From 4feb8e42db16819090cd6cbb8a82252d561c008d Mon Sep 17 00:00:00 2001 From: Andrea Amorese Date: Mon, 6 Sep 2021 14:40:04 +0200 Subject: [PATCH] Built motion from commit 1644b69e.|2.5.345 --- apidoc/api_project.js | 2 +- apidoc/api_project.json | 2 +- server/api/action/action.attributes.js | 2 +- server/api/action/action.controller.js | 2 +- server/api/action/action.model.js | 2 +- server/api/action/action.rpc.js | 2 +- server/api/action/index.js | 2 +- .../analyticCustomReport.attributes.js | 2 +- .../analyticCustomReport.controller.js | 2 +- .../analyticCustomReport.model.js | 2 +- .../analyticCustomReport.rpc.js | 2 +- server/api/analyticCustomReport/index.js | 2 +- .../analyticDefaultReport.attributes.js | 2 +- .../analyticDefaultReport.controller.js | 2 +- .../analyticDefaultReport.model.js | 2 +- .../analyticDefaultReport.rpc.js | 2 +- server/api/analyticDefaultReport/index.js | 2 +- .../analyticExtractedReport.attributes.js | 2 +- .../analyticExtractedReport.controller.js | 2 +- .../analyticExtractedReport.model.js | 2 +- .../analyticExtractedReport.rpc.js | 2 +- server/api/analyticExtractedReport/index.js | 2 +- .../analyticFieldReport.attributes.js | 2 +- .../analyticFieldReport.controller.js | 2 +- .../analyticFieldReport.model.js | 2 +- .../analyticFieldReport/analyticFieldReport.rpc.js | 2 +- server/api/analyticFieldReport/index.js | 2 +- .../analyticMetric/analyticMetric.attributes.js | 2 +- .../analyticMetric/analyticMetric.controller.js | 2 +- server/api/analyticMetric/analyticMetric.model.js | 2 +- server/api/analyticMetric/analyticMetric.rpc.js | 2 +- server/api/analyticMetric/index.js | 2 +- .../analyticTreeReport.attributes.js | 2 +- .../analyticTreeReport.controller.js | 2 +- .../analyticTreeReport/analyticTreeReport.model.js | 2 +- .../analyticTreeReport/analyticTreeReport.rpc.js | 2 +- server/api/analyticTreeReport/index.js | 2 +- server/api/attachment/attachment.attributes.js | 2 +- server/api/attachment/attachment.controller.js | 2 +- server/api/attachment/attachment.model.js | 2 +- server/api/attachment/attachment.rpc.js | 2 +- server/api/attachment/index.js | 2 +- server/api/authGoogle/authGoogle.controller.js | 2 +- server/api/authGoogle/index.js | 2 +- server/api/authLocal/authLocal.controller.js | 2 +- server/api/authLocal/index.js | 2 +- server/api/automation/automation.attributes.js | 2 +- server/api/automation/automation.controller.js | 2 +- server/api/automation/automation.model.js | 2 +- server/api/automation/automation.rpc.js | 2 +- server/api/automation/index.js | 2 +- server/api/campaign/campaign.attributes.js | 2 +- server/api/campaign/campaign.controller.js | 2 +- server/api/campaign/campaign.model.js | 2 +- server/api/campaign/campaign.rpc.js | 2 +- server/api/campaign/index.js | 2 +- server/api/cannedAnswer/cannedAnswer.attributes.js | 2 +- server/api/cannedAnswer/cannedAnswer.controller.js | 2 +- server/api/cannedAnswer/cannedAnswer.model.js | 2 +- server/api/cannedAnswer/cannedAnswer.rpc.js | 2 +- server/api/cannedAnswer/index.js | 2 +- server/api/cdr/cdr.attributes.js | 2 +- server/api/cdr/cdr.controller.js | 2 +- server/api/cdr/cdr.model.js | 2 +- server/api/cdr/cdr.rpc.js | 2 +- server/api/cdr/index.js | 2 +- .../chatApplication/chatApplication.attributes.js | 2 +- .../chatApplication/chatApplication.controller.js | 2 +- .../api/chatApplication/chatApplication.model.js | 2 +- server/api/chatApplication/chatApplication.rpc.js | 2 +- server/api/chatApplication/index.js | 2 +- server/api/chatGroup/chatGroup.attributes.js | 2 +- server/api/chatGroup/chatGroup.controller.js | 2 +- server/api/chatGroup/chatGroup.events.js | 2 +- server/api/chatGroup/chatGroup.model.js | 2 +- server/api/chatGroup/chatGroup.rpc.js | 2 +- server/api/chatGroup/chatGroup.socket.js | 2 +- server/api/chatGroup/index.js | 2 +- .../chatInteraction/chatInteraction.attributes.js | 2 +- .../chatInteraction/chatInteraction.controller.js | 2 +- .../api/chatInteraction/chatInteraction.events.js | 2 +- .../api/chatInteraction/chatInteraction.model.js | 2 +- server/api/chatInteraction/chatInteraction.rpc.js | 2 +- .../api/chatInteraction/chatInteraction.socket.js | 2 +- server/api/chatInteraction/index.js | 2 +- .../chatInternalMessage.attributes.js | 2 +- .../chatInternalMessage.controller.js | 2 +- .../chatInternalMessage.events.js | 2 +- .../chatInternalMessage.model.js | 2 +- .../chatInternalMessage/chatInternalMessage.rpc.js | 2 +- .../chatInternalMessage.socket.js | 2 +- server/api/chatInternalMessage/index.js | 2 +- server/api/chatMessage/chatMessage.attributes.js | 2 +- server/api/chatMessage/chatMessage.controller.js | 2 +- server/api/chatMessage/chatMessage.events.js | 2 +- server/api/chatMessage/chatMessage.model.js | 2 +- server/api/chatMessage/chatMessage.rpc.js | 2 +- server/api/chatMessage/chatMessage.socket.js | 2 +- server/api/chatMessage/index.js | 2 +- .../chatOfflineMessage.attributes.js | 2 +- .../chatOfflineMessage.controller.js | 2 +- .../chatOfflineMessage/chatOfflineMessage.model.js | 2 +- .../chatOfflineMessage/chatOfflineMessage.rpc.js | 2 +- server/api/chatOfflineMessage/index.js | 2 +- .../chatProactiveAction.attributes.js | 2 +- .../chatProactiveAction.controller.js | 2 +- .../chatProactiveAction.model.js | 2 +- .../chatProactiveAction/chatProactiveAction.rpc.js | 2 +- server/api/chatProactiveAction/index.js | 2 +- server/api/chatQueue/chatQueue.attributes.js | 2 +- server/api/chatQueue/chatQueue.controller.js | 2 +- server/api/chatQueue/chatQueue.events.js | 2 +- server/api/chatQueue/chatQueue.model.js | 2 +- server/api/chatQueue/chatQueue.rpc.js | 2 +- server/api/chatQueue/chatQueue.socket.js | 2 +- server/api/chatQueue/index.js | 2 +- .../chatQueueReport/chatQueueReport.attributes.js | 2 +- .../chatQueueReport/chatQueueReport.controller.js | 2 +- .../api/chatQueueReport/chatQueueReport.model.js | 2 +- server/api/chatQueueReport/chatQueueReport.rpc.js | 2 +- server/api/chatQueueReport/index.js | 2 +- .../chatTransferReport.attributes.js | 2 +- .../chatTransferReport.controller.js | 2 +- .../chatTransferReport/chatTransferReport.model.js | 2 +- .../chatTransferReport/chatTransferReport.rpc.js | 2 +- server/api/chatTransferReport/index.js | 2 +- server/api/chatWebsite/chatWebsite.attributes.js | 2 +- server/api/chatWebsite/chatWebsite.controller.js | 2 +- server/api/chatWebsite/chatWebsite.events.js | 2 +- server/api/chatWebsite/chatWebsite.model.js | 2 +- server/api/chatWebsite/chatWebsite.rpc.js | 2 +- server/api/chatWebsite/chatWebsite.socket.js | 2 +- server/api/chatWebsite/index.js | 2 +- .../api/cloudProvider/cloudProvider.attributes.js | 2 +- .../api/cloudProvider/cloudProvider.controller.js | 2 +- server/api/cloudProvider/cloudProvider.model.js | 2 +- server/api/cloudProvider/cloudProvider.rpc.js | 2 +- server/api/cloudProvider/index.js | 2 +- server/api/cmCompany/cmCompany.attributes.js | 2 +- server/api/cmCompany/cmCompany.controller.js | 2 +- server/api/cmCompany/cmCompany.model.js | 2 +- server/api/cmCompany/cmCompany.rpc.js | 2 +- server/api/cmCompany/index.js | 2 +- server/api/cmContact/cmContact.attributes.js | 2 +- server/api/cmContact/cmContact.controller.js | 2 +- server/api/cmContact/cmContact.events.js | 2 +- server/api/cmContact/cmContact.model.js | 2 +- server/api/cmContact/cmContact.rpc.js | 2 +- server/api/cmContact/cmContact.socket.js | 2 +- server/api/cmContact/index.js | 2 +- .../api/cmCustomField/cmCustomField.attributes.js | 2 +- .../api/cmCustomField/cmCustomField.controller.js | 2 +- server/api/cmCustomField/cmCustomField.model.js | 2 +- server/api/cmCustomField/cmCustomField.rpc.js | 2 +- server/api/cmCustomField/index.js | 2 +- server/api/cmHopper/cmHopper.attributes.js | 2 +- server/api/cmHopper/cmHopper.controller.js | 2 +- server/api/cmHopper/cmHopper.model.js | 2 +- server/api/cmHopper/cmHopper.rpc.js | 2 +- server/api/cmHopper/index.js | 2 +- .../api/cmHopperBlack/cmHopperBlack.attributes.js | 2 +- .../api/cmHopperBlack/cmHopperBlack.controller.js | 2 +- server/api/cmHopperBlack/cmHopperBlack.model.js | 2 +- server/api/cmHopperBlack/cmHopperBlack.rpc.js | 2 +- server/api/cmHopperBlack/index.js | 2 +- .../api/cmHopperFinal/cmHopperFinal.attributes.js | 2 +- .../api/cmHopperFinal/cmHopperFinal.controller.js | 2 +- server/api/cmHopperFinal/cmHopperFinal.model.js | 2 +- server/api/cmHopperFinal/cmHopperFinal.rpc.js | 2 +- server/api/cmHopperFinal/index.js | 2 +- .../cmHopperHistory/cmHopperHistory.attributes.js | 2 +- .../cmHopperHistory/cmHopperHistory.controller.js | 2 +- .../api/cmHopperHistory/cmHopperHistory.model.js | 2 +- server/api/cmHopperHistory/cmHopperHistory.rpc.js | 2 +- server/api/cmHopperHistory/index.js | 2 +- server/api/cmList/cmList.attributes.js | 2 +- server/api/cmList/cmList.controller.js | 2 +- server/api/cmList/cmList.events.js | 2 +- server/api/cmList/cmList.model.js | 2 +- server/api/cmList/cmList.rpc.js | 2 +- server/api/cmList/cmList.socket.js | 2 +- server/api/cmList/index.js | 2 +- server/api/condition/condition.attributes.js | 2 +- server/api/condition/condition.controller.js | 2 +- server/api/condition/condition.model.js | 2 +- server/api/condition/condition.rpc.js | 2 +- server/api/condition/index.js | 2 +- server/api/dashboard/dashboard.attributes.js | 2 +- server/api/dashboard/dashboard.controller.js | 2 +- server/api/dashboard/dashboard.events.js | 2 +- server/api/dashboard/dashboard.model.js | 2 +- server/api/dashboard/dashboard.rpc.js | 2 +- server/api/dashboard/dashboard.socket.js | 2 +- server/api/dashboard/index.js | 2 +- .../api/dashboardItem/dashboardItem.attributes.js | 2 +- .../api/dashboardItem/dashboardItem.controller.js | 2 +- server/api/dashboardItem/dashboardItem.events.js | 2 +- server/api/dashboardItem/dashboardItem.model.js | 2 +- server/api/dashboardItem/dashboardItem.rpc.js | 2 +- server/api/dashboardItem/dashboardItem.socket.js | 2 +- server/api/dashboardItem/index.js | 2 +- server/api/disposition/disposition.attributes.js | 2 +- server/api/disposition/disposition.controller.js | 2 +- server/api/disposition/disposition.model.js | 2 +- server/api/disposition/disposition.rpc.js | 2 +- server/api/disposition/index.js | 2 +- server/api/faxAccount/faxAccount.attributes.js | 2 +- server/api/faxAccount/faxAccount.controller.js | 2 +- server/api/faxAccount/faxAccount.events.js | 2 +- server/api/faxAccount/faxAccount.model.js | 2 +- server/api/faxAccount/faxAccount.rpc.js | 2 +- server/api/faxAccount/faxAccount.socket.js | 2 +- server/api/faxAccount/index.js | 2 +- .../faxApplication/faxApplication.attributes.js | 2 +- .../faxApplication/faxApplication.controller.js | 2 +- server/api/faxApplication/faxApplication.model.js | 2 +- server/api/faxApplication/faxApplication.rpc.js | 2 +- server/api/faxApplication/index.js | 2 +- .../faxInteraction/faxInteraction.attributes.js | 2 +- .../faxInteraction/faxInteraction.controller.js | 2 +- server/api/faxInteraction/faxInteraction.events.js | 2 +- server/api/faxInteraction/faxInteraction.model.js | 2 +- server/api/faxInteraction/faxInteraction.rpc.js | 2 +- server/api/faxInteraction/faxInteraction.socket.js | 2 +- server/api/faxInteraction/index.js | 2 +- server/api/faxMessage/faxMessage.attributes.js | 2 +- server/api/faxMessage/faxMessage.controller.js | 2 +- server/api/faxMessage/faxMessage.events.js | 2 +- server/api/faxMessage/faxMessage.model.js | 2 +- server/api/faxMessage/faxMessage.rpc.js | 2 +- server/api/faxMessage/faxMessage.socket.js | 2 +- server/api/faxMessage/index.js | 2 +- server/api/faxQueue/faxQueue.attributes.js | 2 +- server/api/faxQueue/faxQueue.controller.js | 2 +- server/api/faxQueue/faxQueue.events.js | 2 +- server/api/faxQueue/faxQueue.model.js | 2 +- server/api/faxQueue/faxQueue.rpc.js | 2 +- server/api/faxQueue/faxQueue.socket.js | 2 +- server/api/faxQueue/index.js | 2 +- .../faxQueueReport/faxQueueReport.attributes.js | 2 +- .../faxQueueReport/faxQueueReport.controller.js | 2 +- server/api/faxQueueReport/faxQueueReport.model.js | 2 +- server/api/faxQueueReport/faxQueueReport.rpc.js | 2 +- server/api/faxQueueReport/index.js | 2 +- .../faxTransferReport.attributes.js | 2 +- .../faxTransferReport.controller.js | 2 +- .../faxTransferReport/faxTransferReport.model.js | 2 +- .../api/faxTransferReport/faxTransferReport.rpc.js | 2 +- server/api/faxTransferReport/index.js | 2 +- server/api/intDeskAccount/index.js | 2 +- .../intDeskAccount/intDeskAccount.attributes.js | 2 +- .../intDeskAccount/intDeskAccount.controller.js | 2 +- server/api/intDeskAccount/intDeskAccount.model.js | 2 +- server/api/intDeskAccount/intDeskAccount.rpc.js | 2 +- server/api/intDeskConfiguration/index.js | 2 +- .../intDeskConfiguration.attributes.js | 2 +- .../intDeskConfiguration.controller.js | 2 +- .../intDeskConfiguration.model.js | 2 +- .../intDeskConfiguration.rpc.js | 2 +- server/api/intDeskField/index.js | 2 +- server/api/intDeskField/intDeskField.attributes.js | 2 +- server/api/intDeskField/intDeskField.controller.js | 2 +- server/api/intDeskField/intDeskField.model.js | 2 +- server/api/intDeskField/intDeskField.rpc.js | 2 +- server/api/intDynamics365Account/index.js | 2 +- .../intDynamics365Account.attributes.js | 2 +- .../intDynamics365Account.controller.js | 2 +- .../intDynamics365Account.model.js | 2 +- .../intDynamics365Account.rpc.js | 2 +- server/api/intDynamics365Configuration/index.js | 2 +- .../intDynamics365Configuration.attributes.js | 2 +- .../intDynamics365Configuration.controller.js | 2 +- .../intDynamics365Configuration.model.js | 2 +- .../intDynamics365Configuration.rpc.js | 2 +- server/api/intDynamics365Field/index.js | 2 +- .../intDynamics365Field.attributes.js | 2 +- .../intDynamics365Field.controller.js | 2 +- .../intDynamics365Field.model.js | 2 +- .../intDynamics365Field/intDynamics365Field.rpc.js | 2 +- server/api/intFreshdeskAccount/index.js | 2 +- .../intFreshdeskAccount.attributes.js | 2 +- .../intFreshdeskAccount.controller.js | 2 +- .../intFreshdeskAccount.model.js | 2 +- .../intFreshdeskAccount/intFreshdeskAccount.rpc.js | 2 +- server/api/intFreshdeskConfiguration/index.js | 2 +- .../intFreshdeskConfiguration.attributes.js | 2 +- .../intFreshdeskConfiguration.controller.js | 2 +- .../intFreshdeskConfiguration.model.js | 2 +- .../intFreshdeskConfiguration.rpc.js | 2 +- server/api/intFreshdeskField/index.js | 2 +- .../intFreshdeskField.attributes.js | 2 +- .../intFreshdeskField.controller.js | 2 +- .../intFreshdeskField/intFreshdeskField.model.js | 2 +- .../api/intFreshdeskField/intFreshdeskField.rpc.js | 2 +- server/api/intFreshsalesAccount/index.js | 2 +- .../intFreshsalesAccount.attributes.js | 2 +- .../intFreshsalesAccount.controller.js | 2 +- .../intFreshsalesAccount.model.js | 2 +- .../intFreshsalesAccount.rpc.js | 2 +- server/api/intFreshsalesConfiguration/index.js | 2 +- .../intFreshsalesConfiguration.attributes.js | 2 +- .../intFreshsalesConfiguration.controller.js | 2 +- .../intFreshsalesConfiguration.model.js | 2 +- .../intFreshsalesConfiguration.rpc.js | 2 +- server/api/intFreshsalesField/index.js | 2 +- .../intFreshsalesField.attributes.js | 2 +- .../intFreshsalesField.controller.js | 2 +- .../intFreshsalesField/intFreshsalesField.model.js | 2 +- .../intFreshsalesField/intFreshsalesField.rpc.js | 2 +- server/api/intSalesforceAccount/index.js | 2 +- .../intSalesforceAccount.attributes.js | 2 +- .../intSalesforceAccount.controller.js | 2 +- .../intSalesforceAccount.model.js | 2 +- .../intSalesforceAccount.rpc.js | 2 +- server/api/intSalesforceConfiguration/index.js | 2 +- .../intSalesforceConfiguration.attributes.js | 2 +- .../intSalesforceConfiguration.controller.js | 2 +- .../intSalesforceConfiguration.model.js | 2 +- .../intSalesforceConfiguration.rpc.js | 2 +- server/api/intSalesforceField/index.js | 2 +- .../intSalesforceField.attributes.js | 2 +- .../intSalesforceField.controller.js | 2 +- .../intSalesforceField/intSalesforceField.model.js | 2 +- .../intSalesforceField/intSalesforceField.rpc.js | 2 +- server/api/intServicenowAccount/index.js | 2 +- .../intServicenowAccount.attributes.js | 2 +- .../intServicenowAccount.controller.js | 2 +- .../intServicenowAccount.model.js | 2 +- .../intServicenowAccount.rpc.js | 2 +- server/api/intServicenowConfiguration/index.js | 2 +- .../intServicenowConfiguration.attributes.js | 2 +- .../intServicenowConfiguration.controller.js | 2 +- .../intServicenowConfiguration.model.js | 2 +- .../intServicenowConfiguration.rpc.js | 2 +- server/api/intServicenowField/index.js | 2 +- .../intServicenowField.attributes.js | 2 +- .../intServicenowField.controller.js | 2 +- .../intServicenowField/intServicenowField.model.js | 2 +- .../intServicenowField/intServicenowField.rpc.js | 2 +- server/api/intSugarcrmAccount/index.js | 2 +- .../intSugarcrmAccount.attributes.js | 2 +- .../intSugarcrmAccount.controller.js | 2 +- .../intSugarcrmAccount/intSugarcrmAccount.model.js | 2 +- .../intSugarcrmAccount/intSugarcrmAccount.rpc.js | 2 +- server/api/intSugarcrmConfiguration/index.js | 2 +- .../intSugarcrmConfiguration.attributes.js | 2 +- .../intSugarcrmConfiguration.controller.js | 2 +- .../intSugarcrmConfiguration.model.js | 2 +- .../intSugarcrmConfiguration.rpc.js | 2 +- server/api/intSugarcrmField/index.js | 2 +- .../intSugarcrmField.attributes.js | 2 +- .../intSugarcrmField.controller.js | 2 +- .../api/intSugarcrmField/intSugarcrmField.model.js | 2 +- .../api/intSugarcrmField/intSugarcrmField.rpc.js | 2 +- server/api/intVtigerAccount/index.js | 2 +- .../intVtigerAccount.attributes.js | 2 +- .../intVtigerAccount.controller.js | 2 +- .../api/intVtigerAccount/intVtigerAccount.model.js | 2 +- .../api/intVtigerAccount/intVtigerAccount.rpc.js | 2 +- server/api/intVtigerConfiguration/index.js | 2 +- .../intVtigerConfiguration.attributes.js | 2 +- .../intVtigerConfiguration.controller.js | 2 +- .../intVtigerConfiguration.model.js | 2 +- .../intVtigerConfiguration.rpc.js | 2 +- server/api/intVtigerField/index.js | 2 +- .../intVtigerField/intVtigerField.attributes.js | 2 +- .../intVtigerField/intVtigerField.controller.js | 2 +- server/api/intVtigerField/intVtigerField.model.js | 2 +- server/api/intVtigerField/intVtigerField.rpc.js | 2 +- server/api/intZendeskAccount/index.js | 2 +- .../intZendeskAccount.attributes.js | 2 +- .../intZendeskAccount.controller.js | 2 +- .../intZendeskAccount/intZendeskAccount.model.js | 2 +- .../api/intZendeskAccount/intZendeskAccount.rpc.js | 2 +- server/api/intZendeskConfiguration/index.js | 2 +- .../intZendeskConfiguration.attributes.js | 2 +- .../intZendeskConfiguration.controller.js | 2 +- .../intZendeskConfiguration.model.js | 2 +- .../intZendeskConfiguration.rpc.js | 2 +- server/api/intZendeskField/index.js | 2 +- .../intZendeskField/intZendeskField.attributes.js | 2 +- .../intZendeskField/intZendeskField.controller.js | 2 +- .../api/intZendeskField/intZendeskField.model.js | 2 +- server/api/intZendeskField/intZendeskField.rpc.js | 2 +- server/api/intZohoAccount/index.js | 2 +- .../intZohoAccount/intZohoAccount.attributes.js | 2 +- .../intZohoAccount/intZohoAccount.controller.js | 2 +- server/api/intZohoAccount/intZohoAccount.model.js | 2 +- server/api/intZohoAccount/intZohoAccount.rpc.js | 2 +- server/api/intZohoConfiguration/index.js | 2 +- .../intZohoConfiguration.attributes.js | 2 +- .../intZohoConfiguration.controller.js | 2 +- .../intZohoConfiguration.model.js | 2 +- .../intZohoConfiguration.rpc.js | 2 +- server/api/intZohoField/index.js | 2 +- server/api/intZohoField/intZohoField.attributes.js | 2 +- server/api/intZohoField/intZohoField.controller.js | 2 +- server/api/intZohoField/intZohoField.model.js | 2 +- server/api/intZohoField/intZohoField.rpc.js | 2 +- server/api/integration/index.js | 2 +- server/api/integration/integration.attributes.js | 2 +- server/api/integration/integration.controller.js | 2 +- server/api/integration/integration.model.js | 2 +- server/api/integration/integration.rpc.js | 2 +- server/api/integrationReport/index.js | 2 +- .../integrationReport.attributes.js | 2 +- .../integrationReport.controller.js | 2 +- .../integrationReport/integrationReport.model.js | 2 +- .../api/integrationReport/integrationReport.rpc.js | 2 +- server/api/interval/index.js | 2 +- server/api/interval/interval.attributes.js | 2 +- server/api/interval/interval.controller.js | 2 +- server/api/interval/interval.model.js | 2 +- server/api/interval/interval.rpc.js | 2 +- server/api/jira/index.js | 2 +- server/api/jira/jira.controller.js | 2 +- server/api/jscriptyAnswerReport/index.js | 2 +- .../jscriptyAnswerReport.attributes.js | 2 +- .../jscriptyAnswerReport.controller.js | 2 +- .../jscriptyAnswerReport.model.js | 2 +- .../jscriptyAnswerReport.rpc.js | 2 +- server/api/jscriptyProject/index.js | 2 +- .../jscriptyProject/jscriptyProject.attributes.js | 2 +- .../jscriptyProject/jscriptyProject.controller.js | 2 +- .../api/jscriptyProject/jscriptyProject.model.js | 2 +- server/api/jscriptyProject/jscriptyProject.rpc.js | 2 +- server/api/jscriptyQuestionReport/index.js | 2 +- .../jscriptyQuestionReport.attributes.js | 2 +- .../jscriptyQuestionReport.controller.js | 2 +- .../jscriptyQuestionReport.model.js | 2 +- .../jscriptyQuestionReport.rpc.js | 2 +- server/api/jscriptySessionReport/index.js | 2 +- .../jscriptySessionReport.attributes.js | 2 +- .../jscriptySessionReport.controller.js | 2 +- .../jscriptySessionReport.model.js | 2 +- .../jscriptySessionReport.rpc.js | 2 +- server/api/license/index.js | 2 +- server/api/license/license.attributes.js | 2 +- server/api/license/license.controller.js | 2 +- server/api/license/license.model.js | 2 +- server/api/license/license.rpc.js | 2 +- server/api/mailAccount/index.js | 2 +- server/api/mailAccount/mailAccount.attributes.js | 2 +- server/api/mailAccount/mailAccount.controller.js | 2 +- server/api/mailAccount/mailAccount.events.js | 2 +- server/api/mailAccount/mailAccount.model.js | 2 +- server/api/mailAccount/mailAccount.rpc.js | 2 +- server/api/mailAccount/mailAccount.socket.js | 2 +- server/api/mailApplication/index.js | 2 +- .../mailApplication/mailApplication.attributes.js | 2 +- .../mailApplication/mailApplication.controller.js | 2 +- .../api/mailApplication/mailApplication.model.js | 2 +- server/api/mailApplication/mailApplication.rpc.js | 2 +- server/api/mailInteraction/index.js | 2 +- .../mailInteraction/mailInteraction.attributes.js | 2 +- .../mailInteraction/mailInteraction.controller.js | 2 +- .../api/mailInteraction/mailInteraction.events.js | 2 +- .../api/mailInteraction/mailInteraction.model.js | 2 +- server/api/mailInteraction/mailInteraction.rpc.js | 2 +- .../api/mailInteraction/mailInteraction.socket.js | 2 +- server/api/mailMessage/index.js | 2 +- server/api/mailMessage/mailMessage.attributes.js | 2 +- server/api/mailMessage/mailMessage.controller.js | 2 +- server/api/mailMessage/mailMessage.events.js | 2 +- server/api/mailMessage/mailMessage.model.js | 2 +- server/api/mailMessage/mailMessage.rpc.js | 2 +- server/api/mailMessage/mailMessage.socket.js | 2 +- server/api/mailQueue/index.js | 2 +- server/api/mailQueue/mailQueue.attributes.js | 2 +- server/api/mailQueue/mailQueue.controller.js | 2 +- server/api/mailQueue/mailQueue.events.js | 2 +- server/api/mailQueue/mailQueue.model.js | 2 +- server/api/mailQueue/mailQueue.rpc.js | 2 +- server/api/mailQueue/mailQueue.socket.js | 2 +- server/api/mailQueueReport/index.js | 2 +- .../mailQueueReport/mailQueueReport.attributes.js | 2 +- .../mailQueueReport/mailQueueReport.controller.js | 2 +- .../api/mailQueueReport/mailQueueReport.model.js | 2 +- server/api/mailQueueReport/mailQueueReport.rpc.js | 2 +- server/api/mailServerIn/index.js | 2 +- server/api/mailServerIn/mailServerIn.attributes.js | 2 +- server/api/mailServerIn/mailServerIn.model.js | 2 +- server/api/mailServerIn/mailServerIn.rpc.js | 2 +- server/api/mailServerOut/index.js | 2 +- .../api/mailServerOut/mailServerOut.attributes.js | 2 +- .../api/mailServerOut/mailServerOut.controller.js | 2 +- server/api/mailServerOut/mailServerOut.model.js | 2 +- server/api/mailServerOut/mailServerOut.rpc.js | 2 +- server/api/mailSubstatus/index.js | 2 +- .../api/mailSubstatus/mailSubstatus.attributes.js | 2 +- .../api/mailSubstatus/mailSubstatus.controller.js | 2 +- server/api/mailSubstatus/mailSubstatus.model.js | 2 +- server/api/mailSubstatus/mailSubstatus.rpc.js | 2 +- server/api/mailTransferReport/index.js | 2 +- .../mailTransferReport.attributes.js | 2 +- .../mailTransferReport.controller.js | 2 +- .../mailTransferReport/mailTransferReport.model.js | 2 +- .../mailTransferReport/mailTransferReport.rpc.js | 2 +- server/api/memberReport/index.js | 2 +- server/api/memberReport/memberReport.attributes.js | 2 +- server/api/memberReport/memberReport.controller.js | 2 +- server/api/memberReport/memberReport.model.js | 2 +- server/api/memberReport/memberReport.rpc.js | 2 +- server/api/migration/index.js | 2 +- server/api/migration/migration.attributes.js | 2 +- server/api/migration/migration.controller.js | 2 +- server/api/migration/migration.model.js | 2 +- server/api/migration/migration.rpc.js | 2 +- server/api/network/index.js | 2 +- server/api/network/network.attributes.js | 2 +- server/api/network/network.controller.js | 2 +- server/api/network/network.model.js | 2 +- server/api/network/network.rpc.js | 2 +- server/api/openchannelAccount/index.js | 2 +- .../openchannelAccount.attributes.js | 2 +- .../openchannelAccount.controller.js | 2 +- .../openchannelAccount.events.js | 2 +- .../openchannelAccount/openchannelAccount.model.js | 2 +- .../openchannelAccount/openchannelAccount.rpc.js | 2 +- .../openchannelAccount.socket.js | 2 +- server/api/openchannelApplication/index.js | 2 +- .../openchannelApplication.attributes.js | 2 +- .../openchannelApplication.controller.js | 2 +- .../openchannelApplication.model.js | 2 +- .../openchannelApplication.rpc.js | 2 +- server/api/openchannelInteraction/index.js | 2 +- .../openchannelInteraction.attributes.js | 2 +- .../openchannelInteraction.controller.js | 2 +- .../openchannelInteraction.events.js | 2 +- .../openchannelInteraction.model.js | 2 +- .../openchannelInteraction.rpc.js | 2 +- .../openchannelInteraction.socket.js | 2 +- server/api/openchannelMessage/index.js | 2 +- .../openchannelMessage.attributes.js | 2 +- .../openchannelMessage.controller.js | 2 +- .../openchannelMessage.events.js | 2 +- .../openchannelMessage/openchannelMessage.model.js | 2 +- .../openchannelMessage/openchannelMessage.rpc.js | 2 +- .../openchannelMessage.socket.js | 2 +- server/api/openchannelQueue/index.js | 2 +- .../openchannelQueue.attributes.js | 2 +- .../openchannelQueue.controller.js | 2 +- .../openchannelQueue/openchannelQueue.events.js | 2 +- .../api/openchannelQueue/openchannelQueue.model.js | 2 +- .../api/openchannelQueue/openchannelQueue.rpc.js | 2 +- .../openchannelQueue/openchannelQueue.socket.js | 2 +- server/api/openchannelQueueReport/index.js | 2 +- .../openchannelQueueReport.attributes.js | 2 +- .../openchannelQueueReport.controller.js | 2 +- .../openchannelQueueReport.model.js | 2 +- .../openchannelQueueReport.rpc.js | 2 +- server/api/openchannelTransferReport/index.js | 2 +- .../openchannelTransferReport.attributes.js | 2 +- .../openchannelTransferReport.controller.js | 2 +- .../openchannelTransferReport.model.js | 2 +- .../openchannelTransferReport.rpc.js | 2 +- server/api/pause/index.js | 2 +- server/api/pause/pause.attributes.js | 2 +- server/api/pause/pause.controller.js | 2 +- server/api/pause/pause.model.js | 2 +- server/api/pause/pause.rpc.js | 2 +- server/api/plugin/index.js | 2 +- server/api/plugin/plugin.attributes.js | 2 +- server/api/plugin/plugin.controller.js | 2 +- server/api/plugin/plugin.events.js | 2 +- server/api/plugin/plugin.model.js | 2 +- server/api/plugin/plugin.rpc.js | 2 +- server/api/plugin/plugin.socket.js | 2 +- server/api/pm2/index.js | 2 +- server/api/pm2/pm2.controller.js | 2 +- server/api/realtime/index.js | 2 +- server/api/realtime/realtime.controller.js | 2 +- server/api/reportAgentPreview/index.js | 2 +- .../reportAgentPreview.attributes.js | 2 +- .../reportAgentPreview/reportAgentPreview.model.js | 2 +- .../reportAgentPreview/reportAgentPreview.rpc.js | 2 +- server/api/rpc/index.js | 2 +- server/api/rpc/rpc.controller.js | 2 +- server/api/schedule/index.js | 2 +- server/api/schedule/schedule.attributes.js | 2 +- server/api/schedule/schedule.controller.js | 2 +- server/api/schedule/schedule.model.js | 2 +- server/api/schedule/schedule.rpc.js | 2 +- server/api/screenRecording/index.js | 2 +- .../screenRecording/screenRecording.attributes.js | 2 +- .../screenRecording/screenRecording.controller.js | 2 +- .../api/screenRecording/screenRecording.model.js | 2 +- server/api/screenRecording/screenRecording.rpc.js | 2 +- server/api/setting/index.js | 2 +- server/api/setting/setting.attributes.js | 2 +- server/api/setting/setting.controller.js | 2 +- server/api/setting/setting.model.js | 2 +- server/api/setting/setting.rpc.js | 2 +- server/api/smsAccount/index.js | 2 +- server/api/smsAccount/smsAccount.attributes.js | 2 +- server/api/smsAccount/smsAccount.controller.js | 2 +- server/api/smsAccount/smsAccount.events.js | 2 +- server/api/smsAccount/smsAccount.model.js | 2 +- server/api/smsAccount/smsAccount.rpc.js | 2 +- server/api/smsAccount/smsAccount.socket.js | 2 +- server/api/smsApplication/index.js | 2 +- .../smsApplication/smsApplication.attributes.js | 2 +- .../smsApplication/smsApplication.controller.js | 2 +- server/api/smsApplication/smsApplication.model.js | 2 +- server/api/smsApplication/smsApplication.rpc.js | 2 +- server/api/smsInteraction/index.js | 2 +- .../smsInteraction/smsInteraction.attributes.js | 2 +- .../smsInteraction/smsInteraction.controller.js | 2 +- server/api/smsInteraction/smsInteraction.events.js | 2 +- server/api/smsInteraction/smsInteraction.model.js | 2 +- server/api/smsInteraction/smsInteraction.rpc.js | 2 +- server/api/smsInteraction/smsInteraction.socket.js | 2 +- server/api/smsMessage/index.js | 2 +- server/api/smsMessage/smsMessage.attributes.js | 2 +- server/api/smsMessage/smsMessage.controller.js | 2 +- server/api/smsMessage/smsMessage.events.js | 2 +- server/api/smsMessage/smsMessage.model.js | 2 +- server/api/smsMessage/smsMessage.rpc.js | 2 +- server/api/smsMessage/smsMessage.socket.js | 2 +- server/api/smsQueue/index.js | 2 +- server/api/smsQueue/smsQueue.attributes.js | 2 +- server/api/smsQueue/smsQueue.controller.js | 2 +- server/api/smsQueue/smsQueue.events.js | 2 +- server/api/smsQueue/smsQueue.model.js | 2 +- server/api/smsQueue/smsQueue.rpc.js | 2 +- server/api/smsQueue/smsQueue.socket.js | 2 +- server/api/smsQueueReport/index.js | 2 +- .../smsQueueReport/smsQueueReport.attributes.js | 2 +- .../smsQueueReport/smsQueueReport.controller.js | 2 +- server/api/smsQueueReport/smsQueueReport.model.js | 2 +- server/api/smsQueueReport/smsQueueReport.rpc.js | 2 +- server/api/smsTransferReport/index.js | 2 +- .../smsTransferReport.attributes.js | 2 +- .../smsTransferReport.controller.js | 2 +- .../smsTransferReport/smsTransferReport.model.js | 2 +- .../api/smsTransferReport/smsTransferReport.rpc.js | 2 +- server/api/sound/index.js | 2 +- server/api/sound/sound.attributes.js | 2 +- server/api/sound/sound.controller.js | 2 +- server/api/sound/sound.model.js | 2 +- server/api/sound/sound.rpc.js | 2 +- server/api/squareMessage/index.js | 2 +- .../api/squareMessage/squareMessage.attributes.js | 2 +- .../api/squareMessage/squareMessage.controller.js | 2 +- server/api/squareMessage/squareMessage.model.js | 2 +- server/api/squareMessage/squareMessage.rpc.js | 2 +- server/api/squareOdbc/index.js | 2 +- server/api/squareOdbc/squareOdbc.attributes.js | 2 +- server/api/squareOdbc/squareOdbc.controller.js | 2 +- server/api/squareOdbc/squareOdbc.model.js | 2 +- server/api/squareOdbc/squareOdbc.rpc.js | 2 +- server/api/squareProject/index.js | 2 +- .../api/squareProject/squareProject.attributes.js | 2 +- .../api/squareProject/squareProject.controller.js | 2 +- server/api/squareProject/squareProject.events.js | 2 +- server/api/squareProject/squareProject.model.js | 2 +- server/api/squareProject/squareProject.rpc.js | 2 +- server/api/squareProject/squareProject.socket.js | 2 +- server/api/squareRecording/index.js | 2 +- .../squareRecording/squareRecording.attributes.js | 2 +- .../squareRecording/squareRecording.controller.js | 2 +- .../api/squareRecording/squareRecording.model.js | 2 +- server/api/squareRecording/squareRecording.rpc.js | 2 +- server/api/squareReport/index.js | 2 +- server/api/squareReport/squareReport.attributes.js | 2 +- server/api/squareReport/squareReport.controller.js | 2 +- server/api/squareReport/squareReport.model.js | 2 +- server/api/squareReport/squareReport.rpc.js | 2 +- server/api/squareReportDetail/index.js | 2 +- .../squareReportDetail.attributes.js | 2 +- .../squareReportDetail.controller.js | 2 +- .../squareReportDetail/squareReportDetail.model.js | 2 +- .../squareReportDetail/squareReportDetail.rpc.js | 2 +- server/api/system/index.js | 2 +- server/api/system/system.controller.js | 2 +- server/api/tag/index.js | 2 +- server/api/tag/tag.attributes.js | 2 +- server/api/tag/tag.controller.js | 2 +- server/api/tag/tag.model.js | 2 +- server/api/tag/tag.rpc.js | 2 +- server/api/team/index.js | 2 +- server/api/team/team.attributes.js | 2 +- server/api/team/team.controller.js | 2 +- server/api/team/team.events.js | 2 +- server/api/team/team.model.js | 2 +- server/api/team/team.rpc.js | 2 +- server/api/team/team.socket.js | 2 +- server/api/teamVoicePrefix/index.js | 18 ------------------ .../teamVoicePrefix/teamVoicePrefix.attributes.js | 2 +- .../api/teamVoicePrefix/teamVoicePrefix.model.js | 2 +- server/api/teamVoicePrefix/teamVoicePrefix.rpc.js | 18 ------------------ server/api/teamVoiceQueue/index.js | 2 +- .../teamVoiceQueue/teamVoiceQueue.attributes.js | 2 +- server/api/teamVoiceQueue/teamVoiceQueue.model.js | 2 +- server/api/teamVoiceQueue/teamVoiceQueue.rpc.js | 2 +- server/api/template/index.js | 2 +- server/api/template/template.attributes.js | 2 +- server/api/template/template.controller.js | 2 +- server/api/template/template.model.js | 2 +- server/api/template/template.rpc.js | 2 +- server/api/trigger/index.js | 2 +- server/api/trigger/trigger.attributes.js | 2 +- server/api/trigger/trigger.controller.js | 2 +- server/api/trigger/trigger.model.js | 2 +- server/api/trigger/trigger.rpc.js | 2 +- server/api/trunk/index.js | 2 +- server/api/trunk/trunk.attributes.js | 2 +- server/api/trunk/trunk.controller.js | 2 +- server/api/trunk/trunk.model.js | 2 +- server/api/trunk/trunk.rpc.js | 2 +- server/api/user/index.js | 2 +- server/api/user/user.attributes.js | 2 +- server/api/user/user.controller.js | 2 +- server/api/user/user.events.js | 2 +- server/api/user/user.model.js | 2 +- server/api/user/user.rpc.js | 2 +- server/api/user/user.socket.js | 2 +- server/api/userChatQueue/index.js | 2 +- .../api/userChatQueue/userChatQueue.attributes.js | 2 +- server/api/userChatQueue/userChatQueue.model.js | 2 +- server/api/userChatQueue/userChatQueue.rpc.js | 2 +- server/api/userFaxQueue/index.js | 2 +- server/api/userFaxQueue/userFaxQueue.attributes.js | 2 +- server/api/userFaxQueue/userFaxQueue.model.js | 2 +- server/api/userFaxQueue/userFaxQueue.rpc.js | 2 +- server/api/userMailQueue/index.js | 2 +- .../api/userMailQueue/userMailQueue.attributes.js | 2 +- server/api/userMailQueue/userMailQueue.model.js | 2 +- server/api/userMailQueue/userMailQueue.rpc.js | 2 +- server/api/userNotification/index.js | 2 +- .../userNotification.attributes.js | 2 +- .../userNotification.controller.js | 2 +- .../userNotification/userNotification.events.js | 2 +- .../api/userNotification/userNotification.model.js | 2 +- .../api/userNotification/userNotification.rpc.js | 2 +- .../userNotification/userNotification.socket.js | 2 +- server/api/userOpenchannelQueue/index.js | 2 +- .../userOpenchannelQueue.attributes.js | 2 +- .../userOpenchannelQueue.model.js | 2 +- .../userOpenchannelQueue.rpc.js | 2 +- server/api/userProfile/index.js | 2 +- server/api/userProfile/userProfile.attributes.js | 2 +- server/api/userProfile/userProfile.controller.js | 2 +- server/api/userProfile/userProfile.events.js | 2 +- server/api/userProfile/userProfile.model.js | 2 +- server/api/userProfile/userProfile.rpc.js | 2 +- server/api/userProfile/userProfile.socket.js | 2 +- server/api/userProfileResource/index.js | 2 +- .../userProfileResource.attributes.js | 2 +- .../userProfileResource.controller.js | 2 +- .../userProfileResource.model.js | 2 +- .../userProfileResource/userProfileResource.rpc.js | 2 +- server/api/userProfileSection/index.js | 2 +- .../userProfileSection.attributes.js | 2 +- .../userProfileSection.controller.js | 2 +- .../userProfileSection/userProfileSection.model.js | 2 +- .../userProfileSection/userProfileSection.rpc.js | 2 +- server/api/userSmsQueue/index.js | 2 +- server/api/userSmsQueue/userSmsQueue.attributes.js | 2 +- server/api/userSmsQueue/userSmsQueue.model.js | 2 +- server/api/userSmsQueue/userSmsQueue.rpc.js | 2 +- server/api/userVoicePrefix/index.js | 18 ------------------ .../userVoicePrefix/userVoicePrefix.attributes.js | 2 +- .../api/userVoicePrefix/userVoicePrefix.model.js | 2 +- server/api/userVoicePrefix/userVoicePrefix.rpc.js | 18 ------------------ server/api/userVoiceQueue/index.js | 2 +- .../userVoiceQueue/userVoiceQueue.attributes.js | 2 +- server/api/userVoiceQueue/userVoiceQueue.model.js | 2 +- server/api/userVoiceQueue/userVoiceQueue.rpc.js | 2 +- server/api/userVoiceQueueRt/index.js | 2 +- .../userVoiceQueueRt.attributes.js | 2 +- .../userVoiceQueueRt/userVoiceQueueRt.events.js | 2 +- .../api/userVoiceQueueRt/userVoiceQueueRt.model.js | 2 +- .../api/userVoiceQueueRt/userVoiceQueueRt.rpc.js | 2 +- .../userVoiceQueueRt/userVoiceQueueRt.socket.js | 2 +- server/api/userWhatsappQueue/index.js | 2 +- .../userWhatsappQueue.attributes.js | 2 +- .../userWhatsappQueue/userWhatsappQueue.model.js | 2 +- .../api/userWhatsappQueue/userWhatsappQueue.rpc.js | 2 +- server/api/variable/index.js | 2 +- server/api/variable/variable.attributes.js | 2 +- server/api/variable/variable.controller.js | 2 +- server/api/variable/variable.model.js | 2 +- server/api/variable/variable.rpc.js | 2 +- server/api/version/index.js | 2 +- server/api/version/version.controller.js | 2 +- server/api/voiceAgentReport/index.js | 2 +- .../voiceAgentReport.attributes.js | 2 +- .../voiceAgentReport.controller.js | 2 +- .../api/voiceAgentReport/voiceAgentReport.model.js | 2 +- .../api/voiceAgentReport/voiceAgentReport.rpc.js | 2 +- server/api/voiceCallReport/index.js | 2 +- .../voiceCallReport/voiceCallReport.attributes.js | 2 +- .../voiceCallReport/voiceCallReport.controller.js | 2 +- .../api/voiceCallReport/voiceCallReport.model.js | 2 +- server/api/voiceCallReport/voiceCallReport.rpc.js | 2 +- server/api/voiceChanSpy/index.js | 2 +- server/api/voiceChanSpy/voiceChanSpy.attributes.js | 2 +- server/api/voiceChanSpy/voiceChanSpy.controller.js | 2 +- server/api/voiceChanSpy/voiceChanSpy.model.js | 2 +- server/api/voiceChanSpy/voiceChanSpy.rpc.js | 2 +- server/api/voiceContext/index.js | 2 +- server/api/voiceContext/voiceContext.attributes.js | 2 +- server/api/voiceContext/voiceContext.controller.js | 2 +- server/api/voiceContext/voiceContext.model.js | 2 +- server/api/voiceContext/voiceContext.rpc.js | 2 +- server/api/voiceDialReport/index.js | 2 +- .../voiceDialReport/voiceDialReport.attributes.js | 2 +- .../voiceDialReport/voiceDialReport.controller.js | 2 +- .../api/voiceDialReport/voiceDialReport.model.js | 2 +- server/api/voiceDialReport/voiceDialReport.rpc.js | 2 +- server/api/voiceExtension/index.js | 2 +- .../voiceExtension/voiceExtension.attributes.js | 2 +- .../voiceExtension/voiceExtension.controller.js | 2 +- server/api/voiceExtension/voiceExtension.events.js | 2 +- server/api/voiceExtension/voiceExtension.model.js | 2 +- server/api/voiceExtension/voiceExtension.rpc.js | 2 +- server/api/voiceExtension/voiceExtension.socket.js | 2 +- server/api/voiceMail/index.js | 2 +- server/api/voiceMail/voiceMail.attributes.js | 2 +- server/api/voiceMail/voiceMail.controller.js | 2 +- server/api/voiceMail/voiceMail.model.js | 2 +- server/api/voiceMail/voiceMail.rpc.js | 2 +- server/api/voiceMailMessage/index.js | 2 +- .../voiceMailMessage.attributes.js | 2 +- .../voiceMailMessage.controller.js | 2 +- .../api/voiceMailMessage/voiceMailMessage.model.js | 2 +- .../api/voiceMailMessage/voiceMailMessage.rpc.js | 2 +- server/api/voiceMusicOnHold/index.js | 2 +- .../voiceMusicOnHold.attributes.js | 2 +- .../voiceMusicOnHold.controller.js | 2 +- .../api/voiceMusicOnHold/voiceMusicOnHold.model.js | 2 +- .../api/voiceMusicOnHold/voiceMusicOnHold.rpc.js | 2 +- server/api/voicePrefix/index.js | 2 +- server/api/voicePrefix/voicePrefix.attributes.js | 2 +- server/api/voicePrefix/voicePrefix.controller.js | 2 +- server/api/voicePrefix/voicePrefix.events.js | 2 +- server/api/voicePrefix/voicePrefix.model.js | 2 +- server/api/voicePrefix/voicePrefix.rpc.js | 2 +- server/api/voicePrefix/voicePrefix.socket.js | 2 +- server/api/voiceQueue/index.js | 2 +- server/api/voiceQueue/voiceQueue.attributes.js | 2 +- server/api/voiceQueue/voiceQueue.controller.js | 2 +- server/api/voiceQueue/voiceQueue.events.js | 2 +- server/api/voiceQueue/voiceQueue.model.js | 2 +- server/api/voiceQueue/voiceQueue.rpc.js | 2 +- server/api/voiceQueue/voiceQueue.socket.js | 2 +- server/api/voiceQueueReport/index.js | 2 +- .../voiceQueueReport.attributes.js | 2 +- .../voiceQueueReport.controller.js | 2 +- .../voiceQueueReport/voiceQueueReport.events.js | 2 +- .../api/voiceQueueReport/voiceQueueReport.model.js | 2 +- .../api/voiceQueueReport/voiceQueueReport.rpc.js | 2 +- .../voiceQueueReport/voiceQueueReport.socket.js | 2 +- server/api/voiceQueuesLog/index.js | 2 +- .../voiceQueuesLog/voiceQueuesLog.attributes.js | 2 +- .../voiceQueuesLog/voiceQueuesLog.controller.js | 2 +- server/api/voiceQueuesLog/voiceQueuesLog.model.js | 2 +- server/api/voiceQueuesLog/voiceQueuesLog.rpc.js | 2 +- server/api/voiceRecording/index.js | 2 +- .../voiceRecording/voiceRecording.attributes.js | 2 +- .../voiceRecording/voiceRecording.controller.js | 2 +- server/api/voiceRecording/voiceRecording.model.js | 2 +- server/api/voiceRecording/voiceRecording.rpc.js | 2 +- server/api/voiceTransferReport/index.js | 2 +- .../voiceTransferReport.attributes.js | 2 +- .../voiceTransferReport.controller.js | 2 +- .../voiceTransferReport.model.js | 2 +- .../voiceTransferReport/voiceTransferReport.rpc.js | 2 +- server/api/webbar/index.js | 2 +- server/api/webbar/webbar.controller.js | 2 +- server/api/whatsappAccount/index.js | 2 +- .../whatsappAccount/whatsappAccount.attributes.js | 2 +- .../whatsappAccount/whatsappAccount.controller.js | 2 +- .../api/whatsappAccount/whatsappAccount.events.js | 2 +- .../api/whatsappAccount/whatsappAccount.model.js | 2 +- server/api/whatsappAccount/whatsappAccount.rpc.js | 2 +- .../api/whatsappAccount/whatsappAccount.socket.js | 2 +- server/api/whatsappApplication/index.js | 2 +- .../whatsappApplication.attributes.js | 2 +- .../whatsappApplication.controller.js | 2 +- .../whatsappApplication.model.js | 2 +- .../whatsappApplication/whatsappApplication.rpc.js | 2 +- server/api/whatsappInteraction/index.js | 2 +- .../whatsappInteraction.attributes.js | 2 +- .../whatsappInteraction.controller.js | 2 +- .../whatsappInteraction.events.js | 2 +- .../whatsappInteraction.model.js | 2 +- .../whatsappInteraction/whatsappInteraction.rpc.js | 2 +- .../whatsappInteraction.socket.js | 2 +- server/api/whatsappMessage/index.js | 2 +- .../whatsappMessage/whatsappMessage.attributes.js | 2 +- .../whatsappMessage/whatsappMessage.controller.js | 2 +- .../api/whatsappMessage/whatsappMessage.events.js | 2 +- .../api/whatsappMessage/whatsappMessage.model.js | 2 +- server/api/whatsappMessage/whatsappMessage.rpc.js | 2 +- .../api/whatsappMessage/whatsappMessage.socket.js | 2 +- server/api/whatsappQueue/index.js | 2 +- .../api/whatsappQueue/whatsappQueue.attributes.js | 2 +- .../api/whatsappQueue/whatsappQueue.controller.js | 2 +- server/api/whatsappQueue/whatsappQueue.events.js | 2 +- server/api/whatsappQueue/whatsappQueue.model.js | 2 +- server/api/whatsappQueue/whatsappQueue.rpc.js | 2 +- server/api/whatsappQueue/whatsappQueue.socket.js | 2 +- server/api/whatsappQueueReport/index.js | 2 +- .../whatsappQueueReport.attributes.js | 2 +- .../whatsappQueueReport.controller.js | 2 +- .../whatsappQueueReport.model.js | 2 +- .../whatsappQueueReport/whatsappQueueReport.rpc.js | 2 +- server/api/whatsappTransferReport/index.js | 2 +- .../whatsappTransferReport.attributes.js | 2 +- .../whatsappTransferReport.controller.js | 2 +- .../whatsappTransferReport.model.js | 2 +- .../whatsappTransferReport.rpc.js | 2 +- server/app.js | 2 +- server/components/auth/service.js | 2 +- server/components/encryptor/index.js | 2 +- server/components/export/csv.js | 2 +- server/components/export/pdf.js | 2 +- server/components/export/xlsx.js | 2 +- server/components/extensions/rewrite.js | 2 +- server/components/import/cm/csv.js | 2 +- server/components/import/cm/csv2.js | 2 +- server/components/integrations/configuration.js | 2 +- server/components/interaction/service.js | 2 +- server/components/license/service.js | 2 +- server/components/parsers/advancedSearch.js | 2 +- server/components/parsers/qs.js | 2 +- server/config/express.js | 2 +- server/config/license/hardware.js | 2 +- server/config/license/index.js | 2 +- server/config/license/util.js | 2 +- server/config/local.env.js | 2 +- server/config/logger.js | 2 +- server/config/pm2/config.js | 2 +- server/config/pm2/index.js | 2 +- server/config/schedule/chat.js | 2 +- server/config/schedule/index.js | 2 +- server/config/schedule/transcribe.js | 2 +- server/config/schedule/whatsapp.js | 2 +- server/config/seedContact.js | 2 +- server/config/seedUsers.js | 2 +- server/config/socketio.js | 2 +- server/config/triggers/index.js | 2 +- server/config/utils.js | 2 +- server/errors/index.js | 2 +- server/mysqldb/index.js | 2 +- server/routes.js | 2 +- server/rpc/index.js | 2 +- server/services/agi/channel.js | 2 +- server/services/agi/error.js | 2 +- server/services/agi/graph/index.js | 2 +- server/services/agi/index.js | 2 +- server/services/agi/mailRpc/index.js | 2 +- server/services/agi/reply.js | 2 +- server/services/agi/rpc/index.js | 2 +- server/services/agi/scripts/aws/index.js | 2 +- server/services/agi/scripts/aws/lex/index.js | 2 +- server/services/agi/scripts/aws/lex/lib/api.js | 2 +- server/services/agi/scripts/aws/polly/index.js | 2 +- server/services/agi/scripts/aws/polly/lib/api.js | 2 +- server/services/agi/scripts/google/asr/index.js | 2 +- server/services/agi/scripts/google/asr/lib/api.js | 2 +- server/services/agi/scripts/google/index.js | 2 +- server/services/agi/scripts/index.js | 2 +- server/services/agi/scripts/sestek/index.js | 2 +- server/services/agi/scripts/sestek/nda/index.js | 2 +- server/services/agi/scripts/tilde/asr/index.js | 2 +- server/services/agi/scripts/tilde/asr/lib/api.js | 2 +- server/services/agi/scripts/tilde/index.js | 2 +- server/services/agi/server.js | 2 +- server/services/agi/vertices.js | 2 +- server/services/ami/acw/index.js | 2 +- server/services/ami/ami.js | 2 +- server/services/ami/client.js | 2 +- server/services/ami/dialer/action.js | 2 +- server/services/ami/dialer/agentComplete.js | 2 +- server/services/ami/dialer/final.js | 2 +- server/services/ami/dialer/hangup.js | 2 +- server/services/ami/dialer/history.js | 2 +- server/services/ami/dialer/index.js | 2 +- server/services/ami/dialer/queueCallerAbandon.js | 2 +- server/services/ami/fax/action.js | 2 +- server/services/ami/fax/index.js | 2 +- server/services/ami/fax/rpcDb.js | 2 +- server/services/ami/fax/util/gs.js | 2 +- server/services/ami/fax/util/util.js | 2 +- server/services/ami/index.js | 2 +- server/services/ami/model/agent.js | 2 +- server/services/ami/model/campaign.js | 2 +- server/services/ami/model/channel.js | 2 +- server/services/ami/model/deskAccount.js | 2 +- server/services/ami/model/dynamics365Account.js | 2 +- server/services/ami/model/faxAccount.js | 2 +- server/services/ami/model/freshdeskAccount.js | 2 +- server/services/ami/model/freshsalesAccount.js | 2 +- server/services/ami/model/queueReport.js | 2 +- server/services/ami/model/salesforceAccount.js | 2 +- server/services/ami/model/servicenowAccount.js | 2 +- server/services/ami/model/sugarcrmAccount.js | 2 +- server/services/ami/model/telephone.js | 2 +- server/services/ami/model/template.js | 2 +- server/services/ami/model/trigger.js | 2 +- server/services/ami/model/trunk.js | 2 +- server/services/ami/model/voiceExtension.js | 2 +- server/services/ami/model/voiceQueue.js | 2 +- server/services/ami/model/vtigerAccount.js | 2 +- server/services/ami/model/zendeskAccount.js | 2 +- server/services/ami/model/zohoAccount.js | 2 +- server/services/ami/preview/action.js | 2 +- server/services/ami/preview/index.js | 2 +- server/services/ami/preview/rpcDb.js | 2 +- server/services/ami/preview/util/util.js | 2 +- server/services/ami/properties.js | 2 +- server/services/ami/realtime/index.js | 2 +- server/services/ami/report/index.js | 2 +- server/services/ami/report/userReport.js | 2 +- server/services/ami/report/voiceAgentReport.js | 2 +- server/services/ami/report/voiceCallReport.js | 2 +- server/services/ami/report/voiceDialReport.js | 2 +- server/services/ami/report/voiceQueueReport.js | 2 +- server/services/ami/rpc/agentReportPreview.js | 2 +- server/services/ami/rpc/attachment.js | 2 +- server/services/ami/rpc/campaign.js | 2 +- server/services/ami/rpc/cmContact.js | 2 +- server/services/ami/rpc/cmHopper.js | 2 +- server/services/ami/rpc/cmHopperBlack.js | 2 +- server/services/ami/rpc/cmHopperFinal.js | 2 +- server/services/ami/rpc/cmHopperHistory.js | 2 +- server/services/ami/rpc/faxAccount.js | 2 +- server/services/ami/rpc/faxMessage.js | 2 +- server/services/ami/rpc/integrations/desk.js | 2 +- .../services/ami/rpc/integrations/dynamics365.js | 2 +- server/services/ami/rpc/integrations/freshdesk.js | 2 +- server/services/ami/rpc/integrations/freshsales.js | 2 +- server/services/ami/rpc/integrations/salesforce.js | 2 +- server/services/ami/rpc/integrations/servicenow.js | 2 +- server/services/ami/rpc/integrations/sugarcrm.js | 2 +- server/services/ami/rpc/integrations/vtiger.js | 2 +- server/services/ami/rpc/integrations/zendesk.js | 2 +- server/services/ami/rpc/integrations/zoho.js | 2 +- server/services/ami/rpc/memberReport.js | 2 +- server/services/ami/rpc/setting.js | 2 +- server/services/ami/rpc/template.js | 2 +- server/services/ami/rpc/trigger.js | 2 +- server/services/ami/rpc/trunk.js | 2 +- server/services/ami/rpc/user.js | 2 +- server/services/ami/rpc/voiceAgentReport.js | 2 +- server/services/ami/rpc/voiceCallReport.js | 2 +- server/services/ami/rpc/voiceDialReport.js | 2 +- server/services/ami/rpc/voiceExtension.js | 2 +- server/services/ami/rpc/voiceQueue.js | 2 +- server/services/ami/rpc/voiceQueueReport.js | 2 +- server/services/ami/rpc/voiceQueueRt.js | 2 +- server/services/ami/rpc/voiceRecording.js | 2 +- server/services/ami/rpc/voiceTransferReport.js | 2 +- server/services/ami/server/index.js | 2 +- server/services/ami/trigger/cmContact/index.js | 2 +- server/services/ami/trigger/index.js | 2 +- server/services/ami/trigger/integration/desk.js | 2 +- .../ami/trigger/integration/dynamics365.js | 2 +- .../services/ami/trigger/integration/freshdesk.js | 2 +- .../services/ami/trigger/integration/freshsales.js | 2 +- server/services/ami/trigger/integration/index.js | 2 +- .../services/ami/trigger/integration/salesforce.js | 2 +- .../services/ami/trigger/integration/servicenow.js | 2 +- .../services/ami/trigger/integration/sugarcrm.js | 2 +- server/services/ami/trigger/integration/util.js | 2 +- server/services/ami/trigger/integration/vtiger.js | 2 +- server/services/ami/trigger/integration/zendesk.js | 2 +- server/services/ami/trigger/integration/zoho.js | 2 +- server/services/ami/trigger/script/index.js | 2 +- server/services/ami/trigger/urlforward/index.js | 2 +- server/services/email/client.js | 2 +- server/services/email/index.js | 2 +- server/services/email/lib/email.js | 2 +- server/services/email/lib/imap.js | 2 +- server/services/email/lib/smtp.js | 2 +- server/services/email/lib/utils.js | 2 +- server/services/email/model/mailAccount.js | 2 +- server/services/email/realtime/index.js | 2 +- server/services/email/rpc/mailAccount.js | 2 +- server/services/email/rpc/setting.js | 2 +- server/services/email/server/index.js | 2 +- server/services/express/index.js | 2 +- server/services/routing/client.js | 2 +- server/services/routing/index.js | 2 +- server/services/routing/lib/rule-engine.js | 2 +- server/services/routing/mailRpc/index.js | 2 +- server/services/routing/model/agent.js | 2 +- server/services/routing/model/chatQueue.js | 2 +- server/services/routing/model/faxQueue.js | 2 +- server/services/routing/model/interval.js | 2 +- server/services/routing/model/mailQueue.js | 2 +- server/services/routing/model/openchannelQueue.js | 2 +- server/services/routing/model/smsQueue.js | 2 +- server/services/routing/model/whatsappQueue.js | 2 +- server/services/routing/realtime/index.js | 2 +- server/services/routing/rpc/chatInteraction.js | 2 +- server/services/routing/rpc/chatMessage.js | 2 +- server/services/routing/rpc/chatQueue.js | 2 +- server/services/routing/rpc/chatQueueReport.js | 2 +- server/services/routing/rpc/faxInteraction.js | 2 +- server/services/routing/rpc/faxMessage.js | 2 +- server/services/routing/rpc/faxQueue.js | 2 +- server/services/routing/rpc/faxQueueReport.js | 2 +- server/services/routing/rpc/interval.js | 2 +- server/services/routing/rpc/mailInteraction.js | 2 +- server/services/routing/rpc/mailMessage.js | 2 +- server/services/routing/rpc/mailQueue.js | 2 +- server/services/routing/rpc/mailQueueReport.js | 2 +- .../services/routing/rpc/openchannelInteraction.js | 2 +- server/services/routing/rpc/openchannelMessage.js | 2 +- server/services/routing/rpc/openchannelQueue.js | 2 +- .../services/routing/rpc/openchannelQueueReport.js | 2 +- server/services/routing/rpc/smsInteraction.js | 2 +- server/services/routing/rpc/smsMessage.js | 2 +- server/services/routing/rpc/smsQueue.js | 2 +- server/services/routing/rpc/smsQueueReport.js | 2 +- server/services/routing/rpc/user.js | 2 +- server/services/routing/rpc/whatsappInteraction.js | 2 +- server/services/routing/rpc/whatsappMessage.js | 2 +- server/services/routing/rpc/whatsappQueue.js | 2 +- server/services/routing/rpc/whatsappQueueReport.js | 2 +- .../services/routing/server/applications/agent.js | 2 +- .../routing/server/applications/amazonlex.js | 2 +- .../routing/server/applications/autoreply.js | 2 +- .../services/routing/server/applications/close.js | 2 +- .../routing/server/applications/dialogflow.js | 2 +- .../routing/server/applications/dialogflowV2.js | 2 +- .../services/routing/server/applications/gotoif.js | 2 +- .../services/routing/server/applications/gotop.js | 2 +- .../routing/server/applications/message.js | 2 +- .../services/routing/server/applications/noop.js | 2 +- .../services/routing/server/applications/queue.js | 2 +- .../routing/server/applications/strategy/agent.js | 2 +- .../server/applications/strategy/beepall.js | 2 +- .../routing/server/applications/strategy/index.js | 2 +- .../server/applications/strategy/rrmemory.js | 2 +- .../routing/server/applications/strategy/util.js | 2 +- .../services/routing/server/applications/system.js | 2 +- server/services/routing/server/applications/tag.js | 2 +- .../services/routing/server/applications/utils.js | 2 +- server/services/routing/server/index.js | 2 +- server/services/routing/server/interval.js | 2 +- server/services/xdr/agents.controller.js | 2 +- server/services/xdr/calls.controller.js | 2 +- server/services/xdr/core.controller.js | 2 +- server/services/xdr/dials.controller.js | 2 +- server/services/xdr/index.js | 2 +- server/services/xdr/members.controller.js | 2 +- server/services/xdr/queues.controller.js | 2 +- server/services/xdr/recordings.controller.js | 2 +- server/services/xdr/transfers.controller.js | 2 +- server/services/xdr/utils.js | 2 +- 1155 files changed, 1151 insertions(+), 1223 deletions(-) delete mode 100644 server/api/teamVoicePrefix/index.js delete mode 100644 server/api/teamVoicePrefix/teamVoicePrefix.rpc.js delete mode 100644 server/api/userVoicePrefix/index.js delete mode 100644 server/api/userVoicePrefix/userVoicePrefix.rpc.js diff --git a/apidoc/api_project.js b/apidoc/api_project.js index d435e56..69e77db 100644 --- a/apidoc/api_project.js +++ b/apidoc/api_project.js @@ -17,7 +17,7 @@ define({ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2021-09-03T14:37:22.620Z", + "time": "2021-09-06T12:29:21.798Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/apidoc/api_project.json b/apidoc/api_project.json index dea3609..2cb94a6 100644 --- a/apidoc/api_project.json +++ b/apidoc/api_project.json @@ -17,7 +17,7 @@ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2021-09-03T14:37:22.620Z", + "time": "2021-09-06T12:29:21.798Z", "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 60d8b7a..7b0035a 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 _0x3f8a=['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]','browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]','urlForward[timeout],\x20browser[windowWidth]','urlForward[headers],\x20browser[wsindowHeight]','TEXT','urlForward[body]','sequelize','exports','VIRTUAL','action','STRING','contactManager','integration','motionbar','jscripty','urlForward','browser','bot','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'];(function(_0x43d0e7,_0x201b93){var _0x1bfd9c=function(_0x4ffe28){while(--_0x4ffe28){_0x43d0e7['push'](_0x43d0e7['shift']());}};_0x1bfd9c(++_0x201b93);}(_0x3f8a,0x1d5));var _0xa3f8=function(_0x271ad2,_0x2c93eb){_0x271ad2=_0x271ad2-0x0;var _0x3ee9e4=_0x3f8a[_0x271ad2];return _0x3ee9e4;};'use strict';var Sequelize=require(_0xa3f8('0x0'));module[_0xa3f8('0x1')]={'name':{'type':Sequelize[_0xa3f8('0x2')],'get':function(_0x23c224){return this['getDataValue'](_0xa3f8('0x3'));}},'action':{'type':Sequelize[_0xa3f8('0x4')],'allowNull':![],'validate':{'isIn':{'args':[[_0xa3f8('0x5'),_0xa3f8('0x6'),_0xa3f8('0x7'),_0xa3f8('0x8'),_0xa3f8('0x9'),_0xa3f8('0xa'),_0xa3f8('0xb'),_0xa3f8('0xc')]],'msg':_0xa3f8('0xd')}},'comment':_0xa3f8('0xd')},'data1':{'type':Sequelize[_0xa3f8('0x4')](0x1000),'comment':_0xa3f8('0xe')},'data2':{'type':Sequelize[_0xa3f8('0x4')](0x1000),'comment':_0xa3f8('0xf')},'data3':{'type':Sequelize[_0xa3f8('0x4')](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[_0xa3f8('0x4')](0x1000),'comments':_0xa3f8('0x10')},'data5':{'type':Sequelize[_0xa3f8('0x4')](0x1000),'comments':_0xa3f8('0x11')},'data6':{'type':Sequelize['STRING'],'comments':_0xa3f8('0x12')},'data7':{'type':Sequelize[_0xa3f8('0x13')],'comments':_0xa3f8('0x14')}}; \ No newline at end of file +var _0x6657=['contactManager[searchFields],\x20script[script],\x20integration[ConfigurationId],\x20motionbar[NULL,eventVariables(0=No,1=Yes),WinAppArguments],\x20browser[NULL,eventVariables(0=No,1=Yes)]','urlForward[timeout],\x20browser[windowWidth]','TEXT','sequelize','VIRTUAL','getDataValue','action','contactManager','integration','motionbar','jscripty','urlForward','browser','bot','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','STRING','jscripty[ProjectId],\x20browser[type(0=Popup,1=CTI\x20URL)],\x20contactManager[ListId],\x20urlForward[type(GET,POST,PUT,DELETE)],\x20script[info],\x20integration[intName(desk,dynamics365,freshdesk,freshsales,salesforce,sugarcrm,vtiger,zendesk,zoho)],\x20motionbar[type(0=Popup,1=CTI\x20URL,2=WinApp)]','contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]'];(function(_0x4e0de1,_0x251835){var _0x507b73=function(_0x4353b7){while(--_0x4353b7){_0x4e0de1['push'](_0x4e0de1['shift']());}};_0x507b73(++_0x251835);}(_0x6657,0x17f));var _0x7665=function(_0x53691d,_0x5d11a2){_0x53691d=_0x53691d-0x0;var _0x4849b0=_0x6657[_0x53691d];return _0x4849b0;};'use strict';var Sequelize=require(_0x7665('0x0'));module['exports']={'name':{'type':Sequelize[_0x7665('0x1')],'get':function(_0x43c954){return this[_0x7665('0x2')](_0x7665('0x3'));}},'action':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'isIn':{'args':[[_0x7665('0x4'),_0x7665('0x5'),_0x7665('0x6'),_0x7665('0x7'),_0x7665('0x8'),_0x7665('0x9'),_0x7665('0xa'),_0x7665('0xb')]],'msg':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'}},'comment':_0x7665('0xc')},'data1':{'type':Sequelize[_0x7665('0xd')](0x1000),'comment':_0x7665('0xe')},'data2':{'type':Sequelize[_0x7665('0xd')](0x1000),'comment':_0x7665('0xf')},'data3':{'type':Sequelize[_0x7665('0xd')](0x1000),'comment':_0x7665('0x10')},'data4':{'type':Sequelize[_0x7665('0xd')](0x1000),'comments':'browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]'},'data5':{'type':Sequelize[_0x7665('0xd')](0x1000),'comments':_0x7665('0x11')},'data6':{'type':Sequelize[_0x7665('0xd')],'comments':'urlForward[headers],\x20browser[wsindowHeight]'},'data7':{'type':Sequelize[_0x7665('0x12')],'comments':'urlForward[body]'}}; \ No newline at end of file diff --git a/server/api/action/action.controller.js b/server/api/action/action.controller.js index 2e288ea..5fc9323 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 _0x4cac=['lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','count','offset','Content-Range','apply','reject','update','then','destroy','error','name','body','find','catch','Action','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','to-csv','ejs','fs-extra'];(function(_0xc86f1a,_0x54d4ba){var _0x513368=function(_0x27e711){while(--_0x27e711){_0xc86f1a['push'](_0xc86f1a['shift']());}};_0x513368(++_0x54d4ba);}(_0x4cac,0x130));var _0xc4ca=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x4cac[_0x2dafbe];return _0x58a45a;};'use strict';var emlformat=require(_0xc4ca('0x0'));var rimraf=require(_0xc4ca('0x1'));var zipdir=require(_0xc4ca('0x2'));var jsonpatch=require(_0xc4ca('0x3'));var rp=require('request-promise');var moment=require(_0xc4ca('0x4'));var BPromise=require(_0xc4ca('0x5'));var Mustache=require('mustache');var util=require(_0xc4ca('0x6'));var path=require(_0xc4ca('0x7'));var sox=require('sox');var csv=require(_0xc4ca('0x8'));var ejs=require(_0xc4ca('0x9'));var fs=require('fs');var fs_extra=require(_0xc4ca('0xa'));var _=require(_0xc4ca('0xb'));var squel=require(_0xc4ca('0xc'));var crypto=require(_0xc4ca('0xd'));var jsforce=require(_0xc4ca('0xe'));var deskjs=require(_0xc4ca('0xf'));var toCsv=require(_0xc4ca('0x8'));var querystring=require(_0xc4ca('0x10'));var Papa=require(_0xc4ca('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xc4ca('0x12'));var as=require(_0xc4ca('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xc4ca('0x14'));var utils=require(_0xc4ca('0x15'));var config=require(_0xc4ca('0x16'));var licenseUtil=require(_0xc4ca('0x17'));var db=require(_0xc4ca('0x18'))['db'];function respondWithStatusCode(_0x3ca8d5,_0x2936dd){_0x2936dd=_0x2936dd||0xcc;return function(_0x4549e7){if(_0x4549e7){return _0x3ca8d5[_0xc4ca('0x19')](_0x2936dd);}return _0x3ca8d5['status'](_0x2936dd)[_0xc4ca('0x1a')]();};}function respondWithResult(_0x4b123b,_0x48b468){_0x48b468=_0x48b468||0xc8;return function(_0x3c38ba){if(_0x3c38ba){return _0x4b123b[_0xc4ca('0x1b')](_0x48b468)[_0xc4ca('0x1c')](_0x3c38ba);}};}function respondWithFilteredResult(_0xdade7a,_0x2590a8){return function(_0x282cc1){if(_0x282cc1){var _0x4aa478=typeof _0x2590a8['offset']===_0xc4ca('0x1d')&&typeof _0x2590a8[_0xc4ca('0x1e')]===_0xc4ca('0x1d');var _0x42db90=_0x282cc1[_0xc4ca('0x1f')];var _0x27cb3a=_0x4aa478?0x0:_0x2590a8[_0xc4ca('0x20')];var _0x29ba20=_0x4aa478?_0x282cc1[_0xc4ca('0x1f')]:_0x2590a8[_0xc4ca('0x20')]+_0x2590a8[_0xc4ca('0x1e')];var _0x5e9d7f;if(_0x29ba20>=_0x42db90){_0x29ba20=_0x42db90;_0x5e9d7f=0xc8;}else{_0x5e9d7f=0xce;}_0xdade7a[_0xc4ca('0x1b')](_0x5e9d7f);return _0xdade7a['set'](_0xc4ca('0x21'),_0x27cb3a+'-'+_0x29ba20+'/'+_0x42db90)['json'](_0x282cc1);}return null;};}function patchUpdates(_0x3262a9){return function(_0x1d38e2){try{jsonpatch[_0xc4ca('0x22')](_0x1d38e2,_0x3262a9,!![]);}catch(_0x5befbc){return BPromise[_0xc4ca('0x23')](_0x5befbc);}return _0x1d38e2['save']();};}function saveUpdates(_0x1dc4c6,_0x339f74){return function(_0x499c8e){if(_0x499c8e){return _0x499c8e[_0xc4ca('0x24')](_0x1dc4c6)[_0xc4ca('0x25')](function(_0x2939c4){return _0x2939c4;});}return null;};}function removeEntity(_0x5ac0d1,_0x9d26a4){return function(_0x87037a){if(_0x87037a){return _0x87037a[_0xc4ca('0x26')]()[_0xc4ca('0x25')](function(){_0x5ac0d1[_0xc4ca('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4a8c56,_0xd2f14c){return function(_0x5553d0){if(!_0x5553d0){_0x4a8c56[_0xc4ca('0x19')](0x194);}return _0x5553d0;};}function handleError(_0x299fe1,_0x3f8e88){_0x3f8e88=_0x3f8e88||0x1f4;return function(_0x459072){logger[_0xc4ca('0x27')](_0x459072['stack']);if(_0x459072[_0xc4ca('0x28')]){delete _0x459072[_0xc4ca('0x28')];}_0x299fe1[_0xc4ca('0x1b')](_0x3f8e88)['send'](_0x459072);};}exports[_0xc4ca('0x24')]=function(_0x1383ac,_0x56c70e){if(_0x1383ac[_0xc4ca('0x29')]['id']){delete _0x1383ac[_0xc4ca('0x29')]['id'];}return db['Action'][_0xc4ca('0x2a')]({'where':{'id':_0x1383ac['params']['id']}})['then'](handleEntityNotFound(_0x56c70e,null))[_0xc4ca('0x25')](saveUpdates(_0x1383ac[_0xc4ca('0x29')],null))[_0xc4ca('0x25')](respondWithResult(_0x56c70e,null))[_0xc4ca('0x2b')](handleError(_0x56c70e,null));};exports[_0xc4ca('0x26')]=function(_0x396673,_0x5b1b36){return db[_0xc4ca('0x2c')]['find']({'where':{'id':_0x396673['params']['id']}})[_0xc4ca('0x25')](handleEntityNotFound(_0x5b1b36,null))[_0xc4ca('0x25')](removeEntity(_0x5b1b36,null))[_0xc4ca('0x2b')](handleError(_0x5b1b36,null));}; \ No newline at end of file +var _0x9f6f=['offset','undefined','count','limit','Content-Range','apply','reject','update','then','destroy','end','error','stack','name','send','body','Action','find','params','eml-format','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json'];(function(_0x2550ce,_0x45209b){var _0x25748d=function(_0x806ad5){while(--_0x806ad5){_0x2550ce['push'](_0x2550ce['shift']());}};_0x25748d(++_0x45209b);}(_0x9f6f,0x1b1));var _0xf9f6=function(_0xdc545c,_0x1b010f){_0xdc545c=_0xdc545c-0x0;var _0x249c58=_0x9f6f[_0xdc545c];return _0x249c58;};'use strict';var emlformat=require(_0xf9f6('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xf9f6('0x1'));var rp=require(_0xf9f6('0x2'));var moment=require('moment');var BPromise=require(_0xf9f6('0x3'));var Mustache=require(_0xf9f6('0x4'));var util=require(_0xf9f6('0x5'));var path=require(_0xf9f6('0x6'));var sox=require(_0xf9f6('0x7'));var csv=require(_0xf9f6('0x8'));var ejs=require(_0xf9f6('0x9'));var fs=require('fs');var fs_extra=require(_0xf9f6('0xa'));var _=require('lodash');var squel=require(_0xf9f6('0xb'));var crypto=require(_0xf9f6('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xf9f6('0xd'));var toCsv=require('to-csv');var querystring=require(_0xf9f6('0xe'));var Papa=require(_0xf9f6('0xf'));var Redis=require(_0xf9f6('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xf9f6('0x11'));var as=require(_0xf9f6('0x12'));var hardwareService=require(_0xf9f6('0x13'));var logger=require(_0xf9f6('0x14'))('api');var utils=require(_0xf9f6('0x15'));var config=require(_0xf9f6('0x16'));var licenseUtil=require(_0xf9f6('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x175627,_0x17cc69){_0x17cc69=_0x17cc69||0xcc;return function(_0x3b1fc3){if(_0x3b1fc3){return _0x175627[_0xf9f6('0x18')](_0x17cc69);}return _0x175627[_0xf9f6('0x19')](_0x17cc69)['end']();};}function respondWithResult(_0x4ad7b6,_0x3b6cee){_0x3b6cee=_0x3b6cee||0xc8;return function(_0x38946f){if(_0x38946f){return _0x4ad7b6[_0xf9f6('0x19')](_0x3b6cee)[_0xf9f6('0x1a')](_0x38946f);}};}function respondWithFilteredResult(_0x3b5d5f,_0x4460dc){return function(_0x5a8235){if(_0x5a8235){var _0x16577a=typeof _0x4460dc[_0xf9f6('0x1b')]===_0xf9f6('0x1c')&&typeof _0x4460dc['limit']===_0xf9f6('0x1c');var _0x7b6e1a=_0x5a8235['count'];var _0x3fa0a3=_0x16577a?0x0:_0x4460dc[_0xf9f6('0x1b')];var _0x2e3c9f=_0x16577a?_0x5a8235[_0xf9f6('0x1d')]:_0x4460dc[_0xf9f6('0x1b')]+_0x4460dc[_0xf9f6('0x1e')];var _0x6a1b06;if(_0x2e3c9f>=_0x7b6e1a){_0x2e3c9f=_0x7b6e1a;_0x6a1b06=0xc8;}else{_0x6a1b06=0xce;}_0x3b5d5f[_0xf9f6('0x19')](_0x6a1b06);return _0x3b5d5f['set'](_0xf9f6('0x1f'),_0x3fa0a3+'-'+_0x2e3c9f+'/'+_0x7b6e1a)[_0xf9f6('0x1a')](_0x5a8235);}return null;};}function patchUpdates(_0x1cfa2d){return function(_0x379339){try{jsonpatch[_0xf9f6('0x20')](_0x379339,_0x1cfa2d,!![]);}catch(_0x4b2512){return BPromise[_0xf9f6('0x21')](_0x4b2512);}return _0x379339['save']();};}function saveUpdates(_0x13df70,_0x541e73){return function(_0x55baa9){if(_0x55baa9){return _0x55baa9[_0xf9f6('0x22')](_0x13df70)[_0xf9f6('0x23')](function(_0x5450e6){return _0x5450e6;});}return null;};}function removeEntity(_0x4d54d2,_0x417556){return function(_0x142670){if(_0x142670){return _0x142670[_0xf9f6('0x24')]()[_0xf9f6('0x23')](function(){_0x4d54d2['status'](0xcc)[_0xf9f6('0x25')]();});}};}function handleEntityNotFound(_0x309cff,_0x149264){return function(_0x1bc51e){if(!_0x1bc51e){_0x309cff['sendStatus'](0x194);}return _0x1bc51e;};}function handleError(_0x24d97e,_0x3d5457){_0x3d5457=_0x3d5457||0x1f4;return function(_0x4d6b8e){logger[_0xf9f6('0x26')](_0x4d6b8e[_0xf9f6('0x27')]);if(_0x4d6b8e[_0xf9f6('0x28')]){delete _0x4d6b8e[_0xf9f6('0x28')];}_0x24d97e['status'](_0x3d5457)[_0xf9f6('0x29')](_0x4d6b8e);};}exports[_0xf9f6('0x22')]=function(_0x511cb2,_0x1110fa){if(_0x511cb2[_0xf9f6('0x2a')]['id']){delete _0x511cb2[_0xf9f6('0x2a')]['id'];}return db[_0xf9f6('0x2b')][_0xf9f6('0x2c')]({'where':{'id':_0x511cb2[_0xf9f6('0x2d')]['id']}})[_0xf9f6('0x23')](handleEntityNotFound(_0x1110fa,null))[_0xf9f6('0x23')](saveUpdates(_0x511cb2[_0xf9f6('0x2a')],null))[_0xf9f6('0x23')](respondWithResult(_0x1110fa,null))['catch'](handleError(_0x1110fa,null));};exports[_0xf9f6('0x24')]=function(_0x3968c3,_0x257745){return db[_0xf9f6('0x2b')]['find']({'where':{'id':_0x3968c3[_0xf9f6('0x2d')]['id']}})[_0xf9f6('0x23')](handleEntityNotFound(_0x257745,null))['then'](removeEntity(_0x257745,null))['catch'](handleError(_0x257745,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index 2632309..86f4906 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 _0xf858=['request-promise','path','../../config/environment','./action.attributes','define','Action','tools_actions','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x35ded5,_0x4cd999){var _0x1bd1ee=function(_0xae2c9c){while(--_0xae2c9c){_0x35ded5['push'](_0x35ded5['shift']());}};_0x1bd1ee(++_0x4cd999);}(_0xf858,0x13f));var _0x8f85=function(_0x1321cd,_0x4ebce9){_0x1321cd=_0x1321cd-0x0;var _0x4137eb=_0xf858[_0x1321cd];return _0x4137eb;};'use strict';var _=require(_0x8f85('0x0'));var util=require(_0x8f85('0x1'));var logger=require(_0x8f85('0x2'))(_0x8f85('0x3'));var moment=require(_0x8f85('0x4'));var BPromise=require(_0x8f85('0x5'));var rp=require(_0x8f85('0x6'));var fs=require('fs');var path=require(_0x8f85('0x7'));var rimraf=require('rimraf');var config=require(_0x8f85('0x8'));var attributes=require(_0x8f85('0x9'));module['exports']=function(_0x453e90,_0x4f7d8b){return _0x453e90[_0x8f85('0xa')](_0x8f85('0xb'),attributes,{'tableName':_0x8f85('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x36b1=['exports','define','Action','lodash','util','../../config/logger','path','../../config/environment','./action.attributes'];(function(_0x1bcaa5,_0x4d8f4e){var _0x5093b6=function(_0x30a5ae){while(--_0x30a5ae){_0x1bcaa5['push'](_0x1bcaa5['shift']());}};_0x5093b6(++_0x4d8f4e);}(_0x36b1,0x1aa));var _0x136b=function(_0x10219c,_0x20196e){_0x10219c=_0x10219c-0x0;var _0x5139b9=_0x36b1[_0x10219c];return _0x5139b9;};'use strict';var _=require(_0x136b('0x0'));var util=require(_0x136b('0x1'));var logger=require(_0x136b('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x136b('0x3'));var rimraf=require('rimraf');var config=require(_0x136b('0x4'));var attributes=require(_0x136b('0x5'));module[_0x136b('0x6')]=function(_0x2240a6,_0x5a8f24){return _0x2240a6[_0x136b('0x7')](_0x136b('0x8'),attributes,{'tableName':'tools_actions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/action/action.rpc.js b/server/api/action/action.rpc.js index fc5a8eb..f548fde 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 _0x5fab=['../../config/environment','jayson/promise','client','request','then','request\x20sent','debug','Action,\x20%s,\x20%s,\x20%s','stringify','error','code','message','Action,\x20%s,\x20%s','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x49b0bf,_0x2c50e9){var _0x4e6b5c=function(_0x2eaf9e){while(--_0x2eaf9e){_0x49b0bf['push'](_0x49b0bf['shift']());}};_0x4e6b5c(++_0x2c50e9);}(_0x5fab,0x177));var _0xb5fa=function(_0x5be892,_0x68238a){_0x5be892=_0x5be892-0x0;var _0x53fc35=_0x5fab[_0x5be892];return _0x53fc35;};'use strict';var _=require(_0xb5fa('0x0'));var util=require(_0xb5fa('0x1'));var moment=require('moment');var BPromise=require(_0xb5fa('0x2'));var rs=require(_0xb5fa('0x3'));var fs=require('fs');var Redis=require(_0xb5fa('0x4'));var db=require(_0xb5fa('0x5'))['db'];var utils=require(_0xb5fa('0x6'));var logger=require(_0xb5fa('0x7'))(_0xb5fa('0x8'));var config=require(_0xb5fa('0x9'));var jayson=require(_0xb5fa('0xa'));var client=jayson[_0xb5fa('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5d70f6,_0x2e3804,_0x1aec3e){return new BPromise(function(_0x9c7bce,_0x56d018){return client[_0xb5fa('0xc')](_0x5d70f6,_0x1aec3e)[_0xb5fa('0xd')](function(_0x2cf4a5){logger['info']('Action,\x20%s,\x20%s',_0x2e3804,_0xb5fa('0xe'));logger[_0xb5fa('0xf')](_0xb5fa('0x10'),_0x2e3804,_0xb5fa('0xe'),JSON[_0xb5fa('0x11')](_0x2cf4a5));if(_0x2cf4a5[_0xb5fa('0x12')]){if(_0x2cf4a5[_0xb5fa('0x12')][_0xb5fa('0x13')]===0x1f4){logger[_0xb5fa('0x12')]('Action,\x20%s,\x20%s',_0x2e3804,_0x2cf4a5[_0xb5fa('0x12')][_0xb5fa('0x14')]);return _0x56d018(_0x2cf4a5['error'][_0xb5fa('0x14')]);}logger['error'](_0xb5fa('0x15'),_0x2e3804,_0x2cf4a5[_0xb5fa('0x12')][_0xb5fa('0x14')]);return _0x9c7bce(_0x2cf4a5[_0xb5fa('0x12')][_0xb5fa('0x14')]);}else{logger['info']('Action,\x20%s,\x20%s',_0x2e3804,_0xb5fa('0xe'));_0x9c7bce(_0x2cf4a5[_0xb5fa('0x16')][_0xb5fa('0x14')]);}})[_0xb5fa('0x17')](function(_0x56fe10){logger['error'](_0xb5fa('0x15'),_0x2e3804,_0x56fe10);_0x56d018(_0x56fe10);});});} \ No newline at end of file +var _0x1cb9=['error','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','Action,\x20%s,\x20%s','request\x20sent','debug','Action,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x1f9f37,_0x18776e){var _0x21c080=function(_0x4acb93){while(--_0x4acb93){_0x1f9f37['push'](_0x1f9f37['shift']());}};_0x21c080(++_0x18776e);}(_0x1cb9,0x14e));var _0x91cb=function(_0x37b27b,_0x45571c){_0x37b27b=_0x37b27b-0x0;var _0x5deff7=_0x1cb9[_0x37b27b];return _0x5deff7;};'use strict';var _=require(_0x91cb('0x0'));var util=require('util');var moment=require(_0x91cb('0x1'));var BPromise=require(_0x91cb('0x2'));var rs=require(_0x91cb('0x3'));var fs=require('fs');var Redis=require(_0x91cb('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x91cb('0x5'));var logger=require(_0x91cb('0x6'))('rpc');var config=require(_0x91cb('0x7'));var jayson=require(_0x91cb('0x8'));var client=jayson[_0x91cb('0x9')][_0x91cb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3b9d98,_0x8f8a3b,_0x4c1f56){return new BPromise(function(_0x15c517,_0x5bda2f){return client[_0x91cb('0xb')](_0x3b9d98,_0x4c1f56)['then'](function(_0xa43e7a){logger[_0x91cb('0xc')](_0x91cb('0xd'),_0x8f8a3b,_0x91cb('0xe'));logger[_0x91cb('0xf')](_0x91cb('0x10'),_0x8f8a3b,_0x91cb('0xe'),JSON[_0x91cb('0x11')](_0xa43e7a));if(_0xa43e7a[_0x91cb('0x12')]){if(_0xa43e7a[_0x91cb('0x12')]['code']===0x1f4){logger[_0x91cb('0x12')](_0x91cb('0xd'),_0x8f8a3b,_0xa43e7a['error'][_0x91cb('0x13')]);return _0x5bda2f(_0xa43e7a[_0x91cb('0x12')][_0x91cb('0x13')]);}logger[_0x91cb('0x12')]('Action,\x20%s,\x20%s',_0x8f8a3b,_0xa43e7a['error'][_0x91cb('0x13')]);return _0x15c517(_0xa43e7a[_0x91cb('0x12')]['message']);}else{logger['info'](_0x91cb('0xd'),_0x8f8a3b,_0x91cb('0xe'));_0x15c517(_0xa43e7a[_0x91cb('0x14')]['message']);}})[_0x91cb('0x15')](function(_0x135890){logger['error'](_0x91cb('0xd'),_0x8f8a3b,_0x135890);_0x5bda2f(_0x135890);});});} \ No newline at end of file diff --git a/server/api/action/index.js b/server/api/action/index.js index 7bf13ff..2d5d7d4 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 _0x580e=['exports','multer','path','fs-extra','../../components/interaction/service','put','/:id','isAuthenticated','update','delete','destroy'];(function(_0x5b36ac,_0x4767aa){var _0x512bc2=function(_0x312285){while(--_0x312285){_0x5b36ac['push'](_0x5b36ac['shift']());}};_0x512bc2(++_0x4767aa);}(_0x580e,0xfe));var _0xe580=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x580e[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0xe580('0x0'));var util=require('util');var path=require(_0xe580('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xe580('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0xe580('0x3'));var config=require('../../config/environment');var controller=require('./action.controller');router[_0xe580('0x4')](_0xe580('0x5'),auth[_0xe580('0x6')](),controller[_0xe580('0x7')]);router[_0xe580('0x8')](_0xe580('0x5'),auth[_0xe580('0x6')](),controller[_0xe580('0x9')]);module[_0xe580('0xa')]=router; \ No newline at end of file +var _0xe978=['connect-timeout','express','Router','fs-extra','../../config/environment','./action.controller','put','/:id','isAuthenticated','update','delete','path'];(function(_0x5c1353,_0x328298){var _0x31e2e6=function(_0x5d37e4){while(--_0x5d37e4){_0x5c1353['push'](_0x5c1353['shift']());}};_0x31e2e6(++_0x328298);}(_0xe978,0x173));var _0x8e97=function(_0x2a44b9,_0x51ac94){_0x2a44b9=_0x2a44b9-0x0;var _0x1e2fa5=_0xe978[_0x2a44b9];return _0x1e2fa5;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x8e97('0x0'));var timeout=require(_0x8e97('0x1'));var express=require(_0x8e97('0x2'));var router=express[_0x8e97('0x3')]();var fs_extra=require(_0x8e97('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x8e97('0x5'));var controller=require(_0x8e97('0x6'));router[_0x8e97('0x7')](_0x8e97('0x8'),auth[_0x8e97('0x9')](),controller[_0x8e97('0xa')]);router[_0x8e97('0xb')](_0x8e97('0x8'),auth[_0x8e97('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.attributes.js b/server/api/analyticCustomReport/analyticCustomReport.attributes.js index 70545cb..0623c67 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 _0x4819=['TEXT','exports','STRING'];(function(_0x4da356,_0x5235e1){var _0x321b07=function(_0x2bc6f4){while(--_0x2bc6f4){_0x4da356['push'](_0x4da356['shift']());}};_0x321b07(++_0x5235e1);}(_0x4819,0xcd));var _0x9481=function(_0x25b022,_0x394a08){_0x25b022=_0x25b022-0x0;var _0x2e13a5=_0x4819[_0x25b022];return _0x2e13a5;};'use strict';var Sequelize=require('sequelize');module[_0x9481('0x0')]={'name':{'type':Sequelize[_0x9481('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x9481('0x1')]},'parent':{'type':Sequelize[_0x9481('0x1')]},'table':{'type':Sequelize[_0x9481('0x1')]},'conditions':{'type':Sequelize[_0x9481('0x2')]},'joins':{'type':Sequelize[_0x9481('0x2')]}}; \ No newline at end of file +var _0xf494=['STRING','TEXT','sequelize','exports'];(function(_0x5815af,_0x361f0b){var _0x3f14cb=function(_0x422c47){while(--_0x422c47){_0x5815af['push'](_0x5815af['shift']());}};_0x3f14cb(++_0x361f0b);}(_0xf494,0x1c6));var _0x4f49=function(_0x3a6ff9,_0x4ae96f){_0x3a6ff9=_0x3a6ff9-0x0;var _0x48467e=_0xf494[_0x3a6ff9];return _0x48467e;};'use strict';var Sequelize=require(_0x4f49('0x0'));module[_0x4f49('0x1')]={'name':{'type':Sequelize[_0x4f49('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize[_0x4f49('0x2')]},'table':{'type':Sequelize[_0x4f49('0x2')]},'conditions':{'type':Sequelize[_0x4f49('0x3')]},'joins':{'type':Sequelize[_0x4f49('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.controller.js b/server/api/analyticCustomReport/analyticCustomReport.controller.js index 026f8b4..5b9947f 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 _0xd07e=['reject','update','then','destroy','CustomReports','UserProfileResource','error','stack','name','send','index','map','AnalyticCustomReport','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','type','VIRTUAL','count','includeAll','include','findAll','rows','show','params','options','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','Reports','UserProfileSection','userProfileId','autoAssociation','catch','preview','join','right_join','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','includes','IS\x20NOT\x20EMPTY','rules','operator','group','condition','value','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','from','field','function','replace','format','groupBy','orderBy','DESC','alias','joins','parentKey','foreignTable','foreignKey','table','conditions','parse','clone','debug','Limited\x20Query:','toString','sequelize','QueryTypes','left_join','MIN(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','ROUND(%s)','IS\x20NULL','IS\x20NOT\x20NULL','select','MetricId','%s.%s\x20=\x20%s.%s','output','fullPath','%s-%s.%s','generate','custom','AnalyticExtractedReport','.calldate\x20BETWEEN\x20?\x20AND\x20?','endDate','Run\x20Query:','child_process','fork','../../components/export/','savename','SELECT','run','UNIX_TIMESTAMP(%s)','metric','rimraf','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','dbH','sendStatus','end','status','json','undefined','limit','offset','Content-Range','apply'];(function(_0x47d22c,_0x2a8058){var _0x35e7da=function(_0x18bf49){while(--_0x18bf49){_0x47d22c['push'](_0x47d22c['shift']());}};_0x35e7da(++_0x2a8058);}(_0xd07e,0x80));var _0xed07=function(_0x13547d,_0xa3895e){_0x13547d=_0x13547d-0x0;var _0x22c36b=_0xd07e[_0x13547d];return _0x22c36b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xed07('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xed07('0x1'));var rp=require('request-promise');var moment=require(_0xed07('0x2'));var BPromise=require(_0xed07('0x3'));var Mustache=require('mustache');var util=require(_0xed07('0x4'));var path=require(_0xed07('0x5'));var sox=require(_0xed07('0x6'));var csv=require(_0xed07('0x7'));var ejs=require(_0xed07('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xed07('0x9'));var squel=require(_0xed07('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xed07('0xb'));var toCsv=require(_0xed07('0x7'));var querystring=require(_0xed07('0xc'));var Papa=require(_0xed07('0xd'));var Redis=require(_0xed07('0xe'));var authService=require(_0xed07('0xf'));var qs=require(_0xed07('0x10'));var as=require(_0xed07('0x11'));var hardwareService=require(_0xed07('0x12'));var logger=require(_0xed07('0x13'))(_0xed07('0x14'));var utils=require('../../config/utils');var config=require(_0xed07('0x15'));var licenseUtil=require(_0xed07('0x16'));var db=require(_0xed07('0x17'))['db'];var dbH=require(_0xed07('0x17'))[_0xed07('0x18')];function respondWithStatusCode(_0x21aa96,_0x1f9b73){_0x1f9b73=_0x1f9b73||0xcc;return function(_0x4e347f){if(_0x4e347f){return _0x21aa96[_0xed07('0x19')](_0x1f9b73);}return _0x21aa96['status'](_0x1f9b73)[_0xed07('0x1a')]();};}function respondWithResult(_0x49b071,_0x5cdad5){_0x5cdad5=_0x5cdad5||0xc8;return function(_0x52c86e){if(_0x52c86e){return _0x49b071[_0xed07('0x1b')](_0x5cdad5)[_0xed07('0x1c')](_0x52c86e);}};}function respondWithFilteredResult(_0x7dee7c,_0x38e6f7){return function(_0x4f41d9){if(_0x4f41d9){var _0x2097f0=typeof _0x38e6f7['offset']===_0xed07('0x1d')&&typeof _0x38e6f7[_0xed07('0x1e')]===_0xed07('0x1d');var _0x61a079=_0x4f41d9['count'];var _0x7a6b29=_0x2097f0?0x0:_0x38e6f7[_0xed07('0x1f')];var _0x315ba9=_0x2097f0?_0x4f41d9['count']:_0x38e6f7['offset']+_0x38e6f7['limit'];var _0x1a8387;if(_0x315ba9>=_0x61a079){_0x315ba9=_0x61a079;_0x1a8387=0xc8;}else{_0x1a8387=0xce;}_0x7dee7c[_0xed07('0x1b')](_0x1a8387);return _0x7dee7c['set'](_0xed07('0x20'),_0x7a6b29+'-'+_0x315ba9+'/'+_0x61a079)[_0xed07('0x1c')](_0x4f41d9);}return null;};}function patchUpdates(_0x11df71){return function(_0x445275){try{jsonpatch[_0xed07('0x21')](_0x445275,_0x11df71,!![]);}catch(_0x10c394){return BPromise[_0xed07('0x22')](_0x10c394);}return _0x445275['save']();};}function saveUpdates(_0x5bb7b6,_0xba74ba){return function(_0x46119f){if(_0x46119f){return _0x46119f[_0xed07('0x23')](_0x5bb7b6)[_0xed07('0x24')](function(_0x4b89c1){return _0x4b89c1;});}return null;};}function removeEntity(_0x25b3e6,_0x16edab){return function(_0x598bea){if(_0x598bea){return _0x598bea[_0xed07('0x25')]()[_0xed07('0x24')](function(){var _0x57d898=_0x598bea['get']({'plain':!![]});var _0x16266b=_0xed07('0x26');return db[_0xed07('0x27')][_0xed07('0x25')]({'where':{'type':_0x16266b,'resourceId':_0x57d898['id']}})[_0xed07('0x24')](function(){return _0x598bea;});})[_0xed07('0x24')](function(){_0x25b3e6[_0xed07('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1e4c42,_0x4a6368){return function(_0x2ee303){if(!_0x2ee303){_0x1e4c42[_0xed07('0x19')](0x194);}return _0x2ee303;};}function handleError(_0x143436,_0x1e9113){_0x1e9113=_0x1e9113||0x1f4;return function(_0x7ae630){logger[_0xed07('0x28')](_0x7ae630[_0xed07('0x29')]);if(_0x7ae630[_0xed07('0x2a')]){delete _0x7ae630['name'];}_0x143436[_0xed07('0x1b')](_0x1e9113)[_0xed07('0x2b')](_0x7ae630);};}exports[_0xed07('0x2c')]=function(_0x4d42fe,_0x49e799){var _0x54bc52={},_0x17e264={},_0x51503e={'count':0x0,'rows':[]};var _0x5ab625=_[_0xed07('0x2d')](db[_0xed07('0x2e')][_0xed07('0x2f')],function(_0xfa357e){return{'name':_0xfa357e[_0xed07('0x30')],'type':_0xfa357e['type'][_0xed07('0x31')]};});_0x17e264[_0xed07('0x32')]=_['map'](_0x5ab625,'name');_0x17e264[_0xed07('0x33')]=_[_0xed07('0x34')](_0x4d42fe[_0xed07('0x33')]);_0x17e264['filters']=_[_0xed07('0x35')](_0x17e264[_0xed07('0x32')],_0x17e264[_0xed07('0x33')]);_0x54bc52[_0xed07('0x36')]=_[_0xed07('0x35')](_0x17e264[_0xed07('0x32')],qs[_0xed07('0x37')](_0x4d42fe[_0xed07('0x33')]['fields']));_0x54bc52[_0xed07('0x36')]=_0x54bc52[_0xed07('0x36')][_0xed07('0x38')]?_0x54bc52[_0xed07('0x36')]:_0x17e264[_0xed07('0x32')];if(!_0x4d42fe[_0xed07('0x33')][_0xed07('0x39')](_0xed07('0x3a'))){_0x54bc52['limit']=qs[_0xed07('0x1e')](_0x4d42fe[_0xed07('0x33')][_0xed07('0x1e')]);_0x54bc52[_0xed07('0x1f')]=qs[_0xed07('0x1f')](_0x4d42fe[_0xed07('0x33')][_0xed07('0x1f')]);}_0x54bc52[_0xed07('0x3b')]=qs[_0xed07('0x3c')](_0x4d42fe[_0xed07('0x33')][_0xed07('0x3c')]);_0x54bc52['where']=qs[_0xed07('0x3d')](_[_0xed07('0x3e')](_0x4d42fe[_0xed07('0x33')],_0x17e264[_0xed07('0x3d')]),_0x5ab625);if(_0x4d42fe[_0xed07('0x33')][_0xed07('0x3f')]){_0x54bc52[_0xed07('0x40')]=_[_0xed07('0x41')](_0x54bc52['where'],{'$or':_[_0xed07('0x2d')](_0x5ab625,function(_0x48d230){if(_0x48d230[_0xed07('0x42')]!==_0xed07('0x43')){var _0x3085d0={};_0x3085d0[_0x48d230[_0xed07('0x2a')]]={'$like':'%'+_0x4d42fe[_0xed07('0x33')]['filter']+'%'};return _0x3085d0;}})});}_0x54bc52=_[_0xed07('0x41')]({},_0x54bc52,_0x4d42fe['options']);var _0x1bbcdd={'where':_0x54bc52[_0xed07('0x40')]};return db[_0xed07('0x2e')][_0xed07('0x44')](_0x1bbcdd)[_0xed07('0x24')](function(_0x40967a){_0x51503e['count']=_0x40967a;if(_0x4d42fe[_0xed07('0x33')][_0xed07('0x45')]){_0x54bc52[_0xed07('0x46')]=[{'all':!![]}];}return db[_0xed07('0x2e')][_0xed07('0x47')](_0x54bc52);})[_0xed07('0x24')](function(_0x2e306f){_0x51503e[_0xed07('0x48')]=_0x2e306f;return _0x51503e;})[_0xed07('0x24')](respondWithFilteredResult(_0x49e799,_0x54bc52))['catch'](handleError(_0x49e799,null));};exports[_0xed07('0x49')]=function(_0x305fdc,_0xb5f6ad){var _0xae22b4={'raw':![],'where':{'id':_0x305fdc[_0xed07('0x4a')]['id']}},_0x35e8f6={};_0x35e8f6['model']=_[_0xed07('0x34')](db[_0xed07('0x2e')][_0xed07('0x2f')]);_0x35e8f6[_0xed07('0x33')]=_[_0xed07('0x34')](_0x305fdc[_0xed07('0x33')]);_0x35e8f6[_0xed07('0x3d')]=_['intersection'](_0x35e8f6[_0xed07('0x32')],_0x35e8f6['query']);_0xae22b4[_0xed07('0x36')]=_[_0xed07('0x35')](_0x35e8f6[_0xed07('0x32')],qs[_0xed07('0x37')](_0x305fdc[_0xed07('0x33')][_0xed07('0x37')]));_0xae22b4['attributes']=_0xae22b4[_0xed07('0x36')]['length']?_0xae22b4[_0xed07('0x36')]:_0x35e8f6['model'];if(_0x305fdc['query'][_0xed07('0x45')]){_0xae22b4['include']=[{'all':!![]}];}_0xae22b4=_[_0xed07('0x41')]({},_0xae22b4,_0x305fdc[_0xed07('0x4b')]);return db['AnalyticCustomReport'][_0xed07('0x4c')](_0xae22b4)[_0xed07('0x24')](handleEntityNotFound(_0xb5f6ad,null))[_0xed07('0x24')](respondWithResult(_0xb5f6ad,null))['catch'](handleError(_0xb5f6ad,null));};exports[_0xed07('0x4d')]=function(_0x11f95a,_0x185f07){return db[_0xed07('0x2e')][_0xed07('0x4d')](_0x11f95a[_0xed07('0x4e')],{})[_0xed07('0x24')](function(_0x45e03a){var _0x11d191=_0x11f95a[_0xed07('0x4f')][_0xed07('0x50')]({'plain':!![]});if(!_0x11d191)throw new Error(_0xed07('0x51'));if(_0x11d191['role']===_0xed07('0x4f')){var _0x3567a7=_0x45e03a[_0xed07('0x50')]({'plain':!![]});var _0x2e839a=_0xed07('0x52');return db[_0xed07('0x53')][_0xed07('0x4c')]({'where':{'name':_0x2e839a,'userProfileId':_0x11d191[_0xed07('0x54')]},'raw':!![]})[_0xed07('0x24')](function(_0x1ab2b4){if(_0x1ab2b4&&_0x1ab2b4[_0xed07('0x55')]===0x0){return db[_0xed07('0x27')][_0xed07('0x4d')]({'name':_0x3567a7[_0xed07('0x2a')],'resourceId':_0x3567a7['id'],'type':'CustomReports','sectionId':_0x1ab2b4['id']},{})[_0xed07('0x24')](function(){return _0x45e03a;});}else{return _0x45e03a;}})['catch'](function(_0x373443){logger[_0xed07('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x373443);throw _0x373443;});}return _0x45e03a;})['then'](respondWithResult(_0x185f07,0xc9))['catch'](handleError(_0x185f07,null));};exports[_0xed07('0x23')]=function(_0x12bcfd,_0x255316){if(_0x12bcfd[_0xed07('0x4e')]['id']){delete _0x12bcfd[_0xed07('0x4e')]['id'];}return db[_0xed07('0x2e')][_0xed07('0x4c')]({'where':{'id':_0x12bcfd['params']['id']}})[_0xed07('0x24')](handleEntityNotFound(_0x255316,null))[_0xed07('0x24')](saveUpdates(_0x12bcfd[_0xed07('0x4e')],null))[_0xed07('0x24')](respondWithResult(_0x255316,null))[_0xed07('0x56')](handleError(_0x255316,null));};exports[_0xed07('0x25')]=function(_0x320ade,_0x452278){return db[_0xed07('0x2e')][_0xed07('0x4c')]({'where':{'id':_0x320ade[_0xed07('0x4a')]['id']}})[_0xed07('0x24')](handleEntityNotFound(_0x452278,null))[_0xed07('0x24')](removeEntity(_0x452278,null))[_0xed07('0x56')](handleError(_0x452278,null));};exports[_0xed07('0x57')]=function(_0x5bd6d1,_0x56d830){var _0x30a220=0xa;var _0x5cd790=[_0xed07('0x58'),'left_join',_0xed07('0x59'),_0xed07('0x5a')];var _0x57c844={'SUM':_0xed07('0x5b'),'COUNT':_0xed07('0x5c'),'COUNT DISTINCT':_0xed07('0x5d'),'MAX':_0xed07('0x5e'),'MIN':'MIN(%s)','AVG':_0xed07('0x5f'),'GROUP_CONCAT':_0xed07('0x60'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xed07('0x61')};var _0x549fc3={'SEC_TO_TIME':_0xed07('0x62'),'DATE':_0xed07('0x63'),'HOUR':_0xed07('0x64'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x4e4db3=function(_0x1cc479){return!_[_0xed07('0x65')](['IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY',_0xed07('0x66')],_0x1cc479);};var _0xf13ba3=function(_0x2c48e9){if(!_0x2c48e9||!_0x2c48e9[_0xed07('0x67')][_0xed07('0x38')]){return'';}for(var _0x367bf5='(',_0x3e54c5=0x0;_0x3e54c5<_0x2c48e9['rules'][_0xed07('0x38')];_0x3e54c5+=0x1){_0x3e54c5>0x0&&(_0x367bf5+='\x20'+_0x2c48e9[_0xed07('0x68')]+'\x20');_0x367bf5+=_0x2c48e9[_0xed07('0x67')][_0x3e54c5][_0xed07('0x69')]?_0xf13ba3(_0x2c48e9[_0xed07('0x67')][_0x3e54c5][_0xed07('0x69')]):_0x2c48e9[_0xed07('0x67')][_0x3e54c5]['field']+'\x20'+_0x2c48e9['rules'][_0x3e54c5][_0xed07('0x6a')]+(_0x4e4db3(_0x2c48e9[_0xed07('0x67')][_0x3e54c5][_0xed07('0x6a')])?'\x20'+_0x2c48e9[_0xed07('0x67')][_0x3e54c5][_0xed07('0x6b')]:'');}return _0x367bf5+')';};var _0x17a796={'where':{'id':_0x5bd6d1[_0xed07('0x4a')]['id']}},_0x22fde4,_0x45a1ac,_0x36b4f5,_0x587286,_0x1a27a8;_0x17a796=_[_0xed07('0x41')]({},_0x17a796,_0x5bd6d1['options']);return db['AnalyticCustomReport'][_0xed07('0x4c')](_0x17a796)[_0xed07('0x24')](function(_0x582089){if(_0x582089){_0x22fde4=_0x582089;return _0x582089[_0xed07('0x6c')]();}return null;})['then'](function(_0x2c8f12){if(_0x2c8f12){if(!_0x2c8f12['length']){throw new db[(_0xed07('0x6d'))][(_0xed07('0x6e'))](_0xed07('0x6f'),0x193);}_0x45a1ac=_0x2c8f12;return db[_0xed07('0x70')][_0xed07('0x47')]({'raw':!![]});}return null;})[_0xed07('0x24')](function(_0x54875f){if(_0x54875f){_0x36b4f5=_[_0xed07('0x71')](_0x54875f,'id');var _0x4835c4;var _0x1c0d52=squel['select']();_0x1c0d52[_0xed07('0x72')](_0x22fde4['table']);for(var _0x50b8e1=0x0;_0x50b8e1<_0x45a1ac[_0xed07('0x38')];_0x50b8e1+=0x1){_0x4835c4=_0x45a1ac[_0x50b8e1]['MetricId']?_0x36b4f5[_0x45a1ac[_0x50b8e1]['MetricId']]['metric']:_0x45a1ac[_0x50b8e1][_0xed07('0x73')];_0x4835c4=_0x45a1ac[_0x50b8e1][_0xed07('0x74')]?_[_0xed07('0x75')](_0x57c844[_0x45a1ac[_0x50b8e1][_0xed07('0x74')]],'%s',_0x4835c4):_0x4835c4;_0x4835c4=_0x45a1ac[_0x50b8e1]['format']?_[_0xed07('0x75')](_0x549fc3[_0x45a1ac[_0x50b8e1][_0xed07('0x76')]],'%s',_0x4835c4):_0x4835c4;if(_0x45a1ac[_0x50b8e1][_0xed07('0x77')]){_0x1c0d52['group'](_0x4835c4);}_0x45a1ac[_0x50b8e1][_0xed07('0x78')]&&_0x1c0d52['order'](_0x4835c4,_0x45a1ac[_0x50b8e1][_0xed07('0x78')]===_0xed07('0x79')?![]:!![]);_0x1c0d52[_0xed07('0x73')](_0x4835c4,_0x45a1ac[_0x50b8e1][_0xed07('0x7a')]||_0x4835c4);}if(_0x22fde4['joins']){_0x22fde4[_0xed07('0x7b')]=JSON['parse'](_0x22fde4['joins']);for(var _0x463564=0x0;_0x463564<_0x22fde4[_0xed07('0x7b')][_0xed07('0x38')];_0x463564+=0x1){if(_0x22fde4[_0xed07('0x7b')][_0x463564]['type']&&_[_0xed07('0x65')](_0x5cd790,_0x22fde4['joins'][_0x463564][_0xed07('0x42')])&&_0x22fde4[_0xed07('0x7b')][_0x463564][_0xed07('0x7c')]&&_0x22fde4[_0xed07('0x7b')][_0x463564][_0xed07('0x7d')]&&_0x22fde4[_0xed07('0x7b')][_0x463564][_0xed07('0x7e')]){_0x1c0d52[_0x22fde4[_0xed07('0x7b')][_0x463564]['type']](_0x22fde4[_0xed07('0x7b')][_0x463564]['foreignTable'],null,util['format']('%s.%s\x20=\x20%s.%s',_0x22fde4[_0xed07('0x7f')],_0x22fde4[_0xed07('0x7b')][_0x463564][_0xed07('0x7c')],_0x22fde4['joins'][_0x463564][_0xed07('0x7d')],_0x22fde4[_0xed07('0x7b')][_0x463564][_0xed07('0x7e')]));}}}if(_0x22fde4[_0xed07('0x80')]){_0x22fde4['conditions']=JSON[_0xed07('0x81')](_0x22fde4[_0xed07('0x80')]);_0x1c0d52[_0xed07('0x40')](_0xf13ba3(_0x22fde4['conditions'][_0xed07('0x69')]));}_0x1a27a8=_0x1c0d52[_0xed07('0x82')]();_0x1c0d52[_0xed07('0x1e')](_0x30a220);_0x1c0d52[_0xed07('0x1f')](0x0);logger[_0xed07('0x83')](_0xed07('0x84'),_0x1c0d52[_0xed07('0x85')]());return dbH[_0xed07('0x86')][_0xed07('0x33')](_0x1c0d52[_0xed07('0x85')](),{'type':dbH[_0xed07('0x86')][_0xed07('0x87')]['SELECT']});}})[_0xed07('0x24')](respondWithResult(_0x56d830,null))[_0xed07('0x56')](handleError(_0x56d830,null));};function runReport(_0x82d8f8,_0x29bf9d,_0x5b3e14){var _0x5bc9dd=_0x29bf9d[_0xed07('0x2a')];var _0x198f5b=0xa;var _0x3491fb=[_0xed07('0x58'),_0xed07('0x88'),_0xed07('0x59'),_0xed07('0x5a')];var _0x376d01={'SUM':'SUM(%s)','COUNT':_0xed07('0x5c'),'COUNT DISTINCT':_0xed07('0x5d'),'MAX':_0xed07('0x5e'),'MIN':_0xed07('0x89'),'AVG':_0xed07('0x5f'),'GROUP_CONCAT':_0xed07('0x60'),'GROUP_CONCAT ASC':_0xed07('0x8a'),'GROUP_CONCAT DESC':_0xed07('0x61')};var _0x12e130={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xed07('0x63'),'HOUR':_0xed07('0x64'),'ROUND':_0xed07('0x8b'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x1d0254=function(_0x561473){return!_[_0xed07('0x65')]([_0xed07('0x8c'),_0xed07('0x8d'),'IS\x20EMPTY',_0xed07('0x66')],_0x561473);};var _0x2ae5dd=function(_0x18938e){if(!_0x18938e||!_0x18938e['rules']['length']){return'';}for(var _0x43c4c5='(',_0x183074=0x0;_0x183074<_0x18938e[_0xed07('0x67')]['length'];_0x183074+=0x1){_0x183074>0x0&&(_0x43c4c5+='\x20'+_0x18938e[_0xed07('0x68')]+'\x20');_0x43c4c5+=_0x18938e[_0xed07('0x67')][_0x183074][_0xed07('0x69')]?_0x2ae5dd(_0x18938e[_0xed07('0x67')][_0x183074][_0xed07('0x69')]):_0x18938e[_0xed07('0x67')][_0x183074][_0xed07('0x73')]+'\x20'+_0x18938e['rules'][_0x183074][_0xed07('0x6a')]+(_0x1d0254(_0x18938e[_0xed07('0x67')][_0x183074][_0xed07('0x6a')])?'\x20'+_0x18938e[_0xed07('0x67')][_0x183074][_0xed07('0x6b')]:'');}return _0x43c4c5+')';};var _0x54be7d={'where':{'id':_0x82d8f8['id']}},_0x5ebdb5,_0x4e8421,_0xe5631f,_0x113cd0,_0x3cfc43;_0x54be7d=_[_0xed07('0x41')]({},_0x54be7d,_0x5b3e14);return db[_0xed07('0x2e')][_0xed07('0x4c')](_0x54be7d)[_0xed07('0x24')](function(_0x4ec1e6){if(_0x4ec1e6){_0x5ebdb5=_0x4ec1e6;return _0x4ec1e6[_0xed07('0x6c')]();}return null;})[_0xed07('0x24')](function(_0x5b9114){if(_0x5b9114){if(!_0x5b9114[_0xed07('0x38')]){throw new db[(_0xed07('0x6d'))][(_0xed07('0x6e'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x4e8421=_0x5b9114;return db['AnalyticMetric']['findAll']({'raw':!![]});}return null;})[_0xed07('0x24')](function(_0x46c608){if(_0x46c608){_0xe5631f=_['keyBy'](_0x46c608,'id');var _0x2c99c2;var _0x3a42b9=squel[_0xed07('0x8e')]();_0x3a42b9[_0xed07('0x72')](_0x5ebdb5[_0xed07('0x7f')]);for(var _0x293b4d=0x0;_0x293b4d<_0x4e8421[_0xed07('0x38')];_0x293b4d+=0x1){_0x2c99c2=_0x4e8421[_0x293b4d][_0xed07('0x8f')]?_0xe5631f[_0x4e8421[_0x293b4d][_0xed07('0x8f')]]['metric']:_0x4e8421[_0x293b4d]['field'];_0x2c99c2=_0x4e8421[_0x293b4d][_0xed07('0x74')]?_['replace'](_0x376d01[_0x4e8421[_0x293b4d]['function']],'%s',_0x2c99c2):_0x2c99c2;_0x2c99c2=_0x4e8421[_0x293b4d][_0xed07('0x76')]?_[_0xed07('0x75')](_0x12e130[_0x4e8421[_0x293b4d][_0xed07('0x76')]],'%s',_0x2c99c2):_0x2c99c2;if(_0x4e8421[_0x293b4d][_0xed07('0x77')]){_0x3a42b9[_0xed07('0x69')](_0x2c99c2);}_0x4e8421[_0x293b4d]['orderBy']&&_0x3a42b9['order'](_0x2c99c2,_0x4e8421[_0x293b4d]['orderBy']===_0xed07('0x79')?![]:!![]);_0x3a42b9['field'](_0x2c99c2,_0x4e8421[_0x293b4d]['alias']||_0x2c99c2);}if(_0x5ebdb5[_0xed07('0x7b')]){_0x5ebdb5[_0xed07('0x7b')]=JSON['parse'](_0x5ebdb5['joins']);for(var _0x5c7a64=0x0;_0x5c7a64<_0x5ebdb5[_0xed07('0x7b')][_0xed07('0x38')];_0x5c7a64+=0x1){if(_0x5ebdb5[_0xed07('0x7b')][_0x5c7a64][_0xed07('0x42')]&&_['includes'](_0x3491fb,_0x5ebdb5[_0xed07('0x7b')][_0x5c7a64][_0xed07('0x42')])&&_0x5ebdb5[_0xed07('0x7b')][_0x5c7a64][_0xed07('0x7c')]&&_0x5ebdb5[_0xed07('0x7b')][_0x5c7a64]['foreignTable']&&_0x5ebdb5[_0xed07('0x7b')][_0x5c7a64][_0xed07('0x7e')]){_0x3a42b9[_0x5ebdb5['joins'][_0x5c7a64][_0xed07('0x42')]](_0x5ebdb5[_0xed07('0x7b')][_0x5c7a64]['foreignTable'],null,util[_0xed07('0x76')](_0xed07('0x90'),_0x5ebdb5['table'],_0x5ebdb5[_0xed07('0x7b')][_0x5c7a64][_0xed07('0x7c')],_0x5ebdb5['joins'][_0x5c7a64]['foreignTable'],_0x5ebdb5[_0xed07('0x7b')][_0x5c7a64][_0xed07('0x7e')]));}}}if(_0x5ebdb5[_0xed07('0x80')]){_0x5ebdb5[_0xed07('0x80')]=JSON[_0xed07('0x81')](_0x5ebdb5[_0xed07('0x80')]);_0x3a42b9[_0xed07('0x40')](_0x2ae5dd(_0x5ebdb5[_0xed07('0x80')][_0xed07('0x69')]));}_0x3cfc43=_0x3a42b9['clone']();_0x3a42b9['limit'](_0x198f5b);_0x3a42b9[_0xed07('0x1f')](0x0);return;}})[_0xed07('0x24')](function(){if(_0x29bf9d[_0xed07('0x91')]==='web'){return null;}var _0x201760=_[_0xed07('0x41')](_0x29bf9d,{'name':_0x29bf9d[_0xed07('0x92')]||_0x29bf9d[_0xed07('0x2a')]||_0x5ebdb5[_0xed07('0x2a')],'basename':_0x5bc9dd,'savename':util['format'](_0xed07('0x93'),_0x29bf9d[_0xed07('0x2a')]||_0x5ebdb5['name'],require('randomstring')[_0xed07('0x94')](0x4),_0x29bf9d['output']||'csv'),'reportId':_0x5ebdb5['id'],'reportType':_0xed07('0x95')});return db[_0xed07('0x96')]['create'](_0x201760,{'raw':!![]});})[_0xed07('0x24')](function(_0x4c23b3){if(_0x5ebdb5['table']==='cdr'){_0x3cfc43[_0xed07('0x40')](_0x5ebdb5['table']+_0xed07('0x97'),_0x29bf9d['startDate'],_0x29bf9d['endDate']);}else{_0x3cfc43[_0xed07('0x40')](_0x5ebdb5[_0xed07('0x7f')]+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x29bf9d['startDate'],_0x29bf9d[_0xed07('0x98')]);}if(_0x4c23b3){logger['info'](_0xed07('0x99'),_0x3cfc43[_0xed07('0x85')]());require(_0xed07('0x9a'))[_0xed07('0x9b')](path[_0xed07('0x58')](__dirname,_0xed07('0x9c'),_0x4c23b3[_0xed07('0x91')]),[_0x4c23b3['id'],_0x3cfc43[_0xed07('0x85')](),path[_0xed07('0x58')](__dirname,'../../files/reports',_0x4c23b3[_0xed07('0x9d')]),_0x5bc9dd]);return _0x4c23b3;}else{var _0x2a5549=squel[_0xed07('0x8e')]();_0x2a5549['from']('('+_0x3cfc43[_0xed07('0x85')]()+')','countTable');_0x2a5549[_0xed07('0x73')]('COUNT(*)',_0xed07('0x44'));_0x3cfc43[_0xed07('0x1e')](_0x29bf9d[_0xed07('0x1e')]||_0x198f5b);_0x3cfc43['offset'](_0x29bf9d[_0xed07('0x1f')]||0x0);return dbH[_0xed07('0x86')][_0xed07('0x33')](_0x2a5549[_0xed07('0x85')](),{'type':dbH[_0xed07('0x86')][_0xed07('0x87')][_0xed07('0x9e')]})['then'](function(_0x456720){if(!_0x456720['length']){_0x113cd0=0x0;}else{_0x113cd0=_0x456720[0x0][_0xed07('0x44')]||0x0;}return dbH[_0xed07('0x86')][_0xed07('0x33')](_0x3cfc43['toString'](),{'type':dbH[_0xed07('0x86')][_0xed07('0x87')]['SELECT']});})[_0xed07('0x24')](function(_0xad4409){return{'rows':_0xad4409||[],'count':_0x113cd0};});}});}exports[_0xed07('0x9f')]=function(_0x292963,_0x1a9e4e){return runReport(_0x292963['params'],_0x292963['query'],_0x292963['options'])[_0xed07('0x24')](respondWithResult(_0x1a9e4e,null))['catch'](handleError(_0x1a9e4e,null));};exports['runReport']=runReport;exports[_0xed07('0x33')]=function(_0x163716,_0x1ce9b6){var _0x3e8b32=0xa;var _0x57bb47=[_0xed07('0x58'),_0xed07('0x88'),'right_join',_0xed07('0x5a')];var _0x2d0556={'SUM':'SUM(%s)','COUNT':'COUNT(%s)','COUNT DISTINCT':_0xed07('0x5d'),'MAX':_0xed07('0x5e'),'MIN':_0xed07('0x89'),'AVG':_0xed07('0x5f'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0xed07('0x8a'),'GROUP_CONCAT DESC':_0xed07('0x61')};var _0x50a62f={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xed07('0x63'),'HOUR':_0xed07('0x64'),'ROUND':_0xed07('0x8b'),'UNIX_TIMESTAMP':_0xed07('0xa0')};var _0x5aa118=function(_0x28554e){return!_['includes']([_0xed07('0x8c'),_0xed07('0x8d'),'IS\x20EMPTY',_0xed07('0x66')],_0x28554e);};var _0x3c400a=function(_0x468d64){if(!_0x468d64||!_0x468d64['rules'][_0xed07('0x38')]){return'';}for(var _0x1da1df='(',_0x377259=0x0;_0x377259<_0x468d64['rules'][_0xed07('0x38')];_0x377259+=0x1){_0x377259>0x0&&(_0x1da1df+='\x20'+_0x468d64['operator']+'\x20');_0x1da1df+=_0x468d64['rules'][_0x377259][_0xed07('0x69')]?_0x3c400a(_0x468d64['rules'][_0x377259][_0xed07('0x69')]):_0x468d64[_0xed07('0x67')][_0x377259][_0xed07('0x73')]+'\x20'+_0x468d64[_0xed07('0x67')][_0x377259][_0xed07('0x6a')]+(_0x5aa118(_0x468d64[_0xed07('0x67')][_0x377259][_0xed07('0x6a')])?'\x20'+_0x468d64['rules'][_0x377259][_0xed07('0x6b')]:'');}return _0x1da1df+')';};var _0x4d6f58={'where':{'id':_0x163716['params']['id']}},_0x50c2e0,_0x7ec40c,_0x1f4833,_0xcf40dc,_0x39ef0c;_0x4d6f58=_[_0xed07('0x41')]({},_0x4d6f58,_0x163716['options']);return db[_0xed07('0x2e')]['find'](_0x4d6f58)[_0xed07('0x24')](function(_0x57219a){if(_0x57219a){_0x50c2e0=_0x57219a;return _0x57219a[_0xed07('0x6c')]();}return null;})[_0xed07('0x24')](function(_0xd46710){if(_0xd46710){if(!_0xd46710[_0xed07('0x38')]){throw new db[(_0xed07('0x6d'))][(_0xed07('0x6e'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x7ec40c=_0xd46710;return db[_0xed07('0x70')]['findAll']({'raw':!![]});}return null;})[_0xed07('0x24')](function(_0x12a782){if(_0x12a782){_0x1f4833=_['keyBy'](_0x12a782,'id');var _0xa50109;var _0x447158=squel[_0xed07('0x8e')]();_0x447158['from'](_0x50c2e0[_0xed07('0x7f')]);for(var _0xc26b71=0x0;_0xc26b71<_0x7ec40c[_0xed07('0x38')];_0xc26b71+=0x1){_0xa50109=_0x7ec40c[_0xc26b71][_0xed07('0x8f')]?_0x1f4833[_0x7ec40c[_0xc26b71]['MetricId']][_0xed07('0xa1')]:_0x7ec40c[_0xc26b71]['field'];_0xa50109=_0x7ec40c[_0xc26b71][_0xed07('0x74')]?_['replace'](_0x2d0556[_0x7ec40c[_0xc26b71][_0xed07('0x74')]],'%s',_0xa50109):_0xa50109;_0xa50109=_0x7ec40c[_0xc26b71][_0xed07('0x76')]?_[_0xed07('0x75')](_0x50a62f[_0x7ec40c[_0xc26b71][_0xed07('0x76')]],'%s',_0xa50109):_0xa50109;if(_0x7ec40c[_0xc26b71][_0xed07('0x77')]){_0x447158['group'](_0xa50109);}_0x7ec40c[_0xc26b71][_0xed07('0x78')]&&_0x447158[_0xed07('0x3b')](_0xa50109,_0x7ec40c[_0xc26b71]['orderBy']==='DESC'?![]:!![]);_0x447158[_0xed07('0x73')](_0xa50109,_0x7ec40c[_0xc26b71][_0xed07('0x7a')]||_0xa50109);}if(_0x50c2e0[_0xed07('0x7b')]){_0x50c2e0[_0xed07('0x7b')]=JSON[_0xed07('0x81')](_0x50c2e0[_0xed07('0x7b')]);for(var _0x59b805=0x0;_0x59b805<_0x50c2e0['joins']['length'];_0x59b805+=0x1){if(_0x50c2e0[_0xed07('0x7b')][_0x59b805][_0xed07('0x42')]&&_[_0xed07('0x65')](_0x57bb47,_0x50c2e0[_0xed07('0x7b')][_0x59b805][_0xed07('0x42')])&&_0x50c2e0[_0xed07('0x7b')][_0x59b805][_0xed07('0x7c')]&&_0x50c2e0['joins'][_0x59b805][_0xed07('0x7d')]&&_0x50c2e0[_0xed07('0x7b')][_0x59b805][_0xed07('0x7e')]){_0x447158[_0x50c2e0['joins'][_0x59b805][_0xed07('0x42')]](_0x50c2e0[_0xed07('0x7b')][_0x59b805]['foreignTable'],null,util[_0xed07('0x76')](_0xed07('0x90'),_0x50c2e0[_0xed07('0x7f')],_0x50c2e0[_0xed07('0x7b')][_0x59b805][_0xed07('0x7c')],_0x50c2e0[_0xed07('0x7b')][_0x59b805][_0xed07('0x7d')],_0x50c2e0[_0xed07('0x7b')][_0x59b805][_0xed07('0x7e')]));}}}if(_0x50c2e0['conditions']){_0x50c2e0[_0xed07('0x80')]=JSON[_0xed07('0x81')](_0x50c2e0[_0xed07('0x80')]);_0x447158['where'](_0x3c400a(_0x50c2e0[_0xed07('0x80')][_0xed07('0x69')]));}_0x39ef0c=_0x447158[_0xed07('0x82')]();_0x447158[_0xed07('0x1e')](_0x3e8b32);_0x447158[_0xed07('0x1f')](0x0);logger[_0xed07('0x83')](_0xed07('0x84'),_0x447158[_0xed07('0x85')]());return dbH[_0xed07('0x86')]['query'](_0x447158[_0xed07('0x85')](),{'type':dbH[_0xed07('0x86')]['QueryTypes'][_0xed07('0x9e')]});}})[_0xed07('0x24')](function(){return{'sql':_0x39ef0c[_0xed07('0x85')]()};})[_0xed07('0x24')](respondWithResult(_0x1ce9b6,null))[_0xed07('0x56')](handleError(_0x1ce9b6,null));}; \ No newline at end of file +var _0xa33d=['../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','Content-Range','reject','update','then','UserProfileResource','destroy','error','name','send','map','AnalyticCustomReport','fieldName','type','model','query','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','catch','params','rawAttributes','keys','filters','length','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','Reports','UserProfileSection','userProfileId','autoAssociation','CustomReports','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','preview','join','left_join','right_join','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','value','getFields','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','findAll','keyBy','select','from','table','MetricId','function','replace','format','orderBy','DESC','joins','parse','parentKey','foreignTable','foreignKey','conditions','clone','Limited\x20Query:','toString','sequelize','SELECT','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','IS\x20NULL','IS\x20EMPTY','Sequelize','AnalyticMetric','metric','groupBy','alias','output','fullPath','%s-%s.%s','generate','csv','custom','AnalyticExtractedReport','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','child_process','fork','../../components/export/','../../files/reports','savename','countTable','COUNT(*)','QueryTypes','run','runReport','IS\x20NOT\x20NULL','%s.%s\x20=\x20%s.%s','debug','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','fs-extra','lodash','desk.js','to-csv','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa33d,0x8f));var _0xda33=function(_0x214f4d,_0x3153ad){_0x214f4d=_0x214f4d-0x0;var _0x5218e6=_0xa33d[_0x214f4d];return _0x5218e6;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xda33('0x0'));var zipdir=require(_0xda33('0x1'));var jsonpatch=require(_0xda33('0x2'));var rp=require(_0xda33('0x3'));var moment=require(_0xda33('0x4'));var BPromise=require(_0xda33('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xda33('0x6'));var sox=require(_0xda33('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xda33('0x8'));var _=require(_0xda33('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xda33('0xa'));var toCsv=require(_0xda33('0xb'));var querystring=require(_0xda33('0xc'));var Papa=require('papaparse');var Redis=require(_0xda33('0xd'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xda33('0xe'));var hardwareService=require(_0xda33('0xf'));var logger=require(_0xda33('0x10'))('api');var utils=require(_0xda33('0x11'));var config=require(_0xda33('0x12'));var licenseUtil=require(_0xda33('0x13'));var db=require(_0xda33('0x14'))['db'];var dbH=require('../../mysqldb')['dbH'];function respondWithStatusCode(_0x42fdb3,_0x2ab371){_0x2ab371=_0x2ab371||0xcc;return function(_0x1e4f57){if(_0x1e4f57){return _0x42fdb3[_0xda33('0x15')](_0x2ab371);}return _0x42fdb3['status'](_0x2ab371)['end']();};}function respondWithResult(_0x56d423,_0x5f4722){_0x5f4722=_0x5f4722||0xc8;return function(_0x2bf0c4){if(_0x2bf0c4){return _0x56d423[_0xda33('0x16')](_0x5f4722)[_0xda33('0x17')](_0x2bf0c4);}};}function respondWithFilteredResult(_0xc98127,_0x342def){return function(_0x300e3f){if(_0x300e3f){var _0x4aa762=typeof _0x342def[_0xda33('0x18')]==='undefined'&&typeof _0x342def[_0xda33('0x19')]===_0xda33('0x1a');var _0x22928d=_0x300e3f[_0xda33('0x1b')];var _0x2cbb63=_0x4aa762?0x0:_0x342def[_0xda33('0x18')];var _0x3a6b0b=_0x4aa762?_0x300e3f[_0xda33('0x1b')]:_0x342def[_0xda33('0x18')]+_0x342def[_0xda33('0x19')];var _0x340401;if(_0x3a6b0b>=_0x22928d){_0x3a6b0b=_0x22928d;_0x340401=0xc8;}else{_0x340401=0xce;}_0xc98127[_0xda33('0x16')](_0x340401);return _0xc98127['set'](_0xda33('0x1c'),_0x2cbb63+'-'+_0x3a6b0b+'/'+_0x22928d)[_0xda33('0x17')](_0x300e3f);}return null;};}function patchUpdates(_0x4fcaa4){return function(_0x586f2f){try{jsonpatch['apply'](_0x586f2f,_0x4fcaa4,!![]);}catch(_0x46e601){return BPromise[_0xda33('0x1d')](_0x46e601);}return _0x586f2f['save']();};}function saveUpdates(_0x4f6a0e,_0x2e319c){return function(_0xcdebf3){if(_0xcdebf3){return _0xcdebf3[_0xda33('0x1e')](_0x4f6a0e)[_0xda33('0x1f')](function(_0x12c538){return _0x12c538;});}return null;};}function removeEntity(_0x261642,_0x2955f1){return function(_0x48aed8){if(_0x48aed8){return _0x48aed8['destroy']()['then'](function(){var _0x5a7ba1=_0x48aed8['get']({'plain':!![]});var _0x1ccb6a='CustomReports';return db[_0xda33('0x20')][_0xda33('0x21')]({'where':{'type':_0x1ccb6a,'resourceId':_0x5a7ba1['id']}})[_0xda33('0x1f')](function(){return _0x48aed8;});})['then'](function(){_0x261642[_0xda33('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5b9021,_0x4e1eca){return function(_0x3b5e16){if(!_0x3b5e16){_0x5b9021[_0xda33('0x15')](0x194);}return _0x3b5e16;};}function handleError(_0x2be28e,_0x45810c){_0x45810c=_0x45810c||0x1f4;return function(_0x142486){logger[_0xda33('0x22')](_0x142486['stack']);if(_0x142486[_0xda33('0x23')]){delete _0x142486['name'];}_0x2be28e[_0xda33('0x16')](_0x45810c)[_0xda33('0x24')](_0x142486);};}exports['index']=function(_0x168ac4,_0xe7714c){var _0x1acc7e={},_0x47620f={},_0xddbff9={'count':0x0,'rows':[]};var _0x4d4b4e=_[_0xda33('0x25')](db[_0xda33('0x26')]['rawAttributes'],function(_0x4ffc2b){return{'name':_0x4ffc2b[_0xda33('0x27')],'type':_0x4ffc2b[_0xda33('0x28')]['key']};});_0x47620f[_0xda33('0x29')]=_[_0xda33('0x25')](_0x4d4b4e,_0xda33('0x23'));_0x47620f['query']=_['keys'](_0x168ac4[_0xda33('0x2a')]);_0x47620f['filters']=_[_0xda33('0x2b')](_0x47620f[_0xda33('0x29')],_0x47620f[_0xda33('0x2a')]);_0x1acc7e['attributes']=_[_0xda33('0x2b')](_0x47620f['model'],qs[_0xda33('0x2c')](_0x168ac4['query'][_0xda33('0x2c')]));_0x1acc7e[_0xda33('0x2d')]=_0x1acc7e[_0xda33('0x2d')]['length']?_0x1acc7e[_0xda33('0x2d')]:_0x47620f['model'];if(!_0x168ac4[_0xda33('0x2a')][_0xda33('0x2e')](_0xda33('0x2f'))){_0x1acc7e['limit']=qs[_0xda33('0x19')](_0x168ac4['query'][_0xda33('0x19')]);_0x1acc7e[_0xda33('0x18')]=qs['offset'](_0x168ac4[_0xda33('0x2a')]['offset']);}_0x1acc7e[_0xda33('0x30')]=qs[_0xda33('0x31')](_0x168ac4['query'][_0xda33('0x31')]);_0x1acc7e[_0xda33('0x32')]=qs['filters'](_[_0xda33('0x33')](_0x168ac4[_0xda33('0x2a')],_0x47620f['filters']),_0x4d4b4e);if(_0x168ac4['query'][_0xda33('0x34')]){_0x1acc7e['where']=_[_0xda33('0x35')](_0x1acc7e[_0xda33('0x32')],{'$or':_[_0xda33('0x25')](_0x4d4b4e,function(_0x6409d9){if(_0x6409d9[_0xda33('0x28')]!==_0xda33('0x36')){var _0x58ddde={};_0x58ddde[_0x6409d9['name']]={'$like':'%'+_0x168ac4[_0xda33('0x2a')]['filter']+'%'};return _0x58ddde;}})});}_0x1acc7e=_[_0xda33('0x35')]({},_0x1acc7e,_0x168ac4[_0xda33('0x37')]);var _0xf324e0={'where':_0x1acc7e[_0xda33('0x32')]};return db[_0xda33('0x26')][_0xda33('0x1b')](_0xf324e0)[_0xda33('0x1f')](function(_0x4c3ae6){_0xddbff9[_0xda33('0x1b')]=_0x4c3ae6;if(_0x168ac4[_0xda33('0x2a')][_0xda33('0x38')]){_0x1acc7e[_0xda33('0x39')]=[{'all':!![]}];}return db[_0xda33('0x26')]['findAll'](_0x1acc7e);})[_0xda33('0x1f')](function(_0x5cabd9){_0xddbff9['rows']=_0x5cabd9;return _0xddbff9;})[_0xda33('0x1f')](respondWithFilteredResult(_0xe7714c,_0x1acc7e))[_0xda33('0x3a')](handleError(_0xe7714c,null));};exports['show']=function(_0x37beb4,_0x27311b){var _0x3726dd={'raw':![],'where':{'id':_0x37beb4[_0xda33('0x3b')]['id']}},_0x3ecb91={};_0x3ecb91[_0xda33('0x29')]=_['keys'](db[_0xda33('0x26')][_0xda33('0x3c')]);_0x3ecb91[_0xda33('0x2a')]=_[_0xda33('0x3d')](_0x37beb4['query']);_0x3ecb91[_0xda33('0x3e')]=_['intersection'](_0x3ecb91[_0xda33('0x29')],_0x3ecb91[_0xda33('0x2a')]);_0x3726dd[_0xda33('0x2d')]=_[_0xda33('0x2b')](_0x3ecb91[_0xda33('0x29')],qs[_0xda33('0x2c')](_0x37beb4[_0xda33('0x2a')][_0xda33('0x2c')]));_0x3726dd['attributes']=_0x3726dd[_0xda33('0x2d')][_0xda33('0x3f')]?_0x3726dd[_0xda33('0x2d')]:_0x3ecb91['model'];if(_0x37beb4[_0xda33('0x2a')][_0xda33('0x38')]){_0x3726dd[_0xda33('0x39')]=[{'all':!![]}];}_0x3726dd=_[_0xda33('0x35')]({},_0x3726dd,_0x37beb4['options']);return db[_0xda33('0x26')][_0xda33('0x40')](_0x3726dd)[_0xda33('0x1f')](handleEntityNotFound(_0x27311b,null))['then'](respondWithResult(_0x27311b,null))['catch'](handleError(_0x27311b,null));};exports[_0xda33('0x41')]=function(_0x1dcc64,_0x584ea9){return db[_0xda33('0x26')][_0xda33('0x41')](_0x1dcc64[_0xda33('0x42')],{})[_0xda33('0x1f')](function(_0x43ab8d){var _0x4e81f9=_0x1dcc64[_0xda33('0x43')][_0xda33('0x44')]({'plain':!![]});if(!_0x4e81f9)throw new Error(_0xda33('0x45'));if(_0x4e81f9['role']===_0xda33('0x43')){var _0x566bdc=_0x43ab8d[_0xda33('0x44')]({'plain':!![]});var _0x575c2=_0xda33('0x46');return db[_0xda33('0x47')]['find']({'where':{'name':_0x575c2,'userProfileId':_0x4e81f9[_0xda33('0x48')]},'raw':!![]})['then'](function(_0x1bbb1c){if(_0x1bbb1c&&_0x1bbb1c[_0xda33('0x49')]===0x0){return db[_0xda33('0x20')]['create']({'name':_0x566bdc[_0xda33('0x23')],'resourceId':_0x566bdc['id'],'type':_0xda33('0x4a'),'sectionId':_0x1bbb1c['id']},{})[_0xda33('0x1f')](function(){return _0x43ab8d;});}else{return _0x43ab8d;}})[_0xda33('0x3a')](function(_0x700803){logger['error'](_0xda33('0x4b'),_0x700803);throw _0x700803;});}return _0x43ab8d;})[_0xda33('0x1f')](respondWithResult(_0x584ea9,0xc9))['catch'](handleError(_0x584ea9,null));};exports['update']=function(_0x3be859,_0x451bb2){if(_0x3be859[_0xda33('0x42')]['id']){delete _0x3be859[_0xda33('0x42')]['id'];}return db['AnalyticCustomReport'][_0xda33('0x40')]({'where':{'id':_0x3be859[_0xda33('0x3b')]['id']}})[_0xda33('0x1f')](handleEntityNotFound(_0x451bb2,null))[_0xda33('0x1f')](saveUpdates(_0x3be859[_0xda33('0x42')],null))[_0xda33('0x1f')](respondWithResult(_0x451bb2,null))['catch'](handleError(_0x451bb2,null));};exports[_0xda33('0x21')]=function(_0x2df531,_0x3b73da){return db['AnalyticCustomReport']['find']({'where':{'id':_0x2df531[_0xda33('0x3b')]['id']}})[_0xda33('0x1f')](handleEntityNotFound(_0x3b73da,null))[_0xda33('0x1f')](removeEntity(_0x3b73da,null))[_0xda33('0x3a')](handleError(_0x3b73da,null));};exports[_0xda33('0x4c')]=function(_0xb2c643,_0x59fd3b){var _0x56f479=0xa;var _0x236101=[_0xda33('0x4d'),_0xda33('0x4e'),_0xda33('0x4f'),_0xda33('0x50')];var _0x5370fc={'SUM':_0xda33('0x51'),'COUNT':_0xda33('0x52'),'COUNT DISTINCT':_0xda33('0x53'),'MAX':_0xda33('0x54'),'MIN':_0xda33('0x55'),'AVG':_0xda33('0x56'),'GROUP_CONCAT':_0xda33('0x57'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xda33('0x58')};var _0x528cd4={'SEC_TO_TIME':_0xda33('0x59'),'DATE':_0xda33('0x5a'),'HOUR':_0xda33('0x5b'),'ROUND':_0xda33('0x5c'),'UNIX_TIMESTAMP':_0xda33('0x5d')};var _0x547aa5=function(_0x106d87){return!_[_0xda33('0x5e')](['IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY',_0xda33('0x5f')],_0x106d87);};var _0x13baeb=function(_0x16f9bd){if(!_0x16f9bd||!_0x16f9bd[_0xda33('0x60')]['length']){return'';}for(var _0x1a5c34='(',_0x49349b=0x0;_0x49349b<_0x16f9bd['rules'][_0xda33('0x3f')];_0x49349b+=0x1){_0x49349b>0x0&&(_0x1a5c34+='\x20'+_0x16f9bd[_0xda33('0x61')]+'\x20');_0x1a5c34+=_0x16f9bd[_0xda33('0x60')][_0x49349b][_0xda33('0x62')]?_0x13baeb(_0x16f9bd['rules'][_0x49349b][_0xda33('0x62')]):_0x16f9bd[_0xda33('0x60')][_0x49349b][_0xda33('0x63')]+'\x20'+_0x16f9bd['rules'][_0x49349b][_0xda33('0x64')]+(_0x547aa5(_0x16f9bd[_0xda33('0x60')][_0x49349b][_0xda33('0x64')])?'\x20'+_0x16f9bd[_0xda33('0x60')][_0x49349b][_0xda33('0x65')]:'');}return _0x1a5c34+')';};var _0x3284b9={'where':{'id':_0xb2c643[_0xda33('0x3b')]['id']}},_0x25888b,_0x31ea41,_0x3d6cf6,_0x26fd1e,_0x3d83c7;_0x3284b9=_[_0xda33('0x35')]({},_0x3284b9,_0xb2c643[_0xda33('0x37')]);return db[_0xda33('0x26')][_0xda33('0x40')](_0x3284b9)[_0xda33('0x1f')](function(_0x4765c9){if(_0x4765c9){_0x25888b=_0x4765c9;return _0x4765c9[_0xda33('0x66')]();}return null;})[_0xda33('0x1f')](function(_0x3eb953){if(_0x3eb953){if(!_0x3eb953['length']){throw new db['Sequelize'][(_0xda33('0x67'))](_0xda33('0x68'),0x193);}_0x31ea41=_0x3eb953;return db['AnalyticMetric'][_0xda33('0x69')]({'raw':!![]});}return null;})[_0xda33('0x1f')](function(_0x2bf423){if(_0x2bf423){_0x3d6cf6=_[_0xda33('0x6a')](_0x2bf423,'id');var _0x482af1;var _0x12be75=squel[_0xda33('0x6b')]();_0x12be75[_0xda33('0x6c')](_0x25888b[_0xda33('0x6d')]);for(var _0x3108f3=0x0;_0x3108f3<_0x31ea41[_0xda33('0x3f')];_0x3108f3+=0x1){_0x482af1=_0x31ea41[_0x3108f3][_0xda33('0x6e')]?_0x3d6cf6[_0x31ea41[_0x3108f3][_0xda33('0x6e')]]['metric']:_0x31ea41[_0x3108f3][_0xda33('0x63')];_0x482af1=_0x31ea41[_0x3108f3][_0xda33('0x6f')]?_['replace'](_0x5370fc[_0x31ea41[_0x3108f3][_0xda33('0x6f')]],'%s',_0x482af1):_0x482af1;_0x482af1=_0x31ea41[_0x3108f3]['format']?_[_0xda33('0x70')](_0x528cd4[_0x31ea41[_0x3108f3][_0xda33('0x71')]],'%s',_0x482af1):_0x482af1;if(_0x31ea41[_0x3108f3]['groupBy']){_0x12be75[_0xda33('0x62')](_0x482af1);}_0x31ea41[_0x3108f3]['orderBy']&&_0x12be75[_0xda33('0x30')](_0x482af1,_0x31ea41[_0x3108f3][_0xda33('0x72')]===_0xda33('0x73')?![]:!![]);_0x12be75[_0xda33('0x63')](_0x482af1,_0x31ea41[_0x3108f3]['alias']||_0x482af1);}if(_0x25888b[_0xda33('0x74')]){_0x25888b[_0xda33('0x74')]=JSON[_0xda33('0x75')](_0x25888b[_0xda33('0x74')]);for(var _0x3241d0=0x0;_0x3241d0<_0x25888b['joins'][_0xda33('0x3f')];_0x3241d0+=0x1){if(_0x25888b['joins'][_0x3241d0][_0xda33('0x28')]&&_[_0xda33('0x5e')](_0x236101,_0x25888b[_0xda33('0x74')][_0x3241d0][_0xda33('0x28')])&&_0x25888b['joins'][_0x3241d0][_0xda33('0x76')]&&_0x25888b[_0xda33('0x74')][_0x3241d0][_0xda33('0x77')]&&_0x25888b['joins'][_0x3241d0][_0xda33('0x78')]){_0x12be75[_0x25888b[_0xda33('0x74')][_0x3241d0][_0xda33('0x28')]](_0x25888b[_0xda33('0x74')][_0x3241d0][_0xda33('0x77')],null,util[_0xda33('0x71')]('%s.%s\x20=\x20%s.%s',_0x25888b[_0xda33('0x6d')],_0x25888b[_0xda33('0x74')][_0x3241d0][_0xda33('0x76')],_0x25888b[_0xda33('0x74')][_0x3241d0][_0xda33('0x77')],_0x25888b['joins'][_0x3241d0][_0xda33('0x78')]));}}}if(_0x25888b[_0xda33('0x79')]){_0x25888b['conditions']=JSON[_0xda33('0x75')](_0x25888b['conditions']);_0x12be75['where'](_0x13baeb(_0x25888b['conditions'][_0xda33('0x62')]));}_0x3d83c7=_0x12be75[_0xda33('0x7a')]();_0x12be75[_0xda33('0x19')](_0x56f479);_0x12be75[_0xda33('0x18')](0x0);logger['debug'](_0xda33('0x7b'),_0x12be75[_0xda33('0x7c')]());return dbH[_0xda33('0x7d')][_0xda33('0x2a')](_0x12be75[_0xda33('0x7c')](),{'type':dbH[_0xda33('0x7d')]['QueryTypes'][_0xda33('0x7e')]});}})[_0xda33('0x1f')](respondWithResult(_0x59fd3b,null))[_0xda33('0x3a')](handleError(_0x59fd3b,null));};function runReport(_0xa9641a,_0x57c5f9,_0x45e814){var _0xae6491=_0x57c5f9[_0xda33('0x23')];var _0x11c9c6=0xa;var _0xa0c674=[_0xda33('0x4d'),_0xda33('0x4e'),_0xda33('0x4f'),_0xda33('0x50')];var _0x176a63={'SUM':_0xda33('0x51'),'COUNT':_0xda33('0x52'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':'MAX(%s)','MIN':_0xda33('0x55'),'AVG':_0xda33('0x56'),'GROUP_CONCAT':_0xda33('0x57'),'GROUP_CONCAT ASC':_0xda33('0x7f'),'GROUP_CONCAT DESC':_0xda33('0x58')};var _0x3b34ab={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xda33('0x5a'),'HOUR':_0xda33('0x5b'),'ROUND':_0xda33('0x5c'),'UNIX_TIMESTAMP':_0xda33('0x5d')};var _0x2877a9=function(_0x588447){return!_[_0xda33('0x5e')]([_0xda33('0x80'),'IS\x20NOT\x20NULL',_0xda33('0x81'),_0xda33('0x5f')],_0x588447);};var _0x310b8b=function(_0x498b1f){if(!_0x498b1f||!_0x498b1f['rules']['length']){return'';}for(var _0x9ca72b='(',_0x3b423a=0x0;_0x3b423a<_0x498b1f[_0xda33('0x60')][_0xda33('0x3f')];_0x3b423a+=0x1){_0x3b423a>0x0&&(_0x9ca72b+='\x20'+_0x498b1f[_0xda33('0x61')]+'\x20');_0x9ca72b+=_0x498b1f[_0xda33('0x60')][_0x3b423a][_0xda33('0x62')]?_0x310b8b(_0x498b1f[_0xda33('0x60')][_0x3b423a][_0xda33('0x62')]):_0x498b1f['rules'][_0x3b423a][_0xda33('0x63')]+'\x20'+_0x498b1f[_0xda33('0x60')][_0x3b423a]['condition']+(_0x2877a9(_0x498b1f[_0xda33('0x60')][_0x3b423a][_0xda33('0x64')])?'\x20'+_0x498b1f[_0xda33('0x60')][_0x3b423a][_0xda33('0x65')]:'');}return _0x9ca72b+')';};var _0x9bf68f={'where':{'id':_0xa9641a['id']}},_0x5f36fc,_0x30240f,_0x10f4e7,_0x43cc99,_0x5dd34a;_0x9bf68f=_[_0xda33('0x35')]({},_0x9bf68f,_0x45e814);return db[_0xda33('0x26')]['find'](_0x9bf68f)[_0xda33('0x1f')](function(_0x451497){if(_0x451497){_0x5f36fc=_0x451497;return _0x451497[_0xda33('0x66')]();}return null;})[_0xda33('0x1f')](function(_0x70a6cc){if(_0x70a6cc){if(!_0x70a6cc[_0xda33('0x3f')]){throw new db[(_0xda33('0x82'))][(_0xda33('0x67'))](_0xda33('0x68'),0x193);}_0x30240f=_0x70a6cc;return db[_0xda33('0x83')]['findAll']({'raw':!![]});}return null;})[_0xda33('0x1f')](function(_0x3f58b7){if(_0x3f58b7){_0x10f4e7=_[_0xda33('0x6a')](_0x3f58b7,'id');var _0x31f557;var _0x29520c=squel['select']();_0x29520c[_0xda33('0x6c')](_0x5f36fc[_0xda33('0x6d')]);for(var _0x1db94e=0x0;_0x1db94e<_0x30240f['length'];_0x1db94e+=0x1){_0x31f557=_0x30240f[_0x1db94e]['MetricId']?_0x10f4e7[_0x30240f[_0x1db94e][_0xda33('0x6e')]][_0xda33('0x84')]:_0x30240f[_0x1db94e][_0xda33('0x63')];_0x31f557=_0x30240f[_0x1db94e][_0xda33('0x6f')]?_['replace'](_0x176a63[_0x30240f[_0x1db94e][_0xda33('0x6f')]],'%s',_0x31f557):_0x31f557;_0x31f557=_0x30240f[_0x1db94e]['format']?_[_0xda33('0x70')](_0x3b34ab[_0x30240f[_0x1db94e][_0xda33('0x71')]],'%s',_0x31f557):_0x31f557;if(_0x30240f[_0x1db94e][_0xda33('0x85')]){_0x29520c[_0xda33('0x62')](_0x31f557);}_0x30240f[_0x1db94e][_0xda33('0x72')]&&_0x29520c['order'](_0x31f557,_0x30240f[_0x1db94e][_0xda33('0x72')]==='DESC'?![]:!![]);_0x29520c[_0xda33('0x63')](_0x31f557,_0x30240f[_0x1db94e][_0xda33('0x86')]||_0x31f557);}if(_0x5f36fc[_0xda33('0x74')]){_0x5f36fc[_0xda33('0x74')]=JSON[_0xda33('0x75')](_0x5f36fc[_0xda33('0x74')]);for(var _0x2e7ba5=0x0;_0x2e7ba5<_0x5f36fc[_0xda33('0x74')][_0xda33('0x3f')];_0x2e7ba5+=0x1){if(_0x5f36fc[_0xda33('0x74')][_0x2e7ba5][_0xda33('0x28')]&&_[_0xda33('0x5e')](_0xa0c674,_0x5f36fc[_0xda33('0x74')][_0x2e7ba5][_0xda33('0x28')])&&_0x5f36fc[_0xda33('0x74')][_0x2e7ba5][_0xda33('0x76')]&&_0x5f36fc['joins'][_0x2e7ba5][_0xda33('0x77')]&&_0x5f36fc['joins'][_0x2e7ba5][_0xda33('0x78')]){_0x29520c[_0x5f36fc[_0xda33('0x74')][_0x2e7ba5][_0xda33('0x28')]](_0x5f36fc[_0xda33('0x74')][_0x2e7ba5][_0xda33('0x77')],null,util['format']('%s.%s\x20=\x20%s.%s',_0x5f36fc['table'],_0x5f36fc[_0xda33('0x74')][_0x2e7ba5][_0xda33('0x76')],_0x5f36fc[_0xda33('0x74')][_0x2e7ba5][_0xda33('0x77')],_0x5f36fc[_0xda33('0x74')][_0x2e7ba5][_0xda33('0x78')]));}}}if(_0x5f36fc[_0xda33('0x79')]){_0x5f36fc[_0xda33('0x79')]=JSON[_0xda33('0x75')](_0x5f36fc['conditions']);_0x29520c[_0xda33('0x32')](_0x310b8b(_0x5f36fc[_0xda33('0x79')][_0xda33('0x62')]));}_0x5dd34a=_0x29520c[_0xda33('0x7a')]();_0x29520c[_0xda33('0x19')](_0x11c9c6);_0x29520c['offset'](0x0);return;}})['then'](function(){if(_0x57c5f9[_0xda33('0x87')]==='web'){return null;}var _0x19cb9a=_[_0xda33('0x35')](_0x57c5f9,{'name':_0x57c5f9[_0xda33('0x88')]||_0x57c5f9[_0xda33('0x23')]||_0x5f36fc[_0xda33('0x23')],'basename':_0xae6491,'savename':util['format'](_0xda33('0x89'),_0x57c5f9[_0xda33('0x23')]||_0x5f36fc[_0xda33('0x23')],require('randomstring')[_0xda33('0x8a')](0x4),_0x57c5f9[_0xda33('0x87')]||_0xda33('0x8b')),'reportId':_0x5f36fc['id'],'reportType':_0xda33('0x8c')});return db[_0xda33('0x8d')][_0xda33('0x41')](_0x19cb9a,{'raw':!![]});})['then'](function(_0x44abf5){if(_0x5f36fc[_0xda33('0x6d')]==='cdr'){_0x5dd34a['where'](_0x5f36fc[_0xda33('0x6d')]+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x57c5f9[_0xda33('0x8e')],_0x57c5f9[_0xda33('0x8f')]);}else{_0x5dd34a[_0xda33('0x32')](_0x5f36fc[_0xda33('0x6d')]+_0xda33('0x90'),_0x57c5f9['startDate'],_0x57c5f9['endDate']);}if(_0x44abf5){logger[_0xda33('0x91')](_0xda33('0x92'),_0x5dd34a[_0xda33('0x7c')]());require(_0xda33('0x93'))[_0xda33('0x94')](path[_0xda33('0x4d')](__dirname,_0xda33('0x95'),_0x44abf5['output']),[_0x44abf5['id'],_0x5dd34a[_0xda33('0x7c')](),path['join'](__dirname,_0xda33('0x96'),_0x44abf5[_0xda33('0x97')]),_0xae6491]);return _0x44abf5;}else{var _0x50ee7b=squel[_0xda33('0x6b')]();_0x50ee7b[_0xda33('0x6c')]('('+_0x5dd34a[_0xda33('0x7c')]()+')',_0xda33('0x98'));_0x50ee7b[_0xda33('0x63')](_0xda33('0x99'),_0xda33('0x1b'));_0x5dd34a['limit'](_0x57c5f9[_0xda33('0x19')]||_0x11c9c6);_0x5dd34a[_0xda33('0x18')](_0x57c5f9[_0xda33('0x18')]||0x0);return dbH['sequelize'][_0xda33('0x2a')](_0x50ee7b[_0xda33('0x7c')](),{'type':dbH['sequelize'][_0xda33('0x9a')]['SELECT']})['then'](function(_0x45147a){if(!_0x45147a[_0xda33('0x3f')]){_0x43cc99=0x0;}else{_0x43cc99=_0x45147a[0x0][_0xda33('0x1b')]||0x0;}return dbH[_0xda33('0x7d')][_0xda33('0x2a')](_0x5dd34a['toString'](),{'type':dbH[_0xda33('0x7d')][_0xda33('0x9a')][_0xda33('0x7e')]});})['then'](function(_0x1e4676){return{'rows':_0x1e4676||[],'count':_0x43cc99};});}});}exports[_0xda33('0x9b')]=function(_0xf60957,_0x2dbdb8){return runReport(_0xf60957[_0xda33('0x3b')],_0xf60957[_0xda33('0x2a')],_0xf60957[_0xda33('0x37')])[_0xda33('0x1f')](respondWithResult(_0x2dbdb8,null))[_0xda33('0x3a')](handleError(_0x2dbdb8,null));};exports[_0xda33('0x9c')]=runReport;exports[_0xda33('0x2a')]=function(_0x24bd2f,_0x322aa4){var _0x599732=0xa;var _0x16fa77=[_0xda33('0x4d'),_0xda33('0x4e'),'right_join',_0xda33('0x50')];var _0x343b5d={'SUM':_0xda33('0x51'),'COUNT':_0xda33('0x52'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':'MAX(%s)','MIN':_0xda33('0x55'),'AVG':_0xda33('0x56'),'GROUP_CONCAT':_0xda33('0x57'),'GROUP_CONCAT ASC':_0xda33('0x7f'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x305df1={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xda33('0x5a'),'HOUR':_0xda33('0x5b'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0xda33('0x5d')};var _0x4f25e9=function(_0x16ae2a){return!_[_0xda33('0x5e')]([_0xda33('0x80'),_0xda33('0x9d'),_0xda33('0x81'),_0xda33('0x5f')],_0x16ae2a);};var _0x2dd0f2=function(_0x480113){if(!_0x480113||!_0x480113[_0xda33('0x60')][_0xda33('0x3f')]){return'';}for(var _0x5e1c01='(',_0x357491=0x0;_0x357491<_0x480113['rules']['length'];_0x357491+=0x1){_0x357491>0x0&&(_0x5e1c01+='\x20'+_0x480113[_0xda33('0x61')]+'\x20');_0x5e1c01+=_0x480113['rules'][_0x357491][_0xda33('0x62')]?_0x2dd0f2(_0x480113[_0xda33('0x60')][_0x357491]['group']):_0x480113[_0xda33('0x60')][_0x357491][_0xda33('0x63')]+'\x20'+_0x480113[_0xda33('0x60')][_0x357491][_0xda33('0x64')]+(_0x4f25e9(_0x480113[_0xda33('0x60')][_0x357491]['condition'])?'\x20'+_0x480113[_0xda33('0x60')][_0x357491][_0xda33('0x65')]:'');}return _0x5e1c01+')';};var _0x3d50ba={'where':{'id':_0x24bd2f[_0xda33('0x3b')]['id']}},_0x1fd895,_0x3de1b8,_0x1b5454,_0x1d357f,_0x2a5375;_0x3d50ba=_[_0xda33('0x35')]({},_0x3d50ba,_0x24bd2f[_0xda33('0x37')]);return db[_0xda33('0x26')][_0xda33('0x40')](_0x3d50ba)[_0xda33('0x1f')](function(_0x55a982){if(_0x55a982){_0x1fd895=_0x55a982;return _0x55a982[_0xda33('0x66')]();}return null;})[_0xda33('0x1f')](function(_0x1d517a){if(_0x1d517a){if(!_0x1d517a['length']){throw new db[(_0xda33('0x82'))][(_0xda33('0x67'))](_0xda33('0x68'),0x193);}_0x3de1b8=_0x1d517a;return db['AnalyticMetric']['findAll']({'raw':!![]});}return null;})[_0xda33('0x1f')](function(_0x21c35e){if(_0x21c35e){_0x1b5454=_[_0xda33('0x6a')](_0x21c35e,'id');var _0x3081e2;var _0x2cf42e=squel[_0xda33('0x6b')]();_0x2cf42e['from'](_0x1fd895[_0xda33('0x6d')]);for(var _0x1ae7a1=0x0;_0x1ae7a1<_0x3de1b8['length'];_0x1ae7a1+=0x1){_0x3081e2=_0x3de1b8[_0x1ae7a1][_0xda33('0x6e')]?_0x1b5454[_0x3de1b8[_0x1ae7a1]['MetricId']][_0xda33('0x84')]:_0x3de1b8[_0x1ae7a1]['field'];_0x3081e2=_0x3de1b8[_0x1ae7a1]['function']?_['replace'](_0x343b5d[_0x3de1b8[_0x1ae7a1]['function']],'%s',_0x3081e2):_0x3081e2;_0x3081e2=_0x3de1b8[_0x1ae7a1][_0xda33('0x71')]?_[_0xda33('0x70')](_0x305df1[_0x3de1b8[_0x1ae7a1]['format']],'%s',_0x3081e2):_0x3081e2;if(_0x3de1b8[_0x1ae7a1][_0xda33('0x85')]){_0x2cf42e[_0xda33('0x62')](_0x3081e2);}_0x3de1b8[_0x1ae7a1][_0xda33('0x72')]&&_0x2cf42e[_0xda33('0x30')](_0x3081e2,_0x3de1b8[_0x1ae7a1][_0xda33('0x72')]===_0xda33('0x73')?![]:!![]);_0x2cf42e['field'](_0x3081e2,_0x3de1b8[_0x1ae7a1][_0xda33('0x86')]||_0x3081e2);}if(_0x1fd895[_0xda33('0x74')]){_0x1fd895[_0xda33('0x74')]=JSON[_0xda33('0x75')](_0x1fd895[_0xda33('0x74')]);for(var _0x236961=0x0;_0x236961<_0x1fd895[_0xda33('0x74')][_0xda33('0x3f')];_0x236961+=0x1){if(_0x1fd895['joins'][_0x236961]['type']&&_[_0xda33('0x5e')](_0x16fa77,_0x1fd895[_0xda33('0x74')][_0x236961][_0xda33('0x28')])&&_0x1fd895[_0xda33('0x74')][_0x236961][_0xda33('0x76')]&&_0x1fd895['joins'][_0x236961][_0xda33('0x77')]&&_0x1fd895[_0xda33('0x74')][_0x236961][_0xda33('0x78')]){_0x2cf42e[_0x1fd895['joins'][_0x236961]['type']](_0x1fd895[_0xda33('0x74')][_0x236961][_0xda33('0x77')],null,util[_0xda33('0x71')](_0xda33('0x9e'),_0x1fd895[_0xda33('0x6d')],_0x1fd895[_0xda33('0x74')][_0x236961][_0xda33('0x76')],_0x1fd895['joins'][_0x236961][_0xda33('0x77')],_0x1fd895[_0xda33('0x74')][_0x236961]['foreignKey']));}}}if(_0x1fd895[_0xda33('0x79')]){_0x1fd895[_0xda33('0x79')]=JSON[_0xda33('0x75')](_0x1fd895[_0xda33('0x79')]);_0x2cf42e['where'](_0x2dd0f2(_0x1fd895[_0xda33('0x79')][_0xda33('0x62')]));}_0x2a5375=_0x2cf42e[_0xda33('0x7a')]();_0x2cf42e[_0xda33('0x19')](_0x599732);_0x2cf42e[_0xda33('0x18')](0x0);logger[_0xda33('0x9f')](_0xda33('0x7b'),_0x2cf42e['toString']());return dbH['sequelize'][_0xda33('0x2a')](_0x2cf42e[_0xda33('0x7c')](),{'type':dbH['sequelize'][_0xda33('0x9a')]['SELECT']});}})[_0xda33('0x1f')](function(){return{'sql':_0x2a5375[_0xda33('0x7c')]()};})[_0xda33('0x1f')](respondWithResult(_0x322aa4,null))[_0xda33('0x3a')](handleError(_0x322aa4,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index 9d93a98..3b8d801 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 _0xc2a4=['../../config/logger','bluebird','path','rimraf','../../config/environment','./analyticCustomReport.attributes','exports','define','AnalyticCustomReport','analytics_custom_reports','lodash','util'];(function(_0x22e9fe,_0x3d019f){var _0x47cd19=function(_0x8fd5fc){while(--_0x8fd5fc){_0x22e9fe['push'](_0x22e9fe['shift']());}};_0x47cd19(++_0x3d019f);}(_0xc2a4,0x1d2));var _0x4c2a=function(_0x1354ed,_0x45b93d){_0x1354ed=_0x1354ed-0x0;var _0x5e3605=_0xc2a4[_0x1354ed];return _0x5e3605;};'use strict';var _=require(_0x4c2a('0x0'));var util=require(_0x4c2a('0x1'));var logger=require(_0x4c2a('0x2'))('api');var moment=require('moment');var BPromise=require(_0x4c2a('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4c2a('0x4'));var rimraf=require(_0x4c2a('0x5'));var config=require(_0x4c2a('0x6'));var attributes=require(_0x4c2a('0x7'));module[_0x4c2a('0x8')]=function(_0xc91c86,_0x542bcb){return _0xc91c86[_0x4c2a('0x9')](_0x4c2a('0xa'),attributes,{'tableName':_0x4c2a('0xb'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd0a3=['../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./analyticCustomReport.attributes','AnalyticCustomReport','analytics_custom_reports','lodash'];(function(_0x1acb5a,_0x112268){var _0x92d8c5=function(_0x3038a2){while(--_0x3038a2){_0x1acb5a['push'](_0x1acb5a['shift']());}};_0x92d8c5(++_0x112268);}(_0xd0a3,0x1a3));var _0x3d0a=function(_0x221a3f,_0x2c632a){_0x221a3f=_0x221a3f-0x0;var _0x756b2b=_0xd0a3[_0x221a3f];return _0x756b2b;};'use strict';var _=require(_0x3d0a('0x0'));var util=require('util');var logger=require(_0x3d0a('0x1'))(_0x3d0a('0x2'));var moment=require(_0x3d0a('0x3'));var BPromise=require('bluebird');var rp=require(_0x3d0a('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3d0a('0x5'));var config=require(_0x3d0a('0x6'));var attributes=require(_0x3d0a('0x7'));module['exports']=function(_0x1d278f,_0x2b6f9a){return _0x1d278f['define'](_0x3d0a('0x8'),attributes,{'tableName':_0x3d0a('0x9'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.rpc.js b/server/api/analyticCustomReport/analyticCustomReport.rpc.js index b55e466..eb7da2e 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 _0x9d68=['result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message'];(function(_0x11d447,_0x5b9c09){var _0x285004=function(_0x32ecab){while(--_0x32ecab){_0x11d447['push'](_0x11d447['shift']());}};_0x285004(++_0x5b9c09);}(_0x9d68,0xd1));var _0x89d6=function(_0x34b5ca,_0x594010){_0x34b5ca=_0x34b5ca-0x0;var _0x2d72c0=_0x9d68[_0x34b5ca];return _0x2d72c0;};'use strict';var _=require(_0x89d6('0x0'));var util=require('util');var moment=require(_0x89d6('0x1'));var BPromise=require(_0x89d6('0x2'));var rs=require(_0x89d6('0x3'));var fs=require('fs');var Redis=require(_0x89d6('0x4'));var db=require(_0x89d6('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x89d6('0x6'));var config=require(_0x89d6('0x7'));var jayson=require(_0x89d6('0x8'));var client=jayson[_0x89d6('0x9')][_0x89d6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x33ce6c,_0x2bfdb1,_0x239017){return new BPromise(function(_0x1769eb,_0x2aedf0){return client[_0x89d6('0xb')](_0x33ce6c,_0x239017)[_0x89d6('0xc')](function(_0x32bd5c){logger[_0x89d6('0xd')](_0x89d6('0xe'),_0x2bfdb1,_0x89d6('0xf'));logger[_0x89d6('0x10')]('AnalyticCustomReport,\x20%s,\x20%s,\x20%s',_0x2bfdb1,_0x89d6('0xf'),JSON[_0x89d6('0x11')](_0x32bd5c));if(_0x32bd5c[_0x89d6('0x12')]){if(_0x32bd5c['error'][_0x89d6('0x13')]===0x1f4){logger['error'](_0x89d6('0xe'),_0x2bfdb1,_0x32bd5c[_0x89d6('0x12')][_0x89d6('0x14')]);return _0x2aedf0(_0x32bd5c[_0x89d6('0x12')][_0x89d6('0x14')]);}logger[_0x89d6('0x12')](_0x89d6('0xe'),_0x2bfdb1,_0x32bd5c[_0x89d6('0x12')][_0x89d6('0x14')]);return _0x1769eb(_0x32bd5c[_0x89d6('0x12')][_0x89d6('0x14')]);}else{logger[_0x89d6('0xd')](_0x89d6('0xe'),_0x2bfdb1,'request\x20sent');_0x1769eb(_0x32bd5c[_0x89d6('0x15')][_0x89d6('0x14')]);}})[_0x89d6('0x16')](function(_0x350610){logger[_0x89d6('0x12')](_0x89d6('0xe'),_0x2bfdb1,_0x350610);_0x2aedf0(_0x350610);});});} \ No newline at end of file +var _0xa9c3=['../../config/environment','jayson/promise','client','http','info','AnalyticCustomReport,\x20%s,\x20%s','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x30e289,_0x1ed090){var _0x37d9a2=function(_0x306be5){while(--_0x306be5){_0x30e289['push'](_0x30e289['shift']());}};_0x37d9a2(++_0x1ed090);}(_0xa9c3,0x18e));var _0x3a9c=function(_0x8a969d,_0x339d9f){_0x8a969d=_0x8a969d-0x0;var _0x1d8dc7=_0xa9c3[_0x8a969d];return _0x1d8dc7;};'use strict';var _=require(_0x3a9c('0x0'));var util=require(_0x3a9c('0x1'));var moment=require(_0x3a9c('0x2'));var BPromise=require(_0x3a9c('0x3'));var rs=require(_0x3a9c('0x4'));var fs=require('fs');var Redis=require(_0x3a9c('0x5'));var db=require(_0x3a9c('0x6'))['db'];var utils=require(_0x3a9c('0x7'));var logger=require(_0x3a9c('0x8'))(_0x3a9c('0x9'));var config=require(_0x3a9c('0xa'));var jayson=require(_0x3a9c('0xb'));var client=jayson[_0x3a9c('0xc')][_0x3a9c('0xd')]({'port':0x232a});function respondWithRpcPromise(_0xfe17c6,_0x1cd332,_0x4e9edd){return new BPromise(function(_0xdd95f5,_0x11667f){return client['request'](_0xfe17c6,_0x4e9edd)['then'](function(_0x4ffd29){logger[_0x3a9c('0xe')](_0x3a9c('0xf'),_0x1cd332,'request\x20sent');logger[_0x3a9c('0x10')](_0x3a9c('0x11'),_0x1cd332,'request\x20sent',JSON[_0x3a9c('0x12')](_0x4ffd29));if(_0x4ffd29[_0x3a9c('0x13')]){if(_0x4ffd29['error']['code']===0x1f4){logger['error'](_0x3a9c('0xf'),_0x1cd332,_0x4ffd29[_0x3a9c('0x13')][_0x3a9c('0x14')]);return _0x11667f(_0x4ffd29[_0x3a9c('0x13')]['message']);}logger[_0x3a9c('0x13')](_0x3a9c('0xf'),_0x1cd332,_0x4ffd29[_0x3a9c('0x13')][_0x3a9c('0x14')]);return _0xdd95f5(_0x4ffd29[_0x3a9c('0x13')][_0x3a9c('0x14')]);}else{logger[_0x3a9c('0xe')]('AnalyticCustomReport,\x20%s,\x20%s',_0x1cd332,_0x3a9c('0x15'));_0xdd95f5(_0x4ffd29[_0x3a9c('0x16')][_0x3a9c('0x14')]);}})[_0x3a9c('0x17')](function(_0x5f546d){logger[_0x3a9c('0x13')](_0x3a9c('0xf'),_0x1cd332,_0x5f546d);_0x11667f(_0x5f546d);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index 369e385..839c1d3 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 _0x2c60=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','index','get','/:id','isAuthenticated','show','/:id/preview','preview','/:id/run','query','create','put','delete','destroy','exports','multer','util'];(function(_0x2d89ce,_0x24d58d){var _0x3fad10=function(_0xad0ec){while(--_0xad0ec){_0x2d89ce['push'](_0x2d89ce['shift']());}};_0x3fad10(++_0x24d58d);}(_0x2c60,0xcd));var _0x02c6=function(_0x6cf19c,_0x2f3f02){_0x6cf19c=_0x6cf19c-0x0;var _0xce14f3=_0x2c60[_0x6cf19c];return _0xce14f3;};'use strict';var multer=require(_0x02c6('0x0'));var util=require(_0x02c6('0x1'));var path=require(_0x02c6('0x2'));var timeout=require(_0x02c6('0x3'));var express=require(_0x02c6('0x4'));var router=express[_0x02c6('0x5')]();var fs_extra=require(_0x02c6('0x6'));var auth=require(_0x02c6('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x02c6('0x8'));var controller=require('./analyticCustomReport.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x02c6('0x9')]);router[_0x02c6('0xa')](_0x02c6('0xb'),auth[_0x02c6('0xc')](),controller[_0x02c6('0xd')]);router[_0x02c6('0xa')](_0x02c6('0xe'),auth[_0x02c6('0xc')](),controller[_0x02c6('0xf')]);router[_0x02c6('0xa')](_0x02c6('0x10'),auth[_0x02c6('0xc')](),controller['run']);router[_0x02c6('0xa')]('/:id/query',auth[_0x02c6('0xc')](),controller[_0x02c6('0x11')]);router['post']('/',auth[_0x02c6('0xc')](),controller[_0x02c6('0x12')]);router[_0x02c6('0x13')](_0x02c6('0xb'),auth[_0x02c6('0xc')](),controller['update']);router[_0x02c6('0x14')](_0x02c6('0xb'),auth['isAuthenticated'](),controller[_0x02c6('0x15')]);module[_0x02c6('0x16')]=router; \ No newline at end of file +var _0xf83f=['show','/:id/preview','preview','/:id/run','run','update','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','./analyticCustomReport.controller','isAuthenticated','get','/:id'];(function(_0x23a298,_0x21adb7){var _0x31a410=function(_0x3350b9){while(--_0x3350b9){_0x23a298['push'](_0x23a298['shift']());}};_0x31a410(++_0x21adb7);}(_0xf83f,0x185));var _0xff83=function(_0x2b553d,_0x5bc904){_0x2b553d=_0x2b553d-0x0;var _0xe9b379=_0xf83f[_0x2b553d];return _0xe9b379;};'use strict';var multer=require(_0xff83('0x0'));var util=require(_0xff83('0x1'));var path=require(_0xff83('0x2'));var timeout=require('connect-timeout');var express=require(_0xff83('0x3'));var router=express[_0xff83('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xff83('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xff83('0x6'));router['get']('/',auth[_0xff83('0x7')](),controller['index']);router[_0xff83('0x8')](_0xff83('0x9'),auth[_0xff83('0x7')](),controller[_0xff83('0xa')]);router[_0xff83('0x8')](_0xff83('0xb'),auth[_0xff83('0x7')](),controller[_0xff83('0xc')]);router[_0xff83('0x8')](_0xff83('0xd'),auth[_0xff83('0x7')](),controller[_0xff83('0xe')]);router[_0xff83('0x8')]('/:id/query',auth['isAuthenticated'](),controller['query']);router['post']('/',auth[_0xff83('0x7')](),controller['create']);router['put'](_0xff83('0x9'),auth[_0xff83('0x7')](),controller[_0xff83('0xf')]);router[_0xff83('0x10')](_0xff83('0x9'),auth[_0xff83('0x7')](),controller[_0xff83('0x11')]);module[_0xff83('0x12')]=router; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js b/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js index 6e759fe..8f66acb 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 _0x326f=['STRING','TEXT','sequelize'];(function(_0x2c890a,_0x127db2){var _0x301a13=function(_0x1fae7){while(--_0x1fae7){_0x2c890a['push'](_0x2c890a['shift']());}};_0x301a13(++_0x127db2);}(_0x326f,0xd1));var _0xf326=function(_0x5a8133,_0x485c40){_0x5a8133=_0x5a8133-0x0;var _0x4d8801=_0x326f[_0x5a8133];return _0x4d8801;};'use strict';var Sequelize=require(_0xf326('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0xf326('0x1')]},'parent':{'type':Sequelize[_0xf326('0x1')]},'table':{'type':Sequelize[_0xf326('0x1')]},'conditions':{'type':Sequelize[_0xf326('0x2')]},'joins':{'type':Sequelize[_0xf326('0x2')]}}; \ No newline at end of file +var _0xac9d=['TEXT','sequelize','exports','STRING'];(function(_0x474ba7,_0x1d74c6){var _0x422657=function(_0x570f82){while(--_0x570f82){_0x474ba7['push'](_0x474ba7['shift']());}};_0x422657(++_0x1d74c6);}(_0xac9d,0x14d));var _0xdac9=function(_0x3d7a9f,_0x24e0f1){_0x3d7a9f=_0x3d7a9f-0x0;var _0x13f5f1=_0xac9d[_0x3d7a9f];return _0x13f5f1;};'use strict';var Sequelize=require(_0xdac9('0x0'));module[_0xdac9('0x1')]={'name':{'type':Sequelize[_0xdac9('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xdac9('0x2')]},'parent':{'type':Sequelize[_0xdac9('0x2')]},'table':{'type':Sequelize[_0xdac9('0x2')]},'conditions':{'type':Sequelize[_0xdac9('0x3')]},'joins':{'type':Sequelize[_0xdac9('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js index 6fa57fe..6e360c4 100644 --- a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js +++ b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2675=['AnalyticDefaultReport','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','nolimit','sort','where','filters','pick','VIRTUAL','merge','options','includeAll','include','catch','params','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','Reports','UserProfileSection','find','userProfileId','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','preview','join','left_join','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','DATE(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20NOT\x20EMPTY','rules','operator','group','condition','value','getFields','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','findAll','select','table','MetricId','metric','field','function','replace','format','groupBy','order','orderBy','DESC','joins','parentKey','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','conditions','parse','clone','toString','sequelize','QueryTypes','right_join','SEC_TO_TIME(%s)','IS\x20EMPTY','Sequelize','keyBy','from','alias','output','randomstring','generate','csv','default','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','info','Run\x20Query:','child_process','fork','../../files/reports','savename','COUNT(*)','SELECT','run','runReport','MIN(%s)','debug','eml-format','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','dbH','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','destroy','then','get','DefaultReports','name','map'];(function(_0x348a50,_0xe211f1){var _0x29beb2=function(_0x1a4036){while(--_0x1a4036){_0x348a50['push'](_0x348a50['shift']());}};_0x29beb2(++_0xe211f1);}(_0x2675,0x75));var _0x5267=function(_0x5853e4,_0x1d5e9a){_0x5853e4=_0x5853e4-0x0;var _0x3228d7=_0x2675[_0x5853e4];return _0x3228d7;};'use strict';var emlformat=require(_0x5267('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x5267('0x1'));var moment=require(_0x5267('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x5267('0x3'));var util=require(_0x5267('0x4'));var path=require('path');var sox=require(_0x5267('0x5'));var csv=require(_0x5267('0x6'));var ejs=require(_0x5267('0x7'));var fs=require('fs');var fs_extra=require(_0x5267('0x8'));var _=require(_0x5267('0x9'));var squel=require(_0x5267('0xa'));var crypto=require('crypto');var jsforce=require(_0x5267('0xb'));var deskjs=require(_0x5267('0xc'));var toCsv=require('to-csv');var querystring=require(_0x5267('0xd'));var Papa=require('papaparse');var Redis=require(_0x5267('0xe'));var authService=require(_0x5267('0xf'));var qs=require(_0x5267('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5267('0x11'));var logger=require('../../config/logger')(_0x5267('0x12'));var utils=require('../../config/utils');var config=require(_0x5267('0x13'));var licenseUtil=require(_0x5267('0x14'));var db=require(_0x5267('0x15'))['db'];var dbH=require(_0x5267('0x15'))[_0x5267('0x16')];function respondWithStatusCode(_0x1171b9,_0x20785c){_0x20785c=_0x20785c||0xcc;return function(_0x36dc17){if(_0x36dc17){return _0x1171b9[_0x5267('0x17')](_0x20785c);}return _0x1171b9[_0x5267('0x18')](_0x20785c)[_0x5267('0x19')]();};}function respondWithResult(_0x29349a,_0x3e2bab){_0x3e2bab=_0x3e2bab||0xc8;return function(_0x548040){if(_0x548040){return _0x29349a['status'](_0x3e2bab)[_0x5267('0x1a')](_0x548040);}};}function respondWithFilteredResult(_0x40d897,_0x38a147){return function(_0x3f5344){if(_0x3f5344){var _0x46b2c2=typeof _0x38a147[_0x5267('0x1b')]===_0x5267('0x1c')&&typeof _0x38a147[_0x5267('0x1d')]===_0x5267('0x1c');var _0xb1c97a=_0x3f5344[_0x5267('0x1e')];var _0x1ab03=_0x46b2c2?0x0:_0x38a147['offset'];var _0x18f32e=_0x46b2c2?_0x3f5344[_0x5267('0x1e')]:_0x38a147['offset']+_0x38a147[_0x5267('0x1d')];var _0x56733e;if(_0x18f32e>=_0xb1c97a){_0x18f32e=_0xb1c97a;_0x56733e=0xc8;}else{_0x56733e=0xce;}_0x40d897[_0x5267('0x18')](_0x56733e);return _0x40d897[_0x5267('0x1f')](_0x5267('0x20'),_0x1ab03+'-'+_0x18f32e+'/'+_0xb1c97a)[_0x5267('0x1a')](_0x3f5344);}return null;};}function patchUpdates(_0x5ca9c6){return function(_0x4dd637){try{jsonpatch[_0x5267('0x21')](_0x4dd637,_0x5ca9c6,!![]);}catch(_0x5aebdd){return BPromise[_0x5267('0x22')](_0x5aebdd);}return _0x4dd637[_0x5267('0x23')]();};}function saveUpdates(_0x3b53ac,_0x56dd95){return function(_0x499f19){if(_0x499f19){return _0x499f19['update'](_0x3b53ac)['then'](function(_0x5ea6a6){return _0x5ea6a6;});}return null;};}function removeEntity(_0x26c7f8,_0x399e64){return function(_0x2d761d){if(_0x2d761d){return _0x2d761d[_0x5267('0x24')]()[_0x5267('0x25')](function(){var _0x40d1be=_0x2d761d[_0x5267('0x26')]({'plain':!![]});var _0x220e03=_0x5267('0x27');return db['UserProfileResource']['destroy']({'where':{'type':_0x220e03,'resourceId':_0x40d1be['id']}})[_0x5267('0x25')](function(){return _0x2d761d;});})[_0x5267('0x25')](function(){_0x26c7f8['status'](0xcc)[_0x5267('0x19')]();});}};}function handleEntityNotFound(_0x52504e,_0x4d7c2a){return function(_0x43e7e7){if(!_0x43e7e7){_0x52504e[_0x5267('0x17')](0x194);}return _0x43e7e7;};}function handleError(_0x1f33b7,_0x2d2ace){_0x2d2ace=_0x2d2ace||0x1f4;return function(_0x33c431){logger['error'](_0x33c431['stack']);if(_0x33c431[_0x5267('0x28')]){delete _0x33c431[_0x5267('0x28')];}_0x1f33b7[_0x5267('0x18')](_0x2d2ace)['send'](_0x33c431);};}exports['index']=function(_0xbe7922,_0x3ef2a8){var _0x1fa725={},_0x5bec7e={},_0x59b091={'count':0x0,'rows':[]};var _0x2249a1=_[_0x5267('0x29')](db[_0x5267('0x2a')][_0x5267('0x2b')],function(_0x5bbb83){return{'name':_0x5bbb83[_0x5267('0x2c')],'type':_0x5bbb83[_0x5267('0x2d')][_0x5267('0x2e')]};});_0x5bec7e[_0x5267('0x2f')]=_[_0x5267('0x29')](_0x2249a1,_0x5267('0x28'));_0x5bec7e[_0x5267('0x30')]=_[_0x5267('0x31')](_0xbe7922['query']);_0x5bec7e['filters']=_[_0x5267('0x32')](_0x5bec7e['model'],_0x5bec7e[_0x5267('0x30')]);_0x1fa725[_0x5267('0x33')]=_[_0x5267('0x32')](_0x5bec7e[_0x5267('0x2f')],qs['fields'](_0xbe7922[_0x5267('0x30')][_0x5267('0x34')]));_0x1fa725[_0x5267('0x33')]=_0x1fa725[_0x5267('0x33')][_0x5267('0x35')]?_0x1fa725[_0x5267('0x33')]:_0x5bec7e[_0x5267('0x2f')];if(!_0xbe7922[_0x5267('0x30')]['hasOwnProperty'](_0x5267('0x36'))){_0x1fa725['limit']=qs[_0x5267('0x1d')](_0xbe7922[_0x5267('0x30')][_0x5267('0x1d')]);_0x1fa725[_0x5267('0x1b')]=qs[_0x5267('0x1b')](_0xbe7922[_0x5267('0x30')][_0x5267('0x1b')]);}_0x1fa725['order']=qs[_0x5267('0x37')](_0xbe7922[_0x5267('0x30')][_0x5267('0x37')]);_0x1fa725[_0x5267('0x38')]=qs[_0x5267('0x39')](_[_0x5267('0x3a')](_0xbe7922[_0x5267('0x30')],_0x5bec7e['filters']),_0x2249a1);if(_0xbe7922[_0x5267('0x30')]['filter']){_0x1fa725[_0x5267('0x38')]=_['merge'](_0x1fa725['where'],{'$or':_['map'](_0x2249a1,function(_0x46bfcc){if(_0x46bfcc['type']!==_0x5267('0x3b')){var _0x146476={};_0x146476[_0x46bfcc[_0x5267('0x28')]]={'$like':'%'+_0xbe7922[_0x5267('0x30')]['filter']+'%'};return _0x146476;}})});}_0x1fa725=_[_0x5267('0x3c')]({},_0x1fa725,_0xbe7922[_0x5267('0x3d')]);var _0x588edf={'where':_0x1fa725['where']};return db[_0x5267('0x2a')]['count'](_0x588edf)[_0x5267('0x25')](function(_0x1cf94a){_0x59b091[_0x5267('0x1e')]=_0x1cf94a;if(_0xbe7922[_0x5267('0x30')][_0x5267('0x3e')]){_0x1fa725[_0x5267('0x3f')]=[{'all':!![]}];}return db[_0x5267('0x2a')]['findAll'](_0x1fa725);})['then'](function(_0x28ea4a){_0x59b091['rows']=_0x28ea4a;return _0x59b091;})[_0x5267('0x25')](respondWithFilteredResult(_0x3ef2a8,_0x1fa725))[_0x5267('0x40')](handleError(_0x3ef2a8,null));};exports['show']=function(_0x1fa925,_0xc764cd){var _0x299a13={'raw':!![],'where':{'id':_0x1fa925[_0x5267('0x41')]['id']}},_0x161fed={};_0x161fed[_0x5267('0x2f')]=_[_0x5267('0x31')](db[_0x5267('0x2a')][_0x5267('0x2b')]);_0x161fed['query']=_[_0x5267('0x31')](_0x1fa925[_0x5267('0x30')]);_0x161fed[_0x5267('0x39')]=_[_0x5267('0x32')](_0x161fed[_0x5267('0x2f')],_0x161fed['query']);_0x299a13[_0x5267('0x33')]=_['intersection'](_0x161fed[_0x5267('0x2f')],qs['fields'](_0x1fa925['query'][_0x5267('0x34')]));_0x299a13['attributes']=_0x299a13[_0x5267('0x33')][_0x5267('0x35')]?_0x299a13[_0x5267('0x33')]:_0x161fed[_0x5267('0x2f')];if(_0x1fa925['query'][_0x5267('0x3e')]){_0x299a13['include']=[{'all':!![]}];}_0x299a13=_['merge']({},_0x299a13,_0x1fa925[_0x5267('0x3d')]);return db[_0x5267('0x2a')]['find'](_0x299a13)['then'](handleEntityNotFound(_0xc764cd,null))[_0x5267('0x25')](respondWithResult(_0xc764cd,null))[_0x5267('0x40')](handleError(_0xc764cd,null));};exports[_0x5267('0x42')]=function(_0x1b5a7e,_0x1c2803){return db[_0x5267('0x2a')][_0x5267('0x42')](_0x1b5a7e[_0x5267('0x43')],{})[_0x5267('0x25')](function(_0x2cfe09){var _0x21b040=_0x1b5a7e[_0x5267('0x44')][_0x5267('0x26')]({'plain':!![]});if(!_0x21b040)throw new Error(_0x5267('0x45'));if(_0x21b040['role']===_0x5267('0x44')){var _0x466d46=_0x2cfe09[_0x5267('0x26')]({'plain':!![]});var _0x4f0148=_0x5267('0x46');return db[_0x5267('0x47')][_0x5267('0x48')]({'where':{'name':_0x4f0148,'userProfileId':_0x21b040[_0x5267('0x49')]},'raw':!![]})[_0x5267('0x25')](function(_0x1457cf){if(_0x1457cf&&_0x1457cf['autoAssociation']===0x0){return db[_0x5267('0x4a')]['create']({'name':_0x466d46[_0x5267('0x28')],'resourceId':_0x466d46['id'],'type':_0x5267('0x27'),'sectionId':_0x1457cf['id']},{})[_0x5267('0x25')](function(){return _0x2cfe09;});}else{return _0x2cfe09;}})[_0x5267('0x40')](function(_0x91b932){logger[_0x5267('0x4b')](_0x5267('0x4c'),_0x91b932);throw _0x91b932;});}return _0x2cfe09;})['then'](respondWithResult(_0x1c2803,0xc9))['catch'](handleError(_0x1c2803,null));};exports[_0x5267('0x4d')]=function(_0x15b5c9,_0x566b6f){if(_0x15b5c9[_0x5267('0x43')]['id']){delete _0x15b5c9['body']['id'];}return db['AnalyticDefaultReport'][_0x5267('0x48')]({'where':{'id':_0x15b5c9[_0x5267('0x41')]['id']}})[_0x5267('0x25')](handleEntityNotFound(_0x566b6f,null))[_0x5267('0x25')](saveUpdates(_0x15b5c9[_0x5267('0x43')],null))[_0x5267('0x25')](respondWithResult(_0x566b6f,null))[_0x5267('0x40')](handleError(_0x566b6f,null));};exports[_0x5267('0x24')]=function(_0xf0b5a9,_0x43d254){return db['AnalyticDefaultReport'][_0x5267('0x48')]({'where':{'id':_0xf0b5a9[_0x5267('0x41')]['id']}})[_0x5267('0x25')](handleEntityNotFound(_0x43d254,null))[_0x5267('0x25')](removeEntity(_0x43d254,null))[_0x5267('0x40')](handleError(_0x43d254,null));};exports[_0x5267('0x4e')]=function(_0x552211,_0x195575){var _0x5ad1ce=0xa;var _0x1522d6=[_0x5267('0x4f'),_0x5267('0x50'),'right_join',_0x5267('0x51')];var _0x161dab={'SUM':_0x5267('0x52'),'COUNT':_0x5267('0x53'),'COUNT DISTINCT':_0x5267('0x54'),'MAX':_0x5267('0x55'),'MIN':'MIN(%s)','AVG':_0x5267('0x56'),'GROUP_CONCAT':_0x5267('0x57'),'GROUP_CONCAT ASC':_0x5267('0x58'),'GROUP_CONCAT DESC':_0x5267('0x59')};var _0x51220c={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x5267('0x5a'),'HOUR':'HOUR(%s)','ROUND':_0x5267('0x5b'),'UNIX_TIMESTAMP':_0x5267('0x5c')};var _0x4e3771=function(_0x489780){return!_[_0x5267('0x5d')]([_0x5267('0x5e'),_0x5267('0x5f'),'IS\x20EMPTY',_0x5267('0x60')],_0x489780);};var _0xc88193=function(_0x293e61){if(!_0x293e61||!_0x293e61[_0x5267('0x61')]['length']){return'';}for(var _0x5a87b5='(',_0x540ab8=0x0;_0x540ab8<_0x293e61[_0x5267('0x61')][_0x5267('0x35')];_0x540ab8+=0x1){_0x540ab8>0x0&&(_0x5a87b5+='\x20'+_0x293e61[_0x5267('0x62')]+'\x20');_0x5a87b5+=_0x293e61[_0x5267('0x61')][_0x540ab8][_0x5267('0x63')]?_0xc88193(_0x293e61[_0x5267('0x61')][_0x540ab8][_0x5267('0x63')]):_0x293e61[_0x5267('0x61')][_0x540ab8]['field']+'\x20'+_0x293e61[_0x5267('0x61')][_0x540ab8][_0x5267('0x64')]+(_0x4e3771(_0x293e61['rules'][_0x540ab8][_0x5267('0x64')])?'\x20'+_0x293e61[_0x5267('0x61')][_0x540ab8][_0x5267('0x65')]:'');}return _0x5a87b5+')';};var _0x1b6dd7={'where':{'id':_0x552211[_0x5267('0x41')]['id']}},_0x19adf5,_0xde1ecd,_0x4915f4,_0x2ca259,_0x726410;_0x1b6dd7=_[_0x5267('0x3c')]({},_0x1b6dd7,_0x552211[_0x5267('0x3d')]);return db[_0x5267('0x2a')]['find'](_0x1b6dd7)[_0x5267('0x25')](function(_0x87465){if(_0x87465){_0x19adf5=_0x87465;return _0x87465[_0x5267('0x66')]();}return null;})[_0x5267('0x25')](function(_0x1a4016){if(_0x1a4016){if(!_0x1a4016[_0x5267('0x35')]){throw new db['Sequelize'][(_0x5267('0x67'))](_0x5267('0x68'),0x193);}_0xde1ecd=_0x1a4016;return db[_0x5267('0x69')][_0x5267('0x6a')]({'raw':!![]});}return null;})['then'](function(_0x516e6e){if(_0x516e6e){_0x4915f4=_['keyBy'](_0x516e6e,'id');var _0x910f97;var _0x5cca85=squel[_0x5267('0x6b')]();_0x5cca85['from'](_0x19adf5[_0x5267('0x6c')]);for(var _0x1150ba=0x0;_0x1150ba<_0xde1ecd[_0x5267('0x35')];_0x1150ba+=0x1){_0x910f97=_0xde1ecd[_0x1150ba][_0x5267('0x6d')]?_0x4915f4[_0xde1ecd[_0x1150ba][_0x5267('0x6d')]][_0x5267('0x6e')]:_0xde1ecd[_0x1150ba][_0x5267('0x6f')];_0x910f97=_0xde1ecd[_0x1150ba][_0x5267('0x70')]?_['replace'](_0x161dab[_0xde1ecd[_0x1150ba]['function']],'%s',_0x910f97):_0x910f97;_0x910f97=_0xde1ecd[_0x1150ba]['format']?_[_0x5267('0x71')](_0x51220c[_0xde1ecd[_0x1150ba][_0x5267('0x72')]],'%s',_0x910f97):_0x910f97;if(_0xde1ecd[_0x1150ba][_0x5267('0x73')]){_0x5cca85[_0x5267('0x63')](_0x910f97);}_0xde1ecd[_0x1150ba]['orderBy']&&_0x5cca85[_0x5267('0x74')](_0x910f97,_0xde1ecd[_0x1150ba][_0x5267('0x75')]===_0x5267('0x76')?![]:!![]);_0x5cca85[_0x5267('0x6f')](_0x910f97,_0xde1ecd[_0x1150ba]['alias']||_0x910f97);}if(_0x19adf5[_0x5267('0x77')]){_0x19adf5[_0x5267('0x77')]=JSON['parse'](_0x19adf5[_0x5267('0x77')]);for(var _0x268805=0x0;_0x268805<_0x19adf5['joins']['length'];_0x268805+=0x1){if(_0x19adf5[_0x5267('0x77')][_0x268805][_0x5267('0x2d')]&&_['includes'](_0x1522d6,_0x19adf5['joins'][_0x268805][_0x5267('0x2d')])&&_0x19adf5[_0x5267('0x77')][_0x268805][_0x5267('0x78')]&&_0x19adf5[_0x5267('0x77')][_0x268805][_0x5267('0x79')]&&_0x19adf5['joins'][_0x268805][_0x5267('0x7a')]){_0x5cca85[_0x19adf5[_0x5267('0x77')][_0x268805]['type']](_0x19adf5[_0x5267('0x77')][_0x268805][_0x5267('0x79')],null,util[_0x5267('0x72')](_0x5267('0x7b'),_0x19adf5[_0x5267('0x6c')],_0x19adf5[_0x5267('0x77')][_0x268805][_0x5267('0x78')],_0x19adf5[_0x5267('0x77')][_0x268805]['foreignTable'],_0x19adf5['joins'][_0x268805][_0x5267('0x7a')]));}}}if(_0x19adf5[_0x5267('0x7c')]){_0x19adf5[_0x5267('0x7c')]=JSON[_0x5267('0x7d')](_0x19adf5['conditions']);_0x5cca85[_0x5267('0x38')](_0xc88193(_0x19adf5['conditions'][_0x5267('0x63')]));}_0x726410=_0x5cca85[_0x5267('0x7e')]();_0x5cca85[_0x5267('0x1d')](_0x5ad1ce);_0x5cca85[_0x5267('0x1b')](0x0);logger['debug']('Limited\x20Query:',_0x5cca85[_0x5267('0x7f')]());return dbH[_0x5267('0x80')][_0x5267('0x30')](_0x5cca85[_0x5267('0x7f')](),{'type':dbH[_0x5267('0x80')][_0x5267('0x81')]['SELECT']});}})[_0x5267('0x25')](respondWithResult(_0x195575,null))['catch'](handleError(_0x195575,null));};function runReport(_0x418a03,_0x5b8026,_0x2c2b95){var _0x20888d=_0x5b8026[_0x5267('0x28')];var _0x87aa90=0xa;var _0x164cc1=[_0x5267('0x4f'),_0x5267('0x50'),_0x5267('0x82'),_0x5267('0x51')];var _0x28e4b6={'SUM':_0x5267('0x52'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0x5267('0x54'),'MAX':_0x5267('0x55'),'MIN':'MIN(%s)','AVG':_0x5267('0x56'),'GROUP_CONCAT':_0x5267('0x57'),'GROUP_CONCAT ASC':_0x5267('0x58'),'GROUP_CONCAT DESC':_0x5267('0x59')};var _0xd18795={'SEC_TO_TIME':_0x5267('0x83'),'DATE':_0x5267('0x5a'),'HOUR':'HOUR(%s)','ROUND':_0x5267('0x5b'),'UNIX_TIMESTAMP':_0x5267('0x5c')};var _0x2543a4=function(_0x2feea8){return!_[_0x5267('0x5d')](['IS\x20NULL','IS\x20NOT\x20NULL',_0x5267('0x84'),_0x5267('0x60')],_0x2feea8);};var _0x199ff6=function(_0xbf36fb){if(!_0xbf36fb||!_0xbf36fb['rules'][_0x5267('0x35')]){return'';}for(var _0x3cc775='(',_0x2630f2=0x0;_0x2630f2<_0xbf36fb[_0x5267('0x61')][_0x5267('0x35')];_0x2630f2+=0x1){_0x2630f2>0x0&&(_0x3cc775+='\x20'+_0xbf36fb[_0x5267('0x62')]+'\x20');_0x3cc775+=_0xbf36fb[_0x5267('0x61')][_0x2630f2][_0x5267('0x63')]?_0x199ff6(_0xbf36fb[_0x5267('0x61')][_0x2630f2][_0x5267('0x63')]):_0xbf36fb[_0x5267('0x61')][_0x2630f2][_0x5267('0x6f')]+'\x20'+_0xbf36fb[_0x5267('0x61')][_0x2630f2]['condition']+(_0x2543a4(_0xbf36fb[_0x5267('0x61')][_0x2630f2][_0x5267('0x64')])?'\x20'+_0xbf36fb[_0x5267('0x61')][_0x2630f2][_0x5267('0x65')]:'');}return _0x3cc775+')';};var _0x447b5f={'where':{'id':_0x418a03['id']}},_0x25ce90,_0x257c69,_0x160c9c,_0x42694a,_0x11a2f4;_0x447b5f=_[_0x5267('0x3c')]({},_0x447b5f,_0x2c2b95);return db[_0x5267('0x2a')][_0x5267('0x48')](_0x447b5f)[_0x5267('0x25')](function(_0x35c3b7){if(_0x35c3b7){_0x25ce90=_0x35c3b7;return _0x35c3b7[_0x5267('0x66')]();}return null;})[_0x5267('0x25')](function(_0x35a4a3){if(_0x35a4a3){if(!_0x35a4a3[_0x5267('0x35')]){throw new db[(_0x5267('0x85'))][(_0x5267('0x67'))](_0x5267('0x68'),0x193);}_0x257c69=_0x35a4a3;return db[_0x5267('0x69')]['findAll']({'raw':!![]});}return null;})[_0x5267('0x25')](function(_0x318393){if(_0x318393){_0x160c9c=_[_0x5267('0x86')](_0x318393,'id');var _0x405eb4;var _0x38f5b7=squel['select']();_0x38f5b7[_0x5267('0x87')](_0x25ce90[_0x5267('0x6c')]);for(var _0x4c68cd=0x0;_0x4c68cd<_0x257c69['length'];_0x4c68cd+=0x1){_0x405eb4=_0x257c69[_0x4c68cd]['MetricId']?_0x160c9c[_0x257c69[_0x4c68cd][_0x5267('0x6d')]]['metric']:_0x257c69[_0x4c68cd][_0x5267('0x6f')];_0x405eb4=_0x257c69[_0x4c68cd]['function']?_['replace'](_0x28e4b6[_0x257c69[_0x4c68cd][_0x5267('0x70')]],'%s',_0x405eb4):_0x405eb4;_0x405eb4=_0x257c69[_0x4c68cd][_0x5267('0x72')]?_[_0x5267('0x71')](_0xd18795[_0x257c69[_0x4c68cd][_0x5267('0x72')]],'%s',_0x405eb4):_0x405eb4;if(_0x257c69[_0x4c68cd][_0x5267('0x73')]){_0x38f5b7['group'](_0x405eb4);}_0x257c69[_0x4c68cd]['orderBy']&&_0x38f5b7[_0x5267('0x74')](_0x405eb4,_0x257c69[_0x4c68cd][_0x5267('0x75')]===_0x5267('0x76')?![]:!![]);_0x38f5b7[_0x5267('0x6f')](_0x405eb4,_0x257c69[_0x4c68cd][_0x5267('0x88')]||_0x405eb4);}if(_0x25ce90['joins']){_0x25ce90[_0x5267('0x77')]=JSON['parse'](_0x25ce90['joins']);for(var _0x3dfd8d=0x0;_0x3dfd8d<_0x25ce90['joins']['length'];_0x3dfd8d+=0x1){if(_0x25ce90[_0x5267('0x77')][_0x3dfd8d][_0x5267('0x2d')]&&_['includes'](_0x164cc1,_0x25ce90['joins'][_0x3dfd8d]['type'])&&_0x25ce90[_0x5267('0x77')][_0x3dfd8d]['parentKey']&&_0x25ce90[_0x5267('0x77')][_0x3dfd8d]['foreignTable']&&_0x25ce90[_0x5267('0x77')][_0x3dfd8d][_0x5267('0x7a')]){_0x38f5b7[_0x25ce90['joins'][_0x3dfd8d][_0x5267('0x2d')]](_0x25ce90[_0x5267('0x77')][_0x3dfd8d][_0x5267('0x79')],null,util[_0x5267('0x72')](_0x5267('0x7b'),_0x25ce90[_0x5267('0x6c')],_0x25ce90['joins'][_0x3dfd8d]['parentKey'],_0x25ce90[_0x5267('0x77')][_0x3dfd8d]['foreignTable'],_0x25ce90['joins'][_0x3dfd8d][_0x5267('0x7a')]));}}}if(_0x25ce90['conditions']){_0x25ce90[_0x5267('0x7c')]=JSON['parse'](_0x25ce90[_0x5267('0x7c')]);_0x38f5b7['where'](_0x199ff6(_0x25ce90[_0x5267('0x7c')][_0x5267('0x63')]));}_0x11a2f4=_0x38f5b7[_0x5267('0x7e')]();_0x38f5b7[_0x5267('0x1d')](_0x87aa90);_0x38f5b7[_0x5267('0x1b')](0x0);return;}})[_0x5267('0x25')](function(){if(_0x5b8026[_0x5267('0x89')]==='web'){return null;}var _0x4df99f=_[_0x5267('0x3c')](_0x5b8026,{'name':_0x5b8026['fullPath']||_0x5b8026['name']||_0x25ce90['name'],'basename':_0x20888d,'savename':util['format']('%s-%s.%s',_0x5b8026['name']||_0x25ce90[_0x5267('0x28')],require(_0x5267('0x8a'))[_0x5267('0x8b')](0x4),_0x5b8026[_0x5267('0x89')]||_0x5267('0x8c')),'reportId':_0x25ce90['id'],'reportType':_0x5267('0x8d')});return db[_0x5267('0x8e')][_0x5267('0x42')](_0x4df99f,{'raw':!![]});})['then'](function(_0x5df23d){if(_0x25ce90['table']===_0x5267('0x8f')){_0x11a2f4[_0x5267('0x38')](_0x25ce90['table']+_0x5267('0x90'),_0x5b8026[_0x5267('0x91')],_0x5b8026[_0x5267('0x92')]);}else{_0x11a2f4[_0x5267('0x38')](_0x25ce90['table']+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x5b8026[_0x5267('0x91')],_0x5b8026[_0x5267('0x92')]);}if(_0x5df23d){logger[_0x5267('0x93')](_0x5267('0x94'),_0x11a2f4[_0x5267('0x7f')]());require(_0x5267('0x95'))[_0x5267('0x96')](path['join'](__dirname,'../../components/export/',_0x5df23d['output']),[_0x5df23d['id'],_0x11a2f4[_0x5267('0x7f')](),path[_0x5267('0x4f')](__dirname,_0x5267('0x97'),_0x5df23d[_0x5267('0x98')]),_0x20888d]);return _0x5df23d;}else{var _0x190ef4=squel[_0x5267('0x6b')]();_0x190ef4['from']('('+_0x11a2f4[_0x5267('0x7f')]()+')','countTable');_0x190ef4[_0x5267('0x6f')](_0x5267('0x99'),_0x5267('0x1e'));_0x11a2f4[_0x5267('0x1d')](_0x5b8026[_0x5267('0x1d')]||_0x87aa90);_0x11a2f4['offset'](_0x5b8026[_0x5267('0x1b')]||0x0);return dbH[_0x5267('0x80')][_0x5267('0x30')](_0x190ef4['toString'](),{'type':dbH['sequelize']['QueryTypes'][_0x5267('0x9a')]})[_0x5267('0x25')](function(_0x1be763){if(!_0x1be763[_0x5267('0x35')]){_0x42694a=0x0;}else{_0x42694a=_0x1be763[0x0]['count']||0x0;}return dbH['sequelize'][_0x5267('0x30')](_0x11a2f4[_0x5267('0x7f')](),{'type':dbH['sequelize'][_0x5267('0x81')][_0x5267('0x9a')]});})['then'](function(_0x5005b3){return{'rows':_0x5005b3||[],'count':_0x42694a};});}});}exports[_0x5267('0x9b')]=function(_0x11a6f4,_0x5a16ee){return runReport(_0x11a6f4[_0x5267('0x41')],_0x11a6f4[_0x5267('0x30')],_0x11a6f4[_0x5267('0x3d')])[_0x5267('0x25')](respondWithResult(_0x5a16ee,null))[_0x5267('0x40')](handleError(_0x5a16ee,null));};exports[_0x5267('0x9c')]=runReport;exports[_0x5267('0x30')]=function(_0x1e9651,_0x66da7a){var _0x54b582=0xa;var _0x4e4724=[_0x5267('0x4f'),'left_join',_0x5267('0x82'),_0x5267('0x51')];var _0x2722f9={'SUM':_0x5267('0x52'),'COUNT':_0x5267('0x53'),'COUNT DISTINCT':_0x5267('0x54'),'MAX':_0x5267('0x55'),'MIN':_0x5267('0x9d'),'AVG':_0x5267('0x56'),'GROUP_CONCAT':_0x5267('0x57'),'GROUP_CONCAT ASC':_0x5267('0x58'),'GROUP_CONCAT DESC':_0x5267('0x59')};var _0x5909b3={'SEC_TO_TIME':_0x5267('0x83'),'DATE':'DATE(%s)','HOUR':'HOUR(%s)','ROUND':_0x5267('0x5b'),'UNIX_TIMESTAMP':_0x5267('0x5c')};var _0x1d7987=function(_0x59efe1){return!_[_0x5267('0x5d')]([_0x5267('0x5e'),_0x5267('0x5f'),_0x5267('0x84'),_0x5267('0x60')],_0x59efe1);};var _0x46c79e=function(_0xcfba51){if(!_0xcfba51||!_0xcfba51[_0x5267('0x61')][_0x5267('0x35')]){return'';}for(var _0x3c5516='(',_0x1e8367=0x0;_0x1e8367<_0xcfba51[_0x5267('0x61')]['length'];_0x1e8367+=0x1){_0x1e8367>0x0&&(_0x3c5516+='\x20'+_0xcfba51[_0x5267('0x62')]+'\x20');_0x3c5516+=_0xcfba51[_0x5267('0x61')][_0x1e8367]['group']?_0x46c79e(_0xcfba51[_0x5267('0x61')][_0x1e8367][_0x5267('0x63')]):_0xcfba51[_0x5267('0x61')][_0x1e8367][_0x5267('0x6f')]+'\x20'+_0xcfba51['rules'][_0x1e8367][_0x5267('0x64')]+(_0x1d7987(_0xcfba51[_0x5267('0x61')][_0x1e8367][_0x5267('0x64')])?'\x20'+_0xcfba51['rules'][_0x1e8367][_0x5267('0x65')]:'');}return _0x3c5516+')';};var _0x19935d={'where':{'id':_0x1e9651[_0x5267('0x41')]['id']}},_0x3102e0,_0x2d215e,_0xc0af94,_0x178080,_0x3485ab;_0x19935d=_[_0x5267('0x3c')]({},_0x19935d,_0x1e9651['options']);return db[_0x5267('0x2a')][_0x5267('0x48')](_0x19935d)['then'](function(_0x17d2d4){if(_0x17d2d4){_0x3102e0=_0x17d2d4;return _0x17d2d4['getFields']();}return null;})[_0x5267('0x25')](function(_0x4c5a26){if(_0x4c5a26){if(!_0x4c5a26[_0x5267('0x35')]){throw new db[(_0x5267('0x85'))]['ValidationErrorItem']('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x2d215e=_0x4c5a26;return db[_0x5267('0x69')][_0x5267('0x6a')]({'raw':!![]});}return null;})[_0x5267('0x25')](function(_0x1a0883){if(_0x1a0883){_0xc0af94=_[_0x5267('0x86')](_0x1a0883,'id');var _0x501da6;var _0x3dcf73=squel['select']();_0x3dcf73['from'](_0x3102e0['table']);for(var _0x1ded05=0x0;_0x1ded05<_0x2d215e[_0x5267('0x35')];_0x1ded05+=0x1){_0x501da6=_0x2d215e[_0x1ded05][_0x5267('0x6d')]?_0xc0af94[_0x2d215e[_0x1ded05][_0x5267('0x6d')]][_0x5267('0x6e')]:_0x2d215e[_0x1ded05][_0x5267('0x6f')];_0x501da6=_0x2d215e[_0x1ded05][_0x5267('0x70')]?_['replace'](_0x2722f9[_0x2d215e[_0x1ded05]['function']],'%s',_0x501da6):_0x501da6;_0x501da6=_0x2d215e[_0x1ded05][_0x5267('0x72')]?_[_0x5267('0x71')](_0x5909b3[_0x2d215e[_0x1ded05][_0x5267('0x72')]],'%s',_0x501da6):_0x501da6;if(_0x2d215e[_0x1ded05][_0x5267('0x73')]){_0x3dcf73[_0x5267('0x63')](_0x501da6);}_0x2d215e[_0x1ded05]['orderBy']&&_0x3dcf73[_0x5267('0x74')](_0x501da6,_0x2d215e[_0x1ded05][_0x5267('0x75')]===_0x5267('0x76')?![]:!![]);_0x3dcf73[_0x5267('0x6f')](_0x501da6,_0x2d215e[_0x1ded05][_0x5267('0x88')]||_0x501da6);}if(_0x3102e0['joins']){_0x3102e0[_0x5267('0x77')]=JSON[_0x5267('0x7d')](_0x3102e0[_0x5267('0x77')]);for(var _0x4bfafd=0x0;_0x4bfafd<_0x3102e0[_0x5267('0x77')]['length'];_0x4bfafd+=0x1){if(_0x3102e0[_0x5267('0x77')][_0x4bfafd][_0x5267('0x2d')]&&_['includes'](_0x4e4724,_0x3102e0[_0x5267('0x77')][_0x4bfafd]['type'])&&_0x3102e0[_0x5267('0x77')][_0x4bfafd][_0x5267('0x78')]&&_0x3102e0['joins'][_0x4bfafd][_0x5267('0x79')]&&_0x3102e0[_0x5267('0x77')][_0x4bfafd]['foreignKey']){_0x3dcf73[_0x3102e0[_0x5267('0x77')][_0x4bfafd][_0x5267('0x2d')]](_0x3102e0[_0x5267('0x77')][_0x4bfafd][_0x5267('0x79')],null,util[_0x5267('0x72')]('%s.%s\x20=\x20%s.%s',_0x3102e0['table'],_0x3102e0[_0x5267('0x77')][_0x4bfafd][_0x5267('0x78')],_0x3102e0['joins'][_0x4bfafd][_0x5267('0x79')],_0x3102e0['joins'][_0x4bfafd][_0x5267('0x7a')]));}}}if(_0x3102e0[_0x5267('0x7c')]){_0x3102e0[_0x5267('0x7c')]=JSON[_0x5267('0x7d')](_0x3102e0[_0x5267('0x7c')]);_0x3dcf73[_0x5267('0x38')](_0x46c79e(_0x3102e0[_0x5267('0x7c')][_0x5267('0x63')]));}_0x3485ab=_0x3dcf73[_0x5267('0x7e')]();_0x3dcf73[_0x5267('0x1d')](_0x54b582);_0x3dcf73[_0x5267('0x1b')](0x0);logger[_0x5267('0x9e')]('Limited\x20Query:',_0x3dcf73[_0x5267('0x7f')]());return dbH[_0x5267('0x80')][_0x5267('0x30')](_0x3dcf73[_0x5267('0x7f')](),{'type':dbH[_0x5267('0x80')][_0x5267('0x81')][_0x5267('0x9a')]});}})[_0x5267('0x25')](function(){return{'sql':_0x3485ab[_0x5267('0x7f')]()};})[_0x5267('0x25')](respondWithResult(_0x66da7a,null))[_0x5267('0x40')](handleError(_0x66da7a,null));}; \ No newline at end of file +var _0x2675=['AnalyticDefaultReport','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','nolimit','sort','where','filters','pick','VIRTUAL','merge','options','includeAll','include','catch','params','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','Reports','UserProfileSection','find','userProfileId','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','preview','join','left_join','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','DATE(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20NOT\x20EMPTY','rules','operator','group','condition','value','getFields','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','findAll','select','table','MetricId','metric','field','function','replace','format','groupBy','order','orderBy','DESC','joins','parentKey','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','conditions','parse','clone','toString','sequelize','QueryTypes','right_join','SEC_TO_TIME(%s)','IS\x20EMPTY','Sequelize','keyBy','from','alias','output','randomstring','generate','csv','default','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','info','Run\x20Query:','child_process','fork','../../files/reports','savename','COUNT(*)','SELECT','run','runReport','MIN(%s)','debug','eml-format','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','dbH','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','destroy','then','get','DefaultReports','name','map'];(function(_0x2ef9e2,_0x376185){var _0x2d4632=function(_0x4abaf4){while(--_0x4abaf4){_0x2ef9e2['push'](_0x2ef9e2['shift']());}};_0x2d4632(++_0x376185);}(_0x2675,0x75));var _0x5267=function(_0x1ca795,_0x3f3b29){_0x1ca795=_0x1ca795-0x0;var _0x499bb5=_0x2675[_0x1ca795];return _0x499bb5;};'use strict';var emlformat=require(_0x5267('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x5267('0x1'));var moment=require(_0x5267('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x5267('0x3'));var util=require(_0x5267('0x4'));var path=require('path');var sox=require(_0x5267('0x5'));var csv=require(_0x5267('0x6'));var ejs=require(_0x5267('0x7'));var fs=require('fs');var fs_extra=require(_0x5267('0x8'));var _=require(_0x5267('0x9'));var squel=require(_0x5267('0xa'));var crypto=require('crypto');var jsforce=require(_0x5267('0xb'));var deskjs=require(_0x5267('0xc'));var toCsv=require('to-csv');var querystring=require(_0x5267('0xd'));var Papa=require('papaparse');var Redis=require(_0x5267('0xe'));var authService=require(_0x5267('0xf'));var qs=require(_0x5267('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5267('0x11'));var logger=require('../../config/logger')(_0x5267('0x12'));var utils=require('../../config/utils');var config=require(_0x5267('0x13'));var licenseUtil=require(_0x5267('0x14'));var db=require(_0x5267('0x15'))['db'];var dbH=require(_0x5267('0x15'))[_0x5267('0x16')];function respondWithStatusCode(_0x1171b9,_0x20785c){_0x20785c=_0x20785c||0xcc;return function(_0x36dc17){if(_0x36dc17){return _0x1171b9[_0x5267('0x17')](_0x20785c);}return _0x1171b9[_0x5267('0x18')](_0x20785c)[_0x5267('0x19')]();};}function respondWithResult(_0x29349a,_0x3e2bab){_0x3e2bab=_0x3e2bab||0xc8;return function(_0x548040){if(_0x548040){return _0x29349a['status'](_0x3e2bab)[_0x5267('0x1a')](_0x548040);}};}function respondWithFilteredResult(_0x40d897,_0x38a147){return function(_0x3f5344){if(_0x3f5344){var _0x46b2c2=typeof _0x38a147[_0x5267('0x1b')]===_0x5267('0x1c')&&typeof _0x38a147[_0x5267('0x1d')]===_0x5267('0x1c');var _0xb1c97a=_0x3f5344[_0x5267('0x1e')];var _0x1ab03=_0x46b2c2?0x0:_0x38a147['offset'];var _0x18f32e=_0x46b2c2?_0x3f5344[_0x5267('0x1e')]:_0x38a147['offset']+_0x38a147[_0x5267('0x1d')];var _0x56733e;if(_0x18f32e>=_0xb1c97a){_0x18f32e=_0xb1c97a;_0x56733e=0xc8;}else{_0x56733e=0xce;}_0x40d897[_0x5267('0x18')](_0x56733e);return _0x40d897[_0x5267('0x1f')](_0x5267('0x20'),_0x1ab03+'-'+_0x18f32e+'/'+_0xb1c97a)[_0x5267('0x1a')](_0x3f5344);}return null;};}function patchUpdates(_0x5ca9c6){return function(_0x4dd637){try{jsonpatch[_0x5267('0x21')](_0x4dd637,_0x5ca9c6,!![]);}catch(_0x5aebdd){return BPromise[_0x5267('0x22')](_0x5aebdd);}return _0x4dd637[_0x5267('0x23')]();};}function saveUpdates(_0x3b53ac,_0x56dd95){return function(_0x499f19){if(_0x499f19){return _0x499f19['update'](_0x3b53ac)['then'](function(_0x5ea6a6){return _0x5ea6a6;});}return null;};}function removeEntity(_0x26c7f8,_0x399e64){return function(_0x2d761d){if(_0x2d761d){return _0x2d761d[_0x5267('0x24')]()[_0x5267('0x25')](function(){var _0x40d1be=_0x2d761d[_0x5267('0x26')]({'plain':!![]});var _0x220e03=_0x5267('0x27');return db['UserProfileResource']['destroy']({'where':{'type':_0x220e03,'resourceId':_0x40d1be['id']}})[_0x5267('0x25')](function(){return _0x2d761d;});})[_0x5267('0x25')](function(){_0x26c7f8['status'](0xcc)[_0x5267('0x19')]();});}};}function handleEntityNotFound(_0x52504e,_0x4d7c2a){return function(_0x43e7e7){if(!_0x43e7e7){_0x52504e[_0x5267('0x17')](0x194);}return _0x43e7e7;};}function handleError(_0x1f33b7,_0x2d2ace){_0x2d2ace=_0x2d2ace||0x1f4;return function(_0x33c431){logger['error'](_0x33c431['stack']);if(_0x33c431[_0x5267('0x28')]){delete _0x33c431[_0x5267('0x28')];}_0x1f33b7[_0x5267('0x18')](_0x2d2ace)['send'](_0x33c431);};}exports['index']=function(_0xbe7922,_0x3ef2a8){var _0x1fa725={},_0x5bec7e={},_0x59b091={'count':0x0,'rows':[]};var _0x2249a1=_[_0x5267('0x29')](db[_0x5267('0x2a')][_0x5267('0x2b')],function(_0x5bbb83){return{'name':_0x5bbb83[_0x5267('0x2c')],'type':_0x5bbb83[_0x5267('0x2d')][_0x5267('0x2e')]};});_0x5bec7e[_0x5267('0x2f')]=_[_0x5267('0x29')](_0x2249a1,_0x5267('0x28'));_0x5bec7e[_0x5267('0x30')]=_[_0x5267('0x31')](_0xbe7922['query']);_0x5bec7e['filters']=_[_0x5267('0x32')](_0x5bec7e['model'],_0x5bec7e[_0x5267('0x30')]);_0x1fa725[_0x5267('0x33')]=_[_0x5267('0x32')](_0x5bec7e[_0x5267('0x2f')],qs['fields'](_0xbe7922[_0x5267('0x30')][_0x5267('0x34')]));_0x1fa725[_0x5267('0x33')]=_0x1fa725[_0x5267('0x33')][_0x5267('0x35')]?_0x1fa725[_0x5267('0x33')]:_0x5bec7e[_0x5267('0x2f')];if(!_0xbe7922[_0x5267('0x30')]['hasOwnProperty'](_0x5267('0x36'))){_0x1fa725['limit']=qs[_0x5267('0x1d')](_0xbe7922[_0x5267('0x30')][_0x5267('0x1d')]);_0x1fa725[_0x5267('0x1b')]=qs[_0x5267('0x1b')](_0xbe7922[_0x5267('0x30')][_0x5267('0x1b')]);}_0x1fa725['order']=qs[_0x5267('0x37')](_0xbe7922[_0x5267('0x30')][_0x5267('0x37')]);_0x1fa725[_0x5267('0x38')]=qs[_0x5267('0x39')](_[_0x5267('0x3a')](_0xbe7922[_0x5267('0x30')],_0x5bec7e['filters']),_0x2249a1);if(_0xbe7922[_0x5267('0x30')]['filter']){_0x1fa725[_0x5267('0x38')]=_['merge'](_0x1fa725['where'],{'$or':_['map'](_0x2249a1,function(_0x46bfcc){if(_0x46bfcc['type']!==_0x5267('0x3b')){var _0x146476={};_0x146476[_0x46bfcc[_0x5267('0x28')]]={'$like':'%'+_0xbe7922[_0x5267('0x30')]['filter']+'%'};return _0x146476;}})});}_0x1fa725=_[_0x5267('0x3c')]({},_0x1fa725,_0xbe7922[_0x5267('0x3d')]);var _0x588edf={'where':_0x1fa725['where']};return db[_0x5267('0x2a')]['count'](_0x588edf)[_0x5267('0x25')](function(_0x1cf94a){_0x59b091[_0x5267('0x1e')]=_0x1cf94a;if(_0xbe7922[_0x5267('0x30')][_0x5267('0x3e')]){_0x1fa725[_0x5267('0x3f')]=[{'all':!![]}];}return db[_0x5267('0x2a')]['findAll'](_0x1fa725);})['then'](function(_0x28ea4a){_0x59b091['rows']=_0x28ea4a;return _0x59b091;})[_0x5267('0x25')](respondWithFilteredResult(_0x3ef2a8,_0x1fa725))[_0x5267('0x40')](handleError(_0x3ef2a8,null));};exports['show']=function(_0x1fa925,_0xc764cd){var _0x299a13={'raw':!![],'where':{'id':_0x1fa925[_0x5267('0x41')]['id']}},_0x161fed={};_0x161fed[_0x5267('0x2f')]=_[_0x5267('0x31')](db[_0x5267('0x2a')][_0x5267('0x2b')]);_0x161fed['query']=_[_0x5267('0x31')](_0x1fa925[_0x5267('0x30')]);_0x161fed[_0x5267('0x39')]=_[_0x5267('0x32')](_0x161fed[_0x5267('0x2f')],_0x161fed['query']);_0x299a13[_0x5267('0x33')]=_['intersection'](_0x161fed[_0x5267('0x2f')],qs['fields'](_0x1fa925['query'][_0x5267('0x34')]));_0x299a13['attributes']=_0x299a13[_0x5267('0x33')][_0x5267('0x35')]?_0x299a13[_0x5267('0x33')]:_0x161fed[_0x5267('0x2f')];if(_0x1fa925['query'][_0x5267('0x3e')]){_0x299a13['include']=[{'all':!![]}];}_0x299a13=_['merge']({},_0x299a13,_0x1fa925[_0x5267('0x3d')]);return db[_0x5267('0x2a')]['find'](_0x299a13)['then'](handleEntityNotFound(_0xc764cd,null))[_0x5267('0x25')](respondWithResult(_0xc764cd,null))[_0x5267('0x40')](handleError(_0xc764cd,null));};exports[_0x5267('0x42')]=function(_0x1b5a7e,_0x1c2803){return db[_0x5267('0x2a')][_0x5267('0x42')](_0x1b5a7e[_0x5267('0x43')],{})[_0x5267('0x25')](function(_0x2cfe09){var _0x21b040=_0x1b5a7e[_0x5267('0x44')][_0x5267('0x26')]({'plain':!![]});if(!_0x21b040)throw new Error(_0x5267('0x45'));if(_0x21b040['role']===_0x5267('0x44')){var _0x466d46=_0x2cfe09[_0x5267('0x26')]({'plain':!![]});var _0x4f0148=_0x5267('0x46');return db[_0x5267('0x47')][_0x5267('0x48')]({'where':{'name':_0x4f0148,'userProfileId':_0x21b040[_0x5267('0x49')]},'raw':!![]})[_0x5267('0x25')](function(_0x1457cf){if(_0x1457cf&&_0x1457cf['autoAssociation']===0x0){return db[_0x5267('0x4a')]['create']({'name':_0x466d46[_0x5267('0x28')],'resourceId':_0x466d46['id'],'type':_0x5267('0x27'),'sectionId':_0x1457cf['id']},{})[_0x5267('0x25')](function(){return _0x2cfe09;});}else{return _0x2cfe09;}})[_0x5267('0x40')](function(_0x91b932){logger[_0x5267('0x4b')](_0x5267('0x4c'),_0x91b932);throw _0x91b932;});}return _0x2cfe09;})['then'](respondWithResult(_0x1c2803,0xc9))['catch'](handleError(_0x1c2803,null));};exports[_0x5267('0x4d')]=function(_0x15b5c9,_0x566b6f){if(_0x15b5c9[_0x5267('0x43')]['id']){delete _0x15b5c9['body']['id'];}return db['AnalyticDefaultReport'][_0x5267('0x48')]({'where':{'id':_0x15b5c9[_0x5267('0x41')]['id']}})[_0x5267('0x25')](handleEntityNotFound(_0x566b6f,null))[_0x5267('0x25')](saveUpdates(_0x15b5c9[_0x5267('0x43')],null))[_0x5267('0x25')](respondWithResult(_0x566b6f,null))[_0x5267('0x40')](handleError(_0x566b6f,null));};exports[_0x5267('0x24')]=function(_0xf0b5a9,_0x43d254){return db['AnalyticDefaultReport'][_0x5267('0x48')]({'where':{'id':_0xf0b5a9[_0x5267('0x41')]['id']}})[_0x5267('0x25')](handleEntityNotFound(_0x43d254,null))[_0x5267('0x25')](removeEntity(_0x43d254,null))[_0x5267('0x40')](handleError(_0x43d254,null));};exports[_0x5267('0x4e')]=function(_0x552211,_0x195575){var _0x5ad1ce=0xa;var _0x1522d6=[_0x5267('0x4f'),_0x5267('0x50'),'right_join',_0x5267('0x51')];var _0x161dab={'SUM':_0x5267('0x52'),'COUNT':_0x5267('0x53'),'COUNT DISTINCT':_0x5267('0x54'),'MAX':_0x5267('0x55'),'MIN':'MIN(%s)','AVG':_0x5267('0x56'),'GROUP_CONCAT':_0x5267('0x57'),'GROUP_CONCAT ASC':_0x5267('0x58'),'GROUP_CONCAT DESC':_0x5267('0x59')};var _0x51220c={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x5267('0x5a'),'HOUR':'HOUR(%s)','ROUND':_0x5267('0x5b'),'UNIX_TIMESTAMP':_0x5267('0x5c')};var _0x4e3771=function(_0x489780){return!_[_0x5267('0x5d')]([_0x5267('0x5e'),_0x5267('0x5f'),'IS\x20EMPTY',_0x5267('0x60')],_0x489780);};var _0xc88193=function(_0x293e61){if(!_0x293e61||!_0x293e61[_0x5267('0x61')]['length']){return'';}for(var _0x5a87b5='(',_0x540ab8=0x0;_0x540ab8<_0x293e61[_0x5267('0x61')][_0x5267('0x35')];_0x540ab8+=0x1){_0x540ab8>0x0&&(_0x5a87b5+='\x20'+_0x293e61[_0x5267('0x62')]+'\x20');_0x5a87b5+=_0x293e61[_0x5267('0x61')][_0x540ab8][_0x5267('0x63')]?_0xc88193(_0x293e61[_0x5267('0x61')][_0x540ab8][_0x5267('0x63')]):_0x293e61[_0x5267('0x61')][_0x540ab8]['field']+'\x20'+_0x293e61[_0x5267('0x61')][_0x540ab8][_0x5267('0x64')]+(_0x4e3771(_0x293e61['rules'][_0x540ab8][_0x5267('0x64')])?'\x20'+_0x293e61[_0x5267('0x61')][_0x540ab8][_0x5267('0x65')]:'');}return _0x5a87b5+')';};var _0x1b6dd7={'where':{'id':_0x552211[_0x5267('0x41')]['id']}},_0x19adf5,_0xde1ecd,_0x4915f4,_0x2ca259,_0x726410;_0x1b6dd7=_[_0x5267('0x3c')]({},_0x1b6dd7,_0x552211[_0x5267('0x3d')]);return db[_0x5267('0x2a')]['find'](_0x1b6dd7)[_0x5267('0x25')](function(_0x87465){if(_0x87465){_0x19adf5=_0x87465;return _0x87465[_0x5267('0x66')]();}return null;})[_0x5267('0x25')](function(_0x1a4016){if(_0x1a4016){if(!_0x1a4016[_0x5267('0x35')]){throw new db['Sequelize'][(_0x5267('0x67'))](_0x5267('0x68'),0x193);}_0xde1ecd=_0x1a4016;return db[_0x5267('0x69')][_0x5267('0x6a')]({'raw':!![]});}return null;})['then'](function(_0x516e6e){if(_0x516e6e){_0x4915f4=_['keyBy'](_0x516e6e,'id');var _0x910f97;var _0x5cca85=squel[_0x5267('0x6b')]();_0x5cca85['from'](_0x19adf5[_0x5267('0x6c')]);for(var _0x1150ba=0x0;_0x1150ba<_0xde1ecd[_0x5267('0x35')];_0x1150ba+=0x1){_0x910f97=_0xde1ecd[_0x1150ba][_0x5267('0x6d')]?_0x4915f4[_0xde1ecd[_0x1150ba][_0x5267('0x6d')]][_0x5267('0x6e')]:_0xde1ecd[_0x1150ba][_0x5267('0x6f')];_0x910f97=_0xde1ecd[_0x1150ba][_0x5267('0x70')]?_['replace'](_0x161dab[_0xde1ecd[_0x1150ba]['function']],'%s',_0x910f97):_0x910f97;_0x910f97=_0xde1ecd[_0x1150ba]['format']?_[_0x5267('0x71')](_0x51220c[_0xde1ecd[_0x1150ba][_0x5267('0x72')]],'%s',_0x910f97):_0x910f97;if(_0xde1ecd[_0x1150ba][_0x5267('0x73')]){_0x5cca85[_0x5267('0x63')](_0x910f97);}_0xde1ecd[_0x1150ba]['orderBy']&&_0x5cca85[_0x5267('0x74')](_0x910f97,_0xde1ecd[_0x1150ba][_0x5267('0x75')]===_0x5267('0x76')?![]:!![]);_0x5cca85[_0x5267('0x6f')](_0x910f97,_0xde1ecd[_0x1150ba]['alias']||_0x910f97);}if(_0x19adf5[_0x5267('0x77')]){_0x19adf5[_0x5267('0x77')]=JSON['parse'](_0x19adf5[_0x5267('0x77')]);for(var _0x268805=0x0;_0x268805<_0x19adf5['joins']['length'];_0x268805+=0x1){if(_0x19adf5[_0x5267('0x77')][_0x268805][_0x5267('0x2d')]&&_['includes'](_0x1522d6,_0x19adf5['joins'][_0x268805][_0x5267('0x2d')])&&_0x19adf5[_0x5267('0x77')][_0x268805][_0x5267('0x78')]&&_0x19adf5[_0x5267('0x77')][_0x268805][_0x5267('0x79')]&&_0x19adf5['joins'][_0x268805][_0x5267('0x7a')]){_0x5cca85[_0x19adf5[_0x5267('0x77')][_0x268805]['type']](_0x19adf5[_0x5267('0x77')][_0x268805][_0x5267('0x79')],null,util[_0x5267('0x72')](_0x5267('0x7b'),_0x19adf5[_0x5267('0x6c')],_0x19adf5[_0x5267('0x77')][_0x268805][_0x5267('0x78')],_0x19adf5[_0x5267('0x77')][_0x268805]['foreignTable'],_0x19adf5['joins'][_0x268805][_0x5267('0x7a')]));}}}if(_0x19adf5[_0x5267('0x7c')]){_0x19adf5[_0x5267('0x7c')]=JSON[_0x5267('0x7d')](_0x19adf5['conditions']);_0x5cca85[_0x5267('0x38')](_0xc88193(_0x19adf5['conditions'][_0x5267('0x63')]));}_0x726410=_0x5cca85[_0x5267('0x7e')]();_0x5cca85[_0x5267('0x1d')](_0x5ad1ce);_0x5cca85[_0x5267('0x1b')](0x0);logger['debug']('Limited\x20Query:',_0x5cca85[_0x5267('0x7f')]());return dbH[_0x5267('0x80')][_0x5267('0x30')](_0x5cca85[_0x5267('0x7f')](),{'type':dbH[_0x5267('0x80')][_0x5267('0x81')]['SELECT']});}})[_0x5267('0x25')](respondWithResult(_0x195575,null))['catch'](handleError(_0x195575,null));};function runReport(_0x418a03,_0x5b8026,_0x2c2b95){var _0x20888d=_0x5b8026[_0x5267('0x28')];var _0x87aa90=0xa;var _0x164cc1=[_0x5267('0x4f'),_0x5267('0x50'),_0x5267('0x82'),_0x5267('0x51')];var _0x28e4b6={'SUM':_0x5267('0x52'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0x5267('0x54'),'MAX':_0x5267('0x55'),'MIN':'MIN(%s)','AVG':_0x5267('0x56'),'GROUP_CONCAT':_0x5267('0x57'),'GROUP_CONCAT ASC':_0x5267('0x58'),'GROUP_CONCAT DESC':_0x5267('0x59')};var _0xd18795={'SEC_TO_TIME':_0x5267('0x83'),'DATE':_0x5267('0x5a'),'HOUR':'HOUR(%s)','ROUND':_0x5267('0x5b'),'UNIX_TIMESTAMP':_0x5267('0x5c')};var _0x2543a4=function(_0x2feea8){return!_[_0x5267('0x5d')](['IS\x20NULL','IS\x20NOT\x20NULL',_0x5267('0x84'),_0x5267('0x60')],_0x2feea8);};var _0x199ff6=function(_0xbf36fb){if(!_0xbf36fb||!_0xbf36fb['rules'][_0x5267('0x35')]){return'';}for(var _0x3cc775='(',_0x2630f2=0x0;_0x2630f2<_0xbf36fb[_0x5267('0x61')][_0x5267('0x35')];_0x2630f2+=0x1){_0x2630f2>0x0&&(_0x3cc775+='\x20'+_0xbf36fb[_0x5267('0x62')]+'\x20');_0x3cc775+=_0xbf36fb[_0x5267('0x61')][_0x2630f2][_0x5267('0x63')]?_0x199ff6(_0xbf36fb[_0x5267('0x61')][_0x2630f2][_0x5267('0x63')]):_0xbf36fb[_0x5267('0x61')][_0x2630f2][_0x5267('0x6f')]+'\x20'+_0xbf36fb[_0x5267('0x61')][_0x2630f2]['condition']+(_0x2543a4(_0xbf36fb[_0x5267('0x61')][_0x2630f2][_0x5267('0x64')])?'\x20'+_0xbf36fb[_0x5267('0x61')][_0x2630f2][_0x5267('0x65')]:'');}return _0x3cc775+')';};var _0x447b5f={'where':{'id':_0x418a03['id']}},_0x25ce90,_0x257c69,_0x160c9c,_0x42694a,_0x11a2f4;_0x447b5f=_[_0x5267('0x3c')]({},_0x447b5f,_0x2c2b95);return db[_0x5267('0x2a')][_0x5267('0x48')](_0x447b5f)[_0x5267('0x25')](function(_0x35c3b7){if(_0x35c3b7){_0x25ce90=_0x35c3b7;return _0x35c3b7[_0x5267('0x66')]();}return null;})[_0x5267('0x25')](function(_0x35a4a3){if(_0x35a4a3){if(!_0x35a4a3[_0x5267('0x35')]){throw new db[(_0x5267('0x85'))][(_0x5267('0x67'))](_0x5267('0x68'),0x193);}_0x257c69=_0x35a4a3;return db[_0x5267('0x69')]['findAll']({'raw':!![]});}return null;})[_0x5267('0x25')](function(_0x318393){if(_0x318393){_0x160c9c=_[_0x5267('0x86')](_0x318393,'id');var _0x405eb4;var _0x38f5b7=squel['select']();_0x38f5b7[_0x5267('0x87')](_0x25ce90[_0x5267('0x6c')]);for(var _0x4c68cd=0x0;_0x4c68cd<_0x257c69['length'];_0x4c68cd+=0x1){_0x405eb4=_0x257c69[_0x4c68cd]['MetricId']?_0x160c9c[_0x257c69[_0x4c68cd][_0x5267('0x6d')]]['metric']:_0x257c69[_0x4c68cd][_0x5267('0x6f')];_0x405eb4=_0x257c69[_0x4c68cd]['function']?_['replace'](_0x28e4b6[_0x257c69[_0x4c68cd][_0x5267('0x70')]],'%s',_0x405eb4):_0x405eb4;_0x405eb4=_0x257c69[_0x4c68cd][_0x5267('0x72')]?_[_0x5267('0x71')](_0xd18795[_0x257c69[_0x4c68cd][_0x5267('0x72')]],'%s',_0x405eb4):_0x405eb4;if(_0x257c69[_0x4c68cd][_0x5267('0x73')]){_0x38f5b7['group'](_0x405eb4);}_0x257c69[_0x4c68cd]['orderBy']&&_0x38f5b7[_0x5267('0x74')](_0x405eb4,_0x257c69[_0x4c68cd][_0x5267('0x75')]===_0x5267('0x76')?![]:!![]);_0x38f5b7[_0x5267('0x6f')](_0x405eb4,_0x257c69[_0x4c68cd][_0x5267('0x88')]||_0x405eb4);}if(_0x25ce90['joins']){_0x25ce90[_0x5267('0x77')]=JSON['parse'](_0x25ce90['joins']);for(var _0x3dfd8d=0x0;_0x3dfd8d<_0x25ce90['joins']['length'];_0x3dfd8d+=0x1){if(_0x25ce90[_0x5267('0x77')][_0x3dfd8d][_0x5267('0x2d')]&&_['includes'](_0x164cc1,_0x25ce90['joins'][_0x3dfd8d]['type'])&&_0x25ce90[_0x5267('0x77')][_0x3dfd8d]['parentKey']&&_0x25ce90[_0x5267('0x77')][_0x3dfd8d]['foreignTable']&&_0x25ce90[_0x5267('0x77')][_0x3dfd8d][_0x5267('0x7a')]){_0x38f5b7[_0x25ce90['joins'][_0x3dfd8d][_0x5267('0x2d')]](_0x25ce90[_0x5267('0x77')][_0x3dfd8d][_0x5267('0x79')],null,util[_0x5267('0x72')](_0x5267('0x7b'),_0x25ce90[_0x5267('0x6c')],_0x25ce90['joins'][_0x3dfd8d]['parentKey'],_0x25ce90[_0x5267('0x77')][_0x3dfd8d]['foreignTable'],_0x25ce90['joins'][_0x3dfd8d][_0x5267('0x7a')]));}}}if(_0x25ce90['conditions']){_0x25ce90[_0x5267('0x7c')]=JSON['parse'](_0x25ce90[_0x5267('0x7c')]);_0x38f5b7['where'](_0x199ff6(_0x25ce90[_0x5267('0x7c')][_0x5267('0x63')]));}_0x11a2f4=_0x38f5b7[_0x5267('0x7e')]();_0x38f5b7[_0x5267('0x1d')](_0x87aa90);_0x38f5b7[_0x5267('0x1b')](0x0);return;}})[_0x5267('0x25')](function(){if(_0x5b8026[_0x5267('0x89')]==='web'){return null;}var _0x4df99f=_[_0x5267('0x3c')](_0x5b8026,{'name':_0x5b8026['fullPath']||_0x5b8026['name']||_0x25ce90['name'],'basename':_0x20888d,'savename':util['format']('%s-%s.%s',_0x5b8026['name']||_0x25ce90[_0x5267('0x28')],require(_0x5267('0x8a'))[_0x5267('0x8b')](0x4),_0x5b8026[_0x5267('0x89')]||_0x5267('0x8c')),'reportId':_0x25ce90['id'],'reportType':_0x5267('0x8d')});return db[_0x5267('0x8e')][_0x5267('0x42')](_0x4df99f,{'raw':!![]});})['then'](function(_0x5df23d){if(_0x25ce90['table']===_0x5267('0x8f')){_0x11a2f4[_0x5267('0x38')](_0x25ce90['table']+_0x5267('0x90'),_0x5b8026[_0x5267('0x91')],_0x5b8026[_0x5267('0x92')]);}else{_0x11a2f4[_0x5267('0x38')](_0x25ce90['table']+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x5b8026[_0x5267('0x91')],_0x5b8026[_0x5267('0x92')]);}if(_0x5df23d){logger[_0x5267('0x93')](_0x5267('0x94'),_0x11a2f4[_0x5267('0x7f')]());require(_0x5267('0x95'))[_0x5267('0x96')](path['join'](__dirname,'../../components/export/',_0x5df23d['output']),[_0x5df23d['id'],_0x11a2f4[_0x5267('0x7f')](),path[_0x5267('0x4f')](__dirname,_0x5267('0x97'),_0x5df23d[_0x5267('0x98')]),_0x20888d]);return _0x5df23d;}else{var _0x190ef4=squel[_0x5267('0x6b')]();_0x190ef4['from']('('+_0x11a2f4[_0x5267('0x7f')]()+')','countTable');_0x190ef4[_0x5267('0x6f')](_0x5267('0x99'),_0x5267('0x1e'));_0x11a2f4[_0x5267('0x1d')](_0x5b8026[_0x5267('0x1d')]||_0x87aa90);_0x11a2f4['offset'](_0x5b8026[_0x5267('0x1b')]||0x0);return dbH[_0x5267('0x80')][_0x5267('0x30')](_0x190ef4['toString'](),{'type':dbH['sequelize']['QueryTypes'][_0x5267('0x9a')]})[_0x5267('0x25')](function(_0x1be763){if(!_0x1be763[_0x5267('0x35')]){_0x42694a=0x0;}else{_0x42694a=_0x1be763[0x0]['count']||0x0;}return dbH['sequelize'][_0x5267('0x30')](_0x11a2f4[_0x5267('0x7f')](),{'type':dbH['sequelize'][_0x5267('0x81')][_0x5267('0x9a')]});})['then'](function(_0x5005b3){return{'rows':_0x5005b3||[],'count':_0x42694a};});}});}exports[_0x5267('0x9b')]=function(_0x11a6f4,_0x5a16ee){return runReport(_0x11a6f4[_0x5267('0x41')],_0x11a6f4[_0x5267('0x30')],_0x11a6f4[_0x5267('0x3d')])[_0x5267('0x25')](respondWithResult(_0x5a16ee,null))[_0x5267('0x40')](handleError(_0x5a16ee,null));};exports[_0x5267('0x9c')]=runReport;exports[_0x5267('0x30')]=function(_0x1e9651,_0x66da7a){var _0x54b582=0xa;var _0x4e4724=[_0x5267('0x4f'),'left_join',_0x5267('0x82'),_0x5267('0x51')];var _0x2722f9={'SUM':_0x5267('0x52'),'COUNT':_0x5267('0x53'),'COUNT DISTINCT':_0x5267('0x54'),'MAX':_0x5267('0x55'),'MIN':_0x5267('0x9d'),'AVG':_0x5267('0x56'),'GROUP_CONCAT':_0x5267('0x57'),'GROUP_CONCAT ASC':_0x5267('0x58'),'GROUP_CONCAT DESC':_0x5267('0x59')};var _0x5909b3={'SEC_TO_TIME':_0x5267('0x83'),'DATE':'DATE(%s)','HOUR':'HOUR(%s)','ROUND':_0x5267('0x5b'),'UNIX_TIMESTAMP':_0x5267('0x5c')};var _0x1d7987=function(_0x59efe1){return!_[_0x5267('0x5d')]([_0x5267('0x5e'),_0x5267('0x5f'),_0x5267('0x84'),_0x5267('0x60')],_0x59efe1);};var _0x46c79e=function(_0xcfba51){if(!_0xcfba51||!_0xcfba51[_0x5267('0x61')][_0x5267('0x35')]){return'';}for(var _0x3c5516='(',_0x1e8367=0x0;_0x1e8367<_0xcfba51[_0x5267('0x61')]['length'];_0x1e8367+=0x1){_0x1e8367>0x0&&(_0x3c5516+='\x20'+_0xcfba51[_0x5267('0x62')]+'\x20');_0x3c5516+=_0xcfba51[_0x5267('0x61')][_0x1e8367]['group']?_0x46c79e(_0xcfba51[_0x5267('0x61')][_0x1e8367][_0x5267('0x63')]):_0xcfba51[_0x5267('0x61')][_0x1e8367][_0x5267('0x6f')]+'\x20'+_0xcfba51['rules'][_0x1e8367][_0x5267('0x64')]+(_0x1d7987(_0xcfba51[_0x5267('0x61')][_0x1e8367][_0x5267('0x64')])?'\x20'+_0xcfba51['rules'][_0x1e8367][_0x5267('0x65')]:'');}return _0x3c5516+')';};var _0x19935d={'where':{'id':_0x1e9651[_0x5267('0x41')]['id']}},_0x3102e0,_0x2d215e,_0xc0af94,_0x178080,_0x3485ab;_0x19935d=_[_0x5267('0x3c')]({},_0x19935d,_0x1e9651['options']);return db[_0x5267('0x2a')][_0x5267('0x48')](_0x19935d)['then'](function(_0x17d2d4){if(_0x17d2d4){_0x3102e0=_0x17d2d4;return _0x17d2d4['getFields']();}return null;})[_0x5267('0x25')](function(_0x4c5a26){if(_0x4c5a26){if(!_0x4c5a26[_0x5267('0x35')]){throw new db[(_0x5267('0x85'))]['ValidationErrorItem']('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x2d215e=_0x4c5a26;return db[_0x5267('0x69')][_0x5267('0x6a')]({'raw':!![]});}return null;})[_0x5267('0x25')](function(_0x1a0883){if(_0x1a0883){_0xc0af94=_[_0x5267('0x86')](_0x1a0883,'id');var _0x501da6;var _0x3dcf73=squel['select']();_0x3dcf73['from'](_0x3102e0['table']);for(var _0x1ded05=0x0;_0x1ded05<_0x2d215e[_0x5267('0x35')];_0x1ded05+=0x1){_0x501da6=_0x2d215e[_0x1ded05][_0x5267('0x6d')]?_0xc0af94[_0x2d215e[_0x1ded05][_0x5267('0x6d')]][_0x5267('0x6e')]:_0x2d215e[_0x1ded05][_0x5267('0x6f')];_0x501da6=_0x2d215e[_0x1ded05][_0x5267('0x70')]?_['replace'](_0x2722f9[_0x2d215e[_0x1ded05]['function']],'%s',_0x501da6):_0x501da6;_0x501da6=_0x2d215e[_0x1ded05][_0x5267('0x72')]?_[_0x5267('0x71')](_0x5909b3[_0x2d215e[_0x1ded05][_0x5267('0x72')]],'%s',_0x501da6):_0x501da6;if(_0x2d215e[_0x1ded05][_0x5267('0x73')]){_0x3dcf73[_0x5267('0x63')](_0x501da6);}_0x2d215e[_0x1ded05]['orderBy']&&_0x3dcf73[_0x5267('0x74')](_0x501da6,_0x2d215e[_0x1ded05][_0x5267('0x75')]===_0x5267('0x76')?![]:!![]);_0x3dcf73[_0x5267('0x6f')](_0x501da6,_0x2d215e[_0x1ded05][_0x5267('0x88')]||_0x501da6);}if(_0x3102e0['joins']){_0x3102e0[_0x5267('0x77')]=JSON[_0x5267('0x7d')](_0x3102e0[_0x5267('0x77')]);for(var _0x4bfafd=0x0;_0x4bfafd<_0x3102e0[_0x5267('0x77')]['length'];_0x4bfafd+=0x1){if(_0x3102e0[_0x5267('0x77')][_0x4bfafd][_0x5267('0x2d')]&&_['includes'](_0x4e4724,_0x3102e0[_0x5267('0x77')][_0x4bfafd]['type'])&&_0x3102e0[_0x5267('0x77')][_0x4bfafd][_0x5267('0x78')]&&_0x3102e0['joins'][_0x4bfafd][_0x5267('0x79')]&&_0x3102e0[_0x5267('0x77')][_0x4bfafd]['foreignKey']){_0x3dcf73[_0x3102e0[_0x5267('0x77')][_0x4bfafd][_0x5267('0x2d')]](_0x3102e0[_0x5267('0x77')][_0x4bfafd][_0x5267('0x79')],null,util[_0x5267('0x72')]('%s.%s\x20=\x20%s.%s',_0x3102e0['table'],_0x3102e0[_0x5267('0x77')][_0x4bfafd][_0x5267('0x78')],_0x3102e0['joins'][_0x4bfafd][_0x5267('0x79')],_0x3102e0['joins'][_0x4bfafd][_0x5267('0x7a')]));}}}if(_0x3102e0[_0x5267('0x7c')]){_0x3102e0[_0x5267('0x7c')]=JSON[_0x5267('0x7d')](_0x3102e0[_0x5267('0x7c')]);_0x3dcf73[_0x5267('0x38')](_0x46c79e(_0x3102e0[_0x5267('0x7c')][_0x5267('0x63')]));}_0x3485ab=_0x3dcf73[_0x5267('0x7e')]();_0x3dcf73[_0x5267('0x1d')](_0x54b582);_0x3dcf73[_0x5267('0x1b')](0x0);logger[_0x5267('0x9e')]('Limited\x20Query:',_0x3dcf73[_0x5267('0x7f')]());return dbH[_0x5267('0x80')][_0x5267('0x30')](_0x3dcf73[_0x5267('0x7f')](),{'type':dbH[_0x5267('0x80')][_0x5267('0x81')][_0x5267('0x9a')]});}})[_0x5267('0x25')](function(){return{'sql':_0x3485ab[_0x5267('0x7f')]()};})[_0x5267('0x25')](respondWithResult(_0x66da7a,null))[_0x5267('0x40')](handleError(_0x66da7a,null));}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index 38c26f0..0345b11 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 _0xe6f3=['request-promise','path','rimraf','../../config/environment','exports','define','analytics_default_reports','lodash','util','../../config/logger','api','moment'];(function(_0xbf3a7b,_0x42ada8){var _0x5ad5f8=function(_0x89ee1){while(--_0x89ee1){_0xbf3a7b['push'](_0xbf3a7b['shift']());}};_0x5ad5f8(++_0x42ada8);}(_0xe6f3,0xeb));var _0x3e6f=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xe6f3[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0x3e6f('0x0'));var util=require(_0x3e6f('0x1'));var logger=require(_0x3e6f('0x2'))(_0x3e6f('0x3'));var moment=require(_0x3e6f('0x4'));var BPromise=require('bluebird');var rp=require(_0x3e6f('0x5'));var fs=require('fs');var path=require(_0x3e6f('0x6'));var rimraf=require(_0x3e6f('0x7'));var config=require(_0x3e6f('0x8'));var attributes=require('./analyticDefaultReport.attributes');module[_0x3e6f('0x9')]=function(_0x222085,_0x1b2524){return _0x222085[_0x3e6f('0xa')]('AnalyticDefaultReport',attributes,{'tableName':_0x3e6f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3533=['analytics_default_reports','util','../../config/logger','bluebird','path','rimraf','../../config/environment','./analyticDefaultReport.attributes','exports','AnalyticDefaultReport'];(function(_0x4b9aea,_0x85deeb){var _0x34fd47=function(_0x282b51){while(--_0x282b51){_0x4b9aea['push'](_0x4b9aea['shift']());}};_0x34fd47(++_0x85deeb);}(_0x3533,0xb5));var _0x3353=function(_0x82eef6,_0x52a17d){_0x82eef6=_0x82eef6-0x0;var _0x8809c3=_0x3533[_0x82eef6];return _0x8809c3;};'use strict';var _=require('lodash');var util=require(_0x3353('0x0'));var logger=require(_0x3353('0x1'))('api');var moment=require('moment');var BPromise=require(_0x3353('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3353('0x3'));var rimraf=require(_0x3353('0x4'));var config=require(_0x3353('0x5'));var attributes=require(_0x3353('0x6'));module[_0x3353('0x7')]=function(_0x4f0988,_0xb85da7){return _0x4f0988['define'](_0x3353('0x8'),attributes,{'tableName':_0x3353('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.rpc.js b/server/api/analyticDefaultReport/analyticDefaultReport.rpc.js index ef7e504..ae86345 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 _0x21e0=['then','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request'];(function(_0x1ac120,_0x3e7e45){var _0x19b703=function(_0x5f32cb){while(--_0x5f32cb){_0x1ac120['push'](_0x1ac120['shift']());}};_0x19b703(++_0x3e7e45);}(_0x21e0,0xda));var _0x021e=function(_0x305d5d,_0x41cf20){_0x305d5d=_0x305d5d-0x0;var _0x89e1dd=_0x21e0[_0x305d5d];return _0x89e1dd;};'use strict';var _=require(_0x021e('0x0'));var util=require(_0x021e('0x1'));var moment=require(_0x021e('0x2'));var BPromise=require(_0x021e('0x3'));var rs=require(_0x021e('0x4'));var fs=require('fs');var Redis=require(_0x021e('0x5'));var db=require(_0x021e('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x021e('0x7'))(_0x021e('0x8'));var config=require(_0x021e('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x021e('0xa')][_0x021e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2cfefa,_0x17af04,_0x9bf7f0){return new BPromise(function(_0x149b8b,_0x15e899){return client[_0x021e('0xc')](_0x2cfefa,_0x9bf7f0)[_0x021e('0xd')](function(_0x4a1296){logger['info'](_0x021e('0xe'),_0x17af04,_0x021e('0xf'));logger['debug']('AnalyticDefaultReport,\x20%s,\x20%s,\x20%s',_0x17af04,'request\x20sent',JSON[_0x021e('0x10')](_0x4a1296));if(_0x4a1296[_0x021e('0x11')]){if(_0x4a1296[_0x021e('0x11')][_0x021e('0x12')]===0x1f4){logger[_0x021e('0x11')](_0x021e('0xe'),_0x17af04,_0x4a1296[_0x021e('0x11')][_0x021e('0x13')]);return _0x15e899(_0x4a1296[_0x021e('0x11')][_0x021e('0x13')]);}logger[_0x021e('0x11')](_0x021e('0xe'),_0x17af04,_0x4a1296['error']['message']);return _0x149b8b(_0x4a1296[_0x021e('0x11')][_0x021e('0x13')]);}else{logger['info']('AnalyticDefaultReport,\x20%s,\x20%s',_0x17af04,_0x021e('0xf'));_0x149b8b(_0x4a1296[_0x021e('0x14')]['message']);}})['catch'](function(_0x1d8e87){logger[_0x021e('0x11')](_0x021e('0xe'),_0x17af04,_0x1d8e87);_0x15e899(_0x1d8e87);});});} \ No newline at end of file +var _0x4f88=['../../config/environment','http','request','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc'];(function(_0x50f288,_0xfecd76){var _0x2a0755=function(_0x48f555){while(--_0x48f555){_0x50f288['push'](_0x50f288['shift']());}};_0x2a0755(++_0xfecd76);}(_0x4f88,0x1da));var _0x84f8=function(_0x467cb0,_0x303070){_0x467cb0=_0x467cb0-0x0;var _0x2153f7=_0x4f88[_0x467cb0];return _0x2153f7;};'use strict';var _=require(_0x84f8('0x0'));var util=require(_0x84f8('0x1'));var moment=require(_0x84f8('0x2'));var BPromise=require(_0x84f8('0x3'));var rs=require(_0x84f8('0x4'));var fs=require('fs');var Redis=require(_0x84f8('0x5'));var db=require(_0x84f8('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x84f8('0x7'))(_0x84f8('0x8'));var config=require(_0x84f8('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x84f8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3fea09,_0x54441e,_0x5e8807){return new BPromise(function(_0x5f2841,_0x4613c0){return client[_0x84f8('0xb')](_0x3fea09,_0x5e8807)['then'](function(_0x32fc2c){logger['info'](_0x84f8('0xc'),_0x54441e,_0x84f8('0xd'));logger[_0x84f8('0xe')](_0x84f8('0xf'),_0x54441e,_0x84f8('0xd'),JSON[_0x84f8('0x10')](_0x32fc2c));if(_0x32fc2c[_0x84f8('0x11')]){if(_0x32fc2c[_0x84f8('0x11')][_0x84f8('0x12')]===0x1f4){logger[_0x84f8('0x11')](_0x84f8('0xc'),_0x54441e,_0x32fc2c[_0x84f8('0x11')]['message']);return _0x4613c0(_0x32fc2c[_0x84f8('0x11')]['message']);}logger[_0x84f8('0x11')](_0x84f8('0xc'),_0x54441e,_0x32fc2c[_0x84f8('0x11')][_0x84f8('0x13')]);return _0x5f2841(_0x32fc2c['error'][_0x84f8('0x13')]);}else{logger[_0x84f8('0x14')](_0x84f8('0xc'),_0x54441e,_0x84f8('0xd'));_0x5f2841(_0x32fc2c[_0x84f8('0x15')]['message']);}})[_0x84f8('0x16')](function(_0x163332){logger['error'](_0x84f8('0xc'),_0x54441e,_0x163332);_0x4613c0(_0x163332);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index 8c8a28e..64b6e93 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 _0xcf53=['show','/:id/preview','preview','/:id/run','run','/:id/query','query','post','create','put','multer','util','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticDefaultReport.controller','get','isAuthenticated','index','/:id'];(function(_0x323df1,_0x5b31f4){var _0x312757=function(_0x3bcc55){while(--_0x3bcc55){_0x323df1['push'](_0x323df1['shift']());}};_0x312757(++_0x5b31f4);}(_0xcf53,0x15a));var _0x3cf5=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xcf53[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0x3cf5('0x0'));var util=require(_0x3cf5('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x3cf5('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x3cf5('0x3'));var interaction=require(_0x3cf5('0x4'));var config=require(_0x3cf5('0x5'));var controller=require(_0x3cf5('0x6'));router[_0x3cf5('0x7')]('/',auth[_0x3cf5('0x8')](),controller[_0x3cf5('0x9')]);router[_0x3cf5('0x7')](_0x3cf5('0xa'),auth[_0x3cf5('0x8')](),controller[_0x3cf5('0xb')]);router[_0x3cf5('0x7')](_0x3cf5('0xc'),auth['isAuthenticated'](),controller[_0x3cf5('0xd')]);router[_0x3cf5('0x7')](_0x3cf5('0xe'),auth[_0x3cf5('0x8')](),controller[_0x3cf5('0xf')]);router[_0x3cf5('0x7')](_0x3cf5('0x10'),auth[_0x3cf5('0x8')](),controller[_0x3cf5('0x11')]);router[_0x3cf5('0x12')]('/',auth[_0x3cf5('0x8')](),controller[_0x3cf5('0x13')]);router[_0x3cf5('0x14')](_0x3cf5('0xa'),auth[_0x3cf5('0x8')](),controller['update']);router['delete'](_0x3cf5('0xa'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x74a7=['index','/:id','show','/:id/preview','preview','/:id/run','/:id/query','query','post','create','put','delete','exports','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./analyticDefaultReport.controller','get','isAuthenticated'];(function(_0x12e073,_0x2a6387){var _0x17e67b=function(_0x61b780){while(--_0x61b780){_0x12e073['push'](_0x12e073['shift']());}};_0x17e67b(++_0x2a6387);}(_0x74a7,0x91));var _0x774a=function(_0x3c8291,_0x104ac7){_0x3c8291=_0x3c8291-0x0;var _0x3eea23=_0x74a7[_0x3c8291];return _0x3eea23;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x774a('0x0'));var timeout=require(_0x774a('0x1'));var express=require('express');var router=express[_0x774a('0x2')]();var fs_extra=require(_0x774a('0x3'));var auth=require(_0x774a('0x4'));var interaction=require(_0x774a('0x5'));var config=require('../../config/environment');var controller=require(_0x774a('0x6'));router[_0x774a('0x7')]('/',auth[_0x774a('0x8')](),controller[_0x774a('0x9')]);router[_0x774a('0x7')](_0x774a('0xa'),auth['isAuthenticated'](),controller[_0x774a('0xb')]);router[_0x774a('0x7')](_0x774a('0xc'),auth[_0x774a('0x8')](),controller[_0x774a('0xd')]);router[_0x774a('0x7')](_0x774a('0xe'),auth[_0x774a('0x8')](),controller['run']);router[_0x774a('0x7')](_0x774a('0xf'),auth['isAuthenticated'](),controller[_0x774a('0x10')]);router[_0x774a('0x11')]('/',auth['isAuthenticated'](),controller[_0x774a('0x12')]);router[_0x774a('0x13')](_0x774a('0xa'),auth['isAuthenticated'](),controller['update']);router[_0x774a('0x14')](_0x774a('0xa'),auth[_0x774a('0x8')](),controller['destroy']);module[_0x774a('0x15')]=router; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js b/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js index d1e47b7..f4f518e 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 _0x1e34=['DATE','Loading','manual','scheduled','INTEGER','sequelize','exports','STRING','ENUM','csv','pdf','xlsx'];(function(_0x242b15,_0x546fe1){var _0x40443a=function(_0x4ed34f){while(--_0x4ed34f){_0x242b15['push'](_0x242b15['shift']());}};_0x40443a(++_0x546fe1);}(_0x1e34,0x1d9));var _0x41e3=function(_0x456432,_0x2979c3){_0x456432=_0x456432-0x0;var _0x47706f=_0x1e34[_0x456432];return _0x47706f;};'use strict';var Sequelize=require(_0x41e3('0x0'));var moment=require('moment');module[_0x41e3('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'basename':{'type':Sequelize[_0x41e3('0x2')],'allowNull':![]},'output':{'type':Sequelize[_0x41e3('0x3')](_0x41e3('0x4'),_0x41e3('0x5'),_0x41e3('0x6')),'allowNull':![],'defaultValue':_0x41e3('0x4')},'savename':{'type':Sequelize[_0x41e3('0x2')],'allowNull':![]},'startDate':{'type':Sequelize['DATE']},'endDate':{'type':Sequelize[_0x41e3('0x7')]},'status':{'type':Sequelize[_0x41e3('0x2')],'defaultValue':_0x41e3('0x8')},'type':{'type':Sequelize[_0x41e3('0x3')](_0x41e3('0x9'),_0x41e3('0xa')),'allowNull':![],'defaultValue':_0x41e3('0x9')},'reportId':{'type':Sequelize[_0x41e3('0xb')](0xb)['UNSIGNED']},'reportType':{'type':Sequelize[_0x41e3('0x2')]}}; \ No newline at end of file +var _0x4401=['ENUM','csv','pdf','xlsx','DATE','Loading','scheduled','manual','INTEGER','sequelize','moment','exports','STRING'];(function(_0x4848cd,_0x3d9895){var _0x261a1d=function(_0xc825c0){while(--_0xc825c0){_0x4848cd['push'](_0x4848cd['shift']());}};_0x261a1d(++_0x3d9895);}(_0x4401,0xcc));var _0x1440=function(_0x29d1ac,_0x502f20){_0x29d1ac=_0x29d1ac-0x0;var _0x5db05c=_0x4401[_0x29d1ac];return _0x5db05c;};'use strict';var Sequelize=require(_0x1440('0x0'));var moment=require(_0x1440('0x1'));module[_0x1440('0x2')]={'name':{'type':Sequelize[_0x1440('0x3')],'allowNull':![]},'basename':{'type':Sequelize[_0x1440('0x3')],'allowNull':![]},'output':{'type':Sequelize[_0x1440('0x4')](_0x1440('0x5'),_0x1440('0x6'),_0x1440('0x7')),'allowNull':![],'defaultValue':'csv'},'savename':{'type':Sequelize[_0x1440('0x3')],'allowNull':![]},'startDate':{'type':Sequelize[_0x1440('0x8')]},'endDate':{'type':Sequelize[_0x1440('0x8')]},'status':{'type':Sequelize[_0x1440('0x3')],'defaultValue':_0x1440('0x9')},'type':{'type':Sequelize[_0x1440('0x4')]('manual',_0x1440('0xa')),'allowNull':![],'defaultValue':_0x1440('0xb')},'reportId':{'type':Sequelize[_0x1440('0xc')](0xb)['UNSIGNED']},'reportType':{'type':Sequelize[_0x1440('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.controller.js b/server/api/analyticExtractedReport/analyticExtractedReport.controller.js index e258c86..f515c67 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 _0x1e6c=['savename','Sequelize','ValidationError','Report\x20not\x20found\x20or\x20empty','exists','format','%s.%s','toLowerCase','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','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','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','Content-Range','apply','reject','save','then','destroy','get','ExtractedReports','UserProfileResource','error','stack','name','send','index','map','AnalyticExtractedReport','rawAttributes','fieldName','type','key','model','keys','intersection','query','fields','attributes','length','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','download','basename','output','existsSync','join','root','server/files/reports'];(function(_0x4b3512,_0xb29a42){var _0x47d086=function(_0x22710f){while(--_0x22710f){_0x4b3512['push'](_0x4b3512['shift']());}};_0x47d086(++_0xb29a42);}(_0x1e6c,0x137));var _0xc1e6=function(_0x49e584,_0x2886f8){_0x49e584=_0x49e584-0x0;var _0x58b1be=_0x1e6c[_0x49e584];return _0x58b1be;};'use strict';var emlformat=require(_0xc1e6('0x0'));var rimraf=require(_0xc1e6('0x1'));var zipdir=require(_0xc1e6('0x2'));var jsonpatch=require(_0xc1e6('0x3'));var rp=require(_0xc1e6('0x4'));var moment=require(_0xc1e6('0x5'));var BPromise=require(_0xc1e6('0x6'));var Mustache=require(_0xc1e6('0x7'));var util=require(_0xc1e6('0x8'));var path=require('path');var sox=require(_0xc1e6('0x9'));var csv=require(_0xc1e6('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc1e6('0xb'));var _=require(_0xc1e6('0xc'));var squel=require(_0xc1e6('0xd'));var crypto=require('crypto');var jsforce=require(_0xc1e6('0xe'));var deskjs=require(_0xc1e6('0xf'));var toCsv=require(_0xc1e6('0xa'));var querystring=require(_0xc1e6('0x10'));var Papa=require(_0xc1e6('0x11'));var Redis=require(_0xc1e6('0x12'));var authService=require(_0xc1e6('0x13'));var qs=require(_0xc1e6('0x14'));var as=require(_0xc1e6('0x15'));var hardwareService=require(_0xc1e6('0x16'));var logger=require('../../config/logger')(_0xc1e6('0x17'));var utils=require(_0xc1e6('0x18'));var config=require(_0xc1e6('0x19'));var licenseUtil=require(_0xc1e6('0x1a'));var db=require(_0xc1e6('0x1b'))['db'];function respondWithStatusCode(_0x339e7a,_0x14af17){_0x14af17=_0x14af17||0xcc;return function(_0xa37d70){if(_0xa37d70){return _0x339e7a[_0xc1e6('0x1c')](_0x14af17);}return _0x339e7a[_0xc1e6('0x1d')](_0x14af17)[_0xc1e6('0x1e')]();};}function respondWithResult(_0x9ec315,_0x17322f){_0x17322f=_0x17322f||0xc8;return function(_0x40f393){if(_0x40f393){return _0x9ec315['status'](_0x17322f)['json'](_0x40f393);}};}function respondWithFilteredResult(_0x5d5744,_0x502f74){return function(_0x3840aa){if(_0x3840aa){var _0x33b168=typeof _0x502f74[_0xc1e6('0x1f')]===_0xc1e6('0x20')&&typeof _0x502f74[_0xc1e6('0x21')]===_0xc1e6('0x20');var _0x193b50=_0x3840aa[_0xc1e6('0x22')];var _0x52f2a8=_0x33b168?0x0:_0x502f74['offset'];var _0x18c973=_0x33b168?_0x3840aa[_0xc1e6('0x22')]:_0x502f74[_0xc1e6('0x1f')]+_0x502f74[_0xc1e6('0x21')];var _0x2feda8;if(_0x18c973>=_0x193b50){_0x18c973=_0x193b50;_0x2feda8=0xc8;}else{_0x2feda8=0xce;}_0x5d5744['status'](_0x2feda8);return _0x5d5744['set'](_0xc1e6('0x23'),_0x52f2a8+'-'+_0x18c973+'/'+_0x193b50)['json'](_0x3840aa);}return null;};}function patchUpdates(_0x3fe2c1){return function(_0x2c7662){try{jsonpatch[_0xc1e6('0x24')](_0x2c7662,_0x3fe2c1,!![]);}catch(_0x187a9b){return BPromise[_0xc1e6('0x25')](_0x187a9b);}return _0x2c7662[_0xc1e6('0x26')]();};}function saveUpdates(_0x29a4e5,_0x19ddf4){return function(_0x1729ed){if(_0x1729ed){return _0x1729ed['update'](_0x29a4e5)[_0xc1e6('0x27')](function(_0x2f1eee){return _0x2f1eee;});}return null;};}function removeEntity(_0x5c51c2,_0x38a43e){return function(_0x166485){if(_0x166485){return _0x166485[_0xc1e6('0x28')]()[_0xc1e6('0x27')](function(){var _0x36bbe8=_0x166485[_0xc1e6('0x29')]({'plain':!![]});var _0x85c465=_0xc1e6('0x2a');return db[_0xc1e6('0x2b')][_0xc1e6('0x28')]({'where':{'type':_0x85c465,'resourceId':_0x36bbe8['id']}})['then'](function(){return _0x166485;});})['then'](function(){_0x5c51c2[_0xc1e6('0x1d')](0xcc)[_0xc1e6('0x1e')]();});}};}function handleEntityNotFound(_0x219a14,_0x21abdd){return function(_0x3e17b5){if(!_0x3e17b5){_0x219a14[_0xc1e6('0x1c')](0x194);}return _0x3e17b5;};}function handleError(_0x57c979,_0x50d157){_0x50d157=_0x50d157||0x1f4;return function(_0x5ab8f1){logger[_0xc1e6('0x2c')](_0x5ab8f1[_0xc1e6('0x2d')]);if(_0x5ab8f1[_0xc1e6('0x2e')]){delete _0x5ab8f1[_0xc1e6('0x2e')];}_0x57c979['status'](_0x50d157)[_0xc1e6('0x2f')](_0x5ab8f1);};}exports[_0xc1e6('0x30')]=function(_0x12a1f2,_0x2468bb){var _0x3e9597={},_0x8db248={},_0x5cf6f3={'count':0x0,'rows':[]};var _0x25e605=_[_0xc1e6('0x31')](db[_0xc1e6('0x32')][_0xc1e6('0x33')],function(_0x17fb5b){return{'name':_0x17fb5b[_0xc1e6('0x34')],'type':_0x17fb5b[_0xc1e6('0x35')][_0xc1e6('0x36')]};});_0x8db248[_0xc1e6('0x37')]=_[_0xc1e6('0x31')](_0x25e605,_0xc1e6('0x2e'));_0x8db248['query']=_[_0xc1e6('0x38')](_0x12a1f2['query']);_0x8db248['filters']=_[_0xc1e6('0x39')](_0x8db248[_0xc1e6('0x37')],_0x8db248[_0xc1e6('0x3a')]);_0x3e9597['attributes']=_[_0xc1e6('0x39')](_0x8db248[_0xc1e6('0x37')],qs[_0xc1e6('0x3b')](_0x12a1f2[_0xc1e6('0x3a')]['fields']));_0x3e9597[_0xc1e6('0x3c')]=_0x3e9597[_0xc1e6('0x3c')][_0xc1e6('0x3d')]?_0x3e9597[_0xc1e6('0x3c')]:_0x8db248[_0xc1e6('0x37')];if(!_0x12a1f2[_0xc1e6('0x3a')]['hasOwnProperty'](_0xc1e6('0x3e'))){_0x3e9597['limit']=qs[_0xc1e6('0x21')](_0x12a1f2['query']['limit']);_0x3e9597[_0xc1e6('0x1f')]=qs[_0xc1e6('0x1f')](_0x12a1f2[_0xc1e6('0x3a')]['offset']);}_0x3e9597[_0xc1e6('0x3f')]=qs[_0xc1e6('0x40')](_0x12a1f2['query']['sort']);_0x3e9597[_0xc1e6('0x41')]=qs[_0xc1e6('0x42')](_['pick'](_0x12a1f2[_0xc1e6('0x3a')],_0x8db248[_0xc1e6('0x42')]),_0x25e605);if(_0x12a1f2[_0xc1e6('0x3a')][_0xc1e6('0x43')]){_0x3e9597[_0xc1e6('0x41')]=_[_0xc1e6('0x44')](_0x3e9597[_0xc1e6('0x41')],{'$or':_['map'](_0x25e605,function(_0x20075e){if(_0x20075e[_0xc1e6('0x35')]!==_0xc1e6('0x45')){var _0x29b1e0={};_0x29b1e0[_0x20075e['name']]={'$like':'%'+_0x12a1f2[_0xc1e6('0x3a')]['filter']+'%'};return _0x29b1e0;}})});}_0x3e9597=_[_0xc1e6('0x44')]({},_0x3e9597,_0x12a1f2[_0xc1e6('0x46')]);var _0x1b90aa={'where':_0x3e9597['where']};return db[_0xc1e6('0x32')]['count'](_0x1b90aa)['then'](function(_0x50afc4){_0x5cf6f3[_0xc1e6('0x22')]=_0x50afc4;if(_0x12a1f2[_0xc1e6('0x3a')][_0xc1e6('0x47')]){_0x3e9597[_0xc1e6('0x48')]=[{'all':!![]}];}return db[_0xc1e6('0x32')][_0xc1e6('0x49')](_0x3e9597);})[_0xc1e6('0x27')](function(_0x4724dd){_0x5cf6f3[_0xc1e6('0x4a')]=_0x4724dd;return _0x5cf6f3;})[_0xc1e6('0x27')](respondWithFilteredResult(_0x2468bb,_0x3e9597))[_0xc1e6('0x4b')](handleError(_0x2468bb,null));};exports[_0xc1e6('0x4c')]=function(_0x57a538,_0x260c1b){var _0x5ab98f={'raw':!![],'where':{'id':_0x57a538[_0xc1e6('0x4d')]['id']}},_0x4ff6dc={};_0x4ff6dc[_0xc1e6('0x37')]=_[_0xc1e6('0x38')](db[_0xc1e6('0x32')][_0xc1e6('0x33')]);_0x4ff6dc['query']=_[_0xc1e6('0x38')](_0x57a538[_0xc1e6('0x3a')]);_0x4ff6dc['filters']=_[_0xc1e6('0x39')](_0x4ff6dc[_0xc1e6('0x37')],_0x4ff6dc[_0xc1e6('0x3a')]);_0x5ab98f[_0xc1e6('0x3c')]=_['intersection'](_0x4ff6dc[_0xc1e6('0x37')],qs[_0xc1e6('0x3b')](_0x57a538[_0xc1e6('0x3a')]['fields']));_0x5ab98f[_0xc1e6('0x3c')]=_0x5ab98f[_0xc1e6('0x3c')]['length']?_0x5ab98f[_0xc1e6('0x3c')]:_0x4ff6dc[_0xc1e6('0x37')];if(_0x57a538[_0xc1e6('0x3a')][_0xc1e6('0x47')]){_0x5ab98f[_0xc1e6('0x48')]=[{'all':!![]}];}_0x5ab98f=_[_0xc1e6('0x44')]({},_0x5ab98f,_0x57a538[_0xc1e6('0x46')]);return db[_0xc1e6('0x32')][_0xc1e6('0x4e')](_0x5ab98f)[_0xc1e6('0x27')](handleEntityNotFound(_0x260c1b,null))[_0xc1e6('0x27')](respondWithResult(_0x260c1b,null))[_0xc1e6('0x4b')](handleError(_0x260c1b,null));};exports[_0xc1e6('0x4f')]=function(_0x318a4e,_0x59e2bd){return db[_0xc1e6('0x32')][_0xc1e6('0x4f')](_0x318a4e[_0xc1e6('0x50')],{})[_0xc1e6('0x27')](function(_0x58cedc){var _0x734d2c=_0x318a4e[_0xc1e6('0x51')]['get']({'plain':!![]});if(!_0x734d2c)throw new Error(_0xc1e6('0x52'));if(_0x734d2c[_0xc1e6('0x53')]===_0xc1e6('0x51')){var _0x37f496=_0x58cedc[_0xc1e6('0x29')]({'plain':!![]});var _0xbe99a0=_0xc1e6('0x2a');return db['UserProfileSection'][_0xc1e6('0x4e')]({'where':{'name':_0xbe99a0,'userProfileId':_0x734d2c[_0xc1e6('0x54')]},'raw':!![]})[_0xc1e6('0x27')](function(_0x59fadd){if(_0x59fadd&&_0x59fadd['autoAssociation']===0x0){return db[_0xc1e6('0x2b')][_0xc1e6('0x4f')]({'name':_0x37f496[_0xc1e6('0x2e')],'resourceId':_0x37f496['id'],'type':_0x59fadd[_0xc1e6('0x2e')],'sectionId':_0x59fadd['id']},{})['then'](function(){return _0x58cedc;});}else{return _0x58cedc;}})[_0xc1e6('0x4b')](function(_0x490b84){logger['error'](_0xc1e6('0x55'),_0x490b84);throw _0x490b84;});}return _0x58cedc;})['then'](respondWithResult(_0x59e2bd,0xc9))['catch'](handleError(_0x59e2bd,null));};exports['update']=function(_0x2383f0,_0x4ddfe9){if(_0x2383f0['body']['id']){delete _0x2383f0[_0xc1e6('0x50')]['id'];}return db[_0xc1e6('0x32')][_0xc1e6('0x4e')]({'where':{'id':_0x2383f0[_0xc1e6('0x4d')]['id']}})[_0xc1e6('0x27')](handleEntityNotFound(_0x4ddfe9,null))[_0xc1e6('0x27')](saveUpdates(_0x2383f0[_0xc1e6('0x50')],null))[_0xc1e6('0x27')](respondWithResult(_0x4ddfe9,null))[_0xc1e6('0x4b')](handleError(_0x4ddfe9,null));};exports[_0xc1e6('0x28')]=function(_0x51507a,_0x56407f){return db[_0xc1e6('0x32')][_0xc1e6('0x4e')]({'where':{'id':_0x51507a[_0xc1e6('0x4d')]['id']}})[_0xc1e6('0x27')](handleEntityNotFound(_0x56407f,null))[_0xc1e6('0x27')](removeEntity(_0x56407f,null))[_0xc1e6('0x4b')](handleError(_0x56407f,null));};exports[_0xc1e6('0x56')]=function(_0x5d8418,_0x10eee2,_0x267375){return db[_0xc1e6('0x32')][_0xc1e6('0x4e')]({'where':{'id':_0x5d8418[_0xc1e6('0x4d')]['id']},'attributes':[_0xc1e6('0x2e'),_0xc1e6('0x57'),'savename',_0xc1e6('0x58')],'raw':!![]})[_0xc1e6('0x27')](handleEntityNotFound(_0x10eee2,null))['then'](function(_0x2e6566){if(_0x2e6566){if(!fs[_0xc1e6('0x59')](path[_0xc1e6('0x5a')](config[_0xc1e6('0x5b')],_0xc1e6('0x5c'),_0x2e6566[_0xc1e6('0x5d')]))){throw new db[(_0xc1e6('0x5e'))][(_0xc1e6('0x5f'))](_0xc1e6('0x60'));}if(_0x5d8418['query'][_0xc1e6('0x61')]){return _0x10eee2[_0xc1e6('0x1c')](0xc8);}return _0x10eee2[_0xc1e6('0x56')](path['join'](config['root'],_0xc1e6('0x5c'),_0x2e6566[_0xc1e6('0x5d')]),util[_0xc1e6('0x62')](_0xc1e6('0x63'),_0x2e6566[_0xc1e6('0x57')]||_0x2e6566[_0xc1e6('0x2e')],_0x2e6566[_0xc1e6('0x58')][_0xc1e6('0x64')]()));}})['catch'](handleError(_0x10eee2,null));}; \ No newline at end of file +var _0x9519=['pick','merge','options','findAll','rows','catch','show','params','keys','rawAttributes','length','includeAll','find','create','body','get','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','download','basename','savename','existsSync','join','root','Sequelize','ValidationError','Report\x20not\x20found\x20or\x20empty','exists','server/files/reports','format','%s.%s','toLowerCase','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','fs-extra','lodash','squel','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','undefined','limit','count','offset','set','Content-Range','apply','reject','destroy','then','ExtractedReports','UserProfileResource','error','stack','name','status','send','index','map','AnalyticExtractedReport','fieldName','type','key','model','query','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','filters'];(function(_0x5679ac,_0x413bd9){var _0xe5073b=function(_0x5b6903){while(--_0x5b6903){_0x5679ac['push'](_0x5679ac['shift']());}};_0xe5073b(++_0x413bd9);}(_0x9519,0x1a0));var _0x9951=function(_0x4452db,_0x4b907c){_0x4452db=_0x4452db-0x0;var _0x192d46=_0x9519[_0x4452db];return _0x192d46;};'use strict';var emlformat=require(_0x9951('0x0'));var rimraf=require(_0x9951('0x1'));var zipdir=require(_0x9951('0x2'));var jsonpatch=require(_0x9951('0x3'));var rp=require(_0x9951('0x4'));var moment=require(_0x9951('0x5'));var BPromise=require(_0x9951('0x6'));var Mustache=require(_0x9951('0x7'));var util=require(_0x9951('0x8'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9951('0x9'));var _=require(_0x9951('0xa'));var squel=require(_0x9951('0xb'));var crypto=require('crypto');var jsforce=require(_0x9951('0xc'));var deskjs=require(_0x9951('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x9951('0xe'));var authService=require(_0x9951('0xf'));var qs=require(_0x9951('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9951('0x11'));var logger=require(_0x9951('0x12'))(_0x9951('0x13'));var utils=require(_0x9951('0x14'));var config=require(_0x9951('0x15'));var licenseUtil=require(_0x9951('0x16'));var db=require(_0x9951('0x17'))['db'];function respondWithStatusCode(_0x3b70e8,_0x56cca0){_0x56cca0=_0x56cca0||0xcc;return function(_0x518020){if(_0x518020){return _0x3b70e8[_0x9951('0x18')](_0x56cca0);}return _0x3b70e8['status'](_0x56cca0)[_0x9951('0x19')]();};}function respondWithResult(_0x2fd6e7,_0x45dbcc){_0x45dbcc=_0x45dbcc||0xc8;return function(_0x45f874){if(_0x45f874){return _0x2fd6e7['status'](_0x45dbcc)['json'](_0x45f874);}};}function respondWithFilteredResult(_0x266983,_0xcdfa8e){return function(_0x3cb7f4){if(_0x3cb7f4){var _0x5231fa=typeof _0xcdfa8e['offset']===_0x9951('0x1a')&&typeof _0xcdfa8e[_0x9951('0x1b')]==='undefined';var _0x230130=_0x3cb7f4[_0x9951('0x1c')];var _0x32c4df=_0x5231fa?0x0:_0xcdfa8e[_0x9951('0x1d')];var _0x517a25=_0x5231fa?_0x3cb7f4[_0x9951('0x1c')]:_0xcdfa8e[_0x9951('0x1d')]+_0xcdfa8e[_0x9951('0x1b')];var _0x5ecb52;if(_0x517a25>=_0x230130){_0x517a25=_0x230130;_0x5ecb52=0xc8;}else{_0x5ecb52=0xce;}_0x266983['status'](_0x5ecb52);return _0x266983[_0x9951('0x1e')](_0x9951('0x1f'),_0x32c4df+'-'+_0x517a25+'/'+_0x230130)['json'](_0x3cb7f4);}return null;};}function patchUpdates(_0x5dfb47){return function(_0x7b60de){try{jsonpatch[_0x9951('0x20')](_0x7b60de,_0x5dfb47,!![]);}catch(_0x2180e3){return BPromise[_0x9951('0x21')](_0x2180e3);}return _0x7b60de['save']();};}function saveUpdates(_0x4d32b0,_0x4003e5){return function(_0x4fabcd){if(_0x4fabcd){return _0x4fabcd['update'](_0x4d32b0)['then'](function(_0x1f44ae){return _0x1f44ae;});}return null;};}function removeEntity(_0x3bdd95,_0xc4392a){return function(_0x462788){if(_0x462788){return _0x462788[_0x9951('0x22')]()[_0x9951('0x23')](function(){var _0x53289b=_0x462788['get']({'plain':!![]});var _0x18ab60=_0x9951('0x24');return db[_0x9951('0x25')][_0x9951('0x22')]({'where':{'type':_0x18ab60,'resourceId':_0x53289b['id']}})[_0x9951('0x23')](function(){return _0x462788;});})[_0x9951('0x23')](function(){_0x3bdd95['status'](0xcc)[_0x9951('0x19')]();});}};}function handleEntityNotFound(_0x2243a3,_0x400377){return function(_0x30755b){if(!_0x30755b){_0x2243a3[_0x9951('0x18')](0x194);}return _0x30755b;};}function handleError(_0x1c88bd,_0x433f59){_0x433f59=_0x433f59||0x1f4;return function(_0x5b2aff){logger[_0x9951('0x26')](_0x5b2aff[_0x9951('0x27')]);if(_0x5b2aff[_0x9951('0x28')]){delete _0x5b2aff['name'];}_0x1c88bd[_0x9951('0x29')](_0x433f59)[_0x9951('0x2a')](_0x5b2aff);};}exports[_0x9951('0x2b')]=function(_0x5054ac,_0x102e89){var _0x4c5a39={},_0x335d4a={},_0x3a6f14={'count':0x0,'rows':[]};var _0x5d9b77=_[_0x9951('0x2c')](db[_0x9951('0x2d')]['rawAttributes'],function(_0x13fee1){return{'name':_0x13fee1[_0x9951('0x2e')],'type':_0x13fee1[_0x9951('0x2f')][_0x9951('0x30')]};});_0x335d4a[_0x9951('0x31')]=_['map'](_0x5d9b77,_0x9951('0x28'));_0x335d4a['query']=_['keys'](_0x5054ac[_0x9951('0x32')]);_0x335d4a['filters']=_[_0x9951('0x33')](_0x335d4a[_0x9951('0x31')],_0x335d4a['query']);_0x4c5a39[_0x9951('0x34')]=_[_0x9951('0x33')](_0x335d4a['model'],qs[_0x9951('0x35')](_0x5054ac[_0x9951('0x32')][_0x9951('0x35')]));_0x4c5a39['attributes']=_0x4c5a39[_0x9951('0x34')]['length']?_0x4c5a39[_0x9951('0x34')]:_0x335d4a[_0x9951('0x31')];if(!_0x5054ac[_0x9951('0x32')][_0x9951('0x36')](_0x9951('0x37'))){_0x4c5a39[_0x9951('0x1b')]=qs['limit'](_0x5054ac[_0x9951('0x32')]['limit']);_0x4c5a39[_0x9951('0x1d')]=qs[_0x9951('0x1d')](_0x5054ac[_0x9951('0x32')][_0x9951('0x1d')]);}_0x4c5a39['order']=qs['sort'](_0x5054ac['query'][_0x9951('0x38')]);_0x4c5a39[_0x9951('0x39')]=qs[_0x9951('0x3a')](_[_0x9951('0x3b')](_0x5054ac[_0x9951('0x32')],_0x335d4a[_0x9951('0x3a')]),_0x5d9b77);if(_0x5054ac[_0x9951('0x32')]['filter']){_0x4c5a39[_0x9951('0x39')]=_[_0x9951('0x3c')](_0x4c5a39[_0x9951('0x39')],{'$or':_[_0x9951('0x2c')](_0x5d9b77,function(_0x456727){if(_0x456727['type']!=='VIRTUAL'){var _0x424caa={};_0x424caa[_0x456727[_0x9951('0x28')]]={'$like':'%'+_0x5054ac['query']['filter']+'%'};return _0x424caa;}})});}_0x4c5a39=_[_0x9951('0x3c')]({},_0x4c5a39,_0x5054ac[_0x9951('0x3d')]);var _0xd48001={'where':_0x4c5a39[_0x9951('0x39')]};return db[_0x9951('0x2d')]['count'](_0xd48001)[_0x9951('0x23')](function(_0x235642){_0x3a6f14['count']=_0x235642;if(_0x5054ac[_0x9951('0x32')]['includeAll']){_0x4c5a39['include']=[{'all':!![]}];}return db[_0x9951('0x2d')][_0x9951('0x3e')](_0x4c5a39);})[_0x9951('0x23')](function(_0x51e2fa){_0x3a6f14[_0x9951('0x3f')]=_0x51e2fa;return _0x3a6f14;})['then'](respondWithFilteredResult(_0x102e89,_0x4c5a39))[_0x9951('0x40')](handleError(_0x102e89,null));};exports[_0x9951('0x41')]=function(_0x18b661,_0x3527c0){var _0x4b780e={'raw':!![],'where':{'id':_0x18b661[_0x9951('0x42')]['id']}},_0x4c1a84={};_0x4c1a84[_0x9951('0x31')]=_[_0x9951('0x43')](db[_0x9951('0x2d')][_0x9951('0x44')]);_0x4c1a84['query']=_[_0x9951('0x43')](_0x18b661[_0x9951('0x32')]);_0x4c1a84['filters']=_[_0x9951('0x33')](_0x4c1a84[_0x9951('0x31')],_0x4c1a84[_0x9951('0x32')]);_0x4b780e['attributes']=_['intersection'](_0x4c1a84[_0x9951('0x31')],qs[_0x9951('0x35')](_0x18b661['query']['fields']));_0x4b780e['attributes']=_0x4b780e[_0x9951('0x34')][_0x9951('0x45')]?_0x4b780e[_0x9951('0x34')]:_0x4c1a84[_0x9951('0x31')];if(_0x18b661[_0x9951('0x32')][_0x9951('0x46')]){_0x4b780e['include']=[{'all':!![]}];}_0x4b780e=_['merge']({},_0x4b780e,_0x18b661[_0x9951('0x3d')]);return db[_0x9951('0x2d')][_0x9951('0x47')](_0x4b780e)['then'](handleEntityNotFound(_0x3527c0,null))[_0x9951('0x23')](respondWithResult(_0x3527c0,null))['catch'](handleError(_0x3527c0,null));};exports['create']=function(_0x1eb99b,_0x138d98){return db[_0x9951('0x2d')][_0x9951('0x48')](_0x1eb99b[_0x9951('0x49')],{})[_0x9951('0x23')](function(_0x3e57a9){var _0x473bc5=_0x1eb99b['user'][_0x9951('0x4a')]({'plain':!![]});if(!_0x473bc5)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x473bc5[_0x9951('0x4b')]==='user'){var _0x35f856=_0x3e57a9['get']({'plain':!![]});var _0x413042=_0x9951('0x24');return db[_0x9951('0x4c')][_0x9951('0x47')]({'where':{'name':_0x413042,'userProfileId':_0x473bc5[_0x9951('0x4d')]},'raw':!![]})[_0x9951('0x23')](function(_0x2e8d20){if(_0x2e8d20&&_0x2e8d20[_0x9951('0x4e')]===0x0){return db['UserProfileResource'][_0x9951('0x48')]({'name':_0x35f856['name'],'resourceId':_0x35f856['id'],'type':_0x2e8d20[_0x9951('0x28')],'sectionId':_0x2e8d20['id']},{})[_0x9951('0x23')](function(){return _0x3e57a9;});}else{return _0x3e57a9;}})[_0x9951('0x40')](function(_0x29ed5d){logger['error'](_0x9951('0x4f'),_0x29ed5d);throw _0x29ed5d;});}return _0x3e57a9;})[_0x9951('0x23')](respondWithResult(_0x138d98,0xc9))[_0x9951('0x40')](handleError(_0x138d98,null));};exports[_0x9951('0x50')]=function(_0xf9c26d,_0x471d7d){if(_0xf9c26d[_0x9951('0x49')]['id']){delete _0xf9c26d[_0x9951('0x49')]['id'];}return db[_0x9951('0x2d')][_0x9951('0x47')]({'where':{'id':_0xf9c26d[_0x9951('0x42')]['id']}})[_0x9951('0x23')](handleEntityNotFound(_0x471d7d,null))[_0x9951('0x23')](saveUpdates(_0xf9c26d['body'],null))[_0x9951('0x23')](respondWithResult(_0x471d7d,null))[_0x9951('0x40')](handleError(_0x471d7d,null));};exports[_0x9951('0x22')]=function(_0x205de1,_0x2a00d6){return db[_0x9951('0x2d')][_0x9951('0x47')]({'where':{'id':_0x205de1[_0x9951('0x42')]['id']}})[_0x9951('0x23')](handleEntityNotFound(_0x2a00d6,null))[_0x9951('0x23')](removeEntity(_0x2a00d6,null))['catch'](handleError(_0x2a00d6,null));};exports[_0x9951('0x51')]=function(_0x3556ab,_0x26c7af,_0x418a7e){return db[_0x9951('0x2d')]['find']({'where':{'id':_0x3556ab[_0x9951('0x42')]['id']},'attributes':[_0x9951('0x28'),_0x9951('0x52'),_0x9951('0x53'),'output'],'raw':!![]})[_0x9951('0x23')](handleEntityNotFound(_0x26c7af,null))[_0x9951('0x23')](function(_0x5877af){if(_0x5877af){if(!fs[_0x9951('0x54')](path[_0x9951('0x55')](config[_0x9951('0x56')],'server/files/reports',_0x5877af['savename']))){throw new db[(_0x9951('0x57'))][(_0x9951('0x58'))](_0x9951('0x59'));}if(_0x3556ab[_0x9951('0x32')][_0x9951('0x5a')]){return _0x26c7af[_0x9951('0x18')](0xc8);}return _0x26c7af['download'](path['join'](config[_0x9951('0x56')],_0x9951('0x5b'),_0x5877af[_0x9951('0x53')]),util[_0x9951('0x5c')](_0x9951('0x5d'),_0x5877af[_0x9951('0x52')]||_0x5877af[_0x9951('0x28')],_0x5877af['output'][_0x9951('0x5e')]()));}})[_0x9951('0x40')](handleError(_0x26c7af,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index 8d7548e..d81ed2c 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 _0xf34b=['moment','bluebird','request-promise','../../config/environment','exports','AnalyticExtractedReport','analytics_extracted_reports','util','../../config/logger','api'];(function(_0x583a1f,_0x4fb9da){var _0x45f430=function(_0xc90da){while(--_0xc90da){_0x583a1f['push'](_0x583a1f['shift']());}};_0x45f430(++_0x4fb9da);}(_0xf34b,0x13d));var _0xbf34=function(_0x33d129,_0x3bc274){_0x33d129=_0x33d129-0x0;var _0x54093f=_0xf34b[_0x33d129];return _0x54093f;};'use strict';var _=require('lodash');var util=require(_0xbf34('0x0'));var logger=require(_0xbf34('0x1'))(_0xbf34('0x2'));var moment=require(_0xbf34('0x3'));var BPromise=require(_0xbf34('0x4'));var rp=require(_0xbf34('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xbf34('0x6'));var attributes=require('./analyticExtractedReport.attributes');module[_0xbf34('0x7')]=function(_0x825092,_0x7a570b){return _0x825092['define'](_0xbf34('0x8'),attributes,{'tableName':_0xbf34('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdb2f=['./analyticExtractedReport.attributes','define','analytics_extracted_reports','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x51d6e4,_0x5b48ff){var _0xb104f1=function(_0x4d1bc3){while(--_0x4d1bc3){_0x51d6e4['push'](_0x51d6e4['shift']());}};_0xb104f1(++_0x5b48ff);}(_0xdb2f,0x12f));var _0xfdb2=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xdb2f[_0x6131cd];return _0x47e916;};'use strict';var _=require(_0xfdb2('0x0'));var util=require(_0xfdb2('0x1'));var logger=require(_0xfdb2('0x2'))(_0xfdb2('0x3'));var moment=require(_0xfdb2('0x4'));var BPromise=require(_0xfdb2('0x5'));var rp=require(_0xfdb2('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xfdb2('0x7'));var config=require(_0xfdb2('0x8'));var attributes=require(_0xfdb2('0x9'));module['exports']=function(_0x351713,_0x590a39){return _0x351713[_0xfdb2('0xa')]('AnalyticExtractedReport',attributes,{'tableName':_0xfdb2('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.rpc.js b/server/api/analyticExtractedReport/analyticExtractedReport.rpc.js index a6e2891..f04976f 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 _0xb230=['then','info','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xb230,0x150));var _0x0b23=function(_0xe74d9b,_0x17a86c){_0xe74d9b=_0xe74d9b-0x0;var _0x57c1cc=_0xb230[_0xe74d9b];return _0x57c1cc;};'use strict';var _=require(_0x0b23('0x0'));var util=require(_0x0b23('0x1'));var moment=require(_0x0b23('0x2'));var BPromise=require(_0x0b23('0x3'));var rs=require(_0x0b23('0x4'));var fs=require('fs');var Redis=require(_0x0b23('0x5'));var db=require(_0x0b23('0x6'))['db'];var utils=require(_0x0b23('0x7'));var logger=require(_0x0b23('0x8'))(_0x0b23('0x9'));var config=require('../../config/environment');var jayson=require(_0x0b23('0xa'));var client=jayson[_0x0b23('0xb')][_0x0b23('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x135dd7,_0x2fd92d,_0x2ad939){return new BPromise(function(_0x3a7f46,_0x53e288){return client[_0x0b23('0xd')](_0x135dd7,_0x2ad939)[_0x0b23('0xe')](function(_0x5f3719){logger[_0x0b23('0xf')](_0x0b23('0x10'),_0x2fd92d,_0x0b23('0x11'));logger[_0x0b23('0x12')](_0x0b23('0x13'),_0x2fd92d,'request\x20sent',JSON[_0x0b23('0x14')](_0x5f3719));if(_0x5f3719[_0x0b23('0x15')]){if(_0x5f3719[_0x0b23('0x15')][_0x0b23('0x16')]===0x1f4){logger[_0x0b23('0x15')](_0x0b23('0x10'),_0x2fd92d,_0x5f3719[_0x0b23('0x15')][_0x0b23('0x17')]);return _0x53e288(_0x5f3719[_0x0b23('0x15')][_0x0b23('0x17')]);}logger[_0x0b23('0x15')](_0x0b23('0x10'),_0x2fd92d,_0x5f3719[_0x0b23('0x15')][_0x0b23('0x17')]);return _0x3a7f46(_0x5f3719[_0x0b23('0x15')][_0x0b23('0x17')]);}else{logger['info'](_0x0b23('0x10'),_0x2fd92d,_0x0b23('0x11'));_0x3a7f46(_0x5f3719[_0x0b23('0x18')][_0x0b23('0x17')]);}})['catch'](function(_0x37dd69){logger['error'](_0x0b23('0x10'),_0x2fd92d,_0x37dd69);_0x53e288(_0x37dd69);});});} \ No newline at end of file +var _0x96bb=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','debug','stringify','error','code','AnalyticExtractedReport,\x20%s,\x20%s','message','result','util','moment','bluebird','randomstring','ioredis'];(function(_0x58b6e9,_0x2857c0){var _0x261a4c=function(_0x1ac398){while(--_0x1ac398){_0x58b6e9['push'](_0x58b6e9['shift']());}};_0x261a4c(++_0x2857c0);}(_0x96bb,0x9c));var _0xb96b=function(_0x16c0bd,_0x9676d2){_0x16c0bd=_0x16c0bd-0x0;var _0x48fd60=_0x96bb[_0x16c0bd];return _0x48fd60;};'use strict';var _=require('lodash');var util=require(_0xb96b('0x0'));var moment=require(_0xb96b('0x1'));var BPromise=require(_0xb96b('0x2'));var rs=require(_0xb96b('0x3'));var fs=require('fs');var Redis=require(_0xb96b('0x4'));var db=require(_0xb96b('0x5'))['db'];var utils=require(_0xb96b('0x6'));var logger=require(_0xb96b('0x7'))(_0xb96b('0x8'));var config=require(_0xb96b('0x9'));var jayson=require(_0xb96b('0xa'));var client=jayson[_0xb96b('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5da463,_0x293eb3,_0x543c74){return new BPromise(function(_0x4b142c,_0x154222){return client[_0xb96b('0xc')](_0x5da463,_0x543c74)[_0xb96b('0xd')](function(_0x35c1c2){logger[_0xb96b('0xe')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x293eb3,_0xb96b('0xf'));logger[_0xb96b('0x10')]('AnalyticExtractedReport,\x20%s,\x20%s,\x20%s',_0x293eb3,'request\x20sent',JSON[_0xb96b('0x11')](_0x35c1c2));if(_0x35c1c2[_0xb96b('0x12')]){if(_0x35c1c2['error'][_0xb96b('0x13')]===0x1f4){logger['error'](_0xb96b('0x14'),_0x293eb3,_0x35c1c2['error']['message']);return _0x154222(_0x35c1c2[_0xb96b('0x12')]['message']);}logger[_0xb96b('0x12')](_0xb96b('0x14'),_0x293eb3,_0x35c1c2['error'][_0xb96b('0x15')]);return _0x4b142c(_0x35c1c2[_0xb96b('0x12')][_0xb96b('0x15')]);}else{logger['info'](_0xb96b('0x14'),_0x293eb3,_0xb96b('0xf'));_0x4b142c(_0x35c1c2[_0xb96b('0x16')][_0xb96b('0x15')]);}})['catch'](function(_0x47b842){logger[_0xb96b('0x12')](_0xb96b('0x14'),_0x293eb3,_0x47b842);_0x154222(_0x47b842);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index 52aeff9..8c24e1d 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 _0x0715=['Router','../../components/auth/service','../../components/interaction/service','./analyticExtractedReport.controller','get','isAuthenticated','index','/:id/download','download','post','create','/:id','update','destroy','util','connect-timeout','express'];(function(_0xc74a5e,_0x3170aa){var _0x4bc55b=function(_0xecab7b){while(--_0xecab7b){_0xc74a5e['push'](_0xc74a5e['shift']());}};_0x4bc55b(++_0x3170aa);}(_0x0715,0xa7));var _0x5071=function(_0x417af8,_0x368246){_0x417af8=_0x417af8-0x0;var _0x3f8bf8=_0x0715[_0x417af8];return _0x3f8bf8;};'use strict';var multer=require('multer');var util=require(_0x5071('0x0'));var path=require('path');var timeout=require(_0x5071('0x1'));var express=require(_0x5071('0x2'));var router=express[_0x5071('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x5071('0x4'));var interaction=require(_0x5071('0x5'));var config=require('../../config/environment');var controller=require(_0x5071('0x6'));router[_0x5071('0x7')]('/',auth[_0x5071('0x8')](),controller[_0x5071('0x9')]);router['get']('/:id',auth[_0x5071('0x8')](),controller['show']);router[_0x5071('0x7')](_0x5071('0xa'),auth[_0x5071('0x8')](),controller[_0x5071('0xb')]);router[_0x5071('0xc')]('/',auth[_0x5071('0x8')](),controller[_0x5071('0xd')]);router['put'](_0x5071('0xe'),auth['isAuthenticated'](),controller[_0x5071('0xf')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x5071('0x10')]);module['exports']=router; \ No newline at end of file +var _0xdd79=['delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','index','/:id','/:id/download','isAuthenticated','put','update'];(function(_0x6c0ac,_0x26ec95){var _0x57f34c=function(_0x4d0ac6){while(--_0x4d0ac6){_0x6c0ac['push'](_0x6c0ac['shift']());}};_0x57f34c(++_0x26ec95);}(_0xdd79,0x16b));var _0x9dd7=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xdd79[_0x432682];return _0x463d05;};'use strict';var multer=require('multer');var util=require(_0x9dd7('0x0'));var path=require(_0x9dd7('0x1'));var timeout=require(_0x9dd7('0x2'));var express=require(_0x9dd7('0x3'));var router=express[_0x9dd7('0x4')]();var fs_extra=require(_0x9dd7('0x5'));var auth=require(_0x9dd7('0x6'));var interaction=require(_0x9dd7('0x7'));var config=require('../../config/environment');var controller=require('./analyticExtractedReport.controller');router[_0x9dd7('0x8')]('/',auth['isAuthenticated'](),controller[_0x9dd7('0x9')]);router[_0x9dd7('0x8')](_0x9dd7('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x9dd7('0x8')](_0x9dd7('0xb'),auth[_0x9dd7('0xc')](),controller['download']);router['post']('/',auth[_0x9dd7('0xc')](),controller['create']);router[_0x9dd7('0xd')](_0x9dd7('0xa'),auth['isAuthenticated'](),controller[_0x9dd7('0xe')]);router[_0x9dd7('0xf')](_0x9dd7('0xa'),auth['isAuthenticated'](),controller[_0x9dd7('0x10')]);module[_0x9dd7('0x11')]=router; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.attributes.js b/server/api/analyticFieldReport/analyticFieldReport.attributes.js index c8dc4df..47c897d 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 _0x753d=['exports','TEXT','STRING','BOOLEAN','sequelize'];(function(_0xf83302,_0x17aa7a){var _0x5abd74=function(_0x2b8f43){while(--_0x2b8f43){_0xf83302['push'](_0xf83302['shift']());}};_0x5abd74(++_0x17aa7a);}(_0x753d,0x1e4));var _0xd753=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x753d[_0x122ef9];return _0x42fba0;};'use strict';var Sequelize=require(_0xd753('0x0'));module[_0xd753('0x1')]={'field':{'type':Sequelize[_0xd753('0x2')]},'alias':{'type':Sequelize[_0xd753('0x3')]},'function':{'type':Sequelize[_0xd753('0x3')]},'format':{'type':Sequelize[_0xd753('0x3')]},'groupBy':{'type':Sequelize[_0xd753('0x4')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0xd753('0x3')]},'custom':{'type':Sequelize[_0xd753('0x4')],'defaultValue':![]}}; \ No newline at end of file +var _0x8f1b=['STRING','BOOLEAN','sequelize','exports','TEXT'];(function(_0x577a87,_0x30efe2){var _0x3e2384=function(_0x2f9915){while(--_0x2f9915){_0x577a87['push'](_0x577a87['shift']());}};_0x3e2384(++_0x30efe2);}(_0x8f1b,0x16a));var _0xb8f1=function(_0x87f99b,_0x4c3d05){_0x87f99b=_0x87f99b-0x0;var _0x233df9=_0x8f1b[_0x87f99b];return _0x233df9;};'use strict';var Sequelize=require(_0xb8f1('0x0'));module[_0xb8f1('0x1')]={'field':{'type':Sequelize[_0xb8f1('0x2')]},'alias':{'type':Sequelize['STRING']},'function':{'type':Sequelize[_0xb8f1('0x3')]},'format':{'type':Sequelize[_0xb8f1('0x3')]},'groupBy':{'type':Sequelize[_0xb8f1('0x4')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0xb8f1('0x3')]},'custom':{'type':Sequelize[_0xb8f1('0x4')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.controller.js b/server/api/analyticFieldReport/analyticFieldReport.controller.js index 66319c2..e12c789 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 _0x888b=['merge','where','type','VIRTUAL','includeAll','include','findAll','rows','params','options','find','catch','create','body','destroy','bulkDestroy','ids','addFields','AnalyticCustomReport','transaction','CustomReportId','bulkCreate','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','undefined','count','offset','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','index','map','AnalyticFieldReport','rawAttributes','fieldName','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter'];(function(_0x237bed,_0x2c9315){var _0x325fbf=function(_0x3e20f3){while(--_0x3e20f3){_0x237bed['push'](_0x237bed['shift']());}};_0x325fbf(++_0x2c9315);}(_0x888b,0x112));var _0xb888=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x888b[_0x4565bf];return _0x5610ba;};'use strict';var emlformat=require(_0xb888('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb888('0x1'));var jsonpatch=require(_0xb888('0x2'));var rp=require('request-promise');var moment=require(_0xb888('0x3'));var BPromise=require(_0xb888('0x4'));var Mustache=require(_0xb888('0x5'));var util=require(_0xb888('0x6'));var path=require('path');var sox=require(_0xb888('0x7'));var csv=require(_0xb888('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb888('0x9'));var squel=require(_0xb888('0xa'));var crypto=require('crypto');var jsforce=require(_0xb888('0xb'));var deskjs=require(_0xb888('0xc'));var toCsv=require(_0xb888('0x8'));var querystring=require('querystring');var Papa=require(_0xb888('0xd'));var Redis=require(_0xb888('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xb888('0xf'));var as=require(_0xb888('0x10'));var hardwareService=require(_0xb888('0x11'));var logger=require(_0xb888('0x12'))(_0xb888('0x13'));var utils=require(_0xb888('0x14'));var config=require(_0xb888('0x15'));var licenseUtil=require(_0xb888('0x16'));var db=require(_0xb888('0x17'))['db'];function respondWithStatusCode(_0x19c938,_0x593ce9){_0x593ce9=_0x593ce9||0xcc;return function(_0x2514f2){if(_0x2514f2){return _0x19c938[_0xb888('0x18')](_0x593ce9);}return _0x19c938[_0xb888('0x19')](_0x593ce9)[_0xb888('0x1a')]();};}function respondWithResult(_0x87c46f,_0x2b0d7a){_0x2b0d7a=_0x2b0d7a||0xc8;return function(_0x1d4036){if(_0x1d4036){return _0x87c46f['status'](_0x2b0d7a)[_0xb888('0x1b')](_0x1d4036);}};}function respondWithFilteredResult(_0x52c8d4,_0x48b7a5){return function(_0x591325){if(_0x591325){var _0xe4741c=typeof _0x48b7a5['offset']==='undefined'&&typeof _0x48b7a5[_0xb888('0x1c')]===_0xb888('0x1d');var _0x167ddc=_0x591325[_0xb888('0x1e')];var _0x33bc02=_0xe4741c?0x0:_0x48b7a5['offset'];var _0x4b0882=_0xe4741c?_0x591325[_0xb888('0x1e')]:_0x48b7a5[_0xb888('0x1f')]+_0x48b7a5[_0xb888('0x1c')];var _0x36e616;if(_0x4b0882>=_0x167ddc){_0x4b0882=_0x167ddc;_0x36e616=0xc8;}else{_0x36e616=0xce;}_0x52c8d4[_0xb888('0x19')](_0x36e616);return _0x52c8d4[_0xb888('0x20')](_0xb888('0x21'),_0x33bc02+'-'+_0x4b0882+'/'+_0x167ddc)[_0xb888('0x1b')](_0x591325);}return null;};}function patchUpdates(_0x224ec9){return function(_0x51d263){try{jsonpatch[_0xb888('0x22')](_0x51d263,_0x224ec9,!![]);}catch(_0x52511d){return BPromise[_0xb888('0x23')](_0x52511d);}return _0x51d263[_0xb888('0x24')]();};}function saveUpdates(_0x308829,_0x1b10a1){return function(_0x542512){if(_0x542512){return _0x542512[_0xb888('0x25')](_0x308829)[_0xb888('0x26')](function(_0x4a1ddd){return _0x4a1ddd;});}return null;};}function removeEntity(_0x263e35,_0x19f24f){return function(_0xae41bf){if(_0xae41bf){return _0xae41bf['destroy']()[_0xb888('0x26')](function(){_0x263e35[_0xb888('0x19')](0xcc)[_0xb888('0x1a')]();});}};}function handleEntityNotFound(_0x595b5e,_0x51b591){return function(_0x53ff37){if(!_0x53ff37){_0x595b5e[_0xb888('0x18')](0x194);}return _0x53ff37;};}function handleError(_0x93e96c,_0x3004e3){_0x3004e3=_0x3004e3||0x1f4;return function(_0x3d3f13){logger[_0xb888('0x27')](_0x3d3f13[_0xb888('0x28')]);if(_0x3d3f13[_0xb888('0x29')]){delete _0x3d3f13['name'];}_0x93e96c[_0xb888('0x19')](_0x3004e3)[_0xb888('0x2a')](_0x3d3f13);};}exports[_0xb888('0x2b')]=function(_0x29c958,_0x11e195){var _0x18e2fd={},_0x3d3415={},_0x5375f5={'count':0x0,'rows':[]};var _0x595bd3=_[_0xb888('0x2c')](db[_0xb888('0x2d')][_0xb888('0x2e')],function(_0x4bc3f0){return{'name':_0x4bc3f0[_0xb888('0x2f')],'type':_0x4bc3f0['type']['key']};});_0x3d3415[_0xb888('0x30')]=_[_0xb888('0x2c')](_0x595bd3,_0xb888('0x29'));_0x3d3415[_0xb888('0x31')]=_[_0xb888('0x32')](_0x29c958['query']);_0x3d3415[_0xb888('0x33')]=_['intersection'](_0x3d3415[_0xb888('0x30')],_0x3d3415['query']);_0x18e2fd[_0xb888('0x34')]=_[_0xb888('0x35')](_0x3d3415[_0xb888('0x30')],qs[_0xb888('0x36')](_0x29c958[_0xb888('0x31')][_0xb888('0x36')]));_0x18e2fd[_0xb888('0x34')]=_0x18e2fd[_0xb888('0x34')][_0xb888('0x37')]?_0x18e2fd[_0xb888('0x34')]:_0x3d3415[_0xb888('0x30')];if(!_0x29c958[_0xb888('0x31')][_0xb888('0x38')](_0xb888('0x39'))){_0x18e2fd[_0xb888('0x1c')]=qs[_0xb888('0x1c')](_0x29c958[_0xb888('0x31')][_0xb888('0x1c')]);_0x18e2fd[_0xb888('0x1f')]=qs[_0xb888('0x1f')](_0x29c958['query'][_0xb888('0x1f')]);}_0x18e2fd[_0xb888('0x3a')]=qs[_0xb888('0x3b')](_0x29c958['query']['sort']);_0x18e2fd['where']=qs[_0xb888('0x33')](_[_0xb888('0x3c')](_0x29c958['query'],_0x3d3415[_0xb888('0x33')]),_0x595bd3);if(_0x29c958[_0xb888('0x31')][_0xb888('0x3d')]){_0x18e2fd['where']=_[_0xb888('0x3e')](_0x18e2fd[_0xb888('0x3f')],{'$or':_['map'](_0x595bd3,function(_0x147da1){if(_0x147da1[_0xb888('0x40')]!==_0xb888('0x41')){var _0x262d50={};_0x262d50[_0x147da1[_0xb888('0x29')]]={'$like':'%'+_0x29c958[_0xb888('0x31')][_0xb888('0x3d')]+'%'};return _0x262d50;}})});}_0x18e2fd=_[_0xb888('0x3e')]({},_0x18e2fd,_0x29c958['options']);var _0x434ced={'where':_0x18e2fd[_0xb888('0x3f')]};return db['AnalyticFieldReport'][_0xb888('0x1e')](_0x434ced)[_0xb888('0x26')](function(_0x2aec97){_0x5375f5[_0xb888('0x1e')]=_0x2aec97;if(_0x29c958[_0xb888('0x31')][_0xb888('0x42')]){_0x18e2fd[_0xb888('0x43')]=[{'all':!![]}];}return db[_0xb888('0x2d')][_0xb888('0x44')](_0x18e2fd);})[_0xb888('0x26')](function(_0x2c83dc){_0x5375f5[_0xb888('0x45')]=_0x2c83dc;return _0x5375f5;})['then'](respondWithFilteredResult(_0x11e195,_0x18e2fd))['catch'](handleError(_0x11e195,null));};exports['show']=function(_0x3dab72,_0x48708b){var _0x1c908={'raw':![],'where':{'id':_0x3dab72[_0xb888('0x46')]['id']}},_0x6b31f1={};_0x6b31f1[_0xb888('0x30')]=_[_0xb888('0x32')](db[_0xb888('0x2d')]['rawAttributes']);_0x6b31f1[_0xb888('0x31')]=_['keys'](_0x3dab72['query']);_0x6b31f1[_0xb888('0x33')]=_[_0xb888('0x35')](_0x6b31f1[_0xb888('0x30')],_0x6b31f1[_0xb888('0x31')]);_0x1c908[_0xb888('0x34')]=_[_0xb888('0x35')](_0x6b31f1[_0xb888('0x30')],qs[_0xb888('0x36')](_0x3dab72['query']['fields']));_0x1c908[_0xb888('0x34')]=_0x1c908[_0xb888('0x34')][_0xb888('0x37')]?_0x1c908[_0xb888('0x34')]:_0x6b31f1[_0xb888('0x30')];if(_0x3dab72[_0xb888('0x31')][_0xb888('0x42')]){_0x1c908['include']=[{'all':!![]}];}_0x1c908=_[_0xb888('0x3e')]({},_0x1c908,_0x3dab72[_0xb888('0x47')]);return db[_0xb888('0x2d')][_0xb888('0x48')](_0x1c908)[_0xb888('0x26')](handleEntityNotFound(_0x48708b,null))[_0xb888('0x26')](respondWithResult(_0x48708b,null))[_0xb888('0x49')](handleError(_0x48708b,null));};exports[_0xb888('0x4a')]=function(_0x627f66,_0x35e037){return db[_0xb888('0x2d')][_0xb888('0x4a')](_0x627f66[_0xb888('0x4b')],{})[_0xb888('0x26')](respondWithResult(_0x35e037,0xc9))['catch'](handleError(_0x35e037,null));};exports['bulkCreate']=function(_0x5d374d,_0x487eef){return db['AnalyticFieldReport']['bulkCreate'](_0x5d374d[_0xb888('0x4b')],{'raw':![],'individualHooks':!![]})[_0xb888('0x26')](respondWithResult(_0x487eef,0xc9))[_0xb888('0x49')](handleError(_0x487eef,null));};exports[_0xb888('0x25')]=function(_0x3481f2,_0x12e169){if(_0x3481f2[_0xb888('0x4b')]['id']){delete _0x3481f2[_0xb888('0x4b')]['id'];}return db[_0xb888('0x2d')][_0xb888('0x48')]({'where':{'id':_0x3481f2[_0xb888('0x46')]['id']}})[_0xb888('0x26')](handleEntityNotFound(_0x12e169,null))[_0xb888('0x26')](saveUpdates(_0x3481f2['body'],null))['then'](respondWithResult(_0x12e169,null))['catch'](handleError(_0x12e169,null));};exports[_0xb888('0x4c')]=function(_0x550ebf,_0x5b0231){return db[_0xb888('0x2d')][_0xb888('0x48')]({'where':{'id':_0x550ebf[_0xb888('0x46')]['id']}})[_0xb888('0x26')](handleEntityNotFound(_0x5b0231,null))[_0xb888('0x26')](removeEntity(_0x5b0231,null))['catch'](handleError(_0x5b0231,null));};exports[_0xb888('0x4d')]=function(_0x5d768b,_0x6bb7a3){return db[_0xb888('0x2d')][_0xb888('0x4c')]({'where':{'id':_0x5d768b[_0xb888('0x31')][_0xb888('0x4e')]||[]},'raw':![],'individualHooks':!![]})[_0xb888('0x26')](respondWithResult(_0x6bb7a3,0xcc))[_0xb888('0x49')](handleError(_0x6bb7a3,null));};exports[_0xb888('0x4f')]=function(_0x2d88f1,_0x3c540c,_0x255698){return db[_0xb888('0x50')]['findOne']({'where':{'id':_0x2d88f1[_0xb888('0x46')]['id']}})[_0xb888('0x26')](handleEntityNotFound(_0x3c540c,null))[_0xb888('0x26')](function(_0x34f47b){if(_0x34f47b){return db['sequelize'][_0xb888('0x51')](function(_0x6533a){return db[_0xb888('0x2d')][_0xb888('0x4c')]({'where':{'CustomReportId':_0x2d88f1[_0xb888('0x46')]['id']},'transaction':_0x6533a})[_0xb888('0x26')](function(_0x576bed){var _0x1ec9e4=_[_0xb888('0x2c')](_0x2d88f1['body'],function(_0x39c884){delete _0x39c884['id'];_0x39c884[_0xb888('0x52')]=_0x2d88f1['params']['id'];return _0x39c884;});return db['AnalyticFieldReport'][_0xb888('0x53')](_0x1ec9e4,{'transaction':_0x6533a});});})[_0xb888('0x26')](function(){return db[_0xb888('0x2d')][_0xb888('0x44')]({'where':{'CustomReportId':_0x2d88f1[_0xb888('0x46')]['id']}});});}})['then'](respondWithResult(_0x3c540c,null))['catch'](handleError(_0x3c540c,null));}; \ No newline at end of file +var _0x535e=['AnalyticFieldReport','rawAttributes','fieldName','type','map','query','keys','intersection','attributes','model','length','nolimit','order','sort','pick','filters','where','merge','VIRTUAL','filter','options','then','findAll','catch','params','fields','includeAll','find','create','bulkCreate','body','update','bulkDestroy','ids','addFields','findOne','sequelize','transaction','rimraf','request-promise','bluebird','mustache','sox','to-csv','ejs','fs-extra','squel','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','undefined','limit','count','reject','destroy','sendStatus','stack','name','send','index'];(function(_0x27162c,_0x21cb5d){var _0x39f7fc=function(_0x2ba9e0){while(--_0x2ba9e0){_0x27162c['push'](_0x27162c['shift']());}};_0x39f7fc(++_0x21cb5d);}(_0x535e,0x189));var _0xe535=function(_0x2cdcf9,_0x8a09d1){_0x2cdcf9=_0x2cdcf9-0x0;var _0x39412d=_0x535e[_0x2cdcf9];return _0x39412d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe535('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xe535('0x1'));var moment=require('moment');var BPromise=require(_0xe535('0x2'));var Mustache=require(_0xe535('0x3'));var util=require('util');var path=require('path');var sox=require(_0xe535('0x4'));var csv=require(_0xe535('0x5'));var ejs=require(_0xe535('0x6'));var fs=require('fs');var fs_extra=require(_0xe535('0x7'));var _=require('lodash');var squel=require(_0xe535('0x8'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xe535('0x9'));var toCsv=require(_0xe535('0x5'));var querystring=require(_0xe535('0xa'));var Papa=require('papaparse');var Redis=require(_0xe535('0xb'));var authService=require(_0xe535('0xc'));var qs=require('../../components/parsers/qs');var as=require(_0xe535('0xd'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe535('0xe'))(_0xe535('0xf'));var utils=require(_0xe535('0x10'));var config=require(_0xe535('0x11'));var licenseUtil=require('../../config/license/util');var db=require(_0xe535('0x12'))['db'];function respondWithStatusCode(_0x20cc8e,_0x2579c7){_0x2579c7=_0x2579c7||0xcc;return function(_0x573db0){if(_0x573db0){return _0x20cc8e['sendStatus'](_0x2579c7);}return _0x20cc8e[_0xe535('0x13')](_0x2579c7)[_0xe535('0x14')]();};}function respondWithResult(_0x50047b,_0x4bd6a5){_0x4bd6a5=_0x4bd6a5||0xc8;return function(_0x36c3b8){if(_0x36c3b8){return _0x50047b[_0xe535('0x13')](_0x4bd6a5)[_0xe535('0x15')](_0x36c3b8);}};}function respondWithFilteredResult(_0x2ea235,_0x5a0bca){return function(_0x29453d){if(_0x29453d){var _0x3dc832=typeof _0x5a0bca[_0xe535('0x16')]===_0xe535('0x17')&&typeof _0x5a0bca[_0xe535('0x18')]===_0xe535('0x17');var _0x2723f6=_0x29453d[_0xe535('0x19')];var _0x1886cb=_0x3dc832?0x0:_0x5a0bca['offset'];var _0x54bfd8=_0x3dc832?_0x29453d[_0xe535('0x19')]:_0x5a0bca[_0xe535('0x16')]+_0x5a0bca[_0xe535('0x18')];var _0x23d7d2;if(_0x54bfd8>=_0x2723f6){_0x54bfd8=_0x2723f6;_0x23d7d2=0xc8;}else{_0x23d7d2=0xce;}_0x2ea235[_0xe535('0x13')](_0x23d7d2);return _0x2ea235['set']('Content-Range',_0x1886cb+'-'+_0x54bfd8+'/'+_0x2723f6)[_0xe535('0x15')](_0x29453d);}return null;};}function patchUpdates(_0x3866d0){return function(_0x1bf92b){try{jsonpatch['apply'](_0x1bf92b,_0x3866d0,!![]);}catch(_0x297475){return BPromise[_0xe535('0x1a')](_0x297475);}return _0x1bf92b['save']();};}function saveUpdates(_0x6b6a79,_0x31bbcb){return function(_0x4946d5){if(_0x4946d5){return _0x4946d5['update'](_0x6b6a79)['then'](function(_0xcbffa2){return _0xcbffa2;});}return null;};}function removeEntity(_0x2936b5,_0x53b591){return function(_0x23a351){if(_0x23a351){return _0x23a351[_0xe535('0x1b')]()['then'](function(){_0x2936b5['status'](0xcc)[_0xe535('0x14')]();});}};}function handleEntityNotFound(_0x458876,_0x13fcb4){return function(_0x337565){if(!_0x337565){_0x458876[_0xe535('0x1c')](0x194);}return _0x337565;};}function handleError(_0x2ccc74,_0x206e65){_0x206e65=_0x206e65||0x1f4;return function(_0x232d30){logger['error'](_0x232d30[_0xe535('0x1d')]);if(_0x232d30[_0xe535('0x1e')]){delete _0x232d30[_0xe535('0x1e')];}_0x2ccc74[_0xe535('0x13')](_0x206e65)[_0xe535('0x1f')](_0x232d30);};}exports[_0xe535('0x20')]=function(_0x5b7ec5,_0xf96443){var _0x2415cd={},_0x3d7c86={},_0x7f46dd={'count':0x0,'rows':[]};var _0x34b778=_['map'](db[_0xe535('0x21')][_0xe535('0x22')],function(_0x3a6701){return{'name':_0x3a6701[_0xe535('0x23')],'type':_0x3a6701[_0xe535('0x24')]['key']};});_0x3d7c86['model']=_[_0xe535('0x25')](_0x34b778,'name');_0x3d7c86[_0xe535('0x26')]=_[_0xe535('0x27')](_0x5b7ec5[_0xe535('0x26')]);_0x3d7c86['filters']=_[_0xe535('0x28')](_0x3d7c86['model'],_0x3d7c86['query']);_0x2415cd[_0xe535('0x29')]=_['intersection'](_0x3d7c86[_0xe535('0x2a')],qs['fields'](_0x5b7ec5[_0xe535('0x26')]['fields']));_0x2415cd[_0xe535('0x29')]=_0x2415cd['attributes'][_0xe535('0x2b')]?_0x2415cd[_0xe535('0x29')]:_0x3d7c86[_0xe535('0x2a')];if(!_0x5b7ec5[_0xe535('0x26')]['hasOwnProperty'](_0xe535('0x2c'))){_0x2415cd['limit']=qs[_0xe535('0x18')](_0x5b7ec5[_0xe535('0x26')][_0xe535('0x18')]);_0x2415cd['offset']=qs[_0xe535('0x16')](_0x5b7ec5[_0xe535('0x26')][_0xe535('0x16')]);}_0x2415cd[_0xe535('0x2d')]=qs[_0xe535('0x2e')](_0x5b7ec5['query']['sort']);_0x2415cd['where']=qs['filters'](_[_0xe535('0x2f')](_0x5b7ec5[_0xe535('0x26')],_0x3d7c86[_0xe535('0x30')]),_0x34b778);if(_0x5b7ec5[_0xe535('0x26')]['filter']){_0x2415cd[_0xe535('0x31')]=_[_0xe535('0x32')](_0x2415cd['where'],{'$or':_[_0xe535('0x25')](_0x34b778,function(_0xa6bbe1){if(_0xa6bbe1['type']!==_0xe535('0x33')){var _0x1a0d08={};_0x1a0d08[_0xa6bbe1[_0xe535('0x1e')]]={'$like':'%'+_0x5b7ec5[_0xe535('0x26')][_0xe535('0x34')]+'%'};return _0x1a0d08;}})});}_0x2415cd=_[_0xe535('0x32')]({},_0x2415cd,_0x5b7ec5[_0xe535('0x35')]);var _0x46d861={'where':_0x2415cd['where']};return db[_0xe535('0x21')][_0xe535('0x19')](_0x46d861)[_0xe535('0x36')](function(_0x265b79){_0x7f46dd[_0xe535('0x19')]=_0x265b79;if(_0x5b7ec5[_0xe535('0x26')]['includeAll']){_0x2415cd['include']=[{'all':!![]}];}return db[_0xe535('0x21')][_0xe535('0x37')](_0x2415cd);})[_0xe535('0x36')](function(_0x4bb06e){_0x7f46dd['rows']=_0x4bb06e;return _0x7f46dd;})[_0xe535('0x36')](respondWithFilteredResult(_0xf96443,_0x2415cd))[_0xe535('0x38')](handleError(_0xf96443,null));};exports['show']=function(_0x30e83c,_0x3ee7a8){var _0x3b5aba={'raw':![],'where':{'id':_0x30e83c[_0xe535('0x39')]['id']}},_0x499071={};_0x499071[_0xe535('0x2a')]=_['keys'](db[_0xe535('0x21')][_0xe535('0x22')]);_0x499071[_0xe535('0x26')]=_[_0xe535('0x27')](_0x30e83c['query']);_0x499071['filters']=_[_0xe535('0x28')](_0x499071[_0xe535('0x2a')],_0x499071[_0xe535('0x26')]);_0x3b5aba[_0xe535('0x29')]=_[_0xe535('0x28')](_0x499071[_0xe535('0x2a')],qs[_0xe535('0x3a')](_0x30e83c[_0xe535('0x26')][_0xe535('0x3a')]));_0x3b5aba[_0xe535('0x29')]=_0x3b5aba[_0xe535('0x29')][_0xe535('0x2b')]?_0x3b5aba['attributes']:_0x499071[_0xe535('0x2a')];if(_0x30e83c[_0xe535('0x26')][_0xe535('0x3b')]){_0x3b5aba['include']=[{'all':!![]}];}_0x3b5aba=_[_0xe535('0x32')]({},_0x3b5aba,_0x30e83c[_0xe535('0x35')]);return db['AnalyticFieldReport'][_0xe535('0x3c')](_0x3b5aba)['then'](handleEntityNotFound(_0x3ee7a8,null))[_0xe535('0x36')](respondWithResult(_0x3ee7a8,null))[_0xe535('0x38')](handleError(_0x3ee7a8,null));};exports[_0xe535('0x3d')]=function(_0x4f1e95,_0x234267){return db[_0xe535('0x21')][_0xe535('0x3d')](_0x4f1e95['body'],{})[_0xe535('0x36')](respondWithResult(_0x234267,0xc9))[_0xe535('0x38')](handleError(_0x234267,null));};exports[_0xe535('0x3e')]=function(_0x398522,_0x416560){return db[_0xe535('0x21')][_0xe535('0x3e')](_0x398522[_0xe535('0x3f')],{'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0x416560,0xc9))[_0xe535('0x38')](handleError(_0x416560,null));};exports[_0xe535('0x40')]=function(_0xa02751,_0x237ee5){if(_0xa02751[_0xe535('0x3f')]['id']){delete _0xa02751[_0xe535('0x3f')]['id'];}return db[_0xe535('0x21')][_0xe535('0x3c')]({'where':{'id':_0xa02751['params']['id']}})['then'](handleEntityNotFound(_0x237ee5,null))[_0xe535('0x36')](saveUpdates(_0xa02751[_0xe535('0x3f')],null))[_0xe535('0x36')](respondWithResult(_0x237ee5,null))[_0xe535('0x38')](handleError(_0x237ee5,null));};exports[_0xe535('0x1b')]=function(_0x66e843,_0xdc8cc2){return db['AnalyticFieldReport'][_0xe535('0x3c')]({'where':{'id':_0x66e843[_0xe535('0x39')]['id']}})[_0xe535('0x36')](handleEntityNotFound(_0xdc8cc2,null))['then'](removeEntity(_0xdc8cc2,null))[_0xe535('0x38')](handleError(_0xdc8cc2,null));};exports[_0xe535('0x41')]=function(_0x16c597,_0x1c835b){return db[_0xe535('0x21')][_0xe535('0x1b')]({'where':{'id':_0x16c597[_0xe535('0x26')][_0xe535('0x42')]||[]},'raw':![],'individualHooks':!![]})[_0xe535('0x36')](respondWithResult(_0x1c835b,0xcc))[_0xe535('0x38')](handleError(_0x1c835b,null));};exports[_0xe535('0x43')]=function(_0x16fb66,_0x5d8566,_0xd6d10){return db['AnalyticCustomReport'][_0xe535('0x44')]({'where':{'id':_0x16fb66[_0xe535('0x39')]['id']}})[_0xe535('0x36')](handleEntityNotFound(_0x5d8566,null))['then'](function(_0x39e580){if(_0x39e580){return db[_0xe535('0x45')][_0xe535('0x46')](function(_0x278766){return db['AnalyticFieldReport'][_0xe535('0x1b')]({'where':{'CustomReportId':_0x16fb66[_0xe535('0x39')]['id']},'transaction':_0x278766})[_0xe535('0x36')](function(_0xdd7a7){var _0x41b37a=_['map'](_0x16fb66['body'],function(_0x48adb1){delete _0x48adb1['id'];_0x48adb1['CustomReportId']=_0x16fb66['params']['id'];return _0x48adb1;});return db[_0xe535('0x21')][_0xe535('0x3e')](_0x41b37a,{'transaction':_0x278766});});})[_0xe535('0x36')](function(){return db['AnalyticFieldReport'][_0xe535('0x37')]({'where':{'CustomReportId':_0x16fb66[_0xe535('0x39')]['id']}});});}})[_0xe535('0x36')](respondWithResult(_0x5d8566,null))[_0xe535('0x38')](handleError(_0x5d8566,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index 0bd7715..206e1c7 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 _0xd2b8=['moment','bluebird','rimraf','../../config/environment','exports','define','AnalyticFieldReport','lodash','util','../../config/logger','api'];(function(_0x3f25db,_0x1d3686){var _0x54f29d=function(_0x2963bb){while(--_0x2963bb){_0x3f25db['push'](_0x3f25db['shift']());}};_0x54f29d(++_0x1d3686);}(_0xd2b8,0xa1));var _0x8d2b=function(_0x102470,_0x31195a){_0x102470=_0x102470-0x0;var _0x21fb8b=_0xd2b8[_0x102470];return _0x21fb8b;};'use strict';var _=require(_0x8d2b('0x0'));var util=require(_0x8d2b('0x1'));var logger=require(_0x8d2b('0x2'))(_0x8d2b('0x3'));var moment=require(_0x8d2b('0x4'));var BPromise=require(_0x8d2b('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x8d2b('0x6'));var config=require(_0x8d2b('0x7'));var attributes=require('./analyticFieldReport.attributes');module[_0x8d2b('0x8')]=function(_0xdfba21,_0x3f84d5){return _0xdfba21[_0x8d2b('0x9')](_0x8d2b('0xa'),attributes,{'tableName':'analytics_report_fields','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc247=['path','rimraf','../../config/environment','./analyticFieldReport.attributes','exports','define','AnalyticFieldReport','analytics_report_fields','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x4408b8,_0x41014b){var _0x4671df=function(_0x420a4f){while(--_0x420a4f){_0x4408b8['push'](_0x4408b8['shift']());}};_0x4671df(++_0x41014b);}(_0xc247,0x1ac));var _0x7c24=function(_0x44216d,_0x4938a7){_0x44216d=_0x44216d-0x0;var _0xeca523=_0xc247[_0x44216d];return _0xeca523;};'use strict';var _=require('lodash');var util=require(_0x7c24('0x0'));var logger=require(_0x7c24('0x1'))(_0x7c24('0x2'));var moment=require(_0x7c24('0x3'));var BPromise=require(_0x7c24('0x4'));var rp=require(_0x7c24('0x5'));var fs=require('fs');var path=require(_0x7c24('0x6'));var rimraf=require(_0x7c24('0x7'));var config=require(_0x7c24('0x8'));var attributes=require(_0x7c24('0x9'));module[_0x7c24('0xa')]=function(_0xbb4844,_0x7954c8){return _0xbb4844[_0x7c24('0xb')](_0x7c24('0xc'),attributes,{'tableName':_0x7c24('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.rpc.js b/server/api/analyticFieldReport/analyticFieldReport.rpc.js index c441b91..629aaef 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 _0xd839=['bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','then','info','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','moment'];(function(_0x30b5f2,_0x2b8439){var _0x1509a4=function(_0x2ccee7){while(--_0x2ccee7){_0x30b5f2['push'](_0x30b5f2['shift']());}};_0x1509a4(++_0x2b8439);}(_0xd839,0x105));var _0x9d83=function(_0x2e0803,_0x20b12c){_0x2e0803=_0x2e0803-0x0;var _0x3d8c51=_0xd839[_0x2e0803];return _0x3d8c51;};'use strict';var _=require(_0x9d83('0x0'));var util=require(_0x9d83('0x1'));var moment=require(_0x9d83('0x2'));var BPromise=require(_0x9d83('0x3'));var rs=require(_0x9d83('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9d83('0x5'))['db'];var utils=require(_0x9d83('0x6'));var logger=require(_0x9d83('0x7'))('rpc');var config=require(_0x9d83('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x9d83('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x430203,_0x53f9ac,_0x53d02a){return new BPromise(function(_0x353d2b,_0x4d7bf7){return client[_0x9d83('0xa')](_0x430203,_0x53d02a)[_0x9d83('0xb')](function(_0xf043d0){logger[_0x9d83('0xc')](_0x9d83('0xd'),_0x53f9ac,_0x9d83('0xe'));logger[_0x9d83('0xf')]('AnalyticFieldReport,\x20%s,\x20%s,\x20%s',_0x53f9ac,'request\x20sent',JSON[_0x9d83('0x10')](_0xf043d0));if(_0xf043d0[_0x9d83('0x11')]){if(_0xf043d0[_0x9d83('0x11')][_0x9d83('0x12')]===0x1f4){logger[_0x9d83('0x11')](_0x9d83('0xd'),_0x53f9ac,_0xf043d0['error'][_0x9d83('0x13')]);return _0x4d7bf7(_0xf043d0[_0x9d83('0x11')]['message']);}logger[_0x9d83('0x11')]('AnalyticFieldReport,\x20%s,\x20%s',_0x53f9ac,_0xf043d0[_0x9d83('0x11')][_0x9d83('0x13')]);return _0x353d2b(_0xf043d0['error']['message']);}else{logger[_0x9d83('0xc')](_0x9d83('0xd'),_0x53f9ac,_0x9d83('0xe'));_0x353d2b(_0xf043d0[_0x9d83('0x14')][_0x9d83('0x13')]);}})[_0x9d83('0x15')](function(_0x2ef226){logger[_0x9d83('0x11')](_0x9d83('0xd'),_0x53f9ac,_0x2ef226);_0x4d7bf7(_0x2ef226);});});} \ No newline at end of file +var _0xa0e0=['../../config/environment','jayson/promise','client','http','then','info','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x434a78,_0x4b1332){var _0x431d6e=function(_0xa80eac){while(--_0xa80eac){_0x434a78['push'](_0x434a78['shift']());}};_0x431d6e(++_0x4b1332);}(_0xa0e0,0x1af));var _0x0a0e=function(_0x47e4ba,_0x1e7596){_0x47e4ba=_0x47e4ba-0x0;var _0x51b33a=_0xa0e0[_0x47e4ba];return _0x51b33a;};'use strict';var _=require(_0x0a0e('0x0'));var util=require(_0x0a0e('0x1'));var moment=require(_0x0a0e('0x2'));var BPromise=require('bluebird');var rs=require(_0x0a0e('0x3'));var fs=require('fs');var Redis=require(_0x0a0e('0x4'));var db=require(_0x0a0e('0x5'))['db'];var utils=require(_0x0a0e('0x6'));var logger=require(_0x0a0e('0x7'))(_0x0a0e('0x8'));var config=require(_0x0a0e('0x9'));var jayson=require(_0x0a0e('0xa'));var client=jayson[_0x0a0e('0xb')][_0x0a0e('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x8ef100,_0x3f6e6c,_0x217936){return new BPromise(function(_0x5f4d0e,_0x5f531c){return client['request'](_0x8ef100,_0x217936)[_0x0a0e('0xd')](function(_0x485b4c){logger[_0x0a0e('0xe')](_0x0a0e('0xf'),_0x3f6e6c,_0x0a0e('0x10'));logger['debug']('AnalyticFieldReport,\x20%s,\x20%s,\x20%s',_0x3f6e6c,'request\x20sent',JSON[_0x0a0e('0x11')](_0x485b4c));if(_0x485b4c[_0x0a0e('0x12')]){if(_0x485b4c[_0x0a0e('0x12')]['code']===0x1f4){logger[_0x0a0e('0x12')](_0x0a0e('0xf'),_0x3f6e6c,_0x485b4c[_0x0a0e('0x12')][_0x0a0e('0x13')]);return _0x5f531c(_0x485b4c[_0x0a0e('0x12')][_0x0a0e('0x13')]);}logger['error'](_0x0a0e('0xf'),_0x3f6e6c,_0x485b4c[_0x0a0e('0x12')][_0x0a0e('0x13')]);return _0x5f4d0e(_0x485b4c[_0x0a0e('0x12')][_0x0a0e('0x13')]);}else{logger[_0x0a0e('0xe')](_0x0a0e('0xf'),_0x3f6e6c,_0x0a0e('0x10'));_0x5f4d0e(_0x485b4c[_0x0a0e('0x14')][_0x0a0e('0x13')]);}})[_0x0a0e('0x15')](function(_0x331ff7){logger[_0x0a0e('0x12')](_0x0a0e('0xf'),_0x3f6e6c,_0x331ff7);_0x5f531c(_0x331ff7);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index ca4791b..74c7d58 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(_0x457b1f,_0x13d5f6){var _0x2a782a=function(_0x28581a){while(--_0x28581a){_0x457b1f['push'](_0x457b1f['shift']());}};_0x2a782a(++_0x13d5f6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4e1d03,_0x786f3a){_0x4e1d03=_0x4e1d03-0x0;var _0x362d4b=_0xa9e0[_0x4e1d03];return _0x362d4b;};'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(_0x3f4bef,_0x359a87){var _0x1989b7=function(_0xe0ffca){while(--_0xe0ffca){_0x3f4bef['push'](_0x3f4bef['shift']());}};_0x1989b7(++_0x359a87);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1c546c,_0x5c57cb){_0x1c546c=_0x1c546c-0x0;var _0x2cc384=_0xa9e0[_0x1c546c];return _0x2cc384;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0xb')]('/',auth['isAuthenticated'](),controller['create']);router[_0x0a9e('0xb')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xb')](_0x0a9e('0xf'),auth['isAuthenticated'](),controller['addFields']);router['put']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router['delete'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x14')]);module[_0x0a9e('0x15')]=router; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.attributes.js b/server/api/analyticMetric/analyticMetric.attributes.js index 94820a2..ca251f5 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 _0xbf5c=['sequelize','exports','STRING','TEXT'];(function(_0x283b17,_0x53606e){var _0x459e07=function(_0x11884d){while(--_0x11884d){_0x283b17['push'](_0x283b17['shift']());}};_0x459e07(++_0x53606e);}(_0xbf5c,0xb8));var _0xcbf5=function(_0x238a7a,_0x5807fe){_0x238a7a=_0x238a7a-0x0;var _0x5a1038=_0xbf5c[_0x238a7a];return _0x5a1038;};'use strict';var Sequelize=require(_0xcbf5('0x0'));module[_0xcbf5('0x1')]={'name':{'type':Sequelize[_0xcbf5('0x2')],'allowNull':![],'unique':'name'},'table':{'type':Sequelize[_0xcbf5('0x2')]},'metric':{'type':Sequelize[_0xcbf5('0x3')]},'description':{'type':Sequelize[_0xcbf5('0x2')]}}; \ No newline at end of file +var _0xd110=['sequelize','exports','STRING','TEXT'];(function(_0x307547,_0x1a12bb){var _0x35bee3=function(_0x4d0499){while(--_0x4d0499){_0x307547['push'](_0x307547['shift']());}};_0x35bee3(++_0x1a12bb);}(_0xd110,0x1e8));var _0x0d11=function(_0x11163c,_0xa1514e){_0x11163c=_0x11163c-0x0;var _0x26b991=_0xd110[_0x11163c];return _0x26b991;};'use strict';var Sequelize=require(_0x0d11('0x0'));module[_0x0d11('0x1')]={'name':{'type':Sequelize[_0x0d11('0x2')],'allowNull':![],'unique':'name'},'table':{'type':Sequelize[_0x0d11('0x2')]},'metric':{'type':Sequelize[_0x0d11('0x3')]},'description':{'type':Sequelize[_0x0d11('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.controller.js b/server/api/analyticMetric/analyticMetric.controller.js index 7fc87f8..877cea9 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 _0xe14b=['papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','limit','count','offset','set','json','apply','save','update','then','get','Metrics','UserProfileResource','destroy','error','stack','name','send','index','map','AnalyticMetric','rawAttributes','fieldName','type','model','query','filters','attributes','intersection','fields','order','sort','pick','filter','where','merge','VIRTUAL','options','include','findAll','rows','show','keys','length','includeAll','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','params','eml-format','rimraf','request-promise','moment','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring'];(function(_0x4ab28f,_0x9619a1){var _0x452c9b=function(_0x570af4){while(--_0x570af4){_0x4ab28f['push'](_0x4ab28f['shift']());}};_0x452c9b(++_0x9619a1);}(_0xe14b,0x93));var _0xbe14=function(_0x36393d,_0x38d9e8){_0x36393d=_0x36393d-0x0;var _0x1fa70a=_0xe14b[_0x36393d];return _0x1fa70a;};'use strict';var emlformat=require(_0xbe14('0x0'));var rimraf=require(_0xbe14('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xbe14('0x2'));var moment=require(_0xbe14('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xbe14('0x4'));var util=require('util');var path=require('path');var sox=require(_0xbe14('0x5'));var csv=require(_0xbe14('0x6'));var ejs=require(_0xbe14('0x7'));var fs=require('fs');var fs_extra=require(_0xbe14('0x8'));var _=require(_0xbe14('0x9'));var squel=require(_0xbe14('0xa'));var crypto=require(_0xbe14('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xbe14('0xc'));var Papa=require(_0xbe14('0xd'));var Redis=require(_0xbe14('0xe'));var authService=require(_0xbe14('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbe14('0x10'));var logger=require(_0xbe14('0x11'))('api');var utils=require(_0xbe14('0x12'));var config=require(_0xbe14('0x13'));var licenseUtil=require(_0xbe14('0x14'));var db=require(_0xbe14('0x15'))['db'];function respondWithStatusCode(_0x27792f,_0x3b898d){_0x3b898d=_0x3b898d||0xcc;return function(_0x23a730){if(_0x23a730){return _0x27792f[_0xbe14('0x16')](_0x3b898d);}return _0x27792f[_0xbe14('0x17')](_0x3b898d)[_0xbe14('0x18')]();};}function respondWithResult(_0x1e4826,_0x33fd54){_0x33fd54=_0x33fd54||0xc8;return function(_0x813399){if(_0x813399){return _0x1e4826['status'](_0x33fd54)['json'](_0x813399);}};}function respondWithFilteredResult(_0x3f58f5,_0x3dc4a9){return function(_0xf4ac9){if(_0xf4ac9){var _0x37ce4e=typeof _0x3dc4a9['offset']===_0xbe14('0x19')&&typeof _0x3dc4a9[_0xbe14('0x1a')]===_0xbe14('0x19');var _0x123ede=_0xf4ac9[_0xbe14('0x1b')];var _0x29ab73=_0x37ce4e?0x0:_0x3dc4a9[_0xbe14('0x1c')];var _0x5ea1f8=_0x37ce4e?_0xf4ac9[_0xbe14('0x1b')]:_0x3dc4a9[_0xbe14('0x1c')]+_0x3dc4a9[_0xbe14('0x1a')];var _0x433459;if(_0x5ea1f8>=_0x123ede){_0x5ea1f8=_0x123ede;_0x433459=0xc8;}else{_0x433459=0xce;}_0x3f58f5[_0xbe14('0x17')](_0x433459);return _0x3f58f5[_0xbe14('0x1d')]('Content-Range',_0x29ab73+'-'+_0x5ea1f8+'/'+_0x123ede)[_0xbe14('0x1e')](_0xf4ac9);}return null;};}function patchUpdates(_0x4a1bbd){return function(_0x417c8d){try{jsonpatch[_0xbe14('0x1f')](_0x417c8d,_0x4a1bbd,!![]);}catch(_0x188ec4){return BPromise['reject'](_0x188ec4);}return _0x417c8d[_0xbe14('0x20')]();};}function saveUpdates(_0x56d845,_0x3c1c85){return function(_0x56e80c){if(_0x56e80c){return _0x56e80c[_0xbe14('0x21')](_0x56d845)['then'](function(_0x274018){return _0x274018;});}return null;};}function removeEntity(_0x3d3608,_0x505dbd){return function(_0x2da350){if(_0x2da350){return _0x2da350['destroy']()[_0xbe14('0x22')](function(){var _0x4851f8=_0x2da350[_0xbe14('0x23')]({'plain':!![]});var _0x5fa043=_0xbe14('0x24');return db[_0xbe14('0x25')][_0xbe14('0x26')]({'where':{'type':_0x5fa043,'resourceId':_0x4851f8['id']}})[_0xbe14('0x22')](function(){return _0x2da350;});})['then'](function(){_0x3d3608[_0xbe14('0x17')](0xcc)[_0xbe14('0x18')]();});}};}function handleEntityNotFound(_0x391556,_0x169369){return function(_0x5dd475){if(!_0x5dd475){_0x391556[_0xbe14('0x16')](0x194);}return _0x5dd475;};}function handleError(_0x29fc64,_0x59bf34){_0x59bf34=_0x59bf34||0x1f4;return function(_0x3c3613){logger[_0xbe14('0x27')](_0x3c3613[_0xbe14('0x28')]);if(_0x3c3613[_0xbe14('0x29')]){delete _0x3c3613[_0xbe14('0x29')];}_0x29fc64[_0xbe14('0x17')](_0x59bf34)[_0xbe14('0x2a')](_0x3c3613);};}exports[_0xbe14('0x2b')]=function(_0x4168c8,_0x16a159){var _0x40538f={},_0x3bf43c={},_0x39dc0a={'count':0x0,'rows':[]};var _0x10ae36=_[_0xbe14('0x2c')](db[_0xbe14('0x2d')][_0xbe14('0x2e')],function(_0x2ff48e){return{'name':_0x2ff48e[_0xbe14('0x2f')],'type':_0x2ff48e[_0xbe14('0x30')]['key']};});_0x3bf43c[_0xbe14('0x31')]=_['map'](_0x10ae36,'name');_0x3bf43c[_0xbe14('0x32')]=_['keys'](_0x4168c8[_0xbe14('0x32')]);_0x3bf43c[_0xbe14('0x33')]=_['intersection'](_0x3bf43c['model'],_0x3bf43c['query']);_0x40538f[_0xbe14('0x34')]=_[_0xbe14('0x35')](_0x3bf43c['model'],qs[_0xbe14('0x36')](_0x4168c8[_0xbe14('0x32')][_0xbe14('0x36')]));_0x40538f[_0xbe14('0x34')]=_0x40538f[_0xbe14('0x34')]['length']?_0x40538f['attributes']:_0x3bf43c[_0xbe14('0x31')];if(!_0x4168c8['query']['hasOwnProperty']('nolimit')){_0x40538f[_0xbe14('0x1a')]=qs[_0xbe14('0x1a')](_0x4168c8[_0xbe14('0x32')][_0xbe14('0x1a')]);_0x40538f[_0xbe14('0x1c')]=qs[_0xbe14('0x1c')](_0x4168c8[_0xbe14('0x32')][_0xbe14('0x1c')]);}_0x40538f[_0xbe14('0x37')]=qs[_0xbe14('0x38')](_0x4168c8[_0xbe14('0x32')][_0xbe14('0x38')]);_0x40538f['where']=qs['filters'](_[_0xbe14('0x39')](_0x4168c8[_0xbe14('0x32')],_0x3bf43c[_0xbe14('0x33')]),_0x10ae36);if(_0x4168c8['query'][_0xbe14('0x3a')]){_0x40538f[_0xbe14('0x3b')]=_[_0xbe14('0x3c')](_0x40538f[_0xbe14('0x3b')],{'$or':_[_0xbe14('0x2c')](_0x10ae36,function(_0x25ee1f){if(_0x25ee1f[_0xbe14('0x30')]!==_0xbe14('0x3d')){var _0x1b2608={};_0x1b2608[_0x25ee1f['name']]={'$like':'%'+_0x4168c8[_0xbe14('0x32')][_0xbe14('0x3a')]+'%'};return _0x1b2608;}})});}_0x40538f=_[_0xbe14('0x3c')]({},_0x40538f,_0x4168c8[_0xbe14('0x3e')]);var _0x3287b9={'where':_0x40538f[_0xbe14('0x3b')]};return db['AnalyticMetric'][_0xbe14('0x1b')](_0x3287b9)[_0xbe14('0x22')](function(_0x1220c9){_0x39dc0a[_0xbe14('0x1b')]=_0x1220c9;if(_0x4168c8['query']['includeAll']){_0x40538f[_0xbe14('0x3f')]=[{'all':!![]}];}return db[_0xbe14('0x2d')][_0xbe14('0x40')](_0x40538f);})['then'](function(_0x5d5318){_0x39dc0a[_0xbe14('0x41')]=_0x5d5318;return _0x39dc0a;})['then'](respondWithFilteredResult(_0x16a159,_0x40538f))['catch'](handleError(_0x16a159,null));};exports[_0xbe14('0x42')]=function(_0x1f0355,_0x8216c3){var _0x5051e4={'raw':!![],'where':{'id':_0x1f0355['params']['id']}},_0x558525={};_0x558525[_0xbe14('0x31')]=_[_0xbe14('0x43')](db[_0xbe14('0x2d')]['rawAttributes']);_0x558525[_0xbe14('0x32')]=_[_0xbe14('0x43')](_0x1f0355[_0xbe14('0x32')]);_0x558525[_0xbe14('0x33')]=_['intersection'](_0x558525['model'],_0x558525[_0xbe14('0x32')]);_0x5051e4[_0xbe14('0x34')]=_[_0xbe14('0x35')](_0x558525[_0xbe14('0x31')],qs[_0xbe14('0x36')](_0x1f0355['query']['fields']));_0x5051e4[_0xbe14('0x34')]=_0x5051e4[_0xbe14('0x34')][_0xbe14('0x44')]?_0x5051e4[_0xbe14('0x34')]:_0x558525['model'];if(_0x1f0355[_0xbe14('0x32')][_0xbe14('0x45')]){_0x5051e4['include']=[{'all':!![]}];}_0x5051e4=_[_0xbe14('0x3c')]({},_0x5051e4,_0x1f0355[_0xbe14('0x3e')]);return db[_0xbe14('0x2d')][_0xbe14('0x46')](_0x5051e4)['then'](handleEntityNotFound(_0x8216c3,null))['then'](respondWithResult(_0x8216c3,null))[_0xbe14('0x47')](handleError(_0x8216c3,null));};exports[_0xbe14('0x48')]=function(_0x4a1a37,_0x5acf90){return db[_0xbe14('0x2d')][_0xbe14('0x48')](_0x4a1a37[_0xbe14('0x49')],{})[_0xbe14('0x22')](function(_0xdbc6e1){var _0xd04fd5=_0x4a1a37[_0xbe14('0x4a')]['get']({'plain':!![]});if(!_0xd04fd5)throw new Error(_0xbe14('0x4b'));if(_0xd04fd5[_0xbe14('0x4c')]===_0xbe14('0x4a')){var _0x22b1f8=_0xdbc6e1[_0xbe14('0x23')]({'plain':!![]});var _0x494c32=_0xbe14('0x24');return db[_0xbe14('0x4d')][_0xbe14('0x46')]({'where':{'name':_0x494c32,'userProfileId':_0xd04fd5[_0xbe14('0x4e')]},'raw':!![]})[_0xbe14('0x22')](function(_0x2dbeb1){if(_0x2dbeb1&&_0x2dbeb1['autoAssociation']===0x0){return db['UserProfileResource'][_0xbe14('0x48')]({'name':_0x22b1f8[_0xbe14('0x29')],'resourceId':_0x22b1f8['id'],'type':_0x2dbeb1[_0xbe14('0x29')],'sectionId':_0x2dbeb1['id']},{})['then'](function(){return _0xdbc6e1;});}else{return _0xdbc6e1;}})['catch'](function(_0x44fe0d){logger[_0xbe14('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x44fe0d);throw _0x44fe0d;});}return _0xdbc6e1;})[_0xbe14('0x22')](respondWithResult(_0x5acf90,0xc9))[_0xbe14('0x47')](handleError(_0x5acf90,null));};exports['update']=function(_0x28f995,_0x4a40d2){if(_0x28f995[_0xbe14('0x49')]['id']){delete _0x28f995[_0xbe14('0x49')]['id'];}return db[_0xbe14('0x2d')]['find']({'where':{'id':_0x28f995[_0xbe14('0x4f')]['id']}})[_0xbe14('0x22')](handleEntityNotFound(_0x4a40d2,null))['then'](saveUpdates(_0x28f995[_0xbe14('0x49')],null))[_0xbe14('0x22')](respondWithResult(_0x4a40d2,null))[_0xbe14('0x47')](handleError(_0x4a40d2,null));};exports[_0xbe14('0x26')]=function(_0x49322f,_0x4f06a3){return db[_0xbe14('0x2d')][_0xbe14('0x46')]({'where':{'id':_0x49322f[_0xbe14('0x4f')]['id']}})[_0xbe14('0x22')](handleEntityNotFound(_0x4f06a3,null))[_0xbe14('0x22')](removeEntity(_0x4f06a3,null))[_0xbe14('0x47')](handleError(_0x4f06a3,null));}; \ No newline at end of file +var _0xe5b3=['undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','Metrics','UserProfileResource','destroy','error','stack','name','send','index','map','AnalyticMetric','rawAttributes','type','keys','query','filters','intersection','model','attributes','fields','length','nolimit','sort','where','pick','VIRTUAL','filter','merge','options','includeAll','include','findAll','params','find','catch','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json'];(function(_0x59517f,_0x5a7789){var _0x10f732=function(_0x125cb6){while(--_0x125cb6){_0x59517f['push'](_0x59517f['shift']());}};_0x10f732(++_0x5a7789);}(_0xe5b3,0x133));var _0x3e5b=function(_0x4af356,_0x298d74){_0x4af356=_0x4af356-0x0;var _0x40566=_0xe5b3[_0x4af356];return _0x40566;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3e5b('0x0'));var zipdir=require(_0x3e5b('0x1'));var jsonpatch=require(_0x3e5b('0x2'));var rp=require(_0x3e5b('0x3'));var moment=require(_0x3e5b('0x4'));var BPromise=require(_0x3e5b('0x5'));var Mustache=require(_0x3e5b('0x6'));var util=require(_0x3e5b('0x7'));var path=require(_0x3e5b('0x8'));var sox=require(_0x3e5b('0x9'));var csv=require(_0x3e5b('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3e5b('0xb'));var _=require(_0x3e5b('0xc'));var squel=require('squel');var crypto=require(_0x3e5b('0xd'));var jsforce=require(_0x3e5b('0xe'));var deskjs=require(_0x3e5b('0xf'));var toCsv=require(_0x3e5b('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x3e5b('0x10'));var authService=require(_0x3e5b('0x11'));var qs=require(_0x3e5b('0x12'));var as=require(_0x3e5b('0x13'));var hardwareService=require(_0x3e5b('0x14'));var logger=require('../../config/logger')(_0x3e5b('0x15'));var utils=require('../../config/utils');var config=require(_0x3e5b('0x16'));var licenseUtil=require(_0x3e5b('0x17'));var db=require(_0x3e5b('0x18'))['db'];function respondWithStatusCode(_0x374068,_0x20b97b){_0x20b97b=_0x20b97b||0xcc;return function(_0x3c4eb1){if(_0x3c4eb1){return _0x374068[_0x3e5b('0x19')](_0x20b97b);}return _0x374068['status'](_0x20b97b)[_0x3e5b('0x1a')]();};}function respondWithResult(_0x5f2f9c,_0x51a188){_0x51a188=_0x51a188||0xc8;return function(_0x4d71a3){if(_0x4d71a3){return _0x5f2f9c[_0x3e5b('0x1b')](_0x51a188)[_0x3e5b('0x1c')](_0x4d71a3);}};}function respondWithFilteredResult(_0x17aaa3,_0x4fb471){return function(_0x1f81a7){if(_0x1f81a7){var _0x59ddc0=typeof _0x4fb471['offset']===_0x3e5b('0x1d')&&typeof _0x4fb471[_0x3e5b('0x1e')]==='undefined';var _0x3d58a4=_0x1f81a7[_0x3e5b('0x1f')];var _0x555002=_0x59ddc0?0x0:_0x4fb471[_0x3e5b('0x20')];var _0x3365dd=_0x59ddc0?_0x1f81a7['count']:_0x4fb471['offset']+_0x4fb471[_0x3e5b('0x1e')];var _0x20806a;if(_0x3365dd>=_0x3d58a4){_0x3365dd=_0x3d58a4;_0x20806a=0xc8;}else{_0x20806a=0xce;}_0x17aaa3[_0x3e5b('0x1b')](_0x20806a);return _0x17aaa3[_0x3e5b('0x21')](_0x3e5b('0x22'),_0x555002+'-'+_0x3365dd+'/'+_0x3d58a4)[_0x3e5b('0x1c')](_0x1f81a7);}return null;};}function patchUpdates(_0x447d36){return function(_0x21fc32){try{jsonpatch[_0x3e5b('0x23')](_0x21fc32,_0x447d36,!![]);}catch(_0x3d95f3){return BPromise[_0x3e5b('0x24')](_0x3d95f3);}return _0x21fc32[_0x3e5b('0x25')]();};}function saveUpdates(_0x2d77cc,_0x402873){return function(_0x5b46d4){if(_0x5b46d4){return _0x5b46d4[_0x3e5b('0x26')](_0x2d77cc)[_0x3e5b('0x27')](function(_0x2146d4){return _0x2146d4;});}return null;};}function removeEntity(_0x150674,_0x50039b){return function(_0x1eb80f){if(_0x1eb80f){return _0x1eb80f['destroy']()[_0x3e5b('0x27')](function(){var _0x36d960=_0x1eb80f['get']({'plain':!![]});var _0x41b684=_0x3e5b('0x28');return db[_0x3e5b('0x29')][_0x3e5b('0x2a')]({'where':{'type':_0x41b684,'resourceId':_0x36d960['id']}})[_0x3e5b('0x27')](function(){return _0x1eb80f;});})[_0x3e5b('0x27')](function(){_0x150674[_0x3e5b('0x1b')](0xcc)[_0x3e5b('0x1a')]();});}};}function handleEntityNotFound(_0x4c4b89,_0x1c7278){return function(_0x505f40){if(!_0x505f40){_0x4c4b89[_0x3e5b('0x19')](0x194);}return _0x505f40;};}function handleError(_0x4fd64b,_0x101653){_0x101653=_0x101653||0x1f4;return function(_0x1f6473){logger[_0x3e5b('0x2b')](_0x1f6473[_0x3e5b('0x2c')]);if(_0x1f6473[_0x3e5b('0x2d')]){delete _0x1f6473[_0x3e5b('0x2d')];}_0x4fd64b[_0x3e5b('0x1b')](_0x101653)[_0x3e5b('0x2e')](_0x1f6473);};}exports[_0x3e5b('0x2f')]=function(_0x112dc0,_0x1e1565){var _0x489221={},_0x21bc10={},_0x1882aa={'count':0x0,'rows':[]};var _0xa8760b=_[_0x3e5b('0x30')](db[_0x3e5b('0x31')][_0x3e5b('0x32')],function(_0x345927){return{'name':_0x345927['fieldName'],'type':_0x345927[_0x3e5b('0x33')]['key']};});_0x21bc10['model']=_[_0x3e5b('0x30')](_0xa8760b,_0x3e5b('0x2d'));_0x21bc10['query']=_[_0x3e5b('0x34')](_0x112dc0[_0x3e5b('0x35')]);_0x21bc10[_0x3e5b('0x36')]=_[_0x3e5b('0x37')](_0x21bc10[_0x3e5b('0x38')],_0x21bc10[_0x3e5b('0x35')]);_0x489221[_0x3e5b('0x39')]=_[_0x3e5b('0x37')](_0x21bc10[_0x3e5b('0x38')],qs[_0x3e5b('0x3a')](_0x112dc0[_0x3e5b('0x35')][_0x3e5b('0x3a')]));_0x489221['attributes']=_0x489221[_0x3e5b('0x39')][_0x3e5b('0x3b')]?_0x489221['attributes']:_0x21bc10['model'];if(!_0x112dc0[_0x3e5b('0x35')]['hasOwnProperty'](_0x3e5b('0x3c'))){_0x489221[_0x3e5b('0x1e')]=qs[_0x3e5b('0x1e')](_0x112dc0[_0x3e5b('0x35')]['limit']);_0x489221[_0x3e5b('0x20')]=qs['offset'](_0x112dc0[_0x3e5b('0x35')]['offset']);}_0x489221['order']=qs['sort'](_0x112dc0[_0x3e5b('0x35')][_0x3e5b('0x3d')]);_0x489221[_0x3e5b('0x3e')]=qs[_0x3e5b('0x36')](_[_0x3e5b('0x3f')](_0x112dc0[_0x3e5b('0x35')],_0x21bc10['filters']),_0xa8760b);if(_0x112dc0['query']['filter']){_0x489221['where']=_['merge'](_0x489221['where'],{'$or':_['map'](_0xa8760b,function(_0x182bc4){if(_0x182bc4[_0x3e5b('0x33')]!==_0x3e5b('0x40')){var _0x1aafd5={};_0x1aafd5[_0x182bc4[_0x3e5b('0x2d')]]={'$like':'%'+_0x112dc0[_0x3e5b('0x35')][_0x3e5b('0x41')]+'%'};return _0x1aafd5;}})});}_0x489221=_[_0x3e5b('0x42')]({},_0x489221,_0x112dc0[_0x3e5b('0x43')]);var _0xbbc6b={'where':_0x489221[_0x3e5b('0x3e')]};return db['AnalyticMetric'][_0x3e5b('0x1f')](_0xbbc6b)[_0x3e5b('0x27')](function(_0x1e8075){_0x1882aa[_0x3e5b('0x1f')]=_0x1e8075;if(_0x112dc0[_0x3e5b('0x35')][_0x3e5b('0x44')]){_0x489221[_0x3e5b('0x45')]=[{'all':!![]}];}return db[_0x3e5b('0x31')][_0x3e5b('0x46')](_0x489221);})[_0x3e5b('0x27')](function(_0x13c8d5){_0x1882aa['rows']=_0x13c8d5;return _0x1882aa;})['then'](respondWithFilteredResult(_0x1e1565,_0x489221))['catch'](handleError(_0x1e1565,null));};exports['show']=function(_0xa99d75,_0x21ee8a){var _0x9fc025={'raw':!![],'where':{'id':_0xa99d75[_0x3e5b('0x47')]['id']}},_0x24c416={};_0x24c416[_0x3e5b('0x38')]=_[_0x3e5b('0x34')](db[_0x3e5b('0x31')][_0x3e5b('0x32')]);_0x24c416[_0x3e5b('0x35')]=_['keys'](_0xa99d75[_0x3e5b('0x35')]);_0x24c416[_0x3e5b('0x36')]=_[_0x3e5b('0x37')](_0x24c416[_0x3e5b('0x38')],_0x24c416[_0x3e5b('0x35')]);_0x9fc025['attributes']=_['intersection'](_0x24c416['model'],qs[_0x3e5b('0x3a')](_0xa99d75[_0x3e5b('0x35')][_0x3e5b('0x3a')]));_0x9fc025['attributes']=_0x9fc025['attributes'][_0x3e5b('0x3b')]?_0x9fc025[_0x3e5b('0x39')]:_0x24c416[_0x3e5b('0x38')];if(_0xa99d75['query']['includeAll']){_0x9fc025[_0x3e5b('0x45')]=[{'all':!![]}];}_0x9fc025=_['merge']({},_0x9fc025,_0xa99d75[_0x3e5b('0x43')]);return db[_0x3e5b('0x31')][_0x3e5b('0x48')](_0x9fc025)[_0x3e5b('0x27')](handleEntityNotFound(_0x21ee8a,null))[_0x3e5b('0x27')](respondWithResult(_0x21ee8a,null))[_0x3e5b('0x49')](handleError(_0x21ee8a,null));};exports[_0x3e5b('0x4a')]=function(_0x3ea5aa,_0x339852){return db['AnalyticMetric'][_0x3e5b('0x4a')](_0x3ea5aa['body'],{})[_0x3e5b('0x27')](function(_0x2e7047){var _0x26e11e=_0x3ea5aa[_0x3e5b('0x4b')][_0x3e5b('0x4c')]({'plain':!![]});if(!_0x26e11e)throw new Error(_0x3e5b('0x4d'));if(_0x26e11e[_0x3e5b('0x4e')]===_0x3e5b('0x4b')){var _0x2b5d3d=_0x2e7047[_0x3e5b('0x4c')]({'plain':!![]});var _0xf6ca5b=_0x3e5b('0x28');return db[_0x3e5b('0x4f')]['find']({'where':{'name':_0xf6ca5b,'userProfileId':_0x26e11e[_0x3e5b('0x50')]},'raw':!![]})[_0x3e5b('0x27')](function(_0x2ca33b){if(_0x2ca33b&&_0x2ca33b[_0x3e5b('0x51')]===0x0){return db[_0x3e5b('0x29')][_0x3e5b('0x4a')]({'name':_0x2b5d3d['name'],'resourceId':_0x2b5d3d['id'],'type':_0x2ca33b[_0x3e5b('0x2d')],'sectionId':_0x2ca33b['id']},{})[_0x3e5b('0x27')](function(){return _0x2e7047;});}else{return _0x2e7047;}})[_0x3e5b('0x49')](function(_0x314d42){logger[_0x3e5b('0x2b')](_0x3e5b('0x52'),_0x314d42);throw _0x314d42;});}return _0x2e7047;})[_0x3e5b('0x27')](respondWithResult(_0x339852,0xc9))[_0x3e5b('0x49')](handleError(_0x339852,null));};exports['update']=function(_0x1e6403,_0x5e702f){if(_0x1e6403['body']['id']){delete _0x1e6403[_0x3e5b('0x53')]['id'];}return db['AnalyticMetric'][_0x3e5b('0x48')]({'where':{'id':_0x1e6403[_0x3e5b('0x47')]['id']}})[_0x3e5b('0x27')](handleEntityNotFound(_0x5e702f,null))[_0x3e5b('0x27')](saveUpdates(_0x1e6403['body'],null))['then'](respondWithResult(_0x5e702f,null))['catch'](handleError(_0x5e702f,null));};exports['destroy']=function(_0x2ab5f3,_0x999518){return db[_0x3e5b('0x31')][_0x3e5b('0x48')]({'where':{'id':_0x2ab5f3[_0x3e5b('0x47')]['id']}})['then'](handleEntityNotFound(_0x999518,null))['then'](removeEntity(_0x999518,null))[_0x3e5b('0x49')](handleError(_0x999518,null));}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.model.js b/server/api/analyticMetric/analyticMetric.model.js index 4527e40..8118890 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 _0x8375=['lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','AnalyticMetric'];(function(_0x1f4ef4,_0x525c7a){var _0x2757e9=function(_0x4f1004){while(--_0x4f1004){_0x1f4ef4['push'](_0x1f4ef4['shift']());}};_0x2757e9(++_0x525c7a);}(_0x8375,0xa8));var _0x5837=function(_0x3e65ea,_0x72471f){_0x3e65ea=_0x3e65ea-0x0;var _0x401ae8=_0x8375[_0x3e65ea];return _0x401ae8;};'use strict';var _=require(_0x5837('0x0'));var util=require(_0x5837('0x1'));var logger=require(_0x5837('0x2'))('api');var moment=require(_0x5837('0x3'));var BPromise=require(_0x5837('0x4'));var rp=require(_0x5837('0x5'));var fs=require('fs');var path=require(_0x5837('0x6'));var rimraf=require(_0x5837('0x7'));var config=require(_0x5837('0x8'));var attributes=require('./analyticMetric.attributes');module[_0x5837('0x9')]=function(_0x19491e,_0x365da3){return _0x19491e[_0x5837('0xa')](_0x5837('0xb'),attributes,{'tableName':'analytics_metrics','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x280b=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./analyticMetric.attributes','exports','define','AnalyticMetric','lodash','util'];(function(_0x27236c,_0x4e81b6){var _0x325d41=function(_0x355313){while(--_0x355313){_0x27236c['push'](_0x27236c['shift']());}};_0x325d41(++_0x4e81b6);}(_0x280b,0xce));var _0xb280=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x280b[_0x2b4411];return _0x8e41ef;};'use strict';var _=require(_0xb280('0x0'));var util=require(_0xb280('0x1'));var logger=require('../../config/logger')(_0xb280('0x2'));var moment=require(_0xb280('0x3'));var BPromise=require(_0xb280('0x4'));var rp=require(_0xb280('0x5'));var fs=require('fs');var path=require(_0xb280('0x6'));var rimraf=require(_0xb280('0x7'));var config=require(_0xb280('0x8'));var attributes=require(_0xb280('0x9'));module[_0xb280('0xa')]=function(_0x5d1991,_0x4d1b2e){return _0x5d1991[_0xb280('0xb')](_0xb280('0xc'),attributes,{'tableName':'analytics_metrics','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.rpc.js b/server/api/analyticMetric/analyticMetric.rpc.js index ee24d87..81e6198 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 _0xa668=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','AnalyticMetric,\x20%s,\x20%s','request\x20sent','debug','error','message','info','result','lodash','util','moment','bluebird'];(function(_0x3471e1,_0x297aeb){var _0x259194=function(_0x3d3e77){while(--_0x3d3e77){_0x3471e1['push'](_0x3471e1['shift']());}};_0x259194(++_0x297aeb);}(_0xa668,0xec));var _0x8a66=function(_0x32f9cf,_0x307d57){_0x32f9cf=_0x32f9cf-0x0;var _0x24ec66=_0xa668[_0x32f9cf];return _0x24ec66;};'use strict';var _=require(_0x8a66('0x0'));var util=require(_0x8a66('0x1'));var moment=require(_0x8a66('0x2'));var BPromise=require(_0x8a66('0x3'));var rs=require(_0x8a66('0x4'));var fs=require('fs');var Redis=require(_0x8a66('0x5'));var db=require(_0x8a66('0x6'))['db'];var utils=require(_0x8a66('0x7'));var logger=require(_0x8a66('0x8'))('rpc');var config=require(_0x8a66('0x9'));var jayson=require(_0x8a66('0xa'));var client=jayson[_0x8a66('0xb')][_0x8a66('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1dd14b,_0x23b514,_0x51dacb){return new BPromise(function(_0x355ad5,_0x504237){return client['request'](_0x1dd14b,_0x51dacb)['then'](function(_0x31170a){logger['info'](_0x8a66('0xd'),_0x23b514,_0x8a66('0xe'));logger[_0x8a66('0xf')]('AnalyticMetric,\x20%s,\x20%s,\x20%s',_0x23b514,_0x8a66('0xe'),JSON['stringify'](_0x31170a));if(_0x31170a[_0x8a66('0x10')]){if(_0x31170a['error']['code']===0x1f4){logger[_0x8a66('0x10')]('AnalyticMetric,\x20%s,\x20%s',_0x23b514,_0x31170a[_0x8a66('0x10')][_0x8a66('0x11')]);return _0x504237(_0x31170a[_0x8a66('0x10')]['message']);}logger[_0x8a66('0x10')](_0x8a66('0xd'),_0x23b514,_0x31170a[_0x8a66('0x10')][_0x8a66('0x11')]);return _0x355ad5(_0x31170a[_0x8a66('0x10')][_0x8a66('0x11')]);}else{logger[_0x8a66('0x12')](_0x8a66('0xd'),_0x23b514,'request\x20sent');_0x355ad5(_0x31170a[_0x8a66('0x13')][_0x8a66('0x11')]);}})['catch'](function(_0x503f22){logger[_0x8a66('0x10')](_0x8a66('0xd'),_0x23b514,_0x503f22);_0x504237(_0x503f22);});});} \ No newline at end of file +var _0xaed1=['then','info','AnalyticMetric,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x1ac120,_0x3e7e45){var _0x19b703=function(_0x5f32cb){while(--_0x5f32cb){_0x1ac120['push'](_0x1ac120['shift']());}};_0x19b703(++_0x3e7e45);}(_0xaed1,0x135));var _0x1aed=function(_0x384b64,_0x4f0784){_0x384b64=_0x384b64-0x0;var _0x3a8f2c=_0xaed1[_0x384b64];return _0x3a8f2c;};'use strict';var _=require('lodash');var util=require(_0x1aed('0x0'));var moment=require(_0x1aed('0x1'));var BPromise=require(_0x1aed('0x2'));var rs=require(_0x1aed('0x3'));var fs=require('fs');var Redis=require(_0x1aed('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x1aed('0x5'));var logger=require(_0x1aed('0x6'))(_0x1aed('0x7'));var config=require(_0x1aed('0x8'));var jayson=require(_0x1aed('0x9'));var client=jayson[_0x1aed('0xa')][_0x1aed('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4cf800,_0x23db52,_0x43af06){return new BPromise(function(_0x181b62,_0x26bfdb){return client[_0x1aed('0xc')](_0x4cf800,_0x43af06)[_0x1aed('0xd')](function(_0x2d7e41){logger[_0x1aed('0xe')](_0x1aed('0xf'),_0x23db52,_0x1aed('0x10'));logger[_0x1aed('0x11')]('AnalyticMetric,\x20%s,\x20%s,\x20%s',_0x23db52,_0x1aed('0x10'),JSON[_0x1aed('0x12')](_0x2d7e41));if(_0x2d7e41['error']){if(_0x2d7e41[_0x1aed('0x13')][_0x1aed('0x14')]===0x1f4){logger[_0x1aed('0x13')](_0x1aed('0xf'),_0x23db52,_0x2d7e41[_0x1aed('0x13')]['message']);return _0x26bfdb(_0x2d7e41['error']['message']);}logger[_0x1aed('0x13')](_0x1aed('0xf'),_0x23db52,_0x2d7e41['error']['message']);return _0x181b62(_0x2d7e41[_0x1aed('0x13')][_0x1aed('0x15')]);}else{logger[_0x1aed('0xe')]('AnalyticMetric,\x20%s,\x20%s',_0x23db52,_0x1aed('0x10'));_0x181b62(_0x2d7e41[_0x1aed('0x16')][_0x1aed('0x15')]);}})['catch'](function(_0x51d0b9){logger['error']('AnalyticMetric,\x20%s,\x20%s',_0x23db52,_0x51d0b9);_0x26bfdb(_0x51d0b9);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index 20fc01a..53f3592 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 _0x7217=['Router','fs-extra','../../config/environment','./analyticMetric.controller','get','isAuthenticated','index','/:id','show','post','create','put','delete','destroy','exports','multer','path','connect-timeout','express'];(function(_0x433850,_0x5e347c){var _0x4b8501=function(_0xb66cfe){while(--_0xb66cfe){_0x433850['push'](_0x433850['shift']());}};_0x4b8501(++_0x5e347c);}(_0x7217,0x19e));var _0x7721=function(_0x5e3b04,_0xbb6795){_0x5e3b04=_0x5e3b04-0x0;var _0x1fc44d=_0x7217[_0x5e3b04];return _0x1fc44d;};'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 _0x0958=['create','delete','destroy','exports','multer','util','path','express','Router','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id'];(function(_0x4e468f,_0x1489a2){var _0x32edaf=function(_0x2e8cf3){while(--_0x2e8cf3){_0x4e468f['push'](_0x4e468f['shift']());}};_0x32edaf(++_0x1489a2);}(_0x0958,0x7c));var _0x8095=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x0958[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0x8095('0x0'));var util=require(_0x8095('0x1'));var path=require(_0x8095('0x2'));var timeout=require('connect-timeout');var express=require(_0x8095('0x3'));var router=express[_0x8095('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x8095('0x5'));var config=require(_0x8095('0x6'));var controller=require('./analyticMetric.controller');router['get']('/',auth[_0x8095('0x7')](),controller[_0x8095('0x8')]);router[_0x8095('0x9')](_0x8095('0xa'),auth[_0x8095('0x7')](),controller['show']);router['post']('/',auth[_0x8095('0x7')](),controller[_0x8095('0xb')]);router['put']('/:id',auth[_0x8095('0x7')](),controller['update']);router[_0x8095('0xc')](_0x8095('0xa'),auth[_0x8095('0x7')](),controller[_0x8095('0xd')]);module[_0x8095('0xe')]=router; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.attributes.js b/server/api/analyticTreeReport/analyticTreeReport.attributes.js index c43b52c..f04335d 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 _0x6e2b=['TEXT','sequelize','exports'];(function(_0x4e22e5,_0x5071c6){var _0x178be0=function(_0x461bc6){while(--_0x461bc6){_0x4e22e5['push'](_0x4e22e5['shift']());}};_0x178be0(++_0x5071c6);}(_0x6e2b,0x91));var _0xb6e2=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x6e2b[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0xb6e2('0x0'));module[_0xb6e2('0x1')]={'tree':{'type':Sequelize[_0xb6e2('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x8002=['TEXT','sequelize','exports'];(function(_0x225f50,_0x48a77d){var _0x19d003=function(_0x58965d){while(--_0x58965d){_0x225f50['push'](_0x225f50['shift']());}};_0x19d003(++_0x48a77d);}(_0x8002,0xa0));var _0x2800=function(_0x4f6f0b,_0xc26047){_0x4f6f0b=_0x4f6f0b-0x0;var _0x518ed2=_0x8002[_0x4f6f0b];return _0x518ed2;};'use strict';var Sequelize=require(_0x2800('0x0'));module[_0x2800('0x1')]={'tree':{'type':Sequelize[_0x2800('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.controller.js b/server/api/analyticTreeReport/analyticTreeReport.controller.js index 5ff182a..fa8622f 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 _0x0c58=['includeAll','include','findAll','catch','show','params','rawAttributes','find','create','body','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','status','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','destroy','then','end','error','send','map','AnalyticTreeReport','fieldName','type','key','name','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options'];(function(_0xad8169,_0x565e9e){var _0x8f61e7=function(_0x5ac70e){while(--_0x5ac70e){_0xad8169['push'](_0xad8169['shift']());}};_0x8f61e7(++_0x565e9e);}(_0x0c58,0x9e));var _0x80c5=function(_0x376246,_0x305977){_0x376246=_0x376246-0x0;var _0x483010=_0x0c58[_0x376246];return _0x483010;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x80c5('0x0'));var zipdir=require(_0x80c5('0x1'));var jsonpatch=require(_0x80c5('0x2'));var rp=require(_0x80c5('0x3'));var moment=require('moment');var BPromise=require(_0x80c5('0x4'));var Mustache=require(_0x80c5('0x5'));var util=require(_0x80c5('0x6'));var path=require(_0x80c5('0x7'));var sox=require(_0x80c5('0x8'));var csv=require('to-csv');var ejs=require(_0x80c5('0x9'));var fs=require('fs');var fs_extra=require(_0x80c5('0xa'));var _=require(_0x80c5('0xb'));var squel=require(_0x80c5('0xc'));var crypto=require(_0x80c5('0xd'));var jsforce=require(_0x80c5('0xe'));var deskjs=require(_0x80c5('0xf'));var toCsv=require('to-csv');var querystring=require(_0x80c5('0x10'));var Papa=require(_0x80c5('0x11'));var Redis=require(_0x80c5('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x80c5('0x13'));var logger=require('../../config/logger')(_0x80c5('0x14'));var utils=require('../../config/utils');var config=require(_0x80c5('0x15'));var licenseUtil=require(_0x80c5('0x16'));var db=require(_0x80c5('0x17'))['db'];function respondWithStatusCode(_0x3aea1b,_0x57b744){_0x57b744=_0x57b744||0xcc;return function(_0x303cda){if(_0x303cda){return _0x3aea1b['sendStatus'](_0x57b744);}return _0x3aea1b[_0x80c5('0x18')](_0x57b744)['end']();};}function respondWithResult(_0x2dd32f,_0x302488){_0x302488=_0x302488||0xc8;return function(_0x3b38eb){if(_0x3b38eb){return _0x2dd32f[_0x80c5('0x18')](_0x302488)['json'](_0x3b38eb);}};}function respondWithFilteredResult(_0x34642e,_0x185014){return function(_0x325727){if(_0x325727){var _0x2775c8=typeof _0x185014[_0x80c5('0x19')]===_0x80c5('0x1a')&&typeof _0x185014['limit']===_0x80c5('0x1a');var _0x516331=_0x325727[_0x80c5('0x1b')];var _0x27839c=_0x2775c8?0x0:_0x185014[_0x80c5('0x19')];var _0x45c1aa=_0x2775c8?_0x325727['count']:_0x185014[_0x80c5('0x19')]+_0x185014[_0x80c5('0x1c')];var _0x5962df;if(_0x45c1aa>=_0x516331){_0x45c1aa=_0x516331;_0x5962df=0xc8;}else{_0x5962df=0xce;}_0x34642e[_0x80c5('0x18')](_0x5962df);return _0x34642e[_0x80c5('0x1d')](_0x80c5('0x1e'),_0x27839c+'-'+_0x45c1aa+'/'+_0x516331)['json'](_0x325727);}return null;};}function patchUpdates(_0x29d606){return function(_0x5b0caf){try{jsonpatch[_0x80c5('0x1f')](_0x5b0caf,_0x29d606,!![]);}catch(_0x2bfadc){return BPromise[_0x80c5('0x20')](_0x2bfadc);}return _0x5b0caf[_0x80c5('0x21')]();};}function saveUpdates(_0xc9c594,_0x5d3dab){return function(_0x4a4b68){if(_0x4a4b68){return _0x4a4b68[_0x80c5('0x22')](_0xc9c594)['then'](function(_0x35822d){return _0x35822d;});}return null;};}function removeEntity(_0x5b749d,_0x49004c){return function(_0x243ef2){if(_0x243ef2){return _0x243ef2[_0x80c5('0x23')]()[_0x80c5('0x24')](function(){_0x5b749d['status'](0xcc)[_0x80c5('0x25')]();});}};}function handleEntityNotFound(_0x4ca865,_0x53cfaf){return function(_0x1d24f9){if(!_0x1d24f9){_0x4ca865['sendStatus'](0x194);}return _0x1d24f9;};}function handleError(_0x341689,_0x1ec328){_0x1ec328=_0x1ec328||0x1f4;return function(_0x56034b){logger[_0x80c5('0x26')](_0x56034b['stack']);if(_0x56034b['name']){delete _0x56034b['name'];}_0x341689[_0x80c5('0x18')](_0x1ec328)[_0x80c5('0x27')](_0x56034b);};}exports['index']=function(_0x5d004d,_0x2cbd81){var _0x1b7890={},_0x4a26ae={},_0x4a7628={'count':0x0,'rows':[]};var _0x39d408=_[_0x80c5('0x28')](db[_0x80c5('0x29')]['rawAttributes'],function(_0x532b94){return{'name':_0x532b94[_0x80c5('0x2a')],'type':_0x532b94[_0x80c5('0x2b')][_0x80c5('0x2c')]};});_0x4a26ae['model']=_['map'](_0x39d408,_0x80c5('0x2d'));_0x4a26ae[_0x80c5('0x2e')]=_[_0x80c5('0x2f')](_0x5d004d[_0x80c5('0x2e')]);_0x4a26ae[_0x80c5('0x30')]=_['intersection'](_0x4a26ae[_0x80c5('0x31')],_0x4a26ae[_0x80c5('0x2e')]);_0x1b7890[_0x80c5('0x32')]=_[_0x80c5('0x33')](_0x4a26ae[_0x80c5('0x31')],qs[_0x80c5('0x34')](_0x5d004d['query'][_0x80c5('0x34')]));_0x1b7890[_0x80c5('0x32')]=_0x1b7890[_0x80c5('0x32')][_0x80c5('0x35')]?_0x1b7890[_0x80c5('0x32')]:_0x4a26ae['model'];if(!_0x5d004d[_0x80c5('0x2e')][_0x80c5('0x36')](_0x80c5('0x37'))){_0x1b7890[_0x80c5('0x1c')]=qs[_0x80c5('0x1c')](_0x5d004d[_0x80c5('0x2e')][_0x80c5('0x1c')]);_0x1b7890[_0x80c5('0x19')]=qs[_0x80c5('0x19')](_0x5d004d['query']['offset']);}_0x1b7890[_0x80c5('0x38')]=qs[_0x80c5('0x39')](_0x5d004d['query'][_0x80c5('0x39')]);_0x1b7890[_0x80c5('0x3a')]=qs['filters'](_[_0x80c5('0x3b')](_0x5d004d[_0x80c5('0x2e')],_0x4a26ae[_0x80c5('0x30')]),_0x39d408);if(_0x5d004d[_0x80c5('0x2e')][_0x80c5('0x3c')]){_0x1b7890[_0x80c5('0x3a')]=_[_0x80c5('0x3d')](_0x1b7890[_0x80c5('0x3a')],{'$or':_[_0x80c5('0x28')](_0x39d408,function(_0x141e56){if(_0x141e56[_0x80c5('0x2b')]!==_0x80c5('0x3e')){var _0x519413={};_0x519413[_0x141e56[_0x80c5('0x2d')]]={'$like':'%'+_0x5d004d[_0x80c5('0x2e')][_0x80c5('0x3c')]+'%'};return _0x519413;}})});}_0x1b7890=_[_0x80c5('0x3d')]({},_0x1b7890,_0x5d004d[_0x80c5('0x3f')]);var _0xee96b5={'where':_0x1b7890[_0x80c5('0x3a')]};return db[_0x80c5('0x29')][_0x80c5('0x1b')](_0xee96b5)['then'](function(_0x85bdc0){_0x4a7628['count']=_0x85bdc0;if(_0x5d004d['query'][_0x80c5('0x40')]){_0x1b7890[_0x80c5('0x41')]=[{'all':!![]}];}return db[_0x80c5('0x29')][_0x80c5('0x42')](_0x1b7890);})[_0x80c5('0x24')](function(_0x47867f){_0x4a7628['rows']=_0x47867f;return _0x4a7628;})[_0x80c5('0x24')](respondWithFilteredResult(_0x2cbd81,_0x1b7890))[_0x80c5('0x43')](handleError(_0x2cbd81,null));};exports[_0x80c5('0x44')]=function(_0x26fc8d,_0x13f35b){var _0x1edaf0={'raw':!![],'where':{'id':_0x26fc8d[_0x80c5('0x45')]['id']}},_0x4a9ccd={};_0x4a9ccd['model']=_[_0x80c5('0x2f')](db[_0x80c5('0x29')][_0x80c5('0x46')]);_0x4a9ccd[_0x80c5('0x2e')]=_[_0x80c5('0x2f')](_0x26fc8d[_0x80c5('0x2e')]);_0x4a9ccd[_0x80c5('0x30')]=_[_0x80c5('0x33')](_0x4a9ccd[_0x80c5('0x31')],_0x4a9ccd['query']);_0x1edaf0[_0x80c5('0x32')]=_['intersection'](_0x4a9ccd['model'],qs[_0x80c5('0x34')](_0x26fc8d['query'][_0x80c5('0x34')]));_0x1edaf0[_0x80c5('0x32')]=_0x1edaf0[_0x80c5('0x32')]['length']?_0x1edaf0[_0x80c5('0x32')]:_0x4a9ccd[_0x80c5('0x31')];if(_0x26fc8d[_0x80c5('0x2e')]['includeAll']){_0x1edaf0[_0x80c5('0x41')]=[{'all':!![]}];}_0x1edaf0=_[_0x80c5('0x3d')]({},_0x1edaf0,_0x26fc8d['options']);return db[_0x80c5('0x29')][_0x80c5('0x47')](_0x1edaf0)['then'](handleEntityNotFound(_0x13f35b,null))[_0x80c5('0x24')](respondWithResult(_0x13f35b,null))[_0x80c5('0x43')](handleError(_0x13f35b,null));};exports[_0x80c5('0x48')]=function(_0x4ad946,_0x1c1ed6){return db[_0x80c5('0x29')]['create'](_0x4ad946[_0x80c5('0x49')],{})[_0x80c5('0x24')](respondWithResult(_0x1c1ed6,0xc9))[_0x80c5('0x43')](handleError(_0x1c1ed6,null));};exports[_0x80c5('0x22')]=function(_0xbb3ab6,_0x38560c){if(_0xbb3ab6[_0x80c5('0x49')]['id']){delete _0xbb3ab6[_0x80c5('0x49')]['id'];}return db[_0x80c5('0x29')][_0x80c5('0x47')]({'where':{'id':_0xbb3ab6['params']['id']}})[_0x80c5('0x24')](handleEntityNotFound(_0x38560c,null))[_0x80c5('0x24')](saveUpdates(_0xbb3ab6['body'],null))[_0x80c5('0x24')](respondWithResult(_0x38560c,null))[_0x80c5('0x43')](handleError(_0x38560c,null));};exports[_0x80c5('0x23')]=function(_0x25d4b0,_0x2f7b90){return db['AnalyticTreeReport'][_0x80c5('0x47')]({'where':{'id':_0x25d4b0[_0x80c5('0x45')]['id']}})[_0x80c5('0x24')](handleEntityNotFound(_0x2f7b90,null))[_0x80c5('0x24')](removeEntity(_0x2f7b90,null))[_0x80c5('0x43')](handleError(_0x2f7b90,null));}; \ No newline at end of file +var _0x4a00=['update','then','destroy','error','name','send','map','AnalyticTreeReport','rawAttributes','fieldName','type','key','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','include','findAll','rows','params','includeAll','merge','options','create','body','catch','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save'];(function(_0x53d5c6,_0x4cbc4d){var _0xd6e91a=function(_0x517a2f){while(--_0x517a2f){_0x53d5c6['push'](_0x53d5c6['shift']());}};_0xd6e91a(++_0x4cbc4d);}(_0x4a00,0x192));var _0x04a0=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x4a00[_0x2dafbe];return _0x58a45a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x04a0('0x0'));var zipdir=require(_0x04a0('0x1'));var jsonpatch=require(_0x04a0('0x2'));var rp=require(_0x04a0('0x3'));var moment=require('moment');var BPromise=require(_0x04a0('0x4'));var Mustache=require(_0x04a0('0x5'));var util=require(_0x04a0('0x6'));var path=require(_0x04a0('0x7'));var sox=require(_0x04a0('0x8'));var csv=require(_0x04a0('0x9'));var ejs=require(_0x04a0('0xa'));var fs=require('fs');var fs_extra=require(_0x04a0('0xb'));var _=require(_0x04a0('0xc'));var squel=require(_0x04a0('0xd'));var crypto=require(_0x04a0('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x04a0('0xf'));var toCsv=require(_0x04a0('0x9'));var querystring=require(_0x04a0('0x10'));var Papa=require(_0x04a0('0x11'));var Redis=require(_0x04a0('0x12'));var authService=require(_0x04a0('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x04a0('0x14'));var config=require(_0x04a0('0x15'));var licenseUtil=require(_0x04a0('0x16'));var db=require(_0x04a0('0x17'))['db'];function respondWithStatusCode(_0x54d360,_0x4280c8){_0x4280c8=_0x4280c8||0xcc;return function(_0xd3bc9b){if(_0xd3bc9b){return _0x54d360[_0x04a0('0x18')](_0x4280c8);}return _0x54d360[_0x04a0('0x19')](_0x4280c8)['end']();};}function respondWithResult(_0x20d3ab,_0x286aa4){_0x286aa4=_0x286aa4||0xc8;return function(_0x2454cb){if(_0x2454cb){return _0x20d3ab[_0x04a0('0x19')](_0x286aa4)[_0x04a0('0x1a')](_0x2454cb);}};}function respondWithFilteredResult(_0x3d4036,_0x1d9261){return function(_0x540702){if(_0x540702){var _0x83546=typeof _0x1d9261[_0x04a0('0x1b')]===_0x04a0('0x1c')&&typeof _0x1d9261[_0x04a0('0x1d')]===_0x04a0('0x1c');var _0x367915=_0x540702[_0x04a0('0x1e')];var _0x318b8a=_0x83546?0x0:_0x1d9261[_0x04a0('0x1b')];var _0x3883a5=_0x83546?_0x540702['count']:_0x1d9261[_0x04a0('0x1b')]+_0x1d9261['limit'];var _0x4515fd;if(_0x3883a5>=_0x367915){_0x3883a5=_0x367915;_0x4515fd=0xc8;}else{_0x4515fd=0xce;}_0x3d4036[_0x04a0('0x19')](_0x4515fd);return _0x3d4036[_0x04a0('0x1f')](_0x04a0('0x20'),_0x318b8a+'-'+_0x3883a5+'/'+_0x367915)[_0x04a0('0x1a')](_0x540702);}return null;};}function patchUpdates(_0x50847e){return function(_0x5d8dda){try{jsonpatch[_0x04a0('0x21')](_0x5d8dda,_0x50847e,!![]);}catch(_0x18693a){return BPromise[_0x04a0('0x22')](_0x18693a);}return _0x5d8dda[_0x04a0('0x23')]();};}function saveUpdates(_0x33163a,_0x54bae0){return function(_0x213295){if(_0x213295){return _0x213295[_0x04a0('0x24')](_0x33163a)[_0x04a0('0x25')](function(_0x4a5e83){return _0x4a5e83;});}return null;};}function removeEntity(_0x454b15,_0x406aae){return function(_0x4a9f67){if(_0x4a9f67){return _0x4a9f67[_0x04a0('0x26')]()[_0x04a0('0x25')](function(){_0x454b15['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x45eb59,_0x5be87d){return function(_0x2bd02a){if(!_0x2bd02a){_0x45eb59[_0x04a0('0x18')](0x194);}return _0x2bd02a;};}function handleError(_0x5a15ba,_0x164636){_0x164636=_0x164636||0x1f4;return function(_0x45c350){logger[_0x04a0('0x27')](_0x45c350['stack']);if(_0x45c350[_0x04a0('0x28')]){delete _0x45c350['name'];}_0x5a15ba[_0x04a0('0x19')](_0x164636)[_0x04a0('0x29')](_0x45c350);};}exports['index']=function(_0x269752,_0x209ba3){var _0x2bd19f={},_0xf8ba1d={},_0x4160fa={'count':0x0,'rows':[]};var _0x15d509=_[_0x04a0('0x2a')](db[_0x04a0('0x2b')][_0x04a0('0x2c')],function(_0x5b9d15){return{'name':_0x5b9d15[_0x04a0('0x2d')],'type':_0x5b9d15[_0x04a0('0x2e')][_0x04a0('0x2f')]};});_0xf8ba1d[_0x04a0('0x30')]=_[_0x04a0('0x2a')](_0x15d509,_0x04a0('0x28'));_0xf8ba1d['query']=_[_0x04a0('0x31')](_0x269752[_0x04a0('0x32')]);_0xf8ba1d[_0x04a0('0x33')]=_['intersection'](_0xf8ba1d['model'],_0xf8ba1d[_0x04a0('0x32')]);_0x2bd19f[_0x04a0('0x34')]=_[_0x04a0('0x35')](_0xf8ba1d[_0x04a0('0x30')],qs[_0x04a0('0x36')](_0x269752[_0x04a0('0x32')]['fields']));_0x2bd19f['attributes']=_0x2bd19f[_0x04a0('0x34')][_0x04a0('0x37')]?_0x2bd19f[_0x04a0('0x34')]:_0xf8ba1d[_0x04a0('0x30')];if(!_0x269752['query'][_0x04a0('0x38')](_0x04a0('0x39'))){_0x2bd19f[_0x04a0('0x1d')]=qs[_0x04a0('0x1d')](_0x269752[_0x04a0('0x32')][_0x04a0('0x1d')]);_0x2bd19f[_0x04a0('0x1b')]=qs[_0x04a0('0x1b')](_0x269752[_0x04a0('0x32')][_0x04a0('0x1b')]);}_0x2bd19f[_0x04a0('0x3a')]=qs[_0x04a0('0x3b')](_0x269752['query']['sort']);_0x2bd19f[_0x04a0('0x3c')]=qs[_0x04a0('0x33')](_[_0x04a0('0x3d')](_0x269752[_0x04a0('0x32')],_0xf8ba1d['filters']),_0x15d509);if(_0x269752['query'][_0x04a0('0x3e')]){_0x2bd19f['where']=_['merge'](_0x2bd19f['where'],{'$or':_['map'](_0x15d509,function(_0x1707fb){if(_0x1707fb[_0x04a0('0x2e')]!=='VIRTUAL'){var _0x5207a9={};_0x5207a9[_0x1707fb[_0x04a0('0x28')]]={'$like':'%'+_0x269752[_0x04a0('0x32')][_0x04a0('0x3e')]+'%'};return _0x5207a9;}})});}_0x2bd19f=_['merge']({},_0x2bd19f,_0x269752['options']);var _0x2262d4={'where':_0x2bd19f[_0x04a0('0x3c')]};return db[_0x04a0('0x2b')][_0x04a0('0x1e')](_0x2262d4)[_0x04a0('0x25')](function(_0x1dcd2){_0x4160fa[_0x04a0('0x1e')]=_0x1dcd2;if(_0x269752[_0x04a0('0x32')]['includeAll']){_0x2bd19f[_0x04a0('0x3f')]=[{'all':!![]}];}return db[_0x04a0('0x2b')][_0x04a0('0x40')](_0x2bd19f);})['then'](function(_0x43a21a){_0x4160fa[_0x04a0('0x41')]=_0x43a21a;return _0x4160fa;})['then'](respondWithFilteredResult(_0x209ba3,_0x2bd19f))['catch'](handleError(_0x209ba3,null));};exports['show']=function(_0x2015eb,_0x4f54fe){var _0x197802={'raw':!![],'where':{'id':_0x2015eb[_0x04a0('0x42')]['id']}},_0x11e212={};_0x11e212['model']=_[_0x04a0('0x31')](db['AnalyticTreeReport'][_0x04a0('0x2c')]);_0x11e212['query']=_[_0x04a0('0x31')](_0x2015eb['query']);_0x11e212[_0x04a0('0x33')]=_[_0x04a0('0x35')](_0x11e212[_0x04a0('0x30')],_0x11e212[_0x04a0('0x32')]);_0x197802[_0x04a0('0x34')]=_[_0x04a0('0x35')](_0x11e212['model'],qs[_0x04a0('0x36')](_0x2015eb[_0x04a0('0x32')][_0x04a0('0x36')]));_0x197802['attributes']=_0x197802['attributes'][_0x04a0('0x37')]?_0x197802[_0x04a0('0x34')]:_0x11e212[_0x04a0('0x30')];if(_0x2015eb[_0x04a0('0x32')][_0x04a0('0x43')]){_0x197802['include']=[{'all':!![]}];}_0x197802=_[_0x04a0('0x44')]({},_0x197802,_0x2015eb[_0x04a0('0x45')]);return db[_0x04a0('0x2b')]['find'](_0x197802)[_0x04a0('0x25')](handleEntityNotFound(_0x4f54fe,null))[_0x04a0('0x25')](respondWithResult(_0x4f54fe,null))['catch'](handleError(_0x4f54fe,null));};exports['create']=function(_0x42c273,_0x3b5125){return db['AnalyticTreeReport'][_0x04a0('0x46')](_0x42c273[_0x04a0('0x47')],{})['then'](respondWithResult(_0x3b5125,0xc9))[_0x04a0('0x48')](handleError(_0x3b5125,null));};exports[_0x04a0('0x24')]=function(_0x44c38c,_0x17f739){if(_0x44c38c[_0x04a0('0x47')]['id']){delete _0x44c38c[_0x04a0('0x47')]['id'];}return db[_0x04a0('0x2b')]['find']({'where':{'id':_0x44c38c[_0x04a0('0x42')]['id']}})[_0x04a0('0x25')](handleEntityNotFound(_0x17f739,null))[_0x04a0('0x25')](saveUpdates(_0x44c38c[_0x04a0('0x47')],null))[_0x04a0('0x25')](respondWithResult(_0x17f739,null))[_0x04a0('0x48')](handleError(_0x17f739,null));};exports[_0x04a0('0x26')]=function(_0x3cba97,_0x93bc1d){return db[_0x04a0('0x2b')]['find']({'where':{'id':_0x3cba97[_0x04a0('0x42')]['id']}})[_0x04a0('0x25')](handleEntityNotFound(_0x93bc1d,null))[_0x04a0('0x25')](removeEntity(_0x93bc1d,null))[_0x04a0('0x48')](handleError(_0x93bc1d,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index 02a7844..9bdf34f 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 _0x7e8d=['./analyticTreeReport.attributes','define','AnalyticTreeReport','analytics_report_trees','api','moment','request-promise','path','rimraf'];(function(_0x72063a,_0x1b012e){var _0x41f179=function(_0x135faf){while(--_0x135faf){_0x72063a['push'](_0x72063a['shift']());}};_0x41f179(++_0x1b012e);}(_0x7e8d,0x190));var _0xd7e8=function(_0x136619,_0x31c9b2){_0x136619=_0x136619-0x0;var _0x38c4a5=_0x7e8d[_0x136619];return _0x38c4a5;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xd7e8('0x0'));var moment=require(_0xd7e8('0x1'));var BPromise=require('bluebird');var rp=require(_0xd7e8('0x2'));var fs=require('fs');var path=require(_0xd7e8('0x3'));var rimraf=require(_0xd7e8('0x4'));var config=require('../../config/environment');var attributes=require(_0xd7e8('0x5'));module['exports']=function(_0x48ce40,_0x2361ea){return _0x48ce40[_0xd7e8('0x6')](_0xd7e8('0x7'),attributes,{'tableName':_0xd7e8('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xecc5=['lodash','api','moment','bluebird','path','../../config/environment','define','AnalyticTreeReport'];(function(_0x18528a,_0x4de7d1){var _0x2c3214=function(_0x1b9ff8){while(--_0x1b9ff8){_0x18528a['push'](_0x18528a['shift']());}};_0x2c3214(++_0x4de7d1);}(_0xecc5,0xf8));var _0x5ecc=function(_0x379271,_0x272069){_0x379271=_0x379271-0x0;var _0x597bf4=_0xecc5[_0x379271];return _0x597bf4;};'use strict';var _=require(_0x5ecc('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x5ecc('0x1'));var moment=require(_0x5ecc('0x2'));var BPromise=require(_0x5ecc('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5ecc('0x4'));var rimraf=require('rimraf');var config=require(_0x5ecc('0x5'));var attributes=require('./analyticTreeReport.attributes');module['exports']=function(_0x1901fe,_0x4e134e){return _0x1901fe[_0x5ecc('0x6')](_0x5ecc('0x7'),attributes,{'tableName':'analytics_report_trees','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.rpc.js b/server/api/analyticTreeReport/analyticTreeReport.rpc.js index 6dd4c86..f2e6ec7 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(_0x326054,_0x4cb01c){var _0x4b3213=function(_0x170961){while(--_0x170961){_0x326054['push'](_0x326054['shift']());}};_0x4b3213(++_0x4cb01c);}(_0x5f2f,0x73));var _0xf5f2=function(_0xead4e,_0x4b7d06){_0xead4e=_0xead4e-0x0;var _0xa7f386=_0x5f2f[_0xead4e];return _0xa7f386;};'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 _0x1261=['then','info','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','AnalyticTreeReport,\x20%s,\x20%s,\x20%s','error','code','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request'];(function(_0x33f9d0,_0x60b5b2){var _0x452c7e=function(_0x362179){while(--_0x362179){_0x33f9d0['push'](_0x33f9d0['shift']());}};_0x452c7e(++_0x60b5b2);}(_0x1261,0x144));var _0x1126=function(_0x16e9b5,_0x192142){_0x16e9b5=_0x16e9b5-0x0;var _0x206df0=_0x1261[_0x16e9b5];return _0x206df0;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var moment=require(_0x1126('0x1'));var BPromise=require(_0x1126('0x2'));var rs=require(_0x1126('0x3'));var fs=require('fs');var Redis=require(_0x1126('0x4'));var db=require(_0x1126('0x5'))['db'];var utils=require(_0x1126('0x6'));var logger=require(_0x1126('0x7'))(_0x1126('0x8'));var config=require(_0x1126('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1126('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x907180,_0x4f239c,_0x17e5f0){return new BPromise(function(_0x28772d,_0x245be9){return client[_0x1126('0xb')](_0x907180,_0x17e5f0)[_0x1126('0xc')](function(_0x59cfa1){logger[_0x1126('0xd')](_0x1126('0xe'),_0x4f239c,_0x1126('0xf'));logger['debug'](_0x1126('0x10'),_0x4f239c,'request\x20sent',JSON['stringify'](_0x59cfa1));if(_0x59cfa1[_0x1126('0x11')]){if(_0x59cfa1['error'][_0x1126('0x12')]===0x1f4){logger[_0x1126('0x11')](_0x1126('0xe'),_0x4f239c,_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);return _0x245be9(_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);}logger[_0x1126('0x11')](_0x1126('0xe'),_0x4f239c,_0x59cfa1['error']['message']);return _0x28772d(_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);}else{logger[_0x1126('0xd')]('AnalyticTreeReport,\x20%s,\x20%s',_0x4f239c,_0x1126('0xf'));_0x28772d(_0x59cfa1['result'][_0x1126('0x13')]);}})[_0x1126('0x14')](function(_0x257b5f){logger['error'](_0x1126('0xe'),_0x4f239c,_0x257b5f);_0x245be9(_0x257b5f);});});} \ No newline at end of file diff --git a/server/api/analyticTreeReport/index.js b/server/api/analyticTreeReport/index.js index f08880a..e237869 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 _0x7abc=['put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticTreeReport.controller','get','isAuthenticated','index','/:id','post'];(function(_0x55fa4b,_0x51bbfc){var _0x49b0cf=function(_0x4dff47){while(--_0x4dff47){_0x55fa4b['push'](_0x55fa4b['shift']());}};_0x49b0cf(++_0x51bbfc);}(_0x7abc,0x181));var _0xc7ab=function(_0x4c207b,_0x59f530){_0x4c207b=_0x4c207b-0x0;var _0x560c4f=_0x7abc[_0x4c207b];return _0x560c4f;};'use strict';var multer=require(_0xc7ab('0x0'));var util=require('util');var path=require(_0xc7ab('0x1'));var timeout=require(_0xc7ab('0x2'));var express=require(_0xc7ab('0x3'));var router=express[_0xc7ab('0x4')]();var fs_extra=require(_0xc7ab('0x5'));var auth=require(_0xc7ab('0x6'));var interaction=require(_0xc7ab('0x7'));var config=require(_0xc7ab('0x8'));var controller=require(_0xc7ab('0x9'));router[_0xc7ab('0xa')]('/',auth[_0xc7ab('0xb')](),controller[_0xc7ab('0xc')]);router[_0xc7ab('0xa')](_0xc7ab('0xd'),auth['isAuthenticated'](),controller['show']);router[_0xc7ab('0xe')]('/',auth[_0xc7ab('0xb')](),controller['create']);router[_0xc7ab('0xf')]('/:id',auth[_0xc7ab('0xb')](),controller[_0xc7ab('0x10')]);router[_0xc7ab('0x11')](_0xc7ab('0xd'),auth[_0xc7ab('0xb')](),controller[_0xc7ab('0x12')]);module[_0xc7ab('0x13')]=router; \ No newline at end of file +var _0x7b5a=['show','post','create','delete','destroy','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./analyticTreeReport.controller','get','isAuthenticated','/:id'];(function(_0x5676df,_0x14d122){var _0x1fb878=function(_0x84c80a){while(--_0x84c80a){_0x5676df['push'](_0x5676df['shift']());}};_0x1fb878(++_0x14d122);}(_0x7b5a,0x1d0));var _0xa7b5=function(_0x386525,_0xefae6){_0x386525=_0x386525-0x0;var _0x14d015=_0x7b5a[_0x386525];return _0x14d015;};'use strict';var multer=require(_0xa7b5('0x0'));var util=require('util');var path=require(_0xa7b5('0x1'));var timeout=require(_0xa7b5('0x2'));var express=require(_0xa7b5('0x3'));var router=express[_0xa7b5('0x4')]();var fs_extra=require(_0xa7b5('0x5'));var auth=require(_0xa7b5('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xa7b5('0x7'));var controller=require(_0xa7b5('0x8'));router[_0xa7b5('0x9')]('/',auth[_0xa7b5('0xa')](),controller['index']);router[_0xa7b5('0x9')](_0xa7b5('0xb'),auth[_0xa7b5('0xa')](),controller[_0xa7b5('0xc')]);router[_0xa7b5('0xd')]('/',auth['isAuthenticated'](),controller[_0xa7b5('0xe')]);router['put']('/:id',auth[_0xa7b5('0xa')](),controller['update']);router[_0xa7b5('0xf')]('/:id',auth[_0xa7b5('0xa')](),controller[_0xa7b5('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/attachment/attachment.attributes.js b/server/api/attachment/attachment.attributes.js index b906312..dc4c16a 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 _0x5a8c=['sequelize','exports','STRING'];(function(_0x3e5b1e,_0x10a1fc){var _0x265956=function(_0x2c3a03){while(--_0x2c3a03){_0x3e5b1e['push'](_0x3e5b1e['shift']());}};_0x265956(++_0x10a1fc);}(_0x5a8c,0x1da));var _0xc5a8=function(_0xe27948,_0x5bfa16){_0xe27948=_0xe27948-0x0;var _0x44e57b=_0x5a8c[_0xe27948];return _0x44e57b;};'use strict';var Sequelize=require(_0xc5a8('0x0'));module[_0xc5a8('0x1')]={'name':{'type':Sequelize['STRING']},'basename':{'type':Sequelize[_0xc5a8('0x2')]},'type':{'type':Sequelize[_0xc5a8('0x2')]}}; \ No newline at end of file +var _0x89c3=['sequelize','exports','STRING'];(function(_0x200d3d,_0xa6ad41){var _0x6d0dca=function(_0x37127b){while(--_0x37127b){_0x200d3d['push'](_0x200d3d['shift']());}};_0x6d0dca(++_0xa6ad41);}(_0x89c3,0xff));var _0x389c=function(_0x552b33,_0x1ce5ec){_0x552b33=_0x552b33-0x0;var _0x2b8810=_0x89c3[_0x552b33];return _0x2b8810;};'use strict';var Sequelize=require(_0x389c('0x0'));module[_0x389c('0x1')]={'name':{'type':Sequelize[_0x389c('0x2')]},'basename':{'type':Sequelize[_0x389c('0x2')]},'type':{'type':Sequelize[_0x389c('0x2')]}}; \ No newline at end of file diff --git a/server/api/attachment/attachment.controller.js b/server/api/attachment/attachment.controller.js index a3fdbb9..62485fc 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 _0x7446=['Content-Range','apply','save','then','destroy','error','stack','name','index','map','Attachment','rawAttributes','type','key','query','keys','filters','intersection','model','fields','attributes','length','nolimit','order','sort','filter','where','VIRTUAL','merge','options','includeAll','include','findAll','catch','find','clone','params','get','omit','createdAt','updatedAt','body','create','update','file','basename','filename','download','ChatOfflineMessageId','join','root','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit'];(function(_0x326e5e,_0x491c33){var _0x4d0fde=function(_0xcbcedc){while(--_0xcbcedc){_0x326e5e['push'](_0x326e5e['shift']());}};_0x4d0fde(++_0x491c33);}(_0x7446,0x17f));var _0x6744=function(_0x351c0e,_0x172dd0){_0x351c0e=_0x351c0e-0x0;var _0x3ac7f1=_0x7446[_0x351c0e];return _0x3ac7f1;};'use strict';var emlformat=require(_0x6744('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6744('0x1'));var jsonpatch=require(_0x6744('0x2'));var rp=require('request-promise');var moment=require(_0x6744('0x3'));var BPromise=require(_0x6744('0x4'));var Mustache=require(_0x6744('0x5'));var util=require('util');var path=require(_0x6744('0x6'));var sox=require(_0x6744('0x7'));var csv=require('to-csv');var ejs=require(_0x6744('0x8'));var fs=require('fs');var fs_extra=require(_0x6744('0x9'));var _=require('lodash');var squel=require(_0x6744('0xa'));var crypto=require(_0x6744('0xb'));var jsforce=require(_0x6744('0xc'));var deskjs=require(_0x6744('0xd'));var toCsv=require(_0x6744('0xe'));var querystring=require(_0x6744('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x6744('0x10'));var qs=require(_0x6744('0x11'));var as=require(_0x6744('0x12'));var hardwareService=require(_0x6744('0x13'));var logger=require('../../config/logger')(_0x6744('0x14'));var utils=require(_0x6744('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x6744('0x16'));var db=require(_0x6744('0x17'))['db'];function respondWithStatusCode(_0x32597c,_0x416c62){_0x416c62=_0x416c62||0xcc;return function(_0x139222){if(_0x139222){return _0x32597c[_0x6744('0x18')](_0x416c62);}return _0x32597c[_0x6744('0x19')](_0x416c62)[_0x6744('0x1a')]();};}function respondWithResult(_0x132ed8,_0x25b30e){_0x25b30e=_0x25b30e||0xc8;return function(_0x5e6c22){if(_0x5e6c22){return _0x132ed8[_0x6744('0x19')](_0x25b30e)[_0x6744('0x1b')](_0x5e6c22);}};}function respondWithFilteredResult(_0x38707b,_0x4d7b8d){return function(_0x17a039){if(_0x17a039){var _0x1617fa=typeof _0x4d7b8d[_0x6744('0x1c')]==='undefined'&&typeof _0x4d7b8d['limit']===_0x6744('0x1d');var _0x5f334d=_0x17a039[_0x6744('0x1e')];var _0x50d329=_0x1617fa?0x0:_0x4d7b8d[_0x6744('0x1c')];var _0x3e5e63=_0x1617fa?_0x17a039[_0x6744('0x1e')]:_0x4d7b8d[_0x6744('0x1c')]+_0x4d7b8d[_0x6744('0x1f')];var _0xcf2ce6;if(_0x3e5e63>=_0x5f334d){_0x3e5e63=_0x5f334d;_0xcf2ce6=0xc8;}else{_0xcf2ce6=0xce;}_0x38707b['status'](_0xcf2ce6);return _0x38707b['set'](_0x6744('0x20'),_0x50d329+'-'+_0x3e5e63+'/'+_0x5f334d)['json'](_0x17a039);}return null;};}function patchUpdates(_0x34b8ef){return function(_0x4bfe68){try{jsonpatch[_0x6744('0x21')](_0x4bfe68,_0x34b8ef,!![]);}catch(_0x26f083){return BPromise['reject'](_0x26f083);}return _0x4bfe68[_0x6744('0x22')]();};}function saveUpdates(_0xa8bc4a,_0x32bfb1){return function(_0x121bb6){if(_0x121bb6){return _0x121bb6['update'](_0xa8bc4a)[_0x6744('0x23')](function(_0xc0763e){return _0xc0763e;});}return null;};}function removeEntity(_0x338a79,_0x144d15){return function(_0x3680ca){if(_0x3680ca){return _0x3680ca[_0x6744('0x24')]()[_0x6744('0x23')](function(){_0x338a79[_0x6744('0x19')](0xcc)[_0x6744('0x1a')]();});}};}function handleEntityNotFound(_0x7a5983,_0x538cd4){return function(_0x747afc){if(!_0x747afc){_0x7a5983[_0x6744('0x18')](0x194);}return _0x747afc;};}function handleError(_0x26f352,_0x835999){_0x835999=_0x835999||0x1f4;return function(_0x7e46b3){logger[_0x6744('0x25')](_0x7e46b3[_0x6744('0x26')]);if(_0x7e46b3[_0x6744('0x27')]){delete _0x7e46b3[_0x6744('0x27')];}_0x26f352[_0x6744('0x19')](_0x835999)['send'](_0x7e46b3);};}exports[_0x6744('0x28')]=function(_0x19c7d8,_0x4c6bf1){var _0x522800={},_0xa23129={},_0xb783db={'count':0x0,'rows':[]};var _0x1cef4a=_[_0x6744('0x29')](db[_0x6744('0x2a')][_0x6744('0x2b')],function(_0x427394){return{'name':_0x427394['fieldName'],'type':_0x427394[_0x6744('0x2c')][_0x6744('0x2d')]};});_0xa23129['model']=_[_0x6744('0x29')](_0x1cef4a,_0x6744('0x27'));_0xa23129[_0x6744('0x2e')]=_[_0x6744('0x2f')](_0x19c7d8[_0x6744('0x2e')]);_0xa23129[_0x6744('0x30')]=_[_0x6744('0x31')](_0xa23129[_0x6744('0x32')],_0xa23129['query']);_0x522800['attributes']=_[_0x6744('0x31')](_0xa23129[_0x6744('0x32')],qs[_0x6744('0x33')](_0x19c7d8[_0x6744('0x2e')][_0x6744('0x33')]));_0x522800['attributes']=_0x522800[_0x6744('0x34')][_0x6744('0x35')]?_0x522800[_0x6744('0x34')]:_0xa23129[_0x6744('0x32')];if(!_0x19c7d8[_0x6744('0x2e')]['hasOwnProperty'](_0x6744('0x36'))){_0x522800[_0x6744('0x1f')]=qs[_0x6744('0x1f')](_0x19c7d8[_0x6744('0x2e')][_0x6744('0x1f')]);_0x522800[_0x6744('0x1c')]=qs['offset'](_0x19c7d8[_0x6744('0x2e')]['offset']);}_0x522800[_0x6744('0x37')]=qs[_0x6744('0x38')](_0x19c7d8['query'][_0x6744('0x38')]);_0x522800['where']=qs['filters'](_['pick'](_0x19c7d8['query'],_0xa23129[_0x6744('0x30')]),_0x1cef4a);if(_0x19c7d8[_0x6744('0x2e')][_0x6744('0x39')]){_0x522800[_0x6744('0x3a')]=_['merge'](_0x522800['where'],{'$or':_[_0x6744('0x29')](_0x1cef4a,function(_0x286bf2){if(_0x286bf2[_0x6744('0x2c')]!==_0x6744('0x3b')){var _0x5788b4={};_0x5788b4[_0x286bf2[_0x6744('0x27')]]={'$like':'%'+_0x19c7d8[_0x6744('0x2e')]['filter']+'%'};return _0x5788b4;}})});}_0x522800=_[_0x6744('0x3c')]({},_0x522800,_0x19c7d8[_0x6744('0x3d')]);var _0x46faf2={'where':_0x522800[_0x6744('0x3a')]};return db[_0x6744('0x2a')][_0x6744('0x1e')](_0x46faf2)[_0x6744('0x23')](function(_0x1aff13){_0xb783db[_0x6744('0x1e')]=_0x1aff13;if(_0x19c7d8[_0x6744('0x2e')][_0x6744('0x3e')]){_0x522800[_0x6744('0x3f')]=[{'all':!![]}];}return db[_0x6744('0x2a')][_0x6744('0x40')](_0x522800);})[_0x6744('0x23')](function(_0x1a434a){_0xb783db['rows']=_0x1a434a;return _0xb783db;})[_0x6744('0x23')](respondWithFilteredResult(_0x4c6bf1,_0x522800))[_0x6744('0x41')](handleError(_0x4c6bf1,null));};exports['show']=function(_0x2357a8,_0x288db7){var _0x1d3282={'raw':!![],'where':{'id':_0x2357a8['params']['id']}},_0x19c8e2={};_0x19c8e2['model']=_['keys'](db['Attachment'][_0x6744('0x2b')]);_0x19c8e2['query']=_[_0x6744('0x2f')](_0x2357a8[_0x6744('0x2e')]);_0x19c8e2[_0x6744('0x30')]=_[_0x6744('0x31')](_0x19c8e2['model'],_0x19c8e2[_0x6744('0x2e')]);_0x1d3282[_0x6744('0x34')]=_[_0x6744('0x31')](_0x19c8e2[_0x6744('0x32')],qs[_0x6744('0x33')](_0x2357a8[_0x6744('0x2e')][_0x6744('0x33')]));_0x1d3282['attributes']=_0x1d3282['attributes'][_0x6744('0x35')]?_0x1d3282['attributes']:_0x19c8e2['model'];if(_0x2357a8[_0x6744('0x2e')]['includeAll']){_0x1d3282[_0x6744('0x3f')]=[{'all':!![]}];}_0x1d3282=_['merge']({},_0x1d3282,_0x2357a8[_0x6744('0x3d')]);return db['Attachment'][_0x6744('0x42')](_0x1d3282)['then'](handleEntityNotFound(_0x288db7,null))[_0x6744('0x23')](respondWithResult(_0x288db7,null))[_0x6744('0x41')](handleError(_0x288db7,null));};exports[_0x6744('0x43')]=function(_0x5e1991,_0x2e9954){var _0x1c349f={'where':{'id':_0x5e1991[_0x6744('0x44')]['id']}},_0x30cd47={};_0x30cd47[_0x6744('0x32')]=_[_0x6744('0x2f')](db[_0x6744('0x2a')][_0x6744('0x2b')]);_0x1c349f[_0x6744('0x34')]=_[_0x6744('0x31')](_0x30cd47[_0x6744('0x32')],qs[_0x6744('0x33')](_0x5e1991[_0x6744('0x2e')][_0x6744('0x33')]));_0x1c349f[_0x6744('0x34')]=_0x1c349f['attributes'][_0x6744('0x35')]?_0x1c349f[_0x6744('0x34')]:_0x30cd47[_0x6744('0x32')];if(_0x5e1991['query']['includeAll']){_0x1c349f[_0x6744('0x3f')]=[{'all':!![]}];}_0x1c349f=_['merge']({},_0x1c349f,_0x5e1991[_0x6744('0x3d')]);return db[_0x6744('0x2a')][_0x6744('0x42')](_0x1c349f)[_0x6744('0x23')](handleEntityNotFound(_0x2e9954,null))[_0x6744('0x23')](function(_0x406dc6){if(_0x406dc6){var _0x2a0789=_0x406dc6[_0x6744('0x45')]({'plain':!![]});_0x2a0789=qs[_0x6744('0x46')](_0x2a0789,['id',_0x6744('0x47'),_0x6744('0x48')]);_0x5e1991[_0x6744('0x49')]=_['omit'](_0x5e1991[_0x6744('0x49')],['id',_0x6744('0x47'),_0x6744('0x48')]);return db[_0x6744('0x2a')][_0x6744('0x4a')](_[_0x6744('0x3c')](_0x2a0789,_0x5e1991[_0x6744('0x49')]),{'include':_0x5e1991['query'][_0x6744('0x3e')]?[{'all':!![]}]:undefined});}})[_0x6744('0x23')](respondWithResult(_0x2e9954,0xc9))['catch'](handleError(_0x2e9954,null));};exports[_0x6744('0x4b')]=function(_0x8e8a74,_0x40fb2e){if(_0x8e8a74[_0x6744('0x49')]['id']){delete _0x8e8a74[_0x6744('0x49')]['id'];}return db[_0x6744('0x2a')][_0x6744('0x42')]({'where':{'id':_0x8e8a74['params']['id']}})[_0x6744('0x23')](handleEntityNotFound(_0x40fb2e,null))[_0x6744('0x23')](saveUpdates(_0x8e8a74[_0x6744('0x49')],null))['then'](respondWithResult(_0x40fb2e,null))[_0x6744('0x41')](handleError(_0x40fb2e,null));};exports[_0x6744('0x24')]=function(_0x4354d5,_0x2df817){return db['Attachment'][_0x6744('0x42')]({'where':{'id':_0x4354d5[_0x6744('0x44')]['id']}})[_0x6744('0x23')](handleEntityNotFound(_0x2df817,null))[_0x6744('0x23')](removeEntity(_0x2df817,null))[_0x6744('0x41')](handleError(_0x2df817,null));};exports['create']=function(_0xe1c2e4,_0x452509,_0xddc70c){_0xe1c2e4[_0x6744('0x49')][_0x6744('0x27')]=_0xe1c2e4[_0x6744('0x4c')]['originalname'];_0xe1c2e4['body'][_0x6744('0x4d')]=_0xe1c2e4[_0x6744('0x4c')][_0x6744('0x4e')];_0xe1c2e4[_0x6744('0x49')][_0x6744('0x2c')]=_0xe1c2e4[_0x6744('0x4c')]['mimetype'];return db[_0x6744('0x2a')]['create'](_0xe1c2e4[_0x6744('0x49')])[_0x6744('0x23')](respondWithResult(_0x452509,0xc9))[_0x6744('0x41')](handleError(_0x452509,null));};exports[_0x6744('0x4f')]=function(_0x5f2124,_0x2af54b,_0x408cca){return db[_0x6744('0x2a')]['findOne']({'where':{'id':_0x5f2124[_0x6744('0x44')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x2af54b,null))[_0x6744('0x23')](function(_0x31dfba){if(_0x31dfba){var _0x5331a6=_0x31dfba[_0x6744('0x50')]!==null;var _0x2df9ab=path[_0x6744('0x51')](config[_0x6744('0x52')],'server/files/attachments/');if(_0x5331a6){_0x2df9ab=path[_0x6744('0x51')](_0x2df9ab,'offline-chat/');}var _0x1f5f39=path['join'](_0x2df9ab,_0x31dfba['basename']);return _0x2af54b[_0x6744('0x4f')](_0x1f5f39);}})[_0x6744('0x41')](handleError(_0x2af54b,null));}; \ No newline at end of file +var _0xcb53=['then','error','stack','name','send','index','Attachment','rawAttributes','fieldName','key','model','map','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','sort','where','pick','merge','type','VIRTUAL','filter','includeAll','include','findAll','rows','catch','show','keys','length','options','find','omit','createdAt','body','create','params','file','originalname','basename','filename','mimetype','download','findOne','ChatOfflineMessageId','join','root','offline-chat/','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update'];(function(_0x1a0667,_0x31adbd){var _0x39475a=function(_0x561478){while(--_0x561478){_0x1a0667['push'](_0x1a0667['shift']());}};_0x39475a(++_0x31adbd);}(_0xcb53,0xe6));var _0x3cb5=function(_0xc98184,_0x5adfa4){_0xc98184=_0xc98184-0x0;var _0x1d7c75=_0xcb53[_0xc98184];return _0x1d7c75;};'use strict';var emlformat=require(_0x3cb5('0x0'));var rimraf=require(_0x3cb5('0x1'));var zipdir=require(_0x3cb5('0x2'));var jsonpatch=require(_0x3cb5('0x3'));var rp=require(_0x3cb5('0x4'));var moment=require(_0x3cb5('0x5'));var BPromise=require(_0x3cb5('0x6'));var Mustache=require(_0x3cb5('0x7'));var util=require('util');var path=require(_0x3cb5('0x8'));var sox=require(_0x3cb5('0x9'));var csv=require(_0x3cb5('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3cb5('0xb'));var _=require('lodash');var squel=require(_0x3cb5('0xc'));var crypto=require(_0x3cb5('0xd'));var jsforce=require(_0x3cb5('0xe'));var deskjs=require(_0x3cb5('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x3cb5('0x10'));var Redis=require(_0x3cb5('0x11'));var authService=require(_0x3cb5('0x12'));var qs=require(_0x3cb5('0x13'));var as=require(_0x3cb5('0x14'));var hardwareService=require(_0x3cb5('0x15'));var logger=require('../../config/logger')(_0x3cb5('0x16'));var utils=require(_0x3cb5('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x3cb5('0x18'))['db'];function respondWithStatusCode(_0x3846c6,_0x3515bd){_0x3515bd=_0x3515bd||0xcc;return function(_0x34be3c){if(_0x34be3c){return _0x3846c6[_0x3cb5('0x19')](_0x3515bd);}return _0x3846c6[_0x3cb5('0x1a')](_0x3515bd)['end']();};}function respondWithResult(_0x5cc097,_0x3bbdc4){_0x3bbdc4=_0x3bbdc4||0xc8;return function(_0x3f0603){if(_0x3f0603){return _0x5cc097[_0x3cb5('0x1a')](_0x3bbdc4)[_0x3cb5('0x1b')](_0x3f0603);}};}function respondWithFilteredResult(_0x101c2a,_0x523582){return function(_0x2e62b4){if(_0x2e62b4){var _0x4d407b=typeof _0x523582[_0x3cb5('0x1c')]===_0x3cb5('0x1d')&&typeof _0x523582[_0x3cb5('0x1e')]==='undefined';var _0x3a6de5=_0x2e62b4[_0x3cb5('0x1f')];var _0x222638=_0x4d407b?0x0:_0x523582[_0x3cb5('0x1c')];var _0x5ab7d=_0x4d407b?_0x2e62b4[_0x3cb5('0x1f')]:_0x523582[_0x3cb5('0x1c')]+_0x523582[_0x3cb5('0x1e')];var _0x46cae1;if(_0x5ab7d>=_0x3a6de5){_0x5ab7d=_0x3a6de5;_0x46cae1=0xc8;}else{_0x46cae1=0xce;}_0x101c2a['status'](_0x46cae1);return _0x101c2a[_0x3cb5('0x20')](_0x3cb5('0x21'),_0x222638+'-'+_0x5ab7d+'/'+_0x3a6de5)[_0x3cb5('0x1b')](_0x2e62b4);}return null;};}function patchUpdates(_0x53d40d){return function(_0x160ce8){try{jsonpatch['apply'](_0x160ce8,_0x53d40d,!![]);}catch(_0x273985){return BPromise[_0x3cb5('0x22')](_0x273985);}return _0x160ce8[_0x3cb5('0x23')]();};}function saveUpdates(_0x5859a0,_0x5750b2){return function(_0x412306){if(_0x412306){return _0x412306[_0x3cb5('0x24')](_0x5859a0)['then'](function(_0x36c044){return _0x36c044;});}return null;};}function removeEntity(_0x306842,_0x3ddb6c){return function(_0x67fcf3){if(_0x67fcf3){return _0x67fcf3['destroy']()[_0x3cb5('0x25')](function(){_0x306842[_0x3cb5('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1a7a74,_0x43775d){return function(_0x4c1dda){if(!_0x4c1dda){_0x1a7a74['sendStatus'](0x194);}return _0x4c1dda;};}function handleError(_0x1ea89f,_0x458a8a){_0x458a8a=_0x458a8a||0x1f4;return function(_0x5b41eb){logger[_0x3cb5('0x26')](_0x5b41eb[_0x3cb5('0x27')]);if(_0x5b41eb[_0x3cb5('0x28')]){delete _0x5b41eb[_0x3cb5('0x28')];}_0x1ea89f[_0x3cb5('0x1a')](_0x458a8a)[_0x3cb5('0x29')](_0x5b41eb);};}exports[_0x3cb5('0x2a')]=function(_0x5eb8ad,_0x44c863){var _0x18aad2={},_0x1187a0={},_0x135cd0={'count':0x0,'rows':[]};var _0x265634=_['map'](db[_0x3cb5('0x2b')][_0x3cb5('0x2c')],function(_0x5dcdb8){return{'name':_0x5dcdb8[_0x3cb5('0x2d')],'type':_0x5dcdb8['type'][_0x3cb5('0x2e')]};});_0x1187a0[_0x3cb5('0x2f')]=_[_0x3cb5('0x30')](_0x265634,_0x3cb5('0x28'));_0x1187a0[_0x3cb5('0x31')]=_['keys'](_0x5eb8ad[_0x3cb5('0x31')]);_0x1187a0[_0x3cb5('0x32')]=_['intersection'](_0x1187a0['model'],_0x1187a0[_0x3cb5('0x31')]);_0x18aad2[_0x3cb5('0x33')]=_[_0x3cb5('0x34')](_0x1187a0[_0x3cb5('0x2f')],qs[_0x3cb5('0x35')](_0x5eb8ad[_0x3cb5('0x31')][_0x3cb5('0x35')]));_0x18aad2['attributes']=_0x18aad2[_0x3cb5('0x33')]['length']?_0x18aad2[_0x3cb5('0x33')]:_0x1187a0[_0x3cb5('0x2f')];if(!_0x5eb8ad[_0x3cb5('0x31')][_0x3cb5('0x36')](_0x3cb5('0x37'))){_0x18aad2[_0x3cb5('0x1e')]=qs[_0x3cb5('0x1e')](_0x5eb8ad[_0x3cb5('0x31')][_0x3cb5('0x1e')]);_0x18aad2[_0x3cb5('0x1c')]=qs[_0x3cb5('0x1c')](_0x5eb8ad[_0x3cb5('0x31')][_0x3cb5('0x1c')]);}_0x18aad2['order']=qs[_0x3cb5('0x38')](_0x5eb8ad['query'][_0x3cb5('0x38')]);_0x18aad2[_0x3cb5('0x39')]=qs[_0x3cb5('0x32')](_[_0x3cb5('0x3a')](_0x5eb8ad[_0x3cb5('0x31')],_0x1187a0[_0x3cb5('0x32')]),_0x265634);if(_0x5eb8ad[_0x3cb5('0x31')]['filter']){_0x18aad2[_0x3cb5('0x39')]=_[_0x3cb5('0x3b')](_0x18aad2['where'],{'$or':_[_0x3cb5('0x30')](_0x265634,function(_0x2ac2f7){if(_0x2ac2f7[_0x3cb5('0x3c')]!==_0x3cb5('0x3d')){var _0x1f40ec={};_0x1f40ec[_0x2ac2f7[_0x3cb5('0x28')]]={'$like':'%'+_0x5eb8ad[_0x3cb5('0x31')][_0x3cb5('0x3e')]+'%'};return _0x1f40ec;}})});}_0x18aad2=_['merge']({},_0x18aad2,_0x5eb8ad['options']);var _0x47527d={'where':_0x18aad2[_0x3cb5('0x39')]};return db[_0x3cb5('0x2b')][_0x3cb5('0x1f')](_0x47527d)[_0x3cb5('0x25')](function(_0x53c7ee){_0x135cd0['count']=_0x53c7ee;if(_0x5eb8ad[_0x3cb5('0x31')][_0x3cb5('0x3f')]){_0x18aad2[_0x3cb5('0x40')]=[{'all':!![]}];}return db[_0x3cb5('0x2b')][_0x3cb5('0x41')](_0x18aad2);})['then'](function(_0x21116f){_0x135cd0[_0x3cb5('0x42')]=_0x21116f;return _0x135cd0;})[_0x3cb5('0x25')](respondWithFilteredResult(_0x44c863,_0x18aad2))[_0x3cb5('0x43')](handleError(_0x44c863,null));};exports[_0x3cb5('0x44')]=function(_0x122427,_0x52695b){var _0x2277db={'raw':!![],'where':{'id':_0x122427['params']['id']}},_0x57ddd0={};_0x57ddd0[_0x3cb5('0x2f')]=_[_0x3cb5('0x45')](db[_0x3cb5('0x2b')][_0x3cb5('0x2c')]);_0x57ddd0[_0x3cb5('0x31')]=_[_0x3cb5('0x45')](_0x122427[_0x3cb5('0x31')]);_0x57ddd0['filters']=_['intersection'](_0x57ddd0[_0x3cb5('0x2f')],_0x57ddd0[_0x3cb5('0x31')]);_0x2277db[_0x3cb5('0x33')]=_[_0x3cb5('0x34')](_0x57ddd0[_0x3cb5('0x2f')],qs['fields'](_0x122427['query'][_0x3cb5('0x35')]));_0x2277db[_0x3cb5('0x33')]=_0x2277db[_0x3cb5('0x33')][_0x3cb5('0x46')]?_0x2277db[_0x3cb5('0x33')]:_0x57ddd0[_0x3cb5('0x2f')];if(_0x122427['query']['includeAll']){_0x2277db['include']=[{'all':!![]}];}_0x2277db=_[_0x3cb5('0x3b')]({},_0x2277db,_0x122427[_0x3cb5('0x47')]);return db[_0x3cb5('0x2b')][_0x3cb5('0x48')](_0x2277db)['then'](handleEntityNotFound(_0x52695b,null))[_0x3cb5('0x25')](respondWithResult(_0x52695b,null))[_0x3cb5('0x43')](handleError(_0x52695b,null));};exports['clone']=function(_0x449248,_0x48823e){var _0x2807fb={'where':{'id':_0x449248['params']['id']}},_0x95c08e={};_0x95c08e[_0x3cb5('0x2f')]=_['keys'](db[_0x3cb5('0x2b')]['rawAttributes']);_0x2807fb['attributes']=_['intersection'](_0x95c08e[_0x3cb5('0x2f')],qs[_0x3cb5('0x35')](_0x449248[_0x3cb5('0x31')][_0x3cb5('0x35')]));_0x2807fb['attributes']=_0x2807fb[_0x3cb5('0x33')][_0x3cb5('0x46')]?_0x2807fb[_0x3cb5('0x33')]:_0x95c08e[_0x3cb5('0x2f')];if(_0x449248[_0x3cb5('0x31')][_0x3cb5('0x3f')]){_0x2807fb[_0x3cb5('0x40')]=[{'all':!![]}];}_0x2807fb=_[_0x3cb5('0x3b')]({},_0x2807fb,_0x449248['options']);return db[_0x3cb5('0x2b')][_0x3cb5('0x48')](_0x2807fb)['then'](handleEntityNotFound(_0x48823e,null))[_0x3cb5('0x25')](function(_0x1a1a12){if(_0x1a1a12){var _0x1460c0=_0x1a1a12['get']({'plain':!![]});_0x1460c0=qs[_0x3cb5('0x49')](_0x1460c0,['id',_0x3cb5('0x4a'),'updatedAt']);_0x449248[_0x3cb5('0x4b')]=_['omit'](_0x449248['body'],['id',_0x3cb5('0x4a'),'updatedAt']);return db[_0x3cb5('0x2b')][_0x3cb5('0x4c')](_[_0x3cb5('0x3b')](_0x1460c0,_0x449248[_0x3cb5('0x4b')]),{'include':_0x449248[_0x3cb5('0x31')][_0x3cb5('0x3f')]?[{'all':!![]}]:undefined});}})[_0x3cb5('0x25')](respondWithResult(_0x48823e,0xc9))[_0x3cb5('0x43')](handleError(_0x48823e,null));};exports[_0x3cb5('0x24')]=function(_0x1607af,_0x17922e){if(_0x1607af[_0x3cb5('0x4b')]['id']){delete _0x1607af['body']['id'];}return db['Attachment'][_0x3cb5('0x48')]({'where':{'id':_0x1607af[_0x3cb5('0x4d')]['id']}})[_0x3cb5('0x25')](handleEntityNotFound(_0x17922e,null))[_0x3cb5('0x25')](saveUpdates(_0x1607af[_0x3cb5('0x4b')],null))[_0x3cb5('0x25')](respondWithResult(_0x17922e,null))[_0x3cb5('0x43')](handleError(_0x17922e,null));};exports['destroy']=function(_0x13ca01,_0x1be727){return db['Attachment'][_0x3cb5('0x48')]({'where':{'id':_0x13ca01['params']['id']}})[_0x3cb5('0x25')](handleEntityNotFound(_0x1be727,null))[_0x3cb5('0x25')](removeEntity(_0x1be727,null))[_0x3cb5('0x43')](handleError(_0x1be727,null));};exports[_0x3cb5('0x4c')]=function(_0x69cbe3,_0x2f0cac,_0x626b2c){_0x69cbe3['body']['name']=_0x69cbe3[_0x3cb5('0x4e')][_0x3cb5('0x4f')];_0x69cbe3[_0x3cb5('0x4b')][_0x3cb5('0x50')]=_0x69cbe3[_0x3cb5('0x4e')][_0x3cb5('0x51')];_0x69cbe3[_0x3cb5('0x4b')][_0x3cb5('0x3c')]=_0x69cbe3[_0x3cb5('0x4e')][_0x3cb5('0x52')];return db['Attachment'][_0x3cb5('0x4c')](_0x69cbe3[_0x3cb5('0x4b')])[_0x3cb5('0x25')](respondWithResult(_0x2f0cac,0xc9))[_0x3cb5('0x43')](handleError(_0x2f0cac,null));};exports[_0x3cb5('0x53')]=function(_0x4f4ec2,_0x194191,_0x505332){return db['Attachment'][_0x3cb5('0x54')]({'where':{'id':_0x4f4ec2[_0x3cb5('0x4d')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x194191,null))['then'](function(_0x275f32){if(_0x275f32){var _0x2b31d5=_0x275f32[_0x3cb5('0x55')]!==null;var _0x31e82c=path[_0x3cb5('0x56')](config[_0x3cb5('0x57')],'server/files/attachments/');if(_0x2b31d5){_0x31e82c=path['join'](_0x31e82c,_0x3cb5('0x58'));}var _0x5bc453=path[_0x3cb5('0x56')](_0x31e82c,_0x275f32['basename']);return _0x194191[_0x3cb5('0x53')](_0x5bc453);}})[_0x3cb5('0x43')](handleError(_0x194191,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index e6fc8c7..7789b90 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 _0x6982=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./attachment.attributes','exports','Attachment','attachments','util','../../config/logger'];(function(_0x33d97a,_0x2b0786){var _0x4580b7=function(_0xb0b9d4){while(--_0xb0b9d4){_0x33d97a['push'](_0x33d97a['shift']());}};_0x4580b7(++_0x2b0786);}(_0x6982,0x15d));var _0x2698=function(_0x5a8d19,_0x21a494){_0x5a8d19=_0x5a8d19-0x0;var _0x23c925=_0x6982[_0x5a8d19];return _0x23c925;};'use strict';var _=require('lodash');var util=require(_0x2698('0x0'));var logger=require(_0x2698('0x1'))(_0x2698('0x2'));var moment=require(_0x2698('0x3'));var BPromise=require(_0x2698('0x4'));var rp=require(_0x2698('0x5'));var fs=require('fs');var path=require(_0x2698('0x6'));var rimraf=require(_0x2698('0x7'));var config=require(_0x2698('0x8'));var attributes=require(_0x2698('0x9'));module[_0x2698('0xa')]=function(_0x52346a,_0x446e5b){return _0x52346a['define'](_0x2698('0xb'),attributes,{'tableName':_0x2698('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0725=['exports','define','attachments','util','api','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x223a26,_0xfa7d3f){var _0x46f8d2=function(_0x3ddc3f){while(--_0x3ddc3f){_0x223a26['push'](_0x223a26['shift']());}};_0x46f8d2(++_0xfa7d3f);}(_0x0725,0x1aa));var _0x5072=function(_0x212d49,_0x1121d6){_0x212d49=_0x212d49-0x0;var _0x272fce=_0x0725[_0x212d49];return _0x272fce;};'use strict';var _=require('lodash');var util=require(_0x5072('0x0'));var logger=require('../../config/logger')(_0x5072('0x1'));var moment=require('moment');var BPromise=require(_0x5072('0x2'));var rp=require(_0x5072('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5072('0x4'));var config=require(_0x5072('0x5'));var attributes=require('./attachment.attributes');module[_0x5072('0x6')]=function(_0x2b39f1,_0x13904a){return _0x2b39f1[_0x5072('0x7')]('Attachment',attributes,{'tableName':_0x5072('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/attachment/attachment.rpc.js b/server/api/attachment/attachment.rpc.js index 3181132..2e19925 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 _0xb0d9=['Attachment,\x20%s,\x20%s','debug','Attachment,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','catch','CreateAttachment','Attachment','create','body','options','raw','then','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','jayson/promise','client','http','request','info'];(function(_0x715d76,_0x402d60){var _0x48fe88=function(_0x4dd0ea){while(--_0x4dd0ea){_0x715d76['push'](_0x715d76['shift']());}};_0x48fe88(++_0x402d60);}(_0xb0d9,0x10c));var _0x9b0d=function(_0x347528,_0x19e795){_0x347528=_0x347528-0x0;var _0x481de7=_0xb0d9[_0x347528];return _0x481de7;};'use strict';var _=require(_0x9b0d('0x0'));var util=require(_0x9b0d('0x1'));var moment=require(_0x9b0d('0x2'));var BPromise=require(_0x9b0d('0x3'));var rs=require(_0x9b0d('0x4'));var fs=require('fs');var Redis=require(_0x9b0d('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x9b0d('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x9b0d('0x7'));var client=jayson[_0x9b0d('0x8')][_0x9b0d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x438e0a,_0x2c519d,_0x45c371){return new BPromise(function(_0x32ee67,_0x30cd11){return client[_0x9b0d('0xa')](_0x438e0a,_0x45c371)['then'](function(_0x479a06){logger[_0x9b0d('0xb')](_0x9b0d('0xc'),_0x2c519d,'request\x20sent');logger[_0x9b0d('0xd')](_0x9b0d('0xe'),_0x2c519d,'request\x20sent',JSON[_0x9b0d('0xf')](_0x479a06));if(_0x479a06[_0x9b0d('0x10')]){if(_0x479a06['error'][_0x9b0d('0x11')]===0x1f4){logger['error'](_0x9b0d('0xc'),_0x2c519d,_0x479a06[_0x9b0d('0x10')][_0x9b0d('0x12')]);return _0x30cd11(_0x479a06['error'][_0x9b0d('0x12')]);}logger['error'](_0x9b0d('0xc'),_0x2c519d,_0x479a06[_0x9b0d('0x10')]['message']);return _0x32ee67(_0x479a06[_0x9b0d('0x10')]['message']);}else{logger[_0x9b0d('0xb')](_0x9b0d('0xc'),_0x2c519d,_0x9b0d('0x13'));_0x32ee67(_0x479a06['result'][_0x9b0d('0x12')]);}})[_0x9b0d('0x14')](function(_0x49db91){logger['error']('Attachment,\x20%s,\x20%s',_0x2c519d,_0x49db91);_0x30cd11(_0x49db91);});});}exports[_0x9b0d('0x15')]=function(_0xd8bb89){var _0x41a5e2=this;return new Promise(function(_0x27ee1a,_0x54ccf1){return db[_0x9b0d('0x16')][_0x9b0d('0x17')](_0xd8bb89[_0x9b0d('0x18')],{'raw':_0xd8bb89[_0x9b0d('0x19')]?_0xd8bb89['options'][_0x9b0d('0x1a')]===undefined?!![]:![]:!![]})[_0x9b0d('0x1b')](function(_0xe5fb08){logger[_0x9b0d('0xb')](_0x9b0d('0x15'),_0xd8bb89);logger['debug'](_0x9b0d('0x15'),_0xd8bb89,JSON[_0x9b0d('0xf')](_0xe5fb08));_0x27ee1a(_0xe5fb08);})[_0x9b0d('0x14')](function(_0x14c01b){logger[_0x9b0d('0x10')](_0x9b0d('0x15'),_0x14c01b[_0x9b0d('0x12')],_0xd8bb89);_0x54ccf1(_0x41a5e2[_0x9b0d('0x10')](0x1f4,_0x14c01b[_0x9b0d('0x12')]));});});}; \ No newline at end of file +var _0x222f=['lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','Attachment,\x20%s,\x20%s','request\x20sent','Attachment,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateAttachment','Attachment','body','options','raw','debug'];(function(_0x484508,_0x217c0e){var _0x141ef5=function(_0x26fdef){while(--_0x26fdef){_0x484508['push'](_0x484508['shift']());}};_0x141ef5(++_0x217c0e);}(_0x222f,0x1a4));var _0xf222=function(_0x33c9f8,_0x5aedbb){_0x33c9f8=_0x33c9f8-0x0;var _0x2d7004=_0x222f[_0x33c9f8];return _0x2d7004;};'use strict';var _=require(_0xf222('0x0'));var util=require(_0xf222('0x1'));var moment=require(_0xf222('0x2'));var BPromise=require(_0xf222('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf222('0x4'))['db'];var utils=require(_0xf222('0x5'));var logger=require(_0xf222('0x6'))(_0xf222('0x7'));var config=require('../../config/environment');var jayson=require(_0xf222('0x8'));var client=jayson['client'][_0xf222('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x26f129,_0x518ebb,_0xf5a105){return new BPromise(function(_0x302d7a,_0x4aceb4){return client[_0xf222('0xa')](_0x26f129,_0xf5a105)[_0xf222('0xb')](function(_0x878804){logger[_0xf222('0xc')](_0xf222('0xd'),_0x518ebb,_0xf222('0xe'));logger['debug'](_0xf222('0xf'),_0x518ebb,_0xf222('0xe'),JSON[_0xf222('0x10')](_0x878804));if(_0x878804[_0xf222('0x11')]){if(_0x878804['error'][_0xf222('0x12')]===0x1f4){logger[_0xf222('0x11')](_0xf222('0xd'),_0x518ebb,_0x878804[_0xf222('0x11')][_0xf222('0x13')]);return _0x4aceb4(_0x878804[_0xf222('0x11')][_0xf222('0x13')]);}logger[_0xf222('0x11')]('Attachment,\x20%s,\x20%s',_0x518ebb,_0x878804['error'][_0xf222('0x13')]);return _0x302d7a(_0x878804[_0xf222('0x11')]['message']);}else{logger[_0xf222('0xc')](_0xf222('0xd'),_0x518ebb,_0xf222('0xe'));_0x302d7a(_0x878804[_0xf222('0x14')][_0xf222('0x13')]);}})[_0xf222('0x15')](function(_0x30b646){logger['error'](_0xf222('0xd'),_0x518ebb,_0x30b646);_0x4aceb4(_0x30b646);});});}exports[_0xf222('0x16')]=function(_0x8783ab){var _0xfb4ddf=this;return new Promise(function(_0x12a2e4,_0x1e57ee){return db[_0xf222('0x17')]['create'](_0x8783ab[_0xf222('0x18')],{'raw':_0x8783ab[_0xf222('0x19')]?_0x8783ab[_0xf222('0x19')][_0xf222('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x5cd899){logger[_0xf222('0xc')](_0xf222('0x16'),_0x8783ab);logger[_0xf222('0x1b')](_0xf222('0x16'),_0x8783ab,JSON[_0xf222('0x10')](_0x5cd899));_0x12a2e4(_0x5cd899);})[_0xf222('0x15')](function(_0x51b872){logger[_0xf222('0x11')](_0xf222('0x16'),_0x51b872[_0xf222('0x13')],_0x8783ab);_0x1e57ee(_0xfb4ddf[_0xf222('0x11')](0x1f4,_0x51b872[_0xf222('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index 199e745..27771ff 100644 --- a/server/api/attachment/index.js +++ b/server/api/attachment/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f66=['fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/download','/:id/clone','clone','diskStorage','root','format','%s-%s','now','originalname','replace','post','single','file','create','delete','destroy','exports','util','connect-timeout','express','Router'];(function(_0x354164,_0x4c30de){var _0x5db9a8=function(_0x319b08){while(--_0x319b08){_0x354164['push'](_0x354164['shift']());}};_0x5db9a8(++_0x4c30de);}(_0x5f66,0x1a0));var _0x65f6=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x5f66[_0x502c7d];return _0x30b7ed;};'use strict';var multer=require('multer');var util=require(_0x65f6('0x0'));var path=require('path');var timeout=require(_0x65f6('0x1'));var express=require(_0x65f6('0x2'));var router=express[_0x65f6('0x3')]();var fs_extra=require(_0x65f6('0x4'));var auth=require(_0x65f6('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x65f6('0x6'));var controller=require('./attachment.controller');router[_0x65f6('0x7')]('/',auth[_0x65f6('0x8')](),controller['index']);router['get'](_0x65f6('0x9'),auth[_0x65f6('0x8')](),controller[_0x65f6('0xa')]);router[_0x65f6('0x7')](_0x65f6('0xb'),auth[_0x65f6('0x8')](),controller['download']);router['post'](_0x65f6('0xc'),auth[_0x65f6('0x8')](),controller[_0x65f6('0xd')]);var upload=multer({'storage':multer[_0x65f6('0xe')]({'destination':function(_0x50d26d,_0x41a7fd,_0x571436){_0x571436(null,path['join'](config[_0x65f6('0xf')],'server/files/attachments/'));},'filename':function(_0x419819,_0x4862a5,_0x2f964a){_0x2f964a(null,util[_0x65f6('0x10')](_0x65f6('0x11'),Date[_0x65f6('0x12')](),_0x4862a5[_0x65f6('0x13')][_0x65f6('0x14')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x65f6('0x15')]('/',upload[_0x65f6('0x16')](_0x65f6('0x17')),controller[_0x65f6('0x18')]);router['put'](_0x65f6('0x9'),auth['isAuthenticated'](),controller['update']);router[_0x65f6('0x19')](_0x65f6('0x9'),auth[_0x65f6('0x8')](),controller[_0x65f6('0x1a')]);module[_0x65f6('0x1b')]=router; \ No newline at end of file +var _0xadb5=['root','format','%s-%s','originalname','replace','file','put','update','delete','destroy','exports','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/download','download','post','/:id/clone'];(function(_0x3c7371,_0x4508f6){var _0x220298=function(_0x3d1d70){while(--_0x3d1d70){_0x3c7371['push'](_0x3c7371['shift']());}};_0x220298(++_0x4508f6);}(_0xadb5,0xad));var _0x5adb=function(_0xfa8d75,_0xfc2844){_0xfa8d75=_0xfa8d75-0x0;var _0xe03c2d=_0xadb5[_0xfa8d75];return _0xe03c2d;};'use strict';var multer=require('multer');var util=require(_0x5adb('0x0'));var path=require('path');var timeout=require(_0x5adb('0x1'));var express=require(_0x5adb('0x2'));var router=express[_0x5adb('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x5adb('0x4'));var interaction=require(_0x5adb('0x5'));var config=require(_0x5adb('0x6'));var controller=require('./attachment.controller');router[_0x5adb('0x7')]('/',auth[_0x5adb('0x8')](),controller[_0x5adb('0x9')]);router[_0x5adb('0x7')](_0x5adb('0xa'),auth[_0x5adb('0x8')](),controller[_0x5adb('0xb')]);router[_0x5adb('0x7')](_0x5adb('0xc'),auth[_0x5adb('0x8')](),controller[_0x5adb('0xd')]);router[_0x5adb('0xe')](_0x5adb('0xf'),auth[_0x5adb('0x8')](),controller['clone']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x1a8f66,_0x1ea238,_0x82e67e){_0x82e67e(null,path['join'](config[_0x5adb('0x10')],'server/files/attachments/'));},'filename':function(_0x2a0b70,_0x5433bf,_0x8cfcc6){_0x8cfcc6(null,util[_0x5adb('0x11')](_0x5adb('0x12'),Date['now'](),_0x5433bf[_0x5adb('0x13')][_0x5adb('0x14')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x5adb('0xe')]('/',upload['single'](_0x5adb('0x15')),controller['create']);router[_0x5adb('0x16')](_0x5adb('0xa'),auth[_0x5adb('0x8')](),controller[_0x5adb('0x17')]);router[_0x5adb('0x18')](_0x5adb('0xa'),auth[_0x5adb('0x8')](),controller[_0x5adb('0x19')]);module[_0x5adb('0x1a')]=router; \ No newline at end of file diff --git a/server/api/authGoogle/authGoogle.controller.js b/server/api/authGoogle/authGoogle.controller.js index a78a39e..96d93a4 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 _0x53d0=['../../config/environment','../../components/auth/service','signToken','../../config/utils','login','authenticate','google','profile','email','callback','/login','use','clientID','clientSecret','secret','Setting','findOne','allowedLoginAttempts','blockDuration','then','map','emails','admin','user','agent','disabled','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blocked','blockedAt','add','minutes','getLicense','passport','passport-google-oauth20','moment','../../mysqldb'];(function(_0x130209,_0x2cc129){var _0x155fb7=function(_0x891a60){while(--_0x891a60){_0x130209['push'](_0x130209['shift']());}};_0x155fb7(++_0x2cc129);}(_0x53d0,0x8c));var _0x053d=function(_0x114c76,_0xc937df){_0x114c76=_0x114c76-0x0;var _0xb5babf=_0x53d0[_0x114c76];return _0xb5babf;};'use strict';var _=require('lodash');var passport=require(_0x053d('0x0'));var GoogleStrategy=require(_0x053d('0x1'))['Strategy'];var moment=require(_0x053d('0x2'));var db=require(_0x053d('0x3'))['db'];var config=require(_0x053d('0x4'));var signToken=require(_0x053d('0x5'))[_0x053d('0x6')];var utils=require(_0x053d('0x7'));exports[_0x053d('0x8')]=passport[_0x053d('0x9')](_0x053d('0xa'),{'failureRedirect':'/login','scope':[_0x053d('0xb'),_0x053d('0xc')],'session':![]});exports[_0x053d('0xd')]=passport['authenticate'](_0x053d('0xa'),{'failureRedirect':_0x053d('0xe'),'session':![]});passport[_0x053d('0xf')](new GoogleStrategy({'clientID':config['google']?config['google'][_0x053d('0x10')]:'id','clientSecret':config[_0x053d('0xa')]?config[_0x053d('0xa')][_0x053d('0x11')]:_0x053d('0x12'),'callbackURL':config[_0x053d('0xa')]?config[_0x053d('0xa')]['callbackURL']:''},function(_0x372a67,_0x1832bf,_0x44a7f9,_0x1768a3){var _0x2a4724,_0x21492e;return db[_0x053d('0x13')][_0x053d('0x14')]({'where':{'id':0x1},'attributes':[_0x053d('0x15'),_0x053d('0x16')],'raw':!![]})[_0x053d('0x17')](function(_0x37ef8b){_0x2a4724=_0x37ef8b;return db['User']['find']({'where':{'email':_[_0x053d('0x18')](_0x44a7f9[_0x053d('0x19')],'value'),'role':{'$or':[_0x053d('0x1a'),_0x053d('0x1b'),_0x053d('0x1c')]}}});})[_0x053d('0x17')](function(_0x22103b){_0x21492e=_0x22103b;if(_0x21492e){if(_0x21492e[_0x053d('0x1d')]){return _0x1768a3(_0x053d('0x1e'));}else if(_0x2a4724[_0x053d('0x16')]>0x0){if(_0x21492e[_0x053d('0x1f')]){if(moment(_0x21492e[_0x053d('0x20')])[_0x053d('0x21')](_0x2a4724['blockDuration'],_0x053d('0x22'))>moment()){return _0x1768a3(_0x053d('0x1e'));}else{return utils['clearBlockUser'](_0x21492e,0x0,![],null)[_0x053d('0x17')](function(){return utils[_0x053d('0x23')](_0x21492e);})[_0x053d('0x17')](function(){return _0x1768a3(null,_0x21492e);});}}else{return utils[_0x053d('0x23')](_0x21492e)['then'](function(){return _0x1768a3(null,_0x21492e);});}}else{return utils[_0x053d('0x23')](_0x21492e)[_0x053d('0x17')](function(){return _0x1768a3(null,_0x21492e);});}}return _0x1768a3(_0x053d('0x1e'));})['catch'](function(_0x2f2ff2){_0x1768a3(_0x2f2ff2);});})); \ No newline at end of file +var _0xdc7a=['lodash','passport','passport-google-oauth20','../../mysqldb','../../components/auth/service','signToken','../../config/utils','login','authenticate','google','/login','profile','email','use','clientID','clientSecret','secret','callbackURL','Setting','findOne','allowedLoginAttempts','blockDuration','find','map','emails','value','admin','user','agent','then','disabled','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','add','minutes','getLicense'];(function(_0x4d4576,_0x373606){var _0x437769=function(_0x4fee50){while(--_0x4fee50){_0x4d4576['push'](_0x4d4576['shift']());}};_0x437769(++_0x373606);}(_0xdc7a,0x8c));var _0xadc7=function(_0x174728,_0x205bb4){_0x174728=_0x174728-0x0;var _0x53e467=_0xdc7a[_0x174728];return _0x53e467;};'use strict';var _=require(_0xadc7('0x0'));var passport=require(_0xadc7('0x1'));var GoogleStrategy=require(_0xadc7('0x2'))['Strategy'];var moment=require('moment');var db=require(_0xadc7('0x3'))['db'];var config=require('../../config/environment');var signToken=require(_0xadc7('0x4'))[_0xadc7('0x5')];var utils=require(_0xadc7('0x6'));exports[_0xadc7('0x7')]=passport[_0xadc7('0x8')](_0xadc7('0x9'),{'failureRedirect':_0xadc7('0xa'),'scope':[_0xadc7('0xb'),_0xadc7('0xc')],'session':![]});exports['callback']=passport[_0xadc7('0x8')]('google',{'failureRedirect':_0xadc7('0xa'),'session':![]});passport[_0xadc7('0xd')](new GoogleStrategy({'clientID':config[_0xadc7('0x9')]?config['google'][_0xadc7('0xe')]:'id','clientSecret':config[_0xadc7('0x9')]?config[_0xadc7('0x9')][_0xadc7('0xf')]:_0xadc7('0x10'),'callbackURL':config[_0xadc7('0x9')]?config[_0xadc7('0x9')][_0xadc7('0x11')]:''},function(_0x342eb6,_0x3d8e59,_0x5b0a99,_0x5e7506){var _0x135394,_0x42c91c;return db[_0xadc7('0x12')][_0xadc7('0x13')]({'where':{'id':0x1},'attributes':[_0xadc7('0x14'),_0xadc7('0x15')],'raw':!![]})['then'](function(_0x416f64){_0x135394=_0x416f64;return db['User'][_0xadc7('0x16')]({'where':{'email':_[_0xadc7('0x17')](_0x5b0a99[_0xadc7('0x18')],_0xadc7('0x19')),'role':{'$or':[_0xadc7('0x1a'),_0xadc7('0x1b'),_0xadc7('0x1c')]}}});})[_0xadc7('0x1d')](function(_0x1fca4e){_0x42c91c=_0x1fca4e;if(_0x42c91c){if(_0x42c91c[_0xadc7('0x1e')]){return _0x5e7506(_0xadc7('0x1f'));}else if(_0x135394[_0xadc7('0x15')]>0x0){if(_0x42c91c['blocked']){if(moment(_0x42c91c['blockedAt'])[_0xadc7('0x20')](_0x135394[_0xadc7('0x15')],_0xadc7('0x21'))>moment()){return _0x5e7506(_0xadc7('0x1f'));}else{return utils['clearBlockUser'](_0x42c91c,0x0,![],null)['then'](function(){return utils[_0xadc7('0x22')](_0x42c91c);})[_0xadc7('0x1d')](function(){return _0x5e7506(null,_0x42c91c);});}}else{return utils['getLicense'](_0x42c91c)[_0xadc7('0x1d')](function(){return _0x5e7506(null,_0x42c91c);});}}else{return utils[_0xadc7('0x22')](_0x42c91c)['then'](function(){return _0x5e7506(null,_0x42c91c);});}}return _0x5e7506('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');})['catch'](function(_0x42294a){_0x5e7506(_0x42294a);});})); \ No newline at end of file diff --git a/server/api/authGoogle/index.js b/server/api/authGoogle/index.js index fb92233..07970ab 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 _0xea52=['isMiddleware','setTokenCookie','exports','passport','Router','login','get','/callback','callback'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xea52,0x162));var _0x2ea5=function(_0x4007b1,_0x206901){_0x4007b1=_0x4007b1-0x0;var _0x108d6c=_0xea52[_0x4007b1];return _0x108d6c;};'use strict';var express=require('express');var passport=require(_0x2ea5('0x0'));var router=express[_0x2ea5('0x1')]();var controller=require('./authGoogle.controller');var userController=require('../user/user.controller.js');var authService=require('../../components/auth/service');router['get']('/',controller[_0x2ea5('0x2')]);router[_0x2ea5('0x3')](_0x2ea5('0x4'),controller[_0x2ea5('0x5')],authService[_0x2ea5('0x6')],userController['login'],authService[_0x2ea5('0x7')]);module[_0x2ea5('0x8')]=router; \ No newline at end of file +var _0xacde=['isMiddleware','login','exports','express','passport','Router','./authGoogle.controller','../../components/auth/service','get','callback'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0xacde,0x1cf));var _0xeacd=function(_0x5d160,_0xa4838e){_0x5d160=_0x5d160-0x0;var _0x1d180d=_0xacde[_0x5d160];return _0x1d180d;};'use strict';var express=require(_0xeacd('0x0'));var passport=require(_0xeacd('0x1'));var router=express[_0xeacd('0x2')]();var controller=require(_0xeacd('0x3'));var userController=require('../user/user.controller.js');var authService=require(_0xeacd('0x4'));router[_0xeacd('0x5')]('/',controller['login']);router['get']('/callback',controller[_0xeacd('0x6')],authService[_0xeacd('0x7')],userController[_0xeacd('0x8')],authService['setTokenCookie']);module[_0xeacd('0x9')]=router; \ No newline at end of file diff --git a/server/api/authLocal/authLocal.controller.js b/server/api/authLocal/authLocal.controller.js index 86ba300..31a90e8 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 _0x2697=['json','online','forgot','body','Email\x20parameter\x20is\x20missing','generate','trim','toLowerCase','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','resetPasswordExpires','xCally\x20Motion\x20Password\x20Reset','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','https://','headers','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','Reset\x20Email\x20sent!','catch','reset','User','params','token','now','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','enforcePasswordHistory','passwordHistoryLimit','validatePasswordPattern','validatePasswordHistory','password','previousPasswords','save','Password\x20reset!','use','passport','passport-local','Strategy','jayson/promise','lodash','moment','../../components/auth/service','../../config/utils','client','http','Setting','allowedLoginAttempts','blockDuration','name','salt','disabled','blocked','blockedAt','admin','user','then','authenticate','loginAttempts','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','add','clearBlockUser','minutes','getLicense','find','email','MailServerOut','Smtp','service','host','port','secure','auth','merge','format','\x22%s\x22\x20<%s>','request','SendMail','error','message','stringify','status','send','Something\x20went\x20wrong,\x20please\x20try\x20again.'];(function(_0x122e3d,_0x37718b){var _0xbb3437=function(_0xf749e){while(--_0xf749e){_0x122e3d['push'](_0x122e3d['shift']());}};_0xbb3437(++_0x37718b);}(_0x2697,0x120));var _0x7269=function(_0x4df85c,_0x248dfb){_0x4df85c=_0x4df85c-0x0;var _0x4e2a61=_0x2697[_0x4df85c];return _0x4e2a61;};'use strict';var util=require('util');var passport=require(_0x7269('0x0'));var LocalStrategy=require(_0x7269('0x1'))[_0x7269('0x2')];var jayson=require(_0x7269('0x3'));var _=require(_0x7269('0x4'));var rs=require('randomstring');var moment=require(_0x7269('0x5'));var db=require('../../mysqldb')['db'];var authService=require(_0x7269('0x6'));var utils=require(_0x7269('0x7'));var client=jayson[_0x7269('0x8')][_0x7269('0x9')]({'port':0x232b});function localAuthenticate(_0x438f7c,_0x1e47e3,_0x20ddbf,_0x2c968f){var _0x328097,_0x572969;return db[_0x7269('0xa')]['findOne']({'where':{'id':0x1},'attributes':[_0x7269('0xb'),_0x7269('0xc')],'raw':!![]})['then'](function(_0x3c21f9){_0x328097=_0x3c21f9;return _0x438f7c['findOne']({'attributes':['id',_0x7269('0xd'),'password',_0x7269('0xe'),'role',_0x7269('0xf'),_0x7269('0x10'),_0x7269('0x11'),'loginAttempts'],'where':{'name':_0x1e47e3,'role':{'$or':[_0x7269('0x12'),_0x7269('0x13'),'agent']}}});})[_0x7269('0x14')](function(_0x2de29b){if(!_0x2de29b||_0x2de29b&&_0x2de29b[_0x7269('0xd')]!==_0x1e47e3){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else{_0x572969=_0x2de29b;return _0x572969;}})[_0x7269('0x14')](function(){_0x572969[_0x7269('0x15')](_0x20ddbf,function(_0x2d78a0,_0x2c28f8){var _0x26547f=_0x572969[_0x7269('0x16')]+0x1;if(_0x2d78a0){return _0x2c968f(_0x2d78a0);}else if(!_0x2c28f8){if(_0x572969[_0x7269('0xf')]){return _0x2c968f(null,![],{'message':_0x7269('0x17')});}else if(_0x328097['allowedLoginAttempts']>0x0){if(_0x572969[_0x7269('0x10')]){if(_0x328097[_0x7269('0xc')]>0x0){if(moment(_0x572969[_0x7269('0x11')])[_0x7269('0x18')](_0x328097['blockDuration'],'minutes')>moment()){return _0x2c968f(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0x7269('0x19')](_0x572969,_0x26547f,![],null)[_0x7269('0x14')](function(){return _0x2c968f(null,![],{'message':_0x7269('0x17')});});}}else{return _0x2c968f(null,![],{'message':_0x7269('0x17')});}}else{if(_0x26547f>=_0x328097[_0x7269('0xb')]){return utils[_0x7269('0x19')](_0x572969,0x0,!![],moment())[_0x7269('0x14')](function(){return _0x2c968f(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}else{return utils['clearBlockUser'](_0x572969,_0x26547f,![],null)['then'](function(){return _0x2c968f(null,![],{'message':_0x7269('0x17')});});}}}else{return _0x2c968f(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{if(_0x572969[_0x7269('0xf')]){return _0x2c968f(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else if(_0x328097[_0x7269('0xb')]>0x0){if(_0x572969[_0x7269('0x10')]){if(_0x328097['blockDuration']>0x0){if(moment(_0x572969[_0x7269('0x11')])[_0x7269('0x18')](_0x328097['blockDuration'],_0x7269('0x1a'))>moment()){return _0x2c968f(null,![],{'message':_0x7269('0x17')});}else{return utils[_0x7269('0x19')](_0x572969,0x0,![],null)[_0x7269('0x14')](function(){return utils['getLicense'](_0x572969);})[_0x7269('0x14')](function(){return _0x2c968f(null,_0x572969);});}}else{return _0x2c968f(null,![],{'message':_0x7269('0x17')});}}else{return utils[_0x7269('0x19')](_0x572969,0x0,![],null)[_0x7269('0x14')](function(){return utils[_0x7269('0x1b')](_0x572969);})[_0x7269('0x14')](function(){return _0x2c968f(null,_0x572969);})['catch'](function(_0x198b59){return _0x2c968f(null,![],_0x198b59);});}}else{if(_0x572969[_0x7269('0x10')]){return _0x2c968f(null,![],{'message':_0x7269('0x17')});}else{return utils[_0x7269('0x1b')](_0x572969)[_0x7269('0x14')](function(){return _0x2c968f(null,_0x572969);});}}}});})['catch'](function(_0x33c43a){return _0x2c968f(null,![],_0x33c43a);});}function sendServiceMail(_0x470e5c){return db['MailAccount'][_0x7269('0x1c')]({'where':{'service':!![]},'attributes':['id','name',_0x7269('0x1d')],'include':[{'model':db[_0x7269('0x1e')],'as':_0x7269('0x1f')}]})[_0x7269('0x14')](function(_0x468d0b){if(!_0x468d0b){throw new Error('Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!');}var _0x43e363={'tls':{'rejectUnauthorized':![]}};if(_0x468d0b[_0x7269('0x1f')][_0x7269('0x20')]){_0x43e363[_0x7269('0x20')]=_0x468d0b['Smtp'][_0x7269('0x20')];}else{_0x43e363[_0x7269('0x21')]=_0x468d0b['Smtp']['host'];_0x43e363[_0x7269('0x22')]=_0x468d0b[_0x7269('0x1f')][_0x7269('0x22')];_0x43e363[_0x7269('0x23')]=_0x468d0b[_0x7269('0x1f')][_0x7269('0x23')];}if(_0x468d0b['Smtp']['authentication']){_0x43e363[_0x7269('0x24')]={'user':_0x468d0b[_0x7269('0x1f')]['user'],'pass':_0x468d0b[_0x7269('0x1f')]['pass']};}var _0x1f244c={'account':_0x43e363,'message':_[_0x7269('0x25')]({'from':util[_0x7269('0x26')](_0x7269('0x27'),_0x468d0b[_0x7269('0xd')],_0x468d0b[_0x7269('0x1d')]||_0x468d0b[_0x7269('0x1f')]['user'])},_0x470e5c)};return client[_0x7269('0x28')](_0x7269('0x29'),_0x1f244c);})['then'](function(_0x747178){if(_0x747178[_0x7269('0x2a')]){throw new Error(util[_0x7269('0x26')]('SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!',_0x747178[_0x7269('0x2a')][_0x7269('0x2b')]||JSON[_0x7269('0x2c')](_0x747178[_0x7269('0x2a')])));}return!![];});}function handleError(_0x487f25,_0x285274,_0xe5d1b9){return _0x487f25[_0x7269('0x2d')](_0x285274||0x1f4)[_0x7269('0x2e')]({'message':_0xe5d1b9?_0xe5d1b9[_0x7269('0x2b')]||_0xe5d1b9:''});}exports['login']=function(_0x1deb1a,_0x223faf,_0x301a10){passport['authenticate']('local',function(_0x399efe,_0x51a7ba,_0x2873fa){var _0x492a1e=_0x399efe||_0x2873fa;if(_0x492a1e){return handleError(_0x223faf,0x191,_0x492a1e);}if(!_0x51a7ba){return handleError(_0x223faf,0x194,{'message':_0x7269('0x2f')});}else{var _0x4d4a04={'payload':{'id':_0x51a7ba['id'],'role':_0x51a7ba['role']},'options':{'expiresIn':0x15180}};return authService['signToken'](_0x4d4a04)[_0x7269('0x14')](function(_0x2265ac){_0x223faf[_0x7269('0x30')]({'id':_0x51a7ba['id'],'token':_0x2265ac,'statusCall':'','isAlreadyLogged':_0x51a7ba[_0x7269('0x31')]});});}})(_0x1deb1a,_0x223faf,_0x301a10);};exports[_0x7269('0x32')]=function(_0x470982,_0x1fd570,_0x1ffa92){if(!_0x470982[_0x7269('0x33')][_0x7269('0x1d')]){return handleError(_0x1fd570,0x1f4,{'message':_0x7269('0x34')});}var _0x4eb641=rs[_0x7269('0x35')]();_0x470982[_0x7269('0x33')][_0x7269('0x1d')]=_0x470982[_0x7269('0x33')][_0x7269('0x1d')][_0x7269('0x36')]()[_0x7269('0x37')]();var _0x2a67c3;return db['Setting']['findOne']({'where':{'id':0x1},'attributes':[_0x7269('0xb'),_0x7269('0xc')],'raw':!![]})['then'](function(_0x54676d){_0x2a67c3=_0x54676d;return db['User'][_0x7269('0x1c')]({'where':{'email':_0x470982[_0x7269('0x33')]['email']}});})[_0x7269('0x14')](function(_0x1c4901){if(!_0x1c4901){throw new Error(_0x7269('0x38'));}if(_0x1c4901[_0x7269('0xf')]){throw new Error(_0x7269('0x39'));}if(_0x1c4901['blocked']){if(moment(_0x1c4901['blockedAt'])[_0x7269('0x18')](_0x2a67c3[_0x7269('0xc')],_0x7269('0x1a'))>moment()){throw new Error(_0x7269('0x3a'));}else{_0x1c4901[_0x7269('0x10')]=![];_0x1c4901['blockedAt']=null;}}_0x1c4901[_0x7269('0x3b')]=_0x4eb641;_0x1c4901[_0x7269('0x3c')]=Date['now']()+0x36ee80;return _0x1c4901['save']();})['then'](function(){return sendServiceMail({'to':_0x470982[_0x7269('0x33')][_0x7269('0x1d')],'subject':_0x7269('0x3d'),'text':'You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a'+_0x7269('0x3e')+_0x7269('0x3f')+_0x470982[_0x7269('0x40')][_0x7269('0x21')]+'/reset/'+_0x4eb641+'\x0a\x0a'+_0x7269('0x41')});})[_0x7269('0x14')](function(){_0x1fd570[_0x7269('0x2d')](0xc8)[_0x7269('0x2e')]({'message':_0x7269('0x42')});})[_0x7269('0x43')](function(_0x80dba9){return handleError(_0x1fd570,0x1f4,_0x80dba9);});};exports[_0x7269('0x44')]=function(_0x5f34d3,_0x23d91b,_0x51de71){return db[_0x7269('0x45')][_0x7269('0x1c')]({'where':{'resetPasswordToken':_0x5f34d3[_0x7269('0x46')][_0x7269('0x47')],'resetPasswordExpires':{'$gt':Date[_0x7269('0x48')]()}}})['then'](function(_0x52b0f0){if(!_0x52b0f0){throw new Error(_0x7269('0x49'));}return db[_0x7269('0xa')]['findOne']({'attributes':['id',_0x7269('0x4a'),_0x7269('0x4b'),_0x7269('0x4c')]})['then'](function(_0x13c173){if(_0x13c173[_0x7269('0x4a')])authService[_0x7269('0x4d')](_0x5f34d3['body']['password']);if(!_0x13c173[_0x7269('0x4b')]||!_0x52b0f0['previousPasswords'])return _0x52b0f0;authService[_0x7269('0x4e')](_0x5f34d3['body'][_0x7269('0x4f')],_0x52b0f0[_0x7269('0x50')],_0x13c173[_0x7269('0x4c')]);return _0x52b0f0;})[_0x7269('0x14')](function(){_0x52b0f0['password']=_0x5f34d3[_0x7269('0x33')]['password'];_0x52b0f0[_0x7269('0x3b')]=null;_0x52b0f0[_0x7269('0x3c')]=null;return _0x52b0f0[_0x7269('0x51')]();});})[_0x7269('0x14')](function(){_0x23d91b[_0x7269('0x2d')](0xc8)[_0x7269('0x2e')]({'message':_0x7269('0x52')});})[_0x7269('0x43')](function(_0x1e5ef1){return handleError(_0x23d91b,0x1f4,_0x1e5ef1);});};passport[_0x7269('0x53')](new LocalStrategy({'usernameField':'name','passwordField':_0x7269('0x4f')},function(_0x101470,_0x1bfc00,_0x1e564c){return localAuthenticate(db[_0x7269('0x45')],_0x101470,_0x1bfc00,_0x1e564c);})); \ No newline at end of file +var _0xc820=['moment','../../components/auth/service','../../config/utils','client','http','Setting','findOne','allowedLoginAttempts','blockDuration','name','password','salt','role','disabled','blocked','blockedAt','loginAttempts','user','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','then','authenticate','minutes','clearBlockUser','add','getLicense','catch','MailAccount','find','email','service','Smtp','host','port','secure','auth','pass','merge','\x22%s\x22\x20<%s>','SendMail','error','format','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','message','stringify','status','login','local','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','forgot','body','Email\x20parameter\x20is\x20missing','trim','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','resetPasswordExpires','now','save','xCally\x20Motion\x20Password\x20Reset','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','headers','/reset/','send','reset','User','token','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','enforcePasswordHistory','passwordHistoryLimit','securePassword','validatePasswordPattern','previousPasswords','Password\x20reset!','use','passport','passport-local','Strategy','jayson/promise','lodash'];(function(_0x1e741c,_0x20e62d){var _0x2652b0=function(_0x220af5){while(--_0x220af5){_0x1e741c['push'](_0x1e741c['shift']());}};_0x2652b0(++_0x20e62d);}(_0xc820,0x13f));var _0x0c82=function(_0x3ad0d7,_0x22e61c){_0x3ad0d7=_0x3ad0d7-0x0;var _0x51cd6b=_0xc820[_0x3ad0d7];return _0x51cd6b;};'use strict';var util=require('util');var passport=require(_0x0c82('0x0'));var LocalStrategy=require(_0x0c82('0x1'))[_0x0c82('0x2')];var jayson=require(_0x0c82('0x3'));var _=require(_0x0c82('0x4'));var rs=require('randomstring');var moment=require(_0x0c82('0x5'));var db=require('../../mysqldb')['db'];var authService=require(_0x0c82('0x6'));var utils=require(_0x0c82('0x7'));var client=jayson[_0x0c82('0x8')][_0x0c82('0x9')]({'port':0x232b});function localAuthenticate(_0x28db5e,_0x23f783,_0x2d2567,_0x32e9ee){var _0x4689b7,_0x29fc55;return db[_0x0c82('0xa')][_0x0c82('0xb')]({'where':{'id':0x1},'attributes':[_0x0c82('0xc'),_0x0c82('0xd')],'raw':!![]})['then'](function(_0x8c568){_0x4689b7=_0x8c568;return _0x28db5e[_0x0c82('0xb')]({'attributes':['id',_0x0c82('0xe'),_0x0c82('0xf'),_0x0c82('0x10'),_0x0c82('0x11'),_0x0c82('0x12'),_0x0c82('0x13'),_0x0c82('0x14'),_0x0c82('0x15')],'where':{'name':_0x23f783,'role':{'$or':['admin',_0x0c82('0x16'),'agent']}}});})['then'](function(_0x2098ae){if(!_0x2098ae||_0x2098ae&&_0x2098ae[_0x0c82('0xe')]!==_0x23f783){throw new Error(_0x0c82('0x17'));}else{_0x29fc55=_0x2098ae;return _0x29fc55;}})[_0x0c82('0x18')](function(){_0x29fc55[_0x0c82('0x19')](_0x2d2567,function(_0x5bdcf6,_0x4610e5){var _0x17376c=_0x29fc55[_0x0c82('0x15')]+0x1;if(_0x5bdcf6){return _0x32e9ee(_0x5bdcf6);}else if(!_0x4610e5){if(_0x29fc55['disabled']){return _0x32e9ee(null,![],{'message':_0x0c82('0x17')});}else if(_0x4689b7['allowedLoginAttempts']>0x0){if(_0x29fc55[_0x0c82('0x13')]){if(_0x4689b7[_0x0c82('0xd')]>0x0){if(moment(_0x29fc55[_0x0c82('0x14')])['add'](_0x4689b7['blockDuration'],_0x0c82('0x1a'))>moment()){return _0x32e9ee(null,![],{'message':_0x0c82('0x17')});}else{return utils['clearBlockUser'](_0x29fc55,_0x17376c,![],null)[_0x0c82('0x18')](function(){return _0x32e9ee(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}}else{return _0x32e9ee(null,![],{'message':_0x0c82('0x17')});}}else{if(_0x17376c>=_0x4689b7[_0x0c82('0xc')]){return utils['clearBlockUser'](_0x29fc55,0x0,!![],moment())[_0x0c82('0x18')](function(){return _0x32e9ee(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}else{return utils[_0x0c82('0x1b')](_0x29fc55,_0x17376c,![],null)['then'](function(){return _0x32e9ee(null,![],{'message':_0x0c82('0x17')});});}}}else{return _0x32e9ee(null,![],{'message':_0x0c82('0x17')});}}else{if(_0x29fc55['disabled']){return _0x32e9ee(null,![],{'message':_0x0c82('0x17')});}else if(_0x4689b7[_0x0c82('0xc')]>0x0){if(_0x29fc55[_0x0c82('0x13')]){if(_0x4689b7['blockDuration']>0x0){if(moment(_0x29fc55[_0x0c82('0x14')])[_0x0c82('0x1c')](_0x4689b7[_0x0c82('0xd')],_0x0c82('0x1a'))>moment()){return _0x32e9ee(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0x0c82('0x1b')](_0x29fc55,0x0,![],null)[_0x0c82('0x18')](function(){return utils[_0x0c82('0x1d')](_0x29fc55);})[_0x0c82('0x18')](function(){return _0x32e9ee(null,_0x29fc55);});}}else{return _0x32e9ee(null,![],{'message':_0x0c82('0x17')});}}else{return utils[_0x0c82('0x1b')](_0x29fc55,0x0,![],null)[_0x0c82('0x18')](function(){return utils['getLicense'](_0x29fc55);})[_0x0c82('0x18')](function(){return _0x32e9ee(null,_0x29fc55);})[_0x0c82('0x1e')](function(_0x4e7f33){return _0x32e9ee(null,![],_0x4e7f33);});}}else{if(_0x29fc55[_0x0c82('0x13')]){return _0x32e9ee(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils['getLicense'](_0x29fc55)[_0x0c82('0x18')](function(){return _0x32e9ee(null,_0x29fc55);});}}}});})[_0x0c82('0x1e')](function(_0x224b66){return _0x32e9ee(null,![],_0x224b66);});}function sendServiceMail(_0x46490d){return db[_0x0c82('0x1f')][_0x0c82('0x20')]({'where':{'service':!![]},'attributes':['id','name',_0x0c82('0x21')],'include':[{'model':db['MailServerOut'],'as':'Smtp'}]})[_0x0c82('0x18')](function(_0x596232){if(!_0x596232){throw new Error('Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!');}var _0x1ca7ee={'tls':{'rejectUnauthorized':![]}};if(_0x596232['Smtp']['service']){_0x1ca7ee[_0x0c82('0x22')]=_0x596232[_0x0c82('0x23')][_0x0c82('0x22')];}else{_0x1ca7ee[_0x0c82('0x24')]=_0x596232[_0x0c82('0x23')][_0x0c82('0x24')];_0x1ca7ee[_0x0c82('0x25')]=_0x596232[_0x0c82('0x23')][_0x0c82('0x25')];_0x1ca7ee[_0x0c82('0x26')]=_0x596232[_0x0c82('0x23')][_0x0c82('0x26')];}if(_0x596232['Smtp']['authentication']){_0x1ca7ee[_0x0c82('0x27')]={'user':_0x596232[_0x0c82('0x23')][_0x0c82('0x16')],'pass':_0x596232[_0x0c82('0x23')][_0x0c82('0x28')]};}var _0x175708={'account':_0x1ca7ee,'message':_[_0x0c82('0x29')]({'from':util['format'](_0x0c82('0x2a'),_0x596232[_0x0c82('0xe')],_0x596232['email']||_0x596232[_0x0c82('0x23')]['user'])},_0x46490d)};return client['request'](_0x0c82('0x2b'),_0x175708);})['then'](function(_0x4d86c2){if(_0x4d86c2[_0x0c82('0x2c')]){throw new Error(util[_0x0c82('0x2d')](_0x0c82('0x2e'),_0x4d86c2[_0x0c82('0x2c')][_0x0c82('0x2f')]||JSON[_0x0c82('0x30')](_0x4d86c2['error'])));}return!![];});}function handleError(_0x5a9cd1,_0x6ae129,_0x32597d){return _0x5a9cd1[_0x0c82('0x31')](_0x6ae129||0x1f4)['send']({'message':_0x32597d?_0x32597d[_0x0c82('0x2f')]||_0x32597d:''});}exports[_0x0c82('0x32')]=function(_0x572c14,_0x1c4bd7,_0x46d3d8){passport['authenticate'](_0x0c82('0x33'),function(_0x2da3dc,_0x41a569,_0x94f60e){var _0x5dcb49=_0x2da3dc||_0x94f60e;if(_0x5dcb49){return handleError(_0x1c4bd7,0x191,_0x5dcb49);}if(!_0x41a569){return handleError(_0x1c4bd7,0x194,{'message':_0x0c82('0x34')});}else{var _0x1b3048={'payload':{'id':_0x41a569['id'],'role':_0x41a569[_0x0c82('0x11')]},'options':{'expiresIn':0x15180}};return authService[_0x0c82('0x35')](_0x1b3048)[_0x0c82('0x18')](function(_0x2fa180){_0x1c4bd7[_0x0c82('0x36')]({'id':_0x41a569['id'],'token':_0x2fa180,'statusCall':'','isAlreadyLogged':_0x41a569['online']});});}})(_0x572c14,_0x1c4bd7,_0x46d3d8);};exports[_0x0c82('0x37')]=function(_0x18e98d,_0x534ec5,_0x1ad7f5){if(!_0x18e98d[_0x0c82('0x38')][_0x0c82('0x21')]){return handleError(_0x534ec5,0x1f4,{'message':_0x0c82('0x39')});}var _0x57ff5e=rs['generate']();_0x18e98d[_0x0c82('0x38')]['email']=_0x18e98d[_0x0c82('0x38')][_0x0c82('0x21')][_0x0c82('0x3a')]()['toLowerCase']();var _0x4b3257;return db[_0x0c82('0xa')][_0x0c82('0xb')]({'where':{'id':0x1},'attributes':[_0x0c82('0xc'),_0x0c82('0xd')],'raw':!![]})[_0x0c82('0x18')](function(_0x4b80f4){_0x4b3257=_0x4b80f4;return db['User'][_0x0c82('0x20')]({'where':{'email':_0x18e98d['body']['email']}});})['then'](function(_0xcdb966){if(!_0xcdb966){throw new Error(_0x0c82('0x3b'));}if(_0xcdb966['disabled']){throw new Error(_0x0c82('0x3c'));}if(_0xcdb966[_0x0c82('0x13')]){if(moment(_0xcdb966[_0x0c82('0x14')])['add'](_0x4b3257['blockDuration'],_0x0c82('0x1a'))>moment()){throw new Error('The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.');}else{_0xcdb966[_0x0c82('0x13')]=![];_0xcdb966[_0x0c82('0x14')]=null;}}_0xcdb966[_0x0c82('0x3d')]=_0x57ff5e;_0xcdb966[_0x0c82('0x3e')]=Date[_0x0c82('0x3f')]()+0x36ee80;return _0xcdb966[_0x0c82('0x40')]();})[_0x0c82('0x18')](function(){return sendServiceMail({'to':_0x18e98d[_0x0c82('0x38')][_0x0c82('0x21')],'subject':_0x0c82('0x41'),'text':_0x0c82('0x42')+'Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a'+'https://'+_0x18e98d[_0x0c82('0x43')][_0x0c82('0x24')]+_0x0c82('0x44')+_0x57ff5e+'\x0a\x0a'+'If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a'});})[_0x0c82('0x18')](function(){_0x534ec5[_0x0c82('0x31')](0xc8)[_0x0c82('0x45')]({'message':'Reset\x20Email\x20sent!'});})['catch'](function(_0x16d118){return handleError(_0x534ec5,0x1f4,_0x16d118);});};exports[_0x0c82('0x46')]=function(_0x4e789d,_0x221efc,_0x5ccd68){return db[_0x0c82('0x47')][_0x0c82('0x20')]({'where':{'resetPasswordToken':_0x4e789d['params'][_0x0c82('0x48')],'resetPasswordExpires':{'$gt':Date[_0x0c82('0x3f')]()}}})[_0x0c82('0x18')](function(_0x401654){if(!_0x401654){throw new Error(_0x0c82('0x49'));}return db[_0x0c82('0xa')]['findOne']({'attributes':['id','securePassword',_0x0c82('0x4a'),_0x0c82('0x4b')]})[_0x0c82('0x18')](function(_0x1993b1){if(_0x1993b1[_0x0c82('0x4c')])authService[_0x0c82('0x4d')](_0x4e789d[_0x0c82('0x38')]['password']);if(!_0x1993b1['enforcePasswordHistory']||!_0x401654[_0x0c82('0x4e')])return _0x401654;authService['validatePasswordHistory'](_0x4e789d[_0x0c82('0x38')][_0x0c82('0xf')],_0x401654['previousPasswords'],_0x1993b1[_0x0c82('0x4b')]);return _0x401654;})[_0x0c82('0x18')](function(){_0x401654[_0x0c82('0xf')]=_0x4e789d[_0x0c82('0x38')]['password'];_0x401654[_0x0c82('0x3d')]=null;_0x401654[_0x0c82('0x3e')]=null;return _0x401654[_0x0c82('0x40')]();});})[_0x0c82('0x18')](function(){_0x221efc[_0x0c82('0x31')](0xc8)['send']({'message':_0x0c82('0x4f')});})[_0x0c82('0x1e')](function(_0x525673){return handleError(_0x221efc,0x1f4,_0x525673);});};passport[_0x0c82('0x50')](new LocalStrategy({'usernameField':_0x0c82('0xe'),'passwordField':_0x0c82('0xf')},function(_0x97889,_0x2b737a,_0x500e80){return localAuthenticate(db[_0x0c82('0x47')],_0x97889,_0x2b737a,_0x500e80);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index 08e9b90..bb4d9cd 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 _0x655b=['login','/forgot','forgot','/reset/:token','reset','exports','Router','post'];(function(_0x4508d4,_0x25d42f){var _0x220dab=function(_0x1e03e7){while(--_0x1e03e7){_0x4508d4['push'](_0x4508d4['shift']());}};_0x220dab(++_0x25d42f);}(_0x655b,0xfe));var _0xb655=function(_0x5f1391,_0x19c132){_0x5f1391=_0x5f1391-0x0;var _0x50ebe3=_0x655b[_0x5f1391];return _0x50ebe3;};'use strict';var express=require('express');var router=express[_0xb655('0x0')]();var controller=require('./authLocal.controller');router[_0xb655('0x1')]('/',controller[_0xb655('0x2')]);router[_0xb655('0x1')](_0xb655('0x3'),controller[_0xb655('0x4')]);router[_0xb655('0x1')](_0xb655('0x5'),controller[_0xb655('0x6')]);module[_0xb655('0x7')]=router; \ No newline at end of file +var _0x2925=['exports','express','Router','./authLocal.controller','post','forgot','reset'];(function(_0x217931,_0x2c6669){var _0x20f8d0=function(_0x144281){while(--_0x144281){_0x217931['push'](_0x217931['shift']());}};_0x20f8d0(++_0x2c6669);}(_0x2925,0x71));var _0x5292=function(_0x1d094b,_0x251681){_0x1d094b=_0x1d094b-0x0;var _0x1bf90b=_0x2925[_0x1d094b];return _0x1bf90b;};'use strict';var express=require(_0x5292('0x0'));var router=express[_0x5292('0x1')]();var controller=require(_0x5292('0x2'));router['post']('/',controller['login']);router[_0x5292('0x3')]('/forgot',controller[_0x5292('0x4')]);router['post']('/reset/:token',controller[_0x5292('0x5')]);module[_0x5292('0x6')]=router; \ No newline at end of file diff --git a/server/api/automation/automation.attributes.js b/server/api/automation/automation.attributes.js index 491307d..b76e984 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 _0x09c4=['exports','STRING','BOOLEAN','INTEGER','sequelize'];(function(_0x21a9cf,_0x51f954){var _0x5d4ba7=function(_0x18d186){while(--_0x18d186){_0x21a9cf['push'](_0x21a9cf['shift']());}};_0x5d4ba7(++_0x51f954);}(_0x09c4,0x10d));var _0x409c=function(_0x550e29,_0x4047f){_0x550e29=_0x550e29-0x0;var _0x3515b6=_0x09c4[_0x550e29];return _0x3515b6;};'use strict';var Sequelize=require(_0x409c('0x0'));module[_0x409c('0x1')]={'name':{'type':Sequelize[_0x409c('0x2')],'allowNull':![]},'channel':{'type':Sequelize[_0x409c('0x2')]},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize[_0x409c('0x3')],'defaultValue':![]},'timeout':{'type':Sequelize[_0x409c('0x4')],'defaultValue':0xa}}; \ No newline at end of file +var _0xe10e=['BOOLEAN','sequelize','STRING'];(function(_0x3a6b68,_0x8d8c95){var _0x45e882=function(_0x10060d){while(--_0x10060d){_0x3a6b68['push'](_0x3a6b68['shift']());}};_0x45e882(++_0x8d8c95);}(_0xe10e,0xe2));var _0xee10=function(_0xd0a847,_0x72562b){_0xd0a847=_0xd0a847-0x0;var _0x2536ec=_0xe10e[_0xd0a847];return _0x2536ec;};'use strict';var Sequelize=require(_0xee10('0x0'));module['exports']={'name':{'type':Sequelize[_0xee10('0x1')],'allowNull':![]},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize[_0xee10('0x2')],'defaultValue':![]},'timeout':{'type':Sequelize['INTEGER'],'defaultValue':0xa}}; \ No newline at end of file diff --git a/server/api/automation/automation.controller.js b/server/api/automation/automation.controller.js index 132b426..cc75003 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 _0xefb6=['model','query','intersection','attributes','fields','length','nolimit','order','filters','filter','where','include','findAll','rows','catch','show','params','keys','includeAll','merge','options','find','create','body','addConditions','Condition','ids','findOne','sort','pick','hasOwnProperty','getConditions','addActions','Action','omit','getActions','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','set','apply','reject','save','update','then','destroy','stack','name','send','index','map','Automation','rawAttributes','fieldName','type'];(function(_0x3c4505,_0xffe1f8){var _0x18f0cc=function(_0x21a4d4){while(--_0x21a4d4){_0x3c4505['push'](_0x3c4505['shift']());}};_0x18f0cc(++_0xffe1f8);}(_0xefb6,0x1c8));var _0x6efb=function(_0x402c8f,_0x30cc1d){_0x402c8f=_0x402c8f-0x0;var _0x11e809=_0xefb6[_0x402c8f];return _0x11e809;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6efb('0x0'));var zipdir=require(_0x6efb('0x1'));var jsonpatch=require(_0x6efb('0x2'));var rp=require(_0x6efb('0x3'));var moment=require(_0x6efb('0x4'));var BPromise=require(_0x6efb('0x5'));var Mustache=require('mustache');var util=require(_0x6efb('0x6'));var path=require(_0x6efb('0x7'));var sox=require(_0x6efb('0x8'));var csv=require(_0x6efb('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6efb('0xa'));var _=require(_0x6efb('0xb'));var squel=require(_0x6efb('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x6efb('0x9'));var querystring=require('querystring');var Papa=require(_0x6efb('0xd'));var Redis=require(_0x6efb('0xe'));var authService=require(_0x6efb('0xf'));var qs=require(_0x6efb('0x10'));var as=require(_0x6efb('0x11'));var hardwareService=require(_0x6efb('0x12'));var logger=require(_0x6efb('0x13'))(_0x6efb('0x14'));var utils=require(_0x6efb('0x15'));var config=require(_0x6efb('0x16'));var licenseUtil=require(_0x6efb('0x17'));var db=require(_0x6efb('0x18'))['db'];function respondWithStatusCode(_0xbb7e96,_0x334a1e){_0x334a1e=_0x334a1e||0xcc;return function(_0x238e7c){if(_0x238e7c){return _0xbb7e96[_0x6efb('0x19')](_0x334a1e);}return _0xbb7e96[_0x6efb('0x1a')](_0x334a1e)['end']();};}function respondWithResult(_0x3ca387,_0x5c898d){_0x5c898d=_0x5c898d||0xc8;return function(_0x47d405){if(_0x47d405){return _0x3ca387[_0x6efb('0x1a')](_0x5c898d)[_0x6efb('0x1b')](_0x47d405);}};}function respondWithFilteredResult(_0x12274d,_0x27c972){return function(_0x414490){if(_0x414490){var _0x9151f=typeof _0x27c972[_0x6efb('0x1c')]===_0x6efb('0x1d')&&typeof _0x27c972['limit']===_0x6efb('0x1d');var _0x1b6eec=_0x414490[_0x6efb('0x1e')];var _0xec1fb5=_0x9151f?0x0:_0x27c972['offset'];var _0x4f9422=_0x9151f?_0x414490[_0x6efb('0x1e')]:_0x27c972[_0x6efb('0x1c')]+_0x27c972[_0x6efb('0x1f')];var _0x4a2d46;if(_0x4f9422>=_0x1b6eec){_0x4f9422=_0x1b6eec;_0x4a2d46=0xc8;}else{_0x4a2d46=0xce;}_0x12274d[_0x6efb('0x1a')](_0x4a2d46);return _0x12274d[_0x6efb('0x20')]('Content-Range',_0xec1fb5+'-'+_0x4f9422+'/'+_0x1b6eec)[_0x6efb('0x1b')](_0x414490);}return null;};}function patchUpdates(_0x1956a7){return function(_0x38d64e){try{jsonpatch[_0x6efb('0x21')](_0x38d64e,_0x1956a7,!![]);}catch(_0x7185b4){return BPromise[_0x6efb('0x22')](_0x7185b4);}return _0x38d64e[_0x6efb('0x23')]();};}function saveUpdates(_0x26cf2a,_0x201dcf){return function(_0x13cd62){if(_0x13cd62){return _0x13cd62[_0x6efb('0x24')](_0x26cf2a)[_0x6efb('0x25')](function(_0x5bc366){return _0x5bc366;});}return null;};}function removeEntity(_0x4440ff,_0x32ee0e){return function(_0x5766ae){if(_0x5766ae){return _0x5766ae[_0x6efb('0x26')]()['then'](function(){_0x4440ff[_0x6efb('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2e9dfa,_0x150594){return function(_0x5a517c){if(!_0x5a517c){_0x2e9dfa['sendStatus'](0x194);}return _0x5a517c;};}function handleError(_0x28bf22,_0x105e41){_0x105e41=_0x105e41||0x1f4;return function(_0x24cdca){logger['error'](_0x24cdca[_0x6efb('0x27')]);if(_0x24cdca[_0x6efb('0x28')]){delete _0x24cdca[_0x6efb('0x28')];}_0x28bf22['status'](_0x105e41)[_0x6efb('0x29')](_0x24cdca);};}exports[_0x6efb('0x2a')]=function(_0x53cd1a,_0x3fe231){var _0x4a062e={},_0x1a1aff={},_0x4bf77d={'count':0x0,'rows':[]};var _0x3eb8ec=_[_0x6efb('0x2b')](db[_0x6efb('0x2c')][_0x6efb('0x2d')],function(_0x471d16){return{'name':_0x471d16[_0x6efb('0x2e')],'type':_0x471d16[_0x6efb('0x2f')]['key']};});_0x1a1aff[_0x6efb('0x30')]=_['map'](_0x3eb8ec,_0x6efb('0x28'));_0x1a1aff[_0x6efb('0x31')]=_['keys'](_0x53cd1a[_0x6efb('0x31')]);_0x1a1aff['filters']=_[_0x6efb('0x32')](_0x1a1aff[_0x6efb('0x30')],_0x1a1aff[_0x6efb('0x31')]);_0x4a062e[_0x6efb('0x33')]=_[_0x6efb('0x32')](_0x1a1aff['model'],qs['fields'](_0x53cd1a[_0x6efb('0x31')][_0x6efb('0x34')]));_0x4a062e['attributes']=_0x4a062e[_0x6efb('0x33')][_0x6efb('0x35')]?_0x4a062e[_0x6efb('0x33')]:_0x1a1aff[_0x6efb('0x30')];if(!_0x53cd1a[_0x6efb('0x31')]['hasOwnProperty'](_0x6efb('0x36'))){_0x4a062e[_0x6efb('0x1f')]=qs['limit'](_0x53cd1a['query'][_0x6efb('0x1f')]);_0x4a062e[_0x6efb('0x1c')]=qs[_0x6efb('0x1c')](_0x53cd1a[_0x6efb('0x31')][_0x6efb('0x1c')]);}_0x4a062e[_0x6efb('0x37')]=qs['sort'](_0x53cd1a[_0x6efb('0x31')]['sort']);_0x4a062e['where']=qs[_0x6efb('0x38')](_['pick'](_0x53cd1a[_0x6efb('0x31')],_0x1a1aff['filters']),_0x3eb8ec);if(_0x53cd1a[_0x6efb('0x31')][_0x6efb('0x39')]){_0x4a062e[_0x6efb('0x3a')]=_['merge'](_0x4a062e[_0x6efb('0x3a')],{'$or':_[_0x6efb('0x2b')](_0x3eb8ec,function(_0x3e3731){if(_0x3e3731[_0x6efb('0x2f')]!=='VIRTUAL'){var _0x34b46c={};_0x34b46c[_0x3e3731['name']]={'$like':'%'+_0x53cd1a[_0x6efb('0x31')][_0x6efb('0x39')]+'%'};return _0x34b46c;}})});}_0x4a062e=_['merge']({},_0x4a062e,_0x53cd1a['options']);var _0xd94007={'where':_0x4a062e[_0x6efb('0x3a')]};return db[_0x6efb('0x2c')][_0x6efb('0x1e')](_0xd94007)['then'](function(_0x2dadb1){_0x4bf77d[_0x6efb('0x1e')]=_0x2dadb1;if(_0x53cd1a['query']['includeAll']){_0x4a062e[_0x6efb('0x3b')]=[{'all':!![]}];}return db[_0x6efb('0x2c')][_0x6efb('0x3c')](_0x4a062e);})[_0x6efb('0x25')](function(_0x14bc95){_0x4bf77d[_0x6efb('0x3d')]=_0x14bc95;return _0x4bf77d;})[_0x6efb('0x25')](respondWithFilteredResult(_0x3fe231,_0x4a062e))[_0x6efb('0x3e')](handleError(_0x3fe231,null));};exports[_0x6efb('0x3f')]=function(_0x5e0dc0,_0x201cab){var _0x27e602={'raw':![],'where':{'id':_0x5e0dc0[_0x6efb('0x40')]['id']}},_0x1206c8={};_0x1206c8['model']=_[_0x6efb('0x41')](db[_0x6efb('0x2c')][_0x6efb('0x2d')]);_0x1206c8[_0x6efb('0x31')]=_['keys'](_0x5e0dc0[_0x6efb('0x31')]);_0x1206c8[_0x6efb('0x38')]=_[_0x6efb('0x32')](_0x1206c8[_0x6efb('0x30')],_0x1206c8[_0x6efb('0x31')]);_0x27e602['attributes']=_[_0x6efb('0x32')](_0x1206c8[_0x6efb('0x30')],qs[_0x6efb('0x34')](_0x5e0dc0['query'][_0x6efb('0x34')]));_0x27e602['attributes']=_0x27e602[_0x6efb('0x33')][_0x6efb('0x35')]?_0x27e602[_0x6efb('0x33')]:_0x1206c8[_0x6efb('0x30')];if(_0x5e0dc0['query'][_0x6efb('0x42')]){_0x27e602['include']=[{'all':!![]}];}_0x27e602=_[_0x6efb('0x43')]({},_0x27e602,_0x5e0dc0[_0x6efb('0x44')]);return db[_0x6efb('0x2c')][_0x6efb('0x45')](_0x27e602)[_0x6efb('0x25')](handleEntityNotFound(_0x201cab,null))[_0x6efb('0x25')](respondWithResult(_0x201cab,null))[_0x6efb('0x3e')](handleError(_0x201cab,null));};exports['create']=function(_0x21fb7f,_0x22b314){return db['Automation'][_0x6efb('0x46')](_0x21fb7f[_0x6efb('0x47')],{})['then'](respondWithResult(_0x22b314,0xc9))[_0x6efb('0x3e')](handleError(_0x22b314,null));};exports[_0x6efb('0x24')]=function(_0x5a05ec,_0x59136c){if(_0x5a05ec[_0x6efb('0x47')]['id']){delete _0x5a05ec[_0x6efb('0x47')]['id'];}return db[_0x6efb('0x2c')][_0x6efb('0x45')]({'where':{'id':_0x5a05ec[_0x6efb('0x40')]['id']}})[_0x6efb('0x25')](handleEntityNotFound(_0x59136c,null))['then'](saveUpdates(_0x5a05ec[_0x6efb('0x47')],null))[_0x6efb('0x25')](respondWithResult(_0x59136c,null))[_0x6efb('0x3e')](handleError(_0x59136c,null));};exports['destroy']=function(_0x13be93,_0x1f8d9b){return db[_0x6efb('0x2c')][_0x6efb('0x45')]({'where':{'id':_0x13be93['params']['id']}})[_0x6efb('0x25')](handleEntityNotFound(_0x1f8d9b,null))[_0x6efb('0x25')](removeEntity(_0x1f8d9b,null))[_0x6efb('0x3e')](handleError(_0x1f8d9b,null));};exports[_0x6efb('0x48')]=function(_0x5af036,_0x54b8be,_0x9de016){return db[_0x6efb('0x49')]['find']({'where':{'id':_0x5af036['params']['id']}})[_0x6efb('0x25')](handleEntityNotFound(_0x54b8be,null))[_0x6efb('0x25')](function(_0x295204){if(_0x295204){return _0x295204['addConditions'](_0x5af036[_0x6efb('0x47')][_0x6efb('0x4a')],_['omit'](_0x5af036[_0x6efb('0x47')],['ids','id'])||{});}})[_0x6efb('0x25')](respondWithResult(_0x54b8be,null))[_0x6efb('0x3e')](handleError(_0x54b8be,null));};exports['getConditions']=function(_0x49030e,_0x142055,_0xdde676){var _0x362603={};var _0x35b96d={};var _0x2c82d1;var _0x3c798c;return db[_0x6efb('0x2c')][_0x6efb('0x4b')]({'where':{'id':_0x49030e[_0x6efb('0x40')]['id']}})['then'](handleEntityNotFound(_0x142055,null))['then'](function(_0x2a9233){if(_0x2a9233){_0x2c82d1=_0x2a9233;_0x35b96d['model']=_['keys'](db[_0x6efb('0x49')][_0x6efb('0x2d')]);_0x35b96d[_0x6efb('0x31')]=_[_0x6efb('0x41')](_0x49030e[_0x6efb('0x31')]);_0x35b96d[_0x6efb('0x38')]=_[_0x6efb('0x32')](_0x35b96d[_0x6efb('0x30')],_0x35b96d[_0x6efb('0x31')]);_0x362603['attributes']=_[_0x6efb('0x32')](_0x35b96d['model'],qs[_0x6efb('0x34')](_0x49030e['query'][_0x6efb('0x34')]));_0x362603[_0x6efb('0x33')]=_0x362603[_0x6efb('0x33')][_0x6efb('0x35')]?_0x362603[_0x6efb('0x33')]:_0x35b96d['model'];_0x362603[_0x6efb('0x37')]=qs[_0x6efb('0x4c')](_0x49030e[_0x6efb('0x31')][_0x6efb('0x4c')]);_0x362603[_0x6efb('0x3a')]=qs['filters'](_[_0x6efb('0x4d')](_0x49030e[_0x6efb('0x31')],_0x35b96d['filters']));if(_0x49030e['query'][_0x6efb('0x39')]){_0x362603[_0x6efb('0x3a')]=_[_0x6efb('0x43')](_0x362603[_0x6efb('0x3a')],{'$or':_[_0x6efb('0x2b')](_0x362603[_0x6efb('0x33')],function(_0x5af569){var _0x744cf6={};_0x744cf6[_0x5af569]={'$like':'%'+_0x49030e[_0x6efb('0x31')][_0x6efb('0x39')]+'%'};return _0x744cf6;})});}_0x362603=_[_0x6efb('0x43')]({},_0x362603,_0x49030e['options']);return _0x2c82d1['getConditions'](_0x362603);}})[_0x6efb('0x25')](function(_0x48652f){if(_0x48652f){_0x3c798c=_0x48652f[_0x6efb('0x35')];if(!_0x49030e['query'][_0x6efb('0x4e')](_0x6efb('0x36'))){_0x362603[_0x6efb('0x1f')]=qs[_0x6efb('0x1f')](_0x49030e[_0x6efb('0x31')][_0x6efb('0x1f')]);_0x362603[_0x6efb('0x1c')]=qs[_0x6efb('0x1c')](_0x49030e['query'][_0x6efb('0x1c')]);}return _0x2c82d1[_0x6efb('0x4f')](_0x362603);}})['then'](function(_0x168eaf){if(_0x168eaf){return _0x168eaf?{'count':_0x3c798c,'rows':_0x168eaf}:null;}})[_0x6efb('0x25')](respondWithResult(_0x142055,null))[_0x6efb('0x3e')](handleError(_0x142055,null));};exports[_0x6efb('0x50')]=function(_0x603cc0,_0x5f1cfb,_0x4e0747){return db[_0x6efb('0x51')]['find']({'where':{'id':_0x603cc0[_0x6efb('0x40')]['id']}})[_0x6efb('0x25')](handleEntityNotFound(_0x5f1cfb,null))['then'](function(_0x480ced){if(_0x480ced){return _0x480ced[_0x6efb('0x50')](_0x603cc0['body']['ids'],_[_0x6efb('0x52')](_0x603cc0['body'],[_0x6efb('0x4a'),'id'])||{});}})[_0x6efb('0x25')](respondWithResult(_0x5f1cfb,null))[_0x6efb('0x3e')](handleError(_0x5f1cfb,null));};exports[_0x6efb('0x53')]=function(_0x646063,_0x22050c,_0x4f8e72){var _0xa73b4e={};var _0x5201cd={};var _0x1e5c5a;var _0x33ebf7;return db[_0x6efb('0x2c')][_0x6efb('0x4b')]({'where':{'id':_0x646063[_0x6efb('0x40')]['id']}})[_0x6efb('0x25')](handleEntityNotFound(_0x22050c,null))['then'](function(_0x18e94e){if(_0x18e94e){_0x1e5c5a=_0x18e94e;_0x5201cd[_0x6efb('0x30')]=_[_0x6efb('0x41')](db['Action'][_0x6efb('0x2d')]);_0x5201cd[_0x6efb('0x31')]=_[_0x6efb('0x41')](_0x646063[_0x6efb('0x31')]);_0x5201cd[_0x6efb('0x38')]=_['intersection'](_0x5201cd['model'],_0x5201cd['query']);_0xa73b4e['attributes']=_[_0x6efb('0x32')](_0x5201cd[_0x6efb('0x30')],qs[_0x6efb('0x34')](_0x646063[_0x6efb('0x31')][_0x6efb('0x34')]));_0xa73b4e[_0x6efb('0x33')]=_0xa73b4e[_0x6efb('0x33')][_0x6efb('0x35')]?_0xa73b4e[_0x6efb('0x33')]:_0x5201cd['model'];_0xa73b4e[_0x6efb('0x37')]=qs[_0x6efb('0x4c')](_0x646063[_0x6efb('0x31')][_0x6efb('0x4c')]);_0xa73b4e[_0x6efb('0x3a')]=qs[_0x6efb('0x38')](_['pick'](_0x646063[_0x6efb('0x31')],_0x5201cd[_0x6efb('0x38')]));if(_0x646063[_0x6efb('0x31')][_0x6efb('0x39')]){_0xa73b4e[_0x6efb('0x3a')]=_[_0x6efb('0x43')](_0xa73b4e[_0x6efb('0x3a')],{'$or':_[_0x6efb('0x2b')](_0xa73b4e[_0x6efb('0x33')],function(_0x4d0daf){var _0x1e371c={};_0x1e371c[_0x4d0daf]={'$like':'%'+_0x646063[_0x6efb('0x31')][_0x6efb('0x39')]+'%'};return _0x1e371c;})});}_0xa73b4e=_['merge']({},_0xa73b4e,_0x646063[_0x6efb('0x44')]);return _0x1e5c5a[_0x6efb('0x53')](_0xa73b4e);}})[_0x6efb('0x25')](function(_0x215bf7){if(_0x215bf7){_0x33ebf7=_0x215bf7[_0x6efb('0x35')];if(!_0x646063[_0x6efb('0x31')][_0x6efb('0x4e')](_0x6efb('0x36'))){_0xa73b4e[_0x6efb('0x1f')]=qs['limit'](_0x646063['query']['limit']);_0xa73b4e[_0x6efb('0x1c')]=qs[_0x6efb('0x1c')](_0x646063[_0x6efb('0x31')]['offset']);}return _0x1e5c5a[_0x6efb('0x53')](_0xa73b4e);}})['then'](function(_0x4bcc0b){if(_0x4bcc0b){return _0x4bcc0b?{'count':_0x33ebf7,'rows':_0x4bcc0b}:null;}})[_0x6efb('0x25')](respondWithResult(_0x22050c,null))[_0x6efb('0x3e')](handleError(_0x22050c,null));}; \ No newline at end of file +var _0xc418=['query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','options','then','includeAll','include','rows','show','params','find','catch','create','body','addConditions','Condition','ids','omit','getConditions','addActions','Action','findOne','getActions','hasOwnProperty','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','end','status','json','undefined','count','offset','limit','set','apply','reject','update','destroy','error','stack','name','send','index','map','Automation','rawAttributes','fieldName','type','key','model','keys'];(function(_0x2f1677,_0x668f){var _0x359eff=function(_0x3fcc1e){while(--_0x3fcc1e){_0x2f1677['push'](_0x2f1677['shift']());}};_0x359eff(++_0x668f);}(_0xc418,0x17a));var _0x8c41=function(_0x13c782,_0x17bb19){_0x13c782=_0x13c782-0x0;var _0x539ad2=_0xc418[_0x13c782];return _0x539ad2;};'use strict';var emlformat=require(_0x8c41('0x0'));var rimraf=require(_0x8c41('0x1'));var zipdir=require(_0x8c41('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x8c41('0x3'));var BPromise=require(_0x8c41('0x4'));var Mustache=require(_0x8c41('0x5'));var util=require(_0x8c41('0x6'));var path=require(_0x8c41('0x7'));var sox=require(_0x8c41('0x8'));var csv=require(_0x8c41('0x9'));var ejs=require(_0x8c41('0xa'));var fs=require('fs');var fs_extra=require(_0x8c41('0xb'));var _=require(_0x8c41('0xc'));var squel=require(_0x8c41('0xd'));var crypto=require(_0x8c41('0xe'));var jsforce=require(_0x8c41('0xf'));var deskjs=require(_0x8c41('0x10'));var toCsv=require(_0x8c41('0x9'));var querystring=require(_0x8c41('0x11'));var Papa=require(_0x8c41('0x12'));var Redis=require(_0x8c41('0x13'));var authService=require(_0x8c41('0x14'));var qs=require(_0x8c41('0x15'));var as=require(_0x8c41('0x16'));var hardwareService=require(_0x8c41('0x17'));var logger=require('../../config/logger')(_0x8c41('0x18'));var utils=require('../../config/utils');var config=require(_0x8c41('0x19'));var licenseUtil=require(_0x8c41('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x246c74,_0x412a05){_0x412a05=_0x412a05||0xcc;return function(_0x92c162){if(_0x92c162){return _0x246c74['sendStatus'](_0x412a05);}return _0x246c74['status'](_0x412a05)[_0x8c41('0x1b')]();};}function respondWithResult(_0x4c2a1f,_0x348559){_0x348559=_0x348559||0xc8;return function(_0x16bc3f){if(_0x16bc3f){return _0x4c2a1f[_0x8c41('0x1c')](_0x348559)[_0x8c41('0x1d')](_0x16bc3f);}};}function respondWithFilteredResult(_0x335eed,_0x1642f0){return function(_0xc29bbd){if(_0xc29bbd){var _0x47069a=typeof _0x1642f0['offset']===_0x8c41('0x1e')&&typeof _0x1642f0['limit']===_0x8c41('0x1e');var _0x4cafb3=_0xc29bbd[_0x8c41('0x1f')];var _0x51a344=_0x47069a?0x0:_0x1642f0[_0x8c41('0x20')];var _0x36d70f=_0x47069a?_0xc29bbd[_0x8c41('0x1f')]:_0x1642f0[_0x8c41('0x20')]+_0x1642f0[_0x8c41('0x21')];var _0x4ebee1;if(_0x36d70f>=_0x4cafb3){_0x36d70f=_0x4cafb3;_0x4ebee1=0xc8;}else{_0x4ebee1=0xce;}_0x335eed[_0x8c41('0x1c')](_0x4ebee1);return _0x335eed[_0x8c41('0x22')]('Content-Range',_0x51a344+'-'+_0x36d70f+'/'+_0x4cafb3)['json'](_0xc29bbd);}return null;};}function patchUpdates(_0x276f87){return function(_0x1c28d5){try{jsonpatch[_0x8c41('0x23')](_0x1c28d5,_0x276f87,!![]);}catch(_0x2eef71){return BPromise[_0x8c41('0x24')](_0x2eef71);}return _0x1c28d5['save']();};}function saveUpdates(_0x48d141,_0x14682c){return function(_0x3ef865){if(_0x3ef865){return _0x3ef865[_0x8c41('0x25')](_0x48d141)['then'](function(_0x2f0fc4){return _0x2f0fc4;});}return null;};}function removeEntity(_0x528ae6,_0x48b981){return function(_0x556a38){if(_0x556a38){return _0x556a38[_0x8c41('0x26')]()['then'](function(){_0x528ae6[_0x8c41('0x1c')](0xcc)[_0x8c41('0x1b')]();});}};}function handleEntityNotFound(_0x10bfd6,_0x51c543){return function(_0x3b9494){if(!_0x3b9494){_0x10bfd6['sendStatus'](0x194);}return _0x3b9494;};}function handleError(_0x462b5e,_0x2d4e7f){_0x2d4e7f=_0x2d4e7f||0x1f4;return function(_0x44b91e){logger[_0x8c41('0x27')](_0x44b91e[_0x8c41('0x28')]);if(_0x44b91e[_0x8c41('0x29')]){delete _0x44b91e['name'];}_0x462b5e[_0x8c41('0x1c')](_0x2d4e7f)[_0x8c41('0x2a')](_0x44b91e);};}exports[_0x8c41('0x2b')]=function(_0x52ef69,_0x51e2d1){var _0x3a7ef9={},_0x1f486b={},_0x542ec4={'count':0x0,'rows':[]};var _0x27664b=_[_0x8c41('0x2c')](db[_0x8c41('0x2d')][_0x8c41('0x2e')],function(_0x33a1df){return{'name':_0x33a1df[_0x8c41('0x2f')],'type':_0x33a1df[_0x8c41('0x30')][_0x8c41('0x31')]};});_0x1f486b[_0x8c41('0x32')]=_['map'](_0x27664b,_0x8c41('0x29'));_0x1f486b['query']=_[_0x8c41('0x33')](_0x52ef69[_0x8c41('0x34')]);_0x1f486b[_0x8c41('0x35')]=_[_0x8c41('0x36')](_0x1f486b[_0x8c41('0x32')],_0x1f486b['query']);_0x3a7ef9[_0x8c41('0x37')]=_[_0x8c41('0x36')](_0x1f486b[_0x8c41('0x32')],qs[_0x8c41('0x38')](_0x52ef69['query'][_0x8c41('0x38')]));_0x3a7ef9[_0x8c41('0x37')]=_0x3a7ef9['attributes'][_0x8c41('0x39')]?_0x3a7ef9[_0x8c41('0x37')]:_0x1f486b[_0x8c41('0x32')];if(!_0x52ef69[_0x8c41('0x34')]['hasOwnProperty'](_0x8c41('0x3a'))){_0x3a7ef9[_0x8c41('0x21')]=qs[_0x8c41('0x21')](_0x52ef69[_0x8c41('0x34')]['limit']);_0x3a7ef9['offset']=qs[_0x8c41('0x20')](_0x52ef69[_0x8c41('0x34')][_0x8c41('0x20')]);}_0x3a7ef9[_0x8c41('0x3b')]=qs[_0x8c41('0x3c')](_0x52ef69[_0x8c41('0x34')][_0x8c41('0x3c')]);_0x3a7ef9[_0x8c41('0x3d')]=qs[_0x8c41('0x35')](_[_0x8c41('0x3e')](_0x52ef69[_0x8c41('0x34')],_0x1f486b[_0x8c41('0x35')]),_0x27664b);if(_0x52ef69[_0x8c41('0x34')][_0x8c41('0x3f')]){_0x3a7ef9[_0x8c41('0x3d')]=_[_0x8c41('0x40')](_0x3a7ef9[_0x8c41('0x3d')],{'$or':_[_0x8c41('0x2c')](_0x27664b,function(_0x403e82){if(_0x403e82[_0x8c41('0x30')]!=='VIRTUAL'){var _0x4e59df={};_0x4e59df[_0x403e82[_0x8c41('0x29')]]={'$like':'%'+_0x52ef69['query'][_0x8c41('0x3f')]+'%'};return _0x4e59df;}})});}_0x3a7ef9=_[_0x8c41('0x40')]({},_0x3a7ef9,_0x52ef69[_0x8c41('0x41')]);var _0x1bc18d={'where':_0x3a7ef9[_0x8c41('0x3d')]};return db['Automation'][_0x8c41('0x1f')](_0x1bc18d)[_0x8c41('0x42')](function(_0x37c05c){_0x542ec4[_0x8c41('0x1f')]=_0x37c05c;if(_0x52ef69['query'][_0x8c41('0x43')]){_0x3a7ef9[_0x8c41('0x44')]=[{'all':!![]}];}return db[_0x8c41('0x2d')]['findAll'](_0x3a7ef9);})['then'](function(_0x3d2bbb){_0x542ec4[_0x8c41('0x45')]=_0x3d2bbb;return _0x542ec4;})[_0x8c41('0x42')](respondWithFilteredResult(_0x51e2d1,_0x3a7ef9))['catch'](handleError(_0x51e2d1,null));};exports[_0x8c41('0x46')]=function(_0x1b9197,_0x525c2d){var _0x58d211={'raw':![],'where':{'id':_0x1b9197[_0x8c41('0x47')]['id']}},_0x25a675={};_0x25a675[_0x8c41('0x32')]=_['keys'](db[_0x8c41('0x2d')][_0x8c41('0x2e')]);_0x25a675[_0x8c41('0x34')]=_[_0x8c41('0x33')](_0x1b9197[_0x8c41('0x34')]);_0x25a675[_0x8c41('0x35')]=_[_0x8c41('0x36')](_0x25a675[_0x8c41('0x32')],_0x25a675[_0x8c41('0x34')]);_0x58d211[_0x8c41('0x37')]=_['intersection'](_0x25a675[_0x8c41('0x32')],qs[_0x8c41('0x38')](_0x1b9197[_0x8c41('0x34')][_0x8c41('0x38')]));_0x58d211['attributes']=_0x58d211[_0x8c41('0x37')][_0x8c41('0x39')]?_0x58d211['attributes']:_0x25a675[_0x8c41('0x32')];if(_0x1b9197[_0x8c41('0x34')]['includeAll']){_0x58d211[_0x8c41('0x44')]=[{'all':!![]}];}_0x58d211=_[_0x8c41('0x40')]({},_0x58d211,_0x1b9197[_0x8c41('0x41')]);return db[_0x8c41('0x2d')][_0x8c41('0x48')](_0x58d211)[_0x8c41('0x42')](handleEntityNotFound(_0x525c2d,null))[_0x8c41('0x42')](respondWithResult(_0x525c2d,null))[_0x8c41('0x49')](handleError(_0x525c2d,null));};exports['create']=function(_0xa410c7,_0x302bea){return db['Automation'][_0x8c41('0x4a')](_0xa410c7[_0x8c41('0x4b')],{})[_0x8c41('0x42')](respondWithResult(_0x302bea,0xc9))[_0x8c41('0x49')](handleError(_0x302bea,null));};exports[_0x8c41('0x25')]=function(_0x526da9,_0x58febf){if(_0x526da9['body']['id']){delete _0x526da9['body']['id'];}return db[_0x8c41('0x2d')][_0x8c41('0x48')]({'where':{'id':_0x526da9[_0x8c41('0x47')]['id']}})['then'](handleEntityNotFound(_0x58febf,null))['then'](saveUpdates(_0x526da9[_0x8c41('0x4b')],null))[_0x8c41('0x42')](respondWithResult(_0x58febf,null))[_0x8c41('0x49')](handleError(_0x58febf,null));};exports[_0x8c41('0x26')]=function(_0xaa7815,_0x4de7c9){return db[_0x8c41('0x2d')]['find']({'where':{'id':_0xaa7815[_0x8c41('0x47')]['id']}})['then'](handleEntityNotFound(_0x4de7c9,null))[_0x8c41('0x42')](removeEntity(_0x4de7c9,null))['catch'](handleError(_0x4de7c9,null));};exports[_0x8c41('0x4c')]=function(_0x5f3565,_0x52722a,_0x3874c9){return db[_0x8c41('0x4d')][_0x8c41('0x48')]({'where':{'id':_0x5f3565[_0x8c41('0x47')]['id']}})[_0x8c41('0x42')](handleEntityNotFound(_0x52722a,null))[_0x8c41('0x42')](function(_0x573ae2){if(_0x573ae2){return _0x573ae2[_0x8c41('0x4c')](_0x5f3565['body'][_0x8c41('0x4e')],_[_0x8c41('0x4f')](_0x5f3565['body'],['ids','id'])||{});}})[_0x8c41('0x42')](respondWithResult(_0x52722a,null))[_0x8c41('0x49')](handleError(_0x52722a,null));};exports[_0x8c41('0x50')]=function(_0x3565e7,_0x5ecb6,_0x136444){var _0x38721e={};var _0x5e0f1d={};var _0x270b1b;var _0x3f2eb6;return db['Automation']['findOne']({'where':{'id':_0x3565e7[_0x8c41('0x47')]['id']}})['then'](handleEntityNotFound(_0x5ecb6,null))['then'](function(_0x3201ea){if(_0x3201ea){_0x270b1b=_0x3201ea;_0x5e0f1d[_0x8c41('0x32')]=_['keys'](db[_0x8c41('0x4d')][_0x8c41('0x2e')]);_0x5e0f1d[_0x8c41('0x34')]=_['keys'](_0x3565e7['query']);_0x5e0f1d[_0x8c41('0x35')]=_[_0x8c41('0x36')](_0x5e0f1d[_0x8c41('0x32')],_0x5e0f1d[_0x8c41('0x34')]);_0x38721e['attributes']=_['intersection'](_0x5e0f1d[_0x8c41('0x32')],qs['fields'](_0x3565e7[_0x8c41('0x34')][_0x8c41('0x38')]));_0x38721e[_0x8c41('0x37')]=_0x38721e[_0x8c41('0x37')][_0x8c41('0x39')]?_0x38721e[_0x8c41('0x37')]:_0x5e0f1d['model'];_0x38721e['order']=qs['sort'](_0x3565e7[_0x8c41('0x34')][_0x8c41('0x3c')]);_0x38721e[_0x8c41('0x3d')]=qs[_0x8c41('0x35')](_[_0x8c41('0x3e')](_0x3565e7['query'],_0x5e0f1d[_0x8c41('0x35')]));if(_0x3565e7[_0x8c41('0x34')][_0x8c41('0x3f')]){_0x38721e[_0x8c41('0x3d')]=_[_0x8c41('0x40')](_0x38721e[_0x8c41('0x3d')],{'$or':_[_0x8c41('0x2c')](_0x38721e[_0x8c41('0x37')],function(_0x15d619){var _0x2b86d3={};_0x2b86d3[_0x15d619]={'$like':'%'+_0x3565e7[_0x8c41('0x34')][_0x8c41('0x3f')]+'%'};return _0x2b86d3;})});}_0x38721e=_[_0x8c41('0x40')]({},_0x38721e,_0x3565e7[_0x8c41('0x41')]);return _0x270b1b[_0x8c41('0x50')](_0x38721e);}})[_0x8c41('0x42')](function(_0x32aa91){if(_0x32aa91){_0x3f2eb6=_0x32aa91[_0x8c41('0x39')];if(!_0x3565e7['query']['hasOwnProperty'](_0x8c41('0x3a'))){_0x38721e['limit']=qs[_0x8c41('0x21')](_0x3565e7['query'][_0x8c41('0x21')]);_0x38721e['offset']=qs[_0x8c41('0x20')](_0x3565e7[_0x8c41('0x34')][_0x8c41('0x20')]);}return _0x270b1b[_0x8c41('0x50')](_0x38721e);}})[_0x8c41('0x42')](function(_0x371582){if(_0x371582){return _0x371582?{'count':_0x3f2eb6,'rows':_0x371582}:null;}})['then'](respondWithResult(_0x5ecb6,null))['catch'](handleError(_0x5ecb6,null));};exports[_0x8c41('0x51')]=function(_0x158307,_0x5d1768,_0x291546){return db[_0x8c41('0x52')][_0x8c41('0x48')]({'where':{'id':_0x158307['params']['id']}})[_0x8c41('0x42')](handleEntityNotFound(_0x5d1768,null))[_0x8c41('0x42')](function(_0x82f8b7){if(_0x82f8b7){return _0x82f8b7[_0x8c41('0x51')](_0x158307[_0x8c41('0x4b')]['ids'],_[_0x8c41('0x4f')](_0x158307[_0x8c41('0x4b')],[_0x8c41('0x4e'),'id'])||{});}})[_0x8c41('0x42')](respondWithResult(_0x5d1768,null))[_0x8c41('0x49')](handleError(_0x5d1768,null));};exports['getActions']=function(_0x545c66,_0xa85e76,_0x5130d1){var _0x36518a={};var _0x2ff1c0={};var _0x23f15c;var _0x42a22f;return db[_0x8c41('0x2d')][_0x8c41('0x53')]({'where':{'id':_0x545c66['params']['id']}})[_0x8c41('0x42')](handleEntityNotFound(_0xa85e76,null))[_0x8c41('0x42')](function(_0x2e52c4){if(_0x2e52c4){_0x23f15c=_0x2e52c4;_0x2ff1c0[_0x8c41('0x32')]=_[_0x8c41('0x33')](db['Action'][_0x8c41('0x2e')]);_0x2ff1c0[_0x8c41('0x34')]=_[_0x8c41('0x33')](_0x545c66[_0x8c41('0x34')]);_0x2ff1c0[_0x8c41('0x35')]=_[_0x8c41('0x36')](_0x2ff1c0[_0x8c41('0x32')],_0x2ff1c0[_0x8c41('0x34')]);_0x36518a[_0x8c41('0x37')]=_[_0x8c41('0x36')](_0x2ff1c0[_0x8c41('0x32')],qs[_0x8c41('0x38')](_0x545c66[_0x8c41('0x34')]['fields']));_0x36518a['attributes']=_0x36518a[_0x8c41('0x37')][_0x8c41('0x39')]?_0x36518a[_0x8c41('0x37')]:_0x2ff1c0[_0x8c41('0x32')];_0x36518a[_0x8c41('0x3b')]=qs[_0x8c41('0x3c')](_0x545c66[_0x8c41('0x34')][_0x8c41('0x3c')]);_0x36518a['where']=qs[_0x8c41('0x35')](_[_0x8c41('0x3e')](_0x545c66[_0x8c41('0x34')],_0x2ff1c0['filters']));if(_0x545c66[_0x8c41('0x34')][_0x8c41('0x3f')]){_0x36518a['where']=_[_0x8c41('0x40')](_0x36518a[_0x8c41('0x3d')],{'$or':_['map'](_0x36518a['attributes'],function(_0x3e87d5){var _0x354df2={};_0x354df2[_0x3e87d5]={'$like':'%'+_0x545c66[_0x8c41('0x34')][_0x8c41('0x3f')]+'%'};return _0x354df2;})});}_0x36518a=_[_0x8c41('0x40')]({},_0x36518a,_0x545c66[_0x8c41('0x41')]);return _0x23f15c[_0x8c41('0x54')](_0x36518a);}})[_0x8c41('0x42')](function(_0x58f93e){if(_0x58f93e){_0x42a22f=_0x58f93e[_0x8c41('0x39')];if(!_0x545c66[_0x8c41('0x34')][_0x8c41('0x55')](_0x8c41('0x3a'))){_0x36518a['limit']=qs['limit'](_0x545c66[_0x8c41('0x34')][_0x8c41('0x21')]);_0x36518a[_0x8c41('0x20')]=qs[_0x8c41('0x20')](_0x545c66['query']['offset']);}return _0x23f15c[_0x8c41('0x54')](_0x36518a);}})['then'](function(_0x31ffa7){if(_0x31ffa7){return _0x31ffa7?{'count':_0x42a22f,'rows':_0x31ffa7}:null;}})[_0x8c41('0x42')](respondWithResult(_0xa85e76,null))[_0x8c41('0x49')](handleError(_0xa85e76,null));}; \ No newline at end of file diff --git a/server/api/automation/automation.model.js b/server/api/automation/automation.model.js index bf70cb6..2a0260a 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 _0xfedd=['lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./automation.attributes','exports','define','Automation'];(function(_0x30ff0d,_0x385305){var _0x958560=function(_0xfd1229){while(--_0xfd1229){_0x30ff0d['push'](_0x30ff0d['shift']());}};_0x958560(++_0x385305);}(_0xfedd,0x9c));var _0xdfed=function(_0x55490e,_0x23f25c){_0x55490e=_0x55490e-0x0;var _0x4e4708=_0xfedd[_0x55490e];return _0x4e4708;};'use strict';var _=require(_0xdfed('0x0'));var util=require(_0xdfed('0x1'));var logger=require(_0xdfed('0x2'))('api');var moment=require('moment');var BPromise=require(_0xdfed('0x3'));var rp=require(_0xdfed('0x4'));var fs=require('fs');var path=require(_0xdfed('0x5'));var rimraf=require(_0xdfed('0x6'));var config=require(_0xdfed('0x7'));var attributes=require(_0xdfed('0x8'));module[_0xdfed('0x9')]=function(_0x4bc5a9,_0x4c47bd){return _0x4bc5a9[_0xdfed('0xa')](_0xdfed('0xb'),attributes,{'tableName':'tools_automations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x925d=['lodash','util','api','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x5d3397,_0x23a4bc){var _0x16a3c7=function(_0x54750e){while(--_0x54750e){_0x5d3397['push'](_0x5d3397['shift']());}};_0x16a3c7(++_0x23a4bc);}(_0x925d,0x140));var _0xd925=function(_0x547a0d,_0x442e7a){_0x547a0d=_0x547a0d-0x0;var _0x55f12c=_0x925d[_0x547a0d];return _0x55f12c;};'use strict';var _=require(_0xd925('0x0'));var util=require(_0xd925('0x1'));var logger=require('../../config/logger')(_0xd925('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xd925('0x3'));var fs=require('fs');var path=require(_0xd925('0x4'));var rimraf=require(_0xd925('0x5'));var config=require(_0xd925('0x6'));var attributes=require('./automation.attributes');module[_0xd925('0x7')]=function(_0x4d0a93,_0x5de7ae){return _0x4d0a93['define']('Automation',attributes,{'tableName':'tools_automations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/automation/automation.rpc.js b/server/api/automation/automation.rpc.js index 5266ab8..3a9711e 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 _0xc1d3=['stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','http','request','then','info','Automation,\x20%s,\x20%s','request\x20sent','debug','Automation,\x20%s,\x20%s,\x20%s'];(function(_0x178dbe,_0x969fba){var _0x2c6ea5=function(_0x3fcac7){while(--_0x3fcac7){_0x178dbe['push'](_0x178dbe['shift']());}};_0x2c6ea5(++_0x969fba);}(_0xc1d3,0x147));var _0x3c1d=function(_0x2ec3c3,_0xc744cd){_0x2ec3c3=_0x2ec3c3-0x0;var _0x5b374a=_0xc1d3[_0x2ec3c3];return _0x5b374a;};'use strict';var _=require(_0x3c1d('0x0'));var util=require(_0x3c1d('0x1'));var moment=require(_0x3c1d('0x2'));var BPromise=require(_0x3c1d('0x3'));var rs=require(_0x3c1d('0x4'));var fs=require('fs');var Redis=require(_0x3c1d('0x5'));var db=require(_0x3c1d('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x3c1d('0x7'));var config=require(_0x3c1d('0x8'));var jayson=require(_0x3c1d('0x9'));var client=jayson['client'][_0x3c1d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x36863b,_0x3bef1a,_0x28793c){return new BPromise(function(_0x1796a0,_0x58e08c){return client[_0x3c1d('0xb')](_0x36863b,_0x28793c)[_0x3c1d('0xc')](function(_0x33cb1b){logger[_0x3c1d('0xd')](_0x3c1d('0xe'),_0x3bef1a,_0x3c1d('0xf'));logger[_0x3c1d('0x10')](_0x3c1d('0x11'),_0x3bef1a,'request\x20sent',JSON[_0x3c1d('0x12')](_0x33cb1b));if(_0x33cb1b[_0x3c1d('0x13')]){if(_0x33cb1b[_0x3c1d('0x13')][_0x3c1d('0x14')]===0x1f4){logger[_0x3c1d('0x13')]('Automation,\x20%s,\x20%s',_0x3bef1a,_0x33cb1b[_0x3c1d('0x13')][_0x3c1d('0x15')]);return _0x58e08c(_0x33cb1b['error'][_0x3c1d('0x15')]);}logger['error']('Automation,\x20%s,\x20%s',_0x3bef1a,_0x33cb1b['error'][_0x3c1d('0x15')]);return _0x1796a0(_0x33cb1b[_0x3c1d('0x13')][_0x3c1d('0x15')]);}else{logger[_0x3c1d('0xd')](_0x3c1d('0xe'),_0x3bef1a,_0x3c1d('0xf'));_0x1796a0(_0x33cb1b['result']['message']);}})[_0x3c1d('0x16')](function(_0x5ab3b0){logger[_0x3c1d('0x13')](_0x3c1d('0xe'),_0x3bef1a,_0x5ab3b0);_0x58e08c(_0x5ab3b0);});});} \ No newline at end of file +var _0x6efe=['error','code','Automation,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug','Automation,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x32146e,_0x2be230){var _0x375cc7=function(_0xdf3711){while(--_0xdf3711){_0x32146e['push'](_0x32146e['shift']());}};_0x375cc7(++_0x2be230);}(_0x6efe,0xc6));var _0xe6ef=function(_0x1c60a1,_0x11b0e1){_0x1c60a1=_0x1c60a1-0x0;var _0x45a858=_0x6efe[_0x1c60a1];return _0x45a858;};'use strict';var _=require(_0xe6ef('0x0'));var util=require(_0xe6ef('0x1'));var moment=require(_0xe6ef('0x2'));var BPromise=require(_0xe6ef('0x3'));var rs=require(_0xe6ef('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xe6ef('0x5'));var logger=require(_0xe6ef('0x6'))(_0xe6ef('0x7'));var config=require(_0xe6ef('0x8'));var jayson=require(_0xe6ef('0x9'));var client=jayson['client'][_0xe6ef('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x422e13,_0x599b6c,_0x4a4bb9){return new BPromise(function(_0x51a9eb,_0x3256ff){return client[_0xe6ef('0xb')](_0x422e13,_0x4a4bb9)[_0xe6ef('0xc')](function(_0x4fca2f){logger[_0xe6ef('0xd')]('Automation,\x20%s,\x20%s',_0x599b6c,_0xe6ef('0xe'));logger[_0xe6ef('0xf')](_0xe6ef('0x10'),_0x599b6c,_0xe6ef('0xe'),JSON[_0xe6ef('0x11')](_0x4fca2f));if(_0x4fca2f[_0xe6ef('0x12')]){if(_0x4fca2f[_0xe6ef('0x12')][_0xe6ef('0x13')]===0x1f4){logger['error'](_0xe6ef('0x14'),_0x599b6c,_0x4fca2f[_0xe6ef('0x12')][_0xe6ef('0x15')]);return _0x3256ff(_0x4fca2f[_0xe6ef('0x12')]['message']);}logger[_0xe6ef('0x12')]('Automation,\x20%s,\x20%s',_0x599b6c,_0x4fca2f[_0xe6ef('0x12')][_0xe6ef('0x15')]);return _0x51a9eb(_0x4fca2f[_0xe6ef('0x12')][_0xe6ef('0x15')]);}else{logger[_0xe6ef('0xd')](_0xe6ef('0x14'),_0x599b6c,_0xe6ef('0xe'));_0x51a9eb(_0x4fca2f[_0xe6ef('0x16')][_0xe6ef('0x15')]);}})[_0xe6ef('0x17')](function(_0x5c32cc){logger[_0xe6ef('0x12')](_0xe6ef('0x14'),_0x599b6c,_0x5c32cc);_0x3256ff(_0x5c32cc);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index d5b8b42..f6be194 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 _0x9cff=['util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./automation.controller','get','isAuthenticated','index','/:id','show','/:id/conditions','getConditions','create','addConditions','/:id/actions','addActions','put','update','delete','destroy','exports'];(function(_0x374ada,_0x27b3a5){var _0x449ed8=function(_0x3efc46){while(--_0x3efc46){_0x374ada['push'](_0x374ada['shift']());}};_0x449ed8(++_0x27b3a5);}(_0x9cff,0x1b0));var _0xf9cf=function(_0xa9af46,_0x32ab25){_0xa9af46=_0xa9af46-0x0;var _0x24822d=_0x9cff[_0xa9af46];return _0x24822d;};'use strict';var multer=require('multer');var util=require(_0xf9cf('0x0'));var path=require(_0xf9cf('0x1'));var timeout=require(_0xf9cf('0x2'));var express=require('express');var router=express[_0xf9cf('0x3')]();var fs_extra=require(_0xf9cf('0x4'));var auth=require(_0xf9cf('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xf9cf('0x6'));var controller=require(_0xf9cf('0x7'));router[_0xf9cf('0x8')]('/',auth[_0xf9cf('0x9')](),controller[_0xf9cf('0xa')]);router[_0xf9cf('0x8')](_0xf9cf('0xb'),auth[_0xf9cf('0x9')](),controller[_0xf9cf('0xc')]);router[_0xf9cf('0x8')](_0xf9cf('0xd'),auth['isAuthenticated'](),controller[_0xf9cf('0xe')]);router[_0xf9cf('0x8')]('/:id/actions',auth[_0xf9cf('0x9')](),controller['getActions']);router['post']('/',auth[_0xf9cf('0x9')](),controller[_0xf9cf('0xf')]);router['post'](_0xf9cf('0xd'),auth['isAuthenticated'](),controller[_0xf9cf('0x10')]);router['post'](_0xf9cf('0x11'),auth['isAuthenticated'](),controller[_0xf9cf('0x12')]);router[_0xf9cf('0x13')](_0xf9cf('0xb'),auth[_0xf9cf('0x9')](),controller[_0xf9cf('0x14')]);router[_0xf9cf('0x15')](_0xf9cf('0xb'),auth['isAuthenticated'](),controller[_0xf9cf('0x16')]);module[_0xf9cf('0x17')]=router; \ No newline at end of file +var _0xf4e5=['express','Router','../../components/interaction/service','../../config/environment','./automation.controller','isAuthenticated','index','get','/:id','show','/:id/conditions','/:id/actions','getActions','create','post','addConditions','addActions','put','update','destroy','multer','util','path','connect-timeout'];(function(_0xfd495c,_0x4a3c1a){var _0x561dd8=function(_0x83e915){while(--_0x83e915){_0xfd495c['push'](_0xfd495c['shift']());}};_0x561dd8(++_0x4a3c1a);}(_0xf4e5,0xd4));var _0x5f4e=function(_0x5785fe,_0x359895){_0x5785fe=_0x5785fe-0x0;var _0x57a0e1=_0xf4e5[_0x5785fe];return _0x57a0e1;};'use strict';var multer=require(_0x5f4e('0x0'));var util=require(_0x5f4e('0x1'));var path=require(_0x5f4e('0x2'));var timeout=require(_0x5f4e('0x3'));var express=require(_0x5f4e('0x4'));var router=express[_0x5f4e('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x5f4e('0x6'));var config=require(_0x5f4e('0x7'));var controller=require(_0x5f4e('0x8'));router['get']('/',auth[_0x5f4e('0x9')](),controller[_0x5f4e('0xa')]);router[_0x5f4e('0xb')](_0x5f4e('0xc'),auth[_0x5f4e('0x9')](),controller[_0x5f4e('0xd')]);router[_0x5f4e('0xb')](_0x5f4e('0xe'),auth[_0x5f4e('0x9')](),controller['getConditions']);router['get'](_0x5f4e('0xf'),auth[_0x5f4e('0x9')](),controller[_0x5f4e('0x10')]);router['post']('/',auth[_0x5f4e('0x9')](),controller[_0x5f4e('0x11')]);router[_0x5f4e('0x12')](_0x5f4e('0xe'),auth[_0x5f4e('0x9')](),controller[_0x5f4e('0x13')]);router[_0x5f4e('0x12')](_0x5f4e('0xf'),auth[_0x5f4e('0x9')](),controller[_0x5f4e('0x14')]);router[_0x5f4e('0x15')]('/:id',auth[_0x5f4e('0x9')](),controller[_0x5f4e('0x16')]);router['delete'](_0x5f4e('0xc'),auth[_0x5f4e('0x9')](),controller[_0x5f4e('0x17')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/campaign/campaign.attributes.js b/server/api/campaign/campaign.attributes.js index be9c658..7309277 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 _0x2675=['STRING','name','ENUM','ivr','BOOLEAN','Active/Disactive\x20Campaign','INTEGER','UNSIGNED','Max\x20200\x20calls.','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','DESC','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)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize','exports'];(function(_0x303c0a,_0x1b2e62){var _0x233310=function(_0x358546){while(--_0x358546){_0x303c0a['push'](_0x303c0a['shift']());}};_0x233310(++_0x1b2e62);}(_0x2675,0x1ab));var _0x5267=function(_0x49e066,_0x27e060){_0x49e066=_0x49e066-0x0;var _0x49ba9b=_0x2675[_0x49e066];return _0x49ba9b;};'use strict';var Sequelize=require(_0x5267('0x0'));module[_0x5267('0x1')]={'name':{'type':Sequelize[_0x5267('0x2')],'unique':_0x5267('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0x5267('0x4')](_0x5267('0x5')),'allowNull':![],'defaultValue':_0x5267('0x5')},'description':{'type':Sequelize[_0x5267('0x2')]},'active':{'type':Sequelize[_0x5267('0x6')],'defaultValue':0x0,'comment':_0x5267('0x7')},'limitCalls':{'type':Sequelize[_0x5267('0x8')](0x4)[_0x5267('0x9')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0x5267('0xa')},'dialOriginateCallerIdName':{'type':Sequelize[_0x5267('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize['STRING']},'dialOriginateTimeout':{'type':Sequelize[_0x5267('0x8')](0x3)[_0x5267('0x9')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5267('0xb')},'dialCongestionMaxRetry':{'type':Sequelize[_0x5267('0x8')](0x3)[_0x5267('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5267('0xc')},'dialCongestionRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x5267('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x5267('0xd')},'dialBusyMaxRetry':{'type':Sequelize[_0x5267('0x8')](0x3)[_0x5267('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5267('0xe')},'dialBusyRetryFrequency':{'type':Sequelize[_0x5267('0x8')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x5267('0xf')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x5267('0x8')](0x3)[_0x5267('0x9')],'defaultValue':0x3,'comment':'#NoAnswer\x20Retry\x20(min:1,\x20max:999)'},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x5267('0x8')](0x5)[_0x5267('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x5267('0x10')},'dialGlobalMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x5267('0x9')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x5267('0x11')},'dialTimezone':{'type':Sequelize['STRING'],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x5267('0x2')],'defaultValue':_0x5267('0x12')},'dialCheckDuplicateType':{'type':Sequelize['ENUM'](_0x5267('0x13'),'never',_0x5267('0x14')),'defaultValue':'always'},'dialAMDActive':{'type':Sequelize[_0x5267('0x6')],'defaultValue':0x0,'comment':_0x5267('0x15')},'dialAMDInitialSilence':{'type':Sequelize[_0x5267('0x8')](0x9)['UNSIGNED'],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x5267('0x16')},'dialAMDGreeting':{'type':Sequelize[_0x5267('0x8')](0x9)['UNSIGNED'],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':'#AMD\x20Greeting'},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x5267('0x8')](0x9)[_0x5267('0x9')],'defaultValue':0x320,'validate':{'min':0x0},'comment':'#AMD\x20After\x20Greeting\x20Silence'},'dialAMDTotalAnalysisTime':{'type':Sequelize['INTEGER'](0x9)[_0x5267('0x9')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x5267('0x17')},'dialAMDMinWordLength':{'type':Sequelize[_0x5267('0x8')](0x9)['UNSIGNED'],'defaultValue':0x64,'validate':{'min':0x0},'comment':'#AMD\x20Min\x20Word\x20Length'},'dialAMDBetweenWordsSilence':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x5267('0x18')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x5267('0x8')](0x9)[_0x5267('0x9')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x5267('0x19')},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)[_0x5267('0x9')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x5267('0x1a')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x5267('0x8')](0x9)[_0x5267('0x9')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x5267('0x1b')},'dialOrderByScheduledAt':{'type':Sequelize[_0x5267('0x4')](_0x5267('0x1c'),'ASC'),'defaultValue':_0x5267('0x1c')},'dialPrefix':{'type':Sequelize['STRING'],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x5267('0x8')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x5267('0x1d')},'dialCutDigit':{'type':Sequelize[_0x5267('0x8')](0x3)[_0x5267('0x9')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x5267('0x1e')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x5267('0x8')](0x3)[_0x5267('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'},'dialNoSuchNumberRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x5267('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x5267('0x1f')},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x5267('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5267('0x20')},'dialDropRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x5267('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x5267('0x21')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x5267('0x8')](0x3)[_0x5267('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5267('0x22')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x5267('0x8')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialMachineMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5267('0x23')},'dialMachineRetryFrequency':{'type':Sequelize[_0x5267('0x8')](0x5)[_0x5267('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x5267('0x24')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x5267('0x8')](0x3)[_0x5267('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5267('0x25')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x5267('0x8')](0x5)[_0x5267('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x5267('0x26')}}; \ No newline at end of file +var _0xdfc0=['UNSIGNED','#Congestion\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','never','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Greeting','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','#Machine\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize','STRING','name','ENUM','ivr','BOOLEAN','INTEGER','Max\x20200\x20calls.'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xdfc0,0x1aa));var _0x0dfc=function(_0x169f05,_0x451867){_0x169f05=_0x169f05-0x0;var _0x44c984=_0xdfc0[_0x169f05];return _0x44c984;};'use strict';var Sequelize=require(_0x0dfc('0x0'));module['exports']={'name':{'type':Sequelize[_0x0dfc('0x1')],'unique':_0x0dfc('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0x0dfc('0x3')](_0x0dfc('0x4')),'allowNull':![],'defaultValue':_0x0dfc('0x4')},'description':{'type':Sequelize[_0x0dfc('0x1')]},'active':{'type':Sequelize[_0x0dfc('0x5')],'defaultValue':0x0,'comment':'Active/Disactive\x20Campaign'},'limitCalls':{'type':Sequelize[_0x0dfc('0x6')](0x4)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0x0dfc('0x7')},'dialOriginateCallerIdName':{'type':Sequelize[_0x0dfc('0x1')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x0dfc('0x1')]},'dialOriginateTimeout':{'type':Sequelize[_0x0dfc('0x6')](0x3)[_0x0dfc('0x8')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':'Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialCongestionMaxRetry':{'type':Sequelize[_0x0dfc('0x6')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0dfc('0x9')},'dialCongestionRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x0dfc('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialBusyMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x0dfc('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize[_0x0dfc('0x6')](0x5)[_0x0dfc('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x0dfc('0x6')](0x3)[_0x0dfc('0x8')],'defaultValue':0x3,'comment':'#NoAnswer\x20Retry\x20(min:1,\x20max:999)'},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x0dfc('0x6')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialGlobalMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x0dfc('0x8')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':'#Global\x20Max\x20Retry\x20(min:1,\x20max:999)'},'dialTimezone':{'type':Sequelize['STRING'],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x0dfc('0x1')],'defaultValue':_0x0dfc('0xa')},'dialCheckDuplicateType':{'type':Sequelize['ENUM']('always',_0x0dfc('0xb'),_0x0dfc('0xc')),'defaultValue':'always'},'dialAMDActive':{'type':Sequelize[_0x0dfc('0x5')],'defaultValue':0x0,'comment':_0x0dfc('0xd')},'dialAMDInitialSilence':{'type':Sequelize[_0x0dfc('0x6')](0x9)[_0x0dfc('0x8')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':'#AMD\x20Initial\x20Silence'},'dialAMDGreeting':{'type':Sequelize[_0x0dfc('0x6')](0x9)[_0x0dfc('0x8')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x0dfc('0xe')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x0dfc('0x6')](0x9)[_0x0dfc('0x8')],'defaultValue':0x320,'validate':{'min':0x0},'comment':'#AMD\x20After\x20Greeting\x20Silence'},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x0dfc('0x6')](0x9)[_0x0dfc('0x8')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x0dfc('0xf')},'dialAMDMinWordLength':{'type':Sequelize['INTEGER'](0x9)[_0x0dfc('0x8')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x0dfc('0x10')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x0dfc('0x6')](0x9)[_0x0dfc('0x8')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x0dfc('0x11')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x0dfc('0x6')](0x9)[_0x0dfc('0x8')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x0dfc('0x12')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x0dfc('0x6')](0x5)[_0x0dfc('0x8')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x0dfc('0x13')},'dialAMDMaximumWordLength':{'type':Sequelize['INTEGER'](0x9)[_0x0dfc('0x8')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x0dfc('0x14')},'dialOrderByScheduledAt':{'type':Sequelize['ENUM'](_0x0dfc('0x15'),_0x0dfc('0x16')),'defaultValue':'DESC'},'dialPrefix':{'type':Sequelize[_0x0dfc('0x1')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x0dfc('0x6')](0x3)[_0x0dfc('0x8')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x0dfc('0x17')},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)[_0x0dfc('0x8')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x0dfc('0x18')},'dialNoSuchNumberMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x0dfc('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0dfc('0x19')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x0dfc('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0dfc('0x1a')},'dialDropMaxRetry':{'type':Sequelize[_0x0dfc('0x6')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0dfc('0x1b')},'dialDropRetryFrequency':{'type':Sequelize[_0x0dfc('0x6')](0x5)[_0x0dfc('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAbandonedMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0dfc('0x1c')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x0dfc('0x6')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialMachineMaxRetry':{'type':Sequelize[_0x0dfc('0x6')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0dfc('0x1d')},'dialMachineRetryFrequency':{'type':Sequelize[_0x0dfc('0x6')](0x5)[_0x0dfc('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x0dfc('0x6')](0x3)[_0x0dfc('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#AgentReject\x20Retry\x20(min:1,\x20max:999)'},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x0dfc('0x6')](0x5)[_0x0dfc('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0dfc('0x1e')}}; \ No newline at end of file diff --git a/server/api/campaign/campaign.controller.js b/server/api/campaign/campaign.controller.js index fe20d45..6a9bea5 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 _0x7792=['../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','get','IvrCampaigns','UserProfileResource','end','stack','name','send','index','map','Campaign','rawAttributes','type','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','include','findAll','rows','catch','show','params','keys','includeAll','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','UserProfileSection','userProfileId','autoAssociation','error','getHoppers','findOne','CmHopper','CampaignId','getHopperHistories','CmHopperHistory','nolimit','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','CmList','getLists','addLists','ids','spread','dialCheckDuplicateType','into','cm_hopper','phone','scheduledAt','ContactId','NOW()','field','toString','from','cm_contacts','deletedAt\x20IS\x20NULL','CmListId','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','CampaignId\x20=\x20?','select','COALESCE(phone,\x27\x27)','insert','fromQuery','ListId','phone\x20IS\x20NOT\x20NULL','ListId\x20=\x20?','push','sequelize','all','removeLists','getBlackLists','addBlackLists','removeBlackLists','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/qs'];(function(_0x460f81,_0x553431){var _0x423f0d=function(_0x267a6b){while(--_0x267a6b){_0x460f81['push'](_0x460f81['shift']());}};_0x423f0d(++_0x553431);}(_0x7792,0x184));var _0x2779=function(_0x229f5e,_0x433f0f){_0x229f5e=_0x229f5e-0x0;var _0x2d62ff=_0x7792[_0x229f5e];return _0x2d62ff;};'use strict';var emlformat=require(_0x2779('0x0'));var rimraf=require(_0x2779('0x1'));var zipdir=require(_0x2779('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2779('0x3'));var moment=require(_0x2779('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x2779('0x5'));var util=require(_0x2779('0x6'));var path=require(_0x2779('0x7'));var sox=require(_0x2779('0x8'));var csv=require('to-csv');var ejs=require(_0x2779('0x9'));var fs=require('fs');var fs_extra=require(_0x2779('0xa'));var _=require(_0x2779('0xb'));var squel=require(_0x2779('0xc'));var crypto=require(_0x2779('0xd'));var jsforce=require(_0x2779('0xe'));var deskjs=require(_0x2779('0xf'));var toCsv=require(_0x2779('0x10'));var querystring=require(_0x2779('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x2779('0x12'));var qs=require(_0x2779('0x13'));var as=require(_0x2779('0x14'));var hardwareService=require(_0x2779('0x15'));var logger=require('../../config/logger')(_0x2779('0x16'));var utils=require(_0x2779('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x2779('0x18'));var db=require(_0x2779('0x19'))['db'];function respondWithStatusCode(_0x285786,_0xd98fe0){_0xd98fe0=_0xd98fe0||0xcc;return function(_0x503fac){if(_0x503fac){return _0x285786[_0x2779('0x1a')](_0xd98fe0);}return _0x285786[_0x2779('0x1b')](_0xd98fe0)['end']();};}function respondWithResult(_0x3e28a1,_0x22122b){_0x22122b=_0x22122b||0xc8;return function(_0x3ac775){if(_0x3ac775){return _0x3e28a1[_0x2779('0x1b')](_0x22122b)[_0x2779('0x1c')](_0x3ac775);}};}function respondWithFilteredResult(_0xdca5d5,_0xffe5b1){return function(_0x1cfd85){if(_0x1cfd85){var _0xb29e28=typeof _0xffe5b1[_0x2779('0x1d')]===_0x2779('0x1e')&&typeof _0xffe5b1[_0x2779('0x1f')]===_0x2779('0x1e');var _0x103498=_0x1cfd85[_0x2779('0x20')];var _0x27ea78=_0xb29e28?0x0:_0xffe5b1[_0x2779('0x1d')];var _0x492fe0=_0xb29e28?_0x1cfd85[_0x2779('0x20')]:_0xffe5b1[_0x2779('0x1d')]+_0xffe5b1[_0x2779('0x1f')];var _0x2786aa;if(_0x492fe0>=_0x103498){_0x492fe0=_0x103498;_0x2786aa=0xc8;}else{_0x2786aa=0xce;}_0xdca5d5['status'](_0x2786aa);return _0xdca5d5[_0x2779('0x21')](_0x2779('0x22'),_0x27ea78+'-'+_0x492fe0+'/'+_0x103498)[_0x2779('0x1c')](_0x1cfd85);}return null;};}function patchUpdates(_0x989416){return function(_0x206644){try{jsonpatch['apply'](_0x206644,_0x989416,!![]);}catch(_0x2ddfd3){return BPromise[_0x2779('0x23')](_0x2ddfd3);}return _0x206644[_0x2779('0x24')]();};}function saveUpdates(_0x441648,_0x6ff722){return function(_0x4d6d5a){if(_0x4d6d5a){return _0x4d6d5a[_0x2779('0x25')](_0x441648)[_0x2779('0x26')](function(_0xdbc38a){return _0xdbc38a;});}return null;};}function removeEntity(_0x45e2da,_0x5a728d){return function(_0x338336){if(_0x338336){return _0x338336[_0x2779('0x27')]()[_0x2779('0x26')](function(){var _0x289af4=_0x338336[_0x2779('0x28')]({'plain':!![]});var _0x10b63e=_0x2779('0x29');return db[_0x2779('0x2a')][_0x2779('0x27')]({'where':{'type':_0x10b63e,'resourceId':_0x289af4['id']}})[_0x2779('0x26')](function(){return _0x338336;});})[_0x2779('0x26')](function(){_0x45e2da[_0x2779('0x1b')](0xcc)[_0x2779('0x2b')]();});}};}function handleEntityNotFound(_0x375a68,_0x327e43){return function(_0x51dced){if(!_0x51dced){_0x375a68['sendStatus'](0x194);}return _0x51dced;};}function handleError(_0x34b4ea,_0x32081c){_0x32081c=_0x32081c||0x1f4;return function(_0x4cf2f4){logger['error'](_0x4cf2f4[_0x2779('0x2c')]);if(_0x4cf2f4[_0x2779('0x2d')]){delete _0x4cf2f4['name'];}_0x34b4ea['status'](_0x32081c)[_0x2779('0x2e')](_0x4cf2f4);};}exports[_0x2779('0x2f')]=function(_0x3ce4cd,_0xaf4276){var _0x3f4f9c={},_0x56a5e2={},_0x26baf7={'count':0x0,'rows':[]};var _0x48b092=_[_0x2779('0x30')](db[_0x2779('0x31')][_0x2779('0x32')],function(_0x35a9bf){return{'name':_0x35a9bf['fieldName'],'type':_0x35a9bf[_0x2779('0x33')]['key']};});_0x56a5e2['model']=_[_0x2779('0x30')](_0x48b092,_0x2779('0x2d'));_0x56a5e2[_0x2779('0x34')]=_['keys'](_0x3ce4cd['query']);_0x56a5e2[_0x2779('0x35')]=_['intersection'](_0x56a5e2[_0x2779('0x36')],_0x56a5e2[_0x2779('0x34')]);_0x3f4f9c[_0x2779('0x37')]=_[_0x2779('0x38')](_0x56a5e2['model'],qs[_0x2779('0x39')](_0x3ce4cd[_0x2779('0x34')][_0x2779('0x39')]));_0x3f4f9c[_0x2779('0x37')]=_0x3f4f9c[_0x2779('0x37')][_0x2779('0x3a')]?_0x3f4f9c[_0x2779('0x37')]:_0x56a5e2[_0x2779('0x36')];if(!_0x3ce4cd[_0x2779('0x34')][_0x2779('0x3b')]('nolimit')){_0x3f4f9c[_0x2779('0x1f')]=qs['limit'](_0x3ce4cd[_0x2779('0x34')][_0x2779('0x1f')]);_0x3f4f9c[_0x2779('0x1d')]=qs[_0x2779('0x1d')](_0x3ce4cd[_0x2779('0x34')][_0x2779('0x1d')]);}_0x3f4f9c[_0x2779('0x3c')]=qs[_0x2779('0x3d')](_0x3ce4cd[_0x2779('0x34')]['sort']);_0x3f4f9c[_0x2779('0x3e')]=qs[_0x2779('0x35')](_[_0x2779('0x3f')](_0x3ce4cd['query'],_0x56a5e2[_0x2779('0x35')]),_0x48b092);if(_0x3ce4cd[_0x2779('0x34')][_0x2779('0x40')]){_0x3f4f9c['where']=_[_0x2779('0x41')](_0x3f4f9c['where'],{'$or':_[_0x2779('0x30')](_0x48b092,function(_0xd03271){if(_0xd03271[_0x2779('0x33')]!=='VIRTUAL'){var _0x4af19a={};_0x4af19a[_0xd03271[_0x2779('0x2d')]]={'$like':'%'+_0x3ce4cd[_0x2779('0x34')][_0x2779('0x40')]+'%'};return _0x4af19a;}})});}_0x3f4f9c=_[_0x2779('0x41')]({},_0x3f4f9c,_0x3ce4cd['options']);var _0xfe97b4={'where':_0x3f4f9c[_0x2779('0x3e')]};return db['Campaign'][_0x2779('0x20')](_0xfe97b4)[_0x2779('0x26')](function(_0x2a24f8){_0x26baf7[_0x2779('0x20')]=_0x2a24f8;if(_0x3ce4cd[_0x2779('0x34')]['includeAll']){_0x3f4f9c[_0x2779('0x42')]=[{'all':!![]}];}return db[_0x2779('0x31')][_0x2779('0x43')](_0x3f4f9c);})[_0x2779('0x26')](function(_0x1b711c){_0x26baf7[_0x2779('0x44')]=_0x1b711c;return _0x26baf7;})[_0x2779('0x26')](respondWithFilteredResult(_0xaf4276,_0x3f4f9c))[_0x2779('0x45')](handleError(_0xaf4276,null));};exports[_0x2779('0x46')]=function(_0x26ddee,_0x38ced1){var _0x15be23={'raw':![],'where':{'id':_0x26ddee[_0x2779('0x47')]['id']}},_0x6de4c0={};_0x6de4c0[_0x2779('0x36')]=_[_0x2779('0x48')](db[_0x2779('0x31')][_0x2779('0x32')]);_0x6de4c0[_0x2779('0x34')]=_[_0x2779('0x48')](_0x26ddee[_0x2779('0x34')]);_0x6de4c0[_0x2779('0x35')]=_[_0x2779('0x38')](_0x6de4c0[_0x2779('0x36')],_0x6de4c0[_0x2779('0x34')]);_0x15be23['attributes']=_[_0x2779('0x38')](_0x6de4c0[_0x2779('0x36')],qs['fields'](_0x26ddee[_0x2779('0x34')]['fields']));_0x15be23[_0x2779('0x37')]=_0x15be23[_0x2779('0x37')][_0x2779('0x3a')]?_0x15be23[_0x2779('0x37')]:_0x6de4c0[_0x2779('0x36')];if(_0x26ddee[_0x2779('0x34')][_0x2779('0x49')]){_0x15be23[_0x2779('0x42')]=[{'all':!![]}];}_0x15be23=_[_0x2779('0x41')]({},_0x15be23,_0x26ddee[_0x2779('0x4a')]);return db[_0x2779('0x31')][_0x2779('0x4b')](_0x15be23)[_0x2779('0x26')](handleEntityNotFound(_0x38ced1,null))[_0x2779('0x26')](respondWithResult(_0x38ced1,null))[_0x2779('0x45')](handleError(_0x38ced1,null));};exports[_0x2779('0x4c')]=function(_0x381c9c,_0x4bb1ba){return db[_0x2779('0x31')]['create'](_0x381c9c[_0x2779('0x4d')],{})[_0x2779('0x26')](function(_0xdd93ad){var _0x3bb6d2=_0x381c9c[_0x2779('0x4e')]['get']({'plain':!![]});if(!_0x3bb6d2)throw new Error(_0x2779('0x4f'));if(_0x3bb6d2[_0x2779('0x50')]===_0x2779('0x4e')){var _0x11a94f=_0xdd93ad[_0x2779('0x28')]({'plain':!![]});var _0x3c67bf=_0x2779('0x29');return db['UserProfileSection'][_0x2779('0x4b')]({'where':{'name':_0x3c67bf,'userProfileId':_0x3bb6d2['userProfileId']},'raw':!![]})['then'](function(_0x468c25){if(_0x468c25&&_0x468c25['autoAssociation']===0x0){return db[_0x2779('0x2a')][_0x2779('0x4c')]({'name':_0x11a94f[_0x2779('0x2d')],'resourceId':_0x11a94f['id'],'type':_0x468c25['name'],'sectionId':_0x468c25['id']},{})[_0x2779('0x26')](function(){return _0xdd93ad;});}else{return _0xdd93ad;}})[_0x2779('0x45')](function(_0x16dee7){logger['error'](_0x2779('0x51'),_0x16dee7);throw _0x16dee7;});}return _0xdd93ad;})['then'](respondWithResult(_0x4bb1ba,0xc9))[_0x2779('0x45')](handleError(_0x4bb1ba,null));};exports[_0x2779('0x52')]=function(_0x190f4a,_0x10a90a){var _0x282d06={'where':{'id':_0x190f4a[_0x2779('0x47')]['id']}},_0x1f6940={};_0x1f6940[_0x2779('0x36')]=_[_0x2779('0x48')](db[_0x2779('0x31')][_0x2779('0x32')]);_0x282d06['attributes']=_[_0x2779('0x38')](_0x1f6940[_0x2779('0x36')],qs[_0x2779('0x39')](_0x190f4a[_0x2779('0x34')][_0x2779('0x39')]));_0x282d06[_0x2779('0x37')]=_0x282d06[_0x2779('0x37')][_0x2779('0x3a')]?_0x282d06[_0x2779('0x37')]:_0x1f6940[_0x2779('0x36')];if(_0x190f4a[_0x2779('0x34')]['includeAll']){_0x282d06[_0x2779('0x42')]=[{'all':!![]}];}_0x282d06=_[_0x2779('0x41')]({},_0x282d06,_0x190f4a[_0x2779('0x4a')]);return db[_0x2779('0x31')][_0x2779('0x4b')](_0x282d06)[_0x2779('0x26')](handleEntityNotFound(_0x10a90a,null))['then'](function(_0x33924c){if(_0x33924c){var _0x1103ed=_0x33924c[_0x2779('0x28')]({'plain':!![]});_0x1103ed=qs[_0x2779('0x53')](_0x1103ed,['id',_0x2779('0x54'),_0x2779('0x55')]);_0x190f4a[_0x2779('0x4d')]=_[_0x2779('0x53')](_0x190f4a[_0x2779('0x4d')],['id',_0x2779('0x54'),_0x2779('0x55')]);return db['Campaign'][_0x2779('0x4c')](_[_0x2779('0x41')](_0x1103ed,_0x190f4a['body']),{'include':_0x190f4a[_0x2779('0x34')][_0x2779('0x49')]?[{'all':!![]}]:undefined})[_0x2779('0x26')](function(_0x463ba1){var _0x465c4a=_0x190f4a['user']['get']({'plain':!![]});if(!_0x465c4a)throw new Error(_0x2779('0x4f'));if(_0x465c4a[_0x2779('0x50')]===_0x2779('0x4e')){var _0x23f7f1=_0x463ba1['get']({'plain':!![]});var _0x306a8b=_0x2779('0x29');return db[_0x2779('0x56')]['find']({'where':{'name':_0x306a8b,'userProfileId':_0x465c4a[_0x2779('0x57')]},'raw':!![]})['then'](function(_0x28804d){if(_0x28804d&&_0x28804d[_0x2779('0x58')]===0x0){return db['UserProfileResource'][_0x2779('0x4c')]({'name':_0x23f7f1[_0x2779('0x2d')],'resourceId':_0x23f7f1['id'],'type':_0x28804d[_0x2779('0x2d')],'sectionId':_0x28804d['id']},{})[_0x2779('0x26')](function(){return _0x463ba1;});}else{return _0x463ba1;}})['catch'](function(_0x5b19b7){logger[_0x2779('0x59')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5b19b7);throw _0x5b19b7;});}return _0x463ba1;});}})[_0x2779('0x26')](respondWithResult(_0x10a90a,0xc9))[_0x2779('0x45')](handleError(_0x10a90a,null));};exports['update']=function(_0x2559b8,_0xa02fd0){if(_0x2559b8[_0x2779('0x4d')]['id']){delete _0x2559b8[_0x2779('0x4d')]['id'];}return db[_0x2779('0x31')][_0x2779('0x4b')]({'where':{'id':_0x2559b8[_0x2779('0x47')]['id']}})['then'](handleEntityNotFound(_0xa02fd0,null))[_0x2779('0x26')](saveUpdates(_0x2559b8[_0x2779('0x4d')],null))[_0x2779('0x26')](respondWithResult(_0xa02fd0,null))[_0x2779('0x45')](handleError(_0xa02fd0,null));};exports[_0x2779('0x27')]=function(_0x125de4,_0x382c0f){return db['Campaign']['find']({'where':{'id':_0x125de4[_0x2779('0x47')]['id']}})[_0x2779('0x26')](handleEntityNotFound(_0x382c0f,null))['then'](removeEntity(_0x382c0f,null))['catch'](handleError(_0x382c0f,null));};exports[_0x2779('0x5a')]=function(_0xb8a57b,_0x1479a2,_0x56ba09){var _0x4b3b98={'raw':!![],'where':{}};var _0x2b4252={};var _0x5c5a22={'count':0x0,'rows':[]};return db[_0x2779('0x31')][_0x2779('0x5b')]({'where':{'id':_0xb8a57b['params']['id']}})[_0x2779('0x26')](handleEntityNotFound(_0x1479a2,null))[_0x2779('0x26')](function(_0x1e14ed){if(_0x1e14ed){_0x2b4252[_0x2779('0x36')]=_['keys'](db[_0x2779('0x5c')][_0x2779('0x32')]);_0x2b4252[_0x2779('0x34')]=_['keys'](_0xb8a57b[_0x2779('0x34')]);_0x2b4252[_0x2779('0x35')]=_[_0x2779('0x38')](_0x2b4252[_0x2779('0x36')],_0x2b4252[_0x2779('0x34')]);_0x4b3b98['attributes']=_[_0x2779('0x38')](_0x2b4252['model'],qs[_0x2779('0x39')](_0xb8a57b[_0x2779('0x34')][_0x2779('0x39')]));_0x4b3b98['attributes']=_0x4b3b98[_0x2779('0x37')][_0x2779('0x3a')]?_0x4b3b98[_0x2779('0x37')]:_0x2b4252[_0x2779('0x36')];if(!_0xb8a57b[_0x2779('0x34')][_0x2779('0x3b')]('nolimit')){_0x4b3b98[_0x2779('0x1f')]=qs[_0x2779('0x1f')](_0xb8a57b[_0x2779('0x34')][_0x2779('0x1f')]);_0x4b3b98[_0x2779('0x1d')]=qs[_0x2779('0x1d')](_0xb8a57b[_0x2779('0x34')][_0x2779('0x1d')]);}_0x4b3b98['order']=qs['sort'](_0xb8a57b[_0x2779('0x34')][_0x2779('0x3d')]);_0x4b3b98['where']=qs[_0x2779('0x35')](_[_0x2779('0x3f')](_0xb8a57b[_0x2779('0x34')],_0x2b4252[_0x2779('0x35')]));_0x4b3b98[_0x2779('0x3e')][_0x2779('0x5d')]=_0x1e14ed['id'];if(_0xb8a57b[_0x2779('0x34')]['filter']){_0x4b3b98[_0x2779('0x3e')]=_[_0x2779('0x41')](_0x4b3b98[_0x2779('0x3e')],{'$or':_[_0x2779('0x30')](_0x4b3b98[_0x2779('0x37')],function(_0x27873d){var _0x13fc70={};_0x13fc70[_0x27873d]={'$like':'%'+_0xb8a57b[_0x2779('0x34')][_0x2779('0x40')]+'%'};return _0x13fc70;})});}_0x4b3b98=_[_0x2779('0x41')]({},_0x4b3b98,_0xb8a57b[_0x2779('0x4a')]);return db[_0x2779('0x5c')]['count']({'where':_0x4b3b98[_0x2779('0x3e')]})[_0x2779('0x26')](function(_0x3b5a32){_0x5c5a22[_0x2779('0x20')]=_0x3b5a32;if(_0xb8a57b[_0x2779('0x34')][_0x2779('0x49')]){_0x4b3b98[_0x2779('0x42')]=[{'all':!![]}];}return db[_0x2779('0x5c')][_0x2779('0x43')](_0x4b3b98);})[_0x2779('0x26')](function(_0x4b3719){_0x5c5a22[_0x2779('0x44')]=_0x4b3719;return _0x5c5a22;});}})[_0x2779('0x26')](respondWithFilteredResult(_0x1479a2,_0x4b3b98))[_0x2779('0x45')](handleError(_0x1479a2,null));};exports[_0x2779('0x5e')]=function(_0x579bbd,_0x4f1779,_0x38754f){var _0x178984={'raw':!![],'where':{}};var _0x21d08c={};var _0x3c5f54={'count':0x0,'rows':[]};return db[_0x2779('0x31')]['findOne']({'where':{'id':_0x579bbd[_0x2779('0x47')]['id']}})[_0x2779('0x26')](handleEntityNotFound(_0x4f1779,null))[_0x2779('0x26')](function(_0x4b04e1){if(_0x4b04e1){_0x21d08c['model']=_[_0x2779('0x48')](db[_0x2779('0x5f')]['rawAttributes']);_0x21d08c[_0x2779('0x34')]=_[_0x2779('0x48')](_0x579bbd[_0x2779('0x34')]);_0x21d08c[_0x2779('0x35')]=_[_0x2779('0x38')](_0x21d08c[_0x2779('0x36')],_0x21d08c[_0x2779('0x34')]);_0x178984['attributes']=_[_0x2779('0x38')](_0x21d08c[_0x2779('0x36')],qs[_0x2779('0x39')](_0x579bbd['query'][_0x2779('0x39')]));_0x178984[_0x2779('0x37')]=_0x178984[_0x2779('0x37')][_0x2779('0x3a')]?_0x178984['attributes']:_0x21d08c['model'];if(!_0x579bbd[_0x2779('0x34')]['hasOwnProperty'](_0x2779('0x60'))){_0x178984[_0x2779('0x1f')]=qs['limit'](_0x579bbd[_0x2779('0x34')][_0x2779('0x1f')]);_0x178984[_0x2779('0x1d')]=qs[_0x2779('0x1d')](_0x579bbd['query'][_0x2779('0x1d')]);}_0x178984[_0x2779('0x3c')]=qs[_0x2779('0x3d')](_0x579bbd[_0x2779('0x34')][_0x2779('0x3d')]);_0x178984[_0x2779('0x3e')]=qs['filters'](_[_0x2779('0x3f')](_0x579bbd[_0x2779('0x34')],_0x21d08c[_0x2779('0x35')]));_0x178984[_0x2779('0x3e')][_0x2779('0x5d')]=_0x4b04e1['id'];if(_0x579bbd['query'][_0x2779('0x40')]){_0x178984[_0x2779('0x3e')]=_[_0x2779('0x41')](_0x178984[_0x2779('0x3e')],{'$or':_['map'](_0x178984['attributes'],function(_0x13655f){var _0xa49cdb={};_0xa49cdb[_0x13655f]={'$like':'%'+_0x579bbd[_0x2779('0x34')][_0x2779('0x40')]+'%'};return _0xa49cdb;})});}_0x178984=_[_0x2779('0x41')]({},_0x178984,_0x579bbd[_0x2779('0x4a')]);return db[_0x2779('0x5f')][_0x2779('0x20')]({'where':_0x178984[_0x2779('0x3e')]})[_0x2779('0x26')](function(_0x42c715){_0x3c5f54[_0x2779('0x20')]=_0x42c715;if(_0x579bbd[_0x2779('0x34')]['includeAll']){_0x178984['include']=[{'all':!![]}];}return db['CmHopperHistory']['findAll'](_0x178984);})[_0x2779('0x26')](function(_0x2ca465){_0x3c5f54[_0x2779('0x44')]=_0x2ca465;return _0x3c5f54;});}})['then'](respondWithFilteredResult(_0x4f1779,_0x178984))['catch'](handleError(_0x4f1779,null));};exports[_0x2779('0x61')]=function(_0x54a231,_0x9bf0e5,_0x388e64){var _0x2163e2={'raw':!![],'where':{}};var _0x1e4d3c={};var _0x32b16f={'count':0x0,'rows':[]};return db[_0x2779('0x31')][_0x2779('0x5b')]({'where':{'id':_0x54a231[_0x2779('0x47')]['id']}})[_0x2779('0x26')](handleEntityNotFound(_0x9bf0e5,null))[_0x2779('0x26')](function(_0x2c4223){if(_0x2c4223){_0x1e4d3c[_0x2779('0x36')]=_[_0x2779('0x48')](db['CmHopperFinal']['rawAttributes']);_0x1e4d3c['query']=_[_0x2779('0x48')](_0x54a231['query']);_0x1e4d3c[_0x2779('0x35')]=_[_0x2779('0x38')](_0x1e4d3c[_0x2779('0x36')],_0x1e4d3c[_0x2779('0x34')]);_0x2163e2[_0x2779('0x37')]=_[_0x2779('0x38')](_0x1e4d3c['model'],qs[_0x2779('0x39')](_0x54a231[_0x2779('0x34')]['fields']));_0x2163e2[_0x2779('0x37')]=_0x2163e2[_0x2779('0x37')][_0x2779('0x3a')]?_0x2163e2[_0x2779('0x37')]:_0x1e4d3c[_0x2779('0x36')];if(!_0x54a231[_0x2779('0x34')][_0x2779('0x3b')](_0x2779('0x60'))){_0x2163e2[_0x2779('0x1f')]=qs[_0x2779('0x1f')](_0x54a231['query'][_0x2779('0x1f')]);_0x2163e2[_0x2779('0x1d')]=qs[_0x2779('0x1d')](_0x54a231[_0x2779('0x34')][_0x2779('0x1d')]);}_0x2163e2[_0x2779('0x3c')]=qs[_0x2779('0x3d')](_0x54a231['query'][_0x2779('0x3d')]);_0x2163e2[_0x2779('0x3e')]=qs['filters'](_[_0x2779('0x3f')](_0x54a231['query'],_0x1e4d3c['filters']));_0x2163e2[_0x2779('0x3e')][_0x2779('0x5d')]=_0x2c4223['id'];if(_0x54a231[_0x2779('0x34')][_0x2779('0x40')]){_0x2163e2['where']=_[_0x2779('0x41')](_0x2163e2[_0x2779('0x3e')],{'$or':_[_0x2779('0x30')](_0x2163e2['attributes'],function(_0x1c5e83){var _0x2af93a={};_0x2af93a[_0x1c5e83]={'$like':'%'+_0x54a231[_0x2779('0x34')][_0x2779('0x40')]+'%'};return _0x2af93a;})});}_0x2163e2=_[_0x2779('0x41')]({},_0x2163e2,_0x54a231[_0x2779('0x4a')]);return db['CmHopperFinal'][_0x2779('0x20')]({'where':_0x2163e2[_0x2779('0x3e')]})[_0x2779('0x26')](function(_0xec2725){_0x32b16f['count']=_0xec2725;if(_0x54a231[_0x2779('0x34')]['includeAll']){_0x2163e2[_0x2779('0x42')]=[{'all':!![]}];}return db[_0x2779('0x62')]['findAll'](_0x2163e2);})['then'](function(_0x457072){_0x32b16f[_0x2779('0x44')]=_0x457072;return _0x32b16f;});}})['then'](respondWithFilteredResult(_0x9bf0e5,_0x2163e2))[_0x2779('0x45')](handleError(_0x9bf0e5,null));};exports[_0x2779('0x63')]=function(_0x3f2bae,_0x2906e9,_0x1df165){var _0x5b37a8={'raw':!![],'where':{}};var _0x42b8fd={};var _0x596df3={'count':0x0,'rows':[]};return db[_0x2779('0x31')][_0x2779('0x5b')]({'where':{'id':_0x3f2bae[_0x2779('0x47')]['id']}})[_0x2779('0x26')](handleEntityNotFound(_0x2906e9,null))['then'](function(_0x37c7dd){if(_0x37c7dd){_0x42b8fd[_0x2779('0x36')]=_['keys'](db[_0x2779('0x64')][_0x2779('0x32')]);_0x42b8fd[_0x2779('0x34')]=_['keys'](_0x3f2bae[_0x2779('0x34')]);_0x42b8fd[_0x2779('0x35')]=_[_0x2779('0x38')](_0x42b8fd[_0x2779('0x36')],_0x42b8fd[_0x2779('0x34')]);_0x5b37a8['attributes']=_[_0x2779('0x38')](_0x42b8fd['model'],qs['fields'](_0x3f2bae[_0x2779('0x34')][_0x2779('0x39')]));_0x5b37a8[_0x2779('0x37')]=_0x5b37a8[_0x2779('0x37')][_0x2779('0x3a')]?_0x5b37a8[_0x2779('0x37')]:_0x42b8fd['model'];if(!_0x3f2bae[_0x2779('0x34')][_0x2779('0x3b')]('nolimit')){_0x5b37a8[_0x2779('0x1f')]=qs[_0x2779('0x1f')](_0x3f2bae[_0x2779('0x34')][_0x2779('0x1f')]);_0x5b37a8[_0x2779('0x1d')]=qs[_0x2779('0x1d')](_0x3f2bae[_0x2779('0x34')][_0x2779('0x1d')]);}_0x5b37a8[_0x2779('0x3c')]=qs[_0x2779('0x3d')](_0x3f2bae[_0x2779('0x34')][_0x2779('0x3d')]);_0x5b37a8[_0x2779('0x3e')]=qs['filters'](_[_0x2779('0x3f')](_0x3f2bae[_0x2779('0x34')],_0x42b8fd[_0x2779('0x35')]));_0x5b37a8[_0x2779('0x3e')][_0x2779('0x5d')]=_0x37c7dd['id'];if(_0x3f2bae[_0x2779('0x34')][_0x2779('0x40')]){_0x5b37a8[_0x2779('0x3e')]=_[_0x2779('0x41')](_0x5b37a8['where'],{'$or':_[_0x2779('0x30')](_0x5b37a8[_0x2779('0x37')],function(_0x3aeef2){var _0x5b2981={};_0x5b2981[_0x3aeef2]={'$like':'%'+_0x3f2bae[_0x2779('0x34')]['filter']+'%'};return _0x5b2981;})});}_0x5b37a8=_[_0x2779('0x41')]({},_0x5b37a8,_0x3f2bae[_0x2779('0x4a')]);return db[_0x2779('0x64')][_0x2779('0x20')]({'where':_0x5b37a8['where']})[_0x2779('0x26')](function(_0x469b33){_0x596df3['count']=_0x469b33;if(_0x3f2bae[_0x2779('0x34')][_0x2779('0x49')]){_0x5b37a8[_0x2779('0x42')]=[{'all':!![]}];}return db[_0x2779('0x64')][_0x2779('0x43')](_0x5b37a8);})[_0x2779('0x26')](function(_0x2e5ebc){_0x596df3['rows']=_0x2e5ebc;return _0x596df3;});}})[_0x2779('0x26')](respondWithFilteredResult(_0x2906e9,_0x5b37a8))['catch'](handleError(_0x2906e9,null));};exports['getLists']=function(_0x11c7ba,_0x583f0e,_0x27a26e){var _0x5a5e41={};var _0x10bafc={};var _0xd42767;var _0x5e21f2;return db['Campaign'][_0x2779('0x5b')]({'where':{'id':_0x11c7ba[_0x2779('0x47')]['id']}})[_0x2779('0x26')](handleEntityNotFound(_0x583f0e,null))[_0x2779('0x26')](function(_0x259b2f){if(_0x259b2f){_0xd42767=_0x259b2f;_0x10bafc[_0x2779('0x36')]=_[_0x2779('0x48')](db[_0x2779('0x65')][_0x2779('0x32')]);_0x10bafc['query']=_[_0x2779('0x48')](_0x11c7ba['query']);_0x10bafc[_0x2779('0x35')]=_[_0x2779('0x38')](_0x10bafc[_0x2779('0x36')],_0x10bafc[_0x2779('0x34')]);_0x5a5e41['attributes']=_[_0x2779('0x38')](_0x10bafc[_0x2779('0x36')],qs[_0x2779('0x39')](_0x11c7ba['query']['fields']));_0x5a5e41[_0x2779('0x37')]=_0x5a5e41['attributes']['length']?_0x5a5e41[_0x2779('0x37')]:_0x10bafc[_0x2779('0x36')];_0x5a5e41['order']=qs['sort'](_0x11c7ba[_0x2779('0x34')][_0x2779('0x3d')]);_0x5a5e41['where']=qs['filters'](_[_0x2779('0x3f')](_0x11c7ba[_0x2779('0x34')],_0x10bafc[_0x2779('0x35')]));if(_0x11c7ba[_0x2779('0x34')][_0x2779('0x40')]){_0x5a5e41[_0x2779('0x3e')]=_['merge'](_0x5a5e41[_0x2779('0x3e')],{'$or':_[_0x2779('0x30')](_0x5a5e41[_0x2779('0x37')],function(_0x568212){var _0x704b83={};_0x704b83[_0x568212]={'$like':'%'+_0x11c7ba[_0x2779('0x34')][_0x2779('0x40')]+'%'};return _0x704b83;})});}_0x5a5e41=_[_0x2779('0x41')]({},_0x5a5e41,_0x11c7ba[_0x2779('0x4a')]);return _0xd42767[_0x2779('0x66')](_0x5a5e41);}})[_0x2779('0x26')](function(_0x23cfeb){if(_0x23cfeb){_0x5e21f2=_0x23cfeb[_0x2779('0x3a')];if(!_0x11c7ba[_0x2779('0x34')][_0x2779('0x3b')](_0x2779('0x60'))){_0x5a5e41[_0x2779('0x1f')]=qs[_0x2779('0x1f')](_0x11c7ba['query'][_0x2779('0x1f')]);_0x5a5e41[_0x2779('0x1d')]=qs['offset'](_0x11c7ba[_0x2779('0x34')][_0x2779('0x1d')]);}return _0xd42767[_0x2779('0x66')](_0x5a5e41);}})['then'](function(_0x17e53f){if(_0x17e53f){return _0x17e53f?{'count':_0x5e21f2,'rows':_0x17e53f}:null;}})[_0x2779('0x26')](respondWithResult(_0x583f0e,null))[_0x2779('0x45')](handleError(_0x583f0e,null));};exports[_0x2779('0x67')]=function(_0x24451c,_0x23e3e2,_0x1dfccd){var _0x1d1167,_0x47b241;return db[_0x2779('0x31')][_0x2779('0x4b')]({'where':{'id':_0x24451c[_0x2779('0x47')]['id']}})[_0x2779('0x26')](handleEntityNotFound(_0x23e3e2,null))[_0x2779('0x26')](function(_0x409d51){if(_0x409d51){_0x47b241=_0x409d51;return _0x409d51[_0x2779('0x67')](_0x24451c['body'][_0x2779('0x68')],_[_0x2779('0x53')](_0x24451c[_0x2779('0x4d')],[_0x2779('0x68'),'id'])||{});}return null;})[_0x2779('0x69')](function(_0x315141){var _0x4fbf08;_0x1d1167=_0x315141||[];var _0x1b643c=[];if(_0x315141){for(var _0x2cc7b2=0x0;_0x2cc7b2<_0x315141['length'];_0x2cc7b2+=0x1){var _0x464df7=_0x315141[_0x2cc7b2]['get']({'plain':!![]});_0x47b241['dialCheckDuplicateType']=_0x24451c[_0x2779('0x4d')][_0x2779('0x6a')]?_0x24451c['body'][_0x2779('0x6a')]:_0x47b241[_0x2779('0x6a')];switch(_0x47b241['dialCheckDuplicateType']){case'always':_0x4fbf08=squel['insert']()[_0x2779('0x6b')](_0x2779('0x6c'))['fromQuery']([_0x2779('0x6d'),_0x2779('0x6e'),_0x2779('0x6f'),'ListId',_0x2779('0x5d'),'createdAt',_0x2779('0x55')],squel['select']()['field'](_0x2779('0x6d'),_0x2779('0x6d'))['field'](_0x2779('0x70'),'scheduledAt')['field']('id',_0x2779('0x6f'))[_0x2779('0x71')](_0x464df7['CmListId']['toString'](),'ListId')['field'](_0x24451c['params']['id'][_0x2779('0x72')](),_0x2779('0x5d'))[_0x2779('0x71')](_0x2779('0x70'),'createdAt')[_0x2779('0x71')]('NOW()',_0x2779('0x55'))[_0x2779('0x73')](_0x2779('0x74'))[_0x2779('0x3e')](_0x2779('0x75'))[_0x2779('0x3e')]('ListId\x20=\x20?',_0x464df7[_0x2779('0x76')]['toString']())[_0x2779('0x3e')]('phone\x20IS\x20NOT\x20NULL')[_0x2779('0x3e')](_0x2779('0x77'),squel['select']()[_0x2779('0x71')](_0x2779('0x78'))[_0x2779('0x73')]('cm_hopper_final')[_0x2779('0x3e')](_0x2779('0x79'),_0x24451c[_0x2779('0x47')]['id'][_0x2779('0x72')]()))['where'](_0x2779('0x77'),squel[_0x2779('0x7a')]()['field'](_0x2779('0x7b'))[_0x2779('0x73')](_0x2779('0x6c'))[_0x2779('0x3e')](_0x2779('0x79'),_0x24451c[_0x2779('0x47')]['id'][_0x2779('0x72')]())))[_0x2779('0x72')]();break;case'onlyIfOpen':_0x4fbf08=squel[_0x2779('0x7c')]()[_0x2779('0x6b')](_0x2779('0x6c'))[_0x2779('0x7d')]([_0x2779('0x6d'),_0x2779('0x6e'),_0x2779('0x6f'),_0x2779('0x7e'),_0x2779('0x5d'),_0x2779('0x54'),_0x2779('0x55')],squel['select']()[_0x2779('0x71')](_0x2779('0x6d'),_0x2779('0x6d'))[_0x2779('0x71')](_0x2779('0x70'),'scheduledAt')[_0x2779('0x71')]('id',_0x2779('0x6f'))[_0x2779('0x71')](_0x464df7[_0x2779('0x76')]['toString'](),'ListId')[_0x2779('0x71')](_0x24451c[_0x2779('0x47')]['id'][_0x2779('0x72')](),_0x2779('0x5d'))[_0x2779('0x71')](_0x2779('0x70'),'createdAt')['field']('NOW()',_0x2779('0x55'))['from'](_0x2779('0x74'))[_0x2779('0x3e')]('deletedAt\x20IS\x20NULL')[_0x2779('0x3e')]('ListId\x20=\x20?',_0x464df7['CmListId'][_0x2779('0x72')]())[_0x2779('0x3e')](_0x2779('0x7f'))[_0x2779('0x3e')](_0x2779('0x77'),squel['select']()['field'](_0x2779('0x7b'))[_0x2779('0x73')](_0x2779('0x6c'))[_0x2779('0x3e')](_0x2779('0x79'),_0x24451c[_0x2779('0x47')]['id'][_0x2779('0x72')]())))[_0x2779('0x72')]();break;default:_0x4fbf08=squel[_0x2779('0x7c')]()['into'](_0x2779('0x6c'))['fromQuery']([_0x2779('0x6d'),'scheduledAt',_0x2779('0x6f'),_0x2779('0x7e'),_0x2779('0x5d'),_0x2779('0x54'),_0x2779('0x55')],squel[_0x2779('0x7a')]()[_0x2779('0x71')]('phone',_0x2779('0x6d'))[_0x2779('0x71')](_0x2779('0x70'),_0x2779('0x6e'))['field']('id',_0x2779('0x6f'))[_0x2779('0x71')](_0x464df7['CmListId'][_0x2779('0x72')](),_0x2779('0x7e'))[_0x2779('0x71')](_0x24451c[_0x2779('0x47')]['id'][_0x2779('0x72')](),_0x2779('0x5d'))[_0x2779('0x71')]('NOW()',_0x2779('0x54'))[_0x2779('0x71')]('NOW()',_0x2779('0x55'))[_0x2779('0x73')](_0x2779('0x74'))['where']('deletedAt\x20IS\x20NULL')['where'](_0x2779('0x80'),_0x464df7['CmListId'][_0x2779('0x72')]())[_0x2779('0x3e')](_0x2779('0x7f')))[_0x2779('0x72')]();}_0x1b643c[_0x2779('0x81')](db[_0x2779('0x82')]['query'](_0x4fbf08));}return BPromise[_0x2779('0x83')](_0x1b643c);}})['then'](function(){return _0x1d1167;})['then'](respondWithResult(_0x23e3e2,null))['catch'](handleError(_0x23e3e2,null));};exports[_0x2779('0x84')]=function(_0x55f2eb,_0x5c4738,_0x29c619){return db[_0x2779('0x31')][_0x2779('0x4b')]({'where':{'id':_0x55f2eb[_0x2779('0x47')]['id']}})[_0x2779('0x26')](handleEntityNotFound(_0x5c4738,null))[_0x2779('0x26')](function(_0x176423){if(_0x176423){return _0x176423[_0x2779('0x84')](_0x55f2eb[_0x2779('0x34')][_0x2779('0x68')]);}})['then'](function(_0x48e793){if(_0x48e793){return db[_0x2779('0x5c')][_0x2779('0x27')]({'where':{'ListId':_0x55f2eb['query'][_0x2779('0x68')],'CampaignId':_0x55f2eb[_0x2779('0x47')]['id']}})[_0x2779('0x26')](function(){return _0x48e793;});}})[_0x2779('0x26')](respondWithStatusCode(_0x5c4738,null))['catch'](handleError(_0x5c4738,null));};exports[_0x2779('0x85')]=function(_0x37ccd1,_0xd7f97e,_0x404c4d){var _0x76886d={};var _0xc8f55f={};var _0x3283e0;var _0x5b3437;return db[_0x2779('0x31')][_0x2779('0x5b')]({'where':{'id':_0x37ccd1['params']['id']}})[_0x2779('0x26')](handleEntityNotFound(_0xd7f97e,null))[_0x2779('0x26')](function(_0x127b37){if(_0x127b37){_0x3283e0=_0x127b37;_0xc8f55f['model']=_[_0x2779('0x48')](db[_0x2779('0x65')][_0x2779('0x32')]);_0xc8f55f['query']=_[_0x2779('0x48')](_0x37ccd1[_0x2779('0x34')]);_0xc8f55f[_0x2779('0x35')]=_['intersection'](_0xc8f55f['model'],_0xc8f55f[_0x2779('0x34')]);_0x76886d[_0x2779('0x37')]=_[_0x2779('0x38')](_0xc8f55f[_0x2779('0x36')],qs[_0x2779('0x39')](_0x37ccd1['query'][_0x2779('0x39')]));_0x76886d['attributes']=_0x76886d[_0x2779('0x37')]['length']?_0x76886d[_0x2779('0x37')]:_0xc8f55f[_0x2779('0x36')];_0x76886d[_0x2779('0x3c')]=qs[_0x2779('0x3d')](_0x37ccd1[_0x2779('0x34')]['sort']);_0x76886d[_0x2779('0x3e')]=qs['filters'](_['pick'](_0x37ccd1[_0x2779('0x34')],_0xc8f55f[_0x2779('0x35')]));if(_0x37ccd1[_0x2779('0x34')][_0x2779('0x40')]){_0x76886d[_0x2779('0x3e')]=_[_0x2779('0x41')](_0x76886d[_0x2779('0x3e')],{'$or':_[_0x2779('0x30')](_0x76886d['attributes'],function(_0x15a51f){var _0x689b92={};_0x689b92[_0x15a51f]={'$like':'%'+_0x37ccd1[_0x2779('0x34')][_0x2779('0x40')]+'%'};return _0x689b92;})});}_0x76886d=_['merge']({},_0x76886d,_0x37ccd1['options']);return _0x3283e0[_0x2779('0x85')](_0x76886d);}})[_0x2779('0x26')](function(_0x2d0a87){if(_0x2d0a87){_0x5b3437=_0x2d0a87[_0x2779('0x3a')];if(!_0x37ccd1[_0x2779('0x34')]['hasOwnProperty'](_0x2779('0x60'))){_0x76886d['limit']=qs[_0x2779('0x1f')](_0x37ccd1[_0x2779('0x34')][_0x2779('0x1f')]);_0x76886d['offset']=qs['offset'](_0x37ccd1['query']['offset']);}return _0x3283e0[_0x2779('0x85')](_0x76886d);}})['then'](function(_0x5a3ec8){if(_0x5a3ec8){return _0x5a3ec8?{'count':_0x5b3437,'rows':_0x5a3ec8}:null;}})['then'](respondWithResult(_0xd7f97e,null))['catch'](handleError(_0xd7f97e,null));};exports['addBlackLists']=function(_0xbf82b1,_0xc6e727,_0x4a8957){var _0x3b9d5e,_0x4ee401;return db[_0x2779('0x31')]['find']({'where':{'id':_0xbf82b1['params']['id']}})[_0x2779('0x26')](handleEntityNotFound(_0xc6e727,null))['then'](function(_0x58841c){if(_0x58841c){_0x4ee401=_0x58841c;return _0x58841c[_0x2779('0x86')](_0xbf82b1[_0x2779('0x4d')]['ids'],_[_0x2779('0x53')](_0xbf82b1[_0x2779('0x4d')],[_0x2779('0x68'),'id'])||{});}return null;})[_0x2779('0x69')](function(_0x5c8203){var _0x5be33e;_0x3b9d5e=_0x5c8203||[];var _0x37c8c7=[];if(_0x5c8203){for(var _0x51c6f5=0x0;_0x51c6f5<_0x5c8203[_0x2779('0x3a')];_0x51c6f5+=0x1){var _0x252b5a=_0x5c8203[_0x51c6f5]['get']({'plain':!![]});_0x5be33e=squel[_0x2779('0x7c')]()[_0x2779('0x6b')]('cm_hopper_black')['fromQuery']([_0x2779('0x6d'),_0x2779('0x6f'),'ListId',_0x2779('0x5d'),_0x2779('0x54'),'updatedAt'],squel[_0x2779('0x7a')]()['field'](_0x2779('0x6d'),'phone')['field']('id',_0x2779('0x6f'))[_0x2779('0x71')](_0x252b5a[_0x2779('0x76')][_0x2779('0x72')](),_0x2779('0x7e'))['field'](_0xbf82b1[_0x2779('0x47')]['id'][_0x2779('0x72')](),_0x2779('0x5d'))[_0x2779('0x71')](_0x2779('0x70'),_0x2779('0x54'))[_0x2779('0x71')](_0x2779('0x70'),_0x2779('0x55'))[_0x2779('0x73')]('cm_contacts')['where'](_0x2779('0x75'))[_0x2779('0x3e')](_0x2779('0x80'),_0x252b5a['CmListId'][_0x2779('0x72')]())['where'](_0x2779('0x7f')))['toString']();_0x37c8c7[_0x2779('0x81')](db[_0x2779('0x82')][_0x2779('0x34')](_0x5be33e));}return BPromise[_0x2779('0x83')](_0x37c8c7);}})[_0x2779('0x26')](function(){return _0x3b9d5e;})[_0x2779('0x26')](respondWithResult(_0xc6e727,null))[_0x2779('0x45')](handleError(_0xc6e727,null));};exports[_0x2779('0x87')]=function(_0x398ce7,_0x4a960d,_0x20753b){return db[_0x2779('0x31')][_0x2779('0x4b')]({'where':{'id':_0x398ce7['params']['id']}})[_0x2779('0x26')](handleEntityNotFound(_0x4a960d,null))[_0x2779('0x26')](function(_0x5eafab){if(_0x5eafab){return _0x5eafab[_0x2779('0x87')](_0x398ce7[_0x2779('0x34')][_0x2779('0x68')]);}})[_0x2779('0x26')](function(_0x34f9fc){if(_0x34f9fc){return db[_0x2779('0x64')][_0x2779('0x27')]({'where':{'ListId':_0x398ce7['query'][_0x2779('0x68')],'CampaignId':_0x398ce7['params']['id']}})[_0x2779('0x26')](function(){return _0x34f9fc;});}})[_0x2779('0x26')](respondWithStatusCode(_0x4a960d,null))['catch'](handleError(_0x4a960d,null));}; \ No newline at end of file +var _0xb8ac=['to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','end','json','offset','undefined','count','limit','status','set','Content-Range','apply','reject','save','then','destroy','get','sendStatus','error','name','send','index','map','rawAttributes','fieldName','type','key','query','keys','intersection','attributes','fields','length','nolimit','sort','where','filters','pick','filter','VIRTUAL','options','Campaign','includeAll','include','findAll','show','params','model','merge','catch','create','user','role','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','omit','createdAt','updatedAt','IvrCampaigns','update','body','getHoppers','findOne','CmHopper','hasOwnProperty','order','CampaignId','rows','getHopperHistories','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','CmList','addLists','ids','spread','dialCheckDuplicateType','always','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','select','field','NOW()','CmListId','toString','from','cm_contacts','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','CampaignId\x20=\x20?','COALESCE(phone,\x27\x27)','deletedAt\x20IS\x20NULL','insert','push','sequelize','all','removeLists','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util'];(function(_0x1be3b3,_0x4335ee){var _0x4f8b2d=function(_0x1d955f){while(--_0x1d955f){_0x1be3b3['push'](_0x1be3b3['shift']());}};_0x4f8b2d(++_0x4335ee);}(_0xb8ac,0x10b));var _0xcb8a=function(_0xf2760,_0x2a3d49){_0xf2760=_0xf2760-0x0;var _0x17d9ac=_0xb8ac[_0xf2760];return _0x17d9ac;};'use strict';var emlformat=require(_0xcb8a('0x0'));var rimraf=require(_0xcb8a('0x1'));var zipdir=require(_0xcb8a('0x2'));var jsonpatch=require(_0xcb8a('0x3'));var rp=require(_0xcb8a('0x4'));var moment=require(_0xcb8a('0x5'));var BPromise=require(_0xcb8a('0x6'));var Mustache=require(_0xcb8a('0x7'));var util=require(_0xcb8a('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0xcb8a('0x9'));var ejs=require(_0xcb8a('0xa'));var fs=require('fs');var fs_extra=require(_0xcb8a('0xb'));var _=require(_0xcb8a('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xcb8a('0xd'));var deskjs=require(_0xcb8a('0xe'));var toCsv=require(_0xcb8a('0x9'));var querystring=require(_0xcb8a('0xf'));var Papa=require(_0xcb8a('0x10'));var Redis=require(_0xcb8a('0x11'));var authService=require(_0xcb8a('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xcb8a('0x13'));var logger=require(_0xcb8a('0x14'))(_0xcb8a('0x15'));var utils=require('../../config/utils');var config=require(_0xcb8a('0x16'));var licenseUtil=require(_0xcb8a('0x17'));var db=require(_0xcb8a('0x18'))['db'];function respondWithStatusCode(_0x59932e,_0x5f0a5a){_0x5f0a5a=_0x5f0a5a||0xcc;return function(_0x519215){if(_0x519215){return _0x59932e['sendStatus'](_0x5f0a5a);}return _0x59932e['status'](_0x5f0a5a)[_0xcb8a('0x19')]();};}function respondWithResult(_0x49fc3b,_0x78f72f){_0x78f72f=_0x78f72f||0xc8;return function(_0x136c82){if(_0x136c82){return _0x49fc3b['status'](_0x78f72f)[_0xcb8a('0x1a')](_0x136c82);}};}function respondWithFilteredResult(_0x5a1481,_0x1eed8a){return function(_0x13a340){if(_0x13a340){var _0x529703=typeof _0x1eed8a[_0xcb8a('0x1b')]===_0xcb8a('0x1c')&&typeof _0x1eed8a['limit']==='undefined';var _0x475db6=_0x13a340[_0xcb8a('0x1d')];var _0x20d81c=_0x529703?0x0:_0x1eed8a[_0xcb8a('0x1b')];var _0x259cea=_0x529703?_0x13a340[_0xcb8a('0x1d')]:_0x1eed8a['offset']+_0x1eed8a[_0xcb8a('0x1e')];var _0x130af6;if(_0x259cea>=_0x475db6){_0x259cea=_0x475db6;_0x130af6=0xc8;}else{_0x130af6=0xce;}_0x5a1481[_0xcb8a('0x1f')](_0x130af6);return _0x5a1481[_0xcb8a('0x20')](_0xcb8a('0x21'),_0x20d81c+'-'+_0x259cea+'/'+_0x475db6)[_0xcb8a('0x1a')](_0x13a340);}return null;};}function patchUpdates(_0x2cdae7){return function(_0x378410){try{jsonpatch[_0xcb8a('0x22')](_0x378410,_0x2cdae7,!![]);}catch(_0x58772c){return BPromise[_0xcb8a('0x23')](_0x58772c);}return _0x378410[_0xcb8a('0x24')]();};}function saveUpdates(_0xe49140,_0x50e346){return function(_0x2ac6ea){if(_0x2ac6ea){return _0x2ac6ea['update'](_0xe49140)[_0xcb8a('0x25')](function(_0x23c05b){return _0x23c05b;});}return null;};}function removeEntity(_0x47d280,_0x1c042f){return function(_0x422f93){if(_0x422f93){return _0x422f93[_0xcb8a('0x26')]()[_0xcb8a('0x25')](function(){var _0x36fde6=_0x422f93[_0xcb8a('0x27')]({'plain':!![]});var _0x29825c='IvrCampaigns';return db['UserProfileResource']['destroy']({'where':{'type':_0x29825c,'resourceId':_0x36fde6['id']}})[_0xcb8a('0x25')](function(){return _0x422f93;});})[_0xcb8a('0x25')](function(){_0x47d280['status'](0xcc)[_0xcb8a('0x19')]();});}};}function handleEntityNotFound(_0x35d02f,_0x4b0ff5){return function(_0x62f277){if(!_0x62f277){_0x35d02f[_0xcb8a('0x28')](0x194);}return _0x62f277;};}function handleError(_0x4e6227,_0x3f71d6){_0x3f71d6=_0x3f71d6||0x1f4;return function(_0x534e75){logger[_0xcb8a('0x29')](_0x534e75['stack']);if(_0x534e75[_0xcb8a('0x2a')]){delete _0x534e75[_0xcb8a('0x2a')];}_0x4e6227[_0xcb8a('0x1f')](_0x3f71d6)[_0xcb8a('0x2b')](_0x534e75);};}exports[_0xcb8a('0x2c')]=function(_0x22be75,_0x1c9833){var _0x2fe306={},_0xaa3c55={},_0x4dd85f={'count':0x0,'rows':[]};var _0x348a8c=_[_0xcb8a('0x2d')](db['Campaign'][_0xcb8a('0x2e')],function(_0x3e874c){return{'name':_0x3e874c[_0xcb8a('0x2f')],'type':_0x3e874c[_0xcb8a('0x30')][_0xcb8a('0x31')]};});_0xaa3c55['model']=_[_0xcb8a('0x2d')](_0x348a8c,'name');_0xaa3c55[_0xcb8a('0x32')]=_[_0xcb8a('0x33')](_0x22be75[_0xcb8a('0x32')]);_0xaa3c55['filters']=_[_0xcb8a('0x34')](_0xaa3c55['model'],_0xaa3c55['query']);_0x2fe306[_0xcb8a('0x35')]=_[_0xcb8a('0x34')](_0xaa3c55['model'],qs[_0xcb8a('0x36')](_0x22be75[_0xcb8a('0x32')][_0xcb8a('0x36')]));_0x2fe306[_0xcb8a('0x35')]=_0x2fe306[_0xcb8a('0x35')][_0xcb8a('0x37')]?_0x2fe306[_0xcb8a('0x35')]:_0xaa3c55['model'];if(!_0x22be75[_0xcb8a('0x32')]['hasOwnProperty'](_0xcb8a('0x38'))){_0x2fe306[_0xcb8a('0x1e')]=qs[_0xcb8a('0x1e')](_0x22be75[_0xcb8a('0x32')][_0xcb8a('0x1e')]);_0x2fe306[_0xcb8a('0x1b')]=qs[_0xcb8a('0x1b')](_0x22be75[_0xcb8a('0x32')]['offset']);}_0x2fe306['order']=qs['sort'](_0x22be75['query'][_0xcb8a('0x39')]);_0x2fe306[_0xcb8a('0x3a')]=qs[_0xcb8a('0x3b')](_[_0xcb8a('0x3c')](_0x22be75[_0xcb8a('0x32')],_0xaa3c55['filters']),_0x348a8c);if(_0x22be75[_0xcb8a('0x32')][_0xcb8a('0x3d')]){_0x2fe306[_0xcb8a('0x3a')]=_['merge'](_0x2fe306['where'],{'$or':_['map'](_0x348a8c,function(_0x5ece2b){if(_0x5ece2b[_0xcb8a('0x30')]!==_0xcb8a('0x3e')){var _0x635cef={};_0x635cef[_0x5ece2b['name']]={'$like':'%'+_0x22be75[_0xcb8a('0x32')][_0xcb8a('0x3d')]+'%'};return _0x635cef;}})});}_0x2fe306=_['merge']({},_0x2fe306,_0x22be75[_0xcb8a('0x3f')]);var _0x532db2={'where':_0x2fe306['where']};return db[_0xcb8a('0x40')][_0xcb8a('0x1d')](_0x532db2)[_0xcb8a('0x25')](function(_0x3a6bff){_0x4dd85f[_0xcb8a('0x1d')]=_0x3a6bff;if(_0x22be75[_0xcb8a('0x32')][_0xcb8a('0x41')]){_0x2fe306[_0xcb8a('0x42')]=[{'all':!![]}];}return db['Campaign'][_0xcb8a('0x43')](_0x2fe306);})[_0xcb8a('0x25')](function(_0x29a86f){_0x4dd85f['rows']=_0x29a86f;return _0x4dd85f;})[_0xcb8a('0x25')](respondWithFilteredResult(_0x1c9833,_0x2fe306))['catch'](handleError(_0x1c9833,null));};exports[_0xcb8a('0x44')]=function(_0x5946c7,_0x34e3e3){var _0x4f53fd={'raw':![],'where':{'id':_0x5946c7[_0xcb8a('0x45')]['id']}},_0x3a1457={};_0x3a1457['model']=_[_0xcb8a('0x33')](db[_0xcb8a('0x40')][_0xcb8a('0x2e')]);_0x3a1457['query']=_['keys'](_0x5946c7[_0xcb8a('0x32')]);_0x3a1457[_0xcb8a('0x3b')]=_[_0xcb8a('0x34')](_0x3a1457[_0xcb8a('0x46')],_0x3a1457['query']);_0x4f53fd['attributes']=_[_0xcb8a('0x34')](_0x3a1457[_0xcb8a('0x46')],qs['fields'](_0x5946c7[_0xcb8a('0x32')][_0xcb8a('0x36')]));_0x4f53fd[_0xcb8a('0x35')]=_0x4f53fd[_0xcb8a('0x35')][_0xcb8a('0x37')]?_0x4f53fd[_0xcb8a('0x35')]:_0x3a1457[_0xcb8a('0x46')];if(_0x5946c7['query'][_0xcb8a('0x41')]){_0x4f53fd[_0xcb8a('0x42')]=[{'all':!![]}];}_0x4f53fd=_[_0xcb8a('0x47')]({},_0x4f53fd,_0x5946c7[_0xcb8a('0x3f')]);return db[_0xcb8a('0x40')]['find'](_0x4f53fd)[_0xcb8a('0x25')](handleEntityNotFound(_0x34e3e3,null))[_0xcb8a('0x25')](respondWithResult(_0x34e3e3,null))[_0xcb8a('0x48')](handleError(_0x34e3e3,null));};exports['create']=function(_0x19d5ec,_0x3e9330){return db[_0xcb8a('0x40')][_0xcb8a('0x49')](_0x19d5ec['body'],{})['then'](function(_0x58a8b1){var _0x3ed851=_0x19d5ec[_0xcb8a('0x4a')][_0xcb8a('0x27')]({'plain':!![]});if(!_0x3ed851)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3ed851[_0xcb8a('0x4b')]==='user'){var _0x48fcd0=_0x58a8b1[_0xcb8a('0x27')]({'plain':!![]});var _0x5e0112='IvrCampaigns';return db[_0xcb8a('0x4c')][_0xcb8a('0x4d')]({'where':{'name':_0x5e0112,'userProfileId':_0x3ed851[_0xcb8a('0x4e')]},'raw':!![]})[_0xcb8a('0x25')](function(_0x3c6d12){if(_0x3c6d12&&_0x3c6d12[_0xcb8a('0x4f')]===0x0){return db[_0xcb8a('0x50')][_0xcb8a('0x49')]({'name':_0x48fcd0[_0xcb8a('0x2a')],'resourceId':_0x48fcd0['id'],'type':_0x3c6d12['name'],'sectionId':_0x3c6d12['id']},{})[_0xcb8a('0x25')](function(){return _0x58a8b1;});}else{return _0x58a8b1;}})[_0xcb8a('0x48')](function(_0x1ed7bd){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1ed7bd);throw _0x1ed7bd;});}return _0x58a8b1;})[_0xcb8a('0x25')](respondWithResult(_0x3e9330,0xc9))['catch'](handleError(_0x3e9330,null));};exports['clone']=function(_0x495fb6,_0x55ffd5){var _0x1962fe={'where':{'id':_0x495fb6[_0xcb8a('0x45')]['id']}},_0x4cbef3={};_0x4cbef3[_0xcb8a('0x46')]=_[_0xcb8a('0x33')](db[_0xcb8a('0x40')][_0xcb8a('0x2e')]);_0x1962fe[_0xcb8a('0x35')]=_['intersection'](_0x4cbef3[_0xcb8a('0x46')],qs[_0xcb8a('0x36')](_0x495fb6[_0xcb8a('0x32')]['fields']));_0x1962fe[_0xcb8a('0x35')]=_0x1962fe[_0xcb8a('0x35')][_0xcb8a('0x37')]?_0x1962fe[_0xcb8a('0x35')]:_0x4cbef3[_0xcb8a('0x46')];if(_0x495fb6[_0xcb8a('0x32')][_0xcb8a('0x41')]){_0x1962fe[_0xcb8a('0x42')]=[{'all':!![]}];}_0x1962fe=_[_0xcb8a('0x47')]({},_0x1962fe,_0x495fb6[_0xcb8a('0x3f')]);return db[_0xcb8a('0x40')]['find'](_0x1962fe)[_0xcb8a('0x25')](handleEntityNotFound(_0x55ffd5,null))['then'](function(_0x58e580){if(_0x58e580){var _0x4cbb8e=_0x58e580['get']({'plain':!![]});_0x4cbb8e=qs[_0xcb8a('0x51')](_0x4cbb8e,['id',_0xcb8a('0x52'),'updatedAt']);_0x495fb6['body']=_['omit'](_0x495fb6['body'],['id',_0xcb8a('0x52'),_0xcb8a('0x53')]);return db[_0xcb8a('0x40')]['create'](_[_0xcb8a('0x47')](_0x4cbb8e,_0x495fb6['body']),{'include':_0x495fb6[_0xcb8a('0x32')]['includeAll']?[{'all':!![]}]:undefined})[_0xcb8a('0x25')](function(_0x3dc3dc){var _0x5239f6=_0x495fb6[_0xcb8a('0x4a')]['get']({'plain':!![]});if(!_0x5239f6)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5239f6[_0xcb8a('0x4b')]===_0xcb8a('0x4a')){var _0x53b3f3=_0x3dc3dc[_0xcb8a('0x27')]({'plain':!![]});var _0x162965=_0xcb8a('0x54');return db[_0xcb8a('0x4c')][_0xcb8a('0x4d')]({'where':{'name':_0x162965,'userProfileId':_0x5239f6['userProfileId']},'raw':!![]})[_0xcb8a('0x25')](function(_0x4941e6){if(_0x4941e6&&_0x4941e6[_0xcb8a('0x4f')]===0x0){return db[_0xcb8a('0x50')][_0xcb8a('0x49')]({'name':_0x53b3f3[_0xcb8a('0x2a')],'resourceId':_0x53b3f3['id'],'type':_0x4941e6[_0xcb8a('0x2a')],'sectionId':_0x4941e6['id']},{})[_0xcb8a('0x25')](function(){return _0x3dc3dc;});}else{return _0x3dc3dc;}})[_0xcb8a('0x48')](function(_0x3bcbdc){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3bcbdc);throw _0x3bcbdc;});}return _0x3dc3dc;});}})['then'](respondWithResult(_0x55ffd5,0xc9))[_0xcb8a('0x48')](handleError(_0x55ffd5,null));};exports[_0xcb8a('0x55')]=function(_0xd0c25e,_0x54aae7){if(_0xd0c25e[_0xcb8a('0x56')]['id']){delete _0xd0c25e['body']['id'];}return db[_0xcb8a('0x40')][_0xcb8a('0x4d')]({'where':{'id':_0xd0c25e[_0xcb8a('0x45')]['id']}})[_0xcb8a('0x25')](handleEntityNotFound(_0x54aae7,null))[_0xcb8a('0x25')](saveUpdates(_0xd0c25e[_0xcb8a('0x56')],null))[_0xcb8a('0x25')](respondWithResult(_0x54aae7,null))['catch'](handleError(_0x54aae7,null));};exports['destroy']=function(_0x38e72b,_0x50bcf8){return db[_0xcb8a('0x40')][_0xcb8a('0x4d')]({'where':{'id':_0x38e72b[_0xcb8a('0x45')]['id']}})[_0xcb8a('0x25')](handleEntityNotFound(_0x50bcf8,null))[_0xcb8a('0x25')](removeEntity(_0x50bcf8,null))[_0xcb8a('0x48')](handleError(_0x50bcf8,null));};exports[_0xcb8a('0x57')]=function(_0x4816d9,_0x35248d,_0x2806b9){var _0x25d24f={'raw':!![],'where':{}};var _0x43ec88={};var _0x1e536f={'count':0x0,'rows':[]};return db[_0xcb8a('0x40')][_0xcb8a('0x58')]({'where':{'id':_0x4816d9[_0xcb8a('0x45')]['id']}})[_0xcb8a('0x25')](handleEntityNotFound(_0x35248d,null))[_0xcb8a('0x25')](function(_0x1ed925){if(_0x1ed925){_0x43ec88['model']=_['keys'](db[_0xcb8a('0x59')][_0xcb8a('0x2e')]);_0x43ec88['query']=_[_0xcb8a('0x33')](_0x4816d9[_0xcb8a('0x32')]);_0x43ec88[_0xcb8a('0x3b')]=_[_0xcb8a('0x34')](_0x43ec88[_0xcb8a('0x46')],_0x43ec88[_0xcb8a('0x32')]);_0x25d24f[_0xcb8a('0x35')]=_[_0xcb8a('0x34')](_0x43ec88[_0xcb8a('0x46')],qs['fields'](_0x4816d9[_0xcb8a('0x32')][_0xcb8a('0x36')]));_0x25d24f[_0xcb8a('0x35')]=_0x25d24f['attributes'][_0xcb8a('0x37')]?_0x25d24f['attributes']:_0x43ec88[_0xcb8a('0x46')];if(!_0x4816d9[_0xcb8a('0x32')][_0xcb8a('0x5a')]('nolimit')){_0x25d24f[_0xcb8a('0x1e')]=qs['limit'](_0x4816d9['query'][_0xcb8a('0x1e')]);_0x25d24f['offset']=qs[_0xcb8a('0x1b')](_0x4816d9['query'][_0xcb8a('0x1b')]);}_0x25d24f[_0xcb8a('0x5b')]=qs['sort'](_0x4816d9['query'][_0xcb8a('0x39')]);_0x25d24f[_0xcb8a('0x3a')]=qs['filters'](_['pick'](_0x4816d9[_0xcb8a('0x32')],_0x43ec88[_0xcb8a('0x3b')]));_0x25d24f[_0xcb8a('0x3a')][_0xcb8a('0x5c')]=_0x1ed925['id'];if(_0x4816d9[_0xcb8a('0x32')][_0xcb8a('0x3d')]){_0x25d24f[_0xcb8a('0x3a')]=_['merge'](_0x25d24f[_0xcb8a('0x3a')],{'$or':_[_0xcb8a('0x2d')](_0x25d24f[_0xcb8a('0x35')],function(_0x707557){var _0x361b5e={};_0x361b5e[_0x707557]={'$like':'%'+_0x4816d9[_0xcb8a('0x32')]['filter']+'%'};return _0x361b5e;})});}_0x25d24f=_[_0xcb8a('0x47')]({},_0x25d24f,_0x4816d9[_0xcb8a('0x3f')]);return db[_0xcb8a('0x59')]['count']({'where':_0x25d24f['where']})[_0xcb8a('0x25')](function(_0x2bac27){_0x1e536f[_0xcb8a('0x1d')]=_0x2bac27;if(_0x4816d9[_0xcb8a('0x32')][_0xcb8a('0x41')]){_0x25d24f[_0xcb8a('0x42')]=[{'all':!![]}];}return db[_0xcb8a('0x59')]['findAll'](_0x25d24f);})['then'](function(_0x531f6f){_0x1e536f[_0xcb8a('0x5d')]=_0x531f6f;return _0x1e536f;});}})[_0xcb8a('0x25')](respondWithFilteredResult(_0x35248d,_0x25d24f))[_0xcb8a('0x48')](handleError(_0x35248d,null));};exports[_0xcb8a('0x5e')]=function(_0x150e00,_0xd23a30,_0x219726){var _0x28b7d7={'raw':!![],'where':{}};var _0x5b35db={};var _0x13dc2c={'count':0x0,'rows':[]};return db['Campaign'][_0xcb8a('0x58')]({'where':{'id':_0x150e00['params']['id']}})[_0xcb8a('0x25')](handleEntityNotFound(_0xd23a30,null))['then'](function(_0x5b9aea){if(_0x5b9aea){_0x5b35db[_0xcb8a('0x46')]=_[_0xcb8a('0x33')](db[_0xcb8a('0x5f')][_0xcb8a('0x2e')]);_0x5b35db[_0xcb8a('0x32')]=_[_0xcb8a('0x33')](_0x150e00['query']);_0x5b35db[_0xcb8a('0x3b')]=_[_0xcb8a('0x34')](_0x5b35db[_0xcb8a('0x46')],_0x5b35db[_0xcb8a('0x32')]);_0x28b7d7['attributes']=_[_0xcb8a('0x34')](_0x5b35db[_0xcb8a('0x46')],qs[_0xcb8a('0x36')](_0x150e00[_0xcb8a('0x32')][_0xcb8a('0x36')]));_0x28b7d7[_0xcb8a('0x35')]=_0x28b7d7[_0xcb8a('0x35')]['length']?_0x28b7d7[_0xcb8a('0x35')]:_0x5b35db[_0xcb8a('0x46')];if(!_0x150e00['query'][_0xcb8a('0x5a')](_0xcb8a('0x38'))){_0x28b7d7[_0xcb8a('0x1e')]=qs[_0xcb8a('0x1e')](_0x150e00[_0xcb8a('0x32')][_0xcb8a('0x1e')]);_0x28b7d7[_0xcb8a('0x1b')]=qs[_0xcb8a('0x1b')](_0x150e00[_0xcb8a('0x32')]['offset']);}_0x28b7d7[_0xcb8a('0x5b')]=qs[_0xcb8a('0x39')](_0x150e00['query'][_0xcb8a('0x39')]);_0x28b7d7[_0xcb8a('0x3a')]=qs[_0xcb8a('0x3b')](_[_0xcb8a('0x3c')](_0x150e00[_0xcb8a('0x32')],_0x5b35db[_0xcb8a('0x3b')]));_0x28b7d7[_0xcb8a('0x3a')][_0xcb8a('0x5c')]=_0x5b9aea['id'];if(_0x150e00['query'][_0xcb8a('0x3d')]){_0x28b7d7['where']=_[_0xcb8a('0x47')](_0x28b7d7[_0xcb8a('0x3a')],{'$or':_[_0xcb8a('0x2d')](_0x28b7d7['attributes'],function(_0x19b156){var _0x5052e2={};_0x5052e2[_0x19b156]={'$like':'%'+_0x150e00[_0xcb8a('0x32')][_0xcb8a('0x3d')]+'%'};return _0x5052e2;})});}_0x28b7d7=_[_0xcb8a('0x47')]({},_0x28b7d7,_0x150e00[_0xcb8a('0x3f')]);return db[_0xcb8a('0x5f')][_0xcb8a('0x1d')]({'where':_0x28b7d7[_0xcb8a('0x3a')]})[_0xcb8a('0x25')](function(_0x201731){_0x13dc2c[_0xcb8a('0x1d')]=_0x201731;if(_0x150e00[_0xcb8a('0x32')][_0xcb8a('0x41')]){_0x28b7d7[_0xcb8a('0x42')]=[{'all':!![]}];}return db['CmHopperHistory']['findAll'](_0x28b7d7);})[_0xcb8a('0x25')](function(_0x2b52ff){_0x13dc2c[_0xcb8a('0x5d')]=_0x2b52ff;return _0x13dc2c;});}})['then'](respondWithFilteredResult(_0xd23a30,_0x28b7d7))[_0xcb8a('0x48')](handleError(_0xd23a30,null));};exports[_0xcb8a('0x60')]=function(_0x185e73,_0x2232ae,_0x184325){var _0x2ad26e={'raw':!![],'where':{}};var _0x52ef1b={};var _0x13d4f1={'count':0x0,'rows':[]};return db[_0xcb8a('0x40')][_0xcb8a('0x58')]({'where':{'id':_0x185e73[_0xcb8a('0x45')]['id']}})['then'](handleEntityNotFound(_0x2232ae,null))[_0xcb8a('0x25')](function(_0x1b2d7d){if(_0x1b2d7d){_0x52ef1b[_0xcb8a('0x46')]=_[_0xcb8a('0x33')](db['CmHopperFinal'][_0xcb8a('0x2e')]);_0x52ef1b[_0xcb8a('0x32')]=_['keys'](_0x185e73[_0xcb8a('0x32')]);_0x52ef1b[_0xcb8a('0x3b')]=_['intersection'](_0x52ef1b[_0xcb8a('0x46')],_0x52ef1b['query']);_0x2ad26e[_0xcb8a('0x35')]=_[_0xcb8a('0x34')](_0x52ef1b['model'],qs[_0xcb8a('0x36')](_0x185e73[_0xcb8a('0x32')][_0xcb8a('0x36')]));_0x2ad26e[_0xcb8a('0x35')]=_0x2ad26e[_0xcb8a('0x35')][_0xcb8a('0x37')]?_0x2ad26e[_0xcb8a('0x35')]:_0x52ef1b['model'];if(!_0x185e73[_0xcb8a('0x32')][_0xcb8a('0x5a')](_0xcb8a('0x38'))){_0x2ad26e[_0xcb8a('0x1e')]=qs[_0xcb8a('0x1e')](_0x185e73[_0xcb8a('0x32')]['limit']);_0x2ad26e['offset']=qs[_0xcb8a('0x1b')](_0x185e73['query'][_0xcb8a('0x1b')]);}_0x2ad26e['order']=qs['sort'](_0x185e73[_0xcb8a('0x32')][_0xcb8a('0x39')]);_0x2ad26e[_0xcb8a('0x3a')]=qs['filters'](_[_0xcb8a('0x3c')](_0x185e73[_0xcb8a('0x32')],_0x52ef1b[_0xcb8a('0x3b')]));_0x2ad26e[_0xcb8a('0x3a')][_0xcb8a('0x5c')]=_0x1b2d7d['id'];if(_0x185e73[_0xcb8a('0x32')][_0xcb8a('0x3d')]){_0x2ad26e[_0xcb8a('0x3a')]=_[_0xcb8a('0x47')](_0x2ad26e['where'],{'$or':_[_0xcb8a('0x2d')](_0x2ad26e['attributes'],function(_0x208cbf){var _0x2b829c={};_0x2b829c[_0x208cbf]={'$like':'%'+_0x185e73['query']['filter']+'%'};return _0x2b829c;})});}_0x2ad26e=_['merge']({},_0x2ad26e,_0x185e73[_0xcb8a('0x3f')]);return db[_0xcb8a('0x61')][_0xcb8a('0x1d')]({'where':_0x2ad26e['where']})[_0xcb8a('0x25')](function(_0x187e5e){_0x13d4f1['count']=_0x187e5e;if(_0x185e73[_0xcb8a('0x32')][_0xcb8a('0x41')]){_0x2ad26e[_0xcb8a('0x42')]=[{'all':!![]}];}return db[_0xcb8a('0x61')][_0xcb8a('0x43')](_0x2ad26e);})[_0xcb8a('0x25')](function(_0x50dd87){_0x13d4f1[_0xcb8a('0x5d')]=_0x50dd87;return _0x13d4f1;});}})['then'](respondWithFilteredResult(_0x2232ae,_0x2ad26e))[_0xcb8a('0x48')](handleError(_0x2232ae,null));};exports[_0xcb8a('0x62')]=function(_0x421f40,_0x57b54e,_0x3c8ff7){var _0x45b141={'raw':!![],'where':{}};var _0x25fefb={};var _0x53fe4a={'count':0x0,'rows':[]};return db['Campaign'][_0xcb8a('0x58')]({'where':{'id':_0x421f40[_0xcb8a('0x45')]['id']}})[_0xcb8a('0x25')](handleEntityNotFound(_0x57b54e,null))[_0xcb8a('0x25')](function(_0x256d94){if(_0x256d94){_0x25fefb[_0xcb8a('0x46')]=_[_0xcb8a('0x33')](db[_0xcb8a('0x63')][_0xcb8a('0x2e')]);_0x25fefb['query']=_[_0xcb8a('0x33')](_0x421f40['query']);_0x25fefb['filters']=_[_0xcb8a('0x34')](_0x25fefb[_0xcb8a('0x46')],_0x25fefb[_0xcb8a('0x32')]);_0x45b141[_0xcb8a('0x35')]=_['intersection'](_0x25fefb[_0xcb8a('0x46')],qs[_0xcb8a('0x36')](_0x421f40['query'][_0xcb8a('0x36')]));_0x45b141[_0xcb8a('0x35')]=_0x45b141[_0xcb8a('0x35')]['length']?_0x45b141[_0xcb8a('0x35')]:_0x25fefb[_0xcb8a('0x46')];if(!_0x421f40[_0xcb8a('0x32')][_0xcb8a('0x5a')](_0xcb8a('0x38'))){_0x45b141[_0xcb8a('0x1e')]=qs[_0xcb8a('0x1e')](_0x421f40[_0xcb8a('0x32')][_0xcb8a('0x1e')]);_0x45b141[_0xcb8a('0x1b')]=qs[_0xcb8a('0x1b')](_0x421f40[_0xcb8a('0x32')][_0xcb8a('0x1b')]);}_0x45b141[_0xcb8a('0x5b')]=qs[_0xcb8a('0x39')](_0x421f40[_0xcb8a('0x32')]['sort']);_0x45b141[_0xcb8a('0x3a')]=qs[_0xcb8a('0x3b')](_['pick'](_0x421f40[_0xcb8a('0x32')],_0x25fefb['filters']));_0x45b141[_0xcb8a('0x3a')][_0xcb8a('0x5c')]=_0x256d94['id'];if(_0x421f40[_0xcb8a('0x32')]['filter']){_0x45b141['where']=_[_0xcb8a('0x47')](_0x45b141[_0xcb8a('0x3a')],{'$or':_[_0xcb8a('0x2d')](_0x45b141['attributes'],function(_0x510e06){var _0x34e2a3={};_0x34e2a3[_0x510e06]={'$like':'%'+_0x421f40['query'][_0xcb8a('0x3d')]+'%'};return _0x34e2a3;})});}_0x45b141=_[_0xcb8a('0x47')]({},_0x45b141,_0x421f40[_0xcb8a('0x3f')]);return db[_0xcb8a('0x63')][_0xcb8a('0x1d')]({'where':_0x45b141[_0xcb8a('0x3a')]})[_0xcb8a('0x25')](function(_0x4187f1){_0x53fe4a[_0xcb8a('0x1d')]=_0x4187f1;if(_0x421f40[_0xcb8a('0x32')][_0xcb8a('0x41')]){_0x45b141['include']=[{'all':!![]}];}return db[_0xcb8a('0x63')]['findAll'](_0x45b141);})[_0xcb8a('0x25')](function(_0x169376){_0x53fe4a[_0xcb8a('0x5d')]=_0x169376;return _0x53fe4a;});}})[_0xcb8a('0x25')](respondWithFilteredResult(_0x57b54e,_0x45b141))[_0xcb8a('0x48')](handleError(_0x57b54e,null));};exports[_0xcb8a('0x64')]=function(_0x456ed3,_0x4d59a5,_0x5c3bd4){var _0x57ef41={};var _0x311d18={};var _0x2a13f3;var _0x217173;return db[_0xcb8a('0x40')][_0xcb8a('0x58')]({'where':{'id':_0x456ed3['params']['id']}})[_0xcb8a('0x25')](handleEntityNotFound(_0x4d59a5,null))[_0xcb8a('0x25')](function(_0x2551be){if(_0x2551be){_0x2a13f3=_0x2551be;_0x311d18[_0xcb8a('0x46')]=_[_0xcb8a('0x33')](db[_0xcb8a('0x65')][_0xcb8a('0x2e')]);_0x311d18[_0xcb8a('0x32')]=_[_0xcb8a('0x33')](_0x456ed3[_0xcb8a('0x32')]);_0x311d18['filters']=_[_0xcb8a('0x34')](_0x311d18[_0xcb8a('0x46')],_0x311d18[_0xcb8a('0x32')]);_0x57ef41[_0xcb8a('0x35')]=_[_0xcb8a('0x34')](_0x311d18[_0xcb8a('0x46')],qs[_0xcb8a('0x36')](_0x456ed3[_0xcb8a('0x32')][_0xcb8a('0x36')]));_0x57ef41['attributes']=_0x57ef41['attributes']['length']?_0x57ef41[_0xcb8a('0x35')]:_0x311d18[_0xcb8a('0x46')];_0x57ef41['order']=qs['sort'](_0x456ed3[_0xcb8a('0x32')][_0xcb8a('0x39')]);_0x57ef41[_0xcb8a('0x3a')]=qs[_0xcb8a('0x3b')](_['pick'](_0x456ed3[_0xcb8a('0x32')],_0x311d18[_0xcb8a('0x3b')]));if(_0x456ed3['query'][_0xcb8a('0x3d')]){_0x57ef41[_0xcb8a('0x3a')]=_[_0xcb8a('0x47')](_0x57ef41[_0xcb8a('0x3a')],{'$or':_[_0xcb8a('0x2d')](_0x57ef41[_0xcb8a('0x35')],function(_0x224094){var _0x3a9af8={};_0x3a9af8[_0x224094]={'$like':'%'+_0x456ed3[_0xcb8a('0x32')][_0xcb8a('0x3d')]+'%'};return _0x3a9af8;})});}_0x57ef41=_['merge']({},_0x57ef41,_0x456ed3['options']);return _0x2a13f3[_0xcb8a('0x64')](_0x57ef41);}})['then'](function(_0x3c9734){if(_0x3c9734){_0x217173=_0x3c9734[_0xcb8a('0x37')];if(!_0x456ed3['query']['hasOwnProperty'](_0xcb8a('0x38'))){_0x57ef41[_0xcb8a('0x1e')]=qs[_0xcb8a('0x1e')](_0x456ed3[_0xcb8a('0x32')]['limit']);_0x57ef41[_0xcb8a('0x1b')]=qs[_0xcb8a('0x1b')](_0x456ed3[_0xcb8a('0x32')][_0xcb8a('0x1b')]);}return _0x2a13f3[_0xcb8a('0x64')](_0x57ef41);}})[_0xcb8a('0x25')](function(_0x53d2db){if(_0x53d2db){return _0x53d2db?{'count':_0x217173,'rows':_0x53d2db}:null;}})[_0xcb8a('0x25')](respondWithResult(_0x4d59a5,null))[_0xcb8a('0x48')](handleError(_0x4d59a5,null));};exports['addLists']=function(_0x1b6345,_0x344447,_0x367345){var _0x14d879,_0x4b3ff6;return db['Campaign'][_0xcb8a('0x4d')]({'where':{'id':_0x1b6345[_0xcb8a('0x45')]['id']}})['then'](handleEntityNotFound(_0x344447,null))[_0xcb8a('0x25')](function(_0x4fcfbe){if(_0x4fcfbe){_0x4b3ff6=_0x4fcfbe;return _0x4fcfbe[_0xcb8a('0x66')](_0x1b6345[_0xcb8a('0x56')][_0xcb8a('0x67')],_[_0xcb8a('0x51')](_0x1b6345[_0xcb8a('0x56')],[_0xcb8a('0x67'),'id'])||{});}return null;})[_0xcb8a('0x68')](function(_0x50c1de){var _0x1e043c;_0x14d879=_0x50c1de||[];var _0x179d47=[];if(_0x50c1de){for(var _0x4d5076=0x0;_0x4d5076<_0x50c1de['length'];_0x4d5076+=0x1){var _0x384519=_0x50c1de[_0x4d5076]['get']({'plain':!![]});_0x4b3ff6['dialCheckDuplicateType']=_0x1b6345['body']['dialCheckDuplicateType']?_0x1b6345[_0xcb8a('0x56')]['dialCheckDuplicateType']:_0x4b3ff6[_0xcb8a('0x69')];switch(_0x4b3ff6[_0xcb8a('0x69')]){case _0xcb8a('0x6a'):_0x1e043c=squel['insert']()[_0xcb8a('0x6b')](_0xcb8a('0x6c'))[_0xcb8a('0x6d')]([_0xcb8a('0x6e'),_0xcb8a('0x6f'),_0xcb8a('0x70'),_0xcb8a('0x71'),_0xcb8a('0x5c'),'createdAt',_0xcb8a('0x53')],squel[_0xcb8a('0x72')]()[_0xcb8a('0x73')](_0xcb8a('0x6e'),_0xcb8a('0x6e'))[_0xcb8a('0x73')](_0xcb8a('0x74'),_0xcb8a('0x6f'))['field']('id','ContactId')['field'](_0x384519[_0xcb8a('0x75')][_0xcb8a('0x76')](),_0xcb8a('0x71'))[_0xcb8a('0x73')](_0x1b6345[_0xcb8a('0x45')]['id'][_0xcb8a('0x76')](),'CampaignId')['field'](_0xcb8a('0x74'),_0xcb8a('0x52'))[_0xcb8a('0x73')]('NOW()',_0xcb8a('0x53'))[_0xcb8a('0x77')](_0xcb8a('0x78'))[_0xcb8a('0x3a')]('deletedAt\x20IS\x20NULL')[_0xcb8a('0x3a')](_0xcb8a('0x79'),_0x384519['CmListId'][_0xcb8a('0x76')]())[_0xcb8a('0x3a')](_0xcb8a('0x7a'))[_0xcb8a('0x3a')](_0xcb8a('0x7b'),squel['select']()[_0xcb8a('0x73')](_0xcb8a('0x7c'))['from'](_0xcb8a('0x7d'))[_0xcb8a('0x3a')](_0xcb8a('0x7e'),_0x1b6345[_0xcb8a('0x45')]['id']['toString']()))[_0xcb8a('0x3a')](_0xcb8a('0x7b'),squel[_0xcb8a('0x72')]()[_0xcb8a('0x73')](_0xcb8a('0x7f'))[_0xcb8a('0x77')]('cm_hopper')['where'](_0xcb8a('0x7e'),_0x1b6345[_0xcb8a('0x45')]['id'][_0xcb8a('0x76')]())))[_0xcb8a('0x76')]();break;case'onlyIfOpen':_0x1e043c=squel['insert']()[_0xcb8a('0x6b')](_0xcb8a('0x6c'))['fromQuery']([_0xcb8a('0x6e'),_0xcb8a('0x6f'),_0xcb8a('0x70'),_0xcb8a('0x71'),_0xcb8a('0x5c'),_0xcb8a('0x52'),_0xcb8a('0x53')],squel[_0xcb8a('0x72')]()[_0xcb8a('0x73')]('phone',_0xcb8a('0x6e'))['field'](_0xcb8a('0x74'),_0xcb8a('0x6f'))['field']('id',_0xcb8a('0x70'))[_0xcb8a('0x73')](_0x384519['CmListId'][_0xcb8a('0x76')](),_0xcb8a('0x71'))['field'](_0x1b6345[_0xcb8a('0x45')]['id'][_0xcb8a('0x76')](),_0xcb8a('0x5c'))[_0xcb8a('0x73')](_0xcb8a('0x74'),_0xcb8a('0x52'))['field']('NOW()',_0xcb8a('0x53'))['from'](_0xcb8a('0x78'))[_0xcb8a('0x3a')](_0xcb8a('0x80'))['where'](_0xcb8a('0x79'),_0x384519[_0xcb8a('0x75')][_0xcb8a('0x76')]())[_0xcb8a('0x3a')]('phone\x20IS\x20NOT\x20NULL')[_0xcb8a('0x3a')](_0xcb8a('0x7b'),squel[_0xcb8a('0x72')]()['field'](_0xcb8a('0x7f'))[_0xcb8a('0x77')](_0xcb8a('0x6c'))[_0xcb8a('0x3a')](_0xcb8a('0x7e'),_0x1b6345[_0xcb8a('0x45')]['id'][_0xcb8a('0x76')]())))[_0xcb8a('0x76')]();break;default:_0x1e043c=squel[_0xcb8a('0x81')]()['into'](_0xcb8a('0x6c'))['fromQuery']([_0xcb8a('0x6e'),_0xcb8a('0x6f'),'ContactId',_0xcb8a('0x71'),_0xcb8a('0x5c'),_0xcb8a('0x52'),_0xcb8a('0x53')],squel[_0xcb8a('0x72')]()['field'](_0xcb8a('0x6e'),'phone')[_0xcb8a('0x73')]('NOW()','scheduledAt')['field']('id',_0xcb8a('0x70'))[_0xcb8a('0x73')](_0x384519[_0xcb8a('0x75')][_0xcb8a('0x76')](),_0xcb8a('0x71'))[_0xcb8a('0x73')](_0x1b6345[_0xcb8a('0x45')]['id'][_0xcb8a('0x76')](),_0xcb8a('0x5c'))['field'](_0xcb8a('0x74'),'createdAt')[_0xcb8a('0x73')](_0xcb8a('0x74'),_0xcb8a('0x53'))['from']('cm_contacts')[_0xcb8a('0x3a')](_0xcb8a('0x80'))[_0xcb8a('0x3a')]('ListId\x20=\x20?',_0x384519[_0xcb8a('0x75')][_0xcb8a('0x76')]())[_0xcb8a('0x3a')](_0xcb8a('0x7a')))[_0xcb8a('0x76')]();}_0x179d47[_0xcb8a('0x82')](db[_0xcb8a('0x83')]['query'](_0x1e043c));}return BPromise[_0xcb8a('0x84')](_0x179d47);}})[_0xcb8a('0x25')](function(){return _0x14d879;})[_0xcb8a('0x25')](respondWithResult(_0x344447,null))['catch'](handleError(_0x344447,null));};exports[_0xcb8a('0x85')]=function(_0x5acfda,_0x5084d5,_0x593b3a){return db[_0xcb8a('0x40')][_0xcb8a('0x4d')]({'where':{'id':_0x5acfda['params']['id']}})[_0xcb8a('0x25')](handleEntityNotFound(_0x5084d5,null))[_0xcb8a('0x25')](function(_0x1b0d2d){if(_0x1b0d2d){return _0x1b0d2d['removeLists'](_0x5acfda['query'][_0xcb8a('0x67')]);}})['then'](function(_0x3d488f){if(_0x3d488f){return db[_0xcb8a('0x59')][_0xcb8a('0x26')]({'where':{'ListId':_0x5acfda['query'][_0xcb8a('0x67')],'CampaignId':_0x5acfda[_0xcb8a('0x45')]['id']}})['then'](function(){return _0x3d488f;});}})[_0xcb8a('0x25')](respondWithStatusCode(_0x5084d5,null))[_0xcb8a('0x48')](handleError(_0x5084d5,null));};exports[_0xcb8a('0x86')]=function(_0x29de60,_0x3d0639,_0x4d94c5){var _0xe3c16b={};var _0xeae62c={};var _0x4569f2;var _0x3e2234;return db[_0xcb8a('0x40')][_0xcb8a('0x58')]({'where':{'id':_0x29de60[_0xcb8a('0x45')]['id']}})[_0xcb8a('0x25')](handleEntityNotFound(_0x3d0639,null))[_0xcb8a('0x25')](function(_0x11e7f9){if(_0x11e7f9){_0x4569f2=_0x11e7f9;_0xeae62c[_0xcb8a('0x46')]=_[_0xcb8a('0x33')](db['CmList']['rawAttributes']);_0xeae62c[_0xcb8a('0x32')]=_[_0xcb8a('0x33')](_0x29de60[_0xcb8a('0x32')]);_0xeae62c[_0xcb8a('0x3b')]=_[_0xcb8a('0x34')](_0xeae62c[_0xcb8a('0x46')],_0xeae62c[_0xcb8a('0x32')]);_0xe3c16b[_0xcb8a('0x35')]=_['intersection'](_0xeae62c['model'],qs['fields'](_0x29de60['query'][_0xcb8a('0x36')]));_0xe3c16b['attributes']=_0xe3c16b[_0xcb8a('0x35')][_0xcb8a('0x37')]?_0xe3c16b['attributes']:_0xeae62c[_0xcb8a('0x46')];_0xe3c16b[_0xcb8a('0x5b')]=qs[_0xcb8a('0x39')](_0x29de60[_0xcb8a('0x32')][_0xcb8a('0x39')]);_0xe3c16b['where']=qs[_0xcb8a('0x3b')](_[_0xcb8a('0x3c')](_0x29de60[_0xcb8a('0x32')],_0xeae62c[_0xcb8a('0x3b')]));if(_0x29de60['query'][_0xcb8a('0x3d')]){_0xe3c16b[_0xcb8a('0x3a')]=_['merge'](_0xe3c16b[_0xcb8a('0x3a')],{'$or':_['map'](_0xe3c16b['attributes'],function(_0x5a13b3){var _0x175c8d={};_0x175c8d[_0x5a13b3]={'$like':'%'+_0x29de60[_0xcb8a('0x32')][_0xcb8a('0x3d')]+'%'};return _0x175c8d;})});}_0xe3c16b=_[_0xcb8a('0x47')]({},_0xe3c16b,_0x29de60[_0xcb8a('0x3f')]);return _0x4569f2[_0xcb8a('0x86')](_0xe3c16b);}})[_0xcb8a('0x25')](function(_0x16361f){if(_0x16361f){_0x3e2234=_0x16361f[_0xcb8a('0x37')];if(!_0x29de60[_0xcb8a('0x32')]['hasOwnProperty'](_0xcb8a('0x38'))){_0xe3c16b[_0xcb8a('0x1e')]=qs[_0xcb8a('0x1e')](_0x29de60[_0xcb8a('0x32')][_0xcb8a('0x1e')]);_0xe3c16b['offset']=qs[_0xcb8a('0x1b')](_0x29de60[_0xcb8a('0x32')]['offset']);}return _0x4569f2[_0xcb8a('0x86')](_0xe3c16b);}})[_0xcb8a('0x25')](function(_0x35d04b){if(_0x35d04b){return _0x35d04b?{'count':_0x3e2234,'rows':_0x35d04b}:null;}})[_0xcb8a('0x25')](respondWithResult(_0x3d0639,null))['catch'](handleError(_0x3d0639,null));};exports[_0xcb8a('0x87')]=function(_0x6999fd,_0x12db8b,_0x13aa7c){var _0x4ade74,_0x56966a;return db[_0xcb8a('0x40')]['find']({'where':{'id':_0x6999fd[_0xcb8a('0x45')]['id']}})[_0xcb8a('0x25')](handleEntityNotFound(_0x12db8b,null))[_0xcb8a('0x25')](function(_0x563ef0){if(_0x563ef0){_0x56966a=_0x563ef0;return _0x563ef0[_0xcb8a('0x87')](_0x6999fd[_0xcb8a('0x56')]['ids'],_[_0xcb8a('0x51')](_0x6999fd[_0xcb8a('0x56')],[_0xcb8a('0x67'),'id'])||{});}return null;})[_0xcb8a('0x68')](function(_0x3d3cbf){var _0x3fbff0;_0x4ade74=_0x3d3cbf||[];var _0x1b0a97=[];if(_0x3d3cbf){for(var _0x201e6a=0x0;_0x201e6a<_0x3d3cbf[_0xcb8a('0x37')];_0x201e6a+=0x1){var _0x17ba51=_0x3d3cbf[_0x201e6a]['get']({'plain':!![]});_0x3fbff0=squel[_0xcb8a('0x81')]()[_0xcb8a('0x6b')](_0xcb8a('0x88'))[_0xcb8a('0x6d')]([_0xcb8a('0x6e'),_0xcb8a('0x70'),_0xcb8a('0x71'),_0xcb8a('0x5c'),_0xcb8a('0x52'),_0xcb8a('0x53')],squel['select']()[_0xcb8a('0x73')]('phone','phone')[_0xcb8a('0x73')]('id','ContactId')['field'](_0x17ba51[_0xcb8a('0x75')]['toString'](),_0xcb8a('0x71'))['field'](_0x6999fd['params']['id'][_0xcb8a('0x76')](),'CampaignId')[_0xcb8a('0x73')](_0xcb8a('0x74'),_0xcb8a('0x52'))[_0xcb8a('0x73')](_0xcb8a('0x74'),'updatedAt')[_0xcb8a('0x77')](_0xcb8a('0x78'))[_0xcb8a('0x3a')](_0xcb8a('0x80'))[_0xcb8a('0x3a')](_0xcb8a('0x79'),_0x17ba51[_0xcb8a('0x75')][_0xcb8a('0x76')]())[_0xcb8a('0x3a')](_0xcb8a('0x7a')))['toString']();_0x1b0a97[_0xcb8a('0x82')](db[_0xcb8a('0x83')][_0xcb8a('0x32')](_0x3fbff0));}return BPromise[_0xcb8a('0x84')](_0x1b0a97);}})[_0xcb8a('0x25')](function(){return _0x4ade74;})[_0xcb8a('0x25')](respondWithResult(_0x12db8b,null))['catch'](handleError(_0x12db8b,null));};exports[_0xcb8a('0x89')]=function(_0x5a5539,_0x30d7d6,_0x4d8d26){return db[_0xcb8a('0x40')][_0xcb8a('0x4d')]({'where':{'id':_0x5a5539[_0xcb8a('0x45')]['id']}})['then'](handleEntityNotFound(_0x30d7d6,null))[_0xcb8a('0x25')](function(_0x53c4f3){if(_0x53c4f3){return _0x53c4f3['removeBlackLists'](_0x5a5539[_0xcb8a('0x32')][_0xcb8a('0x67')]);}})[_0xcb8a('0x25')](function(_0x1e5ef7){if(_0x1e5ef7){return db[_0xcb8a('0x63')][_0xcb8a('0x26')]({'where':{'ListId':_0x5a5539['query'][_0xcb8a('0x67')],'CampaignId':_0x5a5539['params']['id']}})[_0xcb8a('0x25')](function(){return _0x1e5ef7;});}})[_0xcb8a('0x25')](respondWithStatusCode(_0x30d7d6,null))[_0xcb8a('0x48')](handleError(_0x30d7d6,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index c120076..b851e45 100644 --- a/server/api/campaign/campaign.model.js +++ b/server/api/campaign/campaign.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./campaign.attributes','exports','Campaign','campaigns','lodash','util'];(function(_0x221927,_0x1cd547){var _0x5c7399=function(_0x19b6ca){while(--_0x19b6ca){_0x221927['push'](_0x221927['shift']());}};_0x5c7399(++_0x1cd547);}(_0x7a54,0x106));var _0x47a5=function(_0x531d6f,_0x4fb825){_0x531d6f=_0x531d6f-0x0;var _0x2bdce7=_0x7a54[_0x531d6f];return _0x2bdce7;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7a54=['../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./campaign.attributes','exports','Campaign','campaigns','lodash','util'];(function(_0x2cee34,_0x7e21a9){var _0x5a369e=function(_0x5114d1){while(--_0x5114d1){_0x2cee34['push'](_0x2cee34['shift']());}};_0x5a369e(++_0x7e21a9);}(_0x7a54,0x106));var _0x47a5=function(_0x267210,_0x261b9f){_0x267210=_0x267210-0x0;var _0x485a55=_0x7a54[_0x267210];return _0x485a55;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/campaign/campaign.rpc.js b/server/api/campaign/campaign.rpc.js index 3dab695..3f9297a 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 _0xc6d8=['request','info','Campaign,\x20%s,\x20%s','request\x20sent','debug','Campaign,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','findAll','options','raw','model','attributes','map','include','then','GetCampaign','lodash','moment','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x35ec9a,_0x174edd){var _0x491fa3=function(_0x45eea8){while(--_0x45eea8){_0x35ec9a['push'](_0x35ec9a['shift']());}};_0x491fa3(++_0x174edd);}(_0xc6d8,0xd7));var _0x8c6d=function(_0x426cad,_0x45810d){_0x426cad=_0x426cad-0x0;var _0x50c00f=_0xc6d8[_0x426cad];return _0x50c00f;};'use strict';var _=require(_0x8c6d('0x0'));var util=require('util');var moment=require(_0x8c6d('0x1'));var BPromise=require('bluebird');var rs=require(_0x8c6d('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8c6d('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x8c6d('0x4'));var config=require(_0x8c6d('0x5'));var jayson=require(_0x8c6d('0x6'));var client=jayson[_0x8c6d('0x7')][_0x8c6d('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2dbb52,_0x98cae4,_0x5529f1){return new BPromise(function(_0x1496ba,_0x75c49f){return client[_0x8c6d('0x9')](_0x2dbb52,_0x5529f1)['then'](function(_0x3cecc1){logger[_0x8c6d('0xa')](_0x8c6d('0xb'),_0x98cae4,_0x8c6d('0xc'));logger[_0x8c6d('0xd')](_0x8c6d('0xe'),_0x98cae4,_0x8c6d('0xc'),JSON[_0x8c6d('0xf')](_0x3cecc1));if(_0x3cecc1['error']){if(_0x3cecc1[_0x8c6d('0x10')]['code']===0x1f4){logger['error'](_0x8c6d('0xb'),_0x98cae4,_0x3cecc1[_0x8c6d('0x10')][_0x8c6d('0x11')]);return _0x75c49f(_0x3cecc1[_0x8c6d('0x10')][_0x8c6d('0x11')]);}logger[_0x8c6d('0x10')](_0x8c6d('0xb'),_0x98cae4,_0x3cecc1[_0x8c6d('0x10')][_0x8c6d('0x11')]);return _0x1496ba(_0x3cecc1[_0x8c6d('0x10')]['message']);}else{logger[_0x8c6d('0xa')]('Campaign,\x20%s,\x20%s',_0x98cae4,_0x8c6d('0xc'));_0x1496ba(_0x3cecc1['result'][_0x8c6d('0x11')]);}})[_0x8c6d('0x12')](function(_0x52ed7b){logger[_0x8c6d('0x10')](_0x8c6d('0xb'),_0x98cae4,_0x52ed7b);_0x75c49f(_0x52ed7b);});});}exports['GetCampaign']=function(_0x3e5495){var _0x5a22de=this;return new Promise(function(_0x4c2f8d,_0x21b8ee){return db['Campaign'][_0x8c6d('0x13')]({'raw':_0x3e5495[_0x8c6d('0x14')]?_0x3e5495[_0x8c6d('0x14')][_0x8c6d('0x15')]===undefined?!![]:![]:!![],'where':_0x3e5495[_0x8c6d('0x14')]?_0x3e5495['options']['where']||null:null,'attributes':_0x3e5495['options']?_0x3e5495[_0x8c6d('0x14')]['attributes']||null:null,'limit':_0x3e5495[_0x8c6d('0x14')]?_0x3e5495['options']['limit']||null:null,'include':_0x3e5495[_0x8c6d('0x14')]?_0x3e5495[_0x8c6d('0x14')]['include']?_['map'](_0x3e5495['options']['include'],function(_0x2a85b5){return{'model':db[_0x2a85b5[_0x8c6d('0x16')]],'as':_0x2a85b5['as'],'attributes':_0x2a85b5[_0x8c6d('0x17')],'include':_0x2a85b5['include']?_[_0x8c6d('0x18')](_0x2a85b5['include'],function(_0x15a9c4){return{'model':db[_0x15a9c4['model']],'as':_0x15a9c4['as'],'attributes':_0x15a9c4[_0x8c6d('0x17')],'include':_0x15a9c4[_0x8c6d('0x19')]?_[_0x8c6d('0x18')](_0x15a9c4[_0x8c6d('0x19')],function(_0x1e6755){return{'model':db[_0x1e6755[_0x8c6d('0x16')]],'as':_0x1e6755['as'],'attributes':_0x1e6755[_0x8c6d('0x17')]};}):[]};}):[]};}):[]:[]})[_0x8c6d('0x1a')](function(_0x3eab38){logger['info']('GetCampaign',_0x3e5495);logger[_0x8c6d('0xd')](_0x8c6d('0x1b'),_0x3e5495,JSON[_0x8c6d('0xf')](_0x3eab38));_0x4c2f8d(_0x3eab38);})[_0x8c6d('0x12')](function(_0x370626){logger[_0x8c6d('0x10')](_0x8c6d('0x1b'),_0x370626[_0x8c6d('0x11')],_0x3e5495);_0x21b8ee(_0x5a22de[_0x8c6d('0x10')](0x1f4,_0x370626[_0x8c6d('0x11')]));});});}; \ No newline at end of file +var _0x5bbd=['info','Campaign,\x20%s,\x20%s','debug','Campaign,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','catch','GetCampaign','Campaign','options','raw','where','include','map','model','attributes','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/environment','jayson/promise'];(function(_0x45ee03,_0x2f5319){var _0x13d535=function(_0x391904){while(--_0x391904){_0x45ee03['push'](_0x45ee03['shift']());}};_0x13d535(++_0x2f5319);}(_0x5bbd,0x12b));var _0xd5bb=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5bbd[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xd5bb('0x0'));var util=require(_0xd5bb('0x1'));var moment=require(_0xd5bb('0x2'));var BPromise=require(_0xd5bb('0x3'));var rs=require(_0xd5bb('0x4'));var fs=require('fs');var Redis=require(_0xd5bb('0x5'));var db=require(_0xd5bb('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xd5bb('0x7'));var jayson=require(_0xd5bb('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x292873,_0x5093d3,_0x3878ba){return new BPromise(function(_0x17c08f,_0x1e7ad6){return client['request'](_0x292873,_0x3878ba)['then'](function(_0x44ffea){logger[_0xd5bb('0x9')](_0xd5bb('0xa'),_0x5093d3,'request\x20sent');logger[_0xd5bb('0xb')](_0xd5bb('0xc'),_0x5093d3,_0xd5bb('0xd'),JSON['stringify'](_0x44ffea));if(_0x44ffea['error']){if(_0x44ffea[_0xd5bb('0xe')][_0xd5bb('0xf')]===0x1f4){logger['error'](_0xd5bb('0xa'),_0x5093d3,_0x44ffea['error'][_0xd5bb('0x10')]);return _0x1e7ad6(_0x44ffea['error'][_0xd5bb('0x10')]);}logger[_0xd5bb('0xe')]('Campaign,\x20%s,\x20%s',_0x5093d3,_0x44ffea[_0xd5bb('0xe')][_0xd5bb('0x10')]);return _0x17c08f(_0x44ffea[_0xd5bb('0xe')]['message']);}else{logger['info'](_0xd5bb('0xa'),_0x5093d3,_0xd5bb('0xd'));_0x17c08f(_0x44ffea['result'][_0xd5bb('0x10')]);}})[_0xd5bb('0x11')](function(_0x3b7021){logger[_0xd5bb('0xe')]('Campaign,\x20%s,\x20%s',_0x5093d3,_0x3b7021);_0x1e7ad6(_0x3b7021);});});}exports[_0xd5bb('0x12')]=function(_0x41bc89){var _0x567d06=this;return new Promise(function(_0x3d312f,_0x222b0c){return db[_0xd5bb('0x13')]['findAll']({'raw':_0x41bc89[_0xd5bb('0x14')]?_0x41bc89[_0xd5bb('0x14')][_0xd5bb('0x15')]===undefined?!![]:![]:!![],'where':_0x41bc89[_0xd5bb('0x14')]?_0x41bc89[_0xd5bb('0x14')][_0xd5bb('0x16')]||null:null,'attributes':_0x41bc89[_0xd5bb('0x14')]?_0x41bc89[_0xd5bb('0x14')]['attributes']||null:null,'limit':_0x41bc89['options']?_0x41bc89[_0xd5bb('0x14')]['limit']||null:null,'include':_0x41bc89['options']?_0x41bc89[_0xd5bb('0x14')][_0xd5bb('0x17')]?_[_0xd5bb('0x18')](_0x41bc89[_0xd5bb('0x14')][_0xd5bb('0x17')],function(_0x52383c){return{'model':db[_0x52383c[_0xd5bb('0x19')]],'as':_0x52383c['as'],'attributes':_0x52383c[_0xd5bb('0x1a')],'include':_0x52383c[_0xd5bb('0x17')]?_[_0xd5bb('0x18')](_0x52383c[_0xd5bb('0x17')],function(_0x48f15d){return{'model':db[_0x48f15d['model']],'as':_0x48f15d['as'],'attributes':_0x48f15d[_0xd5bb('0x1a')],'include':_0x48f15d[_0xd5bb('0x17')]?_[_0xd5bb('0x18')](_0x48f15d[_0xd5bb('0x17')],function(_0x351c33){return{'model':db[_0x351c33['model']],'as':_0x351c33['as'],'attributes':_0x351c33[_0xd5bb('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x30fa6d){logger[_0xd5bb('0x9')](_0xd5bb('0x12'),_0x41bc89);logger[_0xd5bb('0xb')](_0xd5bb('0x12'),_0x41bc89,JSON[_0xd5bb('0x1b')](_0x30fa6d));_0x3d312f(_0x30fa6d);})[_0xd5bb('0x11')](function(_0x228fc4){logger[_0xd5bb('0xe')](_0xd5bb('0x12'),_0x228fc4[_0xd5bb('0x10')],_0x41bc89);_0x222b0c(_0x567d06[_0xd5bb('0xe')](0x1f4,_0x228fc4[_0xd5bb('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/campaign/index.js b/server/api/campaign/index.js index 7b1f9bd..1f37205 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 _0x9aee=['../../components/auth/service','../../components/interaction/service','isAuthenticated','/:id','show','get','getHoppers','getHopperHistories','/:id/hopper_black','getHopperBlacks','/:id/lists','getLists','/:id/blacklists','post','create','/:id/clone','clone','addBlackLists','put','delete','removeLists','removeBlackLists','exports','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x24a863,_0x255d66){var _0x564910=function(_0x3d59d){while(--_0x3d59d){_0x24a863['push'](_0x24a863['shift']());}};_0x564910(++_0x255d66);}(_0x9aee,0x71));var _0xe9ae=function(_0x515d8c,_0x305407){_0x515d8c=_0x515d8c-0x0;var _0x1297e7=_0x9aee[_0x515d8c];return _0x1297e7;};'use strict';var multer=require(_0xe9ae('0x0'));var util=require(_0xe9ae('0x1'));var path=require(_0xe9ae('0x2'));var timeout=require(_0xe9ae('0x3'));var express=require(_0xe9ae('0x4'));var router=express[_0xe9ae('0x5')]();var fs_extra=require(_0xe9ae('0x6'));var auth=require(_0xe9ae('0x7'));var interaction=require(_0xe9ae('0x8'));var config=require('../../config/environment');var controller=require('./campaign.controller');router['get']('/',auth[_0xe9ae('0x9')](),controller['index']);router['get'](_0xe9ae('0xa'),auth['isAuthenticated'](),controller[_0xe9ae('0xb')]);router[_0xe9ae('0xc')]('/:id/hoppers',auth[_0xe9ae('0x9')](),controller[_0xe9ae('0xd')]);router[_0xe9ae('0xc')]('/:id/hopper_histories',auth[_0xe9ae('0x9')](),controller[_0xe9ae('0xe')]);router[_0xe9ae('0xc')]('/:id/hopper_finals',auth[_0xe9ae('0x9')](),controller['getHopperFinals']);router[_0xe9ae('0xc')](_0xe9ae('0xf'),auth[_0xe9ae('0x9')](),controller[_0xe9ae('0x10')]);router[_0xe9ae('0xc')](_0xe9ae('0x11'),auth[_0xe9ae('0x9')](),controller[_0xe9ae('0x12')]);router['get'](_0xe9ae('0x13'),auth[_0xe9ae('0x9')](),controller['getBlackLists']);router[_0xe9ae('0x14')]('/',auth[_0xe9ae('0x9')](),controller[_0xe9ae('0x15')]);router[_0xe9ae('0x14')](_0xe9ae('0x16'),auth[_0xe9ae('0x9')](),controller[_0xe9ae('0x17')]);router[_0xe9ae('0x14')](_0xe9ae('0x11'),auth['isAuthenticated'](),controller['addLists']);router[_0xe9ae('0x14')]('/:id/blacklists',auth[_0xe9ae('0x9')](),controller[_0xe9ae('0x18')]);router[_0xe9ae('0x19')](_0xe9ae('0xa'),auth['isAuthenticated'](),controller['update']);router['delete'](_0xe9ae('0xa'),auth[_0xe9ae('0x9')](),controller['destroy']);router[_0xe9ae('0x1a')]('/:id/lists',auth[_0xe9ae('0x9')](),controller[_0xe9ae('0x1b')]);router[_0xe9ae('0x1a')]('/:id/blacklists',auth['isAuthenticated'](),controller[_0xe9ae('0x1c')]);module[_0xe9ae('0x1d')]=router; \ No newline at end of file +var _0x27c9=['/:id/hopper_black','getHopperBlacks','/:id/lists','getBlackLists','post','clone','addLists','put','update','delete','removeLists','/:id/blacklists','removeBlackLists','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./campaign.controller','get','index','/:id','isAuthenticated','show','getHoppers','/:id/hopper_histories','getHopperHistories','getHopperFinals'];(function(_0x55a949,_0x43be62){var _0xbd0bff=function(_0x297308){while(--_0x297308){_0x55a949['push'](_0x55a949['shift']());}};_0xbd0bff(++_0x43be62);}(_0x27c9,0x12e));var _0x927c=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x27c9[_0x465028];return _0xb783d4;};'use strict';var multer=require(_0x927c('0x0'));var util=require(_0x927c('0x1'));var path=require('path');var timeout=require(_0x927c('0x2'));var express=require(_0x927c('0x3'));var router=express[_0x927c('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x927c('0x5'));var interaction=require(_0x927c('0x6'));var config=require(_0x927c('0x7'));var controller=require(_0x927c('0x8'));router[_0x927c('0x9')]('/',auth['isAuthenticated'](),controller[_0x927c('0xa')]);router[_0x927c('0x9')](_0x927c('0xb'),auth[_0x927c('0xc')](),controller[_0x927c('0xd')]);router[_0x927c('0x9')]('/:id/hoppers',auth[_0x927c('0xc')](),controller[_0x927c('0xe')]);router[_0x927c('0x9')](_0x927c('0xf'),auth[_0x927c('0xc')](),controller[_0x927c('0x10')]);router[_0x927c('0x9')]('/:id/hopper_finals',auth[_0x927c('0xc')](),controller[_0x927c('0x11')]);router[_0x927c('0x9')](_0x927c('0x12'),auth[_0x927c('0xc')](),controller[_0x927c('0x13')]);router[_0x927c('0x9')](_0x927c('0x14'),auth['isAuthenticated'](),controller['getLists']);router[_0x927c('0x9')]('/:id/blacklists',auth[_0x927c('0xc')](),controller[_0x927c('0x15')]);router[_0x927c('0x16')]('/',auth[_0x927c('0xc')](),controller['create']);router[_0x927c('0x16')]('/:id/clone',auth[_0x927c('0xc')](),controller[_0x927c('0x17')]);router[_0x927c('0x16')]('/:id/lists',auth[_0x927c('0xc')](),controller[_0x927c('0x18')]);router['post']('/:id/blacklists',auth[_0x927c('0xc')](),controller['addBlackLists']);router[_0x927c('0x19')](_0x927c('0xb'),auth[_0x927c('0xc')](),controller[_0x927c('0x1a')]);router[_0x927c('0x1b')]('/:id',auth[_0x927c('0xc')](),controller['destroy']);router['delete'](_0x927c('0x14'),auth[_0x927c('0xc')](),controller[_0x927c('0x1c')]);router[_0x927c('0x1b')](_0x927c('0x1d'),auth[_0x927c('0xc')](),controller[_0x927c('0x1e')]);module[_0x927c('0x1f')]=router; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.attributes.js b/server/api/cannedAnswer/cannedAnswer.attributes.js index 485b78e..4f87492 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 _0xe94f=['key','sequelize','exports','STRING','VIRTUAL'];(function(_0x2b9075,_0x25b39c){var _0x256ac2=function(_0x388e28){while(--_0x388e28){_0x2b9075['push'](_0x2b9075['shift']());}};_0x256ac2(++_0x25b39c);}(_0xe94f,0x178));var _0xfe94=function(_0x51e79c,_0x51485e){_0x51e79c=_0x51e79c-0x0;var _0x2467be=_0xe94f[_0x51e79c];return _0x2467be;};'use strict';var Sequelize=require(_0xfe94('0x0'));module[_0xfe94('0x1')]={'key':{'type':Sequelize[_0xfe94('0x2')],'allowNull':![]},'value':{'type':Sequelize['TEXT'],'allowNull':![]},'description':{'type':Sequelize[_0xfe94('0x2')]},'name':{'type':Sequelize[_0xfe94('0x3')],'get':function(){return this['getDataValue'](_0xfe94('0x4'));}}}; \ No newline at end of file +var _0x0c42=['getDataValue','key','sequelize','STRING','VIRTUAL'];(function(_0x1f0559,_0x5257d5){var _0x1edf81=function(_0x1d076d){while(--_0x1d076d){_0x1f0559['push'](_0x1f0559['shift']());}};_0x1edf81(++_0x5257d5);}(_0x0c42,0x179));var _0x20c4=function(_0x5906f1,_0x32f216){_0x5906f1=_0x5906f1-0x0;var _0x3552a8=_0x0c42[_0x5906f1];return _0x3552a8;};'use strict';var Sequelize=require(_0x20c4('0x0'));module['exports']={'key':{'type':Sequelize[_0x20c4('0x1')],'allowNull':![]},'value':{'type':Sequelize['TEXT'],'allowNull':![]},'description':{'type':Sequelize[_0x20c4('0x1')]},'name':{'type':Sequelize[_0x20c4('0x2')],'get':function(){return this[_0x20c4('0x3')](_0x20c4('0x4'));}}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index 1567ddc..393c727 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 _0x29dd=['../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','get','stack','name','index','map','CannedAnswer','rawAttributes','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filter','merge','where','options','includeAll','findAll','rows','catch','params','include','find','body','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','The\x20inserted\x20key\x20already\x20exists.','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','CannedAnswers','userProfileId','error','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x29dd,0x13d));var _0xd29d=function(_0x2bea1d,_0xc4d88a){_0x2bea1d=_0x2bea1d-0x0;var _0x22cee5=_0x29dd[_0x2bea1d];return _0x22cee5;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd29d('0x0'));var zipdir=require(_0xd29d('0x1'));var jsonpatch=require(_0xd29d('0x2'));var rp=require(_0xd29d('0x3'));var moment=require('moment');var BPromise=require(_0xd29d('0x4'));var Mustache=require(_0xd29d('0x5'));var util=require(_0xd29d('0x6'));var path=require(_0xd29d('0x7'));var sox=require(_0xd29d('0x8'));var csv=require(_0xd29d('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd29d('0xa'));var _=require(_0xd29d('0xb'));var squel=require(_0xd29d('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xd29d('0xd'));var toCsv=require(_0xd29d('0x9'));var querystring=require(_0xd29d('0xe'));var Papa=require(_0xd29d('0xf'));var Redis=require(_0xd29d('0x10'));var authService=require(_0xd29d('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xd29d('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xd29d('0x13'));var utils=require(_0xd29d('0x14'));var config=require(_0xd29d('0x15'));var licenseUtil=require(_0xd29d('0x16'));var db=require(_0xd29d('0x17'))['db'];function respondWithStatusCode(_0x5b77cc,_0x212076){_0x212076=_0x212076||0xcc;return function(_0x1c41c9){if(_0x1c41c9){return _0x5b77cc['sendStatus'](_0x212076);}return _0x5b77cc[_0xd29d('0x18')](_0x212076)[_0xd29d('0x19')]();};}function respondWithResult(_0xbf4306,_0x3ae90f){_0x3ae90f=_0x3ae90f||0xc8;return function(_0x5b3727){if(_0x5b3727){return _0xbf4306[_0xd29d('0x18')](_0x3ae90f)[_0xd29d('0x1a')](_0x5b3727);}};}function respondWithFilteredResult(_0x3ddb24,_0x4e9ae1){return function(_0x1f96fb){if(_0x1f96fb){var _0x12855e=typeof _0x4e9ae1[_0xd29d('0x1b')]===_0xd29d('0x1c')&&typeof _0x4e9ae1[_0xd29d('0x1d')]===_0xd29d('0x1c');var _0x587c97=_0x1f96fb[_0xd29d('0x1e')];var _0x1d90ee=_0x12855e?0x0:_0x4e9ae1[_0xd29d('0x1b')];var _0x2e7897=_0x12855e?_0x1f96fb[_0xd29d('0x1e')]:_0x4e9ae1[_0xd29d('0x1b')]+_0x4e9ae1['limit'];var _0x30bdd5;if(_0x2e7897>=_0x587c97){_0x2e7897=_0x587c97;_0x30bdd5=0xc8;}else{_0x30bdd5=0xce;}_0x3ddb24[_0xd29d('0x18')](_0x30bdd5);return _0x3ddb24[_0xd29d('0x1f')](_0xd29d('0x20'),_0x1d90ee+'-'+_0x2e7897+'/'+_0x587c97)[_0xd29d('0x1a')](_0x1f96fb);}return null;};}function patchUpdates(_0x4be369){return function(_0x4558ca){try{jsonpatch[_0xd29d('0x21')](_0x4558ca,_0x4be369,!![]);}catch(_0x4a9541){return BPromise[_0xd29d('0x22')](_0x4a9541);}return _0x4558ca['save']();};}function saveUpdates(_0x1645ee,_0x5c3507){return function(_0x23d78c){if(_0x23d78c){return _0x23d78c[_0xd29d('0x23')](_0x1645ee)[_0xd29d('0x24')](function(_0x1cd80b){return _0x1cd80b;});}return null;};}function removeEntity(_0x352fab,_0x682fd2){return function(_0x367767){if(_0x367767){return _0x367767[_0xd29d('0x25')]()[_0xd29d('0x24')](function(){var _0x4a755b=_0x367767[_0xd29d('0x26')]({'plain':!![]});var _0x2bef3f='CannedAnswers';return db['UserProfileResource'][_0xd29d('0x25')]({'where':{'type':_0x2bef3f,'resourceId':_0x4a755b['id']}})[_0xd29d('0x24')](function(){return _0x367767;});})[_0xd29d('0x24')](function(){_0x352fab[_0xd29d('0x18')](0xcc)[_0xd29d('0x19')]();});}};}function handleEntityNotFound(_0x2ee346,_0x59e7d6){return function(_0x1e4bba){if(!_0x1e4bba){_0x2ee346['sendStatus'](0x194);}return _0x1e4bba;};}function handleError(_0x242517,_0x129bdf){_0x129bdf=_0x129bdf||0x1f4;return function(_0x2f6d82){logger['error'](_0x2f6d82[_0xd29d('0x27')]);if(_0x2f6d82[_0xd29d('0x28')]){delete _0x2f6d82['name'];}_0x242517[_0xd29d('0x18')](_0x129bdf)['send'](_0x2f6d82);};}exports[_0xd29d('0x29')]=function(_0x52421f,_0x41f563){var _0x128d1c={},_0x194fca={},_0x3ea0a8={'count':0x0,'rows':[]};var _0x1ec288=_[_0xd29d('0x2a')](db[_0xd29d('0x2b')][_0xd29d('0x2c')],function(_0x2ca882){return{'name':_0x2ca882['fieldName'],'type':_0x2ca882[_0xd29d('0x2d')]['key']};});_0x194fca[_0xd29d('0x2e')]=_['map'](_0x1ec288,'name');_0x194fca[_0xd29d('0x2f')]=_[_0xd29d('0x30')](_0x52421f['query']);_0x194fca[_0xd29d('0x31')]=_[_0xd29d('0x32')](_0x194fca[_0xd29d('0x2e')],_0x194fca[_0xd29d('0x2f')]);_0x128d1c['attributes']=_[_0xd29d('0x32')](_0x194fca[_0xd29d('0x2e')],qs[_0xd29d('0x33')](_0x52421f[_0xd29d('0x2f')][_0xd29d('0x33')]));_0x128d1c['attributes']=_0x128d1c[_0xd29d('0x34')][_0xd29d('0x35')]?_0x128d1c[_0xd29d('0x34')]:_0x194fca['model'];if(!_0x52421f['query'][_0xd29d('0x36')](_0xd29d('0x37'))){_0x128d1c[_0xd29d('0x1d')]=qs[_0xd29d('0x1d')](_0x52421f['query'][_0xd29d('0x1d')]);_0x128d1c[_0xd29d('0x1b')]=qs[_0xd29d('0x1b')](_0x52421f[_0xd29d('0x2f')][_0xd29d('0x1b')]);}_0x128d1c[_0xd29d('0x38')]=qs[_0xd29d('0x39')](_0x52421f[_0xd29d('0x2f')][_0xd29d('0x39')]);_0x128d1c['where']=qs['filters'](_['pick'](_0x52421f[_0xd29d('0x2f')],_0x194fca[_0xd29d('0x31')]),_0x1ec288);if(_0x52421f[_0xd29d('0x2f')][_0xd29d('0x3a')]){_0x128d1c['where']=_[_0xd29d('0x3b')](_0x128d1c[_0xd29d('0x3c')],{'$or':[{'key':{'$like':'%'+_0x52421f[_0xd29d('0x2f')]['filter']+'%'}},{'value':{'$like':'%'+_0x52421f['query'][_0xd29d('0x3a')]+'%'}}]});}_0x128d1c=_[_0xd29d('0x3b')]({},_0x128d1c,_0x52421f[_0xd29d('0x3d')]);var _0x16469e={'where':_0x128d1c[_0xd29d('0x3c')]};return db['CannedAnswer'][_0xd29d('0x1e')](_0x16469e)[_0xd29d('0x24')](function(_0x2cef3d){_0x3ea0a8[_0xd29d('0x1e')]=_0x2cef3d;if(_0x52421f['query'][_0xd29d('0x3e')]){_0x128d1c['include']=[{'all':!![]}];}return db[_0xd29d('0x2b')][_0xd29d('0x3f')](_0x128d1c);})[_0xd29d('0x24')](function(_0x307fd9){_0x3ea0a8[_0xd29d('0x40')]=_0x307fd9;return _0x3ea0a8;})[_0xd29d('0x24')](respondWithFilteredResult(_0x41f563,_0x128d1c))[_0xd29d('0x41')](handleError(_0x41f563,null));};exports['show']=function(_0x417e7f,_0x14b636){var _0x4ae26d={'raw':!![],'where':{'id':_0x417e7f[_0xd29d('0x42')]['id']}},_0x2e3e4a={};_0x2e3e4a[_0xd29d('0x2e')]=_[_0xd29d('0x30')](db[_0xd29d('0x2b')][_0xd29d('0x2c')]);_0x2e3e4a['query']=_['keys'](_0x417e7f[_0xd29d('0x2f')]);_0x2e3e4a['filters']=_[_0xd29d('0x32')](_0x2e3e4a[_0xd29d('0x2e')],_0x2e3e4a[_0xd29d('0x2f')]);_0x4ae26d['attributes']=_[_0xd29d('0x32')](_0x2e3e4a[_0xd29d('0x2e')],qs['fields'](_0x417e7f[_0xd29d('0x2f')][_0xd29d('0x33')]));_0x4ae26d[_0xd29d('0x34')]=_0x4ae26d[_0xd29d('0x34')]['length']?_0x4ae26d['attributes']:_0x2e3e4a[_0xd29d('0x2e')];if(_0x417e7f[_0xd29d('0x2f')][_0xd29d('0x3e')]){_0x4ae26d[_0xd29d('0x43')]=[{'all':!![]}];}_0x4ae26d=_[_0xd29d('0x3b')]({},_0x4ae26d,_0x417e7f[_0xd29d('0x3d')]);return db[_0xd29d('0x2b')][_0xd29d('0x44')](_0x4ae26d)['then'](handleEntityNotFound(_0x14b636,null))[_0xd29d('0x24')](respondWithResult(_0x14b636,null))['catch'](handleError(_0x14b636,null));};exports[_0xd29d('0x23')]=function(_0x379837,_0x1a533d){if(_0x379837['body']['id']){delete _0x379837[_0xd29d('0x45')]['id'];}return db[_0xd29d('0x2b')][_0xd29d('0x44')]({'where':{'id':_0x379837['params']['id']}})[_0xd29d('0x24')](handleEntityNotFound(_0x1a533d,null))[_0xd29d('0x24')](saveUpdates(_0x379837[_0xd29d('0x45')],null))[_0xd29d('0x24')](respondWithResult(_0x1a533d,null))['catch'](handleError(_0x1a533d,null));};exports['destroy']=function(_0x532817,_0x2999d6){return db[_0xd29d('0x2b')][_0xd29d('0x44')]({'where':{'id':_0x532817[_0xd29d('0x42')]['id']}})[_0xd29d('0x24')](handleEntityNotFound(_0x2999d6,null))[_0xd29d('0x24')](removeEntity(_0x2999d6,null))[_0xd29d('0x41')](handleError(_0x2999d6,null));};exports[_0xd29d('0x46')]=function(_0x4de7f5,_0x4e0465){var _0x386f5d={'key':_0x4de7f5[_0xd29d('0x45')]['key']};if(_0x4de7f5[_0xd29d('0x45')]['MailAccountId']){_0x386f5d[_0xd29d('0x47')]=_0x4de7f5[_0xd29d('0x45')][_0xd29d('0x47')];}else if(_0x4de7f5[_0xd29d('0x45')]['SmsAccountId']){_0x386f5d[_0xd29d('0x48')]=_0x4de7f5['body']['SmsAccountId'];}else if(_0x4de7f5[_0xd29d('0x45')]['OpenchannelAccountId']){_0x386f5d['OpenchannelAccountId']=_0x4de7f5[_0xd29d('0x45')][_0xd29d('0x49')];}else if(_0x4de7f5[_0xd29d('0x45')][_0xd29d('0x4a')]){_0x386f5d[_0xd29d('0x4a')]=_0x4de7f5[_0xd29d('0x45')][_0xd29d('0x4a')];}return db[_0xd29d('0x2b')][_0xd29d('0x44')]({'where':_0x386f5d})[_0xd29d('0x24')](function(_0xa66974){if(_0xa66974){throw new db[(_0xd29d('0x4b'))][(_0xd29d('0x4c'))](_0xd29d('0x4d'));}return db[_0xd29d('0x2b')]['create'](_0x4de7f5[_0xd29d('0x45')]);})['then'](function(_0x46bb3d){var _0x153c11=_0x4de7f5[_0xd29d('0x4e')][_0xd29d('0x26')]({'plain':!![]});if(!_0x153c11)throw new Error(_0xd29d('0x4f'));if(_0x153c11[_0xd29d('0x50')]==='user'){var _0x190b63=_0x46bb3d[_0xd29d('0x26')]({'plain':!![]});return db[_0xd29d('0x51')][_0xd29d('0x44')]({'where':{'name':_0xd29d('0x52'),'userProfileId':_0x153c11[_0xd29d('0x53')]},'raw':!![]})[_0xd29d('0x24')](function(_0x1a50db){if(_0x1a50db&&_0x1a50db['autoAssociation']===0x0){return db['UserProfileResource'][_0xd29d('0x46')]({'name':_0x190b63[_0xd29d('0x28')],'resourceId':_0x190b63['id'],'type':_0x1a50db['name'],'sectionId':_0x1a50db['id']},{})[_0xd29d('0x24')](function(){return _0x46bb3d;});}else{return _0x46bb3d;}})['catch'](function(_0x431120){logger[_0xd29d('0x54')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x431120);throw _0x431120;});}return _0x46bb3d;})[_0xd29d('0x24')](respondWithResult(_0x4e0465,0xc9))['catch'](handleError(_0x4e0465,null));}; \ No newline at end of file +var _0x0ca3=['jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','json','reject','save','update','then','UserProfileResource','error','stack','name','index','CannedAnswer','rawAttributes','type','key','model','map','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','rows','catch','show','params','keys','find','body','destroy','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','ValidationError','The\x20inserted\x20key\x20already\x20exists.','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','CannedAnswers','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','squel'];(function(_0x181e5b,_0x5e7d43){var _0x494c61=function(_0x4d0c0e){while(--_0x4d0c0e){_0x181e5b['push'](_0x181e5b['shift']());}};_0x494c61(++_0x5e7d43);}(_0x0ca3,0x1b5));var _0x30ca=function(_0x5d5bcb,_0x25e2ea){_0x5d5bcb=_0x5d5bcb-0x0;var _0x4ea5eb=_0x0ca3[_0x5d5bcb];return _0x4ea5eb;};'use strict';var emlformat=require(_0x30ca('0x0'));var rimraf=require(_0x30ca('0x1'));var zipdir=require(_0x30ca('0x2'));var jsonpatch=require(_0x30ca('0x3'));var rp=require(_0x30ca('0x4'));var moment=require(_0x30ca('0x5'));var BPromise=require(_0x30ca('0x6'));var Mustache=require(_0x30ca('0x7'));var util=require(_0x30ca('0x8'));var path=require(_0x30ca('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x30ca('0xa'));var fs=require('fs');var fs_extra=require(_0x30ca('0xb'));var _=require('lodash');var squel=require(_0x30ca('0xc'));var crypto=require('crypto');var jsforce=require(_0x30ca('0xd'));var deskjs=require(_0x30ca('0xe'));var toCsv=require(_0x30ca('0xf'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x30ca('0x10'));var authService=require(_0x30ca('0x11'));var qs=require(_0x30ca('0x12'));var as=require(_0x30ca('0x13'));var hardwareService=require(_0x30ca('0x14'));var logger=require(_0x30ca('0x15'))('api');var utils=require(_0x30ca('0x16'));var config=require(_0x30ca('0x17'));var licenseUtil=require(_0x30ca('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x45763b,_0x55afaf){_0x55afaf=_0x55afaf||0xcc;return function(_0x58dbd2){if(_0x58dbd2){return _0x45763b[_0x30ca('0x19')](_0x55afaf);}return _0x45763b['status'](_0x55afaf)[_0x30ca('0x1a')]();};}function respondWithResult(_0x429af7,_0x3b7737){_0x3b7737=_0x3b7737||0xc8;return function(_0x370815){if(_0x370815){return _0x429af7[_0x30ca('0x1b')](_0x3b7737)['json'](_0x370815);}};}function respondWithFilteredResult(_0x198664,_0x10f3b1){return function(_0x3a085b){if(_0x3a085b){var _0x155584=typeof _0x10f3b1[_0x30ca('0x1c')]===_0x30ca('0x1d')&&typeof _0x10f3b1[_0x30ca('0x1e')]===_0x30ca('0x1d');var _0x37f0e7=_0x3a085b['count'];var _0x6da53c=_0x155584?0x0:_0x10f3b1[_0x30ca('0x1c')];var _0x5258ce=_0x155584?_0x3a085b[_0x30ca('0x1f')]:_0x10f3b1[_0x30ca('0x1c')]+_0x10f3b1[_0x30ca('0x1e')];var _0x4fc776;if(_0x5258ce>=_0x37f0e7){_0x5258ce=_0x37f0e7;_0x4fc776=0xc8;}else{_0x4fc776=0xce;}_0x198664[_0x30ca('0x1b')](_0x4fc776);return _0x198664[_0x30ca('0x20')](_0x30ca('0x21'),_0x6da53c+'-'+_0x5258ce+'/'+_0x37f0e7)[_0x30ca('0x22')](_0x3a085b);}return null;};}function patchUpdates(_0x5583ee){return function(_0x536388){try{jsonpatch['apply'](_0x536388,_0x5583ee,!![]);}catch(_0x44358f){return BPromise[_0x30ca('0x23')](_0x44358f);}return _0x536388[_0x30ca('0x24')]();};}function saveUpdates(_0x51d3c0,_0x2bbfb2){return function(_0x3518f4){if(_0x3518f4){return _0x3518f4[_0x30ca('0x25')](_0x51d3c0)[_0x30ca('0x26')](function(_0x235ebb){return _0x235ebb;});}return null;};}function removeEntity(_0x6ef3d1,_0x30ca64){return function(_0x470523){if(_0x470523){return _0x470523['destroy']()['then'](function(){var _0x28a43e=_0x470523['get']({'plain':!![]});var _0x19199c='CannedAnswers';return db[_0x30ca('0x27')]['destroy']({'where':{'type':_0x19199c,'resourceId':_0x28a43e['id']}})[_0x30ca('0x26')](function(){return _0x470523;});})['then'](function(){_0x6ef3d1['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4550ca,_0x16e838){return function(_0xcfa08b){if(!_0xcfa08b){_0x4550ca['sendStatus'](0x194);}return _0xcfa08b;};}function handleError(_0x519a69,_0x44925d){_0x44925d=_0x44925d||0x1f4;return function(_0x4b6717){logger[_0x30ca('0x28')](_0x4b6717[_0x30ca('0x29')]);if(_0x4b6717[_0x30ca('0x2a')]){delete _0x4b6717[_0x30ca('0x2a')];}_0x519a69[_0x30ca('0x1b')](_0x44925d)['send'](_0x4b6717);};}exports[_0x30ca('0x2b')]=function(_0x95ac65,_0x48fdd8){var _0x5b54d7={},_0x378398={},_0x31b30d={'count':0x0,'rows':[]};var _0x5a5b34=_['map'](db[_0x30ca('0x2c')][_0x30ca('0x2d')],function(_0x24fb87){return{'name':_0x24fb87['fieldName'],'type':_0x24fb87[_0x30ca('0x2e')][_0x30ca('0x2f')]};});_0x378398[_0x30ca('0x30')]=_[_0x30ca('0x31')](_0x5a5b34,_0x30ca('0x2a'));_0x378398[_0x30ca('0x32')]=_['keys'](_0x95ac65['query']);_0x378398[_0x30ca('0x33')]=_[_0x30ca('0x34')](_0x378398['model'],_0x378398[_0x30ca('0x32')]);_0x5b54d7['attributes']=_[_0x30ca('0x34')](_0x378398[_0x30ca('0x30')],qs[_0x30ca('0x35')](_0x95ac65[_0x30ca('0x32')][_0x30ca('0x35')]));_0x5b54d7[_0x30ca('0x36')]=_0x5b54d7[_0x30ca('0x36')][_0x30ca('0x37')]?_0x5b54d7[_0x30ca('0x36')]:_0x378398['model'];if(!_0x95ac65[_0x30ca('0x32')][_0x30ca('0x38')](_0x30ca('0x39'))){_0x5b54d7[_0x30ca('0x1e')]=qs[_0x30ca('0x1e')](_0x95ac65[_0x30ca('0x32')][_0x30ca('0x1e')]);_0x5b54d7[_0x30ca('0x1c')]=qs[_0x30ca('0x1c')](_0x95ac65[_0x30ca('0x32')][_0x30ca('0x1c')]);}_0x5b54d7[_0x30ca('0x3a')]=qs[_0x30ca('0x3b')](_0x95ac65[_0x30ca('0x32')][_0x30ca('0x3b')]);_0x5b54d7[_0x30ca('0x3c')]=qs['filters'](_[_0x30ca('0x3d')](_0x95ac65[_0x30ca('0x32')],_0x378398[_0x30ca('0x33')]),_0x5a5b34);if(_0x95ac65['query'][_0x30ca('0x3e')]){_0x5b54d7[_0x30ca('0x3c')]=_[_0x30ca('0x3f')](_0x5b54d7[_0x30ca('0x3c')],{'$or':[{'key':{'$like':'%'+_0x95ac65[_0x30ca('0x32')][_0x30ca('0x3e')]+'%'}},{'value':{'$like':'%'+_0x95ac65[_0x30ca('0x32')]['filter']+'%'}}]});}_0x5b54d7=_[_0x30ca('0x3f')]({},_0x5b54d7,_0x95ac65[_0x30ca('0x40')]);var _0x1408cc={'where':_0x5b54d7[_0x30ca('0x3c')]};return db['CannedAnswer'][_0x30ca('0x1f')](_0x1408cc)[_0x30ca('0x26')](function(_0x1122d6){_0x31b30d[_0x30ca('0x1f')]=_0x1122d6;if(_0x95ac65[_0x30ca('0x32')][_0x30ca('0x41')]){_0x5b54d7[_0x30ca('0x42')]=[{'all':!![]}];}return db['CannedAnswer']['findAll'](_0x5b54d7);})['then'](function(_0x50943b){_0x31b30d[_0x30ca('0x43')]=_0x50943b;return _0x31b30d;})[_0x30ca('0x26')](respondWithFilteredResult(_0x48fdd8,_0x5b54d7))[_0x30ca('0x44')](handleError(_0x48fdd8,null));};exports[_0x30ca('0x45')]=function(_0x370385,_0x2724f5){var _0x29c72b={'raw':!![],'where':{'id':_0x370385[_0x30ca('0x46')]['id']}},_0x373fb3={};_0x373fb3[_0x30ca('0x30')]=_[_0x30ca('0x47')](db['CannedAnswer'][_0x30ca('0x2d')]);_0x373fb3[_0x30ca('0x32')]=_[_0x30ca('0x47')](_0x370385[_0x30ca('0x32')]);_0x373fb3[_0x30ca('0x33')]=_[_0x30ca('0x34')](_0x373fb3['model'],_0x373fb3[_0x30ca('0x32')]);_0x29c72b['attributes']=_[_0x30ca('0x34')](_0x373fb3['model'],qs[_0x30ca('0x35')](_0x370385[_0x30ca('0x32')][_0x30ca('0x35')]));_0x29c72b['attributes']=_0x29c72b[_0x30ca('0x36')][_0x30ca('0x37')]?_0x29c72b[_0x30ca('0x36')]:_0x373fb3[_0x30ca('0x30')];if(_0x370385[_0x30ca('0x32')][_0x30ca('0x41')]){_0x29c72b[_0x30ca('0x42')]=[{'all':!![]}];}_0x29c72b=_['merge']({},_0x29c72b,_0x370385[_0x30ca('0x40')]);return db[_0x30ca('0x2c')][_0x30ca('0x48')](_0x29c72b)[_0x30ca('0x26')](handleEntityNotFound(_0x2724f5,null))[_0x30ca('0x26')](respondWithResult(_0x2724f5,null))['catch'](handleError(_0x2724f5,null));};exports[_0x30ca('0x25')]=function(_0x233347,_0x4cedda){if(_0x233347[_0x30ca('0x49')]['id']){delete _0x233347[_0x30ca('0x49')]['id'];}return db[_0x30ca('0x2c')][_0x30ca('0x48')]({'where':{'id':_0x233347[_0x30ca('0x46')]['id']}})[_0x30ca('0x26')](handleEntityNotFound(_0x4cedda,null))['then'](saveUpdates(_0x233347[_0x30ca('0x49')],null))[_0x30ca('0x26')](respondWithResult(_0x4cedda,null))['catch'](handleError(_0x4cedda,null));};exports[_0x30ca('0x4a')]=function(_0xc34702,_0x562e5d){return db[_0x30ca('0x2c')]['find']({'where':{'id':_0xc34702[_0x30ca('0x46')]['id']}})[_0x30ca('0x26')](handleEntityNotFound(_0x562e5d,null))['then'](removeEntity(_0x562e5d,null))[_0x30ca('0x44')](handleError(_0x562e5d,null));};exports[_0x30ca('0x4b')]=function(_0xaabf5b,_0x1fa96f){var _0x21332d={'key':_0xaabf5b[_0x30ca('0x49')][_0x30ca('0x2f')]};if(_0xaabf5b['body'][_0x30ca('0x4c')]){_0x21332d[_0x30ca('0x4c')]=_0xaabf5b['body'][_0x30ca('0x4c')];}else if(_0xaabf5b[_0x30ca('0x49')][_0x30ca('0x4d')]){_0x21332d[_0x30ca('0x4d')]=_0xaabf5b[_0x30ca('0x49')][_0x30ca('0x4d')];}else if(_0xaabf5b[_0x30ca('0x49')][_0x30ca('0x4e')]){_0x21332d[_0x30ca('0x4e')]=_0xaabf5b[_0x30ca('0x49')][_0x30ca('0x4e')];}else if(_0xaabf5b[_0x30ca('0x49')][_0x30ca('0x4f')]){_0x21332d['ChatWebsiteId']=_0xaabf5b[_0x30ca('0x49')][_0x30ca('0x4f')];}return db[_0x30ca('0x2c')][_0x30ca('0x48')]({'where':_0x21332d})['then'](function(_0x5f14be){if(_0x5f14be){throw new db['Sequelize'][(_0x30ca('0x50'))](_0x30ca('0x51'));}return db[_0x30ca('0x2c')][_0x30ca('0x4b')](_0xaabf5b[_0x30ca('0x49')]);})[_0x30ca('0x26')](function(_0x244435){var _0x2eb3e8=_0xaabf5b[_0x30ca('0x52')][_0x30ca('0x53')]({'plain':!![]});if(!_0x2eb3e8)throw new Error(_0x30ca('0x54'));if(_0x2eb3e8['role']===_0x30ca('0x52')){var _0x18e889=_0x244435['get']({'plain':!![]});return db[_0x30ca('0x55')]['find']({'where':{'name':_0x30ca('0x56'),'userProfileId':_0x2eb3e8[_0x30ca('0x57')]},'raw':!![]})[_0x30ca('0x26')](function(_0x47a210){if(_0x47a210&&_0x47a210[_0x30ca('0x58')]===0x0){return db[_0x30ca('0x27')]['create']({'name':_0x18e889[_0x30ca('0x2a')],'resourceId':_0x18e889['id'],'type':_0x47a210[_0x30ca('0x2a')],'sectionId':_0x47a210['id']},{})[_0x30ca('0x26')](function(){return _0x244435;});}else{return _0x244435;}})[_0x30ca('0x44')](function(_0x50ea2c){logger['error'](_0x30ca('0x59'),_0x50ea2c);throw _0x50ea2c;});}return _0x244435;})['then'](respondWithResult(_0x1fa96f,0xc9))[_0x30ca('0x44')](handleError(_0x1fa96f,null));}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.model.js b/server/api/cannedAnswer/cannedAnswer.model.js index fc7cbae..c90cb26 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 _0xdc78=['moment','request-promise','path','../../config/environment','./cannedAnswer.attributes','define','CannedAnswer','tools_canned_answers','utf8mb4_unicode_ci','lodash','../../config/logger','api'];(function(_0x3761c6,_0x2a5f2f){var _0x16ec0b=function(_0x1c04a3){while(--_0x1c04a3){_0x3761c6['push'](_0x3761c6['shift']());}};_0x16ec0b(++_0x2a5f2f);}(_0xdc78,0x14d));var _0x8dc7=function(_0x5d860f,_0x467498){_0x5d860f=_0x5d860f-0x0;var _0x236490=_0xdc78[_0x5d860f];return _0x236490;};'use strict';var _=require(_0x8dc7('0x0'));var util=require('util');var logger=require(_0x8dc7('0x1'))(_0x8dc7('0x2'));var moment=require(_0x8dc7('0x3'));var BPromise=require('bluebird');var rp=require(_0x8dc7('0x4'));var fs=require('fs');var path=require(_0x8dc7('0x5'));var rimraf=require('rimraf');var config=require(_0x8dc7('0x6'));var attributes=require(_0x8dc7('0x7'));module['exports']=function(_0x44088c,_0x3ad5db){return _0x44088c[_0x8dc7('0x8')](_0x8dc7('0x9'),attributes,{'tableName':_0x8dc7('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x8dc7('0xb')});}; \ No newline at end of file +var _0x92db=['../../config/environment','./cannedAnswer.attributes','exports','define','CannedAnswer','tools_canned_answers','utf8mb4','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x30033a,_0x5ce4a6){var _0x5e3518=function(_0x11494a){while(--_0x11494a){_0x30033a['push'](_0x30033a['shift']());}};_0x5e3518(++_0x5ce4a6);}(_0x92db,0x111));var _0xb92d=function(_0x59f89a,_0x22bc8b){_0x59f89a=_0x59f89a-0x0;var _0x2783d2=_0x92db[_0x59f89a];return _0x2783d2;};'use strict';var _=require('lodash');var util=require(_0xb92d('0x0'));var logger=require(_0xb92d('0x1'))(_0xb92d('0x2'));var moment=require(_0xb92d('0x3'));var BPromise=require(_0xb92d('0x4'));var rp=require(_0xb92d('0x5'));var fs=require('fs');var path=require(_0xb92d('0x6'));var rimraf=require('rimraf');var config=require(_0xb92d('0x7'));var attributes=require(_0xb92d('0x8'));module[_0xb92d('0x9')]=function(_0x36c463,_0x534688){return _0x36c463[_0xb92d('0xa')](_0xb92d('0xb'),attributes,{'tableName':_0xb92d('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xb92d('0xd'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.rpc.js b/server/api/cannedAnswer/cannedAnswer.rpc.js index 4abe925..daf79eb 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(_0x46cece,_0x1729fd){var _0x382eea=function(_0x251d3b){while(--_0x251d3b){_0x46cece['push'](_0x46cece['shift']());}};_0x382eea(++_0x1729fd);}(_0xa9e0,0x123));var _0x0a9e=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0xa9e0[_0x46aff0];return _0x9d78cf;};'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(_0x557789,_0xce2491){var _0x164126=function(_0x2d8dfb){while(--_0x2d8dfb){_0x557789['push'](_0x557789['shift']());}};_0x164126(++_0xce2491);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3e112d,_0x2bb132){_0x3e112d=_0x3e112d-0x0;var _0x531c31=_0xa9e0[_0x3e112d];return _0x531c31;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file diff --git a/server/api/cannedAnswer/index.js b/server/api/cannedAnswer/index.js index a4f7334..c9deef4 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 _0xe488=['./cannedAnswer.controller','get','isAuthenticated','index','/:id','post','create','put','update','delete','destroy','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x3d3d96,_0x28998e){var _0x2e479a=function(_0x1349ba){while(--_0x1349ba){_0x3d3d96['push'](_0x3d3d96['shift']());}};_0x2e479a(++_0x28998e);}(_0xe488,0x19a));var _0x8e48=function(_0x43aee5,_0x11268b){_0x43aee5=_0x43aee5-0x0;var _0x76d1d0=_0xe488[_0x43aee5];return _0x76d1d0;};'use strict';var multer=require(_0x8e48('0x0'));var util=require(_0x8e48('0x1'));var path=require(_0x8e48('0x2'));var timeout=require('connect-timeout');var express=require(_0x8e48('0x3'));var router=express[_0x8e48('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x8e48('0x5'));var interaction=require(_0x8e48('0x6'));var config=require(_0x8e48('0x7'));var controller=require(_0x8e48('0x8'));router[_0x8e48('0x9')]('/',auth[_0x8e48('0xa')](),controller[_0x8e48('0xb')]);router[_0x8e48('0x9')](_0x8e48('0xc'),auth[_0x8e48('0xa')](),controller['show']);router[_0x8e48('0xd')]('/',auth[_0x8e48('0xa')](),controller[_0x8e48('0xe')]);router[_0x8e48('0xf')](_0x8e48('0xc'),auth['isAuthenticated'](),controller[_0x8e48('0x10')]);router[_0x8e48('0x11')](_0x8e48('0xc'),auth[_0x8e48('0xa')](),controller[_0x8e48('0x12')]);module['exports']=router; \ No newline at end of file +var _0x0e57=['create','update','delete','destroy','exports','multer','connect-timeout','express','Router','fs-extra','../../config/environment','./cannedAnswer.controller','get','isAuthenticated','index','/:id','show','post'];(function(_0x47a7d0,_0x4e182d){var _0xb9bd08=function(_0x588ee2){while(--_0x588ee2){_0x47a7d0['push'](_0x47a7d0['shift']());}};_0xb9bd08(++_0x4e182d);}(_0x0e57,0x1eb));var _0x70e5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0e57[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x70e5('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x70e5('0x1'));var express=require(_0x70e5('0x2'));var router=express[_0x70e5('0x3')]();var fs_extra=require(_0x70e5('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x70e5('0x5'));var controller=require(_0x70e5('0x6'));router[_0x70e5('0x7')]('/',auth[_0x70e5('0x8')](),controller[_0x70e5('0x9')]);router[_0x70e5('0x7')](_0x70e5('0xa'),auth['isAuthenticated'](),controller[_0x70e5('0xb')]);router[_0x70e5('0xc')]('/',auth['isAuthenticated'](),controller[_0x70e5('0xd')]);router['put'](_0x70e5('0xa'),auth[_0x70e5('0x8')](),controller[_0x70e5('0xe')]);router[_0x70e5('0xf')](_0x70e5('0xa'),auth[_0x70e5('0x8')](),controller[_0x70e5('0x10')]);module[_0x70e5('0x11')]=router; \ No newline at end of file diff --git a/server/api/cdr/cdr.attributes.js b/server/api/cdr/cdr.attributes.js index 07674ba..4dcf6cd 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 _0x6584=['INTEGER','sequelize','exports','DATE','1970-01-01\x2000:00:01','STRING'];(function(_0x318abe,_0x48c571){var _0x28f734=function(_0x27bac8){while(--_0x27bac8){_0x318abe['push'](_0x318abe['shift']());}};_0x28f734(++_0x48c571);}(_0x6584,0x175));var _0x4658=function(_0x32b993,_0x1c5989){_0x32b993=_0x32b993-0x0;var _0x482780=_0x6584[_0x32b993];return _0x482780;};'use strict';var Sequelize=require(_0x4658('0x0'));module[_0x4658('0x1')]={'calldate':{'type':Sequelize[_0x4658('0x2')],'allowNull':![],'defaultValue':_0x4658('0x3')},'clid':{'type':Sequelize['STRING']},'src':{'type':Sequelize[_0x4658('0x4')]},'dst':{'type':Sequelize[_0x4658('0x4')]},'dcontext':{'type':Sequelize[_0x4658('0x4')]},'channel':{'type':Sequelize['STRING']},'dstchannel':{'type':Sequelize['STRING']},'lastapp':{'type':Sequelize[_0x4658('0x4')]},'lastdata':{'type':Sequelize[_0x4658('0x4')]},'duration':{'type':Sequelize[_0x4658('0x5')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x4658('0x5')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x4658('0x4')]},'amaflags':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0x4658('0x4')]},'userfield':{'type':Sequelize[_0x4658('0x4')]},'uniqueid':{'type':Sequelize[_0x4658('0x4')]},'linkedid':{'type':Sequelize['STRING']},'sequence':{'type':Sequelize[_0x4658('0x4')]},'peeraccount':{'type':Sequelize[_0x4658('0x4')]},'type':{'type':Sequelize['STRING']},'tag':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x92d7=['DATE','1970-01-01\x2000:00:01','STRING','INTEGER','sequelize'];(function(_0x44bcb0,_0x235aa9){var _0xfaf881=function(_0x25d81d){while(--_0x25d81d){_0x44bcb0['push'](_0x44bcb0['shift']());}};_0xfaf881(++_0x235aa9);}(_0x92d7,0x17b));var _0x792d=function(_0xc586d3,_0x516ed4){_0xc586d3=_0xc586d3-0x0;var _0xb12da7=_0x92d7[_0xc586d3];return _0xb12da7;};'use strict';var Sequelize=require(_0x792d('0x0'));module['exports']={'calldate':{'type':Sequelize[_0x792d('0x1')],'allowNull':![],'defaultValue':_0x792d('0x2')},'clid':{'type':Sequelize[_0x792d('0x3')]},'src':{'type':Sequelize[_0x792d('0x3')]},'dst':{'type':Sequelize[_0x792d('0x3')]},'dcontext':{'type':Sequelize[_0x792d('0x3')]},'channel':{'type':Sequelize[_0x792d('0x3')]},'dstchannel':{'type':Sequelize[_0x792d('0x3')]},'lastapp':{'type':Sequelize[_0x792d('0x3')]},'lastdata':{'type':Sequelize[_0x792d('0x3')]},'duration':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x792d('0x4')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x792d('0x3')]},'amaflags':{'type':Sequelize[_0x792d('0x4')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0x792d('0x3')]},'userfield':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x792d('0x3')]},'linkedid':{'type':Sequelize[_0x792d('0x3')]},'sequence':{'type':Sequelize[_0x792d('0x3')]},'peeraccount':{'type':Sequelize[_0x792d('0x3')]},'type':{'type':Sequelize[_0x792d('0x3')]},'tag':{'type':Sequelize[_0x792d('0x3')]}}; \ No newline at end of file diff --git a/server/api/cdr/cdr.controller.js b/server/api/cdr/cdr.controller.js index ee60b21..7d21124 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 _0xf006=['fieldName','keys','filters','intersection','model','query','attributes','fields','hasOwnProperty','nolimit','order','sort','where','type','VIRTUAL','merge','includeAll','include','findAll','rows','catch','show','params','length','options','find','create','body','destroy','describe','zip-dir','fast-json-patch','moment','mustache','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','count','set','Content-Range','reject','save','update','then','error','stack','name','send','index','map','Cdr','rawAttributes'];(function(_0x5341ff,_0x1de6df){var _0x53be58=function(_0x4da0da){while(--_0x4da0da){_0x5341ff['push'](_0x5341ff['shift']());}};_0x53be58(++_0x1de6df);}(_0xf006,0x146));var _0x6f00=function(_0x50723d,_0x1f48eb){_0x50723d=_0x50723d-0x0;var _0x3a1534=_0xf006[_0x50723d];return _0x3a1534;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x6f00('0x0'));var jsonpatch=require(_0x6f00('0x1'));var rp=require('request-promise');var moment=require(_0x6f00('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x6f00('0x3'));var util=require('util');var path=require('path');var sox=require(_0x6f00('0x4'));var csv=require(_0x6f00('0x5'));var ejs=require(_0x6f00('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6f00('0x7'));var squel=require('squel');var crypto=require(_0x6f00('0x8'));var jsforce=require(_0x6f00('0x9'));var deskjs=require(_0x6f00('0xa'));var toCsv=require(_0x6f00('0x5'));var querystring=require(_0x6f00('0xb'));var Papa=require(_0x6f00('0xc'));var Redis=require(_0x6f00('0xd'));var authService=require(_0x6f00('0xe'));var qs=require(_0x6f00('0xf'));var as=require(_0x6f00('0x10'));var hardwareService=require(_0x6f00('0x11'));var logger=require(_0x6f00('0x12'))(_0x6f00('0x13'));var utils=require('../../config/utils');var config=require(_0x6f00('0x14'));var licenseUtil=require(_0x6f00('0x15'));var db=require(_0x6f00('0x16'))['db'];function respondWithStatusCode(_0x36a2ec,_0x289fe9){_0x289fe9=_0x289fe9||0xcc;return function(_0x5e3264){if(_0x5e3264){return _0x36a2ec[_0x6f00('0x17')](_0x289fe9);}return _0x36a2ec['status'](_0x289fe9)[_0x6f00('0x18')]();};}function respondWithResult(_0x5047f5,_0x324e67){_0x324e67=_0x324e67||0xc8;return function(_0x220e68){if(_0x220e68){return _0x5047f5[_0x6f00('0x19')](_0x324e67)[_0x6f00('0x1a')](_0x220e68);}};}function respondWithFilteredResult(_0xa6e7a1,_0x411203){return function(_0x46bc2c){if(_0x46bc2c){var _0x4d8aee=typeof _0x411203[_0x6f00('0x1b')]==='undefined'&&typeof _0x411203[_0x6f00('0x1c')]==='undefined';var _0x534275=_0x46bc2c[_0x6f00('0x1d')];var _0x6cf83f=_0x4d8aee?0x0:_0x411203[_0x6f00('0x1b')];var _0x340f78=_0x4d8aee?_0x46bc2c[_0x6f00('0x1d')]:_0x411203[_0x6f00('0x1b')]+_0x411203[_0x6f00('0x1c')];var _0x295640;if(_0x340f78>=_0x534275){_0x340f78=_0x534275;_0x295640=0xc8;}else{_0x295640=0xce;}_0xa6e7a1[_0x6f00('0x19')](_0x295640);return _0xa6e7a1[_0x6f00('0x1e')](_0x6f00('0x1f'),_0x6cf83f+'-'+_0x340f78+'/'+_0x534275)[_0x6f00('0x1a')](_0x46bc2c);}return null;};}function patchUpdates(_0x4e11de){return function(_0x4f3031){try{jsonpatch['apply'](_0x4f3031,_0x4e11de,!![]);}catch(_0x2a5286){return BPromise[_0x6f00('0x20')](_0x2a5286);}return _0x4f3031[_0x6f00('0x21')]();};}function saveUpdates(_0x57340f,_0xe301e5){return function(_0x9066ff){if(_0x9066ff){return _0x9066ff[_0x6f00('0x22')](_0x57340f)[_0x6f00('0x23')](function(_0x388983){return _0x388983;});}return null;};}function removeEntity(_0x1cbf1c,_0x90d74c){return function(_0x1ea061){if(_0x1ea061){return _0x1ea061['destroy']()[_0x6f00('0x23')](function(){_0x1cbf1c[_0x6f00('0x19')](0xcc)[_0x6f00('0x18')]();});}};}function handleEntityNotFound(_0x4d41ef,_0x37f062){return function(_0x4f7e29){if(!_0x4f7e29){_0x4d41ef[_0x6f00('0x17')](0x194);}return _0x4f7e29;};}function handleError(_0x511293,_0x434735){_0x434735=_0x434735||0x1f4;return function(_0x39375d){logger[_0x6f00('0x24')](_0x39375d[_0x6f00('0x25')]);if(_0x39375d[_0x6f00('0x26')]){delete _0x39375d['name'];}_0x511293[_0x6f00('0x19')](_0x434735)[_0x6f00('0x27')](_0x39375d);};}exports[_0x6f00('0x28')]=function(_0x4366a4,_0x2671fe){var _0x235a86={},_0xff36ce={},_0x451849={'count':0x0,'rows':[]};var _0x22f107=_[_0x6f00('0x29')](db[_0x6f00('0x2a')][_0x6f00('0x2b')],function(_0x29555d){return{'name':_0x29555d[_0x6f00('0x2c')],'type':_0x29555d['type']['key']};});_0xff36ce['model']=_['map'](_0x22f107,'name');_0xff36ce['query']=_[_0x6f00('0x2d')](_0x4366a4['query']);_0xff36ce[_0x6f00('0x2e')]=_[_0x6f00('0x2f')](_0xff36ce[_0x6f00('0x30')],_0xff36ce[_0x6f00('0x31')]);_0x235a86[_0x6f00('0x32')]=_[_0x6f00('0x2f')](_0xff36ce['model'],qs[_0x6f00('0x33')](_0x4366a4[_0x6f00('0x31')][_0x6f00('0x33')]));_0x235a86[_0x6f00('0x32')]=_0x235a86[_0x6f00('0x32')]['length']?_0x235a86['attributes']:_0xff36ce['model'];if(!_0x4366a4[_0x6f00('0x31')][_0x6f00('0x34')](_0x6f00('0x35'))){_0x235a86[_0x6f00('0x1c')]=qs[_0x6f00('0x1c')](_0x4366a4['query'][_0x6f00('0x1c')]);_0x235a86[_0x6f00('0x1b')]=qs[_0x6f00('0x1b')](_0x4366a4[_0x6f00('0x31')][_0x6f00('0x1b')]);}_0x235a86[_0x6f00('0x36')]=qs[_0x6f00('0x37')](_0x4366a4['query'][_0x6f00('0x37')]);_0x235a86[_0x6f00('0x38')]=qs[_0x6f00('0x2e')](_['pick'](_0x4366a4[_0x6f00('0x31')],_0xff36ce[_0x6f00('0x2e')]),_0x22f107);if(_0x4366a4[_0x6f00('0x31')]['filter']){_0x235a86[_0x6f00('0x38')]=_['merge'](_0x235a86[_0x6f00('0x38')],{'$or':_['map'](_0x22f107,function(_0x3dc8e3){if(_0x3dc8e3[_0x6f00('0x39')]!==_0x6f00('0x3a')){var _0x896b3f={};_0x896b3f[_0x3dc8e3['name']]={'$like':'%'+_0x4366a4[_0x6f00('0x31')]['filter']+'%'};return _0x896b3f;}})});}_0x235a86=_[_0x6f00('0x3b')]({},_0x235a86,_0x4366a4['options']);var _0x7785e1={'where':_0x235a86[_0x6f00('0x38')]};return db[_0x6f00('0x2a')][_0x6f00('0x1d')](_0x7785e1)['then'](function(_0x53dc8c){_0x451849[_0x6f00('0x1d')]=_0x53dc8c;if(_0x4366a4['query'][_0x6f00('0x3c')]){_0x235a86[_0x6f00('0x3d')]=[{'all':!![]}];}return db['Cdr'][_0x6f00('0x3e')](_0x235a86);})['then'](function(_0x4cac2c){_0x451849[_0x6f00('0x3f')]=_0x4cac2c;return _0x451849;})[_0x6f00('0x23')](respondWithFilteredResult(_0x2671fe,_0x235a86))[_0x6f00('0x40')](handleError(_0x2671fe,null));};exports[_0x6f00('0x41')]=function(_0x56399a,_0x38ee25){var _0x4523f2={'raw':!![],'where':{'id':_0x56399a[_0x6f00('0x42')]['id']}},_0x2bb5aa={};_0x2bb5aa[_0x6f00('0x30')]=_[_0x6f00('0x2d')](db['Cdr'][_0x6f00('0x2b')]);_0x2bb5aa[_0x6f00('0x31')]=_[_0x6f00('0x2d')](_0x56399a[_0x6f00('0x31')]);_0x2bb5aa[_0x6f00('0x2e')]=_[_0x6f00('0x2f')](_0x2bb5aa['model'],_0x2bb5aa[_0x6f00('0x31')]);_0x4523f2[_0x6f00('0x32')]=_[_0x6f00('0x2f')](_0x2bb5aa['model'],qs[_0x6f00('0x33')](_0x56399a['query'][_0x6f00('0x33')]));_0x4523f2[_0x6f00('0x32')]=_0x4523f2['attributes'][_0x6f00('0x43')]?_0x4523f2['attributes']:_0x2bb5aa[_0x6f00('0x30')];if(_0x56399a[_0x6f00('0x31')][_0x6f00('0x3c')]){_0x4523f2[_0x6f00('0x3d')]=[{'all':!![]}];}_0x4523f2=_['merge']({},_0x4523f2,_0x56399a[_0x6f00('0x44')]);return db['Cdr'][_0x6f00('0x45')](_0x4523f2)['then'](handleEntityNotFound(_0x38ee25,null))[_0x6f00('0x23')](respondWithResult(_0x38ee25,null))[_0x6f00('0x40')](handleError(_0x38ee25,null));};exports[_0x6f00('0x46')]=function(_0x9b003,_0x470ff3){return db[_0x6f00('0x2a')][_0x6f00('0x46')](_0x9b003[_0x6f00('0x47')],{})['then'](respondWithResult(_0x470ff3,0xc9))[_0x6f00('0x40')](handleError(_0x470ff3,null));};exports['update']=function(_0x265666,_0x31fb17){if(_0x265666[_0x6f00('0x47')]['id']){delete _0x265666['body']['id'];}return db['Cdr'][_0x6f00('0x45')]({'where':{'id':_0x265666[_0x6f00('0x42')]['id']}})['then'](handleEntityNotFound(_0x31fb17,null))[_0x6f00('0x23')](saveUpdates(_0x265666['body'],null))[_0x6f00('0x23')](respondWithResult(_0x31fb17,null))['catch'](handleError(_0x31fb17,null));};exports[_0x6f00('0x48')]=function(_0x222b4c,_0x4c6e06){return db['Cdr'][_0x6f00('0x45')]({'where':{'id':_0x222b4c[_0x6f00('0x42')]['id']}})['then'](handleEntityNotFound(_0x4c6e06,null))[_0x6f00('0x23')](removeEntity(_0x4c6e06,null))['catch'](handleError(_0x4c6e06,null));};exports[_0x6f00('0x49')]=function(_0x7f80ed,_0x3100ee){return db[_0x6f00('0x2a')][_0x6f00('0x49')]()[_0x6f00('0x23')](respondWithResult(_0x3100ee,null))[_0x6f00('0x40')](handleError(_0x3100ee,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(_0x1b68e5,_0x3d1a8d){var _0x2f80bb=function(_0x4fa58e){while(--_0x4fa58e){_0x1b68e5['push'](_0x1b68e5['shift']());}};_0x2f80bb(++_0x3d1a8d);}(_0x1af3,0x1ca));var _0x31af=function(_0x176317,_0x4897b3){_0x176317=_0x176317-0x0;var _0xef2759=_0x1af3[_0x176317];return _0xef2759;};'use strict';var emlformat=require(_0x31af('0x0'));var rimraf=require(_0x31af('0x1'));var zipdir=require(_0x31af('0x2'));var jsonpatch=require(_0x31af('0x3'));var rp=require(_0x31af('0x4'));var moment=require(_0x31af('0x5'));var BPromise=require(_0x31af('0x6'));var Mustache=require(_0x31af('0x7'));var util=require(_0x31af('0x8'));var path=require(_0x31af('0x9'));var sox=require('sox');var csv=require(_0x31af('0xa'));var ejs=require(_0x31af('0xb'));var fs=require('fs');var fs_extra=require(_0x31af('0xc'));var _=require(_0x31af('0xd'));var squel=require('squel');var crypto=require(_0x31af('0xe'));var jsforce=require(_0x31af('0xf'));var deskjs=require(_0x31af('0x10'));var toCsv=require('to-csv');var querystring=require(_0x31af('0x11'));var Papa=require(_0x31af('0x12'));var Redis=require(_0x31af('0x13'));var authService=require(_0x31af('0x14'));var qs=require(_0x31af('0x15'));var as=require(_0x31af('0x16'));var hardwareService=require(_0x31af('0x17'));var logger=require(_0x31af('0x18'))('api');var utils=require(_0x31af('0x19'));var config=require(_0x31af('0x1a'));var licenseUtil=require(_0x31af('0x1b'));var db=require(_0x31af('0x1c'))['db'];function respondWithStatusCode(_0x144406,_0x481f20){_0x481f20=_0x481f20||0xcc;return function(_0x358fb4){if(_0x358fb4){return _0x144406[_0x31af('0x1d')](_0x481f20);}return _0x144406['status'](_0x481f20)['end']();};}function respondWithResult(_0x2a4727,_0x46a494){_0x46a494=_0x46a494||0xc8;return function(_0x14c57e){if(_0x14c57e){return _0x2a4727[_0x31af('0x1e')](_0x46a494)[_0x31af('0x1f')](_0x14c57e);}};}function respondWithFilteredResult(_0x1d35fa,_0x369934){return function(_0x37c275){if(_0x37c275){var _0xd431e4=typeof _0x369934[_0x31af('0x20')]===_0x31af('0x21')&&typeof _0x369934['limit']===_0x31af('0x21');var _0xd33b3f=_0x37c275[_0x31af('0x22')];var _0x477ada=_0xd431e4?0x0:_0x369934[_0x31af('0x20')];var _0x30a112=_0xd431e4?_0x37c275[_0x31af('0x22')]:_0x369934[_0x31af('0x20')]+_0x369934[_0x31af('0x23')];var _0x550870;if(_0x30a112>=_0xd33b3f){_0x30a112=_0xd33b3f;_0x550870=0xc8;}else{_0x550870=0xce;}_0x1d35fa[_0x31af('0x1e')](_0x550870);return _0x1d35fa[_0x31af('0x24')](_0x31af('0x25'),_0x477ada+'-'+_0x30a112+'/'+_0xd33b3f)[_0x31af('0x1f')](_0x37c275);}return null;};}function patchUpdates(_0x414ad8){return function(_0x5d96ca){try{jsonpatch[_0x31af('0x26')](_0x5d96ca,_0x414ad8,!![]);}catch(_0x46b03e){return BPromise[_0x31af('0x27')](_0x46b03e);}return _0x5d96ca[_0x31af('0x28')]();};}function saveUpdates(_0x394d13,_0x14c3f9){return function(_0x1ddfba){if(_0x1ddfba){return _0x1ddfba[_0x31af('0x29')](_0x394d13)[_0x31af('0x2a')](function(_0x6634e3){return _0x6634e3;});}return null;};}function removeEntity(_0x40aa32,_0x1a67e3){return function(_0x3a98d3){if(_0x3a98d3){return _0x3a98d3[_0x31af('0x2b')]()[_0x31af('0x2a')](function(){_0x40aa32['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5d3832,_0x20a50c){return function(_0x2b3bad){if(!_0x2b3bad){_0x5d3832['sendStatus'](0x194);}return _0x2b3bad;};}function handleError(_0x4c958,_0x8f9f60){_0x8f9f60=_0x8f9f60||0x1f4;return function(_0x49812a){logger[_0x31af('0x2c')](_0x49812a[_0x31af('0x2d')]);if(_0x49812a['name']){delete _0x49812a[_0x31af('0x2e')];}_0x4c958[_0x31af('0x1e')](_0x8f9f60)[_0x31af('0x2f')](_0x49812a);};}exports[_0x31af('0x30')]=function(_0x3326a7,_0x5a1f41){var _0xb1f5b1={},_0x3eb61f={},_0x1e6df8={'count':0x0,'rows':[]};var _0x1f4eae=_[_0x31af('0x31')](db[_0x31af('0x32')][_0x31af('0x33')],function(_0x231438){return{'name':_0x231438[_0x31af('0x34')],'type':_0x231438[_0x31af('0x35')][_0x31af('0x36')]};});_0x3eb61f[_0x31af('0x37')]=_['map'](_0x1f4eae,_0x31af('0x2e'));_0x3eb61f[_0x31af('0x38')]=_['keys'](_0x3326a7['query']);_0x3eb61f['filters']=_[_0x31af('0x39')](_0x3eb61f['model'],_0x3eb61f[_0x31af('0x38')]);_0xb1f5b1[_0x31af('0x3a')]=_[_0x31af('0x39')](_0x3eb61f[_0x31af('0x37')],qs[_0x31af('0x3b')](_0x3326a7[_0x31af('0x38')]['fields']));_0xb1f5b1[_0x31af('0x3a')]=_0xb1f5b1[_0x31af('0x3a')][_0x31af('0x3c')]?_0xb1f5b1[_0x31af('0x3a')]:_0x3eb61f[_0x31af('0x37')];if(!_0x3326a7[_0x31af('0x38')][_0x31af('0x3d')](_0x31af('0x3e'))){_0xb1f5b1['limit']=qs[_0x31af('0x23')](_0x3326a7['query'][_0x31af('0x23')]);_0xb1f5b1[_0x31af('0x20')]=qs[_0x31af('0x20')](_0x3326a7[_0x31af('0x38')][_0x31af('0x20')]);}_0xb1f5b1['order']=qs['sort'](_0x3326a7['query'][_0x31af('0x3f')]);_0xb1f5b1[_0x31af('0x40')]=qs[_0x31af('0x41')](_[_0x31af('0x42')](_0x3326a7[_0x31af('0x38')],_0x3eb61f[_0x31af('0x41')]),_0x1f4eae);if(_0x3326a7[_0x31af('0x38')][_0x31af('0x43')]){_0xb1f5b1['where']=_[_0x31af('0x44')](_0xb1f5b1[_0x31af('0x40')],{'$or':_[_0x31af('0x31')](_0x1f4eae,function(_0x2a5cde){if(_0x2a5cde[_0x31af('0x35')]!==_0x31af('0x45')){var _0x32d1b9={};_0x32d1b9[_0x2a5cde[_0x31af('0x2e')]]={'$like':'%'+_0x3326a7[_0x31af('0x38')]['filter']+'%'};return _0x32d1b9;}})});}_0xb1f5b1=_[_0x31af('0x44')]({},_0xb1f5b1,_0x3326a7['options']);var _0x447a01={'where':_0xb1f5b1['where']};return db['Cdr'][_0x31af('0x22')](_0x447a01)[_0x31af('0x2a')](function(_0x110f38){_0x1e6df8[_0x31af('0x22')]=_0x110f38;if(_0x3326a7[_0x31af('0x38')][_0x31af('0x46')]){_0xb1f5b1[_0x31af('0x47')]=[{'all':!![]}];}return db['Cdr'][_0x31af('0x48')](_0xb1f5b1);})[_0x31af('0x2a')](function(_0xb53565){_0x1e6df8['rows']=_0xb53565;return _0x1e6df8;})[_0x31af('0x2a')](respondWithFilteredResult(_0x5a1f41,_0xb1f5b1))[_0x31af('0x49')](handleError(_0x5a1f41,null));};exports[_0x31af('0x4a')]=function(_0x23942b,_0x34205a){var _0x57da2c={'raw':!![],'where':{'id':_0x23942b[_0x31af('0x4b')]['id']}},_0x12357c={};_0x12357c[_0x31af('0x37')]=_[_0x31af('0x4c')](db['Cdr'][_0x31af('0x33')]);_0x12357c[_0x31af('0x38')]=_['keys'](_0x23942b[_0x31af('0x38')]);_0x12357c[_0x31af('0x41')]=_[_0x31af('0x39')](_0x12357c[_0x31af('0x37')],_0x12357c[_0x31af('0x38')]);_0x57da2c[_0x31af('0x3a')]=_[_0x31af('0x39')](_0x12357c[_0x31af('0x37')],qs[_0x31af('0x3b')](_0x23942b[_0x31af('0x38')]['fields']));_0x57da2c['attributes']=_0x57da2c[_0x31af('0x3a')]['length']?_0x57da2c[_0x31af('0x3a')]:_0x12357c[_0x31af('0x37')];if(_0x23942b[_0x31af('0x38')]['includeAll']){_0x57da2c['include']=[{'all':!![]}];}_0x57da2c=_[_0x31af('0x44')]({},_0x57da2c,_0x23942b['options']);return db[_0x31af('0x32')][_0x31af('0x4d')](_0x57da2c)[_0x31af('0x2a')](handleEntityNotFound(_0x34205a,null))[_0x31af('0x2a')](respondWithResult(_0x34205a,null))['catch'](handleError(_0x34205a,null));};exports['create']=function(_0x407386,_0x3acff1){return db[_0x31af('0x32')][_0x31af('0x4e')](_0x407386['body'],{})[_0x31af('0x2a')](respondWithResult(_0x3acff1,0xc9))[_0x31af('0x49')](handleError(_0x3acff1,null));};exports[_0x31af('0x29')]=function(_0x4ad7a6,_0x5a1cbe){if(_0x4ad7a6[_0x31af('0x4f')]['id']){delete _0x4ad7a6[_0x31af('0x4f')]['id'];}return db[_0x31af('0x32')][_0x31af('0x4d')]({'where':{'id':_0x4ad7a6[_0x31af('0x4b')]['id']}})[_0x31af('0x2a')](handleEntityNotFound(_0x5a1cbe,null))[_0x31af('0x2a')](saveUpdates(_0x4ad7a6[_0x31af('0x4f')],null))[_0x31af('0x2a')](respondWithResult(_0x5a1cbe,null))[_0x31af('0x49')](handleError(_0x5a1cbe,null));};exports['destroy']=function(_0x441362,_0x29de7e){return db[_0x31af('0x32')][_0x31af('0x4d')]({'where':{'id':_0x441362[_0x31af('0x4b')]['id']}})[_0x31af('0x2a')](handleEntityNotFound(_0x29de7e,null))[_0x31af('0x2a')](removeEntity(_0x29de7e,null))[_0x31af('0x49')](handleError(_0x29de7e,null));};exports[_0x31af('0x50')]=function(_0x25369b,_0x3bfbae){return db[_0x31af('0x32')][_0x31af('0x50')]()[_0x31af('0x2a')](respondWithResult(_0x3bfbae,null))['catch'](handleError(_0x3bfbae,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index fa45554..ea592c8 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 _0x9957=['dst','src','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./cdr.attributes','exports','define','Cdr','accountcode','calldate','disposition'];(function(_0x51ebc4,_0x2a4d0e){var _0x4dba4d=function(_0x54daaa){while(--_0x54daaa){_0x51ebc4['push'](_0x51ebc4['shift']());}};_0x4dba4d(++_0x2a4d0e);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'cdr','paranoid':![],'indexes':[{'name':_0x7995('0xc'),'fields':[_0x7995('0xc')]},{'name':'calldate','fields':[_0x7995('0xd')]},{'name':_0x7995('0xe'),'fields':[_0x7995('0xe')]},{'name':_0x7995('0xf'),'fields':[_0x7995('0xf')]},{'name':_0x7995('0x10'),'fields':[_0x7995('0x10')]},{'name':'uniqueid','fields':[_0x7995('0x11')]}],'timestamps':![]});}; \ No newline at end of file +var _0x7a54=['Cdr','cdr','accountcode','disposition','dst','src','uniqueid','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./cdr.attributes','exports'];(function(_0x15286e,_0x5c7c29){var _0x2fa3c8=function(_0x4e3a32){while(--_0x4e3a32){_0x15286e['push'](_0x15286e['shift']());}};_0x2fa3c8(++_0x5c7c29);}(_0x7a54,0x106));var _0x47a5=function(_0x34913b,_0x5070bf){_0x34913b=_0x34913b-0x0;var _0x4494f1=_0x7a54[_0x34913b];return _0x4494f1;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[{'name':'accountcode','fields':[_0x47a5('0xc')]},{'name':'calldate','fields':['calldate']},{'name':'disposition','fields':[_0x47a5('0xd')]},{'name':_0x47a5('0xe'),'fields':['dst']},{'name':_0x47a5('0xf'),'fields':['src']},{'name':'uniqueid','fields':[_0x47a5('0x10')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/cdr/cdr.rpc.js b/server/api/cdr/cdr.rpc.js index 6487303..7be0bf1 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 _0x62b9=['randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','request','then','info','request\x20sent','debug','Cdr,\x20%s,\x20%s,\x20%s','error','code','message','Cdr,\x20%s,\x20%s','result','catch','util','bluebird'];(function(_0x200e46,_0x5acacf){var _0x18467d=function(_0x30e26a){while(--_0x30e26a){_0x200e46['push'](_0x200e46['shift']());}};_0x18467d(++_0x5acacf);}(_0x62b9,0xa9));var _0x962b=function(_0xf0b34,_0x1dd2da){_0xf0b34=_0xf0b34-0x0;var _0x35e678=_0x62b9[_0xf0b34];return _0x35e678;};'use strict';var _=require('lodash');var util=require(_0x962b('0x0'));var moment=require('moment');var BPromise=require(_0x962b('0x1'));var rs=require(_0x962b('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x962b('0x3'))['db'];var utils=require(_0x962b('0x4'));var logger=require(_0x962b('0x5'))(_0x962b('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x46d6c7,_0x46d1d4,_0xd40ced){return new BPromise(function(_0x458254,_0x5be397){return client[_0x962b('0x7')](_0x46d6c7,_0xd40ced)[_0x962b('0x8')](function(_0x1e8c4e){logger[_0x962b('0x9')]('Cdr,\x20%s,\x20%s',_0x46d1d4,_0x962b('0xa'));logger[_0x962b('0xb')](_0x962b('0xc'),_0x46d1d4,_0x962b('0xa'),JSON['stringify'](_0x1e8c4e));if(_0x1e8c4e[_0x962b('0xd')]){if(_0x1e8c4e[_0x962b('0xd')][_0x962b('0xe')]===0x1f4){logger[_0x962b('0xd')]('Cdr,\x20%s,\x20%s',_0x46d1d4,_0x1e8c4e[_0x962b('0xd')]['message']);return _0x5be397(_0x1e8c4e[_0x962b('0xd')][_0x962b('0xf')]);}logger[_0x962b('0xd')](_0x962b('0x10'),_0x46d1d4,_0x1e8c4e[_0x962b('0xd')][_0x962b('0xf')]);return _0x458254(_0x1e8c4e[_0x962b('0xd')][_0x962b('0xf')]);}else{logger[_0x962b('0x9')]('Cdr,\x20%s,\x20%s',_0x46d1d4,_0x962b('0xa'));_0x458254(_0x1e8c4e[_0x962b('0x11')][_0x962b('0xf')]);}})[_0x962b('0x12')](function(_0x28c7bf){logger[_0x962b('0xd')]('Cdr,\x20%s,\x20%s',_0x46d1d4,_0x28c7bf);_0x5be397(_0x28c7bf);});});} \ No newline at end of file +var _0xfc25=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','Cdr,\x20%s,\x20%s','request\x20sent','debug','Cdr,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment'];(function(_0x58194e,_0x541b3b){var _0x3e5a76=function(_0x5d375d){while(--_0x5d375d){_0x58194e['push'](_0x58194e['shift']());}};_0x3e5a76(++_0x541b3b);}(_0xfc25,0xde));var _0x5fc2=function(_0x161e48,_0xf0b7b4){_0x161e48=_0x161e48-0x0;var _0x5817f0=_0xfc25[_0x161e48];return _0x5817f0;};'use strict';var _=require(_0x5fc2('0x0'));var util=require(_0x5fc2('0x1'));var moment=require(_0x5fc2('0x2'));var BPromise=require(_0x5fc2('0x3'));var rs=require(_0x5fc2('0x4'));var fs=require('fs');var Redis=require(_0x5fc2('0x5'));var db=require(_0x5fc2('0x6'))['db'];var utils=require(_0x5fc2('0x7'));var logger=require(_0x5fc2('0x8'))('rpc');var config=require(_0x5fc2('0x9'));var jayson=require(_0x5fc2('0xa'));var client=jayson[_0x5fc2('0xb')][_0x5fc2('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x59dc6a,_0x55d7cb,_0x2ad7ed){return new BPromise(function(_0x148390,_0x41ad50){return client[_0x5fc2('0xd')](_0x59dc6a,_0x2ad7ed)[_0x5fc2('0xe')](function(_0x52ef09){logger[_0x5fc2('0xf')](_0x5fc2('0x10'),_0x55d7cb,_0x5fc2('0x11'));logger[_0x5fc2('0x12')](_0x5fc2('0x13'),_0x55d7cb,_0x5fc2('0x11'),JSON[_0x5fc2('0x14')](_0x52ef09));if(_0x52ef09[_0x5fc2('0x15')]){if(_0x52ef09[_0x5fc2('0x15')]['code']===0x1f4){logger[_0x5fc2('0x15')](_0x5fc2('0x10'),_0x55d7cb,_0x52ef09[_0x5fc2('0x15')][_0x5fc2('0x16')]);return _0x41ad50(_0x52ef09['error'][_0x5fc2('0x16')]);}logger[_0x5fc2('0x15')](_0x5fc2('0x10'),_0x55d7cb,_0x52ef09['error']['message']);return _0x148390(_0x52ef09[_0x5fc2('0x15')][_0x5fc2('0x16')]);}else{logger[_0x5fc2('0xf')](_0x5fc2('0x10'),_0x55d7cb,'request\x20sent');_0x148390(_0x52ef09[_0x5fc2('0x17')][_0x5fc2('0x16')]);}})[_0x5fc2('0x18')](function(_0x375c8f){logger[_0x5fc2('0x15')](_0x5fc2('0x10'),_0x55d7cb,_0x375c8f);_0x41ad50(_0x375c8f);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index e1cc707..2fac372 100644 --- a/server/api/cdr/index.js +++ b/server/api/cdr/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['isAuthenticated','create','put','/:id','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cdr.controller','get','index','/describe','show','post'];(function(_0x548627,_0x4ec392){var _0x844a84=function(_0x2ffdd2){while(--_0x2ffdd2){_0x548627['push'](_0x548627['shift']());}};_0x844a84(++_0x4ec392);}(_0xa9e0,0x123));var _0x0a9e=function(_0x9df060,_0x253d33){_0x9df060=_0x9df060-0x0;var _0x338dfe=_0xa9e0[_0x9df060];return _0x338dfe;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0xc')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')](_0x0a9e('0x10'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x11')]);module[_0x0a9e('0x12')]=router; \ No newline at end of file +var _0xd8b0=['destroy','exports','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','/:id','show','post','create','put','update'];(function(_0x3dbccb,_0x126d36){var _0x3e90e7=function(_0x43298f){while(--_0x43298f){_0x3dbccb['push'](_0x3dbccb['shift']());}};_0x3e90e7(++_0x126d36);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var controller=require('./cdr.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/describe',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')](_0x0d8b('0xb'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);router['delete'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x11')]);module[_0x0d8b('0x12')]=router; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.attributes.js b/server/api/chatApplication/chatApplication.attributes.js index a79b988..4744653 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 _0xf0e4=['STRING','noop','TEXT','sequelize','exports','INTEGER'];(function(_0x1fe7fe,_0x41cc8a){var _0x119376=function(_0x4e66d9){while(--_0x4e66d9){_0x1fe7fe['push'](_0x1fe7fe['shift']());}};_0x119376(++_0x41cc8a);}(_0xf0e4,0xb1));var _0x4f0e=function(_0x16268d,_0x340078){_0x16268d=_0x16268d-0x0;var _0x36799c=_0xf0e4[_0x16268d];return _0x36799c;};'use strict';var Sequelize=require(_0x4f0e('0x0'));module[_0x4f0e('0x1')]={'priority':{'type':Sequelize[_0x4f0e('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x4f0e('0x3')],'allowNull':![],'defaultValue':_0x4f0e('0x4')},'appdata':{'type':Sequelize[_0x4f0e('0x5')]()},'description':{'type':Sequelize[_0x4f0e('0x3')]},'interval':{'type':Sequelize[_0x4f0e('0x3')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0xecd1=['TEXT','STRING','noop'];(function(_0x1d1fd9,_0x343c4f){var _0x48c07e=function(_0x2ccbef){while(--_0x2ccbef){_0x1d1fd9['push'](_0x1d1fd9['shift']());}};_0x48c07e(++_0x343c4f);}(_0xecd1,0x15d));var _0x1ecd=function(_0x10946a,_0x33d6b8){_0x10946a=_0x10946a-0x0;var _0x180fa3=_0xecd1[_0x10946a];return _0x180fa3;};'use strict';var Sequelize=require('sequelize');module['exports']={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x1ecd('0x0')],'allowNull':![],'defaultValue':_0x1ecd('0x1')},'appdata':{'type':Sequelize[_0x1ecd('0x2')]()},'description':{'type':Sequelize[_0x1ecd('0x0')]},'interval':{'type':Sequelize[_0x1ecd('0x0')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index f812e2f..aacd46c 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 _0xe3ed=['Content-Range','apply','reject','save','then','destroy','error','stack','name','params','model','rawAttributes','query','filters','intersection','attributes','fields','length','include','merge','options','ChatApplication','find','catch','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','count','offset','set'];(function(_0x36c28f,_0x331ff7){var _0x1cda15=function(_0x4a2ff5){while(--_0x4a2ff5){_0x36c28f['push'](_0x36c28f['shift']());}};_0x1cda15(++_0x331ff7);}(_0xe3ed,0x8d));var _0xde3e=function(_0x532880,_0xaf724d){_0x532880=_0x532880-0x0;var _0x418bbe=_0xe3ed[_0x532880];return _0x418bbe;};'use strict';var emlformat=require(_0xde3e('0x0'));var rimraf=require(_0xde3e('0x1'));var zipdir=require(_0xde3e('0x2'));var jsonpatch=require(_0xde3e('0x3'));var rp=require(_0xde3e('0x4'));var moment=require(_0xde3e('0x5'));var BPromise=require(_0xde3e('0x6'));var Mustache=require(_0xde3e('0x7'));var util=require('util');var path=require(_0xde3e('0x8'));var sox=require(_0xde3e('0x9'));var csv=require('to-csv');var ejs=require(_0xde3e('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xde3e('0xb'));var squel=require(_0xde3e('0xc'));var crypto=require('crypto');var jsforce=require(_0xde3e('0xd'));var deskjs=require(_0xde3e('0xe'));var toCsv=require(_0xde3e('0xf'));var querystring=require(_0xde3e('0x10'));var Papa=require(_0xde3e('0x11'));var Redis=require('ioredis');var authService=require(_0xde3e('0x12'));var qs=require(_0xde3e('0x13'));var as=require(_0xde3e('0x14'));var hardwareService=require(_0xde3e('0x15'));var logger=require('../../config/logger')(_0xde3e('0x16'));var utils=require(_0xde3e('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xde3e('0x18'));var db=require(_0xde3e('0x19'))['db'];function respondWithStatusCode(_0x5d0240,_0x22ffc2){_0x22ffc2=_0x22ffc2||0xcc;return function(_0x4e0f23){if(_0x4e0f23){return _0x5d0240[_0xde3e('0x1a')](_0x22ffc2);}return _0x5d0240[_0xde3e('0x1b')](_0x22ffc2)[_0xde3e('0x1c')]();};}function respondWithResult(_0x4fe882,_0x167fa7){_0x167fa7=_0x167fa7||0xc8;return function(_0x1fee7b){if(_0x1fee7b){return _0x4fe882['status'](_0x167fa7)['json'](_0x1fee7b);}};}function respondWithFilteredResult(_0x120077,_0x11db96){return function(_0x6543f7){if(_0x6543f7){var _0x552fc4=typeof _0x11db96['offset']===_0xde3e('0x1d')&&typeof _0x11db96['limit']==='undefined';var _0xc3ee05=_0x6543f7[_0xde3e('0x1e')];var _0x4aa02c=_0x552fc4?0x0:_0x11db96[_0xde3e('0x1f')];var _0x276e83=_0x552fc4?_0x6543f7[_0xde3e('0x1e')]:_0x11db96['offset']+_0x11db96['limit'];var _0x4fa0d2;if(_0x276e83>=_0xc3ee05){_0x276e83=_0xc3ee05;_0x4fa0d2=0xc8;}else{_0x4fa0d2=0xce;}_0x120077[_0xde3e('0x1b')](_0x4fa0d2);return _0x120077[_0xde3e('0x20')](_0xde3e('0x21'),_0x4aa02c+'-'+_0x276e83+'/'+_0xc3ee05)['json'](_0x6543f7);}return null;};}function patchUpdates(_0x2ceb3e){return function(_0x11dd22){try{jsonpatch[_0xde3e('0x22')](_0x11dd22,_0x2ceb3e,!![]);}catch(_0x8c8ace){return BPromise[_0xde3e('0x23')](_0x8c8ace);}return _0x11dd22[_0xde3e('0x24')]();};}function saveUpdates(_0x26c5ca,_0x1eda88){return function(_0x443e8d){if(_0x443e8d){return _0x443e8d['update'](_0x26c5ca)[_0xde3e('0x25')](function(_0x334093){return _0x334093;});}return null;};}function removeEntity(_0x37615f,_0x57df9e){return function(_0x361511){if(_0x361511){return _0x361511[_0xde3e('0x26')]()[_0xde3e('0x25')](function(){_0x37615f['status'](0xcc)[_0xde3e('0x1c')]();});}};}function handleEntityNotFound(_0x78647,_0x1d9432){return function(_0xd795ac){if(!_0xd795ac){_0x78647[_0xde3e('0x1a')](0x194);}return _0xd795ac;};}function handleError(_0x5ec4b6,_0x5313cb){_0x5313cb=_0x5313cb||0x1f4;return function(_0x6c0db0){logger[_0xde3e('0x27')](_0x6c0db0[_0xde3e('0x28')]);if(_0x6c0db0['name']){delete _0x6c0db0[_0xde3e('0x29')];}_0x5ec4b6[_0xde3e('0x1b')](_0x5313cb)['send'](_0x6c0db0);};}exports['show']=function(_0x245fbc,_0x3c83c8){var _0x582c8d={'raw':!![],'where':{'id':_0x245fbc[_0xde3e('0x2a')]['id']}},_0x2e4c62={};_0x2e4c62[_0xde3e('0x2b')]=_['keys'](db['ChatApplication'][_0xde3e('0x2c')]);_0x2e4c62['query']=_['keys'](_0x245fbc[_0xde3e('0x2d')]);_0x2e4c62[_0xde3e('0x2e')]=_[_0xde3e('0x2f')](_0x2e4c62[_0xde3e('0x2b')],_0x2e4c62[_0xde3e('0x2d')]);_0x582c8d[_0xde3e('0x30')]=_[_0xde3e('0x2f')](_0x2e4c62[_0xde3e('0x2b')],qs[_0xde3e('0x31')](_0x245fbc[_0xde3e('0x2d')][_0xde3e('0x31')]));_0x582c8d[_0xde3e('0x30')]=_0x582c8d[_0xde3e('0x30')][_0xde3e('0x32')]?_0x582c8d[_0xde3e('0x30')]:_0x2e4c62[_0xde3e('0x2b')];if(_0x245fbc[_0xde3e('0x2d')]['includeAll']){_0x582c8d[_0xde3e('0x33')]=[{'all':!![]}];}_0x582c8d=_[_0xde3e('0x34')]({},_0x582c8d,_0x245fbc[_0xde3e('0x35')]);return db[_0xde3e('0x36')][_0xde3e('0x37')](_0x582c8d)[_0xde3e('0x25')](handleEntityNotFound(_0x3c83c8,null))[_0xde3e('0x25')](respondWithResult(_0x3c83c8,null))[_0xde3e('0x38')](handleError(_0x3c83c8,null));};exports['update']=function(_0x50f1e3,_0x47793d){if(_0x50f1e3['body']['id']){delete _0x50f1e3['body']['id'];}return db[_0xde3e('0x36')][_0xde3e('0x37')]({'where':{'id':_0x50f1e3[_0xde3e('0x2a')]['id']}})[_0xde3e('0x25')](handleEntityNotFound(_0x47793d,null))[_0xde3e('0x25')](saveUpdates(_0x50f1e3[_0xde3e('0x39')],null))['then'](respondWithResult(_0x47793d,null))['catch'](handleError(_0x47793d,null));};exports[_0xde3e('0x26')]=function(_0x24adee,_0x1ade0c){return db[_0xde3e('0x36')][_0xde3e('0x37')]({'where':{'id':_0x24adee[_0xde3e('0x2a')]['id']}})['then'](handleEntityNotFound(_0x1ade0c,null))[_0xde3e('0x25')](removeEntity(_0x1ade0c,null))['catch'](handleError(_0x1ade0c,null));}; \ No newline at end of file +var _0xb676=['ChatApplication','rawAttributes','query','filters','intersection','attributes','fields','length','includeAll','merge','options','catch','body','find','eml-format','zip-dir','fast-json-patch','request-promise','moment','util','path','to-csv','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','show','params','model','keys'];(function(_0x4a79c8,_0x49ec68){var _0x1b775d=function(_0x3bdb9b){while(--_0x3bdb9b){_0x4a79c8['push'](_0x4a79c8['shift']());}};_0x1b775d(++_0x49ec68);}(_0xb676,0xbc));var _0x6b67=function(_0x125ff8,_0x41925f){_0x125ff8=_0x125ff8-0x0;var _0x2d9ef=_0xb676[_0x125ff8];return _0x2d9ef;};'use strict';var emlformat=require(_0x6b67('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6b67('0x1'));var jsonpatch=require(_0x6b67('0x2'));var rp=require(_0x6b67('0x3'));var moment=require(_0x6b67('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x6b67('0x5'));var path=require(_0x6b67('0x6'));var sox=require('sox');var csv=require(_0x6b67('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6b67('0x8'));var _=require(_0x6b67('0x9'));var squel=require(_0x6b67('0xa'));var crypto=require('crypto');var jsforce=require(_0x6b67('0xb'));var deskjs=require(_0x6b67('0xc'));var toCsv=require(_0x6b67('0x7'));var querystring=require('querystring');var Papa=require(_0x6b67('0xd'));var Redis=require(_0x6b67('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x6b67('0xf'));var as=require(_0x6b67('0x10'));var hardwareService=require(_0x6b67('0x11'));var logger=require(_0x6b67('0x12'))('api');var utils=require(_0x6b67('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x6b67('0x14'));var db=require(_0x6b67('0x15'))['db'];function respondWithStatusCode(_0x1ebceb,_0x2ab6c5){_0x2ab6c5=_0x2ab6c5||0xcc;return function(_0x3e1bc6){if(_0x3e1bc6){return _0x1ebceb[_0x6b67('0x16')](_0x2ab6c5);}return _0x1ebceb[_0x6b67('0x17')](_0x2ab6c5)[_0x6b67('0x18')]();};}function respondWithResult(_0x2de534,_0x5fb6b3){_0x5fb6b3=_0x5fb6b3||0xc8;return function(_0x8a29a2){if(_0x8a29a2){return _0x2de534['status'](_0x5fb6b3)[_0x6b67('0x19')](_0x8a29a2);}};}function respondWithFilteredResult(_0x2213f4,_0x51e798){return function(_0x187fd4){if(_0x187fd4){var _0x1b6c60=typeof _0x51e798[_0x6b67('0x1a')]===_0x6b67('0x1b')&&typeof _0x51e798['limit']===_0x6b67('0x1b');var _0x46c44e=_0x187fd4[_0x6b67('0x1c')];var _0x46d828=_0x1b6c60?0x0:_0x51e798[_0x6b67('0x1a')];var _0x37d964=_0x1b6c60?_0x187fd4['count']:_0x51e798[_0x6b67('0x1a')]+_0x51e798['limit'];var _0x37cf6d;if(_0x37d964>=_0x46c44e){_0x37d964=_0x46c44e;_0x37cf6d=0xc8;}else{_0x37cf6d=0xce;}_0x2213f4[_0x6b67('0x17')](_0x37cf6d);return _0x2213f4[_0x6b67('0x1d')](_0x6b67('0x1e'),_0x46d828+'-'+_0x37d964+'/'+_0x46c44e)['json'](_0x187fd4);}return null;};}function patchUpdates(_0xd36be3){return function(_0x360208){try{jsonpatch[_0x6b67('0x1f')](_0x360208,_0xd36be3,!![]);}catch(_0x50fdfc){return BPromise[_0x6b67('0x20')](_0x50fdfc);}return _0x360208[_0x6b67('0x21')]();};}function saveUpdates(_0x1fedd5,_0x4d48e1){return function(_0xd4fda5){if(_0xd4fda5){return _0xd4fda5[_0x6b67('0x22')](_0x1fedd5)[_0x6b67('0x23')](function(_0x3a0a3f){return _0x3a0a3f;});}return null;};}function removeEntity(_0x393b3d,_0x17d27b){return function(_0x3c89d2){if(_0x3c89d2){return _0x3c89d2[_0x6b67('0x24')]()[_0x6b67('0x23')](function(){_0x393b3d[_0x6b67('0x17')](0xcc)[_0x6b67('0x18')]();});}};}function handleEntityNotFound(_0x47c927,_0x265245){return function(_0x3cffdf){if(!_0x3cffdf){_0x47c927[_0x6b67('0x16')](0x194);}return _0x3cffdf;};}function handleError(_0x5dca55,_0x2b67f6){_0x2b67f6=_0x2b67f6||0x1f4;return function(_0x1c73b0){logger['error'](_0x1c73b0[_0x6b67('0x25')]);if(_0x1c73b0[_0x6b67('0x26')]){delete _0x1c73b0[_0x6b67('0x26')];}_0x5dca55[_0x6b67('0x17')](_0x2b67f6)[_0x6b67('0x27')](_0x1c73b0);};}exports[_0x6b67('0x28')]=function(_0x3b65af,_0x5d9f6d){var _0x320a70={'raw':!![],'where':{'id':_0x3b65af[_0x6b67('0x29')]['id']}},_0x433881={};_0x433881[_0x6b67('0x2a')]=_[_0x6b67('0x2b')](db[_0x6b67('0x2c')][_0x6b67('0x2d')]);_0x433881[_0x6b67('0x2e')]=_['keys'](_0x3b65af[_0x6b67('0x2e')]);_0x433881[_0x6b67('0x2f')]=_[_0x6b67('0x30')](_0x433881[_0x6b67('0x2a')],_0x433881[_0x6b67('0x2e')]);_0x320a70[_0x6b67('0x31')]=_['intersection'](_0x433881['model'],qs[_0x6b67('0x32')](_0x3b65af[_0x6b67('0x2e')][_0x6b67('0x32')]));_0x320a70[_0x6b67('0x31')]=_0x320a70['attributes'][_0x6b67('0x33')]?_0x320a70['attributes']:_0x433881[_0x6b67('0x2a')];if(_0x3b65af[_0x6b67('0x2e')][_0x6b67('0x34')]){_0x320a70['include']=[{'all':!![]}];}_0x320a70=_[_0x6b67('0x35')]({},_0x320a70,_0x3b65af[_0x6b67('0x36')]);return db[_0x6b67('0x2c')]['find'](_0x320a70)[_0x6b67('0x23')](handleEntityNotFound(_0x5d9f6d,null))[_0x6b67('0x23')](respondWithResult(_0x5d9f6d,null))[_0x6b67('0x37')](handleError(_0x5d9f6d,null));};exports[_0x6b67('0x22')]=function(_0x4c3a86,_0x2092f6){if(_0x4c3a86[_0x6b67('0x38')]['id']){delete _0x4c3a86[_0x6b67('0x38')]['id'];}return db[_0x6b67('0x2c')][_0x6b67('0x39')]({'where':{'id':_0x4c3a86[_0x6b67('0x29')]['id']}})[_0x6b67('0x23')](handleEntityNotFound(_0x2092f6,null))[_0x6b67('0x23')](saveUpdates(_0x4c3a86['body'],null))[_0x6b67('0x23')](respondWithResult(_0x2092f6,null))[_0x6b67('0x37')](handleError(_0x2092f6,null));};exports[_0x6b67('0x24')]=function(_0x4d259f,_0x3889ef){return db[_0x6b67('0x2c')][_0x6b67('0x39')]({'where':{'id':_0x4d259f[_0x6b67('0x29')]['id']}})['then'](handleEntityNotFound(_0x3889ef,null))['then'](removeEntity(_0x3889ef,null))[_0x6b67('0x37')](handleError(_0x3889ef,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index e56b5bd..0ccadd9 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 _0x4f88=['chat_applications','lodash','util','api','moment','bluebird','rimraf','../../config/environment','./chatApplication.attributes','exports','ChatApplication'];(function(_0x1a7536,_0x30c791){var _0x4660d9=function(_0x1db222){while(--_0x1db222){_0x1a7536['push'](_0x1a7536['shift']());}};_0x4660d9(++_0x30c791);}(_0x4f88,0xf3));var _0x84f8=function(_0xbf8ebe,_0x3b69a5){_0xbf8ebe=_0xbf8ebe-0x0;var _0x1e25e8=_0x4f88[_0xbf8ebe];return _0x1e25e8;};'use strict';var _=require(_0x84f8('0x0'));var util=require(_0x84f8('0x1'));var logger=require('../../config/logger')(_0x84f8('0x2'));var moment=require(_0x84f8('0x3'));var BPromise=require(_0x84f8('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x84f8('0x5'));var config=require(_0x84f8('0x6'));var attributes=require(_0x84f8('0x7'));module[_0x84f8('0x8')]=function(_0x79dcec,_0x1ac0c8){return _0x79dcec['define'](_0x84f8('0x9'),attributes,{'tableName':_0x84f8('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x7ca3=['../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','exports','ChatApplication','chat_applications','utf8mb4','utf8mb4_unicode_ci','util'];(function(_0x3da77c,_0x5251ff){var _0x35ff37=function(_0x6fc260){while(--_0x6fc260){_0x3da77c['push'](_0x3da77c['shift']());}};_0x35ff37(++_0x5251ff);}(_0x7ca3,0x9b));var _0x37ca=function(_0x1265fa,_0x1a1fed){_0x1265fa=_0x1265fa-0x0;var _0x1fe35e=_0x7ca3[_0x1265fa];return _0x1fe35e;};'use strict';var _=require('lodash');var util=require(_0x37ca('0x0'));var logger=require(_0x37ca('0x1'))(_0x37ca('0x2'));var moment=require(_0x37ca('0x3'));var BPromise=require(_0x37ca('0x4'));var rp=require(_0x37ca('0x5'));var fs=require('fs');var path=require(_0x37ca('0x6'));var rimraf=require('rimraf');var config=require(_0x37ca('0x7'));var attributes=require('./chatApplication.attributes');module[_0x37ca('0x8')]=function(_0x3f0a23,_0xbb16e3){return _0x3f0a23['define'](_0x37ca('0x9'),attributes,{'tableName':_0x37ca('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x37ca('0xb'),'collate':_0x37ca('0xc')});}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.rpc.js b/server/api/chatApplication/chatApplication.rpc.js index fb497d6..198e432 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 _0xed1d=['info','ChatApplication,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x9df060,_0x253d33){var _0x338dfe=function(_0x17d9a5){while(--_0x17d9a5){_0x9df060['push'](_0x9df060['shift']());}};_0x338dfe(++_0x253d33);}(_0xed1d,0x127));var _0xded1=function(_0x3cf76d,_0xb29031){_0x3cf76d=_0x3cf76d-0x0;var _0xb2c522=_0xed1d[_0x3cf76d];return _0xb2c522;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xded1('0x0'));var BPromise=require(_0xded1('0x1'));var rs=require(_0xded1('0x2'));var fs=require('fs');var Redis=require(_0xded1('0x3'));var db=require(_0xded1('0x4'))['db'];var utils=require(_0xded1('0x5'));var logger=require(_0xded1('0x6'))(_0xded1('0x7'));var config=require(_0xded1('0x8'));var jayson=require(_0xded1('0x9'));var client=jayson[_0xded1('0xa')][_0xded1('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1f79d4,_0x5a4dc6,_0x1aee31){return new BPromise(function(_0x37d971,_0x51febd){return client[_0xded1('0xc')](_0x1f79d4,_0x1aee31)['then'](function(_0x13d98f){logger[_0xded1('0xd')](_0xded1('0xe'),_0x5a4dc6,_0xded1('0xf'));logger[_0xded1('0x10')]('ChatApplication,\x20%s,\x20%s,\x20%s',_0x5a4dc6,_0xded1('0xf'),JSON[_0xded1('0x11')](_0x13d98f));if(_0x13d98f[_0xded1('0x12')]){if(_0x13d98f[_0xded1('0x12')][_0xded1('0x13')]===0x1f4){logger[_0xded1('0x12')](_0xded1('0xe'),_0x5a4dc6,_0x13d98f[_0xded1('0x12')][_0xded1('0x14')]);return _0x51febd(_0x13d98f[_0xded1('0x12')][_0xded1('0x14')]);}logger[_0xded1('0x12')](_0xded1('0xe'),_0x5a4dc6,_0x13d98f[_0xded1('0x12')][_0xded1('0x14')]);return _0x37d971(_0x13d98f[_0xded1('0x12')][_0xded1('0x14')]);}else{logger['info'](_0xded1('0xe'),_0x5a4dc6,'request\x20sent');_0x37d971(_0x13d98f['result'][_0xded1('0x14')]);}})[_0xded1('0x15')](function(_0x556c5e){logger[_0xded1('0x12')]('ChatApplication,\x20%s,\x20%s',_0x5a4dc6,_0x556c5e);_0x51febd(_0x556c5e);});});} \ No newline at end of file +var _0x2c93=['moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info','ChatApplication,\x20%s,\x20%s','request\x20sent','debug','ChatApplication,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x2c93,0x106));var _0x32c9=function(_0x2c7618,_0x26be9c){_0x2c7618=_0x2c7618-0x0;var _0x5ce3f0=_0x2c93[_0x2c7618];return _0x5ce3f0;};'use strict';var _=require(_0x32c9('0x0'));var util=require(_0x32c9('0x1'));var moment=require(_0x32c9('0x2'));var BPromise=require(_0x32c9('0x3'));var rs=require(_0x32c9('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x32c9('0x5'));var logger=require(_0x32c9('0x6'))(_0x32c9('0x7'));var config=require('../../config/environment');var jayson=require(_0x32c9('0x8'));var client=jayson[_0x32c9('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x112024,_0x8c5c8e,_0x1b8ef9){return new BPromise(function(_0x1f6062,_0x30e03d){return client[_0x32c9('0xa')](_0x112024,_0x1b8ef9)[_0x32c9('0xb')](function(_0x43bb2c){logger[_0x32c9('0xc')](_0x32c9('0xd'),_0x8c5c8e,_0x32c9('0xe'));logger[_0x32c9('0xf')](_0x32c9('0x10'),_0x8c5c8e,_0x32c9('0xe'),JSON['stringify'](_0x43bb2c));if(_0x43bb2c[_0x32c9('0x11')]){if(_0x43bb2c[_0x32c9('0x11')][_0x32c9('0x12')]===0x1f4){logger[_0x32c9('0x11')](_0x32c9('0xd'),_0x8c5c8e,_0x43bb2c[_0x32c9('0x11')][_0x32c9('0x13')]);return _0x30e03d(_0x43bb2c[_0x32c9('0x11')][_0x32c9('0x13')]);}logger[_0x32c9('0x11')](_0x32c9('0xd'),_0x8c5c8e,_0x43bb2c['error'][_0x32c9('0x13')]);return _0x1f6062(_0x43bb2c['error'][_0x32c9('0x13')]);}else{logger[_0x32c9('0xc')](_0x32c9('0xd'),_0x8c5c8e,_0x32c9('0xe'));_0x1f6062(_0x43bb2c[_0x32c9('0x14')][_0x32c9('0x13')]);}})[_0x32c9('0x15')](function(_0x3a76ee){logger[_0x32c9('0x11')](_0x32c9('0xd'),_0x8c5c8e,_0x3a76ee);_0x30e03d(_0x3a76ee);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index 3adfa67..b4e40ba 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 _0x665f=['show','put','delete','exports','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','./chatApplication.controller','get','/:id','isAuthenticated'];(function(_0x572a16,_0x4d5089){var _0x4a0803=function(_0x55b517){while(--_0x55b517){_0x572a16['push'](_0x572a16['shift']());}};_0x4a0803(++_0x4d5089);}(_0x665f,0x1c4));var _0xf665=function(_0xb74774,_0x33681d){_0xb74774=_0xb74774-0x0;var _0x57e076=_0x665f[_0xb74774];return _0x57e076;};'use strict';var multer=require('multer');var util=require(_0xf665('0x0'));var path=require(_0xf665('0x1'));var timeout=require(_0xf665('0x2'));var express=require(_0xf665('0x3'));var router=express['Router']();var fs_extra=require(_0xf665('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xf665('0x5'));var config=require('../../config/environment');var controller=require(_0xf665('0x6'));router[_0xf665('0x7')](_0xf665('0x8'),auth[_0xf665('0x9')](),controller[_0xf665('0xa')]);router[_0xf665('0xb')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0xf665('0xc')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0xf665('0xd')]=router; \ No newline at end of file +var _0x3798=['../../components/interaction/service','../../config/environment','get','/:id','isAuthenticated','update','delete','destroy','exports','multer','express','Router','fs-extra','../../components/auth/service'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3798,0xe9));var _0x8379=function(_0x1da90d,_0x349c14){_0x1da90d=_0x1da90d-0x0;var _0x34aae9=_0x3798[_0x1da90d];return _0x34aae9;};'use strict';var multer=require(_0x8379('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x8379('0x1'));var router=express[_0x8379('0x2')]();var fs_extra=require(_0x8379('0x3'));var auth=require(_0x8379('0x4'));var interaction=require(_0x8379('0x5'));var config=require(_0x8379('0x6'));var controller=require('./chatApplication.controller');router[_0x8379('0x7')](_0x8379('0x8'),auth[_0x8379('0x9')](),controller['show']);router['put']('/:id',auth[_0x8379('0x9')](),controller[_0x8379('0xa')]);router[_0x8379('0xb')](_0x8379('0x8'),auth[_0x8379('0x9')](),controller[_0x8379('0xc')]);module[_0x8379('0xd')]=router; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.attributes.js b/server/api/chatGroup/chatGroup.attributes.js index b157cee..82b13d2 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 _0x02bd=['sequelize','exports','STRING'];(function(_0x3be174,_0x393350){var _0x5ec09c=function(_0x28a9aa){while(--_0x28a9aa){_0x3be174['push'](_0x3be174['shift']());}};_0x5ec09c(++_0x393350);}(_0x02bd,0x6c));var _0xd02b=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x02bd[_0x57b54c];return _0x59cc19;};'use strict';var Sequelize=require(_0xd02b('0x0'));module[_0xd02b('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0xd02b('0x2')]},'write':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0xaac4=['sequelize','exports','STRING','BOOLEAN'];(function(_0x3663cb,_0x426160){var _0x2e5262=function(_0xf5ee41){while(--_0xf5ee41){_0x3663cb['push'](_0x3663cb['shift']());}};_0x2e5262(++_0x426160);}(_0xaac4,0x6c));var _0x4aac=function(_0x419c4a,_0x5d525d){_0x419c4a=_0x419c4a-0x0;var _0x4dae37=_0xaac4[_0x419c4a];return _0x4dae37;};'use strict';var Sequelize=require(_0x4aac('0x0'));module[_0x4aac('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x4aac('0x2')]},'write':{'type':Sequelize[_0x4aac('0x3')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.controller.js b/server/api/chatGroup/chatGroup.controller.js index fd63adc..a00b7a3 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 _0x812e=['redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','json','apply','reject','save','then','destroy','error','stack','name','send','map','ChatGroup','fieldName','type','key','query','keys','filters','intersection','attributes','fields','length','model','hasOwnProperty','sort','pick','filter','merge','where','VIRTUAL','includeAll','include','findAll','catch','show','params','options','find','create','body','update','describe','getUnread','user','toInteger','addMembers','ids','omit','User','getMembers','nolimit','removeMembers','ChatGroupId','ChatInternalMessage','findOne','order','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','getMessages','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x812e,0x117));var _0xe812=function(_0x5839fa,_0xacd507){_0x5839fa=_0x5839fa-0x0;var _0x5d514e=_0x812e[_0x5839fa];return _0x5d514e;};'use strict';var emlformat=require(_0xe812('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe812('0x1'));var jsonpatch=require(_0xe812('0x2'));var rp=require(_0xe812('0x3'));var moment=require(_0xe812('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xe812('0x5'));var util=require('util');var path=require(_0xe812('0x6'));var sox=require(_0xe812('0x7'));var csv=require('to-csv');var ejs=require(_0xe812('0x8'));var fs=require('fs');var fs_extra=require(_0xe812('0x9'));var _=require(_0xe812('0xa'));var squel=require(_0xe812('0xb'));var crypto=require(_0xe812('0xc'));var jsforce=require(_0xe812('0xd'));var deskjs=require(_0xe812('0xe'));var toCsv=require(_0xe812('0xf'));var querystring=require(_0xe812('0x10'));var Papa=require(_0xe812('0x11'));var Redis=require(_0xe812('0x12'));var authService=require(_0xe812('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xe812('0x14'));var hardwareService=require(_0xe812('0x15'));var logger=require(_0xe812('0x16'))(_0xe812('0x17'));var utils=require(_0xe812('0x18'));var config=require(_0xe812('0x19'));var licenseUtil=require(_0xe812('0x1a'));var db=require('../../mysqldb')['db'];config[_0xe812('0x1b')]=_[_0xe812('0x1c')](config[_0xe812('0x1b')],{'host':_0xe812('0x1d'),'port':0x18eb});var socket=require(_0xe812('0x1e'))(new Redis(config[_0xe812('0x1b')]));require('./chatGroup.socket')[_0xe812('0x1f')](socket);function respondWithStatusCode(_0x2b0bb6,_0x1f9be0){_0x1f9be0=_0x1f9be0||0xcc;return function(_0x9c4402){if(_0x9c4402){return _0x2b0bb6[_0xe812('0x20')](_0x1f9be0);}return _0x2b0bb6[_0xe812('0x21')](_0x1f9be0)[_0xe812('0x22')]();};}function respondWithResult(_0x3c496e,_0x4ee593){_0x4ee593=_0x4ee593||0xc8;return function(_0x267233){if(_0x267233){return _0x3c496e[_0xe812('0x21')](_0x4ee593)['json'](_0x267233);}};}function respondWithFilteredResult(_0x13b6c6,_0x5ef3dd){return function(_0x1d7e4e){if(_0x1d7e4e){var _0x774e45=typeof _0x5ef3dd[_0xe812('0x23')]===_0xe812('0x24')&&typeof _0x5ef3dd['limit']===_0xe812('0x24');var _0x290d7b=_0x1d7e4e[_0xe812('0x25')];var _0xa8adc8=_0x774e45?0x0:_0x5ef3dd[_0xe812('0x23')];var _0x2427f3=_0x774e45?_0x1d7e4e[_0xe812('0x25')]:_0x5ef3dd['offset']+_0x5ef3dd[_0xe812('0x26')];var _0x3cc7d9;if(_0x2427f3>=_0x290d7b){_0x2427f3=_0x290d7b;_0x3cc7d9=0xc8;}else{_0x3cc7d9=0xce;}_0x13b6c6[_0xe812('0x21')](_0x3cc7d9);return _0x13b6c6[_0xe812('0x27')](_0xe812('0x28'),_0xa8adc8+'-'+_0x2427f3+'/'+_0x290d7b)[_0xe812('0x29')](_0x1d7e4e);}return null;};}function patchUpdates(_0x35e946){return function(_0x1d26a6){try{jsonpatch[_0xe812('0x2a')](_0x1d26a6,_0x35e946,!![]);}catch(_0x553e42){return BPromise[_0xe812('0x2b')](_0x553e42);}return _0x1d26a6[_0xe812('0x2c')]();};}function saveUpdates(_0x35b066,_0x4b4fb1){return function(_0xb76d88){if(_0xb76d88){return _0xb76d88['update'](_0x35b066)[_0xe812('0x2d')](function(_0x1e11b5){return _0x1e11b5;});}return null;};}function removeEntity(_0x580cc3,_0x125fdd){return function(_0x159482){if(_0x159482){return _0x159482[_0xe812('0x2e')]()[_0xe812('0x2d')](function(){_0x580cc3[_0xe812('0x21')](0xcc)['end']();});}};}function handleEntityNotFound(_0x44efa7,_0x16bf81){return function(_0x1e0de2){if(!_0x1e0de2){_0x44efa7[_0xe812('0x20')](0x194);}return _0x1e0de2;};}function handleError(_0x5c5ce6,_0x4f65ff){_0x4f65ff=_0x4f65ff||0x1f4;return function(_0x373036){logger[_0xe812('0x2f')](_0x373036[_0xe812('0x30')]);if(_0x373036[_0xe812('0x31')]){delete _0x373036['name'];}_0x5c5ce6[_0xe812('0x21')](_0x4f65ff)[_0xe812('0x32')](_0x373036);};}exports['index']=function(_0xebcad3,_0x478dfc){var _0x240a22={},_0x173721={},_0xc4988c={'count':0x0,'rows':[]};var _0x241bc3=_[_0xe812('0x33')](db[_0xe812('0x34')]['rawAttributes'],function(_0x2d94c4){return{'name':_0x2d94c4[_0xe812('0x35')],'type':_0x2d94c4[_0xe812('0x36')][_0xe812('0x37')]};});_0x173721['model']=_['map'](_0x241bc3,_0xe812('0x31'));_0x173721[_0xe812('0x38')]=_[_0xe812('0x39')](_0xebcad3[_0xe812('0x38')]);_0x173721[_0xe812('0x3a')]=_[_0xe812('0x3b')](_0x173721['model'],_0x173721[_0xe812('0x38')]);_0x240a22[_0xe812('0x3c')]=_[_0xe812('0x3b')](_0x173721['model'],qs[_0xe812('0x3d')](_0xebcad3['query'][_0xe812('0x3d')]));_0x240a22[_0xe812('0x3c')]=_0x240a22['attributes'][_0xe812('0x3e')]?_0x240a22[_0xe812('0x3c')]:_0x173721[_0xe812('0x3f')];if(!_0xebcad3[_0xe812('0x38')][_0xe812('0x40')]('nolimit')){_0x240a22[_0xe812('0x26')]=qs[_0xe812('0x26')](_0xebcad3[_0xe812('0x38')]['limit']);_0x240a22[_0xe812('0x23')]=qs[_0xe812('0x23')](_0xebcad3[_0xe812('0x38')][_0xe812('0x23')]);}_0x240a22['order']=qs[_0xe812('0x41')](_0xebcad3['query'][_0xe812('0x41')]);_0x240a22['where']=qs[_0xe812('0x3a')](_[_0xe812('0x42')](_0xebcad3[_0xe812('0x38')],_0x173721[_0xe812('0x3a')]),_0x241bc3);if(_0xebcad3[_0xe812('0x38')][_0xe812('0x43')]){_0x240a22['where']=_[_0xe812('0x44')](_0x240a22[_0xe812('0x45')],{'$or':_[_0xe812('0x33')](_0x241bc3,function(_0x24860c){if(_0x24860c[_0xe812('0x36')]!==_0xe812('0x46')){var _0x5d20b9={};_0x5d20b9[_0x24860c[_0xe812('0x31')]]={'$like':'%'+_0xebcad3['query'][_0xe812('0x43')]+'%'};return _0x5d20b9;}})});}_0x240a22=_['merge']({},_0x240a22,_0xebcad3['options']);var _0x48155f={'where':_0x240a22[_0xe812('0x45')]};return db[_0xe812('0x34')][_0xe812('0x25')](_0x48155f)[_0xe812('0x2d')](function(_0x53c6d1){_0xc4988c[_0xe812('0x25')]=_0x53c6d1;if(_0xebcad3[_0xe812('0x38')][_0xe812('0x47')]){_0x240a22[_0xe812('0x48')]=[{'all':!![]}];}return db[_0xe812('0x34')][_0xe812('0x49')](_0x240a22);})[_0xe812('0x2d')](function(_0x5b1ebd){_0xc4988c['rows']=_0x5b1ebd;return _0xc4988c;})[_0xe812('0x2d')](respondWithFilteredResult(_0x478dfc,_0x240a22))[_0xe812('0x4a')](handleError(_0x478dfc,null));};exports[_0xe812('0x4b')]=function(_0x89568d,_0x777e3c){var _0x509827={'raw':!![],'where':{'id':_0x89568d[_0xe812('0x4c')]['id']}},_0x1fcba9={};_0x1fcba9[_0xe812('0x3f')]=_[_0xe812('0x39')](db[_0xe812('0x34')]['rawAttributes']);_0x1fcba9['query']=_[_0xe812('0x39')](_0x89568d['query']);_0x1fcba9[_0xe812('0x3a')]=_['intersection'](_0x1fcba9[_0xe812('0x3f')],_0x1fcba9['query']);_0x509827[_0xe812('0x3c')]=_[_0xe812('0x3b')](_0x1fcba9['model'],qs[_0xe812('0x3d')](_0x89568d[_0xe812('0x38')][_0xe812('0x3d')]));_0x509827[_0xe812('0x3c')]=_0x509827[_0xe812('0x3c')]['length']?_0x509827[_0xe812('0x3c')]:_0x1fcba9[_0xe812('0x3f')];if(_0x89568d[_0xe812('0x38')][_0xe812('0x47')]){_0x509827[_0xe812('0x48')]=[{'all':!![]}];}_0x509827=_['merge']({},_0x509827,_0x89568d[_0xe812('0x4d')]);return db[_0xe812('0x34')][_0xe812('0x4e')](_0x509827)[_0xe812('0x2d')](handleEntityNotFound(_0x777e3c,null))[_0xe812('0x2d')](respondWithResult(_0x777e3c,null))['catch'](handleError(_0x777e3c,null));};exports[_0xe812('0x4f')]=function(_0x2b266f,_0x16fe5c){return db[_0xe812('0x34')][_0xe812('0x4f')](_0x2b266f[_0xe812('0x50')],{})[_0xe812('0x2d')](respondWithResult(_0x16fe5c,0xc9))['catch'](handleError(_0x16fe5c,null));};exports[_0xe812('0x51')]=function(_0x1c151b,_0x48eb4d){if(_0x1c151b[_0xe812('0x50')]['id']){delete _0x1c151b[_0xe812('0x50')]['id'];}return db[_0xe812('0x34')][_0xe812('0x4e')]({'where':{'id':_0x1c151b[_0xe812('0x4c')]['id']}})['then'](handleEntityNotFound(_0x48eb4d,null))[_0xe812('0x2d')](saveUpdates(_0x1c151b['body'],null))[_0xe812('0x2d')](respondWithResult(_0x48eb4d,null))[_0xe812('0x4a')](handleError(_0x48eb4d,null));};exports['destroy']=function(_0x3deffd,_0x26052a){return db[_0xe812('0x34')][_0xe812('0x4e')]({'where':{'id':_0x3deffd[_0xe812('0x4c')]['id']}})['then'](handleEntityNotFound(_0x26052a,null))[_0xe812('0x2d')](removeEntity(_0x26052a,null))['catch'](handleError(_0x26052a,null));};exports[_0xe812('0x52')]=function(_0x568791,_0x236187){return db[_0xe812('0x34')][_0xe812('0x52')]()[_0xe812('0x2d')](respondWithResult(_0x236187,null))[_0xe812('0x4a')](handleError(_0x236187,null));};exports[_0xe812('0x53')]=function(_0x1dda33,_0x1c7fce,_0x590b08){return db['ChatInternalMessage'][_0xe812('0x25')]({'where':{'ChatGroupId':_0x1dda33[_0xe812('0x4c')]['id'],'ToId':_0x1dda33[_0xe812('0x54')]['id'],'read':![]}})[_0xe812('0x2d')](function(_0x155b93){return{'id':_[_0xe812('0x55')](_0x1dda33[_0xe812('0x4c')]['id']),'count':_0x155b93};})[_0xe812('0x2d')](respondWithResult(_0x1c7fce,null))[_0xe812('0x4a')](handleError(_0x1c7fce,null));};exports[_0xe812('0x56')]=function(_0x2a1bc6,_0x51c687,_0x46ce96){return db[_0xe812('0x34')][_0xe812('0x4e')]({'where':{'id':_0x2a1bc6['params']['id']}})[_0xe812('0x2d')](handleEntityNotFound(_0x51c687,null))[_0xe812('0x2d')](function(_0x2d194f){if(_0x2d194f){return _0x2d194f[_0xe812('0x56')](_0x2a1bc6[_0xe812('0x50')][_0xe812('0x57')],_[_0xe812('0x58')](_0x2a1bc6['body'],[_0xe812('0x57'),'id'])||{});}})[_0xe812('0x2d')](respondWithResult(_0x51c687,null))[_0xe812('0x4a')](handleError(_0x51c687,null));};exports['getMembers']=function(_0x588e0e,_0x286d80,_0x32c672){var _0x2b4c68={};var _0x32a588={};var _0x1b1de6;var _0x25b584;return db[_0xe812('0x34')]['findOne']({'where':{'id':_0x588e0e[_0xe812('0x4c')]['id']}})[_0xe812('0x2d')](handleEntityNotFound(_0x286d80,null))[_0xe812('0x2d')](function(_0x3420cb){if(_0x3420cb){_0x1b1de6=_0x3420cb;_0x32a588[_0xe812('0x3f')]=_['keys'](db[_0xe812('0x59')]['rawAttributes']);_0x32a588[_0xe812('0x38')]=_[_0xe812('0x39')](_0x588e0e[_0xe812('0x38')]);_0x32a588['filters']=_['intersection'](_0x32a588[_0xe812('0x3f')],_0x32a588[_0xe812('0x38')]);_0x2b4c68[_0xe812('0x3c')]=_[_0xe812('0x3b')](_0x32a588['model'],qs[_0xe812('0x3d')](_0x588e0e[_0xe812('0x38')][_0xe812('0x3d')]));_0x2b4c68[_0xe812('0x3c')]=_0x2b4c68['attributes'][_0xe812('0x3e')]?_0x2b4c68['attributes']:_0x32a588[_0xe812('0x3f')];_0x2b4c68['order']=qs['sort'](_0x588e0e[_0xe812('0x38')]['sort']);_0x2b4c68[_0xe812('0x45')]=qs[_0xe812('0x3a')](_[_0xe812('0x42')](_0x588e0e[_0xe812('0x38')],_0x32a588['filters']));if(_0x588e0e[_0xe812('0x38')][_0xe812('0x43')]){_0x2b4c68[_0xe812('0x45')]=_['merge'](_0x2b4c68[_0xe812('0x45')],{'$or':_[_0xe812('0x33')](_0x2b4c68[_0xe812('0x3c')],function(_0x478a3f){var _0x1716bf={};_0x1716bf[_0x478a3f]={'$like':'%'+_0x588e0e[_0xe812('0x38')][_0xe812('0x43')]+'%'};return _0x1716bf;})});}_0x2b4c68=_[_0xe812('0x44')]({},_0x2b4c68,_0x588e0e[_0xe812('0x4d')]);return _0x1b1de6[_0xe812('0x5a')](_0x2b4c68);}})[_0xe812('0x2d')](function(_0x1df0d0){if(_0x1df0d0){_0x25b584=_0x1df0d0[_0xe812('0x3e')];if(!_0x588e0e[_0xe812('0x38')]['hasOwnProperty'](_0xe812('0x5b'))){_0x2b4c68[_0xe812('0x26')]=qs[_0xe812('0x26')](_0x588e0e[_0xe812('0x38')][_0xe812('0x26')]);_0x2b4c68[_0xe812('0x23')]=qs[_0xe812('0x23')](_0x588e0e[_0xe812('0x38')][_0xe812('0x23')]);}return _0x1b1de6[_0xe812('0x5a')](_0x2b4c68);}})[_0xe812('0x2d')](function(_0x71e7a3){if(_0x71e7a3){return _0x71e7a3?{'count':_0x25b584,'rows':_0x71e7a3}:null;}})['then'](respondWithResult(_0x286d80,null))[_0xe812('0x4a')](handleError(_0x286d80,null));};exports[_0xe812('0x5c')]=function(_0x6a0aba,_0x39dd5b,_0xae2751){return db['ChatGroup']['find']({'where':{'id':_0x6a0aba[_0xe812('0x4c')]['id']}})[_0xe812('0x2d')](handleEntityNotFound(_0x39dd5b,null))[_0xe812('0x2d')](function(_0x35074a){if(_0x35074a){return _0x35074a[_0xe812('0x5c')](_0x6a0aba[_0xe812('0x38')]['ids']);}})[_0xe812('0x2d')](respondWithStatusCode(_0x39dd5b,null))[_0xe812('0x4a')](handleError(_0x39dd5b,null));};exports['addMessage']=function(_0x534234,_0x24c6ea,_0xa3567e){if(_0x534234[_0xe812('0x50')]['id']){delete _0x534234[_0xe812('0x50')]['id'];}return db[_0xe812('0x34')][_0xe812('0x4e')]({'where':{'id':_0x534234[_0xe812('0x4c')]['id']}})['then'](handleEntityNotFound(_0x24c6ea,null))['then'](function(_0x1f1625){if(_0x1f1625){_0x534234[_0xe812('0x50')][_0xe812('0x5d')]=_0x1f1625['id'];return db[_0xe812('0x5e')][_0xe812('0x4f')](_0x534234[_0xe812('0x50')]);}})[_0xe812('0x2d')](respondWithResult(_0x24c6ea,null))['catch'](handleError(_0x24c6ea,null));};exports['getMessages']=function(_0x530d19,_0x4ef0a4,_0x137b55){var _0x1e3e99={};var _0x52cf6b={};var _0x112eb1;var _0x4f4149;return db[_0xe812('0x34')][_0xe812('0x5f')]({'where':{'id':_0x530d19[_0xe812('0x4c')]['id']}})['then'](handleEntityNotFound(_0x4ef0a4,null))[_0xe812('0x2d')](function(_0x1a2fcf){if(_0x1a2fcf){_0x112eb1=_0x1a2fcf;_0x52cf6b[_0xe812('0x3f')]=_['keys'](db[_0xe812('0x5e')]['rawAttributes']);_0x52cf6b[_0xe812('0x38')]=_[_0xe812('0x39')](_0x530d19['query']);_0x52cf6b[_0xe812('0x3a')]=_[_0xe812('0x3b')](_0x52cf6b[_0xe812('0x3f')],_0x52cf6b['query']);_0x1e3e99[_0xe812('0x3c')]=_[_0xe812('0x3b')](_0x52cf6b['model'],qs[_0xe812('0x3d')](_0x530d19[_0xe812('0x38')][_0xe812('0x3d')]));_0x1e3e99[_0xe812('0x3c')]=_0x1e3e99['attributes']['length']?_0x1e3e99[_0xe812('0x3c')]:_0x52cf6b[_0xe812('0x3f')];_0x1e3e99[_0xe812('0x60')]=qs[_0xe812('0x41')](_0x530d19['query']['sort']);_0x1e3e99['where']=qs['filters'](_[_0xe812('0x42')](_0x530d19[_0xe812('0x38')],_0x52cf6b[_0xe812('0x3a')]));if(_0x530d19[_0xe812('0x38')]['filter']){_0x1e3e99['where']=_[_0xe812('0x44')](_0x1e3e99[_0xe812('0x45')],{'$or':_['map'](_0x1e3e99[_0xe812('0x3c')],function(_0x99439c){var _0x458c19={};_0x458c19[_0x99439c]={'$like':'%'+_0x530d19[_0xe812('0x38')][_0xe812('0x43')]+'%'};return _0x458c19;})});}if(_0x530d19[_0xe812('0x38')]['$gte']){var _0x3d2d8e=_0x530d19['query'][_0xe812('0x61')][_0xe812('0x62')](',');var _0x44df2e={};_0x44df2e[_0x3d2d8e[0x0]]={'$gte':moment(_0x3d2d8e[0x1])[_0xe812('0x63')](_0xe812('0x64'))};_0x1e3e99['where']=_['merge'](_0x1e3e99[_0xe812('0x45')],_0x44df2e);}_0x1e3e99=_[_0xe812('0x44')]({},_0x1e3e99,_0x530d19[_0xe812('0x4d')]);return _0x112eb1[_0xe812('0x65')](_0x1e3e99);}})['then'](function(_0x294395){if(_0x294395){_0x4f4149=_0x294395[_0xe812('0x3e')];if(!_0x530d19['query'][_0xe812('0x40')](_0xe812('0x5b'))){_0x1e3e99[_0xe812('0x26')]=qs['limit'](_0x530d19[_0xe812('0x38')][_0xe812('0x26')]);_0x1e3e99[_0xe812('0x23')]=qs[_0xe812('0x23')](_0x530d19['query'][_0xe812('0x23')]);}return _0x112eb1[_0xe812('0x65')](_0x1e3e99);}})['then'](function(_0x19969e){if(_0x19969e){return _0x19969e?{'count':_0x4f4149,'rows':_0x19969e}:null;}})[_0xe812('0x2d')](respondWithResult(_0x4ef0a4,null))[_0xe812('0x4a')](handleError(_0x4ef0a4,null));}; \ No newline at end of file +var _0xa277=['getMessages','findOne','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','defaults','redis','localhost','./chatGroup.socket','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','index','rawAttributes','fieldName','type','key','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','filters','pick','where','merge','VIRTUAL','filter','options','includeAll','include','ChatGroup','findAll','rows','catch','find','create','body','update','params','describe','ChatInternalMessage','addMembers','omit','User','order','getMembers','removeMembers'];(function(_0x173f10,_0x35db61){var _0x53142d=function(_0x37bbef){while(--_0x37bbef){_0x173f10['push'](_0x173f10['shift']());}};_0x53142d(++_0x35db61);}(_0xa277,0x1f0));var _0x7a27=function(_0x180131,_0x28e667){_0x180131=_0x180131-0x0;var _0x13755b=_0xa277[_0x180131];return _0x13755b;};'use strict';var emlformat=require(_0x7a27('0x0'));var rimraf=require(_0x7a27('0x1'));var zipdir=require(_0x7a27('0x2'));var jsonpatch=require(_0x7a27('0x3'));var rp=require(_0x7a27('0x4'));var moment=require('moment');var BPromise=require(_0x7a27('0x5'));var Mustache=require(_0x7a27('0x6'));var util=require(_0x7a27('0x7'));var path=require('path');var sox=require(_0x7a27('0x8'));var csv=require(_0x7a27('0x9'));var ejs=require(_0x7a27('0xa'));var fs=require('fs');var fs_extra=require(_0x7a27('0xb'));var _=require(_0x7a27('0xc'));var squel=require('squel');var crypto=require(_0x7a27('0xd'));var jsforce=require(_0x7a27('0xe'));var deskjs=require(_0x7a27('0xf'));var toCsv=require(_0x7a27('0x9'));var querystring=require(_0x7a27('0x10'));var Papa=require(_0x7a27('0x11'));var Redis=require(_0x7a27('0x12'));var authService=require(_0x7a27('0x13'));var qs=require(_0x7a27('0x14'));var as=require(_0x7a27('0x15'));var hardwareService=require(_0x7a27('0x16'));var logger=require('../../config/logger')(_0x7a27('0x17'));var utils=require(_0x7a27('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7a27('0x19'));var db=require(_0x7a27('0x1a'))['db'];config['redis']=_[_0x7a27('0x1b')](config[_0x7a27('0x1c')],{'host':_0x7a27('0x1d'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x7a27('0x1e'))['register'](socket);function respondWithStatusCode(_0x3a9dd1,_0x3f4482){_0x3f4482=_0x3f4482||0xcc;return function(_0x5f0262){if(_0x5f0262){return _0x3a9dd1[_0x7a27('0x1f')](_0x3f4482);}return _0x3a9dd1[_0x7a27('0x20')](_0x3f4482)[_0x7a27('0x21')]();};}function respondWithResult(_0x4c4579,_0x28b608){_0x28b608=_0x28b608||0xc8;return function(_0x1433ae){if(_0x1433ae){return _0x4c4579[_0x7a27('0x20')](_0x28b608)[_0x7a27('0x22')](_0x1433ae);}};}function respondWithFilteredResult(_0x3bd962,_0x2ff936){return function(_0x290e25){if(_0x290e25){var _0x480deb=typeof _0x2ff936[_0x7a27('0x23')]===_0x7a27('0x24')&&typeof _0x2ff936[_0x7a27('0x25')]===_0x7a27('0x24');var _0x4befc8=_0x290e25['count'];var _0x2e13a7=_0x480deb?0x0:_0x2ff936[_0x7a27('0x23')];var _0x340925=_0x480deb?_0x290e25[_0x7a27('0x26')]:_0x2ff936[_0x7a27('0x23')]+_0x2ff936[_0x7a27('0x25')];var _0x2c0fcf;if(_0x340925>=_0x4befc8){_0x340925=_0x4befc8;_0x2c0fcf=0xc8;}else{_0x2c0fcf=0xce;}_0x3bd962[_0x7a27('0x20')](_0x2c0fcf);return _0x3bd962[_0x7a27('0x27')](_0x7a27('0x28'),_0x2e13a7+'-'+_0x340925+'/'+_0x4befc8)['json'](_0x290e25);}return null;};}function patchUpdates(_0x26e71e){return function(_0xf71b3c){try{jsonpatch[_0x7a27('0x29')](_0xf71b3c,_0x26e71e,!![]);}catch(_0x8c3777){return BPromise[_0x7a27('0x2a')](_0x8c3777);}return _0xf71b3c[_0x7a27('0x2b')]();};}function saveUpdates(_0x59bab5,_0x509e20){return function(_0xb85130){if(_0xb85130){return _0xb85130['update'](_0x59bab5)[_0x7a27('0x2c')](function(_0x6dc1a4){return _0x6dc1a4;});}return null;};}function removeEntity(_0x1f3810,_0x20dbc4){return function(_0x4f9732){if(_0x4f9732){return _0x4f9732[_0x7a27('0x2d')]()['then'](function(){_0x1f3810[_0x7a27('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1126c7,_0xb7dbde){return function(_0x3af1a3){if(!_0x3af1a3){_0x1126c7['sendStatus'](0x194);}return _0x3af1a3;};}function handleError(_0x3f46af,_0x1fbf01){_0x1fbf01=_0x1fbf01||0x1f4;return function(_0x4f51f1){logger[_0x7a27('0x2e')](_0x4f51f1[_0x7a27('0x2f')]);if(_0x4f51f1[_0x7a27('0x30')]){delete _0x4f51f1['name'];}_0x3f46af['status'](_0x1fbf01)[_0x7a27('0x31')](_0x4f51f1);};}exports[_0x7a27('0x32')]=function(_0x4da785,_0x1191ee){var _0x1eec5c={},_0x7befcc={},_0x48686a={'count':0x0,'rows':[]};var _0x11e570=_['map'](db['ChatGroup'][_0x7a27('0x33')],function(_0x1436f5){return{'name':_0x1436f5[_0x7a27('0x34')],'type':_0x1436f5[_0x7a27('0x35')][_0x7a27('0x36')]};});_0x7befcc[_0x7a27('0x37')]=_[_0x7a27('0x38')](_0x11e570,'name');_0x7befcc[_0x7a27('0x39')]=_[_0x7a27('0x3a')](_0x4da785[_0x7a27('0x39')]);_0x7befcc['filters']=_[_0x7a27('0x3b')](_0x7befcc[_0x7a27('0x37')],_0x7befcc[_0x7a27('0x39')]);_0x1eec5c[_0x7a27('0x3c')]=_[_0x7a27('0x3b')](_0x7befcc[_0x7a27('0x37')],qs['fields'](_0x4da785['query'][_0x7a27('0x3d')]));_0x1eec5c['attributes']=_0x1eec5c[_0x7a27('0x3c')][_0x7a27('0x3e')]?_0x1eec5c[_0x7a27('0x3c')]:_0x7befcc[_0x7a27('0x37')];if(!_0x4da785['query'][_0x7a27('0x3f')](_0x7a27('0x40'))){_0x1eec5c[_0x7a27('0x25')]=qs[_0x7a27('0x25')](_0x4da785[_0x7a27('0x39')][_0x7a27('0x25')]);_0x1eec5c[_0x7a27('0x23')]=qs[_0x7a27('0x23')](_0x4da785['query']['offset']);}_0x1eec5c['order']=qs['sort'](_0x4da785[_0x7a27('0x39')][_0x7a27('0x41')]);_0x1eec5c['where']=qs[_0x7a27('0x42')](_[_0x7a27('0x43')](_0x4da785[_0x7a27('0x39')],_0x7befcc[_0x7a27('0x42')]),_0x11e570);if(_0x4da785['query']['filter']){_0x1eec5c[_0x7a27('0x44')]=_[_0x7a27('0x45')](_0x1eec5c[_0x7a27('0x44')],{'$or':_[_0x7a27('0x38')](_0x11e570,function(_0x1fb3b5){if(_0x1fb3b5[_0x7a27('0x35')]!==_0x7a27('0x46')){var _0xa03ebd={};_0xa03ebd[_0x1fb3b5[_0x7a27('0x30')]]={'$like':'%'+_0x4da785[_0x7a27('0x39')][_0x7a27('0x47')]+'%'};return _0xa03ebd;}})});}_0x1eec5c=_[_0x7a27('0x45')]({},_0x1eec5c,_0x4da785[_0x7a27('0x48')]);var _0x594078={'where':_0x1eec5c[_0x7a27('0x44')]};return db['ChatGroup'][_0x7a27('0x26')](_0x594078)[_0x7a27('0x2c')](function(_0x24a3ae){_0x48686a[_0x7a27('0x26')]=_0x24a3ae;if(_0x4da785['query'][_0x7a27('0x49')]){_0x1eec5c[_0x7a27('0x4a')]=[{'all':!![]}];}return db[_0x7a27('0x4b')][_0x7a27('0x4c')](_0x1eec5c);})[_0x7a27('0x2c')](function(_0x2c7a6c){_0x48686a[_0x7a27('0x4d')]=_0x2c7a6c;return _0x48686a;})[_0x7a27('0x2c')](respondWithFilteredResult(_0x1191ee,_0x1eec5c))[_0x7a27('0x4e')](handleError(_0x1191ee,null));};exports['show']=function(_0x5f4f23,_0x41b00e){var _0x76f894={'raw':!![],'where':{'id':_0x5f4f23['params']['id']}},_0x1cdd7e={};_0x1cdd7e[_0x7a27('0x37')]=_[_0x7a27('0x3a')](db['ChatGroup']['rawAttributes']);_0x1cdd7e[_0x7a27('0x39')]=_[_0x7a27('0x3a')](_0x5f4f23[_0x7a27('0x39')]);_0x1cdd7e['filters']=_[_0x7a27('0x3b')](_0x1cdd7e['model'],_0x1cdd7e[_0x7a27('0x39')]);_0x76f894[_0x7a27('0x3c')]=_[_0x7a27('0x3b')](_0x1cdd7e[_0x7a27('0x37')],qs[_0x7a27('0x3d')](_0x5f4f23['query'][_0x7a27('0x3d')]));_0x76f894[_0x7a27('0x3c')]=_0x76f894[_0x7a27('0x3c')][_0x7a27('0x3e')]?_0x76f894[_0x7a27('0x3c')]:_0x1cdd7e[_0x7a27('0x37')];if(_0x5f4f23['query']['includeAll']){_0x76f894['include']=[{'all':!![]}];}_0x76f894=_[_0x7a27('0x45')]({},_0x76f894,_0x5f4f23[_0x7a27('0x48')]);return db[_0x7a27('0x4b')][_0x7a27('0x4f')](_0x76f894)[_0x7a27('0x2c')](handleEntityNotFound(_0x41b00e,null))[_0x7a27('0x2c')](respondWithResult(_0x41b00e,null))[_0x7a27('0x4e')](handleError(_0x41b00e,null));};exports[_0x7a27('0x50')]=function(_0x3072bc,_0x5840b0){return db[_0x7a27('0x4b')][_0x7a27('0x50')](_0x3072bc[_0x7a27('0x51')],{})[_0x7a27('0x2c')](respondWithResult(_0x5840b0,0xc9))[_0x7a27('0x4e')](handleError(_0x5840b0,null));};exports[_0x7a27('0x52')]=function(_0x2e16b2,_0x1b08dc){if(_0x2e16b2['body']['id']){delete _0x2e16b2[_0x7a27('0x51')]['id'];}return db[_0x7a27('0x4b')][_0x7a27('0x4f')]({'where':{'id':_0x2e16b2[_0x7a27('0x53')]['id']}})['then'](handleEntityNotFound(_0x1b08dc,null))[_0x7a27('0x2c')](saveUpdates(_0x2e16b2[_0x7a27('0x51')],null))[_0x7a27('0x2c')](respondWithResult(_0x1b08dc,null))[_0x7a27('0x4e')](handleError(_0x1b08dc,null));};exports[_0x7a27('0x2d')]=function(_0x2ff167,_0x7879ad){return db[_0x7a27('0x4b')][_0x7a27('0x4f')]({'where':{'id':_0x2ff167['params']['id']}})[_0x7a27('0x2c')](handleEntityNotFound(_0x7879ad,null))[_0x7a27('0x2c')](removeEntity(_0x7879ad,null))[_0x7a27('0x4e')](handleError(_0x7879ad,null));};exports[_0x7a27('0x54')]=function(_0x3d8d92,_0xe2ce79){return db[_0x7a27('0x4b')]['describe']()[_0x7a27('0x2c')](respondWithResult(_0xe2ce79,null))[_0x7a27('0x4e')](handleError(_0xe2ce79,null));};exports['getUnread']=function(_0x30f38c,_0x26ae7c,_0x3ecba2){return db[_0x7a27('0x55')][_0x7a27('0x26')]({'where':{'ChatGroupId':_0x30f38c[_0x7a27('0x53')]['id'],'ToId':_0x30f38c['user']['id'],'read':![]}})[_0x7a27('0x2c')](function(_0x7f9ba){return{'id':_['toInteger'](_0x30f38c['params']['id']),'count':_0x7f9ba};})[_0x7a27('0x2c')](respondWithResult(_0x26ae7c,null))['catch'](handleError(_0x26ae7c,null));};exports[_0x7a27('0x56')]=function(_0x2a4142,_0x24d20e,_0x1b9e14){return db[_0x7a27('0x4b')][_0x7a27('0x4f')]({'where':{'id':_0x2a4142[_0x7a27('0x53')]['id']}})[_0x7a27('0x2c')](handleEntityNotFound(_0x24d20e,null))[_0x7a27('0x2c')](function(_0xe09070){if(_0xe09070){return _0xe09070[_0x7a27('0x56')](_0x2a4142['body']['ids'],_[_0x7a27('0x57')](_0x2a4142['body'],['ids','id'])||{});}})[_0x7a27('0x2c')](respondWithResult(_0x24d20e,null))[_0x7a27('0x4e')](handleError(_0x24d20e,null));};exports['getMembers']=function(_0x21c30b,_0x1f051e,_0x528b88){var _0x576537={};var _0x422135={};var _0x5628b7;var _0x5042d6;return db[_0x7a27('0x4b')]['findOne']({'where':{'id':_0x21c30b[_0x7a27('0x53')]['id']}})[_0x7a27('0x2c')](handleEntityNotFound(_0x1f051e,null))[_0x7a27('0x2c')](function(_0xd18baa){if(_0xd18baa){_0x5628b7=_0xd18baa;_0x422135[_0x7a27('0x37')]=_[_0x7a27('0x3a')](db[_0x7a27('0x58')][_0x7a27('0x33')]);_0x422135['query']=_[_0x7a27('0x3a')](_0x21c30b[_0x7a27('0x39')]);_0x422135['filters']=_[_0x7a27('0x3b')](_0x422135[_0x7a27('0x37')],_0x422135['query']);_0x576537['attributes']=_['intersection'](_0x422135['model'],qs[_0x7a27('0x3d')](_0x21c30b[_0x7a27('0x39')][_0x7a27('0x3d')]));_0x576537[_0x7a27('0x3c')]=_0x576537[_0x7a27('0x3c')][_0x7a27('0x3e')]?_0x576537[_0x7a27('0x3c')]:_0x422135[_0x7a27('0x37')];_0x576537[_0x7a27('0x59')]=qs[_0x7a27('0x41')](_0x21c30b['query'][_0x7a27('0x41')]);_0x576537['where']=qs[_0x7a27('0x42')](_['pick'](_0x21c30b[_0x7a27('0x39')],_0x422135[_0x7a27('0x42')]));if(_0x21c30b[_0x7a27('0x39')][_0x7a27('0x47')]){_0x576537[_0x7a27('0x44')]=_[_0x7a27('0x45')](_0x576537[_0x7a27('0x44')],{'$or':_[_0x7a27('0x38')](_0x576537['attributes'],function(_0x41629f){var _0x483711={};_0x483711[_0x41629f]={'$like':'%'+_0x21c30b[_0x7a27('0x39')][_0x7a27('0x47')]+'%'};return _0x483711;})});}_0x576537=_[_0x7a27('0x45')]({},_0x576537,_0x21c30b[_0x7a27('0x48')]);return _0x5628b7[_0x7a27('0x5a')](_0x576537);}})[_0x7a27('0x2c')](function(_0xb26db1){if(_0xb26db1){_0x5042d6=_0xb26db1[_0x7a27('0x3e')];if(!_0x21c30b[_0x7a27('0x39')][_0x7a27('0x3f')](_0x7a27('0x40'))){_0x576537[_0x7a27('0x25')]=qs[_0x7a27('0x25')](_0x21c30b[_0x7a27('0x39')][_0x7a27('0x25')]);_0x576537[_0x7a27('0x23')]=qs[_0x7a27('0x23')](_0x21c30b[_0x7a27('0x39')]['offset']);}return _0x5628b7['getMembers'](_0x576537);}})[_0x7a27('0x2c')](function(_0x51cfc9){if(_0x51cfc9){return _0x51cfc9?{'count':_0x5042d6,'rows':_0x51cfc9}:null;}})[_0x7a27('0x2c')](respondWithResult(_0x1f051e,null))[_0x7a27('0x4e')](handleError(_0x1f051e,null));};exports['removeMembers']=function(_0x5cb62b,_0x38c470,_0x31a133){return db[_0x7a27('0x4b')][_0x7a27('0x4f')]({'where':{'id':_0x5cb62b[_0x7a27('0x53')]['id']}})['then'](handleEntityNotFound(_0x38c470,null))[_0x7a27('0x2c')](function(_0x4b635f){if(_0x4b635f){return _0x4b635f[_0x7a27('0x5b')](_0x5cb62b[_0x7a27('0x39')]['ids']);}})['then'](respondWithStatusCode(_0x38c470,null))[_0x7a27('0x4e')](handleError(_0x38c470,null));};exports['addMessage']=function(_0x3b2b63,_0x3661e7,_0x5cd9e4){if(_0x3b2b63[_0x7a27('0x51')]['id']){delete _0x3b2b63[_0x7a27('0x51')]['id'];}return db[_0x7a27('0x4b')]['find']({'where':{'id':_0x3b2b63['params']['id']}})['then'](handleEntityNotFound(_0x3661e7,null))[_0x7a27('0x2c')](function(_0x2631ff){if(_0x2631ff){_0x3b2b63[_0x7a27('0x51')]['ChatGroupId']=_0x2631ff['id'];return db[_0x7a27('0x55')][_0x7a27('0x50')](_0x3b2b63[_0x7a27('0x51')]);}})['then'](respondWithResult(_0x3661e7,null))[_0x7a27('0x4e')](handleError(_0x3661e7,null));};exports[_0x7a27('0x5c')]=function(_0xd6544c,_0x2c17cf,_0x1bc540){var _0x5b385f={};var _0x4d05be={};var _0xb4a279;var _0x38e145;return db[_0x7a27('0x4b')][_0x7a27('0x5d')]({'where':{'id':_0xd6544c['params']['id']}})[_0x7a27('0x2c')](handleEntityNotFound(_0x2c17cf,null))[_0x7a27('0x2c')](function(_0x4701c4){if(_0x4701c4){_0xb4a279=_0x4701c4;_0x4d05be[_0x7a27('0x37')]=_[_0x7a27('0x3a')](db[_0x7a27('0x55')]['rawAttributes']);_0x4d05be['query']=_[_0x7a27('0x3a')](_0xd6544c[_0x7a27('0x39')]);_0x4d05be['filters']=_[_0x7a27('0x3b')](_0x4d05be['model'],_0x4d05be[_0x7a27('0x39')]);_0x5b385f['attributes']=_[_0x7a27('0x3b')](_0x4d05be[_0x7a27('0x37')],qs[_0x7a27('0x3d')](_0xd6544c[_0x7a27('0x39')][_0x7a27('0x3d')]));_0x5b385f['attributes']=_0x5b385f[_0x7a27('0x3c')][_0x7a27('0x3e')]?_0x5b385f[_0x7a27('0x3c')]:_0x4d05be[_0x7a27('0x37')];_0x5b385f['order']=qs[_0x7a27('0x41')](_0xd6544c[_0x7a27('0x39')][_0x7a27('0x41')]);_0x5b385f[_0x7a27('0x44')]=qs[_0x7a27('0x42')](_[_0x7a27('0x43')](_0xd6544c[_0x7a27('0x39')],_0x4d05be['filters']));if(_0xd6544c[_0x7a27('0x39')][_0x7a27('0x47')]){_0x5b385f[_0x7a27('0x44')]=_[_0x7a27('0x45')](_0x5b385f[_0x7a27('0x44')],{'$or':_[_0x7a27('0x38')](_0x5b385f[_0x7a27('0x3c')],function(_0x5b3b69){var _0x535d7f={};_0x535d7f[_0x5b3b69]={'$like':'%'+_0xd6544c['query'][_0x7a27('0x47')]+'%'};return _0x535d7f;})});}if(_0xd6544c[_0x7a27('0x39')][_0x7a27('0x5e')]){var _0xf76bd7=_0xd6544c[_0x7a27('0x39')][_0x7a27('0x5e')][_0x7a27('0x5f')](',');var _0x3e755d={};_0x3e755d[_0xf76bd7[0x0]]={'$gte':moment(_0xf76bd7[0x1])[_0x7a27('0x60')](_0x7a27('0x61'))};_0x5b385f[_0x7a27('0x44')]=_[_0x7a27('0x45')](_0x5b385f[_0x7a27('0x44')],_0x3e755d);}_0x5b385f=_[_0x7a27('0x45')]({},_0x5b385f,_0xd6544c[_0x7a27('0x48')]);return _0xb4a279[_0x7a27('0x5c')](_0x5b385f);}})[_0x7a27('0x2c')](function(_0xbeb2a3){if(_0xbeb2a3){_0x38e145=_0xbeb2a3[_0x7a27('0x3e')];if(!_0xd6544c[_0x7a27('0x39')][_0x7a27('0x3f')](_0x7a27('0x40'))){_0x5b385f[_0x7a27('0x25')]=qs[_0x7a27('0x25')](_0xd6544c[_0x7a27('0x39')][_0x7a27('0x25')]);_0x5b385f['offset']=qs[_0x7a27('0x23')](_0xd6544c[_0x7a27('0x39')]['offset']);}return _0xb4a279['getMessages'](_0x5b385f);}})[_0x7a27('0x2c')](function(_0x1ea6a4){if(_0x1ea6a4){return _0x1ea6a4?{'count':_0x38e145,'rows':_0x1ea6a4}:null;}})[_0x7a27('0x2c')](respondWithResult(_0x2c17cf,null))['catch'](handleError(_0x2c17cf,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index 114b4d5..31ace2f 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 _0x8ff4=['setMaxListeners','save','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0xb3ba57,_0x3c90a8){var _0x5ce9d6=function(_0x4d66a9){while(--_0x4d66a9){_0xb3ba57['push'](_0xb3ba57['shift']());}};_0x5ce9d6(++_0x3c90a8);}(_0x8ff4,0x11f));var _0x48ff=function(_0x53be8d,_0x2cb53f){_0x53be8d=_0x53be8d-0x0;var _0x396d2c=_0x8ff4[_0x53be8d];return _0x396d2c;};'use strict';var EventEmitter=require(_0x48ff('0x0'));var ChatGroup=require('../../mysqldb')['db']['ChatGroup'];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0x48ff('0x1')](0x0);var events={'afterCreate':_0x48ff('0x2'),'afterUpdate':'update','afterDestroy':_0x48ff('0x3')};function emitEvent(_0xc4b32e){return function(_0x2e6166,_0x3fa416,_0x46de8a){ChatGroupEvents[_0x48ff('0x4')](_0xc4b32e+':'+_0x2e6166['id'],_0x2e6166);ChatGroupEvents[_0x48ff('0x4')](_0xc4b32e,_0x2e6166);_0x46de8a(null);};}for(var e in events){if(events[_0x48ff('0x5')](e)){var event=events[e];ChatGroup[_0x48ff('0x6')](e,emitEvent(event));}}module[_0x48ff('0x7')]=ChatGroupEvents; \ No newline at end of file +var _0x62a7=['save','update','remove','emit','hook','exports','../../mysqldb','ChatGroup','setMaxListeners'];(function(_0x92fc4e,_0x3e6d2b){var _0x1476c6=function(_0x32c8d0){while(--_0x32c8d0){_0x92fc4e['push'](_0x92fc4e['shift']());}};_0x1476c6(++_0x3e6d2b);}(_0x62a7,0x84));var _0x762a=function(_0x1f0c9b,_0x234e61){_0x1f0c9b=_0x1f0c9b-0x0;var _0x1283e6=_0x62a7[_0x1f0c9b];return _0x1283e6;};'use strict';var EventEmitter=require('events');var ChatGroup=require(_0x762a('0x0'))['db'][_0x762a('0x1')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0x762a('0x2')](0x0);var events={'afterCreate':_0x762a('0x3'),'afterUpdate':_0x762a('0x4'),'afterDestroy':_0x762a('0x5')};function emitEvent(_0x804ab8){return function(_0x2a0808,_0x5c5006,_0x58690b){ChatGroupEvents[_0x762a('0x6')](_0x804ab8+':'+_0x2a0808['id'],_0x2a0808);ChatGroupEvents[_0x762a('0x6')](_0x804ab8,_0x2a0808);_0x58690b(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatGroup[_0x762a('0x7')](e,emitEvent(event));}}module[_0x762a('0x8')]=ChatGroupEvents; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.model.js b/server/api/chatGroup/chatGroup.model.js index 0ee351c..a32ca60 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 _0xa5d7=['rimraf','../../config/environment','./chatGroup.attributes','define','ChatGroup','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x505473,_0x358249){var _0x1c466d=function(_0x525a9f){while(--_0x525a9f){_0x505473['push'](_0x505473['shift']());}};_0x1c466d(++_0x358249);}(_0xa5d7,0x94));var _0x7a5d=function(_0xba185f,_0x7c5e61){_0xba185f=_0xba185f-0x0;var _0x50c684=_0xa5d7[_0xba185f];return _0x50c684;};'use strict';var _=require(_0x7a5d('0x0'));var util=require(_0x7a5d('0x1'));var logger=require(_0x7a5d('0x2'))(_0x7a5d('0x3'));var moment=require(_0x7a5d('0x4'));var BPromise=require(_0x7a5d('0x5'));var rp=require(_0x7a5d('0x6'));var fs=require('fs');var path=require(_0x7a5d('0x7'));var rimraf=require(_0x7a5d('0x8'));var config=require(_0x7a5d('0x9'));var attributes=require(_0x7a5d('0xa'));module['exports']=function(_0x7fa601,_0x27022e){return _0x7fa601[_0x7a5d('0xb')](_0x7a5d('0xc'),attributes,{'tableName':'chat_groups','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7d93=['lodash','util','../../config/logger','path','rimraf','../../config/environment','./chatGroup.attributes','exports','define','ChatGroup'];(function(_0x3a498d,_0x43a314){var _0xe247b9=function(_0x543e7c){while(--_0x543e7c){_0x3a498d['push'](_0x3a498d['shift']());}};_0xe247b9(++_0x43a314);}(_0x7d93,0x1c2));var _0x37d9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7d93[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x37d9('0x0'));var util=require(_0x37d9('0x1'));var logger=require(_0x37d9('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x37d9('0x3'));var rimraf=require(_0x37d9('0x4'));var config=require(_0x37d9('0x5'));var attributes=require(_0x37d9('0x6'));module[_0x37d9('0x7')]=function(_0x32bd21,_0x278fdd){return _0x32bd21[_0x37d9('0x8')](_0x37d9('0x9'),attributes,{'tableName':'chat_groups','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.rpc.js b/server/api/chatGroup/chatGroup.rpc.js index b820020..124a8bb 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 _0xc15b=['randomstring','ioredis','../../config/logger','rpc','../../config/environment','redis','defaults','./chatGroup.socket','request','info','ChatGroup,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','moment','bluebird'];(function(_0x50eb38,_0x2ee6ba){var _0x5de7bf=function(_0x3558c7){while(--_0x3558c7){_0x50eb38['push'](_0x50eb38['shift']());}};_0x5de7bf(++_0x2ee6ba);}(_0xc15b,0xe4));var _0xbc15=function(_0x1a9204,_0x1c9e00){_0x1a9204=_0x1a9204-0x0;var _0x17ca68=_0xc15b[_0x1a9204];return _0x17ca68;};'use strict';var _=require(_0xbc15('0x0'));var util=require('util');var moment=require(_0xbc15('0x1'));var BPromise=require(_0xbc15('0x2'));var rs=require(_0xbc15('0x3'));var fs=require('fs');var Redis=require(_0xbc15('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xbc15('0x5'))(_0xbc15('0x6'));var config=require(_0xbc15('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config[_0xbc15('0x8')]=_[_0xbc15('0x9')](config[_0xbc15('0x8')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xbc15('0xa'))['register'](socket);function respondWithRpcPromise(_0x2189d4,_0x42f0b9,_0x359eb9){return new BPromise(function(_0x551a7b,_0x413eda){return client[_0xbc15('0xb')](_0x2189d4,_0x359eb9)['then'](function(_0xc677d5){logger[_0xbc15('0xc')](_0xbc15('0xd'),_0x42f0b9,'request\x20sent');logger['debug']('ChatGroup,\x20%s,\x20%s,\x20%s',_0x42f0b9,_0xbc15('0xe'),JSON[_0xbc15('0xf')](_0xc677d5));if(_0xc677d5[_0xbc15('0x10')]){if(_0xc677d5[_0xbc15('0x10')][_0xbc15('0x11')]===0x1f4){logger[_0xbc15('0x10')](_0xbc15('0xd'),_0x42f0b9,_0xc677d5[_0xbc15('0x10')][_0xbc15('0x12')]);return _0x413eda(_0xc677d5[_0xbc15('0x10')][_0xbc15('0x12')]);}logger[_0xbc15('0x10')](_0xbc15('0xd'),_0x42f0b9,_0xc677d5[_0xbc15('0x10')]['message']);return _0x551a7b(_0xc677d5[_0xbc15('0x10')]['message']);}else{logger[_0xbc15('0xc')](_0xbc15('0xd'),_0x42f0b9,_0xbc15('0xe'));_0x551a7b(_0xc677d5[_0xbc15('0x13')][_0xbc15('0x12')]);}})[_0xbc15('0x14')](function(_0x7e7826){logger[_0xbc15('0x10')](_0xbc15('0xd'),_0x42f0b9,_0x7e7826);_0x413eda(_0x7e7826);});});} \ No newline at end of file +var _0x919e=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','socket.io-emitter','./chatGroup.socket','register','then','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s','error','ChatGroup,\x20%s,\x20%s','message','info','catch','lodash','util','moment','randomstring'];(function(_0x1c33b5,_0x3445d8){var _0x5bf626=function(_0x449a63){while(--_0x449a63){_0x1c33b5['push'](_0x1c33b5['shift']());}};_0x5bf626(++_0x3445d8);}(_0x919e,0x1d7));var _0xe919=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x919e[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xe919('0x0'));var util=require(_0xe919('0x1'));var moment=require(_0xe919('0x2'));var BPromise=require('bluebird');var rs=require(_0xe919('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xe919('0x4'));var logger=require(_0xe919('0x5'))(_0xe919('0x6'));var config=require(_0xe919('0x7'));var jayson=require(_0xe919('0x8'));var client=jayson[_0xe919('0x9')][_0xe919('0xa')]({'port':0x232a});config['redis']=_[_0xe919('0xb')](config[_0xe919('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xe919('0xd'))(new Redis(config['redis']));require(_0xe919('0xe'))[_0xe919('0xf')](socket);function respondWithRpcPromise(_0x814c47,_0x58a7a7,_0x83759d){return new BPromise(function(_0x34e59e,_0x1da9c9){return client['request'](_0x814c47,_0x83759d)[_0xe919('0x10')](function(_0x50c6ff){logger['info']('ChatGroup,\x20%s,\x20%s',_0x58a7a7,_0xe919('0x11'));logger[_0xe919('0x12')](_0xe919('0x13'),_0x58a7a7,'request\x20sent',JSON['stringify'](_0x50c6ff));if(_0x50c6ff[_0xe919('0x14')]){if(_0x50c6ff[_0xe919('0x14')]['code']===0x1f4){logger[_0xe919('0x14')](_0xe919('0x15'),_0x58a7a7,_0x50c6ff[_0xe919('0x14')][_0xe919('0x16')]);return _0x1da9c9(_0x50c6ff[_0xe919('0x14')][_0xe919('0x16')]);}logger[_0xe919('0x14')]('ChatGroup,\x20%s,\x20%s',_0x58a7a7,_0x50c6ff[_0xe919('0x14')]['message']);return _0x34e59e(_0x50c6ff['error'][_0xe919('0x16')]);}else{logger[_0xe919('0x17')]('ChatGroup,\x20%s,\x20%s',_0x58a7a7,'request\x20sent');_0x34e59e(_0x50c6ff['result'][_0xe919('0x16')]);}})[_0xe919('0x18')](function(_0x2e0988){logger[_0xe919('0x14')]('ChatGroup,\x20%s,\x20%s',_0x58a7a7,_0x2e0988);_0x1da9c9(_0x2e0988);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index 54db341..07a6f5d 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 _0x299b=['./chatGroup.events','remove','update','emit','removeListener','register','chatGroup:'];(function(_0x20a35e,_0x477112){var _0x52bbe7=function(_0x494529){while(--_0x494529){_0x20a35e['push'](_0x20a35e['shift']());}};_0x52bbe7(++_0x477112);}(_0x299b,0x118));var _0xb299=function(_0x13843f,_0x50422d){_0x13843f=_0x13843f-0x0;var _0x1063ae=_0x299b[_0x13843f];return _0x1063ae;};'use strict';var ChatGroupEvents=require(_0xb299('0x0'));var events=['save',_0xb299('0x1'),_0xb299('0x2')];function createListener(_0x25aaba,_0x500567){return function(_0x3a10ce){_0x500567[_0xb299('0x3')](_0x25aaba,_0x3a10ce);};}function removeListener(_0x1ca9ec,_0x26139d){return function(){ChatGroupEvents[_0xb299('0x4')](_0x1ca9ec,_0x26139d);};}exports[_0xb299('0x5')]=function(_0x5b3f02){for(var _0x37dc00=0x0,_0x3ed409=events['length'];_0x37dc00<_0x3ed409;_0x37dc00++){var _0x1eb304=events[_0x37dc00];var _0x41edbb=createListener(_0xb299('0x6')+_0x1eb304,_0x5b3f02);ChatGroupEvents['on'](_0x1eb304,_0x41edbb);}}; \ No newline at end of file +var _0xee06=['removeListener','length','./chatGroup.events','save','remove','update','emit'];(function(_0x36c6eb,_0x4fb127){var _0x30675b=function(_0x3a788b){while(--_0x3a788b){_0x36c6eb['push'](_0x36c6eb['shift']());}};_0x30675b(++_0x4fb127);}(_0xee06,0x19f));var _0x6ee0=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xee06[_0x3dd15e];return _0x231fd0;};'use strict';var ChatGroupEvents=require(_0x6ee0('0x0'));var events=[_0x6ee0('0x1'),_0x6ee0('0x2'),_0x6ee0('0x3')];function createListener(_0x56ed68,_0x284013){return function(_0x16e380){_0x284013[_0x6ee0('0x4')](_0x56ed68,_0x16e380);};}function removeListener(_0x3f660c,_0x36ed40){return function(){ChatGroupEvents[_0x6ee0('0x5')](_0x3f660c,_0x36ed40);};}exports['register']=function(_0x5ec9b9){for(var _0x5b9136=0x0,_0x584d20=events[_0x6ee0('0x6')];_0x5b9136<_0x584d20;_0x5b9136++){var _0x3b4f69=events[_0x5b9136];var _0x157fd0=createListener('chatGroup:'+_0x3b4f69,_0x5ec9b9);ChatGroupEvents['on'](_0x3b4f69,_0x157fd0);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index 13ad9d6..9ac41a1 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 _0xe0d8=['util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./chatGroup.controller','get','isAuthenticated','index','describe','/:id','/:id/unread','getUnread','/:id/members','getMembers','/:id/messages','post','create','addMembers','put','delete','destroy','removeMembers','multer'];(function(_0x223a3e,_0x2da798){var _0x582005=function(_0x4adba8){while(--_0x4adba8){_0x223a3e['push'](_0x223a3e['shift']());}};_0x582005(++_0x2da798);}(_0xe0d8,0x185));var _0x8e0d=function(_0x3d4ef1,_0x5a957c){_0x3d4ef1=_0x3d4ef1-0x0;var _0x409423=_0xe0d8[_0x3d4ef1];return _0x409423;};'use strict';var multer=require(_0x8e0d('0x0'));var util=require(_0x8e0d('0x1'));var path=require(_0x8e0d('0x2'));var timeout=require(_0x8e0d('0x3'));var express=require(_0x8e0d('0x4'));var router=express['Router']();var fs_extra=require(_0x8e0d('0x5'));var auth=require(_0x8e0d('0x6'));var interaction=require(_0x8e0d('0x7'));var config=require('../../config/environment');var controller=require(_0x8e0d('0x8'));router[_0x8e0d('0x9')]('/',auth[_0x8e0d('0xa')](),controller[_0x8e0d('0xb')]);router[_0x8e0d('0x9')]('/describe',auth[_0x8e0d('0xa')](),controller[_0x8e0d('0xc')]);router[_0x8e0d('0x9')](_0x8e0d('0xd'),auth['isAuthenticated'](),controller['show']);router['get'](_0x8e0d('0xe'),auth[_0x8e0d('0xa')](),controller[_0x8e0d('0xf')]);router[_0x8e0d('0x9')](_0x8e0d('0x10'),auth['isAuthenticated'](),controller[_0x8e0d('0x11')]);router['get'](_0x8e0d('0x12'),auth[_0x8e0d('0xa')](),controller['getMessages']);router[_0x8e0d('0x13')]('/',auth['isAuthenticated'](),controller[_0x8e0d('0x14')]);router['post']('/:id/members',auth[_0x8e0d('0xa')](),controller[_0x8e0d('0x15')]);router[_0x8e0d('0x13')](_0x8e0d('0x12'),auth['isAuthenticated'](),controller['addMessage']);router[_0x8e0d('0x16')](_0x8e0d('0xd'),auth['isAuthenticated'](),controller['update']);router[_0x8e0d('0x17')](_0x8e0d('0xd'),auth[_0x8e0d('0xa')](),controller[_0x8e0d('0x18')]);router[_0x8e0d('0x17')](_0x8e0d('0x10'),auth[_0x8e0d('0xa')](),controller[_0x8e0d('0x19')]);module['exports']=router; \ No newline at end of file +var _0x3687=['path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','getUnread','getMembers','getMessages','create','post','addMembers','addMessage','update','delete','destroy','exports','multer','util'];(function(_0x5c1f3b,_0xb93a7e){var _0x3496e0=function(_0xac66aa){while(--_0xac66aa){_0x5c1f3b['push'](_0x5c1f3b['shift']());}};_0x3496e0(++_0xb93a7e);}(_0x3687,0x1e4));var _0x7368=function(_0x475198,_0x30c1fa){_0x475198=_0x475198-0x0;var _0x5b6ee7=_0x3687[_0x475198];return _0x5b6ee7;};'use strict';var multer=require(_0x7368('0x0'));var util=require(_0x7368('0x1'));var path=require(_0x7368('0x2'));var timeout=require(_0x7368('0x3'));var express=require(_0x7368('0x4'));var router=express[_0x7368('0x5')]();var fs_extra=require(_0x7368('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x7368('0x7'));var config=require(_0x7368('0x8'));var controller=require('./chatGroup.controller');router[_0x7368('0x9')]('/',auth[_0x7368('0xa')](),controller[_0x7368('0xb')]);router[_0x7368('0x9')](_0x7368('0xc'),auth[_0x7368('0xa')](),controller[_0x7368('0xd')]);router[_0x7368('0x9')](_0x7368('0xe'),auth[_0x7368('0xa')](),controller[_0x7368('0xf')]);router[_0x7368('0x9')]('/:id/unread',auth[_0x7368('0xa')](),controller[_0x7368('0x10')]);router[_0x7368('0x9')]('/:id/members',auth['isAuthenticated'](),controller[_0x7368('0x11')]);router[_0x7368('0x9')]('/:id/messages',auth[_0x7368('0xa')](),controller[_0x7368('0x12')]);router['post']('/',auth[_0x7368('0xa')](),controller[_0x7368('0x13')]);router[_0x7368('0x14')]('/:id/members',auth['isAuthenticated'](),controller[_0x7368('0x15')]);router[_0x7368('0x14')]('/:id/messages',auth[_0x7368('0xa')](),controller[_0x7368('0x16')]);router['put'](_0x7368('0xe'),auth[_0x7368('0xa')](),controller[_0x7368('0x17')]);router[_0x7368('0x18')](_0x7368('0xe'),auth[_0x7368('0xa')](),controller[_0x7368('0x19')]);router[_0x7368('0x18')]('/:id/members',auth['isAuthenticated'](),controller['removeMembers']);module[_0x7368('0x1a')]=router; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.attributes.js b/server/api/chatInteraction/chatInteraction.attributes.js index 118ad12..e66b440 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 _0x38c9=['long','out','sequelize','exports','BOOLEAN','ENUM','star','thumb','TEXT','STRING','DATE'];(function(_0x3d0719,_0x53156d){var _0x1eedfd=function(_0xc07d52){while(--_0xc07d52){_0x3d0719['push'](_0x3d0719['shift']());}};_0x1eedfd(++_0x53156d);}(_0x38c9,0x199));var _0x938c=function(_0x2f4c1c,_0x5a3dd4){_0x2f4c1c=_0x2f4c1c-0x0;var _0x25e0f2=_0x38c9[_0x2f4c1c];return _0x25e0f2;};'use strict';var Sequelize=require(_0x938c('0x0'));module[_0x938c('0x1')]={'closed':{'type':Sequelize[_0x938c('0x2')],'defaultValue':![]},'ratingValue':{'type':Sequelize['INTEGER']},'ratingType':{'type':Sequelize[_0x938c('0x3')](_0x938c('0x4'),_0x938c('0x5')),'defaultValue':_0x938c('0x4')},'ratingMessage':{'type':Sequelize['TEXT']},'pathTranscript':{'type':Sequelize[_0x938c('0x6')]},'mailTranscript':{'type':Sequelize[_0x938c('0x7')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x938c('0x8')]},'disposition':{'type':Sequelize[_0x938c('0x7')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x938c('0x7')]},'note':{'type':Sequelize[_0x938c('0x7')]},'browserName':{'type':Sequelize[_0x938c('0x7')]},'browserVersion':{'type':Sequelize[_0x938c('0x7')]},'osName':{'type':Sequelize['STRING']},'osVersion':{'type':Sequelize['STRING']},'deviceModel':{'type':Sequelize[_0x938c('0x7')]},'deviceVendor':{'type':Sequelize[_0x938c('0x7')]},'deviceType':{'type':Sequelize[_0x938c('0x7')]},'referer':{'type':Sequelize[_0x938c('0x6')]},'customerIp':{'type':Sequelize[_0x938c('0x7')]},'formData':{'type':Sequelize[_0x938c('0x6')](_0x938c('0x9'))},'read1stAt':{'type':Sequelize[_0x938c('0x8')]},'lastMsgAt':{'type':Sequelize[_0x938c('0x8')]},'lastMsgDirection':{'type':Sequelize[_0x938c('0x3')]('in',_0x938c('0xa')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0x938c('0x7')]},'customerPort':{'type':Sequelize[_0x938c('0x7')]},'vidaooSessionId':{'type':Sequelize[_0x938c('0x6')]},'autoreplyExecuted':{'type':Sequelize[_0x938c('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0x6324=['long','ENUM','out','sequelize','exports','BOOLEAN','INTEGER','star','TEXT','DATE','STRING'];(function(_0x177fb5,_0x3962f9){var _0x1b8128=function(_0x5514ff){while(--_0x5514ff){_0x177fb5['push'](_0x177fb5['shift']());}};_0x1b8128(++_0x3962f9);}(_0x6324,0x142));var _0x4632=function(_0x255c48,_0x2a4449){_0x255c48=_0x255c48-0x0;var _0xaebda3=_0x6324[_0x255c48];return _0xaebda3;};'use strict';var Sequelize=require(_0x4632('0x0'));module[_0x4632('0x1')]={'closed':{'type':Sequelize[_0x4632('0x2')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0x4632('0x3')]},'ratingType':{'type':Sequelize['ENUM'](_0x4632('0x4'),'thumb'),'defaultValue':_0x4632('0x4')},'ratingMessage':{'type':Sequelize['TEXT']},'pathTranscript':{'type':Sequelize[_0x4632('0x5')]},'mailTranscript':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x4632('0x6')]},'disposition':{'type':Sequelize[_0x4632('0x7')]},'secondDisposition':{'type':Sequelize[_0x4632('0x7')]},'thirdDisposition':{'type':Sequelize[_0x4632('0x7')]},'note':{'type':Sequelize['STRING']},'browserName':{'type':Sequelize[_0x4632('0x7')]},'browserVersion':{'type':Sequelize[_0x4632('0x7')]},'osName':{'type':Sequelize[_0x4632('0x7')]},'osVersion':{'type':Sequelize['STRING']},'deviceModel':{'type':Sequelize[_0x4632('0x7')]},'deviceVendor':{'type':Sequelize[_0x4632('0x7')]},'deviceType':{'type':Sequelize['STRING']},'referer':{'type':Sequelize['TEXT']},'customerIp':{'type':Sequelize[_0x4632('0x7')]},'formData':{'type':Sequelize[_0x4632('0x5')](_0x4632('0x8'))},'read1stAt':{'type':Sequelize[_0x4632('0x6')]},'lastMsgAt':{'type':Sequelize[_0x4632('0x6')]},'lastMsgDirection':{'type':Sequelize[_0x4632('0x9')]('in',_0x4632('0xa')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0x4632('0x7')]},'customerPort':{'type':Sequelize['STRING']},'vidaooSessionId':{'type':Sequelize[_0x4632('0x5')]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.controller.js b/server/api/chatInteraction/chatInteraction.controller.js index d1efeb8..0cad000 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 _0xbaf0=['../../components/export/pdf','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','redis','defaults','socket.io-emitter','./chatInteraction.socket','register','jayson/promise','client','http','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','destroy','stack','name','body','contact','agent','interaction','account','Users','map','fullname','TagIds','Tags','split','forEach','push','index','ChatInteraction','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','select','field','color','tools_tags','u.id','u.fullname','ui.ChatInteractionId','from','user_has_chat_interactions','left_join','users','chat_interactions','cm_contacts','o.id\x20=\x20i.UserId','chat_websites','a.id\x20=\x20i.ChatWebsiteId','chat_interaction_has_tags','it.ChatInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','having','`\x20=\x200','`\x20>\x200','Contact','operator','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','value','ContactId','buildExpression','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','$substring','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','find','UserId','compact','isEmpty','ChatWebsiteId','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages','contactName','DESC','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','role','user','getChatWebsites','i.ChatWebsiteId\x20IS\x20NULL','i.ChatWebsiteId\x20IN\x20?','sequelize','toString','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.*','Contact.firstName','c.lastName','Contact.lastName','c.email','c.phone','c.mobile','Contact.mobile','c.fax','Owner.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.ChatInteractionId\x20IN\x20?','groupBy','ChatInteractionId','all','rows','show','params','rawAttributes','includeAll','include','options','create','describe','createVidaooSession','findOne','ChatWebsite','vidaooApiKey','vidaooEscalation','vidaooTopic','vidaooMetadata','email','POST','isNull','vidaooNote','follow','Sequelize','ValidationError','Error\x20in\x20Vidaoo\x20configuration','join_url','out','updateAttributes','CmContact','abandon','entity\x20not\x20found','Interaction\x20already\x20assigned','closed','AbandonInteraction','file','originalname','basename','filename','mimetype','attachId','join','root','server/files/attachments/','offline-chat/','download','close','mailTranscript','format','transcript-%s.txt','pathTranscript','ChatMessage','Messages','User','%s%d','agentAlias','System','customer','website_alias','agent_alias','alias','agent_fullname','[%s]\x20%s:\x20%s\x0a','MM/DD/YYYY\x20HH:mm:ss','direction','secret','appendFileSync','MailAccount','MailServerOut','Smtp','service','host','port','secure','authentication','auth','pass','Mail\x20Transcript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','ids','omit','getMessages','findAll','getMyMessages','includeAgent','addTags','setTags','emit','chatInteractionTags:save','removeTags','unix','tmp','server','files','attachments','firstName','lastName','Attachment','Owner','get','mkdirSync','Chat','YYYY-MM-DD\x20HH:mm:ss','disposition','browserName','osName','referer','customerIp','customerPort','N.A.','tail','existsSync','createReadStream','pipe','createWriteStream','renderFile','views','downloadInteraction.ejs','.pdf','createPdfFromHTML','log','err','unlinkSync','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x10c988,_0x1a5956){var _0x4a4dcd=function(_0x4d96da){while(--_0x4d96da){_0x10c988['push'](_0x10c988['shift']());}};_0x4a4dcd(++_0x1a5956);}(_0xbaf0,0x12a));var _0x0baf=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xbaf0[_0x6c993a];return _0x27f547;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0baf('0x0'));var zipdir=require(_0x0baf('0x1'));var jsonpatch=require(_0x0baf('0x2'));var rp=require(_0x0baf('0x3'));var moment=require(_0x0baf('0x4'));var BPromise=require(_0x0baf('0x5'));var Mustache=require('mustache');var util=require(_0x0baf('0x6'));var path=require(_0x0baf('0x7'));var sox=require(_0x0baf('0x8'));var csv=require(_0x0baf('0x9'));var ejs=require(_0x0baf('0xa'));var fs=require('fs');var fs_extra=require(_0x0baf('0xb'));var _=require(_0x0baf('0xc'));var squel=require(_0x0baf('0xd'));var crypto=require(_0x0baf('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x0baf('0xf'));var toCsv=require('to-csv');var querystring=require(_0x0baf('0x10'));var Papa=require(_0x0baf('0x11'));var Redis=require(_0x0baf('0x12'));var authService=require(_0x0baf('0x13'));var qs=require(_0x0baf('0x14'));var as=require(_0x0baf('0x15'));var pdf=require(_0x0baf('0x16'));var hardwareService=require(_0x0baf('0x17'));var logger=require(_0x0baf('0x18'))(_0x0baf('0x19'));var utils=require(_0x0baf('0x1a'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x0baf('0x1b'))['db'];config[_0x0baf('0x1c')]=_[_0x0baf('0x1d')](config[_0x0baf('0x1c')],{'host':'localhost','port':0x18eb});var socket=require(_0x0baf('0x1e'))(new Redis(config['redis']));require(_0x0baf('0x1f'))[_0x0baf('0x20')](socket);var jayson=require(_0x0baf('0x21'));var client=jayson[_0x0baf('0x22')][_0x0baf('0x23')]({'port':0x232b});var client9004=jayson[_0x0baf('0x22')]['http']({'port':0x232c});function respondWithRpcPromise(_0x4cd79d,_0x2312c7,_0x38395b,_0x283408){return new BPromise(function(_0x3d83a3,_0x2cf7da){var _0x288a98=_0x283408||client;return _0x288a98['request'](_0x4cd79d,_0x38395b)[_0x0baf('0x24')](function(_0xfbecec){logger[_0x0baf('0x25')](_0x0baf('0x26'),_0x2312c7,_0x0baf('0x27'));logger[_0x0baf('0x28')]('ChatInteraction,\x20%s,\x20%s,\x20%s',_0x2312c7,'request\x20sent',JSON[_0x0baf('0x29')](_0xfbecec));if(_0xfbecec[_0x0baf('0x2a')]){if(_0xfbecec[_0x0baf('0x2a')][_0x0baf('0x2b')]===0x1f4){logger[_0x0baf('0x2a')](_0x0baf('0x26'),_0x2312c7,_0xfbecec[_0x0baf('0x2a')][_0x0baf('0x2c')]);return _0x2cf7da(_0xfbecec[_0x0baf('0x2a')][_0x0baf('0x2c')]);}logger['error'](_0x0baf('0x26'),_0x2312c7,_0xfbecec['error'][_0x0baf('0x2c')]);return _0x3d83a3(_0xfbecec['error']['message']);}else{logger[_0x0baf('0x25')]('ChatInteraction,\x20%s,\x20%s',_0x2312c7,'request\x20sent');_0x3d83a3(_0xfbecec[_0x0baf('0x2d')][_0x0baf('0x2c')]);}})[_0x0baf('0x2e')](function(_0x19d9fd){logger[_0x0baf('0x2a')]('ChatInteraction,\x20%s,\x20%s',_0x2312c7,_0x19d9fd);_0x2cf7da(_0x19d9fd);});});}function respondWithStatusCode(_0x448617,_0x4681c5){_0x4681c5=_0x4681c5||0xcc;return function(_0x1ca35a){if(_0x1ca35a){return _0x448617[_0x0baf('0x2f')](_0x4681c5);}return _0x448617[_0x0baf('0x30')](_0x4681c5)[_0x0baf('0x31')]();};}function respondWithResult(_0x453525,_0x549fd0){_0x549fd0=_0x549fd0||0xc8;return function(_0x1590b4){if(_0x1590b4){return _0x453525[_0x0baf('0x30')](_0x549fd0)[_0x0baf('0x32')](_0x1590b4);}};}function respondWithFilteredResult(_0x265915,_0x55c715){return function(_0x29dbdf){if(_0x29dbdf){var _0x34a58a=typeof _0x55c715['offset']===_0x0baf('0x33')&&typeof _0x55c715[_0x0baf('0x34')]===_0x0baf('0x33');var _0xb4dbb1=_0x29dbdf[_0x0baf('0x35')];var _0x366924=_0x34a58a?0x0:_0x55c715[_0x0baf('0x36')];var _0x57476f=_0x34a58a?_0x29dbdf[_0x0baf('0x35')]:_0x55c715[_0x0baf('0x36')]+_0x55c715[_0x0baf('0x34')];var _0x3ed995;if(_0x57476f>=_0xb4dbb1){_0x57476f=_0xb4dbb1;_0x3ed995=0xc8;}else{_0x3ed995=0xce;}_0x265915[_0x0baf('0x30')](_0x3ed995);return _0x265915[_0x0baf('0x37')](_0x0baf('0x38'),_0x366924+'-'+_0x57476f+'/'+_0xb4dbb1)[_0x0baf('0x32')](_0x29dbdf);}return null;};}function patchUpdates(_0x59431b){return function(_0x3ded64){try{jsonpatch[_0x0baf('0x39')](_0x3ded64,_0x59431b,!![]);}catch(_0x165d14){return BPromise[_0x0baf('0x3a')](_0x165d14);}return _0x3ded64[_0x0baf('0x3b')]();};}function saveUpdates(_0x57a6bb,_0x2fd426){return function(_0x53ae1d){if(_0x53ae1d){return _0x53ae1d[_0x0baf('0x3c')](_0x57a6bb)[_0x0baf('0x24')](function(_0x35e534){return _0x35e534;});}return null;};}function removeEntity(_0x3d65f2,_0x5300a5){return function(_0x1a2b03){if(_0x1a2b03){return _0x1a2b03[_0x0baf('0x3d')]()['then'](function(){_0x3d65f2[_0x0baf('0x30')](0xcc)[_0x0baf('0x31')]();});}};}function handleEntityNotFound(_0x62a2ed,_0xbaa9a7){return function(_0x1f60bd){if(!_0x1f60bd){_0x62a2ed[_0x0baf('0x2f')](0x194);}return _0x1f60bd;};}function handleError(_0xe03d82,_0x675461){_0x675461=_0x675461||0x1f4;return function(_0x4aa6ed){logger[_0x0baf('0x2a')](_0x4aa6ed[_0x0baf('0x3e')]);if(_0x4aa6ed['name']){delete _0x4aa6ed[_0x0baf('0x3f')];}_0xe03d82['status'](_0x675461)['send'](_0x4aa6ed);};}function getMustacheRender(_0x11bc49,_0x81af83){return Mustache['render'](_0x11bc49,_['merge'](_0x81af83[_0x0baf('0x40')],{'contact':_0x81af83[_0x0baf('0x41')],'message':_0x81af83[_0x0baf('0x2c')],'agent':_0x81af83[_0x0baf('0x42')],'interaction':_0x81af83[_0x0baf('0x43')],'account':_0x81af83[_0x0baf('0x44')]}))||'';}function getInteractionUsers(_0x290464,_0x37c038){return new BPromise(function(_0x631f74,_0x36c6d2){try{if(_0x37c038[_0x290464['id']]){_0x290464[_0x0baf('0x45')]=_[_0x0baf('0x46')](_0x37c038[_0x290464['id']],function(_0x354cb1){return{'id':_0x354cb1['id'],'fullname':_0x354cb1[_0x0baf('0x47')]};});}}catch(_0x53d6b7){_0x36c6d2(_0x53d6b7);}_0x631f74(_0x290464);});}function getInteractionTags(_0x3573ce,_0x1435d5){return new BPromise(function(_0x4f1de9,_0x38006a){try{if(_0x3573ce[_0x0baf('0x48')]){_0x3573ce[_0x0baf('0x49')]=[];_0x3573ce[_0x0baf('0x48')][_0x0baf('0x4a')](',')[_0x0baf('0x4b')](function(_0x57b581){_0x3573ce[_0x0baf('0x49')][_0x0baf('0x4c')](_0x1435d5[_0x57b581]);});}delete _0x3573ce['TagIds'];}catch(_0x35d442){_0x38006a(_0x35d442);}_0x4f1de9(_0x3573ce);});}function updateChatInteraction(_0x412e6f,_0x45c6aa,_0x57903e){return new BPromise(function(_0x504031,_0x193fd3){return getInteractionUsers(_0x412e6f,_0x57903e)[_0x0baf('0x24')](function(_0x301412){return getInteractionTags(_0x301412,_0x45c6aa);})[_0x0baf('0x24')](function(_0x2b6d54){_0x504031(_0x2b6d54);})[_0x0baf('0x2e')](function(_0x33da34){_0x193fd3(_0x33da34);});});}exports[_0x0baf('0x4d')]=function(_0xce1bf0,_0x355033){var _0x56270e={},_0x2a2a7c={},_0x2bc755={'count':0x0,'rows':[]};var _0x1daf1d=_[_0x0baf('0x46')](db[_0x0baf('0x4e')]['rawAttributes'],function(_0x1e7364){return{'name':_0x1e7364[_0x0baf('0x4f')],'type':_0x1e7364[_0x0baf('0x50')][_0x0baf('0x51')]};});_0x2a2a7c[_0x0baf('0x52')]=_['map'](_0x1daf1d,_0x0baf('0x3f'));_0x2a2a7c[_0x0baf('0x53')]=_[_0x0baf('0x54')](_0xce1bf0[_0x0baf('0x53')]);_0x2a2a7c[_0x0baf('0x55')]=_[_0x0baf('0x56')](_0x2a2a7c[_0x0baf('0x52')],_0x2a2a7c['query']);_0x56270e[_0x0baf('0x57')]=_[_0x0baf('0x56')](_0x2a2a7c[_0x0baf('0x52')],qs['fields'](_0xce1bf0[_0x0baf('0x53')][_0x0baf('0x58')]));_0x56270e[_0x0baf('0x57')]=_0x56270e[_0x0baf('0x57')][_0x0baf('0x59')]?_0x56270e[_0x0baf('0x57')]:_0x2a2a7c[_0x0baf('0x52')];if(!_0xce1bf0['query'][_0x0baf('0x5a')](_0x0baf('0x5b'))){_0x56270e[_0x0baf('0x34')]=qs[_0x0baf('0x34')](_0xce1bf0[_0x0baf('0x53')][_0x0baf('0x34')]);_0x56270e[_0x0baf('0x36')]=qs[_0x0baf('0x36')](_0xce1bf0[_0x0baf('0x53')][_0x0baf('0x36')]);}_0x56270e[_0x0baf('0x5c')]=qs['sort'](_0xce1bf0['query'][_0x0baf('0x5d')]);_0x56270e[_0x0baf('0x5e')]=qs[_0x0baf('0x55')](_[_0x0baf('0x5f')](_0xce1bf0[_0x0baf('0x53')],_0x2a2a7c[_0x0baf('0x55')]),_0x1daf1d);var _0x3403d5=[];var _0x4b492c=squel[_0x0baf('0x60')]()[_0x0baf('0x61')]('id')[_0x0baf('0x61')](_0x0baf('0x3f'))[_0x0baf('0x61')](_0x0baf('0x62'))['from'](_0x0baf('0x63'));var _0x5f123c=squel[_0x0baf('0x60')]()['field'](_0x0baf('0x64'))['field'](_0x0baf('0x65'))['field'](_0x0baf('0x66'))[_0x0baf('0x67')](_0x0baf('0x68'),'ui')[_0x0baf('0x69')](_0x0baf('0x6a'),'u','u.id\x20=\x20ui.UserId');var _0x21f179=squel[_0x0baf('0x60')]()[_0x0baf('0x67')](_0x0baf('0x6b'),'i')[_0x0baf('0x69')](_0x0baf('0x6c'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0x0baf('0x69')](_0x0baf('0x6a'),'o',_0x0baf('0x6d'))[_0x0baf('0x69')](_0x0baf('0x6e'),'a',_0x0baf('0x6f'))[_0x0baf('0x69')]('chat_messages','me','me.ChatInteractionId\x20=\x20i.id')[_0x0baf('0x69')](_0x0baf('0x70'),'it',_0x0baf('0x71'))[_0x0baf('0x69')](_0x0baf('0x63'),'t',_0x0baf('0x72'));var _0xaa4293=squel[_0x0baf('0x73')]();var _0x3d9a32=[];var _0x585969=squel[_0x0baf('0x73')]();var _0x268be8;if(_0xce1bf0[_0x0baf('0x53')][_0x0baf('0x74')]){_0x268be8=as[_0x0baf('0x75')](_0xce1bf0[_0x0baf('0x53')][_0x0baf('0x74')]);var _0x51d75f=_0x268be8[_0x0baf('0x76')];for(var _0x27f580=0x0;_0x27f580<_0x268be8[_0x0baf('0x77')][_0x0baf('0x59')];_0x27f580++){var _0x1c7d88=_0x268be8[_0x0baf('0x77')][_0x27f580];var _0x14e6d0='i';var _0x12543e=_['find'](_0x1daf1d,[_0x0baf('0x3f'),_0x1c7d88['field']]);if(!_0x12543e){switch(_0x1c7d88[_0x0baf('0x61')]){case'unreadMessages':if(_0x1c7d88['value']==0x1){_0x21f179[_0x0baf('0x78')]('`'+_0x1c7d88['field']+_0x0baf('0x79'));}else{_0x21f179[_0x0baf('0x78')]('`'+_0x1c7d88['field']+_0x0baf('0x7a'));}break;case _0x0baf('0x7b'):if(_0x1c7d88[_0x0baf('0x7c')]==='$substring'){if(_0x1c7d88['value'][_0x0baf('0x4a')]('\x20')[_0x0baf('0x59')]>0x1){_0xaa4293[_0x51d75f](_0x0baf('0x7d'),qs[_0x0baf('0x7e')](_0x1c7d88[_0x0baf('0x7f')]),null);}else{var _0x588b88='%'+_0x1c7d88[_0x0baf('0x7f')]+'%';_0xaa4293[_0x51d75f]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x588b88,_0x588b88,_0x588b88);}}else{_0x12543e=_['find'](_0x1daf1d,['name',_0x0baf('0x80')]);_0x1c7d88['field']='ContactId';_0xf45ec3=as[_0x0baf('0x81')](_0x14e6d0,_0x12543e[_0x0baf('0x50')],_0x1c7d88);_0xaa4293[_0x51d75f](_0xf45ec3[_0x0baf('0x82')],_0xf45ec3[_0x0baf('0x7f')][_0x0baf('0x83')],_0xf45ec3[_0x0baf('0x7f')]['end']);}break;case _0x0baf('0x84'):var _0x1a0a67=_0x1c7d88[_0x0baf('0x7f')][_0x0baf('0x4a')](',')[_0x0baf('0x46')](function(_0x1273f4){return Number(_0x1273f4);});_0x1a0a67['forEach'](function(_0x42e8ad){_0x585969['or'](_0x0baf('0x85'),'%,'+_0x42e8ad+',%');});_0x3d9a32=_[_0x0baf('0x86')](_0x3d9a32,_0x1a0a67);break;case'User':if(_0x1c7d88[_0x0baf('0x7c')]===_0x0baf('0x87')){_0xaa4293[_0x51d75f](_0x0baf('0x88'),'%'+_0x1c7d88[_0x0baf('0x7f')]+'%',null);}else{_0x12543e=_[_0x0baf('0x89')](_0x1daf1d,[_0x0baf('0x3f'),_0x0baf('0x8a')]);_0x1c7d88['field']='UserId';_0xf45ec3=as['buildExpression'](_0x14e6d0,_0x12543e[_0x0baf('0x50')],_0x1c7d88);_0xaa4293[_0x51d75f](_0xf45ec3[_0x0baf('0x82')],_0xf45ec3[_0x0baf('0x7f')][_0x0baf('0x83')],_0xf45ec3[_0x0baf('0x7f')][_0x0baf('0x31')]);}break;case'body':_0xf45ec3=as['buildExpression']('me',null,_0x1c7d88);_0xaa4293[_0x51d75f](_0xf45ec3[_0x0baf('0x82')],_0xf45ec3['value'][_0x0baf('0x83')],_0xf45ec3[_0x0baf('0x7f')]['end']);break;}}else{var _0xf45ec3=as[_0x0baf('0x81')](_0x14e6d0,_0x12543e[_0x0baf('0x50')],_0x1c7d88);_0xaa4293[_0x51d75f](_0xf45ec3[_0x0baf('0x82')],_0xf45ec3[_0x0baf('0x7f')][_0x0baf('0x83')],_0xf45ec3[_0x0baf('0x7f')][_0x0baf('0x31')]);}}}else{var _0xfcc697=_(_0xce1bf0['query'])['keys']()['map'](function(_0x493784){return _['some'](_0x1daf1d,[_0x0baf('0x3f'),_0x493784])?_0x493784:undefined;})[_0x0baf('0x8b')]()[_0x0baf('0x7f')]();if(!_[_0x0baf('0x8c')](_0xfcc697)){_0xfcc697['forEach'](function(_0x1be7f2){if(_0x1be7f2===_0x0baf('0x8d')){_0x21f179['where']('i.ChatWebsiteId\x20IN\x20?',[][_0x0baf('0x8e')](_0xce1bf0[_0x0baf('0x53')][_0x1be7f2]));}else if(_0x1be7f2===_0x0baf('0x8f')){var _0x442e5f=JSON[_0x0baf('0x90')](_0xce1bf0[_0x0baf('0x53')][_0x1be7f2])[_0x0baf('0x91')];var _0x399f40=JSON['parse'](_0xce1bf0[_0x0baf('0x53')][_0x1be7f2])[_0x0baf('0x92')];_0x21f179['where'](_0x0baf('0x93'),_0x442e5f,_0x399f40);}else{if(_0xce1bf0[_0x0baf('0x53')][_0x1be7f2]==='null'){_0x21f179[_0x0baf('0x5e')]('i.'+_0x1be7f2+_0x0baf('0x94'));}else{_0x21f179[_0x0baf('0x5e')]('i.'+_0x1be7f2+_0x0baf('0x95'),_0xce1bf0[_0x0baf('0x53')][_0x1be7f2]);}}});}if(_0xce1bf0['query']['read']){if(_0xce1bf0[_0x0baf('0x53')][_0x0baf('0x96')]==0x1){_0x21f179['having'](_0x0baf('0x97'));}else{_0x21f179[_0x0baf('0x78')](_0x0baf('0x98'));}}if(_0xce1bf0['query'][_0x0baf('0x99')]){_0x3d9a32=_[_0x0baf('0x9a')](_0xce1bf0[_0x0baf('0x53')]['tag'])?_0xce1bf0[_0x0baf('0x53')]['tag']:new Array(_0xce1bf0[_0x0baf('0x53')][_0x0baf('0x99')]);_0x3d9a32[_0x0baf('0x4b')](function(_0x2f009f){_0x585969['or'](_0x0baf('0x85'),'%,'+_0x2f009f+',%');});}if(_0xce1bf0['query'][_0x0baf('0x9b')]){var _0x57f33c=_0xce1bf0['query'][_0x0baf('0x9b')][_0x0baf('0x9c')]('\x5c','\x5c\x5c')[_0x0baf('0x9c')](/'/g,'\x27\x27');if(qs[_0x0baf('0x9d')](_0x57f33c)){_0xaa4293['or'](_0x0baf('0x9e'),_0x57f33c+'%');}else{_0xaa4293['or'](_0x0baf('0x9f'),qs[_0x0baf('0x7e')](_0x57f33c))['or'](_0x0baf('0xa0'),_0x57f33c+'%');}}}_0x21f179[_0x0baf('0x5e')](_0xaa4293);_0x21f179[_0x0baf('0xa1')](_0x0baf('0xa2'));var _0x2c2f09={'type':db['Sequelize']['QueryTypes'][_0x0baf('0xa3')],'raw':!![]};var _0x322a09=_0x21f179[_0x0baf('0xa4')]();_0x322a09['field']('i.id');_0x322a09[_0x0baf('0x61')](_0x0baf('0xa5'),_0x0baf('0xa6'));if(_0x56270e[_0x0baf('0x5c')]){_0x56270e[_0x0baf('0x5c')][_0x0baf('0x4b')](function(_0x191d35){var _0xa2d315=_0x191d35[0x0]===_0x0baf('0xa7')?_0x191d35[0x0]:'i.'+_0x191d35[0x0];_0x21f179['order'](_0xa2d315,_0x191d35[0x1]===_0x0baf('0xa8')?![]:!![]);});}if(!_[_0x0baf('0x8c')](_0x3d9a32)){_0x21f179[_0x0baf('0x78')](_0x585969);_0x322a09[_0x0baf('0x5e')]('t.id\x20IN\x20?',_0x3d9a32);}BPromise['resolve']()['then'](function(){if(!_0x268be8){if(_0xce1bf0[_0x0baf('0x53')][_0x0baf('0x8d')])return;_0x322a09['where']('i.ChatWebsiteId\x20IS\x20NOT\x20NULL');_0x21f179[_0x0baf('0x5e')](_0x0baf('0xa9'));return;}if(_0xce1bf0['user'][_0x0baf('0xaa')]!==_0x0baf('0x42'))return;return _0xce1bf0[_0x0baf('0xab')][_0x0baf('0xac')]({'attributes':['id'],'raw':!![]})[_0x0baf('0x24')](function(_0x25081e){if(_[_0x0baf('0x8c')](_0x25081e)){_0x322a09[_0x0baf('0x5e')](_0x0baf('0xad'));_0x21f179[_0x0baf('0x5e')](_0x0baf('0xad'));}else{_0x322a09[_0x0baf('0x5e')]('i.ChatWebsiteId\x20IN\x20?',_[_0x0baf('0x46')](_0x25081e,'id'));_0x21f179[_0x0baf('0x5e')](_0x0baf('0xae'),_[_0x0baf('0x46')](_0x25081e,'id'));}});})[_0x0baf('0x24')](function(){if(_0xce1bf0[_0x0baf('0xab')]['role']===_0x0baf('0x42')&&!_0x268be8&&!_0xce1bf0[_0x0baf('0x53')][_0x0baf('0x8d')])return[];return db[_0x0baf('0xaf')][_0x0baf('0x53')](_0x322a09['toString'](),_0x2c2f09);})[_0x0baf('0x24')](function(_0x30eac8){_0x2bc755[_0x0baf('0x35')]=_0x30eac8[_0x0baf('0x59')];if(_0x2bc755[_0x0baf('0x35')]===0x0)return[];return db['sequelize']['query'](_0x4b492c[_0x0baf('0xb0')](),_0x2c2f09)['then'](function(_0x477cd5){_0x3403d5=_['keyBy'](_0x477cd5,'id');_0x2c2f09=_[_0x0baf('0xb1')](_0x2c2f09,{'model':db[_0x0baf('0x4e')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0xce1bf0[_0x0baf('0x53')][_0x0baf('0x58')]){_0x56270e['attributes'][_0x0baf('0x4b')](function(_0x106ffa){_0x21f179[_0x0baf('0x61')]('i.'+_0x106ffa);});}else{_0x21f179['field']('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages');_0x21f179['field'](_0x0baf('0xb2'),_0x0baf('0xb3'));_0x21f179[_0x0baf('0x61')](_0x0baf('0xb4'),'Account.mandatoryDisposition');_0x21f179[_0x0baf('0x61')](_0x0baf('0xb5'),_0x0baf('0xa7'));_0x21f179['field'](_0x0baf('0xb6'));_0x21f179[_0x0baf('0x61')]('c.firstName',_0x0baf('0xb7'));_0x21f179['field'](_0x0baf('0xb8'),_0x0baf('0xb9'));_0x21f179[_0x0baf('0x61')](_0x0baf('0xba'),'Contact.email');_0x21f179['field'](_0x0baf('0xbb'),'Contact.phone');_0x21f179[_0x0baf('0x61')](_0x0baf('0xbc'),_0x0baf('0xbd'));_0x21f179[_0x0baf('0x61')](_0x0baf('0xbe'),'Contact.fax');_0x21f179[_0x0baf('0x61')]('o.fullname',_0x0baf('0xbf'));_0x21f179['field'](_0x0baf('0xc0'),'Owner.internal');_0x21f179[_0x0baf('0x61')](_0x0baf('0xc1'),_0x0baf('0x48'));}if(_0x56270e['limit'])_0x21f179['limit'](_0x56270e[_0x0baf('0x34')]);if(_0x56270e[_0x0baf('0x36')])_0x21f179[_0x0baf('0x36')](_0x56270e[_0x0baf('0x36')]);return db[_0x0baf('0xaf')][_0x0baf('0x53')](_0x21f179['toString'](),_0x2c2f09);})[_0x0baf('0x24')](function(_0x5ee37f){if(_0x5ee37f[_0x0baf('0x59')]>0x0)_0x5f123c['where'](_0x0baf('0xc2'),_[_0x0baf('0x46')](_0x5ee37f,'id'));return db[_0x0baf('0xaf')]['query'](_0x5f123c[_0x0baf('0xb0')](),_0x2c2f09)[_0x0baf('0x24')](function(_0x4879b4){var _0x544498=_[_0x0baf('0xc3')](_0x4879b4,_0x0baf('0xc4'));var _0x20dd04=[];_0x5ee37f[_0x0baf('0x4b')](function(_0x4823a3){_0x20dd04['push'](updateChatInteraction(_0x4823a3,_0x3403d5,_0x544498));});return BPromise[_0x0baf('0xc5')](_0x20dd04);});});})[_0x0baf('0x24')](function(_0x116d52){_0x2bc755[_0x0baf('0xc6')]=_0x116d52;return _0x2bc755;})[_0x0baf('0x24')](respondWithFilteredResult(_0x355033,_0x56270e))[_0x0baf('0x2e')](handleError(_0x355033,null));};exports[_0x0baf('0xc7')]=function(_0xe0b67c,_0x205de6){var _0x2369f0={'raw':![],'where':{'id':_0xe0b67c[_0x0baf('0xc8')]['id']}},_0x58f95c={};_0x58f95c['model']=_[_0x0baf('0x54')](db[_0x0baf('0x4e')][_0x0baf('0xc9')]);_0x58f95c[_0x0baf('0x53')]=_['keys'](_0xe0b67c[_0x0baf('0x53')]);_0x58f95c[_0x0baf('0x55')]=_[_0x0baf('0x56')](_0x58f95c[_0x0baf('0x52')],_0x58f95c[_0x0baf('0x53')]);_0x2369f0[_0x0baf('0x57')]=_[_0x0baf('0x56')](_0x58f95c[_0x0baf('0x52')],qs[_0x0baf('0x58')](_0xe0b67c['query'][_0x0baf('0x58')]));_0x2369f0[_0x0baf('0x57')]=_0x2369f0['attributes'][_0x0baf('0x59')]?_0x2369f0[_0x0baf('0x57')]:_0x58f95c[_0x0baf('0x52')];if(_0xe0b67c[_0x0baf('0x53')][_0x0baf('0xca')]){_0x2369f0[_0x0baf('0xcb')]=[{'all':!![]}];}_0x2369f0=_[_0x0baf('0xb1')]({},_0x2369f0,_0xe0b67c[_0x0baf('0xcc')]);return db[_0x0baf('0x4e')]['find'](_0x2369f0)[_0x0baf('0x24')](handleEntityNotFound(_0x205de6,null))[_0x0baf('0x24')](respondWithResult(_0x205de6,null))[_0x0baf('0x2e')](handleError(_0x205de6,null));};exports[_0x0baf('0xcd')]=function(_0x4328d5,_0x270d69){return db['ChatInteraction'][_0x0baf('0xcd')](_0x4328d5[_0x0baf('0x40')],{})[_0x0baf('0x24')](respondWithResult(_0x270d69,0xc9))['catch'](handleError(_0x270d69,null));};exports['update']=function(_0x5adbd9,_0x1adb84){if(_0x5adbd9[_0x0baf('0x40')]['id']){delete _0x5adbd9['body']['id'];}return db[_0x0baf('0x4e')]['find']({'where':{'id':_0x5adbd9[_0x0baf('0xc8')]['id']}})['then'](handleEntityNotFound(_0x1adb84,null))[_0x0baf('0x24')](saveUpdates(_0x5adbd9[_0x0baf('0x40')],null))['then'](respondWithResult(_0x1adb84,null))[_0x0baf('0x2e')](handleError(_0x1adb84,null));};exports[_0x0baf('0x3d')]=function(_0x25d25e,_0x4494de){return db[_0x0baf('0x4e')][_0x0baf('0x89')]({'where':{'id':_0x25d25e[_0x0baf('0xc8')]['id']}})['then'](handleEntityNotFound(_0x4494de,null))[_0x0baf('0x24')](removeEntity(_0x4494de,null))[_0x0baf('0x2e')](handleError(_0x4494de,null));};exports[_0x0baf('0xce')]=function(_0x2e1629,_0x275cc4){return db[_0x0baf('0x4e')][_0x0baf('0xce')]()[_0x0baf('0x24')](respondWithResult(_0x275cc4,null))[_0x0baf('0x2e')](handleError(_0x275cc4,null));};exports[_0x0baf('0xcf')]=function(_0x308b3f,_0xae8bc2){var _0x1390cd=_0x308b3f[_0x0baf('0xc8')]['id'];var _0x59dd6c;var _0x57b64b;var _0x1cd215;return db[_0x0baf('0x4e')][_0x0baf('0xd0')]({'where':{'id':_0x1390cd}})[_0x0baf('0x24')](function(_0x52e98a){_0x59dd6c=_0x52e98a;return db[_0x0baf('0xd1')][_0x0baf('0xd0')]({'where':{'id':_0x52e98a[_0x0baf('0x8d')]},'attributes':['id',_0x0baf('0xd2'),_0x0baf('0xd3'),_0x0baf('0xd4'),'vidaooNote',_0x0baf('0xd5')],'raw':!![]});})[_0x0baf('0x24')](function(_0x347c39){if(_0x347c39&&_0x347c39['vidaooApiKey']&&_0x347c39[_0x0baf('0xd3')]){_0x57b64b=_0x347c39;var _0x106c6e={'interaction':{'id':_0x1390cd},'agent':{'id':_0x308b3f[_0x0baf('0xab')]['id'],'name':_0x308b3f['user']['name'],'fullname':_0x308b3f['user'][_0x0baf('0x47')],'email':_0x308b3f['user'][_0x0baf('0xd6')]},'contact':_0x308b3f[_0x0baf('0x40')]['contact'],'account':_0x308b3f[_0x0baf('0x40')]['account']};var _0x5737b0={'rejectUnauthorized':![],'method':_0x0baf('0xd7'),'url':'https://api-vidaoo.xcally.com/api/v1/meetings','headers':{'X-APIKEY':_0x347c39[_0x0baf('0xd2')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x308b3f['user']['email']],'buttons':null,'topic':_0x57b64b['vidaooTopic'],'note':_[_0x0baf('0xd8')](_0x57b64b[_0x0baf('0xd9')])?null:getMustacheRender(_0x57b64b[_0x0baf('0xd9')],_0x106c6e),'metadata':null},'redirect':_0x0baf('0xda'),'json':!![]};try{if(!_[_0x0baf('0xd8')](_0x57b64b[_0x0baf('0xd5')])){var _0x20582a=getMustacheRender(_0x57b64b['vidaooMetadata'],_0x106c6e);var _0x36cd08=JSON[_0x0baf('0x90')](_0x20582a);_0x5737b0[_0x0baf('0x40')]['metadata']=_0x36cd08;}}catch(_0x24672f){throw new db[(_0x0baf('0xdb'))][(_0x0baf('0xdc'))]('Error\x20in\x20conversion\x20vidaooMetadata');}return rp(_0x5737b0);}else{throw new db[(_0x0baf('0xdb'))]['ValidationError'](_0x0baf('0xdd'));}})[_0x0baf('0x24')](function(_0x57846e){_0x1cd215=_0x57846e;if(_0x1cd215['id']){var _0xd4ed40={'body':_0x1cd215[_0x0baf('0xde')],'ChatWebsiteId':_0x57b64b['id'],'ChatInteractionId':_0x59dd6c['id'],'direction':_0x0baf('0xdf'),'UserId':_0x308b3f[_0x0baf('0xab')]['id']};return db['ChatMessage'][_0x0baf('0xcd')](_0xd4ed40,{});}else{throw new db[(_0x0baf('0xdb'))]['ValidationError']('Unable\x20to\x20create\x20Vidaoo\x20session');}})[_0x0baf('0x24')](function(){return _0x59dd6c[_0x0baf('0xe0')]({'vidaooSessionId':_0x1cd215['id']});})[_0x0baf('0x24')](respondWithResult(_0xae8bc2,null))[_0x0baf('0x2e')](handleError(_0xae8bc2,null));};exports['customUpdate']=function(_0x5571d4,_0x16579f){if(_0x5571d4[_0x0baf('0x40')]['id']){delete _0x5571d4[_0x0baf('0x40')]['id'];}return db[_0x0baf('0x4e')][_0x0baf('0x89')]({'where':{'id':_0x5571d4['params']['id']},'include':[{'model':db[_0x0baf('0xe1')],'as':_0x0baf('0x7b')}]})['then'](handleEntityNotFound(_0x16579f,null))[_0x0baf('0x24')](saveUpdates(_0x5571d4[_0x0baf('0x40')],null))['then'](respondWithResult(_0x16579f,null))[_0x0baf('0x2e')](handleError(_0x16579f,null));};exports[_0x0baf('0xe2')]=function(_0x19457c,_0x1f0b00,_0x2484d4){if(_0x19457c[_0x0baf('0x40')]['id']){delete _0x19457c[_0x0baf('0x40')]['id'];}return db[_0x0baf('0x4e')]['find']({'where':{'id':_0x19457c[_0x0baf('0xc8')]['id']}})[_0x0baf('0x24')](function(_0x226edd){if(!_0x226edd){logger[_0x0baf('0x2a')]('abandonInteraction,\x20%s,\x20%s,\x20%s',_0x0baf('0xe2'),0x194,_0x0baf('0xe3'));_0x1f0b00['sendStatus'](0x194);}else{if(_0x226edd[_0x0baf('0x8a')]){throw new db[(_0x0baf('0xdb'))][(_0x0baf('0xdc'))](_0x0baf('0xe4'));}}return _0x226edd;})['then'](function(_0x3ca1a6){if(_0x3ca1a6){return _0x3ca1a6[_0x0baf('0x3c')]({'closed':_0x19457c[_0x0baf('0x40')][_0x0baf('0xe5')],'disposition':_0x19457c[_0x0baf('0x40')]['disposition']})[_0x0baf('0x24')](function(_0xc5ec1a){return _0xc5ec1a;});}})[_0x0baf('0x24')](function(_0x5d33b4){return respondWithRpcPromise(_0x0baf('0xe6'),_0x0baf('0xe2'),_0x19457c[_0x0baf('0x40')],client9004);})[_0x0baf('0x24')](respondWithResult(_0x1f0b00,null))[_0x0baf('0x2e')](handleError(_0x1f0b00,null));};exports['attachmentUpload']=function(_0x553084,_0x19898e,_0x315ada){_0x553084[_0x0baf('0x40')]['name']=_0x553084[_0x0baf('0xe7')][_0x0baf('0xe8')];_0x553084[_0x0baf('0x40')][_0x0baf('0xe9')]=_0x553084[_0x0baf('0xe7')][_0x0baf('0xea')];_0x553084[_0x0baf('0x40')][_0x0baf('0x50')]=_0x553084[_0x0baf('0xe7')][_0x0baf('0xeb')];return db['Attachment'][_0x0baf('0xcd')](_0x553084[_0x0baf('0x40')])[_0x0baf('0x24')](respondWithResult(_0x19898e,0xc9))[_0x0baf('0x2e')](handleError(_0x19898e,null));};exports['attachmentDownload']=function(_0x413d0d,_0x3d7667,_0x386928){return db['ChatInteraction'][_0x0baf('0xd0')]({'where':{'id':_0x413d0d[_0x0baf('0xc8')]['id']},'raw':!![]})[_0x0baf('0x24')](handleEntityNotFound(_0x3d7667,null))[_0x0baf('0x24')](function(_0x1e4bf1){if(_0x1e4bf1){if(_0x1e4bf1['closed']){return _0x3d7667[_0x0baf('0x30')](0x193)[_0x0baf('0x32')]({'status':0x193,'message':'Unauthorized'});}return db['Attachment'][_0x0baf('0xd0')]({'where':{'id':_0x413d0d[_0x0baf('0x53')][_0x0baf('0xec')]},'raw':!![]})[_0x0baf('0x24')](handleEntityNotFound(_0x3d7667,null));}})[_0x0baf('0x24')](function(_0xb22125){if(_0xb22125){var _0x37c83a=_0xb22125['ChatOfflineMessageId']!==null;var _0x5deb7b=path[_0x0baf('0xed')](config[_0x0baf('0xee')],_0x0baf('0xef'));if(_0x37c83a){_0x5deb7b=path['join'](_0x5deb7b,_0x0baf('0xf0'));}var _0x3a6bf8=path['join'](_0x5deb7b,_0xb22125[_0x0baf('0xe9')]);return _0x3d7667[_0x0baf('0xf1')](_0x3a6bf8);}})['catch'](handleError(_0x3d7667,null));};exports[_0x0baf('0xf2')]=function(_0x9d6974,_0x939365){var _0x4d6ac4=null;var _0x1d86c9=null;var _0x95fe84=null;var _0x2a7138=null;if(_0x9d6974[_0x0baf('0x40')]['id']){delete _0x9d6974[_0x0baf('0x40')]['id'];}if(_0x9d6974[_0x0baf('0x40')][_0x0baf('0xf3')]){_0x2a7138=path['join'](config[_0x0baf('0xee')],'server/files/chat/upload/',util[_0x0baf('0xf4')](_0x0baf('0xf5'),Date['now']()));_0x9d6974['body'][_0x0baf('0xf6')]=_0x2a7138;}return db[_0x0baf('0x4e')][_0x0baf('0x89')]({'where':{'id':_0x9d6974['params']['id']},'include':[{'model':db[_0x0baf('0xf7')],'as':_0x0baf('0xf8'),'include':[{'model':db[_0x0baf('0xf9')],'as':_0x0baf('0xf9')}]}]})[_0x0baf('0x24')](handleEntityNotFound(_0x939365,null))[_0x0baf('0x24')](saveUpdates(_0x9d6974[_0x0baf('0x40')],null))[_0x0baf('0x24')](function(_0x5f3691){if(_0x5f3691){_0x4d6ac4=_0x5f3691;return db['ChatWebsite'][_0x0baf('0x89')]({'where':{'id':_0x4d6ac4[_0x0baf('0x8d')]}});}})['then'](function(_0x210047){if(_0x210047){_0x95fe84=_0x210047;return db[_0x0baf('0xe1')][_0x0baf('0x89')]({'where':{'id':_0x4d6ac4[_0x0baf('0x80')]}});}})[_0x0baf('0x24')](function(_0x8806f9){if(_0x8806f9){_0x1d86c9=_0x8806f9;if(_0x2a7138){var _0x1cb69a=null;for(var _0x4bc31f=0x1;_0x4bc31f<_0x4d6ac4[_0x0baf('0xf8')]['length'];++_0x4bc31f){_0x1cb69a=_0x4d6ac4[_0x0baf('0xf8')][_0x4bc31f];var _0x32abf2=_0x1cb69a['UserId']?util['format'](_0x0baf('0xfa'),_0x95fe84[_0x0baf('0xfb')],_0x1cb69a[_0x0baf('0x8a')]):_0x0baf('0xfc');var _0x4759d5=_0x9d6974[_0x0baf('0x40')][_0x0baf('0xfd')]||util['format']('%s%d','Visitor',_0x1cb69a[_0x0baf('0x80')]);switch(_0x95fe84['agentIdentifier']){case _0x0baf('0xfe'):_0x32abf2=_0x1cb69a[_0x0baf('0x8a')]?util['format']('%s%d',_0x95fe84[_0x0baf('0xfb')],_0x1cb69a[_0x0baf('0x8a')]):_0x0baf('0xfc');break;case _0x0baf('0xff'):_0x32abf2=_0x1cb69a[_0x0baf('0x8a')]?_0x1cb69a['User'][_0x0baf('0x100')]||_0x1cb69a[_0x0baf('0xf9')][_0x0baf('0x47')]:_0x0baf('0xfc');break;case _0x0baf('0x101'):_0x32abf2=_0x1cb69a[_0x0baf('0x8a')]?_0x1cb69a['User'][_0x0baf('0x47')]:_0x0baf('0xfc');break;default:_0x32abf2=_0x1cb69a[_0x0baf('0x8a')]?util['format'](_0x0baf('0xfa'),_0x95fe84[_0x0baf('0xfb')],_0x1cb69a['UserId']):_0x0baf('0xfc');}var _0xe93008=util[_0x0baf('0xf4')](_0x0baf('0x102'),moment(_0x1cb69a['createdAt'])['format'](_0x0baf('0x103')),_0x1cb69a[_0x0baf('0x104')]==='in'?_0x4759d5:_0x32abf2,_0x1cb69a['body']);if(!_0x1cb69a[_0x0baf('0x105')]){fs[_0x0baf('0x106')](_0x2a7138,_0xe93008);}}return db[_0x0baf('0x107')][_0x0baf('0xd0')]({'where':{'service':!![]},'include':[{'model':db[_0x0baf('0x108')],'as':'Smtp','raw':!![]}]});}}})[_0x0baf('0x24')](function(_0x1fe362){if(_0x1fe362&&_0x1fe362[_0x0baf('0x109')]&&_0x9d6974[_0x0baf('0x40')]){var _0x51287e={'tls':{'rejectUnauthorized':![]}};if(_0x1fe362[_0x0baf('0x109')]['service']){_0x51287e[_0x0baf('0x10a')]=_0x1fe362[_0x0baf('0x109')][_0x0baf('0x10a')];}else{_0x51287e['host']=_0x1fe362[_0x0baf('0x109')][_0x0baf('0x10b')];_0x51287e[_0x0baf('0x10c')]=_0x1fe362[_0x0baf('0x109')][_0x0baf('0x10c')];_0x51287e[_0x0baf('0x10d')]=_0x1fe362[_0x0baf('0x109')][_0x0baf('0x10d')];}if(_0x1fe362[_0x0baf('0x109')][_0x0baf('0x10e')]){_0x51287e[_0x0baf('0x10f')]={'user':_0x1fe362[_0x0baf('0x109')]['user'],'pass':_0x1fe362['Smtp'][_0x0baf('0x110')]};}return respondWithRpcPromise('SendMail','sendMail',{'account':_0x51287e,'message':{'from':util['format']('\x22%s\x22\x20<%s>',_0x1fe362[_0x0baf('0x3f')],_0x1fe362[_0x0baf('0xd6')]||_0x1fe362['Smtp']['user']),'to':_0x9d6974['body']['mailTranscript'],'subject':_0x0baf('0x111'),'text':util['format'](_0x0baf('0x112'),_0x9d6974[_0x0baf('0x40')][_0x0baf('0xf3')]),'attachments':[{'path':_0x2a7138}]}})[_0x0baf('0x24')](function(){return _0x4d6ac4;})[_0x0baf('0x2e')](function(_0x292469){console[_0x0baf('0x2a')](_0x292469);});}else{return _0x4d6ac4;}})[_0x0baf('0x24')](respondWithStatusCode(_0x939365,0xc8))['catch'](handleError(_0x939365,null));};exports['addMessage']=function(_0x2d7ec3,_0x2a4d79,_0x5ebcad){return db[_0x0baf('0xf7')]['find']({'where':{'id':_0x2d7ec3[_0x0baf('0xc8')]['id']}})['then'](handleEntityNotFound(_0x2a4d79,null))['then'](function(_0x4621ba){if(_0x4621ba){return _0x4621ba[_0x0baf('0x113')](_0x2d7ec3[_0x0baf('0x40')][_0x0baf('0x114')],_[_0x0baf('0x115')](_0x2d7ec3[_0x0baf('0x40')],[_0x0baf('0x114'),'id'])||{});}})[_0x0baf('0x24')](respondWithResult(_0x2a4d79,null))[_0x0baf('0x2e')](handleError(_0x2a4d79,null));};exports[_0x0baf('0x116')]=function(_0x425869,_0x4059e1,_0x2c94ff){var _0x738da0={'raw':![],'where':{}};var _0x268a1c={};var _0x34cb32={'count':0x0,'rows':[]};return db['ChatInteraction'][_0x0baf('0xd0')]({'where':{'id':_0x425869[_0x0baf('0xc8')]['id']}})['then'](handleEntityNotFound(_0x4059e1,null))[_0x0baf('0x24')](function(_0x39526b){if(_0x39526b){_0x268a1c['model']=_[_0x0baf('0x54')](db['ChatMessage'][_0x0baf('0xc9')]);_0x268a1c['query']=_[_0x0baf('0x54')](_0x425869['query']);_0x268a1c[_0x0baf('0x55')]=_[_0x0baf('0x56')](_0x268a1c[_0x0baf('0x52')],_0x268a1c[_0x0baf('0x53')]);_0x738da0['attributes']=_[_0x0baf('0x56')](_0x268a1c[_0x0baf('0x52')],qs[_0x0baf('0x58')](_0x425869[_0x0baf('0x53')]['fields']));_0x738da0['attributes']=_0x738da0[_0x0baf('0x57')][_0x0baf('0x59')]?_0x738da0[_0x0baf('0x57')]:_0x268a1c[_0x0baf('0x52')];if(!_0x425869['query'][_0x0baf('0x5a')](_0x0baf('0x5b'))){_0x738da0[_0x0baf('0x34')]=qs['limit'](_0x425869['query'][_0x0baf('0x34')]);_0x738da0['offset']=qs[_0x0baf('0x36')](_0x425869['query'][_0x0baf('0x36')]);}_0x738da0[_0x0baf('0x5c')]=qs[_0x0baf('0x5d')](_0x425869['query'][_0x0baf('0x5d')]);_0x738da0[_0x0baf('0x5e')]=qs['filters'](_['pick'](_0x425869[_0x0baf('0x53')],_0x268a1c['filters']));_0x738da0[_0x0baf('0x5e')][_0x0baf('0xc4')]=_0x39526b['id'];if(_0x425869['query']['filter']){_0x738da0[_0x0baf('0x5e')]=_[_0x0baf('0xb1')](_0x738da0['where'],{'$or':_[_0x0baf('0x46')](_0x738da0['attributes'],function(_0x309220){var _0x376eb3={};_0x376eb3[_0x309220]={'$like':'%'+_0x425869['query'][_0x0baf('0x9b')]+'%'};return _0x376eb3;})});}if(_0x425869[_0x0baf('0x53')][_0x0baf('0x91')]){var _0x2ef76b=_0x425869[_0x0baf('0x53')]['$gte'][_0x0baf('0x4a')](',');var _0x4ca9ea={};_0x4ca9ea[_0x2ef76b[0x0]]={'$gte':moment(_0x2ef76b[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x738da0[_0x0baf('0x5e')]=_[_0x0baf('0xb1')](_0x738da0['where'],_0x4ca9ea);}_0x738da0=_[_0x0baf('0xb1')]({},_0x738da0,_0x425869[_0x0baf('0xcc')]);return db['ChatMessage'][_0x0baf('0x35')]({'where':_0x738da0[_0x0baf('0x5e')]})[_0x0baf('0x24')](function(_0x3d6ece){_0x34cb32[_0x0baf('0x35')]=_0x3d6ece;if(_0x425869[_0x0baf('0x53')][_0x0baf('0xca')]){_0x738da0[_0x0baf('0xcb')]=[{'all':!![]}];}return db[_0x0baf('0xf7')][_0x0baf('0x117')](_0x738da0);})['then'](function(_0x19727f){_0x34cb32[_0x0baf('0xc6')]=_0x19727f;return _0x34cb32;});}})[_0x0baf('0x24')](respondWithFilteredResult(_0x4059e1,_0x738da0))[_0x0baf('0x2e')](handleError(_0x4059e1,null));};exports[_0x0baf('0x118')]=function(_0x57b26e,_0x3a0a2f,_0x5b676d){var _0x298155={'where':{}},_0xff9b69={},_0x5398c6={'count':0x0,'rows':[]};return db[_0x0baf('0x4e')][_0x0baf('0xd0')]({'where':{'id':_0x57b26e[_0x0baf('0xc8')]['id']}})[_0x0baf('0x24')](handleEntityNotFound(_0x3a0a2f,null))['then'](function(_0x2edcf9){if(_0x2edcf9){_0xff9b69[_0x0baf('0x52')]=_[_0x0baf('0x54')](db[_0x0baf('0xf7')][_0x0baf('0xc9')]);_0xff9b69[_0x0baf('0x53')]=_[_0x0baf('0x54')](_0x57b26e[_0x0baf('0x53')]);_0xff9b69[_0x0baf('0x55')]=_[_0x0baf('0x56')](_0xff9b69[_0x0baf('0x52')],_0xff9b69[_0x0baf('0x53')]);_0x298155[_0x0baf('0x57')]=_[_0x0baf('0x56')](_0xff9b69[_0x0baf('0x52')],qs[_0x0baf('0x58')](_0x57b26e[_0x0baf('0x53')][_0x0baf('0x58')]));_0x298155['attributes']=_0x298155[_0x0baf('0x57')][_0x0baf('0x59')]?_0x298155[_0x0baf('0x57')]:_0xff9b69[_0x0baf('0x52')];if(!_0x57b26e[_0x0baf('0x53')][_0x0baf('0x5a')](_0x0baf('0x5b'))){_0x298155['limit']=qs[_0x0baf('0x34')](_0x57b26e[_0x0baf('0x53')][_0x0baf('0x34')]);_0x298155[_0x0baf('0x36')]=qs[_0x0baf('0x36')](_0x57b26e[_0x0baf('0x53')][_0x0baf('0x36')]);}_0x298155['order']=qs[_0x0baf('0x5d')](_0x57b26e[_0x0baf('0x53')][_0x0baf('0x5d')]);_0x298155[_0x0baf('0x5e')]=qs[_0x0baf('0x55')](_[_0x0baf('0x5f')](_0x57b26e['query'],_0xff9b69[_0x0baf('0x55')]));_0x298155[_0x0baf('0x5e')][_0x0baf('0xc4')]=_0x2edcf9['id'];if(_0x57b26e[_0x0baf('0x53')][_0x0baf('0x9b')]){_0x298155['where']=_['merge'](_0x298155[_0x0baf('0x5e')],{'$or':_[_0x0baf('0x46')](_0x298155[_0x0baf('0x57')],function(_0x2d43ac){var _0x34126b={};_0x34126b[_0x2d43ac]={'$like':'%'+_0x57b26e[_0x0baf('0x53')][_0x0baf('0x9b')]+'%'};return _0x34126b;})});}_0x298155[_0x0baf('0x5e')][_0x0baf('0x105')]=![];if(_0x57b26e[_0x0baf('0x53')]['id']){_0x298155[_0x0baf('0x5e')]['id']={'$gt':_0x57b26e[_0x0baf('0x53')]['id']};}_0x298155=_[_0x0baf('0xb1')]({},_0x298155,_0x57b26e[_0x0baf('0xcc')]);return db[_0x0baf('0xf7')][_0x0baf('0x35')]({'where':_0x298155[_0x0baf('0x5e')]})[_0x0baf('0x24')](function(_0x18d219){_0x5398c6[_0x0baf('0x35')]=_0x18d219;_0x298155[_0x0baf('0xcb')]=[];if(_0x57b26e[_0x0baf('0x53')][_0x0baf('0x119')]){_0x298155[_0x0baf('0xcb')][_0x0baf('0x4c')]({'model':db[_0x0baf('0xf9')],'as':_0x0baf('0xf9'),'attributes':['id','fullname',_0x0baf('0x100')]});}if(_0x57b26e[_0x0baf('0x53')][_0x0baf('0xca')]){_0x298155[_0x0baf('0xcb')]=[{'all':!![]}];}return db[_0x0baf('0xf7')]['findAll'](_0x298155);})[_0x0baf('0x24')](function(_0x344fef){_0x5398c6[_0x0baf('0xc6')]=_0x344fef;return _0x5398c6;});}})[_0x0baf('0x24')](respondWithFilteredResult(_0x3a0a2f,_0x298155))[_0x0baf('0x2e')](handleError(_0x3a0a2f,null));};exports[_0x0baf('0x11a')]=function(_0x3358f5,_0x237a20,_0x26dd4c){return db[_0x0baf('0x4e')][_0x0baf('0x89')]({'where':{'id':_0x3358f5[_0x0baf('0xc8')]['id']}})[_0x0baf('0x24')](handleEntityNotFound(_0x237a20,null))[_0x0baf('0x24')](function(_0x2867b7){if(_0x2867b7){return _0x2867b7[_0x0baf('0x11b')](_0x3358f5[_0x0baf('0x40')][_0x0baf('0x114')],_['omit'](_0x3358f5[_0x0baf('0x40')],['ids','id'])||{})['spread'](function(){return db[_0x0baf('0x84')][_0x0baf('0x117')]({'attributes':['id',_0x0baf('0x3f'),'color'],'where':{'id':_0x3358f5[_0x0baf('0x40')][_0x0baf('0x114')]}});})[_0x0baf('0x24')](function(_0x24bc8f){socket[_0x0baf('0x11c')](_0x0baf('0x11d'),{'id':Number(_0x3358f5['params']['id']),'tags':_0x24bc8f||[]});return{'id':Number(_0x3358f5[_0x0baf('0xc8')]['id']),'tags':_0x24bc8f||[]};});}})[_0x0baf('0x24')](respondWithResult(_0x237a20,null))[_0x0baf('0x2e')](handleError(_0x237a20,null));};exports[_0x0baf('0x11e')]=function(_0x262063,_0x216897,_0x4c2bae){return db[_0x0baf('0x4e')]['find']({'where':{'id':_0x262063[_0x0baf('0xc8')]['id']}})[_0x0baf('0x24')](handleEntityNotFound(_0x216897,null))['then'](function(_0x56da3e){if(_0x56da3e){return _0x56da3e[_0x0baf('0x11e')](_0x262063[_0x0baf('0x53')][_0x0baf('0x114')]);}})['then'](respondWithStatusCode(_0x216897,null))[_0x0baf('0x2e')](handleError(_0x216897,null));};exports[_0x0baf('0xf1')]=function(_0x51d2aa,_0x26d73d){var _0x20cc18=moment()[_0x0baf('0x11f')]()[_0x0baf('0xb0')]();var _0x3fa8eb=path[_0x0baf('0xed')](config[_0x0baf('0xee')],'server','files',_0x0baf('0x120'));var _0x1bd67f=path[_0x0baf('0xed')](config[_0x0baf('0xee')],_0x0baf('0x121'),_0x0baf('0x122'),_0x0baf('0x123'));var _0x4316c5=path[_0x0baf('0xed')](_0x3fa8eb,_0x20cc18);var _0x1d5b73=util['format']('transcript-%d-%s.zip',_0x51d2aa[_0x0baf('0xc8')]['id'],_0x20cc18);var _0x2a84f8=path[_0x0baf('0xed')](_0x3fa8eb,_0x1d5b73);var _0x552504=[];_0x552504['push']({'model':db[_0x0baf('0xf9')],'as':_0x0baf('0xf9'),'attributes':['id',_0x0baf('0x47')],'raw':!![]});_0x552504[_0x0baf('0x4c')]({'model':db['CmContact'],'as':_0x0baf('0x7b'),'attributes':['id',_0x0baf('0x124'),_0x0baf('0x125')],'raw':!![]});if(_0x51d2aa[_0x0baf('0x53')][_0x0baf('0x123')]){_0x552504[_0x0baf('0x4c')]({'model':db[_0x0baf('0x126')],'as':_0x0baf('0x126'),'raw':!![]});}var _0x5bbd33=[{'model':db[_0x0baf('0xf7')],'as':_0x0baf('0xf8'),'attributes':['id',_0x0baf('0x40'),_0x0baf('0x8f'),_0x0baf('0x104'),_0x0baf('0x105'),'read'],'include':_0x552504}];_0x5bbd33[_0x0baf('0x4c')]({'model':db[_0x0baf('0xd1')],'as':'Account','attributes':['id','name']});_0x5bbd33[_0x0baf('0x4c')]({'model':db['User'],'as':_0x0baf('0x127'),'attributes':['id',_0x0baf('0x47')]});return db[_0x0baf('0x4e')][_0x0baf('0x89')]({'where':{'id':_0x51d2aa['params']['id']},'include':_0x5bbd33})[_0x0baf('0x24')](handleEntityNotFound(_0x26d73d,null))[_0x0baf('0x24')](function(_0x32c2a8){if(_0x32c2a8){var _0x58fea2=_0x32c2a8[_0x0baf('0x128')]({'plain':!![]});fs[_0x0baf('0x129')](_0x4316c5);var _0x5f5d45={'channel':_0x0baf('0x12a'),'account':_0x58fea2['Account'][_0x0baf('0x3f')],'agent':_0x58fea2[_0x0baf('0x127')]?_0x58fea2[_0x0baf('0x127')][_0x0baf('0x47')]:'N.A.','createdAt':moment(_0x58fea2[_0x0baf('0x8f')])[_0x0baf('0xf4')]('YYYY-MM-DD\x20HH:mm:ss')[_0x0baf('0xb0')](),'closedAt':_0x58fea2[_0x0baf('0xe5')]?moment(_0x58fea2['closedAt'])[_0x0baf('0xf4')](_0x0baf('0x12b'))['toString']():'','disposition':_0x58fea2[_0x0baf('0x12c')],'chatInfo':{'browser':_0x58fea2[_0x0baf('0x12d')],'os':_0x58fea2[_0x0baf('0x12e')],'referer':_0x58fea2[_0x0baf('0x12f')],'customerIp':_0x58fea2[_0x0baf('0x130')],'customerPort':_0x58fea2[_0x0baf('0x131')]?_0x58fea2['customerPort']:_0x0baf('0x132')},'messages':_(_0x58fea2[_0x0baf('0xf8')])[_0x0baf('0x133')]()[_0x0baf('0x9b')]({'secret':![]})[_0x0baf('0x46')](function(_0x1ca912){if(_0x1ca912[_0x0baf('0x126')]){var _0x70e2e=path[_0x0baf('0xed')](_0x1bd67f,_0x1ca912[_0x0baf('0x126')][_0x0baf('0xe9')]);if(fs[_0x0baf('0x134')](_0x70e2e)){fs[_0x0baf('0x135')](_0x70e2e)[_0x0baf('0x136')](fs[_0x0baf('0x137')](path[_0x0baf('0xed')](_0x4316c5,_0x1ca912[_0x0baf('0x126')][_0x0baf('0xe9')])));}}return{'date':moment(_0x1ca912[_0x0baf('0x8f')])[_0x0baf('0xf4')](_0x0baf('0x12b'))[_0x0baf('0xb0')](),'sender':_0x1ca912['direction']===_0x0baf('0xdf')?_0x1ca912[_0x0baf('0xf9')]?_0x1ca912['User']['fullname']:'System':_0x1ca912[_0x0baf('0x7b')]['firstName']+(_0x1ca912['Contact']['lastName']?'\x20'+_0x1ca912[_0x0baf('0x7b')][_0x0baf('0x125')]:''),'body':_0x1ca912[_0x0baf('0x126')]?_0x1ca912['Attachment'][_0x0baf('0xe9')]:_0x1ca912['body'],'direction':_0x1ca912['direction']===_0x0baf('0xdf')?'A':'C','secret':_0x1ca912[_0x0baf('0x105')],'read':_0x1ca912[_0x0baf('0x96')],'attachment':_0x1ca912['Attachment']};})['value']()};return ejs[_0x0baf('0x138')](path[_0x0baf('0xed')](config[_0x0baf('0xee')],_0x0baf('0x121'),_0x0baf('0x139'),_0x0baf('0x13a')),{'interaction':_0x5f5d45})['then'](function(_0x4c1f01){var _0x217cd8=path[_0x0baf('0xed')](_0x4316c5,'transcript-'+_0x58fea2['id']+'-'+_0x20cc18+_0x0baf('0x13b'));var _0x223d32={'path':_0x217cd8,'channel':_0x0baf('0x12a'),'interactionId':_0x58fea2['id']};return pdf[_0x0baf('0x13c')](_0x4c1f01,_0x223d32);})['then'](function(){return new BPromise(function(_0xcca408,_0x557ec9){zipdir(_0x4316c5,{'saveTo':_0x2a84f8},function(_0x479231,_0x320409){if(_0x479231)return _0x557ec9(_0x479231);return _0xcca408(_0x320409);});})['then'](function(){return new BPromise(function(_0x4a0f32,_0xc6fc4d){rimraf(_0x4316c5,function(_0x46b904){if(_0x46b904)_0xc6fc4d(_0x46b904);return _0x4a0f32();});});})['then'](function(){return _0x26d73d[_0x0baf('0xf1')](_0x2a84f8,_0x1d5b73,function(_0x2dea20){if(_0x2dea20){console[_0x0baf('0x13d')](_0x0baf('0x13e'),_0x2dea20);}else{fs[_0x0baf('0x13f')](_0x2a84f8);}});});});}else{return _0x26d73d[_0x0baf('0x2f')](0xc8);}})['catch'](handleError(_0x26d73d,null));}; \ No newline at end of file +var _0xea28=['fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./chatInteraction.socket','register','jayson/promise','client','http','request','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','error','code','message','catch','status','end','json','offset','undefined','limit','count','Content-Range','apply','update','destroy','sendStatus','stack','name','merge','contact','agent','interaction','account','Users','map','TagIds','Tags','split','forEach','index','ChatInteraction','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','select','field','color','u.id','ui.ChatInteractionId','from','user_has_chat_interactions','users','u.id\x20=\x20ui.UserId','chat_interactions','left_join','cm_contacts','o.id\x20=\x20i.UserId','chat_websites','a.id\x20=\x20i.ChatWebsiteId','chat_messages','me.ChatInteractionId\x20=\x20i.id','tools_tags','t.id\x20=\x20it.TagId','search','parseSearch','conditions','find','unreadMessages','having','`\x20=\x200','Contact','$substring','value','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','start','Tag','union','User','operator','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','text','compact','i.ChatWebsiteId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','isNumeric','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','isEmpty','t.id\x20IN\x20?','resolve','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','role','user','getChatWebsites','i.ChatWebsiteId\x20IS\x20NULL','sequelize','toString','keyBy','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','Contact.firstName','Contact.lastName','Contact.email','Contact.phone','c.mobile','Contact.mobile','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.ChatInteractionId\x20IN\x20?','groupBy','ChatInteractionId','push','all','params','includeAll','options','create','body','describe','createVidaooSession','findOne','ChatWebsite','ChatWebsiteId','vidaooApiKey','vidaooEscalation','vidaooNote','vidaooMetadata','POST','https://api-vidaoo.xcally.com/api/v1/meetings','email','isNull','follow','metadata','ValidationError','Error\x20in\x20conversion\x20vidaooMetadata','join_url','ChatMessage','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','customUpdate','CmContact','abandon','entity\x20not\x20found','Interaction\x20already\x20assigned','disposition','AbandonInteraction','attachmentUpload','file','originalname','basename','filename','mimetype','attachmentDownload','closed','Unauthorized','Attachment','attachId','ChatOfflineMessageId','join','root','server/files/attachments/','offline-chat/','download','close','mailTranscript','server/files/chat/upload/','now','pathTranscript','%s%d','agentAlias','System','customer','format','Visitor','agentIdentifier','website_alias','agent_alias','alias','agent_fullname','fullname','[%s]\x20%s:\x20%s\x0a','direction','appendFileSync','MailServerOut','Smtp','service','port','secure','authentication','auth','SendMail','sendMail','\x22%s\x22\x20<%s>','Mail\x20Transcript','addMessage','ids','omit','getMessages','include','findAll','rows','getMyMessages','secret','includeAgent','addTags','setTags','spread','emit','removeTags','files','attachments','transcript-%d-%s.zip','firstName','lastName','Messages','read','Account','Chat','Owner','YYYY-MM-DD\x20HH:mm:ss','browserName','customerIp','customerPort','tail','existsSync','createReadStream','pipe','createWriteStream','out','renderFile','views','downloadInteraction.ejs','transcript-','log','unlinkSync','eml-format','rimraf','zip-dir'];(function(_0x57192c,_0x15496a){var _0x3d9932=function(_0x101291){while(--_0x101291){_0x57192c['push'](_0x57192c['shift']());}};_0x3d9932(++_0x15496a);}(_0xea28,0x13a));var _0x8ea2=function(_0x152f32,_0x2243d8){_0x152f32=_0x152f32-0x0;var _0x45d400=_0xea28[_0x152f32];return _0x45d400;};'use strict';var emlformat=require(_0x8ea2('0x0'));var rimraf=require(_0x8ea2('0x1'));var zipdir=require(_0x8ea2('0x2'));var jsonpatch=require(_0x8ea2('0x3'));var rp=require(_0x8ea2('0x4'));var moment=require(_0x8ea2('0x5'));var BPromise=require(_0x8ea2('0x6'));var Mustache=require(_0x8ea2('0x7'));var util=require('util');var path=require(_0x8ea2('0x8'));var sox=require(_0x8ea2('0x9'));var csv=require(_0x8ea2('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8ea2('0xb'));var _=require(_0x8ea2('0xc'));var squel=require(_0x8ea2('0xd'));var crypto=require(_0x8ea2('0xe'));var jsforce=require(_0x8ea2('0xf'));var deskjs=require(_0x8ea2('0x10'));var toCsv=require(_0x8ea2('0xa'));var querystring=require(_0x8ea2('0x11'));var Papa=require(_0x8ea2('0x12'));var Redis=require(_0x8ea2('0x13'));var authService=require(_0x8ea2('0x14'));var qs=require(_0x8ea2('0x15'));var as=require('../../components/parsers/advancedSearch');var pdf=require('../../components/export/pdf');var hardwareService=require(_0x8ea2('0x16'));var logger=require(_0x8ea2('0x17'))(_0x8ea2('0x18'));var utils=require('../../config/utils');var config=require(_0x8ea2('0x19'));var licenseUtil=require(_0x8ea2('0x1a'));var db=require(_0x8ea2('0x1b'))['db'];config[_0x8ea2('0x1c')]=_[_0x8ea2('0x1d')](config['redis'],{'host':_0x8ea2('0x1e'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x8ea2('0x1f'))[_0x8ea2('0x20')](socket);var jayson=require(_0x8ea2('0x21'));var client=jayson[_0x8ea2('0x22')][_0x8ea2('0x23')]({'port':0x232b});var client9004=jayson[_0x8ea2('0x22')][_0x8ea2('0x23')]({'port':0x232c});function respondWithRpcPromise(_0x11f5e8,_0x474873,_0x396aab,_0x2dfa7c){return new BPromise(function(_0x1c1715,_0x3bc774){var _0xaa8abf=_0x2dfa7c||client;return _0xaa8abf[_0x8ea2('0x24')](_0x11f5e8,_0x396aab)[_0x8ea2('0x25')](function(_0x467045){logger[_0x8ea2('0x26')](_0x8ea2('0x27'),_0x474873,_0x8ea2('0x28'));logger[_0x8ea2('0x29')](_0x8ea2('0x2a'),_0x474873,'request\x20sent',JSON['stringify'](_0x467045));if(_0x467045[_0x8ea2('0x2b')]){if(_0x467045[_0x8ea2('0x2b')][_0x8ea2('0x2c')]===0x1f4){logger['error'](_0x8ea2('0x27'),_0x474873,_0x467045[_0x8ea2('0x2b')]['message']);return _0x3bc774(_0x467045[_0x8ea2('0x2b')][_0x8ea2('0x2d')]);}logger[_0x8ea2('0x2b')](_0x8ea2('0x27'),_0x474873,_0x467045[_0x8ea2('0x2b')][_0x8ea2('0x2d')]);return _0x1c1715(_0x467045[_0x8ea2('0x2b')][_0x8ea2('0x2d')]);}else{logger[_0x8ea2('0x26')]('ChatInteraction,\x20%s,\x20%s',_0x474873,_0x8ea2('0x28'));_0x1c1715(_0x467045['result'][_0x8ea2('0x2d')]);}})[_0x8ea2('0x2e')](function(_0x29b38f){logger['error']('ChatInteraction,\x20%s,\x20%s',_0x474873,_0x29b38f);_0x3bc774(_0x29b38f);});});}function respondWithStatusCode(_0x2e4da3,_0x4dc7bf){_0x4dc7bf=_0x4dc7bf||0xcc;return function(_0x200a49){if(_0x200a49){return _0x2e4da3['sendStatus'](_0x4dc7bf);}return _0x2e4da3[_0x8ea2('0x2f')](_0x4dc7bf)[_0x8ea2('0x30')]();};}function respondWithResult(_0x21c526,_0x266db8){_0x266db8=_0x266db8||0xc8;return function(_0x4e1b90){if(_0x4e1b90){return _0x21c526['status'](_0x266db8)[_0x8ea2('0x31')](_0x4e1b90);}};}function respondWithFilteredResult(_0x4da5b3,_0x4a9875){return function(_0x287078){if(_0x287078){var _0x24f187=typeof _0x4a9875[_0x8ea2('0x32')]===_0x8ea2('0x33')&&typeof _0x4a9875[_0x8ea2('0x34')]===_0x8ea2('0x33');var _0x316707=_0x287078[_0x8ea2('0x35')];var _0x9c5fac=_0x24f187?0x0:_0x4a9875['offset'];var _0x5b7ff9=_0x24f187?_0x287078[_0x8ea2('0x35')]:_0x4a9875[_0x8ea2('0x32')]+_0x4a9875['limit'];var _0x4a110f;if(_0x5b7ff9>=_0x316707){_0x5b7ff9=_0x316707;_0x4a110f=0xc8;}else{_0x4a110f=0xce;}_0x4da5b3[_0x8ea2('0x2f')](_0x4a110f);return _0x4da5b3['set'](_0x8ea2('0x36'),_0x9c5fac+'-'+_0x5b7ff9+'/'+_0x316707)[_0x8ea2('0x31')](_0x287078);}return null;};}function patchUpdates(_0x53fd06){return function(_0x17b21c){try{jsonpatch[_0x8ea2('0x37')](_0x17b21c,_0x53fd06,!![]);}catch(_0x33abc8){return BPromise['reject'](_0x33abc8);}return _0x17b21c['save']();};}function saveUpdates(_0x49a252,_0x3880c3){return function(_0x233e12){if(_0x233e12){return _0x233e12[_0x8ea2('0x38')](_0x49a252)['then'](function(_0x456487){return _0x456487;});}return null;};}function removeEntity(_0x391b08,_0x3d5bf0){return function(_0x278e5d){if(_0x278e5d){return _0x278e5d[_0x8ea2('0x39')]()[_0x8ea2('0x25')](function(){_0x391b08[_0x8ea2('0x2f')](0xcc)[_0x8ea2('0x30')]();});}};}function handleEntityNotFound(_0x5e9b1f,_0x955ef3){return function(_0x29e3f5){if(!_0x29e3f5){_0x5e9b1f[_0x8ea2('0x3a')](0x194);}return _0x29e3f5;};}function handleError(_0x467d97,_0x4eebc1){_0x4eebc1=_0x4eebc1||0x1f4;return function(_0x2a1f14){logger['error'](_0x2a1f14[_0x8ea2('0x3b')]);if(_0x2a1f14[_0x8ea2('0x3c')]){delete _0x2a1f14[_0x8ea2('0x3c')];}_0x467d97[_0x8ea2('0x2f')](_0x4eebc1)['send'](_0x2a1f14);};}function getMustacheRender(_0x2bed24,_0x531979){return Mustache['render'](_0x2bed24,_[_0x8ea2('0x3d')](_0x531979['body'],{'contact':_0x531979[_0x8ea2('0x3e')],'message':_0x531979[_0x8ea2('0x2d')],'agent':_0x531979[_0x8ea2('0x3f')],'interaction':_0x531979[_0x8ea2('0x40')],'account':_0x531979[_0x8ea2('0x41')]}))||'';}function getInteractionUsers(_0x4ae536,_0x84685d){return new BPromise(function(_0x5c5d2d,_0x12a6c2){try{if(_0x84685d[_0x4ae536['id']]){_0x4ae536[_0x8ea2('0x42')]=_[_0x8ea2('0x43')](_0x84685d[_0x4ae536['id']],function(_0x3995ff){return{'id':_0x3995ff['id'],'fullname':_0x3995ff['fullname']};});}}catch(_0x44e8bc){_0x12a6c2(_0x44e8bc);}_0x5c5d2d(_0x4ae536);});}function getInteractionTags(_0x57a6b8,_0x3f0c78){return new BPromise(function(_0x5ba351,_0x2ee78b){try{if(_0x57a6b8[_0x8ea2('0x44')]){_0x57a6b8[_0x8ea2('0x45')]=[];_0x57a6b8[_0x8ea2('0x44')][_0x8ea2('0x46')](',')[_0x8ea2('0x47')](function(_0x2f4fa8){_0x57a6b8['Tags']['push'](_0x3f0c78[_0x2f4fa8]);});}delete _0x57a6b8[_0x8ea2('0x44')];}catch(_0x53455a){_0x2ee78b(_0x53455a);}_0x5ba351(_0x57a6b8);});}function updateChatInteraction(_0x4b03fa,_0x59e2fa,_0x3cbc09){return new BPromise(function(_0x5d9ba0,_0x40a532){return getInteractionUsers(_0x4b03fa,_0x3cbc09)[_0x8ea2('0x25')](function(_0x39c944){return getInteractionTags(_0x39c944,_0x59e2fa);})[_0x8ea2('0x25')](function(_0x989d9b){_0x5d9ba0(_0x989d9b);})[_0x8ea2('0x2e')](function(_0x3b2219){_0x40a532(_0x3b2219);});});}exports[_0x8ea2('0x48')]=function(_0x5352b9,_0x3afb80){var _0x1ef615={},_0x1db25c={},_0x5cb6ad={'count':0x0,'rows':[]};var _0x2d6bbb=_[_0x8ea2('0x43')](db[_0x8ea2('0x49')][_0x8ea2('0x4a')],function(_0x20992d){return{'name':_0x20992d['fieldName'],'type':_0x20992d[_0x8ea2('0x4b')][_0x8ea2('0x4c')]};});_0x1db25c[_0x8ea2('0x4d')]=_['map'](_0x2d6bbb,_0x8ea2('0x3c'));_0x1db25c[_0x8ea2('0x4e')]=_[_0x8ea2('0x4f')](_0x5352b9[_0x8ea2('0x4e')]);_0x1db25c[_0x8ea2('0x50')]=_[_0x8ea2('0x51')](_0x1db25c[_0x8ea2('0x4d')],_0x1db25c[_0x8ea2('0x4e')]);_0x1ef615[_0x8ea2('0x52')]=_[_0x8ea2('0x51')](_0x1db25c[_0x8ea2('0x4d')],qs[_0x8ea2('0x53')](_0x5352b9[_0x8ea2('0x4e')][_0x8ea2('0x53')]));_0x1ef615['attributes']=_0x1ef615[_0x8ea2('0x52')][_0x8ea2('0x54')]?_0x1ef615[_0x8ea2('0x52')]:_0x1db25c[_0x8ea2('0x4d')];if(!_0x5352b9[_0x8ea2('0x4e')][_0x8ea2('0x55')](_0x8ea2('0x56'))){_0x1ef615[_0x8ea2('0x34')]=qs['limit'](_0x5352b9[_0x8ea2('0x4e')][_0x8ea2('0x34')]);_0x1ef615[_0x8ea2('0x32')]=qs['offset'](_0x5352b9['query'][_0x8ea2('0x32')]);}_0x1ef615[_0x8ea2('0x57')]=qs[_0x8ea2('0x58')](_0x5352b9['query'][_0x8ea2('0x58')]);_0x1ef615[_0x8ea2('0x59')]=qs[_0x8ea2('0x50')](_[_0x8ea2('0x5a')](_0x5352b9[_0x8ea2('0x4e')],_0x1db25c['filters']),_0x2d6bbb);var _0x4afd85=[];var _0x24a22a=squel[_0x8ea2('0x5b')]()[_0x8ea2('0x5c')]('id')['field'](_0x8ea2('0x3c'))[_0x8ea2('0x5c')](_0x8ea2('0x5d'))['from']('tools_tags');var _0x48aebf=squel['select']()['field'](_0x8ea2('0x5e'))[_0x8ea2('0x5c')]('u.fullname')['field'](_0x8ea2('0x5f'))[_0x8ea2('0x60')](_0x8ea2('0x61'),'ui')['left_join'](_0x8ea2('0x62'),'u',_0x8ea2('0x63'));var _0x59e3df=squel[_0x8ea2('0x5b')]()[_0x8ea2('0x60')](_0x8ea2('0x64'),'i')[_0x8ea2('0x65')](_0x8ea2('0x66'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')['left_join']('users','o',_0x8ea2('0x67'))[_0x8ea2('0x65')](_0x8ea2('0x68'),'a',_0x8ea2('0x69'))[_0x8ea2('0x65')](_0x8ea2('0x6a'),'me',_0x8ea2('0x6b'))['left_join']('chat_interaction_has_tags','it','it.ChatInteractionId\x20=\x20i.id')[_0x8ea2('0x65')](_0x8ea2('0x6c'),'t',_0x8ea2('0x6d'));var _0x2bbec0=squel['expr']();var _0x11824e=[];var _0x2b8662=squel['expr']();var _0x21485a;if(_0x5352b9[_0x8ea2('0x4e')][_0x8ea2('0x6e')]){_0x21485a=as[_0x8ea2('0x6f')](_0x5352b9[_0x8ea2('0x4e')]['search']);var _0x479c05=_0x21485a['sqlOperator'];for(var _0x53a62c=0x0;_0x53a62c<_0x21485a[_0x8ea2('0x70')][_0x8ea2('0x54')];_0x53a62c++){var _0x2d8221=_0x21485a[_0x8ea2('0x70')][_0x53a62c];var _0x491d3d='i';var _0x461d32=_[_0x8ea2('0x71')](_0x2d6bbb,[_0x8ea2('0x3c'),_0x2d8221[_0x8ea2('0x5c')]]);if(!_0x461d32){switch(_0x2d8221['field']){case _0x8ea2('0x72'):if(_0x2d8221['value']==0x1){_0x59e3df[_0x8ea2('0x73')]('`'+_0x2d8221['field']+_0x8ea2('0x74'));}else{_0x59e3df[_0x8ea2('0x73')]('`'+_0x2d8221['field']+'`\x20>\x200');}break;case _0x8ea2('0x75'):if(_0x2d8221['operator']===_0x8ea2('0x76')){if(_0x2d8221[_0x8ea2('0x77')][_0x8ea2('0x46')]('\x20')[_0x8ea2('0x54')]>0x1){_0x2bbec0[_0x479c05]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x8ea2('0x78')](_0x2d8221[_0x8ea2('0x77')]),null);}else{var _0x39776d='%'+_0x2d8221[_0x8ea2('0x77')]+'%';_0x2bbec0[_0x479c05](_0x8ea2('0x79'),_0x39776d,_0x39776d,_0x39776d);}}else{_0x461d32=_[_0x8ea2('0x71')](_0x2d6bbb,[_0x8ea2('0x3c'),_0x8ea2('0x7a')]);_0x2d8221[_0x8ea2('0x5c')]=_0x8ea2('0x7a');_0x3d55db=as[_0x8ea2('0x7b')](_0x491d3d,_0x461d32[_0x8ea2('0x4b')],_0x2d8221);_0x2bbec0[_0x479c05](_0x3d55db['text'],_0x3d55db[_0x8ea2('0x77')][_0x8ea2('0x7c')],_0x3d55db[_0x8ea2('0x77')][_0x8ea2('0x30')]);}break;case _0x8ea2('0x7d'):var _0x219f78=_0x2d8221[_0x8ea2('0x77')][_0x8ea2('0x46')](',')[_0x8ea2('0x43')](function(_0xefb7b){return Number(_0xefb7b);});_0x219f78[_0x8ea2('0x47')](function(_0x35cfc5){_0x2b8662['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x35cfc5+',%');});_0x11824e=_[_0x8ea2('0x7e')](_0x11824e,_0x219f78);break;case _0x8ea2('0x7f'):if(_0x2d8221[_0x8ea2('0x80')]===_0x8ea2('0x76')){_0x2bbec0[_0x479c05](_0x8ea2('0x81'),'%'+_0x2d8221['value']+'%',null);}else{_0x461d32=_['find'](_0x2d6bbb,['name',_0x8ea2('0x82')]);_0x2d8221[_0x8ea2('0x5c')]=_0x8ea2('0x82');_0x3d55db=as[_0x8ea2('0x7b')](_0x491d3d,_0x461d32[_0x8ea2('0x4b')],_0x2d8221);_0x2bbec0[_0x479c05](_0x3d55db[_0x8ea2('0x83')],_0x3d55db['value'][_0x8ea2('0x7c')],_0x3d55db[_0x8ea2('0x77')]['end']);}break;case'body':_0x3d55db=as[_0x8ea2('0x7b')]('me',null,_0x2d8221);_0x2bbec0[_0x479c05](_0x3d55db[_0x8ea2('0x83')],_0x3d55db[_0x8ea2('0x77')][_0x8ea2('0x7c')],_0x3d55db[_0x8ea2('0x77')][_0x8ea2('0x30')]);break;}}else{var _0x3d55db=as['buildExpression'](_0x491d3d,_0x461d32[_0x8ea2('0x4b')],_0x2d8221);_0x2bbec0[_0x479c05](_0x3d55db[_0x8ea2('0x83')],_0x3d55db[_0x8ea2('0x77')][_0x8ea2('0x7c')],_0x3d55db['value'][_0x8ea2('0x30')]);}}}else{var _0x356099=_(_0x5352b9[_0x8ea2('0x4e')])['keys']()[_0x8ea2('0x43')](function(_0x5c2d05){return _['some'](_0x2d6bbb,[_0x8ea2('0x3c'),_0x5c2d05])?_0x5c2d05:undefined;})[_0x8ea2('0x84')]()['value']();if(!_['isEmpty'](_0x356099)){_0x356099['forEach'](function(_0x167f15){if(_0x167f15==='ChatWebsiteId'){_0x59e3df['where'](_0x8ea2('0x85'),[][_0x8ea2('0x86')](_0x5352b9[_0x8ea2('0x4e')][_0x167f15]));}else if(_0x167f15===_0x8ea2('0x87')){var _0x1681d8=JSON[_0x8ea2('0x88')](_0x5352b9[_0x8ea2('0x4e')][_0x167f15])[_0x8ea2('0x89')];var _0x14a5de=JSON[_0x8ea2('0x88')](_0x5352b9[_0x8ea2('0x4e')][_0x167f15])[_0x8ea2('0x8a')];_0x59e3df[_0x8ea2('0x59')](_0x8ea2('0x8b'),_0x1681d8,_0x14a5de);}else{if(_0x5352b9['query'][_0x167f15]===_0x8ea2('0x8c')){_0x59e3df[_0x8ea2('0x59')]('i.'+_0x167f15+_0x8ea2('0x8d'));}else{_0x59e3df['where']('i.'+_0x167f15+_0x8ea2('0x8e'),_0x5352b9['query'][_0x167f15]);}}});}if(_0x5352b9[_0x8ea2('0x4e')]['read']){if(_0x5352b9[_0x8ea2('0x4e')]['read']==0x1){_0x59e3df[_0x8ea2('0x73')](_0x8ea2('0x8f'));}else{_0x59e3df['having'](_0x8ea2('0x90'));}}if(_0x5352b9['query'][_0x8ea2('0x91')]){_0x11824e=_[_0x8ea2('0x92')](_0x5352b9[_0x8ea2('0x4e')][_0x8ea2('0x91')])?_0x5352b9[_0x8ea2('0x4e')]['tag']:new Array(_0x5352b9['query'][_0x8ea2('0x91')]);_0x11824e['forEach'](function(_0x410f78){_0x2b8662['or'](_0x8ea2('0x93'),'%,'+_0x410f78+',%');});}if(_0x5352b9[_0x8ea2('0x4e')][_0x8ea2('0x94')]){var _0x262cef=_0x5352b9[_0x8ea2('0x4e')]['filter']['replace']('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0x8ea2('0x95')](_0x262cef)){_0x2bbec0['or']('i.id\x20LIKE\x20?',_0x262cef+'%');}else{_0x2bbec0['or'](_0x8ea2('0x96'),qs[_0x8ea2('0x78')](_0x262cef))['or'](_0x8ea2('0x97'),_0x262cef+'%');}}}_0x59e3df[_0x8ea2('0x59')](_0x2bbec0);_0x59e3df[_0x8ea2('0x98')](_0x8ea2('0x99'));var _0x4b4d64={'type':db[_0x8ea2('0x9a')][_0x8ea2('0x9b')][_0x8ea2('0x9c')],'raw':!![]};var _0x335a96=_0x59e3df[_0x8ea2('0x9d')]();_0x335a96['field']('i.id');_0x335a96[_0x8ea2('0x5c')](_0x8ea2('0x9e'),_0x8ea2('0x72'));if(_0x1ef615[_0x8ea2('0x57')]){_0x1ef615[_0x8ea2('0x57')][_0x8ea2('0x47')](function(_0x2e0bbe){var _0x9c4960=_0x2e0bbe[0x0]===_0x8ea2('0x9f')?_0x2e0bbe[0x0]:'i.'+_0x2e0bbe[0x0];_0x59e3df[_0x8ea2('0x57')](_0x9c4960,_0x2e0bbe[0x1]===_0x8ea2('0xa0')?![]:!![]);});}if(!_[_0x8ea2('0xa1')](_0x11824e)){_0x59e3df[_0x8ea2('0x73')](_0x2b8662);_0x335a96[_0x8ea2('0x59')](_0x8ea2('0xa2'),_0x11824e);}BPromise[_0x8ea2('0xa3')]()[_0x8ea2('0x25')](function(){if(!_0x21485a){if(_0x5352b9['query']['ChatWebsiteId'])return;_0x335a96[_0x8ea2('0x59')]('i.ChatWebsiteId\x20IS\x20NOT\x20NULL');_0x59e3df[_0x8ea2('0x59')](_0x8ea2('0xa4'));return;}if(_0x5352b9['user'][_0x8ea2('0xa5')]!=='agent')return;return _0x5352b9[_0x8ea2('0xa6')][_0x8ea2('0xa7')]({'attributes':['id'],'raw':!![]})['then'](function(_0x17dee8){if(_[_0x8ea2('0xa1')](_0x17dee8)){_0x335a96[_0x8ea2('0x59')](_0x8ea2('0xa8'));_0x59e3df[_0x8ea2('0x59')](_0x8ea2('0xa8'));}else{_0x335a96[_0x8ea2('0x59')](_0x8ea2('0x85'),_[_0x8ea2('0x43')](_0x17dee8,'id'));_0x59e3df[_0x8ea2('0x59')]('i.ChatWebsiteId\x20IN\x20?',_[_0x8ea2('0x43')](_0x17dee8,'id'));}});})[_0x8ea2('0x25')](function(){if(_0x5352b9['user'][_0x8ea2('0xa5')]==='agent'&&!_0x21485a&&!_0x5352b9['query']['ChatWebsiteId'])return[];return db[_0x8ea2('0xa9')]['query'](_0x335a96[_0x8ea2('0xaa')](),_0x4b4d64);})[_0x8ea2('0x25')](function(_0x12ed20){_0x5cb6ad[_0x8ea2('0x35')]=_0x12ed20[_0x8ea2('0x54')];if(_0x5cb6ad[_0x8ea2('0x35')]===0x0)return[];return db['sequelize'][_0x8ea2('0x4e')](_0x24a22a['toString'](),_0x4b4d64)[_0x8ea2('0x25')](function(_0x18aa81){_0x4afd85=_[_0x8ea2('0xab')](_0x18aa81,'id');_0x4b4d64=_[_0x8ea2('0x3d')](_0x4b4d64,{'model':db[_0x8ea2('0x49')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x5352b9['query'][_0x8ea2('0x53')]){_0x1ef615[_0x8ea2('0x52')][_0x8ea2('0x47')](function(_0x2a82b2){_0x59e3df[_0x8ea2('0x5c')]('i.'+_0x2a82b2);});}else{_0x59e3df[_0x8ea2('0x5c')](_0x8ea2('0x9e'),_0x8ea2('0x72'));_0x59e3df[_0x8ea2('0x5c')](_0x8ea2('0xac'),_0x8ea2('0xad'));_0x59e3df[_0x8ea2('0x5c')](_0x8ea2('0xae'),_0x8ea2('0xaf'));_0x59e3df[_0x8ea2('0x5c')](_0x8ea2('0xb0'),_0x8ea2('0x9f'));_0x59e3df['field'](_0x8ea2('0xb1'));_0x59e3df['field']('c.firstName',_0x8ea2('0xb2'));_0x59e3df[_0x8ea2('0x5c')]('c.lastName',_0x8ea2('0xb3'));_0x59e3df[_0x8ea2('0x5c')]('c.email',_0x8ea2('0xb4'));_0x59e3df[_0x8ea2('0x5c')]('c.phone',_0x8ea2('0xb5'));_0x59e3df[_0x8ea2('0x5c')](_0x8ea2('0xb6'),_0x8ea2('0xb7'));_0x59e3df[_0x8ea2('0x5c')]('c.fax',_0x8ea2('0xb8'));_0x59e3df[_0x8ea2('0x5c')](_0x8ea2('0xb9'),_0x8ea2('0xba'));_0x59e3df[_0x8ea2('0x5c')](_0x8ea2('0xbb'),_0x8ea2('0xbc'));_0x59e3df[_0x8ea2('0x5c')](_0x8ea2('0xbd'),'TagIds');}if(_0x1ef615[_0x8ea2('0x34')])_0x59e3df['limit'](_0x1ef615[_0x8ea2('0x34')]);if(_0x1ef615[_0x8ea2('0x32')])_0x59e3df[_0x8ea2('0x32')](_0x1ef615[_0x8ea2('0x32')]);return db[_0x8ea2('0xa9')]['query'](_0x59e3df[_0x8ea2('0xaa')](),_0x4b4d64);})[_0x8ea2('0x25')](function(_0x4fdd16){if(_0x4fdd16['length']>0x0)_0x48aebf[_0x8ea2('0x59')](_0x8ea2('0xbe'),_['map'](_0x4fdd16,'id'));return db['sequelize'][_0x8ea2('0x4e')](_0x48aebf[_0x8ea2('0xaa')](),_0x4b4d64)['then'](function(_0x2b7e80){var _0x2f6673=_[_0x8ea2('0xbf')](_0x2b7e80,_0x8ea2('0xc0'));var _0xdf4de9=[];_0x4fdd16['forEach'](function(_0x2e3a5d){_0xdf4de9[_0x8ea2('0xc1')](updateChatInteraction(_0x2e3a5d,_0x4afd85,_0x2f6673));});return BPromise[_0x8ea2('0xc2')](_0xdf4de9);});});})[_0x8ea2('0x25')](function(_0x412af1){_0x5cb6ad['rows']=_0x412af1;return _0x5cb6ad;})[_0x8ea2('0x25')](respondWithFilteredResult(_0x3afb80,_0x1ef615))['catch'](handleError(_0x3afb80,null));};exports['show']=function(_0x9468be,_0x17e9fc){var _0x5c95ec={'raw':![],'where':{'id':_0x9468be[_0x8ea2('0xc3')]['id']}},_0x239516={};_0x239516[_0x8ea2('0x4d')]=_[_0x8ea2('0x4f')](db[_0x8ea2('0x49')][_0x8ea2('0x4a')]);_0x239516['query']=_[_0x8ea2('0x4f')](_0x9468be[_0x8ea2('0x4e')]);_0x239516[_0x8ea2('0x50')]=_['intersection'](_0x239516[_0x8ea2('0x4d')],_0x239516[_0x8ea2('0x4e')]);_0x5c95ec[_0x8ea2('0x52')]=_[_0x8ea2('0x51')](_0x239516[_0x8ea2('0x4d')],qs['fields'](_0x9468be[_0x8ea2('0x4e')][_0x8ea2('0x53')]));_0x5c95ec[_0x8ea2('0x52')]=_0x5c95ec[_0x8ea2('0x52')]['length']?_0x5c95ec['attributes']:_0x239516[_0x8ea2('0x4d')];if(_0x9468be['query'][_0x8ea2('0xc4')]){_0x5c95ec['include']=[{'all':!![]}];}_0x5c95ec=_[_0x8ea2('0x3d')]({},_0x5c95ec,_0x9468be[_0x8ea2('0xc5')]);return db[_0x8ea2('0x49')][_0x8ea2('0x71')](_0x5c95ec)[_0x8ea2('0x25')](handleEntityNotFound(_0x17e9fc,null))[_0x8ea2('0x25')](respondWithResult(_0x17e9fc,null))[_0x8ea2('0x2e')](handleError(_0x17e9fc,null));};exports['create']=function(_0x2c5677,_0x224fca){return db[_0x8ea2('0x49')][_0x8ea2('0xc6')](_0x2c5677[_0x8ea2('0xc7')],{})[_0x8ea2('0x25')](respondWithResult(_0x224fca,0xc9))['catch'](handleError(_0x224fca,null));};exports[_0x8ea2('0x38')]=function(_0x463372,_0x76085){if(_0x463372[_0x8ea2('0xc7')]['id']){delete _0x463372['body']['id'];}return db['ChatInteraction']['find']({'where':{'id':_0x463372[_0x8ea2('0xc3')]['id']}})[_0x8ea2('0x25')](handleEntityNotFound(_0x76085,null))[_0x8ea2('0x25')](saveUpdates(_0x463372['body'],null))[_0x8ea2('0x25')](respondWithResult(_0x76085,null))[_0x8ea2('0x2e')](handleError(_0x76085,null));};exports[_0x8ea2('0x39')]=function(_0x500b47,_0x331019){return db[_0x8ea2('0x49')]['find']({'where':{'id':_0x500b47[_0x8ea2('0xc3')]['id']}})['then'](handleEntityNotFound(_0x331019,null))['then'](removeEntity(_0x331019,null))[_0x8ea2('0x2e')](handleError(_0x331019,null));};exports[_0x8ea2('0xc8')]=function(_0x405020,_0x5c9359){return db[_0x8ea2('0x49')][_0x8ea2('0xc8')]()[_0x8ea2('0x25')](respondWithResult(_0x5c9359,null))[_0x8ea2('0x2e')](handleError(_0x5c9359,null));};exports[_0x8ea2('0xc9')]=function(_0x11c59e,_0x11b02a){var _0x5ab2c4=_0x11c59e[_0x8ea2('0xc3')]['id'];var _0x111f97;var _0xf76d70;var _0x384500;return db[_0x8ea2('0x49')][_0x8ea2('0xca')]({'where':{'id':_0x5ab2c4}})[_0x8ea2('0x25')](function(_0x568581){_0x111f97=_0x568581;return db[_0x8ea2('0xcb')][_0x8ea2('0xca')]({'where':{'id':_0x568581[_0x8ea2('0xcc')]},'attributes':['id',_0x8ea2('0xcd'),_0x8ea2('0xce'),'vidaooTopic',_0x8ea2('0xcf'),_0x8ea2('0xd0')],'raw':!![]});})[_0x8ea2('0x25')](function(_0x1c336e){if(_0x1c336e&&_0x1c336e[_0x8ea2('0xcd')]&&_0x1c336e[_0x8ea2('0xce')]){_0xf76d70=_0x1c336e;var _0x473ae2={'interaction':{'id':_0x5ab2c4},'agent':{'id':_0x11c59e[_0x8ea2('0xa6')]['id'],'name':_0x11c59e[_0x8ea2('0xa6')]['name'],'fullname':_0x11c59e['user']['fullname'],'email':_0x11c59e[_0x8ea2('0xa6')]['email']},'contact':_0x11c59e[_0x8ea2('0xc7')][_0x8ea2('0x3e')],'account':_0x11c59e[_0x8ea2('0xc7')][_0x8ea2('0x41')]};var _0x6c0ccc={'rejectUnauthorized':![],'method':_0x8ea2('0xd1'),'url':_0x8ea2('0xd2'),'headers':{'X-APIKEY':_0x1c336e[_0x8ea2('0xcd')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x11c59e[_0x8ea2('0xa6')][_0x8ea2('0xd3')]],'buttons':null,'topic':_0xf76d70['vidaooTopic'],'note':_[_0x8ea2('0xd4')](_0xf76d70[_0x8ea2('0xcf')])?null:getMustacheRender(_0xf76d70[_0x8ea2('0xcf')],_0x473ae2),'metadata':null},'redirect':_0x8ea2('0xd5'),'json':!![]};try{if(!_[_0x8ea2('0xd4')](_0xf76d70[_0x8ea2('0xd0')])){var _0xc6888c=getMustacheRender(_0xf76d70[_0x8ea2('0xd0')],_0x473ae2);var _0x152d46=JSON[_0x8ea2('0x88')](_0xc6888c);_0x6c0ccc[_0x8ea2('0xc7')][_0x8ea2('0xd6')]=_0x152d46;}}catch(_0x465e7f){throw new db[(_0x8ea2('0x9a'))][(_0x8ea2('0xd7'))](_0x8ea2('0xd8'));}return rp(_0x6c0ccc);}else{throw new db[(_0x8ea2('0x9a'))]['ValidationError']('Error\x20in\x20Vidaoo\x20configuration');}})['then'](function(_0x4b2c0f){_0x384500=_0x4b2c0f;if(_0x384500['id']){var _0x2fcddc={'body':_0x384500[_0x8ea2('0xd9')],'ChatWebsiteId':_0xf76d70['id'],'ChatInteractionId':_0x111f97['id'],'direction':'out','UserId':_0x11c59e[_0x8ea2('0xa6')]['id']};return db[_0x8ea2('0xda')][_0x8ea2('0xc6')](_0x2fcddc,{});}else{throw new db[(_0x8ea2('0x9a'))]['ValidationError'](_0x8ea2('0xdb'));}})['then'](function(){return _0x111f97[_0x8ea2('0xdc')]({'vidaooSessionId':_0x384500['id']});})[_0x8ea2('0x25')](respondWithResult(_0x11b02a,null))[_0x8ea2('0x2e')](handleError(_0x11b02a,null));};exports[_0x8ea2('0xdd')]=function(_0x3b6b03,_0x3292bc){if(_0x3b6b03['body']['id']){delete _0x3b6b03['body']['id'];}return db[_0x8ea2('0x49')][_0x8ea2('0x71')]({'where':{'id':_0x3b6b03['params']['id']},'include':[{'model':db[_0x8ea2('0xde')],'as':'Contact'}]})[_0x8ea2('0x25')](handleEntityNotFound(_0x3292bc,null))[_0x8ea2('0x25')](saveUpdates(_0x3b6b03[_0x8ea2('0xc7')],null))[_0x8ea2('0x25')](respondWithResult(_0x3292bc,null))[_0x8ea2('0x2e')](handleError(_0x3292bc,null));};exports[_0x8ea2('0xdf')]=function(_0x1383b4,_0x4c1b9d,_0x3f3822){if(_0x1383b4[_0x8ea2('0xc7')]['id']){delete _0x1383b4[_0x8ea2('0xc7')]['id'];}return db[_0x8ea2('0x49')][_0x8ea2('0x71')]({'where':{'id':_0x1383b4[_0x8ea2('0xc3')]['id']}})[_0x8ea2('0x25')](function(_0x1c974d){if(!_0x1c974d){logger[_0x8ea2('0x2b')]('abandonInteraction,\x20%s,\x20%s,\x20%s',_0x8ea2('0xdf'),0x194,_0x8ea2('0xe0'));_0x4c1b9d[_0x8ea2('0x3a')](0x194);}else{if(_0x1c974d['UserId']){throw new db[(_0x8ea2('0x9a'))][(_0x8ea2('0xd7'))](_0x8ea2('0xe1'));}}return _0x1c974d;})[_0x8ea2('0x25')](function(_0xe18090){if(_0xe18090){return _0xe18090[_0x8ea2('0x38')]({'closed':_0x1383b4['body']['closed'],'disposition':_0x1383b4[_0x8ea2('0xc7')][_0x8ea2('0xe2')]})[_0x8ea2('0x25')](function(_0x695f4a){return _0x695f4a;});}})[_0x8ea2('0x25')](function(_0x57ff72){return respondWithRpcPromise(_0x8ea2('0xe3'),'abandon',_0x1383b4[_0x8ea2('0xc7')],client9004);})[_0x8ea2('0x25')](respondWithResult(_0x4c1b9d,null))['catch'](handleError(_0x4c1b9d,null));};exports[_0x8ea2('0xe4')]=function(_0x254b51,_0x2c11d2,_0x2aaa88){_0x254b51[_0x8ea2('0xc7')][_0x8ea2('0x3c')]=_0x254b51[_0x8ea2('0xe5')][_0x8ea2('0xe6')];_0x254b51[_0x8ea2('0xc7')][_0x8ea2('0xe7')]=_0x254b51['file'][_0x8ea2('0xe8')];_0x254b51[_0x8ea2('0xc7')][_0x8ea2('0x4b')]=_0x254b51['file'][_0x8ea2('0xe9')];return db['Attachment'][_0x8ea2('0xc6')](_0x254b51[_0x8ea2('0xc7')])[_0x8ea2('0x25')](respondWithResult(_0x2c11d2,0xc9))[_0x8ea2('0x2e')](handleError(_0x2c11d2,null));};exports[_0x8ea2('0xea')]=function(_0x1786ac,_0x7a45a8,_0x3a68e2){return db[_0x8ea2('0x49')]['findOne']({'where':{'id':_0x1786ac[_0x8ea2('0xc3')]['id']},'raw':!![]})[_0x8ea2('0x25')](handleEntityNotFound(_0x7a45a8,null))[_0x8ea2('0x25')](function(_0x8d4abd){if(_0x8d4abd){if(_0x8d4abd[_0x8ea2('0xeb')]){return _0x7a45a8[_0x8ea2('0x2f')](0x193)[_0x8ea2('0x31')]({'status':0x193,'message':_0x8ea2('0xec')});}return db[_0x8ea2('0xed')]['findOne']({'where':{'id':_0x1786ac[_0x8ea2('0x4e')][_0x8ea2('0xee')]},'raw':!![]})[_0x8ea2('0x25')](handleEntityNotFound(_0x7a45a8,null));}})[_0x8ea2('0x25')](function(_0xcbb6b3){if(_0xcbb6b3){var _0x4bdbe0=_0xcbb6b3[_0x8ea2('0xef')]!==null;var _0x44791f=path[_0x8ea2('0xf0')](config[_0x8ea2('0xf1')],_0x8ea2('0xf2'));if(_0x4bdbe0){_0x44791f=path['join'](_0x44791f,_0x8ea2('0xf3'));}var _0x4e7aff=path[_0x8ea2('0xf0')](_0x44791f,_0xcbb6b3[_0x8ea2('0xe7')]);return _0x7a45a8[_0x8ea2('0xf4')](_0x4e7aff);}})['catch'](handleError(_0x7a45a8,null));};exports[_0x8ea2('0xf5')]=function(_0x48a2e2,_0x4e804c){var _0x487bab=null;var _0x1a0966=null;var _0x50087b=null;var _0x196b89=null;if(_0x48a2e2[_0x8ea2('0xc7')]['id']){delete _0x48a2e2[_0x8ea2('0xc7')]['id'];}if(_0x48a2e2[_0x8ea2('0xc7')][_0x8ea2('0xf6')]){_0x196b89=path[_0x8ea2('0xf0')](config[_0x8ea2('0xf1')],_0x8ea2('0xf7'),util['format']('transcript-%s.txt',Date[_0x8ea2('0xf8')]()));_0x48a2e2[_0x8ea2('0xc7')][_0x8ea2('0xf9')]=_0x196b89;}return db['ChatInteraction']['find']({'where':{'id':_0x48a2e2['params']['id']},'include':[{'model':db[_0x8ea2('0xda')],'as':'Messages','include':[{'model':db['User'],'as':_0x8ea2('0x7f')}]}]})[_0x8ea2('0x25')](handleEntityNotFound(_0x4e804c,null))['then'](saveUpdates(_0x48a2e2['body'],null))[_0x8ea2('0x25')](function(_0x48eac8){if(_0x48eac8){_0x487bab=_0x48eac8;return db['ChatWebsite'][_0x8ea2('0x71')]({'where':{'id':_0x487bab[_0x8ea2('0xcc')]}});}})[_0x8ea2('0x25')](function(_0x54da21){if(_0x54da21){_0x50087b=_0x54da21;return db[_0x8ea2('0xde')][_0x8ea2('0x71')]({'where':{'id':_0x487bab[_0x8ea2('0x7a')]}});}})[_0x8ea2('0x25')](function(_0x3a43d5){if(_0x3a43d5){_0x1a0966=_0x3a43d5;if(_0x196b89){var _0x535b01=null;for(var _0x22e4cd=0x1;_0x22e4cd<_0x487bab['Messages'][_0x8ea2('0x54')];++_0x22e4cd){_0x535b01=_0x487bab['Messages'][_0x22e4cd];var _0x230a70=_0x535b01['UserId']?util['format'](_0x8ea2('0xfa'),_0x50087b[_0x8ea2('0xfb')],_0x535b01[_0x8ea2('0x82')]):_0x8ea2('0xfc');var _0x332670=_0x48a2e2[_0x8ea2('0xc7')][_0x8ea2('0xfd')]||util[_0x8ea2('0xfe')]('%s%d',_0x8ea2('0xff'),_0x535b01[_0x8ea2('0x7a')]);switch(_0x50087b[_0x8ea2('0x100')]){case _0x8ea2('0x101'):_0x230a70=_0x535b01[_0x8ea2('0x82')]?util['format'](_0x8ea2('0xfa'),_0x50087b['agentAlias'],_0x535b01[_0x8ea2('0x82')]):'System';break;case _0x8ea2('0x102'):_0x230a70=_0x535b01[_0x8ea2('0x82')]?_0x535b01[_0x8ea2('0x7f')][_0x8ea2('0x103')]||_0x535b01['User']['fullname']:'System';break;case _0x8ea2('0x104'):_0x230a70=_0x535b01[_0x8ea2('0x82')]?_0x535b01['User'][_0x8ea2('0x105')]:_0x8ea2('0xfc');break;default:_0x230a70=_0x535b01[_0x8ea2('0x82')]?util[_0x8ea2('0xfe')](_0x8ea2('0xfa'),_0x50087b[_0x8ea2('0xfb')],_0x535b01[_0x8ea2('0x82')]):_0x8ea2('0xfc');}var _0x422280=util[_0x8ea2('0xfe')](_0x8ea2('0x106'),moment(_0x535b01[_0x8ea2('0x87')])[_0x8ea2('0xfe')]('MM/DD/YYYY\x20HH:mm:ss'),_0x535b01[_0x8ea2('0x107')]==='in'?_0x332670:_0x230a70,_0x535b01['body']);if(!_0x535b01['secret']){fs[_0x8ea2('0x108')](_0x196b89,_0x422280);}}return db['MailAccount'][_0x8ea2('0xca')]({'where':{'service':!![]},'include':[{'model':db[_0x8ea2('0x109')],'as':_0x8ea2('0x10a'),'raw':!![]}]});}}})[_0x8ea2('0x25')](function(_0xff0fae){if(_0xff0fae&&_0xff0fae['Smtp']&&_0x48a2e2[_0x8ea2('0xc7')]){var _0x3f5688={'tls':{'rejectUnauthorized':![]}};if(_0xff0fae[_0x8ea2('0x10a')]['service']){_0x3f5688['service']=_0xff0fae[_0x8ea2('0x10a')][_0x8ea2('0x10b')];}else{_0x3f5688['host']=_0xff0fae[_0x8ea2('0x10a')]['host'];_0x3f5688[_0x8ea2('0x10c')]=_0xff0fae[_0x8ea2('0x10a')][_0x8ea2('0x10c')];_0x3f5688[_0x8ea2('0x10d')]=_0xff0fae[_0x8ea2('0x10a')][_0x8ea2('0x10d')];}if(_0xff0fae[_0x8ea2('0x10a')][_0x8ea2('0x10e')]){_0x3f5688[_0x8ea2('0x10f')]={'user':_0xff0fae['Smtp']['user'],'pass':_0xff0fae[_0x8ea2('0x10a')]['pass']};}return respondWithRpcPromise(_0x8ea2('0x110'),_0x8ea2('0x111'),{'account':_0x3f5688,'message':{'from':util[_0x8ea2('0xfe')](_0x8ea2('0x112'),_0xff0fae['name'],_0xff0fae[_0x8ea2('0xd3')]||_0xff0fae[_0x8ea2('0x10a')]['user']),'to':_0x48a2e2[_0x8ea2('0xc7')][_0x8ea2('0xf6')],'subject':_0x8ea2('0x113'),'text':util['format']('Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a',_0x48a2e2['body'][_0x8ea2('0xf6')]),'attachments':[{'path':_0x196b89}]}})['then'](function(){return _0x487bab;})[_0x8ea2('0x2e')](function(_0x488acb){console[_0x8ea2('0x2b')](_0x488acb);});}else{return _0x487bab;}})[_0x8ea2('0x25')](respondWithStatusCode(_0x4e804c,0xc8))[_0x8ea2('0x2e')](handleError(_0x4e804c,null));};exports[_0x8ea2('0x114')]=function(_0x54925a,_0x295339,_0x55c23c){return db['ChatMessage']['find']({'where':{'id':_0x54925a[_0x8ea2('0xc3')]['id']}})[_0x8ea2('0x25')](handleEntityNotFound(_0x295339,null))[_0x8ea2('0x25')](function(_0x48b51d){if(_0x48b51d){return _0x48b51d[_0x8ea2('0x114')](_0x54925a[_0x8ea2('0xc7')][_0x8ea2('0x115')],_[_0x8ea2('0x116')](_0x54925a[_0x8ea2('0xc7')],[_0x8ea2('0x115'),'id'])||{});}})[_0x8ea2('0x25')](respondWithResult(_0x295339,null))[_0x8ea2('0x2e')](handleError(_0x295339,null));};exports[_0x8ea2('0x117')]=function(_0x102d70,_0x2b014d,_0xc35654){var _0x355b91={'raw':![],'where':{}};var _0x1cf414={};var _0x48e543={'count':0x0,'rows':[]};return db['ChatInteraction'][_0x8ea2('0xca')]({'where':{'id':_0x102d70['params']['id']}})[_0x8ea2('0x25')](handleEntityNotFound(_0x2b014d,null))[_0x8ea2('0x25')](function(_0x3ebbc8){if(_0x3ebbc8){_0x1cf414['model']=_[_0x8ea2('0x4f')](db['ChatMessage']['rawAttributes']);_0x1cf414[_0x8ea2('0x4e')]=_[_0x8ea2('0x4f')](_0x102d70[_0x8ea2('0x4e')]);_0x1cf414[_0x8ea2('0x50')]=_[_0x8ea2('0x51')](_0x1cf414[_0x8ea2('0x4d')],_0x1cf414[_0x8ea2('0x4e')]);_0x355b91['attributes']=_[_0x8ea2('0x51')](_0x1cf414[_0x8ea2('0x4d')],qs[_0x8ea2('0x53')](_0x102d70['query'][_0x8ea2('0x53')]));_0x355b91[_0x8ea2('0x52')]=_0x355b91[_0x8ea2('0x52')]['length']?_0x355b91[_0x8ea2('0x52')]:_0x1cf414[_0x8ea2('0x4d')];if(!_0x102d70[_0x8ea2('0x4e')]['hasOwnProperty']('nolimit')){_0x355b91[_0x8ea2('0x34')]=qs['limit'](_0x102d70[_0x8ea2('0x4e')]['limit']);_0x355b91[_0x8ea2('0x32')]=qs[_0x8ea2('0x32')](_0x102d70[_0x8ea2('0x4e')][_0x8ea2('0x32')]);}_0x355b91[_0x8ea2('0x57')]=qs['sort'](_0x102d70[_0x8ea2('0x4e')][_0x8ea2('0x58')]);_0x355b91[_0x8ea2('0x59')]=qs[_0x8ea2('0x50')](_[_0x8ea2('0x5a')](_0x102d70[_0x8ea2('0x4e')],_0x1cf414['filters']));_0x355b91['where'][_0x8ea2('0xc0')]=_0x3ebbc8['id'];if(_0x102d70[_0x8ea2('0x4e')]['filter']){_0x355b91[_0x8ea2('0x59')]=_[_0x8ea2('0x3d')](_0x355b91[_0x8ea2('0x59')],{'$or':_[_0x8ea2('0x43')](_0x355b91['attributes'],function(_0x19ea2b){var _0x4450e8={};_0x4450e8[_0x19ea2b]={'$like':'%'+_0x102d70['query'][_0x8ea2('0x94')]+'%'};return _0x4450e8;})});}if(_0x102d70['query'][_0x8ea2('0x89')]){var _0x479b40=_0x102d70['query'][_0x8ea2('0x89')][_0x8ea2('0x46')](',');var _0xbb5964={};_0xbb5964[_0x479b40[0x0]]={'$gte':moment(_0x479b40[0x1])[_0x8ea2('0xfe')]('YYYY-MM-DD\x20HH:mm:ss')};_0x355b91[_0x8ea2('0x59')]=_[_0x8ea2('0x3d')](_0x355b91[_0x8ea2('0x59')],_0xbb5964);}_0x355b91=_['merge']({},_0x355b91,_0x102d70[_0x8ea2('0xc5')]);return db[_0x8ea2('0xda')][_0x8ea2('0x35')]({'where':_0x355b91[_0x8ea2('0x59')]})[_0x8ea2('0x25')](function(_0x46d38e){_0x48e543[_0x8ea2('0x35')]=_0x46d38e;if(_0x102d70['query'][_0x8ea2('0xc4')]){_0x355b91[_0x8ea2('0x118')]=[{'all':!![]}];}return db[_0x8ea2('0xda')][_0x8ea2('0x119')](_0x355b91);})[_0x8ea2('0x25')](function(_0x23f247){_0x48e543[_0x8ea2('0x11a')]=_0x23f247;return _0x48e543;});}})[_0x8ea2('0x25')](respondWithFilteredResult(_0x2b014d,_0x355b91))[_0x8ea2('0x2e')](handleError(_0x2b014d,null));};exports[_0x8ea2('0x11b')]=function(_0x3a37fb,_0x455009,_0x556919){var _0x58a0e5={'where':{}},_0x3be2ce={},_0x56a973={'count':0x0,'rows':[]};return db[_0x8ea2('0x49')][_0x8ea2('0xca')]({'where':{'id':_0x3a37fb[_0x8ea2('0xc3')]['id']}})[_0x8ea2('0x25')](handleEntityNotFound(_0x455009,null))[_0x8ea2('0x25')](function(_0x515381){if(_0x515381){_0x3be2ce[_0x8ea2('0x4d')]=_[_0x8ea2('0x4f')](db['ChatMessage'][_0x8ea2('0x4a')]);_0x3be2ce[_0x8ea2('0x4e')]=_[_0x8ea2('0x4f')](_0x3a37fb[_0x8ea2('0x4e')]);_0x3be2ce['filters']=_[_0x8ea2('0x51')](_0x3be2ce[_0x8ea2('0x4d')],_0x3be2ce[_0x8ea2('0x4e')]);_0x58a0e5[_0x8ea2('0x52')]=_['intersection'](_0x3be2ce[_0x8ea2('0x4d')],qs[_0x8ea2('0x53')](_0x3a37fb[_0x8ea2('0x4e')]['fields']));_0x58a0e5[_0x8ea2('0x52')]=_0x58a0e5[_0x8ea2('0x52')][_0x8ea2('0x54')]?_0x58a0e5['attributes']:_0x3be2ce['model'];if(!_0x3a37fb[_0x8ea2('0x4e')]['hasOwnProperty'](_0x8ea2('0x56'))){_0x58a0e5[_0x8ea2('0x34')]=qs[_0x8ea2('0x34')](_0x3a37fb[_0x8ea2('0x4e')]['limit']);_0x58a0e5[_0x8ea2('0x32')]=qs['offset'](_0x3a37fb['query']['offset']);}_0x58a0e5['order']=qs[_0x8ea2('0x58')](_0x3a37fb[_0x8ea2('0x4e')][_0x8ea2('0x58')]);_0x58a0e5[_0x8ea2('0x59')]=qs[_0x8ea2('0x50')](_['pick'](_0x3a37fb['query'],_0x3be2ce[_0x8ea2('0x50')]));_0x58a0e5['where']['ChatInteractionId']=_0x515381['id'];if(_0x3a37fb[_0x8ea2('0x4e')][_0x8ea2('0x94')]){_0x58a0e5[_0x8ea2('0x59')]=_['merge'](_0x58a0e5[_0x8ea2('0x59')],{'$or':_['map'](_0x58a0e5[_0x8ea2('0x52')],function(_0x4041ec){var _0x56178b={};_0x56178b[_0x4041ec]={'$like':'%'+_0x3a37fb[_0x8ea2('0x4e')][_0x8ea2('0x94')]+'%'};return _0x56178b;})});}_0x58a0e5['where'][_0x8ea2('0x11c')]=![];if(_0x3a37fb[_0x8ea2('0x4e')]['id']){_0x58a0e5[_0x8ea2('0x59')]['id']={'$gt':_0x3a37fb[_0x8ea2('0x4e')]['id']};}_0x58a0e5=_[_0x8ea2('0x3d')]({},_0x58a0e5,_0x3a37fb[_0x8ea2('0xc5')]);return db[_0x8ea2('0xda')][_0x8ea2('0x35')]({'where':_0x58a0e5[_0x8ea2('0x59')]})['then'](function(_0xcedece){_0x56a973['count']=_0xcedece;_0x58a0e5[_0x8ea2('0x118')]=[];if(_0x3a37fb[_0x8ea2('0x4e')][_0x8ea2('0x11d')]){_0x58a0e5[_0x8ea2('0x118')][_0x8ea2('0xc1')]({'model':db[_0x8ea2('0x7f')],'as':_0x8ea2('0x7f'),'attributes':['id',_0x8ea2('0x105'),'alias']});}if(_0x3a37fb['query'][_0x8ea2('0xc4')]){_0x58a0e5[_0x8ea2('0x118')]=[{'all':!![]}];}return db[_0x8ea2('0xda')][_0x8ea2('0x119')](_0x58a0e5);})[_0x8ea2('0x25')](function(_0x52bf7c){_0x56a973[_0x8ea2('0x11a')]=_0x52bf7c;return _0x56a973;});}})[_0x8ea2('0x25')](respondWithFilteredResult(_0x455009,_0x58a0e5))['catch'](handleError(_0x455009,null));};exports[_0x8ea2('0x11e')]=function(_0x3be5d0,_0x3ac848,_0x52ce76){return db['ChatInteraction'][_0x8ea2('0x71')]({'where':{'id':_0x3be5d0['params']['id']}})[_0x8ea2('0x25')](handleEntityNotFound(_0x3ac848,null))[_0x8ea2('0x25')](function(_0x1030c9){if(_0x1030c9){return _0x1030c9[_0x8ea2('0x11f')](_0x3be5d0[_0x8ea2('0xc7')][_0x8ea2('0x115')],_[_0x8ea2('0x116')](_0x3be5d0[_0x8ea2('0xc7')],[_0x8ea2('0x115'),'id'])||{})[_0x8ea2('0x120')](function(){return db[_0x8ea2('0x7d')][_0x8ea2('0x119')]({'attributes':['id',_0x8ea2('0x3c'),_0x8ea2('0x5d')],'where':{'id':_0x3be5d0[_0x8ea2('0xc7')][_0x8ea2('0x115')]}});})[_0x8ea2('0x25')](function(_0x452b94){socket[_0x8ea2('0x121')]('chatInteractionTags:save',{'id':Number(_0x3be5d0['params']['id']),'tags':_0x452b94||[]});return{'id':Number(_0x3be5d0['params']['id']),'tags':_0x452b94||[]};});}})[_0x8ea2('0x25')](respondWithResult(_0x3ac848,null))[_0x8ea2('0x2e')](handleError(_0x3ac848,null));};exports[_0x8ea2('0x122')]=function(_0x9410dd,_0x497671,_0x5e3e8d){return db[_0x8ea2('0x49')]['find']({'where':{'id':_0x9410dd[_0x8ea2('0xc3')]['id']}})[_0x8ea2('0x25')](handleEntityNotFound(_0x497671,null))[_0x8ea2('0x25')](function(_0x19b042){if(_0x19b042){return _0x19b042[_0x8ea2('0x122')](_0x9410dd[_0x8ea2('0x4e')][_0x8ea2('0x115')]);}})['then'](respondWithStatusCode(_0x497671,null))[_0x8ea2('0x2e')](handleError(_0x497671,null));};exports[_0x8ea2('0xf4')]=function(_0x2dc450,_0x34e1c5){var _0x5b929c=moment()['unix']()[_0x8ea2('0xaa')]();var _0x263123=path[_0x8ea2('0xf0')](config['root'],'server',_0x8ea2('0x123'),'tmp');var _0x40e8e6=path[_0x8ea2('0xf0')](config[_0x8ea2('0xf1')],'server',_0x8ea2('0x123'),_0x8ea2('0x124'));var _0x2dfabc=path[_0x8ea2('0xf0')](_0x263123,_0x5b929c);var _0x515049=util['format'](_0x8ea2('0x125'),_0x2dc450[_0x8ea2('0xc3')]['id'],_0x5b929c);var _0x39000d=path['join'](_0x263123,_0x515049);var _0x3a1752=[];_0x3a1752['push']({'model':db[_0x8ea2('0x7f')],'as':'User','attributes':['id',_0x8ea2('0x105')],'raw':!![]});_0x3a1752['push']({'model':db[_0x8ea2('0xde')],'as':_0x8ea2('0x75'),'attributes':['id',_0x8ea2('0x126'),_0x8ea2('0x127')],'raw':!![]});if(_0x2dc450['query'][_0x8ea2('0x124')]){_0x3a1752[_0x8ea2('0xc1')]({'model':db[_0x8ea2('0xed')],'as':_0x8ea2('0xed'),'raw':!![]});}var _0x5ba508=[{'model':db[_0x8ea2('0xda')],'as':_0x8ea2('0x128'),'attributes':['id',_0x8ea2('0xc7'),_0x8ea2('0x87'),_0x8ea2('0x107'),'secret',_0x8ea2('0x129')],'include':_0x3a1752}];_0x5ba508[_0x8ea2('0xc1')]({'model':db[_0x8ea2('0xcb')],'as':_0x8ea2('0x12a'),'attributes':['id','name']});_0x5ba508[_0x8ea2('0xc1')]({'model':db[_0x8ea2('0x7f')],'as':'Owner','attributes':['id','fullname']});return db['ChatInteraction'][_0x8ea2('0x71')]({'where':{'id':_0x2dc450[_0x8ea2('0xc3')]['id']},'include':_0x5ba508})[_0x8ea2('0x25')](handleEntityNotFound(_0x34e1c5,null))[_0x8ea2('0x25')](function(_0x3c9013){if(_0x3c9013){var _0x103c43=_0x3c9013['get']({'plain':!![]});fs['mkdirSync'](_0x2dfabc);var _0xc099b6={'channel':_0x8ea2('0x12b'),'account':_0x103c43[_0x8ea2('0x12a')]['name'],'agent':_0x103c43['Owner']?_0x103c43[_0x8ea2('0x12c')][_0x8ea2('0x105')]:'N.A.','createdAt':moment(_0x103c43[_0x8ea2('0x87')])['format'](_0x8ea2('0x12d'))[_0x8ea2('0xaa')](),'closedAt':_0x103c43[_0x8ea2('0xeb')]?moment(_0x103c43['closedAt'])[_0x8ea2('0xfe')](_0x8ea2('0x12d'))['toString']():'','disposition':_0x103c43[_0x8ea2('0xe2')],'chatInfo':{'browser':_0x103c43[_0x8ea2('0x12e')],'os':_0x103c43['osName'],'referer':_0x103c43['referer'],'customerIp':_0x103c43[_0x8ea2('0x12f')],'customerPort':_0x103c43[_0x8ea2('0x130')]?_0x103c43[_0x8ea2('0x130')]:'N.A.'},'messages':_(_0x103c43[_0x8ea2('0x128')])[_0x8ea2('0x131')]()[_0x8ea2('0x94')]({'secret':![]})[_0x8ea2('0x43')](function(_0x36799a){if(_0x36799a['Attachment']){var _0x1cc1d9=path['join'](_0x40e8e6,_0x36799a[_0x8ea2('0xed')]['basename']);if(fs[_0x8ea2('0x132')](_0x1cc1d9)){fs[_0x8ea2('0x133')](_0x1cc1d9)[_0x8ea2('0x134')](fs[_0x8ea2('0x135')](path['join'](_0x2dfabc,_0x36799a[_0x8ea2('0xed')][_0x8ea2('0xe7')])));}}return{'date':moment(_0x36799a[_0x8ea2('0x87')])[_0x8ea2('0xfe')](_0x8ea2('0x12d'))[_0x8ea2('0xaa')](),'sender':_0x36799a[_0x8ea2('0x107')]===_0x8ea2('0x136')?_0x36799a[_0x8ea2('0x7f')]?_0x36799a[_0x8ea2('0x7f')][_0x8ea2('0x105')]:'System':_0x36799a[_0x8ea2('0x75')][_0x8ea2('0x126')]+(_0x36799a[_0x8ea2('0x75')]['lastName']?'\x20'+_0x36799a[_0x8ea2('0x75')][_0x8ea2('0x127')]:''),'body':_0x36799a[_0x8ea2('0xed')]?_0x36799a[_0x8ea2('0xed')][_0x8ea2('0xe7')]:_0x36799a[_0x8ea2('0xc7')],'direction':_0x36799a[_0x8ea2('0x107')]===_0x8ea2('0x136')?'A':'C','secret':_0x36799a[_0x8ea2('0x11c')],'read':_0x36799a[_0x8ea2('0x129')],'attachment':_0x36799a['Attachment']};})[_0x8ea2('0x77')]()};return ejs[_0x8ea2('0x137')](path[_0x8ea2('0xf0')](config[_0x8ea2('0xf1')],'server',_0x8ea2('0x138'),_0x8ea2('0x139')),{'interaction':_0xc099b6})[_0x8ea2('0x25')](function(_0x10d2b3){var _0x12a217=path[_0x8ea2('0xf0')](_0x2dfabc,_0x8ea2('0x13a')+_0x103c43['id']+'-'+_0x5b929c+'.pdf');var _0x44b0dc={'path':_0x12a217,'channel':_0x8ea2('0x12b'),'interactionId':_0x103c43['id']};return pdf['createPdfFromHTML'](_0x10d2b3,_0x44b0dc);})[_0x8ea2('0x25')](function(){return new BPromise(function(_0x27f5e9,_0x19b678){zipdir(_0x2dfabc,{'saveTo':_0x39000d},function(_0x50ebcd,_0x5d6c63){if(_0x50ebcd)return _0x19b678(_0x50ebcd);return _0x27f5e9(_0x5d6c63);});})[_0x8ea2('0x25')](function(){return new BPromise(function(_0x55b3a1,_0x57e228){rimraf(_0x2dfabc,function(_0x3c669b){if(_0x3c669b)_0x57e228(_0x3c669b);return _0x55b3a1();});});})[_0x8ea2('0x25')](function(){return _0x34e1c5['download'](_0x39000d,_0x515049,function(_0x688d21){if(_0x688d21){console[_0x8ea2('0x13b')]('err',_0x688d21);}else{fs[_0x8ea2('0x13c')](_0x39000d);}});});});}else{return _0x34e1c5['sendStatus'](0xc8);}})[_0x8ea2('0x2e')](handleError(_0x34e1c5,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index 28d6f88..051b8cb 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 _0x4ecc=['map','unreadMessages','emit','catch','hasOwnProperty','hook','exports','../../mysqldb','ChatMessage','setMaxListeners','save','update','remove','getUsers','then','Users'];(function(_0x408753,_0x5176e1){var _0x1ba6f1=function(_0x2ed00d){while(--_0x2ed00d){_0x408753['push'](_0x408753['shift']());}};_0x1ba6f1(++_0x5176e1);}(_0x4ecc,0x177));var _0xc4ec=function(_0xca1f0e,_0x2713d5){_0xca1f0e=_0xca1f0e-0x0;var _0x35e4ef=_0x4ecc[_0xca1f0e];return _0x35e4ef;};'use strict';var EventEmitter=require('events');var ChatInteraction=require(_0xc4ec('0x0'))['db']['ChatInteraction'];var ChatMessage=require(_0xc4ec('0x0'))['db'][_0xc4ec('0x1')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0xc4ec('0x2')](0x0);var events={'afterCreate':_0xc4ec('0x3'),'afterUpdate':_0xc4ec('0x4'),'afterDestroy':_0xc4ec('0x5')};function emitEvent(_0x448c21){return function(_0x4624a4,_0x86ef0d,_0x147f2c){_0x4624a4[_0xc4ec('0x6')]({'attributes':['id'],'raw':!![]})[_0xc4ec('0x7')](function(_0x29e24f){_0x4624a4['setDataValue'](_0xc4ec('0x8'),_0x29e24f[_0xc4ec('0x9')](function(_0x129175){return{'id':_0x129175['id']};}));return ChatMessage['findAll']({'where':{'ChatInteractionId':_0x4624a4['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x3fc874){_0x4624a4['setDataValue'](_0xc4ec('0xa'),_0x3fc874['length']);ChatInteractionEvents[_0xc4ec('0xb')](_0x448c21+':'+_0x4624a4['id'],_0x4624a4);ChatInteractionEvents['emit'](_0x448c21,_0x4624a4);_0x147f2c(null);})[_0xc4ec('0xc')](_0x147f2c(null));};}for(var e in events){if(events[_0xc4ec('0xd')](e)){var event=events[e];ChatInteraction[_0xc4ec('0xe')](e,emitEvent(event));}}module[_0xc4ec('0xf')]=ChatInteractionEvents; \ No newline at end of file +var _0x3a90=['Users','map','findAll','then','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','ChatInteraction','ChatMessage','save','update','getUsers','setDataValue'];(function(_0x544a7b,_0x388672){var _0x1c8701=function(_0x448d61){while(--_0x448d61){_0x544a7b['push'](_0x544a7b['shift']());}};_0x1c8701(++_0x388672);}(_0x3a90,0x1ad));var _0x03a9=function(_0x5236e2,_0x18e12){_0x5236e2=_0x5236e2-0x0;var _0x22f044=_0x3a90[_0x5236e2];return _0x22f044;};'use strict';var EventEmitter=require(_0x03a9('0x0'));var ChatInteraction=require(_0x03a9('0x1'))['db'][_0x03a9('0x2')];var ChatMessage=require('../../mysqldb')['db'][_0x03a9('0x3')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x03a9('0x4'),'afterUpdate':_0x03a9('0x5'),'afterDestroy':'remove'};function emitEvent(_0x9646ca){return function(_0x31629f,_0xc70f63,_0x1837bc){_0x31629f[_0x03a9('0x6')]({'attributes':['id'],'raw':!![]})['then'](function(_0x12dfb0){_0x31629f[_0x03a9('0x7')](_0x03a9('0x8'),_0x12dfb0[_0x03a9('0x9')](function(_0x40994b){return{'id':_0x40994b['id']};}));return ChatMessage[_0x03a9('0xa')]({'where':{'ChatInteractionId':_0x31629f['id'],'direction':'in','read':![]},'raw':!![]});})[_0x03a9('0xb')](function(_0x830798){_0x31629f[_0x03a9('0x7')](_0x03a9('0xc'),_0x830798[_0x03a9('0xd')]);ChatInteractionEvents[_0x03a9('0xe')](_0x9646ca+':'+_0x31629f['id'],_0x31629f);ChatInteractionEvents['emit'](_0x9646ca,_0x31629f);_0x1837bc(null);})[_0x03a9('0xf')](_0x1837bc(null));};}for(var e in events){if(events[_0x03a9('0x10')](e)){var event=events[e];ChatInteraction[_0x03a9('0x11')](e,emitEvent(event));}}module[_0x03a9('0x12')]=ChatInteractionEvents; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.model.js b/server/api/chatInteraction/chatInteraction.model.js index 601220b..18f3767 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 _0xc23c=['request-promise','path','../../config/environment','./chatInteraction.attributes','exports','define','chat_interactions','changed','closed','closedAt','format','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird'];(function(_0x28f1de,_0x355054){var _0x5b5dad=function(_0x399b72){while(--_0x399b72){_0x28f1de['push'](_0x28f1de['shift']());}};_0x5b5dad(++_0x355054);}(_0xc23c,0x187));var _0xcc23=function(_0x2a9f4,_0x25c14a){_0x2a9f4=_0x2a9f4-0x0;var _0x3c39e0=_0xc23c[_0x2a9f4];return _0x3c39e0;};'use strict';var _=require(_0xcc23('0x0'));var util=require(_0xcc23('0x1'));var logger=require('../../config/logger')(_0xcc23('0x2'));var moment=require(_0xcc23('0x3'));var BPromise=require(_0xcc23('0x4'));var rp=require(_0xcc23('0x5'));var fs=require('fs');var path=require(_0xcc23('0x6'));var rimraf=require('rimraf');var config=require(_0xcc23('0x7'));var attributes=require(_0xcc23('0x8'));module[_0xcc23('0x9')]=function(_0x5a6a89,_0x2a3791){return _0x5a6a89[_0xcc23('0xa')]('ChatInteraction',attributes,{'tableName':_0xcc23('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x298aed,_0x115710,_0x54d54e){if(_0x298aed[_0xcc23('0xc')](_0xcc23('0xd'))){_0x298aed[_0xcc23('0xe')]=moment()[_0xcc23('0xf')]('YYYY-MM-DD\x20HH:mm:ss');}_0x54d54e(null,_0x298aed);}},'charset':_0xcc23('0x10'),'collate':_0xcc23('0x11')});}; \ No newline at end of file +var _0x8313=['rimraf','../../config/environment','./chatInteraction.attributes','exports','define','ChatInteraction','chat_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','utf8mb4','../../config/logger','moment','path'];(function(_0x1d8ef2,_0x1b22f7){var _0x4a1c25=function(_0x49405f){while(--_0x49405f){_0x1d8ef2['push'](_0x1d8ef2['shift']());}};_0x4a1c25(++_0x1b22f7);}(_0x8313,0x14d));var _0x3831=function(_0x357a74,_0xe8550f){_0x357a74=_0x357a74-0x0;var _0x17dfe5=_0x8313[_0x357a74];return _0x17dfe5;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3831('0x0'))('api');var moment=require(_0x3831('0x1'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x3831('0x2'));var rimraf=require(_0x3831('0x3'));var config=require(_0x3831('0x4'));var attributes=require(_0x3831('0x5'));module[_0x3831('0x6')]=function(_0x57e186,_0x4d26cf){return _0x57e186[_0x3831('0x7')](_0x3831('0x8'),attributes,{'tableName':_0x3831('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x60479e,_0x1b12ae,_0x160376){if(_0x60479e[_0x3831('0xa')](_0x3831('0xb'))){_0x60479e[_0x3831('0xc')]=moment()[_0x3831('0xd')](_0x3831('0xe'));}_0x160376(null,_0x60479e);}},'charset':_0x3831('0xf'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.rpc.js b/server/api/chatInteraction/chatInteraction.rpc.js index 0be062f..60e7e65 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 _0x620f=['spread','AddTags','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./chatInteraction.socket','then','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','ChatInteraction','update','body','options','raw','attributes','limit','UpdateChatInteraction','catch','AddTagsToChatInteraction','omit'];(function(_0xf13d0d,_0x3df04c){var _0x4e55f2=function(_0xe546eb){while(--_0xe546eb){_0xf13d0d['push'](_0xf13d0d['shift']());}};_0x4e55f2(++_0x3df04c);}(_0x620f,0x1af));var _0xf620=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x620f[_0x397e5f];return _0x5302b8;};'use strict';var _=require('lodash');var util=require(_0xf620('0x0'));var moment=require(_0xf620('0x1'));var BPromise=require(_0xf620('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf620('0x3'));var db=require(_0xf620('0x4'))['db'];var utils=require(_0xf620('0x5'));var logger=require(_0xf620('0x6'))(_0xf620('0x7'));var config=require(_0xf620('0x8'));var jayson=require(_0xf620('0x9'));var client=jayson['client'][_0xf620('0xa')]({'port':0x232a});config[_0xf620('0xb')]=_[_0xf620('0xc')](config[_0xf620('0xb')],{'host':_0xf620('0xd'),'port':0x18eb});var socket=require(_0xf620('0xe'))(new Redis(config[_0xf620('0xb')]));require(_0xf620('0xf'))['register'](socket);function respondWithRpcPromise(_0x5ed84c,_0x1e7b1e,_0x2d059d){return new BPromise(function(_0x8bd8f3,_0x1d627f){return client['request'](_0x5ed84c,_0x2d059d)[_0xf620('0x10')](function(_0x4a462d){logger['info'](_0xf620('0x11'),_0x1e7b1e,_0xf620('0x12'));logger[_0xf620('0x13')](_0xf620('0x14'),_0x1e7b1e,'request\x20sent',JSON[_0xf620('0x15')](_0x4a462d));if(_0x4a462d[_0xf620('0x16')]){if(_0x4a462d[_0xf620('0x16')]['code']===0x1f4){logger[_0xf620('0x16')](_0xf620('0x11'),_0x1e7b1e,_0x4a462d['error'][_0xf620('0x17')]);return _0x1d627f(_0x4a462d[_0xf620('0x16')]['message']);}logger[_0xf620('0x16')](_0xf620('0x11'),_0x1e7b1e,_0x4a462d[_0xf620('0x16')][_0xf620('0x17')]);return _0x8bd8f3(_0x4a462d['error'][_0xf620('0x17')]);}else{logger[_0xf620('0x18')](_0xf620('0x11'),_0x1e7b1e,_0xf620('0x12'));_0x8bd8f3(_0x4a462d[_0xf620('0x19')][_0xf620('0x17')]);}})['catch'](function(_0x1e63b8){logger[_0xf620('0x16')](_0xf620('0x11'),_0x1e7b1e,_0x1e63b8);_0x1d627f(_0x1e63b8);});});}exports['UpdateChatInteraction']=function(_0x1d9be0){var _0x15d6d2=this;return new Promise(function(_0xd20a4c,_0x14a1ed){return db[_0xf620('0x1a')][_0xf620('0x1b')](_0x1d9be0[_0xf620('0x1c')],{'raw':_0x1d9be0['options']?_0x1d9be0[_0xf620('0x1d')][_0xf620('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1d9be0[_0xf620('0x1d')]?_0x1d9be0[_0xf620('0x1d')]['where']||null:null,'attributes':_0x1d9be0[_0xf620('0x1d')]?_0x1d9be0['options'][_0xf620('0x1f')]||null:null,'limit':_0x1d9be0['options']?_0x1d9be0['options'][_0xf620('0x20')]||null:null})[_0xf620('0x10')](function(_0x539650){logger[_0xf620('0x18')]('UpdateChatInteraction',_0x1d9be0);logger[_0xf620('0x13')](_0xf620('0x21'),_0x1d9be0,JSON['stringify'](_0x539650));_0xd20a4c(_0x539650);})[_0xf620('0x22')](function(_0x154b82){logger[_0xf620('0x16')]('UpdateChatInteraction',_0x154b82[_0xf620('0x17')],_0x1d9be0);_0x14a1ed(_0x15d6d2[_0xf620('0x16')](0x1f4,_0x154b82['message']));});});};exports[_0xf620('0x23')]=function(_0x11b6bf){return new Promise(function(_0x12ffe4,_0x594806){return db[_0xf620('0x1a')]['find']({'where':_0x11b6bf[_0xf620('0x1d')]?_0x11b6bf['options']['where']||null:null})[_0xf620('0x10')](function(_0xc7bb29){if(_0xc7bb29){return _0xc7bb29['addTags'](_0x11b6bf[_0xf620('0x1c')]['ids'],_[_0xf620('0x24')](_0x11b6bf[_0xf620('0x1c')],['ids','id'])||{});}})[_0xf620('0x25')](function(_0x4e5def){logger[_0xf620('0x18')](_0xf620('0x26'),_0x11b6bf);logger[_0xf620('0x13')](_0xf620('0x26'),_0x11b6bf,JSON[_0xf620('0x15')](_0x4e5def));_0x12ffe4(_0x4e5def);})[_0xf620('0x22')](function(_0x589793){logger[_0xf620('0x16')]('AddTags',_0x589793[_0xf620('0x17')],_0x11b6bf);_0x594806(_this[_0xf620('0x16')](0x1f4,_0x589793['message']));});});}; \ No newline at end of file +var _0x6026=['rpc','jayson/promise','client','redis','defaults','localhost','./chatInteraction.socket','register','request','then','info','ChatInteraction,\x20%s,\x20%s','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','catch','UpdateChatInteraction','ChatInteraction','update','body','options','limit','AddTagsToChatInteraction','find','where','addTags','ids','omit','spread','AddTags','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x2958bf,_0x1d242c){var _0x454512=function(_0x4be22a){while(--_0x4be22a){_0x2958bf['push'](_0x2958bf['shift']());}};_0x454512(++_0x1d242c);}(_0x6026,0x76));var _0x6602=function(_0x2f2f8c,_0x12e3a5){_0x2f2f8c=_0x2f2f8c-0x0;var _0x26da09=_0x6026[_0x2f2f8c];return _0x26da09;};'use strict';var _=require(_0x6602('0x0'));var util=require(_0x6602('0x1'));var moment=require(_0x6602('0x2'));var BPromise=require(_0x6602('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6602('0x4'));var db=require(_0x6602('0x5'))['db'];var utils=require(_0x6602('0x6'));var logger=require(_0x6602('0x7'))(_0x6602('0x8'));var config=require('../../config/environment');var jayson=require(_0x6602('0x9'));var client=jayson[_0x6602('0xa')]['http']({'port':0x232a});config[_0x6602('0xb')]=_[_0x6602('0xc')](config['redis'],{'host':_0x6602('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x6602('0xe'))[_0x6602('0xf')](socket);function respondWithRpcPromise(_0x5d3d6b,_0x4c6b42,_0x4d9b20){return new BPromise(function(_0x82c1fa,_0x563149){return client[_0x6602('0x10')](_0x5d3d6b,_0x4d9b20)[_0x6602('0x11')](function(_0x280316){logger[_0x6602('0x12')](_0x6602('0x13'),_0x4c6b42,'request\x20sent');logger[_0x6602('0x14')](_0x6602('0x15'),_0x4c6b42,'request\x20sent',JSON[_0x6602('0x16')](_0x280316));if(_0x280316[_0x6602('0x17')]){if(_0x280316[_0x6602('0x17')]['code']===0x1f4){logger[_0x6602('0x17')](_0x6602('0x13'),_0x4c6b42,_0x280316[_0x6602('0x17')][_0x6602('0x18')]);return _0x563149(_0x280316[_0x6602('0x17')][_0x6602('0x18')]);}logger[_0x6602('0x17')](_0x6602('0x13'),_0x4c6b42,_0x280316[_0x6602('0x17')][_0x6602('0x18')]);return _0x82c1fa(_0x280316['error']['message']);}else{logger[_0x6602('0x12')]('ChatInteraction,\x20%s,\x20%s',_0x4c6b42,_0x6602('0x19'));_0x82c1fa(_0x280316[_0x6602('0x1a')][_0x6602('0x18')]);}})[_0x6602('0x1b')](function(_0x5967a5){logger[_0x6602('0x17')](_0x6602('0x13'),_0x4c6b42,_0x5967a5);_0x563149(_0x5967a5);});});}exports[_0x6602('0x1c')]=function(_0x355df3){var _0x29c5dc=this;return new Promise(function(_0x55ec0c,_0x381ed8){return db[_0x6602('0x1d')][_0x6602('0x1e')](_0x355df3[_0x6602('0x1f')],{'raw':_0x355df3['options']?_0x355df3['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x355df3[_0x6602('0x20')]?_0x355df3[_0x6602('0x20')]['where']||null:null,'attributes':_0x355df3[_0x6602('0x20')]?_0x355df3[_0x6602('0x20')]['attributes']||null:null,'limit':_0x355df3[_0x6602('0x20')]?_0x355df3['options'][_0x6602('0x21')]||null:null})[_0x6602('0x11')](function(_0x235f52){logger[_0x6602('0x12')](_0x6602('0x1c'),_0x355df3);logger['debug'](_0x6602('0x1c'),_0x355df3,JSON[_0x6602('0x16')](_0x235f52));_0x55ec0c(_0x235f52);})['catch'](function(_0x987292){logger['error']('UpdateChatInteraction',_0x987292[_0x6602('0x18')],_0x355df3);_0x381ed8(_0x29c5dc[_0x6602('0x17')](0x1f4,_0x987292['message']));});});};exports[_0x6602('0x22')]=function(_0x596c71){return new Promise(function(_0x13b783,_0x25045f){return db['ChatInteraction'][_0x6602('0x23')]({'where':_0x596c71[_0x6602('0x20')]?_0x596c71[_0x6602('0x20')][_0x6602('0x24')]||null:null})['then'](function(_0xb9d616){if(_0xb9d616){return _0xb9d616[_0x6602('0x25')](_0x596c71[_0x6602('0x1f')][_0x6602('0x26')],_[_0x6602('0x27')](_0x596c71['body'],['ids','id'])||{});}})[_0x6602('0x28')](function(_0x31269e){logger[_0x6602('0x12')]('AddTags',_0x596c71);logger['debug'](_0x6602('0x29'),_0x596c71,JSON[_0x6602('0x16')](_0x31269e));_0x13b783(_0x31269e);})[_0x6602('0x1b')](function(_0x1ca417){logger[_0x6602('0x17')]('AddTags',_0x1ca417['message'],_0x596c71);_0x25045f(_this[_0x6602('0x17')](0x1f4,_0x1ca417[_0x6602('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index 8044e52..0ca4c17 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 _0x8734=['removeListener','chatInteraction:','./chatInteraction.events','remove','update','emit'];(function(_0x2e11d3,_0x26a29a){var _0x3f7f7f=function(_0x3c43f1){while(--_0x3c43f1){_0x2e11d3['push'](_0x2e11d3['shift']());}};_0x3f7f7f(++_0x26a29a);}(_0x8734,0x134));var _0x4873=function(_0x3dfea6,_0x5cd685){_0x3dfea6=_0x3dfea6-0x0;var _0x567aca=_0x8734[_0x3dfea6];return _0x567aca;};'use strict';var ChatInteractionEvents=require(_0x4873('0x0'));var events=['save',_0x4873('0x1'),_0x4873('0x2')];function createListener(_0x270283,_0x354735){return function(_0x4eb8ad){_0x354735[_0x4873('0x3')](_0x270283,_0x4eb8ad);};}function removeListener(_0x5bcb32,_0x1ae455){return function(){ChatInteractionEvents[_0x4873('0x4')](_0x5bcb32,_0x1ae455);};}exports['register']=function(_0xb44024){for(var _0x4b5d88=0x0,_0x5ea436=events['length'];_0x4b5d88<_0x5ea436;_0x4b5d88++){var _0x22ed5c=events[_0x4b5d88];var _0x54fdb5=createListener(_0x4873('0x5')+_0x22ed5c,_0xb44024);ChatInteractionEvents['on'](_0x22ed5c,_0x54fdb5);}}; \ No newline at end of file +var _0x9d2d=['update','emit','removeListener','register','chatInteraction:','save','remove'];(function(_0x4d22b8,_0x4f1c0b){var _0x233467=function(_0x50ac2c){while(--_0x50ac2c){_0x4d22b8['push'](_0x4d22b8['shift']());}};_0x233467(++_0x4f1c0b);}(_0x9d2d,0x124));var _0xd9d2=function(_0x31d279,_0x24f8d7){_0x31d279=_0x31d279-0x0;var _0x107618=_0x9d2d[_0x31d279];return _0x107618;};'use strict';var ChatInteractionEvents=require('./chatInteraction.events');var events=[_0xd9d2('0x0'),_0xd9d2('0x1'),_0xd9d2('0x2')];function createListener(_0x1fe802,_0x348c9d){return function(_0x406dc9){_0x348c9d[_0xd9d2('0x3')](_0x1fe802,_0x406dc9);};}function removeListener(_0x10f4bf,_0x420ef6){return function(){ChatInteractionEvents[_0xd9d2('0x4')](_0x10f4bf,_0x420ef6);};}exports[_0xd9d2('0x5')]=function(_0x8f3c05){for(var _0x2288db=0x0,_0x559ae0=events['length'];_0x2288db<_0x559ae0;_0x2288db++){var _0x5d49df=events[_0x2288db];var _0x195f06=createListener(_0xd9d2('0x6')+_0x5d49df,_0x8f3c05);ChatInteractionEvents['on'](_0x5d49df,_0x195f06);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index d548562..f7ec1fe 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 _0xf06a=['/:id/download','download','create','post','/:id/vidaoo','createVidaooSession','diskStorage','join','root','server/files/attachments/','%s-%s','now','originalname','replace','/:id/attachment_upload','attachmentUpload','addMessage','tracked','chat','put','chatinteraction:update','update','customUpdate','/:id/abandon','abandon','/:id/close','delete','chatinteraction:destroy','destroy','/:id/tags','removeTags','exports','multer','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInteraction.controller','get','isAuthenticated','/describe','describe','/:id','isChatInteractionAuthorized','show','/:id/attachment_download','attachmentDownload','/:id/messages','getMessages','/:id/my_messages','getMyMessages'];(function(_0x4f95f8,_0xb73784){var _0x123b8e=function(_0x89ad8f){while(--_0x89ad8f){_0x4f95f8['push'](_0x4f95f8['shift']());}};_0x123b8e(++_0xb73784);}(_0xf06a,0x158));var _0xaf06=function(_0x1b1d3b,_0x5ead4c){_0x1b1d3b=_0x1b1d3b-0x0;var _0x1535bc=_0xf06a[_0x1b1d3b];return _0x1535bc;};'use strict';var multer=require(_0xaf06('0x0'));var util=require('util');var path=require(_0xaf06('0x1'));var timeout=require('connect-timeout');var express=require(_0xaf06('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xaf06('0x3'));var interaction=require(_0xaf06('0x4'));var config=require(_0xaf06('0x5'));var controller=require(_0xaf06('0x6'));router[_0xaf06('0x7')]('/',auth[_0xaf06('0x8')](),controller['index']);router['get'](_0xaf06('0x9'),auth[_0xaf06('0x8')](),controller[_0xaf06('0xa')]);router[_0xaf06('0x7')](_0xaf06('0xb'),auth[_0xaf06('0xc')](),controller[_0xaf06('0xd')]);router[_0xaf06('0x7')](_0xaf06('0xe'),auth['isChatInteractionAuthorized'](),controller[_0xaf06('0xf')]);router[_0xaf06('0x7')](_0xaf06('0x10'),auth[_0xaf06('0x8')](),controller[_0xaf06('0x11')]);router[_0xaf06('0x7')](_0xaf06('0x12'),auth[_0xaf06('0xc')](),controller[_0xaf06('0x13')]);router[_0xaf06('0x7')](_0xaf06('0x14'),auth[_0xaf06('0x8')](),controller[_0xaf06('0x15')]);router['post']('/',auth[_0xaf06('0x8')](),controller[_0xaf06('0x16')]);router[_0xaf06('0x17')](_0xaf06('0x18'),auth[_0xaf06('0x8')](),controller[_0xaf06('0x19')]);var upload=multer({'storage':multer[_0xaf06('0x1a')]({'destination':function(_0x3a02e1,_0x58de4c,_0x114eed){_0x114eed(null,path[_0xaf06('0x1b')](config[_0xaf06('0x1c')],_0xaf06('0x1d')));},'filename':function(_0x52012b,_0x155b39,_0x1e2b4d){_0x1e2b4d(null,util['format'](_0xaf06('0x1e'),Date[_0xaf06('0x1f')](),_0x155b39[_0xaf06('0x20')][_0xaf06('0x21')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xaf06('0x17')](_0xaf06('0x22'),upload['single']('file'),controller[_0xaf06('0x23')]);router[_0xaf06('0x17')]('/:id/messages',auth['isChatInteractionAuthorized'](),controller[_0xaf06('0x24')]);router['post']('/:id/tags',auth[_0xaf06('0x8')](),interaction[_0xaf06('0x25')](_0xaf06('0x26'),'chatinteraction:addtags'),controller['addTags']);router[_0xaf06('0x27')](_0xaf06('0xb'),auth['isAuthenticated'](),interaction[_0xaf06('0x25')]('chat',_0xaf06('0x28')),controller[_0xaf06('0x29')]);router[_0xaf06('0x27')]('/:id/custom_update',controller[_0xaf06('0x2a')]);router[_0xaf06('0x27')](_0xaf06('0x2b'),auth[_0xaf06('0xc')](),controller[_0xaf06('0x2c')]);router[_0xaf06('0x27')](_0xaf06('0x2d'),controller['close']);router[_0xaf06('0x2e')](_0xaf06('0xb'),auth[_0xaf06('0x8')](),interaction[_0xaf06('0x25')](_0xaf06('0x26'),_0xaf06('0x2f')),controller[_0xaf06('0x30')]);router['delete'](_0xaf06('0x31'),auth['isAuthenticated'](),controller[_0xaf06('0x32')]);module[_0xaf06('0x33')]=router; \ No newline at end of file +var _0x9fcd=['chatinteraction:destroy','destroy','delete','exports','multer','util','path','Router','fs-extra','../../components/interaction/service','../../config/environment','get','index','/describe','/:id','show','/:id/attachment_download','isChatInteractionAuthorized','attachmentDownload','isAuthenticated','getMessages','/:id/download','download','post','create','/:id/vidaoo','createVidaooSession','diskStorage','join','server/files/attachments/','%s-%s','now','originalname','replace','/:id/attachment_upload','single','file','attachmentUpload','/:id/messages','addMessage','/:id/tags','chat','chatinteraction:addtags','addTags','put','chatinteraction:update','customUpdate','/:id/abandon','abandon','/:id/close','close'];(function(_0x2cf4b3,_0x3d8c66){var _0x4b72a8=function(_0x56c54d){while(--_0x56c54d){_0x2cf4b3['push'](_0x2cf4b3['shift']());}};_0x4b72a8(++_0x3d8c66);}(_0x9fcd,0x6a));var _0xd9fc=function(_0x4a36dd,_0x9d6dc4){_0x4a36dd=_0x4a36dd-0x0;var _0x59287a=_0x9fcd[_0x4a36dd];return _0x59287a;};'use strict';var multer=require(_0xd9fc('0x0'));var util=require(_0xd9fc('0x1'));var path=require(_0xd9fc('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xd9fc('0x3')]();var fs_extra=require(_0xd9fc('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xd9fc('0x5'));var config=require(_0xd9fc('0x6'));var controller=require('./chatInteraction.controller');router[_0xd9fc('0x7')]('/',auth['isAuthenticated'](),controller[_0xd9fc('0x8')]);router['get'](_0xd9fc('0x9'),auth['isAuthenticated'](),controller['describe']);router[_0xd9fc('0x7')](_0xd9fc('0xa'),auth['isChatInteractionAuthorized'](),controller[_0xd9fc('0xb')]);router[_0xd9fc('0x7')](_0xd9fc('0xc'),auth[_0xd9fc('0xd')](),controller[_0xd9fc('0xe')]);router[_0xd9fc('0x7')]('/:id/messages',auth[_0xd9fc('0xf')](),controller[_0xd9fc('0x10')]);router[_0xd9fc('0x7')]('/:id/my_messages',auth[_0xd9fc('0xd')](),controller['getMyMessages']);router[_0xd9fc('0x7')](_0xd9fc('0x11'),auth[_0xd9fc('0xf')](),controller[_0xd9fc('0x12')]);router[_0xd9fc('0x13')]('/',auth[_0xd9fc('0xf')](),controller[_0xd9fc('0x14')]);router[_0xd9fc('0x13')](_0xd9fc('0x15'),auth[_0xd9fc('0xf')](),controller[_0xd9fc('0x16')]);var upload=multer({'storage':multer[_0xd9fc('0x17')]({'destination':function(_0x439708,_0x47f89c,_0x503ffb){_0x503ffb(null,path[_0xd9fc('0x18')](config['root'],_0xd9fc('0x19')));},'filename':function(_0x407061,_0x3f4cea,_0x258264){_0x258264(null,util['format'](_0xd9fc('0x1a'),Date[_0xd9fc('0x1b')](),_0x3f4cea[_0xd9fc('0x1c')][_0xd9fc('0x1d')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xd9fc('0x13')](_0xd9fc('0x1e'),upload[_0xd9fc('0x1f')](_0xd9fc('0x20')),controller[_0xd9fc('0x21')]);router[_0xd9fc('0x13')](_0xd9fc('0x22'),auth[_0xd9fc('0xd')](),controller[_0xd9fc('0x23')]);router[_0xd9fc('0x13')](_0xd9fc('0x24'),auth['isAuthenticated'](),interaction['tracked'](_0xd9fc('0x25'),_0xd9fc('0x26')),controller[_0xd9fc('0x27')]);router[_0xd9fc('0x28')]('/:id',auth['isAuthenticated'](),interaction['tracked'](_0xd9fc('0x25'),_0xd9fc('0x29')),controller['update']);router['put']('/:id/custom_update',controller[_0xd9fc('0x2a')]);router['put'](_0xd9fc('0x2b'),auth['isChatInteractionAuthorized'](),controller[_0xd9fc('0x2c')]);router[_0xd9fc('0x28')](_0xd9fc('0x2d'),controller[_0xd9fc('0x2e')]);router['delete']('/:id',auth[_0xd9fc('0xf')](),interaction['tracked'](_0xd9fc('0x25'),_0xd9fc('0x2f')),controller[_0xd9fc('0x30')]);router[_0xd9fc('0x31')]('/:id/tags',auth[_0xd9fc('0xf')](),controller['removeTags']);module[_0xd9fc('0x32')]=router; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.attributes.js b/server/api/chatInternalMessage/chatInternalMessage.attributes.js index a612c52..67adda1 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 _0xd2a3=['exports','medium','BOOLEAN','INTEGER'];(function(_0x20b29c,_0xe22528){var _0x20d81b=function(_0xd63a71){while(--_0xd63a71){_0x20b29c['push'](_0x20b29c['shift']());}};_0x20d81b(++_0xe22528);}(_0xd2a3,0xd4));var _0x3d2a=function(_0x55e0c3,_0x456cf4){_0x55e0c3=_0x55e0c3-0x0;var _0x3ee5d8=_0xd2a3[_0x55e0c3];return _0x3ee5d8;};'use strict';var Sequelize=require('sequelize');module[_0x3d2a('0x0')]={'body':{'type':Sequelize['TEXT'](_0x3d2a('0x1')),'allowNull':![]},'read':{'type':Sequelize[_0x3d2a('0x2')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0x3d2a('0x3')]}}; \ No newline at end of file +var _0xc9ef=['INTEGER','sequelize','exports','TEXT','medium','BOOLEAN'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xc9ef,0xe5));var _0xfc9e=function(_0x4c5cd4,_0x268643){_0x4c5cd4=_0x4c5cd4-0x0;var _0x210bcf=_0xc9ef[_0x4c5cd4];return _0x210bcf;};'use strict';var Sequelize=require(_0xfc9e('0x0'));module[_0xfc9e('0x1')]={'body':{'type':Sequelize[_0xfc9e('0x2')](_0xfc9e('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xfc9e('0x4')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0xfc9e('0x5')]}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.controller.js b/server/api/chatInternalMessage/chatInternalMessage.controller.js index 8fc6c73..e972037 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 _0x5ed7=['save','update','then','destroy','error','stack','name','send','ChatInternalMessage','rawAttributes','fieldName','key','query','keys','filters','attributes','intersection','model','fields','length','hasOwnProperty','nolimit','order','where','pick','filter','map','type','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','find','create','body','params','describe','get','createdAt','lastMessage','lastMessageAt','format','YYYY-MM-DD\x20HH:mm:ss','getUsers','agent','user','internal','online','allowmessenger','showWebBar','sort','VoiceQueue','VoiceQueues','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','Agents','autoAssociation','isEmpty','resourceId','push','messages','ToId','read','all','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject'];(function(_0x208961,_0x5e6cf6){var _0x4236f5=function(_0x28856f){while(--_0x28856f){_0x208961['push'](_0x208961['shift']());}};_0x4236f5(++_0x5e6cf6);}(_0x5ed7,0x11c));var _0x75ed=function(_0x11abab,_0x1ad3dd){_0x11abab=_0x11abab-0x0;var _0x1e2b7c=_0x5ed7[_0x11abab];return _0x1e2b7c;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x75ed('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x75ed('0x1'));var moment=require('moment');var BPromise=require(_0x75ed('0x2'));var Mustache=require(_0x75ed('0x3'));var util=require(_0x75ed('0x4'));var path=require(_0x75ed('0x5'));var sox=require(_0x75ed('0x6'));var csv=require(_0x75ed('0x7'));var ejs=require(_0x75ed('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x75ed('0x9'));var squel=require('squel');var crypto=require(_0x75ed('0xa'));var jsforce=require(_0x75ed('0xb'));var deskjs=require(_0x75ed('0xc'));var toCsv=require(_0x75ed('0x7'));var querystring=require('querystring');var Papa=require(_0x75ed('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x75ed('0xe'));var as=require(_0x75ed('0xf'));var hardwareService=require(_0x75ed('0x10'));var logger=require('../../config/logger')(_0x75ed('0x11'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x75ed('0x12'));var db=require(_0x75ed('0x13'))['db'];config[_0x75ed('0x14')]=_[_0x75ed('0x15')](config[_0x75ed('0x14')],{'host':_0x75ed('0x16'),'port':0x18eb});var socket=require(_0x75ed('0x17'))(new Redis(config['redis']));require(_0x75ed('0x18'))[_0x75ed('0x19')](socket);function respondWithStatusCode(_0x8715e2,_0x3fc968){_0x3fc968=_0x3fc968||0xcc;return function(_0x11a465){if(_0x11a465){return _0x8715e2[_0x75ed('0x1a')](_0x3fc968);}return _0x8715e2[_0x75ed('0x1b')](_0x3fc968)[_0x75ed('0x1c')]();};}function respondWithResult(_0x28caa4,_0x1f4fa1){_0x1f4fa1=_0x1f4fa1||0xc8;return function(_0x422a8a){if(_0x422a8a){return _0x28caa4[_0x75ed('0x1b')](_0x1f4fa1)[_0x75ed('0x1d')](_0x422a8a);}};}function respondWithFilteredResult(_0x32567b,_0x34cb14){return function(_0x9a258c){if(_0x9a258c){var _0xc7ee9f=typeof _0x34cb14[_0x75ed('0x1e')]===_0x75ed('0x1f')&&typeof _0x34cb14[_0x75ed('0x20')]===_0x75ed('0x1f');var _0xb977a3=_0x9a258c[_0x75ed('0x21')];var _0x28a4a2=_0xc7ee9f?0x0:_0x34cb14['offset'];var _0x9a89f3=_0xc7ee9f?_0x9a258c[_0x75ed('0x21')]:_0x34cb14['offset']+_0x34cb14[_0x75ed('0x20')];var _0x1bd8c4;if(_0x9a89f3>=_0xb977a3){_0x9a89f3=_0xb977a3;_0x1bd8c4=0xc8;}else{_0x1bd8c4=0xce;}_0x32567b[_0x75ed('0x1b')](_0x1bd8c4);return _0x32567b['set'](_0x75ed('0x22'),_0x28a4a2+'-'+_0x9a89f3+'/'+_0xb977a3)[_0x75ed('0x1d')](_0x9a258c);}return null;};}function patchUpdates(_0x2d17cd){return function(_0x5bfa16){try{jsonpatch[_0x75ed('0x23')](_0x5bfa16,_0x2d17cd,!![]);}catch(_0x51f886){return BPromise[_0x75ed('0x24')](_0x51f886);}return _0x5bfa16[_0x75ed('0x25')]();};}function saveUpdates(_0x5781ac,_0x23eb8a){return function(_0x359e31){if(_0x359e31){return _0x359e31[_0x75ed('0x26')](_0x5781ac)[_0x75ed('0x27')](function(_0x5a70f8){return _0x5a70f8;});}return null;};}function removeEntity(_0x8cd377,_0x42c93b){return function(_0x477530){if(_0x477530){return _0x477530[_0x75ed('0x28')]()['then'](function(){_0x8cd377['status'](0xcc)[_0x75ed('0x1c')]();});}};}function handleEntityNotFound(_0xffc1d7,_0x26edd5){return function(_0x5efdd1){if(!_0x5efdd1){_0xffc1d7[_0x75ed('0x1a')](0x194);}return _0x5efdd1;};}function handleError(_0x440dea,_0x17785c){_0x17785c=_0x17785c||0x1f4;return function(_0x12cc8d){logger[_0x75ed('0x29')](_0x12cc8d[_0x75ed('0x2a')]);if(_0x12cc8d['name']){delete _0x12cc8d[_0x75ed('0x2b')];}_0x440dea[_0x75ed('0x1b')](_0x17785c)[_0x75ed('0x2c')](_0x12cc8d);};}exports['index']=function(_0x4dc113,_0x18ce30){var _0x331ad3={},_0x581769={},_0x49bab0={'count':0x0,'rows':[]};var _0x259676=_['map'](db[_0x75ed('0x2d')][_0x75ed('0x2e')],function(_0x2a4607){return{'name':_0x2a4607[_0x75ed('0x2f')],'type':_0x2a4607['type'][_0x75ed('0x30')]};});_0x581769['model']=_['map'](_0x259676,_0x75ed('0x2b'));_0x581769[_0x75ed('0x31')]=_[_0x75ed('0x32')](_0x4dc113['query']);_0x581769[_0x75ed('0x33')]=_['intersection'](_0x581769['model'],_0x581769[_0x75ed('0x31')]);_0x331ad3[_0x75ed('0x34')]=_[_0x75ed('0x35')](_0x581769[_0x75ed('0x36')],qs[_0x75ed('0x37')](_0x4dc113[_0x75ed('0x31')]['fields']));_0x331ad3['attributes']=_0x331ad3[_0x75ed('0x34')][_0x75ed('0x38')]?_0x331ad3[_0x75ed('0x34')]:_0x581769[_0x75ed('0x36')];if(!_0x4dc113[_0x75ed('0x31')][_0x75ed('0x39')](_0x75ed('0x3a'))){_0x331ad3[_0x75ed('0x20')]=qs[_0x75ed('0x20')](_0x4dc113['query']['limit']);_0x331ad3['offset']=qs['offset'](_0x4dc113[_0x75ed('0x31')][_0x75ed('0x1e')]);}_0x331ad3[_0x75ed('0x3b')]=qs['sort'](_0x4dc113[_0x75ed('0x31')]['sort']);_0x331ad3[_0x75ed('0x3c')]=qs[_0x75ed('0x33')](_[_0x75ed('0x3d')](_0x4dc113['query'],_0x581769['filters']),_0x259676);if(_0x4dc113['query'][_0x75ed('0x3e')]){_0x331ad3[_0x75ed('0x3c')]=_['merge'](_0x331ad3['where'],{'$or':_[_0x75ed('0x3f')](_0x259676,function(_0x4da6bc){if(_0x4da6bc[_0x75ed('0x40')]!==_0x75ed('0x41')){var _0xce8334={};_0xce8334[_0x4da6bc['name']]={'$like':'%'+_0x4dc113['query'][_0x75ed('0x3e')]+'%'};return _0xce8334;}})});}_0x331ad3=_[_0x75ed('0x42')]({},_0x331ad3,_0x4dc113[_0x75ed('0x43')]);var _0x48cdc7={'where':_0x331ad3[_0x75ed('0x3c')]};return db[_0x75ed('0x2d')][_0x75ed('0x21')](_0x48cdc7)['then'](function(_0x2f7477){_0x49bab0[_0x75ed('0x21')]=_0x2f7477;if(_0x4dc113[_0x75ed('0x31')][_0x75ed('0x44')]){_0x331ad3[_0x75ed('0x45')]=[{'all':!![]}];}return db[_0x75ed('0x2d')][_0x75ed('0x46')](_0x331ad3);})[_0x75ed('0x27')](function(_0x3ed486){_0x49bab0[_0x75ed('0x47')]=_0x3ed486;return _0x49bab0;})[_0x75ed('0x27')](respondWithFilteredResult(_0x18ce30,_0x331ad3))[_0x75ed('0x48')](handleError(_0x18ce30,null));};exports[_0x75ed('0x49')]=function(_0x2a8d7e,_0x5e567d){var _0x5a687e={'raw':!![],'where':{'id':_0x2a8d7e['params']['id']}},_0x44ae7a={};_0x44ae7a[_0x75ed('0x36')]=_[_0x75ed('0x32')](db[_0x75ed('0x2d')][_0x75ed('0x2e')]);_0x44ae7a[_0x75ed('0x31')]=_['keys'](_0x2a8d7e[_0x75ed('0x31')]);_0x44ae7a[_0x75ed('0x33')]=_[_0x75ed('0x35')](_0x44ae7a[_0x75ed('0x36')],_0x44ae7a['query']);_0x5a687e['attributes']=_['intersection'](_0x44ae7a[_0x75ed('0x36')],qs[_0x75ed('0x37')](_0x2a8d7e['query'][_0x75ed('0x37')]));_0x5a687e[_0x75ed('0x34')]=_0x5a687e['attributes'][_0x75ed('0x38')]?_0x5a687e['attributes']:_0x44ae7a['model'];if(_0x2a8d7e[_0x75ed('0x31')]['includeAll']){_0x5a687e[_0x75ed('0x45')]=[{'all':!![]}];}_0x5a687e=_[_0x75ed('0x42')]({},_0x5a687e,_0x2a8d7e['options']);return db[_0x75ed('0x2d')][_0x75ed('0x4a')](_0x5a687e)[_0x75ed('0x27')](handleEntityNotFound(_0x5e567d,null))[_0x75ed('0x27')](respondWithResult(_0x5e567d,null))[_0x75ed('0x48')](handleError(_0x5e567d,null));};exports[_0x75ed('0x4b')]=function(_0xad8e9f,_0x46f1e7){return db[_0x75ed('0x2d')][_0x75ed('0x4b')](_0xad8e9f[_0x75ed('0x4c')],{})['then'](respondWithResult(_0x46f1e7,0xc9))[_0x75ed('0x48')](handleError(_0x46f1e7,null));};exports['update']=function(_0x40a8d1,_0x5c8f9d){if(_0x40a8d1[_0x75ed('0x4c')]['id']){delete _0x40a8d1[_0x75ed('0x4c')]['id'];}return db[_0x75ed('0x2d')][_0x75ed('0x4a')]({'where':{'id':_0x40a8d1[_0x75ed('0x4d')]['id']}})[_0x75ed('0x27')](handleEntityNotFound(_0x5c8f9d,null))['then'](saveUpdates(_0x40a8d1[_0x75ed('0x4c')],null))[_0x75ed('0x27')](respondWithResult(_0x5c8f9d,null))['catch'](handleError(_0x5c8f9d,null));};exports[_0x75ed('0x28')]=function(_0x2bb938,_0x30ce06){return db[_0x75ed('0x2d')][_0x75ed('0x4a')]({'where':{'id':_0x2bb938[_0x75ed('0x4d')]['id']}})['then'](handleEntityNotFound(_0x30ce06,null))['then'](removeEntity(_0x30ce06,null))[_0x75ed('0x48')](handleError(_0x30ce06,null));};exports[_0x75ed('0x4e')]=function(_0x382fa4,_0x3a0dbe){return db[_0x75ed('0x2d')][_0x75ed('0x4e')]()[_0x75ed('0x27')](respondWithResult(_0x3a0dbe,null))[_0x75ed('0x48')](handleError(_0x3a0dbe,null));};function wrapUser(_0xf4f425){return function(_0x27e564){var _0x33174d=_0xf4f425[_0x75ed('0x4f')]({'plain':!![]});_0x33174d['messages']=[];if(_0x27e564){_0x33174d['lastMessageAt']=_0x27e564[_0x75ed('0x50')];_0x33174d[_0x75ed('0x51')]=_0x27e564;}else{_0x33174d[_0x75ed('0x52')]=moment(0x0)[_0x75ed('0x53')](_0x75ed('0x54'));_0x33174d[_0x75ed('0x51')]={};}return _0x33174d;};}exports[_0x75ed('0x55')]=function(_0x5906ca,_0x307b02,_0xbc8294){var _0x3e8040=[];return db['User'][_0x75ed('0x46')]({'where':{'role':[_0x75ed('0x56'),'admin',_0x75ed('0x57')]},'attributes':['id','fullname',_0x75ed('0x2b'),'role','userpic',_0x75ed('0x58'),_0x75ed('0x59'),'lastLoginAt',_0x75ed('0x5a'),_0x75ed('0x5b')],'order':qs[_0x75ed('0x5c')]('-online'),'include':[{'model':db[_0x75ed('0x5d')],'as':_0x75ed('0x5e'),'attributes':['id',_0x75ed('0x2b'),_0x75ed('0x40')],'through':{'attributes':[]}}]})[_0x75ed('0x27')](function(_0x4c80f8){if(_0x4c80f8){var _0x3c757b=_0x5906ca[_0x75ed('0x57')][_0x75ed('0x4f')]({'plain':!![]});if(!_0x3c757b)throw new Error(_0x75ed('0x5f'));if(_0x3c757b[_0x75ed('0x60')]===_0x75ed('0x57')){return db[_0x75ed('0x61')][_0x75ed('0x4a')]({'where':{'name':_0x75ed('0x62'),'userProfileId':_0x3c757b['userProfileId']},'raw':!![]})[_0x75ed('0x27')](function(_0x2e3107){if(_0x2e3107){if(_0x2e3107[_0x75ed('0x63')]===0x0){return db['UserProfileResource'][_0x75ed('0x46')]({'where':{'sectionId':_0x2e3107['id']},'raw':!![]})[_0x75ed('0x27')](function(_0x54fa6f){var _0xf08da=[];if(_[_0x75ed('0x64')](_0x54fa6f)){_0xf08da=_[_0x75ed('0x3e')](_0x4c80f8,function(_0x5b2c7a){if(_0x5b2c7a['role']!=='agent'){return _0x5b2c7a;}});return _0xf08da;}else{for(var _0x5d7331=0x0;_0x5d7331<_0x4c80f8[_0x75ed('0x38')];_0x5d7331++){var _0x5ca16d=_0x4c80f8[_0x5d7331];if(_0x5ca16d['role']===_0x75ed('0x56')){var _0x3901cc=_['find'](_0x54fa6f,function(_0x178511){return _0x178511[_0x75ed('0x65')]===_0x5ca16d['id'];});if(_0x3901cc)_0xf08da[_0x75ed('0x66')](_0x5ca16d);}else{_0xf08da[_0x75ed('0x66')](_0x5ca16d);}}return _0xf08da;}});}else{return _0x4c80f8;}}else{var _0x103958=_[_0x75ed('0x3e')](_0x4c80f8,function(_0x406725){if(_0x406725['role']!==_0x75ed('0x56')){return _0x406725;}});return _0x103958;}});}else{return _0x4c80f8;}}})[_0x75ed('0x27')](function(_0x35b4f3){var _0x39da36=[];if(_0x35b4f3){_0x3e8040=_0x35b4f3;for(var _0x534fcf=0x0;_0x534fcf<_0x35b4f3[_0x75ed('0x38')];_0x534fcf+=0x1){_0x3e8040[_0x534fcf][_0x75ed('0x67')]=[];_0x39da36[_0x75ed('0x66')](db[_0x75ed('0x2d')]['find']({'where':{'FromId':[_0x5906ca[_0x75ed('0x57')]['id'],_0x35b4f3[_0x534fcf]['id']],'ToId':[_0x5906ca[_0x75ed('0x57')]['id'],_0x35b4f3[_0x534fcf]['id']],'ChatGroupId':null},'attributes':['id','createdAt','FromId',_0x75ed('0x68'),_0x75ed('0x69'),_0x75ed('0x4c')],'order':qs[_0x75ed('0x5c')]('-createdAt'),'limit':0x1,'offset':0x0,'raw':!![]})[_0x75ed('0x27')](wrapUser(_0x35b4f3[_0x534fcf])));}return BPromise[_0x75ed('0x6a')](_0x39da36);}return[];})['then'](function(_0x2418cd){return{'rows':_0x2418cd,'count':_0x2418cd['length']};})['then'](respondWithResult(_0x307b02,null))['catch'](handleError(_0x307b02,null));}; \ No newline at end of file +var _0x7410=['includeAll','include','findAll','catch','show','params','find','create','body','describe','get','lastMessageAt','createdAt','lastMessage','YYYY-MM-DD\x20HH:mm:ss','User','agent','admin','user','fullname','role','online','lastLoginAt','allowmessenger','showWebBar','-online','VoiceQueue','UserProfileSection','Agents','userProfileId','autoAssociation','UserProfileResource','resourceId','push','messages','FromId','ToId','read','-createdAt','all','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','sendStatus','stack','name','send','index','map','ChatInternalMessage','rawAttributes','fieldName','type','key','query','keys','filters','attributes','intersection','model','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','merge','options'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x7410,0x9b));var _0x0741=function(_0x3ac779,_0x2fb6ad){_0x3ac779=_0x3ac779-0x0;var _0x5de65d=_0x7410[_0x3ac779];return _0x5de65d;};'use strict';var emlformat=require(_0x0741('0x0'));var rimraf=require(_0x0741('0x1'));var zipdir=require(_0x0741('0x2'));var jsonpatch=require(_0x0741('0x3'));var rp=require('request-promise');var moment=require(_0x0741('0x4'));var BPromise=require(_0x0741('0x5'));var Mustache=require(_0x0741('0x6'));var util=require(_0x0741('0x7'));var path=require(_0x0741('0x8'));var sox=require(_0x0741('0x9'));var csv=require(_0x0741('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0741('0xb'));var _=require(_0x0741('0xc'));var squel=require(_0x0741('0xd'));var crypto=require(_0x0741('0xe'));var jsforce=require(_0x0741('0xf'));var deskjs=require(_0x0741('0x10'));var toCsv=require(_0x0741('0xa'));var querystring=require(_0x0741('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x0741('0x12'));var qs=require(_0x0741('0x13'));var as=require(_0x0741('0x14'));var hardwareService=require(_0x0741('0x15'));var logger=require(_0x0741('0x16'))('api');var utils=require(_0x0741('0x17'));var config=require(_0x0741('0x18'));var licenseUtil=require(_0x0741('0x19'));var db=require(_0x0741('0x1a'))['db'];config[_0x0741('0x1b')]=_[_0x0741('0x1c')](config[_0x0741('0x1b')],{'host':_0x0741('0x1d'),'port':0x18eb});var socket=require(_0x0741('0x1e'))(new Redis(config[_0x0741('0x1b')]));require(_0x0741('0x1f'))['register'](socket);function respondWithStatusCode(_0x466dee,_0x57d275){_0x57d275=_0x57d275||0xcc;return function(_0x28c37b){if(_0x28c37b){return _0x466dee['sendStatus'](_0x57d275);}return _0x466dee[_0x0741('0x20')](_0x57d275)[_0x0741('0x21')]();};}function respondWithResult(_0x24e07e,_0x40599f){_0x40599f=_0x40599f||0xc8;return function(_0x18c531){if(_0x18c531){return _0x24e07e[_0x0741('0x20')](_0x40599f)[_0x0741('0x22')](_0x18c531);}};}function respondWithFilteredResult(_0x3f0082,_0x35504a){return function(_0x2e9495){if(_0x2e9495){var _0x95cf86=typeof _0x35504a[_0x0741('0x23')]===_0x0741('0x24')&&typeof _0x35504a[_0x0741('0x25')]===_0x0741('0x24');var _0x47038a=_0x2e9495[_0x0741('0x26')];var _0x318a3b=_0x95cf86?0x0:_0x35504a[_0x0741('0x23')];var _0x419867=_0x95cf86?_0x2e9495['count']:_0x35504a[_0x0741('0x23')]+_0x35504a[_0x0741('0x25')];var _0x3d86dc;if(_0x419867>=_0x47038a){_0x419867=_0x47038a;_0x3d86dc=0xc8;}else{_0x3d86dc=0xce;}_0x3f0082[_0x0741('0x20')](_0x3d86dc);return _0x3f0082[_0x0741('0x27')](_0x0741('0x28'),_0x318a3b+'-'+_0x419867+'/'+_0x47038a)[_0x0741('0x22')](_0x2e9495);}return null;};}function patchUpdates(_0x39b71d){return function(_0x580ebe){try{jsonpatch[_0x0741('0x29')](_0x580ebe,_0x39b71d,!![]);}catch(_0x33d5b6){return BPromise[_0x0741('0x2a')](_0x33d5b6);}return _0x580ebe[_0x0741('0x2b')]();};}function saveUpdates(_0x32c14e,_0x3cc9b1){return function(_0x5c0a56){if(_0x5c0a56){return _0x5c0a56[_0x0741('0x2c')](_0x32c14e)['then'](function(_0x54985a){return _0x54985a;});}return null;};}function removeEntity(_0x68e47b,_0x2bf6a1){return function(_0x1bbb88){if(_0x1bbb88){return _0x1bbb88[_0x0741('0x2d')]()[_0x0741('0x2e')](function(){_0x68e47b[_0x0741('0x20')](0xcc)[_0x0741('0x21')]();});}};}function handleEntityNotFound(_0x16e684,_0x2bebf0){return function(_0x14c035){if(!_0x14c035){_0x16e684[_0x0741('0x2f')](0x194);}return _0x14c035;};}function handleError(_0x13c07e,_0x3c02ca){_0x3c02ca=_0x3c02ca||0x1f4;return function(_0x55178f){logger['error'](_0x55178f[_0x0741('0x30')]);if(_0x55178f[_0x0741('0x31')]){delete _0x55178f['name'];}_0x13c07e['status'](_0x3c02ca)[_0x0741('0x32')](_0x55178f);};}exports[_0x0741('0x33')]=function(_0x26c7d7,_0x2f6e2e){var _0x423268={},_0x420396={},_0x3768e7={'count':0x0,'rows':[]};var _0x2e6f12=_[_0x0741('0x34')](db[_0x0741('0x35')][_0x0741('0x36')],function(_0x57ef52){return{'name':_0x57ef52[_0x0741('0x37')],'type':_0x57ef52[_0x0741('0x38')][_0x0741('0x39')]};});_0x420396['model']=_[_0x0741('0x34')](_0x2e6f12,_0x0741('0x31'));_0x420396[_0x0741('0x3a')]=_[_0x0741('0x3b')](_0x26c7d7[_0x0741('0x3a')]);_0x420396[_0x0741('0x3c')]=_['intersection'](_0x420396['model'],_0x420396['query']);_0x423268[_0x0741('0x3d')]=_[_0x0741('0x3e')](_0x420396[_0x0741('0x3f')],qs[_0x0741('0x40')](_0x26c7d7[_0x0741('0x3a')][_0x0741('0x40')]));_0x423268[_0x0741('0x3d')]=_0x423268[_0x0741('0x3d')][_0x0741('0x41')]?_0x423268[_0x0741('0x3d')]:_0x420396[_0x0741('0x3f')];if(!_0x26c7d7['query'][_0x0741('0x42')](_0x0741('0x43'))){_0x423268[_0x0741('0x25')]=qs[_0x0741('0x25')](_0x26c7d7['query']['limit']);_0x423268[_0x0741('0x23')]=qs[_0x0741('0x23')](_0x26c7d7['query'][_0x0741('0x23')]);}_0x423268[_0x0741('0x44')]=qs[_0x0741('0x45')](_0x26c7d7['query'][_0x0741('0x45')]);_0x423268[_0x0741('0x46')]=qs['filters'](_['pick'](_0x26c7d7[_0x0741('0x3a')],_0x420396[_0x0741('0x3c')]),_0x2e6f12);if(_0x26c7d7['query'][_0x0741('0x47')]){_0x423268[_0x0741('0x46')]=_['merge'](_0x423268[_0x0741('0x46')],{'$or':_[_0x0741('0x34')](_0x2e6f12,function(_0x58970c){if(_0x58970c[_0x0741('0x38')]!==_0x0741('0x48')){var _0x54062c={};_0x54062c[_0x58970c['name']]={'$like':'%'+_0x26c7d7[_0x0741('0x3a')][_0x0741('0x47')]+'%'};return _0x54062c;}})});}_0x423268=_[_0x0741('0x49')]({},_0x423268,_0x26c7d7[_0x0741('0x4a')]);var _0x517c09={'where':_0x423268[_0x0741('0x46')]};return db[_0x0741('0x35')]['count'](_0x517c09)[_0x0741('0x2e')](function(_0x4f06b6){_0x3768e7[_0x0741('0x26')]=_0x4f06b6;if(_0x26c7d7[_0x0741('0x3a')][_0x0741('0x4b')]){_0x423268[_0x0741('0x4c')]=[{'all':!![]}];}return db[_0x0741('0x35')][_0x0741('0x4d')](_0x423268);})[_0x0741('0x2e')](function(_0x511366){_0x3768e7['rows']=_0x511366;return _0x3768e7;})[_0x0741('0x2e')](respondWithFilteredResult(_0x2f6e2e,_0x423268))[_0x0741('0x4e')](handleError(_0x2f6e2e,null));};exports[_0x0741('0x4f')]=function(_0xdb27da,_0x847f2){var _0x24c463={'raw':!![],'where':{'id':_0xdb27da[_0x0741('0x50')]['id']}},_0x40c6dd={};_0x40c6dd[_0x0741('0x3f')]=_['keys'](db[_0x0741('0x35')][_0x0741('0x36')]);_0x40c6dd[_0x0741('0x3a')]=_['keys'](_0xdb27da[_0x0741('0x3a')]);_0x40c6dd[_0x0741('0x3c')]=_[_0x0741('0x3e')](_0x40c6dd['model'],_0x40c6dd[_0x0741('0x3a')]);_0x24c463['attributes']=_[_0x0741('0x3e')](_0x40c6dd[_0x0741('0x3f')],qs[_0x0741('0x40')](_0xdb27da[_0x0741('0x3a')][_0x0741('0x40')]));_0x24c463[_0x0741('0x3d')]=_0x24c463[_0x0741('0x3d')][_0x0741('0x41')]?_0x24c463[_0x0741('0x3d')]:_0x40c6dd[_0x0741('0x3f')];if(_0xdb27da[_0x0741('0x3a')][_0x0741('0x4b')]){_0x24c463[_0x0741('0x4c')]=[{'all':!![]}];}_0x24c463=_[_0x0741('0x49')]({},_0x24c463,_0xdb27da['options']);return db[_0x0741('0x35')][_0x0741('0x51')](_0x24c463)[_0x0741('0x2e')](handleEntityNotFound(_0x847f2,null))[_0x0741('0x2e')](respondWithResult(_0x847f2,null))[_0x0741('0x4e')](handleError(_0x847f2,null));};exports[_0x0741('0x52')]=function(_0x244158,_0x1980fb){return db[_0x0741('0x35')][_0x0741('0x52')](_0x244158[_0x0741('0x53')],{})[_0x0741('0x2e')](respondWithResult(_0x1980fb,0xc9))[_0x0741('0x4e')](handleError(_0x1980fb,null));};exports[_0x0741('0x2c')]=function(_0x5a13ab,_0x1b0c8d){if(_0x5a13ab[_0x0741('0x53')]['id']){delete _0x5a13ab[_0x0741('0x53')]['id'];}return db[_0x0741('0x35')]['find']({'where':{'id':_0x5a13ab[_0x0741('0x50')]['id']}})[_0x0741('0x2e')](handleEntityNotFound(_0x1b0c8d,null))[_0x0741('0x2e')](saveUpdates(_0x5a13ab[_0x0741('0x53')],null))[_0x0741('0x2e')](respondWithResult(_0x1b0c8d,null))['catch'](handleError(_0x1b0c8d,null));};exports[_0x0741('0x2d')]=function(_0x3d2bde,_0xa1c15e){return db[_0x0741('0x35')][_0x0741('0x51')]({'where':{'id':_0x3d2bde[_0x0741('0x50')]['id']}})[_0x0741('0x2e')](handleEntityNotFound(_0xa1c15e,null))[_0x0741('0x2e')](removeEntity(_0xa1c15e,null))['catch'](handleError(_0xa1c15e,null));};exports['describe']=function(_0x3abb5d,_0x394009){return db[_0x0741('0x35')][_0x0741('0x54')]()[_0x0741('0x2e')](respondWithResult(_0x394009,null))['catch'](handleError(_0x394009,null));};function wrapUser(_0x4a7959){return function(_0x456189){var _0x55d770=_0x4a7959[_0x0741('0x55')]({'plain':!![]});_0x55d770['messages']=[];if(_0x456189){_0x55d770[_0x0741('0x56')]=_0x456189[_0x0741('0x57')];_0x55d770[_0x0741('0x58')]=_0x456189;}else{_0x55d770[_0x0741('0x56')]=moment(0x0)['format'](_0x0741('0x59'));_0x55d770['lastMessage']={};}return _0x55d770;};}exports['getUsers']=function(_0x32ccbf,_0x56cefa,_0x28e78a){var _0x17979b=[];return db[_0x0741('0x5a')][_0x0741('0x4d')]({'where':{'role':[_0x0741('0x5b'),_0x0741('0x5c'),_0x0741('0x5d')]},'attributes':['id',_0x0741('0x5e'),_0x0741('0x31'),_0x0741('0x5f'),'userpic','internal',_0x0741('0x60'),_0x0741('0x61'),_0x0741('0x62'),_0x0741('0x63')],'order':qs[_0x0741('0x45')](_0x0741('0x64')),'include':[{'model':db[_0x0741('0x65')],'as':'VoiceQueues','attributes':['id','name','type'],'through':{'attributes':[]}}]})[_0x0741('0x2e')](function(_0x3cfca6){if(_0x3cfca6){var _0x31dad7=_0x32ccbf[_0x0741('0x5d')]['get']({'plain':!![]});if(!_0x31dad7)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x31dad7[_0x0741('0x5f')]===_0x0741('0x5d')){return db[_0x0741('0x66')][_0x0741('0x51')]({'where':{'name':_0x0741('0x67'),'userProfileId':_0x31dad7[_0x0741('0x68')]},'raw':!![]})[_0x0741('0x2e')](function(_0x2ca818){if(_0x2ca818){if(_0x2ca818[_0x0741('0x69')]===0x0){return db[_0x0741('0x6a')][_0x0741('0x4d')]({'where':{'sectionId':_0x2ca818['id']},'raw':!![]})[_0x0741('0x2e')](function(_0x58bd6e){var _0x55054f=[];if(_['isEmpty'](_0x58bd6e)){_0x55054f=_[_0x0741('0x47')](_0x3cfca6,function(_0x1e9a5e){if(_0x1e9a5e['role']!=='agent'){return _0x1e9a5e;}});return _0x55054f;}else{for(var _0x2920e8=0x0;_0x2920e8<_0x3cfca6['length'];_0x2920e8++){var _0x5030d4=_0x3cfca6[_0x2920e8];if(_0x5030d4['role']===_0x0741('0x5b')){var _0x181ea9=_[_0x0741('0x51')](_0x58bd6e,function(_0x53eeaf){return _0x53eeaf[_0x0741('0x6b')]===_0x5030d4['id'];});if(_0x181ea9)_0x55054f['push'](_0x5030d4);}else{_0x55054f[_0x0741('0x6c')](_0x5030d4);}}return _0x55054f;}});}else{return _0x3cfca6;}}else{var _0x43988b=_[_0x0741('0x47')](_0x3cfca6,function(_0x5c1a2f){if(_0x5c1a2f['role']!==_0x0741('0x5b')){return _0x5c1a2f;}});return _0x43988b;}});}else{return _0x3cfca6;}}})['then'](function(_0x382d85){var _0x3c5df3=[];if(_0x382d85){_0x17979b=_0x382d85;for(var _0x217702=0x0;_0x217702<_0x382d85[_0x0741('0x41')];_0x217702+=0x1){_0x17979b[_0x217702][_0x0741('0x6d')]=[];_0x3c5df3['push'](db[_0x0741('0x35')][_0x0741('0x51')]({'where':{'FromId':[_0x32ccbf[_0x0741('0x5d')]['id'],_0x382d85[_0x217702]['id']],'ToId':[_0x32ccbf[_0x0741('0x5d')]['id'],_0x382d85[_0x217702]['id']],'ChatGroupId':null},'attributes':['id',_0x0741('0x57'),_0x0741('0x6e'),_0x0741('0x6f'),_0x0741('0x70'),'body'],'order':qs[_0x0741('0x45')](_0x0741('0x71')),'limit':0x1,'offset':0x0,'raw':!![]})['then'](wrapUser(_0x382d85[_0x217702])));}return BPromise[_0x0741('0x72')](_0x3c5df3);}return[];})[_0x0741('0x2e')](function(_0x1cded5){return{'rows':_0x1cded5,'count':_0x1cded5[_0x0741('0x41')]};})[_0x0741('0x2e')](respondWithResult(_0x56cefa,null))[_0x0741('0x4e')](handleError(_0x56cefa,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index 8b9a0df..545263a 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 _0xb1fa=['save','hook','ChatInternalMessage'];(function(_0x3003fc,_0x5ac5de){var _0x22cb43=function(_0x478661){while(--_0x478661){_0x3003fc['push'](_0x3003fc['shift']());}};_0x22cb43(++_0x5ac5de);}(_0xb1fa,0x9e));var _0xab1f=function(_0x2d51ed,_0x40cc5f){_0x2d51ed=_0x2d51ed-0x0;var _0x368cea=_0xb1fa[_0x2d51ed];return _0x368cea;};'use strict';var EventEmitter=require('events');var ChatInternalMessage=require('../../mysqldb')['db'][_0xab1f('0x0')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xab1f('0x1'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x4fa20a){return function(_0x554576,_0x50e03f,_0x2f3821){ChatInternalMessageEvents['emit'](_0x4fa20a+':'+_0x554576['id'],_0x554576);ChatInternalMessageEvents['emit'](_0x4fa20a,_0x554576);_0x2f3821(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatInternalMessage[_0xab1f('0x2')](e,emitEvent(event));}}module['exports']=ChatInternalMessageEvents; \ No newline at end of file +var _0xcdd6=['setMaxListeners','save','remove','emit','hook','../../mysqldb','ChatInternalMessage'];(function(_0x4c3e69,_0x2be8c6){var _0x4aa69=function(_0x3b1238){while(--_0x3b1238){_0x4c3e69['push'](_0x4c3e69['shift']());}};_0x4aa69(++_0x2be8c6);}(_0xcdd6,0x1be));var _0x6cdd=function(_0x41f2fd,_0x427d9c){_0x41f2fd=_0x41f2fd-0x0;var _0x19ee5a=_0xcdd6[_0x41f2fd];return _0x19ee5a;};'use strict';var EventEmitter=require('events');var ChatInternalMessage=require(_0x6cdd('0x0'))['db'][_0x6cdd('0x1')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0x6cdd('0x2')](0x0);var events={'afterCreate':_0x6cdd('0x3'),'afterUpdate':'update','afterDestroy':_0x6cdd('0x4')};function emitEvent(_0x4d4591){return function(_0x105169,_0x2dd7da,_0x2cf235){ChatInternalMessageEvents[_0x6cdd('0x5')](_0x4d4591+':'+_0x105169['id'],_0x105169);ChatInternalMessageEvents[_0x6cdd('0x5')](_0x4d4591,_0x105169);_0x2cf235(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatInternalMessage[_0x6cdd('0x6')](e,emitEvent(event));}}module['exports']=ChatInternalMessageEvents; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.model.js b/server/api/chatInternalMessage/chatInternalMessage.model.js index 350bfdb..f3c7d6c 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 _0x9797=['bluebird','request-promise','path','rimraf','../../config/environment','./chatInternalMessage.attributes','exports','define','ChatInternalMessage','chat_internal_messages','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment'];(function(_0x38acab,_0x5db216){var _0x560db8=function(_0x4e3d19){while(--_0x4e3d19){_0x38acab['push'](_0x38acab['shift']());}};_0x560db8(++_0x5db216);}(_0x9797,0xdc));var _0x7979=function(_0x583e98,_0x5534f5){_0x583e98=_0x583e98-0x0;var _0x84cc30=_0x9797[_0x583e98];return _0x84cc30;};'use strict';var _=require(_0x7979('0x0'));var util=require(_0x7979('0x1'));var logger=require('../../config/logger')(_0x7979('0x2'));var moment=require(_0x7979('0x3'));var BPromise=require(_0x7979('0x4'));var rp=require(_0x7979('0x5'));var fs=require('fs');var path=require(_0x7979('0x6'));var rimraf=require(_0x7979('0x7'));var config=require(_0x7979('0x8'));var attributes=require(_0x7979('0x9'));module[_0x7979('0xa')]=function(_0x50c3bd,_0x41351f){return _0x50c3bd[_0x7979('0xb')](_0x7979('0xc'),attributes,{'tableName':_0x7979('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x7979('0xe'),'collate':_0x7979('0xf')});}; \ No newline at end of file +var _0x947e=['ChatInternalMessage','utf8mb4','utf8mb4_unicode_ci','util','api','moment','rimraf','../../config/environment','./chatInternalMessage.attributes','exports','define'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x947e,0x1a5));var _0xe947=function(_0x2e7153,_0x2b3dca){_0x2e7153=_0x2e7153-0x0;var _0xbd2fdd=_0x947e[_0x2e7153];return _0xbd2fdd;};'use strict';var _=require('lodash');var util=require(_0xe947('0x0'));var logger=require('../../config/logger')(_0xe947('0x1'));var moment=require(_0xe947('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xe947('0x3'));var config=require(_0xe947('0x4'));var attributes=require(_0xe947('0x5'));module[_0xe947('0x6')]=function(_0x193497,_0x5919c7){return _0x193497[_0xe947('0x7')](_0xe947('0x8'),attributes,{'tableName':'chat_internal_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xe947('0x9'),'collate':_0xe947('0xa')});}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.rpc.js b/server/api/chatInternalMessage/chatInternalMessage.rpc.js index 46eac2d..0723662 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 _0x4390=['error','message','result','catch','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','redis','defaults','socket.io-emitter','./chatInternalMessage.socket','request','then','info','ChatInternalMessage,\x20%s,\x20%s','ChatInternalMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x1b63f1,_0x2fd7e0){var _0x189093=function(_0x8ec513){while(--_0x8ec513){_0x1b63f1['push'](_0x1b63f1['shift']());}};_0x189093(++_0x2fd7e0);}(_0x4390,0x64));var _0x0439=function(_0x3c8df6,_0x3067a3){_0x3c8df6=_0x3c8df6-0x0;var _0xa73cd6=_0x4390[_0x3c8df6];return _0xa73cd6;};'use strict';var _=require('lodash');var util=require(_0x0439('0x0'));var moment=require(_0x0439('0x1'));var BPromise=require(_0x0439('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0439('0x3'))['db'];var utils=require(_0x0439('0x4'));var logger=require(_0x0439('0x5'))(_0x0439('0x6'));var config=require(_0x0439('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x0439('0x8')]['http']({'port':0x232a});config[_0x0439('0x9')]=_[_0x0439('0xa')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x0439('0xb'))(new Redis(config[_0x0439('0x9')]));require(_0x0439('0xc'))['register'](socket);function respondWithRpcPromise(_0x56a29f,_0x202236,_0x344108){return new BPromise(function(_0x3a0262,_0x15f886){return client[_0x0439('0xd')](_0x56a29f,_0x344108)[_0x0439('0xe')](function(_0xc26b84){logger[_0x0439('0xf')](_0x0439('0x10'),_0x202236,'request\x20sent');logger['debug'](_0x0439('0x11'),_0x202236,_0x0439('0x12'),JSON[_0x0439('0x13')](_0xc26b84));if(_0xc26b84[_0x0439('0x14')]){if(_0xc26b84[_0x0439('0x14')]['code']===0x1f4){logger[_0x0439('0x14')](_0x0439('0x10'),_0x202236,_0xc26b84[_0x0439('0x14')]['message']);return _0x15f886(_0xc26b84[_0x0439('0x14')][_0x0439('0x15')]);}logger[_0x0439('0x14')]('ChatInternalMessage,\x20%s,\x20%s',_0x202236,_0xc26b84[_0x0439('0x14')]['message']);return _0x3a0262(_0xc26b84[_0x0439('0x14')]['message']);}else{logger[_0x0439('0xf')]('ChatInternalMessage,\x20%s,\x20%s',_0x202236,_0x0439('0x12'));_0x3a0262(_0xc26b84[_0x0439('0x16')][_0x0439('0x15')]);}})[_0x0439('0x17')](function(_0x40d337){logger[_0x0439('0x14')]('ChatInternalMessage,\x20%s,\x20%s',_0x202236,_0x40d337);_0x15f886(_0x40d337);});});} \ No newline at end of file +var _0x87cb=['result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./chatInternalMessage.socket','request','then','info','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','ChatInternalMessage,\x20%s,\x20%s','message'];(function(_0x1b8880,_0x382d59){var _0x144525=function(_0x207621){while(--_0x207621){_0x1b8880['push'](_0x1b8880['shift']());}};_0x144525(++_0x382d59);}(_0x87cb,0xaa));var _0xb87c=function(_0x4a53d,_0x58a95e){_0x4a53d=_0x4a53d-0x0;var _0x27410e=_0x87cb[_0x4a53d];return _0x27410e;};'use strict';var _=require(_0xb87c('0x0'));var util=require(_0xb87c('0x1'));var moment=require(_0xb87c('0x2'));var BPromise=require(_0xb87c('0x3'));var rs=require(_0xb87c('0x4'));var fs=require('fs');var Redis=require(_0xb87c('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xb87c('0x6'))(_0xb87c('0x7'));var config=require(_0xb87c('0x8'));var jayson=require(_0xb87c('0x9'));var client=jayson[_0xb87c('0xa')][_0xb87c('0xb')]({'port':0x232a});config['redis']=_['defaults'](config[_0xb87c('0xc')],{'host':_0xb87c('0xd'),'port':0x18eb});var socket=require(_0xb87c('0xe'))(new Redis(config[_0xb87c('0xc')]));require(_0xb87c('0xf'))['register'](socket);function respondWithRpcPromise(_0x10517c,_0x484d49,_0x260a20){return new BPromise(function(_0x5229a4,_0x37b8e7){return client[_0xb87c('0x10')](_0x10517c,_0x260a20)[_0xb87c('0x11')](function(_0xa4095f){logger[_0xb87c('0x12')]('ChatInternalMessage,\x20%s,\x20%s',_0x484d49,'request\x20sent');logger[_0xb87c('0x13')](_0xb87c('0x14'),_0x484d49,_0xb87c('0x15'),JSON['stringify'](_0xa4095f));if(_0xa4095f[_0xb87c('0x16')]){if(_0xa4095f[_0xb87c('0x16')][_0xb87c('0x17')]===0x1f4){logger[_0xb87c('0x16')](_0xb87c('0x18'),_0x484d49,_0xa4095f[_0xb87c('0x16')][_0xb87c('0x19')]);return _0x37b8e7(_0xa4095f[_0xb87c('0x16')][_0xb87c('0x19')]);}logger['error'](_0xb87c('0x18'),_0x484d49,_0xa4095f[_0xb87c('0x16')][_0xb87c('0x19')]);return _0x5229a4(_0xa4095f[_0xb87c('0x16')]['message']);}else{logger[_0xb87c('0x12')]('ChatInternalMessage,\x20%s,\x20%s',_0x484d49,'request\x20sent');_0x5229a4(_0xa4095f[_0xb87c('0x1a')][_0xb87c('0x19')]);}})[_0xb87c('0x1b')](function(_0x581c9e){logger['error']('ChatInternalMessage,\x20%s,\x20%s',_0x484d49,_0x581c9e);_0x37b8e7(_0x581c9e);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index 4bf5004..274c1a8 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 _0xec3b=['./chatInternalMessage.events','save','update','removeListener'];(function(_0x3a4574,_0x585526){var _0x13352a=function(_0x398863){while(--_0x398863){_0x3a4574['push'](_0x3a4574['shift']());}};_0x13352a(++_0x585526);}(_0xec3b,0x1f0));var _0xbec3=function(_0x4902e8,_0x1ca53e){_0x4902e8=_0x4902e8-0x0;var _0x4c31fe=_0xec3b[_0x4902e8];return _0x4c31fe;};'use strict';var ChatInternalMessageEvents=require(_0xbec3('0x0'));var events=[_0xbec3('0x1'),'remove',_0xbec3('0x2')];function createListener(_0x4499bb,_0x5758b2){return function(_0x4e3037){_0x5758b2['emit'](_0x4499bb,_0x4e3037);};}function removeListener(_0x285e99,_0x24c42f){return function(){ChatInternalMessageEvents[_0xbec3('0x3')](_0x285e99,_0x24c42f);};}exports['register']=function(_0x5d4141){for(var _0x1c8be2=0x0,_0x34dfa4=events['length'];_0x1c8be2<_0x34dfa4;_0x1c8be2++){var _0xd2d6ff=events[_0x1c8be2];var _0x19229d=createListener('chatInternalMessage:'+_0xd2d6ff,_0x5d4141);ChatInternalMessageEvents['on'](_0xd2d6ff,_0x19229d);}}; \ No newline at end of file +var _0xd403=['update','emit','removeListener','register','length','chatInternalMessage:','./chatInternalMessage.events','save'];(function(_0x2224f0,_0x5a3253){var _0x4c2aac=function(_0xe32873){while(--_0xe32873){_0x2224f0['push'](_0x2224f0['shift']());}};_0x4c2aac(++_0x5a3253);}(_0xd403,0xbe));var _0x3d40=function(_0x525c7b,_0x488fcc){_0x525c7b=_0x525c7b-0x0;var _0x27b33e=_0xd403[_0x525c7b];return _0x27b33e;};'use strict';var ChatInternalMessageEvents=require(_0x3d40('0x0'));var events=[_0x3d40('0x1'),'remove',_0x3d40('0x2')];function createListener(_0xe152d6,_0x5dc3d1){return function(_0x362ea3){_0x5dc3d1[_0x3d40('0x3')](_0xe152d6,_0x362ea3);};}function removeListener(_0x2b3dc9,_0x1272ca){return function(){ChatInternalMessageEvents[_0x3d40('0x4')](_0x2b3dc9,_0x1272ca);};}exports[_0x3d40('0x5')]=function(_0x40fe68){for(var _0x29b4c8=0x0,_0x524034=events[_0x3d40('0x6')];_0x29b4c8<_0x524034;_0x29b4c8++){var _0x2f6f52=events[_0x29b4c8];var _0x3da2d3=createListener(_0x3d40('0x7')+_0x2f6f52,_0x40fe68);ChatInternalMessageEvents['on'](_0x2f6f52,_0x3da2d3);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index cafe564..953fc95 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 _0x0422=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','./chatInternalMessage.controller','get','/describe','isAuthenticated','describe','/:id','show','post','create','put','update','delete','exports','multer','util','path','connect-timeout','express'];(function(_0x2df0f0,_0x121f5d){var _0x863c9f=function(_0x245745){while(--_0x245745){_0x2df0f0['push'](_0x2df0f0['shift']());}};_0x863c9f(++_0x121f5d);}(_0x0422,0x1b3));var _0x2042=function(_0x40a825,_0x3bac79){_0x40a825=_0x40a825-0x0;var _0x273a54=_0x0422[_0x40a825];return _0x273a54;};'use strict';var multer=require(_0x2042('0x0'));var util=require(_0x2042('0x1'));var path=require(_0x2042('0x2'));var timeout=require(_0x2042('0x3'));var express=require(_0x2042('0x4'));var router=express[_0x2042('0x5')]();var fs_extra=require(_0x2042('0x6'));var auth=require(_0x2042('0x7'));var interaction=require(_0x2042('0x8'));var config=require('../../config/environment');var controller=require(_0x2042('0x9'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x2042('0xa')](_0x2042('0xb'),auth[_0x2042('0xc')](),controller[_0x2042('0xd')]);router['get']('/users',auth[_0x2042('0xc')](),controller['getUsers']);router[_0x2042('0xa')](_0x2042('0xe'),auth[_0x2042('0xc')](),controller[_0x2042('0xf')]);router[_0x2042('0x10')]('/',auth[_0x2042('0xc')](),controller[_0x2042('0x11')]);router[_0x2042('0x12')]('/:id',controller[_0x2042('0x13')]);router[_0x2042('0x14')](_0x2042('0xe'),auth[_0x2042('0xc')](),controller['destroy']);module[_0x2042('0x15')]=router; \ No newline at end of file +var _0x3af7=['path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInternalMessage.controller','get','isAuthenticated','index','describe','getUsers','/:id','show','post','create','put','delete','destroy','util'];(function(_0x3c3cf3,_0x3e1092){var _0xcd152b=function(_0x49600f){while(--_0x49600f){_0x3c3cf3['push'](_0x3c3cf3['shift']());}};_0xcd152b(++_0x3e1092);}(_0x3af7,0x1cd));var _0x73af=function(_0x147ece,_0x12c09c){_0x147ece=_0x147ece-0x0;var _0x2d0bcb=_0x3af7[_0x147ece];return _0x2d0bcb;};'use strict';var multer=require('multer');var util=require(_0x73af('0x0'));var path=require(_0x73af('0x1'));var timeout=require(_0x73af('0x2'));var express=require(_0x73af('0x3'));var router=express[_0x73af('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x73af('0x5'));var interaction=require(_0x73af('0x6'));var config=require(_0x73af('0x7'));var controller=require(_0x73af('0x8'));router[_0x73af('0x9')]('/',auth[_0x73af('0xa')](),controller[_0x73af('0xb')]);router[_0x73af('0x9')]('/describe',auth[_0x73af('0xa')](),controller[_0x73af('0xc')]);router[_0x73af('0x9')]('/users',auth['isAuthenticated'](),controller[_0x73af('0xd')]);router[_0x73af('0x9')](_0x73af('0xe'),auth['isAuthenticated'](),controller[_0x73af('0xf')]);router[_0x73af('0x10')]('/',auth[_0x73af('0xa')](),controller[_0x73af('0x11')]);router[_0x73af('0x12')](_0x73af('0xe'),controller['update']);router[_0x73af('0x13')](_0x73af('0xe'),auth[_0x73af('0xa')](),controller[_0x73af('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.attributes.js b/server/api/chatMessage/chatMessage.attributes.js index 1eb5f78..738c7a8 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 _0x9158=['DATE','STRING','sequelize','exports','TEXT','BOOLEAN','ENUM'];(function(_0x2eb5bc,_0x4634c6){var _0x51c7b1=function(_0x1af430){while(--_0x1af430){_0x2eb5bc['push'](_0x2eb5bc['shift']());}};_0x51c7b1(++_0x4634c6);}(_0x9158,0x16e));var _0x8915=function(_0x396680,_0x5ac1e5){_0x396680=_0x396680-0x0;var _0x112aae=_0x9158[_0x396680];return _0x112aae;};'use strict';var Sequelize=require(_0x8915('0x0'));module[_0x8915('0x1')]={'body':{'type':Sequelize[_0x8915('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x8915('0x3')],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x8915('0x4')]('in','out'),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize[_0x8915('0x5')]},'providerName':{'type':Sequelize[_0x8915('0x6')]},'providerResponse':{'type':Sequelize[_0x8915('0x2')]}}; \ No newline at end of file +var _0xc06d=['BOOLEAN','ENUM','DATE','sequelize','exports','TEXT','medium'];(function(_0x599f41,_0x4db732){var _0x2e4d58=function(_0x14c882){while(--_0x14c882){_0x599f41['push'](_0x599f41['shift']());}};_0x2e4d58(++_0x4db732);}(_0xc06d,0x15a));var _0xdc06=function(_0x175b18,_0x4cc1f3){_0x175b18=_0x175b18-0x0;var _0x1e0702=_0xc06d[_0x175b18];return _0x1e0702;};'use strict';var Sequelize=require(_0xdc06('0x0'));module[_0xdc06('0x1')]={'body':{'type':Sequelize[_0xdc06('0x2')](_0xdc06('0x3')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize[_0xdc06('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0xdc06('0x5')]('in','out'),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize[_0xdc06('0x6')]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0xdc06('0x2')]}}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.controller.js b/server/api/chatMessage/chatMessage.controller.js index 392e701..64cf235 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 _0x8c56=['bluebird','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatMessage.socket','register','jayson/promise','client','http','request','then','info','request\x20sent','stringify','error','code','message','ChatMessage,\x20%s,\x20%s','catch','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','destroy','name','send','ChatMessage','rawAttributes','type','key','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','merge','VIRTUAL','options','include','findAll','rows','show','params','includeAll','find','create','body','update','accept','chat','read','format','UserId','agent','get','ChatInteractionId','isNil','read1stAt','YYYY-MM-DD\x20HH:mm:ss','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','interaction','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','fullname','email','internal','interface','SIP/%s','channel','motionChannel','event','parse','formData','chat-interactions','ChatInteraction','RejectMessage','EventManager','rejectmessage','eml-format','zip-dir','fast-json-patch','request-promise','moment'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x8c56,0x7b));var _0x68c5=function(_0x39d90f,_0xee44f){_0x39d90f=_0x39d90f-0x0;var _0x4d5c2c=_0x8c56[_0x39d90f];return _0x4d5c2c;};'use strict';var emlformat=require(_0x68c5('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x68c5('0x1'));var jsonpatch=require(_0x68c5('0x2'));var rp=require(_0x68c5('0x3'));var moment=require(_0x68c5('0x4'));var BPromise=require(_0x68c5('0x5'));var Mustache=require('mustache');var util=require(_0x68c5('0x6'));var path=require(_0x68c5('0x7'));var sox=require('sox');var csv=require(_0x68c5('0x8'));var ejs=require(_0x68c5('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x68c5('0xa'));var squel=require(_0x68c5('0xb'));var crypto=require(_0x68c5('0xc'));var jsforce=require(_0x68c5('0xd'));var deskjs=require(_0x68c5('0xe'));var toCsv=require(_0x68c5('0x8'));var querystring=require(_0x68c5('0xf'));var Papa=require(_0x68c5('0x10'));var Redis=require('ioredis');var authService=require(_0x68c5('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x68c5('0x12'))(_0x68c5('0x13'));var utils=require(_0x68c5('0x14'));var config=require(_0x68c5('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x68c5('0x16'))['db'];config[_0x68c5('0x17')]=_[_0x68c5('0x18')](config[_0x68c5('0x17')],{'host':_0x68c5('0x19'),'port':0x18eb});var socket=require(_0x68c5('0x1a'))(new Redis(config[_0x68c5('0x17')]));require(_0x68c5('0x1b'))[_0x68c5('0x1c')](socket);var jayson=require(_0x68c5('0x1d'));var client=jayson[_0x68c5('0x1e')]['http']({'port':0x232c});var client9002=jayson[_0x68c5('0x1e')][_0x68c5('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x1327e9,_0x1d168d,_0x414007,_0x1ed71a){return new BPromise(function(_0x5ec727,_0x494fc1){var _0x56f96a=_0x1ed71a||client;return _0x56f96a[_0x68c5('0x20')](_0x1327e9,_0x414007)[_0x68c5('0x21')](function(_0x498812){logger[_0x68c5('0x22')]('ChatMessage,\x20%s,\x20%s',_0x1d168d,_0x68c5('0x23'));logger['debug']('ChatMessage,\x20%s,\x20%s,\x20%s',_0x1d168d,'request\x20sent',JSON[_0x68c5('0x24')](_0x498812));if(_0x498812[_0x68c5('0x25')]){if(_0x498812[_0x68c5('0x25')][_0x68c5('0x26')]===0x1f4){logger[_0x68c5('0x25')]('ChatMessage,\x20%s,\x20%s',_0x1d168d,_0x498812[_0x68c5('0x25')][_0x68c5('0x27')]);return _0x494fc1(_0x498812[_0x68c5('0x25')][_0x68c5('0x27')]);}logger[_0x68c5('0x25')]('ChatMessage,\x20%s,\x20%s',_0x1d168d,_0x498812[_0x68c5('0x25')][_0x68c5('0x27')]);return _0x5ec727(_0x498812['error'][_0x68c5('0x27')]);}else{logger[_0x68c5('0x22')](_0x68c5('0x28'),_0x1d168d,_0x68c5('0x23'));_0x5ec727(_0x498812['result'][_0x68c5('0x27')]);}})[_0x68c5('0x29')](function(_0x4153e4){logger[_0x68c5('0x25')](_0x68c5('0x28'),_0x1d168d,_0x4153e4);_0x494fc1(_0x4153e4);});});}function respondWithStatusCode(_0x132771,_0x282000){_0x282000=_0x282000||0xcc;return function(_0x55d832){if(_0x55d832){return _0x132771[_0x68c5('0x2a')](_0x282000);}return _0x132771['status'](_0x282000)[_0x68c5('0x2b')]();};}function respondWithResult(_0x218776,_0x2f6c54){_0x2f6c54=_0x2f6c54||0xc8;return function(_0x42bc6b){if(_0x42bc6b){return _0x218776[_0x68c5('0x2c')](_0x2f6c54)[_0x68c5('0x2d')](_0x42bc6b);}};}function respondWithFilteredResult(_0x359a23,_0x20229d){return function(_0x8d243e){if(_0x8d243e){var _0x1f155c=typeof _0x20229d[_0x68c5('0x2e')]===_0x68c5('0x2f')&&typeof _0x20229d[_0x68c5('0x30')]==='undefined';var _0x2ee639=_0x8d243e[_0x68c5('0x31')];var _0x251b26=_0x1f155c?0x0:_0x20229d[_0x68c5('0x2e')];var _0x58e770=_0x1f155c?_0x8d243e['count']:_0x20229d['offset']+_0x20229d[_0x68c5('0x30')];var _0x57ef7f;if(_0x58e770>=_0x2ee639){_0x58e770=_0x2ee639;_0x57ef7f=0xc8;}else{_0x57ef7f=0xce;}_0x359a23[_0x68c5('0x2c')](_0x57ef7f);return _0x359a23[_0x68c5('0x32')](_0x68c5('0x33'),_0x251b26+'-'+_0x58e770+'/'+_0x2ee639)[_0x68c5('0x2d')](_0x8d243e);}return null;};}function patchUpdates(_0x2b5675){return function(_0x519dcd){try{jsonpatch[_0x68c5('0x34')](_0x519dcd,_0x2b5675,!![]);}catch(_0x5b3f19){return BPromise[_0x68c5('0x35')](_0x5b3f19);}return _0x519dcd[_0x68c5('0x36')]();};}function saveUpdates(_0x4b9804,_0x331d0d){return function(_0x2012cb){if(_0x2012cb){return _0x2012cb['update'](_0x4b9804)[_0x68c5('0x21')](function(_0x462019){return _0x462019;});}return null;};}function removeEntity(_0x1022f5,_0x3f2e89){return function(_0x18aaad){if(_0x18aaad){return _0x18aaad[_0x68c5('0x37')]()[_0x68c5('0x21')](function(){_0x1022f5[_0x68c5('0x2c')](0xcc)[_0x68c5('0x2b')]();});}};}function handleEntityNotFound(_0x4362a8,_0x11fe46){return function(_0x449f91){if(!_0x449f91){_0x4362a8[_0x68c5('0x2a')](0x194);}return _0x449f91;};}function handleError(_0x3da050,_0xc0037b){_0xc0037b=_0xc0037b||0x1f4;return function(_0x3fb261){logger[_0x68c5('0x25')](_0x3fb261['stack']);if(_0x3fb261['name']){delete _0x3fb261[_0x68c5('0x38')];}_0x3da050[_0x68c5('0x2c')](_0xc0037b)[_0x68c5('0x39')](_0x3fb261);};}exports['index']=function(_0x285ee8,_0x20e90e){var _0x57dcb7={},_0xb29df7={},_0x261cb8={'count':0x0,'rows':[]};var _0x13f4ba=_['map'](db[_0x68c5('0x3a')][_0x68c5('0x3b')],function(_0x2f3680){return{'name':_0x2f3680['fieldName'],'type':_0x2f3680[_0x68c5('0x3c')][_0x68c5('0x3d')]};});_0xb29df7[_0x68c5('0x3e')]=_[_0x68c5('0x3f')](_0x13f4ba,_0x68c5('0x38'));_0xb29df7[_0x68c5('0x40')]=_[_0x68c5('0x41')](_0x285ee8[_0x68c5('0x40')]);_0xb29df7[_0x68c5('0x42')]=_[_0x68c5('0x43')](_0xb29df7[_0x68c5('0x3e')],_0xb29df7['query']);_0x57dcb7[_0x68c5('0x44')]=_[_0x68c5('0x43')](_0xb29df7[_0x68c5('0x3e')],qs['fields'](_0x285ee8[_0x68c5('0x40')][_0x68c5('0x45')]));_0x57dcb7[_0x68c5('0x44')]=_0x57dcb7['attributes']['length']?_0x57dcb7[_0x68c5('0x44')]:_0xb29df7[_0x68c5('0x3e')];if(!_0x285ee8[_0x68c5('0x40')][_0x68c5('0x46')](_0x68c5('0x47'))){_0x57dcb7[_0x68c5('0x30')]=qs['limit'](_0x285ee8[_0x68c5('0x40')][_0x68c5('0x30')]);_0x57dcb7[_0x68c5('0x2e')]=qs[_0x68c5('0x2e')](_0x285ee8['query'][_0x68c5('0x2e')]);}_0x57dcb7[_0x68c5('0x48')]=qs[_0x68c5('0x49')](_0x285ee8[_0x68c5('0x40')][_0x68c5('0x49')]);_0x57dcb7['where']=qs['filters'](_['pick'](_0x285ee8[_0x68c5('0x40')],_0xb29df7['filters']),_0x13f4ba);if(_0x285ee8['query']['filter']){_0x57dcb7['where']=_[_0x68c5('0x4a')](_0x57dcb7['where'],{'$or':_[_0x68c5('0x3f')](_0x13f4ba,function(_0x5d418b){if(_0x5d418b[_0x68c5('0x3c')]!==_0x68c5('0x4b')){var _0x38c899={};_0x38c899[_0x5d418b[_0x68c5('0x38')]]={'$like':'%'+_0x285ee8[_0x68c5('0x40')]['filter']+'%'};return _0x38c899;}})});}_0x57dcb7=_[_0x68c5('0x4a')]({},_0x57dcb7,_0x285ee8[_0x68c5('0x4c')]);var _0x2354da={'where':_0x57dcb7['where']};return db['ChatMessage'][_0x68c5('0x31')](_0x2354da)['then'](function(_0x1351c5){_0x261cb8[_0x68c5('0x31')]=_0x1351c5;if(_0x285ee8[_0x68c5('0x40')]['includeAll']){_0x57dcb7[_0x68c5('0x4d')]=[{'all':!![]}];}return db[_0x68c5('0x3a')][_0x68c5('0x4e')](_0x57dcb7);})['then'](function(_0x2da353){_0x261cb8[_0x68c5('0x4f')]=_0x2da353;return _0x261cb8;})[_0x68c5('0x21')](respondWithFilteredResult(_0x20e90e,_0x57dcb7))['catch'](handleError(_0x20e90e,null));};exports[_0x68c5('0x50')]=function(_0x33f6d8,_0x522a2e){var _0xc827e7={'raw':!![],'where':{'id':_0x33f6d8[_0x68c5('0x51')]['id']}},_0x45e64d={};_0x45e64d[_0x68c5('0x3e')]=_[_0x68c5('0x41')](db[_0x68c5('0x3a')][_0x68c5('0x3b')]);_0x45e64d[_0x68c5('0x40')]=_[_0x68c5('0x41')](_0x33f6d8['query']);_0x45e64d['filters']=_[_0x68c5('0x43')](_0x45e64d['model'],_0x45e64d['query']);_0xc827e7[_0x68c5('0x44')]=_[_0x68c5('0x43')](_0x45e64d[_0x68c5('0x3e')],qs['fields'](_0x33f6d8[_0x68c5('0x40')][_0x68c5('0x45')]));_0xc827e7[_0x68c5('0x44')]=_0xc827e7[_0x68c5('0x44')]['length']?_0xc827e7[_0x68c5('0x44')]:_0x45e64d['model'];if(_0x33f6d8[_0x68c5('0x40')][_0x68c5('0x52')]){_0xc827e7[_0x68c5('0x4d')]=[{'all':!![]}];}_0xc827e7=_[_0x68c5('0x4a')]({},_0xc827e7,_0x33f6d8['options']);return db[_0x68c5('0x3a')][_0x68c5('0x53')](_0xc827e7)[_0x68c5('0x21')](handleEntityNotFound(_0x522a2e,null))[_0x68c5('0x21')](respondWithResult(_0x522a2e,null))[_0x68c5('0x29')](handleError(_0x522a2e,null));};exports[_0x68c5('0x54')]=function(_0x79212b,_0x4a962d){return db['ChatMessage']['create'](_0x79212b[_0x68c5('0x55')],{})[_0x68c5('0x21')](respondWithResult(_0x4a962d,0xc9))[_0x68c5('0x29')](handleError(_0x4a962d,null));};exports[_0x68c5('0x56')]=function(_0x5dd14a,_0x4e953a){if(_0x5dd14a['body']['id']){delete _0x5dd14a['body']['id'];}return db[_0x68c5('0x3a')][_0x68c5('0x53')]({'where':{'id':_0x5dd14a[_0x68c5('0x51')]['id']}})['then'](handleEntityNotFound(_0x4e953a,null))[_0x68c5('0x21')](saveUpdates(_0x5dd14a[_0x68c5('0x55')],null))[_0x68c5('0x21')](respondWithResult(_0x4e953a,null))[_0x68c5('0x29')](handleError(_0x4e953a,null));};exports[_0x68c5('0x37')]=function(_0x122ad3,_0x5805e4){return db[_0x68c5('0x3a')][_0x68c5('0x53')]({'where':{'id':_0x122ad3[_0x68c5('0x51')]['id']}})['then'](handleEntityNotFound(_0x5805e4,null))[_0x68c5('0x21')](removeEntity(_0x5805e4,null))[_0x68c5('0x29')](handleError(_0x5805e4,null));};exports['describe']=function(_0x4a21f5,_0x3aa43d){return db[_0x68c5('0x3a')]['describe']()[_0x68c5('0x21')](respondWithResult(_0x3aa43d,null))[_0x68c5('0x29')](handleError(_0x3aa43d,null));};var interaction_log=require(_0x68c5('0x12'))('chat-interactions');exports[_0x68c5('0x57')]=function(_0x1bd9f,_0x3c4284,_0x471320){var _0x423cac={'agent':{},'channel':_0x68c5('0x58')};if(_0x1bd9f[_0x68c5('0x55')]['id']){delete _0x1bd9f['body']['id'];}_0x1bd9f[_0x68c5('0x55')][_0x68c5('0x59')]=!![];_0x1bd9f[_0x68c5('0x55')]['readAt']=moment()[_0x68c5('0x5a')]('YYYY-MM-DD\x20HH:mm:ss');_0x1bd9f[_0x68c5('0x55')]['UserId']=_0x1bd9f[_0x68c5('0x55')][_0x68c5('0x5b')]||_0x1bd9f['user']['id'];_0x423cac[_0x68c5('0x5c')]['id']=_0x1bd9f['body'][_0x68c5('0x5b')];return db[_0x68c5('0x3a')][_0x68c5('0x53')]({'where':{'id':_0x1bd9f[_0x68c5('0x51')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x3c4284,null))[_0x68c5('0x21')](saveUpdates(_0x1bd9f[_0x68c5('0x55')],null))[_0x68c5('0x21')](function(_0xb61f2b){if(_0xb61f2b){_0x423cac['message']=_0xb61f2b[_0x68c5('0x5d')]({'plain':!![]});return db['ChatInteraction']['find']({'where':{'id':_0xb61f2b[_0x68c5('0x5e')]}});}return null;})[_0x68c5('0x21')](handleEntityNotFound(_0x3c4284,null))['then'](function(_0x3beed7){if(_0x3beed7){return _0x3beed7[_0x68c5('0x56')]({'UserId':_0x1bd9f[_0x68c5('0x55')][_0x68c5('0x5b')],'read1stAt':_[_0x68c5('0x5f')](_0x3beed7[_0x68c5('0x60')])?moment()['format'](_0x68c5('0x61')):undefined});}return null;})[_0x68c5('0x21')](function(_0x286190){if(_0x286190){_0x423cac['interaction']=_0x286190[_0x68c5('0x5d')]({'plain':!![]});interaction_log[_0x68c5('0x22')](_0x68c5('0x62'),_0x1bd9f[_0x68c5('0x63')]['id'],_0x1bd9f[_0x68c5('0x63')][_0x68c5('0x38')],_0x1bd9f[_0x68c5('0x63')][_0x68c5('0x64')],_0x423cac[_0x68c5('0x65')]['id'],_0x1bd9f['body']?JSON[_0x68c5('0x24')](_0x1bd9f[_0x68c5('0x55')]):_0x68c5('0x66'));return respondWithRpcPromise(_0x68c5('0x67'),_0x68c5('0x68'),_0x423cac);}return null;})[_0x68c5('0x21')](function(_0x6bd594){var _0x529148=_0x68c5('0x69')+_0x6bd594[_0x68c5('0x27')][_0x68c5('0x6a')];return db[_0x68c5('0x6b')][_0x68c5('0x40')](_0x529148,{'type':db[_0x68c5('0x6c')][_0x68c5('0x6d')][_0x68c5('0x6e')],'raw':!![]})[_0x68c5('0x21')](function(_0x33a06c){return _0x33a06c;});})[_0x68c5('0x21')](function(_0x4bd448){if(_0x4bd448){_0x423cac[_0x68c5('0x27')][_0x68c5('0x6f')]=_0x4bd448[0x0];if(!_0x1bd9f[_0x68c5('0x55')][_0x68c5('0x5b')])return;return db[_0x68c5('0x70')][_0x68c5('0x53')]({'where':{'id':_0x1bd9f['body'][_0x68c5('0x5b')],'role':_0x68c5('0x5c')},'attributes':['id',_0x68c5('0x38'),_0x68c5('0x71'),_0x68c5('0x72'),_0x68c5('0x73')],'raw':!![]});}return null;})[_0x68c5('0x21')](function(_0x569bf8){if(!_0x569bf8)return null;_0x423cac[_0x68c5('0x27')]['agent']=_0x569bf8;return _0x423cac;})[_0x68c5('0x21')](function(_0xa2fa22){if(_0xa2fa22){if(_0x1bd9f[_0x68c5('0x55')]['manual']){_0x423cac[_0x68c5('0x27')][_0x68c5('0x74')]=util[_0x68c5('0x5a')](_0x68c5('0x75'),_0x1bd9f[_0x68c5('0x63')][_0x68c5('0x38')]);_0x423cac[_0x68c5('0x27')][_0x68c5('0x76')]=_0x423cac[_0x68c5('0x76')];_0x423cac[_0x68c5('0x27')][_0x68c5('0x77')]=_0x423cac[_0x68c5('0x76')];_0x423cac['message'][_0x68c5('0x78')]='accept';return respondWithRpcPromise('EventManager','EventManager',{'event':'acceptmessage','message':_[_0x68c5('0x4a')](_0x423cac[_0x68c5('0x27')],JSON[_0x68c5('0x79')](_0x423cac[_0x68c5('0x65')][_0x68c5('0x7a')]))},client9002)[_0x68c5('0x21')](function(){return _0x423cac;});}return _0x423cac;}return null;})[_0x68c5('0x21')](respondWithResult(_0x3c4284,null))[_0x68c5('0x29')](handleError(_0x3c4284,null));};var interaction_log=require(_0x68c5('0x12'))(_0x68c5('0x7b'));exports[_0x68c5('0x35')]=function(_0xb6a0f9,_0x350841,_0x17aee8){var _0x35c4a8={'agent':{},'channel':_0x68c5('0x58')};if(_0xb6a0f9['body']['id']){delete _0xb6a0f9[_0x68c5('0x55')]['id'];}_0xb6a0f9[_0x68c5('0x55')][_0x68c5('0x5b')]=_0xb6a0f9['body'][_0x68c5('0x5b')]||_0xb6a0f9['user']['id'];_0x35c4a8[_0x68c5('0x5c')]['id']=_0xb6a0f9[_0x68c5('0x55')][_0x68c5('0x5b')];return db['ChatMessage']['find']({'where':{'id':_0xb6a0f9[_0x68c5('0x51')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x350841,null))['then'](function(_0x15d98c){if(_0x15d98c){_0x35c4a8[_0x68c5('0x27')]=_0x15d98c[_0x68c5('0x5d')]({'plain':!![]});return db[_0x68c5('0x7c')][_0x68c5('0x53')]({'where':{'id':_0x15d98c[_0x68c5('0x5e')]}});}return null;})['then'](handleEntityNotFound(_0x350841,null))['then'](function(_0xd1dc66){if(_0xd1dc66){_0x35c4a8['interaction']=_0xd1dc66[_0x68c5('0x5d')]({'plain':!![]});interaction_log[_0x68c5('0x22')]('[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0xb6a0f9[_0x68c5('0x63')]['id'],_0xb6a0f9[_0x68c5('0x63')]['name'],_0xb6a0f9[_0x68c5('0x63')][_0x68c5('0x64')],_0x35c4a8[_0x68c5('0x65')]['id'],_0xb6a0f9[_0x68c5('0x55')]?JSON[_0x68c5('0x24')](_0xb6a0f9[_0x68c5('0x55')]):'null');return respondWithRpcPromise(_0x68c5('0x7d'),'rejectMessage',_0x35c4a8);}return null;})[_0x68c5('0x21')](function(_0x1cf959){var _0x2a832d='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x1cf959['message'][_0x68c5('0x6a')];return db[_0x68c5('0x6b')][_0x68c5('0x40')](_0x2a832d,{'type':db['Sequelize']['QueryTypes']['SELECT'],'raw':!![]})[_0x68c5('0x21')](function(_0x48e00a){return _0x48e00a;});})[_0x68c5('0x21')](function(_0x41baba){if(_0x41baba){_0x35c4a8[_0x68c5('0x27')][_0x68c5('0x6f')]=_0x41baba[0x0];if(!_0xb6a0f9[_0x68c5('0x55')][_0x68c5('0x5b')])return;return db[_0x68c5('0x70')]['find']({'where':{'id':_0xb6a0f9[_0x68c5('0x55')][_0x68c5('0x5b')],'role':'agent'},'attributes':['id',_0x68c5('0x38'),_0x68c5('0x71'),'email',_0x68c5('0x73')],'raw':!![]});}return null;})[_0x68c5('0x21')](function(_0x1d5772){if(!_0x1d5772)return null;_0x35c4a8[_0x68c5('0x27')]['agent']=_0x1d5772;return _0x35c4a8;})['then'](function(_0xf61fba){if(_0xf61fba){_0xf61fba['message']['interface']=util[_0x68c5('0x5a')](_0x68c5('0x75'),_0xb6a0f9[_0x68c5('0x63')][_0x68c5('0x38')]);_0xf61fba[_0x68c5('0x27')]['channel']=_0x35c4a8[_0x68c5('0x76')];_0xf61fba[_0x68c5('0x27')][_0x68c5('0x77')]=_0x35c4a8[_0x68c5('0x76')];_0xf61fba['message'][_0x68c5('0x78')]='reject';respondWithRpcPromise(_0x68c5('0x7e'),_0x68c5('0x7e'),{'event':_0x68c5('0x7f'),'message':_[_0x68c5('0x4a')](_0x35c4a8[_0x68c5('0x27')],JSON['parse'](_0x35c4a8[_0x68c5('0x65')][_0x68c5('0x7a')]))},client9002);return _0x35c4a8;}return null;})[_0x68c5('0x21')](respondWithResult(_0x350841,null))['catch'](handleError(_0x350841,null));}; \ No newline at end of file +var _0x465f=['includeAll','include','findAll','show','params','create','body','find','describe','chat-interactions','accept','chat','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','ChatInteractionId','update','isNil','interaction','role','null','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','QueryTypes','contact','User','email','internal','manual','interface','SIP/%s','channel','event','EventManager','acceptmessage','parse','formData','ChatInteraction','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','sequelize','SELECT','fullname','motionChannel','rejectmessage','eml-format','rimraf','fast-json-patch','request-promise','bluebird','util','path','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','redis','defaults','localhost','socket.io-emitter','jayson/promise','client','http','then','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','sendStatus','status','json','offset','undefined','count','limit','Content-Range','apply','reject','save','stack','name','send','map','ChatMessage','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','VIRTUAL','merge','where'];(function(_0x2123d2,_0x2b4976){var _0x3c549e=function(_0x2a539a){while(--_0x2a539a){_0x2123d2['push'](_0x2123d2['shift']());}};_0x3c549e(++_0x2b4976);}(_0x465f,0x13f));var _0xf465=function(_0x10c3fc,_0x342c3e){_0x10c3fc=_0x10c3fc-0x0;var _0x3515bb=_0x465f[_0x10c3fc];return _0x3515bb;};'use strict';var emlformat=require(_0xf465('0x0'));var rimraf=require(_0xf465('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf465('0x2'));var rp=require(_0xf465('0x3'));var moment=require('moment');var BPromise=require(_0xf465('0x4'));var Mustache=require('mustache');var util=require(_0xf465('0x5'));var path=require(_0xf465('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xf465('0x7'));var fs=require('fs');var fs_extra=require(_0xf465('0x8'));var _=require(_0xf465('0x9'));var squel=require(_0xf465('0xa'));var crypto=require(_0xf465('0xb'));var jsforce=require(_0xf465('0xc'));var deskjs=require(_0xf465('0xd'));var toCsv=require(_0xf465('0xe'));var querystring=require(_0xf465('0xf'));var Papa=require(_0xf465('0x10'));var Redis=require(_0xf465('0x11'));var authService=require(_0xf465('0x12'));var qs=require(_0xf465('0x13'));var as=require(_0xf465('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf465('0x15'))(_0xf465('0x16'));var utils=require(_0xf465('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xf465('0x18'));var db=require('../../mysqldb')['db'];config[_0xf465('0x19')]=_[_0xf465('0x1a')](config[_0xf465('0x19')],{'host':_0xf465('0x1b'),'port':0x18eb});var socket=require(_0xf465('0x1c'))(new Redis(config['redis']));require('./chatMessage.socket')['register'](socket);var jayson=require(_0xf465('0x1d'));var client=jayson[_0xf465('0x1e')][_0xf465('0x1f')]({'port':0x232c});var client9002=jayson[_0xf465('0x1e')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4e2707,_0xe47e8c,_0x5af046,_0x4e9c0d){return new BPromise(function(_0x230307,_0x227e9c){var _0x457caa=_0x4e9c0d||client;return _0x457caa['request'](_0x4e2707,_0x5af046)[_0xf465('0x20')](function(_0x45a23d){logger['info'](_0xf465('0x21'),_0xe47e8c,_0xf465('0x22'));logger[_0xf465('0x23')](_0xf465('0x24'),_0xe47e8c,'request\x20sent',JSON[_0xf465('0x25')](_0x45a23d));if(_0x45a23d[_0xf465('0x26')]){if(_0x45a23d[_0xf465('0x26')][_0xf465('0x27')]===0x1f4){logger[_0xf465('0x26')](_0xf465('0x21'),_0xe47e8c,_0x45a23d[_0xf465('0x26')]['message']);return _0x227e9c(_0x45a23d[_0xf465('0x26')][_0xf465('0x28')]);}logger[_0xf465('0x26')](_0xf465('0x21'),_0xe47e8c,_0x45a23d[_0xf465('0x26')]['message']);return _0x230307(_0x45a23d[_0xf465('0x26')][_0xf465('0x28')]);}else{logger[_0xf465('0x29')](_0xf465('0x21'),_0xe47e8c,_0xf465('0x22'));_0x230307(_0x45a23d[_0xf465('0x2a')]['message']);}})[_0xf465('0x2b')](function(_0x2405af){logger['error'](_0xf465('0x21'),_0xe47e8c,_0x2405af);_0x227e9c(_0x2405af);});});}function respondWithStatusCode(_0x5c6d17,_0x41a83f){_0x41a83f=_0x41a83f||0xcc;return function(_0x2167ca){if(_0x2167ca){return _0x5c6d17[_0xf465('0x2c')](_0x41a83f);}return _0x5c6d17[_0xf465('0x2d')](_0x41a83f)['end']();};}function respondWithResult(_0x4f72b9,_0x725457){_0x725457=_0x725457||0xc8;return function(_0xb75797){if(_0xb75797){return _0x4f72b9[_0xf465('0x2d')](_0x725457)[_0xf465('0x2e')](_0xb75797);}};}function respondWithFilteredResult(_0x5b0b17,_0x408c8d){return function(_0x14c4ad){if(_0x14c4ad){var _0x5b3eab=typeof _0x408c8d[_0xf465('0x2f')]==='undefined'&&typeof _0x408c8d['limit']===_0xf465('0x30');var _0x3abff3=_0x14c4ad[_0xf465('0x31')];var _0x35bb23=_0x5b3eab?0x0:_0x408c8d[_0xf465('0x2f')];var _0x4ef699=_0x5b3eab?_0x14c4ad[_0xf465('0x31')]:_0x408c8d[_0xf465('0x2f')]+_0x408c8d[_0xf465('0x32')];var _0x132005;if(_0x4ef699>=_0x3abff3){_0x4ef699=_0x3abff3;_0x132005=0xc8;}else{_0x132005=0xce;}_0x5b0b17['status'](_0x132005);return _0x5b0b17['set'](_0xf465('0x33'),_0x35bb23+'-'+_0x4ef699+'/'+_0x3abff3)[_0xf465('0x2e')](_0x14c4ad);}return null;};}function patchUpdates(_0x4d243b){return function(_0x3798f7){try{jsonpatch[_0xf465('0x34')](_0x3798f7,_0x4d243b,!![]);}catch(_0x4724c1){return BPromise[_0xf465('0x35')](_0x4724c1);}return _0x3798f7[_0xf465('0x36')]();};}function saveUpdates(_0x25cb23,_0x1aa85d){return function(_0x563df1){if(_0x563df1){return _0x563df1['update'](_0x25cb23)[_0xf465('0x20')](function(_0x598c9b){return _0x598c9b;});}return null;};}function removeEntity(_0x2f71c2,_0x2e4ad9){return function(_0x18bb78){if(_0x18bb78){return _0x18bb78['destroy']()[_0xf465('0x20')](function(){_0x2f71c2[_0xf465('0x2d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4246ba,_0x14bf97){return function(_0x314a02){if(!_0x314a02){_0x4246ba[_0xf465('0x2c')](0x194);}return _0x314a02;};}function handleError(_0x373f15,_0x475325){_0x475325=_0x475325||0x1f4;return function(_0x25edee){logger[_0xf465('0x26')](_0x25edee[_0xf465('0x37')]);if(_0x25edee[_0xf465('0x38')]){delete _0x25edee[_0xf465('0x38')];}_0x373f15['status'](_0x475325)[_0xf465('0x39')](_0x25edee);};}exports['index']=function(_0x38565c,_0x13d981){var _0x461a0e={},_0x2f8ce9={},_0x33ab69={'count':0x0,'rows':[]};var _0x93267b=_[_0xf465('0x3a')](db[_0xf465('0x3b')][_0xf465('0x3c')],function(_0xaf4005){return{'name':_0xaf4005['fieldName'],'type':_0xaf4005[_0xf465('0x3d')][_0xf465('0x3e')]};});_0x2f8ce9[_0xf465('0x3f')]=_['map'](_0x93267b,_0xf465('0x38'));_0x2f8ce9[_0xf465('0x40')]=_[_0xf465('0x41')](_0x38565c[_0xf465('0x40')]);_0x2f8ce9[_0xf465('0x42')]=_[_0xf465('0x43')](_0x2f8ce9[_0xf465('0x3f')],_0x2f8ce9[_0xf465('0x40')]);_0x461a0e[_0xf465('0x44')]=_['intersection'](_0x2f8ce9['model'],qs['fields'](_0x38565c[_0xf465('0x40')][_0xf465('0x45')]));_0x461a0e[_0xf465('0x44')]=_0x461a0e['attributes'][_0xf465('0x46')]?_0x461a0e[_0xf465('0x44')]:_0x2f8ce9[_0xf465('0x3f')];if(!_0x38565c[_0xf465('0x40')][_0xf465('0x47')](_0xf465('0x48'))){_0x461a0e[_0xf465('0x32')]=qs['limit'](_0x38565c[_0xf465('0x40')][_0xf465('0x32')]);_0x461a0e['offset']=qs['offset'](_0x38565c[_0xf465('0x40')][_0xf465('0x2f')]);}_0x461a0e[_0xf465('0x49')]=qs[_0xf465('0x4a')](_0x38565c[_0xf465('0x40')][_0xf465('0x4a')]);_0x461a0e['where']=qs[_0xf465('0x42')](_[_0xf465('0x4b')](_0x38565c['query'],_0x2f8ce9[_0xf465('0x42')]),_0x93267b);if(_0x38565c[_0xf465('0x40')][_0xf465('0x4c')]){_0x461a0e['where']=_['merge'](_0x461a0e['where'],{'$or':_['map'](_0x93267b,function(_0x290408){if(_0x290408[_0xf465('0x3d')]!==_0xf465('0x4d')){var _0x1465af={};_0x1465af[_0x290408['name']]={'$like':'%'+_0x38565c[_0xf465('0x40')][_0xf465('0x4c')]+'%'};return _0x1465af;}})});}_0x461a0e=_[_0xf465('0x4e')]({},_0x461a0e,_0x38565c['options']);var _0xf4666={'where':_0x461a0e[_0xf465('0x4f')]};return db[_0xf465('0x3b')][_0xf465('0x31')](_0xf4666)['then'](function(_0x1e46d){_0x33ab69['count']=_0x1e46d;if(_0x38565c[_0xf465('0x40')][_0xf465('0x50')]){_0x461a0e[_0xf465('0x51')]=[{'all':!![]}];}return db[_0xf465('0x3b')][_0xf465('0x52')](_0x461a0e);})['then'](function(_0x48d31d){_0x33ab69['rows']=_0x48d31d;return _0x33ab69;})[_0xf465('0x20')](respondWithFilteredResult(_0x13d981,_0x461a0e))[_0xf465('0x2b')](handleError(_0x13d981,null));};exports[_0xf465('0x53')]=function(_0x522e4d,_0x34c92e){var _0x315ec8={'raw':!![],'where':{'id':_0x522e4d[_0xf465('0x54')]['id']}},_0xe465c6={};_0xe465c6['model']=_[_0xf465('0x41')](db[_0xf465('0x3b')][_0xf465('0x3c')]);_0xe465c6[_0xf465('0x40')]=_['keys'](_0x522e4d[_0xf465('0x40')]);_0xe465c6[_0xf465('0x42')]=_[_0xf465('0x43')](_0xe465c6[_0xf465('0x3f')],_0xe465c6[_0xf465('0x40')]);_0x315ec8['attributes']=_['intersection'](_0xe465c6[_0xf465('0x3f')],qs['fields'](_0x522e4d['query']['fields']));_0x315ec8[_0xf465('0x44')]=_0x315ec8['attributes']['length']?_0x315ec8[_0xf465('0x44')]:_0xe465c6[_0xf465('0x3f')];if(_0x522e4d['query'][_0xf465('0x50')]){_0x315ec8[_0xf465('0x51')]=[{'all':!![]}];}_0x315ec8=_[_0xf465('0x4e')]({},_0x315ec8,_0x522e4d['options']);return db[_0xf465('0x3b')]['find'](_0x315ec8)[_0xf465('0x20')](handleEntityNotFound(_0x34c92e,null))[_0xf465('0x20')](respondWithResult(_0x34c92e,null))[_0xf465('0x2b')](handleError(_0x34c92e,null));};exports[_0xf465('0x55')]=function(_0x18c0be,_0x1efa96){return db[_0xf465('0x3b')][_0xf465('0x55')](_0x18c0be[_0xf465('0x56')],{})['then'](respondWithResult(_0x1efa96,0xc9))['catch'](handleError(_0x1efa96,null));};exports['update']=function(_0x185de9,_0x41fab2){if(_0x185de9[_0xf465('0x56')]['id']){delete _0x185de9['body']['id'];}return db[_0xf465('0x3b')][_0xf465('0x57')]({'where':{'id':_0x185de9[_0xf465('0x54')]['id']}})['then'](handleEntityNotFound(_0x41fab2,null))[_0xf465('0x20')](saveUpdates(_0x185de9[_0xf465('0x56')],null))['then'](respondWithResult(_0x41fab2,null))[_0xf465('0x2b')](handleError(_0x41fab2,null));};exports['destroy']=function(_0x365a3d,_0x2e070a){return db[_0xf465('0x3b')][_0xf465('0x57')]({'where':{'id':_0x365a3d[_0xf465('0x54')]['id']}})['then'](handleEntityNotFound(_0x2e070a,null))['then'](removeEntity(_0x2e070a,null))[_0xf465('0x2b')](handleError(_0x2e070a,null));};exports[_0xf465('0x58')]=function(_0xddcbd1,_0xccb2c5){return db['ChatMessage'][_0xf465('0x58')]()[_0xf465('0x20')](respondWithResult(_0xccb2c5,null))[_0xf465('0x2b')](handleError(_0xccb2c5,null));};var interaction_log=require('../../config/logger')(_0xf465('0x59'));exports[_0xf465('0x5a')]=function(_0x341de5,_0x4c82d6,_0x43f0ed){var _0x2ebb70={'agent':{},'channel':_0xf465('0x5b')};if(_0x341de5[_0xf465('0x56')]['id']){delete _0x341de5[_0xf465('0x56')]['id'];}_0x341de5['body'][_0xf465('0x5c')]=!![];_0x341de5[_0xf465('0x56')][_0xf465('0x5d')]=moment()[_0xf465('0x5e')](_0xf465('0x5f'));_0x341de5['body']['UserId']=_0x341de5[_0xf465('0x56')][_0xf465('0x60')]||_0x341de5[_0xf465('0x61')]['id'];_0x2ebb70[_0xf465('0x62')]['id']=_0x341de5['body'][_0xf465('0x60')];return db['ChatMessage']['find']({'where':{'id':_0x341de5['params']['id'],'UserId':null}})[_0xf465('0x20')](handleEntityNotFound(_0x4c82d6,null))['then'](saveUpdates(_0x341de5['body'],null))[_0xf465('0x20')](function(_0x1e77dc){if(_0x1e77dc){_0x2ebb70[_0xf465('0x28')]=_0x1e77dc[_0xf465('0x63')]({'plain':!![]});return db['ChatInteraction'][_0xf465('0x57')]({'where':{'id':_0x1e77dc[_0xf465('0x64')]}});}return null;})[_0xf465('0x20')](handleEntityNotFound(_0x4c82d6,null))['then'](function(_0x31f526){if(_0x31f526){return _0x31f526[_0xf465('0x65')]({'UserId':_0x341de5[_0xf465('0x56')][_0xf465('0x60')],'read1stAt':_[_0xf465('0x66')](_0x31f526['read1stAt'])?moment()[_0xf465('0x5e')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0xf465('0x20')](function(_0x47b6c5){if(_0x47b6c5){_0x2ebb70[_0xf465('0x67')]=_0x47b6c5[_0xf465('0x63')]({'plain':!![]});interaction_log[_0xf465('0x29')]('[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x341de5[_0xf465('0x61')]['id'],_0x341de5['user'][_0xf465('0x38')],_0x341de5['user'][_0xf465('0x68')],_0x2ebb70[_0xf465('0x67')]['id'],_0x341de5['body']?JSON[_0xf465('0x25')](_0x341de5[_0xf465('0x56')]):_0xf465('0x69'));return respondWithRpcPromise(_0xf465('0x6a'),'acceptMessage',_0x2ebb70);}return null;})[_0xf465('0x20')](function(_0x4c9501){var _0x1aa3db=_0xf465('0x6b')+_0x4c9501[_0xf465('0x28')][_0xf465('0x6c')];return db['sequelize'][_0xf465('0x40')](_0x1aa3db,{'type':db[_0xf465('0x6d')][_0xf465('0x6e')]['SELECT'],'raw':!![]})[_0xf465('0x20')](function(_0x42363f){return _0x42363f;});})[_0xf465('0x20')](function(_0x15bcff){if(_0x15bcff){_0x2ebb70[_0xf465('0x28')][_0xf465('0x6f')]=_0x15bcff[0x0];if(!_0x341de5['body'][_0xf465('0x60')])return;return db[_0xf465('0x70')]['find']({'where':{'id':_0x341de5['body'][_0xf465('0x60')],'role':_0xf465('0x62')},'attributes':['id',_0xf465('0x38'),'fullname',_0xf465('0x71'),_0xf465('0x72')],'raw':!![]});}return null;})['then'](function(_0x4b09ea){if(!_0x4b09ea)return null;_0x2ebb70[_0xf465('0x28')][_0xf465('0x62')]=_0x4b09ea;return _0x2ebb70;})[_0xf465('0x20')](function(_0x1a1eab){if(_0x1a1eab){if(_0x341de5['body'][_0xf465('0x73')]){_0x2ebb70[_0xf465('0x28')][_0xf465('0x74')]=util[_0xf465('0x5e')](_0xf465('0x75'),_0x341de5[_0xf465('0x61')][_0xf465('0x38')]);_0x2ebb70[_0xf465('0x28')][_0xf465('0x76')]=_0x2ebb70['channel'];_0x2ebb70[_0xf465('0x28')]['motionChannel']=_0x2ebb70[_0xf465('0x76')];_0x2ebb70[_0xf465('0x28')][_0xf465('0x77')]=_0xf465('0x5a');return respondWithRpcPromise(_0xf465('0x78'),_0xf465('0x78'),{'event':_0xf465('0x79'),'message':_[_0xf465('0x4e')](_0x2ebb70[_0xf465('0x28')],JSON[_0xf465('0x7a')](_0x2ebb70['interaction'][_0xf465('0x7b')]))},client9002)['then'](function(){return _0x2ebb70;});}return _0x2ebb70;}return null;})['then'](respondWithResult(_0x4c82d6,null))[_0xf465('0x2b')](handleError(_0x4c82d6,null));};var interaction_log=require('../../config/logger')(_0xf465('0x59'));exports[_0xf465('0x35')]=function(_0x1aadca,_0x4bc62a,_0x5a891d){var _0x3b11d7={'agent':{},'channel':'chat'};if(_0x1aadca[_0xf465('0x56')]['id']){delete _0x1aadca['body']['id'];}_0x1aadca['body'][_0xf465('0x60')]=_0x1aadca[_0xf465('0x56')][_0xf465('0x60')]||_0x1aadca[_0xf465('0x61')]['id'];_0x3b11d7[_0xf465('0x62')]['id']=_0x1aadca[_0xf465('0x56')][_0xf465('0x60')];return db['ChatMessage'][_0xf465('0x57')]({'where':{'id':_0x1aadca[_0xf465('0x54')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x4bc62a,null))[_0xf465('0x20')](function(_0x170d45){if(_0x170d45){_0x3b11d7['message']=_0x170d45[_0xf465('0x63')]({'plain':!![]});return db[_0xf465('0x7c')][_0xf465('0x57')]({'where':{'id':_0x170d45[_0xf465('0x64')]}});}return null;})['then'](handleEntityNotFound(_0x4bc62a,null))[_0xf465('0x20')](function(_0x31e714){if(_0x31e714){_0x3b11d7[_0xf465('0x67')]=_0x31e714['get']({'plain':!![]});interaction_log['info'](_0xf465('0x7d'),_0x1aadca[_0xf465('0x61')]['id'],_0x1aadca[_0xf465('0x61')][_0xf465('0x38')],_0x1aadca[_0xf465('0x61')]['role'],_0x3b11d7['interaction']['id'],_0x1aadca[_0xf465('0x56')]?JSON[_0xf465('0x25')](_0x1aadca[_0xf465('0x56')]):'null');return respondWithRpcPromise(_0xf465('0x7e'),_0xf465('0x7f'),_0x3b11d7);}return null;})[_0xf465('0x20')](function(_0x5344fd){var _0x147d88=_0xf465('0x6b')+_0x5344fd[_0xf465('0x28')][_0xf465('0x6c')];return db[_0xf465('0x80')][_0xf465('0x40')](_0x147d88,{'type':db[_0xf465('0x6d')][_0xf465('0x6e')][_0xf465('0x81')],'raw':!![]})[_0xf465('0x20')](function(_0x4c8c8b){return _0x4c8c8b;});})['then'](function(_0x170b01){if(_0x170b01){_0x3b11d7[_0xf465('0x28')][_0xf465('0x6f')]=_0x170b01[0x0];if(!_0x1aadca[_0xf465('0x56')][_0xf465('0x60')])return;return db['User'][_0xf465('0x57')]({'where':{'id':_0x1aadca[_0xf465('0x56')]['UserId'],'role':_0xf465('0x62')},'attributes':['id',_0xf465('0x38'),_0xf465('0x82'),_0xf465('0x71'),'internal'],'raw':!![]});}return null;})[_0xf465('0x20')](function(_0x5c5c40){if(!_0x5c5c40)return null;_0x3b11d7[_0xf465('0x28')][_0xf465('0x62')]=_0x5c5c40;return _0x3b11d7;})[_0xf465('0x20')](function(_0x19b7eb){if(_0x19b7eb){_0x19b7eb[_0xf465('0x28')][_0xf465('0x74')]=util[_0xf465('0x5e')]('SIP/%s',_0x1aadca[_0xf465('0x61')]['name']);_0x19b7eb[_0xf465('0x28')][_0xf465('0x76')]=_0x3b11d7['channel'];_0x19b7eb['message'][_0xf465('0x83')]=_0x3b11d7[_0xf465('0x76')];_0x19b7eb[_0xf465('0x28')][_0xf465('0x77')]=_0xf465('0x35');respondWithRpcPromise(_0xf465('0x78'),_0xf465('0x78'),{'event':_0xf465('0x84'),'message':_[_0xf465('0x4e')](_0x3b11d7[_0xf465('0x28')],JSON['parse'](_0x3b11d7[_0xf465('0x67')][_0xf465('0x7b')]))},client9002);return _0x3b11d7;}return null;})[_0xf465('0x20')](respondWithResult(_0x4bc62a,null))[_0xf465('0x2b')](handleError(_0x4bc62a,null));}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index a577bc1..cb79133 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 _0xf9eb=['events','../../mysqldb','ChatMessage','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x5c588f,_0x425a0d){var _0x19125e=function(_0x325792){while(--_0x325792){_0x5c588f['push'](_0x5c588f['shift']());}};_0x19125e(++_0x425a0d);}(_0xf9eb,0x1a2));var _0xbf9e=function(_0x376e18,_0x4273c6){_0x376e18=_0x376e18-0x0;var _0x247ca1=_0xf9eb[_0x376e18];return _0x247ca1;};'use strict';var EventEmitter=require(_0xbf9e('0x0'));var ChatMessage=require(_0xbf9e('0x1'))['db'][_0xbf9e('0x2')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0xbf9e('0x3')](0x0);var events={'afterCreate':_0xbf9e('0x4'),'afterUpdate':_0xbf9e('0x5'),'afterDestroy':_0xbf9e('0x6')};function emitEvent(_0x4c8680){return function(_0x111f7e,_0x5ba57c,_0x566fcf){ChatMessageEvents[_0xbf9e('0x7')](_0x4c8680+':'+_0x111f7e['id'],_0x111f7e);ChatMessageEvents[_0xbf9e('0x7')](_0x4c8680,_0x111f7e);_0x566fcf(null);};}for(var e in events){if(events[_0xbf9e('0x8')](e)){var event=events[e];ChatMessage[_0xbf9e('0x9')](e,emitEvent(event));}}module[_0xbf9e('0xa')]=ChatMessageEvents; \ No newline at end of file +var _0xb04a=['emit','hasOwnProperty','hook','exports','../../mysqldb','setMaxListeners','save','update','remove'];(function(_0xc941ea,_0x408c2e){var _0x3b0f27=function(_0x5a4233){while(--_0x5a4233){_0xc941ea['push'](_0xc941ea['shift']());}};_0x3b0f27(++_0x408c2e);}(_0xb04a,0x67));var _0xab04=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb04a[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require('events');var ChatMessage=require(_0xab04('0x0'))['db']['ChatMessage'];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0xab04('0x1')](0x0);var events={'afterCreate':_0xab04('0x2'),'afterUpdate':_0xab04('0x3'),'afterDestroy':_0xab04('0x4')};function emitEvent(_0x48112b){return function(_0x54a524,_0x24d857,_0x5d9fc2){ChatMessageEvents['emit'](_0x48112b+':'+_0x54a524['id'],_0x54a524);ChatMessageEvents[_0xab04('0x5')](_0x48112b,_0x54a524);_0x5d9fc2(null);};}for(var e in events){if(events[_0xab04('0x6')](e)){var event=events[e];ChatMessage[_0xab04('0x7')](e,emitEvent(event));}}module[_0xab04('0x8')]=ChatMessageEvents; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.model.js b/server/api/chatMessage/chatMessage.model.js index e64e902..c5cb261 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 _0x640e=['../../config/environment','./chatMessage.attributes','exports','define','ChatMessage','chat_messages','fti_chat_messages','body','models','get','direction','toLowerCase','out','secret','isNil','UserId','ChatInteraction','ChatInteractionId','then','update','createdAt','catch','error','utf8mb4','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x34802f,_0x161127){var _0x18e109=function(_0x209311){while(--_0x209311){_0x34802f['push'](_0x34802f['shift']());}};_0x18e109(++_0x161127);}(_0x640e,0xde));var _0xe640=function(_0x209fcd,_0x1ecccc){_0x209fcd=_0x209fcd-0x0;var _0x501d5e=_0x640e[_0x209fcd];return _0x501d5e;};'use strict';var _=require(_0xe640('0x0'));var util=require(_0xe640('0x1'));var logger=require(_0xe640('0x2'))(_0xe640('0x3'));var moment=require(_0xe640('0x4'));var BPromise=require(_0xe640('0x5'));var rp=require(_0xe640('0x6'));var fs=require('fs');var path=require(_0xe640('0x7'));var rimraf=require(_0xe640('0x8'));var config=require(_0xe640('0x9'));var attributes=require(_0xe640('0xa'));module[_0xe640('0xb')]=function(_0x3cb4c2,_0x2412f3){return _0x3cb4c2[_0xe640('0xc')](_0xe640('0xd'),attributes,{'tableName':_0xe640('0xe'),'paranoid':![],'indexes':[{'name':_0xe640('0xf'),'fields':[_0xe640('0x10')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x3b0f3f,_0x28d3a5,_0x596884){var _0x4c26b6=_0x3cb4c2[_0xe640('0x11')];var _0x50df97=_0x3b0f3f[_0xe640('0x12')]({'plain':!![]});if(_0x50df97[_0xe640('0x13')]['toLowerCase']()==='in'||_0x50df97[_0xe640('0x13')][_0xe640('0x14')]()===_0xe640('0x15')&&!_0x50df97[_0xe640('0x16')]&&!_[_0xe640('0x17')](_0x50df97[_0xe640('0x18')])){_0x4c26b6[_0xe640('0x19')]['findOne']({'where':{'id':_0x50df97[_0xe640('0x1a')]}})[_0xe640('0x1b')](function(_0x5b0e16){if(_0x5b0e16){_0x5b0e16[_0xe640('0x1c')]({'lastMsgAt':_0x50df97[_0xe640('0x1d')],'lastMsgDirection':_0x50df97[_0xe640('0x13')][_0xe640('0x14')]()});}})[_0xe640('0x1e')](function(_0x43e209){console[_0xe640('0x1f')](_0x43e209);});}_0x596884();}},'charset':_0xe640('0x20'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xe74d=['error','utf8mb4_unicode_ci','lodash','util','moment','bluebird','request-promise','path','../../config/environment','./chatMessage.attributes','exports','define','ChatMessage','chat_messages','fti_chat_messages','body','FULLTEXT','models','direction','toLowerCase','out','UserId','ChatInteraction','findOne','then','update','createdAt','catch'];(function(_0x2fb816,_0x1dadbb){var _0x557527=function(_0x461714){while(--_0x461714){_0x2fb816['push'](_0x2fb816['shift']());}};_0x557527(++_0x1dadbb);}(_0xe74d,0x16e));var _0xde74=function(_0x18d36f,_0x31b65f){_0x18d36f=_0x18d36f-0x0;var _0x10034d=_0xe74d[_0x18d36f];return _0x10034d;};'use strict';var _=require(_0xde74('0x0'));var util=require(_0xde74('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xde74('0x2'));var BPromise=require(_0xde74('0x3'));var rp=require(_0xde74('0x4'));var fs=require('fs');var path=require(_0xde74('0x5'));var rimraf=require('rimraf');var config=require(_0xde74('0x6'));var attributes=require(_0xde74('0x7'));module[_0xde74('0x8')]=function(_0x328c43,_0x4800a3){return _0x328c43[_0xde74('0x9')](_0xde74('0xa'),attributes,{'tableName':_0xde74('0xb'),'paranoid':![],'indexes':[{'name':_0xde74('0xc'),'fields':[_0xde74('0xd')],'type':_0xde74('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x27c148,_0x3e214e,_0x392082){var _0x146ecf=_0x328c43[_0xde74('0xf')];var _0x542f15=_0x27c148['get']({'plain':!![]});if(_0x542f15[_0xde74('0x10')][_0xde74('0x11')]()==='in'||_0x542f15[_0xde74('0x10')]['toLowerCase']()===_0xde74('0x12')&&!_0x542f15['secret']&&!_['isNil'](_0x542f15[_0xde74('0x13')])){_0x146ecf[_0xde74('0x14')][_0xde74('0x15')]({'where':{'id':_0x542f15['ChatInteractionId']}})[_0xde74('0x16')](function(_0x125c9b){if(_0x125c9b){_0x125c9b[_0xde74('0x17')]({'lastMsgAt':_0x542f15[_0xde74('0x18')],'lastMsgDirection':_0x542f15['direction']['toLowerCase']()});}})[_0xde74('0x19')](function(_0xa376){console[_0xde74('0x1a')](_0xa376);});}_0x392082();}},'charset':'utf8mb4','collate':_0xde74('0x1b')});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.rpc.js b/server/api/chatMessage/chatMessage.rpc.js index ab7924e..ab84721 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 _0xdcb8=['register','request','info','ChatMessage,\x20%s,\x20%s','request\x20sent','ChatMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','CreateChatMessage','ChatMessage','create','body','options','raw','then','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','socket.io-emitter','./chatMessage.socket'];(function(_0x2642cb,_0x4b917f){var _0xe6e41=function(_0x281676){while(--_0x281676){_0x2642cb['push'](_0x2642cb['shift']());}};_0xe6e41(++_0x4b917f);}(_0xdcb8,0x13b));var _0x8dcb=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0xdcb8[_0x3b380d];return _0x54502b;};'use strict';var _=require('lodash');var util=require(_0x8dcb('0x0'));var moment=require(_0x8dcb('0x1'));var BPromise=require('bluebird');var rs=require(_0x8dcb('0x2'));var fs=require('fs');var Redis=require(_0x8dcb('0x3'));var db=require(_0x8dcb('0x4'))['db'];var utils=require(_0x8dcb('0x5'));var logger=require(_0x8dcb('0x6'))(_0x8dcb('0x7'));var config=require('../../config/environment');var jayson=require(_0x8dcb('0x8'));var client=jayson[_0x8dcb('0x9')][_0x8dcb('0xa')]({'port':0x232a});config[_0x8dcb('0xb')]=_[_0x8dcb('0xc')](config[_0x8dcb('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x8dcb('0xd'))(new Redis(config['redis']));require(_0x8dcb('0xe'))[_0x8dcb('0xf')](socket);function respondWithRpcPromise(_0x4e0494,_0x25916d,_0x49d06d){return new BPromise(function(_0x480639,_0x30b4e2){return client[_0x8dcb('0x10')](_0x4e0494,_0x49d06d)['then'](function(_0x23bfaa){logger[_0x8dcb('0x11')](_0x8dcb('0x12'),_0x25916d,_0x8dcb('0x13'));logger['debug'](_0x8dcb('0x14'),_0x25916d,_0x8dcb('0x13'),JSON['stringify'](_0x23bfaa));if(_0x23bfaa[_0x8dcb('0x15')]){if(_0x23bfaa['error'][_0x8dcb('0x16')]===0x1f4){logger[_0x8dcb('0x15')]('ChatMessage,\x20%s,\x20%s',_0x25916d,_0x23bfaa[_0x8dcb('0x15')][_0x8dcb('0x17')]);return _0x30b4e2(_0x23bfaa[_0x8dcb('0x15')]['message']);}logger[_0x8dcb('0x15')](_0x8dcb('0x12'),_0x25916d,_0x23bfaa[_0x8dcb('0x15')]['message']);return _0x480639(_0x23bfaa['error'][_0x8dcb('0x17')]);}else{logger[_0x8dcb('0x11')](_0x8dcb('0x12'),_0x25916d,'request\x20sent');_0x480639(_0x23bfaa[_0x8dcb('0x18')][_0x8dcb('0x17')]);}})[_0x8dcb('0x19')](function(_0x45f918){logger[_0x8dcb('0x15')](_0x8dcb('0x12'),_0x25916d,_0x45f918);_0x30b4e2(_0x45f918);});});}exports[_0x8dcb('0x1a')]=function(_0x109bca){var _0x103bf0=this;return new Promise(function(_0x1837c6,_0x34df68){return db[_0x8dcb('0x1b')][_0x8dcb('0x1c')](_0x109bca[_0x8dcb('0x1d')],{'raw':_0x109bca[_0x8dcb('0x1e')]?_0x109bca[_0x8dcb('0x1e')][_0x8dcb('0x1f')]===undefined?!![]:![]:!![]})[_0x8dcb('0x20')](function(_0x4925de){logger[_0x8dcb('0x11')](_0x8dcb('0x1a'),_0x109bca);logger['debug'](_0x8dcb('0x1a'),_0x109bca,JSON['stringify'](_0x4925de));_0x1837c6(_0x4925de);})[_0x8dcb('0x19')](function(_0x432028){logger[_0x8dcb('0x15')](_0x8dcb('0x1a'),_0x432028[_0x8dcb('0x17')],_0x109bca);_0x34df68(_0x103bf0[_0x8dcb('0x15')](0x1f4,_0x432028[_0x8dcb('0x17')]));});});}; \ No newline at end of file +var _0x70d7=['then','request\x20sent','stringify','error','code','ChatMessage,\x20%s,\x20%s','message','info','result','CreateChatMessage','ChatMessage','options','raw','debug','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register'];(function(_0x2a4246,_0xe98f2e){var _0x13d361=function(_0x4eacaa){while(--_0x4eacaa){_0x2a4246['push'](_0x2a4246['shift']());}};_0x13d361(++_0xe98f2e);}(_0x70d7,0x1ee));var _0x770d=function(_0x3978e9,_0x202fbf){_0x3978e9=_0x3978e9-0x0;var _0x4c6581=_0x70d7[_0x3978e9];return _0x4c6581;};'use strict';var _=require(_0x770d('0x0'));var util=require(_0x770d('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x770d('0x2'));var fs=require('fs');var Redis=require(_0x770d('0x3'));var db=require(_0x770d('0x4'))['db'];var utils=require(_0x770d('0x5'));var logger=require(_0x770d('0x6'))(_0x770d('0x7'));var config=require('../../config/environment');var jayson=require(_0x770d('0x8'));var client=jayson[_0x770d('0x9')][_0x770d('0xa')]({'port':0x232a});config[_0x770d('0xb')]=_[_0x770d('0xc')](config[_0x770d('0xb')],{'host':_0x770d('0xd'),'port':0x18eb});var socket=require(_0x770d('0xe'))(new Redis(config[_0x770d('0xb')]));require('./chatMessage.socket')[_0x770d('0xf')](socket);function respondWithRpcPromise(_0x104b21,_0x1579ca,_0xa9aebe){return new BPromise(function(_0x2c1a71,_0x269a7c){return client['request'](_0x104b21,_0xa9aebe)[_0x770d('0x10')](function(_0x5e1ee1){logger['info']('ChatMessage,\x20%s,\x20%s',_0x1579ca,_0x770d('0x11'));logger['debug']('ChatMessage,\x20%s,\x20%s,\x20%s',_0x1579ca,_0x770d('0x11'),JSON[_0x770d('0x12')](_0x5e1ee1));if(_0x5e1ee1[_0x770d('0x13')]){if(_0x5e1ee1[_0x770d('0x13')][_0x770d('0x14')]===0x1f4){logger[_0x770d('0x13')](_0x770d('0x15'),_0x1579ca,_0x5e1ee1['error']['message']);return _0x269a7c(_0x5e1ee1[_0x770d('0x13')][_0x770d('0x16')]);}logger[_0x770d('0x13')]('ChatMessage,\x20%s,\x20%s',_0x1579ca,_0x5e1ee1[_0x770d('0x13')][_0x770d('0x16')]);return _0x2c1a71(_0x5e1ee1['error']['message']);}else{logger[_0x770d('0x17')](_0x770d('0x15'),_0x1579ca,_0x770d('0x11'));_0x2c1a71(_0x5e1ee1[_0x770d('0x18')]['message']);}})['catch'](function(_0x3857c7){logger[_0x770d('0x13')]('ChatMessage,\x20%s,\x20%s',_0x1579ca,_0x3857c7);_0x269a7c(_0x3857c7);});});}exports[_0x770d('0x19')]=function(_0x5888e4){var _0xe31303=this;return new Promise(function(_0x49f8af,_0x5d7818){return db[_0x770d('0x1a')]['create'](_0x5888e4['body'],{'raw':_0x5888e4[_0x770d('0x1b')]?_0x5888e4[_0x770d('0x1b')][_0x770d('0x1c')]===undefined?!![]:![]:!![]})[_0x770d('0x10')](function(_0x75e812){logger[_0x770d('0x17')]('CreateChatMessage',_0x5888e4);logger[_0x770d('0x1d')](_0x770d('0x19'),_0x5888e4,JSON[_0x770d('0x12')](_0x75e812));_0x49f8af(_0x75e812);})['catch'](function(_0x253a66){logger[_0x770d('0x13')](_0x770d('0x19'),_0x253a66['message'],_0x5888e4);_0x5d7818(_0xe31303[_0x770d('0x13')](0x1f4,_0x253a66[_0x770d('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index 6a8658d..6f2d584 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 _0x818f=['update','emit','removeListener','register','length','chatMessage:','./chatMessage.events','save','remove'];(function(_0x1974a6,_0xdb12ff){var _0x8f6b8c=function(_0x4655d1){while(--_0x4655d1){_0x1974a6['push'](_0x1974a6['shift']());}};_0x8f6b8c(++_0xdb12ff);}(_0x818f,0x1da));var _0xf818=function(_0x8cc1ce,_0x120de3){_0x8cc1ce=_0x8cc1ce-0x0;var _0x293189=_0x818f[_0x8cc1ce];return _0x293189;};'use strict';var ChatMessageEvents=require(_0xf818('0x0'));var events=[_0xf818('0x1'),_0xf818('0x2'),_0xf818('0x3')];function createListener(_0x121db7,_0x39b430){return function(_0x58f142){_0x39b430[_0xf818('0x4')](_0x121db7,_0x58f142);};}function removeListener(_0xd6c86,_0x2c1bb0){return function(){ChatMessageEvents[_0xf818('0x5')](_0xd6c86,_0x2c1bb0);};}exports[_0xf818('0x6')]=function(_0x41310f){for(var _0x27119b=0x0,_0x42a23e=events[_0xf818('0x7')];_0x27119b<_0x42a23e;_0x27119b++){var _0x55540d=events[_0x27119b];var _0x1dbfc8=createListener(_0xf818('0x8')+_0x55540d,_0x41310f);ChatMessageEvents['on'](_0x55540d,_0x1dbfc8);}}; \ No newline at end of file +var _0xf776=['length','./chatMessage.events','remove','update','emit','removeListener'];(function(_0x1a450a,_0x4dcb72){var _0x4f8ef4=function(_0x44c6ba){while(--_0x44c6ba){_0x1a450a['push'](_0x1a450a['shift']());}};_0x4f8ef4(++_0x4dcb72);}(_0xf776,0x169));var _0x6f77=function(_0x399af4,_0x23cc92){_0x399af4=_0x399af4-0x0;var _0x265849=_0xf776[_0x399af4];return _0x265849;};'use strict';var ChatMessageEvents=require(_0x6f77('0x0'));var events=['save',_0x6f77('0x1'),_0x6f77('0x2')];function createListener(_0x4e3b77,_0x43f2fd){return function(_0x2458e0){_0x43f2fd[_0x6f77('0x3')](_0x4e3b77,_0x2458e0);};}function removeListener(_0x16874b,_0x53ec9b){return function(){ChatMessageEvents[_0x6f77('0x4')](_0x16874b,_0x53ec9b);};}exports['register']=function(_0xf62e3e){for(var _0x21909a=0x0,_0x36ffd2=events[_0x6f77('0x5')];_0x21909a<_0x36ffd2;_0x21909a++){var _0x545ba9=events[_0x21909a];var _0x1dd52f=createListener('chatMessage:'+_0x545ba9,_0xf62e3e);ChatMessageEvents['on'](_0x545ba9,_0x1dd52f);}}; \ No newline at end of file diff --git a/server/api/chatMessage/index.js b/server/api/chatMessage/index.js index d153cf9..ece76ff 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 _0xa1d6=['chat','chatmessage:create','create','/:id/accept','accept','put','/:id/reject','reject','delete','destroy','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','show','post','tracked'];(function(_0x56f561,_0x7f75f4){var _0x15ed6f=function(_0xc13416){while(--_0xc13416){_0x56f561['push'](_0x56f561['shift']());}};_0x15ed6f(++_0x7f75f4);}(_0xa1d6,0x10f));var _0x6a1d=function(_0x35ce0e,_0x13f34e){_0x35ce0e=_0x35ce0e-0x0;var _0x17d179=_0xa1d6[_0x35ce0e];return _0x17d179;};'use strict';var multer=require(_0x6a1d('0x0'));var util=require(_0x6a1d('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x6a1d('0x2'));var router=express[_0x6a1d('0x3')]();var fs_extra=require(_0x6a1d('0x4'));var auth=require(_0x6a1d('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x6a1d('0x6'));var controller=require('./chatMessage.controller');router[_0x6a1d('0x7')]('/',auth[_0x6a1d('0x8')](),controller['index']);router['get'](_0x6a1d('0x9'),auth[_0x6a1d('0x8')](),controller[_0x6a1d('0xa')]);router[_0x6a1d('0x7')](_0x6a1d('0xb'),auth[_0x6a1d('0x8')](),controller[_0x6a1d('0xc')]);router[_0x6a1d('0xd')]('/',auth[_0x6a1d('0x8')](),interaction[_0x6a1d('0xe')](_0x6a1d('0xf'),_0x6a1d('0x10')),controller[_0x6a1d('0x11')]);router['put'](_0x6a1d('0xb'),controller['update']);router['put'](_0x6a1d('0x12'),auth[_0x6a1d('0x8')](),controller[_0x6a1d('0x13')]);router[_0x6a1d('0x14')](_0x6a1d('0x15'),auth[_0x6a1d('0x8')](),controller[_0x6a1d('0x16')]);router[_0x6a1d('0x17')](_0x6a1d('0xb'),auth[_0x6a1d('0x8')](),controller[_0x6a1d('0x18')]);module[_0x6a1d('0x19')]=router; \ No newline at end of file +var _0x4680=['delete','destroy','exports','multer','path','connect-timeout','express','../../components/auth/service','../../config/environment','./chatMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','tracked','chat','create','put','update','/:id/accept','accept','/:id/reject','reject'];(function(_0x162c52,_0x2d489b){var _0xcb6dda=function(_0x170496){while(--_0x170496){_0x162c52['push'](_0x162c52['shift']());}};_0xcb6dda(++_0x2d489b);}(_0x4680,0x1ce));var _0x0468=function(_0x2de62c,_0x2a32cd){_0x2de62c=_0x2de62c-0x0;var _0x1c024c=_0x4680[_0x2de62c];return _0x1c024c;};'use strict';var multer=require(_0x0468('0x0'));var util=require('util');var path=require(_0x0468('0x1'));var timeout=require(_0x0468('0x2'));var express=require(_0x0468('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x0468('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x0468('0x5'));var controller=require(_0x0468('0x6'));router[_0x0468('0x7')]('/',auth[_0x0468('0x8')](),controller[_0x0468('0x9')]);router[_0x0468('0x7')](_0x0468('0xa'),auth[_0x0468('0x8')](),controller[_0x0468('0xb')]);router[_0x0468('0x7')](_0x0468('0xc'),auth[_0x0468('0x8')](),controller[_0x0468('0xd')]);router[_0x0468('0xe')]('/',auth[_0x0468('0x8')](),interaction[_0x0468('0xf')](_0x0468('0x10'),'chatmessage:create'),controller[_0x0468('0x11')]);router[_0x0468('0x12')](_0x0468('0xc'),controller[_0x0468('0x13')]);router[_0x0468('0x12')](_0x0468('0x14'),auth[_0x0468('0x8')](),controller[_0x0468('0x15')]);router[_0x0468('0x12')](_0x0468('0x16'),auth[_0x0468('0x8')](),controller[_0x0468('0x17')]);router[_0x0468('0x18')](_0x0468('0xc'),auth[_0x0468('0x8')](),controller[_0x0468('0x19')]);module[_0x0468('0x1a')]=router; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js index 92640e3..553d46b 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 _0x47c8=['exports','TEXT','medium','sequelize'];(function(_0x369cae,_0x45a057){var _0xc7a297=function(_0x1e81bf){while(--_0x1e81bf){_0x369cae['push'](_0x369cae['shift']());}};_0xc7a297(++_0x45a057);}(_0x47c8,0xcf));var _0x847c=function(_0x2f1351,_0xb5203){_0x2f1351=_0x2f1351-0x0;var _0xe88511=_0x47c8[_0x2f1351];return _0xe88511;};'use strict';var Sequelize=require(_0x847c('0x0'));module[_0x847c('0x1')]={'body':{'type':Sequelize[_0x847c('0x2')](_0x847c('0x3')),'allowNull':![]}}; \ No newline at end of file +var _0xd38f=['exports','TEXT','medium','sequelize'];(function(_0x34f756,_0x1ea7ab){var _0x26e745=function(_0x165a65){while(--_0x165a65){_0x34f756['push'](_0x34f756['shift']());}};_0x26e745(++_0x1ea7ab);}(_0xd38f,0xbf));var _0xfd38=function(_0x406a87,_0x28891c){_0x406a87=_0x406a87-0x0;var _0x223876=_0xd38f[_0x406a87];return _0x223876;};'use strict';var Sequelize=require(_0xfd38('0x0'));module[_0xfd38('0x1')]={'body':{'type':Sequelize[_0xfd38('0x2')](_0xfd38('0x3')),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js index 7b43f5a..150e32b 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(_0x13ea00,_0x12f610){var _0x1f7347=function(_0x34ae63){while(--_0x34ae63){_0x13ea00['push'](_0x13ea00['shift']());}};_0x1f7347(++_0x12f610);}(_0x7a54,0x106));var _0x47a5=function(_0x11d73e,_0x3f4882){_0x11d73e=_0x11d73e-0x0;var _0xfd3d73=_0x7a54[_0x11d73e];return _0xfd3d73;};'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(_0x13ca2c,_0x132564){var _0x37e9ac=function(_0x1c1d0f){while(--_0x1c1d0f){_0x13ca2c['push'](_0x13ca2c['shift']());}};_0x37e9ac(++_0x132564);}(_0x9957,0x93));var _0x7995=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9957[_0x1facfa];return _0x9ec701;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){var _0x514445={},_0x456a28={},_0x3250e0={'count':0x0,'rows':[]};var _0x4253e5=_['map'](db['ChatOfflineMessage']['rawAttributes'],function(_0x3573be){return{'name':_0x3573be[_0x7995('0x2c')],'type':_0x3573be[_0x7995('0x2d')][_0x7995('0x2e')]};});_0x456a28[_0x7995('0x2f')]=_[_0x7995('0x30')](_0x4253e5,'name');_0x456a28['query']=_[_0x7995('0x31')](_0x4b6f99['query']);_0x456a28[_0x7995('0x32')]=_[_0x7995('0x33')](_0x456a28[_0x7995('0x2f')],_0x456a28[_0x7995('0x34')]);_0x514445[_0x7995('0x35')]=_['intersection'](_0x456a28[_0x7995('0x2f')],qs[_0x7995('0x36')](_0x4b6f99['query']['fields']));_0x514445['attributes']=_0x514445[_0x7995('0x35')][_0x7995('0x37')]?_0x514445['attributes']:_0x456a28[_0x7995('0x2f')];if(!_0x4b6f99['query'][_0x7995('0x38')](_0x7995('0x39'))){_0x514445[_0x7995('0x21')]=qs['limit'](_0x4b6f99['query'][_0x7995('0x21')]);_0x514445['offset']=qs['offset'](_0x4b6f99[_0x7995('0x34')][_0x7995('0x20')]);}_0x514445['order']=qs[_0x7995('0x3a')](_0x4b6f99[_0x7995('0x34')][_0x7995('0x3a')]);_0x514445[_0x7995('0x3b')]=qs[_0x7995('0x32')](_['pick'](_0x4b6f99[_0x7995('0x34')],_0x456a28[_0x7995('0x32')]),_0x4253e5);if(_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]){_0x514445['where']=_[_0x7995('0x3d')](_0x514445[_0x7995('0x3b')],{'$or':_[_0x7995('0x30')](_0x4253e5,function(_0xe5ea43){if(_0xe5ea43[_0x7995('0x2d')]!==_0x7995('0x3e')){var _0x5688a1={};_0x5688a1[_0xe5ea43[_0x7995('0x29')]]={'$like':'%'+_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]+'%'};return _0x5688a1;}})});}_0x514445=_[_0x7995('0x3d')]({},_0x514445,_0x4b6f99[_0x7995('0x3f')]);var _0x298fc2={'where':_0x514445[_0x7995('0x3b')]};return db[_0x7995('0x40')][_0x7995('0x1f')](_0x298fc2)[_0x7995('0x26')](function(_0x6fe77b){_0x3250e0[_0x7995('0x1f')]=_0x6fe77b;if(_0x4b6f99[_0x7995('0x34')]['includeAll']){_0x514445['include']=[{'all':!![]}];}return db[_0x7995('0x40')][_0x7995('0x41')](_0x514445);})['then'](function(_0x4b0855){_0x3250e0[_0x7995('0x42')]=_0x4b0855;return _0x3250e0;})['then'](respondWithFilteredResult(_0x9b2a15,_0x514445))['catch'](handleError(_0x9b2a15,null));};exports[_0x7995('0x43')]=function(_0x36e28b,_0x35c8ff){var _0x576b96={'raw':!![],'where':{'id':_0x36e28b['params']['id']}},_0x46ac4f={};_0x46ac4f[_0x7995('0x2f')]=_['keys'](db['ChatOfflineMessage'][_0x7995('0x44')]);_0x46ac4f[_0x7995('0x34')]=_[_0x7995('0x31')](_0x36e28b[_0x7995('0x34')]);_0x46ac4f['filters']=_[_0x7995('0x33')](_0x46ac4f[_0x7995('0x2f')],_0x46ac4f[_0x7995('0x34')]);_0x576b96[_0x7995('0x35')]=_['intersection'](_0x46ac4f['model'],qs[_0x7995('0x36')](_0x36e28b['query'][_0x7995('0x36')]));_0x576b96['attributes']=_0x576b96[_0x7995('0x35')]['length']?_0x576b96[_0x7995('0x35')]:_0x46ac4f[_0x7995('0x2f')];if(_0x36e28b['query'][_0x7995('0x45')]){_0x576b96[_0x7995('0x46')]=[{'all':!![]}];}_0x576b96=_[_0x7995('0x3d')]({},_0x576b96,_0x36e28b[_0x7995('0x3f')]);return db['ChatOfflineMessage'][_0x7995('0x47')](_0x576b96)[_0x7995('0x26')](handleEntityNotFound(_0x35c8ff,null))[_0x7995('0x26')](respondWithResult(_0x35c8ff,null))['catch'](handleError(_0x35c8ff,null));};exports[_0x7995('0x48')]=function(_0x44f516,_0x511567){return db[_0x7995('0x40')][_0x7995('0x48')](_0x44f516['body'],{})[_0x7995('0x26')](respondWithResult(_0x511567,0xc9))[_0x7995('0x49')](handleError(_0x511567,null));};exports['update']=function(_0x3d1dbb,_0x5843ba){if(_0x3d1dbb[_0x7995('0x4a')]['id']){delete _0x3d1dbb[_0x7995('0x4a')]['id'];}return db[_0x7995('0x40')][_0x7995('0x47')]({'where':{'id':_0x3d1dbb[_0x7995('0x4b')]['id']}})[_0x7995('0x26')](handleEntityNotFound(_0x5843ba,null))[_0x7995('0x26')](saveUpdates(_0x3d1dbb['body'],null))[_0x7995('0x26')](respondWithResult(_0x5843ba,null))[_0x7995('0x49')](handleError(_0x5843ba,null));};exports[_0x7995('0x27')]=function(_0x4ffc8a,_0x19da63){return db[_0x7995('0x4c')][_0x7995('0x41')]({'where':{'ChatOfflineMessageId':_0x4ffc8a['params']['id']},'raw':!![]})['then'](function(_0x5a592e){_0x5a592e[_0x7995('0x4d')](function(_0x1fd1ca){var _0x4cf5db=path[_0x7995('0x4e')](config[_0x7995('0x4f')],_0x7995('0x50'),_0x7995('0x51'),_0x7995('0x52'),'offline-chat',_0x1fd1ca[_0x7995('0x53')]);var _0x4ab09f=fs[_0x7995('0x54')](_0x4cf5db);if(_0x4ab09f)fs_extra[_0x7995('0x55')](_0x4cf5db);});})[_0x7995('0x26')](function(){return db['ChatOfflineMessage']['find']({'where':{'id':_0x4ffc8a['params']['id']},'individualHooks':!![]});})['then'](handleEntityNotFound(_0x19da63,null))[_0x7995('0x26')](removeEntity(_0x19da63,null))[_0x7995('0x49')](handleError(_0x19da63,null));};exports[_0x7995('0x56')]=function(_0x150261,_0x1d957e){return db[_0x7995('0x40')][_0x7995('0x56')]()[_0x7995('0x26')](respondWithResult(_0x1d957e,null))[_0x7995('0x49')](handleError(_0x1d957e,null));}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.model.js b/server/api/chatOfflineMessage/chatOfflineMessage.model.js index b9c4474..06e8c54 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 _0x74f1=['rimraf','../../config/environment','./chatOfflineMessage.attributes','exports','define','chat_offline_messages','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','request-promise','path'];(function(_0x582d0b,_0x28f609){var _0x2e93e1=function(_0xb6a81c){while(--_0xb6a81c){_0x582d0b['push'](_0x582d0b['shift']());}};_0x2e93e1(++_0x28f609);}(_0x74f1,0x14a));var _0x174f=function(_0x1ee0a1,_0x51058e){_0x1ee0a1=_0x1ee0a1-0x0;var _0x1d2d5b=_0x74f1[_0x1ee0a1];return _0x1d2d5b;};'use strict';var _=require('lodash');var util=require(_0x174f('0x0'));var logger=require(_0x174f('0x1'))(_0x174f('0x2'));var moment=require(_0x174f('0x3'));var BPromise=require('bluebird');var rp=require(_0x174f('0x4'));var fs=require('fs');var path=require(_0x174f('0x5'));var rimraf=require(_0x174f('0x6'));var config=require(_0x174f('0x7'));var attributes=require(_0x174f('0x8'));module[_0x174f('0x9')]=function(_0xc8fdce,_0x1a4cff){return _0xc8fdce[_0x174f('0xa')]('ChatOfflineMessage',attributes,{'tableName':_0x174f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x174f('0xc'),'collate':_0x174f('0xd')});}; \ No newline at end of file +var _0x45c2=['exports','define','ChatOfflineMessage','chat_offline_messages','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./chatOfflineMessage.attributes'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x45c2,0x164));var _0x245c=function(_0x3360f3,_0x344f01){_0x3360f3=_0x3360f3-0x0;var _0x45e856=_0x45c2[_0x3360f3];return _0x45e856;};'use strict';var _=require('lodash');var util=require(_0x245c('0x0'));var logger=require(_0x245c('0x1'))(_0x245c('0x2'));var moment=require('moment');var BPromise=require(_0x245c('0x3'));var rp=require(_0x245c('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x245c('0x5'));var config=require(_0x245c('0x6'));var attributes=require(_0x245c('0x7'));module[_0x245c('0x8')]=function(_0x18d18c,_0x53d6bb){return _0x18d18c[_0x245c('0x9')](_0x245c('0xa'),attributes,{'tableName':_0x245c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x245c('0xc'),'collate':_0x245c('0xd')});}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index 64f2b9d..286ff86 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 _0x9ea2=['then','info','ChatOfflineMessage,\x20%s,\x20%s','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','result','catch','lodash','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','request'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9ea2,0x147));var _0x29ea=function(_0x383ea8,_0x5d5797){_0x383ea8=_0x383ea8-0x0;var _0x3736b8=_0x9ea2[_0x383ea8];return _0x3736b8;};'use strict';var _=require(_0x29ea('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x29ea('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x29ea('0x2'));var db=require(_0x29ea('0x3'))['db'];var utils=require(_0x29ea('0x4'));var logger=require(_0x29ea('0x5'))(_0x29ea('0x6'));var config=require(_0x29ea('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x19f3b7,_0x50e60f,_0x36dbd7){return new BPromise(function(_0x25b1aa,_0x724c09){return client[_0x29ea('0x8')](_0x19f3b7,_0x36dbd7)[_0x29ea('0x9')](function(_0x96d254){logger[_0x29ea('0xa')](_0x29ea('0xb'),_0x50e60f,'request\x20sent');logger[_0x29ea('0xc')](_0x29ea('0xd'),_0x50e60f,_0x29ea('0xe'),JSON[_0x29ea('0xf')](_0x96d254));if(_0x96d254['error']){if(_0x96d254['error'][_0x29ea('0x10')]===0x1f4){logger[_0x29ea('0x11')]('ChatOfflineMessage,\x20%s,\x20%s',_0x50e60f,_0x96d254[_0x29ea('0x11')][_0x29ea('0x12')]);return _0x724c09(_0x96d254[_0x29ea('0x11')]['message']);}logger[_0x29ea('0x11')]('ChatOfflineMessage,\x20%s,\x20%s',_0x50e60f,_0x96d254[_0x29ea('0x11')][_0x29ea('0x12')]);return _0x25b1aa(_0x96d254[_0x29ea('0x11')][_0x29ea('0x12')]);}else{logger[_0x29ea('0xa')](_0x29ea('0xb'),_0x50e60f,_0x29ea('0xe'));_0x25b1aa(_0x96d254[_0x29ea('0x13')][_0x29ea('0x12')]);}})[_0x29ea('0x14')](function(_0x303ceb){logger[_0x29ea('0x11')]('ChatOfflineMessage,\x20%s,\x20%s',_0x50e60f,_0x303ceb);_0x724c09(_0x303ceb);});});} \ No newline at end of file +var _0x4ccf=['ChatOfflineMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ChatOfflineMessage,\x20%s,\x20%s','debug'];(function(_0x585cff,_0xedb8e0){var _0x1aaf4c=function(_0x2041aa){while(--_0x2041aa){_0x585cff['push'](_0x585cff['shift']());}};_0x1aaf4c(++_0xedb8e0);}(_0x4ccf,0x170));var _0xf4cc=function(_0x157492,_0x38af62){_0x157492=_0x157492-0x0;var _0x224180=_0x4ccf[_0x157492];return _0x224180;};'use strict';var _=require('lodash');var util=require(_0xf4cc('0x0'));var moment=require(_0xf4cc('0x1'));var BPromise=require(_0xf4cc('0x2'));var rs=require(_0xf4cc('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf4cc('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xf4cc('0x5'))(_0xf4cc('0x6'));var config=require(_0xf4cc('0x7'));var jayson=require(_0xf4cc('0x8'));var client=jayson[_0xf4cc('0x9')][_0xf4cc('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x234ff6,_0x35625c,_0x4b0a29){return new BPromise(function(_0x392fda,_0x4092d1){return client[_0xf4cc('0xb')](_0x234ff6,_0x4b0a29)[_0xf4cc('0xc')](function(_0x561314){logger[_0xf4cc('0xd')](_0xf4cc('0xe'),_0x35625c,'request\x20sent');logger[_0xf4cc('0xf')](_0xf4cc('0x10'),_0x35625c,_0xf4cc('0x11'),JSON[_0xf4cc('0x12')](_0x561314));if(_0x561314['error']){if(_0x561314[_0xf4cc('0x13')][_0xf4cc('0x14')]===0x1f4){logger[_0xf4cc('0x13')](_0xf4cc('0xe'),_0x35625c,_0x561314['error'][_0xf4cc('0x15')]);return _0x4092d1(_0x561314[_0xf4cc('0x13')][_0xf4cc('0x15')]);}logger[_0xf4cc('0x13')](_0xf4cc('0xe'),_0x35625c,_0x561314['error']['message']);return _0x392fda(_0x561314['error'][_0xf4cc('0x15')]);}else{logger['info'](_0xf4cc('0xe'),_0x35625c,'request\x20sent');_0x392fda(_0x561314[_0xf4cc('0x16')]['message']);}})[_0xf4cc('0x17')](function(_0x119c5c){logger[_0xf4cc('0x13')](_0xf4cc('0xe'),_0x35625c,_0x119c5c);_0x4092d1(_0x119c5c);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index 72ef751..90ad2e9 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 _0x1591=['../../config/environment','./chatOfflineMessage.controller','get','isAuthenticated','/describe','describe','/:id','show','post','create','update','destroy','exports','path','express','fs-extra','../../components/interaction/service'];(function(_0x16061c,_0xc37b21){var _0x190355=function(_0x3fe799){while(--_0x3fe799){_0x16061c['push'](_0x16061c['shift']());}};_0x190355(++_0xc37b21);}(_0x1591,0x84));var _0x1159=function(_0x5311e8,_0x57c5bb){_0x5311e8=_0x5311e8-0x0;var _0x582ad8=_0x1591[_0x5311e8];return _0x582ad8;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1159('0x0'));var timeout=require('connect-timeout');var express=require(_0x1159('0x1'));var router=express['Router']();var fs_extra=require(_0x1159('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0x1159('0x3'));var config=require(_0x1159('0x4'));var controller=require(_0x1159('0x5'));router[_0x1159('0x6')]('/',auth[_0x1159('0x7')](),controller['index']);router[_0x1159('0x6')](_0x1159('0x8'),auth[_0x1159('0x7')](),controller[_0x1159('0x9')]);router['get'](_0x1159('0xa'),auth[_0x1159('0x7')](),controller[_0x1159('0xb')]);router[_0x1159('0xc')]('/',auth[_0x1159('0x7')](),controller[_0x1159('0xd')]);router['put'](_0x1159('0xa'),auth['isAuthenticated'](),controller[_0x1159('0xe')]);router['delete'](_0x1159('0xa'),auth[_0x1159('0x7')](),controller[_0x1159('0xf')]);module[_0x1159('0x10')]=router; \ No newline at end of file +var _0x466f=['delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./chatOfflineMessage.controller','isAuthenticated','index','get','/describe','describe','show','post','create','put','/:id'];(function(_0x46c8aa,_0x215266){var _0x5231eb=function(_0x500733){while(--_0x500733){_0x46c8aa['push'](_0x46c8aa['shift']());}};_0x5231eb(++_0x215266);}(_0x466f,0x114));var _0xf466=function(_0x514e2d,_0x5d7e17){_0x514e2d=_0x514e2d-0x0;var _0x3659f9=_0x466f[_0x514e2d];return _0x3659f9;};'use strict';var multer=require(_0xf466('0x0'));var util=require('util');var path=require(_0xf466('0x1'));var timeout=require(_0xf466('0x2'));var express=require(_0xf466('0x3'));var router=express[_0xf466('0x4')]();var fs_extra=require(_0xf466('0x5'));var auth=require(_0xf466('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xf466('0x7'));router['get']('/',auth[_0xf466('0x8')](),controller[_0xf466('0x9')]);router[_0xf466('0xa')](_0xf466('0xb'),auth[_0xf466('0x8')](),controller[_0xf466('0xc')]);router[_0xf466('0xa')]('/:id',auth[_0xf466('0x8')](),controller[_0xf466('0xd')]);router[_0xf466('0xe')]('/',auth[_0xf466('0x8')](),controller[_0xf466('0xf')]);router[_0xf466('0x10')](_0xf466('0x11'),auth['isAuthenticated'](),controller['update']);router[_0xf466('0x12')](_0xf466('0x11'),auth[_0xf466('0x8')](),controller[_0xf466('0x13')]);module[_0xf466('0x14')]=router; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.attributes.js b/server/api/chatProactiveAction/chatProactiveAction.attributes.js index 65f53bf..9127ded 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 _0x086f=['INTEGER','sequelize','exports','STRING','ENUM','mouseOver','timeout'];(function(_0x941f4b,_0x2881e4){var _0x5b4e5b=function(_0x1ab59e){while(--_0x1ab59e){_0x941f4b['push'](_0x941f4b['shift']());}};_0x5b4e5b(++_0x2881e4);}(_0x086f,0xd3));var _0xf086=function(_0x521884,_0x29a522){_0x521884=_0x521884-0x0;var _0x35d60b=_0x086f[_0x521884];return _0x35d60b;};'use strict';var Sequelize=require(_0xf086('0x0'));module[_0xf086('0x1')]={'name':{'type':Sequelize[_0xf086('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xf086('0x3')](_0xf086('0x4'),_0xf086('0x5')),'defaultValue':_0xf086('0x4')},'selector':{'type':Sequelize[_0xf086('0x2')]},'timeout':{'type':Sequelize[_0xf086('0x6')]}}; \ No newline at end of file +var _0xb02d=['STRING','ENUM','mouseOver','timeout','INTEGER'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xb02d,0xc8));var _0xdb02=function(_0x1f4427,_0x2c5101){_0x1f4427=_0x1f4427-0x0;var _0x56953d=_0xb02d[_0x1f4427];return _0x56953d;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xdb02('0x0')],'allowNull':![]},'type':{'type':Sequelize[_0xdb02('0x1')](_0xdb02('0x2'),_0xdb02('0x3')),'defaultValue':_0xdb02('0x2')},'selector':{'type':Sequelize[_0xdb02('0x0')]},'timeout':{'type':Sequelize[_0xdb02('0x4')]}}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.controller.js b/server/api/chatProactiveAction/chatProactiveAction.controller.js index bbad025..5b37605 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 _0x97d5=['catch','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','limit','offset','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','show','params','model','ChatProactiveAction','rawAttributes','query','filters','attributes','includeAll','include','merge','options','find'];(function(_0x527382,_0x15ba60){var _0x157add=function(_0x452261){while(--_0x452261){_0x527382['push'](_0x527382['shift']());}};_0x157add(++_0x15ba60);}(_0x97d5,0x199));var _0x597d=function(_0x484630,_0x24ca02){_0x484630=_0x484630-0x0;var _0x2e187e=_0x97d5[_0x484630];return _0x2e187e;};'use strict';var emlformat=require(_0x597d('0x0'));var rimraf=require(_0x597d('0x1'));var zipdir=require(_0x597d('0x2'));var jsonpatch=require(_0x597d('0x3'));var rp=require(_0x597d('0x4'));var moment=require(_0x597d('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x597d('0x6'));var util=require(_0x597d('0x7'));var path=require(_0x597d('0x8'));var sox=require('sox');var csv=require(_0x597d('0x9'));var ejs=require(_0x597d('0xa'));var fs=require('fs');var fs_extra=require(_0x597d('0xb'));var _=require(_0x597d('0xc'));var squel=require(_0x597d('0xd'));var crypto=require(_0x597d('0xe'));var jsforce=require(_0x597d('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x597d('0x9'));var querystring=require(_0x597d('0x10'));var Papa=require('papaparse');var Redis=require(_0x597d('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x597d('0x12'));var as=require(_0x597d('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x597d('0x14'));var utils=require(_0x597d('0x15'));var config=require(_0x597d('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x597d('0x17'))['db'];function respondWithStatusCode(_0x2f464a,_0x355fbd){_0x355fbd=_0x355fbd||0xcc;return function(_0x1664e5){if(_0x1664e5){return _0x2f464a[_0x597d('0x18')](_0x355fbd);}return _0x2f464a[_0x597d('0x19')](_0x355fbd)[_0x597d('0x1a')]();};}function respondWithResult(_0x465ebc,_0x810dce){_0x810dce=_0x810dce||0xc8;return function(_0x11147c){if(_0x11147c){return _0x465ebc[_0x597d('0x19')](_0x810dce)[_0x597d('0x1b')](_0x11147c);}};}function respondWithFilteredResult(_0x290db2,_0x394d1d){return function(_0x4ca1b1){if(_0x4ca1b1){var _0x17b021=typeof _0x394d1d['offset']===_0x597d('0x1c')&&typeof _0x394d1d[_0x597d('0x1d')]==='undefined';var _0x38844b=_0x4ca1b1['count'];var _0x68a5c6=_0x17b021?0x0:_0x394d1d[_0x597d('0x1e')];var _0x525f28=_0x17b021?_0x4ca1b1['count']:_0x394d1d['offset']+_0x394d1d[_0x597d('0x1d')];var _0x32717e;if(_0x525f28>=_0x38844b){_0x525f28=_0x38844b;_0x32717e=0xc8;}else{_0x32717e=0xce;}_0x290db2[_0x597d('0x19')](_0x32717e);return _0x290db2[_0x597d('0x1f')](_0x597d('0x20'),_0x68a5c6+'-'+_0x525f28+'/'+_0x38844b)[_0x597d('0x1b')](_0x4ca1b1);}return null;};}function patchUpdates(_0x4173c9){return function(_0x1f8966){try{jsonpatch[_0x597d('0x21')](_0x1f8966,_0x4173c9,!![]);}catch(_0x349d8a){return BPromise['reject'](_0x349d8a);}return _0x1f8966[_0x597d('0x22')]();};}function saveUpdates(_0x330794,_0x639ac){return function(_0x2d4e7b){if(_0x2d4e7b){return _0x2d4e7b[_0x597d('0x23')](_0x330794)[_0x597d('0x24')](function(_0x529af4){return _0x529af4;});}return null;};}function removeEntity(_0xc6ca7,_0xa0a6da){return function(_0x104476){if(_0x104476){return _0x104476[_0x597d('0x25')]()[_0x597d('0x24')](function(){_0xc6ca7['status'](0xcc)[_0x597d('0x1a')]();});}};}function handleEntityNotFound(_0x8e3c80,_0x1379a2){return function(_0x5a551f){if(!_0x5a551f){_0x8e3c80[_0x597d('0x18')](0x194);}return _0x5a551f;};}function handleError(_0x1713d1,_0x30d783){_0x30d783=_0x30d783||0x1f4;return function(_0x6f424f){logger[_0x597d('0x26')](_0x6f424f[_0x597d('0x27')]);if(_0x6f424f[_0x597d('0x28')]){delete _0x6f424f[_0x597d('0x28')];}_0x1713d1[_0x597d('0x19')](_0x30d783)[_0x597d('0x29')](_0x6f424f);};}exports[_0x597d('0x2a')]=function(_0x249e81,_0x25ffc6){var _0x2fcb0d={'raw':!![],'where':{'id':_0x249e81[_0x597d('0x2b')]['id']}},_0x106b92={};_0x106b92[_0x597d('0x2c')]=_['keys'](db[_0x597d('0x2d')][_0x597d('0x2e')]);_0x106b92['query']=_['keys'](_0x249e81[_0x597d('0x2f')]);_0x106b92[_0x597d('0x30')]=_['intersection'](_0x106b92[_0x597d('0x2c')],_0x106b92[_0x597d('0x2f')]);_0x2fcb0d[_0x597d('0x31')]=_['intersection'](_0x106b92[_0x597d('0x2c')],qs['fields'](_0x249e81[_0x597d('0x2f')]['fields']));_0x2fcb0d['attributes']=_0x2fcb0d['attributes']['length']?_0x2fcb0d['attributes']:_0x106b92[_0x597d('0x2c')];if(_0x249e81[_0x597d('0x2f')][_0x597d('0x32')]){_0x2fcb0d[_0x597d('0x33')]=[{'all':!![]}];}_0x2fcb0d=_[_0x597d('0x34')]({},_0x2fcb0d,_0x249e81[_0x597d('0x35')]);return db[_0x597d('0x2d')][_0x597d('0x36')](_0x2fcb0d)['then'](handleEntityNotFound(_0x25ffc6,null))[_0x597d('0x24')](respondWithResult(_0x25ffc6,null))[_0x597d('0x37')](handleError(_0x25ffc6,null));};exports[_0x597d('0x38')]=function(_0x2d56a1,_0x581541){return db[_0x597d('0x2d')][_0x597d('0x38')](_0x2d56a1[_0x597d('0x39')],{})[_0x597d('0x24')](respondWithResult(_0x581541,0xc9))[_0x597d('0x37')](handleError(_0x581541,null));};exports[_0x597d('0x23')]=function(_0x3807ca,_0x1cf849){if(_0x3807ca[_0x597d('0x39')]['id']){delete _0x3807ca[_0x597d('0x39')]['id'];}return db[_0x597d('0x2d')][_0x597d('0x36')]({'where':{'id':_0x3807ca[_0x597d('0x2b')]['id']}})[_0x597d('0x24')](handleEntityNotFound(_0x1cf849,null))[_0x597d('0x24')](saveUpdates(_0x3807ca[_0x597d('0x39')],null))[_0x597d('0x24')](respondWithResult(_0x1cf849,null))[_0x597d('0x37')](handleError(_0x1cf849,null));};exports[_0x597d('0x25')]=function(_0x13d8ba,_0x5b46cc){return db['ChatProactiveAction'][_0x597d('0x36')]({'where':{'id':_0x13d8ba['params']['id']}})[_0x597d('0x24')](handleEntityNotFound(_0x5b46cc,null))[_0x597d('0x24')](removeEntity(_0x5b46cc,null))['catch'](handleError(_0x5b46cc,null));}; \ No newline at end of file +var _0x7217=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','stack','send','show','params','keys','ChatProactiveAction','query','intersection','model','fields','attributes','length','includeAll','merge','find','catch','create','body','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service'];(function(_0x50748b,_0x599d6d){var _0x5688d7=function(_0xfb5d55){while(--_0xfb5d55){_0x50748b['push'](_0x50748b['shift']());}};_0x5688d7(++_0x599d6d);}(_0x7217,0x19e));var _0x7721=function(_0x2a6809,_0x44edde){_0x2a6809=_0x2a6809-0x0;var _0x11c371=_0x7217[_0x2a6809];return _0x11c371;};'use strict';var emlformat=require(_0x7721('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7721('0x1'));var jsonpatch=require(_0x7721('0x2'));var rp=require(_0x7721('0x3'));var moment=require(_0x7721('0x4'));var BPromise=require(_0x7721('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x7721('0x6'));var sox=require(_0x7721('0x7'));var csv=require(_0x7721('0x8'));var ejs=require(_0x7721('0x9'));var fs=require('fs');var fs_extra=require(_0x7721('0xa'));var _=require(_0x7721('0xb'));var squel=require(_0x7721('0xc'));var crypto=require(_0x7721('0xd'));var jsforce=require(_0x7721('0xe'));var deskjs=require(_0x7721('0xf'));var toCsv=require(_0x7721('0x8'));var querystring=require(_0x7721('0x10'));var Papa=require(_0x7721('0x11'));var Redis=require(_0x7721('0x12'));var authService=require(_0x7721('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x7721('0x14'));var hardwareService=require(_0x7721('0x15'));var logger=require(_0x7721('0x16'))(_0x7721('0x17'));var utils=require(_0x7721('0x18'));var config=require(_0x7721('0x19'));var licenseUtil=require(_0x7721('0x1a'));var db=require(_0x7721('0x1b'))['db'];function respondWithStatusCode(_0x55b4ca,_0x2911ec){_0x2911ec=_0x2911ec||0xcc;return function(_0x199930){if(_0x199930){return _0x55b4ca['sendStatus'](_0x2911ec);}return _0x55b4ca[_0x7721('0x1c')](_0x2911ec)[_0x7721('0x1d')]();};}function respondWithResult(_0x3f01c5,_0x2e9752){_0x2e9752=_0x2e9752||0xc8;return function(_0x5069da){if(_0x5069da){return _0x3f01c5[_0x7721('0x1c')](_0x2e9752)[_0x7721('0x1e')](_0x5069da);}};}function respondWithFilteredResult(_0x534f1b,_0x4e199a){return function(_0x4b183e){if(_0x4b183e){var _0x5ed54=typeof _0x4e199a[_0x7721('0x1f')]===_0x7721('0x20')&&typeof _0x4e199a[_0x7721('0x21')]==='undefined';var _0x20f669=_0x4b183e['count'];var _0x3fc09e=_0x5ed54?0x0:_0x4e199a['offset'];var _0xfec626=_0x5ed54?_0x4b183e[_0x7721('0x22')]:_0x4e199a[_0x7721('0x1f')]+_0x4e199a[_0x7721('0x21')];var _0x2286e5;if(_0xfec626>=_0x20f669){_0xfec626=_0x20f669;_0x2286e5=0xc8;}else{_0x2286e5=0xce;}_0x534f1b[_0x7721('0x1c')](_0x2286e5);return _0x534f1b[_0x7721('0x23')](_0x7721('0x24'),_0x3fc09e+'-'+_0xfec626+'/'+_0x20f669)[_0x7721('0x1e')](_0x4b183e);}return null;};}function patchUpdates(_0xaeccc4){return function(_0x4ce1db){try{jsonpatch[_0x7721('0x25')](_0x4ce1db,_0xaeccc4,!![]);}catch(_0x2c1583){return BPromise[_0x7721('0x26')](_0x2c1583);}return _0x4ce1db[_0x7721('0x27')]();};}function saveUpdates(_0x57140c,_0x28f5a6){return function(_0x512f31){if(_0x512f31){return _0x512f31[_0x7721('0x28')](_0x57140c)[_0x7721('0x29')](function(_0x3e8a4e){return _0x3e8a4e;});}return null;};}function removeEntity(_0x1caad8,_0x121cc4){return function(_0x395b15){if(_0x395b15){return _0x395b15[_0x7721('0x2a')]()['then'](function(){_0x1caad8[_0x7721('0x1c')](0xcc)[_0x7721('0x1d')]();});}};}function handleEntityNotFound(_0x125564,_0x1f67c7){return function(_0x40d550){if(!_0x40d550){_0x125564[_0x7721('0x2b')](0x194);}return _0x40d550;};}function handleError(_0x424e05,_0xf753f1){_0xf753f1=_0xf753f1||0x1f4;return function(_0x40f367){logger['error'](_0x40f367[_0x7721('0x2c')]);if(_0x40f367['name']){delete _0x40f367['name'];}_0x424e05[_0x7721('0x1c')](_0xf753f1)[_0x7721('0x2d')](_0x40f367);};}exports[_0x7721('0x2e')]=function(_0x158d98,_0x1ea4d){var _0x37b9f0={'raw':!![],'where':{'id':_0x158d98[_0x7721('0x2f')]['id']}},_0xd7d703={};_0xd7d703['model']=_[_0x7721('0x30')](db[_0x7721('0x31')]['rawAttributes']);_0xd7d703['query']=_[_0x7721('0x30')](_0x158d98[_0x7721('0x32')]);_0xd7d703['filters']=_[_0x7721('0x33')](_0xd7d703[_0x7721('0x34')],_0xd7d703[_0x7721('0x32')]);_0x37b9f0['attributes']=_[_0x7721('0x33')](_0xd7d703[_0x7721('0x34')],qs[_0x7721('0x35')](_0x158d98[_0x7721('0x32')][_0x7721('0x35')]));_0x37b9f0['attributes']=_0x37b9f0[_0x7721('0x36')][_0x7721('0x37')]?_0x37b9f0[_0x7721('0x36')]:_0xd7d703['model'];if(_0x158d98[_0x7721('0x32')][_0x7721('0x38')]){_0x37b9f0['include']=[{'all':!![]}];}_0x37b9f0=_[_0x7721('0x39')]({},_0x37b9f0,_0x158d98['options']);return db[_0x7721('0x31')][_0x7721('0x3a')](_0x37b9f0)[_0x7721('0x29')](handleEntityNotFound(_0x1ea4d,null))[_0x7721('0x29')](respondWithResult(_0x1ea4d,null))[_0x7721('0x3b')](handleError(_0x1ea4d,null));};exports[_0x7721('0x3c')]=function(_0x2f1fe0,_0x15545a){return db[_0x7721('0x31')][_0x7721('0x3c')](_0x2f1fe0[_0x7721('0x3d')],{})['then'](respondWithResult(_0x15545a,0xc9))[_0x7721('0x3b')](handleError(_0x15545a,null));};exports['update']=function(_0x212384,_0x35614c){if(_0x212384[_0x7721('0x3d')]['id']){delete _0x212384[_0x7721('0x3d')]['id'];}return db[_0x7721('0x31')][_0x7721('0x3a')]({'where':{'id':_0x212384['params']['id']}})['then'](handleEntityNotFound(_0x35614c,null))['then'](saveUpdates(_0x212384['body'],null))[_0x7721('0x29')](respondWithResult(_0x35614c,null))[_0x7721('0x3b')](handleError(_0x35614c,null));};exports[_0x7721('0x2a')]=function(_0x22ef35,_0x4a90ce){return db[_0x7721('0x31')]['find']({'where':{'id':_0x22ef35[_0x7721('0x2f')]['id']}})[_0x7721('0x29')](handleEntityNotFound(_0x4a90ce,null))['then'](removeEntity(_0x4a90ce,null))[_0x7721('0x3b')](handleError(_0x4a90ce,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index 6922b7d..2dfa5de 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 _0x1216=['exports','define','ChatProactiveAction','lodash','api','moment','bluebird','path','../../config/environment'];(function(_0x89f002,_0x576460){var _0x3e6340=function(_0x1117f4){while(--_0x1117f4){_0x89f002['push'](_0x89f002['shift']());}};_0x3e6340(++_0x576460);}(_0x1216,0x1c5));var _0x6121=function(_0x243cca,_0x514c2d){_0x243cca=_0x243cca-0x0;var _0xf94771=_0x1216[_0x243cca];return _0xf94771;};'use strict';var _=require(_0x6121('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x6121('0x1'));var moment=require(_0x6121('0x2'));var BPromise=require(_0x6121('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6121('0x4'));var rimraf=require('rimraf');var config=require(_0x6121('0x5'));var attributes=require('./chatProactiveAction.attributes');module[_0x6121('0x6')]=function(_0x48f5ab,_0x18c7bf){return _0x48f5ab[_0x6121('0x7')](_0x6121('0x8'),attributes,{'tableName':'chat_proactive_actions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf5a8=['../../config/environment','exports','define','ChatProactiveAction','chat_proactive_actions','util','../../config/logger','api','moment','bluebird','request-promise','rimraf'];(function(_0xf79bae,_0x263b2a){var _0x5d2cb7=function(_0x27c86b){while(--_0x27c86b){_0xf79bae['push'](_0xf79bae['shift']());}};_0x5d2cb7(++_0x263b2a);}(_0xf5a8,0x71));var _0x8f5a=function(_0x4d7a61,_0x3fb6e6){_0x4d7a61=_0x4d7a61-0x0;var _0x186f73=_0xf5a8[_0x4d7a61];return _0x186f73;};'use strict';var _=require('lodash');var util=require(_0x8f5a('0x0'));var logger=require(_0x8f5a('0x1'))(_0x8f5a('0x2'));var moment=require(_0x8f5a('0x3'));var BPromise=require(_0x8f5a('0x4'));var rp=require(_0x8f5a('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8f5a('0x6'));var config=require(_0x8f5a('0x7'));var attributes=require('./chatProactiveAction.attributes');module[_0x8f5a('0x8')]=function(_0x364e1c,_0x58db24){return _0x364e1c[_0x8f5a('0x9')](_0x8f5a('0xa'),attributes,{'tableName':_0x8f5a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.rpc.js b/server/api/chatProactiveAction/chatProactiveAction.rpc.js index 7e582ea..9f0a916 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 _0x3b42=['../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','then','info','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','randomstring'];(function(_0x43f631,_0x519107){var _0x241582=function(_0x3f3616){while(--_0x3f3616){_0x43f631['push'](_0x43f631['shift']());}};_0x241582(++_0x519107);}(_0x3b42,0x1a1));var _0x23b4=function(_0x1c2d05,_0x1b5545){_0x1c2d05=_0x1c2d05-0x0;var _0xcc38af=_0x3b42[_0x1c2d05];return _0xcc38af;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x23b4('0x0'));var BPromise=require(_0x23b4('0x1'));var rs=require(_0x23b4('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x23b4('0x3'))['db'];var utils=require(_0x23b4('0x4'));var logger=require(_0x23b4('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x23b4('0x6'));var client=jayson[_0x23b4('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x15bf82,_0x4fe583,_0x466075){return new BPromise(function(_0xa6a581,_0x381530){return client['request'](_0x15bf82,_0x466075)[_0x23b4('0x8')](function(_0x1451dd){logger[_0x23b4('0x9')](_0x23b4('0xa'),_0x4fe583,_0x23b4('0xb'));logger[_0x23b4('0xc')](_0x23b4('0xd'),_0x4fe583,'request\x20sent',JSON[_0x23b4('0xe')](_0x1451dd));if(_0x1451dd[_0x23b4('0xf')]){if(_0x1451dd[_0x23b4('0xf')][_0x23b4('0x10')]===0x1f4){logger[_0x23b4('0xf')]('ChatProactiveAction,\x20%s,\x20%s',_0x4fe583,_0x1451dd['error'][_0x23b4('0x11')]);return _0x381530(_0x1451dd[_0x23b4('0xf')]['message']);}logger[_0x23b4('0xf')](_0x23b4('0xa'),_0x4fe583,_0x1451dd[_0x23b4('0xf')][_0x23b4('0x11')]);return _0xa6a581(_0x1451dd['error']['message']);}else{logger[_0x23b4('0x9')](_0x23b4('0xa'),_0x4fe583,_0x23b4('0xb'));_0xa6a581(_0x1451dd[_0x23b4('0x12')][_0x23b4('0x11')]);}})[_0x23b4('0x13')](function(_0x5ea951){logger[_0x23b4('0xf')](_0x23b4('0xa'),_0x4fe583,_0x5ea951);_0x381530(_0x5ea951);});});} \ No newline at end of file +var _0xc36b=['util','moment','bluebird','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','then','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch'];(function(_0x1306e9,_0x4fd1ce){var _0x15eafb=function(_0x16ebed){while(--_0x16ebed){_0x1306e9['push'](_0x1306e9['shift']());}};_0x15eafb(++_0x4fd1ce);}(_0xc36b,0x190));var _0xbc36=function(_0xfebe8f,_0x54af65){_0xfebe8f=_0xfebe8f-0x0;var _0x4c33a5=_0xc36b[_0xfebe8f];return _0x4c33a5;};'use strict';var _=require('lodash');var util=require(_0xbc36('0x0'));var moment=require(_0xbc36('0x1'));var BPromise=require(_0xbc36('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbc36('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xbc36('0x4'));var logger=require('../../config/logger')(_0xbc36('0x5'));var config=require(_0xbc36('0x6'));var jayson=require(_0xbc36('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x227380,_0x4d3629,_0x3f5bd6){return new BPromise(function(_0xd35713,_0x34f560){return client['request'](_0x227380,_0x3f5bd6)[_0xbc36('0x8')](function(_0xada406){logger['info'](_0xbc36('0x9'),_0x4d3629,_0xbc36('0xa'));logger[_0xbc36('0xb')](_0xbc36('0xc'),_0x4d3629,_0xbc36('0xa'),JSON[_0xbc36('0xd')](_0xada406));if(_0xada406['error']){if(_0xada406[_0xbc36('0xe')][_0xbc36('0xf')]===0x1f4){logger[_0xbc36('0xe')]('ChatProactiveAction,\x20%s,\x20%s',_0x4d3629,_0xada406['error']['message']);return _0x34f560(_0xada406[_0xbc36('0xe')]['message']);}logger[_0xbc36('0xe')](_0xbc36('0x9'),_0x4d3629,_0xada406[_0xbc36('0xe')][_0xbc36('0x10')]);return _0xd35713(_0xada406[_0xbc36('0xe')][_0xbc36('0x10')]);}else{logger[_0xbc36('0x11')](_0xbc36('0x9'),_0x4d3629,_0xbc36('0xa'));_0xd35713(_0xada406[_0xbc36('0x12')][_0xbc36('0x10')]);}})[_0xbc36('0x13')](function(_0x4f3dad){logger[_0xbc36('0xe')](_0xbc36('0x9'),_0x4d3629,_0x4f3dad);_0x34f560(_0x4f3dad);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index be2f198..a8f121f 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 _0xeda8=['get','/:id','isAuthenticated','show','create','put','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatProactiveAction.controller'];(function(_0x4b8aa8,_0x44d6b8){var _0x1467fe=function(_0x440908){while(--_0x440908){_0x4b8aa8['push'](_0x4b8aa8['shift']());}};_0x1467fe(++_0x44d6b8);}(_0xeda8,0x104));var _0x8eda=function(_0x26631e,_0x52ea53){_0x26631e=_0x26631e-0x0;var _0x19dafd=_0xeda8[_0x26631e];return _0x19dafd;};'use strict';var multer=require(_0x8eda('0x0'));var util=require(_0x8eda('0x1'));var path=require('path');var timeout=require(_0x8eda('0x2'));var express=require(_0x8eda('0x3'));var router=express[_0x8eda('0x4')]();var fs_extra=require(_0x8eda('0x5'));var auth=require(_0x8eda('0x6'));var interaction=require(_0x8eda('0x7'));var config=require(_0x8eda('0x8'));var controller=require(_0x8eda('0x9'));router[_0x8eda('0xa')](_0x8eda('0xb'),auth[_0x8eda('0xc')](),controller[_0x8eda('0xd')]);router['post']('/',auth[_0x8eda('0xc')](),controller[_0x8eda('0xe')]);router[_0x8eda('0xf')](_0x8eda('0xb'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0x8eda('0xc')](),controller[_0x8eda('0x10')]);module[_0x8eda('0x11')]=router; \ No newline at end of file +var _0xdbf5=['post','put','update','delete','destroy','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatProactiveAction.controller','get','/:id','isAuthenticated','show'];(function(_0x25044f,_0x28a04a){var _0xaace9c=function(_0x209204){while(--_0x209204){_0x25044f['push'](_0x25044f['shift']());}};_0xaace9c(++_0x28a04a);}(_0xdbf5,0x18c));var _0x5dbf=function(_0x340982,_0xa465f6){_0x340982=_0x340982-0x0;var _0x289d44=_0xdbf5[_0x340982];return _0x289d44;};'use strict';var multer=require('multer');var util=require(_0x5dbf('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x5dbf('0x1'));var router=express[_0x5dbf('0x2')]();var fs_extra=require(_0x5dbf('0x3'));var auth=require(_0x5dbf('0x4'));var interaction=require(_0x5dbf('0x5'));var config=require(_0x5dbf('0x6'));var controller=require(_0x5dbf('0x7'));router[_0x5dbf('0x8')](_0x5dbf('0x9'),auth[_0x5dbf('0xa')](),controller[_0x5dbf('0xb')]);router[_0x5dbf('0xc')]('/',auth[_0x5dbf('0xa')](),controller['create']);router[_0x5dbf('0xd')]('/:id',auth[_0x5dbf('0xa')](),controller[_0x5dbf('0xe')]);router[_0x5dbf('0xf')](_0x5dbf('0x9'),auth['isAuthenticated'](),controller[_0x5dbf('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.attributes.js b/server/api/chatQueue/chatQueue.attributes.js index fd55b5e..97db6b2 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 _0xb767=['name','INTEGER','ENUM','rrmemory','beepall','roundrobin','sequelize','exports','STRING'];(function(_0x5eef05,_0x1be989){var _0x56d4b8=function(_0x57993d){while(--_0x57993d){_0x5eef05['push'](_0x5eef05['shift']());}};_0x56d4b8(++_0x1be989);}(_0xb767,0x1bf));var _0x7b76=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xb767[_0x122ef9];return _0x42fba0;};'use strict';var Sequelize=require(_0x7b76('0x0'));module[_0x7b76('0x1')]={'name':{'type':Sequelize[_0x7b76('0x2')],'unique':_0x7b76('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x7b76('0x2')]},'timeout':{'type':Sequelize[_0x7b76('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x7b76('0x5')](_0x7b76('0x6'),_0x7b76('0x7'),_0x7b76('0x8'))}}; \ No newline at end of file +var _0xde65=['name','INTEGER','ENUM','rrmemory','beepall','roundrobin','STRING'];(function(_0x4fc5df,_0x3acaab){var _0x4a18f5=function(_0x241409){while(--_0x241409){_0x4fc5df['push'](_0x4fc5df['shift']());}};_0x4a18f5(++_0x3acaab);}(_0xde65,0x1b8));var _0x5de6=function(_0x2c9f4a,_0x4871e7){_0x2c9f4a=_0x2c9f4a-0x0;var _0xad8d0f=_0xde65[_0x2c9f4a];return _0xad8d0f;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x5de6('0x0')],'unique':_0x5de6('0x1'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x5de6('0x0')]},'timeout':{'type':Sequelize[_0x5de6('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x5de6('0x3')](_0x5de6('0x4'),_0x5de6('0x5'),_0x5de6('0x6'))}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index dbf581c..ab42629 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 _0x4adb=['end','json','undefined','count','offset','limit','set','Content-Range','reject','save','update','destroy','ChatQueues','UserProfileResource','stack','name','send','index','fieldName','type','key','map','query','keys','intersection','model','fields','attributes','length','nolimit','sort','where','filters','merge','VIRTUAL','filter','options','includeAll','include','ChatQueue','rows','show','params','rawAttributes','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','describe','getMembers','findOne','UserChatQueue','hasOwnProperty','order','pick','findAll','User','agent','updatedAt','createdAt','format','%s/%s','SIP','chatPause','getTeams','Team','addTeams','ids','Agents','voicePause','transaction','each','findOrCreate','forEach','userChatQueue:save','removeTeams','select','field','tq.TeamId','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','all','union','value','sequelize','isEmpty','emit','userChatQueue:remove','addAgents','omit','spread','removeAgents','getAgents','eml-format','zip-dir','request-promise','moment','mustache','util','sox','ejs','lodash','jsforce','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatQueue.socket','register','jayson/promise','client','http','request','then','info','ChatQueue,\x20%s,\x20%s','request\x20sent','ChatQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status'];(function(_0x124298,_0x542004){var _0x35ac24=function(_0x49afe8){while(--_0x49afe8){_0x124298['push'](_0x124298['shift']());}};_0x35ac24(++_0x542004);}(_0x4adb,0x105));var _0xb4ad=function(_0x4f44b1,_0x3598cc){_0x4f44b1=_0x4f44b1-0x0;var _0x38ba9e=_0x4adb[_0x4f44b1];return _0x38ba9e;};'use strict';var emlformat=require(_0xb4ad('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb4ad('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb4ad('0x2'));var moment=require(_0xb4ad('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xb4ad('0x4'));var util=require(_0xb4ad('0x5'));var path=require('path');var sox=require(_0xb4ad('0x6'));var csv=require('to-csv');var ejs=require(_0xb4ad('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb4ad('0x8'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xb4ad('0x9'));var deskjs=require('desk.js');var toCsv=require(_0xb4ad('0xa'));var querystring=require(_0xb4ad('0xb'));var Papa=require('papaparse');var Redis=require(_0xb4ad('0xc'));var authService=require(_0xb4ad('0xd'));var qs=require(_0xb4ad('0xe'));var as=require(_0xb4ad('0xf'));var hardwareService=require(_0xb4ad('0x10'));var logger=require(_0xb4ad('0x11'))(_0xb4ad('0x12'));var utils=require(_0xb4ad('0x13'));var config=require(_0xb4ad('0x14'));var licenseUtil=require(_0xb4ad('0x15'));var db=require(_0xb4ad('0x16'))['db'];config[_0xb4ad('0x17')]=_[_0xb4ad('0x18')](config[_0xb4ad('0x17')],{'host':_0xb4ad('0x19'),'port':0x18eb});var socket=require(_0xb4ad('0x1a'))(new Redis(config[_0xb4ad('0x17')]));require(_0xb4ad('0x1b'))[_0xb4ad('0x1c')](socket);var jayson=require(_0xb4ad('0x1d'));var client=jayson[_0xb4ad('0x1e')][_0xb4ad('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x2400f,_0x3f89f7,_0x1ae24e,_0x278451){return new BPromise(function(_0x2f7824,_0x31f6d3){var _0x2a22a0=_0x278451||client;return _0x2a22a0[_0xb4ad('0x20')](_0x2400f,_0x1ae24e)[_0xb4ad('0x21')](function(_0x1de2cb){logger[_0xb4ad('0x22')](_0xb4ad('0x23'),_0x3f89f7,_0xb4ad('0x24'));logger['debug'](_0xb4ad('0x25'),_0x3f89f7,'request\x20sent',JSON['stringify'](_0x1de2cb));if(_0x1de2cb['error']){if(_0x1de2cb[_0xb4ad('0x26')][_0xb4ad('0x27')]===0x1f4){logger[_0xb4ad('0x26')]('ChatQueue,\x20%s,\x20%s',_0x3f89f7,_0x1de2cb['error'][_0xb4ad('0x28')]);return _0x31f6d3(_0x1de2cb[_0xb4ad('0x26')]['message']);}logger[_0xb4ad('0x26')](_0xb4ad('0x23'),_0x3f89f7,_0x1de2cb[_0xb4ad('0x26')][_0xb4ad('0x28')]);return _0x2f7824(_0x1de2cb['error'][_0xb4ad('0x28')]);}else{logger['info'](_0xb4ad('0x23'),_0x3f89f7,'request\x20sent');_0x2f7824(_0x1de2cb[_0xb4ad('0x29')][_0xb4ad('0x28')]);}})[_0xb4ad('0x2a')](function(_0x515815){logger[_0xb4ad('0x26')]('ChatQueue,\x20%s,\x20%s',_0x3f89f7,_0x515815);_0x31f6d3(_0x515815);});});}function respondWithStatusCode(_0x3fec40,_0x4204b3){_0x4204b3=_0x4204b3||0xcc;return function(_0x359c18){if(_0x359c18){return _0x3fec40[_0xb4ad('0x2b')](_0x4204b3);}return _0x3fec40[_0xb4ad('0x2c')](_0x4204b3)[_0xb4ad('0x2d')]();};}function respondWithResult(_0x4ec5cc,_0x28b5d7){_0x28b5d7=_0x28b5d7||0xc8;return function(_0x757a03){if(_0x757a03){return _0x4ec5cc['status'](_0x28b5d7)[_0xb4ad('0x2e')](_0x757a03);}};}function respondWithFilteredResult(_0xde5ea3,_0x2684fe){return function(_0x4c94d2){if(_0x4c94d2){var _0x280931=typeof _0x2684fe['offset']===_0xb4ad('0x2f')&&typeof _0x2684fe['limit']==='undefined';var _0x235be6=_0x4c94d2['count'];var _0x319a4d=_0x280931?0x0:_0x2684fe['offset'];var _0x457538=_0x280931?_0x4c94d2[_0xb4ad('0x30')]:_0x2684fe[_0xb4ad('0x31')]+_0x2684fe[_0xb4ad('0x32')];var _0x587fc4;if(_0x457538>=_0x235be6){_0x457538=_0x235be6;_0x587fc4=0xc8;}else{_0x587fc4=0xce;}_0xde5ea3[_0xb4ad('0x2c')](_0x587fc4);return _0xde5ea3[_0xb4ad('0x33')](_0xb4ad('0x34'),_0x319a4d+'-'+_0x457538+'/'+_0x235be6)['json'](_0x4c94d2);}return null;};}function patchUpdates(_0x3b6a8c){return function(_0x296880){try{jsonpatch['apply'](_0x296880,_0x3b6a8c,!![]);}catch(_0x56db03){return BPromise[_0xb4ad('0x35')](_0x56db03);}return _0x296880[_0xb4ad('0x36')]();};}function saveUpdates(_0x67ebfd,_0x5c2142){return function(_0x132e6c){if(_0x132e6c){return _0x132e6c[_0xb4ad('0x37')](_0x67ebfd)[_0xb4ad('0x21')](function(_0x35a6af){return _0x35a6af;});}return null;};}function removeEntity(_0x57c7c8,_0x288514){return function(_0x4cbaf8){if(_0x4cbaf8){return _0x4cbaf8[_0xb4ad('0x38')]()['then'](function(){var _0x111ec6=_0x4cbaf8['get']({'plain':!![]});var _0x1d8ff4=_0xb4ad('0x39');return db[_0xb4ad('0x3a')]['destroy']({'where':{'type':_0x1d8ff4,'resourceId':_0x111ec6['id']}})[_0xb4ad('0x21')](function(){return _0x4cbaf8;});})[_0xb4ad('0x21')](function(){_0x57c7c8[_0xb4ad('0x2c')](0xcc)[_0xb4ad('0x2d')]();});}};}function handleEntityNotFound(_0x102b7a,_0xf061bc){return function(_0x3a5d88){if(!_0x3a5d88){_0x102b7a[_0xb4ad('0x2b')](0x194);}return _0x3a5d88;};}function handleError(_0x33b6e9,_0x41a94d){_0x41a94d=_0x41a94d||0x1f4;return function(_0x149103){logger[_0xb4ad('0x26')](_0x149103[_0xb4ad('0x3b')]);if(_0x149103[_0xb4ad('0x3c')]){delete _0x149103[_0xb4ad('0x3c')];}_0x33b6e9[_0xb4ad('0x2c')](_0x41a94d)[_0xb4ad('0x3d')](_0x149103);};}exports[_0xb4ad('0x3e')]=function(_0x8bad9d,_0x5cb5dd){var _0x192b28={},_0x539c8b={},_0x1501ed={'count':0x0,'rows':[]};var _0xb17a47=_['map'](db['ChatQueue']['rawAttributes'],function(_0x51fc96){return{'name':_0x51fc96[_0xb4ad('0x3f')],'type':_0x51fc96[_0xb4ad('0x40')][_0xb4ad('0x41')]};});_0x539c8b['model']=_[_0xb4ad('0x42')](_0xb17a47,_0xb4ad('0x3c'));_0x539c8b[_0xb4ad('0x43')]=_[_0xb4ad('0x44')](_0x8bad9d[_0xb4ad('0x43')]);_0x539c8b['filters']=_[_0xb4ad('0x45')](_0x539c8b['model'],_0x539c8b['query']);_0x192b28['attributes']=_[_0xb4ad('0x45')](_0x539c8b[_0xb4ad('0x46')],qs[_0xb4ad('0x47')](_0x8bad9d[_0xb4ad('0x43')]['fields']));_0x192b28[_0xb4ad('0x48')]=_0x192b28[_0xb4ad('0x48')][_0xb4ad('0x49')]?_0x192b28[_0xb4ad('0x48')]:_0x539c8b[_0xb4ad('0x46')];if(!_0x8bad9d[_0xb4ad('0x43')]['hasOwnProperty'](_0xb4ad('0x4a'))){_0x192b28[_0xb4ad('0x32')]=qs[_0xb4ad('0x32')](_0x8bad9d[_0xb4ad('0x43')][_0xb4ad('0x32')]);_0x192b28[_0xb4ad('0x31')]=qs['offset'](_0x8bad9d['query']['offset']);}_0x192b28['order']=qs['sort'](_0x8bad9d[_0xb4ad('0x43')][_0xb4ad('0x4b')]);_0x192b28[_0xb4ad('0x4c')]=qs[_0xb4ad('0x4d')](_['pick'](_0x8bad9d['query'],_0x539c8b[_0xb4ad('0x4d')]),_0xb17a47);if(_0x8bad9d[_0xb4ad('0x43')]['filter']){_0x192b28[_0xb4ad('0x4c')]=_[_0xb4ad('0x4e')](_0x192b28[_0xb4ad('0x4c')],{'$or':_[_0xb4ad('0x42')](_0xb17a47,function(_0x18d90e){if(_0x18d90e[_0xb4ad('0x40')]!==_0xb4ad('0x4f')){var _0x57df88={};_0x57df88[_0x18d90e[_0xb4ad('0x3c')]]={'$like':'%'+_0x8bad9d[_0xb4ad('0x43')][_0xb4ad('0x50')]+'%'};return _0x57df88;}})});}_0x192b28=_[_0xb4ad('0x4e')]({},_0x192b28,_0x8bad9d[_0xb4ad('0x51')]);var _0x4e7ac2={'where':_0x192b28[_0xb4ad('0x4c')]};return db['ChatQueue']['count'](_0x4e7ac2)['then'](function(_0x4519e9){_0x1501ed[_0xb4ad('0x30')]=_0x4519e9;if(_0x8bad9d[_0xb4ad('0x43')][_0xb4ad('0x52')]){_0x192b28[_0xb4ad('0x53')]=[{'all':!![]}];}return db[_0xb4ad('0x54')]['findAll'](_0x192b28);})[_0xb4ad('0x21')](function(_0x3ee04d){_0x1501ed[_0xb4ad('0x55')]=_0x3ee04d;return _0x1501ed;})['then'](respondWithFilteredResult(_0x5cb5dd,_0x192b28))['catch'](handleError(_0x5cb5dd,null));};exports[_0xb4ad('0x56')]=function(_0x569489,_0x58765b){var _0x37cef5={'raw':!![],'where':{'id':_0x569489[_0xb4ad('0x57')]['id']}},_0x33e338={};_0x33e338[_0xb4ad('0x46')]=_[_0xb4ad('0x44')](db[_0xb4ad('0x54')][_0xb4ad('0x58')]);_0x33e338[_0xb4ad('0x43')]=_['keys'](_0x569489[_0xb4ad('0x43')]);_0x33e338[_0xb4ad('0x4d')]=_['intersection'](_0x33e338[_0xb4ad('0x46')],_0x33e338[_0xb4ad('0x43')]);_0x37cef5[_0xb4ad('0x48')]=_[_0xb4ad('0x45')](_0x33e338[_0xb4ad('0x46')],qs[_0xb4ad('0x47')](_0x569489[_0xb4ad('0x43')][_0xb4ad('0x47')]));_0x37cef5[_0xb4ad('0x48')]=_0x37cef5['attributes'][_0xb4ad('0x49')]?_0x37cef5[_0xb4ad('0x48')]:_0x33e338['model'];if(_0x569489[_0xb4ad('0x43')][_0xb4ad('0x52')]){_0x37cef5[_0xb4ad('0x53')]=[{'all':!![]}];}_0x37cef5=_[_0xb4ad('0x4e')]({},_0x37cef5,_0x569489[_0xb4ad('0x51')]);return db[_0xb4ad('0x54')]['find'](_0x37cef5)[_0xb4ad('0x21')](handleEntityNotFound(_0x58765b,null))[_0xb4ad('0x21')](respondWithResult(_0x58765b,null))[_0xb4ad('0x2a')](handleError(_0x58765b,null));};exports[_0xb4ad('0x59')]=function(_0x283b88,_0x320ab4){return db['ChatQueue'][_0xb4ad('0x59')](_0x283b88[_0xb4ad('0x5a')],{})['then'](function(_0x468686){var _0x4e97d3=_0x283b88[_0xb4ad('0x5b')][_0xb4ad('0x5c')]({'plain':!![]});if(!_0x4e97d3)throw new Error(_0xb4ad('0x5d'));if(_0x4e97d3[_0xb4ad('0x5e')]===_0xb4ad('0x5b')){var _0x5c9d64=_0x468686[_0xb4ad('0x5c')]({'plain':!![]});var _0x5bb9dc=_0xb4ad('0x39');return db[_0xb4ad('0x5f')][_0xb4ad('0x60')]({'where':{'name':_0x5bb9dc,'userProfileId':_0x4e97d3[_0xb4ad('0x61')]},'raw':!![]})[_0xb4ad('0x21')](function(_0x3f2603){if(_0x3f2603&&_0x3f2603[_0xb4ad('0x62')]===0x0){return db[_0xb4ad('0x3a')][_0xb4ad('0x59')]({'name':_0x5c9d64[_0xb4ad('0x3c')],'resourceId':_0x5c9d64['id'],'type':_0x3f2603[_0xb4ad('0x3c')],'sectionId':_0x3f2603['id']},{})[_0xb4ad('0x21')](function(){return _0x468686;});}else{return _0x468686;}})['catch'](function(_0x3f3111){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3f3111);throw _0x3f3111;});}return _0x468686;})[_0xb4ad('0x21')](respondWithResult(_0x320ab4,0xc9))[_0xb4ad('0x2a')](handleError(_0x320ab4,null));};exports[_0xb4ad('0x37')]=function(_0x50b3d9,_0x7a3be7){if(_0x50b3d9[_0xb4ad('0x5a')]['id']){delete _0x50b3d9['body']['id'];}return db[_0xb4ad('0x54')][_0xb4ad('0x60')]({'where':{'id':_0x50b3d9[_0xb4ad('0x57')]['id']}})[_0xb4ad('0x21')](handleEntityNotFound(_0x7a3be7,null))['then'](saveUpdates(_0x50b3d9[_0xb4ad('0x5a')],null))[_0xb4ad('0x21')](respondWithResult(_0x7a3be7,null))[_0xb4ad('0x2a')](handleError(_0x7a3be7,null));};exports['destroy']=function(_0x9fac7d,_0x5f2726){return db['ChatQueue'][_0xb4ad('0x60')]({'where':{'id':_0x9fac7d['params']['id']}})[_0xb4ad('0x21')](handleEntityNotFound(_0x5f2726,null))['then'](removeEntity(_0x5f2726,null))[_0xb4ad('0x2a')](handleError(_0x5f2726,null));};exports[_0xb4ad('0x63')]=function(_0x2862e6,_0x3b3d71){return db[_0xb4ad('0x54')][_0xb4ad('0x63')]()[_0xb4ad('0x21')](respondWithResult(_0x3b3d71,null))[_0xb4ad('0x2a')](handleError(_0x3b3d71,null));};exports[_0xb4ad('0x64')]=function(_0x3bbbd5,_0x51b7da,_0x46fdab){var _0x28544f={'raw':!![],'where':{}},_0x54a7e7={},_0x29cd8d;return db[_0xb4ad('0x54')][_0xb4ad('0x65')]({'where':{'id':_0x3bbbd5['params']['id']}})[_0xb4ad('0x21')](handleEntityNotFound(_0x51b7da,null))[_0xb4ad('0x21')](function(_0x33cd37){if(_0x33cd37){_0x29cd8d=_0x33cd37[_0xb4ad('0x5c')]({'plain':!![]});_0x54a7e7[_0xb4ad('0x46')]=_[_0xb4ad('0x44')](db[_0xb4ad('0x66')]['rawAttributes']);_0x54a7e7[_0xb4ad('0x43')]=_[_0xb4ad('0x44')](_0x3bbbd5['query']);_0x54a7e7['filters']=_[_0xb4ad('0x45')](_0x54a7e7['model'],_0x54a7e7[_0xb4ad('0x43')]);_0x28544f[_0xb4ad('0x48')]=_['intersection'](_0x54a7e7[_0xb4ad('0x46')],qs[_0xb4ad('0x47')](_0x3bbbd5[_0xb4ad('0x43')][_0xb4ad('0x47')]));_0x28544f[_0xb4ad('0x48')]=_0x28544f['attributes']['length']?_0x28544f[_0xb4ad('0x48')]:_0x54a7e7[_0xb4ad('0x46')];if(!_0x3bbbd5['query'][_0xb4ad('0x67')](_0xb4ad('0x4a'))){_0x28544f[_0xb4ad('0x32')]=qs[_0xb4ad('0x32')](_0x3bbbd5[_0xb4ad('0x43')][_0xb4ad('0x32')]);_0x28544f[_0xb4ad('0x31')]=qs['offset'](_0x3bbbd5['query']['offset']);}_0x28544f[_0xb4ad('0x68')]=qs['sort'](_0x3bbbd5['query']['sort']);_0x28544f['where']=qs['filters'](_[_0xb4ad('0x69')](_0x3bbbd5[_0xb4ad('0x43')],_0x54a7e7[_0xb4ad('0x4d')]));_0x28544f[_0xb4ad('0x4c')]['ChatQueueId']=_0x33cd37['id'];if(_0x3bbbd5[_0xb4ad('0x43')][_0xb4ad('0x50')]){_0x28544f[_0xb4ad('0x4c')]=_[_0xb4ad('0x4e')](_0x28544f[_0xb4ad('0x4c')],{'$or':_[_0xb4ad('0x42')](_0x28544f['attributes'],function(_0x4cc63d){var _0x2954c2={};_0x2954c2[_0x4cc63d]={'$like':'%'+_0x3bbbd5[_0xb4ad('0x43')][_0xb4ad('0x50')]+'%'};return _0x2954c2;})});}_0x28544f=_[_0xb4ad('0x4e')]({},_0x28544f,_0x3bbbd5[_0xb4ad('0x51')]);return db[_0xb4ad('0x66')][_0xb4ad('0x6a')](_0x28544f);}})[_0xb4ad('0x21')](function(_0x4f2e56){if(_0x4f2e56){return db[_0xb4ad('0x6b')]['findAndCountAll']({'where':{'id':_[_0xb4ad('0x42')](_0x4f2e56,'UserId'),'role':_0xb4ad('0x6c')},'attributes':['id',_0xb4ad('0x3c'),'chatPause',_0xb4ad('0x6d'),_0xb4ad('0x6e')]});}})[_0xb4ad('0x21')](function(_0x5bc72c){if(_0x5bc72c){return{'count':_0x5bc72c['count'],'rows':_[_0xb4ad('0x42')](_0x5bc72c[_0xb4ad('0x55')],function(_0x13359b){return{'membername':_0x13359b['name'],'UserId':_0x13359b['id'],'queue_name':_0x29cd8d[_0xb4ad('0x3c')],'ChatQueueId':_0x29cd8d['id'],'interface':util[_0xb4ad('0x6f')](_0xb4ad('0x70'),_0xb4ad('0x71'),_0x13359b['name']),'penalty':0x0,'paused':_0x13359b[_0xb4ad('0x72')],'createdAt':_0x13359b[_0xb4ad('0x6e')],'updatedAt':_0x13359b[_0xb4ad('0x6d')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xb4ad('0x21')](respondWithFilteredResult(_0x51b7da,_0x28544f))[_0xb4ad('0x2a')](handleError(_0x51b7da,null));};exports[_0xb4ad('0x73')]=function(_0x281537,_0x189910,_0x43271f){var _0x464207={};var _0x315714={};var _0x1ff24c;var _0x32c412;return db[_0xb4ad('0x54')]['findOne']({'where':{'id':_0x281537[_0xb4ad('0x57')]['id']}})['then'](handleEntityNotFound(_0x189910,null))[_0xb4ad('0x21')](function(_0x69559a){if(_0x69559a){_0x1ff24c=_0x69559a;_0x315714[_0xb4ad('0x46')]=_[_0xb4ad('0x44')](db[_0xb4ad('0x74')][_0xb4ad('0x58')]);_0x315714[_0xb4ad('0x43')]=_[_0xb4ad('0x44')](_0x281537[_0xb4ad('0x43')]);_0x315714[_0xb4ad('0x4d')]=_[_0xb4ad('0x45')](_0x315714['model'],_0x315714[_0xb4ad('0x43')]);_0x464207['attributes']=_[_0xb4ad('0x45')](_0x315714[_0xb4ad('0x46')],qs[_0xb4ad('0x47')](_0x281537[_0xb4ad('0x43')][_0xb4ad('0x47')]));_0x464207[_0xb4ad('0x48')]=_0x464207[_0xb4ad('0x48')][_0xb4ad('0x49')]?_0x464207[_0xb4ad('0x48')]:_0x315714[_0xb4ad('0x46')];_0x464207[_0xb4ad('0x68')]=qs[_0xb4ad('0x4b')](_0x281537[_0xb4ad('0x43')]['sort']);_0x464207[_0xb4ad('0x4c')]=qs[_0xb4ad('0x4d')](_[_0xb4ad('0x69')](_0x281537[_0xb4ad('0x43')],_0x315714[_0xb4ad('0x4d')]));if(_0x281537[_0xb4ad('0x43')][_0xb4ad('0x50')]){_0x464207[_0xb4ad('0x4c')]=_[_0xb4ad('0x4e')](_0x464207[_0xb4ad('0x4c')],{'$or':_[_0xb4ad('0x42')](_0x464207[_0xb4ad('0x48')],function(_0x4049e5){var _0x2c9d33={};_0x2c9d33[_0x4049e5]={'$like':'%'+_0x281537[_0xb4ad('0x43')][_0xb4ad('0x50')]+'%'};return _0x2c9d33;})});}_0x464207=_[_0xb4ad('0x4e')]({},_0x464207,_0x281537[_0xb4ad('0x51')]);return _0x1ff24c[_0xb4ad('0x73')](_0x464207);}})[_0xb4ad('0x21')](function(_0x47ae6a){if(_0x47ae6a){_0x32c412=_0x47ae6a[_0xb4ad('0x49')];if(!_0x281537[_0xb4ad('0x43')][_0xb4ad('0x67')](_0xb4ad('0x4a'))){_0x464207[_0xb4ad('0x32')]=qs[_0xb4ad('0x32')](_0x281537[_0xb4ad('0x43')][_0xb4ad('0x32')]);_0x464207['offset']=qs['offset'](_0x281537[_0xb4ad('0x43')][_0xb4ad('0x31')]);}return _0x1ff24c[_0xb4ad('0x73')](_0x464207);}})['then'](function(_0x14ed3d){if(_0x14ed3d){return _0x14ed3d?{'count':_0x32c412,'rows':_0x14ed3d}:null;}})[_0xb4ad('0x21')](respondWithResult(_0x189910,null))['catch'](handleError(_0x189910,null));};exports[_0xb4ad('0x75')]=function(_0x2303b7,_0x4e0e07,_0x5baca3){var _0x1bb472=_0x2303b7[_0xb4ad('0x5a')][_0xb4ad('0x76')];return db[_0xb4ad('0x74')]['findAll']({'where':{'id':_0x1bb472},'attributes':['id'],'include':[{'model':db['User'],'as':_0xb4ad('0x77'),'attributes':['id',_0xb4ad('0x3c'),'online',_0xb4ad('0x78'),'interface'],'raw':!![]}]})[_0xb4ad('0x21')](function(_0x5147a7){if(_0x5147a7){var _0xf4ef09=_['flatMap'](_0x5147a7,function(_0x1407b8){var _0x3202e4=_0x1407b8['get']({'plain':!![]});return _0x3202e4['Agents'];});return db['ChatQueue']['find']({'where':{'id':_0x2303b7[_0xb4ad('0x57')]['id']}})['then'](function(_0x302d79){return db['sequelize'][_0xb4ad('0x79')](function(_0x1c1603){return _0x302d79[_0xb4ad('0x75')](_0x1bb472,{'transaction':_0x1c1603})[_0xb4ad('0x21')](function(){return BPromise[_0xb4ad('0x7a')](_0xf4ef09,function(_0x31264a){return db[_0xb4ad('0x66')][_0xb4ad('0x7b')]({'where':{'UserId':_0x31264a['id'],'ChatQueueId':_0x2303b7[_0xb4ad('0x57')]['id']},'transaction':_0x1c1603});});})[_0xb4ad('0x21')](function(){_0xf4ef09[_0xb4ad('0x7c')](function(_0xc52cb8){socket['emit'](_0xb4ad('0x7d'),{'UserId':_0xc52cb8['id'],'ChatQueueId':_0x302d79['id']});});});});});}})[_0xb4ad('0x21')](respondWithStatusCode(_0x4e0e07,null))[_0xb4ad('0x2a')](handleError(_0x4e0e07,null));};exports[_0xb4ad('0x7e')]=function(_0x40b8b0,_0x44cbaa,_0x1ba239){return db[_0xb4ad('0x74')][_0xb4ad('0x6a')]({'where':{'id':_0x40b8b0[_0xb4ad('0x43')]['ids']},'attributes':['id'],'include':[{'model':db[_0xb4ad('0x6b')],'as':_0xb4ad('0x77'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x44cbaa,null))[_0xb4ad('0x21')](function(_0x20f493){var _0x26230a=_['map'](_0x20f493,'id');var _0x48ac9b=[];var _0x30ef30=[];var _0x21fd29=squel[_0xb4ad('0x7f')]();_0x21fd29[_0xb4ad('0x80')](_0xb4ad('0x81'))[_0xb4ad('0x82')]('team_has_chat_queues','tq')[_0xb4ad('0x83')](_0xb4ad('0x84'),'ut',_0xb4ad('0x85'))[_0xb4ad('0x4c')](_0xb4ad('0x86'),_0x40b8b0[_0xb4ad('0x57')]['id']);for(var _0x5051de=0x0;_0x5051de<_0x20f493[_0xb4ad('0x49')];_0x5051de+=0x1){let _0x4a7783=_0x20f493[_0x5051de];for(var _0x37c351=0x0;_0x37c351<_0x4a7783[_0xb4ad('0x77')][_0xb4ad('0x49')];_0x37c351+=0x1){let _0x3e0acd=_0x4a7783['Agents'][_0x37c351];var _0x3fbbff=_0x21fd29['clone']();_0x3fbbff[_0xb4ad('0x4c')]('ut.UserId\x20=\x20?',_0x3e0acd['id']);_0x30ef30[_0xb4ad('0x87')](db['sequelize'][_0xb4ad('0x43')](_0x3fbbff[_0xb4ad('0x88')](),{'type':db['sequelize'][_0xb4ad('0x89')][_0xb4ad('0x8a')]})['then'](function(_0x1aeb2a){if(_0x1aeb2a[_0xb4ad('0x49')]===0x1){return _0x3e0acd['id'];}else{var _0x93cc98=_[_0xb4ad('0x8b')](_[_0xb4ad('0x42')](_0x1aeb2a,_0xb4ad('0x8c')),function(_0x27daa4){return _['includes'](_0x26230a,_0x27daa4);});if(_0x93cc98){return _0x3e0acd['id'];}}}));}}return BPromise[_0xb4ad('0x8d')](_0x30ef30)[_0xb4ad('0x21')](function(_0x18106a){_0x48ac9b=_(_0x48ac9b)[_0xb4ad('0x8e')](_0x18106a)['compact']()[_0xb4ad('0x8f')]();return db[_0xb4ad('0x54')]['find']({'where':{'id':_0x40b8b0[_0xb4ad('0x57')]['id']}})[_0xb4ad('0x21')](function(_0x4caeb3){return db[_0xb4ad('0x90')][_0xb4ad('0x79')](function(_0x2fcf95){return _0x4caeb3['removeTeams'](_0x40b8b0[_0xb4ad('0x43')][_0xb4ad('0x76')],{'transaction':_0x2fcf95})[_0xb4ad('0x21')](function(){if(!_[_0xb4ad('0x91')](_0x48ac9b)){return _0x4caeb3['removeAgents'](_0x48ac9b,{'transaction':_0x2fcf95});}})[_0xb4ad('0x21')](function(){_0x48ac9b['forEach'](function(_0x5d7d71){socket[_0xb4ad('0x92')](_0xb4ad('0x93'),{'UserId':_0x5d7d71,'ChatQueueId':_0x4caeb3['id']});});});});});});})[_0xb4ad('0x21')](respondWithStatusCode(_0x44cbaa,null))[_0xb4ad('0x2a')](handleError(_0x44cbaa,null));};exports[_0xb4ad('0x94')]=function(_0x49d7a8,_0x1ad58c,_0x52a709){return db[_0xb4ad('0x54')][_0xb4ad('0x60')]({'where':{'id':_0x49d7a8[_0xb4ad('0x57')]['id']}})['then'](handleEntityNotFound(_0x1ad58c,null))[_0xb4ad('0x21')](function(_0x18c381){if(_0x18c381){return _0x18c381['addAgents'](_0x49d7a8[_0xb4ad('0x5a')]['ids'],_[_0xb4ad('0x95')](_0x49d7a8[_0xb4ad('0x5a')],['ids','id'])||{})[_0xb4ad('0x96')](function(_0x12e8a3){for(var _0x4388d3=0x0;_0x4388d3<_0x49d7a8[_0xb4ad('0x5a')][_0xb4ad('0x76')][_0xb4ad('0x49')];_0x4388d3+=0x1){socket['emit'](_0xb4ad('0x7d'),{'UserId':Number(_0x49d7a8[_0xb4ad('0x5a')][_0xb4ad('0x76')][_0x4388d3]),'ChatQueueId':Number(_0x49d7a8[_0xb4ad('0x57')]['id'])});}return _0x12e8a3;});}})[_0xb4ad('0x21')](respondWithResult(_0x1ad58c,null))[_0xb4ad('0x2a')](handleError(_0x1ad58c,null));};exports[_0xb4ad('0x97')]=function(_0xa02048,_0x13c694,_0x367329){return db[_0xb4ad('0x54')][_0xb4ad('0x60')]({'where':{'id':_0xa02048[_0xb4ad('0x57')]['id']}})['then'](handleEntityNotFound(_0x13c694,null))[_0xb4ad('0x21')](function(_0x300186){if(_0x300186){return _0x300186[_0xb4ad('0x97')](_0xa02048[_0xb4ad('0x43')][_0xb4ad('0x76')])[_0xb4ad('0x21')](function(){if(_['isArray'](_0xa02048[_0xb4ad('0x43')][_0xb4ad('0x76')])){for(var _0x490dcf=0x0;_0x490dcf<_0xa02048[_0xb4ad('0x43')][_0xb4ad('0x76')][_0xb4ad('0x49')];_0x490dcf+=0x1){socket[_0xb4ad('0x92')](_0xb4ad('0x93'),{'UserId':Number(_0xa02048[_0xb4ad('0x43')][_0xb4ad('0x76')][_0x490dcf]),'ChatQueueId':Number(_0xa02048['params']['id'])});}}else{socket[_0xb4ad('0x92')](_0xb4ad('0x93'),{'UserId':Number(_0xa02048[_0xb4ad('0x43')][_0xb4ad('0x76')]),'ChatQueueId':Number(_0xa02048['params']['id'])});}});}})['then'](respondWithStatusCode(_0x13c694,null))['catch'](handleError(_0x13c694,null));};exports[_0xb4ad('0x98')]=function(_0xc1598c,_0x596d2c,_0x206f53){var _0x56ac1e={};var _0x14605a={};var _0x22dea7;var _0xd3a446;return db[_0xb4ad('0x54')]['findOne']({'where':{'id':_0xc1598c[_0xb4ad('0x57')]['id']}})[_0xb4ad('0x21')](handleEntityNotFound(_0x596d2c,null))[_0xb4ad('0x21')](function(_0x4fa312){if(_0x4fa312){_0x22dea7=_0x4fa312;_0x14605a[_0xb4ad('0x46')]=_[_0xb4ad('0x44')](db[_0xb4ad('0x6b')][_0xb4ad('0x58')]);_0x14605a['query']=_[_0xb4ad('0x44')](_0xc1598c[_0xb4ad('0x43')]);_0x14605a[_0xb4ad('0x4d')]=_['intersection'](_0x14605a[_0xb4ad('0x46')],_0x14605a[_0xb4ad('0x43')]);_0x56ac1e[_0xb4ad('0x48')]=_[_0xb4ad('0x45')](_0x14605a[_0xb4ad('0x46')],qs['fields'](_0xc1598c[_0xb4ad('0x43')][_0xb4ad('0x47')]));_0x56ac1e[_0xb4ad('0x48')]=_0x56ac1e[_0xb4ad('0x48')][_0xb4ad('0x49')]?_0x56ac1e[_0xb4ad('0x48')]:_0x14605a['model'];_0x56ac1e[_0xb4ad('0x68')]=qs['sort'](_0xc1598c[_0xb4ad('0x43')][_0xb4ad('0x4b')]);_0x56ac1e[_0xb4ad('0x4c')]=qs[_0xb4ad('0x4d')](_['pick'](_0xc1598c[_0xb4ad('0x43')],_0x14605a['filters']));if(_0xc1598c['query'][_0xb4ad('0x50')]){_0x56ac1e[_0xb4ad('0x4c')]=_[_0xb4ad('0x4e')](_0x56ac1e[_0xb4ad('0x4c')],{'$or':_['map'](_0x56ac1e[_0xb4ad('0x48')],function(_0x2c6472){var _0x36b259={};_0x36b259[_0x2c6472]={'$like':'%'+_0xc1598c[_0xb4ad('0x43')][_0xb4ad('0x50')]+'%'};return _0x36b259;})});}_0x56ac1e=_[_0xb4ad('0x4e')]({},_0x56ac1e,_0xc1598c[_0xb4ad('0x51')]);return _0x22dea7['getAgents'](_0x56ac1e);}})[_0xb4ad('0x21')](function(_0x6b113f){if(_0x6b113f){_0xd3a446=_0x6b113f[_0xb4ad('0x49')];if(!_0xc1598c['query'][_0xb4ad('0x67')](_0xb4ad('0x4a'))){_0x56ac1e[_0xb4ad('0x32')]=qs[_0xb4ad('0x32')](_0xc1598c['query'][_0xb4ad('0x32')]);_0x56ac1e[_0xb4ad('0x31')]=qs[_0xb4ad('0x31')](_0xc1598c[_0xb4ad('0x43')][_0xb4ad('0x31')]);}return _0x22dea7['getAgents'](_0x56ac1e);}})[_0xb4ad('0x21')](function(_0x211068){if(_0x211068){return _0x211068?{'count':_0xd3a446,'rows':_0x211068}:null;}})[_0xb4ad('0x21')](respondWithResult(_0x596d2c,null))[_0xb4ad('0x2a')](handleError(_0x596d2c,null));}; \ No newline at end of file +var _0x7d10=['removeTeams','field','tq.TeamId','from','team_has_chat_queues','join','user_has_teams','clone','push','sequelize','toString','SELECT','every','TeamId','includes','all','union','compact','value','isEmpty','removeAgents','forEach','userChatQueue:remove','addAgents','ids','omit','spread','getAgents','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','client','request','then','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','sendStatus','status','json','offset','undefined','limit','count','set','apply','destroy','get','UserProfileResource','end','stack','name','send','index','map','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','ChatQueue','findAll','show','params','includeAll','options','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','ChatQueues','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','getMembers','findOne','UserChatQueue','findAndCountAll','agent','chatPause','updatedAt','rows','%s/%s','createdAt','getTeams','Team','addTeams','User','online','voicePause','interface','flatMap','Agents','transaction','each','findOrCreate','emit','userChatQueue:save'];(function(_0xbf8ebe,_0x3b69a5){var _0x1e25e8=function(_0x40c390){while(--_0x40c390){_0xbf8ebe['push'](_0xbf8ebe['shift']());}};_0x1e25e8(++_0x3b69a5);}(_0x7d10,0xb3));var _0x07d1=function(_0x5c110e,_0x1c0f53){_0x5c110e=_0x5c110e-0x0;var _0x31b810=_0x7d10[_0x5c110e];return _0x31b810;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x07d1('0x0'));var zipdir=require(_0x07d1('0x1'));var jsonpatch=require(_0x07d1('0x2'));var rp=require(_0x07d1('0x3'));var moment=require(_0x07d1('0x4'));var BPromise=require(_0x07d1('0x5'));var Mustache=require(_0x07d1('0x6'));var util=require(_0x07d1('0x7'));var path=require(_0x07d1('0x8'));var sox=require('sox');var csv=require(_0x07d1('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x07d1('0xa'));var _=require(_0x07d1('0xb'));var squel=require(_0x07d1('0xc'));var crypto=require(_0x07d1('0xd'));var jsforce=require(_0x07d1('0xe'));var deskjs=require(_0x07d1('0xf'));var toCsv=require(_0x07d1('0x9'));var querystring=require(_0x07d1('0x10'));var Papa=require(_0x07d1('0x11'));var Redis=require('ioredis');var authService=require(_0x07d1('0x12'));var qs=require(_0x07d1('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x07d1('0x14'))(_0x07d1('0x15'));var utils=require(_0x07d1('0x16'));var config=require(_0x07d1('0x17'));var licenseUtil=require(_0x07d1('0x18'));var db=require(_0x07d1('0x19'))['db'];config[_0x07d1('0x1a')]=_['defaults'](config[_0x07d1('0x1a')],{'host':_0x07d1('0x1b'),'port':0x18eb});var socket=require(_0x07d1('0x1c'))(new Redis(config['redis']));require('./chatQueue.socket')['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0x07d1('0x1d')]['http']({'port':0x232a});function respondWithRpcPromise(_0x31f30b,_0x4f63da,_0x289d4b,_0x867c65){return new BPromise(function(_0x49b7b9,_0x5bf102){var _0x50a44b=_0x867c65||client;return _0x50a44b[_0x07d1('0x1e')](_0x31f30b,_0x289d4b)[_0x07d1('0x1f')](function(_0x3816fb){logger['info'](_0x07d1('0x20'),_0x4f63da,_0x07d1('0x21'));logger[_0x07d1('0x22')](_0x07d1('0x23'),_0x4f63da,'request\x20sent',JSON[_0x07d1('0x24')](_0x3816fb));if(_0x3816fb['error']){if(_0x3816fb[_0x07d1('0x25')][_0x07d1('0x26')]===0x1f4){logger[_0x07d1('0x25')](_0x07d1('0x20'),_0x4f63da,_0x3816fb[_0x07d1('0x25')][_0x07d1('0x27')]);return _0x5bf102(_0x3816fb['error'][_0x07d1('0x27')]);}logger[_0x07d1('0x25')]('ChatQueue,\x20%s,\x20%s',_0x4f63da,_0x3816fb[_0x07d1('0x25')][_0x07d1('0x27')]);return _0x49b7b9(_0x3816fb[_0x07d1('0x25')][_0x07d1('0x27')]);}else{logger[_0x07d1('0x28')]('ChatQueue,\x20%s,\x20%s',_0x4f63da,_0x07d1('0x21'));_0x49b7b9(_0x3816fb[_0x07d1('0x29')]['message']);}})[_0x07d1('0x2a')](function(_0x31559d){logger['error']('ChatQueue,\x20%s,\x20%s',_0x4f63da,_0x31559d);_0x5bf102(_0x31559d);});});}function respondWithStatusCode(_0x1bd403,_0x493923){_0x493923=_0x493923||0xcc;return function(_0x2b4911){if(_0x2b4911){return _0x1bd403[_0x07d1('0x2b')](_0x493923);}return _0x1bd403[_0x07d1('0x2c')](_0x493923)['end']();};}function respondWithResult(_0xc92a99,_0x4e3d6d){_0x4e3d6d=_0x4e3d6d||0xc8;return function(_0x39034e){if(_0x39034e){return _0xc92a99['status'](_0x4e3d6d)[_0x07d1('0x2d')](_0x39034e);}};}function respondWithFilteredResult(_0x58bdf4,_0x3f8de2){return function(_0x16a7b6){if(_0x16a7b6){var _0x4a585a=typeof _0x3f8de2[_0x07d1('0x2e')]===_0x07d1('0x2f')&&typeof _0x3f8de2[_0x07d1('0x30')]===_0x07d1('0x2f');var _0x150311=_0x16a7b6['count'];var _0xd6ee18=_0x4a585a?0x0:_0x3f8de2['offset'];var _0x24ef12=_0x4a585a?_0x16a7b6[_0x07d1('0x31')]:_0x3f8de2['offset']+_0x3f8de2[_0x07d1('0x30')];var _0x1316b3;if(_0x24ef12>=_0x150311){_0x24ef12=_0x150311;_0x1316b3=0xc8;}else{_0x1316b3=0xce;}_0x58bdf4[_0x07d1('0x2c')](_0x1316b3);return _0x58bdf4[_0x07d1('0x32')]('Content-Range',_0xd6ee18+'-'+_0x24ef12+'/'+_0x150311)[_0x07d1('0x2d')](_0x16a7b6);}return null;};}function patchUpdates(_0x2b3e4c){return function(_0x967432){try{jsonpatch[_0x07d1('0x33')](_0x967432,_0x2b3e4c,!![]);}catch(_0x128c2a){return BPromise['reject'](_0x128c2a);}return _0x967432['save']();};}function saveUpdates(_0x2491d7,_0x33aed9){return function(_0x3d7481){if(_0x3d7481){return _0x3d7481['update'](_0x2491d7)[_0x07d1('0x1f')](function(_0x1fbb6a){return _0x1fbb6a;});}return null;};}function removeEntity(_0x89e7ad,_0x30b1a5){return function(_0x2e65ce){if(_0x2e65ce){return _0x2e65ce[_0x07d1('0x34')]()['then'](function(){var _0x4a9a9e=_0x2e65ce[_0x07d1('0x35')]({'plain':!![]});var _0x2c28ea='ChatQueues';return db[_0x07d1('0x36')]['destroy']({'where':{'type':_0x2c28ea,'resourceId':_0x4a9a9e['id']}})[_0x07d1('0x1f')](function(){return _0x2e65ce;});})[_0x07d1('0x1f')](function(){_0x89e7ad[_0x07d1('0x2c')](0xcc)[_0x07d1('0x37')]();});}};}function handleEntityNotFound(_0x10924b,_0x538355){return function(_0x16713d){if(!_0x16713d){_0x10924b[_0x07d1('0x2b')](0x194);}return _0x16713d;};}function handleError(_0x4e85b0,_0x2a026a){_0x2a026a=_0x2a026a||0x1f4;return function(_0x2952fe){logger['error'](_0x2952fe[_0x07d1('0x38')]);if(_0x2952fe[_0x07d1('0x39')]){delete _0x2952fe[_0x07d1('0x39')];}_0x4e85b0[_0x07d1('0x2c')](_0x2a026a)[_0x07d1('0x3a')](_0x2952fe);};}exports[_0x07d1('0x3b')]=function(_0x2e047f,_0x5ebc14){var _0xa8e6fa={},_0x39daff={},_0x38f3ae={'count':0x0,'rows':[]};var _0x2d9dd0=_[_0x07d1('0x3c')](db['ChatQueue'][_0x07d1('0x3d')],function(_0x3fb423){return{'name':_0x3fb423['fieldName'],'type':_0x3fb423[_0x07d1('0x3e')][_0x07d1('0x3f')]};});_0x39daff[_0x07d1('0x40')]=_[_0x07d1('0x3c')](_0x2d9dd0,_0x07d1('0x39'));_0x39daff[_0x07d1('0x41')]=_[_0x07d1('0x42')](_0x2e047f[_0x07d1('0x41')]);_0x39daff[_0x07d1('0x43')]=_[_0x07d1('0x44')](_0x39daff[_0x07d1('0x40')],_0x39daff[_0x07d1('0x41')]);_0xa8e6fa[_0x07d1('0x45')]=_[_0x07d1('0x44')](_0x39daff[_0x07d1('0x40')],qs[_0x07d1('0x46')](_0x2e047f[_0x07d1('0x41')][_0x07d1('0x46')]));_0xa8e6fa[_0x07d1('0x45')]=_0xa8e6fa['attributes'][_0x07d1('0x47')]?_0xa8e6fa['attributes']:_0x39daff[_0x07d1('0x40')];if(!_0x2e047f['query'][_0x07d1('0x48')](_0x07d1('0x49'))){_0xa8e6fa[_0x07d1('0x30')]=qs['limit'](_0x2e047f[_0x07d1('0x41')][_0x07d1('0x30')]);_0xa8e6fa['offset']=qs[_0x07d1('0x2e')](_0x2e047f[_0x07d1('0x41')]['offset']);}_0xa8e6fa[_0x07d1('0x4a')]=qs[_0x07d1('0x4b')](_0x2e047f[_0x07d1('0x41')][_0x07d1('0x4b')]);_0xa8e6fa['where']=qs['filters'](_[_0x07d1('0x4c')](_0x2e047f[_0x07d1('0x41')],_0x39daff['filters']),_0x2d9dd0);if(_0x2e047f[_0x07d1('0x41')][_0x07d1('0x4d')]){_0xa8e6fa['where']=_['merge'](_0xa8e6fa[_0x07d1('0x4e')],{'$or':_['map'](_0x2d9dd0,function(_0x31e7cf){if(_0x31e7cf['type']!==_0x07d1('0x4f')){var _0x597034={};_0x597034[_0x31e7cf[_0x07d1('0x39')]]={'$like':'%'+_0x2e047f[_0x07d1('0x41')]['filter']+'%'};return _0x597034;}})});}_0xa8e6fa=_[_0x07d1('0x50')]({},_0xa8e6fa,_0x2e047f['options']);var _0x1513b3={'where':_0xa8e6fa[_0x07d1('0x4e')]};return db[_0x07d1('0x51')][_0x07d1('0x31')](_0x1513b3)[_0x07d1('0x1f')](function(_0xf49e4a){_0x38f3ae[_0x07d1('0x31')]=_0xf49e4a;if(_0x2e047f[_0x07d1('0x41')]['includeAll']){_0xa8e6fa['include']=[{'all':!![]}];}return db[_0x07d1('0x51')][_0x07d1('0x52')](_0xa8e6fa);})[_0x07d1('0x1f')](function(_0x50ac7f){_0x38f3ae['rows']=_0x50ac7f;return _0x38f3ae;})[_0x07d1('0x1f')](respondWithFilteredResult(_0x5ebc14,_0xa8e6fa))[_0x07d1('0x2a')](handleError(_0x5ebc14,null));};exports[_0x07d1('0x53')]=function(_0x2f30bf,_0x17c5f1){var _0x2c781b={'raw':!![],'where':{'id':_0x2f30bf[_0x07d1('0x54')]['id']}},_0x262c1d={};_0x262c1d[_0x07d1('0x40')]=_[_0x07d1('0x42')](db[_0x07d1('0x51')][_0x07d1('0x3d')]);_0x262c1d[_0x07d1('0x41')]=_['keys'](_0x2f30bf['query']);_0x262c1d['filters']=_[_0x07d1('0x44')](_0x262c1d[_0x07d1('0x40')],_0x262c1d[_0x07d1('0x41')]);_0x2c781b[_0x07d1('0x45')]=_[_0x07d1('0x44')](_0x262c1d[_0x07d1('0x40')],qs[_0x07d1('0x46')](_0x2f30bf[_0x07d1('0x41')]['fields']));_0x2c781b['attributes']=_0x2c781b[_0x07d1('0x45')][_0x07d1('0x47')]?_0x2c781b[_0x07d1('0x45')]:_0x262c1d[_0x07d1('0x40')];if(_0x2f30bf[_0x07d1('0x41')][_0x07d1('0x55')]){_0x2c781b['include']=[{'all':!![]}];}_0x2c781b=_[_0x07d1('0x50')]({},_0x2c781b,_0x2f30bf[_0x07d1('0x56')]);return db[_0x07d1('0x51')][_0x07d1('0x57')](_0x2c781b)[_0x07d1('0x1f')](handleEntityNotFound(_0x17c5f1,null))['then'](respondWithResult(_0x17c5f1,null))[_0x07d1('0x2a')](handleError(_0x17c5f1,null));};exports['create']=function(_0x203cce,_0x22399e){return db[_0x07d1('0x51')][_0x07d1('0x58')](_0x203cce['body'],{})['then'](function(_0x218ffa){var _0x2fa4d0=_0x203cce['user'][_0x07d1('0x35')]({'plain':!![]});if(!_0x2fa4d0)throw new Error(_0x07d1('0x59'));if(_0x2fa4d0[_0x07d1('0x5a')]===_0x07d1('0x5b')){var _0x3edf2a=_0x218ffa[_0x07d1('0x35')]({'plain':!![]});var _0x1ab738=_0x07d1('0x5c');return db[_0x07d1('0x5d')][_0x07d1('0x57')]({'where':{'name':_0x1ab738,'userProfileId':_0x2fa4d0[_0x07d1('0x5e')]},'raw':!![]})[_0x07d1('0x1f')](function(_0x4af579){if(_0x4af579&&_0x4af579[_0x07d1('0x5f')]===0x0){return db['UserProfileResource'][_0x07d1('0x58')]({'name':_0x3edf2a[_0x07d1('0x39')],'resourceId':_0x3edf2a['id'],'type':_0x4af579['name'],'sectionId':_0x4af579['id']},{})[_0x07d1('0x1f')](function(){return _0x218ffa;});}else{return _0x218ffa;}})['catch'](function(_0xff8087){logger[_0x07d1('0x25')](_0x07d1('0x60'),_0xff8087);throw _0xff8087;});}return _0x218ffa;})[_0x07d1('0x1f')](respondWithResult(_0x22399e,0xc9))['catch'](handleError(_0x22399e,null));};exports['update']=function(_0x5ac7f6,_0x1973b1){if(_0x5ac7f6[_0x07d1('0x61')]['id']){delete _0x5ac7f6[_0x07d1('0x61')]['id'];}return db[_0x07d1('0x51')][_0x07d1('0x57')]({'where':{'id':_0x5ac7f6[_0x07d1('0x54')]['id']}})[_0x07d1('0x1f')](handleEntityNotFound(_0x1973b1,null))['then'](saveUpdates(_0x5ac7f6[_0x07d1('0x61')],null))[_0x07d1('0x1f')](respondWithResult(_0x1973b1,null))[_0x07d1('0x2a')](handleError(_0x1973b1,null));};exports[_0x07d1('0x34')]=function(_0x6c7657,_0x2d4457){return db[_0x07d1('0x51')][_0x07d1('0x57')]({'where':{'id':_0x6c7657[_0x07d1('0x54')]['id']}})[_0x07d1('0x1f')](handleEntityNotFound(_0x2d4457,null))[_0x07d1('0x1f')](removeEntity(_0x2d4457,null))[_0x07d1('0x2a')](handleError(_0x2d4457,null));};exports[_0x07d1('0x62')]=function(_0xf8d927,_0x40e8e4){return db['ChatQueue'][_0x07d1('0x62')]()[_0x07d1('0x1f')](respondWithResult(_0x40e8e4,null))[_0x07d1('0x2a')](handleError(_0x40e8e4,null));};exports[_0x07d1('0x63')]=function(_0x5ceb1d,_0x7a06b7,_0x3d4009){var _0x5bdfa3={'raw':!![],'where':{}},_0x460854={},_0x53d5f9;return db[_0x07d1('0x51')][_0x07d1('0x64')]({'where':{'id':_0x5ceb1d[_0x07d1('0x54')]['id']}})[_0x07d1('0x1f')](handleEntityNotFound(_0x7a06b7,null))['then'](function(_0x4357ae){if(_0x4357ae){_0x53d5f9=_0x4357ae[_0x07d1('0x35')]({'plain':!![]});_0x460854[_0x07d1('0x40')]=_[_0x07d1('0x42')](db[_0x07d1('0x65')][_0x07d1('0x3d')]);_0x460854[_0x07d1('0x41')]=_[_0x07d1('0x42')](_0x5ceb1d['query']);_0x460854[_0x07d1('0x43')]=_[_0x07d1('0x44')](_0x460854[_0x07d1('0x40')],_0x460854[_0x07d1('0x41')]);_0x5bdfa3[_0x07d1('0x45')]=_['intersection'](_0x460854['model'],qs[_0x07d1('0x46')](_0x5ceb1d[_0x07d1('0x41')][_0x07d1('0x46')]));_0x5bdfa3[_0x07d1('0x45')]=_0x5bdfa3[_0x07d1('0x45')][_0x07d1('0x47')]?_0x5bdfa3[_0x07d1('0x45')]:_0x460854[_0x07d1('0x40')];if(!_0x5ceb1d[_0x07d1('0x41')][_0x07d1('0x48')](_0x07d1('0x49'))){_0x5bdfa3[_0x07d1('0x30')]=qs[_0x07d1('0x30')](_0x5ceb1d['query'][_0x07d1('0x30')]);_0x5bdfa3[_0x07d1('0x2e')]=qs[_0x07d1('0x2e')](_0x5ceb1d[_0x07d1('0x41')][_0x07d1('0x2e')]);}_0x5bdfa3[_0x07d1('0x4a')]=qs[_0x07d1('0x4b')](_0x5ceb1d[_0x07d1('0x41')][_0x07d1('0x4b')]);_0x5bdfa3[_0x07d1('0x4e')]=qs[_0x07d1('0x43')](_[_0x07d1('0x4c')](_0x5ceb1d[_0x07d1('0x41')],_0x460854[_0x07d1('0x43')]));_0x5bdfa3['where']['ChatQueueId']=_0x4357ae['id'];if(_0x5ceb1d[_0x07d1('0x41')][_0x07d1('0x4d')]){_0x5bdfa3[_0x07d1('0x4e')]=_[_0x07d1('0x50')](_0x5bdfa3[_0x07d1('0x4e')],{'$or':_[_0x07d1('0x3c')](_0x5bdfa3[_0x07d1('0x45')],function(_0x220e98){var _0x14bb26={};_0x14bb26[_0x220e98]={'$like':'%'+_0x5ceb1d[_0x07d1('0x41')][_0x07d1('0x4d')]+'%'};return _0x14bb26;})});}_0x5bdfa3=_[_0x07d1('0x50')]({},_0x5bdfa3,_0x5ceb1d[_0x07d1('0x56')]);return db[_0x07d1('0x65')][_0x07d1('0x52')](_0x5bdfa3);}})['then'](function(_0x2c7928){if(_0x2c7928){return db['User'][_0x07d1('0x66')]({'where':{'id':_[_0x07d1('0x3c')](_0x2c7928,'UserId'),'role':_0x07d1('0x67')},'attributes':['id',_0x07d1('0x39'),_0x07d1('0x68'),_0x07d1('0x69'),'createdAt']});}})[_0x07d1('0x1f')](function(_0x48404c){if(_0x48404c){return{'count':_0x48404c[_0x07d1('0x31')],'rows':_[_0x07d1('0x3c')](_0x48404c[_0x07d1('0x6a')],function(_0x19b4d8){return{'membername':_0x19b4d8[_0x07d1('0x39')],'UserId':_0x19b4d8['id'],'queue_name':_0x53d5f9[_0x07d1('0x39')],'ChatQueueId':_0x53d5f9['id'],'interface':util['format'](_0x07d1('0x6b'),'SIP',_0x19b4d8[_0x07d1('0x39')]),'penalty':0x0,'paused':_0x19b4d8[_0x07d1('0x68')],'createdAt':_0x19b4d8[_0x07d1('0x6c')],'updatedAt':_0x19b4d8[_0x07d1('0x69')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x07d1('0x1f')](respondWithFilteredResult(_0x7a06b7,_0x5bdfa3))[_0x07d1('0x2a')](handleError(_0x7a06b7,null));};exports[_0x07d1('0x6d')]=function(_0x415228,_0x387b5f,_0x47fc87){var _0x76f9a4={};var _0x2e3f7d={};var _0x2497d0;var _0x4c57b1;return db[_0x07d1('0x51')][_0x07d1('0x64')]({'where':{'id':_0x415228[_0x07d1('0x54')]['id']}})[_0x07d1('0x1f')](handleEntityNotFound(_0x387b5f,null))[_0x07d1('0x1f')](function(_0x48870b){if(_0x48870b){_0x2497d0=_0x48870b;_0x2e3f7d[_0x07d1('0x40')]=_['keys'](db[_0x07d1('0x6e')][_0x07d1('0x3d')]);_0x2e3f7d[_0x07d1('0x41')]=_[_0x07d1('0x42')](_0x415228[_0x07d1('0x41')]);_0x2e3f7d[_0x07d1('0x43')]=_['intersection'](_0x2e3f7d[_0x07d1('0x40')],_0x2e3f7d[_0x07d1('0x41')]);_0x76f9a4[_0x07d1('0x45')]=_[_0x07d1('0x44')](_0x2e3f7d[_0x07d1('0x40')],qs[_0x07d1('0x46')](_0x415228[_0x07d1('0x41')][_0x07d1('0x46')]));_0x76f9a4[_0x07d1('0x45')]=_0x76f9a4[_0x07d1('0x45')][_0x07d1('0x47')]?_0x76f9a4[_0x07d1('0x45')]:_0x2e3f7d['model'];_0x76f9a4['order']=qs[_0x07d1('0x4b')](_0x415228[_0x07d1('0x41')][_0x07d1('0x4b')]);_0x76f9a4[_0x07d1('0x4e')]=qs[_0x07d1('0x43')](_[_0x07d1('0x4c')](_0x415228['query'],_0x2e3f7d[_0x07d1('0x43')]));if(_0x415228[_0x07d1('0x41')][_0x07d1('0x4d')]){_0x76f9a4[_0x07d1('0x4e')]=_[_0x07d1('0x50')](_0x76f9a4[_0x07d1('0x4e')],{'$or':_[_0x07d1('0x3c')](_0x76f9a4[_0x07d1('0x45')],function(_0xefd951){var _0x307cc8={};_0x307cc8[_0xefd951]={'$like':'%'+_0x415228[_0x07d1('0x41')][_0x07d1('0x4d')]+'%'};return _0x307cc8;})});}_0x76f9a4=_['merge']({},_0x76f9a4,_0x415228[_0x07d1('0x56')]);return _0x2497d0[_0x07d1('0x6d')](_0x76f9a4);}})[_0x07d1('0x1f')](function(_0x2f3bd3){if(_0x2f3bd3){_0x4c57b1=_0x2f3bd3[_0x07d1('0x47')];if(!_0x415228['query'][_0x07d1('0x48')](_0x07d1('0x49'))){_0x76f9a4[_0x07d1('0x30')]=qs[_0x07d1('0x30')](_0x415228[_0x07d1('0x41')][_0x07d1('0x30')]);_0x76f9a4[_0x07d1('0x2e')]=qs['offset'](_0x415228[_0x07d1('0x41')]['offset']);}return _0x2497d0[_0x07d1('0x6d')](_0x76f9a4);}})[_0x07d1('0x1f')](function(_0x5d5285){if(_0x5d5285){return _0x5d5285?{'count':_0x4c57b1,'rows':_0x5d5285}:null;}})[_0x07d1('0x1f')](respondWithResult(_0x387b5f,null))[_0x07d1('0x2a')](handleError(_0x387b5f,null));};exports[_0x07d1('0x6f')]=function(_0x544e35,_0x277fab,_0xd1ead2){var _0x4be875=_0x544e35[_0x07d1('0x61')]['ids'];return db['Team'][_0x07d1('0x52')]({'where':{'id':_0x4be875},'attributes':['id'],'include':[{'model':db[_0x07d1('0x70')],'as':'Agents','attributes':['id',_0x07d1('0x39'),_0x07d1('0x71'),_0x07d1('0x72'),_0x07d1('0x73')],'raw':!![]}]})[_0x07d1('0x1f')](function(_0x2926e2){if(_0x2926e2){var _0x30cfb7=_[_0x07d1('0x74')](_0x2926e2,function(_0x5a60cb){var _0x21ca08=_0x5a60cb[_0x07d1('0x35')]({'plain':!![]});return _0x21ca08[_0x07d1('0x75')];});return db[_0x07d1('0x51')]['find']({'where':{'id':_0x544e35['params']['id']}})[_0x07d1('0x1f')](function(_0x4baf2d){return db['sequelize'][_0x07d1('0x76')](function(_0x3b0a8a){return _0x4baf2d['addTeams'](_0x4be875,{'transaction':_0x3b0a8a})[_0x07d1('0x1f')](function(){return BPromise[_0x07d1('0x77')](_0x30cfb7,function(_0x27a09f){return db['UserChatQueue'][_0x07d1('0x78')]({'where':{'UserId':_0x27a09f['id'],'ChatQueueId':_0x544e35['params']['id']},'transaction':_0x3b0a8a});});})[_0x07d1('0x1f')](function(){_0x30cfb7['forEach'](function(_0x1d2258){socket[_0x07d1('0x79')](_0x07d1('0x7a'),{'UserId':_0x1d2258['id'],'ChatQueueId':_0x4baf2d['id']});});});});});}})[_0x07d1('0x1f')](respondWithStatusCode(_0x277fab,null))[_0x07d1('0x2a')](handleError(_0x277fab,null));};exports[_0x07d1('0x7b')]=function(_0x2c6ecf,_0x27eeee,_0x145503){return db[_0x07d1('0x6e')][_0x07d1('0x52')]({'where':{'id':_0x2c6ecf[_0x07d1('0x41')]['ids']},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x07d1('0x1f')](handleEntityNotFound(_0x27eeee,null))['then'](function(_0xee4035){var _0x3e84d6=_['map'](_0xee4035,'id');var _0x4314e3=[];var _0x187c21=[];var _0x31c4f4=squel['select']();_0x31c4f4[_0x07d1('0x7c')](_0x07d1('0x7d'))[_0x07d1('0x7e')](_0x07d1('0x7f'),'tq')[_0x07d1('0x80')](_0x07d1('0x81'),'ut','ut.TeamId\x20=\x20tq.TeamId')['where']('ChatQueueId\x20=\x20?',_0x2c6ecf[_0x07d1('0x54')]['id']);for(var _0x3e2b36=0x0;_0x3e2b36<_0xee4035['length'];_0x3e2b36+=0x1){let _0x5613ce=_0xee4035[_0x3e2b36];for(var _0x2f2957=0x0;_0x2f2957<_0x5613ce[_0x07d1('0x75')][_0x07d1('0x47')];_0x2f2957+=0x1){let _0x272955=_0x5613ce['Agents'][_0x2f2957];var _0x451786=_0x31c4f4[_0x07d1('0x82')]();_0x451786['where']('ut.UserId\x20=\x20?',_0x272955['id']);_0x187c21[_0x07d1('0x83')](db[_0x07d1('0x84')][_0x07d1('0x41')](_0x451786[_0x07d1('0x85')](),{'type':db[_0x07d1('0x84')]['QueryTypes'][_0x07d1('0x86')]})[_0x07d1('0x1f')](function(_0x3ca01e){if(_0x3ca01e[_0x07d1('0x47')]===0x1){return _0x272955['id'];}else{var _0x5a6be2=_[_0x07d1('0x87')](_['map'](_0x3ca01e,_0x07d1('0x88')),function(_0x134d7e){return _[_0x07d1('0x89')](_0x3e84d6,_0x134d7e);});if(_0x5a6be2){return _0x272955['id'];}}}));}}return BPromise[_0x07d1('0x8a')](_0x187c21)[_0x07d1('0x1f')](function(_0x188751){_0x4314e3=_(_0x4314e3)[_0x07d1('0x8b')](_0x188751)[_0x07d1('0x8c')]()[_0x07d1('0x8d')]();return db[_0x07d1('0x51')]['find']({'where':{'id':_0x2c6ecf[_0x07d1('0x54')]['id']}})[_0x07d1('0x1f')](function(_0x485557){return db[_0x07d1('0x84')][_0x07d1('0x76')](function(_0x565dde){return _0x485557[_0x07d1('0x7b')](_0x2c6ecf['query']['ids'],{'transaction':_0x565dde})[_0x07d1('0x1f')](function(){if(!_[_0x07d1('0x8e')](_0x4314e3)){return _0x485557[_0x07d1('0x8f')](_0x4314e3,{'transaction':_0x565dde});}})[_0x07d1('0x1f')](function(){_0x4314e3[_0x07d1('0x90')](function(_0x46c80f){socket[_0x07d1('0x79')](_0x07d1('0x91'),{'UserId':_0x46c80f,'ChatQueueId':_0x485557['id']});});});});});});})[_0x07d1('0x1f')](respondWithStatusCode(_0x27eeee,null))[_0x07d1('0x2a')](handleError(_0x27eeee,null));};exports[_0x07d1('0x92')]=function(_0x161432,_0x3cfc2b,_0xcd863e){return db[_0x07d1('0x51')][_0x07d1('0x57')]({'where':{'id':_0x161432['params']['id']}})[_0x07d1('0x1f')](handleEntityNotFound(_0x3cfc2b,null))[_0x07d1('0x1f')](function(_0x5ddbf9){if(_0x5ddbf9){return _0x5ddbf9[_0x07d1('0x92')](_0x161432[_0x07d1('0x61')][_0x07d1('0x93')],_[_0x07d1('0x94')](_0x161432[_0x07d1('0x61')],[_0x07d1('0x93'),'id'])||{})[_0x07d1('0x95')](function(_0x3bea6b){for(var _0x41156b=0x0;_0x41156b<_0x161432[_0x07d1('0x61')]['ids']['length'];_0x41156b+=0x1){socket[_0x07d1('0x79')](_0x07d1('0x7a'),{'UserId':Number(_0x161432['body'][_0x07d1('0x93')][_0x41156b]),'ChatQueueId':Number(_0x161432['params']['id'])});}return _0x3bea6b;});}})['then'](respondWithResult(_0x3cfc2b,null))['catch'](handleError(_0x3cfc2b,null));};exports[_0x07d1('0x8f')]=function(_0x19a180,_0x11b774,_0x3ec169){return db[_0x07d1('0x51')]['find']({'where':{'id':_0x19a180[_0x07d1('0x54')]['id']}})[_0x07d1('0x1f')](handleEntityNotFound(_0x11b774,null))[_0x07d1('0x1f')](function(_0x121e11){if(_0x121e11){return _0x121e11[_0x07d1('0x8f')](_0x19a180[_0x07d1('0x41')][_0x07d1('0x93')])[_0x07d1('0x1f')](function(){if(_['isArray'](_0x19a180[_0x07d1('0x41')][_0x07d1('0x93')])){for(var _0x5e82aa=0x0;_0x5e82aa<_0x19a180[_0x07d1('0x41')]['ids']['length'];_0x5e82aa+=0x1){socket[_0x07d1('0x79')]('userChatQueue:remove',{'UserId':Number(_0x19a180['query'][_0x07d1('0x93')][_0x5e82aa]),'ChatQueueId':Number(_0x19a180[_0x07d1('0x54')]['id'])});}}else{socket['emit']('userChatQueue:remove',{'UserId':Number(_0x19a180[_0x07d1('0x41')][_0x07d1('0x93')]),'ChatQueueId':Number(_0x19a180[_0x07d1('0x54')]['id'])});}});}})[_0x07d1('0x1f')](respondWithStatusCode(_0x11b774,null))[_0x07d1('0x2a')](handleError(_0x11b774,null));};exports[_0x07d1('0x96')]=function(_0x2f58ba,_0x495f4c,_0x33134b){var _0xa9d707={};var _0x58bff5={};var _0x2489fc;var _0x239e9b;return db[_0x07d1('0x51')]['findOne']({'where':{'id':_0x2f58ba[_0x07d1('0x54')]['id']}})[_0x07d1('0x1f')](handleEntityNotFound(_0x495f4c,null))[_0x07d1('0x1f')](function(_0x115a33){if(_0x115a33){_0x2489fc=_0x115a33;_0x58bff5['model']=_[_0x07d1('0x42')](db[_0x07d1('0x70')][_0x07d1('0x3d')]);_0x58bff5[_0x07d1('0x41')]=_[_0x07d1('0x42')](_0x2f58ba[_0x07d1('0x41')]);_0x58bff5['filters']=_[_0x07d1('0x44')](_0x58bff5[_0x07d1('0x40')],_0x58bff5[_0x07d1('0x41')]);_0xa9d707[_0x07d1('0x45')]=_[_0x07d1('0x44')](_0x58bff5[_0x07d1('0x40')],qs[_0x07d1('0x46')](_0x2f58ba['query']['fields']));_0xa9d707['attributes']=_0xa9d707['attributes']['length']?_0xa9d707[_0x07d1('0x45')]:_0x58bff5[_0x07d1('0x40')];_0xa9d707[_0x07d1('0x4a')]=qs['sort'](_0x2f58ba[_0x07d1('0x41')]['sort']);_0xa9d707[_0x07d1('0x4e')]=qs[_0x07d1('0x43')](_[_0x07d1('0x4c')](_0x2f58ba[_0x07d1('0x41')],_0x58bff5[_0x07d1('0x43')]));if(_0x2f58ba[_0x07d1('0x41')]['filter']){_0xa9d707[_0x07d1('0x4e')]=_[_0x07d1('0x50')](_0xa9d707[_0x07d1('0x4e')],{'$or':_[_0x07d1('0x3c')](_0xa9d707[_0x07d1('0x45')],function(_0x41e5e6){var _0x3743df={};_0x3743df[_0x41e5e6]={'$like':'%'+_0x2f58ba['query'][_0x07d1('0x4d')]+'%'};return _0x3743df;})});}_0xa9d707=_[_0x07d1('0x50')]({},_0xa9d707,_0x2f58ba[_0x07d1('0x56')]);return _0x2489fc[_0x07d1('0x96')](_0xa9d707);}})['then'](function(_0x2bfec0){if(_0x2bfec0){_0x239e9b=_0x2bfec0['length'];if(!_0x2f58ba[_0x07d1('0x41')][_0x07d1('0x48')](_0x07d1('0x49'))){_0xa9d707[_0x07d1('0x30')]=qs[_0x07d1('0x30')](_0x2f58ba[_0x07d1('0x41')][_0x07d1('0x30')]);_0xa9d707[_0x07d1('0x2e')]=qs[_0x07d1('0x2e')](_0x2f58ba[_0x07d1('0x41')][_0x07d1('0x2e')]);}return _0x2489fc[_0x07d1('0x96')](_0xa9d707);}})[_0x07d1('0x1f')](function(_0x2bebf1){if(_0x2bebf1){return _0x2bebf1?{'count':_0x239e9b,'rows':_0x2bebf1}:null;}})[_0x07d1('0x1f')](respondWithResult(_0x495f4c,null))[_0x07d1('0x2a')](handleError(_0x495f4c,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index c66dfb8..51f0323 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 _0x4e8e=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','save','update'];(function(_0x5bd4ce,_0x40f4f2){var _0x1bd0f1=function(_0x399c73){while(--_0x399c73){_0x5bd4ce['push'](_0x5bd4ce['shift']());}};_0x1bd0f1(++_0x40f4f2);}(_0x4e8e,0x95));var _0xe4e8=function(_0x255c9a,_0x50c1db){_0x255c9a=_0x255c9a-0x0;var _0x57491d=_0x4e8e[_0x255c9a];return _0x57491d;};'use strict';var EventEmitter=require(_0xe4e8('0x0'));var ChatQueue=require(_0xe4e8('0x1'))['db']['ChatQueue'];var ChatQueueEvents=new EventEmitter();ChatQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xe4e8('0x2'),'afterUpdate':_0xe4e8('0x3'),'afterDestroy':_0xe4e8('0x4')};function emitEvent(_0xb45e41){return function(_0x53cfb5,_0x46c61f,_0x209be6){ChatQueueEvents[_0xe4e8('0x5')](_0xb45e41+':'+_0x53cfb5['id'],_0x53cfb5);ChatQueueEvents['emit'](_0xb45e41,_0x53cfb5);_0x209be6(null);};}for(var e in events){if(events[_0xe4e8('0x6')](e)){var event=events[e];ChatQueue[_0xe4e8('0x7')](e,emitEvent(event));}}module[_0xe4e8('0x8')]=ChatQueueEvents; \ No newline at end of file +var _0xa8fb=['exports','events','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x4cae67,_0x573621){var _0x290961=function(_0x23e722){while(--_0x23e722){_0x4cae67['push'](_0x4cae67['shift']());}};_0x290961(++_0x573621);}(_0xa8fb,0x172));var _0xba8f=function(_0x47fd36,_0x41535d){_0x47fd36=_0x47fd36-0x0;var _0x21a0fc=_0xa8fb[_0x47fd36];return _0x21a0fc;};'use strict';var EventEmitter=require(_0xba8f('0x0'));var ChatQueue=require('../../mysqldb')['db']['ChatQueue'];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0xba8f('0x1')](0x0);var events={'afterCreate':_0xba8f('0x2'),'afterUpdate':_0xba8f('0x3'),'afterDestroy':_0xba8f('0x4')};function emitEvent(_0x26eab1){return function(_0x21be59,_0x19567f,_0x2218f0){ChatQueueEvents[_0xba8f('0x5')](_0x26eab1+':'+_0x21be59['id'],_0x21be59);ChatQueueEvents[_0xba8f('0x5')](_0x26eab1,_0x21be59);_0x2218f0(null);};}for(var e in events){if(events[_0xba8f('0x6')](e)){var event=events[e];ChatQueue[_0xba8f('0x7')](e,emitEvent(event));}}module[_0xba8f('0x8')]=ChatQueueEvents; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.model.js b/server/api/chatQueue/chatQueue.model.js index 2dca84a..27eddce 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 _0xfdf3=['ChatQueue','chat_queues','lodash','util','api','moment','bluebird','path','rimraf','../../config/environment','./chatQueue.attributes','exports'];(function(_0xef4fc0,_0x33cc41){var _0x57dade=function(_0xe75b3e){while(--_0xe75b3e){_0xef4fc0['push'](_0xef4fc0['shift']());}};_0x57dade(++_0x33cc41);}(_0xfdf3,0x176));var _0x3fdf=function(_0x77e70,_0xd75f49){_0x77e70=_0x77e70-0x0;var _0x38f7aa=_0xfdf3[_0x77e70];return _0x38f7aa;};'use strict';var _=require(_0x3fdf('0x0'));var util=require(_0x3fdf('0x1'));var logger=require('../../config/logger')(_0x3fdf('0x2'));var moment=require(_0x3fdf('0x3'));var BPromise=require(_0x3fdf('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3fdf('0x5'));var rimraf=require(_0x3fdf('0x6'));var config=require(_0x3fdf('0x7'));var attributes=require(_0x3fdf('0x8'));module[_0x3fdf('0x9')]=function(_0xd23d22,_0x30c2a8){return _0xd23d22['define'](_0x3fdf('0xa'),attributes,{'tableName':_0x3fdf('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7abe=['../../config/logger','api','bluebird','path','rimraf','../../config/environment','./chatQueue.attributes','exports','define','ChatQueue','chat_queues','lodash','util'];(function(_0x351134,_0x392b05){var _0x5a5278=function(_0x5a4a7f){while(--_0x5a4a7f){_0x351134['push'](_0x351134['shift']());}};_0x5a5278(++_0x392b05);}(_0x7abe,0x1ab));var _0xe7ab=function(_0x544e1a,_0xf7582c){_0x544e1a=_0x544e1a-0x0;var _0x142980=_0x7abe[_0x544e1a];return _0x142980;};'use strict';var _=require(_0xe7ab('0x0'));var util=require(_0xe7ab('0x1'));var logger=require(_0xe7ab('0x2'))(_0xe7ab('0x3'));var moment=require('moment');var BPromise=require(_0xe7ab('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe7ab('0x5'));var rimraf=require(_0xe7ab('0x6'));var config=require(_0xe7ab('0x7'));var attributes=require(_0xe7ab('0x8'));module[_0xe7ab('0x9')]=function(_0x44c7de,_0x1a7494){return _0x44c7de[_0xe7ab('0xa')](_0xe7ab('0xb'),attributes,{'tableName':_0xe7ab('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.rpc.js b/server/api/chatQueue/chatQueue.rpc.js index 5895393..33f943c 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 _0x3264=['attributes','limit','include','map','model','GetChatQueue','ShowChatQueue','find','then','stringify','util','moment','bluebird','randomstring','../../config/utils','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./chatQueue.socket','register','request','info','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','error','ChatQueue,\x20%s,\x20%s','message','catch','ChatQueue','findAll','options','raw','where'];(function(_0x335141,_0x52b910){var _0x4f84da=function(_0x4514ea){while(--_0x4514ea){_0x335141['push'](_0x335141['shift']());}};_0x4f84da(++_0x52b910);}(_0x3264,0x7f));var _0x4326=function(_0x45bf86,_0x75586e){_0x45bf86=_0x45bf86-0x0;var _0x1f02b7=_0x3264[_0x45bf86];return _0x1f02b7;};'use strict';var _=require('lodash');var util=require(_0x4326('0x0'));var moment=require(_0x4326('0x1'));var BPromise=require(_0x4326('0x2'));var rs=require(_0x4326('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x4326('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x4326('0x5'));var jayson=require(_0x4326('0x6'));var client=jayson[_0x4326('0x7')][_0x4326('0x8')]({'port':0x232a});config['redis']=_[_0x4326('0x9')](config[_0x4326('0xa')],{'host':_0x4326('0xb'),'port':0x18eb});var socket=require(_0x4326('0xc'))(new Redis(config[_0x4326('0xa')]));require(_0x4326('0xd'))[_0x4326('0xe')](socket);function respondWithRpcPromise(_0x5cde0b,_0x58bade,_0x51323a){return new BPromise(function(_0x97d63e,_0x9daa3f){return client[_0x4326('0xf')](_0x5cde0b,_0x51323a)['then'](function(_0x5ac227){logger[_0x4326('0x10')]('ChatQueue,\x20%s,\x20%s',_0x58bade,_0x4326('0x11'));logger[_0x4326('0x12')](_0x4326('0x13'),_0x58bade,'request\x20sent',JSON['stringify'](_0x5ac227));if(_0x5ac227[_0x4326('0x14')]){if(_0x5ac227['error']['code']===0x1f4){logger[_0x4326('0x14')](_0x4326('0x15'),_0x58bade,_0x5ac227[_0x4326('0x14')][_0x4326('0x16')]);return _0x9daa3f(_0x5ac227['error'][_0x4326('0x16')]);}logger[_0x4326('0x14')](_0x4326('0x15'),_0x58bade,_0x5ac227['error'][_0x4326('0x16')]);return _0x97d63e(_0x5ac227[_0x4326('0x14')][_0x4326('0x16')]);}else{logger[_0x4326('0x10')]('ChatQueue,\x20%s,\x20%s',_0x58bade,_0x4326('0x11'));_0x97d63e(_0x5ac227['result'][_0x4326('0x16')]);}})[_0x4326('0x17')](function(_0x35f24b){logger[_0x4326('0x14')](_0x4326('0x15'),_0x58bade,_0x35f24b);_0x9daa3f(_0x35f24b);});});}exports['GetChatQueue']=function(_0x42e4e8){var _0x3d5045=this;return new Promise(function(_0x54e4c4,_0x377a83){return db[_0x4326('0x18')][_0x4326('0x19')]({'raw':_0x42e4e8['options']?_0x42e4e8[_0x4326('0x1a')][_0x4326('0x1b')]===undefined?!![]:![]:!![],'where':_0x42e4e8[_0x4326('0x1a')]?_0x42e4e8[_0x4326('0x1a')][_0x4326('0x1c')]||null:null,'attributes':_0x42e4e8[_0x4326('0x1a')]?_0x42e4e8[_0x4326('0x1a')][_0x4326('0x1d')]||null:null,'limit':_0x42e4e8['options']?_0x42e4e8[_0x4326('0x1a')][_0x4326('0x1e')]||null:null,'include':_0x42e4e8['options']?_0x42e4e8[_0x4326('0x1a')][_0x4326('0x1f')]?_[_0x4326('0x20')](_0x42e4e8[_0x4326('0x1a')][_0x4326('0x1f')],function(_0x4b5e63){return{'model':db[_0x4b5e63['model']],'as':_0x4b5e63['as'],'attributes':_0x4b5e63[_0x4326('0x1d')],'include':_0x4b5e63[_0x4326('0x1f')]?_[_0x4326('0x20')](_0x4b5e63[_0x4326('0x1f')],function(_0x4a1de7){return{'model':db[_0x4a1de7[_0x4326('0x21')]],'as':_0x4a1de7['as'],'attributes':_0x4a1de7[_0x4326('0x1d')],'include':_0x4a1de7[_0x4326('0x1f')]?_['map'](_0x4a1de7[_0x4326('0x1f')],function(_0x5a1c44){return{'model':db[_0x5a1c44[_0x4326('0x21')]],'as':_0x5a1c44['as'],'attributes':_0x5a1c44[_0x4326('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3c56d5){logger[_0x4326('0x10')](_0x4326('0x22'),_0x42e4e8);logger[_0x4326('0x12')]('GetChatQueue',_0x42e4e8,JSON['stringify'](_0x3c56d5));_0x54e4c4(_0x3c56d5);})['catch'](function(_0x430f06){logger[_0x4326('0x14')](_0x4326('0x22'),_0x430f06[_0x4326('0x16')],_0x42e4e8);_0x377a83(_0x3d5045[_0x4326('0x14')](0x1f4,_0x430f06[_0x4326('0x16')]));});});};exports[_0x4326('0x23')]=function(_0xd54ee0){var _0x2a94e7=this;return new Promise(function(_0x28c48a,_0x49a2d1){return db[_0x4326('0x18')][_0x4326('0x24')]({'raw':_0xd54ee0[_0x4326('0x1a')]?_0xd54ee0[_0x4326('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0xd54ee0[_0x4326('0x1a')]?_0xd54ee0[_0x4326('0x1a')][_0x4326('0x1c')]||null:null,'attributes':_0xd54ee0[_0x4326('0x1a')]?_0xd54ee0[_0x4326('0x1a')][_0x4326('0x1d')]||null:null,'include':_0xd54ee0['options']?_0xd54ee0[_0x4326('0x1a')][_0x4326('0x1f')]?_[_0x4326('0x20')](_0xd54ee0[_0x4326('0x1a')][_0x4326('0x1f')],function(_0x2138ed){return{'model':db[_0x2138ed[_0x4326('0x21')]],'as':_0x2138ed['as'],'attributes':_0x2138ed['attributes'],'include':_0x2138ed['include']?_[_0x4326('0x20')](_0x2138ed['include'],function(_0x2d5385){return{'model':db[_0x2d5385[_0x4326('0x21')]],'as':_0x2d5385['as'],'attributes':_0x2d5385[_0x4326('0x1d')],'include':_0x2d5385[_0x4326('0x1f')]?_['map'](_0x2d5385['include'],function(_0x1db617){return{'model':db[_0x1db617[_0x4326('0x21')]],'as':_0x1db617['as'],'attributes':_0x1db617['attributes']};}):[]};}):[]};}):[]:[]})[_0x4326('0x25')](function(_0x1233ad){logger[_0x4326('0x10')](_0x4326('0x23'),_0xd54ee0);logger[_0x4326('0x12')](_0x4326('0x23'),_0xd54ee0,JSON[_0x4326('0x26')](_0x1233ad));_0x28c48a(_0x1233ad);})[_0x4326('0x17')](function(_0x3496ac){logger[_0x4326('0x14')]('ShowChatQueue',_0x3496ac['message'],_0xd54ee0);_0x49a2d1(_0x2a94e7['error'](0x1f4,_0x3496ac[_0x4326('0x16')]));});});}; \ No newline at end of file +var _0x8769=['map','model','attributes','catch','ShowChatQueue','stringify','lodash','util','bluebird','ioredis','../../mysqldb','rpc','../../config/environment','client','http','defaults','redis','localhost','socket.io-emitter','./chatQueue.socket','register','request','then','ChatQueue,\x20%s,\x20%s','debug','ChatQueue,\x20%s,\x20%s,\x20%s','error','code','message','info','result','GetChatQueue','ChatQueue','findAll','options','raw','where','include'];(function(_0x568f46,_0x507dcf){var _0xf158b1=function(_0x2d892f){while(--_0x2d892f){_0x568f46['push'](_0x568f46['shift']());}};_0xf158b1(++_0x507dcf);}(_0x8769,0x110));var _0x9876=function(_0x58e469,_0x95ee3e){_0x58e469=_0x58e469-0x0;var _0x4c01c5=_0x8769[_0x58e469];return _0x4c01c5;};'use strict';var _=require(_0x9876('0x0'));var util=require(_0x9876('0x1'));var moment=require('moment');var BPromise=require(_0x9876('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9876('0x3'));var db=require(_0x9876('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x9876('0x5'));var config=require(_0x9876('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x9876('0x7')][_0x9876('0x8')]({'port':0x232a});config['redis']=_[_0x9876('0x9')](config[_0x9876('0xa')],{'host':_0x9876('0xb'),'port':0x18eb});var socket=require(_0x9876('0xc'))(new Redis(config[_0x9876('0xa')]));require(_0x9876('0xd'))[_0x9876('0xe')](socket);function respondWithRpcPromise(_0x2db388,_0x3c6568,_0x299087){return new BPromise(function(_0x1cac6c,_0x8946f8){return client[_0x9876('0xf')](_0x2db388,_0x299087)[_0x9876('0x10')](function(_0x2ef152){logger['info'](_0x9876('0x11'),_0x3c6568,'request\x20sent');logger[_0x9876('0x12')](_0x9876('0x13'),_0x3c6568,'request\x20sent',JSON['stringify'](_0x2ef152));if(_0x2ef152[_0x9876('0x14')]){if(_0x2ef152['error'][_0x9876('0x15')]===0x1f4){logger[_0x9876('0x14')](_0x9876('0x11'),_0x3c6568,_0x2ef152[_0x9876('0x14')]['message']);return _0x8946f8(_0x2ef152[_0x9876('0x14')][_0x9876('0x16')]);}logger[_0x9876('0x14')](_0x9876('0x11'),_0x3c6568,_0x2ef152[_0x9876('0x14')][_0x9876('0x16')]);return _0x1cac6c(_0x2ef152[_0x9876('0x14')][_0x9876('0x16')]);}else{logger[_0x9876('0x17')](_0x9876('0x11'),_0x3c6568,'request\x20sent');_0x1cac6c(_0x2ef152[_0x9876('0x18')][_0x9876('0x16')]);}})['catch'](function(_0x43cd0f){logger[_0x9876('0x14')](_0x9876('0x11'),_0x3c6568,_0x43cd0f);_0x8946f8(_0x43cd0f);});});}exports[_0x9876('0x19')]=function(_0x264445){var _0x73a9f7=this;return new Promise(function(_0x523878,_0x1adb6d){return db[_0x9876('0x1a')][_0x9876('0x1b')]({'raw':_0x264445[_0x9876('0x1c')]?_0x264445[_0x9876('0x1c')][_0x9876('0x1d')]===undefined?!![]:![]:!![],'where':_0x264445[_0x9876('0x1c')]?_0x264445[_0x9876('0x1c')][_0x9876('0x1e')]||null:null,'attributes':_0x264445[_0x9876('0x1c')]?_0x264445[_0x9876('0x1c')]['attributes']||null:null,'limit':_0x264445[_0x9876('0x1c')]?_0x264445[_0x9876('0x1c')]['limit']||null:null,'include':_0x264445[_0x9876('0x1c')]?_0x264445[_0x9876('0x1c')][_0x9876('0x1f')]?_[_0x9876('0x20')](_0x264445[_0x9876('0x1c')][_0x9876('0x1f')],function(_0x40d360){return{'model':db[_0x40d360[_0x9876('0x21')]],'as':_0x40d360['as'],'attributes':_0x40d360[_0x9876('0x22')],'include':_0x40d360[_0x9876('0x1f')]?_[_0x9876('0x20')](_0x40d360['include'],function(_0x39bb68){return{'model':db[_0x39bb68[_0x9876('0x21')]],'as':_0x39bb68['as'],'attributes':_0x39bb68['attributes'],'include':_0x39bb68[_0x9876('0x1f')]?_['map'](_0x39bb68['include'],function(_0x134b97){return{'model':db[_0x134b97[_0x9876('0x21')]],'as':_0x134b97['as'],'attributes':_0x134b97[_0x9876('0x22')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2f8121){logger['info'](_0x9876('0x19'),_0x264445);logger['debug'](_0x9876('0x19'),_0x264445,JSON['stringify'](_0x2f8121));_0x523878(_0x2f8121);})[_0x9876('0x23')](function(_0x37537a){logger[_0x9876('0x14')]('GetChatQueue',_0x37537a[_0x9876('0x16')],_0x264445);_0x1adb6d(_0x73a9f7[_0x9876('0x14')](0x1f4,_0x37537a[_0x9876('0x16')]));});});};exports['ShowChatQueue']=function(_0xf00408){var _0x4d5c4f=this;return new Promise(function(_0x2b34bd,_0x57787c){return db['ChatQueue']['find']({'raw':_0xf00408[_0x9876('0x1c')]?_0xf00408[_0x9876('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0xf00408[_0x9876('0x1c')]?_0xf00408[_0x9876('0x1c')][_0x9876('0x1e')]||null:null,'attributes':_0xf00408[_0x9876('0x1c')]?_0xf00408[_0x9876('0x1c')][_0x9876('0x22')]||null:null,'include':_0xf00408[_0x9876('0x1c')]?_0xf00408['options'][_0x9876('0x1f')]?_['map'](_0xf00408[_0x9876('0x1c')][_0x9876('0x1f')],function(_0x9ad012){return{'model':db[_0x9ad012[_0x9876('0x21')]],'as':_0x9ad012['as'],'attributes':_0x9ad012[_0x9876('0x22')],'include':_0x9ad012['include']?_[_0x9876('0x20')](_0x9ad012[_0x9876('0x1f')],function(_0x36c19d){return{'model':db[_0x36c19d['model']],'as':_0x36c19d['as'],'attributes':_0x36c19d[_0x9876('0x22')],'include':_0x36c19d['include']?_[_0x9876('0x20')](_0x36c19d['include'],function(_0x591718){return{'model':db[_0x591718[_0x9876('0x21')]],'as':_0x591718['as'],'attributes':_0x591718['attributes']};}):[]};}):[]};}):[]:[]})[_0x9876('0x10')](function(_0x341bf9){logger['info'](_0x9876('0x24'),_0xf00408);logger[_0x9876('0x12')](_0x9876('0x24'),_0xf00408,JSON[_0x9876('0x25')](_0x341bf9));_0x2b34bd(_0x341bf9);})[_0x9876('0x23')](function(_0x386e1e){logger[_0x9876('0x14')](_0x9876('0x24'),_0x386e1e[_0x9876('0x16')],_0xf00408);_0x57787c(_0x4d5c4f[_0x9876('0x14')](0x1f4,_0x386e1e[_0x9876('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index 444b0bb..8d9a302 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 _0x6334=['length','chatQueue:','./chatQueue.events','save','remove','update','emit','removeListener','register'];(function(_0x476718,_0x4fb3c6){var _0x1a2b16=function(_0x5b93b0){while(--_0x5b93b0){_0x476718['push'](_0x476718['shift']());}};_0x1a2b16(++_0x4fb3c6);}(_0x6334,0x119));var _0x4633=function(_0x3ae34a,_0x143082){_0x3ae34a=_0x3ae34a-0x0;var _0x4c9edc=_0x6334[_0x3ae34a];return _0x4c9edc;};'use strict';var ChatQueueEvents=require(_0x4633('0x0'));var events=[_0x4633('0x1'),_0x4633('0x2'),_0x4633('0x3')];function createListener(_0x1e53a0,_0x47254b){return function(_0x5109db){_0x47254b[_0x4633('0x4')](_0x1e53a0,_0x5109db);};}function removeListener(_0x205442,_0x2a2b3c){return function(){ChatQueueEvents[_0x4633('0x5')](_0x205442,_0x2a2b3c);};}exports[_0x4633('0x6')]=function(_0x6493dc){for(var _0x175e14=0x0,_0x4a8997=events[_0x4633('0x7')];_0x175e14<_0x4a8997;_0x175e14++){var _0x56891d=events[_0x175e14];var _0x21af74=createListener(_0x4633('0x8')+_0x56891d,_0x6493dc);ChatQueueEvents['on'](_0x56891d,_0x21af74);}}; \ No newline at end of file +var _0x72b1=['register','length','./chatQueue.events','remove','update','emit','removeListener'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x72b1,0x16e));var _0x172b=function(_0x30cb8d,_0x57cd7c){_0x30cb8d=_0x30cb8d-0x0;var _0x47747f=_0x72b1[_0x30cb8d];return _0x47747f;};'use strict';var ChatQueueEvents=require(_0x172b('0x0'));var events=['save',_0x172b('0x1'),_0x172b('0x2')];function createListener(_0x42b795,_0x18fd16){return function(_0x23bc7a){_0x18fd16[_0x172b('0x3')](_0x42b795,_0x23bc7a);};}function removeListener(_0x2c1d6e,_0x558038){return function(){ChatQueueEvents[_0x172b('0x4')](_0x2c1d6e,_0x558038);};}exports[_0x172b('0x5')]=function(_0x475fd6){for(var _0x222624=0x0,_0x571994=events[_0x172b('0x6')];_0x222624<_0x571994;_0x222624++){var _0x517363=events[_0x222624];var _0x1f98e9=createListener('chatQueue:'+_0x517363,_0x475fd6);ChatQueueEvents['on'](_0x517363,_0x1f98e9);}}; \ No newline at end of file diff --git a/server/api/chatQueue/index.js b/server/api/chatQueue/index.js index c033c15..c770cf0 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(_0x46ae97,_0x1457ea){var _0x4d0c37=function(_0x387581){while(--_0x387581){_0x46ae97['push'](_0x46ae97['shift']());}};_0x4d0c37(++_0x1457ea);}(_0x55ca,0x126));var _0xa55c=function(_0x1877e2,_0x2b76d4){_0x1877e2=_0x1877e2-0x0;var _0x44e96a=_0x55ca[_0x1877e2];return _0x44e96a;};'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 _0x008c=['../../config/environment','./chatQueue.controller','get','isAuthenticated','index','show','/:id/teams','getTeams','/:id/users','getAgents','post','addTeams','addAgents','update','delete','/:id','removeTeams','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x7a3fd,_0xe06535){var _0xa18f70=function(_0x13d791){while(--_0x13d791){_0x7a3fd['push'](_0x7a3fd['shift']());}};_0xa18f70(++_0xe06535);}(_0x008c,0x188));var _0xc008=function(_0x2bc400,_0x27208f){_0x2bc400=_0x2bc400-0x0;var _0x36ab53=_0x008c[_0x2bc400];return _0x36ab53;};'use strict';var multer=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var path=require(_0xc008('0x2'));var timeout=require(_0xc008('0x3'));var express=require(_0xc008('0x4'));var router=express['Router']();var fs_extra=require(_0xc008('0x5'));var auth=require(_0xc008('0x6'));var interaction=require(_0xc008('0x7'));var config=require(_0xc008('0x8'));var controller=require(_0xc008('0x9'));router[_0xc008('0xa')]('/',auth[_0xc008('0xb')](),controller[_0xc008('0xc')]);router[_0xc008('0xa')]('/describe',auth[_0xc008('0xb')](),controller['describe']);router[_0xc008('0xa')]('/:id',auth['isAuthenticated'](),controller[_0xc008('0xd')]);router[_0xc008('0xa')]('/:id/members',auth['isAuthenticated'](),controller['getMembers']);router[_0xc008('0xa')](_0xc008('0xe'),auth['isAuthenticated'](),controller[_0xc008('0xf')]);router[_0xc008('0xa')](_0xc008('0x10'),auth[_0xc008('0xb')](),controller[_0xc008('0x11')]);router[_0xc008('0x12')]('/',auth[_0xc008('0xb')](),controller['create']);router['post'](_0xc008('0xe'),auth['isAuthenticated'](),controller[_0xc008('0x13')]);router[_0xc008('0x12')](_0xc008('0x10'),auth[_0xc008('0xb')](),controller[_0xc008('0x14')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xc008('0x15')]);router[_0xc008('0x16')](_0xc008('0x17'),auth[_0xc008('0xb')](),controller['destroy']);router['delete']('/:id/teams',auth['isAuthenticated'](),controller[_0xc008('0x18')]);router[_0xc008('0x16')]('/:id/users',auth[_0xc008('0xb')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.attributes.js b/server/api/chatQueueReport/chatQueueReport.attributes.js index 0e2cc20..3a95ea4 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 _0x3870=['STRING','DATE','moment','sequelize'];(function(_0x73d817,_0x54eed1){var _0x178cf8=function(_0x3cdf24){while(--_0x3cdf24){_0x73d817['push'](_0x73d817['shift']());}};_0x178cf8(++_0x54eed1);}(_0x3870,0x19e));var _0x0387=function(_0x42a6b9,_0x164483){_0x42a6b9=_0x42a6b9-0x0;var _0x420139=_0x3870[_0x42a6b9];return _0x420139;};'use strict';var moment=require(_0x0387('0x0'));var Sequelize=require(_0x0387('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0x0387('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x0387('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x0387('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x0387('0x2')]}}; \ No newline at end of file +var _0xc715=['moment','sequelize','exports','STRING','DATE'];(function(_0x36c1f2,_0x58de4a){var _0x58d393=function(_0x13b5f3){while(--_0x13b5f3){_0x36c1f2['push'](_0x36c1f2['shift']());}};_0x58d393(++_0x58de4a);}(_0xc715,0x1d6));var _0x5c71=function(_0x3bf4d5,_0x366a37){_0x3bf4d5=_0x3bf4d5-0x0;var _0x48fdea=_0xc715[_0x3bf4d5];return _0x48fdea;};'use strict';var moment=require(_0x5c71('0x0'));var Sequelize=require(_0x5c71('0x1'));module[_0x5c71('0x2')]={'uniqueid':{'type':Sequelize[_0x5c71('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x5c71('0x3')]},'joinAt':{'type':Sequelize[_0x5c71('0x4')]},'leaveAt':{'type':Sequelize[_0x5c71('0x4')]},'acceptAt':{'type':Sequelize[_0x5c71('0x4')]},'exitAt':{'type':Sequelize[_0x5c71('0x4')]},'reason':{'type':Sequelize[_0x5c71('0x3')]}}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.controller.js b/server/api/chatQueueReport/chatQueueReport.controller.js index b5cfddc..c18cfdd 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 _0xdd68=['name','map','ChatQueueReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','includeAll','include','findAll','catch','show','params','options','find','create','body','update','destroy','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','fs-extra','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','then','error','stack'];(function(_0x1f8223,_0x2e2b29){var _0x4aa535=function(_0x338b17){while(--_0x338b17){_0x1f8223['push'](_0x1f8223['shift']());}};_0x4aa535(++_0x2e2b29);}(_0xdd68,0x196));var _0x8dd6=function(_0x39780c,_0x5782c9){_0x39780c=_0x39780c-0x0;var _0x53c19b=_0xdd68[_0x39780c];return _0x53c19b;};'use strict';var emlformat=require(_0x8dd6('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8dd6('0x1'));var jsonpatch=require(_0x8dd6('0x2'));var rp=require(_0x8dd6('0x3'));var moment=require(_0x8dd6('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x8dd6('0x5'));var util=require(_0x8dd6('0x6'));var path=require('path');var sox=require(_0x8dd6('0x7'));var csv=require(_0x8dd6('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8dd6('0x9'));var _=require('lodash');var squel=require(_0x8dd6('0xa'));var crypto=require('crypto');var jsforce=require(_0x8dd6('0xb'));var deskjs=require(_0x8dd6('0xc'));var toCsv=require(_0x8dd6('0x8'));var querystring=require('querystring');var Papa=require(_0x8dd6('0xd'));var Redis=require(_0x8dd6('0xe'));var authService=require(_0x8dd6('0xf'));var qs=require(_0x8dd6('0x10'));var as=require(_0x8dd6('0x11'));var hardwareService=require(_0x8dd6('0x12'));var logger=require(_0x8dd6('0x13'))(_0x8dd6('0x14'));var utils=require(_0x8dd6('0x15'));var config=require(_0x8dd6('0x16'));var licenseUtil=require(_0x8dd6('0x17'));var db=require(_0x8dd6('0x18'))['db'];function respondWithStatusCode(_0x3e7182,_0x59456c){_0x59456c=_0x59456c||0xcc;return function(_0x3bf24f){if(_0x3bf24f){return _0x3e7182[_0x8dd6('0x19')](_0x59456c);}return _0x3e7182[_0x8dd6('0x1a')](_0x59456c)['end']();};}function respondWithResult(_0x5957be,_0x41b21f){_0x41b21f=_0x41b21f||0xc8;return function(_0x4c8ff4){if(_0x4c8ff4){return _0x5957be['status'](_0x41b21f)[_0x8dd6('0x1b')](_0x4c8ff4);}};}function respondWithFilteredResult(_0xd906ee,_0x2e9882){return function(_0x469c11){if(_0x469c11){var _0x124e1d=typeof _0x2e9882[_0x8dd6('0x1c')]===_0x8dd6('0x1d')&&typeof _0x2e9882[_0x8dd6('0x1e')]===_0x8dd6('0x1d');var _0x5496cc=_0x469c11[_0x8dd6('0x1f')];var _0x1f910a=_0x124e1d?0x0:_0x2e9882[_0x8dd6('0x1c')];var _0x168a30=_0x124e1d?_0x469c11[_0x8dd6('0x1f')]:_0x2e9882[_0x8dd6('0x1c')]+_0x2e9882[_0x8dd6('0x1e')];var _0x40f9eb;if(_0x168a30>=_0x5496cc){_0x168a30=_0x5496cc;_0x40f9eb=0xc8;}else{_0x40f9eb=0xce;}_0xd906ee['status'](_0x40f9eb);return _0xd906ee[_0x8dd6('0x20')](_0x8dd6('0x21'),_0x1f910a+'-'+_0x168a30+'/'+_0x5496cc)['json'](_0x469c11);}return null;};}function patchUpdates(_0x40d5a5){return function(_0x107bdd){try{jsonpatch[_0x8dd6('0x22')](_0x107bdd,_0x40d5a5,!![]);}catch(_0x2c67e8){return BPromise['reject'](_0x2c67e8);}return _0x107bdd['save']();};}function saveUpdates(_0x488b47,_0x138216){return function(_0xe6b099){if(_0xe6b099){return _0xe6b099['update'](_0x488b47)[_0x8dd6('0x23')](function(_0x31b588){return _0x31b588;});}return null;};}function removeEntity(_0x29d4c8,_0x1485d4){return function(_0x3a4c9f){if(_0x3a4c9f){return _0x3a4c9f['destroy']()[_0x8dd6('0x23')](function(){_0x29d4c8[_0x8dd6('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x50f513,_0x1784a9){return function(_0xeeda3){if(!_0xeeda3){_0x50f513['sendStatus'](0x194);}return _0xeeda3;};}function handleError(_0x2d3205,_0x3e05fa){_0x3e05fa=_0x3e05fa||0x1f4;return function(_0x14cce1){logger[_0x8dd6('0x24')](_0x14cce1[_0x8dd6('0x25')]);if(_0x14cce1['name']){delete _0x14cce1[_0x8dd6('0x26')];}_0x2d3205[_0x8dd6('0x1a')](_0x3e05fa)['send'](_0x14cce1);};}exports['index']=function(_0x25eba7,_0x3f4975){var _0x4328c4={},_0x44c282={},_0x2bbe93={'count':0x0,'rows':[]};var _0x3da00d=_[_0x8dd6('0x27')](db[_0x8dd6('0x28')][_0x8dd6('0x29')],function(_0x35c9ae){return{'name':_0x35c9ae[_0x8dd6('0x2a')],'type':_0x35c9ae[_0x8dd6('0x2b')][_0x8dd6('0x2c')]};});_0x44c282[_0x8dd6('0x2d')]=_[_0x8dd6('0x27')](_0x3da00d,_0x8dd6('0x26'));_0x44c282[_0x8dd6('0x2e')]=_[_0x8dd6('0x2f')](_0x25eba7[_0x8dd6('0x2e')]);_0x44c282[_0x8dd6('0x30')]=_[_0x8dd6('0x31')](_0x44c282[_0x8dd6('0x2d')],_0x44c282['query']);_0x4328c4[_0x8dd6('0x32')]=_[_0x8dd6('0x31')](_0x44c282[_0x8dd6('0x2d')],qs[_0x8dd6('0x33')](_0x25eba7['query'][_0x8dd6('0x33')]));_0x4328c4['attributes']=_0x4328c4['attributes'][_0x8dd6('0x34')]?_0x4328c4[_0x8dd6('0x32')]:_0x44c282['model'];if(!_0x25eba7[_0x8dd6('0x2e')][_0x8dd6('0x35')](_0x8dd6('0x36'))){_0x4328c4[_0x8dd6('0x1e')]=qs[_0x8dd6('0x1e')](_0x25eba7['query'][_0x8dd6('0x1e')]);_0x4328c4[_0x8dd6('0x1c')]=qs[_0x8dd6('0x1c')](_0x25eba7[_0x8dd6('0x2e')][_0x8dd6('0x1c')]);}_0x4328c4[_0x8dd6('0x37')]=qs[_0x8dd6('0x38')](_0x25eba7['query'][_0x8dd6('0x38')]);_0x4328c4[_0x8dd6('0x39')]=qs[_0x8dd6('0x30')](_[_0x8dd6('0x3a')](_0x25eba7[_0x8dd6('0x2e')],_0x44c282[_0x8dd6('0x30')]),_0x3da00d);if(_0x25eba7['query'][_0x8dd6('0x3b')]){_0x4328c4[_0x8dd6('0x39')]=_[_0x8dd6('0x3c')](_0x4328c4[_0x8dd6('0x39')],{'$or':_[_0x8dd6('0x27')](_0x3da00d,function(_0x1bf125){if(_0x1bf125[_0x8dd6('0x2b')]!=='VIRTUAL'){var _0x1b3f5d={};_0x1b3f5d[_0x1bf125[_0x8dd6('0x26')]]={'$like':'%'+_0x25eba7[_0x8dd6('0x2e')]['filter']+'%'};return _0x1b3f5d;}})});}_0x4328c4=_[_0x8dd6('0x3c')]({},_0x4328c4,_0x25eba7['options']);var _0x83ec4b={'where':_0x4328c4[_0x8dd6('0x39')]};return db[_0x8dd6('0x28')][_0x8dd6('0x1f')](_0x83ec4b)['then'](function(_0x1fea6d){_0x2bbe93[_0x8dd6('0x1f')]=_0x1fea6d;if(_0x25eba7[_0x8dd6('0x2e')][_0x8dd6('0x3d')]){_0x4328c4[_0x8dd6('0x3e')]=[{'all':!![]}];}return db[_0x8dd6('0x28')][_0x8dd6('0x3f')](_0x4328c4);})[_0x8dd6('0x23')](function(_0x1e1830){_0x2bbe93['rows']=_0x1e1830;return _0x2bbe93;})[_0x8dd6('0x23')](respondWithFilteredResult(_0x3f4975,_0x4328c4))[_0x8dd6('0x40')](handleError(_0x3f4975,null));};exports[_0x8dd6('0x41')]=function(_0x4309a6,_0x22d3b8){var _0x45577e={'raw':!![],'where':{'id':_0x4309a6[_0x8dd6('0x42')]['id']}},_0x31f1d3={};_0x31f1d3[_0x8dd6('0x2d')]=_[_0x8dd6('0x2f')](db['ChatQueueReport'][_0x8dd6('0x29')]);_0x31f1d3['query']=_[_0x8dd6('0x2f')](_0x4309a6[_0x8dd6('0x2e')]);_0x31f1d3['filters']=_[_0x8dd6('0x31')](_0x31f1d3[_0x8dd6('0x2d')],_0x31f1d3[_0x8dd6('0x2e')]);_0x45577e[_0x8dd6('0x32')]=_[_0x8dd6('0x31')](_0x31f1d3[_0x8dd6('0x2d')],qs['fields'](_0x4309a6[_0x8dd6('0x2e')]['fields']));_0x45577e[_0x8dd6('0x32')]=_0x45577e[_0x8dd6('0x32')]['length']?_0x45577e[_0x8dd6('0x32')]:_0x31f1d3['model'];if(_0x4309a6['query'][_0x8dd6('0x3d')]){_0x45577e['include']=[{'all':!![]}];}_0x45577e=_[_0x8dd6('0x3c')]({},_0x45577e,_0x4309a6[_0x8dd6('0x43')]);return db[_0x8dd6('0x28')][_0x8dd6('0x44')](_0x45577e)['then'](handleEntityNotFound(_0x22d3b8,null))[_0x8dd6('0x23')](respondWithResult(_0x22d3b8,null))[_0x8dd6('0x40')](handleError(_0x22d3b8,null));};exports[_0x8dd6('0x45')]=function(_0x22a0b1,_0x701549){return db[_0x8dd6('0x28')][_0x8dd6('0x45')](_0x22a0b1[_0x8dd6('0x46')],{})['then'](respondWithResult(_0x701549,0xc9))[_0x8dd6('0x40')](handleError(_0x701549,null));};exports[_0x8dd6('0x47')]=function(_0x212929,_0x4a1550){if(_0x212929['body']['id']){delete _0x212929[_0x8dd6('0x46')]['id'];}return db[_0x8dd6('0x28')][_0x8dd6('0x44')]({'where':{'id':_0x212929['params']['id']}})[_0x8dd6('0x23')](handleEntityNotFound(_0x4a1550,null))[_0x8dd6('0x23')](saveUpdates(_0x212929['body'],null))['then'](respondWithResult(_0x4a1550,null))['catch'](handleError(_0x4a1550,null));};exports[_0x8dd6('0x48')]=function(_0x513178,_0x1a919a){return db['ChatQueueReport'][_0x8dd6('0x44')]({'where':{'id':_0x513178[_0x8dd6('0x42')]['id']}})[_0x8dd6('0x23')](handleEntityNotFound(_0x1a919a,null))['then'](removeEntity(_0x1a919a,null))[_0x8dd6('0x40')](handleError(_0x1a919a,null));};exports[_0x8dd6('0x49')]=function(_0x4699be,_0x75dfcc){return db[_0x8dd6('0x28')][_0x8dd6('0x49')]()[_0x8dd6('0x23')](respondWithResult(_0x75dfcc,null))[_0x8dd6('0x40')](handleError(_0x75dfcc,null));}; \ No newline at end of file +var _0xe5e0=['../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','index','map','ChatQueueReport','rawAttributes','type','key','model','filters','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','keys','intersection','catch','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils'];(function(_0x5a2285,_0x3212d1){var _0x48f6ed=function(_0x322127){while(--_0x322127){_0x5a2285['push'](_0x5a2285['shift']());}};_0x48f6ed(++_0x3212d1);}(_0xe5e0,0x1be));var _0x0e5e=function(_0x3452b4,_0x1d0da2){_0x3452b4=_0x3452b4-0x0;var _0x459641=_0xe5e0[_0x3452b4];return _0x459641;};'use strict';var emlformat=require(_0x0e5e('0x0'));var rimraf=require(_0x0e5e('0x1'));var zipdir=require(_0x0e5e('0x2'));var jsonpatch=require(_0x0e5e('0x3'));var rp=require(_0x0e5e('0x4'));var moment=require(_0x0e5e('0x5'));var BPromise=require(_0x0e5e('0x6'));var Mustache=require(_0x0e5e('0x7'));var util=require(_0x0e5e('0x8'));var path=require('path');var sox=require(_0x0e5e('0x9'));var csv=require(_0x0e5e('0xa'));var ejs=require(_0x0e5e('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0e5e('0xc'));var squel=require(_0x0e5e('0xd'));var crypto=require(_0x0e5e('0xe'));var jsforce=require(_0x0e5e('0xf'));var deskjs=require(_0x0e5e('0x10'));var toCsv=require(_0x0e5e('0xa'));var querystring=require(_0x0e5e('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x0e5e('0x12'));var as=require(_0x0e5e('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x0e5e('0x14'));var utils=require(_0x0e5e('0x15'));var config=require(_0x0e5e('0x16'));var licenseUtil=require(_0x0e5e('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x275cd5,_0x322cdf){_0x322cdf=_0x322cdf||0xcc;return function(_0x5c0900){if(_0x5c0900){return _0x275cd5[_0x0e5e('0x18')](_0x322cdf);}return _0x275cd5[_0x0e5e('0x19')](_0x322cdf)[_0x0e5e('0x1a')]();};}function respondWithResult(_0x50c0a3,_0x731afc){_0x731afc=_0x731afc||0xc8;return function(_0x2353b3){if(_0x2353b3){return _0x50c0a3[_0x0e5e('0x19')](_0x731afc)[_0x0e5e('0x1b')](_0x2353b3);}};}function respondWithFilteredResult(_0x19d3a1,_0x1ef0be){return function(_0x5dedc5){if(_0x5dedc5){var _0x20a35f=typeof _0x1ef0be[_0x0e5e('0x1c')]===_0x0e5e('0x1d')&&typeof _0x1ef0be[_0x0e5e('0x1e')]===_0x0e5e('0x1d');var _0x550dda=_0x5dedc5[_0x0e5e('0x1f')];var _0x2efa7f=_0x20a35f?0x0:_0x1ef0be['offset'];var _0x29597b=_0x20a35f?_0x5dedc5[_0x0e5e('0x1f')]:_0x1ef0be['offset']+_0x1ef0be[_0x0e5e('0x1e')];var _0x3b80f8;if(_0x29597b>=_0x550dda){_0x29597b=_0x550dda;_0x3b80f8=0xc8;}else{_0x3b80f8=0xce;}_0x19d3a1['status'](_0x3b80f8);return _0x19d3a1[_0x0e5e('0x20')](_0x0e5e('0x21'),_0x2efa7f+'-'+_0x29597b+'/'+_0x550dda)[_0x0e5e('0x1b')](_0x5dedc5);}return null;};}function patchUpdates(_0x56dcc9){return function(_0x4f468f){try{jsonpatch[_0x0e5e('0x22')](_0x4f468f,_0x56dcc9,!![]);}catch(_0x1b0588){return BPromise[_0x0e5e('0x23')](_0x1b0588);}return _0x4f468f[_0x0e5e('0x24')]();};}function saveUpdates(_0x2c3c01,_0x44b8b9){return function(_0x2588fa){if(_0x2588fa){return _0x2588fa[_0x0e5e('0x25')](_0x2c3c01)[_0x0e5e('0x26')](function(_0x33b27e){return _0x33b27e;});}return null;};}function removeEntity(_0x523c30,_0x742ee8){return function(_0x2321f9){if(_0x2321f9){return _0x2321f9[_0x0e5e('0x27')]()[_0x0e5e('0x26')](function(){_0x523c30[_0x0e5e('0x19')](0xcc)[_0x0e5e('0x1a')]();});}};}function handleEntityNotFound(_0x46cbd7,_0x4b53ca){return function(_0x1b19f0){if(!_0x1b19f0){_0x46cbd7['sendStatus'](0x194);}return _0x1b19f0;};}function handleError(_0x2750b0,_0x2f789a){_0x2f789a=_0x2f789a||0x1f4;return function(_0x5e3a60){logger[_0x0e5e('0x28')](_0x5e3a60[_0x0e5e('0x29')]);if(_0x5e3a60[_0x0e5e('0x2a')]){delete _0x5e3a60['name'];}_0x2750b0[_0x0e5e('0x19')](_0x2f789a)['send'](_0x5e3a60);};}exports[_0x0e5e('0x2b')]=function(_0x2d5cc0,_0x149209){var _0x4eb0d6={},_0x38930f={},_0x7a118={'count':0x0,'rows':[]};var _0x37a2d0=_[_0x0e5e('0x2c')](db[_0x0e5e('0x2d')][_0x0e5e('0x2e')],function(_0x3ea522){return{'name':_0x3ea522['fieldName'],'type':_0x3ea522[_0x0e5e('0x2f')][_0x0e5e('0x30')]};});_0x38930f[_0x0e5e('0x31')]=_[_0x0e5e('0x2c')](_0x37a2d0,'name');_0x38930f['query']=_['keys'](_0x2d5cc0['query']);_0x38930f[_0x0e5e('0x32')]=_['intersection'](_0x38930f[_0x0e5e('0x31')],_0x38930f[_0x0e5e('0x33')]);_0x4eb0d6[_0x0e5e('0x34')]=_['intersection'](_0x38930f[_0x0e5e('0x31')],qs['fields'](_0x2d5cc0['query'][_0x0e5e('0x35')]));_0x4eb0d6[_0x0e5e('0x34')]=_0x4eb0d6[_0x0e5e('0x34')][_0x0e5e('0x36')]?_0x4eb0d6[_0x0e5e('0x34')]:_0x38930f['model'];if(!_0x2d5cc0[_0x0e5e('0x33')][_0x0e5e('0x37')](_0x0e5e('0x38'))){_0x4eb0d6[_0x0e5e('0x1e')]=qs[_0x0e5e('0x1e')](_0x2d5cc0[_0x0e5e('0x33')][_0x0e5e('0x1e')]);_0x4eb0d6[_0x0e5e('0x1c')]=qs[_0x0e5e('0x1c')](_0x2d5cc0['query'][_0x0e5e('0x1c')]);}_0x4eb0d6[_0x0e5e('0x39')]=qs[_0x0e5e('0x3a')](_0x2d5cc0[_0x0e5e('0x33')]['sort']);_0x4eb0d6[_0x0e5e('0x3b')]=qs['filters'](_[_0x0e5e('0x3c')](_0x2d5cc0[_0x0e5e('0x33')],_0x38930f[_0x0e5e('0x32')]),_0x37a2d0);if(_0x2d5cc0['query'][_0x0e5e('0x3d')]){_0x4eb0d6[_0x0e5e('0x3b')]=_[_0x0e5e('0x3e')](_0x4eb0d6['where'],{'$or':_['map'](_0x37a2d0,function(_0x392a37){if(_0x392a37[_0x0e5e('0x2f')]!==_0x0e5e('0x3f')){var _0x5e6600={};_0x5e6600[_0x392a37[_0x0e5e('0x2a')]]={'$like':'%'+_0x2d5cc0[_0x0e5e('0x33')][_0x0e5e('0x3d')]+'%'};return _0x5e6600;}})});}_0x4eb0d6=_[_0x0e5e('0x3e')]({},_0x4eb0d6,_0x2d5cc0[_0x0e5e('0x40')]);var _0x5d25f6={'where':_0x4eb0d6[_0x0e5e('0x3b')]};return db[_0x0e5e('0x2d')][_0x0e5e('0x1f')](_0x5d25f6)[_0x0e5e('0x26')](function(_0xb0953f){_0x7a118[_0x0e5e('0x1f')]=_0xb0953f;if(_0x2d5cc0['query'][_0x0e5e('0x41')]){_0x4eb0d6[_0x0e5e('0x42')]=[{'all':!![]}];}return db['ChatQueueReport'][_0x0e5e('0x43')](_0x4eb0d6);})[_0x0e5e('0x26')](function(_0x5271fb){_0x7a118[_0x0e5e('0x44')]=_0x5271fb;return _0x7a118;})[_0x0e5e('0x26')](respondWithFilteredResult(_0x149209,_0x4eb0d6))['catch'](handleError(_0x149209,null));};exports[_0x0e5e('0x45')]=function(_0x5570b6,_0x1aeaad){var _0x29fd38={'raw':!![],'where':{'id':_0x5570b6[_0x0e5e('0x46')]['id']}},_0x31223b={};_0x31223b[_0x0e5e('0x31')]=_[_0x0e5e('0x47')](db[_0x0e5e('0x2d')][_0x0e5e('0x2e')]);_0x31223b[_0x0e5e('0x33')]=_[_0x0e5e('0x47')](_0x5570b6[_0x0e5e('0x33')]);_0x31223b['filters']=_[_0x0e5e('0x48')](_0x31223b['model'],_0x31223b['query']);_0x29fd38[_0x0e5e('0x34')]=_[_0x0e5e('0x48')](_0x31223b[_0x0e5e('0x31')],qs[_0x0e5e('0x35')](_0x5570b6[_0x0e5e('0x33')][_0x0e5e('0x35')]));_0x29fd38[_0x0e5e('0x34')]=_0x29fd38['attributes'][_0x0e5e('0x36')]?_0x29fd38[_0x0e5e('0x34')]:_0x31223b[_0x0e5e('0x31')];if(_0x5570b6[_0x0e5e('0x33')]['includeAll']){_0x29fd38[_0x0e5e('0x42')]=[{'all':!![]}];}_0x29fd38=_[_0x0e5e('0x3e')]({},_0x29fd38,_0x5570b6[_0x0e5e('0x40')]);return db[_0x0e5e('0x2d')]['find'](_0x29fd38)['then'](handleEntityNotFound(_0x1aeaad,null))['then'](respondWithResult(_0x1aeaad,null))[_0x0e5e('0x49')](handleError(_0x1aeaad,null));};exports['create']=function(_0x15a57c,_0x1d9995){return db['ChatQueueReport'][_0x0e5e('0x4a')](_0x15a57c[_0x0e5e('0x4b')],{})[_0x0e5e('0x26')](respondWithResult(_0x1d9995,0xc9))[_0x0e5e('0x49')](handleError(_0x1d9995,null));};exports[_0x0e5e('0x25')]=function(_0x2eb6d9,_0x13098a){if(_0x2eb6d9[_0x0e5e('0x4b')]['id']){delete _0x2eb6d9[_0x0e5e('0x4b')]['id'];}return db['ChatQueueReport']['find']({'where':{'id':_0x2eb6d9[_0x0e5e('0x46')]['id']}})[_0x0e5e('0x26')](handleEntityNotFound(_0x13098a,null))[_0x0e5e('0x26')](saveUpdates(_0x2eb6d9[_0x0e5e('0x4b')],null))['then'](respondWithResult(_0x13098a,null))[_0x0e5e('0x49')](handleError(_0x13098a,null));};exports[_0x0e5e('0x27')]=function(_0x4cd35a,_0x2b9bc2){return db[_0x0e5e('0x2d')][_0x0e5e('0x4c')]({'where':{'id':_0x4cd35a[_0x0e5e('0x46')]['id']}})['then'](handleEntityNotFound(_0x2b9bc2,null))[_0x0e5e('0x26')](removeEntity(_0x2b9bc2,null))['catch'](handleError(_0x2b9bc2,null));};exports[_0x0e5e('0x4d')]=function(_0x4af255,_0x5b6dcd){return db[_0x0e5e('0x2d')][_0x0e5e('0x4d')]()[_0x0e5e('0x26')](respondWithResult(_0x5b6dcd,null))['catch'](handleError(_0x5b6dcd,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index 2f1e0b6..1c94378 100644 --- a/server/api/chatQueueReport/chatQueueReport.model.js +++ b/server/api/chatQueueReport/chatQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['define','report_chat_queue','uniqueid','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x26bae4,_0x59cb48){var _0xa38b80=function(_0x401077){while(--_0x401077){_0x26bae4['push'](_0x26bae4['shift']());}};_0xa38b80(++_0x59cb48);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x0d8b('0x2'));var rp=require(_0x0d8b('0x3'));var fs=require('fs');var path=require(_0x0d8b('0x4'));var rimraf=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var attributes=require('./chatQueueReport.attributes');module['exports']=function(_0x3f8b6f,_0x227c63){return _0x3f8b6f[_0x0d8b('0x7')]('ChatQueueReport',attributes,{'tableName':_0x0d8b('0x8'),'paranoid':![],'indexes':[{'name':_0x0d8b('0x9'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xb7e7=['../../config/logger','moment','request-promise','rimraf','../../config/environment','./chatQueueReport.attributes','define','ChatQueueReport','uniqueid','lodash'];(function(_0xcd4b0a,_0x1fca76){var _0x2d54a9=function(_0x139208){while(--_0x139208){_0xcd4b0a['push'](_0xcd4b0a['shift']());}};_0x2d54a9(++_0x1fca76);}(_0xb7e7,0x121));var _0x7b7e=function(_0x186376,_0x5d988a){_0x186376=_0x186376-0x0;var _0x2dbdd9=_0xb7e7[_0x186376];return _0x2dbdd9;};'use strict';var _=require(_0x7b7e('0x0'));var util=require('util');var logger=require(_0x7b7e('0x1'))('api');var moment=require(_0x7b7e('0x2'));var BPromise=require('bluebird');var rp=require(_0x7b7e('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7b7e('0x4'));var config=require(_0x7b7e('0x5'));var attributes=require(_0x7b7e('0x6'));module['exports']=function(_0x53ed64,_0x333fa4){return _0x53ed64[_0x7b7e('0x7')](_0x7b7e('0x8'),attributes,{'tableName':'report_chat_queue','paranoid':![],'indexes':[{'name':_0x7b7e('0x9'),'fields':[_0x7b7e('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.rpc.js b/server/api/chatQueueReport/chatQueueReport.rpc.js index 2967576..9068442 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 _0x37e9=['client','http','request','then','request\x20sent','ChatQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatQueueReport,\x20%s,\x20%s','message','result','catch','CreateChatQueueReport','ChatQueueReport','create','body','options','raw','update','attributes','limit','info','UpdateChatQueueReport','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x37e9,0x1f4));var _0x937e=function(_0x3db6cb,_0x558f96){_0x3db6cb=_0x3db6cb-0x0;var _0xffd156=_0x37e9[_0x3db6cb];return _0xffd156;};'use strict';var _=require('lodash');var util=require(_0x937e('0x0'));var moment=require(_0x937e('0x1'));var BPromise=require(_0x937e('0x2'));var rs=require(_0x937e('0x3'));var fs=require('fs');var Redis=require(_0x937e('0x4'));var db=require(_0x937e('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x937e('0x6'))(_0x937e('0x7'));var config=require(_0x937e('0x8'));var jayson=require(_0x937e('0x9'));var client=jayson[_0x937e('0xa')][_0x937e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5a648d,_0x3bc4c4,_0x214b0d){return new BPromise(function(_0x327f70,_0x54a357){return client[_0x937e('0xc')](_0x5a648d,_0x214b0d)[_0x937e('0xd')](function(_0x109aa3){logger['info']('ChatQueueReport,\x20%s,\x20%s',_0x3bc4c4,_0x937e('0xe'));logger['debug'](_0x937e('0xf'),_0x3bc4c4,_0x937e('0xe'),JSON[_0x937e('0x10')](_0x109aa3));if(_0x109aa3['error']){if(_0x109aa3[_0x937e('0x11')][_0x937e('0x12')]===0x1f4){logger['error'](_0x937e('0x13'),_0x3bc4c4,_0x109aa3[_0x937e('0x11')][_0x937e('0x14')]);return _0x54a357(_0x109aa3[_0x937e('0x11')][_0x937e('0x14')]);}logger[_0x937e('0x11')](_0x937e('0x13'),_0x3bc4c4,_0x109aa3[_0x937e('0x11')]['message']);return _0x327f70(_0x109aa3[_0x937e('0x11')][_0x937e('0x14')]);}else{logger['info'](_0x937e('0x13'),_0x3bc4c4,_0x937e('0xe'));_0x327f70(_0x109aa3[_0x937e('0x15')][_0x937e('0x14')]);}})[_0x937e('0x16')](function(_0x3b2647){logger[_0x937e('0x11')](_0x937e('0x13'),_0x3bc4c4,_0x3b2647);_0x54a357(_0x3b2647);});});}exports[_0x937e('0x17')]=function(_0xe76e5b){var _0x1a059f=this;return new Promise(function(_0x4ae425,_0x4da5b6){return db[_0x937e('0x18')][_0x937e('0x19')](_0xe76e5b[_0x937e('0x1a')],{'raw':_0xe76e5b[_0x937e('0x1b')]?_0xe76e5b[_0x937e('0x1b')][_0x937e('0x1c')]===undefined?!![]:![]:!![]})[_0x937e('0xd')](function(_0xb3fdfe){logger['info'](_0x937e('0x17'),_0xe76e5b);logger['debug'](_0x937e('0x17'),_0xe76e5b,JSON[_0x937e('0x10')](_0xb3fdfe));_0x4ae425(_0xb3fdfe);})[_0x937e('0x16')](function(_0x35d7ef){logger[_0x937e('0x11')](_0x937e('0x17'),_0x35d7ef[_0x937e('0x14')],_0xe76e5b);_0x4da5b6(_0x1a059f['error'](0x1f4,_0x35d7ef[_0x937e('0x14')]));});});};exports['UpdateChatQueueReport']=function(_0x2e5a16){var _0x2c7e2c=this;return new Promise(function(_0x3ac0fb,_0x578b72){return db[_0x937e('0x18')][_0x937e('0x1d')](_0x2e5a16[_0x937e('0x1a')],{'raw':_0x2e5a16[_0x937e('0x1b')]?_0x2e5a16[_0x937e('0x1b')][_0x937e('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2e5a16[_0x937e('0x1b')]?_0x2e5a16[_0x937e('0x1b')]['where']||null:null,'attributes':_0x2e5a16['options']?_0x2e5a16[_0x937e('0x1b')][_0x937e('0x1e')]||null:null,'limit':_0x2e5a16[_0x937e('0x1b')]?_0x2e5a16[_0x937e('0x1b')][_0x937e('0x1f')]||null:null})['then'](function(_0x511fe4){logger[_0x937e('0x20')](_0x937e('0x21'),_0x2e5a16);logger['debug'](_0x937e('0x21'),_0x2e5a16,JSON['stringify'](_0x511fe4));_0x3ac0fb(_0x511fe4);})[_0x937e('0x16')](function(_0x2ee7c3){logger[_0x937e('0x11')]('UpdateChatQueueReport',_0x2ee7c3['message'],_0x2e5a16);_0x578b72(_0x2c7e2c[_0x937e('0x11')](0x1f4,_0x2ee7c3['message']));});});}; \ No newline at end of file +var _0xf7e2=['randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','ChatQueueReport,\x20%s,\x20%s','request\x20sent','ChatQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','ChatQueueReport','body','CreateChatQueueReport','debug','UpdateChatQueueReport','options','raw','attributes','lodash','util','bluebird'];(function(_0x2cf5c9,_0x56e270){var _0x162695=function(_0x5952ca){while(--_0x5952ca){_0x2cf5c9['push'](_0x2cf5c9['shift']());}};_0x162695(++_0x56e270);}(_0xf7e2,0x1bd));var _0x2f7e=function(_0x146ac6,_0x1f34bf){_0x146ac6=_0x146ac6-0x0;var _0x2892bd=_0xf7e2[_0x146ac6];return _0x2892bd;};'use strict';var _=require(_0x2f7e('0x0'));var util=require(_0x2f7e('0x1'));var moment=require('moment');var BPromise=require(_0x2f7e('0x2'));var rs=require(_0x2f7e('0x3'));var fs=require('fs');var Redis=require(_0x2f7e('0x4'));var db=require(_0x2f7e('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x2f7e('0x6'))(_0x2f7e('0x7'));var config=require(_0x2f7e('0x8'));var jayson=require(_0x2f7e('0x9'));var client=jayson[_0x2f7e('0xa')][_0x2f7e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5bd1d1,_0x33aa1d,_0x515cf1){return new BPromise(function(_0x3d9396,_0x2e52a2){return client[_0x2f7e('0xc')](_0x5bd1d1,_0x515cf1)[_0x2f7e('0xd')](function(_0x18eeb4){logger['info'](_0x2f7e('0xe'),_0x33aa1d,_0x2f7e('0xf'));logger['debug'](_0x2f7e('0x10'),_0x33aa1d,_0x2f7e('0xf'),JSON[_0x2f7e('0x11')](_0x18eeb4));if(_0x18eeb4[_0x2f7e('0x12')]){if(_0x18eeb4[_0x2f7e('0x12')][_0x2f7e('0x13')]===0x1f4){logger[_0x2f7e('0x12')](_0x2f7e('0xe'),_0x33aa1d,_0x18eeb4['error']['message']);return _0x2e52a2(_0x18eeb4[_0x2f7e('0x12')]['message']);}logger[_0x2f7e('0x12')]('ChatQueueReport,\x20%s,\x20%s',_0x33aa1d,_0x18eeb4[_0x2f7e('0x12')][_0x2f7e('0x14')]);return _0x3d9396(_0x18eeb4['error'][_0x2f7e('0x14')]);}else{logger[_0x2f7e('0x15')](_0x2f7e('0xe'),_0x33aa1d,_0x2f7e('0xf'));_0x3d9396(_0x18eeb4[_0x2f7e('0x16')][_0x2f7e('0x14')]);}})[_0x2f7e('0x17')](function(_0x3a066a){logger[_0x2f7e('0x12')](_0x2f7e('0xe'),_0x33aa1d,_0x3a066a);_0x2e52a2(_0x3a066a);});});}exports['CreateChatQueueReport']=function(_0x4a0ff8){var _0x2c30ea=this;return new Promise(function(_0x19b909,_0x3ee08a){return db[_0x2f7e('0x18')]['create'](_0x4a0ff8[_0x2f7e('0x19')],{'raw':_0x4a0ff8['options']?_0x4a0ff8['options']['raw']===undefined?!![]:![]:!![]})[_0x2f7e('0xd')](function(_0x1b60ad){logger[_0x2f7e('0x15')](_0x2f7e('0x1a'),_0x4a0ff8);logger[_0x2f7e('0x1b')](_0x2f7e('0x1a'),_0x4a0ff8,JSON['stringify'](_0x1b60ad));_0x19b909(_0x1b60ad);})['catch'](function(_0x5dbce6){logger['error'](_0x2f7e('0x1a'),_0x5dbce6[_0x2f7e('0x14')],_0x4a0ff8);_0x3ee08a(_0x2c30ea[_0x2f7e('0x12')](0x1f4,_0x5dbce6[_0x2f7e('0x14')]));});});};exports[_0x2f7e('0x1c')]=function(_0x380176){var _0xe29a6=this;return new Promise(function(_0x283efa,_0x59bbc1){return db[_0x2f7e('0x18')]['update'](_0x380176[_0x2f7e('0x19')],{'raw':_0x380176[_0x2f7e('0x1d')]?_0x380176[_0x2f7e('0x1d')][_0x2f7e('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x380176[_0x2f7e('0x1d')]?_0x380176[_0x2f7e('0x1d')]['where']||null:null,'attributes':_0x380176['options']?_0x380176[_0x2f7e('0x1d')][_0x2f7e('0x1f')]||null:null,'limit':_0x380176[_0x2f7e('0x1d')]?_0x380176[_0x2f7e('0x1d')]['limit']||null:null})[_0x2f7e('0xd')](function(_0x489bbf){logger[_0x2f7e('0x15')](_0x2f7e('0x1c'),_0x380176);logger['debug']('UpdateChatQueueReport',_0x380176,JSON[_0x2f7e('0x11')](_0x489bbf));_0x283efa(_0x489bbf);})[_0x2f7e('0x17')](function(_0x50b9a0){logger[_0x2f7e('0x12')](_0x2f7e('0x1c'),_0x50b9a0[_0x2f7e('0x14')],_0x380176);_0x59bbc1(_0xe29a6[_0x2f7e('0x12')](0x1f4,_0x50b9a0[_0x2f7e('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index 7e867fc..2ab7e65 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 _0xedfb=['delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./chatQueueReport.controller','get','index','isAuthenticated','describe','show','post','create','put','/:id'];(function(_0x18a5a0,_0x55f44a){var _0x4854e9=function(_0x5ec295){while(--_0x5ec295){_0x18a5a0['push'](_0x18a5a0['shift']());}};_0x4854e9(++_0x55f44a);}(_0xedfb,0x192));var _0xbedf=function(_0x3079b9,_0x58d2f4){_0x3079b9=_0x3079b9-0x0;var _0x105101=_0xedfb[_0x3079b9];return _0x105101;};'use strict';var multer=require(_0xbedf('0x0'));var util=require(_0xbedf('0x1'));var path=require(_0xbedf('0x2'));var timeout=require(_0xbedf('0x3'));var express=require(_0xbedf('0x4'));var router=express['Router']();var fs_extra=require(_0xbedf('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xbedf('0x6'));var config=require(_0xbedf('0x7'));var controller=require(_0xbedf('0x8'));router[_0xbedf('0x9')]('/',auth['isAuthenticated'](),controller[_0xbedf('0xa')]);router[_0xbedf('0x9')]('/describe',auth[_0xbedf('0xb')](),controller[_0xbedf('0xc')]);router['get']('/:id',auth[_0xbedf('0xb')](),controller[_0xbedf('0xd')]);router[_0xbedf('0xe')]('/',auth[_0xbedf('0xb')](),controller[_0xbedf('0xf')]);router[_0xbedf('0x10')](_0xbedf('0x11'),auth[_0xbedf('0xb')](),controller['update']);router[_0xbedf('0x12')](_0xbedf('0x11'),auth[_0xbedf('0xb')](),controller[_0xbedf('0x13')]);module[_0xbedf('0x14')]=router; \ No newline at end of file +var _0x2875=['/:id','post','create','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated'];(function(_0x5cc49e,_0x571829){var _0x5071f4=function(_0xdc5b79){while(--_0xdc5b79){_0x5cc49e['push'](_0x5cc49e['shift']());}};_0x5071f4(++_0x571829);}(_0x2875,0x11e));var _0x5287=function(_0x5f0995,_0x207d8c){_0x5f0995=_0x5f0995-0x0;var _0x2e0334=_0x2875[_0x5f0995];return _0x2e0334;};'use strict';var multer=require(_0x5287('0x0'));var util=require(_0x5287('0x1'));var path=require(_0x5287('0x2'));var timeout=require(_0x5287('0x3'));var express=require(_0x5287('0x4'));var router=express[_0x5287('0x5')]();var fs_extra=require(_0x5287('0x6'));var auth=require(_0x5287('0x7'));var interaction=require(_0x5287('0x8'));var config=require(_0x5287('0x9'));var controller=require('./chatQueueReport.controller');router[_0x5287('0xa')]('/',auth['isAuthenticated'](),controller[_0x5287('0xb')]);router[_0x5287('0xa')](_0x5287('0xc'),auth[_0x5287('0xd')](),controller['describe']);router[_0x5287('0xa')](_0x5287('0xe'),auth[_0x5287('0xd')](),controller['show']);router[_0x5287('0xf')]('/',auth['isAuthenticated'](),controller[_0x5287('0x10')]);router['put'](_0x5287('0xe'),auth[_0x5287('0xd')](),controller['update']);router[_0x5287('0x11')](_0x5287('0xe'),auth[_0x5287('0xd')](),controller[_0x5287('0x12')]);module[_0x5287('0x13')]=router; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.attributes.js b/server/api/chatTransferReport/chatTransferReport.attributes.js index 11cd549..4041d7e 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 _0xf4eb=['NOW','moment','account','queue','DATE'];(function(_0x3cdfeb,_0x1ff1ad){var _0x23b4e6=function(_0x1c2581){while(--_0x1c2581){_0x3cdfeb['push'](_0x3cdfeb['shift']());}};_0x23b4e6(++_0x1ff1ad);}(_0xf4eb,0xec));var _0xbf4e=function(_0x445068,_0x250944){_0x445068=_0x445068-0x0;var _0x234ca9=_0xf4eb[_0x445068];return _0x234ca9;};'use strict';var moment=require(_0xbf4e('0x0'));var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xbf4e('0x1'),'agent','queue'),'allowNull':![],'defaultValue':_0xbf4e('0x2')},'transferredAt':{'type':Sequelize[_0xbf4e('0x3')],'allowNull':![],'defaultValue':Sequelize[_0xbf4e('0x4')]}}; \ No newline at end of file +var _0x008c=['ENUM','agent','queue','DATE','NOW','moment','sequelize','exports','STRING'];(function(_0x53273a,_0x5ed978){var _0x3c41db=function(_0x491a57){while(--_0x491a57){_0x53273a['push'](_0x53273a['shift']());}};_0x3c41db(++_0x5ed978);}(_0x008c,0x188));var _0xc008=function(_0x7b484,_0x195ad4){_0x7b484=_0x7b484-0x0;var _0x2ae1cf=_0x008c[_0x7b484];return _0x2ae1cf;};'use strict';var moment=require(_0xc008('0x0'));var Sequelize=require(_0xc008('0x1'));module[_0xc008('0x2')]={'uniqueid':{'type':Sequelize[_0xc008('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xc008('0x4')]('account',_0xc008('0x5'),_0xc008('0x6')),'allowNull':![],'defaultValue':_0xc008('0x6')},'transferredAt':{'type':Sequelize[_0xc008('0x7')],'allowNull':![],'defaultValue':Sequelize[_0xc008('0x8')]}}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.controller.js b/server/api/chatTransferReport/chatTransferReport.controller.js index 7ff0412..1b0aa9f 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 _0x6a49=['crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','sendStatus','end','json','undefined','limit','count','offset','status','set','apply','reject','save','update','then','destroy','error','stack','send','index','map','ChatTransferReport','rawAttributes','fieldName','key','model','name','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','filter','where','type','VIRTUAL','merge','options','includeAll','include','findAll','catch','show','params','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','util','to-csv','ejs','fs-extra','lodash','squel'];(function(_0x44e4e1,_0x5637b2){var _0x300cd2=function(_0x189eeb){while(--_0x189eeb){_0x44e4e1['push'](_0x44e4e1['shift']());}};_0x300cd2(++_0x5637b2);}(_0x6a49,0x176));var _0x96a4=function(_0x4fcd39,_0x13594a){_0x4fcd39=_0x4fcd39-0x0;var _0x151cf0=_0x6a49[_0x4fcd39];return _0x151cf0;};'use strict';var emlformat=require(_0x96a4('0x0'));var rimraf=require(_0x96a4('0x1'));var zipdir=require(_0x96a4('0x2'));var jsonpatch=require(_0x96a4('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x96a4('0x4'));var Mustache=require('mustache');var util=require(_0x96a4('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0x96a4('0x6'));var ejs=require(_0x96a4('0x7'));var fs=require('fs');var fs_extra=require(_0x96a4('0x8'));var _=require(_0x96a4('0x9'));var squel=require(_0x96a4('0xa'));var crypto=require(_0x96a4('0xb'));var jsforce=require(_0x96a4('0xc'));var deskjs=require(_0x96a4('0xd'));var toCsv=require(_0x96a4('0x6'));var querystring=require(_0x96a4('0xe'));var Papa=require(_0x96a4('0xf'));var Redis=require(_0x96a4('0x10'));var authService=require(_0x96a4('0x11'));var qs=require(_0x96a4('0x12'));var as=require(_0x96a4('0x13'));var hardwareService=require(_0x96a4('0x14'));var logger=require(_0x96a4('0x15'))(_0x96a4('0x16'));var utils=require(_0x96a4('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4f1356,_0x3ec4d3){_0x3ec4d3=_0x3ec4d3||0xcc;return function(_0x52782e){if(_0x52782e){return _0x4f1356[_0x96a4('0x18')](_0x3ec4d3);}return _0x4f1356['status'](_0x3ec4d3)[_0x96a4('0x19')]();};}function respondWithResult(_0x5178ce,_0x396878){_0x396878=_0x396878||0xc8;return function(_0x99a567){if(_0x99a567){return _0x5178ce['status'](_0x396878)[_0x96a4('0x1a')](_0x99a567);}};}function respondWithFilteredResult(_0xa8e3de,_0x382486){return function(_0x1e58bc){if(_0x1e58bc){var _0x59b65a=typeof _0x382486['offset']===_0x96a4('0x1b')&&typeof _0x382486[_0x96a4('0x1c')]===_0x96a4('0x1b');var _0x13bddc=_0x1e58bc['count'];var _0x28237a=_0x59b65a?0x0:_0x382486['offset'];var _0x296752=_0x59b65a?_0x1e58bc[_0x96a4('0x1d')]:_0x382486[_0x96a4('0x1e')]+_0x382486[_0x96a4('0x1c')];var _0xb55b8b;if(_0x296752>=_0x13bddc){_0x296752=_0x13bddc;_0xb55b8b=0xc8;}else{_0xb55b8b=0xce;}_0xa8e3de[_0x96a4('0x1f')](_0xb55b8b);return _0xa8e3de[_0x96a4('0x20')]('Content-Range',_0x28237a+'-'+_0x296752+'/'+_0x13bddc)[_0x96a4('0x1a')](_0x1e58bc);}return null;};}function patchUpdates(_0x3b875e){return function(_0x5597e0){try{jsonpatch[_0x96a4('0x21')](_0x5597e0,_0x3b875e,!![]);}catch(_0x138936){return BPromise[_0x96a4('0x22')](_0x138936);}return _0x5597e0[_0x96a4('0x23')]();};}function saveUpdates(_0x5d1941,_0x5e989c){return function(_0x34efbc){if(_0x34efbc){return _0x34efbc[_0x96a4('0x24')](_0x5d1941)[_0x96a4('0x25')](function(_0x3f026b){return _0x3f026b;});}return null;};}function removeEntity(_0xba7c2f,_0x5a5bbd){return function(_0x5def61){if(_0x5def61){return _0x5def61[_0x96a4('0x26')]()[_0x96a4('0x25')](function(){_0xba7c2f[_0x96a4('0x1f')](0xcc)[_0x96a4('0x19')]();});}};}function handleEntityNotFound(_0x160cd3,_0x3a3990){return function(_0x4bb7d3){if(!_0x4bb7d3){_0x160cd3[_0x96a4('0x18')](0x194);}return _0x4bb7d3;};}function handleError(_0x38ffa4,_0x52e326){_0x52e326=_0x52e326||0x1f4;return function(_0x446197){logger[_0x96a4('0x27')](_0x446197[_0x96a4('0x28')]);if(_0x446197['name']){delete _0x446197['name'];}_0x38ffa4[_0x96a4('0x1f')](_0x52e326)[_0x96a4('0x29')](_0x446197);};}exports[_0x96a4('0x2a')]=function(_0x1a539f,_0x1fba24){var _0x4a797c={},_0x4aad83={},_0x50d2a2={'count':0x0,'rows':[]};var _0x58b022=_[_0x96a4('0x2b')](db[_0x96a4('0x2c')][_0x96a4('0x2d')],function(_0x12fa4c){return{'name':_0x12fa4c[_0x96a4('0x2e')],'type':_0x12fa4c['type'][_0x96a4('0x2f')]};});_0x4aad83[_0x96a4('0x30')]=_['map'](_0x58b022,_0x96a4('0x31'));_0x4aad83[_0x96a4('0x32')]=_[_0x96a4('0x33')](_0x1a539f[_0x96a4('0x32')]);_0x4aad83[_0x96a4('0x34')]=_[_0x96a4('0x35')](_0x4aad83[_0x96a4('0x30')],_0x4aad83[_0x96a4('0x32')]);_0x4a797c[_0x96a4('0x36')]=_[_0x96a4('0x35')](_0x4aad83[_0x96a4('0x30')],qs[_0x96a4('0x37')](_0x1a539f[_0x96a4('0x32')][_0x96a4('0x37')]));_0x4a797c[_0x96a4('0x36')]=_0x4a797c[_0x96a4('0x36')][_0x96a4('0x38')]?_0x4a797c['attributes']:_0x4aad83[_0x96a4('0x30')];if(!_0x1a539f[_0x96a4('0x32')]['hasOwnProperty'](_0x96a4('0x39'))){_0x4a797c[_0x96a4('0x1c')]=qs['limit'](_0x1a539f['query'][_0x96a4('0x1c')]);_0x4a797c['offset']=qs[_0x96a4('0x1e')](_0x1a539f['query']['offset']);}_0x4a797c[_0x96a4('0x3a')]=qs['sort'](_0x1a539f[_0x96a4('0x32')][_0x96a4('0x3b')]);_0x4a797c['where']=qs[_0x96a4('0x34')](_[_0x96a4('0x3c')](_0x1a539f['query'],_0x4aad83[_0x96a4('0x34')]),_0x58b022);if(_0x1a539f[_0x96a4('0x32')][_0x96a4('0x3d')]){_0x4a797c[_0x96a4('0x3e')]=_['merge'](_0x4a797c[_0x96a4('0x3e')],{'$or':_[_0x96a4('0x2b')](_0x58b022,function(_0x5aa2fa){if(_0x5aa2fa[_0x96a4('0x3f')]!==_0x96a4('0x40')){var _0x2fe685={};_0x2fe685[_0x5aa2fa[_0x96a4('0x31')]]={'$like':'%'+_0x1a539f['query'][_0x96a4('0x3d')]+'%'};return _0x2fe685;}})});}_0x4a797c=_[_0x96a4('0x41')]({},_0x4a797c,_0x1a539f[_0x96a4('0x42')]);var _0x273dcb={'where':_0x4a797c['where']};return db[_0x96a4('0x2c')][_0x96a4('0x1d')](_0x273dcb)[_0x96a4('0x25')](function(_0x49737f){_0x50d2a2[_0x96a4('0x1d')]=_0x49737f;if(_0x1a539f['query'][_0x96a4('0x43')]){_0x4a797c[_0x96a4('0x44')]=[{'all':!![]}];}return db['ChatTransferReport'][_0x96a4('0x45')](_0x4a797c);})['then'](function(_0x3858a8){_0x50d2a2['rows']=_0x3858a8;return _0x50d2a2;})[_0x96a4('0x25')](respondWithFilteredResult(_0x1fba24,_0x4a797c))[_0x96a4('0x46')](handleError(_0x1fba24,null));};exports[_0x96a4('0x47')]=function(_0x334149,_0x1a2658){var _0x317a97={'raw':!![],'where':{'id':_0x334149[_0x96a4('0x48')]['id']}},_0x47e8a0={};_0x47e8a0[_0x96a4('0x30')]=_[_0x96a4('0x33')](db[_0x96a4('0x2c')][_0x96a4('0x2d')]);_0x47e8a0['query']=_['keys'](_0x334149[_0x96a4('0x32')]);_0x47e8a0[_0x96a4('0x34')]=_[_0x96a4('0x35')](_0x47e8a0['model'],_0x47e8a0['query']);_0x317a97[_0x96a4('0x36')]=_[_0x96a4('0x35')](_0x47e8a0['model'],qs[_0x96a4('0x37')](_0x334149[_0x96a4('0x32')][_0x96a4('0x37')]));_0x317a97[_0x96a4('0x36')]=_0x317a97[_0x96a4('0x36')][_0x96a4('0x38')]?_0x317a97[_0x96a4('0x36')]:_0x47e8a0[_0x96a4('0x30')];if(_0x334149['query']['includeAll']){_0x317a97[_0x96a4('0x44')]=[{'all':!![]}];}_0x317a97=_['merge']({},_0x317a97,_0x334149[_0x96a4('0x42')]);return db['ChatTransferReport'][_0x96a4('0x49')](_0x317a97)[_0x96a4('0x25')](handleEntityNotFound(_0x1a2658,null))['then'](respondWithResult(_0x1a2658,null))[_0x96a4('0x46')](handleError(_0x1a2658,null));};exports[_0x96a4('0x4a')]=function(_0x52115f,_0x52b87c){return db['ChatTransferReport'][_0x96a4('0x4a')](_0x52115f['body'],{})['then'](respondWithResult(_0x52b87c,0xc9))[_0x96a4('0x46')](handleError(_0x52b87c,null));};exports[_0x96a4('0x24')]=function(_0x50985b,_0x41fb0b){if(_0x50985b[_0x96a4('0x4b')]['id']){delete _0x50985b['body']['id'];}return db[_0x96a4('0x2c')][_0x96a4('0x49')]({'where':{'id':_0x50985b[_0x96a4('0x48')]['id']}})[_0x96a4('0x25')](handleEntityNotFound(_0x41fb0b,null))[_0x96a4('0x25')](saveUpdates(_0x50985b[_0x96a4('0x4b')],null))[_0x96a4('0x25')](respondWithResult(_0x41fb0b,null))[_0x96a4('0x46')](handleError(_0x41fb0b,null));};exports['destroy']=function(_0x4ae79b,_0x1f4c72){return db[_0x96a4('0x2c')]['find']({'where':{'id':_0x4ae79b[_0x96a4('0x48')]['id']}})[_0x96a4('0x25')](handleEntityNotFound(_0x1f4c72,null))[_0x96a4('0x25')](removeEntity(_0x1f4c72,null))['catch'](handleError(_0x1f4c72,null));};exports[_0x96a4('0x4c')]=function(_0x316663,_0x5c79bd){return db[_0x96a4('0x2c')][_0x96a4('0x4c')]()[_0x96a4('0x25')](respondWithResult(_0x5c79bd,null))['catch'](handleError(_0x5c79bd,null));}; \ No newline at end of file +var _0xfe0a=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','send','map','ChatTransferReport','type','model','query','keys','intersection','attributes','fields','hasOwnProperty','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','rawAttributes','include','find','create','body','params','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs'];(function(_0x34d0a4,_0x217ff4){var _0x350ae3=function(_0x2834af){while(--_0x2834af){_0x34d0a4['push'](_0x34d0a4['shift']());}};_0x350ae3(++_0x217ff4);}(_0xfe0a,0x10c));var _0xafe0=function(_0x14f21c,_0x315b28){_0x14f21c=_0x14f21c-0x0;var _0x2b509b=_0xfe0a[_0x14f21c];return _0x2b509b;};'use strict';var emlformat=require(_0xafe0('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xafe0('0x1'));var jsonpatch=require(_0xafe0('0x2'));var rp=require(_0xafe0('0x3'));var moment=require('moment');var BPromise=require(_0xafe0('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0xafe0('0x5'));var sox=require(_0xafe0('0x6'));var csv=require(_0xafe0('0x7'));var ejs=require(_0xafe0('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xafe0('0x9'));var crypto=require(_0xafe0('0xa'));var jsforce=require(_0xafe0('0xb'));var deskjs=require(_0xafe0('0xc'));var toCsv=require('to-csv');var querystring=require(_0xafe0('0xd'));var Papa=require('papaparse');var Redis=require(_0xafe0('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xafe0('0xf'));var as=require(_0xafe0('0x10'));var hardwareService=require(_0xafe0('0x11'));var logger=require(_0xafe0('0x12'))(_0xafe0('0x13'));var utils=require(_0xafe0('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xafe0('0x15'));var db=require(_0xafe0('0x16'))['db'];function respondWithStatusCode(_0x116610,_0x3669d1){_0x3669d1=_0x3669d1||0xcc;return function(_0x4865a4){if(_0x4865a4){return _0x116610[_0xafe0('0x17')](_0x3669d1);}return _0x116610[_0xafe0('0x18')](_0x3669d1)['end']();};}function respondWithResult(_0xd54083,_0x7ae7b9){_0x7ae7b9=_0x7ae7b9||0xc8;return function(_0xcc1418){if(_0xcc1418){return _0xd54083[_0xafe0('0x18')](_0x7ae7b9)[_0xafe0('0x19')](_0xcc1418);}};}function respondWithFilteredResult(_0x80450a,_0x3d950e){return function(_0x18e506){if(_0x18e506){var _0x13e4a5=typeof _0x3d950e[_0xafe0('0x1a')]==='undefined'&&typeof _0x3d950e['limit']===_0xafe0('0x1b');var _0x158138=_0x18e506[_0xafe0('0x1c')];var _0xbc2b87=_0x13e4a5?0x0:_0x3d950e['offset'];var _0x281d1a=_0x13e4a5?_0x18e506['count']:_0x3d950e['offset']+_0x3d950e[_0xafe0('0x1d')];var _0x2b87a7;if(_0x281d1a>=_0x158138){_0x281d1a=_0x158138;_0x2b87a7=0xc8;}else{_0x2b87a7=0xce;}_0x80450a[_0xafe0('0x18')](_0x2b87a7);return _0x80450a['set'](_0xafe0('0x1e'),_0xbc2b87+'-'+_0x281d1a+'/'+_0x158138)[_0xafe0('0x19')](_0x18e506);}return null;};}function patchUpdates(_0x41fc65){return function(_0x2c5d98){try{jsonpatch[_0xafe0('0x1f')](_0x2c5d98,_0x41fc65,!![]);}catch(_0xe33b77){return BPromise[_0xafe0('0x20')](_0xe33b77);}return _0x2c5d98[_0xafe0('0x21')]();};}function saveUpdates(_0x40258a,_0x9e20ae){return function(_0x4375cc){if(_0x4375cc){return _0x4375cc[_0xafe0('0x22')](_0x40258a)[_0xafe0('0x23')](function(_0xe25448){return _0xe25448;});}return null;};}function removeEntity(_0x25d757,_0x519ffb){return function(_0x30ea39){if(_0x30ea39){return _0x30ea39[_0xafe0('0x24')]()['then'](function(){_0x25d757[_0xafe0('0x18')](0xcc)[_0xafe0('0x25')]();});}};}function handleEntityNotFound(_0x44f306,_0x558ea8){return function(_0x402bbf){if(!_0x402bbf){_0x44f306['sendStatus'](0x194);}return _0x402bbf;};}function handleError(_0xdb18,_0x8b897b){_0x8b897b=_0x8b897b||0x1f4;return function(_0x2bc23a){logger[_0xafe0('0x26')](_0x2bc23a[_0xafe0('0x27')]);if(_0x2bc23a[_0xafe0('0x28')]){delete _0x2bc23a[_0xafe0('0x28')];}_0xdb18[_0xafe0('0x18')](_0x8b897b)[_0xafe0('0x29')](_0x2bc23a);};}exports['index']=function(_0x28c58a,_0x36d600){var _0x214912={},_0x3ab9ed={},_0x29fa50={'count':0x0,'rows':[]};var _0xa41a24=_[_0xafe0('0x2a')](db[_0xafe0('0x2b')]['rawAttributes'],function(_0x383bd5){return{'name':_0x383bd5['fieldName'],'type':_0x383bd5[_0xafe0('0x2c')]['key']};});_0x3ab9ed[_0xafe0('0x2d')]=_['map'](_0xa41a24,_0xafe0('0x28'));_0x3ab9ed[_0xafe0('0x2e')]=_[_0xafe0('0x2f')](_0x28c58a['query']);_0x3ab9ed['filters']=_[_0xafe0('0x30')](_0x3ab9ed[_0xafe0('0x2d')],_0x3ab9ed[_0xafe0('0x2e')]);_0x214912[_0xafe0('0x31')]=_[_0xafe0('0x30')](_0x3ab9ed['model'],qs['fields'](_0x28c58a[_0xafe0('0x2e')][_0xafe0('0x32')]));_0x214912[_0xafe0('0x31')]=_0x214912['attributes']['length']?_0x214912[_0xafe0('0x31')]:_0x3ab9ed['model'];if(!_0x28c58a[_0xafe0('0x2e')][_0xafe0('0x33')]('nolimit')){_0x214912[_0xafe0('0x1d')]=qs[_0xafe0('0x1d')](_0x28c58a[_0xafe0('0x2e')][_0xafe0('0x1d')]);_0x214912[_0xafe0('0x1a')]=qs[_0xafe0('0x1a')](_0x28c58a[_0xafe0('0x2e')][_0xafe0('0x1a')]);}_0x214912['order']=qs[_0xafe0('0x34')](_0x28c58a[_0xafe0('0x2e')][_0xafe0('0x34')]);_0x214912[_0xafe0('0x35')]=qs[_0xafe0('0x36')](_[_0xafe0('0x37')](_0x28c58a['query'],_0x3ab9ed[_0xafe0('0x36')]),_0xa41a24);if(_0x28c58a['query'][_0xafe0('0x38')]){_0x214912['where']=_[_0xafe0('0x39')](_0x214912[_0xafe0('0x35')],{'$or':_[_0xafe0('0x2a')](_0xa41a24,function(_0x4acdc9){if(_0x4acdc9['type']!==_0xafe0('0x3a')){var _0xbd73fb={};_0xbd73fb[_0x4acdc9[_0xafe0('0x28')]]={'$like':'%'+_0x28c58a[_0xafe0('0x2e')]['filter']+'%'};return _0xbd73fb;}})});}_0x214912=_[_0xafe0('0x39')]({},_0x214912,_0x28c58a[_0xafe0('0x3b')]);var _0x2488f3={'where':_0x214912['where']};return db[_0xafe0('0x2b')]['count'](_0x2488f3)[_0xafe0('0x23')](function(_0x132907){_0x29fa50['count']=_0x132907;if(_0x28c58a['query'][_0xafe0('0x3c')]){_0x214912['include']=[{'all':!![]}];}return db[_0xafe0('0x2b')][_0xafe0('0x3d')](_0x214912);})[_0xafe0('0x23')](function(_0x12f590){_0x29fa50[_0xafe0('0x3e')]=_0x12f590;return _0x29fa50;})[_0xafe0('0x23')](respondWithFilteredResult(_0x36d600,_0x214912))[_0xafe0('0x3f')](handleError(_0x36d600,null));};exports[_0xafe0('0x40')]=function(_0x206d79,_0x19d5b2){var _0x2a267a={'raw':!![],'where':{'id':_0x206d79['params']['id']}},_0x4e21e7={};_0x4e21e7[_0xafe0('0x2d')]=_['keys'](db[_0xafe0('0x2b')][_0xafe0('0x41')]);_0x4e21e7[_0xafe0('0x2e')]=_[_0xafe0('0x2f')](_0x206d79['query']);_0x4e21e7[_0xafe0('0x36')]=_[_0xafe0('0x30')](_0x4e21e7[_0xafe0('0x2d')],_0x4e21e7[_0xafe0('0x2e')]);_0x2a267a[_0xafe0('0x31')]=_['intersection'](_0x4e21e7[_0xafe0('0x2d')],qs[_0xafe0('0x32')](_0x206d79['query']['fields']));_0x2a267a[_0xafe0('0x31')]=_0x2a267a['attributes']['length']?_0x2a267a[_0xafe0('0x31')]:_0x4e21e7[_0xafe0('0x2d')];if(_0x206d79[_0xafe0('0x2e')][_0xafe0('0x3c')]){_0x2a267a[_0xafe0('0x42')]=[{'all':!![]}];}_0x2a267a=_['merge']({},_0x2a267a,_0x206d79[_0xafe0('0x3b')]);return db['ChatTransferReport'][_0xafe0('0x43')](_0x2a267a)[_0xafe0('0x23')](handleEntityNotFound(_0x19d5b2,null))['then'](respondWithResult(_0x19d5b2,null))[_0xafe0('0x3f')](handleError(_0x19d5b2,null));};exports[_0xafe0('0x44')]=function(_0xd82b5,_0x597ee7){return db['ChatTransferReport'][_0xafe0('0x44')](_0xd82b5['body'],{})[_0xafe0('0x23')](respondWithResult(_0x597ee7,0xc9))['catch'](handleError(_0x597ee7,null));};exports[_0xafe0('0x22')]=function(_0x1eae0c,_0xd5923){if(_0x1eae0c['body']['id']){delete _0x1eae0c[_0xafe0('0x45')]['id'];}return db['ChatTransferReport']['find']({'where':{'id':_0x1eae0c[_0xafe0('0x46')]['id']}})['then'](handleEntityNotFound(_0xd5923,null))[_0xafe0('0x23')](saveUpdates(_0x1eae0c[_0xafe0('0x45')],null))[_0xafe0('0x23')](respondWithResult(_0xd5923,null))[_0xafe0('0x3f')](handleError(_0xd5923,null));};exports[_0xafe0('0x24')]=function(_0x3ffc06,_0x21c629){return db['ChatTransferReport'][_0xafe0('0x43')]({'where':{'id':_0x3ffc06[_0xafe0('0x46')]['id']}})['then'](handleEntityNotFound(_0x21c629,null))[_0xafe0('0x23')](removeEntity(_0x21c629,null))[_0xafe0('0x3f')](handleError(_0x21c629,null));};exports['describe']=function(_0x163f71,_0x139352){return db[_0xafe0('0x2b')]['describe']()[_0xafe0('0x23')](respondWithResult(_0x139352,null))[_0xafe0('0x3f')](handleError(_0x139352,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index 652ce15..daade68 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 _0xbcca=['./chatTransferReport.attributes','exports','define','ChatTransferReport','report_chat_transfer','lodash','api','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x278e3c,_0x1c9cfd){var _0x3e2d9b=function(_0x34d928){while(--_0x34d928){_0x278e3c['push'](_0x278e3c['shift']());}};_0x3e2d9b(++_0x1c9cfd);}(_0xbcca,0x1cd));var _0xabcc=function(_0xb1fcde,_0x1a23ea){_0xb1fcde=_0xb1fcde-0x0;var _0x175df2=_0xbcca[_0xb1fcde];return _0x175df2;};'use strict';var _=require(_0xabcc('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xabcc('0x1'));var moment=require(_0xabcc('0x2'));var BPromise=require(_0xabcc('0x3'));var rp=require(_0xabcc('0x4'));var fs=require('fs');var path=require(_0xabcc('0x5'));var rimraf=require('rimraf');var config=require(_0xabcc('0x6'));var attributes=require(_0xabcc('0x7'));module[_0xabcc('0x8')]=function(_0x35ffe2,_0x1e3593){return _0x35ffe2[_0xabcc('0x9')](_0xabcc('0xa'),attributes,{'tableName':_0xabcc('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xc339=['./chatTransferReport.attributes','exports','define','ChatTransferReport','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x695b76,_0x551526){var _0x1dc21f=function(_0x5fdb1c){while(--_0x5fdb1c){_0x695b76['push'](_0x695b76['shift']());}};_0x1dc21f(++_0x551526);}(_0xc339,0xae));var _0x9c33=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc339[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x9c33('0x0'));var util=require(_0x9c33('0x1'));var logger=require(_0x9c33('0x2'))(_0x9c33('0x3'));var moment=require('moment');var BPromise=require(_0x9c33('0x4'));var rp=require(_0x9c33('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9c33('0x6'));var config=require(_0x9c33('0x7'));var attributes=require(_0x9c33('0x8'));module[_0x9c33('0x9')]=function(_0xaf8460,_0xd6da0b){return _0xaf8460[_0x9c33('0xa')](_0x9c33('0xb'),attributes,{'tableName':'report_chat_transfer','paranoid':![],'indexes':[{'name':_0x9c33('0xc'),'fields':[_0x9c33('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.rpc.js b/server/api/chatTransferReport/chatTransferReport.rpc.js index 72222ad..c5650c7 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 _0x7efc=['rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','ChatTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','ChatTransferReport,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x18b027,_0x4d0486){var _0x19643f=function(_0x36753b){while(--_0x36753b){_0x18b027['push'](_0x18b027['shift']());}};_0x19643f(++_0x4d0486);}(_0x7efc,0x180));var _0xc7ef=function(_0x280c4b,_0xfe785d){_0x280c4b=_0x280c4b-0x0;var _0x2a5e90=_0x7efc[_0x280c4b];return _0x2a5e90;};'use strict';var _=require(_0xc7ef('0x0'));var util=require(_0xc7ef('0x1'));var moment=require(_0xc7ef('0x2'));var BPromise=require(_0xc7ef('0x3'));var rs=require(_0xc7ef('0x4'));var fs=require('fs');var Redis=require(_0xc7ef('0x5'));var db=require(_0xc7ef('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xc7ef('0x7'));var config=require(_0xc7ef('0x8'));var jayson=require(_0xc7ef('0x9'));var client=jayson[_0xc7ef('0xa')][_0xc7ef('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x36fb25,_0x278d32,_0x2729c2){return new BPromise(function(_0x4fc9bf,_0x2a7701){return client['request'](_0x36fb25,_0x2729c2)[_0xc7ef('0xc')](function(_0x3ba427){logger[_0xc7ef('0xd')]('ChatTransferReport,\x20%s,\x20%s',_0x278d32,_0xc7ef('0xe'));logger[_0xc7ef('0xf')](_0xc7ef('0x10'),_0x278d32,_0xc7ef('0xe'),JSON[_0xc7ef('0x11')](_0x3ba427));if(_0x3ba427[_0xc7ef('0x12')]){if(_0x3ba427[_0xc7ef('0x12')]['code']===0x1f4){logger['error'](_0xc7ef('0x13'),_0x278d32,_0x3ba427[_0xc7ef('0x12')][_0xc7ef('0x14')]);return _0x2a7701(_0x3ba427[_0xc7ef('0x12')][_0xc7ef('0x14')]);}logger[_0xc7ef('0x12')]('ChatTransferReport,\x20%s,\x20%s',_0x278d32,_0x3ba427['error'][_0xc7ef('0x14')]);return _0x4fc9bf(_0x3ba427['error'][_0xc7ef('0x14')]);}else{logger['info'](_0xc7ef('0x13'),_0x278d32,_0xc7ef('0xe'));_0x4fc9bf(_0x3ba427[_0xc7ef('0x15')][_0xc7ef('0x14')]);}})[_0xc7ef('0x16')](function(_0x5563a0){logger[_0xc7ef('0x12')]('ChatTransferReport,\x20%s,\x20%s',_0x278d32,_0x5563a0);_0x2a7701(_0x5563a0);});});} \ No newline at end of file +var _0xd1fe=['lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','then','info','ChatTransferReport,\x20%s,\x20%s','request\x20sent','ChatTransferReport,\x20%s,\x20%s,\x20%s','error','message'];(function(_0x67d4c1,_0x346942){var _0x3ed198=function(_0x166049){while(--_0x166049){_0x67d4c1['push'](_0x67d4c1['shift']());}};_0x3ed198(++_0x346942);}(_0xd1fe,0xdd));var _0xed1f=function(_0x582d5f,_0x2355f1){_0x582d5f=_0x582d5f-0x0;var _0x5ed1b4=_0xd1fe[_0x582d5f];return _0x5ed1b4;};'use strict';var _=require(_0xed1f('0x0'));var util=require(_0xed1f('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xed1f('0x2'));var fs=require('fs');var Redis=require(_0xed1f('0x3'));var db=require(_0xed1f('0x4'))['db'];var utils=require(_0xed1f('0x5'));var logger=require('../../config/logger')(_0xed1f('0x6'));var config=require(_0xed1f('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xed1f('0x8')][_0xed1f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x792a52,_0x5ef87f,_0x295be6){return new BPromise(function(_0x43c8ff,_0x55ea0b){return client['request'](_0x792a52,_0x295be6)[_0xed1f('0xa')](function(_0x2e100a){logger[_0xed1f('0xb')](_0xed1f('0xc'),_0x5ef87f,_0xed1f('0xd'));logger['debug'](_0xed1f('0xe'),_0x5ef87f,_0xed1f('0xd'),JSON['stringify'](_0x2e100a));if(_0x2e100a['error']){if(_0x2e100a[_0xed1f('0xf')]['code']===0x1f4){logger[_0xed1f('0xf')](_0xed1f('0xc'),_0x5ef87f,_0x2e100a[_0xed1f('0xf')]['message']);return _0x55ea0b(_0x2e100a['error'][_0xed1f('0x10')]);}logger[_0xed1f('0xf')](_0xed1f('0xc'),_0x5ef87f,_0x2e100a[_0xed1f('0xf')][_0xed1f('0x10')]);return _0x43c8ff(_0x2e100a[_0xed1f('0xf')][_0xed1f('0x10')]);}else{logger['info'](_0xed1f('0xc'),_0x5ef87f,_0xed1f('0xd'));_0x43c8ff(_0x2e100a['result'][_0xed1f('0x10')]);}})['catch'](function(_0x4d7b3e){logger[_0xed1f('0xf')](_0xed1f('0xc'),_0x5ef87f,_0x4d7b3e);_0x55ea0b(_0x4d7b3e);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index 178d7e9..1a559d5 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 _0x8e2b=['index','describe','/:id','show','post','create','update','delete','destroy','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./chatTransferReport.controller','get','isAuthenticated'];(function(_0x502ed1,_0xd79589){var _0x3dd009=function(_0x41d675){while(--_0x41d675){_0x502ed1['push'](_0x502ed1['shift']());}};_0x3dd009(++_0xd79589);}(_0x8e2b,0x95));var _0xb8e2=function(_0x3e522f,_0x5c7a86){_0x3e522f=_0x3e522f-0x0;var _0x289067=_0x8e2b[_0x3e522f];return _0x289067;};'use strict';var multer=require(_0xb8e2('0x0'));var util=require('util');var path=require(_0xb8e2('0x1'));var timeout=require(_0xb8e2('0x2'));var express=require(_0xb8e2('0x3'));var router=express[_0xb8e2('0x4')]();var fs_extra=require(_0xb8e2('0x5'));var auth=require(_0xb8e2('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xb8e2('0x7'));var controller=require(_0xb8e2('0x8'));router[_0xb8e2('0x9')]('/',auth[_0xb8e2('0xa')](),controller[_0xb8e2('0xb')]);router[_0xb8e2('0x9')]('/describe',auth['isAuthenticated'](),controller[_0xb8e2('0xc')]);router['get'](_0xb8e2('0xd'),auth[_0xb8e2('0xa')](),controller[_0xb8e2('0xe')]);router[_0xb8e2('0xf')]('/',auth[_0xb8e2('0xa')](),controller[_0xb8e2('0x10')]);router['put'](_0xb8e2('0xd'),auth[_0xb8e2('0xa')](),controller[_0xb8e2('0x11')]);router[_0xb8e2('0x12')](_0xb8e2('0xd'),auth[_0xb8e2('0xa')](),controller[_0xb8e2('0x13')]);module['exports']=router; \ No newline at end of file +var _0xf206=['create','put','update','delete','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./chatTransferReport.controller','isAuthenticated','index','get','/describe','describe','/:id','show','post'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xf206,0x89));var _0x6f20=function(_0x51a130,_0x1be49f){_0x51a130=_0x51a130-0x0;var _0x3b3215=_0xf206[_0x51a130];return _0x3b3215;};'use strict';var multer=require(_0x6f20('0x0'));var util=require('util');var path=require(_0x6f20('0x1'));var timeout=require(_0x6f20('0x2'));var express=require(_0x6f20('0x3'));var router=express[_0x6f20('0x4')]();var fs_extra=require(_0x6f20('0x5'));var auth=require(_0x6f20('0x6'));var interaction=require(_0x6f20('0x7'));var config=require('../../config/environment');var controller=require(_0x6f20('0x8'));router['get']('/',auth[_0x6f20('0x9')](),controller[_0x6f20('0xa')]);router[_0x6f20('0xb')](_0x6f20('0xc'),auth['isAuthenticated'](),controller[_0x6f20('0xd')]);router[_0x6f20('0xb')](_0x6f20('0xe'),auth['isAuthenticated'](),controller[_0x6f20('0xf')]);router[_0x6f20('0x10')]('/',auth[_0x6f20('0x9')](),controller[_0x6f20('0x11')]);router[_0x6f20('0x12')](_0x6f20('0xe'),auth[_0x6f20('0x9')](),controller[_0x6f20('0x13')]);router[_0x6f20('0x14')]('/:id',auth[_0x6f20('0x9')](),controller['destroy']);module[_0x6f20('0x15')]=router; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.attributes.js b/server/api/chatWebsite/chatWebsite.attributes.js index eedee10..678c402 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 _0x09b6=['website_alias','bottom_right','alternate','#fafafa','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','mandatoryDisposition','sequelize','exports','STRING','address','#011F6A','#ffffff','INTEGER','BOOLEAN','ENUM','rounded','squared','We\x20are\x20here!','Send','Contact\x20us','Powered\x20by\x20xCALLY','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20submission\x20error','Note','Thanks\x20you\x20for\x20your\x20time!','Skip','star','thumb','TEXT','stringify','name','text','email','getDataValue','onlineForm','parse','setDataValue','input','Comments','Leave\x20your\x20comments','offlineForm','generate','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','New\x20offline\x20message\x20from\x20websiteName','Your\x20request\x20has\x20not\x20been\x20processed.','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}'];(function(_0x17a0a0,_0x1befaa){var _0x4da752=function(_0x429829){while(--_0x429829){_0x17a0a0['push'](_0x17a0a0['shift']());}};_0x4da752(++_0x1befaa);}(_0x09b6,0x121));var _0x609b=function(_0x539533,_0x59b89b){_0x539533=_0x539533-0x0;var _0x3942f3=_0x09b6[_0x539533];return _0x3942f3;};'use strict';var Sequelize=require(_0x609b('0x0'));var rs=require('randomstring');module[_0x609b('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'address':{'type':Sequelize[_0x609b('0x2')],'allowNull':![],'unique':_0x609b('0x3')},'description':{'type':Sequelize[_0x609b('0x2')]},'mapKey':{'type':Sequelize[_0x609b('0x2')],'defaultValue':'email'},'mapKeyOffline':{'type':Sequelize['STRING'],'defaultValue':'email'},'key':{'type':Sequelize[_0x609b('0x2')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0x609b('0x2')],'defaultValue':'Agent'},'customerAlias':{'type':Sequelize[_0x609b('0x2')],'defaultValue':'Me'},'color':{'type':Sequelize[_0x609b('0x2')],'allowNull':![],'defaultValue':_0x609b('0x4'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0x609b('0x2')],'allowNull':![],'defaultValue':_0x609b('0x4'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0x609b('0x2')],'allowNull':![],'defaultValue':_0x609b('0x5'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0x609b('0x6')],'defaultValue':0xf},'remote':{'type':Sequelize['STRING']},'animation':{'type':Sequelize[_0x609b('0x7')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0x609b('0x8')](_0x609b('0x9'),_0x609b('0xa')),'defaultValue':'rounded'},'header_online':{'type':Sequelize[_0x609b('0x2')],'defaultValue':_0x609b('0xb')},'start_chat_button':{'type':Sequelize['STRING'],'defaultValue':'Chat'},'offline_chat_button':{'type':Sequelize[_0x609b('0x2')],'defaultValue':_0x609b('0xc')},'header_offline':{'type':Sequelize[_0x609b('0x2')],'defaultValue':_0x609b('0xd')},'download_transcript':{'type':Sequelize[_0x609b('0x7')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0x609b('0x6')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0x609b('0x2')],'defaultValue':_0x609b('0xe')},'defaultWhiteLabel':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sitepic':{'type':Sequelize['TEXT']},'closingQuestion':{'type':Sequelize[_0x609b('0x2')],'defaultValue':_0x609b('0xf')},'formSubmitSuccessMessage':{'type':Sequelize[_0x609b('0x2')],'defaultValue':'Form\x20properly\x20submitted'},'formSubmitFailureMessage':{'type':Sequelize[_0x609b('0x2')],'defaultValue':_0x609b('0x10')},'noteTitle':{'type':Sequelize[_0x609b('0x2')],'defaultValue':_0x609b('0x11')},'placeholderMessage':{'type':Sequelize[_0x609b('0x2')],'defaultValue':'Type\x20a\x20message'},'closingMessage':{'type':Sequelize[_0x609b('0x2')],'defaultValue':_0x609b('0x12')},'closingMessageButton':{'type':Sequelize[_0x609b('0x2')],'defaultValue':_0x609b('0xc')},'skipMessageButton':{'type':Sequelize['STRING'],'defaultValue':_0x609b('0x13')},'conditionAgreement':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableRating':{'type':Sequelize[_0x609b('0x7')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x609b('0x7')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0x609b('0x7')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0x609b('0x2')],'defaultValue':'Feedback'},'ratingType':{'type':Sequelize[_0x609b('0x8')](_0x609b('0x14'),_0x609b('0x15')),'defaultValue':_0x609b('0x14')},'ratingStarsNumber':{'type':Sequelize[_0x609b('0x6')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x609b('0x16')],'defaultValue':function(){return JSON[_0x609b('0x17')]({'items':[{'type':'input','variable':null,'config':{'placeholder':_0x609b('0x18'),'type':_0x609b('0x19'),'required':!![]},'props':{'title':_0x609b('0x18'),'helpText':''}},{'type':'input','props':{'title':_0x609b('0x1a'),'helpText':''},'config':{'required':!![],'placeholder':_0x609b('0x1a'),'type':_0x609b('0x1a')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0x609b('0x1b')](_0x609b('0x1c'))?JSON[_0x609b('0x1d')](this[_0x609b('0x1b')](_0x609b('0x1c'))):{};},'set':function(_0x23c8c6){return this[_0x609b('0x1e')]('onlineForm',JSON[_0x609b('0x17')](_0x23c8c6));}},'offlineForm':{'type':Sequelize[_0x609b('0x16')],'defaultValue':function(){return JSON['stringify']({'items':[{'type':_0x609b('0x1f'),'props':{'title':_0x609b('0x1a'),'helpText':''},'config':{'required':!![],'placeholder':'email','type':_0x609b('0x1a')},'variable':null},{'type':'textarea','config':{'placeholder':_0x609b('0x20')},'props':{'title':_0x609b('0x20'),'helpText':_0x609b('0x21')}}],'fromKey':0x0});},'get':function(){return this[_0x609b('0x1b')]('offlineForm')?JSON['parse'](this[_0x609b('0x1b')](_0x609b('0x22'))):{};},'set':function(_0xc5ee97){return this[_0x609b('0x1e')]('offlineForm',JSON[_0x609b('0x17')](_0xc5ee97));}},'token':{'type':Sequelize[_0x609b('0x2')],'defaultValue':function(){return rs[_0x609b('0x23')]();}},'autoclose':{'type':Sequelize[_0x609b('0x7')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x609b('0x7')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0x609b('0x7')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0x609b('0x2')]},'forwardOffline':{'type':Sequelize[_0x609b('0x7')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize['STRING']},'waitingTitle':{'type':Sequelize[_0x609b('0x2')],'defaultValue':'All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.'},'waitingMessage':{'type':Sequelize['STRING'],'defaultValue':_0x609b('0x24')},'offlineMessageSubject':{'type':Sequelize[_0x609b('0x2')],'defaultValue':_0x609b('0x25')},'offlineMessageBody':{'type':Sequelize['STRING'],'defaultValue':'You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:'},'enableUnmanagedNote':{'type':Sequelize[_0x609b('0x7')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize['STRING'],'defaultValue':_0x609b('0x26')},'skipUnmanaged':{'type':Sequelize[_0x609b('0x2')],'defaultValue':_0x609b('0x13')},'sendUnmanaged':{'type':Sequelize[_0x609b('0x2')],'defaultValue':'Send'},'enableCustomerAttachment':{'type':Sequelize[_0x609b('0x7')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0x609b('0x16')]},'showAgentAvatar':{'type':Sequelize[_0x609b('0x7')],'defaultValue':![]},'timezone':{'type':Sequelize[_0x609b('0x2')]},'notificationTemplate':{'type':Sequelize[_0x609b('0x16')],'defaultValue':function(){return _0x609b('0x27');}},'notificationSound':{'type':Sequelize[_0x609b('0x7')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x609b('0x7')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0x609b('0x7')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0x609b('0x2')],'defaultValue':_0x609b('0x28')},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0x609b('0x2')],'defaultValue':_0x609b('0x29')},'verticalAlignment':{'type':Sequelize[_0x609b('0x6')],'defaultValue':0x1e},'messagesAlignment':{'type':Sequelize[_0x609b('0x2')],'defaultValue':_0x609b('0x2a')},'defaultTitle':{'type':Sequelize[_0x609b('0x2')]},'customerAvatar':{'type':Sequelize['TEXT']},'showCustomerAvatar':{'type':Sequelize[_0x609b('0x7')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0x609b('0x6')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x609b('0x2b'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x609b('0x7')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x609b('0x7')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x609b('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x609b('0x2')],'defaultValue':_0x609b('0x2c')},'systemAvatar':{'type':Sequelize[_0x609b('0x16')]},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0x609b('0x2d')},'mandatoryDisposition':{'type':Sequelize[_0x609b('0x7')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x272290){if(!_0x272290)this['setDataValue']('mandatoryDispositionPauseId',null);this[_0x609b('0x1e')](_0x609b('0x2e'),_0x272290);}},'vidaooEscalation':{'type':Sequelize[_0x609b('0x7')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0x609b('0x2')]},'vidaooTopic':{'type':Sequelize[_0x609b('0x2')],'allowNull':![],'defaultValue':'Generated\x20by\x20XCALLY\x20Motion'},'vidaooNote':{'type':Sequelize[_0x609b('0x2')],'defaultValue':function(){return'Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}';}},'vidaooMetadata':{'type':Sequelize['TEXT'],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0x609b('0x7')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x860f=['input','name','text','parse','getDataValue','onlineForm','setDataValue','Leave\x20your\x20comments','offlineForm','generate','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Your\x20request\x20has\x20not\x20been\x20processed.','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','bottom_right','alternate','#fafafa','System','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','sequelize','exports','STRING','address','email','Agent','#011F6A','#ffffff','INTEGER','BOOLEAN','ENUM','rounded','We\x20are\x20here!','Chat','Send','Powered\x20by\x20xCALLY','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20submission\x20error','Type\x20a\x20message','Skip','Feedback','thumb','star','stringify'];(function(_0x4e0a43,_0xd9ba5b){var _0x3f9fd4=function(_0x36d35c){while(--_0x36d35c){_0x4e0a43['push'](_0x4e0a43['shift']());}};_0x3f9fd4(++_0xd9ba5b);}(_0x860f,0x1c7));var _0xf860=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0x860f[_0x484e36];return _0xafc85d;};'use strict';var Sequelize=require(_0xf860('0x0'));var rs=require('randomstring');module[_0xf860('0x1')]={'name':{'type':Sequelize[_0xf860('0x2')],'allowNull':![]},'address':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xf860('0x3')},'description':{'type':Sequelize['STRING']},'mapKey':{'type':Sequelize['STRING'],'defaultValue':_0xf860('0x4')},'mapKeyOffline':{'type':Sequelize['STRING'],'defaultValue':_0xf860('0x4')},'key':{'type':Sequelize['STRING'],'allowNull':![]},'agentAlias':{'type':Sequelize['STRING'],'defaultValue':_0xf860('0x5')},'customerAlias':{'type':Sequelize[_0xf860('0x2')],'defaultValue':'Me'},'color':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xf860('0x6'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0xf860('0x2')],'allowNull':![],'defaultValue':_0xf860('0x6'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0xf860('0x2')],'allowNull':![],'defaultValue':_0xf860('0x7'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0xf860('0x8')],'defaultValue':0xf},'remote':{'type':Sequelize['STRING']},'animation':{'type':Sequelize[_0xf860('0x9')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0xf860('0xa')](_0xf860('0xb'),'squared'),'defaultValue':_0xf860('0xb')},'header_online':{'type':Sequelize[_0xf860('0x2')],'defaultValue':_0xf860('0xc')},'start_chat_button':{'type':Sequelize[_0xf860('0x2')],'defaultValue':_0xf860('0xd')},'offline_chat_button':{'type':Sequelize[_0xf860('0x2')],'defaultValue':_0xf860('0xe')},'header_offline':{'type':Sequelize[_0xf860('0x2')],'defaultValue':'Contact\x20us'},'download_transcript':{'type':Sequelize[_0xf860('0x9')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0xf860('0x8')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize['STRING'],'defaultValue':_0xf860('0xf')},'defaultWhiteLabel':{'type':Sequelize[_0xf860('0x9')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0xf860('0x10')]},'closingQuestion':{'type':Sequelize[_0xf860('0x2')],'defaultValue':_0xf860('0x11')},'formSubmitSuccessMessage':{'type':Sequelize[_0xf860('0x2')],'defaultValue':'Form\x20properly\x20submitted'},'formSubmitFailureMessage':{'type':Sequelize[_0xf860('0x2')],'defaultValue':_0xf860('0x12')},'noteTitle':{'type':Sequelize['STRING'],'defaultValue':'Note'},'placeholderMessage':{'type':Sequelize[_0xf860('0x2')],'defaultValue':_0xf860('0x13')},'closingMessage':{'type':Sequelize[_0xf860('0x2')],'defaultValue':'Thanks\x20you\x20for\x20your\x20time!'},'closingMessageButton':{'type':Sequelize[_0xf860('0x2')],'defaultValue':_0xf860('0xe')},'skipMessageButton':{'type':Sequelize[_0xf860('0x2')],'defaultValue':_0xf860('0x14')},'conditionAgreement':{'type':Sequelize[_0xf860('0x9')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0xf860('0x9')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0xf860('0x9')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0xf860('0x9')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0xf860('0x2')],'defaultValue':_0xf860('0x15')},'ratingType':{'type':Sequelize[_0xf860('0xa')]('star',_0xf860('0x16')),'defaultValue':_0xf860('0x17')},'ratingStarsNumber':{'type':Sequelize[_0xf860('0x8')],'defaultValue':0x5},'onlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON[_0xf860('0x18')]({'items':[{'type':_0xf860('0x19'),'variable':null,'config':{'placeholder':_0xf860('0x1a'),'type':_0xf860('0x1b'),'required':!![]},'props':{'title':_0xf860('0x1a'),'helpText':''}},{'type':'input','props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':_0xf860('0x4'),'type':_0xf860('0x4')},'variable':null}],'fromKey':0x1});},'get':function(){return this['getDataValue']('onlineForm')?JSON[_0xf860('0x1c')](this[_0xf860('0x1d')](_0xf860('0x1e'))):{};},'set':function(_0x1c679f){return this[_0xf860('0x1f')](_0xf860('0x1e'),JSON[_0xf860('0x18')](_0x1c679f));}},'offlineForm':{'type':Sequelize[_0xf860('0x10')],'defaultValue':function(){return JSON[_0xf860('0x18')]({'items':[{'type':_0xf860('0x19'),'props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':'email','type':_0xf860('0x4')},'variable':null},{'type':'textarea','config':{'placeholder':'Comments'},'props':{'title':'Comments','helpText':_0xf860('0x20')}}],'fromKey':0x0});},'get':function(){return this[_0xf860('0x1d')](_0xf860('0x21'))?JSON[_0xf860('0x1c')](this[_0xf860('0x1d')](_0xf860('0x21'))):{};},'set':function(_0x2ea267){return this['setDataValue']('offlineForm',JSON['stringify'](_0x2ea267));}},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0xf860('0x22')]();}},'autoclose':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0xf860('0x9')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0xf860('0x9')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize['STRING']},'forwardOffline':{'type':Sequelize[_0xf860('0x9')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0xf860('0x2')]},'waitingTitle':{'type':Sequelize['STRING'],'defaultValue':_0xf860('0x23')},'waitingMessage':{'type':Sequelize[_0xf860('0x2')],'defaultValue':'Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.'},'offlineMessageSubject':{'type':Sequelize[_0xf860('0x2')],'defaultValue':'New\x20offline\x20message\x20from\x20websiteName'},'offlineMessageBody':{'type':Sequelize['STRING'],'defaultValue':_0xf860('0x24')},'enableUnmanagedNote':{'type':Sequelize[_0xf860('0x9')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize['STRING'],'defaultValue':_0xf860('0x25')},'skipUnmanaged':{'type':Sequelize[_0xf860('0x2')],'defaultValue':_0xf860('0x14')},'sendUnmanaged':{'type':Sequelize['STRING'],'defaultValue':_0xf860('0xe')},'enableCustomerAttachment':{'type':Sequelize[_0xf860('0x9')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0xf860('0x9')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0xf860('0x10')]},'showAgentAvatar':{'type':Sequelize[_0xf860('0x9')],'defaultValue':![]},'timezone':{'type':Sequelize[_0xf860('0x2')]},'notificationTemplate':{'type':Sequelize[_0xf860('0x10')],'defaultValue':function(){return _0xf860('0x26');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xf860('0x9')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0xf860('0x9')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0xf860('0x2')],'defaultValue':_0xf860('0x27')},'waitForTheAssignedAgent':{'type':Sequelize[_0xf860('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize['STRING'],'defaultValue':_0xf860('0x28')},'verticalAlignment':{'type':Sequelize[_0xf860('0x8')],'defaultValue':0x1e},'messagesAlignment':{'type':Sequelize[_0xf860('0x2')],'defaultValue':_0xf860('0x29')},'defaultTitle':{'type':Sequelize[_0xf860('0x2')]},'customerAvatar':{'type':Sequelize[_0xf860('0x10')]},'showCustomerAvatar':{'type':Sequelize[_0xf860('0x9')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0xf860('0x8')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0xf860('0x2')],'allowNull':![],'defaultValue':_0xf860('0x2a'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0xf860('0x9')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xf860('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xf860('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0xf860('0x2')],'defaultValue':_0xf860('0x2b')},'systemAvatar':{'type':Sequelize[_0xf860('0x10')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0xf860('0x8')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0xf860('0x9')],'defaultValue':![],'comment':_0xf860('0x2c'),'set':function(_0x4a5269){if(!_0x4a5269)this[_0xf860('0x1f')](_0xf860('0x2d'),null);this[_0xf860('0x1f')](_0xf860('0x2e'),_0x4a5269);}},'vidaooEscalation':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize['STRING']},'vidaooTopic':{'type':Sequelize[_0xf860('0x2')],'allowNull':![],'defaultValue':'Generated\x20by\x20XCALLY\x20Motion'},'vidaooNote':{'type':Sequelize[_0xf860('0x2')],'defaultValue':function(){return _0xf860('0x2f');}},'vidaooMetadata':{'type':Sequelize['TEXT'],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0xf860('0x9')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0xf860('0x10')]}}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.controller.js b/server/api/chatWebsite/chatWebsite.controller.js index bf8098c..5f3c58b 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 _0x64cd=['length','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','options','includeAll','include','rows','params','merge','find','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','ChatWebsiteId','Disposition','getDispositions','findOne','order','findAll','removeDispositions','ids','CannedAnswer','getAnswers','addLogo','sitepic','file','filename','addAvatar','agentAvatar','addCustomerAvatar','customerAvatar','systemAvatar','getLogo','join','root','server/files/images/logos/default_logo.svg','isNil','existsSync','server/files/images/logos/','download','getAvatar','server/files/images/avatars/default_avatar.png','server/files/images/avatars/','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','getSystemAvatar','server/files/images/avatars/system_avatar.png','user-agent-parser','setUA','user-agent','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','from','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','List','Contacts','DESC','ChatApplication','Applications','account','applications','list','orderBy','priority','asc','customerIp','cf-connecting-ip','headers','x-forwarded-for','first','firstName','lastName','x-real-port','referer','version','format','%s\x20%s','browser','unknown','device','%s\x20%s\x20%s','type','vendor','threadId','externalUrl','ChatInteraction','ContactId','interaction','spread','messageId','update','created','autoclose','push','close','unmanaged','*,*,*,*','ChatMessage','contact','AttachmentId','UserId','unshift','agent','forcedOwnership','Start','EventManager','notify','offline','files','from\x20is\x20mandatory','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','readFileSync','server/files/templates/chatOfflineMessage.ejs','utf8','render','toPairs','ChatOfflineMessage','originalname','mimetype','server','attachments','basename','sequelize','Attachment','bulkCreate','MailServerOut','Smtp','forwardOffline','forwardOfflineAddress','service','host','port','secure','authentication','auth','pass','SendMail','sendMail','email','offlineMessageSubject','openNewInteraction','MailAccountId','toPairsIn','subjectOffline','NotifyMailAccount','notifyMail','remove','Could\x20not\x20remove\x20attachment\x20file','addInteraction','omit','getInteractions','Contact','Owner','fullname','internal','Tag','Tags','color','Command','getSnippet','timezone','iftime\x20%s,%s','interval','iftime\x20%s','OFFLINE','No\x20timezone','Interval','getProactiveActions','getLicense','virtual','custom','License','increment','chatLicenseExceeded','Intervals','all','some','server/files/chat/iframe.ejs','remoteAddress','alignment','verticalAlignment','backgroundColor','addApplications','transaction','findAndCountAll','getApplications','addProactiveActions','ChatProactiveAction','offlineForm','onlineForm','fromKey','addAgents','removeAgents','isArray','emit','userChatWebsite:remove','getAgents','User','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','squel','jsforce','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','./chatWebsite.socket','register','jayson/promise','client','http','info','request\x20sent','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatWebsite,\x20%s,\x20%s','message','result','catch','sendStatus','status','json','offset','undefined','limit','count','apply','then','get','ChatWebsites','UserProfileResource','destroy','stack','name','send','index','Pause','mandatoryDispositionPause','map','ChatWebsite','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x64cd,0xe2));var _0xd64c=function(_0x5519a9,_0x1c5147){_0x5519a9=_0x5519a9-0x0;var _0x32f2cc=_0x64cd[_0x5519a9];return _0x32f2cc;};'use strict';var emlformat=require(_0xd64c('0x0'));var rimraf=require(_0xd64c('0x1'));var zipdir=require(_0xd64c('0x2'));var jsonpatch=require(_0xd64c('0x3'));var rp=require(_0xd64c('0x4'));var moment=require(_0xd64c('0x5'));var BPromise=require(_0xd64c('0x6'));var Mustache=require('mustache');var util=require(_0xd64c('0x7'));var path=require(_0xd64c('0x8'));var sox=require(_0xd64c('0x9'));var csv=require(_0xd64c('0xa'));var ejs=require(_0xd64c('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xd64c('0xc'));var crypto=require('crypto');var jsforce=require(_0xd64c('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xd64c('0xe'));var qs=require(_0xd64c('0xf'));var as=require(_0xd64c('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xd64c('0x11'));var utils=require('../../config/utils');var config=require(_0xd64c('0x12'));var licenseUtil=require(_0xd64c('0x13'));var db=require(_0xd64c('0x14'))['db'];config[_0xd64c('0x15')]=_[_0xd64c('0x16')](config[_0xd64c('0x15')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd64c('0x15')]));require(_0xd64c('0x17'))[_0xd64c('0x18')](socket);var jayson=require(_0xd64c('0x19'));var client=jayson[_0xd64c('0x1a')][_0xd64c('0x1b')]({'port':0x232c});var client9002=jayson[_0xd64c('0x1a')][_0xd64c('0x1b')]({'port':0x232a});var client9003=jayson['client']['http']({'port':0x232b});var client9001=jayson[_0xd64c('0x1a')]['http']({'port':0x2329});function respondWithRpcPromise(_0x3af324,_0x70b536,_0x3b9d15,_0x4006e9){return new BPromise(function(_0x4946bb,_0x1392f5){var _0x296f41=_0x4006e9||client;return _0x296f41['request'](_0x3af324,_0x3b9d15)['then'](function(_0x324750){logger[_0xd64c('0x1c')]('ChatWebsite,\x20%s,\x20%s',_0x70b536,_0xd64c('0x1d'));logger['debug'](_0xd64c('0x1e'),_0x70b536,_0xd64c('0x1d'),JSON[_0xd64c('0x1f')](_0x324750));if(_0x324750['error']){if(_0x324750[_0xd64c('0x20')][_0xd64c('0x21')]===0x1f4){logger[_0xd64c('0x20')](_0xd64c('0x22'),_0x70b536,_0x324750[_0xd64c('0x20')]['message']);return _0x1392f5(_0x324750[_0xd64c('0x20')]['message']);}logger[_0xd64c('0x20')](_0xd64c('0x22'),_0x70b536,_0x324750[_0xd64c('0x20')][_0xd64c('0x23')]);return _0x4946bb(_0x324750[_0xd64c('0x20')][_0xd64c('0x23')]);}else{logger['info']('ChatWebsite,\x20%s,\x20%s',_0x70b536,_0xd64c('0x1d'));_0x4946bb(_0x324750[_0xd64c('0x24')][_0xd64c('0x23')]);}})[_0xd64c('0x25')](function(_0xe4bde1){logger[_0xd64c('0x20')](_0xd64c('0x22'),_0x70b536,_0xe4bde1);_0x1392f5(_0xe4bde1);});});}function respondWithStatusCode(_0x4b8fd5,_0x5b9e47){_0x5b9e47=_0x5b9e47||0xcc;return function(_0x278eb2){if(_0x278eb2){return _0x4b8fd5[_0xd64c('0x26')](_0x5b9e47);}return _0x4b8fd5[_0xd64c('0x27')](_0x5b9e47)['end']();};}function respondWithResult(_0xd17fc1,_0x4b523f){_0x4b523f=_0x4b523f||0xc8;return function(_0x43de1f){if(_0x43de1f){return _0xd17fc1['status'](_0x4b523f)[_0xd64c('0x28')](_0x43de1f);}};}function respondWithFilteredResult(_0x4ea696,_0x2119e1){return function(_0x8e5d4a){if(_0x8e5d4a){var _0x27ef7a=typeof _0x2119e1[_0xd64c('0x29')]===_0xd64c('0x2a')&&typeof _0x2119e1[_0xd64c('0x2b')]===_0xd64c('0x2a');var _0x17ed38=_0x8e5d4a[_0xd64c('0x2c')];var _0x1379fa=_0x27ef7a?0x0:_0x2119e1[_0xd64c('0x29')];var _0x3b3f06=_0x27ef7a?_0x8e5d4a['count']:_0x2119e1['offset']+_0x2119e1['limit'];var _0x3a4b10;if(_0x3b3f06>=_0x17ed38){_0x3b3f06=_0x17ed38;_0x3a4b10=0xc8;}else{_0x3a4b10=0xce;}_0x4ea696[_0xd64c('0x27')](_0x3a4b10);return _0x4ea696['set']('Content-Range',_0x1379fa+'-'+_0x3b3f06+'/'+_0x17ed38)['json'](_0x8e5d4a);}return null;};}function patchUpdates(_0x3221c7){return function(_0x212f93){try{jsonpatch[_0xd64c('0x2d')](_0x212f93,_0x3221c7,!![]);}catch(_0xbeaeae){return BPromise['reject'](_0xbeaeae);}return _0x212f93['save']();};}function saveUpdates(_0x39dabd,_0x22070e){return function(_0x872806){if(_0x872806){return _0x872806['update'](_0x39dabd)[_0xd64c('0x2e')](function(_0x2917c3){return _0x2917c3;});}return null;};}function removeEntity(_0x36eebe,_0x5c2b73){return function(_0x40a72a){if(_0x40a72a){return _0x40a72a['destroy']()[_0xd64c('0x2e')](function(){var _0x58b0f2=_0x40a72a[_0xd64c('0x2f')]({'plain':!![]});var _0x41d0a3=_0xd64c('0x30');return db[_0xd64c('0x31')][_0xd64c('0x32')]({'where':{'type':_0x41d0a3,'resourceId':_0x58b0f2['id']}})['then'](function(){return _0x40a72a;});})[_0xd64c('0x2e')](function(){_0x36eebe[_0xd64c('0x27')](0xcc)['end']();});}};}function handleEntityNotFound(_0xa46e42,_0x1ec5a7){return function(_0xb4174d){if(!_0xb4174d){_0xa46e42[_0xd64c('0x26')](0x194);}return _0xb4174d;};}function handleError(_0x163932,_0x26600c){_0x26600c=_0x26600c||0x1f4;return function(_0x3be5eb){logger[_0xd64c('0x20')](_0x3be5eb[_0xd64c('0x33')]);if(_0x3be5eb[_0xd64c('0x34')]){delete _0x3be5eb[_0xd64c('0x34')];}_0x163932['status'](_0x26600c)[_0xd64c('0x35')](_0x3be5eb);};}exports[_0xd64c('0x36')]=function(_0x266b78,_0x5c1241){var _0x323fa6={'include':[{'model':db[_0xd64c('0x37')],'as':_0xd64c('0x38')}]},_0x1a1854={},_0x3f98fd={'count':0x0,'rows':[]};var _0x25b429=_[_0xd64c('0x39')](db[_0xd64c('0x3a')][_0xd64c('0x3b')],function(_0xbaa12d){return{'name':_0xbaa12d[_0xd64c('0x3c')],'type':_0xbaa12d['type'][_0xd64c('0x3d')]};});_0x1a1854[_0xd64c('0x3e')]=_[_0xd64c('0x39')](_0x25b429,_0xd64c('0x34'));_0x1a1854[_0xd64c('0x3f')]=_[_0xd64c('0x40')](_0x266b78[_0xd64c('0x3f')]);_0x1a1854[_0xd64c('0x41')]=_[_0xd64c('0x42')](_0x1a1854[_0xd64c('0x3e')],_0x1a1854['query']);_0x323fa6[_0xd64c('0x43')]=_[_0xd64c('0x42')](_0x1a1854[_0xd64c('0x3e')],qs[_0xd64c('0x44')](_0x266b78[_0xd64c('0x3f')][_0xd64c('0x44')]));_0x323fa6['attributes']=_0x323fa6[_0xd64c('0x43')][_0xd64c('0x45')]?_0x323fa6[_0xd64c('0x43')]:_0x1a1854[_0xd64c('0x3e')];if(!_0x266b78[_0xd64c('0x3f')][_0xd64c('0x46')](_0xd64c('0x47'))){_0x323fa6[_0xd64c('0x2b')]=qs[_0xd64c('0x2b')](_0x266b78['query']['limit']);_0x323fa6['offset']=qs[_0xd64c('0x29')](_0x266b78[_0xd64c('0x3f')][_0xd64c('0x29')]);}_0x323fa6['order']=qs[_0xd64c('0x48')](_0x266b78[_0xd64c('0x3f')][_0xd64c('0x48')]);_0x323fa6[_0xd64c('0x49')]=qs[_0xd64c('0x41')](_[_0xd64c('0x4a')](_0x266b78[_0xd64c('0x3f')],_0x1a1854['filters']),_0x25b429);if(_0x266b78[_0xd64c('0x3f')][_0xd64c('0x4b')]){_0x323fa6[_0xd64c('0x49')]=_['merge'](_0x323fa6[_0xd64c('0x49')],{'$or':_['map'](_0x25b429,function(_0x50ab26){if(_0x50ab26['type']!==_0xd64c('0x4c')){var _0x171a7b={};_0x171a7b[_0x50ab26[_0xd64c('0x34')]]={'$like':'%'+_0x266b78[_0xd64c('0x3f')]['filter']+'%'};return _0x171a7b;}})});}_0x323fa6=_['merge']({},_0x323fa6,_0x266b78[_0xd64c('0x4d')]);var _0x2afa24={'where':_0x323fa6[_0xd64c('0x49')]};return db[_0xd64c('0x3a')][_0xd64c('0x2c')](_0x2afa24)['then'](function(_0x5f1fe9){_0x3f98fd[_0xd64c('0x2c')]=_0x5f1fe9;if(_0x266b78[_0xd64c('0x3f')][_0xd64c('0x4e')]){_0x323fa6[_0xd64c('0x4f')]=[{'all':!![]}];}return db['ChatWebsite']['findAll'](_0x323fa6);})[_0xd64c('0x2e')](function(_0xc08422){_0x3f98fd[_0xd64c('0x50')]=_0xc08422;return _0x3f98fd;})[_0xd64c('0x2e')](respondWithFilteredResult(_0x5c1241,_0x323fa6))['catch'](handleError(_0x5c1241,null));};exports['show']=function(_0x4b4f13,_0x28d976){var _0x29f368={'raw':![],'where':{'id':_0x4b4f13[_0xd64c('0x51')]['id']},'include':[{'model':db['Pause'],'as':_0xd64c('0x38')}]},_0x445d57={};_0x445d57['model']=_[_0xd64c('0x40')](db[_0xd64c('0x3a')][_0xd64c('0x3b')]);_0x445d57[_0xd64c('0x3f')]=_[_0xd64c('0x40')](_0x4b4f13[_0xd64c('0x3f')]);_0x445d57['filters']=_['intersection'](_0x445d57[_0xd64c('0x3e')],_0x445d57[_0xd64c('0x3f')]);_0x29f368[_0xd64c('0x43')]=_[_0xd64c('0x42')](_0x445d57[_0xd64c('0x3e')],qs[_0xd64c('0x44')](_0x4b4f13[_0xd64c('0x3f')][_0xd64c('0x44')]));_0x29f368[_0xd64c('0x43')]=_0x29f368['attributes'][_0xd64c('0x45')]?_0x29f368[_0xd64c('0x43')]:_0x445d57[_0xd64c('0x3e')];if(_0x4b4f13[_0xd64c('0x3f')][_0xd64c('0x4e')]){_0x29f368[_0xd64c('0x4f')]=[{'all':!![]}];}_0x29f368=_[_0xd64c('0x52')]({},_0x29f368,_0x4b4f13[_0xd64c('0x4d')]);return db[_0xd64c('0x3a')][_0xd64c('0x53')](_0x29f368)[_0xd64c('0x2e')](handleEntityNotFound(_0x28d976,null))['then'](respondWithResult(_0x28d976,null))[_0xd64c('0x25')](handleError(_0x28d976,null));};exports[_0xd64c('0x54')]=function(_0x414ed8,_0x51ff78){return db[_0xd64c('0x3a')][_0xd64c('0x54')](_0x414ed8[_0xd64c('0x55')],{})[_0xd64c('0x2e')](function(_0x2b6114){var _0x4ba468=_0x414ed8[_0xd64c('0x56')][_0xd64c('0x2f')]({'plain':!![]});if(!_0x4ba468)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4ba468[_0xd64c('0x57')]===_0xd64c('0x56')){var _0x592d48=_0x2b6114[_0xd64c('0x2f')]({'plain':!![]});var _0x20aa7e=_0xd64c('0x30');return db[_0xd64c('0x58')][_0xd64c('0x53')]({'where':{'name':_0x20aa7e,'userProfileId':_0x4ba468[_0xd64c('0x59')]},'raw':!![]})[_0xd64c('0x2e')](function(_0x250d3f){if(_0x250d3f&&_0x250d3f[_0xd64c('0x5a')]===0x0){return db[_0xd64c('0x31')][_0xd64c('0x54')]({'name':_0x592d48[_0xd64c('0x34')],'resourceId':_0x592d48['id'],'type':_0x250d3f[_0xd64c('0x34')],'sectionId':_0x250d3f['id']},{})['then'](function(){return _0x2b6114;});}else{return _0x2b6114;}})[_0xd64c('0x25')](function(_0x258844){logger[_0xd64c('0x20')](_0xd64c('0x5b'),_0x258844);throw _0x258844;});}return _0x2b6114;})[_0xd64c('0x2e')](respondWithResult(_0x51ff78,0xc9))[_0xd64c('0x25')](handleError(_0x51ff78,null));};exports['update']=function(_0x237280,_0x498ae2){if(_0x237280['body']['id']){delete _0x237280[_0xd64c('0x55')]['id'];}return db[_0xd64c('0x3a')]['find']({'where':{'id':_0x237280[_0xd64c('0x51')]['id']},'include':[{'model':db[_0xd64c('0x37')],'as':_0xd64c('0x38')}]})[_0xd64c('0x2e')](handleEntityNotFound(_0x498ae2,null))[_0xd64c('0x2e')](saveUpdates(_0x237280[_0xd64c('0x55')],null))[_0xd64c('0x2e')](respondWithResult(_0x498ae2,null))[_0xd64c('0x25')](handleError(_0x498ae2,null));};exports['destroy']=function(_0x353b91,_0x146fff){return db['ChatWebsite'][_0xd64c('0x53')]({'where':{'id':_0x353b91['params']['id']}})[_0xd64c('0x2e')](handleEntityNotFound(_0x146fff,null))[_0xd64c('0x2e')](removeEntity(_0x146fff,null))[_0xd64c('0x25')](handleError(_0x146fff,null));};exports[_0xd64c('0x5c')]=function(_0x15f2fe,_0x46a794){return db[_0xd64c('0x3a')][_0xd64c('0x5c')]()[_0xd64c('0x2e')](respondWithResult(_0x46a794,null))['catch'](handleError(_0x46a794,null));};exports[_0xd64c('0x5d')]=function(_0x403d7e,_0x4f7e09,_0x31efa8){if(_0x403d7e[_0xd64c('0x55')]['id']){delete _0x403d7e[_0xd64c('0x55')]['id'];}return db['ChatWebsite']['find']({'where':{'id':_0x403d7e[_0xd64c('0x51')]['id']}})[_0xd64c('0x2e')](handleEntityNotFound(_0x4f7e09,null))['then'](function(_0x51053f){if(_0x51053f){_0x403d7e[_0xd64c('0x55')][_0xd64c('0x5e')]=_0x51053f['id'];return db[_0xd64c('0x5f')]['create'](_0x403d7e['body']);}})[_0xd64c('0x2e')](respondWithResult(_0x4f7e09,null))[_0xd64c('0x25')](handleError(_0x4f7e09,null));};exports[_0xd64c('0x60')]=function(_0x585617,_0x703f6c,_0x1ca934){var _0x4ad6de={'raw':![],'where':{}};var _0x2977b3={};var _0x56f4bc={'count':0x0,'rows':[]};return db[_0xd64c('0x3a')][_0xd64c('0x61')]({'where':{'id':_0x585617[_0xd64c('0x51')]['id']}})['then'](handleEntityNotFound(_0x703f6c,null))['then'](function(_0x2878ca){if(_0x2878ca){_0x2977b3[_0xd64c('0x3e')]=_['keys'](db[_0xd64c('0x5f')]['rawAttributes']);_0x2977b3[_0xd64c('0x3f')]=_[_0xd64c('0x40')](_0x585617[_0xd64c('0x3f')]);_0x2977b3[_0xd64c('0x41')]=_[_0xd64c('0x42')](_0x2977b3[_0xd64c('0x3e')],_0x2977b3[_0xd64c('0x3f')]);_0x4ad6de['attributes']=_[_0xd64c('0x42')](_0x2977b3['model'],qs[_0xd64c('0x44')](_0x585617[_0xd64c('0x3f')][_0xd64c('0x44')]));_0x4ad6de[_0xd64c('0x43')]=_0x4ad6de['attributes']['length']?_0x4ad6de['attributes']:_0x2977b3[_0xd64c('0x3e')];if(!_0x585617[_0xd64c('0x3f')][_0xd64c('0x46')](_0xd64c('0x47'))){_0x4ad6de['limit']=qs[_0xd64c('0x2b')](_0x585617[_0xd64c('0x3f')][_0xd64c('0x2b')]);_0x4ad6de[_0xd64c('0x29')]=qs['offset'](_0x585617['query'][_0xd64c('0x29')]);}_0x4ad6de[_0xd64c('0x62')]=qs['sort'](_0x585617[_0xd64c('0x3f')]['sort']);_0x4ad6de[_0xd64c('0x49')]=qs[_0xd64c('0x41')](_[_0xd64c('0x4a')](_0x585617[_0xd64c('0x3f')],_0x2977b3[_0xd64c('0x41')]));_0x4ad6de['where'][_0xd64c('0x5e')]=_0x2878ca['id'];if(_0x585617[_0xd64c('0x3f')][_0xd64c('0x4b')]){_0x4ad6de[_0xd64c('0x49')]=_['merge'](_0x4ad6de[_0xd64c('0x49')],{'$or':_['map'](_0x4ad6de['attributes'],function(_0x23e94c){var _0xbd581f={};_0xbd581f[_0x23e94c]={'$like':'%'+_0x585617[_0xd64c('0x3f')][_0xd64c('0x4b')]+'%'};return _0xbd581f;})});}_0x4ad6de=_[_0xd64c('0x52')]({},_0x4ad6de,_0x585617['options']);return db[_0xd64c('0x5f')][_0xd64c('0x2c')]({'where':_0x4ad6de['where']})['then'](function(_0xafa053){_0x56f4bc[_0xd64c('0x2c')]=_0xafa053;if(_0x585617[_0xd64c('0x3f')][_0xd64c('0x4e')]){_0x4ad6de['include']=[{'all':!![]}];}return db[_0xd64c('0x5f')][_0xd64c('0x63')](_0x4ad6de);})['then'](function(_0x27ebc4){_0x56f4bc['rows']=_0x27ebc4;return _0x56f4bc;});}})[_0xd64c('0x2e')](respondWithFilteredResult(_0x703f6c,_0x4ad6de))[_0xd64c('0x25')](handleError(_0x703f6c,null));};exports[_0xd64c('0x64')]=function(_0x331593,_0x3aac41,_0x28e45b){return db[_0xd64c('0x3a')][_0xd64c('0x53')]({'where':{'id':_0x331593[_0xd64c('0x51')]['id']}})['then'](handleEntityNotFound(_0x3aac41,null))[_0xd64c('0x2e')](function(_0xe86ba2){if(_0xe86ba2){return _0xe86ba2[_0xd64c('0x64')](_0x331593[_0xd64c('0x3f')][_0xd64c('0x65')]);}})[_0xd64c('0x2e')](respondWithStatusCode(_0x3aac41,null))['catch'](handleError(_0x3aac41,null));};exports['addAnswer']=function(_0x47c618,_0x4eca8a,_0x25a644){if(_0x47c618[_0xd64c('0x55')]['id']){delete _0x47c618[_0xd64c('0x55')]['id'];}return db[_0xd64c('0x3a')]['find']({'where':{'id':_0x47c618[_0xd64c('0x51')]['id']}})[_0xd64c('0x2e')](handleEntityNotFound(_0x4eca8a,null))[_0xd64c('0x2e')](function(_0x6d3616){if(_0x6d3616){_0x47c618[_0xd64c('0x55')][_0xd64c('0x5e')]=_0x6d3616['id'];return db[_0xd64c('0x66')][_0xd64c('0x54')](_0x47c618[_0xd64c('0x55')]);}})[_0xd64c('0x2e')](respondWithResult(_0x4eca8a,null))[_0xd64c('0x25')](handleError(_0x4eca8a,null));};exports[_0xd64c('0x67')]=function(_0x19c8cd,_0x28a517,_0x1be8d3){var _0x32007a={'raw':![],'where':{}};var _0x5b9313={};var _0x28fc09={'count':0x0,'rows':[]};return db['ChatWebsite']['findOne']({'where':{'id':_0x19c8cd[_0xd64c('0x51')]['id']}})[_0xd64c('0x2e')](handleEntityNotFound(_0x28a517,null))[_0xd64c('0x2e')](function(_0x1de2f5){if(_0x1de2f5){_0x5b9313['model']=_['keys'](db[_0xd64c('0x66')][_0xd64c('0x3b')]);_0x5b9313[_0xd64c('0x3f')]=_[_0xd64c('0x40')](_0x19c8cd[_0xd64c('0x3f')]);_0x5b9313[_0xd64c('0x41')]=_[_0xd64c('0x42')](_0x5b9313[_0xd64c('0x3e')],_0x5b9313[_0xd64c('0x3f')]);_0x32007a[_0xd64c('0x43')]=_['intersection'](_0x5b9313['model'],qs[_0xd64c('0x44')](_0x19c8cd[_0xd64c('0x3f')]['fields']));_0x32007a[_0xd64c('0x43')]=_0x32007a['attributes'][_0xd64c('0x45')]?_0x32007a[_0xd64c('0x43')]:_0x5b9313['model'];if(!_0x19c8cd['query']['hasOwnProperty'](_0xd64c('0x47'))){_0x32007a['limit']=qs[_0xd64c('0x2b')](_0x19c8cd[_0xd64c('0x3f')][_0xd64c('0x2b')]);_0x32007a[_0xd64c('0x29')]=qs['offset'](_0x19c8cd[_0xd64c('0x3f')]['offset']);}_0x32007a[_0xd64c('0x62')]=qs['sort'](_0x19c8cd[_0xd64c('0x3f')][_0xd64c('0x48')]);_0x32007a[_0xd64c('0x49')]=qs[_0xd64c('0x41')](_[_0xd64c('0x4a')](_0x19c8cd['query'],_0x5b9313[_0xd64c('0x41')]));_0x32007a[_0xd64c('0x49')]['ChatWebsiteId']=_0x1de2f5['id'];if(_0x19c8cd['query'][_0xd64c('0x4b')]){_0x32007a[_0xd64c('0x49')]=_[_0xd64c('0x52')](_0x32007a[_0xd64c('0x49')],{'$or':_[_0xd64c('0x39')](_0x32007a['attributes'],function(_0x289235){var _0x1ebe34={};_0x1ebe34[_0x289235]={'$like':'%'+_0x19c8cd[_0xd64c('0x3f')][_0xd64c('0x4b')]+'%'};return _0x1ebe34;})});}_0x32007a=_[_0xd64c('0x52')]({},_0x32007a,_0x19c8cd[_0xd64c('0x4d')]);return db[_0xd64c('0x66')][_0xd64c('0x2c')]({'where':_0x32007a[_0xd64c('0x49')]})['then'](function(_0x1d012d){_0x28fc09[_0xd64c('0x2c')]=_0x1d012d;if(_0x19c8cd[_0xd64c('0x3f')][_0xd64c('0x4e')]){_0x32007a[_0xd64c('0x4f')]=[{'all':!![]}];}return db[_0xd64c('0x66')][_0xd64c('0x63')](_0x32007a);})[_0xd64c('0x2e')](function(_0x12d99a){_0x28fc09[_0xd64c('0x50')]=_0x12d99a;return _0x28fc09;});}})[_0xd64c('0x2e')](respondWithFilteredResult(_0x28a517,_0x32007a))[_0xd64c('0x25')](handleError(_0x28a517,null));};exports['removeAnswers']=function(_0x56e5dd,_0x33e477,_0x2be9d9){return db[_0xd64c('0x3a')][_0xd64c('0x53')]({'where':{'id':_0x56e5dd[_0xd64c('0x51')]['id']}})[_0xd64c('0x2e')](handleEntityNotFound(_0x33e477,null))['then'](function(_0xf5c89b){if(_0xf5c89b){return _0xf5c89b['removeAnswers'](_0x56e5dd[_0xd64c('0x3f')]['ids']);}})[_0xd64c('0x2e')](respondWithStatusCode(_0x33e477,null))[_0xd64c('0x25')](handleError(_0x33e477,null));};exports[_0xd64c('0x68')]=function(_0x1af79f,_0xd39937,_0x3f08c7){_0x1af79f['body'][_0xd64c('0x69')]=_0x1af79f[_0xd64c('0x6a')][_0xd64c('0x6b')];return db[_0xd64c('0x3a')][_0xd64c('0x53')]({'where':{'id':_0x1af79f[_0xd64c('0x51')]['id']}})['then'](handleEntityNotFound(_0xd39937,null))[_0xd64c('0x2e')](saveUpdates(_0x1af79f[_0xd64c('0x55')],null))['then'](respondWithResult(_0xd39937,null))[_0xd64c('0x25')](handleError(_0xd39937,null));};exports[_0xd64c('0x6c')]=function(_0x8b17f,_0x1d5555,_0x5410ac){_0x8b17f[_0xd64c('0x55')][_0xd64c('0x6d')]=_0x8b17f['file'][_0xd64c('0x6b')];return db['ChatWebsite'][_0xd64c('0x53')]({'where':{'id':_0x8b17f[_0xd64c('0x51')]['id']}})[_0xd64c('0x2e')](handleEntityNotFound(_0x1d5555,null))[_0xd64c('0x2e')](saveUpdates(_0x8b17f[_0xd64c('0x55')],null))[_0xd64c('0x2e')](respondWithResult(_0x1d5555,null))[_0xd64c('0x25')](handleError(_0x1d5555,null));};exports[_0xd64c('0x6e')]=function(_0x14db15,_0x226156,_0xc289ad){_0x14db15[_0xd64c('0x55')][_0xd64c('0x6f')]=_0x14db15[_0xd64c('0x6a')][_0xd64c('0x6b')];return db[_0xd64c('0x3a')][_0xd64c('0x53')]({'where':{'id':_0x14db15['params']['id']}})[_0xd64c('0x2e')](handleEntityNotFound(_0x226156,null))['then'](saveUpdates(_0x14db15[_0xd64c('0x55')],null))[_0xd64c('0x2e')](respondWithResult(_0x226156,null))[_0xd64c('0x25')](handleError(_0x226156,null));};exports['addSystemAvatar']=function(_0x22fde7,_0x35306f,_0x50a142){_0x22fde7[_0xd64c('0x55')][_0xd64c('0x70')]=_0x22fde7[_0xd64c('0x6a')]['filename'];return db['ChatWebsite']['find']({'where':{'id':_0x22fde7[_0xd64c('0x51')]['id']}})[_0xd64c('0x2e')](handleEntityNotFound(_0x35306f,null))['then'](saveUpdates(_0x22fde7[_0xd64c('0x55')],null))[_0xd64c('0x2e')](respondWithResult(_0x35306f,null))[_0xd64c('0x25')](handleError(_0x35306f,null));};exports[_0xd64c('0x71')]=function(_0x29f6d7,_0x527283,_0x470d94){var _0x33fd8e=path[_0xd64c('0x72')](config[_0xd64c('0x73')],_0xd64c('0x74'));var _0x1b570b={'where':{'id':_0x29f6d7['params']['id']},'attributes':['id',_0xd64c('0x69')],'raw':!![]};var _0x1b9fa4=![];return require(_0xd64c('0x13'))['getLicense']()[_0xd64c('0x2e')](function(_0x5c11b8){if(_0x5c11b8){_0x1b9fa4=_0x5c11b8['custom'];}})[_0xd64c('0x2e')](function(){return db['ChatWebsite']['find'](_0x1b570b);})[_0xd64c('0x2e')](handleEntityNotFound(_0x527283,null))[_0xd64c('0x2e')](function(_0x2d8da1){if(_0x2d8da1){if(!_[_0xd64c('0x75')](_0x2d8da1[_0xd64c('0x69')])){if(fs[_0xd64c('0x76')](path[_0xd64c('0x72')](config[_0xd64c('0x73')],_0xd64c('0x77'),_0x2d8da1[_0xd64c('0x69')]))&&_0x1b9fa4){_0x33fd8e=path['join'](config[_0xd64c('0x73')],_0xd64c('0x77'),_0x2d8da1['sitepic']);}}return _0x527283[_0xd64c('0x78')](_0x33fd8e);}})[_0xd64c('0x25')](handleError(_0x527283,null));};exports[_0xd64c('0x79')]=function(_0x2e4913,_0x2f37a7,_0x3f68f2){var _0x19dc0f=path[_0xd64c('0x72')](config[_0xd64c('0x73')],_0xd64c('0x7a'));var _0x37810={'where':{'id':_0x2e4913[_0xd64c('0x51')]['id']},'attributes':['id',_0xd64c('0x6d')],'raw':!![]};return db['ChatWebsite'][_0xd64c('0x53')](_0x37810)[_0xd64c('0x2e')](handleEntityNotFound(_0x2f37a7,null))[_0xd64c('0x2e')](function(_0x319cdd){if(_0x319cdd){if(!_[_0xd64c('0x75')](_0x319cdd['agentAvatar'])){if(fs['existsSync'](path[_0xd64c('0x72')](config[_0xd64c('0x73')],_0xd64c('0x7b'),_0x319cdd[_0xd64c('0x6d')]))){_0x19dc0f=path[_0xd64c('0x72')](config[_0xd64c('0x73')],_0xd64c('0x7b'),_0x319cdd[_0xd64c('0x6d')]);}}return _0x2f37a7['download'](_0x19dc0f);}})[_0xd64c('0x25')](handleError(_0x2f37a7,null));};exports[_0xd64c('0x7c')]=function(_0x9a58b,_0x234678,_0x5af6c8){var _0x5ba061=path[_0xd64c('0x72')](config['root'],_0xd64c('0x7d'));var _0x40eb1b={'where':{'id':_0x9a58b[_0xd64c('0x51')]['id']},'attributes':['id','customerAvatar',_0xd64c('0x7e')],'raw':!![]};return db[_0xd64c('0x3a')][_0xd64c('0x53')](_0x40eb1b)[_0xd64c('0x2e')](handleEntityNotFound(_0x234678,null))[_0xd64c('0x2e')](function(_0x4c5829){if(_0x4c5829){if(!_[_0xd64c('0x75')](_0x4c5829[_0xd64c('0x6f')])){if(fs[_0xd64c('0x76')](path[_0xd64c('0x72')](config['root'],_0xd64c('0x7b'),_0x4c5829[_0xd64c('0x6f')]))&&_0x4c5829[_0xd64c('0x7e')]){_0x5ba061=path[_0xd64c('0x72')](config[_0xd64c('0x73')],_0xd64c('0x7b'),_0x4c5829[_0xd64c('0x6f')]);}}return _0x234678[_0xd64c('0x78')](_0x5ba061);}})[_0xd64c('0x25')](handleError(_0x234678,null));};exports[_0xd64c('0x7f')]=function(_0x22a69c,_0x53a674,_0x32d822){var _0x4baa50=path[_0xd64c('0x72')](config[_0xd64c('0x73')],_0xd64c('0x80'));var _0x11cacb={'where':{'id':_0x22a69c[_0xd64c('0x51')]['id']},'attributes':['id',_0xd64c('0x70')],'raw':!![]};return db[_0xd64c('0x3a')][_0xd64c('0x53')](_0x11cacb)[_0xd64c('0x2e')](handleEntityNotFound(_0x53a674,null))['then'](function(_0xf20ff9){if(_0xf20ff9){if(!_['isNil'](_0xf20ff9[_0xd64c('0x70')])){if(fs[_0xd64c('0x76')](path[_0xd64c('0x72')](config['root'],_0xd64c('0x7b'),_0xf20ff9[_0xd64c('0x70')]))){_0x4baa50=path['join'](config[_0xd64c('0x73')],_0xd64c('0x7b'),_0xf20ff9[_0xd64c('0x70')]);}}return _0x53a674[_0xd64c('0x78')](_0x4baa50);}})['catch'](handleError(_0x53a674,null));};exports['notify']=function(_0x168bd6,_0x5e6b44,_0x4b26f2){var _0xf6300c=require(_0xd64c('0x81'));var _0x173fbc=new _0xf6300c();var _0x1b0f15=_0x173fbc[_0xd64c('0x82')](_0x168bd6['headers'][_0xd64c('0x83')])['getResult']();var _0x2fd0f7={'body':_0x168bd6[_0xd64c('0x55')],'channel':'chat'};var _0x114913=[];var _0x3dd435=[];var _0x4a2102={};var _0x53085c=![];return db[_0xd64c('0x84')][_0xd64c('0x5c')]()[_0xd64c('0x2e')](function(_0x377173){if(!_0x377173){throw new db[(_0xd64c('0x85'))][(_0xd64c('0x86'))](_0xd64c('0x87'));}_0x114913=_[_0xd64c('0x88')](_['keys'](_0x377173),['createdAt','updatedAt']);_0x3dd435=_['difference'](_[_0xd64c('0x40')](_0x377173),[_0xd64c('0x89'),_0xd64c('0x8a'),_0xd64c('0x8b'),_0xd64c('0x8c')]);if(_0x168bd6[_0xd64c('0x55')]['id']){delete _0x168bd6[_0xd64c('0x55')]['id'];}if(_['isNil'](_0x168bd6[_0xd64c('0x55')][_0xd64c('0x8d')])){throw new db[(_0xd64c('0x85'))][(_0xd64c('0x86'))]('from\x20is\x20mandatory');}if(_['isNil'](_0x168bd6[_0xd64c('0x55')][_0xd64c('0x55')])||_0x168bd6['body'][_0xd64c('0x55')]===''){throw new db[(_0xd64c('0x85'))][(_0xd64c('0x86'))](_0xd64c('0x8e'));}if(_[_0xd64c('0x75')](_0x168bd6['body'][_0xd64c('0x8f')])){throw new db[(_0xd64c('0x85'))]['ValidationError'](_0xd64c('0x90')+_0x3dd435);}if(!_['includes'](_0x3dd435,_0x168bd6[_0xd64c('0x55')][_0xd64c('0x8f')])){throw new db[(_0xd64c('0x85'))][(_0xd64c('0x86'))](_0xd64c('0x91')+_0x3dd435);}_0x4a2102[_0x168bd6[_0xd64c('0x55')][_0xd64c('0x8f')]]=_0x168bd6[_0xd64c('0x55')][_0xd64c('0x8d')];})[_0xd64c('0x2e')](function(){return db[_0xd64c('0x3a')]['find']({'where':{'id':_0x168bd6[_0xd64c('0x51')]['id']},'include':[{'model':db[_0xd64c('0x92')],'as':_0xd64c('0x93'),'include':[{'model':db[_0xd64c('0x84')],'as':_0xd64c('0x94'),'where':_0x4a2102,'limit':0x1,'order':[[_0xd64c('0x8a'),_0xd64c('0x95')]]}]},{'model':db[_0xd64c('0x96')],'as':_0xd64c('0x97')}]});})[_0xd64c('0x2e')](handleEntityNotFound(_0x5e6b44,null))[_0xd64c('0x2e')](function(_0x1db47e){if(_0x1db47e&&_0x1db47e[_0xd64c('0x93')]){_0x2fd0f7[_0xd64c('0x98')]=_0x1db47e;_0x2fd0f7[_0xd64c('0x99')]=_0x1db47e['Applications'];_0x2fd0f7[_0xd64c('0x9a')]=_0x1db47e['List'];_0x2fd0f7['applications']=_[_0xd64c('0x9b')](_0x2fd0f7[_0xd64c('0x99')],[_0xd64c('0x9c')],[_0xd64c('0x9d')]);if(_0x2fd0f7['account'][_0xd64c('0x97')]){delete _0x2fd0f7[_0xd64c('0x98')][_0xd64c('0x97')];}if(_0x2fd0f7[_0xd64c('0x98')][_0xd64c('0x93')]&&_0x2fd0f7[_0xd64c('0x98')]['List']['Contacts'][_0xd64c('0x45')]){return _0x2fd0f7['account'][_0xd64c('0x93')]['Contacts'][0x0];}var _0x5e3002=_[_0xd64c('0x16')](_0x168bd6[_0xd64c('0x55')],{'firstName':_0x168bd6[_0xd64c('0x55')][_0xd64c('0x8d')],'ListId':_0x1db47e['ListId']});_0x5e3002[_0x168bd6['body'][_0xd64c('0x8f')]]=_0x168bd6[_0xd64c('0x55')][_0xd64c('0x8d')];return db['CmContact']['create'](_0x5e3002,{'fields':_0x114913,'raw':!![]});}})[_0xd64c('0x2e')](handleEntityNotFound(_0x5e6b44,null))['then'](function(_0x3ba1a6){_0x2fd0f7['contact']=_0x3ba1a6;var _0x15a973=_0x168bd6['body'][_0xd64c('0x9e')];if(_0x168bd6['headers'][_0xd64c('0x9f')]){_0x15a973=_0x168bd6[_0xd64c('0xa0')][_0xd64c('0x9f')];}else if(_0x168bd6['headers'][_0xd64c('0xa1')]){_0x15a973=_[_0xd64c('0xa2')](_0x168bd6[_0xd64c('0xa0')]['x-forwarded-for']['split'](','));}if(_0x3ba1a6){var _0x1e420c={'ContactId':_0x3ba1a6['id'],'ChatWebsiteId':_0x168bd6[_0xd64c('0x51')]['id'],'from':(_0x3ba1a6[_0xd64c('0xa3')]||'')+'\x20'+(_0x3ba1a6[_0xd64c('0xa4')]||''),'customerIp':_0x15a973,'customerPort':_0x168bd6[_0xd64c('0xa0')]['x-real-port']?_0x168bd6['headers'][_0xd64c('0xa5')]:null,'referer':_0x168bd6[_0xd64c('0x55')][_0xd64c('0xa6')],'browserName':_0x1b0f15['browser'][_0xd64c('0x34')]&&_0x1b0f15['browser'][_0xd64c('0xa7')]?util[_0xd64c('0xa8')](_0xd64c('0xa9'),_0x1b0f15[_0xd64c('0xaa')]['name'],_0x1b0f15[_0xd64c('0xaa')][_0xd64c('0xa7')]):_0xd64c('0xab'),'browserVersion':_0x1b0f15['browser']['version']||_0xd64c('0xab'),'osName':util['format'](_0xd64c('0xa9'),_0x1b0f15['os'][_0xd64c('0x34')],_0x1b0f15['os'][_0xd64c('0xa7')]),'osVersion':_0x1b0f15['os'][_0xd64c('0xa7')],'deviceModel':_0x1b0f15[_0xd64c('0xac')][_0xd64c('0x3e')]&&_0x1b0f15[_0xd64c('0xac')]['vendor']?util[_0xd64c('0xa8')](_0xd64c('0xad'),_0x1b0f15[_0xd64c('0xac')][_0xd64c('0x3e')],_0x1b0f15[_0xd64c('0xac')]['vendor'],_0x1b0f15[_0xd64c('0xac')][_0xd64c('0xae')]):null,'deviceVendor':_0x1b0f15[_0xd64c('0xac')][_0xd64c('0xaf')],'deviceType':_0x1b0f15[_0xd64c('0xac')][_0xd64c('0xae')],'formData':JSON[_0xd64c('0x1f')](_0x168bd6['body'])};var _0x2c8326={'ChatWebsiteId':_0x168bd6[_0xd64c('0x51')]['id'],'closed':![]};if(_0x168bd6['body'][_0xd64c('0xb0')]){_0x2c8326['threadId']=_0x168bd6[_0xd64c('0x55')][_0xd64c('0xb0')];return db['ChatInteraction'][_0xd64c('0x53')]({'where':_0x2c8326})[_0xd64c('0x2e')](function(_0x162f2c){if(_0x162f2c){return[_0x162f2c,![]];}_0x1e420c['threadId']=_0x168bd6[_0xd64c('0x55')][_0xd64c('0xb0')];_0x1e420c['externalUrl']=_0x168bd6[_0xd64c('0x55')][_0xd64c('0xb1')];return db[_0xd64c('0xb2')][_0xd64c('0x54')](_0x1e420c)[_0xd64c('0x2e')](function(_0x50f922){return[_0x50f922,!![]];});});}_0x2c8326[_0xd64c('0xb3')]=_0x3ba1a6['id'];if(_0x168bd6['body'][_0xd64c('0xb4')]&&_0x168bd6[_0xd64c('0x55')]['interaction']['id']){_0x2c8326['id']=_0x168bd6['body'][_0xd64c('0xb4')]['id'];return db[_0xd64c('0xb2')][_0xd64c('0x53')]({'where':_0x2c8326})[_0xd64c('0x2e')](function(_0x158ddc){if(_0x158ddc){return[_0x158ddc,![]];}return db[_0xd64c('0xb2')][_0xd64c('0x54')](_0x1e420c)[_0xd64c('0x2e')](function(_0x2d24a7){return[_0x2d24a7,!![]];});});}return db[_0xd64c('0xb2')][_0xd64c('0x54')](_0x1e420c)[_0xd64c('0x2e')](function(_0x2fb8bc){return[_0x2fb8bc,!![]];});}})[_0xd64c('0xb5')](function(_0x500d1e,_0x2ecf74){if(_0x500d1e){_0x53085c=_0x2ecf74;if(!_0x2ecf74){var _0x306a65={'from':(_0x2fd0f7['contact'][_0xd64c('0xa3')]||'')+'\x20'+(_0x2fd0f7['contact'][_0xd64c('0xa4')]||'')};if(_0x168bd6[_0xd64c('0x55')][_0xd64c('0xb0')]&&_0x168bd6[_0xd64c('0x55')][_0xd64c('0xb6')]&&_0x168bd6[_0xd64c('0x55')][_0xd64c('0xb0')]!=_0x168bd6[_0xd64c('0x55')][_0xd64c('0xb6')]){_0x306a65['threadId']=_0x168bd6[_0xd64c('0x55')][_0xd64c('0xb6')];}return _0x500d1e[_0xd64c('0xb7')](_0x306a65);}else{return _0x500d1e;}}})[_0xd64c('0x2e')](function(_0x23ebaa){_0x2fd0f7[_0xd64c('0xb4')]=_0x23ebaa['get']({'plain':!![]});_0x2fd0f7[_0xd64c('0xb4')]['created']=_0x53085c;if(_0x2fd0f7[_0xd64c('0xb4')][_0xd64c('0xb8')]){if(_0x2fd0f7[_0xd64c('0x98')][_0xd64c('0xb9')]){_0x2fd0f7['applications'][_0xd64c('0xba')]({'id':0x0,'priority':_0x2fd0f7[_0xd64c('0x99')][_0xd64c('0x45')]+0x1,'app':_0xd64c('0xbb'),'appdata':_0xd64c('0xbc'),'interval':_0xd64c('0xbd')});}}return db[_0xd64c('0xbe')][_0xd64c('0x54')]({'body':_0x168bd6[_0xd64c('0x55')][_0xd64c('0x55')],'ChatWebsiteId':_0x168bd6[_0xd64c('0x51')]['id'],'ChatInteractionId':_0x23ebaa['id'],'direction':'in','ContactId':_0x2fd0f7[_0xd64c('0xbf')]['id'],'AttachmentId':_0x168bd6[_0xd64c('0x55')][_0xd64c('0xc0')]});})['then'](function(_0x500105){_0x2fd0f7[_0xd64c('0x23')]=_0x500105;if(_0x2fd0f7['interaction'][_0xd64c('0xc1')]){return db['User'][_0xd64c('0x53')]({'attributes':['id',_0xd64c('0x34')],'where':{'id':_0x2fd0f7['interaction'][_0xd64c('0xc1')]}})[_0xd64c('0x2e')](function(_0x3007d0){if(_0x3007d0){_0x2fd0f7[_0xd64c('0x99')][_0xd64c('0xc2')]({'id':0x0,'priority':0x0,'app':_0xd64c('0xc3'),'appdata':_0x3007d0[_0xd64c('0x34')]+','+(_0x2fd0f7[_0xd64c('0x98')]['waitForTheAssignedAgent']||0xa),'interval':_0xd64c('0xbd')});_0x2fd0f7[_0xd64c('0xc4')]=!![];}return respondWithRpcPromise('Start','startRouting',_0x2fd0f7);});}return respondWithRpcPromise(_0xd64c('0xc5'),'startRouting',_0x2fd0f7);})[_0xd64c('0x2e')](function(_0x5c9aeb){respondWithRpcPromise(_0xd64c('0xc6'),_0xd64c('0xc6'),{'event':_0xd64c('0xc7'),'message':_0x5c9aeb},client9002);return _0x5c9aeb;})[_0xd64c('0x2e')](respondWithResult(_0x5e6b44,null))[_0xd64c('0x25')](handleError(_0x5e6b44,null));};exports[_0xd64c('0xc8')]=function(_0x4d55d6,_0x1fc382,_0x2c42eb){var _0x2caf0c,_0x2c3cb3,_0x1171bc;var _0x326e8f=[];var _0x11be0d=[];var _0x162870={};var _0x465035=_0x4d55d6[_0xd64c('0xc9')]||[];var _0x59e80f=[];var _0x32a600;return db[_0xd64c('0x84')]['describe']()[_0xd64c('0x2e')](function(_0x1c3d0f){if(!_0x1c3d0f){throw new db[(_0xd64c('0x85'))][(_0xd64c('0x86'))](_0xd64c('0x87'));}_0x11be0d=_[_0xd64c('0x88')](_[_0xd64c('0x40')](_0x1c3d0f),[_0xd64c('0x89'),_0xd64c('0x8a')]);_0x326e8f=_[_0xd64c('0x88')](_['keys'](_0x1c3d0f),[_0xd64c('0x89'),_0xd64c('0x8a'),_0xd64c('0x8b'),'ListId']);if(_0x4d55d6[_0xd64c('0x55')]['id']){delete _0x4d55d6[_0xd64c('0x55')]['id'];}if(_['isNil'](_0x4d55d6[_0xd64c('0x55')]['from'])){throw _0x1fc382['status'](0x1f4)[_0xd64c('0x35')](new db['Sequelize'][(_0xd64c('0x86'))](_0xd64c('0xca')));}if(_[_0xd64c('0x75')](_0x4d55d6[_0xd64c('0x55')][_0xd64c('0x55')])||_0x4d55d6[_0xd64c('0x55')][_0xd64c('0x55')]===''){throw _0x1fc382[_0xd64c('0x27')](0x1f4)[_0xd64c('0x35')](new db[(_0xd64c('0x85'))][(_0xd64c('0x86'))](_0xd64c('0x8e')));}if(_['isNil'](_0x4d55d6[_0xd64c('0x55')][_0xd64c('0xcb')])){throw _0x1fc382[_0xd64c('0x27')](0x1f4)[_0xd64c('0x35')](new db[(_0xd64c('0x85'))]['ValidationError'](_0xd64c('0xcc')+_0x326e8f));}if(!_[_0xd64c('0xcd')](_0x326e8f,_0x4d55d6['body'][_0xd64c('0xcb')])){throw _0x1fc382[_0xd64c('0x27')](0x1f4)[_0xd64c('0x35')](new db[(_0xd64c('0x85'))][(_0xd64c('0x86'))](_0xd64c('0xce')+_0x326e8f));}_0x162870[_0x4d55d6[_0xd64c('0x55')][_0xd64c('0xcb')]]=_0x4d55d6[_0xd64c('0x55')][_0xd64c('0x8d')];})['then'](function(){return db[_0xd64c('0x3a')][_0xd64c('0x53')]({'where':{'id':_0x4d55d6[_0xd64c('0x51')]['id']},'include':[{'model':db[_0xd64c('0x92')],'as':_0xd64c('0x93')},{'model':db[_0xd64c('0xcf')],'as':_0xd64c('0xcf')}]});})['then'](handleEntityNotFound(_0x1fc382,null))[_0xd64c('0x2e')](function(_0x39c317){if(_0x39c317&&_0x39c317[_0xd64c('0x93')]){_0x2c3cb3=_0x39c317;var _0x35183e=_[_0xd64c('0x16')](_0x4d55d6['body'],{'firstName':_0x4d55d6[_0xd64c('0x55')][_0xd64c('0x8d')],'phone':_0x4d55d6[_0xd64c('0x55')][_0xd64c('0x8d')],'ListId':_0x39c317['ListId']});_0x35183e[_0x4d55d6[_0xd64c('0x55')][_0xd64c('0xcb')]]=_0x4d55d6[_0xd64c('0x55')][_0xd64c('0x8d')];return db[_0xd64c('0x84')]['findOrCreate']({'where':_0x162870,'defaults':_0x35183e});}})[_0xd64c('0xb5')](function(_0xf9cf37){if(_0xf9cf37){_0x1171bc=_0xf9cf37;var _0x516556=fs[_0xd64c('0xd0')](path['join'](config[_0xd64c('0x73')],_0xd64c('0xd1')),_0xd64c('0xd2'));var _0x29bd2b=ejs[_0xd64c('0xd3')](_0x516556,{'body':_[_0xd64c('0xd4')](_0x4d55d6[_0xd64c('0x55')][_0xd64c('0x55')]),'bodyTitle':_0x2c3cb3['offlineMessageBody']});return db[_0xd64c('0xd5')][_0xd64c('0x54')]({'body':_0x29bd2b,'ContactId':_0xf9cf37['id'],'ChatWebsiteId':_0x2c3cb3['id']});}})[_0xd64c('0x2e')](function(_0x26b169){_0x32a600=_0x26b169;if(_0x465035[_0xd64c('0x45')]){var _0xe9a295=_0x465035[_0xd64c('0x39')](function(_0x409f6b){return{'name':_0x409f6b[_0xd64c('0xd6')],'basename':_0x409f6b['filename'],'type':_0x409f6b[_0xd64c('0xd7')],'ChatOfflineMessageId':_0x26b169['id']};});_0x59e80f=_0xe9a295[_0xd64c('0x39')](_0x48e5d6=>{var _0x340a03={'filename':_0x48e5d6[_0xd64c('0x34')],'path':path['join'](config[_0xd64c('0x73')],_0xd64c('0xd8'),_0xd64c('0xc9'),_0xd64c('0xd9'),'offline-chat',_0x48e5d6[_0xd64c('0xda')])};return _0x340a03;});if(!_0x2c3cb3['openNewInteraction']){return db[_0xd64c('0xdb')]['transaction'](function(_0x23b42c){return db[_0xd64c('0xdc')][_0xd64c('0xdd')](_0xe9a295,{'transaction':_0x23b42c});});}}})[_0xd64c('0x2e')](function(){if(_0x32a600){_0x2caf0c=_0x32a600;return db[_0xd64c('0xcf')][_0xd64c('0x61')]({'where':{'active':!![]},'include':[{'model':db[_0xd64c('0xde')],'as':_0xd64c('0xdf'),'raw':!![]}]});}})[_0xd64c('0x2e')](function(_0x698179){if(_0x698179&&_0x698179[_0xd64c('0xdf')]&&_0x2c3cb3[_0xd64c('0xe0')]&&_0x2c3cb3[_0xd64c('0xe1')]){var _0x2e6dd3={'tls':{'rejectUnauthorized':![]}};if(_0x698179['Smtp']['service']){_0x2e6dd3[_0xd64c('0xe2')]=_0x698179[_0xd64c('0xdf')]['service'];}else{_0x2e6dd3[_0xd64c('0xe3')]=_0x698179['Smtp'][_0xd64c('0xe3')];_0x2e6dd3[_0xd64c('0xe4')]=_0x698179[_0xd64c('0xdf')][_0xd64c('0xe4')];_0x2e6dd3[_0xd64c('0xe5')]=_0x698179[_0xd64c('0xdf')]['secure'];}if(_0x698179[_0xd64c('0xdf')][_0xd64c('0xe6')]){_0x2e6dd3[_0xd64c('0xe7')]={'user':_0x698179[_0xd64c('0xdf')][_0xd64c('0x56')],'pass':_0x698179[_0xd64c('0xdf')][_0xd64c('0xe8')]};}return respondWithRpcPromise(_0xd64c('0xe9'),_0xd64c('0xea'),{'account':_0x2e6dd3,'message':{'from':util[_0xd64c('0xa8')]('\x22%s\x22\x20<%s>',_0x698179[_0xd64c('0x34')],_0x698179[_0xd64c('0xeb')]||_0x698179[_0xd64c('0xdf')][_0xd64c('0x56')]),'to':_0x2c3cb3[_0xd64c('0xe1')],'subject':_0x2c3cb3[_0xd64c('0xec')],'html':_0x2caf0c[_0xd64c('0x55')],'attachments':_0x59e80f}},client9003)['then'](function(){return _0x2caf0c;})[_0xd64c('0x25')](function(_0xc3124a){console[_0xd64c('0x20')](_0xc3124a);});}})[_0xd64c('0x2e')](function(){if(_0x2c3cb3&&_0x2c3cb3[_0xd64c('0xed')]&&_0x2c3cb3[_0xd64c('0xee')]){var _0x49ec6b=[];if(_0x465035[_0xd64c('0x45')]){_0x49ec6b=_0x465035['map'](function(_0x12aa65){return{'name':_0x12aa65[_0xd64c('0xd6')],'basename':_0x12aa65[_0xd64c('0x6b')],'type':_0x12aa65[_0xd64c('0xd7')],'ChatOfflineMessageId':_0x32a600['id']};});}var _0xab5dfb;if(!_[_0xd64c('0x75')](_0x2c3cb3['subjectOffline'])){var _0x497631=_['map'](_0x4d55d6[_0xd64c('0x55')],function(_0x3d8e3a){return _0x3d8e3a;});var _0x2a74cd=_[_0xd64c('0xef')](_0x497631)[0x0];var _0x1a8096=_['mapValues'](_0x2a74cd,function(_0x344504){return _0x344504;});_0xab5dfb=_0x1a8096[0x1][_0x2c3cb3[_0xd64c('0xf0')]];}var _0x928eea={'from':_0x1171bc[_0xd64c('0xeb')],'firstName':_0x1171bc[_0xd64c('0xa3')],'lastName':_0x1171bc[_0xd64c('0xa4')],'mapKey':'email','message':{'from':_0x1171bc[_0xd64c('0xeb')],'to':_0x2c3cb3[_0xd64c('0xcf')][_0xd64c('0xeb')],'cc':'','subject':_[_0xd64c('0x75')](_0xab5dfb)?_0x2c3cb3['offlineMessageSubject']:_0xab5dfb,'messageId':'','sentAt':new Date(),'attach':_0x49ec6b[_0xd64c('0x45')],'attachments':_0x49ec6b,'originChannel':'Chat','ChatWebsiteId':_0x2c3cb3['id'],'ChatOfflineMessageId':_0x2caf0c['id'],'originTo':_0x2c3cb3['MailAccount']['email']},'body':_0x2caf0c[_0xd64c('0x55')]};var _0x4f2f66={'account':{'id':_0x2c3cb3[_0xd64c('0xee')]},'body':_0x928eea,'log':_0xd64c('0xf1')};return respondWithRpcPromise(_0xd64c('0xf1'),_0xd64c('0xf2'),_0x4f2f66,client9001)[_0xd64c('0x2e')](function(){return _0x2caf0c;})[_0xd64c('0x25')](function(_0x2b71f6){console[_0xd64c('0x20')](_0x2b71f6);});}return;})[_0xd64c('0x2e')](function(){if(_0x2caf0c){return _0x2caf0c;}})[_0xd64c('0x2e')](respondWithResult(_0x1fc382,null))[_0xd64c('0x25')](function(_0x5750fd){console['error'](_0xd64c('0x25'),_0x5750fd);for(var _0x2031d6 of _0x465035){var _0x17a462=path[_0xd64c('0x72')](config['root'],'server',_0xd64c('0xc9'),_0xd64c('0xd9'),'offline-chat',_0x2031d6[_0xd64c('0x6b')]);fs_extra[_0xd64c('0xf3')](_0x17a462)[_0xd64c('0x25')](function(_0x1eb49f){console[_0xd64c('0x20')](_0xd64c('0xf4'),_0x17a462,_0x1eb49f);});}});};exports[_0xd64c('0xf5')]=function(_0x41b2c7,_0x3b6758,_0x30540c){return db[_0xd64c('0xb2')][_0xd64c('0x53')]({'where':{'id':_0x41b2c7[_0xd64c('0x51')]['id']}})[_0xd64c('0x2e')](handleEntityNotFound(_0x3b6758,null))[_0xd64c('0x2e')](function(_0x302b92){if(_0x302b92){return _0x302b92[_0xd64c('0xf5')](_0x41b2c7[_0xd64c('0x55')][_0xd64c('0x65')],_[_0xd64c('0xf6')](_0x41b2c7['body'],[_0xd64c('0x65'),'id'])||{});}})[_0xd64c('0x2e')](respondWithResult(_0x3b6758,null))[_0xd64c('0x25')](handleError(_0x3b6758,null));};exports[_0xd64c('0xf7')]=function(_0x47ed30,_0x3cac25,_0x2173ee){var _0x4df8a6={'raw':![],'where':{}};var _0x46f897={};var _0x517080={'count':0x0,'rows':[]};return db[_0xd64c('0x3a')][_0xd64c('0x61')]({'where':{'id':_0x47ed30['params']['id']}})[_0xd64c('0x2e')](handleEntityNotFound(_0x3cac25,null))['then'](function(_0x9a9dd1){if(_0x9a9dd1){_0x46f897['model']=_['keys'](db[_0xd64c('0xb2')][_0xd64c('0x3b')]);_0x46f897[_0xd64c('0x3f')]=_[_0xd64c('0x40')](_0x47ed30[_0xd64c('0x3f')]);_0x46f897['filters']=_['intersection'](_0x46f897['model'],_0x46f897[_0xd64c('0x3f')]);_0x4df8a6[_0xd64c('0x43')]=_[_0xd64c('0x42')](_0x46f897[_0xd64c('0x3e')],qs[_0xd64c('0x44')](_0x47ed30[_0xd64c('0x3f')]['fields']));_0x4df8a6[_0xd64c('0x43')]=_0x4df8a6[_0xd64c('0x43')]['length']?_0x4df8a6[_0xd64c('0x43')]:_0x46f897['model'];if(!_0x47ed30['query']['hasOwnProperty'](_0xd64c('0x47'))){_0x4df8a6['limit']=qs[_0xd64c('0x2b')](_0x47ed30['query']['limit']);_0x4df8a6[_0xd64c('0x29')]=qs[_0xd64c('0x29')](_0x47ed30[_0xd64c('0x3f')]['offset']);}_0x4df8a6['order']=qs[_0xd64c('0x48')](_0x47ed30[_0xd64c('0x3f')][_0xd64c('0x48')]);_0x4df8a6[_0xd64c('0x49')]=qs[_0xd64c('0x41')](_[_0xd64c('0x4a')](_0x47ed30['query'],_0x46f897[_0xd64c('0x41')]));_0x4df8a6['where'][_0xd64c('0x5e')]=_0x9a9dd1['id'];if(_0x47ed30[_0xd64c('0x3f')][_0xd64c('0x4b')]){_0x4df8a6[_0xd64c('0x49')]=_['merge'](_0x4df8a6[_0xd64c('0x49')],{'$or':_[_0xd64c('0x39')](_0x4df8a6[_0xd64c('0x43')],function(_0x4d9e1a){var _0x2c6a9e={};_0x2c6a9e[_0x4d9e1a]={'$like':'%'+_0x47ed30[_0xd64c('0x3f')][_0xd64c('0x4b')]+'%'};return _0x2c6a9e;})});}_0x4df8a6=_['merge']({},_0x4df8a6,_0x47ed30[_0xd64c('0x4d')]);return db[_0xd64c('0xb2')][_0xd64c('0x2c')]({'where':_0x4df8a6['where']})[_0xd64c('0x2e')](function(_0x1783cc){_0x517080['count']=_0x1783cc;if(_0x47ed30['query'][_0xd64c('0x4e')]){_0x4df8a6[_0xd64c('0x4f')]=[{'model':db[_0xd64c('0x84')],'as':_0xd64c('0xf8'),'required':![]},{'model':db['User'],'as':_0xd64c('0xf9'),'attributes':['name',_0xd64c('0xfa'),_0xd64c('0xfb')],'required':![]},{'model':db[_0xd64c('0xfc')],'as':_0xd64c('0xfd'),'attributes':['id',_0xd64c('0x34'),_0xd64c('0xfe')],'where':_0x47ed30[_0xd64c('0x3f')]['tag']?{'id':_0x47ed30[_0xd64c('0x3f')]['tag']}:undefined,'required':_0x47ed30[_0xd64c('0x3f')]['tag']?!![]:![]}];}return db[_0xd64c('0xb2')][_0xd64c('0x63')](_0x4df8a6);})[_0xd64c('0x2e')](function(_0x12697a){_0x517080[_0xd64c('0x50')]=_0x12697a;return _0x517080;});}})[_0xd64c('0x2e')](respondWithFilteredResult(_0x3cac25,_0x4df8a6))[_0xd64c('0x25')](handleError(_0x3cac25,null));};function iftimePromise(_0x425c5b,_0x14c93e){return respondWithRpcPromise(_0xd64c('0xff'),_0xd64c('0x100'),{'command':_0x14c93e[_0xd64c('0x101')]?util[_0xd64c('0xa8')](_0xd64c('0x102'),_0x425c5b[_0xd64c('0x103')],_0x14c93e[_0xd64c('0x101')]):util['format'](_0xd64c('0x104'),_0x425c5b['interval'])},client9002)['then'](function(_0x5dc790){var _0x1432bf=_0x5dc790&&_0x5dc790['indexOf']('true')>=0x0?!![]:![];logger[_0xd64c('0x1c')]('[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)',_0x14c93e['id'],_0x425c5b['id'],_0x425c5b[_0xd64c('0x103')],_0x1432bf?'ONLINE':_0xd64c('0x105'),_0x14c93e[_0xd64c('0x101')]?_0x14c93e[_0xd64c('0x101')]:_0xd64c('0x106'));return _0x1432bf;})[_0xd64c('0x25')](function(_0x358a1b){logger[_0xd64c('0x20')]('[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)',_0x14c93e['id'],_0x425c5b['id'],_0x425c5b[_0xd64c('0x103')],util['inspect'](_0x358a1b,{'showHidden':![],'depth':null}),_0x14c93e[_0xd64c('0x101')]?_0x14c93e[_0xd64c('0x101')]:_0xd64c('0x106'));return![];});}exports[_0xd64c('0x100')]=function(_0x19b8ff,_0x5e6255,_0x559b7d){var _0x3e5b6c=0x0;var _0x21fddc=0x0;var _0xd33e07=![];var _0x66e23;var _0x524d23;return db[_0xd64c('0x3a')][_0xd64c('0x53')]({'where':{'id':_0x19b8ff['params']['id']},'include':[{'model':db[_0xd64c('0x107')],'as':_0xd64c('0x107'),'include':[{'model':db['Interval'],'as':'Intervals','attributes':['id','interval'],'raw':!![]}]}]})[_0xd64c('0x2e')](handleEntityNotFound(_0x5e6255,null))[_0xd64c('0x2e')](function(_0x165059){if(_0x165059){_0x66e23=_0x165059;return _0x165059[_0xd64c('0x108')]({'raw':!![]});}})[_0xd64c('0x2e')](function(_0x51e3e9){if(_0x66e23){if(_0x51e3e9){_0x524d23=_0x51e3e9;}}return require(_0xd64c('0x13'))[_0xd64c('0x109')]();})[_0xd64c('0x2e')](function(_0x5f31df){if(_0x5f31df){_0x21fddc=_0x5f31df[_0xd64c('0x10a')];_0xd33e07=_0x5f31df[_0xd64c('0x10b')];}})[_0xd64c('0x2e')](function(){return db[_0xd64c('0xb2')][_0xd64c('0x2c')]({'where':{'closed':![]}});})[_0xd64c('0x2e')](function(_0x610d2d){_0x3e5b6c=_0x610d2d;if(_0x21fddc&&_0x610d2d>_0x21fddc){return db[_0xd64c('0x10c')][_0xd64c('0x61')]({'where':{'id':0x1}})[_0xd64c('0x2e')](function(_0x57e7b8){if(_0x57e7b8){_0x57e7b8[_0xd64c('0x10d')](_0xd64c('0x10e'));}});}})[_0xd64c('0x2e')](function(){if(_0x66e23[_0xd64c('0x107')]&&_0x66e23[_0xd64c('0x107')]['Intervals']){var _0x2402b3=[];for(var _0x17407c=0x0;_0x17407c<_0x66e23[_0xd64c('0x107')][_0xd64c('0x10f')][_0xd64c('0x45')];_0x17407c++){var _0x532bb4=_0x66e23[_0xd64c('0x107')][_0xd64c('0x10f')][_0x17407c][_0xd64c('0x2f')]({'plain':!![]});_0x2402b3['push'](iftimePromise(_0x532bb4,_0x66e23));}return BPromise[_0xd64c('0x110')](_0x2402b3)[_0xd64c('0x2e')](function(_0x134492){return _[_0xd64c('0x111')](_0x134492);});}else{return!![];}})[_0xd64c('0x2e')](function(_0x4f1f13){var _0x47c0a7=fs[_0xd64c('0xd0')](path['join'](config[_0xd64c('0x73')],_0xd64c('0x112')),_0xd64c('0xd2'));var _0x2900c1={'remote':_0x66e23['remote'],'query':querystring[_0xd64c('0x1f')](_[_0xd64c('0x52')](_0x66e23['get']({'plain':!![]}),{'customerIp':_0x19b8ff[_0xd64c('0xa0')][_0xd64c('0xa1')]||_0x19b8ff[_0xd64c('0xa0')]['x-real-ip']||_0x19b8ff['connection'][_0xd64c('0x113')]||_0x19b8ff['ip'],'referer':_0x19b8ff[_0xd64c('0xa0')][_0xd64c('0xa6')],'openedInteractions':_0x3e5b6c,'maxInteractions':_0x21fddc,'virtual':_0xd33e07[_0xd64c('0x10a')],'online':_0x4f1f13,'custom':_0xd33e07}))['replace'](/'/g,'\x5c\x27')};_0x5e6255[_0xd64c('0x35')](ejs[_0xd64c('0xd3')](Mustache[_0xd64c('0xd3')](_0x47c0a7,_0x2900c1),{'proactiveActions':_0x524d23,'alignment':_0x66e23[_0xd64c('0x114')],'verticalAlignment':_0x66e23[_0xd64c('0x115')],'div_color':_0x66e23[_0xd64c('0xfe')],'text_color':_0x66e23['textColor'],'button_color':_0x66e23['color_button'],'background_color':_0x66e23[_0xd64c('0x116')]}));})[_0xd64c('0x25')](handleError(_0x5e6255,null));};exports[_0xd64c('0x117')]=function(_0x1c496f,_0x293306,_0x530932){return db[_0xd64c('0x3a')][_0xd64c('0x61')]({'where':{'id':_0x1c496f[_0xd64c('0x51')]['id']}})[_0xd64c('0x2e')](handleEntityNotFound(_0x293306,null))[_0xd64c('0x2e')](function(_0x6293e0){if(_0x6293e0){return db[_0xd64c('0xdb')][_0xd64c('0x118')](function(_0x4e11aa){return db[_0xd64c('0x96')][_0xd64c('0x32')]({'where':{'ChatWebsiteId':_0x1c496f['params']['id']},'transaction':_0x4e11aa})[_0xd64c('0x2e')](function(_0x3d4547){var _0x56327e=_[_0xd64c('0x39')](_0x1c496f[_0xd64c('0x55')],function(_0xa5d4e1){_0xa5d4e1[_0xd64c('0x5e')]=_0x1c496f[_0xd64c('0x51')]['id'];return _0xa5d4e1;});return db['ChatApplication']['bulkCreate'](_0x56327e,{'transaction':_0x4e11aa});});})[_0xd64c('0x2e')](function(){return db['ChatApplication'][_0xd64c('0x119')]({'where':{'ChatWebsiteId':_0x1c496f['params']['id']},'order':_0xd64c('0x9c')});});}})[_0xd64c('0x2e')](respondWithResult(_0x293306,null))[_0xd64c('0x25')](handleError(_0x293306,null));};exports[_0xd64c('0x11a')]=function(_0x48d285,_0x413314,_0x5f20fc){var _0x2d87da={};var _0x3c65a7={};var _0x31dbd3;var _0x4192cc;return db['ChatWebsite']['findOne']({'where':{'id':_0x48d285['params']['id']}})[_0xd64c('0x2e')](handleEntityNotFound(_0x413314,null))[_0xd64c('0x2e')](function(_0x228ba1){if(_0x228ba1){_0x31dbd3=_0x228ba1;_0x3c65a7['model']=_[_0xd64c('0x40')](db['ChatApplication'][_0xd64c('0x3b')]);_0x3c65a7[_0xd64c('0x3f')]=_[_0xd64c('0x40')](_0x48d285[_0xd64c('0x3f')]);_0x3c65a7['filters']=_['intersection'](_0x3c65a7[_0xd64c('0x3e')],_0x3c65a7['query']);_0x2d87da['attributes']=_[_0xd64c('0x42')](_0x3c65a7[_0xd64c('0x3e')],qs[_0xd64c('0x44')](_0x48d285[_0xd64c('0x3f')][_0xd64c('0x44')]));_0x2d87da[_0xd64c('0x43')]=_0x2d87da[_0xd64c('0x43')][_0xd64c('0x45')]?_0x2d87da[_0xd64c('0x43')]:_0x3c65a7[_0xd64c('0x3e')];_0x2d87da[_0xd64c('0x62')]=qs[_0xd64c('0x48')](_0x48d285[_0xd64c('0x3f')][_0xd64c('0x48')]);_0x2d87da[_0xd64c('0x49')]=qs['filters'](_['pick'](_0x48d285['query'],_0x3c65a7['filters']));if(_0x48d285['query']['filter']){_0x2d87da[_0xd64c('0x49')]=_[_0xd64c('0x52')](_0x2d87da[_0xd64c('0x49')],{'$or':_[_0xd64c('0x39')](_0x2d87da[_0xd64c('0x43')],function(_0x14437b){var _0x50b8fd={};_0x50b8fd[_0x14437b]={'$like':'%'+_0x48d285['query'][_0xd64c('0x4b')]+'%'};return _0x50b8fd;})});}_0x2d87da=_['merge']({},_0x2d87da,_0x48d285[_0xd64c('0x4d')]);return _0x31dbd3[_0xd64c('0x11a')](_0x2d87da);}})[_0xd64c('0x2e')](function(_0x573494){if(_0x573494){_0x4192cc=_0x573494[_0xd64c('0x45')];if(!_0x48d285['query'][_0xd64c('0x46')](_0xd64c('0x47'))){_0x2d87da[_0xd64c('0x2b')]=qs[_0xd64c('0x2b')](_0x48d285[_0xd64c('0x3f')][_0xd64c('0x2b')]);_0x2d87da[_0xd64c('0x29')]=qs[_0xd64c('0x29')](_0x48d285[_0xd64c('0x3f')]['offset']);}return _0x31dbd3['getApplications'](_0x2d87da);}})[_0xd64c('0x2e')](function(_0x4dcc6e){if(_0x4dcc6e){return _0x4dcc6e?{'count':_0x4192cc,'rows':_0x4dcc6e}:null;}})['then'](respondWithResult(_0x413314,null))['catch'](handleError(_0x413314,null));};exports[_0xd64c('0x11b')]=function(_0x3389f6,_0x21b7c,_0x4236e8){return db['chatProactiveAction'][_0xd64c('0x53')]({'where':{'id':_0x3389f6[_0xd64c('0x51')]['id']}})[_0xd64c('0x2e')](handleEntityNotFound(_0x21b7c,null))['then'](function(_0xc351a8){if(_0xc351a8){return _0xc351a8[_0xd64c('0x11b')](_0x3389f6['body'][_0xd64c('0x65')],_[_0xd64c('0xf6')](_0x3389f6[_0xd64c('0x55')],[_0xd64c('0x65'),'id'])||{});}})[_0xd64c('0x2e')](respondWithResult(_0x21b7c,null))[_0xd64c('0x25')](handleError(_0x21b7c,null));};exports[_0xd64c('0x108')]=function(_0x4bf270,_0x2bef91,_0x678774){var _0x5e00d9={};var _0x34875a={};var _0x4ce6e2;var _0x2a2020;return db[_0xd64c('0x3a')][_0xd64c('0x61')]({'where':{'id':_0x4bf270[_0xd64c('0x51')]['id']}})[_0xd64c('0x2e')](handleEntityNotFound(_0x2bef91,null))[_0xd64c('0x2e')](function(_0x41e2fd){if(_0x41e2fd){_0x4ce6e2=_0x41e2fd;_0x34875a[_0xd64c('0x3e')]=_[_0xd64c('0x40')](db[_0xd64c('0x11c')][_0xd64c('0x3b')]);_0x34875a[_0xd64c('0x3f')]=_['keys'](_0x4bf270[_0xd64c('0x3f')]);_0x34875a[_0xd64c('0x41')]=_[_0xd64c('0x42')](_0x34875a['model'],_0x34875a['query']);_0x5e00d9[_0xd64c('0x43')]=_[_0xd64c('0x42')](_0x34875a[_0xd64c('0x3e')],qs['fields'](_0x4bf270[_0xd64c('0x3f')][_0xd64c('0x44')]));_0x5e00d9[_0xd64c('0x43')]=_0x5e00d9[_0xd64c('0x43')][_0xd64c('0x45')]?_0x5e00d9['attributes']:_0x34875a['model'];_0x5e00d9[_0xd64c('0x62')]=qs[_0xd64c('0x48')](_0x4bf270[_0xd64c('0x3f')][_0xd64c('0x48')]);_0x5e00d9[_0xd64c('0x49')]=qs['filters'](_[_0xd64c('0x4a')](_0x4bf270[_0xd64c('0x3f')],_0x34875a[_0xd64c('0x41')]));if(_0x4bf270['query'][_0xd64c('0x4b')]){_0x5e00d9[_0xd64c('0x49')]=_[_0xd64c('0x52')](_0x5e00d9[_0xd64c('0x49')],{'$or':_[_0xd64c('0x39')](_0x5e00d9[_0xd64c('0x43')],function(_0x262d25){var _0x335950={};_0x335950[_0x262d25]={'$like':'%'+_0x4bf270[_0xd64c('0x3f')][_0xd64c('0x4b')]+'%'};return _0x335950;})});}_0x5e00d9=_[_0xd64c('0x52')]({},_0x5e00d9,_0x4bf270[_0xd64c('0x4d')]);return _0x4ce6e2[_0xd64c('0x108')](_0x5e00d9);}})[_0xd64c('0x2e')](function(_0x54a125){if(_0x54a125){_0x2a2020=_0x54a125[_0xd64c('0x45')];if(!_0x4bf270['query'][_0xd64c('0x46')](_0xd64c('0x47'))){_0x5e00d9[_0xd64c('0x2b')]=qs[_0xd64c('0x2b')](_0x4bf270[_0xd64c('0x3f')][_0xd64c('0x2b')]);_0x5e00d9[_0xd64c('0x29')]=qs[_0xd64c('0x29')](_0x4bf270[_0xd64c('0x3f')][_0xd64c('0x29')]);}return _0x4ce6e2['getProactiveActions'](_0x5e00d9);}})[_0xd64c('0x2e')](function(_0x36755e){if(_0x36755e){return _0x36755e?{'count':_0x2a2020,'rows':_0x36755e}:null;}})[_0xd64c('0x2e')](respondWithResult(_0x2bef91,null))[_0xd64c('0x25')](handleError(_0x2bef91,null));};exports['getFields']=function(_0x16ca70,_0x51da11,_0xac1ddc){var _0x79fd2f=_0x16ca70[_0xd64c('0x3f')]['online']==='false'?_0xd64c('0x11d'):_0xd64c('0x11e');return db[_0xd64c('0x3a')][_0xd64c('0x53')]({'attributes':['id',_0x79fd2f],'where':{'id':_0x16ca70[_0xd64c('0x51')]['id']}})[_0xd64c('0x2e')](handleEntityNotFound(_0x51da11,null))[_0xd64c('0x2e')](function(_0x184d2d){if(_0x184d2d){var _0x57ea35=_0x184d2d[_0x79fd2f];var _0x56dbf0=_0x57ea35&&_0x57ea35['items']?_0x57ea35['items']:[];_0x51da11['send']({'fromKey':_[_0xd64c('0x75')](_0x57ea35['fromKey'])?undefined:_0x57ea35[_0xd64c('0x11f')],'count':_0x56dbf0[_0xd64c('0x45')],'rows':_0x56dbf0});}})[_0xd64c('0x25')](handleError(_0x51da11,null));};exports['getOfflineMessages']=function(_0x2292af,_0x46b00a,_0x5d524f){var _0x289f39={'raw':![],'where':{}};var _0x43ab37={};var _0x432b26={'count':0x0,'rows':[]};return db[_0xd64c('0x3a')]['findOne']({'where':{'id':_0x2292af['params']['id']}})[_0xd64c('0x2e')](handleEntityNotFound(_0x46b00a,null))[_0xd64c('0x2e')](function(_0x39e2a2){if(_0x39e2a2){_0x43ab37[_0xd64c('0x3e')]=_[_0xd64c('0x40')](db['ChatOfflineMessage'][_0xd64c('0x3b')]);_0x43ab37[_0xd64c('0x3f')]=_['keys'](_0x2292af[_0xd64c('0x3f')]);_0x43ab37[_0xd64c('0x41')]=_['intersection'](_0x43ab37[_0xd64c('0x3e')],_0x43ab37[_0xd64c('0x3f')]);_0x289f39[_0xd64c('0x43')]=_[_0xd64c('0x42')](_0x43ab37[_0xd64c('0x3e')],qs[_0xd64c('0x44')](_0x2292af['query'][_0xd64c('0x44')]));_0x289f39['attributes']=_0x289f39[_0xd64c('0x43')]['length']?_0x289f39[_0xd64c('0x43')]:_0x43ab37[_0xd64c('0x3e')];if(!_0x2292af[_0xd64c('0x3f')][_0xd64c('0x46')](_0xd64c('0x47'))){_0x289f39[_0xd64c('0x2b')]=qs[_0xd64c('0x2b')](_0x2292af['query'][_0xd64c('0x2b')]);_0x289f39[_0xd64c('0x29')]=qs[_0xd64c('0x29')](_0x2292af[_0xd64c('0x3f')][_0xd64c('0x29')]);}_0x289f39[_0xd64c('0x62')]=qs[_0xd64c('0x48')](_0x2292af[_0xd64c('0x3f')]['sort']);_0x289f39[_0xd64c('0x49')]=qs[_0xd64c('0x41')](_[_0xd64c('0x4a')](_0x2292af[_0xd64c('0x3f')],_0x43ab37[_0xd64c('0x41')]));_0x289f39[_0xd64c('0x49')][_0xd64c('0x5e')]=_0x39e2a2['id'];if(_0x2292af[_0xd64c('0x3f')][_0xd64c('0x4b')]){_0x289f39[_0xd64c('0x49')]=_[_0xd64c('0x52')](_0x289f39['where'],{'$or':_[_0xd64c('0x39')](_0x289f39['attributes'],function(_0x421cd9){var _0x530f6c={};_0x530f6c[_0x421cd9]={'$like':'%'+_0x2292af[_0xd64c('0x3f')]['filter']+'%'};return _0x530f6c;})});}_0x289f39=_[_0xd64c('0x52')]({},_0x289f39,_0x2292af[_0xd64c('0x4d')]);return db[_0xd64c('0xd5')][_0xd64c('0x2c')]({'where':_0x289f39['where']})[_0xd64c('0x2e')](function(_0x2ed3f2){_0x432b26[_0xd64c('0x2c')]=_0x2ed3f2;if(_0x2292af[_0xd64c('0x3f')][_0xd64c('0x4e')]){_0x289f39['include']=[{'all':!![]}];}else{_0x289f39[_0xd64c('0x4f')]=[{'model':db[_0xd64c('0x84')],'as':_0xd64c('0xf8'),'required':![]},{'model':db[_0xd64c('0xdc')],'as':'Attachments','required':![]}];}return db[_0xd64c('0xd5')][_0xd64c('0x63')](_0x289f39);})['then'](function(_0x386cd0){_0x432b26['rows']=_0x386cd0;return _0x432b26;});}})[_0xd64c('0x2e')](respondWithFilteredResult(_0x46b00a,_0x289f39))[_0xd64c('0x25')](handleError(_0x46b00a,null));};exports[_0xd64c('0x120')]=function(_0x4aebf7,_0x2e058e,_0x51a048){return db[_0xd64c('0x3a')][_0xd64c('0x53')]({'where':{'id':_0x4aebf7[_0xd64c('0x51')]['id']}})['then'](handleEntityNotFound(_0x2e058e,null))['then'](function(_0x1879f9){if(_0x1879f9){return _0x1879f9[_0xd64c('0x120')](_0x4aebf7[_0xd64c('0x55')]['ids'],_[_0xd64c('0xf6')](_0x4aebf7[_0xd64c('0x55')],[_0xd64c('0x65'),'id'])||{})[_0xd64c('0xb5')](function(_0x1cd860){for(var _0x2a0ea9=0x0;_0x2a0ea9<_0x4aebf7[_0xd64c('0x55')][_0xd64c('0x65')][_0xd64c('0x45')];_0x2a0ea9+=0x1){socket['emit']('userChatWebsite:save',{'UserId':Number(_0x4aebf7[_0xd64c('0x55')][_0xd64c('0x65')][_0x2a0ea9]),'ChatWebsiteId':Number(_0x4aebf7[_0xd64c('0x51')]['id'])});}return _0x1cd860;});}})[_0xd64c('0x2e')](respondWithResult(_0x2e058e,null))[_0xd64c('0x25')](handleError(_0x2e058e,null));};exports[_0xd64c('0x121')]=function(_0xa4800d,_0x4c0372,_0x8f8652){return db['ChatWebsite'][_0xd64c('0x53')]({'where':{'id':_0xa4800d[_0xd64c('0x51')]['id']}})[_0xd64c('0x2e')](handleEntityNotFound(_0x4c0372,null))[_0xd64c('0x2e')](function(_0x4a9930){if(_0x4a9930){return _0x4a9930[_0xd64c('0x121')](_0xa4800d[_0xd64c('0x3f')][_0xd64c('0x65')])[_0xd64c('0x2e')](function(){if(_[_0xd64c('0x122')](_0xa4800d['query']['ids'])){for(var _0x48c04d=0x0;_0x48c04d<_0xa4800d['query'][_0xd64c('0x65')][_0xd64c('0x45')];_0x48c04d+=0x1){socket[_0xd64c('0x123')]('userChatWebsite:remove',{'UserId':Number(_0xa4800d[_0xd64c('0x3f')][_0xd64c('0x65')][_0x48c04d]),'ChatWebsiteId':Number(_0xa4800d[_0xd64c('0x51')]['id'])});}}else{socket[_0xd64c('0x123')](_0xd64c('0x124'),{'UserId':Number(_0xa4800d['query'][_0xd64c('0x65')]),'ChatWebsiteId':Number(_0xa4800d[_0xd64c('0x51')]['id'])});}});}})[_0xd64c('0x2e')](respondWithStatusCode(_0x4c0372,null))[_0xd64c('0x25')](handleError(_0x4c0372,null));};exports[_0xd64c('0x125')]=function(_0x440c1a,_0x13590e,_0x1f6ec8){var _0x4a3e1c={};var _0x103175={};var _0x5c9173;var _0x5d3007;return db[_0xd64c('0x3a')]['findOne']({'where':{'id':_0x440c1a['params']['id']}})[_0xd64c('0x2e')](handleEntityNotFound(_0x13590e,null))[_0xd64c('0x2e')](function(_0x3340ef){if(_0x3340ef){_0x5c9173=_0x3340ef;_0x103175['model']=_[_0xd64c('0x40')](db[_0xd64c('0x126')][_0xd64c('0x3b')]);_0x103175[_0xd64c('0x3f')]=_[_0xd64c('0x40')](_0x440c1a['query']);_0x103175[_0xd64c('0x41')]=_[_0xd64c('0x42')](_0x103175['model'],_0x103175[_0xd64c('0x3f')]);_0x4a3e1c[_0xd64c('0x43')]=_[_0xd64c('0x42')](_0x103175[_0xd64c('0x3e')],qs[_0xd64c('0x44')](_0x440c1a[_0xd64c('0x3f')][_0xd64c('0x44')]));_0x4a3e1c[_0xd64c('0x43')]=_0x4a3e1c[_0xd64c('0x43')][_0xd64c('0x45')]?_0x4a3e1c[_0xd64c('0x43')]:_0x103175[_0xd64c('0x3e')];_0x4a3e1c[_0xd64c('0x62')]=qs[_0xd64c('0x48')](_0x440c1a[_0xd64c('0x3f')]['sort']);_0x4a3e1c[_0xd64c('0x49')]=qs[_0xd64c('0x41')](_[_0xd64c('0x4a')](_0x440c1a[_0xd64c('0x3f')],_0x103175[_0xd64c('0x41')]));if(_0x440c1a['query'][_0xd64c('0x4b')]){_0x4a3e1c[_0xd64c('0x49')]=_['merge'](_0x4a3e1c[_0xd64c('0x49')],{'$or':_['map'](_0x4a3e1c[_0xd64c('0x43')],function(_0x296c0c){var _0x880a58={};_0x880a58[_0x296c0c]={'$like':'%'+_0x440c1a[_0xd64c('0x3f')][_0xd64c('0x4b')]+'%'};return _0x880a58;})});}_0x4a3e1c=_[_0xd64c('0x52')]({},_0x4a3e1c,_0x440c1a[_0xd64c('0x4d')]);return _0x5c9173['getAgents'](_0x4a3e1c);}})[_0xd64c('0x2e')](function(_0x4f9666){if(_0x4f9666){_0x5d3007=_0x4f9666[_0xd64c('0x45')];if(!_0x440c1a['query'][_0xd64c('0x46')](_0xd64c('0x47'))){_0x4a3e1c['limit']=qs[_0xd64c('0x2b')](_0x440c1a['query'][_0xd64c('0x2b')]);_0x4a3e1c[_0xd64c('0x29')]=qs[_0xd64c('0x29')](_0x440c1a[_0xd64c('0x3f')][_0xd64c('0x29')]);}return _0x5c9173[_0xd64c('0x125')](_0x4a3e1c);}})[_0xd64c('0x2e')](function(_0x49d8a2){if(_0x49d8a2){return _0x49d8a2?{'count':_0x5d3007,'rows':_0x49d8a2}:null;}})[_0xd64c('0x2e')](respondWithResult(_0x13590e,null))[_0xd64c('0x25')](handleError(_0x13590e,null));}; \ No newline at end of file +var _0xfa1b=['hasOwnProperty','order','sort','where','pick','filter','type','VIRTUAL','merge','ChatWebsite','includeAll','include','findAll','rows','show','keys','fields','length','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','autoAssociation','describe','addDisposition','params','ChatWebsiteId','Disposition','getDispositions','findOne','nolimit','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','addLogo','file','filename','agentAvatar','addCustomerAvatar','customerAvatar','systemAvatar','getLogo','root','server/files/images/logos/default_logo.svg','sitepic','getLicense','isNil','existsSync','join','server/files/images/logos/','download','server/files/images/avatars/default_avatar.png','server/files/images/avatars/','getCustomerAvatar','showCustomerAvatar','getSystemAvatar','server/files/images/avatars/system_avatar.png','notify','user-agent-parser','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','from','from\x20is\x20mandatory','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','Contacts','DESC','ChatApplication','Applications','account','applications','orderBy','asc','defaults','ListId','contact','customerIp','headers','cf-connecting-ip','x-forwarded-for','first','split','firstName','lastName','x-real-port','referer','browser','version','format','%s\x20%s','unknown','device','vendor','%s\x20%s\x20%s','threadId','ChatInteraction','externalUrl','interaction','spread','messageId','created','autoclose','push','close','unmanaged','*,*,*,*','UserId','User','unshift','agent','waitForTheAssignedAgent','Start','startRouting','EventManager','files','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','findOrCreate','readFileSync','render','offlineMessageBody','ChatOfflineMessage','mimetype','server','offline-chat','openNewInteraction','sequelize','transaction','Attachment','bulkCreate','MailServerOut','Smtp','forwardOfflineAddress','service','host','port','secure','authentication','auth','pass','SendMail','sendMail','\x22%s\x22\x20<%s>','email','offlineMessageSubject','originalname','subjectOffline','toPairsIn','Chat','MailAccountId','NotifyMailAccount','notifyMail','attachments','Could\x20not\x20remove\x20attachment\x20file','addInteraction','omit','getInteractions','Contact','fullname','internal','Tag','Tags','color','tag','Command','timezone','iftime\x20%s,%s','interval','iftime\x20%s','indexOf','true','ONLINE','OFFLINE','No\x20timezone','inspect','getSnippet','Interval','Intervals','virtual','custom','License','increment','all','some','server/files/chat/iframe.ejs','remote','x-real-ip','connection','remoteAddress','verticalAlignment','color_button','backgroundColor','addApplications','findAndCountAll','priority','getApplications','addProactiveActions','chatProactiveAction','ChatProactiveAction','getProactiveActions','getFields','online','onlineForm','items','fromKey','getOfflineMessages','Attachments','addAgents','emit','userChatWebsite:save','removeAgents','isArray','userChatWebsite:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','jayson/promise','client','http','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','json','offset','limit','undefined','count','status','Content-Range','apply','reject','save','destroy','get','ChatWebsites','UserProfileResource','end','sendStatus','stack','name','send','Pause','mandatoryDispositionPause','rawAttributes','fieldName','key','model','map','query','filters','intersection','attributes'];(function(_0xc0b67e,_0x4a5ae3){var _0x46b91f=function(_0xd8a097){while(--_0xd8a097){_0xc0b67e['push'](_0xc0b67e['shift']());}};_0x46b91f(++_0x4a5ae3);}(_0xfa1b,0xe9));var _0xbfa1=function(_0x1f63ed,_0x219297){_0x1f63ed=_0x1f63ed-0x0;var _0x174cfa=_0xfa1b[_0x1f63ed];return _0x174cfa;};'use strict';var emlformat=require(_0xbfa1('0x0'));var rimraf=require(_0xbfa1('0x1'));var zipdir=require(_0xbfa1('0x2'));var jsonpatch=require(_0xbfa1('0x3'));var rp=require(_0xbfa1('0x4'));var moment=require(_0xbfa1('0x5'));var BPromise=require(_0xbfa1('0x6'));var Mustache=require(_0xbfa1('0x7'));var util=require(_0xbfa1('0x8'));var path=require(_0xbfa1('0x9'));var sox=require(_0xbfa1('0xa'));var csv=require('to-csv');var ejs=require(_0xbfa1('0xb'));var fs=require('fs');var fs_extra=require(_0xbfa1('0xc'));var _=require(_0xbfa1('0xd'));var squel=require(_0xbfa1('0xe'));var crypto=require(_0xbfa1('0xf'));var jsforce=require(_0xbfa1('0x10'));var deskjs=require(_0xbfa1('0x11'));var toCsv=require(_0xbfa1('0x12'));var querystring=require(_0xbfa1('0x13'));var Papa=require(_0xbfa1('0x14'));var Redis=require(_0xbfa1('0x15'));var authService=require(_0xbfa1('0x16'));var qs=require('../../components/parsers/qs');var as=require(_0xbfa1('0x17'));var hardwareService=require(_0xbfa1('0x18'));var logger=require(_0xbfa1('0x19'))(_0xbfa1('0x1a'));var utils=require(_0xbfa1('0x1b'));var config=require(_0xbfa1('0x1c'));var licenseUtil=require(_0xbfa1('0x1d'));var db=require(_0xbfa1('0x1e'))['db'];config['redis']=_['defaults'](config[_0xbfa1('0x1f')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xbfa1('0x1f')]));require('./chatWebsite.socket')['register'](socket);var jayson=require(_0xbfa1('0x20'));var client=jayson[_0xbfa1('0x21')][_0xbfa1('0x22')]({'port':0x232c});var client9002=jayson[_0xbfa1('0x21')][_0xbfa1('0x22')]({'port':0x232a});var client9003=jayson[_0xbfa1('0x21')][_0xbfa1('0x22')]({'port':0x232b});var client9001=jayson[_0xbfa1('0x21')][_0xbfa1('0x22')]({'port':0x2329});function respondWithRpcPromise(_0x25b7b9,_0x59cd14,_0x31ea04,_0x1eff03){return new BPromise(function(_0x306e42,_0x2c3ca5){var _0x1976d7=_0x1eff03||client;return _0x1976d7['request'](_0x25b7b9,_0x31ea04)[_0xbfa1('0x23')](function(_0x58a6f9){logger[_0xbfa1('0x24')](_0xbfa1('0x25'),_0x59cd14,_0xbfa1('0x26'));logger['debug'](_0xbfa1('0x27'),_0x59cd14,'request\x20sent',JSON[_0xbfa1('0x28')](_0x58a6f9));if(_0x58a6f9[_0xbfa1('0x29')]){if(_0x58a6f9[_0xbfa1('0x29')][_0xbfa1('0x2a')]===0x1f4){logger['error'](_0xbfa1('0x25'),_0x59cd14,_0x58a6f9['error'][_0xbfa1('0x2b')]);return _0x2c3ca5(_0x58a6f9[_0xbfa1('0x29')][_0xbfa1('0x2b')]);}logger[_0xbfa1('0x29')](_0xbfa1('0x25'),_0x59cd14,_0x58a6f9[_0xbfa1('0x29')][_0xbfa1('0x2b')]);return _0x306e42(_0x58a6f9['error'][_0xbfa1('0x2b')]);}else{logger[_0xbfa1('0x24')]('ChatWebsite,\x20%s,\x20%s',_0x59cd14,_0xbfa1('0x26'));_0x306e42(_0x58a6f9[_0xbfa1('0x2c')][_0xbfa1('0x2b')]);}})[_0xbfa1('0x2d')](function(_0x1496a6){logger['error'](_0xbfa1('0x25'),_0x59cd14,_0x1496a6);_0x2c3ca5(_0x1496a6);});});}function respondWithStatusCode(_0x1faa17,_0x346375){_0x346375=_0x346375||0xcc;return function(_0x13d9bb){if(_0x13d9bb){return _0x1faa17['sendStatus'](_0x346375);}return _0x1faa17['status'](_0x346375)['end']();};}function respondWithResult(_0x2c8385,_0x30642d){_0x30642d=_0x30642d||0xc8;return function(_0x5603df){if(_0x5603df){return _0x2c8385['status'](_0x30642d)[_0xbfa1('0x2e')](_0x5603df);}};}function respondWithFilteredResult(_0x4a7dce,_0x88d01e){return function(_0x28eb91){if(_0x28eb91){var _0x95ffc8=typeof _0x88d01e[_0xbfa1('0x2f')]==='undefined'&&typeof _0x88d01e[_0xbfa1('0x30')]===_0xbfa1('0x31');var _0x1a4740=_0x28eb91[_0xbfa1('0x32')];var _0x38d752=_0x95ffc8?0x0:_0x88d01e[_0xbfa1('0x2f')];var _0x6b2574=_0x95ffc8?_0x28eb91[_0xbfa1('0x32')]:_0x88d01e[_0xbfa1('0x2f')]+_0x88d01e[_0xbfa1('0x30')];var _0x5ac586;if(_0x6b2574>=_0x1a4740){_0x6b2574=_0x1a4740;_0x5ac586=0xc8;}else{_0x5ac586=0xce;}_0x4a7dce[_0xbfa1('0x33')](_0x5ac586);return _0x4a7dce['set'](_0xbfa1('0x34'),_0x38d752+'-'+_0x6b2574+'/'+_0x1a4740)[_0xbfa1('0x2e')](_0x28eb91);}return null;};}function patchUpdates(_0x2a94e4){return function(_0x34254f){try{jsonpatch[_0xbfa1('0x35')](_0x34254f,_0x2a94e4,!![]);}catch(_0x36751e){return BPromise[_0xbfa1('0x36')](_0x36751e);}return _0x34254f[_0xbfa1('0x37')]();};}function saveUpdates(_0x1ae2a3,_0x4338e9){return function(_0x671bac){if(_0x671bac){return _0x671bac['update'](_0x1ae2a3)['then'](function(_0x239475){return _0x239475;});}return null;};}function removeEntity(_0xad7c88,_0x5af01d){return function(_0x5276fb){if(_0x5276fb){return _0x5276fb[_0xbfa1('0x38')]()[_0xbfa1('0x23')](function(){var _0x1c4a22=_0x5276fb[_0xbfa1('0x39')]({'plain':!![]});var _0x46118a=_0xbfa1('0x3a');return db[_0xbfa1('0x3b')]['destroy']({'where':{'type':_0x46118a,'resourceId':_0x1c4a22['id']}})['then'](function(){return _0x5276fb;});})[_0xbfa1('0x23')](function(){_0xad7c88[_0xbfa1('0x33')](0xcc)[_0xbfa1('0x3c')]();});}};}function handleEntityNotFound(_0x33936a,_0x56ad1b){return function(_0x8a6a65){if(!_0x8a6a65){_0x33936a[_0xbfa1('0x3d')](0x194);}return _0x8a6a65;};}function handleError(_0x21dce1,_0x479d87){_0x479d87=_0x479d87||0x1f4;return function(_0x333233){logger['error'](_0x333233[_0xbfa1('0x3e')]);if(_0x333233['name']){delete _0x333233[_0xbfa1('0x3f')];}_0x21dce1['status'](_0x479d87)[_0xbfa1('0x40')](_0x333233);};}exports['index']=function(_0x3ac573,_0x49d687){var _0x3347ba={'include':[{'model':db[_0xbfa1('0x41')],'as':_0xbfa1('0x42')}]},_0x212ec1={},_0x3b694c={'count':0x0,'rows':[]};var _0x33bbb7=_['map'](db['ChatWebsite'][_0xbfa1('0x43')],function(_0x50a079){return{'name':_0x50a079[_0xbfa1('0x44')],'type':_0x50a079['type'][_0xbfa1('0x45')]};});_0x212ec1[_0xbfa1('0x46')]=_[_0xbfa1('0x47')](_0x33bbb7,_0xbfa1('0x3f'));_0x212ec1[_0xbfa1('0x48')]=_['keys'](_0x3ac573[_0xbfa1('0x48')]);_0x212ec1[_0xbfa1('0x49')]=_[_0xbfa1('0x4a')](_0x212ec1[_0xbfa1('0x46')],_0x212ec1[_0xbfa1('0x48')]);_0x3347ba[_0xbfa1('0x4b')]=_['intersection'](_0x212ec1[_0xbfa1('0x46')],qs['fields'](_0x3ac573[_0xbfa1('0x48')]['fields']));_0x3347ba[_0xbfa1('0x4b')]=_0x3347ba[_0xbfa1('0x4b')]['length']?_0x3347ba['attributes']:_0x212ec1[_0xbfa1('0x46')];if(!_0x3ac573[_0xbfa1('0x48')][_0xbfa1('0x4c')]('nolimit')){_0x3347ba[_0xbfa1('0x30')]=qs[_0xbfa1('0x30')](_0x3ac573['query']['limit']);_0x3347ba[_0xbfa1('0x2f')]=qs[_0xbfa1('0x2f')](_0x3ac573[_0xbfa1('0x48')][_0xbfa1('0x2f')]);}_0x3347ba[_0xbfa1('0x4d')]=qs[_0xbfa1('0x4e')](_0x3ac573[_0xbfa1('0x48')][_0xbfa1('0x4e')]);_0x3347ba[_0xbfa1('0x4f')]=qs[_0xbfa1('0x49')](_[_0xbfa1('0x50')](_0x3ac573[_0xbfa1('0x48')],_0x212ec1[_0xbfa1('0x49')]),_0x33bbb7);if(_0x3ac573['query'][_0xbfa1('0x51')]){_0x3347ba[_0xbfa1('0x4f')]=_['merge'](_0x3347ba[_0xbfa1('0x4f')],{'$or':_[_0xbfa1('0x47')](_0x33bbb7,function(_0xf2c726){if(_0xf2c726[_0xbfa1('0x52')]!==_0xbfa1('0x53')){var _0x1eaec3={};_0x1eaec3[_0xf2c726[_0xbfa1('0x3f')]]={'$like':'%'+_0x3ac573[_0xbfa1('0x48')][_0xbfa1('0x51')]+'%'};return _0x1eaec3;}})});}_0x3347ba=_[_0xbfa1('0x54')]({},_0x3347ba,_0x3ac573['options']);var _0xcc5ed6={'where':_0x3347ba[_0xbfa1('0x4f')]};return db[_0xbfa1('0x55')]['count'](_0xcc5ed6)[_0xbfa1('0x23')](function(_0x58e78e){_0x3b694c[_0xbfa1('0x32')]=_0x58e78e;if(_0x3ac573[_0xbfa1('0x48')][_0xbfa1('0x56')]){_0x3347ba[_0xbfa1('0x57')]=[{'all':!![]}];}return db[_0xbfa1('0x55')][_0xbfa1('0x58')](_0x3347ba);})[_0xbfa1('0x23')](function(_0xa8b585){_0x3b694c[_0xbfa1('0x59')]=_0xa8b585;return _0x3b694c;})['then'](respondWithFilteredResult(_0x49d687,_0x3347ba))[_0xbfa1('0x2d')](handleError(_0x49d687,null));};exports[_0xbfa1('0x5a')]=function(_0x5f30d9,_0x2c279b){var _0x9a5015={'raw':![],'where':{'id':_0x5f30d9['params']['id']},'include':[{'model':db[_0xbfa1('0x41')],'as':'mandatoryDispositionPause'}]},_0x6f6006={};_0x6f6006['model']=_[_0xbfa1('0x5b')](db[_0xbfa1('0x55')][_0xbfa1('0x43')]);_0x6f6006['query']=_[_0xbfa1('0x5b')](_0x5f30d9[_0xbfa1('0x48')]);_0x6f6006['filters']=_[_0xbfa1('0x4a')](_0x6f6006[_0xbfa1('0x46')],_0x6f6006[_0xbfa1('0x48')]);_0x9a5015[_0xbfa1('0x4b')]=_[_0xbfa1('0x4a')](_0x6f6006['model'],qs['fields'](_0x5f30d9[_0xbfa1('0x48')][_0xbfa1('0x5c')]));_0x9a5015[_0xbfa1('0x4b')]=_0x9a5015[_0xbfa1('0x4b')][_0xbfa1('0x5d')]?_0x9a5015[_0xbfa1('0x4b')]:_0x6f6006[_0xbfa1('0x46')];if(_0x5f30d9[_0xbfa1('0x48')][_0xbfa1('0x56')]){_0x9a5015[_0xbfa1('0x57')]=[{'all':!![]}];}_0x9a5015=_[_0xbfa1('0x54')]({},_0x9a5015,_0x5f30d9[_0xbfa1('0x5e')]);return db[_0xbfa1('0x55')][_0xbfa1('0x5f')](_0x9a5015)['then'](handleEntityNotFound(_0x2c279b,null))[_0xbfa1('0x23')](respondWithResult(_0x2c279b,null))[_0xbfa1('0x2d')](handleError(_0x2c279b,null));};exports[_0xbfa1('0x60')]=function(_0x26febd,_0x12a732){return db[_0xbfa1('0x55')]['create'](_0x26febd[_0xbfa1('0x61')],{})[_0xbfa1('0x23')](function(_0x2e863b){var _0x50b4c7=_0x26febd['user'][_0xbfa1('0x39')]({'plain':!![]});if(!_0x50b4c7)throw new Error(_0xbfa1('0x62'));if(_0x50b4c7['role']===_0xbfa1('0x63')){var _0x1edf51=_0x2e863b['get']({'plain':!![]});var _0x2b8b0d=_0xbfa1('0x3a');return db[_0xbfa1('0x64')][_0xbfa1('0x5f')]({'where':{'name':_0x2b8b0d,'userProfileId':_0x50b4c7[_0xbfa1('0x65')]},'raw':!![]})['then'](function(_0x15ebcf){if(_0x15ebcf&&_0x15ebcf[_0xbfa1('0x66')]===0x0){return db['UserProfileResource'][_0xbfa1('0x60')]({'name':_0x1edf51[_0xbfa1('0x3f')],'resourceId':_0x1edf51['id'],'type':_0x15ebcf[_0xbfa1('0x3f')],'sectionId':_0x15ebcf['id']},{})[_0xbfa1('0x23')](function(){return _0x2e863b;});}else{return _0x2e863b;}})[_0xbfa1('0x2d')](function(_0x560bcc){logger[_0xbfa1('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x560bcc);throw _0x560bcc;});}return _0x2e863b;})[_0xbfa1('0x23')](respondWithResult(_0x12a732,0xc9))['catch'](handleError(_0x12a732,null));};exports['update']=function(_0x32a681,_0xc892db){if(_0x32a681[_0xbfa1('0x61')]['id']){delete _0x32a681[_0xbfa1('0x61')]['id'];}return db[_0xbfa1('0x55')]['find']({'where':{'id':_0x32a681['params']['id']},'include':[{'model':db[_0xbfa1('0x41')],'as':'mandatoryDispositionPause'}]})[_0xbfa1('0x23')](handleEntityNotFound(_0xc892db,null))[_0xbfa1('0x23')](saveUpdates(_0x32a681['body'],null))[_0xbfa1('0x23')](respondWithResult(_0xc892db,null))[_0xbfa1('0x2d')](handleError(_0xc892db,null));};exports[_0xbfa1('0x38')]=function(_0x2e7f15,_0x1efe59){return db[_0xbfa1('0x55')]['find']({'where':{'id':_0x2e7f15['params']['id']}})[_0xbfa1('0x23')](handleEntityNotFound(_0x1efe59,null))[_0xbfa1('0x23')](removeEntity(_0x1efe59,null))['catch'](handleError(_0x1efe59,null));};exports[_0xbfa1('0x67')]=function(_0x32a8f2,_0x38ee4c){return db[_0xbfa1('0x55')][_0xbfa1('0x67')]()[_0xbfa1('0x23')](respondWithResult(_0x38ee4c,null))[_0xbfa1('0x2d')](handleError(_0x38ee4c,null));};exports[_0xbfa1('0x68')]=function(_0x448a4c,_0x171d48,_0x582e5d){if(_0x448a4c[_0xbfa1('0x61')]['id']){delete _0x448a4c[_0xbfa1('0x61')]['id'];}return db[_0xbfa1('0x55')][_0xbfa1('0x5f')]({'where':{'id':_0x448a4c[_0xbfa1('0x69')]['id']}})[_0xbfa1('0x23')](handleEntityNotFound(_0x171d48,null))[_0xbfa1('0x23')](function(_0x4d7cac){if(_0x4d7cac){_0x448a4c[_0xbfa1('0x61')][_0xbfa1('0x6a')]=_0x4d7cac['id'];return db[_0xbfa1('0x6b')]['create'](_0x448a4c['body']);}})[_0xbfa1('0x23')](respondWithResult(_0x171d48,null))[_0xbfa1('0x2d')](handleError(_0x171d48,null));};exports[_0xbfa1('0x6c')]=function(_0x59736f,_0x132b0e,_0x3c6830){var _0x5f5449={'raw':![],'where':{}};var _0x37330c={};var _0x3f001f={'count':0x0,'rows':[]};return db['ChatWebsite'][_0xbfa1('0x6d')]({'where':{'id':_0x59736f['params']['id']}})[_0xbfa1('0x23')](handleEntityNotFound(_0x132b0e,null))['then'](function(_0x55916d){if(_0x55916d){_0x37330c['model']=_[_0xbfa1('0x5b')](db[_0xbfa1('0x6b')]['rawAttributes']);_0x37330c[_0xbfa1('0x48')]=_[_0xbfa1('0x5b')](_0x59736f[_0xbfa1('0x48')]);_0x37330c['filters']=_[_0xbfa1('0x4a')](_0x37330c[_0xbfa1('0x46')],_0x37330c[_0xbfa1('0x48')]);_0x5f5449[_0xbfa1('0x4b')]=_[_0xbfa1('0x4a')](_0x37330c[_0xbfa1('0x46')],qs[_0xbfa1('0x5c')](_0x59736f['query']['fields']));_0x5f5449[_0xbfa1('0x4b')]=_0x5f5449[_0xbfa1('0x4b')]['length']?_0x5f5449['attributes']:_0x37330c[_0xbfa1('0x46')];if(!_0x59736f['query'][_0xbfa1('0x4c')](_0xbfa1('0x6e'))){_0x5f5449[_0xbfa1('0x30')]=qs[_0xbfa1('0x30')](_0x59736f[_0xbfa1('0x48')][_0xbfa1('0x30')]);_0x5f5449['offset']=qs[_0xbfa1('0x2f')](_0x59736f['query'][_0xbfa1('0x2f')]);}_0x5f5449[_0xbfa1('0x4d')]=qs['sort'](_0x59736f[_0xbfa1('0x48')][_0xbfa1('0x4e')]);_0x5f5449[_0xbfa1('0x4f')]=qs['filters'](_[_0xbfa1('0x50')](_0x59736f['query'],_0x37330c['filters']));_0x5f5449[_0xbfa1('0x4f')]['ChatWebsiteId']=_0x55916d['id'];if(_0x59736f['query'][_0xbfa1('0x51')]){_0x5f5449[_0xbfa1('0x4f')]=_[_0xbfa1('0x54')](_0x5f5449[_0xbfa1('0x4f')],{'$or':_[_0xbfa1('0x47')](_0x5f5449['attributes'],function(_0x1fac99){var _0x277f05={};_0x277f05[_0x1fac99]={'$like':'%'+_0x59736f['query']['filter']+'%'};return _0x277f05;})});}_0x5f5449=_['merge']({},_0x5f5449,_0x59736f[_0xbfa1('0x5e')]);return db['Disposition'][_0xbfa1('0x32')]({'where':_0x5f5449[_0xbfa1('0x4f')]})[_0xbfa1('0x23')](function(_0x372d9d){_0x3f001f[_0xbfa1('0x32')]=_0x372d9d;if(_0x59736f[_0xbfa1('0x48')]['includeAll']){_0x5f5449[_0xbfa1('0x57')]=[{'all':!![]}];}return db['Disposition'][_0xbfa1('0x58')](_0x5f5449);})[_0xbfa1('0x23')](function(_0x2fa547){_0x3f001f[_0xbfa1('0x59')]=_0x2fa547;return _0x3f001f;});}})['then'](respondWithFilteredResult(_0x132b0e,_0x5f5449))[_0xbfa1('0x2d')](handleError(_0x132b0e,null));};exports[_0xbfa1('0x6f')]=function(_0x10c288,_0x574461,_0x1b43fa){return db[_0xbfa1('0x55')]['find']({'where':{'id':_0x10c288[_0xbfa1('0x69')]['id']}})['then'](handleEntityNotFound(_0x574461,null))['then'](function(_0x4355c9){if(_0x4355c9){return _0x4355c9[_0xbfa1('0x6f')](_0x10c288['query'][_0xbfa1('0x70')]);}})[_0xbfa1('0x23')](respondWithStatusCode(_0x574461,null))['catch'](handleError(_0x574461,null));};exports[_0xbfa1('0x71')]=function(_0x26e7f7,_0x596c03,_0x2bf00e){if(_0x26e7f7[_0xbfa1('0x61')]['id']){delete _0x26e7f7[_0xbfa1('0x61')]['id'];}return db[_0xbfa1('0x55')][_0xbfa1('0x5f')]({'where':{'id':_0x26e7f7['params']['id']}})[_0xbfa1('0x23')](handleEntityNotFound(_0x596c03,null))[_0xbfa1('0x23')](function(_0x3221ff){if(_0x3221ff){_0x26e7f7[_0xbfa1('0x61')]['ChatWebsiteId']=_0x3221ff['id'];return db[_0xbfa1('0x72')]['create'](_0x26e7f7[_0xbfa1('0x61')]);}})[_0xbfa1('0x23')](respondWithResult(_0x596c03,null))[_0xbfa1('0x2d')](handleError(_0x596c03,null));};exports[_0xbfa1('0x73')]=function(_0x9cbe85,_0x5616f2,_0x53e395){var _0x595d47={'raw':![],'where':{}};var _0x2da59f={};var _0x61cadc={'count':0x0,'rows':[]};return db[_0xbfa1('0x55')][_0xbfa1('0x6d')]({'where':{'id':_0x9cbe85[_0xbfa1('0x69')]['id']}})[_0xbfa1('0x23')](handleEntityNotFound(_0x5616f2,null))[_0xbfa1('0x23')](function(_0x59ef6b){if(_0x59ef6b){_0x2da59f[_0xbfa1('0x46')]=_[_0xbfa1('0x5b')](db['CannedAnswer'][_0xbfa1('0x43')]);_0x2da59f[_0xbfa1('0x48')]=_[_0xbfa1('0x5b')](_0x9cbe85[_0xbfa1('0x48')]);_0x2da59f['filters']=_[_0xbfa1('0x4a')](_0x2da59f[_0xbfa1('0x46')],_0x2da59f[_0xbfa1('0x48')]);_0x595d47[_0xbfa1('0x4b')]=_['intersection'](_0x2da59f[_0xbfa1('0x46')],qs[_0xbfa1('0x5c')](_0x9cbe85['query'][_0xbfa1('0x5c')]));_0x595d47['attributes']=_0x595d47[_0xbfa1('0x4b')][_0xbfa1('0x5d')]?_0x595d47[_0xbfa1('0x4b')]:_0x2da59f[_0xbfa1('0x46')];if(!_0x9cbe85['query'][_0xbfa1('0x4c')]('nolimit')){_0x595d47[_0xbfa1('0x30')]=qs[_0xbfa1('0x30')](_0x9cbe85[_0xbfa1('0x48')][_0xbfa1('0x30')]);_0x595d47[_0xbfa1('0x2f')]=qs[_0xbfa1('0x2f')](_0x9cbe85['query'][_0xbfa1('0x2f')]);}_0x595d47[_0xbfa1('0x4d')]=qs[_0xbfa1('0x4e')](_0x9cbe85[_0xbfa1('0x48')][_0xbfa1('0x4e')]);_0x595d47[_0xbfa1('0x4f')]=qs[_0xbfa1('0x49')](_[_0xbfa1('0x50')](_0x9cbe85[_0xbfa1('0x48')],_0x2da59f['filters']));_0x595d47[_0xbfa1('0x4f')]['ChatWebsiteId']=_0x59ef6b['id'];if(_0x9cbe85[_0xbfa1('0x48')][_0xbfa1('0x51')]){_0x595d47['where']=_[_0xbfa1('0x54')](_0x595d47['where'],{'$or':_[_0xbfa1('0x47')](_0x595d47['attributes'],function(_0x753baa){var _0x1642c1={};_0x1642c1[_0x753baa]={'$like':'%'+_0x9cbe85['query'][_0xbfa1('0x51')]+'%'};return _0x1642c1;})});}_0x595d47=_['merge']({},_0x595d47,_0x9cbe85[_0xbfa1('0x5e')]);return db['CannedAnswer']['count']({'where':_0x595d47['where']})[_0xbfa1('0x23')](function(_0x28dc08){_0x61cadc['count']=_0x28dc08;if(_0x9cbe85['query']['includeAll']){_0x595d47[_0xbfa1('0x57')]=[{'all':!![]}];}return db[_0xbfa1('0x72')]['findAll'](_0x595d47);})[_0xbfa1('0x23')](function(_0x342b25){_0x61cadc[_0xbfa1('0x59')]=_0x342b25;return _0x61cadc;});}})[_0xbfa1('0x23')](respondWithFilteredResult(_0x5616f2,_0x595d47))[_0xbfa1('0x2d')](handleError(_0x5616f2,null));};exports[_0xbfa1('0x74')]=function(_0x14a7cb,_0x23489d,_0xe2bf72){return db[_0xbfa1('0x55')][_0xbfa1('0x5f')]({'where':{'id':_0x14a7cb[_0xbfa1('0x69')]['id']}})[_0xbfa1('0x23')](handleEntityNotFound(_0x23489d,null))[_0xbfa1('0x23')](function(_0x2e5931){if(_0x2e5931){return _0x2e5931['removeAnswers'](_0x14a7cb[_0xbfa1('0x48')]['ids']);}})['then'](respondWithStatusCode(_0x23489d,null))['catch'](handleError(_0x23489d,null));};exports[_0xbfa1('0x75')]=function(_0x3059ba,_0x304aa2,_0x9fea5d){_0x3059ba[_0xbfa1('0x61')]['sitepic']=_0x3059ba[_0xbfa1('0x76')][_0xbfa1('0x77')];return db[_0xbfa1('0x55')][_0xbfa1('0x5f')]({'where':{'id':_0x3059ba['params']['id']}})['then'](handleEntityNotFound(_0x304aa2,null))['then'](saveUpdates(_0x3059ba[_0xbfa1('0x61')],null))[_0xbfa1('0x23')](respondWithResult(_0x304aa2,null))[_0xbfa1('0x2d')](handleError(_0x304aa2,null));};exports['addAvatar']=function(_0x11336a,_0x415fdb,_0x1b3f12){_0x11336a[_0xbfa1('0x61')][_0xbfa1('0x78')]=_0x11336a['file'][_0xbfa1('0x77')];return db[_0xbfa1('0x55')][_0xbfa1('0x5f')]({'where':{'id':_0x11336a[_0xbfa1('0x69')]['id']}})[_0xbfa1('0x23')](handleEntityNotFound(_0x415fdb,null))[_0xbfa1('0x23')](saveUpdates(_0x11336a[_0xbfa1('0x61')],null))['then'](respondWithResult(_0x415fdb,null))['catch'](handleError(_0x415fdb,null));};exports[_0xbfa1('0x79')]=function(_0x163f7c,_0x3f83ec,_0x2cc377){_0x163f7c[_0xbfa1('0x61')][_0xbfa1('0x7a')]=_0x163f7c[_0xbfa1('0x76')][_0xbfa1('0x77')];return db['ChatWebsite'][_0xbfa1('0x5f')]({'where':{'id':_0x163f7c[_0xbfa1('0x69')]['id']}})[_0xbfa1('0x23')](handleEntityNotFound(_0x3f83ec,null))[_0xbfa1('0x23')](saveUpdates(_0x163f7c[_0xbfa1('0x61')],null))['then'](respondWithResult(_0x3f83ec,null))['catch'](handleError(_0x3f83ec,null));};exports['addSystemAvatar']=function(_0x29b90e,_0x24d6f2,_0x4884a6){_0x29b90e[_0xbfa1('0x61')][_0xbfa1('0x7b')]=_0x29b90e['file']['filename'];return db[_0xbfa1('0x55')]['find']({'where':{'id':_0x29b90e[_0xbfa1('0x69')]['id']}})[_0xbfa1('0x23')](handleEntityNotFound(_0x24d6f2,null))[_0xbfa1('0x23')](saveUpdates(_0x29b90e[_0xbfa1('0x61')],null))[_0xbfa1('0x23')](respondWithResult(_0x24d6f2,null))[_0xbfa1('0x2d')](handleError(_0x24d6f2,null));};exports[_0xbfa1('0x7c')]=function(_0x558870,_0x51dc96,_0x5c1fee){var _0x3c8427=path['join'](config[_0xbfa1('0x7d')],_0xbfa1('0x7e'));var _0x3ff138={'where':{'id':_0x558870[_0xbfa1('0x69')]['id']},'attributes':['id',_0xbfa1('0x7f')],'raw':!![]};var _0x4ffcba=![];return require('../../config/license/util')[_0xbfa1('0x80')]()['then'](function(_0x359134){if(_0x359134){_0x4ffcba=_0x359134['custom'];}})[_0xbfa1('0x23')](function(){return db['ChatWebsite'][_0xbfa1('0x5f')](_0x3ff138);})[_0xbfa1('0x23')](handleEntityNotFound(_0x51dc96,null))['then'](function(_0x47b43c){if(_0x47b43c){if(!_[_0xbfa1('0x81')](_0x47b43c['sitepic'])){if(fs[_0xbfa1('0x82')](path[_0xbfa1('0x83')](config[_0xbfa1('0x7d')],_0xbfa1('0x84'),_0x47b43c[_0xbfa1('0x7f')]))&&_0x4ffcba){_0x3c8427=path['join'](config['root'],'server/files/images/logos/',_0x47b43c[_0xbfa1('0x7f')]);}}return _0x51dc96[_0xbfa1('0x85')](_0x3c8427);}})[_0xbfa1('0x2d')](handleError(_0x51dc96,null));};exports['getAvatar']=function(_0x51c66f,_0x4720a8,_0x2637de){var _0x22380f=path[_0xbfa1('0x83')](config['root'],_0xbfa1('0x86'));var _0x37950f={'where':{'id':_0x51c66f[_0xbfa1('0x69')]['id']},'attributes':['id','agentAvatar'],'raw':!![]};return db[_0xbfa1('0x55')][_0xbfa1('0x5f')](_0x37950f)[_0xbfa1('0x23')](handleEntityNotFound(_0x4720a8,null))['then'](function(_0x2f0bcc){if(_0x2f0bcc){if(!_['isNil'](_0x2f0bcc[_0xbfa1('0x78')])){if(fs[_0xbfa1('0x82')](path[_0xbfa1('0x83')](config[_0xbfa1('0x7d')],_0xbfa1('0x87'),_0x2f0bcc[_0xbfa1('0x78')]))){_0x22380f=path[_0xbfa1('0x83')](config[_0xbfa1('0x7d')],'server/files/images/avatars/',_0x2f0bcc['agentAvatar']);}}return _0x4720a8[_0xbfa1('0x85')](_0x22380f);}})['catch'](handleError(_0x4720a8,null));};exports[_0xbfa1('0x88')]=function(_0x12dbe4,_0x379d8b,_0x13dc71){var _0x419c20=path[_0xbfa1('0x83')](config[_0xbfa1('0x7d')],'server/files/images/avatars/customer_avatar.png');var _0x5ca8ee={'where':{'id':_0x12dbe4[_0xbfa1('0x69')]['id']},'attributes':['id','customerAvatar',_0xbfa1('0x89')],'raw':!![]};return db[_0xbfa1('0x55')][_0xbfa1('0x5f')](_0x5ca8ee)[_0xbfa1('0x23')](handleEntityNotFound(_0x379d8b,null))[_0xbfa1('0x23')](function(_0x17d268){if(_0x17d268){if(!_[_0xbfa1('0x81')](_0x17d268[_0xbfa1('0x7a')])){if(fs[_0xbfa1('0x82')](path[_0xbfa1('0x83')](config[_0xbfa1('0x7d')],'server/files/images/avatars/',_0x17d268[_0xbfa1('0x7a')]))&&_0x17d268[_0xbfa1('0x89')]){_0x419c20=path[_0xbfa1('0x83')](config['root'],_0xbfa1('0x87'),_0x17d268[_0xbfa1('0x7a')]);}}return _0x379d8b[_0xbfa1('0x85')](_0x419c20);}})[_0xbfa1('0x2d')](handleError(_0x379d8b,null));};exports[_0xbfa1('0x8a')]=function(_0x35494e,_0x465ae9,_0x41d81b){var _0x380690=path[_0xbfa1('0x83')](config['root'],_0xbfa1('0x8b'));var _0x77e4ae={'where':{'id':_0x35494e['params']['id']},'attributes':['id',_0xbfa1('0x7b')],'raw':!![]};return db[_0xbfa1('0x55')][_0xbfa1('0x5f')](_0x77e4ae)[_0xbfa1('0x23')](handleEntityNotFound(_0x465ae9,null))[_0xbfa1('0x23')](function(_0x15e425){if(_0x15e425){if(!_[_0xbfa1('0x81')](_0x15e425[_0xbfa1('0x7b')])){if(fs[_0xbfa1('0x82')](path['join'](config['root'],_0xbfa1('0x87'),_0x15e425[_0xbfa1('0x7b')]))){_0x380690=path[_0xbfa1('0x83')](config[_0xbfa1('0x7d')],_0xbfa1('0x87'),_0x15e425[_0xbfa1('0x7b')]);}}return _0x465ae9[_0xbfa1('0x85')](_0x380690);}})[_0xbfa1('0x2d')](handleError(_0x465ae9,null));};exports[_0xbfa1('0x8c')]=function(_0x2c921b,_0x514213,_0x4e6f85){var _0x325747=require(_0xbfa1('0x8d'));var _0x4b6c67=new _0x325747();var _0xa22eff=_0x4b6c67['setUA'](_0x2c921b['headers']['user-agent'])['getResult']();var _0x35f72f={'body':_0x2c921b[_0xbfa1('0x61')],'channel':'chat'};var _0x14bd26=[];var _0x3d0e30=[];var _0x5419c5={};var _0x6df36e=![];return db[_0xbfa1('0x8e')][_0xbfa1('0x67')]()[_0xbfa1('0x23')](function(_0x4733e6){if(!_0x4733e6){throw new db[(_0xbfa1('0x8f'))][(_0xbfa1('0x90'))](_0xbfa1('0x91'));}_0x14bd26=_[_0xbfa1('0x92')](_[_0xbfa1('0x5b')](_0x4733e6),[_0xbfa1('0x93'),_0xbfa1('0x94')]);_0x3d0e30=_[_0xbfa1('0x92')](_['keys'](_0x4733e6),['createdAt','updatedAt',_0xbfa1('0x95'),'ListId']);if(_0x2c921b[_0xbfa1('0x61')]['id']){delete _0x2c921b[_0xbfa1('0x61')]['id'];}if(_[_0xbfa1('0x81')](_0x2c921b[_0xbfa1('0x61')][_0xbfa1('0x96')])){throw new db['Sequelize'][(_0xbfa1('0x90'))](_0xbfa1('0x97'));}if(_[_0xbfa1('0x81')](_0x2c921b[_0xbfa1('0x61')][_0xbfa1('0x61')])||_0x2c921b[_0xbfa1('0x61')][_0xbfa1('0x61')]===''){throw new db['Sequelize'][(_0xbfa1('0x90'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x2c921b[_0xbfa1('0x61')][_0xbfa1('0x98')])){throw new db[(_0xbfa1('0x8f'))][(_0xbfa1('0x90'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x3d0e30);}if(!_[_0xbfa1('0x99')](_0x3d0e30,_0x2c921b[_0xbfa1('0x61')][_0xbfa1('0x98')])){throw new db[(_0xbfa1('0x8f'))][(_0xbfa1('0x90'))](_0xbfa1('0x9a')+_0x3d0e30);}_0x5419c5[_0x2c921b[_0xbfa1('0x61')][_0xbfa1('0x98')]]=_0x2c921b[_0xbfa1('0x61')][_0xbfa1('0x96')];})[_0xbfa1('0x23')](function(){return db[_0xbfa1('0x55')]['find']({'where':{'id':_0x2c921b[_0xbfa1('0x69')]['id']},'include':[{'model':db[_0xbfa1('0x9b')],'as':_0xbfa1('0x9c'),'include':[{'model':db[_0xbfa1('0x8e')],'as':_0xbfa1('0x9d'),'where':_0x5419c5,'limit':0x1,'order':[[_0xbfa1('0x94'),_0xbfa1('0x9e')]]}]},{'model':db[_0xbfa1('0x9f')],'as':_0xbfa1('0xa0')}]});})[_0xbfa1('0x23')](handleEntityNotFound(_0x514213,null))[_0xbfa1('0x23')](function(_0x30a077){if(_0x30a077&&_0x30a077['List']){_0x35f72f[_0xbfa1('0xa1')]=_0x30a077;_0x35f72f[_0xbfa1('0xa2')]=_0x30a077['Applications'];_0x35f72f['list']=_0x30a077[_0xbfa1('0x9c')];_0x35f72f['applications']=_[_0xbfa1('0xa3')](_0x35f72f['applications'],['priority'],[_0xbfa1('0xa4')]);if(_0x35f72f['account'][_0xbfa1('0xa0')]){delete _0x35f72f[_0xbfa1('0xa1')][_0xbfa1('0xa0')];}if(_0x35f72f[_0xbfa1('0xa1')]['List']&&_0x35f72f[_0xbfa1('0xa1')]['List'][_0xbfa1('0x9d')][_0xbfa1('0x5d')]){return _0x35f72f[_0xbfa1('0xa1')][_0xbfa1('0x9c')][_0xbfa1('0x9d')][0x0];}var _0x892f53=_[_0xbfa1('0xa5')](_0x2c921b['body'],{'firstName':_0x2c921b[_0xbfa1('0x61')][_0xbfa1('0x96')],'ListId':_0x30a077[_0xbfa1('0xa6')]});_0x892f53[_0x2c921b[_0xbfa1('0x61')]['mapKey']]=_0x2c921b[_0xbfa1('0x61')][_0xbfa1('0x96')];return db[_0xbfa1('0x8e')][_0xbfa1('0x60')](_0x892f53,{'fields':_0x14bd26,'raw':!![]});}})[_0xbfa1('0x23')](handleEntityNotFound(_0x514213,null))[_0xbfa1('0x23')](function(_0x1d3008){_0x35f72f[_0xbfa1('0xa7')]=_0x1d3008;var _0x1e2db9=_0x2c921b[_0xbfa1('0x61')][_0xbfa1('0xa8')];if(_0x2c921b[_0xbfa1('0xa9')][_0xbfa1('0xaa')]){_0x1e2db9=_0x2c921b[_0xbfa1('0xa9')][_0xbfa1('0xaa')];}else if(_0x2c921b[_0xbfa1('0xa9')][_0xbfa1('0xab')]){_0x1e2db9=_[_0xbfa1('0xac')](_0x2c921b['headers'][_0xbfa1('0xab')][_0xbfa1('0xad')](','));}if(_0x1d3008){var _0x952643={'ContactId':_0x1d3008['id'],'ChatWebsiteId':_0x2c921b[_0xbfa1('0x69')]['id'],'from':(_0x1d3008[_0xbfa1('0xae')]||'')+'\x20'+(_0x1d3008[_0xbfa1('0xaf')]||''),'customerIp':_0x1e2db9,'customerPort':_0x2c921b[_0xbfa1('0xa9')][_0xbfa1('0xb0')]?_0x2c921b[_0xbfa1('0xa9')][_0xbfa1('0xb0')]:null,'referer':_0x2c921b[_0xbfa1('0x61')][_0xbfa1('0xb1')],'browserName':_0xa22eff[_0xbfa1('0xb2')][_0xbfa1('0x3f')]&&_0xa22eff[_0xbfa1('0xb2')][_0xbfa1('0xb3')]?util[_0xbfa1('0xb4')](_0xbfa1('0xb5'),_0xa22eff[_0xbfa1('0xb2')][_0xbfa1('0x3f')],_0xa22eff[_0xbfa1('0xb2')]['version']):_0xbfa1('0xb6'),'browserVersion':_0xa22eff[_0xbfa1('0xb2')][_0xbfa1('0xb3')]||_0xbfa1('0xb6'),'osName':util[_0xbfa1('0xb4')](_0xbfa1('0xb5'),_0xa22eff['os']['name'],_0xa22eff['os']['version']),'osVersion':_0xa22eff['os']['version'],'deviceModel':_0xa22eff[_0xbfa1('0xb7')][_0xbfa1('0x46')]&&_0xa22eff[_0xbfa1('0xb7')][_0xbfa1('0xb8')]?util['format'](_0xbfa1('0xb9'),_0xa22eff[_0xbfa1('0xb7')][_0xbfa1('0x46')],_0xa22eff[_0xbfa1('0xb7')][_0xbfa1('0xb8')],_0xa22eff[_0xbfa1('0xb7')][_0xbfa1('0x52')]):null,'deviceVendor':_0xa22eff['device'][_0xbfa1('0xb8')],'deviceType':_0xa22eff[_0xbfa1('0xb7')][_0xbfa1('0x52')],'formData':JSON['stringify'](_0x2c921b[_0xbfa1('0x61')])};var _0x3b70ad={'ChatWebsiteId':_0x2c921b[_0xbfa1('0x69')]['id'],'closed':![]};if(_0x2c921b[_0xbfa1('0x61')][_0xbfa1('0xba')]){_0x3b70ad[_0xbfa1('0xba')]=_0x2c921b[_0xbfa1('0x61')][_0xbfa1('0xba')];return db[_0xbfa1('0xbb')][_0xbfa1('0x5f')]({'where':_0x3b70ad})[_0xbfa1('0x23')](function(_0x4ab116){if(_0x4ab116){return[_0x4ab116,![]];}_0x952643[_0xbfa1('0xba')]=_0x2c921b['body'][_0xbfa1('0xba')];_0x952643[_0xbfa1('0xbc')]=_0x2c921b[_0xbfa1('0x61')]['externalUrl'];return db[_0xbfa1('0xbb')]['create'](_0x952643)[_0xbfa1('0x23')](function(_0x57c778){return[_0x57c778,!![]];});});}_0x3b70ad['ContactId']=_0x1d3008['id'];if(_0x2c921b['body'][_0xbfa1('0xbd')]&&_0x2c921b[_0xbfa1('0x61')][_0xbfa1('0xbd')]['id']){_0x3b70ad['id']=_0x2c921b[_0xbfa1('0x61')][_0xbfa1('0xbd')]['id'];return db[_0xbfa1('0xbb')][_0xbfa1('0x5f')]({'where':_0x3b70ad})[_0xbfa1('0x23')](function(_0x833de1){if(_0x833de1){return[_0x833de1,![]];}return db['ChatInteraction']['create'](_0x952643)[_0xbfa1('0x23')](function(_0x5a89e1){return[_0x5a89e1,!![]];});});}return db['ChatInteraction'][_0xbfa1('0x60')](_0x952643)[_0xbfa1('0x23')](function(_0x52f4f1){return[_0x52f4f1,!![]];});}})[_0xbfa1('0xbe')](function(_0x978898,_0x22b8dc){if(_0x978898){_0x6df36e=_0x22b8dc;if(!_0x22b8dc){var _0x3d68d0={'from':(_0x35f72f[_0xbfa1('0xa7')][_0xbfa1('0xae')]||'')+'\x20'+(_0x35f72f[_0xbfa1('0xa7')]['lastName']||'')};if(_0x2c921b[_0xbfa1('0x61')][_0xbfa1('0xba')]&&_0x2c921b[_0xbfa1('0x61')]['messageId']&&_0x2c921b[_0xbfa1('0x61')][_0xbfa1('0xba')]!=_0x2c921b[_0xbfa1('0x61')]['messageId']){_0x3d68d0[_0xbfa1('0xba')]=_0x2c921b[_0xbfa1('0x61')][_0xbfa1('0xbf')];}return _0x978898['update'](_0x3d68d0);}else{return _0x978898;}}})['then'](function(_0xea342f){_0x35f72f[_0xbfa1('0xbd')]=_0xea342f['get']({'plain':!![]});_0x35f72f[_0xbfa1('0xbd')][_0xbfa1('0xc0')]=_0x6df36e;if(_0x35f72f[_0xbfa1('0xbd')][_0xbfa1('0xc0')]){if(_0x35f72f[_0xbfa1('0xa1')][_0xbfa1('0xc1')]){_0x35f72f[_0xbfa1('0xa2')][_0xbfa1('0xc2')]({'id':0x0,'priority':_0x35f72f[_0xbfa1('0xa2')]['length']+0x1,'app':_0xbfa1('0xc3'),'appdata':_0xbfa1('0xc4'),'interval':_0xbfa1('0xc5')});}}return db['ChatMessage'][_0xbfa1('0x60')]({'body':_0x2c921b[_0xbfa1('0x61')][_0xbfa1('0x61')],'ChatWebsiteId':_0x2c921b[_0xbfa1('0x69')]['id'],'ChatInteractionId':_0xea342f['id'],'direction':'in','ContactId':_0x35f72f[_0xbfa1('0xa7')]['id'],'AttachmentId':_0x2c921b[_0xbfa1('0x61')]['AttachmentId']});})['then'](function(_0x46bd19){_0x35f72f[_0xbfa1('0x2b')]=_0x46bd19;if(_0x35f72f[_0xbfa1('0xbd')][_0xbfa1('0xc6')]){return db[_0xbfa1('0xc7')][_0xbfa1('0x5f')]({'attributes':['id',_0xbfa1('0x3f')],'where':{'id':_0x35f72f[_0xbfa1('0xbd')][_0xbfa1('0xc6')]}})[_0xbfa1('0x23')](function(_0x3542b2){if(_0x3542b2){_0x35f72f[_0xbfa1('0xa2')][_0xbfa1('0xc8')]({'id':0x0,'priority':0x0,'app':_0xbfa1('0xc9'),'appdata':_0x3542b2['name']+','+(_0x35f72f['account'][_0xbfa1('0xca')]||0xa),'interval':_0xbfa1('0xc5')});_0x35f72f['forcedOwnership']=!![];}return respondWithRpcPromise(_0xbfa1('0xcb'),_0xbfa1('0xcc'),_0x35f72f);});}return respondWithRpcPromise('Start','startRouting',_0x35f72f);})['then'](function(_0x56053e){respondWithRpcPromise('EventManager',_0xbfa1('0xcd'),{'event':_0xbfa1('0x8c'),'message':_0x56053e},client9002);return _0x56053e;})['then'](respondWithResult(_0x514213,null))['catch'](handleError(_0x514213,null));};exports['offline']=function(_0x13c82a,_0x42bc1c,_0x30011b){var _0x18a9e3,_0x405105,_0x33d7f4;var _0x1196bc=[];var _0x1089f2=[];var _0x2380f4={};var _0x5e3495=_0x13c82a[_0xbfa1('0xce')]||[];var _0x5aa6a8=[];var _0xe8c3b2;return db['CmContact'][_0xbfa1('0x67')]()[_0xbfa1('0x23')](function(_0x813fab){if(!_0x813fab){throw new db[(_0xbfa1('0x8f'))][(_0xbfa1('0x90'))](_0xbfa1('0x91'));}_0x1089f2=_[_0xbfa1('0x92')](_[_0xbfa1('0x5b')](_0x813fab),[_0xbfa1('0x93'),_0xbfa1('0x94')]);_0x1196bc=_[_0xbfa1('0x92')](_[_0xbfa1('0x5b')](_0x813fab),[_0xbfa1('0x93'),'updatedAt',_0xbfa1('0x95'),_0xbfa1('0xa6')]);if(_0x13c82a['body']['id']){delete _0x13c82a[_0xbfa1('0x61')]['id'];}if(_['isNil'](_0x13c82a[_0xbfa1('0x61')]['from'])){throw _0x42bc1c[_0xbfa1('0x33')](0x1f4)[_0xbfa1('0x40')](new db['Sequelize'][(_0xbfa1('0x90'))](_0xbfa1('0x97')));}if(_['isNil'](_0x13c82a[_0xbfa1('0x61')][_0xbfa1('0x61')])||_0x13c82a[_0xbfa1('0x61')][_0xbfa1('0x61')]===''){throw _0x42bc1c[_0xbfa1('0x33')](0x1f4)['send'](new db[(_0xbfa1('0x8f'))]['ValidationError'](_0xbfa1('0xcf')));}if(_[_0xbfa1('0x81')](_0x13c82a[_0xbfa1('0x61')]['mapKeyOffline'])){throw _0x42bc1c[_0xbfa1('0x33')](0x1f4)[_0xbfa1('0x40')](new db[(_0xbfa1('0x8f'))][(_0xbfa1('0x90'))](_0xbfa1('0xd0')+_0x1196bc));}if(!_[_0xbfa1('0x99')](_0x1196bc,_0x13c82a[_0xbfa1('0x61')][_0xbfa1('0xd1')])){throw _0x42bc1c['status'](0x1f4)[_0xbfa1('0x40')](new db[(_0xbfa1('0x8f'))][(_0xbfa1('0x90'))](_0xbfa1('0xd2')+_0x1196bc));}_0x2380f4[_0x13c82a[_0xbfa1('0x61')]['mapKeyOffline']]=_0x13c82a[_0xbfa1('0x61')]['from'];})[_0xbfa1('0x23')](function(){return db[_0xbfa1('0x55')][_0xbfa1('0x5f')]({'where':{'id':_0x13c82a['params']['id']},'include':[{'model':db[_0xbfa1('0x9b')],'as':'List'},{'model':db['MailAccount'],'as':_0xbfa1('0xd3')}]});})['then'](handleEntityNotFound(_0x42bc1c,null))[_0xbfa1('0x23')](function(_0x4d0064){if(_0x4d0064&&_0x4d0064[_0xbfa1('0x9c')]){_0x405105=_0x4d0064;var _0x454680=_['defaults'](_0x13c82a['body'],{'firstName':_0x13c82a[_0xbfa1('0x61')][_0xbfa1('0x96')],'phone':_0x13c82a[_0xbfa1('0x61')]['from'],'ListId':_0x4d0064['ListId']});_0x454680[_0x13c82a[_0xbfa1('0x61')][_0xbfa1('0xd1')]]=_0x13c82a[_0xbfa1('0x61')][_0xbfa1('0x96')];return db[_0xbfa1('0x8e')][_0xbfa1('0xd4')]({'where':_0x2380f4,'defaults':_0x454680});}})[_0xbfa1('0xbe')](function(_0x122571){if(_0x122571){_0x33d7f4=_0x122571;var _0x21df66=fs[_0xbfa1('0xd5')](path[_0xbfa1('0x83')](config[_0xbfa1('0x7d')],'server/files/templates/chatOfflineMessage.ejs'),'utf8');var _0x4424e4=ejs[_0xbfa1('0xd6')](_0x21df66,{'body':_['toPairs'](_0x13c82a['body'][_0xbfa1('0x61')]),'bodyTitle':_0x405105[_0xbfa1('0xd7')]});return db[_0xbfa1('0xd8')][_0xbfa1('0x60')]({'body':_0x4424e4,'ContactId':_0x122571['id'],'ChatWebsiteId':_0x405105['id']});}})[_0xbfa1('0x23')](function(_0x583804){_0xe8c3b2=_0x583804;if(_0x5e3495[_0xbfa1('0x5d')]){var _0x5a2b57=_0x5e3495[_0xbfa1('0x47')](function(_0x52ddcb){return{'name':_0x52ddcb['originalname'],'basename':_0x52ddcb[_0xbfa1('0x77')],'type':_0x52ddcb[_0xbfa1('0xd9')],'ChatOfflineMessageId':_0x583804['id']};});_0x5aa6a8=_0x5a2b57[_0xbfa1('0x47')](_0x17347f=>{var _0x339c2e={'filename':_0x17347f[_0xbfa1('0x3f')],'path':path['join'](config[_0xbfa1('0x7d')],_0xbfa1('0xda'),_0xbfa1('0xce'),'attachments',_0xbfa1('0xdb'),_0x17347f['basename'])};return _0x339c2e;});if(!_0x405105[_0xbfa1('0xdc')]){return db[_0xbfa1('0xdd')][_0xbfa1('0xde')](function(_0x4e476d){return db[_0xbfa1('0xdf')][_0xbfa1('0xe0')](_0x5a2b57,{'transaction':_0x4e476d});});}}})[_0xbfa1('0x23')](function(){if(_0xe8c3b2){_0x18a9e3=_0xe8c3b2;return db[_0xbfa1('0xd3')][_0xbfa1('0x6d')]({'where':{'active':!![]},'include':[{'model':db[_0xbfa1('0xe1')],'as':_0xbfa1('0xe2'),'raw':!![]}]});}})[_0xbfa1('0x23')](function(_0x272cb7){if(_0x272cb7&&_0x272cb7[_0xbfa1('0xe2')]&&_0x405105['forwardOffline']&&_0x405105[_0xbfa1('0xe3')]){var _0x62d20c={'tls':{'rejectUnauthorized':![]}};if(_0x272cb7[_0xbfa1('0xe2')][_0xbfa1('0xe4')]){_0x62d20c['service']=_0x272cb7[_0xbfa1('0xe2')][_0xbfa1('0xe4')];}else{_0x62d20c[_0xbfa1('0xe5')]=_0x272cb7['Smtp'][_0xbfa1('0xe5')];_0x62d20c[_0xbfa1('0xe6')]=_0x272cb7[_0xbfa1('0xe2')]['port'];_0x62d20c[_0xbfa1('0xe7')]=_0x272cb7[_0xbfa1('0xe2')][_0xbfa1('0xe7')];}if(_0x272cb7[_0xbfa1('0xe2')][_0xbfa1('0xe8')]){_0x62d20c[_0xbfa1('0xe9')]={'user':_0x272cb7['Smtp'][_0xbfa1('0x63')],'pass':_0x272cb7[_0xbfa1('0xe2')][_0xbfa1('0xea')]};}return respondWithRpcPromise(_0xbfa1('0xeb'),_0xbfa1('0xec'),{'account':_0x62d20c,'message':{'from':util[_0xbfa1('0xb4')](_0xbfa1('0xed'),_0x272cb7[_0xbfa1('0x3f')],_0x272cb7[_0xbfa1('0xee')]||_0x272cb7[_0xbfa1('0xe2')][_0xbfa1('0x63')]),'to':_0x405105[_0xbfa1('0xe3')],'subject':_0x405105[_0xbfa1('0xef')],'html':_0x18a9e3['body'],'attachments':_0x5aa6a8}},client9003)[_0xbfa1('0x23')](function(){return _0x18a9e3;})[_0xbfa1('0x2d')](function(_0x350a3c){console[_0xbfa1('0x29')](_0x350a3c);});}})[_0xbfa1('0x23')](function(){if(_0x405105&&_0x405105[_0xbfa1('0xdc')]&&_0x405105['MailAccountId']){var _0x653c41=[];if(_0x5e3495['length']){_0x653c41=_0x5e3495['map'](function(_0x457185){return{'name':_0x457185[_0xbfa1('0xf0')],'basename':_0x457185[_0xbfa1('0x77')],'type':_0x457185['mimetype'],'ChatOfflineMessageId':_0xe8c3b2['id']};});}var _0x989c6b;if(!_[_0xbfa1('0x81')](_0x405105[_0xbfa1('0xf1')])){var _0x58d637=_[_0xbfa1('0x47')](_0x13c82a['body'],function(_0x5197d0){return _0x5197d0;});var _0x58c4d9=_[_0xbfa1('0xf2')](_0x58d637)[0x0];var _0x2b9acc=_['mapValues'](_0x58c4d9,function(_0x3af21e){return _0x3af21e;});_0x989c6b=_0x2b9acc[0x1][_0x405105[_0xbfa1('0xf1')]];}var _0xbfe18={'from':_0x33d7f4[_0xbfa1('0xee')],'firstName':_0x33d7f4[_0xbfa1('0xae')],'lastName':_0x33d7f4[_0xbfa1('0xaf')],'mapKey':'email','message':{'from':_0x33d7f4['email'],'to':_0x405105['MailAccount'][_0xbfa1('0xee')],'cc':'','subject':_[_0xbfa1('0x81')](_0x989c6b)?_0x405105['offlineMessageSubject']:_0x989c6b,'messageId':'','sentAt':new Date(),'attach':_0x653c41[_0xbfa1('0x5d')],'attachments':_0x653c41,'originChannel':_0xbfa1('0xf3'),'ChatWebsiteId':_0x405105['id'],'ChatOfflineMessageId':_0x18a9e3['id'],'originTo':_0x405105[_0xbfa1('0xd3')][_0xbfa1('0xee')]},'body':_0x18a9e3[_0xbfa1('0x61')]};var _0x4cfc7e={'account':{'id':_0x405105[_0xbfa1('0xf4')]},'body':_0xbfe18,'log':_0xbfa1('0xf5')};return respondWithRpcPromise(_0xbfa1('0xf5'),_0xbfa1('0xf6'),_0x4cfc7e,client9001)[_0xbfa1('0x23')](function(){return _0x18a9e3;})[_0xbfa1('0x2d')](function(_0xb4c102){console[_0xbfa1('0x29')](_0xb4c102);});}return;})['then'](function(){if(_0x18a9e3){return _0x18a9e3;}})[_0xbfa1('0x23')](respondWithResult(_0x42bc1c,null))[_0xbfa1('0x2d')](function(_0x3b3fd8){console[_0xbfa1('0x29')](_0xbfa1('0x2d'),_0x3b3fd8);for(var _0x438f97 of _0x5e3495){var _0xafc825=path['join'](config['root'],_0xbfa1('0xda'),_0xbfa1('0xce'),_0xbfa1('0xf7'),_0xbfa1('0xdb'),_0x438f97[_0xbfa1('0x77')]);fs_extra['remove'](_0xafc825)[_0xbfa1('0x2d')](function(_0x298f97){console[_0xbfa1('0x29')](_0xbfa1('0xf8'),_0xafc825,_0x298f97);});}});};exports[_0xbfa1('0xf9')]=function(_0x279991,_0x104a80,_0x243bdd){return db[_0xbfa1('0xbb')][_0xbfa1('0x5f')]({'where':{'id':_0x279991[_0xbfa1('0x69')]['id']}})[_0xbfa1('0x23')](handleEntityNotFound(_0x104a80,null))['then'](function(_0x4ed2ad){if(_0x4ed2ad){return _0x4ed2ad[_0xbfa1('0xf9')](_0x279991[_0xbfa1('0x61')][_0xbfa1('0x70')],_[_0xbfa1('0xfa')](_0x279991[_0xbfa1('0x61')],[_0xbfa1('0x70'),'id'])||{});}})[_0xbfa1('0x23')](respondWithResult(_0x104a80,null))['catch'](handleError(_0x104a80,null));};exports[_0xbfa1('0xfb')]=function(_0x7d59e1,_0x5e7184,_0x39a6ab){var _0x4ee45c={'raw':![],'where':{}};var _0x5a7e9e={};var _0x36b4bd={'count':0x0,'rows':[]};return db['ChatWebsite']['findOne']({'where':{'id':_0x7d59e1[_0xbfa1('0x69')]['id']}})['then'](handleEntityNotFound(_0x5e7184,null))[_0xbfa1('0x23')](function(_0x4cab93){if(_0x4cab93){_0x5a7e9e[_0xbfa1('0x46')]=_[_0xbfa1('0x5b')](db[_0xbfa1('0xbb')][_0xbfa1('0x43')]);_0x5a7e9e[_0xbfa1('0x48')]=_[_0xbfa1('0x5b')](_0x7d59e1['query']);_0x5a7e9e[_0xbfa1('0x49')]=_['intersection'](_0x5a7e9e['model'],_0x5a7e9e['query']);_0x4ee45c[_0xbfa1('0x4b')]=_['intersection'](_0x5a7e9e[_0xbfa1('0x46')],qs[_0xbfa1('0x5c')](_0x7d59e1['query'][_0xbfa1('0x5c')]));_0x4ee45c[_0xbfa1('0x4b')]=_0x4ee45c[_0xbfa1('0x4b')][_0xbfa1('0x5d')]?_0x4ee45c['attributes']:_0x5a7e9e[_0xbfa1('0x46')];if(!_0x7d59e1[_0xbfa1('0x48')][_0xbfa1('0x4c')](_0xbfa1('0x6e'))){_0x4ee45c[_0xbfa1('0x30')]=qs[_0xbfa1('0x30')](_0x7d59e1[_0xbfa1('0x48')]['limit']);_0x4ee45c[_0xbfa1('0x2f')]=qs['offset'](_0x7d59e1[_0xbfa1('0x48')][_0xbfa1('0x2f')]);}_0x4ee45c[_0xbfa1('0x4d')]=qs[_0xbfa1('0x4e')](_0x7d59e1[_0xbfa1('0x48')][_0xbfa1('0x4e')]);_0x4ee45c['where']=qs['filters'](_[_0xbfa1('0x50')](_0x7d59e1[_0xbfa1('0x48')],_0x5a7e9e[_0xbfa1('0x49')]));_0x4ee45c['where']['ChatWebsiteId']=_0x4cab93['id'];if(_0x7d59e1['query'][_0xbfa1('0x51')]){_0x4ee45c['where']=_[_0xbfa1('0x54')](_0x4ee45c[_0xbfa1('0x4f')],{'$or':_['map'](_0x4ee45c[_0xbfa1('0x4b')],function(_0x35ea44){var _0x240160={};_0x240160[_0x35ea44]={'$like':'%'+_0x7d59e1[_0xbfa1('0x48')]['filter']+'%'};return _0x240160;})});}_0x4ee45c=_[_0xbfa1('0x54')]({},_0x4ee45c,_0x7d59e1[_0xbfa1('0x5e')]);return db[_0xbfa1('0xbb')][_0xbfa1('0x32')]({'where':_0x4ee45c['where']})[_0xbfa1('0x23')](function(_0x54db05){_0x36b4bd[_0xbfa1('0x32')]=_0x54db05;if(_0x7d59e1['query'][_0xbfa1('0x56')]){_0x4ee45c[_0xbfa1('0x57')]=[{'model':db[_0xbfa1('0x8e')],'as':_0xbfa1('0xfc'),'required':![]},{'model':db[_0xbfa1('0xc7')],'as':'Owner','attributes':['name',_0xbfa1('0xfd'),_0xbfa1('0xfe')],'required':![]},{'model':db[_0xbfa1('0xff')],'as':_0xbfa1('0x100'),'attributes':['id',_0xbfa1('0x3f'),_0xbfa1('0x101')],'where':_0x7d59e1[_0xbfa1('0x48')][_0xbfa1('0x102')]?{'id':_0x7d59e1[_0xbfa1('0x48')][_0xbfa1('0x102')]}:undefined,'required':_0x7d59e1[_0xbfa1('0x48')][_0xbfa1('0x102')]?!![]:![]}];}return db['ChatInteraction']['findAll'](_0x4ee45c);})[_0xbfa1('0x23')](function(_0x303302){_0x36b4bd['rows']=_0x303302;return _0x36b4bd;});}})[_0xbfa1('0x23')](respondWithFilteredResult(_0x5e7184,_0x4ee45c))[_0xbfa1('0x2d')](handleError(_0x5e7184,null));};function iftimePromise(_0x5e76e0,_0x1e12e1){return respondWithRpcPromise(_0xbfa1('0x103'),'getSnippet',{'command':_0x1e12e1[_0xbfa1('0x104')]?util[_0xbfa1('0xb4')](_0xbfa1('0x105'),_0x5e76e0[_0xbfa1('0x106')],_0x1e12e1[_0xbfa1('0x104')]):util[_0xbfa1('0xb4')](_0xbfa1('0x107'),_0x5e76e0[_0xbfa1('0x106')])},client9002)[_0xbfa1('0x23')](function(_0x2c7717){var _0x467363=_0x2c7717&&_0x2c7717[_0xbfa1('0x108')](_0xbfa1('0x109'))>=0x0?!![]:![];logger['info']('[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)',_0x1e12e1['id'],_0x5e76e0['id'],_0x5e76e0[_0xbfa1('0x106')],_0x467363?_0xbfa1('0x10a'):_0xbfa1('0x10b'),_0x1e12e1[_0xbfa1('0x104')]?_0x1e12e1[_0xbfa1('0x104')]:_0xbfa1('0x10c'));return _0x467363;})[_0xbfa1('0x2d')](function(_0x60fa96){logger[_0xbfa1('0x29')]('[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)',_0x1e12e1['id'],_0x5e76e0['id'],_0x5e76e0[_0xbfa1('0x106')],util[_0xbfa1('0x10d')](_0x60fa96,{'showHidden':![],'depth':null}),_0x1e12e1[_0xbfa1('0x104')]?_0x1e12e1[_0xbfa1('0x104')]:'No\x20timezone');return![];});}exports[_0xbfa1('0x10e')]=function(_0x2b2724,_0x4858e6,_0xc390c7){var _0x5cee54=0x0;var _0x4057e2=0x0;var _0x163951=![];var _0x56d6d4;var _0x37015e;return db[_0xbfa1('0x55')][_0xbfa1('0x5f')]({'where':{'id':_0x2b2724['params']['id']},'include':[{'model':db[_0xbfa1('0x10f')],'as':'Interval','include':[{'model':db[_0xbfa1('0x10f')],'as':_0xbfa1('0x110'),'attributes':['id',_0xbfa1('0x106')],'raw':!![]}]}]})[_0xbfa1('0x23')](handleEntityNotFound(_0x4858e6,null))[_0xbfa1('0x23')](function(_0x2e38ac){if(_0x2e38ac){_0x56d6d4=_0x2e38ac;return _0x2e38ac['getProactiveActions']({'raw':!![]});}})[_0xbfa1('0x23')](function(_0x1b76fd){if(_0x56d6d4){if(_0x1b76fd){_0x37015e=_0x1b76fd;}}return require(_0xbfa1('0x1d'))[_0xbfa1('0x80')]();})[_0xbfa1('0x23')](function(_0x24eead){if(_0x24eead){_0x4057e2=_0x24eead[_0xbfa1('0x111')];_0x163951=_0x24eead[_0xbfa1('0x112')];}})[_0xbfa1('0x23')](function(){return db[_0xbfa1('0xbb')]['count']({'where':{'closed':![]}});})[_0xbfa1('0x23')](function(_0x11e79e){_0x5cee54=_0x11e79e;if(_0x4057e2&&_0x11e79e>_0x4057e2){return db[_0xbfa1('0x113')][_0xbfa1('0x6d')]({'where':{'id':0x1}})['then'](function(_0x46d69b){if(_0x46d69b){_0x46d69b[_0xbfa1('0x114')]('chatLicenseExceeded');}});}})[_0xbfa1('0x23')](function(){if(_0x56d6d4[_0xbfa1('0x10f')]&&_0x56d6d4[_0xbfa1('0x10f')][_0xbfa1('0x110')]){var _0x466dac=[];for(var _0x17674f=0x0;_0x17674f<_0x56d6d4[_0xbfa1('0x10f')][_0xbfa1('0x110')][_0xbfa1('0x5d')];_0x17674f++){var _0x1d0173=_0x56d6d4[_0xbfa1('0x10f')]['Intervals'][_0x17674f]['get']({'plain':!![]});_0x466dac['push'](iftimePromise(_0x1d0173,_0x56d6d4));}return BPromise[_0xbfa1('0x115')](_0x466dac)[_0xbfa1('0x23')](function(_0xc36cf2){return _[_0xbfa1('0x116')](_0xc36cf2);});}else{return!![];}})['then'](function(_0x39b41e){var _0x4974be=fs[_0xbfa1('0xd5')](path[_0xbfa1('0x83')](config['root'],_0xbfa1('0x117')),'utf8');var _0x1eca27={'remote':_0x56d6d4[_0xbfa1('0x118')],'query':querystring['stringify'](_['merge'](_0x56d6d4[_0xbfa1('0x39')]({'plain':!![]}),{'customerIp':_0x2b2724['headers'][_0xbfa1('0xab')]||_0x2b2724[_0xbfa1('0xa9')][_0xbfa1('0x119')]||_0x2b2724[_0xbfa1('0x11a')][_0xbfa1('0x11b')]||_0x2b2724['ip'],'referer':_0x2b2724[_0xbfa1('0xa9')][_0xbfa1('0xb1')],'openedInteractions':_0x5cee54,'maxInteractions':_0x4057e2,'virtual':_0x163951['virtual'],'online':_0x39b41e,'custom':_0x163951}))['replace'](/'/g,'\x5c\x27')};_0x4858e6[_0xbfa1('0x40')](ejs[_0xbfa1('0xd6')](Mustache[_0xbfa1('0xd6')](_0x4974be,_0x1eca27),{'proactiveActions':_0x37015e,'alignment':_0x56d6d4['alignment'],'verticalAlignment':_0x56d6d4[_0xbfa1('0x11c')],'div_color':_0x56d6d4['color'],'text_color':_0x56d6d4['textColor'],'button_color':_0x56d6d4[_0xbfa1('0x11d')],'background_color':_0x56d6d4[_0xbfa1('0x11e')]}));})[_0xbfa1('0x2d')](handleError(_0x4858e6,null));};exports[_0xbfa1('0x11f')]=function(_0xa6b4e1,_0x72ea9a,_0x469a38){return db[_0xbfa1('0x55')][_0xbfa1('0x6d')]({'where':{'id':_0xa6b4e1[_0xbfa1('0x69')]['id']}})['then'](handleEntityNotFound(_0x72ea9a,null))['then'](function(_0x11efa9){if(_0x11efa9){return db[_0xbfa1('0xdd')][_0xbfa1('0xde')](function(_0x6cc3ff){return db['ChatApplication'][_0xbfa1('0x38')]({'where':{'ChatWebsiteId':_0xa6b4e1['params']['id']},'transaction':_0x6cc3ff})[_0xbfa1('0x23')](function(_0x156a2b){var _0x2e5adf=_['map'](_0xa6b4e1[_0xbfa1('0x61')],function(_0x286429){_0x286429[_0xbfa1('0x6a')]=_0xa6b4e1[_0xbfa1('0x69')]['id'];return _0x286429;});return db['ChatApplication'][_0xbfa1('0xe0')](_0x2e5adf,{'transaction':_0x6cc3ff});});})[_0xbfa1('0x23')](function(){return db[_0xbfa1('0x9f')][_0xbfa1('0x120')]({'where':{'ChatWebsiteId':_0xa6b4e1[_0xbfa1('0x69')]['id']},'order':_0xbfa1('0x121')});});}})[_0xbfa1('0x23')](respondWithResult(_0x72ea9a,null))[_0xbfa1('0x2d')](handleError(_0x72ea9a,null));};exports[_0xbfa1('0x122')]=function(_0x57b837,_0x58dfe6,_0xa64f4f){var _0x46726d={};var _0xd3ab16={};var _0x779dc7;var _0x56a89a;return db[_0xbfa1('0x55')][_0xbfa1('0x6d')]({'where':{'id':_0x57b837['params']['id']}})[_0xbfa1('0x23')](handleEntityNotFound(_0x58dfe6,null))['then'](function(_0x158c16){if(_0x158c16){_0x779dc7=_0x158c16;_0xd3ab16[_0xbfa1('0x46')]=_[_0xbfa1('0x5b')](db['ChatApplication'][_0xbfa1('0x43')]);_0xd3ab16[_0xbfa1('0x48')]=_[_0xbfa1('0x5b')](_0x57b837[_0xbfa1('0x48')]);_0xd3ab16[_0xbfa1('0x49')]=_[_0xbfa1('0x4a')](_0xd3ab16[_0xbfa1('0x46')],_0xd3ab16['query']);_0x46726d[_0xbfa1('0x4b')]=_[_0xbfa1('0x4a')](_0xd3ab16[_0xbfa1('0x46')],qs['fields'](_0x57b837[_0xbfa1('0x48')]['fields']));_0x46726d[_0xbfa1('0x4b')]=_0x46726d[_0xbfa1('0x4b')][_0xbfa1('0x5d')]?_0x46726d[_0xbfa1('0x4b')]:_0xd3ab16['model'];_0x46726d[_0xbfa1('0x4d')]=qs[_0xbfa1('0x4e')](_0x57b837[_0xbfa1('0x48')][_0xbfa1('0x4e')]);_0x46726d[_0xbfa1('0x4f')]=qs[_0xbfa1('0x49')](_[_0xbfa1('0x50')](_0x57b837[_0xbfa1('0x48')],_0xd3ab16['filters']));if(_0x57b837[_0xbfa1('0x48')][_0xbfa1('0x51')]){_0x46726d['where']=_[_0xbfa1('0x54')](_0x46726d[_0xbfa1('0x4f')],{'$or':_[_0xbfa1('0x47')](_0x46726d[_0xbfa1('0x4b')],function(_0x16b06f){var _0x52e6a2={};_0x52e6a2[_0x16b06f]={'$like':'%'+_0x57b837[_0xbfa1('0x48')]['filter']+'%'};return _0x52e6a2;})});}_0x46726d=_[_0xbfa1('0x54')]({},_0x46726d,_0x57b837[_0xbfa1('0x5e')]);return _0x779dc7[_0xbfa1('0x122')](_0x46726d);}})[_0xbfa1('0x23')](function(_0x464422){if(_0x464422){_0x56a89a=_0x464422[_0xbfa1('0x5d')];if(!_0x57b837[_0xbfa1('0x48')][_0xbfa1('0x4c')](_0xbfa1('0x6e'))){_0x46726d[_0xbfa1('0x30')]=qs[_0xbfa1('0x30')](_0x57b837['query'][_0xbfa1('0x30')]);_0x46726d[_0xbfa1('0x2f')]=qs[_0xbfa1('0x2f')](_0x57b837[_0xbfa1('0x48')][_0xbfa1('0x2f')]);}return _0x779dc7[_0xbfa1('0x122')](_0x46726d);}})[_0xbfa1('0x23')](function(_0x551c99){if(_0x551c99){return _0x551c99?{'count':_0x56a89a,'rows':_0x551c99}:null;}})[_0xbfa1('0x23')](respondWithResult(_0x58dfe6,null))['catch'](handleError(_0x58dfe6,null));};exports[_0xbfa1('0x123')]=function(_0x1058b4,_0x3636c2,_0x2db5f5){return db[_0xbfa1('0x124')]['find']({'where':{'id':_0x1058b4[_0xbfa1('0x69')]['id']}})[_0xbfa1('0x23')](handleEntityNotFound(_0x3636c2,null))['then'](function(_0x2afbf3){if(_0x2afbf3){return _0x2afbf3['addProactiveActions'](_0x1058b4['body'][_0xbfa1('0x70')],_[_0xbfa1('0xfa')](_0x1058b4[_0xbfa1('0x61')],[_0xbfa1('0x70'),'id'])||{});}})[_0xbfa1('0x23')](respondWithResult(_0x3636c2,null))[_0xbfa1('0x2d')](handleError(_0x3636c2,null));};exports['getProactiveActions']=function(_0x4a7edb,_0x2ed3d6,_0xee0f21){var _0x1506df={};var _0x37d655={};var _0x581a08;var _0x14b45f;return db[_0xbfa1('0x55')][_0xbfa1('0x6d')]({'where':{'id':_0x4a7edb[_0xbfa1('0x69')]['id']}})[_0xbfa1('0x23')](handleEntityNotFound(_0x2ed3d6,null))[_0xbfa1('0x23')](function(_0x534675){if(_0x534675){_0x581a08=_0x534675;_0x37d655['model']=_[_0xbfa1('0x5b')](db[_0xbfa1('0x125')][_0xbfa1('0x43')]);_0x37d655[_0xbfa1('0x48')]=_[_0xbfa1('0x5b')](_0x4a7edb[_0xbfa1('0x48')]);_0x37d655[_0xbfa1('0x49')]=_[_0xbfa1('0x4a')](_0x37d655[_0xbfa1('0x46')],_0x37d655['query']);_0x1506df[_0xbfa1('0x4b')]=_[_0xbfa1('0x4a')](_0x37d655['model'],qs[_0xbfa1('0x5c')](_0x4a7edb[_0xbfa1('0x48')]['fields']));_0x1506df['attributes']=_0x1506df[_0xbfa1('0x4b')][_0xbfa1('0x5d')]?_0x1506df['attributes']:_0x37d655[_0xbfa1('0x46')];_0x1506df[_0xbfa1('0x4d')]=qs[_0xbfa1('0x4e')](_0x4a7edb['query'][_0xbfa1('0x4e')]);_0x1506df['where']=qs[_0xbfa1('0x49')](_[_0xbfa1('0x50')](_0x4a7edb[_0xbfa1('0x48')],_0x37d655[_0xbfa1('0x49')]));if(_0x4a7edb[_0xbfa1('0x48')][_0xbfa1('0x51')]){_0x1506df[_0xbfa1('0x4f')]=_[_0xbfa1('0x54')](_0x1506df[_0xbfa1('0x4f')],{'$or':_[_0xbfa1('0x47')](_0x1506df['attributes'],function(_0x5c2033){var _0x4457a5={};_0x4457a5[_0x5c2033]={'$like':'%'+_0x4a7edb['query'][_0xbfa1('0x51')]+'%'};return _0x4457a5;})});}_0x1506df=_[_0xbfa1('0x54')]({},_0x1506df,_0x4a7edb[_0xbfa1('0x5e')]);return _0x581a08[_0xbfa1('0x126')](_0x1506df);}})[_0xbfa1('0x23')](function(_0x296834){if(_0x296834){_0x14b45f=_0x296834[_0xbfa1('0x5d')];if(!_0x4a7edb[_0xbfa1('0x48')]['hasOwnProperty'](_0xbfa1('0x6e'))){_0x1506df[_0xbfa1('0x30')]=qs[_0xbfa1('0x30')](_0x4a7edb[_0xbfa1('0x48')][_0xbfa1('0x30')]);_0x1506df['offset']=qs[_0xbfa1('0x2f')](_0x4a7edb[_0xbfa1('0x48')][_0xbfa1('0x2f')]);}return _0x581a08[_0xbfa1('0x126')](_0x1506df);}})[_0xbfa1('0x23')](function(_0x38a872){if(_0x38a872){return _0x38a872?{'count':_0x14b45f,'rows':_0x38a872}:null;}})[_0xbfa1('0x23')](respondWithResult(_0x2ed3d6,null))[_0xbfa1('0x2d')](handleError(_0x2ed3d6,null));};exports[_0xbfa1('0x127')]=function(_0x2a26c6,_0x5e6c70,_0x5f2b64){var _0x4dd2e8=_0x2a26c6[_0xbfa1('0x48')][_0xbfa1('0x128')]==='false'?'offlineForm':_0xbfa1('0x129');return db[_0xbfa1('0x55')]['find']({'attributes':['id',_0x4dd2e8],'where':{'id':_0x2a26c6[_0xbfa1('0x69')]['id']}})[_0xbfa1('0x23')](handleEntityNotFound(_0x5e6c70,null))[_0xbfa1('0x23')](function(_0x57ade5){if(_0x57ade5){var _0x341758=_0x57ade5[_0x4dd2e8];var _0x593eb9=_0x341758&&_0x341758[_0xbfa1('0x12a')]?_0x341758[_0xbfa1('0x12a')]:[];_0x5e6c70[_0xbfa1('0x40')]({'fromKey':_[_0xbfa1('0x81')](_0x341758[_0xbfa1('0x12b')])?undefined:_0x341758[_0xbfa1('0x12b')],'count':_0x593eb9[_0xbfa1('0x5d')],'rows':_0x593eb9});}})['catch'](handleError(_0x5e6c70,null));};exports[_0xbfa1('0x12c')]=function(_0x3ea5ab,_0x4221be,_0xc3583a){var _0x270cde={'raw':![],'where':{}};var _0x43d811={};var _0xee4fc6={'count':0x0,'rows':[]};return db[_0xbfa1('0x55')][_0xbfa1('0x6d')]({'where':{'id':_0x3ea5ab[_0xbfa1('0x69')]['id']}})[_0xbfa1('0x23')](handleEntityNotFound(_0x4221be,null))[_0xbfa1('0x23')](function(_0x51f55d){if(_0x51f55d){_0x43d811[_0xbfa1('0x46')]=_[_0xbfa1('0x5b')](db[_0xbfa1('0xd8')][_0xbfa1('0x43')]);_0x43d811['query']=_[_0xbfa1('0x5b')](_0x3ea5ab[_0xbfa1('0x48')]);_0x43d811[_0xbfa1('0x49')]=_[_0xbfa1('0x4a')](_0x43d811[_0xbfa1('0x46')],_0x43d811[_0xbfa1('0x48')]);_0x270cde[_0xbfa1('0x4b')]=_[_0xbfa1('0x4a')](_0x43d811[_0xbfa1('0x46')],qs['fields'](_0x3ea5ab[_0xbfa1('0x48')][_0xbfa1('0x5c')]));_0x270cde[_0xbfa1('0x4b')]=_0x270cde['attributes']['length']?_0x270cde[_0xbfa1('0x4b')]:_0x43d811[_0xbfa1('0x46')];if(!_0x3ea5ab[_0xbfa1('0x48')]['hasOwnProperty'](_0xbfa1('0x6e'))){_0x270cde[_0xbfa1('0x30')]=qs[_0xbfa1('0x30')](_0x3ea5ab[_0xbfa1('0x48')][_0xbfa1('0x30')]);_0x270cde[_0xbfa1('0x2f')]=qs[_0xbfa1('0x2f')](_0x3ea5ab[_0xbfa1('0x48')][_0xbfa1('0x2f')]);}_0x270cde[_0xbfa1('0x4d')]=qs[_0xbfa1('0x4e')](_0x3ea5ab[_0xbfa1('0x48')][_0xbfa1('0x4e')]);_0x270cde[_0xbfa1('0x4f')]=qs[_0xbfa1('0x49')](_[_0xbfa1('0x50')](_0x3ea5ab[_0xbfa1('0x48')],_0x43d811['filters']));_0x270cde['where'][_0xbfa1('0x6a')]=_0x51f55d['id'];if(_0x3ea5ab[_0xbfa1('0x48')][_0xbfa1('0x51')]){_0x270cde['where']=_['merge'](_0x270cde[_0xbfa1('0x4f')],{'$or':_['map'](_0x270cde['attributes'],function(_0xb38fc){var _0x5f2186={};_0x5f2186[_0xb38fc]={'$like':'%'+_0x3ea5ab['query'][_0xbfa1('0x51')]+'%'};return _0x5f2186;})});}_0x270cde=_['merge']({},_0x270cde,_0x3ea5ab[_0xbfa1('0x5e')]);return db[_0xbfa1('0xd8')]['count']({'where':_0x270cde['where']})['then'](function(_0x228916){_0xee4fc6[_0xbfa1('0x32')]=_0x228916;if(_0x3ea5ab[_0xbfa1('0x48')][_0xbfa1('0x56')]){_0x270cde[_0xbfa1('0x57')]=[{'all':!![]}];}else{_0x270cde[_0xbfa1('0x57')]=[{'model':db[_0xbfa1('0x8e')],'as':'Contact','required':![]},{'model':db['Attachment'],'as':_0xbfa1('0x12d'),'required':![]}];}return db['ChatOfflineMessage'][_0xbfa1('0x58')](_0x270cde);})[_0xbfa1('0x23')](function(_0x337137){_0xee4fc6[_0xbfa1('0x59')]=_0x337137;return _0xee4fc6;});}})['then'](respondWithFilteredResult(_0x4221be,_0x270cde))[_0xbfa1('0x2d')](handleError(_0x4221be,null));};exports[_0xbfa1('0x12e')]=function(_0x213851,_0x54fd01,_0x536146){return db[_0xbfa1('0x55')][_0xbfa1('0x5f')]({'where':{'id':_0x213851['params']['id']}})[_0xbfa1('0x23')](handleEntityNotFound(_0x54fd01,null))[_0xbfa1('0x23')](function(_0x1f50a1){if(_0x1f50a1){return _0x1f50a1['addAgents'](_0x213851[_0xbfa1('0x61')][_0xbfa1('0x70')],_['omit'](_0x213851[_0xbfa1('0x61')],['ids','id'])||{})['spread'](function(_0x3fa795){for(var _0x974be3=0x0;_0x974be3<_0x213851[_0xbfa1('0x61')][_0xbfa1('0x70')]['length'];_0x974be3+=0x1){socket[_0xbfa1('0x12f')](_0xbfa1('0x130'),{'UserId':Number(_0x213851['body']['ids'][_0x974be3]),'ChatWebsiteId':Number(_0x213851['params']['id'])});}return _0x3fa795;});}})[_0xbfa1('0x23')](respondWithResult(_0x54fd01,null))['catch'](handleError(_0x54fd01,null));};exports[_0xbfa1('0x131')]=function(_0x241e52,_0x22d8bf,_0x5b0f70){return db[_0xbfa1('0x55')][_0xbfa1('0x5f')]({'where':{'id':_0x241e52[_0xbfa1('0x69')]['id']}})['then'](handleEntityNotFound(_0x22d8bf,null))[_0xbfa1('0x23')](function(_0x21f1ad){if(_0x21f1ad){return _0x21f1ad[_0xbfa1('0x131')](_0x241e52[_0xbfa1('0x48')][_0xbfa1('0x70')])['then'](function(){if(_[_0xbfa1('0x132')](_0x241e52[_0xbfa1('0x48')][_0xbfa1('0x70')])){for(var _0x51cc81=0x0;_0x51cc81<_0x241e52[_0xbfa1('0x48')]['ids'][_0xbfa1('0x5d')];_0x51cc81+=0x1){socket[_0xbfa1('0x12f')](_0xbfa1('0x133'),{'UserId':Number(_0x241e52[_0xbfa1('0x48')][_0xbfa1('0x70')][_0x51cc81]),'ChatWebsiteId':Number(_0x241e52[_0xbfa1('0x69')]['id'])});}}else{socket['emit'](_0xbfa1('0x133'),{'UserId':Number(_0x241e52['query']['ids']),'ChatWebsiteId':Number(_0x241e52[_0xbfa1('0x69')]['id'])});}});}})['then'](respondWithStatusCode(_0x22d8bf,null))['catch'](handleError(_0x22d8bf,null));};exports[_0xbfa1('0x134')]=function(_0x3eaaf1,_0x3be0cb,_0x47a100){var _0x224778={};var _0x1568dd={};var _0x51b0bb;var _0x57da96;return db[_0xbfa1('0x55')][_0xbfa1('0x6d')]({'where':{'id':_0x3eaaf1[_0xbfa1('0x69')]['id']}})[_0xbfa1('0x23')](handleEntityNotFound(_0x3be0cb,null))[_0xbfa1('0x23')](function(_0x2967b0){if(_0x2967b0){_0x51b0bb=_0x2967b0;_0x1568dd[_0xbfa1('0x46')]=_[_0xbfa1('0x5b')](db[_0xbfa1('0xc7')]['rawAttributes']);_0x1568dd[_0xbfa1('0x48')]=_[_0xbfa1('0x5b')](_0x3eaaf1[_0xbfa1('0x48')]);_0x1568dd[_0xbfa1('0x49')]=_[_0xbfa1('0x4a')](_0x1568dd[_0xbfa1('0x46')],_0x1568dd[_0xbfa1('0x48')]);_0x224778[_0xbfa1('0x4b')]=_[_0xbfa1('0x4a')](_0x1568dd[_0xbfa1('0x46')],qs['fields'](_0x3eaaf1[_0xbfa1('0x48')]['fields']));_0x224778['attributes']=_0x224778[_0xbfa1('0x4b')][_0xbfa1('0x5d')]?_0x224778[_0xbfa1('0x4b')]:_0x1568dd[_0xbfa1('0x46')];_0x224778[_0xbfa1('0x4d')]=qs[_0xbfa1('0x4e')](_0x3eaaf1['query'][_0xbfa1('0x4e')]);_0x224778[_0xbfa1('0x4f')]=qs[_0xbfa1('0x49')](_[_0xbfa1('0x50')](_0x3eaaf1[_0xbfa1('0x48')],_0x1568dd['filters']));if(_0x3eaaf1[_0xbfa1('0x48')][_0xbfa1('0x51')]){_0x224778[_0xbfa1('0x4f')]=_[_0xbfa1('0x54')](_0x224778[_0xbfa1('0x4f')],{'$or':_[_0xbfa1('0x47')](_0x224778[_0xbfa1('0x4b')],function(_0x51b7bf){var _0xe5ddf9={};_0xe5ddf9[_0x51b7bf]={'$like':'%'+_0x3eaaf1['query'][_0xbfa1('0x51')]+'%'};return _0xe5ddf9;})});}_0x224778=_['merge']({},_0x224778,_0x3eaaf1['options']);return _0x51b0bb[_0xbfa1('0x134')](_0x224778);}})['then'](function(_0x19e422){if(_0x19e422){_0x57da96=_0x19e422[_0xbfa1('0x5d')];if(!_0x3eaaf1[_0xbfa1('0x48')][_0xbfa1('0x4c')](_0xbfa1('0x6e'))){_0x224778[_0xbfa1('0x30')]=qs[_0xbfa1('0x30')](_0x3eaaf1['query']['limit']);_0x224778[_0xbfa1('0x2f')]=qs['offset'](_0x3eaaf1[_0xbfa1('0x48')][_0xbfa1('0x2f')]);}return _0x51b0bb['getAgents'](_0x224778);}})[_0xbfa1('0x23')](function(_0x3b5da5){if(_0x3b5da5){return _0x3b5da5?{'count':_0x57da96,'rows':_0x3b5da5}:null;}})['then'](respondWithResult(_0x3be0cb,null))[_0xbfa1('0x2d')](handleError(_0x3be0cb,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index a90428c..ff70d15 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 _0xc7b4=['ChatWebsite','setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x326863,_0x48bc96){var _0x3cc1e9=function(_0x54cd54){while(--_0x54cd54){_0x326863['push'](_0x326863['shift']());}};_0x3cc1e9(++_0x48bc96);}(_0xc7b4,0x15e));var _0x4c7b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc7b4[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0x4c7b('0x0'));var ChatWebsite=require('../../mysqldb')['db'][_0x4c7b('0x1')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0x4c7b('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x4c7b('0x3'),'afterDestroy':_0x4c7b('0x4')};function emitEvent(_0x279c21){return function(_0x2a8b1d,_0x109687,_0x5a20ca){ChatWebsiteEvents[_0x4c7b('0x5')](_0x279c21+':'+_0x2a8b1d['id'],_0x2a8b1d);ChatWebsiteEvents[_0x4c7b('0x5')](_0x279c21,_0x2a8b1d);_0x5a20ca(null);};}for(var e in events){if(events[_0x4c7b('0x6')](e)){var event=events[e];ChatWebsite[_0x4c7b('0x7')](e,emitEvent(event));}}module[_0x4c7b('0x8')]=ChatWebsiteEvents; \ No newline at end of file +var _0x3c7b=['setMaxListeners','save','emit','hook','exports','events','../../mysqldb','ChatWebsite'];(function(_0x131f95,_0x52919a){var _0x405fd2=function(_0x2dd12d){while(--_0x2dd12d){_0x131f95['push'](_0x131f95['shift']());}};_0x405fd2(++_0x52919a);}(_0x3c7b,0x11d));var _0xb3c7=function(_0x14d079,_0x4b6d7b){_0x14d079=_0x14d079-0x0;var _0x74dcd=_0x3c7b[_0x14d079];return _0x74dcd;};'use strict';var EventEmitter=require(_0xb3c7('0x0'));var ChatWebsite=require(_0xb3c7('0x1'))['db'][_0xb3c7('0x2')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0xb3c7('0x3')](0x0);var events={'afterCreate':_0xb3c7('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x500bea){return function(_0x5b34ef,_0x234fe5,_0x44c399){ChatWebsiteEvents['emit'](_0x500bea+':'+_0x5b34ef['id'],_0x5b34ef);ChatWebsiteEvents[_0xb3c7('0x5')](_0x500bea,_0x5b34ef);_0x44c399(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatWebsite[_0xb3c7('0x6')](e,emitEvent(event));}}module[_0xb3c7('0x7')]=ChatWebsiteEvents; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.model.js b/server/api/chatWebsite/chatWebsite.model.js index afa2562..1ab5f6d 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 _0x7a92=['chat_websites','util','../../config/logger','moment','bluebird','rimraf','../../config/environment','./chatWebsite.attributes','exports','define','ChatWebsite'];(function(_0x2f62a5,_0x43985d){var _0x32f3a7=function(_0x487d0b){while(--_0x487d0b){_0x2f62a5['push'](_0x2f62a5['shift']());}};_0x32f3a7(++_0x43985d);}(_0x7a92,0x1e5));var _0x27a9=function(_0x3149da,_0x49d0a3){_0x3149da=_0x3149da-0x0;var _0x180dc3=_0x7a92[_0x3149da];return _0x180dc3;};'use strict';var _=require('lodash');var util=require(_0x27a9('0x0'));var logger=require(_0x27a9('0x1'))('api');var moment=require(_0x27a9('0x2'));var BPromise=require(_0x27a9('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x27a9('0x4'));var config=require(_0x27a9('0x5'));var attributes=require(_0x27a9('0x6'));module[_0x27a9('0x7')]=function(_0x1845c4,_0x2083ef){return _0x1845c4[_0x27a9('0x8')](_0x27a9('0x9'),attributes,{'tableName':_0x27a9('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x651a=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatWebsite.attributes','exports','define','ChatWebsite','chat_websites'];(function(_0x31930f,_0x4f5869){var _0x3fab66=function(_0x3644b2){while(--_0x3644b2){_0x31930f['push'](_0x31930f['shift']());}};_0x3fab66(++_0x4f5869);}(_0x651a,0xf0));var _0xa651=function(_0x18f82b,_0x3ea7a0){_0x18f82b=_0x18f82b-0x0;var _0x5d8128=_0x651a[_0x18f82b];return _0x5d8128;};'use strict';var _=require(_0xa651('0x0'));var util=require(_0xa651('0x1'));var logger=require(_0xa651('0x2'))(_0xa651('0x3'));var moment=require(_0xa651('0x4'));var BPromise=require(_0xa651('0x5'));var rp=require(_0xa651('0x6'));var fs=require('fs');var path=require(_0xa651('0x7'));var rimraf=require(_0xa651('0x8'));var config=require(_0xa651('0x9'));var attributes=require(_0xa651('0xa'));module[_0xa651('0xb')]=function(_0x4242d6,_0x8ae13){return _0x4242d6[_0xa651('0xc')](_0xa651('0xd'),attributes,{'tableName':_0xa651('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.rpc.js b/server/api/chatWebsite/chatWebsite.rpc.js index b5d997b..b831990 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 _0x1017=['request','then','info','ChatWebsite,\x20%s,\x20%s','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','bluebird','../../mysqldb','../../config/utils','rpc','http','redis','defaults','localhost','./chatWebsite.socket'];(function(_0x384a44,_0xdc4c20){var _0x314396=function(_0x5dba0c){while(--_0x5dba0c){_0x384a44['push'](_0x384a44['shift']());}};_0x314396(++_0xdc4c20);}(_0x1017,0x1d8));var _0x7101=function(_0x74069a,_0x4f93ee){_0x74069a=_0x74069a-0x0;var _0x2bdc85=_0x1017[_0x74069a];return _0x2bdc85;};'use strict';var _=require(_0x7101('0x0'));var util=require(_0x7101('0x1'));var moment=require('moment');var BPromise=require(_0x7101('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7101('0x3'))['db'];var utils=require(_0x7101('0x4'));var logger=require('../../config/logger')(_0x7101('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x7101('0x6')]({'port':0x232a});config[_0x7101('0x7')]=_[_0x7101('0x8')](config[_0x7101('0x7')],{'host':_0x7101('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x7101('0xa'))['register'](socket);function respondWithRpcPromise(_0x29abf7,_0x5b3d55,_0x296a9d){return new BPromise(function(_0x486c9e,_0x569952){return client[_0x7101('0xb')](_0x29abf7,_0x296a9d)[_0x7101('0xc')](function(_0xa90941){logger[_0x7101('0xd')](_0x7101('0xe'),_0x5b3d55,'request\x20sent');logger[_0x7101('0xf')](_0x7101('0x10'),_0x5b3d55,_0x7101('0x11'),JSON[_0x7101('0x12')](_0xa90941));if(_0xa90941[_0x7101('0x13')]){if(_0xa90941[_0x7101('0x13')][_0x7101('0x14')]===0x1f4){logger[_0x7101('0x13')](_0x7101('0xe'),_0x5b3d55,_0xa90941[_0x7101('0x13')][_0x7101('0x15')]);return _0x569952(_0xa90941[_0x7101('0x13')][_0x7101('0x15')]);}logger[_0x7101('0x13')](_0x7101('0xe'),_0x5b3d55,_0xa90941['error']['message']);return _0x486c9e(_0xa90941[_0x7101('0x13')][_0x7101('0x15')]);}else{logger[_0x7101('0xd')](_0x7101('0xe'),_0x5b3d55,_0x7101('0x11'));_0x486c9e(_0xa90941['result'][_0x7101('0x15')]);}})[_0x7101('0x16')](function(_0xd5be9b){logger[_0x7101('0x13')](_0x7101('0xe'),_0x5b3d55,_0xd5be9b);_0x569952(_0xd5be9b);});});} \ No newline at end of file +var _0xdaab=['../../config/utils','../../config/logger','rpc','http','redis','localhost','register','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','bluebird','randomstring','ioredis'];(function(_0x30bda8,_0x2a47f4){var _0x187982=function(_0x3c5959){while(--_0x3c5959){_0x30bda8['push'](_0x30bda8['shift']());}};_0x187982(++_0x2a47f4);}(_0xdaab,0xe3));var _0xbdaa=function(_0x230747,_0x26a388){_0x230747=_0x230747-0x0;var _0xfe319b=_0xdaab[_0x230747];return _0xfe319b;};'use strict';var _=require(_0xbdaa('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xbdaa('0x1'));var rs=require(_0xbdaa('0x2'));var fs=require('fs');var Redis=require(_0xbdaa('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xbdaa('0x4'));var logger=require(_0xbdaa('0x5'))(_0xbdaa('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xbdaa('0x7')]({'port':0x232a});config['redis']=_['defaults'](config[_0xbdaa('0x8')],{'host':_0xbdaa('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xbdaa('0x8')]));require('./chatWebsite.socket')[_0xbdaa('0xa')](socket);function respondWithRpcPromise(_0x3cc253,_0x5940bb,_0xbe71bc){return new BPromise(function(_0x3683be,_0x544a40){return client['request'](_0x3cc253,_0xbe71bc)[_0xbdaa('0xb')](function(_0x57a65e){logger[_0xbdaa('0xc')](_0xbdaa('0xd'),_0x5940bb,_0xbdaa('0xe'));logger[_0xbdaa('0xf')](_0xbdaa('0x10'),_0x5940bb,_0xbdaa('0xe'),JSON[_0xbdaa('0x11')](_0x57a65e));if(_0x57a65e['error']){if(_0x57a65e[_0xbdaa('0x12')][_0xbdaa('0x13')]===0x1f4){logger['error'](_0xbdaa('0xd'),_0x5940bb,_0x57a65e['error'][_0xbdaa('0x14')]);return _0x544a40(_0x57a65e['error'][_0xbdaa('0x14')]);}logger[_0xbdaa('0x12')](_0xbdaa('0xd'),_0x5940bb,_0x57a65e['error']['message']);return _0x3683be(_0x57a65e[_0xbdaa('0x12')]['message']);}else{logger['info'](_0xbdaa('0xd'),_0x5940bb,_0xbdaa('0xe'));_0x3683be(_0x57a65e['result']['message']);}})['catch'](function(_0x2fd096){logger[_0xbdaa('0x12')]('ChatWebsite,\x20%s,\x20%s',_0x5940bb,_0x2fd096);_0x544a40(_0x2fd096);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index 063aea5..f890c3d 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 _0xaddb=['length','chatWebsite:','save','update','emit','removeListener','register'];(function(_0x102e37,_0x14a181){var _0x35a07c=function(_0x16577f){while(--_0x16577f){_0x102e37['push'](_0x102e37['shift']());}};_0x35a07c(++_0x14a181);}(_0xaddb,0xc6));var _0xbadd=function(_0x3820b5,_0x504325){_0x3820b5=_0x3820b5-0x0;var _0xb749d2=_0xaddb[_0x3820b5];return _0xb749d2;};'use strict';var ChatWebsiteEvents=require('./chatWebsite.events');var events=[_0xbadd('0x0'),'remove',_0xbadd('0x1')];function createListener(_0x250cd4,_0x34b7f2){return function(_0x6092b6){_0x34b7f2[_0xbadd('0x2')](_0x250cd4,_0x6092b6);};}function removeListener(_0x2edee6,_0x98f5d5){return function(){ChatWebsiteEvents[_0xbadd('0x3')](_0x2edee6,_0x98f5d5);};}exports[_0xbadd('0x4')]=function(_0x2a8b4d){for(var _0x1d26a0=0x0,_0xe1eb9f=events[_0xbadd('0x5')];_0x1d26a0<_0xe1eb9f;_0x1d26a0++){var _0x14fcbf=events[_0x1d26a0];var _0x27f06a=createListener(_0xbadd('0x6')+_0x14fcbf,_0x2a8b4d);ChatWebsiteEvents['on'](_0x14fcbf,_0x27f06a);}}; \ No newline at end of file +var _0xaed8=['remove','update','emit','removeListener','length','chatWebsite:','save'];(function(_0x16f39a,_0x233f55){var _0xd6a5da=function(_0x179a80){while(--_0x179a80){_0x16f39a['push'](_0x16f39a['shift']());}};_0xd6a5da(++_0x233f55);}(_0xaed8,0x102));var _0x8aed=function(_0x4d82ea,_0x4d459f){_0x4d82ea=_0x4d82ea-0x0;var _0x257f4a=_0xaed8[_0x4d82ea];return _0x257f4a;};'use strict';var ChatWebsiteEvents=require('./chatWebsite.events');var events=[_0x8aed('0x0'),_0x8aed('0x1'),_0x8aed('0x2')];function createListener(_0x3f2364,_0x5924a5){return function(_0x2a6bdd){_0x5924a5[_0x8aed('0x3')](_0x3f2364,_0x2a6bdd);};}function removeListener(_0x9bddfe,_0x146906){return function(){ChatWebsiteEvents[_0x8aed('0x4')](_0x9bddfe,_0x146906);};}exports['register']=function(_0x5c6b9d){for(var _0x2a5084=0x0,_0x5dce12=events[_0x8aed('0x5')];_0x2a5084<_0x5dce12;_0x2a5084++){var _0x1c2ff2=events[_0x2a5084];var _0x28cba8=createListener(_0x8aed('0x6')+_0x1c2ff2,_0x5c6b9d);ChatWebsiteEvents['on'](_0x1c2ff2,_0x28cba8);}}; \ No newline at end of file diff --git a/server/api/chatWebsite/index.js b/server/api/chatWebsite/index.js index b4f7245..933c060 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 _0xb071=['getInteractions','getSnippet','/:id/applications','getApplications','/:id/proactive_actions','getProactiveActions','getFields','getOfflineMessages','/:id/users','getAgents','post','create','addDisposition','join','root','format','%s-%s','now','originalname','single','file','addLogo','diskStorage','addAvatar','server/files/images/avatars/','addCustomerAvatar','addSystemAvatar','server/files','offline-chat','ensureDir','replace','extname','/:id/offline','offline','addInteraction','addProactiveActions','addAgents','put','update','delete','removeDispositions','removeAnswers','removeAgents','multer','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','./chatWebsite.controller','isAuthenticated','index','get','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/logo','getLogo','getAvatar','/:id/customer_avatar','getCustomerAvatar','/:id/system_avatar','getSystemAvatar','/:id/interactions'];(function(_0x53df25,_0x2a7f81){var _0x434a1b=function(_0x398750){while(--_0x398750){_0x53df25['push'](_0x53df25['shift']());}};_0x434a1b(++_0x2a7f81);}(_0xb071,0xb9));var _0x1b07=function(_0x2881e2,_0x341293){_0x2881e2=_0x2881e2-0x0;var _0x5c1e1f=_0xb071[_0x2881e2];return _0x5c1e1f;};'use strict';var multer=require(_0x1b07('0x0'));var util=require(_0x1b07('0x1'));var path=require(_0x1b07('0x2'));var timeout=require(_0x1b07('0x3'));var express=require(_0x1b07('0x4'));var router=express[_0x1b07('0x5')]();var fs_extra=require(_0x1b07('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x1b07('0x7'));var controller=require(_0x1b07('0x8'));router['get']('/',auth[_0x1b07('0x9')](),controller[_0x1b07('0xa')]);router[_0x1b07('0xb')](_0x1b07('0xc'),auth[_0x1b07('0x9')](),controller[_0x1b07('0xd')]);router[_0x1b07('0xb')](_0x1b07('0xe'),auth[_0x1b07('0x9')](),controller[_0x1b07('0xf')]);router[_0x1b07('0xb')](_0x1b07('0x10'),auth[_0x1b07('0x9')](),controller[_0x1b07('0x11')]);router[_0x1b07('0xb')](_0x1b07('0x12'),auth[_0x1b07('0x9')](),controller[_0x1b07('0x13')]);router[_0x1b07('0xb')](_0x1b07('0x14'),controller[_0x1b07('0x15')]);router[_0x1b07('0xb')]('/:id/avatar',controller[_0x1b07('0x16')]);router[_0x1b07('0xb')](_0x1b07('0x17'),controller[_0x1b07('0x18')]);router[_0x1b07('0xb')](_0x1b07('0x19'),controller[_0x1b07('0x1a')]);router[_0x1b07('0xb')](_0x1b07('0x1b'),auth[_0x1b07('0x9')](),controller[_0x1b07('0x1c')]);router['get']('/:id/snippet',controller[_0x1b07('0x1d')]);router[_0x1b07('0xb')](_0x1b07('0x1e'),auth['isAuthenticated'](),controller[_0x1b07('0x1f')]);router['get'](_0x1b07('0x20'),auth[_0x1b07('0x9')](),controller[_0x1b07('0x21')]);router[_0x1b07('0xb')]('/:id/fields',controller[_0x1b07('0x22')]);router[_0x1b07('0xb')]('/:id/offline_messages',auth[_0x1b07('0x9')](),controller[_0x1b07('0x23')]);router[_0x1b07('0xb')](_0x1b07('0x24'),auth[_0x1b07('0x9')](),controller[_0x1b07('0x25')]);router[_0x1b07('0x26')]('/',auth[_0x1b07('0x9')](),controller[_0x1b07('0x27')]);router['post'](_0x1b07('0x10'),auth[_0x1b07('0x9')](),controller[_0x1b07('0x28')]);router[_0x1b07('0x26')](_0x1b07('0x12'),auth[_0x1b07('0x9')](),controller['addAnswer']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x7d0d04,_0x11915b,_0x2e61d5){_0x2e61d5(null,path[_0x1b07('0x29')](config[_0x1b07('0x2a')],'server/files/images/logos/'));},'filename':function(_0x422715,_0x28da9e,_0xf87018){_0xf87018(null,util[_0x1b07('0x2b')](_0x1b07('0x2c'),Date[_0x1b07('0x2d')](),_0x28da9e[_0x1b07('0x2e')]));}})});router[_0x1b07('0x26')](_0x1b07('0x14'),upload[_0x1b07('0x2f')](_0x1b07('0x30')),controller[_0x1b07('0x31')]);var upload=multer({'storage':multer[_0x1b07('0x32')]({'destination':function(_0x4dff8a,_0x4dbc33,_0x1f5e62){_0x1f5e62(null,path[_0x1b07('0x29')](config['root'],'server/files/images/avatars/'));},'filename':function(_0x5cc4f1,_0x121ae1,_0xceb55a){_0xceb55a(null,util[_0x1b07('0x2b')](_0x1b07('0x2c'),Date['now'](),_0x121ae1['originalname']));}})});router[_0x1b07('0x26')]('/:id/avatar',upload[_0x1b07('0x2f')](_0x1b07('0x30')),controller[_0x1b07('0x33')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3c461c,_0x101fd1,_0x89254f){_0x89254f(null,path[_0x1b07('0x29')](config[_0x1b07('0x2a')],_0x1b07('0x34')));},'filename':function(_0x1319ef,_0x123d6b,_0x4a9510){_0x4a9510(null,util[_0x1b07('0x2b')](_0x1b07('0x2c'),Date[_0x1b07('0x2d')](),_0x123d6b[_0x1b07('0x2e')]));}})});router['post'](_0x1b07('0x17'),upload[_0x1b07('0x2f')](_0x1b07('0x30')),controller[_0x1b07('0x35')]);var upload=multer({'storage':multer[_0x1b07('0x32')]({'destination':function(_0x26ea11,_0xe47d4d,_0x102a0){_0x102a0(null,path[_0x1b07('0x29')](config[_0x1b07('0x2a')],_0x1b07('0x34')));},'filename':function(_0x19bc0d,_0x314c71,_0x124614){_0x124614(null,util[_0x1b07('0x2b')](_0x1b07('0x2c'),Date[_0x1b07('0x2d')](),_0x314c71['originalname']));}})});router[_0x1b07('0x26')](_0x1b07('0x19'),upload['single'](_0x1b07('0x30')),controller[_0x1b07('0x36')]);router[_0x1b07('0x26')]('/:id/notify',controller['notify']);const offlineUploadMulter=multer({'storage':multer['diskStorage']({'destination':function(_0x40c83f,_0xed8481,_0x50507d){const _0x5cde78=path[_0x1b07('0x29')](config[_0x1b07('0x2a')],_0x1b07('0x37'),'attachments',_0x1b07('0x38'));fs_extra[_0x1b07('0x39')](_0x5cde78,function(){_0x50507d(null,_0x5cde78);});},'filename':function(_0x3e8fa3,_0x13ee3b,_0x47efd1){const _0x26d7c3=_0x13ee3b[_0x1b07('0x2e')][_0x1b07('0x3a')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x307560=path[_0x1b07('0x3b')](_0x26d7c3);const _0x560697=Date[_0x1b07('0x2d')]()+'-'+_0x26d7c3[_0x1b07('0x3a')](_0x307560,'')+_0x307560;_0x47efd1(null,_0x560697);}})});router[_0x1b07('0x26')](_0x1b07('0x3c'),offlineUploadMulter['any'](),controller[_0x1b07('0x3d')]);router[_0x1b07('0x26')]('/:id/interactions',auth[_0x1b07('0x9')](),controller[_0x1b07('0x3e')]);router[_0x1b07('0x26')](_0x1b07('0x1e'),auth[_0x1b07('0x9')](),controller['addApplications']);router[_0x1b07('0x26')](_0x1b07('0x20'),auth[_0x1b07('0x9')](),controller[_0x1b07('0x3f')]);router[_0x1b07('0x26')]('/:id/users',auth[_0x1b07('0x9')](),controller[_0x1b07('0x40')]);router[_0x1b07('0x41')](_0x1b07('0xe'),auth[_0x1b07('0x9')](),controller[_0x1b07('0x42')]);router[_0x1b07('0x43')]('/:id',auth[_0x1b07('0x9')](),controller['destroy']);router[_0x1b07('0x43')](_0x1b07('0x10'),auth[_0x1b07('0x9')](),controller[_0x1b07('0x44')]);router[_0x1b07('0x43')](_0x1b07('0x12'),auth[_0x1b07('0x9')](),controller[_0x1b07('0x45')]);router[_0x1b07('0x43')](_0x1b07('0x24'),auth['isAuthenticated'](),controller[_0x1b07('0x46')]);module['exports']=router; \ No newline at end of file +var _0x7212=['/:id/applications','getApplications','/:id/proactive_actions','/:id/fields','getFields','getOfflineMessages','/:id/users','getAgents','create','post','/:id/dispositions','diskStorage','root','server/files/images/logos/','%s-%s','now','originalname','single','file','addLogo','join','server/files/images/avatars/','format','/:id/avatar','addAvatar','/:id/notify','attachments','offline-chat','replace','any','/:id/interactions','addInteraction','addApplications','addProactiveActions','addAgents','put','/:id','update','delete','removeDispositions','removeAgents','exports','multer','express','../../components/interaction/service','get','isAuthenticated','index','/describe','describe','show','getDispositions','/:id/canned_answers','getAnswers','/:id/logo','getLogo','getAvatar','/:id/customer_avatar','getCustomerAvatar','/:id/system_avatar','getInteractions','/:id/snippet','getSnippet'];(function(_0x57904d,_0x58e82f){var _0x105cfc=function(_0x44ba55){while(--_0x44ba55){_0x57904d['push'](_0x57904d['shift']());}};_0x105cfc(++_0x58e82f);}(_0x7212,0x1e3));var _0x2721=function(_0x4f0ee5,_0x4aaec5){_0x4f0ee5=_0x4f0ee5-0x0;var _0x1661dc=_0x7212[_0x4f0ee5];return _0x1661dc;};'use strict';var multer=require(_0x2721('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x2721('0x1'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x2721('0x2'));var config=require('../../config/environment');var controller=require('./chatWebsite.controller');router[_0x2721('0x3')]('/',auth[_0x2721('0x4')](),controller[_0x2721('0x5')]);router['get'](_0x2721('0x6'),auth[_0x2721('0x4')](),controller[_0x2721('0x7')]);router[_0x2721('0x3')]('/:id',auth['isAuthenticated'](),controller[_0x2721('0x8')]);router['get']('/:id/dispositions',auth['isAuthenticated'](),controller[_0x2721('0x9')]);router['get'](_0x2721('0xa'),auth[_0x2721('0x4')](),controller[_0x2721('0xb')]);router[_0x2721('0x3')](_0x2721('0xc'),controller[_0x2721('0xd')]);router['get']('/:id/avatar',controller[_0x2721('0xe')]);router[_0x2721('0x3')](_0x2721('0xf'),controller[_0x2721('0x10')]);router[_0x2721('0x3')](_0x2721('0x11'),controller['getSystemAvatar']);router[_0x2721('0x3')]('/:id/interactions',auth[_0x2721('0x4')](),controller[_0x2721('0x12')]);router[_0x2721('0x3')](_0x2721('0x13'),controller[_0x2721('0x14')]);router[_0x2721('0x3')](_0x2721('0x15'),auth[_0x2721('0x4')](),controller[_0x2721('0x16')]);router[_0x2721('0x3')](_0x2721('0x17'),auth[_0x2721('0x4')](),controller['getProactiveActions']);router[_0x2721('0x3')](_0x2721('0x18'),controller[_0x2721('0x19')]);router[_0x2721('0x3')]('/:id/offline_messages',auth[_0x2721('0x4')](),controller[_0x2721('0x1a')]);router[_0x2721('0x3')](_0x2721('0x1b'),auth['isAuthenticated'](),controller[_0x2721('0x1c')]);router['post']('/',auth[_0x2721('0x4')](),controller[_0x2721('0x1d')]);router[_0x2721('0x1e')](_0x2721('0x1f'),auth['isAuthenticated'](),controller['addDisposition']);router[_0x2721('0x1e')](_0x2721('0xa'),auth[_0x2721('0x4')](),controller['addAnswer']);var upload=multer({'storage':multer[_0x2721('0x20')]({'destination':function(_0x13c101,_0xa2c46d,_0x5e4324){_0x5e4324(null,path['join'](config[_0x2721('0x21')],_0x2721('0x22')));},'filename':function(_0x49dfd9,_0xef2b48,_0x3e7028){_0x3e7028(null,util['format'](_0x2721('0x23'),Date[_0x2721('0x24')](),_0xef2b48[_0x2721('0x25')]));}})});router[_0x2721('0x1e')](_0x2721('0xc'),upload[_0x2721('0x26')](_0x2721('0x27')),controller[_0x2721('0x28')]);var upload=multer({'storage':multer[_0x2721('0x20')]({'destination':function(_0x2ae791,_0x3f56a9,_0x49437c){_0x49437c(null,path[_0x2721('0x29')](config['root'],_0x2721('0x2a')));},'filename':function(_0x33b1ba,_0x1c5e49,_0x1da0cd){_0x1da0cd(null,util[_0x2721('0x2b')]('%s-%s',Date[_0x2721('0x24')](),_0x1c5e49[_0x2721('0x25')]));}})});router[_0x2721('0x1e')](_0x2721('0x2c'),upload[_0x2721('0x26')](_0x2721('0x27')),controller[_0x2721('0x2d')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x2cfe3c,_0x5ad530,_0x27cb59){_0x27cb59(null,path[_0x2721('0x29')](config[_0x2721('0x21')],_0x2721('0x2a')));},'filename':function(_0x581332,_0x442b93,_0xeae5d4){_0xeae5d4(null,util[_0x2721('0x2b')](_0x2721('0x23'),Date[_0x2721('0x24')](),_0x442b93[_0x2721('0x25')]));}})});router[_0x2721('0x1e')](_0x2721('0xf'),upload['single']('file'),controller['addCustomerAvatar']);var upload=multer({'storage':multer[_0x2721('0x20')]({'destination':function(_0x3d1f61,_0x9204a7,_0x17214b){_0x17214b(null,path[_0x2721('0x29')](config['root'],_0x2721('0x2a')));},'filename':function(_0x1826ad,_0x25aee9,_0x204831){_0x204831(null,util[_0x2721('0x2b')]('%s-%s',Date[_0x2721('0x24')](),_0x25aee9[_0x2721('0x25')]));}})});router['post'](_0x2721('0x11'),upload[_0x2721('0x26')]('file'),controller['addSystemAvatar']);router['post'](_0x2721('0x2e'),controller['notify']);const offlineUploadMulter=multer({'storage':multer[_0x2721('0x20')]({'destination':function(_0xeb502c,_0x3fd911,_0x46786b){const _0x2e2629=path[_0x2721('0x29')](config[_0x2721('0x21')],'server/files',_0x2721('0x2f'),_0x2721('0x30'));fs_extra['ensureDir'](_0x2e2629,function(){_0x46786b(null,_0x2e2629);});},'filename':function(_0xd59880,_0x2e9eab,_0x2a4f2f){const _0x5333a0=_0x2e9eab['originalname']['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x20e567=path['extname'](_0x5333a0);const _0x459d9e=Date[_0x2721('0x24')]()+'-'+_0x5333a0[_0x2721('0x31')](_0x20e567,'')+_0x20e567;_0x2a4f2f(null,_0x459d9e);}})});router[_0x2721('0x1e')]('/:id/offline',offlineUploadMulter[_0x2721('0x32')](),controller['offline']);router[_0x2721('0x1e')](_0x2721('0x33'),auth['isAuthenticated'](),controller[_0x2721('0x34')]);router[_0x2721('0x1e')](_0x2721('0x15'),auth[_0x2721('0x4')](),controller[_0x2721('0x35')]);router[_0x2721('0x1e')](_0x2721('0x17'),auth[_0x2721('0x4')](),controller[_0x2721('0x36')]);router[_0x2721('0x1e')]('/:id/users',auth[_0x2721('0x4')](),controller[_0x2721('0x37')]);router[_0x2721('0x38')](_0x2721('0x39'),auth[_0x2721('0x4')](),controller[_0x2721('0x3a')]);router[_0x2721('0x3b')]('/:id',auth[_0x2721('0x4')](),controller['destroy']);router[_0x2721('0x3b')]('/:id/dispositions',auth[_0x2721('0x4')](),controller[_0x2721('0x3c')]);router[_0x2721('0x3b')](_0x2721('0xa'),auth['isAuthenticated'](),controller['removeAnswers']);router[_0x2721('0x3b')]('/:id/users',auth[_0x2721('0x4')](),controller[_0x2721('0x3d')]);module[_0x2721('0x3e')]=router; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.attributes.js b/server/api/cloudProvider/cloudProvider.attributes.js index 54d4ef1..a5d0995 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 _0x8ace=['sequelize','exports','STRING','ENUM','AmazonAWS','Google'];(function(_0x37e498,_0x2df21a){var _0x1ab2e4=function(_0x5f142b){while(--_0x5f142b){_0x37e498['push'](_0x37e498['shift']());}};_0x1ab2e4(++_0x2df21a);}(_0x8ace,0x1bc));var _0xe8ac=function(_0x327c12,_0x2874c9){_0x327c12=_0x327c12-0x0;var _0x4cd602=_0x8ace[_0x327c12];return _0x4cd602;};'use strict';var Sequelize=require(_0xe8ac('0x0'));module[_0xe8ac('0x1')]={'name':{'type':Sequelize[_0xe8ac('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0xe8ac('0x3')](_0xe8ac('0x4'),_0xe8ac('0x5')),'allowNull':![],'validate':{'notEmpty':!![]}},'data1':{'type':Sequelize[_0xe8ac('0x2')]},'data2':{'type':Sequelize[_0xe8ac('0x2')]}}; \ No newline at end of file +var _0x6050=['STRING','ENUM','AmazonAWS','Google','sequelize','exports'];(function(_0x6ca3e0,_0x45acf7){var _0x2f7502=function(_0x2d41d8){while(--_0x2d41d8){_0x6ca3e0['push'](_0x6ca3e0['shift']());}};_0x2f7502(++_0x45acf7);}(_0x6050,0x196));var _0x0605=function(_0x14aea2,_0x441017){_0x14aea2=_0x14aea2-0x0;var _0xaab0b4=_0x6050[_0x14aea2];return _0xaab0b4;};'use strict';var Sequelize=require(_0x0605('0x0'));module[_0x0605('0x1')]={'name':{'type':Sequelize[_0x0605('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0x0605('0x3')](_0x0605('0x4'),_0x0605('0x5')),'allowNull':![],'validate':{'notEmpty':!![]}},'data1':{'type':Sequelize['STRING']},'data2':{'type':Sequelize[_0x0605('0x2')]}}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.controller.js b/server/api/cloudProvider/cloudProvider.controller.js index e1fe9ec..c4960d8 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 _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(_0x47ad9a,_0x300d49){var _0x24b4b1=function(_0x4ef3f8){while(--_0x4ef3f8){_0x47ad9a['push'](_0x47ad9a['shift']());}};_0x24b4b1(++_0x300d49);}(_0x2ef3,0xba));var _0x32ef=function(_0x5ad1c6,_0x1dfc41){_0x5ad1c6=_0x5ad1c6-0x0;var _0x1fdb68=_0x2ef3[_0x5ad1c6];return _0x1fdb68;};'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 +var _0x7a54=['offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','CloudProvider','fieldName','type','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','includeAll','include','findAll','rows','show','params','length','merge','options','find','catch','body','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json'];(function(_0x58cb22,_0x9c9794){var _0x202197=function(_0x577667){while(--_0x577667){_0x58cb22['push'](_0x58cb22['shift']());}};_0x202197(++_0x9c9794);}(_0x7a54,0x106));var _0x47a5=function(_0x2b05e1,_0x41c8ba){_0x2b05e1=_0x2b05e1-0x0;var _0x4fbb1c=_0x7a54[_0x2b05e1];return _0x4fbb1c;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x29')]=function(_0x136b14,_0x16631f){var _0x361bfa={},_0x1127f8={},_0x11a4fa={'count':0x0,'rows':[]};var _0x3ad507=_['map'](db[_0x47a5('0x2a')]['rawAttributes'],function(_0x2ef875){return{'name':_0x2ef875[_0x47a5('0x2b')],'type':_0x2ef875[_0x47a5('0x2c')]['key']};});_0x1127f8[_0x47a5('0x2d')]=_[_0x47a5('0x2e')](_0x3ad507,_0x47a5('0x27'));_0x1127f8[_0x47a5('0x2f')]=_['keys'](_0x136b14['query']);_0x1127f8[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x1127f8['model'],_0x1127f8['query']);_0x361bfa[_0x47a5('0x32')]=_[_0x47a5('0x31')](_0x1127f8['model'],qs[_0x47a5('0x33')](_0x136b14['query'][_0x47a5('0x33')]));_0x361bfa[_0x47a5('0x32')]=_0x361bfa['attributes']['length']?_0x361bfa[_0x47a5('0x32')]:_0x1127f8['model'];if(!_0x136b14[_0x47a5('0x2f')][_0x47a5('0x34')](_0x47a5('0x35'))){_0x361bfa['limit']=qs[_0x47a5('0x1d')](_0x136b14['query']['limit']);_0x361bfa[_0x47a5('0x1a')]=qs['offset'](_0x136b14[_0x47a5('0x2f')]['offset']);}_0x361bfa[_0x47a5('0x36')]=qs[_0x47a5('0x37')](_0x136b14[_0x47a5('0x2f')][_0x47a5('0x37')]);_0x361bfa[_0x47a5('0x38')]=qs[_0x47a5('0x30')](_[_0x47a5('0x39')](_0x136b14[_0x47a5('0x2f')],_0x1127f8[_0x47a5('0x30')]),_0x3ad507);if(_0x136b14['query'][_0x47a5('0x3a')]){_0x361bfa[_0x47a5('0x38')]=_['merge'](_0x361bfa[_0x47a5('0x38')],{'$or':_[_0x47a5('0x2e')](_0x3ad507,function(_0x1d4348){if(_0x1d4348['type']!==_0x47a5('0x3b')){var _0x10f660={};_0x10f660[_0x1d4348['name']]={'$like':'%'+_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3a')]+'%'};return _0x10f660;}})});}_0x361bfa=_['merge']({},_0x361bfa,_0x136b14['options']);var _0x5ebd8c={'where':_0x361bfa[_0x47a5('0x38')]};return db['CloudProvider'][_0x47a5('0x1c')](_0x5ebd8c)[_0x47a5('0x23')](function(_0x301a85){_0x11a4fa[_0x47a5('0x1c')]=_0x301a85;if(_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x361bfa[_0x47a5('0x3d')]=[{'all':!![]}];}return db[_0x47a5('0x2a')][_0x47a5('0x3e')](_0x361bfa);})[_0x47a5('0x23')](function(_0x280500){_0x11a4fa[_0x47a5('0x3f')]=_0x280500;return _0x11a4fa;})[_0x47a5('0x23')](respondWithFilteredResult(_0x16631f,_0x361bfa))['catch'](handleError(_0x16631f,null));};exports[_0x47a5('0x40')]=function(_0x1c36fa,_0x331474){var _0x23bd8d={'raw':!![],'where':{'id':_0x1c36fa[_0x47a5('0x41')]['id']}},_0x586f4f={};_0x586f4f['model']=_['keys'](db['CloudProvider']['rawAttributes']);_0x586f4f[_0x47a5('0x2f')]=_['keys'](_0x1c36fa[_0x47a5('0x2f')]);_0x586f4f[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x586f4f['model'],_0x586f4f[_0x47a5('0x2f')]);_0x23bd8d[_0x47a5('0x32')]=_['intersection'](_0x586f4f['model'],qs[_0x47a5('0x33')](_0x1c36fa['query'][_0x47a5('0x33')]));_0x23bd8d[_0x47a5('0x32')]=_0x23bd8d[_0x47a5('0x32')][_0x47a5('0x42')]?_0x23bd8d[_0x47a5('0x32')]:_0x586f4f[_0x47a5('0x2d')];if(_0x1c36fa[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x23bd8d[_0x47a5('0x3d')]=[{'all':!![]}];}_0x23bd8d=_[_0x47a5('0x43')]({},_0x23bd8d,_0x1c36fa[_0x47a5('0x44')]);return db[_0x47a5('0x2a')][_0x47a5('0x45')](_0x23bd8d)[_0x47a5('0x23')](handleEntityNotFound(_0x331474,null))[_0x47a5('0x23')](respondWithResult(_0x331474,null))[_0x47a5('0x46')](handleError(_0x331474,null));};exports['create']=function(_0x2d38de,_0x23bb04){return db['CloudProvider']['create'](_0x2d38de[_0x47a5('0x47')],{})['then'](respondWithResult(_0x23bb04,0xc9))[_0x47a5('0x46')](handleError(_0x23bb04,null));};exports[_0x47a5('0x22')]=function(_0x54c35f,_0x4f62d3){if(_0x54c35f[_0x47a5('0x47')]['id']){delete _0x54c35f['body']['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x54c35f[_0x47a5('0x41')]['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x4f62d3,null))[_0x47a5('0x23')](saveUpdates(_0x54c35f[_0x47a5('0x47')],null))[_0x47a5('0x23')](respondWithResult(_0x4f62d3,null))['catch'](handleError(_0x4f62d3,null));};exports['destroy']=function(_0x2dd1db,_0x411230){return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x2dd1db[_0x47a5('0x41')]['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x411230,null))[_0x47a5('0x23')](removeEntity(_0x411230,null))['catch'](handleError(_0x411230,null));}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.model.js b/server/api/cloudProvider/cloudProvider.model.js index 0aef948..e921ed7 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 _0xd037=['CloudProvider','cloud_providers','../../config/logger','moment','bluebird','request-promise','path','rimraf','exports','define'];(function(_0x6f929,_0x1ee1bd){var _0x2402f1=function(_0x895feb){while(--_0x895feb){_0x6f929['push'](_0x6f929['shift']());}};_0x2402f1(++_0x1ee1bd);}(_0xd037,0xb6));var _0x7d03=function(_0x10553b,_0x40493a){_0x10553b=_0x10553b-0x0;var _0x2a4d03=_0xd037[_0x10553b];return _0x2a4d03;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x7d03('0x0'))('api');var moment=require(_0x7d03('0x1'));var BPromise=require(_0x7d03('0x2'));var rp=require(_0x7d03('0x3'));var fs=require('fs');var path=require(_0x7d03('0x4'));var rimraf=require(_0x7d03('0x5'));var config=require('../../config/environment');var attributes=require('./cloudProvider.attributes');module[_0x7d03('0x6')]=function(_0xd71fc,_0x431e54){return _0xd71fc[_0x7d03('0x7')](_0x7d03('0x8'),attributes,{'tableName':_0x7d03('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xffd9=['api','bluebird','request-promise','path','rimraf','../../config/environment','./cloudProvider.attributes','define','CloudProvider','cloud_providers','lodash','util','../../config/logger'];(function(_0x2ef1b7,_0x2350bb){var _0x212cd0=function(_0x1bb516){while(--_0x1bb516){_0x2ef1b7['push'](_0x2ef1b7['shift']());}};_0x212cd0(++_0x2350bb);}(_0xffd9,0x19d));var _0x9ffd=function(_0x2d3401,_0x4317d6){_0x2d3401=_0x2d3401-0x0;var _0x50d033=_0xffd9[_0x2d3401];return _0x50d033;};'use strict';var _=require(_0x9ffd('0x0'));var util=require(_0x9ffd('0x1'));var logger=require(_0x9ffd('0x2'))(_0x9ffd('0x3'));var moment=require('moment');var BPromise=require(_0x9ffd('0x4'));var rp=require(_0x9ffd('0x5'));var fs=require('fs');var path=require(_0x9ffd('0x6'));var rimraf=require(_0x9ffd('0x7'));var config=require(_0x9ffd('0x8'));var attributes=require(_0x9ffd('0x9'));module['exports']=function(_0x5d8c52,_0x1c297f){return _0x5d8c52[_0x9ffd('0xa')](_0x9ffd('0xb'),attributes,{'tableName':_0x9ffd('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.rpc.js b/server/api/cloudProvider/cloudProvider.rpc.js index 2c38b33..269084e 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 _0x4329=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','CloudProvider,\x20%s,\x20%s','request\x20sent','CloudProvider,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x10be58,_0x41cdad){var _0x14deb3=function(_0x2a5121){while(--_0x2a5121){_0x10be58['push'](_0x10be58['shift']());}};_0x14deb3(++_0x41cdad);}(_0x4329,0x13b));var _0x9432=function(_0x9df060,_0x253d33){_0x9df060=_0x9df060-0x0;var _0x338dfe=_0x4329[_0x9df060];return _0x338dfe;};'use strict';var _=require(_0x9432('0x0'));var util=require(_0x9432('0x1'));var moment=require(_0x9432('0x2'));var BPromise=require(_0x9432('0x3'));var rs=require(_0x9432('0x4'));var fs=require('fs');var Redis=require(_0x9432('0x5'));var db=require(_0x9432('0x6'))['db'];var utils=require(_0x9432('0x7'));var logger=require(_0x9432('0x8'))(_0x9432('0x9'));var config=require(_0x9432('0xa'));var jayson=require(_0x9432('0xb'));var client=jayson[_0x9432('0xc')][_0x9432('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x5568ad,_0x376967,_0x5346c3){return new BPromise(function(_0x10509f,_0x4563c4){return client['request'](_0x5568ad,_0x5346c3)[_0x9432('0xe')](function(_0x2b06c7){logger[_0x9432('0xf')](_0x9432('0x10'),_0x376967,_0x9432('0x11'));logger['debug'](_0x9432('0x12'),_0x376967,_0x9432('0x11'),JSON['stringify'](_0x2b06c7));if(_0x2b06c7['error']){if(_0x2b06c7[_0x9432('0x13')][_0x9432('0x14')]===0x1f4){logger[_0x9432('0x13')](_0x9432('0x10'),_0x376967,_0x2b06c7['error'][_0x9432('0x15')]);return _0x4563c4(_0x2b06c7[_0x9432('0x13')][_0x9432('0x15')]);}logger[_0x9432('0x13')](_0x9432('0x10'),_0x376967,_0x2b06c7['error'][_0x9432('0x15')]);return _0x10509f(_0x2b06c7[_0x9432('0x13')]['message']);}else{logger[_0x9432('0xf')](_0x9432('0x10'),_0x376967,'request\x20sent');_0x10509f(_0x2b06c7[_0x9432('0x16')][_0x9432('0x15')]);}})['catch'](function(_0x5c4360){logger['error']('CloudProvider,\x20%s,\x20%s',_0x376967,_0x5c4360);_0x4563c4(_0x5c4360);});});} \ No newline at end of file +var _0xcf66=['jayson/promise','client','http','request','then','request\x20sent','CloudProvider,\x20%s,\x20%s,\x20%s','stringify','error','CloudProvider,\x20%s,\x20%s','message','result','catch','lodash','util','moment','randomstring','ioredis','../../config/logger','rpc'];(function(_0x4c253b,_0x3205e9){var _0x2f447c=function(_0xddbb70){while(--_0xddbb70){_0x4c253b['push'](_0x4c253b['shift']());}};_0x2f447c(++_0x3205e9);}(_0xcf66,0x71));var _0x6cf6=function(_0x15f580,_0x35dc48){_0x15f580=_0x15f580-0x0;var _0x40a487=_0xcf66[_0x15f580];return _0x40a487;};'use strict';var _=require(_0x6cf6('0x0'));var util=require(_0x6cf6('0x1'));var moment=require(_0x6cf6('0x2'));var BPromise=require('bluebird');var rs=require(_0x6cf6('0x3'));var fs=require('fs');var Redis=require(_0x6cf6('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x6cf6('0x5'))(_0x6cf6('0x6'));var config=require('../../config/environment');var jayson=require(_0x6cf6('0x7'));var client=jayson[_0x6cf6('0x8')][_0x6cf6('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5eb082,_0x94c6a9,_0x308d0d){return new BPromise(function(_0x36b892,_0x748c93){return client[_0x6cf6('0xa')](_0x5eb082,_0x308d0d)[_0x6cf6('0xb')](function(_0x5b3827){logger['info']('CloudProvider,\x20%s,\x20%s',_0x94c6a9,_0x6cf6('0xc'));logger['debug'](_0x6cf6('0xd'),_0x94c6a9,_0x6cf6('0xc'),JSON[_0x6cf6('0xe')](_0x5b3827));if(_0x5b3827[_0x6cf6('0xf')]){if(_0x5b3827['error']['code']===0x1f4){logger['error'](_0x6cf6('0x10'),_0x94c6a9,_0x5b3827[_0x6cf6('0xf')][_0x6cf6('0x11')]);return _0x748c93(_0x5b3827[_0x6cf6('0xf')][_0x6cf6('0x11')]);}logger[_0x6cf6('0xf')]('CloudProvider,\x20%s,\x20%s',_0x94c6a9,_0x5b3827[_0x6cf6('0xf')]['message']);return _0x36b892(_0x5b3827[_0x6cf6('0xf')][_0x6cf6('0x11')]);}else{logger['info'](_0x6cf6('0x10'),_0x94c6a9,_0x6cf6('0xc'));_0x36b892(_0x5b3827[_0x6cf6('0x12')][_0x6cf6('0x11')]);}})[_0x6cf6('0x13')](function(_0x2bdb12){logger[_0x6cf6('0xf')](_0x6cf6('0x10'),_0x94c6a9,_0x2bdb12);_0x748c93(_0x2bdb12);});});} \ No newline at end of file diff --git a/server/api/cloudProvider/index.js b/server/api/cloudProvider/index.js index a8b5674..6a1ee33 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 _0x0a1c=['show','post','create','put','delete','exports','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./cloudProvider.controller','get','isAuthenticated','index','/:id'];(function(_0x2519d0,_0x305dd4){var _0x5656e3=function(_0x5c317a){while(--_0x5c317a){_0x2519d0['push'](_0x2519d0['shift']());}};_0x5656e3(++_0x305dd4);}(_0x0a1c,0xd2));var _0xc0a1=function(_0x445101,_0x2414bf){_0x445101=_0x445101-0x0;var _0x3c3d04=_0x0a1c[_0x445101];return _0x3c3d04;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xc0a1('0x0'));var timeout=require(_0xc0a1('0x1'));var express=require(_0xc0a1('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xc0a1('0x3'));var interaction=require(_0xc0a1('0x4'));var config=require(_0xc0a1('0x5'));var controller=require(_0xc0a1('0x6'));router[_0xc0a1('0x7')]('/',auth[_0xc0a1('0x8')](),controller[_0xc0a1('0x9')]);router[_0xc0a1('0x7')](_0xc0a1('0xa'),auth[_0xc0a1('0x8')](),controller[_0xc0a1('0xb')]);router[_0xc0a1('0xc')]('/',auth[_0xc0a1('0x8')](),controller[_0xc0a1('0xd')]);router[_0xc0a1('0xe')](_0xc0a1('0xa'),auth[_0xc0a1('0x8')](),controller['update']);router[_0xc0a1('0xf')](_0xc0a1('0xa'),auth[_0xc0a1('0x8')](),controller['destroy']);module[_0xc0a1('0x10')]=router; \ No newline at end of file +var _0xcd94=['create','put','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./cloudProvider.controller','get','isAuthenticated','index','/:id','show'];(function(_0x4f11f0,_0xd8b6b9){var _0x495cd9=function(_0x40dfc8){while(--_0x40dfc8){_0x4f11f0['push'](_0x4f11f0['shift']());}};_0x495cd9(++_0xd8b6b9);}(_0xcd94,0x19b));var _0x4cd9=function(_0x3e451f,_0x10500d){_0x3e451f=_0x3e451f-0x0;var _0x57978f=_0xcd94[_0x3e451f];return _0x57978f;};'use strict';var multer=require('multer');var util=require(_0x4cd9('0x0'));var path=require(_0x4cd9('0x1'));var timeout=require(_0x4cd9('0x2'));var express=require(_0x4cd9('0x3'));var router=express[_0x4cd9('0x4')]();var fs_extra=require(_0x4cd9('0x5'));var auth=require(_0x4cd9('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x4cd9('0x7'));var controller=require(_0x4cd9('0x8'));router[_0x4cd9('0x9')]('/',auth[_0x4cd9('0xa')](),controller[_0x4cd9('0xb')]);router[_0x4cd9('0x9')](_0x4cd9('0xc'),auth[_0x4cd9('0xa')](),controller[_0x4cd9('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0x4cd9('0xe')]);router[_0x4cd9('0xf')]('/:id',auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0x4cd9('0xa')](),controller[_0x4cd9('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.attributes.js b/server/api/cmCompany/cmCompany.attributes.js index 3f81763..161ee49 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 _0xe033=['STRING','exports'];(function(_0x119d5a,_0x19b457){var _0x15bff4=function(_0x1b7c78){while(--_0x1b7c78){_0x119d5a['push'](_0x119d5a['shift']());}};_0x15bff4(++_0x19b457);}(_0xe033,0x8b));var _0x3e03=function(_0x1f61a3,_0x524e29){_0x1f61a3=_0x1f61a3-0x0;var _0x5c5818=_0xe033[_0x1f61a3];return _0x5c5818;};'use strict';var Sequelize=require('sequelize');module[_0x3e03('0x0')]={'name':{'type':Sequelize[_0x3e03('0x1')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0x3e03('0x1')]},'companyId':{'type':Sequelize['STRING']},'website':{'type':Sequelize['STRING']},'phone':{'type':Sequelize['STRING']},'fax':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x3e03('0x1')]},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize['STRING']},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize['STRING']},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize['STRING']},'sStreet':{'type':Sequelize[_0x3e03('0x1')]},'sPostalCode':{'type':Sequelize[_0x3e03('0x1')]},'sCity':{'type':Sequelize[_0x3e03('0x1')]},'sCountry':{'type':Sequelize[_0x3e03('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xb844=['STRING','exports'];(function(_0x342929,_0x2276b8){var _0x3e7f17=function(_0x48153e){while(--_0x48153e){_0x342929['push'](_0x342929['shift']());}};_0x3e7f17(++_0x2276b8);}(_0xb844,0x149));var _0x4b84=function(_0x4429d8,_0x1d1923){_0x4429d8=_0x4429d8-0x0;var _0x7246b0=_0xb844[_0x4429d8];return _0x7246b0;};'use strict';var Sequelize=require('sequelize');module[_0x4b84('0x0')]={'name':{'type':Sequelize[_0x4b84('0x1')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0x4b84('0x1')]},'companyId':{'type':Sequelize[_0x4b84('0x1')]},'website':{'type':Sequelize[_0x4b84('0x1')]},'phone':{'type':Sequelize[_0x4b84('0x1')]},'fax':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x4b84('0x1')]},'street':{'type':Sequelize[_0x4b84('0x1')]},'postalCode':{'type':Sequelize[_0x4b84('0x1')]},'city':{'type':Sequelize[_0x4b84('0x1')]},'country':{'type':Sequelize[_0x4b84('0x1')]},'email':{'type':Sequelize[_0x4b84('0x1')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0x4b84('0x1')]},'sStreet':{'type':Sequelize[_0x4b84('0x1')]},'sPostalCode':{'type':Sequelize[_0x4b84('0x1')]},'sCity':{'type':Sequelize['STRING']},'sCountry':{'type':Sequelize[_0x4b84('0x1')]},'description':{'type':Sequelize[_0x4b84('0x1')]}}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.controller.js b/server/api/cmCompany/cmCompany.controller.js index c8a059b..5555f6b 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 _0x3c0d=['to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','apply','reject','save','destroy','get','UserProfileResource','then','error','stack','name','index','CmCompany','describe','model','keys','query','intersection','attributes','fields','length','nolimit','sort','filters','filter','merge','where','map','options','includeAll','include','findAll','catch','show','params','rawAttributes','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Companies','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addContacts','CmContact','ids','order','pick','getContacts','hasOwnProperty','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util'];(function(_0xd26750,_0x2c1103){var _0x3e310b=function(_0x28ae2b){while(--_0x28ae2b){_0xd26750['push'](_0xd26750['shift']());}};_0x3e310b(++_0x2c1103);}(_0x3c0d,0x149));var _0xd3c0=function(_0x220b7e,_0x2eed81){_0x220b7e=_0x220b7e-0x0;var _0x4ac073=_0x3c0d[_0x220b7e];return _0x4ac073;};'use strict';var emlformat=require(_0xd3c0('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd3c0('0x1'));var jsonpatch=require(_0xd3c0('0x2'));var rp=require(_0xd3c0('0x3'));var moment=require('moment');var BPromise=require(_0xd3c0('0x4'));var Mustache=require(_0xd3c0('0x5'));var util=require(_0xd3c0('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0xd3c0('0x7'));var ejs=require(_0xd3c0('0x8'));var fs=require('fs');var fs_extra=require(_0xd3c0('0x9'));var _=require('lodash');var squel=require(_0xd3c0('0xa'));var crypto=require(_0xd3c0('0xb'));var jsforce=require(_0xd3c0('0xc'));var deskjs=require(_0xd3c0('0xd'));var toCsv=require(_0xd3c0('0x7'));var querystring=require(_0xd3c0('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xd3c0('0xf'));var qs=require(_0xd3c0('0x10'));var as=require(_0xd3c0('0x11'));var hardwareService=require(_0xd3c0('0x12'));var logger=require('../../config/logger')(_0xd3c0('0x13'));var utils=require('../../config/utils');var config=require(_0xd3c0('0x14'));var licenseUtil=require(_0xd3c0('0x15'));var db=require(_0xd3c0('0x16'))['db'];function respondWithStatusCode(_0x52043f,_0x286379){_0x286379=_0x286379||0xcc;return function(_0x3df5c8){if(_0x3df5c8){return _0x52043f[_0xd3c0('0x17')](_0x286379);}return _0x52043f[_0xd3c0('0x18')](_0x286379)[_0xd3c0('0x19')]();};}function respondWithResult(_0x274b98,_0x1a6e53){_0x1a6e53=_0x1a6e53||0xc8;return function(_0xd2bf53){if(_0xd2bf53){return _0x274b98[_0xd3c0('0x18')](_0x1a6e53)[_0xd3c0('0x1a')](_0xd2bf53);}};}function respondWithFilteredResult(_0x458dc4,_0x49f6ab){return function(_0x451235){if(_0x451235){var _0x4fa7d4=typeof _0x49f6ab['offset']===_0xd3c0('0x1b')&&typeof _0x49f6ab[_0xd3c0('0x1c')]===_0xd3c0('0x1b');var _0x567efe=_0x451235[_0xd3c0('0x1d')];var _0x5b09a0=_0x4fa7d4?0x0:_0x49f6ab[_0xd3c0('0x1e')];var _0x3fd7c9=_0x4fa7d4?_0x451235[_0xd3c0('0x1d')]:_0x49f6ab['offset']+_0x49f6ab[_0xd3c0('0x1c')];var _0x486142;if(_0x3fd7c9>=_0x567efe){_0x3fd7c9=_0x567efe;_0x486142=0xc8;}else{_0x486142=0xce;}_0x458dc4['status'](_0x486142);return _0x458dc4[_0xd3c0('0x1f')]('Content-Range',_0x5b09a0+'-'+_0x3fd7c9+'/'+_0x567efe)['json'](_0x451235);}return null;};}function patchUpdates(_0x219592){return function(_0x4d74b8){try{jsonpatch[_0xd3c0('0x20')](_0x4d74b8,_0x219592,!![]);}catch(_0x54a11d){return BPromise[_0xd3c0('0x21')](_0x54a11d);}return _0x4d74b8[_0xd3c0('0x22')]();};}function saveUpdates(_0x3264bd,_0x89c3c2){return function(_0x526b00){if(_0x526b00){return _0x526b00['update'](_0x3264bd)['then'](function(_0x4546fd){return _0x4546fd;});}return null;};}function removeEntity(_0x45b12f,_0x3246da){return function(_0x4653b3){if(_0x4653b3){return _0x4653b3[_0xd3c0('0x23')]()['then'](function(){var _0x4ea830=_0x4653b3[_0xd3c0('0x24')]({'plain':!![]});var _0xa1136e='Companies';return db[_0xd3c0('0x25')][_0xd3c0('0x23')]({'where':{'type':_0xa1136e,'resourceId':_0x4ea830['id']}})[_0xd3c0('0x26')](function(){return _0x4653b3;});})[_0xd3c0('0x26')](function(){_0x45b12f[_0xd3c0('0x18')](0xcc)[_0xd3c0('0x19')]();});}};}function handleEntityNotFound(_0x515f0a,_0x2fb3e8){return function(_0x484f5a){if(!_0x484f5a){_0x515f0a[_0xd3c0('0x17')](0x194);}return _0x484f5a;};}function handleError(_0x185370,_0x4031e6){_0x4031e6=_0x4031e6||0x1f4;return function(_0x525c72){logger[_0xd3c0('0x27')](_0x525c72[_0xd3c0('0x28')]);if(_0x525c72[_0xd3c0('0x29')]){delete _0x525c72[_0xd3c0('0x29')];}_0x185370[_0xd3c0('0x18')](_0x4031e6)['send'](_0x525c72);};}exports[_0xd3c0('0x2a')]=function(_0x2b92ca,_0x3dbbc1){var _0x4e1117={},_0x124228={},_0xeaf45d={'count':0x0,'rows':[]};return db[_0xd3c0('0x2b')][_0xd3c0('0x2c')]()[_0xd3c0('0x26')](function(_0x5500ca){_0x124228[_0xd3c0('0x2d')]=_[_0xd3c0('0x2e')](_0x5500ca);_0x124228[_0xd3c0('0x2f')]=_[_0xd3c0('0x2e')](_0x2b92ca[_0xd3c0('0x2f')]);_0x124228['filters']=_[_0xd3c0('0x30')](_0x124228[_0xd3c0('0x2d')],_0x124228[_0xd3c0('0x2f')]);_0x4e1117[_0xd3c0('0x31')]=_[_0xd3c0('0x30')](_0x124228[_0xd3c0('0x2d')],qs[_0xd3c0('0x32')](_0x2b92ca[_0xd3c0('0x2f')][_0xd3c0('0x32')]));_0x4e1117[_0xd3c0('0x31')]=_0x4e1117['attributes'][_0xd3c0('0x33')]?_0x4e1117[_0xd3c0('0x31')]:_0x124228[_0xd3c0('0x2d')];if(!_0x2b92ca[_0xd3c0('0x2f')]['hasOwnProperty'](_0xd3c0('0x34'))){_0x4e1117['limit']=qs['limit'](_0x2b92ca[_0xd3c0('0x2f')][_0xd3c0('0x1c')]);_0x4e1117[_0xd3c0('0x1e')]=qs['offset'](_0x2b92ca[_0xd3c0('0x2f')][_0xd3c0('0x1e')]);}_0x4e1117['order']=qs[_0xd3c0('0x35')](_0x2b92ca['query'][_0xd3c0('0x35')]);_0x4e1117['where']=qs[_0xd3c0('0x36')](_['pick'](_0x2b92ca[_0xd3c0('0x2f')],_0x124228[_0xd3c0('0x36')]),_0x5500ca);if(_0x2b92ca[_0xd3c0('0x2f')][_0xd3c0('0x37')]){_0x4e1117['where']=_[_0xd3c0('0x38')](_0x4e1117[_0xd3c0('0x39')],{'$or':_[_0xd3c0('0x3a')](_0x4e1117[_0xd3c0('0x31')],function(_0x129261){var _0x3818cc={};_0x3818cc[_0x129261]={'$like':'%'+_0x2b92ca[_0xd3c0('0x2f')]['filter']+'%'};return _0x3818cc;})});}_0x4e1117=_[_0xd3c0('0x38')]({},_0x4e1117,_0x2b92ca[_0xd3c0('0x3b')]);var _0x4738f2={'where':_0x4e1117[_0xd3c0('0x39')]};return db[_0xd3c0('0x2b')][_0xd3c0('0x1d')](_0x4738f2)[_0xd3c0('0x26')](function(_0x337fba){_0xeaf45d['count']=_0x337fba;if(_0x2b92ca['query'][_0xd3c0('0x3c')]){_0x4e1117[_0xd3c0('0x3d')]=[{'all':!![]}];}return db['CmCompany'][_0xd3c0('0x3e')](_0x4e1117);})[_0xd3c0('0x26')](function(_0x34b251){_0xeaf45d['rows']=_0x34b251;return _0xeaf45d;})[_0xd3c0('0x26')](respondWithFilteredResult(_0x3dbbc1,_0x4e1117))[_0xd3c0('0x3f')](handleError(_0x3dbbc1,null));})['catch'](handleError(_0x3dbbc1,null));};exports[_0xd3c0('0x40')]=function(_0x2f6dc6,_0xc846db){var _0x44af89={'raw':![],'where':{'id':_0x2f6dc6[_0xd3c0('0x41')]['id']}},_0x5a2944={};_0x5a2944[_0xd3c0('0x2d')]=_['keys'](db[_0xd3c0('0x2b')][_0xd3c0('0x42')]);_0x5a2944[_0xd3c0('0x2f')]=_[_0xd3c0('0x2e')](_0x2f6dc6['query']);_0x5a2944[_0xd3c0('0x36')]=_[_0xd3c0('0x30')](_0x5a2944[_0xd3c0('0x2d')],_0x5a2944[_0xd3c0('0x2f')]);_0x44af89[_0xd3c0('0x31')]=_[_0xd3c0('0x30')](_0x5a2944[_0xd3c0('0x2d')],qs[_0xd3c0('0x32')](_0x2f6dc6['query'][_0xd3c0('0x32')]));_0x44af89[_0xd3c0('0x31')]=_0x44af89[_0xd3c0('0x31')][_0xd3c0('0x33')]?_0x44af89[_0xd3c0('0x31')]:_0x5a2944[_0xd3c0('0x2d')];if(_0x2f6dc6[_0xd3c0('0x2f')][_0xd3c0('0x3c')]){_0x44af89[_0xd3c0('0x3d')]=[{'all':!![]}];}_0x44af89=_[_0xd3c0('0x38')]({},_0x44af89,_0x2f6dc6[_0xd3c0('0x3b')]);return db['CmCompany'][_0xd3c0('0x43')](_0x44af89)[_0xd3c0('0x26')](handleEntityNotFound(_0xc846db,null))[_0xd3c0('0x26')](respondWithResult(_0xc846db,null))[_0xd3c0('0x3f')](handleError(_0xc846db,null));};exports[_0xd3c0('0x44')]=function(_0x18b1cd,_0x517494){return db['CmCompany']['create'](_0x18b1cd[_0xd3c0('0x45')],{})[_0xd3c0('0x26')](function(_0x54294b){var _0x287db3=_0x18b1cd[_0xd3c0('0x46')][_0xd3c0('0x24')]({'plain':!![]});if(!_0x287db3)throw new Error(_0xd3c0('0x47'));if(_0x287db3[_0xd3c0('0x48')]==='user'){var _0x4b0440=_0x54294b[_0xd3c0('0x24')]({'plain':!![]});var _0x2c64bd=_0xd3c0('0x49');return db[_0xd3c0('0x4a')][_0xd3c0('0x43')]({'where':{'name':_0x2c64bd,'userProfileId':_0x287db3['userProfileId']},'raw':!![]})[_0xd3c0('0x26')](function(_0x32dec3){if(_0x32dec3&&_0x32dec3[_0xd3c0('0x4b')]===0x0){return db[_0xd3c0('0x25')]['create']({'name':_0x4b0440[_0xd3c0('0x29')],'resourceId':_0x4b0440['id'],'type':_0x32dec3['name'],'sectionId':_0x32dec3['id']},{})[_0xd3c0('0x26')](function(){return _0x54294b;});}else{return _0x54294b;}})[_0xd3c0('0x3f')](function(_0x1d565d){logger[_0xd3c0('0x27')](_0xd3c0('0x4c'),_0x1d565d);throw _0x1d565d;});}return _0x54294b;})[_0xd3c0('0x26')](respondWithResult(_0x517494,0xc9))[_0xd3c0('0x3f')](handleError(_0x517494,null));};exports['update']=function(_0x241bbf,_0x3ea555){if(_0x241bbf['body']['id']){delete _0x241bbf[_0xd3c0('0x45')]['id'];}return db[_0xd3c0('0x2b')][_0xd3c0('0x43')]({'where':{'id':_0x241bbf[_0xd3c0('0x41')]['id']}})['then'](handleEntityNotFound(_0x3ea555,null))['then'](saveUpdates(_0x241bbf[_0xd3c0('0x45')],null))[_0xd3c0('0x26')](respondWithResult(_0x3ea555,null))[_0xd3c0('0x3f')](handleError(_0x3ea555,null));};exports[_0xd3c0('0x23')]=function(_0xd88da4,_0x55e3ae){return db[_0xd3c0('0x2b')][_0xd3c0('0x43')]({'where':{'id':_0xd88da4[_0xd3c0('0x41')]['id']}})[_0xd3c0('0x26')](handleEntityNotFound(_0x55e3ae,null))[_0xd3c0('0x26')](removeEntity(_0x55e3ae,null))[_0xd3c0('0x3f')](handleError(_0x55e3ae,null));};exports[_0xd3c0('0x2c')]=function(_0x2c5ef0,_0x3eeb34){return db[_0xd3c0('0x2b')][_0xd3c0('0x2c')]()[_0xd3c0('0x26')](respondWithResult(_0x3eeb34,null))[_0xd3c0('0x3f')](handleError(_0x3eeb34,null));};exports[_0xd3c0('0x4d')]=function(_0xc9088a,_0x5ba47d,_0x50787a){return db[_0xd3c0('0x4e')]['find']({'where':{'id':_0xc9088a[_0xd3c0('0x41')]['id']}})[_0xd3c0('0x26')](handleEntityNotFound(_0x5ba47d,null))['then'](function(_0x707f07){if(_0x707f07){return _0x707f07[_0xd3c0('0x4d')](_0xc9088a[_0xd3c0('0x45')][_0xd3c0('0x4f')],_['omit'](_0xc9088a[_0xd3c0('0x45')],[_0xd3c0('0x4f'),'id'])||{});}})[_0xd3c0('0x26')](respondWithResult(_0x5ba47d,null))[_0xd3c0('0x3f')](handleError(_0x5ba47d,null));};exports['getContacts']=function(_0x3fd934,_0x2aaa7d,_0x3d9375){var _0x24cdd4={};var _0x16f027={};var _0x44319d;var _0x187e9b;return db[_0xd3c0('0x2b')]['findOne']({'where':{'id':_0x3fd934['params']['id']}})[_0xd3c0('0x26')](handleEntityNotFound(_0x2aaa7d,null))['then'](function(_0x1dfdd3){if(_0x1dfdd3){_0x44319d=_0x1dfdd3;_0x16f027[_0xd3c0('0x2d')]=_['keys'](db[_0xd3c0('0x4e')]['rawAttributes']);_0x16f027['query']=_[_0xd3c0('0x2e')](_0x3fd934['query']);_0x16f027['filters']=_[_0xd3c0('0x30')](_0x16f027['model'],_0x16f027['query']);_0x24cdd4[_0xd3c0('0x31')]=_['intersection'](_0x16f027[_0xd3c0('0x2d')],qs[_0xd3c0('0x32')](_0x3fd934[_0xd3c0('0x2f')][_0xd3c0('0x32')]));_0x24cdd4['attributes']=_0x24cdd4['attributes'][_0xd3c0('0x33')]?_0x24cdd4[_0xd3c0('0x31')]:_0x16f027[_0xd3c0('0x2d')];_0x24cdd4[_0xd3c0('0x50')]=qs[_0xd3c0('0x35')](_0x3fd934['query'][_0xd3c0('0x35')]);_0x24cdd4['where']=qs[_0xd3c0('0x36')](_[_0xd3c0('0x51')](_0x3fd934['query'],_0x16f027[_0xd3c0('0x36')]));if(_0x3fd934[_0xd3c0('0x2f')][_0xd3c0('0x37')]){_0x24cdd4[_0xd3c0('0x39')]=_[_0xd3c0('0x38')](_0x24cdd4[_0xd3c0('0x39')],{'$or':_[_0xd3c0('0x3a')](_0x24cdd4[_0xd3c0('0x31')],function(_0x2f6d79){var _0x3cbf1c={};_0x3cbf1c[_0x2f6d79]={'$like':'%'+_0x3fd934['query'][_0xd3c0('0x37')]+'%'};return _0x3cbf1c;})});}_0x24cdd4=_[_0xd3c0('0x38')]({},_0x24cdd4,_0x3fd934[_0xd3c0('0x3b')]);return _0x44319d[_0xd3c0('0x52')](_0x24cdd4);}})[_0xd3c0('0x26')](function(_0x45d558){if(_0x45d558){_0x187e9b=_0x45d558[_0xd3c0('0x33')];if(!_0x3fd934[_0xd3c0('0x2f')][_0xd3c0('0x53')]('nolimit')){_0x24cdd4[_0xd3c0('0x1c')]=qs[_0xd3c0('0x1c')](_0x3fd934[_0xd3c0('0x2f')][_0xd3c0('0x1c')]);_0x24cdd4['offset']=qs[_0xd3c0('0x1e')](_0x3fd934[_0xd3c0('0x2f')][_0xd3c0('0x1e')]);}return _0x44319d[_0xd3c0('0x52')](_0x24cdd4);}})[_0xd3c0('0x26')](function(_0x4136de){if(_0x4136de){return _0x4136de?{'count':_0x187e9b,'rows':_0x4136de}:null;}})['then'](respondWithResult(_0x2aaa7d,null))['catch'](handleError(_0x2aaa7d,null));}; \ No newline at end of file +var _0x32d6=['papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','undefined','count','offset','limit','json','apply','reject','save','update','destroy','then','get','UserProfileResource','stack','name','send','index','CmCompany','describe','model','keys','query','filters','attributes','intersection','fields','length','nolimit','sort','where','pick','filter','merge','map','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','Companies','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addContacts','ids','getContacts','findOne','CmContact','rawAttributes','order','hasOwnProperty','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','querystring'];(function(_0x2b171a,_0x582765){var _0x33acbc=function(_0x97b429){while(--_0x97b429){_0x2b171a['push'](_0x2b171a['shift']());}};_0x33acbc(++_0x582765);}(_0x32d6,0xf8));var _0x632d=function(_0x3a92c3,_0x1b49cf){_0x3a92c3=_0x3a92c3-0x0;var _0x155ce1=_0x32d6[_0x3a92c3];return _0x155ce1;};'use strict';var emlformat=require(_0x632d('0x0'));var rimraf=require(_0x632d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x632d('0x2'));var rp=require(_0x632d('0x3'));var moment=require(_0x632d('0x4'));var BPromise=require(_0x632d('0x5'));var Mustache=require(_0x632d('0x6'));var util=require(_0x632d('0x7'));var path=require(_0x632d('0x8'));var sox=require(_0x632d('0x9'));var csv=require(_0x632d('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x632d('0xb'));var _=require(_0x632d('0xc'));var squel=require(_0x632d('0xd'));var crypto=require(_0x632d('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x632d('0xf'));var Papa=require(_0x632d('0x10'));var Redis=require('ioredis');var authService=require(_0x632d('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x632d('0x12'));var hardwareService=require(_0x632d('0x13'));var logger=require(_0x632d('0x14'))(_0x632d('0x15'));var utils=require(_0x632d('0x16'));var config=require(_0x632d('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x632d('0x18'))['db'];function respondWithStatusCode(_0x517c10,_0x5c2826){_0x5c2826=_0x5c2826||0xcc;return function(_0x2b5da7){if(_0x2b5da7){return _0x517c10[_0x632d('0x19')](_0x5c2826);}return _0x517c10[_0x632d('0x1a')](_0x5c2826)[_0x632d('0x1b')]();};}function respondWithResult(_0x5706e9,_0x5a1b01){_0x5a1b01=_0x5a1b01||0xc8;return function(_0x57e280){if(_0x57e280){return _0x5706e9[_0x632d('0x1a')](_0x5a1b01)['json'](_0x57e280);}};}function respondWithFilteredResult(_0x977a5c,_0x2aa81b){return function(_0x44401b){if(_0x44401b){var _0x228bdd=typeof _0x2aa81b['offset']==='undefined'&&typeof _0x2aa81b['limit']===_0x632d('0x1c');var _0x5903f4=_0x44401b[_0x632d('0x1d')];var _0x10dbf0=_0x228bdd?0x0:_0x2aa81b[_0x632d('0x1e')];var _0x295232=_0x228bdd?_0x44401b[_0x632d('0x1d')]:_0x2aa81b[_0x632d('0x1e')]+_0x2aa81b[_0x632d('0x1f')];var _0x41d0bf;if(_0x295232>=_0x5903f4){_0x295232=_0x5903f4;_0x41d0bf=0xc8;}else{_0x41d0bf=0xce;}_0x977a5c['status'](_0x41d0bf);return _0x977a5c['set']('Content-Range',_0x10dbf0+'-'+_0x295232+'/'+_0x5903f4)[_0x632d('0x20')](_0x44401b);}return null;};}function patchUpdates(_0x3034cb){return function(_0x2b544f){try{jsonpatch[_0x632d('0x21')](_0x2b544f,_0x3034cb,!![]);}catch(_0x2bd70b){return BPromise[_0x632d('0x22')](_0x2bd70b);}return _0x2b544f[_0x632d('0x23')]();};}function saveUpdates(_0x2e13e7,_0x16527e){return function(_0x558111){if(_0x558111){return _0x558111[_0x632d('0x24')](_0x2e13e7)['then'](function(_0x34bd08){return _0x34bd08;});}return null;};}function removeEntity(_0x5293e8,_0x5ee19e){return function(_0x2d33a5){if(_0x2d33a5){return _0x2d33a5[_0x632d('0x25')]()[_0x632d('0x26')](function(){var _0x49bf05=_0x2d33a5[_0x632d('0x27')]({'plain':!![]});var _0x32a058='Companies';return db[_0x632d('0x28')][_0x632d('0x25')]({'where':{'type':_0x32a058,'resourceId':_0x49bf05['id']}})[_0x632d('0x26')](function(){return _0x2d33a5;});})[_0x632d('0x26')](function(){_0x5293e8[_0x632d('0x1a')](0xcc)[_0x632d('0x1b')]();});}};}function handleEntityNotFound(_0x122f16,_0x5c13fc){return function(_0x11198b){if(!_0x11198b){_0x122f16[_0x632d('0x19')](0x194);}return _0x11198b;};}function handleError(_0x349afe,_0x7f4dd){_0x7f4dd=_0x7f4dd||0x1f4;return function(_0x16b751){logger['error'](_0x16b751[_0x632d('0x29')]);if(_0x16b751[_0x632d('0x2a')]){delete _0x16b751[_0x632d('0x2a')];}_0x349afe[_0x632d('0x1a')](_0x7f4dd)[_0x632d('0x2b')](_0x16b751);};}exports[_0x632d('0x2c')]=function(_0x338830,_0x87514){var _0x2879ee={},_0x4b8abc={},_0x4e63c2={'count':0x0,'rows':[]};return db[_0x632d('0x2d')][_0x632d('0x2e')]()[_0x632d('0x26')](function(_0x5af753){_0x4b8abc[_0x632d('0x2f')]=_[_0x632d('0x30')](_0x5af753);_0x4b8abc[_0x632d('0x31')]=_[_0x632d('0x30')](_0x338830['query']);_0x4b8abc[_0x632d('0x32')]=_['intersection'](_0x4b8abc[_0x632d('0x2f')],_0x4b8abc[_0x632d('0x31')]);_0x2879ee[_0x632d('0x33')]=_[_0x632d('0x34')](_0x4b8abc[_0x632d('0x2f')],qs[_0x632d('0x35')](_0x338830[_0x632d('0x31')][_0x632d('0x35')]));_0x2879ee[_0x632d('0x33')]=_0x2879ee[_0x632d('0x33')][_0x632d('0x36')]?_0x2879ee['attributes']:_0x4b8abc[_0x632d('0x2f')];if(!_0x338830[_0x632d('0x31')]['hasOwnProperty'](_0x632d('0x37'))){_0x2879ee[_0x632d('0x1f')]=qs['limit'](_0x338830[_0x632d('0x31')][_0x632d('0x1f')]);_0x2879ee['offset']=qs[_0x632d('0x1e')](_0x338830[_0x632d('0x31')][_0x632d('0x1e')]);}_0x2879ee['order']=qs[_0x632d('0x38')](_0x338830[_0x632d('0x31')][_0x632d('0x38')]);_0x2879ee[_0x632d('0x39')]=qs[_0x632d('0x32')](_[_0x632d('0x3a')](_0x338830[_0x632d('0x31')],_0x4b8abc['filters']),_0x5af753);if(_0x338830['query'][_0x632d('0x3b')]){_0x2879ee['where']=_[_0x632d('0x3c')](_0x2879ee[_0x632d('0x39')],{'$or':_[_0x632d('0x3d')](_0x2879ee['attributes'],function(_0x1772b6){var _0x1543be={};_0x1543be[_0x1772b6]={'$like':'%'+_0x338830[_0x632d('0x31')][_0x632d('0x3b')]+'%'};return _0x1543be;})});}_0x2879ee=_['merge']({},_0x2879ee,_0x338830['options']);var _0x516178={'where':_0x2879ee[_0x632d('0x39')]};return db[_0x632d('0x2d')]['count'](_0x516178)['then'](function(_0x46e20b){_0x4e63c2[_0x632d('0x1d')]=_0x46e20b;if(_0x338830[_0x632d('0x31')][_0x632d('0x3e')]){_0x2879ee[_0x632d('0x3f')]=[{'all':!![]}];}return db[_0x632d('0x2d')][_0x632d('0x40')](_0x2879ee);})[_0x632d('0x26')](function(_0x4bb94b){_0x4e63c2[_0x632d('0x41')]=_0x4bb94b;return _0x4e63c2;})[_0x632d('0x26')](respondWithFilteredResult(_0x87514,_0x2879ee))[_0x632d('0x42')](handleError(_0x87514,null));})[_0x632d('0x42')](handleError(_0x87514,null));};exports[_0x632d('0x43')]=function(_0x167231,_0x133acb){var _0x4a296a={'raw':![],'where':{'id':_0x167231[_0x632d('0x44')]['id']}},_0x5d6b0c={};_0x5d6b0c[_0x632d('0x2f')]=_[_0x632d('0x30')](db['CmCompany']['rawAttributes']);_0x5d6b0c[_0x632d('0x31')]=_['keys'](_0x167231['query']);_0x5d6b0c[_0x632d('0x32')]=_[_0x632d('0x34')](_0x5d6b0c[_0x632d('0x2f')],_0x5d6b0c[_0x632d('0x31')]);_0x4a296a['attributes']=_[_0x632d('0x34')](_0x5d6b0c['model'],qs[_0x632d('0x35')](_0x167231[_0x632d('0x31')]['fields']));_0x4a296a[_0x632d('0x33')]=_0x4a296a[_0x632d('0x33')][_0x632d('0x36')]?_0x4a296a[_0x632d('0x33')]:_0x5d6b0c[_0x632d('0x2f')];if(_0x167231[_0x632d('0x31')][_0x632d('0x3e')]){_0x4a296a[_0x632d('0x3f')]=[{'all':!![]}];}_0x4a296a=_[_0x632d('0x3c')]({},_0x4a296a,_0x167231[_0x632d('0x45')]);return db[_0x632d('0x2d')][_0x632d('0x46')](_0x4a296a)[_0x632d('0x26')](handleEntityNotFound(_0x133acb,null))['then'](respondWithResult(_0x133acb,null))[_0x632d('0x42')](handleError(_0x133acb,null));};exports[_0x632d('0x47')]=function(_0x58892e,_0x5786d5){return db[_0x632d('0x2d')][_0x632d('0x47')](_0x58892e[_0x632d('0x48')],{})['then'](function(_0x41ffa8){var _0x5ef223=_0x58892e['user']['get']({'plain':!![]});if(!_0x5ef223)throw new Error(_0x632d('0x49'));if(_0x5ef223['role']===_0x632d('0x4a')){var _0x501588=_0x41ffa8[_0x632d('0x27')]({'plain':!![]});var _0x271692=_0x632d('0x4b');return db['UserProfileSection'][_0x632d('0x46')]({'where':{'name':_0x271692,'userProfileId':_0x5ef223[_0x632d('0x4c')]},'raw':!![]})[_0x632d('0x26')](function(_0x416b7e){if(_0x416b7e&&_0x416b7e[_0x632d('0x4d')]===0x0){return db['UserProfileResource'][_0x632d('0x47')]({'name':_0x501588[_0x632d('0x2a')],'resourceId':_0x501588['id'],'type':_0x416b7e[_0x632d('0x2a')],'sectionId':_0x416b7e['id']},{})[_0x632d('0x26')](function(){return _0x41ffa8;});}else{return _0x41ffa8;}})[_0x632d('0x42')](function(_0x4adc1d){logger[_0x632d('0x4e')](_0x632d('0x4f'),_0x4adc1d);throw _0x4adc1d;});}return _0x41ffa8;})[_0x632d('0x26')](respondWithResult(_0x5786d5,0xc9))[_0x632d('0x42')](handleError(_0x5786d5,null));};exports[_0x632d('0x24')]=function(_0x286d35,_0x37ca40){if(_0x286d35[_0x632d('0x48')]['id']){delete _0x286d35[_0x632d('0x48')]['id'];}return db[_0x632d('0x2d')]['find']({'where':{'id':_0x286d35['params']['id']}})['then'](handleEntityNotFound(_0x37ca40,null))[_0x632d('0x26')](saveUpdates(_0x286d35[_0x632d('0x48')],null))[_0x632d('0x26')](respondWithResult(_0x37ca40,null))[_0x632d('0x42')](handleError(_0x37ca40,null));};exports[_0x632d('0x25')]=function(_0x35b671,_0x3c1acb){return db[_0x632d('0x2d')][_0x632d('0x46')]({'where':{'id':_0x35b671[_0x632d('0x44')]['id']}})[_0x632d('0x26')](handleEntityNotFound(_0x3c1acb,null))['then'](removeEntity(_0x3c1acb,null))[_0x632d('0x42')](handleError(_0x3c1acb,null));};exports[_0x632d('0x2e')]=function(_0x437619,_0x1d963b){return db[_0x632d('0x2d')][_0x632d('0x2e')]()[_0x632d('0x26')](respondWithResult(_0x1d963b,null))[_0x632d('0x42')](handleError(_0x1d963b,null));};exports[_0x632d('0x50')]=function(_0x1579e8,_0x5d5205,_0x3c71bf){return db['CmContact'][_0x632d('0x46')]({'where':{'id':_0x1579e8[_0x632d('0x44')]['id']}})[_0x632d('0x26')](handleEntityNotFound(_0x5d5205,null))[_0x632d('0x26')](function(_0x322d50){if(_0x322d50){return _0x322d50[_0x632d('0x50')](_0x1579e8['body']['ids'],_['omit'](_0x1579e8[_0x632d('0x48')],[_0x632d('0x51'),'id'])||{});}})[_0x632d('0x26')](respondWithResult(_0x5d5205,null))[_0x632d('0x42')](handleError(_0x5d5205,null));};exports[_0x632d('0x52')]=function(_0x4891cf,_0x19a540,_0x20ab58){var _0x5d9f69={};var _0x5e6bdb={};var _0x3168d4;var _0x5a6fc4;return db[_0x632d('0x2d')][_0x632d('0x53')]({'where':{'id':_0x4891cf[_0x632d('0x44')]['id']}})['then'](handleEntityNotFound(_0x19a540,null))[_0x632d('0x26')](function(_0x4e3d05){if(_0x4e3d05){_0x3168d4=_0x4e3d05;_0x5e6bdb[_0x632d('0x2f')]=_['keys'](db[_0x632d('0x54')][_0x632d('0x55')]);_0x5e6bdb['query']=_[_0x632d('0x30')](_0x4891cf[_0x632d('0x31')]);_0x5e6bdb[_0x632d('0x32')]=_[_0x632d('0x34')](_0x5e6bdb[_0x632d('0x2f')],_0x5e6bdb[_0x632d('0x31')]);_0x5d9f69[_0x632d('0x33')]=_[_0x632d('0x34')](_0x5e6bdb[_0x632d('0x2f')],qs[_0x632d('0x35')](_0x4891cf['query'][_0x632d('0x35')]));_0x5d9f69[_0x632d('0x33')]=_0x5d9f69[_0x632d('0x33')][_0x632d('0x36')]?_0x5d9f69[_0x632d('0x33')]:_0x5e6bdb[_0x632d('0x2f')];_0x5d9f69[_0x632d('0x56')]=qs[_0x632d('0x38')](_0x4891cf['query']['sort']);_0x5d9f69['where']=qs[_0x632d('0x32')](_[_0x632d('0x3a')](_0x4891cf['query'],_0x5e6bdb[_0x632d('0x32')]));if(_0x4891cf[_0x632d('0x31')][_0x632d('0x3b')]){_0x5d9f69[_0x632d('0x39')]=_[_0x632d('0x3c')](_0x5d9f69['where'],{'$or':_[_0x632d('0x3d')](_0x5d9f69[_0x632d('0x33')],function(_0x580163){var _0x4529b7={};_0x4529b7[_0x580163]={'$like':'%'+_0x4891cf[_0x632d('0x31')]['filter']+'%'};return _0x4529b7;})});}_0x5d9f69=_[_0x632d('0x3c')]({},_0x5d9f69,_0x4891cf[_0x632d('0x45')]);return _0x3168d4[_0x632d('0x52')](_0x5d9f69);}})[_0x632d('0x26')](function(_0x3922a2){if(_0x3922a2){_0x5a6fc4=_0x3922a2['length'];if(!_0x4891cf[_0x632d('0x31')][_0x632d('0x57')](_0x632d('0x37'))){_0x5d9f69[_0x632d('0x1f')]=qs[_0x632d('0x1f')](_0x4891cf[_0x632d('0x31')][_0x632d('0x1f')]);_0x5d9f69['offset']=qs[_0x632d('0x1e')](_0x4891cf['query'][_0x632d('0x1e')]);}return _0x3168d4[_0x632d('0x52')](_0x5d9f69);}})[_0x632d('0x26')](function(_0x428afe){if(_0x428afe){return _0x428afe?{'count':_0x5a6fc4,'rows':_0x428afe}:null;}})[_0x632d('0x26')](respondWithResult(_0x19a540,null))['catch'](handleError(_0x19a540,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index d5782d5..a764a52 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 _0x828f=['../../config/environment','./cmCompany.attributes','exports','define','CmCompany','cm_companies','lodash','util','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x237398,_0xc0ef22){var _0x5598de=function(_0x3118fa){while(--_0x3118fa){_0x237398['push'](_0x237398['shift']());}};_0x5598de(++_0xc0ef22);}(_0x828f,0x164));var _0xf828=function(_0x5ddaac,_0x2697a8){_0x5ddaac=_0x5ddaac-0x0;var _0x2a9c58=_0x828f[_0x5ddaac];return _0x2a9c58;};'use strict';var _=require(_0xf828('0x0'));var util=require(_0xf828('0x1'));var logger=require('../../config/logger')(_0xf828('0x2'));var moment=require(_0xf828('0x3'));var BPromise=require(_0xf828('0x4'));var rp=require(_0xf828('0x5'));var fs=require('fs');var path=require(_0xf828('0x6'));var rimraf=require(_0xf828('0x7'));var config=require(_0xf828('0x8'));var attributes=require(_0xf828('0x9'));module[_0xf828('0xa')]=function(_0x3c539b,_0x6c62e2){return _0x3c539b[_0xf828('0xb')](_0xf828('0xc'),attributes,{'tableName':_0xf828('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4763=['../../config/environment','./cmCompany.attributes','exports','define','CmCompany','cm_companies','lodash','../../config/logger','request-promise','path','rimraf'];(function(_0x3afa38,_0x3ee8fd){var _0x20aafa=function(_0x5329d8){while(--_0x5329d8){_0x3afa38['push'](_0x3afa38['shift']());}};_0x20aafa(++_0x3ee8fd);}(_0x4763,0xe2));var _0x3476=function(_0x15c4da,_0x520f2b){_0x15c4da=_0x15c4da-0x0;var _0x12a803=_0x4763[_0x15c4da];return _0x12a803;};'use strict';var _=require(_0x3476('0x0'));var util=require('util');var logger=require(_0x3476('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x3476('0x2'));var fs=require('fs');var path=require(_0x3476('0x3'));var rimraf=require(_0x3476('0x4'));var config=require(_0x3476('0x5'));var attributes=require(_0x3476('0x6'));module[_0x3476('0x7')]=function(_0x3f6172,_0x38d712){return _0x3f6172[_0x3476('0x8')](_0x3476('0x9'),attributes,{'tableName':_0x3476('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.rpc.js b/server/api/cmCompany/cmCompany.rpc.js index 263157a..a575b5b 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 _0x95b0=['client','request','then','CmCompany,\x20%s,\x20%s','request\x20sent','debug','CmCompany,\x20%s,\x20%s,\x20%s','error','code','message','info','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x3579ad,_0x31c43d){var _0x33bcad=function(_0x443171){while(--_0x443171){_0x3579ad['push'](_0x3579ad['shift']());}};_0x33bcad(++_0x31c43d);}(_0x95b0,0xbc));var _0x095b=function(_0x545acc,_0x3d188a){_0x545acc=_0x545acc-0x0;var _0x5b5e30=_0x95b0[_0x545acc];return _0x5b5e30;};'use strict';var _=require(_0x095b('0x0'));var util=require(_0x095b('0x1'));var moment=require(_0x095b('0x2'));var BPromise=require(_0x095b('0x3'));var rs=require(_0x095b('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x095b('0x5'))['db'];var utils=require(_0x095b('0x6'));var logger=require(_0x095b('0x7'))(_0x095b('0x8'));var config=require(_0x095b('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x095b('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2f3545,_0x4f130d,_0x155354){return new BPromise(function(_0x2890c1,_0x227bd7){return client[_0x095b('0xb')](_0x2f3545,_0x155354)[_0x095b('0xc')](function(_0xab6b1a){logger['info'](_0x095b('0xd'),_0x4f130d,_0x095b('0xe'));logger[_0x095b('0xf')](_0x095b('0x10'),_0x4f130d,_0x095b('0xe'),JSON['stringify'](_0xab6b1a));if(_0xab6b1a['error']){if(_0xab6b1a[_0x095b('0x11')][_0x095b('0x12')]===0x1f4){logger[_0x095b('0x11')](_0x095b('0xd'),_0x4f130d,_0xab6b1a[_0x095b('0x11')][_0x095b('0x13')]);return _0x227bd7(_0xab6b1a[_0x095b('0x11')]['message']);}logger['error']('CmCompany,\x20%s,\x20%s',_0x4f130d,_0xab6b1a[_0x095b('0x11')]['message']);return _0x2890c1(_0xab6b1a[_0x095b('0x11')]['message']);}else{logger[_0x095b('0x14')](_0x095b('0xd'),_0x4f130d,'request\x20sent');_0x2890c1(_0xab6b1a['result']['message']);}})[_0x095b('0x15')](function(_0x44c9d8){logger[_0x095b('0x11')](_0x095b('0xd'),_0x4f130d,_0x44c9d8);_0x227bd7(_0x44c9d8);});});} \ No newline at end of file +var _0xa1a6=['info','CmCompany,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','request','then'];(function(_0x415d66,_0x96979f){var _0x8d36f0=function(_0x273d46){while(--_0x273d46){_0x415d66['push'](_0x415d66['shift']());}};_0x8d36f0(++_0x96979f);}(_0xa1a6,0xc5));var _0x6a1a=function(_0x2d3ab3,_0x47d90b){_0x2d3ab3=_0x2d3ab3-0x0;var _0x321f9e=_0xa1a6[_0x2d3ab3];return _0x321f9e;};'use strict';var _=require(_0x6a1a('0x0'));var util=require(_0x6a1a('0x1'));var moment=require(_0x6a1a('0x2'));var BPromise=require(_0x6a1a('0x3'));var rs=require(_0x6a1a('0x4'));var fs=require('fs');var Redis=require(_0x6a1a('0x5'));var db=require(_0x6a1a('0x6'))['db'];var utils=require(_0x6a1a('0x7'));var logger=require(_0x6a1a('0x8'))(_0x6a1a('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x6a1a('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x51b39f,_0x488356,_0x26e021){return new BPromise(function(_0x2b6081,_0x1637b8){return client[_0x6a1a('0xb')](_0x51b39f,_0x26e021)[_0x6a1a('0xc')](function(_0x3fbfb6){logger[_0x6a1a('0xd')](_0x6a1a('0xe'),_0x488356,_0x6a1a('0xf'));logger[_0x6a1a('0x10')]('CmCompany,\x20%s,\x20%s,\x20%s',_0x488356,_0x6a1a('0xf'),JSON[_0x6a1a('0x11')](_0x3fbfb6));if(_0x3fbfb6[_0x6a1a('0x12')]){if(_0x3fbfb6[_0x6a1a('0x12')]['code']===0x1f4){logger[_0x6a1a('0x12')](_0x6a1a('0xe'),_0x488356,_0x3fbfb6[_0x6a1a('0x12')][_0x6a1a('0x13')]);return _0x1637b8(_0x3fbfb6[_0x6a1a('0x12')][_0x6a1a('0x13')]);}logger[_0x6a1a('0x12')]('CmCompany,\x20%s,\x20%s',_0x488356,_0x3fbfb6[_0x6a1a('0x12')][_0x6a1a('0x13')]);return _0x2b6081(_0x3fbfb6[_0x6a1a('0x12')][_0x6a1a('0x13')]);}else{logger[_0x6a1a('0xd')](_0x6a1a('0xe'),_0x488356,'request\x20sent');_0x2b6081(_0x3fbfb6['result'][_0x6a1a('0x13')]);}})[_0x6a1a('0x14')](function(_0x2b40e3){logger[_0x6a1a('0x12')](_0x6a1a('0xe'),_0x488356,_0x2b40e3);_0x1637b8(_0x2b40e3);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index f557864..93b5b42 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 _0x0fb4=['update','delete','destroy','exports','multer','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./cmCompany.controller','get','isAuthenticated','index','describe','/:id','show','/:id/contacts','post','create','addContacts'];(function(_0x56f56d,_0x366e03){var _0x16d690=function(_0x3e99d5){while(--_0x3e99d5){_0x56f56d['push'](_0x56f56d['shift']());}};_0x16d690(++_0x366e03);}(_0x0fb4,0x17e));var _0x40fb=function(_0x3c6ae2,_0x5c52d8){_0x3c6ae2=_0x3c6ae2-0x0;var _0x4edda=_0x0fb4[_0x3c6ae2];return _0x4edda;};'use strict';var multer=require(_0x40fb('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x40fb('0x1'));var express=require(_0x40fb('0x2'));var router=express[_0x40fb('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x40fb('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x40fb('0x5'));var controller=require(_0x40fb('0x6'));router[_0x40fb('0x7')]('/',auth[_0x40fb('0x8')](),controller[_0x40fb('0x9')]);router[_0x40fb('0x7')]('/describe',auth[_0x40fb('0x8')](),controller[_0x40fb('0xa')]);router['get'](_0x40fb('0xb'),auth[_0x40fb('0x8')](),controller[_0x40fb('0xc')]);router['get'](_0x40fb('0xd'),auth[_0x40fb('0x8')](),controller['getContacts']);router[_0x40fb('0xe')]('/',auth[_0x40fb('0x8')](),controller[_0x40fb('0xf')]);router['post']('/:id/contacts',auth[_0x40fb('0x8')](),controller[_0x40fb('0x10')]);router['put'](_0x40fb('0xb'),auth[_0x40fb('0x8')](),controller[_0x40fb('0x11')]);router[_0x40fb('0x12')](_0x40fb('0xb'),auth['isAuthenticated'](),controller[_0x40fb('0x13')]);module[_0x40fb('0x14')]=router; \ No newline at end of file +var _0x916a=['show','post','create','/:id/contacts','addContacts','put','update','delete','destroy','exports','multer','util','path','connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','./cmCompany.controller','get','isAuthenticated','/describe','describe','/:id'];(function(_0x381cd7,_0x5cd931){var _0x42fb4d=function(_0x2ee505){while(--_0x2ee505){_0x381cd7['push'](_0x381cd7['shift']());}};_0x42fb4d(++_0x5cd931);}(_0x916a,0x17a));var _0xa916=function(_0x3a0c4f,_0x5dd1a3){_0x3a0c4f=_0x3a0c4f-0x0;var _0x247049=_0x916a[_0x3a0c4f];return _0x247049;};'use strict';var multer=require(_0xa916('0x0'));var util=require(_0xa916('0x1'));var path=require(_0xa916('0x2'));var timeout=require(_0xa916('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xa916('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xa916('0x5'));var config=require(_0xa916('0x6'));var controller=require(_0xa916('0x7'));router[_0xa916('0x8')]('/',auth[_0xa916('0x9')](),controller['index']);router[_0xa916('0x8')](_0xa916('0xa'),auth[_0xa916('0x9')](),controller[_0xa916('0xb')]);router[_0xa916('0x8')](_0xa916('0xc'),auth[_0xa916('0x9')](),controller[_0xa916('0xd')]);router[_0xa916('0x8')]('/:id/contacts',auth[_0xa916('0x9')](),controller['getContacts']);router[_0xa916('0xe')]('/',auth[_0xa916('0x9')](),controller[_0xa916('0xf')]);router[_0xa916('0xe')](_0xa916('0x10'),auth[_0xa916('0x9')](),controller[_0xa916('0x11')]);router[_0xa916('0x12')](_0xa916('0xc'),auth[_0xa916('0x9')](),controller[_0xa916('0x13')]);router[_0xa916('0x14')](_0xa916('0xc'),auth[_0xa916('0x9')](),controller[_0xa916('0x15')]);module[_0xa916('0x16')]=router; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.attributes.js b/server/api/cmContact/cmContact.attributes.js index 6a58e0e..5e503d6 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 _0xe3ff=['UNSIGNED','NOW','lodash','sequelize','exports','STRING','TEXT','INTEGER'];(function(_0x4b9b90,_0x148e57){var _0x137e8d=function(_0x97a4d4){while(--_0x97a4d4){_0x4b9b90['push'](_0x4b9b90['shift']());}};_0x137e8d(++_0x148e57);}(_0xe3ff,0x142));var _0xfe3f=function(_0x48447c,_0x2cd985){_0x48447c=_0x48447c-0x0;var _0x7a4cfd=_0xe3ff[_0x48447c];return _0x7a4cfd;};'use strict';var _=require(_0xfe3f('0x0'));var Sequelize=require(_0xfe3f('0x1'));module[_0xfe3f('0x2')]={'firstName':{'type':Sequelize['STRING'],'allowNull':![]},'lastName':{'type':Sequelize[_0xfe3f('0x3')]},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize[_0xfe3f('0x3')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0xfe3f('0x3')]},'dateOfBirth':{'type':Sequelize[_0xfe3f('0x3')]},'description':{'type':Sequelize[_0xfe3f('0x4')]},'phone':{'type':Sequelize[_0xfe3f('0x3')]},'mobile':{'type':Sequelize['STRING']},'fax':{'type':Sequelize[_0xfe3f('0x3')]},'email':{'type':Sequelize[_0xfe3f('0x3')]},'url':{'type':Sequelize['STRING']},'facebook':{'type':Sequelize[_0xfe3f('0x3')]},'fb_data':{'type':Sequelize[_0xfe3f('0x3')]},'twitter':{'type':Sequelize[_0xfe3f('0x3')]},'skype':{'type':Sequelize['STRING']},'teams':{'type':Sequelize[_0xfe3f('0x3')]},'viber':{'type':Sequelize[_0xfe3f('0x3')]},'line':{'type':Sequelize[_0xfe3f('0x3')]},'wechat':{'type':Sequelize[_0xfe3f('0x3')]},'telegram':{'type':Sequelize['STRING']},'UserId':{'type':Sequelize[_0xfe3f('0x5')]},'priority':{'type':Sequelize[_0xfe3f('0x5')](0x2)[_0xfe3f('0x6')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':Sequelize[_0xfe3f('0x7')]}}; \ No newline at end of file +var _0xffff=['exports','STRING','TEXT','INTEGER','UNSIGNED','DATE','NOW','lodash','sequelize'];(function(_0x57a50d,_0x2871f8){var _0x1b25b3=function(_0x45691e){while(--_0x45691e){_0x57a50d['push'](_0x57a50d['shift']());}};_0x1b25b3(++_0x2871f8);}(_0xffff,0xf1));var _0xffff=function(_0x427367,_0x3cec17){_0x427367=_0x427367-0x0;var _0x1027b1=_0xffff[_0x427367];return _0x1027b1;};'use strict';var _=require(_0xffff('0x0'));var Sequelize=require(_0xffff('0x1'));module[_0xffff('0x2')]={'firstName':{'type':Sequelize['STRING'],'allowNull':![]},'lastName':{'type':Sequelize[_0xffff('0x3')]},'street':{'type':Sequelize[_0xffff('0x3')]},'postalCode':{'type':Sequelize[_0xffff('0x3')]},'city':{'type':Sequelize[_0xffff('0x3')]},'country':{'type':Sequelize['STRING']},'dateOfBirth':{'type':Sequelize[_0xffff('0x3')]},'description':{'type':Sequelize[_0xffff('0x4')]},'phone':{'type':Sequelize[_0xffff('0x3')]},'mobile':{'type':Sequelize[_0xffff('0x3')]},'fax':{'type':Sequelize[_0xffff('0x3')]},'email':{'type':Sequelize[_0xffff('0x3')]},'url':{'type':Sequelize['STRING']},'facebook':{'type':Sequelize[_0xffff('0x3')]},'fb_data':{'type':Sequelize[_0xffff('0x3')]},'twitter':{'type':Sequelize[_0xffff('0x3')]},'skype':{'type':Sequelize['STRING']},'teams':{'type':Sequelize['STRING']},'viber':{'type':Sequelize[_0xffff('0x3')]},'line':{'type':Sequelize['STRING']},'wechat':{'type':Sequelize['STRING']},'telegram':{'type':Sequelize[_0xffff('0x3')]},'UserId':{'type':Sequelize[_0xffff('0x5')]},'priority':{'type':Sequelize['INTEGER'](0x2)[_0xffff('0x6')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0xffff('0x7')],'defaultValue':Sequelize[_0xffff('0x8')]}}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.controller.js b/server/api/cmContact/cmContact.controller.js index 6f54f06..4255569 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 _0x63fe=['[CmContact][merge]\x20to\x20%s\x20from\x20%s','[CmContact][merge][destroy][CmHopper],\x20%s','[CmContact][merge][destroy][CmHopperBlack],\x20%s','create','ChatInteraction','ChatMessage','ChatOfflineMessage','MailInteraction','MailMessage','SmsInteraction','SmsMessage','FaxInteraction','FaxMessage','CmHopperFinal','CmHopperHistory','ReportAgentPreview','VoiceCallReport','FaxQueueReport','MailQueueReport','OpenchannelQueueReport','SmsQueueReport','JscriptySessionReport','WhatsappMessage','WhatsappQueueReport','bulkCreate','each','duplicates','$or','findOrCreate','spread','show','omit','format','cf_%d','pickBy','table','setFields','id\x20=\x20?','toParam','phone','getTags','rawAttributes','options','nolimit','setTags','ids','getHoppers','CmHopper','ContactId','includeAll','getHopperHistories','include','getHopperFinals','getJscriptySessions','uploadCsv','No\x20ListId\x20specified','binding_keys','No\x20association\x20keys\x20specified!','binding_values','No\x20association\x20values\x20specified!','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','Incorrect\x20binding\x20parameters\x20passed!','zipObject','firstName','No\x20firstName\x20column\x20specified','root','server/files/tmp','chmodSync','child_process','../../components/import/cm/csv','CompanyId','socket_timestamp','File\x20uploaded\x20correctly!','pid','file','parse','meta','import','binding','No\x20phone\x20column\x20specified','fork','../../components/import/cm/csv2','stringify','start\x20child\x20process\x20correctly!','exit','getJourney','mail','chat','sms','openchannel','fax','voice','channel','includes','toLowerCase','range','isValid','Invalid\x20date\x20for\x20range\x20from\x20filter','Invalid\x20date\x20for\x20range\x20to\x20filter','Invalid\x20createdAt\x20filter','uniqueid','source','endtime','duration','note','userDisposition','userSecondDisposition','userThirdDisposition','UserId','alias','createdAt','findAndCountAll','startCase','Website','Account','closed','disposition','thirdDisposition','Owner','fullname','browserName','customerIp','customerPort','osName','ratingType','ratingValue','referer','subject','substatus','externalUrl','threadId','all','sortBy','reverse','slice','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','ejs','fs-extra','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','json','reject','save','update','then','error','name','send','index','keys','length','startsWith','cf_','CmCustomField','findOne','trimStart','fieldType','type','model','query','filters','attributes','intersection','fields','hasOwnProperty','sort','pick','select','field','color','tools_tags','from','cm_contacts','left_join','cm_user_has_contacts','uc.CmContactId\x20=\x20c.id','cm_contact_has_tags','ct.CmContactId\x20=\x20c.id','where','c.deletedAt\x20IS\x20NULL','expr','search','parseSearch','conditions','Tag','split','map','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','uc.UserId\x20=\x20?','dateOfBirth','castTo','DATE','buildExpression','text','value','start','filter','isNil','Contact','isEmpty','forEach','ListId','c.ListId\x20IN\x20?','\x20=\x20?','tag','isArray','replace','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','isNumeric','c.id\x20LIKE\x20?','c.phone\x20LIKE\x20?','c.mobile\x20LIKE\x20?','c.fax\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','c.firstName\x20LIKE\x20?','c.lastName\x20LIKE\x20?','group','c.id','Sequelize','QueryTypes','SELECT','clone','order','DESC','having','resolve','user','agent','some','getLists','c.ListId\x20IS\x20NULL','role','sequelize','toString','keyBy','merge','CmContact','c.firstName','c.lastName','c.phone','c.mobile','c.fax','c.email','c.createdAt','c.deletedAt','c.CompanyId','TagIds','Tags','push','rows','catch','destroy','find','params','describe','tags','displayName','columnName','custom','values','body','findAll','get','mergeWith','join','info'];(function(_0x3e3b81,_0x43adf9){var _0x1301b6=function(_0x2621fb){while(--_0x2621fb){_0x3e3b81['push'](_0x3e3b81['shift']());}};_0x1301b6(++_0x43adf9);}(_0x63fe,0x87));var _0xe63f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x63fe[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xe63f('0x0'));var rimraf=require(_0xe63f('0x1'));var zipdir=require(_0xe63f('0x2'));var jsonpatch=require(_0xe63f('0x3'));var rp=require(_0xe63f('0x4'));var moment=require(_0xe63f('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xe63f('0x6'));var path=require(_0xe63f('0x7'));var sox=require(_0xe63f('0x8'));var csv=require('to-csv');var ejs=require(_0xe63f('0x9'));var fs=require('fs');var fs_extra=require(_0xe63f('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xe63f('0xb'));var jsforce=require(_0xe63f('0xc'));var deskjs=require(_0xe63f('0xd'));var toCsv=require(_0xe63f('0xe'));var querystring=require(_0xe63f('0xf'));var Papa=require(_0xe63f('0x10'));var Redis=require(_0xe63f('0x11'));var authService=require(_0xe63f('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xe63f('0x13'));var hardwareService=require(_0xe63f('0x14'));var logger=require(_0xe63f('0x15'))(_0xe63f('0x16'));var utils=require(_0xe63f('0x17'));var config=require(_0xe63f('0x18'));var licenseUtil=require(_0xe63f('0x19'));var db=require(_0xe63f('0x1a'))['db'];config[_0xe63f('0x1b')]=_[_0xe63f('0x1c')](config[_0xe63f('0x1b')],{'host':_0xe63f('0x1d'),'port':0x18eb});var socket=require(_0xe63f('0x1e'))(new Redis(config[_0xe63f('0x1b')]));require('./cmContact.socket')[_0xe63f('0x1f')](socket);function respondWithStatusCode(_0x647eba,_0x59264a){_0x59264a=_0x59264a||0xcc;return function(_0x22a735){if(_0x22a735){return _0x647eba[_0xe63f('0x20')](_0x59264a);}return _0x647eba[_0xe63f('0x21')](_0x59264a)[_0xe63f('0x22')]();};}function respondWithResult(_0x103636,_0x176cbd){_0x176cbd=_0x176cbd||0xc8;return function(_0xa517be){if(_0xa517be){return _0x103636[_0xe63f('0x21')](_0x176cbd)['json'](_0xa517be);}};}function respondWithFilteredResult(_0x2a3128,_0x1a62d5){return function(_0x2586ae){if(_0x2586ae){var _0x495a10=typeof _0x1a62d5[_0xe63f('0x23')]===_0xe63f('0x24')&&typeof _0x1a62d5['limit']===_0xe63f('0x24');var _0x3ce620=_0x2586ae[_0xe63f('0x25')];var _0x34afe7=_0x495a10?0x0:_0x1a62d5[_0xe63f('0x23')];var _0x5613b7=_0x495a10?_0x2586ae[_0xe63f('0x25')]:_0x1a62d5[_0xe63f('0x23')]+_0x1a62d5[_0xe63f('0x26')];var _0x1fa2dc;if(_0x5613b7>=_0x3ce620){_0x5613b7=_0x3ce620;_0x1fa2dc=0xc8;}else{_0x1fa2dc=0xce;}_0x2a3128[_0xe63f('0x21')](_0x1fa2dc);return _0x2a3128[_0xe63f('0x27')](_0xe63f('0x28'),_0x34afe7+'-'+_0x5613b7+'/'+_0x3ce620)[_0xe63f('0x29')](_0x2586ae);}return null;};}function patchUpdates(_0x10e7f6){return function(_0x30e760){try{jsonpatch['apply'](_0x30e760,_0x10e7f6,!![]);}catch(_0x261cda){return BPromise[_0xe63f('0x2a')](_0x261cda);}return _0x30e760[_0xe63f('0x2b')]();};}function saveUpdates(_0xd60cd9,_0x201813){return function(_0x34f868){if(_0x34f868){return _0x34f868[_0xe63f('0x2c')](_0xd60cd9)[_0xe63f('0x2d')](function(_0x2dca5c){return _0x2dca5c;});}return null;};}function removeEntity(_0x1f88db,_0x3be8a3){return function(_0x3f9b67){if(_0x3f9b67){return _0x3f9b67['destroy']()['then'](function(){_0x1f88db[_0xe63f('0x21')](0xcc)['end']();});}};}function handleEntityNotFound(_0x423483,_0x11301f){return function(_0x3d7e23){if(!_0x3d7e23){_0x423483['sendStatus'](0x194);}return _0x3d7e23;};}function handleError(_0x4768a5,_0x1a701f){_0x1a701f=_0x1a701f||0x1f4;return function(_0x37c5df){logger[_0xe63f('0x2e')](_0x37c5df['stack']);if(_0x37c5df['name']){delete _0x37c5df[_0xe63f('0x2f')];}_0x4768a5[_0xe63f('0x21')](_0x1a701f)[_0xe63f('0x30')](_0x37c5df);};}exports[_0xe63f('0x31')]=function(_0x5d66ba,_0x2a7374){var _0x1b7c04={},_0x304b28={},_0x17f2bf={'count':0x0,'rows':[]};return db['CmContact']['describe']()[_0xe63f('0x2d')](function(_0x366dce){var _0x5cf370=[];for(var _0x124f84=0x0;_0x124f840x1){_0x1ee7ea['or'](_0xe63f('0x6e'),qs[_0xe63f('0x6f')](_0xbb7072),null);}else{if(qs[_0xe63f('0x70')](_0xbb7072)){_0x1ee7ea['or'](_0xe63f('0x71'),_0xbb7072+'%');_0x1ee7ea['or'](_0xe63f('0x72'),_0xbb7072+'%');_0x1ee7ea['or'](_0xe63f('0x73'),_0xbb7072+'%');_0x1ee7ea['or'](_0xe63f('0x74'),_0xbb7072+'%');}else if(qs[_0xe63f('0x75')](_0xbb7072)){_0x1ee7ea['or'](_0xe63f('0x76'),_0xbb7072+'%');}else{_0x1ee7ea['or'](_0xe63f('0x77'),'%'+_0xbb7072+'%');_0x1ee7ea['or'](_0xe63f('0x78'),'%'+_0xbb7072+'%');_0x1ee7ea['or']('c.email\x20LIKE\x20?','%'+_0xbb7072+'%');}}}}_0x4cc4b1['where'](_0x1ee7ea);_0x4cc4b1[_0xe63f('0x79')](_0xe63f('0x7a'));var _0x49e02c={'type':db[_0xe63f('0x7b')][_0xe63f('0x7c')][_0xe63f('0x7d')],'raw':!![]};var _0x455258=_0x4cc4b1[_0xe63f('0x7e')]()[_0xe63f('0x45')](_0xe63f('0x7a'));if(_0x1b7c04[_0xe63f('0x7f')]){_0x1b7c04[_0xe63f('0x7f')][_0xe63f('0x67')](function(_0x5327b8){_0x4cc4b1[_0xe63f('0x7f')]('c.'+_0x5327b8[0x0],_0x5327b8[0x1]===_0xe63f('0x80')?![]:!![]);});}if(!_['isEmpty'](_0x30d9a6)){_0x4cc4b1[_0xe63f('0x81')](_0x49aacc);_0x455258[_0xe63f('0x4f')]('t.id\x20IN\x20?',_0x30d9a6);}BPromise[_0xe63f('0x82')]()[_0xe63f('0x2d')](function(){if(!_0x3814c4)return;if(_0x5d66ba[_0xe63f('0x83')]['role']!==_0xe63f('0x84'))return;if(!_[_0xe63f('0x85')](_0x3814c4[_0xe63f('0x54')],[_0xe63f('0x45'),_0xe63f('0x5a')])){return _0x5d66ba[_0xe63f('0x83')][_0xe63f('0x86')]({'attributes':['id'],'raw':!![]})[_0xe63f('0x2d')](function(_0x4fced5){if(_['isEmpty'](_0x4fced5)){_0x455258['where']('c.ListId\x20IS\x20NULL');_0x4cc4b1[_0xe63f('0x4f')](_0xe63f('0x87'));}else{_0x455258[_0xe63f('0x4f')](_0xe63f('0x69'),_[_0xe63f('0x57')](_0x4fced5,'id'));_0x4cc4b1['where'](_0xe63f('0x69'),_['map'](_0x4fced5,'id'));}});}})[_0xe63f('0x2d')](function(){if(_0x5d66ba[_0xe63f('0x83')][_0xe63f('0x88')]===_0xe63f('0x84')&&!_0x3814c4&&!_0x5d66ba[_0xe63f('0x3c')]['ListId'])return[];return db[_0xe63f('0x89')][_0xe63f('0x3c')](_0x455258[_0xe63f('0x8a')](),_0x49e02c);})[_0xe63f('0x2d')](function(_0x30e7a5){_0x17f2bf[_0xe63f('0x25')]=_0x30e7a5['length'];if(_0x17f2bf[_0xe63f('0x25')]===0x0)return[];return db[_0xe63f('0x89')][_0xe63f('0x3c')](_0x2e88a5[_0xe63f('0x8a')](),_0x49e02c)[_0xe63f('0x2d')](function(_0x1dcc58){_0x4e239b=_[_0xe63f('0x8b')](_0x1dcc58,'id');_0x49e02c=_[_0xe63f('0x8c')](_0x49e02c,{'model':db[_0xe63f('0x8d')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x5d66ba['query'][_0xe63f('0x40')]){_0x1b7c04[_0xe63f('0x3e')]['forEach'](function(_0x4d550b){_0x4cc4b1[_0xe63f('0x45')]('c.'+_0x4d550b);});}else{_0x4cc4b1[_0xe63f('0x45')](_0xe63f('0x7a'));_0x4cc4b1[_0xe63f('0x45')](_0xe63f('0x8e'));_0x4cc4b1[_0xe63f('0x45')](_0xe63f('0x8f'));_0x4cc4b1[_0xe63f('0x45')](_0xe63f('0x90'));_0x4cc4b1['field'](_0xe63f('0x91'));_0x4cc4b1['field'](_0xe63f('0x92'));_0x4cc4b1[_0xe63f('0x45')](_0xe63f('0x93'));_0x4cc4b1['field']('c.ListId');_0x4cc4b1[_0xe63f('0x45')](_0xe63f('0x94'));_0x4cc4b1['field'](_0xe63f('0x95'));_0x4cc4b1[_0xe63f('0x45')](_0xe63f('0x96'));_0x4cc4b1['field']('GROUP_CONCAT(DISTINCT\x20t.id)',_0xe63f('0x97'));}if(_0x1b7c04['limit'])_0x4cc4b1['limit'](_0x1b7c04[_0xe63f('0x26')]);if(_0x1b7c04['offset'])_0x4cc4b1[_0xe63f('0x23')](_0x1b7c04[_0xe63f('0x23')]);return db[_0xe63f('0x89')][_0xe63f('0x3c')](_0x4cc4b1[_0xe63f('0x8a')](),_0x49e02c);});})[_0xe63f('0x2d')](function(_0x5d0456){_0x5d0456['forEach'](function(_0x235956){if(_0x235956['TagIds']){_0x235956[_0xe63f('0x98')]=[];_0x235956[_0xe63f('0x97')][_0xe63f('0x56')](',')[_0xe63f('0x67')](function(_0x53fd23){_0x235956['Tags'][_0xe63f('0x99')](_0x4e239b[_0x53fd23]);});}delete _0x235956['TagIds'];});_0x17f2bf[_0xe63f('0x9a')]=_0x5d0456;return _0x17f2bf;})[_0xe63f('0x2d')](respondWithFilteredResult(_0x2a7374,_0x1b7c04));})[_0xe63f('0x9b')](handleError(_0x2a7374,null));};exports[_0xe63f('0x9c')]=function(_0x1a4d64,_0x9a7560){return db[_0xe63f('0x8d')][_0xe63f('0x9d')]({'where':{'id':_0x1a4d64[_0xe63f('0x9e')]['id']}})['then'](handleEntityNotFound(_0x9a7560,null))[_0xe63f('0x2d')](removeEntity(_0x9a7560,null))['catch'](handleError(_0x9a7560,null));};exports['describe']=function(_0x27d909,_0x312faf){return db[_0xe63f('0x8d')][_0xe63f('0x9f')]()[_0xe63f('0x2d')](function(_0x31b6c8){delete _0x31b6c8[_0xe63f('0xa0')];for(var _0x2506ce=0x0;_0x2506ce=_0x440031){_0x1f6390=_0x440031;_0x171df4=0xc8;}else{_0x171df4=0xce;}_0x3d770f[_0xe3fc('0x19')](_0x171df4);return _0x3d770f[_0xe3fc('0x1f')](_0xe3fc('0x20'),_0x4fbeb3+'-'+_0x1f6390+'/'+_0x440031)[_0xe3fc('0x21')](_0x5762b3);}return null;};}function patchUpdates(_0x2fffd5){return function(_0x48ebac){try{jsonpatch[_0xe3fc('0x22')](_0x48ebac,_0x2fffd5,!![]);}catch(_0x16a248){return BPromise[_0xe3fc('0x23')](_0x16a248);}return _0x48ebac[_0xe3fc('0x24')]();};}function saveUpdates(_0x518d0f,_0x1481d2){return function(_0x554678){if(_0x554678){return _0x554678[_0xe3fc('0x25')](_0x518d0f)[_0xe3fc('0x26')](function(_0x2b0b20){return _0x2b0b20;});}return null;};}function removeEntity(_0x41d26d,_0x3490ea){return function(_0x1f37e9){if(_0x1f37e9){return _0x1f37e9[_0xe3fc('0x27')]()[_0xe3fc('0x26')](function(){_0x41d26d[_0xe3fc('0x19')](0xcc)[_0xe3fc('0x1a')]();});}};}function handleEntityNotFound(_0x3288f1,_0x41ae14){return function(_0x53886e){if(!_0x53886e){_0x3288f1[_0xe3fc('0x28')](0x194);}return _0x53886e;};}function handleError(_0x486f9d,_0x3af2f3){_0x3af2f3=_0x3af2f3||0x1f4;return function(_0x742550){logger[_0xe3fc('0x29')](_0x742550[_0xe3fc('0x2a')]);if(_0x742550[_0xe3fc('0x2b')]){delete _0x742550['name'];}_0x486f9d['status'](_0x3af2f3)['send'](_0x742550);};}exports[_0xe3fc('0x2c')]=function(_0x42c2d3,_0x4ea173){var _0x1f93a9={},_0x3ff64e={},_0x1bbf99={'count':0x0,'rows':[]};return db[_0xe3fc('0x2d')]['describe']()['then'](function(_0x1c59cf){var _0x5a6502=[];for(var _0x3f3571=0x0;_0x3f35710x1){_0x1d42cf['or'](_0xe3fc('0x68'),qs[_0xe3fc('0x69')](_0x12831e),null);}else{if(qs[_0xe3fc('0x6a')](_0x12831e)){_0x1d42cf['or']('c.id\x20LIKE\x20?',_0x12831e+'%');_0x1d42cf['or'](_0xe3fc('0x6b'),_0x12831e+'%');_0x1d42cf['or'](_0xe3fc('0x6c'),_0x12831e+'%');_0x1d42cf['or']('c.fax\x20LIKE\x20?',_0x12831e+'%');}else if(qs[_0xe3fc('0x6d')](_0x12831e)){_0x1d42cf['or'](_0xe3fc('0x6e'),_0x12831e+'%');}else{_0x1d42cf['or'](_0xe3fc('0x6f'),'%'+_0x12831e+'%');_0x1d42cf['or'](_0xe3fc('0x70'),'%'+_0x12831e+'%');_0x1d42cf['or'](_0xe3fc('0x6e'),'%'+_0x12831e+'%');}}}}_0x5f070d[_0xe3fc('0x4b')](_0x1d42cf);_0x5f070d[_0xe3fc('0x71')](_0xe3fc('0x72'));var _0x558660={'type':db[_0xe3fc('0x73')][_0xe3fc('0x74')][_0xe3fc('0x75')],'raw':!![]};var _0x568bb3=_0x5f070d['clone']()[_0xe3fc('0x41')](_0xe3fc('0x72'));if(_0x1f93a9[_0xe3fc('0x3e')]){_0x1f93a9[_0xe3fc('0x3e')][_0xe3fc('0x55')](function(_0x51fa15){_0x5f070d[_0xe3fc('0x3e')]('c.'+_0x51fa15[0x0],_0x51fa15[0x1]===_0xe3fc('0x76')?![]:!![]);});}if(!_['isEmpty'](_0x3a43f9)){_0x5f070d[_0xe3fc('0x77')](_0x37a907);_0x568bb3[_0xe3fc('0x4b')]('t.id\x20IN\x20?',_0x3a43f9);}BPromise[_0xe3fc('0x78')]()['then'](function(){if(!_0x5ade99)return;if(_0x42c2d3['user']['role']!==_0xe3fc('0x79'))return;if(!_[_0xe3fc('0x7a')](_0x5ade99[_0xe3fc('0x4f')],[_0xe3fc('0x41'),_0xe3fc('0x56')])){return _0x42c2d3[_0xe3fc('0x7b')]['getLists']({'attributes':['id'],'raw':!![]})[_0xe3fc('0x26')](function(_0x48b096){if(_[_0xe3fc('0x5f')](_0x48b096)){_0x568bb3[_0xe3fc('0x4b')](_0xe3fc('0x7c'));_0x5f070d[_0xe3fc('0x4b')](_0xe3fc('0x7c'));}else{_0x568bb3[_0xe3fc('0x4b')](_0xe3fc('0x61'),_['map'](_0x48b096,'id'));_0x5f070d[_0xe3fc('0x4b')]('c.ListId\x20IN\x20?',_[_0xe3fc('0x54')](_0x48b096,'id'));}});}})[_0xe3fc('0x26')](function(){if(_0x42c2d3[_0xe3fc('0x7b')][_0xe3fc('0x7d')]==='agent'&&!_0x5ade99&&!_0x42c2d3[_0xe3fc('0x38')][_0xe3fc('0x60')])return[];return db[_0xe3fc('0x7e')][_0xe3fc('0x38')](_0x568bb3[_0xe3fc('0x7f')](),_0x558660);})[_0xe3fc('0x26')](function(_0x428162){_0x1bbf99[_0xe3fc('0x1d')]=_0x428162[_0xe3fc('0x36')];if(_0x1bbf99['count']===0x0)return[];return db['sequelize'][_0xe3fc('0x38')](_0x92d0fd['toString'](),_0x558660)[_0xe3fc('0x26')](function(_0x12c3dd){_0x3450b7=_[_0xe3fc('0x80')](_0x12c3dd,'id');_0x558660=_['merge'](_0x558660,{'model':db[_0xe3fc('0x2d')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x42c2d3['query'][_0xe3fc('0x3b')]){_0x1f93a9['attributes'][_0xe3fc('0x55')](function(_0x2bfb7b){_0x5f070d[_0xe3fc('0x41')]('c.'+_0x2bfb7b);});}else{_0x5f070d['field']('c.id');_0x5f070d['field']('c.firstName');_0x5f070d[_0xe3fc('0x41')](_0xe3fc('0x81'));_0x5f070d[_0xe3fc('0x41')]('c.phone');_0x5f070d[_0xe3fc('0x41')]('c.mobile');_0x5f070d[_0xe3fc('0x41')](_0xe3fc('0x82'));_0x5f070d['field'](_0xe3fc('0x83'));_0x5f070d[_0xe3fc('0x41')](_0xe3fc('0x84'));_0x5f070d[_0xe3fc('0x41')](_0xe3fc('0x85'));_0x5f070d[_0xe3fc('0x41')]('c.deletedAt');_0x5f070d[_0xe3fc('0x41')]('c.CompanyId');_0x5f070d[_0xe3fc('0x41')](_0xe3fc('0x86'),_0xe3fc('0x87'));}if(_0x1f93a9[_0xe3fc('0x1e')])_0x5f070d['limit'](_0x1f93a9['limit']);if(_0x1f93a9[_0xe3fc('0x1b')])_0x5f070d['offset'](_0x1f93a9[_0xe3fc('0x1b')]);return db['sequelize'][_0xe3fc('0x38')](_0x5f070d['toString'](),_0x558660);});})[_0xe3fc('0x26')](function(_0x244f06){_0x244f06['forEach'](function(_0x108278){if(_0x108278[_0xe3fc('0x87')]){_0x108278[_0xe3fc('0x88')]=[];_0x108278['TagIds'][_0xe3fc('0x53')](',')[_0xe3fc('0x55')](function(_0x4e8054){_0x108278[_0xe3fc('0x88')][_0xe3fc('0x30')](_0x3450b7[_0x4e8054]);});}delete _0x108278[_0xe3fc('0x87')];});_0x1bbf99[_0xe3fc('0x89')]=_0x244f06;return _0x1bbf99;})['then'](respondWithFilteredResult(_0x4ea173,_0x1f93a9));})['catch'](handleError(_0x4ea173,null));};exports['destroy']=function(_0x2ee21c,_0x23347d){return db[_0xe3fc('0x2d')][_0xe3fc('0x50')]({'where':{'id':_0x2ee21c[_0xe3fc('0x8a')]['id']}})['then'](handleEntityNotFound(_0x23347d,null))[_0xe3fc('0x26')](removeEntity(_0x23347d,null))['catch'](handleError(_0x23347d,null));};exports[_0xe3fc('0x8b')]=function(_0x2a731f,_0x1749e0){return db[_0xe3fc('0x2d')]['describe']()[_0xe3fc('0x26')](function(_0x6cc9d5){delete _0x6cc9d5[_0xe3fc('0x8c')];for(var _0x2ad3d1=0x0;_0x2ad3d1{}\s\\|]/g,'-');_0x3ba1d2(null,util[_0x6d9c('0x24')](_0x6d9c('0x25'),path[_0x6d9c('0x26')](_0x12efe8[_0x6d9c('0x22')],path['extname'](_0x12efe8[_0x6d9c('0x22')])),Date[_0x6d9c('0x27')](),path[_0x6d9c('0x28')](_0x12efe8['originalname'])));}})});router[_0x6d9c('0x18')]('/csv',upload[_0x6d9c('0x29')](_0x6d9c('0x2a')),controller[_0x6d9c('0x2b')]);var upload=multer({'storage':multer[_0x6d9c('0x1f')]({'destination':function(_0x7216b9,_0x3f1b1a,_0x5f2813){_0x5f2813(null,path[_0x6d9c('0x20')](config[_0x6d9c('0x2c')],_0x6d9c('0x21')));},'filename':function(_0x9dcdfd,_0x776def,_0x3525f7){_0x776def['originalname']=_0x776def[_0x6d9c('0x22')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x3525f7(null,util[_0x6d9c('0x24')]('%s-%s%s',path['basename'](_0x776def[_0x6d9c('0x22')],path['extname'](_0x776def['originalname'])),Date[_0x6d9c('0x27')](),path[_0x6d9c('0x28')](_0x776def[_0x6d9c('0x22')])));}})});router[_0x6d9c('0x18')](_0x6d9c('0x2d'),upload[_0x6d9c('0x29')](_0x6d9c('0x2a')),controller[_0x6d9c('0x2e')]);router['post'](_0x6d9c('0x2f'),auth['isAuthenticated'](),controller[_0x6d9c('0x30')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x6d9c('0x31')]);router[_0x6d9c('0x32')](_0x6d9c('0xe'),auth[_0x6d9c('0xb')](),controller[_0x6d9c('0x33')]);module[_0x6d9c('0x34')]=router; \ No newline at end of file +var _0x091a=['file','uploadCsv','root','/upload','upload','/upload/:id','import','put','/:id','update','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/describe','isAuthenticated','describe','/:id/tags','getTags','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getJscriptySessions','getJourney','post','/merge','merge','create','/create_many','bulkCreate','setTags','diskStorage','join','server/files/tmp','originalname','replace','format','%s-%s%s','basename','extname','now','/csv','single'];(function(_0x47242d,_0x13f993){var _0x30273a=function(_0x322cd2){while(--_0x322cd2){_0x47242d['push'](_0x47242d['shift']());}};_0x30273a(++_0x13f993);}(_0x091a,0x14a));var _0xa091=function(_0x4d613c,_0x55f220){_0x4d613c=_0x4d613c-0x0;var _0x301fe3=_0x091a[_0x4d613c];return _0x301fe3;};'use strict';var multer=require(_0xa091('0x0'));var util=require(_0xa091('0x1'));var path=require('path');var timeout=require(_0xa091('0x2'));var express=require(_0xa091('0x3'));var router=express[_0xa091('0x4')]();var fs_extra=require(_0xa091('0x5'));var auth=require(_0xa091('0x6'));var interaction=require(_0xa091('0x7'));var config=require(_0xa091('0x8'));var controller=require('./cmContact.controller');router[_0xa091('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0xa091('0x9')](_0xa091('0xa'),auth[_0xa091('0xb')](),controller[_0xa091('0xc')]);router[_0xa091('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0xa091('0x9')](_0xa091('0xd'),auth[_0xa091('0xb')](),controller[_0xa091('0xe')]);router[_0xa091('0x9')](_0xa091('0xf'),auth[_0xa091('0xb')](),controller[_0xa091('0x10')]);router[_0xa091('0x9')](_0xa091('0x11'),auth[_0xa091('0xb')](),controller[_0xa091('0x12')]);router['get'](_0xa091('0x13'),auth[_0xa091('0xb')](),controller['getHopperFinals']);router[_0xa091('0x9')]('/:id/jscripty_sessions',auth[_0xa091('0xb')](),controller[_0xa091('0x14')]);router['get']('/:id/journey',auth[_0xa091('0xb')](),controller[_0xa091('0x15')]);router[_0xa091('0x16')](_0xa091('0x17'),auth['isAuthenticated'](),controller[_0xa091('0x18')]);router[_0xa091('0x16')]('/',auth[_0xa091('0xb')](),controller[_0xa091('0x19')]);router[_0xa091('0x16')](_0xa091('0x1a'),auth[_0xa091('0xb')](),controller[_0xa091('0x1b')]);router[_0xa091('0x16')]('/:id/tags',auth[_0xa091('0xb')](),controller[_0xa091('0x1c')]);var upload=multer({'storage':multer[_0xa091('0x1d')]({'destination':function(_0x4063bd,_0x456fb4,_0x2b9183){_0x2b9183(null,path[_0xa091('0x1e')](config['root'],_0xa091('0x1f')));},'filename':function(_0x2bc101,_0x55f828,_0x59e51f){_0x55f828['originalname']=_0x55f828[_0xa091('0x20')][_0xa091('0x21')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x59e51f(null,util[_0xa091('0x22')](_0xa091('0x23'),path[_0xa091('0x24')](_0x55f828[_0xa091('0x20')],path[_0xa091('0x25')](_0x55f828['originalname'])),Date[_0xa091('0x26')](),path[_0xa091('0x25')](_0x55f828['originalname'])));}})});router[_0xa091('0x16')](_0xa091('0x27'),upload[_0xa091('0x28')](_0xa091('0x29')),controller[_0xa091('0x2a')]);var upload=multer({'storage':multer[_0xa091('0x1d')]({'destination':function(_0x46e2ea,_0x2f3fbd,_0x49c5f6){_0x49c5f6(null,path[_0xa091('0x1e')](config[_0xa091('0x2b')],_0xa091('0x1f')));},'filename':function(_0x4c842f,_0xa53211,_0x52d2e3){_0xa53211[_0xa091('0x20')]=_0xa53211[_0xa091('0x20')][_0xa091('0x21')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x52d2e3(null,util[_0xa091('0x22')](_0xa091('0x23'),path[_0xa091('0x24')](_0xa53211['originalname'],path[_0xa091('0x25')](_0xa53211[_0xa091('0x20')])),Date[_0xa091('0x26')](),path[_0xa091('0x25')](_0xa53211[_0xa091('0x20')])));}})});router[_0xa091('0x16')](_0xa091('0x2c'),upload['single']('file'),controller[_0xa091('0x2d')]);router[_0xa091('0x16')](_0xa091('0x2e'),auth[_0xa091('0xb')](),controller[_0xa091('0x2f')]);router[_0xa091('0x30')](_0xa091('0x31'),auth[_0xa091('0xb')](),controller[_0xa091('0x32')]);router['delete'](_0xa091('0x31'),auth['isAuthenticated'](),controller[_0xa091('0x33')]);module[_0xa091('0x34')]=router; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.attributes.js b/server/api/cmCustomField/cmCustomField.attributes.js index e6686b7..93b6ed0 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 _0x1246=['ENUM','voice','sequelize','lodash','exports','VIRTUAL','getDataValue','STRING','setDataValue','type','values','isArray','BOOLEAN'];(function(_0x54f4c6,_0x3281df){var _0x215141=function(_0x3d1ffa){while(--_0x3d1ffa){_0x54f4c6['push'](_0x54f4c6['shift']());}};_0x215141(++_0x3281df);}(_0x1246,0x1bc));var _0x6124=function(_0x3d5a46,_0x5e2a3f){_0x3d5a46=_0x3d5a46-0x0;var _0x3e60c2=_0x1246[_0x3d5a46];return _0x3e60c2;};'use strict';var Sequelize=require(_0x6124('0x0'));var _=require(_0x6124('0x1'));module[_0x6124('0x2')]={'name':{'type':Sequelize[_0x6124('0x3')],'get':function(_0x2b22c8){return this[_0x6124('0x4')]('alias');}},'alias':{'type':Sequelize[_0x6124('0x5')],'allowNull':![],'set':function(_0x2f9628){this[_0x6124('0x6')]('alias',_0x2f9628?_0x2f9628:this[_0x6124('0x4')]('name'));}},'type':{'type':Sequelize[_0x6124('0x5')],'allowNull':![]},'values':{'type':Sequelize['TEXT']('long'),'get':function(){if(this[_0x6124('0x4')](_0x6124('0x7'))==='select'){return JSON['parse'](this[_0x6124('0x4')](_0x6124('0x8')));}else{return this[_0x6124('0x4')](_0x6124('0x8'));}},'set':function(_0x1a3d80){if(Array[_0x6124('0x9')](_0x1a3d80)){this[_0x6124('0x6')](_0x6124('0x8'),JSON['stringify'](_0x1a3d80));}else{this[_0x6124('0x6')]('values',_0x1a3d80);}}},'required':{'type':Sequelize[_0x6124('0xa')],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0x6124('0xa')],'defaultValue':![]},'actionType':{'type':Sequelize[_0x6124('0xb')](_0x6124('0xc'))}}; \ No newline at end of file +var _0x23ea=['STRING','setDataValue','name','TEXT','long','type','select','parse','values','isArray','stringify','BOOLEAN','ENUM','voice','lodash','exports','getDataValue','alias'];(function(_0x16ca8d,_0x5198cf){var _0x674c3f=function(_0x2a4f30){while(--_0x2a4f30){_0x16ca8d['push'](_0x16ca8d['shift']());}};_0x674c3f(++_0x5198cf);}(_0x23ea,0xd4));var _0xa23e=function(_0x144b16,_0x528837){_0x144b16=_0x144b16-0x0;var _0x50369d=_0x23ea[_0x144b16];return _0x50369d;};'use strict';var Sequelize=require('sequelize');var _=require(_0xa23e('0x0'));module[_0xa23e('0x1')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x2aed14){return this[_0xa23e('0x2')](_0xa23e('0x3'));}},'alias':{'type':Sequelize[_0xa23e('0x4')],'allowNull':![],'set':function(_0x156670){this[_0xa23e('0x5')]('alias',_0x156670?_0x156670:this[_0xa23e('0x2')](_0xa23e('0x6')));}},'type':{'type':Sequelize[_0xa23e('0x4')],'allowNull':![]},'values':{'type':Sequelize[_0xa23e('0x7')](_0xa23e('0x8')),'get':function(){if(this[_0xa23e('0x2')](_0xa23e('0x9'))===_0xa23e('0xa')){return JSON[_0xa23e('0xb')](this[_0xa23e('0x2')](_0xa23e('0xc')));}else{return this[_0xa23e('0x2')](_0xa23e('0xc'));}},'set':function(_0x5216a2){if(Array[_0xa23e('0xd')](_0x5216a2)){this[_0xa23e('0x5')](_0xa23e('0xc'),JSON[_0xa23e('0xe')](_0x5216a2));}else{this[_0xa23e('0x5')](_0xa23e('0xc'),_0x5216a2);}}},'required':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0xa23e('0xf')],'defaultValue':![]},'actionType':{'type':Sequelize[_0xa23e('0x10')](_0xa23e('0x11'))}}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.controller.js b/server/api/cmCustomField/cmCustomField.controller.js index 0b60858..cfe9510 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 _0xfc25=['type','text','Sequelize','number','switch','BOOLEAN','defaultValue','addColumn','cm_contacts','format','cf_%d','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','name','send','index','rawAttributes','fieldName','key','model','differenceBy','map','query','keys','intersection','attributes','fields','length','order','sort','where','pick','filters','filter','VIRTUAL','merge','options','CmCustomField','include','rows','catch','show','params','includeAll','find','body','destroy','create','sequelize','TEXT'];(function(_0x24a0ff,_0x1e6192){var _0xc45157=function(_0x5160d1){while(--_0x5160d1){_0x24a0ff['push'](_0x24a0ff['shift']());}};_0xc45157(++_0x1e6192);}(_0xfc25,0x163));var _0x5fc2=function(_0x1e0cde,_0x22735b){_0x1e0cde=_0x1e0cde-0x0;var _0x41f8c5=_0xfc25[_0x1e0cde];return _0x41f8c5;};'use strict';var emlformat=require(_0x5fc2('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5fc2('0x1'));var jsonpatch=require(_0x5fc2('0x2'));var rp=require(_0x5fc2('0x3'));var moment=require(_0x5fc2('0x4'));var BPromise=require(_0x5fc2('0x5'));var Mustache=require(_0x5fc2('0x6'));var util=require(_0x5fc2('0x7'));var path=require(_0x5fc2('0x8'));var sox=require(_0x5fc2('0x9'));var csv=require(_0x5fc2('0xa'));var ejs=require(_0x5fc2('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5fc2('0xc'));var squel=require(_0x5fc2('0xd'));var crypto=require(_0x5fc2('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x5fc2('0xf'));var toCsv=require(_0x5fc2('0xa'));var querystring=require(_0x5fc2('0x10'));var Papa=require(_0x5fc2('0x11'));var Redis=require(_0x5fc2('0x12'));var authService=require(_0x5fc2('0x13'));var qs=require(_0x5fc2('0x14'));var as=require(_0x5fc2('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5fc2('0x16'))('api');var utils=require('../../config/utils');var config=require(_0x5fc2('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x147d45,_0x545c9d){_0x545c9d=_0x545c9d||0xcc;return function(_0x287035){if(_0x287035){return _0x147d45[_0x5fc2('0x18')](_0x545c9d);}return _0x147d45[_0x5fc2('0x19')](_0x545c9d)[_0x5fc2('0x1a')]();};}function respondWithResult(_0x4cbf5c,_0x1da56f){_0x1da56f=_0x1da56f||0xc8;return function(_0x45f510){if(_0x45f510){return _0x4cbf5c[_0x5fc2('0x19')](_0x1da56f)[_0x5fc2('0x1b')](_0x45f510);}};}function respondWithFilteredResult(_0x31d99f,_0x4827be){return function(_0x373dfa){if(_0x373dfa){var _0x47a645=typeof _0x4827be[_0x5fc2('0x1c')]===_0x5fc2('0x1d')&&typeof _0x4827be[_0x5fc2('0x1e')]===_0x5fc2('0x1d');var _0x2e3964=_0x373dfa['count'];var _0x524ebf=_0x47a645?0x0:_0x4827be[_0x5fc2('0x1c')];var _0x1e9753=_0x47a645?_0x373dfa[_0x5fc2('0x1f')]:_0x4827be[_0x5fc2('0x1c')]+_0x4827be[_0x5fc2('0x1e')];var _0x4862df;if(_0x1e9753>=_0x2e3964){_0x1e9753=_0x2e3964;_0x4862df=0xc8;}else{_0x4862df=0xce;}_0x31d99f[_0x5fc2('0x19')](_0x4862df);return _0x31d99f[_0x5fc2('0x20')](_0x5fc2('0x21'),_0x524ebf+'-'+_0x1e9753+'/'+_0x2e3964)['json'](_0x373dfa);}return null;};}function patchUpdates(_0x513a32){return function(_0x43503a){try{jsonpatch['apply'](_0x43503a,_0x513a32,!![]);}catch(_0x57b6a8){return BPromise[_0x5fc2('0x22')](_0x57b6a8);}return _0x43503a[_0x5fc2('0x23')]();};}function saveUpdates(_0x4edb67,_0x4be9fa){return function(_0x4f0386){if(_0x4f0386){return _0x4f0386[_0x5fc2('0x24')](_0x4edb67)['then'](function(_0xfe8ffc){return _0xfe8ffc;});}return null;};}function removeEntity(_0x2ef03d,_0x5af7b7){return function(_0x7e7ff4){if(_0x7e7ff4){return _0x7e7ff4['destroy']()[_0x5fc2('0x25')](function(){_0x2ef03d[_0x5fc2('0x19')](0xcc)[_0x5fc2('0x1a')]();});}};}function handleEntityNotFound(_0x370caf,_0x4b8d81){return function(_0x23be65){if(!_0x23be65){_0x370caf['sendStatus'](0x194);}return _0x23be65;};}function handleError(_0x2e87fc,_0x1896a2){_0x1896a2=_0x1896a2||0x1f4;return function(_0x4d4721){logger['error'](_0x4d4721['stack']);if(_0x4d4721['name']){delete _0x4d4721[_0x5fc2('0x26')];}_0x2e87fc[_0x5fc2('0x19')](_0x1896a2)[_0x5fc2('0x27')](_0x4d4721);};}exports[_0x5fc2('0x28')]=function(_0x3e7e3b,_0x15225c){var _0x44b50f={},_0x1d35b1={},_0xbcce73={'count':0x0,'rows':[]};var _0x2235d4=_['map'](db['CmCustomField'][_0x5fc2('0x29')],function(_0x42fd20){return{'name':_0x42fd20[_0x5fc2('0x2a')],'type':_0x42fd20['type'][_0x5fc2('0x2b')]};});_0x1d35b1[_0x5fc2('0x2c')]=_[_0x5fc2('0x2d')](_[_0x5fc2('0x2e')](_0x2235d4,'name'),[_0x5fc2('0x26')]);_0x1d35b1[_0x5fc2('0x2f')]=_[_0x5fc2('0x30')](_0x3e7e3b[_0x5fc2('0x2f')]);_0x1d35b1['filters']=_[_0x5fc2('0x31')](_0x1d35b1[_0x5fc2('0x2c')],_0x1d35b1[_0x5fc2('0x2f')]);_0x44b50f[_0x5fc2('0x32')]=_[_0x5fc2('0x31')](_0x1d35b1[_0x5fc2('0x2c')],qs[_0x5fc2('0x33')](_0x3e7e3b[_0x5fc2('0x2f')][_0x5fc2('0x33')]));_0x44b50f[_0x5fc2('0x32')]=_0x44b50f['attributes'][_0x5fc2('0x34')]?_0x44b50f[_0x5fc2('0x32')]:_0x1d35b1[_0x5fc2('0x2c')];if(!_0x3e7e3b[_0x5fc2('0x2f')]['hasOwnProperty']('nolimit')){_0x44b50f['limit']=qs['limit'](_0x3e7e3b[_0x5fc2('0x2f')]['limit']);_0x44b50f['offset']=qs[_0x5fc2('0x1c')](_0x3e7e3b[_0x5fc2('0x2f')][_0x5fc2('0x1c')]);}_0x44b50f[_0x5fc2('0x35')]=qs[_0x5fc2('0x36')](_0x3e7e3b['query'][_0x5fc2('0x36')]);_0x44b50f[_0x5fc2('0x37')]=qs['filters'](_[_0x5fc2('0x38')](_0x3e7e3b[_0x5fc2('0x2f')],_0x1d35b1[_0x5fc2('0x39')]),_0x2235d4);if(_0x3e7e3b[_0x5fc2('0x2f')][_0x5fc2('0x3a')]){_0x44b50f['where']=_['merge'](_0x44b50f[_0x5fc2('0x37')],{'$or':_[_0x5fc2('0x2e')](_0x2235d4,function(_0x5419b9){if(_0x5419b9['type']!==_0x5fc2('0x3b')){var _0x36d336={};_0x36d336[_0x5419b9[_0x5fc2('0x26')]]={'$like':'%'+_0x3e7e3b[_0x5fc2('0x2f')]['filter']+'%'};return _0x36d336;}})});}_0x44b50f=_[_0x5fc2('0x3c')]({},_0x44b50f,_0x3e7e3b[_0x5fc2('0x3d')]);var _0x298ebc={'where':_0x44b50f[_0x5fc2('0x37')]};return db[_0x5fc2('0x3e')]['count'](_0x298ebc)[_0x5fc2('0x25')](function(_0x54781d){_0xbcce73[_0x5fc2('0x1f')]=_0x54781d;if(_0x3e7e3b[_0x5fc2('0x2f')]['includeAll']){_0x44b50f[_0x5fc2('0x3f')]=[{'all':!![]}];}return db[_0x5fc2('0x3e')]['findAll'](_0x44b50f);})[_0x5fc2('0x25')](function(_0x50153f){_0xbcce73[_0x5fc2('0x40')]=_0x50153f;return _0xbcce73;})[_0x5fc2('0x25')](respondWithFilteredResult(_0x15225c,_0x44b50f))[_0x5fc2('0x41')](handleError(_0x15225c,null));};exports[_0x5fc2('0x42')]=function(_0x1d1950,_0x4f5ea2){var _0x105d60={'raw':!![],'where':{'id':_0x1d1950[_0x5fc2('0x43')]['id']}},_0x233e28={};_0x233e28['model']=_[_0x5fc2('0x30')](db[_0x5fc2('0x3e')]['rawAttributes']);_0x233e28[_0x5fc2('0x2f')]=_['keys'](_0x1d1950[_0x5fc2('0x2f')]);_0x233e28['filters']=_['intersection'](_0x233e28[_0x5fc2('0x2c')],_0x233e28['query']);_0x105d60['attributes']=_[_0x5fc2('0x31')](_0x233e28[_0x5fc2('0x2c')],qs['fields'](_0x1d1950['query'][_0x5fc2('0x33')]));_0x105d60['attributes']=_0x105d60[_0x5fc2('0x32')][_0x5fc2('0x34')]?_0x105d60['attributes']:_0x233e28[_0x5fc2('0x2c')];if(_0x1d1950[_0x5fc2('0x2f')][_0x5fc2('0x44')]){_0x105d60[_0x5fc2('0x3f')]=[{'all':!![]}];}_0x105d60=_[_0x5fc2('0x3c')]({},_0x105d60,_0x1d1950[_0x5fc2('0x3d')]);return db[_0x5fc2('0x3e')][_0x5fc2('0x45')](_0x105d60)['then'](handleEntityNotFound(_0x4f5ea2,null))[_0x5fc2('0x25')](respondWithResult(_0x4f5ea2,null))[_0x5fc2('0x41')](handleError(_0x4f5ea2,null));};exports[_0x5fc2('0x24')]=function(_0x8e1bf8,_0x20ec1f){if(_0x8e1bf8[_0x5fc2('0x46')]['id']){delete _0x8e1bf8['body']['id'];}return db[_0x5fc2('0x3e')][_0x5fc2('0x45')]({'where':{'id':_0x8e1bf8['params']['id']}})[_0x5fc2('0x25')](handleEntityNotFound(_0x20ec1f,null))[_0x5fc2('0x25')](saveUpdates(_0x8e1bf8[_0x5fc2('0x46')],null))['then'](respondWithResult(_0x20ec1f,null))[_0x5fc2('0x41')](handleError(_0x20ec1f,null));};exports[_0x5fc2('0x47')]=function(_0x4e20d3,_0x3742cc){return db[_0x5fc2('0x3e')][_0x5fc2('0x45')]({'where':{'id':_0x4e20d3[_0x5fc2('0x43')]['id']}})[_0x5fc2('0x25')](handleEntityNotFound(_0x3742cc,null))[_0x5fc2('0x25')](removeEntity(_0x3742cc,null))[_0x5fc2('0x41')](handleError(_0x3742cc,null));};exports[_0x5fc2('0x48')]=function(_0x52aa43,_0x37371e){var _0x345e72;return db[_0x5fc2('0x49')]['transaction'](function(_0xb463f7){return db[_0x5fc2('0x3e')][_0x5fc2('0x48')](_0x52aa43['body'],{'transaction':_0xb463f7})[_0x5fc2('0x25')](function(_0x2bfd88){_0x345e72=_0x2bfd88;var _0x13d1d6={'type':db['Sequelize'][_0x5fc2('0x4a')],'transaction':_0xb463f7};switch(_0x52aa43[_0x5fc2('0x46')][_0x5fc2('0x4b')]){case _0x5fc2('0x4c'):_0x13d1d6['type']=db[_0x5fc2('0x4d')][_0x5fc2('0x4a')];break;case _0x5fc2('0x4e'):_0x13d1d6['type']=db[_0x5fc2('0x4d')]['INTEGER'];break;case _0x5fc2('0x4f'):_0x13d1d6[_0x5fc2('0x4b')]=db[_0x5fc2('0x4d')][_0x5fc2('0x50')];_0x13d1d6[_0x5fc2('0x51')]=![];break;default:}return db[_0x5fc2('0x49')]['queryInterface'][_0x5fc2('0x52')](_0x5fc2('0x53'),util[_0x5fc2('0x54')](_0x5fc2('0x55'),_0x345e72['id']),_0x13d1d6);})['then'](function(){return _0x345e72;});})[_0x5fc2('0x25')](respondWithResult(_0x37371e,0xc9))['catch'](handleError(_0x37371e,null));}; \ No newline at end of file +var _0x6d4c=['map','CmCustomField','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','where','filter','merge','VIRTUAL','options','then','includeAll','include','findAll','rows','params','fields','find','catch','body','destroy','create','transaction','TEXT','text','Sequelize','number','INTEGER','switch','BOOLEAN','defaultValue','sequelize','addColumn','cm_contacts','cf_%d','eml-format','zip-dir','fast-json-patch','request-promise','path','to-csv','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','end','error','stack','name','send','index'];(function(_0x138f59,_0x1b53fb){var _0x3d114d=function(_0x1f9461){while(--_0x1f9461){_0x138f59['push'](_0x138f59['shift']());}};_0x3d114d(++_0x1b53fb);}(_0x6d4c,0x81));var _0xc6d4=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6d4c[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xc6d4('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc6d4('0x1'));var jsonpatch=require(_0xc6d4('0x2'));var rp=require(_0xc6d4('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xc6d4('0x4'));var sox=require('sox');var csv=require(_0xc6d4('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc6d4('0x6'));var squel=require(_0xc6d4('0x7'));var crypto=require(_0xc6d4('0x8'));var jsforce=require('jsforce');var deskjs=require(_0xc6d4('0x9'));var toCsv=require(_0xc6d4('0x5'));var querystring=require(_0xc6d4('0xa'));var Papa=require('papaparse');var Redis=require(_0xc6d4('0xb'));var authService=require('../../components/auth/service');var qs=require(_0xc6d4('0xc'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc6d4('0xd'));var logger=require(_0xc6d4('0xe'))(_0xc6d4('0xf'));var utils=require(_0xc6d4('0x10'));var config=require(_0xc6d4('0x11'));var licenseUtil=require(_0xc6d4('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x9dbf94,_0x175475){_0x175475=_0x175475||0xcc;return function(_0x55bdc3){if(_0x55bdc3){return _0x9dbf94[_0xc6d4('0x13')](_0x175475);}return _0x9dbf94[_0xc6d4('0x14')](_0x175475)['end']();};}function respondWithResult(_0x180a6f,_0x3e8f72){_0x3e8f72=_0x3e8f72||0xc8;return function(_0x2a7019){if(_0x2a7019){return _0x180a6f[_0xc6d4('0x14')](_0x3e8f72)[_0xc6d4('0x15')](_0x2a7019);}};}function respondWithFilteredResult(_0x7ef06e,_0x5f336d){return function(_0x3577a2){if(_0x3577a2){var _0xd44b74=typeof _0x5f336d[_0xc6d4('0x16')]===_0xc6d4('0x17')&&typeof _0x5f336d[_0xc6d4('0x18')]===_0xc6d4('0x17');var _0x1aa594=_0x3577a2[_0xc6d4('0x19')];var _0x514894=_0xd44b74?0x0:_0x5f336d[_0xc6d4('0x16')];var _0x987e8=_0xd44b74?_0x3577a2[_0xc6d4('0x19')]:_0x5f336d[_0xc6d4('0x16')]+_0x5f336d['limit'];var _0x21eeba;if(_0x987e8>=_0x1aa594){_0x987e8=_0x1aa594;_0x21eeba=0xc8;}else{_0x21eeba=0xce;}_0x7ef06e[_0xc6d4('0x14')](_0x21eeba);return _0x7ef06e[_0xc6d4('0x1a')](_0xc6d4('0x1b'),_0x514894+'-'+_0x987e8+'/'+_0x1aa594)[_0xc6d4('0x15')](_0x3577a2);}return null;};}function patchUpdates(_0x3ddbeb){return function(_0x3ba255){try{jsonpatch[_0xc6d4('0x1c')](_0x3ba255,_0x3ddbeb,!![]);}catch(_0x43dda0){return BPromise['reject'](_0x43dda0);}return _0x3ba255[_0xc6d4('0x1d')]();};}function saveUpdates(_0x324e70,_0x53b6e5){return function(_0x36d87a){if(_0x36d87a){return _0x36d87a[_0xc6d4('0x1e')](_0x324e70)['then'](function(_0x3afaf7){return _0x3afaf7;});}return null;};}function removeEntity(_0x46cc46,_0x480962){return function(_0x43ca23){if(_0x43ca23){return _0x43ca23['destroy']()['then'](function(){_0x46cc46[_0xc6d4('0x14')](0xcc)[_0xc6d4('0x1f')]();});}};}function handleEntityNotFound(_0x3e0cce,_0x49a45c){return function(_0x1da83e){if(!_0x1da83e){_0x3e0cce[_0xc6d4('0x13')](0x194);}return _0x1da83e;};}function handleError(_0x5b8c26,_0x2fd3ef){_0x2fd3ef=_0x2fd3ef||0x1f4;return function(_0x41e3a7){logger[_0xc6d4('0x20')](_0x41e3a7[_0xc6d4('0x21')]);if(_0x41e3a7[_0xc6d4('0x22')]){delete _0x41e3a7[_0xc6d4('0x22')];}_0x5b8c26[_0xc6d4('0x14')](_0x2fd3ef)[_0xc6d4('0x23')](_0x41e3a7);};}exports[_0xc6d4('0x24')]=function(_0x972f50,_0x24e8fe){var _0x3237a5={},_0x58bba1={},_0x3aef62={'count':0x0,'rows':[]};var _0x1d4ecb=_[_0xc6d4('0x25')](db[_0xc6d4('0x26')][_0xc6d4('0x27')],function(_0x499556){return{'name':_0x499556[_0xc6d4('0x28')],'type':_0x499556[_0xc6d4('0x29')][_0xc6d4('0x2a')]};});_0x58bba1[_0xc6d4('0x2b')]=_['differenceBy'](_['map'](_0x1d4ecb,_0xc6d4('0x22')),[_0xc6d4('0x22')]);_0x58bba1[_0xc6d4('0x2c')]=_[_0xc6d4('0x2d')](_0x972f50[_0xc6d4('0x2c')]);_0x58bba1[_0xc6d4('0x2e')]=_[_0xc6d4('0x2f')](_0x58bba1['model'],_0x58bba1[_0xc6d4('0x2c')]);_0x3237a5['attributes']=_['intersection'](_0x58bba1['model'],qs['fields'](_0x972f50[_0xc6d4('0x2c')]['fields']));_0x3237a5[_0xc6d4('0x30')]=_0x3237a5[_0xc6d4('0x30')][_0xc6d4('0x31')]?_0x3237a5[_0xc6d4('0x30')]:_0x58bba1['model'];if(!_0x972f50[_0xc6d4('0x2c')][_0xc6d4('0x32')](_0xc6d4('0x33'))){_0x3237a5[_0xc6d4('0x18')]=qs[_0xc6d4('0x18')](_0x972f50[_0xc6d4('0x2c')][_0xc6d4('0x18')]);_0x3237a5['offset']=qs['offset'](_0x972f50['query'][_0xc6d4('0x16')]);}_0x3237a5[_0xc6d4('0x34')]=qs['sort'](_0x972f50['query']['sort']);_0x3237a5[_0xc6d4('0x35')]=qs['filters'](_['pick'](_0x972f50[_0xc6d4('0x2c')],_0x58bba1[_0xc6d4('0x2e')]),_0x1d4ecb);if(_0x972f50[_0xc6d4('0x2c')][_0xc6d4('0x36')]){_0x3237a5[_0xc6d4('0x35')]=_[_0xc6d4('0x37')](_0x3237a5[_0xc6d4('0x35')],{'$or':_['map'](_0x1d4ecb,function(_0x15cb8f){if(_0x15cb8f['type']!==_0xc6d4('0x38')){var _0x540724={};_0x540724[_0x15cb8f[_0xc6d4('0x22')]]={'$like':'%'+_0x972f50[_0xc6d4('0x2c')][_0xc6d4('0x36')]+'%'};return _0x540724;}})});}_0x3237a5=_['merge']({},_0x3237a5,_0x972f50[_0xc6d4('0x39')]);var _0xcf93fc={'where':_0x3237a5['where']};return db[_0xc6d4('0x26')][_0xc6d4('0x19')](_0xcf93fc)[_0xc6d4('0x3a')](function(_0x4c1aaf){_0x3aef62['count']=_0x4c1aaf;if(_0x972f50[_0xc6d4('0x2c')][_0xc6d4('0x3b')]){_0x3237a5[_0xc6d4('0x3c')]=[{'all':!![]}];}return db[_0xc6d4('0x26')][_0xc6d4('0x3d')](_0x3237a5);})[_0xc6d4('0x3a')](function(_0x196a31){_0x3aef62[_0xc6d4('0x3e')]=_0x196a31;return _0x3aef62;})[_0xc6d4('0x3a')](respondWithFilteredResult(_0x24e8fe,_0x3237a5))['catch'](handleError(_0x24e8fe,null));};exports['show']=function(_0x1589dc,_0x195752){var _0x3c1ed9={'raw':!![],'where':{'id':_0x1589dc[_0xc6d4('0x3f')]['id']}},_0x2eadcd={};_0x2eadcd[_0xc6d4('0x2b')]=_['keys'](db[_0xc6d4('0x26')]['rawAttributes']);_0x2eadcd[_0xc6d4('0x2c')]=_[_0xc6d4('0x2d')](_0x1589dc[_0xc6d4('0x2c')]);_0x2eadcd[_0xc6d4('0x2e')]=_[_0xc6d4('0x2f')](_0x2eadcd[_0xc6d4('0x2b')],_0x2eadcd[_0xc6d4('0x2c')]);_0x3c1ed9[_0xc6d4('0x30')]=_['intersection'](_0x2eadcd[_0xc6d4('0x2b')],qs['fields'](_0x1589dc['query'][_0xc6d4('0x40')]));_0x3c1ed9[_0xc6d4('0x30')]=_0x3c1ed9[_0xc6d4('0x30')][_0xc6d4('0x31')]?_0x3c1ed9[_0xc6d4('0x30')]:_0x2eadcd[_0xc6d4('0x2b')];if(_0x1589dc[_0xc6d4('0x2c')][_0xc6d4('0x3b')]){_0x3c1ed9[_0xc6d4('0x3c')]=[{'all':!![]}];}_0x3c1ed9=_[_0xc6d4('0x37')]({},_0x3c1ed9,_0x1589dc[_0xc6d4('0x39')]);return db[_0xc6d4('0x26')][_0xc6d4('0x41')](_0x3c1ed9)[_0xc6d4('0x3a')](handleEntityNotFound(_0x195752,null))[_0xc6d4('0x3a')](respondWithResult(_0x195752,null))[_0xc6d4('0x42')](handleError(_0x195752,null));};exports[_0xc6d4('0x1e')]=function(_0x557556,_0x3ae7d8){if(_0x557556[_0xc6d4('0x43')]['id']){delete _0x557556[_0xc6d4('0x43')]['id'];}return db['CmCustomField'][_0xc6d4('0x41')]({'where':{'id':_0x557556[_0xc6d4('0x3f')]['id']}})[_0xc6d4('0x3a')](handleEntityNotFound(_0x3ae7d8,null))[_0xc6d4('0x3a')](saveUpdates(_0x557556[_0xc6d4('0x43')],null))[_0xc6d4('0x3a')](respondWithResult(_0x3ae7d8,null))['catch'](handleError(_0x3ae7d8,null));};exports[_0xc6d4('0x44')]=function(_0x59d44b,_0xe7e63a){return db[_0xc6d4('0x26')][_0xc6d4('0x41')]({'where':{'id':_0x59d44b[_0xc6d4('0x3f')]['id']}})[_0xc6d4('0x3a')](handleEntityNotFound(_0xe7e63a,null))[_0xc6d4('0x3a')](removeEntity(_0xe7e63a,null))[_0xc6d4('0x42')](handleError(_0xe7e63a,null));};exports[_0xc6d4('0x45')]=function(_0x58235c,_0x187664){var _0x559391;return db['sequelize'][_0xc6d4('0x46')](function(_0x46c8aa){return db[_0xc6d4('0x26')][_0xc6d4('0x45')](_0x58235c[_0xc6d4('0x43')],{'transaction':_0x46c8aa})['then'](function(_0xfc12cd){_0x559391=_0xfc12cd;var _0x2a4c3b={'type':db['Sequelize'][_0xc6d4('0x47')],'transaction':_0x46c8aa};switch(_0x58235c[_0xc6d4('0x43')][_0xc6d4('0x29')]){case _0xc6d4('0x48'):_0x2a4c3b[_0xc6d4('0x29')]=db[_0xc6d4('0x49')][_0xc6d4('0x47')];break;case _0xc6d4('0x4a'):_0x2a4c3b['type']=db[_0xc6d4('0x49')][_0xc6d4('0x4b')];break;case _0xc6d4('0x4c'):_0x2a4c3b['type']=db[_0xc6d4('0x49')][_0xc6d4('0x4d')];_0x2a4c3b[_0xc6d4('0x4e')]=![];break;default:}return db[_0xc6d4('0x4f')]['queryInterface'][_0xc6d4('0x50')](_0xc6d4('0x51'),util['format'](_0xc6d4('0x52'),_0x559391['id']),_0x2a4c3b);})[_0xc6d4('0x3a')](function(){return _0x559391;});})[_0xc6d4('0x3a')](respondWithResult(_0x187664,0xc9))[_0xc6d4('0x42')](handleError(_0x187664,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index 8d40c9a..78fb2bf 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 _0xa55c=['util','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','CmCustomField','lodash'];(function(_0x1776b7,_0x2fb32e){var _0x50543c=function(_0x1de375){while(--_0x1de375){_0x1776b7['push'](_0x1776b7['shift']());}};_0x50543c(++_0x2fb32e);}(_0xa55c,0x6d));var _0xca55=function(_0x6a4611,_0x529a49){_0x6a4611=_0x6a4611-0x0;var _0x2f2a8b=_0xa55c[_0x6a4611];return _0x2f2a8b;};'use strict';var _=require(_0xca55('0x0'));var util=require(_0xca55('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xca55('0x2'));var BPromise=require(_0xca55('0x3'));var rp=require(_0xca55('0x4'));var fs=require('fs');var path=require(_0xca55('0x5'));var rimraf=require(_0xca55('0x6'));var config=require(_0xca55('0x7'));var attributes=require('./cmCustomField.attributes');module[_0xca55('0x8')]=function(_0x37a371,_0x142b78){return _0x37a371[_0xca55('0x9')](_0xca55('0xa'),attributes,{'tableName':'cm_custom_fields','paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x809c=['api','moment','bluebird','request-promise','path','rimraf','./cmCustomField.attributes','exports','CmCustomField','cm_custom_fields','util','../../config/logger'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x809c,0x15a));var _0xc809=function(_0x256fb7,_0x4150de){_0x256fb7=_0x256fb7-0x0;var _0x401c7b=_0x809c[_0x256fb7];return _0x401c7b;};'use strict';var _=require('lodash');var util=require(_0xc809('0x0'));var logger=require(_0xc809('0x1'))(_0xc809('0x2'));var moment=require(_0xc809('0x3'));var BPromise=require(_0xc809('0x4'));var rp=require(_0xc809('0x5'));var fs=require('fs');var path=require(_0xc809('0x6'));var rimraf=require(_0xc809('0x7'));var config=require('../../config/environment');var attributes=require(_0xc809('0x8'));module[_0xc809('0x9')]=function(_0xf6533b,_0x17395b){return _0xf6533b['define'](_0xc809('0xa'),attributes,{'tableName':_0xc809('0xb'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.rpc.js b/server/api/cmCustomField/cmCustomField.rpc.js index 91ff507..f9dc05e 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 _0x0396=['then','info','CmCustomField,\x20%s,\x20%s','debug','CmCustomField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x725b8e,_0xc22b48){var _0x43ac45=function(_0x46bb4a){while(--_0x46bb4a){_0x725b8e['push'](_0x725b8e['shift']());}};_0x43ac45(++_0xc22b48);}(_0x0396,0xb4));var _0x6039=function(_0x5608a3,_0x5b33c5){_0x5608a3=_0x5608a3-0x0;var _0x1ed50a=_0x0396[_0x5608a3];return _0x1ed50a;};'use strict';var _=require(_0x6039('0x0'));var util=require(_0x6039('0x1'));var moment=require(_0x6039('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6039('0x3'));var db=require(_0x6039('0x4'))['db'];var utils=require(_0x6039('0x5'));var logger=require(_0x6039('0x6'))(_0x6039('0x7'));var config=require(_0x6039('0x8'));var jayson=require(_0x6039('0x9'));var client=jayson[_0x6039('0xa')][_0x6039('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x402da8,_0x4d5527,_0x4c8e07){return new BPromise(function(_0x34d1ae,_0x3495b4){return client['request'](_0x402da8,_0x4c8e07)[_0x6039('0xc')](function(_0x2ef167){logger[_0x6039('0xd')](_0x6039('0xe'),_0x4d5527,'request\x20sent');logger[_0x6039('0xf')](_0x6039('0x10'),_0x4d5527,_0x6039('0x11'),JSON[_0x6039('0x12')](_0x2ef167));if(_0x2ef167['error']){if(_0x2ef167[_0x6039('0x13')][_0x6039('0x14')]===0x1f4){logger[_0x6039('0x13')](_0x6039('0xe'),_0x4d5527,_0x2ef167[_0x6039('0x13')][_0x6039('0x15')]);return _0x3495b4(_0x2ef167[_0x6039('0x13')][_0x6039('0x15')]);}logger[_0x6039('0x13')](_0x6039('0xe'),_0x4d5527,_0x2ef167[_0x6039('0x13')]['message']);return _0x34d1ae(_0x2ef167[_0x6039('0x13')][_0x6039('0x15')]);}else{logger[_0x6039('0xd')](_0x6039('0xe'),_0x4d5527,_0x6039('0x11'));_0x34d1ae(_0x2ef167[_0x6039('0x16')][_0x6039('0x15')]);}})[_0x6039('0x17')](function(_0x20deb0){logger['error']('CmCustomField,\x20%s,\x20%s',_0x4d5527,_0x20deb0);_0x3495b4(_0x20deb0);});});} \ No newline at end of file +var _0x3c79=['result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','CmCustomField,\x20%s,\x20%s','request\x20sent','debug','CmCustomField,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x311608,_0x74a560){var _0x44542d=function(_0x242c05){while(--_0x242c05){_0x311608['push'](_0x311608['shift']());}};_0x44542d(++_0x74a560);}(_0x3c79,0xff));var _0x93c7=function(_0x3aea93,_0x2cd9fe){_0x3aea93=_0x3aea93-0x0;var _0x12bfa1=_0x3c79[_0x3aea93];return _0x12bfa1;};'use strict';var _=require(_0x93c7('0x0'));var util=require('util');var moment=require(_0x93c7('0x1'));var BPromise=require(_0x93c7('0x2'));var rs=require(_0x93c7('0x3'));var fs=require('fs');var Redis=require(_0x93c7('0x4'));var db=require(_0x93c7('0x5'))['db'];var utils=require(_0x93c7('0x6'));var logger=require(_0x93c7('0x7'))(_0x93c7('0x8'));var config=require(_0x93c7('0x9'));var jayson=require(_0x93c7('0xa'));var client=jayson[_0x93c7('0xb')][_0x93c7('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xde206b,_0x2619ec,_0x4b1768){return new BPromise(function(_0x576ad9,_0x2961e5){return client['request'](_0xde206b,_0x4b1768)['then'](function(_0x21d058){logger['info'](_0x93c7('0xd'),_0x2619ec,_0x93c7('0xe'));logger[_0x93c7('0xf')](_0x93c7('0x10'),_0x2619ec,'request\x20sent',JSON[_0x93c7('0x11')](_0x21d058));if(_0x21d058[_0x93c7('0x12')]){if(_0x21d058[_0x93c7('0x12')][_0x93c7('0x13')]===0x1f4){logger[_0x93c7('0x12')](_0x93c7('0xd'),_0x2619ec,_0x21d058[_0x93c7('0x12')]['message']);return _0x2961e5(_0x21d058['error']['message']);}logger[_0x93c7('0x12')](_0x93c7('0xd'),_0x2619ec,_0x21d058[_0x93c7('0x12')]['message']);return _0x576ad9(_0x21d058[_0x93c7('0x12')][_0x93c7('0x14')]);}else{logger['info'](_0x93c7('0xd'),_0x2619ec,_0x93c7('0xe'));_0x576ad9(_0x21d058[_0x93c7('0x15')][_0x93c7('0x14')]);}})[_0x93c7('0x16')](function(_0x4a013f){logger[_0x93c7('0x12')](_0x93c7('0xd'),_0x2619ec,_0x4a013f);_0x2961e5(_0x4a013f);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index 1d70b06..01b4fc6 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 _0x46cb=['./cmCustomField.controller','get','isAuthenticated','index','/:id','post','create','put','destroy','exports','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x3cefbb,_0x1bfb4e){var _0xb62b94=function(_0x51cd66){while(--_0x51cd66){_0x3cefbb['push'](_0x3cefbb['shift']());}};_0xb62b94(++_0x1bfb4e);}(_0x46cb,0xd6));var _0xb46c=function(_0xad15c7,_0x210cb4){_0xad15c7=_0xad15c7-0x0;var _0x520045=_0x46cb[_0xad15c7];return _0x520045;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xb46c('0x0'));var express=require(_0xb46c('0x1'));var router=express[_0xb46c('0x2')]();var fs_extra=require(_0xb46c('0x3'));var auth=require(_0xb46c('0x4'));var interaction=require(_0xb46c('0x5'));var config=require(_0xb46c('0x6'));var controller=require(_0xb46c('0x7'));router[_0xb46c('0x8')]('/',auth[_0xb46c('0x9')](),controller[_0xb46c('0xa')]);router[_0xb46c('0x8')](_0xb46c('0xb'),auth[_0xb46c('0x9')](),controller['show']);router[_0xb46c('0xc')]('/',auth[_0xb46c('0x9')](),controller[_0xb46c('0xd')]);router[_0xb46c('0xe')](_0xb46c('0xb'),auth['isAuthenticated'](),controller['update']);router['delete'](_0xb46c('0xb'),auth[_0xb46c('0x9')](),controller[_0xb46c('0xf')]);module[_0xb46c('0x10')]=router; \ No newline at end of file +var _0xdf3b=['destroy','exports','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./cmCustomField.controller','get','isAuthenticated','index','/:id','create','update'];(function(_0x390f35,_0x3a7e7b){var _0x43a987=function(_0x114678){while(--_0x114678){_0x390f35['push'](_0x390f35['shift']());}};_0x43a987(++_0x3a7e7b);}(_0xdf3b,0x172));var _0xbdf3=function(_0x4d821c,_0x22bd0e){_0x4d821c=_0x4d821c-0x0;var _0x15dd5b=_0xdf3b[_0x4d821c];return _0x15dd5b;};'use strict';var multer=require('multer');var util=require(_0xbdf3('0x0'));var path=require('path');var timeout=require(_0xbdf3('0x1'));var express=require(_0xbdf3('0x2'));var router=express[_0xbdf3('0x3')]();var fs_extra=require(_0xbdf3('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xbdf3('0x5'));var config=require(_0xbdf3('0x6'));var controller=require(_0xbdf3('0x7'));router[_0xbdf3('0x8')]('/',auth[_0xbdf3('0x9')](),controller[_0xbdf3('0xa')]);router[_0xbdf3('0x8')](_0xbdf3('0xb'),auth[_0xbdf3('0x9')](),controller['show']);router['post']('/',auth[_0xbdf3('0x9')](),controller[_0xbdf3('0xc')]);router['put'](_0xbdf3('0xb'),auth[_0xbdf3('0x9')](),controller[_0xbdf3('0xd')]);router['delete'](_0xbdf3('0xb'),auth[_0xbdf3('0x9')](),controller[_0xbdf3('0xe')]);module[_0xbdf3('0xf')]=router; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.attributes.js b/server/api/cmHopper/cmHopper.attributes.js index bae9c47..f0f3503 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 _0xe5e6=['exports','STRING','BOOLEAN','format','YYYY-MM-DD\x20HH:mm:ss','INTEGER','DATE','UNSIGNED','contactListQueue','sequelize'];(function(_0x51b96e,_0x1add51){var _0x46b4d9=function(_0x22572a){while(--_0x22572a){_0x51b96e['push'](_0x51b96e['shift']());}};_0x46b4d9(++_0x1add51);}(_0xe5e6,0x1e9));var _0x6e5e=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xe5e6[_0x20a584];return _0x4b41a8;};'use strict';var moment=require('moment');var Sequelize=require(_0x6e5e('0x0'));module[_0x6e5e('0x1')]={'phone':{'type':Sequelize[_0x6e5e('0x2')],'allowNull':![]},'active':{'type':Sequelize[_0x6e5e('0x3')],'defaultValue':![]},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':moment()[_0x6e5e('0x4')](_0x6e5e('0x5'))},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x6e5e('0x6')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x6e5e('0x6')],'defaultValue':0x0},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0x6e5e('0x7')]},'priority':{'type':Sequelize[_0x6e5e('0x6')](0x2)[_0x6e5e('0x8')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0x6e5e('0x3')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0x6e5e('0x6')],'unique':_0x6e5e('0x9')},'ListId':{'type':Sequelize[_0x6e5e('0x6')],'unique':_0x6e5e('0x9')},'UserId':{'type':Sequelize[_0x6e5e('0x6')]},'VoiceQueueId':{'type':Sequelize[_0x6e5e('0x6')],'unique':_0x6e5e('0x9')},'CampaignId':{'type':Sequelize[_0x6e5e('0x6')]},'countnosuchnumberretry':{'type':Sequelize[_0x6e5e('0x6')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x6e5e('0x6')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x6e5e('0x6')],'defaultValue':0x0}}; \ No newline at end of file +var _0x7e65=['contactListQueue','moment','sequelize','STRING','BOOLEAN','DATE','INTEGER','UNSIGNED'];(function(_0x15ca1a,_0x30fc82){var _0x507626=function(_0x14c9bc){while(--_0x14c9bc){_0x15ca1a['push'](_0x15ca1a['shift']());}};_0x507626(++_0x30fc82);}(_0x7e65,0xc9));var _0x57e6=function(_0x510f22,_0x391e2d){_0x510f22=_0x510f22-0x0;var _0x131834=_0x7e65[_0x510f22];return _0x131834;};'use strict';var moment=require(_0x57e6('0x0'));var Sequelize=require(_0x57e6('0x1'));module['exports']={'phone':{'type':Sequelize[_0x57e6('0x2')],'allowNull':![]},'active':{'type':Sequelize[_0x57e6('0x3')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0x57e6('0x4')],'defaultValue':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')},'countbusyretry':{'type':Sequelize[_0x57e6('0x5')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x57e6('0x5')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x57e6('0x5')],'defaultValue':0x0},'callback':{'type':Sequelize[_0x57e6('0x3')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x57e6('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x57e6('0x4')]},'priority':{'type':Sequelize[_0x57e6('0x5')](0x2)[_0x57e6('0x6')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0x57e6('0x3')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0x57e6('0x5')],'unique':_0x57e6('0x7')},'ListId':{'type':Sequelize[_0x57e6('0x5')],'unique':_0x57e6('0x7')},'UserId':{'type':Sequelize[_0x57e6('0x5')]},'VoiceQueueId':{'type':Sequelize['INTEGER'],'unique':_0x57e6('0x7')},'CampaignId':{'type':Sequelize[_0x57e6('0x5')]},'countnosuchnumberretry':{'type':Sequelize[_0x57e6('0x5')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x57e6('0x5')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x57e6('0x5')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x57e6('0x5')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.controller.js b/server/api/cmHopper/cmHopper.controller.js index 0c5c661..1edc21d 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 _0x8b47=['merge','VIRTUAL','options','findAll','rows','catch','show','params','keys','includeAll','include','find','create','body','describe','CampaignId','VoiceQueueId','VoiceQueue','omit','createdAt','statedesc','user','UserId','deletedat','YYYY-MM-DD\x20HH:mm:ss','phone','queue','ivr','CmContact','ContactId','lastName','isNil','firstName','calleridname','finally','getPreview','sequelize','format','direction','prev','hopperIds','priority','ASC','scheduledAt','dialOrderByScheduledAt','literal','COALESCE(CmHopper.UserId,\x200)\x20ASC','DESC','isEmpty','COALESCE(CmHopper.UserId,\x200)\x20DESC','UPDATE','CmList','dialActive','getOpenContacts','getVoiceQueues','preview','CmHopper,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','zip-dir','fast-json-patch','request-promise','moment','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','limit','count','set','Content-Range','json','apply','reject','save','update','destroy','then','error','name','send','index','CmHopper','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','$gt','$gte','$lt','$lte','$notBetween','$in','$like','$notLike','$iLike','$notILike','$overlap','$contains','$contained','$any','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter'];(function(_0x1c30aa,_0x4cd5e8){var _0x27731e=function(_0x2d07d8){while(--_0x2d07d8){_0x1c30aa['push'](_0x1c30aa['shift']());}};_0x27731e(++_0x4cd5e8);}(_0x8b47,0xbe));var _0x78b4=function(_0x4fb9ae,_0x4d2b95){_0x4fb9ae=_0x4fb9ae-0x0;var _0x4e4be7=_0x8b47[_0x4fb9ae];return _0x4e4be7;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x78b4('0x0'));var jsonpatch=require(_0x78b4('0x1'));var rp=require(_0x78b4('0x2'));var moment=require(_0x78b4('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x78b4('0x4'));var path=require('path');var sox=require(_0x78b4('0x5'));var csv=require(_0x78b4('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x78b4('0x7'));var _=require(_0x78b4('0x8'));var squel=require(_0x78b4('0x9'));var crypto=require(_0x78b4('0xa'));var jsforce=require(_0x78b4('0xb'));var deskjs=require(_0x78b4('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x78b4('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x78b4('0xe'));var as=require(_0x78b4('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x78b4('0x10'))(_0x78b4('0x11'));var utils=require(_0x78b4('0x12'));var config=require(_0x78b4('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x78b4('0x14'))['db'];function respondWithStatusCode(_0x3f8835,_0x39bd44){_0x39bd44=_0x39bd44||0xcc;return function(_0x1556c4){if(_0x1556c4){return _0x3f8835[_0x78b4('0x15')](_0x39bd44);}return _0x3f8835[_0x78b4('0x16')](_0x39bd44)[_0x78b4('0x17')]();};}function respondWithResult(_0x2866ab,_0x3751a6){_0x3751a6=_0x3751a6||0xc8;return function(_0x31c3d6){if(_0x31c3d6){return _0x2866ab['status'](_0x3751a6)['json'](_0x31c3d6);}};}function respondWithFilteredResult(_0x3b5a2e,_0x4a1606){return function(_0x226dad){if(_0x226dad){var _0x624540=typeof _0x4a1606[_0x78b4('0x18')]==='undefined'&&typeof _0x4a1606[_0x78b4('0x19')]==='undefined';var _0x2e4c37=_0x226dad[_0x78b4('0x1a')];var _0x434a25=_0x624540?0x0:_0x4a1606[_0x78b4('0x18')];var _0x2b35f8=_0x624540?_0x226dad['count']:_0x4a1606[_0x78b4('0x18')]+_0x4a1606[_0x78b4('0x19')];var _0x514daf;if(_0x2b35f8>=_0x2e4c37){_0x2b35f8=_0x2e4c37;_0x514daf=0xc8;}else{_0x514daf=0xce;}_0x3b5a2e[_0x78b4('0x16')](_0x514daf);return _0x3b5a2e[_0x78b4('0x1b')](_0x78b4('0x1c'),_0x434a25+'-'+_0x2b35f8+'/'+_0x2e4c37)[_0x78b4('0x1d')](_0x226dad);}return null;};}function patchUpdates(_0x26c4dc){return function(_0x400bd3){try{jsonpatch[_0x78b4('0x1e')](_0x400bd3,_0x26c4dc,!![]);}catch(_0xf0b5cf){return BPromise[_0x78b4('0x1f')](_0xf0b5cf);}return _0x400bd3[_0x78b4('0x20')]();};}function saveUpdates(_0x18cd9e,_0x4dbc3a){return function(_0x1e423f){if(_0x1e423f){return _0x1e423f[_0x78b4('0x21')](_0x18cd9e)['then'](function(_0x40b6d5){return _0x40b6d5;});}return null;};}function removeEntity(_0x5f04cb,_0x35a1eb){return function(_0x3d31cc){if(_0x3d31cc){return _0x3d31cc[_0x78b4('0x22')]()[_0x78b4('0x23')](function(){_0x5f04cb[_0x78b4('0x16')](0xcc)[_0x78b4('0x17')]();});}};}function handleEntityNotFound(_0x2d0f4,_0x319e0a){return function(_0x455bc0){if(!_0x455bc0){_0x2d0f4['sendStatus'](0x194);}return _0x455bc0;};}function handleError(_0x1c1755,_0x45c3ef){_0x45c3ef=_0x45c3ef||0x1f4;return function(_0x160ba0){logger[_0x78b4('0x24')](_0x160ba0['stack']);if(_0x160ba0[_0x78b4('0x25')]){delete _0x160ba0[_0x78b4('0x25')];}_0x1c1755[_0x78b4('0x16')](_0x45c3ef)[_0x78b4('0x26')](_0x160ba0);};}exports[_0x78b4('0x27')]=function(_0x23ad59,_0x2d4eef){var _0x5de5b2={},_0x32b44e={},_0x510218={'count':0x0,'rows':[]};var _0x5b4d4e=_['map'](db[_0x78b4('0x28')][_0x78b4('0x29')],function(_0xb62e16){return{'name':_0xb62e16[_0x78b4('0x2a')],'type':_0xb62e16[_0x78b4('0x2b')][_0x78b4('0x2c')]};});_0x32b44e[_0x78b4('0x2d')]=_[_0x78b4('0x2e')](_0x5b4d4e,'name');_0x32b44e['query']=_['keys'](_0x23ad59[_0x78b4('0x2f')]);_0x32b44e[_0x78b4('0x30')]=_[_0x78b4('0x31')](_0x32b44e[_0x78b4('0x2d')],_0x32b44e['query']);_0x32b44e['filters']=_['concat'](_0x32b44e[_0x78b4('0x30')],['$and','$or',_0x78b4('0x32'),_0x78b4('0x33'),_0x78b4('0x34'),_0x78b4('0x35'),'$ne','$eq','$not','$between',_0x78b4('0x36'),_0x78b4('0x37'),'$notIn',_0x78b4('0x38'),_0x78b4('0x39'),_0x78b4('0x3a'),_0x78b4('0x3b'),_0x78b4('0x38'),_0x78b4('0x3c'),_0x78b4('0x3d'),_0x78b4('0x3e'),_0x78b4('0x3f')]);_0x5de5b2[_0x78b4('0x40')]=_[_0x78b4('0x31')](_0x32b44e[_0x78b4('0x2d')],qs[_0x78b4('0x41')](_0x23ad59[_0x78b4('0x2f')][_0x78b4('0x41')]));_0x5de5b2['attributes']=_0x5de5b2['attributes'][_0x78b4('0x42')]?_0x5de5b2[_0x78b4('0x40')]:_0x32b44e['model'];if(!_0x23ad59['query'][_0x78b4('0x43')](_0x78b4('0x44'))){_0x5de5b2['limit']=qs['limit'](_0x23ad59[_0x78b4('0x2f')][_0x78b4('0x19')]);_0x5de5b2['offset']=qs['offset'](_0x23ad59[_0x78b4('0x2f')]['offset']);}_0x5de5b2[_0x78b4('0x45')]=qs[_0x78b4('0x46')](_0x23ad59[_0x78b4('0x2f')]['sort']);_0x5de5b2[_0x78b4('0x47')]=qs[_0x78b4('0x30')](_[_0x78b4('0x48')](_0x23ad59[_0x78b4('0x2f')],_0x32b44e[_0x78b4('0x30')]),_0x5b4d4e);if(_0x23ad59['query'][_0x78b4('0x49')]){_0x5de5b2[_0x78b4('0x47')]=_[_0x78b4('0x4a')](_0x5de5b2[_0x78b4('0x47')],{'$or':_['map'](_0x5b4d4e,function(_0x96b744){if(_0x96b744['type']!==_0x78b4('0x4b')){var _0x4134ba={};_0x4134ba[_0x96b744[_0x78b4('0x25')]]={'$like':'%'+_0x23ad59[_0x78b4('0x2f')][_0x78b4('0x49')]+'%'};return _0x4134ba;}})});}_0x5de5b2=_[_0x78b4('0x4a')]({},_0x5de5b2,_0x23ad59[_0x78b4('0x4c')]);var _0x2b380f={'where':_0x5de5b2['where']};return db[_0x78b4('0x28')][_0x78b4('0x1a')](_0x2b380f)[_0x78b4('0x23')](function(_0x5cf3f2){_0x510218[_0x78b4('0x1a')]=_0x5cf3f2;if(_0x23ad59[_0x78b4('0x2f')]['includeAll']){_0x5de5b2['include']=[{'all':!![]}];}return db[_0x78b4('0x28')][_0x78b4('0x4d')](_0x5de5b2);})[_0x78b4('0x23')](function(_0x3d4d62){_0x510218[_0x78b4('0x4e')]=_0x3d4d62;return _0x510218;})['then'](respondWithFilteredResult(_0x2d4eef,_0x5de5b2))[_0x78b4('0x4f')](handleError(_0x2d4eef,null));};exports[_0x78b4('0x50')]=function(_0x37316f,_0x3ff0b5){var _0x4714d6={'raw':!![],'where':{'id':_0x37316f[_0x78b4('0x51')]['id']}},_0x27b65e={};_0x27b65e['model']=_[_0x78b4('0x52')](db[_0x78b4('0x28')]['rawAttributes']);_0x27b65e[_0x78b4('0x2f')]=_[_0x78b4('0x52')](_0x37316f['query']);_0x27b65e['filters']=_[_0x78b4('0x31')](_0x27b65e[_0x78b4('0x2d')],_0x27b65e[_0x78b4('0x2f')]);_0x4714d6['attributes']=_[_0x78b4('0x31')](_0x27b65e['model'],qs[_0x78b4('0x41')](_0x37316f[_0x78b4('0x2f')]['fields']));_0x4714d6[_0x78b4('0x40')]=_0x4714d6['attributes'][_0x78b4('0x42')]?_0x4714d6[_0x78b4('0x40')]:_0x27b65e['model'];if(_0x37316f[_0x78b4('0x2f')][_0x78b4('0x53')]){_0x4714d6[_0x78b4('0x54')]=[{'all':!![]}];}_0x4714d6=_[_0x78b4('0x4a')]({},_0x4714d6,_0x37316f[_0x78b4('0x4c')]);return db[_0x78b4('0x28')][_0x78b4('0x55')](_0x4714d6)[_0x78b4('0x23')](handleEntityNotFound(_0x3ff0b5,null))[_0x78b4('0x23')](respondWithResult(_0x3ff0b5,null))[_0x78b4('0x4f')](handleError(_0x3ff0b5,null));};exports['create']=function(_0x5f0a55,_0x5a27db){return db['CmHopper'][_0x78b4('0x56')](_0x5f0a55[_0x78b4('0x57')],{})['then'](respondWithResult(_0x5a27db,0xc9))['catch'](handleError(_0x5a27db,null));};exports['update']=function(_0x1e88a2,_0x86aa45){if(_0x1e88a2[_0x78b4('0x57')]['id']){delete _0x1e88a2['body']['id'];}return db['CmHopper'][_0x78b4('0x55')]({'where':{'id':_0x1e88a2[_0x78b4('0x51')]['id']}})[_0x78b4('0x23')](handleEntityNotFound(_0x86aa45,null))[_0x78b4('0x23')](saveUpdates(_0x1e88a2[_0x78b4('0x57')],null))[_0x78b4('0x23')](respondWithResult(_0x86aa45,null))[_0x78b4('0x4f')](handleError(_0x86aa45,null));};exports[_0x78b4('0x58')]=function(_0x1be1ea,_0x5b3e9f){return db['CmHopper'][_0x78b4('0x58')]()[_0x78b4('0x23')](respondWithResult(_0x5b3e9f,null))[_0x78b4('0x4f')](handleError(_0x5b3e9f,null));};exports['destroy']=function(_0x48986d,_0x4482e4){var _0x139a45;return db[_0x78b4('0x28')][_0x78b4('0x55')]({'where':{'id':_0x48986d[_0x78b4('0x51')]['id']}})[_0x78b4('0x23')](handleEntityNotFound(_0x4482e4,null))[_0x78b4('0x23')](function(_0x5f44d2){if(_0x5f44d2){return _0x5f44d2['destroy']()['then'](function(_0x447628){return _0x447628;});}})[_0x78b4('0x23')](function(_0x49d313){_0x139a45=_0x49d313;if(_0x49d313){if(_0x49d313['VoiceQueueId']||_0x49d313[_0x78b4('0x59')]){return db[_0x49d313[_0x78b4('0x5a')]?_0x78b4('0x5b'):'Campaign']['find']({'where':{'id':_0x49d313[_0x78b4('0x5a')]?_0x49d313[_0x78b4('0x5a')]:_0x49d313[_0x78b4('0x59')]},'attributes':['id',_0x78b4('0x25')],'raw':!![]});}}})[_0x78b4('0x23')](function(_0x57cef9){var _0xc19621={};if(_0x57cef9){_['merge'](_0xc19621,_[_0x78b4('0x5c')](_0x139a45['dataValues'],[_0x78b4('0x5d'),'updatedAt','id']));_0xc19621['state']=0x15;_0xc19621[_0x78b4('0x5e')]='deleted';_0xc19621['campaign']=_0x57cef9[_0x78b4('0x25')];_0xc19621['membername']=_0x48986d[_0x78b4('0x5f')][_0x78b4('0x25')];_0xc19621[_0x78b4('0x60')]=_0x48986d[_0x78b4('0x5f')]['id'];_0xc19621['deleted']=!![];_0xc19621[_0x78b4('0x61')]=moment()['format'](_0x78b4('0x62'));_0xc19621['calleridnum']=_0x139a45[_0x78b4('0x63')];_0xc19621['campaigntype']=_0x139a45[_0x78b4('0x5a')]?_0x78b4('0x64'):_0x78b4('0x65');return db[_0x78b4('0x66')][_0x78b4('0x55')]({'where':{'id':_0xc19621[_0x78b4('0x67')]},'attributes':['firstName',_0x78b4('0x68')]})[_0x78b4('0x23')](function(_0x1f04a5){if(!_[_0x78b4('0x69')](_0x4482e4)&&!_['isNil'](_0x1f04a5[_0x78b4('0x6a')])){_0xc19621[_0x78b4('0x6b')]=_0x1f04a5[_0x78b4('0x6a')];if(!_[_0x78b4('0x69')](_0x1f04a5['lastName'])){_0xc19621[_0x78b4('0x6b')]+='\x20'+_0x1f04a5[_0x78b4('0x68')];}}})[_0x78b4('0x6c')](function(){return db['CmHopperFinal']['create'](_0xc19621);});}})['then'](function(){return _0x4482e4[_0x78b4('0x16')](0xcc)[_0x78b4('0x17')]();})[_0x78b4('0x4f')](handleError(_0x4482e4,null));};exports[_0x78b4('0x6d')]=function(_0x496896,_0x33836f,_0x4f9a4c){var _0x42d6c1=[];return db[_0x78b4('0x66')][_0x78b4('0x58')]()[_0x78b4('0x23')](function(_0x3c37f5){_0x42d6c1=_[_0x78b4('0x52')](_0x3c37f5);return _0x496896['user']['getVoiceQueues']({'where':{'type':'outbound','dialActive':!![],'dialMethod':'preview'},'attributes':['id','dialOrderByScheduledAt'],'raw':!![]});})['then'](function(_0x4721b5){if(_0x4721b5&&_0x4721b5[_0x78b4('0x42')]){return db[_0x78b4('0x6e')]['transaction'](function(_0x439383){var _0x5d13bd={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x78b4('0x6f')](_0x78b4('0x62'))},'VoiceQueueId':{'$in':_['map'](_0x4721b5,'id')},'$or':[{'UserId':null},{'UserId':_0x496896[_0x78b4('0x5f')]['id']}]};var _0x2b6c72=[];if(_0x496896['body']['direction']&&_0x496896[_0x78b4('0x57')][_0x78b4('0x70')]===_0x78b4('0x71')){if(!_['isEmpty'](_0x496896['body'][_0x78b4('0x72')])){_0x5d13bd['id']={'$in':_0x496896['body'][_0x78b4('0x72')]};}_0x2b6c72=[[_0x78b4('0x73'),_0x78b4('0x74')],[_0x78b4('0x75'),_0x4721b5[0x0][_0x78b4('0x76')]==='ASC'?'DESC':_0x78b4('0x74')],db['sequelize'][_0x78b4('0x77')](_0x78b4('0x78')),['id',_0x78b4('0x79')]];}else{if(!_[_0x78b4('0x7a')](_0x496896[_0x78b4('0x57')][_0x78b4('0x72')])){_0x5d13bd['id']={'$notIn':_0x496896[_0x78b4('0x57')]['hopperIds']};}_0x2b6c72=[[_0x78b4('0x73'),_0x78b4('0x79')],[_0x78b4('0x75'),_0x4721b5[0x0]['dialOrderByScheduledAt']],db[_0x78b4('0x6e')][_0x78b4('0x77')](_0x78b4('0x7b')),['id','ASC']];}return db[_0x78b4('0x28')]['findOne']({'attributes':['id','scheduledat'],'where':_0x5d13bd,'order':_0x2b6c72,'transaction':_0x439383,'lock':_0x439383['LOCK'][_0x78b4('0x7c')],'include':[{'model':db[_0x78b4('0x66')],'as':'Contact','attributes':_0x42d6c1,'include':[{'model':db['CmCompany'],'as':'Company','attributes':['id',_0x78b4('0x25')]}]},{'model':db[_0x78b4('0x7d')],'as':'List','attributes':['id','name']},{'model':db[_0x78b4('0x5b')],'as':'Queue','attributes':['id',_0x78b4('0x25'),_0x78b4('0x7e')]}]})[_0x78b4('0x23')](function(_0x340172){if(_0x340172){return _0x340172['update']({'UserId':_0x496896[_0x78b4('0x5f')]['id']},{'transaction':_0x439383});}});});}})['then'](handleEntityNotFound(_0x33836f,null))['then'](respondWithResult(_0x33836f,null))[_0x78b4('0x4f')](handleError(_0x33836f,null));};exports[_0x78b4('0x7f')]=function(_0x4cf420,_0x1d1899,_0x28520b){return _0x4cf420[_0x78b4('0x5f')][_0x78b4('0x80')]({'where':{'type':'outbound','dialActive':!![],'dialMethod':_0x78b4('0x81')},'attributes':['id'],'raw':!![]})['then'](function(_0xe1dbbb){if(_0xe1dbbb&&_0xe1dbbb[_0x78b4('0x42')]){return db[_0x78b4('0x28')][_0x78b4('0x1a')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x78b4('0x6f')](_0x78b4('0x62'))},'VoiceQueueId':{'$in':_[_0x78b4('0x2e')](_0xe1dbbb,'id')},'$or':[{'UserId':null},{'UserId':_0x4cf420[_0x78b4('0x5f')]['id']}]}});}return 0x0;})[_0x78b4('0x23')](function(_0x4242d3){if(!_[_0x78b4('0x69')](_0x4242d3)&&_['isNumber'](_0x4242d3)){return _0x1d1899[_0x78b4('0x16')](0xc8)['json']({'contacts':_0x4242d3});}else{logger[_0x78b4('0x24')](_0x78b4('0x82'),_0x78b4('0x7f'),0x194,_0x78b4('0x83'));_0x1d1899[_0x78b4('0x15')](0x194);}})['catch'](handleError(_0x1d1899,null));}; \ No newline at end of file +var _0xda66=['hopperIds','scheduledAt','findOne','UPDATE','CmContact','Contact','CmCompany','CmList','List','VoiceQueue','Queue','dialActive','getOpenContacts','getVoiceQueues','outbound','isNumber','CmHopper,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','end','error','stack','name','send','index','map','CmHopper','rawAttributes','fieldName','model','keys','query','intersection','filters','concat','$and','$or','$gte','$lt','$lte','$ne','$eq','$between','$in','$notIn','$iLike','$like','$contained','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','type','VIRTUAL','merge','options','include','findAll','then','params','includeAll','find','catch','create','body','describe','VoiceQueueId','Campaign','CampaignId','dataValues','updatedAt','state','statedesc','deleted','campaign','membername','user','UserId','format','calleridnum','phone','campaigntype','ivr','ContactId','firstName','lastName','isNil','calleridname','CmHopperFinal','getPreview','preview','dialOrderByScheduledAt','sequelize','transaction','YYYY-MM-DD\x20HH:mm:ss','prev','isEmpty','priority','ASC','COALESCE(CmHopper.UserId,\x200)\x20ASC','DESC'];(function(_0x30ae5e,_0x391fc4){var _0x1f2e93=function(_0x60307d){while(--_0x60307d){_0x30ae5e['push'](_0x30ae5e['shift']());}};_0x1f2e93(++_0x391fc4);}(_0xda66,0x1c8));var _0x6da6=function(_0x48a80d,_0x1b2aaf){_0x48a80d=_0x48a80d-0x0;var _0x267bcb=_0xda66[_0x48a80d];return _0x267bcb;};'use strict';var emlformat=require(_0x6da6('0x0'));var rimraf=require(_0x6da6('0x1'));var zipdir=require(_0x6da6('0x2'));var jsonpatch=require(_0x6da6('0x3'));var rp=require(_0x6da6('0x4'));var moment=require(_0x6da6('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x6da6('0x6'));var util=require(_0x6da6('0x7'));var path=require('path');var sox=require(_0x6da6('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6da6('0x9'));var _=require(_0x6da6('0xa'));var squel=require(_0x6da6('0xb'));var crypto=require(_0x6da6('0xc'));var jsforce=require(_0x6da6('0xd'));var deskjs=require(_0x6da6('0xe'));var toCsv=require(_0x6da6('0xf'));var querystring=require(_0x6da6('0x10'));var Papa=require(_0x6da6('0x11'));var Redis=require(_0x6da6('0x12'));var authService=require(_0x6da6('0x13'));var qs=require(_0x6da6('0x14'));var as=require(_0x6da6('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x6da6('0x16'));var utils=require(_0x6da6('0x17'));var config=require(_0x6da6('0x18'));var licenseUtil=require(_0x6da6('0x19'));var db=require(_0x6da6('0x1a'))['db'];function respondWithStatusCode(_0x32dd4e,_0x555eca){_0x555eca=_0x555eca||0xcc;return function(_0x3fa4b2){if(_0x3fa4b2){return _0x32dd4e[_0x6da6('0x1b')](_0x555eca);}return _0x32dd4e[_0x6da6('0x1c')](_0x555eca)['end']();};}function respondWithResult(_0x180726,_0x4dfa87){_0x4dfa87=_0x4dfa87||0xc8;return function(_0x581435){if(_0x581435){return _0x180726[_0x6da6('0x1c')](_0x4dfa87)[_0x6da6('0x1d')](_0x581435);}};}function respondWithFilteredResult(_0x3b7b01,_0x1fbd1a){return function(_0x395556){if(_0x395556){var _0x457030=typeof _0x1fbd1a[_0x6da6('0x1e')]===_0x6da6('0x1f')&&typeof _0x1fbd1a[_0x6da6('0x20')]===_0x6da6('0x1f');var _0x435df2=_0x395556['count'];var _0x249e91=_0x457030?0x0:_0x1fbd1a[_0x6da6('0x1e')];var _0x4dbc07=_0x457030?_0x395556[_0x6da6('0x21')]:_0x1fbd1a[_0x6da6('0x1e')]+_0x1fbd1a['limit'];var _0x10473d;if(_0x4dbc07>=_0x435df2){_0x4dbc07=_0x435df2;_0x10473d=0xc8;}else{_0x10473d=0xce;}_0x3b7b01[_0x6da6('0x1c')](_0x10473d);return _0x3b7b01[_0x6da6('0x22')](_0x6da6('0x23'),_0x249e91+'-'+_0x4dbc07+'/'+_0x435df2)[_0x6da6('0x1d')](_0x395556);}return null;};}function patchUpdates(_0x403cb0){return function(_0x18bc06){try{jsonpatch[_0x6da6('0x24')](_0x18bc06,_0x403cb0,!![]);}catch(_0x4a75e3){return BPromise[_0x6da6('0x25')](_0x4a75e3);}return _0x18bc06[_0x6da6('0x26')]();};}function saveUpdates(_0x3bc107,_0x47b574){return function(_0x360c5a){if(_0x360c5a){return _0x360c5a[_0x6da6('0x27')](_0x3bc107)['then'](function(_0x40452c){return _0x40452c;});}return null;};}function removeEntity(_0x392491,_0x259e56){return function(_0xfb3a2a){if(_0xfb3a2a){return _0xfb3a2a[_0x6da6('0x28')]()['then'](function(){_0x392491[_0x6da6('0x1c')](0xcc)[_0x6da6('0x29')]();});}};}function handleEntityNotFound(_0x54dfc6,_0x17251e){return function(_0x2610e9){if(!_0x2610e9){_0x54dfc6[_0x6da6('0x1b')](0x194);}return _0x2610e9;};}function handleError(_0x3d9709,_0x5819c2){_0x5819c2=_0x5819c2||0x1f4;return function(_0x346a1a){logger[_0x6da6('0x2a')](_0x346a1a[_0x6da6('0x2b')]);if(_0x346a1a[_0x6da6('0x2c')]){delete _0x346a1a[_0x6da6('0x2c')];}_0x3d9709['status'](_0x5819c2)[_0x6da6('0x2d')](_0x346a1a);};}exports[_0x6da6('0x2e')]=function(_0x20e221,_0x5909a1){var _0x1c7bc1={},_0x63cd6e={},_0x297262={'count':0x0,'rows':[]};var _0x1fdb04=_[_0x6da6('0x2f')](db[_0x6da6('0x30')][_0x6da6('0x31')],function(_0x58e0fb){return{'name':_0x58e0fb[_0x6da6('0x32')],'type':_0x58e0fb['type']['key']};});_0x63cd6e[_0x6da6('0x33')]=_['map'](_0x1fdb04,_0x6da6('0x2c'));_0x63cd6e['query']=_[_0x6da6('0x34')](_0x20e221[_0x6da6('0x35')]);_0x63cd6e['filters']=_[_0x6da6('0x36')](_0x63cd6e[_0x6da6('0x33')],_0x63cd6e['query']);_0x63cd6e[_0x6da6('0x37')]=_[_0x6da6('0x38')](_0x63cd6e['filters'],[_0x6da6('0x39'),_0x6da6('0x3a'),'$gt',_0x6da6('0x3b'),_0x6da6('0x3c'),_0x6da6('0x3d'),_0x6da6('0x3e'),_0x6da6('0x3f'),'$not',_0x6da6('0x40'),'$notBetween',_0x6da6('0x41'),_0x6da6('0x42'),'$like','$notLike',_0x6da6('0x43'),'$notILike',_0x6da6('0x44'),'$overlap','$contains',_0x6da6('0x45'),'$any']);_0x1c7bc1[_0x6da6('0x46')]=_[_0x6da6('0x36')](_0x63cd6e[_0x6da6('0x33')],qs[_0x6da6('0x47')](_0x20e221[_0x6da6('0x35')]['fields']));_0x1c7bc1['attributes']=_0x1c7bc1[_0x6da6('0x46')][_0x6da6('0x48')]?_0x1c7bc1['attributes']:_0x63cd6e[_0x6da6('0x33')];if(!_0x20e221['query'][_0x6da6('0x49')](_0x6da6('0x4a'))){_0x1c7bc1[_0x6da6('0x20')]=qs[_0x6da6('0x20')](_0x20e221['query'][_0x6da6('0x20')]);_0x1c7bc1[_0x6da6('0x1e')]=qs[_0x6da6('0x1e')](_0x20e221[_0x6da6('0x35')][_0x6da6('0x1e')]);}_0x1c7bc1[_0x6da6('0x4b')]=qs[_0x6da6('0x4c')](_0x20e221['query']['sort']);_0x1c7bc1[_0x6da6('0x4d')]=qs[_0x6da6('0x37')](_['pick'](_0x20e221[_0x6da6('0x35')],_0x63cd6e[_0x6da6('0x37')]),_0x1fdb04);if(_0x20e221['query'][_0x6da6('0x4e')]){_0x1c7bc1[_0x6da6('0x4d')]=_['merge'](_0x1c7bc1['where'],{'$or':_[_0x6da6('0x2f')](_0x1fdb04,function(_0x5179d8){if(_0x5179d8[_0x6da6('0x4f')]!==_0x6da6('0x50')){var _0x58acc4={};_0x58acc4[_0x5179d8[_0x6da6('0x2c')]]={'$like':'%'+_0x20e221[_0x6da6('0x35')][_0x6da6('0x4e')]+'%'};return _0x58acc4;}})});}_0x1c7bc1=_[_0x6da6('0x51')]({},_0x1c7bc1,_0x20e221[_0x6da6('0x52')]);var _0x48e84b={'where':_0x1c7bc1['where']};return db['CmHopper'][_0x6da6('0x21')](_0x48e84b)['then'](function(_0x1719c9){_0x297262[_0x6da6('0x21')]=_0x1719c9;if(_0x20e221['query']['includeAll']){_0x1c7bc1[_0x6da6('0x53')]=[{'all':!![]}];}return db[_0x6da6('0x30')][_0x6da6('0x54')](_0x1c7bc1);})[_0x6da6('0x55')](function(_0x447ef3){_0x297262['rows']=_0x447ef3;return _0x297262;})['then'](respondWithFilteredResult(_0x5909a1,_0x1c7bc1))['catch'](handleError(_0x5909a1,null));};exports['show']=function(_0x1859e2,_0x2186c0){var _0x244287={'raw':!![],'where':{'id':_0x1859e2[_0x6da6('0x56')]['id']}},_0x16d1ba={};_0x16d1ba['model']=_[_0x6da6('0x34')](db[_0x6da6('0x30')][_0x6da6('0x31')]);_0x16d1ba['query']=_['keys'](_0x1859e2[_0x6da6('0x35')]);_0x16d1ba[_0x6da6('0x37')]=_[_0x6da6('0x36')](_0x16d1ba[_0x6da6('0x33')],_0x16d1ba[_0x6da6('0x35')]);_0x244287[_0x6da6('0x46')]=_['intersection'](_0x16d1ba[_0x6da6('0x33')],qs[_0x6da6('0x47')](_0x1859e2[_0x6da6('0x35')][_0x6da6('0x47')]));_0x244287[_0x6da6('0x46')]=_0x244287['attributes'][_0x6da6('0x48')]?_0x244287['attributes']:_0x16d1ba[_0x6da6('0x33')];if(_0x1859e2[_0x6da6('0x35')][_0x6da6('0x57')]){_0x244287[_0x6da6('0x53')]=[{'all':!![]}];}_0x244287=_[_0x6da6('0x51')]({},_0x244287,_0x1859e2[_0x6da6('0x52')]);return db['CmHopper'][_0x6da6('0x58')](_0x244287)[_0x6da6('0x55')](handleEntityNotFound(_0x2186c0,null))['then'](respondWithResult(_0x2186c0,null))[_0x6da6('0x59')](handleError(_0x2186c0,null));};exports[_0x6da6('0x5a')]=function(_0x3fa094,_0x1fb6d6){return db[_0x6da6('0x30')][_0x6da6('0x5a')](_0x3fa094[_0x6da6('0x5b')],{})[_0x6da6('0x55')](respondWithResult(_0x1fb6d6,0xc9))[_0x6da6('0x59')](handleError(_0x1fb6d6,null));};exports[_0x6da6('0x27')]=function(_0xb6556e,_0xf66baa){if(_0xb6556e[_0x6da6('0x5b')]['id']){delete _0xb6556e['body']['id'];}return db['CmHopper']['find']({'where':{'id':_0xb6556e[_0x6da6('0x56')]['id']}})[_0x6da6('0x55')](handleEntityNotFound(_0xf66baa,null))['then'](saveUpdates(_0xb6556e[_0x6da6('0x5b')],null))[_0x6da6('0x55')](respondWithResult(_0xf66baa,null))[_0x6da6('0x59')](handleError(_0xf66baa,null));};exports[_0x6da6('0x5c')]=function(_0x4566d8,_0x387d3f){return db[_0x6da6('0x30')][_0x6da6('0x5c')]()['then'](respondWithResult(_0x387d3f,null))['catch'](handleError(_0x387d3f,null));};exports['destroy']=function(_0x31a67e,_0x4b9cb5){var _0x192f0e;return db[_0x6da6('0x30')][_0x6da6('0x58')]({'where':{'id':_0x31a67e['params']['id']}})[_0x6da6('0x55')](handleEntityNotFound(_0x4b9cb5,null))[_0x6da6('0x55')](function(_0x37388a){if(_0x37388a){return _0x37388a[_0x6da6('0x28')]()[_0x6da6('0x55')](function(_0x5bd5f6){return _0x5bd5f6;});}})[_0x6da6('0x55')](function(_0x2ad0e3){_0x192f0e=_0x2ad0e3;if(_0x2ad0e3){if(_0x2ad0e3[_0x6da6('0x5d')]||_0x2ad0e3['CampaignId']){return db[_0x2ad0e3['VoiceQueueId']?'VoiceQueue':_0x6da6('0x5e')][_0x6da6('0x58')]({'where':{'id':_0x2ad0e3[_0x6da6('0x5d')]?_0x2ad0e3[_0x6da6('0x5d')]:_0x2ad0e3[_0x6da6('0x5f')]},'attributes':['id',_0x6da6('0x2c')],'raw':!![]});}}})['then'](function(_0x572668){var _0x419fbb={};if(_0x572668){_[_0x6da6('0x51')](_0x419fbb,_['omit'](_0x192f0e[_0x6da6('0x60')],['createdAt',_0x6da6('0x61'),'id']));_0x419fbb[_0x6da6('0x62')]=0x15;_0x419fbb[_0x6da6('0x63')]=_0x6da6('0x64');_0x419fbb[_0x6da6('0x65')]=_0x572668[_0x6da6('0x2c')];_0x419fbb[_0x6da6('0x66')]=_0x31a67e[_0x6da6('0x67')][_0x6da6('0x2c')];_0x419fbb[_0x6da6('0x68')]=_0x31a67e[_0x6da6('0x67')]['id'];_0x419fbb[_0x6da6('0x64')]=!![];_0x419fbb['deletedat']=moment()[_0x6da6('0x69')]('YYYY-MM-DD\x20HH:mm:ss');_0x419fbb[_0x6da6('0x6a')]=_0x192f0e[_0x6da6('0x6b')];_0x419fbb[_0x6da6('0x6c')]=_0x192f0e[_0x6da6('0x5d')]?'queue':_0x6da6('0x6d');return db['CmContact']['find']({'where':{'id':_0x419fbb[_0x6da6('0x6e')]},'attributes':[_0x6da6('0x6f'),_0x6da6('0x70')]})[_0x6da6('0x55')](function(_0x2ae1af){if(!_[_0x6da6('0x71')](_0x4b9cb5)&&!_[_0x6da6('0x71')](_0x2ae1af['firstName'])){_0x419fbb['calleridname']=_0x2ae1af['firstName'];if(!_[_0x6da6('0x71')](_0x2ae1af[_0x6da6('0x70')])){_0x419fbb[_0x6da6('0x72')]+='\x20'+_0x2ae1af[_0x6da6('0x70')];}}})['finally'](function(){return db[_0x6da6('0x73')][_0x6da6('0x5a')](_0x419fbb);});}})[_0x6da6('0x55')](function(){return _0x4b9cb5[_0x6da6('0x1c')](0xcc)[_0x6da6('0x29')]();})['catch'](handleError(_0x4b9cb5,null));};exports[_0x6da6('0x74')]=function(_0x55f0b6,_0x4b8c79,_0x3547c9){var _0x7ec9eb=[];return db['CmContact'][_0x6da6('0x5c')]()[_0x6da6('0x55')](function(_0x2adfae){_0x7ec9eb=_[_0x6da6('0x34')](_0x2adfae);return _0x55f0b6['user']['getVoiceQueues']({'where':{'type':'outbound','dialActive':!![],'dialMethod':_0x6da6('0x75')},'attributes':['id',_0x6da6('0x76')],'raw':!![]});})[_0x6da6('0x55')](function(_0x291349){if(_0x291349&&_0x291349[_0x6da6('0x48')]){return db[_0x6da6('0x77')][_0x6da6('0x78')](function(_0x109158){var _0x141cc1={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x6da6('0x69')](_0x6da6('0x79'))},'VoiceQueueId':{'$in':_['map'](_0x291349,'id')},'$or':[{'UserId':null},{'UserId':_0x55f0b6[_0x6da6('0x67')]['id']}]};var _0x5ebcb3=[];if(_0x55f0b6[_0x6da6('0x5b')]['direction']&&_0x55f0b6[_0x6da6('0x5b')]['direction']===_0x6da6('0x7a')){if(!_[_0x6da6('0x7b')](_0x55f0b6[_0x6da6('0x5b')]['hopperIds'])){_0x141cc1['id']={'$in':_0x55f0b6[_0x6da6('0x5b')]['hopperIds']};}_0x5ebcb3=[[_0x6da6('0x7c'),_0x6da6('0x7d')],['scheduledAt',_0x291349[0x0][_0x6da6('0x76')]===_0x6da6('0x7d')?'DESC':_0x6da6('0x7d')],db[_0x6da6('0x77')]['literal'](_0x6da6('0x7e')),['id',_0x6da6('0x7f')]];}else{if(!_[_0x6da6('0x7b')](_0x55f0b6[_0x6da6('0x5b')][_0x6da6('0x80')])){_0x141cc1['id']={'$notIn':_0x55f0b6[_0x6da6('0x5b')][_0x6da6('0x80')]};}_0x5ebcb3=[[_0x6da6('0x7c'),_0x6da6('0x7f')],[_0x6da6('0x81'),_0x291349[0x0][_0x6da6('0x76')]],db[_0x6da6('0x77')]['literal']('COALESCE(CmHopper.UserId,\x200)\x20DESC'),['id',_0x6da6('0x7d')]];}return db[_0x6da6('0x30')][_0x6da6('0x82')]({'attributes':['id','scheduledat'],'where':_0x141cc1,'order':_0x5ebcb3,'transaction':_0x109158,'lock':_0x109158['LOCK'][_0x6da6('0x83')],'include':[{'model':db[_0x6da6('0x84')],'as':_0x6da6('0x85'),'attributes':_0x7ec9eb,'include':[{'model':db[_0x6da6('0x86')],'as':'Company','attributes':['id',_0x6da6('0x2c')]}]},{'model':db[_0x6da6('0x87')],'as':_0x6da6('0x88'),'attributes':['id','name']},{'model':db[_0x6da6('0x89')],'as':_0x6da6('0x8a'),'attributes':['id',_0x6da6('0x2c'),_0x6da6('0x8b')]}]})['then'](function(_0x59d1de){if(_0x59d1de){return _0x59d1de['update']({'UserId':_0x55f0b6[_0x6da6('0x67')]['id']},{'transaction':_0x109158});}});});}})[_0x6da6('0x55')](handleEntityNotFound(_0x4b8c79,null))[_0x6da6('0x55')](respondWithResult(_0x4b8c79,null))[_0x6da6('0x59')](handleError(_0x4b8c79,null));};exports[_0x6da6('0x8c')]=function(_0x5259ca,_0x1eee3f,_0x270feb){return _0x5259ca[_0x6da6('0x67')][_0x6da6('0x8d')]({'where':{'type':_0x6da6('0x8e'),'dialActive':!![],'dialMethod':_0x6da6('0x75')},'attributes':['id'],'raw':!![]})[_0x6da6('0x55')](function(_0x25b694){if(_0x25b694&&_0x25b694[_0x6da6('0x48')]){return db['CmHopper']['count']({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x6da6('0x69')](_0x6da6('0x79'))},'VoiceQueueId':{'$in':_['map'](_0x25b694,'id')},'$or':[{'UserId':null},{'UserId':_0x5259ca[_0x6da6('0x67')]['id']}]}});}return 0x0;})['then'](function(_0x2f7e4c){if(!_[_0x6da6('0x71')](_0x2f7e4c)&&_[_0x6da6('0x8f')](_0x2f7e4c)){return _0x1eee3f[_0x6da6('0x1c')](0xc8)[_0x6da6('0x1d')]({'contacts':_0x2f7e4c});}else{logger[_0x6da6('0x2a')](_0x6da6('0x90'),_0x6da6('0x8c'),0x194,_0x6da6('0x91'));_0x1eee3f[_0x6da6('0x1b')](0x194);}})['catch'](handleError(_0x1eee3f,null));}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index f90f1e3..c9f0d0a 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 _0x5d58=['priority','bluebird','request-promise','rimraf','../../config/environment','exports','define','cm_hopper','scheduledat','phone'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5d58,0x187));var _0x85d5=function(_0x4950b8,_0x15aadf){_0x4950b8=_0x4950b8-0x0;var _0x19a4b5=_0x5d58[_0x4950b8];return _0x19a4b5;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x85d5('0x0'));var rp=require(_0x85d5('0x1'));var fs=require('fs');var path=require('path');var rimraf=require(_0x85d5('0x2'));var config=require(_0x85d5('0x3'));var attributes=require('./cmHopper.attributes');module[_0x85d5('0x4')]=function(_0x2d457a,_0x578fad){return _0x2d457a[_0x85d5('0x5')]('CmHopper',attributes,{'tableName':_0x85d5('0x6'),'paranoid':![],'indexes':[{'name':_0x85d5('0x7'),'fields':['scheduledat']},{'name':_0x85d5('0x8'),'fields':['phone']},{'name':_0x85d5('0x9'),'fields':[_0x85d5('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7096=['bluebird','request-promise','path','rimraf','../../config/environment','./cmHopper.attributes','exports','define','CmHopper','cm_hopper','scheduledat','phone','priority','util','api'];(function(_0x5d87e9,_0x3ef6b9){var _0x1b6035=function(_0x221455){while(--_0x221455){_0x5d87e9['push'](_0x5d87e9['shift']());}};_0x1b6035(++_0x3ef6b9);}(_0x7096,0x10c));var _0x6709=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0x7096[_0xae7c2f];return _0x5d7001;};'use strict';var _=require('lodash');var util=require(_0x6709('0x0'));var logger=require('../../config/logger')(_0x6709('0x1'));var moment=require('moment');var BPromise=require(_0x6709('0x2'));var rp=require(_0x6709('0x3'));var fs=require('fs');var path=require(_0x6709('0x4'));var rimraf=require(_0x6709('0x5'));var config=require(_0x6709('0x6'));var attributes=require(_0x6709('0x7'));module[_0x6709('0x8')]=function(_0x9d630f,_0xa35832){return _0x9d630f[_0x6709('0x9')](_0x6709('0xa'),attributes,{'tableName':_0x6709('0xb'),'paranoid':![],'indexes':[{'name':_0x6709('0xc'),'fields':['scheduledat']},{'name':'phone','fields':[_0x6709('0xd')]},{'name':_0x6709('0xe'),'fields':[_0x6709('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.rpc.js b/server/api/cmHopper/cmHopper.rpc.js index 8a5bc09..ac9827d 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 _0x840f=['code','CmHopper,\x20%s,\x20%s','info','message','catch','CmHopper','options','raw','where','attributes','limit','include','map','model','then','GetCmHopper','ShowCmHopper','find','CreateCmHopper','body','UpdateCmHopper','update','DestroyCmHopper','GetContactDialer','CmContact','sequelize','transaction','LOCK','UPDATE','Contact','keys','Agent','name','voicePause','length','UserId','includes','push','all','MoveContactManagedDialer','destroy','CountReScheduled','COUNT','`scheduledat`\x20>=\x20','format','\x22%s\x22','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','contactsRescheduled','GetContactRecallMe','describe','findAll','order','GetCmHopperPreview','lodash','util','moment','bluebird','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','request\x20sent','debug','CmHopper,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x2c00cb,_0x44745f){var _0x2b6b96=function(_0x3b1775){while(--_0x3b1775){_0x2c00cb['push'](_0x2c00cb['shift']());}};_0x2b6b96(++_0x44745f);}(_0x840f,0x10b));var _0xf840=function(_0x3c3021,_0x189015){_0x3c3021=_0x3c3021-0x0;var _0x347432=_0x840f[_0x3c3021];return _0x347432;};'use strict';var _=require(_0xf840('0x0'));var util=require(_0xf840('0x1'));var moment=require(_0xf840('0x2'));var BPromise=require(_0xf840('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf840('0x4'));var db=require(_0xf840('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xf840('0x6'));var config=require(_0xf840('0x7'));var jayson=require(_0xf840('0x8'));var client=jayson[_0xf840('0x9')][_0xf840('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4b59cd,_0x28d719,_0x2482cb){return new BPromise(function(_0x1b2115,_0xb86091){return client[_0xf840('0xb')](_0x4b59cd,_0x2482cb)['then'](function(_0x28675b){logger['info']('CmHopper,\x20%s,\x20%s',_0x28d719,_0xf840('0xc'));logger[_0xf840('0xd')](_0xf840('0xe'),_0x28d719,_0xf840('0xc'),JSON[_0xf840('0xf')](_0x28675b));if(_0x28675b[_0xf840('0x10')]){if(_0x28675b['error'][_0xf840('0x11')]===0x1f4){logger['error'](_0xf840('0x12'),_0x28d719,_0x28675b[_0xf840('0x10')]['message']);return _0xb86091(_0x28675b[_0xf840('0x10')]['message']);}logger[_0xf840('0x10')](_0xf840('0x12'),_0x28d719,_0x28675b[_0xf840('0x10')]['message']);return _0x1b2115(_0x28675b['error']['message']);}else{logger[_0xf840('0x13')]('CmHopper,\x20%s,\x20%s',_0x28d719,_0xf840('0xc'));_0x1b2115(_0x28675b['result'][_0xf840('0x14')]);}})[_0xf840('0x15')](function(_0x4f7642){logger[_0xf840('0x10')](_0xf840('0x12'),_0x28d719,_0x4f7642);_0xb86091(_0x4f7642);});});}exports['GetCmHopper']=function(_0x15be64){var _0x3fe0c3=this;return new Promise(function(_0x16fe1c,_0x1c39ea){return db[_0xf840('0x16')]['findAll']({'raw':_0x15be64[_0xf840('0x17')]?_0x15be64[_0xf840('0x17')][_0xf840('0x18')]===undefined?!![]:![]:!![],'where':_0x15be64['options']?_0x15be64['options'][_0xf840('0x19')]||null:null,'attributes':_0x15be64[_0xf840('0x17')]?_0x15be64[_0xf840('0x17')][_0xf840('0x1a')]||null:null,'limit':_0x15be64[_0xf840('0x17')]?_0x15be64[_0xf840('0x17')][_0xf840('0x1b')]||null:null,'include':_0x15be64[_0xf840('0x17')]?_0x15be64['options'][_0xf840('0x1c')]?_[_0xf840('0x1d')](_0x15be64[_0xf840('0x17')][_0xf840('0x1c')],function(_0x1b8155){return{'model':db[_0x1b8155[_0xf840('0x1e')]],'as':_0x1b8155['as'],'attributes':_0x1b8155[_0xf840('0x1a')],'include':_0x1b8155['include']?_['map'](_0x1b8155[_0xf840('0x1c')],function(_0x4b3499){return{'model':db[_0x4b3499[_0xf840('0x1e')]],'as':_0x4b3499['as'],'attributes':_0x4b3499[_0xf840('0x1a')],'include':_0x4b3499['include']?_[_0xf840('0x1d')](_0x4b3499[_0xf840('0x1c')],function(_0x4e3bd3){return{'model':db[_0x4e3bd3[_0xf840('0x1e')]],'as':_0x4e3bd3['as'],'attributes':_0x4e3bd3[_0xf840('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xf840('0x1f')](function(_0x120015){logger[_0xf840('0x13')](_0xf840('0x20'),_0x15be64);logger[_0xf840('0xd')]('GetCmHopper',_0x15be64,JSON[_0xf840('0xf')](_0x120015));_0x16fe1c(_0x120015);})[_0xf840('0x15')](function(_0xe078ff){logger['error'](_0xf840('0x20'),_0xe078ff[_0xf840('0x14')],_0x15be64);_0x1c39ea(_0x3fe0c3[_0xf840('0x10')](0x1f4,_0xe078ff[_0xf840('0x14')]));});});};exports[_0xf840('0x21')]=function(_0x244135){var _0x1f9c1a=this;return new Promise(function(_0x2a053b,_0x3df038){return db[_0xf840('0x16')][_0xf840('0x22')]({'raw':_0x244135[_0xf840('0x17')]?_0x244135[_0xf840('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x244135[_0xf840('0x17')]?_0x244135[_0xf840('0x17')]['where']||null:null,'attributes':_0x244135[_0xf840('0x17')]?_0x244135[_0xf840('0x17')][_0xf840('0x1a')]||null:null,'include':_0x244135[_0xf840('0x17')]?_0x244135[_0xf840('0x17')]['include']?_['map'](_0x244135[_0xf840('0x17')][_0xf840('0x1c')],function(_0x144046){return{'model':db[_0x144046[_0xf840('0x1e')]],'as':_0x144046['as'],'attributes':_0x144046['attributes'],'include':_0x144046[_0xf840('0x1c')]?_[_0xf840('0x1d')](_0x144046[_0xf840('0x1c')],function(_0x110f8d){return{'model':db[_0x110f8d[_0xf840('0x1e')]],'as':_0x110f8d['as'],'attributes':_0x110f8d[_0xf840('0x1a')],'include':_0x110f8d[_0xf840('0x1c')]?_['map'](_0x110f8d[_0xf840('0x1c')],function(_0x310fc2){return{'model':db[_0x310fc2[_0xf840('0x1e')]],'as':_0x310fc2['as'],'attributes':_0x310fc2[_0xf840('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xf840('0x1f')](function(_0x4a79b1){logger[_0xf840('0x13')](_0xf840('0x21'),_0x244135);logger[_0xf840('0xd')](_0xf840('0x21'),_0x244135,JSON[_0xf840('0xf')](_0x4a79b1));_0x2a053b(_0x4a79b1);})[_0xf840('0x15')](function(_0x6ec793){logger[_0xf840('0x10')](_0xf840('0x21'),_0x6ec793[_0xf840('0x14')],_0x244135);_0x3df038(_0x1f9c1a[_0xf840('0x10')](0x1f4,_0x6ec793[_0xf840('0x14')]));});});};exports[_0xf840('0x23')]=function(_0x522a7a){var _0x1d3602=this;return new Promise(function(_0x3a046c,_0x40be5b){return db[_0xf840('0x16')]['create'](_0x522a7a[_0xf840('0x24')],{'raw':_0x522a7a[_0xf840('0x17')]?_0x522a7a['options']['raw']===undefined?!![]:![]:!![]})[_0xf840('0x1f')](function(_0x2bdea8){logger[_0xf840('0x13')](_0xf840('0x23'),_0x522a7a);logger[_0xf840('0xd')]('CreateCmHopper',_0x522a7a,JSON[_0xf840('0xf')](_0x2bdea8));_0x3a046c(_0x2bdea8);})[_0xf840('0x15')](function(_0x372c4e){logger[_0xf840('0x10')](_0xf840('0x23'),_0x372c4e[_0xf840('0x14')],_0x522a7a);_0x40be5b(_0x1d3602[_0xf840('0x10')](0x1f4,_0x372c4e['message']));});});};exports[_0xf840('0x25')]=function(_0x444352){var _0x487090=this;return new Promise(function(_0x204814,_0x5f467b){return db[_0xf840('0x16')][_0xf840('0x26')](_0x444352[_0xf840('0x24')],{'raw':_0x444352[_0xf840('0x17')]?_0x444352[_0xf840('0x17')][_0xf840('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x444352[_0xf840('0x17')]?_0x444352['options']['where']||null:null,'attributes':_0x444352['options']?_0x444352[_0xf840('0x17')]['attributes']||null:null,'limit':_0x444352[_0xf840('0x17')]?_0x444352[_0xf840('0x17')][_0xf840('0x1b')]||null:null})[_0xf840('0x1f')](function(_0x28df2b){logger[_0xf840('0x13')](_0xf840('0x25'),_0x444352);logger[_0xf840('0xd')]('UpdateCmHopper',_0x444352,JSON[_0xf840('0xf')](_0x28df2b));_0x204814(_0x28df2b);})[_0xf840('0x15')](function(_0x1a7545){logger[_0xf840('0x10')](_0xf840('0x25'),_0x1a7545[_0xf840('0x14')],_0x444352);_0x5f467b(_0x487090['error'](0x1f4,_0x1a7545['message']));});});};exports[_0xf840('0x27')]=function(_0x102391){var _0x8a8704=this;return new Promise(function(_0x5b2061,_0x4226df){return db[_0xf840('0x16')]['destroy']({'where':_0x102391[_0xf840('0x17')]?_0x102391[_0xf840('0x17')][_0xf840('0x19')]||null:null})[_0xf840('0x1f')](function(_0x3418fb){logger[_0xf840('0x13')]('DestroyCmHopper',_0x102391);logger[_0xf840('0xd')](_0xf840('0x27'),_0x102391,JSON[_0xf840('0xf')](_0x3418fb));_0x5b2061(_0x3418fb);})[_0xf840('0x15')](function(_0x23eb8e){logger[_0xf840('0x10')]('DestroyCmHopper',_0x23eb8e[_0xf840('0x14')],_0x102391);_0x4226df(_0x8a8704[_0xf840('0x10')](0x1f4,_0x23eb8e[_0xf840('0x14')]));});});};exports[_0xf840('0x28')]=function(_0x8f8f49){var _0x6642bc=this;return new Promise(function(_0x31a008,_0x26c3e4){return db[_0xf840('0x29')]['describe']()[_0xf840('0x1f')](function(_0x4d292c){return db[_0xf840('0x2a')][_0xf840('0x2b')](function(_0x3321d0){return db[_0xf840('0x16')]['findAll']({'where':_0x8f8f49['options']?_0x8f8f49['options'][_0xf840('0x19')]||null:null,'attributes':_0x8f8f49[_0xf840('0x17')]?_0x8f8f49['options'][_0xf840('0x1a')]||null:null,'limit':_0x8f8f49['options']?_0x8f8f49[_0xf840('0x17')][_0xf840('0x1b')]||null:null,'order':_0x8f8f49[_0xf840('0x17')]?_0x8f8f49['options']['order']||null:null,'transaction':_0x3321d0,'lock':_0x3321d0[_0xf840('0x2c')][_0xf840('0x2d')],'include':[{'model':db[_0xf840('0x29')],'as':_0xf840('0x2e'),'attributes':_[_0xf840('0x2f')](_0x4d292c)},{'model':db['User'],'as':_0xf840('0x30'),'attributes':['id',_0xf840('0x31'),_0xf840('0x32')]}]})[_0xf840('0x1f')](function(_0x7fad44){var _0x9a0c65=[];var _0x159d76=[];for(var _0x41495a=0x0;_0x41495a<_0x7fad44[_0xf840('0x33')];_0x41495a+=0x1){var _0x487d75=_0x7fad44[_0x41495a][_0xf840('0x34')];if(_0x487d75===null){_0x9a0c65['push'](_0x7fad44[_0x41495a][_0xf840('0x26')](_0x8f8f49[_0xf840('0x24')],{'transaction':_0x3321d0}));}else if(!_0x159d76[_0xf840('0x35')](_0x487d75)){_0x159d76[_0xf840('0x36')](_0x487d75);_0x9a0c65[_0xf840('0x36')](_0x7fad44[_0x41495a][_0xf840('0x26')](_0x8f8f49['body'],{'transaction':_0x3321d0}));}}return BPromise[_0xf840('0x37')](_0x9a0c65);});})[_0xf840('0x1f')](function(_0x3c8b18){logger['info'](_0xf840('0x28'),_0x8f8f49);logger[_0xf840('0xd')](_0xf840('0x28'),_0x8f8f49,JSON['stringify'](_0x3c8b18));_0x31a008(_0x3c8b18);})[_0xf840('0x15')](function(_0x1ca0fe){logger[_0xf840('0x10')](_0xf840('0x28'),_0x1ca0fe[_0xf840('0x14')],_0x8f8f49);_0x26c3e4(_0x6642bc[_0xf840('0x10')](0x1f4,_0x1ca0fe[_0xf840('0x14')]));});});});};exports[_0xf840('0x38')]=function(_0x3e844a){var _0x4b6cc4=this;return new Promise(function(_0x3dc52e,_0x4ed4e6){return db[_0xf840('0x2a')]['transaction'](function(_0x3b967c){return db['CmHopperFinal']['create'](_0x3e844a[_0xf840('0x24')],{'raw':_0x3e844a['options']?_0x3e844a[_0xf840('0x17')][_0xf840('0x18')]===undefined?!![]:![]:!![],'transaction':_0x3b967c})[_0xf840('0x1f')](function(){return db[_0xf840('0x16')][_0xf840('0x39')]({'where':_0x3e844a['options']?_0x3e844a[_0xf840('0x17')]['where']||null:null,'transaction':_0x3b967c});});})['then'](function(_0x316197){logger[_0xf840('0x13')](_0xf840('0x38'),_0x3e844a);logger['debug'](_0xf840('0x38'),_0x3e844a,JSON[_0xf840('0xf')](_0x316197));_0x3dc52e(_0x316197);})[_0xf840('0x15')](function(_0x3fe3bf){logger['error'](_0xf840('0x38'),_0x3fe3bf['message'],_0x3e844a);_0x4ed4e6(_0x4b6cc4[_0xf840('0x10')](0x1f4,_0x3fe3bf['message']));});});};exports[_0xf840('0x3a')]=function(_0x5e1c3c){var _0x298a7b=this;return new Promise(function(_0x53439f,_0x2693b9){return db[_0xf840('0x16')]['findAll']({'raw':_0x5e1c3c[_0xf840('0x17')]?_0x5e1c3c[_0xf840('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x5e1c3c['options']?_0x5e1c3c[_0xf840('0x17')]['where']||null:null,'attributes':[[db[_0xf840('0x2a')]['fn'](_0xf840('0x3b'),db[_0xf840('0x2a')]['fn']('IF',db[_0xf840('0x2a')]['literal'](_0xf840('0x3c')+util[_0xf840('0x3d')](_0xf840('0x3e'),moment()['format'](_0xf840('0x3f')))+_0xf840('0x40')))),_0xf840('0x41')]]})[_0xf840('0x1f')](function(_0x29c446){logger['info']('CountReScheduled',_0x5e1c3c);logger[_0xf840('0xd')](_0xf840('0x3a'),_0x5e1c3c,JSON[_0xf840('0xf')](_0x29c446));_0x53439f(_0x29c446);})[_0xf840('0x15')](function(_0xbb034a){logger[_0xf840('0x10')](_0xf840('0x3a'),_0xbb034a[_0xf840('0x14')],_0x5e1c3c);_0x2693b9(_0x298a7b[_0xf840('0x10')](0x1f4,_0xbb034a[_0xf840('0x14')]));});});};exports[_0xf840('0x42')]=function(_0xa679fc){var _0x396afd=this;return new Promise(function(_0x4ed2fa,_0x3fac76){return db['CmContact'][_0xf840('0x43')]()[_0xf840('0x1f')](function(_0x2f3a94){return db[_0xf840('0x2a')]['transaction'](function(_0x340ed7){return db[_0xf840('0x16')][_0xf840('0x44')]({'where':_0xa679fc[_0xf840('0x17')]?_0xa679fc[_0xf840('0x17')][_0xf840('0x19')]||null:null,'attributes':_0xa679fc[_0xf840('0x17')]?_0xa679fc['options'][_0xf840('0x1a')]||null:null,'limit':0x1,'order':_0xa679fc['options']?_0xa679fc[_0xf840('0x17')][_0xf840('0x45')]||null:null,'group':db[_0xf840('0x16')][_0xf840('0x34')],'transaction':_0x340ed7,'lock':_0x340ed7[_0xf840('0x2c')][_0xf840('0x2d')],'include':_0xa679fc['options']?_0xa679fc[_0xf840('0x17')][_0xf840('0x1c')]?_[_0xf840('0x1d')](_0xa679fc[_0xf840('0x17')][_0xf840('0x1c')],function(_0x14d2ec){return{'model':db[_0x14d2ec[_0xf840('0x1e')]],'as':_0x14d2ec['as'],'attributes':_0x14d2ec[_0xf840('0x1a')],'include':_0x14d2ec[_0xf840('0x1c')]?_[_0xf840('0x1d')](_0x14d2ec[_0xf840('0x1c')],function(_0x3c9819){return{'model':db[_0x3c9819[_0xf840('0x1e')]],'as':_0x3c9819['as'],'attributes':_0x3c9819[_0xf840('0x1a')],'include':_0x3c9819[_0xf840('0x1c')]?_[_0xf840('0x1d')](_0x3c9819[_0xf840('0x1c')],function(_0x1b85bb){return{'model':db[_0x1b85bb[_0xf840('0x1e')]],'as':_0x1b85bb['as'],'attributes':_0x1b85bb[_0xf840('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xf840('0x1f')](function(_0x580273){var _0x32d1a7=[];for(var _0x5f41ae=0x0;_0x5f41ae<_0x580273['length'];_0x5f41ae+=0x1){_0x32d1a7['push'](_0x580273[_0x5f41ae]['update'](_0xa679fc[_0xf840('0x24')],{'transaction':_0x340ed7}));}return BPromise[_0xf840('0x37')](_0x32d1a7);});})[_0xf840('0x1f')](function(_0x54239){logger[_0xf840('0x13')]('GetContactRecallMe',_0xa679fc);logger[_0xf840('0xd')](_0xf840('0x42'),_0xa679fc,JSON[_0xf840('0xf')](_0x54239));_0x4ed2fa(_0x54239);})[_0xf840('0x15')](function(_0x246b38){logger[_0xf840('0x10')](_0xf840('0x42'),_0x246b38[_0xf840('0x14')],_0xa679fc);_0x3fac76(_0x396afd['error'](0x1f4,_0x246b38[_0xf840('0x14')]));});});});};exports[_0xf840('0x46')]=function(_0x3a9160){var _0x20869d=this;return new Promise(function(_0x3e013e,_0x5f2782){db[_0xf840('0x29')][_0xf840('0x43')]()[_0xf840('0x1f')](function(_0xfdfdd1){return db[_0xf840('0x16')][_0xf840('0x44')]({'raw':_0x3a9160[_0xf840('0x17')]?_0x3a9160['options']['raw']===undefined?!![]:![]:!![],'where':_0x3a9160[_0xf840('0x17')]?_0x3a9160['options'][_0xf840('0x19')]||null:null,'attributes':_0x3a9160['options']?_0x3a9160[_0xf840('0x17')][_0xf840('0x1a')]||null:null,'limit':_0x3a9160['options']?_0x3a9160['options'][_0xf840('0x1b')]||null:null,'include':_0x3a9160['options']?_0x3a9160[_0xf840('0x17')][_0xf840('0x1c')]?_[_0xf840('0x1d')](_0x3a9160[_0xf840('0x17')]['include'],function(_0x2d0882){return{'model':db[_0x2d0882[_0xf840('0x1e')]],'as':_0x2d0882['as'],'attributes':_0x2d0882['as']===_0xf840('0x2e')?_[_0xf840('0x2f')](_0xfdfdd1):_0x2d0882[_0xf840('0x1a')],'include':_0x2d0882[_0xf840('0x1c')]?_[_0xf840('0x1d')](_0x2d0882[_0xf840('0x1c')],function(_0x21a8fc){return{'model':db[_0x21a8fc['model']],'as':_0x21a8fc['as'],'attributes':_0x21a8fc[_0xf840('0x1a')],'include':_0x21a8fc[_0xf840('0x1c')]?_[_0xf840('0x1d')](_0x21a8fc['include'],function(_0x593731){return{'model':db[_0x593731[_0xf840('0x1e')]],'as':_0x593731['as'],'attributes':_0x593731[_0xf840('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xf840('0x1f')](function(_0x5ac6b6){logger['info'](_0xf840('0x20'),_0x3a9160);logger[_0xf840('0xd')](_0xf840('0x20'),_0x3a9160,JSON[_0xf840('0xf')](_0x5ac6b6));_0x3e013e(_0x5ac6b6);})[_0xf840('0x15')](function(_0x177544){logger[_0xf840('0x10')]('GetCmHopper',_0x177544[_0xf840('0x14')],_0x3a9160);_0x5f2782(_0x20869d[_0xf840('0x10')](0x1f4,_0x177544[_0xf840('0x14')]));});});});}; \ No newline at end of file +var _0xe61b=['Agent','name','voicePause','length','UserId','push','all','GetContactDialer','MoveContactManagedDialer','sequelize','CmHopperFinal','CountReScheduled','literal','`scheduledat`\x20>=\x20','format','\x20,\x201,\x20null','contactsRescheduled','GetContactRecallMe','CmContact','LOCK','UPDATE','GetCmHopperPreview','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','info','CmHopper,\x20%s,\x20%s','request\x20sent','debug','CmHopper,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','CmHopper','findAll','options','raw','where','limit','include','map','model','attributes','GetCmHopper','ShowCmHopper','find','then','CreateCmHopper','create','body','update','UpdateCmHopper','destroy','DestroyCmHopper','describe','transaction','order','Contact','keys'];(function(_0x49e0f7,_0x387cc6){var _0x4a325a=function(_0x1a9537){while(--_0x1a9537){_0x49e0f7['push'](_0x49e0f7['shift']());}};_0x4a325a(++_0x387cc6);}(_0xe61b,0xa0));var _0xbe61=function(_0x4697fa,_0x21c841){_0x4697fa=_0x4697fa-0x0;var _0x390950=_0xe61b[_0x4697fa];return _0x390950;};'use strict';var _=require(_0xbe61('0x0'));var util=require(_0xbe61('0x1'));var moment=require('moment');var BPromise=require(_0xbe61('0x2'));var rs=require(_0xbe61('0x3'));var fs=require('fs');var Redis=require(_0xbe61('0x4'));var db=require(_0xbe61('0x5'))['db'];var utils=require(_0xbe61('0x6'));var logger=require(_0xbe61('0x7'))(_0xbe61('0x8'));var config=require(_0xbe61('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xbe61('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4678dc,_0x18494e,_0x412108){return new BPromise(function(_0x57c954,_0x51f4b0){return client['request'](_0x4678dc,_0x412108)['then'](function(_0xc8d15b){logger[_0xbe61('0xb')](_0xbe61('0xc'),_0x18494e,_0xbe61('0xd'));logger[_0xbe61('0xe')](_0xbe61('0xf'),_0x18494e,_0xbe61('0xd'),JSON[_0xbe61('0x10')](_0xc8d15b));if(_0xc8d15b[_0xbe61('0x11')]){if(_0xc8d15b['error']['code']===0x1f4){logger[_0xbe61('0x11')](_0xbe61('0xc'),_0x18494e,_0xc8d15b['error'][_0xbe61('0x12')]);return _0x51f4b0(_0xc8d15b[_0xbe61('0x11')]['message']);}logger[_0xbe61('0x11')]('CmHopper,\x20%s,\x20%s',_0x18494e,_0xc8d15b[_0xbe61('0x11')][_0xbe61('0x12')]);return _0x57c954(_0xc8d15b[_0xbe61('0x11')][_0xbe61('0x12')]);}else{logger[_0xbe61('0xb')](_0xbe61('0xc'),_0x18494e,_0xbe61('0xd'));_0x57c954(_0xc8d15b[_0xbe61('0x13')]['message']);}})[_0xbe61('0x14')](function(_0x5bbc92){logger['error'](_0xbe61('0xc'),_0x18494e,_0x5bbc92);_0x51f4b0(_0x5bbc92);});});}exports['GetCmHopper']=function(_0x468f78){var _0x22aee7=this;return new Promise(function(_0x3ad6b4,_0x344fc4){return db[_0xbe61('0x15')][_0xbe61('0x16')]({'raw':_0x468f78[_0xbe61('0x17')]?_0x468f78[_0xbe61('0x17')][_0xbe61('0x18')]===undefined?!![]:![]:!![],'where':_0x468f78['options']?_0x468f78[_0xbe61('0x17')][_0xbe61('0x19')]||null:null,'attributes':_0x468f78['options']?_0x468f78[_0xbe61('0x17')]['attributes']||null:null,'limit':_0x468f78[_0xbe61('0x17')]?_0x468f78[_0xbe61('0x17')][_0xbe61('0x1a')]||null:null,'include':_0x468f78[_0xbe61('0x17')]?_0x468f78[_0xbe61('0x17')][_0xbe61('0x1b')]?_[_0xbe61('0x1c')](_0x468f78[_0xbe61('0x17')][_0xbe61('0x1b')],function(_0x1a5324){return{'model':db[_0x1a5324[_0xbe61('0x1d')]],'as':_0x1a5324['as'],'attributes':_0x1a5324[_0xbe61('0x1e')],'include':_0x1a5324[_0xbe61('0x1b')]?_['map'](_0x1a5324[_0xbe61('0x1b')],function(_0x1dc2ee){return{'model':db[_0x1dc2ee[_0xbe61('0x1d')]],'as':_0x1dc2ee['as'],'attributes':_0x1dc2ee['attributes'],'include':_0x1dc2ee[_0xbe61('0x1b')]?_[_0xbe61('0x1c')](_0x1dc2ee[_0xbe61('0x1b')],function(_0x40084c){return{'model':db[_0x40084c[_0xbe61('0x1d')]],'as':_0x40084c['as'],'attributes':_0x40084c['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x23cc6f){logger[_0xbe61('0xb')]('GetCmHopper',_0x468f78);logger['debug'](_0xbe61('0x1f'),_0x468f78,JSON['stringify'](_0x23cc6f));_0x3ad6b4(_0x23cc6f);})['catch'](function(_0x22da71){logger[_0xbe61('0x11')](_0xbe61('0x1f'),_0x22da71[_0xbe61('0x12')],_0x468f78);_0x344fc4(_0x22aee7[_0xbe61('0x11')](0x1f4,_0x22da71[_0xbe61('0x12')]));});});};exports[_0xbe61('0x20')]=function(_0x192d60){var _0x52833c=this;return new Promise(function(_0xe30d76,_0x46c99e){return db[_0xbe61('0x15')][_0xbe61('0x21')]({'raw':_0x192d60[_0xbe61('0x17')]?_0x192d60[_0xbe61('0x17')][_0xbe61('0x18')]===undefined?!![]:![]:!![],'where':_0x192d60[_0xbe61('0x17')]?_0x192d60[_0xbe61('0x17')][_0xbe61('0x19')]||null:null,'attributes':_0x192d60[_0xbe61('0x17')]?_0x192d60[_0xbe61('0x17')]['attributes']||null:null,'include':_0x192d60[_0xbe61('0x17')]?_0x192d60[_0xbe61('0x17')][_0xbe61('0x1b')]?_[_0xbe61('0x1c')](_0x192d60['options'][_0xbe61('0x1b')],function(_0x227747){return{'model':db[_0x227747[_0xbe61('0x1d')]],'as':_0x227747['as'],'attributes':_0x227747[_0xbe61('0x1e')],'include':_0x227747[_0xbe61('0x1b')]?_[_0xbe61('0x1c')](_0x227747[_0xbe61('0x1b')],function(_0x467635){return{'model':db[_0x467635[_0xbe61('0x1d')]],'as':_0x467635['as'],'attributes':_0x467635[_0xbe61('0x1e')],'include':_0x467635['include']?_[_0xbe61('0x1c')](_0x467635[_0xbe61('0x1b')],function(_0x51acdb){return{'model':db[_0x51acdb['model']],'as':_0x51acdb['as'],'attributes':_0x51acdb['attributes']};}):[]};}):[]};}):[]:[]})[_0xbe61('0x22')](function(_0x28020d){logger[_0xbe61('0xb')](_0xbe61('0x20'),_0x192d60);logger['debug']('ShowCmHopper',_0x192d60,JSON[_0xbe61('0x10')](_0x28020d));_0xe30d76(_0x28020d);})['catch'](function(_0x397e95){logger[_0xbe61('0x11')]('ShowCmHopper',_0x397e95['message'],_0x192d60);_0x46c99e(_0x52833c[_0xbe61('0x11')](0x1f4,_0x397e95[_0xbe61('0x12')]));});});};exports[_0xbe61('0x23')]=function(_0x55b2a9){var _0x4cbf8d=this;return new Promise(function(_0x53f719,_0x38b533){return db[_0xbe61('0x15')][_0xbe61('0x24')](_0x55b2a9[_0xbe61('0x25')],{'raw':_0x55b2a9[_0xbe61('0x17')]?_0x55b2a9[_0xbe61('0x17')][_0xbe61('0x18')]===undefined?!![]:![]:!![]})[_0xbe61('0x22')](function(_0x5a964f){logger[_0xbe61('0xb')](_0xbe61('0x23'),_0x55b2a9);logger[_0xbe61('0xe')](_0xbe61('0x23'),_0x55b2a9,JSON['stringify'](_0x5a964f));_0x53f719(_0x5a964f);})[_0xbe61('0x14')](function(_0x55ed41){logger[_0xbe61('0x11')](_0xbe61('0x23'),_0x55ed41['message'],_0x55b2a9);_0x38b533(_0x4cbf8d['error'](0x1f4,_0x55ed41['message']));});});};exports['UpdateCmHopper']=function(_0x36a11c){var _0x29681f=this;return new Promise(function(_0x53ad92,_0xc6b768){return db[_0xbe61('0x15')][_0xbe61('0x26')](_0x36a11c[_0xbe61('0x25')],{'raw':_0x36a11c[_0xbe61('0x17')]?_0x36a11c[_0xbe61('0x17')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x36a11c[_0xbe61('0x17')]?_0x36a11c['options'][_0xbe61('0x19')]||null:null,'attributes':_0x36a11c[_0xbe61('0x17')]?_0x36a11c[_0xbe61('0x17')][_0xbe61('0x1e')]||null:null,'limit':_0x36a11c['options']?_0x36a11c['options'][_0xbe61('0x1a')]||null:null})['then'](function(_0x372f70){logger[_0xbe61('0xb')]('UpdateCmHopper',_0x36a11c);logger[_0xbe61('0xe')]('UpdateCmHopper',_0x36a11c,JSON[_0xbe61('0x10')](_0x372f70));_0x53ad92(_0x372f70);})['catch'](function(_0x47962e){logger[_0xbe61('0x11')](_0xbe61('0x27'),_0x47962e[_0xbe61('0x12')],_0x36a11c);_0xc6b768(_0x29681f[_0xbe61('0x11')](0x1f4,_0x47962e[_0xbe61('0x12')]));});});};exports['DestroyCmHopper']=function(_0x15fc9e){var _0x1f21f3=this;return new Promise(function(_0x2d3243,_0x4cb1f4){return db[_0xbe61('0x15')][_0xbe61('0x28')]({'where':_0x15fc9e[_0xbe61('0x17')]?_0x15fc9e[_0xbe61('0x17')]['where']||null:null})[_0xbe61('0x22')](function(_0x3c7980){logger['info']('DestroyCmHopper',_0x15fc9e);logger[_0xbe61('0xe')](_0xbe61('0x29'),_0x15fc9e,JSON[_0xbe61('0x10')](_0x3c7980));_0x2d3243(_0x3c7980);})[_0xbe61('0x14')](function(_0x5990f8){logger[_0xbe61('0x11')]('DestroyCmHopper',_0x5990f8[_0xbe61('0x12')],_0x15fc9e);_0x4cb1f4(_0x1f21f3['error'](0x1f4,_0x5990f8[_0xbe61('0x12')]));});});};exports['GetContactDialer']=function(_0x2899e8){var _0x11ad8a=this;return new Promise(function(_0x1c294e,_0x4685b9){return db['CmContact'][_0xbe61('0x2a')]()[_0xbe61('0x22')](function(_0x4390d2){return db['sequelize'][_0xbe61('0x2b')](function(_0x127a26){return db[_0xbe61('0x15')]['findAll']({'where':_0x2899e8[_0xbe61('0x17')]?_0x2899e8[_0xbe61('0x17')][_0xbe61('0x19')]||null:null,'attributes':_0x2899e8[_0xbe61('0x17')]?_0x2899e8['options'][_0xbe61('0x1e')]||null:null,'limit':_0x2899e8[_0xbe61('0x17')]?_0x2899e8[_0xbe61('0x17')]['limit']||null:null,'order':_0x2899e8['options']?_0x2899e8[_0xbe61('0x17')][_0xbe61('0x2c')]||null:null,'transaction':_0x127a26,'lock':_0x127a26['LOCK']['UPDATE'],'include':[{'model':db['CmContact'],'as':_0xbe61('0x2d'),'attributes':_[_0xbe61('0x2e')](_0x4390d2)},{'model':db['User'],'as':_0xbe61('0x2f'),'attributes':['id',_0xbe61('0x30'),_0xbe61('0x31')]}]})[_0xbe61('0x22')](function(_0x63a4a4){var _0x29d43a=[];var _0x21dc4b=[];for(var _0x3d2d7f=0x0;_0x3d2d7f<_0x63a4a4[_0xbe61('0x32')];_0x3d2d7f+=0x1){var _0x5532ec=_0x63a4a4[_0x3d2d7f][_0xbe61('0x33')];if(_0x5532ec===null){_0x29d43a[_0xbe61('0x34')](_0x63a4a4[_0x3d2d7f]['update'](_0x2899e8[_0xbe61('0x25')],{'transaction':_0x127a26}));}else if(!_0x21dc4b['includes'](_0x5532ec)){_0x21dc4b[_0xbe61('0x34')](_0x5532ec);_0x29d43a['push'](_0x63a4a4[_0x3d2d7f][_0xbe61('0x26')](_0x2899e8[_0xbe61('0x25')],{'transaction':_0x127a26}));}}return BPromise[_0xbe61('0x35')](_0x29d43a);});})[_0xbe61('0x22')](function(_0x3f91e8){logger[_0xbe61('0xb')]('GetContactDialer',_0x2899e8);logger[_0xbe61('0xe')](_0xbe61('0x36'),_0x2899e8,JSON['stringify'](_0x3f91e8));_0x1c294e(_0x3f91e8);})[_0xbe61('0x14')](function(_0x375e58){logger[_0xbe61('0x11')](_0xbe61('0x36'),_0x375e58[_0xbe61('0x12')],_0x2899e8);_0x4685b9(_0x11ad8a[_0xbe61('0x11')](0x1f4,_0x375e58[_0xbe61('0x12')]));});});});};exports[_0xbe61('0x37')]=function(_0x1a466d){var _0x362ed4=this;return new Promise(function(_0x2fe991,_0x2e9932){return db[_0xbe61('0x38')][_0xbe61('0x2b')](function(_0x83e4c9){return db[_0xbe61('0x39')]['create'](_0x1a466d[_0xbe61('0x25')],{'raw':_0x1a466d[_0xbe61('0x17')]?_0x1a466d[_0xbe61('0x17')][_0xbe61('0x18')]===undefined?!![]:![]:!![],'transaction':_0x83e4c9})[_0xbe61('0x22')](function(){return db[_0xbe61('0x15')][_0xbe61('0x28')]({'where':_0x1a466d['options']?_0x1a466d[_0xbe61('0x17')][_0xbe61('0x19')]||null:null,'transaction':_0x83e4c9});});})[_0xbe61('0x22')](function(_0x14822c){logger['info'](_0xbe61('0x37'),_0x1a466d);logger[_0xbe61('0xe')](_0xbe61('0x37'),_0x1a466d,JSON[_0xbe61('0x10')](_0x14822c));_0x2fe991(_0x14822c);})['catch'](function(_0xb1554d){logger['error']('MoveContactManagedDialer',_0xb1554d['message'],_0x1a466d);_0x2e9932(_0x362ed4['error'](0x1f4,_0xb1554d[_0xbe61('0x12')]));});});};exports[_0xbe61('0x3a')]=function(_0x6f9f0b){var _0x33a7ed=this;return new Promise(function(_0x39a939,_0x1cb4b5){return db[_0xbe61('0x15')][_0xbe61('0x16')]({'raw':_0x6f9f0b[_0xbe61('0x17')]?_0x6f9f0b[_0xbe61('0x17')][_0xbe61('0x18')]===undefined?!![]:![]:!![],'where':_0x6f9f0b[_0xbe61('0x17')]?_0x6f9f0b['options'][_0xbe61('0x19')]||null:null,'attributes':[[db[_0xbe61('0x38')]['fn']('COUNT',db[_0xbe61('0x38')]['fn']('IF',db[_0xbe61('0x38')][_0xbe61('0x3b')](_0xbe61('0x3c')+util[_0xbe61('0x3d')]('\x22%s\x22',moment()[_0xbe61('0x3d')]('YYYY-MM-DD\x20HH:mm:ss'))+_0xbe61('0x3e')))),_0xbe61('0x3f')]]})[_0xbe61('0x22')](function(_0x2a844f){logger[_0xbe61('0xb')](_0xbe61('0x3a'),_0x6f9f0b);logger['debug'](_0xbe61('0x3a'),_0x6f9f0b,JSON[_0xbe61('0x10')](_0x2a844f));_0x39a939(_0x2a844f);})[_0xbe61('0x14')](function(_0x5b2f6b){logger[_0xbe61('0x11')](_0xbe61('0x3a'),_0x5b2f6b[_0xbe61('0x12')],_0x6f9f0b);_0x1cb4b5(_0x33a7ed[_0xbe61('0x11')](0x1f4,_0x5b2f6b[_0xbe61('0x12')]));});});};exports[_0xbe61('0x40')]=function(_0x37bfab){var _0x5058a3=this;return new Promise(function(_0x55160d,_0x720006){return db[_0xbe61('0x41')][_0xbe61('0x2a')]()['then'](function(_0x219da4){return db[_0xbe61('0x38')][_0xbe61('0x2b')](function(_0x5d5c0f){return db[_0xbe61('0x15')][_0xbe61('0x16')]({'where':_0x37bfab[_0xbe61('0x17')]?_0x37bfab[_0xbe61('0x17')][_0xbe61('0x19')]||null:null,'attributes':_0x37bfab['options']?_0x37bfab[_0xbe61('0x17')][_0xbe61('0x1e')]||null:null,'limit':0x1,'order':_0x37bfab[_0xbe61('0x17')]?_0x37bfab[_0xbe61('0x17')][_0xbe61('0x2c')]||null:null,'group':db[_0xbe61('0x15')][_0xbe61('0x33')],'transaction':_0x5d5c0f,'lock':_0x5d5c0f[_0xbe61('0x42')][_0xbe61('0x43')],'include':_0x37bfab[_0xbe61('0x17')]?_0x37bfab[_0xbe61('0x17')][_0xbe61('0x1b')]?_['map'](_0x37bfab[_0xbe61('0x17')][_0xbe61('0x1b')],function(_0x69332b){return{'model':db[_0x69332b['model']],'as':_0x69332b['as'],'attributes':_0x69332b[_0xbe61('0x1e')],'include':_0x69332b[_0xbe61('0x1b')]?_[_0xbe61('0x1c')](_0x69332b['include'],function(_0x130fa8){return{'model':db[_0x130fa8[_0xbe61('0x1d')]],'as':_0x130fa8['as'],'attributes':_0x130fa8[_0xbe61('0x1e')],'include':_0x130fa8[_0xbe61('0x1b')]?_['map'](_0x130fa8[_0xbe61('0x1b')],function(_0x10969b){return{'model':db[_0x10969b[_0xbe61('0x1d')]],'as':_0x10969b['as'],'attributes':_0x10969b['attributes']};}):[]};}):[]};}):[]:[]})[_0xbe61('0x22')](function(_0x12715e){var _0x223e59=[];for(var _0x4eb640=0x0;_0x4eb640<_0x12715e[_0xbe61('0x32')];_0x4eb640+=0x1){_0x223e59['push'](_0x12715e[_0x4eb640][_0xbe61('0x26')](_0x37bfab[_0xbe61('0x25')],{'transaction':_0x5d5c0f}));}return BPromise[_0xbe61('0x35')](_0x223e59);});})['then'](function(_0x4702e1){logger['info']('GetContactRecallMe',_0x37bfab);logger[_0xbe61('0xe')]('GetContactRecallMe',_0x37bfab,JSON['stringify'](_0x4702e1));_0x55160d(_0x4702e1);})[_0xbe61('0x14')](function(_0x514957){logger[_0xbe61('0x11')]('GetContactRecallMe',_0x514957['message'],_0x37bfab);_0x720006(_0x5058a3[_0xbe61('0x11')](0x1f4,_0x514957[_0xbe61('0x12')]));});});});};exports[_0xbe61('0x44')]=function(_0x22cb1f){var _0x352937=this;return new Promise(function(_0x2915eb,_0x96098f){db[_0xbe61('0x41')][_0xbe61('0x2a')]()[_0xbe61('0x22')](function(_0x2c1af3){return db[_0xbe61('0x15')]['findAll']({'raw':_0x22cb1f['options']?_0x22cb1f[_0xbe61('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x22cb1f[_0xbe61('0x17')]?_0x22cb1f[_0xbe61('0x17')]['where']||null:null,'attributes':_0x22cb1f[_0xbe61('0x17')]?_0x22cb1f[_0xbe61('0x17')]['attributes']||null:null,'limit':_0x22cb1f['options']?_0x22cb1f[_0xbe61('0x17')]['limit']||null:null,'include':_0x22cb1f[_0xbe61('0x17')]?_0x22cb1f[_0xbe61('0x17')][_0xbe61('0x1b')]?_['map'](_0x22cb1f['options'][_0xbe61('0x1b')],function(_0x23463f){return{'model':db[_0x23463f[_0xbe61('0x1d')]],'as':_0x23463f['as'],'attributes':_0x23463f['as']===_0xbe61('0x2d')?_[_0xbe61('0x2e')](_0x2c1af3):_0x23463f[_0xbe61('0x1e')],'include':_0x23463f['include']?_['map'](_0x23463f[_0xbe61('0x1b')],function(_0x4d3dea){return{'model':db[_0x4d3dea[_0xbe61('0x1d')]],'as':_0x4d3dea['as'],'attributes':_0x4d3dea[_0xbe61('0x1e')],'include':_0x4d3dea[_0xbe61('0x1b')]?_['map'](_0x4d3dea['include'],function(_0x5d767a){return{'model':db[_0x5d767a[_0xbe61('0x1d')]],'as':_0x5d767a['as'],'attributes':_0x5d767a[_0xbe61('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xbe61('0x22')](function(_0x44c7da){logger[_0xbe61('0xb')](_0xbe61('0x1f'),_0x22cb1f);logger[_0xbe61('0xe')](_0xbe61('0x1f'),_0x22cb1f,JSON[_0xbe61('0x10')](_0x44c7da));_0x2915eb(_0x44c7da);})[_0xbe61('0x14')](function(_0x2a49f3){logger['error']('GetCmHopper',_0x2a49f3[_0xbe61('0x12')],_0x22cb1f);_0x96098f(_0x352937[_0xbe61('0x11')](0x1f4,_0x2a49f3[_0xbe61('0x12')]));});});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index d1ff4c8..a1f2d4d 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 _0x312d=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','/opencontacts','getOpenContacts','/:id','create','post','/preview','destroy','multer','util','path'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x312d,0x14d));var _0xd312=function(_0x288f5e,_0x205edd){_0x288f5e=_0x288f5e-0x0;var _0x476cc9=_0x312d[_0x288f5e];return _0x476cc9;};'use strict';var multer=require(_0xd312('0x0'));var util=require(_0xd312('0x1'));var path=require(_0xd312('0x2'));var timeout=require(_0xd312('0x3'));var express=require(_0xd312('0x4'));var router=express[_0xd312('0x5')]();var fs_extra=require(_0xd312('0x6'));var auth=require(_0xd312('0x7'));var interaction=require(_0xd312('0x8'));var config=require(_0xd312('0x9'));var controller=require('./cmHopper.controller');router[_0xd312('0xa')]('/',auth[_0xd312('0xb')](),controller['index']);router[_0xd312('0xa')](_0xd312('0xc'),auth['isAuthenticated'](),controller[_0xd312('0xd')]);router[_0xd312('0xa')](_0xd312('0xe'),auth[_0xd312('0xb')](),controller[_0xd312('0xf')]);router[_0xd312('0xa')](_0xd312('0x10'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0xd312('0xb')](),controller[_0xd312('0x11')]);router[_0xd312('0x12')](_0xd312('0x13'),auth[_0xd312('0xb')](),controller['getPreview']);router['put']('/:id',auth[_0xd312('0xb')](),controller['update']);router['delete']('/:id',auth[_0xd312('0xb')](),controller[_0xd312('0x14')]);module['exports']=router; \ No newline at end of file +var _0x1aa3=['getOpenContacts','show','post','/preview','getPreview','put','/:id','delete','destroy','exports','multer','util','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopper.controller','get','isAuthenticated','/describe','describe','/opencontacts'];(function(_0x47f587,_0x33ec3a){var _0x2a26d3=function(_0x3154f0){while(--_0x3154f0){_0x47f587['push'](_0x47f587['shift']());}};_0x2a26d3(++_0x33ec3a);}(_0x1aa3,0x7d));var _0x31aa=function(_0x3cdcbe,_0x450f7b){_0x3cdcbe=_0x3cdcbe-0x0;var _0x5846a1=_0x1aa3[_0x3cdcbe];return _0x5846a1;};'use strict';var multer=require(_0x31aa('0x0'));var util=require(_0x31aa('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x31aa('0x2'));var router=express['Router']();var fs_extra=require(_0x31aa('0x3'));var auth=require(_0x31aa('0x4'));var interaction=require(_0x31aa('0x5'));var config=require(_0x31aa('0x6'));var controller=require(_0x31aa('0x7'));router[_0x31aa('0x8')]('/',auth[_0x31aa('0x9')](),controller['index']);router[_0x31aa('0x8')](_0x31aa('0xa'),auth['isAuthenticated'](),controller[_0x31aa('0xb')]);router[_0x31aa('0x8')](_0x31aa('0xc'),auth['isAuthenticated'](),controller[_0x31aa('0xd')]);router[_0x31aa('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x31aa('0xe')]);router[_0x31aa('0xf')]('/',auth[_0x31aa('0x9')](),controller['create']);router[_0x31aa('0xf')](_0x31aa('0x10'),auth['isAuthenticated'](),controller[_0x31aa('0x11')]);router[_0x31aa('0x12')](_0x31aa('0x13'),auth[_0x31aa('0x9')](),controller['update']);router[_0x31aa('0x14')]('/:id',auth[_0x31aa('0x9')](),controller[_0x31aa('0x15')]);module[_0x31aa('0x16')]=router; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.attributes.js b/server/api/cmHopperBlack/cmHopperBlack.attributes.js index 3299946..2eb71a7 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 _0x3b40=['exports','STRING','INTEGER','contactListQueue','sequelize'];(function(_0x5728b6,_0xfe983e){var _0x45e938=function(_0x338124){while(--_0x338124){_0x5728b6['push'](_0x5728b6['shift']());}};_0x45e938(++_0xfe983e);}(_0x3b40,0x13a));var _0x03b4=function(_0x413584,_0x2aa074){_0x413584=_0x413584-0x0;var _0x5f1e8f=_0x3b40[_0x413584];return _0x5f1e8f;};'use strict';var moment=require('moment');var Sequelize=require(_0x03b4('0x0'));module[_0x03b4('0x1')]={'phone':{'type':Sequelize[_0x03b4('0x2')],'allowNull':![]},'ContactId':{'type':Sequelize[_0x03b4('0x3')],'unique':_0x03b4('0x4')},'ListId':{'type':Sequelize[_0x03b4('0x3')],'unique':_0x03b4('0x4')},'VoiceQueueId':{'type':Sequelize[_0x03b4('0x3')],'unique':_0x03b4('0x4')}}; \ No newline at end of file +var _0x7d55=['moment','sequelize','exports','STRING','INTEGER','contactListQueue'];(function(_0x3f246b,_0xd399bd){var _0x10d846=function(_0x455002){while(--_0x455002){_0x3f246b['push'](_0x3f246b['shift']());}};_0x10d846(++_0xd399bd);}(_0x7d55,0x1bc));var _0x57d5=function(_0x311685,_0x2ea661){_0x311685=_0x311685-0x0;var _0x5ea29e=_0x7d55[_0x311685];return _0x5ea29e;};'use strict';var moment=require(_0x57d5('0x0'));var Sequelize=require(_0x57d5('0x1'));module[_0x57d5('0x2')]={'phone':{'type':Sequelize[_0x57d5('0x3')],'allowNull':![]},'ContactId':{'type':Sequelize['INTEGER'],'unique':'contactListQueue'},'ListId':{'type':Sequelize[_0x57d5('0x4')],'unique':_0x57d5('0x5')},'VoiceQueueId':{'type':Sequelize[_0x57d5('0x4')],'unique':'contactListQueue'}}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.controller.js b/server/api/cmHopperBlack/cmHopperBlack.controller.js index 2d0951e..a9166c7 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 _0x4bab=['set','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','key','model','keys','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','filters','filter','where','merge','type','VIRTUAL','options','CmHopperBlack','includeAll','findAll','rows','catch','show','include','find','body','params','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','count'];(function(_0xf71120,_0x25b7f9){var _0xbe2fd3=function(_0x1acbdd){while(--_0x1acbdd){_0xf71120['push'](_0xf71120['shift']());}};_0xbe2fd3(++_0x25b7f9);}(_0x4bab,0xc8));var _0xb4ba=function(_0x542672,_0x5aa7ba){_0x542672=_0x542672-0x0;var _0x233b88=_0x4bab[_0x542672];return _0x233b88;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb4ba('0x0'));var zipdir=require(_0xb4ba('0x1'));var jsonpatch=require(_0xb4ba('0x2'));var rp=require(_0xb4ba('0x3'));var moment=require(_0xb4ba('0x4'));var BPromise=require(_0xb4ba('0x5'));var Mustache=require(_0xb4ba('0x6'));var util=require(_0xb4ba('0x7'));var path=require('path');var sox=require(_0xb4ba('0x8'));var csv=require(_0xb4ba('0x9'));var ejs=require(_0xb4ba('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb4ba('0xb'));var squel=require(_0xb4ba('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xb4ba('0x9'));var querystring=require(_0xb4ba('0xd'));var Papa=require(_0xb4ba('0xe'));var Redis=require(_0xb4ba('0xf'));var authService=require(_0xb4ba('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xb4ba('0x11'));var hardwareService=require(_0xb4ba('0x12'));var logger=require(_0xb4ba('0x13'))(_0xb4ba('0x14'));var utils=require(_0xb4ba('0x15'));var config=require(_0xb4ba('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xb4ba('0x17'))['db'];function respondWithStatusCode(_0x2ff2ee,_0x5ccd64){_0x5ccd64=_0x5ccd64||0xcc;return function(_0x3d2b37){if(_0x3d2b37){return _0x2ff2ee[_0xb4ba('0x18')](_0x5ccd64);}return _0x2ff2ee[_0xb4ba('0x19')](_0x5ccd64)[_0xb4ba('0x1a')]();};}function respondWithResult(_0x17124b,_0xf59cbd){_0xf59cbd=_0xf59cbd||0xc8;return function(_0x414cf9){if(_0x414cf9){return _0x17124b[_0xb4ba('0x19')](_0xf59cbd)[_0xb4ba('0x1b')](_0x414cf9);}};}function respondWithFilteredResult(_0x3208b8,_0x5efb5a){return function(_0x2fcf29){if(_0x2fcf29){var _0x588028=typeof _0x5efb5a[_0xb4ba('0x1c')]===_0xb4ba('0x1d')&&typeof _0x5efb5a['limit']==='undefined';var _0x52038d=_0x2fcf29[_0xb4ba('0x1e')];var _0x1fea10=_0x588028?0x0:_0x5efb5a[_0xb4ba('0x1c')];var _0x5cfb95=_0x588028?_0x2fcf29[_0xb4ba('0x1e')]:_0x5efb5a[_0xb4ba('0x1c')]+_0x5efb5a['limit'];var _0x241bf8;if(_0x5cfb95>=_0x52038d){_0x5cfb95=_0x52038d;_0x241bf8=0xc8;}else{_0x241bf8=0xce;}_0x3208b8[_0xb4ba('0x19')](_0x241bf8);return _0x3208b8[_0xb4ba('0x1f')]('Content-Range',_0x1fea10+'-'+_0x5cfb95+'/'+_0x52038d)[_0xb4ba('0x1b')](_0x2fcf29);}return null;};}function patchUpdates(_0x2fc858){return function(_0x11db73){try{jsonpatch[_0xb4ba('0x20')](_0x11db73,_0x2fc858,!![]);}catch(_0x59b2cd){return BPromise[_0xb4ba('0x21')](_0x59b2cd);}return _0x11db73[_0xb4ba('0x22')]();};}function saveUpdates(_0x1ee113,_0x30925b){return function(_0x3ec220){if(_0x3ec220){return _0x3ec220[_0xb4ba('0x23')](_0x1ee113)[_0xb4ba('0x24')](function(_0x141cb6){return _0x141cb6;});}return null;};}function removeEntity(_0x5153ac,_0x48269a){return function(_0x53d189){if(_0x53d189){return _0x53d189[_0xb4ba('0x25')]()[_0xb4ba('0x24')](function(){_0x5153ac['status'](0xcc)[_0xb4ba('0x1a')]();});}};}function handleEntityNotFound(_0x15d06e,_0x488a14){return function(_0x4a1e6b){if(!_0x4a1e6b){_0x15d06e[_0xb4ba('0x18')](0x194);}return _0x4a1e6b;};}function handleError(_0x1257e0,_0x5d4509){_0x5d4509=_0x5d4509||0x1f4;return function(_0x224ace){logger[_0xb4ba('0x26')](_0x224ace[_0xb4ba('0x27')]);if(_0x224ace[_0xb4ba('0x28')]){delete _0x224ace['name'];}_0x1257e0['status'](_0x5d4509)[_0xb4ba('0x29')](_0x224ace);};}exports[_0xb4ba('0x2a')]=function(_0x22fe53,_0x329510){var _0x3350dd={},_0x448b37={},_0x6a3ab8={'count':0x0,'rows':[]};var _0x206136=_[_0xb4ba('0x2b')](db['CmHopperBlack'][_0xb4ba('0x2c')],function(_0x4a39ab){return{'name':_0x4a39ab[_0xb4ba('0x2d')],'type':_0x4a39ab['type'][_0xb4ba('0x2e')]};});_0x448b37[_0xb4ba('0x2f')]=_['map'](_0x206136,_0xb4ba('0x28'));_0x448b37['query']=_[_0xb4ba('0x30')](_0x22fe53[_0xb4ba('0x31')]);_0x448b37['filters']=_['intersection'](_0x448b37[_0xb4ba('0x2f')],_0x448b37[_0xb4ba('0x31')]);_0x3350dd[_0xb4ba('0x32')]=_[_0xb4ba('0x33')](_0x448b37['model'],qs[_0xb4ba('0x34')](_0x22fe53[_0xb4ba('0x31')][_0xb4ba('0x34')]));_0x3350dd[_0xb4ba('0x32')]=_0x3350dd[_0xb4ba('0x32')][_0xb4ba('0x35')]?_0x3350dd[_0xb4ba('0x32')]:_0x448b37[_0xb4ba('0x2f')];if(!_0x22fe53[_0xb4ba('0x31')][_0xb4ba('0x36')](_0xb4ba('0x37'))){_0x3350dd[_0xb4ba('0x38')]=qs[_0xb4ba('0x38')](_0x22fe53[_0xb4ba('0x31')][_0xb4ba('0x38')]);_0x3350dd['offset']=qs[_0xb4ba('0x1c')](_0x22fe53[_0xb4ba('0x31')][_0xb4ba('0x1c')]);}_0x3350dd[_0xb4ba('0x39')]=qs[_0xb4ba('0x3a')](_0x22fe53[_0xb4ba('0x31')]['sort']);_0x3350dd['where']=qs[_0xb4ba('0x3b')](_['pick'](_0x22fe53['query'],_0x448b37[_0xb4ba('0x3b')]),_0x206136);if(_0x22fe53[_0xb4ba('0x31')][_0xb4ba('0x3c')]){_0x3350dd[_0xb4ba('0x3d')]=_[_0xb4ba('0x3e')](_0x3350dd[_0xb4ba('0x3d')],{'$or':_[_0xb4ba('0x2b')](_0x206136,function(_0x16f35e){if(_0x16f35e[_0xb4ba('0x3f')]!==_0xb4ba('0x40')){var _0x52c3c2={};_0x52c3c2[_0x16f35e[_0xb4ba('0x28')]]={'$like':'%'+_0x22fe53['query'][_0xb4ba('0x3c')]+'%'};return _0x52c3c2;}})});}_0x3350dd=_[_0xb4ba('0x3e')]({},_0x3350dd,_0x22fe53[_0xb4ba('0x41')]);var _0x24a40d={'where':_0x3350dd[_0xb4ba('0x3d')]};return db[_0xb4ba('0x42')][_0xb4ba('0x1e')](_0x24a40d)[_0xb4ba('0x24')](function(_0xc03daf){_0x6a3ab8[_0xb4ba('0x1e')]=_0xc03daf;if(_0x22fe53['query'][_0xb4ba('0x43')]){_0x3350dd['include']=[{'all':!![]}];}return db[_0xb4ba('0x42')][_0xb4ba('0x44')](_0x3350dd);})[_0xb4ba('0x24')](function(_0x49f947){_0x6a3ab8[_0xb4ba('0x45')]=_0x49f947;return _0x6a3ab8;})[_0xb4ba('0x24')](respondWithFilteredResult(_0x329510,_0x3350dd))[_0xb4ba('0x46')](handleError(_0x329510,null));};exports[_0xb4ba('0x47')]=function(_0x44470a,_0x4fad16){var _0x265f99={'raw':!![],'where':{'id':_0x44470a['params']['id']}},_0x44c8c6={};_0x44c8c6[_0xb4ba('0x2f')]=_[_0xb4ba('0x30')](db[_0xb4ba('0x42')][_0xb4ba('0x2c')]);_0x44c8c6[_0xb4ba('0x31')]=_[_0xb4ba('0x30')](_0x44470a[_0xb4ba('0x31')]);_0x44c8c6[_0xb4ba('0x3b')]=_[_0xb4ba('0x33')](_0x44c8c6[_0xb4ba('0x2f')],_0x44c8c6['query']);_0x265f99[_0xb4ba('0x32')]=_['intersection'](_0x44c8c6[_0xb4ba('0x2f')],qs[_0xb4ba('0x34')](_0x44470a[_0xb4ba('0x31')]['fields']));_0x265f99[_0xb4ba('0x32')]=_0x265f99['attributes'][_0xb4ba('0x35')]?_0x265f99[_0xb4ba('0x32')]:_0x44c8c6[_0xb4ba('0x2f')];if(_0x44470a[_0xb4ba('0x31')][_0xb4ba('0x43')]){_0x265f99[_0xb4ba('0x48')]=[{'all':!![]}];}_0x265f99=_[_0xb4ba('0x3e')]({},_0x265f99,_0x44470a[_0xb4ba('0x41')]);return db[_0xb4ba('0x42')][_0xb4ba('0x49')](_0x265f99)[_0xb4ba('0x24')](handleEntityNotFound(_0x4fad16,null))[_0xb4ba('0x24')](respondWithResult(_0x4fad16,null))['catch'](handleError(_0x4fad16,null));};exports[_0xb4ba('0x23')]=function(_0x481321,_0x294c82){if(_0x481321['body']['id']){delete _0x481321[_0xb4ba('0x4a')]['id'];}return db[_0xb4ba('0x42')][_0xb4ba('0x49')]({'where':{'id':_0x481321[_0xb4ba('0x4b')]['id']}})[_0xb4ba('0x24')](handleEntityNotFound(_0x294c82,null))['then'](saveUpdates(_0x481321['body'],null))[_0xb4ba('0x24')](respondWithResult(_0x294c82,null))['catch'](handleError(_0x294c82,null));};exports[_0xb4ba('0x25')]=function(_0x50bb7b,_0x18fd2e){return db['CmHopperBlack'][_0xb4ba('0x49')]({'where':{'id':_0x50bb7b['params']['id']}})[_0xb4ba('0x24')](handleEntityNotFound(_0x18fd2e,null))['then'](removeEntity(_0x18fd2e,null))[_0xb4ba('0x46')](handleError(_0x18fd2e,null));};exports[_0xb4ba('0x4c')]=function(_0x2db964,_0xc88303){return db[_0xb4ba('0x42')]['describe']()['then'](respondWithResult(_0xc88303,null))[_0xb4ba('0x46')](handleError(_0xc88303,null));}; \ No newline at end of file +var _0x07c9=['apply','save','destroy','then','error','stack','name','send','index','map','CmHopperBlack','rawAttributes','fieldName','type','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','sort','where','pick','filters','merge','filter','options','includeAll','include','findAll','rows','catch','params','find','update','body','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','count','offset','set'];(function(_0x15f8dd,_0xd65352){var _0x1b48f7=function(_0x26d68e){while(--_0x26d68e){_0x15f8dd['push'](_0x15f8dd['shift']());}};_0x1b48f7(++_0xd65352);}(_0x07c9,0x6f));var _0x907c=function(_0x1206e0,_0x21f7b9){_0x1206e0=_0x1206e0-0x0;var _0x1d002f=_0x07c9[_0x1206e0];return _0x1d002f;};'use strict';var emlformat=require(_0x907c('0x0'));var rimraf=require(_0x907c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x907c('0x2'));var rp=require(_0x907c('0x3'));var moment=require(_0x907c('0x4'));var BPromise=require(_0x907c('0x5'));var Mustache=require(_0x907c('0x6'));var util=require(_0x907c('0x7'));var path=require(_0x907c('0x8'));var sox=require(_0x907c('0x9'));var csv=require(_0x907c('0xa'));var ejs=require(_0x907c('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x907c('0xc'));var squel=require(_0x907c('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x907c('0xe'));var toCsv=require(_0x907c('0xa'));var querystring=require(_0x907c('0xf'));var Papa=require(_0x907c('0x10'));var Redis=require(_0x907c('0x11'));var authService=require(_0x907c('0x12'));var qs=require(_0x907c('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x907c('0x14'))('api');var utils=require(_0x907c('0x15'));var config=require(_0x907c('0x16'));var licenseUtil=require(_0x907c('0x17'));var db=require(_0x907c('0x18'))['db'];function respondWithStatusCode(_0x4a6449,_0x35ba40){_0x35ba40=_0x35ba40||0xcc;return function(_0x4e252d){if(_0x4e252d){return _0x4a6449[_0x907c('0x19')](_0x35ba40);}return _0x4a6449[_0x907c('0x1a')](_0x35ba40)[_0x907c('0x1b')]();};}function respondWithResult(_0xcaabb9,_0x1a2c47){_0x1a2c47=_0x1a2c47||0xc8;return function(_0x4f2f69){if(_0x4f2f69){return _0xcaabb9['status'](_0x1a2c47)[_0x907c('0x1c')](_0x4f2f69);}};}function respondWithFilteredResult(_0x5dbd92,_0x5da4ec){return function(_0x24beb4){if(_0x24beb4){var _0x2c6aa9=typeof _0x5da4ec['offset']==='undefined'&&typeof _0x5da4ec[_0x907c('0x1d')]==='undefined';var _0x20a9c6=_0x24beb4[_0x907c('0x1e')];var _0x37cd38=_0x2c6aa9?0x0:_0x5da4ec[_0x907c('0x1f')];var _0x3f43ff=_0x2c6aa9?_0x24beb4[_0x907c('0x1e')]:_0x5da4ec[_0x907c('0x1f')]+_0x5da4ec[_0x907c('0x1d')];var _0x2f65a2;if(_0x3f43ff>=_0x20a9c6){_0x3f43ff=_0x20a9c6;_0x2f65a2=0xc8;}else{_0x2f65a2=0xce;}_0x5dbd92[_0x907c('0x1a')](_0x2f65a2);return _0x5dbd92[_0x907c('0x20')]('Content-Range',_0x37cd38+'-'+_0x3f43ff+'/'+_0x20a9c6)[_0x907c('0x1c')](_0x24beb4);}return null;};}function patchUpdates(_0x4fb8e9){return function(_0x4dee41){try{jsonpatch[_0x907c('0x21')](_0x4dee41,_0x4fb8e9,!![]);}catch(_0x4004c1){return BPromise['reject'](_0x4004c1);}return _0x4dee41[_0x907c('0x22')]();};}function saveUpdates(_0x6bc4fa,_0x4b2d2e){return function(_0x48f82a){if(_0x48f82a){return _0x48f82a['update'](_0x6bc4fa)['then'](function(_0x4fc97d){return _0x4fc97d;});}return null;};}function removeEntity(_0x18e8a8,_0xdeecde){return function(_0x3f56ad){if(_0x3f56ad){return _0x3f56ad[_0x907c('0x23')]()[_0x907c('0x24')](function(){_0x18e8a8[_0x907c('0x1a')](0xcc)[_0x907c('0x1b')]();});}};}function handleEntityNotFound(_0x1da8da,_0x38a55b){return function(_0x329895){if(!_0x329895){_0x1da8da[_0x907c('0x19')](0x194);}return _0x329895;};}function handleError(_0x1d3c55,_0x5c14f4){_0x5c14f4=_0x5c14f4||0x1f4;return function(_0x576304){logger[_0x907c('0x25')](_0x576304[_0x907c('0x26')]);if(_0x576304[_0x907c('0x27')]){delete _0x576304[_0x907c('0x27')];}_0x1d3c55['status'](_0x5c14f4)[_0x907c('0x28')](_0x576304);};}exports[_0x907c('0x29')]=function(_0x2d23cd,_0x5ee598){var _0x5da345={},_0x3171c4={},_0x530a1d={'count':0x0,'rows':[]};var _0x5b58ee=_[_0x907c('0x2a')](db[_0x907c('0x2b')][_0x907c('0x2c')],function(_0x102388){return{'name':_0x102388[_0x907c('0x2d')],'type':_0x102388[_0x907c('0x2e')]['key']};});_0x3171c4[_0x907c('0x2f')]=_[_0x907c('0x2a')](_0x5b58ee,_0x907c('0x27'));_0x3171c4[_0x907c('0x30')]=_[_0x907c('0x31')](_0x2d23cd[_0x907c('0x30')]);_0x3171c4['filters']=_['intersection'](_0x3171c4[_0x907c('0x2f')],_0x3171c4['query']);_0x5da345[_0x907c('0x32')]=_[_0x907c('0x33')](_0x3171c4[_0x907c('0x2f')],qs[_0x907c('0x34')](_0x2d23cd[_0x907c('0x30')][_0x907c('0x34')]));_0x5da345[_0x907c('0x32')]=_0x5da345[_0x907c('0x32')][_0x907c('0x35')]?_0x5da345['attributes']:_0x3171c4['model'];if(!_0x2d23cd[_0x907c('0x30')][_0x907c('0x36')]('nolimit')){_0x5da345[_0x907c('0x1d')]=qs['limit'](_0x2d23cd['query'][_0x907c('0x1d')]);_0x5da345[_0x907c('0x1f')]=qs['offset'](_0x2d23cd['query'][_0x907c('0x1f')]);}_0x5da345['order']=qs[_0x907c('0x37')](_0x2d23cd['query'][_0x907c('0x37')]);_0x5da345[_0x907c('0x38')]=qs['filters'](_[_0x907c('0x39')](_0x2d23cd[_0x907c('0x30')],_0x3171c4[_0x907c('0x3a')]),_0x5b58ee);if(_0x2d23cd[_0x907c('0x30')]['filter']){_0x5da345['where']=_[_0x907c('0x3b')](_0x5da345[_0x907c('0x38')],{'$or':_[_0x907c('0x2a')](_0x5b58ee,function(_0x5526f1){if(_0x5526f1['type']!=='VIRTUAL'){var _0x51951e={};_0x51951e[_0x5526f1['name']]={'$like':'%'+_0x2d23cd['query'][_0x907c('0x3c')]+'%'};return _0x51951e;}})});}_0x5da345=_['merge']({},_0x5da345,_0x2d23cd[_0x907c('0x3d')]);var _0x4f3c84={'where':_0x5da345[_0x907c('0x38')]};return db[_0x907c('0x2b')][_0x907c('0x1e')](_0x4f3c84)['then'](function(_0x2159c4){_0x530a1d[_0x907c('0x1e')]=_0x2159c4;if(_0x2d23cd[_0x907c('0x30')][_0x907c('0x3e')]){_0x5da345[_0x907c('0x3f')]=[{'all':!![]}];}return db['CmHopperBlack'][_0x907c('0x40')](_0x5da345);})[_0x907c('0x24')](function(_0x5e60ee){_0x530a1d[_0x907c('0x41')]=_0x5e60ee;return _0x530a1d;})[_0x907c('0x24')](respondWithFilteredResult(_0x5ee598,_0x5da345))[_0x907c('0x42')](handleError(_0x5ee598,null));};exports['show']=function(_0x57c278,_0x12c632){var _0x3d3bb4={'raw':!![],'where':{'id':_0x57c278[_0x907c('0x43')]['id']}},_0x261610={};_0x261610[_0x907c('0x2f')]=_[_0x907c('0x31')](db[_0x907c('0x2b')][_0x907c('0x2c')]);_0x261610[_0x907c('0x30')]=_[_0x907c('0x31')](_0x57c278[_0x907c('0x30')]);_0x261610['filters']=_['intersection'](_0x261610['model'],_0x261610['query']);_0x3d3bb4[_0x907c('0x32')]=_['intersection'](_0x261610[_0x907c('0x2f')],qs[_0x907c('0x34')](_0x57c278[_0x907c('0x30')]['fields']));_0x3d3bb4[_0x907c('0x32')]=_0x3d3bb4[_0x907c('0x32')][_0x907c('0x35')]?_0x3d3bb4['attributes']:_0x261610[_0x907c('0x2f')];if(_0x57c278[_0x907c('0x30')][_0x907c('0x3e')]){_0x3d3bb4[_0x907c('0x3f')]=[{'all':!![]}];}_0x3d3bb4=_[_0x907c('0x3b')]({},_0x3d3bb4,_0x57c278[_0x907c('0x3d')]);return db[_0x907c('0x2b')][_0x907c('0x44')](_0x3d3bb4)[_0x907c('0x24')](handleEntityNotFound(_0x12c632,null))['then'](respondWithResult(_0x12c632,null))['catch'](handleError(_0x12c632,null));};exports[_0x907c('0x45')]=function(_0x1cfdb7,_0x55439c){if(_0x1cfdb7[_0x907c('0x46')]['id']){delete _0x1cfdb7[_0x907c('0x46')]['id'];}return db[_0x907c('0x2b')][_0x907c('0x44')]({'where':{'id':_0x1cfdb7[_0x907c('0x43')]['id']}})[_0x907c('0x24')](handleEntityNotFound(_0x55439c,null))[_0x907c('0x24')](saveUpdates(_0x1cfdb7['body'],null))[_0x907c('0x24')](respondWithResult(_0x55439c,null))['catch'](handleError(_0x55439c,null));};exports[_0x907c('0x23')]=function(_0x571f84,_0x4dfc37){return db['CmHopperBlack'][_0x907c('0x44')]({'where':{'id':_0x571f84[_0x907c('0x43')]['id']}})[_0x907c('0x24')](handleEntityNotFound(_0x4dfc37,null))[_0x907c('0x24')](removeEntity(_0x4dfc37,null))[_0x907c('0x42')](handleError(_0x4dfc37,null));};exports['describe']=function(_0x26241c,_0x1d30f6){return db[_0x907c('0x2b')][_0x907c('0x47')]()['then'](respondWithResult(_0x1d30f6,null))[_0x907c('0x42')](handleError(_0x1d30f6,null));}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.model.js b/server/api/cmHopperBlack/cmHopperBlack.model.js index 91059e1..8c20a15 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 _0xe36b=['exports','define','CmHopperBlack','cm_hopper_black','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmHopperBlack.attributes'];(function(_0xed9d13,_0x5f5331){var _0xdcd9ae=function(_0x53844f){while(--_0x53844f){_0xed9d13['push'](_0xed9d13['shift']());}};_0xdcd9ae(++_0x5f5331);}(_0xe36b,0x19a));var _0xbe36=function(_0x316ca0,_0x1fae95){_0x316ca0=_0x316ca0-0x0;var _0x42240=_0xe36b[_0x316ca0];return _0x42240;};'use strict';var _=require('lodash');var util=require(_0xbe36('0x0'));var logger=require(_0xbe36('0x1'))(_0xbe36('0x2'));var moment=require(_0xbe36('0x3'));var BPromise=require(_0xbe36('0x4'));var rp=require(_0xbe36('0x5'));var fs=require('fs');var path=require(_0xbe36('0x6'));var rimraf=require(_0xbe36('0x7'));var config=require(_0xbe36('0x8'));var attributes=require(_0xbe36('0x9'));module[_0xbe36('0xa')]=function(_0x1aec35,_0x275d8e){return _0x1aec35[_0xbe36('0xb')](_0xbe36('0xc'),attributes,{'tableName':_0xbe36('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf494=['../../config/logger','api','moment','bluebird','path','exports','define','CmHopperBlack'];(function(_0x132a9a,_0x4da489){var _0x9dd201=function(_0x20435d){while(--_0x20435d){_0x132a9a['push'](_0x132a9a['shift']());}};_0x9dd201(++_0x4da489);}(_0xf494,0x1d8));var _0x4f49=function(_0x2bd8cb,_0x1fd91c){_0x2bd8cb=_0x2bd8cb-0x0;var _0x2db999=_0xf494[_0x2bd8cb];return _0x2db999;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x4f49('0x0'))(_0x4f49('0x1'));var moment=require(_0x4f49('0x2'));var BPromise=require(_0x4f49('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4f49('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./cmHopperBlack.attributes');module[_0x4f49('0x5')]=function(_0x400cbe,_0x1754cd){return _0x400cbe[_0x4f49('0x6')](_0x4f49('0x7'),attributes,{'tableName':'cm_hopper_black','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.rpc.js b/server/api/cmHopperBlack/cmHopperBlack.rpc.js index f0734cd..eddbb61 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 _0x67c6=['debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','CmHopperBlack,\x20%s,\x20%s','message','result','GetCmHopperBlack','CmHopperBlack','findAll','options','raw','where','attributes','map','model','include','stringify','catch','UpdateCmHopperBlack','body','DestroyCmHopperBlack','destroy','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','info'];(function(_0x4a81d6,_0x15524d){var _0x23bf3f=function(_0x2dc614){while(--_0x2dc614){_0x4a81d6['push'](_0x4a81d6['shift']());}};_0x23bf3f(++_0x15524d);}(_0x67c6,0x8a));var _0x667c=function(_0xf7cbb,_0x11582f){_0xf7cbb=_0xf7cbb-0x0;var _0x5e80a4=_0x67c6[_0xf7cbb];return _0x5e80a4;};'use strict';var _=require(_0x667c('0x0'));var util=require(_0x667c('0x1'));var moment=require(_0x667c('0x2'));var BPromise=require(_0x667c('0x3'));var rs=require(_0x667c('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x667c('0x5'))['db'];var utils=require(_0x667c('0x6'));var logger=require('../../config/logger')(_0x667c('0x7'));var config=require(_0x667c('0x8'));var jayson=require(_0x667c('0x9'));var client=jayson[_0x667c('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4cfc1e,_0x42fe02,_0x145e33){return new BPromise(function(_0x286c24,_0x1d35c6){return client[_0x667c('0xb')](_0x4cfc1e,_0x145e33)[_0x667c('0xc')](function(_0x5e6b3d){logger[_0x667c('0xd')]('CmHopperBlack,\x20%s,\x20%s',_0x42fe02,'request\x20sent');logger[_0x667c('0xe')](_0x667c('0xf'),_0x42fe02,_0x667c('0x10'),JSON['stringify'](_0x5e6b3d));if(_0x5e6b3d[_0x667c('0x11')]){if(_0x5e6b3d[_0x667c('0x11')][_0x667c('0x12')]===0x1f4){logger[_0x667c('0x11')](_0x667c('0x13'),_0x42fe02,_0x5e6b3d['error'][_0x667c('0x14')]);return _0x1d35c6(_0x5e6b3d[_0x667c('0x11')][_0x667c('0x14')]);}logger[_0x667c('0x11')](_0x667c('0x13'),_0x42fe02,_0x5e6b3d[_0x667c('0x11')][_0x667c('0x14')]);return _0x286c24(_0x5e6b3d[_0x667c('0x11')][_0x667c('0x14')]);}else{logger[_0x667c('0xd')]('CmHopperBlack,\x20%s,\x20%s',_0x42fe02,_0x667c('0x10'));_0x286c24(_0x5e6b3d[_0x667c('0x15')][_0x667c('0x14')]);}})['catch'](function(_0x478506){logger[_0x667c('0x11')]('CmHopperBlack,\x20%s,\x20%s',_0x42fe02,_0x478506);_0x1d35c6(_0x478506);});});}exports[_0x667c('0x16')]=function(_0x5c108d){var _0x4eb26a=this;return new Promise(function(_0x5dc900,_0x233aaa){return db[_0x667c('0x17')][_0x667c('0x18')]({'raw':_0x5c108d[_0x667c('0x19')]?_0x5c108d[_0x667c('0x19')][_0x667c('0x1a')]===undefined?!![]:![]:!![],'where':_0x5c108d['options']?_0x5c108d[_0x667c('0x19')][_0x667c('0x1b')]||null:null,'attributes':_0x5c108d[_0x667c('0x19')]?_0x5c108d['options'][_0x667c('0x1c')]||null:null,'limit':_0x5c108d[_0x667c('0x19')]?_0x5c108d[_0x667c('0x19')]['limit']||null:null,'include':_0x5c108d['options']?_0x5c108d['options']['include']?_[_0x667c('0x1d')](_0x5c108d[_0x667c('0x19')]['include'],function(_0x51e198){return{'model':db[_0x51e198[_0x667c('0x1e')]],'as':_0x51e198['as'],'attributes':_0x51e198[_0x667c('0x1c')],'include':_0x51e198[_0x667c('0x1f')]?_[_0x667c('0x1d')](_0x51e198['include'],function(_0xe4caff){return{'model':db[_0xe4caff['model']],'as':_0xe4caff['as'],'attributes':_0xe4caff[_0x667c('0x1c')],'include':_0xe4caff['include']?_['map'](_0xe4caff[_0x667c('0x1f')],function(_0x1fb027){return{'model':db[_0x1fb027[_0x667c('0x1e')]],'as':_0x1fb027['as'],'attributes':_0x1fb027[_0x667c('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x667c('0xc')](function(_0x5295f1){logger[_0x667c('0xd')](_0x667c('0x16'),_0x5c108d);logger[_0x667c('0xe')]('GetCmHopperBlack',_0x5c108d,JSON[_0x667c('0x20')](_0x5295f1));_0x5dc900(_0x5295f1);})[_0x667c('0x21')](function(_0xa8f63){logger[_0x667c('0x11')](_0x667c('0x16'),_0xa8f63[_0x667c('0x14')],_0x5c108d);_0x233aaa(_0x4eb26a[_0x667c('0x11')](0x1f4,_0xa8f63[_0x667c('0x14')]));});});};exports[_0x667c('0x22')]=function(_0x5714f1){var _0x1bf12f=this;return new Promise(function(_0x36eae7,_0x35b495){return db[_0x667c('0x17')]['update'](_0x5714f1[_0x667c('0x23')],{'raw':_0x5714f1['options']?_0x5714f1[_0x667c('0x19')][_0x667c('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5714f1[_0x667c('0x19')]?_0x5714f1['options']['where']||null:null,'attributes':_0x5714f1[_0x667c('0x19')]?_0x5714f1[_0x667c('0x19')][_0x667c('0x1c')]||null:null,'limit':_0x5714f1[_0x667c('0x19')]?_0x5714f1[_0x667c('0x19')]['limit']||null:null})[_0x667c('0xc')](function(_0x1c3c57){logger[_0x667c('0xd')](_0x667c('0x22'),_0x5714f1);logger[_0x667c('0xe')]('UpdateCmHopperBlack',_0x5714f1,JSON[_0x667c('0x20')](_0x1c3c57));_0x36eae7(_0x1c3c57);})[_0x667c('0x21')](function(_0x5ab8dd){logger[_0x667c('0x11')](_0x667c('0x22'),_0x5ab8dd[_0x667c('0x14')],_0x5714f1);_0x35b495(_0x1bf12f[_0x667c('0x11')](0x1f4,_0x5ab8dd['message']));});});};exports[_0x667c('0x24')]=function(_0x2026ef){var _0xf1d3fb=this;return new Promise(function(_0x4d428b,_0x15f2b7){return db[_0x667c('0x17')][_0x667c('0x25')]({'where':_0x2026ef[_0x667c('0x19')]?_0x2026ef[_0x667c('0x19')]['where']||null:null})[_0x667c('0xc')](function(_0x2ebf17){logger[_0x667c('0xd')](_0x667c('0x24'),_0x2026ef);logger[_0x667c('0xe')](_0x667c('0x24'),_0x2026ef,JSON[_0x667c('0x20')](_0x2ebf17));_0x4d428b(_0x2ebf17);})['catch'](function(_0x450d55){logger[_0x667c('0x11')]('DestroyCmHopperBlack',_0x450d55[_0x667c('0x14')],_0x2026ef);_0x15f2b7(_0xf1d3fb['error'](0x1f4,_0x450d55[_0x667c('0x14')]));});});}; \ No newline at end of file +var _0x4c05=['findAll','options','raw','where','attributes','limit','include','map','model','UpdateCmHopperBlack','body','DestroyCmHopperBlack','lodash','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','info','CmHopperBlack,\x20%s,\x20%s','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','GetCmHopperBlack','CmHopperBlack'];(function(_0x27eab2,_0x5d3db){var _0xa81a1b=function(_0x476599){while(--_0x476599){_0x27eab2['push'](_0x27eab2['shift']());}};_0xa81a1b(++_0x5d3db);}(_0x4c05,0xc0));var _0x54c0=function(_0x5dc384,_0x1ba10f){_0x5dc384=_0x5dc384-0x0;var _0x46b4e9=_0x4c05[_0x5dc384];return _0x46b4e9;};'use strict';var _=require(_0x54c0('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x54c0('0x1'));var rs=require(_0x54c0('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x54c0('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x54c0('0x4'))(_0x54c0('0x5'));var config=require(_0x54c0('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x54c0('0x7')][_0x54c0('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x526287,_0x3840ac,_0x32f820){return new BPromise(function(_0x35d32b,_0x1dcf01){return client[_0x54c0('0x9')](_0x526287,_0x32f820)[_0x54c0('0xa')](function(_0x444955){logger[_0x54c0('0xb')](_0x54c0('0xc'),_0x3840ac,'request\x20sent');logger[_0x54c0('0xd')](_0x54c0('0xe'),_0x3840ac,'request\x20sent',JSON[_0x54c0('0xf')](_0x444955));if(_0x444955[_0x54c0('0x10')]){if(_0x444955['error'][_0x54c0('0x11')]===0x1f4){logger[_0x54c0('0x10')](_0x54c0('0xc'),_0x3840ac,_0x444955[_0x54c0('0x10')][_0x54c0('0x12')]);return _0x1dcf01(_0x444955[_0x54c0('0x10')][_0x54c0('0x12')]);}logger['error']('CmHopperBlack,\x20%s,\x20%s',_0x3840ac,_0x444955[_0x54c0('0x10')][_0x54c0('0x12')]);return _0x35d32b(_0x444955[_0x54c0('0x10')][_0x54c0('0x12')]);}else{logger[_0x54c0('0xb')](_0x54c0('0xc'),_0x3840ac,_0x54c0('0x13'));_0x35d32b(_0x444955[_0x54c0('0x14')][_0x54c0('0x12')]);}})[_0x54c0('0x15')](function(_0x3139e3){logger[_0x54c0('0x10')](_0x54c0('0xc'),_0x3840ac,_0x3139e3);_0x1dcf01(_0x3139e3);});});}exports[_0x54c0('0x16')]=function(_0x4637d8){var _0x3c012b=this;return new Promise(function(_0x123516,_0xa872b9){return db[_0x54c0('0x17')][_0x54c0('0x18')]({'raw':_0x4637d8[_0x54c0('0x19')]?_0x4637d8[_0x54c0('0x19')][_0x54c0('0x1a')]===undefined?!![]:![]:!![],'where':_0x4637d8[_0x54c0('0x19')]?_0x4637d8[_0x54c0('0x19')][_0x54c0('0x1b')]||null:null,'attributes':_0x4637d8[_0x54c0('0x19')]?_0x4637d8[_0x54c0('0x19')][_0x54c0('0x1c')]||null:null,'limit':_0x4637d8[_0x54c0('0x19')]?_0x4637d8[_0x54c0('0x19')][_0x54c0('0x1d')]||null:null,'include':_0x4637d8[_0x54c0('0x19')]?_0x4637d8['options'][_0x54c0('0x1e')]?_[_0x54c0('0x1f')](_0x4637d8['options'][_0x54c0('0x1e')],function(_0x215fd0){return{'model':db[_0x215fd0[_0x54c0('0x20')]],'as':_0x215fd0['as'],'attributes':_0x215fd0[_0x54c0('0x1c')],'include':_0x215fd0[_0x54c0('0x1e')]?_[_0x54c0('0x1f')](_0x215fd0['include'],function(_0xd70df4){return{'model':db[_0xd70df4['model']],'as':_0xd70df4['as'],'attributes':_0xd70df4['attributes'],'include':_0xd70df4[_0x54c0('0x1e')]?_['map'](_0xd70df4[_0x54c0('0x1e')],function(_0x4a3712){return{'model':db[_0x4a3712['model']],'as':_0x4a3712['as'],'attributes':_0x4a3712[_0x54c0('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x54c0('0xa')](function(_0x777811){logger[_0x54c0('0xb')](_0x54c0('0x16'),_0x4637d8);logger[_0x54c0('0xd')](_0x54c0('0x16'),_0x4637d8,JSON[_0x54c0('0xf')](_0x777811));_0x123516(_0x777811);})[_0x54c0('0x15')](function(_0x33b585){logger[_0x54c0('0x10')](_0x54c0('0x16'),_0x33b585['message'],_0x4637d8);_0xa872b9(_0x3c012b['error'](0x1f4,_0x33b585[_0x54c0('0x12')]));});});};exports[_0x54c0('0x21')]=function(_0x5b0354){var _0x3e7876=this;return new Promise(function(_0x18b3e4,_0x1ffa6a){return db[_0x54c0('0x17')]['update'](_0x5b0354[_0x54c0('0x22')],{'raw':_0x5b0354[_0x54c0('0x19')]?_0x5b0354[_0x54c0('0x19')][_0x54c0('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5b0354[_0x54c0('0x19')]?_0x5b0354[_0x54c0('0x19')][_0x54c0('0x1b')]||null:null,'attributes':_0x5b0354[_0x54c0('0x19')]?_0x5b0354[_0x54c0('0x19')]['attributes']||null:null,'limit':_0x5b0354[_0x54c0('0x19')]?_0x5b0354['options'][_0x54c0('0x1d')]||null:null})['then'](function(_0x5e6ad0){logger[_0x54c0('0xb')](_0x54c0('0x21'),_0x5b0354);logger[_0x54c0('0xd')](_0x54c0('0x21'),_0x5b0354,JSON[_0x54c0('0xf')](_0x5e6ad0));_0x18b3e4(_0x5e6ad0);})['catch'](function(_0x1e9ee1){logger[_0x54c0('0x10')](_0x54c0('0x21'),_0x1e9ee1[_0x54c0('0x12')],_0x5b0354);_0x1ffa6a(_0x3e7876['error'](0x1f4,_0x1e9ee1[_0x54c0('0x12')]));});});};exports['DestroyCmHopperBlack']=function(_0x6cc4ac){var _0x4cdf5c=this;return new Promise(function(_0x35fad2,_0x4f9cc1){return db[_0x54c0('0x17')]['destroy']({'where':_0x6cc4ac['options']?_0x6cc4ac[_0x54c0('0x19')][_0x54c0('0x1b')]||null:null})[_0x54c0('0xa')](function(_0x416480){logger[_0x54c0('0xb')](_0x54c0('0x23'),_0x6cc4ac);logger[_0x54c0('0xd')]('DestroyCmHopperBlack',_0x6cc4ac,JSON[_0x54c0('0xf')](_0x416480));_0x35fad2(_0x416480);})[_0x54c0('0x15')](function(_0x27ca0b){logger[_0x54c0('0x10')](_0x54c0('0x23'),_0x27ca0b[_0x54c0('0x12')],_0x6cc4ac);_0x4f9cc1(_0x4cdf5c[_0x54c0('0x10')](0x1f4,_0x27ca0b[_0x54c0('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index c37bbaf..abe62c4 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 _0x741c=['get','isAuthenticated','index','/describe','/:id','show','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','./cmHopperBlack.controller'];(function(_0x88b9f8,_0x82c64e){var _0x5562d3=function(_0x28c185){while(--_0x28c185){_0x88b9f8['push'](_0x88b9f8['shift']());}};_0x5562d3(++_0x82c64e);}(_0x741c,0x196));var _0xc741=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x741c[_0xfae23b];return _0x200640;};'use strict';var multer=require(_0xc741('0x0'));var util=require(_0xc741('0x1'));var path=require(_0xc741('0x2'));var timeout=require(_0xc741('0x3'));var express=require(_0xc741('0x4'));var router=express[_0xc741('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xc741('0x6'));var config=require('../../config/environment');var controller=require(_0xc741('0x7'));router[_0xc741('0x8')]('/',auth[_0xc741('0x9')](),controller[_0xc741('0xa')]);router[_0xc741('0x8')](_0xc741('0xb'),auth[_0xc741('0x9')](),controller['describe']);router[_0xc741('0x8')](_0xc741('0xc'),auth['isAuthenticated'](),controller[_0xc741('0xd')]);router['put']('/:id',auth[_0xc741('0x9')](),controller[_0xc741('0xe')]);router[_0xc741('0xf')](_0xc741('0xc'),auth[_0xc741('0x9')](),controller[_0xc741('0x10')]);module[_0xc741('0x11')]=router; \ No newline at end of file +var _0xf2e3=['exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperBlack.controller','isAuthenticated','index','get','/describe','describe','/:id','show','put','update','delete','destroy'];(function(_0x41ed13,_0x1044be){var _0x1bb4d5=function(_0x15d224){while(--_0x15d224){_0x41ed13['push'](_0x41ed13['shift']());}};_0x1bb4d5(++_0x1044be);}(_0xf2e3,0x9b));var _0x3f2e=function(_0x46d0c9,_0x526bfa){_0x46d0c9=_0x46d0c9-0x0;var _0x174506=_0xf2e3[_0x46d0c9];return _0x174506;};'use strict';var multer=require(_0x3f2e('0x0'));var util=require('util');var path=require(_0x3f2e('0x1'));var timeout=require(_0x3f2e('0x2'));var express=require(_0x3f2e('0x3'));var router=express[_0x3f2e('0x4')]();var fs_extra=require(_0x3f2e('0x5'));var auth=require(_0x3f2e('0x6'));var interaction=require(_0x3f2e('0x7'));var config=require(_0x3f2e('0x8'));var controller=require(_0x3f2e('0x9'));router['get']('/',auth[_0x3f2e('0xa')](),controller[_0x3f2e('0xb')]);router[_0x3f2e('0xc')](_0x3f2e('0xd'),auth[_0x3f2e('0xa')](),controller[_0x3f2e('0xe')]);router[_0x3f2e('0xc')](_0x3f2e('0xf'),auth[_0x3f2e('0xa')](),controller[_0x3f2e('0x10')]);router[_0x3f2e('0x11')](_0x3f2e('0xf'),auth[_0x3f2e('0xa')](),controller[_0x3f2e('0x12')]);router[_0x3f2e('0x13')](_0x3f2e('0xf'),auth[_0x3f2e('0xa')](),controller[_0x3f2e('0x14')]);module[_0x3f2e('0x15')]=router; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.attributes.js b/server/api/cmHopperFinal/cmHopperFinal.attributes.js index 030305e..cc7ddfa 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 _0xfe34=['BOOLEAN','moment','exports','INTEGER','STRING','DATE','getDataValue','setDataValue','diff','dispositionat'];(function(_0x435928,_0x2e2f62){var _0x269156=function(_0xcca49d){while(--_0xcca49d){_0x435928['push'](_0x435928['shift']());}};_0x269156(++_0x2e2f62);}(_0xfe34,0x141));var _0x4fe3=function(_0x365789,_0x366c54){_0x365789=_0x365789-0x0;var _0x3e0030=_0xfe34[_0x365789];return _0x3e0030;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x4fe3('0x0'));module[_0x4fe3('0x1')]={'state':{'type':Sequelize[_0x4fe3('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x4fe3('0x3')]},'scheduledat':{'type':Sequelize[_0x4fe3('0x4')]},'countbusyretry':{'type':Sequelize[_0x4fe3('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x4fe3('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize['STRING']},'originatecalleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x4fe3('0x3')]},'calleridname':{'type':Sequelize[_0x4fe3('0x3')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0x4fe3('0x4')]},'droptime':{'type':Sequelize[_0x4fe3('0x4')]},'endtime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0x4fe3('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x4fe3('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x4fe3('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x4fe3('0x3')]},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize[_0x4fe3('0x3')]},'disposition':{'type':Sequelize[_0x4fe3('0x3')]},'secondDisposition':{'type':Sequelize[_0x4fe3('0x3')]},'thirdDisposition':{'type':Sequelize[_0x4fe3('0x3')]},'dispositionat':{'type':Sequelize[_0x4fe3('0x4')],'set':function(_0x3dbb58){var _0xf8102b=this[_0x4fe3('0x5')]('endtime');if(_0xf8102b&&_0x3dbb58){this[_0x4fe3('0x6')]('followuptime',moment(_0x3dbb58)[_0x4fe3('0x7')](moment(_0xf8102b),'seconds'));}return this[_0x4fe3('0x6')](_0x4fe3('0x8'),_0x3dbb58);}},'amd':{'type':Sequelize[_0x4fe3('0x9')],'defaultValue':![]},'fax':{'type':Sequelize[_0x4fe3('0x9')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0x4fe3('0x9')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0x4fe3('0x9')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0x4fe3('0x4')]},'callback':{'type':Sequelize[_0x4fe3('0x9')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x4fe3('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'deleted':{'type':Sequelize[_0x4fe3('0x3')],'defaultValue':null},'deletedat':{'type':Sequelize[_0x4fe3('0x4')]},'recallme':{'type':Sequelize[_0x4fe3('0x9')],'defaultValue':![]},'agiafterat':{'type':Sequelize['DATE']},'countnosuchnumberretry':{'type':Sequelize[_0x4fe3('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x4fe3('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x4fe3('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x4fe3('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x2c58=['endtime','setDataValue','followuptime','diff','seconds','dispositionat','BOOLEAN','moment','exports','INTEGER','DATE','STRING'];(function(_0x1deae8,_0x936ca2){var _0xf176ae=function(_0x3c0017){while(--_0x3c0017){_0x1deae8['push'](_0x1deae8['shift']());}};_0xf176ae(++_0x936ca2);}(_0x2c58,0x1ab));var _0x82c5=function(_0x5311b5,_0x3df0db){_0x5311b5=_0x5311b5-0x0;var _0x116e77=_0x2c58[_0x5311b5];return _0x116e77;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x82c5('0x0'));module[_0x82c5('0x1')]={'state':{'type':Sequelize[_0x82c5('0x2')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0x82c5('0x3')]},'countbusyretry':{'type':Sequelize[_0x82c5('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x82c5('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x82c5('0x4')]},'originatecalleridnum':{'type':Sequelize[_0x82c5('0x4')]},'originatecalleridname':{'type':Sequelize[_0x82c5('0x4')]},'calleridnum':{'type':Sequelize[_0x82c5('0x4')]},'calleridname':{'type':Sequelize[_0x82c5('0x4')]},'starttime':{'type':Sequelize[_0x82c5('0x3')]},'responsetime':{'type':Sequelize[_0x82c5('0x3')]},'answertime':{'type':Sequelize[_0x82c5('0x3')]},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x82c5('0x3')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x82c5('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x82c5('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x82c5('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x82c5('0x4')]},'campaign':{'type':Sequelize[_0x82c5('0x4')]},'campaigntype':{'type':Sequelize[_0x82c5('0x4')]},'membername':{'type':Sequelize[_0x82c5('0x4')]},'reason':{'type':Sequelize[_0x82c5('0x4')]},'disposition':{'type':Sequelize[_0x82c5('0x4')]},'secondDisposition':{'type':Sequelize[_0x82c5('0x4')]},'thirdDisposition':{'type':Sequelize[_0x82c5('0x4')]},'dispositionat':{'type':Sequelize[_0x82c5('0x3')],'set':function(_0x1a1e5c){var _0x16f873=this['getDataValue'](_0x82c5('0x5'));if(_0x16f873&&_0x1a1e5c){this[_0x82c5('0x6')](_0x82c5('0x7'),moment(_0x1a1e5c)[_0x82c5('0x8')](moment(_0x16f873),_0x82c5('0x9')));}return this['setDataValue'](_0x82c5('0xa'),_0x1a1e5c);}},'amd':{'type':Sequelize[_0x82c5('0xb')],'defaultValue':![]},'fax':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'blacklist':{'type':Sequelize[_0x82c5('0xb')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0x82c5('0xb')],'defaultValue':![]},'rescheduledat':{'type':Sequelize['DATE']},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x82c5('0x4')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x82c5('0x3')]},'deleted':{'type':Sequelize[_0x82c5('0x4')],'defaultValue':null},'deletedat':{'type':Sequelize[_0x82c5('0x3')]},'recallme':{'type':Sequelize[_0x82c5('0xb')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0x82c5('0x3')]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x82c5('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x82c5('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x82c5('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.controller.js b/server/api/cmHopperFinal/cmHopperFinal.controller.js index b725482..a64200e 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 _0x7096=['group','moveContactsIvrCampaignHopperFinal','Campaign','CampaignId','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','state\x20=\x20?','findOne','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','name','send','map','rawAttributes','fieldName','type','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','limit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','rows','params','CmHopperFinal','find','catch','describe','body','uniqueid','countContactsQueueCampaignHopperFinal','findAll','sequelize','COUNT','`state`\x20=\x200,\x201,\x20null','literal','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','busyContacts','`state`\x20=\x208,\x201,\x20null','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','`state`\x20=\x2019,\x201,\x20null','countContactsIvrCampaignHopperFinal','noSuchContacts','`state`\x20=\x2011\x20,\x201,\x20null','reCallContacts','moveContactsQueueCampaignHopperFinal','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','VoiceQueueId','updatedAt','select','field','ANY_VALUE(calleridnum)','NOW()','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','ANY_VALUE(VoiceQueueId)','createdAt','from','cm_hopper_final','VoiceQueueId\x20=\x20?','toString','state','calleridnum\x20IS\x20NOT\x20NULL','calleridnum','state\x20=\x204'];(function(_0x923f9b,_0x911264){var _0xfdf48e=function(_0x49bd30){while(--_0x49bd30){_0x923f9b['push'](_0x923f9b['shift']());}};_0xfdf48e(++_0x911264);}(_0x7096,0x10c));var _0x6709=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0x7096[_0xae7c2f];return _0x5d7001;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6709('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6709('0x1'));var rp=require('request-promise');var moment=require(_0x6709('0x2'));var BPromise=require(_0x6709('0x3'));var Mustache=require(_0x6709('0x4'));var util=require(_0x6709('0x5'));var path=require(_0x6709('0x6'));var sox=require(_0x6709('0x7'));var csv=require(_0x6709('0x8'));var ejs=require(_0x6709('0x9'));var fs=require('fs');var fs_extra=require(_0x6709('0xa'));var _=require(_0x6709('0xb'));var squel=require(_0x6709('0xc'));var crypto=require(_0x6709('0xd'));var jsforce=require(_0x6709('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x6709('0xf'));var Papa=require(_0x6709('0x10'));var Redis=require(_0x6709('0x11'));var authService=require(_0x6709('0x12'));var qs=require(_0x6709('0x13'));var as=require(_0x6709('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x6709('0x15'));var utils=require(_0x6709('0x16'));var config=require(_0x6709('0x17'));var licenseUtil=require(_0x6709('0x18'));var db=require(_0x6709('0x19'))['db'];function respondWithStatusCode(_0x288f51,_0x1d56a5){_0x1d56a5=_0x1d56a5||0xcc;return function(_0x1ac547){if(_0x1ac547){return _0x288f51['sendStatus'](_0x1d56a5);}return _0x288f51[_0x6709('0x1a')](_0x1d56a5)[_0x6709('0x1b')]();};}function respondWithResult(_0x4d5255,_0x3706e1){_0x3706e1=_0x3706e1||0xc8;return function(_0x4e4587){if(_0x4e4587){return _0x4d5255[_0x6709('0x1a')](_0x3706e1)['json'](_0x4e4587);}};}function respondWithFilteredResult(_0x41af1f,_0x4bc059){return function(_0x149233){if(_0x149233){var _0x28866a=typeof _0x4bc059[_0x6709('0x1c')]===_0x6709('0x1d')&&typeof _0x4bc059['limit']==='undefined';var _0x5c4f94=_0x149233[_0x6709('0x1e')];var _0x235a54=_0x28866a?0x0:_0x4bc059['offset'];var _0x9c1fd8=_0x28866a?_0x149233[_0x6709('0x1e')]:_0x4bc059[_0x6709('0x1c')]+_0x4bc059['limit'];var _0x13cf04;if(_0x9c1fd8>=_0x5c4f94){_0x9c1fd8=_0x5c4f94;_0x13cf04=0xc8;}else{_0x13cf04=0xce;}_0x41af1f[_0x6709('0x1a')](_0x13cf04);return _0x41af1f[_0x6709('0x1f')](_0x6709('0x20'),_0x235a54+'-'+_0x9c1fd8+'/'+_0x5c4f94)['json'](_0x149233);}return null;};}function patchUpdates(_0x3c4971){return function(_0x1edac3){try{jsonpatch[_0x6709('0x21')](_0x1edac3,_0x3c4971,!![]);}catch(_0x3cf882){return BPromise[_0x6709('0x22')](_0x3cf882);}return _0x1edac3[_0x6709('0x23')]();};}function saveUpdates(_0x45921e,_0x17763d){return function(_0x386224){if(_0x386224){return _0x386224[_0x6709('0x24')](_0x45921e)[_0x6709('0x25')](function(_0xa36371){return _0xa36371;});}return null;};}function removeEntity(_0x5cf48b,_0x29f25f){return function(_0x81138e){if(_0x81138e){return _0x81138e[_0x6709('0x26')]()['then'](function(){_0x5cf48b[_0x6709('0x1a')](0xcc)[_0x6709('0x1b')]();});}};}function handleEntityNotFound(_0x20a347,_0x44b465){return function(_0x588e00){if(!_0x588e00){_0x20a347[_0x6709('0x27')](0x194);}return _0x588e00;};}function handleError(_0x3076fe,_0x50f7d6){_0x50f7d6=_0x50f7d6||0x1f4;return function(_0x585073){logger[_0x6709('0x28')](_0x585073['stack']);if(_0x585073[_0x6709('0x29')]){delete _0x585073[_0x6709('0x29')];}_0x3076fe['status'](_0x50f7d6)[_0x6709('0x2a')](_0x585073);};}exports['index']=function(_0x46a325,_0x3cd555){var _0x5b6906={},_0x137137={},_0x4e6989={'count':0x0,'rows':[]};var _0xe066d8=_[_0x6709('0x2b')](db['CmHopperFinal'][_0x6709('0x2c')],function(_0x5deff5){return{'name':_0x5deff5[_0x6709('0x2d')],'type':_0x5deff5[_0x6709('0x2e')]['key']};});_0x137137['model']=_[_0x6709('0x2b')](_0xe066d8,_0x6709('0x29'));_0x137137[_0x6709('0x2f')]=_[_0x6709('0x30')](_0x46a325[_0x6709('0x2f')]);_0x137137[_0x6709('0x31')]=_[_0x6709('0x32')](_0x137137[_0x6709('0x33')],_0x137137[_0x6709('0x2f')]);_0x5b6906['attributes']=_[_0x6709('0x32')](_0x137137[_0x6709('0x33')],qs[_0x6709('0x34')](_0x46a325[_0x6709('0x2f')]['fields']));_0x5b6906[_0x6709('0x35')]=_0x5b6906[_0x6709('0x35')][_0x6709('0x36')]?_0x5b6906[_0x6709('0x35')]:_0x137137['model'];if(!_0x46a325[_0x6709('0x2f')][_0x6709('0x37')]('nolimit')){_0x5b6906[_0x6709('0x38')]=qs[_0x6709('0x38')](_0x46a325['query'][_0x6709('0x38')]);_0x5b6906[_0x6709('0x1c')]=qs[_0x6709('0x1c')](_0x46a325[_0x6709('0x2f')][_0x6709('0x1c')]);}_0x5b6906[_0x6709('0x39')]=qs[_0x6709('0x3a')](_0x46a325['query'][_0x6709('0x3a')]);_0x5b6906[_0x6709('0x3b')]=qs['filters'](_[_0x6709('0x3c')](_0x46a325[_0x6709('0x2f')],_0x137137[_0x6709('0x31')]),_0xe066d8);if(_0x46a325[_0x6709('0x2f')][_0x6709('0x3d')]){_0x5b6906[_0x6709('0x3b')]=_['merge'](_0x5b6906[_0x6709('0x3b')],{'$or':_['map'](_0xe066d8,function(_0x31e05a){if(_0x31e05a[_0x6709('0x2e')]!==_0x6709('0x3e')){var _0x48492f={};_0x48492f[_0x31e05a[_0x6709('0x29')]]={'$like':'%'+_0x46a325[_0x6709('0x2f')][_0x6709('0x3d')]+'%'};return _0x48492f;}})});}_0x5b6906=_[_0x6709('0x3f')]({},_0x5b6906,_0x46a325[_0x6709('0x40')]);var _0x1030ee={'where':_0x5b6906[_0x6709('0x3b')]};return db['CmHopperFinal'][_0x6709('0x1e')](_0x1030ee)[_0x6709('0x25')](function(_0x50fbcd){_0x4e6989[_0x6709('0x1e')]=_0x50fbcd;if(_0x46a325[_0x6709('0x2f')][_0x6709('0x41')]){_0x5b6906[_0x6709('0x42')]=[{'all':!![]}];}return db['CmHopperFinal']['findAll'](_0x5b6906);})[_0x6709('0x25')](function(_0x3f0da1){_0x4e6989[_0x6709('0x43')]=_0x3f0da1;return _0x4e6989;})[_0x6709('0x25')](respondWithFilteredResult(_0x3cd555,_0x5b6906))['catch'](handleError(_0x3cd555,null));};exports['show']=function(_0x5af1fb,_0x3d4237){var _0x293577={'raw':!![],'where':{'id':_0x5af1fb[_0x6709('0x44')]['id']}},_0x54f74e={};_0x54f74e[_0x6709('0x33')]=_['keys'](db['CmHopperFinal'][_0x6709('0x2c')]);_0x54f74e[_0x6709('0x2f')]=_[_0x6709('0x30')](_0x5af1fb[_0x6709('0x2f')]);_0x54f74e[_0x6709('0x31')]=_['intersection'](_0x54f74e[_0x6709('0x33')],_0x54f74e['query']);_0x293577[_0x6709('0x35')]=_[_0x6709('0x32')](_0x54f74e[_0x6709('0x33')],qs['fields'](_0x5af1fb[_0x6709('0x2f')]['fields']));_0x293577['attributes']=_0x293577[_0x6709('0x35')][_0x6709('0x36')]?_0x293577[_0x6709('0x35')]:_0x54f74e[_0x6709('0x33')];if(_0x5af1fb[_0x6709('0x2f')][_0x6709('0x41')]){_0x293577[_0x6709('0x42')]=[{'all':!![]}];}_0x293577=_[_0x6709('0x3f')]({},_0x293577,_0x5af1fb[_0x6709('0x40')]);return db[_0x6709('0x45')][_0x6709('0x46')](_0x293577)[_0x6709('0x25')](handleEntityNotFound(_0x3d4237,null))[_0x6709('0x25')](respondWithResult(_0x3d4237,null))[_0x6709('0x47')](handleError(_0x3d4237,null));};exports[_0x6709('0x48')]=function(_0x4f82a0,_0xfbb810){return db['CmHopperFinal']['describe']()[_0x6709('0x25')](respondWithResult(_0xfbb810,null))[_0x6709('0x47')](handleError(_0xfbb810,null));};exports[_0x6709('0x24')]=function(_0xe8dd1,_0x22363b){if(_0xe8dd1[_0x6709('0x49')][_0x6709('0x4a')]){delete _0xe8dd1[_0x6709('0x49')]['uniqueid'];}return db[_0x6709('0x45')][_0x6709('0x46')]({'where':{'uniqueid':_0xe8dd1[_0x6709('0x44')]['id']}})[_0x6709('0x25')](handleEntityNotFound(_0x22363b,null))['then'](saveUpdates(_0xe8dd1[_0x6709('0x49')],null))['then'](respondWithResult(_0x22363b,null))[_0x6709('0x47')](handleError(_0x22363b,null));};exports[_0x6709('0x4b')]=function(_0x2a563b,_0xb257b5,_0x35c9cd){return db['CmHopperFinal'][_0x6709('0x4c')]({'raw':![],'where':{'VoiceQueueId':_0x2a563b[_0x6709('0x44')]['id']},'attributes':[[db[_0x6709('0x4d')]['fn'](_0x6709('0x4e'),db[_0x6709('0x4d')]['fn']('IF',db['sequelize']['literal'](_0x6709('0x4f')))),'noSuchContacts'],[db['sequelize']['fn'](_0x6709('0x4e'),db[_0x6709('0x4d')]['fn']('IF',db[_0x6709('0x4d')][_0x6709('0x50')](_0x6709('0x51')))),_0x6709('0x52')],[db[_0x6709('0x4d')]['fn'](_0x6709('0x4e'),db[_0x6709('0x4d')]['fn']('IF',db[_0x6709('0x4d')][_0x6709('0x50')]('`state`\x20=\x205,\x201,\x20null'))),_0x6709('0x53')],[db[_0x6709('0x4d')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x6709('0x4d')][_0x6709('0x50')](_0x6709('0x54')))),_0x6709('0x55')],[db['sequelize']['fn'](_0x6709('0x4e'),db['sequelize']['fn']('IF',db[_0x6709('0x4d')][_0x6709('0x50')](_0x6709('0x56')))),_0x6709('0x57')],[db[_0x6709('0x4d')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x6709('0x4d')][_0x6709('0x50')]('`state`\x20=\x2011\x20,\x201,\x20null'))),_0x6709('0x58')],[db[_0x6709('0x4d')]['fn']('COUNT',db[_0x6709('0x4d')]['fn']('IF',db[_0x6709('0x4d')][_0x6709('0x50')](_0x6709('0x59')))),'reCallContacts'],[db['sequelize']['fn'](_0x6709('0x4e'),db['sequelize']['fn']('IF',db[_0x6709('0x4d')][_0x6709('0x50')](_0x6709('0x5a')))),'answeringMachine']]})[_0x6709('0x25')](handleEntityNotFound(_0xb257b5,null))['then'](respondWithResult(_0xb257b5,null))['catch'](handleError(_0xb257b5,null));};exports[_0x6709('0x5b')]=function(_0x511bae,_0x124199,_0x5cf7c0){return db[_0x6709('0x45')][_0x6709('0x4c')]({'raw':![],'where':{'CampaignId':_0x511bae[_0x6709('0x44')]['id']},'attributes':[[db[_0x6709('0x4d')]['fn']('COUNT',db[_0x6709('0x4d')]['fn']('IF',db[_0x6709('0x4d')][_0x6709('0x50')](_0x6709('0x4f')))),_0x6709('0x5c')],[db[_0x6709('0x4d')]['fn'](_0x6709('0x4e'),db['sequelize']['fn']('IF',db[_0x6709('0x4d')][_0x6709('0x50')](_0x6709('0x51')))),_0x6709('0x52')],[db[_0x6709('0x4d')]['fn'](_0x6709('0x4e'),db[_0x6709('0x4d')]['fn']('IF',db[_0x6709('0x4d')][_0x6709('0x50')]('`state`\x20=\x205,\x201,\x20null'))),_0x6709('0x53')],[db[_0x6709('0x4d')]['fn']('COUNT',db[_0x6709('0x4d')]['fn']('IF',db[_0x6709('0x4d')][_0x6709('0x50')](_0x6709('0x54')))),_0x6709('0x55')],[db[_0x6709('0x4d')]['fn'](_0x6709('0x4e'),db[_0x6709('0x4d')]['fn']('IF',db[_0x6709('0x4d')]['literal'](_0x6709('0x56')))),_0x6709('0x57')],[db[_0x6709('0x4d')]['fn'](_0x6709('0x4e'),db[_0x6709('0x4d')]['fn']('IF',db[_0x6709('0x4d')][_0x6709('0x50')](_0x6709('0x5d')))),_0x6709('0x58')],[db[_0x6709('0x4d')]['fn'](_0x6709('0x4e'),db['sequelize']['fn']('IF',db[_0x6709('0x4d')]['literal']('`state`\x20=\x2022,\x201,\x20null'))),_0x6709('0x5e')],[db[_0x6709('0x4d')]['fn'](_0x6709('0x4e'),db[_0x6709('0x4d')]['fn']('IF',db[_0x6709('0x4d')][_0x6709('0x50')](_0x6709('0x5a')))),'answeringMachine']]})['then'](handleEntityNotFound(_0x124199,null))[_0x6709('0x25')](respondWithResult(_0x124199,null))['catch'](handleError(_0x124199,null));};exports[_0x6709('0x5f')]=function(_0x47b7d9,_0x123183,_0x2f1faf){return db['VoiceQueue']['find']({'where':{'id':_0x47b7d9['params']['id']}})[_0x6709('0x25')](handleEntityNotFound(_0x123183,null))[_0x6709('0x25')](function(_0x24c584){var _0xbbfc50;if(_0x24c584){_0xbbfc50=squel[_0x6709('0x60')]()[_0x6709('0x61')](_0x6709('0x62'))[_0x6709('0x63')]([_0x6709('0x64'),_0x6709('0x65'),_0x6709('0x66'),_0x6709('0x67'),_0x6709('0x68'),'createdAt',_0x6709('0x69')],squel[_0x6709('0x6a')]()[_0x6709('0x6b')](_0x6709('0x6c'),'phone')['field'](_0x6709('0x6d'),'scheduledAt')['field'](_0x6709('0x6e'),_0x6709('0x66'))['field'](_0x6709('0x6f'),_0x6709('0x67'))[_0x6709('0x6b')](_0x6709('0x70'),_0x6709('0x68'))['field']('NOW()',_0x6709('0x71'))[_0x6709('0x6b')]('NOW()',_0x6709('0x69'))[_0x6709('0x72')](_0x6709('0x73'))['where'](_0x6709('0x74'),_0x47b7d9[_0x6709('0x44')]['id'][_0x6709('0x75')]())[_0x6709('0x3b')]('state\x20=\x20?',_0x47b7d9['body'][_0x6709('0x76')][_0x6709('0x75')]())[_0x6709('0x3b')](_0x6709('0x77'))[_0x6709('0x3b')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x6709('0x6a')]()[_0x6709('0x6b')]('phone')[_0x6709('0x72')](_0x6709('0x62'))[_0x6709('0x3b')](_0x6709('0x74'),_0x47b7d9[_0x6709('0x44')]['id']['toString']()))[_0x6709('0x3b')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x6709('0x6a')]()['field'](_0x6709('0x78'))[_0x6709('0x72')](_0x6709('0x73'))[_0x6709('0x3b')]('VoiceQueueId\x20=\x20?',_0x47b7d9[_0x6709('0x44')]['id'][_0x6709('0x75')]())[_0x6709('0x3b')](_0x6709('0x79')))[_0x6709('0x7a')](_0x6709('0x66')))['toString']();return db[_0x6709('0x4d')][_0x6709('0x2f')](_0xbbfc50);}return[];})[_0x6709('0x25')](respondWithResult(_0x123183,null))['catch'](handleError(_0x123183,null));};exports[_0x6709('0x7b')]=function(_0x124270,_0x57f14e,_0x4388a1){return db[_0x6709('0x7c')][_0x6709('0x46')]({'where':{'id':_0x124270['params']['id']}})[_0x6709('0x25')](handleEntityNotFound(_0x57f14e,null))[_0x6709('0x25')](function(_0x409723){var _0x5c8564;if(_0x409723){_0x5c8564=squel[_0x6709('0x60')]()[_0x6709('0x61')](_0x6709('0x62'))[_0x6709('0x63')]([_0x6709('0x64'),_0x6709('0x65'),'ContactId',_0x6709('0x67'),_0x6709('0x7d'),'createdAt',_0x6709('0x69')],squel[_0x6709('0x6a')]()[_0x6709('0x6b')]('ANY_VALUE(calleridnum)',_0x6709('0x64'))[_0x6709('0x6b')](_0x6709('0x6d'),_0x6709('0x65'))[_0x6709('0x6b')](_0x6709('0x6e'),_0x6709('0x66'))['field'](_0x6709('0x6f'),_0x6709('0x67'))[_0x6709('0x6b')](_0x6709('0x7e'),_0x6709('0x7d'))[_0x6709('0x6b')](_0x6709('0x6d'),'createdAt')[_0x6709('0x6b')]('NOW()',_0x6709('0x69'))[_0x6709('0x72')](_0x6709('0x73'))[_0x6709('0x3b')](_0x6709('0x7f'),_0x124270[_0x6709('0x44')]['id'][_0x6709('0x75')]())[_0x6709('0x3b')](_0x6709('0x80'),_0x124270[_0x6709('0x49')][_0x6709('0x76')][_0x6709('0x75')]())[_0x6709('0x3b')](_0x6709('0x77'))['where']('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x6709('0x6a')]()[_0x6709('0x6b')]('phone')[_0x6709('0x72')](_0x6709('0x62'))[_0x6709('0x3b')](_0x6709('0x7f'),_0x124270[_0x6709('0x44')]['id'][_0x6709('0x75')]()))[_0x6709('0x3b')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x6709('0x6a')]()[_0x6709('0x6b')](_0x6709('0x78'))[_0x6709('0x72')]('cm_hopper_final')['where'](_0x6709('0x7f'),_0x124270[_0x6709('0x44')]['id'][_0x6709('0x75')]())[_0x6709('0x3b')](_0x6709('0x79')))[_0x6709('0x7a')](_0x6709('0x66')))[_0x6709('0x75')]();return db[_0x6709('0x4d')][_0x6709('0x2f')](_0x5c8564);}return[];})[_0x6709('0x25')](respondWithResult(_0x57f14e,null))[_0x6709('0x47')](handleError(_0x57f14e,null));};exports['checkContactHopper']=function(_0x4767b7,_0x5f7adc,_0x393934){return db['CmHopper'][_0x6709('0x81')]({'where':{'VoiceQueueId':_0x4767b7[_0x6709('0x49')]['VoiceQueueId'],'CampaignId':_0x4767b7[_0x6709('0x49')]['CampaignId'],'ContactId':_0x4767b7[_0x6709('0x49')][_0x6709('0x66')]}})[_0x6709('0x25')](handleEntityNotFound(_0x5f7adc,null))[_0x6709('0x25')](function(_0x45cd4e){if(_0x45cd4e){return _0x45cd4e;}return null;})[_0x6709('0x25')](respondWithResult(_0x5f7adc,null))[_0x6709('0x47')](handleError(_0x5f7adc,null));}; \ No newline at end of file +var _0x01d9=['../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','save','update','then','destroy','error','name','send','index','map','CmHopperFinal','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','include','catch','show','params','includeAll','find','describe','body','uniqueid','countContactsQueueCampaignHopperFinal','findAll','sequelize','COUNT','literal','`state`\x20=\x200,\x201,\x20null','noSuchContacts','`state`\x20=\x203,\x201,\x20null','`state`\x20=\x205,\x201,\x20null','busyContacts','`state`\x20=\x208,\x201,\x20null','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','`state`\x20=\x2011\x20,\x201,\x20null','`state`\x20=\x2022,\x201,\x20null','`state`\x20=\x2019,\x201,\x20null','answeringMachine','noAnswerContacts','dropContacts','moveContactsQueueCampaignHopperFinal','VoiceQueue','into','cm_hopper','scheduledAt','ContactId','ListId','VoiceQueueId','createdAt','select','field','ANY_VALUE(calleridnum)','phone','NOW()','ANY_VALUE(ListId)','ANY_VALUE(VoiceQueueId)','VoiceQueueId\x20=\x20?','state\x20=\x20?','state','toString','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','from','calleridnum','cm_hopper_final','state\x20=\x204','group','moveContactsIvrCampaignHopperFinal','Campaign','insert','fromQuery','CampaignId','updatedAt','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','checkContactHopper','findOne','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment'];(function(_0x5de076,_0x404fa7){var _0x1b01ed=function(_0x5b738f){while(--_0x5b738f){_0x5de076['push'](_0x5de076['shift']());}};_0x1b01ed(++_0x404fa7);}(_0x01d9,0x6c));var _0x901d=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x01d9[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0x901d('0x0'));var rimraf=require(_0x901d('0x1'));var zipdir=require(_0x901d('0x2'));var jsonpatch=require(_0x901d('0x3'));var rp=require('request-promise');var moment=require(_0x901d('0x4'));var BPromise=require(_0x901d('0x5'));var Mustache=require(_0x901d('0x6'));var util=require(_0x901d('0x7'));var path=require(_0x901d('0x8'));var sox=require(_0x901d('0x9'));var csv=require(_0x901d('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x901d('0xb'));var _=require(_0x901d('0xc'));var squel=require(_0x901d('0xd'));var crypto=require(_0x901d('0xe'));var jsforce=require(_0x901d('0xf'));var deskjs=require(_0x901d('0x10'));var toCsv=require(_0x901d('0xa'));var querystring=require(_0x901d('0x11'));var Papa=require(_0x901d('0x12'));var Redis=require(_0x901d('0x13'));var authService=require(_0x901d('0x14'));var qs=require(_0x901d('0x15'));var as=require(_0x901d('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x901d('0x17'))('api');var utils=require(_0x901d('0x18'));var config=require(_0x901d('0x19'));var licenseUtil=require(_0x901d('0x1a'));var db=require(_0x901d('0x1b'))['db'];function respondWithStatusCode(_0x15ebaf,_0x5d2345){_0x5d2345=_0x5d2345||0xcc;return function(_0x1d8117){if(_0x1d8117){return _0x15ebaf[_0x901d('0x1c')](_0x5d2345);}return _0x15ebaf[_0x901d('0x1d')](_0x5d2345)[_0x901d('0x1e')]();};}function respondWithResult(_0xb8869a,_0x14d99b){_0x14d99b=_0x14d99b||0xc8;return function(_0x530a2b){if(_0x530a2b){return _0xb8869a[_0x901d('0x1d')](_0x14d99b)[_0x901d('0x1f')](_0x530a2b);}};}function respondWithFilteredResult(_0x11b0cc,_0x17d451){return function(_0x1aba97){if(_0x1aba97){var _0x7dd5f4=typeof _0x17d451[_0x901d('0x20')]===_0x901d('0x21')&&typeof _0x17d451[_0x901d('0x22')]===_0x901d('0x21');var _0x28caae=_0x1aba97[_0x901d('0x23')];var _0x285353=_0x7dd5f4?0x0:_0x17d451[_0x901d('0x20')];var _0x38f42b=_0x7dd5f4?_0x1aba97[_0x901d('0x23')]:_0x17d451[_0x901d('0x20')]+_0x17d451[_0x901d('0x22')];var _0x57d518;if(_0x38f42b>=_0x28caae){_0x38f42b=_0x28caae;_0x57d518=0xc8;}else{_0x57d518=0xce;}_0x11b0cc[_0x901d('0x1d')](_0x57d518);return _0x11b0cc[_0x901d('0x24')]('Content-Range',_0x285353+'-'+_0x38f42b+'/'+_0x28caae)['json'](_0x1aba97);}return null;};}function patchUpdates(_0x496a06){return function(_0x53f8ae){try{jsonpatch[_0x901d('0x25')](_0x53f8ae,_0x496a06,!![]);}catch(_0x44ea6f){return BPromise['reject'](_0x44ea6f);}return _0x53f8ae[_0x901d('0x26')]();};}function saveUpdates(_0x3ea3f6,_0x488e24){return function(_0x20778b){if(_0x20778b){return _0x20778b[_0x901d('0x27')](_0x3ea3f6)[_0x901d('0x28')](function(_0x3f80b9){return _0x3f80b9;});}return null;};}function removeEntity(_0x1e7d36,_0x1818d3){return function(_0x46e5c6){if(_0x46e5c6){return _0x46e5c6[_0x901d('0x29')]()['then'](function(){_0x1e7d36[_0x901d('0x1d')](0xcc)[_0x901d('0x1e')]();});}};}function handleEntityNotFound(_0xbc89a5,_0x1f0ee5){return function(_0x557809){if(!_0x557809){_0xbc89a5[_0x901d('0x1c')](0x194);}return _0x557809;};}function handleError(_0x23fd43,_0x27f4ca){_0x27f4ca=_0x27f4ca||0x1f4;return function(_0x3cbe43){logger[_0x901d('0x2a')](_0x3cbe43['stack']);if(_0x3cbe43[_0x901d('0x2b')]){delete _0x3cbe43[_0x901d('0x2b')];}_0x23fd43[_0x901d('0x1d')](_0x27f4ca)[_0x901d('0x2c')](_0x3cbe43);};}exports[_0x901d('0x2d')]=function(_0x3de9b9,_0x48e86e){var _0xae6dfe={},_0x533038={},_0x128830={'count':0x0,'rows':[]};var _0x389fd9=_[_0x901d('0x2e')](db[_0x901d('0x2f')][_0x901d('0x30')],function(_0x20df02){return{'name':_0x20df02[_0x901d('0x31')],'type':_0x20df02[_0x901d('0x32')][_0x901d('0x33')]};});_0x533038[_0x901d('0x34')]=_[_0x901d('0x2e')](_0x389fd9,_0x901d('0x2b'));_0x533038[_0x901d('0x35')]=_[_0x901d('0x36')](_0x3de9b9[_0x901d('0x35')]);_0x533038['filters']=_[_0x901d('0x37')](_0x533038[_0x901d('0x34')],_0x533038[_0x901d('0x35')]);_0xae6dfe['attributes']=_[_0x901d('0x37')](_0x533038[_0x901d('0x34')],qs[_0x901d('0x38')](_0x3de9b9[_0x901d('0x35')][_0x901d('0x38')]));_0xae6dfe[_0x901d('0x39')]=_0xae6dfe[_0x901d('0x39')][_0x901d('0x3a')]?_0xae6dfe[_0x901d('0x39')]:_0x533038[_0x901d('0x34')];if(!_0x3de9b9['query']['hasOwnProperty'](_0x901d('0x3b'))){_0xae6dfe['limit']=qs[_0x901d('0x22')](_0x3de9b9[_0x901d('0x35')]['limit']);_0xae6dfe[_0x901d('0x20')]=qs[_0x901d('0x20')](_0x3de9b9[_0x901d('0x35')]['offset']);}_0xae6dfe[_0x901d('0x3c')]=qs[_0x901d('0x3d')](_0x3de9b9[_0x901d('0x35')][_0x901d('0x3d')]);_0xae6dfe[_0x901d('0x3e')]=qs[_0x901d('0x3f')](_[_0x901d('0x40')](_0x3de9b9[_0x901d('0x35')],_0x533038[_0x901d('0x3f')]),_0x389fd9);if(_0x3de9b9[_0x901d('0x35')][_0x901d('0x41')]){_0xae6dfe[_0x901d('0x3e')]=_[_0x901d('0x42')](_0xae6dfe[_0x901d('0x3e')],{'$or':_[_0x901d('0x2e')](_0x389fd9,function(_0x1644d8){if(_0x1644d8['type']!==_0x901d('0x43')){var _0x423cab={};_0x423cab[_0x1644d8['name']]={'$like':'%'+_0x3de9b9['query'][_0x901d('0x41')]+'%'};return _0x423cab;}})});}_0xae6dfe=_['merge']({},_0xae6dfe,_0x3de9b9[_0x901d('0x44')]);var _0x3d0556={'where':_0xae6dfe[_0x901d('0x3e')]};return db[_0x901d('0x2f')][_0x901d('0x23')](_0x3d0556)[_0x901d('0x28')](function(_0x5df4cb){_0x128830['count']=_0x5df4cb;if(_0x3de9b9['query']['includeAll']){_0xae6dfe[_0x901d('0x45')]=[{'all':!![]}];}return db[_0x901d('0x2f')]['findAll'](_0xae6dfe);})[_0x901d('0x28')](function(_0x22fc44){_0x128830['rows']=_0x22fc44;return _0x128830;})[_0x901d('0x28')](respondWithFilteredResult(_0x48e86e,_0xae6dfe))[_0x901d('0x46')](handleError(_0x48e86e,null));};exports[_0x901d('0x47')]=function(_0x2c1895,_0x53663d){var _0x5aeb41={'raw':!![],'where':{'id':_0x2c1895[_0x901d('0x48')]['id']}},_0xa9c008={};_0xa9c008[_0x901d('0x34')]=_[_0x901d('0x36')](db[_0x901d('0x2f')][_0x901d('0x30')]);_0xa9c008[_0x901d('0x35')]=_[_0x901d('0x36')](_0x2c1895[_0x901d('0x35')]);_0xa9c008[_0x901d('0x3f')]=_[_0x901d('0x37')](_0xa9c008['model'],_0xa9c008[_0x901d('0x35')]);_0x5aeb41['attributes']=_[_0x901d('0x37')](_0xa9c008['model'],qs[_0x901d('0x38')](_0x2c1895['query'][_0x901d('0x38')]));_0x5aeb41[_0x901d('0x39')]=_0x5aeb41[_0x901d('0x39')][_0x901d('0x3a')]?_0x5aeb41[_0x901d('0x39')]:_0xa9c008[_0x901d('0x34')];if(_0x2c1895[_0x901d('0x35')][_0x901d('0x49')]){_0x5aeb41[_0x901d('0x45')]=[{'all':!![]}];}_0x5aeb41=_[_0x901d('0x42')]({},_0x5aeb41,_0x2c1895[_0x901d('0x44')]);return db['CmHopperFinal'][_0x901d('0x4a')](_0x5aeb41)[_0x901d('0x28')](handleEntityNotFound(_0x53663d,null))[_0x901d('0x28')](respondWithResult(_0x53663d,null))[_0x901d('0x46')](handleError(_0x53663d,null));};exports[_0x901d('0x4b')]=function(_0x24b6fa,_0x27459b){return db[_0x901d('0x2f')][_0x901d('0x4b')]()[_0x901d('0x28')](respondWithResult(_0x27459b,null))[_0x901d('0x46')](handleError(_0x27459b,null));};exports[_0x901d('0x27')]=function(_0x2cd965,_0x23f2a9){if(_0x2cd965['body']['uniqueid']){delete _0x2cd965[_0x901d('0x4c')][_0x901d('0x4d')];}return db[_0x901d('0x2f')][_0x901d('0x4a')]({'where':{'uniqueid':_0x2cd965[_0x901d('0x48')]['id']}})['then'](handleEntityNotFound(_0x23f2a9,null))['then'](saveUpdates(_0x2cd965[_0x901d('0x4c')],null))[_0x901d('0x28')](respondWithResult(_0x23f2a9,null))['catch'](handleError(_0x23f2a9,null));};exports[_0x901d('0x4e')]=function(_0x165207,_0x4d2b2d,_0x4512e5){return db['CmHopperFinal'][_0x901d('0x4f')]({'raw':![],'where':{'VoiceQueueId':_0x165207[_0x901d('0x48')]['id']},'attributes':[[db[_0x901d('0x50')]['fn'](_0x901d('0x51'),db['sequelize']['fn']('IF',db[_0x901d('0x50')][_0x901d('0x52')](_0x901d('0x53')))),_0x901d('0x54')],[db[_0x901d('0x50')]['fn'](_0x901d('0x51'),db[_0x901d('0x50')]['fn']('IF',db[_0x901d('0x50')][_0x901d('0x52')](_0x901d('0x55')))),'noAnswerContacts'],[db[_0x901d('0x50')]['fn']('COUNT',db[_0x901d('0x50')]['fn']('IF',db[_0x901d('0x50')][_0x901d('0x52')](_0x901d('0x56')))),_0x901d('0x57')],[db[_0x901d('0x50')]['fn'](_0x901d('0x51'),db[_0x901d('0x50')]['fn']('IF',db['sequelize'][_0x901d('0x52')](_0x901d('0x58')))),_0x901d('0x59')],[db['sequelize']['fn'](_0x901d('0x51'),db['sequelize']['fn']('IF',db[_0x901d('0x50')][_0x901d('0x52')](_0x901d('0x5a')))),'dropContacts'],[db[_0x901d('0x50')]['fn'](_0x901d('0x51'),db[_0x901d('0x50')]['fn']('IF',db[_0x901d('0x50')][_0x901d('0x52')](_0x901d('0x5b')))),'abandonedContacts'],[db[_0x901d('0x50')]['fn'](_0x901d('0x51'),db[_0x901d('0x50')]['fn']('IF',db[_0x901d('0x50')][_0x901d('0x52')](_0x901d('0x5c')))),'reCallContacts'],[db[_0x901d('0x50')]['fn']('COUNT',db['sequelize']['fn']('IF',db['sequelize']['literal'](_0x901d('0x5d')))),_0x901d('0x5e')]]})[_0x901d('0x28')](handleEntityNotFound(_0x4d2b2d,null))['then'](respondWithResult(_0x4d2b2d,null))[_0x901d('0x46')](handleError(_0x4d2b2d,null));};exports['countContactsIvrCampaignHopperFinal']=function(_0xabab57,_0x219c23,_0xecc8f9){return db[_0x901d('0x2f')][_0x901d('0x4f')]({'raw':![],'where':{'CampaignId':_0xabab57[_0x901d('0x48')]['id']},'attributes':[[db[_0x901d('0x50')]['fn'](_0x901d('0x51'),db[_0x901d('0x50')]['fn']('IF',db[_0x901d('0x50')][_0x901d('0x52')](_0x901d('0x53')))),_0x901d('0x54')],[db[_0x901d('0x50')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x901d('0x50')][_0x901d('0x52')](_0x901d('0x55')))),_0x901d('0x5f')],[db[_0x901d('0x50')]['fn'](_0x901d('0x51'),db[_0x901d('0x50')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x205,\x201,\x20null'))),_0x901d('0x57')],[db[_0x901d('0x50')]['fn'](_0x901d('0x51'),db[_0x901d('0x50')]['fn']('IF',db[_0x901d('0x50')][_0x901d('0x52')](_0x901d('0x58')))),_0x901d('0x59')],[db[_0x901d('0x50')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x901d('0x50')][_0x901d('0x52')](_0x901d('0x5a')))),_0x901d('0x60')],[db[_0x901d('0x50')]['fn'](_0x901d('0x51'),db[_0x901d('0x50')]['fn']('IF',db[_0x901d('0x50')][_0x901d('0x52')](_0x901d('0x5b')))),'abandonedContacts'],[db[_0x901d('0x50')]['fn'](_0x901d('0x51'),db['sequelize']['fn']('IF',db['sequelize'][_0x901d('0x52')](_0x901d('0x5c')))),'reCallContacts'],[db[_0x901d('0x50')]['fn'](_0x901d('0x51'),db[_0x901d('0x50')]['fn']('IF',db[_0x901d('0x50')]['literal'](_0x901d('0x5d')))),_0x901d('0x5e')]]})[_0x901d('0x28')](handleEntityNotFound(_0x219c23,null))[_0x901d('0x28')](respondWithResult(_0x219c23,null))[_0x901d('0x46')](handleError(_0x219c23,null));};exports[_0x901d('0x61')]=function(_0x5cff96,_0x130dfb,_0x302049){return db[_0x901d('0x62')]['find']({'where':{'id':_0x5cff96[_0x901d('0x48')]['id']}})[_0x901d('0x28')](handleEntityNotFound(_0x130dfb,null))[_0x901d('0x28')](function(_0x4b5e3b){var _0x576d50;if(_0x4b5e3b){_0x576d50=squel['insert']()[_0x901d('0x63')](_0x901d('0x64'))['fromQuery'](['phone',_0x901d('0x65'),_0x901d('0x66'),_0x901d('0x67'),_0x901d('0x68'),_0x901d('0x69'),'updatedAt'],squel[_0x901d('0x6a')]()[_0x901d('0x6b')](_0x901d('0x6c'),_0x901d('0x6d'))['field'](_0x901d('0x6e'),'scheduledAt')[_0x901d('0x6b')]('ANY_VALUE(ContactId)',_0x901d('0x66'))[_0x901d('0x6b')](_0x901d('0x6f'),_0x901d('0x67'))[_0x901d('0x6b')](_0x901d('0x70'),_0x901d('0x68'))['field'](_0x901d('0x6e'),_0x901d('0x69'))['field'](_0x901d('0x6e'),'updatedAt')['from']('cm_hopper_final')['where'](_0x901d('0x71'),_0x5cff96[_0x901d('0x48')]['id']['toString']())[_0x901d('0x3e')](_0x901d('0x72'),_0x5cff96[_0x901d('0x4c')][_0x901d('0x73')][_0x901d('0x74')]())['where'](_0x901d('0x75'))[_0x901d('0x3e')](_0x901d('0x76'),squel['select']()[_0x901d('0x6b')](_0x901d('0x6d'))[_0x901d('0x77')](_0x901d('0x64'))[_0x901d('0x3e')](_0x901d('0x71'),_0x5cff96[_0x901d('0x48')]['id'][_0x901d('0x74')]()))[_0x901d('0x3e')](_0x901d('0x76'),squel[_0x901d('0x6a')]()[_0x901d('0x6b')](_0x901d('0x78'))['from'](_0x901d('0x79'))[_0x901d('0x3e')](_0x901d('0x71'),_0x5cff96[_0x901d('0x48')]['id'][_0x901d('0x74')]())[_0x901d('0x3e')](_0x901d('0x7a')))[_0x901d('0x7b')]('ContactId'))[_0x901d('0x74')]();return db[_0x901d('0x50')][_0x901d('0x35')](_0x576d50);}return[];})['then'](respondWithResult(_0x130dfb,null))[_0x901d('0x46')](handleError(_0x130dfb,null));};exports[_0x901d('0x7c')]=function(_0xa14cbd,_0x34f33f,_0x785f77){return db[_0x901d('0x7d')][_0x901d('0x4a')]({'where':{'id':_0xa14cbd[_0x901d('0x48')]['id']}})[_0x901d('0x28')](handleEntityNotFound(_0x34f33f,null))[_0x901d('0x28')](function(_0x28b640){var _0x45601a;if(_0x28b640){_0x45601a=squel[_0x901d('0x7e')]()[_0x901d('0x63')](_0x901d('0x64'))[_0x901d('0x7f')](['phone',_0x901d('0x65'),_0x901d('0x66'),_0x901d('0x67'),_0x901d('0x80'),_0x901d('0x69'),_0x901d('0x81')],squel['select']()[_0x901d('0x6b')](_0x901d('0x6c'),_0x901d('0x6d'))[_0x901d('0x6b')](_0x901d('0x6e'),_0x901d('0x65'))[_0x901d('0x6b')]('ANY_VALUE(ContactId)',_0x901d('0x66'))['field'](_0x901d('0x6f'),_0x901d('0x67'))[_0x901d('0x6b')](_0x901d('0x82'),'CampaignId')['field']('NOW()','createdAt')[_0x901d('0x6b')](_0x901d('0x6e'),'updatedAt')['from']('cm_hopper_final')[_0x901d('0x3e')]('CampaignId\x20=\x20?',_0xa14cbd[_0x901d('0x48')]['id'][_0x901d('0x74')]())[_0x901d('0x3e')]('state\x20=\x20?',_0xa14cbd['body'][_0x901d('0x73')][_0x901d('0x74')]())[_0x901d('0x3e')]('calleridnum\x20IS\x20NOT\x20NULL')['where']('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x901d('0x6a')]()[_0x901d('0x6b')]('phone')[_0x901d('0x77')]('cm_hopper')['where'](_0x901d('0x83'),_0xa14cbd['params']['id'][_0x901d('0x74')]()))[_0x901d('0x3e')](_0x901d('0x76'),squel[_0x901d('0x6a')]()[_0x901d('0x6b')](_0x901d('0x78'))['from'](_0x901d('0x79'))[_0x901d('0x3e')](_0x901d('0x83'),_0xa14cbd[_0x901d('0x48')]['id'][_0x901d('0x74')]())[_0x901d('0x3e')]('state\x20=\x204'))['group'](_0x901d('0x66')))[_0x901d('0x74')]();return db[_0x901d('0x50')][_0x901d('0x35')](_0x45601a);}return[];})[_0x901d('0x28')](respondWithResult(_0x34f33f,null))[_0x901d('0x46')](handleError(_0x34f33f,null));};exports[_0x901d('0x84')]=function(_0x306491,_0x3cb399,_0x101067){return db['CmHopper'][_0x901d('0x85')]({'where':{'VoiceQueueId':_0x306491[_0x901d('0x4c')][_0x901d('0x68')],'CampaignId':_0x306491[_0x901d('0x4c')][_0x901d('0x80')],'ContactId':_0x306491[_0x901d('0x4c')][_0x901d('0x66')]}})[_0x901d('0x28')](handleEntityNotFound(_0x3cb399,null))[_0x901d('0x28')](function(_0x17b7ef){if(_0x17b7ef){return _0x17b7ef;}return null;})[_0x901d('0x28')](respondWithResult(_0x3cb399,null))[_0x901d('0x46')](handleError(_0x3cb399,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index 24bbe78..24307dd 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 _0x3af2=['define','CmHopperFinal','cm_hopper_final','calleridnum','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmHopperFinal.attributes'];(function(_0x51bb74,_0x3af26f){var _0x5a124b=function(_0x292fb6){while(--_0x292fb6){_0x51bb74['push'](_0x51bb74['shift']());}};_0x5a124b(++_0x3af26f);}(_0x3af2,0xac));var _0x23af=function(_0x2351c4,_0x1dca54){_0x2351c4=_0x2351c4-0x0;var _0x1dd3f8=_0x3af2[_0x2351c4];return _0x1dd3f8;};'use strict';var _=require('lodash');var util=require(_0x23af('0x0'));var logger=require(_0x23af('0x1'))(_0x23af('0x2'));var moment=require(_0x23af('0x3'));var BPromise=require(_0x23af('0x4'));var rp=require(_0x23af('0x5'));var fs=require('fs');var path=require(_0x23af('0x6'));var rimraf=require(_0x23af('0x7'));var config=require(_0x23af('0x8'));var attributes=require(_0x23af('0x9'));module['exports']=function(_0x1b8ae8,_0x4ae80f){return _0x1b8ae8[_0x23af('0xa')](_0x23af('0xb'),attributes,{'tableName':_0x23af('0xc'),'paranoid':![],'indexes':[{'name':_0x23af('0xd'),'fields':[_0x23af('0xd')]},{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x9dbd=['CmHopperFinal','cm_hopper_final','calleridnum','uniqueid','lodash','util','api','moment','request-promise','path','define'];(function(_0x19eefa,_0x53f333){var _0x1123f0=function(_0xe3a4d8){while(--_0xe3a4d8){_0x19eefa['push'](_0x19eefa['shift']());}};_0x1123f0(++_0x53f333);}(_0x9dbd,0xb4));var _0xd9db=function(_0xeb9086,_0x312332){_0xeb9086=_0xeb9086-0x0;var _0x3d5f58=_0x9dbd[_0xeb9086];return _0x3d5f58;};'use strict';var _=require(_0xd9db('0x0'));var util=require(_0xd9db('0x1'));var logger=require('../../config/logger')(_0xd9db('0x2'));var moment=require(_0xd9db('0x3'));var BPromise=require('bluebird');var rp=require(_0xd9db('0x4'));var fs=require('fs');var path=require(_0xd9db('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./cmHopperFinal.attributes');module['exports']=function(_0x495ff9,_0x2a85e7){return _0x495ff9[_0xd9db('0x6')](_0xd9db('0x7'),attributes,{'tableName':_0xd9db('0x8'),'paranoid':![],'indexes':[{'name':_0xd9db('0x9'),'fields':['calleridnum']},{'name':_0xd9db('0xa'),'fields':[_0xd9db('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.rpc.js b/server/api/cmHopperFinal/cmHopperFinal.rpc.js index 36f0d7f..ba69a02 100644 --- a/server/api/cmHopperFinal/cmHopperFinal.rpc.js +++ b/server/api/cmHopperFinal/cmHopperFinal.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['debug','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','CmHopperFinal,\x20%s,\x20%s','CmHopperFinal,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','CreateCmHopperFinal','CmHopperFinal','create','options','raw'];(function(_0x26592b,_0x1ee506){var _0x4ee592=function(_0xa6a9af){while(--_0xa6a9af){_0x26592b['push'](_0x26592b['shift']());}};_0x4ee592(++_0x1ee506);}(_0xb10b,0x12a));var _0xbb10=function(_0x21f7c2,_0x1b2426){_0x21f7c2=_0x21f7c2-0x0;var _0x3f3279=_0xb10b[_0x21f7c2];return _0x3f3279;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')](_0x378da8['body'],{'raw':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![]})[_0xbb10('0xc')](function(_0xdf237d){logger[_0xbb10('0xd')]('CreateCmHopperFinal',_0x378da8);logger[_0xbb10('0x1a')](_0xbb10('0x15'),_0x378da8,JSON['stringify'](_0xdf237d));_0x575cca(_0xdf237d);})['catch'](function(_0x8e2b97){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x8e2b97[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4[_0xbb10('0x12')](0x1f4,_0x8e2b97[_0xbb10('0x13')]));});});}; \ No newline at end of file +var _0xb10b=['debug','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','CmHopperFinal,\x20%s,\x20%s','CmHopperFinal,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','CreateCmHopperFinal','CmHopperFinal','create','options','raw'];(function(_0x2888b0,_0x36bbef){var _0x389329=function(_0x93f49b){while(--_0x93f49b){_0x2888b0['push'](_0x2888b0['shift']());}};_0x389329(++_0x36bbef);}(_0xb10b,0x12a));var _0xbb10=function(_0x5dc2fa,_0x56279d){_0x5dc2fa=_0x5dc2fa-0x0;var _0x16eaf9=_0xb10b[_0x5dc2fa];return _0x16eaf9;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')](_0x378da8['body'],{'raw':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![]})[_0xbb10('0xc')](function(_0xdf237d){logger[_0xbb10('0xd')]('CreateCmHopperFinal',_0x378da8);logger[_0xbb10('0x1a')](_0xbb10('0x15'),_0x378da8,JSON['stringify'](_0xdf237d));_0x575cca(_0xdf237d);})['catch'](function(_0x8e2b97){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x8e2b97[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4[_0xbb10('0x12')](0x1f4,_0x8e2b97[_0xbb10('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/index.js b/server/api/cmHopperFinal/index.js index 1a95a37..b4b0300 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 _0xaf42=['path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperFinal.controller','get','index','/describe','isAuthenticated','/:id','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','post','/voice/queue/moveContacts/:id','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','/checkContactHopper','checkContactHopper','put','exports','util'];(function(_0x8de54f,_0x271987){var _0x14cba4=function(_0x58ed41){while(--_0x58ed41){_0x8de54f['push'](_0x8de54f['shift']());}};_0x14cba4(++_0x271987);}(_0xaf42,0x11f));var _0x2af4=function(_0x368850,_0x32bb6f){_0x368850=_0x368850-0x0;var _0x417f93=_0xaf42[_0x368850];return _0x417f93;};'use strict';var multer=require('multer');var util=require(_0x2af4('0x0'));var path=require(_0x2af4('0x1'));var timeout=require(_0x2af4('0x2'));var express=require(_0x2af4('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x2af4('0x4'));var interaction=require(_0x2af4('0x5'));var config=require(_0x2af4('0x6'));var controller=require(_0x2af4('0x7'));router[_0x2af4('0x8')]('/',auth['isAuthenticated'](),controller[_0x2af4('0x9')]);router[_0x2af4('0x8')](_0x2af4('0xa'),auth[_0x2af4('0xb')](),controller['describe']);router[_0x2af4('0x8')](_0x2af4('0xc'),auth[_0x2af4('0xb')](),controller['show']);router[_0x2af4('0x8')](_0x2af4('0xd'),auth['isAuthenticated'](),controller[_0x2af4('0xe')]);router[_0x2af4('0x8')](_0x2af4('0xf'),auth['isAuthenticated'](),controller['countContactsIvrCampaignHopperFinal']);router[_0x2af4('0x10')](_0x2af4('0x11'),auth[_0x2af4('0xb')](),controller['moveContactsQueueCampaignHopperFinal']);router[_0x2af4('0x10')](_0x2af4('0x12'),auth[_0x2af4('0xb')](),controller[_0x2af4('0x13')]);router[_0x2af4('0x10')](_0x2af4('0x14'),auth[_0x2af4('0xb')](),controller[_0x2af4('0x15')]);router[_0x2af4('0x16')]('/:id',auth[_0x2af4('0xb')](),controller['update']);module[_0x2af4('0x17')]=router; \ No newline at end of file +var _0x3121=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperFinal.controller','get','isAuthenticated','index','describe','/:id','show','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','post','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','/checkContactHopper','checkContactHopper','update','exports','util','path','express'];(function(_0x4ccd0a,_0x523d4d){var _0x36eb6c=function(_0xba32ef){while(--_0xba32ef){_0x4ccd0a['push'](_0x4ccd0a['shift']());}};_0x36eb6c(++_0x523d4d);}(_0x3121,0x14d));var _0x1312=function(_0x3d7de9,_0x3057f6){_0x3d7de9=_0x3d7de9-0x0;var _0x3fdbe8=_0x3121[_0x3d7de9];return _0x3fdbe8;};'use strict';var multer=require('multer');var util=require(_0x1312('0x0'));var path=require(_0x1312('0x1'));var timeout=require('connect-timeout');var express=require(_0x1312('0x2'));var router=express[_0x1312('0x3')]();var fs_extra=require(_0x1312('0x4'));var auth=require(_0x1312('0x5'));var interaction=require(_0x1312('0x6'));var config=require(_0x1312('0x7'));var controller=require(_0x1312('0x8'));router[_0x1312('0x9')]('/',auth[_0x1312('0xa')](),controller[_0x1312('0xb')]);router[_0x1312('0x9')]('/describe',auth['isAuthenticated'](),controller[_0x1312('0xc')]);router[_0x1312('0x9')](_0x1312('0xd'),auth[_0x1312('0xa')](),controller[_0x1312('0xe')]);router['get'](_0x1312('0xf'),auth[_0x1312('0xa')](),controller[_0x1312('0x10')]);router['get'](_0x1312('0x11'),auth[_0x1312('0xa')](),controller[_0x1312('0x12')]);router[_0x1312('0x13')](_0x1312('0x14'),auth[_0x1312('0xa')](),controller[_0x1312('0x15')]);router[_0x1312('0x13')](_0x1312('0x16'),auth[_0x1312('0xa')](),controller[_0x1312('0x17')]);router[_0x1312('0x13')](_0x1312('0x18'),auth['isAuthenticated'](),controller[_0x1312('0x19')]);router['put']('/:id',auth[_0x1312('0xa')](),controller[_0x1312('0x1a')]);module[_0x1312('0x1b')]=router; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.attributes.js b/server/api/cmHopperHistory/cmHopperHistory.attributes.js index 6472588..3719135 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 _0x1300=['STRING','DATE','BOOLEAN','sequelize','exports','INTEGER'];(function(_0x5a3299,_0x1f7bc0){var _0x5c51d7=function(_0x4d77db){while(--_0x4d77db){_0x5a3299['push'](_0x5a3299['shift']());}};_0x5c51d7(++_0x1f7bc0);}(_0x1300,0x1bf));var _0x0130=function(_0x5c83e3,_0x482f2b){_0x5c83e3=_0x5c83e3-0x0;var _0x3f7ace=_0x1300[_0x5c83e3];return _0x3f7ace;};'use strict';var Sequelize=require(_0x0130('0x0'));module[_0x0130('0x1')]={'state':{'type':Sequelize[_0x0130('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x0130('0x3')]},'scheduledat':{'type':Sequelize[_0x0130('0x4')]},'countbusyretry':{'type':Sequelize[_0x0130('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x0130('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x0130('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x0130('0x3')]},'originatecalleridnum':{'type':Sequelize[_0x0130('0x3')]},'originatecalleridname':{'type':Sequelize[_0x0130('0x3')]},'calleridnum':{'type':Sequelize[_0x0130('0x3')]},'calleridname':{'type':Sequelize[_0x0130('0x3')]},'starttime':{'type':Sequelize[_0x0130('0x4')]},'responsetime':{'type':Sequelize[_0x0130('0x4')]},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize[_0x0130('0x4')]},'endtime':{'type':Sequelize[_0x0130('0x4')]},'ringtime':{'type':Sequelize[_0x0130('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x0130('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x0130('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x0130('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize[_0x0130('0x3')]},'campaigntype':{'type':Sequelize[_0x0130('0x3')]},'membername':{'type':Sequelize[_0x0130('0x3')]},'reason':{'type':Sequelize[_0x0130('0x3')]},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize[_0x0130('0x5')],'defaultValue':![]},'callback':{'type':Sequelize[_0x0130('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x0130('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize[_0x0130('0x5')],'defaultValue':![]},'editedat':{'type':Sequelize[_0x0130('0x4')]},'edited':{'type':Sequelize[_0x0130('0x5')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x0130('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x0130('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x0130('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x0130('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xd365=['STRING','DATE','BOOLEAN','sequelize','INTEGER'];(function(_0x220bec,_0x3e116e){var _0x398827=function(_0x2290c3){while(--_0x2290c3){_0x220bec['push'](_0x220bec['shift']());}};_0x398827(++_0x3e116e);}(_0xd365,0x102));var _0x5d36=function(_0x49dab2,_0x3adc67){_0x49dab2=_0x49dab2-0x0;var _0x148d3a=_0xd365[_0x49dab2];return _0x148d3a;};'use strict';var Sequelize=require(_0x5d36('0x0'));module['exports']={'state':{'type':Sequelize[_0x5d36('0x1')](0x2)},'statedesc':{'type':Sequelize[_0x5d36('0x2')]},'scheduledat':{'type':Sequelize[_0x5d36('0x3')]},'countbusyretry':{'type':Sequelize[_0x5d36('0x1')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x5d36('0x1')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x5d36('0x1')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x5d36('0x2')]},'originatecalleridnum':{'type':Sequelize[_0x5d36('0x2')]},'originatecalleridname':{'type':Sequelize[_0x5d36('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0x5d36('0x3')]},'responsetime':{'type':Sequelize[_0x5d36('0x3')]},'answertime':{'type':Sequelize[_0x5d36('0x3')]},'droptime':{'type':Sequelize[_0x5d36('0x3')]},'endtime':{'type':Sequelize[_0x5d36('0x3')]},'ringtime':{'type':Sequelize[_0x5d36('0x1')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x5d36('0x1')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x5d36('0x1')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x5d36('0x1')],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0x5d36('0x2')]},'membername':{'type':Sequelize[_0x5d36('0x2')]},'reason':{'type':Sequelize['STRING']},'amd':{'type':Sequelize[_0x5d36('0x4')],'defaultValue':![]},'fax':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callback':{'type':Sequelize[_0x5d36('0x4')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x5d36('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x5d36('0x3')]},'recallme':{'type':Sequelize[_0x5d36('0x4')],'defaultValue':![]},'editedat':{'type':Sequelize[_0x5d36('0x3')]},'edited':{'type':Sequelize[_0x5d36('0x4')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0x5d36('0x1')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x5d36('0x1')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.controller.js b/server/api/cmHopperHistory/cmHopperHistory.controller.js index e140f97..2f1706f 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 _0xfffc=['model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','filters','pick','filter','where','merge','options','includeAll','include','findAll','rows','catch','show','find','create','body','describe','uniqueid','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../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','reject','save','update','then','destroy','error','stack','name','send','index','map','CmHopperHistory','rawAttributes','fieldName','type','key'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xfffc,0x6b));var _0xcfff=function(_0x2985ac,_0x38254e){_0x2985ac=_0x2985ac-0x0;var _0x382b19=_0xfffc[_0x2985ac];return _0x382b19;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xcfff('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xcfff('0x1'));var rp=require('request-promise');var moment=require(_0xcfff('0x2'));var BPromise=require(_0xcfff('0x3'));var Mustache=require(_0xcfff('0x4'));var util=require(_0xcfff('0x5'));var path=require(_0xcfff('0x6'));var sox=require(_0xcfff('0x7'));var csv=require(_0xcfff('0x8'));var ejs=require(_0xcfff('0x9'));var fs=require('fs');var fs_extra=require(_0xcfff('0xa'));var _=require(_0xcfff('0xb'));var squel=require(_0xcfff('0xc'));var crypto=require(_0xcfff('0xd'));var jsforce=require(_0xcfff('0xe'));var deskjs=require(_0xcfff('0xf'));var toCsv=require(_0xcfff('0x8'));var querystring=require(_0xcfff('0x10'));var Papa=require(_0xcfff('0x11'));var Redis=require(_0xcfff('0x12'));var authService=require(_0xcfff('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xcfff('0x14'));var logger=require(_0xcfff('0x15'))(_0xcfff('0x16'));var utils=require(_0xcfff('0x17'));var config=require(_0xcfff('0x18'));var licenseUtil=require(_0xcfff('0x19'));var db=require(_0xcfff('0x1a'))['db'];function respondWithStatusCode(_0x299a68,_0x3019fb){_0x3019fb=_0x3019fb||0xcc;return function(_0x4c4332){if(_0x4c4332){return _0x299a68[_0xcfff('0x1b')](_0x3019fb);}return _0x299a68[_0xcfff('0x1c')](_0x3019fb)[_0xcfff('0x1d')]();};}function respondWithResult(_0x3e309f,_0x5e8c83){_0x5e8c83=_0x5e8c83||0xc8;return function(_0x2888e4){if(_0x2888e4){return _0x3e309f[_0xcfff('0x1c')](_0x5e8c83)[_0xcfff('0x1e')](_0x2888e4);}};}function respondWithFilteredResult(_0x1f0bc5,_0x1fbdf5){return function(_0x10fc47){if(_0x10fc47){var _0x21be65=typeof _0x1fbdf5[_0xcfff('0x1f')]===_0xcfff('0x20')&&typeof _0x1fbdf5[_0xcfff('0x21')]===_0xcfff('0x20');var _0x9da6d2=_0x10fc47[_0xcfff('0x22')];var _0xbc7b63=_0x21be65?0x0:_0x1fbdf5[_0xcfff('0x1f')];var _0x1fcbdb=_0x21be65?_0x10fc47[_0xcfff('0x22')]:_0x1fbdf5[_0xcfff('0x1f')]+_0x1fbdf5[_0xcfff('0x21')];var _0x3c6998;if(_0x1fcbdb>=_0x9da6d2){_0x1fcbdb=_0x9da6d2;_0x3c6998=0xc8;}else{_0x3c6998=0xce;}_0x1f0bc5[_0xcfff('0x1c')](_0x3c6998);return _0x1f0bc5[_0xcfff('0x23')](_0xcfff('0x24'),_0xbc7b63+'-'+_0x1fcbdb+'/'+_0x9da6d2)[_0xcfff('0x1e')](_0x10fc47);}return null;};}function patchUpdates(_0x5288a9){return function(_0x1cf7b8){try{jsonpatch['apply'](_0x1cf7b8,_0x5288a9,!![]);}catch(_0x4bce91){return BPromise[_0xcfff('0x25')](_0x4bce91);}return _0x1cf7b8[_0xcfff('0x26')]();};}function saveUpdates(_0xb75f96,_0x26b3f6){return function(_0x22c7da){if(_0x22c7da){return _0x22c7da[_0xcfff('0x27')](_0xb75f96)[_0xcfff('0x28')](function(_0x288a53){return _0x288a53;});}return null;};}function removeEntity(_0x309a74,_0x4a4b77){return function(_0x367928){if(_0x367928){return _0x367928[_0xcfff('0x29')]()[_0xcfff('0x28')](function(){_0x309a74['status'](0xcc)[_0xcfff('0x1d')]();});}};}function handleEntityNotFound(_0x1055cc,_0x232502){return function(_0x1c296f){if(!_0x1c296f){_0x1055cc[_0xcfff('0x1b')](0x194);}return _0x1c296f;};}function handleError(_0x68669b,_0x23d4cf){_0x23d4cf=_0x23d4cf||0x1f4;return function(_0x575b78){logger[_0xcfff('0x2a')](_0x575b78[_0xcfff('0x2b')]);if(_0x575b78[_0xcfff('0x2c')]){delete _0x575b78[_0xcfff('0x2c')];}_0x68669b[_0xcfff('0x1c')](_0x23d4cf)[_0xcfff('0x2d')](_0x575b78);};}exports[_0xcfff('0x2e')]=function(_0x47766b,_0x78b954){var _0x3cc9d8={},_0xf1c77b={},_0x2a85ff={'count':0x0,'rows':[]};var _0x21288a=_[_0xcfff('0x2f')](db[_0xcfff('0x30')][_0xcfff('0x31')],function(_0x3071fa){return{'name':_0x3071fa[_0xcfff('0x32')],'type':_0x3071fa[_0xcfff('0x33')][_0xcfff('0x34')]};});_0xf1c77b[_0xcfff('0x35')]=_[_0xcfff('0x2f')](_0x21288a,_0xcfff('0x2c'));_0xf1c77b[_0xcfff('0x36')]=_[_0xcfff('0x37')](_0x47766b[_0xcfff('0x36')]);_0xf1c77b['filters']=_[_0xcfff('0x38')](_0xf1c77b['model'],_0xf1c77b[_0xcfff('0x36')]);_0x3cc9d8[_0xcfff('0x39')]=_[_0xcfff('0x38')](_0xf1c77b[_0xcfff('0x35')],qs[_0xcfff('0x3a')](_0x47766b['query'][_0xcfff('0x3a')]));_0x3cc9d8['attributes']=_0x3cc9d8[_0xcfff('0x39')][_0xcfff('0x3b')]?_0x3cc9d8['attributes']:_0xf1c77b[_0xcfff('0x35')];if(!_0x47766b[_0xcfff('0x36')][_0xcfff('0x3c')]('nolimit')){_0x3cc9d8[_0xcfff('0x21')]=qs[_0xcfff('0x21')](_0x47766b[_0xcfff('0x36')][_0xcfff('0x21')]);_0x3cc9d8[_0xcfff('0x1f')]=qs[_0xcfff('0x1f')](_0x47766b['query'][_0xcfff('0x1f')]);}_0x3cc9d8[_0xcfff('0x3d')]=qs['sort'](_0x47766b[_0xcfff('0x36')][_0xcfff('0x3e')]);_0x3cc9d8['where']=qs[_0xcfff('0x3f')](_[_0xcfff('0x40')](_0x47766b[_0xcfff('0x36')],_0xf1c77b['filters']),_0x21288a);if(_0x47766b[_0xcfff('0x36')][_0xcfff('0x41')]){_0x3cc9d8[_0xcfff('0x42')]=_[_0xcfff('0x43')](_0x3cc9d8[_0xcfff('0x42')],{'$or':_['map'](_0x21288a,function(_0x37929f){if(_0x37929f[_0xcfff('0x33')]!=='VIRTUAL'){var _0x5abf79={};_0x5abf79[_0x37929f[_0xcfff('0x2c')]]={'$like':'%'+_0x47766b['query'][_0xcfff('0x41')]+'%'};return _0x5abf79;}})});}_0x3cc9d8=_['merge']({},_0x3cc9d8,_0x47766b[_0xcfff('0x44')]);var _0x5e67a5={'where':_0x3cc9d8['where']};return db[_0xcfff('0x30')][_0xcfff('0x22')](_0x5e67a5)[_0xcfff('0x28')](function(_0x2bfc75){_0x2a85ff['count']=_0x2bfc75;if(_0x47766b[_0xcfff('0x36')][_0xcfff('0x45')]){_0x3cc9d8[_0xcfff('0x46')]=[{'all':!![]}];}return db[_0xcfff('0x30')][_0xcfff('0x47')](_0x3cc9d8);})[_0xcfff('0x28')](function(_0x18bce4){_0x2a85ff[_0xcfff('0x48')]=_0x18bce4;return _0x2a85ff;})[_0xcfff('0x28')](respondWithFilteredResult(_0x78b954,_0x3cc9d8))[_0xcfff('0x49')](handleError(_0x78b954,null));};exports[_0xcfff('0x4a')]=function(_0x34b4d3,_0x54b76f){var _0x4a767c={'raw':!![],'where':{'id':_0x34b4d3['params']['id']}},_0x38bf87={};_0x38bf87[_0xcfff('0x35')]=_[_0xcfff('0x37')](db[_0xcfff('0x30')][_0xcfff('0x31')]);_0x38bf87[_0xcfff('0x36')]=_[_0xcfff('0x37')](_0x34b4d3[_0xcfff('0x36')]);_0x38bf87[_0xcfff('0x3f')]=_[_0xcfff('0x38')](_0x38bf87[_0xcfff('0x35')],_0x38bf87['query']);_0x4a767c[_0xcfff('0x39')]=_[_0xcfff('0x38')](_0x38bf87[_0xcfff('0x35')],qs['fields'](_0x34b4d3[_0xcfff('0x36')][_0xcfff('0x3a')]));_0x4a767c[_0xcfff('0x39')]=_0x4a767c[_0xcfff('0x39')]['length']?_0x4a767c[_0xcfff('0x39')]:_0x38bf87[_0xcfff('0x35')];if(_0x34b4d3[_0xcfff('0x36')]['includeAll']){_0x4a767c[_0xcfff('0x46')]=[{'all':!![]}];}_0x4a767c=_[_0xcfff('0x43')]({},_0x4a767c,_0x34b4d3[_0xcfff('0x44')]);return db[_0xcfff('0x30')][_0xcfff('0x4b')](_0x4a767c)['then'](handleEntityNotFound(_0x54b76f,null))[_0xcfff('0x28')](respondWithResult(_0x54b76f,null))['catch'](handleError(_0x54b76f,null));};exports[_0xcfff('0x4c')]=function(_0x409542,_0x38e55e){return db['CmHopperHistory'][_0xcfff('0x4c')](_0x409542[_0xcfff('0x4d')],{})[_0xcfff('0x28')](respondWithResult(_0x38e55e,0xc9))[_0xcfff('0x49')](handleError(_0x38e55e,null));};exports[_0xcfff('0x4e')]=function(_0x460fa8,_0x3aed11){return db['CmHopperHistory'][_0xcfff('0x4e')]()[_0xcfff('0x28')](respondWithResult(_0x3aed11,null))['catch'](handleError(_0x3aed11,null));};exports[_0xcfff('0x27')]=function(_0x2a44b6,_0xdf9bd7){if(_0x2a44b6[_0xcfff('0x4d')][_0xcfff('0x4f')]){delete _0x2a44b6['body'][_0xcfff('0x4f')];}return db['CmHopperHistory'][_0xcfff('0x4b')]({'where':{'uniqueid':_0x2a44b6['params']['id']}})[_0xcfff('0x28')](handleEntityNotFound(_0xdf9bd7,null))['then'](saveUpdates(_0x2a44b6[_0xcfff('0x4d')],null))[_0xcfff('0x28')](respondWithResult(_0xdf9bd7,null))[_0xcfff('0x49')](handleError(_0xdf9bd7,null));}; \ No newline at end of file +var _0x076f=['set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','map','CmHopperHistory','rawAttributes','fieldName','type','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','create','body','describe','uniqueid','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset'];(function(_0x11568b,_0x4e971c){var _0x147d35=function(_0x5ef775){while(--_0x5ef775){_0x11568b['push'](_0x11568b['shift']());}};_0x147d35(++_0x4e971c);}(_0x076f,0x121));var _0xf076=function(_0x51bf9b,_0x2f6e31){_0x51bf9b=_0x51bf9b-0x0;var _0x45e7e3=_0x076f[_0x51bf9b];return _0x45e7e3;};'use strict';var emlformat=require(_0xf076('0x0'));var rimraf=require(_0xf076('0x1'));var zipdir=require(_0xf076('0x2'));var jsonpatch=require(_0xf076('0x3'));var rp=require(_0xf076('0x4'));var moment=require(_0xf076('0x5'));var BPromise=require(_0xf076('0x6'));var Mustache=require('mustache');var util=require(_0xf076('0x7'));var path=require(_0xf076('0x8'));var sox=require('sox');var csv=require(_0xf076('0x9'));var ejs=require(_0xf076('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf076('0xb'));var squel=require(_0xf076('0xc'));var crypto=require(_0xf076('0xd'));var jsforce=require(_0xf076('0xe'));var deskjs=require(_0xf076('0xf'));var toCsv=require(_0xf076('0x9'));var querystring=require(_0xf076('0x10'));var Papa=require(_0xf076('0x11'));var Redis=require(_0xf076('0x12'));var authService=require(_0xf076('0x13'));var qs=require(_0xf076('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf076('0x15'));var logger=require('../../config/logger')(_0xf076('0x16'));var utils=require(_0xf076('0x17'));var config=require(_0xf076('0x18'));var licenseUtil=require(_0xf076('0x19'));var db=require(_0xf076('0x1a'))['db'];function respondWithStatusCode(_0x122ad5,_0x209cf4){_0x209cf4=_0x209cf4||0xcc;return function(_0x21a9b3){if(_0x21a9b3){return _0x122ad5[_0xf076('0x1b')](_0x209cf4);}return _0x122ad5[_0xf076('0x1c')](_0x209cf4)[_0xf076('0x1d')]();};}function respondWithResult(_0xa20e0a,_0x142d6f){_0x142d6f=_0x142d6f||0xc8;return function(_0x2af9df){if(_0x2af9df){return _0xa20e0a[_0xf076('0x1c')](_0x142d6f)[_0xf076('0x1e')](_0x2af9df);}};}function respondWithFilteredResult(_0x58f682,_0x437a15){return function(_0x4c8cfc){if(_0x4c8cfc){var _0x1bd07f=typeof _0x437a15['offset']===_0xf076('0x1f')&&typeof _0x437a15[_0xf076('0x20')]===_0xf076('0x1f');var _0x437243=_0x4c8cfc[_0xf076('0x21')];var _0x3c1028=_0x1bd07f?0x0:_0x437a15['offset'];var _0x1df372=_0x1bd07f?_0x4c8cfc[_0xf076('0x21')]:_0x437a15[_0xf076('0x22')]+_0x437a15[_0xf076('0x20')];var _0x43736a;if(_0x1df372>=_0x437243){_0x1df372=_0x437243;_0x43736a=0xc8;}else{_0x43736a=0xce;}_0x58f682[_0xf076('0x1c')](_0x43736a);return _0x58f682[_0xf076('0x23')](_0xf076('0x24'),_0x3c1028+'-'+_0x1df372+'/'+_0x437243)[_0xf076('0x1e')](_0x4c8cfc);}return null;};}function patchUpdates(_0x7fd4f3){return function(_0x587afb){try{jsonpatch[_0xf076('0x25')](_0x587afb,_0x7fd4f3,!![]);}catch(_0xa8cf0e){return BPromise[_0xf076('0x26')](_0xa8cf0e);}return _0x587afb[_0xf076('0x27')]();};}function saveUpdates(_0x252165,_0x57a845){return function(_0x43da0c){if(_0x43da0c){return _0x43da0c[_0xf076('0x28')](_0x252165)[_0xf076('0x29')](function(_0x1f9661){return _0x1f9661;});}return null;};}function removeEntity(_0x1b9698,_0x275e3f){return function(_0x2874be){if(_0x2874be){return _0x2874be[_0xf076('0x2a')]()[_0xf076('0x29')](function(){_0x1b9698['status'](0xcc)[_0xf076('0x1d')]();});}};}function handleEntityNotFound(_0x3ff431,_0x5edbf3){return function(_0x1324d4){if(!_0x1324d4){_0x3ff431[_0xf076('0x1b')](0x194);}return _0x1324d4;};}function handleError(_0x4ef11a,_0x606835){_0x606835=_0x606835||0x1f4;return function(_0x15edee){logger['error'](_0x15edee[_0xf076('0x2b')]);if(_0x15edee[_0xf076('0x2c')]){delete _0x15edee[_0xf076('0x2c')];}_0x4ef11a[_0xf076('0x1c')](_0x606835)[_0xf076('0x2d')](_0x15edee);};}exports[_0xf076('0x2e')]=function(_0x21ec47,_0x4d7054){var _0x2e1725={},_0x457946={},_0x472b59={'count':0x0,'rows':[]};var _0x448aba=_[_0xf076('0x2f')](db[_0xf076('0x30')][_0xf076('0x31')],function(_0xa1e4da){return{'name':_0xa1e4da[_0xf076('0x32')],'type':_0xa1e4da[_0xf076('0x33')]['key']};});_0x457946[_0xf076('0x34')]=_[_0xf076('0x2f')](_0x448aba,_0xf076('0x2c'));_0x457946['query']=_[_0xf076('0x35')](_0x21ec47[_0xf076('0x36')]);_0x457946[_0xf076('0x37')]=_[_0xf076('0x38')](_0x457946[_0xf076('0x34')],_0x457946['query']);_0x2e1725['attributes']=_['intersection'](_0x457946[_0xf076('0x34')],qs[_0xf076('0x39')](_0x21ec47[_0xf076('0x36')][_0xf076('0x39')]));_0x2e1725[_0xf076('0x3a')]=_0x2e1725[_0xf076('0x3a')][_0xf076('0x3b')]?_0x2e1725[_0xf076('0x3a')]:_0x457946['model'];if(!_0x21ec47['query'][_0xf076('0x3c')](_0xf076('0x3d'))){_0x2e1725[_0xf076('0x20')]=qs[_0xf076('0x20')](_0x21ec47[_0xf076('0x36')]['limit']);_0x2e1725[_0xf076('0x22')]=qs['offset'](_0x21ec47['query'][_0xf076('0x22')]);}_0x2e1725[_0xf076('0x3e')]=qs['sort'](_0x21ec47['query']['sort']);_0x2e1725[_0xf076('0x3f')]=qs['filters'](_[_0xf076('0x40')](_0x21ec47[_0xf076('0x36')],_0x457946[_0xf076('0x37')]),_0x448aba);if(_0x21ec47[_0xf076('0x36')][_0xf076('0x41')]){_0x2e1725['where']=_[_0xf076('0x42')](_0x2e1725[_0xf076('0x3f')],{'$or':_[_0xf076('0x2f')](_0x448aba,function(_0x2aadee){if(_0x2aadee[_0xf076('0x33')]!==_0xf076('0x43')){var _0x6ae8b0={};_0x6ae8b0[_0x2aadee['name']]={'$like':'%'+_0x21ec47[_0xf076('0x36')][_0xf076('0x41')]+'%'};return _0x6ae8b0;}})});}_0x2e1725=_[_0xf076('0x42')]({},_0x2e1725,_0x21ec47[_0xf076('0x44')]);var _0x100c9e={'where':_0x2e1725[_0xf076('0x3f')]};return db[_0xf076('0x30')]['count'](_0x100c9e)[_0xf076('0x29')](function(_0x53ec88){_0x472b59[_0xf076('0x21')]=_0x53ec88;if(_0x21ec47[_0xf076('0x36')][_0xf076('0x45')]){_0x2e1725[_0xf076('0x46')]=[{'all':!![]}];}return db['CmHopperHistory'][_0xf076('0x47')](_0x2e1725);})[_0xf076('0x29')](function(_0x408723){_0x472b59[_0xf076('0x48')]=_0x408723;return _0x472b59;})[_0xf076('0x29')](respondWithFilteredResult(_0x4d7054,_0x2e1725))[_0xf076('0x49')](handleError(_0x4d7054,null));};exports[_0xf076('0x4a')]=function(_0x398cf6,_0x37e997){var _0x5d3a84={'raw':!![],'where':{'id':_0x398cf6[_0xf076('0x4b')]['id']}},_0x36e31f={};_0x36e31f['model']=_[_0xf076('0x35')](db[_0xf076('0x30')][_0xf076('0x31')]);_0x36e31f[_0xf076('0x36')]=_['keys'](_0x398cf6[_0xf076('0x36')]);_0x36e31f[_0xf076('0x37')]=_['intersection'](_0x36e31f[_0xf076('0x34')],_0x36e31f[_0xf076('0x36')]);_0x5d3a84[_0xf076('0x3a')]=_[_0xf076('0x38')](_0x36e31f['model'],qs[_0xf076('0x39')](_0x398cf6[_0xf076('0x36')]['fields']));_0x5d3a84[_0xf076('0x3a')]=_0x5d3a84['attributes'][_0xf076('0x3b')]?_0x5d3a84[_0xf076('0x3a')]:_0x36e31f[_0xf076('0x34')];if(_0x398cf6[_0xf076('0x36')][_0xf076('0x45')]){_0x5d3a84[_0xf076('0x46')]=[{'all':!![]}];}_0x5d3a84=_['merge']({},_0x5d3a84,_0x398cf6[_0xf076('0x44')]);return db['CmHopperHistory']['find'](_0x5d3a84)['then'](handleEntityNotFound(_0x37e997,null))['then'](respondWithResult(_0x37e997,null))[_0xf076('0x49')](handleError(_0x37e997,null));};exports[_0xf076('0x4c')]=function(_0x4b5055,_0x4d2858){return db[_0xf076('0x30')]['create'](_0x4b5055[_0xf076('0x4d')],{})[_0xf076('0x29')](respondWithResult(_0x4d2858,0xc9))[_0xf076('0x49')](handleError(_0x4d2858,null));};exports['describe']=function(_0x4640ae,_0x214913){return db[_0xf076('0x30')][_0xf076('0x4e')]()[_0xf076('0x29')](respondWithResult(_0x214913,null))[_0xf076('0x49')](handleError(_0x214913,null));};exports[_0xf076('0x28')]=function(_0x58a44f,_0xf5f957){if(_0x58a44f[_0xf076('0x4d')]['uniqueid']){delete _0x58a44f[_0xf076('0x4d')][_0xf076('0x4f')];}return db[_0xf076('0x30')][_0xf076('0x50')]({'where':{'uniqueid':_0x58a44f['params']['id']}})[_0xf076('0x29')](handleEntityNotFound(_0xf5f957,null))[_0xf076('0x29')](saveUpdates(_0x58a44f[_0xf076('0x4d')],null))[_0xf076('0x29')](respondWithResult(_0xf5f957,null))[_0xf076('0x49')](handleError(_0xf5f957,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index b36fa15..a924165 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 _0x4f2f=['define','CmHopperHistory','endtime','uniqueid','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./cmHopperHistory.attributes','exports'];(function(_0x3d486f,_0x13af81){var _0x3af020=function(_0x4ac395){while(--_0x4ac395){_0x3d486f['push'](_0x3d486f['shift']());}};_0x3af020(++_0x13af81);}(_0x4f2f,0x1cb));var _0xf4f2=function(_0x1d24eb,_0x12295b){_0x1d24eb=_0x1d24eb-0x0;var _0x1dc576=_0x4f2f[_0x1d24eb];return _0x1dc576;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xf4f2('0x0'))(_0xf4f2('0x1'));var moment=require('moment');var BPromise=require(_0xf4f2('0x2'));var rp=require(_0xf4f2('0x3'));var fs=require('fs');var path=require(_0xf4f2('0x4'));var rimraf=require(_0xf4f2('0x5'));var config=require(_0xf4f2('0x6'));var attributes=require(_0xf4f2('0x7'));module[_0xf4f2('0x8')]=function(_0x2d7c29,_0x1e0ceb){return _0x2d7c29[_0xf4f2('0x9')](_0xf4f2('0xa'),attributes,{'tableName':'cm_hopper_history','paranoid':![],'indexes':[{'name':_0xf4f2('0xb'),'fields':[_0xf4f2('0xb')]},{'name':'uniqueid','fields':[_0xf4f2('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x80e0=['cm_hopper_history','endtime','uniqueid','../../config/logger','api','moment','request-promise','path','rimraf','./cmHopperHistory.attributes','exports'];(function(_0x2a7416,_0x2a2b28){var _0x5ed598=function(_0x16ff89){while(--_0x16ff89){_0x2a7416['push'](_0x2a7416['shift']());}};_0x5ed598(++_0x2a2b28);}(_0x80e0,0x9d));var _0x080e=function(_0x22f274,_0x443582){_0x22f274=_0x22f274-0x0;var _0x1a9506=_0x80e0[_0x22f274];return _0x1a9506;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x080e('0x0'))(_0x080e('0x1'));var moment=require(_0x080e('0x2'));var BPromise=require('bluebird');var rp=require(_0x080e('0x3'));var fs=require('fs');var path=require(_0x080e('0x4'));var rimraf=require(_0x080e('0x5'));var config=require('../../config/environment');var attributes=require(_0x080e('0x6'));module[_0x080e('0x7')]=function(_0x307481,_0x52548f){return _0x307481['define']('CmHopperHistory',attributes,{'tableName':_0x080e('0x8'),'paranoid':![],'indexes':[{'name':'endtime','fields':[_0x080e('0x9')]},{'name':'uniqueid','fields':[_0x080e('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.rpc.js b/server/api/cmHopperHistory/cmHopperHistory.rpc.js index b018917..837857c 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 _0x3445=['request\x20sent','debug','stringify','error','code','message','info','result','catch','CreateCmHopperHistory','CmHopperHistory','body','options','raw','then','findAll','where','sequelize','COUNT','col','predictiveIntervalTotalCalls','literal','`state`\x20=\x204,\x201,\x20null','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgTalktime','AvgHandleTime','campaign','name','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','outboundAnswerCallsDay','outboundBusyCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayTimeout','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','`state`\x20=\x2016,\x201,\x20null','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','GetVoiceQueueHopperHistory','GetCampaignHopperHistory','ivrTotalCallsDays','lodash','util','randomstring','ioredis','../../config/utils','../../config/logger','rpc','client','http','request','CmHopperHistory,\x20%s,\x20%s'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x3445,0x13a));var _0x5344=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3445[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x5344('0x0'));var util=require(_0x5344('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x5344('0x2'));var fs=require('fs');var Redis=require(_0x5344('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5344('0x4'));var logger=require(_0x5344('0x5'))(_0x5344('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x5344('0x7')][_0x5344('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xea8222,_0x3c4589,_0x9f237f){return new BPromise(function(_0xb805dc,_0x530ebb){return client[_0x5344('0x9')](_0xea8222,_0x9f237f)['then'](function(_0x271c86){logger['info'](_0x5344('0xa'),_0x3c4589,_0x5344('0xb'));logger[_0x5344('0xc')]('CmHopperHistory,\x20%s,\x20%s,\x20%s',_0x3c4589,_0x5344('0xb'),JSON[_0x5344('0xd')](_0x271c86));if(_0x271c86[_0x5344('0xe')]){if(_0x271c86[_0x5344('0xe')][_0x5344('0xf')]===0x1f4){logger['error'](_0x5344('0xa'),_0x3c4589,_0x271c86[_0x5344('0xe')][_0x5344('0x10')]);return _0x530ebb(_0x271c86[_0x5344('0xe')]['message']);}logger[_0x5344('0xe')]('CmHopperHistory,\x20%s,\x20%s',_0x3c4589,_0x271c86[_0x5344('0xe')][_0x5344('0x10')]);return _0xb805dc(_0x271c86[_0x5344('0xe')]['message']);}else{logger[_0x5344('0x11')]('CmHopperHistory,\x20%s,\x20%s',_0x3c4589,_0x5344('0xb'));_0xb805dc(_0x271c86[_0x5344('0x12')][_0x5344('0x10')]);}})[_0x5344('0x13')](function(_0x2b4963){logger[_0x5344('0xe')]('CmHopperHistory,\x20%s,\x20%s',_0x3c4589,_0x2b4963);_0x530ebb(_0x2b4963);});});}exports[_0x5344('0x14')]=function(_0x5ee0a3){var _0xd2740c=this;return new Promise(function(_0x193492,_0xf2811d){return db[_0x5344('0x15')]['create'](_0x5ee0a3[_0x5344('0x16')],{'raw':_0x5ee0a3[_0x5344('0x17')]?_0x5ee0a3['options'][_0x5344('0x18')]===undefined?!![]:![]:!![]})[_0x5344('0x19')](function(_0x3418da){logger[_0x5344('0x11')](_0x5344('0x14'),_0x5ee0a3);logger[_0x5344('0xc')](_0x5344('0x14'),_0x5ee0a3,JSON[_0x5344('0xd')](_0x3418da));_0x193492(_0x3418da);})[_0x5344('0x13')](function(_0x1ebec4){logger[_0x5344('0xe')]('CreateCmHopperHistory',_0x1ebec4['message'],_0x5ee0a3);_0xf2811d(_0xd2740c[_0x5344('0xe')](0x1f4,_0x1ebec4[_0x5344('0x10')]));});});};exports['AvgHandleTime']=function(_0x487993){var _0x20472=this;return new Promise(function(_0x20f228,_0x2f000d){return db['CmHopperHistory'][_0x5344('0x1a')]({'raw':_0x487993[_0x5344('0x17')]?_0x487993['options'][_0x5344('0x18')]===undefined?!![]:![]:!![],'where':_0x487993[_0x5344('0x17')]?_0x487993[_0x5344('0x17')][_0x5344('0x1b')]||null:null,'attributes':[[db[_0x5344('0x1c')]['fn'](_0x5344('0x1d'),db[_0x5344('0x1c')][_0x5344('0x1e')]('id')),_0x5344('0x1f')],[db[_0x5344('0x1c')]['fn']('COUNT',db[_0x5344('0x1c')]['fn']('IF',db[_0x5344('0x1c')][_0x5344('0x20')](_0x5344('0x21')))),'predictiveIntervalAnsweredCalls'],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x5344('0x1c')][_0x5344('0x20')](_0x5344('0x22')))),_0x5344('0x23')],[db[_0x5344('0x1c')]['fn'](_0x5344('0x1d'),db['sequelize']['fn']('IF',db['sequelize']['literal'](_0x5344('0x24')))),_0x5344('0x25')],[db[_0x5344('0x1c')]['fn'](_0x5344('0x26'),db['sequelize']['fn']('IF',db[_0x5344('0x1c')]['literal'](_0x5344('0x27')))),'predictiveIntervalAvgHoldtime'],[db[_0x5344('0x1c')]['fn'](_0x5344('0x26'),db['sequelize']['fn']('IF',db[_0x5344('0x1c')][_0x5344('0x20')]('`state`\x20=\x204,\x20`talktime`,\x20null'))),_0x5344('0x28')]]})['then'](function(_0x217c43){logger[_0x5344('0x11')](_0x5344('0x29'),_0x487993);logger[_0x5344('0xc')](_0x5344('0x29'),_0x487993,JSON[_0x5344('0xd')](_0x217c43));_0x20f228(_0x217c43);})[_0x5344('0x13')](function(_0x1e7070){logger['error'](_0x5344('0x29'),_0x1e7070['message'],_0x487993);_0x2f000d(_0x20472[_0x5344('0xe')](0x1f4,_0x1e7070[_0x5344('0x10')]));});});};exports['GetVoiceQueueHopperHistory']=function(_0x35c7d0){var _0x2bb695=this;return new Promise(function(_0x29d396,_0x2eaffa){return db[_0x5344('0x15')][_0x5344('0x1a')]({'raw':_0x35c7d0['options']?_0x35c7d0[_0x5344('0x17')][_0x5344('0x18')]===undefined?!![]:![]:!![],'where':_0x35c7d0[_0x5344('0x17')]?_0x35c7d0[_0x5344('0x17')][_0x5344('0x1b')]||null:null,'attributes':[[_0x5344('0x2a'),_0x5344('0x2b')],[db[_0x5344('0x1c')]['fn'](_0x5344('0x1d'),db[_0x5344('0x1c')]['fn']('IF',db['sequelize'][_0x5344('0x20')](_0x5344('0x2c')))),_0x5344('0x2d')],[db[_0x5344('0x1c')]['fn'](_0x5344('0x1d'),db[_0x5344('0x1c')]['fn']('IF',db[_0x5344('0x1c')][_0x5344('0x20')](_0x5344('0x2e')))),'outboundNoAnswerCallsDay'],[db[_0x5344('0x1c')]['fn'](_0x5344('0x1d'),db[_0x5344('0x1c')]['fn']('IF',db[_0x5344('0x1c')][_0x5344('0x20')](_0x5344('0x21')))),_0x5344('0x2f')],[db[_0x5344('0x1c')]['fn']('COUNT',db[_0x5344('0x1c')]['fn']('IF',db[_0x5344('0x1c')][_0x5344('0x20')]('`state`\x20=\x205,\x201,\x20null'))),_0x5344('0x30')],[db[_0x5344('0x1c')]['fn'](_0x5344('0x1d'),db['sequelize']['fn']('IF',db[_0x5344('0x1c')][_0x5344('0x20')]('`state`\x20=\x208,\x201,\x20null'))),'outboundCongestionCallsDay'],[db[_0x5344('0x1c')]['fn']('COUNT',db[_0x5344('0x1c')]['fn']('IF',db[_0x5344('0x1c')][_0x5344('0x20')](_0x5344('0x31')))),_0x5344('0x32')],[db[_0x5344('0x1c')]['fn'](_0x5344('0x1d'),db[_0x5344('0x1c')]['fn']('IF',db[_0x5344('0x1c')][_0x5344('0x20')](_0x5344('0x33')))),_0x5344('0x34')],[db['sequelize']['fn']('COUNT',db[_0x5344('0x1c')]['fn']('IF',db[_0x5344('0x1c')][_0x5344('0x20')]('`state`\x20=\x2012,\x201,\x20null'))),_0x5344('0x35')],[db[_0x5344('0x1c')]['fn'](_0x5344('0x1d'),db[_0x5344('0x1c')]['fn']('IF',db[_0x5344('0x1c')][_0x5344('0x20')](_0x5344('0x36')))),_0x5344('0x37')],[db[_0x5344('0x1c')]['fn'](_0x5344('0x1d'),db[_0x5344('0x1c')]['fn']('IF',db[_0x5344('0x1c')]['literal']('`state`\x20=\x2014,\x201,\x20null'))),_0x5344('0x38')],[db[_0x5344('0x1c')]['fn'](_0x5344('0x1d'),db['sequelize']['fn']('IF',db['sequelize']['literal'](_0x5344('0x39')))),_0x5344('0x3a')],[db['sequelize']['fn'](_0x5344('0x1d'),db[_0x5344('0x1c')]['fn']('IF',db[_0x5344('0x1c')][_0x5344('0x20')](_0x5344('0x3b')))),_0x5344('0x3c')],[db[_0x5344('0x1c')]['fn'](_0x5344('0x1d'),db[_0x5344('0x1c')]['fn']('IF',db[_0x5344('0x1c')][_0x5344('0x20')](_0x5344('0x3d')))),'outboundRejectCallsDay'],[db[_0x5344('0x1c')]['fn']('COUNT',db[_0x5344('0x1c')]['fn']('IF',db[_0x5344('0x1c')]['literal']('`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null'))),'outboundReCallsDay']],'group':[_0x5344('0x2a')]})[_0x5344('0x19')](function(_0x54d2b0){logger['info'](_0x5344('0x3e'),_0x35c7d0);logger[_0x5344('0xc')](_0x5344('0x3e'),_0x35c7d0,JSON[_0x5344('0xd')](_0x54d2b0));_0x29d396(_0x54d2b0);})[_0x5344('0x13')](function(_0x534b32){logger[_0x5344('0xe')](_0x5344('0x3e'),_0x534b32[_0x5344('0x10')],_0x35c7d0);_0x2eaffa(_0x2bb695['error'](0x1f4,_0x534b32['message']));});});};exports[_0x5344('0x3f')]=function(_0x2e71f4){var _0x37409e=this;return new Promise(function(_0xaae044,_0x52882e){return db[_0x5344('0x15')][_0x5344('0x1a')]({'raw':_0x2e71f4[_0x5344('0x17')]?_0x2e71f4[_0x5344('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x2e71f4[_0x5344('0x17')]?_0x2e71f4[_0x5344('0x17')][_0x5344('0x1b')]||null:null,'attributes':[[_0x5344('0x2a'),_0x5344('0x2b')],[db[_0x5344('0x1c')]['fn']('COUNT',db['sequelize'][_0x5344('0x1e')]('id')),_0x5344('0x40')],[db[_0x5344('0x1c')]['fn'](_0x5344('0x1d'),db['sequelize']['fn']('IF',db['sequelize'][_0x5344('0x20')]('`state`\x20=\x204,\x201,\x20null'))),'ivrAnswerCallsDay']],'group':[_0x5344('0x2a')]})[_0x5344('0x19')](function(_0x32cfa4){logger['info'](_0x5344('0x3f'),_0x2e71f4);logger[_0x5344('0xc')]('GetCampaignHopperHistory',_0x2e71f4,JSON[_0x5344('0xd')](_0x32cfa4));_0xaae044(_0x32cfa4);})['catch'](function(_0x56dc43){logger[_0x5344('0xe')](_0x5344('0x3f'),_0x56dc43['message'],_0x2e71f4);_0x52882e(_0x37409e[_0x5344('0xe')](0x1f4,_0x56dc43['message']));});});}; \ No newline at end of file +var _0xc678=['`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','`state`\x20=\x2016,\x201,\x20null','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','campaign','GetVoiceQueueHopperHistory','GetCampaignHopperHistory','ivrTotalCallsDays','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','request\x20sent','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','stringify','error','code','CmHopperHistory,\x20%s,\x20%s','message','result','catch','CreateCmHopperHistory','CmHopperHistory','body','options','raw','findAll','where','sequelize','COUNT','col','predictiveIntervalTotalCalls','literal','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','`state`\x20=\x204,\x20`talktime`,\x20null','AvgHandleTime','name','`state`\x20=\x200,\x201,\x20null','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','outboundAnswerCallsDay','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayTimeout','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay'];(function(_0x4ace6e,_0x162d9d){var _0x265c2d=function(_0x160bf6){while(--_0x160bf6){_0x4ace6e['push'](_0x4ace6e['shift']());}};_0x265c2d(++_0x162d9d);}(_0xc678,0x1b4));var _0x8c67=function(_0xc091ba,_0x300504){_0xc091ba=_0xc091ba-0x0;var _0xeb0355=_0xc678[_0xc091ba];return _0xeb0355;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x8c67('0x0'));var BPromise=require(_0x8c67('0x1'));var rs=require(_0x8c67('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8c67('0x3'))['db'];var utils=require(_0x8c67('0x4'));var logger=require(_0x8c67('0x5'))(_0x8c67('0x6'));var config=require('../../config/environment');var jayson=require(_0x8c67('0x7'));var client=jayson['client'][_0x8c67('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1b4ceb,_0x4c2ffe,_0x207de1){return new BPromise(function(_0x22d7e4,_0x41ac88){return client[_0x8c67('0x9')](_0x1b4ceb,_0x207de1)[_0x8c67('0xa')](function(_0x5bac97){logger[_0x8c67('0xb')]('CmHopperHistory,\x20%s,\x20%s',_0x4c2ffe,_0x8c67('0xc'));logger[_0x8c67('0xd')](_0x8c67('0xe'),_0x4c2ffe,'request\x20sent',JSON[_0x8c67('0xf')](_0x5bac97));if(_0x5bac97[_0x8c67('0x10')]){if(_0x5bac97[_0x8c67('0x10')][_0x8c67('0x11')]===0x1f4){logger['error'](_0x8c67('0x12'),_0x4c2ffe,_0x5bac97['error']['message']);return _0x41ac88(_0x5bac97['error']['message']);}logger[_0x8c67('0x10')]('CmHopperHistory,\x20%s,\x20%s',_0x4c2ffe,_0x5bac97[_0x8c67('0x10')]['message']);return _0x22d7e4(_0x5bac97[_0x8c67('0x10')][_0x8c67('0x13')]);}else{logger[_0x8c67('0xb')](_0x8c67('0x12'),_0x4c2ffe,'request\x20sent');_0x22d7e4(_0x5bac97[_0x8c67('0x14')][_0x8c67('0x13')]);}})[_0x8c67('0x15')](function(_0x1bae2f){logger['error']('CmHopperHistory,\x20%s,\x20%s',_0x4c2ffe,_0x1bae2f);_0x41ac88(_0x1bae2f);});});}exports[_0x8c67('0x16')]=function(_0x3e9ab8){var _0x215d52=this;return new Promise(function(_0x544717,_0xe7f0b6){return db[_0x8c67('0x17')]['create'](_0x3e9ab8[_0x8c67('0x18')],{'raw':_0x3e9ab8['options']?_0x3e9ab8[_0x8c67('0x19')][_0x8c67('0x1a')]===undefined?!![]:![]:!![]})[_0x8c67('0xa')](function(_0x2bd6b3){logger[_0x8c67('0xb')]('CreateCmHopperHistory',_0x3e9ab8);logger[_0x8c67('0xd')](_0x8c67('0x16'),_0x3e9ab8,JSON['stringify'](_0x2bd6b3));_0x544717(_0x2bd6b3);})[_0x8c67('0x15')](function(_0x5486e8){logger[_0x8c67('0x10')](_0x8c67('0x16'),_0x5486e8[_0x8c67('0x13')],_0x3e9ab8);_0xe7f0b6(_0x215d52[_0x8c67('0x10')](0x1f4,_0x5486e8[_0x8c67('0x13')]));});});};exports['AvgHandleTime']=function(_0x2658a1){var _0x26fb02=this;return new Promise(function(_0x94d19b,_0xbb787e){return db[_0x8c67('0x17')][_0x8c67('0x1b')]({'raw':_0x2658a1['options']?_0x2658a1['options'][_0x8c67('0x1a')]===undefined?!![]:![]:!![],'where':_0x2658a1['options']?_0x2658a1['options'][_0x8c67('0x1c')]||null:null,'attributes':[[db[_0x8c67('0x1d')]['fn'](_0x8c67('0x1e'),db['sequelize'][_0x8c67('0x1f')]('id')),_0x8c67('0x20')],[db[_0x8c67('0x1d')]['fn'](_0x8c67('0x1e'),db['sequelize']['fn']('IF',db[_0x8c67('0x1d')][_0x8c67('0x21')](_0x8c67('0x22')))),_0x8c67('0x23')],[db[_0x8c67('0x1d')]['fn'](_0x8c67('0x1e'),db[_0x8c67('0x1d')]['fn']('IF',db['sequelize'][_0x8c67('0x21')](_0x8c67('0x24')))),_0x8c67('0x25')],[db[_0x8c67('0x1d')]['fn'](_0x8c67('0x1e'),db['sequelize']['fn']('IF',db['sequelize'][_0x8c67('0x21')](_0x8c67('0x26')))),_0x8c67('0x27')],[db[_0x8c67('0x1d')]['fn'](_0x8c67('0x28'),db['sequelize']['fn']('IF',db['sequelize'][_0x8c67('0x21')](_0x8c67('0x29')))),_0x8c67('0x2a')],[db['sequelize']['fn'](_0x8c67('0x28'),db[_0x8c67('0x1d')]['fn']('IF',db['sequelize']['literal'](_0x8c67('0x2b')))),'predictiveIntervalAvgTalktime']]})['then'](function(_0x2a855a){logger[_0x8c67('0xb')](_0x8c67('0x2c'),_0x2658a1);logger[_0x8c67('0xd')](_0x8c67('0x2c'),_0x2658a1,JSON[_0x8c67('0xf')](_0x2a855a));_0x94d19b(_0x2a855a);})[_0x8c67('0x15')](function(_0x435ece){logger['error']('AvgHandleTime',_0x435ece[_0x8c67('0x13')],_0x2658a1);_0xbb787e(_0x26fb02['error'](0x1f4,_0x435ece[_0x8c67('0x13')]));});});};exports['GetVoiceQueueHopperHistory']=function(_0x34684a){var _0x3a956a=this;return new Promise(function(_0x2a37b4,_0x2145b4){return db['CmHopperHistory'][_0x8c67('0x1b')]({'raw':_0x34684a[_0x8c67('0x19')]?_0x34684a['options'][_0x8c67('0x1a')]===undefined?!![]:![]:!![],'where':_0x34684a[_0x8c67('0x19')]?_0x34684a[_0x8c67('0x19')]['where']||null:null,'attributes':[['campaign',_0x8c67('0x2d')],[db[_0x8c67('0x1d')]['fn']('COUNT',db[_0x8c67('0x1d')]['fn']('IF',db[_0x8c67('0x1d')][_0x8c67('0x21')](_0x8c67('0x2e')))),'outboundNoSuchCallsDay'],[db['sequelize']['fn'](_0x8c67('0x1e'),db[_0x8c67('0x1d')]['fn']('IF',db['sequelize']['literal'](_0x8c67('0x2f')))),_0x8c67('0x30')],[db[_0x8c67('0x1d')]['fn'](_0x8c67('0x1e'),db[_0x8c67('0x1d')]['fn']('IF',db[_0x8c67('0x1d')][_0x8c67('0x21')](_0x8c67('0x22')))),_0x8c67('0x31')],[db[_0x8c67('0x1d')]['fn']('COUNT',db[_0x8c67('0x1d')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x205,\x201,\x20null'))),_0x8c67('0x32')],[db['sequelize']['fn'](_0x8c67('0x1e'),db[_0x8c67('0x1d')]['fn']('IF',db[_0x8c67('0x1d')][_0x8c67('0x21')](_0x8c67('0x33')))),'outboundCongestionCallsDay'],[db[_0x8c67('0x1d')]['fn'](_0x8c67('0x1e'),db[_0x8c67('0x1d')]['fn']('IF',db[_0x8c67('0x1d')]['literal'](_0x8c67('0x34')))),_0x8c67('0x35')],[db[_0x8c67('0x1d')]['fn'](_0x8c67('0x1e'),db[_0x8c67('0x1d')]['fn']('IF',db['sequelize'][_0x8c67('0x21')](_0x8c67('0x36')))),_0x8c67('0x37')],[db[_0x8c67('0x1d')]['fn']('COUNT',db[_0x8c67('0x1d')]['fn']('IF',db[_0x8c67('0x1d')][_0x8c67('0x21')](_0x8c67('0x38')))),_0x8c67('0x39')],[db[_0x8c67('0x1d')]['fn']('COUNT',db[_0x8c67('0x1d')]['fn']('IF',db[_0x8c67('0x1d')]['literal']('`state`\x20=\x2013,\x201,\x20null'))),_0x8c67('0x3a')],[db['sequelize']['fn'](_0x8c67('0x1e'),db['sequelize']['fn']('IF',db[_0x8c67('0x1d')][_0x8c67('0x21')](_0x8c67('0x3b')))),_0x8c67('0x3c')],[db['sequelize']['fn'](_0x8c67('0x1e'),db[_0x8c67('0x1d')]['fn']('IF',db[_0x8c67('0x1d')][_0x8c67('0x21')](_0x8c67('0x3d')))),_0x8c67('0x3e')],[db[_0x8c67('0x1d')]['fn'](_0x8c67('0x1e'),db[_0x8c67('0x1d')]['fn']('IF',db[_0x8c67('0x1d')][_0x8c67('0x21')](_0x8c67('0x3f')))),_0x8c67('0x40')],[db['sequelize']['fn'](_0x8c67('0x1e'),db[_0x8c67('0x1d')]['fn']('IF',db[_0x8c67('0x1d')][_0x8c67('0x21')](_0x8c67('0x41')))),'outboundRejectCallsDay'],[db[_0x8c67('0x1d')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x8c67('0x1d')][_0x8c67('0x21')](_0x8c67('0x42')))),'outboundReCallsDay']],'group':[_0x8c67('0x43')]})['then'](function(_0x50fb02){logger[_0x8c67('0xb')](_0x8c67('0x44'),_0x34684a);logger[_0x8c67('0xd')](_0x8c67('0x44'),_0x34684a,JSON[_0x8c67('0xf')](_0x50fb02));_0x2a37b4(_0x50fb02);})['catch'](function(_0xc9ff67){logger[_0x8c67('0x10')]('GetVoiceQueueHopperHistory',_0xc9ff67[_0x8c67('0x13')],_0x34684a);_0x2145b4(_0x3a956a[_0x8c67('0x10')](0x1f4,_0xc9ff67[_0x8c67('0x13')]));});});};exports[_0x8c67('0x45')]=function(_0x4724c7){var _0x51555f=this;return new Promise(function(_0x31bd72,_0x3344ce){return db[_0x8c67('0x17')][_0x8c67('0x1b')]({'raw':_0x4724c7['options']?_0x4724c7['options']['raw']===undefined?!![]:![]:!![],'where':_0x4724c7[_0x8c67('0x19')]?_0x4724c7[_0x8c67('0x19')][_0x8c67('0x1c')]||null:null,'attributes':[[_0x8c67('0x43'),'name'],[db[_0x8c67('0x1d')]['fn'](_0x8c67('0x1e'),db['sequelize']['col']('id')),_0x8c67('0x46')],[db[_0x8c67('0x1d')]['fn']('COUNT',db[_0x8c67('0x1d')]['fn']('IF',db['sequelize'][_0x8c67('0x21')]('`state`\x20=\x204,\x201,\x20null'))),'ivrAnswerCallsDay']],'group':[_0x8c67('0x43')]})[_0x8c67('0xa')](function(_0x4465e2){logger['info']('GetCampaignHopperHistory',_0x4724c7);logger[_0x8c67('0xd')]('GetCampaignHopperHistory',_0x4724c7,JSON[_0x8c67('0xf')](_0x4465e2));_0x31bd72(_0x4465e2);})[_0x8c67('0x15')](function(_0x278377){logger['error'](_0x8c67('0x45'),_0x278377['message'],_0x4724c7);_0x3344ce(_0x51555f['error'](0x1f4,_0x278377['message']));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index f52ae22..54eb4d1 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 _0x3e0f=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperHistory.controller','get','index','/describe','isAuthenticated','post','create','put','/:id','update','multer','util','path','connect-timeout'];(function(_0xec9d02,_0x32d164){var _0x5b9eba=function(_0x28a5ae){while(--_0x28a5ae){_0xec9d02['push'](_0xec9d02['shift']());}};_0x5b9eba(++_0x32d164);}(_0x3e0f,0x1ea));var _0xf3e0=function(_0x47408e,_0x481428){_0x47408e=_0x47408e-0x0;var _0x1636bc=_0x3e0f[_0x47408e];return _0x1636bc;};'use strict';var multer=require(_0xf3e0('0x0'));var util=require(_0xf3e0('0x1'));var path=require(_0xf3e0('0x2'));var timeout=require(_0xf3e0('0x3'));var express=require('express');var router=express[_0xf3e0('0x4')]();var fs_extra=require(_0xf3e0('0x5'));var auth=require(_0xf3e0('0x6'));var interaction=require(_0xf3e0('0x7'));var config=require(_0xf3e0('0x8'));var controller=require(_0xf3e0('0x9'));router[_0xf3e0('0xa')]('/',auth['isAuthenticated'](),controller[_0xf3e0('0xb')]);router[_0xf3e0('0xa')](_0xf3e0('0xc'),auth['isAuthenticated'](),controller['describe']);router[_0xf3e0('0xa')]('/:id',auth[_0xf3e0('0xd')](),controller['show']);router[_0xf3e0('0xe')]('/',auth['isAuthenticated'](),controller[_0xf3e0('0xf')]);router[_0xf3e0('0x10')](_0xf3e0('0x11'),auth['isAuthenticated'](),controller[_0xf3e0('0x12')]);module['exports']=router; \ No newline at end of file +var _0xb5a4=['../../config/environment','get','index','/describe','isAuthenticated','describe','/:id','show','post','put','util','path','Router','fs-extra','../../components/interaction/service'];(function(_0x499b6c,_0x137024){var _0x4a9d83=function(_0x5e364a){while(--_0x5e364a){_0x499b6c['push'](_0x499b6c['shift']());}};_0x4a9d83(++_0x137024);}(_0xb5a4,0xcd));var _0x4b5a=function(_0x9d2949,_0x259ca0){_0x9d2949=_0x9d2949-0x0;var _0x5596ad=_0xb5a4[_0x9d2949];return _0x5596ad;};'use strict';var multer=require('multer');var util=require(_0x4b5a('0x0'));var path=require(_0x4b5a('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x4b5a('0x2')]();var fs_extra=require(_0x4b5a('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x4b5a('0x4'));var config=require(_0x4b5a('0x5'));var controller=require('./cmHopperHistory.controller');router[_0x4b5a('0x6')]('/',auth['isAuthenticated'](),controller[_0x4b5a('0x7')]);router['get'](_0x4b5a('0x8'),auth[_0x4b5a('0x9')](),controller[_0x4b5a('0xa')]);router['get'](_0x4b5a('0xb'),auth[_0x4b5a('0x9')](),controller[_0x4b5a('0xc')]);router[_0x4b5a('0xd')]('/',auth[_0x4b5a('0x9')](),controller['create']);router[_0x4b5a('0xe')]('/:id',auth[_0x4b5a('0x9')](),controller['update']);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmList/cmList.attributes.js b/server/api/cmList/cmList.attributes.js index 200dcf6..9e30827 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 _0x64f5=['sequelize','STRING'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x64f5,0x17e));var _0x564f=function(_0x4e3103,_0x2b16fe){_0x4e3103=_0x4e3103-0x0;var _0x5ba646=_0x64f5[_0x4e3103];return _0x5ba646;};'use strict';var Sequelize=require(_0x564f('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x564f('0x1')]},'dialPrefix':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x7da7=['exports','STRING','sequelize'];(function(_0x49ca18,_0x5e6d05){var _0x145d54=function(_0x30b9be){while(--_0x30b9be){_0x49ca18['push'](_0x49ca18['shift']());}};_0x145d54(++_0x5e6d05);}(_0x7da7,0x10d));var _0x77da=function(_0x37c8ef,_0x334449){_0x37c8ef=_0x37c8ef-0x0;var _0x5eaee9=_0x7da7[_0x37c8ef];return _0x5eaee9;};'use strict';var Sequelize=require(_0x77da('0x0'));module[_0x77da('0x1')]={'name':{'type':Sequelize[_0x77da('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']},'dialPrefix':{'type':Sequelize[_0x77da('0x2')]}}; \ No newline at end of file diff --git a/server/api/cmList/cmList.controller.js b/server/api/cmList/cmList.controller.js index 30b827e..376ce8d 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 _0x4f09=['dataValues','errors','message','Malformed\x20request\x20syntax','getContacts','CmCustomField','CustomFields','concat','raw','format','cf_%d','isEmpty','now','writeFileSync','/tmp/list_%d_%s.csv','setHeader','Content-disposition','list_%d_%s.csv','Content-type','download','sequelize','transaction','TEXT','text','type','Sequelize','INTEGER','switch','BOOLEAN','queryInterface','cm_contacts','getCustomFields','findAndCountAll','addAgents','omit','spread','userCmList:save','removeAgents','isArray','userCmList:remove','User','getAgents','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./cmList.socket','register','sendStatus','status','end','offset','limit','undefined','count','Content-Range','json','reject','save','update','then','destroy','Lists','error','stack','name','send','index','map','CmList','rawAttributes','fieldName','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','describe','addDisposition','ListId','Disposition','getDispositions','findOne','removeDispositions','ids','CmContact','tags','push','each','success'];(function(_0x307d7b,_0x6212aa){var _0x45a278=function(_0x4e79ce){while(--_0x4e79ce){_0x307d7b['push'](_0x307d7b['shift']());}};_0x45a278(++_0x6212aa);}(_0x4f09,0xbe));var _0x94f0=function(_0x266c43,_0x12bc29){_0x266c43=_0x266c43-0x0;var _0x360a3d=_0x4f09[_0x266c43];return _0x360a3d;};'use strict';var emlformat=require(_0x94f0('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x94f0('0x1'));var jsonpatch=require(_0x94f0('0x2'));var rp=require(_0x94f0('0x3'));var moment=require(_0x94f0('0x4'));var BPromise=require(_0x94f0('0x5'));var Mustache=require(_0x94f0('0x6'));var util=require(_0x94f0('0x7'));var path=require(_0x94f0('0x8'));var sox=require(_0x94f0('0x9'));var csv=require(_0x94f0('0xa'));var ejs=require(_0x94f0('0xb'));var fs=require('fs');var fs_extra=require(_0x94f0('0xc'));var _=require(_0x94f0('0xd'));var squel=require('squel');var crypto=require(_0x94f0('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x94f0('0xf'));var toCsv=require(_0x94f0('0xa'));var querystring=require(_0x94f0('0x10'));var Papa=require('papaparse');var Redis=require(_0x94f0('0x11'));var authService=require(_0x94f0('0x12'));var qs=require(_0x94f0('0x13'));var as=require(_0x94f0('0x14'));var hardwareService=require(_0x94f0('0x15'));var logger=require(_0x94f0('0x16'))(_0x94f0('0x17'));var utils=require(_0x94f0('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x94f0('0x19'));var db=require(_0x94f0('0x1a'))['db'];config[_0x94f0('0x1b')]=_[_0x94f0('0x1c')](config[_0x94f0('0x1b')],{'host':'localhost','port':0x18eb});var socket=require(_0x94f0('0x1d'))(new Redis(config[_0x94f0('0x1b')]));require(_0x94f0('0x1e'))[_0x94f0('0x1f')](socket);function respondWithStatusCode(_0x4936c6,_0x23e546){_0x23e546=_0x23e546||0xcc;return function(_0x249fb9){if(_0x249fb9){return _0x4936c6[_0x94f0('0x20')](_0x23e546);}return _0x4936c6[_0x94f0('0x21')](_0x23e546)[_0x94f0('0x22')]();};}function respondWithResult(_0x489ca2,_0x12e74c){_0x12e74c=_0x12e74c||0xc8;return function(_0x50aae1){if(_0x50aae1){return _0x489ca2[_0x94f0('0x21')](_0x12e74c)['json'](_0x50aae1);}};}function respondWithFilteredResult(_0x37cc47,_0x54372f){return function(_0x51b146){if(_0x51b146){var _0x4042df=typeof _0x54372f[_0x94f0('0x23')]==='undefined'&&typeof _0x54372f[_0x94f0('0x24')]===_0x94f0('0x25');var _0x5c49e6=_0x51b146['count'];var _0x182a2c=_0x4042df?0x0:_0x54372f[_0x94f0('0x23')];var _0x45ad63=_0x4042df?_0x51b146[_0x94f0('0x26')]:_0x54372f[_0x94f0('0x23')]+_0x54372f[_0x94f0('0x24')];var _0x444576;if(_0x45ad63>=_0x5c49e6){_0x45ad63=_0x5c49e6;_0x444576=0xc8;}else{_0x444576=0xce;}_0x37cc47[_0x94f0('0x21')](_0x444576);return _0x37cc47['set'](_0x94f0('0x27'),_0x182a2c+'-'+_0x45ad63+'/'+_0x5c49e6)[_0x94f0('0x28')](_0x51b146);}return null;};}function patchUpdates(_0x5c7a52){return function(_0x5845f4){try{jsonpatch['apply'](_0x5845f4,_0x5c7a52,!![]);}catch(_0xfa2abe){return BPromise[_0x94f0('0x29')](_0xfa2abe);}return _0x5845f4[_0x94f0('0x2a')]();};}function saveUpdates(_0x44e254,_0x40d1ab){return function(_0x562242){if(_0x562242){return _0x562242[_0x94f0('0x2b')](_0x44e254)[_0x94f0('0x2c')](function(_0x1650c5){return _0x1650c5;});}return null;};}function removeEntity(_0x57aad2,_0x381d07){return function(_0xaaf158){if(_0xaaf158){return _0xaaf158[_0x94f0('0x2d')]()[_0x94f0('0x2c')](function(){var _0xeeb574=_0xaaf158['get']({'plain':!![]});var _0x4cf24b=_0x94f0('0x2e');return db['UserProfileResource']['destroy']({'where':{'type':_0x4cf24b,'resourceId':_0xeeb574['id']}})['then'](function(){return _0xaaf158;});})[_0x94f0('0x2c')](function(){_0x57aad2[_0x94f0('0x21')](0xcc)[_0x94f0('0x22')]();});}};}function handleEntityNotFound(_0xc16d6a,_0x475a69){return function(_0x37577e){if(!_0x37577e){_0xc16d6a[_0x94f0('0x20')](0x194);}return _0x37577e;};}function handleError(_0x4145ef,_0x1067ee){_0x1067ee=_0x1067ee||0x1f4;return function(_0x37e162){logger[_0x94f0('0x2f')](_0x37e162[_0x94f0('0x30')]);if(_0x37e162[_0x94f0('0x31')]){delete _0x37e162[_0x94f0('0x31')];}_0x4145ef['status'](_0x1067ee)[_0x94f0('0x32')](_0x37e162);};}exports[_0x94f0('0x33')]=function(_0x327448,_0x1a65b1){var _0x21b29f={},_0x221b5c={},_0xdfe1d0={'count':0x0,'rows':[]};var _0x362a97=_[_0x94f0('0x34')](db[_0x94f0('0x35')][_0x94f0('0x36')],function(_0x47695){return{'name':_0x47695[_0x94f0('0x37')],'type':_0x47695['type'][_0x94f0('0x38')]};});_0x221b5c[_0x94f0('0x39')]=_[_0x94f0('0x34')](_0x362a97,_0x94f0('0x31'));_0x221b5c[_0x94f0('0x3a')]=_['keys'](_0x327448[_0x94f0('0x3a')]);_0x221b5c['filters']=_[_0x94f0('0x3b')](_0x221b5c['model'],_0x221b5c[_0x94f0('0x3a')]);_0x21b29f[_0x94f0('0x3c')]=_[_0x94f0('0x3b')](_0x221b5c[_0x94f0('0x39')],qs[_0x94f0('0x3d')](_0x327448['query'][_0x94f0('0x3d')]));_0x21b29f[_0x94f0('0x3c')]=_0x21b29f[_0x94f0('0x3c')][_0x94f0('0x3e')]?_0x21b29f['attributes']:_0x221b5c[_0x94f0('0x39')];if(!_0x327448[_0x94f0('0x3a')][_0x94f0('0x3f')](_0x94f0('0x40'))){_0x21b29f[_0x94f0('0x24')]=qs[_0x94f0('0x24')](_0x327448[_0x94f0('0x3a')][_0x94f0('0x24')]);_0x21b29f['offset']=qs['offset'](_0x327448[_0x94f0('0x3a')][_0x94f0('0x23')]);}_0x21b29f[_0x94f0('0x41')]=qs['sort'](_0x327448[_0x94f0('0x3a')][_0x94f0('0x42')]);_0x21b29f['where']=qs[_0x94f0('0x43')](_[_0x94f0('0x44')](_0x327448[_0x94f0('0x3a')],_0x221b5c[_0x94f0('0x43')]),_0x362a97);if(_0x327448[_0x94f0('0x3a')][_0x94f0('0x45')]){_0x21b29f[_0x94f0('0x46')]=_[_0x94f0('0x47')](_0x21b29f['where'],{'$or':_[_0x94f0('0x34')](_0x362a97,function(_0x5197d2){if(_0x5197d2['type']!==_0x94f0('0x48')){var _0x579786={};_0x579786[_0x5197d2[_0x94f0('0x31')]]={'$like':'%'+_0x327448['query'][_0x94f0('0x45')]+'%'};return _0x579786;}})});}_0x21b29f=_[_0x94f0('0x47')]({},_0x21b29f,_0x327448[_0x94f0('0x49')]);var _0x42e4b1={'where':_0x21b29f['where']};return db[_0x94f0('0x35')]['count'](_0x42e4b1)['then'](function(_0x58489e){_0xdfe1d0[_0x94f0('0x26')]=_0x58489e;if(_0x327448['query'][_0x94f0('0x4a')]){_0x21b29f[_0x94f0('0x4b')]=[{'all':!![]}];}return db[_0x94f0('0x35')][_0x94f0('0x4c')](_0x21b29f);})[_0x94f0('0x2c')](function(_0x2367eb){_0xdfe1d0[_0x94f0('0x4d')]=_0x2367eb;return _0xdfe1d0;})[_0x94f0('0x2c')](respondWithFilteredResult(_0x1a65b1,_0x21b29f))[_0x94f0('0x4e')](handleError(_0x1a65b1,null));};exports[_0x94f0('0x4f')]=function(_0x3fc445,_0x237b98){var _0x4ddee2={'raw':![],'where':{'id':_0x3fc445[_0x94f0('0x50')]['id']}},_0x5e0586={};_0x5e0586[_0x94f0('0x39')]=_[_0x94f0('0x51')](db['CmList'][_0x94f0('0x36')]);_0x5e0586[_0x94f0('0x3a')]=_[_0x94f0('0x51')](_0x3fc445[_0x94f0('0x3a')]);_0x5e0586[_0x94f0('0x43')]=_['intersection'](_0x5e0586[_0x94f0('0x39')],_0x5e0586[_0x94f0('0x3a')]);_0x4ddee2['attributes']=_[_0x94f0('0x3b')](_0x5e0586[_0x94f0('0x39')],qs['fields'](_0x3fc445[_0x94f0('0x3a')][_0x94f0('0x3d')]));_0x4ddee2['attributes']=_0x4ddee2[_0x94f0('0x3c')][_0x94f0('0x3e')]?_0x4ddee2['attributes']:_0x5e0586[_0x94f0('0x39')];if(_0x3fc445[_0x94f0('0x3a')]['includeAll']){_0x4ddee2['include']=[{'all':!![]}];}_0x4ddee2=_[_0x94f0('0x47')]({},_0x4ddee2,_0x3fc445[_0x94f0('0x49')]);return db['CmList'][_0x94f0('0x52')](_0x4ddee2)['then'](handleEntityNotFound(_0x237b98,null))[_0x94f0('0x2c')](respondWithResult(_0x237b98,null))[_0x94f0('0x4e')](handleError(_0x237b98,null));};exports[_0x94f0('0x53')]=function(_0x4758b1,_0x147bac){return db[_0x94f0('0x35')][_0x94f0('0x53')](_0x4758b1[_0x94f0('0x54')],{})[_0x94f0('0x2c')](function(_0x4bfe22){var _0x359076=_0x4758b1[_0x94f0('0x55')][_0x94f0('0x56')]({'plain':!![]});if(!_0x359076)throw new Error(_0x94f0('0x57'));if(_0x359076[_0x94f0('0x58')]===_0x94f0('0x55')){var _0x603827=_0x4bfe22[_0x94f0('0x56')]({'plain':!![]});var _0x224d7c='Lists';return db[_0x94f0('0x59')]['find']({'where':{'name':_0x224d7c,'userProfileId':_0x359076[_0x94f0('0x5a')]},'raw':!![]})[_0x94f0('0x2c')](function(_0x39f441){if(_0x39f441&&_0x39f441[_0x94f0('0x5b')]===0x0){return db[_0x94f0('0x5c')]['create']({'name':_0x603827[_0x94f0('0x31')],'resourceId':_0x603827['id'],'type':_0x39f441['name'],'sectionId':_0x39f441['id']},{})[_0x94f0('0x2c')](function(){return _0x4bfe22;});}else{return _0x4bfe22;}})[_0x94f0('0x4e')](function(_0x141b18){logger[_0x94f0('0x2f')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x141b18);throw _0x141b18;});}return _0x4bfe22;})['then'](respondWithResult(_0x147bac,0xc9))['catch'](handleError(_0x147bac,null));};exports['update']=function(_0x459ecb,_0x424c78){if(_0x459ecb[_0x94f0('0x54')]['id']){delete _0x459ecb[_0x94f0('0x54')]['id'];}return db[_0x94f0('0x35')][_0x94f0('0x52')]({'where':{'id':_0x459ecb[_0x94f0('0x50')]['id']}})[_0x94f0('0x2c')](handleEntityNotFound(_0x424c78,null))['then'](saveUpdates(_0x459ecb['body'],null))['then'](respondWithResult(_0x424c78,null))[_0x94f0('0x4e')](handleError(_0x424c78,null));};exports['destroy']=function(_0x1a6d88,_0x306dbb){return db[_0x94f0('0x35')][_0x94f0('0x52')]({'where':{'id':_0x1a6d88['params']['id']}})[_0x94f0('0x2c')](handleEntityNotFound(_0x306dbb,null))[_0x94f0('0x2c')](removeEntity(_0x306dbb,null))[_0x94f0('0x4e')](handleError(_0x306dbb,null));};exports[_0x94f0('0x5d')]=function(_0x4eff9a,_0x5dd51f){return db['CmList'][_0x94f0('0x5d')]()['then'](respondWithResult(_0x5dd51f,null))[_0x94f0('0x4e')](handleError(_0x5dd51f,null));};exports[_0x94f0('0x5e')]=function(_0x6751e2,_0x15fd05,_0x30c69c){if(_0x6751e2['body']['id']){delete _0x6751e2[_0x94f0('0x54')]['id'];}return db[_0x94f0('0x35')][_0x94f0('0x52')]({'where':{'id':_0x6751e2[_0x94f0('0x50')]['id']}})[_0x94f0('0x2c')](handleEntityNotFound(_0x15fd05,null))['then'](function(_0x545980){if(_0x545980){_0x6751e2[_0x94f0('0x54')][_0x94f0('0x5f')]=_0x545980['id'];return db[_0x94f0('0x60')][_0x94f0('0x53')](_0x6751e2[_0x94f0('0x54')]);}})[_0x94f0('0x2c')](respondWithResult(_0x15fd05,null))[_0x94f0('0x4e')](handleError(_0x15fd05,null));};exports[_0x94f0('0x61')]=function(_0x6d9153,_0x17347e,_0x4104c3){var _0x50c6b6={'raw':![],'where':{}};var _0x301650={};var _0x243b27={'count':0x0,'rows':[]};return db['CmList'][_0x94f0('0x62')]({'where':{'id':_0x6d9153['params']['id']}})[_0x94f0('0x2c')](handleEntityNotFound(_0x17347e,null))['then'](function(_0x46c782){if(_0x46c782){_0x301650[_0x94f0('0x39')]=_[_0x94f0('0x51')](db[_0x94f0('0x60')][_0x94f0('0x36')]);_0x301650[_0x94f0('0x3a')]=_['keys'](_0x6d9153[_0x94f0('0x3a')]);_0x301650[_0x94f0('0x43')]=_[_0x94f0('0x3b')](_0x301650[_0x94f0('0x39')],_0x301650[_0x94f0('0x3a')]);_0x50c6b6[_0x94f0('0x3c')]=_['intersection'](_0x301650[_0x94f0('0x39')],qs[_0x94f0('0x3d')](_0x6d9153[_0x94f0('0x3a')]['fields']));_0x50c6b6[_0x94f0('0x3c')]=_0x50c6b6[_0x94f0('0x3c')][_0x94f0('0x3e')]?_0x50c6b6[_0x94f0('0x3c')]:_0x301650[_0x94f0('0x39')];if(!_0x6d9153[_0x94f0('0x3a')]['hasOwnProperty'](_0x94f0('0x40'))){_0x50c6b6[_0x94f0('0x24')]=qs[_0x94f0('0x24')](_0x6d9153[_0x94f0('0x3a')][_0x94f0('0x24')]);_0x50c6b6[_0x94f0('0x23')]=qs['offset'](_0x6d9153[_0x94f0('0x3a')]['offset']);}_0x50c6b6[_0x94f0('0x41')]=qs[_0x94f0('0x42')](_0x6d9153[_0x94f0('0x3a')][_0x94f0('0x42')]);_0x50c6b6[_0x94f0('0x46')]=qs['filters'](_[_0x94f0('0x44')](_0x6d9153[_0x94f0('0x3a')],_0x301650['filters']));_0x50c6b6[_0x94f0('0x46')][_0x94f0('0x5f')]=_0x46c782['id'];if(_0x6d9153[_0x94f0('0x3a')][_0x94f0('0x45')]){_0x50c6b6[_0x94f0('0x46')]=_['merge'](_0x50c6b6[_0x94f0('0x46')],{'$or':_['map'](_0x50c6b6[_0x94f0('0x3c')],function(_0x315ade){var _0x3c2909={};_0x3c2909[_0x315ade]={'$like':'%'+_0x6d9153[_0x94f0('0x3a')][_0x94f0('0x45')]+'%'};return _0x3c2909;})});}_0x50c6b6=_[_0x94f0('0x47')]({},_0x50c6b6,_0x6d9153['options']);return db[_0x94f0('0x60')][_0x94f0('0x26')]({'where':_0x50c6b6[_0x94f0('0x46')]})['then'](function(_0x44e5df){_0x243b27[_0x94f0('0x26')]=_0x44e5df;if(_0x6d9153[_0x94f0('0x3a')]['includeAll']){_0x50c6b6[_0x94f0('0x4b')]=[{'all':!![]}];}return db[_0x94f0('0x60')]['findAll'](_0x50c6b6);})[_0x94f0('0x2c')](function(_0x1f3d26){_0x243b27['rows']=_0x1f3d26;return _0x243b27;});}})[_0x94f0('0x2c')](respondWithFilteredResult(_0x17347e,_0x50c6b6))[_0x94f0('0x4e')](handleError(_0x17347e,null));};exports[_0x94f0('0x63')]=function(_0x45dca4,_0x5b80b2,_0xdd3359){return db[_0x94f0('0x35')][_0x94f0('0x52')]({'where':{'id':_0x45dca4[_0x94f0('0x50')]['id']}})[_0x94f0('0x2c')](handleEntityNotFound(_0x5b80b2,null))[_0x94f0('0x2c')](function(_0x3fbe9d){if(_0x3fbe9d){return _0x3fbe9d[_0x94f0('0x63')](_0x45dca4[_0x94f0('0x3a')][_0x94f0('0x64')]);}})[_0x94f0('0x2c')](respondWithStatusCode(_0x5b80b2,null))['catch'](handleError(_0x5b80b2,null));};exports['addContacts']=function(_0x359060,_0x2a38f3,_0x570585){return db['CmList'][_0x94f0('0x52')]({'where':{'id':_0x359060['params']['id']}})['then'](handleEntityNotFound(_0x2a38f3,null))[_0x94f0('0x2c')](function(_0x53e19a){if(_0x53e19a){var _0x5ad853=[];var _0x4ecd7c={'success':[],'errors':[]};return db[_0x94f0('0x65')][_0x94f0('0x5d')]()[_0x94f0('0x2c')](function(_0x276319){if(_0x359060[_0x94f0('0x54')][_0x94f0('0x66')]&&_['isArray'](_0x359060[_0x94f0('0x54')][_0x94f0('0x66')])){if(_0x359060[_0x94f0('0x54')][_0x94f0('0x66')]['length']){_0x359060[_0x94f0('0x54')]['tags']=_0x359060[_0x94f0('0x54')][_0x94f0('0x66')]['join'](';')+';';}else{_0x359060[_0x94f0('0x54')][_0x94f0('0x66')]=null;}}else{_0x359060[_0x94f0('0x54')]['tags']=null;}if(_0x359060[_0x94f0('0x54')]&&_['isArray'](_0x359060[_0x94f0('0x54')])){for(var _0x348e75=0x0;_0x348e75<_0x359060[_0x94f0('0x54')][_0x94f0('0x3e')];_0x348e75+=0x1){_0x359060[_0x94f0('0x54')][_0x348e75][_0x94f0('0x5f')]=_0x359060[_0x94f0('0x50')]['id'];_0x5ad853[_0x94f0('0x67')](_0x359060[_0x94f0('0x54')][_0x348e75]);}return BPromise[_0x94f0('0x68')](_0x5ad853,function(_0x35c36e){return db['CmContact'][_0x94f0('0x53')](_['omit'](_0x35c36e,['ids','id'])||{},{'fields':_[_0x94f0('0x51')](_0x276319),'raw':!![]})['then'](function(_0x38ecb3){_0x4ecd7c[_0x94f0('0x69')]['push'](_0x38ecb3[_0x94f0('0x6a')]);})[_0x94f0('0x4e')](function(_0x2e91ec){_0x4ecd7c[_0x94f0('0x6b')][_0x94f0('0x67')]({'data':_0x35c36e,'error':_0x2e91ec[_0x94f0('0x6c')]});});})[_0x94f0('0x2c')](function(_0xe28390){return _0x4ecd7c;})['catch'](function(_0x2c4ffa){return _0x2c4ffa;});}else{_0x2a38f3['status'](0x190)[_0x94f0('0x28')]({'message':_0x94f0('0x6d')});}});}})[_0x94f0('0x2c')](respondWithResult(_0x2a38f3,null))[_0x94f0('0x4e')](handleError(_0x2a38f3,null));};exports[_0x94f0('0x6e')]=function(_0x9cd2f2,_0x5b035c,_0x5d82d2){var _0x37f190;return db[_0x94f0('0x35')][_0x94f0('0x52')]({'where':{'id':_0x9cd2f2[_0x94f0('0x50')]['id']},'include':[{'model':db[_0x94f0('0x6f')],'as':_0x94f0('0x70')}]})['then'](handleEntityNotFound(_0x5b035c,null))[_0x94f0('0x2c')](function(_0x531a2f){if(_0x531a2f){_0x37f190=_0x531a2f;return db['CmContact'][_0x94f0('0x36')];}})[_0x94f0('0x2c')](function(_0x5261d0){if(_0x5261d0){var _0x17d570={};var _0x5241a8={};_0x5241a8['model']=_[_0x94f0('0x71')](_[_0x94f0('0x51')](_0x5261d0),_['map'](_0x37f190[_0x94f0('0x70')],function(_0x340365){return util['format']('cf_%d',_0x340365['id']);}));_0x5241a8['query']=_[_0x94f0('0x51')](_0x9cd2f2[_0x94f0('0x3a')]);_0x5241a8[_0x94f0('0x43')]=_[_0x94f0('0x3b')](_0x5241a8['model'],_0x5241a8['query']);_0x17d570[_0x94f0('0x3c')]=_[_0x94f0('0x3b')](_0x5241a8[_0x94f0('0x39')],qs['fields'](_0x9cd2f2['query'][_0x94f0('0x3d')]));_0x17d570[_0x94f0('0x3c')]=_0x17d570['attributes']['length']?_0x17d570[_0x94f0('0x3c')]:_0x5241a8[_0x94f0('0x39')];if(!_0x9cd2f2[_0x94f0('0x3a')][_0x94f0('0x3f')](_0x94f0('0x40'))){_0x17d570[_0x94f0('0x24')]=qs[_0x94f0('0x24')](_0x9cd2f2['query'][_0x94f0('0x24')]);_0x17d570[_0x94f0('0x23')]=qs['offset'](_0x9cd2f2[_0x94f0('0x3a')][_0x94f0('0x23')]);}_0x17d570['order']=qs[_0x94f0('0x42')](_0x9cd2f2[_0x94f0('0x3a')][_0x94f0('0x42')]);_0x17d570[_0x94f0('0x46')]=qs['filters'](_[_0x94f0('0x44')](_0x9cd2f2[_0x94f0('0x3a')],_0x5241a8['filters']));_0x17d570[_0x94f0('0x72')]=!![];if(_0x9cd2f2[_0x94f0('0x3a')][_0x94f0('0x45')]){_0x17d570[_0x94f0('0x46')]=_[_0x94f0('0x47')](_0x17d570['where'],{'$or':_[_0x94f0('0x34')](_0x17d570[_0x94f0('0x3c')],function(_0x5f5be1){var _0x618072={};_0x618072[_0x5f5be1]={'$like':'%'+_0x9cd2f2[_0x94f0('0x3a')][_0x94f0('0x45')]+'%'};return _0x618072;})});}_0x17d570=_[_0x94f0('0x47')]({},_0x17d570,_0x9cd2f2[_0x94f0('0x49')]);return _0x37f190[_0x94f0('0x6e')](_0x17d570);}})[_0x94f0('0x2c')](respondWithResult(_0x5b035c,null))['catch'](handleError(_0x5b035c,null));};exports['getContactsCsv']=function(_0x5236b9,_0x3ddc99,_0x14d1f6){var _0x31eec6;return db['CmList'][_0x94f0('0x52')]({'where':{'id':_0x5236b9[_0x94f0('0x50')]['id']},'include':[{'model':db['CmCustomField'],'as':'CustomFields'}]})[_0x94f0('0x2c')](handleEntityNotFound(_0x3ddc99,null))[_0x94f0('0x2c')](function(_0x315be8){if(_0x315be8){_0x31eec6=_0x315be8;return db[_0x94f0('0x65')][_0x94f0('0x36')];}})['then'](function(_0x147574){if(_0x147574){var _0x619a72={};var _0x11ede8={};_0x11ede8[_0x94f0('0x39')]=_['concat'](_[_0x94f0('0x51')](_0x147574),_[_0x94f0('0x34')](_0x31eec6['CustomFields'],function(_0x9f6449){return util[_0x94f0('0x73')](_0x94f0('0x74'),_0x9f6449['id']);}));_0x11ede8['query']=_['keys'](_0x5236b9[_0x94f0('0x3a')]);_0x11ede8[_0x94f0('0x43')]=_[_0x94f0('0x3b')](_0x11ede8['model'],_0x11ede8[_0x94f0('0x3a')]);_0x619a72[_0x94f0('0x3c')]=_[_0x94f0('0x3b')](_0x11ede8[_0x94f0('0x39')],qs[_0x94f0('0x3d')](_0x5236b9['query']['fields']));_0x619a72[_0x94f0('0x3c')]=_0x619a72[_0x94f0('0x3c')]['length']?_0x619a72['attributes']:_0x11ede8[_0x94f0('0x39')];if(!_0x5236b9[_0x94f0('0x3a')][_0x94f0('0x3f')](_0x94f0('0x40'))){_0x619a72[_0x94f0('0x24')]=qs[_0x94f0('0x24')](_0x5236b9[_0x94f0('0x3a')]['limit']);_0x619a72[_0x94f0('0x23')]=qs['offset'](_0x5236b9[_0x94f0('0x3a')][_0x94f0('0x23')]);}_0x619a72[_0x94f0('0x41')]=qs[_0x94f0('0x42')](_0x5236b9[_0x94f0('0x3a')][_0x94f0('0x42')]);_0x619a72[_0x94f0('0x46')]=qs['filters'](_[_0x94f0('0x44')](_0x5236b9['query'],_0x11ede8[_0x94f0('0x43')]));_0x619a72[_0x94f0('0x72')]=!![];if(_0x5236b9['query'][_0x94f0('0x45')]){_0x619a72[_0x94f0('0x46')]=_[_0x94f0('0x47')](_0x619a72[_0x94f0('0x46')],{'$or':_[_0x94f0('0x34')](_0x619a72[_0x94f0('0x3c')],function(_0x3fb089){var _0x1c82e3={};_0x1c82e3[_0x3fb089]={'$like':'%'+_0x5236b9[_0x94f0('0x3a')][_0x94f0('0x45')]+'%'};return _0x1c82e3;})});}_0x619a72=_['merge']({},_0x619a72,_0x5236b9[_0x94f0('0x49')]);return _0x31eec6[_0x94f0('0x6e')](_0x619a72);}})[_0x94f0('0x2c')](function(_0x40813d){if(!_[_0x94f0('0x75')](_0x40813d)){var _0x4a3587=toCsv(_0x40813d);var _0x29ee2e=Date[_0x94f0('0x76')]();fs[_0x94f0('0x77')](util[_0x94f0('0x73')](_0x94f0('0x78'),_0x31eec6['id'],_0x29ee2e),_0x4a3587);_0x3ddc99[_0x94f0('0x79')](_0x94f0('0x7a'),'attachment;\x20filename='+util[_0x94f0('0x73')](_0x94f0('0x7b'),_0x31eec6['id'],_0x29ee2e));_0x3ddc99[_0x94f0('0x79')](_0x94f0('0x7c'),'text/csv');return _0x3ddc99[_0x94f0('0x7d')](util[_0x94f0('0x73')](_0x94f0('0x78'),_0x31eec6['id'],_0x29ee2e));}else{return _0x3ddc99[_0x94f0('0x20')](0xcc);}})[_0x94f0('0x4e')](handleError(_0x3ddc99,null));};exports['addCustomField']=function(_0x278d65,_0x25fb1b,_0x1a0cbd){var _0x1d0daa;delete _0x278d65[_0x94f0('0x54')]['id'];return db[_0x94f0('0x35')]['findOne']({'where':{'id':_0x278d65[_0x94f0('0x50')]['id']}})['then'](handleEntityNotFound(_0x25fb1b,null))[_0x94f0('0x2c')](function(_0x236926){if(_0x236926){return db[_0x94f0('0x7e')][_0x94f0('0x7f')](function(_0x212887){return db[_0x94f0('0x6f')][_0x94f0('0x53')](_0x278d65[_0x94f0('0x54')],{'transaction':_0x212887})['then'](function(_0x257272){_0x1d0daa=_0x257272;return _0x236926['addCustomFields'](_0x257272,{'transaction':_0x212887});})[_0x94f0('0x2c')](function(){var _0x4c5569={'type':db['Sequelize'][_0x94f0('0x80')],'transaction':_0x212887};switch(_0x278d65['body']['type']){case _0x94f0('0x81'):_0x4c5569[_0x94f0('0x82')]=db[_0x94f0('0x83')][_0x94f0('0x80')];break;case'number':_0x4c5569[_0x94f0('0x82')]=db[_0x94f0('0x83')][_0x94f0('0x84')];break;case _0x94f0('0x85'):_0x4c5569[_0x94f0('0x82')]=db[_0x94f0('0x83')][_0x94f0('0x86')];_0x4c5569['defaultValue']=![];break;default:}return db[_0x94f0('0x7e')][_0x94f0('0x87')]['addColumn'](_0x94f0('0x88'),util['format']('cf_%s',_0x1d0daa['id']),_0x4c5569);})[_0x94f0('0x2c')](function(){return _0x1d0daa;});});}})[_0x94f0('0x2c')](respondWithResult(_0x25fb1b,null))[_0x94f0('0x4e')](handleError(_0x25fb1b,null));};exports[_0x94f0('0x89')]=function(_0x580413,_0x519c93,_0x1e7b5b){var _0x3d0b53={};var _0x4b2fda={};var _0x404eb8;var _0x3bd3d8;return db[_0x94f0('0x35')][_0x94f0('0x62')]({'where':{'id':_0x580413[_0x94f0('0x50')]['id']}})[_0x94f0('0x2c')](handleEntityNotFound(_0x519c93,null))['then'](function(_0x5a4953){if(_0x5a4953){_0x404eb8=_0x5a4953;_0x4b2fda['model']=_['keys'](db[_0x94f0('0x6f')][_0x94f0('0x36')]);_0x4b2fda['query']=_[_0x94f0('0x51')](_0x580413[_0x94f0('0x3a')]);_0x4b2fda[_0x94f0('0x43')]=_[_0x94f0('0x3b')](_0x4b2fda[_0x94f0('0x39')],_0x4b2fda[_0x94f0('0x3a')]);_0x3d0b53[_0x94f0('0x3c')]=_[_0x94f0('0x3b')](_0x4b2fda[_0x94f0('0x39')],qs[_0x94f0('0x3d')](_0x580413['query'][_0x94f0('0x3d')]));_0x3d0b53[_0x94f0('0x3c')]=_0x3d0b53[_0x94f0('0x3c')][_0x94f0('0x3e')]?_0x3d0b53[_0x94f0('0x3c')]:_0x4b2fda[_0x94f0('0x39')];_0x3d0b53[_0x94f0('0x41')]=qs[_0x94f0('0x42')](_0x580413[_0x94f0('0x3a')][_0x94f0('0x42')]);_0x3d0b53['where']=qs[_0x94f0('0x43')](_[_0x94f0('0x44')](_0x580413[_0x94f0('0x3a')],_0x4b2fda[_0x94f0('0x43')]));_0x3d0b53[_0x94f0('0x46')]=_[_0x94f0('0x47')](_0x3d0b53[_0x94f0('0x46')],{'$or':[{'ListId':_0x5a4953['id']},{'ListId':null}]});if(_0x580413[_0x94f0('0x3a')][_0x94f0('0x45')]){_0x3d0b53['where']=_[_0x94f0('0x47')](_0x3d0b53[_0x94f0('0x46')],{'$or':_[_0x94f0('0x34')](_0x3d0b53[_0x94f0('0x3c')],function(_0x195f12){var _0x27a5b7={};_0x27a5b7[_0x195f12]={'$like':'%'+_0x580413['query']['filter']+'%'};return _0x27a5b7;})});}_0x3d0b53=_[_0x94f0('0x47')]({},_0x3d0b53,_0x580413[_0x94f0('0x49')]);return db[_0x94f0('0x6f')][_0x94f0('0x8a')](_0x3d0b53);}})[_0x94f0('0x2c')](respondWithResult(_0x519c93,null))[_0x94f0('0x4e')](handleError(_0x519c93,null));};exports[_0x94f0('0x8b')]=function(_0x43a4f6,_0x48faa8,_0x28592b){return db['CmList']['find']({'where':{'id':_0x43a4f6[_0x94f0('0x50')]['id']}})[_0x94f0('0x2c')](handleEntityNotFound(_0x48faa8,null))[_0x94f0('0x2c')](function(_0x4525a5){if(_0x4525a5){return _0x4525a5[_0x94f0('0x8b')](_0x43a4f6[_0x94f0('0x54')]['ids'],_[_0x94f0('0x8c')](_0x43a4f6[_0x94f0('0x54')],[_0x94f0('0x64'),'id'])||{})[_0x94f0('0x8d')](function(_0x30ac58){for(var _0x6e3e1=0x0;_0x6e3e1<_0x43a4f6['body'][_0x94f0('0x64')][_0x94f0('0x3e')];_0x6e3e1+=0x1){socket['emit'](_0x94f0('0x8e'),{'UserId':Number(_0x43a4f6[_0x94f0('0x54')][_0x94f0('0x64')][_0x6e3e1]),'CmListId':Number(_0x43a4f6[_0x94f0('0x50')]['id'])});}return _0x30ac58;});}})[_0x94f0('0x2c')](respondWithResult(_0x48faa8,null))['catch'](handleError(_0x48faa8,null));};exports[_0x94f0('0x8f')]=function(_0x56e87b,_0x3be19b,_0x1d14d9){return db[_0x94f0('0x35')][_0x94f0('0x52')]({'where':{'id':_0x56e87b[_0x94f0('0x50')]['id']}})['then'](handleEntityNotFound(_0x3be19b,null))['then'](function(_0x3c11f9){if(_0x3c11f9){return _0x3c11f9['removeAgents'](_0x56e87b['query'][_0x94f0('0x64')])['then'](function(){if(_[_0x94f0('0x90')](_0x56e87b[_0x94f0('0x3a')][_0x94f0('0x64')])){for(var _0xe2ba8b=0x0;_0xe2ba8b<_0x56e87b[_0x94f0('0x3a')][_0x94f0('0x64')]['length'];_0xe2ba8b+=0x1){socket['emit'](_0x94f0('0x91'),{'UserId':Number(_0x56e87b[_0x94f0('0x3a')][_0x94f0('0x64')][_0xe2ba8b]),'CmListId':Number(_0x56e87b[_0x94f0('0x50')]['id'])});}}else{socket['emit']('userCmList:remove',{'UserId':Number(_0x56e87b[_0x94f0('0x3a')]['ids']),'CmListId':Number(_0x56e87b['params']['id'])});}});}})[_0x94f0('0x2c')](respondWithStatusCode(_0x3be19b,null))[_0x94f0('0x4e')](handleError(_0x3be19b,null));};exports['getAgents']=function(_0x58a4a5,_0x686249,_0x954809){var _0x132971={};var _0x176c97={};var _0x328367;var _0x3b643e;return db[_0x94f0('0x35')][_0x94f0('0x62')]({'where':{'id':_0x58a4a5[_0x94f0('0x50')]['id']}})['then'](handleEntityNotFound(_0x686249,null))[_0x94f0('0x2c')](function(_0x97efe8){if(_0x97efe8){_0x328367=_0x97efe8;_0x176c97[_0x94f0('0x39')]=_[_0x94f0('0x51')](db[_0x94f0('0x92')][_0x94f0('0x36')]);_0x176c97[_0x94f0('0x3a')]=_[_0x94f0('0x51')](_0x58a4a5[_0x94f0('0x3a')]);_0x176c97[_0x94f0('0x43')]=_[_0x94f0('0x3b')](_0x176c97[_0x94f0('0x39')],_0x176c97[_0x94f0('0x3a')]);_0x132971[_0x94f0('0x3c')]=_[_0x94f0('0x3b')](_0x176c97[_0x94f0('0x39')],qs[_0x94f0('0x3d')](_0x58a4a5[_0x94f0('0x3a')]['fields']));_0x132971[_0x94f0('0x3c')]=_0x132971[_0x94f0('0x3c')]['length']?_0x132971[_0x94f0('0x3c')]:_0x176c97[_0x94f0('0x39')];_0x132971[_0x94f0('0x41')]=qs[_0x94f0('0x42')](_0x58a4a5[_0x94f0('0x3a')][_0x94f0('0x42')]);_0x132971[_0x94f0('0x46')]=qs[_0x94f0('0x43')](_['pick'](_0x58a4a5[_0x94f0('0x3a')],_0x176c97['filters']));if(_0x58a4a5['query'][_0x94f0('0x45')]){_0x132971[_0x94f0('0x46')]=_[_0x94f0('0x47')](_0x132971[_0x94f0('0x46')],{'$or':_['map'](_0x132971[_0x94f0('0x3c')],function(_0x591f5a){var _0x59c31b={};_0x59c31b[_0x591f5a]={'$like':'%'+_0x58a4a5[_0x94f0('0x3a')][_0x94f0('0x45')]+'%'};return _0x59c31b;})});}_0x132971=_[_0x94f0('0x47')]({},_0x132971,_0x58a4a5[_0x94f0('0x49')]);return _0x328367[_0x94f0('0x93')](_0x132971);}})[_0x94f0('0x2c')](function(_0xa64e83){if(_0xa64e83){_0x3b643e=_0xa64e83[_0x94f0('0x3e')];if(!_0x58a4a5[_0x94f0('0x3a')][_0x94f0('0x3f')](_0x94f0('0x40'))){_0x132971['limit']=qs[_0x94f0('0x24')](_0x58a4a5['query'][_0x94f0('0x24')]);_0x132971[_0x94f0('0x23')]=qs['offset'](_0x58a4a5[_0x94f0('0x3a')][_0x94f0('0x23')]);}return _0x328367[_0x94f0('0x93')](_0x132971);}})[_0x94f0('0x2c')](function(_0x417e3b){if(_0x417e3b){return _0x417e3b?{'count':_0x3b643e,'rows':_0x417e3b}:null;}})['then'](respondWithResult(_0x686249,null))[_0x94f0('0x4e')](handleError(_0x686249,null));}; \ No newline at end of file +var _0x9ec4=['Sequelize','TEXT','text','INTEGER','switch','BOOLEAN','defaultValue','queryInterface','addColumn','cm_contacts','cf_%s','getCustomFields','findAndCountAll','addAgents','omit','emit','userCmList:save','removeAgents','userCmList:remove','getAgents','User','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./cmList.socket','register','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','apply','reject','save','then','destroy','get','Lists','error','stack','name','index','map','CmList','rawAttributes','type','key','model','filters','intersection','query','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','addDisposition','Disposition','getDispositions','findOne','length','removeDispositions','ids','addContacts','CmContact','isArray','tags','join','push','each','success','dataValues','errors','message','json','Malformed\x20request\x20syntax','getContacts','CmCustomField','CustomFields','concat','format','cf_%d','raw','isEmpty','now','writeFileSync','/tmp/list_%d_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','list_%d_%s.csv','addCustomField','sequelize','transaction','addCustomFields'];(function(_0x1017fa,_0x371fe5){var _0x3072e8=function(_0x42b827){while(--_0x42b827){_0x1017fa['push'](_0x1017fa['shift']());}};_0x3072e8(++_0x371fe5);}(_0x9ec4,0x147));var _0x49ec=function(_0x5109a3,_0x494ed5){_0x5109a3=_0x5109a3-0x0;var _0x25df9e=_0x9ec4[_0x5109a3];return _0x25df9e;};'use strict';var emlformat=require(_0x49ec('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x49ec('0x1'));var jsonpatch=require(_0x49ec('0x2'));var rp=require(_0x49ec('0x3'));var moment=require(_0x49ec('0x4'));var BPromise=require(_0x49ec('0x5'));var Mustache=require(_0x49ec('0x6'));var util=require(_0x49ec('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x49ec('0x8'));var ejs=require(_0x49ec('0x9'));var fs=require('fs');var fs_extra=require(_0x49ec('0xa'));var _=require(_0x49ec('0xb'));var squel=require('squel');var crypto=require(_0x49ec('0xc'));var jsforce=require(_0x49ec('0xd'));var deskjs=require(_0x49ec('0xe'));var toCsv=require(_0x49ec('0x8'));var querystring=require(_0x49ec('0xf'));var Papa=require(_0x49ec('0x10'));var Redis=require(_0x49ec('0x11'));var authService=require(_0x49ec('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x49ec('0x13'));var hardwareService=require(_0x49ec('0x14'));var logger=require(_0x49ec('0x15'))(_0x49ec('0x16'));var utils=require(_0x49ec('0x17'));var config=require(_0x49ec('0x18'));var licenseUtil=require(_0x49ec('0x19'));var db=require(_0x49ec('0x1a'))['db'];config[_0x49ec('0x1b')]=_[_0x49ec('0x1c')](config[_0x49ec('0x1b')],{'host':_0x49ec('0x1d'),'port':0x18eb});var socket=require(_0x49ec('0x1e'))(new Redis(config[_0x49ec('0x1b')]));require(_0x49ec('0x1f'))[_0x49ec('0x20')](socket);function respondWithStatusCode(_0x480ce9,_0x536a91){_0x536a91=_0x536a91||0xcc;return function(_0x291b23){if(_0x291b23){return _0x480ce9[_0x49ec('0x21')](_0x536a91);}return _0x480ce9[_0x49ec('0x22')](_0x536a91)[_0x49ec('0x23')]();};}function respondWithResult(_0x575f3a,_0x376603){_0x376603=_0x376603||0xc8;return function(_0x2e226){if(_0x2e226){return _0x575f3a[_0x49ec('0x22')](_0x376603)['json'](_0x2e226);}};}function respondWithFilteredResult(_0x3c6637,_0x576d72){return function(_0x1f855a){if(_0x1f855a){var _0x427ec7=typeof _0x576d72['offset']===_0x49ec('0x24')&&typeof _0x576d72[_0x49ec('0x25')]===_0x49ec('0x24');var _0x2480bf=_0x1f855a[_0x49ec('0x26')];var _0x51da15=_0x427ec7?0x0:_0x576d72[_0x49ec('0x27')];var _0x4a81a8=_0x427ec7?_0x1f855a['count']:_0x576d72['offset']+_0x576d72['limit'];var _0x53999a;if(_0x4a81a8>=_0x2480bf){_0x4a81a8=_0x2480bf;_0x53999a=0xc8;}else{_0x53999a=0xce;}_0x3c6637[_0x49ec('0x22')](_0x53999a);return _0x3c6637[_0x49ec('0x28')](_0x49ec('0x29'),_0x51da15+'-'+_0x4a81a8+'/'+_0x2480bf)['json'](_0x1f855a);}return null;};}function patchUpdates(_0x1a4e5a){return function(_0x486355){try{jsonpatch[_0x49ec('0x2a')](_0x486355,_0x1a4e5a,!![]);}catch(_0x135f2e){return BPromise[_0x49ec('0x2b')](_0x135f2e);}return _0x486355[_0x49ec('0x2c')]();};}function saveUpdates(_0xa8fd17,_0x370a7a){return function(_0x40cd33){if(_0x40cd33){return _0x40cd33['update'](_0xa8fd17)[_0x49ec('0x2d')](function(_0x4ba5e4){return _0x4ba5e4;});}return null;};}function removeEntity(_0x407e50,_0xadccc8){return function(_0x38f405){if(_0x38f405){return _0x38f405[_0x49ec('0x2e')]()[_0x49ec('0x2d')](function(){var _0x2c3ce3=_0x38f405[_0x49ec('0x2f')]({'plain':!![]});var _0x30ea70=_0x49ec('0x30');return db['UserProfileResource'][_0x49ec('0x2e')]({'where':{'type':_0x30ea70,'resourceId':_0x2c3ce3['id']}})[_0x49ec('0x2d')](function(){return _0x38f405;});})['then'](function(){_0x407e50['status'](0xcc)[_0x49ec('0x23')]();});}};}function handleEntityNotFound(_0xa122fc,_0x38e17c){return function(_0x169042){if(!_0x169042){_0xa122fc[_0x49ec('0x21')](0x194);}return _0x169042;};}function handleError(_0x17c952,_0x552ebf){_0x552ebf=_0x552ebf||0x1f4;return function(_0x10f0ab){logger[_0x49ec('0x31')](_0x10f0ab[_0x49ec('0x32')]);if(_0x10f0ab['name']){delete _0x10f0ab[_0x49ec('0x33')];}_0x17c952['status'](_0x552ebf)['send'](_0x10f0ab);};}exports[_0x49ec('0x34')]=function(_0x2e6a2b,_0x1cb9ae){var _0x2af790={},_0x36b0f0={},_0x57e6ce={'count':0x0,'rows':[]};var _0x2d271c=_[_0x49ec('0x35')](db[_0x49ec('0x36')][_0x49ec('0x37')],function(_0x515cdd){return{'name':_0x515cdd['fieldName'],'type':_0x515cdd[_0x49ec('0x38')][_0x49ec('0x39')]};});_0x36b0f0[_0x49ec('0x3a')]=_[_0x49ec('0x35')](_0x2d271c,_0x49ec('0x33'));_0x36b0f0['query']=_['keys'](_0x2e6a2b['query']);_0x36b0f0[_0x49ec('0x3b')]=_[_0x49ec('0x3c')](_0x36b0f0[_0x49ec('0x3a')],_0x36b0f0[_0x49ec('0x3d')]);_0x2af790[_0x49ec('0x3e')]=_[_0x49ec('0x3c')](_0x36b0f0['model'],qs[_0x49ec('0x3f')](_0x2e6a2b[_0x49ec('0x3d')][_0x49ec('0x3f')]));_0x2af790[_0x49ec('0x3e')]=_0x2af790['attributes']['length']?_0x2af790[_0x49ec('0x3e')]:_0x36b0f0[_0x49ec('0x3a')];if(!_0x2e6a2b[_0x49ec('0x3d')][_0x49ec('0x40')](_0x49ec('0x41'))){_0x2af790[_0x49ec('0x25')]=qs[_0x49ec('0x25')](_0x2e6a2b[_0x49ec('0x3d')][_0x49ec('0x25')]);_0x2af790['offset']=qs['offset'](_0x2e6a2b[_0x49ec('0x3d')][_0x49ec('0x27')]);}_0x2af790[_0x49ec('0x42')]=qs[_0x49ec('0x43')](_0x2e6a2b[_0x49ec('0x3d')][_0x49ec('0x43')]);_0x2af790[_0x49ec('0x44')]=qs[_0x49ec('0x3b')](_[_0x49ec('0x45')](_0x2e6a2b[_0x49ec('0x3d')],_0x36b0f0[_0x49ec('0x3b')]),_0x2d271c);if(_0x2e6a2b[_0x49ec('0x3d')][_0x49ec('0x46')]){_0x2af790['where']=_[_0x49ec('0x47')](_0x2af790['where'],{'$or':_['map'](_0x2d271c,function(_0x231f6e){if(_0x231f6e[_0x49ec('0x38')]!==_0x49ec('0x48')){var _0x56ed83={};_0x56ed83[_0x231f6e['name']]={'$like':'%'+_0x2e6a2b[_0x49ec('0x3d')][_0x49ec('0x46')]+'%'};return _0x56ed83;}})});}_0x2af790=_[_0x49ec('0x47')]({},_0x2af790,_0x2e6a2b[_0x49ec('0x49')]);var _0x1ac398={'where':_0x2af790[_0x49ec('0x44')]};return db[_0x49ec('0x36')]['count'](_0x1ac398)[_0x49ec('0x2d')](function(_0xd717e5){_0x57e6ce[_0x49ec('0x26')]=_0xd717e5;if(_0x2e6a2b[_0x49ec('0x3d')][_0x49ec('0x4a')]){_0x2af790[_0x49ec('0x4b')]=[{'all':!![]}];}return db[_0x49ec('0x36')][_0x49ec('0x4c')](_0x2af790);})['then'](function(_0xb400c1){_0x57e6ce[_0x49ec('0x4d')]=_0xb400c1;return _0x57e6ce;})[_0x49ec('0x2d')](respondWithFilteredResult(_0x1cb9ae,_0x2af790))[_0x49ec('0x4e')](handleError(_0x1cb9ae,null));};exports[_0x49ec('0x4f')]=function(_0x1a54dc,_0x1b0427){var _0x17e78c={'raw':![],'where':{'id':_0x1a54dc[_0x49ec('0x50')]['id']}},_0x2386ba={};_0x2386ba[_0x49ec('0x3a')]=_[_0x49ec('0x51')](db[_0x49ec('0x36')][_0x49ec('0x37')]);_0x2386ba['query']=_[_0x49ec('0x51')](_0x1a54dc[_0x49ec('0x3d')]);_0x2386ba[_0x49ec('0x3b')]=_['intersection'](_0x2386ba[_0x49ec('0x3a')],_0x2386ba[_0x49ec('0x3d')]);_0x17e78c[_0x49ec('0x3e')]=_[_0x49ec('0x3c')](_0x2386ba[_0x49ec('0x3a')],qs['fields'](_0x1a54dc[_0x49ec('0x3d')][_0x49ec('0x3f')]));_0x17e78c['attributes']=_0x17e78c[_0x49ec('0x3e')]['length']?_0x17e78c[_0x49ec('0x3e')]:_0x2386ba['model'];if(_0x1a54dc[_0x49ec('0x3d')][_0x49ec('0x4a')]){_0x17e78c[_0x49ec('0x4b')]=[{'all':!![]}];}_0x17e78c=_[_0x49ec('0x47')]({},_0x17e78c,_0x1a54dc[_0x49ec('0x49')]);return db[_0x49ec('0x36')][_0x49ec('0x52')](_0x17e78c)['then'](handleEntityNotFound(_0x1b0427,null))[_0x49ec('0x2d')](respondWithResult(_0x1b0427,null))['catch'](handleError(_0x1b0427,null));};exports['create']=function(_0x3b3311,_0x39a276){return db['CmList'][_0x49ec('0x53')](_0x3b3311[_0x49ec('0x54')],{})[_0x49ec('0x2d')](function(_0x251f1e){var _0x3d3561=_0x3b3311[_0x49ec('0x55')][_0x49ec('0x2f')]({'plain':!![]});if(!_0x3d3561)throw new Error(_0x49ec('0x56'));if(_0x3d3561[_0x49ec('0x57')]===_0x49ec('0x55')){var _0xb4e5cd=_0x251f1e[_0x49ec('0x2f')]({'plain':!![]});var _0x1e8b78=_0x49ec('0x30');return db['UserProfileSection'][_0x49ec('0x52')]({'where':{'name':_0x1e8b78,'userProfileId':_0x3d3561['userProfileId']},'raw':!![]})[_0x49ec('0x2d')](function(_0x35d40e){if(_0x35d40e&&_0x35d40e[_0x49ec('0x58')]===0x0){return db[_0x49ec('0x59')][_0x49ec('0x53')]({'name':_0xb4e5cd[_0x49ec('0x33')],'resourceId':_0xb4e5cd['id'],'type':_0x35d40e[_0x49ec('0x33')],'sectionId':_0x35d40e['id']},{})[_0x49ec('0x2d')](function(){return _0x251f1e;});}else{return _0x251f1e;}})[_0x49ec('0x4e')](function(_0x224f90){logger[_0x49ec('0x31')](_0x49ec('0x5a'),_0x224f90);throw _0x224f90;});}return _0x251f1e;})['then'](respondWithResult(_0x39a276,0xc9))[_0x49ec('0x4e')](handleError(_0x39a276,null));};exports[_0x49ec('0x5b')]=function(_0x29c89f,_0x4121ec){if(_0x29c89f['body']['id']){delete _0x29c89f[_0x49ec('0x54')]['id'];}return db[_0x49ec('0x36')]['find']({'where':{'id':_0x29c89f[_0x49ec('0x50')]['id']}})['then'](handleEntityNotFound(_0x4121ec,null))[_0x49ec('0x2d')](saveUpdates(_0x29c89f[_0x49ec('0x54')],null))[_0x49ec('0x2d')](respondWithResult(_0x4121ec,null))[_0x49ec('0x4e')](handleError(_0x4121ec,null));};exports['destroy']=function(_0x3f1bfd,_0x563d94){return db['CmList'][_0x49ec('0x52')]({'where':{'id':_0x3f1bfd[_0x49ec('0x50')]['id']}})[_0x49ec('0x2d')](handleEntityNotFound(_0x563d94,null))['then'](removeEntity(_0x563d94,null))[_0x49ec('0x4e')](handleError(_0x563d94,null));};exports[_0x49ec('0x5c')]=function(_0x572744,_0x1ee79d){return db['CmList'][_0x49ec('0x5c')]()[_0x49ec('0x2d')](respondWithResult(_0x1ee79d,null))[_0x49ec('0x4e')](handleError(_0x1ee79d,null));};exports[_0x49ec('0x5d')]=function(_0x39c7d6,_0x4c804f,_0x43b356){if(_0x39c7d6[_0x49ec('0x54')]['id']){delete _0x39c7d6[_0x49ec('0x54')]['id'];}return db[_0x49ec('0x36')][_0x49ec('0x52')]({'where':{'id':_0x39c7d6[_0x49ec('0x50')]['id']}})[_0x49ec('0x2d')](handleEntityNotFound(_0x4c804f,null))[_0x49ec('0x2d')](function(_0x468327){if(_0x468327){_0x39c7d6[_0x49ec('0x54')]['ListId']=_0x468327['id'];return db[_0x49ec('0x5e')]['create'](_0x39c7d6[_0x49ec('0x54')]);}})['then'](respondWithResult(_0x4c804f,null))['catch'](handleError(_0x4c804f,null));};exports[_0x49ec('0x5f')]=function(_0x58498a,_0x3c4ca2,_0xd84f1b){var _0x3cecc4={'raw':![],'where':{}};var _0x5bcc34={};var _0x2df57a={'count':0x0,'rows':[]};return db['CmList'][_0x49ec('0x60')]({'where':{'id':_0x58498a['params']['id']}})[_0x49ec('0x2d')](handleEntityNotFound(_0x3c4ca2,null))[_0x49ec('0x2d')](function(_0x27c138){if(_0x27c138){_0x5bcc34['model']=_[_0x49ec('0x51')](db[_0x49ec('0x5e')]['rawAttributes']);_0x5bcc34[_0x49ec('0x3d')]=_[_0x49ec('0x51')](_0x58498a[_0x49ec('0x3d')]);_0x5bcc34[_0x49ec('0x3b')]=_[_0x49ec('0x3c')](_0x5bcc34[_0x49ec('0x3a')],_0x5bcc34[_0x49ec('0x3d')]);_0x3cecc4[_0x49ec('0x3e')]=_[_0x49ec('0x3c')](_0x5bcc34[_0x49ec('0x3a')],qs[_0x49ec('0x3f')](_0x58498a[_0x49ec('0x3d')][_0x49ec('0x3f')]));_0x3cecc4[_0x49ec('0x3e')]=_0x3cecc4[_0x49ec('0x3e')][_0x49ec('0x61')]?_0x3cecc4[_0x49ec('0x3e')]:_0x5bcc34[_0x49ec('0x3a')];if(!_0x58498a['query']['hasOwnProperty'](_0x49ec('0x41'))){_0x3cecc4['limit']=qs['limit'](_0x58498a[_0x49ec('0x3d')]['limit']);_0x3cecc4[_0x49ec('0x27')]=qs['offset'](_0x58498a['query'][_0x49ec('0x27')]);}_0x3cecc4[_0x49ec('0x42')]=qs[_0x49ec('0x43')](_0x58498a[_0x49ec('0x3d')][_0x49ec('0x43')]);_0x3cecc4[_0x49ec('0x44')]=qs[_0x49ec('0x3b')](_[_0x49ec('0x45')](_0x58498a[_0x49ec('0x3d')],_0x5bcc34[_0x49ec('0x3b')]));_0x3cecc4[_0x49ec('0x44')]['ListId']=_0x27c138['id'];if(_0x58498a[_0x49ec('0x3d')][_0x49ec('0x46')]){_0x3cecc4['where']=_[_0x49ec('0x47')](_0x3cecc4[_0x49ec('0x44')],{'$or':_[_0x49ec('0x35')](_0x3cecc4['attributes'],function(_0x437944){var _0x2ae646={};_0x2ae646[_0x437944]={'$like':'%'+_0x58498a[_0x49ec('0x3d')][_0x49ec('0x46')]+'%'};return _0x2ae646;})});}_0x3cecc4=_[_0x49ec('0x47')]({},_0x3cecc4,_0x58498a['options']);return db['Disposition'][_0x49ec('0x26')]({'where':_0x3cecc4[_0x49ec('0x44')]})[_0x49ec('0x2d')](function(_0x4a5b84){_0x2df57a['count']=_0x4a5b84;if(_0x58498a[_0x49ec('0x3d')][_0x49ec('0x4a')]){_0x3cecc4['include']=[{'all':!![]}];}return db[_0x49ec('0x5e')][_0x49ec('0x4c')](_0x3cecc4);})[_0x49ec('0x2d')](function(_0x17a798){_0x2df57a['rows']=_0x17a798;return _0x2df57a;});}})[_0x49ec('0x2d')](respondWithFilteredResult(_0x3c4ca2,_0x3cecc4))[_0x49ec('0x4e')](handleError(_0x3c4ca2,null));};exports[_0x49ec('0x62')]=function(_0x2fd394,_0x29ab33,_0x40471f){return db[_0x49ec('0x36')]['find']({'where':{'id':_0x2fd394['params']['id']}})[_0x49ec('0x2d')](handleEntityNotFound(_0x29ab33,null))[_0x49ec('0x2d')](function(_0x26a3e7){if(_0x26a3e7){return _0x26a3e7[_0x49ec('0x62')](_0x2fd394[_0x49ec('0x3d')][_0x49ec('0x63')]);}})[_0x49ec('0x2d')](respondWithStatusCode(_0x29ab33,null))[_0x49ec('0x4e')](handleError(_0x29ab33,null));};exports[_0x49ec('0x64')]=function(_0x3324d4,_0x316832,_0x25306b){return db[_0x49ec('0x36')][_0x49ec('0x52')]({'where':{'id':_0x3324d4[_0x49ec('0x50')]['id']}})[_0x49ec('0x2d')](handleEntityNotFound(_0x316832,null))[_0x49ec('0x2d')](function(_0x18efc5){if(_0x18efc5){var _0x112d33=[];var _0x18aad9={'success':[],'errors':[]};return db[_0x49ec('0x65')][_0x49ec('0x5c')]()['then'](function(_0x1c3d7c){if(_0x3324d4[_0x49ec('0x54')]['tags']&&_[_0x49ec('0x66')](_0x3324d4['body'][_0x49ec('0x67')])){if(_0x3324d4[_0x49ec('0x54')]['tags'][_0x49ec('0x61')]){_0x3324d4[_0x49ec('0x54')][_0x49ec('0x67')]=_0x3324d4['body'][_0x49ec('0x67')][_0x49ec('0x68')](';')+';';}else{_0x3324d4[_0x49ec('0x54')][_0x49ec('0x67')]=null;}}else{_0x3324d4['body']['tags']=null;}if(_0x3324d4[_0x49ec('0x54')]&&_[_0x49ec('0x66')](_0x3324d4[_0x49ec('0x54')])){for(var _0x4a9853=0x0;_0x4a9853<_0x3324d4[_0x49ec('0x54')][_0x49ec('0x61')];_0x4a9853+=0x1){_0x3324d4['body'][_0x4a9853]['ListId']=_0x3324d4[_0x49ec('0x50')]['id'];_0x112d33[_0x49ec('0x69')](_0x3324d4[_0x49ec('0x54')][_0x4a9853]);}return BPromise[_0x49ec('0x6a')](_0x112d33,function(_0x60e430){return db[_0x49ec('0x65')][_0x49ec('0x53')](_['omit'](_0x60e430,['ids','id'])||{},{'fields':_[_0x49ec('0x51')](_0x1c3d7c),'raw':!![]})[_0x49ec('0x2d')](function(_0x15d819){_0x18aad9[_0x49ec('0x6b')][_0x49ec('0x69')](_0x15d819[_0x49ec('0x6c')]);})[_0x49ec('0x4e')](function(_0x364ad2){_0x18aad9[_0x49ec('0x6d')][_0x49ec('0x69')]({'data':_0x60e430,'error':_0x364ad2[_0x49ec('0x6e')]});});})[_0x49ec('0x2d')](function(_0x373e5b){return _0x18aad9;})[_0x49ec('0x4e')](function(_0x31ab10){return _0x31ab10;});}else{_0x316832[_0x49ec('0x22')](0x190)[_0x49ec('0x6f')]({'message':_0x49ec('0x70')});}});}})[_0x49ec('0x2d')](respondWithResult(_0x316832,null))['catch'](handleError(_0x316832,null));};exports[_0x49ec('0x71')]=function(_0x1f9f24,_0x4497b4,_0x6e77cf){var _0x36d480;return db[_0x49ec('0x36')]['find']({'where':{'id':_0x1f9f24['params']['id']},'include':[{'model':db[_0x49ec('0x72')],'as':_0x49ec('0x73')}]})[_0x49ec('0x2d')](handleEntityNotFound(_0x4497b4,null))[_0x49ec('0x2d')](function(_0x100d11){if(_0x100d11){_0x36d480=_0x100d11;return db[_0x49ec('0x65')][_0x49ec('0x37')];}})[_0x49ec('0x2d')](function(_0x5cd93f){if(_0x5cd93f){var _0x30fc2f={};var _0xcdc48e={};_0xcdc48e[_0x49ec('0x3a')]=_[_0x49ec('0x74')](_[_0x49ec('0x51')](_0x5cd93f),_[_0x49ec('0x35')](_0x36d480[_0x49ec('0x73')],function(_0x545942){return util[_0x49ec('0x75')](_0x49ec('0x76'),_0x545942['id']);}));_0xcdc48e[_0x49ec('0x3d')]=_[_0x49ec('0x51')](_0x1f9f24[_0x49ec('0x3d')]);_0xcdc48e['filters']=_[_0x49ec('0x3c')](_0xcdc48e[_0x49ec('0x3a')],_0xcdc48e[_0x49ec('0x3d')]);_0x30fc2f[_0x49ec('0x3e')]=_[_0x49ec('0x3c')](_0xcdc48e[_0x49ec('0x3a')],qs[_0x49ec('0x3f')](_0x1f9f24[_0x49ec('0x3d')][_0x49ec('0x3f')]));_0x30fc2f[_0x49ec('0x3e')]=_0x30fc2f[_0x49ec('0x3e')][_0x49ec('0x61')]?_0x30fc2f[_0x49ec('0x3e')]:_0xcdc48e['model'];if(!_0x1f9f24[_0x49ec('0x3d')][_0x49ec('0x40')]('nolimit')){_0x30fc2f[_0x49ec('0x25')]=qs[_0x49ec('0x25')](_0x1f9f24[_0x49ec('0x3d')][_0x49ec('0x25')]);_0x30fc2f[_0x49ec('0x27')]=qs[_0x49ec('0x27')](_0x1f9f24['query'][_0x49ec('0x27')]);}_0x30fc2f['order']=qs[_0x49ec('0x43')](_0x1f9f24[_0x49ec('0x3d')]['sort']);_0x30fc2f['where']=qs[_0x49ec('0x3b')](_[_0x49ec('0x45')](_0x1f9f24[_0x49ec('0x3d')],_0xcdc48e[_0x49ec('0x3b')]));_0x30fc2f[_0x49ec('0x77')]=!![];if(_0x1f9f24[_0x49ec('0x3d')][_0x49ec('0x46')]){_0x30fc2f['where']=_['merge'](_0x30fc2f[_0x49ec('0x44')],{'$or':_['map'](_0x30fc2f['attributes'],function(_0x229b1c){var _0x19ad8a={};_0x19ad8a[_0x229b1c]={'$like':'%'+_0x1f9f24['query'][_0x49ec('0x46')]+'%'};return _0x19ad8a;})});}_0x30fc2f=_['merge']({},_0x30fc2f,_0x1f9f24[_0x49ec('0x49')]);return _0x36d480[_0x49ec('0x71')](_0x30fc2f);}})[_0x49ec('0x2d')](respondWithResult(_0x4497b4,null))['catch'](handleError(_0x4497b4,null));};exports['getContactsCsv']=function(_0x4ea0e3,_0x54ec9a,_0x3803e7){var _0x12a41d;return db['CmList']['find']({'where':{'id':_0x4ea0e3[_0x49ec('0x50')]['id']},'include':[{'model':db['CmCustomField'],'as':_0x49ec('0x73')}]})[_0x49ec('0x2d')](handleEntityNotFound(_0x54ec9a,null))[_0x49ec('0x2d')](function(_0x2e71f8){if(_0x2e71f8){_0x12a41d=_0x2e71f8;return db[_0x49ec('0x65')][_0x49ec('0x37')];}})[_0x49ec('0x2d')](function(_0xdd1d4f){if(_0xdd1d4f){var _0x4aa530={};var _0x560770={};_0x560770['model']=_[_0x49ec('0x74')](_[_0x49ec('0x51')](_0xdd1d4f),_['map'](_0x12a41d[_0x49ec('0x73')],function(_0x137095){return util[_0x49ec('0x75')](_0x49ec('0x76'),_0x137095['id']);}));_0x560770[_0x49ec('0x3d')]=_['keys'](_0x4ea0e3[_0x49ec('0x3d')]);_0x560770[_0x49ec('0x3b')]=_[_0x49ec('0x3c')](_0x560770[_0x49ec('0x3a')],_0x560770[_0x49ec('0x3d')]);_0x4aa530[_0x49ec('0x3e')]=_['intersection'](_0x560770[_0x49ec('0x3a')],qs[_0x49ec('0x3f')](_0x4ea0e3[_0x49ec('0x3d')]['fields']));_0x4aa530[_0x49ec('0x3e')]=_0x4aa530[_0x49ec('0x3e')][_0x49ec('0x61')]?_0x4aa530[_0x49ec('0x3e')]:_0x560770[_0x49ec('0x3a')];if(!_0x4ea0e3[_0x49ec('0x3d')][_0x49ec('0x40')](_0x49ec('0x41'))){_0x4aa530['limit']=qs[_0x49ec('0x25')](_0x4ea0e3[_0x49ec('0x3d')][_0x49ec('0x25')]);_0x4aa530[_0x49ec('0x27')]=qs[_0x49ec('0x27')](_0x4ea0e3[_0x49ec('0x3d')][_0x49ec('0x27')]);}_0x4aa530['order']=qs[_0x49ec('0x43')](_0x4ea0e3['query'][_0x49ec('0x43')]);_0x4aa530[_0x49ec('0x44')]=qs['filters'](_[_0x49ec('0x45')](_0x4ea0e3['query'],_0x560770[_0x49ec('0x3b')]));_0x4aa530['raw']=!![];if(_0x4ea0e3[_0x49ec('0x3d')]['filter']){_0x4aa530[_0x49ec('0x44')]=_[_0x49ec('0x47')](_0x4aa530[_0x49ec('0x44')],{'$or':_['map'](_0x4aa530[_0x49ec('0x3e')],function(_0x16f101){var _0x5c2f26={};_0x5c2f26[_0x16f101]={'$like':'%'+_0x4ea0e3[_0x49ec('0x3d')]['filter']+'%'};return _0x5c2f26;})});}_0x4aa530=_[_0x49ec('0x47')]({},_0x4aa530,_0x4ea0e3[_0x49ec('0x49')]);return _0x12a41d['getContacts'](_0x4aa530);}})[_0x49ec('0x2d')](function(_0x181fc7){if(!_[_0x49ec('0x78')](_0x181fc7)){var _0x561c8e=toCsv(_0x181fc7);var _0x398f40=Date[_0x49ec('0x79')]();fs[_0x49ec('0x7a')](util['format'](_0x49ec('0x7b'),_0x12a41d['id'],_0x398f40),_0x561c8e);_0x54ec9a[_0x49ec('0x7c')](_0x49ec('0x7d'),_0x49ec('0x7e')+util[_0x49ec('0x75')](_0x49ec('0x7f'),_0x12a41d['id'],_0x398f40));_0x54ec9a[_0x49ec('0x7c')]('Content-type','text/csv');return _0x54ec9a['download'](util[_0x49ec('0x75')](_0x49ec('0x7b'),_0x12a41d['id'],_0x398f40));}else{return _0x54ec9a[_0x49ec('0x21')](0xcc);}})[_0x49ec('0x4e')](handleError(_0x54ec9a,null));};exports[_0x49ec('0x80')]=function(_0xbd644f,_0x2329e1,_0x5c011c){var _0x845584;delete _0xbd644f[_0x49ec('0x54')]['id'];return db[_0x49ec('0x36')][_0x49ec('0x60')]({'where':{'id':_0xbd644f[_0x49ec('0x50')]['id']}})[_0x49ec('0x2d')](handleEntityNotFound(_0x2329e1,null))['then'](function(_0x3103b9){if(_0x3103b9){return db[_0x49ec('0x81')][_0x49ec('0x82')](function(_0x306604){return db[_0x49ec('0x72')][_0x49ec('0x53')](_0xbd644f[_0x49ec('0x54')],{'transaction':_0x306604})[_0x49ec('0x2d')](function(_0x375905){_0x845584=_0x375905;return _0x3103b9[_0x49ec('0x83')](_0x375905,{'transaction':_0x306604});})[_0x49ec('0x2d')](function(){var _0x350758={'type':db[_0x49ec('0x84')][_0x49ec('0x85')],'transaction':_0x306604};switch(_0xbd644f[_0x49ec('0x54')][_0x49ec('0x38')]){case _0x49ec('0x86'):_0x350758[_0x49ec('0x38')]=db['Sequelize'][_0x49ec('0x85')];break;case'number':_0x350758[_0x49ec('0x38')]=db['Sequelize'][_0x49ec('0x87')];break;case _0x49ec('0x88'):_0x350758['type']=db[_0x49ec('0x84')][_0x49ec('0x89')];_0x350758[_0x49ec('0x8a')]=![];break;default:}return db[_0x49ec('0x81')][_0x49ec('0x8b')][_0x49ec('0x8c')](_0x49ec('0x8d'),util[_0x49ec('0x75')](_0x49ec('0x8e'),_0x845584['id']),_0x350758);})[_0x49ec('0x2d')](function(){return _0x845584;});});}})['then'](respondWithResult(_0x2329e1,null))['catch'](handleError(_0x2329e1,null));};exports[_0x49ec('0x8f')]=function(_0x4b876e,_0x3da5e,_0x1e49dd){var _0x276195={};var _0x38b823={};var _0x2751f4;var _0x6994f1;return db[_0x49ec('0x36')]['findOne']({'where':{'id':_0x4b876e[_0x49ec('0x50')]['id']}})[_0x49ec('0x2d')](handleEntityNotFound(_0x3da5e,null))['then'](function(_0x34517c){if(_0x34517c){_0x2751f4=_0x34517c;_0x38b823[_0x49ec('0x3a')]=_[_0x49ec('0x51')](db[_0x49ec('0x72')][_0x49ec('0x37')]);_0x38b823[_0x49ec('0x3d')]=_['keys'](_0x4b876e[_0x49ec('0x3d')]);_0x38b823[_0x49ec('0x3b')]=_[_0x49ec('0x3c')](_0x38b823[_0x49ec('0x3a')],_0x38b823[_0x49ec('0x3d')]);_0x276195[_0x49ec('0x3e')]=_[_0x49ec('0x3c')](_0x38b823[_0x49ec('0x3a')],qs[_0x49ec('0x3f')](_0x4b876e['query'][_0x49ec('0x3f')]));_0x276195[_0x49ec('0x3e')]=_0x276195[_0x49ec('0x3e')][_0x49ec('0x61')]?_0x276195[_0x49ec('0x3e')]:_0x38b823['model'];_0x276195[_0x49ec('0x42')]=qs[_0x49ec('0x43')](_0x4b876e[_0x49ec('0x3d')][_0x49ec('0x43')]);_0x276195[_0x49ec('0x44')]=qs['filters'](_[_0x49ec('0x45')](_0x4b876e[_0x49ec('0x3d')],_0x38b823['filters']));_0x276195[_0x49ec('0x44')]=_['merge'](_0x276195[_0x49ec('0x44')],{'$or':[{'ListId':_0x34517c['id']},{'ListId':null}]});if(_0x4b876e[_0x49ec('0x3d')][_0x49ec('0x46')]){_0x276195[_0x49ec('0x44')]=_[_0x49ec('0x47')](_0x276195[_0x49ec('0x44')],{'$or':_['map'](_0x276195[_0x49ec('0x3e')],function(_0x52cddb){var _0x4f8e95={};_0x4f8e95[_0x52cddb]={'$like':'%'+_0x4b876e['query'][_0x49ec('0x46')]+'%'};return _0x4f8e95;})});}_0x276195=_['merge']({},_0x276195,_0x4b876e['options']);return db[_0x49ec('0x72')][_0x49ec('0x90')](_0x276195);}})['then'](respondWithResult(_0x3da5e,null))[_0x49ec('0x4e')](handleError(_0x3da5e,null));};exports[_0x49ec('0x91')]=function(_0x4a16e2,_0x1757b1,_0x40a7c6){return db[_0x49ec('0x36')]['find']({'where':{'id':_0x4a16e2[_0x49ec('0x50')]['id']}})[_0x49ec('0x2d')](handleEntityNotFound(_0x1757b1,null))['then'](function(_0x5426d3){if(_0x5426d3){return _0x5426d3[_0x49ec('0x91')](_0x4a16e2[_0x49ec('0x54')]['ids'],_[_0x49ec('0x92')](_0x4a16e2[_0x49ec('0x54')],[_0x49ec('0x63'),'id'])||{})['spread'](function(_0x5514e5){for(var _0x39036f=0x0;_0x39036f<_0x4a16e2[_0x49ec('0x54')]['ids'][_0x49ec('0x61')];_0x39036f+=0x1){socket[_0x49ec('0x93')](_0x49ec('0x94'),{'UserId':Number(_0x4a16e2[_0x49ec('0x54')][_0x49ec('0x63')][_0x39036f]),'CmListId':Number(_0x4a16e2[_0x49ec('0x50')]['id'])});}return _0x5514e5;});}})[_0x49ec('0x2d')](respondWithResult(_0x1757b1,null))['catch'](handleError(_0x1757b1,null));};exports[_0x49ec('0x95')]=function(_0x239a13,_0x506d78,_0x26cb0c){return db['CmList'][_0x49ec('0x52')]({'where':{'id':_0x239a13[_0x49ec('0x50')]['id']}})[_0x49ec('0x2d')](handleEntityNotFound(_0x506d78,null))[_0x49ec('0x2d')](function(_0x413ef1){if(_0x413ef1){return _0x413ef1[_0x49ec('0x95')](_0x239a13['query'][_0x49ec('0x63')])[_0x49ec('0x2d')](function(){if(_['isArray'](_0x239a13[_0x49ec('0x3d')]['ids'])){for(var _0x14c5bd=0x0;_0x14c5bd<_0x239a13[_0x49ec('0x3d')][_0x49ec('0x63')][_0x49ec('0x61')];_0x14c5bd+=0x1){socket[_0x49ec('0x93')](_0x49ec('0x96'),{'UserId':Number(_0x239a13[_0x49ec('0x3d')][_0x49ec('0x63')][_0x14c5bd]),'CmListId':Number(_0x239a13[_0x49ec('0x50')]['id'])});}}else{socket[_0x49ec('0x93')](_0x49ec('0x96'),{'UserId':Number(_0x239a13[_0x49ec('0x3d')][_0x49ec('0x63')]),'CmListId':Number(_0x239a13[_0x49ec('0x50')]['id'])});}});}})[_0x49ec('0x2d')](respondWithStatusCode(_0x506d78,null))[_0x49ec('0x4e')](handleError(_0x506d78,null));};exports[_0x49ec('0x97')]=function(_0x12c51c,_0x450f0d,_0x1fd6d6){var _0x378f32={};var _0x300f9f={};var _0x22d6e6;var _0x223902;return db[_0x49ec('0x36')][_0x49ec('0x60')]({'where':{'id':_0x12c51c[_0x49ec('0x50')]['id']}})[_0x49ec('0x2d')](handleEntityNotFound(_0x450f0d,null))['then'](function(_0x2536bb){if(_0x2536bb){_0x22d6e6=_0x2536bb;_0x300f9f[_0x49ec('0x3a')]=_[_0x49ec('0x51')](db[_0x49ec('0x98')][_0x49ec('0x37')]);_0x300f9f[_0x49ec('0x3d')]=_[_0x49ec('0x51')](_0x12c51c[_0x49ec('0x3d')]);_0x300f9f['filters']=_[_0x49ec('0x3c')](_0x300f9f[_0x49ec('0x3a')],_0x300f9f[_0x49ec('0x3d')]);_0x378f32['attributes']=_[_0x49ec('0x3c')](_0x300f9f[_0x49ec('0x3a')],qs[_0x49ec('0x3f')](_0x12c51c[_0x49ec('0x3d')][_0x49ec('0x3f')]));_0x378f32[_0x49ec('0x3e')]=_0x378f32[_0x49ec('0x3e')]['length']?_0x378f32['attributes']:_0x300f9f[_0x49ec('0x3a')];_0x378f32[_0x49ec('0x42')]=qs[_0x49ec('0x43')](_0x12c51c[_0x49ec('0x3d')]['sort']);_0x378f32[_0x49ec('0x44')]=qs['filters'](_[_0x49ec('0x45')](_0x12c51c[_0x49ec('0x3d')],_0x300f9f['filters']));if(_0x12c51c[_0x49ec('0x3d')][_0x49ec('0x46')]){_0x378f32[_0x49ec('0x44')]=_[_0x49ec('0x47')](_0x378f32[_0x49ec('0x44')],{'$or':_[_0x49ec('0x35')](_0x378f32[_0x49ec('0x3e')],function(_0x37cac8){var _0x2ba8d1={};_0x2ba8d1[_0x37cac8]={'$like':'%'+_0x12c51c['query'][_0x49ec('0x46')]+'%'};return _0x2ba8d1;})});}_0x378f32=_[_0x49ec('0x47')]({},_0x378f32,_0x12c51c[_0x49ec('0x49')]);return _0x22d6e6[_0x49ec('0x97')](_0x378f32);}})[_0x49ec('0x2d')](function(_0x465cb4){if(_0x465cb4){_0x223902=_0x465cb4[_0x49ec('0x61')];if(!_0x12c51c[_0x49ec('0x3d')][_0x49ec('0x40')](_0x49ec('0x41'))){_0x378f32[_0x49ec('0x25')]=qs[_0x49ec('0x25')](_0x12c51c['query'][_0x49ec('0x25')]);_0x378f32[_0x49ec('0x27')]=qs['offset'](_0x12c51c[_0x49ec('0x3d')][_0x49ec('0x27')]);}return _0x22d6e6[_0x49ec('0x97')](_0x378f32);}})[_0x49ec('0x2d')](function(_0x52626a){if(_0x52626a){return _0x52626a?{'count':_0x223902,'rows':_0x52626a}:null;}})[_0x49ec('0x2d')](respondWithResult(_0x450f0d,null))[_0x49ec('0x4e')](handleError(_0x450f0d,null));}; \ No newline at end of file diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index 6d10fe7..32bf096 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(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xe14b,0x93));var _0xbe14=function(_0x2350bf,_0x37288a){_0x2350bf=_0x2350bf-0x0;var _0x14211e=_0xe14b[_0x2350bf];return _0x14211e;};'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(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe14b,0x93));var _0xbe14=function(_0x4cdc05,_0xe591b4){_0x4cdc05=_0x4cdc05-0x0;var _0x7bced5=_0xe14b[_0x4cdc05];return _0x7bced5;};'use strict';var EventEmitter=require(_0xbe14('0x0'));var CmList=require(_0xbe14('0x1'))['db']['CmList'];var CmListEvents=new EventEmitter();CmListEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xbe14('0x2'),'afterUpdate':_0xbe14('0x3'),'afterDestroy':'remove'};function emitEvent(_0x7d3665){return function(_0x5ce8fb,_0x496c04,_0x1833e3){CmListEvents[_0xbe14('0x4')](_0x7d3665+':'+_0x5ce8fb['id'],_0x5ce8fb);CmListEvents[_0xbe14('0x4')](_0x7d3665,_0x5ce8fb);_0x1833e3(null);};}for(var e in events){if(events[_0xbe14('0x5')](e)){var event=events[e];CmList[_0xbe14('0x6')](e,emitEvent(event));}}module[_0xbe14('0x7')]=CmListEvents; \ No newline at end of file diff --git a/server/api/cmList/cmList.model.js b/server/api/cmList/cmList.model.js index c7e3b2f..b710876 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 _0x9bde=['request-promise','path','rimraf','../../config/environment','./cmList.attributes','exports','define','CmList','cm_lists','util','api','bluebird'];(function(_0x44e16b,_0x479c8e){var _0x921f41=function(_0x5b74f6){while(--_0x5b74f6){_0x44e16b['push'](_0x44e16b['shift']());}};_0x921f41(++_0x479c8e);}(_0x9bde,0xe1));var _0xe9bd=function(_0x4bb40d,_0x541949){_0x4bb40d=_0x4bb40d-0x0;var _0x41ede2=_0x9bde[_0x4bb40d];return _0x41ede2;};'use strict';var _=require('lodash');var util=require(_0xe9bd('0x0'));var logger=require('../../config/logger')(_0xe9bd('0x1'));var moment=require('moment');var BPromise=require(_0xe9bd('0x2'));var rp=require(_0xe9bd('0x3'));var fs=require('fs');var path=require(_0xe9bd('0x4'));var rimraf=require(_0xe9bd('0x5'));var config=require(_0xe9bd('0x6'));var attributes=require(_0xe9bd('0x7'));module[_0xe9bd('0x8')]=function(_0x4fd7b8,_0x4763e9){return _0x4fd7b8[_0xe9bd('0x9')](_0xe9bd('0xa'),attributes,{'tableName':_0xe9bd('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe706=['request-promise','path','rimraf','../../config/environment','./cmList.attributes','exports','define','CmList','cm_lists','lodash','util','../../config/logger','moment','bluebird'];(function(_0x1a7698,_0x28d70e){var _0x3e8433=function(_0x151ebd){while(--_0x151ebd){_0x1a7698['push'](_0x1a7698['shift']());}};_0x3e8433(++_0x28d70e);}(_0xe706,0xa3));var _0x6e70=function(_0x10f68e,_0xf198ea){_0x10f68e=_0x10f68e-0x0;var _0x4c8372=_0xe706[_0x10f68e];return _0x4c8372;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var logger=require(_0x6e70('0x2'))('api');var moment=require(_0x6e70('0x3'));var BPromise=require(_0x6e70('0x4'));var rp=require(_0x6e70('0x5'));var fs=require('fs');var path=require(_0x6e70('0x6'));var rimraf=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var attributes=require(_0x6e70('0x9'));module[_0x6e70('0xa')]=function(_0x1b0389,_0x4381d1){return _0x1b0389[_0x6e70('0xb')](_0x6e70('0xc'),attributes,{'tableName':_0x6e70('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmList/cmList.rpc.js b/server/api/cmList/cmList.rpc.js index 9b812f3..18f16d5 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 _0x94a6=['debug','CmList,\x20%s,\x20%s,\x20%s','stringify','error','code','CmList,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','redis','defaults','localhost','socket.io-emitter','./cmList.socket','register','info','request\x20sent'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0x94a6,0x17f));var _0x694a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x94a6[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x694a('0x0'));var util=require(_0x694a('0x1'));var moment=require(_0x694a('0x2'));var BPromise=require(_0x694a('0x3'));var rs=require(_0x694a('0x4'));var fs=require('fs');var Redis=require(_0x694a('0x5'));var db=require(_0x694a('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x694a('0x7'))(_0x694a('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config[_0x694a('0x9')]=_[_0x694a('0xa')](config[_0x694a('0x9')],{'host':_0x694a('0xb'),'port':0x18eb});var socket=require(_0x694a('0xc'))(new Redis(config[_0x694a('0x9')]));require(_0x694a('0xd'))[_0x694a('0xe')](socket);function respondWithRpcPromise(_0x135126,_0x54e175,_0x1ef86f){return new BPromise(function(_0x4e7696,_0x28bc30){return client['request'](_0x135126,_0x1ef86f)['then'](function(_0x31558f){logger[_0x694a('0xf')]('CmList,\x20%s,\x20%s',_0x54e175,_0x694a('0x10'));logger[_0x694a('0x11')](_0x694a('0x12'),_0x54e175,_0x694a('0x10'),JSON[_0x694a('0x13')](_0x31558f));if(_0x31558f[_0x694a('0x14')]){if(_0x31558f['error'][_0x694a('0x15')]===0x1f4){logger[_0x694a('0x14')](_0x694a('0x16'),_0x54e175,_0x31558f['error'][_0x694a('0x17')]);return _0x28bc30(_0x31558f[_0x694a('0x14')][_0x694a('0x17')]);}logger['error'](_0x694a('0x16'),_0x54e175,_0x31558f['error'][_0x694a('0x17')]);return _0x4e7696(_0x31558f[_0x694a('0x14')][_0x694a('0x17')]);}else{logger[_0x694a('0xf')](_0x694a('0x16'),_0x54e175,_0x694a('0x10'));_0x4e7696(_0x31558f[_0x694a('0x18')]['message']);}})['catch'](function(_0x2977de){logger[_0x694a('0x14')](_0x694a('0x16'),_0x54e175,_0x2977de);_0x28bc30(_0x2977de);});});} \ No newline at end of file +var _0xee5e=['code','message','CmList,\x20%s,\x20%s','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./cmList.socket','register','then','info','request\x20sent','debug','stringify','error'];(function(_0xe8725,_0x1d4a7d){var _0x21c1fc=function(_0x5d2a8d){while(--_0x5d2a8d){_0xe8725['push'](_0xe8725['shift']());}};_0x21c1fc(++_0x1d4a7d);}(_0xee5e,0x1a9));var _0xeee5=function(_0x3a0895,_0xf5e0a6){_0x3a0895=_0x3a0895-0x0;var _0x4ec9aa=_0xee5e[_0x3a0895];return _0x4ec9aa;};'use strict';var _=require(_0xeee5('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xeee5('0x1'));var rs=require(_0xeee5('0x2'));var fs=require('fs');var Redis=require(_0xeee5('0x3'));var db=require(_0xeee5('0x4'))['db'];var utils=require(_0xeee5('0x5'));var logger=require(_0xeee5('0x6'))(_0xeee5('0x7'));var config=require(_0xeee5('0x8'));var jayson=require(_0xeee5('0x9'));var client=jayson[_0xeee5('0xa')][_0xeee5('0xb')]({'port':0x232a});config[_0xeee5('0xc')]=_[_0xeee5('0xd')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xeee5('0xe'))(new Redis(config['redis']));require(_0xeee5('0xf'))[_0xeee5('0x10')](socket);function respondWithRpcPromise(_0x439088,_0x3fad46,_0x429c22){return new BPromise(function(_0x3134eb,_0xb5c3d0){return client['request'](_0x439088,_0x429c22)[_0xeee5('0x11')](function(_0x1cd8ed){logger[_0xeee5('0x12')]('CmList,\x20%s,\x20%s',_0x3fad46,_0xeee5('0x13'));logger[_0xeee5('0x14')]('CmList,\x20%s,\x20%s,\x20%s',_0x3fad46,_0xeee5('0x13'),JSON[_0xeee5('0x15')](_0x1cd8ed));if(_0x1cd8ed[_0xeee5('0x16')]){if(_0x1cd8ed[_0xeee5('0x16')][_0xeee5('0x17')]===0x1f4){logger[_0xeee5('0x16')]('CmList,\x20%s,\x20%s',_0x3fad46,_0x1cd8ed[_0xeee5('0x16')]['message']);return _0xb5c3d0(_0x1cd8ed['error'][_0xeee5('0x18')]);}logger[_0xeee5('0x16')](_0xeee5('0x19'),_0x3fad46,_0x1cd8ed[_0xeee5('0x16')][_0xeee5('0x18')]);return _0x3134eb(_0x1cd8ed[_0xeee5('0x16')][_0xeee5('0x18')]);}else{logger['info'](_0xeee5('0x19'),_0x3fad46,_0xeee5('0x13'));_0x3134eb(_0x1cd8ed[_0xeee5('0x1a')]['message']);}})[_0xeee5('0x1b')](function(_0x182899){logger[_0xeee5('0x16')](_0xeee5('0x19'),_0x3fad46,_0x182899);_0xb5c3d0(_0x182899);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index fdf94e2..0d2eecf 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 _0xce0a=['cmList:','remove','emit','removeListener','register','length'];(function(_0x320800,_0x1ddb58){var _0x1cbdf3=function(_0x49a114){while(--_0x49a114){_0x320800['push'](_0x320800['shift']());}};_0x1cbdf3(++_0x1ddb58);}(_0xce0a,0xbb));var _0xace0=function(_0x4e9274,_0x49576e){_0x4e9274=_0x4e9274-0x0;var _0x8b474c=_0xce0a[_0x4e9274];return _0x8b474c;};'use strict';var CmListEvents=require('./cmList.events');var events=['save',_0xace0('0x0'),'update'];function createListener(_0x3bebd1,_0x1f6554){return function(_0x3eda18){_0x1f6554[_0xace0('0x1')](_0x3bebd1,_0x3eda18);};}function removeListener(_0x3a4706,_0x543209){return function(){CmListEvents[_0xace0('0x2')](_0x3a4706,_0x543209);};}exports[_0xace0('0x3')]=function(_0x25eb90){for(var _0x273ae1=0x0,_0x16a130=events[_0xace0('0x4')];_0x273ae1<_0x16a130;_0x273ae1++){var _0x30bd97=events[_0x273ae1];var _0x2dc450=createListener(_0xace0('0x5')+_0x30bd97,_0x25eb90);CmListEvents['on'](_0x30bd97,_0x2dc450);}}; \ No newline at end of file +var _0xcea1=['cmList:','./cmList.events','save','update','removeListener','register'];(function(_0x2a332d,_0x3d5865){var _0x5d24c4=function(_0x255e6c){while(--_0x255e6c){_0x2a332d['push'](_0x2a332d['shift']());}};_0x5d24c4(++_0x3d5865);}(_0xcea1,0x91));var _0x1cea=function(_0x4e07d9,_0x15d276){_0x4e07d9=_0x4e07d9-0x0;var _0x508643=_0xcea1[_0x4e07d9];return _0x508643;};'use strict';var CmListEvents=require(_0x1cea('0x0'));var events=[_0x1cea('0x1'),'remove',_0x1cea('0x2')];function createListener(_0x5f3c91,_0x25dc90){return function(_0x46ed81){_0x25dc90['emit'](_0x5f3c91,_0x46ed81);};}function removeListener(_0x3a9290,_0x441520){return function(){CmListEvents[_0x1cea('0x3')](_0x3a9290,_0x441520);};}exports[_0x1cea('0x4')]=function(_0x5c6218){for(var _0x221a88=0x0,_0x3323a3=events['length'];_0x221a88<_0x3323a3;_0x221a88++){var _0xa9757a=events[_0x221a88];var _0x14f58c=createListener(_0x1cea('0x5')+_0xa9757a,_0x5c6218);CmListEvents['on'](_0xa9757a,_0x14f58c);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index 6a31b46..2720003 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 _0x50ef=['../../components/interaction/service','./cmList.controller','get','isAuthenticated','index','/describe','/:id','getDispositions','/:id/contacts','getContacts','/:id/contacts/csv','getContactsCsv','getCustomFields','/:id/users','getAgents','post','/:id/dispositions','addContacts','addCustomField','addAgents','put','update','delete','destroy','removeDispositions','removeAgents','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0xfa1bdd,_0x1416f9){var _0x497408=function(_0x475876){while(--_0x475876){_0xfa1bdd['push'](_0xfa1bdd['shift']());}};_0x497408(++_0x1416f9);}(_0x50ef,0x81));var _0xf50e=function(_0x5b0e88,_0x396dad){_0x5b0e88=_0x5b0e88-0x0;var _0x583a8e=_0x50ef[_0x5b0e88];return _0x583a8e;};'use strict';var multer=require(_0xf50e('0x0'));var util=require('util');var path=require(_0xf50e('0x1'));var timeout=require(_0xf50e('0x2'));var express=require(_0xf50e('0x3'));var router=express[_0xf50e('0x4')]();var fs_extra=require(_0xf50e('0x5'));var auth=require(_0xf50e('0x6'));var interaction=require(_0xf50e('0x7'));var config=require('../../config/environment');var controller=require(_0xf50e('0x8'));router[_0xf50e('0x9')]('/',auth[_0xf50e('0xa')](),controller[_0xf50e('0xb')]);router[_0xf50e('0x9')](_0xf50e('0xc'),auth['isAuthenticated'](),controller['describe']);router[_0xf50e('0x9')](_0xf50e('0xd'),auth[_0xf50e('0xa')](),controller['show']);router[_0xf50e('0x9')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0xf50e('0xe')]);router[_0xf50e('0x9')](_0xf50e('0xf'),auth[_0xf50e('0xa')](),controller[_0xf50e('0x10')]);router[_0xf50e('0x9')](_0xf50e('0x11'),auth[_0xf50e('0xa')](),controller[_0xf50e('0x12')]);router[_0xf50e('0x9')]('/:id/fields',auth[_0xf50e('0xa')](),controller[_0xf50e('0x13')]);router['get'](_0xf50e('0x14'),auth['isAuthenticated'](),controller[_0xf50e('0x15')]);router['post']('/',auth[_0xf50e('0xa')](),controller['create']);router[_0xf50e('0x16')](_0xf50e('0x17'),auth[_0xf50e('0xa')](),controller['addDisposition']);router['post'](_0xf50e('0xf'),auth[_0xf50e('0xa')](),controller[_0xf50e('0x18')]);router[_0xf50e('0x16')]('/:id/fields',auth['isAuthenticated'](),controller[_0xf50e('0x19')]);router[_0xf50e('0x16')](_0xf50e('0x14'),auth[_0xf50e('0xa')](),controller[_0xf50e('0x1a')]);router[_0xf50e('0x1b')](_0xf50e('0xd'),auth[_0xf50e('0xa')](),controller[_0xf50e('0x1c')]);router[_0xf50e('0x1d')](_0xf50e('0xd'),auth['isAuthenticated'](),controller[_0xf50e('0x1e')]);router['delete'](_0xf50e('0x17'),auth['isAuthenticated'](),controller[_0xf50e('0x1f')]);router[_0xf50e('0x1d')](_0xf50e('0x14'),auth[_0xf50e('0xa')](),controller[_0xf50e('0x20')]);module[_0xf50e('0x21')]=router; \ No newline at end of file +var _0x7e53=['/:id/contacts','addContacts','addCustomField','addAgents','put','update','delete','removeDispositions','exports','multer','fs-extra','../../components/auth/service','isAuthenticated','get','/:id','show','/:id/dispositions','getDispositions','/:id/contacts/csv','getContactsCsv','/:id/fields','/:id/users','getAgents','post','create','addDisposition'];(function(_0x2946db,_0x113ba6){var _0x39a299=function(_0x2e7e85){while(--_0x2e7e85){_0x2946db['push'](_0x2946db['shift']());}};_0x39a299(++_0x113ba6);}(_0x7e53,0xf3));var _0x37e5=function(_0x1efa4d,_0x5d52a1){_0x1efa4d=_0x1efa4d-0x0;var _0x4aa043=_0x7e53[_0x1efa4d];return _0x4aa043;};'use strict';var multer=require(_0x37e5('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x37e5('0x1'));var auth=require(_0x37e5('0x2'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./cmList.controller');router['get']('/',auth[_0x37e5('0x3')](),controller['index']);router['get']('/describe',auth[_0x37e5('0x3')](),controller['describe']);router[_0x37e5('0x4')](_0x37e5('0x5'),auth[_0x37e5('0x3')](),controller[_0x37e5('0x6')]);router[_0x37e5('0x4')](_0x37e5('0x7'),auth[_0x37e5('0x3')](),controller[_0x37e5('0x8')]);router[_0x37e5('0x4')]('/:id/contacts',auth[_0x37e5('0x3')](),controller['getContacts']);router['get'](_0x37e5('0x9'),auth[_0x37e5('0x3')](),controller[_0x37e5('0xa')]);router['get'](_0x37e5('0xb'),auth['isAuthenticated'](),controller['getCustomFields']);router['get'](_0x37e5('0xc'),auth['isAuthenticated'](),controller[_0x37e5('0xd')]);router[_0x37e5('0xe')]('/',auth['isAuthenticated'](),controller[_0x37e5('0xf')]);router[_0x37e5('0xe')](_0x37e5('0x7'),auth[_0x37e5('0x3')](),controller[_0x37e5('0x10')]);router[_0x37e5('0xe')](_0x37e5('0x11'),auth[_0x37e5('0x3')](),controller[_0x37e5('0x12')]);router['post']('/:id/fields',auth['isAuthenticated'](),controller[_0x37e5('0x13')]);router[_0x37e5('0xe')](_0x37e5('0xc'),auth[_0x37e5('0x3')](),controller[_0x37e5('0x14')]);router[_0x37e5('0x15')]('/:id',auth[_0x37e5('0x3')](),controller[_0x37e5('0x16')]);router[_0x37e5('0x17')]('/:id',auth['isAuthenticated'](),controller['destroy']);router[_0x37e5('0x17')](_0x37e5('0x7'),auth[_0x37e5('0x3')](),controller[_0x37e5('0x18')]);router[_0x37e5('0x17')]('/:id/users',auth[_0x37e5('0x3')](),controller['removeAgents']);module[_0x37e5('0x19')]=router; \ No newline at end of file diff --git a/server/api/condition/condition.attributes.js b/server/api/condition/condition.attributes.js index b2302c5..90a594d 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 _0xdde7=['STRING','sequelize','exports','VIRTUAL','getDataValue','field'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xdde7,0x1db));var _0x7dde=function(_0x4a7458,_0x5e0843){_0x4a7458=_0x4a7458-0x0;var _0x35226d=_0xdde7[_0x4a7458];return _0x35226d;};'use strict';var Sequelize=require(_0x7dde('0x0'));module[_0x7dde('0x1')]={'name':{'type':Sequelize[_0x7dde('0x2')],'get':function(_0x37788e){return this[_0x7dde('0x3')](_0x7dde('0x4'));}},'field':{'type':Sequelize[_0x7dde('0x5')],'allowNull':![]},'operator':{'type':Sequelize[_0x7dde('0x5')],'allowNull':![]},'value':{'type':Sequelize[_0x7dde('0x5')],'allowNull':![]}}; \ No newline at end of file +var _0x24be=['exports','VIRTUAL','getDataValue','field','STRING','sequelize'];(function(_0x50f378,_0x4ea47e){var _0x2db0ee=function(_0x557099){while(--_0x557099){_0x50f378['push'](_0x50f378['shift']());}};_0x2db0ee(++_0x4ea47e);}(_0x24be,0x1b5));var _0xe24b=function(_0x5a6323,_0x5ecd9f){_0x5a6323=_0x5a6323-0x0;var _0x252ed5=_0x24be[_0x5a6323];return _0x252ed5;};'use strict';var Sequelize=require(_0xe24b('0x0'));module[_0xe24b('0x1')]={'name':{'type':Sequelize[_0xe24b('0x2')],'get':function(_0x4583a7){return this[_0xe24b('0x3')](_0xe24b('0x4'));}},'field':{'type':Sequelize[_0xe24b('0x5')],'allowNull':![]},'operator':{'type':Sequelize[_0xe24b('0x5')],'allowNull':![]},'value':{'type':Sequelize[_0xe24b('0x5')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/condition/condition.controller.js b/server/api/condition/condition.controller.js index 5424454..47bcd8e 100644 --- a/server/api/condition/condition.controller.js +++ b/server/api/condition/condition.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['sox','to-csv','fs-extra','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','body','Condition','find','catch','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path'];(function(_0x3692a9,_0x15b170){var _0x2a29f3=function(_0x5f1ebb){while(--_0x5f1ebb){_0x3692a9['push'](_0x3692a9['shift']());}};_0x2a29f3(++_0x15b170);}(_0x7a54,0x106));var _0x47a5=function(_0x17bbe9,_0x48062e){_0x17bbe9=_0x17bbe9-0x0;var _0x8f0634=_0x7a54[_0x17bbe9];return _0x8f0634;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x22')]=function(_0x136b14,_0x16631f){if(_0x136b14[_0x47a5('0x29')]['id']){delete _0x136b14[_0x47a5('0x29')]['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x2b')]({'where':{'id':_0x136b14['params']['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x16631f,null))['then'](saveUpdates(_0x136b14[_0x47a5('0x29')],null))[_0x47a5('0x23')](respondWithResult(_0x16631f,null))[_0x47a5('0x2c')](handleError(_0x16631f,null));};exports['destroy']=function(_0x256650,_0x625952){return db[_0x47a5('0x2a')][_0x47a5('0x2b')]({'where':{'id':_0x256650['params']['id']}})['then'](handleEntityNotFound(_0x625952,null))[_0x47a5('0x23')](removeEntity(_0x625952,null))[_0x47a5('0x2c')](handleError(_0x625952,null));}; \ No newline at end of file +var _0x7a54=['sox','to-csv','fs-extra','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','body','Condition','find','catch','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path'];(function(_0x1544a6,_0x37a542){var _0xe4bd5b=function(_0xc52f4f){while(--_0xc52f4f){_0x1544a6['push'](_0x1544a6['shift']());}};_0xe4bd5b(++_0x37a542);}(_0x7a54,0x106));var _0x47a5=function(_0x39baed,_0x2a1ea4){_0x39baed=_0x39baed-0x0;var _0x67bf75=_0x7a54[_0x39baed];return _0x67bf75;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x22')]=function(_0x136b14,_0x16631f){if(_0x136b14[_0x47a5('0x29')]['id']){delete _0x136b14[_0x47a5('0x29')]['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x2b')]({'where':{'id':_0x136b14['params']['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x16631f,null))['then'](saveUpdates(_0x136b14[_0x47a5('0x29')],null))[_0x47a5('0x23')](respondWithResult(_0x16631f,null))[_0x47a5('0x2c')](handleError(_0x16631f,null));};exports['destroy']=function(_0x256650,_0x625952){return db[_0x47a5('0x2a')][_0x47a5('0x2b')]({'where':{'id':_0x256650['params']['id']}})['then'](handleEntityNotFound(_0x625952,null))[_0x47a5('0x23')](removeEntity(_0x625952,null))[_0x47a5('0x2c')](handleError(_0x625952,null));}; \ No newline at end of file diff --git a/server/api/condition/condition.model.js b/server/api/condition/condition.model.js index cbc1ac2..735bdae 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 _0x5a24=['path','rimraf','./condition.attributes','exports','define','tools_conditions','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x299504,_0x1f3008){var _0x1908ee=function(_0x23e4e9){while(--_0x23e4e9){_0x299504['push'](_0x299504['shift']());}};_0x1908ee(++_0x1f3008);}(_0x5a24,0x74));var _0x45a2=function(_0x3865ad,_0x2db7b1){_0x3865ad=_0x3865ad-0x0;var _0x3b41df=_0x5a24[_0x3865ad];return _0x3b41df;};'use strict';var _=require('lodash');var util=require(_0x45a2('0x0'));var logger=require(_0x45a2('0x1'))('api');var moment=require(_0x45a2('0x2'));var BPromise=require(_0x45a2('0x3'));var rp=require(_0x45a2('0x4'));var fs=require('fs');var path=require(_0x45a2('0x5'));var rimraf=require(_0x45a2('0x6'));var config=require('../../config/environment');var attributes=require(_0x45a2('0x7'));module[_0x45a2('0x8')]=function(_0x352fdc,_0x4bd814){return _0x352fdc[_0x45a2('0x9')]('Condition',attributes,{'tableName':_0x45a2('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc806=['path','../../config/environment','./condition.attributes','exports','define','lodash','../../config/logger','api','moment','request-promise'];(function(_0x37ee9a,_0x49f980){var _0x2177e1=function(_0x1fb96b){while(--_0x1fb96b){_0x37ee9a['push'](_0x37ee9a['shift']());}};_0x2177e1(++_0x49f980);}(_0xc806,0x109));var _0x6c80=function(_0x139ecb,_0x26c9fc){_0x139ecb=_0x139ecb-0x0;var _0x2b67fb=_0xc806[_0x139ecb];return _0x2b67fb;};'use strict';var _=require(_0x6c80('0x0'));var util=require('util');var logger=require(_0x6c80('0x1'))(_0x6c80('0x2'));var moment=require(_0x6c80('0x3'));var BPromise=require('bluebird');var rp=require(_0x6c80('0x4'));var fs=require('fs');var path=require(_0x6c80('0x5'));var rimraf=require('rimraf');var config=require(_0x6c80('0x6'));var attributes=require(_0x6c80('0x7'));module[_0x6c80('0x8')]=function(_0x270a8b,_0x5bb903){return _0x270a8b[_0x6c80('0x9')]('Condition',attributes,{'tableName':'tools_conditions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/condition/condition.rpc.js b/server/api/condition/condition.rpc.js index e15dbfa..91101b7 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 _0x2f40=['code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','Condition,\x20%s,\x20%s','request\x20sent','debug','Condition,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2f40,0x124));var _0x02f4=function(_0x5783f4,_0x4a9e0a){_0x5783f4=_0x5783f4-0x0;var _0x28e380=_0x2f40[_0x5783f4];return _0x28e380;};'use strict';var _=require(_0x02f4('0x0'));var util=require(_0x02f4('0x1'));var moment=require(_0x02f4('0x2'));var BPromise=require('bluebird');var rs=require(_0x02f4('0x3'));var fs=require('fs');var Redis=require(_0x02f4('0x4'));var db=require(_0x02f4('0x5'))['db'];var utils=require(_0x02f4('0x6'));var logger=require(_0x02f4('0x7'))(_0x02f4('0x8'));var config=require('../../config/environment');var jayson=require(_0x02f4('0x9'));var client=jayson['client'][_0x02f4('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4ef593,_0xde2024,_0x5724cb){return new BPromise(function(_0x256799,_0x34328a){return client[_0x02f4('0xb')](_0x4ef593,_0x5724cb)[_0x02f4('0xc')](function(_0x293b14){logger[_0x02f4('0xd')](_0x02f4('0xe'),_0xde2024,_0x02f4('0xf'));logger[_0x02f4('0x10')](_0x02f4('0x11'),_0xde2024,_0x02f4('0xf'),JSON[_0x02f4('0x12')](_0x293b14));if(_0x293b14[_0x02f4('0x13')]){if(_0x293b14[_0x02f4('0x13')][_0x02f4('0x14')]===0x1f4){logger['error'](_0x02f4('0xe'),_0xde2024,_0x293b14[_0x02f4('0x13')][_0x02f4('0x15')]);return _0x34328a(_0x293b14[_0x02f4('0x13')]['message']);}logger[_0x02f4('0x13')](_0x02f4('0xe'),_0xde2024,_0x293b14['error']['message']);return _0x256799(_0x293b14[_0x02f4('0x13')][_0x02f4('0x15')]);}else{logger[_0x02f4('0xd')](_0x02f4('0xe'),_0xde2024,'request\x20sent');_0x256799(_0x293b14[_0x02f4('0x16')][_0x02f4('0x15')]);}})[_0x02f4('0x17')](function(_0x937da0){logger[_0x02f4('0x13')](_0x02f4('0xe'),_0xde2024,_0x937da0);_0x34328a(_0x937da0);});});} \ No newline at end of file +var _0x09d2=['../../config/environment','http','request','then','info','request\x20sent','Condition,\x20%s,\x20%s,\x20%s','error','code','message','Condition,\x20%s,\x20%s','result','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x59ca69,_0x8f11e4){var _0x4d2f9a=function(_0x44c560){while(--_0x44c560){_0x59ca69['push'](_0x59ca69['shift']());}};_0x4d2f9a(++_0x8f11e4);}(_0x09d2,0xf4));var _0x209d=function(_0x323065,_0x5d412a){_0x323065=_0x323065-0x0;var _0xec74b2=_0x09d2[_0x323065];return _0xec74b2;};'use strict';var _=require(_0x209d('0x0'));var util=require('util');var moment=require(_0x209d('0x1'));var BPromise=require(_0x209d('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x209d('0x3'));var db=require(_0x209d('0x4'))['db'];var utils=require(_0x209d('0x5'));var logger=require(_0x209d('0x6'))(_0x209d('0x7'));var config=require(_0x209d('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x209d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xa5de1c,_0x40f8d3,_0xf265ad){return new BPromise(function(_0x3bc915,_0x29d37c){return client[_0x209d('0xa')](_0xa5de1c,_0xf265ad)[_0x209d('0xb')](function(_0x4df03b){logger[_0x209d('0xc')]('Condition,\x20%s,\x20%s',_0x40f8d3,_0x209d('0xd'));logger['debug'](_0x209d('0xe'),_0x40f8d3,_0x209d('0xd'),JSON['stringify'](_0x4df03b));if(_0x4df03b['error']){if(_0x4df03b[_0x209d('0xf')][_0x209d('0x10')]===0x1f4){logger[_0x209d('0xf')]('Condition,\x20%s,\x20%s',_0x40f8d3,_0x4df03b[_0x209d('0xf')][_0x209d('0x11')]);return _0x29d37c(_0x4df03b['error']['message']);}logger[_0x209d('0xf')]('Condition,\x20%s,\x20%s',_0x40f8d3,_0x4df03b[_0x209d('0xf')][_0x209d('0x11')]);return _0x3bc915(_0x4df03b[_0x209d('0xf')]['message']);}else{logger[_0x209d('0xc')](_0x209d('0x12'),_0x40f8d3,_0x209d('0xd'));_0x3bc915(_0x4df03b[_0x209d('0x13')]['message']);}})[_0x209d('0x14')](function(_0x1764c0){logger[_0x209d('0xf')](_0x209d('0x12'),_0x40f8d3,_0x1764c0);_0x29d37c(_0x1764c0);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index 3095acc..fcfdfab 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 _0x5f70=['destroy','multer','util','connect-timeout','express','../../components/auth/service','../../config/environment','./condition.controller','put','/:id','isAuthenticated','update'];(function(_0x4b980d,_0x32fc6a){var _0x5c7974=function(_0x3b7af4){while(--_0x3b7af4){_0x4b980d['push'](_0x4b980d['shift']());}};_0x5c7974(++_0x32fc6a);}(_0x5f70,0x1a5));var _0x05f7=function(_0x552b92,_0x1e2e17){_0x552b92=_0x552b92-0x0;var _0x213901=_0x5f70[_0x552b92];return _0x213901;};'use strict';var multer=require(_0x05f7('0x0'));var util=require(_0x05f7('0x1'));var path=require('path');var timeout=require(_0x05f7('0x2'));var express=require(_0x05f7('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x05f7('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x05f7('0x5'));var controller=require(_0x05f7('0x6'));router[_0x05f7('0x7')](_0x05f7('0x8'),auth[_0x05f7('0x9')](),controller[_0x05f7('0xa')]);router['delete']('/:id',auth[_0x05f7('0x9')](),controller[_0x05f7('0xb')]);module['exports']=router; \ No newline at end of file +var _0xc4d4=['util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./condition.controller','put','/:id','update','delete','isAuthenticated'];(function(_0x17c9d6,_0xb95b04){var _0x68b7a2=function(_0x59468b){while(--_0x59468b){_0x17c9d6['push'](_0x17c9d6['shift']());}};_0x68b7a2(++_0xb95b04);}(_0xc4d4,0x193));var _0x4c4d=function(_0x554b32,_0x577efd){_0x554b32=_0x554b32-0x0;var _0x2d896d=_0xc4d4[_0x554b32];return _0x2d896d;};'use strict';var multer=require('multer');var util=require(_0x4c4d('0x0'));var path=require(_0x4c4d('0x1'));var timeout=require('connect-timeout');var express=require(_0x4c4d('0x2'));var router=express[_0x4c4d('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x4c4d('0x4'));var interaction=require(_0x4c4d('0x5'));var config=require(_0x4c4d('0x6'));var controller=require(_0x4c4d('0x7'));router[_0x4c4d('0x8')](_0x4c4d('0x9'),auth['isAuthenticated'](),controller[_0x4c4d('0xa')]);router[_0x4c4d('0xb')]('/:id',auth[_0x4c4d('0xc')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.attributes.js b/server/api/dashboard/dashboard.attributes.js index 21f2acf..7452045 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(_0x8e5431,_0xac0957){var _0x259c87=function(_0x3cd86c){while(--_0x3cd86c){_0x8e5431['push'](_0x8e5431['shift']());}};_0x259c87(++_0xac0957);}(_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 _0x757a=['exports','STRING'];(function(_0x2fac80,_0x285808){var _0xb6ad33=function(_0x129359){while(--_0x129359){_0x2fac80['push'](_0x2fac80['shift']());}};_0xb6ad33(++_0x285808);}(_0x757a,0xde));var _0xa757=function(_0x20c260,_0x4b21a2){_0x20c260=_0x20c260-0x0;var _0x2f22de=_0x757a[_0x20c260];return _0x2f22de;};'use strict';var Sequelize=require('sequelize');module[_0xa757('0x0')]={'name':{'type':Sequelize[_0xa757('0x1')],'allowNull':![],'unique':'name'},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.controller.js b/server/api/dashboard/dashboard.controller.js index f758e1b..90a8da5 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 _0x7963=['eml-format','rimraf','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','./dashboard.socket','sendStatus','status','undefined','limit','offset','count','set','Content-Range','json','apply','reject','save','update','then','destroy','get','end','error','stack','name','send','index','map','Dashboard','rawAttributes','fieldName','type','key','query','keys','filters','intersection','attributes','model','fields','length','order','sort','pick','filter','where','merge','options','includeAll','findAll','catch','show','include','create','body','user','role','CustomDashboards','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','params','find','omit','createdAt','updatedAt','UserProfileResource','iframe','attrUrl','attrs','value','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','attrMetric','total','attrVoiceQueues','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','reportType','attrRefresh','stringify','DashboardId','DashboardItem','getItems','hasOwnProperty','nolimit'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x7963,0x16e));var _0x3796=function(_0x19a49f,_0x444d74){_0x19a49f=_0x19a49f-0x0;var _0x5351ae=_0x7963[_0x19a49f];return _0x5351ae;};'use strict';var emlformat=require(_0x3796('0x0'));var rimraf=require(_0x3796('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x3796('0x2'));var moment=require('moment');var BPromise=require(_0x3796('0x3'));var Mustache=require('mustache');var util=require(_0x3796('0x4'));var path=require(_0x3796('0x5'));var sox=require(_0x3796('0x6'));var csv=require(_0x3796('0x7'));var ejs=require(_0x3796('0x8'));var fs=require('fs');var fs_extra=require(_0x3796('0x9'));var _=require(_0x3796('0xa'));var squel=require(_0x3796('0xb'));var crypto=require(_0x3796('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x3796('0xd'));var toCsv=require(_0x3796('0x7'));var querystring=require(_0x3796('0xe'));var Papa=require(_0x3796('0xf'));var Redis=require(_0x3796('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x3796('0x11'));var as=require(_0x3796('0x12'));var hardwareService=require(_0x3796('0x13'));var logger=require(_0x3796('0x14'))(_0x3796('0x15'));var utils=require(_0x3796('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x3796('0x17'));var db=require(_0x3796('0x18'))['db'];config[_0x3796('0x19')]=_[_0x3796('0x1a')](config['redis'],{'host':_0x3796('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3796('0x19')]));require(_0x3796('0x1c'))['register'](socket);function respondWithStatusCode(_0x2381dc,_0x3a6aeb){_0x3a6aeb=_0x3a6aeb||0xcc;return function(_0x345d02){if(_0x345d02){return _0x2381dc[_0x3796('0x1d')](_0x3a6aeb);}return _0x2381dc['status'](_0x3a6aeb)['end']();};}function respondWithResult(_0xc39772,_0x5fe2ab){_0x5fe2ab=_0x5fe2ab||0xc8;return function(_0x5d4131){if(_0x5d4131){return _0xc39772[_0x3796('0x1e')](_0x5fe2ab)['json'](_0x5d4131);}};}function respondWithFilteredResult(_0x267e3e,_0x49f139){return function(_0x3aa884){if(_0x3aa884){var _0x53bb2a=typeof _0x49f139['offset']===_0x3796('0x1f')&&typeof _0x49f139[_0x3796('0x20')]==='undefined';var _0x9894b0=_0x3aa884['count'];var _0x378eba=_0x53bb2a?0x0:_0x49f139[_0x3796('0x21')];var _0x53209c=_0x53bb2a?_0x3aa884[_0x3796('0x22')]:_0x49f139['offset']+_0x49f139[_0x3796('0x20')];var _0x5cd491;if(_0x53209c>=_0x9894b0){_0x53209c=_0x9894b0;_0x5cd491=0xc8;}else{_0x5cd491=0xce;}_0x267e3e['status'](_0x5cd491);return _0x267e3e[_0x3796('0x23')](_0x3796('0x24'),_0x378eba+'-'+_0x53209c+'/'+_0x9894b0)[_0x3796('0x25')](_0x3aa884);}return null;};}function patchUpdates(_0x4c9194){return function(_0x13b17c){try{jsonpatch[_0x3796('0x26')](_0x13b17c,_0x4c9194,!![]);}catch(_0x2a7923){return BPromise[_0x3796('0x27')](_0x2a7923);}return _0x13b17c[_0x3796('0x28')]();};}function saveUpdates(_0x57163c,_0x4dc53d){return function(_0xb933fa){if(_0xb933fa){return _0xb933fa[_0x3796('0x29')](_0x57163c)[_0x3796('0x2a')](function(_0x2cd1ff){return _0x2cd1ff;});}return null;};}function removeEntity(_0x58b6e1,_0x310828){return function(_0x1664e5){if(_0x1664e5){return _0x1664e5[_0x3796('0x2b')]()[_0x3796('0x2a')](function(){var _0x3a6072=_0x1664e5[_0x3796('0x2c')]({'plain':!![]});var _0x32289c='CustomDashboards';return db['UserProfileResource'][_0x3796('0x2b')]({'where':{'type':_0x32289c,'resourceId':_0x3a6072['id']}})[_0x3796('0x2a')](function(){return _0x1664e5;});})[_0x3796('0x2a')](function(){_0x58b6e1[_0x3796('0x1e')](0xcc)[_0x3796('0x2d')]();});}};}function handleEntityNotFound(_0x2c54a1,_0x1aa4f3){return function(_0x4dfe73){if(!_0x4dfe73){_0x2c54a1[_0x3796('0x1d')](0x194);}return _0x4dfe73;};}function handleError(_0x2eb360,_0x2c660c){_0x2c660c=_0x2c660c||0x1f4;return function(_0x37ba2f){logger[_0x3796('0x2e')](_0x37ba2f[_0x3796('0x2f')]);if(_0x37ba2f[_0x3796('0x30')]){delete _0x37ba2f['name'];}_0x2eb360['status'](_0x2c660c)[_0x3796('0x31')](_0x37ba2f);};}exports[_0x3796('0x32')]=function(_0x506df2,_0x92d377){var _0xb018f1={},_0x5b17da={},_0x13148d={'count':0x0,'rows':[]};var _0x16b034=_[_0x3796('0x33')](db[_0x3796('0x34')][_0x3796('0x35')],function(_0x368090){return{'name':_0x368090[_0x3796('0x36')],'type':_0x368090[_0x3796('0x37')][_0x3796('0x38')]};});_0x5b17da['model']=_[_0x3796('0x33')](_0x16b034,_0x3796('0x30'));_0x5b17da[_0x3796('0x39')]=_[_0x3796('0x3a')](_0x506df2[_0x3796('0x39')]);_0x5b17da[_0x3796('0x3b')]=_[_0x3796('0x3c')](_0x5b17da['model'],_0x5b17da[_0x3796('0x39')]);_0xb018f1[_0x3796('0x3d')]=_[_0x3796('0x3c')](_0x5b17da[_0x3796('0x3e')],qs[_0x3796('0x3f')](_0x506df2['query'][_0x3796('0x3f')]));_0xb018f1[_0x3796('0x3d')]=_0xb018f1[_0x3796('0x3d')][_0x3796('0x40')]?_0xb018f1[_0x3796('0x3d')]:_0x5b17da[_0x3796('0x3e')];if(!_0x506df2['query']['hasOwnProperty']('nolimit')){_0xb018f1[_0x3796('0x20')]=qs[_0x3796('0x20')](_0x506df2['query'][_0x3796('0x20')]);_0xb018f1[_0x3796('0x21')]=qs['offset'](_0x506df2['query'][_0x3796('0x21')]);}_0xb018f1[_0x3796('0x41')]=qs[_0x3796('0x42')](_0x506df2['query'][_0x3796('0x42')]);_0xb018f1['where']=qs[_0x3796('0x3b')](_[_0x3796('0x43')](_0x506df2['query'],_0x5b17da[_0x3796('0x3b')]),_0x16b034);if(_0x506df2['query'][_0x3796('0x44')]){_0xb018f1[_0x3796('0x45')]=_[_0x3796('0x46')](_0xb018f1['where'],{'$or':_[_0x3796('0x33')](_0x16b034,function(_0x216420){if(_0x216420[_0x3796('0x37')]!=='VIRTUAL'){var _0x465658={};_0x465658[_0x216420[_0x3796('0x30')]]={'$like':'%'+_0x506df2[_0x3796('0x39')][_0x3796('0x44')]+'%'};return _0x465658;}})});}_0xb018f1=_[_0x3796('0x46')]({},_0xb018f1,_0x506df2[_0x3796('0x47')]);var _0x489615={'where':_0xb018f1['where']};return db[_0x3796('0x34')]['count'](_0x489615)[_0x3796('0x2a')](function(_0xcb6b77){_0x13148d[_0x3796('0x22')]=_0xcb6b77;if(_0x506df2['query'][_0x3796('0x48')]){_0xb018f1['include']=[{'all':!![]}];}return db[_0x3796('0x34')][_0x3796('0x49')](_0xb018f1);})['then'](function(_0x1c2190){_0x13148d['rows']=_0x1c2190;return _0x13148d;})[_0x3796('0x2a')](respondWithFilteredResult(_0x92d377,_0xb018f1))[_0x3796('0x4a')](handleError(_0x92d377,null));};exports[_0x3796('0x4b')]=function(_0x243e97,_0x436ca0){var _0x476271={'raw':![],'where':{'id':_0x243e97['params']['id']}},_0x140366={};_0x140366[_0x3796('0x3e')]=_['keys'](db[_0x3796('0x34')][_0x3796('0x35')]);_0x140366['query']=_['keys'](_0x243e97[_0x3796('0x39')]);_0x140366[_0x3796('0x3b')]=_['intersection'](_0x140366[_0x3796('0x3e')],_0x140366[_0x3796('0x39')]);_0x476271['attributes']=_[_0x3796('0x3c')](_0x140366[_0x3796('0x3e')],qs[_0x3796('0x3f')](_0x243e97[_0x3796('0x39')][_0x3796('0x3f')]));_0x476271[_0x3796('0x3d')]=_0x476271[_0x3796('0x3d')][_0x3796('0x40')]?_0x476271[_0x3796('0x3d')]:_0x140366[_0x3796('0x3e')];if(_0x243e97[_0x3796('0x39')][_0x3796('0x48')]){_0x476271[_0x3796('0x4c')]=[{'all':!![]}];}_0x476271=_[_0x3796('0x46')]({},_0x476271,_0x243e97[_0x3796('0x47')]);return db['Dashboard']['find'](_0x476271)[_0x3796('0x2a')](handleEntityNotFound(_0x436ca0,null))[_0x3796('0x2a')](respondWithResult(_0x436ca0,null))['catch'](handleError(_0x436ca0,null));};exports[_0x3796('0x4d')]=function(_0x17494b,_0x391515){return db[_0x3796('0x34')]['create'](_0x17494b[_0x3796('0x4e')],{})[_0x3796('0x2a')](function(_0x275604){var _0x232452=_0x17494b[_0x3796('0x4f')][_0x3796('0x2c')]({'plain':!![]});if(!_0x232452)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x232452[_0x3796('0x50')]===_0x3796('0x4f')){var _0x2f80c6=_0x275604[_0x3796('0x2c')]({'plain':!![]});var _0x1f40a7=_0x3796('0x51');return db[_0x3796('0x52')]['find']({'where':{'name':_0x1f40a7,'userProfileId':_0x232452[_0x3796('0x53')]},'raw':!![]})[_0x3796('0x2a')](function(_0x4fc39c){if(_0x4fc39c&&_0x4fc39c[_0x3796('0x54')]===0x0){return db['UserProfileResource'][_0x3796('0x4d')]({'name':_0x2f80c6[_0x3796('0x30')],'resourceId':_0x2f80c6['id'],'type':_0x4fc39c[_0x3796('0x30')],'sectionId':_0x4fc39c['id']},{})[_0x3796('0x2a')](function(){return _0x275604;});}else{return _0x275604;}})['catch'](function(_0x405072){logger[_0x3796('0x2e')](_0x3796('0x55'),_0x405072);throw _0x405072;});}return _0x275604;})[_0x3796('0x2a')](respondWithResult(_0x391515,0xc9))['catch'](handleError(_0x391515,null));};exports[_0x3796('0x56')]=function(_0x1c9c83,_0x5539d9){var _0xfabea3={'where':{'id':_0x1c9c83[_0x3796('0x57')]['id']}},_0x530dee={};_0x530dee[_0x3796('0x3e')]=_[_0x3796('0x3a')](db[_0x3796('0x34')][_0x3796('0x35')]);_0xfabea3[_0x3796('0x3d')]=_[_0x3796('0x3c')](_0x530dee[_0x3796('0x3e')],qs[_0x3796('0x3f')](_0x1c9c83[_0x3796('0x39')]['fields']));_0xfabea3[_0x3796('0x3d')]=_0xfabea3[_0x3796('0x3d')][_0x3796('0x40')]?_0xfabea3[_0x3796('0x3d')]:_0x530dee[_0x3796('0x3e')];if(_0x1c9c83['query']['includeAll']){_0xfabea3['include']=[{'all':!![]}];}_0xfabea3=_['merge']({},_0xfabea3,_0x1c9c83['options']);return db[_0x3796('0x34')][_0x3796('0x58')](_0xfabea3)['then'](handleEntityNotFound(_0x5539d9,null))[_0x3796('0x2a')](function(_0x5ac90b){if(_0x5ac90b){var _0x488dae=_0x5ac90b[_0x3796('0x2c')]({'plain':!![]});_0x488dae=qs[_0x3796('0x59')](_0x488dae,['id',_0x3796('0x5a'),_0x3796('0x5b')]);_0x1c9c83[_0x3796('0x4e')]=_[_0x3796('0x59')](_0x1c9c83[_0x3796('0x4e')],['id',_0x3796('0x5a'),_0x3796('0x5b')]);return db[_0x3796('0x34')][_0x3796('0x4d')](_['merge'](_0x488dae,_0x1c9c83['body']),{'include':_0x1c9c83[_0x3796('0x39')][_0x3796('0x48')]?[{'all':!![]}]:undefined})['then'](function(_0x418250){var _0x1f780c=_0x1c9c83[_0x3796('0x4f')]['get']({'plain':!![]});if(!_0x1f780c)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1f780c['role']===_0x3796('0x4f')){var _0x1a1d4e=_0x418250[_0x3796('0x2c')]({'plain':!![]});var _0x6d5d0c='CustomDashboards';return db[_0x3796('0x52')][_0x3796('0x58')]({'where':{'name':_0x6d5d0c,'userProfileId':_0x1f780c['userProfileId']},'raw':!![]})[_0x3796('0x2a')](function(_0x4a5ed0){if(_0x4a5ed0&&_0x4a5ed0['autoAssociation']===0x0){return db[_0x3796('0x5c')][_0x3796('0x4d')]({'name':_0x1a1d4e[_0x3796('0x30')],'resourceId':_0x1a1d4e['id'],'type':_0x4a5ed0[_0x3796('0x30')],'sectionId':_0x4a5ed0['id']},{})[_0x3796('0x2a')](function(){return _0x418250;});}else{return _0x418250;}})['catch'](function(_0x1c842d){logger['error'](_0x3796('0x55'),_0x1c842d);throw _0x1c842d;});}return _0x418250;});}})[_0x3796('0x2a')](respondWithResult(_0x5539d9,0xc9))[_0x3796('0x4a')](handleError(_0x5539d9,null));};exports[_0x3796('0x29')]=function(_0x22356d,_0x5d0ffb){if(_0x22356d[_0x3796('0x4e')]['id']){delete _0x22356d[_0x3796('0x4e')]['id'];}return db[_0x3796('0x34')]['find']({'where':{'id':_0x22356d[_0x3796('0x57')]['id']}})[_0x3796('0x2a')](handleEntityNotFound(_0x5d0ffb,null))['then'](saveUpdates(_0x22356d[_0x3796('0x4e')],null))[_0x3796('0x2a')](respondWithResult(_0x5d0ffb,null))[_0x3796('0x4a')](handleError(_0x5d0ffb,null));};exports[_0x3796('0x2b')]=function(_0x16b512,_0x18f48f){return db[_0x3796('0x34')][_0x3796('0x58')]({'where':{'id':_0x16b512[_0x3796('0x57')]['id']}})['then'](handleEntityNotFound(_0x18f48f,null))['then'](removeEntity(_0x18f48f,null))[_0x3796('0x4a')](handleError(_0x18f48f,null));};function widgetAttributes(_0x4f2634){try{switch(_0x4f2634['type']){case _0x3796('0x5d'):return[{'name':_0x3796('0x5e'),'value':_0x4f2634['attrUrl']||(_0x4f2634[_0x3796('0x5f')]&&_0x4f2634[_0x3796('0x5f')][0x0]?_0x4f2634[_0x3796('0x5f')][0x0][_0x3796('0x60')]:undefined)||'https://'}];case'custom':return[{'name':_0x3796('0x61'),'value':_0x4f2634[_0x3796('0x61')]||(_0x4f2634[_0x3796('0x5f')]&&_0x4f2634[_0x3796('0x5f')][0x0]?_0x4f2634[_0x3796('0x5f')][0x0][_0x3796('0x60')]:undefined)||''}];case _0x3796('0x62'):return[{'name':_0x3796('0x63'),'value':_0x4f2634[_0x3796('0x63')]||(_0x4f2634[_0x3796('0x5f')]&&_0x4f2634[_0x3796('0x5f')][0x0]?_0x4f2634[_0x3796('0x5f')][0x0][_0x3796('0x60')]:undefined)||_0x3796('0x64')},{'name':_0x3796('0x65'),'value':_0x4f2634['attrTimezone']||(_0x4f2634['attrs']&&_0x4f2634['attrs'][0x1]?_0x4f2634['attrs'][0x1][_0x3796('0x60')]:undefined)||_0x3796('0x66')},{'name':_0x3796('0x67'),'value':_0x4f2634['attrFontSize']||(_0x4f2634[_0x3796('0x5f')]&&_0x4f2634[_0x3796('0x5f')][0x2]?_0x4f2634[_0x3796('0x5f')][0x2][_0x3796('0x60')]:undefined)||0xc}];case'counter':return[{'name':_0x3796('0x68'),'value':_0x4f2634[_0x3796('0x68')]||(_0x4f2634[_0x3796('0x5f')]&&_0x4f2634[_0x3796('0x5f')][0x0]?_0x4f2634[_0x3796('0x5f')][0x0][_0x3796('0x60')]:undefined)||_0x3796('0x69')},{'name':_0x3796('0x6a'),'value':_0x4f2634[_0x3796('0x6a')]||(_0x4f2634[_0x3796('0x5f')]&&_0x4f2634[_0x3796('0x5f')][0x1]?_0x4f2634[_0x3796('0x5f')][0x1][_0x3796('0x60')]:undefined)||[]},{'name':_0x3796('0x67'),'value':_0x4f2634[_0x3796('0x67')]||(_0x4f2634[_0x3796('0x5f')]&&_0x4f2634[_0x3796('0x5f')][0x2]?_0x4f2634[_0x3796('0x5f')][0x2][_0x3796('0x60')]:undefined)||0x14}];case _0x3796('0x6b'):case _0x3796('0x6c'):return[{'name':_0x3796('0x6d'),'value':_0x4f2634[_0x3796('0x6d')]||(_0x4f2634['attrs']&&_0x4f2634[_0x3796('0x5f')][0x0]?_0x4f2634[_0x3796('0x5f')][0x0]['value']:undefined)||_0x3796('0x69')},{'name':_0x3796('0x6e'),'value':_0x4f2634[_0x3796('0x6e')]||(_0x4f2634['attrs']&&_0x4f2634[_0x3796('0x5f')][0x1]?_0x4f2634[_0x3796('0x5f')][0x1][_0x3796('0x60')]:undefined)||null},{'name':_0x3796('0x6f'),'value':_0x4f2634['attrSerie3']||(_0x4f2634[_0x3796('0x5f')]&&_0x4f2634['attrs'][0x2]?_0x4f2634[_0x3796('0x5f')][0x2]['value']:undefined)||null},{'name':_0x3796('0x6a'),'value':_0x4f2634['attrVoiceQueues']||(_0x4f2634[_0x3796('0x5f')]&&_0x4f2634[_0x3796('0x5f')][0x3]?_0x4f2634[_0x3796('0x5f')][0x3][_0x3796('0x60')]:undefined)||[]}];case _0x3796('0x70'):return[{'name':_0x3796('0x71'),'type':_0x4f2634[_0x3796('0x72')]||(_0x4f2634['attrs']&&_0x4f2634['attrs'][0x0]?_0x4f2634[_0x3796('0x5f')][0x0]['type']:undefined)||null,'value':_0x4f2634[_0x3796('0x71')]||(_0x4f2634[_0x3796('0x5f')]&&_0x4f2634[_0x3796('0x5f')][0x0]?_0x4f2634[_0x3796('0x5f')][0x0][_0x3796('0x60')]:undefined)||null},{'name':_0x3796('0x73'),'value':_0x4f2634['attrRefresh']||(_0x4f2634[_0x3796('0x5f')]&&_0x4f2634[_0x3796('0x5f')][0x1]?_0x4f2634[_0x3796('0x5f')][0x1][_0x3796('0x60')]:undefined)||0x0}];default:return[];}}catch(_0x4d14a0){logger[_0x3796('0x2e')]('widgetAttributes:\x20%s',JSON[_0x3796('0x74')](_0x4d14a0));return[];}}exports['addItem']=function(_0x5d8474,_0x2dbbf3,_0x5c9483){if(_0x5d8474[_0x3796('0x4e')]['id']){delete _0x5d8474['body']['id'];}return db[_0x3796('0x34')]['find']({'where':{'id':_0x5d8474[_0x3796('0x57')]['id']}})[_0x3796('0x2a')](handleEntityNotFound(_0x2dbbf3,null))['then'](function(_0x4f3f8c){if(_0x4f3f8c){_0x5d8474['body'][_0x3796('0x75')]=_0x4f3f8c['id'];_0x5d8474[_0x3796('0x4e')]['attrs']=widgetAttributes(_0x5d8474[_0x3796('0x4e')]);return db[_0x3796('0x76')]['create'](_0x5d8474['body']);}})['then'](respondWithResult(_0x2dbbf3,null))[_0x3796('0x4a')](handleError(_0x2dbbf3,null));};exports[_0x3796('0x77')]=function(_0x30cd0f,_0x6cbfed,_0x1190b4){var _0x3a0720={};var _0x4825f0={};var _0x673e87;var _0x12889d;return db[_0x3796('0x34')]['findOne']({'where':{'id':_0x30cd0f[_0x3796('0x57')]['id']}})[_0x3796('0x2a')](handleEntityNotFound(_0x6cbfed,null))[_0x3796('0x2a')](function(_0xdfe1d4){if(_0xdfe1d4){_0x673e87=_0xdfe1d4;_0x4825f0['model']=_[_0x3796('0x3a')](db[_0x3796('0x76')][_0x3796('0x35')]);_0x4825f0[_0x3796('0x39')]=_[_0x3796('0x3a')](_0x30cd0f[_0x3796('0x39')]);_0x4825f0[_0x3796('0x3b')]=_[_0x3796('0x3c')](_0x4825f0[_0x3796('0x3e')],_0x4825f0['query']);_0x3a0720['attributes']=_[_0x3796('0x3c')](_0x4825f0[_0x3796('0x3e')],qs['fields'](_0x30cd0f[_0x3796('0x39')]['fields']));_0x3a0720[_0x3796('0x3d')]=_0x3a0720['attributes'][_0x3796('0x40')]?_0x3a0720[_0x3796('0x3d')]:_0x4825f0[_0x3796('0x3e')];_0x3a0720[_0x3796('0x41')]=qs['sort'](_0x30cd0f['query'][_0x3796('0x42')]);_0x3a0720[_0x3796('0x45')]=qs['filters'](_[_0x3796('0x43')](_0x30cd0f[_0x3796('0x39')],_0x4825f0[_0x3796('0x3b')]));if(_0x30cd0f['query'][_0x3796('0x44')]){_0x3a0720[_0x3796('0x45')]=_['merge'](_0x3a0720[_0x3796('0x45')],{'$or':_[_0x3796('0x33')](_0x3a0720[_0x3796('0x3d')],function(_0x3568fc){var _0x1f04f9={};_0x1f04f9[_0x3568fc]={'$like':'%'+_0x30cd0f['query'][_0x3796('0x44')]+'%'};return _0x1f04f9;})});}_0x3a0720=_[_0x3796('0x46')]({},_0x3a0720,_0x30cd0f['options']);return _0x673e87[_0x3796('0x77')](_0x3a0720);}})['then'](function(_0x307b65){if(_0x307b65){_0x12889d=_0x307b65['length'];if(!_0x30cd0f[_0x3796('0x39')][_0x3796('0x78')](_0x3796('0x79'))){_0x3a0720[_0x3796('0x20')]=qs[_0x3796('0x20')](_0x30cd0f[_0x3796('0x39')][_0x3796('0x20')]);_0x3a0720[_0x3796('0x21')]=qs[_0x3796('0x21')](_0x30cd0f[_0x3796('0x39')][_0x3796('0x21')]);}return _0x673e87[_0x3796('0x77')](_0x3a0720);}})[_0x3796('0x2a')](function(_0xa6cf7a){if(_0xa6cf7a){return _0xa6cf7a?{'count':_0x12889d,'rows':_0xa6cf7a}:null;}})[_0x3796('0x2a')](respondWithResult(_0x6cbfed,null))[_0x3796('0x4a')](handleError(_0x6cbfed,null));}; \ No newline at end of file +var _0xec3f=['body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','createdAt','updatedAt','omit','iframe','attrUrl','attrs','value','https://','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','attrReport','reportType','attrRefresh','stringify','DashboardId','DashboardItem','getItems','findOne','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','sox','ejs','fs-extra','crypto','jsforce','desk.js','to-csv','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./dashboard.socket','json','offset','limit','undefined','count','status','apply','reject','update','destroy','then','get','CustomDashboards','UserProfileResource','end','sendStatus','error','name','send','index','map','Dashboard','fieldName','type','model','query','intersection','fields','attributes','length','nolimit','order','sort','where','filters','pick','VIRTUAL','filter','rows','show','params','keys','rawAttributes','includeAll','include','merge','options','find','catch','create'];(function(_0x58547b,_0x4b89c2){var _0x1d3fd2=function(_0x4ac500){while(--_0x4ac500){_0x58547b['push'](_0x58547b['shift']());}};_0x1d3fd2(++_0x4b89c2);}(_0xec3f,0xa0));var _0xfec3=function(_0x1425b9,_0xfa7115){_0x1425b9=_0x1425b9-0x0;var _0x37d4ef=_0xec3f[_0x1425b9];return _0x37d4ef;};'use strict';var emlformat=require(_0xfec3('0x0'));var rimraf=require(_0xfec3('0x1'));var zipdir=require(_0xfec3('0x2'));var jsonpatch=require(_0xfec3('0x3'));var rp=require('request-promise');var moment=require(_0xfec3('0x4'));var BPromise=require(_0xfec3('0x5'));var Mustache=require(_0xfec3('0x6'));var util=require('util');var path=require('path');var sox=require(_0xfec3('0x7'));var csv=require('to-csv');var ejs=require(_0xfec3('0x8'));var fs=require('fs');var fs_extra=require(_0xfec3('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xfec3('0xa'));var jsforce=require(_0xfec3('0xb'));var deskjs=require(_0xfec3('0xc'));var toCsv=require(_0xfec3('0xd'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xfec3('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xfec3('0xf'));var as=require(_0xfec3('0x10'));var hardwareService=require(_0xfec3('0x11'));var logger=require(_0xfec3('0x12'))('api');var utils=require(_0xfec3('0x13'));var config=require(_0xfec3('0x14'));var licenseUtil=require(_0xfec3('0x15'));var db=require(_0xfec3('0x16'))['db'];config[_0xfec3('0x17')]=_[_0xfec3('0x18')](config['redis'],{'host':_0xfec3('0x19'),'port':0x18eb});var socket=require(_0xfec3('0x1a'))(new Redis(config[_0xfec3('0x17')]));require(_0xfec3('0x1b'))['register'](socket);function respondWithStatusCode(_0x1916ec,_0x27626e){_0x27626e=_0x27626e||0xcc;return function(_0x271f5d){if(_0x271f5d){return _0x1916ec['sendStatus'](_0x27626e);}return _0x1916ec['status'](_0x27626e)['end']();};}function respondWithResult(_0x53ea49,_0xc74b78){_0xc74b78=_0xc74b78||0xc8;return function(_0x4d861e){if(_0x4d861e){return _0x53ea49['status'](_0xc74b78)[_0xfec3('0x1c')](_0x4d861e);}};}function respondWithFilteredResult(_0x1186fe,_0x43d2ee){return function(_0x47087c){if(_0x47087c){var _0x586b26=typeof _0x43d2ee[_0xfec3('0x1d')]==='undefined'&&typeof _0x43d2ee[_0xfec3('0x1e')]===_0xfec3('0x1f');var _0x19701b=_0x47087c[_0xfec3('0x20')];var _0x4b17da=_0x586b26?0x0:_0x43d2ee['offset'];var _0x594901=_0x586b26?_0x47087c[_0xfec3('0x20')]:_0x43d2ee[_0xfec3('0x1d')]+_0x43d2ee[_0xfec3('0x1e')];var _0x4d31eb;if(_0x594901>=_0x19701b){_0x594901=_0x19701b;_0x4d31eb=0xc8;}else{_0x4d31eb=0xce;}_0x1186fe[_0xfec3('0x21')](_0x4d31eb);return _0x1186fe['set']('Content-Range',_0x4b17da+'-'+_0x594901+'/'+_0x19701b)['json'](_0x47087c);}return null;};}function patchUpdates(_0x47b82a){return function(_0x185b73){try{jsonpatch[_0xfec3('0x22')](_0x185b73,_0x47b82a,!![]);}catch(_0x536aaf){return BPromise[_0xfec3('0x23')](_0x536aaf);}return _0x185b73['save']();};}function saveUpdates(_0x146957,_0x453bf5){return function(_0x3416cd){if(_0x3416cd){return _0x3416cd[_0xfec3('0x24')](_0x146957)['then'](function(_0x5a59db){return _0x5a59db;});}return null;};}function removeEntity(_0x560081,_0x24b3ed){return function(_0x6e8f6d){if(_0x6e8f6d){return _0x6e8f6d[_0xfec3('0x25')]()[_0xfec3('0x26')](function(){var _0x428a93=_0x6e8f6d[_0xfec3('0x27')]({'plain':!![]});var _0x3c9104=_0xfec3('0x28');return db[_0xfec3('0x29')][_0xfec3('0x25')]({'where':{'type':_0x3c9104,'resourceId':_0x428a93['id']}})['then'](function(){return _0x6e8f6d;});})['then'](function(){_0x560081['status'](0xcc)[_0xfec3('0x2a')]();});}};}function handleEntityNotFound(_0x2d80ab,_0x19d45b){return function(_0x2526ae){if(!_0x2526ae){_0x2d80ab[_0xfec3('0x2b')](0x194);}return _0x2526ae;};}function handleError(_0x1402fc,_0x1ca58d){_0x1ca58d=_0x1ca58d||0x1f4;return function(_0x28855d){logger[_0xfec3('0x2c')](_0x28855d['stack']);if(_0x28855d[_0xfec3('0x2d')]){delete _0x28855d[_0xfec3('0x2d')];}_0x1402fc[_0xfec3('0x21')](_0x1ca58d)[_0xfec3('0x2e')](_0x28855d);};}exports[_0xfec3('0x2f')]=function(_0x487a82,_0x55e866){var _0x69155={},_0x1bf29d={},_0x58b7b0={'count':0x0,'rows':[]};var _0x4a4542=_[_0xfec3('0x30')](db[_0xfec3('0x31')]['rawAttributes'],function(_0x48d026){return{'name':_0x48d026[_0xfec3('0x32')],'type':_0x48d026[_0xfec3('0x33')]['key']};});_0x1bf29d[_0xfec3('0x34')]=_[_0xfec3('0x30')](_0x4a4542,_0xfec3('0x2d'));_0x1bf29d[_0xfec3('0x35')]=_['keys'](_0x487a82['query']);_0x1bf29d['filters']=_[_0xfec3('0x36')](_0x1bf29d[_0xfec3('0x34')],_0x1bf29d['query']);_0x69155['attributes']=_['intersection'](_0x1bf29d['model'],qs[_0xfec3('0x37')](_0x487a82[_0xfec3('0x35')][_0xfec3('0x37')]));_0x69155[_0xfec3('0x38')]=_0x69155[_0xfec3('0x38')][_0xfec3('0x39')]?_0x69155[_0xfec3('0x38')]:_0x1bf29d[_0xfec3('0x34')];if(!_0x487a82[_0xfec3('0x35')]['hasOwnProperty'](_0xfec3('0x3a'))){_0x69155[_0xfec3('0x1e')]=qs[_0xfec3('0x1e')](_0x487a82[_0xfec3('0x35')][_0xfec3('0x1e')]);_0x69155['offset']=qs['offset'](_0x487a82[_0xfec3('0x35')]['offset']);}_0x69155[_0xfec3('0x3b')]=qs[_0xfec3('0x3c')](_0x487a82[_0xfec3('0x35')][_0xfec3('0x3c')]);_0x69155[_0xfec3('0x3d')]=qs[_0xfec3('0x3e')](_[_0xfec3('0x3f')](_0x487a82[_0xfec3('0x35')],_0x1bf29d[_0xfec3('0x3e')]),_0x4a4542);if(_0x487a82[_0xfec3('0x35')]['filter']){_0x69155[_0xfec3('0x3d')]=_['merge'](_0x69155['where'],{'$or':_[_0xfec3('0x30')](_0x4a4542,function(_0x1a0523){if(_0x1a0523[_0xfec3('0x33')]!==_0xfec3('0x40')){var _0x4bee9b={};_0x4bee9b[_0x1a0523['name']]={'$like':'%'+_0x487a82[_0xfec3('0x35')][_0xfec3('0x41')]+'%'};return _0x4bee9b;}})});}_0x69155=_['merge']({},_0x69155,_0x487a82['options']);var _0x4ca9ef={'where':_0x69155[_0xfec3('0x3d')]};return db[_0xfec3('0x31')][_0xfec3('0x20')](_0x4ca9ef)['then'](function(_0x2a671d){_0x58b7b0[_0xfec3('0x20')]=_0x2a671d;if(_0x487a82[_0xfec3('0x35')]['includeAll']){_0x69155['include']=[{'all':!![]}];}return db[_0xfec3('0x31')]['findAll'](_0x69155);})['then'](function(_0x2f0336){_0x58b7b0[_0xfec3('0x42')]=_0x2f0336;return _0x58b7b0;})[_0xfec3('0x26')](respondWithFilteredResult(_0x55e866,_0x69155))['catch'](handleError(_0x55e866,null));};exports[_0xfec3('0x43')]=function(_0x6a4123,_0x3468c8){var _0x14a60a={'raw':![],'where':{'id':_0x6a4123[_0xfec3('0x44')]['id']}},_0xda345b={};_0xda345b[_0xfec3('0x34')]=_[_0xfec3('0x45')](db['Dashboard'][_0xfec3('0x46')]);_0xda345b[_0xfec3('0x35')]=_['keys'](_0x6a4123[_0xfec3('0x35')]);_0xda345b[_0xfec3('0x3e')]=_[_0xfec3('0x36')](_0xda345b['model'],_0xda345b[_0xfec3('0x35')]);_0x14a60a[_0xfec3('0x38')]=_[_0xfec3('0x36')](_0xda345b[_0xfec3('0x34')],qs[_0xfec3('0x37')](_0x6a4123['query']['fields']));_0x14a60a['attributes']=_0x14a60a[_0xfec3('0x38')][_0xfec3('0x39')]?_0x14a60a[_0xfec3('0x38')]:_0xda345b[_0xfec3('0x34')];if(_0x6a4123['query'][_0xfec3('0x47')]){_0x14a60a[_0xfec3('0x48')]=[{'all':!![]}];}_0x14a60a=_[_0xfec3('0x49')]({},_0x14a60a,_0x6a4123[_0xfec3('0x4a')]);return db[_0xfec3('0x31')][_0xfec3('0x4b')](_0x14a60a)[_0xfec3('0x26')](handleEntityNotFound(_0x3468c8,null))[_0xfec3('0x26')](respondWithResult(_0x3468c8,null))[_0xfec3('0x4c')](handleError(_0x3468c8,null));};exports['create']=function(_0x45ce0f,_0xce3cea){return db[_0xfec3('0x31')][_0xfec3('0x4d')](_0x45ce0f[_0xfec3('0x4e')],{})[_0xfec3('0x26')](function(_0x4a72cf){var _0x2abd1d=_0x45ce0f[_0xfec3('0x4f')]['get']({'plain':!![]});if(!_0x2abd1d)throw new Error(_0xfec3('0x50'));if(_0x2abd1d[_0xfec3('0x51')]===_0xfec3('0x4f')){var _0x3924a4=_0x4a72cf[_0xfec3('0x27')]({'plain':!![]});var _0x48730c='CustomDashboards';return db[_0xfec3('0x52')][_0xfec3('0x4b')]({'where':{'name':_0x48730c,'userProfileId':_0x2abd1d[_0xfec3('0x53')]},'raw':!![]})[_0xfec3('0x26')](function(_0x5c78f7){if(_0x5c78f7&&_0x5c78f7[_0xfec3('0x54')]===0x0){return db['UserProfileResource']['create']({'name':_0x3924a4[_0xfec3('0x2d')],'resourceId':_0x3924a4['id'],'type':_0x5c78f7['name'],'sectionId':_0x5c78f7['id']},{})[_0xfec3('0x26')](function(){return _0x4a72cf;});}else{return _0x4a72cf;}})[_0xfec3('0x4c')](function(_0x5df0ba){logger[_0xfec3('0x2c')](_0xfec3('0x55'),_0x5df0ba);throw _0x5df0ba;});}return _0x4a72cf;})[_0xfec3('0x26')](respondWithResult(_0xce3cea,0xc9))[_0xfec3('0x4c')](handleError(_0xce3cea,null));};exports[_0xfec3('0x56')]=function(_0x595051,_0x516651){var _0x46c6b1={'where':{'id':_0x595051[_0xfec3('0x44')]['id']}},_0x47b3e3={};_0x47b3e3['model']=_[_0xfec3('0x45')](db[_0xfec3('0x31')]['rawAttributes']);_0x46c6b1['attributes']=_[_0xfec3('0x36')](_0x47b3e3['model'],qs[_0xfec3('0x37')](_0x595051[_0xfec3('0x35')][_0xfec3('0x37')]));_0x46c6b1['attributes']=_0x46c6b1[_0xfec3('0x38')]['length']?_0x46c6b1[_0xfec3('0x38')]:_0x47b3e3[_0xfec3('0x34')];if(_0x595051[_0xfec3('0x35')][_0xfec3('0x47')]){_0x46c6b1[_0xfec3('0x48')]=[{'all':!![]}];}_0x46c6b1=_[_0xfec3('0x49')]({},_0x46c6b1,_0x595051['options']);return db[_0xfec3('0x31')][_0xfec3('0x4b')](_0x46c6b1)['then'](handleEntityNotFound(_0x516651,null))[_0xfec3('0x26')](function(_0x307a3e){if(_0x307a3e){var _0x66c7df=_0x307a3e[_0xfec3('0x27')]({'plain':!![]});_0x66c7df=qs['omit'](_0x66c7df,['id',_0xfec3('0x57'),_0xfec3('0x58')]);_0x595051[_0xfec3('0x4e')]=_[_0xfec3('0x59')](_0x595051['body'],['id',_0xfec3('0x57'),_0xfec3('0x58')]);return db[_0xfec3('0x31')][_0xfec3('0x4d')](_[_0xfec3('0x49')](_0x66c7df,_0x595051[_0xfec3('0x4e')]),{'include':_0x595051[_0xfec3('0x35')]['includeAll']?[{'all':!![]}]:undefined})['then'](function(_0x31e7fd){var _0x42a573=_0x595051[_0xfec3('0x4f')][_0xfec3('0x27')]({'plain':!![]});if(!_0x42a573)throw new Error(_0xfec3('0x50'));if(_0x42a573[_0xfec3('0x51')]===_0xfec3('0x4f')){var _0x4b15d6=_0x31e7fd['get']({'plain':!![]});var _0xdc7dae=_0xfec3('0x28');return db[_0xfec3('0x52')]['find']({'where':{'name':_0xdc7dae,'userProfileId':_0x42a573[_0xfec3('0x53')]},'raw':!![]})[_0xfec3('0x26')](function(_0x5c2f6c){if(_0x5c2f6c&&_0x5c2f6c['autoAssociation']===0x0){return db[_0xfec3('0x29')][_0xfec3('0x4d')]({'name':_0x4b15d6[_0xfec3('0x2d')],'resourceId':_0x4b15d6['id'],'type':_0x5c2f6c['name'],'sectionId':_0x5c2f6c['id']},{})[_0xfec3('0x26')](function(){return _0x31e7fd;});}else{return _0x31e7fd;}})[_0xfec3('0x4c')](function(_0x1f446f){logger[_0xfec3('0x2c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1f446f);throw _0x1f446f;});}return _0x31e7fd;});}})['then'](respondWithResult(_0x516651,0xc9))[_0xfec3('0x4c')](handleError(_0x516651,null));};exports[_0xfec3('0x24')]=function(_0x3fd123,_0x5f3262){if(_0x3fd123[_0xfec3('0x4e')]['id']){delete _0x3fd123[_0xfec3('0x4e')]['id'];}return db[_0xfec3('0x31')][_0xfec3('0x4b')]({'where':{'id':_0x3fd123[_0xfec3('0x44')]['id']}})[_0xfec3('0x26')](handleEntityNotFound(_0x5f3262,null))['then'](saveUpdates(_0x3fd123['body'],null))[_0xfec3('0x26')](respondWithResult(_0x5f3262,null))['catch'](handleError(_0x5f3262,null));};exports[_0xfec3('0x25')]=function(_0x5bf2ed,_0x31cfc8){return db[_0xfec3('0x31')][_0xfec3('0x4b')]({'where':{'id':_0x5bf2ed[_0xfec3('0x44')]['id']}})['then'](handleEntityNotFound(_0x31cfc8,null))[_0xfec3('0x26')](removeEntity(_0x31cfc8,null))[_0xfec3('0x4c')](handleError(_0x31cfc8,null));};function widgetAttributes(_0x29b7d7){try{switch(_0x29b7d7[_0xfec3('0x33')]){case _0xfec3('0x5a'):return[{'name':_0xfec3('0x5b'),'value':_0x29b7d7[_0xfec3('0x5b')]||(_0x29b7d7[_0xfec3('0x5c')]&&_0x29b7d7[_0xfec3('0x5c')][0x0]?_0x29b7d7[_0xfec3('0x5c')][0x0][_0xfec3('0x5d')]:undefined)||_0xfec3('0x5e')}];case'custom':return[{'name':_0xfec3('0x5f'),'value':_0x29b7d7[_0xfec3('0x5f')]||(_0x29b7d7[_0xfec3('0x5c')]&&_0x29b7d7['attrs'][0x0]?_0x29b7d7['attrs'][0x0]['value']:undefined)||''}];case _0xfec3('0x60'):return[{'name':_0xfec3('0x61'),'value':_0x29b7d7[_0xfec3('0x61')]||(_0x29b7d7[_0xfec3('0x5c')]&&_0x29b7d7[_0xfec3('0x5c')][0x0]?_0x29b7d7[_0xfec3('0x5c')][0x0][_0xfec3('0x5d')]:undefined)||_0xfec3('0x62')},{'name':_0xfec3('0x63'),'value':_0x29b7d7['attrTimezone']||(_0x29b7d7[_0xfec3('0x5c')]&&_0x29b7d7[_0xfec3('0x5c')][0x1]?_0x29b7d7[_0xfec3('0x5c')][0x1]['value']:undefined)||_0xfec3('0x64')},{'name':_0xfec3('0x65'),'value':_0x29b7d7[_0xfec3('0x65')]||(_0x29b7d7[_0xfec3('0x5c')]&&_0x29b7d7['attrs'][0x2]?_0x29b7d7['attrs'][0x2][_0xfec3('0x5d')]:undefined)||0xc}];case _0xfec3('0x66'):return[{'name':_0xfec3('0x67'),'value':_0x29b7d7[_0xfec3('0x67')]||(_0x29b7d7['attrs']&&_0x29b7d7['attrs'][0x0]?_0x29b7d7[_0xfec3('0x5c')][0x0][_0xfec3('0x5d')]:undefined)||_0xfec3('0x68')},{'name':_0xfec3('0x69'),'value':_0x29b7d7[_0xfec3('0x69')]||(_0x29b7d7[_0xfec3('0x5c')]&&_0x29b7d7[_0xfec3('0x5c')][0x1]?_0x29b7d7['attrs'][0x1][_0xfec3('0x5d')]:undefined)||[]},{'name':_0xfec3('0x65'),'value':_0x29b7d7[_0xfec3('0x65')]||(_0x29b7d7[_0xfec3('0x5c')]&&_0x29b7d7[_0xfec3('0x5c')][0x2]?_0x29b7d7[_0xfec3('0x5c')][0x2][_0xfec3('0x5d')]:undefined)||0x14}];case _0xfec3('0x6a'):case _0xfec3('0x6b'):return[{'name':'attrSerie1','value':_0x29b7d7[_0xfec3('0x6c')]||(_0x29b7d7['attrs']&&_0x29b7d7[_0xfec3('0x5c')][0x0]?_0x29b7d7[_0xfec3('0x5c')][0x0][_0xfec3('0x5d')]:undefined)||_0xfec3('0x68')},{'name':'attrSerie2','value':_0x29b7d7[_0xfec3('0x6d')]||(_0x29b7d7[_0xfec3('0x5c')]&&_0x29b7d7['attrs'][0x1]?_0x29b7d7[_0xfec3('0x5c')][0x1][_0xfec3('0x5d')]:undefined)||null},{'name':_0xfec3('0x6e'),'value':_0x29b7d7[_0xfec3('0x6e')]||(_0x29b7d7['attrs']&&_0x29b7d7[_0xfec3('0x5c')][0x2]?_0x29b7d7[_0xfec3('0x5c')][0x2]['value']:undefined)||null},{'name':_0xfec3('0x69'),'value':_0x29b7d7['attrVoiceQueues']||(_0x29b7d7['attrs']&&_0x29b7d7[_0xfec3('0x5c')][0x3]?_0x29b7d7[_0xfec3('0x5c')][0x3][_0xfec3('0x5d')]:undefined)||[]}];case'web-report':return[{'name':_0xfec3('0x6f'),'type':_0x29b7d7[_0xfec3('0x70')]||(_0x29b7d7[_0xfec3('0x5c')]&&_0x29b7d7[_0xfec3('0x5c')][0x0]?_0x29b7d7[_0xfec3('0x5c')][0x0]['type']:undefined)||null,'value':_0x29b7d7[_0xfec3('0x6f')]||(_0x29b7d7[_0xfec3('0x5c')]&&_0x29b7d7['attrs'][0x0]?_0x29b7d7[_0xfec3('0x5c')][0x0][_0xfec3('0x5d')]:undefined)||null},{'name':_0xfec3('0x71'),'value':_0x29b7d7[_0xfec3('0x71')]||(_0x29b7d7[_0xfec3('0x5c')]&&_0x29b7d7[_0xfec3('0x5c')][0x1]?_0x29b7d7['attrs'][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0xda7743){logger[_0xfec3('0x2c')]('widgetAttributes:\x20%s',JSON[_0xfec3('0x72')](_0xda7743));return[];}}exports['addItem']=function(_0x344834,_0x247b06,_0x474326){if(_0x344834['body']['id']){delete _0x344834['body']['id'];}return db[_0xfec3('0x31')]['find']({'where':{'id':_0x344834['params']['id']}})[_0xfec3('0x26')](handleEntityNotFound(_0x247b06,null))['then'](function(_0x127dd8){if(_0x127dd8){_0x344834['body'][_0xfec3('0x73')]=_0x127dd8['id'];_0x344834[_0xfec3('0x4e')][_0xfec3('0x5c')]=widgetAttributes(_0x344834[_0xfec3('0x4e')]);return db[_0xfec3('0x74')][_0xfec3('0x4d')](_0x344834[_0xfec3('0x4e')]);}})[_0xfec3('0x26')](respondWithResult(_0x247b06,null))[_0xfec3('0x4c')](handleError(_0x247b06,null));};exports[_0xfec3('0x75')]=function(_0x22ce40,_0x5e025e,_0x2ae602){var _0x1809e4={};var _0x36f9d9={};var _0x48efd1;var _0x5ec2e6;return db[_0xfec3('0x31')][_0xfec3('0x76')]({'where':{'id':_0x22ce40[_0xfec3('0x44')]['id']}})[_0xfec3('0x26')](handleEntityNotFound(_0x5e025e,null))[_0xfec3('0x26')](function(_0x4af92d){if(_0x4af92d){_0x48efd1=_0x4af92d;_0x36f9d9['model']=_[_0xfec3('0x45')](db[_0xfec3('0x74')][_0xfec3('0x46')]);_0x36f9d9['query']=_[_0xfec3('0x45')](_0x22ce40[_0xfec3('0x35')]);_0x36f9d9[_0xfec3('0x3e')]=_['intersection'](_0x36f9d9[_0xfec3('0x34')],_0x36f9d9[_0xfec3('0x35')]);_0x1809e4[_0xfec3('0x38')]=_[_0xfec3('0x36')](_0x36f9d9[_0xfec3('0x34')],qs[_0xfec3('0x37')](_0x22ce40[_0xfec3('0x35')][_0xfec3('0x37')]));_0x1809e4['attributes']=_0x1809e4[_0xfec3('0x38')][_0xfec3('0x39')]?_0x1809e4['attributes']:_0x36f9d9[_0xfec3('0x34')];_0x1809e4[_0xfec3('0x3b')]=qs[_0xfec3('0x3c')](_0x22ce40[_0xfec3('0x35')][_0xfec3('0x3c')]);_0x1809e4[_0xfec3('0x3d')]=qs[_0xfec3('0x3e')](_[_0xfec3('0x3f')](_0x22ce40[_0xfec3('0x35')],_0x36f9d9[_0xfec3('0x3e')]));if(_0x22ce40[_0xfec3('0x35')]['filter']){_0x1809e4[_0xfec3('0x3d')]=_['merge'](_0x1809e4[_0xfec3('0x3d')],{'$or':_[_0xfec3('0x30')](_0x1809e4[_0xfec3('0x38')],function(_0x497efa){var _0x349b5e={};_0x349b5e[_0x497efa]={'$like':'%'+_0x22ce40[_0xfec3('0x35')]['filter']+'%'};return _0x349b5e;})});}_0x1809e4=_[_0xfec3('0x49')]({},_0x1809e4,_0x22ce40[_0xfec3('0x4a')]);return _0x48efd1['getItems'](_0x1809e4);}})[_0xfec3('0x26')](function(_0x3c7edb){if(_0x3c7edb){_0x5ec2e6=_0x3c7edb['length'];if(!_0x22ce40['query']['hasOwnProperty'](_0xfec3('0x3a'))){_0x1809e4[_0xfec3('0x1e')]=qs[_0xfec3('0x1e')](_0x22ce40['query'][_0xfec3('0x1e')]);_0x1809e4[_0xfec3('0x1d')]=qs[_0xfec3('0x1d')](_0x22ce40[_0xfec3('0x35')]['offset']);}return _0x48efd1[_0xfec3('0x75')](_0x1809e4);}})[_0xfec3('0x26')](function(_0x57227e){if(_0x57227e){return _0x57227e?{'count':_0x5ec2e6,'rows':_0x57227e}:null;}})['then'](respondWithResult(_0x5e025e,null))[_0xfec3('0x4c')](handleError(_0x5e025e,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index 4492269..4242c92 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 _0x2bbc=['remove','emit','hasOwnProperty','hook','events','../../mysqldb','Dashboard','setMaxListeners','update'];(function(_0x56039b,_0x3de8d8){var _0xc90792=function(_0x300c35){while(--_0x300c35){_0x56039b['push'](_0x56039b['shift']());}};_0xc90792(++_0x3de8d8);}(_0x2bbc,0x1ea));var _0xc2bb=function(_0x25c314,_0x4b0b63){_0x25c314=_0x25c314-0x0;var _0x4d335d=_0x2bbc[_0x25c314];return _0x4d335d;};'use strict';var EventEmitter=require(_0xc2bb('0x0'));var Dashboard=require(_0xc2bb('0x1'))['db'][_0xc2bb('0x2')];var DashboardEvents=new EventEmitter();DashboardEvents[_0xc2bb('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xc2bb('0x4'),'afterDestroy':_0xc2bb('0x5')};function emitEvent(_0x2b170c){return function(_0x407c7c,_0xe5ffb0,_0x3f9e2d){DashboardEvents['emit'](_0x2b170c+':'+_0x407c7c['id'],_0x407c7c);DashboardEvents[_0xc2bb('0x6')](_0x2b170c,_0x407c7c);_0x3f9e2d(null);};}for(var e in events){if(events[_0xc2bb('0x7')](e)){var event=events[e];Dashboard[_0xc2bb('0x8')](e,emitEvent(event));}}module['exports']=DashboardEvents; \ No newline at end of file +var _0x3ea2=['Dashboard','setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x538fd8,_0x24ed11){var _0x279fb4=function(_0x550563){while(--_0x550563){_0x538fd8['push'](_0x538fd8['shift']());}};_0x279fb4(++_0x24ed11);}(_0x3ea2,0x1d4));var _0x23ea=function(_0x2fb356,_0x567092){_0x2fb356=_0x2fb356-0x0;var _0x27fb4b=_0x3ea2[_0x2fb356];return _0x27fb4b;};'use strict';var EventEmitter=require(_0x23ea('0x0'));var Dashboard=require(_0x23ea('0x1'))['db'][_0x23ea('0x2')];var DashboardEvents=new EventEmitter();DashboardEvents[_0x23ea('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x23ea('0x4'),'afterDestroy':_0x23ea('0x5')};function emitEvent(_0x239a88){return function(_0x32d062,_0x5e1a61,_0x1b7557){DashboardEvents[_0x23ea('0x6')](_0x239a88+':'+_0x32d062['id'],_0x32d062);DashboardEvents[_0x23ea('0x6')](_0x239a88,_0x32d062);_0x1b7557(null);};}for(var e in events){if(events[_0x23ea('0x7')](e)){var event=events[e];Dashboard[_0x23ea('0x8')](e,emitEvent(event));}}module[_0x23ea('0x9')]=DashboardEvents; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.model.js b/server/api/dashboard/dashboard.model.js index 648220b..2b7543f 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 _0xad3b=['rimraf','../../config/environment','./dashboard.attributes','Dashboard','dashboards','util','../../config/logger','api','moment','request-promise','path'];(function(_0x46ed01,_0x5af9e6){var _0x809d68=function(_0x43c8b8){while(--_0x43c8b8){_0x46ed01['push'](_0x46ed01['shift']());}};_0x809d68(++_0x5af9e6);}(_0xad3b,0xec));var _0xbad3=function(_0x5463c2,_0x22c4cc){_0x5463c2=_0x5463c2-0x0;var _0x5a7da7=_0xad3b[_0x5463c2];return _0x5a7da7;};'use strict';var _=require('lodash');var util=require(_0xbad3('0x0'));var logger=require(_0xbad3('0x1'))(_0xbad3('0x2'));var moment=require(_0xbad3('0x3'));var BPromise=require('bluebird');var rp=require(_0xbad3('0x4'));var fs=require('fs');var path=require(_0xbad3('0x5'));var rimraf=require(_0xbad3('0x6'));var config=require(_0xbad3('0x7'));var attributes=require(_0xbad3('0x8'));module['exports']=function(_0x4e0a06,_0x477af0){return _0x4e0a06['define'](_0xbad3('0x9'),attributes,{'tableName':_0xbad3('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5000=['moment','bluebird','request-promise','path','rimraf','exports','define','Dashboard','dashboards','lodash','util','api'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x5000,0x1c5));var _0x0500=function(_0x52d5c6,_0x18dfc8){_0x52d5c6=_0x52d5c6-0x0;var _0x4a6334=_0x5000[_0x52d5c6];return _0x4a6334;};'use strict';var _=require(_0x0500('0x0'));var util=require(_0x0500('0x1'));var logger=require('../../config/logger')(_0x0500('0x2'));var moment=require(_0x0500('0x3'));var BPromise=require(_0x0500('0x4'));var rp=require(_0x0500('0x5'));var fs=require('fs');var path=require(_0x0500('0x6'));var rimraf=require(_0x0500('0x7'));var config=require('../../config/environment');var attributes=require('./dashboard.attributes');module[_0x0500('0x8')]=function(_0x5991af,_0x772836){return _0x5991af[_0x0500('0x9')](_0x0500('0xa'),attributes,{'tableName':_0x0500('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.rpc.js b/server/api/dashboard/dashboard.rpc.js index 96af295..7a7f7e8 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 _0xfb8f=['debug','stringify','error','code','message','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./dashboard.socket','request','info','Dashboard,\x20%s,\x20%s','request\x20sent'];(function(_0x4e7d25,_0x58285f){var _0x526fe6=function(_0x4f0aec){while(--_0x4f0aec){_0x4e7d25['push'](_0x4e7d25['shift']());}};_0x526fe6(++_0x58285f);}(_0xfb8f,0x18c));var _0xffb8=function(_0x5d952b,_0x395c8d){_0x5d952b=_0x5d952b-0x0;var _0xb8517a=_0xfb8f[_0x5d952b];return _0xb8517a;};'use strict';var _=require('lodash');var util=require(_0xffb8('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xffb8('0x1'));var fs=require('fs');var Redis=require(_0xffb8('0x2'));var db=require(_0xffb8('0x3'))['db'];var utils=require(_0xffb8('0x4'));var logger=require(_0xffb8('0x5'))('rpc');var config=require(_0xffb8('0x6'));var jayson=require(_0xffb8('0x7'));var client=jayson[_0xffb8('0x8')][_0xffb8('0x9')]({'port':0x232a});config['redis']=_['defaults'](config[_0xffb8('0xa')],{'host':_0xffb8('0xb'),'port':0x18eb});var socket=require(_0xffb8('0xc'))(new Redis(config[_0xffb8('0xa')]));require(_0xffb8('0xd'))['register'](socket);function respondWithRpcPromise(_0x4e3508,_0x3dbb54,_0x2fcc2f){return new BPromise(function(_0x1614b5,_0x2b2197){return client[_0xffb8('0xe')](_0x4e3508,_0x2fcc2f)['then'](function(_0x1eabeb){logger[_0xffb8('0xf')](_0xffb8('0x10'),_0x3dbb54,_0xffb8('0x11'));logger[_0xffb8('0x12')]('Dashboard,\x20%s,\x20%s,\x20%s',_0x3dbb54,_0xffb8('0x11'),JSON[_0xffb8('0x13')](_0x1eabeb));if(_0x1eabeb[_0xffb8('0x14')]){if(_0x1eabeb['error'][_0xffb8('0x15')]===0x1f4){logger['error']('Dashboard,\x20%s,\x20%s',_0x3dbb54,_0x1eabeb[_0xffb8('0x14')][_0xffb8('0x16')]);return _0x2b2197(_0x1eabeb[_0xffb8('0x14')][_0xffb8('0x16')]);}logger[_0xffb8('0x14')](_0xffb8('0x10'),_0x3dbb54,_0x1eabeb[_0xffb8('0x14')][_0xffb8('0x16')]);return _0x1614b5(_0x1eabeb[_0xffb8('0x14')]['message']);}else{logger['info'](_0xffb8('0x10'),_0x3dbb54,'request\x20sent');_0x1614b5(_0x1eabeb['result']['message']);}})['catch'](function(_0x377463){logger[_0xffb8('0x14')](_0xffb8('0x10'),_0x3dbb54,_0x377463);_0x2b2197(_0x377463);});});} \ No newline at end of file +var _0xcc1a=['../../config/logger','rpc','client','redis','defaults','localhost','./dashboard.socket','request','request\x20sent','debug','Dashboard,\x20%s,\x20%s,\x20%s','stringify','error','code','Dashboard,\x20%s,\x20%s','message','info','result','catch','lodash','moment','bluebird','ioredis','../../config/utils'];(function(_0x39ffd1,_0x299703){var _0x31267e=function(_0x11b420){while(--_0x11b420){_0x39ffd1['push'](_0x39ffd1['shift']());}};_0x31267e(++_0x299703);}(_0xcc1a,0x133));var _0xacc1=function(_0x419550,_0x15cdf1){_0x419550=_0x419550-0x0;var _0x55f9ef=_0xcc1a[_0x419550];return _0x55f9ef;};'use strict';var _=require(_0xacc1('0x0'));var util=require('util');var moment=require(_0xacc1('0x1'));var BPromise=require(_0xacc1('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xacc1('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xacc1('0x4'));var logger=require(_0xacc1('0x5'))(_0xacc1('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xacc1('0x7')]['http']({'port':0x232a});config[_0xacc1('0x8')]=_[_0xacc1('0x9')](config['redis'],{'host':_0xacc1('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xacc1('0x8')]));require(_0xacc1('0xb'))['register'](socket);function respondWithRpcPromise(_0x18a3ce,_0x457ca8,_0x30c27b){return new BPromise(function(_0x4d74e1,_0x231a4f){return client[_0xacc1('0xc')](_0x18a3ce,_0x30c27b)['then'](function(_0x2623a6){logger['info']('Dashboard,\x20%s,\x20%s',_0x457ca8,_0xacc1('0xd'));logger[_0xacc1('0xe')](_0xacc1('0xf'),_0x457ca8,_0xacc1('0xd'),JSON[_0xacc1('0x10')](_0x2623a6));if(_0x2623a6[_0xacc1('0x11')]){if(_0x2623a6[_0xacc1('0x11')][_0xacc1('0x12')]===0x1f4){logger['error'](_0xacc1('0x13'),_0x457ca8,_0x2623a6[_0xacc1('0x11')][_0xacc1('0x14')]);return _0x231a4f(_0x2623a6['error'][_0xacc1('0x14')]);}logger[_0xacc1('0x11')](_0xacc1('0x13'),_0x457ca8,_0x2623a6[_0xacc1('0x11')]['message']);return _0x4d74e1(_0x2623a6[_0xacc1('0x11')]['message']);}else{logger[_0xacc1('0x15')]('Dashboard,\x20%s,\x20%s',_0x457ca8,_0xacc1('0xd'));_0x4d74e1(_0x2623a6[_0xacc1('0x16')][_0xacc1('0x14')]);}})[_0xacc1('0x17')](function(_0x1319d4){logger['error'](_0xacc1('0x13'),_0x457ca8,_0x1319d4);_0x231a4f(_0x1319d4);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index 9cb1cbf..da6566b 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 _0x4edb=['removeListener','register','length','dashboard:','./dashboard.events','save','remove','emit'];(function(_0xb4a153,_0x2ff110){var _0x2c4036=function(_0x19abcf){while(--_0x19abcf){_0xb4a153['push'](_0xb4a153['shift']());}};_0x2c4036(++_0x2ff110);}(_0x4edb,0x10c));var _0xb4ed=function(_0x5f8000,_0x4a56b1){_0x5f8000=_0x5f8000-0x0;var _0xc8f261=_0x4edb[_0x5f8000];return _0xc8f261;};'use strict';var DashboardEvents=require(_0xb4ed('0x0'));var events=[_0xb4ed('0x1'),_0xb4ed('0x2'),'update'];function createListener(_0x4ec39d,_0x241ac8){return function(_0xbd261a){_0x241ac8[_0xb4ed('0x3')](_0x4ec39d,_0xbd261a);};}function removeListener(_0x16a1a5,_0x7fdd2f){return function(){DashboardEvents[_0xb4ed('0x4')](_0x16a1a5,_0x7fdd2f);};}exports[_0xb4ed('0x5')]=function(_0x10bdc8){for(var _0x4de441=0x0,_0x4f0431=events[_0xb4ed('0x6')];_0x4de441<_0x4f0431;_0x4de441++){var _0x531ea1=events[_0x4de441];var _0x407255=createListener(_0xb4ed('0x7')+_0x531ea1,_0x10bdc8);DashboardEvents['on'](_0x531ea1,_0x407255);}}; \ No newline at end of file +var _0x8b80=['register','length','dashboard:','./dashboard.events','save','remove','update','emit','removeListener'];(function(_0x589c04,_0x210b55){var _0x2cce22=function(_0x284ece){while(--_0x284ece){_0x589c04['push'](_0x589c04['shift']());}};_0x2cce22(++_0x210b55);}(_0x8b80,0xed));var _0x08b8=function(_0x28d18d,_0x55896b){_0x28d18d=_0x28d18d-0x0;var _0x470640=_0x8b80[_0x28d18d];return _0x470640;};'use strict';var DashboardEvents=require(_0x08b8('0x0'));var events=[_0x08b8('0x1'),_0x08b8('0x2'),_0x08b8('0x3')];function createListener(_0x3f929b,_0x43fcff){return function(_0x22d054){_0x43fcff[_0x08b8('0x4')](_0x3f929b,_0x22d054);};}function removeListener(_0x3932ba,_0x20eaf9){return function(){DashboardEvents[_0x08b8('0x5')](_0x3932ba,_0x20eaf9);};}exports[_0x08b8('0x6')]=function(_0x358547){for(var _0x3a6bcd=0x0,_0x38bbbf=events[_0x08b8('0x7')];_0x3a6bcd<_0x38bbbf;_0x3a6bcd++){var _0x199b0c=events[_0x3a6bcd];var _0x2ea5cf=createListener(_0x08b8('0x8')+_0x199b0c,_0x358547);DashboardEvents['on'](_0x199b0c,_0x2ea5cf);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index c5b6cc6..ce1c929 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 _0xf8bf=['show','/:id/items','getItems','post','create','/:id/clone','clone','addItem','put','/:id','delete','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboard.controller','get','index','isAuthenticated'];(function(_0x5de237,_0x2058e8){var _0x3b3d4d=function(_0x3debe1){while(--_0x3debe1){_0x5de237['push'](_0x5de237['shift']());}};_0x3b3d4d(++_0x2058e8);}(_0xf8bf,0xa5));var _0xff8b=function(_0x175080,_0x2a901d){_0x175080=_0x175080-0x0;var _0x29f1a5=_0xf8bf[_0x175080];return _0x29f1a5;};'use strict';var multer=require('multer');var util=require(_0xff8b('0x0'));var path=require('path');var timeout=require(_0xff8b('0x1'));var express=require(_0xff8b('0x2'));var router=express[_0xff8b('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xff8b('0x4'));var interaction=require(_0xff8b('0x5'));var config=require(_0xff8b('0x6'));var controller=require(_0xff8b('0x7'));router[_0xff8b('0x8')]('/',auth['isAuthenticated'](),controller[_0xff8b('0x9')]);router[_0xff8b('0x8')]('/:id',auth[_0xff8b('0xa')](),controller[_0xff8b('0xb')]);router['get'](_0xff8b('0xc'),auth['isAuthenticated'](),controller[_0xff8b('0xd')]);router[_0xff8b('0xe')]('/',auth[_0xff8b('0xa')](),controller[_0xff8b('0xf')]);router[_0xff8b('0xe')](_0xff8b('0x10'),auth[_0xff8b('0xa')](),controller[_0xff8b('0x11')]);router['post'](_0xff8b('0xc'),auth[_0xff8b('0xa')](),controller[_0xff8b('0x12')]);router[_0xff8b('0x13')](_0xff8b('0x14'),auth['isAuthenticated'](),controller['update']);router[_0xff8b('0x15')]('/:id',auth[_0xff8b('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xb1d6=['exports','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/items','getItems','post','clone','addItem','put','update','delete','destroy'];(function(_0x1c470d,_0x81d66b){var _0x12141b=function(_0x45bfd3){while(--_0x45bfd3){_0x1c470d['push'](_0x1c470d['shift']());}};_0x12141b(++_0x81d66b);}(_0xb1d6,0xdd));var _0x6b1d=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xb1d6[_0x2f5ac5];return _0x37c9a8;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x6b1d('0x0'));var timeout=require('connect-timeout');var express=require(_0x6b1d('0x1'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x6b1d('0x2'));var interaction=require(_0x6b1d('0x3'));var config=require(_0x6b1d('0x4'));var controller=require('./dashboard.controller');router[_0x6b1d('0x5')]('/',auth[_0x6b1d('0x6')](),controller[_0x6b1d('0x7')]);router[_0x6b1d('0x5')](_0x6b1d('0x8'),auth[_0x6b1d('0x6')](),controller[_0x6b1d('0x9')]);router['get'](_0x6b1d('0xa'),auth[_0x6b1d('0x6')](),controller[_0x6b1d('0xb')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x6b1d('0xc')]('/:id/clone',auth[_0x6b1d('0x6')](),controller[_0x6b1d('0xd')]);router[_0x6b1d('0xc')](_0x6b1d('0xa'),auth[_0x6b1d('0x6')](),controller[_0x6b1d('0xe')]);router[_0x6b1d('0xf')](_0x6b1d('0x8'),auth[_0x6b1d('0x6')](),controller[_0x6b1d('0x10')]);router[_0x6b1d('0x11')](_0x6b1d('0x8'),auth[_0x6b1d('0x6')](),controller[_0x6b1d('0x12')]);module[_0x6b1d('0x13')]=router; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.attributes.js b/server/api/dashboardItem/dashboardItem.attributes.js index a56e01e..87a64c5 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 _0x0295=['#ffffff','sequelize','exports','TEXT','long','parse','getDataValue','attrs','setDataValue','INTEGER','STRING'];(function(_0xa8b370,_0x2b77db){var _0x643e37=function(_0x1486eb){while(--_0x1486eb){_0xa8b370['push'](_0xa8b370['shift']());}};_0x643e37(++_0x2b77db);}(_0x0295,0x1f0));var _0x5029=function(_0x52fc63,_0x5a2f5e){_0x52fc63=_0x52fc63-0x0;var _0x5183aa=_0x0295[_0x52fc63];return _0x5183aa;};'use strict';var Sequelize=require(_0x5029('0x0'));var squel=require('squel');var _=require('lodash');module[_0x5029('0x1')]={'title':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['STRING'](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x5029('0x2')](_0x5029('0x3')),'get':function(){try{return JSON[_0x5029('0x4')](this[_0x5029('0x5')](_0x5029('0x6')));}catch(_0x69a497){return[];}},'set':function(_0x200217){try{this[_0x5029('0x7')](_0x5029('0x6'),JSON['stringify'](_0x200217));}catch(_0x54978f){this['setDataValue'](_0x5029('0x6'),JSON['stringify']([]));}}},'sizeX':{'type':Sequelize[_0x5029('0x8')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0x5029('0x8')]},'col':{'type':Sequelize['INTEGER']},'background':{'type':Sequelize[_0x5029('0x9')],'allowNull':![],'defaultValue':_0x5029('0xa'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0x5029('0x9')],'allowNull':![],'defaultValue':'#2196f3','validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x5029('0x9')]},'titleFontSize':{'type':Sequelize[_0x5029('0x8')],'defaultValue':0xc}}; \ No newline at end of file +var _0xeda8=['TEXT','long','parse','getDataValue','attrs','setDataValue','stringify','#ffffff','sequelize','squel','exports','STRING'];(function(_0xf23b24,_0x55c8f4){var _0x12ed3b=function(_0x99f130){while(--_0x99f130){_0xf23b24['push'](_0xf23b24['shift']());}};_0x12ed3b(++_0x55c8f4);}(_0xeda8,0x104));var _0x8eda=function(_0x3c3e69,_0x361556){_0x3c3e69=_0x3c3e69-0x0;var _0x273e78=_0xeda8[_0x3c3e69];return _0x273e78;};'use strict';var Sequelize=require(_0x8eda('0x0'));var squel=require(_0x8eda('0x1'));var _=require('lodash');module[_0x8eda('0x2')]={'title':{'type':Sequelize[_0x8eda('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x8eda('0x3')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x8eda('0x4')](_0x8eda('0x5')),'get':function(){try{return JSON[_0x8eda('0x6')](this[_0x8eda('0x7')](_0x8eda('0x8')));}catch(_0x22dee9){return[];}},'set':function(_0x1f3556){try{this[_0x8eda('0x9')](_0x8eda('0x8'),JSON['stringify'](_0x1f3556));}catch(_0x28b721){this[_0x8eda('0x9')](_0x8eda('0x8'),JSON[_0x8eda('0xa')]([]));}}},'sizeX':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize['INTEGER']},'col':{'type':Sequelize['INTEGER']},'background':{'type':Sequelize[_0x8eda('0x3')],'allowNull':![],'defaultValue':_0x8eda('0xb'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0x8eda('0x3')],'allowNull':![],'defaultValue':'#2196f3','validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x8eda('0x3')]},'titleFontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xc}}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.controller.js b/server/api/dashboardItem/dashboardItem.controller.js index ef8a680..5b58a50 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 _0xac15=['web-report','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','create','body','eml-format','rimraf','request-promise','bluebird','mustache','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./dashboardItem.socket','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','end','error','stack','name','send','show','params','model','DashboardItem','rawAttributes','query','filters','intersection','attributes','fields','length','includeAll','include','merge','options','find','catch','type','iframe','attrUrl','attrs','value','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','attrFontSize','counter','attrMetric','attrVoiceQueues','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3'];(function(_0x20f3bc,_0x34c2fd){var _0x2e0502=function(_0x14dd1a){while(--_0x14dd1a){_0x20f3bc['push'](_0x20f3bc['shift']());}};_0x2e0502(++_0x34c2fd);}(_0xac15,0x11f));var _0x5ac1=function(_0x53ab07,_0x516f40){_0x53ab07=_0x53ab07-0x0;var _0xf9ee72=_0xac15[_0x53ab07];return _0xf9ee72;};'use strict';var emlformat=require(_0x5ac1('0x0'));var rimraf=require(_0x5ac1('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x5ac1('0x2'));var moment=require('moment');var BPromise=require(_0x5ac1('0x3'));var Mustache=require(_0x5ac1('0x4'));var util=require('util');var path=require(_0x5ac1('0x5'));var sox=require('sox');var csv=require(_0x5ac1('0x6'));var ejs=require(_0x5ac1('0x7'));var fs=require('fs');var fs_extra=require(_0x5ac1('0x8'));var _=require('lodash');var squel=require(_0x5ac1('0x9'));var crypto=require(_0x5ac1('0xa'));var jsforce=require(_0x5ac1('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x5ac1('0x6'));var querystring=require(_0x5ac1('0xc'));var Papa=require(_0x5ac1('0xd'));var Redis=require(_0x5ac1('0xe'));var authService=require(_0x5ac1('0xf'));var qs=require(_0x5ac1('0x10'));var as=require(_0x5ac1('0x11'));var hardwareService=require(_0x5ac1('0x12'));var logger=require(_0x5ac1('0x13'))(_0x5ac1('0x14'));var utils=require('../../config/utils');var config=require(_0x5ac1('0x15'));var licenseUtil=require(_0x5ac1('0x16'));var db=require(_0x5ac1('0x17'))['db'];config[_0x5ac1('0x18')]=_[_0x5ac1('0x19')](config['redis'],{'host':_0x5ac1('0x1a'),'port':0x18eb});var socket=require(_0x5ac1('0x1b'))(new Redis(config[_0x5ac1('0x18')]));require(_0x5ac1('0x1c'))['register'](socket);function respondWithStatusCode(_0x2ad765,_0x2af927){_0x2af927=_0x2af927||0xcc;return function(_0x43626b){if(_0x43626b){return _0x2ad765[_0x5ac1('0x1d')](_0x2af927);}return _0x2ad765[_0x5ac1('0x1e')](_0x2af927)['end']();};}function respondWithResult(_0x544fc1,_0x251865){_0x251865=_0x251865||0xc8;return function(_0x579ccd){if(_0x579ccd){return _0x544fc1[_0x5ac1('0x1e')](_0x251865)[_0x5ac1('0x1f')](_0x579ccd);}};}function respondWithFilteredResult(_0x58a2ee,_0x1c28ac){return function(_0x59ff37){if(_0x59ff37){var _0x99e7c3=typeof _0x1c28ac[_0x5ac1('0x20')]===_0x5ac1('0x21')&&typeof _0x1c28ac[_0x5ac1('0x22')]===_0x5ac1('0x21');var _0xddb768=_0x59ff37[_0x5ac1('0x23')];var _0x54a9f8=_0x99e7c3?0x0:_0x1c28ac[_0x5ac1('0x20')];var _0x41ef1e=_0x99e7c3?_0x59ff37[_0x5ac1('0x23')]:_0x1c28ac['offset']+_0x1c28ac['limit'];var _0x588b74;if(_0x41ef1e>=_0xddb768){_0x41ef1e=_0xddb768;_0x588b74=0xc8;}else{_0x588b74=0xce;}_0x58a2ee[_0x5ac1('0x1e')](_0x588b74);return _0x58a2ee[_0x5ac1('0x24')](_0x5ac1('0x25'),_0x54a9f8+'-'+_0x41ef1e+'/'+_0xddb768)[_0x5ac1('0x1f')](_0x59ff37);}return null;};}function patchUpdates(_0x814e7e){return function(_0x562505){try{jsonpatch['apply'](_0x562505,_0x814e7e,!![]);}catch(_0x2f878d){return BPromise[_0x5ac1('0x26')](_0x2f878d);}return _0x562505[_0x5ac1('0x27')]();};}function saveUpdates(_0x23bb51,_0x727d68){return function(_0x2337c4){if(_0x2337c4){return _0x2337c4[_0x5ac1('0x28')](_0x23bb51)[_0x5ac1('0x29')](function(_0x4b6885){return _0x4b6885;});}return null;};}function removeEntity(_0x899424,_0x299d59){return function(_0x1478b5){if(_0x1478b5){return _0x1478b5[_0x5ac1('0x2a')]()['then'](function(){_0x899424[_0x5ac1('0x1e')](0xcc)[_0x5ac1('0x2b')]();});}};}function handleEntityNotFound(_0x415684,_0x1f5ece){return function(_0x1f8bd5){if(!_0x1f8bd5){_0x415684['sendStatus'](0x194);}return _0x1f8bd5;};}function handleError(_0x5efc09,_0x150f69){_0x150f69=_0x150f69||0x1f4;return function(_0x4d2f11){logger[_0x5ac1('0x2c')](_0x4d2f11[_0x5ac1('0x2d')]);if(_0x4d2f11['name']){delete _0x4d2f11[_0x5ac1('0x2e')];}_0x5efc09['status'](_0x150f69)[_0x5ac1('0x2f')](_0x4d2f11);};}exports[_0x5ac1('0x30')]=function(_0x325685,_0x5ce791){var _0x50c351={'raw':![],'where':{'id':_0x325685[_0x5ac1('0x31')]['id']}},_0x409387={};_0x409387[_0x5ac1('0x32')]=_['keys'](db[_0x5ac1('0x33')][_0x5ac1('0x34')]);_0x409387['query']=_['keys'](_0x325685[_0x5ac1('0x35')]);_0x409387[_0x5ac1('0x36')]=_[_0x5ac1('0x37')](_0x409387[_0x5ac1('0x32')],_0x409387[_0x5ac1('0x35')]);_0x50c351[_0x5ac1('0x38')]=_['intersection'](_0x409387[_0x5ac1('0x32')],qs[_0x5ac1('0x39')](_0x325685[_0x5ac1('0x35')][_0x5ac1('0x39')]));_0x50c351[_0x5ac1('0x38')]=_0x50c351[_0x5ac1('0x38')][_0x5ac1('0x3a')]?_0x50c351['attributes']:_0x409387[_0x5ac1('0x32')];if(_0x325685[_0x5ac1('0x35')][_0x5ac1('0x3b')]){_0x50c351[_0x5ac1('0x3c')]=[{'all':!![]}];}_0x50c351=_[_0x5ac1('0x3d')]({},_0x50c351,_0x325685[_0x5ac1('0x3e')]);return db[_0x5ac1('0x33')][_0x5ac1('0x3f')](_0x50c351)['then'](handleEntityNotFound(_0x5ce791,null))[_0x5ac1('0x29')](respondWithResult(_0x5ce791,null))[_0x5ac1('0x40')](handleError(_0x5ce791,null));};exports[_0x5ac1('0x2a')]=function(_0xa5e7a8,_0x545469){return db[_0x5ac1('0x33')][_0x5ac1('0x3f')]({'where':{'id':_0xa5e7a8[_0x5ac1('0x31')]['id']}})['then'](handleEntityNotFound(_0x545469,null))[_0x5ac1('0x29')](removeEntity(_0x545469,null))['catch'](handleError(_0x545469,null));};function widgetAttributes(_0x509396){try{switch(_0x509396[_0x5ac1('0x41')]){case _0x5ac1('0x42'):return[{'name':_0x5ac1('0x43'),'value':_0x509396[_0x5ac1('0x43')]||(_0x509396[_0x5ac1('0x44')]&&_0x509396['attrs'][0x0]?_0x509396[_0x5ac1('0x44')][0x0][_0x5ac1('0x45')]:undefined)||'https://'}];case _0x5ac1('0x46'):return[{'name':'attrPath','value':_0x509396[_0x5ac1('0x47')]||(_0x509396[_0x5ac1('0x44')]&&_0x509396['attrs'][0x0]?_0x509396[_0x5ac1('0x44')][0x0][_0x5ac1('0x45')]:undefined)||''}];case _0x5ac1('0x48'):return[{'name':'attrHourFormat','value':_0x509396[_0x5ac1('0x49')]||(_0x509396['attrs']&&_0x509396[_0x5ac1('0x44')][0x0]?_0x509396[_0x5ac1('0x44')][0x0][_0x5ac1('0x45')]:undefined)||_0x5ac1('0x4a')},{'name':_0x5ac1('0x4b'),'value':_0x509396['attrTimezone']||(_0x509396[_0x5ac1('0x44')]&&_0x509396['attrs'][0x1]?_0x509396['attrs'][0x1]['value']:undefined)||'0.00'},{'name':'attrFontSize','value':_0x509396[_0x5ac1('0x4c')]||(_0x509396[_0x5ac1('0x44')]&&_0x509396[_0x5ac1('0x44')][0x2]?_0x509396[_0x5ac1('0x44')][0x2][_0x5ac1('0x45')]:undefined)||0xc}];case _0x5ac1('0x4d'):return[{'name':_0x5ac1('0x4e'),'value':_0x509396[_0x5ac1('0x4e')]||(_0x509396['attrs']&&_0x509396[_0x5ac1('0x44')][0x0]?_0x509396['attrs'][0x0][_0x5ac1('0x45')]:undefined)||'total'},{'name':_0x5ac1('0x4f'),'value':_0x509396['attrVoiceQueues']||(_0x509396[_0x5ac1('0x44')]&&_0x509396[_0x5ac1('0x44')][0x1]?_0x509396[_0x5ac1('0x44')][0x1][_0x5ac1('0x45')]:undefined)||[]},{'name':'attrFontSize','value':_0x509396[_0x5ac1('0x4c')]||(_0x509396[_0x5ac1('0x44')]&&_0x509396[_0x5ac1('0x44')][0x2]?_0x509396[_0x5ac1('0x44')][0x2]['value']:undefined)||0x14}];case _0x5ac1('0x50'):case _0x5ac1('0x51'):return[{'name':_0x5ac1('0x52'),'value':_0x509396[_0x5ac1('0x52')]||(_0x509396[_0x5ac1('0x44')]&&_0x509396['attrs'][0x0]?_0x509396[_0x5ac1('0x44')][0x0]['value']:undefined)||'total'},{'name':_0x5ac1('0x53'),'value':_0x509396[_0x5ac1('0x53')]||(_0x509396[_0x5ac1('0x44')]&&_0x509396[_0x5ac1('0x44')][0x1]?_0x509396[_0x5ac1('0x44')][0x1][_0x5ac1('0x45')]:undefined)||null},{'name':_0x5ac1('0x54'),'value':_0x509396['attrSerie3']||(_0x509396[_0x5ac1('0x44')]&&_0x509396[_0x5ac1('0x44')][0x2]?_0x509396['attrs'][0x2][_0x5ac1('0x45')]:undefined)||null},{'name':_0x5ac1('0x4f'),'value':_0x509396[_0x5ac1('0x4f')]||(_0x509396[_0x5ac1('0x44')]&&_0x509396[_0x5ac1('0x44')][0x3]?_0x509396[_0x5ac1('0x44')][0x3][_0x5ac1('0x45')]:undefined)||[]}];case _0x5ac1('0x55'):return[{'name':_0x5ac1('0x56'),'type':_0x509396[_0x5ac1('0x57')]||(_0x509396['attrs']&&_0x509396[_0x5ac1('0x44')][0x0]?_0x509396[_0x5ac1('0x44')][0x0]['type']:undefined)||null,'value':_0x509396[_0x5ac1('0x56')]||(_0x509396[_0x5ac1('0x44')]&&_0x509396[_0x5ac1('0x44')][0x0]?_0x509396[_0x5ac1('0x44')][0x0][_0x5ac1('0x45')]:undefined)||null},{'name':_0x5ac1('0x58'),'value':_0x509396['attrRefresh']||(_0x509396['attrs']&&_0x509396['attrs'][0x1]?_0x509396[_0x5ac1('0x44')][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x65f69c){logger[_0x5ac1('0x2c')](_0x5ac1('0x59'),JSON[_0x5ac1('0x5a')](_0x65f69c));return[];}}exports[_0x5ac1('0x5b')]=function(_0x215496,_0x5ebc6d){if(_0x215496[_0x5ac1('0x5c')]){_0x215496['body']['attrs']=widgetAttributes(_0x215496['body']);}return db[_0x5ac1('0x33')][_0x5ac1('0x5b')](_0x215496['body'],{})[_0x5ac1('0x29')](respondWithResult(_0x5ebc6d,0xc9))['catch'](handleError(_0x5ebc6d,null));};exports[_0x5ac1('0x28')]=function(_0x5ac594,_0x43c89b){if(_0x5ac594[_0x5ac1('0x5c')]['id']){delete _0x5ac594[_0x5ac1('0x5c')]['id'];}_0x5ac594['body'][_0x5ac1('0x44')]=widgetAttributes(_0x5ac594[_0x5ac1('0x5c')]);return db[_0x5ac1('0x33')][_0x5ac1('0x3f')]({'where':{'id':_0x5ac594[_0x5ac1('0x31')]['id']}})['then'](handleEntityNotFound(_0x43c89b,null))[_0x5ac1('0x29')](saveUpdates(_0x5ac594[_0x5ac1('0x5c')],null))[_0x5ac1('0x29')](respondWithResult(_0x43c89b,null))[_0x5ac1('0x40')](handleError(_0x43c89b,null));}; \ No newline at end of file +var _0xd99d=['attrs','https://','attrPath','clock','attrHourFormat','attrTimezone','value','attrFontSize','counter','attrMetric','attrVoiceQueues','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','reportType','type','attrRefresh','widgetAttributes:\x20%s','stringify','create','body','update','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','defaults','redis','localhost','register','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','then','destroy','error','stack','name','send','params','model','DashboardItem','keys','query','intersection','fields','attributes','includeAll','include','merge','options','find','catch','attrUrl'];(function(_0x525c7b,_0x488fcc){var _0x27b33e=function(_0x56d43b){while(--_0x56d43b){_0x525c7b['push'](_0x525c7b['shift']());}};_0x27b33e(++_0x488fcc);}(_0xd99d,0x70));var _0xdd99=function(_0x2b03b9,_0x2e6583){_0x2b03b9=_0x2b03b9-0x0;var _0x31351b=_0xd99d[_0x2b03b9];return _0x31351b;};'use strict';var emlformat=require(_0xdd99('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xdd99('0x1'));var jsonpatch=require(_0xdd99('0x2'));var rp=require(_0xdd99('0x3'));var moment=require(_0xdd99('0x4'));var BPromise=require(_0xdd99('0x5'));var Mustache=require(_0xdd99('0x6'));var util=require('util');var path=require(_0xdd99('0x7'));var sox=require(_0xdd99('0x8'));var csv=require(_0xdd99('0x9'));var ejs=require(_0xdd99('0xa'));var fs=require('fs');var fs_extra=require(_0xdd99('0xb'));var _=require(_0xdd99('0xc'));var squel=require(_0xdd99('0xd'));var crypto=require(_0xdd99('0xe'));var jsforce=require(_0xdd99('0xf'));var deskjs=require(_0xdd99('0x10'));var toCsv=require(_0xdd99('0x9'));var querystring=require('querystring');var Papa=require(_0xdd99('0x11'));var Redis=require(_0xdd99('0x12'));var authService=require(_0xdd99('0x13'));var qs=require(_0xdd99('0x14'));var as=require(_0xdd99('0x15'));var hardwareService=require(_0xdd99('0x16'));var logger=require(_0xdd99('0x17'))('api');var utils=require(_0xdd99('0x18'));var config=require(_0xdd99('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config['redis']=_[_0xdd99('0x1a')](config[_0xdd99('0x1b')],{'host':_0xdd99('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./dashboardItem.socket')[_0xdd99('0x1d')](socket);function respondWithStatusCode(_0x572f8b,_0x52776e){_0x52776e=_0x52776e||0xcc;return function(_0xc7c333){if(_0xc7c333){return _0x572f8b[_0xdd99('0x1e')](_0x52776e);}return _0x572f8b[_0xdd99('0x1f')](_0x52776e)['end']();};}function respondWithResult(_0x396fdf,_0x2637c){_0x2637c=_0x2637c||0xc8;return function(_0x547ccb){if(_0x547ccb){return _0x396fdf['status'](_0x2637c)[_0xdd99('0x20')](_0x547ccb);}};}function respondWithFilteredResult(_0x50bdd7,_0x400b13){return function(_0x41fa2f){if(_0x41fa2f){var _0x1d178f=typeof _0x400b13['offset']===_0xdd99('0x21')&&typeof _0x400b13[_0xdd99('0x22')]===_0xdd99('0x21');var _0x3c884c=_0x41fa2f[_0xdd99('0x23')];var _0x4dec31=_0x1d178f?0x0:_0x400b13[_0xdd99('0x24')];var _0x3e05a8=_0x1d178f?_0x41fa2f['count']:_0x400b13['offset']+_0x400b13[_0xdd99('0x22')];var _0x51d98f;if(_0x3e05a8>=_0x3c884c){_0x3e05a8=_0x3c884c;_0x51d98f=0xc8;}else{_0x51d98f=0xce;}_0x50bdd7['status'](_0x51d98f);return _0x50bdd7[_0xdd99('0x25')](_0xdd99('0x26'),_0x4dec31+'-'+_0x3e05a8+'/'+_0x3c884c)[_0xdd99('0x20')](_0x41fa2f);}return null;};}function patchUpdates(_0x47d122){return function(_0x300b98){try{jsonpatch['apply'](_0x300b98,_0x47d122,!![]);}catch(_0x210bb4){return BPromise['reject'](_0x210bb4);}return _0x300b98['save']();};}function saveUpdates(_0xa784cf,_0xcc25b6){return function(_0x246f3f){if(_0x246f3f){return _0x246f3f['update'](_0xa784cf)[_0xdd99('0x27')](function(_0x49654a){return _0x49654a;});}return null;};}function removeEntity(_0x48e187,_0x238cd9){return function(_0x1e5f59){if(_0x1e5f59){return _0x1e5f59[_0xdd99('0x28')]()[_0xdd99('0x27')](function(){_0x48e187['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x441ebf,_0x4ac226){return function(_0x277012){if(!_0x277012){_0x441ebf[_0xdd99('0x1e')](0x194);}return _0x277012;};}function handleError(_0x282421,_0x23d72b){_0x23d72b=_0x23d72b||0x1f4;return function(_0x9895f0){logger[_0xdd99('0x29')](_0x9895f0[_0xdd99('0x2a')]);if(_0x9895f0[_0xdd99('0x2b')]){delete _0x9895f0['name'];}_0x282421[_0xdd99('0x1f')](_0x23d72b)[_0xdd99('0x2c')](_0x9895f0);};}exports['show']=function(_0x59b314,_0x3f0290){var _0x2c4f7d={'raw':![],'where':{'id':_0x59b314[_0xdd99('0x2d')]['id']}},_0x2ca78f={};_0x2ca78f[_0xdd99('0x2e')]=_['keys'](db[_0xdd99('0x2f')]['rawAttributes']);_0x2ca78f['query']=_[_0xdd99('0x30')](_0x59b314[_0xdd99('0x31')]);_0x2ca78f['filters']=_[_0xdd99('0x32')](_0x2ca78f['model'],_0x2ca78f[_0xdd99('0x31')]);_0x2c4f7d['attributes']=_[_0xdd99('0x32')](_0x2ca78f['model'],qs[_0xdd99('0x33')](_0x59b314[_0xdd99('0x31')][_0xdd99('0x33')]));_0x2c4f7d['attributes']=_0x2c4f7d[_0xdd99('0x34')]['length']?_0x2c4f7d[_0xdd99('0x34')]:_0x2ca78f[_0xdd99('0x2e')];if(_0x59b314[_0xdd99('0x31')][_0xdd99('0x35')]){_0x2c4f7d[_0xdd99('0x36')]=[{'all':!![]}];}_0x2c4f7d=_[_0xdd99('0x37')]({},_0x2c4f7d,_0x59b314[_0xdd99('0x38')]);return db[_0xdd99('0x2f')][_0xdd99('0x39')](_0x2c4f7d)['then'](handleEntityNotFound(_0x3f0290,null))[_0xdd99('0x27')](respondWithResult(_0x3f0290,null))[_0xdd99('0x3a')](handleError(_0x3f0290,null));};exports[_0xdd99('0x28')]=function(_0x56e041,_0x1a9b48){return db[_0xdd99('0x2f')][_0xdd99('0x39')]({'where':{'id':_0x56e041['params']['id']}})[_0xdd99('0x27')](handleEntityNotFound(_0x1a9b48,null))[_0xdd99('0x27')](removeEntity(_0x1a9b48,null))[_0xdd99('0x3a')](handleError(_0x1a9b48,null));};function widgetAttributes(_0x1a2fb3){try{switch(_0x1a2fb3['type']){case'iframe':return[{'name':'attrUrl','value':_0x1a2fb3[_0xdd99('0x3b')]||(_0x1a2fb3['attrs']&&_0x1a2fb3['attrs'][0x0]?_0x1a2fb3[_0xdd99('0x3c')][0x0]['value']:undefined)||_0xdd99('0x3d')}];case'custom':return[{'name':_0xdd99('0x3e'),'value':_0x1a2fb3[_0xdd99('0x3e')]||(_0x1a2fb3[_0xdd99('0x3c')]&&_0x1a2fb3[_0xdd99('0x3c')][0x0]?_0x1a2fb3[_0xdd99('0x3c')][0x0]['value']:undefined)||''}];case _0xdd99('0x3f'):return[{'name':_0xdd99('0x40'),'value':_0x1a2fb3['attrHourFormat']||(_0x1a2fb3[_0xdd99('0x3c')]&&_0x1a2fb3['attrs'][0x0]?_0x1a2fb3[_0xdd99('0x3c')][0x0]['value']:undefined)||'HH:mm:ss'},{'name':_0xdd99('0x41'),'value':_0x1a2fb3[_0xdd99('0x41')]||(_0x1a2fb3[_0xdd99('0x3c')]&&_0x1a2fb3[_0xdd99('0x3c')][0x1]?_0x1a2fb3['attrs'][0x1][_0xdd99('0x42')]:undefined)||'0.00'},{'name':_0xdd99('0x43'),'value':_0x1a2fb3[_0xdd99('0x43')]||(_0x1a2fb3[_0xdd99('0x3c')]&&_0x1a2fb3[_0xdd99('0x3c')][0x2]?_0x1a2fb3[_0xdd99('0x3c')][0x2]['value']:undefined)||0xc}];case _0xdd99('0x44'):return[{'name':_0xdd99('0x45'),'value':_0x1a2fb3[_0xdd99('0x45')]||(_0x1a2fb3[_0xdd99('0x3c')]&&_0x1a2fb3[_0xdd99('0x3c')][0x0]?_0x1a2fb3[_0xdd99('0x3c')][0x0][_0xdd99('0x42')]:undefined)||'total'},{'name':_0xdd99('0x46'),'value':_0x1a2fb3[_0xdd99('0x46')]||(_0x1a2fb3[_0xdd99('0x3c')]&&_0x1a2fb3[_0xdd99('0x3c')][0x1]?_0x1a2fb3[_0xdd99('0x3c')][0x1][_0xdd99('0x42')]:undefined)||[]},{'name':'attrFontSize','value':_0x1a2fb3['attrFontSize']||(_0x1a2fb3[_0xdd99('0x3c')]&&_0x1a2fb3[_0xdd99('0x3c')][0x2]?_0x1a2fb3[_0xdd99('0x3c')][0x2][_0xdd99('0x42')]:undefined)||0x14}];case _0xdd99('0x47'):case _0xdd99('0x48'):return[{'name':'attrSerie1','value':_0x1a2fb3[_0xdd99('0x49')]||(_0x1a2fb3[_0xdd99('0x3c')]&&_0x1a2fb3[_0xdd99('0x3c')][0x0]?_0x1a2fb3['attrs'][0x0][_0xdd99('0x42')]:undefined)||'total'},{'name':_0xdd99('0x4a'),'value':_0x1a2fb3[_0xdd99('0x4a')]||(_0x1a2fb3['attrs']&&_0x1a2fb3['attrs'][0x1]?_0x1a2fb3[_0xdd99('0x3c')][0x1][_0xdd99('0x42')]:undefined)||null},{'name':_0xdd99('0x4b'),'value':_0x1a2fb3[_0xdd99('0x4b')]||(_0x1a2fb3[_0xdd99('0x3c')]&&_0x1a2fb3[_0xdd99('0x3c')][0x2]?_0x1a2fb3[_0xdd99('0x3c')][0x2]['value']:undefined)||null},{'name':_0xdd99('0x46'),'value':_0x1a2fb3[_0xdd99('0x46')]||(_0x1a2fb3['attrs']&&_0x1a2fb3[_0xdd99('0x3c')][0x3]?_0x1a2fb3['attrs'][0x3]['value']:undefined)||[]}];case _0xdd99('0x4c'):return[{'name':_0xdd99('0x4d'),'type':_0x1a2fb3[_0xdd99('0x4e')]||(_0x1a2fb3[_0xdd99('0x3c')]&&_0x1a2fb3['attrs'][0x0]?_0x1a2fb3[_0xdd99('0x3c')][0x0][_0xdd99('0x4f')]:undefined)||null,'value':_0x1a2fb3[_0xdd99('0x4d')]||(_0x1a2fb3['attrs']&&_0x1a2fb3[_0xdd99('0x3c')][0x0]?_0x1a2fb3['attrs'][0x0]['value']:undefined)||null},{'name':_0xdd99('0x50'),'value':_0x1a2fb3[_0xdd99('0x50')]||(_0x1a2fb3[_0xdd99('0x3c')]&&_0x1a2fb3[_0xdd99('0x3c')][0x1]?_0x1a2fb3['attrs'][0x1][_0xdd99('0x42')]:undefined)||0x0}];default:return[];}}catch(_0x311163){logger[_0xdd99('0x29')](_0xdd99('0x51'),JSON[_0xdd99('0x52')](_0x311163));return[];}}exports[_0xdd99('0x53')]=function(_0x493d91,_0x21eef5){if(_0x493d91['body']){_0x493d91['body'][_0xdd99('0x3c')]=widgetAttributes(_0x493d91[_0xdd99('0x54')]);}return db[_0xdd99('0x2f')]['create'](_0x493d91[_0xdd99('0x54')],{})[_0xdd99('0x27')](respondWithResult(_0x21eef5,0xc9))[_0xdd99('0x3a')](handleError(_0x21eef5,null));};exports[_0xdd99('0x55')]=function(_0x13df5d,_0x536bb7){if(_0x13df5d[_0xdd99('0x54')]['id']){delete _0x13df5d['body']['id'];}_0x13df5d[_0xdd99('0x54')][_0xdd99('0x3c')]=widgetAttributes(_0x13df5d[_0xdd99('0x54')]);return db[_0xdd99('0x2f')]['find']({'where':{'id':_0x13df5d['params']['id']}})[_0xdd99('0x27')](handleEntityNotFound(_0x536bb7,null))[_0xdd99('0x27')](saveUpdates(_0x13df5d['body'],null))[_0xdd99('0x27')](respondWithResult(_0x536bb7,null))['catch'](handleError(_0x536bb7,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index 34ded14..d04abf6 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 _0xef74=['exports','events','../../mysqldb','DashboardItem','setMaxListeners','update','remove','emit','hasOwnProperty','hook'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xef74,0x8d));var _0x4ef7=function(_0x4ed520,_0x21be63){_0x4ed520=_0x4ed520-0x0;var _0x4415a6=_0xef74[_0x4ed520];return _0x4415a6;};'use strict';var EventEmitter=require(_0x4ef7('0x0'));var DashboardItem=require(_0x4ef7('0x1'))['db'][_0x4ef7('0x2')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0x4ef7('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x4ef7('0x4'),'afterDestroy':_0x4ef7('0x5')};function emitEvent(_0x5c5066){return function(_0x50f650,_0x3eee59,_0x1af99e){DashboardItemEvents[_0x4ef7('0x6')](_0x5c5066+':'+_0x50f650['id'],_0x50f650);DashboardItemEvents[_0x4ef7('0x6')](_0x5c5066,_0x50f650);_0x1af99e(null);};}for(var e in events){if(events[_0x4ef7('0x7')](e)){var event=events[e];DashboardItem[_0x4ef7('0x8')](e,emitEvent(event));}}module[_0x4ef7('0x9')]=DashboardItemEvents; \ No newline at end of file +var _0xa606=['events','../../mysqldb','DashboardItem','setMaxListeners','remove','emit','hasOwnProperty','hook'];(function(_0x2de0a7,_0x38d3e7){var _0x429437=function(_0x23c148){while(--_0x23c148){_0x2de0a7['push'](_0x2de0a7['shift']());}};_0x429437(++_0x38d3e7);}(_0xa606,0x198));var _0x6a60=function(_0x59be19,_0x1e253e){_0x59be19=_0x59be19-0x0;var _0x3daa51=_0xa606[_0x59be19];return _0x3daa51;};'use strict';var EventEmitter=require(_0x6a60('0x0'));var DashboardItem=require(_0x6a60('0x1'))['db'][_0x6a60('0x2')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0x6a60('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x6a60('0x4')};function emitEvent(_0x9b42bc){return function(_0x47c96b,_0x40c7f1,_0x14246b){DashboardItemEvents[_0x6a60('0x5')](_0x9b42bc+':'+_0x47c96b['id'],_0x47c96b);DashboardItemEvents['emit'](_0x9b42bc,_0x47c96b);_0x14246b(null);};}for(var e in events){if(events[_0x6a60('0x6')](e)){var event=events[e];DashboardItem[_0x6a60('0x7')](e,emitEvent(event));}}module['exports']=DashboardItemEvents; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.model.js b/server/api/dashboardItem/dashboardItem.model.js index 9c5b363..222d21f 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 _0x3d2a=['moment','path','rimraf','../../config/environment','./dashboardItem.attributes','exports','DashboardItem','dashboard_items','../../config/logger','api'];(function(_0x465d11,_0x37e1ad){var _0x29225d=function(_0xb3283){while(--_0xb3283){_0x465d11['push'](_0x465d11['shift']());}};_0x29225d(++_0x37e1ad);}(_0x3d2a,0x1d4));var _0xa3d2=function(_0x41b06b,_0x34d7bb){_0x41b06b=_0x41b06b-0x0;var _0x52fce1=_0x3d2a[_0x41b06b];return _0x52fce1;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xa3d2('0x0'))(_0xa3d2('0x1'));var moment=require(_0xa3d2('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xa3d2('0x3'));var rimraf=require(_0xa3d2('0x4'));var config=require(_0xa3d2('0x5'));var attributes=require(_0xa3d2('0x6'));module[_0xa3d2('0x7')]=function(_0x3de50d,_0x17ec0d){return _0x3de50d['define'](_0xa3d2('0x8'),attributes,{'tableName':_0xa3d2('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8e0e=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','DashboardItem','dashboard_items'];(function(_0x3901fa,_0x43d1e3){var _0x1c6c80=function(_0x1f1a44){while(--_0x1f1a44){_0x3901fa['push'](_0x3901fa['shift']());}};_0x1c6c80(++_0x43d1e3);}(_0x8e0e,0x176));var _0xe8e0=function(_0x4c7dc7,_0x1f0e2f){_0x4c7dc7=_0x4c7dc7-0x0;var _0xddef07=_0x8e0e[_0x4c7dc7];return _0xddef07;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xe8e0('0x0'))('api');var moment=require(_0xe8e0('0x1'));var BPromise=require(_0xe8e0('0x2'));var rp=require(_0xe8e0('0x3'));var fs=require('fs');var path=require(_0xe8e0('0x4'));var rimraf=require(_0xe8e0('0x5'));var config=require(_0xe8e0('0x6'));var attributes=require('./dashboardItem.attributes');module[_0xe8e0('0x7')]=function(_0x71adc6,_0x5cb6ea){return _0x71adc6[_0xe8e0('0x8')](_0xe8e0('0x9'),attributes,{'tableName':_0xe8e0('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.rpc.js b/server/api/dashboardItem/dashboardItem.rpc.js index 76e5909..5a1d6c7 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 _0x0012=['moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','info','DashboardItem,\x20%s,\x20%s','request\x20sent','debug','error','message','result','catch','lodash','util'];(function(_0xbd6e0f,_0x58fb03){var _0x3f5e97=function(_0x1d66dd){while(--_0x1d66dd){_0xbd6e0f['push'](_0xbd6e0f['shift']());}};_0x3f5e97(++_0x58fb03);}(_0x0012,0x127));var _0x2001=function(_0x39d576,_0xad8bca){_0x39d576=_0x39d576-0x0;var _0x38d81a=_0x0012[_0x39d576];return _0x38d81a;};'use strict';var _=require(_0x2001('0x0'));var util=require(_0x2001('0x1'));var moment=require(_0x2001('0x2'));var BPromise=require('bluebird');var rs=require(_0x2001('0x3'));var fs=require('fs');var Redis=require(_0x2001('0x4'));var db=require(_0x2001('0x5'))['db'];var utils=require(_0x2001('0x6'));var logger=require(_0x2001('0x7'))(_0x2001('0x8'));var config=require(_0x2001('0x9'));var jayson=require(_0x2001('0xa'));var client=jayson[_0x2001('0xb')][_0x2001('0xc')]({'port':0x232a});config[_0x2001('0xd')]=_[_0x2001('0xe')](config['redis'],{'host':_0x2001('0xf'),'port':0x18eb});var socket=require(_0x2001('0x10'))(new Redis(config[_0x2001('0xd')]));require('./dashboardItem.socket')[_0x2001('0x11')](socket);function respondWithRpcPromise(_0x4d57c3,_0x5620e8,_0x1e7b22){return new BPromise(function(_0xbd2348,_0x36bba4){return client[_0x2001('0x12')](_0x4d57c3,_0x1e7b22)['then'](function(_0x1f1060){logger[_0x2001('0x13')](_0x2001('0x14'),_0x5620e8,_0x2001('0x15'));logger[_0x2001('0x16')]('DashboardItem,\x20%s,\x20%s,\x20%s',_0x5620e8,'request\x20sent',JSON['stringify'](_0x1f1060));if(_0x1f1060[_0x2001('0x17')]){if(_0x1f1060[_0x2001('0x17')]['code']===0x1f4){logger[_0x2001('0x17')](_0x2001('0x14'),_0x5620e8,_0x1f1060[_0x2001('0x17')][_0x2001('0x18')]);return _0x36bba4(_0x1f1060[_0x2001('0x17')]['message']);}logger['error'](_0x2001('0x14'),_0x5620e8,_0x1f1060['error'][_0x2001('0x18')]);return _0xbd2348(_0x1f1060['error']['message']);}else{logger[_0x2001('0x13')](_0x2001('0x14'),_0x5620e8,_0x2001('0x15'));_0xbd2348(_0x1f1060[_0x2001('0x19')]['message']);}})[_0x2001('0x1a')](function(_0x115ae4){logger[_0x2001('0x17')](_0x2001('0x14'),_0x5620e8,_0x115ae4);_0x36bba4(_0x115ae4);});});} \ No newline at end of file +var _0x2de4=['rpc','../../config/environment','redis','localhost','./dashboardItem.socket','register','request','info','debug','DashboardItem,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','DashboardItem,\x20%s,\x20%s','message','result','catch','lodash','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x2b36bc,_0x382e97){var _0x4aafcd=function(_0x27c96b){while(--_0x27c96b){_0x2b36bc['push'](_0x2b36bc['shift']());}};_0x4aafcd(++_0x382e97);}(_0x2de4,0xd2));var _0x42de=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x2de4[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x42de('0x0'));var util=require('util');var moment=require(_0x42de('0x1'));var BPromise=require('bluebird');var rs=require(_0x42de('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x42de('0x3'))['db'];var utils=require(_0x42de('0x4'));var logger=require(_0x42de('0x5'))(_0x42de('0x6'));var config=require(_0x42de('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config['redis']=_['defaults'](config[_0x42de('0x8')],{'host':_0x42de('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x42de('0x8')]));require(_0x42de('0xa'))[_0x42de('0xb')](socket);function respondWithRpcPromise(_0x1f9e0c,_0x543778,_0x49eb31){return new BPromise(function(_0x1ac950,_0x432e08){return client[_0x42de('0xc')](_0x1f9e0c,_0x49eb31)['then'](function(_0x5d1f6b){logger[_0x42de('0xd')]('DashboardItem,\x20%s,\x20%s',_0x543778,'request\x20sent');logger[_0x42de('0xe')](_0x42de('0xf'),_0x543778,_0x42de('0x10'),JSON[_0x42de('0x11')](_0x5d1f6b));if(_0x5d1f6b['error']){if(_0x5d1f6b['error'][_0x42de('0x12')]===0x1f4){logger[_0x42de('0x13')](_0x42de('0x14'),_0x543778,_0x5d1f6b[_0x42de('0x13')][_0x42de('0x15')]);return _0x432e08(_0x5d1f6b[_0x42de('0x13')]['message']);}logger[_0x42de('0x13')](_0x42de('0x14'),_0x543778,_0x5d1f6b['error'][_0x42de('0x15')]);return _0x1ac950(_0x5d1f6b[_0x42de('0x13')][_0x42de('0x15')]);}else{logger['info']('DashboardItem,\x20%s,\x20%s',_0x543778,'request\x20sent');_0x1ac950(_0x5d1f6b[_0x42de('0x16')][_0x42de('0x15')]);}})[_0x42de('0x17')](function(_0x525156){logger['error'](_0x42de('0x14'),_0x543778,_0x525156);_0x432e08(_0x525156);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index 79c100a..061ddfb 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 _0x8413=['register','length','./dashboardItem.events','remove','update','removeListener'];(function(_0x5491e5,_0x37a869){var _0x214eb5=function(_0x13a469){while(--_0x13a469){_0x5491e5['push'](_0x5491e5['shift']());}};_0x214eb5(++_0x37a869);}(_0x8413,0x152));var _0x3841=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x8413[_0x6131cd];return _0x47e916;};'use strict';var DashboardItemEvents=require(_0x3841('0x0'));var events=['save',_0x3841('0x1'),_0x3841('0x2')];function createListener(_0x4b3e89,_0x330992){return function(_0x3498d5){_0x330992['emit'](_0x4b3e89,_0x3498d5);};}function removeListener(_0x52af13,_0x473c5d){return function(){DashboardItemEvents[_0x3841('0x3')](_0x52af13,_0x473c5d);};}exports[_0x3841('0x4')]=function(_0x725a04){for(var _0x3cc74b=0x0,_0x4f5e91=events[_0x3841('0x5')];_0x3cc74b<_0x4f5e91;_0x3cc74b++){var _0x5ea1cb=events[_0x3cc74b];var _0x892b8f=createListener('dashboardItem:'+_0x5ea1cb,_0x725a04);DashboardItemEvents['on'](_0x5ea1cb,_0x892b8f);}}; \ No newline at end of file +var _0x79b0=['register','./dashboardItem.events','emit','removeListener'];(function(_0x4e8369,_0x16e483){var _0x512f31=function(_0x397085){while(--_0x397085){_0x4e8369['push'](_0x4e8369['shift']());}};_0x512f31(++_0x16e483);}(_0x79b0,0x1c9));var _0x079b=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x79b0[_0x1facfa];return _0x9ec701;};'use strict';var DashboardItemEvents=require(_0x079b('0x0'));var events=['save','remove','update'];function createListener(_0x1216c8,_0xed4386){return function(_0x594e3f){_0xed4386[_0x079b('0x1')](_0x1216c8,_0x594e3f);};}function removeListener(_0x49ae5f,_0x17ae62){return function(){DashboardItemEvents[_0x079b('0x2')](_0x49ae5f,_0x17ae62);};}exports[_0x079b('0x3')]=function(_0x1ea701){for(var _0x25efaf=0x0,_0x171e11=events['length'];_0x25efaf<_0x171e11;_0x25efaf++){var _0x285c53=events[_0x25efaf];var _0xa0217a=createListener('dashboardItem:'+_0x285c53,_0x1ea701);DashboardItemEvents['on'](_0x285c53,_0xa0217a);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index e6780c5..5b6c75c 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 _0xe333=['create','put','update','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./dashboardItem.controller','get','/:id','isAuthenticated','show','post'];(function(_0x3566a3,_0x40cdaf){var _0x1ea920=function(_0x5ecbb1){while(--_0x5ecbb1){_0x3566a3['push'](_0x3566a3['shift']());}};_0x1ea920(++_0x40cdaf);}(_0xe333,0x1eb));var _0x3e33=function(_0x4d108b,_0x20fcfc){_0x4d108b=_0x4d108b-0x0;var _0x16c26c=_0xe333[_0x4d108b];return _0x16c26c;};'use strict';var multer=require(_0x3e33('0x0'));var util=require('util');var path=require(_0x3e33('0x1'));var timeout=require(_0x3e33('0x2'));var express=require(_0x3e33('0x3'));var router=express['Router']();var fs_extra=require(_0x3e33('0x4'));var auth=require(_0x3e33('0x5'));var interaction=require(_0x3e33('0x6'));var config=require('../../config/environment');var controller=require(_0x3e33('0x7'));router[_0x3e33('0x8')](_0x3e33('0x9'),auth[_0x3e33('0xa')](),controller[_0x3e33('0xb')]);router[_0x3e33('0xc')]('/',auth[_0x3e33('0xa')](),controller[_0x3e33('0xd')]);router[_0x3e33('0xe')](_0x3e33('0x9'),auth[_0x3e33('0xa')](),controller[_0x3e33('0xf')]);router['delete'](_0x3e33('0x9'),auth['isAuthenticated'](),controller[_0x3e33('0x10')]);module[_0x3e33('0x11')]=router; \ No newline at end of file +var _0xc28a=['update','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./dashboardItem.controller','get','/:id','show','create','isAuthenticated'];(function(_0x1c8fdc,_0x4210b1){var _0x39e241=function(_0x1c1faf){while(--_0x1c1faf){_0x1c8fdc['push'](_0x1c8fdc['shift']());}};_0x39e241(++_0x4210b1);}(_0xc28a,0x17a));var _0xac28=function(_0x29b15c,_0x3ac4f9){_0x29b15c=_0x29b15c-0x0;var _0x2022f7=_0xc28a[_0x29b15c];return _0x2022f7;};'use strict';var multer=require(_0xac28('0x0'));var util=require(_0xac28('0x1'));var path=require(_0xac28('0x2'));var timeout=require(_0xac28('0x3'));var express=require('express');var router=express[_0xac28('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xac28('0x5'));var config=require(_0xac28('0x6'));var controller=require(_0xac28('0x7'));router[_0xac28('0x8')](_0xac28('0x9'),auth['isAuthenticated'](),controller[_0xac28('0xa')]);router['post']('/',auth['isAuthenticated'](),controller[_0xac28('0xb')]);router['put'](_0xac28('0x9'),auth[_0xac28('0xc')](),controller[_0xac28('0xd')]);router[_0xac28('0xe')](_0xac28('0x9'),auth['isAuthenticated'](),controller[_0xac28('0xf')]);module[_0xac28('0x10')]=router; \ No newline at end of file diff --git a/server/api/disposition/disposition.attributes.js b/server/api/disposition/disposition.attributes.js index a8d9b6b..275866b 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 _0x0be6=['exports','STRING','ENUM','first','second','sequelize'];(function(_0x1e77ea,_0x5442bf){var _0x193925=function(_0x529587){while(--_0x529587){_0x1e77ea['push'](_0x1e77ea['shift']());}};_0x193925(++_0x5442bf);}(_0x0be6,0x1c7));var _0x60be=function(_0x11fbfe,_0x170dbb){_0x11fbfe=_0x11fbfe-0x0;var _0xc54685=_0x0be6[_0x11fbfe];return _0xc54685;};'use strict';var Sequelize=require(_0x60be('0x0'));module[_0x60be('0x1')]={'name':{'type':Sequelize[_0x60be('0x2')],'allowNull':![]},'level':{'type':Sequelize[_0x60be('0x3')](_0x60be('0x4'),_0x60be('0x5'),'third'),'allowNull':![],'defaultValue':'first'},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x9b25=['second','third','sequelize','STRING','ENUM','first'];(function(_0x390dad,_0x3a3e5a){var _0x490148=function(_0x4a2c87){while(--_0x4a2c87){_0x390dad['push'](_0x390dad['shift']());}};_0x490148(++_0x3a3e5a);}(_0x9b25,0x74));var _0x59b2=function(_0x58ea81,_0x8b5067){_0x58ea81=_0x58ea81-0x0;var _0x2c467c=_0x9b25[_0x58ea81];return _0x2c467c;};'use strict';var Sequelize=require(_0x59b2('0x0'));module['exports']={'name':{'type':Sequelize[_0x59b2('0x1')],'allowNull':![]},'level':{'type':Sequelize[_0x59b2('0x2')](_0x59b2('0x3'),_0x59b2('0x4'),_0x59b2('0x5')),'allowNull':![],'defaultValue':_0x59b2('0x3')},'description':{'type':Sequelize[_0x59b2('0x1')]}}; \ No newline at end of file diff --git a/server/api/disposition/disposition.controller.js b/server/api/disposition/disposition.controller.js index 3bb5af9..45278d5 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 _0xcc20=['map','Disposition','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','options','includeAll','include','rows','show','params','rawAttributes','find','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','eml-format','rimraf','fast-json-patch','request-promise','bluebird','path','sox','to-csv','fs-extra','lodash','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','sendStatus','status','undefined','count','offset','limit','set','Content-Range','json','apply','reject','save','then','destroy','get','Dispositions','end','error','name','send'];(function(_0x33302a,_0x5432ec){var _0x588bcc=function(_0x370cc2){while(--_0x370cc2){_0x33302a['push'](_0x33302a['shift']());}};_0x588bcc(++_0x5432ec);}(_0xcc20,0x114));var _0x0cc2=function(_0x2402b8,_0x574be8){_0x2402b8=_0x2402b8-0x0;var _0x378906=_0xcc20[_0x2402b8];return _0x378906;};'use strict';var emlformat=require(_0x0cc2('0x0'));var rimraf=require(_0x0cc2('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0cc2('0x2'));var rp=require(_0x0cc2('0x3'));var moment=require('moment');var BPromise=require(_0x0cc2('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x0cc2('0x5'));var sox=require(_0x0cc2('0x6'));var csv=require(_0x0cc2('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0cc2('0x8'));var _=require(_0x0cc2('0x9'));var squel=require('squel');var crypto=require(_0x0cc2('0xa'));var jsforce=require(_0x0cc2('0xb'));var deskjs=require(_0x0cc2('0xc'));var toCsv=require(_0x0cc2('0x7'));var querystring=require(_0x0cc2('0xd'));var Papa=require(_0x0cc2('0xe'));var Redis=require('ioredis');var authService=require(_0x0cc2('0xf'));var qs=require(_0x0cc2('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0cc2('0x11'));var logger=require(_0x0cc2('0x12'))(_0x0cc2('0x13'));var utils=require(_0x0cc2('0x14'));var config=require(_0x0cc2('0x15'));var licenseUtil=require(_0x0cc2('0x16'));var db=require(_0x0cc2('0x17'))['db'];function respondWithStatusCode(_0x2db4af,_0x23e350){_0x23e350=_0x23e350||0xcc;return function(_0x1ca175){if(_0x1ca175){return _0x2db4af[_0x0cc2('0x18')](_0x23e350);}return _0x2db4af['status'](_0x23e350)['end']();};}function respondWithResult(_0x50c282,_0x26a506){_0x26a506=_0x26a506||0xc8;return function(_0x39fb38){if(_0x39fb38){return _0x50c282[_0x0cc2('0x19')](_0x26a506)['json'](_0x39fb38);}};}function respondWithFilteredResult(_0x151644,_0x29b1fd){return function(_0x305d9e){if(_0x305d9e){var _0x2741aa=typeof _0x29b1fd['offset']===_0x0cc2('0x1a')&&typeof _0x29b1fd['limit']===_0x0cc2('0x1a');var _0x215c0e=_0x305d9e[_0x0cc2('0x1b')];var _0x48522a=_0x2741aa?0x0:_0x29b1fd['offset'];var _0xc04f31=_0x2741aa?_0x305d9e[_0x0cc2('0x1b')]:_0x29b1fd[_0x0cc2('0x1c')]+_0x29b1fd[_0x0cc2('0x1d')];var _0x1b1b0d;if(_0xc04f31>=_0x215c0e){_0xc04f31=_0x215c0e;_0x1b1b0d=0xc8;}else{_0x1b1b0d=0xce;}_0x151644[_0x0cc2('0x19')](_0x1b1b0d);return _0x151644[_0x0cc2('0x1e')](_0x0cc2('0x1f'),_0x48522a+'-'+_0xc04f31+'/'+_0x215c0e)[_0x0cc2('0x20')](_0x305d9e);}return null;};}function patchUpdates(_0x102cb2){return function(_0x2f7a42){try{jsonpatch[_0x0cc2('0x21')](_0x2f7a42,_0x102cb2,!![]);}catch(_0x234bc8){return BPromise[_0x0cc2('0x22')](_0x234bc8);}return _0x2f7a42[_0x0cc2('0x23')]();};}function saveUpdates(_0x533bc5,_0x3aefc5){return function(_0x350edd){if(_0x350edd){return _0x350edd['update'](_0x533bc5)[_0x0cc2('0x24')](function(_0x35793c){return _0x35793c;});}return null;};}function removeEntity(_0x18cad3,_0x52289f){return function(_0x50c68c){if(_0x50c68c){return _0x50c68c[_0x0cc2('0x25')]()['then'](function(){var _0x2f55c4=_0x50c68c[_0x0cc2('0x26')]({'plain':!![]});var _0x54702c=_0x0cc2('0x27');return db['UserProfileResource']['destroy']({'where':{'type':_0x54702c,'resourceId':_0x2f55c4['id']}})[_0x0cc2('0x24')](function(){return _0x50c68c;});})[_0x0cc2('0x24')](function(){_0x18cad3[_0x0cc2('0x19')](0xcc)[_0x0cc2('0x28')]();});}};}function handleEntityNotFound(_0x10c027,_0x230a43){return function(_0x1996da){if(!_0x1996da){_0x10c027['sendStatus'](0x194);}return _0x1996da;};}function handleError(_0x4239ae,_0x41c89a){_0x41c89a=_0x41c89a||0x1f4;return function(_0x5c7fb1){logger[_0x0cc2('0x29')](_0x5c7fb1['stack']);if(_0x5c7fb1[_0x0cc2('0x2a')]){delete _0x5c7fb1[_0x0cc2('0x2a')];}_0x4239ae[_0x0cc2('0x19')](_0x41c89a)[_0x0cc2('0x2b')](_0x5c7fb1);};}exports['index']=function(_0x3e3a53,_0x2d72ab){var _0x499174={},_0x57de66={},_0x52dfbf={'count':0x0,'rows':[]};var _0xc63152=_[_0x0cc2('0x2c')](db[_0x0cc2('0x2d')]['rawAttributes'],function(_0x34c28c){return{'name':_0x34c28c['fieldName'],'type':_0x34c28c['type'][_0x0cc2('0x2e')]};});_0x57de66[_0x0cc2('0x2f')]=_['map'](_0xc63152,'name');_0x57de66[_0x0cc2('0x30')]=_[_0x0cc2('0x31')](_0x3e3a53[_0x0cc2('0x30')]);_0x57de66['filters']=_[_0x0cc2('0x32')](_0x57de66['model'],_0x57de66[_0x0cc2('0x30')]);_0x499174[_0x0cc2('0x33')]=_['intersection'](_0x57de66[_0x0cc2('0x2f')],qs['fields'](_0x3e3a53[_0x0cc2('0x30')][_0x0cc2('0x34')]));_0x499174['attributes']=_0x499174[_0x0cc2('0x33')][_0x0cc2('0x35')]?_0x499174[_0x0cc2('0x33')]:_0x57de66['model'];if(!_0x3e3a53[_0x0cc2('0x30')][_0x0cc2('0x36')](_0x0cc2('0x37'))){_0x499174[_0x0cc2('0x1d')]=qs[_0x0cc2('0x1d')](_0x3e3a53[_0x0cc2('0x30')][_0x0cc2('0x1d')]);_0x499174[_0x0cc2('0x1c')]=qs['offset'](_0x3e3a53[_0x0cc2('0x30')][_0x0cc2('0x1c')]);}_0x499174[_0x0cc2('0x38')]=qs['sort'](_0x3e3a53[_0x0cc2('0x30')][_0x0cc2('0x39')]);_0x499174[_0x0cc2('0x3a')]=qs[_0x0cc2('0x3b')](_[_0x0cc2('0x3c')](_0x3e3a53['query'],_0x57de66[_0x0cc2('0x3b')]),_0xc63152);if(_0x3e3a53[_0x0cc2('0x30')][_0x0cc2('0x3d')]){_0x499174[_0x0cc2('0x3a')]=_['merge'](_0x499174[_0x0cc2('0x3a')],{'$or':_[_0x0cc2('0x2c')](_0xc63152,function(_0x59448e){if(_0x59448e['type']!=='VIRTUAL'){var _0x183865={};_0x183865[_0x59448e[_0x0cc2('0x2a')]]={'$like':'%'+_0x3e3a53[_0x0cc2('0x30')][_0x0cc2('0x3d')]+'%'};return _0x183865;}})});}_0x499174=_[_0x0cc2('0x3e')]({},_0x499174,_0x3e3a53[_0x0cc2('0x3f')]);var _0x4cfc24={'where':_0x499174['where']};return db['Disposition'][_0x0cc2('0x1b')](_0x4cfc24)[_0x0cc2('0x24')](function(_0x5ebaef){_0x52dfbf[_0x0cc2('0x1b')]=_0x5ebaef;if(_0x3e3a53[_0x0cc2('0x30')][_0x0cc2('0x40')]){_0x499174[_0x0cc2('0x41')]=[{'all':!![]}];}return db[_0x0cc2('0x2d')]['findAll'](_0x499174);})[_0x0cc2('0x24')](function(_0x3f3453){_0x52dfbf[_0x0cc2('0x42')]=_0x3f3453;return _0x52dfbf;})[_0x0cc2('0x24')](respondWithFilteredResult(_0x2d72ab,_0x499174))['catch'](handleError(_0x2d72ab,null));};exports[_0x0cc2('0x43')]=function(_0x1d646b,_0x4f05bf){var _0x3c95e9={'raw':!![],'where':{'id':_0x1d646b[_0x0cc2('0x44')]['id']}},_0x3c6e1d={};_0x3c6e1d['model']=_[_0x0cc2('0x31')](db[_0x0cc2('0x2d')][_0x0cc2('0x45')]);_0x3c6e1d[_0x0cc2('0x30')]=_[_0x0cc2('0x31')](_0x1d646b[_0x0cc2('0x30')]);_0x3c6e1d[_0x0cc2('0x3b')]=_['intersection'](_0x3c6e1d[_0x0cc2('0x2f')],_0x3c6e1d[_0x0cc2('0x30')]);_0x3c95e9['attributes']=_[_0x0cc2('0x32')](_0x3c6e1d['model'],qs[_0x0cc2('0x34')](_0x1d646b[_0x0cc2('0x30')][_0x0cc2('0x34')]));_0x3c95e9[_0x0cc2('0x33')]=_0x3c95e9[_0x0cc2('0x33')]['length']?_0x3c95e9[_0x0cc2('0x33')]:_0x3c6e1d[_0x0cc2('0x2f')];if(_0x1d646b[_0x0cc2('0x30')]['includeAll']){_0x3c95e9['include']=[{'all':!![]}];}_0x3c95e9=_[_0x0cc2('0x3e')]({},_0x3c95e9,_0x1d646b[_0x0cc2('0x3f')]);return db[_0x0cc2('0x2d')][_0x0cc2('0x46')](_0x3c95e9)[_0x0cc2('0x24')](handleEntityNotFound(_0x4f05bf,null))[_0x0cc2('0x24')](respondWithResult(_0x4f05bf,null))[_0x0cc2('0x47')](handleError(_0x4f05bf,null));};exports['create']=function(_0x3b74bb,_0x493f3a){return db[_0x0cc2('0x2d')][_0x0cc2('0x48')](_0x3b74bb[_0x0cc2('0x49')],{})[_0x0cc2('0x24')](function(_0x2f6404){var _0x304bc1=_0x3b74bb['user'][_0x0cc2('0x26')]({'plain':!![]});if(!_0x304bc1)throw new Error(_0x0cc2('0x4a'));if(_0x304bc1['role']==='user'){var _0x26acc8=_0x2f6404[_0x0cc2('0x26')]({'plain':!![]});var _0x249272=_0x0cc2('0x27');return db[_0x0cc2('0x4b')][_0x0cc2('0x46')]({'where':{'name':_0x249272,'userProfileId':_0x304bc1['userProfileId']},'raw':!![]})[_0x0cc2('0x24')](function(_0x29cc29){if(_0x29cc29&&_0x29cc29[_0x0cc2('0x4c')]===0x0){return db[_0x0cc2('0x4d')][_0x0cc2('0x48')]({'name':_0x26acc8[_0x0cc2('0x2a')],'resourceId':_0x26acc8['id'],'type':_0x29cc29[_0x0cc2('0x2a')],'sectionId':_0x29cc29['id']},{})['then'](function(){return _0x2f6404;});}else{return _0x2f6404;}})[_0x0cc2('0x47')](function(_0x3d36d7){logger['error'](_0x0cc2('0x4e'),_0x3d36d7);throw _0x3d36d7;});}return _0x2f6404;})[_0x0cc2('0x24')](respondWithResult(_0x493f3a,0xc9))[_0x0cc2('0x47')](handleError(_0x493f3a,null));};exports[_0x0cc2('0x4f')]=function(_0xa0101a,_0x4b2e75){if(_0xa0101a[_0x0cc2('0x49')]['id']){delete _0xa0101a[_0x0cc2('0x49')]['id'];}return db['Disposition'][_0x0cc2('0x46')]({'where':{'id':_0xa0101a['params']['id']}})['then'](handleEntityNotFound(_0x4b2e75,null))['then'](saveUpdates(_0xa0101a[_0x0cc2('0x49')],null))[_0x0cc2('0x24')](respondWithResult(_0x4b2e75,null))[_0x0cc2('0x47')](handleError(_0x4b2e75,null));};exports[_0x0cc2('0x25')]=function(_0x506f53,_0x243fba){return db['Disposition'][_0x0cc2('0x46')]({'where':{'id':_0x506f53[_0x0cc2('0x44')]['id']}})[_0x0cc2('0x24')](handleEntityNotFound(_0x243fba,null))[_0x0cc2('0x24')](removeEntity(_0x243fba,null))[_0x0cc2('0x47')](handleError(_0x243fba,null));}; \ No newline at end of file +var _0xcafb=['Disposition','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','offset','undefined','count','limit','set','Content-Range','json','apply','reject','update','then','get','Dispositions','destroy','end','sendStatus','error','stack','name','send','index','map'];(function(_0x2fe5b9,_0x127e48){var _0x6f874=function(_0x23f8e7){while(--_0x23f8e7){_0x2fe5b9['push'](_0x2fe5b9['shift']());}};_0x6f874(++_0x127e48);}(_0xcafb,0x188));var _0xbcaf=function(_0x1501ee,_0x1627f4){_0x1501ee=_0x1501ee-0x0;var _0x4fe224=_0xcafb[_0x1501ee];return _0x4fe224;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xbcaf('0x0'));var zipdir=require(_0xbcaf('0x1'));var jsonpatch=require(_0xbcaf('0x2'));var rp=require(_0xbcaf('0x3'));var moment=require(_0xbcaf('0x4'));var BPromise=require(_0xbcaf('0x5'));var Mustache=require(_0xbcaf('0x6'));var util=require('util');var path=require(_0xbcaf('0x7'));var sox=require(_0xbcaf('0x8'));var csv=require(_0xbcaf('0x9'));var ejs=require(_0xbcaf('0xa'));var fs=require('fs');var fs_extra=require(_0xbcaf('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xbcaf('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xbcaf('0xd'));var toCsv=require(_0xbcaf('0x9'));var querystring=require(_0xbcaf('0xe'));var Papa=require(_0xbcaf('0xf'));var Redis=require(_0xbcaf('0x10'));var authService=require(_0xbcaf('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xbcaf('0x12'));var hardwareService=require(_0xbcaf('0x13'));var logger=require(_0xbcaf('0x14'))('api');var utils=require(_0xbcaf('0x15'));var config=require(_0xbcaf('0x16'));var licenseUtil=require(_0xbcaf('0x17'));var db=require(_0xbcaf('0x18'))['db'];function respondWithStatusCode(_0x15db82,_0x5be89f){_0x5be89f=_0x5be89f||0xcc;return function(_0x21ad45){if(_0x21ad45){return _0x15db82['sendStatus'](_0x5be89f);}return _0x15db82[_0xbcaf('0x19')](_0x5be89f)['end']();};}function respondWithResult(_0x5291e0,_0xd42af6){_0xd42af6=_0xd42af6||0xc8;return function(_0x3f10f4){if(_0x3f10f4){return _0x5291e0[_0xbcaf('0x19')](_0xd42af6)['json'](_0x3f10f4);}};}function respondWithFilteredResult(_0x593d9d,_0x41dfde){return function(_0x4507d9){if(_0x4507d9){var _0x4e4a65=typeof _0x41dfde[_0xbcaf('0x1a')]==='undefined'&&typeof _0x41dfde['limit']===_0xbcaf('0x1b');var _0x2c5efc=_0x4507d9[_0xbcaf('0x1c')];var _0x1f7862=_0x4e4a65?0x0:_0x41dfde[_0xbcaf('0x1a')];var _0x5d6e09=_0x4e4a65?_0x4507d9[_0xbcaf('0x1c')]:_0x41dfde['offset']+_0x41dfde[_0xbcaf('0x1d')];var _0x5b026a;if(_0x5d6e09>=_0x2c5efc){_0x5d6e09=_0x2c5efc;_0x5b026a=0xc8;}else{_0x5b026a=0xce;}_0x593d9d['status'](_0x5b026a);return _0x593d9d[_0xbcaf('0x1e')](_0xbcaf('0x1f'),_0x1f7862+'-'+_0x5d6e09+'/'+_0x2c5efc)[_0xbcaf('0x20')](_0x4507d9);}return null;};}function patchUpdates(_0x3772b3){return function(_0x5d93c0){try{jsonpatch[_0xbcaf('0x21')](_0x5d93c0,_0x3772b3,!![]);}catch(_0x3ce683){return BPromise[_0xbcaf('0x22')](_0x3ce683);}return _0x5d93c0['save']();};}function saveUpdates(_0x1f97ac,_0x19ce71){return function(_0x45714a){if(_0x45714a){return _0x45714a[_0xbcaf('0x23')](_0x1f97ac)[_0xbcaf('0x24')](function(_0x23574f){return _0x23574f;});}return null;};}function removeEntity(_0x32ad8a,_0x1306d1){return function(_0x44b462){if(_0x44b462){return _0x44b462['destroy']()['then'](function(){var _0x41f397=_0x44b462[_0xbcaf('0x25')]({'plain':!![]});var _0xe0c35f=_0xbcaf('0x26');return db['UserProfileResource'][_0xbcaf('0x27')]({'where':{'type':_0xe0c35f,'resourceId':_0x41f397['id']}})[_0xbcaf('0x24')](function(){return _0x44b462;});})[_0xbcaf('0x24')](function(){_0x32ad8a[_0xbcaf('0x19')](0xcc)[_0xbcaf('0x28')]();});}};}function handleEntityNotFound(_0x5b5980,_0x5652ba){return function(_0x44f856){if(!_0x44f856){_0x5b5980[_0xbcaf('0x29')](0x194);}return _0x44f856;};}function handleError(_0x1a8db4,_0x37b6fe){_0x37b6fe=_0x37b6fe||0x1f4;return function(_0xefc6f5){logger[_0xbcaf('0x2a')](_0xefc6f5[_0xbcaf('0x2b')]);if(_0xefc6f5[_0xbcaf('0x2c')]){delete _0xefc6f5[_0xbcaf('0x2c')];}_0x1a8db4[_0xbcaf('0x19')](_0x37b6fe)[_0xbcaf('0x2d')](_0xefc6f5);};}exports[_0xbcaf('0x2e')]=function(_0x5dc2c3,_0x73631f){var _0x292236={},_0xddfd02={},_0x3041d8={'count':0x0,'rows':[]};var _0x1b0dd6=_[_0xbcaf('0x2f')](db[_0xbcaf('0x30')][_0xbcaf('0x31')],function(_0x6b45c4){return{'name':_0x6b45c4[_0xbcaf('0x32')],'type':_0x6b45c4[_0xbcaf('0x33')][_0xbcaf('0x34')]};});_0xddfd02[_0xbcaf('0x35')]=_[_0xbcaf('0x2f')](_0x1b0dd6,_0xbcaf('0x2c'));_0xddfd02[_0xbcaf('0x36')]=_[_0xbcaf('0x37')](_0x5dc2c3[_0xbcaf('0x36')]);_0xddfd02[_0xbcaf('0x38')]=_[_0xbcaf('0x39')](_0xddfd02['model'],_0xddfd02[_0xbcaf('0x36')]);_0x292236['attributes']=_['intersection'](_0xddfd02[_0xbcaf('0x35')],qs[_0xbcaf('0x3a')](_0x5dc2c3[_0xbcaf('0x36')][_0xbcaf('0x3a')]));_0x292236[_0xbcaf('0x3b')]=_0x292236[_0xbcaf('0x3b')][_0xbcaf('0x3c')]?_0x292236[_0xbcaf('0x3b')]:_0xddfd02[_0xbcaf('0x35')];if(!_0x5dc2c3[_0xbcaf('0x36')][_0xbcaf('0x3d')](_0xbcaf('0x3e'))){_0x292236['limit']=qs[_0xbcaf('0x1d')](_0x5dc2c3[_0xbcaf('0x36')][_0xbcaf('0x1d')]);_0x292236['offset']=qs['offset'](_0x5dc2c3[_0xbcaf('0x36')][_0xbcaf('0x1a')]);}_0x292236[_0xbcaf('0x3f')]=qs[_0xbcaf('0x40')](_0x5dc2c3[_0xbcaf('0x36')]['sort']);_0x292236[_0xbcaf('0x41')]=qs['filters'](_[_0xbcaf('0x42')](_0x5dc2c3['query'],_0xddfd02[_0xbcaf('0x38')]),_0x1b0dd6);if(_0x5dc2c3[_0xbcaf('0x36')][_0xbcaf('0x43')]){_0x292236[_0xbcaf('0x41')]=_[_0xbcaf('0x44')](_0x292236[_0xbcaf('0x41')],{'$or':_[_0xbcaf('0x2f')](_0x1b0dd6,function(_0x52087b){if(_0x52087b[_0xbcaf('0x33')]!==_0xbcaf('0x45')){var _0x255fde={};_0x255fde[_0x52087b['name']]={'$like':'%'+_0x5dc2c3[_0xbcaf('0x36')][_0xbcaf('0x43')]+'%'};return _0x255fde;}})});}_0x292236=_[_0xbcaf('0x44')]({},_0x292236,_0x5dc2c3[_0xbcaf('0x46')]);var _0x3aea16={'where':_0x292236[_0xbcaf('0x41')]};return db[_0xbcaf('0x30')]['count'](_0x3aea16)['then'](function(_0x94deb9){_0x3041d8[_0xbcaf('0x1c')]=_0x94deb9;if(_0x5dc2c3['query'][_0xbcaf('0x47')]){_0x292236[_0xbcaf('0x48')]=[{'all':!![]}];}return db[_0xbcaf('0x30')][_0xbcaf('0x49')](_0x292236);})['then'](function(_0x28f144){_0x3041d8[_0xbcaf('0x4a')]=_0x28f144;return _0x3041d8;})[_0xbcaf('0x24')](respondWithFilteredResult(_0x73631f,_0x292236))[_0xbcaf('0x4b')](handleError(_0x73631f,null));};exports[_0xbcaf('0x4c')]=function(_0x29ac9c,_0x4a8798){var _0x41efa8={'raw':!![],'where':{'id':_0x29ac9c[_0xbcaf('0x4d')]['id']}},_0x5bc15f={};_0x5bc15f[_0xbcaf('0x35')]=_[_0xbcaf('0x37')](db[_0xbcaf('0x30')]['rawAttributes']);_0x5bc15f[_0xbcaf('0x36')]=_[_0xbcaf('0x37')](_0x29ac9c[_0xbcaf('0x36')]);_0x5bc15f['filters']=_[_0xbcaf('0x39')](_0x5bc15f[_0xbcaf('0x35')],_0x5bc15f[_0xbcaf('0x36')]);_0x41efa8[_0xbcaf('0x3b')]=_[_0xbcaf('0x39')](_0x5bc15f[_0xbcaf('0x35')],qs[_0xbcaf('0x3a')](_0x29ac9c['query'][_0xbcaf('0x3a')]));_0x41efa8[_0xbcaf('0x3b')]=_0x41efa8[_0xbcaf('0x3b')]['length']?_0x41efa8[_0xbcaf('0x3b')]:_0x5bc15f[_0xbcaf('0x35')];if(_0x29ac9c[_0xbcaf('0x36')][_0xbcaf('0x47')]){_0x41efa8[_0xbcaf('0x48')]=[{'all':!![]}];}_0x41efa8=_['merge']({},_0x41efa8,_0x29ac9c[_0xbcaf('0x46')]);return db[_0xbcaf('0x30')][_0xbcaf('0x4e')](_0x41efa8)['then'](handleEntityNotFound(_0x4a8798,null))[_0xbcaf('0x24')](respondWithResult(_0x4a8798,null))[_0xbcaf('0x4b')](handleError(_0x4a8798,null));};exports['create']=function(_0x35b613,_0x92dca7){return db[_0xbcaf('0x30')][_0xbcaf('0x4f')](_0x35b613['body'],{})['then'](function(_0x16d961){var _0x5e2765=_0x35b613['user']['get']({'plain':!![]});if(!_0x5e2765)throw new Error(_0xbcaf('0x50'));if(_0x5e2765[_0xbcaf('0x51')]===_0xbcaf('0x52')){var _0x4868a8=_0x16d961['get']({'plain':!![]});var _0x3a0370=_0xbcaf('0x26');return db[_0xbcaf('0x53')][_0xbcaf('0x4e')]({'where':{'name':_0x3a0370,'userProfileId':_0x5e2765['userProfileId']},'raw':!![]})['then'](function(_0x3eb41b){if(_0x3eb41b&&_0x3eb41b[_0xbcaf('0x54')]===0x0){return db[_0xbcaf('0x55')][_0xbcaf('0x4f')]({'name':_0x4868a8[_0xbcaf('0x2c')],'resourceId':_0x4868a8['id'],'type':_0x3eb41b[_0xbcaf('0x2c')],'sectionId':_0x3eb41b['id']},{})['then'](function(){return _0x16d961;});}else{return _0x16d961;}})[_0xbcaf('0x4b')](function(_0x48b065){logger['error'](_0xbcaf('0x56'),_0x48b065);throw _0x48b065;});}return _0x16d961;})[_0xbcaf('0x24')](respondWithResult(_0x92dca7,0xc9))['catch'](handleError(_0x92dca7,null));};exports['update']=function(_0xdc4c0a,_0x2cf357){if(_0xdc4c0a[_0xbcaf('0x57')]['id']){delete _0xdc4c0a[_0xbcaf('0x57')]['id'];}return db['Disposition'][_0xbcaf('0x4e')]({'where':{'id':_0xdc4c0a[_0xbcaf('0x4d')]['id']}})[_0xbcaf('0x24')](handleEntityNotFound(_0x2cf357,null))[_0xbcaf('0x24')](saveUpdates(_0xdc4c0a[_0xbcaf('0x57')],null))[_0xbcaf('0x24')](respondWithResult(_0x2cf357,null))['catch'](handleError(_0x2cf357,null));};exports['destroy']=function(_0x22a0e3,_0x2e653b){return db[_0xbcaf('0x30')][_0xbcaf('0x4e')]({'where':{'id':_0x22a0e3['params']['id']}})[_0xbcaf('0x24')](handleEntityNotFound(_0x2e653b,null))[_0xbcaf('0x24')](removeEntity(_0x2e653b,null))[_0xbcaf('0x4b')](handleError(_0x2e653b,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index 258c9b2..68e306c 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 _0xa633=['ListId','name_chat','ChatWebsiteId','name_mail','MailAccountId','SmsAccountId','name_fax','FaxAccountId','name_openchannel','WhatsappAccountId','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./disposition.attributes','Disposition','name_voice','name'];(function(_0x1b4057,_0x58212a){var _0x1d749a=function(_0x1fa30b){while(--_0x1fa30b){_0x1b4057['push'](_0x1b4057['shift']());}};_0x1d749a(++_0x58212a);}(_0xa633,0x128));var _0x3a63=function(_0x567709,_0x6ec004){_0x567709=_0x567709-0x0;var _0x1d2cdb=_0xa633[_0x567709];return _0x1d2cdb;};'use strict';var _=require(_0x3a63('0x0'));var util=require(_0x3a63('0x1'));var logger=require(_0x3a63('0x2'))('api');var moment=require(_0x3a63('0x3'));var BPromise=require(_0x3a63('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3a63('0x5'));var rimraf=require(_0x3a63('0x6'));var config=require(_0x3a63('0x7'));var attributes=require(_0x3a63('0x8'));module['exports']=function(_0x130d7f,_0x94a681){return _0x130d7f['define'](_0x3a63('0x9'),attributes,{'tableName':'tools_dispositions','paranoid':![],'indexes':[{'unique':!![],'name':_0x3a63('0xa'),'fields':[_0x3a63('0xb'),_0x3a63('0xc')]},{'unique':!![],'name':_0x3a63('0xd'),'fields':['name',_0x3a63('0xe')]},{'unique':!![],'name':_0x3a63('0xf'),'fields':[_0x3a63('0xb'),_0x3a63('0x10')]},{'unique':!![],'name':'name_sms','fields':[_0x3a63('0xb'),_0x3a63('0x11')]},{'unique':!![],'name':_0x3a63('0x12'),'fields':[_0x3a63('0xb'),_0x3a63('0x13')]},{'unique':!![],'name':_0x3a63('0x14'),'fields':['name','OpenchannelAccountId']},{'unique':!![],'name':'name_whatsapp','fields':[_0x3a63('0xb'),_0x3a63('0x15')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc502=['bluebird','request-promise','path','rimraf','exports','define','tools_dispositions','name_voice','name','ListId','name_chat','ChatWebsiteId','name_mail','MailAccountId','name_sms','name_fax','name_openchannel','name_whatsapp','lodash','../../config/logger','api','moment'];(function(_0xb4535f,_0x5d8a20){var _0x398acf=function(_0x125bb8){while(--_0x125bb8){_0xb4535f['push'](_0xb4535f['shift']());}};_0x398acf(++_0x5d8a20);}(_0xc502,0xee));var _0x2c50=function(_0x41e45d,_0x1ee3b0){_0x41e45d=_0x41e45d-0x0;var _0x4d3aac=_0xc502[_0x41e45d];return _0x4d3aac;};'use strict';var _=require(_0x2c50('0x0'));var util=require('util');var logger=require(_0x2c50('0x1'))(_0x2c50('0x2'));var moment=require(_0x2c50('0x3'));var BPromise=require(_0x2c50('0x4'));var rp=require(_0x2c50('0x5'));var fs=require('fs');var path=require(_0x2c50('0x6'));var rimraf=require(_0x2c50('0x7'));var config=require('../../config/environment');var attributes=require('./disposition.attributes');module[_0x2c50('0x8')]=function(_0x2c9e62,_0x570c6e){return _0x2c9e62[_0x2c50('0x9')]('Disposition',attributes,{'tableName':_0x2c50('0xa'),'paranoid':![],'indexes':[{'unique':!![],'name':_0x2c50('0xb'),'fields':[_0x2c50('0xc'),_0x2c50('0xd')]},{'unique':!![],'name':_0x2c50('0xe'),'fields':[_0x2c50('0xc'),_0x2c50('0xf')]},{'unique':!![],'name':_0x2c50('0x10'),'fields':['name',_0x2c50('0x11')]},{'unique':!![],'name':_0x2c50('0x12'),'fields':[_0x2c50('0xc'),'SmsAccountId']},{'unique':!![],'name':_0x2c50('0x13'),'fields':[_0x2c50('0xc'),'FaxAccountId']},{'unique':!![],'name':_0x2c50('0x14'),'fields':['name','OpenchannelAccountId']},{'unique':!![],'name':_0x2c50('0x15'),'fields':[_0x2c50('0xc'),'WhatsappAccountId']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/disposition/disposition.rpc.js b/server/api/disposition/disposition.rpc.js index c805c17..e46e804 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(_0x2a9a86,_0x36780d){var _0x278e71=function(_0x2b716c){while(--_0x2b716c){_0x2a9a86['push'](_0x2a9a86['shift']());}};_0x278e71(++_0x36780d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3a6efd,_0x2a5102){_0x3a6efd=_0x3a6efd-0x0;var _0x487b9a=_0xa9e0[_0x3a6efd];return _0x487b9a;};'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(_0x5e58ea,_0x671fee){var _0x42ba2b=function(_0x151ef1){while(--_0x151ef1){_0x5e58ea['push'](_0x5e58ea['shift']());}};_0x42ba2b(++_0x671fee);}(_0xa9e0,0x123));var _0x0a9e=function(_0x54d4fe,_0x55e869){_0x54d4fe=_0x54d4fe-0x0;var _0x1ab5bb=_0xa9e0[_0x54d4fe];return _0x1ab5bb;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file diff --git a/server/api/disposition/index.js b/server/api/disposition/index.js index fa6bc04..f69ef79 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 _0xc035=['show','post','isAuthenticated','update','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','get','/:id'];(function(_0x214266,_0x1f6f52){var _0x568f75=function(_0x541904){while(--_0x541904){_0x214266['push'](_0x214266['shift']());}};_0x568f75(++_0x1f6f52);}(_0xc035,0xf6));var _0x5c03=function(_0x116b75,_0x4d994e){_0x116b75=_0x116b75-0x0;var _0x4e4eee=_0xc035[_0x116b75];return _0x4e4eee;};'use strict';var multer=require(_0x5c03('0x0'));var util=require('util');var path=require(_0x5c03('0x1'));var timeout=require(_0x5c03('0x2'));var express=require(_0x5c03('0x3'));var router=express['Router']();var fs_extra=require(_0x5c03('0x4'));var auth=require(_0x5c03('0x5'));var interaction=require(_0x5c03('0x6'));var config=require('../../config/environment');var controller=require('./disposition.controller');router[_0x5c03('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0x5c03('0x7')](_0x5c03('0x8'),auth['isAuthenticated'](),controller[_0x5c03('0x9')]);router[_0x5c03('0xa')]('/',auth[_0x5c03('0xb')](),controller['create']);router['put']('/:id',auth[_0x5c03('0xb')](),controller[_0x5c03('0xc')]);router['delete'](_0x5c03('0x8'),auth[_0x5c03('0xb')](),controller[_0x5c03('0xd')]);module[_0x5c03('0xe')]=router; \ No newline at end of file +var _0xd1e8=['delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./disposition.controller','get','index','/:id','show','post','isAuthenticated','put'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd1e8,0xed));var _0x8d1e=function(_0x281386,_0x1a98ac){_0x281386=_0x281386-0x0;var _0x43077e=_0xd1e8[_0x281386];return _0x43077e;};'use strict';var multer=require(_0x8d1e('0x0'));var util=require(_0x8d1e('0x1'));var path=require('path');var timeout=require(_0x8d1e('0x2'));var express=require(_0x8d1e('0x3'));var router=express[_0x8d1e('0x4')]();var fs_extra=require(_0x8d1e('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x8d1e('0x6'));var config=require('../../config/environment');var controller=require(_0x8d1e('0x7'));router[_0x8d1e('0x8')]('/',auth['isAuthenticated'](),controller[_0x8d1e('0x9')]);router['get'](_0x8d1e('0xa'),auth['isAuthenticated'](),controller[_0x8d1e('0xb')]);router[_0x8d1e('0xc')]('/',auth[_0x8d1e('0xd')](),controller['create']);router[_0x8d1e('0xe')](_0x8d1e('0xa'),auth['isAuthenticated'](),controller['update']);router[_0x8d1e('0xf')](_0x8d1e('0xa'),auth[_0x8d1e('0xd')](),controller[_0x8d1e('0x10')]);module[_0x8d1e('0x11')]=router; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.attributes.js b/server/api/faxAccount/faxAccount.attributes.js index 2b706f7..0e7a616 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 _0x2005=['mandatoryDisposition','sequelize','exports','STRING','ENUM','xCALLY\x20Motion\x20Fax','localstationid','2400','4800','7200','9600','14400','12000','v17,v27,v29','SIP','IAX','DADHI','KHOMP','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(_0x5eb045,_0x44506e){var _0x270fb9=function(_0xfe4320){while(--_0xfe4320){_0x5eb045['push'](_0x5eb045['shift']());}};_0x270fb9(++_0x44506e);}(_0x2005,0xc9));var _0x5200=function(_0x391635,_0x25d933){_0x391635=_0x391635-0x0;var _0x11c075=_0x2005[_0x391635];return _0x11c075;};'use strict';var Sequelize=require(_0x5200('0x0'));module[_0x5200('0x1')]={'name':{'type':Sequelize[_0x5200('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x5200('0x2')]},'ecm':{'type':Sequelize[_0x5200('0x3')]('yes','no'),'defaultValue':'yes'},'headerinfo':{'type':Sequelize[_0x5200('0x2')],'defaultValue':_0x5200('0x4')},'localstationid':{'type':Sequelize['STRING'],'unique':_0x5200('0x5')},'minrate':{'type':Sequelize['ENUM'](_0x5200('0x6'),_0x5200('0x7'),_0x5200('0x8'),_0x5200('0x9'),'12000',_0x5200('0xa')),'defaultValue':_0x5200('0x7')},'maxrate':{'type':Sequelize[_0x5200('0x3')](_0x5200('0x6'),_0x5200('0x7'),_0x5200('0x8'),_0x5200('0x9'),_0x5200('0xb'),_0x5200('0xa')),'defaultValue':'14400'},'modem':{'type':Sequelize['STRING'],'defaultValue':_0x5200('0xc')},'gateway':{'type':Sequelize[_0x5200('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x5200('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize['INTEGER'],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x5200('0x3')](_0x5200('0xd'),_0x5200('0xe'),_0x5200('0xf'),_0x5200('0x10')),'defaultValue':'SIP'},'key':{'type':Sequelize[_0x5200('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x5200('0x11')],'defaultValue':function(){return _0x5200('0x12');}},'notificationSound':{'type':Sequelize[_0x5200('0x13')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x5200('0x13')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x5200('0x14')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x5200('0x13')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x5200('0x14')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x5200('0x13')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x5200('0x14')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x5200('0x14')],'allowNull':!![],'defaultValue':null,'comment':_0x5200('0x15')},'mandatoryDisposition':{'type':Sequelize[_0x5200('0x13')],'defaultValue':![],'comment':_0x5200('0x16'),'set':function(_0xa8a1bf){if(!_0xa8a1bf)this['setDataValue']('mandatoryDispositionPauseId',null);this[_0x5200('0x17')](_0x5200('0x18'),_0xa8a1bf);}}}; \ 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(_0x55bc6e,_0x179ede){var _0x30344d=function(_0x18d459){while(--_0x18d459){_0x55bc6e['push'](_0x55bc6e['shift']());}};_0x30344d(++_0x179ede);}(_0x407f,0x8a));var _0xf407=function(_0x553f1e,_0x3a2402){_0x553f1e=_0x553f1e-0x0;var _0x1edf1b=_0x407f[_0x553f1e];return _0x1edf1b;};'use strict';var Sequelize=require(_0xf407('0x0'));module[_0xf407('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xf407('0x2')]},'ecm':{'type':Sequelize[_0xf407('0x3')](_0xf407('0x4'),'no'),'defaultValue':_0xf407('0x4')},'headerinfo':{'type':Sequelize[_0xf407('0x2')],'defaultValue':_0xf407('0x5')},'localstationid':{'type':Sequelize[_0xf407('0x2')],'unique':_0xf407('0x6')},'minrate':{'type':Sequelize[_0xf407('0x3')](_0xf407('0x7'),_0xf407('0x8'),_0xf407('0x9'),_0xf407('0xa'),_0xf407('0xb'),_0xf407('0xc')),'defaultValue':_0xf407('0x8')},'maxrate':{'type':Sequelize[_0xf407('0x3')](_0xf407('0x7'),_0xf407('0x8'),_0xf407('0x9'),_0xf407('0xa'),_0xf407('0xb'),_0xf407('0xc')),'defaultValue':'14400'},'modem':{'type':Sequelize[_0xf407('0x2')],'defaultValue':_0xf407('0xd')},'gateway':{'type':Sequelize['STRING'],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize['STRING'],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0xf407('0xe')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0xf407('0x3')]('SIP','IAX',_0xf407('0xf'),'KHOMP'),'defaultValue':_0xf407('0x10')},'key':{'type':Sequelize[_0xf407('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xf407('0x11')],'defaultValue':function(){return _0xf407('0x12');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xf407('0x13')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xf407('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xf407('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xf407('0x13')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xf407('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0xf407('0x14')},'mandatoryDisposition':{'type':Sequelize[_0xf407('0x13')],'defaultValue':![],'comment':_0xf407('0x15'),'set':function(_0x5415f5){if(!_0x5415f5)this[_0xf407('0x16')](_0xf407('0x17'),null);this[_0xf407('0x16')](_0xf407('0x18'),_0x5415f5);}}}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index 61d16c8..251ca45 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 _0x384b=['Tags','color','tag','addApplications','sequelize','FaxApplication','bulkCreate','findAndCountAll','getApplications','context','from-voip-provider','exten','localstationid','app','system','description','priority','appdata','push','Answer','Set','ecm','headerinfo','maxrate','minrate','t38timeout','FAXOPT(','Wait','transaction','VoiceExtension','key','createdAt','updatedAt','TrunkId','ListId','findById','getMessages','$gte','split','format','FaxMessage','send','CmList','Contacts','attachments','join','root','server/files/attachments','basename','CheckAfterSend','isNil','from','\x22%s\x22\x20<%s>','fax','List','defaults','List\x20not\x20found','out','filename','Messages','Contact\x20not\x20found','spread','ContactId','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','emit','userFaxAccount:save','removeAgents','isArray','userFaxAccount:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./faxAccount.socket','register','client','http','request','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','sendStatus','status','end','json','limit','undefined','count','set','Content-Range','apply','save','update','destroy','get','FaxAccounts','UserProfileResource','stack','name','index','mandatoryDispositionPause','map','FaxAccount','type','query','filters','intersection','model','fields','length','attributes','hasOwnProperty','nolimit','offset','order','sort','pick','filter','where','merge','VIRTUAL','include','findAll','rows','params','Pause','keys','rawAttributes','includeAll','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','FaxAccountId','getDispositions','findOne','Disposition','removeDispositions','ids','addAnswer','CannedAnswer','removeAnswers','addInteraction','FaxInteraction','omit','getInteractions','CmContact','Contact','User','Owner','fullname','internal','Tag'];(function(_0x1203f,_0x554bbc){var _0x365f0a=function(_0x3531d0){while(--_0x3531d0){_0x1203f['push'](_0x1203f['shift']());}};_0x365f0a(++_0x554bbc);}(_0x384b,0x1d7));var _0xb384=function(_0x54e570,_0x4713d6){_0x54e570=_0x54e570-0x0;var _0x426b77=_0x384b[_0x54e570];return _0x426b77;};'use strict';var emlformat=require(_0xb384('0x0'));var rimraf=require(_0xb384('0x1'));var zipdir=require(_0xb384('0x2'));var jsonpatch=require(_0xb384('0x3'));var rp=require(_0xb384('0x4'));var moment=require(_0xb384('0x5'));var BPromise=require(_0xb384('0x6'));var Mustache=require(_0xb384('0x7'));var util=require(_0xb384('0x8'));var path=require(_0xb384('0x9'));var sox=require(_0xb384('0xa'));var csv=require('to-csv');var ejs=require(_0xb384('0xb'));var fs=require('fs');var fs_extra=require(_0xb384('0xc'));var _=require(_0xb384('0xd'));var squel=require('squel');var crypto=require(_0xb384('0xe'));var jsforce=require(_0xb384('0xf'));var deskjs=require(_0xb384('0x10'));var toCsv=require(_0xb384('0x11'));var querystring=require(_0xb384('0x12'));var Papa=require('papaparse');var Redis=require(_0xb384('0x13'));var authService=require(_0xb384('0x14'));var qs=require(_0xb384('0x15'));var as=require(_0xb384('0x16'));var hardwareService=require(_0xb384('0x17'));var logger=require(_0xb384('0x18'))(_0xb384('0x19'));var utils=require(_0xb384('0x1a'));var config=require('../../config/environment');var licenseUtil=require(_0xb384('0x1b'));var db=require(_0xb384('0x1c'))['db'];config[_0xb384('0x1d')]=_['defaults'](config['redis'],{'host':_0xb384('0x1e'),'port':0x18eb});var socket=require(_0xb384('0x1f'))(new Redis(config[_0xb384('0x1d')]));require(_0xb384('0x20'))[_0xb384('0x21')](socket);var jayson=require('jayson/promise');var client=jayson[_0xb384('0x22')][_0xb384('0x23')]({'port':0x232c});var client9002=jayson[_0xb384('0x22')][_0xb384('0x23')]({'port':0x232a});function respondWithRpcPromise(_0x7ccf03,_0x4bbbf6,_0x343029,_0x4f2997){return new BPromise(function(_0x35249c,_0x265893){var _0x4e4f50=_0x4f2997||client;return _0x4e4f50[_0xb384('0x24')](_0x7ccf03,_0x343029)[_0xb384('0x25')](function(_0x5bf32b){logger[_0xb384('0x26')](_0xb384('0x27'),_0x4bbbf6,_0xb384('0x28'));logger[_0xb384('0x29')]('FaxAccount,\x20%s,\x20%s,\x20%s',_0x4bbbf6,_0xb384('0x28'),JSON[_0xb384('0x2a')](_0x5bf32b));if(_0x5bf32b[_0xb384('0x2b')]){if(_0x5bf32b[_0xb384('0x2b')][_0xb384('0x2c')]===0x1f4){logger[_0xb384('0x2b')](_0xb384('0x27'),_0x4bbbf6,_0x5bf32b[_0xb384('0x2b')][_0xb384('0x2d')]);return _0x265893(_0x5bf32b['error'][_0xb384('0x2d')]);}logger[_0xb384('0x2b')]('FaxAccount,\x20%s,\x20%s',_0x4bbbf6,_0x5bf32b[_0xb384('0x2b')][_0xb384('0x2d')]);return _0x35249c(_0x5bf32b[_0xb384('0x2b')][_0xb384('0x2d')]);}else{logger['info']('FaxAccount,\x20%s,\x20%s',_0x4bbbf6,_0xb384('0x28'));_0x35249c(_0x5bf32b['result'][_0xb384('0x2d')]);}})[_0xb384('0x2e')](function(_0x5ebc17){logger['error']('FaxAccount,\x20%s,\x20%s',_0x4bbbf6,_0x5ebc17);_0x265893(_0x5ebc17);});});}function respondWithStatusCode(_0x44fff1,_0x338405){_0x338405=_0x338405||0xcc;return function(_0x5e6911){if(_0x5e6911){return _0x44fff1[_0xb384('0x2f')](_0x338405);}return _0x44fff1[_0xb384('0x30')](_0x338405)[_0xb384('0x31')]();};}function respondWithResult(_0x1f5548,_0x57aafe){_0x57aafe=_0x57aafe||0xc8;return function(_0x451f86){if(_0x451f86){return _0x1f5548[_0xb384('0x30')](_0x57aafe)[_0xb384('0x32')](_0x451f86);}};}function respondWithFilteredResult(_0x1c481c,_0x31c3cc){return function(_0x50119a){if(_0x50119a){var _0x4d9f8d=typeof _0x31c3cc['offset']==='undefined'&&typeof _0x31c3cc[_0xb384('0x33')]===_0xb384('0x34');var _0x1a0961=_0x50119a[_0xb384('0x35')];var _0x16ba56=_0x4d9f8d?0x0:_0x31c3cc['offset'];var _0x2e2121=_0x4d9f8d?_0x50119a[_0xb384('0x35')]:_0x31c3cc['offset']+_0x31c3cc[_0xb384('0x33')];var _0x40c48b;if(_0x2e2121>=_0x1a0961){_0x2e2121=_0x1a0961;_0x40c48b=0xc8;}else{_0x40c48b=0xce;}_0x1c481c[_0xb384('0x30')](_0x40c48b);return _0x1c481c[_0xb384('0x36')](_0xb384('0x37'),_0x16ba56+'-'+_0x2e2121+'/'+_0x1a0961)[_0xb384('0x32')](_0x50119a);}return null;};}function patchUpdates(_0x204bcd){return function(_0x3db909){try{jsonpatch[_0xb384('0x38')](_0x3db909,_0x204bcd,!![]);}catch(_0x290ed3){return BPromise['reject'](_0x290ed3);}return _0x3db909[_0xb384('0x39')]();};}function saveUpdates(_0x5ed071,_0x23481b){return function(_0x3130a2){if(_0x3130a2){return _0x3130a2[_0xb384('0x3a')](_0x5ed071)['then'](function(_0x5de9df){return _0x5de9df;});}return null;};}function removeEntity(_0x4d1a58,_0x1d5c7f){return function(_0x28fbf3){if(_0x28fbf3){return _0x28fbf3[_0xb384('0x3b')]()[_0xb384('0x25')](function(){var _0x51a6e7=_0x28fbf3[_0xb384('0x3c')]({'plain':!![]});var _0x3fb313=_0xb384('0x3d');return db[_0xb384('0x3e')][_0xb384('0x3b')]({'where':{'type':_0x3fb313,'resourceId':_0x51a6e7['id']}})[_0xb384('0x25')](function(){return _0x28fbf3;});})[_0xb384('0x25')](function(){_0x4d1a58[_0xb384('0x30')](0xcc)[_0xb384('0x31')]();});}};}function handleEntityNotFound(_0x1c32d2,_0x589296){return function(_0x7707fc){if(!_0x7707fc){_0x1c32d2[_0xb384('0x2f')](0x194);}return _0x7707fc;};}function handleError(_0x38f302,_0x2cd72a){_0x2cd72a=_0x2cd72a||0x1f4;return function(_0x2e1ce5){logger[_0xb384('0x2b')](_0x2e1ce5[_0xb384('0x3f')]);if(_0x2e1ce5[_0xb384('0x40')]){delete _0x2e1ce5[_0xb384('0x40')];}_0x38f302[_0xb384('0x30')](_0x2cd72a)['send'](_0x2e1ce5);};}exports[_0xb384('0x41')]=function(_0x22b574,_0x31f236){var _0x4b7759={'include':[{'model':db['Pause'],'as':_0xb384('0x42')}]},_0x3540b0={},_0x113946={'count':0x0,'rows':[]};var _0x3af09f=_[_0xb384('0x43')](db[_0xb384('0x44')]['rawAttributes'],function(_0x137854){return{'name':_0x137854['fieldName'],'type':_0x137854[_0xb384('0x45')]['key']};});_0x3540b0['model']=_[_0xb384('0x43')](_0x3af09f,_0xb384('0x40'));_0x3540b0[_0xb384('0x46')]=_['keys'](_0x22b574[_0xb384('0x46')]);_0x3540b0[_0xb384('0x47')]=_[_0xb384('0x48')](_0x3540b0[_0xb384('0x49')],_0x3540b0[_0xb384('0x46')]);_0x4b7759['attributes']=_[_0xb384('0x48')](_0x3540b0['model'],qs[_0xb384('0x4a')](_0x22b574[_0xb384('0x46')][_0xb384('0x4a')]));_0x4b7759['attributes']=_0x4b7759['attributes'][_0xb384('0x4b')]?_0x4b7759[_0xb384('0x4c')]:_0x3540b0['model'];if(!_0x22b574[_0xb384('0x46')][_0xb384('0x4d')](_0xb384('0x4e'))){_0x4b7759[_0xb384('0x33')]=qs[_0xb384('0x33')](_0x22b574[_0xb384('0x46')][_0xb384('0x33')]);_0x4b7759['offset']=qs[_0xb384('0x4f')](_0x22b574[_0xb384('0x46')]['offset']);}_0x4b7759[_0xb384('0x50')]=qs[_0xb384('0x51')](_0x22b574[_0xb384('0x46')][_0xb384('0x51')]);_0x4b7759['where']=qs[_0xb384('0x47')](_[_0xb384('0x52')](_0x22b574['query'],_0x3540b0[_0xb384('0x47')]),_0x3af09f);if(_0x22b574['query'][_0xb384('0x53')]){_0x4b7759[_0xb384('0x54')]=_[_0xb384('0x55')](_0x4b7759[_0xb384('0x54')],{'$or':_[_0xb384('0x43')](_0x3af09f,function(_0x505d82){if(_0x505d82[_0xb384('0x45')]!==_0xb384('0x56')){var _0x52dfe9={};_0x52dfe9[_0x505d82[_0xb384('0x40')]]={'$like':'%'+_0x22b574[_0xb384('0x46')][_0xb384('0x53')]+'%'};return _0x52dfe9;}})});}_0x4b7759=_[_0xb384('0x55')]({},_0x4b7759,_0x22b574['options']);var _0x4e95d2={'where':_0x4b7759[_0xb384('0x54')]};return db['FaxAccount'][_0xb384('0x35')](_0x4e95d2)[_0xb384('0x25')](function(_0x27056c){_0x113946[_0xb384('0x35')]=_0x27056c;if(_0x22b574['query']['includeAll']){_0x4b7759[_0xb384('0x57')]=[{'all':!![]}];}return db['FaxAccount'][_0xb384('0x58')](_0x4b7759);})[_0xb384('0x25')](function(_0x1d3923){_0x113946[_0xb384('0x59')]=_0x1d3923;return _0x113946;})['then'](respondWithFilteredResult(_0x31f236,_0x4b7759))['catch'](handleError(_0x31f236,null));};exports['show']=function(_0x171217,_0x59c77d){var _0x4f769b={'raw':![],'where':{'id':_0x171217[_0xb384('0x5a')]['id']},'include':[{'model':db[_0xb384('0x5b')],'as':_0xb384('0x42')}]},_0x3e5260={};_0x3e5260[_0xb384('0x49')]=_[_0xb384('0x5c')](db[_0xb384('0x44')][_0xb384('0x5d')]);_0x3e5260[_0xb384('0x46')]=_[_0xb384('0x5c')](_0x171217[_0xb384('0x46')]);_0x3e5260[_0xb384('0x47')]=_[_0xb384('0x48')](_0x3e5260[_0xb384('0x49')],_0x3e5260[_0xb384('0x46')]);_0x4f769b['attributes']=_[_0xb384('0x48')](_0x3e5260['model'],qs[_0xb384('0x4a')](_0x171217[_0xb384('0x46')]['fields']));_0x4f769b[_0xb384('0x4c')]=_0x4f769b[_0xb384('0x4c')][_0xb384('0x4b')]?_0x4f769b['attributes']:_0x3e5260[_0xb384('0x49')];if(_0x171217[_0xb384('0x46')][_0xb384('0x5e')]){_0x4f769b[_0xb384('0x57')]=[{'all':!![]}];}_0x4f769b=_[_0xb384('0x55')]({},_0x4f769b,_0x171217[_0xb384('0x5f')]);return db[_0xb384('0x44')][_0xb384('0x60')](_0x4f769b)['then'](handleEntityNotFound(_0x59c77d,null))[_0xb384('0x25')](respondWithResult(_0x59c77d,null))[_0xb384('0x2e')](handleError(_0x59c77d,null));};exports[_0xb384('0x61')]=function(_0xe50f75,_0x49e414){return db[_0xb384('0x44')][_0xb384('0x61')](_0xe50f75[_0xb384('0x62')],{})[_0xb384('0x25')](function(_0x5beeb3){var _0x5bd5ca=_0xe50f75[_0xb384('0x63')][_0xb384('0x3c')]({'plain':!![]});if(!_0x5bd5ca)throw new Error(_0xb384('0x64'));if(_0x5bd5ca['role']===_0xb384('0x63')){var _0xb1f786=_0x5beeb3[_0xb384('0x3c')]({'plain':!![]});var _0x4c8bdf=_0xb384('0x3d');return db[_0xb384('0x65')][_0xb384('0x60')]({'where':{'name':_0x4c8bdf,'userProfileId':_0x5bd5ca[_0xb384('0x66')]},'raw':!![]})[_0xb384('0x25')](function(_0x27d695){if(_0x27d695&&_0x27d695['autoAssociation']===0x0){return db[_0xb384('0x3e')][_0xb384('0x61')]({'name':_0xb1f786['name'],'resourceId':_0xb1f786['id'],'type':_0x27d695[_0xb384('0x40')],'sectionId':_0x27d695['id']},{})[_0xb384('0x25')](function(){return _0x5beeb3;});}else{return _0x5beeb3;}})[_0xb384('0x2e')](function(_0x3af5a9){logger[_0xb384('0x2b')](_0xb384('0x67'),_0x3af5a9);throw _0x3af5a9;});}return _0x5beeb3;})['then'](respondWithResult(_0x49e414,0xc9))[_0xb384('0x2e')](handleError(_0x49e414,null));};exports['update']=function(_0x2b5c12,_0x2140f4){if(_0x2b5c12[_0xb384('0x62')]['id']){delete _0x2b5c12[_0xb384('0x62')]['id'];}return db[_0xb384('0x44')]['find']({'where':{'id':_0x2b5c12['params']['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]})[_0xb384('0x25')](handleEntityNotFound(_0x2140f4,null))[_0xb384('0x25')](saveUpdates(_0x2b5c12[_0xb384('0x62')],null))['then'](respondWithResult(_0x2140f4,null))[_0xb384('0x2e')](handleError(_0x2140f4,null));};exports[_0xb384('0x3b')]=function(_0x564eec,_0x18e866){return db[_0xb384('0x44')][_0xb384('0x60')]({'where':{'id':_0x564eec[_0xb384('0x5a')]['id']}})[_0xb384('0x25')](handleEntityNotFound(_0x18e866,null))['then'](removeEntity(_0x18e866,null))['catch'](handleError(_0x18e866,null));};exports[_0xb384('0x68')]=function(_0x46042d,_0x1937d4){return db['FaxAccount'][_0xb384('0x68')]()[_0xb384('0x25')](respondWithResult(_0x1937d4,null))[_0xb384('0x2e')](handleError(_0x1937d4,null));};exports[_0xb384('0x69')]=function(_0x51b836,_0x4b865a,_0x5c6643){if(_0x51b836['body']['id']){delete _0x51b836[_0xb384('0x62')]['id'];}return db[_0xb384('0x44')][_0xb384('0x60')]({'where':{'id':_0x51b836[_0xb384('0x5a')]['id']}})[_0xb384('0x25')](handleEntityNotFound(_0x4b865a,null))[_0xb384('0x25')](function(_0x1237f7){if(_0x1237f7){_0x51b836[_0xb384('0x62')][_0xb384('0x6a')]=_0x1237f7['id'];return db['Disposition'][_0xb384('0x61')](_0x51b836[_0xb384('0x62')]);}})[_0xb384('0x25')](respondWithResult(_0x4b865a,null))['catch'](handleError(_0x4b865a,null));};exports[_0xb384('0x6b')]=function(_0x4224c4,_0x42da91,_0x22e317){var _0x10bf56={'raw':![],'where':{}};var _0xb2dd92={};var _0x1075e2={'count':0x0,'rows':[]};return db[_0xb384('0x44')][_0xb384('0x6c')]({'where':{'id':_0x4224c4[_0xb384('0x5a')]['id']}})[_0xb384('0x25')](handleEntityNotFound(_0x42da91,null))[_0xb384('0x25')](function(_0x2ded74){if(_0x2ded74){_0xb2dd92[_0xb384('0x49')]=_[_0xb384('0x5c')](db['Disposition'][_0xb384('0x5d')]);_0xb2dd92[_0xb384('0x46')]=_[_0xb384('0x5c')](_0x4224c4[_0xb384('0x46')]);_0xb2dd92[_0xb384('0x47')]=_['intersection'](_0xb2dd92[_0xb384('0x49')],_0xb2dd92[_0xb384('0x46')]);_0x10bf56[_0xb384('0x4c')]=_[_0xb384('0x48')](_0xb2dd92[_0xb384('0x49')],qs[_0xb384('0x4a')](_0x4224c4[_0xb384('0x46')][_0xb384('0x4a')]));_0x10bf56[_0xb384('0x4c')]=_0x10bf56[_0xb384('0x4c')]['length']?_0x10bf56[_0xb384('0x4c')]:_0xb2dd92['model'];if(!_0x4224c4[_0xb384('0x46')][_0xb384('0x4d')](_0xb384('0x4e'))){_0x10bf56['limit']=qs['limit'](_0x4224c4[_0xb384('0x46')][_0xb384('0x33')]);_0x10bf56[_0xb384('0x4f')]=qs['offset'](_0x4224c4['query'][_0xb384('0x4f')]);}_0x10bf56['order']=qs[_0xb384('0x51')](_0x4224c4['query'][_0xb384('0x51')]);_0x10bf56['where']=qs[_0xb384('0x47')](_['pick'](_0x4224c4[_0xb384('0x46')],_0xb2dd92[_0xb384('0x47')]));_0x10bf56['where'][_0xb384('0x6a')]=_0x2ded74['id'];if(_0x4224c4[_0xb384('0x46')]['filter']){_0x10bf56[_0xb384('0x54')]=_[_0xb384('0x55')](_0x10bf56['where'],{'$or':_[_0xb384('0x43')](_0x10bf56[_0xb384('0x4c')],function(_0x41d36b){var _0x1daedb={};_0x1daedb[_0x41d36b]={'$like':'%'+_0x4224c4[_0xb384('0x46')]['filter']+'%'};return _0x1daedb;})});}_0x10bf56=_[_0xb384('0x55')]({},_0x10bf56,_0x4224c4[_0xb384('0x5f')]);return db[_0xb384('0x6d')][_0xb384('0x35')]({'where':_0x10bf56['where']})[_0xb384('0x25')](function(_0x24842d){_0x1075e2[_0xb384('0x35')]=_0x24842d;if(_0x4224c4[_0xb384('0x46')][_0xb384('0x5e')]){_0x10bf56[_0xb384('0x57')]=[{'all':!![]}];}return db[_0xb384('0x6d')][_0xb384('0x58')](_0x10bf56);})[_0xb384('0x25')](function(_0x16b2cc){_0x1075e2['rows']=_0x16b2cc;return _0x1075e2;});}})[_0xb384('0x25')](respondWithFilteredResult(_0x42da91,_0x10bf56))[_0xb384('0x2e')](handleError(_0x42da91,null));};exports[_0xb384('0x6e')]=function(_0x4f5929,_0x25b7d2,_0x48800b){return db[_0xb384('0x44')][_0xb384('0x60')]({'where':{'id':_0x4f5929['params']['id']}})[_0xb384('0x25')](handleEntityNotFound(_0x25b7d2,null))[_0xb384('0x25')](function(_0x578e3d){if(_0x578e3d){return _0x578e3d[_0xb384('0x6e')](_0x4f5929[_0xb384('0x46')][_0xb384('0x6f')]);}})[_0xb384('0x25')](respondWithStatusCode(_0x25b7d2,null))['catch'](handleError(_0x25b7d2,null));};exports[_0xb384('0x70')]=function(_0x416fff,_0x12351d,_0x475bbc){if(_0x416fff['body']['id']){delete _0x416fff[_0xb384('0x62')]['id'];}return db['FaxAccount'][_0xb384('0x60')]({'where':{'id':_0x416fff['params']['id']}})[_0xb384('0x25')](handleEntityNotFound(_0x12351d,null))[_0xb384('0x25')](function(_0x54872e){if(_0x54872e){_0x416fff[_0xb384('0x62')]['FaxAccountId']=_0x54872e['id'];return db[_0xb384('0x71')][_0xb384('0x61')](_0x416fff[_0xb384('0x62')]);}})['then'](respondWithResult(_0x12351d,null))[_0xb384('0x2e')](handleError(_0x12351d,null));};exports['getAnswers']=function(_0x1daf04,_0x581173,_0x9ccfa1){var _0x4d5333={'raw':![],'where':{}};var _0x599fb7={};var _0x46ba4f={'count':0x0,'rows':[]};return db[_0xb384('0x44')][_0xb384('0x6c')]({'where':{'id':_0x1daf04['params']['id']}})[_0xb384('0x25')](handleEntityNotFound(_0x581173,null))[_0xb384('0x25')](function(_0x11cfb3){if(_0x11cfb3){_0x599fb7['model']=_['keys'](db[_0xb384('0x71')][_0xb384('0x5d')]);_0x599fb7[_0xb384('0x46')]=_[_0xb384('0x5c')](_0x1daf04[_0xb384('0x46')]);_0x599fb7[_0xb384('0x47')]=_[_0xb384('0x48')](_0x599fb7[_0xb384('0x49')],_0x599fb7['query']);_0x4d5333['attributes']=_['intersection'](_0x599fb7[_0xb384('0x49')],qs[_0xb384('0x4a')](_0x1daf04[_0xb384('0x46')][_0xb384('0x4a')]));_0x4d5333['attributes']=_0x4d5333['attributes']['length']?_0x4d5333['attributes']:_0x599fb7[_0xb384('0x49')];if(!_0x1daf04[_0xb384('0x46')][_0xb384('0x4d')]('nolimit')){_0x4d5333[_0xb384('0x33')]=qs[_0xb384('0x33')](_0x1daf04[_0xb384('0x46')]['limit']);_0x4d5333[_0xb384('0x4f')]=qs[_0xb384('0x4f')](_0x1daf04[_0xb384('0x46')]['offset']);}_0x4d5333[_0xb384('0x50')]=qs[_0xb384('0x51')](_0x1daf04[_0xb384('0x46')][_0xb384('0x51')]);_0x4d5333[_0xb384('0x54')]=qs['filters'](_[_0xb384('0x52')](_0x1daf04['query'],_0x599fb7[_0xb384('0x47')]));_0x4d5333[_0xb384('0x54')][_0xb384('0x6a')]=_0x11cfb3['id'];if(_0x1daf04[_0xb384('0x46')][_0xb384('0x53')]){_0x4d5333[_0xb384('0x54')]=_[_0xb384('0x55')](_0x4d5333[_0xb384('0x54')],{'$or':_[_0xb384('0x43')](_0x4d5333[_0xb384('0x4c')],function(_0x31037f){var _0x352645={};_0x352645[_0x31037f]={'$like':'%'+_0x1daf04[_0xb384('0x46')][_0xb384('0x53')]+'%'};return _0x352645;})});}_0x4d5333=_[_0xb384('0x55')]({},_0x4d5333,_0x1daf04[_0xb384('0x5f')]);return db['CannedAnswer']['count']({'where':_0x4d5333[_0xb384('0x54')]})[_0xb384('0x25')](function(_0x49a23d){_0x46ba4f[_0xb384('0x35')]=_0x49a23d;if(_0x1daf04[_0xb384('0x46')][_0xb384('0x5e')]){_0x4d5333['include']=[{'all':!![]}];}return db[_0xb384('0x71')][_0xb384('0x58')](_0x4d5333);})[_0xb384('0x25')](function(_0x443626){_0x46ba4f['rows']=_0x443626;return _0x46ba4f;});}})[_0xb384('0x25')](respondWithFilteredResult(_0x581173,_0x4d5333))['catch'](handleError(_0x581173,null));};exports[_0xb384('0x72')]=function(_0x4e73bf,_0x1eee72,_0x40752f){return db[_0xb384('0x44')][_0xb384('0x60')]({'where':{'id':_0x4e73bf[_0xb384('0x5a')]['id']}})[_0xb384('0x25')](handleEntityNotFound(_0x1eee72,null))[_0xb384('0x25')](function(_0xfbc0ea){if(_0xfbc0ea){return _0xfbc0ea[_0xb384('0x72')](_0x4e73bf[_0xb384('0x46')]['ids']);}})[_0xb384('0x25')](respondWithStatusCode(_0x1eee72,null))[_0xb384('0x2e')](handleError(_0x1eee72,null));};exports[_0xb384('0x73')]=function(_0x530f14,_0x21b778,_0x4c6c26){return db[_0xb384('0x74')][_0xb384('0x60')]({'where':{'id':_0x530f14[_0xb384('0x5a')]['id']}})[_0xb384('0x25')](handleEntityNotFound(_0x21b778,null))[_0xb384('0x25')](function(_0x46dd66){if(_0x46dd66){return _0x46dd66[_0xb384('0x73')](_0x530f14['body'][_0xb384('0x6f')],_[_0xb384('0x75')](_0x530f14['body'],[_0xb384('0x6f'),'id'])||{});}})[_0xb384('0x25')](respondWithResult(_0x21b778,null))[_0xb384('0x2e')](handleError(_0x21b778,null));};exports[_0xb384('0x76')]=function(_0x1748d7,_0x4cf80b,_0x13283d){var _0x55de99={'raw':![],'where':{}};var _0x3e5140={};var _0x40c178={'count':0x0,'rows':[]};return db[_0xb384('0x44')][_0xb384('0x6c')]({'where':{'id':_0x1748d7[_0xb384('0x5a')]['id']}})[_0xb384('0x25')](handleEntityNotFound(_0x4cf80b,null))[_0xb384('0x25')](function(_0x4fe9ed){if(_0x4fe9ed){_0x3e5140[_0xb384('0x49')]=_[_0xb384('0x5c')](db[_0xb384('0x74')][_0xb384('0x5d')]);_0x3e5140[_0xb384('0x46')]=_['keys'](_0x1748d7['query']);_0x3e5140[_0xb384('0x47')]=_['intersection'](_0x3e5140[_0xb384('0x49')],_0x3e5140[_0xb384('0x46')]);_0x55de99[_0xb384('0x4c')]=_['intersection'](_0x3e5140[_0xb384('0x49')],qs[_0xb384('0x4a')](_0x1748d7[_0xb384('0x46')][_0xb384('0x4a')]));_0x55de99[_0xb384('0x4c')]=_0x55de99[_0xb384('0x4c')][_0xb384('0x4b')]?_0x55de99[_0xb384('0x4c')]:_0x3e5140[_0xb384('0x49')];if(!_0x1748d7[_0xb384('0x46')]['hasOwnProperty']('nolimit')){_0x55de99['limit']=qs[_0xb384('0x33')](_0x1748d7['query'][_0xb384('0x33')]);_0x55de99[_0xb384('0x4f')]=qs['offset'](_0x1748d7['query'][_0xb384('0x4f')]);}_0x55de99[_0xb384('0x50')]=qs[_0xb384('0x51')](_0x1748d7[_0xb384('0x46')]['sort']);_0x55de99[_0xb384('0x54')]=qs['filters'](_[_0xb384('0x52')](_0x1748d7[_0xb384('0x46')],_0x3e5140[_0xb384('0x47')]));_0x55de99[_0xb384('0x54')]['FaxAccountId']=_0x4fe9ed['id'];if(_0x1748d7[_0xb384('0x46')][_0xb384('0x53')]){_0x55de99['where']=_[_0xb384('0x55')](_0x55de99[_0xb384('0x54')],{'$or':_[_0xb384('0x43')](_0x55de99['attributes'],function(_0x3c0c53){var _0x5c81c8={};_0x5c81c8[_0x3c0c53]={'$like':'%'+_0x1748d7[_0xb384('0x46')][_0xb384('0x53')]+'%'};return _0x5c81c8;})});}_0x55de99=_[_0xb384('0x55')]({},_0x55de99,_0x1748d7[_0xb384('0x5f')]);return db[_0xb384('0x74')][_0xb384('0x35')]({'where':_0x55de99['where']})['then'](function(_0x491e03){_0x40c178['count']=_0x491e03;if(_0x1748d7[_0xb384('0x46')]['includeAll']){_0x55de99[_0xb384('0x57')]=[{'model':db[_0xb384('0x77')],'as':_0xb384('0x78'),'required':![]},{'model':db[_0xb384('0x79')],'as':_0xb384('0x7a'),'attributes':[_0xb384('0x40'),_0xb384('0x7b'),_0xb384('0x7c')],'required':![]},{'model':db[_0xb384('0x7d')],'as':_0xb384('0x7e'),'attributes':['id',_0xb384('0x40'),_0xb384('0x7f')],'where':_0x1748d7[_0xb384('0x46')]['tag']?{'id':_0x1748d7[_0xb384('0x46')][_0xb384('0x80')]}:undefined,'required':_0x1748d7[_0xb384('0x46')][_0xb384('0x80')]?!![]:![]}];}return db[_0xb384('0x74')][_0xb384('0x58')](_0x55de99);})[_0xb384('0x25')](function(_0x50b42b){_0x40c178[_0xb384('0x59')]=_0x50b42b;return _0x40c178;});}})[_0xb384('0x25')](respondWithFilteredResult(_0x4cf80b,_0x55de99))[_0xb384('0x2e')](handleError(_0x4cf80b,null));};exports[_0xb384('0x81')]=function(_0x17bf4b,_0xf6c8cb,_0x252cc5){return db[_0xb384('0x44')][_0xb384('0x6c')]({'where':{'id':_0x17bf4b['params']['id']}})['then'](handleEntityNotFound(_0xf6c8cb,null))['then'](function(_0x42cc35){if(_0x42cc35){return db[_0xb384('0x82')]['transaction'](function(_0x3470a9){return db[_0xb384('0x83')][_0xb384('0x3b')]({'where':{'FaxAccountId':_0x17bf4b[_0xb384('0x5a')]['id']},'transaction':_0x3470a9})['then'](function(_0x3319a8){var _0x6fe0b=_[_0xb384('0x43')](_0x17bf4b['body'],function(_0x477281){_0x477281[_0xb384('0x6a')]=_0x17bf4b['params']['id'];return _0x477281;});return db[_0xb384('0x83')][_0xb384('0x84')](_0x6fe0b,{'transaction':_0x3470a9});});})['then'](function(){return db[_0xb384('0x83')][_0xb384('0x85')]({'where':{'FaxAccountId':_0x17bf4b[_0xb384('0x5a')]['id']},'order':'priority'});});}})[_0xb384('0x25')](respondWithResult(_0xf6c8cb,null))[_0xb384('0x2e')](handleError(_0xf6c8cb,null));};exports[_0xb384('0x86')]=function(_0x217ca2,_0xcc6bb,_0x118b65){var _0x443c09={};var _0x3a53f2={};var _0x1e31af;var _0x52c6c2;return db[_0xb384('0x44')][_0xb384('0x6c')]({'where':{'id':_0x217ca2[_0xb384('0x5a')]['id']}})['then'](handleEntityNotFound(_0xcc6bb,null))[_0xb384('0x25')](function(_0x1df790){if(_0x1df790){_0x1e31af=_0x1df790;_0x3a53f2['model']=_[_0xb384('0x5c')](db[_0xb384('0x83')][_0xb384('0x5d')]);_0x3a53f2['query']=_['keys'](_0x217ca2['query']);_0x3a53f2[_0xb384('0x47')]=_[_0xb384('0x48')](_0x3a53f2[_0xb384('0x49')],_0x3a53f2[_0xb384('0x46')]);_0x443c09[_0xb384('0x4c')]=_[_0xb384('0x48')](_0x3a53f2[_0xb384('0x49')],qs[_0xb384('0x4a')](_0x217ca2[_0xb384('0x46')][_0xb384('0x4a')]));_0x443c09[_0xb384('0x4c')]=_0x443c09['attributes'][_0xb384('0x4b')]?_0x443c09[_0xb384('0x4c')]:_0x3a53f2[_0xb384('0x49')];_0x443c09[_0xb384('0x50')]=qs[_0xb384('0x51')](_0x217ca2[_0xb384('0x46')][_0xb384('0x51')]);_0x443c09['where']=qs[_0xb384('0x47')](_[_0xb384('0x52')](_0x217ca2[_0xb384('0x46')],_0x3a53f2[_0xb384('0x47')]));if(_0x217ca2[_0xb384('0x46')][_0xb384('0x53')]){_0x443c09['where']=_[_0xb384('0x55')](_0x443c09['where'],{'$or':_['map'](_0x443c09[_0xb384('0x4c')],function(_0xa2909d){var _0x254a34={};_0x254a34[_0xa2909d]={'$like':'%'+_0x217ca2[_0xb384('0x46')]['filter']+'%'};return _0x254a34;})});}_0x443c09=_[_0xb384('0x55')]({},_0x443c09,_0x217ca2[_0xb384('0x5f')]);return _0x1e31af[_0xb384('0x86')](_0x443c09);}})[_0xb384('0x25')](function(_0x5d6f12){if(_0x5d6f12){_0x52c6c2=_0x5d6f12['length'];if(!_0x217ca2[_0xb384('0x46')][_0xb384('0x4d')](_0xb384('0x4e'))){_0x443c09[_0xb384('0x33')]=qs[_0xb384('0x33')](_0x217ca2[_0xb384('0x46')]['limit']);_0x443c09[_0xb384('0x4f')]=qs[_0xb384('0x4f')](_0x217ca2[_0xb384('0x46')]['offset']);}return _0x1e31af[_0xb384('0x86')](_0x443c09);}})[_0xb384('0x25')](function(_0x241ace){if(_0x241ace){return _0x241ace?{'count':_0x52c6c2,'rows':_0x241ace}:null;}})[_0xb384('0x25')](respondWithResult(_0xcc6bb,null))[_0xb384('0x2e')](handleError(_0xcc6bb,null));};function Extension(_0x10099b,_0xcbfc0e,_0x1e37b4,_0x15c83d){this[_0xb384('0x87')]=_0xb384('0x88');this[_0xb384('0x89')]=_0x10099b[_0xb384('0x8a')];this[_0xb384('0x8b')]=_0x15c83d;this['type']=_0xb384('0x8c');this[_0xb384('0x8d')]='Fax\x20Extension';this[_0xb384('0x6a')]=_0x10099b['id'];this[_0xb384('0x8e')]=_0xcbfc0e;this[_0xb384('0x8f')]=_0x1e37b4;}function createExtensionsReciveFax(_0x1dfe11){var _0x50781f=0x1;var _0x32e930=[];_0x32e930[_0xb384('0x90')](new Extension(_0x1dfe11,_0x50781f,'',_0xb384('0x91')));_0x50781f+=0x1;_0x32e930['push'](new Extension(_0x1dfe11,_0x50781f,'CDR(type)=inbound-fax',_0xb384('0x92')));_0x50781f+=0x1;for(var _0x4366d4 in _0x1dfe11){if(_0x1dfe11['hasOwnProperty'](_0x4366d4)&&(_0x4366d4===_0xb384('0x93')||_0x4366d4==='localstationid'||_0x4366d4==='gateway'||_0x4366d4==='faxdetect'||_0x4366d4===_0xb384('0x94')||_0x4366d4===_0xb384('0x95')||_0x4366d4===_0xb384('0x96')||_0x4366d4==='modem'||_0x4366d4===_0xb384('0x97'))){_0x32e930[_0xb384('0x90')](new Extension(_0x1dfe11,_0x50781f,_0xb384('0x98')+_0x4366d4+')='+_0x1dfe11[_0x4366d4],'Set'));_0x50781f+=0x1;}}_0x32e930[_0xb384('0x90')](new Extension(_0x1dfe11,_0x50781f,'6',_0xb384('0x99')));_0x50781f+=0x1;_0x32e930[_0xb384('0x90')](new Extension(_0x1dfe11,_0x50781f,'/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'));_0x50781f=0x0;return _0x32e930;}exports['addAccountApplications']=function(_0x4c4f4b,_0x29f56e,_0x3c55a9){var _0x329133;return db[_0xb384('0x82')][_0xb384('0x9a')](function(_0x5f3bc7){return db[_0xb384('0x44')][_0xb384('0x61')](_0x4c4f4b[_0xb384('0x62')],{'transaction':_0x5f3bc7})[_0xb384('0x25')](function(_0x30ea33){_0x329133=_0x30ea33[_0xb384('0x3c')]({'plain':!![]});return db[_0xb384('0x9b')][_0xb384('0x84')](createExtensionsReciveFax(_0x329133),{'transaction':_0x5f3bc7});});})['then'](function(){return _0x329133;})[_0xb384('0x25')](respondWithResult(_0x29f56e,null))[_0xb384('0x2e')](handleError(_0x29f56e,null));};exports['updateAccountApplications']=function(_0xb5ae40,_0x295c8a,_0x4b3d0f){var _0xcd7c23;return db['sequelize'][_0xb384('0x9a')](function(_0x5ea6d3){return db['FaxAccount'][_0xb384('0x3a')](_0xb5ae40[_0xb384('0x62')],{'where':{'id':_0xb5ae40[_0xb384('0x62')]['id']},'transaction':_0x5ea6d3})[_0xb384('0x25')](function(_0x52fef6){return db[_0xb384('0x9b')]['destroy']({'where':{'FaxAccountId':_0xb5ae40[_0xb384('0x62')]['id']},'transaction':_0x5ea6d3})[_0xb384('0x25')](function(_0x445855){return db['VoiceExtension']['bulkCreate'](createExtensionsReciveFax(_[_0xb384('0x75')](_0xb5ae40[_0xb384('0x62')],['tech',_0xb384('0x9c'),_0xb384('0x9d'),_0xb384('0x9e'),_0xb384('0x9f'),_0xb384('0xa0')])),{'transaction':_0x5ea6d3});});});})['then'](function(){return db[_0xb384('0x44')][_0xb384('0xa1')](_0xb5ae40[_0xb384('0x62')]['id']);})[_0xb384('0x25')](respondWithResult(_0x295c8a,null))[_0xb384('0x2e')](handleError(_0x295c8a,null));};exports[_0xb384('0xa2')]=function(_0x59eafc,_0x39bee7,_0x49403e){var _0x4cce30={'raw':!![],'where':{}};var _0x2ecee1={};var _0x3f415b={'count':0x0,'rows':[]};return db[_0xb384('0x44')]['findOne']({'where':{'id':_0x59eafc[_0xb384('0x5a')]['id']}})[_0xb384('0x25')](handleEntityNotFound(_0x39bee7,null))['then'](function(_0x13a472){if(_0x13a472){_0x2ecee1[_0xb384('0x49')]=_[_0xb384('0x5c')](db['FaxMessage'][_0xb384('0x5d')]);_0x2ecee1[_0xb384('0x46')]=_[_0xb384('0x5c')](_0x59eafc[_0xb384('0x46')]);_0x2ecee1['filters']=_[_0xb384('0x48')](_0x2ecee1[_0xb384('0x49')],_0x2ecee1['query']);_0x4cce30[_0xb384('0x4c')]=_['intersection'](_0x2ecee1['model'],qs[_0xb384('0x4a')](_0x59eafc[_0xb384('0x46')]['fields']));_0x4cce30[_0xb384('0x4c')]=_0x4cce30[_0xb384('0x4c')]['length']?_0x4cce30[_0xb384('0x4c')]:_0x2ecee1[_0xb384('0x49')];if(!_0x59eafc[_0xb384('0x46')][_0xb384('0x4d')](_0xb384('0x4e'))){_0x4cce30[_0xb384('0x33')]=qs[_0xb384('0x33')](_0x59eafc[_0xb384('0x46')][_0xb384('0x33')]);_0x4cce30[_0xb384('0x4f')]=qs['offset'](_0x59eafc['query'][_0xb384('0x4f')]);}_0x4cce30['order']=qs[_0xb384('0x51')](_0x59eafc[_0xb384('0x46')][_0xb384('0x51')]);_0x4cce30[_0xb384('0x54')]=qs[_0xb384('0x47')](_[_0xb384('0x52')](_0x59eafc[_0xb384('0x46')],_0x2ecee1[_0xb384('0x47')]));_0x4cce30[_0xb384('0x54')]['FaxAccountId']=_0x13a472['id'];if(_0x59eafc[_0xb384('0x46')][_0xb384('0x53')]){_0x4cce30[_0xb384('0x54')]=_[_0xb384('0x55')](_0x4cce30[_0xb384('0x54')],{'$or':_['map'](_0x4cce30[_0xb384('0x4c')],function(_0x784032){var _0x1a2c9c={};_0x1a2c9c[_0x784032]={'$like':'%'+_0x59eafc['query'][_0xb384('0x53')]+'%'};return _0x1a2c9c;})});}if(_0x59eafc[_0xb384('0x46')][_0xb384('0xa3')]){var _0x37c0b5=_0x59eafc[_0xb384('0x46')][_0xb384('0xa3')][_0xb384('0xa4')](',');var _0x24b7ab={};_0x24b7ab[_0x37c0b5[0x0]]={'$gte':moment(_0x37c0b5[0x1])[_0xb384('0xa5')]('YYYY-MM-DD\x20HH:mm:ss')};_0x4cce30['where']=_[_0xb384('0x55')](_0x4cce30[_0xb384('0x54')],_0x24b7ab);}_0x4cce30=_['merge']({},_0x4cce30,_0x59eafc[_0xb384('0x5f')]);return db['FaxMessage'][_0xb384('0x35')]({'where':_0x4cce30[_0xb384('0x54')]})[_0xb384('0x25')](function(_0x41c67f){_0x3f415b['count']=_0x41c67f;if(_0x59eafc[_0xb384('0x46')][_0xb384('0x5e')]){_0x4cce30[_0xb384('0x57')]=[{'all':!![]}];}return db[_0xb384('0xa6')][_0xb384('0x58')](_0x4cce30);})['then'](function(_0x48d600){_0x3f415b['rows']=_0x48d600;return _0x3f415b;});}})[_0xb384('0x25')](respondWithFilteredResult(_0x39bee7,_0x4cce30))[_0xb384('0x2e')](handleError(_0x39bee7,null));};exports[_0xb384('0xa7')]=function(_0x2dc80f,_0x16dc50,_0xc8aab5){var _0x22c485,_0x144d25={},_0x5807e6;if(_0x2dc80f[_0xb384('0x62')]['to']){_0x5807e6=_0x2dc80f[_0xb384('0x62')]['to'][0x0];}return db[_0xb384('0x44')][_0xb384('0x60')]({'where':{'id':_0x2dc80f['params']['id']},'include':[{'model':db[_0xb384('0xa8')],'as':'List','include':[{'model':db[_0xb384('0x77')],'as':_0xb384('0xa9'),'where':{'fax':_0x5807e6},'limit':0x1,'order':[[_0xb384('0x9e'),'DESC']]}]}]})[_0xb384('0x25')](handleEntityNotFound(_0x16dc50,null))['then'](function(_0x4eceb2){_0x22c485=_0x4eceb2;if(_0x2dc80f[_0xb384('0x62')]['attachments']&&_0x2dc80f[_0xb384('0x62')]['attachments'][_0xb384('0x4b')]){for(var _0x51a0c9=0x0;_0x51a0c9<_0x2dc80f[_0xb384('0x62')][_0xb384('0xaa')]['length'];_0x51a0c9+=0x1){_0x2dc80f[_0xb384('0x62')][_0xb384('0xaa')][_0x51a0c9]={'filename':_0x2dc80f[_0xb384('0x62')]['attachments'][_0x51a0c9][_0xb384('0x40')],'id':_0x2dc80f[_0xb384('0x62')]['attachments'][_0x51a0c9]['id'],'path':path[_0xb384('0xab')](config[_0xb384('0xac')],_0xb384('0xad'),_0x2dc80f[_0xb384('0x62')][_0xb384('0xaa')][_0x51a0c9][_0xb384('0xae')])};}}return respondWithRpcPromise(_0xb384('0xaf'),_0xb384('0xaf'),{'FaxAccountId':_[_0xb384('0xb0')](_0x2dc80f[_0xb384('0x5a')]['id'])?undefined:_0x2dc80f[_0xb384('0x5a')]['id'],'path':_['isNil'](_0x2dc80f[_0xb384('0x62')][_0xb384('0xaa')][0x0][_0xb384('0x9')])?undefined:_0x2dc80f[_0xb384('0x62')]['attachments'][0x0]['path'],'fax':_['isNil'](_0x2dc80f[_0xb384('0x62')]['to'][0x0])?undefined:_0x2dc80f[_0xb384('0x62')]['to'][0x0]},client9002);})[_0xb384('0x25')](function(){if(_0x22c485){if(_[_0xb384('0xb0')](_0x2dc80f['body'][_0xb384('0xb1')])){_0x2dc80f[_0xb384('0x62')][_0xb384('0xb1')]=util[_0xb384('0xa5')](_0xb384('0xb2'),_0x22c485[_0xb384('0x40')],_0x22c485[_0xb384('0xb3')]);}if(_0x22c485[_0xb384('0xb4')]){if(_0x22c485[_0xb384('0xb4')]['Contacts']['length']){return _0x22c485[_0xb384('0xb4')][_0xb384('0xa9')][0x0];}else{return db[_0xb384('0x77')][_0xb384('0x61')](_[_0xb384('0xb5')](_0x2dc80f[_0xb384('0x62')],{'firstName':_0x2dc80f[_0xb384('0x62')]['to'][0x0],'phone':_0x2dc80f[_0xb384('0x62')]['to'][0x0],'fax':_0x2dc80f[_0xb384('0x62')]['to'][0x0],'ListId':_0x22c485[_0xb384('0xa0')]}));}}else{throw new Error(_0xb384('0xb6'));}}else{throw new Error('Send\x20Fax\x20failed');}})[_0xb384('0x25')](function(_0x45ff4b){if(_0x45ff4b){return db[_0xb384('0x74')]['find']({'where':{'ContactId':_0x45ff4b['id'],'closed':![],'FaxAccountId':_0x22c485['id']}})[_0xb384('0x25')](function(_0x1104ce){if(_0x1104ce){return[_0x1104ce,![]];}return db[_0xb384('0x74')][_0xb384('0x61')]({'UserId':_0x2dc80f[_0xb384('0x63')]['id'],'ContactId':_0x45ff4b['id'],'FaxAccountId':_0x22c485['id'],'fax':_0x2dc80f[_0xb384('0x62')]['to'][0x0],'firstMsgDirection':_0xb384('0xb7'),'Messages':[_[_0xb384('0x55')](_0x2dc80f['body'],{'read':![],'body':_0x2dc80f['body'][_0xb384('0xaa')][0x0][_0xb384('0xb8')],'FaxAccountId':_0x22c485['id'],'UserId':_0x2dc80f[_0xb384('0x63')]['id'],'ContactId':_0x45ff4b['id'],'AttachmentId':_0x2dc80f['body'][_0xb384('0xaa')][0x0]['id']})]},{'include':[{'model':db[_0xb384('0xa6')],'as':_0xb384('0xb9')}]})['then'](function(_0x59b5f9){return[_0x59b5f9,!![]];});});}else{throw new Error(_0xb384('0xba'));}})[_0xb384('0xbb')](function(_0x3567a6,_0x3ebb29){if(_0x3ebb29){return _0x3567a6;}return db[_0xb384('0xa6')][_0xb384('0x61')]({'direction':'out','read':![],'body':_0x2dc80f[_0xb384('0x62')]['attachments'][0x0]['filename'],'FaxAccountId':_0x22c485['id'],'FaxInteractionId':_0x3567a6['id'],'UserId':_0x2dc80f['user']['id'],'ContactId':_0x3567a6[_0xb384('0xbc')],'AttachmentId':_0x2dc80f[_0xb384('0x62')][_0xb384('0xaa')][0x0]['id']})[_0xb384('0x25')](function(_0x23c292){_0x3567a6['dataValues'][_0xb384('0xb9')]=[];_0x3567a6[_0xb384('0xbd')][_0xb384('0xb9')]['push'](_0x23c292[_0xb384('0xbd')]);return _0x3567a6;});})['then'](function(_0x4f1257){respondWithRpcPromise('SendFax',_0xb384('0xbe'),{'FaxAccountId':_[_0xb384('0xb0')](_0x2dc80f[_0xb384('0x5a')]['id'])?undefined:_0x2dc80f[_0xb384('0x5a')]['id'],'path':_[_0xb384('0xb0')](_0x2dc80f[_0xb384('0x62')][_0xb384('0xaa')][0x0][_0xb384('0x9')])?undefined:_0x2dc80f[_0xb384('0x62')]['attachments'][0x0][_0xb384('0x9')],'fax':_[_0xb384('0xb0')](_0x2dc80f[_0xb384('0x62')]['to'][0x0])?undefined:_0x2dc80f[_0xb384('0x62')]['to'][0x0],'AttachmentId':_0x2dc80f[_0xb384('0x62')][_0xb384('0xaa')][0x0]['id']},client9002)['then'](function(_0x12a175){logger['info'](_0xb384('0xbf'),_0x12a175);})[_0xb384('0x2e')](function(_0x11725f){logger[_0xb384('0x26')](_0xb384('0xbf'),_0x11725f);});return _0x4f1257;})[_0xb384('0x25')](respondWithResult(_0x16dc50,null))[_0xb384('0x2e')](handleError(_0x16dc50,null));};exports[_0xb384('0xc0')]=function(_0x169be5,_0x3a42cc,_0x1aec18){return db[_0xb384('0x44')][_0xb384('0x60')]({'where':{'id':_0x169be5[_0xb384('0x5a')]['id']}})[_0xb384('0x25')](handleEntityNotFound(_0x3a42cc,null))['then'](function(_0x2ed7f5){if(_0x2ed7f5){return _0x2ed7f5[_0xb384('0xc0')](_0x169be5[_0xb384('0x62')][_0xb384('0x6f')],_[_0xb384('0x75')](_0x169be5[_0xb384('0x62')],['ids','id'])||{})[_0xb384('0xbb')](function(_0x4298c7){for(var _0x58c567=0x0;_0x58c567<_0x169be5[_0xb384('0x62')][_0xb384('0x6f')][_0xb384('0x4b')];_0x58c567+=0x1){socket[_0xb384('0xc1')](_0xb384('0xc2'),{'UserId':Number(_0x169be5[_0xb384('0x62')]['ids'][_0x58c567]),'FaxAccountId':Number(_0x169be5['params']['id'])});}return _0x4298c7;});}})[_0xb384('0x25')](respondWithResult(_0x3a42cc,null))[_0xb384('0x2e')](handleError(_0x3a42cc,null));};exports[_0xb384('0xc3')]=function(_0x1b873b,_0x42b058,_0x111429){return db['FaxAccount'][_0xb384('0x60')]({'where':{'id':_0x1b873b[_0xb384('0x5a')]['id']}})['then'](handleEntityNotFound(_0x42b058,null))[_0xb384('0x25')](function(_0x1de55f){if(_0x1de55f){return _0x1de55f[_0xb384('0xc3')](_0x1b873b[_0xb384('0x46')][_0xb384('0x6f')])[_0xb384('0x25')](function(){if(_[_0xb384('0xc4')](_0x1b873b[_0xb384('0x46')][_0xb384('0x6f')])){for(var _0x320c75=0x0;_0x320c75<_0x1b873b[_0xb384('0x46')][_0xb384('0x6f')]['length'];_0x320c75+=0x1){socket['emit'](_0xb384('0xc5'),{'UserId':Number(_0x1b873b[_0xb384('0x46')][_0xb384('0x6f')][_0x320c75]),'FaxAccountId':Number(_0x1b873b[_0xb384('0x5a')]['id'])});}}else{socket[_0xb384('0xc1')](_0xb384('0xc5'),{'UserId':Number(_0x1b873b['query']['ids']),'FaxAccountId':Number(_0x1b873b[_0xb384('0x5a')]['id'])});}});}})[_0xb384('0x25')](respondWithStatusCode(_0x42b058,null))[_0xb384('0x2e')](handleError(_0x42b058,null));};exports[_0xb384('0xc6')]=function(_0x117474,_0x24138c,_0x1f620e){var _0x591a81={};var _0x45a970={};var _0x137175;var _0x43b40c;return db[_0xb384('0x44')][_0xb384('0x6c')]({'where':{'id':_0x117474['params']['id']}})[_0xb384('0x25')](handleEntityNotFound(_0x24138c,null))[_0xb384('0x25')](function(_0x29e76b){if(_0x29e76b){_0x137175=_0x29e76b;_0x45a970[_0xb384('0x49')]=_[_0xb384('0x5c')](db[_0xb384('0x79')]['rawAttributes']);_0x45a970[_0xb384('0x46')]=_[_0xb384('0x5c')](_0x117474[_0xb384('0x46')]);_0x45a970[_0xb384('0x47')]=_[_0xb384('0x48')](_0x45a970['model'],_0x45a970['query']);_0x591a81[_0xb384('0x4c')]=_[_0xb384('0x48')](_0x45a970[_0xb384('0x49')],qs[_0xb384('0x4a')](_0x117474[_0xb384('0x46')]['fields']));_0x591a81['attributes']=_0x591a81['attributes'][_0xb384('0x4b')]?_0x591a81[_0xb384('0x4c')]:_0x45a970['model'];_0x591a81[_0xb384('0x50')]=qs['sort'](_0x117474[_0xb384('0x46')][_0xb384('0x51')]);_0x591a81[_0xb384('0x54')]=qs[_0xb384('0x47')](_[_0xb384('0x52')](_0x117474[_0xb384('0x46')],_0x45a970['filters']));if(_0x117474['query']['filter']){_0x591a81[_0xb384('0x54')]=_[_0xb384('0x55')](_0x591a81[_0xb384('0x54')],{'$or':_['map'](_0x591a81['attributes'],function(_0x1a8a51){var _0x2b228e={};_0x2b228e[_0x1a8a51]={'$like':'%'+_0x117474[_0xb384('0x46')][_0xb384('0x53')]+'%'};return _0x2b228e;})});}_0x591a81=_['merge']({},_0x591a81,_0x117474[_0xb384('0x5f')]);return _0x137175[_0xb384('0xc6')](_0x591a81);}})[_0xb384('0x25')](function(_0x12fa2d){if(_0x12fa2d){_0x43b40c=_0x12fa2d[_0xb384('0x4b')];if(!_0x117474[_0xb384('0x46')][_0xb384('0x4d')](_0xb384('0x4e'))){_0x591a81[_0xb384('0x33')]=qs[_0xb384('0x33')](_0x117474['query'][_0xb384('0x33')]);_0x591a81[_0xb384('0x4f')]=qs[_0xb384('0x4f')](_0x117474[_0xb384('0x46')]['offset']);}return _0x137175[_0xb384('0xc6')](_0x591a81);}})[_0xb384('0x25')](function(_0x5012af){if(_0x5012af){return _0x5012af?{'count':_0x43b40c,'rows':_0x5012af}:null;}})[_0xb384('0x25')](respondWithResult(_0x24138c,null))[_0xb384('0x2e')](handleError(_0x24138c,null));}; \ No newline at end of file +var _0x9a3a=['root','server/files/attachments','basename','CheckAfterSend','isNil','from','\x22%s\x22\x20<%s>','Contacts','ListId','List\x20not\x20found','filename','Messages','Contact\x20not\x20found','spread','out','ContactId','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','userFaxAccount:save','removeAgents','isArray','emit','userFaxAccount:remove','getAgents','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','crypto','to-csv','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','localhost','socket.io-emitter','./faxAccount.socket','register','client','http','request','then','info','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','FaxAccount,\x20%s,\x20%s','message','result','catch','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range','apply','save','update','destroy','FaxAccounts','stack','name','Pause','mandatoryDispositionPause','map','FaxAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','order','sort','where','pick','VIRTUAL','filter','merge','options','includeAll','include','findAll','show','params','find','create','body','user','get','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','Disposition','getDispositions','rows','removeDispositions','ids','addAnswer','FaxAccountId','CannedAnswer','getAnswers','findOne','nolimit','addInteraction','FaxInteraction','omit','getInteractions','hasOwnProperty','CmContact','Contact','User','Owner','fullname','internal','Tag','color','tag','addApplications','sequelize','transaction','FaxApplication','bulkCreate','findAndCountAll','priority','getApplications','from-voip-provider','exten','localstationid','app','system','description','push','CDR(type)=inbound-fax','Set','gateway','faxdetect','headerinfo','maxrate','minrate','modem','Wait','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','ReceiveFax','addAccountApplications','updateAccountApplications','VoiceExtension','tech','createdAt','updatedAt','TrunkId','findById','FaxMessage','$gte','split','YYYY-MM-DD\x20HH:mm:ss','send','CmList','List','DESC','attachments','join'];(function(_0x3e2a9e,_0x476f39){var _0x51eb5f=function(_0x421bb8){while(--_0x421bb8){_0x3e2a9e['push'](_0x3e2a9e['shift']());}};_0x51eb5f(++_0x476f39);}(_0x9a3a,0x19a));var _0xa9a3=function(_0x173c67,_0x31db4c){_0x173c67=_0x173c67-0x0;var _0x174507=_0x9a3a[_0x173c67];return _0x174507;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xa9a3('0x0'));var rp=require(_0xa9a3('0x1'));var moment=require(_0xa9a3('0x2'));var BPromise=require(_0xa9a3('0x3'));var Mustache=require(_0xa9a3('0x4'));var util=require(_0xa9a3('0x5'));var path=require(_0xa9a3('0x6'));var sox=require(_0xa9a3('0x7'));var csv=require('to-csv');var ejs=require(_0xa9a3('0x8'));var fs=require('fs');var fs_extra=require(_0xa9a3('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xa9a3('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xa9a3('0xb'));var querystring=require(_0xa9a3('0xc'));var Papa=require('papaparse');var Redis=require(_0xa9a3('0xd'));var authService=require(_0xa9a3('0xe'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa9a3('0xf'));var logger=require(_0xa9a3('0x10'))(_0xa9a3('0x11'));var utils=require(_0xa9a3('0x12'));var config=require(_0xa9a3('0x13'));var licenseUtil=require(_0xa9a3('0x14'));var db=require(_0xa9a3('0x15'))['db'];config['redis']=_[_0xa9a3('0x16')](config['redis'],{'host':_0xa9a3('0x17'),'port':0x18eb});var socket=require(_0xa9a3('0x18'))(new Redis(config['redis']));require(_0xa9a3('0x19'))[_0xa9a3('0x1a')](socket);var jayson=require('jayson/promise');var client=jayson[_0xa9a3('0x1b')][_0xa9a3('0x1c')]({'port':0x232c});var client9002=jayson[_0xa9a3('0x1b')][_0xa9a3('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x44f46d,_0x3c5ab3,_0x512532,_0x360e7a){return new BPromise(function(_0x6b7933,_0x109aa7){var _0x489860=_0x360e7a||client;return _0x489860[_0xa9a3('0x1d')](_0x44f46d,_0x512532)[_0xa9a3('0x1e')](function(_0x3143bd){logger[_0xa9a3('0x1f')]('FaxAccount,\x20%s,\x20%s',_0x3c5ab3,_0xa9a3('0x20'));logger[_0xa9a3('0x21')](_0xa9a3('0x22'),_0x3c5ab3,_0xa9a3('0x20'),JSON[_0xa9a3('0x23')](_0x3143bd));if(_0x3143bd['error']){if(_0x3143bd[_0xa9a3('0x24')]['code']===0x1f4){logger[_0xa9a3('0x24')](_0xa9a3('0x25'),_0x3c5ab3,_0x3143bd['error'][_0xa9a3('0x26')]);return _0x109aa7(_0x3143bd[_0xa9a3('0x24')][_0xa9a3('0x26')]);}logger[_0xa9a3('0x24')](_0xa9a3('0x25'),_0x3c5ab3,_0x3143bd[_0xa9a3('0x24')][_0xa9a3('0x26')]);return _0x6b7933(_0x3143bd[_0xa9a3('0x24')][_0xa9a3('0x26')]);}else{logger[_0xa9a3('0x1f')]('FaxAccount,\x20%s,\x20%s',_0x3c5ab3,_0xa9a3('0x20'));_0x6b7933(_0x3143bd[_0xa9a3('0x27')][_0xa9a3('0x26')]);}})[_0xa9a3('0x28')](function(_0x35d3c1){logger[_0xa9a3('0x24')](_0xa9a3('0x25'),_0x3c5ab3,_0x35d3c1);_0x109aa7(_0x35d3c1);});});}function respondWithStatusCode(_0x218392,_0x1b11c4){_0x1b11c4=_0x1b11c4||0xcc;return function(_0xc74b8f){if(_0xc74b8f){return _0x218392[_0xa9a3('0x29')](_0x1b11c4);}return _0x218392['status'](_0x1b11c4)[_0xa9a3('0x2a')]();};}function respondWithResult(_0x43d0a1,_0x48dcd2){_0x48dcd2=_0x48dcd2||0xc8;return function(_0x88637b){if(_0x88637b){return _0x43d0a1[_0xa9a3('0x2b')](_0x48dcd2)[_0xa9a3('0x2c')](_0x88637b);}};}function respondWithFilteredResult(_0x19a230,_0x339f7a){return function(_0xfb190e){if(_0xfb190e){var _0x4c6f68=typeof _0x339f7a[_0xa9a3('0x2d')]===_0xa9a3('0x2e')&&typeof _0x339f7a[_0xa9a3('0x2f')]===_0xa9a3('0x2e');var _0x11f8d2=_0xfb190e[_0xa9a3('0x30')];var _0x21d258=_0x4c6f68?0x0:_0x339f7a['offset'];var _0x303f22=_0x4c6f68?_0xfb190e[_0xa9a3('0x30')]:_0x339f7a[_0xa9a3('0x2d')]+_0x339f7a[_0xa9a3('0x2f')];var _0x24a7a4;if(_0x303f22>=_0x11f8d2){_0x303f22=_0x11f8d2;_0x24a7a4=0xc8;}else{_0x24a7a4=0xce;}_0x19a230[_0xa9a3('0x2b')](_0x24a7a4);return _0x19a230['set'](_0xa9a3('0x31'),_0x21d258+'-'+_0x303f22+'/'+_0x11f8d2)['json'](_0xfb190e);}return null;};}function patchUpdates(_0x4480ab){return function(_0x2711fc){try{jsonpatch[_0xa9a3('0x32')](_0x2711fc,_0x4480ab,!![]);}catch(_0x513cc4){return BPromise['reject'](_0x513cc4);}return _0x2711fc[_0xa9a3('0x33')]();};}function saveUpdates(_0x414604,_0x17d56b){return function(_0x4c1041){if(_0x4c1041){return _0x4c1041[_0xa9a3('0x34')](_0x414604)[_0xa9a3('0x1e')](function(_0x38d82c){return _0x38d82c;});}return null;};}function removeEntity(_0x9d7574,_0x426b28){return function(_0x178183){if(_0x178183){return _0x178183[_0xa9a3('0x35')]()[_0xa9a3('0x1e')](function(){var _0x5010d2=_0x178183['get']({'plain':!![]});var _0x31199a=_0xa9a3('0x36');return db['UserProfileResource'][_0xa9a3('0x35')]({'where':{'type':_0x31199a,'resourceId':_0x5010d2['id']}})[_0xa9a3('0x1e')](function(){return _0x178183;});})[_0xa9a3('0x1e')](function(){_0x9d7574['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x107408,_0x386b53){return function(_0x1a13d2){if(!_0x1a13d2){_0x107408[_0xa9a3('0x29')](0x194);}return _0x1a13d2;};}function handleError(_0x43b557,_0x4d2f78){_0x4d2f78=_0x4d2f78||0x1f4;return function(_0x3060ef){logger[_0xa9a3('0x24')](_0x3060ef[_0xa9a3('0x37')]);if(_0x3060ef[_0xa9a3('0x38')]){delete _0x3060ef['name'];}_0x43b557[_0xa9a3('0x2b')](_0x4d2f78)['send'](_0x3060ef);};}exports['index']=function(_0x124b8d,_0x22221c){var _0x202235={'include':[{'model':db[_0xa9a3('0x39')],'as':_0xa9a3('0x3a')}]},_0x4bcbe5={},_0xe874f1={'count':0x0,'rows':[]};var _0x3274d1=_[_0xa9a3('0x3b')](db[_0xa9a3('0x3c')][_0xa9a3('0x3d')],function(_0x396f95){return{'name':_0x396f95[_0xa9a3('0x3e')],'type':_0x396f95[_0xa9a3('0x3f')][_0xa9a3('0x40')]};});_0x4bcbe5[_0xa9a3('0x41')]=_[_0xa9a3('0x3b')](_0x3274d1,_0xa9a3('0x38'));_0x4bcbe5[_0xa9a3('0x42')]=_[_0xa9a3('0x43')](_0x124b8d[_0xa9a3('0x42')]);_0x4bcbe5[_0xa9a3('0x44')]=_[_0xa9a3('0x45')](_0x4bcbe5[_0xa9a3('0x41')],_0x4bcbe5[_0xa9a3('0x42')]);_0x202235[_0xa9a3('0x46')]=_['intersection'](_0x4bcbe5['model'],qs[_0xa9a3('0x47')](_0x124b8d[_0xa9a3('0x42')][_0xa9a3('0x47')]));_0x202235[_0xa9a3('0x46')]=_0x202235['attributes'][_0xa9a3('0x48')]?_0x202235[_0xa9a3('0x46')]:_0x4bcbe5[_0xa9a3('0x41')];if(!_0x124b8d[_0xa9a3('0x42')]['hasOwnProperty']('nolimit')){_0x202235[_0xa9a3('0x2f')]=qs[_0xa9a3('0x2f')](_0x124b8d[_0xa9a3('0x42')]['limit']);_0x202235[_0xa9a3('0x2d')]=qs[_0xa9a3('0x2d')](_0x124b8d[_0xa9a3('0x42')][_0xa9a3('0x2d')]);}_0x202235[_0xa9a3('0x49')]=qs['sort'](_0x124b8d[_0xa9a3('0x42')][_0xa9a3('0x4a')]);_0x202235[_0xa9a3('0x4b')]=qs[_0xa9a3('0x44')](_[_0xa9a3('0x4c')](_0x124b8d['query'],_0x4bcbe5[_0xa9a3('0x44')]),_0x3274d1);if(_0x124b8d[_0xa9a3('0x42')]['filter']){_0x202235[_0xa9a3('0x4b')]=_['merge'](_0x202235['where'],{'$or':_['map'](_0x3274d1,function(_0x4edae0){if(_0x4edae0['type']!==_0xa9a3('0x4d')){var _0x48a013={};_0x48a013[_0x4edae0['name']]={'$like':'%'+_0x124b8d[_0xa9a3('0x42')][_0xa9a3('0x4e')]+'%'};return _0x48a013;}})});}_0x202235=_[_0xa9a3('0x4f')]({},_0x202235,_0x124b8d[_0xa9a3('0x50')]);var _0x4176a0={'where':_0x202235[_0xa9a3('0x4b')]};return db[_0xa9a3('0x3c')][_0xa9a3('0x30')](_0x4176a0)['then'](function(_0x538a92){_0xe874f1[_0xa9a3('0x30')]=_0x538a92;if(_0x124b8d[_0xa9a3('0x42')][_0xa9a3('0x51')]){_0x202235[_0xa9a3('0x52')]=[{'all':!![]}];}return db[_0xa9a3('0x3c')][_0xa9a3('0x53')](_0x202235);})[_0xa9a3('0x1e')](function(_0x569997){_0xe874f1['rows']=_0x569997;return _0xe874f1;})[_0xa9a3('0x1e')](respondWithFilteredResult(_0x22221c,_0x202235))[_0xa9a3('0x28')](handleError(_0x22221c,null));};exports[_0xa9a3('0x54')]=function(_0x37ad97,_0x328743){var _0x48a9f6={'raw':![],'where':{'id':_0x37ad97[_0xa9a3('0x55')]['id']},'include':[{'model':db[_0xa9a3('0x39')],'as':_0xa9a3('0x3a')}]},_0x327032={};_0x327032[_0xa9a3('0x41')]=_[_0xa9a3('0x43')](db[_0xa9a3('0x3c')]['rawAttributes']);_0x327032[_0xa9a3('0x42')]=_['keys'](_0x37ad97[_0xa9a3('0x42')]);_0x327032[_0xa9a3('0x44')]=_['intersection'](_0x327032[_0xa9a3('0x41')],_0x327032[_0xa9a3('0x42')]);_0x48a9f6[_0xa9a3('0x46')]=_['intersection'](_0x327032[_0xa9a3('0x41')],qs[_0xa9a3('0x47')](_0x37ad97[_0xa9a3('0x42')]['fields']));_0x48a9f6[_0xa9a3('0x46')]=_0x48a9f6['attributes']['length']?_0x48a9f6['attributes']:_0x327032['model'];if(_0x37ad97[_0xa9a3('0x42')]['includeAll']){_0x48a9f6[_0xa9a3('0x52')]=[{'all':!![]}];}_0x48a9f6=_[_0xa9a3('0x4f')]({},_0x48a9f6,_0x37ad97[_0xa9a3('0x50')]);return db[_0xa9a3('0x3c')][_0xa9a3('0x56')](_0x48a9f6)['then'](handleEntityNotFound(_0x328743,null))[_0xa9a3('0x1e')](respondWithResult(_0x328743,null))[_0xa9a3('0x28')](handleError(_0x328743,null));};exports[_0xa9a3('0x57')]=function(_0x386ec0,_0x5b1a53){return db[_0xa9a3('0x3c')][_0xa9a3('0x57')](_0x386ec0[_0xa9a3('0x58')],{})['then'](function(_0x224809){var _0x174e82=_0x386ec0[_0xa9a3('0x59')][_0xa9a3('0x5a')]({'plain':!![]});if(!_0x174e82)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x174e82[_0xa9a3('0x5b')]==='user'){var _0x45b0b0=_0x224809[_0xa9a3('0x5a')]({'plain':!![]});var _0x36349c=_0xa9a3('0x36');return db[_0xa9a3('0x5c')][_0xa9a3('0x56')]({'where':{'name':_0x36349c,'userProfileId':_0x174e82['userProfileId']},'raw':!![]})['then'](function(_0x6d0291){if(_0x6d0291&&_0x6d0291[_0xa9a3('0x5d')]===0x0){return db['UserProfileResource'][_0xa9a3('0x57')]({'name':_0x45b0b0[_0xa9a3('0x38')],'resourceId':_0x45b0b0['id'],'type':_0x6d0291['name'],'sectionId':_0x6d0291['id']},{})['then'](function(){return _0x224809;});}else{return _0x224809;}})[_0xa9a3('0x28')](function(_0x3f08cc){logger[_0xa9a3('0x24')](_0xa9a3('0x5e'),_0x3f08cc);throw _0x3f08cc;});}return _0x224809;})[_0xa9a3('0x1e')](respondWithResult(_0x5b1a53,0xc9))[_0xa9a3('0x28')](handleError(_0x5b1a53,null));};exports[_0xa9a3('0x34')]=function(_0x583ecf,_0x204e75){if(_0x583ecf[_0xa9a3('0x58')]['id']){delete _0x583ecf[_0xa9a3('0x58')]['id'];}return db[_0xa9a3('0x3c')][_0xa9a3('0x56')]({'where':{'id':_0x583ecf[_0xa9a3('0x55')]['id']},'include':[{'model':db[_0xa9a3('0x39')],'as':_0xa9a3('0x3a')}]})[_0xa9a3('0x1e')](handleEntityNotFound(_0x204e75,null))['then'](saveUpdates(_0x583ecf[_0xa9a3('0x58')],null))['then'](respondWithResult(_0x204e75,null))[_0xa9a3('0x28')](handleError(_0x204e75,null));};exports[_0xa9a3('0x35')]=function(_0x451cdc,_0x425822){return db[_0xa9a3('0x3c')][_0xa9a3('0x56')]({'where':{'id':_0x451cdc[_0xa9a3('0x55')]['id']}})[_0xa9a3('0x1e')](handleEntityNotFound(_0x425822,null))[_0xa9a3('0x1e')](removeEntity(_0x425822,null))[_0xa9a3('0x28')](handleError(_0x425822,null));};exports[_0xa9a3('0x5f')]=function(_0x540951,_0x10589b){return db[_0xa9a3('0x3c')][_0xa9a3('0x5f')]()[_0xa9a3('0x1e')](respondWithResult(_0x10589b,null))['catch'](handleError(_0x10589b,null));};exports[_0xa9a3('0x60')]=function(_0x3e5999,_0x3ff015,_0x319ee9){if(_0x3e5999['body']['id']){delete _0x3e5999[_0xa9a3('0x58')]['id'];}return db[_0xa9a3('0x3c')][_0xa9a3('0x56')]({'where':{'id':_0x3e5999[_0xa9a3('0x55')]['id']}})[_0xa9a3('0x1e')](handleEntityNotFound(_0x3ff015,null))[_0xa9a3('0x1e')](function(_0x3f9d86){if(_0x3f9d86){_0x3e5999[_0xa9a3('0x58')]['FaxAccountId']=_0x3f9d86['id'];return db[_0xa9a3('0x61')][_0xa9a3('0x57')](_0x3e5999[_0xa9a3('0x58')]);}})[_0xa9a3('0x1e')](respondWithResult(_0x3ff015,null))[_0xa9a3('0x28')](handleError(_0x3ff015,null));};exports[_0xa9a3('0x62')]=function(_0x55b5ae,_0x5da599,_0x428541){var _0x38c1c2={'raw':![],'where':{}};var _0x1d055b={};var _0x4ada2f={'count':0x0,'rows':[]};return db['FaxAccount']['findOne']({'where':{'id':_0x55b5ae[_0xa9a3('0x55')]['id']}})[_0xa9a3('0x1e')](handleEntityNotFound(_0x5da599,null))['then'](function(_0x1af67c){if(_0x1af67c){_0x1d055b[_0xa9a3('0x41')]=_[_0xa9a3('0x43')](db[_0xa9a3('0x61')]['rawAttributes']);_0x1d055b[_0xa9a3('0x42')]=_['keys'](_0x55b5ae[_0xa9a3('0x42')]);_0x1d055b['filters']=_[_0xa9a3('0x45')](_0x1d055b[_0xa9a3('0x41')],_0x1d055b[_0xa9a3('0x42')]);_0x38c1c2[_0xa9a3('0x46')]=_[_0xa9a3('0x45')](_0x1d055b['model'],qs[_0xa9a3('0x47')](_0x55b5ae[_0xa9a3('0x42')][_0xa9a3('0x47')]));_0x38c1c2[_0xa9a3('0x46')]=_0x38c1c2[_0xa9a3('0x46')][_0xa9a3('0x48')]?_0x38c1c2[_0xa9a3('0x46')]:_0x1d055b[_0xa9a3('0x41')];if(!_0x55b5ae[_0xa9a3('0x42')]['hasOwnProperty']('nolimit')){_0x38c1c2[_0xa9a3('0x2f')]=qs['limit'](_0x55b5ae['query']['limit']);_0x38c1c2[_0xa9a3('0x2d')]=qs[_0xa9a3('0x2d')](_0x55b5ae['query'][_0xa9a3('0x2d')]);}_0x38c1c2[_0xa9a3('0x49')]=qs[_0xa9a3('0x4a')](_0x55b5ae['query'][_0xa9a3('0x4a')]);_0x38c1c2[_0xa9a3('0x4b')]=qs[_0xa9a3('0x44')](_['pick'](_0x55b5ae[_0xa9a3('0x42')],_0x1d055b[_0xa9a3('0x44')]));_0x38c1c2[_0xa9a3('0x4b')]['FaxAccountId']=_0x1af67c['id'];if(_0x55b5ae['query'][_0xa9a3('0x4e')]){_0x38c1c2[_0xa9a3('0x4b')]=_[_0xa9a3('0x4f')](_0x38c1c2[_0xa9a3('0x4b')],{'$or':_[_0xa9a3('0x3b')](_0x38c1c2[_0xa9a3('0x46')],function(_0xd174f0){var _0x3f188e={};_0x3f188e[_0xd174f0]={'$like':'%'+_0x55b5ae[_0xa9a3('0x42')][_0xa9a3('0x4e')]+'%'};return _0x3f188e;})});}_0x38c1c2=_['merge']({},_0x38c1c2,_0x55b5ae[_0xa9a3('0x50')]);return db[_0xa9a3('0x61')][_0xa9a3('0x30')]({'where':_0x38c1c2['where']})[_0xa9a3('0x1e')](function(_0x1346b2){_0x4ada2f[_0xa9a3('0x30')]=_0x1346b2;if(_0x55b5ae[_0xa9a3('0x42')][_0xa9a3('0x51')]){_0x38c1c2[_0xa9a3('0x52')]=[{'all':!![]}];}return db[_0xa9a3('0x61')][_0xa9a3('0x53')](_0x38c1c2);})[_0xa9a3('0x1e')](function(_0x2f2afa){_0x4ada2f[_0xa9a3('0x63')]=_0x2f2afa;return _0x4ada2f;});}})[_0xa9a3('0x1e')](respondWithFilteredResult(_0x5da599,_0x38c1c2))[_0xa9a3('0x28')](handleError(_0x5da599,null));};exports[_0xa9a3('0x64')]=function(_0x5f4e66,_0x4ca93b,_0x511e0a){return db['FaxAccount'][_0xa9a3('0x56')]({'where':{'id':_0x5f4e66[_0xa9a3('0x55')]['id']}})[_0xa9a3('0x1e')](handleEntityNotFound(_0x4ca93b,null))[_0xa9a3('0x1e')](function(_0x1e42e3){if(_0x1e42e3){return _0x1e42e3['removeDispositions'](_0x5f4e66[_0xa9a3('0x42')][_0xa9a3('0x65')]);}})['then'](respondWithStatusCode(_0x4ca93b,null))[_0xa9a3('0x28')](handleError(_0x4ca93b,null));};exports[_0xa9a3('0x66')]=function(_0x463206,_0xa5cea3,_0x585beb){if(_0x463206[_0xa9a3('0x58')]['id']){delete _0x463206[_0xa9a3('0x58')]['id'];}return db[_0xa9a3('0x3c')][_0xa9a3('0x56')]({'where':{'id':_0x463206['params']['id']}})['then'](handleEntityNotFound(_0xa5cea3,null))['then'](function(_0x2788fa){if(_0x2788fa){_0x463206[_0xa9a3('0x58')][_0xa9a3('0x67')]=_0x2788fa['id'];return db[_0xa9a3('0x68')][_0xa9a3('0x57')](_0x463206[_0xa9a3('0x58')]);}})[_0xa9a3('0x1e')](respondWithResult(_0xa5cea3,null))['catch'](handleError(_0xa5cea3,null));};exports[_0xa9a3('0x69')]=function(_0x637b2c,_0x1049e4,_0x56407b){var _0x35166b={'raw':![],'where':{}};var _0x46944b={};var _0x594d19={'count':0x0,'rows':[]};return db['FaxAccount'][_0xa9a3('0x6a')]({'where':{'id':_0x637b2c[_0xa9a3('0x55')]['id']}})[_0xa9a3('0x1e')](handleEntityNotFound(_0x1049e4,null))[_0xa9a3('0x1e')](function(_0x539fc4){if(_0x539fc4){_0x46944b['model']=_['keys'](db[_0xa9a3('0x68')]['rawAttributes']);_0x46944b['query']=_[_0xa9a3('0x43')](_0x637b2c[_0xa9a3('0x42')]);_0x46944b[_0xa9a3('0x44')]=_[_0xa9a3('0x45')](_0x46944b[_0xa9a3('0x41')],_0x46944b[_0xa9a3('0x42')]);_0x35166b['attributes']=_[_0xa9a3('0x45')](_0x46944b['model'],qs['fields'](_0x637b2c[_0xa9a3('0x42')][_0xa9a3('0x47')]));_0x35166b[_0xa9a3('0x46')]=_0x35166b[_0xa9a3('0x46')][_0xa9a3('0x48')]?_0x35166b[_0xa9a3('0x46')]:_0x46944b['model'];if(!_0x637b2c['query']['hasOwnProperty'](_0xa9a3('0x6b'))){_0x35166b[_0xa9a3('0x2f')]=qs[_0xa9a3('0x2f')](_0x637b2c[_0xa9a3('0x42')][_0xa9a3('0x2f')]);_0x35166b[_0xa9a3('0x2d')]=qs[_0xa9a3('0x2d')](_0x637b2c[_0xa9a3('0x42')][_0xa9a3('0x2d')]);}_0x35166b[_0xa9a3('0x49')]=qs['sort'](_0x637b2c[_0xa9a3('0x42')]['sort']);_0x35166b[_0xa9a3('0x4b')]=qs[_0xa9a3('0x44')](_['pick'](_0x637b2c[_0xa9a3('0x42')],_0x46944b[_0xa9a3('0x44')]));_0x35166b[_0xa9a3('0x4b')][_0xa9a3('0x67')]=_0x539fc4['id'];if(_0x637b2c['query'][_0xa9a3('0x4e')]){_0x35166b[_0xa9a3('0x4b')]=_[_0xa9a3('0x4f')](_0x35166b[_0xa9a3('0x4b')],{'$or':_[_0xa9a3('0x3b')](_0x35166b['attributes'],function(_0x4e1932){var _0xf16bc3={};_0xf16bc3[_0x4e1932]={'$like':'%'+_0x637b2c[_0xa9a3('0x42')][_0xa9a3('0x4e')]+'%'};return _0xf16bc3;})});}_0x35166b=_['merge']({},_0x35166b,_0x637b2c['options']);return db[_0xa9a3('0x68')][_0xa9a3('0x30')]({'where':_0x35166b[_0xa9a3('0x4b')]})[_0xa9a3('0x1e')](function(_0x335f78){_0x594d19[_0xa9a3('0x30')]=_0x335f78;if(_0x637b2c[_0xa9a3('0x42')][_0xa9a3('0x51')]){_0x35166b['include']=[{'all':!![]}];}return db[_0xa9a3('0x68')]['findAll'](_0x35166b);})[_0xa9a3('0x1e')](function(_0x1d79d8){_0x594d19['rows']=_0x1d79d8;return _0x594d19;});}})['then'](respondWithFilteredResult(_0x1049e4,_0x35166b))[_0xa9a3('0x28')](handleError(_0x1049e4,null));};exports['removeAnswers']=function(_0x16648e,_0x2299e0,_0x1929b2){return db['FaxAccount'][_0xa9a3('0x56')]({'where':{'id':_0x16648e[_0xa9a3('0x55')]['id']}})['then'](handleEntityNotFound(_0x2299e0,null))['then'](function(_0xa4db78){if(_0xa4db78){return _0xa4db78['removeAnswers'](_0x16648e[_0xa9a3('0x42')][_0xa9a3('0x65')]);}})['then'](respondWithStatusCode(_0x2299e0,null))[_0xa9a3('0x28')](handleError(_0x2299e0,null));};exports[_0xa9a3('0x6c')]=function(_0x52f9e4,_0x5226de,_0x3eeb57){return db[_0xa9a3('0x6d')][_0xa9a3('0x56')]({'where':{'id':_0x52f9e4['params']['id']}})[_0xa9a3('0x1e')](handleEntityNotFound(_0x5226de,null))['then'](function(_0x599d79){if(_0x599d79){return _0x599d79[_0xa9a3('0x6c')](_0x52f9e4['body'][_0xa9a3('0x65')],_[_0xa9a3('0x6e')](_0x52f9e4[_0xa9a3('0x58')],[_0xa9a3('0x65'),'id'])||{});}})[_0xa9a3('0x1e')](respondWithResult(_0x5226de,null))[_0xa9a3('0x28')](handleError(_0x5226de,null));};exports[_0xa9a3('0x6f')]=function(_0x10a47b,_0x1c25e0,_0x348d51){var _0x25c7ef={'raw':![],'where':{}};var _0x4e7daa={};var _0x5aeea0={'count':0x0,'rows':[]};return db['FaxAccount'][_0xa9a3('0x6a')]({'where':{'id':_0x10a47b[_0xa9a3('0x55')]['id']}})[_0xa9a3('0x1e')](handleEntityNotFound(_0x1c25e0,null))['then'](function(_0x138a63){if(_0x138a63){_0x4e7daa[_0xa9a3('0x41')]=_[_0xa9a3('0x43')](db[_0xa9a3('0x6d')][_0xa9a3('0x3d')]);_0x4e7daa[_0xa9a3('0x42')]=_[_0xa9a3('0x43')](_0x10a47b[_0xa9a3('0x42')]);_0x4e7daa['filters']=_[_0xa9a3('0x45')](_0x4e7daa[_0xa9a3('0x41')],_0x4e7daa[_0xa9a3('0x42')]);_0x25c7ef[_0xa9a3('0x46')]=_['intersection'](_0x4e7daa[_0xa9a3('0x41')],qs['fields'](_0x10a47b[_0xa9a3('0x42')][_0xa9a3('0x47')]));_0x25c7ef[_0xa9a3('0x46')]=_0x25c7ef[_0xa9a3('0x46')]['length']?_0x25c7ef[_0xa9a3('0x46')]:_0x4e7daa[_0xa9a3('0x41')];if(!_0x10a47b[_0xa9a3('0x42')][_0xa9a3('0x70')]('nolimit')){_0x25c7ef[_0xa9a3('0x2f')]=qs[_0xa9a3('0x2f')](_0x10a47b[_0xa9a3('0x42')][_0xa9a3('0x2f')]);_0x25c7ef[_0xa9a3('0x2d')]=qs['offset'](_0x10a47b[_0xa9a3('0x42')][_0xa9a3('0x2d')]);}_0x25c7ef[_0xa9a3('0x49')]=qs[_0xa9a3('0x4a')](_0x10a47b[_0xa9a3('0x42')][_0xa9a3('0x4a')]);_0x25c7ef[_0xa9a3('0x4b')]=qs[_0xa9a3('0x44')](_[_0xa9a3('0x4c')](_0x10a47b[_0xa9a3('0x42')],_0x4e7daa[_0xa9a3('0x44')]));_0x25c7ef[_0xa9a3('0x4b')][_0xa9a3('0x67')]=_0x138a63['id'];if(_0x10a47b[_0xa9a3('0x42')][_0xa9a3('0x4e')]){_0x25c7ef[_0xa9a3('0x4b')]=_[_0xa9a3('0x4f')](_0x25c7ef['where'],{'$or':_[_0xa9a3('0x3b')](_0x25c7ef['attributes'],function(_0x2745be){var _0xd34a4b={};_0xd34a4b[_0x2745be]={'$like':'%'+_0x10a47b[_0xa9a3('0x42')][_0xa9a3('0x4e')]+'%'};return _0xd34a4b;})});}_0x25c7ef=_[_0xa9a3('0x4f')]({},_0x25c7ef,_0x10a47b[_0xa9a3('0x50')]);return db[_0xa9a3('0x6d')][_0xa9a3('0x30')]({'where':_0x25c7ef['where']})[_0xa9a3('0x1e')](function(_0x319d92){_0x5aeea0[_0xa9a3('0x30')]=_0x319d92;if(_0x10a47b['query'][_0xa9a3('0x51')]){_0x25c7ef['include']=[{'model':db[_0xa9a3('0x71')],'as':_0xa9a3('0x72'),'required':![]},{'model':db[_0xa9a3('0x73')],'as':_0xa9a3('0x74'),'attributes':['name',_0xa9a3('0x75'),_0xa9a3('0x76')],'required':![]},{'model':db[_0xa9a3('0x77')],'as':'Tags','attributes':['id',_0xa9a3('0x38'),_0xa9a3('0x78')],'where':_0x10a47b['query'][_0xa9a3('0x79')]?{'id':_0x10a47b['query'][_0xa9a3('0x79')]}:undefined,'required':_0x10a47b[_0xa9a3('0x42')]['tag']?!![]:![]}];}return db[_0xa9a3('0x6d')][_0xa9a3('0x53')](_0x25c7ef);})[_0xa9a3('0x1e')](function(_0x53a038){_0x5aeea0[_0xa9a3('0x63')]=_0x53a038;return _0x5aeea0;});}})[_0xa9a3('0x1e')](respondWithFilteredResult(_0x1c25e0,_0x25c7ef))[_0xa9a3('0x28')](handleError(_0x1c25e0,null));};exports[_0xa9a3('0x7a')]=function(_0x1a990f,_0x177c21,_0x3f09d4){return db[_0xa9a3('0x3c')]['findOne']({'where':{'id':_0x1a990f[_0xa9a3('0x55')]['id']}})[_0xa9a3('0x1e')](handleEntityNotFound(_0x177c21,null))[_0xa9a3('0x1e')](function(_0x4779c0){if(_0x4779c0){return db[_0xa9a3('0x7b')][_0xa9a3('0x7c')](function(_0x29d90e){return db['FaxApplication'][_0xa9a3('0x35')]({'where':{'FaxAccountId':_0x1a990f[_0xa9a3('0x55')]['id']},'transaction':_0x29d90e})[_0xa9a3('0x1e')](function(_0x120784){var _0x259343=_[_0xa9a3('0x3b')](_0x1a990f[_0xa9a3('0x58')],function(_0x439332){_0x439332[_0xa9a3('0x67')]=_0x1a990f[_0xa9a3('0x55')]['id'];return _0x439332;});return db[_0xa9a3('0x7d')][_0xa9a3('0x7e')](_0x259343,{'transaction':_0x29d90e});});})[_0xa9a3('0x1e')](function(){return db[_0xa9a3('0x7d')][_0xa9a3('0x7f')]({'where':{'FaxAccountId':_0x1a990f[_0xa9a3('0x55')]['id']},'order':_0xa9a3('0x80')});});}})[_0xa9a3('0x1e')](respondWithResult(_0x177c21,null))[_0xa9a3('0x28')](handleError(_0x177c21,null));};exports[_0xa9a3('0x81')]=function(_0x2dd4e0,_0x9b46f3,_0x448b74){var _0xb9cfae={};var _0x119d6a={};var _0x33cadb;var _0x344750;return db[_0xa9a3('0x3c')][_0xa9a3('0x6a')]({'where':{'id':_0x2dd4e0[_0xa9a3('0x55')]['id']}})[_0xa9a3('0x1e')](handleEntityNotFound(_0x9b46f3,null))[_0xa9a3('0x1e')](function(_0x14fced){if(_0x14fced){_0x33cadb=_0x14fced;_0x119d6a[_0xa9a3('0x41')]=_[_0xa9a3('0x43')](db['FaxApplication']['rawAttributes']);_0x119d6a[_0xa9a3('0x42')]=_[_0xa9a3('0x43')](_0x2dd4e0['query']);_0x119d6a['filters']=_['intersection'](_0x119d6a['model'],_0x119d6a[_0xa9a3('0x42')]);_0xb9cfae[_0xa9a3('0x46')]=_[_0xa9a3('0x45')](_0x119d6a[_0xa9a3('0x41')],qs[_0xa9a3('0x47')](_0x2dd4e0[_0xa9a3('0x42')][_0xa9a3('0x47')]));_0xb9cfae['attributes']=_0xb9cfae[_0xa9a3('0x46')][_0xa9a3('0x48')]?_0xb9cfae[_0xa9a3('0x46')]:_0x119d6a[_0xa9a3('0x41')];_0xb9cfae[_0xa9a3('0x49')]=qs[_0xa9a3('0x4a')](_0x2dd4e0[_0xa9a3('0x42')][_0xa9a3('0x4a')]);_0xb9cfae[_0xa9a3('0x4b')]=qs[_0xa9a3('0x44')](_[_0xa9a3('0x4c')](_0x2dd4e0[_0xa9a3('0x42')],_0x119d6a[_0xa9a3('0x44')]));if(_0x2dd4e0[_0xa9a3('0x42')][_0xa9a3('0x4e')]){_0xb9cfae[_0xa9a3('0x4b')]=_[_0xa9a3('0x4f')](_0xb9cfae[_0xa9a3('0x4b')],{'$or':_[_0xa9a3('0x3b')](_0xb9cfae[_0xa9a3('0x46')],function(_0x3f35bc){var _0x84eadb={};_0x84eadb[_0x3f35bc]={'$like':'%'+_0x2dd4e0[_0xa9a3('0x42')]['filter']+'%'};return _0x84eadb;})});}_0xb9cfae=_[_0xa9a3('0x4f')]({},_0xb9cfae,_0x2dd4e0['options']);return _0x33cadb[_0xa9a3('0x81')](_0xb9cfae);}})[_0xa9a3('0x1e')](function(_0x54d82b){if(_0x54d82b){_0x344750=_0x54d82b[_0xa9a3('0x48')];if(!_0x2dd4e0['query'][_0xa9a3('0x70')]('nolimit')){_0xb9cfae[_0xa9a3('0x2f')]=qs[_0xa9a3('0x2f')](_0x2dd4e0[_0xa9a3('0x42')][_0xa9a3('0x2f')]);_0xb9cfae[_0xa9a3('0x2d')]=qs['offset'](_0x2dd4e0[_0xa9a3('0x42')]['offset']);}return _0x33cadb['getApplications'](_0xb9cfae);}})['then'](function(_0x52b0f6){if(_0x52b0f6){return _0x52b0f6?{'count':_0x344750,'rows':_0x52b0f6}:null;}})[_0xa9a3('0x1e')](respondWithResult(_0x9b46f3,null))[_0xa9a3('0x28')](handleError(_0x9b46f3,null));};function Extension(_0x8294d7,_0x2ef625,_0x3483e6,_0x1f2b70){this['context']=_0xa9a3('0x82');this[_0xa9a3('0x83')]=_0x8294d7[_0xa9a3('0x84')];this[_0xa9a3('0x85')]=_0x1f2b70;this[_0xa9a3('0x3f')]=_0xa9a3('0x86');this[_0xa9a3('0x87')]='Fax\x20Extension';this[_0xa9a3('0x67')]=_0x8294d7['id'];this[_0xa9a3('0x80')]=_0x2ef625;this['appdata']=_0x3483e6;}function createExtensionsReciveFax(_0x38489c){var _0x4aeebd=0x1;var _0x4c1d44=[];_0x4c1d44[_0xa9a3('0x88')](new Extension(_0x38489c,_0x4aeebd,'','Answer'));_0x4aeebd+=0x1;_0x4c1d44[_0xa9a3('0x88')](new Extension(_0x38489c,_0x4aeebd,_0xa9a3('0x89'),_0xa9a3('0x8a')));_0x4aeebd+=0x1;for(var _0x498d2d in _0x38489c){if(_0x38489c[_0xa9a3('0x70')](_0x498d2d)&&(_0x498d2d==='ecm'||_0x498d2d===_0xa9a3('0x84')||_0x498d2d===_0xa9a3('0x8b')||_0x498d2d===_0xa9a3('0x8c')||_0x498d2d===_0xa9a3('0x8d')||_0x498d2d===_0xa9a3('0x8e')||_0x498d2d===_0xa9a3('0x8f')||_0x498d2d===_0xa9a3('0x90')||_0x498d2d==='t38timeout')){_0x4c1d44[_0xa9a3('0x88')](new Extension(_0x38489c,_0x4aeebd,'FAXOPT('+_0x498d2d+')='+_0x38489c[_0x498d2d],_0xa9a3('0x8a')));_0x4aeebd+=0x1;}}_0x4c1d44[_0xa9a3('0x88')](new Extension(_0x38489c,_0x4aeebd,'6',_0xa9a3('0x91')));_0x4aeebd+=0x1;_0x4c1d44[_0xa9a3('0x88')](new Extension(_0x38489c,_0x4aeebd,_0xa9a3('0x92'),_0xa9a3('0x93')));_0x4aeebd=0x0;return _0x4c1d44;}exports[_0xa9a3('0x94')]=function(_0x2a0851,_0x5e2555,_0x32ce49){var _0x80a591;return db[_0xa9a3('0x7b')][_0xa9a3('0x7c')](function(_0x21d872){return db[_0xa9a3('0x3c')]['create'](_0x2a0851[_0xa9a3('0x58')],{'transaction':_0x21d872})[_0xa9a3('0x1e')](function(_0x98ad2b){_0x80a591=_0x98ad2b[_0xa9a3('0x5a')]({'plain':!![]});return db['VoiceExtension'][_0xa9a3('0x7e')](createExtensionsReciveFax(_0x80a591),{'transaction':_0x21d872});});})[_0xa9a3('0x1e')](function(){return _0x80a591;})[_0xa9a3('0x1e')](respondWithResult(_0x5e2555,null))['catch'](handleError(_0x5e2555,null));};exports[_0xa9a3('0x95')]=function(_0x7ab45a,_0x2415ef,_0x51cfe7){var _0x3b526d;return db['sequelize']['transaction'](function(_0x47b145){return db[_0xa9a3('0x3c')][_0xa9a3('0x34')](_0x7ab45a[_0xa9a3('0x58')],{'where':{'id':_0x7ab45a['body']['id']},'transaction':_0x47b145})[_0xa9a3('0x1e')](function(_0x2c70af){return db[_0xa9a3('0x96')][_0xa9a3('0x35')]({'where':{'FaxAccountId':_0x7ab45a[_0xa9a3('0x58')]['id']},'transaction':_0x47b145})[_0xa9a3('0x1e')](function(_0x35ca4b){return db[_0xa9a3('0x96')][_0xa9a3('0x7e')](createExtensionsReciveFax(_[_0xa9a3('0x6e')](_0x7ab45a[_0xa9a3('0x58')],[_0xa9a3('0x97'),_0xa9a3('0x40'),_0xa9a3('0x98'),_0xa9a3('0x99'),_0xa9a3('0x9a'),'ListId'])),{'transaction':_0x47b145});});});})[_0xa9a3('0x1e')](function(){return db[_0xa9a3('0x3c')][_0xa9a3('0x9b')](_0x7ab45a[_0xa9a3('0x58')]['id']);})[_0xa9a3('0x1e')](respondWithResult(_0x2415ef,null))['catch'](handleError(_0x2415ef,null));};exports['getMessages']=function(_0xa11e7b,_0x91621d,_0x452951){var _0x143cfe={'raw':!![],'where':{}};var _0x34402b={};var _0x4f2dd3={'count':0x0,'rows':[]};return db['FaxAccount'][_0xa9a3('0x6a')]({'where':{'id':_0xa11e7b[_0xa9a3('0x55')]['id']}})['then'](handleEntityNotFound(_0x91621d,null))[_0xa9a3('0x1e')](function(_0x57898a){if(_0x57898a){_0x34402b[_0xa9a3('0x41')]=_[_0xa9a3('0x43')](db[_0xa9a3('0x9c')][_0xa9a3('0x3d')]);_0x34402b[_0xa9a3('0x42')]=_[_0xa9a3('0x43')](_0xa11e7b['query']);_0x34402b[_0xa9a3('0x44')]=_[_0xa9a3('0x45')](_0x34402b[_0xa9a3('0x41')],_0x34402b['query']);_0x143cfe[_0xa9a3('0x46')]=_['intersection'](_0x34402b[_0xa9a3('0x41')],qs[_0xa9a3('0x47')](_0xa11e7b['query']['fields']));_0x143cfe[_0xa9a3('0x46')]=_0x143cfe['attributes'][_0xa9a3('0x48')]?_0x143cfe['attributes']:_0x34402b[_0xa9a3('0x41')];if(!_0xa11e7b[_0xa9a3('0x42')]['hasOwnProperty'](_0xa9a3('0x6b'))){_0x143cfe[_0xa9a3('0x2f')]=qs[_0xa9a3('0x2f')](_0xa11e7b[_0xa9a3('0x42')][_0xa9a3('0x2f')]);_0x143cfe['offset']=qs[_0xa9a3('0x2d')](_0xa11e7b[_0xa9a3('0x42')][_0xa9a3('0x2d')]);}_0x143cfe[_0xa9a3('0x49')]=qs[_0xa9a3('0x4a')](_0xa11e7b[_0xa9a3('0x42')][_0xa9a3('0x4a')]);_0x143cfe[_0xa9a3('0x4b')]=qs[_0xa9a3('0x44')](_['pick'](_0xa11e7b[_0xa9a3('0x42')],_0x34402b['filters']));_0x143cfe[_0xa9a3('0x4b')][_0xa9a3('0x67')]=_0x57898a['id'];if(_0xa11e7b[_0xa9a3('0x42')][_0xa9a3('0x4e')]){_0x143cfe[_0xa9a3('0x4b')]=_[_0xa9a3('0x4f')](_0x143cfe[_0xa9a3('0x4b')],{'$or':_[_0xa9a3('0x3b')](_0x143cfe['attributes'],function(_0x26f288){var _0x34e877={};_0x34e877[_0x26f288]={'$like':'%'+_0xa11e7b[_0xa9a3('0x42')][_0xa9a3('0x4e')]+'%'};return _0x34e877;})});}if(_0xa11e7b[_0xa9a3('0x42')][_0xa9a3('0x9d')]){var _0x5b0e68=_0xa11e7b['query'][_0xa9a3('0x9d')][_0xa9a3('0x9e')](',');var _0xfcc9b3={};_0xfcc9b3[_0x5b0e68[0x0]]={'$gte':moment(_0x5b0e68[0x1])['format'](_0xa9a3('0x9f'))};_0x143cfe[_0xa9a3('0x4b')]=_['merge'](_0x143cfe[_0xa9a3('0x4b')],_0xfcc9b3);}_0x143cfe=_[_0xa9a3('0x4f')]({},_0x143cfe,_0xa11e7b['options']);return db[_0xa9a3('0x9c')][_0xa9a3('0x30')]({'where':_0x143cfe[_0xa9a3('0x4b')]})[_0xa9a3('0x1e')](function(_0x2dbda7){_0x4f2dd3[_0xa9a3('0x30')]=_0x2dbda7;if(_0xa11e7b[_0xa9a3('0x42')][_0xa9a3('0x51')]){_0x143cfe[_0xa9a3('0x52')]=[{'all':!![]}];}return db[_0xa9a3('0x9c')][_0xa9a3('0x53')](_0x143cfe);})['then'](function(_0x3db2f2){_0x4f2dd3[_0xa9a3('0x63')]=_0x3db2f2;return _0x4f2dd3;});}})[_0xa9a3('0x1e')](respondWithFilteredResult(_0x91621d,_0x143cfe))[_0xa9a3('0x28')](handleError(_0x91621d,null));};exports[_0xa9a3('0xa0')]=function(_0x1e66f7,_0x4dec1d,_0x33d43e){var _0x4f5e2d,_0x19acd2={},_0xd3a415;if(_0x1e66f7[_0xa9a3('0x58')]['to']){_0xd3a415=_0x1e66f7['body']['to'][0x0];}return db[_0xa9a3('0x3c')]['find']({'where':{'id':_0x1e66f7['params']['id']},'include':[{'model':db[_0xa9a3('0xa1')],'as':_0xa9a3('0xa2'),'include':[{'model':db[_0xa9a3('0x71')],'as':'Contacts','where':{'fax':_0xd3a415},'limit':0x1,'order':[[_0xa9a3('0x99'),_0xa9a3('0xa3')]]}]}]})[_0xa9a3('0x1e')](handleEntityNotFound(_0x4dec1d,null))[_0xa9a3('0x1e')](function(_0x458d03){_0x4f5e2d=_0x458d03;if(_0x1e66f7[_0xa9a3('0x58')]['attachments']&&_0x1e66f7[_0xa9a3('0x58')]['attachments']['length']){for(var _0x23666f=0x0;_0x23666f<_0x1e66f7[_0xa9a3('0x58')][_0xa9a3('0xa4')]['length'];_0x23666f+=0x1){_0x1e66f7['body']['attachments'][_0x23666f]={'filename':_0x1e66f7[_0xa9a3('0x58')][_0xa9a3('0xa4')][_0x23666f][_0xa9a3('0x38')],'id':_0x1e66f7[_0xa9a3('0x58')][_0xa9a3('0xa4')][_0x23666f]['id'],'path':path[_0xa9a3('0xa5')](config[_0xa9a3('0xa6')],_0xa9a3('0xa7'),_0x1e66f7[_0xa9a3('0x58')][_0xa9a3('0xa4')][_0x23666f][_0xa9a3('0xa8')])};}}return respondWithRpcPromise(_0xa9a3('0xa9'),_0xa9a3('0xa9'),{'FaxAccountId':_[_0xa9a3('0xaa')](_0x1e66f7[_0xa9a3('0x55')]['id'])?undefined:_0x1e66f7[_0xa9a3('0x55')]['id'],'path':_[_0xa9a3('0xaa')](_0x1e66f7[_0xa9a3('0x58')][_0xa9a3('0xa4')][0x0][_0xa9a3('0x6')])?undefined:_0x1e66f7['body'][_0xa9a3('0xa4')][0x0]['path'],'fax':_[_0xa9a3('0xaa')](_0x1e66f7[_0xa9a3('0x58')]['to'][0x0])?undefined:_0x1e66f7['body']['to'][0x0]},client9002);})[_0xa9a3('0x1e')](function(){if(_0x4f5e2d){if(_[_0xa9a3('0xaa')](_0x1e66f7[_0xa9a3('0x58')][_0xa9a3('0xab')])){_0x1e66f7[_0xa9a3('0x58')][_0xa9a3('0xab')]=util['format'](_0xa9a3('0xac'),_0x4f5e2d[_0xa9a3('0x38')],_0x4f5e2d['fax']);}if(_0x4f5e2d['List']){if(_0x4f5e2d[_0xa9a3('0xa2')][_0xa9a3('0xad')][_0xa9a3('0x48')]){return _0x4f5e2d[_0xa9a3('0xa2')]['Contacts'][0x0];}else{return db['CmContact'][_0xa9a3('0x57')](_[_0xa9a3('0x16')](_0x1e66f7['body'],{'firstName':_0x1e66f7[_0xa9a3('0x58')]['to'][0x0],'phone':_0x1e66f7[_0xa9a3('0x58')]['to'][0x0],'fax':_0x1e66f7[_0xa9a3('0x58')]['to'][0x0],'ListId':_0x4f5e2d[_0xa9a3('0xae')]}));}}else{throw new Error(_0xa9a3('0xaf'));}}else{throw new Error('Send\x20Fax\x20failed');}})[_0xa9a3('0x1e')](function(_0x14a7f9){if(_0x14a7f9){return db['FaxInteraction'][_0xa9a3('0x56')]({'where':{'ContactId':_0x14a7f9['id'],'closed':![],'FaxAccountId':_0x4f5e2d['id']}})[_0xa9a3('0x1e')](function(_0x20f4ff){if(_0x20f4ff){return[_0x20f4ff,![]];}return db['FaxInteraction']['create']({'UserId':_0x1e66f7['user']['id'],'ContactId':_0x14a7f9['id'],'FaxAccountId':_0x4f5e2d['id'],'fax':_0x1e66f7[_0xa9a3('0x58')]['to'][0x0],'firstMsgDirection':'out','Messages':[_[_0xa9a3('0x4f')](_0x1e66f7[_0xa9a3('0x58')],{'read':![],'body':_0x1e66f7[_0xa9a3('0x58')]['attachments'][0x0][_0xa9a3('0xb0')],'FaxAccountId':_0x4f5e2d['id'],'UserId':_0x1e66f7['user']['id'],'ContactId':_0x14a7f9['id'],'AttachmentId':_0x1e66f7['body'][_0xa9a3('0xa4')][0x0]['id']})]},{'include':[{'model':db[_0xa9a3('0x9c')],'as':_0xa9a3('0xb1')}]})[_0xa9a3('0x1e')](function(_0x3de677){return[_0x3de677,!![]];});});}else{throw new Error(_0xa9a3('0xb2'));}})[_0xa9a3('0xb3')](function(_0x5b04a6,_0x503322){if(_0x503322){return _0x5b04a6;}return db['FaxMessage']['create']({'direction':_0xa9a3('0xb4'),'read':![],'body':_0x1e66f7['body'][_0xa9a3('0xa4')][0x0][_0xa9a3('0xb0')],'FaxAccountId':_0x4f5e2d['id'],'FaxInteractionId':_0x5b04a6['id'],'UserId':_0x1e66f7['user']['id'],'ContactId':_0x5b04a6[_0xa9a3('0xb5')],'AttachmentId':_0x1e66f7['body'][_0xa9a3('0xa4')][0x0]['id']})[_0xa9a3('0x1e')](function(_0x1cad77){_0x5b04a6['dataValues'][_0xa9a3('0xb1')]=[];_0x5b04a6[_0xa9a3('0xb6')][_0xa9a3('0xb1')][_0xa9a3('0x88')](_0x1cad77[_0xa9a3('0xb6')]);return _0x5b04a6;});})[_0xa9a3('0x1e')](function(_0x54ec10){respondWithRpcPromise(_0xa9a3('0xb7'),_0xa9a3('0xb7'),{'FaxAccountId':_[_0xa9a3('0xaa')](_0x1e66f7[_0xa9a3('0x55')]['id'])?undefined:_0x1e66f7['params']['id'],'path':_[_0xa9a3('0xaa')](_0x1e66f7[_0xa9a3('0x58')]['attachments'][0x0][_0xa9a3('0x6')])?undefined:_0x1e66f7[_0xa9a3('0x58')][_0xa9a3('0xa4')][0x0][_0xa9a3('0x6')],'fax':_[_0xa9a3('0xaa')](_0x1e66f7[_0xa9a3('0x58')]['to'][0x0])?undefined:_0x1e66f7[_0xa9a3('0x58')]['to'][0x0],'AttachmentId':_0x1e66f7[_0xa9a3('0x58')]['attachments'][0x0]['id']},client9002)[_0xa9a3('0x1e')](function(_0x264e33){logger[_0xa9a3('0x1f')](_0xa9a3('0xb8'),_0x264e33);})[_0xa9a3('0x28')](function(_0x200585){logger[_0xa9a3('0x1f')](_0xa9a3('0xb8'),_0x200585);});return _0x54ec10;})[_0xa9a3('0x1e')](respondWithResult(_0x4dec1d,null))[_0xa9a3('0x28')](handleError(_0x4dec1d,null));};exports[_0xa9a3('0xb9')]=function(_0x376fa3,_0x31baf2,_0x2a64cb){return db['FaxAccount'][_0xa9a3('0x56')]({'where':{'id':_0x376fa3[_0xa9a3('0x55')]['id']}})['then'](handleEntityNotFound(_0x31baf2,null))['then'](function(_0x3ee0c3){if(_0x3ee0c3){return _0x3ee0c3['addAgents'](_0x376fa3['body'][_0xa9a3('0x65')],_['omit'](_0x376fa3['body'],[_0xa9a3('0x65'),'id'])||{})[_0xa9a3('0xb3')](function(_0x447fe9){for(var _0x59e930=0x0;_0x59e930<_0x376fa3['body'][_0xa9a3('0x65')][_0xa9a3('0x48')];_0x59e930+=0x1){socket['emit'](_0xa9a3('0xba'),{'UserId':Number(_0x376fa3['body'][_0xa9a3('0x65')][_0x59e930]),'FaxAccountId':Number(_0x376fa3[_0xa9a3('0x55')]['id'])});}return _0x447fe9;});}})[_0xa9a3('0x1e')](respondWithResult(_0x31baf2,null))[_0xa9a3('0x28')](handleError(_0x31baf2,null));};exports['removeAgents']=function(_0x29f983,_0x5e73a1,_0x5d4933){return db[_0xa9a3('0x3c')][_0xa9a3('0x56')]({'where':{'id':_0x29f983[_0xa9a3('0x55')]['id']}})['then'](handleEntityNotFound(_0x5e73a1,null))[_0xa9a3('0x1e')](function(_0x15f9fc){if(_0x15f9fc){return _0x15f9fc[_0xa9a3('0xbb')](_0x29f983[_0xa9a3('0x42')]['ids'])[_0xa9a3('0x1e')](function(){if(_[_0xa9a3('0xbc')](_0x29f983[_0xa9a3('0x42')][_0xa9a3('0x65')])){for(var _0x40a70c=0x0;_0x40a70c<_0x29f983[_0xa9a3('0x42')][_0xa9a3('0x65')][_0xa9a3('0x48')];_0x40a70c+=0x1){socket[_0xa9a3('0xbd')](_0xa9a3('0xbe'),{'UserId':Number(_0x29f983['query'][_0xa9a3('0x65')][_0x40a70c]),'FaxAccountId':Number(_0x29f983['params']['id'])});}}else{socket[_0xa9a3('0xbd')]('userFaxAccount:remove',{'UserId':Number(_0x29f983[_0xa9a3('0x42')][_0xa9a3('0x65')]),'FaxAccountId':Number(_0x29f983[_0xa9a3('0x55')]['id'])});}});}})['then'](respondWithStatusCode(_0x5e73a1,null))[_0xa9a3('0x28')](handleError(_0x5e73a1,null));};exports[_0xa9a3('0xbf')]=function(_0x6547aa,_0x4f979b,_0xbb75a3){var _0x5a3bf1={};var _0x5f059c={};var _0x526219;var _0x4467e0;return db[_0xa9a3('0x3c')][_0xa9a3('0x6a')]({'where':{'id':_0x6547aa[_0xa9a3('0x55')]['id']}})[_0xa9a3('0x1e')](handleEntityNotFound(_0x4f979b,null))['then'](function(_0x33f4ab){if(_0x33f4ab){_0x526219=_0x33f4ab;_0x5f059c['model']=_[_0xa9a3('0x43')](db[_0xa9a3('0x73')]['rawAttributes']);_0x5f059c[_0xa9a3('0x42')]=_[_0xa9a3('0x43')](_0x6547aa[_0xa9a3('0x42')]);_0x5f059c[_0xa9a3('0x44')]=_['intersection'](_0x5f059c[_0xa9a3('0x41')],_0x5f059c[_0xa9a3('0x42')]);_0x5a3bf1[_0xa9a3('0x46')]=_[_0xa9a3('0x45')](_0x5f059c[_0xa9a3('0x41')],qs[_0xa9a3('0x47')](_0x6547aa[_0xa9a3('0x42')][_0xa9a3('0x47')]));_0x5a3bf1[_0xa9a3('0x46')]=_0x5a3bf1['attributes']['length']?_0x5a3bf1[_0xa9a3('0x46')]:_0x5f059c['model'];_0x5a3bf1[_0xa9a3('0x49')]=qs[_0xa9a3('0x4a')](_0x6547aa[_0xa9a3('0x42')][_0xa9a3('0x4a')]);_0x5a3bf1[_0xa9a3('0x4b')]=qs[_0xa9a3('0x44')](_[_0xa9a3('0x4c')](_0x6547aa[_0xa9a3('0x42')],_0x5f059c[_0xa9a3('0x44')]));if(_0x6547aa[_0xa9a3('0x42')][_0xa9a3('0x4e')]){_0x5a3bf1[_0xa9a3('0x4b')]=_['merge'](_0x5a3bf1[_0xa9a3('0x4b')],{'$or':_[_0xa9a3('0x3b')](_0x5a3bf1[_0xa9a3('0x46')],function(_0x55e40e){var _0x2eb703={};_0x2eb703[_0x55e40e]={'$like':'%'+_0x6547aa[_0xa9a3('0x42')][_0xa9a3('0x4e')]+'%'};return _0x2eb703;})});}_0x5a3bf1=_[_0xa9a3('0x4f')]({},_0x5a3bf1,_0x6547aa['options']);return _0x526219[_0xa9a3('0xbf')](_0x5a3bf1);}})[_0xa9a3('0x1e')](function(_0x5e3c2b){if(_0x5e3c2b){_0x4467e0=_0x5e3c2b[_0xa9a3('0x48')];if(!_0x6547aa[_0xa9a3('0x42')][_0xa9a3('0x70')](_0xa9a3('0x6b'))){_0x5a3bf1['limit']=qs['limit'](_0x6547aa['query'][_0xa9a3('0x2f')]);_0x5a3bf1[_0xa9a3('0x2d')]=qs['offset'](_0x6547aa[_0xa9a3('0x42')]['offset']);}return _0x526219[_0xa9a3('0xbf')](_0x5a3bf1);}})[_0xa9a3('0x1e')](function(_0x3b548a){if(_0x3b548a){return _0x3b548a?{'count':_0x4467e0,'rows':_0x3b548a}:null;}})[_0xa9a3('0x1e')](respondWithResult(_0x4f979b,null))['catch'](handleError(_0x4f979b,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index 9389e97..f739ffd 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 _0x60d7=['../../mysqldb','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','events'];(function(_0x1104ed,_0x578ff9){var _0x27d221=function(_0xa83f7b){while(--_0xa83f7b){_0x1104ed['push'](_0x1104ed['shift']());}};_0x27d221(++_0x578ff9);}(_0x60d7,0xe9));var _0x760d=function(_0x392b8e,_0x18b263){_0x392b8e=_0x392b8e-0x0;var _0x5e4efe=_0x60d7[_0x392b8e];return _0x5e4efe;};'use strict';var EventEmitter=require(_0x760d('0x0'));var FaxAccount=require(_0x760d('0x1'))['db']['FaxAccount'];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0x760d('0x2')](0x0);var events={'afterCreate':_0x760d('0x3'),'afterUpdate':_0x760d('0x4'),'afterDestroy':_0x760d('0x5')};function emitEvent(_0x18da70){return function(_0x46c40d,_0x3f8202,_0x39ab66){FaxAccountEvents[_0x760d('0x6')](_0x18da70+':'+_0x46c40d['id'],_0x46c40d);FaxAccountEvents[_0x760d('0x6')](_0x18da70,_0x46c40d);_0x39ab66(null);};}for(var e in events){if(events[_0x760d('0x7')](e)){var event=events[e];FaxAccount[_0x760d('0x8')](e,emitEvent(event));}}module['exports']=FaxAccountEvents; \ No newline at end of file +var _0x7543=['remove','emit','hook','exports','../../mysqldb','FaxAccount','setMaxListeners','save','update'];(function(_0x45413a,_0x281b1c){var _0x27fe7f=function(_0x11e59e){while(--_0x11e59e){_0x45413a['push'](_0x45413a['shift']());}};_0x27fe7f(++_0x281b1c);}(_0x7543,0xca));var _0x3754=function(_0x4ac941,_0x2432a9){_0x4ac941=_0x4ac941-0x0;var _0x4d1ad1=_0x7543[_0x4ac941];return _0x4d1ad1;};'use strict';var EventEmitter=require('events');var FaxAccount=require(_0x3754('0x0'))['db'][_0x3754('0x1')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0x3754('0x2')](0x0);var events={'afterCreate':_0x3754('0x3'),'afterUpdate':_0x3754('0x4'),'afterDestroy':_0x3754('0x5')};function emitEvent(_0x1f13c8){return function(_0x276109,_0x3e5e4e,_0x42c22e){FaxAccountEvents[_0x3754('0x6')](_0x1f13c8+':'+_0x276109['id'],_0x276109);FaxAccountEvents[_0x3754('0x6')](_0x1f13c8,_0x276109);_0x42c22e(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxAccount[_0x3754('0x7')](e,emitEvent(event));}}module[_0x3754('0x8')]=FaxAccountEvents; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.model.js b/server/api/faxAccount/faxAccount.model.js index a6267a3..274fa3f 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 _0x5472=['exports','define','fax_accounts','lodash','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./faxAccount.attributes'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x5472,0x1d1));var _0x2547=function(_0x38ff3c,_0x53525b){_0x38ff3c=_0x38ff3c-0x0;var _0x339faa=_0x5472[_0x38ff3c];return _0x339faa;};'use strict';var _=require(_0x2547('0x0'));var util=require('util');var logger=require(_0x2547('0x1'))(_0x2547('0x2'));var moment=require('moment');var BPromise=require(_0x2547('0x3'));var rp=require(_0x2547('0x4'));var fs=require('fs');var path=require(_0x2547('0x5'));var rimraf=require('rimraf');var config=require(_0x2547('0x6'));var attributes=require(_0x2547('0x7'));module[_0x2547('0x8')]=function(_0x2cc241,_0x2f4569){return _0x2cc241[_0x2547('0x9')]('FaxAccount',attributes,{'tableName':_0x2547('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6ee8=['FaxAccount','fax_accounts','lodash','util','api','moment','bluebird','request-promise','path','../../config/environment','exports'];(function(_0x37a1e6,_0x536b85){var _0x115a59=function(_0x4173a7){while(--_0x4173a7){_0x37a1e6['push'](_0x37a1e6['shift']());}};_0x115a59(++_0x536b85);}(_0x6ee8,0x10a));var _0x86ee=function(_0x2ff22c,_0xae3c7d){_0x2ff22c=_0x2ff22c-0x0;var _0x2a8243=_0x6ee8[_0x2ff22c];return _0x2a8243;};'use strict';var _=require(_0x86ee('0x0'));var util=require(_0x86ee('0x1'));var logger=require('../../config/logger')(_0x86ee('0x2'));var moment=require(_0x86ee('0x3'));var BPromise=require(_0x86ee('0x4'));var rp=require(_0x86ee('0x5'));var fs=require('fs');var path=require(_0x86ee('0x6'));var rimraf=require('rimraf');var config=require(_0x86ee('0x7'));var attributes=require('./faxAccount.attributes');module[_0x86ee('0x8')]=function(_0x39d68c,_0x4daa4f){return _0x39d68c['define'](_0x86ee('0x9'),attributes,{'tableName':_0x86ee('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.rpc.js b/server/api/faxAccount/faxAccount.rpc.js index 4bb33ce..86c5c6b 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 _0xcfaf=['interaction','FaxMessage','ContactId','AttachmentId','UserId','User','unshift','startRouting','Start','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./faxAccount.socket','register','request','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetFaxAccount','FaxAccount','findAll','options','raw','attributes','limit','include','map','model','then','body','fax','CmContact','describe','Sequelize','ValidationError','no\x20available\x20attributes','difference','keys','updatedAt','createdAt','CompanyId','ListId','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','find','List','Applications','get','account','applications','list','orderBy','asc','Contacts','length','from','create','contact','FaxInteraction','Contact\x20not\x20found','spread','push','unmanaged','*,*,*,*','created'];(function(_0x3db199,_0x43f3c1){var _0x580d61=function(_0x24d45c){while(--_0x24d45c){_0x3db199['push'](_0x3db199['shift']());}};_0x580d61(++_0x43f3c1);}(_0xcfaf,0xb9));var _0xfcfa=function(_0x3f1678,_0x195928){_0x3f1678=_0x3f1678-0x0;var _0x2e4da2=_0xcfaf[_0x3f1678];return _0x2e4da2;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xfcfa('0x0'));var BPromise=require('bluebird');var rs=require(_0xfcfa('0x1'));var fs=require('fs');var Redis=require(_0xfcfa('0x2'));var db=require(_0xfcfa('0x3'))['db'];var utils=require(_0xfcfa('0x4'));var logger=require(_0xfcfa('0x5'))(_0xfcfa('0x6'));var config=require(_0xfcfa('0x7'));var jayson=require(_0xfcfa('0x8'));var client=jayson[_0xfcfa('0x9')][_0xfcfa('0xa')]({'port':0x232c});config[_0xfcfa('0xb')]=_[_0xfcfa('0xc')](config[_0xfcfa('0xb')],{'host':_0xfcfa('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xfcfa('0xe'))[_0xfcfa('0xf')](socket);function respondWithRpcPromise(_0x300a70,_0x55b888,_0x257f84){return new BPromise(function(_0x3bc287,_0x153763){return client[_0xfcfa('0x10')](_0x300a70,_0x257f84)['then'](function(_0x471464){logger[_0xfcfa('0x11')](_0xfcfa('0x12'),_0x55b888,_0xfcfa('0x13'));logger[_0xfcfa('0x14')](_0xfcfa('0x15'),_0x55b888,_0xfcfa('0x13'),JSON[_0xfcfa('0x16')](_0x471464));if(_0x471464[_0xfcfa('0x17')]){if(_0x471464[_0xfcfa('0x17')][_0xfcfa('0x18')]===0x1f4){logger[_0xfcfa('0x17')](_0xfcfa('0x12'),_0x55b888,_0x471464[_0xfcfa('0x17')][_0xfcfa('0x19')]);return _0x153763(_0x471464[_0xfcfa('0x17')][_0xfcfa('0x19')]);}logger[_0xfcfa('0x17')]('FaxAccount,\x20%s,\x20%s',_0x55b888,_0x471464[_0xfcfa('0x17')][_0xfcfa('0x19')]);return _0x3bc287(_0x471464[_0xfcfa('0x17')]['message']);}else{logger[_0xfcfa('0x11')](_0xfcfa('0x12'),_0x55b888,_0xfcfa('0x13'));_0x3bc287(_0x471464[_0xfcfa('0x1a')]['message']);}})[_0xfcfa('0x1b')](function(_0x9e1adb){logger[_0xfcfa('0x17')]('FaxAccount,\x20%s,\x20%s',_0x55b888,_0x9e1adb);_0x153763(_0x9e1adb);});});}exports[_0xfcfa('0x1c')]=function(_0x4c3c93){var _0x4859f4=this;return new Promise(function(_0x19e99b,_0x24a078){return db[_0xfcfa('0x1d')][_0xfcfa('0x1e')]({'raw':_0x4c3c93[_0xfcfa('0x1f')]?_0x4c3c93[_0xfcfa('0x1f')][_0xfcfa('0x20')]===undefined?!![]:![]:!![],'where':_0x4c3c93['options']?_0x4c3c93['options']['where']||null:null,'attributes':_0x4c3c93[_0xfcfa('0x1f')]?_0x4c3c93[_0xfcfa('0x1f')][_0xfcfa('0x21')]||null:null,'limit':_0x4c3c93['options']?_0x4c3c93[_0xfcfa('0x1f')][_0xfcfa('0x22')]||null:null,'include':_0x4c3c93[_0xfcfa('0x1f')]?_0x4c3c93[_0xfcfa('0x1f')][_0xfcfa('0x23')]?_[_0xfcfa('0x24')](_0x4c3c93[_0xfcfa('0x1f')]['include'],function(_0x5754bd){return{'model':db[_0x5754bd[_0xfcfa('0x25')]],'as':_0x5754bd['as'],'attributes':_0x5754bd[_0xfcfa('0x21')],'include':_0x5754bd[_0xfcfa('0x23')]?_['map'](_0x5754bd[_0xfcfa('0x23')],function(_0x1efc13){return{'model':db[_0x1efc13[_0xfcfa('0x25')]],'as':_0x1efc13['as'],'attributes':_0x1efc13['attributes'],'include':_0x1efc13[_0xfcfa('0x23')]?_['map'](_0x1efc13['include'],function(_0x2317ab){return{'model':db[_0x2317ab[_0xfcfa('0x25')]],'as':_0x2317ab['as'],'attributes':_0x2317ab[_0xfcfa('0x21')]};}):[]};}):[]};}):[]:[]})[_0xfcfa('0x26')](function(_0x494635){logger['info'](_0xfcfa('0x1c'),_0x4c3c93);logger[_0xfcfa('0x14')](_0xfcfa('0x1c'),_0x4c3c93,JSON['stringify'](_0x494635));_0x19e99b(_0x494635);})['catch'](function(_0x5c0f37){logger[_0xfcfa('0x17')](_0xfcfa('0x1c'),_0x5c0f37[_0xfcfa('0x19')],_0x4c3c93);_0x24a078(_0x4859f4['error'](0x1f4,_0x5c0f37[_0xfcfa('0x19')]));});});};exports['NotifyFaxAccount']=function(_0x860170,_0x218c91,_0x131cb4){var _0x30db4d=this;return new Promise(function(_0x2e5ae0,_0x3ba05f){var _0x1c1cf5={'body':_0x860170[_0xfcfa('0x27')],'channel':_0xfcfa('0x28')};var _0xe9fdf4=[];var _0x5129f5=[];var _0x4adfb3={};return db[_0xfcfa('0x29')][_0xfcfa('0x2a')]()[_0xfcfa('0x26')](function(_0x2cc6c6){if(!_0x2cc6c6){throw new db[(_0xfcfa('0x2b'))][(_0xfcfa('0x2c'))](_0xfcfa('0x2d'));}_0xe9fdf4=_[_0xfcfa('0x2e')](_[_0xfcfa('0x2f')](_0x2cc6c6),['createdAt',_0xfcfa('0x30')]);_0x5129f5=_['difference'](_[_0xfcfa('0x2f')](_0x2cc6c6),[_0xfcfa('0x31'),_0xfcfa('0x30'),_0xfcfa('0x32'),_0xfcfa('0x33')]);if(_0x860170['body']['id']){delete _0x860170[_0xfcfa('0x27')]['id'];}if(_[_0xfcfa('0x34')](_0x860170[_0xfcfa('0x27')]['from'])){throw new db[(_0xfcfa('0x2b'))][(_0xfcfa('0x2c'))]('from\x20is\x20mandatory');}if(_['isNil'](_0x860170[_0xfcfa('0x27')][_0xfcfa('0x27')])||_0x860170[_0xfcfa('0x27')][_0xfcfa('0x27')]===''){throw new db[(_0xfcfa('0x2b'))][(_0xfcfa('0x2c'))](_0xfcfa('0x35'));}if(_[_0xfcfa('0x34')](_0x860170[_0xfcfa('0x27')]['mapKey'])){throw new db[(_0xfcfa('0x2b'))][(_0xfcfa('0x2c'))](_0xfcfa('0x36')+_0x5129f5);}if(!_[_0xfcfa('0x37')](_0x5129f5,_0x860170[_0xfcfa('0x27')][_0xfcfa('0x38')])){throw new db[(_0xfcfa('0x2b'))][(_0xfcfa('0x2c'))](_0xfcfa('0x39')+_0x5129f5);}_0x4adfb3[_0x860170['body'][_0xfcfa('0x38')]]=_0x860170['body']['from'];})[_0xfcfa('0x26')](function(){return db['FaxAccount'][_0xfcfa('0x3a')]({'where':{'id':_0x860170['account']['id']},'include':[{'model':db['CmList'],'as':_0xfcfa('0x3b'),'include':[{'model':db[_0xfcfa('0x29')],'as':'Contacts','where':_0x4adfb3,'limit':0x1,'order':[[_0xfcfa('0x30'),'DESC']]}]},{'model':db['FaxApplication'],'as':_0xfcfa('0x3c')}]});})[_0xfcfa('0x26')](function(_0x4e2989){if(_0x4e2989&&_0x4e2989['List']){var _0x44c771=_0x4e2989[_0xfcfa('0x3d')]({'plain':!![]});_0x1c1cf5[_0xfcfa('0x3e')]=_0x44c771;_0x1c1cf5[_0xfcfa('0x3f')]=_0x44c771[_0xfcfa('0x3c')];_0x1c1cf5[_0xfcfa('0x40')]=_0x44c771[_0xfcfa('0x3b')];_0x1c1cf5[_0xfcfa('0x3f')]=_[_0xfcfa('0x41')](_0x1c1cf5['applications'],['priority'],[_0xfcfa('0x42')]);if(_0x1c1cf5[_0xfcfa('0x3e')]['Applications']){delete _0x1c1cf5[_0xfcfa('0x3e')][_0xfcfa('0x3c')];}if(_0x1c1cf5[_0xfcfa('0x3e')][_0xfcfa('0x3b')]&&_0x1c1cf5[_0xfcfa('0x3e')][_0xfcfa('0x3b')][_0xfcfa('0x43')][_0xfcfa('0x44')]){return _0x1c1cf5[_0xfcfa('0x3e')]['List'][_0xfcfa('0x43')][0x0];}var _0x8d5199=_[_0xfcfa('0xc')](_0x860170[_0xfcfa('0x27')],{'firstName':_0x860170[_0xfcfa('0x27')][_0xfcfa('0x45')],'ListId':_0x44c771[_0xfcfa('0x33')]});_0x8d5199[_0x860170[_0xfcfa('0x27')]['mapKey']]=_0x860170[_0xfcfa('0x27')][_0xfcfa('0x45')];return db[_0xfcfa('0x29')][_0xfcfa('0x46')](_0x8d5199,{'fields':_0xe9fdf4,'raw':!![]});}})[_0xfcfa('0x26')](function(_0x285b3c){_0x1c1cf5[_0xfcfa('0x47')]=_0x285b3c;if(_0x285b3c){var _0xa9e40c={'ContactId':_0x285b3c['id'],'FaxAccountId':_0x860170[_0xfcfa('0x3e')]['id'],'fax':_0x285b3c[_0xfcfa('0x28')]};return db[_0xfcfa('0x48')][_0xfcfa('0x3a')]({'where':{'ContactId':_0x285b3c['id'],'closed':![],'FaxAccountId':_0x860170[_0xfcfa('0x3e')]['id']}})[_0xfcfa('0x26')](function(_0x4bd94c){if(_0x4bd94c){return[_0x4bd94c,![]];}return db[_0xfcfa('0x48')][_0xfcfa('0x46')](_0xa9e40c)[_0xfcfa('0x26')](function(_0x26895b){return[_0x26895b,!![]];});});}else{throw new Error(_0xfcfa('0x49'));}})[_0xfcfa('0x4a')](function(_0xa8830a,_0x105300){var _0x2e765f=_0xa8830a['get']({'plain':!![]});if(_0x105300){if(_0x1c1cf5['account']['autoclose']){_0x1c1cf5[_0xfcfa('0x3f')][_0xfcfa('0x4b')]({'id':0x0,'priority':_0x1c1cf5[_0xfcfa('0x3f')]['length']+0x1,'app':'close','appdata':_0xfcfa('0x4c'),'interval':_0xfcfa('0x4d')});}_0x2e765f[_0xfcfa('0x4e')]=!![];}else{_0x2e765f[_0xfcfa('0x4e')]=![];}_0x1c1cf5[_0xfcfa('0x4f')]=_0x2e765f;return db[_0xfcfa('0x50')][_0xfcfa('0x46')]({'body':_0x860170[_0xfcfa('0x27')]['body'],'FaxAccountId':_0x860170[_0xfcfa('0x3e')]['id'],'FaxInteractionId':_0xa8830a['id'],'direction':'in','ContactId':_0xa8830a[_0xfcfa('0x51')],'AttachmentId':_0x860170[_0xfcfa('0x27')][_0xfcfa('0x52')]});})[_0xfcfa('0x26')](function(_0x29af05){_0x1c1cf5[_0xfcfa('0x19')]=_0x29af05;if(_0x1c1cf5[_0xfcfa('0x4f')][_0xfcfa('0x53')]){return db[_0xfcfa('0x54')][_0xfcfa('0x3a')]({'attributes':['id','name'],'where':{'id':_0x1c1cf5[_0xfcfa('0x4f')]['UserId']}})[_0xfcfa('0x26')](function(_0xf2c1eb){if(_0xf2c1eb){_0x1c1cf5[_0xfcfa('0x3f')][_0xfcfa('0x55')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0xf2c1eb['name']+','+(_0x1c1cf5[_0xfcfa('0x3e')]['waitForTheAssignedAgent']||0xa),'interval':_0xfcfa('0x4d')});}return respondWithRpcPromise('Start',_0xfcfa('0x56'),_0x1c1cf5);});}return respondWithRpcPromise(_0xfcfa('0x57'),_0xfcfa('0x56'),_0x1c1cf5);})[_0xfcfa('0x26')](function(_0x527a40){_0x2e5ae0(_0x527a40);})[_0xfcfa('0x1b')](function(_0x296a21){_0x3ba05f(_0x30db4d[_0xfcfa('0x17')](0x1f4,_0x296a21[_0xfcfa('0x19')]));});});}; \ No newline at end of file +var _0xe829=['priority','asc','length','defaults','create','fax','FaxInteraction','find','Contact\x20not\x20found','autoclose','push','unmanaged','*,*,*,*','created','interaction','FaxMessage','ContactId','AttachmentId','UserId','User','unshift','name','Start','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','info','FaxAccount,\x20%s,\x20%s','request\x20sent','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetFaxAccount','FaxAccount','findAll','options','raw','attributes','limit','include','map','model','then','body','CmContact','describe','Sequelize','difference','updatedAt','keys','createdAt','CompanyId','ListId','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','ValidationError','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','account','CmList','List','Contacts','DESC','FaxApplication','Applications','get','applications','list'];(function(_0x481739,_0x714003){var _0x20f1d4=function(_0x266a1e){while(--_0x266a1e){_0x481739['push'](_0x481739['shift']());}};_0x20f1d4(++_0x714003);}(_0xe829,0x113));var _0x9e82=function(_0x443547,_0x21d7a8){_0x443547=_0x443547-0x0;var _0x1423a8=_0xe829[_0x443547];return _0x1423a8;};'use strict';var _=require(_0x9e82('0x0'));var util=require(_0x9e82('0x1'));var moment=require(_0x9e82('0x2'));var BPromise=require(_0x9e82('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9e82('0x4'));var db=require(_0x9e82('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x9e82('0x6'))(_0x9e82('0x7'));var config=require(_0x9e82('0x8'));var jayson=require(_0x9e82('0x9'));var client=jayson[_0x9e82('0xa')]['http']({'port':0x232c});config[_0x9e82('0xb')]=_['defaults'](config[_0x9e82('0xb')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9e82('0xb')]));require('./faxAccount.socket')['register'](socket);function respondWithRpcPromise(_0x2b6a1a,_0x5e4119,_0x381bd4){return new BPromise(function(_0x4762ea,_0xe6f581){return client['request'](_0x2b6a1a,_0x381bd4)['then'](function(_0x55f3c2){logger[_0x9e82('0xc')](_0x9e82('0xd'),_0x5e4119,_0x9e82('0xe'));logger['debug'](_0x9e82('0xf'),_0x5e4119,_0x9e82('0xe'),JSON[_0x9e82('0x10')](_0x55f3c2));if(_0x55f3c2[_0x9e82('0x11')]){if(_0x55f3c2['error'][_0x9e82('0x12')]===0x1f4){logger[_0x9e82('0x11')](_0x9e82('0xd'),_0x5e4119,_0x55f3c2[_0x9e82('0x11')][_0x9e82('0x13')]);return _0xe6f581(_0x55f3c2[_0x9e82('0x11')][_0x9e82('0x13')]);}logger['error']('FaxAccount,\x20%s,\x20%s',_0x5e4119,_0x55f3c2['error'][_0x9e82('0x13')]);return _0x4762ea(_0x55f3c2[_0x9e82('0x11')][_0x9e82('0x13')]);}else{logger[_0x9e82('0xc')](_0x9e82('0xd'),_0x5e4119,_0x9e82('0xe'));_0x4762ea(_0x55f3c2[_0x9e82('0x14')][_0x9e82('0x13')]);}})[_0x9e82('0x15')](function(_0x48744c){logger[_0x9e82('0x11')](_0x9e82('0xd'),_0x5e4119,_0x48744c);_0xe6f581(_0x48744c);});});}exports[_0x9e82('0x16')]=function(_0x1219f4){var _0xfbcb36=this;return new Promise(function(_0x27c853,_0x52af10){return db[_0x9e82('0x17')][_0x9e82('0x18')]({'raw':_0x1219f4[_0x9e82('0x19')]?_0x1219f4[_0x9e82('0x19')][_0x9e82('0x1a')]===undefined?!![]:![]:!![],'where':_0x1219f4[_0x9e82('0x19')]?_0x1219f4[_0x9e82('0x19')]['where']||null:null,'attributes':_0x1219f4[_0x9e82('0x19')]?_0x1219f4[_0x9e82('0x19')][_0x9e82('0x1b')]||null:null,'limit':_0x1219f4[_0x9e82('0x19')]?_0x1219f4[_0x9e82('0x19')][_0x9e82('0x1c')]||null:null,'include':_0x1219f4[_0x9e82('0x19')]?_0x1219f4[_0x9e82('0x19')][_0x9e82('0x1d')]?_[_0x9e82('0x1e')](_0x1219f4[_0x9e82('0x19')]['include'],function(_0x373812){return{'model':db[_0x373812[_0x9e82('0x1f')]],'as':_0x373812['as'],'attributes':_0x373812[_0x9e82('0x1b')],'include':_0x373812[_0x9e82('0x1d')]?_['map'](_0x373812[_0x9e82('0x1d')],function(_0x103ff4){return{'model':db[_0x103ff4[_0x9e82('0x1f')]],'as':_0x103ff4['as'],'attributes':_0x103ff4['attributes'],'include':_0x103ff4[_0x9e82('0x1d')]?_[_0x9e82('0x1e')](_0x103ff4[_0x9e82('0x1d')],function(_0xcaa0dd){return{'model':db[_0xcaa0dd[_0x9e82('0x1f')]],'as':_0xcaa0dd['as'],'attributes':_0xcaa0dd['attributes']};}):[]};}):[]};}):[]:[]})[_0x9e82('0x20')](function(_0x3a836c){logger[_0x9e82('0xc')]('GetFaxAccount',_0x1219f4);logger['debug'](_0x9e82('0x16'),_0x1219f4,JSON['stringify'](_0x3a836c));_0x27c853(_0x3a836c);})[_0x9e82('0x15')](function(_0x2e1f7f){logger[_0x9e82('0x11')](_0x9e82('0x16'),_0x2e1f7f[_0x9e82('0x13')],_0x1219f4);_0x52af10(_0xfbcb36[_0x9e82('0x11')](0x1f4,_0x2e1f7f[_0x9e82('0x13')]));});});};exports['NotifyFaxAccount']=function(_0x5b90b5,_0x2c9756,_0x1024f6){var _0x800bbc=this;return new Promise(function(_0x542e50,_0x567720){var _0x161e1f={'body':_0x5b90b5[_0x9e82('0x21')],'channel':'fax'};var _0x1dbe93=[];var _0x9ad36a=[];var _0x3fdd16={};return db[_0x9e82('0x22')][_0x9e82('0x23')]()[_0x9e82('0x20')](function(_0x3908c8){if(!_0x3908c8){throw new db[(_0x9e82('0x24'))]['ValidationError']('no\x20available\x20attributes');}_0x1dbe93=_[_0x9e82('0x25')](_['keys'](_0x3908c8),['createdAt',_0x9e82('0x26')]);_0x9ad36a=_[_0x9e82('0x25')](_[_0x9e82('0x27')](_0x3908c8),[_0x9e82('0x28'),_0x9e82('0x26'),_0x9e82('0x29'),_0x9e82('0x2a')]);if(_0x5b90b5['body']['id']){delete _0x5b90b5[_0x9e82('0x21')]['id'];}if(_[_0x9e82('0x2b')](_0x5b90b5[_0x9e82('0x21')][_0x9e82('0x2c')])){throw new db[(_0x9e82('0x24'))]['ValidationError'](_0x9e82('0x2d'));}if(_[_0x9e82('0x2b')](_0x5b90b5[_0x9e82('0x21')][_0x9e82('0x21')])||_0x5b90b5[_0x9e82('0x21')][_0x9e82('0x21')]===''){throw new db[(_0x9e82('0x24'))]['ValidationError'](_0x9e82('0x2e'));}if(_['isNil'](_0x5b90b5[_0x9e82('0x21')][_0x9e82('0x2f')])){throw new db[(_0x9e82('0x24'))][(_0x9e82('0x30'))](_0x9e82('0x31')+_0x9ad36a);}if(!_[_0x9e82('0x32')](_0x9ad36a,_0x5b90b5['body'][_0x9e82('0x2f')])){throw new db[(_0x9e82('0x24'))]['ValidationError']('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x9ad36a);}_0x3fdd16[_0x5b90b5[_0x9e82('0x21')]['mapKey']]=_0x5b90b5[_0x9e82('0x21')][_0x9e82('0x2c')];})[_0x9e82('0x20')](function(){return db[_0x9e82('0x17')]['find']({'where':{'id':_0x5b90b5[_0x9e82('0x33')]['id']},'include':[{'model':db[_0x9e82('0x34')],'as':_0x9e82('0x35'),'include':[{'model':db[_0x9e82('0x22')],'as':_0x9e82('0x36'),'where':_0x3fdd16,'limit':0x1,'order':[[_0x9e82('0x26'),_0x9e82('0x37')]]}]},{'model':db[_0x9e82('0x38')],'as':_0x9e82('0x39')}]});})[_0x9e82('0x20')](function(_0x417781){if(_0x417781&&_0x417781[_0x9e82('0x35')]){var _0x581ead=_0x417781[_0x9e82('0x3a')]({'plain':!![]});_0x161e1f[_0x9e82('0x33')]=_0x581ead;_0x161e1f[_0x9e82('0x3b')]=_0x581ead['Applications'];_0x161e1f[_0x9e82('0x3c')]=_0x581ead['List'];_0x161e1f['applications']=_['orderBy'](_0x161e1f[_0x9e82('0x3b')],[_0x9e82('0x3d')],[_0x9e82('0x3e')]);if(_0x161e1f[_0x9e82('0x33')][_0x9e82('0x39')]){delete _0x161e1f[_0x9e82('0x33')][_0x9e82('0x39')];}if(_0x161e1f['account'][_0x9e82('0x35')]&&_0x161e1f[_0x9e82('0x33')]['List']['Contacts'][_0x9e82('0x3f')]){return _0x161e1f[_0x9e82('0x33')][_0x9e82('0x35')][_0x9e82('0x36')][0x0];}var _0x520f4f=_[_0x9e82('0x40')](_0x5b90b5[_0x9e82('0x21')],{'firstName':_0x5b90b5[_0x9e82('0x21')][_0x9e82('0x2c')],'ListId':_0x581ead[_0x9e82('0x2a')]});_0x520f4f[_0x5b90b5[_0x9e82('0x21')][_0x9e82('0x2f')]]=_0x5b90b5['body'][_0x9e82('0x2c')];return db[_0x9e82('0x22')][_0x9e82('0x41')](_0x520f4f,{'fields':_0x1dbe93,'raw':!![]});}})[_0x9e82('0x20')](function(_0x5951d8){_0x161e1f['contact']=_0x5951d8;if(_0x5951d8){var _0x168cf6={'ContactId':_0x5951d8['id'],'FaxAccountId':_0x5b90b5['account']['id'],'fax':_0x5951d8[_0x9e82('0x42')]};return db[_0x9e82('0x43')][_0x9e82('0x44')]({'where':{'ContactId':_0x5951d8['id'],'closed':![],'FaxAccountId':_0x5b90b5[_0x9e82('0x33')]['id']}})[_0x9e82('0x20')](function(_0x169ecc){if(_0x169ecc){return[_0x169ecc,![]];}return db[_0x9e82('0x43')][_0x9e82('0x41')](_0x168cf6)[_0x9e82('0x20')](function(_0x4286f5){return[_0x4286f5,!![]];});});}else{throw new Error(_0x9e82('0x45'));}})['spread'](function(_0x41ec01,_0x24a544){var _0x155aac=_0x41ec01[_0x9e82('0x3a')]({'plain':!![]});if(_0x24a544){if(_0x161e1f[_0x9e82('0x33')][_0x9e82('0x46')]){_0x161e1f['applications'][_0x9e82('0x47')]({'id':0x0,'priority':_0x161e1f[_0x9e82('0x3b')][_0x9e82('0x3f')]+0x1,'app':'close','appdata':_0x9e82('0x48'),'interval':_0x9e82('0x49')});}_0x155aac['created']=!![];}else{_0x155aac[_0x9e82('0x4a')]=![];}_0x161e1f[_0x9e82('0x4b')]=_0x155aac;return db[_0x9e82('0x4c')][_0x9e82('0x41')]({'body':_0x5b90b5[_0x9e82('0x21')][_0x9e82('0x21')],'FaxAccountId':_0x5b90b5[_0x9e82('0x33')]['id'],'FaxInteractionId':_0x41ec01['id'],'direction':'in','ContactId':_0x41ec01[_0x9e82('0x4d')],'AttachmentId':_0x5b90b5[_0x9e82('0x21')][_0x9e82('0x4e')]});})['then'](function(_0x184d3a){_0x161e1f[_0x9e82('0x13')]=_0x184d3a;if(_0x161e1f[_0x9e82('0x4b')][_0x9e82('0x4f')]){return db[_0x9e82('0x50')][_0x9e82('0x44')]({'attributes':['id','name'],'where':{'id':_0x161e1f[_0x9e82('0x4b')][_0x9e82('0x4f')]}})[_0x9e82('0x20')](function(_0x971f35){if(_0x971f35){_0x161e1f[_0x9e82('0x3b')][_0x9e82('0x51')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x971f35[_0x9e82('0x52')]+','+(_0x161e1f['account']['waitForTheAssignedAgent']||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x9e82('0x53'),'startRouting',_0x161e1f);});}return respondWithRpcPromise(_0x9e82('0x53'),'startRouting',_0x161e1f);})[_0x9e82('0x20')](function(_0x2cb3b1){_0x542e50(_0x2cb3b1);})[_0x9e82('0x15')](function(_0xce7fe9){_0x567720(_0x800bbc['error'](0x1f4,_0xce7fe9[_0x9e82('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index ab71590..088d8f6 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 _0x475b=['./faxAccount.events','update','removeListener','register','length'];(function(_0x3bc958,_0x45d34a){var _0x3d136e=function(_0x3602f8){while(--_0x3602f8){_0x3bc958['push'](_0x3bc958['shift']());}};_0x3d136e(++_0x45d34a);}(_0x475b,0xb4));var _0xb475=function(_0x3b29cf,_0x171bc9){_0x3b29cf=_0x3b29cf-0x0;var _0x1dc73b=_0x475b[_0x3b29cf];return _0x1dc73b;};'use strict';var FaxAccountEvents=require(_0xb475('0x0'));var events=['save','remove',_0xb475('0x1')];function createListener(_0x30f3ee,_0x560f55){return function(_0x9ae2c0){_0x560f55['emit'](_0x30f3ee,_0x9ae2c0);};}function removeListener(_0x127656,_0x2d37a9){return function(){FaxAccountEvents[_0xb475('0x2')](_0x127656,_0x2d37a9);};}exports[_0xb475('0x3')]=function(_0x1cac01){for(var _0x2ecb3d=0x0,_0x2a3429=events[_0xb475('0x4')];_0x2ecb3d<_0x2a3429;_0x2ecb3d++){var _0x216a46=events[_0x2ecb3d];var _0x222096=createListener('faxAccount:'+_0x216a46,_0x1cac01);FaxAccountEvents['on'](_0x216a46,_0x222096);}}; \ No newline at end of file +var _0x8909=['save','remove','update','emit','removeListener','register','length','faxAccount:','./faxAccount.events'];(function(_0x505f7e,_0x454912){var _0x3851f9=function(_0xde87ba){while(--_0xde87ba){_0x505f7e['push'](_0x505f7e['shift']());}};_0x3851f9(++_0x454912);}(_0x8909,0x14c));var _0x9890=function(_0x4629ed,_0x59ef85){_0x4629ed=_0x4629ed-0x0;var _0x52ca04=_0x8909[_0x4629ed];return _0x52ca04;};'use strict';var FaxAccountEvents=require(_0x9890('0x0'));var events=[_0x9890('0x1'),_0x9890('0x2'),_0x9890('0x3')];function createListener(_0x2951fa,_0x10725b){return function(_0x5f4dca){_0x10725b[_0x9890('0x4')](_0x2951fa,_0x5f4dca);};}function removeListener(_0x524e23,_0x2ad9ad){return function(){FaxAccountEvents[_0x9890('0x5')](_0x524e23,_0x2ad9ad);};}exports[_0x9890('0x6')]=function(_0x65bdc1){for(var _0x466168=0x0,_0x15427b=events[_0x9890('0x7')];_0x466168<_0x15427b;_0x466168++){var _0x1c0935=events[_0x466168];var _0x431ab9=createListener(_0x9890('0x8')+_0x1c0935,_0x65bdc1);FaxAccountEvents['on'](_0x1c0935,_0x431ab9);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index 9ab1070..ed936c6 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(_0x2f029b,_0x5c393c){var _0x3df1aa=function(_0x11f2b4){while(--_0x11f2b4){_0x2f029b['push'](_0x2f029b['shift']());}};_0x3df1aa(++_0x5c393c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xa9e0[_0x501510];return _0x1e6ee5;};'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(_0x54a229,_0x1a65da){var _0x3a6c60=function(_0x4ada56){while(--_0x4ada56){_0x54a229['push'](_0x54a229['shift']());}};_0x3a6c60(++_0x1a65da);}(_0xa9e0,0x123));var _0x0a9e=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xa9e0[_0x6c993a];return _0x27f547;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/canned_answers',auth['isAuthenticated'](),controller['getAnswers']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getApplications']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['post']('/',auth[_0x0a9e('0xd')](),controller['create']);router[_0x0a9e('0x16')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router['post'](_0x0a9e('0x18'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x16')](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1a')]);router[_0x0a9e('0x16')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x16')]('/addaccountapplications',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router['post'](_0x0a9e('0x1d'),auth['isAuthenticated'](),controller['updateAccountApplications']);router[_0x0a9e('0x16')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1f')]);router['post'](_0x0a9e('0x14'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);router[_0x0a9e('0x21')](_0x0a9e('0x22'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x23')]);router['delete']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x24')]);router[_0x0a9e('0x25')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x26')]);router['delete'](_0x0a9e('0x18'),auth['isAuthenticated'](),controller[_0x0a9e('0x27')]);router[_0x0a9e('0x25')](_0x0a9e('0x14'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x28')]);module[_0x0a9e('0x29')]=router; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.attributes.js b/server/api/faxApplication/faxApplication.attributes.js index 6ec8a7c..ad46e16 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 _0xdc3f=['exports','STRING','TEXT','*,*,*,*','sequelize'];(function(_0x414a95,_0x3d54bf){var _0xe7abb0=function(_0x426a76){while(--_0x426a76){_0x414a95['push'](_0x414a95['shift']());}};_0xe7abb0(++_0x3d54bf);}(_0xdc3f,0x8b));var _0xfdc3=function(_0x16e768,_0xde568c){_0x16e768=_0x16e768-0x0;var _0x13139e=_0xdc3f[_0x16e768];return _0x13139e;};'use strict';var Sequelize=require(_0xfdc3('0x0'));module[_0xfdc3('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0xfdc3('0x2')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0xfdc3('0x3')]()},'description':{'type':Sequelize[_0xfdc3('0x2')]},'interval':{'type':Sequelize[_0xfdc3('0x2')],'defaultValue':_0xfdc3('0x4')}}; \ No newline at end of file +var _0x3835=['exports','INTEGER','STRING','noop','TEXT','sequelize'];(function(_0x1e8c6a,_0x239500){var _0x207244=function(_0x438245){while(--_0x438245){_0x1e8c6a['push'](_0x1e8c6a['shift']());}};_0x207244(++_0x239500);}(_0x3835,0xf5));var _0x5383=function(_0x11765d,_0x46113b){_0x11765d=_0x11765d-0x0;var _0x389e72=_0x3835[_0x11765d];return _0x389e72;};'use strict';var Sequelize=require(_0x5383('0x0'));module[_0x5383('0x1')]={'priority':{'type':Sequelize[_0x5383('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x5383('0x3')],'allowNull':![],'defaultValue':_0x5383('0x4')},'appdata':{'type':Sequelize[_0x5383('0x5')]()},'description':{'type':Sequelize[_0x5383('0x3')]},'interval':{'type':Sequelize[_0x5383('0x3')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index 7d741f7..f10002e 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 _0x471c=['crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','offset','limit','undefined','count','set','Content-Range','json','apply','reject','save','then','destroy','end','error','stack','name','send','map','FaxApplication','rawAttributes','fieldName','key','model','query','keys','attributes','intersection','fields','hasOwnProperty','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','find','create','body','update','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','squel'];(function(_0x4dca75,_0x1ea147){var _0x3192f1=function(_0x2d9a60){while(--_0x2d9a60){_0x4dca75['push'](_0x4dca75['shift']());}};_0x3192f1(++_0x1ea147);}(_0x471c,0x128));var _0xc471=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x471c[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xc471('0x0'));var rimraf=require(_0xc471('0x1'));var zipdir=require(_0xc471('0x2'));var jsonpatch=require(_0xc471('0x3'));var rp=require(_0xc471('0x4'));var moment=require(_0xc471('0x5'));var BPromise=require(_0xc471('0x6'));var Mustache=require(_0xc471('0x7'));var util=require(_0xc471('0x8'));var path=require(_0xc471('0x9'));var sox=require(_0xc471('0xa'));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(_0xc471('0xb'));var crypto=require(_0xc471('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xc471('0xd'));var toCsv=require(_0xc471('0xe'));var querystring=require(_0xc471('0xf'));var Papa=require(_0xc471('0x10'));var Redis=require(_0xc471('0x11'));var authService=require(_0xc471('0x12'));var qs=require(_0xc471('0x13'));var as=require(_0xc471('0x14'));var hardwareService=require(_0xc471('0x15'));var logger=require('../../config/logger')(_0xc471('0x16'));var utils=require(_0xc471('0x17'));var config=require(_0xc471('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xc471('0x19'))['db'];function respondWithStatusCode(_0x37b2ca,_0x3f3ee5){_0x3f3ee5=_0x3f3ee5||0xcc;return function(_0x1da0d1){if(_0x1da0d1){return _0x37b2ca[_0xc471('0x1a')](_0x3f3ee5);}return _0x37b2ca[_0xc471('0x1b')](_0x3f3ee5)['end']();};}function respondWithResult(_0x20b85b,_0x3a705f){_0x3a705f=_0x3a705f||0xc8;return function(_0x420eef){if(_0x420eef){return _0x20b85b[_0xc471('0x1b')](_0x3a705f)['json'](_0x420eef);}};}function respondWithFilteredResult(_0x1d699b,_0x2163f5){return function(_0x36755a){if(_0x36755a){var _0x4057e5=typeof _0x2163f5[_0xc471('0x1c')]==='undefined'&&typeof _0x2163f5[_0xc471('0x1d')]===_0xc471('0x1e');var _0x3dae7d=_0x36755a[_0xc471('0x1f')];var _0x2f5ae2=_0x4057e5?0x0:_0x2163f5['offset'];var _0x4d72f8=_0x4057e5?_0x36755a['count']:_0x2163f5[_0xc471('0x1c')]+_0x2163f5[_0xc471('0x1d')];var _0x2a2204;if(_0x4d72f8>=_0x3dae7d){_0x4d72f8=_0x3dae7d;_0x2a2204=0xc8;}else{_0x2a2204=0xce;}_0x1d699b[_0xc471('0x1b')](_0x2a2204);return _0x1d699b[_0xc471('0x20')](_0xc471('0x21'),_0x2f5ae2+'-'+_0x4d72f8+'/'+_0x3dae7d)[_0xc471('0x22')](_0x36755a);}return null;};}function patchUpdates(_0x2014b5){return function(_0x251895){try{jsonpatch[_0xc471('0x23')](_0x251895,_0x2014b5,!![]);}catch(_0x595ed0){return BPromise[_0xc471('0x24')](_0x595ed0);}return _0x251895[_0xc471('0x25')]();};}function saveUpdates(_0x2733f9,_0x2c4168){return function(_0x161469){if(_0x161469){return _0x161469['update'](_0x2733f9)[_0xc471('0x26')](function(_0x4d9dda){return _0x4d9dda;});}return null;};}function removeEntity(_0x28503f,_0x529350){return function(_0x2544df){if(_0x2544df){return _0x2544df[_0xc471('0x27')]()[_0xc471('0x26')](function(){_0x28503f[_0xc471('0x1b')](0xcc)[_0xc471('0x28')]();});}};}function handleEntityNotFound(_0x420273,_0x3dc6af){return function(_0x1eead5){if(!_0x1eead5){_0x420273[_0xc471('0x1a')](0x194);}return _0x1eead5;};}function handleError(_0x372eda,_0x5b8be1){_0x5b8be1=_0x5b8be1||0x1f4;return function(_0xcd98cf){logger[_0xc471('0x29')](_0xcd98cf[_0xc471('0x2a')]);if(_0xcd98cf[_0xc471('0x2b')]){delete _0xcd98cf[_0xc471('0x2b')];}_0x372eda[_0xc471('0x1b')](_0x5b8be1)[_0xc471('0x2c')](_0xcd98cf);};}exports['index']=function(_0x49fe0b,_0x5458ae){var _0x453d66={},_0x35ca08={},_0x5c7d0c={'count':0x0,'rows':[]};var _0x24dec8=_[_0xc471('0x2d')](db[_0xc471('0x2e')][_0xc471('0x2f')],function(_0x18b537){return{'name':_0x18b537[_0xc471('0x30')],'type':_0x18b537['type'][_0xc471('0x31')]};});_0x35ca08[_0xc471('0x32')]=_['map'](_0x24dec8,_0xc471('0x2b'));_0x35ca08[_0xc471('0x33')]=_[_0xc471('0x34')](_0x49fe0b[_0xc471('0x33')]);_0x35ca08['filters']=_['intersection'](_0x35ca08[_0xc471('0x32')],_0x35ca08[_0xc471('0x33')]);_0x453d66[_0xc471('0x35')]=_[_0xc471('0x36')](_0x35ca08[_0xc471('0x32')],qs[_0xc471('0x37')](_0x49fe0b[_0xc471('0x33')][_0xc471('0x37')]));_0x453d66[_0xc471('0x35')]=_0x453d66[_0xc471('0x35')]['length']?_0x453d66[_0xc471('0x35')]:_0x35ca08[_0xc471('0x32')];if(!_0x49fe0b['query'][_0xc471('0x38')]('nolimit')){_0x453d66[_0xc471('0x1d')]=qs[_0xc471('0x1d')](_0x49fe0b[_0xc471('0x33')][_0xc471('0x1d')]);_0x453d66[_0xc471('0x1c')]=qs['offset'](_0x49fe0b[_0xc471('0x33')][_0xc471('0x1c')]);}_0x453d66[_0xc471('0x39')]=qs['sort'](_0x49fe0b[_0xc471('0x33')][_0xc471('0x3a')]);_0x453d66[_0xc471('0x3b')]=qs[_0xc471('0x3c')](_[_0xc471('0x3d')](_0x49fe0b[_0xc471('0x33')],_0x35ca08[_0xc471('0x3c')]),_0x24dec8);if(_0x49fe0b[_0xc471('0x33')][_0xc471('0x3e')]){_0x453d66['where']=_[_0xc471('0x3f')](_0x453d66['where'],{'$or':_['map'](_0x24dec8,function(_0x22dfd5){if(_0x22dfd5['type']!==_0xc471('0x40')){var _0xa8cb46={};_0xa8cb46[_0x22dfd5[_0xc471('0x2b')]]={'$like':'%'+_0x49fe0b[_0xc471('0x33')][_0xc471('0x3e')]+'%'};return _0xa8cb46;}})});}_0x453d66=_['merge']({},_0x453d66,_0x49fe0b[_0xc471('0x41')]);var _0x381bf3={'where':_0x453d66[_0xc471('0x3b')]};return db[_0xc471('0x2e')][_0xc471('0x1f')](_0x381bf3)[_0xc471('0x26')](function(_0x5aa0f2){_0x5c7d0c['count']=_0x5aa0f2;if(_0x49fe0b['query'][_0xc471('0x42')]){_0x453d66[_0xc471('0x43')]=[{'all':!![]}];}return db[_0xc471('0x2e')][_0xc471('0x44')](_0x453d66);})['then'](function(_0x27eed4){_0x5c7d0c[_0xc471('0x45')]=_0x27eed4;return _0x5c7d0c;})[_0xc471('0x26')](respondWithFilteredResult(_0x5458ae,_0x453d66))[_0xc471('0x46')](handleError(_0x5458ae,null));};exports[_0xc471('0x47')]=function(_0x13c913,_0x20b0e0){var _0x187761={'raw':!![],'where':{'id':_0x13c913['params']['id']}},_0x3e05cb={};_0x3e05cb[_0xc471('0x32')]=_['keys'](db[_0xc471('0x2e')][_0xc471('0x2f')]);_0x3e05cb[_0xc471('0x33')]=_['keys'](_0x13c913['query']);_0x3e05cb[_0xc471('0x3c')]=_['intersection'](_0x3e05cb[_0xc471('0x32')],_0x3e05cb[_0xc471('0x33')]);_0x187761['attributes']=_[_0xc471('0x36')](_0x3e05cb[_0xc471('0x32')],qs['fields'](_0x13c913[_0xc471('0x33')][_0xc471('0x37')]));_0x187761[_0xc471('0x35')]=_0x187761['attributes']['length']?_0x187761[_0xc471('0x35')]:_0x3e05cb['model'];if(_0x13c913[_0xc471('0x33')][_0xc471('0x42')]){_0x187761['include']=[{'all':!![]}];}_0x187761=_['merge']({},_0x187761,_0x13c913[_0xc471('0x41')]);return db[_0xc471('0x2e')][_0xc471('0x48')](_0x187761)[_0xc471('0x26')](handleEntityNotFound(_0x20b0e0,null))[_0xc471('0x26')](respondWithResult(_0x20b0e0,null))[_0xc471('0x46')](handleError(_0x20b0e0,null));};exports[_0xc471('0x49')]=function(_0x365687,_0x4821df){return db['FaxApplication'][_0xc471('0x49')](_0x365687[_0xc471('0x4a')],{})[_0xc471('0x26')](respondWithResult(_0x4821df,0xc9))[_0xc471('0x46')](handleError(_0x4821df,null));};exports[_0xc471('0x4b')]=function(_0x227baf,_0x4c2d47){if(_0x227baf[_0xc471('0x4a')]['id']){delete _0x227baf[_0xc471('0x4a')]['id'];}return db[_0xc471('0x2e')][_0xc471('0x48')]({'where':{'id':_0x227baf[_0xc471('0x4c')]['id']}})[_0xc471('0x26')](handleEntityNotFound(_0x4c2d47,null))[_0xc471('0x26')](saveUpdates(_0x227baf['body'],null))['then'](respondWithResult(_0x4c2d47,null))[_0xc471('0x46')](handleError(_0x4c2d47,null));};exports[_0xc471('0x27')]=function(_0x5f01aa,_0x484ac1){return db['FaxApplication'][_0xc471('0x48')]({'where':{'id':_0x5f01aa['params']['id']}})[_0xc471('0x26')](handleEntityNotFound(_0x484ac1,null))[_0xc471('0x26')](removeEntity(_0x484ac1,null))[_0xc471('0x46')](handleError(_0x484ac1,null));}; \ No newline at end of file +var _0x12b6=['model','keys','query','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','options','count','includeAll','include','rows','catch','show','params','length','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','to-csv','ejs','lodash','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/license/util','sendStatus','status','end','json','undefined','limit','offset','Content-Range','apply','update','then','error','name','send','map','FaxApplication','rawAttributes','type','key'];(function(_0x69d61e,_0x424294){var _0x2e3bea=function(_0xe6085){while(--_0xe6085){_0x69d61e['push'](_0x69d61e['shift']());}};_0x2e3bea(++_0x424294);}(_0x12b6,0x165));var _0x612b=function(_0x54f8b2,_0x37fd77){_0x54f8b2=_0x54f8b2-0x0;var _0x563b6d=_0x12b6[_0x54f8b2];return _0x563b6d;};'use strict';var emlformat=require(_0x612b('0x0'));var rimraf=require(_0x612b('0x1'));var zipdir=require(_0x612b('0x2'));var jsonpatch=require(_0x612b('0x3'));var rp=require(_0x612b('0x4'));var moment=require('moment');var BPromise=require(_0x612b('0x5'));var Mustache=require('mustache');var util=require(_0x612b('0x6'));var path=require(_0x612b('0x7'));var sox=require('sox');var csv=require(_0x612b('0x8'));var ejs=require(_0x612b('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x612b('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x612b('0xb'));var Papa=require(_0x612b('0xc'));var Redis=require(_0x612b('0xd'));var authService=require(_0x612b('0xe'));var qs=require(_0x612b('0xf'));var as=require(_0x612b('0x10'));var hardwareService=require(_0x612b('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0x612b('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x612b('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3a1e93,_0x2cd015){_0x2cd015=_0x2cd015||0xcc;return function(_0x7a5f0f){if(_0x7a5f0f){return _0x3a1e93[_0x612b('0x14')](_0x2cd015);}return _0x3a1e93[_0x612b('0x15')](_0x2cd015)[_0x612b('0x16')]();};}function respondWithResult(_0x127f76,_0x2eeb8e){_0x2eeb8e=_0x2eeb8e||0xc8;return function(_0x2de920){if(_0x2de920){return _0x127f76[_0x612b('0x15')](_0x2eeb8e)[_0x612b('0x17')](_0x2de920);}};}function respondWithFilteredResult(_0x248b54,_0x1f2a36){return function(_0x45c776){if(_0x45c776){var _0x1e27ef=typeof _0x1f2a36['offset']===_0x612b('0x18')&&typeof _0x1f2a36[_0x612b('0x19')]===_0x612b('0x18');var _0x3c6d54=_0x45c776['count'];var _0x5df72c=_0x1e27ef?0x0:_0x1f2a36['offset'];var _0x203559=_0x1e27ef?_0x45c776['count']:_0x1f2a36[_0x612b('0x1a')]+_0x1f2a36[_0x612b('0x19')];var _0x220e5a;if(_0x203559>=_0x3c6d54){_0x203559=_0x3c6d54;_0x220e5a=0xc8;}else{_0x220e5a=0xce;}_0x248b54[_0x612b('0x15')](_0x220e5a);return _0x248b54['set'](_0x612b('0x1b'),_0x5df72c+'-'+_0x203559+'/'+_0x3c6d54)['json'](_0x45c776);}return null;};}function patchUpdates(_0x588c7e){return function(_0x4a2c0f){try{jsonpatch[_0x612b('0x1c')](_0x4a2c0f,_0x588c7e,!![]);}catch(_0x4744c1){return BPromise['reject'](_0x4744c1);}return _0x4a2c0f['save']();};}function saveUpdates(_0x41b26b,_0x42de3e){return function(_0x591223){if(_0x591223){return _0x591223[_0x612b('0x1d')](_0x41b26b)[_0x612b('0x1e')](function(_0x5ad3d1){return _0x5ad3d1;});}return null;};}function removeEntity(_0x503806,_0x48d083){return function(_0x22854e){if(_0x22854e){return _0x22854e['destroy']()[_0x612b('0x1e')](function(){_0x503806[_0x612b('0x15')](0xcc)[_0x612b('0x16')]();});}};}function handleEntityNotFound(_0x33b296,_0xfad797){return function(_0x38fce9){if(!_0x38fce9){_0x33b296[_0x612b('0x14')](0x194);}return _0x38fce9;};}function handleError(_0x18cbce,_0x213f60){_0x213f60=_0x213f60||0x1f4;return function(_0x513f40){logger[_0x612b('0x1f')](_0x513f40['stack']);if(_0x513f40['name']){delete _0x513f40[_0x612b('0x20')];}_0x18cbce['status'](_0x213f60)[_0x612b('0x21')](_0x513f40);};}exports['index']=function(_0x18e175,_0x483407){var _0x4136f1={},_0x1f0ad1={},_0x40f44a={'count':0x0,'rows':[]};var _0x2d8519=_[_0x612b('0x22')](db[_0x612b('0x23')][_0x612b('0x24')],function(_0x26c8f6){return{'name':_0x26c8f6['fieldName'],'type':_0x26c8f6[_0x612b('0x25')][_0x612b('0x26')]};});_0x1f0ad1[_0x612b('0x27')]=_['map'](_0x2d8519,_0x612b('0x20'));_0x1f0ad1['query']=_[_0x612b('0x28')](_0x18e175[_0x612b('0x29')]);_0x1f0ad1['filters']=_[_0x612b('0x2a')](_0x1f0ad1['model'],_0x1f0ad1[_0x612b('0x29')]);_0x4136f1[_0x612b('0x2b')]=_[_0x612b('0x2a')](_0x1f0ad1[_0x612b('0x27')],qs[_0x612b('0x2c')](_0x18e175['query']['fields']));_0x4136f1[_0x612b('0x2b')]=_0x4136f1[_0x612b('0x2b')]['length']?_0x4136f1[_0x612b('0x2b')]:_0x1f0ad1[_0x612b('0x27')];if(!_0x18e175[_0x612b('0x29')][_0x612b('0x2d')](_0x612b('0x2e'))){_0x4136f1[_0x612b('0x19')]=qs[_0x612b('0x19')](_0x18e175[_0x612b('0x29')][_0x612b('0x19')]);_0x4136f1[_0x612b('0x1a')]=qs[_0x612b('0x1a')](_0x18e175[_0x612b('0x29')][_0x612b('0x1a')]);}_0x4136f1['order']=qs[_0x612b('0x2f')](_0x18e175[_0x612b('0x29')][_0x612b('0x2f')]);_0x4136f1[_0x612b('0x30')]=qs[_0x612b('0x31')](_[_0x612b('0x32')](_0x18e175[_0x612b('0x29')],_0x1f0ad1[_0x612b('0x31')]),_0x2d8519);if(_0x18e175[_0x612b('0x29')][_0x612b('0x33')]){_0x4136f1[_0x612b('0x30')]=_[_0x612b('0x34')](_0x4136f1[_0x612b('0x30')],{'$or':_[_0x612b('0x22')](_0x2d8519,function(_0x1bb1cd){if(_0x1bb1cd[_0x612b('0x25')]!==_0x612b('0x35')){var _0x371150={};_0x371150[_0x1bb1cd[_0x612b('0x20')]]={'$like':'%'+_0x18e175[_0x612b('0x29')][_0x612b('0x33')]+'%'};return _0x371150;}})});}_0x4136f1=_[_0x612b('0x34')]({},_0x4136f1,_0x18e175[_0x612b('0x36')]);var _0x1e3857={'where':_0x4136f1[_0x612b('0x30')]};return db[_0x612b('0x23')][_0x612b('0x37')](_0x1e3857)[_0x612b('0x1e')](function(_0x28133e){_0x40f44a[_0x612b('0x37')]=_0x28133e;if(_0x18e175[_0x612b('0x29')][_0x612b('0x38')]){_0x4136f1[_0x612b('0x39')]=[{'all':!![]}];}return db[_0x612b('0x23')]['findAll'](_0x4136f1);})[_0x612b('0x1e')](function(_0x4bc9fa){_0x40f44a[_0x612b('0x3a')]=_0x4bc9fa;return _0x40f44a;})[_0x612b('0x1e')](respondWithFilteredResult(_0x483407,_0x4136f1))[_0x612b('0x3b')](handleError(_0x483407,null));};exports[_0x612b('0x3c')]=function(_0x40cb87,_0x5c9872){var _0x1835f4={'raw':!![],'where':{'id':_0x40cb87[_0x612b('0x3d')]['id']}},_0x37c378={};_0x37c378[_0x612b('0x27')]=_[_0x612b('0x28')](db['FaxApplication'][_0x612b('0x24')]);_0x37c378['query']=_['keys'](_0x40cb87[_0x612b('0x29')]);_0x37c378['filters']=_[_0x612b('0x2a')](_0x37c378['model'],_0x37c378[_0x612b('0x29')]);_0x1835f4['attributes']=_[_0x612b('0x2a')](_0x37c378[_0x612b('0x27')],qs[_0x612b('0x2c')](_0x40cb87[_0x612b('0x29')]['fields']));_0x1835f4[_0x612b('0x2b')]=_0x1835f4[_0x612b('0x2b')][_0x612b('0x3e')]?_0x1835f4[_0x612b('0x2b')]:_0x37c378[_0x612b('0x27')];if(_0x40cb87[_0x612b('0x29')]['includeAll']){_0x1835f4['include']=[{'all':!![]}];}_0x1835f4=_[_0x612b('0x34')]({},_0x1835f4,_0x40cb87[_0x612b('0x36')]);return db[_0x612b('0x23')][_0x612b('0x3f')](_0x1835f4)[_0x612b('0x1e')](handleEntityNotFound(_0x5c9872,null))[_0x612b('0x1e')](respondWithResult(_0x5c9872,null))[_0x612b('0x3b')](handleError(_0x5c9872,null));};exports['create']=function(_0x28bdd5,_0xf42efe){return db[_0x612b('0x23')][_0x612b('0x40')](_0x28bdd5[_0x612b('0x41')],{})[_0x612b('0x1e')](respondWithResult(_0xf42efe,0xc9))['catch'](handleError(_0xf42efe,null));};exports['update']=function(_0x524a3b,_0x27bb43){if(_0x524a3b[_0x612b('0x41')]['id']){delete _0x524a3b[_0x612b('0x41')]['id'];}return db[_0x612b('0x23')][_0x612b('0x3f')]({'where':{'id':_0x524a3b[_0x612b('0x3d')]['id']}})[_0x612b('0x1e')](handleEntityNotFound(_0x27bb43,null))[_0x612b('0x1e')](saveUpdates(_0x524a3b[_0x612b('0x41')],null))[_0x612b('0x1e')](respondWithResult(_0x27bb43,null))['catch'](handleError(_0x27bb43,null));};exports['destroy']=function(_0xcd00a8,_0x44ed5d){return db[_0x612b('0x23')][_0x612b('0x3f')]({'where':{'id':_0xcd00a8[_0x612b('0x3d')]['id']}})[_0x612b('0x1e')](handleEntityNotFound(_0x44ed5d,null))[_0x612b('0x1e')](removeEntity(_0x44ed5d,null))[_0x612b('0x3b')](handleError(_0x44ed5d,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index 4b41caa..edd773d 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 _0x169e=['./faxApplication.attributes','exports','fax_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x1f31cb,_0x49ed49){var _0x188f8d=function(_0x27c5fd){while(--_0x27c5fd){_0x1f31cb['push'](_0x1f31cb['shift']());}};_0x188f8d(++_0x49ed49);}(_0x169e,0x1bf));var _0xe169=function(_0x5bc43e,_0x193c60){_0x5bc43e=_0x5bc43e-0x0;var _0x17d113=_0x169e[_0x5bc43e];return _0x17d113;};'use strict';var _=require(_0xe169('0x0'));var util=require(_0xe169('0x1'));var logger=require(_0xe169('0x2'))('api');var moment=require('moment');var BPromise=require(_0xe169('0x3'));var rp=require(_0xe169('0x4'));var fs=require('fs');var path=require(_0xe169('0x5'));var rimraf=require(_0xe169('0x6'));var config=require(_0xe169('0x7'));var attributes=require(_0xe169('0x8'));module[_0xe169('0x9')]=function(_0x1790b6,_0x4f9b7e){return _0x1790b6['define']('FaxApplication',attributes,{'tableName':_0xe169('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xe169('0xb'),'collate':_0xe169('0xc')});}; \ No newline at end of file +var _0x287d=['utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','request-promise','path','exports','define','FaxApplication','fax_applications'];(function(_0x22ebe6,_0x182cc6){var _0x3b6886=function(_0x82eaac){while(--_0x82eaac){_0x22ebe6['push'](_0x22ebe6['shift']());}};_0x3b6886(++_0x182cc6);}(_0x287d,0xab));var _0xd287=function(_0x16dbcd,_0x274516){_0x16dbcd=_0x16dbcd-0x0;var _0x34706e=_0x287d[_0x16dbcd];return _0x34706e;};'use strict';var _=require('lodash');var util=require(_0xd287('0x0'));var logger=require(_0xd287('0x1'))(_0xd287('0x2'));var moment=require(_0xd287('0x3'));var BPromise=require(_0xd287('0x4'));var rp=require(_0xd287('0x5'));var fs=require('fs');var path=require(_0xd287('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./faxApplication.attributes');module[_0xd287('0x7')]=function(_0x2cad4e,_0x223856){return _0x2cad4e[_0xd287('0x8')](_0xd287('0x9'),attributes,{'tableName':_0xd287('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xd287('0xb'),'collate':_0xd287('0xc')});}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.rpc.js b/server/api/faxApplication/faxApplication.rpc.js index 7fcd739..2979af4 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 _0xa7dc=['util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','http','request','info','FaxApplication,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','UpdateFaxApplication','FaxApplication','update','body','options','raw','where','limit','then'];(function(_0x3b150c,_0x2f93f8){var _0x5cd414=function(_0x26305e){while(--_0x26305e){_0x3b150c['push'](_0x3b150c['shift']());}};_0x5cd414(++_0x2f93f8);}(_0xa7dc,0x1ba));var _0xca7d=function(_0x5299ce,_0x55b39f){_0x5299ce=_0x5299ce-0x0;var _0x23281a=_0xa7dc[_0x5299ce];return _0x23281a;};'use strict';var _=require('lodash');var util=require(_0xca7d('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xca7d('0x1'));var fs=require('fs');var Redis=require(_0xca7d('0x2'));var db=require(_0xca7d('0x3'))['db'];var utils=require(_0xca7d('0x4'));var logger=require(_0xca7d('0x5'))(_0xca7d('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xca7d('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x5bc6b9,_0x2516a4,_0xf09cfc){return new BPromise(function(_0xc5cbf7,_0x4803ed){return client[_0xca7d('0x8')](_0x5bc6b9,_0xf09cfc)['then'](function(_0x3e5d51){logger[_0xca7d('0x9')](_0xca7d('0xa'),_0x2516a4,'request\x20sent');logger['debug']('FaxApplication,\x20%s,\x20%s,\x20%s',_0x2516a4,_0xca7d('0xb'),JSON[_0xca7d('0xc')](_0x3e5d51));if(_0x3e5d51['error']){if(_0x3e5d51[_0xca7d('0xd')][_0xca7d('0xe')]===0x1f4){logger[_0xca7d('0xd')](_0xca7d('0xa'),_0x2516a4,_0x3e5d51[_0xca7d('0xd')][_0xca7d('0xf')]);return _0x4803ed(_0x3e5d51['error'][_0xca7d('0xf')]);}logger['error'](_0xca7d('0xa'),_0x2516a4,_0x3e5d51['error'][_0xca7d('0xf')]);return _0xc5cbf7(_0x3e5d51['error'][_0xca7d('0xf')]);}else{logger[_0xca7d('0x9')](_0xca7d('0xa'),_0x2516a4,_0xca7d('0xb'));_0xc5cbf7(_0x3e5d51['result']['message']);}})[_0xca7d('0x10')](function(_0x95cfea){logger[_0xca7d('0xd')](_0xca7d('0xa'),_0x2516a4,_0x95cfea);_0x4803ed(_0x95cfea);});});}exports[_0xca7d('0x11')]=function(_0x59bb6e){var _0x358aa6=this;return new Promise(function(_0x1cd002,_0x44fe0e){return db[_0xca7d('0x12')][_0xca7d('0x13')](_0x59bb6e[_0xca7d('0x14')],{'raw':_0x59bb6e[_0xca7d('0x15')]?_0x59bb6e['options'][_0xca7d('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x59bb6e[_0xca7d('0x15')]?_0x59bb6e['options'][_0xca7d('0x17')]||null:null,'attributes':_0x59bb6e[_0xca7d('0x15')]?_0x59bb6e['options']['attributes']||null:null,'limit':_0x59bb6e[_0xca7d('0x15')]?_0x59bb6e['options'][_0xca7d('0x18')]||null:null})[_0xca7d('0x19')](function(_0x13c8e0){logger[_0xca7d('0x9')]('UpdateFaxApplication',_0x59bb6e);logger['debug'](_0xca7d('0x11'),_0x59bb6e,JSON['stringify'](_0x13c8e0));_0x1cd002(_0x13c8e0);})[_0xca7d('0x10')](function(_0x39113a){logger['error']('UpdateFaxApplication',_0x39113a[_0xca7d('0xf')],_0x59bb6e);_0x44fe0e(_0x358aa6[_0xca7d('0xd')](0x1f4,_0x39113a[_0xca7d('0xf')]));});});}; \ No newline at end of file +var _0x589e=['request','then','FaxApplication,\x20%s,\x20%s','request\x20sent','debug','FaxApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','UpdateFaxApplication','FaxApplication','update','body','options','where','attributes','limit','info','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x49adfe,_0x2fd329){var _0x1d53da=function(_0x4edbdb){while(--_0x4edbdb){_0x49adfe['push'](_0x49adfe['shift']());}};_0x1d53da(++_0x2fd329);}(_0x589e,0x94));var _0xe589=function(_0x254e90,_0x117412){_0x254e90=_0x254e90-0x0;var _0x113ba0=_0x589e[_0x254e90];return _0x113ba0;};'use strict';var _=require(_0xe589('0x0'));var util=require('util');var moment=require(_0xe589('0x1'));var BPromise=require(_0xe589('0x2'));var rs=require(_0xe589('0x3'));var fs=require('fs');var Redis=require(_0xe589('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xe589('0x5'));var logger=require(_0xe589('0x6'))(_0xe589('0x7'));var config=require(_0xe589('0x8'));var jayson=require(_0xe589('0x9'));var client=jayson[_0xe589('0xa')][_0xe589('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x56d277,_0x1079a9,_0x125192){return new BPromise(function(_0x158f43,_0x20842b){return client[_0xe589('0xc')](_0x56d277,_0x125192)[_0xe589('0xd')](function(_0xc2de0c){logger['info'](_0xe589('0xe'),_0x1079a9,_0xe589('0xf'));logger[_0xe589('0x10')](_0xe589('0x11'),_0x1079a9,_0xe589('0xf'),JSON[_0xe589('0x12')](_0xc2de0c));if(_0xc2de0c[_0xe589('0x13')]){if(_0xc2de0c[_0xe589('0x13')][_0xe589('0x14')]===0x1f4){logger['error'](_0xe589('0xe'),_0x1079a9,_0xc2de0c[_0xe589('0x13')][_0xe589('0x15')]);return _0x20842b(_0xc2de0c[_0xe589('0x13')][_0xe589('0x15')]);}logger[_0xe589('0x13')](_0xe589('0xe'),_0x1079a9,_0xc2de0c[_0xe589('0x13')][_0xe589('0x15')]);return _0x158f43(_0xc2de0c['error'][_0xe589('0x15')]);}else{logger['info']('FaxApplication,\x20%s,\x20%s',_0x1079a9,_0xe589('0xf'));_0x158f43(_0xc2de0c['result'][_0xe589('0x15')]);}})[_0xe589('0x16')](function(_0x52241c){logger[_0xe589('0x13')](_0xe589('0xe'),_0x1079a9,_0x52241c);_0x20842b(_0x52241c);});});}exports[_0xe589('0x17')]=function(_0x31621d){var _0xfcd9c7=this;return new Promise(function(_0x5e30a3,_0x245faa){return db[_0xe589('0x18')][_0xe589('0x19')](_0x31621d[_0xe589('0x1a')],{'raw':_0x31621d[_0xe589('0x1b')]?_0x31621d['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x31621d['options']?_0x31621d[_0xe589('0x1b')][_0xe589('0x1c')]||null:null,'attributes':_0x31621d[_0xe589('0x1b')]?_0x31621d['options'][_0xe589('0x1d')]||null:null,'limit':_0x31621d[_0xe589('0x1b')]?_0x31621d[_0xe589('0x1b')][_0xe589('0x1e')]||null:null})['then'](function(_0x3516ff){logger[_0xe589('0x1f')](_0xe589('0x17'),_0x31621d);logger[_0xe589('0x10')](_0xe589('0x17'),_0x31621d,JSON[_0xe589('0x12')](_0x3516ff));_0x5e30a3(_0x3516ff);})[_0xe589('0x16')](function(_0x5dddc1){logger[_0xe589('0x13')](_0xe589('0x17'),_0x5dddc1[_0xe589('0x15')],_0x31621d);_0x245faa(_0xfcd9c7[_0xe589('0x13')](0x1f4,_0x5dddc1[_0xe589('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index 38f5196..1f8eff2 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 _0xef0f=['path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./faxApplication.controller','get','isAuthenticated','index','/:id','show','create','put','update','delete','destroy','exports','multer'];(function(_0x3987a1,_0x447793){var _0xe2596e=function(_0x546925){while(--_0x546925){_0x3987a1['push'](_0x3987a1['shift']());}};_0xe2596e(++_0x447793);}(_0xef0f,0x168));var _0xfef0=function(_0x168ef1,_0x13edfc){_0x168ef1=_0x168ef1-0x0;var _0x4770ec=_0xef0f[_0x168ef1];return _0x4770ec;};'use strict';var multer=require(_0xfef0('0x0'));var util=require('util');var path=require(_0xfef0('0x1'));var timeout=require(_0xfef0('0x2'));var express=require(_0xfef0('0x3'));var router=express['Router']();var fs_extra=require(_0xfef0('0x4'));var auth=require(_0xfef0('0x5'));var interaction=require(_0xfef0('0x6'));var config=require('../../config/environment');var controller=require(_0xfef0('0x7'));router[_0xfef0('0x8')]('/',auth[_0xfef0('0x9')](),controller[_0xfef0('0xa')]);router[_0xfef0('0x8')](_0xfef0('0xb'),auth['isAuthenticated'](),controller[_0xfef0('0xc')]);router['post']('/',auth[_0xfef0('0x9')](),controller[_0xfef0('0xd')]);router[_0xfef0('0xe')](_0xfef0('0xb'),auth[_0xfef0('0x9')](),controller[_0xfef0('0xf')]);router[_0xfef0('0x10')](_0xfef0('0xb'),auth[_0xfef0('0x9')](),controller[_0xfef0('0x11')]);module[_0xfef0('0x12')]=router; \ No newline at end of file +var _0x1775=['../../config/environment','./faxApplication.controller','get','isAuthenticated','index','/:id','show','post','create','put','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x272da3,_0x2ce295){var _0xbfd0de=function(_0x167a44){while(--_0x167a44){_0x272da3['push'](_0x272da3['shift']());}};_0xbfd0de(++_0x2ce295);}(_0x1775,0x1db));var _0x5177=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x1775[_0x502c7d];return _0x30b7ed;};'use strict';var multer=require('multer');var util=require(_0x5177('0x0'));var path=require(_0x5177('0x1'));var timeout=require(_0x5177('0x2'));var express=require(_0x5177('0x3'));var router=express[_0x5177('0x4')]();var fs_extra=require(_0x5177('0x5'));var auth=require(_0x5177('0x6'));var interaction=require(_0x5177('0x7'));var config=require(_0x5177('0x8'));var controller=require(_0x5177('0x9'));router[_0x5177('0xa')]('/',auth[_0x5177('0xb')](),controller[_0x5177('0xc')]);router[_0x5177('0xa')](_0x5177('0xd'),auth[_0x5177('0xb')](),controller[_0x5177('0xe')]);router[_0x5177('0xf')]('/',auth[_0x5177('0xb')](),controller[_0x5177('0x10')]);router[_0x5177('0x11')](_0x5177('0xd'),auth['isAuthenticated'](),controller['update']);router[_0x5177('0x12')](_0x5177('0xd'),auth[_0x5177('0xb')](),controller[_0x5177('0x13')]);module[_0x5177('0x14')]=router; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.attributes.js b/server/api/faxInteraction/faxInteraction.attributes.js index e857be2..f39388d 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 _0xff1b=['DATE','STRING','out','sequelize','exports','BOOLEAN'];(function(_0x24c835,_0x57262a){var _0x22f985=function(_0x493491){while(--_0x493491){_0x24c835['push'](_0x24c835['shift']());}};_0x22f985(++_0x57262a);}(_0xff1b,0x171));var _0xbff1=function(_0x1f618f,_0x13e460){_0x1f618f=_0x1f618f-0x0;var _0x520d48=_0xff1b[_0x1f618f];return _0x520d48;};'use strict';var Sequelize=require(_0xbff1('0x0'));module[_0xbff1('0x1')]={'closed':{'type':Sequelize[_0xbff1('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xbff1('0x3')]},'disposition':{'type':Sequelize[_0xbff1('0x4')]},'secondDisposition':{'type':Sequelize[_0xbff1('0x4')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xbff1('0x4')]},'read1stAt':{'type':Sequelize['DATE']},'fax':{'type':Sequelize[_0xbff1('0x4')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0xbff1('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xbff1('0x3')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0xbff1('0x5')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0x2b78=['sequelize','exports','DATE','STRING','ENUM','out'];(function(_0x4a9b4e,_0x229afb){var _0x53c60a=function(_0x273e97){while(--_0x273e97){_0x4a9b4e['push'](_0x4a9b4e['shift']());}};_0x53c60a(++_0x229afb);}(_0x2b78,0x1c8));var _0x82b7=function(_0x1d484c,_0x27c954){_0x1d484c=_0x1d484c-0x0;var _0xb2ec18=_0x2b78[_0x1d484c];return _0xb2ec18;};'use strict';var Sequelize=require(_0x82b7('0x0'));module[_0x82b7('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x82b7('0x2')]},'disposition':{'type':Sequelize[_0x82b7('0x3')]},'secondDisposition':{'type':Sequelize[_0x82b7('0x3')]},'thirdDisposition':{'type':Sequelize[_0x82b7('0x3')]},'note':{'type':Sequelize[_0x82b7('0x3')]},'read1stAt':{'type':Sequelize['DATE']},'fax':{'type':Sequelize[_0x82b7('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x82b7('0x4')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x82b7('0x2')]},'lastMsgDirection':{'type':Sequelize[_0x82b7('0x4')]('in',_0x82b7('0x5')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.controller.js b/server/api/faxInteraction/faxInteraction.controller.js index 20b12f7..324a995 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 _0x33da=['name','send','Users','map','fullname','TagIds','Tags','split','catch','index','FaxInteraction','rawAttributes','fieldName','key','query','keys','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','filters','pick','select','field','color','tools_tags','ui.FaxInteractionId','user_has_fax_interactions','left_join','users','u.id\x20=\x20ui.UserId','from','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','fax_accounts','a.id\x20=\x20i.FaxAccountId','it.FaxInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','length','conditions','find','unreadMessages','having','`\x20=\x200','`\x20>\x200','Contact','$substring','value','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','text','Tag','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','type','body','buildExpression','start','some','isEmpty','FaxAccountId','createdAt','parse','$gte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','where','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','i.id\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','resolve','i.FaxAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getFaxAccounts','i.FaxAccountId\x20IN\x20?','sequelize','toString','keyBy','merge','a.key','Account.key','a.mandatoryDisposition','i.*','Contact.firstName','c.lastName','c.email','Contact.email','c.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.FaxInteractionId\x20IN\x20?','groupBy','FaxInteractionId','push','rows','show','includeAll','include','create','params','describe','addMessage','FaxMessage','omit','ids','format','findAll','setTags','spread','faxInteractionTags:save','removeTags','unix','join','root','server','tmp','files','transcript-%d-%s.zip','Attachment','Messages','mkdirSync','basename','existsSync','createReadStream','pipe','createWriteStream','download','err','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./faxInteraction.socket','status','end','json','offset','undefined','limit','count','set','Content-Range','save','update','then','destroy','sendStatus','stack'];(function(_0x25388c,_0x38f391){var _0x198dbb=function(_0x50c60c){while(--_0x50c60c){_0x25388c['push'](_0x25388c['shift']());}};_0x198dbb(++_0x38f391);}(_0x33da,0xa6));var _0xa33d=function(_0x539533,_0x59b89b){_0x539533=_0x539533-0x0;var _0x3942f3=_0x33da[_0x539533];return _0x3942f3;};'use strict';var emlformat=require(_0xa33d('0x0'));var rimraf=require(_0xa33d('0x1'));var zipdir=require(_0xa33d('0x2'));var jsonpatch=require(_0xa33d('0x3'));var rp=require(_0xa33d('0x4'));var moment=require('moment');var BPromise=require(_0xa33d('0x5'));var Mustache=require('mustache');var util=require(_0xa33d('0x6'));var path=require(_0xa33d('0x7'));var sox=require(_0xa33d('0x8'));var csv=require('to-csv');var ejs=require(_0xa33d('0x9'));var fs=require('fs');var fs_extra=require(_0xa33d('0xa'));var _=require(_0xa33d('0xb'));var squel=require(_0xa33d('0xc'));var crypto=require(_0xa33d('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xa33d('0xe'));var toCsv=require(_0xa33d('0xf'));var querystring=require(_0xa33d('0x10'));var Papa=require(_0xa33d('0x11'));var Redis=require(_0xa33d('0x12'));var authService=require(_0xa33d('0x13'));var qs=require(_0xa33d('0x14'));var as=require(_0xa33d('0x15'));var hardwareService=require(_0xa33d('0x16'));var logger=require(_0xa33d('0x17'))(_0xa33d('0x18'));var utils=require(_0xa33d('0x19'));var config=require(_0xa33d('0x1a'));var licenseUtil=require(_0xa33d('0x1b'));var db=require(_0xa33d('0x1c'))['db'];config[_0xa33d('0x1d')]=_[_0xa33d('0x1e')](config[_0xa33d('0x1d')],{'host':'localhost','port':0x18eb});var socket=require(_0xa33d('0x1f'))(new Redis(config[_0xa33d('0x1d')]));require(_0xa33d('0x20'))['register'](socket);function respondWithStatusCode(_0x40c220,_0x424a79){_0x424a79=_0x424a79||0xcc;return function(_0x55cad9){if(_0x55cad9){return _0x40c220['sendStatus'](_0x424a79);}return _0x40c220[_0xa33d('0x21')](_0x424a79)[_0xa33d('0x22')]();};}function respondWithResult(_0x3880ca,_0x29f0ee){_0x29f0ee=_0x29f0ee||0xc8;return function(_0x4787ed){if(_0x4787ed){return _0x3880ca['status'](_0x29f0ee)[_0xa33d('0x23')](_0x4787ed);}};}function respondWithFilteredResult(_0x3b684d,_0xbde8d3){return function(_0x4300bd){if(_0x4300bd){var _0x579072=typeof _0xbde8d3[_0xa33d('0x24')]===_0xa33d('0x25')&&typeof _0xbde8d3[_0xa33d('0x26')]===_0xa33d('0x25');var _0x8b2f5a=_0x4300bd[_0xa33d('0x27')];var _0xd80ba2=_0x579072?0x0:_0xbde8d3['offset'];var _0x9f5dc3=_0x579072?_0x4300bd[_0xa33d('0x27')]:_0xbde8d3['offset']+_0xbde8d3[_0xa33d('0x26')];var _0x2d4111;if(_0x9f5dc3>=_0x8b2f5a){_0x9f5dc3=_0x8b2f5a;_0x2d4111=0xc8;}else{_0x2d4111=0xce;}_0x3b684d[_0xa33d('0x21')](_0x2d4111);return _0x3b684d[_0xa33d('0x28')](_0xa33d('0x29'),_0xd80ba2+'-'+_0x9f5dc3+'/'+_0x8b2f5a)[_0xa33d('0x23')](_0x4300bd);}return null;};}function patchUpdates(_0x4bac75){return function(_0x20609f){try{jsonpatch['apply'](_0x20609f,_0x4bac75,!![]);}catch(_0x594345){return BPromise['reject'](_0x594345);}return _0x20609f[_0xa33d('0x2a')]();};}function saveUpdates(_0x1daa76,_0x57fce7){return function(_0xcd4cde){if(_0xcd4cde){return _0xcd4cde[_0xa33d('0x2b')](_0x1daa76)[_0xa33d('0x2c')](function(_0x1ca1f7){return _0x1ca1f7;});}return null;};}function removeEntity(_0x1708fc,_0x24af54){return function(_0x1b0051){if(_0x1b0051){return _0x1b0051[_0xa33d('0x2d')]()[_0xa33d('0x2c')](function(){_0x1708fc[_0xa33d('0x21')](0xcc)[_0xa33d('0x22')]();});}};}function handleEntityNotFound(_0x284d43,_0x205504){return function(_0x248147){if(!_0x248147){_0x284d43[_0xa33d('0x2e')](0x194);}return _0x248147;};}function handleError(_0x12be8c,_0x1b2525){_0x1b2525=_0x1b2525||0x1f4;return function(_0x2a1097){logger['error'](_0x2a1097[_0xa33d('0x2f')]);if(_0x2a1097[_0xa33d('0x30')]){delete _0x2a1097[_0xa33d('0x30')];}_0x12be8c[_0xa33d('0x21')](_0x1b2525)[_0xa33d('0x31')](_0x2a1097);};}function getInteractionUsers(_0x37742c,_0x1985d7){return new BPromise(function(_0x4a1cee,_0x3f505c){try{if(_0x1985d7[_0x37742c['id']]){_0x37742c[_0xa33d('0x32')]=_[_0xa33d('0x33')](_0x1985d7[_0x37742c['id']],function(_0x319fa6){return{'id':_0x319fa6['id'],'fullname':_0x319fa6[_0xa33d('0x34')]};});}}catch(_0x8bd9e5){_0x3f505c(_0x8bd9e5);}_0x4a1cee(_0x37742c);});}function getInteractionTags(_0x17b5c5,_0x12c124){return new BPromise(function(_0x35a234,_0x34d648){try{if(_0x17b5c5[_0xa33d('0x35')]){_0x17b5c5[_0xa33d('0x36')]=[];_0x17b5c5['TagIds'][_0xa33d('0x37')](',')['forEach'](function(_0x3e6b8a){_0x17b5c5[_0xa33d('0x36')]['push'](_0x12c124[_0x3e6b8a]);});}delete _0x17b5c5['TagIds'];}catch(_0x435288){_0x34d648(_0x435288);}_0x35a234(_0x17b5c5);});}function updateFaxInteraction(_0x4b69df,_0x5c1989,_0x1d19ce){return new BPromise(function(_0x4c37a6,_0x412614){return getInteractionUsers(_0x4b69df,_0x1d19ce)['then'](function(_0x55bc0a){return getInteractionTags(_0x55bc0a,_0x5c1989);})[_0xa33d('0x2c')](function(_0x3f0d3d){_0x4c37a6(_0x3f0d3d);})[_0xa33d('0x38')](function(_0x427881){_0x412614(_0x427881);});});}exports[_0xa33d('0x39')]=function(_0x28f202,_0x46c171){var _0x2486ce={},_0x4ba047={},_0xbaba97={'count':0x0,'rows':[]};var _0x298580=_['map'](db[_0xa33d('0x3a')][_0xa33d('0x3b')],function(_0x255afc){return{'name':_0x255afc[_0xa33d('0x3c')],'type':_0x255afc['type'][_0xa33d('0x3d')]};});_0x4ba047['model']=_[_0xa33d('0x33')](_0x298580,_0xa33d('0x30'));_0x4ba047[_0xa33d('0x3e')]=_[_0xa33d('0x3f')](_0x28f202[_0xa33d('0x3e')]);_0x4ba047['filters']=_[_0xa33d('0x40')](_0x4ba047[_0xa33d('0x41')],_0x4ba047['query']);_0x2486ce[_0xa33d('0x42')]=_[_0xa33d('0x40')](_0x4ba047['model'],qs['fields'](_0x28f202[_0xa33d('0x3e')][_0xa33d('0x43')]));_0x2486ce[_0xa33d('0x42')]=_0x2486ce[_0xa33d('0x42')]['length']?_0x2486ce[_0xa33d('0x42')]:_0x4ba047[_0xa33d('0x41')];if(!_0x28f202[_0xa33d('0x3e')][_0xa33d('0x44')](_0xa33d('0x45'))){_0x2486ce[_0xa33d('0x26')]=qs['limit'](_0x28f202[_0xa33d('0x3e')][_0xa33d('0x26')]);_0x2486ce['offset']=qs['offset'](_0x28f202[_0xa33d('0x3e')][_0xa33d('0x24')]);}_0x2486ce[_0xa33d('0x46')]=qs['sort'](_0x28f202[_0xa33d('0x3e')][_0xa33d('0x47')]);_0x2486ce['where']=qs[_0xa33d('0x48')](_[_0xa33d('0x49')](_0x28f202[_0xa33d('0x3e')],_0x4ba047['filters']),_0x298580);var _0x19a07a=[];var _0x25448c=squel[_0xa33d('0x4a')]()[_0xa33d('0x4b')]('id')[_0xa33d('0x4b')](_0xa33d('0x30'))[_0xa33d('0x4b')](_0xa33d('0x4c'))['from'](_0xa33d('0x4d'));var _0x208c0c=squel['select']()[_0xa33d('0x4b')]('u.id')[_0xa33d('0x4b')]('u.fullname')[_0xa33d('0x4b')](_0xa33d('0x4e'))['from'](_0xa33d('0x4f'),'ui')[_0xa33d('0x50')](_0xa33d('0x51'),'u',_0xa33d('0x52'));var _0x488e18=squel[_0xa33d('0x4a')]()[_0xa33d('0x53')]('fax_interactions','i')[_0xa33d('0x50')](_0xa33d('0x54'),'c',_0xa33d('0x55'))[_0xa33d('0x50')]('users','o',_0xa33d('0x56'))[_0xa33d('0x50')](_0xa33d('0x57'),'a',_0xa33d('0x58'))[_0xa33d('0x50')]('fax_messages','me','me.FaxInteractionId\x20=\x20i.id')[_0xa33d('0x50')]('fax_interaction_has_tags','it',_0xa33d('0x59'))[_0xa33d('0x50')](_0xa33d('0x4d'),'t',_0xa33d('0x5a'));var _0x5f45dc=squel['expr']();var _0x3c3935=[];var _0x1cfcb9=squel[_0xa33d('0x5b')]();var _0x2f4590;if(_0x28f202['query'][_0xa33d('0x5c')]){_0x2f4590=as[_0xa33d('0x5d')](_0x28f202[_0xa33d('0x3e')][_0xa33d('0x5c')]);var _0x24a4b9=_0x2f4590[_0xa33d('0x5e')];for(var _0x1d2995=0x0;_0x1d2995<_0x2f4590['conditions'][_0xa33d('0x5f')];_0x1d2995++){var _0x584285=_0x2f4590[_0xa33d('0x60')][_0x1d2995];var _0x3f8a6c='i';var _0x2c61c7=_[_0xa33d('0x61')](_0x298580,[_0xa33d('0x30'),_0x584285[_0xa33d('0x4b')]]);if(!_0x2c61c7){switch(_0x584285[_0xa33d('0x4b')]){case _0xa33d('0x62'):if(_0x584285['value']==0x1){_0x488e18[_0xa33d('0x63')]('`'+_0x584285[_0xa33d('0x4b')]+_0xa33d('0x64'));}else{_0x488e18[_0xa33d('0x63')]('`'+_0x584285[_0xa33d('0x4b')]+_0xa33d('0x65'));}break;case _0xa33d('0x66'):if(_0x584285['operator']===_0xa33d('0x67')){if(_0x584285[_0xa33d('0x68')][_0xa33d('0x37')]('\x20')['length']>0x1){_0x5f45dc[_0x24a4b9](_0xa33d('0x69'),qs['getFullTextValue'](_0x584285[_0xa33d('0x68')]),null);}else{var _0x160a2d='%'+_0x584285[_0xa33d('0x68')]+'%';_0x5f45dc[_0x24a4b9](_0xa33d('0x6a'),_0x160a2d,_0x160a2d,_0x160a2d);}}else{_0x2c61c7=_['find'](_0x298580,[_0xa33d('0x30'),_0xa33d('0x6b')]);_0x584285[_0xa33d('0x4b')]=_0xa33d('0x6b');_0x59aa1a=as['buildExpression'](_0x3f8a6c,_0x2c61c7['type'],_0x584285);_0x5f45dc[_0x24a4b9](_0x59aa1a[_0xa33d('0x6c')],_0x59aa1a[_0xa33d('0x68')]['start'],_0x59aa1a[_0xa33d('0x68')][_0xa33d('0x22')]);}break;case _0xa33d('0x6d'):var _0x3034bd=_0x584285['value'][_0xa33d('0x37')](',')[_0xa33d('0x33')](function(_0x499153){return Number(_0x499153);});_0x3034bd[_0xa33d('0x6e')](function(_0x1fab0f){_0x1cfcb9['or'](_0xa33d('0x6f'),'%,'+_0x1fab0f+',%');});_0x3c3935=_[_0xa33d('0x70')](_0x3c3935,_0x3034bd);break;case _0xa33d('0x71'):if(_0x584285['operator']===_0xa33d('0x67')){_0x5f45dc[_0x24a4b9](_0xa33d('0x72'),'%'+_0x584285[_0xa33d('0x68')]+'%',null);}else{_0x2c61c7=_['find'](_0x298580,[_0xa33d('0x30'),_0xa33d('0x73')]);_0x584285[_0xa33d('0x4b')]=_0xa33d('0x73');_0x59aa1a=as['buildExpression'](_0x3f8a6c,_0x2c61c7[_0xa33d('0x74')],_0x584285);_0x5f45dc[_0x24a4b9](_0x59aa1a[_0xa33d('0x6c')],_0x59aa1a[_0xa33d('0x68')]['start'],_0x59aa1a[_0xa33d('0x68')][_0xa33d('0x22')]);}break;case _0xa33d('0x75'):_0x59aa1a=as[_0xa33d('0x76')]('me',null,_0x584285);_0x5f45dc[_0x24a4b9](_0x59aa1a[_0xa33d('0x6c')],_0x59aa1a[_0xa33d('0x68')][_0xa33d('0x77')],_0x59aa1a[_0xa33d('0x68')][_0xa33d('0x22')]);break;}}else{var _0x59aa1a=as['buildExpression'](_0x3f8a6c,_0x2c61c7[_0xa33d('0x74')],_0x584285);_0x5f45dc[_0x24a4b9](_0x59aa1a[_0xa33d('0x6c')],_0x59aa1a[_0xa33d('0x68')]['start'],_0x59aa1a[_0xa33d('0x68')][_0xa33d('0x22')]);}}}else{var _0x2530fc=_(_0x28f202['query'])['keys']()['map'](function(_0x48ce4d){return _[_0xa33d('0x78')](_0x298580,['name',_0x48ce4d])?_0x48ce4d:undefined;})['compact']()['value']();if(!_[_0xa33d('0x79')](_0x2530fc)){_0x2530fc['forEach'](function(_0x16ae78){if(_0x16ae78===_0xa33d('0x7a')){_0x488e18['where']('i.FaxAccountId\x20IN\x20?',[]['concat'](_0x28f202[_0xa33d('0x3e')][_0x16ae78]));}else if(_0x16ae78===_0xa33d('0x7b')){var _0xda47e3=JSON[_0xa33d('0x7c')](_0x28f202[_0xa33d('0x3e')][_0x16ae78])[_0xa33d('0x7d')];var _0x3bf1fb=JSON['parse'](_0x28f202[_0xa33d('0x3e')][_0x16ae78])['$lte'];_0x488e18['where'](_0xa33d('0x7e'),_0xda47e3,_0x3bf1fb);}else{if(_0x28f202[_0xa33d('0x3e')][_0x16ae78]===_0xa33d('0x7f')){_0x488e18[_0xa33d('0x80')]('i.'+_0x16ae78+_0xa33d('0x81'));}else{_0x488e18[_0xa33d('0x80')]('i.'+_0x16ae78+_0xa33d('0x82'),_0x28f202[_0xa33d('0x3e')][_0x16ae78]);}}});}if(_0x28f202['query'][_0xa33d('0x83')]){if(_0x28f202[_0xa33d('0x3e')][_0xa33d('0x83')]==0x1){_0x488e18[_0xa33d('0x63')]('`unreadMessages`\x20=\x200');}else{_0x488e18['having'](_0xa33d('0x84'));}}if(_0x28f202['query'][_0xa33d('0x85')]){_0x3c3935=_[_0xa33d('0x86')](_0x28f202[_0xa33d('0x3e')][_0xa33d('0x85')])?_0x28f202['query']['tag']:new Array(_0x28f202['query'][_0xa33d('0x85')]);_0x3c3935['forEach'](function(_0x4ce6bb){_0x1cfcb9['or'](_0xa33d('0x6f'),'%,'+_0x4ce6bb+',%');});}if(_0x28f202[_0xa33d('0x3e')][_0xa33d('0x87')]){var _0x435482=_0x28f202[_0xa33d('0x3e')][_0xa33d('0x87')][_0xa33d('0x88')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs['isNumeric'](_0x435482)){_0x5f45dc['or'](_0xa33d('0x89'),_0x435482+'%')['or']('i.fax\x20LIKE\x20?',_0x435482+'%');}_0x5f45dc['or'](_0xa33d('0x8a'),_0x435482+'%');}}_0x488e18[_0xa33d('0x80')](_0x5f45dc);_0x488e18[_0xa33d('0x8b')]('i.id');var _0x4771aa={'type':db[_0xa33d('0x8c')][_0xa33d('0x8d')][_0xa33d('0x8e')],'raw':!![]};var _0x57db68=_0x488e18[_0xa33d('0x8f')]();_0x57db68[_0xa33d('0x4b')]('i.id');_0x57db68[_0xa33d('0x4b')](_0xa33d('0x90'),'unreadMessages');if(_0x2486ce['order']){_0x2486ce[_0xa33d('0x46')][_0xa33d('0x6e')](function(_0x2fa9d0){var _0x143a2c=_0x2fa9d0[0x0]===_0xa33d('0x91')?_0x2fa9d0[0x0]:'i.'+_0x2fa9d0[0x0];_0x488e18[_0xa33d('0x46')](_0x143a2c,_0x2fa9d0[0x1]===_0xa33d('0x92')?![]:!![]);});}if(!_[_0xa33d('0x79')](_0x3c3935)){_0x488e18[_0xa33d('0x63')](_0x1cfcb9);_0x57db68[_0xa33d('0x80')]('t.id\x20IN\x20?',_0x3c3935);}BPromise[_0xa33d('0x93')]()[_0xa33d('0x2c')](function(){if(!_0x2f4590){if(_0x28f202['query']['FaxAccountId'])return;_0x57db68[_0xa33d('0x80')](_0xa33d('0x94'));_0x488e18[_0xa33d('0x80')](_0xa33d('0x94'));return;}if(_0x28f202[_0xa33d('0x95')][_0xa33d('0x96')]!==_0xa33d('0x97'))return;return _0x28f202[_0xa33d('0x95')][_0xa33d('0x98')]({'attributes':['id'],'raw':!![]})[_0xa33d('0x2c')](function(_0x554e76){if(_[_0xa33d('0x79')](_0x554e76)){_0x57db68[_0xa33d('0x80')]('i.FaxAccountId\x20IS\x20NULL');_0x488e18['where']('i.FaxAccountId\x20IS\x20NULL');}else{_0x57db68['where'](_0xa33d('0x99'),_[_0xa33d('0x33')](_0x554e76,'id'));_0x488e18['where'](_0xa33d('0x99'),_[_0xa33d('0x33')](_0x554e76,'id'));}});})['then'](function(){if(_0x28f202['user'][_0xa33d('0x96')]===_0xa33d('0x97')&&!_0x2f4590&&!_0x28f202[_0xa33d('0x3e')][_0xa33d('0x7a')])return[];return db[_0xa33d('0x9a')]['query'](_0x57db68[_0xa33d('0x9b')](),_0x4771aa);})[_0xa33d('0x2c')](function(_0x2dd590){_0xbaba97[_0xa33d('0x27')]=_0x2dd590['length'];if(_0xbaba97[_0xa33d('0x27')]===0x0)return[];return db[_0xa33d('0x9a')][_0xa33d('0x3e')](_0x25448c[_0xa33d('0x9b')](),_0x4771aa)[_0xa33d('0x2c')](function(_0x4042eb){_0x19a07a=_[_0xa33d('0x9c')](_0x4042eb,'id');_0x4771aa=_[_0xa33d('0x9d')](_0x4771aa,{'model':db[_0xa33d('0x3a')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x28f202['query'][_0xa33d('0x43')]){_0x2486ce[_0xa33d('0x42')][_0xa33d('0x6e')](function(_0x143eae){_0x488e18[_0xa33d('0x4b')]('i.'+_0x143eae);});}else{_0x488e18['field'](_0xa33d('0x90'),_0xa33d('0x62'));_0x488e18['field'](_0xa33d('0x9e'),_0xa33d('0x9f'));_0x488e18['field'](_0xa33d('0xa0'),'Account.mandatoryDisposition');_0x488e18[_0xa33d('0x4b')]('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',_0xa33d('0x91'));_0x488e18['field'](_0xa33d('0xa1'));_0x488e18[_0xa33d('0x4b')]('c.firstName',_0xa33d('0xa2'));_0x488e18[_0xa33d('0x4b')](_0xa33d('0xa3'),'Contact.lastName');_0x488e18[_0xa33d('0x4b')](_0xa33d('0xa4'),_0xa33d('0xa5'));_0x488e18[_0xa33d('0x4b')](_0xa33d('0xa6'),'Contact.phone');_0x488e18[_0xa33d('0x4b')](_0xa33d('0xa7'),_0xa33d('0xa8'));_0x488e18[_0xa33d('0x4b')](_0xa33d('0xa9'),_0xa33d('0xaa'));_0x488e18[_0xa33d('0x4b')](_0xa33d('0xab'),_0xa33d('0xac'));_0x488e18[_0xa33d('0x4b')](_0xa33d('0xad'),_0xa33d('0xae'));_0x488e18[_0xa33d('0x4b')](_0xa33d('0xaf'),_0xa33d('0x35'));}if(_0x2486ce[_0xa33d('0x26')])_0x488e18[_0xa33d('0x26')](_0x2486ce[_0xa33d('0x26')]);if(_0x2486ce[_0xa33d('0x24')])_0x488e18['offset'](_0x2486ce[_0xa33d('0x24')]);return db[_0xa33d('0x9a')]['query'](_0x488e18[_0xa33d('0x9b')](),_0x4771aa);})[_0xa33d('0x2c')](function(_0x13ec25){if(_0x13ec25['length']>0x0)_0x208c0c['where'](_0xa33d('0xb0'),_[_0xa33d('0x33')](_0x13ec25,'id'));return db['sequelize'][_0xa33d('0x3e')](_0x208c0c[_0xa33d('0x9b')](),_0x4771aa)[_0xa33d('0x2c')](function(_0x47f20c){var _0x191920=_[_0xa33d('0xb1')](_0x47f20c,_0xa33d('0xb2'));var _0x31875d=[];_0x13ec25['forEach'](function(_0x162f6d){_0x31875d[_0xa33d('0xb3')](updateFaxInteraction(_0x162f6d,_0x19a07a,_0x191920));});return BPromise['all'](_0x31875d);});});})[_0xa33d('0x2c')](function(_0x4304bb){_0xbaba97[_0xa33d('0xb4')]=_0x4304bb;return _0xbaba97;})[_0xa33d('0x2c')](respondWithFilteredResult(_0x46c171,_0x2486ce))[_0xa33d('0x38')](handleError(_0x46c171,null));};exports[_0xa33d('0xb5')]=function(_0x2a98f6,_0x378d03){var _0x4735bb={'raw':![],'where':{'id':_0x2a98f6['params']['id']}},_0x18ed9d={};_0x18ed9d[_0xa33d('0x41')]=_[_0xa33d('0x3f')](db[_0xa33d('0x3a')][_0xa33d('0x3b')]);_0x18ed9d[_0xa33d('0x3e')]=_[_0xa33d('0x3f')](_0x2a98f6[_0xa33d('0x3e')]);_0x18ed9d['filters']=_[_0xa33d('0x40')](_0x18ed9d[_0xa33d('0x41')],_0x18ed9d[_0xa33d('0x3e')]);_0x4735bb[_0xa33d('0x42')]=_[_0xa33d('0x40')](_0x18ed9d[_0xa33d('0x41')],qs['fields'](_0x2a98f6[_0xa33d('0x3e')][_0xa33d('0x43')]));_0x4735bb[_0xa33d('0x42')]=_0x4735bb[_0xa33d('0x42')]['length']?_0x4735bb['attributes']:_0x18ed9d[_0xa33d('0x41')];if(_0x2a98f6[_0xa33d('0x3e')][_0xa33d('0xb6')]){_0x4735bb[_0xa33d('0xb7')]=[{'all':!![]}];}_0x4735bb=_['merge']({},_0x4735bb,_0x2a98f6['options']);return db[_0xa33d('0x3a')][_0xa33d('0x61')](_0x4735bb)[_0xa33d('0x2c')](handleEntityNotFound(_0x378d03,null))[_0xa33d('0x2c')](respondWithResult(_0x378d03,null))['catch'](handleError(_0x378d03,null));};exports[_0xa33d('0xb8')]=function(_0x44444e,_0x440a9e){return db[_0xa33d('0x3a')][_0xa33d('0xb8')](_0x44444e[_0xa33d('0x75')],{})[_0xa33d('0x2c')](respondWithResult(_0x440a9e,0xc9))['catch'](handleError(_0x440a9e,null));};exports['update']=function(_0x47db1d,_0x1489f1){if(_0x47db1d[_0xa33d('0x75')]['id']){delete _0x47db1d[_0xa33d('0x75')]['id'];}return db[_0xa33d('0x3a')]['find']({'where':{'id':_0x47db1d[_0xa33d('0xb9')]['id']}})[_0xa33d('0x2c')](handleEntityNotFound(_0x1489f1,null))['then'](saveUpdates(_0x47db1d['body'],null))['then'](respondWithResult(_0x1489f1,null))[_0xa33d('0x38')](handleError(_0x1489f1,null));};exports[_0xa33d('0x2d')]=function(_0x1dc57e,_0x4ca96b){return db['FaxInteraction'][_0xa33d('0x61')]({'where':{'id':_0x1dc57e[_0xa33d('0xb9')]['id']}})[_0xa33d('0x2c')](handleEntityNotFound(_0x4ca96b,null))['then'](removeEntity(_0x4ca96b,null))[_0xa33d('0x38')](handleError(_0x4ca96b,null));};exports[_0xa33d('0xba')]=function(_0x550ab7,_0x1d5ad7){return db['FaxInteraction'][_0xa33d('0xba')]()[_0xa33d('0x2c')](respondWithResult(_0x1d5ad7,null))[_0xa33d('0x38')](handleError(_0x1d5ad7,null));};exports[_0xa33d('0xbb')]=function(_0x110040,_0x4d1312,_0x463fde){return db[_0xa33d('0xbc')]['find']({'where':{'id':_0x110040[_0xa33d('0xb9')]['id']}})[_0xa33d('0x2c')](handleEntityNotFound(_0x4d1312,null))[_0xa33d('0x2c')](function(_0x4aa514){if(_0x4aa514){return _0x4aa514['addMessage'](_0x110040['body']['ids'],_[_0xa33d('0xbd')](_0x110040['body'],[_0xa33d('0xbe'),'id'])||{});}})[_0xa33d('0x2c')](respondWithResult(_0x4d1312,null))[_0xa33d('0x38')](handleError(_0x4d1312,null));};exports['getMessages']=function(_0x308681,_0xbbd8d9,_0x1e5399){var _0x2c8603={'raw':![],'where':{}};var _0x2e36c0={};var _0x5200ef={'count':0x0,'rows':[]};return db[_0xa33d('0x3a')]['findOne']({'where':{'id':_0x308681['params']['id']}})[_0xa33d('0x2c')](handleEntityNotFound(_0xbbd8d9,null))[_0xa33d('0x2c')](function(_0x1e8713){if(_0x1e8713){_0x2e36c0['model']=_[_0xa33d('0x3f')](db['FaxMessage'][_0xa33d('0x3b')]);_0x2e36c0[_0xa33d('0x3e')]=_[_0xa33d('0x3f')](_0x308681[_0xa33d('0x3e')]);_0x2e36c0[_0xa33d('0x48')]=_['intersection'](_0x2e36c0[_0xa33d('0x41')],_0x2e36c0[_0xa33d('0x3e')]);_0x2c8603[_0xa33d('0x42')]=_[_0xa33d('0x40')](_0x2e36c0[_0xa33d('0x41')],qs[_0xa33d('0x43')](_0x308681['query'][_0xa33d('0x43')]));_0x2c8603[_0xa33d('0x42')]=_0x2c8603[_0xa33d('0x42')][_0xa33d('0x5f')]?_0x2c8603[_0xa33d('0x42')]:_0x2e36c0[_0xa33d('0x41')];if(!_0x308681[_0xa33d('0x3e')][_0xa33d('0x44')]('nolimit')){_0x2c8603[_0xa33d('0x26')]=qs[_0xa33d('0x26')](_0x308681[_0xa33d('0x3e')][_0xa33d('0x26')]);_0x2c8603[_0xa33d('0x24')]=qs[_0xa33d('0x24')](_0x308681[_0xa33d('0x3e')]['offset']);}_0x2c8603['order']=qs['sort'](_0x308681[_0xa33d('0x3e')][_0xa33d('0x47')]);_0x2c8603['where']=qs['filters'](_[_0xa33d('0x49')](_0x308681[_0xa33d('0x3e')],_0x2e36c0[_0xa33d('0x48')]));_0x2c8603['where']['FaxInteractionId']=_0x1e8713['id'];if(_0x308681[_0xa33d('0x3e')][_0xa33d('0x87')]){_0x2c8603['where']=_[_0xa33d('0x9d')](_0x2c8603['where'],{'$or':_[_0xa33d('0x33')](_0x2c8603['attributes'],function(_0x58dfed){var _0xc66ded={};_0xc66ded[_0x58dfed]={'$like':'%'+_0x308681[_0xa33d('0x3e')][_0xa33d('0x87')]+'%'};return _0xc66ded;})});}if(_0x308681[_0xa33d('0x3e')][_0xa33d('0x7d')]){var _0x3f5eb1=_0x308681[_0xa33d('0x3e')][_0xa33d('0x7d')][_0xa33d('0x37')](',');var _0x2e038d={};_0x2e038d[_0x3f5eb1[0x0]]={'$gte':moment(_0x3f5eb1[0x1])[_0xa33d('0xbf')]('YYYY-MM-DD\x20HH:mm:ss')};_0x2c8603[_0xa33d('0x80')]=_['merge'](_0x2c8603[_0xa33d('0x80')],_0x2e038d);}_0x2c8603=_['merge']({},_0x2c8603,_0x308681['options']);return db[_0xa33d('0xbc')][_0xa33d('0x27')]({'where':_0x2c8603['where']})[_0xa33d('0x2c')](function(_0xfb6bfe){_0x5200ef[_0xa33d('0x27')]=_0xfb6bfe;if(_0x308681[_0xa33d('0x3e')][_0xa33d('0xb6')]){_0x2c8603[_0xa33d('0xb7')]=[{'all':!![]}];}return db[_0xa33d('0xbc')][_0xa33d('0xc0')](_0x2c8603);})[_0xa33d('0x2c')](function(_0x5ca8fa){_0x5200ef[_0xa33d('0xb4')]=_0x5ca8fa;return _0x5200ef;});}})[_0xa33d('0x2c')](respondWithFilteredResult(_0xbbd8d9,_0x2c8603))['catch'](handleError(_0xbbd8d9,null));};exports['addTags']=function(_0x26f895,_0x54752b,_0x4d2aaa){return db['FaxInteraction'][_0xa33d('0x61')]({'where':{'id':_0x26f895[_0xa33d('0xb9')]['id']}})[_0xa33d('0x2c')](handleEntityNotFound(_0x54752b,null))[_0xa33d('0x2c')](function(_0x189617){if(_0x189617){return _0x189617[_0xa33d('0xc1')](_0x26f895[_0xa33d('0x75')]['ids'],_[_0xa33d('0xbd')](_0x26f895[_0xa33d('0x75')],[_0xa33d('0xbe'),'id'])||{})[_0xa33d('0xc2')](function(){return db[_0xa33d('0x6d')][_0xa33d('0xc0')]({'attributes':['id',_0xa33d('0x30'),'color'],'where':{'id':_0x26f895[_0xa33d('0x75')][_0xa33d('0xbe')]}});})['then'](function(_0x243f8f){socket['emit'](_0xa33d('0xc3'),{'id':Number(_0x26f895[_0xa33d('0xb9')]['id']),'tags':_0x243f8f||[]});return{'id':Number(_0x26f895[_0xa33d('0xb9')]['id']),'tags':_0x243f8f||[]};});}})['then'](respondWithResult(_0x54752b,null))[_0xa33d('0x38')](handleError(_0x54752b,null));};exports[_0xa33d('0xc4')]=function(_0xdcd40c,_0x470455,_0x481de6){return db[_0xa33d('0x3a')][_0xa33d('0x61')]({'where':{'id':_0xdcd40c[_0xa33d('0xb9')]['id']}})[_0xa33d('0x2c')](handleEntityNotFound(_0x470455,null))[_0xa33d('0x2c')](function(_0x4dc167){if(_0x4dc167){return _0x4dc167[_0xa33d('0xc4')](_0xdcd40c['query'][_0xa33d('0xbe')]);}})[_0xa33d('0x2c')](respondWithStatusCode(_0x470455,null))[_0xa33d('0x38')](handleError(_0x470455,null));};exports['download']=function(_0x58c191,_0x3a0a78){var _0x40d18b=moment()[_0xa33d('0xc5')]()['toString']();var _0x5d17a6=path[_0xa33d('0xc6')](config[_0xa33d('0xc7')],_0xa33d('0xc8'),'files',_0xa33d('0xc9'));var _0x1efa0b=path['join'](config['root'],_0xa33d('0xc8'),_0xa33d('0xca'),'attachments');var _0x25c6fd=path[_0xa33d('0xc6')](_0x5d17a6,_0x40d18b);var _0x57e73c=util[_0xa33d('0xbf')](_0xa33d('0xcb'),_0x58c191[_0xa33d('0xb9')]['id'],_0x40d18b);var _0x518536=path['join'](_0x5d17a6,_0x57e73c);var _0x224bcc=[];_0x224bcc['push']({'model':db[_0xa33d('0xcc')],'as':_0xa33d('0xcc'),'raw':!![]});var _0x5612c7=[{'model':db['FaxMessage'],'as':'Messages','attributes':['id','body',_0xa33d('0x7b')],'include':_0x224bcc}];return db['FaxInteraction'][_0xa33d('0x61')]({'where':{'id':_0x58c191[_0xa33d('0xb9')]['id']},'include':_0x5612c7})[_0xa33d('0x2c')](handleEntityNotFound(_0x3a0a78,null))['then'](function(_0x338c33){if(_0x338c33&&_0x338c33[_0xa33d('0xcd')]){var _0xae653c=_0x338c33['get']({'plain':!![]});fs[_0xa33d('0xce')](_0x25c6fd);for(var _0x2d7bb5=0x0;_0x2d7bb5<_0xae653c[_0xa33d('0xcd')][_0xa33d('0x5f')];_0x2d7bb5++){var _0xcf0e9f=_0xae653c['Messages'][_0x2d7bb5][_0xa33d('0xcc')];if(_0xcf0e9f){var _0x2dcba1=path[_0xa33d('0xc6')](_0x1efa0b,_0xcf0e9f[_0xa33d('0xcf')]);if(fs[_0xa33d('0xd0')](_0x2dcba1)){fs[_0xa33d('0xd1')](_0x2dcba1)[_0xa33d('0xd2')](fs[_0xa33d('0xd3')](path[_0xa33d('0xc6')](_0x25c6fd,_0xcf0e9f[_0xa33d('0xcf')])));}}}return BPromise[_0xa33d('0x93')]()[_0xa33d('0x2c')](function(){return new BPromise(function(_0x3fb677,_0x5b27e3){zipdir(_0x25c6fd,{'saveTo':_0x518536},function(_0x161a66,_0x3296f1){if(_0x161a66)return _0x5b27e3(_0x161a66);return _0x3fb677(_0x3296f1);});})[_0xa33d('0x2c')](function(){return new BPromise(function(_0x5464b6,_0x4e5a3c){rimraf(_0x25c6fd,function(_0x4ea167){if(_0x4ea167)_0x4e5a3c(_0x4ea167);return _0x5464b6();});});})[_0xa33d('0x2c')](function(){return _0x3a0a78[_0xa33d('0xd4')](_0x518536,_0x57e73c,function(_0x5261f8){if(_0x5261f8){console['log'](_0xa33d('0xd5'),_0x5261f8);}else{fs['unlinkSync'](_0x518536);}});});});}else{return _0x3a0a78[_0xa33d('0x2e')](0xc8);}})[_0xa33d('0x38')](handleError(_0x3a0a78,null));}; \ No newline at end of file +var _0x21c7=['fields','attributes','length','nolimit','order','sort','where','pick','select','field','color','tools_tags','ui.FaxInteractionId','user_has_fax_interactions','left_join','u.id\x20=\x20ui.UserId','from','fax_interactions','cm_contacts','users','o.id\x20=\x20i.UserId','a.id\x20=\x20i.FaxAccountId','fax_messages','fax_interaction_has_tags','it.FaxInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','sqlOperator','conditions','find','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','some','isEmpty','forEach','FaxAccountId','i.FaxAccountId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','filter','replace','isNumeric','i.id\x20LIKE\x20?','group','Sequelize','QueryTypes','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','t.id\x20IN\x20?','resolve','i.FaxAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getFaxAccounts','toString','sequelize','keyBy','merge','FaxInteraction','a.key','Account.key','a.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','Contact.mobile','Contact.fax','o.fullname','Owner.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','groupBy','FaxInteractionId','all','rows','rawAttributes','includeAll','include','options','create','body','catch','params','describe','addMessage','FaxMessage','ids','omit','getMessages','findOne','findAll','addTags','setTags','spread','emit','faxInteractionTags:save','removeTags','download','unix','root','files','tmp','join','server','attachments','format','transcript-%d-%s.zip','Attachment','Messages','get','mkdirSync','existsSync','createReadStream','log','err','sendStatus','rimraf','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxInteraction.socket','register','status','json','undefined','limit','offset','count','set','apply','update','then','destroy','end','error','stack','name','send','Users','map','fullname','Tags','split','push','TagIds','index','fieldName','type','key','model','query','keys','filters','intersection'];(function(_0x215e00,_0x50f345){var _0x180847=function(_0x3287ce){while(--_0x3287ce){_0x215e00['push'](_0x215e00['shift']());}};_0x180847(++_0x50f345);}(_0x21c7,0x99));var _0x721c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x21c7[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x721c('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x721c('0x1'));var BPromise=require(_0x721c('0x2'));var Mustache=require(_0x721c('0x3'));var util=require(_0x721c('0x4'));var path=require('path');var sox=require(_0x721c('0x5'));var csv=require('to-csv');var ejs=require(_0x721c('0x6'));var fs=require('fs');var fs_extra=require(_0x721c('0x7'));var _=require(_0x721c('0x8'));var squel=require('squel');var crypto=require(_0x721c('0x9'));var jsforce=require(_0x721c('0xa'));var deskjs=require(_0x721c('0xb'));var toCsv=require('to-csv');var querystring=require(_0x721c('0xc'));var Papa=require(_0x721c('0xd'));var Redis=require(_0x721c('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x721c('0xf'));var hardwareService=require(_0x721c('0x10'));var logger=require('../../config/logger')(_0x721c('0x11'));var utils=require(_0x721c('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x721c('0x13'));var db=require(_0x721c('0x14'))['db'];config[_0x721c('0x15')]=_[_0x721c('0x16')](config[_0x721c('0x15')],{'host':_0x721c('0x17'),'port':0x18eb});var socket=require(_0x721c('0x18'))(new Redis(config[_0x721c('0x15')]));require(_0x721c('0x19'))[_0x721c('0x1a')](socket);function respondWithStatusCode(_0x4b3d4c,_0x58d93b){_0x58d93b=_0x58d93b||0xcc;return function(_0x59647b){if(_0x59647b){return _0x4b3d4c['sendStatus'](_0x58d93b);}return _0x4b3d4c[_0x721c('0x1b')](_0x58d93b)['end']();};}function respondWithResult(_0x38d022,_0x4451f6){_0x4451f6=_0x4451f6||0xc8;return function(_0xe68b3b){if(_0xe68b3b){return _0x38d022[_0x721c('0x1b')](_0x4451f6)[_0x721c('0x1c')](_0xe68b3b);}};}function respondWithFilteredResult(_0x17341a,_0x571e8f){return function(_0x2ceb27){if(_0x2ceb27){var _0x48d392=typeof _0x571e8f['offset']===_0x721c('0x1d')&&typeof _0x571e8f[_0x721c('0x1e')]==='undefined';var _0x3f77e3=_0x2ceb27['count'];var _0x2cb774=_0x48d392?0x0:_0x571e8f[_0x721c('0x1f')];var _0x51ec9e=_0x48d392?_0x2ceb27[_0x721c('0x20')]:_0x571e8f['offset']+_0x571e8f['limit'];var _0x69e8cc;if(_0x51ec9e>=_0x3f77e3){_0x51ec9e=_0x3f77e3;_0x69e8cc=0xc8;}else{_0x69e8cc=0xce;}_0x17341a[_0x721c('0x1b')](_0x69e8cc);return _0x17341a[_0x721c('0x21')]('Content-Range',_0x2cb774+'-'+_0x51ec9e+'/'+_0x3f77e3)[_0x721c('0x1c')](_0x2ceb27);}return null;};}function patchUpdates(_0x69016f){return function(_0x3fc921){try{jsonpatch[_0x721c('0x22')](_0x3fc921,_0x69016f,!![]);}catch(_0xe8032b){return BPromise['reject'](_0xe8032b);}return _0x3fc921['save']();};}function saveUpdates(_0x1f9835,_0x3b49c0){return function(_0x5daacb){if(_0x5daacb){return _0x5daacb[_0x721c('0x23')](_0x1f9835)[_0x721c('0x24')](function(_0x10d5b6){return _0x10d5b6;});}return null;};}function removeEntity(_0x3bf663,_0x1a1dc4){return function(_0x5adc46){if(_0x5adc46){return _0x5adc46[_0x721c('0x25')]()[_0x721c('0x24')](function(){_0x3bf663[_0x721c('0x1b')](0xcc)[_0x721c('0x26')]();});}};}function handleEntityNotFound(_0x5e1a74,_0x3f95ed){return function(_0x1b9a60){if(!_0x1b9a60){_0x5e1a74['sendStatus'](0x194);}return _0x1b9a60;};}function handleError(_0x2d7413,_0xc17ad1){_0xc17ad1=_0xc17ad1||0x1f4;return function(_0x534987){logger[_0x721c('0x27')](_0x534987[_0x721c('0x28')]);if(_0x534987[_0x721c('0x29')]){delete _0x534987[_0x721c('0x29')];}_0x2d7413[_0x721c('0x1b')](_0xc17ad1)[_0x721c('0x2a')](_0x534987);};}function getInteractionUsers(_0x5a5ca6,_0x1ec307){return new BPromise(function(_0x36b140,_0x3a5393){try{if(_0x1ec307[_0x5a5ca6['id']]){_0x5a5ca6[_0x721c('0x2b')]=_[_0x721c('0x2c')](_0x1ec307[_0x5a5ca6['id']],function(_0x552164){return{'id':_0x552164['id'],'fullname':_0x552164[_0x721c('0x2d')]};});}}catch(_0x1d1887){_0x3a5393(_0x1d1887);}_0x36b140(_0x5a5ca6);});}function getInteractionTags(_0x125299,_0x1c8297){return new BPromise(function(_0xdec993,_0x1d53ed){try{if(_0x125299['TagIds']){_0x125299[_0x721c('0x2e')]=[];_0x125299['TagIds'][_0x721c('0x2f')](',')['forEach'](function(_0x3ebde4){_0x125299[_0x721c('0x2e')][_0x721c('0x30')](_0x1c8297[_0x3ebde4]);});}delete _0x125299[_0x721c('0x31')];}catch(_0x28a13f){_0x1d53ed(_0x28a13f);}_0xdec993(_0x125299);});}function updateFaxInteraction(_0x365d54,_0x3adc56,_0x546c1e){return new BPromise(function(_0x22bb61,_0x13dba9){return getInteractionUsers(_0x365d54,_0x546c1e)[_0x721c('0x24')](function(_0x23f12b){return getInteractionTags(_0x23f12b,_0x3adc56);})[_0x721c('0x24')](function(_0x1cdbcc){_0x22bb61(_0x1cdbcc);})['catch'](function(_0x3bd072){_0x13dba9(_0x3bd072);});});}exports[_0x721c('0x32')]=function(_0x1e22f5,_0x284193){var _0x433a4f={},_0x4012eb={},_0xeded77={'count':0x0,'rows':[]};var _0x2e9f57=_[_0x721c('0x2c')](db['FaxInteraction']['rawAttributes'],function(_0x113af6){return{'name':_0x113af6[_0x721c('0x33')],'type':_0x113af6[_0x721c('0x34')][_0x721c('0x35')]};});_0x4012eb[_0x721c('0x36')]=_[_0x721c('0x2c')](_0x2e9f57,'name');_0x4012eb[_0x721c('0x37')]=_[_0x721c('0x38')](_0x1e22f5[_0x721c('0x37')]);_0x4012eb[_0x721c('0x39')]=_[_0x721c('0x3a')](_0x4012eb[_0x721c('0x36')],_0x4012eb[_0x721c('0x37')]);_0x433a4f['attributes']=_[_0x721c('0x3a')](_0x4012eb[_0x721c('0x36')],qs['fields'](_0x1e22f5[_0x721c('0x37')][_0x721c('0x3b')]));_0x433a4f['attributes']=_0x433a4f[_0x721c('0x3c')][_0x721c('0x3d')]?_0x433a4f[_0x721c('0x3c')]:_0x4012eb[_0x721c('0x36')];if(!_0x1e22f5[_0x721c('0x37')]['hasOwnProperty'](_0x721c('0x3e'))){_0x433a4f[_0x721c('0x1e')]=qs[_0x721c('0x1e')](_0x1e22f5[_0x721c('0x37')][_0x721c('0x1e')]);_0x433a4f[_0x721c('0x1f')]=qs[_0x721c('0x1f')](_0x1e22f5[_0x721c('0x37')][_0x721c('0x1f')]);}_0x433a4f[_0x721c('0x3f')]=qs[_0x721c('0x40')](_0x1e22f5[_0x721c('0x37')][_0x721c('0x40')]);_0x433a4f[_0x721c('0x41')]=qs[_0x721c('0x39')](_[_0x721c('0x42')](_0x1e22f5[_0x721c('0x37')],_0x4012eb[_0x721c('0x39')]),_0x2e9f57);var _0xee04b5=[];var _0x353d20=squel[_0x721c('0x43')]()[_0x721c('0x44')]('id')[_0x721c('0x44')](_0x721c('0x29'))[_0x721c('0x44')](_0x721c('0x45'))['from'](_0x721c('0x46'));var _0x5a38f8=squel[_0x721c('0x43')]()[_0x721c('0x44')]('u.id')['field']('u.fullname')[_0x721c('0x44')](_0x721c('0x47'))['from'](_0x721c('0x48'),'ui')[_0x721c('0x49')]('users','u',_0x721c('0x4a'));var _0x3329a9=squel[_0x721c('0x43')]()[_0x721c('0x4b')](_0x721c('0x4c'),'i')[_0x721c('0x49')](_0x721c('0x4d'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0x721c('0x49')](_0x721c('0x4e'),'o',_0x721c('0x4f'))[_0x721c('0x49')]('fax_accounts','a',_0x721c('0x50'))[_0x721c('0x49')](_0x721c('0x51'),'me','me.FaxInteractionId\x20=\x20i.id')[_0x721c('0x49')](_0x721c('0x52'),'it',_0x721c('0x53'))[_0x721c('0x49')](_0x721c('0x46'),'t',_0x721c('0x54'));var _0x293d27=squel[_0x721c('0x55')]();var _0x25369e=[];var _0x4154a0=squel[_0x721c('0x55')]();var _0x44f453;if(_0x1e22f5[_0x721c('0x37')][_0x721c('0x56')]){_0x44f453=as['parseSearch'](_0x1e22f5['query'][_0x721c('0x56')]);var _0x4ef6fb=_0x44f453[_0x721c('0x57')];for(var _0x52816a=0x0;_0x52816a<_0x44f453[_0x721c('0x58')][_0x721c('0x3d')];_0x52816a++){var _0x2ce4d7=_0x44f453[_0x721c('0x58')][_0x52816a];var _0x4ce71d='i';var _0x58f2e7=_[_0x721c('0x59')](_0x2e9f57,[_0x721c('0x29'),_0x2ce4d7[_0x721c('0x44')]]);if(!_0x58f2e7){switch(_0x2ce4d7[_0x721c('0x44')]){case _0x721c('0x5a'):if(_0x2ce4d7[_0x721c('0x5b')]==0x1){_0x3329a9[_0x721c('0x5c')]('`'+_0x2ce4d7[_0x721c('0x44')]+_0x721c('0x5d'));}else{_0x3329a9[_0x721c('0x5c')]('`'+_0x2ce4d7['field']+_0x721c('0x5e'));}break;case'Contact':if(_0x2ce4d7[_0x721c('0x5f')]===_0x721c('0x60')){if(_0x2ce4d7[_0x721c('0x5b')][_0x721c('0x2f')]('\x20')[_0x721c('0x3d')]>0x1){_0x293d27[_0x4ef6fb](_0x721c('0x61'),qs[_0x721c('0x62')](_0x2ce4d7[_0x721c('0x5b')]),null);}else{var _0x1b9860='%'+_0x2ce4d7[_0x721c('0x5b')]+'%';_0x293d27[_0x4ef6fb](_0x721c('0x63'),_0x1b9860,_0x1b9860,_0x1b9860);}}else{_0x58f2e7=_[_0x721c('0x59')](_0x2e9f57,[_0x721c('0x29'),'ContactId']);_0x2ce4d7[_0x721c('0x44')]=_0x721c('0x64');_0x13ae10=as[_0x721c('0x65')](_0x4ce71d,_0x58f2e7[_0x721c('0x34')],_0x2ce4d7);_0x293d27[_0x4ef6fb](_0x13ae10[_0x721c('0x66')],_0x13ae10[_0x721c('0x5b')][_0x721c('0x67')],_0x13ae10[_0x721c('0x5b')][_0x721c('0x26')]);}break;case _0x721c('0x68'):var _0x4152ed=_0x2ce4d7[_0x721c('0x5b')][_0x721c('0x2f')](',')[_0x721c('0x2c')](function(_0x52f297){return Number(_0x52f297);});_0x4152ed['forEach'](function(_0x2983fb){_0x4154a0['or'](_0x721c('0x69'),'%,'+_0x2983fb+',%');});_0x25369e=_[_0x721c('0x6a')](_0x25369e,_0x4152ed);break;case'User':if(_0x2ce4d7[_0x721c('0x5f')]===_0x721c('0x60')){_0x293d27[_0x4ef6fb](_0x721c('0x6b'),'%'+_0x2ce4d7['value']+'%',null);}else{_0x58f2e7=_[_0x721c('0x59')](_0x2e9f57,[_0x721c('0x29'),_0x721c('0x6c')]);_0x2ce4d7[_0x721c('0x44')]='UserId';_0x13ae10=as[_0x721c('0x65')](_0x4ce71d,_0x58f2e7[_0x721c('0x34')],_0x2ce4d7);_0x293d27[_0x4ef6fb](_0x13ae10[_0x721c('0x66')],_0x13ae10['value'][_0x721c('0x67')],_0x13ae10[_0x721c('0x5b')][_0x721c('0x26')]);}break;case'body':_0x13ae10=as[_0x721c('0x65')]('me',null,_0x2ce4d7);_0x293d27[_0x4ef6fb](_0x13ae10[_0x721c('0x66')],_0x13ae10[_0x721c('0x5b')][_0x721c('0x67')],_0x13ae10[_0x721c('0x5b')]['end']);break;}}else{var _0x13ae10=as[_0x721c('0x65')](_0x4ce71d,_0x58f2e7[_0x721c('0x34')],_0x2ce4d7);_0x293d27[_0x4ef6fb](_0x13ae10[_0x721c('0x66')],_0x13ae10[_0x721c('0x5b')][_0x721c('0x67')],_0x13ae10[_0x721c('0x5b')][_0x721c('0x26')]);}}}else{var _0x3102ed=_(_0x1e22f5[_0x721c('0x37')])[_0x721c('0x38')]()[_0x721c('0x2c')](function(_0x3b3d73){return _[_0x721c('0x6d')](_0x2e9f57,[_0x721c('0x29'),_0x3b3d73])?_0x3b3d73:undefined;})['compact']()[_0x721c('0x5b')]();if(!_[_0x721c('0x6e')](_0x3102ed)){_0x3102ed[_0x721c('0x6f')](function(_0x1099c6){if(_0x1099c6===_0x721c('0x70')){_0x3329a9[_0x721c('0x41')](_0x721c('0x71'),[][_0x721c('0x72')](_0x1e22f5[_0x721c('0x37')][_0x1099c6]));}else if(_0x1099c6===_0x721c('0x73')){var _0x53c3b8=JSON[_0x721c('0x74')](_0x1e22f5[_0x721c('0x37')][_0x1099c6])[_0x721c('0x75')];var _0x2cbf28=JSON[_0x721c('0x74')](_0x1e22f5[_0x721c('0x37')][_0x1099c6])[_0x721c('0x76')];_0x3329a9[_0x721c('0x41')](_0x721c('0x77'),_0x53c3b8,_0x2cbf28);}else{if(_0x1e22f5[_0x721c('0x37')][_0x1099c6]==='null'){_0x3329a9[_0x721c('0x41')]('i.'+_0x1099c6+'\x20IS\x20NULL');}else{_0x3329a9[_0x721c('0x41')]('i.'+_0x1099c6+_0x721c('0x78'),_0x1e22f5[_0x721c('0x37')][_0x1099c6]);}}});}if(_0x1e22f5[_0x721c('0x37')][_0x721c('0x79')]){if(_0x1e22f5[_0x721c('0x37')][_0x721c('0x79')]==0x1){_0x3329a9[_0x721c('0x5c')](_0x721c('0x7a'));}else{_0x3329a9[_0x721c('0x5c')](_0x721c('0x7b'));}}if(_0x1e22f5[_0x721c('0x37')]['tag']){_0x25369e=_['isArray'](_0x1e22f5[_0x721c('0x37')][_0x721c('0x7c')])?_0x1e22f5[_0x721c('0x37')][_0x721c('0x7c')]:new Array(_0x1e22f5[_0x721c('0x37')][_0x721c('0x7c')]);_0x25369e['forEach'](function(_0x53ce3a){_0x4154a0['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x53ce3a+',%');});}if(_0x1e22f5[_0x721c('0x37')][_0x721c('0x7d')]){var _0x3c2ee0=_0x1e22f5[_0x721c('0x37')][_0x721c('0x7d')]['replace']('\x5c','\x5c\x5c')[_0x721c('0x7e')](/'/g,'\x27\x27');if(qs[_0x721c('0x7f')](_0x3c2ee0)){_0x293d27['or'](_0x721c('0x80'),_0x3c2ee0+'%')['or']('i.fax\x20LIKE\x20?',_0x3c2ee0+'%');}_0x293d27['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x3c2ee0+'%');}}_0x3329a9[_0x721c('0x41')](_0x293d27);_0x3329a9[_0x721c('0x81')]('i.id');var _0x48a158={'type':db[_0x721c('0x82')][_0x721c('0x83')]['SELECT'],'raw':!![]};var _0x4d020f=_0x3329a9[_0x721c('0x84')]();_0x4d020f[_0x721c('0x44')]('i.id');_0x4d020f['field'](_0x721c('0x85'),_0x721c('0x5a'));if(_0x433a4f['order']){_0x433a4f['order'][_0x721c('0x6f')](function(_0x117e9e){var _0x1953dd=_0x117e9e[0x0]===_0x721c('0x86')?_0x117e9e[0x0]:'i.'+_0x117e9e[0x0];_0x3329a9[_0x721c('0x3f')](_0x1953dd,_0x117e9e[0x1]===_0x721c('0x87')?![]:!![]);});}if(!_[_0x721c('0x6e')](_0x25369e)){_0x3329a9['having'](_0x4154a0);_0x4d020f['where'](_0x721c('0x88'),_0x25369e);}BPromise[_0x721c('0x89')]()[_0x721c('0x24')](function(){if(!_0x44f453){if(_0x1e22f5[_0x721c('0x37')][_0x721c('0x70')])return;_0x4d020f[_0x721c('0x41')]('i.FaxAccountId\x20IS\x20NOT\x20NULL');_0x3329a9[_0x721c('0x41')](_0x721c('0x8a'));return;}if(_0x1e22f5[_0x721c('0x8b')][_0x721c('0x8c')]!==_0x721c('0x8d'))return;return _0x1e22f5[_0x721c('0x8b')][_0x721c('0x8e')]({'attributes':['id'],'raw':!![]})[_0x721c('0x24')](function(_0x22d1d6){if(_[_0x721c('0x6e')](_0x22d1d6)){_0x4d020f[_0x721c('0x41')]('i.FaxAccountId\x20IS\x20NULL');_0x3329a9[_0x721c('0x41')]('i.FaxAccountId\x20IS\x20NULL');}else{_0x4d020f[_0x721c('0x41')](_0x721c('0x71'),_[_0x721c('0x2c')](_0x22d1d6,'id'));_0x3329a9[_0x721c('0x41')](_0x721c('0x71'),_[_0x721c('0x2c')](_0x22d1d6,'id'));}});})[_0x721c('0x24')](function(){if(_0x1e22f5[_0x721c('0x8b')]['role']===_0x721c('0x8d')&&!_0x44f453&&!_0x1e22f5[_0x721c('0x37')][_0x721c('0x70')])return[];return db['sequelize'][_0x721c('0x37')](_0x4d020f[_0x721c('0x8f')](),_0x48a158);})[_0x721c('0x24')](function(_0x3078ca){_0xeded77[_0x721c('0x20')]=_0x3078ca[_0x721c('0x3d')];if(_0xeded77['count']===0x0)return[];return db[_0x721c('0x90')][_0x721c('0x37')](_0x353d20[_0x721c('0x8f')](),_0x48a158)['then'](function(_0xbd9d){_0xee04b5=_[_0x721c('0x91')](_0xbd9d,'id');_0x48a158=_[_0x721c('0x92')](_0x48a158,{'model':db[_0x721c('0x93')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x1e22f5[_0x721c('0x37')][_0x721c('0x3b')]){_0x433a4f[_0x721c('0x3c')][_0x721c('0x6f')](function(_0x4b5dcc){_0x3329a9[_0x721c('0x44')]('i.'+_0x4b5dcc);});}else{_0x3329a9[_0x721c('0x44')](_0x721c('0x85'),_0x721c('0x5a'));_0x3329a9[_0x721c('0x44')](_0x721c('0x94'),_0x721c('0x95'));_0x3329a9[_0x721c('0x44')](_0x721c('0x96'),'Account.mandatoryDisposition');_0x3329a9['field'](_0x721c('0x97'),_0x721c('0x86'));_0x3329a9[_0x721c('0x44')](_0x721c('0x98'));_0x3329a9[_0x721c('0x44')](_0x721c('0x99'),_0x721c('0x9a'));_0x3329a9[_0x721c('0x44')](_0x721c('0x9b'),_0x721c('0x9c'));_0x3329a9['field'](_0x721c('0x9d'),_0x721c('0x9e'));_0x3329a9[_0x721c('0x44')](_0x721c('0x9f'),_0x721c('0xa0'));_0x3329a9[_0x721c('0x44')]('c.mobile',_0x721c('0xa1'));_0x3329a9['field']('c.fax',_0x721c('0xa2'));_0x3329a9[_0x721c('0x44')](_0x721c('0xa3'),_0x721c('0xa4'));_0x3329a9['field'](_0x721c('0xa5'),'Owner.internal');_0x3329a9[_0x721c('0x44')](_0x721c('0xa6'),_0x721c('0x31'));}if(_0x433a4f['limit'])_0x3329a9[_0x721c('0x1e')](_0x433a4f[_0x721c('0x1e')]);if(_0x433a4f[_0x721c('0x1f')])_0x3329a9[_0x721c('0x1f')](_0x433a4f[_0x721c('0x1f')]);return db[_0x721c('0x90')]['query'](_0x3329a9[_0x721c('0x8f')](),_0x48a158);})['then'](function(_0x1e4339){if(_0x1e4339[_0x721c('0x3d')]>0x0)_0x5a38f8['where']('ui.FaxInteractionId\x20IN\x20?',_[_0x721c('0x2c')](_0x1e4339,'id'));return db[_0x721c('0x90')]['query'](_0x5a38f8[_0x721c('0x8f')](),_0x48a158)['then'](function(_0x16a235){var _0x1a6878=_[_0x721c('0xa7')](_0x16a235,_0x721c('0xa8'));var _0x3d5d33=[];_0x1e4339[_0x721c('0x6f')](function(_0x5cdc70){_0x3d5d33[_0x721c('0x30')](updateFaxInteraction(_0x5cdc70,_0xee04b5,_0x1a6878));});return BPromise[_0x721c('0xa9')](_0x3d5d33);});});})[_0x721c('0x24')](function(_0x22b82e){_0xeded77[_0x721c('0xaa')]=_0x22b82e;return _0xeded77;})[_0x721c('0x24')](respondWithFilteredResult(_0x284193,_0x433a4f))['catch'](handleError(_0x284193,null));};exports['show']=function(_0x52f229,_0x519c76){var _0x230cbd={'raw':![],'where':{'id':_0x52f229['params']['id']}},_0x4b2421={};_0x4b2421[_0x721c('0x36')]=_['keys'](db['FaxInteraction'][_0x721c('0xab')]);_0x4b2421[_0x721c('0x37')]=_[_0x721c('0x38')](_0x52f229[_0x721c('0x37')]);_0x4b2421[_0x721c('0x39')]=_['intersection'](_0x4b2421[_0x721c('0x36')],_0x4b2421[_0x721c('0x37')]);_0x230cbd[_0x721c('0x3c')]=_[_0x721c('0x3a')](_0x4b2421[_0x721c('0x36')],qs[_0x721c('0x3b')](_0x52f229[_0x721c('0x37')][_0x721c('0x3b')]));_0x230cbd['attributes']=_0x230cbd['attributes'][_0x721c('0x3d')]?_0x230cbd[_0x721c('0x3c')]:_0x4b2421[_0x721c('0x36')];if(_0x52f229[_0x721c('0x37')][_0x721c('0xac')]){_0x230cbd[_0x721c('0xad')]=[{'all':!![]}];}_0x230cbd=_[_0x721c('0x92')]({},_0x230cbd,_0x52f229[_0x721c('0xae')]);return db[_0x721c('0x93')]['find'](_0x230cbd)[_0x721c('0x24')](handleEntityNotFound(_0x519c76,null))[_0x721c('0x24')](respondWithResult(_0x519c76,null))['catch'](handleError(_0x519c76,null));};exports[_0x721c('0xaf')]=function(_0xdfd095,_0x28215f){return db['FaxInteraction']['create'](_0xdfd095[_0x721c('0xb0')],{})[_0x721c('0x24')](respondWithResult(_0x28215f,0xc9))[_0x721c('0xb1')](handleError(_0x28215f,null));};exports['update']=function(_0x4b1165,_0x473e89){if(_0x4b1165['body']['id']){delete _0x4b1165[_0x721c('0xb0')]['id'];}return db[_0x721c('0x93')][_0x721c('0x59')]({'where':{'id':_0x4b1165[_0x721c('0xb2')]['id']}})['then'](handleEntityNotFound(_0x473e89,null))['then'](saveUpdates(_0x4b1165[_0x721c('0xb0')],null))[_0x721c('0x24')](respondWithResult(_0x473e89,null))[_0x721c('0xb1')](handleError(_0x473e89,null));};exports['destroy']=function(_0x2f47e1,_0x3e3ff6){return db[_0x721c('0x93')][_0x721c('0x59')]({'where':{'id':_0x2f47e1['params']['id']}})[_0x721c('0x24')](handleEntityNotFound(_0x3e3ff6,null))[_0x721c('0x24')](removeEntity(_0x3e3ff6,null))[_0x721c('0xb1')](handleError(_0x3e3ff6,null));};exports[_0x721c('0xb3')]=function(_0x55a066,_0x9e21b3){return db['FaxInteraction'][_0x721c('0xb3')]()[_0x721c('0x24')](respondWithResult(_0x9e21b3,null))[_0x721c('0xb1')](handleError(_0x9e21b3,null));};exports[_0x721c('0xb4')]=function(_0x48fb9a,_0x20fbd0,_0xcccc11){return db[_0x721c('0xb5')][_0x721c('0x59')]({'where':{'id':_0x48fb9a['params']['id']}})[_0x721c('0x24')](handleEntityNotFound(_0x20fbd0,null))[_0x721c('0x24')](function(_0x140d15){if(_0x140d15){return _0x140d15[_0x721c('0xb4')](_0x48fb9a[_0x721c('0xb0')][_0x721c('0xb6')],_[_0x721c('0xb7')](_0x48fb9a['body'],[_0x721c('0xb6'),'id'])||{});}})[_0x721c('0x24')](respondWithResult(_0x20fbd0,null))[_0x721c('0xb1')](handleError(_0x20fbd0,null));};exports[_0x721c('0xb8')]=function(_0x1cb198,_0x44fcde,_0x20f2e6){var _0x508924={'raw':![],'where':{}};var _0xb2fe1f={};var _0x2f3564={'count':0x0,'rows':[]};return db[_0x721c('0x93')][_0x721c('0xb9')]({'where':{'id':_0x1cb198[_0x721c('0xb2')]['id']}})[_0x721c('0x24')](handleEntityNotFound(_0x44fcde,null))[_0x721c('0x24')](function(_0x35ac52){if(_0x35ac52){_0xb2fe1f[_0x721c('0x36')]=_[_0x721c('0x38')](db[_0x721c('0xb5')][_0x721c('0xab')]);_0xb2fe1f[_0x721c('0x37')]=_['keys'](_0x1cb198[_0x721c('0x37')]);_0xb2fe1f[_0x721c('0x39')]=_[_0x721c('0x3a')](_0xb2fe1f[_0x721c('0x36')],_0xb2fe1f[_0x721c('0x37')]);_0x508924[_0x721c('0x3c')]=_[_0x721c('0x3a')](_0xb2fe1f['model'],qs[_0x721c('0x3b')](_0x1cb198['query'][_0x721c('0x3b')]));_0x508924[_0x721c('0x3c')]=_0x508924['attributes'][_0x721c('0x3d')]?_0x508924['attributes']:_0xb2fe1f[_0x721c('0x36')];if(!_0x1cb198[_0x721c('0x37')]['hasOwnProperty'](_0x721c('0x3e'))){_0x508924[_0x721c('0x1e')]=qs[_0x721c('0x1e')](_0x1cb198[_0x721c('0x37')][_0x721c('0x1e')]);_0x508924[_0x721c('0x1f')]=qs['offset'](_0x1cb198[_0x721c('0x37')][_0x721c('0x1f')]);}_0x508924[_0x721c('0x3f')]=qs['sort'](_0x1cb198[_0x721c('0x37')][_0x721c('0x40')]);_0x508924[_0x721c('0x41')]=qs[_0x721c('0x39')](_[_0x721c('0x42')](_0x1cb198[_0x721c('0x37')],_0xb2fe1f['filters']));_0x508924[_0x721c('0x41')]['FaxInteractionId']=_0x35ac52['id'];if(_0x1cb198[_0x721c('0x37')]['filter']){_0x508924[_0x721c('0x41')]=_[_0x721c('0x92')](_0x508924[_0x721c('0x41')],{'$or':_['map'](_0x508924['attributes'],function(_0x28ba42){var _0x1cb95a={};_0x1cb95a[_0x28ba42]={'$like':'%'+_0x1cb198[_0x721c('0x37')]['filter']+'%'};return _0x1cb95a;})});}if(_0x1cb198[_0x721c('0x37')][_0x721c('0x75')]){var _0x3e92dc=_0x1cb198[_0x721c('0x37')]['$gte']['split'](',');var _0x411a75={};_0x411a75[_0x3e92dc[0x0]]={'$gte':moment(_0x3e92dc[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x508924[_0x721c('0x41')]=_[_0x721c('0x92')](_0x508924['where'],_0x411a75);}_0x508924=_[_0x721c('0x92')]({},_0x508924,_0x1cb198[_0x721c('0xae')]);return db[_0x721c('0xb5')][_0x721c('0x20')]({'where':_0x508924[_0x721c('0x41')]})[_0x721c('0x24')](function(_0x32d2e0){_0x2f3564[_0x721c('0x20')]=_0x32d2e0;if(_0x1cb198[_0x721c('0x37')]['includeAll']){_0x508924['include']=[{'all':!![]}];}return db[_0x721c('0xb5')][_0x721c('0xba')](_0x508924);})[_0x721c('0x24')](function(_0x517050){_0x2f3564[_0x721c('0xaa')]=_0x517050;return _0x2f3564;});}})[_0x721c('0x24')](respondWithFilteredResult(_0x44fcde,_0x508924))[_0x721c('0xb1')](handleError(_0x44fcde,null));};exports[_0x721c('0xbb')]=function(_0x176224,_0x382407,_0x351f3c){return db[_0x721c('0x93')][_0x721c('0x59')]({'where':{'id':_0x176224['params']['id']}})['then'](handleEntityNotFound(_0x382407,null))[_0x721c('0x24')](function(_0x5ee4d0){if(_0x5ee4d0){return _0x5ee4d0[_0x721c('0xbc')](_0x176224[_0x721c('0xb0')][_0x721c('0xb6')],_[_0x721c('0xb7')](_0x176224[_0x721c('0xb0')],['ids','id'])||{})[_0x721c('0xbd')](function(){return db[_0x721c('0x68')][_0x721c('0xba')]({'attributes':['id',_0x721c('0x29'),_0x721c('0x45')],'where':{'id':_0x176224[_0x721c('0xb0')][_0x721c('0xb6')]}});})[_0x721c('0x24')](function(_0x4aba23){socket[_0x721c('0xbe')](_0x721c('0xbf'),{'id':Number(_0x176224[_0x721c('0xb2')]['id']),'tags':_0x4aba23||[]});return{'id':Number(_0x176224[_0x721c('0xb2')]['id']),'tags':_0x4aba23||[]};});}})[_0x721c('0x24')](respondWithResult(_0x382407,null))[_0x721c('0xb1')](handleError(_0x382407,null));};exports[_0x721c('0xc0')]=function(_0x343d31,_0x38b924,_0xf74ca9){return db['FaxInteraction'][_0x721c('0x59')]({'where':{'id':_0x343d31[_0x721c('0xb2')]['id']}})[_0x721c('0x24')](handleEntityNotFound(_0x38b924,null))[_0x721c('0x24')](function(_0x1ce4c6){if(_0x1ce4c6){return _0x1ce4c6[_0x721c('0xc0')](_0x343d31[_0x721c('0x37')]['ids']);}})[_0x721c('0x24')](respondWithStatusCode(_0x38b924,null))[_0x721c('0xb1')](handleError(_0x38b924,null));};exports[_0x721c('0xc1')]=function(_0x58766c,_0x5521e2){var _0x4aa201=moment()[_0x721c('0xc2')]()[_0x721c('0x8f')]();var _0x5565f0=path['join'](config[_0x721c('0xc3')],'server',_0x721c('0xc4'),_0x721c('0xc5'));var _0x25aa17=path[_0x721c('0xc6')](config[_0x721c('0xc3')],_0x721c('0xc7'),_0x721c('0xc4'),_0x721c('0xc8'));var _0x1fe57c=path[_0x721c('0xc6')](_0x5565f0,_0x4aa201);var _0x3151e8=util[_0x721c('0xc9')](_0x721c('0xca'),_0x58766c[_0x721c('0xb2')]['id'],_0x4aa201);var _0x1c0d49=path['join'](_0x5565f0,_0x3151e8);var _0x9e7f8=[];_0x9e7f8[_0x721c('0x30')]({'model':db['Attachment'],'as':_0x721c('0xcb'),'raw':!![]});var _0x113b15=[{'model':db[_0x721c('0xb5')],'as':_0x721c('0xcc'),'attributes':['id',_0x721c('0xb0'),'createdAt'],'include':_0x9e7f8}];return db[_0x721c('0x93')][_0x721c('0x59')]({'where':{'id':_0x58766c[_0x721c('0xb2')]['id']},'include':_0x113b15})[_0x721c('0x24')](handleEntityNotFound(_0x5521e2,null))[_0x721c('0x24')](function(_0x98410){if(_0x98410&&_0x98410[_0x721c('0xcc')]){var _0x260f7d=_0x98410[_0x721c('0xcd')]({'plain':!![]});fs[_0x721c('0xce')](_0x1fe57c);for(var _0x3926b3=0x0;_0x3926b3<_0x260f7d[_0x721c('0xcc')][_0x721c('0x3d')];_0x3926b3++){var _0x4766f4=_0x260f7d[_0x721c('0xcc')][_0x3926b3]['Attachment'];if(_0x4766f4){var _0x5db736=path[_0x721c('0xc6')](_0x25aa17,_0x4766f4['basename']);if(fs[_0x721c('0xcf')](_0x5db736)){fs[_0x721c('0xd0')](_0x5db736)['pipe'](fs['createWriteStream'](path['join'](_0x1fe57c,_0x4766f4['basename'])));}}}return BPromise['resolve']()['then'](function(){return new BPromise(function(_0xe1fff4,_0xbad2e4){zipdir(_0x1fe57c,{'saveTo':_0x1c0d49},function(_0x1e64aa,_0x1fb028){if(_0x1e64aa)return _0xbad2e4(_0x1e64aa);return _0xe1fff4(_0x1fb028);});})[_0x721c('0x24')](function(){return new BPromise(function(_0x192dc7,_0x1ef873){rimraf(_0x1fe57c,function(_0x132866){if(_0x132866)_0x1ef873(_0x132866);return _0x192dc7();});});})[_0x721c('0x24')](function(){return _0x5521e2[_0x721c('0xc1')](_0x1c0d49,_0x3151e8,function(_0x44448a){if(_0x44448a){console[_0x721c('0xd1')](_0x721c('0xd2'),_0x44448a);}else{fs['unlinkSync'](_0x1c0d49);}});});});}else{return _0x5521e2[_0x721c('0xd3')](0xc8);}})[_0x721c('0xb1')](handleError(_0x5521e2,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index f857b12..8ada7df 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 _0x1519=['remove','then','setDataValue','map','findAll','unreadMessages','length','emit','catch','hook','exports','events','../../mysqldb','FaxInteraction','FaxMessage','setMaxListeners','save','update'];(function(_0x1756f3,_0x60f2ce){var _0x2795f1=function(_0x1dbd52){while(--_0x1dbd52){_0x1756f3['push'](_0x1756f3['shift']());}};_0x2795f1(++_0x60f2ce);}(_0x1519,0x1a9));var _0x9151=function(_0x145e04,_0x82a7b3){_0x145e04=_0x145e04-0x0;var _0x531f0d=_0x1519[_0x145e04];return _0x531f0d;};'use strict';var EventEmitter=require(_0x9151('0x0'));var FaxInteraction=require(_0x9151('0x1'))['db'][_0x9151('0x2')];var FaxMessage=require(_0x9151('0x1'))['db'][_0x9151('0x3')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0x9151('0x4')](0x0);var events={'afterCreate':_0x9151('0x5'),'afterUpdate':_0x9151('0x6'),'afterDestroy':_0x9151('0x7')};function emitEvent(_0x3016cf){return function(_0x5400dd,_0x128a9e,_0x373dc0){_0x5400dd['getUsers']({'attributes':['id'],'raw':!![]})[_0x9151('0x8')](function(_0x154efe){_0x5400dd[_0x9151('0x9')]('Users',_0x154efe[_0x9151('0xa')](function(_0x19cc40){return{'id':_0x19cc40['id']};}));return FaxMessage[_0x9151('0xb')]({'where':{'FaxInteractionId':_0x5400dd['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x46196c){_0x5400dd[_0x9151('0x9')](_0x9151('0xc'),_0x46196c[_0x9151('0xd')]);FaxInteractionEvents['emit'](_0x3016cf+':'+_0x5400dd['id'],_0x5400dd);FaxInteractionEvents[_0x9151('0xe')](_0x3016cf,_0x5400dd);_0x373dc0(null);})[_0x9151('0xf')](_0x373dc0(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxInteraction[_0x9151('0x10')](e,emitEvent(event));}}module[_0x9151('0x11')]=FaxInteractionEvents; \ No newline at end of file +var _0xc5d6=['exports','../../mysqldb','FaxInteraction','FaxMessage','save','remove','then','Users','unreadMessages','emit','catch','hasOwnProperty'];(function(_0x34a89b,_0x1f19c0){var _0x57078b=function(_0x423d6b){while(--_0x423d6b){_0x34a89b['push'](_0x34a89b['shift']());}};_0x57078b(++_0x1f19c0);}(_0xc5d6,0x85));var _0x6c5d=function(_0x5f0099,_0x2b8c05){_0x5f0099=_0x5f0099-0x0;var _0x101c76=_0xc5d6[_0x5f0099];return _0x101c76;};'use strict';var EventEmitter=require('events');var FaxInteraction=require(_0x6c5d('0x0'))['db'][_0x6c5d('0x1')];var FaxMessage=require(_0x6c5d('0x0'))['db'][_0x6c5d('0x2')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x6c5d('0x3'),'afterUpdate':'update','afterDestroy':_0x6c5d('0x4')};function emitEvent(_0x52178d){return function(_0x54b9ee,_0x5700b9,_0x230a1c){_0x54b9ee['getUsers']({'attributes':['id'],'raw':!![]})[_0x6c5d('0x5')](function(_0x312772){_0x54b9ee['setDataValue'](_0x6c5d('0x6'),_0x312772['map'](function(_0x52cc4e){return{'id':_0x52cc4e['id']};}));return FaxMessage['findAll']({'where':{'FaxInteractionId':_0x54b9ee['id'],'direction':'in','read':![]},'raw':!![]});})[_0x6c5d('0x5')](function(_0x309fe9){_0x54b9ee['setDataValue'](_0x6c5d('0x7'),_0x309fe9['length']);FaxInteractionEvents[_0x6c5d('0x8')](_0x52178d+':'+_0x54b9ee['id'],_0x54b9ee);FaxInteractionEvents[_0x6c5d('0x8')](_0x52178d,_0x54b9ee);_0x230a1c(null);})[_0x6c5d('0x9')](_0x230a1c(null));};}for(var e in events){if(events[_0x6c5d('0xa')](e)){var event=events[e];FaxInteraction['hook'](e,emitEvent(event));}}module[_0x6c5d('0xb')]=FaxInteractionEvents; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.model.js b/server/api/faxInteraction/faxInteraction.model.js index 65c843c..c1c23cb 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 _0x897e=['fax_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./faxInteraction.attributes','exports','define'];(function(_0x20f32e,_0x17dc84){var _0x395bf9=function(_0x54a448){while(--_0x54a448){_0x20f32e['push'](_0x20f32e['shift']());}};_0x395bf9(++_0x17dc84);}(_0x897e,0x1d6));var _0xe897=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x897e[_0x2641f9];return _0x585741;};'use strict';var _=require(_0xe897('0x0'));var util=require('util');var logger=require(_0xe897('0x1'))('api');var moment=require(_0xe897('0x2'));var BPromise=require(_0xe897('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe897('0x4'));var rimraf=require(_0xe897('0x5'));var config=require(_0xe897('0x6'));var attributes=require(_0xe897('0x7'));module[_0xe897('0x8')]=function(_0x415d0f,_0x3c769b){return _0x415d0f[_0xe897('0x9')]('FaxInteraction',attributes,{'tableName':_0xe897('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x401848,_0x33add6,_0x303190){if(_0x401848[_0xe897('0xb')](_0xe897('0xc'))){_0x401848[_0xe897('0xd')]=moment()[_0xe897('0xe')](_0xe897('0xf'));}_0x303190(null,_0x401848);}}});}; \ No newline at end of file +var _0x5cb4=['FaxInteraction','fax_interactions','changed','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','lodash','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./faxInteraction.attributes','exports','define'];(function(_0x2bfafd,_0x242781){var _0x2e7059=function(_0x5afd19){while(--_0x5afd19){_0x2bfafd['push'](_0x2bfafd['shift']());}};_0x2e7059(++_0x242781);}(_0x5cb4,0xc6));var _0x45cb=function(_0x18f57a,_0x2a23ec){_0x18f57a=_0x18f57a-0x0;var _0x529482=_0x5cb4[_0x18f57a];return _0x529482;};'use strict';var _=require(_0x45cb('0x0'));var util=require('util');var logger=require(_0x45cb('0x1'))('api');var moment=require('moment');var BPromise=require(_0x45cb('0x2'));var rp=require(_0x45cb('0x3'));var fs=require('fs');var path=require(_0x45cb('0x4'));var rimraf=require(_0x45cb('0x5'));var config=require(_0x45cb('0x6'));var attributes=require(_0x45cb('0x7'));module[_0x45cb('0x8')]=function(_0x468f63,_0x2bdbd7){return _0x468f63[_0x45cb('0x9')](_0x45cb('0xa'),attributes,{'tableName':_0x45cb('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x5da4b4,_0x3d8551,_0x46203f){if(_0x5da4b4[_0x45cb('0xc')](_0x45cb('0xd'))){_0x5da4b4[_0x45cb('0xe')]=moment()['format'](_0x45cb('0xf'));}_0x46203f(null,_0x5da4b4);}}});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index 1117a13..ab25df8 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 _0x4cd0=['../../config/utils','../../config/logger','rpc','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./faxInteraction.socket','request','then','info','request\x20sent','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxInteraction,\x20%s,\x20%s','message','result','UpdateFaxInteraction','update','body','options','raw','where','attributes','limit','AddTagsToFaxInteraction','FaxInteraction','find','addTags','omit','AddTags','catch','util','moment','randomstring'];(function(_0x5954d2,_0x15db93){var _0x316928=function(_0x278bd3){while(--_0x278bd3){_0x5954d2['push'](_0x5954d2['shift']());}};_0x316928(++_0x15db93);}(_0x4cd0,0x11c));var _0x04cd=function(_0x8f7850,_0x235a05){_0x8f7850=_0x8f7850-0x0;var _0x2c5bc9=_0x4cd0[_0x8f7850];return _0x2c5bc9;};'use strict';var _=require('lodash');var util=require(_0x04cd('0x0'));var moment=require(_0x04cd('0x1'));var BPromise=require('bluebird');var rs=require(_0x04cd('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x04cd('0x3'));var logger=require(_0x04cd('0x4'))(_0x04cd('0x5'));var config=require('../../config/environment');var jayson=require(_0x04cd('0x6'));var client=jayson[_0x04cd('0x7')][_0x04cd('0x8')]({'port':0x232a});config['redis']=_[_0x04cd('0x9')](config[_0x04cd('0xa')],{'host':_0x04cd('0xb'),'port':0x18eb});var socket=require(_0x04cd('0xc'))(new Redis(config[_0x04cd('0xa')]));require(_0x04cd('0xd'))['register'](socket);function respondWithRpcPromise(_0x48b6b,_0x34e326,_0x1803cc){return new BPromise(function(_0x1c70a8,_0x5c83d1){return client[_0x04cd('0xe')](_0x48b6b,_0x1803cc)[_0x04cd('0xf')](function(_0x7376d0){logger[_0x04cd('0x10')]('FaxInteraction,\x20%s,\x20%s',_0x34e326,_0x04cd('0x11'));logger[_0x04cd('0x12')](_0x04cd('0x13'),_0x34e326,_0x04cd('0x11'),JSON[_0x04cd('0x14')](_0x7376d0));if(_0x7376d0['error']){if(_0x7376d0[_0x04cd('0x15')][_0x04cd('0x16')]===0x1f4){logger[_0x04cd('0x15')](_0x04cd('0x17'),_0x34e326,_0x7376d0[_0x04cd('0x15')][_0x04cd('0x18')]);return _0x5c83d1(_0x7376d0[_0x04cd('0x15')]['message']);}logger[_0x04cd('0x15')](_0x04cd('0x17'),_0x34e326,_0x7376d0[_0x04cd('0x15')][_0x04cd('0x18')]);return _0x1c70a8(_0x7376d0[_0x04cd('0x15')][_0x04cd('0x18')]);}else{logger[_0x04cd('0x10')](_0x04cd('0x17'),_0x34e326,'request\x20sent');_0x1c70a8(_0x7376d0[_0x04cd('0x19')]['message']);}})['catch'](function(_0x321df1){logger[_0x04cd('0x15')](_0x04cd('0x17'),_0x34e326,_0x321df1);_0x5c83d1(_0x321df1);});});}exports[_0x04cd('0x1a')]=function(_0x4949da){var _0xb8fe84=this;return new Promise(function(_0x1854b4,_0x38357c){return db['FaxInteraction'][_0x04cd('0x1b')](_0x4949da[_0x04cd('0x1c')],{'raw':_0x4949da[_0x04cd('0x1d')]?_0x4949da[_0x04cd('0x1d')][_0x04cd('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4949da['options']?_0x4949da['options'][_0x04cd('0x1f')]||null:null,'attributes':_0x4949da[_0x04cd('0x1d')]?_0x4949da[_0x04cd('0x1d')][_0x04cd('0x20')]||null:null,'limit':_0x4949da[_0x04cd('0x1d')]?_0x4949da[_0x04cd('0x1d')][_0x04cd('0x21')]||null:null})[_0x04cd('0xf')](function(_0xcc99c8){logger[_0x04cd('0x10')](_0x04cd('0x1a'),_0x4949da);logger[_0x04cd('0x12')](_0x04cd('0x1a'),_0x4949da,JSON[_0x04cd('0x14')](_0xcc99c8));_0x1854b4(_0xcc99c8);})['catch'](function(_0x4cdf53){logger[_0x04cd('0x15')](_0x04cd('0x1a'),_0x4cdf53['message'],_0x4949da);_0x38357c(_0xb8fe84['error'](0x1f4,_0x4cdf53['message']));});});};exports[_0x04cd('0x22')]=function(_0x4e2566){return new Promise(function(_0x55d944,_0x44bc73){return db[_0x04cd('0x23')][_0x04cd('0x24')]({'where':_0x4e2566['options']?_0x4e2566['options'][_0x04cd('0x1f')]||null:null})[_0x04cd('0xf')](function(_0x5ade72){if(_0x5ade72){return _0x5ade72[_0x04cd('0x25')](_0x4e2566['body']['ids'],_[_0x04cd('0x26')](_0x4e2566[_0x04cd('0x1c')],['ids','id'])||{});}})['spread'](function(_0x11c3d6){logger[_0x04cd('0x10')]('AddTags',_0x4e2566);logger[_0x04cd('0x12')](_0x04cd('0x27'),_0x4e2566,JSON[_0x04cd('0x14')](_0x11c3d6));_0x55d944(_0x11c3d6);})[_0x04cd('0x28')](function(_0x458813){logger[_0x04cd('0x15')]('AddTags',_0x458813[_0x04cd('0x18')],_0x4e2566);_0x44bc73(_this[_0x04cd('0x15')](0x1f4,_0x458813['message']));});});}; \ No newline at end of file +var _0x8b4c=['update','body','options','attributes','debug','find','where','addTags','ids','spread','AddTags','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','register','then','info','FaxInteraction,\x20%s,\x20%s','FaxInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','UpdateFaxInteraction','FaxInteraction'];(function(_0x2806a7,_0x413cd3){var _0x232415=function(_0xd57617){while(--_0xd57617){_0x2806a7['push'](_0x2806a7['shift']());}};_0x232415(++_0x413cd3);}(_0x8b4c,0x187));var _0xc8b4=function(_0x339806,_0xd51dc3){_0x339806=_0x339806-0x0;var _0x5edb3f=_0x8b4c[_0x339806];return _0x5edb3f;};'use strict';var _=require(_0xc8b4('0x0'));var util=require(_0xc8b4('0x1'));var moment=require(_0xc8b4('0x2'));var BPromise=require('bluebird');var rs=require(_0xc8b4('0x3'));var fs=require('fs');var Redis=require(_0xc8b4('0x4'));var db=require(_0xc8b4('0x5'))['db'];var utils=require(_0xc8b4('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xc8b4('0x7'));var jayson=require(_0xc8b4('0x8'));var client=jayson[_0xc8b4('0x9')][_0xc8b4('0xa')]({'port':0x232a});config[_0xc8b4('0xb')]=_[_0xc8b4('0xc')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xc8b4('0xd'))(new Redis(config[_0xc8b4('0xb')]));require('./faxInteraction.socket')[_0xc8b4('0xe')](socket);function respondWithRpcPromise(_0x4379d0,_0x12d3f0,_0x24e82e){return new BPromise(function(_0x297d1f,_0x54e44a){return client['request'](_0x4379d0,_0x24e82e)[_0xc8b4('0xf')](function(_0x1e2311){logger[_0xc8b4('0x10')](_0xc8b4('0x11'),_0x12d3f0,'request\x20sent');logger['debug'](_0xc8b4('0x12'),_0x12d3f0,_0xc8b4('0x13'),JSON[_0xc8b4('0x14')](_0x1e2311));if(_0x1e2311[_0xc8b4('0x15')]){if(_0x1e2311[_0xc8b4('0x15')]['code']===0x1f4){logger[_0xc8b4('0x15')](_0xc8b4('0x11'),_0x12d3f0,_0x1e2311[_0xc8b4('0x15')][_0xc8b4('0x16')]);return _0x54e44a(_0x1e2311['error'][_0xc8b4('0x16')]);}logger[_0xc8b4('0x15')](_0xc8b4('0x11'),_0x12d3f0,_0x1e2311[_0xc8b4('0x15')][_0xc8b4('0x16')]);return _0x297d1f(_0x1e2311[_0xc8b4('0x15')][_0xc8b4('0x16')]);}else{logger[_0xc8b4('0x10')](_0xc8b4('0x11'),_0x12d3f0,_0xc8b4('0x13'));_0x297d1f(_0x1e2311[_0xc8b4('0x17')][_0xc8b4('0x16')]);}})[_0xc8b4('0x18')](function(_0x32f70c){logger['error'](_0xc8b4('0x11'),_0x12d3f0,_0x32f70c);_0x54e44a(_0x32f70c);});});}exports[_0xc8b4('0x19')]=function(_0x44687b){var _0x541d84=this;return new Promise(function(_0xb269e6,_0x6511db){return db[_0xc8b4('0x1a')][_0xc8b4('0x1b')](_0x44687b[_0xc8b4('0x1c')],{'raw':_0x44687b[_0xc8b4('0x1d')]?_0x44687b[_0xc8b4('0x1d')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x44687b[_0xc8b4('0x1d')]?_0x44687b['options']['where']||null:null,'attributes':_0x44687b[_0xc8b4('0x1d')]?_0x44687b[_0xc8b4('0x1d')][_0xc8b4('0x1e')]||null:null,'limit':_0x44687b[_0xc8b4('0x1d')]?_0x44687b[_0xc8b4('0x1d')]['limit']||null:null})[_0xc8b4('0xf')](function(_0x2b01b7){logger[_0xc8b4('0x10')](_0xc8b4('0x19'),_0x44687b);logger[_0xc8b4('0x1f')](_0xc8b4('0x19'),_0x44687b,JSON[_0xc8b4('0x14')](_0x2b01b7));_0xb269e6(_0x2b01b7);})[_0xc8b4('0x18')](function(_0x18e13f){logger['error'](_0xc8b4('0x19'),_0x18e13f[_0xc8b4('0x16')],_0x44687b);_0x6511db(_0x541d84['error'](0x1f4,_0x18e13f['message']));});});};exports['AddTagsToFaxInteraction']=function(_0x11bb8d){return new Promise(function(_0x1a5743,_0x2ab9cb){return db['FaxInteraction'][_0xc8b4('0x20')]({'where':_0x11bb8d['options']?_0x11bb8d[_0xc8b4('0x1d')][_0xc8b4('0x21')]||null:null})[_0xc8b4('0xf')](function(_0x4d3e27){if(_0x4d3e27){return _0x4d3e27[_0xc8b4('0x22')](_0x11bb8d[_0xc8b4('0x1c')][_0xc8b4('0x23')],_['omit'](_0x11bb8d['body'],[_0xc8b4('0x23'),'id'])||{});}})[_0xc8b4('0x24')](function(_0x11eb53){logger[_0xc8b4('0x10')]('AddTags',_0x11bb8d);logger[_0xc8b4('0x1f')]('AddTags',_0x11bb8d,JSON[_0xc8b4('0x14')](_0x11eb53));_0x1a5743(_0x11eb53);})[_0xc8b4('0x18')](function(_0x2155b9){logger[_0xc8b4('0x15')](_0xc8b4('0x25'),_0x2155b9['message'],_0x11bb8d);_0x2ab9cb(_this[_0xc8b4('0x15')](0x1f4,_0x2155b9[_0xc8b4('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index 626ba09..eb7e530 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 _0x107f=['emit','register','faxInteraction:','./faxInteraction.events','save','remove'];(function(_0xa8fe9d,_0x147a47){var _0x595f32=function(_0x150343){while(--_0x150343){_0xa8fe9d['push'](_0xa8fe9d['shift']());}};_0x595f32(++_0x147a47);}(_0x107f,0x1bf));var _0xf107=function(_0x3a6642,_0x217c49){_0x3a6642=_0x3a6642-0x0;var _0x2a4f0c=_0x107f[_0x3a6642];return _0x2a4f0c;};'use strict';var FaxInteractionEvents=require(_0xf107('0x0'));var events=[_0xf107('0x1'),_0xf107('0x2'),'update'];function createListener(_0x2611a0,_0x160b1f){return function(_0xcb7fe9){_0x160b1f[_0xf107('0x3')](_0x2611a0,_0xcb7fe9);};}function removeListener(_0x2b476d,_0x1c21eb){return function(){FaxInteractionEvents['removeListener'](_0x2b476d,_0x1c21eb);};}exports[_0xf107('0x4')]=function(_0x41c82a){for(var _0x13a3f1=0x0,_0x4e1843=events['length'];_0x13a3f1<_0x4e1843;_0x13a3f1++){var _0x4a9b00=events[_0x13a3f1];var _0x29387d=createListener(_0xf107('0x5')+_0x4a9b00,_0x41c82a);FaxInteractionEvents['on'](_0x4a9b00,_0x29387d);}}; \ No newline at end of file +var _0x112a=['emit','removeListener','register','remove','update'];(function(_0x3ba79c,_0x1547d2){var _0xd2d1a4=function(_0x429fd1){while(--_0x429fd1){_0x3ba79c['push'](_0x3ba79c['shift']());}};_0xd2d1a4(++_0x1547d2);}(_0x112a,0x67));var _0xa112=function(_0x37d8bd,_0xee1d87){_0x37d8bd=_0x37d8bd-0x0;var _0x426b73=_0x112a[_0x37d8bd];return _0x426b73;};'use strict';var FaxInteractionEvents=require('./faxInteraction.events');var events=['save',_0xa112('0x0'),_0xa112('0x1')];function createListener(_0x34a650,_0x11261d){return function(_0x492f0b){_0x11261d[_0xa112('0x2')](_0x34a650,_0x492f0b);};}function removeListener(_0x2fb692,_0x5d8397){return function(){FaxInteractionEvents[_0xa112('0x3')](_0x2fb692,_0x5d8397);};}exports[_0xa112('0x4')]=function(_0x3ecd88){for(var _0x728ec4=0x0,_0x371efe=events['length'];_0x728ec4<_0x371efe;_0x728ec4++){var _0x219d9b=events[_0x728ec4];var _0x5a8617=createListener('faxInteraction:'+_0x219d9b,_0x3ecd88);FaxInteractionEvents['on'](_0x219d9b,_0x5a8617);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index 1b4dc17..b2c3bb8 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 _0xd1d6=['/describe','describe','/:id','show','/:id/messages','getMessages','/:id/download','download','create','post','faxinteraction:addtags','addTags','put','tracked','fax','faxinteraction:update','update','faxinteraction:destroy','destroy','/:id/tags','exports','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxInteraction.controller','get','isAuthenticated'];(function(_0x1b04ec,_0x1df13d){var _0xae7265=function(_0x290d83){while(--_0x290d83){_0x1b04ec['push'](_0x1b04ec['shift']());}};_0xae7265(++_0x1df13d);}(_0xd1d6,0x1c7));var _0x6d1d=function(_0x421826,_0x447ef2){_0x421826=_0x421826-0x0;var _0x584192=_0xd1d6[_0x421826];return _0x584192;};'use strict';var multer=require('multer');var util=require(_0x6d1d('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x6d1d('0x1'));var router=express[_0x6d1d('0x2')]();var fs_extra=require(_0x6d1d('0x3'));var auth=require(_0x6d1d('0x4'));var interaction=require(_0x6d1d('0x5'));var config=require(_0x6d1d('0x6'));var controller=require(_0x6d1d('0x7'));router[_0x6d1d('0x8')]('/',auth[_0x6d1d('0x9')](),controller['index']);router[_0x6d1d('0x8')](_0x6d1d('0xa'),auth[_0x6d1d('0x9')](),controller[_0x6d1d('0xb')]);router[_0x6d1d('0x8')](_0x6d1d('0xc'),auth[_0x6d1d('0x9')](),controller[_0x6d1d('0xd')]);router['get'](_0x6d1d('0xe'),auth[_0x6d1d('0x9')](),controller[_0x6d1d('0xf')]);router[_0x6d1d('0x8')](_0x6d1d('0x10'),auth[_0x6d1d('0x9')](),controller[_0x6d1d('0x11')]);router['post']('/',auth[_0x6d1d('0x9')](),controller[_0x6d1d('0x12')]);router['post'](_0x6d1d('0xe'),auth[_0x6d1d('0x9')](),controller['addMessage']);router[_0x6d1d('0x13')]('/:id/tags',auth[_0x6d1d('0x9')](),interaction['tracked']('fax',_0x6d1d('0x14')),controller[_0x6d1d('0x15')]);router[_0x6d1d('0x16')](_0x6d1d('0xc'),auth['isAuthenticated'](),interaction[_0x6d1d('0x17')](_0x6d1d('0x18'),_0x6d1d('0x19')),controller[_0x6d1d('0x1a')]);router['delete'](_0x6d1d('0xc'),auth[_0x6d1d('0x9')](),interaction[_0x6d1d('0x17')](_0x6d1d('0x18'),_0x6d1d('0x1b')),controller[_0x6d1d('0x1c')]);router['delete'](_0x6d1d('0x1d'),auth[_0x6d1d('0x9')](),controller['removeTags']);module[_0x6d1d('0x1e')]=router; \ No newline at end of file +var _0x0d6a=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxInteraction.controller','get','isAuthenticated','/describe','describe','/:id/download','download','post','/:id/messages','/:id/tags','tracked','fax','faxinteraction:addtags','addTags','faxinteraction:update','update','delete','/:id','faxinteraction:destroy','exports','multer','util'];(function(_0x1cf2da,_0x41e8cd){var _0x59108c=function(_0x43735a){while(--_0x43735a){_0x1cf2da['push'](_0x1cf2da['shift']());}};_0x59108c(++_0x41e8cd);}(_0x0d6a,0xc9));var _0xa0d6=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x0d6a[_0x502c7d];return _0x30b7ed;};'use strict';var multer=require(_0xa0d6('0x0'));var util=require(_0xa0d6('0x1'));var path=require('path');var timeout=require(_0xa0d6('0x2'));var express=require(_0xa0d6('0x3'));var router=express[_0xa0d6('0x4')]();var fs_extra=require(_0xa0d6('0x5'));var auth=require(_0xa0d6('0x6'));var interaction=require(_0xa0d6('0x7'));var config=require(_0xa0d6('0x8'));var controller=require(_0xa0d6('0x9'));router[_0xa0d6('0xa')]('/',auth[_0xa0d6('0xb')](),controller['index']);router[_0xa0d6('0xa')](_0xa0d6('0xc'),auth[_0xa0d6('0xb')](),controller[_0xa0d6('0xd')]);router[_0xa0d6('0xa')]('/:id',auth[_0xa0d6('0xb')](),controller['show']);router[_0xa0d6('0xa')]('/:id/messages',auth[_0xa0d6('0xb')](),controller['getMessages']);router[_0xa0d6('0xa')](_0xa0d6('0xe'),auth[_0xa0d6('0xb')](),controller[_0xa0d6('0xf')]);router[_0xa0d6('0x10')]('/',auth[_0xa0d6('0xb')](),controller['create']);router[_0xa0d6('0x10')](_0xa0d6('0x11'),auth[_0xa0d6('0xb')](),controller['addMessage']);router[_0xa0d6('0x10')](_0xa0d6('0x12'),auth[_0xa0d6('0xb')](),interaction[_0xa0d6('0x13')](_0xa0d6('0x14'),_0xa0d6('0x15')),controller[_0xa0d6('0x16')]);router['put']('/:id',auth[_0xa0d6('0xb')](),interaction[_0xa0d6('0x13')](_0xa0d6('0x14'),_0xa0d6('0x17')),controller[_0xa0d6('0x18')]);router[_0xa0d6('0x19')](_0xa0d6('0x1a'),auth['isAuthenticated'](),interaction[_0xa0d6('0x13')](_0xa0d6('0x14'),_0xa0d6('0x1b')),controller['destroy']);router[_0xa0d6('0x19')]('/:id/tags',auth[_0xa0d6('0xb')](),controller['removeTags']);module[_0xa0d6('0x1c')]=router; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.attributes.js b/server/api/faxMessage/faxMessage.attributes.js index 2e6ab21..4fb2e50 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 _0xd6d6=['DATE','sequelize','exports','TEXT','medium','ENUM','out'];(function(_0x18ae6d,_0x255d00){var _0x3deb94=function(_0x44b04c){while(--_0x44b04c){_0x18ae6d['push'](_0x18ae6d['shift']());}};_0x3deb94(++_0x255d00);}(_0xd6d6,0xbe));var _0x6d6d=function(_0x5aae69,_0x67da18){_0x5aae69=_0x5aae69-0x0;var _0x254f5c=_0xd6d6[_0x5aae69];return _0x254f5c;};'use strict';var Sequelize=require(_0x6d6d('0x0'));module[_0x6d6d('0x1')]={'body':{'type':Sequelize[_0x6d6d('0x2')](_0x6d6d('0x3')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x6d6d('0x4')]('in',_0x6d6d('0x5')),'defaultValue':_0x6d6d('0x5'),'allowNull':![]},'failMessage':{'type':Sequelize[_0x6d6d('0x2')],'defaultValue':null},'readAt':{'type':Sequelize[_0x6d6d('0x6')]}}; \ No newline at end of file +var _0xb49a=['exports','TEXT','medium','BOOLEAN','out','sequelize'];(function(_0x4e43fd,_0xceae2d){var _0xc71aad=function(_0x594093){while(--_0x594093){_0x4e43fd['push'](_0x4e43fd['shift']());}};_0xc71aad(++_0xceae2d);}(_0xb49a,0xfb));var _0xab49=function(_0x5e570c,_0x233990){_0x5e570c=_0x5e570c-0x0;var _0xc62527=_0xb49a[_0x5e570c];return _0xc62527;};'use strict';var Sequelize=require(_0xab49('0x0'));module[_0xab49('0x1')]={'body':{'type':Sequelize[_0xab49('0x2')](_0xab49('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xab49('0x4')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0xab49('0x5')),'defaultValue':_0xab49('0x5'),'allowNull':![]},'failMessage':{'type':Sequelize['TEXT'],'defaultValue':null},'readAt':{'type':Sequelize['DATE']}}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.controller.js b/server/api/faxMessage/faxMessage.controller.js index 1b33f46..32046dd 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 _0x43f3=['attachments','basename','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./faxMessage.socket','register','jayson/promise','client','http','request','then','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','reject','save','update','destroy','stack','name','send','index','map','FaxMessage','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','include','findAll','show','params','includeAll','options','find','body','describe','accept','fax','read','readAt','YYYY-MM-DD\x20HH:mm:ss','agent','UserId','get','FaxInteraction','FaxInteractionId','isNil','read1stAt','format','interaction','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','stringify','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','fullname','internal','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','fax-interactions','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','RejectMessage','rejectMessage','User','email','rejectmessage','create','CmContact','findOne','Attachment','AttachmentId','SendFax','/var/opt/motion2/server/files/attachments/%s','download','join','root','files'];(function(_0x390a19,_0x5dd137){var _0x5d8230=function(_0x2e6234){while(--_0x2e6234){_0x390a19['push'](_0x390a19['shift']());}};_0x5d8230(++_0x5dd137);}(_0x43f3,0x1b2));var _0x343f=function(_0x67f95e,_0x3ca797){_0x67f95e=_0x67f95e-0x0;var _0x538f5a=_0x43f3[_0x67f95e];return _0x538f5a;};'use strict';var emlformat=require(_0x343f('0x0'));var rimraf=require(_0x343f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x343f('0x2'));var rp=require('request-promise');var moment=require(_0x343f('0x3'));var BPromise=require(_0x343f('0x4'));var Mustache=require(_0x343f('0x5'));var util=require(_0x343f('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x343f('0x7'));var ejs=require(_0x343f('0x8'));var fs=require('fs');var fs_extra=require(_0x343f('0x9'));var _=require(_0x343f('0xa'));var squel=require(_0x343f('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x343f('0xc'));var toCsv=require(_0x343f('0x7'));var querystring=require(_0x343f('0xd'));var Papa=require(_0x343f('0xe'));var Redis=require(_0x343f('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x343f('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x343f('0x11'));var logger=require(_0x343f('0x12'))(_0x343f('0x13'));var utils=require(_0x343f('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x343f('0x15'));var db=require(_0x343f('0x16'))['db'];config[_0x343f('0x17')]=_[_0x343f('0x18')](config[_0x343f('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0x343f('0x19'))(new Redis(config['redis']));require(_0x343f('0x1a'))[_0x343f('0x1b')](socket);var jayson=require(_0x343f('0x1c'));var client=jayson[_0x343f('0x1d')][_0x343f('0x1e')]({'port':0x232c});var client9002=jayson[_0x343f('0x1d')][_0x343f('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x3b6d3e,_0x555ef5,_0x125d00,_0x253fe8){return new BPromise(function(_0x57437d,_0x3417cf){var _0x58b031=_0x253fe8||client;return _0x58b031[_0x343f('0x1f')](_0x3b6d3e,_0x125d00)[_0x343f('0x20')](function(_0x242bc2){logger['info'](_0x343f('0x21'),_0x555ef5,_0x343f('0x22'));logger[_0x343f('0x23')]('FaxMessage,\x20%s,\x20%s,\x20%s',_0x555ef5,_0x343f('0x22'),JSON['stringify'](_0x242bc2));if(_0x242bc2[_0x343f('0x24')]){if(_0x242bc2[_0x343f('0x24')][_0x343f('0x25')]===0x1f4){logger[_0x343f('0x24')]('FaxMessage,\x20%s,\x20%s',_0x555ef5,_0x242bc2['error']['message']);return _0x3417cf(_0x242bc2['error'][_0x343f('0x26')]);}logger[_0x343f('0x24')]('FaxMessage,\x20%s,\x20%s',_0x555ef5,_0x242bc2['error']['message']);return _0x57437d(_0x242bc2[_0x343f('0x24')][_0x343f('0x26')]);}else{logger[_0x343f('0x27')](_0x343f('0x21'),_0x555ef5,_0x343f('0x22'));_0x57437d(_0x242bc2['result'][_0x343f('0x26')]);}})[_0x343f('0x28')](function(_0x50bf13){logger[_0x343f('0x24')]('FaxMessage,\x20%s,\x20%s',_0x555ef5,_0x50bf13);_0x3417cf(_0x50bf13);});});}function respondWithStatusCode(_0x4665e8,_0x38a203){_0x38a203=_0x38a203||0xcc;return function(_0x568fed){if(_0x568fed){return _0x4665e8[_0x343f('0x29')](_0x38a203);}return _0x4665e8[_0x343f('0x2a')](_0x38a203)[_0x343f('0x2b')]();};}function respondWithResult(_0x33340d,_0x1b455a){_0x1b455a=_0x1b455a||0xc8;return function(_0x1be320){if(_0x1be320){return _0x33340d['status'](_0x1b455a)[_0x343f('0x2c')](_0x1be320);}};}function respondWithFilteredResult(_0x176c78,_0x201da4){return function(_0x457296){if(_0x457296){var _0x2c3ed9=typeof _0x201da4[_0x343f('0x2d')]===_0x343f('0x2e')&&typeof _0x201da4[_0x343f('0x2f')]===_0x343f('0x2e');var _0x1a57cc=_0x457296[_0x343f('0x30')];var _0x3f594d=_0x2c3ed9?0x0:_0x201da4[_0x343f('0x2d')];var _0x2652d1=_0x2c3ed9?_0x457296['count']:_0x201da4[_0x343f('0x2d')]+_0x201da4[_0x343f('0x2f')];var _0x19906e;if(_0x2652d1>=_0x1a57cc){_0x2652d1=_0x1a57cc;_0x19906e=0xc8;}else{_0x19906e=0xce;}_0x176c78[_0x343f('0x2a')](_0x19906e);return _0x176c78[_0x343f('0x31')]('Content-Range',_0x3f594d+'-'+_0x2652d1+'/'+_0x1a57cc)[_0x343f('0x2c')](_0x457296);}return null;};}function patchUpdates(_0x5f0453){return function(_0x488748){try{jsonpatch['apply'](_0x488748,_0x5f0453,!![]);}catch(_0x3b2e62){return BPromise[_0x343f('0x32')](_0x3b2e62);}return _0x488748[_0x343f('0x33')]();};}function saveUpdates(_0x155645,_0x5a8b7f){return function(_0x5f3998){if(_0x5f3998){return _0x5f3998[_0x343f('0x34')](_0x155645)['then'](function(_0x2d4e3a){return _0x2d4e3a;});}return null;};}function removeEntity(_0x28e793,_0x47e6ca){return function(_0x3b616b){if(_0x3b616b){return _0x3b616b[_0x343f('0x35')]()['then'](function(){_0x28e793[_0x343f('0x2a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x16d58d,_0x3e08d2){return function(_0x523a9a){if(!_0x523a9a){_0x16d58d[_0x343f('0x29')](0x194);}return _0x523a9a;};}function handleError(_0x1ef511,_0x3a4252){_0x3a4252=_0x3a4252||0x1f4;return function(_0x51d255){logger[_0x343f('0x24')](_0x51d255[_0x343f('0x36')]);if(_0x51d255['name']){delete _0x51d255[_0x343f('0x37')];}_0x1ef511[_0x343f('0x2a')](_0x3a4252)[_0x343f('0x38')](_0x51d255);};}exports[_0x343f('0x39')]=function(_0x4e7b75,_0x46a516){var _0x110dd5={},_0x304c7d={},_0x10ff15={'count':0x0,'rows':[]};var _0x137fa6=_[_0x343f('0x3a')](db[_0x343f('0x3b')][_0x343f('0x3c')],function(_0x110360){return{'name':_0x110360[_0x343f('0x3d')],'type':_0x110360[_0x343f('0x3e')][_0x343f('0x3f')]};});_0x304c7d[_0x343f('0x40')]=_[_0x343f('0x3a')](_0x137fa6,_0x343f('0x37'));_0x304c7d[_0x343f('0x41')]=_[_0x343f('0x42')](_0x4e7b75[_0x343f('0x41')]);_0x304c7d[_0x343f('0x43')]=_[_0x343f('0x44')](_0x304c7d['model'],_0x304c7d[_0x343f('0x41')]);_0x110dd5['attributes']=_['intersection'](_0x304c7d[_0x343f('0x40')],qs['fields'](_0x4e7b75[_0x343f('0x41')][_0x343f('0x45')]));_0x110dd5[_0x343f('0x46')]=_0x110dd5[_0x343f('0x46')]['length']?_0x110dd5[_0x343f('0x46')]:_0x304c7d[_0x343f('0x40')];if(!_0x4e7b75['query'][_0x343f('0x47')](_0x343f('0x48'))){_0x110dd5[_0x343f('0x2f')]=qs['limit'](_0x4e7b75['query']['limit']);_0x110dd5[_0x343f('0x2d')]=qs[_0x343f('0x2d')](_0x4e7b75[_0x343f('0x41')][_0x343f('0x2d')]);}_0x110dd5['order']=qs[_0x343f('0x49')](_0x4e7b75[_0x343f('0x41')]['sort']);_0x110dd5[_0x343f('0x4a')]=qs[_0x343f('0x43')](_['pick'](_0x4e7b75['query'],_0x304c7d['filters']),_0x137fa6);if(_0x4e7b75[_0x343f('0x41')][_0x343f('0x4b')]){_0x110dd5[_0x343f('0x4a')]=_[_0x343f('0x4c')](_0x110dd5[_0x343f('0x4a')],{'$or':_[_0x343f('0x3a')](_0x137fa6,function(_0x1153df){if(_0x1153df[_0x343f('0x3e')]!==_0x343f('0x4d')){var _0x4e3583={};_0x4e3583[_0x1153df['name']]={'$like':'%'+_0x4e7b75[_0x343f('0x41')][_0x343f('0x4b')]+'%'};return _0x4e3583;}})});}_0x110dd5=_[_0x343f('0x4c')]({},_0x110dd5,_0x4e7b75['options']);var _0x16a21c={'where':_0x110dd5['where']};return db['FaxMessage']['count'](_0x16a21c)['then'](function(_0x125d9f){_0x10ff15[_0x343f('0x30')]=_0x125d9f;if(_0x4e7b75['query']['includeAll']){_0x110dd5[_0x343f('0x4e')]=[{'all':!![]}];}return db['FaxMessage'][_0x343f('0x4f')](_0x110dd5);})[_0x343f('0x20')](function(_0x4ff004){_0x10ff15['rows']=_0x4ff004;return _0x10ff15;})[_0x343f('0x20')](respondWithFilteredResult(_0x46a516,_0x110dd5))['catch'](handleError(_0x46a516,null));};exports[_0x343f('0x50')]=function(_0x3ee71a,_0x2d6099){var _0x5f3a3a={'raw':!![],'where':{'id':_0x3ee71a[_0x343f('0x51')]['id']}},_0x42995a={};_0x42995a[_0x343f('0x40')]=_['keys'](db['FaxMessage'][_0x343f('0x3c')]);_0x42995a[_0x343f('0x41')]=_['keys'](_0x3ee71a[_0x343f('0x41')]);_0x42995a[_0x343f('0x43')]=_[_0x343f('0x44')](_0x42995a[_0x343f('0x40')],_0x42995a['query']);_0x5f3a3a[_0x343f('0x46')]=_[_0x343f('0x44')](_0x42995a[_0x343f('0x40')],qs[_0x343f('0x45')](_0x3ee71a[_0x343f('0x41')][_0x343f('0x45')]));_0x5f3a3a[_0x343f('0x46')]=_0x5f3a3a[_0x343f('0x46')]['length']?_0x5f3a3a[_0x343f('0x46')]:_0x42995a[_0x343f('0x40')];if(_0x3ee71a['query'][_0x343f('0x52')]){_0x5f3a3a[_0x343f('0x4e')]=[{'all':!![]}];}_0x5f3a3a=_['merge']({},_0x5f3a3a,_0x3ee71a[_0x343f('0x53')]);return db[_0x343f('0x3b')][_0x343f('0x54')](_0x5f3a3a)['then'](handleEntityNotFound(_0x2d6099,null))['then'](respondWithResult(_0x2d6099,null))[_0x343f('0x28')](handleError(_0x2d6099,null));};exports[_0x343f('0x34')]=function(_0x1e10aa,_0x29ef76){if(_0x1e10aa[_0x343f('0x55')]['id']){delete _0x1e10aa['body']['id'];}return db['FaxMessage'][_0x343f('0x54')]({'where':{'id':_0x1e10aa[_0x343f('0x51')]['id']}})[_0x343f('0x20')](handleEntityNotFound(_0x29ef76,null))[_0x343f('0x20')](saveUpdates(_0x1e10aa['body'],null))['then'](respondWithResult(_0x29ef76,null))['catch'](handleError(_0x29ef76,null));};exports[_0x343f('0x35')]=function(_0x4bcda0,_0x4d3153){return db['FaxMessage']['find']({'where':{'id':_0x4bcda0['params']['id']}})[_0x343f('0x20')](handleEntityNotFound(_0x4d3153,null))[_0x343f('0x20')](removeEntity(_0x4d3153,null))[_0x343f('0x28')](handleError(_0x4d3153,null));};exports[_0x343f('0x56')]=function(_0x57d5bf,_0x3d238b){return db[_0x343f('0x3b')][_0x343f('0x56')]()[_0x343f('0x20')](respondWithResult(_0x3d238b,null))[_0x343f('0x28')](handleError(_0x3d238b,null));};var interaction_log=require(_0x343f('0x12'))('fax-interactions');exports[_0x343f('0x57')]=function(_0x2f8dc8,_0x40c81f,_0x222c3f){var _0x43749d={'agent':{},'channel':_0x343f('0x58')};if(_0x2f8dc8[_0x343f('0x55')]['id']){delete _0x2f8dc8[_0x343f('0x55')]['id'];}_0x2f8dc8[_0x343f('0x55')][_0x343f('0x59')]=!![];_0x2f8dc8[_0x343f('0x55')][_0x343f('0x5a')]=moment()['format'](_0x343f('0x5b'));_0x2f8dc8['body']['UserId']=_0x2f8dc8[_0x343f('0x55')]['UserId']||_0x2f8dc8['user']['id'];_0x43749d[_0x343f('0x5c')]['id']=_0x2f8dc8[_0x343f('0x55')][_0x343f('0x5d')];return db['FaxMessage'][_0x343f('0x54')]({'where':{'id':_0x2f8dc8[_0x343f('0x51')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x40c81f,null))[_0x343f('0x20')](saveUpdates(_0x2f8dc8['body'],null))[_0x343f('0x20')](function(_0x4f9f72){if(_0x4f9f72){_0x43749d[_0x343f('0x26')]=_0x4f9f72[_0x343f('0x5e')]({'plain':!![]});return db[_0x343f('0x5f')][_0x343f('0x54')]({'where':{'id':_0x4f9f72[_0x343f('0x60')]}});}return null;})[_0x343f('0x20')](handleEntityNotFound(_0x40c81f,null))[_0x343f('0x20')](function(_0x95a3f4){if(_0x95a3f4){return _0x95a3f4[_0x343f('0x34')]({'UserId':_0x2f8dc8['body'][_0x343f('0x5d')],'read1stAt':_[_0x343f('0x61')](_0x95a3f4[_0x343f('0x62')])?moment()[_0x343f('0x63')](_0x343f('0x5b')):undefined});}return null;})[_0x343f('0x20')](function(_0x2d98d2){if(_0x2d98d2){_0x43749d[_0x343f('0x64')]=_0x2d98d2[_0x343f('0x5e')]({'plain':!![]});interaction_log[_0x343f('0x27')](_0x343f('0x65'),_0x2f8dc8[_0x343f('0x66')]['id'],_0x2f8dc8[_0x343f('0x66')][_0x343f('0x37')],_0x2f8dc8[_0x343f('0x66')][_0x343f('0x67')],_0x43749d[_0x343f('0x64')]['id'],_0x2f8dc8['body']?JSON[_0x343f('0x68')](_0x2f8dc8[_0x343f('0x55')]):'null');return respondWithRpcPromise(_0x343f('0x69'),'acceptMessage',_0x43749d);}return null;})[_0x343f('0x20')](function(_0x125754){var _0x25571f=_0x343f('0x6a')+_0x125754['message'][_0x343f('0x6b')];return db[_0x343f('0x6c')][_0x343f('0x41')](_0x25571f,{'type':db[_0x343f('0x6d')][_0x343f('0x6e')][_0x343f('0x6f')],'raw':!![]})['then'](function(_0xd73b9d){return _0xd73b9d;});})['then'](function(_0x2517b8){if(_0x2517b8){_0x43749d['message'][_0x343f('0x70')]=_0x2517b8[0x0];if(!_0x2f8dc8[_0x343f('0x55')]['UserId'])return;return db['User'][_0x343f('0x54')]({'where':{'id':_0x2f8dc8[_0x343f('0x55')][_0x343f('0x5d')],'role':_0x343f('0x5c')},'attributes':['id','name',_0x343f('0x71'),'email',_0x343f('0x72')],'raw':!![]});}return null;})[_0x343f('0x20')](function(_0x435609){if(!_0x435609)return null;_0x43749d[_0x343f('0x26')]['agent']=_0x435609;return _0x43749d;})[_0x343f('0x20')](function(_0x1fc117){if(_0x1fc117){if(_0x2f8dc8[_0x343f('0x55')][_0x343f('0x73')]){_0x43749d[_0x343f('0x26')][_0x343f('0x74')]=util[_0x343f('0x63')](_0x343f('0x75'),_0x2f8dc8[_0x343f('0x66')][_0x343f('0x37')]);_0x43749d[_0x343f('0x26')][_0x343f('0x76')]=_0x43749d[_0x343f('0x76')];_0x43749d[_0x343f('0x26')][_0x343f('0x77')]=_0x43749d[_0x343f('0x76')];_0x43749d[_0x343f('0x26')][_0x343f('0x78')]=_0x343f('0x57');return respondWithRpcPromise(_0x343f('0x79'),_0x343f('0x79'),{'event':_0x343f('0x7a'),'message':_0x43749d[_0x343f('0x26')]},client9002)[_0x343f('0x20')](function(){return _0x43749d;});}return _0x43749d;}return null;})[_0x343f('0x20')](respondWithResult(_0x40c81f,null))['catch'](handleError(_0x40c81f,null));};var interaction_log=require(_0x343f('0x12'))(_0x343f('0x7b'));exports[_0x343f('0x32')]=function(_0x35949f,_0x40c947,_0x24a24f){var _0x2961ca={'agent':{},'channel':'fax'};if(_0x35949f[_0x343f('0x55')]['id']){delete _0x35949f[_0x343f('0x55')]['id'];}_0x35949f['body'][_0x343f('0x5d')]=_0x35949f[_0x343f('0x55')][_0x343f('0x5d')]||_0x35949f[_0x343f('0x66')]['id'];_0x2961ca['agent']['id']=_0x35949f[_0x343f('0x55')][_0x343f('0x5d')];return db[_0x343f('0x3b')][_0x343f('0x54')]({'where':{'id':_0x35949f[_0x343f('0x51')]['id'],'UserId':null}})[_0x343f('0x20')](handleEntityNotFound(_0x40c947,null))['then'](function(_0x505e5b){if(_0x505e5b){_0x2961ca[_0x343f('0x26')]=_0x505e5b['get']({'plain':!![]});return db[_0x343f('0x5f')][_0x343f('0x54')]({'where':{'id':_0x505e5b['FaxInteractionId']}});}return null;})[_0x343f('0x20')](handleEntityNotFound(_0x40c947,null))[_0x343f('0x20')](function(_0x509e30){if(_0x509e30){_0x2961ca[_0x343f('0x64')]=_0x509e30[_0x343f('0x5e')]({'plain':!![]});interaction_log['info'](_0x343f('0x7c'),_0x35949f['user']['id'],_0x35949f[_0x343f('0x66')][_0x343f('0x37')],_0x35949f[_0x343f('0x66')][_0x343f('0x67')],_0x2961ca['interaction']['id'],_0x35949f[_0x343f('0x55')]?JSON[_0x343f('0x68')](_0x35949f['body']):_0x343f('0x7d'));return respondWithRpcPromise(_0x343f('0x7e'),_0x343f('0x7f'),_0x2961ca);}return null;})[_0x343f('0x20')](function(_0x4afcf4){var _0x374ab6='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x4afcf4[_0x343f('0x26')][_0x343f('0x6b')];return db[_0x343f('0x6c')][_0x343f('0x41')](_0x374ab6,{'type':db['Sequelize'][_0x343f('0x6e')][_0x343f('0x6f')],'raw':!![]})[_0x343f('0x20')](function(_0x306bfd){return _0x306bfd;});})[_0x343f('0x20')](function(_0x22c016){if(_0x22c016){_0x2961ca[_0x343f('0x26')][_0x343f('0x70')]=_0x22c016[0x0];if(!_0x35949f[_0x343f('0x55')][_0x343f('0x5d')])return;return db[_0x343f('0x80')][_0x343f('0x54')]({'where':{'id':_0x35949f[_0x343f('0x55')][_0x343f('0x5d')],'role':_0x343f('0x5c')},'attributes':['id',_0x343f('0x37'),'fullname',_0x343f('0x81'),'internal'],'raw':!![]});}return null;})[_0x343f('0x20')](function(_0x3ea8f3){if(!_0x3ea8f3)return null;_0x2961ca[_0x343f('0x26')][_0x343f('0x5c')]=_0x3ea8f3;return _0x2961ca;})[_0x343f('0x20')](function(_0x8acf3){if(_0x8acf3){_0x8acf3['message'][_0x343f('0x74')]=util[_0x343f('0x63')]('SIP/%s',_0x35949f[_0x343f('0x66')][_0x343f('0x37')]);_0x8acf3[_0x343f('0x26')]['channel']=_0x2961ca[_0x343f('0x76')];_0x8acf3[_0x343f('0x26')]['motionChannel']=_0x2961ca[_0x343f('0x76')];_0x8acf3[_0x343f('0x26')][_0x343f('0x78')]=_0x343f('0x32');respondWithRpcPromise(_0x343f('0x79'),_0x343f('0x79'),{'event':_0x343f('0x82'),'message':_0x8acf3[_0x343f('0x26')]},client9002);return _0x2961ca;}return null;})[_0x343f('0x20')](respondWithResult(_0x40c947,null))['catch'](handleError(_0x40c947,null));};exports[_0x343f('0x83')]=function(_0x2d8fbc,_0x29df17){var _0x22b553;return db[_0x343f('0x3b')][_0x343f('0x83')](_0x2d8fbc[_0x343f('0x55')],{})[_0x343f('0x20')](function(_0x143229){_0x22b553=_0x143229;return db[_0x343f('0x84')][_0x343f('0x85')]({'where':{'id':_0x22b553[_0x343f('0x6b')]}});})['then'](function(_0x2c6408){if(_[_0x343f('0x61')](_0x2c6408)){return;}else{_0x22b553[_0x343f('0x58')]=_0x2c6408[_0x343f('0x58')];return db[_0x343f('0x86')][_0x343f('0x85')]({'where':{'id':_0x22b553[_0x343f('0x87')]}});}})[_0x343f('0x20')](function(_0x44957d){return respondWithRpcPromise(_0x343f('0x88'),_0x343f('0x88'),{'FaxAccountId':_['isNil'](_0x2d8fbc['body'])?undefined:_0x2d8fbc[_0x343f('0x55')]['FaxAccountId'],'path':_[_0x343f('0x61')](_0x44957d)?undefined:util[_0x343f('0x63')](_0x343f('0x89'),_0x44957d['basename']),'fax':_[_0x343f('0x61')](_0x22b553[_0x343f('0x58')])?undefined:_0x22b553[_0x343f('0x58')],'AttachmentId':_0x22b553[_0x343f('0x87')]},client9002);})[_0x343f('0x20')](respondWithResult(_0x29df17,0xc9))[_0x343f('0x28')](handleError(_0x29df17,null));};exports[_0x343f('0x8a')]=function(_0x4a1de2,_0x1365ff){var _0x13eb56=path[_0x343f('0x8b')](config[_0x343f('0x8c')],'server',_0x343f('0x8d'),_0x343f('0x8e'));return db[_0x343f('0x3b')][_0x343f('0x54')]({'where':{'id':_0x4a1de2[_0x343f('0x51')]['id']},'include':[{'model':db[_0x343f('0x86')],'as':_0x343f('0x86')}]})[_0x343f('0x20')](handleEntityNotFound(_0x1365ff,null))[_0x343f('0x20')](function(_0x363835){if(_0x363835){return _0x1365ff[_0x343f('0x8a')](path[_0x343f('0x8b')](_0x13eb56,_0x363835[_0x343f('0x86')][_0x343f('0x8f')]));}})[_0x343f('0x28')](handleError(_0x1365ff,null));}; \ No newline at end of file +var _0xd3a9=['apply','reject','save','update','destroy','status','stack','name','index','FaxMessage','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','pick','VIRTUAL','filter','merge','options','where','includeAll','show','params','include','find','body','describe','fax-interactions','fax','format','UserId','user','agent','get','FaxInteraction','FaxInteractionId','isNil','YYYY-MM-DD\x20HH:mm:ss','interaction','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','stringify','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize','SELECT','User','fullname','internal','manual','interface','SIP/%s','channel','motionChannel','event','accept','EventManager','acceptmessage','null','RejectMessage','contact','email','rejectmessage','create','findOne','AttachmentId','SendFax','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','basename','download','server','files','Attachment','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./faxMessage.socket','register','jayson/promise','client','http','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','error','message','result','catch','sendStatus','end','offset','count','set','Content-Range','json'];(function(_0x58c045,_0x2719d1){var _0x460cdb=function(_0x52efe4){while(--_0x52efe4){_0x58c045['push'](_0x58c045['shift']());}};_0x460cdb(++_0x2719d1);}(_0xd3a9,0xe5));var _0x9d3a=function(_0x451c75,_0x57c9db){_0x451c75=_0x451c75-0x0;var _0x158a56=_0xd3a9[_0x451c75];return _0x158a56;};'use strict';var emlformat=require(_0x9d3a('0x0'));var rimraf=require(_0x9d3a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9d3a('0x2'));var rp=require(_0x9d3a('0x3'));var moment=require(_0x9d3a('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x9d3a('0x5'));var util=require('util');var path=require(_0x9d3a('0x6'));var sox=require(_0x9d3a('0x7'));var csv=require('to-csv');var ejs=require(_0x9d3a('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9d3a('0x9'));var squel=require(_0x9d3a('0xa'));var crypto=require(_0x9d3a('0xb'));var jsforce=require(_0x9d3a('0xc'));var deskjs=require(_0x9d3a('0xd'));var toCsv=require(_0x9d3a('0xe'));var querystring=require(_0x9d3a('0xf'));var Papa=require(_0x9d3a('0x10'));var Redis=require(_0x9d3a('0x11'));var authService=require(_0x9d3a('0x12'));var qs=require(_0x9d3a('0x13'));var as=require(_0x9d3a('0x14'));var hardwareService=require(_0x9d3a('0x15'));var logger=require(_0x9d3a('0x16'))(_0x9d3a('0x17'));var utils=require(_0x9d3a('0x18'));var config=require(_0x9d3a('0x19'));var licenseUtil=require(_0x9d3a('0x1a'));var db=require('../../mysqldb')['db'];config[_0x9d3a('0x1b')]=_[_0x9d3a('0x1c')](config[_0x9d3a('0x1b')],{'host':_0x9d3a('0x1d'),'port':0x18eb});var socket=require(_0x9d3a('0x1e'))(new Redis(config[_0x9d3a('0x1b')]));require(_0x9d3a('0x1f'))[_0x9d3a('0x20')](socket);var jayson=require(_0x9d3a('0x21'));var client=jayson[_0x9d3a('0x22')][_0x9d3a('0x23')]({'port':0x232c});var client9002=jayson['client'][_0x9d3a('0x23')]({'port':0x232a});function respondWithRpcPromise(_0x1d6134,_0x4fa029,_0x223415,_0x1a8d30){return new BPromise(function(_0x406856,_0x2f46ef){var _0x35c237=_0x1a8d30||client;return _0x35c237['request'](_0x1d6134,_0x223415)[_0x9d3a('0x24')](function(_0x5583a2){logger[_0x9d3a('0x25')](_0x9d3a('0x26'),_0x4fa029,_0x9d3a('0x27'));logger[_0x9d3a('0x28')](_0x9d3a('0x29'),_0x4fa029,_0x9d3a('0x27'),JSON['stringify'](_0x5583a2));if(_0x5583a2[_0x9d3a('0x2a')]){if(_0x5583a2[_0x9d3a('0x2a')]['code']===0x1f4){logger[_0x9d3a('0x2a')](_0x9d3a('0x26'),_0x4fa029,_0x5583a2[_0x9d3a('0x2a')][_0x9d3a('0x2b')]);return _0x2f46ef(_0x5583a2[_0x9d3a('0x2a')]['message']);}logger[_0x9d3a('0x2a')]('FaxMessage,\x20%s,\x20%s',_0x4fa029,_0x5583a2['error']['message']);return _0x406856(_0x5583a2[_0x9d3a('0x2a')][_0x9d3a('0x2b')]);}else{logger[_0x9d3a('0x25')](_0x9d3a('0x26'),_0x4fa029,_0x9d3a('0x27'));_0x406856(_0x5583a2[_0x9d3a('0x2c')][_0x9d3a('0x2b')]);}})[_0x9d3a('0x2d')](function(_0x396038){logger[_0x9d3a('0x2a')](_0x9d3a('0x26'),_0x4fa029,_0x396038);_0x2f46ef(_0x396038);});});}function respondWithStatusCode(_0x131283,_0x29f983){_0x29f983=_0x29f983||0xcc;return function(_0x44ceba){if(_0x44ceba){return _0x131283[_0x9d3a('0x2e')](_0x29f983);}return _0x131283['status'](_0x29f983)[_0x9d3a('0x2f')]();};}function respondWithResult(_0x5e8514,_0x34a25b){_0x34a25b=_0x34a25b||0xc8;return function(_0x5c1e24){if(_0x5c1e24){return _0x5e8514['status'](_0x34a25b)['json'](_0x5c1e24);}};}function respondWithFilteredResult(_0x11840a,_0x18e298){return function(_0x1fbe8e){if(_0x1fbe8e){var _0x3c77f9=typeof _0x18e298[_0x9d3a('0x30')]==='undefined'&&typeof _0x18e298['limit']==='undefined';var _0x1ff804=_0x1fbe8e['count'];var _0x3f54b0=_0x3c77f9?0x0:_0x18e298[_0x9d3a('0x30')];var _0x321227=_0x3c77f9?_0x1fbe8e[_0x9d3a('0x31')]:_0x18e298['offset']+_0x18e298['limit'];var _0x57bed5;if(_0x321227>=_0x1ff804){_0x321227=_0x1ff804;_0x57bed5=0xc8;}else{_0x57bed5=0xce;}_0x11840a['status'](_0x57bed5);return _0x11840a[_0x9d3a('0x32')](_0x9d3a('0x33'),_0x3f54b0+'-'+_0x321227+'/'+_0x1ff804)[_0x9d3a('0x34')](_0x1fbe8e);}return null;};}function patchUpdates(_0x56bc07){return function(_0x378717){try{jsonpatch[_0x9d3a('0x35')](_0x378717,_0x56bc07,!![]);}catch(_0x42abcd){return BPromise[_0x9d3a('0x36')](_0x42abcd);}return _0x378717[_0x9d3a('0x37')]();};}function saveUpdates(_0x5e56d0,_0x3e085f){return function(_0x2d6d56){if(_0x2d6d56){return _0x2d6d56[_0x9d3a('0x38')](_0x5e56d0)['then'](function(_0x4877f5){return _0x4877f5;});}return null;};}function removeEntity(_0x360fed,_0x2e6a84){return function(_0x353827){if(_0x353827){return _0x353827[_0x9d3a('0x39')]()[_0x9d3a('0x24')](function(){_0x360fed[_0x9d3a('0x3a')](0xcc)[_0x9d3a('0x2f')]();});}};}function handleEntityNotFound(_0x1f8535,_0x1e3298){return function(_0x2b94fe){if(!_0x2b94fe){_0x1f8535[_0x9d3a('0x2e')](0x194);}return _0x2b94fe;};}function handleError(_0x3fc274,_0x19e5ae){_0x19e5ae=_0x19e5ae||0x1f4;return function(_0x43b255){logger[_0x9d3a('0x2a')](_0x43b255[_0x9d3a('0x3b')]);if(_0x43b255[_0x9d3a('0x3c')]){delete _0x43b255[_0x9d3a('0x3c')];}_0x3fc274[_0x9d3a('0x3a')](_0x19e5ae)['send'](_0x43b255);};}exports[_0x9d3a('0x3d')]=function(_0x2176b7,_0xa60fa6){var _0x5cb777={},_0x2c5812={},_0xf5f865={'count':0x0,'rows':[]};var _0x55ca4d=_['map'](db[_0x9d3a('0x3e')][_0x9d3a('0x3f')],function(_0x15e72e){return{'name':_0x15e72e[_0x9d3a('0x40')],'type':_0x15e72e[_0x9d3a('0x41')]['key']};});_0x2c5812[_0x9d3a('0x42')]=_[_0x9d3a('0x43')](_0x55ca4d,'name');_0x2c5812[_0x9d3a('0x44')]=_[_0x9d3a('0x45')](_0x2176b7[_0x9d3a('0x44')]);_0x2c5812[_0x9d3a('0x46')]=_[_0x9d3a('0x47')](_0x2c5812[_0x9d3a('0x42')],_0x2c5812[_0x9d3a('0x44')]);_0x5cb777[_0x9d3a('0x48')]=_[_0x9d3a('0x47')](_0x2c5812['model'],qs['fields'](_0x2176b7[_0x9d3a('0x44')][_0x9d3a('0x49')]));_0x5cb777[_0x9d3a('0x48')]=_0x5cb777[_0x9d3a('0x48')][_0x9d3a('0x4a')]?_0x5cb777[_0x9d3a('0x48')]:_0x2c5812[_0x9d3a('0x42')];if(!_0x2176b7[_0x9d3a('0x44')][_0x9d3a('0x4b')](_0x9d3a('0x4c'))){_0x5cb777[_0x9d3a('0x4d')]=qs[_0x9d3a('0x4d')](_0x2176b7[_0x9d3a('0x44')][_0x9d3a('0x4d')]);_0x5cb777[_0x9d3a('0x30')]=qs[_0x9d3a('0x30')](_0x2176b7['query']['offset']);}_0x5cb777[_0x9d3a('0x4e')]=qs[_0x9d3a('0x4f')](_0x2176b7[_0x9d3a('0x44')][_0x9d3a('0x4f')]);_0x5cb777['where']=qs[_0x9d3a('0x46')](_[_0x9d3a('0x50')](_0x2176b7[_0x9d3a('0x44')],_0x2c5812['filters']),_0x55ca4d);if(_0x2176b7['query']['filter']){_0x5cb777['where']=_['merge'](_0x5cb777['where'],{'$or':_[_0x9d3a('0x43')](_0x55ca4d,function(_0x33e8d8){if(_0x33e8d8[_0x9d3a('0x41')]!==_0x9d3a('0x51')){var _0x3bec8f={};_0x3bec8f[_0x33e8d8[_0x9d3a('0x3c')]]={'$like':'%'+_0x2176b7[_0x9d3a('0x44')][_0x9d3a('0x52')]+'%'};return _0x3bec8f;}})});}_0x5cb777=_[_0x9d3a('0x53')]({},_0x5cb777,_0x2176b7[_0x9d3a('0x54')]);var _0x4e3270={'where':_0x5cb777[_0x9d3a('0x55')]};return db[_0x9d3a('0x3e')][_0x9d3a('0x31')](_0x4e3270)[_0x9d3a('0x24')](function(_0x2b16f5){_0xf5f865[_0x9d3a('0x31')]=_0x2b16f5;if(_0x2176b7[_0x9d3a('0x44')][_0x9d3a('0x56')]){_0x5cb777['include']=[{'all':!![]}];}return db[_0x9d3a('0x3e')]['findAll'](_0x5cb777);})['then'](function(_0x23583a){_0xf5f865['rows']=_0x23583a;return _0xf5f865;})[_0x9d3a('0x24')](respondWithFilteredResult(_0xa60fa6,_0x5cb777))[_0x9d3a('0x2d')](handleError(_0xa60fa6,null));};exports[_0x9d3a('0x57')]=function(_0x1f2e46,_0x2b903c){var _0x1e906e={'raw':!![],'where':{'id':_0x1f2e46[_0x9d3a('0x58')]['id']}},_0x583c37={};_0x583c37[_0x9d3a('0x42')]=_['keys'](db['FaxMessage'][_0x9d3a('0x3f')]);_0x583c37[_0x9d3a('0x44')]=_[_0x9d3a('0x45')](_0x1f2e46[_0x9d3a('0x44')]);_0x583c37[_0x9d3a('0x46')]=_['intersection'](_0x583c37[_0x9d3a('0x42')],_0x583c37['query']);_0x1e906e[_0x9d3a('0x48')]=_[_0x9d3a('0x47')](_0x583c37[_0x9d3a('0x42')],qs[_0x9d3a('0x49')](_0x1f2e46[_0x9d3a('0x44')][_0x9d3a('0x49')]));_0x1e906e[_0x9d3a('0x48')]=_0x1e906e[_0x9d3a('0x48')][_0x9d3a('0x4a')]?_0x1e906e[_0x9d3a('0x48')]:_0x583c37['model'];if(_0x1f2e46[_0x9d3a('0x44')][_0x9d3a('0x56')]){_0x1e906e[_0x9d3a('0x59')]=[{'all':!![]}];}_0x1e906e=_['merge']({},_0x1e906e,_0x1f2e46['options']);return db[_0x9d3a('0x3e')][_0x9d3a('0x5a')](_0x1e906e)[_0x9d3a('0x24')](handleEntityNotFound(_0x2b903c,null))[_0x9d3a('0x24')](respondWithResult(_0x2b903c,null))['catch'](handleError(_0x2b903c,null));};exports[_0x9d3a('0x38')]=function(_0x597876,_0x44dfe9){if(_0x597876[_0x9d3a('0x5b')]['id']){delete _0x597876['body']['id'];}return db[_0x9d3a('0x3e')][_0x9d3a('0x5a')]({'where':{'id':_0x597876['params']['id']}})[_0x9d3a('0x24')](handleEntityNotFound(_0x44dfe9,null))['then'](saveUpdates(_0x597876[_0x9d3a('0x5b')],null))[_0x9d3a('0x24')](respondWithResult(_0x44dfe9,null))[_0x9d3a('0x2d')](handleError(_0x44dfe9,null));};exports[_0x9d3a('0x39')]=function(_0x2336b2,_0xbc3288){return db[_0x9d3a('0x3e')]['find']({'where':{'id':_0x2336b2[_0x9d3a('0x58')]['id']}})[_0x9d3a('0x24')](handleEntityNotFound(_0xbc3288,null))[_0x9d3a('0x24')](removeEntity(_0xbc3288,null))[_0x9d3a('0x2d')](handleError(_0xbc3288,null));};exports[_0x9d3a('0x5c')]=function(_0x3122a,_0x469b7d){return db[_0x9d3a('0x3e')][_0x9d3a('0x5c')]()[_0x9d3a('0x24')](respondWithResult(_0x469b7d,null))[_0x9d3a('0x2d')](handleError(_0x469b7d,null));};var interaction_log=require(_0x9d3a('0x16'))(_0x9d3a('0x5d'));exports['accept']=function(_0x59878c,_0xb98b0d,_0x1b3a8f){var _0x18b78c={'agent':{},'channel':_0x9d3a('0x5e')};if(_0x59878c['body']['id']){delete _0x59878c['body']['id'];}_0x59878c[_0x9d3a('0x5b')]['read']=!![];_0x59878c[_0x9d3a('0x5b')]['readAt']=moment()[_0x9d3a('0x5f')]('YYYY-MM-DD\x20HH:mm:ss');_0x59878c[_0x9d3a('0x5b')]['UserId']=_0x59878c[_0x9d3a('0x5b')][_0x9d3a('0x60')]||_0x59878c[_0x9d3a('0x61')]['id'];_0x18b78c[_0x9d3a('0x62')]['id']=_0x59878c[_0x9d3a('0x5b')][_0x9d3a('0x60')];return db[_0x9d3a('0x3e')][_0x9d3a('0x5a')]({'where':{'id':_0x59878c[_0x9d3a('0x58')]['id'],'UserId':null}})[_0x9d3a('0x24')](handleEntityNotFound(_0xb98b0d,null))['then'](saveUpdates(_0x59878c[_0x9d3a('0x5b')],null))['then'](function(_0x4017e9){if(_0x4017e9){_0x18b78c[_0x9d3a('0x2b')]=_0x4017e9[_0x9d3a('0x63')]({'plain':!![]});return db[_0x9d3a('0x64')][_0x9d3a('0x5a')]({'where':{'id':_0x4017e9[_0x9d3a('0x65')]}});}return null;})['then'](handleEntityNotFound(_0xb98b0d,null))['then'](function(_0x340b86){if(_0x340b86){return _0x340b86['update']({'UserId':_0x59878c[_0x9d3a('0x5b')][_0x9d3a('0x60')],'read1stAt':_[_0x9d3a('0x66')](_0x340b86['read1stAt'])?moment()['format'](_0x9d3a('0x67')):undefined});}return null;})[_0x9d3a('0x24')](function(_0x36dd06){if(_0x36dd06){_0x18b78c[_0x9d3a('0x68')]=_0x36dd06[_0x9d3a('0x63')]({'plain':!![]});interaction_log[_0x9d3a('0x25')](_0x9d3a('0x69'),_0x59878c[_0x9d3a('0x61')]['id'],_0x59878c['user'][_0x9d3a('0x3c')],_0x59878c[_0x9d3a('0x61')][_0x9d3a('0x6a')],_0x18b78c[_0x9d3a('0x68')]['id'],_0x59878c[_0x9d3a('0x5b')]?JSON[_0x9d3a('0x6b')](_0x59878c[_0x9d3a('0x5b')]):'null');return respondWithRpcPromise('AcceptMessage',_0x9d3a('0x6c'),_0x18b78c);}return null;})['then'](function(_0x15419a){var _0x501daa=_0x9d3a('0x6d')+_0x15419a[_0x9d3a('0x2b')]['ContactId'];return db[_0x9d3a('0x6e')][_0x9d3a('0x44')](_0x501daa,{'type':db[_0x9d3a('0x6f')]['QueryTypes'][_0x9d3a('0x70')],'raw':!![]})[_0x9d3a('0x24')](function(_0x419e62){return _0x419e62;});})[_0x9d3a('0x24')](function(_0x56f7e8){if(_0x56f7e8){_0x18b78c[_0x9d3a('0x2b')]['contact']=_0x56f7e8[0x0];if(!_0x59878c['body'][_0x9d3a('0x60')])return;return db[_0x9d3a('0x71')][_0x9d3a('0x5a')]({'where':{'id':_0x59878c[_0x9d3a('0x5b')]['UserId'],'role':_0x9d3a('0x62')},'attributes':['id',_0x9d3a('0x3c'),_0x9d3a('0x72'),'email',_0x9d3a('0x73')],'raw':!![]});}return null;})[_0x9d3a('0x24')](function(_0x1366db){if(!_0x1366db)return null;_0x18b78c[_0x9d3a('0x2b')][_0x9d3a('0x62')]=_0x1366db;return _0x18b78c;})['then'](function(_0xee7d61){if(_0xee7d61){if(_0x59878c[_0x9d3a('0x5b')][_0x9d3a('0x74')]){_0x18b78c[_0x9d3a('0x2b')][_0x9d3a('0x75')]=util['format'](_0x9d3a('0x76'),_0x59878c['user'][_0x9d3a('0x3c')]);_0x18b78c[_0x9d3a('0x2b')][_0x9d3a('0x77')]=_0x18b78c[_0x9d3a('0x77')];_0x18b78c[_0x9d3a('0x2b')][_0x9d3a('0x78')]=_0x18b78c[_0x9d3a('0x77')];_0x18b78c['message'][_0x9d3a('0x79')]=_0x9d3a('0x7a');return respondWithRpcPromise('EventManager',_0x9d3a('0x7b'),{'event':_0x9d3a('0x7c'),'message':_0x18b78c[_0x9d3a('0x2b')]},client9002)['then'](function(){return _0x18b78c;});}return _0x18b78c;}return null;})[_0x9d3a('0x24')](respondWithResult(_0xb98b0d,null))[_0x9d3a('0x2d')](handleError(_0xb98b0d,null));};var interaction_log=require(_0x9d3a('0x16'))(_0x9d3a('0x5d'));exports[_0x9d3a('0x36')]=function(_0x397c05,_0x4f8493,_0xa61916){var _0x3bae38={'agent':{},'channel':_0x9d3a('0x5e')};if(_0x397c05[_0x9d3a('0x5b')]['id']){delete _0x397c05[_0x9d3a('0x5b')]['id'];}_0x397c05[_0x9d3a('0x5b')]['UserId']=_0x397c05[_0x9d3a('0x5b')][_0x9d3a('0x60')]||_0x397c05[_0x9d3a('0x61')]['id'];_0x3bae38['agent']['id']=_0x397c05['body'][_0x9d3a('0x60')];return db[_0x9d3a('0x3e')][_0x9d3a('0x5a')]({'where':{'id':_0x397c05[_0x9d3a('0x58')]['id'],'UserId':null}})[_0x9d3a('0x24')](handleEntityNotFound(_0x4f8493,null))[_0x9d3a('0x24')](function(_0x17b711){if(_0x17b711){_0x3bae38[_0x9d3a('0x2b')]=_0x17b711['get']({'plain':!![]});return db[_0x9d3a('0x64')]['find']({'where':{'id':_0x17b711['FaxInteractionId']}});}return null;})[_0x9d3a('0x24')](handleEntityNotFound(_0x4f8493,null))[_0x9d3a('0x24')](function(_0x2745a8){if(_0x2745a8){_0x3bae38['interaction']=_0x2745a8[_0x9d3a('0x63')]({'plain':!![]});interaction_log[_0x9d3a('0x25')]('[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x397c05[_0x9d3a('0x61')]['id'],_0x397c05[_0x9d3a('0x61')]['name'],_0x397c05[_0x9d3a('0x61')][_0x9d3a('0x6a')],_0x3bae38[_0x9d3a('0x68')]['id'],_0x397c05[_0x9d3a('0x5b')]?JSON['stringify'](_0x397c05[_0x9d3a('0x5b')]):_0x9d3a('0x7d'));return respondWithRpcPromise(_0x9d3a('0x7e'),'rejectMessage',_0x3bae38);}return null;})['then'](function(_0xe70fb5){var _0xdb712e=_0x9d3a('0x6d')+_0xe70fb5[_0x9d3a('0x2b')]['ContactId'];return db[_0x9d3a('0x6e')][_0x9d3a('0x44')](_0xdb712e,{'type':db[_0x9d3a('0x6f')]['QueryTypes']['SELECT'],'raw':!![]})[_0x9d3a('0x24')](function(_0x102833){return _0x102833;});})[_0x9d3a('0x24')](function(_0x433fac){if(_0x433fac){_0x3bae38[_0x9d3a('0x2b')][_0x9d3a('0x7f')]=_0x433fac[0x0];if(!_0x397c05[_0x9d3a('0x5b')][_0x9d3a('0x60')])return;return db['User'][_0x9d3a('0x5a')]({'where':{'id':_0x397c05[_0x9d3a('0x5b')][_0x9d3a('0x60')],'role':_0x9d3a('0x62')},'attributes':['id',_0x9d3a('0x3c'),'fullname',_0x9d3a('0x80'),_0x9d3a('0x73')],'raw':!![]});}return null;})[_0x9d3a('0x24')](function(_0x40025c){if(!_0x40025c)return null;_0x3bae38['message'][_0x9d3a('0x62')]=_0x40025c;return _0x3bae38;})[_0x9d3a('0x24')](function(_0x475cbe){if(_0x475cbe){_0x475cbe['message']['interface']=util[_0x9d3a('0x5f')](_0x9d3a('0x76'),_0x397c05[_0x9d3a('0x61')][_0x9d3a('0x3c')]);_0x475cbe[_0x9d3a('0x2b')][_0x9d3a('0x77')]=_0x3bae38[_0x9d3a('0x77')];_0x475cbe[_0x9d3a('0x2b')][_0x9d3a('0x78')]=_0x3bae38[_0x9d3a('0x77')];_0x475cbe[_0x9d3a('0x2b')][_0x9d3a('0x79')]=_0x9d3a('0x36');respondWithRpcPromise(_0x9d3a('0x7b'),_0x9d3a('0x7b'),{'event':_0x9d3a('0x81'),'message':_0x475cbe[_0x9d3a('0x2b')]},client9002);return _0x3bae38;}return null;})[_0x9d3a('0x24')](respondWithResult(_0x4f8493,null))[_0x9d3a('0x2d')](handleError(_0x4f8493,null));};exports[_0x9d3a('0x82')]=function(_0x41bdfd,_0xb474da){var _0x724142;return db[_0x9d3a('0x3e')][_0x9d3a('0x82')](_0x41bdfd[_0x9d3a('0x5b')],{})[_0x9d3a('0x24')](function(_0x16ef86){_0x724142=_0x16ef86;return db['CmContact'][_0x9d3a('0x83')]({'where':{'id':_0x724142['ContactId']}});})[_0x9d3a('0x24')](function(_0x154a89){if(_[_0x9d3a('0x66')](_0x154a89)){return;}else{_0x724142['fax']=_0x154a89['fax'];return db['Attachment'][_0x9d3a('0x83')]({'where':{'id':_0x724142[_0x9d3a('0x84')]}});}})['then'](function(_0x439689){return respondWithRpcPromise(_0x9d3a('0x85'),_0x9d3a('0x85'),{'FaxAccountId':_[_0x9d3a('0x66')](_0x41bdfd[_0x9d3a('0x5b')])?undefined:_0x41bdfd[_0x9d3a('0x5b')][_0x9d3a('0x86')],'path':_[_0x9d3a('0x66')](_0x439689)?undefined:util['format'](_0x9d3a('0x87'),_0x439689[_0x9d3a('0x88')]),'fax':_[_0x9d3a('0x66')](_0x724142[_0x9d3a('0x5e')])?undefined:_0x724142[_0x9d3a('0x5e')],'AttachmentId':_0x724142[_0x9d3a('0x84')]},client9002);})['then'](respondWithResult(_0xb474da,0xc9))[_0x9d3a('0x2d')](handleError(_0xb474da,null));};exports[_0x9d3a('0x89')]=function(_0x460042,_0x24b107){var _0x37e71c=path['join'](config['root'],_0x9d3a('0x8a'),_0x9d3a('0x8b'),'attachments');return db[_0x9d3a('0x3e')][_0x9d3a('0x5a')]({'where':{'id':_0x460042[_0x9d3a('0x58')]['id']},'include':[{'model':db[_0x9d3a('0x8c')],'as':'Attachment'}]})[_0x9d3a('0x24')](handleEntityNotFound(_0x24b107,null))['then'](function(_0x52a7d2){if(_0x52a7d2){return _0x24b107[_0x9d3a('0x89')](path['join'](_0x37e71c,_0x52a7d2[_0x9d3a('0x8c')][_0x9d3a('0x88')]));}})[_0x9d3a('0x2d')](handleError(_0x24b107,null));}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index 5056cd8..424c68b 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 _0x7676=['events','../../mysqldb','FaxMessage','save','emit','hasOwnProperty','hook','exports'];(function(_0x3bf3b8,_0xf0dea6){var _0x1e26bf=function(_0x17b1a9){while(--_0x17b1a9){_0x3bf3b8['push'](_0x3bf3b8['shift']());}};_0x1e26bf(++_0xf0dea6);}(_0x7676,0xb8));var _0x6767=function(_0x5a595c,_0xf3116){_0x5a595c=_0x5a595c-0x0;var _0x452d13=_0x7676[_0x5a595c];return _0x452d13;};'use strict';var EventEmitter=require(_0x6767('0x0'));var FaxMessage=require(_0x6767('0x1'))['db'][_0x6767('0x2')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x6767('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x1e86fc){return function(_0x4bd37b,_0x4005ff,_0x10d505){FaxMessageEvents[_0x6767('0x4')](_0x1e86fc+':'+_0x4bd37b['id'],_0x4bd37b);FaxMessageEvents['emit'](_0x1e86fc,_0x4bd37b);_0x10d505(null);};}for(var e in events){if(events[_0x6767('0x5')](e)){var event=events[e];FaxMessage[_0x6767('0x6')](e,emitEvent(event));}}module[_0x6767('0x7')]=FaxMessageEvents; \ No newline at end of file +var _0x0424=['exports','FaxMessage','setMaxListeners','save','update','emit','hasOwnProperty','hook'];(function(_0x3166e4,_0x1bd8cd){var _0x438265=function(_0x2dde13){while(--_0x2dde13){_0x3166e4['push'](_0x3166e4['shift']());}};_0x438265(++_0x1bd8cd);}(_0x0424,0x159));var _0x4042=function(_0x43709e,_0x2c3b45){_0x43709e=_0x43709e-0x0;var _0x452820=_0x0424[_0x43709e];return _0x452820;};'use strict';var EventEmitter=require('events');var FaxMessage=require('../../mysqldb')['db'][_0x4042('0x0')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0x4042('0x1')](0x0);var events={'afterCreate':_0x4042('0x2'),'afterUpdate':_0x4042('0x3'),'afterDestroy':'remove'};function emitEvent(_0x3cd879){return function(_0x519987,_0x491eae,_0x20d8df){FaxMessageEvents[_0x4042('0x4')](_0x3cd879+':'+_0x519987['id'],_0x519987);FaxMessageEvents[_0x4042('0x4')](_0x3cd879,_0x519987);_0x20d8df(null);};}for(var e in events){if(events[_0x4042('0x5')](e)){var event=events[e];FaxMessage[_0x4042('0x6')](e,emitEvent(event));}}module[_0x4042('0x7')]=FaxMessageEvents; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.model.js b/server/api/faxMessage/faxMessage.model.js index b241ab4..ffeb767 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 _0xcc90=['get','direction','toLowerCase','out','secret','isNil','UserId','findOne','FaxInteractionId','then','update','catch','error','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','request-promise','path','rimraf','exports','FaxMessage','fti_fax_messages','body','FULLTEXT','models'];(function(_0x2e6c19,_0x131233){var _0x52885d=function(_0x38f224){while(--_0x38f224){_0x2e6c19['push'](_0x2e6c19['shift']());}};_0x52885d(++_0x131233);}(_0xcc90,0x1f4));var _0x0cc9=function(_0x2b4048,_0x579711){_0x2b4048=_0x2b4048-0x0;var _0x22783f=_0xcc90[_0x2b4048];return _0x22783f;};'use strict';var _=require(_0x0cc9('0x0'));var util=require(_0x0cc9('0x1'));var logger=require(_0x0cc9('0x2'))('api');var moment=require(_0x0cc9('0x3'));var BPromise=require('bluebird');var rp=require(_0x0cc9('0x4'));var fs=require('fs');var path=require(_0x0cc9('0x5'));var rimraf=require(_0x0cc9('0x6'));var config=require('../../config/environment');var attributes=require('./faxMessage.attributes');module[_0x0cc9('0x7')]=function(_0x304536,_0x58ed26){return _0x304536['define'](_0x0cc9('0x8'),attributes,{'tableName':'fax_messages','paranoid':![],'indexes':[{'name':_0x0cc9('0x9'),'fields':[_0x0cc9('0xa')],'type':_0x0cc9('0xb')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x392adb,_0x3170a4,_0xc275bb){var _0x5408e1=_0x304536[_0x0cc9('0xc')];var _0x3e757b=_0x392adb[_0x0cc9('0xd')]({'plain':!![]});if(_0x3e757b[_0x0cc9('0xe')]['toLowerCase']()==='in'||_0x3e757b[_0x0cc9('0xe')][_0x0cc9('0xf')]()===_0x0cc9('0x10')&&!_0x3e757b[_0x0cc9('0x11')]&&!_[_0x0cc9('0x12')](_0x3e757b[_0x0cc9('0x13')])){_0x5408e1['FaxInteraction'][_0x0cc9('0x14')]({'where':{'id':_0x3e757b[_0x0cc9('0x15')]}})[_0x0cc9('0x16')](function(_0x2a50c1){if(_0x2a50c1){_0x2a50c1[_0x0cc9('0x17')]({'lastMsgAt':_0x3e757b['createdAt'],'lastMsgDirection':_0x3e757b[_0x0cc9('0xe')]['toLowerCase']()});}})[_0x0cc9('0x18')](function(_0xe0564){console[_0x0cc9('0x19')](_0xe0564);});}_0xc275bb();}},'charset':'utf8mb4','collate':_0x0cc9('0x1a')});}; \ No newline at end of file +var _0x4105=['./faxMessage.attributes','exports','define','FaxMessage','fax_messages','fti_fax_messages','body','FULLTEXT','models','direction','toLowerCase','isNil','UserId','findOne','FaxInteractionId','update','createdAt','error','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','request-promise','path','../../config/environment'];(function(_0x2650e9,_0xb91cc){var _0x3511c8=function(_0x5069cf){while(--_0x5069cf){_0x2650e9['push'](_0x2650e9['shift']());}};_0x3511c8(++_0xb91cc);}(_0x4105,0xc9));var _0x5410=function(_0x4c57f7,_0x2ea228){_0x4c57f7=_0x4c57f7-0x0;var _0x3e2da4=_0x4105[_0x4c57f7];return _0x3e2da4;};'use strict';var _=require(_0x5410('0x0'));var util=require(_0x5410('0x1'));var logger=require(_0x5410('0x2'))('api');var moment=require(_0x5410('0x3'));var BPromise=require('bluebird');var rp=require(_0x5410('0x4'));var fs=require('fs');var path=require(_0x5410('0x5'));var rimraf=require('rimraf');var config=require(_0x5410('0x6'));var attributes=require(_0x5410('0x7'));module[_0x5410('0x8')]=function(_0x1c0348,_0x339b69){return _0x1c0348[_0x5410('0x9')](_0x5410('0xa'),attributes,{'tableName':_0x5410('0xb'),'paranoid':![],'indexes':[{'name':_0x5410('0xc'),'fields':[_0x5410('0xd')],'type':_0x5410('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x409246,_0xbf504b,_0x40b403){var _0xd1ef8=_0x1c0348[_0x5410('0xf')];var _0x5c3d39=_0x409246['get']({'plain':!![]});if(_0x5c3d39[_0x5410('0x10')][_0x5410('0x11')]()==='in'||_0x5c3d39[_0x5410('0x10')][_0x5410('0x11')]()==='out'&&!_0x5c3d39['secret']&&!_[_0x5410('0x12')](_0x5c3d39[_0x5410('0x13')])){_0xd1ef8['FaxInteraction'][_0x5410('0x14')]({'where':{'id':_0x5c3d39[_0x5410('0x15')]}})['then'](function(_0x3c7366){if(_0x3c7366){_0x3c7366[_0x5410('0x16')]({'lastMsgAt':_0x5c3d39[_0x5410('0x17')],'lastMsgDirection':_0x5c3d39[_0x5410('0x10')][_0x5410('0x11')]()});}})['catch'](function(_0xa72d7){console[_0x5410('0x18')](_0xa72d7);});}_0x40b403();}},'charset':'utf8mb4','collate':_0x5410('0x19')});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.rpc.js b/server/api/faxMessage/faxMessage.rpc.js index 79d7a48..c5591fa 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 _0xb903=['options','raw','then','stringify','UpdateFaxMessage','update','where','attributes','limit','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','request','info','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','error','FaxMessage,\x20%s,\x20%s','message','result','catch','CreateFaxMessage','FaxMessage','create','body'];(function(_0x5dc078,_0x38a683){var _0x3d6953=function(_0x56dcfb){while(--_0x56dcfb){_0x5dc078['push'](_0x5dc078['shift']());}};_0x3d6953(++_0x38a683);}(_0xb903,0x185));var _0x3b90=function(_0x503d00,_0x237017){_0x503d00=_0x503d00-0x0;var _0x2c48c8=_0xb903[_0x503d00];return _0x2c48c8;};'use strict';var _=require(_0x3b90('0x0'));var util=require(_0x3b90('0x1'));var moment=require(_0x3b90('0x2'));var BPromise=require(_0x3b90('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3b90('0x4'));var db=require(_0x3b90('0x5'))['db'];var utils=require(_0x3b90('0x6'));var logger=require(_0x3b90('0x7'))(_0x3b90('0x8'));var config=require(_0x3b90('0x9'));var jayson=require(_0x3b90('0xa'));var client=jayson['client'][_0x3b90('0xb')]({'port':0x232a});config['redis']=_['defaults'](config[_0x3b90('0xc')],{'host':_0x3b90('0xd'),'port':0x18eb});var socket=require(_0x3b90('0xe'))(new Redis(config[_0x3b90('0xc')]));require('./faxMessage.socket')['register'](socket);function respondWithRpcPromise(_0x52401e,_0x51f916,_0x56261b){return new BPromise(function(_0x55db3f,_0x336913){return client[_0x3b90('0xf')](_0x52401e,_0x56261b)['then'](function(_0x30c49c){logger[_0x3b90('0x10')]('FaxMessage,\x20%s,\x20%s',_0x51f916,_0x3b90('0x11'));logger[_0x3b90('0x12')](_0x3b90('0x13'),_0x51f916,'request\x20sent',JSON['stringify'](_0x30c49c));if(_0x30c49c[_0x3b90('0x14')]){if(_0x30c49c['error']['code']===0x1f4){logger[_0x3b90('0x14')](_0x3b90('0x15'),_0x51f916,_0x30c49c['error']['message']);return _0x336913(_0x30c49c[_0x3b90('0x14')][_0x3b90('0x16')]);}logger[_0x3b90('0x14')](_0x3b90('0x15'),_0x51f916,_0x30c49c[_0x3b90('0x14')]['message']);return _0x55db3f(_0x30c49c['error'][_0x3b90('0x16')]);}else{logger[_0x3b90('0x10')]('FaxMessage,\x20%s,\x20%s',_0x51f916,_0x3b90('0x11'));_0x55db3f(_0x30c49c[_0x3b90('0x17')][_0x3b90('0x16')]);}})[_0x3b90('0x18')](function(_0x4f388b){logger[_0x3b90('0x14')]('FaxMessage,\x20%s,\x20%s',_0x51f916,_0x4f388b);_0x336913(_0x4f388b);});});}exports[_0x3b90('0x19')]=function(_0x231690){var _0x535894=this;return new Promise(function(_0x39ae7c,_0x12e1cf){return db[_0x3b90('0x1a')][_0x3b90('0x1b')](_0x231690[_0x3b90('0x1c')],{'raw':_0x231690[_0x3b90('0x1d')]?_0x231690[_0x3b90('0x1d')][_0x3b90('0x1e')]===undefined?!![]:![]:!![]})[_0x3b90('0x1f')](function(_0x3e5bb8){logger['info'](_0x3b90('0x19'),_0x231690);logger[_0x3b90('0x12')](_0x3b90('0x19'),_0x231690,JSON[_0x3b90('0x20')](_0x3e5bb8));_0x39ae7c(_0x3e5bb8);})[_0x3b90('0x18')](function(_0x93b8e7){logger['error']('CreateFaxMessage',_0x93b8e7[_0x3b90('0x16')],_0x231690);_0x12e1cf(_0x535894[_0x3b90('0x14')](0x1f4,_0x93b8e7[_0x3b90('0x16')]));});});};exports[_0x3b90('0x21')]=function(_0x583523){var _0x414462=this;return new Promise(function(_0x2936d7,_0x1787d1){return db['FaxMessage'][_0x3b90('0x22')](_0x583523[_0x3b90('0x1c')],{'raw':_0x583523[_0x3b90('0x1d')]?_0x583523[_0x3b90('0x1d')][_0x3b90('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x583523[_0x3b90('0x1d')]?_0x583523['options'][_0x3b90('0x23')]||null:null,'attributes':_0x583523['options']?_0x583523[_0x3b90('0x1d')][_0x3b90('0x24')]||null:null,'limit':_0x583523[_0x3b90('0x1d')]?_0x583523[_0x3b90('0x1d')][_0x3b90('0x25')]||null:null})[_0x3b90('0x1f')](function(_0x290283){logger[_0x3b90('0x10')]('UpdateFaxMessage',_0x583523);logger['debug'](_0x3b90('0x21'),_0x583523,JSON[_0x3b90('0x20')](_0x290283));_0x2936d7(_0x290283);})[_0x3b90('0x18')](function(_0x1c2e84){logger['error']('UpdateFaxMessage',_0x1c2e84[_0x3b90('0x16')],_0x583523);_0x1787d1(_0x414462[_0x3b90('0x14')](0x1f4,_0x1c2e84[_0x3b90('0x16')]));});});}; \ No newline at end of file +var _0x7bae=['request\x20sent','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','FaxMessage,\x20%s,\x20%s','create','body','options','raw','CreateFaxMessage','debug','FaxMessage','update','where','limit','UpdateFaxMessage','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./faxMessage.socket','request','then','info'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x7bae,0x13b));var _0xe7ba=function(_0x15bc81,_0x4d4f77){_0x15bc81=_0x15bc81-0x0;var _0x59440e=_0x7bae[_0x15bc81];return _0x59440e;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe7ba('0x0'));var BPromise=require(_0xe7ba('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe7ba('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xe7ba('0x3'));var logger=require(_0xe7ba('0x4'))(_0xe7ba('0x5'));var config=require(_0xe7ba('0x6'));var jayson=require(_0xe7ba('0x7'));var client=jayson[_0xe7ba('0x8')][_0xe7ba('0x9')]({'port':0x232a});config[_0xe7ba('0xa')]=_[_0xe7ba('0xb')](config[_0xe7ba('0xa')],{'host':_0xe7ba('0xc'),'port':0x18eb});var socket=require(_0xe7ba('0xd'))(new Redis(config[_0xe7ba('0xa')]));require(_0xe7ba('0xe'))['register'](socket);function respondWithRpcPromise(_0x3df8bf,_0xe57e33,_0x375ebb){return new BPromise(function(_0x276bc3,_0x15083a){return client[_0xe7ba('0xf')](_0x3df8bf,_0x375ebb)[_0xe7ba('0x10')](function(_0x448bcc){logger[_0xe7ba('0x11')]('FaxMessage,\x20%s,\x20%s',_0xe57e33,_0xe7ba('0x12'));logger['debug'](_0xe7ba('0x13'),_0xe57e33,_0xe7ba('0x12'),JSON[_0xe7ba('0x14')](_0x448bcc));if(_0x448bcc[_0xe7ba('0x15')]){if(_0x448bcc[_0xe7ba('0x15')][_0xe7ba('0x16')]===0x1f4){logger['error']('FaxMessage,\x20%s,\x20%s',_0xe57e33,_0x448bcc[_0xe7ba('0x15')][_0xe7ba('0x17')]);return _0x15083a(_0x448bcc[_0xe7ba('0x15')]['message']);}logger[_0xe7ba('0x15')]('FaxMessage,\x20%s,\x20%s',_0xe57e33,_0x448bcc['error']['message']);return _0x276bc3(_0x448bcc[_0xe7ba('0x15')]['message']);}else{logger[_0xe7ba('0x11')]('FaxMessage,\x20%s,\x20%s',_0xe57e33,'request\x20sent');_0x276bc3(_0x448bcc['result'][_0xe7ba('0x17')]);}})[_0xe7ba('0x18')](function(_0x39ca38){logger[_0xe7ba('0x15')](_0xe7ba('0x19'),_0xe57e33,_0x39ca38);_0x15083a(_0x39ca38);});});}exports['CreateFaxMessage']=function(_0x149c62){var _0x20c653=this;return new Promise(function(_0x3b40fb,_0x136ec6){return db['FaxMessage'][_0xe7ba('0x1a')](_0x149c62[_0xe7ba('0x1b')],{'raw':_0x149c62['options']?_0x149c62[_0xe7ba('0x1c')][_0xe7ba('0x1d')]===undefined?!![]:![]:!![]})[_0xe7ba('0x10')](function(_0x7ab9e4){logger[_0xe7ba('0x11')](_0xe7ba('0x1e'),_0x149c62);logger[_0xe7ba('0x1f')](_0xe7ba('0x1e'),_0x149c62,JSON[_0xe7ba('0x14')](_0x7ab9e4));_0x3b40fb(_0x7ab9e4);})[_0xe7ba('0x18')](function(_0x58cf43){logger['error']('CreateFaxMessage',_0x58cf43['message'],_0x149c62);_0x136ec6(_0x20c653[_0xe7ba('0x15')](0x1f4,_0x58cf43['message']));});});};exports['UpdateFaxMessage']=function(_0x5ece11){var _0x255def=this;return new Promise(function(_0x32cc00,_0xe32862){return db[_0xe7ba('0x20')][_0xe7ba('0x21')](_0x5ece11[_0xe7ba('0x1b')],{'raw':_0x5ece11[_0xe7ba('0x1c')]?_0x5ece11[_0xe7ba('0x1c')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5ece11[_0xe7ba('0x1c')]?_0x5ece11['options'][_0xe7ba('0x22')]||null:null,'attributes':_0x5ece11[_0xe7ba('0x1c')]?_0x5ece11[_0xe7ba('0x1c')]['attributes']||null:null,'limit':_0x5ece11['options']?_0x5ece11[_0xe7ba('0x1c')][_0xe7ba('0x23')]||null:null})[_0xe7ba('0x10')](function(_0x20b6cd){logger[_0xe7ba('0x11')]('UpdateFaxMessage',_0x5ece11);logger[_0xe7ba('0x1f')](_0xe7ba('0x24'),_0x5ece11,JSON['stringify'](_0x20b6cd));_0x32cc00(_0x20b6cd);})[_0xe7ba('0x18')](function(_0x530227){logger['error'](_0xe7ba('0x24'),_0x530227[_0xe7ba('0x17')],_0x5ece11);_0xe32862(_0x255def[_0xe7ba('0x15')](0x1f4,_0x530227['message']));});});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index 6940a80..26f9f33 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 _0x95d8=['faxMessage:','remove','update','emit','removeListener','register','length'];(function(_0x3b5530,_0x1a263a){var _0xf59680=function(_0x4fd1d8){while(--_0x4fd1d8){_0x3b5530['push'](_0x3b5530['shift']());}};_0xf59680(++_0x1a263a);}(_0x95d8,0x1b3));var _0x895d=function(_0x35d144,_0x48dae8){_0x35d144=_0x35d144-0x0;var _0xb83cfa=_0x95d8[_0x35d144];return _0xb83cfa;};'use strict';var FaxMessageEvents=require('./faxMessage.events');var events=['save',_0x895d('0x0'),_0x895d('0x1')];function createListener(_0x134ab8,_0x28a87c){return function(_0x5ccac1){_0x28a87c[_0x895d('0x2')](_0x134ab8,_0x5ccac1);};}function removeListener(_0x178a29,_0x190360){return function(){FaxMessageEvents[_0x895d('0x3')](_0x178a29,_0x190360);};}exports[_0x895d('0x4')]=function(_0x2ee1c8){for(var _0x380a2c=0x0,_0x34f6cc=events[_0x895d('0x5')];_0x380a2c<_0x34f6cc;_0x380a2c++){var _0x100e90=events[_0x380a2c];var _0x50acdc=createListener(_0x895d('0x6')+_0x100e90,_0x2ee1c8);FaxMessageEvents['on'](_0x100e90,_0x50acdc);}}; \ No newline at end of file +var _0x79c1=['save','remove','update','emit','removeListener','register','faxMessage:','./faxMessage.events'];(function(_0x4a7cbc,_0x555ea3){var _0x401e22=function(_0x30b6ab){while(--_0x30b6ab){_0x4a7cbc['push'](_0x4a7cbc['shift']());}};_0x401e22(++_0x555ea3);}(_0x79c1,0x13f));var _0x179c=function(_0x3e9266,_0xf51328){_0x3e9266=_0x3e9266-0x0;var _0x18b80c=_0x79c1[_0x3e9266];return _0x18b80c;};'use strict';var FaxMessageEvents=require(_0x179c('0x0'));var events=[_0x179c('0x1'),_0x179c('0x2'),_0x179c('0x3')];function createListener(_0x552ab4,_0x880f1a){return function(_0x57dbc2){_0x880f1a[_0x179c('0x4')](_0x552ab4,_0x57dbc2);};}function removeListener(_0x5e7f6f,_0x1013b6){return function(){FaxMessageEvents[_0x179c('0x5')](_0x5e7f6f,_0x1013b6);};}exports[_0x179c('0x6')]=function(_0x1a25da){for(var _0x4c27e0=0x0,_0x152b0a=events['length'];_0x4c27e0<_0x152b0a;_0x4c27e0++){var _0xde7eec=events[_0x4c27e0];var _0x33d280=createListener(_0x179c('0x7')+_0xde7eec,_0x1a25da);FaxMessageEvents['on'](_0xde7eec,_0x33d280);}}; \ No newline at end of file diff --git a/server/api/faxMessage/index.js b/server/api/faxMessage/index.js index 873c4b2..2665bb5 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 _0x702d=['get','index','/describe','describe','/:id','isAuthenticated','show','/:id/download','download','post','tracked','create','put','update','/:id/accept','accept','reject','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x257170,_0x40f5b1){var _0x149834=function(_0x1f5da4){while(--_0x1f5da4){_0x257170['push'](_0x257170['shift']());}};_0x149834(++_0x40f5b1);}(_0x702d,0x147));var _0xd702=function(_0x11f518,_0x4f30dc){_0x11f518=_0x11f518-0x0;var _0x34ab8f=_0x702d[_0x11f518];return _0x34ab8f;};'use strict';var multer=require(_0xd702('0x0'));var util=require(_0xd702('0x1'));var path=require(_0xd702('0x2'));var timeout=require(_0xd702('0x3'));var express=require(_0xd702('0x4'));var router=express['Router']();var fs_extra=require(_0xd702('0x5'));var auth=require(_0xd702('0x6'));var interaction=require(_0xd702('0x7'));var config=require(_0xd702('0x8'));var controller=require('./faxMessage.controller');router[_0xd702('0x9')]('/',auth['isAuthenticated'](),controller[_0xd702('0xa')]);router[_0xd702('0x9')](_0xd702('0xb'),auth['isAuthenticated'](),controller[_0xd702('0xc')]);router['get'](_0xd702('0xd'),auth[_0xd702('0xe')](),controller[_0xd702('0xf')]);router[_0xd702('0x9')](_0xd702('0x10'),auth[_0xd702('0xe')](),controller[_0xd702('0x11')]);router[_0xd702('0x12')]('/',auth[_0xd702('0xe')](),interaction[_0xd702('0x13')]('fax','faxmessage:create'),controller[_0xd702('0x14')]);router[_0xd702('0x15')](_0xd702('0xd'),auth['isAuthenticated'](),controller[_0xd702('0x16')]);router[_0xd702('0x15')](_0xd702('0x17'),auth[_0xd702('0xe')](),controller[_0xd702('0x18')]);router[_0xd702('0x15')]('/:id/reject',auth[_0xd702('0xe')](),controller[_0xd702('0x19')]);router['delete'](_0xd702('0xd'),auth['isAuthenticated'](),controller[_0xd702('0x1a')]);module[_0xd702('0x1b')]=router; \ No newline at end of file +var _0x668b=['create','put','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports','multer','util','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./faxMessage.controller','isAuthenticated','index','get','/describe','describe','/:id','show','/:id/download','download','post','tracked','fax','faxmessage:create'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x668b,0x140));var _0xb668=function(_0x480bc8,_0x1fac40){_0x480bc8=_0x480bc8-0x0;var _0x28c245=_0x668b[_0x480bc8];return _0x28c245;};'use strict';var multer=require(_0xb668('0x0'));var util=require(_0xb668('0x1'));var path=require('path');var timeout=require(_0xb668('0x2'));var express=require(_0xb668('0x3'));var router=express['Router']();var fs_extra=require(_0xb668('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xb668('0x5'));var config=require(_0xb668('0x6'));var controller=require(_0xb668('0x7'));router['get']('/',auth[_0xb668('0x8')](),controller[_0xb668('0x9')]);router[_0xb668('0xa')](_0xb668('0xb'),auth[_0xb668('0x8')](),controller[_0xb668('0xc')]);router['get'](_0xb668('0xd'),auth[_0xb668('0x8')](),controller[_0xb668('0xe')]);router[_0xb668('0xa')](_0xb668('0xf'),auth[_0xb668('0x8')](),controller[_0xb668('0x10')]);router[_0xb668('0x11')]('/',auth['isAuthenticated'](),interaction[_0xb668('0x12')](_0xb668('0x13'),_0xb668('0x14')),controller[_0xb668('0x15')]);router[_0xb668('0x16')](_0xb668('0xd'),auth[_0xb668('0x8')](),controller[_0xb668('0x17')]);router[_0xb668('0x16')](_0xb668('0x18'),auth[_0xb668('0x8')](),controller[_0xb668('0x19')]);router[_0xb668('0x16')](_0xb668('0x1a'),auth[_0xb668('0x8')](),controller[_0xb668('0x1b')]);router[_0xb668('0x1c')](_0xb668('0xd'),auth[_0xb668('0x8')](),controller[_0xb668('0x1d')]);module[_0xb668('0x1e')]=router; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.attributes.js b/server/api/faxQueue/faxQueue.attributes.js index bc3bed4..9a8defa 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 _0x1173=['exports','STRING','INTEGER','ENUM','rrmemory','roundrobin'];(function(_0x26bd9a,_0x5d6f00){var _0x158159=function(_0x40a123){while(--_0x40a123){_0x26bd9a['push'](_0x26bd9a['shift']());}};_0x158159(++_0x5d6f00);}(_0x1173,0x138));var _0x3117=function(_0x3bc730,_0xa7112b){_0x3bc730=_0x3bc730-0x0;var _0x4a7d76=_0x1173[_0x3bc730];return _0x4a7d76;};'use strict';var Sequelize=require('sequelize');module[_0x3117('0x0')]={'name':{'type':Sequelize[_0x3117('0x1')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x3117('0x2')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x3117('0x3')](_0x3117('0x4'),'beepall',_0x3117('0x5')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0x3117('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x6cb2=['rrmemory','roundrobin','sequelize','exports','STRING','name','INTEGER','ENUM'];(function(_0x17e6b2,_0xb25987){var _0x4c500b=function(_0x2a2e90){while(--_0x2a2e90){_0x17e6b2['push'](_0x17e6b2['shift']());}};_0x4c500b(++_0xb25987);}(_0x6cb2,0xfa));var _0x26cb=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x6cb2[_0x19950b];return _0x3c6b41;};'use strict';var Sequelize=require(_0x26cb('0x0'));module[_0x26cb('0x1')]={'name':{'type':Sequelize[_0x26cb('0x2')],'unique':_0x26cb('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x26cb('0x4')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x26cb('0x5')](_0x26cb('0x6'),'beepall',_0x26cb('0x7')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0x26cb('0x4')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.controller.js b/server/api/faxQueue/faxQueue.controller.js index 0543867..6e375fc 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 _0x09c9=['removeAgents','emit','addAgents','omit','spread','userFaxQueue:save','isArray','userFaxQueue:remove','getAgents','findOne','zip-dir','fast-json-patch','request-promise','moment','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','redis','defaults','localhost','./faxQueue.socket','register','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','destroy','then','FaxQueues','UserProfileResource','error','stack','name','map','FaxQueue','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','show','keys','catch','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','userProfileId','autoAssociation','update','params','describe','getMembers','UserFaxQueue','FaxQueueId','findAndCountAll','createdAt','format','%s/%s','faxPause','getTeams','Team','ids','Agents','online','voicePause','interface','sequelize','transaction','addTeams','each','findOrCreate','removeTeams','User','select','tq.TeamId','team_has_fax_queues','join','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','includes','union','compact','isEmpty'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x09c9,0x116));var _0x909c=function(_0x1c9cad,_0x2e0fd4){_0x1c9cad=_0x1c9cad-0x0;var _0x417d45=_0x09c9[_0x1c9cad];return _0x417d45;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x909c('0x0'));var jsonpatch=require(_0x909c('0x1'));var rp=require(_0x909c('0x2'));var moment=require(_0x909c('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x909c('0x4'));var sox=require(_0x909c('0x5'));var csv=require(_0x909c('0x6'));var ejs=require(_0x909c('0x7'));var fs=require('fs');var fs_extra=require(_0x909c('0x8'));var _=require(_0x909c('0x9'));var squel=require('squel');var crypto=require(_0x909c('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x909c('0xb'));var toCsv=require('to-csv');var querystring=require(_0x909c('0xc'));var Papa=require(_0x909c('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x909c('0xe'));var as=require(_0x909c('0xf'));var hardwareService=require(_0x909c('0x10'));var logger=require(_0x909c('0x11'))('api');var utils=require('../../config/utils');var config=require(_0x909c('0x12'));var licenseUtil=require(_0x909c('0x13'));var db=require('../../mysqldb')['db'];config[_0x909c('0x14')]=_[_0x909c('0x15')](config[_0x909c('0x14')],{'host':_0x909c('0x16'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x909c('0x14')]));require(_0x909c('0x17'))[_0x909c('0x18')](socket);function respondWithStatusCode(_0x5aebe9,_0x250ccd){_0x250ccd=_0x250ccd||0xcc;return function(_0x4ec37f){if(_0x4ec37f){return _0x5aebe9[_0x909c('0x19')](_0x250ccd);}return _0x5aebe9[_0x909c('0x1a')](_0x250ccd)[_0x909c('0x1b')]();};}function respondWithResult(_0xcdf5aa,_0x1ab2da){_0x1ab2da=_0x1ab2da||0xc8;return function(_0x12e951){if(_0x12e951){return _0xcdf5aa[_0x909c('0x1a')](_0x1ab2da)['json'](_0x12e951);}};}function respondWithFilteredResult(_0x3a5f7f,_0x1efd2d){return function(_0x35cebf){if(_0x35cebf){var _0x41df19=typeof _0x1efd2d[_0x909c('0x1c')]===_0x909c('0x1d')&&typeof _0x1efd2d[_0x909c('0x1e')]==='undefined';var _0x2e88f3=_0x35cebf[_0x909c('0x1f')];var _0x4ac7dc=_0x41df19?0x0:_0x1efd2d[_0x909c('0x1c')];var _0x4fd4b3=_0x41df19?_0x35cebf[_0x909c('0x1f')]:_0x1efd2d[_0x909c('0x1c')]+_0x1efd2d['limit'];var _0x2254df;if(_0x4fd4b3>=_0x2e88f3){_0x4fd4b3=_0x2e88f3;_0x2254df=0xc8;}else{_0x2254df=0xce;}_0x3a5f7f['status'](_0x2254df);return _0x3a5f7f[_0x909c('0x20')](_0x909c('0x21'),_0x4ac7dc+'-'+_0x4fd4b3+'/'+_0x2e88f3)[_0x909c('0x22')](_0x35cebf);}return null;};}function patchUpdates(_0x20d5db){return function(_0x563c9b){try{jsonpatch[_0x909c('0x23')](_0x563c9b,_0x20d5db,!![]);}catch(_0x46a4f5){return BPromise[_0x909c('0x24')](_0x46a4f5);}return _0x563c9b[_0x909c('0x25')]();};}function saveUpdates(_0x3f0168,_0xffc4d3){return function(_0x20ca0b){if(_0x20ca0b){return _0x20ca0b['update'](_0x3f0168)['then'](function(_0x469164){return _0x469164;});}return null;};}function removeEntity(_0x19d72b,_0x49a723){return function(_0x58d582){if(_0x58d582){return _0x58d582[_0x909c('0x26')]()[_0x909c('0x27')](function(){var _0x2d3714=_0x58d582['get']({'plain':!![]});var _0x1b7738=_0x909c('0x28');return db[_0x909c('0x29')][_0x909c('0x26')]({'where':{'type':_0x1b7738,'resourceId':_0x2d3714['id']}})[_0x909c('0x27')](function(){return _0x58d582;});})['then'](function(){_0x19d72b['status'](0xcc)[_0x909c('0x1b')]();});}};}function handleEntityNotFound(_0x17cbdd,_0x5069eb){return function(_0x40b0f7){if(!_0x40b0f7){_0x17cbdd[_0x909c('0x19')](0x194);}return _0x40b0f7;};}function handleError(_0x849d62,_0x308de8){_0x308de8=_0x308de8||0x1f4;return function(_0xe9b65a){logger[_0x909c('0x2a')](_0xe9b65a[_0x909c('0x2b')]);if(_0xe9b65a['name']){delete _0xe9b65a[_0x909c('0x2c')];}_0x849d62[_0x909c('0x1a')](_0x308de8)['send'](_0xe9b65a);};}exports['index']=function(_0x1a1da2,_0x4ea6f2){var _0x52f66f={},_0x34f07a={},_0xba6e33={'count':0x0,'rows':[]};var _0x2e56a4=_[_0x909c('0x2d')](db[_0x909c('0x2e')][_0x909c('0x2f')],function(_0x60e77){return{'name':_0x60e77[_0x909c('0x30')],'type':_0x60e77[_0x909c('0x31')][_0x909c('0x32')]};});_0x34f07a['model']=_[_0x909c('0x2d')](_0x2e56a4,_0x909c('0x2c'));_0x34f07a[_0x909c('0x33')]=_['keys'](_0x1a1da2[_0x909c('0x33')]);_0x34f07a[_0x909c('0x34')]=_[_0x909c('0x35')](_0x34f07a[_0x909c('0x36')],_0x34f07a['query']);_0x52f66f[_0x909c('0x37')]=_[_0x909c('0x35')](_0x34f07a[_0x909c('0x36')],qs['fields'](_0x1a1da2['query'][_0x909c('0x38')]));_0x52f66f['attributes']=_0x52f66f[_0x909c('0x37')][_0x909c('0x39')]?_0x52f66f[_0x909c('0x37')]:_0x34f07a['model'];if(!_0x1a1da2[_0x909c('0x33')][_0x909c('0x3a')](_0x909c('0x3b'))){_0x52f66f[_0x909c('0x1e')]=qs['limit'](_0x1a1da2[_0x909c('0x33')]['limit']);_0x52f66f[_0x909c('0x1c')]=qs[_0x909c('0x1c')](_0x1a1da2[_0x909c('0x33')]['offset']);}_0x52f66f[_0x909c('0x3c')]=qs[_0x909c('0x3d')](_0x1a1da2['query'][_0x909c('0x3d')]);_0x52f66f[_0x909c('0x3e')]=qs['filters'](_[_0x909c('0x3f')](_0x1a1da2['query'],_0x34f07a['filters']),_0x2e56a4);if(_0x1a1da2[_0x909c('0x33')]['filter']){_0x52f66f[_0x909c('0x3e')]=_['merge'](_0x52f66f['where'],{'$or':_[_0x909c('0x2d')](_0x2e56a4,function(_0x51fbb0){if(_0x51fbb0[_0x909c('0x31')]!=='VIRTUAL'){var _0x4e7289={};_0x4e7289[_0x51fbb0[_0x909c('0x2c')]]={'$like':'%'+_0x1a1da2[_0x909c('0x33')][_0x909c('0x40')]+'%'};return _0x4e7289;}})});}_0x52f66f=_[_0x909c('0x41')]({},_0x52f66f,_0x1a1da2[_0x909c('0x42')]);var _0xbdbecf={'where':_0x52f66f['where']};return db[_0x909c('0x2e')][_0x909c('0x1f')](_0xbdbecf)[_0x909c('0x27')](function(_0x43137f){_0xba6e33[_0x909c('0x1f')]=_0x43137f;if(_0x1a1da2[_0x909c('0x33')][_0x909c('0x43')]){_0x52f66f[_0x909c('0x44')]=[{'all':!![]}];}return db['FaxQueue'][_0x909c('0x45')](_0x52f66f);})['then'](function(_0x1ada0a){_0xba6e33[_0x909c('0x46')]=_0x1ada0a;return _0xba6e33;})['then'](respondWithFilteredResult(_0x4ea6f2,_0x52f66f))['catch'](handleError(_0x4ea6f2,null));};exports[_0x909c('0x47')]=function(_0x4a1c22,_0x551b32){var _0x5e1abc={'raw':!![],'where':{'id':_0x4a1c22['params']['id']}},_0x4767ca={};_0x4767ca['model']=_[_0x909c('0x48')](db[_0x909c('0x2e')][_0x909c('0x2f')]);_0x4767ca[_0x909c('0x33')]=_[_0x909c('0x48')](_0x4a1c22[_0x909c('0x33')]);_0x4767ca[_0x909c('0x34')]=_[_0x909c('0x35')](_0x4767ca[_0x909c('0x36')],_0x4767ca[_0x909c('0x33')]);_0x5e1abc[_0x909c('0x37')]=_[_0x909c('0x35')](_0x4767ca[_0x909c('0x36')],qs[_0x909c('0x38')](_0x4a1c22[_0x909c('0x33')][_0x909c('0x38')]));_0x5e1abc[_0x909c('0x37')]=_0x5e1abc[_0x909c('0x37')][_0x909c('0x39')]?_0x5e1abc[_0x909c('0x37')]:_0x4767ca[_0x909c('0x36')];if(_0x4a1c22[_0x909c('0x33')]['includeAll']){_0x5e1abc[_0x909c('0x44')]=[{'all':!![]}];}_0x5e1abc=_[_0x909c('0x41')]({},_0x5e1abc,_0x4a1c22[_0x909c('0x42')]);return db[_0x909c('0x2e')]['find'](_0x5e1abc)[_0x909c('0x27')](handleEntityNotFound(_0x551b32,null))[_0x909c('0x27')](respondWithResult(_0x551b32,null))[_0x909c('0x49')](handleError(_0x551b32,null));};exports[_0x909c('0x4a')]=function(_0x14ba9a,_0x13eb9a){return db[_0x909c('0x2e')][_0x909c('0x4a')](_0x14ba9a[_0x909c('0x4b')],{})[_0x909c('0x27')](function(_0x42d3fe){var _0x3812e0=_0x14ba9a['user'][_0x909c('0x4c')]({'plain':!![]});if(!_0x3812e0)throw new Error(_0x909c('0x4d'));if(_0x3812e0['role']==='user'){var _0x631a9=_0x42d3fe[_0x909c('0x4c')]({'plain':!![]});var _0x3eea1e=_0x909c('0x28');return db[_0x909c('0x4e')][_0x909c('0x4f')]({'where':{'name':_0x3eea1e,'userProfileId':_0x3812e0[_0x909c('0x50')]},'raw':!![]})[_0x909c('0x27')](function(_0x17df58){if(_0x17df58&&_0x17df58[_0x909c('0x51')]===0x0){return db[_0x909c('0x29')]['create']({'name':_0x631a9['name'],'resourceId':_0x631a9['id'],'type':_0x17df58[_0x909c('0x2c')],'sectionId':_0x17df58['id']},{})['then'](function(){return _0x42d3fe;});}else{return _0x42d3fe;}})[_0x909c('0x49')](function(_0x59ca1d){logger[_0x909c('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x59ca1d);throw _0x59ca1d;});}return _0x42d3fe;})[_0x909c('0x27')](respondWithResult(_0x13eb9a,0xc9))[_0x909c('0x49')](handleError(_0x13eb9a,null));};exports[_0x909c('0x52')]=function(_0x3a0e15,_0x17c00f){if(_0x3a0e15[_0x909c('0x4b')]['id']){delete _0x3a0e15[_0x909c('0x4b')]['id'];}return db['FaxQueue']['find']({'where':{'id':_0x3a0e15[_0x909c('0x53')]['id']}})[_0x909c('0x27')](handleEntityNotFound(_0x17c00f,null))[_0x909c('0x27')](saveUpdates(_0x3a0e15[_0x909c('0x4b')],null))[_0x909c('0x27')](respondWithResult(_0x17c00f,null))['catch'](handleError(_0x17c00f,null));};exports[_0x909c('0x26')]=function(_0x56efbc,_0x252db3){return db[_0x909c('0x2e')][_0x909c('0x4f')]({'where':{'id':_0x56efbc[_0x909c('0x53')]['id']}})[_0x909c('0x27')](handleEntityNotFound(_0x252db3,null))[_0x909c('0x27')](removeEntity(_0x252db3,null))[_0x909c('0x49')](handleError(_0x252db3,null));};exports[_0x909c('0x54')]=function(_0x5971cc,_0x26a1f1){return db[_0x909c('0x2e')][_0x909c('0x54')]()[_0x909c('0x27')](respondWithResult(_0x26a1f1,null))[_0x909c('0x49')](handleError(_0x26a1f1,null));};exports[_0x909c('0x55')]=function(_0x307106,_0x31b7ca,_0x12bf86){var _0xc25e4d={'raw':!![],'where':{}},_0xda3ae4={},_0x71ea64;return db[_0x909c('0x2e')]['findOne']({'where':{'id':_0x307106[_0x909c('0x53')]['id']}})[_0x909c('0x27')](handleEntityNotFound(_0x31b7ca,null))[_0x909c('0x27')](function(_0x475731){if(_0x475731){_0x71ea64=_0x475731[_0x909c('0x4c')]({'plain':!![]});_0xda3ae4['model']=_[_0x909c('0x48')](db[_0x909c('0x56')][_0x909c('0x2f')]);_0xda3ae4['query']=_['keys'](_0x307106['query']);_0xda3ae4[_0x909c('0x34')]=_['intersection'](_0xda3ae4[_0x909c('0x36')],_0xda3ae4[_0x909c('0x33')]);_0xc25e4d[_0x909c('0x37')]=_['intersection'](_0xda3ae4['model'],qs[_0x909c('0x38')](_0x307106[_0x909c('0x33')][_0x909c('0x38')]));_0xc25e4d[_0x909c('0x37')]=_0xc25e4d[_0x909c('0x37')][_0x909c('0x39')]?_0xc25e4d[_0x909c('0x37')]:_0xda3ae4[_0x909c('0x36')];if(!_0x307106[_0x909c('0x33')][_0x909c('0x3a')](_0x909c('0x3b'))){_0xc25e4d['limit']=qs['limit'](_0x307106['query']['limit']);_0xc25e4d[_0x909c('0x1c')]=qs['offset'](_0x307106['query'][_0x909c('0x1c')]);}_0xc25e4d[_0x909c('0x3c')]=qs[_0x909c('0x3d')](_0x307106[_0x909c('0x33')]['sort']);_0xc25e4d['where']=qs[_0x909c('0x34')](_['pick'](_0x307106[_0x909c('0x33')],_0xda3ae4[_0x909c('0x34')]));_0xc25e4d[_0x909c('0x3e')][_0x909c('0x57')]=_0x475731['id'];if(_0x307106[_0x909c('0x33')][_0x909c('0x40')]){_0xc25e4d[_0x909c('0x3e')]=_['merge'](_0xc25e4d['where'],{'$or':_[_0x909c('0x2d')](_0xc25e4d[_0x909c('0x37')],function(_0x27d233){var _0x3c32aa={};_0x3c32aa[_0x27d233]={'$like':'%'+_0x307106[_0x909c('0x33')][_0x909c('0x40')]+'%'};return _0x3c32aa;})});}_0xc25e4d=_[_0x909c('0x41')]({},_0xc25e4d,_0x307106[_0x909c('0x42')]);return db[_0x909c('0x56')][_0x909c('0x45')](_0xc25e4d);}})[_0x909c('0x27')](function(_0x314e6f){if(_0x314e6f){return db['User'][_0x909c('0x58')]({'where':{'id':_[_0x909c('0x2d')](_0x314e6f,'UserId'),'role':'agent'},'attributes':['id',_0x909c('0x2c'),'faxPause','updatedAt',_0x909c('0x59')]});}})[_0x909c('0x27')](function(_0x5db30a){if(_0x5db30a){return{'count':_0x5db30a[_0x909c('0x1f')],'rows':_['map'](_0x5db30a['rows'],function(_0x1bfb8b){return{'membername':_0x1bfb8b['name'],'UserId':_0x1bfb8b['id'],'queue_name':_0x71ea64['name'],'FaxQueueId':_0x71ea64['id'],'interface':util[_0x909c('0x5a')](_0x909c('0x5b'),'SIP',_0x1bfb8b['name']),'penalty':0x0,'paused':_0x1bfb8b[_0x909c('0x5c')],'createdAt':_0x1bfb8b[_0x909c('0x59')],'updatedAt':_0x1bfb8b['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x909c('0x27')](respondWithFilteredResult(_0x31b7ca,_0xc25e4d))[_0x909c('0x49')](handleError(_0x31b7ca,null));};exports[_0x909c('0x5d')]=function(_0xb4c1aa,_0x37f58a,_0x259b53){var _0x4a2ac8={};var _0x5a2387={};var _0x4a9a43;var _0x5b5ed6;return db[_0x909c('0x2e')]['findOne']({'where':{'id':_0xb4c1aa[_0x909c('0x53')]['id']}})[_0x909c('0x27')](handleEntityNotFound(_0x37f58a,null))[_0x909c('0x27')](function(_0x2fb49a){if(_0x2fb49a){_0x4a9a43=_0x2fb49a;_0x5a2387[_0x909c('0x36')]=_[_0x909c('0x48')](db[_0x909c('0x5e')][_0x909c('0x2f')]);_0x5a2387[_0x909c('0x33')]=_[_0x909c('0x48')](_0xb4c1aa['query']);_0x5a2387[_0x909c('0x34')]=_[_0x909c('0x35')](_0x5a2387['model'],_0x5a2387[_0x909c('0x33')]);_0x4a2ac8[_0x909c('0x37')]=_[_0x909c('0x35')](_0x5a2387[_0x909c('0x36')],qs[_0x909c('0x38')](_0xb4c1aa['query'][_0x909c('0x38')]));_0x4a2ac8[_0x909c('0x37')]=_0x4a2ac8[_0x909c('0x37')][_0x909c('0x39')]?_0x4a2ac8[_0x909c('0x37')]:_0x5a2387[_0x909c('0x36')];_0x4a2ac8[_0x909c('0x3c')]=qs['sort'](_0xb4c1aa[_0x909c('0x33')][_0x909c('0x3d')]);_0x4a2ac8[_0x909c('0x3e')]=qs[_0x909c('0x34')](_[_0x909c('0x3f')](_0xb4c1aa['query'],_0x5a2387[_0x909c('0x34')]));if(_0xb4c1aa['query'][_0x909c('0x40')]){_0x4a2ac8[_0x909c('0x3e')]=_[_0x909c('0x41')](_0x4a2ac8[_0x909c('0x3e')],{'$or':_[_0x909c('0x2d')](_0x4a2ac8[_0x909c('0x37')],function(_0x3784db){var _0x43c0bf={};_0x43c0bf[_0x3784db]={'$like':'%'+_0xb4c1aa['query'][_0x909c('0x40')]+'%'};return _0x43c0bf;})});}_0x4a2ac8=_[_0x909c('0x41')]({},_0x4a2ac8,_0xb4c1aa[_0x909c('0x42')]);return _0x4a9a43[_0x909c('0x5d')](_0x4a2ac8);}})[_0x909c('0x27')](function(_0x343d7c){if(_0x343d7c){_0x5b5ed6=_0x343d7c[_0x909c('0x39')];if(!_0xb4c1aa[_0x909c('0x33')][_0x909c('0x3a')]('nolimit')){_0x4a2ac8[_0x909c('0x1e')]=qs[_0x909c('0x1e')](_0xb4c1aa[_0x909c('0x33')][_0x909c('0x1e')]);_0x4a2ac8[_0x909c('0x1c')]=qs[_0x909c('0x1c')](_0xb4c1aa[_0x909c('0x33')][_0x909c('0x1c')]);}return _0x4a9a43[_0x909c('0x5d')](_0x4a2ac8);}})[_0x909c('0x27')](function(_0x34b493){if(_0x34b493){return _0x34b493?{'count':_0x5b5ed6,'rows':_0x34b493}:null;}})[_0x909c('0x27')](respondWithResult(_0x37f58a,null))[_0x909c('0x49')](handleError(_0x37f58a,null));};exports['addTeams']=function(_0x37ee19,_0x4681e9,_0x466fd1){var _0x2adf72=_0x37ee19[_0x909c('0x4b')][_0x909c('0x5f')];return db[_0x909c('0x5e')]['findAll']({'where':{'id':_0x2adf72},'attributes':['id'],'include':[{'model':db['User'],'as':_0x909c('0x60'),'attributes':['id','name',_0x909c('0x61'),_0x909c('0x62'),_0x909c('0x63')],'raw':!![]}]})[_0x909c('0x27')](function(_0x447fb0){if(_0x447fb0){var _0x513e53=_['flatMap'](_0x447fb0,function(_0x5be009){var _0x41f581=_0x5be009['get']({'plain':!![]});return _0x41f581[_0x909c('0x60')];});return db[_0x909c('0x2e')][_0x909c('0x4f')]({'where':{'id':_0x37ee19[_0x909c('0x53')]['id']}})[_0x909c('0x27')](function(_0x59eb08){return db[_0x909c('0x64')][_0x909c('0x65')](function(_0x408120){return _0x59eb08[_0x909c('0x66')](_0x2adf72,{'transaction':_0x408120})[_0x909c('0x27')](function(){return BPromise[_0x909c('0x67')](_0x513e53,function(_0x5de2c2){return db[_0x909c('0x56')][_0x909c('0x68')]({'where':{'UserId':_0x5de2c2['id'],'FaxQueueId':_0x37ee19[_0x909c('0x53')]['id']},'transaction':_0x408120});});})[_0x909c('0x27')](function(){_0x513e53['forEach'](function(_0x539550){socket['emit']('userFaxQueue:save',{'UserId':_0x539550['id'],'FaxQueueId':_0x59eb08['id']});});});});});}})[_0x909c('0x27')](respondWithStatusCode(_0x4681e9,null))[_0x909c('0x49')](handleError(_0x4681e9,null));};exports[_0x909c('0x69')]=function(_0x5970cb,_0x64a63a,_0x3363ac){return db['Team'][_0x909c('0x45')]({'where':{'id':_0x5970cb[_0x909c('0x33')]['ids']},'attributes':['id'],'include':[{'model':db[_0x909c('0x6a')],'as':_0x909c('0x60'),'attributes':['id'],'raw':!![]}]})[_0x909c('0x27')](handleEntityNotFound(_0x64a63a,null))[_0x909c('0x27')](function(_0x45739d){var _0x3961ed=_[_0x909c('0x2d')](_0x45739d,'id');var _0x37be10=[];var _0x435ea8=[];var _0x2e8abb=squel[_0x909c('0x6b')]();_0x2e8abb['field'](_0x909c('0x6c'))['from'](_0x909c('0x6d'),'tq')[_0x909c('0x6e')]('user_has_teams','ut',_0x909c('0x6f'))['where'](_0x909c('0x70'),_0x5970cb[_0x909c('0x53')]['id']);for(var _0x23ea41=0x0;_0x23ea41<_0x45739d['length'];_0x23ea41+=0x1){let _0x5c0b36=_0x45739d[_0x23ea41];for(var _0x348545=0x0;_0x348545<_0x5c0b36[_0x909c('0x60')][_0x909c('0x39')];_0x348545+=0x1){let _0x5239b4=_0x5c0b36[_0x909c('0x60')][_0x348545];var _0x4c0c6d=_0x2e8abb['clone']();_0x4c0c6d[_0x909c('0x3e')](_0x909c('0x71'),_0x5239b4['id']);_0x435ea8[_0x909c('0x72')](db[_0x909c('0x64')][_0x909c('0x33')](_0x4c0c6d[_0x909c('0x73')](),{'type':db[_0x909c('0x64')][_0x909c('0x74')][_0x909c('0x75')]})[_0x909c('0x27')](function(_0x30e7c1){if(_0x30e7c1[_0x909c('0x39')]===0x1){return _0x5239b4['id'];}else{var _0x20339f=_[_0x909c('0x76')](_[_0x909c('0x2d')](_0x30e7c1,_0x909c('0x77')),function(_0x5133d6){return _[_0x909c('0x78')](_0x3961ed,_0x5133d6);});if(_0x20339f){return _0x5239b4['id'];}}}));}}return BPromise['all'](_0x435ea8)[_0x909c('0x27')](function(_0x4c6bb0){_0x37be10=_(_0x37be10)[_0x909c('0x79')](_0x4c6bb0)[_0x909c('0x7a')]()['value']();return db[_0x909c('0x2e')]['find']({'where':{'id':_0x5970cb['params']['id']}})[_0x909c('0x27')](function(_0x12c956){return db[_0x909c('0x64')][_0x909c('0x65')](function(_0xfd50e4){return _0x12c956['removeTeams'](_0x5970cb[_0x909c('0x33')][_0x909c('0x5f')],{'transaction':_0xfd50e4})[_0x909c('0x27')](function(){if(!_[_0x909c('0x7b')](_0x37be10)){return _0x12c956[_0x909c('0x7c')](_0x37be10,{'transaction':_0xfd50e4});}})['then'](function(){_0x37be10['forEach'](function(_0x2ba33f){socket[_0x909c('0x7d')]('userFaxQueue:remove',{'UserId':_0x2ba33f,'FaxQueueId':_0x12c956['id']});});});});});});})[_0x909c('0x27')](respondWithStatusCode(_0x64a63a,null))[_0x909c('0x49')](handleError(_0x64a63a,null));};exports[_0x909c('0x7e')]=function(_0x43eac4,_0x1e5069,_0x1f2427){return db[_0x909c('0x2e')][_0x909c('0x4f')]({'where':{'id':_0x43eac4[_0x909c('0x53')]['id']}})['then'](handleEntityNotFound(_0x1e5069,null))[_0x909c('0x27')](function(_0xa6f85d){if(_0xa6f85d){return _0xa6f85d[_0x909c('0x7e')](_0x43eac4[_0x909c('0x4b')][_0x909c('0x5f')],_[_0x909c('0x7f')](_0x43eac4['body'],[_0x909c('0x5f'),'id'])||{})[_0x909c('0x80')](function(_0x1a4312){for(var _0x25c813=0x0;_0x25c813<_0x43eac4[_0x909c('0x4b')][_0x909c('0x5f')][_0x909c('0x39')];_0x25c813+=0x1){socket[_0x909c('0x7d')](_0x909c('0x81'),{'UserId':Number(_0x43eac4[_0x909c('0x4b')][_0x909c('0x5f')][_0x25c813]),'FaxQueueId':Number(_0x43eac4[_0x909c('0x53')]['id'])});}return _0x1a4312;});}})[_0x909c('0x27')](respondWithResult(_0x1e5069,null))['catch'](handleError(_0x1e5069,null));};exports[_0x909c('0x7c')]=function(_0x276260,_0x2c4a17,_0x53d9bb){return db['FaxQueue'][_0x909c('0x4f')]({'where':{'id':_0x276260[_0x909c('0x53')]['id']}})[_0x909c('0x27')](handleEntityNotFound(_0x2c4a17,null))[_0x909c('0x27')](function(_0x4e4ab6){if(_0x4e4ab6){return _0x4e4ab6[_0x909c('0x7c')](_0x276260[_0x909c('0x33')][_0x909c('0x5f')])[_0x909c('0x27')](function(){if(_[_0x909c('0x82')](_0x276260['query'][_0x909c('0x5f')])){for(var _0x193404=0x0;_0x193404<_0x276260[_0x909c('0x33')]['ids']['length'];_0x193404+=0x1){socket['emit'](_0x909c('0x83'),{'UserId':Number(_0x276260[_0x909c('0x33')][_0x909c('0x5f')][_0x193404]),'FaxQueueId':Number(_0x276260['params']['id'])});}}else{socket[_0x909c('0x7d')](_0x909c('0x83'),{'UserId':Number(_0x276260[_0x909c('0x33')]['ids']),'FaxQueueId':Number(_0x276260['params']['id'])});}});}})[_0x909c('0x27')](respondWithStatusCode(_0x2c4a17,null))['catch'](handleError(_0x2c4a17,null));};exports[_0x909c('0x84')]=function(_0x4be9e9,_0x2389c9,_0x4489cb){var _0x1dcd96={};var _0x477577={};var _0x316adf;var _0x4f62fd;return db[_0x909c('0x2e')][_0x909c('0x85')]({'where':{'id':_0x4be9e9[_0x909c('0x53')]['id']}})['then'](handleEntityNotFound(_0x2389c9,null))[_0x909c('0x27')](function(_0x4d7820){if(_0x4d7820){_0x316adf=_0x4d7820;_0x477577[_0x909c('0x36')]=_[_0x909c('0x48')](db['User']['rawAttributes']);_0x477577['query']=_[_0x909c('0x48')](_0x4be9e9['query']);_0x477577[_0x909c('0x34')]=_[_0x909c('0x35')](_0x477577['model'],_0x477577[_0x909c('0x33')]);_0x1dcd96[_0x909c('0x37')]=_[_0x909c('0x35')](_0x477577[_0x909c('0x36')],qs[_0x909c('0x38')](_0x4be9e9[_0x909c('0x33')][_0x909c('0x38')]));_0x1dcd96[_0x909c('0x37')]=_0x1dcd96['attributes']['length']?_0x1dcd96['attributes']:_0x477577['model'];_0x1dcd96[_0x909c('0x3c')]=qs[_0x909c('0x3d')](_0x4be9e9[_0x909c('0x33')][_0x909c('0x3d')]);_0x1dcd96[_0x909c('0x3e')]=qs['filters'](_['pick'](_0x4be9e9[_0x909c('0x33')],_0x477577[_0x909c('0x34')]));if(_0x4be9e9[_0x909c('0x33')][_0x909c('0x40')]){_0x1dcd96[_0x909c('0x3e')]=_[_0x909c('0x41')](_0x1dcd96[_0x909c('0x3e')],{'$or':_[_0x909c('0x2d')](_0x1dcd96[_0x909c('0x37')],function(_0x10fb20){var _0x5d9b84={};_0x5d9b84[_0x10fb20]={'$like':'%'+_0x4be9e9[_0x909c('0x33')][_0x909c('0x40')]+'%'};return _0x5d9b84;})});}_0x1dcd96=_[_0x909c('0x41')]({},_0x1dcd96,_0x4be9e9[_0x909c('0x42')]);return _0x316adf['getAgents'](_0x1dcd96);}})[_0x909c('0x27')](function(_0x3de8c8){if(_0x3de8c8){_0x4f62fd=_0x3de8c8['length'];if(!_0x4be9e9[_0x909c('0x33')][_0x909c('0x3a')](_0x909c('0x3b'))){_0x1dcd96[_0x909c('0x1e')]=qs['limit'](_0x4be9e9[_0x909c('0x33')]['limit']);_0x1dcd96['offset']=qs[_0x909c('0x1c')](_0x4be9e9[_0x909c('0x33')][_0x909c('0x1c')]);}return _0x316adf[_0x909c('0x84')](_0x1dcd96);}})[_0x909c('0x27')](function(_0x59d4ab){if(_0x59d4ab){return _0x59d4ab?{'count':_0x4f62fd,'rows':_0x59d4ab}:null;}})[_0x909c('0x27')](respondWithResult(_0x2389c9,null))['catch'](handleError(_0x2389c9,null));}; \ No newline at end of file +var _0x4cdb=['index','map','FaxQueue','rawAttributes','fieldName','type','key','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','filter','findAll','rows','catch','show','params','includeAll','include','options','find','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','error','body','describe','getMembers','findOne','UserFaxQueue','User','findAndCountAll','UserId','updatedAt','createdAt','format','%s/%s','SIP','faxPause','getTeams','addTeams','ids','Agents','online','voicePause','interface','sequelize','each','findOrCreate','forEach','emit','userFaxQueue:save','removeTeams','Team','select','field','tq.TeamId','team_has_fax_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','value','transaction','isEmpty','removeAgents','userFaxQueue:remove','addAgents','omit','spread','isArray','getAgents','eml-format','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','register','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','destroy','then','FaxQueues','UserProfileResource','name','send'];(function(_0x1d2054,_0x3ba7cc){var _0x4e0173=function(_0x131e86){while(--_0x131e86){_0x1d2054['push'](_0x1d2054['shift']());}};_0x4e0173(++_0x3ba7cc);}(_0x4cdb,0xee));var _0xb4cd=function(_0x1f36bb,_0x8af718){_0x1f36bb=_0x1f36bb-0x0;var _0xaf97fa=_0x4cdb[_0x1f36bb];return _0xaf97fa;};'use strict';var emlformat=require(_0xb4cd('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb4cd('0x1'));var jsonpatch=require(_0xb4cd('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xb4cd('0x3'));var Mustache=require(_0xb4cd('0x4'));var util=require(_0xb4cd('0x5'));var path=require(_0xb4cd('0x6'));var sox=require(_0xb4cd('0x7'));var csv=require(_0xb4cd('0x8'));var ejs=require(_0xb4cd('0x9'));var fs=require('fs');var fs_extra=require(_0xb4cd('0xa'));var _=require(_0xb4cd('0xb'));var squel=require(_0xb4cd('0xc'));var crypto=require('crypto');var jsforce=require(_0xb4cd('0xd'));var deskjs=require(_0xb4cd('0xe'));var toCsv=require(_0xb4cd('0x8'));var querystring=require('querystring');var Papa=require(_0xb4cd('0xf'));var Redis=require(_0xb4cd('0x10'));var authService=require(_0xb4cd('0x11'));var qs=require(_0xb4cd('0x12'));var as=require(_0xb4cd('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb4cd('0x14'))(_0xb4cd('0x15'));var utils=require(_0xb4cd('0x16'));var config=require(_0xb4cd('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xb4cd('0x18'))['db'];config[_0xb4cd('0x19')]=_[_0xb4cd('0x1a')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./faxQueue.socket')[_0xb4cd('0x1b')](socket);function respondWithStatusCode(_0x2bc96e,_0x2f6804){_0x2f6804=_0x2f6804||0xcc;return function(_0x38c180){if(_0x38c180){return _0x2bc96e[_0xb4cd('0x1c')](_0x2f6804);}return _0x2bc96e[_0xb4cd('0x1d')](_0x2f6804)[_0xb4cd('0x1e')]();};}function respondWithResult(_0x2631f9,_0x36c2f1){_0x36c2f1=_0x36c2f1||0xc8;return function(_0x26e10e){if(_0x26e10e){return _0x2631f9[_0xb4cd('0x1d')](_0x36c2f1)[_0xb4cd('0x1f')](_0x26e10e);}};}function respondWithFilteredResult(_0x4fe807,_0x345c05){return function(_0x2fd90f){if(_0x2fd90f){var _0x404473=typeof _0x345c05[_0xb4cd('0x20')]==='undefined'&&typeof _0x345c05[_0xb4cd('0x21')]===_0xb4cd('0x22');var _0x41b422=_0x2fd90f['count'];var _0x3a983b=_0x404473?0x0:_0x345c05[_0xb4cd('0x20')];var _0x2cb402=_0x404473?_0x2fd90f[_0xb4cd('0x23')]:_0x345c05[_0xb4cd('0x20')]+_0x345c05[_0xb4cd('0x21')];var _0x5d0e0e;if(_0x2cb402>=_0x41b422){_0x2cb402=_0x41b422;_0x5d0e0e=0xc8;}else{_0x5d0e0e=0xce;}_0x4fe807['status'](_0x5d0e0e);return _0x4fe807[_0xb4cd('0x24')](_0xb4cd('0x25'),_0x3a983b+'-'+_0x2cb402+'/'+_0x41b422)['json'](_0x2fd90f);}return null;};}function patchUpdates(_0x1c1799){return function(_0x8a0053){try{jsonpatch[_0xb4cd('0x26')](_0x8a0053,_0x1c1799,!![]);}catch(_0x3c214c){return BPromise[_0xb4cd('0x27')](_0x3c214c);}return _0x8a0053[_0xb4cd('0x28')]();};}function saveUpdates(_0x481d36,_0x7336ff){return function(_0x362104){if(_0x362104){return _0x362104[_0xb4cd('0x29')](_0x481d36)['then'](function(_0x208b36){return _0x208b36;});}return null;};}function removeEntity(_0x5cb309,_0x5e87b6){return function(_0x3bfbc6){if(_0x3bfbc6){return _0x3bfbc6[_0xb4cd('0x2a')]()[_0xb4cd('0x2b')](function(){var _0x3dd086=_0x3bfbc6['get']({'plain':!![]});var _0x55b988=_0xb4cd('0x2c');return db[_0xb4cd('0x2d')][_0xb4cd('0x2a')]({'where':{'type':_0x55b988,'resourceId':_0x3dd086['id']}})[_0xb4cd('0x2b')](function(){return _0x3bfbc6;});})['then'](function(){_0x5cb309[_0xb4cd('0x1d')](0xcc)[_0xb4cd('0x1e')]();});}};}function handleEntityNotFound(_0x44e78a,_0x3f072a){return function(_0xf53c1){if(!_0xf53c1){_0x44e78a[_0xb4cd('0x1c')](0x194);}return _0xf53c1;};}function handleError(_0x50a272,_0x9049f){_0x9049f=_0x9049f||0x1f4;return function(_0x17de90){logger['error'](_0x17de90['stack']);if(_0x17de90[_0xb4cd('0x2e')]){delete _0x17de90[_0xb4cd('0x2e')];}_0x50a272['status'](_0x9049f)[_0xb4cd('0x2f')](_0x17de90);};}exports[_0xb4cd('0x30')]=function(_0x1d72db,_0xad0970){var _0x2980ce={},_0x55091a={},_0x4fbd4a={'count':0x0,'rows':[]};var _0x14ce3d=_[_0xb4cd('0x31')](db[_0xb4cd('0x32')][_0xb4cd('0x33')],function(_0x34bc89){return{'name':_0x34bc89[_0xb4cd('0x34')],'type':_0x34bc89[_0xb4cd('0x35')][_0xb4cd('0x36')]};});_0x55091a['model']=_[_0xb4cd('0x31')](_0x14ce3d,'name');_0x55091a[_0xb4cd('0x37')]=_[_0xb4cd('0x38')](_0x1d72db[_0xb4cd('0x37')]);_0x55091a[_0xb4cd('0x39')]=_['intersection'](_0x55091a[_0xb4cd('0x3a')],_0x55091a[_0xb4cd('0x37')]);_0x2980ce[_0xb4cd('0x3b')]=_[_0xb4cd('0x3c')](_0x55091a['model'],qs[_0xb4cd('0x3d')](_0x1d72db[_0xb4cd('0x37')][_0xb4cd('0x3d')]));_0x2980ce['attributes']=_0x2980ce[_0xb4cd('0x3b')][_0xb4cd('0x3e')]?_0x2980ce[_0xb4cd('0x3b')]:_0x55091a['model'];if(!_0x1d72db[_0xb4cd('0x37')][_0xb4cd('0x3f')](_0xb4cd('0x40'))){_0x2980ce['limit']=qs[_0xb4cd('0x21')](_0x1d72db[_0xb4cd('0x37')][_0xb4cd('0x21')]);_0x2980ce[_0xb4cd('0x20')]=qs['offset'](_0x1d72db[_0xb4cd('0x37')][_0xb4cd('0x20')]);}_0x2980ce[_0xb4cd('0x41')]=qs['sort'](_0x1d72db[_0xb4cd('0x37')][_0xb4cd('0x42')]);_0x2980ce[_0xb4cd('0x43')]=qs[_0xb4cd('0x39')](_[_0xb4cd('0x44')](_0x1d72db[_0xb4cd('0x37')],_0x55091a[_0xb4cd('0x39')]),_0x14ce3d);if(_0x1d72db['query']['filter']){_0x2980ce[_0xb4cd('0x43')]=_[_0xb4cd('0x45')](_0x2980ce['where'],{'$or':_[_0xb4cd('0x31')](_0x14ce3d,function(_0x3fd268){if(_0x3fd268[_0xb4cd('0x35')]!=='VIRTUAL'){var _0x48e126={};_0x48e126[_0x3fd268[_0xb4cd('0x2e')]]={'$like':'%'+_0x1d72db['query'][_0xb4cd('0x46')]+'%'};return _0x48e126;}})});}_0x2980ce=_[_0xb4cd('0x45')]({},_0x2980ce,_0x1d72db['options']);var _0x3ac14b={'where':_0x2980ce[_0xb4cd('0x43')]};return db['FaxQueue'][_0xb4cd('0x23')](_0x3ac14b)[_0xb4cd('0x2b')](function(_0x43877a){_0x4fbd4a[_0xb4cd('0x23')]=_0x43877a;if(_0x1d72db[_0xb4cd('0x37')]['includeAll']){_0x2980ce['include']=[{'all':!![]}];}return db[_0xb4cd('0x32')][_0xb4cd('0x47')](_0x2980ce);})[_0xb4cd('0x2b')](function(_0x532de6){_0x4fbd4a[_0xb4cd('0x48')]=_0x532de6;return _0x4fbd4a;})['then'](respondWithFilteredResult(_0xad0970,_0x2980ce))[_0xb4cd('0x49')](handleError(_0xad0970,null));};exports[_0xb4cd('0x4a')]=function(_0x4ad421,_0x1e54ce){var _0x5b05fa={'raw':!![],'where':{'id':_0x4ad421[_0xb4cd('0x4b')]['id']}},_0x30bb5c={};_0x30bb5c[_0xb4cd('0x3a')]=_[_0xb4cd('0x38')](db[_0xb4cd('0x32')][_0xb4cd('0x33')]);_0x30bb5c[_0xb4cd('0x37')]=_['keys'](_0x4ad421[_0xb4cd('0x37')]);_0x30bb5c[_0xb4cd('0x39')]=_[_0xb4cd('0x3c')](_0x30bb5c[_0xb4cd('0x3a')],_0x30bb5c[_0xb4cd('0x37')]);_0x5b05fa[_0xb4cd('0x3b')]=_[_0xb4cd('0x3c')](_0x30bb5c['model'],qs['fields'](_0x4ad421[_0xb4cd('0x37')][_0xb4cd('0x3d')]));_0x5b05fa[_0xb4cd('0x3b')]=_0x5b05fa[_0xb4cd('0x3b')]['length']?_0x5b05fa['attributes']:_0x30bb5c[_0xb4cd('0x3a')];if(_0x4ad421[_0xb4cd('0x37')][_0xb4cd('0x4c')]){_0x5b05fa[_0xb4cd('0x4d')]=[{'all':!![]}];}_0x5b05fa=_[_0xb4cd('0x45')]({},_0x5b05fa,_0x4ad421[_0xb4cd('0x4e')]);return db[_0xb4cd('0x32')][_0xb4cd('0x4f')](_0x5b05fa)[_0xb4cd('0x2b')](handleEntityNotFound(_0x1e54ce,null))[_0xb4cd('0x2b')](respondWithResult(_0x1e54ce,null))[_0xb4cd('0x49')](handleError(_0x1e54ce,null));};exports['create']=function(_0x5a1e2f,_0x3d821c){return db['FaxQueue']['create'](_0x5a1e2f['body'],{})[_0xb4cd('0x2b')](function(_0x4ef2be){var _0x366a3b=_0x5a1e2f[_0xb4cd('0x50')][_0xb4cd('0x51')]({'plain':!![]});if(!_0x366a3b)throw new Error(_0xb4cd('0x52'));if(_0x366a3b[_0xb4cd('0x53')]===_0xb4cd('0x50')){var _0x5b80d6=_0x4ef2be[_0xb4cd('0x51')]({'plain':!![]});var _0x4b1790=_0xb4cd('0x2c');return db['UserProfileSection'][_0xb4cd('0x4f')]({'where':{'name':_0x4b1790,'userProfileId':_0x366a3b[_0xb4cd('0x54')]},'raw':!![]})[_0xb4cd('0x2b')](function(_0x4b5ae8){if(_0x4b5ae8&&_0x4b5ae8['autoAssociation']===0x0){return db[_0xb4cd('0x2d')]['create']({'name':_0x5b80d6[_0xb4cd('0x2e')],'resourceId':_0x5b80d6['id'],'type':_0x4b5ae8['name'],'sectionId':_0x4b5ae8['id']},{})[_0xb4cd('0x2b')](function(){return _0x4ef2be;});}else{return _0x4ef2be;}})['catch'](function(_0x14433d){logger[_0xb4cd('0x55')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x14433d);throw _0x14433d;});}return _0x4ef2be;})[_0xb4cd('0x2b')](respondWithResult(_0x3d821c,0xc9))[_0xb4cd('0x49')](handleError(_0x3d821c,null));};exports[_0xb4cd('0x29')]=function(_0x2696c5,_0x39f508){if(_0x2696c5[_0xb4cd('0x56')]['id']){delete _0x2696c5['body']['id'];}return db['FaxQueue']['find']({'where':{'id':_0x2696c5[_0xb4cd('0x4b')]['id']}})[_0xb4cd('0x2b')](handleEntityNotFound(_0x39f508,null))[_0xb4cd('0x2b')](saveUpdates(_0x2696c5[_0xb4cd('0x56')],null))['then'](respondWithResult(_0x39f508,null))[_0xb4cd('0x49')](handleError(_0x39f508,null));};exports[_0xb4cd('0x2a')]=function(_0x42bea8,_0x31b897){return db[_0xb4cd('0x32')][_0xb4cd('0x4f')]({'where':{'id':_0x42bea8[_0xb4cd('0x4b')]['id']}})['then'](handleEntityNotFound(_0x31b897,null))[_0xb4cd('0x2b')](removeEntity(_0x31b897,null))[_0xb4cd('0x49')](handleError(_0x31b897,null));};exports[_0xb4cd('0x57')]=function(_0x2a2391,_0x1f5c88){return db[_0xb4cd('0x32')][_0xb4cd('0x57')]()[_0xb4cd('0x2b')](respondWithResult(_0x1f5c88,null))[_0xb4cd('0x49')](handleError(_0x1f5c88,null));};exports[_0xb4cd('0x58')]=function(_0x31fe76,_0x521d31,_0x3f65b7){var _0x44b72e={'raw':!![],'where':{}},_0x2a0904={},_0x5dc3b6;return db[_0xb4cd('0x32')][_0xb4cd('0x59')]({'where':{'id':_0x31fe76[_0xb4cd('0x4b')]['id']}})[_0xb4cd('0x2b')](handleEntityNotFound(_0x521d31,null))['then'](function(_0x2684bf){if(_0x2684bf){_0x5dc3b6=_0x2684bf['get']({'plain':!![]});_0x2a0904[_0xb4cd('0x3a')]=_[_0xb4cd('0x38')](db[_0xb4cd('0x5a')][_0xb4cd('0x33')]);_0x2a0904[_0xb4cd('0x37')]=_['keys'](_0x31fe76[_0xb4cd('0x37')]);_0x2a0904['filters']=_[_0xb4cd('0x3c')](_0x2a0904['model'],_0x2a0904[_0xb4cd('0x37')]);_0x44b72e['attributes']=_[_0xb4cd('0x3c')](_0x2a0904[_0xb4cd('0x3a')],qs[_0xb4cd('0x3d')](_0x31fe76[_0xb4cd('0x37')][_0xb4cd('0x3d')]));_0x44b72e[_0xb4cd('0x3b')]=_0x44b72e[_0xb4cd('0x3b')][_0xb4cd('0x3e')]?_0x44b72e[_0xb4cd('0x3b')]:_0x2a0904[_0xb4cd('0x3a')];if(!_0x31fe76[_0xb4cd('0x37')]['hasOwnProperty'](_0xb4cd('0x40'))){_0x44b72e['limit']=qs['limit'](_0x31fe76[_0xb4cd('0x37')][_0xb4cd('0x21')]);_0x44b72e[_0xb4cd('0x20')]=qs[_0xb4cd('0x20')](_0x31fe76[_0xb4cd('0x37')][_0xb4cd('0x20')]);}_0x44b72e[_0xb4cd('0x41')]=qs[_0xb4cd('0x42')](_0x31fe76['query']['sort']);_0x44b72e[_0xb4cd('0x43')]=qs[_0xb4cd('0x39')](_[_0xb4cd('0x44')](_0x31fe76[_0xb4cd('0x37')],_0x2a0904['filters']));_0x44b72e[_0xb4cd('0x43')]['FaxQueueId']=_0x2684bf['id'];if(_0x31fe76[_0xb4cd('0x37')][_0xb4cd('0x46')]){_0x44b72e[_0xb4cd('0x43')]=_[_0xb4cd('0x45')](_0x44b72e['where'],{'$or':_['map'](_0x44b72e[_0xb4cd('0x3b')],function(_0x36231d){var _0x384ffd={};_0x384ffd[_0x36231d]={'$like':'%'+_0x31fe76[_0xb4cd('0x37')][_0xb4cd('0x46')]+'%'};return _0x384ffd;})});}_0x44b72e=_[_0xb4cd('0x45')]({},_0x44b72e,_0x31fe76[_0xb4cd('0x4e')]);return db['UserFaxQueue'][_0xb4cd('0x47')](_0x44b72e);}})[_0xb4cd('0x2b')](function(_0x59274b){if(_0x59274b){return db[_0xb4cd('0x5b')][_0xb4cd('0x5c')]({'where':{'id':_['map'](_0x59274b,_0xb4cd('0x5d')),'role':'agent'},'attributes':['id',_0xb4cd('0x2e'),'faxPause',_0xb4cd('0x5e'),_0xb4cd('0x5f')]});}})[_0xb4cd('0x2b')](function(_0x125416){if(_0x125416){return{'count':_0x125416['count'],'rows':_['map'](_0x125416['rows'],function(_0x261450){return{'membername':_0x261450[_0xb4cd('0x2e')],'UserId':_0x261450['id'],'queue_name':_0x5dc3b6[_0xb4cd('0x2e')],'FaxQueueId':_0x5dc3b6['id'],'interface':util[_0xb4cd('0x60')](_0xb4cd('0x61'),_0xb4cd('0x62'),_0x261450['name']),'penalty':0x0,'paused':_0x261450[_0xb4cd('0x63')],'createdAt':_0x261450[_0xb4cd('0x5f')],'updatedAt':_0x261450[_0xb4cd('0x5e')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xb4cd('0x2b')](respondWithFilteredResult(_0x521d31,_0x44b72e))[_0xb4cd('0x49')](handleError(_0x521d31,null));};exports['getTeams']=function(_0x14cd3d,_0x401c0f,_0x4fdd3f){var _0x4a57aa={};var _0x2bb74b={};var _0x2cb565;var _0x4e9068;return db[_0xb4cd('0x32')][_0xb4cd('0x59')]({'where':{'id':_0x14cd3d[_0xb4cd('0x4b')]['id']}})['then'](handleEntityNotFound(_0x401c0f,null))[_0xb4cd('0x2b')](function(_0x187c4f){if(_0x187c4f){_0x2cb565=_0x187c4f;_0x2bb74b[_0xb4cd('0x3a')]=_[_0xb4cd('0x38')](db['Team'][_0xb4cd('0x33')]);_0x2bb74b['query']=_[_0xb4cd('0x38')](_0x14cd3d[_0xb4cd('0x37')]);_0x2bb74b[_0xb4cd('0x39')]=_[_0xb4cd('0x3c')](_0x2bb74b['model'],_0x2bb74b[_0xb4cd('0x37')]);_0x4a57aa[_0xb4cd('0x3b')]=_['intersection'](_0x2bb74b['model'],qs[_0xb4cd('0x3d')](_0x14cd3d['query'][_0xb4cd('0x3d')]));_0x4a57aa[_0xb4cd('0x3b')]=_0x4a57aa[_0xb4cd('0x3b')]['length']?_0x4a57aa[_0xb4cd('0x3b')]:_0x2bb74b['model'];_0x4a57aa[_0xb4cd('0x41')]=qs['sort'](_0x14cd3d[_0xb4cd('0x37')][_0xb4cd('0x42')]);_0x4a57aa[_0xb4cd('0x43')]=qs['filters'](_[_0xb4cd('0x44')](_0x14cd3d[_0xb4cd('0x37')],_0x2bb74b[_0xb4cd('0x39')]));if(_0x14cd3d[_0xb4cd('0x37')][_0xb4cd('0x46')]){_0x4a57aa[_0xb4cd('0x43')]=_[_0xb4cd('0x45')](_0x4a57aa['where'],{'$or':_[_0xb4cd('0x31')](_0x4a57aa['attributes'],function(_0x1cd8ad){var _0x5d85e9={};_0x5d85e9[_0x1cd8ad]={'$like':'%'+_0x14cd3d[_0xb4cd('0x37')][_0xb4cd('0x46')]+'%'};return _0x5d85e9;})});}_0x4a57aa=_[_0xb4cd('0x45')]({},_0x4a57aa,_0x14cd3d[_0xb4cd('0x4e')]);return _0x2cb565[_0xb4cd('0x64')](_0x4a57aa);}})[_0xb4cd('0x2b')](function(_0x1ccbdc){if(_0x1ccbdc){_0x4e9068=_0x1ccbdc[_0xb4cd('0x3e')];if(!_0x14cd3d[_0xb4cd('0x37')][_0xb4cd('0x3f')](_0xb4cd('0x40'))){_0x4a57aa[_0xb4cd('0x21')]=qs[_0xb4cd('0x21')](_0x14cd3d[_0xb4cd('0x37')][_0xb4cd('0x21')]);_0x4a57aa[_0xb4cd('0x20')]=qs[_0xb4cd('0x20')](_0x14cd3d[_0xb4cd('0x37')][_0xb4cd('0x20')]);}return _0x2cb565['getTeams'](_0x4a57aa);}})[_0xb4cd('0x2b')](function(_0x98b5ae){if(_0x98b5ae){return _0x98b5ae?{'count':_0x4e9068,'rows':_0x98b5ae}:null;}})[_0xb4cd('0x2b')](respondWithResult(_0x401c0f,null))[_0xb4cd('0x49')](handleError(_0x401c0f,null));};exports[_0xb4cd('0x65')]=function(_0x5eb138,_0x59e3ea,_0x1f0d2b){var _0x1fb252=_0x5eb138[_0xb4cd('0x56')][_0xb4cd('0x66')];return db['Team'][_0xb4cd('0x47')]({'where':{'id':_0x1fb252},'attributes':['id'],'include':[{'model':db['User'],'as':_0xb4cd('0x67'),'attributes':['id',_0xb4cd('0x2e'),_0xb4cd('0x68'),_0xb4cd('0x69'),_0xb4cd('0x6a')],'raw':!![]}]})[_0xb4cd('0x2b')](function(_0x22f4b3){if(_0x22f4b3){var _0x5ebe13=_['flatMap'](_0x22f4b3,function(_0x3f472e){var _0x792866=_0x3f472e[_0xb4cd('0x51')]({'plain':!![]});return _0x792866[_0xb4cd('0x67')];});return db[_0xb4cd('0x32')]['find']({'where':{'id':_0x5eb138[_0xb4cd('0x4b')]['id']}})[_0xb4cd('0x2b')](function(_0x4e4ea7){return db[_0xb4cd('0x6b')]['transaction'](function(_0x59df93){return _0x4e4ea7[_0xb4cd('0x65')](_0x1fb252,{'transaction':_0x59df93})[_0xb4cd('0x2b')](function(){return BPromise[_0xb4cd('0x6c')](_0x5ebe13,function(_0x421255){return db[_0xb4cd('0x5a')][_0xb4cd('0x6d')]({'where':{'UserId':_0x421255['id'],'FaxQueueId':_0x5eb138['params']['id']},'transaction':_0x59df93});});})['then'](function(){_0x5ebe13[_0xb4cd('0x6e')](function(_0x526124){socket[_0xb4cd('0x6f')](_0xb4cd('0x70'),{'UserId':_0x526124['id'],'FaxQueueId':_0x4e4ea7['id']});});});});});}})[_0xb4cd('0x2b')](respondWithStatusCode(_0x59e3ea,null))[_0xb4cd('0x49')](handleError(_0x59e3ea,null));};exports[_0xb4cd('0x71')]=function(_0x50b751,_0x58e459,_0x1ce593){return db[_0xb4cd('0x72')][_0xb4cd('0x47')]({'where':{'id':_0x50b751[_0xb4cd('0x37')][_0xb4cd('0x66')]},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xb4cd('0x2b')](handleEntityNotFound(_0x58e459,null))['then'](function(_0x2bae75){var _0x168d23=_['map'](_0x2bae75,'id');var _0x233f98=[];var _0x10cb8e=[];var _0x1c84d0=squel[_0xb4cd('0x73')]();_0x1c84d0[_0xb4cd('0x74')](_0xb4cd('0x75'))['from'](_0xb4cd('0x76'),'tq')[_0xb4cd('0x77')](_0xb4cd('0x78'),'ut',_0xb4cd('0x79'))['where'](_0xb4cd('0x7a'),_0x50b751[_0xb4cd('0x4b')]['id']);for(var _0x43a05b=0x0;_0x43a05b<_0x2bae75[_0xb4cd('0x3e')];_0x43a05b+=0x1){let _0x435ba9=_0x2bae75[_0x43a05b];for(var _0x1eb181=0x0;_0x1eb181<_0x435ba9[_0xb4cd('0x67')][_0xb4cd('0x3e')];_0x1eb181+=0x1){let _0x4c47d9=_0x435ba9[_0xb4cd('0x67')][_0x1eb181];var _0x21e5a2=_0x1c84d0[_0xb4cd('0x7b')]();_0x21e5a2['where'](_0xb4cd('0x7c'),_0x4c47d9['id']);_0x10cb8e['push'](db['sequelize'][_0xb4cd('0x37')](_0x21e5a2['toString'](),{'type':db[_0xb4cd('0x6b')][_0xb4cd('0x7d')][_0xb4cd('0x7e')]})[_0xb4cd('0x2b')](function(_0x34dc94){if(_0x34dc94[_0xb4cd('0x3e')]===0x1){return _0x4c47d9['id'];}else{var _0xcc9166=_[_0xb4cd('0x7f')](_[_0xb4cd('0x31')](_0x34dc94,_0xb4cd('0x80')),function(_0x9a6970){return _[_0xb4cd('0x81')](_0x168d23,_0x9a6970);});if(_0xcc9166){return _0x4c47d9['id'];}}}));}}return BPromise[_0xb4cd('0x82')](_0x10cb8e)['then'](function(_0x2325bf){_0x233f98=_(_0x233f98)[_0xb4cd('0x83')](_0x2325bf)[_0xb4cd('0x84')]()[_0xb4cd('0x85')]();return db[_0xb4cd('0x32')][_0xb4cd('0x4f')]({'where':{'id':_0x50b751['params']['id']}})[_0xb4cd('0x2b')](function(_0x102e7b){return db[_0xb4cd('0x6b')][_0xb4cd('0x86')](function(_0x5c9504){return _0x102e7b['removeTeams'](_0x50b751['query'][_0xb4cd('0x66')],{'transaction':_0x5c9504})[_0xb4cd('0x2b')](function(){if(!_[_0xb4cd('0x87')](_0x233f98)){return _0x102e7b[_0xb4cd('0x88')](_0x233f98,{'transaction':_0x5c9504});}})['then'](function(){_0x233f98[_0xb4cd('0x6e')](function(_0x1f1979){socket[_0xb4cd('0x6f')](_0xb4cd('0x89'),{'UserId':_0x1f1979,'FaxQueueId':_0x102e7b['id']});});});});});});})['then'](respondWithStatusCode(_0x58e459,null))[_0xb4cd('0x49')](handleError(_0x58e459,null));};exports[_0xb4cd('0x8a')]=function(_0x139052,_0x340d88,_0xcf5c95){return db[_0xb4cd('0x32')][_0xb4cd('0x4f')]({'where':{'id':_0x139052['params']['id']}})[_0xb4cd('0x2b')](handleEntityNotFound(_0x340d88,null))[_0xb4cd('0x2b')](function(_0x2595ce){if(_0x2595ce){return _0x2595ce[_0xb4cd('0x8a')](_0x139052['body'][_0xb4cd('0x66')],_[_0xb4cd('0x8b')](_0x139052[_0xb4cd('0x56')],[_0xb4cd('0x66'),'id'])||{})[_0xb4cd('0x8c')](function(_0x5e4eee){for(var _0x25900f=0x0;_0x25900f<_0x139052[_0xb4cd('0x56')]['ids'][_0xb4cd('0x3e')];_0x25900f+=0x1){socket[_0xb4cd('0x6f')](_0xb4cd('0x70'),{'UserId':Number(_0x139052[_0xb4cd('0x56')][_0xb4cd('0x66')][_0x25900f]),'FaxQueueId':Number(_0x139052[_0xb4cd('0x4b')]['id'])});}return _0x5e4eee;});}})[_0xb4cd('0x2b')](respondWithResult(_0x340d88,null))[_0xb4cd('0x49')](handleError(_0x340d88,null));};exports[_0xb4cd('0x88')]=function(_0x257cc1,_0x34a6f6,_0x14a05d){return db['FaxQueue']['find']({'where':{'id':_0x257cc1[_0xb4cd('0x4b')]['id']}})[_0xb4cd('0x2b')](handleEntityNotFound(_0x34a6f6,null))[_0xb4cd('0x2b')](function(_0x4c58ae){if(_0x4c58ae){return _0x4c58ae[_0xb4cd('0x88')](_0x257cc1[_0xb4cd('0x37')][_0xb4cd('0x66')])[_0xb4cd('0x2b')](function(){if(_[_0xb4cd('0x8d')](_0x257cc1[_0xb4cd('0x37')][_0xb4cd('0x66')])){for(var _0x2125e8=0x0;_0x2125e8<_0x257cc1[_0xb4cd('0x37')][_0xb4cd('0x66')][_0xb4cd('0x3e')];_0x2125e8+=0x1){socket['emit'](_0xb4cd('0x89'),{'UserId':Number(_0x257cc1[_0xb4cd('0x37')]['ids'][_0x2125e8]),'FaxQueueId':Number(_0x257cc1['params']['id'])});}}else{socket[_0xb4cd('0x6f')](_0xb4cd('0x89'),{'UserId':Number(_0x257cc1[_0xb4cd('0x37')][_0xb4cd('0x66')]),'FaxQueueId':Number(_0x257cc1[_0xb4cd('0x4b')]['id'])});}});}})[_0xb4cd('0x2b')](respondWithStatusCode(_0x34a6f6,null))['catch'](handleError(_0x34a6f6,null));};exports[_0xb4cd('0x8e')]=function(_0x20f133,_0x21dd0c,_0x59d174){var _0x568c8a={};var _0x4e7b5a={};var _0x914f4f;var _0x3fa2b3;return db[_0xb4cd('0x32')][_0xb4cd('0x59')]({'where':{'id':_0x20f133[_0xb4cd('0x4b')]['id']}})['then'](handleEntityNotFound(_0x21dd0c,null))[_0xb4cd('0x2b')](function(_0x84cb45){if(_0x84cb45){_0x914f4f=_0x84cb45;_0x4e7b5a[_0xb4cd('0x3a')]=_['keys'](db[_0xb4cd('0x5b')][_0xb4cd('0x33')]);_0x4e7b5a[_0xb4cd('0x37')]=_['keys'](_0x20f133[_0xb4cd('0x37')]);_0x4e7b5a[_0xb4cd('0x39')]=_[_0xb4cd('0x3c')](_0x4e7b5a[_0xb4cd('0x3a')],_0x4e7b5a['query']);_0x568c8a[_0xb4cd('0x3b')]=_[_0xb4cd('0x3c')](_0x4e7b5a[_0xb4cd('0x3a')],qs[_0xb4cd('0x3d')](_0x20f133[_0xb4cd('0x37')][_0xb4cd('0x3d')]));_0x568c8a[_0xb4cd('0x3b')]=_0x568c8a[_0xb4cd('0x3b')][_0xb4cd('0x3e')]?_0x568c8a[_0xb4cd('0x3b')]:_0x4e7b5a[_0xb4cd('0x3a')];_0x568c8a['order']=qs[_0xb4cd('0x42')](_0x20f133['query']['sort']);_0x568c8a[_0xb4cd('0x43')]=qs['filters'](_[_0xb4cd('0x44')](_0x20f133[_0xb4cd('0x37')],_0x4e7b5a[_0xb4cd('0x39')]));if(_0x20f133[_0xb4cd('0x37')][_0xb4cd('0x46')]){_0x568c8a[_0xb4cd('0x43')]=_[_0xb4cd('0x45')](_0x568c8a[_0xb4cd('0x43')],{'$or':_[_0xb4cd('0x31')](_0x568c8a[_0xb4cd('0x3b')],function(_0x9c7455){var _0x38eeaa={};_0x38eeaa[_0x9c7455]={'$like':'%'+_0x20f133[_0xb4cd('0x37')][_0xb4cd('0x46')]+'%'};return _0x38eeaa;})});}_0x568c8a=_[_0xb4cd('0x45')]({},_0x568c8a,_0x20f133['options']);return _0x914f4f[_0xb4cd('0x8e')](_0x568c8a);}})[_0xb4cd('0x2b')](function(_0x58f69e){if(_0x58f69e){_0x3fa2b3=_0x58f69e[_0xb4cd('0x3e')];if(!_0x20f133[_0xb4cd('0x37')]['hasOwnProperty'](_0xb4cd('0x40'))){_0x568c8a[_0xb4cd('0x21')]=qs[_0xb4cd('0x21')](_0x20f133[_0xb4cd('0x37')][_0xb4cd('0x21')]);_0x568c8a[_0xb4cd('0x20')]=qs[_0xb4cd('0x20')](_0x20f133[_0xb4cd('0x37')][_0xb4cd('0x20')]);}return _0x914f4f[_0xb4cd('0x8e')](_0x568c8a);}})['then'](function(_0x1457ac){if(_0x1457ac){return _0x1457ac?{'count':_0x3fa2b3,'rows':_0x1457ac}:null;}})['then'](respondWithResult(_0x21dd0c,null))[_0xb4cd('0x49')](handleError(_0x21dd0c,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index 8f7d9fc..d3af5c3 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 _0x0cd1=['update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','save'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x0cd1,0x114));var _0x10cd=function(_0x47d804,_0x5cc88f){_0x47d804=_0x47d804-0x0;var _0x284c47=_0x0cd1[_0x47d804];return _0x284c47;};'use strict';var EventEmitter=require(_0x10cd('0x0'));var FaxQueue=require(_0x10cd('0x1'))['db']['FaxQueue'];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x10cd('0x2')](0x0);var events={'afterCreate':_0x10cd('0x3'),'afterUpdate':_0x10cd('0x4'),'afterDestroy':_0x10cd('0x5')};function emitEvent(_0x13bcb6){return function(_0x4714c3,_0x97e1e4,_0x13a372){FaxQueueEvents[_0x10cd('0x6')](_0x13bcb6+':'+_0x4714c3['id'],_0x4714c3);FaxQueueEvents[_0x10cd('0x6')](_0x13bcb6,_0x4714c3);_0x13a372(null);};}for(var e in events){if(events[_0x10cd('0x7')](e)){var event=events[e];FaxQueue[_0x10cd('0x8')](e,emitEvent(event));}}module[_0x10cd('0x9')]=FaxQueueEvents; \ No newline at end of file +var _0x55e8=['exports','events','setMaxListeners','save','update','remove','emit','hook'];(function(_0x16e07a,_0x3d4a03){var _0x508dc6=function(_0x2782c4){while(--_0x2782c4){_0x16e07a['push'](_0x16e07a['shift']());}};_0x508dc6(++_0x3d4a03);}(_0x55e8,0x1e1));var _0x855e=function(_0x4940fc,_0x45357a){_0x4940fc=_0x4940fc-0x0;var _0xd590f8=_0x55e8[_0x4940fc];return _0xd590f8;};'use strict';var EventEmitter=require(_0x855e('0x0'));var FaxQueue=require('../../mysqldb')['db']['FaxQueue'];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x855e('0x1')](0x0);var events={'afterCreate':_0x855e('0x2'),'afterUpdate':_0x855e('0x3'),'afterDestroy':_0x855e('0x4')};function emitEvent(_0x5d6875){return function(_0x186f40,_0x2bd24e,_0x5b0fe9){FaxQueueEvents[_0x855e('0x5')](_0x5d6875+':'+_0x186f40['id'],_0x186f40);FaxQueueEvents['emit'](_0x5d6875,_0x186f40);_0x5b0fe9(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxQueue[_0x855e('0x6')](e,emitEvent(event));}}module[_0x855e('0x7')]=FaxQueueEvents; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.model.js b/server/api/faxQueue/faxQueue.model.js index b3471b3..7bad8ca 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 _0xda94=['define','FaxQueue','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxQueue.attributes'];(function(_0x4c0622,_0x5dacaf){var _0x1799d8=function(_0x2ba801){while(--_0x2ba801){_0x4c0622['push'](_0x4c0622['shift']());}};_0x1799d8(++_0x5dacaf);}(_0xda94,0x15e));var _0x4da9=function(_0x11005e,_0x20c3d2){_0x11005e=_0x11005e-0x0;var _0x29338f=_0xda94[_0x11005e];return _0x29338f;};'use strict';var _=require(_0x4da9('0x0'));var util=require(_0x4da9('0x1'));var logger=require(_0x4da9('0x2'))('api');var moment=require(_0x4da9('0x3'));var BPromise=require(_0x4da9('0x4'));var rp=require(_0x4da9('0x5'));var fs=require('fs');var path=require(_0x4da9('0x6'));var rimraf=require(_0x4da9('0x7'));var config=require(_0x4da9('0x8'));var attributes=require(_0x4da9('0x9'));module['exports']=function(_0x20660d,_0x32674d){return _0x20660d[_0x4da9('0xa')](_0x4da9('0xb'),attributes,{'tableName':'fax_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbd57=['request-promise','path','../../config/environment','exports','define','FaxQueue','fax_queues','lodash','util','../../config/logger','api','bluebird'];(function(_0x1fcd58,_0x4f8a92){var _0x307d25=function(_0x3b0bc0){while(--_0x3b0bc0){_0x1fcd58['push'](_0x1fcd58['shift']());}};_0x307d25(++_0x4f8a92);}(_0xbd57,0xeb));var _0x7bd5=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xbd57[_0x6c993a];return _0x27f547;};'use strict';var _=require(_0x7bd5('0x0'));var util=require(_0x7bd5('0x1'));var logger=require(_0x7bd5('0x2'))(_0x7bd5('0x3'));var moment=require('moment');var BPromise=require(_0x7bd5('0x4'));var rp=require(_0x7bd5('0x5'));var fs=require('fs');var path=require(_0x7bd5('0x6'));var rimraf=require('rimraf');var config=require(_0x7bd5('0x7'));var attributes=require('./faxQueue.attributes');module[_0x7bd5('0x8')]=function(_0x263684,_0x32d31c){return _0x263684[_0x7bd5('0x9')](_0x7bd5('0xa'),attributes,{'tableName':_0x7bd5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.rpc.js b/server/api/faxQueue/faxQueue.rpc.js index 8a55382..6f034ee 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 _0x5e14=['jayson/promise','client','http','redis','defaults','socket.io-emitter','request','info','FaxQueue,\x20%s,\x20%s','request\x20sent','debug','FaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetFaxQueue','FaxQueue','options','raw','attributes','limit','include','map','model','ShowFaxQueue','find','where','then','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc'];(function(_0xb0072b,_0x564ce4){var _0x5ea422=function(_0x11e9d3){while(--_0x11e9d3){_0xb0072b['push'](_0xb0072b['shift']());}};_0x5ea422(++_0x564ce4);}(_0x5e14,0x187));var _0x45e1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5e14[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x45e1('0x0'));var util=require(_0x45e1('0x1'));var moment=require(_0x45e1('0x2'));var BPromise=require(_0x45e1('0x3'));var rs=require(_0x45e1('0x4'));var fs=require('fs');var Redis=require(_0x45e1('0x5'));var db=require(_0x45e1('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x45e1('0x7'))(_0x45e1('0x8'));var config=require('../../config/environment');var jayson=require(_0x45e1('0x9'));var client=jayson[_0x45e1('0xa')][_0x45e1('0xb')]({'port':0x232a});config[_0x45e1('0xc')]=_[_0x45e1('0xd')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x45e1('0xe'))(new Redis(config[_0x45e1('0xc')]));require('./faxQueue.socket')['register'](socket);function respondWithRpcPromise(_0x142cca,_0x390c6a,_0xcd089b){return new BPromise(function(_0x22ddd7,_0x3154b5){return client[_0x45e1('0xf')](_0x142cca,_0xcd089b)['then'](function(_0x460556){logger[_0x45e1('0x10')](_0x45e1('0x11'),_0x390c6a,_0x45e1('0x12'));logger[_0x45e1('0x13')](_0x45e1('0x14'),_0x390c6a,_0x45e1('0x12'),JSON[_0x45e1('0x15')](_0x460556));if(_0x460556[_0x45e1('0x16')]){if(_0x460556['error'][_0x45e1('0x17')]===0x1f4){logger[_0x45e1('0x16')](_0x45e1('0x11'),_0x390c6a,_0x460556['error'][_0x45e1('0x18')]);return _0x3154b5(_0x460556['error'][_0x45e1('0x18')]);}logger[_0x45e1('0x16')](_0x45e1('0x11'),_0x390c6a,_0x460556['error'][_0x45e1('0x18')]);return _0x22ddd7(_0x460556['error'][_0x45e1('0x18')]);}else{logger[_0x45e1('0x10')]('FaxQueue,\x20%s,\x20%s',_0x390c6a,_0x45e1('0x12'));_0x22ddd7(_0x460556[_0x45e1('0x19')][_0x45e1('0x18')]);}})[_0x45e1('0x1a')](function(_0x58efe9){logger[_0x45e1('0x16')]('FaxQueue,\x20%s,\x20%s',_0x390c6a,_0x58efe9);_0x3154b5(_0x58efe9);});});}exports[_0x45e1('0x1b')]=function(_0x3b5a4e){var _0x57b907=this;return new Promise(function(_0x31c882,_0x219f09){return db[_0x45e1('0x1c')]['findAll']({'raw':_0x3b5a4e[_0x45e1('0x1d')]?_0x3b5a4e['options'][_0x45e1('0x1e')]===undefined?!![]:![]:!![],'where':_0x3b5a4e[_0x45e1('0x1d')]?_0x3b5a4e[_0x45e1('0x1d')]['where']||null:null,'attributes':_0x3b5a4e['options']?_0x3b5a4e['options'][_0x45e1('0x1f')]||null:null,'limit':_0x3b5a4e['options']?_0x3b5a4e[_0x45e1('0x1d')][_0x45e1('0x20')]||null:null,'include':_0x3b5a4e[_0x45e1('0x1d')]?_0x3b5a4e[_0x45e1('0x1d')][_0x45e1('0x21')]?_[_0x45e1('0x22')](_0x3b5a4e[_0x45e1('0x1d')]['include'],function(_0x49910a){return{'model':db[_0x49910a['model']],'as':_0x49910a['as'],'attributes':_0x49910a[_0x45e1('0x1f')],'include':_0x49910a[_0x45e1('0x21')]?_[_0x45e1('0x22')](_0x49910a[_0x45e1('0x21')],function(_0x5b440b){return{'model':db[_0x5b440b[_0x45e1('0x23')]],'as':_0x5b440b['as'],'attributes':_0x5b440b['attributes'],'include':_0x5b440b[_0x45e1('0x21')]?_['map'](_0x5b440b[_0x45e1('0x21')],function(_0x4af75c){return{'model':db[_0x4af75c['model']],'as':_0x4af75c['as'],'attributes':_0x4af75c['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x1f2fad){logger[_0x45e1('0x10')](_0x45e1('0x1b'),_0x3b5a4e);logger['debug'](_0x45e1('0x1b'),_0x3b5a4e,JSON['stringify'](_0x1f2fad));_0x31c882(_0x1f2fad);})[_0x45e1('0x1a')](function(_0x2aeb03){logger[_0x45e1('0x16')]('GetFaxQueue',_0x2aeb03['message'],_0x3b5a4e);_0x219f09(_0x57b907['error'](0x1f4,_0x2aeb03[_0x45e1('0x18')]));});});};exports[_0x45e1('0x24')]=function(_0x5d0ec8){var _0xc0c175=this;return new Promise(function(_0x199910,_0x3fbd72){return db[_0x45e1('0x1c')][_0x45e1('0x25')]({'raw':_0x5d0ec8[_0x45e1('0x1d')]?_0x5d0ec8[_0x45e1('0x1d')][_0x45e1('0x1e')]===undefined?!![]:![]:!![],'where':_0x5d0ec8[_0x45e1('0x1d')]?_0x5d0ec8[_0x45e1('0x1d')][_0x45e1('0x26')]||null:null,'attributes':_0x5d0ec8['options']?_0x5d0ec8[_0x45e1('0x1d')][_0x45e1('0x1f')]||null:null,'include':_0x5d0ec8[_0x45e1('0x1d')]?_0x5d0ec8[_0x45e1('0x1d')][_0x45e1('0x21')]?_[_0x45e1('0x22')](_0x5d0ec8[_0x45e1('0x1d')][_0x45e1('0x21')],function(_0x1bea1e){return{'model':db[_0x1bea1e[_0x45e1('0x23')]],'as':_0x1bea1e['as'],'attributes':_0x1bea1e[_0x45e1('0x1f')],'include':_0x1bea1e[_0x45e1('0x21')]?_[_0x45e1('0x22')](_0x1bea1e[_0x45e1('0x21')],function(_0x4a8cc6){return{'model':db[_0x4a8cc6['model']],'as':_0x4a8cc6['as'],'attributes':_0x4a8cc6[_0x45e1('0x1f')],'include':_0x4a8cc6[_0x45e1('0x21')]?_[_0x45e1('0x22')](_0x4a8cc6['include'],function(_0x241636){return{'model':db[_0x241636[_0x45e1('0x23')]],'as':_0x241636['as'],'attributes':_0x241636[_0x45e1('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x45e1('0x27')](function(_0x4eae0f){logger[_0x45e1('0x10')](_0x45e1('0x24'),_0x5d0ec8);logger[_0x45e1('0x13')](_0x45e1('0x24'),_0x5d0ec8,JSON[_0x45e1('0x15')](_0x4eae0f));_0x199910(_0x4eae0f);})[_0x45e1('0x1a')](function(_0x34f03b){logger[_0x45e1('0x16')](_0x45e1('0x24'),_0x34f03b['message'],_0x5d0ec8);_0x3fbd72(_0xc0c175[_0x45e1('0x16')](0x1f4,_0x34f03b['message']));});});}; \ No newline at end of file +var _0x6856=['where','attributes','limit','include','model','map','ShowFaxQueue','find','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./faxQueue.socket','register','request','then','request\x20sent','debug','FaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxQueue,\x20%s,\x20%s','message','info','result','catch','GetFaxQueue','FaxQueue','options'];(function(_0x512973,_0x564e8b){var _0x32f2e1=function(_0x5d5d3b){while(--_0x5d5d3b){_0x512973['push'](_0x512973['shift']());}};_0x32f2e1(++_0x564e8b);}(_0x6856,0x1ac));var _0x6685=function(_0x36c251,_0x25159c){_0x36c251=_0x36c251-0x0;var _0xa2cbba=_0x6856[_0x36c251];return _0xa2cbba;};'use strict';var _=require(_0x6685('0x0'));var util=require('util');var moment=require(_0x6685('0x1'));var BPromise=require(_0x6685('0x2'));var rs=require(_0x6685('0x3'));var fs=require('fs');var Redis=require(_0x6685('0x4'));var db=require(_0x6685('0x5'))['db'];var utils=require(_0x6685('0x6'));var logger=require(_0x6685('0x7'))(_0x6685('0x8'));var config=require(_0x6685('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x6685('0xa')][_0x6685('0xb')]({'port':0x232a});config[_0x6685('0xc')]=_[_0x6685('0xd')](config[_0x6685('0xc')],{'host':_0x6685('0xe'),'port':0x18eb});var socket=require(_0x6685('0xf'))(new Redis(config['redis']));require(_0x6685('0x10'))[_0x6685('0x11')](socket);function respondWithRpcPromise(_0x1b5323,_0x37d366,_0xb9c507){return new BPromise(function(_0x22fd87,_0x6bda05){return client[_0x6685('0x12')](_0x1b5323,_0xb9c507)[_0x6685('0x13')](function(_0x2ea7ba){logger['info']('FaxQueue,\x20%s,\x20%s',_0x37d366,_0x6685('0x14'));logger[_0x6685('0x15')](_0x6685('0x16'),_0x37d366,'request\x20sent',JSON[_0x6685('0x17')](_0x2ea7ba));if(_0x2ea7ba[_0x6685('0x18')]){if(_0x2ea7ba[_0x6685('0x18')][_0x6685('0x19')]===0x1f4){logger[_0x6685('0x18')](_0x6685('0x1a'),_0x37d366,_0x2ea7ba['error'][_0x6685('0x1b')]);return _0x6bda05(_0x2ea7ba[_0x6685('0x18')]['message']);}logger[_0x6685('0x18')](_0x6685('0x1a'),_0x37d366,_0x2ea7ba[_0x6685('0x18')][_0x6685('0x1b')]);return _0x22fd87(_0x2ea7ba[_0x6685('0x18')][_0x6685('0x1b')]);}else{logger[_0x6685('0x1c')](_0x6685('0x1a'),_0x37d366,_0x6685('0x14'));_0x22fd87(_0x2ea7ba[_0x6685('0x1d')][_0x6685('0x1b')]);}})[_0x6685('0x1e')](function(_0x50fc1){logger[_0x6685('0x18')]('FaxQueue,\x20%s,\x20%s',_0x37d366,_0x50fc1);_0x6bda05(_0x50fc1);});});}exports[_0x6685('0x1f')]=function(_0x31fbea){var _0x1723c5=this;return new Promise(function(_0x4c5ce3,_0xbcd45){return db[_0x6685('0x20')]['findAll']({'raw':_0x31fbea['options']?_0x31fbea[_0x6685('0x21')]['raw']===undefined?!![]:![]:!![],'where':_0x31fbea[_0x6685('0x21')]?_0x31fbea[_0x6685('0x21')][_0x6685('0x22')]||null:null,'attributes':_0x31fbea[_0x6685('0x21')]?_0x31fbea[_0x6685('0x21')][_0x6685('0x23')]||null:null,'limit':_0x31fbea[_0x6685('0x21')]?_0x31fbea['options'][_0x6685('0x24')]||null:null,'include':_0x31fbea['options']?_0x31fbea[_0x6685('0x21')][_0x6685('0x25')]?_['map'](_0x31fbea[_0x6685('0x21')][_0x6685('0x25')],function(_0x3c5bd1){return{'model':db[_0x3c5bd1[_0x6685('0x26')]],'as':_0x3c5bd1['as'],'attributes':_0x3c5bd1[_0x6685('0x23')],'include':_0x3c5bd1[_0x6685('0x25')]?_[_0x6685('0x27')](_0x3c5bd1[_0x6685('0x25')],function(_0x45ff96){return{'model':db[_0x45ff96[_0x6685('0x26')]],'as':_0x45ff96['as'],'attributes':_0x45ff96[_0x6685('0x23')],'include':_0x45ff96[_0x6685('0x25')]?_[_0x6685('0x27')](_0x45ff96['include'],function(_0x19825e){return{'model':db[_0x19825e[_0x6685('0x26')]],'as':_0x19825e['as'],'attributes':_0x19825e['attributes']};}):[]};}):[]};}):[]:[]})[_0x6685('0x13')](function(_0x2de148){logger[_0x6685('0x1c')](_0x6685('0x1f'),_0x31fbea);logger[_0x6685('0x15')](_0x6685('0x1f'),_0x31fbea,JSON[_0x6685('0x17')](_0x2de148));_0x4c5ce3(_0x2de148);})[_0x6685('0x1e')](function(_0x498fa6){logger[_0x6685('0x18')](_0x6685('0x1f'),_0x498fa6[_0x6685('0x1b')],_0x31fbea);_0xbcd45(_0x1723c5['error'](0x1f4,_0x498fa6[_0x6685('0x1b')]));});});};exports[_0x6685('0x28')]=function(_0x260820){var _0x56f216=this;return new Promise(function(_0x2870db,_0x21ece7){return db[_0x6685('0x20')][_0x6685('0x29')]({'raw':_0x260820[_0x6685('0x21')]?_0x260820[_0x6685('0x21')]['raw']===undefined?!![]:![]:!![],'where':_0x260820['options']?_0x260820[_0x6685('0x21')]['where']||null:null,'attributes':_0x260820['options']?_0x260820[_0x6685('0x21')][_0x6685('0x23')]||null:null,'include':_0x260820['options']?_0x260820[_0x6685('0x21')][_0x6685('0x25')]?_[_0x6685('0x27')](_0x260820[_0x6685('0x21')][_0x6685('0x25')],function(_0x2c603d){return{'model':db[_0x2c603d[_0x6685('0x26')]],'as':_0x2c603d['as'],'attributes':_0x2c603d[_0x6685('0x23')],'include':_0x2c603d[_0x6685('0x25')]?_[_0x6685('0x27')](_0x2c603d['include'],function(_0x44bf51){return{'model':db[_0x44bf51['model']],'as':_0x44bf51['as'],'attributes':_0x44bf51[_0x6685('0x23')],'include':_0x44bf51[_0x6685('0x25')]?_['map'](_0x44bf51[_0x6685('0x25')],function(_0x1fcded){return{'model':db[_0x1fcded[_0x6685('0x26')]],'as':_0x1fcded['as'],'attributes':_0x1fcded[_0x6685('0x23')]};}):[]};}):[]};}):[]:[]})[_0x6685('0x13')](function(_0x5df446){logger[_0x6685('0x1c')](_0x6685('0x28'),_0x260820);logger['debug'](_0x6685('0x28'),_0x260820,JSON[_0x6685('0x17')](_0x5df446));_0x2870db(_0x5df446);})[_0x6685('0x1e')](function(_0x1148dd){logger[_0x6685('0x18')](_0x6685('0x28'),_0x1148dd['message'],_0x260820);_0x21ece7(_0x56f216[_0x6685('0x18')](0x1f4,_0x1148dd['message']));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index c2c5b4a..10f031c 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 _0xcbf6=['./faxQueue.events','remove','update','emit','removeListener','faxQueue:'];(function(_0x5365e3,_0x264205){var _0x15d9be=function(_0x2497b1){while(--_0x2497b1){_0x5365e3['push'](_0x5365e3['shift']());}};_0x15d9be(++_0x264205);}(_0xcbf6,0xd8));var _0x6cbf=function(_0xba0394,_0x2c6844){_0xba0394=_0xba0394-0x0;var _0x1789dd=_0xcbf6[_0xba0394];return _0x1789dd;};'use strict';var FaxQueueEvents=require(_0x6cbf('0x0'));var events=['save',_0x6cbf('0x1'),_0x6cbf('0x2')];function createListener(_0x288727,_0x5a3ea3){return function(_0x243650){_0x5a3ea3[_0x6cbf('0x3')](_0x288727,_0x243650);};}function removeListener(_0x581716,_0x366fbc){return function(){FaxQueueEvents[_0x6cbf('0x4')](_0x581716,_0x366fbc);};}exports['register']=function(_0x1fb618){for(var _0x54a974=0x0,_0x4e226f=events['length'];_0x54a974<_0x4e226f;_0x54a974++){var _0x14f27a=events[_0x54a974];var _0x5d4306=createListener(_0x6cbf('0x5')+_0x14f27a,_0x1fb618);FaxQueueEvents['on'](_0x14f27a,_0x5d4306);}}; \ No newline at end of file +var _0x20ef=['register','faxQueue:','save','remove','emit','removeListener'];(function(_0x29cf54,_0x1be9c5){var _0x35dd6f=function(_0x5cdab2){while(--_0x5cdab2){_0x29cf54['push'](_0x29cf54['shift']());}};_0x35dd6f(++_0x1be9c5);}(_0x20ef,0x9e));var _0xf20e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x20ef[_0x3dd15e];return _0x231fd0;};'use strict';var FaxQueueEvents=require('./faxQueue.events');var events=[_0xf20e('0x0'),_0xf20e('0x1'),'update'];function createListener(_0x399efc,_0x2c11e9){return function(_0x2e66f2){_0x2c11e9[_0xf20e('0x2')](_0x399efc,_0x2e66f2);};}function removeListener(_0x4ee77b,_0x5792a0){return function(){FaxQueueEvents[_0xf20e('0x3')](_0x4ee77b,_0x5792a0);};}exports[_0xf20e('0x4')]=function(_0x141d2b){for(var _0x26b003=0x0,_0x62143b=events['length'];_0x26b003<_0x62143b;_0x26b003++){var _0x146c28=events[_0x26b003];var _0x3330cd=createListener(_0xf20e('0x5')+_0x146c28,_0x141d2b);FaxQueueEvents['on'](_0x146c28,_0x3330cd);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index a41c21b..b9e0856 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 _0x01d9=['post','addTeams','addAgents','put','update','delete','destroy','removeTeams','exports','multer','util','path','connect-timeout','Router','fs-extra','../../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'];(function(_0x3ce3c6,_0x1115ba){var _0x1a2c99=function(_0x25c448){while(--_0x25c448){_0x3ce3c6['push'](_0x3ce3c6['shift']());}};_0x1a2c99(++_0x1115ba);}(_0x01d9,0x6c));var _0x901d=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x01d9[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x901d('0x0'));var util=require(_0x901d('0x1'));var path=require(_0x901d('0x2'));var timeout=require(_0x901d('0x3'));var express=require('express');var router=express[_0x901d('0x4')]();var fs_extra=require(_0x901d('0x5'));var auth=require(_0x901d('0x6'));var interaction=require(_0x901d('0x7'));var config=require(_0x901d('0x8'));var controller=require(_0x901d('0x9'));router[_0x901d('0xa')]('/',auth['isAuthenticated'](),controller[_0x901d('0xb')]);router[_0x901d('0xa')](_0x901d('0xc'),auth[_0x901d('0xd')](),controller[_0x901d('0xe')]);router[_0x901d('0xa')](_0x901d('0xf'),auth[_0x901d('0xd')](),controller[_0x901d('0x10')]);router[_0x901d('0xa')](_0x901d('0x11'),auth[_0x901d('0xd')](),controller[_0x901d('0x12')]);router['get'](_0x901d('0x13'),auth['isAuthenticated'](),controller[_0x901d('0x14')]);router[_0x901d('0xa')](_0x901d('0x15'),auth[_0x901d('0xd')](),controller[_0x901d('0x16')]);router['post']('/',auth[_0x901d('0xd')](),controller[_0x901d('0x17')]);router[_0x901d('0x18')](_0x901d('0x13'),auth[_0x901d('0xd')](),controller[_0x901d('0x19')]);router['post'](_0x901d('0x15'),auth[_0x901d('0xd')](),controller[_0x901d('0x1a')]);router[_0x901d('0x1b')](_0x901d('0xf'),auth[_0x901d('0xd')](),controller[_0x901d('0x1c')]);router[_0x901d('0x1d')](_0x901d('0xf'),auth[_0x901d('0xd')](),controller[_0x901d('0x1e')]);router[_0x901d('0x1d')](_0x901d('0x13'),auth[_0x901d('0xd')](),controller[_0x901d('0x1f')]);router[_0x901d('0x1d')](_0x901d('0x15'),auth[_0x901d('0xd')](),controller['removeAgents']);module[_0x901d('0x20')]=router; \ No newline at end of file +var _0x2542=['exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueue.controller','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/members','getMembers','/:id/teams','/:id/users','getAgents','post','create','addAgents','put','update','destroy','delete','removeAgents'];(function(_0x3b4b82,_0x210aab){var _0x2ebf58=function(_0x46504e){while(--_0x46504e){_0x3b4b82['push'](_0x3b4b82['shift']());}};_0x2ebf58(++_0x210aab);}(_0x2542,0x169));var _0x2254=function(_0x405e53,_0x27b8f3){_0x405e53=_0x405e53-0x0;var _0x1395eb=_0x2542[_0x405e53];return _0x1395eb;};'use strict';var multer=require(_0x2254('0x0'));var util=require(_0x2254('0x1'));var path=require(_0x2254('0x2'));var timeout=require(_0x2254('0x3'));var express=require('express');var router=express[_0x2254('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x2254('0x5'));var interaction=require(_0x2254('0x6'));var config=require(_0x2254('0x7'));var controller=require(_0x2254('0x8'));router[_0x2254('0x9')]('/',auth['isAuthenticated'](),controller[_0x2254('0xa')]);router[_0x2254('0x9')](_0x2254('0xb'),auth[_0x2254('0xc')](),controller[_0x2254('0xd')]);router[_0x2254('0x9')](_0x2254('0xe'),auth[_0x2254('0xc')](),controller[_0x2254('0xf')]);router[_0x2254('0x9')](_0x2254('0x10'),auth['isAuthenticated'](),controller[_0x2254('0x11')]);router[_0x2254('0x9')](_0x2254('0x12'),auth[_0x2254('0xc')](),controller['getTeams']);router['get'](_0x2254('0x13'),auth[_0x2254('0xc')](),controller[_0x2254('0x14')]);router[_0x2254('0x15')]('/',auth[_0x2254('0xc')](),controller[_0x2254('0x16')]);router['post'](_0x2254('0x12'),auth[_0x2254('0xc')](),controller['addTeams']);router[_0x2254('0x15')](_0x2254('0x13'),auth[_0x2254('0xc')](),controller[_0x2254('0x17')]);router[_0x2254('0x18')](_0x2254('0xe'),auth['isAuthenticated'](),controller[_0x2254('0x19')]);router['delete'](_0x2254('0xe'),auth[_0x2254('0xc')](),controller[_0x2254('0x1a')]);router[_0x2254('0x1b')](_0x2254('0x12'),auth[_0x2254('0xc')](),controller['removeTeams']);router['delete']('/:id/users',auth[_0x2254('0xc')](),controller[_0x2254('0x1c')]);module[_0x2254('0x1d')]=router; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.attributes.js b/server/api/faxQueueReport/faxQueueReport.attributes.js index 2bdef5a..d5dfcd8 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 _0x490c=['STRING','DATE','moment','exports'];(function(_0x1562a2,_0x2e4655){var _0x39a636=function(_0x25483a){while(--_0x25483a){_0x1562a2['push'](_0x1562a2['shift']());}};_0x39a636(++_0x2e4655);}(_0x490c,0x186));var _0xc490=function(_0x2d8fc2,_0x1c461d){_0x2d8fc2=_0x2d8fc2-0x0;var _0x3a9e53=_0x490c[_0x2d8fc2];return _0x3a9e53;};'use strict';var moment=require(_0xc490('0x0'));var Sequelize=require('sequelize');module[_0xc490('0x1')]={'uniqueid':{'type':Sequelize[_0xc490('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xc490('0x2')]},'joinAt':{'type':Sequelize[_0xc490('0x3')]},'leaveAt':{'type':Sequelize[_0xc490('0x3')]},'acceptAt':{'type':Sequelize[_0xc490('0x3')]},'exitAt':{'type':Sequelize[_0xc490('0x3')]},'reason':{'type':Sequelize[_0xc490('0x2')]}}; \ No newline at end of file +var _0x8524=['exports','DATE','STRING'];(function(_0x233826,_0x2a0353){var _0x31cbb8=function(_0x3f08fb){while(--_0x3f08fb){_0x233826['push'](_0x233826['shift']());}};_0x31cbb8(++_0x2a0353);}(_0x8524,0x84));var _0x4852=function(_0x58fe9b,_0x5b725c){_0x58fe9b=_0x58fe9b-0x0;var _0x1af38b=_0x8524[_0x58fe9b];return _0x1af38b;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x4852('0x0')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x4852('0x1')]},'leaveAt':{'type':Sequelize[_0x4852('0x1')]},'acceptAt':{'type':Sequelize[_0x4852('0x1')]},'exitAt':{'type':Sequelize[_0x4852('0x1')]},'reason':{'type':Sequelize[_0x4852('0x2')]}}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.controller.js b/server/api/faxQueueReport/faxQueueReport.controller.js index a49ce87..0d17329 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 _0xe739=['../../config/environment','../../config/license/util','sendStatus','end','status','json','undefined','count','offset','limit','set','Content-Range','apply','reject','update','destroy','then','error','stack','name','index','FaxQueueReport','rawAttributes','fieldName','type','model','map','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','merge','options','include','params','includeAll','find','catch','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','../../config/utils'];(function(_0x5e8e0c,_0x38fbda){var _0x2f8770=function(_0x3d5ab5){while(--_0x3d5ab5){_0x5e8e0c['push'](_0x5e8e0c['shift']());}};_0x2f8770(++_0x38fbda);}(_0xe739,0x105));var _0x9e73=function(_0x5425ec,_0x588424){_0x5425ec=_0x5425ec-0x0;var _0x51359b=_0xe739[_0x5425ec];return _0x51359b;};'use strict';var emlformat=require(_0x9e73('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9e73('0x1'));var jsonpatch=require(_0x9e73('0x2'));var rp=require(_0x9e73('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x9e73('0x4'));var path=require(_0x9e73('0x5'));var sox=require(_0x9e73('0x6'));var csv=require(_0x9e73('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9e73('0x8'));var _=require(_0x9e73('0x9'));var squel=require(_0x9e73('0xa'));var crypto=require('crypto');var jsforce=require(_0x9e73('0xb'));var deskjs=require(_0x9e73('0xc'));var toCsv=require(_0x9e73('0x7'));var querystring=require(_0x9e73('0xd'));var Papa=require(_0x9e73('0xe'));var Redis=require(_0x9e73('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x9e73('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x9e73('0x11'))('api');var utils=require(_0x9e73('0x12'));var config=require(_0x9e73('0x13'));var licenseUtil=require(_0x9e73('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x102bb9,_0x4696e2){_0x4696e2=_0x4696e2||0xcc;return function(_0x45c2d0){if(_0x45c2d0){return _0x102bb9[_0x9e73('0x15')](_0x4696e2);}return _0x102bb9['status'](_0x4696e2)[_0x9e73('0x16')]();};}function respondWithResult(_0x607981,_0x3a7bd5){_0x3a7bd5=_0x3a7bd5||0xc8;return function(_0x5be2fa){if(_0x5be2fa){return _0x607981[_0x9e73('0x17')](_0x3a7bd5)[_0x9e73('0x18')](_0x5be2fa);}};}function respondWithFilteredResult(_0x597492,_0x367857){return function(_0x327305){if(_0x327305){var _0x21bd3a=typeof _0x367857['offset']===_0x9e73('0x19')&&typeof _0x367857['limit']===_0x9e73('0x19');var _0x58bbaa=_0x327305[_0x9e73('0x1a')];var _0x48b1db=_0x21bd3a?0x0:_0x367857['offset'];var _0x419c5b=_0x21bd3a?_0x327305[_0x9e73('0x1a')]:_0x367857[_0x9e73('0x1b')]+_0x367857[_0x9e73('0x1c')];var _0x3e56d8;if(_0x419c5b>=_0x58bbaa){_0x419c5b=_0x58bbaa;_0x3e56d8=0xc8;}else{_0x3e56d8=0xce;}_0x597492[_0x9e73('0x17')](_0x3e56d8);return _0x597492[_0x9e73('0x1d')](_0x9e73('0x1e'),_0x48b1db+'-'+_0x419c5b+'/'+_0x58bbaa)[_0x9e73('0x18')](_0x327305);}return null;};}function patchUpdates(_0x3f56bf){return function(_0x4a5cd1){try{jsonpatch[_0x9e73('0x1f')](_0x4a5cd1,_0x3f56bf,!![]);}catch(_0x5c6bae){return BPromise[_0x9e73('0x20')](_0x5c6bae);}return _0x4a5cd1['save']();};}function saveUpdates(_0x31d354,_0x589a5d){return function(_0x2c2b32){if(_0x2c2b32){return _0x2c2b32[_0x9e73('0x21')](_0x31d354)['then'](function(_0x55704a){return _0x55704a;});}return null;};}function removeEntity(_0x127afd,_0x5c6322){return function(_0x256ea1){if(_0x256ea1){return _0x256ea1[_0x9e73('0x22')]()[_0x9e73('0x23')](function(){_0x127afd['status'](0xcc)[_0x9e73('0x16')]();});}};}function handleEntityNotFound(_0x3a845c,_0x566cd8){return function(_0x539560){if(!_0x539560){_0x3a845c[_0x9e73('0x15')](0x194);}return _0x539560;};}function handleError(_0x5031eb,_0x5356ce){_0x5356ce=_0x5356ce||0x1f4;return function(_0x23b2cd){logger[_0x9e73('0x24')](_0x23b2cd[_0x9e73('0x25')]);if(_0x23b2cd['name']){delete _0x23b2cd[_0x9e73('0x26')];}_0x5031eb[_0x9e73('0x17')](_0x5356ce)['send'](_0x23b2cd);};}exports[_0x9e73('0x27')]=function(_0x24532d,_0x3fd13d){var _0x397bd6={},_0x2363f6={},_0x511e35={'count':0x0,'rows':[]};var _0x312e08=_['map'](db[_0x9e73('0x28')][_0x9e73('0x29')],function(_0xb3ef4f){return{'name':_0xb3ef4f[_0x9e73('0x2a')],'type':_0xb3ef4f[_0x9e73('0x2b')]['key']};});_0x2363f6[_0x9e73('0x2c')]=_[_0x9e73('0x2d')](_0x312e08,'name');_0x2363f6['query']=_[_0x9e73('0x2e')](_0x24532d[_0x9e73('0x2f')]);_0x2363f6[_0x9e73('0x30')]=_[_0x9e73('0x31')](_0x2363f6[_0x9e73('0x2c')],_0x2363f6[_0x9e73('0x2f')]);_0x397bd6['attributes']=_[_0x9e73('0x31')](_0x2363f6[_0x9e73('0x2c')],qs[_0x9e73('0x32')](_0x24532d[_0x9e73('0x2f')][_0x9e73('0x32')]));_0x397bd6[_0x9e73('0x33')]=_0x397bd6[_0x9e73('0x33')][_0x9e73('0x34')]?_0x397bd6[_0x9e73('0x33')]:_0x2363f6[_0x9e73('0x2c')];if(!_0x24532d['query'][_0x9e73('0x35')](_0x9e73('0x36'))){_0x397bd6[_0x9e73('0x1c')]=qs[_0x9e73('0x1c')](_0x24532d['query'][_0x9e73('0x1c')]);_0x397bd6[_0x9e73('0x1b')]=qs['offset'](_0x24532d['query'][_0x9e73('0x1b')]);}_0x397bd6[_0x9e73('0x37')]=qs[_0x9e73('0x38')](_0x24532d[_0x9e73('0x2f')][_0x9e73('0x38')]);_0x397bd6[_0x9e73('0x39')]=qs['filters'](_['pick'](_0x24532d['query'],_0x2363f6[_0x9e73('0x30')]),_0x312e08);if(_0x24532d[_0x9e73('0x2f')][_0x9e73('0x3a')]){_0x397bd6['where']=_['merge'](_0x397bd6['where'],{'$or':_[_0x9e73('0x2d')](_0x312e08,function(_0xb5bb10){if(_0xb5bb10[_0x9e73('0x2b')]!==_0x9e73('0x3b')){var _0x541171={};_0x541171[_0xb5bb10[_0x9e73('0x26')]]={'$like':'%'+_0x24532d[_0x9e73('0x2f')][_0x9e73('0x3a')]+'%'};return _0x541171;}})});}_0x397bd6=_[_0x9e73('0x3c')]({},_0x397bd6,_0x24532d[_0x9e73('0x3d')]);var _0x40bbda={'where':_0x397bd6[_0x9e73('0x39')]};return db[_0x9e73('0x28')][_0x9e73('0x1a')](_0x40bbda)[_0x9e73('0x23')](function(_0x5d8e77){_0x511e35['count']=_0x5d8e77;if(_0x24532d['query']['includeAll']){_0x397bd6[_0x9e73('0x3e')]=[{'all':!![]}];}return db[_0x9e73('0x28')]['findAll'](_0x397bd6);})[_0x9e73('0x23')](function(_0x2038fb){_0x511e35['rows']=_0x2038fb;return _0x511e35;})['then'](respondWithFilteredResult(_0x3fd13d,_0x397bd6))['catch'](handleError(_0x3fd13d,null));};exports['show']=function(_0x51036a,_0x1e3a56){var _0x2a0166={'raw':!![],'where':{'id':_0x51036a[_0x9e73('0x3f')]['id']}},_0xee1f5={};_0xee1f5['model']=_['keys'](db[_0x9e73('0x28')][_0x9e73('0x29')]);_0xee1f5[_0x9e73('0x2f')]=_[_0x9e73('0x2e')](_0x51036a[_0x9e73('0x2f')]);_0xee1f5[_0x9e73('0x30')]=_['intersection'](_0xee1f5[_0x9e73('0x2c')],_0xee1f5[_0x9e73('0x2f')]);_0x2a0166['attributes']=_[_0x9e73('0x31')](_0xee1f5[_0x9e73('0x2c')],qs['fields'](_0x51036a[_0x9e73('0x2f')][_0x9e73('0x32')]));_0x2a0166['attributes']=_0x2a0166[_0x9e73('0x33')][_0x9e73('0x34')]?_0x2a0166[_0x9e73('0x33')]:_0xee1f5[_0x9e73('0x2c')];if(_0x51036a[_0x9e73('0x2f')][_0x9e73('0x40')]){_0x2a0166[_0x9e73('0x3e')]=[{'all':!![]}];}_0x2a0166=_[_0x9e73('0x3c')]({},_0x2a0166,_0x51036a[_0x9e73('0x3d')]);return db[_0x9e73('0x28')][_0x9e73('0x41')](_0x2a0166)[_0x9e73('0x23')](handleEntityNotFound(_0x1e3a56,null))[_0x9e73('0x23')](respondWithResult(_0x1e3a56,null))[_0x9e73('0x42')](handleError(_0x1e3a56,null));};exports[_0x9e73('0x43')]=function(_0x2d6ed4,_0x4e7891){return db[_0x9e73('0x28')]['create'](_0x2d6ed4['body'],{})[_0x9e73('0x23')](respondWithResult(_0x4e7891,0xc9))[_0x9e73('0x42')](handleError(_0x4e7891,null));};exports['update']=function(_0x4baaf7,_0x308e86){if(_0x4baaf7[_0x9e73('0x44')]['id']){delete _0x4baaf7[_0x9e73('0x44')]['id'];}return db[_0x9e73('0x28')][_0x9e73('0x41')]({'where':{'id':_0x4baaf7[_0x9e73('0x3f')]['id']}})[_0x9e73('0x23')](handleEntityNotFound(_0x308e86,null))[_0x9e73('0x23')](saveUpdates(_0x4baaf7[_0x9e73('0x44')],null))[_0x9e73('0x23')](respondWithResult(_0x308e86,null))[_0x9e73('0x42')](handleError(_0x308e86,null));};exports[_0x9e73('0x22')]=function(_0x230249,_0xe70028){return db['FaxQueueReport'][_0x9e73('0x41')]({'where':{'id':_0x230249[_0x9e73('0x3f')]['id']}})[_0x9e73('0x23')](handleEntityNotFound(_0xe70028,null))[_0x9e73('0x23')](removeEntity(_0xe70028,null))[_0x9e73('0x42')](handleError(_0xe70028,null));};exports[_0x9e73('0x45')]=function(_0x2c2003,_0x1e6655){return db['FaxQueueReport']['describe']()['then'](respondWithResult(_0x1e6655,null))[_0x9e73('0x42')](handleError(_0x1e6655,null));}; \ No newline at end of file +var _0xc831=['count','limit','set','then','error','name','send','index','FaxQueueReport','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','rawAttributes','create','body','update','params','destroy','find','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','undefined'];(function(_0x196196,_0x248c82){var _0x495848=function(_0x26dbbf){while(--_0x26dbbf){_0x196196['push'](_0x196196['shift']());}};_0x495848(++_0x248c82);}(_0xc831,0x103));var _0x1c83=function(_0x140157,_0x29b06f){_0x140157=_0x140157-0x0;var _0x3f8e46=_0xc831[_0x140157];return _0x3f8e46;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1c83('0x0'));var zipdir=require(_0x1c83('0x1'));var jsonpatch=require(_0x1c83('0x2'));var rp=require(_0x1c83('0x3'));var moment=require(_0x1c83('0x4'));var BPromise=require(_0x1c83('0x5'));var Mustache=require(_0x1c83('0x6'));var util=require(_0x1c83('0x7'));var path=require(_0x1c83('0x8'));var sox=require(_0x1c83('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1c83('0xa'));var _=require('lodash');var squel=require(_0x1c83('0xb'));var crypto=require(_0x1c83('0xc'));var jsforce=require(_0x1c83('0xd'));var deskjs=require(_0x1c83('0xe'));var toCsv=require(_0x1c83('0xf'));var querystring=require('querystring');var Papa=require(_0x1c83('0x10'));var Redis=require(_0x1c83('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x1c83('0x12'));var hardwareService=require(_0x1c83('0x13'));var logger=require(_0x1c83('0x14'))('api');var utils=require(_0x1c83('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x1c83('0x16'))['db'];function respondWithStatusCode(_0x276377,_0x3128ec){_0x3128ec=_0x3128ec||0xcc;return function(_0x20a59f){if(_0x20a59f){return _0x276377[_0x1c83('0x17')](_0x3128ec);}return _0x276377[_0x1c83('0x18')](_0x3128ec)[_0x1c83('0x19')]();};}function respondWithResult(_0x5d5742,_0x43f74e){_0x43f74e=_0x43f74e||0xc8;return function(_0x1be133){if(_0x1be133){return _0x5d5742[_0x1c83('0x18')](_0x43f74e)[_0x1c83('0x1a')](_0x1be133);}};}function respondWithFilteredResult(_0x37ba9b,_0x4e1620){return function(_0x11acf1){if(_0x11acf1){var _0x18a06d=typeof _0x4e1620[_0x1c83('0x1b')]===_0x1c83('0x1c')&&typeof _0x4e1620['limit']===_0x1c83('0x1c');var _0x4a5025=_0x11acf1['count'];var _0x3b3369=_0x18a06d?0x0:_0x4e1620[_0x1c83('0x1b')];var _0x2ec743=_0x18a06d?_0x11acf1[_0x1c83('0x1d')]:_0x4e1620['offset']+_0x4e1620[_0x1c83('0x1e')];var _0x5642aa;if(_0x2ec743>=_0x4a5025){_0x2ec743=_0x4a5025;_0x5642aa=0xc8;}else{_0x5642aa=0xce;}_0x37ba9b[_0x1c83('0x18')](_0x5642aa);return _0x37ba9b[_0x1c83('0x1f')]('Content-Range',_0x3b3369+'-'+_0x2ec743+'/'+_0x4a5025)[_0x1c83('0x1a')](_0x11acf1);}return null;};}function patchUpdates(_0x1b5a71){return function(_0x5aa566){try{jsonpatch['apply'](_0x5aa566,_0x1b5a71,!![]);}catch(_0x4cd6bb){return BPromise['reject'](_0x4cd6bb);}return _0x5aa566['save']();};}function saveUpdates(_0x19abb8,_0x3e216d){return function(_0x5daab4){if(_0x5daab4){return _0x5daab4['update'](_0x19abb8)[_0x1c83('0x20')](function(_0x3c8123){return _0x3c8123;});}return null;};}function removeEntity(_0x2d041f,_0x58a7d5){return function(_0xb21f06){if(_0xb21f06){return _0xb21f06['destroy']()[_0x1c83('0x20')](function(){_0x2d041f[_0x1c83('0x18')](0xcc)[_0x1c83('0x19')]();});}};}function handleEntityNotFound(_0x1096ed,_0x2e452b){return function(_0x2982d3){if(!_0x2982d3){_0x1096ed[_0x1c83('0x17')](0x194);}return _0x2982d3;};}function handleError(_0x2beb2b,_0x2ed4a3){_0x2ed4a3=_0x2ed4a3||0x1f4;return function(_0x578c37){logger[_0x1c83('0x21')](_0x578c37['stack']);if(_0x578c37[_0x1c83('0x22')]){delete _0x578c37['name'];}_0x2beb2b[_0x1c83('0x18')](_0x2ed4a3)[_0x1c83('0x23')](_0x578c37);};}exports[_0x1c83('0x24')]=function(_0x341d8d,_0x3c027b){var _0x282df2={},_0x2671a9={},_0x2fb872={'count':0x0,'rows':[]};var _0x3cf5a2=_['map'](db[_0x1c83('0x25')]['rawAttributes'],function(_0x4af140){return{'name':_0x4af140[_0x1c83('0x26')],'type':_0x4af140[_0x1c83('0x27')][_0x1c83('0x28')]};});_0x2671a9[_0x1c83('0x29')]=_[_0x1c83('0x2a')](_0x3cf5a2,_0x1c83('0x22'));_0x2671a9[_0x1c83('0x2b')]=_[_0x1c83('0x2c')](_0x341d8d['query']);_0x2671a9[_0x1c83('0x2d')]=_[_0x1c83('0x2e')](_0x2671a9[_0x1c83('0x29')],_0x2671a9[_0x1c83('0x2b')]);_0x282df2[_0x1c83('0x2f')]=_['intersection'](_0x2671a9[_0x1c83('0x29')],qs[_0x1c83('0x30')](_0x341d8d[_0x1c83('0x2b')]['fields']));_0x282df2[_0x1c83('0x2f')]=_0x282df2[_0x1c83('0x2f')][_0x1c83('0x31')]?_0x282df2[_0x1c83('0x2f')]:_0x2671a9[_0x1c83('0x29')];if(!_0x341d8d[_0x1c83('0x2b')][_0x1c83('0x32')](_0x1c83('0x33'))){_0x282df2[_0x1c83('0x1e')]=qs['limit'](_0x341d8d[_0x1c83('0x2b')][_0x1c83('0x1e')]);_0x282df2[_0x1c83('0x1b')]=qs[_0x1c83('0x1b')](_0x341d8d[_0x1c83('0x2b')]['offset']);}_0x282df2['order']=qs['sort'](_0x341d8d[_0x1c83('0x2b')]['sort']);_0x282df2[_0x1c83('0x34')]=qs[_0x1c83('0x2d')](_[_0x1c83('0x35')](_0x341d8d[_0x1c83('0x2b')],_0x2671a9[_0x1c83('0x2d')]),_0x3cf5a2);if(_0x341d8d['query']['filter']){_0x282df2['where']=_[_0x1c83('0x36')](_0x282df2[_0x1c83('0x34')],{'$or':_[_0x1c83('0x2a')](_0x3cf5a2,function(_0x10fba4){if(_0x10fba4[_0x1c83('0x27')]!==_0x1c83('0x37')){var _0x24d8c5={};_0x24d8c5[_0x10fba4['name']]={'$like':'%'+_0x341d8d['query'][_0x1c83('0x38')]+'%'};return _0x24d8c5;}})});}_0x282df2=_[_0x1c83('0x36')]({},_0x282df2,_0x341d8d[_0x1c83('0x39')]);var _0x267988={'where':_0x282df2[_0x1c83('0x34')]};return db[_0x1c83('0x25')][_0x1c83('0x1d')](_0x267988)['then'](function(_0x2a0e55){_0x2fb872[_0x1c83('0x1d')]=_0x2a0e55;if(_0x341d8d[_0x1c83('0x2b')][_0x1c83('0x3a')]){_0x282df2[_0x1c83('0x3b')]=[{'all':!![]}];}return db[_0x1c83('0x25')][_0x1c83('0x3c')](_0x282df2);})[_0x1c83('0x20')](function(_0xd9c16c){_0x2fb872[_0x1c83('0x3d')]=_0xd9c16c;return _0x2fb872;})[_0x1c83('0x20')](respondWithFilteredResult(_0x3c027b,_0x282df2))[_0x1c83('0x3e')](handleError(_0x3c027b,null));};exports[_0x1c83('0x3f')]=function(_0x3568f4,_0x5a3ae7){var _0x1ca69b={'raw':!![],'where':{'id':_0x3568f4['params']['id']}},_0x124d55={};_0x124d55[_0x1c83('0x29')]=_[_0x1c83('0x2c')](db[_0x1c83('0x25')][_0x1c83('0x40')]);_0x124d55[_0x1c83('0x2b')]=_[_0x1c83('0x2c')](_0x3568f4[_0x1c83('0x2b')]);_0x124d55[_0x1c83('0x2d')]=_['intersection'](_0x124d55[_0x1c83('0x29')],_0x124d55[_0x1c83('0x2b')]);_0x1ca69b[_0x1c83('0x2f')]=_[_0x1c83('0x2e')](_0x124d55[_0x1c83('0x29')],qs[_0x1c83('0x30')](_0x3568f4[_0x1c83('0x2b')][_0x1c83('0x30')]));_0x1ca69b['attributes']=_0x1ca69b['attributes'][_0x1c83('0x31')]?_0x1ca69b[_0x1c83('0x2f')]:_0x124d55[_0x1c83('0x29')];if(_0x3568f4[_0x1c83('0x2b')][_0x1c83('0x3a')]){_0x1ca69b['include']=[{'all':!![]}];}_0x1ca69b=_[_0x1c83('0x36')]({},_0x1ca69b,_0x3568f4['options']);return db['FaxQueueReport']['find'](_0x1ca69b)[_0x1c83('0x20')](handleEntityNotFound(_0x5a3ae7,null))['then'](respondWithResult(_0x5a3ae7,null))[_0x1c83('0x3e')](handleError(_0x5a3ae7,null));};exports[_0x1c83('0x41')]=function(_0x424a79,_0x216a07){return db[_0x1c83('0x25')][_0x1c83('0x41')](_0x424a79[_0x1c83('0x42')],{})[_0x1c83('0x20')](respondWithResult(_0x216a07,0xc9))['catch'](handleError(_0x216a07,null));};exports[_0x1c83('0x43')]=function(_0x2421d3,_0x320448){if(_0x2421d3[_0x1c83('0x42')]['id']){delete _0x2421d3[_0x1c83('0x42')]['id'];}return db['FaxQueueReport']['find']({'where':{'id':_0x2421d3[_0x1c83('0x44')]['id']}})[_0x1c83('0x20')](handleEntityNotFound(_0x320448,null))[_0x1c83('0x20')](saveUpdates(_0x2421d3[_0x1c83('0x42')],null))[_0x1c83('0x20')](respondWithResult(_0x320448,null))['catch'](handleError(_0x320448,null));};exports[_0x1c83('0x45')]=function(_0x901dc5,_0x16c478){return db['FaxQueueReport'][_0x1c83('0x46')]({'where':{'id':_0x901dc5[_0x1c83('0x44')]['id']}})[_0x1c83('0x20')](handleEntityNotFound(_0x16c478,null))[_0x1c83('0x20')](removeEntity(_0x16c478,null))[_0x1c83('0x3e')](handleError(_0x16c478,null));};exports[_0x1c83('0x47')]=function(_0x6377d6,_0x370291){return db['FaxQueueReport'][_0x1c83('0x47')]()[_0x1c83('0x20')](respondWithResult(_0x370291,null))[_0x1c83('0x3e')](handleError(_0x370291,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index b1b60fb..4a3e4e1 100644 --- a/server/api/faxQueueReport/faxQueueReport.model.js +++ b/server/api/faxQueueReport/faxQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7fbe=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxQueueReport.attributes','exports','define','FaxQueueReport','uniqueid','../../config/logger','api'];(function(_0x3657e5,_0x7b4384){var _0x25c13d=function(_0x1b8677){while(--_0x1b8677){_0x3657e5['push'](_0x3657e5['shift']());}};_0x25c13d(++_0x7b4384);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x49d77e,_0x47b0ca){_0x49d77e=_0x49d77e-0x0;var _0x37895e=_0x7fbe[_0x49d77e];return _0x37895e;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xe7fb('0x0'))(_0xe7fb('0x1'));var moment=require(_0xe7fb('0x2'));var BPromise=require(_0xe7fb('0x3'));var rp=require(_0xe7fb('0x4'));var fs=require('fs');var path=require(_0xe7fb('0x5'));var rimraf=require(_0xe7fb('0x6'));var config=require(_0xe7fb('0x7'));var attributes=require(_0xe7fb('0x8'));module[_0xe7fb('0x9')]=function(_0x290172,_0x12d1b0){return _0x290172[_0xe7fb('0xa')](_0xe7fb('0xb'),attributes,{'tableName':'report_fax_queue','paranoid':![],'indexes':[{'name':_0xe7fb('0xc'),'fields':[_0xe7fb('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7fbe=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxQueueReport.attributes','exports','define','FaxQueueReport','uniqueid','../../config/logger','api'];(function(_0x5e7855,_0x16db93){var _0x21b089=function(_0x75267e){while(--_0x75267e){_0x5e7855['push'](_0x5e7855['shift']());}};_0x21b089(++_0x16db93);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x6fbc80,_0x355ace){_0x6fbc80=_0x6fbc80-0x0;var _0x57c2ff=_0x7fbe[_0x6fbc80];return _0x57c2ff;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xe7fb('0x0'))(_0xe7fb('0x1'));var moment=require(_0xe7fb('0x2'));var BPromise=require(_0xe7fb('0x3'));var rp=require(_0xe7fb('0x4'));var fs=require('fs');var path=require(_0xe7fb('0x5'));var rimraf=require(_0xe7fb('0x6'));var config=require(_0xe7fb('0x7'));var attributes=require(_0xe7fb('0x8'));module[_0xe7fb('0x9')]=function(_0x290172,_0x12d1b0){return _0x290172[_0xe7fb('0xa')](_0xe7fb('0xb'),attributes,{'tableName':'report_fax_queue','paranoid':![],'indexes':[{'name':_0xe7fb('0xc'),'fields':[_0xe7fb('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.rpc.js b/server/api/faxQueueReport/faxQueueReport.rpc.js index 9a7129d..67902cd 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 _0xb6eb=['limit','lodash','util','bluebird','randomstring','ioredis','../../config/logger','rpc','jayson/promise','http','request','info','request\x20sent','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','error','FaxQueueReport,\x20%s,\x20%s','message','result','catch','CreateFaxQueueReport','FaxQueueReport','create','body','options','raw','then','stringify','UpdateFaxQueueReport','update','where','attributes'];(function(_0x363b81,_0x81e6ca){var _0x1d92fb=function(_0x129644){while(--_0x129644){_0x363b81['push'](_0x363b81['shift']());}};_0x1d92fb(++_0x81e6ca);}(_0xb6eb,0xe1));var _0xbb6e=function(_0x421aa9,_0xd5d28d){_0x421aa9=_0x421aa9-0x0;var _0x2b2b14=_0xb6eb[_0x421aa9];return _0x2b2b14;};'use strict';var _=require(_0xbb6e('0x0'));var util=require(_0xbb6e('0x1'));var moment=require('moment');var BPromise=require(_0xbb6e('0x2'));var rs=require(_0xbb6e('0x3'));var fs=require('fs');var Redis=require(_0xbb6e('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xbb6e('0x5'))(_0xbb6e('0x6'));var config=require('../../config/environment');var jayson=require(_0xbb6e('0x7'));var client=jayson['client'][_0xbb6e('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2362c5,_0x23df53,_0x55aa17){return new BPromise(function(_0x55c8e0,_0xa49efa){return client[_0xbb6e('0x9')](_0x2362c5,_0x55aa17)['then'](function(_0x56747b){logger[_0xbb6e('0xa')]('FaxQueueReport,\x20%s,\x20%s',_0x23df53,_0xbb6e('0xb'));logger[_0xbb6e('0xc')](_0xbb6e('0xd'),_0x23df53,_0xbb6e('0xb'),JSON['stringify'](_0x56747b));if(_0x56747b[_0xbb6e('0xe')]){if(_0x56747b[_0xbb6e('0xe')]['code']===0x1f4){logger[_0xbb6e('0xe')](_0xbb6e('0xf'),_0x23df53,_0x56747b['error']['message']);return _0xa49efa(_0x56747b[_0xbb6e('0xe')][_0xbb6e('0x10')]);}logger[_0xbb6e('0xe')](_0xbb6e('0xf'),_0x23df53,_0x56747b[_0xbb6e('0xe')][_0xbb6e('0x10')]);return _0x55c8e0(_0x56747b[_0xbb6e('0xe')][_0xbb6e('0x10')]);}else{logger[_0xbb6e('0xa')]('FaxQueueReport,\x20%s,\x20%s',_0x23df53,_0xbb6e('0xb'));_0x55c8e0(_0x56747b[_0xbb6e('0x11')][_0xbb6e('0x10')]);}})[_0xbb6e('0x12')](function(_0x6b6e72){logger['error'](_0xbb6e('0xf'),_0x23df53,_0x6b6e72);_0xa49efa(_0x6b6e72);});});}exports[_0xbb6e('0x13')]=function(_0x40a00d){var _0x19b908=this;return new Promise(function(_0x3ae7be,_0x30867e){return db[_0xbb6e('0x14')][_0xbb6e('0x15')](_0x40a00d[_0xbb6e('0x16')],{'raw':_0x40a00d[_0xbb6e('0x17')]?_0x40a00d[_0xbb6e('0x17')][_0xbb6e('0x18')]===undefined?!![]:![]:!![]})[_0xbb6e('0x19')](function(_0x2f3eac){logger[_0xbb6e('0xa')](_0xbb6e('0x13'),_0x40a00d);logger['debug']('CreateFaxQueueReport',_0x40a00d,JSON[_0xbb6e('0x1a')](_0x2f3eac));_0x3ae7be(_0x2f3eac);})['catch'](function(_0x485508){logger[_0xbb6e('0xe')](_0xbb6e('0x13'),_0x485508[_0xbb6e('0x10')],_0x40a00d);_0x30867e(_0x19b908[_0xbb6e('0xe')](0x1f4,_0x485508['message']));});});};exports[_0xbb6e('0x1b')]=function(_0x4183ba){var _0x328b99=this;return new Promise(function(_0x246770,_0x4443cf){return db[_0xbb6e('0x14')][_0xbb6e('0x1c')](_0x4183ba[_0xbb6e('0x16')],{'raw':_0x4183ba['options']?_0x4183ba['options'][_0xbb6e('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4183ba[_0xbb6e('0x17')]?_0x4183ba['options'][_0xbb6e('0x1d')]||null:null,'attributes':_0x4183ba['options']?_0x4183ba[_0xbb6e('0x17')][_0xbb6e('0x1e')]||null:null,'limit':_0x4183ba['options']?_0x4183ba[_0xbb6e('0x17')][_0xbb6e('0x1f')]||null:null})['then'](function(_0xc43ee4){logger[_0xbb6e('0xa')](_0xbb6e('0x1b'),_0x4183ba);logger[_0xbb6e('0xc')](_0xbb6e('0x1b'),_0x4183ba,JSON[_0xbb6e('0x1a')](_0xc43ee4));_0x246770(_0xc43ee4);})['catch'](function(_0x32c39d){logger[_0xbb6e('0xe')](_0xbb6e('0x1b'),_0x32c39d['message'],_0x4183ba);_0x4443cf(_0x328b99[_0xbb6e('0xe')](0x1f4,_0x32c39d['message']));});});}; \ No newline at end of file +var _0x0cf9=['body','options','raw','where','limit','UpdateFaxQueueReport','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','then','info','FaxQueueReport,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','CreateFaxQueueReport','FaxQueueReport','create'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x0cf9,0xd8));var _0x90cf=function(_0x33b259,_0x2036be){_0x33b259=_0x33b259-0x0;var _0xf95548=_0x0cf9[_0x33b259];return _0xf95548;};'use strict';var _=require(_0x90cf('0x0'));var util=require('util');var moment=require(_0x90cf('0x1'));var BPromise=require(_0x90cf('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x90cf('0x3'));var db=require(_0x90cf('0x4'))['db'];var utils=require(_0x90cf('0x5'));var logger=require(_0x90cf('0x6'))(_0x90cf('0x7'));var config=require(_0x90cf('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x90cf('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x38c052,_0x1817d1,_0x1b2dd8){return new BPromise(function(_0x16a881,_0x2395ed){return client['request'](_0x38c052,_0x1b2dd8)[_0x90cf('0xa')](function(_0x5cc908){logger[_0x90cf('0xb')](_0x90cf('0xc'),_0x1817d1,'request\x20sent');logger[_0x90cf('0xd')]('FaxQueueReport,\x20%s,\x20%s,\x20%s',_0x1817d1,_0x90cf('0xe'),JSON[_0x90cf('0xf')](_0x5cc908));if(_0x5cc908[_0x90cf('0x10')]){if(_0x5cc908[_0x90cf('0x10')][_0x90cf('0x11')]===0x1f4){logger['error'](_0x90cf('0xc'),_0x1817d1,_0x5cc908['error'][_0x90cf('0x12')]);return _0x2395ed(_0x5cc908[_0x90cf('0x10')][_0x90cf('0x12')]);}logger[_0x90cf('0x10')](_0x90cf('0xc'),_0x1817d1,_0x5cc908[_0x90cf('0x10')]['message']);return _0x16a881(_0x5cc908[_0x90cf('0x10')]['message']);}else{logger['info']('FaxQueueReport,\x20%s,\x20%s',_0x1817d1,_0x90cf('0xe'));_0x16a881(_0x5cc908[_0x90cf('0x13')]['message']);}})[_0x90cf('0x14')](function(_0x3c4252){logger[_0x90cf('0x10')](_0x90cf('0xc'),_0x1817d1,_0x3c4252);_0x2395ed(_0x3c4252);});});}exports[_0x90cf('0x15')]=function(_0x556059){var _0x29f4a6=this;return new Promise(function(_0x17deee,_0x305761){return db[_0x90cf('0x16')][_0x90cf('0x17')](_0x556059[_0x90cf('0x18')],{'raw':_0x556059[_0x90cf('0x19')]?_0x556059[_0x90cf('0x19')][_0x90cf('0x1a')]===undefined?!![]:![]:!![]})[_0x90cf('0xa')](function(_0x512ab3){logger[_0x90cf('0xb')](_0x90cf('0x15'),_0x556059);logger[_0x90cf('0xd')](_0x90cf('0x15'),_0x556059,JSON[_0x90cf('0xf')](_0x512ab3));_0x17deee(_0x512ab3);})[_0x90cf('0x14')](function(_0x1efe4c){logger[_0x90cf('0x10')](_0x90cf('0x15'),_0x1efe4c[_0x90cf('0x12')],_0x556059);_0x305761(_0x29f4a6[_0x90cf('0x10')](0x1f4,_0x1efe4c[_0x90cf('0x12')]));});});};exports['UpdateFaxQueueReport']=function(_0x354a9f){var _0xaf9a3f=this;return new Promise(function(_0x527f93,_0xf00fbe){return db[_0x90cf('0x16')]['update'](_0x354a9f[_0x90cf('0x18')],{'raw':_0x354a9f[_0x90cf('0x19')]?_0x354a9f[_0x90cf('0x19')][_0x90cf('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x354a9f[_0x90cf('0x19')]?_0x354a9f['options'][_0x90cf('0x1b')]||null:null,'attributes':_0x354a9f[_0x90cf('0x19')]?_0x354a9f['options']['attributes']||null:null,'limit':_0x354a9f[_0x90cf('0x19')]?_0x354a9f[_0x90cf('0x19')][_0x90cf('0x1c')]||null:null})[_0x90cf('0xa')](function(_0x1989da){logger[_0x90cf('0xb')]('UpdateFaxQueueReport',_0x354a9f);logger[_0x90cf('0xd')](_0x90cf('0x1d'),_0x354a9f,JSON['stringify'](_0x1989da));_0x527f93(_0x1989da);})[_0x90cf('0x14')](function(_0x506581){logger[_0x90cf('0x10')](_0x90cf('0x1d'),_0x506581['message'],_0x354a9f);_0xf00fbe(_0xaf9a3f[_0x90cf('0x10')](0x1f4,_0x506581['message']));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index bf3c0d8..3498e61 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 _0xafcb=['../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueueReport.controller','get','isAuthenticated','/describe','describe','show','post','create','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x15497f,_0x15ecb3){var _0x3dff4e=function(_0x539f9c){while(--_0x539f9c){_0x15497f['push'](_0x15497f['shift']());}};_0x3dff4e(++_0x15ecb3);}(_0xafcb,0xb7));var _0xbafc=function(_0x357f25,_0x3c9914){_0x357f25=_0x357f25-0x0;var _0x19e18e=_0xafcb[_0x357f25];return _0x19e18e;};'use strict';var multer=require(_0xbafc('0x0'));var util=require(_0xbafc('0x1'));var path=require(_0xbafc('0x2'));var timeout=require(_0xbafc('0x3'));var express=require(_0xbafc('0x4'));var router=express[_0xbafc('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xbafc('0x6'));var interaction=require(_0xbafc('0x7'));var config=require(_0xbafc('0x8'));var controller=require(_0xbafc('0x9'));router[_0xbafc('0xa')]('/',auth[_0xbafc('0xb')](),controller['index']);router[_0xbafc('0xa')](_0xbafc('0xc'),auth[_0xbafc('0xb')](),controller[_0xbafc('0xd')]);router[_0xbafc('0xa')]('/:id',auth[_0xbafc('0xb')](),controller[_0xbafc('0xe')]);router[_0xbafc('0xf')]('/',auth['isAuthenticated'](),controller[_0xbafc('0x10')]);router[_0xbafc('0x11')]('/:id',auth[_0xbafc('0xb')](),controller[_0xbafc('0x12')]);router['delete']('/:id',auth[_0xbafc('0xb')](),controller[_0xbafc('0x13')]);module[_0xbafc('0x14')]=router; \ No newline at end of file +var _0x69a9=['get','isAuthenticated','index','describe','/:id','post','create','put','update','delete','exports','multer','util','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./faxQueueReport.controller'];(function(_0x384e08,_0xa03d79){var _0x171a0c=function(_0x4046be){while(--_0x4046be){_0x384e08['push'](_0x384e08['shift']());}};_0x171a0c(++_0xa03d79);}(_0x69a9,0x1ad));var _0x969a=function(_0x36ccc1,_0xcd7e2e){_0x36ccc1=_0x36ccc1-0x0;var _0x3ac406=_0x69a9[_0x36ccc1];return _0x3ac406;};'use strict';var multer=require(_0x969a('0x0'));var util=require(_0x969a('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x969a('0x2'));var router=express[_0x969a('0x3')]();var fs_extra=require(_0x969a('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x969a('0x5'));var config=require(_0x969a('0x6'));var controller=require(_0x969a('0x7'));router[_0x969a('0x8')]('/',auth[_0x969a('0x9')](),controller[_0x969a('0xa')]);router[_0x969a('0x8')]('/describe',auth[_0x969a('0x9')](),controller[_0x969a('0xb')]);router[_0x969a('0x8')](_0x969a('0xc'),auth[_0x969a('0x9')](),controller['show']);router[_0x969a('0xd')]('/',auth['isAuthenticated'](),controller[_0x969a('0xe')]);router[_0x969a('0xf')](_0x969a('0xc'),auth[_0x969a('0x9')](),controller[_0x969a('0x10')]);router[_0x969a('0x11')](_0x969a('0xc'),auth[_0x969a('0x9')](),controller['destroy']);module[_0x969a('0x12')]=router; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.attributes.js b/server/api/faxTransferReport/faxTransferReport.attributes.js index 3f42f70..b44aec2 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 _0x70e0=['NOW','moment','sequelize','exports','account','agent','queue'];(function(_0x524c06,_0x348a82){var _0x4b16ec=function(_0x5d16e0){while(--_0x5d16e0){_0x524c06['push'](_0x524c06['shift']());}};_0x4b16ec(++_0x348a82);}(_0x70e0,0x17b));var _0x070e=function(_0x1ec6f2,_0x51d0b8){_0x1ec6f2=_0x1ec6f2-0x0;var _0xd0e9dc=_0x70e0[_0x1ec6f2];return _0xd0e9dc;};'use strict';var moment=require(_0x070e('0x0'));var Sequelize=require(_0x070e('0x1'));module[_0x070e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x070e('0x3'),_0x070e('0x4'),_0x070e('0x5')),'allowNull':![],'defaultValue':_0x070e('0x5')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x070e('0x6')]}}; \ No newline at end of file +var _0x9c44=['ENUM','account','agent','queue','NOW','exports','STRING'];(function(_0x311cfe,_0x42e904){var _0x40ce33=function(_0x29b0f4){while(--_0x29b0f4){_0x311cfe['push'](_0x311cfe['shift']());}};_0x40ce33(++_0x42e904);}(_0x9c44,0x178));var _0x49c4=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x9c44[_0x3ab51d];return _0x29a04e;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x49c4('0x0')]={'uniqueid':{'type':Sequelize[_0x49c4('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x49c4('0x2')](_0x49c4('0x3'),_0x49c4('0x4'),_0x49c4('0x5')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x49c4('0x6')]}}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.controller.js b/server/api/faxTransferReport/faxTransferReport.controller.js index 44b874c..8c7ae75 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 _0x755e=['apply','reject','save','update','then','destroy','stack','name','send','index','map','FaxTransferReport','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','offset','order','sort','where','filter','merge','VIRTUAL','findAll','rows','catch','show','params','rawAttributes','includeAll','include','options','find','create','body','describe','rimraf','zip-dir','fast-json-patch','moment','mustache','to-csv','lodash','squel','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','set'];(function(_0x487d0a,_0x1b7cb4){var _0x3d740c=function(_0xa714f2){while(--_0xa714f2){_0x487d0a['push'](_0x487d0a['shift']());}};_0x3d740c(++_0x1b7cb4);}(_0x755e,0x71));var _0xe755=function(_0x4ece58,_0x50922a){_0x4ece58=_0x4ece58-0x0;var _0x20d209=_0x755e[_0x4ece58];return _0x20d209;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe755('0x0'));var zipdir=require(_0xe755('0x1'));var jsonpatch=require(_0xe755('0x2'));var rp=require('request-promise');var moment=require(_0xe755('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xe755('0x4'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xe755('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe755('0x6'));var squel=require(_0xe755('0x7'));var crypto=require(_0xe755('0x8'));var jsforce=require(_0xe755('0x9'));var deskjs=require('desk.js');var toCsv=require(_0xe755('0x5'));var querystring=require(_0xe755('0xa'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xe755('0xb'));var qs=require(_0xe755('0xc'));var as=require(_0xe755('0xd'));var hardwareService=require(_0xe755('0xe'));var logger=require(_0xe755('0xf'))('api');var utils=require(_0xe755('0x10'));var config=require('../../config/environment');var licenseUtil=require(_0xe755('0x11'));var db=require(_0xe755('0x12'))['db'];function respondWithStatusCode(_0x269791,_0x45926c){_0x45926c=_0x45926c||0xcc;return function(_0x38ddb2){if(_0x38ddb2){return _0x269791[_0xe755('0x13')](_0x45926c);}return _0x269791[_0xe755('0x14')](_0x45926c)[_0xe755('0x15')]();};}function respondWithResult(_0x357d58,_0x239697){_0x239697=_0x239697||0xc8;return function(_0x13def9){if(_0x13def9){return _0x357d58[_0xe755('0x14')](_0x239697)[_0xe755('0x16')](_0x13def9);}};}function respondWithFilteredResult(_0x2e47c9,_0x1924e0){return function(_0x5ebbc0){if(_0x5ebbc0){var _0xb2ba6c=typeof _0x1924e0['offset']===_0xe755('0x17')&&typeof _0x1924e0[_0xe755('0x18')]===_0xe755('0x17');var _0x34ca40=_0x5ebbc0[_0xe755('0x19')];var _0x2fcc92=_0xb2ba6c?0x0:_0x1924e0['offset'];var _0x4f1c7c=_0xb2ba6c?_0x5ebbc0[_0xe755('0x19')]:_0x1924e0['offset']+_0x1924e0[_0xe755('0x18')];var _0x320a92;if(_0x4f1c7c>=_0x34ca40){_0x4f1c7c=_0x34ca40;_0x320a92=0xc8;}else{_0x320a92=0xce;}_0x2e47c9[_0xe755('0x14')](_0x320a92);return _0x2e47c9[_0xe755('0x1a')]('Content-Range',_0x2fcc92+'-'+_0x4f1c7c+'/'+_0x34ca40)[_0xe755('0x16')](_0x5ebbc0);}return null;};}function patchUpdates(_0x3797e5){return function(_0x14accc){try{jsonpatch[_0xe755('0x1b')](_0x14accc,_0x3797e5,!![]);}catch(_0x3823df){return BPromise[_0xe755('0x1c')](_0x3823df);}return _0x14accc[_0xe755('0x1d')]();};}function saveUpdates(_0x330a4f,_0x413fe2){return function(_0x36e36c){if(_0x36e36c){return _0x36e36c[_0xe755('0x1e')](_0x330a4f)[_0xe755('0x1f')](function(_0x17070b){return _0x17070b;});}return null;};}function removeEntity(_0x4a5f19,_0x490911){return function(_0x3f96e8){if(_0x3f96e8){return _0x3f96e8[_0xe755('0x20')]()[_0xe755('0x1f')](function(){_0x4a5f19[_0xe755('0x14')](0xcc)[_0xe755('0x15')]();});}};}function handleEntityNotFound(_0x586da0,_0x42e8d4){return function(_0x4b2a08){if(!_0x4b2a08){_0x586da0[_0xe755('0x13')](0x194);}return _0x4b2a08;};}function handleError(_0x569960,_0x3b55a4){_0x3b55a4=_0x3b55a4||0x1f4;return function(_0x83d7b8){logger['error'](_0x83d7b8[_0xe755('0x21')]);if(_0x83d7b8[_0xe755('0x22')]){delete _0x83d7b8[_0xe755('0x22')];}_0x569960['status'](_0x3b55a4)[_0xe755('0x23')](_0x83d7b8);};}exports[_0xe755('0x24')]=function(_0xf1f3a5,_0x49d2d7){var _0x376a1d={},_0x3b631d={},_0x5986ad={'count':0x0,'rows':[]};var _0x5ad315=_[_0xe755('0x25')](db[_0xe755('0x26')]['rawAttributes'],function(_0x258004){return{'name':_0x258004['fieldName'],'type':_0x258004[_0xe755('0x27')][_0xe755('0x28')]};});_0x3b631d[_0xe755('0x29')]=_[_0xe755('0x25')](_0x5ad315,'name');_0x3b631d[_0xe755('0x2a')]=_[_0xe755('0x2b')](_0xf1f3a5[_0xe755('0x2a')]);_0x3b631d[_0xe755('0x2c')]=_[_0xe755('0x2d')](_0x3b631d['model'],_0x3b631d[_0xe755('0x2a')]);_0x376a1d['attributes']=_[_0xe755('0x2d')](_0x3b631d[_0xe755('0x29')],qs[_0xe755('0x2e')](_0xf1f3a5[_0xe755('0x2a')]['fields']));_0x376a1d[_0xe755('0x2f')]=_0x376a1d[_0xe755('0x2f')]['length']?_0x376a1d[_0xe755('0x2f')]:_0x3b631d['model'];if(!_0xf1f3a5[_0xe755('0x2a')][_0xe755('0x30')](_0xe755('0x31'))){_0x376a1d['limit']=qs[_0xe755('0x18')](_0xf1f3a5[_0xe755('0x2a')][_0xe755('0x18')]);_0x376a1d[_0xe755('0x32')]=qs['offset'](_0xf1f3a5['query'][_0xe755('0x32')]);}_0x376a1d[_0xe755('0x33')]=qs[_0xe755('0x34')](_0xf1f3a5[_0xe755('0x2a')][_0xe755('0x34')]);_0x376a1d[_0xe755('0x35')]=qs[_0xe755('0x2c')](_['pick'](_0xf1f3a5['query'],_0x3b631d[_0xe755('0x2c')]),_0x5ad315);if(_0xf1f3a5['query'][_0xe755('0x36')]){_0x376a1d[_0xe755('0x35')]=_[_0xe755('0x37')](_0x376a1d[_0xe755('0x35')],{'$or':_[_0xe755('0x25')](_0x5ad315,function(_0x2c7d15){if(_0x2c7d15[_0xe755('0x27')]!==_0xe755('0x38')){var _0x1a6a30={};_0x1a6a30[_0x2c7d15[_0xe755('0x22')]]={'$like':'%'+_0xf1f3a5[_0xe755('0x2a')][_0xe755('0x36')]+'%'};return _0x1a6a30;}})});}_0x376a1d=_[_0xe755('0x37')]({},_0x376a1d,_0xf1f3a5['options']);var _0x37429f={'where':_0x376a1d[_0xe755('0x35')]};return db[_0xe755('0x26')]['count'](_0x37429f)['then'](function(_0x5b6bfb){_0x5986ad['count']=_0x5b6bfb;if(_0xf1f3a5[_0xe755('0x2a')]['includeAll']){_0x376a1d['include']=[{'all':!![]}];}return db[_0xe755('0x26')][_0xe755('0x39')](_0x376a1d);})[_0xe755('0x1f')](function(_0x304c5e){_0x5986ad[_0xe755('0x3a')]=_0x304c5e;return _0x5986ad;})[_0xe755('0x1f')](respondWithFilteredResult(_0x49d2d7,_0x376a1d))[_0xe755('0x3b')](handleError(_0x49d2d7,null));};exports[_0xe755('0x3c')]=function(_0x175fde,_0x33cf5a){var _0x2d9963={'raw':!![],'where':{'id':_0x175fde[_0xe755('0x3d')]['id']}},_0x2a5f46={};_0x2a5f46[_0xe755('0x29')]=_['keys'](db[_0xe755('0x26')][_0xe755('0x3e')]);_0x2a5f46[_0xe755('0x2a')]=_[_0xe755('0x2b')](_0x175fde[_0xe755('0x2a')]);_0x2a5f46['filters']=_[_0xe755('0x2d')](_0x2a5f46['model'],_0x2a5f46[_0xe755('0x2a')]);_0x2d9963[_0xe755('0x2f')]=_['intersection'](_0x2a5f46[_0xe755('0x29')],qs[_0xe755('0x2e')](_0x175fde[_0xe755('0x2a')][_0xe755('0x2e')]));_0x2d9963[_0xe755('0x2f')]=_0x2d9963[_0xe755('0x2f')]['length']?_0x2d9963['attributes']:_0x2a5f46[_0xe755('0x29')];if(_0x175fde[_0xe755('0x2a')][_0xe755('0x3f')]){_0x2d9963[_0xe755('0x40')]=[{'all':!![]}];}_0x2d9963=_[_0xe755('0x37')]({},_0x2d9963,_0x175fde[_0xe755('0x41')]);return db[_0xe755('0x26')][_0xe755('0x42')](_0x2d9963)[_0xe755('0x1f')](handleEntityNotFound(_0x33cf5a,null))['then'](respondWithResult(_0x33cf5a,null))[_0xe755('0x3b')](handleError(_0x33cf5a,null));};exports[_0xe755('0x43')]=function(_0x2d40e7,_0x439b01){return db[_0xe755('0x26')][_0xe755('0x43')](_0x2d40e7['body'],{})['then'](respondWithResult(_0x439b01,0xc9))[_0xe755('0x3b')](handleError(_0x439b01,null));};exports[_0xe755('0x1e')]=function(_0x5534e3,_0x3ff67a){if(_0x5534e3['body']['id']){delete _0x5534e3[_0xe755('0x44')]['id'];}return db[_0xe755('0x26')]['find']({'where':{'id':_0x5534e3[_0xe755('0x3d')]['id']}})[_0xe755('0x1f')](handleEntityNotFound(_0x3ff67a,null))[_0xe755('0x1f')](saveUpdates(_0x5534e3[_0xe755('0x44')],null))['then'](respondWithResult(_0x3ff67a,null))[_0xe755('0x3b')](handleError(_0x3ff67a,null));};exports[_0xe755('0x20')]=function(_0x2f3c11,_0x812a83){return db[_0xe755('0x26')]['find']({'where':{'id':_0x2f3c11[_0xe755('0x3d')]['id']}})[_0xe755('0x1f')](handleEntityNotFound(_0x812a83,null))[_0xe755('0x1f')](removeEntity(_0x812a83,null))[_0xe755('0x3b')](handleError(_0x812a83,null));};exports['describe']=function(_0x9d1361,_0x4b184d){return db[_0xe755('0x26')][_0xe755('0x45')]()[_0xe755('0x1f')](respondWithResult(_0x4b184d,null))[_0xe755('0x3b')](handleError(_0x4b184d,null));}; \ No newline at end of file +var _0x92d1=['path','sox','to-csv','ejs','fs-extra','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','Content-Range','apply','reject','then','destroy','error','stack','send','index','map','FaxTransferReport','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','name','options','rows','catch','show','params','keys','includeAll','include','find','create','body','update','describe','eml-format','zip-dir','request-promise','moment','bluebird','mustache'];(function(_0x1290f9,_0x2b5543){var _0x303ba8=function(_0x458a59){while(--_0x458a59){_0x1290f9['push'](_0x1290f9['shift']());}};_0x303ba8(++_0x2b5543);}(_0x92d1,0x90));var _0x192d=function(_0x42a4ab,_0x225c6f){_0x42a4ab=_0x42a4ab-0x0;var _0x468a42=_0x92d1[_0x42a4ab];return _0x468a42;};'use strict';var emlformat=require(_0x192d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x192d('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x192d('0x2'));var moment=require(_0x192d('0x3'));var BPromise=require(_0x192d('0x4'));var Mustache=require(_0x192d('0x5'));var util=require('util');var path=require(_0x192d('0x6'));var sox=require(_0x192d('0x7'));var csv=require(_0x192d('0x8'));var ejs=require(_0x192d('0x9'));var fs=require('fs');var fs_extra=require(_0x192d('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x192d('0xb'));var jsforce=require(_0x192d('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x192d('0x8'));var querystring=require(_0x192d('0xd'));var Papa=require('papaparse');var Redis=require(_0x192d('0xe'));var authService=require(_0x192d('0xf'));var qs=require(_0x192d('0x10'));var as=require(_0x192d('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x192d('0x12'))(_0x192d('0x13'));var utils=require(_0x192d('0x14'));var config=require(_0x192d('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x192d('0x16'))['db'];function respondWithStatusCode(_0xba5c97,_0x1312c5){_0x1312c5=_0x1312c5||0xcc;return function(_0x1499a8){if(_0x1499a8){return _0xba5c97[_0x192d('0x17')](_0x1312c5);}return _0xba5c97[_0x192d('0x18')](_0x1312c5)[_0x192d('0x19')]();};}function respondWithResult(_0x38664b,_0xbeb99d){_0xbeb99d=_0xbeb99d||0xc8;return function(_0x4d1d6e){if(_0x4d1d6e){return _0x38664b['status'](_0xbeb99d)['json'](_0x4d1d6e);}};}function respondWithFilteredResult(_0x582a11,_0x164801){return function(_0x474b){if(_0x474b){var _0x23682e=typeof _0x164801[_0x192d('0x1a')]===_0x192d('0x1b')&&typeof _0x164801[_0x192d('0x1c')]===_0x192d('0x1b');var _0x52ad07=_0x474b[_0x192d('0x1d')];var _0x611490=_0x23682e?0x0:_0x164801[_0x192d('0x1a')];var _0x293b27=_0x23682e?_0x474b[_0x192d('0x1d')]:_0x164801[_0x192d('0x1a')]+_0x164801['limit'];var _0x17a90b;if(_0x293b27>=_0x52ad07){_0x293b27=_0x52ad07;_0x17a90b=0xc8;}else{_0x17a90b=0xce;}_0x582a11[_0x192d('0x18')](_0x17a90b);return _0x582a11['set'](_0x192d('0x1e'),_0x611490+'-'+_0x293b27+'/'+_0x52ad07)['json'](_0x474b);}return null;};}function patchUpdates(_0x2b966b){return function(_0x4da481){try{jsonpatch[_0x192d('0x1f')](_0x4da481,_0x2b966b,!![]);}catch(_0x329189){return BPromise[_0x192d('0x20')](_0x329189);}return _0x4da481['save']();};}function saveUpdates(_0x20d5c5,_0x41384c){return function(_0xc591fb){if(_0xc591fb){return _0xc591fb['update'](_0x20d5c5)[_0x192d('0x21')](function(_0x18af6b){return _0x18af6b;});}return null;};}function removeEntity(_0x51a0cd,_0x4abd3f){return function(_0x82aa71){if(_0x82aa71){return _0x82aa71[_0x192d('0x22')]()['then'](function(){_0x51a0cd[_0x192d('0x18')](0xcc)[_0x192d('0x19')]();});}};}function handleEntityNotFound(_0x33ce9d,_0x419b4d){return function(_0x392dca){if(!_0x392dca){_0x33ce9d['sendStatus'](0x194);}return _0x392dca;};}function handleError(_0x1f95f4,_0x15c3d3){_0x15c3d3=_0x15c3d3||0x1f4;return function(_0x36fa42){logger[_0x192d('0x23')](_0x36fa42[_0x192d('0x24')]);if(_0x36fa42['name']){delete _0x36fa42['name'];}_0x1f95f4[_0x192d('0x18')](_0x15c3d3)[_0x192d('0x25')](_0x36fa42);};}exports[_0x192d('0x26')]=function(_0x331f88,_0x15740b){var _0x36b0ef={},_0x42eac1={},_0xebaa0={'count':0x0,'rows':[]};var _0x552cc8=_[_0x192d('0x27')](db[_0x192d('0x28')][_0x192d('0x29')],function(_0x2cb0ab){return{'name':_0x2cb0ab[_0x192d('0x2a')],'type':_0x2cb0ab[_0x192d('0x2b')][_0x192d('0x2c')]};});_0x42eac1[_0x192d('0x2d')]=_[_0x192d('0x27')](_0x552cc8,'name');_0x42eac1[_0x192d('0x2e')]=_['keys'](_0x331f88[_0x192d('0x2e')]);_0x42eac1[_0x192d('0x2f')]=_[_0x192d('0x30')](_0x42eac1[_0x192d('0x2d')],_0x42eac1['query']);_0x36b0ef['attributes']=_[_0x192d('0x30')](_0x42eac1[_0x192d('0x2d')],qs[_0x192d('0x31')](_0x331f88['query'][_0x192d('0x31')]));_0x36b0ef[_0x192d('0x32')]=_0x36b0ef['attributes'][_0x192d('0x33')]?_0x36b0ef[_0x192d('0x32')]:_0x42eac1[_0x192d('0x2d')];if(!_0x331f88[_0x192d('0x2e')][_0x192d('0x34')](_0x192d('0x35'))){_0x36b0ef['limit']=qs[_0x192d('0x1c')](_0x331f88['query'][_0x192d('0x1c')]);_0x36b0ef[_0x192d('0x1a')]=qs['offset'](_0x331f88[_0x192d('0x2e')][_0x192d('0x1a')]);}_0x36b0ef[_0x192d('0x36')]=qs['sort'](_0x331f88[_0x192d('0x2e')][_0x192d('0x37')]);_0x36b0ef[_0x192d('0x38')]=qs[_0x192d('0x2f')](_[_0x192d('0x39')](_0x331f88['query'],_0x42eac1[_0x192d('0x2f')]),_0x552cc8);if(_0x331f88[_0x192d('0x2e')][_0x192d('0x3a')]){_0x36b0ef[_0x192d('0x38')]=_[_0x192d('0x3b')](_0x36b0ef[_0x192d('0x38')],{'$or':_[_0x192d('0x27')](_0x552cc8,function(_0x1a7b0a){if(_0x1a7b0a[_0x192d('0x2b')]!==_0x192d('0x3c')){var _0x42e107={};_0x42e107[_0x1a7b0a[_0x192d('0x3d')]]={'$like':'%'+_0x331f88[_0x192d('0x2e')][_0x192d('0x3a')]+'%'};return _0x42e107;}})});}_0x36b0ef=_[_0x192d('0x3b')]({},_0x36b0ef,_0x331f88[_0x192d('0x3e')]);var _0x103770={'where':_0x36b0ef[_0x192d('0x38')]};return db[_0x192d('0x28')][_0x192d('0x1d')](_0x103770)[_0x192d('0x21')](function(_0x5c12fd){_0xebaa0[_0x192d('0x1d')]=_0x5c12fd;if(_0x331f88[_0x192d('0x2e')]['includeAll']){_0x36b0ef['include']=[{'all':!![]}];}return db[_0x192d('0x28')]['findAll'](_0x36b0ef);})['then'](function(_0x25947e){_0xebaa0[_0x192d('0x3f')]=_0x25947e;return _0xebaa0;})[_0x192d('0x21')](respondWithFilteredResult(_0x15740b,_0x36b0ef))[_0x192d('0x40')](handleError(_0x15740b,null));};exports[_0x192d('0x41')]=function(_0x565ea9,_0x59ca14){var _0xd76a69={'raw':!![],'where':{'id':_0x565ea9[_0x192d('0x42')]['id']}},_0x346b20={};_0x346b20[_0x192d('0x2d')]=_[_0x192d('0x43')](db[_0x192d('0x28')][_0x192d('0x29')]);_0x346b20[_0x192d('0x2e')]=_[_0x192d('0x43')](_0x565ea9[_0x192d('0x2e')]);_0x346b20['filters']=_[_0x192d('0x30')](_0x346b20[_0x192d('0x2d')],_0x346b20['query']);_0xd76a69[_0x192d('0x32')]=_[_0x192d('0x30')](_0x346b20[_0x192d('0x2d')],qs[_0x192d('0x31')](_0x565ea9['query'][_0x192d('0x31')]));_0xd76a69[_0x192d('0x32')]=_0xd76a69[_0x192d('0x32')][_0x192d('0x33')]?_0xd76a69['attributes']:_0x346b20[_0x192d('0x2d')];if(_0x565ea9[_0x192d('0x2e')][_0x192d('0x44')]){_0xd76a69[_0x192d('0x45')]=[{'all':!![]}];}_0xd76a69=_['merge']({},_0xd76a69,_0x565ea9[_0x192d('0x3e')]);return db[_0x192d('0x28')][_0x192d('0x46')](_0xd76a69)['then'](handleEntityNotFound(_0x59ca14,null))[_0x192d('0x21')](respondWithResult(_0x59ca14,null))[_0x192d('0x40')](handleError(_0x59ca14,null));};exports['create']=function(_0x234f0b,_0x38af10){return db[_0x192d('0x28')][_0x192d('0x47')](_0x234f0b[_0x192d('0x48')],{})[_0x192d('0x21')](respondWithResult(_0x38af10,0xc9))['catch'](handleError(_0x38af10,null));};exports[_0x192d('0x49')]=function(_0x167e3f,_0x4897a2){if(_0x167e3f['body']['id']){delete _0x167e3f[_0x192d('0x48')]['id'];}return db['FaxTransferReport'][_0x192d('0x46')]({'where':{'id':_0x167e3f[_0x192d('0x42')]['id']}})[_0x192d('0x21')](handleEntityNotFound(_0x4897a2,null))[_0x192d('0x21')](saveUpdates(_0x167e3f['body'],null))[_0x192d('0x21')](respondWithResult(_0x4897a2,null))[_0x192d('0x40')](handleError(_0x4897a2,null));};exports[_0x192d('0x22')]=function(_0x4f5486,_0x2231e0){return db['FaxTransferReport'][_0x192d('0x46')]({'where':{'id':_0x4f5486[_0x192d('0x42')]['id']}})[_0x192d('0x21')](handleEntityNotFound(_0x2231e0,null))[_0x192d('0x21')](removeEntity(_0x2231e0,null))['catch'](handleError(_0x2231e0,null));};exports[_0x192d('0x4a')]=function(_0x11e57f,_0x32eb68){return db[_0x192d('0x28')]['describe']()['then'](respondWithResult(_0x32eb68,null))['catch'](handleError(_0x32eb68,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index 0505f9c..836cb1b 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 _0xf2a2=['api','moment','request-promise','path','rimraf','../../config/environment','exports','define','uniqueid','lodash','../../config/logger'];(function(_0xf98d20,_0x39a333){var _0x496c3d=function(_0x30c2a8){while(--_0x30c2a8){_0xf98d20['push'](_0xf98d20['shift']());}};_0x496c3d(++_0x39a333);}(_0xf2a2,0x1d7));var _0x2f2a=function(_0x129c1,_0x144d9b){_0x129c1=_0x129c1-0x0;var _0x42cde2=_0xf2a2[_0x129c1];return _0x42cde2;};'use strict';var _=require(_0x2f2a('0x0'));var util=require('util');var logger=require(_0x2f2a('0x1'))(_0x2f2a('0x2'));var moment=require(_0x2f2a('0x3'));var BPromise=require('bluebird');var rp=require(_0x2f2a('0x4'));var fs=require('fs');var path=require(_0x2f2a('0x5'));var rimraf=require(_0x2f2a('0x6'));var config=require(_0x2f2a('0x7'));var attributes=require('./faxTransferReport.attributes');module[_0x2f2a('0x8')]=function(_0x17be3e,_0x10508d){return _0x17be3e[_0x2f2a('0x9')]('FaxTransferReport',attributes,{'tableName':'report_fax_transfer','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x2f2a('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x6916=['report_fax_transfer','uniqueid','lodash','util','../../config/logger','api','request-promise','path','../../config/environment','./faxTransferReport.attributes','exports','FaxTransferReport'];(function(_0x1e5704,_0x4cdb70){var _0x40346a=function(_0x456549){while(--_0x456549){_0x1e5704['push'](_0x1e5704['shift']());}};_0x40346a(++_0x4cdb70);}(_0x6916,0x86));var _0x6691=function(_0x41c9d1,_0x27e11a){_0x41c9d1=_0x41c9d1-0x0;var _0x4bdd2d=_0x6916[_0x41c9d1];return _0x4bdd2d;};'use strict';var _=require(_0x6691('0x0'));var util=require(_0x6691('0x1'));var logger=require(_0x6691('0x2'))(_0x6691('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x6691('0x4'));var fs=require('fs');var path=require(_0x6691('0x5'));var rimraf=require('rimraf');var config=require(_0x6691('0x6'));var attributes=require(_0x6691('0x7'));module[_0x6691('0x8')]=function(_0x18b9d1,_0x3e86e5){return _0x18b9d1['define'](_0x6691('0x9'),attributes,{'tableName':_0x6691('0xa'),'paranoid':![],'indexes':[{'name':_0x6691('0xb'),'fields':[_0x6691('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.rpc.js b/server/api/faxTransferReport/faxTransferReport.rpc.js index aa4ab01..8823982 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 _0x1f2e=['request\x20sent','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','FaxTransferReport,\x20%s,\x20%s','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s'];(function(_0x2f257e,_0x49af2c){var _0x16293c=function(_0x59f6d9){while(--_0x59f6d9){_0x2f257e['push'](_0x2f257e['shift']());}};_0x16293c(++_0x49af2c);}(_0x1f2e,0xb7));var _0xe1f2=function(_0x405883,_0x2ce7d5){_0x405883=_0x405883-0x0;var _0x1374d3=_0x1f2e[_0x405883];return _0x1374d3;};'use strict';var _=require(_0xe1f2('0x0'));var util=require(_0xe1f2('0x1'));var moment=require(_0xe1f2('0x2'));var BPromise=require(_0xe1f2('0x3'));var rs=require(_0xe1f2('0x4'));var fs=require('fs');var Redis=require(_0xe1f2('0x5'));var db=require(_0xe1f2('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xe1f2('0x7'))(_0xe1f2('0x8'));var config=require(_0xe1f2('0x9'));var jayson=require(_0xe1f2('0xa'));var client=jayson[_0xe1f2('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x190685,_0xe82c1e,_0x4268fe){return new BPromise(function(_0x563399,_0x255e55){return client[_0xe1f2('0xc')](_0x190685,_0x4268fe)[_0xe1f2('0xd')](function(_0x326cce){logger['info'](_0xe1f2('0xe'),_0xe82c1e,'request\x20sent');logger[_0xe1f2('0xf')](_0xe1f2('0x10'),_0xe82c1e,_0xe1f2('0x11'),JSON[_0xe1f2('0x12')](_0x326cce));if(_0x326cce['error']){if(_0x326cce[_0xe1f2('0x13')][_0xe1f2('0x14')]===0x1f4){logger[_0xe1f2('0x13')](_0xe1f2('0xe'),_0xe82c1e,_0x326cce['error'][_0xe1f2('0x15')]);return _0x255e55(_0x326cce[_0xe1f2('0x13')][_0xe1f2('0x15')]);}logger[_0xe1f2('0x13')]('FaxTransferReport,\x20%s,\x20%s',_0xe82c1e,_0x326cce[_0xe1f2('0x13')][_0xe1f2('0x15')]);return _0x563399(_0x326cce[_0xe1f2('0x13')][_0xe1f2('0x15')]);}else{logger[_0xe1f2('0x16')]('FaxTransferReport,\x20%s,\x20%s',_0xe82c1e,_0xe1f2('0x11'));_0x563399(_0x326cce[_0xe1f2('0x17')][_0xe1f2('0x15')]);}})[_0xe1f2('0x18')](function(_0x732db4){logger['error'](_0xe1f2('0xe'),_0xe82c1e,_0x732db4);_0x255e55(_0x732db4);});});} \ No newline at end of file +var _0xc3c6=['randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','info','FaxTransferReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','lodash','moment'];(function(_0x3df1e0,_0x10bf2a){var _0x595bdb=function(_0x2715e3){while(--_0x2715e3){_0x3df1e0['push'](_0x3df1e0['shift']());}};_0x595bdb(++_0x10bf2a);}(_0xc3c6,0x152));var _0x6c3c=function(_0x4bcfea,_0x487dce){_0x4bcfea=_0x4bcfea-0x0;var _0x25a86f=_0xc3c6[_0x4bcfea];return _0x25a86f;};'use strict';var _=require(_0x6c3c('0x0'));var util=require('util');var moment=require(_0x6c3c('0x1'));var BPromise=require('bluebird');var rs=require(_0x6c3c('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6c3c('0x3'))['db'];var utils=require(_0x6c3c('0x4'));var logger=require('../../config/logger')(_0x6c3c('0x5'));var config=require('../../config/environment');var jayson=require(_0x6c3c('0x6'));var client=jayson[_0x6c3c('0x7')][_0x6c3c('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1ca554,_0x15f062,_0x36d09f){return new BPromise(function(_0x2ffe64,_0x123adf){return client[_0x6c3c('0x9')](_0x1ca554,_0x36d09f)[_0x6c3c('0xa')](function(_0x49a969){logger[_0x6c3c('0xb')](_0x6c3c('0xc'),_0x15f062,_0x6c3c('0xd'));logger[_0x6c3c('0xe')]('FaxTransferReport,\x20%s,\x20%s,\x20%s',_0x15f062,_0x6c3c('0xd'),JSON[_0x6c3c('0xf')](_0x49a969));if(_0x49a969[_0x6c3c('0x10')]){if(_0x49a969['error']['code']===0x1f4){logger[_0x6c3c('0x10')](_0x6c3c('0xc'),_0x15f062,_0x49a969[_0x6c3c('0x10')][_0x6c3c('0x11')]);return _0x123adf(_0x49a969['error']['message']);}logger[_0x6c3c('0x10')]('FaxTransferReport,\x20%s,\x20%s',_0x15f062,_0x49a969[_0x6c3c('0x10')][_0x6c3c('0x11')]);return _0x2ffe64(_0x49a969[_0x6c3c('0x10')][_0x6c3c('0x11')]);}else{logger[_0x6c3c('0xb')](_0x6c3c('0xc'),_0x15f062,_0x6c3c('0xd'));_0x2ffe64(_0x49a969[_0x6c3c('0x12')][_0x6c3c('0x11')]);}})[_0x6c3c('0x13')](function(_0x134ec3){logger['error'](_0x6c3c('0xc'),_0x15f062,_0x134ec3);_0x123adf(_0x134ec3);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index 45e5a96..3cf7c2e 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 _0xc02a=['fs-extra','../../components/interaction/service','./faxTransferReport.controller','get','/describe','isAuthenticated','describe','show','post','create','put','/:id','update','delete','destroy','exports','multer','path','express'];(function(_0x1bac0e,_0x1cc32b){var _0x37f932=function(_0x4f9704){while(--_0x4f9704){_0x1bac0e['push'](_0x1bac0e['shift']());}};_0x37f932(++_0x1cc32b);}(_0xc02a,0x107));var _0xac02=function(_0x487496,_0x249683){_0x487496=_0x487496-0x0;var _0x539dc8=_0xc02a[_0x487496];return _0x539dc8;};'use strict';var multer=require(_0xac02('0x0'));var util=require('util');var path=require(_0xac02('0x1'));var timeout=require('connect-timeout');var express=require(_0xac02('0x2'));var router=express['Router']();var fs_extra=require(_0xac02('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xac02('0x4'));var config=require('../../config/environment');var controller=require(_0xac02('0x5'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xac02('0x6')](_0xac02('0x7'),auth[_0xac02('0x8')](),controller[_0xac02('0x9')]);router[_0xac02('0x6')]('/:id',auth[_0xac02('0x8')](),controller[_0xac02('0xa')]);router[_0xac02('0xb')]('/',auth[_0xac02('0x8')](),controller[_0xac02('0xc')]);router[_0xac02('0xd')](_0xac02('0xe'),auth[_0xac02('0x8')](),controller[_0xac02('0xf')]);router[_0xac02('0x10')](_0xac02('0xe'),auth['isAuthenticated'](),controller[_0xac02('0x11')]);module[_0xac02('0x12')]=router; \ No newline at end of file +var _0x9069=['exports','multer','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./faxTransferReport.controller','get','isAuthenticated','describe','show','create','put','/:id','update','destroy'];(function(_0x5acbc4,_0x33cf81){var _0xc6a4ee=function(_0x14ca9d){while(--_0x14ca9d){_0x5acbc4['push'](_0x5acbc4['shift']());}};_0xc6a4ee(++_0x33cf81);}(_0x9069,0xa3));var _0x9906=function(_0x530d5c,_0x9ec15f){_0x530d5c=_0x530d5c-0x0;var _0x4f332b=_0x9069[_0x530d5c];return _0x4f332b;};'use strict';var multer=require(_0x9906('0x0'));var util=require('util');var path=require(_0x9906('0x1'));var timeout=require('connect-timeout');var express=require(_0x9906('0x2'));var router=express[_0x9906('0x3')]();var fs_extra=require(_0x9906('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x9906('0x5'));var config=require(_0x9906('0x6'));var controller=require(_0x9906('0x7'));router[_0x9906('0x8')]('/',auth[_0x9906('0x9')](),controller['index']);router[_0x9906('0x8')]('/describe',auth['isAuthenticated'](),controller[_0x9906('0xa')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x9906('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0x9906('0xc')]);router[_0x9906('0xd')](_0x9906('0xe'),auth['isAuthenticated'](),controller[_0x9906('0xf')]);router['delete'](_0x9906('0xe'),auth[_0x9906('0x9')](),controller[_0x9906('0x10')]);module[_0x9906('0x11')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/index.js b/server/api/intDeskAccount/index.js index bfc57fa..09dbe21 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 _0xc869=['getConfigurations','get','/:id/fields','getFields','post','create','/:id/configurations','addConfiguration','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intDeskAccount.controller','isAuthenticated','index','show'];(function(_0x3305de,_0x16582f){var _0x3b5a84=function(_0x57d7e1){while(--_0x57d7e1){_0x3305de['push'](_0x3305de['shift']());}};_0x3b5a84(++_0x16582f);}(_0xc869,0x1a3));var _0x9c86=function(_0x5c0529,_0x3d9507){_0x5c0529=_0x5c0529-0x0;var _0x3505c8=_0xc869[_0x5c0529];return _0x3505c8;};'use strict';var multer=require(_0x9c86('0x0'));var util=require(_0x9c86('0x1'));var path=require(_0x9c86('0x2'));var timeout=require(_0x9c86('0x3'));var express=require(_0x9c86('0x4'));var router=express[_0x9c86('0x5')]();var fs_extra=require(_0x9c86('0x6'));var auth=require(_0x9c86('0x7'));var interaction=require(_0x9c86('0x8'));var config=require('../../config/environment');var controller=require(_0x9c86('0x9'));router['get']('/',auth[_0x9c86('0xa')](),controller[_0x9c86('0xb')]);router['get']('/:id',auth[_0x9c86('0xa')](),controller[_0x9c86('0xc')]);router['get']('/:id/configurations',auth[_0x9c86('0xa')](),controller[_0x9c86('0xd')]);router[_0x9c86('0xe')](_0x9c86('0xf'),auth[_0x9c86('0xa')](),controller[_0x9c86('0x10')]);router[_0x9c86('0x11')]('/',auth['isAuthenticated'](),controller[_0x9c86('0x12')]);router[_0x9c86('0x11')](_0x9c86('0x13'),auth[_0x9c86('0xa')](),controller[_0x9c86('0x14')]);router[_0x9c86('0x15')](_0x9c86('0x16'),auth[_0x9c86('0xa')](),controller[_0x9c86('0x17')]);router[_0x9c86('0x18')](_0x9c86('0x16'),auth[_0x9c86('0xa')](),controller[_0x9c86('0x19')]);module[_0x9c86('0x1a')]=router; \ No newline at end of file +var _0x6b9f=['index','/:id','isAuthenticated','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','addConfiguration','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../config/environment','./intDeskAccount.controller','get'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0x6b9f,0x1a7));var _0xf6b9=function(_0x2c3ce9,_0x23097b){_0x2c3ce9=_0x2c3ce9-0x0;var _0x18d083=_0x6b9f[_0x2c3ce9];return _0x18d083;};'use strict';var multer=require(_0xf6b9('0x0'));var util=require(_0xf6b9('0x1'));var path=require(_0xf6b9('0x2'));var timeout=require(_0xf6b9('0x3'));var express=require(_0xf6b9('0x4'));var router=express[_0xf6b9('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xf6b9('0x6'));var controller=require(_0xf6b9('0x7'));router[_0xf6b9('0x8')]('/',auth['isAuthenticated'](),controller[_0xf6b9('0x9')]);router[_0xf6b9('0x8')](_0xf6b9('0xa'),auth[_0xf6b9('0xb')](),controller[_0xf6b9('0xc')]);router[_0xf6b9('0x8')](_0xf6b9('0xd'),auth['isAuthenticated'](),controller[_0xf6b9('0xe')]);router[_0xf6b9('0x8')](_0xf6b9('0xf'),auth[_0xf6b9('0xb')](),controller[_0xf6b9('0x10')]);router[_0xf6b9('0x11')]('/',auth['isAuthenticated'](),controller['create']);router[_0xf6b9('0x11')](_0xf6b9('0xd'),auth[_0xf6b9('0xb')](),controller[_0xf6b9('0x12')]);router[_0xf6b9('0x13')](_0xf6b9('0xa'),auth[_0xf6b9('0xb')](),controller[_0xf6b9('0x14')]);router[_0xf6b9('0x15')]('/:id',auth['isAuthenticated'](),controller[_0xf6b9('0x16')]);module[_0xf6b9('0x17')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.attributes.js b/server/api/intDeskAccount/intDeskAccount.attributes.js index af88943..7de41dc 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 _0x20e7=['basic','integrationTab','newTab','STRING'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x20e7,0xc7));var _0x720e=function(_0x3eb943,_0x5c9b25){_0x3eb943=_0x3eb943-0x0;var _0x34206f=_0x20e7[_0x3eb943];return _0x34206f;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x720e('0x0')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x720e('0x0')]},'remoteUri':{'type':Sequelize['STRING']},'authType':{'type':Sequelize['ENUM'](_0x720e('0x1')),'defaultValue':_0x720e('0x1')},'password':{'type':Sequelize[_0x720e('0x0')]},'consumerKey':{'type':Sequelize['STRING']},'consumerSecret':{'type':Sequelize[_0x720e('0x0')]},'token':{'type':Sequelize[_0x720e('0x0')]},'tokenSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0x720e('0x0')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x720e('0x2'),_0x720e('0x3')),'defaultValue':_0x720e('0x2')}}; \ No newline at end of file +var _0x5452=['basic','integrationTab','newTab','exports','STRING','ENUM'];(function(_0x10c6ab,_0x3260c4){var _0x491f28=function(_0x3799e5){while(--_0x3799e5){_0x10c6ab['push'](_0x10c6ab['shift']());}};_0x491f28(++_0x3260c4);}(_0x5452,0x17d));var _0x2545=function(_0xfec38d,_0xb5a9e){_0xfec38d=_0xfec38d-0x0;var _0x8b46fe=_0x5452[_0xfec38d];return _0x8b46fe;};'use strict';var Sequelize=require('sequelize');module[_0x2545('0x0')]={'name':{'type':Sequelize[_0x2545('0x1')]},'description':{'type':Sequelize[_0x2545('0x1')]},'username':{'type':Sequelize[_0x2545('0x1')]},'remoteUri':{'type':Sequelize[_0x2545('0x1')]},'authType':{'type':Sequelize[_0x2545('0x2')](_0x2545('0x3')),'defaultValue':'basic'},'password':{'type':Sequelize[_0x2545('0x1')]},'consumerKey':{'type':Sequelize['STRING']},'consumerSecret':{'type':Sequelize[_0x2545('0x1')]},'token':{'type':Sequelize['STRING']},'tokenSecret':{'type':Sequelize[_0x2545('0x1')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x2545('0x2')](_0x2545('0x4'),_0x2545('0x5')),'defaultValue':'integrationTab'}}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.controller.js b/server/api/intDeskAccount/intDeskAccount.controller.js index 48bf8fa..468ad16 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 _0xb50a=['merge','where','VIRTUAL','options','count','includeAll','include','findAll','params','keys','find','catch','create','body','destroy','getConfigurations','findOne','DeskConfiguration','filter','nolimit','addConfiguration','AccountId','Subjects','getSubjects','type','Descriptions','DeskField','getFields','priority','remoteUri','authType','username','consumerKey','consumerSecret','token','tokenSecret','slice','lastIndexOf','GET','format','%s/custom_fields','application/json','headers','Authorization','Basic\x20%s','%s:%s','toString','base64','concat','_embedded','entries','active','label','getFields,\x20%s,\x20%s,\x20%s','stringify','test','Wrong\x20credentials','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','undefined','limit','offset','status','Content-Range','json','apply','reject','save','update','then','error','name','index','map','DeskAccount','rawAttributes','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','pick'];(function(_0x1cd297,_0x4b2b98){var _0x2ea65f=function(_0x3dea33){while(--_0x3dea33){_0x1cd297['push'](_0x1cd297['shift']());}};_0x2ea65f(++_0x4b2b98);}(_0xb50a,0x18f));var _0xab50=function(_0x1c4071,_0x8ca88d){_0x1c4071=_0x1c4071-0x0;var _0x4afb04=_0xb50a[_0x1c4071];return _0x4afb04;};'use strict';var emlformat=require(_0xab50('0x0'));var rimraf=require(_0xab50('0x1'));var zipdir=require(_0xab50('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xab50('0x3'));var moment=require(_0xab50('0x4'));var BPromise=require(_0xab50('0x5'));var Mustache=require(_0xab50('0x6'));var util=require(_0xab50('0x7'));var path=require(_0xab50('0x8'));var sox=require(_0xab50('0x9'));var csv=require(_0xab50('0xa'));var ejs=require(_0xab50('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xab50('0xc'));var crypto=require(_0xab50('0xd'));var jsforce=require(_0xab50('0xe'));var deskjs=require(_0xab50('0xf'));var toCsv=require(_0xab50('0xa'));var querystring=require(_0xab50('0x10'));var Papa=require(_0xab50('0x11'));var Redis=require(_0xab50('0x12'));var authService=require(_0xab50('0x13'));var qs=require(_0xab50('0x14'));var as=require(_0xab50('0x15'));var hardwareService=require(_0xab50('0x16'));var logger=require(_0xab50('0x17'))('api');var utils=require(_0xab50('0x18'));var config=require(_0xab50('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xab50('0x1a'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x208e92,_0x22dbf4){_0x22dbf4=_0x22dbf4||0xcc;return function(_0x19fe75){if(_0x19fe75){return _0x208e92[_0xab50('0x1b')](_0x22dbf4);}return _0x208e92['status'](_0x22dbf4)[_0xab50('0x1c')]();};}function respondWithResult(_0x1a372e,_0x561232){_0x561232=_0x561232||0xc8;return function(_0x22db29){if(_0x22db29){return _0x1a372e['status'](_0x561232)['json'](_0x22db29);}};}function respondWithFilteredResult(_0x33eba5,_0x52dde6){return function(_0x5a2b93){if(_0x5a2b93){var _0xa28843=typeof _0x52dde6['offset']===_0xab50('0x1d')&&typeof _0x52dde6[_0xab50('0x1e')]===_0xab50('0x1d');var _0x89a5ac=_0x5a2b93['count'];var _0x356123=_0xa28843?0x0:_0x52dde6[_0xab50('0x1f')];var _0x18f219=_0xa28843?_0x5a2b93['count']:_0x52dde6[_0xab50('0x1f')]+_0x52dde6[_0xab50('0x1e')];var _0x3dcd6d;if(_0x18f219>=_0x89a5ac){_0x18f219=_0x89a5ac;_0x3dcd6d=0xc8;}else{_0x3dcd6d=0xce;}_0x33eba5[_0xab50('0x20')](_0x3dcd6d);return _0x33eba5['set'](_0xab50('0x21'),_0x356123+'-'+_0x18f219+'/'+_0x89a5ac)[_0xab50('0x22')](_0x5a2b93);}return null;};}function patchUpdates(_0x2891ea){return function(_0x4c06c8){try{jsonpatch[_0xab50('0x23')](_0x4c06c8,_0x2891ea,!![]);}catch(_0x2fd666){return BPromise[_0xab50('0x24')](_0x2fd666);}return _0x4c06c8[_0xab50('0x25')]();};}function saveUpdates(_0x4276cd,_0x530da9){return function(_0x34c41c){if(_0x34c41c){return _0x34c41c[_0xab50('0x26')](_0x4276cd)[_0xab50('0x27')](function(_0x2aaceb){return _0x2aaceb;});}return null;};}function removeEntity(_0x4cdee7,_0x393c6a){return function(_0x2f8849){if(_0x2f8849){return _0x2f8849['destroy']()[_0xab50('0x27')](function(){_0x4cdee7[_0xab50('0x20')](0xcc)[_0xab50('0x1c')]();});}};}function handleEntityNotFound(_0x2ccab8,_0x345330){return function(_0x3eb879){if(!_0x3eb879){_0x2ccab8[_0xab50('0x1b')](0x194);}return _0x3eb879;};}function handleError(_0x362f41,_0xb35ebc){_0xb35ebc=_0xb35ebc||0x1f4;return function(_0x316214){logger[_0xab50('0x28')](_0x316214['stack']);if(_0x316214[_0xab50('0x29')]){delete _0x316214['name'];}_0x362f41[_0xab50('0x20')](_0xb35ebc)['send'](_0x316214);};}exports[_0xab50('0x2a')]=function(_0x5599ed,_0x41dc84){var _0x2cfec5={},_0x41dae5={},_0x32eb24={'count':0x0,'rows':[]};var _0x1aefae=_[_0xab50('0x2b')](db[_0xab50('0x2c')][_0xab50('0x2d')],function(_0x13dea9){return{'name':_0x13dea9['fieldName'],'type':_0x13dea9['type']['key']};});_0x41dae5[_0xab50('0x2e')]=_[_0xab50('0x2b')](_0x1aefae,_0xab50('0x29'));_0x41dae5['query']=_['keys'](_0x5599ed[_0xab50('0x2f')]);_0x41dae5[_0xab50('0x30')]=_['intersection'](_0x41dae5[_0xab50('0x2e')],_0x41dae5['query']);_0x2cfec5[_0xab50('0x31')]=_[_0xab50('0x32')](_0x41dae5[_0xab50('0x2e')],qs[_0xab50('0x33')](_0x5599ed['query'][_0xab50('0x33')]));_0x2cfec5[_0xab50('0x31')]=_0x2cfec5[_0xab50('0x31')][_0xab50('0x34')]?_0x2cfec5[_0xab50('0x31')]:_0x41dae5[_0xab50('0x2e')];if(!_0x5599ed['query'][_0xab50('0x35')]('nolimit')){_0x2cfec5['limit']=qs['limit'](_0x5599ed['query']['limit']);_0x2cfec5[_0xab50('0x1f')]=qs[_0xab50('0x1f')](_0x5599ed[_0xab50('0x2f')][_0xab50('0x1f')]);}_0x2cfec5[_0xab50('0x36')]=qs[_0xab50('0x37')](_0x5599ed[_0xab50('0x2f')]['sort']);_0x2cfec5['where']=qs['filters'](_[_0xab50('0x38')](_0x5599ed[_0xab50('0x2f')],_0x41dae5[_0xab50('0x30')]),_0x1aefae);if(_0x5599ed[_0xab50('0x2f')]['filter']){_0x2cfec5['where']=_[_0xab50('0x39')](_0x2cfec5[_0xab50('0x3a')],{'$or':_['map'](_0x1aefae,function(_0xb7f3d1){if(_0xb7f3d1['type']!==_0xab50('0x3b')){var _0x10e76b={};_0x10e76b[_0xb7f3d1[_0xab50('0x29')]]={'$like':'%'+_0x5599ed[_0xab50('0x2f')]['filter']+'%'};return _0x10e76b;}})});}_0x2cfec5=_[_0xab50('0x39')]({},_0x2cfec5,_0x5599ed[_0xab50('0x3c')]);var _0x4a1b85={'where':_0x2cfec5[_0xab50('0x3a')]};return db[_0xab50('0x2c')]['count'](_0x4a1b85)['then'](function(_0x31368f){_0x32eb24[_0xab50('0x3d')]=_0x31368f;if(_0x5599ed[_0xab50('0x2f')][_0xab50('0x3e')]){_0x2cfec5[_0xab50('0x3f')]=[{'all':!![]}];}return db[_0xab50('0x2c')][_0xab50('0x40')](_0x2cfec5);})[_0xab50('0x27')](function(_0x184cc9){_0x32eb24['rows']=_0x184cc9;return _0x32eb24;})[_0xab50('0x27')](respondWithFilteredResult(_0x41dc84,_0x2cfec5))['catch'](handleError(_0x41dc84,null));};exports['show']=function(_0x5753b2,_0x48ee11){var _0x4056a9={'raw':![],'where':{'id':_0x5753b2[_0xab50('0x41')]['id']}},_0x51400c={};_0x51400c[_0xab50('0x2e')]=_[_0xab50('0x42')](db[_0xab50('0x2c')][_0xab50('0x2d')]);_0x51400c['query']=_['keys'](_0x5753b2[_0xab50('0x2f')]);_0x51400c[_0xab50('0x30')]=_['intersection'](_0x51400c['model'],_0x51400c[_0xab50('0x2f')]);_0x4056a9['attributes']=_[_0xab50('0x32')](_0x51400c[_0xab50('0x2e')],qs['fields'](_0x5753b2['query'][_0xab50('0x33')]));_0x4056a9['attributes']=_0x4056a9[_0xab50('0x31')][_0xab50('0x34')]?_0x4056a9[_0xab50('0x31')]:_0x51400c['model'];if(_0x5753b2[_0xab50('0x2f')][_0xab50('0x3e')]){_0x4056a9[_0xab50('0x3f')]=[{'all':!![]}];}_0x4056a9=_[_0xab50('0x39')]({},_0x4056a9,_0x5753b2[_0xab50('0x3c')]);return db[_0xab50('0x2c')][_0xab50('0x43')](_0x4056a9)[_0xab50('0x27')](handleEntityNotFound(_0x48ee11,null))['then'](respondWithResult(_0x48ee11,null))[_0xab50('0x44')](handleError(_0x48ee11,null));};exports[_0xab50('0x45')]=function(_0x12ed19,_0x173441){return db[_0xab50('0x2c')][_0xab50('0x45')](_0x12ed19[_0xab50('0x46')],{})[_0xab50('0x27')](respondWithResult(_0x173441,0xc9))[_0xab50('0x44')](handleError(_0x173441,null));};exports[_0xab50('0x26')]=function(_0x5548e4,_0x11a7aa){if(_0x5548e4[_0xab50('0x46')]['id']){delete _0x5548e4[_0xab50('0x46')]['id'];}return db[_0xab50('0x2c')]['find']({'where':{'id':_0x5548e4[_0xab50('0x41')]['id']}})[_0xab50('0x27')](handleEntityNotFound(_0x11a7aa,null))[_0xab50('0x27')](saveUpdates(_0x5548e4[_0xab50('0x46')],null))[_0xab50('0x27')](respondWithResult(_0x11a7aa,null))[_0xab50('0x44')](handleError(_0x11a7aa,null));};exports[_0xab50('0x47')]=function(_0x2ab1fe,_0x5353a3){return db['DeskAccount'][_0xab50('0x43')]({'where':{'id':_0x2ab1fe[_0xab50('0x41')]['id']}})[_0xab50('0x27')](handleEntityNotFound(_0x5353a3,null))['then'](removeEntity(_0x5353a3,null))[_0xab50('0x44')](handleError(_0x5353a3,null));};exports[_0xab50('0x48')]=function(_0x1f2740,_0x4b078a,_0x3da7cf){var _0x3a7c94={};var _0x234af3={};var _0x4b9bf3;var _0x4f2d2d;return db['DeskAccount'][_0xab50('0x49')]({'where':{'id':_0x1f2740[_0xab50('0x41')]['id']}})['then'](handleEntityNotFound(_0x4b078a,null))['then'](function(_0x2ffb8b){if(_0x2ffb8b){_0x4b9bf3=_0x2ffb8b;_0x234af3[_0xab50('0x2e')]=_[_0xab50('0x42')](db[_0xab50('0x4a')][_0xab50('0x2d')]);_0x234af3[_0xab50('0x2f')]=_[_0xab50('0x42')](_0x1f2740['query']);_0x234af3[_0xab50('0x30')]=_[_0xab50('0x32')](_0x234af3[_0xab50('0x2e')],_0x234af3[_0xab50('0x2f')]);_0x3a7c94[_0xab50('0x31')]=_['intersection'](_0x234af3[_0xab50('0x2e')],qs['fields'](_0x1f2740['query'][_0xab50('0x33')]));_0x3a7c94[_0xab50('0x31')]=_0x3a7c94[_0xab50('0x31')][_0xab50('0x34')]?_0x3a7c94[_0xab50('0x31')]:_0x234af3[_0xab50('0x2e')];_0x3a7c94[_0xab50('0x36')]=qs[_0xab50('0x37')](_0x1f2740[_0xab50('0x2f')][_0xab50('0x37')]);_0x3a7c94[_0xab50('0x3a')]=qs[_0xab50('0x30')](_[_0xab50('0x38')](_0x1f2740[_0xab50('0x2f')],_0x234af3[_0xab50('0x30')]));if(_0x1f2740['query']['filter']){_0x3a7c94[_0xab50('0x3a')]=_[_0xab50('0x39')](_0x3a7c94['where'],{'$or':_['map'](_0x3a7c94[_0xab50('0x31')],function(_0x81e936){var _0x494593={};_0x494593[_0x81e936]={'$like':'%'+_0x1f2740[_0xab50('0x2f')][_0xab50('0x4b')]+'%'};return _0x494593;})});}_0x3a7c94=_[_0xab50('0x39')]({},_0x3a7c94,_0x1f2740[_0xab50('0x3c')]);return _0x4b9bf3[_0xab50('0x48')](_0x3a7c94);}})[_0xab50('0x27')](function(_0x3bbeaf){if(_0x3bbeaf){_0x4f2d2d=_0x3bbeaf[_0xab50('0x34')];if(!_0x1f2740[_0xab50('0x2f')][_0xab50('0x35')](_0xab50('0x4c'))){_0x3a7c94[_0xab50('0x1e')]=qs['limit'](_0x1f2740[_0xab50('0x2f')][_0xab50('0x1e')]);_0x3a7c94[_0xab50('0x1f')]=qs['offset'](_0x1f2740[_0xab50('0x2f')]['offset']);}return _0x4b9bf3['getConfigurations'](_0x3a7c94);}})['then'](function(_0x4b7a2f){if(_0x4b7a2f){return _0x4b7a2f?{'count':_0x4f2d2d,'rows':_0x4b7a2f}:null;}})[_0xab50('0x27')](respondWithResult(_0x4b078a,null))['catch'](handleError(_0x4b078a,null));};exports[_0xab50('0x4d')]=function(_0x882119,_0x3a10ff,_0xa80086){if(_0x882119[_0xab50('0x46')]['id']){delete _0x882119[_0xab50('0x46')]['id'];}return db[_0xab50('0x2c')][_0xab50('0x49')]({'where':{'id':_0x882119[_0xab50('0x41')]['id']}})['then'](handleEntityNotFound(_0x3a10ff,null))['then'](function(_0x1f21c5){if(_0x1f21c5){_0x882119[_0xab50('0x46')][_0xab50('0x4e')]=_0x1f21c5['id'];_0x882119[_0xab50('0x46')][_0xab50('0x4f')]=integrations[_0xab50('0x50')](_0x882119[_0xab50('0x46')]['channel'],_0x882119[_0xab50('0x46')][_0xab50('0x51')]);_0x882119[_0xab50('0x46')][_0xab50('0x52')]=integrations['getDescriptions'](_0x882119[_0xab50('0x46')]['channel'],_0x882119['body'][_0xab50('0x51')]);return db['DeskConfiguration'][_0xab50('0x45')](_0x882119[_0xab50('0x46')],{'include':[{'model':db['DeskField'],'as':_0xab50('0x4f')},{'model':db[_0xab50('0x53')],'as':'Descriptions'}]});}return null;})[_0xab50('0x27')](respondWithResult(_0x3a10ff,null))['catch'](handleError(_0x3a10ff,null));};exports[_0xab50('0x54')]=function(_0x1c4041,_0x1f4196,_0x3dbce1){var _0x2fbc3f=[{'name':_0xab50('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 _0x486b06='';return db[_0xab50('0x2c')]['findOne']({'where':{'id':_0x1c4041[_0xab50('0x41')]['id']},'attributes':['id',_0xab50('0x56'),_0xab50('0x57'),_0xab50('0x58'),'password',_0xab50('0x59'),_0xab50('0x5a'),_0xab50('0x5b'),_0xab50('0x5c')]})['then'](handleEntityNotFound(_0x1f4196,null))[_0xab50('0x27')](function(_0x42ec69){if(_0x42ec69){_0x486b06=_0x42ec69[_0xab50('0x56')];var _0x53e5d7=_0x486b06[_0xab50('0x5d')](-0x1);if(_0x53e5d7==='/'){_0x486b06=_0x486b06['substring'](0x0,_0x486b06[_0xab50('0x5e')](_0x53e5d7));}var _0x2b9695={'method':_0xab50('0x5f'),'uri':util[_0xab50('0x60')](_0xab50('0x61'),_0x486b06),'headers':{'Content-Type':_0xab50('0x62'),'Accept':_0xab50('0x62')},'json':!![]};if(_0x42ec69[_0xab50('0x57')]==='basic'){_0x2b9695[_0xab50('0x63')][_0xab50('0x64')]=util[_0xab50('0x60')](_0xab50('0x65'),new Buffer(util['format'](_0xab50('0x66'),_0x42ec69['username'],_0x42ec69['password']))[_0xab50('0x67')](_0xab50('0x68')));}return rp(_0x2b9695)[_0xab50('0x27')](function(_0x52bed6){return _0x2fbc3f[_0xab50('0x69')](_[_0xab50('0x2b')](_0x52bed6[_0xab50('0x6a')][_0xab50('0x6b')],function(_0x173d19){return{'id':_0x173d19['name'],'name':_0x173d19[_0xab50('0x29')],'type':_0x173d19[_0xab50('0x51')],'active':_0x173d19[_0xab50('0x6c')],'label':_0x173d19[_0xab50('0x6d')],'custom':!![]};}));});}})['then'](function(_0x29ac6c){return{'count':_0x29ac6c[_0xab50('0x34')],'rows':_0x29ac6c};})[_0xab50('0x27')](respondWithResult(_0x1f4196,null))[_0xab50('0x44')](function(_0x2cf06e){var _0x3c3c74=_0x1c4041[_0xab50('0x2f')]['test']?0x1f4:_0x2cf06e['statusCode']||0x1f4;logger[_0xab50('0x28')](_0xab50('0x6e'),_0xab50('0x54'),_0x3c3c74,JSON[_0xab50('0x6f')](_0x2cf06e));delete _0x2cf06e[_0xab50('0x29')];if(_0x3c3c74===0x191){_0x3c3c74=0x190;}_0x1f4196[_0xab50('0x20')](_0x3c3c74)['send'](_0x1c4041[_0xab50('0x2f')][_0xab50('0x70')]?{'message':_0xab50('0x71'),'statusCode':_0x2cf06e['statusCode']}:_0x2cf06e);});}; \ No newline at end of file +var _0xada8=['end','json','offset','limit','count','set','Content-Range','reject','save','then','destroy','error','stack','send','map','DeskAccount','rawAttributes','fieldName','type','model','name','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','merge','includeAll','include','findAll','rows','show','params','options','find','catch','create','update','body','getConfigurations','DeskConfiguration','order','filter','addConfiguration','findOne','AccountId','getSubjects','channel','Descriptions','getDescriptions','DeskField','Subjects','priority','remoteUri','authType','username','password','consumerKey','consumerSecret','token','tokenSecret','slice','substring','lastIndexOf','%s/custom_fields','application/json','headers','Basic\x20%s','format','%s:%s','base64','concat','_embedded','statusCode','getFields','stringify','test','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status'];(function(_0x4e5b82,_0x21a4f9){var _0x1ace82=function(_0xf0fce){while(--_0xf0fce){_0x4e5b82['push'](_0x4e5b82['shift']());}};_0x1ace82(++_0x21a4f9);}(_0xada8,0x137));var _0x8ada=function(_0x51af3f,_0x3f911d){_0x51af3f=_0x51af3f-0x0;var _0x24be82=_0xada8[_0x51af3f];return _0x24be82;};'use strict';var emlformat=require(_0x8ada('0x0'));var rimraf=require(_0x8ada('0x1'));var zipdir=require(_0x8ada('0x2'));var jsonpatch=require(_0x8ada('0x3'));var rp=require(_0x8ada('0x4'));var moment=require('moment');var BPromise=require(_0x8ada('0x5'));var Mustache=require('mustache');var util=require(_0x8ada('0x6'));var path=require(_0x8ada('0x7'));var sox=require(_0x8ada('0x8'));var csv=require(_0x8ada('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8ada('0xa'));var _=require(_0x8ada('0xb'));var squel=require(_0x8ada('0xc'));var crypto=require(_0x8ada('0xd'));var jsforce=require(_0x8ada('0xe'));var deskjs=require(_0x8ada('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x8ada('0x10'));var Redis=require(_0x8ada('0x11'));var authService=require(_0x8ada('0x12'));var qs=require(_0x8ada('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x8ada('0x14'))(_0x8ada('0x15'));var utils=require(_0x8ada('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x8ada('0x17'));var db=require(_0x8ada('0x18'))['db'];var integrations=require(_0x8ada('0x19'));function respondWithStatusCode(_0x5b8bb1,_0x29acc2){_0x29acc2=_0x29acc2||0xcc;return function(_0x4bbca8){if(_0x4bbca8){return _0x5b8bb1[_0x8ada('0x1a')](_0x29acc2);}return _0x5b8bb1[_0x8ada('0x1b')](_0x29acc2)[_0x8ada('0x1c')]();};}function respondWithResult(_0x5b08d2,_0x6bfcac){_0x6bfcac=_0x6bfcac||0xc8;return function(_0x168067){if(_0x168067){return _0x5b08d2['status'](_0x6bfcac)[_0x8ada('0x1d')](_0x168067);}};}function respondWithFilteredResult(_0x288cdb,_0x23574d){return function(_0x6bc132){if(_0x6bc132){var _0x27faf8=typeof _0x23574d[_0x8ada('0x1e')]==='undefined'&&typeof _0x23574d[_0x8ada('0x1f')]==='undefined';var _0x2fef1a=_0x6bc132[_0x8ada('0x20')];var _0x390f96=_0x27faf8?0x0:_0x23574d[_0x8ada('0x1e')];var _0x375cd1=_0x27faf8?_0x6bc132['count']:_0x23574d['offset']+_0x23574d['limit'];var _0x32af40;if(_0x375cd1>=_0x2fef1a){_0x375cd1=_0x2fef1a;_0x32af40=0xc8;}else{_0x32af40=0xce;}_0x288cdb[_0x8ada('0x1b')](_0x32af40);return _0x288cdb[_0x8ada('0x21')](_0x8ada('0x22'),_0x390f96+'-'+_0x375cd1+'/'+_0x2fef1a)[_0x8ada('0x1d')](_0x6bc132);}return null;};}function patchUpdates(_0x51cd1d){return function(_0x4b11a7){try{jsonpatch['apply'](_0x4b11a7,_0x51cd1d,!![]);}catch(_0x491f20){return BPromise[_0x8ada('0x23')](_0x491f20);}return _0x4b11a7[_0x8ada('0x24')]();};}function saveUpdates(_0x53ca87,_0x5351f1){return function(_0x531984){if(_0x531984){return _0x531984['update'](_0x53ca87)[_0x8ada('0x25')](function(_0x4fe675){return _0x4fe675;});}return null;};}function removeEntity(_0x1be941,_0x988bf0){return function(_0x1f468a){if(_0x1f468a){return _0x1f468a[_0x8ada('0x26')]()[_0x8ada('0x25')](function(){_0x1be941['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x176b3c,_0x43b4e8){return function(_0x5bdc17){if(!_0x5bdc17){_0x176b3c['sendStatus'](0x194);}return _0x5bdc17;};}function handleError(_0x630b0f,_0x472206){_0x472206=_0x472206||0x1f4;return function(_0x33caff){logger[_0x8ada('0x27')](_0x33caff[_0x8ada('0x28')]);if(_0x33caff['name']){delete _0x33caff['name'];}_0x630b0f['status'](_0x472206)[_0x8ada('0x29')](_0x33caff);};}exports['index']=function(_0x7050c3,_0x2d5c91){var _0x370a6f={},_0x1c4ee6={},_0x5a92d6={'count':0x0,'rows':[]};var _0xee816f=_[_0x8ada('0x2a')](db[_0x8ada('0x2b')][_0x8ada('0x2c')],function(_0x4180eb){return{'name':_0x4180eb[_0x8ada('0x2d')],'type':_0x4180eb[_0x8ada('0x2e')]['key']};});_0x1c4ee6[_0x8ada('0x2f')]=_['map'](_0xee816f,_0x8ada('0x30'));_0x1c4ee6[_0x8ada('0x31')]=_[_0x8ada('0x32')](_0x7050c3[_0x8ada('0x31')]);_0x1c4ee6['filters']=_[_0x8ada('0x33')](_0x1c4ee6[_0x8ada('0x2f')],_0x1c4ee6[_0x8ada('0x31')]);_0x370a6f[_0x8ada('0x34')]=_[_0x8ada('0x33')](_0x1c4ee6[_0x8ada('0x2f')],qs[_0x8ada('0x35')](_0x7050c3[_0x8ada('0x31')][_0x8ada('0x35')]));_0x370a6f['attributes']=_0x370a6f[_0x8ada('0x34')][_0x8ada('0x36')]?_0x370a6f[_0x8ada('0x34')]:_0x1c4ee6[_0x8ada('0x2f')];if(!_0x7050c3[_0x8ada('0x31')][_0x8ada('0x37')](_0x8ada('0x38'))){_0x370a6f[_0x8ada('0x1f')]=qs[_0x8ada('0x1f')](_0x7050c3[_0x8ada('0x31')][_0x8ada('0x1f')]);_0x370a6f['offset']=qs[_0x8ada('0x1e')](_0x7050c3[_0x8ada('0x31')][_0x8ada('0x1e')]);}_0x370a6f['order']=qs[_0x8ada('0x39')](_0x7050c3['query'][_0x8ada('0x39')]);_0x370a6f[_0x8ada('0x3a')]=qs[_0x8ada('0x3b')](_[_0x8ada('0x3c')](_0x7050c3[_0x8ada('0x31')],_0x1c4ee6[_0x8ada('0x3b')]),_0xee816f);if(_0x7050c3[_0x8ada('0x31')]['filter']){_0x370a6f['where']=_[_0x8ada('0x3d')](_0x370a6f[_0x8ada('0x3a')],{'$or':_[_0x8ada('0x2a')](_0xee816f,function(_0x7fbb74){if(_0x7fbb74[_0x8ada('0x2e')]!=='VIRTUAL'){var _0x27c93d={};_0x27c93d[_0x7fbb74['name']]={'$like':'%'+_0x7050c3[_0x8ada('0x31')]['filter']+'%'};return _0x27c93d;}})});}_0x370a6f=_[_0x8ada('0x3d')]({},_0x370a6f,_0x7050c3['options']);var _0x11c893={'where':_0x370a6f['where']};return db['DeskAccount'][_0x8ada('0x20')](_0x11c893)[_0x8ada('0x25')](function(_0x3e0292){_0x5a92d6['count']=_0x3e0292;if(_0x7050c3['query'][_0x8ada('0x3e')]){_0x370a6f[_0x8ada('0x3f')]=[{'all':!![]}];}return db[_0x8ada('0x2b')][_0x8ada('0x40')](_0x370a6f);})['then'](function(_0x8a03db){_0x5a92d6[_0x8ada('0x41')]=_0x8a03db;return _0x5a92d6;})[_0x8ada('0x25')](respondWithFilteredResult(_0x2d5c91,_0x370a6f))['catch'](handleError(_0x2d5c91,null));};exports[_0x8ada('0x42')]=function(_0x249168,_0x6c825a){var _0x5468ac={'raw':![],'where':{'id':_0x249168[_0x8ada('0x43')]['id']}},_0x129df9={};_0x129df9['model']=_[_0x8ada('0x32')](db[_0x8ada('0x2b')][_0x8ada('0x2c')]);_0x129df9[_0x8ada('0x31')]=_[_0x8ada('0x32')](_0x249168['query']);_0x129df9[_0x8ada('0x3b')]=_['intersection'](_0x129df9[_0x8ada('0x2f')],_0x129df9[_0x8ada('0x31')]);_0x5468ac[_0x8ada('0x34')]=_[_0x8ada('0x33')](_0x129df9['model'],qs['fields'](_0x249168[_0x8ada('0x31')][_0x8ada('0x35')]));_0x5468ac[_0x8ada('0x34')]=_0x5468ac[_0x8ada('0x34')][_0x8ada('0x36')]?_0x5468ac[_0x8ada('0x34')]:_0x129df9[_0x8ada('0x2f')];if(_0x249168[_0x8ada('0x31')]['includeAll']){_0x5468ac[_0x8ada('0x3f')]=[{'all':!![]}];}_0x5468ac=_[_0x8ada('0x3d')]({},_0x5468ac,_0x249168[_0x8ada('0x44')]);return db[_0x8ada('0x2b')][_0x8ada('0x45')](_0x5468ac)[_0x8ada('0x25')](handleEntityNotFound(_0x6c825a,null))[_0x8ada('0x25')](respondWithResult(_0x6c825a,null))[_0x8ada('0x46')](handleError(_0x6c825a,null));};exports[_0x8ada('0x47')]=function(_0x2311b2,_0x2d6e6d){return db[_0x8ada('0x2b')][_0x8ada('0x47')](_0x2311b2['body'],{})[_0x8ada('0x25')](respondWithResult(_0x2d6e6d,0xc9))['catch'](handleError(_0x2d6e6d,null));};exports[_0x8ada('0x48')]=function(_0x229724,_0x1a8545){if(_0x229724[_0x8ada('0x49')]['id']){delete _0x229724[_0x8ada('0x49')]['id'];}return db[_0x8ada('0x2b')][_0x8ada('0x45')]({'where':{'id':_0x229724['params']['id']}})['then'](handleEntityNotFound(_0x1a8545,null))[_0x8ada('0x25')](saveUpdates(_0x229724[_0x8ada('0x49')],null))[_0x8ada('0x25')](respondWithResult(_0x1a8545,null))['catch'](handleError(_0x1a8545,null));};exports[_0x8ada('0x26')]=function(_0x486dff,_0x211096){return db[_0x8ada('0x2b')][_0x8ada('0x45')]({'where':{'id':_0x486dff[_0x8ada('0x43')]['id']}})[_0x8ada('0x25')](handleEntityNotFound(_0x211096,null))['then'](removeEntity(_0x211096,null))[_0x8ada('0x46')](handleError(_0x211096,null));};exports[_0x8ada('0x4a')]=function(_0x857e2,_0x2422c9,_0x41cbb9){var _0x46a409={};var _0x3d8d3f={};var _0x15858c;var _0x358e6b;return db[_0x8ada('0x2b')]['findOne']({'where':{'id':_0x857e2[_0x8ada('0x43')]['id']}})[_0x8ada('0x25')](handleEntityNotFound(_0x2422c9,null))[_0x8ada('0x25')](function(_0x46f505){if(_0x46f505){_0x15858c=_0x46f505;_0x3d8d3f[_0x8ada('0x2f')]=_[_0x8ada('0x32')](db[_0x8ada('0x4b')][_0x8ada('0x2c')]);_0x3d8d3f[_0x8ada('0x31')]=_[_0x8ada('0x32')](_0x857e2[_0x8ada('0x31')]);_0x3d8d3f[_0x8ada('0x3b')]=_['intersection'](_0x3d8d3f[_0x8ada('0x2f')],_0x3d8d3f[_0x8ada('0x31')]);_0x46a409['attributes']=_[_0x8ada('0x33')](_0x3d8d3f[_0x8ada('0x2f')],qs['fields'](_0x857e2['query']['fields']));_0x46a409['attributes']=_0x46a409[_0x8ada('0x34')][_0x8ada('0x36')]?_0x46a409[_0x8ada('0x34')]:_0x3d8d3f['model'];_0x46a409[_0x8ada('0x4c')]=qs['sort'](_0x857e2[_0x8ada('0x31')]['sort']);_0x46a409['where']=qs[_0x8ada('0x3b')](_[_0x8ada('0x3c')](_0x857e2[_0x8ada('0x31')],_0x3d8d3f[_0x8ada('0x3b')]));if(_0x857e2['query'][_0x8ada('0x4d')]){_0x46a409['where']=_['merge'](_0x46a409[_0x8ada('0x3a')],{'$or':_[_0x8ada('0x2a')](_0x46a409[_0x8ada('0x34')],function(_0x289402){var _0x3a9bac={};_0x3a9bac[_0x289402]={'$like':'%'+_0x857e2['query'][_0x8ada('0x4d')]+'%'};return _0x3a9bac;})});}_0x46a409=_[_0x8ada('0x3d')]({},_0x46a409,_0x857e2['options']);return _0x15858c['getConfigurations'](_0x46a409);}})[_0x8ada('0x25')](function(_0x4dd612){if(_0x4dd612){_0x358e6b=_0x4dd612[_0x8ada('0x36')];if(!_0x857e2['query'][_0x8ada('0x37')](_0x8ada('0x38'))){_0x46a409[_0x8ada('0x1f')]=qs[_0x8ada('0x1f')](_0x857e2[_0x8ada('0x31')][_0x8ada('0x1f')]);_0x46a409[_0x8ada('0x1e')]=qs[_0x8ada('0x1e')](_0x857e2[_0x8ada('0x31')][_0x8ada('0x1e')]);}return _0x15858c['getConfigurations'](_0x46a409);}})[_0x8ada('0x25')](function(_0x2a0a7d){if(_0x2a0a7d){return _0x2a0a7d?{'count':_0x358e6b,'rows':_0x2a0a7d}:null;}})[_0x8ada('0x25')](respondWithResult(_0x2422c9,null))['catch'](handleError(_0x2422c9,null));};exports[_0x8ada('0x4e')]=function(_0x325866,_0x212acb,_0x255d1f){if(_0x325866[_0x8ada('0x49')]['id']){delete _0x325866[_0x8ada('0x49')]['id'];}return db[_0x8ada('0x2b')][_0x8ada('0x4f')]({'where':{'id':_0x325866['params']['id']}})['then'](handleEntityNotFound(_0x212acb,null))['then'](function(_0x5eef85){if(_0x5eef85){_0x325866['body'][_0x8ada('0x50')]=_0x5eef85['id'];_0x325866[_0x8ada('0x49')]['Subjects']=integrations[_0x8ada('0x51')](_0x325866[_0x8ada('0x49')][_0x8ada('0x52')],_0x325866[_0x8ada('0x49')][_0x8ada('0x2e')]);_0x325866[_0x8ada('0x49')][_0x8ada('0x53')]=integrations[_0x8ada('0x54')](_0x325866[_0x8ada('0x49')][_0x8ada('0x52')],_0x325866[_0x8ada('0x49')][_0x8ada('0x2e')]);return db['DeskConfiguration'][_0x8ada('0x47')](_0x325866[_0x8ada('0x49')],{'include':[{'model':db[_0x8ada('0x55')],'as':_0x8ada('0x56')},{'model':db[_0x8ada('0x55')],'as':_0x8ada('0x53')}]});}return null;})[_0x8ada('0x25')](respondWithResult(_0x212acb,null))['catch'](handleError(_0x212acb,null));};exports['getFields']=function(_0x21b8eb,_0x2db97f,_0x32dc8d){var _0x24c176=[{'name':_0x8ada('0x57'),'label':_0x8ada('0x57'),'custom':![],'options':[{'name':0x1,'value':0x1},{'name':0x2,'value':0x2},{'name':0x3,'value':0x3},{'name':0x4,'value':0x4},{'name':0x5,'value':0x5},{'name':0x6,'value':0x6},{'name':0x7,'value':0x7},{'name':0x8,'value':0x8},{'name':0x9,'value':0x9},{'name':0xa,'value':0xa}]}];var _0x569015='';return db['DeskAccount'][_0x8ada('0x4f')]({'where':{'id':_0x21b8eb['params']['id']},'attributes':['id',_0x8ada('0x58'),_0x8ada('0x59'),_0x8ada('0x5a'),_0x8ada('0x5b'),_0x8ada('0x5c'),_0x8ada('0x5d'),_0x8ada('0x5e'),_0x8ada('0x5f')]})[_0x8ada('0x25')](handleEntityNotFound(_0x2db97f,null))[_0x8ada('0x25')](function(_0x1ae88e){if(_0x1ae88e){_0x569015=_0x1ae88e[_0x8ada('0x58')];var _0x33d8c6=_0x569015[_0x8ada('0x60')](-0x1);if(_0x33d8c6==='/'){_0x569015=_0x569015[_0x8ada('0x61')](0x0,_0x569015[_0x8ada('0x62')](_0x33d8c6));}var _0x31810b={'method':'GET','uri':util['format'](_0x8ada('0x63'),_0x569015),'headers':{'Content-Type':_0x8ada('0x64'),'Accept':_0x8ada('0x64')},'json':!![]};if(_0x1ae88e[_0x8ada('0x59')]==='basic'){_0x31810b[_0x8ada('0x65')]['Authorization']=util['format'](_0x8ada('0x66'),new Buffer(util[_0x8ada('0x67')](_0x8ada('0x68'),_0x1ae88e[_0x8ada('0x5a')],_0x1ae88e[_0x8ada('0x5b')]))['toString'](_0x8ada('0x69')));}return rp(_0x31810b)[_0x8ada('0x25')](function(_0x1e214e){return _0x24c176[_0x8ada('0x6a')](_[_0x8ada('0x2a')](_0x1e214e[_0x8ada('0x6b')]['entries'],function(_0x6ecd9b){return{'id':_0x6ecd9b[_0x8ada('0x30')],'name':_0x6ecd9b['name'],'type':_0x6ecd9b['type'],'active':_0x6ecd9b['active'],'label':_0x6ecd9b['label'],'custom':!![]};}));});}})['then'](function(_0x5a5515){return{'count':_0x5a5515[_0x8ada('0x36')],'rows':_0x5a5515};})[_0x8ada('0x25')](respondWithResult(_0x2db97f,null))[_0x8ada('0x46')](function(_0x4310c5){var _0xfe0df2=_0x21b8eb[_0x8ada('0x31')]['test']?0x1f4:_0x4310c5[_0x8ada('0x6c')]||0x1f4;logger[_0x8ada('0x27')]('getFields,\x20%s,\x20%s,\x20%s',_0x8ada('0x6d'),_0xfe0df2,JSON[_0x8ada('0x6e')](_0x4310c5));delete _0x4310c5[_0x8ada('0x30')];if(_0xfe0df2===0x191){_0xfe0df2=0x190;}_0x2db97f[_0x8ada('0x1b')](_0xfe0df2)[_0x8ada('0x29')](_0x21b8eb[_0x8ada('0x31')][_0x8ada('0x6f')]?{'message':_0x8ada('0x70'),'statusCode':_0x4310c5[_0x8ada('0x6c')]}:_0x4310c5);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index e63f932..9f758fb 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 _0x6f9e=['lodash','api','moment','bluebird','request-promise','rimraf','./intDeskAccount.attributes','../../components/integrations/configuration','exports','define','int_desk_accounts'];(function(_0x88cd7b,_0x4c884c){var _0x56fcc8=function(_0x513b3d){while(--_0x513b3d){_0x88cd7b['push'](_0x88cd7b['shift']());}};_0x56fcc8(++_0x4c884c);}(_0x6f9e,0x155));var _0xe6f9=function(_0x32126f,_0xb8d4e6){_0x32126f=_0x32126f-0x0;var _0x492842=_0x6f9e[_0x32126f];return _0x492842;};'use strict';var _=require(_0xe6f9('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xe6f9('0x1'));var moment=require(_0xe6f9('0x2'));var BPromise=require(_0xe6f9('0x3'));var rp=require(_0xe6f9('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe6f9('0x5'));var config=require('../../config/environment');var attributes=require(_0xe6f9('0x6'));var integrations=require(_0xe6f9('0x7'));module[_0xe6f9('0x8')]=function(_0x47ffe1,_0x44e7d9){return _0x47ffe1[_0xe6f9('0x9')]('DeskAccount',attributes,{'tableName':_0xe6f9('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6c20=['rimraf','./intDeskAccount.attributes','../../components/integrations/configuration','exports','define','DeskAccount','int_desk_accounts','util','../../config/logger','bluebird','request-promise'];(function(_0x4ceda8,_0x3b91cc){var _0x122eb2=function(_0x2db4cc){while(--_0x2db4cc){_0x4ceda8['push'](_0x4ceda8['shift']());}};_0x122eb2(++_0x3b91cc);}(_0x6c20,0xe3));var _0x06c2=function(_0x23e33d,_0x31c8c8){_0x23e33d=_0x23e33d-0x0;var _0x818fc=_0x6c20[_0x23e33d];return _0x818fc;};'use strict';var _=require('lodash');var util=require(_0x06c2('0x0'));var logger=require(_0x06c2('0x1'))('api');var moment=require('moment');var BPromise=require(_0x06c2('0x2'));var rp=require(_0x06c2('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x06c2('0x4'));var config=require('../../config/environment');var attributes=require(_0x06c2('0x5'));var integrations=require(_0x06c2('0x6'));module[_0x06c2('0x7')]=function(_0x537cb9,_0x4b8f73){return _0x537cb9[_0x06c2('0x8')](_0x06c2('0x9'),attributes,{'tableName':_0x06c2('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.rpc.js b/server/api/intDeskAccount/intDeskAccount.rpc.js index f572263..ed9054d 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 _0x9a5d=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','DeskAccount,\x20%s,\x20%s','debug','DeskAccount,\x20%s,\x20%s,\x20%s','error','message','request\x20sent','catch','GetDeskAccount','DeskAccount','findAll','options','raw','limit','map','model','attributes','include','then','stringify','ShowDeskAccount','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x35c021,_0x1b1c07){var _0xca7a81=function(_0x366f71){while(--_0x366f71){_0x35c021['push'](_0x35c021['shift']());}};_0xca7a81(++_0x1b1c07);}(_0x9a5d,0xf6));var _0xd9a5=function(_0x41cec2,_0xe1e3d6){_0x41cec2=_0x41cec2-0x0;var _0x524cb6=_0x9a5d[_0x41cec2];return _0x524cb6;};'use strict';var _=require(_0xd9a5('0x0'));var util=require(_0xd9a5('0x1'));var moment=require(_0xd9a5('0x2'));var BPromise=require(_0xd9a5('0x3'));var rs=require(_0xd9a5('0x4'));var fs=require('fs');var Redis=require(_0xd9a5('0x5'));var db=require(_0xd9a5('0x6'))['db'];var utils=require(_0xd9a5('0x7'));var logger=require(_0xd9a5('0x8'))(_0xd9a5('0x9'));var config=require(_0xd9a5('0xa'));var jayson=require(_0xd9a5('0xb'));var client=jayson[_0xd9a5('0xc')][_0xd9a5('0xd')]({'port':0x232a});function respondWithRpcPromise(_0xb9a379,_0x3a4d98,_0x4f6bd3){return new BPromise(function(_0x9d365,_0x39a9ab){return client[_0xd9a5('0xe')](_0xb9a379,_0x4f6bd3)['then'](function(_0x33c00e){logger[_0xd9a5('0xf')](_0xd9a5('0x10'),_0x3a4d98,'request\x20sent');logger[_0xd9a5('0x11')](_0xd9a5('0x12'),_0x3a4d98,'request\x20sent',JSON['stringify'](_0x33c00e));if(_0x33c00e['error']){if(_0x33c00e[_0xd9a5('0x13')]['code']===0x1f4){logger[_0xd9a5('0x13')]('DeskAccount,\x20%s,\x20%s',_0x3a4d98,_0x33c00e[_0xd9a5('0x13')][_0xd9a5('0x14')]);return _0x39a9ab(_0x33c00e['error'][_0xd9a5('0x14')]);}logger[_0xd9a5('0x13')](_0xd9a5('0x10'),_0x3a4d98,_0x33c00e[_0xd9a5('0x13')]['message']);return _0x9d365(_0x33c00e[_0xd9a5('0x13')][_0xd9a5('0x14')]);}else{logger[_0xd9a5('0xf')](_0xd9a5('0x10'),_0x3a4d98,_0xd9a5('0x15'));_0x9d365(_0x33c00e['result']['message']);}})[_0xd9a5('0x16')](function(_0x3ead53){logger[_0xd9a5('0x13')](_0xd9a5('0x10'),_0x3a4d98,_0x3ead53);_0x39a9ab(_0x3ead53);});});}exports[_0xd9a5('0x17')]=function(_0x5d099b){var _0x10d59b=this;return new Promise(function(_0x45df1d,_0x10bca5){return db[_0xd9a5('0x18')][_0xd9a5('0x19')]({'raw':_0x5d099b[_0xd9a5('0x1a')]?_0x5d099b[_0xd9a5('0x1a')][_0xd9a5('0x1b')]===undefined?!![]:![]:!![],'where':_0x5d099b[_0xd9a5('0x1a')]?_0x5d099b['options']['where']||null:null,'attributes':_0x5d099b[_0xd9a5('0x1a')]?_0x5d099b[_0xd9a5('0x1a')]['attributes']||null:null,'limit':_0x5d099b[_0xd9a5('0x1a')]?_0x5d099b[_0xd9a5('0x1a')][_0xd9a5('0x1c')]||null:null,'include':_0x5d099b[_0xd9a5('0x1a')]?_0x5d099b[_0xd9a5('0x1a')]['include']?_[_0xd9a5('0x1d')](_0x5d099b[_0xd9a5('0x1a')]['include'],function(_0x37c772){return{'model':db[_0x37c772[_0xd9a5('0x1e')]],'as':_0x37c772['as'],'attributes':_0x37c772[_0xd9a5('0x1f')],'include':_0x37c772[_0xd9a5('0x20')]?_[_0xd9a5('0x1d')](_0x37c772['include'],function(_0x3e483e){return{'model':db[_0x3e483e[_0xd9a5('0x1e')]],'as':_0x3e483e['as'],'attributes':_0x3e483e[_0xd9a5('0x1f')],'include':_0x3e483e[_0xd9a5('0x20')]?_['map'](_0x3e483e[_0xd9a5('0x20')],function(_0x1e9948){return{'model':db[_0x1e9948[_0xd9a5('0x1e')]],'as':_0x1e9948['as'],'attributes':_0x1e9948['attributes']};}):[]};}):[]};}):[]:[]})[_0xd9a5('0x21')](function(_0x33a6d2){logger[_0xd9a5('0xf')](_0xd9a5('0x17'),_0x5d099b);logger['debug'](_0xd9a5('0x17'),_0x5d099b,JSON[_0xd9a5('0x22')](_0x33a6d2));_0x45df1d(_0x33a6d2);})['catch'](function(_0x3e8b83){logger[_0xd9a5('0x13')](_0xd9a5('0x17'),_0x3e8b83['message'],_0x5d099b);_0x10bca5(_0x10d59b[_0xd9a5('0x13')](0x1f4,_0x3e8b83['message']));});});};exports[_0xd9a5('0x23')]=function(_0x2ccdba){var _0x1b5f3c=this;return new Promise(function(_0x1822db,_0xa702ee){return db[_0xd9a5('0x18')]['find']({'raw':_0x2ccdba['options']?_0x2ccdba[_0xd9a5('0x1a')][_0xd9a5('0x1b')]===undefined?!![]:![]:!![],'where':_0x2ccdba[_0xd9a5('0x1a')]?_0x2ccdba[_0xd9a5('0x1a')]['where']||null:null,'attributes':_0x2ccdba[_0xd9a5('0x1a')]?_0x2ccdba[_0xd9a5('0x1a')]['attributes']||null:null,'include':_0x2ccdba['options']?_0x2ccdba[_0xd9a5('0x1a')][_0xd9a5('0x20')]?_['map'](_0x2ccdba['options'][_0xd9a5('0x20')],function(_0x27108c){return{'model':db[_0x27108c['model']],'as':_0x27108c['as'],'attributes':_0x27108c[_0xd9a5('0x1f')],'include':_0x27108c['include']?_[_0xd9a5('0x1d')](_0x27108c[_0xd9a5('0x20')],function(_0x564b17){return{'model':db[_0x564b17[_0xd9a5('0x1e')]],'as':_0x564b17['as'],'attributes':_0x564b17['attributes'],'include':_0x564b17[_0xd9a5('0x20')]?_[_0xd9a5('0x1d')](_0x564b17[_0xd9a5('0x20')],function(_0x53301e){return{'model':db[_0x53301e[_0xd9a5('0x1e')]],'as':_0x53301e['as'],'attributes':_0x53301e[_0xd9a5('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x52374c){logger[_0xd9a5('0xf')](_0xd9a5('0x23'),_0x2ccdba);logger[_0xd9a5('0x11')](_0xd9a5('0x23'),_0x2ccdba,JSON[_0xd9a5('0x22')](_0x52374c));_0x1822db(_0x52374c);})[_0xd9a5('0x16')](function(_0x1053fb){logger[_0xd9a5('0x13')](_0xd9a5('0x23'),_0x1053fb[_0xd9a5('0x14')],_0x2ccdba);_0xa702ee(_0x1b5f3c[_0xd9a5('0x13')](0x1f4,_0x1053fb[_0xd9a5('0x14')]));});});}; \ No newline at end of file +var _0xee48=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','info','DeskAccount,\x20%s,\x20%s','request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetDeskAccount','DeskAccount','options','raw','where','attributes','map','model','include','ShowDeskAccount','find','then','util','moment','bluebird','randomstring'];(function(_0x2dda31,_0x41f900){var _0x10735a=function(_0x147685){while(--_0x147685){_0x2dda31['push'](_0x2dda31['shift']());}};_0x10735a(++_0x41f900);}(_0xee48,0xab));var _0x8ee4=function(_0x4ae625,_0xf396d0){_0x4ae625=_0x4ae625-0x0;var _0x31accf=_0xee48[_0x4ae625];return _0x31accf;};'use strict';var _=require('lodash');var util=require(_0x8ee4('0x0'));var moment=require(_0x8ee4('0x1'));var BPromise=require(_0x8ee4('0x2'));var rs=require(_0x8ee4('0x3'));var fs=require('fs');var Redis=require(_0x8ee4('0x4'));var db=require(_0x8ee4('0x5'))['db'];var utils=require(_0x8ee4('0x6'));var logger=require(_0x8ee4('0x7'))(_0x8ee4('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x8ee4('0x9')][_0x8ee4('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x541fb5,_0x58e317,_0x44f9d8){return new BPromise(function(_0x17943e,_0x1ca818){return client[_0x8ee4('0xb')](_0x541fb5,_0x44f9d8)['then'](function(_0x2ea56e){logger[_0x8ee4('0xc')](_0x8ee4('0xd'),_0x58e317,_0x8ee4('0xe'));logger[_0x8ee4('0xf')](_0x8ee4('0x10'),_0x58e317,'request\x20sent',JSON[_0x8ee4('0x11')](_0x2ea56e));if(_0x2ea56e[_0x8ee4('0x12')]){if(_0x2ea56e[_0x8ee4('0x12')][_0x8ee4('0x13')]===0x1f4){logger[_0x8ee4('0x12')](_0x8ee4('0xd'),_0x58e317,_0x2ea56e['error']['message']);return _0x1ca818(_0x2ea56e[_0x8ee4('0x12')][_0x8ee4('0x14')]);}logger[_0x8ee4('0x12')](_0x8ee4('0xd'),_0x58e317,_0x2ea56e[_0x8ee4('0x12')]['message']);return _0x17943e(_0x2ea56e[_0x8ee4('0x12')][_0x8ee4('0x14')]);}else{logger['info'](_0x8ee4('0xd'),_0x58e317,'request\x20sent');_0x17943e(_0x2ea56e[_0x8ee4('0x15')][_0x8ee4('0x14')]);}})[_0x8ee4('0x16')](function(_0x26014d){logger[_0x8ee4('0x12')](_0x8ee4('0xd'),_0x58e317,_0x26014d);_0x1ca818(_0x26014d);});});}exports[_0x8ee4('0x17')]=function(_0x5317dc){var _0x5c3232=this;return new Promise(function(_0x2f961d,_0x1c209b){return db[_0x8ee4('0x18')]['findAll']({'raw':_0x5317dc['options']?_0x5317dc[_0x8ee4('0x19')][_0x8ee4('0x1a')]===undefined?!![]:![]:!![],'where':_0x5317dc[_0x8ee4('0x19')]?_0x5317dc[_0x8ee4('0x19')][_0x8ee4('0x1b')]||null:null,'attributes':_0x5317dc[_0x8ee4('0x19')]?_0x5317dc[_0x8ee4('0x19')][_0x8ee4('0x1c')]||null:null,'limit':_0x5317dc[_0x8ee4('0x19')]?_0x5317dc[_0x8ee4('0x19')]['limit']||null:null,'include':_0x5317dc[_0x8ee4('0x19')]?_0x5317dc['options']['include']?_[_0x8ee4('0x1d')](_0x5317dc[_0x8ee4('0x19')]['include'],function(_0x15faef){return{'model':db[_0x15faef[_0x8ee4('0x1e')]],'as':_0x15faef['as'],'attributes':_0x15faef['attributes'],'include':_0x15faef[_0x8ee4('0x1f')]?_[_0x8ee4('0x1d')](_0x15faef['include'],function(_0x503a24){return{'model':db[_0x503a24[_0x8ee4('0x1e')]],'as':_0x503a24['as'],'attributes':_0x503a24['attributes'],'include':_0x503a24[_0x8ee4('0x1f')]?_['map'](_0x503a24[_0x8ee4('0x1f')],function(_0x31d40c){return{'model':db[_0x31d40c[_0x8ee4('0x1e')]],'as':_0x31d40c['as'],'attributes':_0x31d40c[_0x8ee4('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x583c9a){logger[_0x8ee4('0xc')](_0x8ee4('0x17'),_0x5317dc);logger[_0x8ee4('0xf')](_0x8ee4('0x17'),_0x5317dc,JSON['stringify'](_0x583c9a));_0x2f961d(_0x583c9a);})[_0x8ee4('0x16')](function(_0x1e0d46){logger['error'](_0x8ee4('0x17'),_0x1e0d46[_0x8ee4('0x14')],_0x5317dc);_0x1c209b(_0x5c3232[_0x8ee4('0x12')](0x1f4,_0x1e0d46[_0x8ee4('0x14')]));});});};exports[_0x8ee4('0x20')]=function(_0x62e393){var _0x475617=this;return new Promise(function(_0x446256,_0x5a4d72){return db[_0x8ee4('0x18')][_0x8ee4('0x21')]({'raw':_0x62e393[_0x8ee4('0x19')]?_0x62e393[_0x8ee4('0x19')][_0x8ee4('0x1a')]===undefined?!![]:![]:!![],'where':_0x62e393[_0x8ee4('0x19')]?_0x62e393[_0x8ee4('0x19')]['where']||null:null,'attributes':_0x62e393[_0x8ee4('0x19')]?_0x62e393[_0x8ee4('0x19')]['attributes']||null:null,'include':_0x62e393[_0x8ee4('0x19')]?_0x62e393[_0x8ee4('0x19')][_0x8ee4('0x1f')]?_[_0x8ee4('0x1d')](_0x62e393[_0x8ee4('0x19')]['include'],function(_0xadf29b){return{'model':db[_0xadf29b[_0x8ee4('0x1e')]],'as':_0xadf29b['as'],'attributes':_0xadf29b[_0x8ee4('0x1c')],'include':_0xadf29b['include']?_['map'](_0xadf29b[_0x8ee4('0x1f')],function(_0x3f1bc0){return{'model':db[_0x3f1bc0['model']],'as':_0x3f1bc0['as'],'attributes':_0x3f1bc0[_0x8ee4('0x1c')],'include':_0x3f1bc0[_0x8ee4('0x1f')]?_[_0x8ee4('0x1d')](_0x3f1bc0[_0x8ee4('0x1f')],function(_0x267087){return{'model':db[_0x267087[_0x8ee4('0x1e')]],'as':_0x267087['as'],'attributes':_0x267087['attributes']};}):[]};}):[]};}):[]:[]})[_0x8ee4('0x22')](function(_0x33539b){logger['info']('ShowDeskAccount',_0x62e393);logger['debug'](_0x8ee4('0x20'),_0x62e393,JSON[_0x8ee4('0x11')](_0x33539b));_0x446256(_0x33539b);})[_0x8ee4('0x16')](function(_0x4db03d){logger[_0x8ee4('0x12')](_0x8ee4('0x20'),_0x4db03d[_0x8ee4('0x14')],_0x62e393);_0x5a4d72(_0x475617[_0x8ee4('0x12')](0x1f4,_0x4db03d[_0x8ee4('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index eb9e9ed..db3202d 100644 --- a/server/api/intDeskConfiguration/index.js +++ b/server/api/intDeskConfiguration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xedd9=['getTags','post','create','setTags','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intDeskConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getSubjects','/:id/descriptions','/:id/tags'];(function(_0x2d59a7,_0x264bb1){var _0x2a63e9=function(_0x1da851){while(--_0x1da851){_0x2d59a7['push'](_0x2d59a7['shift']());}};_0x2a63e9(++_0x264bb1);}(_0xedd9,0xfc));var _0x9edd=function(_0x4b064e,_0x129d1a){_0x4b064e=_0x4b064e-0x0;var _0x182dd0=_0xedd9[_0x4b064e];return _0x182dd0;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');var controller=require(_0x9edd('0x8'));router[_0x9edd('0x9')]('/',auth[_0x9edd('0xa')](),controller[_0x9edd('0xb')]);router['get'](_0x9edd('0xc'),auth['isAuthenticated'](),controller[_0x9edd('0xd')]);router[_0x9edd('0x9')](_0x9edd('0xe'),auth[_0x9edd('0xa')](),controller['getFields']);router[_0x9edd('0x9')]('/:id/subjects',auth[_0x9edd('0xa')](),controller[_0x9edd('0xf')]);router['get'](_0x9edd('0x10'),auth[_0x9edd('0xa')](),controller['getDescriptions']);router[_0x9edd('0x9')](_0x9edd('0x11'),auth[_0x9edd('0xa')](),controller[_0x9edd('0x12')]);router[_0x9edd('0x13')]('/',auth[_0x9edd('0xa')](),controller[_0x9edd('0x14')]);router[_0x9edd('0x13')]('/:id/tags',auth[_0x9edd('0xa')](),controller[_0x9edd('0x15')]);router[_0x9edd('0x16')](_0x9edd('0xc'),auth[_0x9edd('0xa')](),controller[_0x9edd('0x17')]);router[_0x9edd('0x18')](_0x9edd('0xc'),auth['isAuthenticated'](),controller[_0x9edd('0x19')]);module[_0x9edd('0x1a')]=router; \ No newline at end of file +var _0x9c44=['destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./intDeskConfiguration.controller','isAuthenticated','index','get','/:id','/:id/fields','getFields','getSubjects','/:id/descriptions','/:id/tags','post','setTags','put','update'];(function(_0x3a4a42,_0x61f1e){var _0x1ee783=function(_0x5653ee){while(--_0x5653ee){_0x3a4a42['push'](_0x3a4a42['shift']());}};_0x1ee783(++_0x61f1e);}(_0x9c44,0x178));var _0x49c4=function(_0x2d2c16,_0x4e88b6){_0x2d2c16=_0x2d2c16-0x0;var _0x53f2fb=_0x9c44[_0x2d2c16];return _0x53f2fb;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x49c4('0x6'));router['get']('/',auth[_0x49c4('0x7')](),controller[_0x49c4('0x8')]);router[_0x49c4('0x9')](_0x49c4('0xa'),auth[_0x49c4('0x7')](),controller['show']);router[_0x49c4('0x9')](_0x49c4('0xb'),auth[_0x49c4('0x7')](),controller[_0x49c4('0xc')]);router['get']('/:id/subjects',auth[_0x49c4('0x7')](),controller[_0x49c4('0xd')]);router['get'](_0x49c4('0xe'),auth[_0x49c4('0x7')](),controller['getDescriptions']);router['get'](_0x49c4('0xf'),auth[_0x49c4('0x7')](),controller['getTags']);router[_0x49c4('0x10')]('/',auth[_0x49c4('0x7')](),controller['create']);router[_0x49c4('0x10')](_0x49c4('0xf'),auth[_0x49c4('0x7')](),controller[_0x49c4('0x11')]);router[_0x49c4('0x12')](_0x49c4('0xa'),auth[_0x49c4('0x7')](),controller[_0x49c4('0x13')]);router['delete'](_0x49c4('0xa'),auth[_0x49c4('0x7')](),controller[_0x49c4('0x14')]);module[_0x49c4('0x15')]=router; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js b/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js index 981778f..7236d62 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 _0x0fc6=['STRING','sequelize'];(function(_0x5c9916,_0x20cb76){var _0x3a45f8=function(_0x58fd1d){while(--_0x58fd1d){_0x5c9916['push'](_0x5c9916['shift']());}};_0x3a45f8(++_0x20cb76);}(_0x0fc6,0x167));var _0x60fc=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x0fc6[_0x19950b];return _0x3c6b41;};'use strict';var Sequelize=require(_0x60fc('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x60fc('0x1')]}}; \ No newline at end of file +var _0xdbf1=['STRING','sequelize'];(function(_0x1d908b,_0x4abdba){var _0x13559a=function(_0x4bb5f7){while(--_0x4bb5f7){_0x1d908b['push'](_0x1d908b['shift']());}};_0x13559a(++_0x4abdba);}(_0xdbf1,0xd3));var _0x1dbf=function(_0x710815,_0x520da8){_0x710815=_0x710815-0x0;var _0x5b3b89=_0xdbf1[_0x710815];return _0x5b3b89;};'use strict';var Sequelize=require(_0x1dbf('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x1dbf('0x1')]}}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js index 74ad6aa..20fe29c 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 _0x8f15=['limit','count','set','apply','reject','update','then','error','stack','name','map','DeskConfiguration','rawAttributes','fieldName','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','catch','show','intersection','create','body','params','destroy','find','getFields','findOne','DeskField','nolimit','getSubjects','getDescriptions','getTags','Tag','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../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'];(function(_0x2243f7,_0x4402c7){var _0x3c0b01=function(_0x357db5){while(--_0x357db5){_0x2243f7['push'](_0x2243f7['shift']());}};_0x3c0b01(++_0x4402c7);}(_0x8f15,0xde));var _0x58f1=function(_0x56330a,_0xa51f9f){_0x56330a=_0x56330a-0x0;var _0x3b1d74=_0x8f15[_0x56330a];return _0x3b1d74;};'use strict';var emlformat=require(_0x58f1('0x0'));var rimraf=require(_0x58f1('0x1'));var zipdir=require(_0x58f1('0x2'));var jsonpatch=require(_0x58f1('0x3'));var rp=require(_0x58f1('0x4'));var moment=require(_0x58f1('0x5'));var BPromise=require(_0x58f1('0x6'));var Mustache=require(_0x58f1('0x7'));var util=require('util');var path=require('path');var sox=require(_0x58f1('0x8'));var csv=require(_0x58f1('0x9'));var ejs=require(_0x58f1('0xa'));var fs=require('fs');var fs_extra=require(_0x58f1('0xb'));var _=require(_0x58f1('0xc'));var squel=require(_0x58f1('0xd'));var crypto=require(_0x58f1('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x58f1('0xf'));var toCsv=require(_0x58f1('0x9'));var querystring=require(_0x58f1('0x10'));var Papa=require(_0x58f1('0x11'));var Redis=require('ioredis');var authService=require(_0x58f1('0x12'));var qs=require(_0x58f1('0x13'));var as=require(_0x58f1('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x58f1('0x15'))(_0x58f1('0x16'));var utils=require(_0x58f1('0x17'));var config=require(_0x58f1('0x18'));var licenseUtil=require(_0x58f1('0x19'));var db=require(_0x58f1('0x1a'))['db'];function respondWithStatusCode(_0x217f30,_0x1e85dc){_0x1e85dc=_0x1e85dc||0xcc;return function(_0x1c9450){if(_0x1c9450){return _0x217f30[_0x58f1('0x1b')](_0x1e85dc);}return _0x217f30[_0x58f1('0x1c')](_0x1e85dc)[_0x58f1('0x1d')]();};}function respondWithResult(_0x36b4ea,_0x483849){_0x483849=_0x483849||0xc8;return function(_0x4b0de9){if(_0x4b0de9){return _0x36b4ea[_0x58f1('0x1c')](_0x483849)[_0x58f1('0x1e')](_0x4b0de9);}};}function respondWithFilteredResult(_0x2a8b9e,_0x1ff2cc){return function(_0x2836c7){if(_0x2836c7){var _0x20323b=typeof _0x1ff2cc[_0x58f1('0x1f')]===_0x58f1('0x20')&&typeof _0x1ff2cc[_0x58f1('0x21')]===_0x58f1('0x20');var _0x33cdf9=_0x2836c7[_0x58f1('0x22')];var _0x91bae7=_0x20323b?0x0:_0x1ff2cc[_0x58f1('0x1f')];var _0xff5918=_0x20323b?_0x2836c7['count']:_0x1ff2cc[_0x58f1('0x1f')]+_0x1ff2cc[_0x58f1('0x21')];var _0x660803;if(_0xff5918>=_0x33cdf9){_0xff5918=_0x33cdf9;_0x660803=0xc8;}else{_0x660803=0xce;}_0x2a8b9e['status'](_0x660803);return _0x2a8b9e[_0x58f1('0x23')]('Content-Range',_0x91bae7+'-'+_0xff5918+'/'+_0x33cdf9)['json'](_0x2836c7);}return null;};}function patchUpdates(_0x182579){return function(_0x1f17d2){try{jsonpatch[_0x58f1('0x24')](_0x1f17d2,_0x182579,!![]);}catch(_0x18714c){return BPromise[_0x58f1('0x25')](_0x18714c);}return _0x1f17d2['save']();};}function saveUpdates(_0x9d582a,_0x58d961){return function(_0x5e5309){if(_0x5e5309){return _0x5e5309[_0x58f1('0x26')](_0x9d582a)[_0x58f1('0x27')](function(_0x1a44a5){return _0x1a44a5;});}return null;};}function removeEntity(_0x431fe8,_0x3e1ebc){return function(_0x3b95cd){if(_0x3b95cd){return _0x3b95cd['destroy']()['then'](function(){_0x431fe8['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x55be38,_0x484e59){return function(_0x2b0200){if(!_0x2b0200){_0x55be38[_0x58f1('0x1b')](0x194);}return _0x2b0200;};}function handleError(_0x3b6003,_0x306932){_0x306932=_0x306932||0x1f4;return function(_0x3b3b20){logger[_0x58f1('0x28')](_0x3b3b20[_0x58f1('0x29')]);if(_0x3b3b20[_0x58f1('0x2a')]){delete _0x3b3b20[_0x58f1('0x2a')];}_0x3b6003['status'](_0x306932)['send'](_0x3b3b20);};}exports['index']=function(_0x26b8e0,_0x45a7b9){var _0x491fb6={},_0x2570e6={},_0x1f7342={'count':0x0,'rows':[]};var _0x31acd9=_[_0x58f1('0x2b')](db[_0x58f1('0x2c')][_0x58f1('0x2d')],function(_0xb414bf){return{'name':_0xb414bf[_0x58f1('0x2e')],'type':_0xb414bf['type'][_0x58f1('0x2f')]};});_0x2570e6[_0x58f1('0x30')]=_['map'](_0x31acd9,_0x58f1('0x2a'));_0x2570e6[_0x58f1('0x31')]=_[_0x58f1('0x32')](_0x26b8e0[_0x58f1('0x31')]);_0x2570e6[_0x58f1('0x33')]=_['intersection'](_0x2570e6[_0x58f1('0x30')],_0x2570e6[_0x58f1('0x31')]);_0x491fb6[_0x58f1('0x34')]=_['intersection'](_0x2570e6[_0x58f1('0x30')],qs[_0x58f1('0x35')](_0x26b8e0[_0x58f1('0x31')]['fields']));_0x491fb6[_0x58f1('0x34')]=_0x491fb6[_0x58f1('0x34')][_0x58f1('0x36')]?_0x491fb6['attributes']:_0x2570e6[_0x58f1('0x30')];if(!_0x26b8e0[_0x58f1('0x31')][_0x58f1('0x37')]('nolimit')){_0x491fb6[_0x58f1('0x21')]=qs[_0x58f1('0x21')](_0x26b8e0['query'][_0x58f1('0x21')]);_0x491fb6[_0x58f1('0x1f')]=qs[_0x58f1('0x1f')](_0x26b8e0[_0x58f1('0x31')][_0x58f1('0x1f')]);}_0x491fb6[_0x58f1('0x38')]=qs[_0x58f1('0x39')](_0x26b8e0[_0x58f1('0x31')][_0x58f1('0x39')]);_0x491fb6[_0x58f1('0x3a')]=qs[_0x58f1('0x33')](_[_0x58f1('0x3b')](_0x26b8e0['query'],_0x2570e6['filters']),_0x31acd9);if(_0x26b8e0[_0x58f1('0x31')][_0x58f1('0x3c')]){_0x491fb6['where']=_['merge'](_0x491fb6['where'],{'$or':_[_0x58f1('0x2b')](_0x31acd9,function(_0x1c4c54){if(_0x1c4c54['type']!==_0x58f1('0x3d')){var _0x5de1d5={};_0x5de1d5[_0x1c4c54['name']]={'$like':'%'+_0x26b8e0['query'][_0x58f1('0x3c')]+'%'};return _0x5de1d5;}})});}_0x491fb6=_[_0x58f1('0x3e')]({},_0x491fb6,_0x26b8e0[_0x58f1('0x3f')]);var _0x395281={'where':_0x491fb6['where']};return db[_0x58f1('0x2c')]['count'](_0x395281)['then'](function(_0x482bc0){_0x1f7342[_0x58f1('0x22')]=_0x482bc0;if(_0x26b8e0[_0x58f1('0x31')][_0x58f1('0x40')]){_0x491fb6[_0x58f1('0x41')]=[{'all':!![]}];}return db[_0x58f1('0x2c')][_0x58f1('0x42')](_0x491fb6);})['then'](function(_0x13651b){_0x1f7342['rows']=_0x13651b;return _0x1f7342;})['then'](respondWithFilteredResult(_0x45a7b9,_0x491fb6))[_0x58f1('0x43')](handleError(_0x45a7b9,null));};exports[_0x58f1('0x44')]=function(_0x1db307,_0x5c5bf0){var _0x29d65f={'raw':![],'where':{'id':_0x1db307['params']['id']}},_0x356f23={};_0x356f23['model']=_[_0x58f1('0x32')](db[_0x58f1('0x2c')][_0x58f1('0x2d')]);_0x356f23[_0x58f1('0x31')]=_['keys'](_0x1db307[_0x58f1('0x31')]);_0x356f23[_0x58f1('0x33')]=_['intersection'](_0x356f23['model'],_0x356f23[_0x58f1('0x31')]);_0x29d65f[_0x58f1('0x34')]=_[_0x58f1('0x45')](_0x356f23[_0x58f1('0x30')],qs[_0x58f1('0x35')](_0x1db307[_0x58f1('0x31')][_0x58f1('0x35')]));_0x29d65f[_0x58f1('0x34')]=_0x29d65f[_0x58f1('0x34')][_0x58f1('0x36')]?_0x29d65f[_0x58f1('0x34')]:_0x356f23[_0x58f1('0x30')];if(_0x1db307[_0x58f1('0x31')][_0x58f1('0x40')]){_0x29d65f[_0x58f1('0x41')]=[{'all':!![]}];}_0x29d65f=_[_0x58f1('0x3e')]({},_0x29d65f,_0x1db307[_0x58f1('0x3f')]);return db[_0x58f1('0x2c')]['find'](_0x29d65f)[_0x58f1('0x27')](handleEntityNotFound(_0x5c5bf0,null))[_0x58f1('0x27')](respondWithResult(_0x5c5bf0,null))[_0x58f1('0x43')](handleError(_0x5c5bf0,null));};exports[_0x58f1('0x46')]=function(_0x390cb3,_0x1724be){return db[_0x58f1('0x2c')][_0x58f1('0x46')](_0x390cb3[_0x58f1('0x47')],{})[_0x58f1('0x27')](respondWithResult(_0x1724be,0xc9))['catch'](handleError(_0x1724be,null));};exports[_0x58f1('0x26')]=function(_0x4b7a27,_0x2b6fe0){if(_0x4b7a27[_0x58f1('0x47')]['id']){delete _0x4b7a27[_0x58f1('0x47')]['id'];}return db[_0x58f1('0x2c')]['find']({'where':{'id':_0x4b7a27[_0x58f1('0x48')]['id']}})[_0x58f1('0x27')](handleEntityNotFound(_0x2b6fe0,null))[_0x58f1('0x27')](saveUpdates(_0x4b7a27[_0x58f1('0x47')],null))[_0x58f1('0x27')](respondWithResult(_0x2b6fe0,null))[_0x58f1('0x43')](handleError(_0x2b6fe0,null));};exports[_0x58f1('0x49')]=function(_0x513484,_0x5a20eb){return db[_0x58f1('0x2c')][_0x58f1('0x4a')]({'where':{'id':_0x513484[_0x58f1('0x48')]['id']}})[_0x58f1('0x27')](handleEntityNotFound(_0x5a20eb,null))[_0x58f1('0x27')](removeEntity(_0x5a20eb,null))[_0x58f1('0x43')](handleError(_0x5a20eb,null));};exports[_0x58f1('0x4b')]=function(_0x2d2c66,_0x44ca1a,_0x26754c){var _0x11e25c={};var _0x13cc69={};var _0x23ae39;var _0x1a7e58;return db[_0x58f1('0x2c')][_0x58f1('0x4c')]({'where':{'id':_0x2d2c66[_0x58f1('0x48')]['id']}})['then'](handleEntityNotFound(_0x44ca1a,null))[_0x58f1('0x27')](function(_0x52ea94){if(_0x52ea94){_0x23ae39=_0x52ea94;_0x13cc69[_0x58f1('0x30')]=_[_0x58f1('0x32')](db[_0x58f1('0x4d')][_0x58f1('0x2d')]);_0x13cc69[_0x58f1('0x31')]=_[_0x58f1('0x32')](_0x2d2c66[_0x58f1('0x31')]);_0x13cc69['filters']=_[_0x58f1('0x45')](_0x13cc69[_0x58f1('0x30')],_0x13cc69['query']);_0x11e25c[_0x58f1('0x34')]=_[_0x58f1('0x45')](_0x13cc69[_0x58f1('0x30')],qs[_0x58f1('0x35')](_0x2d2c66[_0x58f1('0x31')][_0x58f1('0x35')]));_0x11e25c[_0x58f1('0x34')]=_0x11e25c['attributes']['length']?_0x11e25c[_0x58f1('0x34')]:_0x13cc69[_0x58f1('0x30')];_0x11e25c[_0x58f1('0x38')]=qs[_0x58f1('0x39')](_0x2d2c66[_0x58f1('0x31')][_0x58f1('0x39')]);_0x11e25c[_0x58f1('0x3a')]=qs[_0x58f1('0x33')](_[_0x58f1('0x3b')](_0x2d2c66['query'],_0x13cc69[_0x58f1('0x33')]));if(_0x2d2c66[_0x58f1('0x31')][_0x58f1('0x3c')]){_0x11e25c[_0x58f1('0x3a')]=_[_0x58f1('0x3e')](_0x11e25c['where'],{'$or':_['map'](_0x11e25c[_0x58f1('0x34')],function(_0x5633d4){var _0x180e4a={};_0x180e4a[_0x5633d4]={'$like':'%'+_0x2d2c66['query'][_0x58f1('0x3c')]+'%'};return _0x180e4a;})});}_0x11e25c=_['merge']({},_0x11e25c,_0x2d2c66['options']);return _0x23ae39[_0x58f1('0x4b')](_0x11e25c);}})[_0x58f1('0x27')](function(_0x897ab9){if(_0x897ab9){_0x1a7e58=_0x897ab9['length'];if(!_0x2d2c66[_0x58f1('0x31')][_0x58f1('0x37')](_0x58f1('0x4e'))){_0x11e25c['limit']=qs[_0x58f1('0x21')](_0x2d2c66[_0x58f1('0x31')][_0x58f1('0x21')]);_0x11e25c['offset']=qs[_0x58f1('0x1f')](_0x2d2c66['query']['offset']);}return _0x23ae39[_0x58f1('0x4b')](_0x11e25c);}})[_0x58f1('0x27')](function(_0x712e3c){if(_0x712e3c){return _0x712e3c?{'count':_0x1a7e58,'rows':_0x712e3c}:null;}})[_0x58f1('0x27')](respondWithResult(_0x44ca1a,null))[_0x58f1('0x43')](handleError(_0x44ca1a,null));};exports[_0x58f1('0x4f')]=function(_0xc2b9b7,_0x159b31,_0x2ccdcb){var _0x17feea={};var _0x5f5977={};var _0x4f3d58;var _0x370daa;return db[_0x58f1('0x2c')]['findOne']({'where':{'id':_0xc2b9b7[_0x58f1('0x48')]['id']}})['then'](handleEntityNotFound(_0x159b31,null))[_0x58f1('0x27')](function(_0x34ff97){if(_0x34ff97){_0x4f3d58=_0x34ff97;_0x5f5977[_0x58f1('0x30')]=_[_0x58f1('0x32')](db[_0x58f1('0x4d')][_0x58f1('0x2d')]);_0x5f5977[_0x58f1('0x31')]=_[_0x58f1('0x32')](_0xc2b9b7['query']);_0x5f5977['filters']=_['intersection'](_0x5f5977[_0x58f1('0x30')],_0x5f5977[_0x58f1('0x31')]);_0x17feea[_0x58f1('0x34')]=_['intersection'](_0x5f5977[_0x58f1('0x30')],qs[_0x58f1('0x35')](_0xc2b9b7[_0x58f1('0x31')][_0x58f1('0x35')]));_0x17feea[_0x58f1('0x34')]=_0x17feea[_0x58f1('0x34')][_0x58f1('0x36')]?_0x17feea['attributes']:_0x5f5977[_0x58f1('0x30')];_0x17feea['order']=qs[_0x58f1('0x39')](_0xc2b9b7[_0x58f1('0x31')][_0x58f1('0x39')]);_0x17feea[_0x58f1('0x3a')]=qs[_0x58f1('0x33')](_[_0x58f1('0x3b')](_0xc2b9b7['query'],_0x5f5977[_0x58f1('0x33')]));if(_0xc2b9b7[_0x58f1('0x31')][_0x58f1('0x3c')]){_0x17feea[_0x58f1('0x3a')]=_[_0x58f1('0x3e')](_0x17feea[_0x58f1('0x3a')],{'$or':_[_0x58f1('0x2b')](_0x17feea['attributes'],function(_0x2b4ec7){var _0xd857fa={};_0xd857fa[_0x2b4ec7]={'$like':'%'+_0xc2b9b7[_0x58f1('0x31')][_0x58f1('0x3c')]+'%'};return _0xd857fa;})});}_0x17feea=_[_0x58f1('0x3e')]({},_0x17feea,_0xc2b9b7[_0x58f1('0x3f')]);return _0x4f3d58['getSubjects'](_0x17feea);}})[_0x58f1('0x27')](function(_0x4bc54c){if(_0x4bc54c){_0x370daa=_0x4bc54c[_0x58f1('0x36')];if(!_0xc2b9b7[_0x58f1('0x31')][_0x58f1('0x37')](_0x58f1('0x4e'))){_0x17feea['limit']=qs[_0x58f1('0x21')](_0xc2b9b7[_0x58f1('0x31')]['limit']);_0x17feea[_0x58f1('0x1f')]=qs['offset'](_0xc2b9b7[_0x58f1('0x31')]['offset']);}return _0x4f3d58['getSubjects'](_0x17feea);}})[_0x58f1('0x27')](function(_0x4f385e){if(_0x4f385e){return _0x4f385e?{'count':_0x370daa,'rows':_0x4f385e}:null;}})[_0x58f1('0x27')](respondWithResult(_0x159b31,null))[_0x58f1('0x43')](handleError(_0x159b31,null));};exports[_0x58f1('0x50')]=function(_0x1535d6,_0x435e3a,_0xd58ad1){var _0x44681c={};var _0xe5c5f6={};var _0x1ce052;var _0x18296d;return db[_0x58f1('0x2c')][_0x58f1('0x4c')]({'where':{'id':_0x1535d6['params']['id']}})[_0x58f1('0x27')](handleEntityNotFound(_0x435e3a,null))[_0x58f1('0x27')](function(_0x531349){if(_0x531349){_0x1ce052=_0x531349;_0xe5c5f6[_0x58f1('0x30')]=_['keys'](db[_0x58f1('0x4d')]['rawAttributes']);_0xe5c5f6[_0x58f1('0x31')]=_[_0x58f1('0x32')](_0x1535d6['query']);_0xe5c5f6[_0x58f1('0x33')]=_[_0x58f1('0x45')](_0xe5c5f6[_0x58f1('0x30')],_0xe5c5f6[_0x58f1('0x31')]);_0x44681c['attributes']=_['intersection'](_0xe5c5f6[_0x58f1('0x30')],qs['fields'](_0x1535d6[_0x58f1('0x31')][_0x58f1('0x35')]));_0x44681c['attributes']=_0x44681c[_0x58f1('0x34')][_0x58f1('0x36')]?_0x44681c['attributes']:_0xe5c5f6[_0x58f1('0x30')];_0x44681c[_0x58f1('0x38')]=qs['sort'](_0x1535d6['query'][_0x58f1('0x39')]);_0x44681c['where']=qs['filters'](_[_0x58f1('0x3b')](_0x1535d6[_0x58f1('0x31')],_0xe5c5f6[_0x58f1('0x33')]));if(_0x1535d6[_0x58f1('0x31')][_0x58f1('0x3c')]){_0x44681c[_0x58f1('0x3a')]=_['merge'](_0x44681c['where'],{'$or':_[_0x58f1('0x2b')](_0x44681c[_0x58f1('0x34')],function(_0x48a120){var _0x37bab0={};_0x37bab0[_0x48a120]={'$like':'%'+_0x1535d6[_0x58f1('0x31')][_0x58f1('0x3c')]+'%'};return _0x37bab0;})});}_0x44681c=_[_0x58f1('0x3e')]({},_0x44681c,_0x1535d6['options']);return _0x1ce052[_0x58f1('0x50')](_0x44681c);}})['then'](function(_0x1d5715){if(_0x1d5715){_0x18296d=_0x1d5715[_0x58f1('0x36')];if(!_0x1535d6[_0x58f1('0x31')][_0x58f1('0x37')]('nolimit')){_0x44681c['limit']=qs[_0x58f1('0x21')](_0x1535d6[_0x58f1('0x31')]['limit']);_0x44681c['offset']=qs['offset'](_0x1535d6['query'][_0x58f1('0x1f')]);}return _0x1ce052[_0x58f1('0x50')](_0x44681c);}})['then'](function(_0x3cde15){if(_0x3cde15){return _0x3cde15?{'count':_0x18296d,'rows':_0x3cde15}:null;}})[_0x58f1('0x27')](respondWithResult(_0x435e3a,null))[_0x58f1('0x43')](handleError(_0x435e3a,null));};exports[_0x58f1('0x51')]=function(_0x57909f,_0x20c71a,_0x306022){var _0x1a0004={};var _0x110a7b={};var _0x34386e;var _0x1bdc6b;return db[_0x58f1('0x2c')][_0x58f1('0x4c')]({'where':{'id':_0x57909f[_0x58f1('0x48')]['id']}})[_0x58f1('0x27')](handleEntityNotFound(_0x20c71a,null))[_0x58f1('0x27')](function(_0x5932ab){if(_0x5932ab){_0x34386e=_0x5932ab;_0x110a7b[_0x58f1('0x30')]=_[_0x58f1('0x32')](db[_0x58f1('0x52')][_0x58f1('0x2d')]);_0x110a7b['query']=_[_0x58f1('0x32')](_0x57909f[_0x58f1('0x31')]);_0x110a7b[_0x58f1('0x33')]=_[_0x58f1('0x45')](_0x110a7b[_0x58f1('0x30')],_0x110a7b[_0x58f1('0x31')]);_0x1a0004[_0x58f1('0x34')]=_[_0x58f1('0x45')](_0x110a7b[_0x58f1('0x30')],qs[_0x58f1('0x35')](_0x57909f['query']['fields']));_0x1a0004[_0x58f1('0x34')]=_0x1a0004[_0x58f1('0x34')][_0x58f1('0x36')]?_0x1a0004[_0x58f1('0x34')]:_0x110a7b[_0x58f1('0x30')];_0x1a0004[_0x58f1('0x38')]=qs[_0x58f1('0x39')](_0x57909f[_0x58f1('0x31')][_0x58f1('0x39')]);_0x1a0004['where']=qs[_0x58f1('0x33')](_[_0x58f1('0x3b')](_0x57909f[_0x58f1('0x31')],_0x110a7b[_0x58f1('0x33')]));if(_0x57909f[_0x58f1('0x31')][_0x58f1('0x3c')]){_0x1a0004[_0x58f1('0x3a')]=_[_0x58f1('0x3e')](_0x1a0004['where'],{'$or':_['map'](_0x1a0004[_0x58f1('0x34')],function(_0x24fb1c){var _0x1247f1={};_0x1247f1[_0x24fb1c]={'$like':'%'+_0x57909f[_0x58f1('0x31')]['filter']+'%'};return _0x1247f1;})});}_0x1a0004=_[_0x58f1('0x3e')]({},_0x1a0004,_0x57909f['options']);return _0x34386e['getTags'](_0x1a0004);}})[_0x58f1('0x27')](function(_0x499745){if(_0x499745){_0x1bdc6b=_0x499745['length'];if(!_0x57909f['query'][_0x58f1('0x37')](_0x58f1('0x4e'))){_0x1a0004[_0x58f1('0x21')]=qs[_0x58f1('0x21')](_0x57909f[_0x58f1('0x31')][_0x58f1('0x21')]);_0x1a0004['offset']=qs[_0x58f1('0x1f')](_0x57909f['query'][_0x58f1('0x1f')]);}return _0x34386e[_0x58f1('0x51')](_0x1a0004);}})[_0x58f1('0x27')](function(_0x3d7e4e){if(_0x3d7e4e){return _0x3d7e4e?{'count':_0x1bdc6b,'rows':_0x3d7e4e}:null;}})[_0x58f1('0x27')](respondWithResult(_0x20c71a,null))[_0x58f1('0x43')](handleError(_0x20c71a,null));};exports[_0x58f1('0x53')]=function(_0x5046f2,_0x4c14d2,_0x3c005f){if(_0x5046f2['body']['id']){delete _0x5046f2[_0x58f1('0x47')]['id'];}return db[_0x58f1('0x2c')][_0x58f1('0x4c')]({'where':{'id':_0x5046f2[_0x58f1('0x48')]['id']}})['then'](handleEntityNotFound(_0x4c14d2,null))[_0x58f1('0x27')](function(_0x236426){if(_0x236426){return _0x236426['setTags'](_0x5046f2['body'][_0x58f1('0x54')]||[]);}return null;})[_0x58f1('0x27')](respondWithResult(_0x4c14d2,null))[_0x58f1('0x43')](handleError(_0x4c14d2,null));}; \ No newline at end of file +var _0x9244=['sort','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','create','body','find','findOne','where','getFields','DeskField','getSubjects','getDescriptions','Tag','getTags','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','destroy','then','error','stack','name','send','index','map','DeskConfiguration','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order'];(function(_0x19b1c2,_0x205062){var _0x4e1ae5=function(_0x5a1cb7){while(--_0x5a1cb7){_0x19b1c2['push'](_0x19b1c2['shift']());}};_0x4e1ae5(++_0x205062);}(_0x9244,0x72));var _0x4924=function(_0x1a8617,_0x5b6c70){_0x1a8617=_0x1a8617-0x0;var _0x15f475=_0x9244[_0x1a8617];return _0x15f475;};'use strict';var emlformat=require(_0x4924('0x0'));var rimraf=require(_0x4924('0x1'));var zipdir=require(_0x4924('0x2'));var jsonpatch=require(_0x4924('0x3'));var rp=require(_0x4924('0x4'));var moment=require(_0x4924('0x5'));var BPromise=require(_0x4924('0x6'));var Mustache=require(_0x4924('0x7'));var util=require(_0x4924('0x8'));var path=require(_0x4924('0x9'));var sox=require(_0x4924('0xa'));var csv=require('to-csv');var ejs=require(_0x4924('0xb'));var fs=require('fs');var fs_extra=require(_0x4924('0xc'));var _=require('lodash');var squel=require(_0x4924('0xd'));var crypto=require(_0x4924('0xe'));var jsforce=require(_0x4924('0xf'));var deskjs=require(_0x4924('0x10'));var toCsv=require(_0x4924('0x11'));var querystring=require(_0x4924('0x12'));var Papa=require(_0x4924('0x13'));var Redis=require(_0x4924('0x14'));var authService=require(_0x4924('0x15'));var qs=require(_0x4924('0x16'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4924('0x17'));var logger=require('../../config/logger')('api');var utils=require(_0x4924('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x4924('0x19'));var db=require(_0x4924('0x1a'))['db'];function respondWithStatusCode(_0x3ec52b,_0x534f23){_0x534f23=_0x534f23||0xcc;return function(_0x1e8995){if(_0x1e8995){return _0x3ec52b[_0x4924('0x1b')](_0x534f23);}return _0x3ec52b[_0x4924('0x1c')](_0x534f23)[_0x4924('0x1d')]();};}function respondWithResult(_0x1e6ae7,_0x3e5340){_0x3e5340=_0x3e5340||0xc8;return function(_0x31a0d8){if(_0x31a0d8){return _0x1e6ae7['status'](_0x3e5340)[_0x4924('0x1e')](_0x31a0d8);}};}function respondWithFilteredResult(_0x532c3d,_0x5ce1af){return function(_0x3f5c98){if(_0x3f5c98){var _0x37b265=typeof _0x5ce1af[_0x4924('0x1f')]===_0x4924('0x20')&&typeof _0x5ce1af[_0x4924('0x21')]===_0x4924('0x20');var _0xda4f1c=_0x3f5c98[_0x4924('0x22')];var _0x2c02b1=_0x37b265?0x0:_0x5ce1af[_0x4924('0x1f')];var _0x7f85ab=_0x37b265?_0x3f5c98['count']:_0x5ce1af[_0x4924('0x1f')]+_0x5ce1af[_0x4924('0x21')];var _0x1e90b4;if(_0x7f85ab>=_0xda4f1c){_0x7f85ab=_0xda4f1c;_0x1e90b4=0xc8;}else{_0x1e90b4=0xce;}_0x532c3d[_0x4924('0x1c')](_0x1e90b4);return _0x532c3d[_0x4924('0x23')]('Content-Range',_0x2c02b1+'-'+_0x7f85ab+'/'+_0xda4f1c)[_0x4924('0x1e')](_0x3f5c98);}return null;};}function patchUpdates(_0x296bb5){return function(_0x58e04a){try{jsonpatch[_0x4924('0x24')](_0x58e04a,_0x296bb5,!![]);}catch(_0x5d786b){return BPromise[_0x4924('0x25')](_0x5d786b);}return _0x58e04a[_0x4924('0x26')]();};}function saveUpdates(_0x1d3db1,_0x412913){return function(_0x2db207){if(_0x2db207){return _0x2db207[_0x4924('0x27')](_0x1d3db1)['then'](function(_0x54d0f8){return _0x54d0f8;});}return null;};}function removeEntity(_0x5a78be,_0x17c902){return function(_0x3d22bf){if(_0x3d22bf){return _0x3d22bf[_0x4924('0x28')]()[_0x4924('0x29')](function(){_0x5a78be[_0x4924('0x1c')](0xcc)[_0x4924('0x1d')]();});}};}function handleEntityNotFound(_0x311e7b,_0x54487a){return function(_0x5c6126){if(!_0x5c6126){_0x311e7b[_0x4924('0x1b')](0x194);}return _0x5c6126;};}function handleError(_0x13a873,_0x552994){_0x552994=_0x552994||0x1f4;return function(_0x4d4775){logger[_0x4924('0x2a')](_0x4d4775[_0x4924('0x2b')]);if(_0x4d4775[_0x4924('0x2c')]){delete _0x4d4775[_0x4924('0x2c')];}_0x13a873[_0x4924('0x1c')](_0x552994)[_0x4924('0x2d')](_0x4d4775);};}exports[_0x4924('0x2e')]=function(_0x27d5a1,_0x51aa6e){var _0xa975c2={},_0x5176b2={},_0x25d285={'count':0x0,'rows':[]};var _0x255e9d=_[_0x4924('0x2f')](db[_0x4924('0x30')][_0x4924('0x31')],function(_0xd86813){return{'name':_0xd86813['fieldName'],'type':_0xd86813['type'][_0x4924('0x32')]};});_0x5176b2[_0x4924('0x33')]=_[_0x4924('0x2f')](_0x255e9d,_0x4924('0x2c'));_0x5176b2[_0x4924('0x34')]=_[_0x4924('0x35')](_0x27d5a1[_0x4924('0x34')]);_0x5176b2[_0x4924('0x36')]=_[_0x4924('0x37')](_0x5176b2['model'],_0x5176b2[_0x4924('0x34')]);_0xa975c2[_0x4924('0x38')]=_['intersection'](_0x5176b2[_0x4924('0x33')],qs[_0x4924('0x39')](_0x27d5a1[_0x4924('0x34')][_0x4924('0x39')]));_0xa975c2[_0x4924('0x38')]=_0xa975c2[_0x4924('0x38')][_0x4924('0x3a')]?_0xa975c2[_0x4924('0x38')]:_0x5176b2[_0x4924('0x33')];if(!_0x27d5a1[_0x4924('0x34')][_0x4924('0x3b')](_0x4924('0x3c'))){_0xa975c2[_0x4924('0x21')]=qs[_0x4924('0x21')](_0x27d5a1[_0x4924('0x34')][_0x4924('0x21')]);_0xa975c2[_0x4924('0x1f')]=qs[_0x4924('0x1f')](_0x27d5a1['query'][_0x4924('0x1f')]);}_0xa975c2[_0x4924('0x3d')]=qs[_0x4924('0x3e')](_0x27d5a1[_0x4924('0x34')][_0x4924('0x3e')]);_0xa975c2['where']=qs[_0x4924('0x36')](_[_0x4924('0x3f')](_0x27d5a1[_0x4924('0x34')],_0x5176b2[_0x4924('0x36')]),_0x255e9d);if(_0x27d5a1[_0x4924('0x34')][_0x4924('0x40')]){_0xa975c2['where']=_[_0x4924('0x41')](_0xa975c2['where'],{'$or':_[_0x4924('0x2f')](_0x255e9d,function(_0x1008d1){if(_0x1008d1['type']!==_0x4924('0x42')){var _0x13a44b={};_0x13a44b[_0x1008d1[_0x4924('0x2c')]]={'$like':'%'+_0x27d5a1['query'][_0x4924('0x40')]+'%'};return _0x13a44b;}})});}_0xa975c2=_[_0x4924('0x41')]({},_0xa975c2,_0x27d5a1[_0x4924('0x43')]);var _0x439461={'where':_0xa975c2['where']};return db[_0x4924('0x30')][_0x4924('0x22')](_0x439461)[_0x4924('0x29')](function(_0x316af1){_0x25d285[_0x4924('0x22')]=_0x316af1;if(_0x27d5a1['query'][_0x4924('0x44')]){_0xa975c2[_0x4924('0x45')]=[{'all':!![]}];}return db[_0x4924('0x30')][_0x4924('0x46')](_0xa975c2);})['then'](function(_0x12495e){_0x25d285[_0x4924('0x47')]=_0x12495e;return _0x25d285;})[_0x4924('0x29')](respondWithFilteredResult(_0x51aa6e,_0xa975c2))[_0x4924('0x48')](handleError(_0x51aa6e,null));};exports[_0x4924('0x49')]=function(_0x152736,_0x136a82){var _0x100d9a={'raw':![],'where':{'id':_0x152736[_0x4924('0x4a')]['id']}},_0x23f836={};_0x23f836[_0x4924('0x33')]=_[_0x4924('0x35')](db['DeskConfiguration'][_0x4924('0x31')]);_0x23f836[_0x4924('0x34')]=_['keys'](_0x152736[_0x4924('0x34')]);_0x23f836[_0x4924('0x36')]=_['intersection'](_0x23f836[_0x4924('0x33')],_0x23f836[_0x4924('0x34')]);_0x100d9a[_0x4924('0x38')]=_[_0x4924('0x37')](_0x23f836['model'],qs['fields'](_0x152736[_0x4924('0x34')][_0x4924('0x39')]));_0x100d9a[_0x4924('0x38')]=_0x100d9a['attributes'][_0x4924('0x3a')]?_0x100d9a[_0x4924('0x38')]:_0x23f836[_0x4924('0x33')];if(_0x152736[_0x4924('0x34')][_0x4924('0x44')]){_0x100d9a[_0x4924('0x45')]=[{'all':!![]}];}_0x100d9a=_['merge']({},_0x100d9a,_0x152736[_0x4924('0x43')]);return db[_0x4924('0x30')]['find'](_0x100d9a)['then'](handleEntityNotFound(_0x136a82,null))[_0x4924('0x29')](respondWithResult(_0x136a82,null))[_0x4924('0x48')](handleError(_0x136a82,null));};exports['create']=function(_0x3775e0,_0x2e0d1f){return db[_0x4924('0x30')][_0x4924('0x4b')](_0x3775e0[_0x4924('0x4c')],{})[_0x4924('0x29')](respondWithResult(_0x2e0d1f,0xc9))['catch'](handleError(_0x2e0d1f,null));};exports[_0x4924('0x27')]=function(_0x703c4,_0x56c574){if(_0x703c4[_0x4924('0x4c')]['id']){delete _0x703c4[_0x4924('0x4c')]['id'];}return db[_0x4924('0x30')]['find']({'where':{'id':_0x703c4[_0x4924('0x4a')]['id']}})[_0x4924('0x29')](handleEntityNotFound(_0x56c574,null))[_0x4924('0x29')](saveUpdates(_0x703c4['body'],null))[_0x4924('0x29')](respondWithResult(_0x56c574,null))[_0x4924('0x48')](handleError(_0x56c574,null));};exports['destroy']=function(_0x63cc09,_0xcef06c){return db[_0x4924('0x30')][_0x4924('0x4d')]({'where':{'id':_0x63cc09['params']['id']}})['then'](handleEntityNotFound(_0xcef06c,null))[_0x4924('0x29')](removeEntity(_0xcef06c,null))[_0x4924('0x48')](handleError(_0xcef06c,null));};exports['getFields']=function(_0xbd8edd,_0x2390f5,_0x31ca41){var _0x3ef8cd={};var _0x3d88eb={};var _0x30c73b;var _0x547925;return db[_0x4924('0x30')][_0x4924('0x4e')]({'where':{'id':_0xbd8edd['params']['id']}})['then'](handleEntityNotFound(_0x2390f5,null))[_0x4924('0x29')](function(_0x1492c1){if(_0x1492c1){_0x30c73b=_0x1492c1;_0x3d88eb[_0x4924('0x33')]=_['keys'](db['DeskField'][_0x4924('0x31')]);_0x3d88eb['query']=_[_0x4924('0x35')](_0xbd8edd[_0x4924('0x34')]);_0x3d88eb[_0x4924('0x36')]=_['intersection'](_0x3d88eb[_0x4924('0x33')],_0x3d88eb[_0x4924('0x34')]);_0x3ef8cd['attributes']=_[_0x4924('0x37')](_0x3d88eb[_0x4924('0x33')],qs[_0x4924('0x39')](_0xbd8edd['query']['fields']));_0x3ef8cd[_0x4924('0x38')]=_0x3ef8cd['attributes'][_0x4924('0x3a')]?_0x3ef8cd[_0x4924('0x38')]:_0x3d88eb[_0x4924('0x33')];_0x3ef8cd[_0x4924('0x3d')]=qs[_0x4924('0x3e')](_0xbd8edd[_0x4924('0x34')][_0x4924('0x3e')]);_0x3ef8cd[_0x4924('0x4f')]=qs['filters'](_[_0x4924('0x3f')](_0xbd8edd[_0x4924('0x34')],_0x3d88eb['filters']));if(_0xbd8edd['query'][_0x4924('0x40')]){_0x3ef8cd[_0x4924('0x4f')]=_[_0x4924('0x41')](_0x3ef8cd[_0x4924('0x4f')],{'$or':_[_0x4924('0x2f')](_0x3ef8cd[_0x4924('0x38')],function(_0x17584b){var _0x158eeb={};_0x158eeb[_0x17584b]={'$like':'%'+_0xbd8edd[_0x4924('0x34')][_0x4924('0x40')]+'%'};return _0x158eeb;})});}_0x3ef8cd=_[_0x4924('0x41')]({},_0x3ef8cd,_0xbd8edd[_0x4924('0x43')]);return _0x30c73b[_0x4924('0x50')](_0x3ef8cd);}})[_0x4924('0x29')](function(_0xe7aadc){if(_0xe7aadc){_0x547925=_0xe7aadc[_0x4924('0x3a')];if(!_0xbd8edd['query']['hasOwnProperty']('nolimit')){_0x3ef8cd[_0x4924('0x21')]=qs[_0x4924('0x21')](_0xbd8edd[_0x4924('0x34')][_0x4924('0x21')]);_0x3ef8cd[_0x4924('0x1f')]=qs[_0x4924('0x1f')](_0xbd8edd[_0x4924('0x34')][_0x4924('0x1f')]);}return _0x30c73b[_0x4924('0x50')](_0x3ef8cd);}})['then'](function(_0x2eb77d){if(_0x2eb77d){return _0x2eb77d?{'count':_0x547925,'rows':_0x2eb77d}:null;}})[_0x4924('0x29')](respondWithResult(_0x2390f5,null))['catch'](handleError(_0x2390f5,null));};exports['getSubjects']=function(_0x1998e5,_0x8b1b29,_0x579c1d){var _0x208ca8={};var _0x41f89d={};var _0x2c9069;var _0x57c0ca;return db[_0x4924('0x30')][_0x4924('0x4e')]({'where':{'id':_0x1998e5[_0x4924('0x4a')]['id']}})[_0x4924('0x29')](handleEntityNotFound(_0x8b1b29,null))['then'](function(_0x3c3d6c){if(_0x3c3d6c){_0x2c9069=_0x3c3d6c;_0x41f89d['model']=_[_0x4924('0x35')](db[_0x4924('0x51')][_0x4924('0x31')]);_0x41f89d[_0x4924('0x34')]=_['keys'](_0x1998e5[_0x4924('0x34')]);_0x41f89d['filters']=_[_0x4924('0x37')](_0x41f89d[_0x4924('0x33')],_0x41f89d[_0x4924('0x34')]);_0x208ca8[_0x4924('0x38')]=_['intersection'](_0x41f89d['model'],qs[_0x4924('0x39')](_0x1998e5['query'][_0x4924('0x39')]));_0x208ca8[_0x4924('0x38')]=_0x208ca8[_0x4924('0x38')][_0x4924('0x3a')]?_0x208ca8[_0x4924('0x38')]:_0x41f89d['model'];_0x208ca8[_0x4924('0x3d')]=qs[_0x4924('0x3e')](_0x1998e5['query'][_0x4924('0x3e')]);_0x208ca8[_0x4924('0x4f')]=qs[_0x4924('0x36')](_['pick'](_0x1998e5[_0x4924('0x34')],_0x41f89d[_0x4924('0x36')]));if(_0x1998e5['query'][_0x4924('0x40')]){_0x208ca8[_0x4924('0x4f')]=_[_0x4924('0x41')](_0x208ca8[_0x4924('0x4f')],{'$or':_['map'](_0x208ca8[_0x4924('0x38')],function(_0x1d0a01){var _0x21d570={};_0x21d570[_0x1d0a01]={'$like':'%'+_0x1998e5[_0x4924('0x34')][_0x4924('0x40')]+'%'};return _0x21d570;})});}_0x208ca8=_[_0x4924('0x41')]({},_0x208ca8,_0x1998e5[_0x4924('0x43')]);return _0x2c9069[_0x4924('0x52')](_0x208ca8);}})[_0x4924('0x29')](function(_0x3ef7d5){if(_0x3ef7d5){_0x57c0ca=_0x3ef7d5['length'];if(!_0x1998e5[_0x4924('0x34')][_0x4924('0x3b')](_0x4924('0x3c'))){_0x208ca8[_0x4924('0x21')]=qs[_0x4924('0x21')](_0x1998e5[_0x4924('0x34')][_0x4924('0x21')]);_0x208ca8['offset']=qs['offset'](_0x1998e5['query'][_0x4924('0x1f')]);}return _0x2c9069[_0x4924('0x52')](_0x208ca8);}})[_0x4924('0x29')](function(_0x56f98b){if(_0x56f98b){return _0x56f98b?{'count':_0x57c0ca,'rows':_0x56f98b}:null;}})['then'](respondWithResult(_0x8b1b29,null))[_0x4924('0x48')](handleError(_0x8b1b29,null));};exports[_0x4924('0x53')]=function(_0x386611,_0x2f02e9,_0x1a7f90){var _0x3f9573={};var _0xa37606={};var _0x593029;var _0x4650c9;return db[_0x4924('0x30')][_0x4924('0x4e')]({'where':{'id':_0x386611[_0x4924('0x4a')]['id']}})[_0x4924('0x29')](handleEntityNotFound(_0x2f02e9,null))[_0x4924('0x29')](function(_0x2ef96e){if(_0x2ef96e){_0x593029=_0x2ef96e;_0xa37606[_0x4924('0x33')]=_[_0x4924('0x35')](db[_0x4924('0x51')][_0x4924('0x31')]);_0xa37606[_0x4924('0x34')]=_[_0x4924('0x35')](_0x386611[_0x4924('0x34')]);_0xa37606[_0x4924('0x36')]=_[_0x4924('0x37')](_0xa37606[_0x4924('0x33')],_0xa37606[_0x4924('0x34')]);_0x3f9573['attributes']=_['intersection'](_0xa37606['model'],qs[_0x4924('0x39')](_0x386611['query']['fields']));_0x3f9573[_0x4924('0x38')]=_0x3f9573[_0x4924('0x38')]['length']?_0x3f9573[_0x4924('0x38')]:_0xa37606[_0x4924('0x33')];_0x3f9573[_0x4924('0x3d')]=qs[_0x4924('0x3e')](_0x386611[_0x4924('0x34')]['sort']);_0x3f9573[_0x4924('0x4f')]=qs[_0x4924('0x36')](_['pick'](_0x386611[_0x4924('0x34')],_0xa37606['filters']));if(_0x386611['query'][_0x4924('0x40')]){_0x3f9573['where']=_[_0x4924('0x41')](_0x3f9573[_0x4924('0x4f')],{'$or':_[_0x4924('0x2f')](_0x3f9573[_0x4924('0x38')],function(_0x5c0904){var _0x21dcca={};_0x21dcca[_0x5c0904]={'$like':'%'+_0x386611['query'][_0x4924('0x40')]+'%'};return _0x21dcca;})});}_0x3f9573=_[_0x4924('0x41')]({},_0x3f9573,_0x386611['options']);return _0x593029[_0x4924('0x53')](_0x3f9573);}})[_0x4924('0x29')](function(_0x244795){if(_0x244795){_0x4650c9=_0x244795[_0x4924('0x3a')];if(!_0x386611[_0x4924('0x34')][_0x4924('0x3b')](_0x4924('0x3c'))){_0x3f9573[_0x4924('0x21')]=qs[_0x4924('0x21')](_0x386611[_0x4924('0x34')]['limit']);_0x3f9573[_0x4924('0x1f')]=qs[_0x4924('0x1f')](_0x386611[_0x4924('0x34')][_0x4924('0x1f')]);}return _0x593029['getDescriptions'](_0x3f9573);}})[_0x4924('0x29')](function(_0x202fb5){if(_0x202fb5){return _0x202fb5?{'count':_0x4650c9,'rows':_0x202fb5}:null;}})[_0x4924('0x29')](respondWithResult(_0x2f02e9,null))[_0x4924('0x48')](handleError(_0x2f02e9,null));};exports['getTags']=function(_0x5550b8,_0x287c66,_0x139c3b){var _0x490cea={};var _0x2cfb54={};var _0x154e45;var _0x219f4b;return db[_0x4924('0x30')][_0x4924('0x4e')]({'where':{'id':_0x5550b8['params']['id']}})['then'](handleEntityNotFound(_0x287c66,null))[_0x4924('0x29')](function(_0x1dbfbd){if(_0x1dbfbd){_0x154e45=_0x1dbfbd;_0x2cfb54[_0x4924('0x33')]=_['keys'](db[_0x4924('0x54')]['rawAttributes']);_0x2cfb54[_0x4924('0x34')]=_[_0x4924('0x35')](_0x5550b8[_0x4924('0x34')]);_0x2cfb54['filters']=_[_0x4924('0x37')](_0x2cfb54['model'],_0x2cfb54['query']);_0x490cea[_0x4924('0x38')]=_['intersection'](_0x2cfb54[_0x4924('0x33')],qs[_0x4924('0x39')](_0x5550b8['query']['fields']));_0x490cea[_0x4924('0x38')]=_0x490cea[_0x4924('0x38')][_0x4924('0x3a')]?_0x490cea[_0x4924('0x38')]:_0x2cfb54[_0x4924('0x33')];_0x490cea[_0x4924('0x3d')]=qs['sort'](_0x5550b8['query'][_0x4924('0x3e')]);_0x490cea[_0x4924('0x4f')]=qs[_0x4924('0x36')](_['pick'](_0x5550b8[_0x4924('0x34')],_0x2cfb54[_0x4924('0x36')]));if(_0x5550b8[_0x4924('0x34')]['filter']){_0x490cea[_0x4924('0x4f')]=_['merge'](_0x490cea[_0x4924('0x4f')],{'$or':_[_0x4924('0x2f')](_0x490cea[_0x4924('0x38')],function(_0x4c870b){var _0x2518fc={};_0x2518fc[_0x4c870b]={'$like':'%'+_0x5550b8['query']['filter']+'%'};return _0x2518fc;})});}_0x490cea=_[_0x4924('0x41')]({},_0x490cea,_0x5550b8['options']);return _0x154e45[_0x4924('0x55')](_0x490cea);}})[_0x4924('0x29')](function(_0x456656){if(_0x456656){_0x219f4b=_0x456656['length'];if(!_0x5550b8[_0x4924('0x34')][_0x4924('0x3b')](_0x4924('0x3c'))){_0x490cea['limit']=qs[_0x4924('0x21')](_0x5550b8[_0x4924('0x34')][_0x4924('0x21')]);_0x490cea[_0x4924('0x1f')]=qs['offset'](_0x5550b8['query'][_0x4924('0x1f')]);}return _0x154e45[_0x4924('0x55')](_0x490cea);}})[_0x4924('0x29')](function(_0x624d00){if(_0x624d00){return _0x624d00?{'count':_0x219f4b,'rows':_0x624d00}:null;}})[_0x4924('0x29')](respondWithResult(_0x287c66,null))[_0x4924('0x48')](handleError(_0x287c66,null));};exports[_0x4924('0x56')]=function(_0x24d4ed,_0x1cab93,_0x80111f){if(_0x24d4ed[_0x4924('0x4c')]['id']){delete _0x24d4ed[_0x4924('0x4c')]['id'];}return db['DeskConfiguration'][_0x4924('0x4e')]({'where':{'id':_0x24d4ed[_0x4924('0x4a')]['id']}})[_0x4924('0x29')](handleEntityNotFound(_0x1cab93,null))['then'](function(_0x152358){if(_0x152358){return _0x152358[_0x4924('0x56')](_0x24d4ed['body'][_0x4924('0x57')]||[]);}return null;})[_0x4924('0x29')](respondWithResult(_0x1cab93,null))[_0x4924('0x48')](handleError(_0x1cab93,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index 3e6e98b..0219056 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 _0xb32f=['./intDeskConfiguration.attributes','exports','define','DeskConfiguration','lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x5399ab,_0x531515){var _0x4b5122=function(_0x19e6b1){while(--_0x19e6b1){_0x5399ab['push'](_0x5399ab['shift']());}};_0x4b5122(++_0x531515);}(_0xb32f,0xd0));var _0xfb32=function(_0xe15b15,_0x4d9458){_0xe15b15=_0xe15b15-0x0;var _0x415066=_0xb32f[_0xe15b15];return _0x415066;};'use strict';var _=require(_0xfb32('0x0'));var util=require('util');var logger=require(_0xfb32('0x1'))(_0xfb32('0x2'));var moment=require(_0xfb32('0x3'));var BPromise=require(_0xfb32('0x4'));var rp=require(_0xfb32('0x5'));var fs=require('fs');var path=require(_0xfb32('0x6'));var rimraf=require('rimraf');var config=require(_0xfb32('0x7'));var attributes=require(_0xfb32('0x8'));module[_0xfb32('0x9')]=function(_0x107fdd,_0x106346){return _0x107fdd[_0xfb32('0xa')](_0xfb32('0xb'),attributes,{'tableName':'int_desk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3bc2=['DeskConfiguration','int_desk_configurations','api','moment','bluebird','request-promise','path','../../config/environment','./intDeskConfiguration.attributes','exports','define'];(function(_0x3e3ad3,_0x52585b){var _0x39e21f=function(_0x1f1822){while(--_0x1f1822){_0x3e3ad3['push'](_0x3e3ad3['shift']());}};_0x39e21f(++_0x52585b);}(_0x3bc2,0x91));var _0x23bc=function(_0x42f9b9,_0x12b35d){_0x42f9b9=_0x42f9b9-0x0;var _0x54e4f8=_0x3bc2[_0x42f9b9];return _0x54e4f8;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x23bc('0x0'));var moment=require(_0x23bc('0x1'));var BPromise=require(_0x23bc('0x2'));var rp=require(_0x23bc('0x3'));var fs=require('fs');var path=require(_0x23bc('0x4'));var rimraf=require('rimraf');var config=require(_0x23bc('0x5'));var attributes=require(_0x23bc('0x6'));module[_0x23bc('0x7')]=function(_0x45890f,_0x25370b){return _0x45890f[_0x23bc('0x8')](_0x23bc('0x9'),attributes,{'tableName':_0x23bc('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.rpc.js b/server/api/intDeskConfiguration/intDeskConfiguration.rpc.js index 8b907ba..6e758cb 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 _0xcd6f=['util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','debug','stringify','error','code','DeskConfiguration,\x20%s,\x20%s','message','info','result','lodash'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xcd6f,0x17b));var _0xfcd6=function(_0x227af0,_0x4af0a4){_0x227af0=_0x227af0-0x0;var _0x14c9ed=_0xcd6f[_0x227af0];return _0x14c9ed;};'use strict';var _=require(_0xfcd6('0x0'));var util=require(_0xfcd6('0x1'));var moment=require(_0xfcd6('0x2'));var BPromise=require(_0xfcd6('0x3'));var rs=require(_0xfcd6('0x4'));var fs=require('fs');var Redis=require(_0xfcd6('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xfcd6('0x6'));var logger=require(_0xfcd6('0x7'))(_0xfcd6('0x8'));var config=require(_0xfcd6('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xfcd6('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x16a180,_0x51329c,_0x135b7e){return new BPromise(function(_0xfc5139,_0x544104){return client[_0xfcd6('0xb')](_0x16a180,_0x135b7e)['then'](function(_0x12dc78){logger['info']('DeskConfiguration,\x20%s,\x20%s',_0x51329c,'request\x20sent');logger[_0xfcd6('0xc')]('DeskConfiguration,\x20%s,\x20%s,\x20%s',_0x51329c,'request\x20sent',JSON[_0xfcd6('0xd')](_0x12dc78));if(_0x12dc78[_0xfcd6('0xe')]){if(_0x12dc78['error'][_0xfcd6('0xf')]===0x1f4){logger[_0xfcd6('0xe')](_0xfcd6('0x10'),_0x51329c,_0x12dc78[_0xfcd6('0xe')][_0xfcd6('0x11')]);return _0x544104(_0x12dc78[_0xfcd6('0xe')][_0xfcd6('0x11')]);}logger[_0xfcd6('0xe')](_0xfcd6('0x10'),_0x51329c,_0x12dc78[_0xfcd6('0xe')][_0xfcd6('0x11')]);return _0xfc5139(_0x12dc78[_0xfcd6('0xe')][_0xfcd6('0x11')]);}else{logger[_0xfcd6('0x12')]('DeskConfiguration,\x20%s,\x20%s',_0x51329c,'request\x20sent');_0xfc5139(_0x12dc78[_0xfcd6('0x13')][_0xfcd6('0x11')]);}})['catch'](function(_0x29d25d){logger[_0xfcd6('0xe')](_0xfcd6('0x10'),_0x51329c,_0x29d25d);_0x544104(_0x29d25d);});});} \ No newline at end of file +var _0x2ffe=['http','request','then','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','jayson/promise','client'];(function(_0x3c5272,_0x1ea873){var _0x31a12a=function(_0x541b39){while(--_0x541b39){_0x3c5272['push'](_0x3c5272['shift']());}};_0x31a12a(++_0x1ea873);}(_0x2ffe,0x6a));var _0xe2ff=function(_0x187699,_0x567f8c){_0x187699=_0x187699-0x0;var _0x204eec=_0x2ffe[_0x187699];return _0x204eec;};'use strict';var _=require('lodash');var util=require(_0xe2ff('0x0'));var moment=require(_0xe2ff('0x1'));var BPromise=require(_0xe2ff('0x2'));var rs=require(_0xe2ff('0x3'));var fs=require('fs');var Redis=require(_0xe2ff('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xe2ff('0x5'));var logger=require(_0xe2ff('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xe2ff('0x7'));var client=jayson[_0xe2ff('0x8')][_0xe2ff('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5dee4a,_0xf24335,_0x212ecc){return new BPromise(function(_0x2a068f,_0x465da8){return client[_0xe2ff('0xa')](_0x5dee4a,_0x212ecc)[_0xe2ff('0xb')](function(_0x220ae3){logger[_0xe2ff('0xc')](_0xe2ff('0xd'),_0xf24335,_0xe2ff('0xe'));logger[_0xe2ff('0xf')](_0xe2ff('0x10'),_0xf24335,_0xe2ff('0xe'),JSON[_0xe2ff('0x11')](_0x220ae3));if(_0x220ae3[_0xe2ff('0x12')]){if(_0x220ae3[_0xe2ff('0x12')][_0xe2ff('0x13')]===0x1f4){logger['error'](_0xe2ff('0xd'),_0xf24335,_0x220ae3[_0xe2ff('0x12')]['message']);return _0x465da8(_0x220ae3[_0xe2ff('0x12')][_0xe2ff('0x14')]);}logger[_0xe2ff('0x12')](_0xe2ff('0xd'),_0xf24335,_0x220ae3[_0xe2ff('0x12')][_0xe2ff('0x14')]);return _0x2a068f(_0x220ae3[_0xe2ff('0x12')][_0xe2ff('0x14')]);}else{logger[_0xe2ff('0xc')](_0xe2ff('0xd'),_0xf24335,_0xe2ff('0xe'));_0x2a068f(_0x220ae3[_0xe2ff('0x15')][_0xe2ff('0x14')]);}})[_0xe2ff('0x16')](function(_0x3fb0f4){logger[_0xe2ff('0x12')]('DeskConfiguration,\x20%s,\x20%s',_0xf24335,_0x3fb0f4);_0x465da8(_0x3fb0f4);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index 5956023..1a181e5 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 _0x909e=['../../components/auth/service','../../config/environment','./intDeskField.controller','get','isAuthenticated','index','/:id','create','put','update','destroy','exports','multer','util','path','connect-timeout','express','fs-extra'];(function(_0x23e7c1,_0x35110c){var _0x1add43=function(_0x238918){while(--_0x238918){_0x23e7c1['push'](_0x23e7c1['shift']());}};_0x1add43(++_0x35110c);}(_0x909e,0x174));var _0xe909=function(_0x50bdb1,_0x47baf3){_0x50bdb1=_0x50bdb1-0x0;var _0x3a60ac=_0x909e[_0x50bdb1];return _0x3a60ac;};'use strict';var multer=require(_0xe909('0x0'));var util=require(_0xe909('0x1'));var path=require(_0xe909('0x2'));var timeout=require(_0xe909('0x3'));var express=require(_0xe909('0x4'));var router=express['Router']();var fs_extra=require(_0xe909('0x5'));var auth=require(_0xe909('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xe909('0x7'));var controller=require(_0xe909('0x8'));router[_0xe909('0x9')]('/',auth[_0xe909('0xa')](),controller[_0xe909('0xb')]);router[_0xe909('0x9')](_0xe909('0xc'),auth[_0xe909('0xa')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0xe909('0xd')]);router[_0xe909('0xe')](_0xe909('0xc'),auth['isAuthenticated'](),controller[_0xe909('0xf')]);router['delete'](_0xe909('0xc'),auth['isAuthenticated'](),controller[_0xe909('0x10')]);module[_0xe909('0x11')]=router; \ No newline at end of file +var _0x9d5b=['isAuthenticated','index','/:id','post','create','put','update','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./intDeskField.controller','get'];(function(_0x189125,_0x123704){var _0xe9c2b=function(_0x329460){while(--_0x329460){_0x189125['push'](_0x189125['shift']());}};_0xe9c2b(++_0x123704);}(_0x9d5b,0x14d));var _0xb9d5=function(_0x636fdb,_0x4782b0){_0x636fdb=_0x636fdb-0x0;var _0x6b633a=_0x9d5b[_0x636fdb];return _0x6b633a;};'use strict';var multer=require('multer');var util=require(_0xb9d5('0x0'));var path=require(_0xb9d5('0x1'));var timeout=require(_0xb9d5('0x2'));var express=require(_0xb9d5('0x3'));var router=express[_0xb9d5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xb9d5('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xb9d5('0x6'));var controller=require(_0xb9d5('0x7'));router[_0xb9d5('0x8')]('/',auth[_0xb9d5('0x9')](),controller[_0xb9d5('0xa')]);router['get'](_0xb9d5('0xb'),auth[_0xb9d5('0x9')](),controller['show']);router[_0xb9d5('0xc')]('/',auth[_0xb9d5('0x9')](),controller[_0xb9d5('0xd')]);router[_0xb9d5('0xe')]('/:id',auth[_0xb9d5('0x9')](),controller[_0xb9d5('0xf')]);router['delete'](_0xb9d5('0xb'),auth[_0xb9d5('0x9')](),controller[_0xb9d5('0x10')]);module[_0xb9d5('0x11')]=router; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.attributes.js b/server/api/intDeskField/intDeskField.attributes.js index d5f641b..c370e88 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 _0x49e2=['variable','customVariable','keyValue','STRING','ENUM','BOOLEAN','sequelize','string'];(function(_0x219196,_0x5b61ef){var _0x1cfd79=function(_0x13d89e){while(--_0x13d89e){_0x219196['push'](_0x219196['shift']());}};_0x1cfd79(++_0x5b61ef);}(_0x49e2,0xa6));var _0x249e=function(_0x5178d8,_0x93a25d){_0x5178d8=_0x5178d8-0x0;var _0x33e667=_0x49e2[_0x5178d8];return _0x33e667;};'use strict';var Sequelize=require(_0x249e('0x0'));module['exports']={'type':{'type':Sequelize['ENUM'](_0x249e('0x1'),_0x249e('0x2'),_0x249e('0x3'),_0x249e('0x4'),'picklist'),'defaultValue':_0x249e('0x1')},'content':{'type':Sequelize[_0x249e('0x5')]},'key':{'type':Sequelize[_0x249e('0x5')]},'keyType':{'type':Sequelize[_0x249e('0x6')]('string',_0x249e('0x2'),_0x249e('0x3'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x249e('0x5')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x249e('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x249e('0x5')]}}; \ No newline at end of file +var _0x5a43=['BOOLEAN','exports','ENUM','string','picklist','STRING','variable'];(function(_0x17a29a,_0x46b1a1){var _0x42cb2f=function(_0x880a2c){while(--_0x880a2c){_0x17a29a['push'](_0x17a29a['shift']());}};_0x42cb2f(++_0x46b1a1);}(_0x5a43,0xa2));var _0x35a4=function(_0x2d4279,_0x5cc62f){_0x2d4279=_0x2d4279-0x0;var _0x21536d=_0x5a43[_0x2d4279];return _0x21536d;};'use strict';var Sequelize=require('sequelize');module[_0x35a4('0x0')]={'type':{'type':Sequelize[_0x35a4('0x1')](_0x35a4('0x2'),'variable','customVariable','keyValue',_0x35a4('0x3')),'defaultValue':_0x35a4('0x2')},'content':{'type':Sequelize[_0x35a4('0x4')]},'key':{'type':Sequelize[_0x35a4('0x4')]},'keyType':{'type':Sequelize['ENUM'](_0x35a4('0x2'),_0x35a4('0x5'),'customVariable')},'keyContent':{'type':Sequelize[_0x35a4('0x4')]},'idField':{'type':Sequelize[_0x35a4('0x4')]},'nameField':{'type':Sequelize[_0x35a4('0x4')]},'customField':{'type':Sequelize[_0x35a4('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x35a4('0x4')]}}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.controller.js b/server/api/intDeskField/intDeskField.controller.js index 0f9863d..89df167 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 _0xe08b=['status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','map','DeskField','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','filter','where','merge','VIRTUAL','options','includeAll','findAll','rows','catch','length','include','create','body','find','params','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus'];(function(_0x2f3790,_0x5c24d9){var _0x353e28=function(_0x2ac3d8){while(--_0x2ac3d8){_0x2f3790['push'](_0x2f3790['shift']());}};_0x353e28(++_0x5c24d9);}(_0xe08b,0x10e));var _0xbe08=function(_0x38854e,_0x23cbc9){_0x38854e=_0x38854e-0x0;var _0x3f8415=_0xe08b[_0x38854e];return _0x3f8415;};'use strict';var emlformat=require(_0xbe08('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbe08('0x1'));var jsonpatch=require(_0xbe08('0x2'));var rp=require('request-promise');var moment=require(_0xbe08('0x3'));var BPromise=require(_0xbe08('0x4'));var Mustache=require(_0xbe08('0x5'));var util=require(_0xbe08('0x6'));var path=require(_0xbe08('0x7'));var sox=require(_0xbe08('0x8'));var csv=require(_0xbe08('0x9'));var ejs=require(_0xbe08('0xa'));var fs=require('fs');var fs_extra=require(_0xbe08('0xb'));var _=require(_0xbe08('0xc'));var squel=require(_0xbe08('0xd'));var crypto=require(_0xbe08('0xe'));var jsforce=require(_0xbe08('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xbe08('0x9'));var querystring=require(_0xbe08('0x10'));var Papa=require('papaparse');var Redis=require(_0xbe08('0x11'));var authService=require(_0xbe08('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xbe08('0x13'));var hardwareService=require(_0xbe08('0x14'));var logger=require('../../config/logger')(_0xbe08('0x15'));var utils=require(_0xbe08('0x16'));var config=require(_0xbe08('0x17'));var licenseUtil=require(_0xbe08('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x42ab71,_0x49410b){_0x49410b=_0x49410b||0xcc;return function(_0x18ee13){if(_0x18ee13){return _0x42ab71[_0xbe08('0x19')](_0x49410b);}return _0x42ab71[_0xbe08('0x1a')](_0x49410b)[_0xbe08('0x1b')]();};}function respondWithResult(_0xe1dafa,_0x3050f1){_0x3050f1=_0x3050f1||0xc8;return function(_0x434646){if(_0x434646){return _0xe1dafa[_0xbe08('0x1a')](_0x3050f1)[_0xbe08('0x1c')](_0x434646);}};}function respondWithFilteredResult(_0x191f51,_0x457129){return function(_0x2b0901){if(_0x2b0901){var _0x122f44=typeof _0x457129[_0xbe08('0x1d')]===_0xbe08('0x1e')&&typeof _0x457129[_0xbe08('0x1f')]===_0xbe08('0x1e');var _0x344019=_0x2b0901['count'];var _0x2fa9b3=_0x122f44?0x0:_0x457129[_0xbe08('0x1d')];var _0x154559=_0x122f44?_0x2b0901[_0xbe08('0x20')]:_0x457129[_0xbe08('0x1d')]+_0x457129[_0xbe08('0x1f')];var _0x1f9808;if(_0x154559>=_0x344019){_0x154559=_0x344019;_0x1f9808=0xc8;}else{_0x1f9808=0xce;}_0x191f51['status'](_0x1f9808);return _0x191f51[_0xbe08('0x21')](_0xbe08('0x22'),_0x2fa9b3+'-'+_0x154559+'/'+_0x344019)['json'](_0x2b0901);}return null;};}function patchUpdates(_0x5ab5f5){return function(_0x439a78){try{jsonpatch[_0xbe08('0x23')](_0x439a78,_0x5ab5f5,!![]);}catch(_0x3785e4){return BPromise['reject'](_0x3785e4);}return _0x439a78[_0xbe08('0x24')]();};}function saveUpdates(_0x25ce24,_0x42143c){return function(_0x45697b){if(_0x45697b){return _0x45697b[_0xbe08('0x25')](_0x25ce24)[_0xbe08('0x26')](function(_0xf1c94a){return _0xf1c94a;});}return null;};}function removeEntity(_0x451732,_0x2d6493){return function(_0x493d13){if(_0x493d13){return _0x493d13[_0xbe08('0x27')]()[_0xbe08('0x26')](function(){_0x451732[_0xbe08('0x1a')](0xcc)[_0xbe08('0x1b')]();});}};}function handleEntityNotFound(_0x3310be,_0x28d47b){return function(_0x368122){if(!_0x368122){_0x3310be[_0xbe08('0x19')](0x194);}return _0x368122;};}function handleError(_0x628624,_0x361b06){_0x361b06=_0x361b06||0x1f4;return function(_0x5e470c){logger[_0xbe08('0x28')](_0x5e470c[_0xbe08('0x29')]);if(_0x5e470c[_0xbe08('0x2a')]){delete _0x5e470c[_0xbe08('0x2a')];}_0x628624[_0xbe08('0x1a')](_0x361b06)[_0xbe08('0x2b')](_0x5e470c);};}exports['index']=function(_0x415da3,_0x2aaa12){var _0x3b77bb={},_0x465b7b={},_0x1135c3={'count':0x0,'rows':[]};var _0x523be0=_[_0xbe08('0x2c')](db[_0xbe08('0x2d')][_0xbe08('0x2e')],function(_0x54c913){return{'name':_0x54c913[_0xbe08('0x2f')],'type':_0x54c913[_0xbe08('0x30')]['key']};});_0x465b7b[_0xbe08('0x31')]=_[_0xbe08('0x2c')](_0x523be0,'name');_0x465b7b[_0xbe08('0x32')]=_[_0xbe08('0x33')](_0x415da3[_0xbe08('0x32')]);_0x465b7b[_0xbe08('0x34')]=_[_0xbe08('0x35')](_0x465b7b[_0xbe08('0x31')],_0x465b7b[_0xbe08('0x32')]);_0x3b77bb[_0xbe08('0x36')]=_[_0xbe08('0x35')](_0x465b7b[_0xbe08('0x31')],qs[_0xbe08('0x37')](_0x415da3[_0xbe08('0x32')][_0xbe08('0x37')]));_0x3b77bb[_0xbe08('0x36')]=_0x3b77bb[_0xbe08('0x36')]['length']?_0x3b77bb['attributes']:_0x465b7b[_0xbe08('0x31')];if(!_0x415da3[_0xbe08('0x32')]['hasOwnProperty'](_0xbe08('0x38'))){_0x3b77bb[_0xbe08('0x1f')]=qs[_0xbe08('0x1f')](_0x415da3[_0xbe08('0x32')]['limit']);_0x3b77bb[_0xbe08('0x1d')]=qs[_0xbe08('0x1d')](_0x415da3['query']['offset']);}_0x3b77bb[_0xbe08('0x39')]=qs[_0xbe08('0x3a')](_0x415da3[_0xbe08('0x32')][_0xbe08('0x3a')]);_0x3b77bb['where']=qs[_0xbe08('0x34')](_['pick'](_0x415da3[_0xbe08('0x32')],_0x465b7b[_0xbe08('0x34')]),_0x523be0);if(_0x415da3['query'][_0xbe08('0x3b')]){_0x3b77bb[_0xbe08('0x3c')]=_[_0xbe08('0x3d')](_0x3b77bb[_0xbe08('0x3c')],{'$or':_[_0xbe08('0x2c')](_0x523be0,function(_0x56db9c){if(_0x56db9c[_0xbe08('0x30')]!==_0xbe08('0x3e')){var _0x2c80d7={};_0x2c80d7[_0x56db9c[_0xbe08('0x2a')]]={'$like':'%'+_0x415da3[_0xbe08('0x32')][_0xbe08('0x3b')]+'%'};return _0x2c80d7;}})});}_0x3b77bb=_[_0xbe08('0x3d')]({},_0x3b77bb,_0x415da3[_0xbe08('0x3f')]);var _0x357158={'where':_0x3b77bb['where']};return db[_0xbe08('0x2d')][_0xbe08('0x20')](_0x357158)['then'](function(_0x4f0bbe){_0x1135c3[_0xbe08('0x20')]=_0x4f0bbe;if(_0x415da3['query'][_0xbe08('0x40')]){_0x3b77bb['include']=[{'all':!![]}];}return db[_0xbe08('0x2d')][_0xbe08('0x41')](_0x3b77bb);})[_0xbe08('0x26')](function(_0x337c2b){_0x1135c3[_0xbe08('0x42')]=_0x337c2b;return _0x1135c3;})[_0xbe08('0x26')](respondWithFilteredResult(_0x2aaa12,_0x3b77bb))[_0xbe08('0x43')](handleError(_0x2aaa12,null));};exports['show']=function(_0x274139,_0x16d412){var _0x4b4d7a={'raw':!![],'where':{'id':_0x274139['params']['id']}},_0x59179f={};_0x59179f[_0xbe08('0x31')]=_[_0xbe08('0x33')](db['DeskField']['rawAttributes']);_0x59179f[_0xbe08('0x32')]=_[_0xbe08('0x33')](_0x274139[_0xbe08('0x32')]);_0x59179f[_0xbe08('0x34')]=_[_0xbe08('0x35')](_0x59179f[_0xbe08('0x31')],_0x59179f[_0xbe08('0x32')]);_0x4b4d7a[_0xbe08('0x36')]=_['intersection'](_0x59179f[_0xbe08('0x31')],qs[_0xbe08('0x37')](_0x274139[_0xbe08('0x32')][_0xbe08('0x37')]));_0x4b4d7a[_0xbe08('0x36')]=_0x4b4d7a[_0xbe08('0x36')][_0xbe08('0x44')]?_0x4b4d7a['attributes']:_0x59179f['model'];if(_0x274139[_0xbe08('0x32')][_0xbe08('0x40')]){_0x4b4d7a[_0xbe08('0x45')]=[{'all':!![]}];}_0x4b4d7a=_[_0xbe08('0x3d')]({},_0x4b4d7a,_0x274139[_0xbe08('0x3f')]);return db['DeskField']['find'](_0x4b4d7a)['then'](handleEntityNotFound(_0x16d412,null))[_0xbe08('0x26')](respondWithResult(_0x16d412,null))['catch'](handleError(_0x16d412,null));};exports['create']=function(_0x1e6e6e,_0x9a9e38){return db[_0xbe08('0x2d')][_0xbe08('0x46')](_0x1e6e6e[_0xbe08('0x47')],{})[_0xbe08('0x26')](respondWithResult(_0x9a9e38,0xc9))[_0xbe08('0x43')](handleError(_0x9a9e38,null));};exports[_0xbe08('0x25')]=function(_0x592a7e,_0x2bd33a){if(_0x592a7e[_0xbe08('0x47')]['id']){delete _0x592a7e[_0xbe08('0x47')]['id'];}return db['DeskField'][_0xbe08('0x48')]({'where':{'id':_0x592a7e[_0xbe08('0x49')]['id']}})['then'](handleEntityNotFound(_0x2bd33a,null))[_0xbe08('0x26')](saveUpdates(_0x592a7e[_0xbe08('0x47')],null))['then'](respondWithResult(_0x2bd33a,null))[_0xbe08('0x43')](handleError(_0x2bd33a,null));};exports[_0xbe08('0x27')]=function(_0x50c0ec,_0x52c6f1){return db['DeskField']['find']({'where':{'id':_0x50c0ec['params']['id']}})[_0xbe08('0x26')](handleEntityNotFound(_0x52c6f1,null))[_0xbe08('0x26')](removeEntity(_0x52c6f1,null))['catch'](handleError(_0x52c6f1,null));}; \ No newline at end of file +var _0x66c7=['papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','Content-Range','reject','save','update','destroy','then','error','stack','name','DeskField','fieldName','type','key','map','query','keys','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','includeAll','include','findAll','rows','params','merge','find','catch','create','body','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x66c7,0x15c));var _0x766c=function(_0x5a57cd,_0x498a68){_0x5a57cd=_0x5a57cd-0x0;var _0x3b9e9d=_0x66c7[_0x5a57cd];return _0x3b9e9d;};'use strict';var emlformat=require(_0x766c('0x0'));var rimraf=require(_0x766c('0x1'));var zipdir=require(_0x766c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x766c('0x3'));var moment=require(_0x766c('0x4'));var BPromise=require(_0x766c('0x5'));var Mustache=require(_0x766c('0x6'));var util=require(_0x766c('0x7'));var path=require(_0x766c('0x8'));var sox=require('sox');var csv=require(_0x766c('0x9'));var ejs=require(_0x766c('0xa'));var fs=require('fs');var fs_extra=require(_0x766c('0xb'));var _=require(_0x766c('0xc'));var squel=require(_0x766c('0xd'));var crypto=require(_0x766c('0xe'));var jsforce=require(_0x766c('0xf'));var deskjs=require(_0x766c('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x766c('0x11'));var Redis=require(_0x766c('0x12'));var authService=require(_0x766c('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x766c('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x766c('0x15'))(_0x766c('0x16'));var utils=require(_0x766c('0x17'));var config=require(_0x766c('0x18'));var licenseUtil=require(_0x766c('0x19'));var db=require(_0x766c('0x1a'))['db'];function respondWithStatusCode(_0x2dcaa6,_0x3fcdb0){_0x3fcdb0=_0x3fcdb0||0xcc;return function(_0x9cb32b){if(_0x9cb32b){return _0x2dcaa6[_0x766c('0x1b')](_0x3fcdb0);}return _0x2dcaa6[_0x766c('0x1c')](_0x3fcdb0)[_0x766c('0x1d')]();};}function respondWithResult(_0x26dbe2,_0x44365a){_0x44365a=_0x44365a||0xc8;return function(_0x186914){if(_0x186914){return _0x26dbe2['status'](_0x44365a)['json'](_0x186914);}};}function respondWithFilteredResult(_0x491b9e,_0x35fcdc){return function(_0x3e0cf0){if(_0x3e0cf0){var _0xfadbc1=typeof _0x35fcdc[_0x766c('0x1e')]===_0x766c('0x1f')&&typeof _0x35fcdc[_0x766c('0x20')]==='undefined';var _0x529811=_0x3e0cf0[_0x766c('0x21')];var _0x23c566=_0xfadbc1?0x0:_0x35fcdc[_0x766c('0x1e')];var _0x47c887=_0xfadbc1?_0x3e0cf0[_0x766c('0x21')]:_0x35fcdc[_0x766c('0x1e')]+_0x35fcdc[_0x766c('0x20')];var _0x563546;if(_0x47c887>=_0x529811){_0x47c887=_0x529811;_0x563546=0xc8;}else{_0x563546=0xce;}_0x491b9e['status'](_0x563546);return _0x491b9e['set'](_0x766c('0x22'),_0x23c566+'-'+_0x47c887+'/'+_0x529811)['json'](_0x3e0cf0);}return null;};}function patchUpdates(_0x2736d0){return function(_0x3a0601){try{jsonpatch['apply'](_0x3a0601,_0x2736d0,!![]);}catch(_0x5dd837){return BPromise[_0x766c('0x23')](_0x5dd837);}return _0x3a0601[_0x766c('0x24')]();};}function saveUpdates(_0x41fa49,_0x508ce7){return function(_0x28304f){if(_0x28304f){return _0x28304f[_0x766c('0x25')](_0x41fa49)['then'](function(_0x504b05){return _0x504b05;});}return null;};}function removeEntity(_0x577000,_0x43d91f){return function(_0x4eb83e){if(_0x4eb83e){return _0x4eb83e[_0x766c('0x26')]()[_0x766c('0x27')](function(){_0x577000[_0x766c('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x44659e,_0x444310){return function(_0x19cb9b){if(!_0x19cb9b){_0x44659e[_0x766c('0x1b')](0x194);}return _0x19cb9b;};}function handleError(_0x3db6b4,_0x8ce86b){_0x8ce86b=_0x8ce86b||0x1f4;return function(_0x5ad1d6){logger[_0x766c('0x28')](_0x5ad1d6[_0x766c('0x29')]);if(_0x5ad1d6[_0x766c('0x2a')]){delete _0x5ad1d6[_0x766c('0x2a')];}_0x3db6b4[_0x766c('0x1c')](_0x8ce86b)['send'](_0x5ad1d6);};}exports['index']=function(_0x2d7de6,_0x19b6e8){var _0x1d5288={},_0x549dde={},_0x9f13ba={'count':0x0,'rows':[]};var _0x463302=_['map'](db[_0x766c('0x2b')]['rawAttributes'],function(_0x5bbefd){return{'name':_0x5bbefd[_0x766c('0x2c')],'type':_0x5bbefd[_0x766c('0x2d')][_0x766c('0x2e')]};});_0x549dde['model']=_[_0x766c('0x2f')](_0x463302,_0x766c('0x2a'));_0x549dde[_0x766c('0x30')]=_[_0x766c('0x31')](_0x2d7de6[_0x766c('0x30')]);_0x549dde['filters']=_['intersection'](_0x549dde[_0x766c('0x32')],_0x549dde[_0x766c('0x30')]);_0x1d5288[_0x766c('0x33')]=_[_0x766c('0x34')](_0x549dde[_0x766c('0x32')],qs['fields'](_0x2d7de6[_0x766c('0x30')][_0x766c('0x35')]));_0x1d5288[_0x766c('0x33')]=_0x1d5288['attributes'][_0x766c('0x36')]?_0x1d5288['attributes']:_0x549dde['model'];if(!_0x2d7de6[_0x766c('0x30')][_0x766c('0x37')](_0x766c('0x38'))){_0x1d5288[_0x766c('0x20')]=qs[_0x766c('0x20')](_0x2d7de6[_0x766c('0x30')]['limit']);_0x1d5288['offset']=qs[_0x766c('0x1e')](_0x2d7de6[_0x766c('0x30')][_0x766c('0x1e')]);}_0x1d5288[_0x766c('0x39')]=qs[_0x766c('0x3a')](_0x2d7de6[_0x766c('0x30')][_0x766c('0x3a')]);_0x1d5288[_0x766c('0x3b')]=qs[_0x766c('0x3c')](_[_0x766c('0x3d')](_0x2d7de6[_0x766c('0x30')],_0x549dde[_0x766c('0x3c')]),_0x463302);if(_0x2d7de6[_0x766c('0x30')]['filter']){_0x1d5288[_0x766c('0x3b')]=_['merge'](_0x1d5288[_0x766c('0x3b')],{'$or':_['map'](_0x463302,function(_0x1e13ee){if(_0x1e13ee[_0x766c('0x2d')]!=='VIRTUAL'){var _0xfb586={};_0xfb586[_0x1e13ee[_0x766c('0x2a')]]={'$like':'%'+_0x2d7de6['query'][_0x766c('0x3e')]+'%'};return _0xfb586;}})});}_0x1d5288=_['merge']({},_0x1d5288,_0x2d7de6['options']);var _0x5c1df6={'where':_0x1d5288[_0x766c('0x3b')]};return db['DeskField'][_0x766c('0x21')](_0x5c1df6)[_0x766c('0x27')](function(_0x3b8636){_0x9f13ba[_0x766c('0x21')]=_0x3b8636;if(_0x2d7de6[_0x766c('0x30')][_0x766c('0x3f')]){_0x1d5288[_0x766c('0x40')]=[{'all':!![]}];}return db[_0x766c('0x2b')][_0x766c('0x41')](_0x1d5288);})['then'](function(_0x246348){_0x9f13ba[_0x766c('0x42')]=_0x246348;return _0x9f13ba;})['then'](respondWithFilteredResult(_0x19b6e8,_0x1d5288))['catch'](handleError(_0x19b6e8,null));};exports['show']=function(_0x256102,_0xe8d1d0){var _0x537714={'raw':!![],'where':{'id':_0x256102[_0x766c('0x43')]['id']}},_0x2b99d1={};_0x2b99d1['model']=_[_0x766c('0x31')](db[_0x766c('0x2b')]['rawAttributes']);_0x2b99d1[_0x766c('0x30')]=_['keys'](_0x256102[_0x766c('0x30')]);_0x2b99d1[_0x766c('0x3c')]=_[_0x766c('0x34')](_0x2b99d1[_0x766c('0x32')],_0x2b99d1[_0x766c('0x30')]);_0x537714['attributes']=_[_0x766c('0x34')](_0x2b99d1[_0x766c('0x32')],qs['fields'](_0x256102[_0x766c('0x30')][_0x766c('0x35')]));_0x537714['attributes']=_0x537714['attributes'][_0x766c('0x36')]?_0x537714[_0x766c('0x33')]:_0x2b99d1[_0x766c('0x32')];if(_0x256102['query'][_0x766c('0x3f')]){_0x537714[_0x766c('0x40')]=[{'all':!![]}];}_0x537714=_[_0x766c('0x44')]({},_0x537714,_0x256102['options']);return db[_0x766c('0x2b')][_0x766c('0x45')](_0x537714)['then'](handleEntityNotFound(_0xe8d1d0,null))[_0x766c('0x27')](respondWithResult(_0xe8d1d0,null))[_0x766c('0x46')](handleError(_0xe8d1d0,null));};exports[_0x766c('0x47')]=function(_0x53c225,_0x67a4ab){return db['DeskField']['create'](_0x53c225['body'],{})[_0x766c('0x27')](respondWithResult(_0x67a4ab,0xc9))[_0x766c('0x46')](handleError(_0x67a4ab,null));};exports['update']=function(_0x2b53ca,_0xcb8c71){if(_0x2b53ca[_0x766c('0x48')]['id']){delete _0x2b53ca['body']['id'];}return db[_0x766c('0x2b')]['find']({'where':{'id':_0x2b53ca[_0x766c('0x43')]['id']}})[_0x766c('0x27')](handleEntityNotFound(_0xcb8c71,null))[_0x766c('0x27')](saveUpdates(_0x2b53ca[_0x766c('0x48')],null))[_0x766c('0x27')](respondWithResult(_0xcb8c71,null))[_0x766c('0x46')](handleError(_0xcb8c71,null));};exports[_0x766c('0x26')]=function(_0x33bd20,_0x38bb8b){return db['DeskField'][_0x766c('0x45')]({'where':{'id':_0x33bd20[_0x766c('0x43')]['id']}})[_0x766c('0x27')](handleEntityNotFound(_0x38bb8b,null))[_0x766c('0x27')](removeEntity(_0x38bb8b,null))[_0x766c('0x46')](handleError(_0x38bb8b,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index a727221..8ff520f 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 _0xd735=['../../config/environment','./intDeskField.attributes','DeskField','int_desk_fields','desk_unique_index','idField','FieldId','../../config/logger','api','moment','request-promise','rimraf'];(function(_0x17ac5b,_0x1a2d16){var _0x2dcec9=function(_0x4bbe8d){while(--_0x4bbe8d){_0x17ac5b['push'](_0x17ac5b['shift']());}};_0x2dcec9(++_0x1a2d16);}(_0xd735,0xd3));var _0x5d73=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0xd735[_0x27af45];return _0x18df21;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x5d73('0x0'))(_0x5d73('0x1'));var moment=require(_0x5d73('0x2'));var BPromise=require('bluebird');var rp=require(_0x5d73('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5d73('0x4'));var config=require(_0x5d73('0x5'));var attributes=require(_0x5d73('0x6'));module['exports']=function(_0x565175,_0x4ee39b){return _0x565175['define'](_0x5d73('0x7'),attributes,{'tableName':_0x5d73('0x8'),'paranoid':![],'indexes':[{'name':_0x5d73('0x9'),'fields':[_0x5d73('0xa'),_0x5d73('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2316=['rimraf','../../config/environment','./intDeskField.attributes','exports','define','DeskField','desk_unique_index','FieldId','lodash','util','api','moment','bluebird'];(function(_0x4792c8,_0x5158a1){var _0x35edb1=function(_0x2472d3){while(--_0x2472d3){_0x4792c8['push'](_0x4792c8['shift']());}};_0x35edb1(++_0x5158a1);}(_0x2316,0x126));var _0x6231=function(_0x8ba19a,_0x1d2b2b){_0x8ba19a=_0x8ba19a-0x0;var _0x2bd8b4=_0x2316[_0x8ba19a];return _0x2bd8b4;};'use strict';var _=require(_0x6231('0x0'));var util=require(_0x6231('0x1'));var logger=require('../../config/logger')(_0x6231('0x2'));var moment=require(_0x6231('0x3'));var BPromise=require(_0x6231('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x6231('0x5'));var config=require(_0x6231('0x6'));var attributes=require(_0x6231('0x7'));module[_0x6231('0x8')]=function(_0x38105a,_0x5a50ca){return _0x38105a[_0x6231('0x9')](_0x6231('0xa'),attributes,{'tableName':'int_desk_fields','paranoid':![],'indexes':[{'name':_0x6231('0xb'),'fields':['idField',_0x6231('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.rpc.js b/server/api/intDeskField/intDeskField.rpc.js index 85ee5f2..11c4ab1 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 _0xf916=['http','request','then','info','request\x20sent','debug','DeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','DeskField,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','client'];(function(_0x1bb812,_0x23eacc){var _0x372adb=function(_0x5ad456){while(--_0x5ad456){_0x1bb812['push'](_0x1bb812['shift']());}};_0x372adb(++_0x23eacc);}(_0xf916,0x97));var _0x6f91=function(_0x559d6c,_0x124742){_0x559d6c=_0x559d6c-0x0;var _0x40efda=_0xf916[_0x559d6c];return _0x40efda;};'use strict';var _=require(_0x6f91('0x0'));var util=require(_0x6f91('0x1'));var moment=require(_0x6f91('0x2'));var BPromise=require(_0x6f91('0x3'));var rs=require(_0x6f91('0x4'));var fs=require('fs');var Redis=require(_0x6f91('0x5'));var db=require(_0x6f91('0x6'))['db'];var utils=require(_0x6f91('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0x6f91('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x6f91('0x9')][_0x6f91('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1552e7,_0x41545c,_0x203496){return new BPromise(function(_0x27eabc,_0x243d55){return client[_0x6f91('0xb')](_0x1552e7,_0x203496)[_0x6f91('0xc')](function(_0x31a66f){logger[_0x6f91('0xd')]('DeskField,\x20%s,\x20%s',_0x41545c,_0x6f91('0xe'));logger[_0x6f91('0xf')](_0x6f91('0x10'),_0x41545c,_0x6f91('0xe'),JSON[_0x6f91('0x11')](_0x31a66f));if(_0x31a66f['error']){if(_0x31a66f[_0x6f91('0x12')][_0x6f91('0x13')]===0x1f4){logger[_0x6f91('0x12')](_0x6f91('0x14'),_0x41545c,_0x31a66f[_0x6f91('0x12')][_0x6f91('0x15')]);return _0x243d55(_0x31a66f['error'][_0x6f91('0x15')]);}logger[_0x6f91('0x12')]('DeskField,\x20%s,\x20%s',_0x41545c,_0x31a66f[_0x6f91('0x12')][_0x6f91('0x15')]);return _0x27eabc(_0x31a66f[_0x6f91('0x12')]['message']);}else{logger[_0x6f91('0xd')](_0x6f91('0x14'),_0x41545c,_0x6f91('0xe'));_0x27eabc(_0x31a66f[_0x6f91('0x16')][_0x6f91('0x15')]);}})['catch'](function(_0x1a61a0){logger[_0x6f91('0x12')](_0x6f91('0x14'),_0x41545c,_0x1a61a0);_0x243d55(_0x1a61a0);});});} \ No newline at end of file +var _0xc554=['bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','client','http','request','info','DeskField,\x20%s,\x20%s','request\x20sent','debug','DeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment'];(function(_0x5d561b,_0x530379){var _0x41a4b1=function(_0x29bcae){while(--_0x29bcae){_0x5d561b['push'](_0x5d561b['shift']());}};_0x41a4b1(++_0x530379);}(_0xc554,0x162));var _0x4c55=function(_0x3f477c,_0x52b7ff){_0x3f477c=_0x3f477c-0x0;var _0x4c36b3=_0xc554[_0x3f477c];return _0x4c36b3;};'use strict';var _=require(_0x4c55('0x0'));var util=require(_0x4c55('0x1'));var moment=require(_0x4c55('0x2'));var BPromise=require(_0x4c55('0x3'));var rs=require(_0x4c55('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4c55('0x5'))['db'];var utils=require(_0x4c55('0x6'));var logger=require(_0x4c55('0x7'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x4c55('0x8')][_0x4c55('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x41fd44,_0x5470cc,_0x28df3b){return new BPromise(function(_0x5d5b30,_0x1621d6){return client[_0x4c55('0xa')](_0x41fd44,_0x28df3b)['then'](function(_0x5bd075){logger[_0x4c55('0xb')](_0x4c55('0xc'),_0x5470cc,_0x4c55('0xd'));logger[_0x4c55('0xe')](_0x4c55('0xf'),_0x5470cc,_0x4c55('0xd'),JSON[_0x4c55('0x10')](_0x5bd075));if(_0x5bd075[_0x4c55('0x11')]){if(_0x5bd075[_0x4c55('0x11')][_0x4c55('0x12')]===0x1f4){logger[_0x4c55('0x11')](_0x4c55('0xc'),_0x5470cc,_0x5bd075[_0x4c55('0x11')][_0x4c55('0x13')]);return _0x1621d6(_0x5bd075[_0x4c55('0x11')][_0x4c55('0x13')]);}logger[_0x4c55('0x11')]('DeskField,\x20%s,\x20%s',_0x5470cc,_0x5bd075['error']['message']);return _0x5d5b30(_0x5bd075[_0x4c55('0x11')][_0x4c55('0x13')]);}else{logger[_0x4c55('0xb')]('DeskField,\x20%s,\x20%s',_0x5470cc,_0x4c55('0xd'));_0x5d5b30(_0x5bd075[_0x4c55('0x14')][_0x4c55('0x13')]);}})['catch'](function(_0x49a87c){logger[_0x4c55('0x11')](_0x4c55('0xc'),_0x5470cc,_0x49a87c);_0x1621d6(_0x49a87c);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index ffb4923..5ddb8ff 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 _0x2e67=['./intDynamics365Account.controller','get','/:id','isAuthenticated','show','/:id/configurations','getFields','post','create','put','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment'];(function(_0x4adf48,_0x43a2e3){var _0x2499d7=function(_0x582896){while(--_0x582896){_0x4adf48['push'](_0x4adf48['shift']());}};_0x2499d7(++_0x43a2e3);}(_0x2e67,0xac));var _0x72e6=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x2e67[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x72e6('0x0'));var util=require(_0x72e6('0x1'));var path=require(_0x72e6('0x2'));var timeout=require('connect-timeout');var express=require(_0x72e6('0x3'));var router=express[_0x72e6('0x4')]();var fs_extra=require(_0x72e6('0x5'));var auth=require(_0x72e6('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x72e6('0x7'));var controller=require(_0x72e6('0x8'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x72e6('0x9')](_0x72e6('0xa'),auth[_0x72e6('0xb')](),controller[_0x72e6('0xc')]);router['get'](_0x72e6('0xd'),auth[_0x72e6('0xb')](),controller['getConfigurations']);router['get']('/:id/fields',auth[_0x72e6('0xb')](),controller[_0x72e6('0xe')]);router[_0x72e6('0xf')]('/',auth['isAuthenticated'](),controller[_0x72e6('0x10')]);router['post'](_0x72e6('0xd'),auth['isAuthenticated'](),controller['addConfiguration']);router[_0x72e6('0x11')](_0x72e6('0xa'),auth[_0x72e6('0xb')](),controller['update']);router['delete'](_0x72e6('0xa'),auth[_0x72e6('0xb')](),controller[_0x72e6('0x12')]);module[_0x72e6('0x13')]=router; \ No newline at end of file +var _0xc2d9=['show','/:id/configurations','/:id/fields','getFields','post','create','addConfiguration','put','update','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../config/environment','./intDynamics365Account.controller','get','isAuthenticated','/:id'];(function(_0x16c521,_0x58d4fc){var _0x13ea45=function(_0x225adc){while(--_0x225adc){_0x16c521['push'](_0x16c521['shift']());}};_0x13ea45(++_0x58d4fc);}(_0xc2d9,0x16f));var _0x9c2d=function(_0x399a0b,_0x550d4e){_0x399a0b=_0x399a0b-0x0;var _0x266bc0=_0xc2d9[_0x399a0b];return _0x266bc0;};'use strict';var multer=require(_0x9c2d('0x0'));var util=require(_0x9c2d('0x1'));var path=require(_0x9c2d('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x9c2d('0x3')]();var fs_extra=require(_0x9c2d('0x4'));var auth=require(_0x9c2d('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x9c2d('0x6'));var controller=require(_0x9c2d('0x7'));router[_0x9c2d('0x8')]('/',auth[_0x9c2d('0x9')](),controller['index']);router[_0x9c2d('0x8')](_0x9c2d('0xa'),auth[_0x9c2d('0x9')](),controller[_0x9c2d('0xb')]);router[_0x9c2d('0x8')](_0x9c2d('0xc'),auth[_0x9c2d('0x9')](),controller['getConfigurations']);router['get'](_0x9c2d('0xd'),auth[_0x9c2d('0x9')](),controller[_0x9c2d('0xe')]);router[_0x9c2d('0xf')]('/',auth['isAuthenticated'](),controller[_0x9c2d('0x10')]);router[_0x9c2d('0xf')]('/:id/configurations',auth[_0x9c2d('0x9')](),controller[_0x9c2d('0x11')]);router[_0x9c2d('0x12')](_0x9c2d('0xa'),auth[_0x9c2d('0x9')](),controller[_0x9c2d('0x13')]);router['delete'](_0x9c2d('0xa'),auth[_0x9c2d('0x9')](),controller['destroy']);module[_0x9c2d('0x14')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.attributes.js b/server/api/intDynamics365Account/intDynamics365Account.attributes.js index 6a487a5..9c5bfb7 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 _0x6d60=['exports','STRING','sequelize'];(function(_0x5b10aa,_0xd1d127){var _0x528daf=function(_0x21957b){while(--_0x21957b){_0x5b10aa['push'](_0x5b10aa['shift']());}};_0x528daf(++_0xd1d127);}(_0x6d60,0x16a));var _0x06d6=function(_0x26d386,_0x1660c0){_0x26d386=_0x26d386-0x0;var _0x4ef9a8=_0x6d60[_0x26d386];return _0x4ef9a8;};'use strict';var Sequelize=require(_0x06d6('0x0'));module[_0x06d6('0x1')]={'name':{'type':Sequelize[_0x06d6('0x2')]},'username':{'type':Sequelize[_0x06d6('0x2')]},'password':{'type':Sequelize[_0x06d6('0x2')]},'remoteUri':{'type':Sequelize['STRING']},'tenantId':{'type':Sequelize[_0x06d6('0x2')]},'clientId':{'type':Sequelize[_0x06d6('0x2')]},'clientSecret':{'type':Sequelize[_0x06d6('0x2')]},'serverUrl':{'type':Sequelize[_0x06d6('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x06d6('0x2')]}}; \ No newline at end of file +var _0xb1e0=['STRING'];(function(_0x32b262,_0x3bf68e){var _0x562b18=function(_0xc33bb9){while(--_0xc33bb9){_0x32b262['push'](_0x32b262['shift']());}};_0x562b18(++_0x3bf68e);}(_0xb1e0,0x112));var _0x0b1e=function(_0xdeba,_0x15eb9a){_0xdeba=_0xdeba-0x0;var _0x9a69ce=_0xb1e0[_0xdeba];return _0x9a69ce;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x0b1e('0x0')]},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize['STRING']},'tenantId':{'type':Sequelize[_0x0b1e('0x0')]},'clientId':{'type':Sequelize[_0x0b1e('0x0')]},'clientSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0x0b1e('0x0')],'allowNull':![]},'description':{'type':Sequelize[_0x0b1e('0x0')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.controller.js b/server/api/intDynamics365Account/intDynamics365Account.controller.js index 460e012..c7aff05 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 _0x269f=['StringAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','concat','test','statusCode','Wrong\x20credentials',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','Options','Label','UserLocalizedLabel','Value','DisplayName','EntityDefinitions(',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','TrueOption','true','FalseOption','false','?$select=DisplayName,LogicalName','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','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','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','reject','update','then','error','stack','name','index','map','Dynamics365Account','rawAttributes','fieldName','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','merge','find','create','body','destroy','getConfigurations','findOne','Dynamics365Configuration','pick','AccountId','getSubjects','channel','Dynamics365Field','Descriptions','getFields','ticketType','PhoneCall','title','description','customerid','ownerid','caseorigincode','subject','phonenumber','directioncode','phonecall_activity_parties','accountidname','accountidyominame','contactidname','contactidyominame','contractdetailidname','contractidname','createdbyexternalpartyname','createdbyname','createdbyyominame','createdon','createdonbehalfbyyominame','customeridname','customeridyominame','entitlementidname','entityimage_timestamp','escalatedon','exchangerate','firstresponsebykpiidname','followupby','importsequencenumber','influencescore','kbarticleidname','lastonholdtime','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyyominame','modifiedon','modifiedonbehalfbyname','msdyn_incidenttypename','msdyn_iotalertname','numberofchildincidents','onholdtime','owneridname','owneridtype','owneridyominame','parentcaseidname','primarycontactidname','primarycontactidyominame','prioritycodename','productidname','productserialnumber','resolveby','resolvebykpiidname','responsiblecontactidname','responsiblecontactidyominame','sentimentvalue','slainvokedidname','slaname','socialprofileidname','statecode','statuscode','ticketnumber','timezoneruleversionnumber','traversedpath','utcconversiontimezonecode','versionnumber','password','remoteUri','tenantId','clientSecret','slice','lastIndexOf','format','%s/api/data/v9.0/','POST','/oauth2/token','clientId','username','access_token','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','4.0','value','MetadataId',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','Attributes','remove','includes','LogicalName','forEach','@odata.type','substring','PicklistAttributeMetadata','push','isNil','BooleanAttributeMetadata','all'];(function(_0x39b7f5,_0x30021e){var _0x572eee=function(_0x5dc28c){while(--_0x5dc28c){_0x39b7f5['push'](_0x39b7f5['shift']());}};_0x572eee(++_0x30021e);}(_0x269f,0xee));var _0xf269=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0x269f[_0x413feb];return _0x40ee88;};'use strict';var emlformat=require(_0xf269('0x0'));var rimraf=require(_0xf269('0x1'));var zipdir=require(_0xf269('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf269('0x3'));var moment=require('moment');var BPromise=require(_0xf269('0x4'));var Mustache=require(_0xf269('0x5'));var util=require(_0xf269('0x6'));var path=require(_0xf269('0x7'));var sox=require(_0xf269('0x8'));var csv=require('to-csv');var ejs=require(_0xf269('0x9'));var fs=require('fs');var fs_extra=require(_0xf269('0xa'));var _=require(_0xf269('0xb'));var squel=require(_0xf269('0xc'));var crypto=require(_0xf269('0xd'));var jsforce=require(_0xf269('0xe'));var deskjs=require(_0xf269('0xf'));var toCsv=require('to-csv');var querystring=require(_0xf269('0x10'));var Papa=require(_0xf269('0x11'));var Redis=require(_0xf269('0x12'));var authService=require(_0xf269('0x13'));var qs=require(_0xf269('0x14'));var as=require(_0xf269('0x15'));var hardwareService=require(_0xf269('0x16'));var logger=require(_0xf269('0x17'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require(_0xf269('0x18'));function respondWithStatusCode(_0x36504a,_0x396a75){_0x396a75=_0x396a75||0xcc;return function(_0x4d130e){if(_0x4d130e){return _0x36504a[_0xf269('0x19')](_0x396a75);}return _0x36504a[_0xf269('0x1a')](_0x396a75)[_0xf269('0x1b')]();};}function respondWithResult(_0x34912d,_0x3e6198){_0x3e6198=_0x3e6198||0xc8;return function(_0x1316bd){if(_0x1316bd){return _0x34912d[_0xf269('0x1a')](_0x3e6198)[_0xf269('0x1c')](_0x1316bd);}};}function respondWithFilteredResult(_0xfc8d78,_0x2a240a){return function(_0x31201c){if(_0x31201c){var _0xa00717=typeof _0x2a240a[_0xf269('0x1d')]===_0xf269('0x1e')&&typeof _0x2a240a[_0xf269('0x1f')]===_0xf269('0x1e');var _0x2198f2=_0x31201c[_0xf269('0x20')];var _0x5f5ba0=_0xa00717?0x0:_0x2a240a[_0xf269('0x1d')];var _0x3348a7=_0xa00717?_0x31201c['count']:_0x2a240a['offset']+_0x2a240a[_0xf269('0x1f')];var _0x575352;if(_0x3348a7>=_0x2198f2){_0x3348a7=_0x2198f2;_0x575352=0xc8;}else{_0x575352=0xce;}_0xfc8d78[_0xf269('0x1a')](_0x575352);return _0xfc8d78['set']('Content-Range',_0x5f5ba0+'-'+_0x3348a7+'/'+_0x2198f2)['json'](_0x31201c);}return null;};}function patchUpdates(_0x1d1847){return function(_0x26b46a){try{jsonpatch['apply'](_0x26b46a,_0x1d1847,!![]);}catch(_0x2cb234){return BPromise[_0xf269('0x21')](_0x2cb234);}return _0x26b46a['save']();};}function saveUpdates(_0x9c9c7a,_0x328973){return function(_0x1d7374){if(_0x1d7374){return _0x1d7374[_0xf269('0x22')](_0x9c9c7a)[_0xf269('0x23')](function(_0x30d9b0){return _0x30d9b0;});}return null;};}function removeEntity(_0x4d9776,_0x9148c5){return function(_0x43b5f2){if(_0x43b5f2){return _0x43b5f2['destroy']()[_0xf269('0x23')](function(){_0x4d9776[_0xf269('0x1a')](0xcc)[_0xf269('0x1b')]();});}};}function handleEntityNotFound(_0x3ac6fc,_0x21e13f){return function(_0x4f639f){if(!_0x4f639f){_0x3ac6fc['sendStatus'](0x194);}return _0x4f639f;};}function handleError(_0x9f558d,_0x4087ef){_0x4087ef=_0x4087ef||0x1f4;return function(_0x2b724a){logger[_0xf269('0x24')](_0x2b724a[_0xf269('0x25')]);if(_0x2b724a[_0xf269('0x26')]){delete _0x2b724a[_0xf269('0x26')];}_0x9f558d['status'](_0x4087ef)['send'](_0x2b724a);};}exports[_0xf269('0x27')]=function(_0x3e9ab9,_0x261ccf){var _0x43d6b8={},_0x2ad8c3={},_0x3441df={'count':0x0,'rows':[]};var _0x3784c1=_[_0xf269('0x28')](db[_0xf269('0x29')][_0xf269('0x2a')],function(_0x22ba16){return{'name':_0x22ba16[_0xf269('0x2b')],'type':_0x22ba16['type']['key']};});_0x2ad8c3[_0xf269('0x2c')]=_['map'](_0x3784c1,_0xf269('0x26'));_0x2ad8c3[_0xf269('0x2d')]=_[_0xf269('0x2e')](_0x3e9ab9[_0xf269('0x2d')]);_0x2ad8c3['filters']=_[_0xf269('0x2f')](_0x2ad8c3[_0xf269('0x2c')],_0x2ad8c3[_0xf269('0x2d')]);_0x43d6b8[_0xf269('0x30')]=_[_0xf269('0x2f')](_0x2ad8c3[_0xf269('0x2c')],qs[_0xf269('0x31')](_0x3e9ab9[_0xf269('0x2d')][_0xf269('0x31')]));_0x43d6b8[_0xf269('0x30')]=_0x43d6b8['attributes'][_0xf269('0x32')]?_0x43d6b8[_0xf269('0x30')]:_0x2ad8c3['model'];if(!_0x3e9ab9['query'][_0xf269('0x33')](_0xf269('0x34'))){_0x43d6b8['limit']=qs[_0xf269('0x1f')](_0x3e9ab9[_0xf269('0x2d')]['limit']);_0x43d6b8[_0xf269('0x1d')]=qs[_0xf269('0x1d')](_0x3e9ab9[_0xf269('0x2d')]['offset']);}_0x43d6b8[_0xf269('0x35')]=qs[_0xf269('0x36')](_0x3e9ab9[_0xf269('0x2d')][_0xf269('0x36')]);_0x43d6b8[_0xf269('0x37')]=qs[_0xf269('0x38')](_['pick'](_0x3e9ab9[_0xf269('0x2d')],_0x2ad8c3[_0xf269('0x38')]),_0x3784c1);if(_0x3e9ab9[_0xf269('0x2d')][_0xf269('0x39')]){_0x43d6b8[_0xf269('0x37')]=_['merge'](_0x43d6b8[_0xf269('0x37')],{'$or':_[_0xf269('0x28')](_0x3784c1,function(_0x295348){if(_0x295348[_0xf269('0x3a')]!==_0xf269('0x3b')){var _0x3035f5={};_0x3035f5[_0x295348['name']]={'$like':'%'+_0x3e9ab9[_0xf269('0x2d')][_0xf269('0x39')]+'%'};return _0x3035f5;}})});}_0x43d6b8=_['merge']({},_0x43d6b8,_0x3e9ab9[_0xf269('0x3c')]);var _0x3c260a={'where':_0x43d6b8['where']};return db[_0xf269('0x29')][_0xf269('0x20')](_0x3c260a)[_0xf269('0x23')](function(_0x24154b){_0x3441df[_0xf269('0x20')]=_0x24154b;if(_0x3e9ab9[_0xf269('0x2d')][_0xf269('0x3d')]){_0x43d6b8[_0xf269('0x3e')]=[{'all':!![]}];}return db['Dynamics365Account'][_0xf269('0x3f')](_0x43d6b8);})[_0xf269('0x23')](function(_0xd752b6){_0x3441df[_0xf269('0x40')]=_0xd752b6;return _0x3441df;})[_0xf269('0x23')](respondWithFilteredResult(_0x261ccf,_0x43d6b8))[_0xf269('0x41')](handleError(_0x261ccf,null));};exports[_0xf269('0x42')]=function(_0x4b9d3d,_0x3610e2){var _0x34dd14={'raw':![],'where':{'id':_0x4b9d3d[_0xf269('0x43')]['id']}},_0x53e0a8={};_0x53e0a8[_0xf269('0x2c')]=_[_0xf269('0x2e')](db['Dynamics365Account'][_0xf269('0x2a')]);_0x53e0a8[_0xf269('0x2d')]=_[_0xf269('0x2e')](_0x4b9d3d[_0xf269('0x2d')]);_0x53e0a8[_0xf269('0x38')]=_[_0xf269('0x2f')](_0x53e0a8[_0xf269('0x2c')],_0x53e0a8[_0xf269('0x2d')]);_0x34dd14[_0xf269('0x30')]=_[_0xf269('0x2f')](_0x53e0a8[_0xf269('0x2c')],qs['fields'](_0x4b9d3d['query'][_0xf269('0x31')]));_0x34dd14[_0xf269('0x30')]=_0x34dd14[_0xf269('0x30')]['length']?_0x34dd14[_0xf269('0x30')]:_0x53e0a8[_0xf269('0x2c')];if(_0x4b9d3d[_0xf269('0x2d')][_0xf269('0x3d')]){_0x34dd14[_0xf269('0x3e')]=[{'all':!![]}];}_0x34dd14=_[_0xf269('0x44')]({},_0x34dd14,_0x4b9d3d[_0xf269('0x3c')]);return db[_0xf269('0x29')][_0xf269('0x45')](_0x34dd14)[_0xf269('0x23')](handleEntityNotFound(_0x3610e2,null))[_0xf269('0x23')](respondWithResult(_0x3610e2,null))[_0xf269('0x41')](handleError(_0x3610e2,null));};exports['create']=function(_0x5a4a59,_0x2b1769){return db[_0xf269('0x29')][_0xf269('0x46')](_0x5a4a59[_0xf269('0x47')],{})['then'](respondWithResult(_0x2b1769,0xc9))['catch'](handleError(_0x2b1769,null));};exports['update']=function(_0x1f1a65,_0x5629ab){if(_0x1f1a65[_0xf269('0x47')]['id']){delete _0x1f1a65[_0xf269('0x47')]['id'];}return db[_0xf269('0x29')][_0xf269('0x45')]({'where':{'id':_0x1f1a65[_0xf269('0x43')]['id']}})[_0xf269('0x23')](handleEntityNotFound(_0x5629ab,null))[_0xf269('0x23')](saveUpdates(_0x1f1a65['body'],null))[_0xf269('0x23')](respondWithResult(_0x5629ab,null))[_0xf269('0x41')](handleError(_0x5629ab,null));};exports[_0xf269('0x48')]=function(_0x9bb640,_0x164cdc){return db[_0xf269('0x29')][_0xf269('0x45')]({'where':{'id':_0x9bb640[_0xf269('0x43')]['id']}})[_0xf269('0x23')](handleEntityNotFound(_0x164cdc,null))[_0xf269('0x23')](removeEntity(_0x164cdc,null))[_0xf269('0x41')](handleError(_0x164cdc,null));};exports[_0xf269('0x49')]=function(_0x4abc3a,_0x39cb9c,_0x3391a1){var _0x57cd77={};var _0x2f9ea3={};var _0x2f499b;var _0x5ad666;return db['Dynamics365Account'][_0xf269('0x4a')]({'where':{'id':_0x4abc3a['params']['id']}})[_0xf269('0x23')](handleEntityNotFound(_0x39cb9c,null))['then'](function(_0x226160){if(_0x226160){_0x2f499b=_0x226160;_0x2f9ea3['model']=_[_0xf269('0x2e')](db[_0xf269('0x4b')][_0xf269('0x2a')]);_0x2f9ea3[_0xf269('0x2d')]=_[_0xf269('0x2e')](_0x4abc3a[_0xf269('0x2d')]);_0x2f9ea3[_0xf269('0x38')]=_[_0xf269('0x2f')](_0x2f9ea3[_0xf269('0x2c')],_0x2f9ea3[_0xf269('0x2d')]);_0x57cd77[_0xf269('0x30')]=_[_0xf269('0x2f')](_0x2f9ea3[_0xf269('0x2c')],qs[_0xf269('0x31')](_0x4abc3a[_0xf269('0x2d')][_0xf269('0x31')]));_0x57cd77[_0xf269('0x30')]=_0x57cd77['attributes']['length']?_0x57cd77[_0xf269('0x30')]:_0x2f9ea3[_0xf269('0x2c')];_0x57cd77[_0xf269('0x35')]=qs[_0xf269('0x36')](_0x4abc3a[_0xf269('0x2d')][_0xf269('0x36')]);_0x57cd77['where']=qs['filters'](_[_0xf269('0x4c')](_0x4abc3a[_0xf269('0x2d')],_0x2f9ea3[_0xf269('0x38')]));if(_0x4abc3a[_0xf269('0x2d')]['filter']){_0x57cd77[_0xf269('0x37')]=_[_0xf269('0x44')](_0x57cd77['where'],{'$or':_[_0xf269('0x28')](_0x57cd77[_0xf269('0x30')],function(_0x2ede9e){var _0x52cb15={};_0x52cb15[_0x2ede9e]={'$like':'%'+_0x4abc3a[_0xf269('0x2d')][_0xf269('0x39')]+'%'};return _0x52cb15;})});}_0x57cd77=_['merge']({},_0x57cd77,_0x4abc3a[_0xf269('0x3c')]);return _0x2f499b[_0xf269('0x49')](_0x57cd77);}})[_0xf269('0x23')](function(_0x4a8dc3){if(_0x4a8dc3){_0x5ad666=_0x4a8dc3[_0xf269('0x32')];if(!_0x4abc3a[_0xf269('0x2d')][_0xf269('0x33')]('nolimit')){_0x57cd77[_0xf269('0x1f')]=qs[_0xf269('0x1f')](_0x4abc3a[_0xf269('0x2d')]['limit']);_0x57cd77[_0xf269('0x1d')]=qs[_0xf269('0x1d')](_0x4abc3a[_0xf269('0x2d')]['offset']);}return _0x2f499b[_0xf269('0x49')](_0x57cd77);}})[_0xf269('0x23')](function(_0x42b54f){if(_0x42b54f){return _0x42b54f?{'count':_0x5ad666,'rows':_0x42b54f}:null;}})[_0xf269('0x23')](respondWithResult(_0x39cb9c,null))['catch'](handleError(_0x39cb9c,null));};exports['addConfiguration']=function(_0x3ce151,_0x4f8f59,_0x285257){if(_0x3ce151[_0xf269('0x47')]['id']){delete _0x3ce151[_0xf269('0x47')]['id'];}return db[_0xf269('0x29')]['findOne']({'where':{'id':_0x3ce151[_0xf269('0x43')]['id']}})[_0xf269('0x23')](handleEntityNotFound(_0x4f8f59,null))[_0xf269('0x23')](function(_0x45349e){if(_0x45349e){_0x3ce151[_0xf269('0x47')][_0xf269('0x4d')]=_0x45349e['id'];_0x3ce151[_0xf269('0x47')]['Subjects']=integrations[_0xf269('0x4e')](_0x3ce151[_0xf269('0x47')][_0xf269('0x4f')],_0x3ce151[_0xf269('0x47')][_0xf269('0x3a')]);_0x3ce151[_0xf269('0x47')]['Descriptions']=integrations['getDescriptions'](_0x3ce151[_0xf269('0x47')][_0xf269('0x4f')],_0x3ce151[_0xf269('0x47')]['type']);return db[_0xf269('0x4b')][_0xf269('0x46')](_0x3ce151[_0xf269('0x47')],{'include':[{'model':db['Dynamics365Field'],'as':'Subjects'},{'model':db[_0xf269('0x50')],'as':_0xf269('0x51')}]});}return null;})['then'](respondWithResult(_0x4f8f59,null))[_0xf269('0x41')](handleError(_0x4f8f59,null));};exports[_0xf269('0x52')]=function(_0x3bc567,_0x3748a2,_0x5a900d){var _0x4b52cf=_0x3bc567[_0xf269('0x2d')][_0xf269('0x53')];var _0x184fb5=_0x4b52cf==='incident'?'Incident':_0xf269('0x54');var _0x2510cd='';var _0x40b2cf='';var _0x17a82c='';var _0x275f42='';var _0x171b6f='';var _0x54ba97='';var _0x4724f5='';var _0x22ee6e='';var _0x3f36e2=[_0xf269('0x55'),_0xf269('0x56'),_0xf269('0x57'),_0xf269('0x58'),_0xf269('0x59'),_0xf269('0x5a'),_0xf269('0x5b'),'regardingobjectid',_0xf269('0x5c'),_0xf269('0x5d')];var _0x4b1b6f=[_0xf269('0x5e'),_0xf269('0x5f'),'actualserviceunits','billedserviceunits',_0xf269('0x60'),_0xf269('0x61'),_0xf269('0x62'),_0xf269('0x63'),_0xf269('0x64'),'createdbyexternalpartyyominame',_0xf269('0x65'),_0xf269('0x66'),_0xf269('0x67'),'createdonbehalfbyname',_0xf269('0x68'),_0xf269('0x69'),'customeridtype',_0xf269('0x6a'),'emailaddress',_0xf269('0x6b'),_0xf269('0x6c'),'entityimage_url',_0xf269('0x6d'),_0xf269('0x6e'),_0xf269('0x6f'),_0xf269('0x70'),_0xf269('0x71'),_0xf269('0x72'),_0xf269('0x73'),_0xf269('0x74'),'masteridname',_0xf269('0x75'),_0xf269('0x76'),'modifiedbyname',_0xf269('0x77'),_0xf269('0x78'),_0xf269('0x79'),'modifiedonbehalfbyyominame',_0xf269('0x7a'),_0xf269('0x7b'),_0xf269('0x7c'),_0xf269('0x7d'),'overriddencreatedon',_0xf269('0x7e'),_0xf269('0x7f'),_0xf269('0x80'),_0xf269('0x81'),_0xf269('0x82'),_0xf269('0x83'),_0xf269('0x84'),_0xf269('0x85'),_0xf269('0x86'),_0xf269('0x87'),_0xf269('0x88'),'responseby',_0xf269('0x89'),_0xf269('0x8a'),_0xf269('0x8b'),_0xf269('0x8c'),_0xf269('0x8d'),_0xf269('0x8e'),_0xf269('0x8f'),_0xf269('0x90'),'subjectidname',_0xf269('0x91'),_0xf269('0x92'),'transactioncurrencyidname',_0xf269('0x93'),_0xf269('0x94'),_0xf269('0x95')];var _0x1ab605=_0x3f36e2['concat'](_0x4b1b6f);return db[_0xf269('0x29')][_0xf269('0x4a')]({'where':{'id':_0x3bc567[_0xf269('0x43')]['id']},'attributes':['id','username',_0xf269('0x96'),_0xf269('0x97'),_0xf269('0x98'),'clientId',_0xf269('0x99')]})[_0xf269('0x23')](handleEntityNotFound(_0x3748a2,null))[_0xf269('0x23')](function(_0xcb37ae){if(_0xcb37ae){_0x22ee6e=_0xcb37ae[_0xf269('0x97')];var _0x5aad55=_0x22ee6e[_0xf269('0x9a')](-0x1);if(_0x5aad55==='/'){_0x22ee6e=_0x22ee6e['substring'](0x0,_0x22ee6e[_0xf269('0x9b')](_0x5aad55));}_0x4724f5=util[_0xf269('0x9c')](_0xf269('0x9d'),_0x22ee6e);var _0x1306b4={'method':_0xf269('0x9e'),'uri':'https://login.microsoftonline.com/'+_0xcb37ae[_0xf269('0x98')]+_0xf269('0x9f'),'form':{'client_id':_0xcb37ae[_0xf269('0xa0')],'resource':_0x22ee6e,'username':_0xcb37ae[_0xf269('0xa1')],'password':_0xcb37ae[_0xf269('0x96')],'grant_type':_0xf269('0x96'),'client_secret':_0xcb37ae[_0xf269('0x99')]},'json':!![]};return rp(_0x1306b4);}})[_0xf269('0x23')](function(_0x280051){_0x54ba97=_0x280051[_0xf269('0xa2')];var _0x4073d1={'method':_0xf269('0xa3'),'uri':encodeURI(_0x4724f5+_0xf269('0xa4')+_0x184fb5+'\x27'),'headers':{'Authorization':_0xf269('0xa5')+_0x54ba97,'If-None-Match':null,'OData-Version':_0xf269('0xa6')},'json':!![]};return rp(_0x4073d1);})[_0xf269('0x23')](function(_0x51f77c){var _0x243cc8=_0x51f77c[_0xf269('0xa7')][0x0];var _0x3cd16b=_0x243cc8[_0xf269('0xa8')];var _0x136ee7={'method':'GET','uri':_0x4724f5+'EntityDefinitions('+_0x3cd16b+_0xf269('0xa9'),'headers':{'Authorization':_0xf269('0xa5')+_0x54ba97,'If-None-Match':null,'OData-Version':_0xf269('0xa6')},'json':!![]};return rp(_0x136ee7);})[_0xf269('0x23')](function(_0x5adfee){_0x2510cd=_0x5adfee;_0x40b2cf=_0x2510cd[_0xf269('0xaa')];_0x40b2cf=_[_0xf269('0xab')](_0x40b2cf,function(_0x3753f9){return!_0x1ab605[_0xf269('0xac')](_0x3753f9[_0xf269('0xad')]);});var _0x38aec2=[];var _0x512051=[];_0x40b2cf[_0xf269('0xae')](function(_0x36ba3f){if(_0x36ba3f['@odata.type']){var _0x3c5847=_0x36ba3f[_0xf269('0xaf')][_0xf269('0xb0')](_0x36ba3f[_0xf269('0xaf')][_0xf269('0x9b')]('.')+0x1);if(_0x3c5847===_0xf269('0xb1')){_0x38aec2[_0xf269('0xb2')](getSelectList(_0x4724f5,_0x4b52cf,_0x512051,_0x2510cd[_0xf269('0xa8')],_0x36ba3f[_0xf269('0xa8')],_0x54ba97));}}});return Promise['all'](_0x38aec2);})[_0xf269('0x23')](function(_0x47dc36){_0x17a82c=_0x47dc36[0x0];var _0x1fcc12=[];var _0x37fc9f=[];_0x40b2cf['forEach'](function(_0x1fb7ed){if(!_[_0xf269('0xb3')](_0x1fb7ed[_0xf269('0xaf')])){var _0x51cf97=_0x1fb7ed['@odata.type']['substring'](_0x1fb7ed[_0xf269('0xaf')][_0xf269('0x9b')]('.')+0x1);if(_0x51cf97===_0xf269('0xb4')){_0x1fcc12[_0xf269('0xb2')](getBooleanList(_0x4724f5,_0x4b52cf,_0x37fc9f,_0x2510cd[_0xf269('0xa8')],_0x1fb7ed['MetadataId'],_0x54ba97));}}});return Promise[_0xf269('0xb5')](_0x1fcc12);})[_0xf269('0x23')](function(_0x3ab068){_0x275f42=_0x3ab068[0x0];var _0x1a5d6f=[];var _0x2fe426=[];_0x40b2cf['forEach'](function(_0x576b15){if(_0x576b15['@odata.type']){var _0x582b1c=_0x576b15[_0xf269('0xaf')][_0xf269('0xb0')](_0x576b15[_0xf269('0xaf')][_0xf269('0x9b')]('.')+0x1);if(_0x582b1c===_0xf269('0xb6')||_0x582b1c==='DoubleAttributeMetadata'||_0x582b1c===_0xf269('0xb7')||_0x582b1c===_0xf269('0xb8')||_0x582b1c===_0xf269('0xb9')||_0x582b1c===_0xf269('0xba')||_0x582b1c==='StatusAttributeMetadata'||_0x582b1c===_0xf269('0xbb')||_0x582b1c===_0xf269('0xbc')||_0x582b1c===_0xf269('0xbd')){_0x1a5d6f['push'](getInputList(_0x4724f5,_0x4b52cf,_0x582b1c,_0x2fe426,_0x2510cd[_0xf269('0xa8')],_0x576b15['MetadataId'],_0x54ba97));}}});return Promise[_0xf269('0xb5')](_0x1a5d6f);})['then'](function(_0x703835){_0x171b6f=_0x703835[0x0];var _0x5d50e9=_0x17a82c[_0xf269('0xbe')](_0x275f42)[_0xf269('0xbe')](_0x171b6f);var _0x4df5db={'count':_0x5d50e9[_0xf269('0x32')],'rows':_0x5d50e9};return _0x4df5db;})[_0xf269('0x23')](respondWithResult(_0x3748a2,null))['catch'](function(_0xa846e6){var _0x4a911d=_0x3bc567['query'][_0xf269('0xbf')]?0x1f4:_0xa846e6[_0xf269('0xc0')]||0x1f4;logger[_0xf269('0x24')](_0xa846e6[_0xf269('0x25')]);delete _0xa846e6[_0xf269('0x26')];if(_0x4a911d===0x191){_0x4a911d=0x190;}_0x3748a2[_0xf269('0x1a')](_0x4a911d)['send'](_0x3bc567[_0xf269('0x2d')][_0xf269('0xbf')]?{'message':_0xf269('0xc1'),'statusCode':_0xa846e6[_0xf269('0xc0')]}:_0xa846e6);});};function getSelectList(_0x5eda0f,_0x33f55d,_0x5e7461,_0x4fe09c,_0xe5b49b,_0x3db10a){var _0x5b7265={'method':'GET','uri':_0x5eda0f+'EntityDefinitions('+_0x4fe09c+_0xf269('0xc2')+_0xe5b49b+_0xf269('0xc3')+_0xf269('0xc4'),'headers':{'Authorization':'Bearer\x20'+_0x3db10a,'If-None-Match':null,'OData-Version':_0xf269('0xa6')},'json':!![]};return rp(_0x5b7265)[_0xf269('0x23')](function(_0x1afad7){var _0x5957a6=[];var _0x49fed7=_0x1afad7[_0xf269('0xc5')][_0xf269('0xc6')];_0x49fed7['forEach'](function(_0x1e24ed){_0x5957a6[_0xf269('0xb2')]({'name':_0x1e24ed[_0xf269('0xc7')][_0xf269('0xc8')][_0xf269('0xc7')],'value':String(_0x1e24ed[_0xf269('0xc9')])});});var _0x131d6c={'id':_0x33f55d+'_'+_0x1afad7[_0xf269('0xad')],'name':_0x1afad7[_0xf269('0xca')][_0xf269('0xc8')][_0xf269('0xc7')],'custom':![],'options':_0x5957a6};_0x5e7461[_0xf269('0xb2')](_0x131d6c);return _0x5e7461;});}function getBooleanList(_0x286699,_0xb52a7c,_0x379c8c,_0x322876,_0x135562,_0x511a00){var _0x498b28={'method':_0xf269('0xa3'),'uri':_0x286699+_0xf269('0xcb')+_0x322876+_0xf269('0xc2')+_0x135562+_0xf269('0xcc'),'headers':{'Authorization':_0xf269('0xa5')+_0x511a00,'If-None-Match':null,'OData-Version':_0xf269('0xa6')},'json':!![]};return rp(_0x498b28)['then'](function(_0x1b8142){var _0xcb033d=[];_0xcb033d[_0xf269('0xb2')]({'name':_0x1b8142[_0xf269('0xc5')][_0xf269('0xcd')]['Label']['UserLocalizedLabel']['Label'],'value':_0xf269('0xce')},{'name':_0x1b8142[_0xf269('0xc5')][_0xf269('0xcf')]['Label'][_0xf269('0xc8')][_0xf269('0xc7')],'value':_0xf269('0xd0')});var _0x36bb1a={'id':_0xb52a7c+'_'+_0x1b8142[_0xf269('0xad')],'name':_0x1b8142[_0xf269('0xca')][_0xf269('0xc8')]['Label'],'custom':![],'options':_0xcb033d};_0x379c8c['push'](_0x36bb1a);return _0x379c8c;});}function getInputList(_0x3431bd,_0x2e6348,_0x459f75,_0x4b5f1f,_0xcaf26b,_0x172ea4,_0x12e844){var _0x1c5be8={'method':_0xf269('0xa3'),'uri':_0x3431bd+_0xf269('0xcb')+_0xcaf26b+_0xf269('0xc2')+_0x172ea4+')/Microsoft.Dynamics.CRM.'+_0x459f75+_0xf269('0xd1'),'headers':{'Authorization':_0xf269('0xa5')+_0x12e844,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x1c5be8)[_0xf269('0x23')](function(_0x3e1572){var _0x13b4c6={'id':_0x2e6348+'_'+_0x3e1572[_0xf269('0xad')],'name':_0x3e1572[_0xf269('0xca')][_0xf269('0xc8')]?_0x3e1572['DisplayName'][_0xf269('0xc8')]['Label']:_0x3e1572['LogicalName'],'custom':![],'options':[]};_0x4b5f1f[_0xf269('0xb2')](_0x13b4c6);return _0x4b5f1f;});} \ No newline at end of file +var _0xc7b4=['attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','Dynamics365Account','then','includeAll','include','findAll','rows','catch','params','find','create','body','update','destroy','getConfigurations','Dynamics365Configuration','addConfiguration','findOne','AccountId','Subjects','Descriptions','getDescriptions','Dynamics365Field','getFields','ticketType','incident','Incident','title','customerid','ownerid','caseorigincode','subject','phonenumber','regardingobjectid','directioncode','phonecall_activity_parties','accountidname','accountidyominame','actualserviceunits','contactidyominame','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyname','createdbyyominame','createdon','customeridtype','entitlementidname','entityimage_timestamp','escalatedon','exchangerate','importsequencenumber','influencescore','kbarticleidname','lastonholdtime','masteridname','modifiedbyexternalpartyname','modifiedbyname','modifiedbyyominame','modifiedon','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_incidenttypename','msdyn_iotalertname','numberofchildincidents','onholdtime','overriddencreatedon','owneridname','owneridtype','parentcaseidname','primarycontactidname','primarycontactidyominame','productidname','productserialnumber','resolveby','resolvebykpiidname','responseby','responsiblecontactidname','responsiblecontactidyominame','sentimentvalue','slainvokedidname','slaname','statecode','statuscode','subjectidname','timezoneruleversionnumber','transactioncurrencyidname','traversedpath','utcconversiontimezonecode','concat','username','password','remoteUri','clientId','slice','substring','lastIndexOf','format','%s/api/data/v9.0/','https://login.microsoftonline.com/','tenantId','access_token','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','4.0','value','MetadataId','Attributes','remove','includes','LogicalName','forEach','@odata.type','PicklistAttributeMetadata','push','all','BooleanAttributeMetadata','StringAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','StateAttributeMetadata','test','statusCode','Wrong\x20credentials','EntityDefinitions(',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','Bearer\x20','OptionSet','Options','Label','UserLocalizedLabel','Value','DisplayName','false',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','count','limit','set','apply','reject','save','end','error','stack','name','send','index','rawAttributes','fieldName','type','key','map','query','keys','filters','model'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0xc7b4,0x15e));var _0x4c7b=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xc7b4[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require(_0x4c7b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4c7b('0x1'));var jsonpatch=require(_0x4c7b('0x2'));var rp=require('request-promise');var moment=require(_0x4c7b('0x3'));var BPromise=require(_0x4c7b('0x4'));var Mustache=require(_0x4c7b('0x5'));var util=require(_0x4c7b('0x6'));var path=require(_0x4c7b('0x7'));var sox=require('sox');var csv=require(_0x4c7b('0x8'));var ejs=require(_0x4c7b('0x9'));var fs=require('fs');var fs_extra=require(_0x4c7b('0xa'));var _=require(_0x4c7b('0xb'));var squel=require(_0x4c7b('0xc'));var crypto=require(_0x4c7b('0xd'));var jsforce=require(_0x4c7b('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x4c7b('0xf'));var Redis=require(_0x4c7b('0x10'));var authService=require(_0x4c7b('0x11'));var qs=require(_0x4c7b('0x12'));var as=require(_0x4c7b('0x13'));var hardwareService=require(_0x4c7b('0x14'));var logger=require('../../config/logger')(_0x4c7b('0x15'));var utils=require(_0x4c7b('0x16'));var config=require(_0x4c7b('0x17'));var licenseUtil=require(_0x4c7b('0x18'));var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x262265,_0x18fd94){_0x18fd94=_0x18fd94||0xcc;return function(_0x13f436){if(_0x13f436){return _0x262265[_0x4c7b('0x19')](_0x18fd94);}return _0x262265[_0x4c7b('0x1a')](_0x18fd94)['end']();};}function respondWithResult(_0x5aa057,_0x4ad52f){_0x4ad52f=_0x4ad52f||0xc8;return function(_0x1c2af5){if(_0x1c2af5){return _0x5aa057['status'](_0x4ad52f)[_0x4c7b('0x1b')](_0x1c2af5);}};}function respondWithFilteredResult(_0x3ed0b2,_0x450cb8){return function(_0x135bda){if(_0x135bda){var _0x2f570f=typeof _0x450cb8[_0x4c7b('0x1c')]==='undefined'&&typeof _0x450cb8['limit']==='undefined';var _0x2f5f35=_0x135bda[_0x4c7b('0x1d')];var _0x290e79=_0x2f570f?0x0:_0x450cb8[_0x4c7b('0x1c')];var _0x2342d4=_0x2f570f?_0x135bda['count']:_0x450cb8[_0x4c7b('0x1c')]+_0x450cb8[_0x4c7b('0x1e')];var _0x42f054;if(_0x2342d4>=_0x2f5f35){_0x2342d4=_0x2f5f35;_0x42f054=0xc8;}else{_0x42f054=0xce;}_0x3ed0b2[_0x4c7b('0x1a')](_0x42f054);return _0x3ed0b2[_0x4c7b('0x1f')]('Content-Range',_0x290e79+'-'+_0x2342d4+'/'+_0x2f5f35)[_0x4c7b('0x1b')](_0x135bda);}return null;};}function patchUpdates(_0x1c3971){return function(_0xb1feda){try{jsonpatch[_0x4c7b('0x20')](_0xb1feda,_0x1c3971,!![]);}catch(_0x3a6f4b){return BPromise[_0x4c7b('0x21')](_0x3a6f4b);}return _0xb1feda[_0x4c7b('0x22')]();};}function saveUpdates(_0x30d77a,_0xe2568f){return function(_0x14f5d0){if(_0x14f5d0){return _0x14f5d0['update'](_0x30d77a)['then'](function(_0x8326c8){return _0x8326c8;});}return null;};}function removeEntity(_0x543e52,_0x28347f){return function(_0x4029d9){if(_0x4029d9){return _0x4029d9['destroy']()['then'](function(){_0x543e52['status'](0xcc)[_0x4c7b('0x23')]();});}};}function handleEntityNotFound(_0x9471c1,_0x218cb3){return function(_0x3dd52e){if(!_0x3dd52e){_0x9471c1[_0x4c7b('0x19')](0x194);}return _0x3dd52e;};}function handleError(_0x49059b,_0x350acb){_0x350acb=_0x350acb||0x1f4;return function(_0x19273f){logger[_0x4c7b('0x24')](_0x19273f[_0x4c7b('0x25')]);if(_0x19273f[_0x4c7b('0x26')]){delete _0x19273f[_0x4c7b('0x26')];}_0x49059b['status'](_0x350acb)[_0x4c7b('0x27')](_0x19273f);};}exports[_0x4c7b('0x28')]=function(_0x4e2641,_0x3a678d){var _0x2e5905={},_0x545df2={},_0x416587={'count':0x0,'rows':[]};var _0x5c580e=_['map'](db['Dynamics365Account'][_0x4c7b('0x29')],function(_0x5e4453){return{'name':_0x5e4453[_0x4c7b('0x2a')],'type':_0x5e4453[_0x4c7b('0x2b')][_0x4c7b('0x2c')]};});_0x545df2['model']=_[_0x4c7b('0x2d')](_0x5c580e,_0x4c7b('0x26'));_0x545df2[_0x4c7b('0x2e')]=_[_0x4c7b('0x2f')](_0x4e2641[_0x4c7b('0x2e')]);_0x545df2[_0x4c7b('0x30')]=_['intersection'](_0x545df2[_0x4c7b('0x31')],_0x545df2[_0x4c7b('0x2e')]);_0x2e5905[_0x4c7b('0x32')]=_[_0x4c7b('0x33')](_0x545df2[_0x4c7b('0x31')],qs[_0x4c7b('0x34')](_0x4e2641[_0x4c7b('0x2e')][_0x4c7b('0x34')]));_0x2e5905[_0x4c7b('0x32')]=_0x2e5905[_0x4c7b('0x32')][_0x4c7b('0x35')]?_0x2e5905[_0x4c7b('0x32')]:_0x545df2['model'];if(!_0x4e2641[_0x4c7b('0x2e')][_0x4c7b('0x36')](_0x4c7b('0x37'))){_0x2e5905['limit']=qs[_0x4c7b('0x1e')](_0x4e2641['query']['limit']);_0x2e5905[_0x4c7b('0x1c')]=qs['offset'](_0x4e2641[_0x4c7b('0x2e')][_0x4c7b('0x1c')]);}_0x2e5905[_0x4c7b('0x38')]=qs[_0x4c7b('0x39')](_0x4e2641[_0x4c7b('0x2e')][_0x4c7b('0x39')]);_0x2e5905[_0x4c7b('0x3a')]=qs[_0x4c7b('0x30')](_[_0x4c7b('0x3b')](_0x4e2641['query'],_0x545df2[_0x4c7b('0x30')]),_0x5c580e);if(_0x4e2641[_0x4c7b('0x2e')][_0x4c7b('0x3c')]){_0x2e5905['where']=_[_0x4c7b('0x3d')](_0x2e5905[_0x4c7b('0x3a')],{'$or':_[_0x4c7b('0x2d')](_0x5c580e,function(_0x38a8a8){if(_0x38a8a8['type']!==_0x4c7b('0x3e')){var _0xdf5517={};_0xdf5517[_0x38a8a8[_0x4c7b('0x26')]]={'$like':'%'+_0x4e2641[_0x4c7b('0x2e')][_0x4c7b('0x3c')]+'%'};return _0xdf5517;}})});}_0x2e5905=_[_0x4c7b('0x3d')]({},_0x2e5905,_0x4e2641[_0x4c7b('0x3f')]);var _0xd244c5={'where':_0x2e5905[_0x4c7b('0x3a')]};return db[_0x4c7b('0x40')][_0x4c7b('0x1d')](_0xd244c5)[_0x4c7b('0x41')](function(_0x4be296){_0x416587['count']=_0x4be296;if(_0x4e2641[_0x4c7b('0x2e')][_0x4c7b('0x42')]){_0x2e5905[_0x4c7b('0x43')]=[{'all':!![]}];}return db[_0x4c7b('0x40')][_0x4c7b('0x44')](_0x2e5905);})[_0x4c7b('0x41')](function(_0x520e44){_0x416587[_0x4c7b('0x45')]=_0x520e44;return _0x416587;})[_0x4c7b('0x41')](respondWithFilteredResult(_0x3a678d,_0x2e5905))[_0x4c7b('0x46')](handleError(_0x3a678d,null));};exports['show']=function(_0x4bc810,_0x488e24){var _0x109047={'raw':![],'where':{'id':_0x4bc810[_0x4c7b('0x47')]['id']}},_0x3dcf57={};_0x3dcf57[_0x4c7b('0x31')]=_[_0x4c7b('0x2f')](db[_0x4c7b('0x40')]['rawAttributes']);_0x3dcf57[_0x4c7b('0x2e')]=_[_0x4c7b('0x2f')](_0x4bc810[_0x4c7b('0x2e')]);_0x3dcf57[_0x4c7b('0x30')]=_[_0x4c7b('0x33')](_0x3dcf57[_0x4c7b('0x31')],_0x3dcf57[_0x4c7b('0x2e')]);_0x109047['attributes']=_[_0x4c7b('0x33')](_0x3dcf57[_0x4c7b('0x31')],qs[_0x4c7b('0x34')](_0x4bc810[_0x4c7b('0x2e')][_0x4c7b('0x34')]));_0x109047['attributes']=_0x109047['attributes'][_0x4c7b('0x35')]?_0x109047[_0x4c7b('0x32')]:_0x3dcf57['model'];if(_0x4bc810[_0x4c7b('0x2e')]['includeAll']){_0x109047[_0x4c7b('0x43')]=[{'all':!![]}];}_0x109047=_[_0x4c7b('0x3d')]({},_0x109047,_0x4bc810[_0x4c7b('0x3f')]);return db[_0x4c7b('0x40')][_0x4c7b('0x48')](_0x109047)[_0x4c7b('0x41')](handleEntityNotFound(_0x488e24,null))[_0x4c7b('0x41')](respondWithResult(_0x488e24,null))['catch'](handleError(_0x488e24,null));};exports['create']=function(_0x5959db,_0x429acf){return db[_0x4c7b('0x40')][_0x4c7b('0x49')](_0x5959db[_0x4c7b('0x4a')],{})['then'](respondWithResult(_0x429acf,0xc9))['catch'](handleError(_0x429acf,null));};exports[_0x4c7b('0x4b')]=function(_0x192f3e,_0x28cc07){if(_0x192f3e['body']['id']){delete _0x192f3e[_0x4c7b('0x4a')]['id'];}return db['Dynamics365Account'][_0x4c7b('0x48')]({'where':{'id':_0x192f3e[_0x4c7b('0x47')]['id']}})[_0x4c7b('0x41')](handleEntityNotFound(_0x28cc07,null))[_0x4c7b('0x41')](saveUpdates(_0x192f3e['body'],null))['then'](respondWithResult(_0x28cc07,null))['catch'](handleError(_0x28cc07,null));};exports[_0x4c7b('0x4c')]=function(_0x5c3fa2,_0x1ad96d){return db[_0x4c7b('0x40')][_0x4c7b('0x48')]({'where':{'id':_0x5c3fa2[_0x4c7b('0x47')]['id']}})[_0x4c7b('0x41')](handleEntityNotFound(_0x1ad96d,null))[_0x4c7b('0x41')](removeEntity(_0x1ad96d,null))[_0x4c7b('0x46')](handleError(_0x1ad96d,null));};exports[_0x4c7b('0x4d')]=function(_0x23679d,_0x3e36bb,_0x35872d){var _0x2082b6={};var _0x139836={};var _0x1db45e;var _0x260f2e;return db['Dynamics365Account']['findOne']({'where':{'id':_0x23679d[_0x4c7b('0x47')]['id']}})['then'](handleEntityNotFound(_0x3e36bb,null))['then'](function(_0x2d0558){if(_0x2d0558){_0x1db45e=_0x2d0558;_0x139836[_0x4c7b('0x31')]=_['keys'](db[_0x4c7b('0x4e')]['rawAttributes']);_0x139836['query']=_[_0x4c7b('0x2f')](_0x23679d[_0x4c7b('0x2e')]);_0x139836[_0x4c7b('0x30')]=_[_0x4c7b('0x33')](_0x139836[_0x4c7b('0x31')],_0x139836['query']);_0x2082b6[_0x4c7b('0x32')]=_[_0x4c7b('0x33')](_0x139836[_0x4c7b('0x31')],qs[_0x4c7b('0x34')](_0x23679d[_0x4c7b('0x2e')][_0x4c7b('0x34')]));_0x2082b6[_0x4c7b('0x32')]=_0x2082b6[_0x4c7b('0x32')][_0x4c7b('0x35')]?_0x2082b6[_0x4c7b('0x32')]:_0x139836[_0x4c7b('0x31')];_0x2082b6[_0x4c7b('0x38')]=qs[_0x4c7b('0x39')](_0x23679d['query'][_0x4c7b('0x39')]);_0x2082b6[_0x4c7b('0x3a')]=qs[_0x4c7b('0x30')](_[_0x4c7b('0x3b')](_0x23679d[_0x4c7b('0x2e')],_0x139836[_0x4c7b('0x30')]));if(_0x23679d['query'][_0x4c7b('0x3c')]){_0x2082b6[_0x4c7b('0x3a')]=_[_0x4c7b('0x3d')](_0x2082b6['where'],{'$or':_[_0x4c7b('0x2d')](_0x2082b6['attributes'],function(_0x2ac504){var _0x51d8b6={};_0x51d8b6[_0x2ac504]={'$like':'%'+_0x23679d[_0x4c7b('0x2e')][_0x4c7b('0x3c')]+'%'};return _0x51d8b6;})});}_0x2082b6=_['merge']({},_0x2082b6,_0x23679d[_0x4c7b('0x3f')]);return _0x1db45e[_0x4c7b('0x4d')](_0x2082b6);}})[_0x4c7b('0x41')](function(_0xf19db3){if(_0xf19db3){_0x260f2e=_0xf19db3[_0x4c7b('0x35')];if(!_0x23679d[_0x4c7b('0x2e')][_0x4c7b('0x36')](_0x4c7b('0x37'))){_0x2082b6[_0x4c7b('0x1e')]=qs[_0x4c7b('0x1e')](_0x23679d['query'][_0x4c7b('0x1e')]);_0x2082b6[_0x4c7b('0x1c')]=qs[_0x4c7b('0x1c')](_0x23679d[_0x4c7b('0x2e')][_0x4c7b('0x1c')]);}return _0x1db45e[_0x4c7b('0x4d')](_0x2082b6);}})[_0x4c7b('0x41')](function(_0x478db9){if(_0x478db9){return _0x478db9?{'count':_0x260f2e,'rows':_0x478db9}:null;}})['then'](respondWithResult(_0x3e36bb,null))[_0x4c7b('0x46')](handleError(_0x3e36bb,null));};exports[_0x4c7b('0x4f')]=function(_0x475263,_0x2dc4df,_0x41190a){if(_0x475263['body']['id']){delete _0x475263[_0x4c7b('0x4a')]['id'];}return db[_0x4c7b('0x40')][_0x4c7b('0x50')]({'where':{'id':_0x475263['params']['id']}})[_0x4c7b('0x41')](handleEntityNotFound(_0x2dc4df,null))[_0x4c7b('0x41')](function(_0x54c2b2){if(_0x54c2b2){_0x475263[_0x4c7b('0x4a')][_0x4c7b('0x51')]=_0x54c2b2['id'];_0x475263['body'][_0x4c7b('0x52')]=integrations['getSubjects'](_0x475263[_0x4c7b('0x4a')]['channel'],_0x475263[_0x4c7b('0x4a')][_0x4c7b('0x2b')]);_0x475263['body'][_0x4c7b('0x53')]=integrations[_0x4c7b('0x54')](_0x475263['body']['channel'],_0x475263['body'][_0x4c7b('0x2b')]);return db['Dynamics365Configuration'][_0x4c7b('0x49')](_0x475263[_0x4c7b('0x4a')],{'include':[{'model':db['Dynamics365Field'],'as':'Subjects'},{'model':db[_0x4c7b('0x55')],'as':_0x4c7b('0x53')}]});}return null;})['then'](respondWithResult(_0x2dc4df,null))[_0x4c7b('0x46')](handleError(_0x2dc4df,null));};exports[_0x4c7b('0x56')]=function(_0x3845f6,_0x2333ee,_0x57772d){var _0x5beda9=_0x3845f6[_0x4c7b('0x2e')][_0x4c7b('0x57')];var _0xc1ce1f=_0x5beda9===_0x4c7b('0x58')?_0x4c7b('0x59'):'PhoneCall';var _0x284e87='';var _0x5bcfb3='';var _0x3ded46='';var _0x39369c='';var _0x3df6d3='';var _0x25d7ec='';var _0x170578='';var _0xf0f7ae='';var _0x216ffd=[_0x4c7b('0x5a'),'description',_0x4c7b('0x5b'),_0x4c7b('0x5c'),_0x4c7b('0x5d'),_0x4c7b('0x5e'),_0x4c7b('0x5f'),_0x4c7b('0x60'),_0x4c7b('0x61'),_0x4c7b('0x62')];var _0x45a65f=[_0x4c7b('0x63'),_0x4c7b('0x64'),_0x4c7b('0x65'),'billedserviceunits','contactidname',_0x4c7b('0x66'),'contractdetailidname','contractidname',_0x4c7b('0x67'),_0x4c7b('0x68'),_0x4c7b('0x69'),_0x4c7b('0x6a'),_0x4c7b('0x6b'),'createdonbehalfbyname','createdonbehalfbyyominame','customeridname',_0x4c7b('0x6c'),'customeridyominame','emailaddress',_0x4c7b('0x6d'),_0x4c7b('0x6e'),'entityimage_url',_0x4c7b('0x6f'),_0x4c7b('0x70'),'firstresponsebykpiidname','followupby',_0x4c7b('0x71'),_0x4c7b('0x72'),_0x4c7b('0x73'),_0x4c7b('0x74'),_0x4c7b('0x75'),_0x4c7b('0x76'),'modifiedbyexternalpartyyominame',_0x4c7b('0x77'),_0x4c7b('0x78'),_0x4c7b('0x79'),_0x4c7b('0x7a'),_0x4c7b('0x7b'),_0x4c7b('0x7c'),_0x4c7b('0x7d'),_0x4c7b('0x7e'),_0x4c7b('0x7f'),_0x4c7b('0x80'),_0x4c7b('0x81'),_0x4c7b('0x82'),'owneridyominame',_0x4c7b('0x83'),_0x4c7b('0x84'),_0x4c7b('0x85'),'prioritycodename',_0x4c7b('0x86'),_0x4c7b('0x87'),_0x4c7b('0x88'),_0x4c7b('0x89'),_0x4c7b('0x8a'),_0x4c7b('0x8b'),_0x4c7b('0x8c'),_0x4c7b('0x8d'),_0x4c7b('0x8e'),_0x4c7b('0x8f'),'socialprofileidname',_0x4c7b('0x90'),_0x4c7b('0x91'),_0x4c7b('0x92'),'ticketnumber',_0x4c7b('0x93'),_0x4c7b('0x94'),_0x4c7b('0x95'),_0x4c7b('0x96'),'versionnumber'];var _0x2c1aa9=_0x216ffd[_0x4c7b('0x97')](_0x45a65f);return db[_0x4c7b('0x40')]['findOne']({'where':{'id':_0x3845f6[_0x4c7b('0x47')]['id']},'attributes':['id',_0x4c7b('0x98'),_0x4c7b('0x99'),_0x4c7b('0x9a'),'tenantId',_0x4c7b('0x9b'),'clientSecret']})[_0x4c7b('0x41')](handleEntityNotFound(_0x2333ee,null))[_0x4c7b('0x41')](function(_0x2717c2){if(_0x2717c2){_0xf0f7ae=_0x2717c2[_0x4c7b('0x9a')];var _0x4664dd=_0xf0f7ae[_0x4c7b('0x9c')](-0x1);if(_0x4664dd==='/'){_0xf0f7ae=_0xf0f7ae[_0x4c7b('0x9d')](0x0,_0xf0f7ae[_0x4c7b('0x9e')](_0x4664dd));}_0x170578=util[_0x4c7b('0x9f')](_0x4c7b('0xa0'),_0xf0f7ae);var _0x30f1b6={'method':'POST','uri':_0x4c7b('0xa1')+_0x2717c2[_0x4c7b('0xa2')]+'/oauth2/token','form':{'client_id':_0x2717c2[_0x4c7b('0x9b')],'resource':_0xf0f7ae,'username':_0x2717c2[_0x4c7b('0x98')],'password':_0x2717c2[_0x4c7b('0x99')],'grant_type':_0x4c7b('0x99'),'client_secret':_0x2717c2['clientSecret']},'json':!![]};return rp(_0x30f1b6);}})[_0x4c7b('0x41')](function(_0x307a48){_0x25d7ec=_0x307a48[_0x4c7b('0xa3')];var _0x494a8f={'method':_0x4c7b('0xa4'),'uri':encodeURI(_0x170578+_0x4c7b('0xa5')+_0xc1ce1f+'\x27'),'headers':{'Authorization':'Bearer\x20'+_0x25d7ec,'If-None-Match':null,'OData-Version':_0x4c7b('0xa6')},'json':!![]};return rp(_0x494a8f);})[_0x4c7b('0x41')](function(_0x2712f4){var _0x11ce2a=_0x2712f4[_0x4c7b('0xa7')][0x0];var _0x33c86d=_0x11ce2a[_0x4c7b('0xa8')];var _0x27d372={'method':_0x4c7b('0xa4'),'uri':_0x170578+'EntityDefinitions('+_0x33c86d+')?$select=LogicalName&$expand=Attributes($select=LogicalName)','headers':{'Authorization':'Bearer\x20'+_0x25d7ec,'If-None-Match':null,'OData-Version':_0x4c7b('0xa6')},'json':!![]};return rp(_0x27d372);})[_0x4c7b('0x41')](function(_0xa9ac59){_0x284e87=_0xa9ac59;_0x5bcfb3=_0x284e87[_0x4c7b('0xa9')];_0x5bcfb3=_[_0x4c7b('0xaa')](_0x5bcfb3,function(_0x3833a3){return!_0x2c1aa9[_0x4c7b('0xab')](_0x3833a3[_0x4c7b('0xac')]);});var _0x4a98b9=[];var _0x5d41c5=[];_0x5bcfb3[_0x4c7b('0xad')](function(_0x4c1864){if(_0x4c1864['@odata.type']){var _0x537074=_0x4c1864[_0x4c7b('0xae')]['substring'](_0x4c1864[_0x4c7b('0xae')]['lastIndexOf']('.')+0x1);if(_0x537074===_0x4c7b('0xaf')){_0x4a98b9[_0x4c7b('0xb0')](getSelectList(_0x170578,_0x5beda9,_0x5d41c5,_0x284e87[_0x4c7b('0xa8')],_0x4c1864[_0x4c7b('0xa8')],_0x25d7ec));}}});return Promise[_0x4c7b('0xb1')](_0x4a98b9);})[_0x4c7b('0x41')](function(_0x5b81aa){_0x3ded46=_0x5b81aa[0x0];var _0xadbdd0=[];var _0x206962=[];_0x5bcfb3[_0x4c7b('0xad')](function(_0x32be2f){if(!_['isNil'](_0x32be2f[_0x4c7b('0xae')])){var _0x816fb4=_0x32be2f['@odata.type'][_0x4c7b('0x9d')](_0x32be2f[_0x4c7b('0xae')]['lastIndexOf']('.')+0x1);if(_0x816fb4===_0x4c7b('0xb2')){_0xadbdd0[_0x4c7b('0xb0')](getBooleanList(_0x170578,_0x5beda9,_0x206962,_0x284e87[_0x4c7b('0xa8')],_0x32be2f[_0x4c7b('0xa8')],_0x25d7ec));}}});return Promise[_0x4c7b('0xb1')](_0xadbdd0);})['then'](function(_0x4f91c8){_0x39369c=_0x4f91c8[0x0];var _0xd4bbcc=[];var _0x4881d1=[];_0x5bcfb3['forEach'](function(_0x4596c8){if(_0x4596c8[_0x4c7b('0xae')]){var _0x19dbf7=_0x4596c8['@odata.type'][_0x4c7b('0x9d')](_0x4596c8['@odata.type']['lastIndexOf']('.')+0x1);if(_0x19dbf7===_0x4c7b('0xb3')||_0x19dbf7===_0x4c7b('0xb4')||_0x19dbf7===_0x4c7b('0xb5')||_0x19dbf7==='IntegerAttributeMetadata'||_0x19dbf7==='MemoAttributeMetadata'||_0x19dbf7==='DateTimeAttributeMetadata'||_0x19dbf7==='StatusAttributeMetadata'||_0x19dbf7==='EntityNameAttributeMetadata'||_0x19dbf7===_0x4c7b('0xb6')||_0x19dbf7==='DecimalAttributeMetadata'){_0xd4bbcc[_0x4c7b('0xb0')](getInputList(_0x170578,_0x5beda9,_0x19dbf7,_0x4881d1,_0x284e87[_0x4c7b('0xa8')],_0x4596c8[_0x4c7b('0xa8')],_0x25d7ec));}}});return Promise[_0x4c7b('0xb1')](_0xd4bbcc);})[_0x4c7b('0x41')](function(_0x1bb3c0){_0x3df6d3=_0x1bb3c0[0x0];var _0x4e644f=_0x3ded46[_0x4c7b('0x97')](_0x39369c)[_0x4c7b('0x97')](_0x3df6d3);var _0x41e2b0={'count':_0x4e644f[_0x4c7b('0x35')],'rows':_0x4e644f};return _0x41e2b0;})[_0x4c7b('0x41')](respondWithResult(_0x2333ee,null))['catch'](function(_0x53adef){var _0x24cf06=_0x3845f6['query'][_0x4c7b('0xb7')]?0x1f4:_0x53adef[_0x4c7b('0xb8')]||0x1f4;logger[_0x4c7b('0x24')](_0x53adef[_0x4c7b('0x25')]);delete _0x53adef[_0x4c7b('0x26')];if(_0x24cf06===0x191){_0x24cf06=0x190;}_0x2333ee[_0x4c7b('0x1a')](_0x24cf06)[_0x4c7b('0x27')](_0x3845f6[_0x4c7b('0x2e')]['test']?{'message':_0x4c7b('0xb9'),'statusCode':_0x53adef[_0x4c7b('0xb8')]}:_0x53adef);});};function getSelectList(_0x2010d9,_0xe495a9,_0x2ac711,_0x3480ee,_0x260d09,_0x502cfa){var _0x278a58={'method':_0x4c7b('0xa4'),'uri':_0x2010d9+_0x4c7b('0xba')+_0x3480ee+_0x4c7b('0xbb')+_0x260d09+_0x4c7b('0xbc')+_0x4c7b('0xbd'),'headers':{'Authorization':_0x4c7b('0xbe')+_0x502cfa,'If-None-Match':null,'OData-Version':_0x4c7b('0xa6')},'json':!![]};return rp(_0x278a58)[_0x4c7b('0x41')](function(_0x4a224a){var _0x5b7329=[];var _0x278e99=_0x4a224a[_0x4c7b('0xbf')][_0x4c7b('0xc0')];_0x278e99[_0x4c7b('0xad')](function(_0x2e028c){_0x5b7329[_0x4c7b('0xb0')]({'name':_0x2e028c[_0x4c7b('0xc1')][_0x4c7b('0xc2')][_0x4c7b('0xc1')],'value':String(_0x2e028c[_0x4c7b('0xc3')])});});var _0x2fb6fb={'id':_0xe495a9+'_'+_0x4a224a[_0x4c7b('0xac')],'name':_0x4a224a[_0x4c7b('0xc4')][_0x4c7b('0xc2')][_0x4c7b('0xc1')],'custom':![],'options':_0x5b7329};_0x2ac711[_0x4c7b('0xb0')](_0x2fb6fb);return _0x2ac711;});}function getBooleanList(_0x2bb654,_0x9b579d,_0x23c78c,_0x3948de,_0x4d4741,_0x109258){var _0x289c5d={'method':_0x4c7b('0xa4'),'uri':_0x2bb654+_0x4c7b('0xba')+_0x3948de+_0x4c7b('0xbb')+_0x4d4741+')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','headers':{'Authorization':_0x4c7b('0xbe')+_0x109258,'If-None-Match':null,'OData-Version':_0x4c7b('0xa6')},'json':!![]};return rp(_0x289c5d)[_0x4c7b('0x41')](function(_0x33d9cc){var _0x4ffb6b=[];_0x4ffb6b[_0x4c7b('0xb0')]({'name':_0x33d9cc[_0x4c7b('0xbf')]['TrueOption']['Label'][_0x4c7b('0xc2')]['Label'],'value':'true'},{'name':_0x33d9cc[_0x4c7b('0xbf')]['FalseOption']['Label'][_0x4c7b('0xc2')][_0x4c7b('0xc1')],'value':_0x4c7b('0xc5')});var _0x24c327={'id':_0x9b579d+'_'+_0x33d9cc[_0x4c7b('0xac')],'name':_0x33d9cc['DisplayName']['UserLocalizedLabel']['Label'],'custom':![],'options':_0x4ffb6b};_0x23c78c['push'](_0x24c327);return _0x23c78c;});}function getInputList(_0x3c36cc,_0x4b345c,_0x36658c,_0x387bdc,_0xf950f4,_0x125196,_0x3e1114){var _0x22e6c6={'method':_0x4c7b('0xa4'),'uri':_0x3c36cc+'EntityDefinitions('+_0xf950f4+_0x4c7b('0xbb')+_0x125196+_0x4c7b('0xc6')+_0x36658c+_0x4c7b('0xc7'),'headers':{'Authorization':_0x4c7b('0xbe')+_0x3e1114,'If-None-Match':null,'OData-Version':_0x4c7b('0xa6')},'json':!![]};return rp(_0x22e6c6)['then'](function(_0x185c13){var _0x20e93d={'id':_0x4b345c+'_'+_0x185c13[_0x4c7b('0xac')],'name':_0x185c13['DisplayName']['UserLocalizedLabel']?_0x185c13[_0x4c7b('0xc4')][_0x4c7b('0xc2')][_0x4c7b('0xc1')]:_0x185c13[_0x4c7b('0xac')],'custom':![],'options':[]};_0x387bdc['push'](_0x20e93d);return _0x387bdc;});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.model.js b/server/api/intDynamics365Account/intDynamics365Account.model.js index 33c81bf..bb60421 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 _0xbaf0=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration','exports','define','Dynamics365Account','util'];(function(_0x46cbf3,_0x7bd780){var _0x1a90e0=function(_0x4d50d0){while(--_0x4d50d0){_0x46cbf3['push'](_0x46cbf3['shift']());}};_0x1a90e0(++_0x7bd780);}(_0xbaf0,0x12a));var _0x0baf=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xbaf0[_0x6131cd];return _0x47e916;};'use strict';var _=require('lodash');var util=require(_0x0baf('0x0'));var logger=require(_0x0baf('0x1'))(_0x0baf('0x2'));var moment=require(_0x0baf('0x3'));var BPromise=require(_0x0baf('0x4'));var rp=require(_0x0baf('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var attributes=require(_0x0baf('0x8'));var integrations=require(_0x0baf('0x9'));module[_0x0baf('0xa')]=function(_0x335e24,_0x1a10b1){return _0x335e24[_0x0baf('0xb')](_0x0baf('0xc'),attributes,{'tableName':'int_dynamics365_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd8b0=['exports','Dynamics365Account','int_dynamics365_accounts','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x31e2a8,_0x53b684){var _0x1c8fb2=function(_0x333dbd){while(--_0x333dbd){_0x31e2a8['push'](_0x31e2a8['shift']());}};_0x1c8fb2(++_0x53b684);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x0d8b('0x2'));var rp=require(_0x0d8b('0x3'));var fs=require('fs');var path=require(_0x0d8b('0x4'));var rimraf=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var attributes=require('./intDynamics365Account.attributes');var integrations=require('../../components/integrations/configuration');module[_0x0d8b('0x7')]=function(_0x227c63,_0x39f43a){return _0x227c63['define'](_0x0d8b('0x8'),attributes,{'tableName':_0x0d8b('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.rpc.js b/server/api/intDynamics365Account/intDynamics365Account.rpc.js index 95564c1..0638709 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 _0xad10=['find','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','Dynamics365Account,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','catch','GetDynamics365Account','options','where','attributes','limit','map','include','model','then','ShowDynamics365Account','Dynamics365Account'];(function(_0x339f13,_0x469a7a){var _0x3cd04c=function(_0x5a3fff){while(--_0x5a3fff){_0x339f13['push'](_0x339f13['shift']());}};_0x3cd04c(++_0x469a7a);}(_0xad10,0x92));var _0x0ad1=function(_0x2c77f8,_0x3dbd4c){_0x2c77f8=_0x2c77f8-0x0;var _0x7b56af=_0xad10[_0x2c77f8];return _0x7b56af;};'use strict';var _=require(_0x0ad1('0x0'));var util=require(_0x0ad1('0x1'));var moment=require(_0x0ad1('0x2'));var BPromise=require(_0x0ad1('0x3'));var rs=require(_0x0ad1('0x4'));var fs=require('fs');var Redis=require(_0x0ad1('0x5'));var db=require(_0x0ad1('0x6'))['db'];var utils=require(_0x0ad1('0x7'));var logger=require(_0x0ad1('0x8'))('rpc');var config=require(_0x0ad1('0x9'));var jayson=require(_0x0ad1('0xa'));var client=jayson[_0x0ad1('0xb')][_0x0ad1('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x22275f,_0x39f4bb,_0x8bc98){return new BPromise(function(_0x5bb056,_0x3e73da){return client[_0x0ad1('0xd')](_0x22275f,_0x8bc98)['then'](function(_0xaf20e6){logger[_0x0ad1('0xe')](_0x0ad1('0xf'),_0x39f4bb,'request\x20sent');logger[_0x0ad1('0x10')]('Dynamics365Account,\x20%s,\x20%s,\x20%s',_0x39f4bb,_0x0ad1('0x11'),JSON[_0x0ad1('0x12')](_0xaf20e6));if(_0xaf20e6[_0x0ad1('0x13')]){if(_0xaf20e6[_0x0ad1('0x13')][_0x0ad1('0x14')]===0x1f4){logger[_0x0ad1('0x13')]('Dynamics365Account,\x20%s,\x20%s',_0x39f4bb,_0xaf20e6[_0x0ad1('0x13')][_0x0ad1('0x15')]);return _0x3e73da(_0xaf20e6['error']['message']);}logger[_0x0ad1('0x13')](_0x0ad1('0xf'),_0x39f4bb,_0xaf20e6['error']['message']);return _0x5bb056(_0xaf20e6[_0x0ad1('0x13')][_0x0ad1('0x15')]);}else{logger[_0x0ad1('0xe')](_0x0ad1('0xf'),_0x39f4bb,_0x0ad1('0x11'));_0x5bb056(_0xaf20e6['result']['message']);}})[_0x0ad1('0x16')](function(_0x398033){logger[_0x0ad1('0x13')](_0x0ad1('0xf'),_0x39f4bb,_0x398033);_0x3e73da(_0x398033);});});}exports[_0x0ad1('0x17')]=function(_0x7dec0){var _0x117c44=this;return new Promise(function(_0x416dd6,_0x280eae){return db['Dynamics365Account']['findAll']({'raw':_0x7dec0[_0x0ad1('0x18')]?_0x7dec0['options']['raw']===undefined?!![]:![]:!![],'where':_0x7dec0['options']?_0x7dec0[_0x0ad1('0x18')][_0x0ad1('0x19')]||null:null,'attributes':_0x7dec0[_0x0ad1('0x18')]?_0x7dec0['options'][_0x0ad1('0x1a')]||null:null,'limit':_0x7dec0[_0x0ad1('0x18')]?_0x7dec0[_0x0ad1('0x18')][_0x0ad1('0x1b')]||null:null,'include':_0x7dec0['options']?_0x7dec0['options']['include']?_[_0x0ad1('0x1c')](_0x7dec0[_0x0ad1('0x18')][_0x0ad1('0x1d')],function(_0x27b387){return{'model':db[_0x27b387[_0x0ad1('0x1e')]],'as':_0x27b387['as'],'attributes':_0x27b387[_0x0ad1('0x1a')],'include':_0x27b387[_0x0ad1('0x1d')]?_[_0x0ad1('0x1c')](_0x27b387[_0x0ad1('0x1d')],function(_0x3de887){return{'model':db[_0x3de887['model']],'as':_0x3de887['as'],'attributes':_0x3de887[_0x0ad1('0x1a')],'include':_0x3de887[_0x0ad1('0x1d')]?_[_0x0ad1('0x1c')](_0x3de887[_0x0ad1('0x1d')],function(_0x4c051c){return{'model':db[_0x4c051c[_0x0ad1('0x1e')]],'as':_0x4c051c['as'],'attributes':_0x4c051c['attributes']};}):[]};}):[]};}):[]:[]})[_0x0ad1('0x1f')](function(_0x109a2e){logger[_0x0ad1('0xe')]('GetDynamics365Account',_0x7dec0);logger['debug']('GetDynamics365Account',_0x7dec0,JSON[_0x0ad1('0x12')](_0x109a2e));_0x416dd6(_0x109a2e);})[_0x0ad1('0x16')](function(_0x3d98f8){logger[_0x0ad1('0x13')]('GetDynamics365Account',_0x3d98f8[_0x0ad1('0x15')],_0x7dec0);_0x280eae(_0x117c44['error'](0x1f4,_0x3d98f8[_0x0ad1('0x15')]));});});};exports[_0x0ad1('0x20')]=function(_0x550715){var _0x18b623=this;return new Promise(function(_0x35c6ae,_0x40f4b7){return db[_0x0ad1('0x21')][_0x0ad1('0x22')]({'raw':_0x550715[_0x0ad1('0x18')]?_0x550715['options'][_0x0ad1('0x23')]===undefined?!![]:![]:!![],'where':_0x550715[_0x0ad1('0x18')]?_0x550715[_0x0ad1('0x18')][_0x0ad1('0x19')]||null:null,'attributes':_0x550715[_0x0ad1('0x18')]?_0x550715[_0x0ad1('0x18')][_0x0ad1('0x1a')]||null:null,'include':_0x550715[_0x0ad1('0x18')]?_0x550715[_0x0ad1('0x18')][_0x0ad1('0x1d')]?_[_0x0ad1('0x1c')](_0x550715[_0x0ad1('0x18')][_0x0ad1('0x1d')],function(_0xe5f747){return{'model':db[_0xe5f747[_0x0ad1('0x1e')]],'as':_0xe5f747['as'],'attributes':_0xe5f747['attributes'],'include':_0xe5f747[_0x0ad1('0x1d')]?_[_0x0ad1('0x1c')](_0xe5f747['include'],function(_0x55217d){return{'model':db[_0x55217d[_0x0ad1('0x1e')]],'as':_0x55217d['as'],'attributes':_0x55217d[_0x0ad1('0x1a')],'include':_0x55217d[_0x0ad1('0x1d')]?_[_0x0ad1('0x1c')](_0x55217d[_0x0ad1('0x1d')],function(_0xb67190){return{'model':db[_0xb67190[_0x0ad1('0x1e')]],'as':_0xb67190['as'],'attributes':_0xb67190[_0x0ad1('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x0ad1('0x1f')](function(_0x479bbf){logger[_0x0ad1('0xe')]('ShowDynamics365Account',_0x550715);logger[_0x0ad1('0x10')](_0x0ad1('0x20'),_0x550715,JSON[_0x0ad1('0x12')](_0x479bbf));_0x35c6ae(_0x479bbf);})[_0x0ad1('0x16')](function(_0x343ff2){logger[_0x0ad1('0x13')](_0x0ad1('0x20'),_0x343ff2[_0x0ad1('0x15')],_0x550715);_0x40f4b7(_0x18b623['error'](0x1f4,_0x343ff2[_0x0ad1('0x15')]));});});}; \ No newline at end of file +var _0x9a0c=['Dynamics365Account,\x20%s,\x20%s','Dynamics365Account,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','result','GetDynamics365Account','Dynamics365Account','findAll','options','raw','where','attributes','include','map','model','catch','ShowDynamics365Account','debug','lodash','util','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x3a5042,_0x3476a7){var _0x104ba2=function(_0x277b29){while(--_0x277b29){_0x3a5042['push'](_0x3a5042['shift']());}};_0x104ba2(++_0x3476a7);}(_0x9a0c,0x173));var _0xc9a0=function(_0x12dec1,_0x4769a8){_0x12dec1=_0x12dec1-0x0;var _0x402464=_0x9a0c[_0x12dec1];return _0x402464;};'use strict';var _=require(_0xc9a0('0x0'));var util=require(_0xc9a0('0x1'));var moment=require('moment');var BPromise=require(_0xc9a0('0x2'));var rs=require(_0xc9a0('0x3'));var fs=require('fs');var Redis=require(_0xc9a0('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xc9a0('0x5'));var logger=require('../../config/logger')(_0xc9a0('0x6'));var config=require(_0xc9a0('0x7'));var jayson=require(_0xc9a0('0x8'));var client=jayson[_0xc9a0('0x9')][_0xc9a0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4ce491,_0x3560e3,_0x5c68cf){return new BPromise(function(_0xf8cc52,_0x473ba0){return client[_0xc9a0('0xb')](_0x4ce491,_0x5c68cf)[_0xc9a0('0xc')](function(_0x178b74){logger[_0xc9a0('0xd')](_0xc9a0('0xe'),_0x3560e3,'request\x20sent');logger['debug'](_0xc9a0('0xf'),_0x3560e3,_0xc9a0('0x10'),JSON[_0xc9a0('0x11')](_0x178b74));if(_0x178b74['error']){if(_0x178b74['error'][_0xc9a0('0x12')]===0x1f4){logger['error'](_0xc9a0('0xe'),_0x3560e3,_0x178b74[_0xc9a0('0x13')][_0xc9a0('0x14')]);return _0x473ba0(_0x178b74[_0xc9a0('0x13')][_0xc9a0('0x14')]);}logger[_0xc9a0('0x13')](_0xc9a0('0xe'),_0x3560e3,_0x178b74[_0xc9a0('0x13')][_0xc9a0('0x14')]);return _0xf8cc52(_0x178b74[_0xc9a0('0x13')][_0xc9a0('0x14')]);}else{logger[_0xc9a0('0xd')]('Dynamics365Account,\x20%s,\x20%s',_0x3560e3,'request\x20sent');_0xf8cc52(_0x178b74[_0xc9a0('0x15')][_0xc9a0('0x14')]);}})['catch'](function(_0x548d2d){logger[_0xc9a0('0x13')](_0xc9a0('0xe'),_0x3560e3,_0x548d2d);_0x473ba0(_0x548d2d);});});}exports[_0xc9a0('0x16')]=function(_0x5a24ee){var _0x50895d=this;return new Promise(function(_0x3fb070,_0x46fc61){return db[_0xc9a0('0x17')][_0xc9a0('0x18')]({'raw':_0x5a24ee[_0xc9a0('0x19')]?_0x5a24ee[_0xc9a0('0x19')][_0xc9a0('0x1a')]===undefined?!![]:![]:!![],'where':_0x5a24ee[_0xc9a0('0x19')]?_0x5a24ee['options'][_0xc9a0('0x1b')]||null:null,'attributes':_0x5a24ee[_0xc9a0('0x19')]?_0x5a24ee[_0xc9a0('0x19')][_0xc9a0('0x1c')]||null:null,'limit':_0x5a24ee[_0xc9a0('0x19')]?_0x5a24ee['options']['limit']||null:null,'include':_0x5a24ee[_0xc9a0('0x19')]?_0x5a24ee[_0xc9a0('0x19')][_0xc9a0('0x1d')]?_[_0xc9a0('0x1e')](_0x5a24ee[_0xc9a0('0x19')]['include'],function(_0x1f60e1){return{'model':db[_0x1f60e1[_0xc9a0('0x1f')]],'as':_0x1f60e1['as'],'attributes':_0x1f60e1[_0xc9a0('0x1c')],'include':_0x1f60e1['include']?_['map'](_0x1f60e1[_0xc9a0('0x1d')],function(_0x1c4230){return{'model':db[_0x1c4230[_0xc9a0('0x1f')]],'as':_0x1c4230['as'],'attributes':_0x1c4230[_0xc9a0('0x1c')],'include':_0x1c4230[_0xc9a0('0x1d')]?_[_0xc9a0('0x1e')](_0x1c4230[_0xc9a0('0x1d')],function(_0x4f40d1){return{'model':db[_0x4f40d1['model']],'as':_0x4f40d1['as'],'attributes':_0x4f40d1[_0xc9a0('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xc9a0('0xc')](function(_0x5dc075){logger['info'](_0xc9a0('0x16'),_0x5a24ee);logger['debug']('GetDynamics365Account',_0x5a24ee,JSON['stringify'](_0x5dc075));_0x3fb070(_0x5dc075);})[_0xc9a0('0x20')](function(_0x2754d4){logger[_0xc9a0('0x13')]('GetDynamics365Account',_0x2754d4['message'],_0x5a24ee);_0x46fc61(_0x50895d[_0xc9a0('0x13')](0x1f4,_0x2754d4[_0xc9a0('0x14')]));});});};exports[_0xc9a0('0x21')]=function(_0x4e1296){var _0x11783e=this;return new Promise(function(_0x1d183e,_0x149848){return db['Dynamics365Account']['find']({'raw':_0x4e1296[_0xc9a0('0x19')]?_0x4e1296[_0xc9a0('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x4e1296[_0xc9a0('0x19')]?_0x4e1296[_0xc9a0('0x19')][_0xc9a0('0x1b')]||null:null,'attributes':_0x4e1296['options']?_0x4e1296[_0xc9a0('0x19')][_0xc9a0('0x1c')]||null:null,'include':_0x4e1296[_0xc9a0('0x19')]?_0x4e1296[_0xc9a0('0x19')][_0xc9a0('0x1d')]?_[_0xc9a0('0x1e')](_0x4e1296['options'][_0xc9a0('0x1d')],function(_0x15f187){return{'model':db[_0x15f187[_0xc9a0('0x1f')]],'as':_0x15f187['as'],'attributes':_0x15f187['attributes'],'include':_0x15f187['include']?_[_0xc9a0('0x1e')](_0x15f187[_0xc9a0('0x1d')],function(_0x3c08aa){return{'model':db[_0x3c08aa[_0xc9a0('0x1f')]],'as':_0x3c08aa['as'],'attributes':_0x3c08aa['attributes'],'include':_0x3c08aa[_0xc9a0('0x1d')]?_[_0xc9a0('0x1e')](_0x3c08aa[_0xc9a0('0x1d')],function(_0x119ab5){return{'model':db[_0x119ab5['model']],'as':_0x119ab5['as'],'attributes':_0x119ab5['attributes']};}):[]};}):[]};}):[]:[]})[_0xc9a0('0xc')](function(_0x5e6dd2){logger[_0xc9a0('0xd')](_0xc9a0('0x21'),_0x4e1296);logger[_0xc9a0('0x22')](_0xc9a0('0x21'),_0x4e1296,JSON[_0xc9a0('0x11')](_0x5e6dd2));_0x1d183e(_0x5e6dd2);})[_0xc9a0('0x20')](function(_0x82868){logger[_0xc9a0('0x13')](_0xc9a0('0x21'),_0x82868[_0xc9a0('0x14')],_0x4e1296);_0x149848(_0x11783e[_0xc9a0('0x13')](0x1f4,_0x82868[_0xc9a0('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index 9035719..f1b2359 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 _0x9ea8=['/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','update','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','isAuthenticated','index','get','/:id','/:id/fields','getFields'];(function(_0x46cbef,_0x2bc8e5){var _0x49e99d=function(_0x474bb5){while(--_0x474bb5){_0x46cbef['push'](_0x46cbef['shift']());}};_0x49e99d(++_0x2bc8e5);}(_0x9ea8,0x147));var _0x89ea=function(_0x5b80d5,_0x288493){_0x5b80d5=_0x5b80d5-0x0;var _0x4935eb=_0x9ea8[_0x5b80d5];return _0x4935eb;};'use strict';var multer=require('multer');var util=require(_0x89ea('0x0'));var path=require(_0x89ea('0x1'));var timeout=require(_0x89ea('0x2'));var express=require(_0x89ea('0x3'));var router=express[_0x89ea('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x89ea('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x89ea('0x6'));var controller=require('./intDynamics365Configuration.controller');router['get']('/',auth[_0x89ea('0x7')](),controller[_0x89ea('0x8')]);router[_0x89ea('0x9')](_0x89ea('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x89ea('0x9')](_0x89ea('0xb'),auth[_0x89ea('0x7')](),controller[_0x89ea('0xc')]);router[_0x89ea('0x9')](_0x89ea('0xd'),auth[_0x89ea('0x7')](),controller[_0x89ea('0xe')]);router[_0x89ea('0x9')](_0x89ea('0xf'),auth[_0x89ea('0x7')](),controller[_0x89ea('0x10')]);router[_0x89ea('0x11')]('/',auth[_0x89ea('0x7')](),controller[_0x89ea('0x12')]);router['put'](_0x89ea('0xa'),auth[_0x89ea('0x7')](),controller[_0x89ea('0x13')]);router['delete'](_0x89ea('0xa'),auth[_0x89ea('0x7')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xd5fc=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','isAuthenticated','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put','update','delete','/:id','exports','multer','express'];(function(_0x21dd14,_0x23fbef){var _0x4bb93b=function(_0x22762d){while(--_0x22762d){_0x21dd14['push'](_0x21dd14['shift']());}};_0x4bb93b(++_0x23fbef);}(_0xd5fc,0xae));var _0xcd5f=function(_0x22ff2d,_0x936ca6){_0x22ff2d=_0x22ff2d-0x0;var _0xc80ff5=_0xd5fc[_0x22ff2d];return _0xc80ff5;};'use strict';var multer=require(_0xcd5f('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xcd5f('0x1'));var router=express[_0xcd5f('0x2')]();var fs_extra=require(_0xcd5f('0x3'));var auth=require(_0xcd5f('0x4'));var interaction=require(_0xcd5f('0x5'));var config=require(_0xcd5f('0x6'));var controller=require('./intDynamics365Configuration.controller');router[_0xcd5f('0x7')]('/',auth['isAuthenticated'](),controller[_0xcd5f('0x8')]);router[_0xcd5f('0x7')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0xcd5f('0x7')]('/:id/fields',auth[_0xcd5f('0x9')](),controller[_0xcd5f('0xa')]);router['get'](_0xcd5f('0xb'),auth['isAuthenticated'](),controller[_0xcd5f('0xc')]);router['get'](_0xcd5f('0xd'),auth[_0xcd5f('0x9')](),controller[_0xcd5f('0xe')]);router[_0xcd5f('0xf')]('/',auth['isAuthenticated'](),controller[_0xcd5f('0x10')]);router[_0xcd5f('0x11')]('/:id',auth[_0xcd5f('0x9')](),controller[_0xcd5f('0x12')]);router[_0xcd5f('0x13')](_0xcd5f('0x14'),auth[_0xcd5f('0x9')](),controller['destroy']);module[_0xcd5f('0x15')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js index aebede0..313547c 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 _0x2b9e=['incident','phonecall','sequelize','exports','STRING'];(function(_0x447044,_0xd9784a){var _0x527bdb=function(_0x20c90d){while(--_0x20c90d){_0x447044['push'](_0x447044['shift']());}};_0x527bdb(++_0xd9784a);}(_0x2b9e,0x1f1));var _0xe2b9=function(_0x5f4db9,_0x3c8ac0){_0x5f4db9=_0x5f4db9-0x0;var _0x49c19a=_0x2b9e[_0x5f4db9];return _0x49c19a;};'use strict';var Sequelize=require(_0xe2b9('0x0'));module[_0xe2b9('0x1')]={'name':{'type':Sequelize[_0xe2b9('0x2')]},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize['ENUM'](_0xe2b9('0x3'),_0xe2b9('0x4')),'defaultValue':_0xe2b9('0x3')}}; \ No newline at end of file +var _0xc04f=['incident','sequelize','exports','STRING','ENUM'];(function(_0x1034ee,_0x12998c){var _0x2922af=function(_0x13715a){while(--_0x13715a){_0x1034ee['push'](_0x1034ee['shift']());}};_0x2922af(++_0x12998c);}(_0xc04f,0x1e6));var _0xfc04=function(_0x50d94a,_0x4bb055){_0x50d94a=_0x50d94a-0x0;var _0x4b88ec=_0xc04f[_0x50d94a];return _0x4b88ec;};'use strict';var Sequelize=require(_0xfc04('0x0'));module[_0xfc04('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xfc04('0x2')]},'ticketType':{'type':Sequelize[_0xfc04('0x3')]('incident','phonecall'),'defaultValue':_0xfc04('0x4')}}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js index 630849d..04b0408 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 _0x8a4c=['../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','then','destroy','error','name','index','map','Dynamics365Configuration','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','options','create','update','body','find','getFields','findOne','Dynamics365Field','nolimit','getSubjects','getDescriptions','eml-format','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api'];(function(_0x3fc767,_0x2c4eda){var _0x5c3fb4=function(_0xbc00eb){while(--_0xbc00eb){_0x3fc767['push'](_0x3fc767['shift']());}};_0x5c3fb4(++_0x2c4eda);}(_0x8a4c,0x89));var _0xc8a4=function(_0x264f48,_0x2c82d8){_0x264f48=_0x264f48-0x0;var _0xb99167=_0x8a4c[_0x264f48];return _0xb99167;};'use strict';var emlformat=require(_0xc8a4('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xc8a4('0x1'));var Mustache=require(_0xc8a4('0x2'));var util=require(_0xc8a4('0x3'));var path=require('path');var sox=require(_0xc8a4('0x4'));var csv=require(_0xc8a4('0x5'));var ejs=require(_0xc8a4('0x6'));var fs=require('fs');var fs_extra=require(_0xc8a4('0x7'));var _=require(_0xc8a4('0x8'));var squel=require(_0xc8a4('0x9'));var crypto=require('crypto');var jsforce=require(_0xc8a4('0xa'));var deskjs=require(_0xc8a4('0xb'));var toCsv=require(_0xc8a4('0x5'));var querystring=require(_0xc8a4('0xc'));var Papa=require(_0xc8a4('0xd'));var Redis=require('ioredis');var authService=require(_0xc8a4('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xc8a4('0xf'));var hardwareService=require(_0xc8a4('0x10'));var logger=require(_0xc8a4('0x11'))(_0xc8a4('0x12'));var utils=require(_0xc8a4('0x13'));var config=require(_0xc8a4('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xc8a4('0x15'))['db'];function respondWithStatusCode(_0x1779cc,_0x145fcf){_0x145fcf=_0x145fcf||0xcc;return function(_0x5b9439){if(_0x5b9439){return _0x1779cc[_0xc8a4('0x16')](_0x145fcf);}return _0x1779cc[_0xc8a4('0x17')](_0x145fcf)[_0xc8a4('0x18')]();};}function respondWithResult(_0x4ad2e8,_0x4bdf12){_0x4bdf12=_0x4bdf12||0xc8;return function(_0x52d42b){if(_0x52d42b){return _0x4ad2e8[_0xc8a4('0x17')](_0x4bdf12)[_0xc8a4('0x19')](_0x52d42b);}};}function respondWithFilteredResult(_0x185fb0,_0x2e4320){return function(_0x20ead8){if(_0x20ead8){var _0x84ece9=typeof _0x2e4320[_0xc8a4('0x1a')]===_0xc8a4('0x1b')&&typeof _0x2e4320[_0xc8a4('0x1c')]===_0xc8a4('0x1b');var _0x283b1f=_0x20ead8[_0xc8a4('0x1d')];var _0x46dc25=_0x84ece9?0x0:_0x2e4320['offset'];var _0x795fb8=_0x84ece9?_0x20ead8[_0xc8a4('0x1d')]:_0x2e4320['offset']+_0x2e4320[_0xc8a4('0x1c')];var _0x2b10b2;if(_0x795fb8>=_0x283b1f){_0x795fb8=_0x283b1f;_0x2b10b2=0xc8;}else{_0x2b10b2=0xce;}_0x185fb0[_0xc8a4('0x17')](_0x2b10b2);return _0x185fb0[_0xc8a4('0x1e')](_0xc8a4('0x1f'),_0x46dc25+'-'+_0x795fb8+'/'+_0x283b1f)[_0xc8a4('0x19')](_0x20ead8);}return null;};}function patchUpdates(_0x602cc3){return function(_0x182ef5){try{jsonpatch[_0xc8a4('0x20')](_0x182ef5,_0x602cc3,!![]);}catch(_0x5bc2e8){return BPromise[_0xc8a4('0x21')](_0x5bc2e8);}return _0x182ef5['save']();};}function saveUpdates(_0x402ccb,_0x5d1b6e){return function(_0x1cde21){if(_0x1cde21){return _0x1cde21['update'](_0x402ccb)[_0xc8a4('0x22')](function(_0x5aeef7){return _0x5aeef7;});}return null;};}function removeEntity(_0x5f463f,_0x45fded){return function(_0x552395){if(_0x552395){return _0x552395[_0xc8a4('0x23')]()[_0xc8a4('0x22')](function(){_0x5f463f['status'](0xcc)[_0xc8a4('0x18')]();});}};}function handleEntityNotFound(_0x5044ca,_0x3c3c1d){return function(_0x4c5b98){if(!_0x4c5b98){_0x5044ca[_0xc8a4('0x16')](0x194);}return _0x4c5b98;};}function handleError(_0x2d2c60,_0x43e2c5){_0x43e2c5=_0x43e2c5||0x1f4;return function(_0x1180ba){logger[_0xc8a4('0x24')](_0x1180ba['stack']);if(_0x1180ba[_0xc8a4('0x25')]){delete _0x1180ba['name'];}_0x2d2c60[_0xc8a4('0x17')](_0x43e2c5)['send'](_0x1180ba);};}exports[_0xc8a4('0x26')]=function(_0x15e012,_0x47fdca){var _0x48ac11={},_0x2fc0fd={},_0x314db1={'count':0x0,'rows':[]};var _0x20bf9b=_[_0xc8a4('0x27')](db[_0xc8a4('0x28')][_0xc8a4('0x29')],function(_0x4cf294){return{'name':_0x4cf294[_0xc8a4('0x2a')],'type':_0x4cf294[_0xc8a4('0x2b')]['key']};});_0x2fc0fd[_0xc8a4('0x2c')]=_[_0xc8a4('0x27')](_0x20bf9b,'name');_0x2fc0fd[_0xc8a4('0x2d')]=_[_0xc8a4('0x2e')](_0x15e012[_0xc8a4('0x2d')]);_0x2fc0fd[_0xc8a4('0x2f')]=_[_0xc8a4('0x30')](_0x2fc0fd[_0xc8a4('0x2c')],_0x2fc0fd[_0xc8a4('0x2d')]);_0x48ac11[_0xc8a4('0x31')]=_[_0xc8a4('0x30')](_0x2fc0fd[_0xc8a4('0x2c')],qs[_0xc8a4('0x32')](_0x15e012['query'][_0xc8a4('0x32')]));_0x48ac11[_0xc8a4('0x31')]=_0x48ac11['attributes'][_0xc8a4('0x33')]?_0x48ac11[_0xc8a4('0x31')]:_0x2fc0fd['model'];if(!_0x15e012[_0xc8a4('0x2d')][_0xc8a4('0x34')]('nolimit')){_0x48ac11[_0xc8a4('0x1c')]=qs[_0xc8a4('0x1c')](_0x15e012[_0xc8a4('0x2d')][_0xc8a4('0x1c')]);_0x48ac11[_0xc8a4('0x1a')]=qs[_0xc8a4('0x1a')](_0x15e012['query'][_0xc8a4('0x1a')]);}_0x48ac11[_0xc8a4('0x35')]=qs[_0xc8a4('0x36')](_0x15e012[_0xc8a4('0x2d')][_0xc8a4('0x36')]);_0x48ac11['where']=qs[_0xc8a4('0x2f')](_[_0xc8a4('0x37')](_0x15e012[_0xc8a4('0x2d')],_0x2fc0fd[_0xc8a4('0x2f')]),_0x20bf9b);if(_0x15e012[_0xc8a4('0x2d')][_0xc8a4('0x38')]){_0x48ac11[_0xc8a4('0x39')]=_[_0xc8a4('0x3a')](_0x48ac11[_0xc8a4('0x39')],{'$or':_[_0xc8a4('0x27')](_0x20bf9b,function(_0x20ab2c){if(_0x20ab2c['type']!==_0xc8a4('0x3b')){var _0x3405df={};_0x3405df[_0x20ab2c[_0xc8a4('0x25')]]={'$like':'%'+_0x15e012['query']['filter']+'%'};return _0x3405df;}})});}_0x48ac11=_['merge']({},_0x48ac11,_0x15e012['options']);var _0x550ced={'where':_0x48ac11[_0xc8a4('0x39')]};return db[_0xc8a4('0x28')][_0xc8a4('0x1d')](_0x550ced)['then'](function(_0x5100f3){_0x314db1[_0xc8a4('0x1d')]=_0x5100f3;if(_0x15e012[_0xc8a4('0x2d')][_0xc8a4('0x3c')]){_0x48ac11[_0xc8a4('0x3d')]=[{'all':!![]}];}return db[_0xc8a4('0x28')][_0xc8a4('0x3e')](_0x48ac11);})[_0xc8a4('0x22')](function(_0x3f58ed){_0x314db1[_0xc8a4('0x3f')]=_0x3f58ed;return _0x314db1;})[_0xc8a4('0x22')](respondWithFilteredResult(_0x47fdca,_0x48ac11))[_0xc8a4('0x40')](handleError(_0x47fdca,null));};exports[_0xc8a4('0x41')]=function(_0x2c1769,_0x248bd5){var _0xe76c63={'raw':![],'where':{'id':_0x2c1769[_0xc8a4('0x42')]['id']}},_0x5749cd={};_0x5749cd[_0xc8a4('0x2c')]=_[_0xc8a4('0x2e')](db[_0xc8a4('0x28')][_0xc8a4('0x29')]);_0x5749cd['query']=_[_0xc8a4('0x2e')](_0x2c1769[_0xc8a4('0x2d')]);_0x5749cd['filters']=_[_0xc8a4('0x30')](_0x5749cd['model'],_0x5749cd[_0xc8a4('0x2d')]);_0xe76c63[_0xc8a4('0x31')]=_[_0xc8a4('0x30')](_0x5749cd[_0xc8a4('0x2c')],qs['fields'](_0x2c1769['query'][_0xc8a4('0x32')]));_0xe76c63['attributes']=_0xe76c63[_0xc8a4('0x31')]['length']?_0xe76c63['attributes']:_0x5749cd['model'];if(_0x2c1769[_0xc8a4('0x2d')][_0xc8a4('0x3c')]){_0xe76c63['include']=[{'all':!![]}];}_0xe76c63=_[_0xc8a4('0x3a')]({},_0xe76c63,_0x2c1769[_0xc8a4('0x43')]);return db[_0xc8a4('0x28')]['find'](_0xe76c63)['then'](handleEntityNotFound(_0x248bd5,null))['then'](respondWithResult(_0x248bd5,null))[_0xc8a4('0x40')](handleError(_0x248bd5,null));};exports[_0xc8a4('0x44')]=function(_0x32a89e,_0x3de88d){return db[_0xc8a4('0x28')][_0xc8a4('0x44')](_0x32a89e['body'],{})[_0xc8a4('0x22')](respondWithResult(_0x3de88d,0xc9))[_0xc8a4('0x40')](handleError(_0x3de88d,null));};exports[_0xc8a4('0x45')]=function(_0x4e5e28,_0x22af3a){if(_0x4e5e28[_0xc8a4('0x46')]['id']){delete _0x4e5e28[_0xc8a4('0x46')]['id'];}return db[_0xc8a4('0x28')][_0xc8a4('0x47')]({'where':{'id':_0x4e5e28[_0xc8a4('0x42')]['id']}})[_0xc8a4('0x22')](handleEntityNotFound(_0x22af3a,null))[_0xc8a4('0x22')](saveUpdates(_0x4e5e28[_0xc8a4('0x46')],null))[_0xc8a4('0x22')](respondWithResult(_0x22af3a,null))[_0xc8a4('0x40')](handleError(_0x22af3a,null));};exports[_0xc8a4('0x23')]=function(_0x1a1ea4,_0x74a076){return db[_0xc8a4('0x28')][_0xc8a4('0x47')]({'where':{'id':_0x1a1ea4[_0xc8a4('0x42')]['id']}})[_0xc8a4('0x22')](handleEntityNotFound(_0x74a076,null))[_0xc8a4('0x22')](removeEntity(_0x74a076,null))['catch'](handleError(_0x74a076,null));};exports[_0xc8a4('0x48')]=function(_0x1ed35b,_0x37133f,_0x526a4f){var _0x15e97d={};var _0xd06f15={};var _0x4e490c;var _0x4d7515;return db[_0xc8a4('0x28')][_0xc8a4('0x49')]({'where':{'id':_0x1ed35b['params']['id']}})['then'](handleEntityNotFound(_0x37133f,null))[_0xc8a4('0x22')](function(_0x5b2c88){if(_0x5b2c88){_0x4e490c=_0x5b2c88;_0xd06f15[_0xc8a4('0x2c')]=_[_0xc8a4('0x2e')](db[_0xc8a4('0x4a')]['rawAttributes']);_0xd06f15[_0xc8a4('0x2d')]=_['keys'](_0x1ed35b[_0xc8a4('0x2d')]);_0xd06f15[_0xc8a4('0x2f')]=_[_0xc8a4('0x30')](_0xd06f15[_0xc8a4('0x2c')],_0xd06f15[_0xc8a4('0x2d')]);_0x15e97d[_0xc8a4('0x31')]=_[_0xc8a4('0x30')](_0xd06f15['model'],qs['fields'](_0x1ed35b[_0xc8a4('0x2d')][_0xc8a4('0x32')]));_0x15e97d[_0xc8a4('0x31')]=_0x15e97d['attributes']['length']?_0x15e97d[_0xc8a4('0x31')]:_0xd06f15[_0xc8a4('0x2c')];_0x15e97d['order']=qs[_0xc8a4('0x36')](_0x1ed35b[_0xc8a4('0x2d')][_0xc8a4('0x36')]);_0x15e97d['where']=qs[_0xc8a4('0x2f')](_[_0xc8a4('0x37')](_0x1ed35b[_0xc8a4('0x2d')],_0xd06f15[_0xc8a4('0x2f')]));if(_0x1ed35b['query']['filter']){_0x15e97d[_0xc8a4('0x39')]=_['merge'](_0x15e97d[_0xc8a4('0x39')],{'$or':_[_0xc8a4('0x27')](_0x15e97d[_0xc8a4('0x31')],function(_0x48f189){var _0x576435={};_0x576435[_0x48f189]={'$like':'%'+_0x1ed35b[_0xc8a4('0x2d')][_0xc8a4('0x38')]+'%'};return _0x576435;})});}_0x15e97d=_['merge']({},_0x15e97d,_0x1ed35b[_0xc8a4('0x43')]);return _0x4e490c['getFields'](_0x15e97d);}})['then'](function(_0x1c2fe1){if(_0x1c2fe1){_0x4d7515=_0x1c2fe1[_0xc8a4('0x33')];if(!_0x1ed35b['query']['hasOwnProperty'](_0xc8a4('0x4b'))){_0x15e97d['limit']=qs['limit'](_0x1ed35b[_0xc8a4('0x2d')][_0xc8a4('0x1c')]);_0x15e97d['offset']=qs['offset'](_0x1ed35b[_0xc8a4('0x2d')][_0xc8a4('0x1a')]);}return _0x4e490c[_0xc8a4('0x48')](_0x15e97d);}})[_0xc8a4('0x22')](function(_0x78e311){if(_0x78e311){return _0x78e311?{'count':_0x4d7515,'rows':_0x78e311}:null;}})[_0xc8a4('0x22')](respondWithResult(_0x37133f,null))[_0xc8a4('0x40')](handleError(_0x37133f,null));};exports[_0xc8a4('0x4c')]=function(_0x43ba72,_0x1e1b03,_0x532936){var _0x235706={};var _0x22ccc1={};var _0x2a1ade;var _0x5815fc;return db[_0xc8a4('0x28')][_0xc8a4('0x49')]({'where':{'id':_0x43ba72[_0xc8a4('0x42')]['id']}})['then'](handleEntityNotFound(_0x1e1b03,null))[_0xc8a4('0x22')](function(_0x4e1978){if(_0x4e1978){_0x2a1ade=_0x4e1978;_0x22ccc1['model']=_[_0xc8a4('0x2e')](db[_0xc8a4('0x4a')]['rawAttributes']);_0x22ccc1[_0xc8a4('0x2d')]=_[_0xc8a4('0x2e')](_0x43ba72['query']);_0x22ccc1[_0xc8a4('0x2f')]=_[_0xc8a4('0x30')](_0x22ccc1[_0xc8a4('0x2c')],_0x22ccc1[_0xc8a4('0x2d')]);_0x235706[_0xc8a4('0x31')]=_[_0xc8a4('0x30')](_0x22ccc1[_0xc8a4('0x2c')],qs[_0xc8a4('0x32')](_0x43ba72['query']['fields']));_0x235706[_0xc8a4('0x31')]=_0x235706[_0xc8a4('0x31')]['length']?_0x235706[_0xc8a4('0x31')]:_0x22ccc1['model'];_0x235706[_0xc8a4('0x35')]=qs[_0xc8a4('0x36')](_0x43ba72[_0xc8a4('0x2d')][_0xc8a4('0x36')]);_0x235706[_0xc8a4('0x39')]=qs[_0xc8a4('0x2f')](_[_0xc8a4('0x37')](_0x43ba72[_0xc8a4('0x2d')],_0x22ccc1['filters']));if(_0x43ba72[_0xc8a4('0x2d')][_0xc8a4('0x38')]){_0x235706[_0xc8a4('0x39')]=_['merge'](_0x235706[_0xc8a4('0x39')],{'$or':_[_0xc8a4('0x27')](_0x235706[_0xc8a4('0x31')],function(_0x2dad82){var _0x42f4c6={};_0x42f4c6[_0x2dad82]={'$like':'%'+_0x43ba72[_0xc8a4('0x2d')][_0xc8a4('0x38')]+'%'};return _0x42f4c6;})});}_0x235706=_['merge']({},_0x235706,_0x43ba72['options']);return _0x2a1ade[_0xc8a4('0x4c')](_0x235706);}})['then'](function(_0x160b3c){if(_0x160b3c){_0x5815fc=_0x160b3c[_0xc8a4('0x33')];if(!_0x43ba72[_0xc8a4('0x2d')][_0xc8a4('0x34')]('nolimit')){_0x235706[_0xc8a4('0x1c')]=qs[_0xc8a4('0x1c')](_0x43ba72['query']['limit']);_0x235706[_0xc8a4('0x1a')]=qs['offset'](_0x43ba72[_0xc8a4('0x2d')]['offset']);}return _0x2a1ade[_0xc8a4('0x4c')](_0x235706);}})[_0xc8a4('0x22')](function(_0x311115){if(_0x311115){return _0x311115?{'count':_0x5815fc,'rows':_0x311115}:null;}})['then'](respondWithResult(_0x1e1b03,null))[_0xc8a4('0x40')](handleError(_0x1e1b03,null));};exports[_0xc8a4('0x4d')]=function(_0x21c326,_0x23b255,_0x3009ae){var _0xcfdf71={};var _0x40aafe={};var _0xc658f4;var _0x18820f;return db[_0xc8a4('0x28')][_0xc8a4('0x49')]({'where':{'id':_0x21c326[_0xc8a4('0x42')]['id']}})[_0xc8a4('0x22')](handleEntityNotFound(_0x23b255,null))[_0xc8a4('0x22')](function(_0x5414c3){if(_0x5414c3){_0xc658f4=_0x5414c3;_0x40aafe['model']=_[_0xc8a4('0x2e')](db[_0xc8a4('0x4a')]['rawAttributes']);_0x40aafe[_0xc8a4('0x2d')]=_['keys'](_0x21c326[_0xc8a4('0x2d')]);_0x40aafe[_0xc8a4('0x2f')]=_['intersection'](_0x40aafe[_0xc8a4('0x2c')],_0x40aafe[_0xc8a4('0x2d')]);_0xcfdf71['attributes']=_[_0xc8a4('0x30')](_0x40aafe[_0xc8a4('0x2c')],qs[_0xc8a4('0x32')](_0x21c326[_0xc8a4('0x2d')][_0xc8a4('0x32')]));_0xcfdf71[_0xc8a4('0x31')]=_0xcfdf71[_0xc8a4('0x31')][_0xc8a4('0x33')]?_0xcfdf71['attributes']:_0x40aafe[_0xc8a4('0x2c')];_0xcfdf71[_0xc8a4('0x35')]=qs[_0xc8a4('0x36')](_0x21c326[_0xc8a4('0x2d')][_0xc8a4('0x36')]);_0xcfdf71['where']=qs['filters'](_[_0xc8a4('0x37')](_0x21c326[_0xc8a4('0x2d')],_0x40aafe[_0xc8a4('0x2f')]));if(_0x21c326[_0xc8a4('0x2d')][_0xc8a4('0x38')]){_0xcfdf71[_0xc8a4('0x39')]=_[_0xc8a4('0x3a')](_0xcfdf71[_0xc8a4('0x39')],{'$or':_[_0xc8a4('0x27')](_0xcfdf71[_0xc8a4('0x31')],function(_0x52592f){var _0x495d94={};_0x495d94[_0x52592f]={'$like':'%'+_0x21c326['query']['filter']+'%'};return _0x495d94;})});}_0xcfdf71=_[_0xc8a4('0x3a')]({},_0xcfdf71,_0x21c326[_0xc8a4('0x43')]);return _0xc658f4[_0xc8a4('0x4d')](_0xcfdf71);}})['then'](function(_0x3f7af7){if(_0x3f7af7){_0x18820f=_0x3f7af7[_0xc8a4('0x33')];if(!_0x21c326[_0xc8a4('0x2d')][_0xc8a4('0x34')](_0xc8a4('0x4b'))){_0xcfdf71[_0xc8a4('0x1c')]=qs[_0xc8a4('0x1c')](_0x21c326[_0xc8a4('0x2d')][_0xc8a4('0x1c')]);_0xcfdf71['offset']=qs[_0xc8a4('0x1a')](_0x21c326[_0xc8a4('0x2d')][_0xc8a4('0x1a')]);}return _0xc658f4['getDescriptions'](_0xcfdf71);}})[_0xc8a4('0x22')](function(_0x151085){if(_0x151085){return _0x151085?{'count':_0x18820f,'rows':_0x151085}:null;}})[_0xc8a4('0x22')](respondWithResult(_0x23b255,null))[_0xc8a4('0x40')](handleError(_0x23b255,null));}; \ No newline at end of file +var _0xf50e=['body','destroy','getFields','findOne','order','sort','pick','hasOwnProperty','getSubjects','getDescriptions','Dynamics365Field','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','count','limit','set','apply','save','update','then','end','error','stack','name','send','index','Dynamics365Configuration','rawAttributes','fieldName','map','query','keys','filters','intersection','attributes','model','length','nolimit','filter','where','merge','VIRTUAL','options','include','rows','catch','show','params','fields','includeAll','find','create'];(function(_0x163cd0,_0x461c03){var _0x166213=function(_0x450910){while(--_0x450910){_0x163cd0['push'](_0x163cd0['shift']());}};_0x166213(++_0x461c03);}(_0xf50e,0xf8));var _0xef50=function(_0x543c51,_0xff0084){_0x543c51=_0x543c51-0x0;var _0x360555=_0xf50e[_0x543c51];return _0x360555;};'use strict';var emlformat=require(_0xef50('0x0'));var rimraf=require(_0xef50('0x1'));var zipdir=require(_0xef50('0x2'));var jsonpatch=require(_0xef50('0x3'));var rp=require('request-promise');var moment=require(_0xef50('0x4'));var BPromise=require(_0xef50('0x5'));var Mustache=require(_0xef50('0x6'));var util=require(_0xef50('0x7'));var path=require(_0xef50('0x8'));var sox=require(_0xef50('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xef50('0xa'));var squel=require(_0xef50('0xb'));var crypto=require(_0xef50('0xc'));var jsforce=require(_0xef50('0xd'));var deskjs=require(_0xef50('0xe'));var toCsv=require(_0xef50('0xf'));var querystring=require(_0xef50('0x10'));var Papa=require('papaparse');var Redis=require(_0xef50('0x11'));var authService=require(_0xef50('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xef50('0x13'));var logger=require('../../config/logger')(_0xef50('0x14'));var utils=require(_0xef50('0x15'));var config=require(_0xef50('0x16'));var licenseUtil=require(_0xef50('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x44a2b8,_0x21981e){_0x21981e=_0x21981e||0xcc;return function(_0x2d9190){if(_0x2d9190){return _0x44a2b8[_0xef50('0x18')](_0x21981e);}return _0x44a2b8[_0xef50('0x19')](_0x21981e)['end']();};}function respondWithResult(_0x15d875,_0x1bf4ba){_0x1bf4ba=_0x1bf4ba||0xc8;return function(_0x2f11fe){if(_0x2f11fe){return _0x15d875[_0xef50('0x19')](_0x1bf4ba)[_0xef50('0x1a')](_0x2f11fe);}};}function respondWithFilteredResult(_0x36643e,_0x5dada9){return function(_0xd54d24){if(_0xd54d24){var _0x4e94ec=typeof _0x5dada9[_0xef50('0x1b')]===_0xef50('0x1c')&&typeof _0x5dada9['limit']==='undefined';var _0x4d31b5=_0xd54d24[_0xef50('0x1d')];var _0x52158f=_0x4e94ec?0x0:_0x5dada9[_0xef50('0x1b')];var _0x59b92b=_0x4e94ec?_0xd54d24[_0xef50('0x1d')]:_0x5dada9[_0xef50('0x1b')]+_0x5dada9[_0xef50('0x1e')];var _0x39578d;if(_0x59b92b>=_0x4d31b5){_0x59b92b=_0x4d31b5;_0x39578d=0xc8;}else{_0x39578d=0xce;}_0x36643e[_0xef50('0x19')](_0x39578d);return _0x36643e[_0xef50('0x1f')]('Content-Range',_0x52158f+'-'+_0x59b92b+'/'+_0x4d31b5)[_0xef50('0x1a')](_0xd54d24);}return null;};}function patchUpdates(_0x1b019f){return function(_0x203446){try{jsonpatch[_0xef50('0x20')](_0x203446,_0x1b019f,!![]);}catch(_0x56d924){return BPromise['reject'](_0x56d924);}return _0x203446[_0xef50('0x21')]();};}function saveUpdates(_0x103e50,_0x3c1b5b){return function(_0x2a776a){if(_0x2a776a){return _0x2a776a[_0xef50('0x22')](_0x103e50)[_0xef50('0x23')](function(_0x586084){return _0x586084;});}return null;};}function removeEntity(_0x371ed4,_0x4b2fcd){return function(_0x2208a){if(_0x2208a){return _0x2208a['destroy']()[_0xef50('0x23')](function(){_0x371ed4[_0xef50('0x19')](0xcc)[_0xef50('0x24')]();});}};}function handleEntityNotFound(_0x1fb64a,_0x5b6ccc){return function(_0x28811e){if(!_0x28811e){_0x1fb64a[_0xef50('0x18')](0x194);}return _0x28811e;};}function handleError(_0x23c51d,_0x342a04){_0x342a04=_0x342a04||0x1f4;return function(_0x3f981e){logger[_0xef50('0x25')](_0x3f981e[_0xef50('0x26')]);if(_0x3f981e['name']){delete _0x3f981e[_0xef50('0x27')];}_0x23c51d[_0xef50('0x19')](_0x342a04)[_0xef50('0x28')](_0x3f981e);};}exports[_0xef50('0x29')]=function(_0x625393,_0x1d1740){var _0xc0ce72={},_0x2c3c44={},_0x306a33={'count':0x0,'rows':[]};var _0x3cda62=_['map'](db[_0xef50('0x2a')][_0xef50('0x2b')],function(_0x17e0a9){return{'name':_0x17e0a9[_0xef50('0x2c')],'type':_0x17e0a9['type']['key']};});_0x2c3c44['model']=_[_0xef50('0x2d')](_0x3cda62,_0xef50('0x27'));_0x2c3c44[_0xef50('0x2e')]=_[_0xef50('0x2f')](_0x625393[_0xef50('0x2e')]);_0x2c3c44[_0xef50('0x30')]=_[_0xef50('0x31')](_0x2c3c44['model'],_0x2c3c44[_0xef50('0x2e')]);_0xc0ce72[_0xef50('0x32')]=_[_0xef50('0x31')](_0x2c3c44[_0xef50('0x33')],qs['fields'](_0x625393[_0xef50('0x2e')]['fields']));_0xc0ce72[_0xef50('0x32')]=_0xc0ce72[_0xef50('0x32')][_0xef50('0x34')]?_0xc0ce72[_0xef50('0x32')]:_0x2c3c44[_0xef50('0x33')];if(!_0x625393[_0xef50('0x2e')]['hasOwnProperty'](_0xef50('0x35'))){_0xc0ce72['limit']=qs[_0xef50('0x1e')](_0x625393[_0xef50('0x2e')][_0xef50('0x1e')]);_0xc0ce72[_0xef50('0x1b')]=qs[_0xef50('0x1b')](_0x625393['query']['offset']);}_0xc0ce72['order']=qs['sort'](_0x625393['query']['sort']);_0xc0ce72['where']=qs[_0xef50('0x30')](_['pick'](_0x625393[_0xef50('0x2e')],_0x2c3c44['filters']),_0x3cda62);if(_0x625393[_0xef50('0x2e')][_0xef50('0x36')]){_0xc0ce72[_0xef50('0x37')]=_[_0xef50('0x38')](_0xc0ce72['where'],{'$or':_[_0xef50('0x2d')](_0x3cda62,function(_0xb1daf9){if(_0xb1daf9['type']!==_0xef50('0x39')){var _0xa54ede={};_0xa54ede[_0xb1daf9[_0xef50('0x27')]]={'$like':'%'+_0x625393['query'][_0xef50('0x36')]+'%'};return _0xa54ede;}})});}_0xc0ce72=_[_0xef50('0x38')]({},_0xc0ce72,_0x625393[_0xef50('0x3a')]);var _0x2f63bc={'where':_0xc0ce72[_0xef50('0x37')]};return db['Dynamics365Configuration']['count'](_0x2f63bc)['then'](function(_0x30495f){_0x306a33['count']=_0x30495f;if(_0x625393[_0xef50('0x2e')]['includeAll']){_0xc0ce72[_0xef50('0x3b')]=[{'all':!![]}];}return db[_0xef50('0x2a')]['findAll'](_0xc0ce72);})['then'](function(_0x4b7594){_0x306a33[_0xef50('0x3c')]=_0x4b7594;return _0x306a33;})[_0xef50('0x23')](respondWithFilteredResult(_0x1d1740,_0xc0ce72))[_0xef50('0x3d')](handleError(_0x1d1740,null));};exports[_0xef50('0x3e')]=function(_0x5c1dbd,_0x530995){var _0x2a48e7={'raw':![],'where':{'id':_0x5c1dbd[_0xef50('0x3f')]['id']}},_0x102c4d={};_0x102c4d[_0xef50('0x33')]=_['keys'](db[_0xef50('0x2a')][_0xef50('0x2b')]);_0x102c4d[_0xef50('0x2e')]=_['keys'](_0x5c1dbd[_0xef50('0x2e')]);_0x102c4d[_0xef50('0x30')]=_[_0xef50('0x31')](_0x102c4d[_0xef50('0x33')],_0x102c4d[_0xef50('0x2e')]);_0x2a48e7[_0xef50('0x32')]=_[_0xef50('0x31')](_0x102c4d[_0xef50('0x33')],qs[_0xef50('0x40')](_0x5c1dbd[_0xef50('0x2e')][_0xef50('0x40')]));_0x2a48e7[_0xef50('0x32')]=_0x2a48e7[_0xef50('0x32')]['length']?_0x2a48e7[_0xef50('0x32')]:_0x102c4d[_0xef50('0x33')];if(_0x5c1dbd[_0xef50('0x2e')][_0xef50('0x41')]){_0x2a48e7['include']=[{'all':!![]}];}_0x2a48e7=_[_0xef50('0x38')]({},_0x2a48e7,_0x5c1dbd[_0xef50('0x3a')]);return db[_0xef50('0x2a')][_0xef50('0x42')](_0x2a48e7)[_0xef50('0x23')](handleEntityNotFound(_0x530995,null))['then'](respondWithResult(_0x530995,null))[_0xef50('0x3d')](handleError(_0x530995,null));};exports[_0xef50('0x43')]=function(_0x448cc2,_0x9fe573){return db[_0xef50('0x2a')]['create'](_0x448cc2[_0xef50('0x44')],{})[_0xef50('0x23')](respondWithResult(_0x9fe573,0xc9))['catch'](handleError(_0x9fe573,null));};exports[_0xef50('0x22')]=function(_0x26ca61,_0x2d8ed2){if(_0x26ca61[_0xef50('0x44')]['id']){delete _0x26ca61['body']['id'];}return db[_0xef50('0x2a')][_0xef50('0x42')]({'where':{'id':_0x26ca61[_0xef50('0x3f')]['id']}})[_0xef50('0x23')](handleEntityNotFound(_0x2d8ed2,null))[_0xef50('0x23')](saveUpdates(_0x26ca61[_0xef50('0x44')],null))[_0xef50('0x23')](respondWithResult(_0x2d8ed2,null))[_0xef50('0x3d')](handleError(_0x2d8ed2,null));};exports[_0xef50('0x45')]=function(_0x4771df,_0x1a7ce5){return db[_0xef50('0x2a')]['find']({'where':{'id':_0x4771df[_0xef50('0x3f')]['id']}})[_0xef50('0x23')](handleEntityNotFound(_0x1a7ce5,null))[_0xef50('0x23')](removeEntity(_0x1a7ce5,null))[_0xef50('0x3d')](handleError(_0x1a7ce5,null));};exports[_0xef50('0x46')]=function(_0x406769,_0x3544ac,_0x1a9ba5){var _0x2d8d77={};var _0xf04817={};var _0x285010;var _0x1f4383;return db[_0xef50('0x2a')][_0xef50('0x47')]({'where':{'id':_0x406769[_0xef50('0x3f')]['id']}})[_0xef50('0x23')](handleEntityNotFound(_0x3544ac,null))['then'](function(_0x5d891c){if(_0x5d891c){_0x285010=_0x5d891c;_0xf04817[_0xef50('0x33')]=_['keys'](db['Dynamics365Field'][_0xef50('0x2b')]);_0xf04817[_0xef50('0x2e')]=_[_0xef50('0x2f')](_0x406769[_0xef50('0x2e')]);_0xf04817[_0xef50('0x30')]=_[_0xef50('0x31')](_0xf04817[_0xef50('0x33')],_0xf04817['query']);_0x2d8d77[_0xef50('0x32')]=_[_0xef50('0x31')](_0xf04817['model'],qs[_0xef50('0x40')](_0x406769[_0xef50('0x2e')][_0xef50('0x40')]));_0x2d8d77[_0xef50('0x32')]=_0x2d8d77[_0xef50('0x32')][_0xef50('0x34')]?_0x2d8d77[_0xef50('0x32')]:_0xf04817[_0xef50('0x33')];_0x2d8d77[_0xef50('0x48')]=qs[_0xef50('0x49')](_0x406769[_0xef50('0x2e')]['sort']);_0x2d8d77[_0xef50('0x37')]=qs[_0xef50('0x30')](_[_0xef50('0x4a')](_0x406769[_0xef50('0x2e')],_0xf04817[_0xef50('0x30')]));if(_0x406769[_0xef50('0x2e')][_0xef50('0x36')]){_0x2d8d77['where']=_['merge'](_0x2d8d77['where'],{'$or':_[_0xef50('0x2d')](_0x2d8d77[_0xef50('0x32')],function(_0x552e91){var _0x5bba45={};_0x5bba45[_0x552e91]={'$like':'%'+_0x406769[_0xef50('0x2e')]['filter']+'%'};return _0x5bba45;})});}_0x2d8d77=_[_0xef50('0x38')]({},_0x2d8d77,_0x406769['options']);return _0x285010['getFields'](_0x2d8d77);}})['then'](function(_0x22d32e){if(_0x22d32e){_0x1f4383=_0x22d32e['length'];if(!_0x406769['query'][_0xef50('0x4b')]('nolimit')){_0x2d8d77[_0xef50('0x1e')]=qs[_0xef50('0x1e')](_0x406769[_0xef50('0x2e')]['limit']);_0x2d8d77[_0xef50('0x1b')]=qs[_0xef50('0x1b')](_0x406769[_0xef50('0x2e')][_0xef50('0x1b')]);}return _0x285010[_0xef50('0x46')](_0x2d8d77);}})[_0xef50('0x23')](function(_0x4b51d0){if(_0x4b51d0){return _0x4b51d0?{'count':_0x1f4383,'rows':_0x4b51d0}:null;}})[_0xef50('0x23')](respondWithResult(_0x3544ac,null))['catch'](handleError(_0x3544ac,null));};exports[_0xef50('0x4c')]=function(_0x242c4d,_0x1a9bd2,_0x3b727f){var _0x3795a6={};var _0xcb116d={};var _0x36c9a2;var _0x2570f9;return db['Dynamics365Configuration'][_0xef50('0x47')]({'where':{'id':_0x242c4d[_0xef50('0x3f')]['id']}})[_0xef50('0x23')](handleEntityNotFound(_0x1a9bd2,null))['then'](function(_0x24df5f){if(_0x24df5f){_0x36c9a2=_0x24df5f;_0xcb116d[_0xef50('0x33')]=_['keys'](db['Dynamics365Field'][_0xef50('0x2b')]);_0xcb116d[_0xef50('0x2e')]=_[_0xef50('0x2f')](_0x242c4d[_0xef50('0x2e')]);_0xcb116d[_0xef50('0x30')]=_['intersection'](_0xcb116d[_0xef50('0x33')],_0xcb116d[_0xef50('0x2e')]);_0x3795a6[_0xef50('0x32')]=_[_0xef50('0x31')](_0xcb116d[_0xef50('0x33')],qs[_0xef50('0x40')](_0x242c4d[_0xef50('0x2e')][_0xef50('0x40')]));_0x3795a6[_0xef50('0x32')]=_0x3795a6[_0xef50('0x32')]['length']?_0x3795a6['attributes']:_0xcb116d[_0xef50('0x33')];_0x3795a6[_0xef50('0x48')]=qs[_0xef50('0x49')](_0x242c4d['query'][_0xef50('0x49')]);_0x3795a6[_0xef50('0x37')]=qs[_0xef50('0x30')](_[_0xef50('0x4a')](_0x242c4d['query'],_0xcb116d['filters']));if(_0x242c4d['query'][_0xef50('0x36')]){_0x3795a6[_0xef50('0x37')]=_[_0xef50('0x38')](_0x3795a6[_0xef50('0x37')],{'$or':_[_0xef50('0x2d')](_0x3795a6['attributes'],function(_0x80f639){var _0x1a5a49={};_0x1a5a49[_0x80f639]={'$like':'%'+_0x242c4d[_0xef50('0x2e')][_0xef50('0x36')]+'%'};return _0x1a5a49;})});}_0x3795a6=_[_0xef50('0x38')]({},_0x3795a6,_0x242c4d['options']);return _0x36c9a2[_0xef50('0x4c')](_0x3795a6);}})[_0xef50('0x23')](function(_0x3bd139){if(_0x3bd139){_0x2570f9=_0x3bd139[_0xef50('0x34')];if(!_0x242c4d[_0xef50('0x2e')]['hasOwnProperty'](_0xef50('0x35'))){_0x3795a6[_0xef50('0x1e')]=qs[_0xef50('0x1e')](_0x242c4d[_0xef50('0x2e')][_0xef50('0x1e')]);_0x3795a6[_0xef50('0x1b')]=qs[_0xef50('0x1b')](_0x242c4d['query'][_0xef50('0x1b')]);}return _0x36c9a2[_0xef50('0x4c')](_0x3795a6);}})['then'](function(_0x15c661){if(_0x15c661){return _0x15c661?{'count':_0x2570f9,'rows':_0x15c661}:null;}})[_0xef50('0x23')](respondWithResult(_0x1a9bd2,null))[_0xef50('0x3d')](handleError(_0x1a9bd2,null));};exports[_0xef50('0x4d')]=function(_0x5c3eef,_0x1ee28f,_0x44be5c){var _0x28358a={};var _0xb0525e={};var _0x34b6a5;var _0x135624;return db[_0xef50('0x2a')]['findOne']({'where':{'id':_0x5c3eef[_0xef50('0x3f')]['id']}})[_0xef50('0x23')](handleEntityNotFound(_0x1ee28f,null))[_0xef50('0x23')](function(_0x54b7b9){if(_0x54b7b9){_0x34b6a5=_0x54b7b9;_0xb0525e['model']=_[_0xef50('0x2f')](db[_0xef50('0x4e')][_0xef50('0x2b')]);_0xb0525e[_0xef50('0x2e')]=_[_0xef50('0x2f')](_0x5c3eef[_0xef50('0x2e')]);_0xb0525e[_0xef50('0x30')]=_['intersection'](_0xb0525e[_0xef50('0x33')],_0xb0525e['query']);_0x28358a[_0xef50('0x32')]=_[_0xef50('0x31')](_0xb0525e['model'],qs[_0xef50('0x40')](_0x5c3eef[_0xef50('0x2e')][_0xef50('0x40')]));_0x28358a[_0xef50('0x32')]=_0x28358a[_0xef50('0x32')][_0xef50('0x34')]?_0x28358a['attributes']:_0xb0525e[_0xef50('0x33')];_0x28358a[_0xef50('0x48')]=qs[_0xef50('0x49')](_0x5c3eef[_0xef50('0x2e')]['sort']);_0x28358a[_0xef50('0x37')]=qs[_0xef50('0x30')](_[_0xef50('0x4a')](_0x5c3eef[_0xef50('0x2e')],_0xb0525e[_0xef50('0x30')]));if(_0x5c3eef[_0xef50('0x2e')]['filter']){_0x28358a['where']=_[_0xef50('0x38')](_0x28358a[_0xef50('0x37')],{'$or':_[_0xef50('0x2d')](_0x28358a['attributes'],function(_0x4ccac2){var _0x25ae14={};_0x25ae14[_0x4ccac2]={'$like':'%'+_0x5c3eef[_0xef50('0x2e')][_0xef50('0x36')]+'%'};return _0x25ae14;})});}_0x28358a=_[_0xef50('0x38')]({},_0x28358a,_0x5c3eef['options']);return _0x34b6a5[_0xef50('0x4d')](_0x28358a);}})[_0xef50('0x23')](function(_0x4bbca5){if(_0x4bbca5){_0x135624=_0x4bbca5['length'];if(!_0x5c3eef['query']['hasOwnProperty'](_0xef50('0x35'))){_0x28358a[_0xef50('0x1e')]=qs[_0xef50('0x1e')](_0x5c3eef[_0xef50('0x2e')]['limit']);_0x28358a['offset']=qs['offset'](_0x5c3eef[_0xef50('0x2e')]['offset']);}return _0x34b6a5[_0xef50('0x4d')](_0x28358a);}})[_0xef50('0x23')](function(_0x1b0e50){if(_0x1b0e50){return _0x1b0e50?{'count':_0x135624,'rows':_0x1b0e50}:null;}})[_0xef50('0x23')](respondWithResult(_0x1ee28f,null))[_0xef50('0x3d')](handleError(_0x1ee28f,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index 35e9115..a249de3 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 _0xe5b3=['request-promise','path','rimraf','../../config/environment','./intDynamics365Configuration.attributes','exports','define','int_dynamics365_configurations','util','../../config/logger','api','moment','bluebird'];(function(_0x256422,_0x367394){var _0x55dddc=function(_0x1594bc){while(--_0x1594bc){_0x256422['push'](_0x256422['shift']());}};_0x55dddc(++_0x367394);}(_0xe5b3,0x133));var _0x3e5b=function(_0x7c5b9f,_0x3bf190){_0x7c5b9f=_0x7c5b9f-0x0;var _0x1a086d=_0xe5b3[_0x7c5b9f];return _0x1a086d;};'use strict';var _=require('lodash');var util=require(_0x3e5b('0x0'));var logger=require(_0x3e5b('0x1'))(_0x3e5b('0x2'));var moment=require(_0x3e5b('0x3'));var BPromise=require(_0x3e5b('0x4'));var rp=require(_0x3e5b('0x5'));var fs=require('fs');var path=require(_0x3e5b('0x6'));var rimraf=require(_0x3e5b('0x7'));var config=require(_0x3e5b('0x8'));var attributes=require(_0x3e5b('0x9'));module[_0x3e5b('0xa')]=function(_0x54e1fb,_0x174923){return _0x54e1fb[_0x3e5b('0xb')]('Dynamics365Configuration',attributes,{'tableName':_0x3e5b('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xedd9=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./intDynamics365Configuration.attributes','exports','Dynamics365Configuration','util'];(function(_0xa4a0e3,_0x225003){var _0x5ae8cf=function(_0x14aa43){while(--_0x14aa43){_0xa4a0e3['push'](_0xa4a0e3['shift']());}};_0x5ae8cf(++_0x225003);}(_0xedd9,0xfc));var _0x9edd=function(_0x37dbe8,_0x10e968){_0x37dbe8=_0x37dbe8-0x0;var _0x2416b6=_0xedd9[_0x37dbe8];return _0x2416b6;};'use strict';var _=require('lodash');var util=require(_0x9edd('0x0'));var logger=require(_0x9edd('0x1'))(_0x9edd('0x2'));var moment=require(_0x9edd('0x3'));var BPromise=require(_0x9edd('0x4'));var rp=require(_0x9edd('0x5'));var fs=require('fs');var path=require(_0x9edd('0x6'));var rimraf=require(_0x9edd('0x7'));var config=require('../../config/environment');var attributes=require(_0x9edd('0x8'));module[_0x9edd('0x9')]=function(_0x268f9e,_0x34c1a7){return _0x268f9e['define'](_0x9edd('0xa'),attributes,{'tableName':'int_dynamics365_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js index fcf477e..fb2835b 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 _0xdcce=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','error','message','result','catch','util','moment','bluebird','randomstring'];(function(_0x4dda52,_0x518b89){var _0x44a777=function(_0x5be2bd){while(--_0x5be2bd){_0x4dda52['push'](_0x4dda52['shift']());}};_0x44a777(++_0x518b89);}(_0xdcce,0x11a));var _0xedcc=function(_0x387363,_0xd5dc2){_0x387363=_0x387363-0x0;var _0x4aeae3=_0xdcce[_0x387363];return _0x4aeae3;};'use strict';var _=require('lodash');var util=require(_0xedcc('0x0'));var moment=require(_0xedcc('0x1'));var BPromise=require(_0xedcc('0x2'));var rs=require(_0xedcc('0x3'));var fs=require('fs');var Redis=require(_0xedcc('0x4'));var db=require(_0xedcc('0x5'))['db'];var utils=require(_0xedcc('0x6'));var logger=require(_0xedcc('0x7'))(_0xedcc('0x8'));var config=require(_0xedcc('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xedcc('0xa')][_0xedcc('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4455e5,_0x5cb4f1,_0x19af37){return new BPromise(function(_0x10bb73,_0x4e3f44){return client[_0xedcc('0xc')](_0x4455e5,_0x19af37)[_0xedcc('0xd')](function(_0x5d3b07){logger['info'](_0xedcc('0xe'),_0x5cb4f1,_0xedcc('0xf'));logger[_0xedcc('0x10')](_0xedcc('0x11'),_0x5cb4f1,_0xedcc('0xf'),JSON['stringify'](_0x5d3b07));if(_0x5d3b07[_0xedcc('0x12')]){if(_0x5d3b07['error']['code']===0x1f4){logger[_0xedcc('0x12')](_0xedcc('0xe'),_0x5cb4f1,_0x5d3b07[_0xedcc('0x12')][_0xedcc('0x13')]);return _0x4e3f44(_0x5d3b07[_0xedcc('0x12')][_0xedcc('0x13')]);}logger['error'](_0xedcc('0xe'),_0x5cb4f1,_0x5d3b07[_0xedcc('0x12')][_0xedcc('0x13')]);return _0x10bb73(_0x5d3b07[_0xedcc('0x12')][_0xedcc('0x13')]);}else{logger['info']('Dynamics365Configuration,\x20%s,\x20%s',_0x5cb4f1,_0xedcc('0xf'));_0x10bb73(_0x5d3b07[_0xedcc('0x14')][_0xedcc('0x13')]);}})[_0xedcc('0x15')](function(_0x156de1){logger[_0xedcc('0x12')]('Dynamics365Configuration,\x20%s,\x20%s',_0x5cb4f1,_0x156de1);_0x4e3f44(_0x156de1);});});} \ No newline at end of file +var _0x9114=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment'];(function(_0x12e63e,_0x30f1f7){var _0x12ff60=function(_0x2a2354){while(--_0x2a2354){_0x12e63e['push'](_0x12e63e['shift']());}};_0x12ff60(++_0x30f1f7);}(_0x9114,0x75));var _0x4911=function(_0x47e397,_0xe3831e){_0x47e397=_0x47e397-0x0;var _0x3e3825=_0x9114[_0x47e397];return _0x3e3825;};'use strict';var _=require(_0x4911('0x0'));var util=require(_0x4911('0x1'));var moment=require(_0x4911('0x2'));var BPromise=require(_0x4911('0x3'));var rs=require(_0x4911('0x4'));var fs=require('fs');var Redis=require(_0x4911('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x4911('0x6'));var logger=require(_0x4911('0x7'))(_0x4911('0x8'));var config=require('../../config/environment');var jayson=require(_0x4911('0x9'));var client=jayson[_0x4911('0xa')][_0x4911('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4a3a57,_0x1e0e12,_0xce6c4f){return new BPromise(function(_0x4d8b52,_0x5b6031){return client[_0x4911('0xc')](_0x4a3a57,_0xce6c4f)[_0x4911('0xd')](function(_0xc3726f){logger[_0x4911('0xe')](_0x4911('0xf'),_0x1e0e12,_0x4911('0x10'));logger[_0x4911('0x11')](_0x4911('0x12'),_0x1e0e12,_0x4911('0x10'),JSON[_0x4911('0x13')](_0xc3726f));if(_0xc3726f[_0x4911('0x14')]){if(_0xc3726f[_0x4911('0x14')][_0x4911('0x15')]===0x1f4){logger[_0x4911('0x14')]('Dynamics365Configuration,\x20%s,\x20%s',_0x1e0e12,_0xc3726f['error'][_0x4911('0x16')]);return _0x5b6031(_0xc3726f[_0x4911('0x14')][_0x4911('0x16')]);}logger['error']('Dynamics365Configuration,\x20%s,\x20%s',_0x1e0e12,_0xc3726f[_0x4911('0x14')]['message']);return _0x4d8b52(_0xc3726f[_0x4911('0x14')][_0x4911('0x16')]);}else{logger[_0x4911('0xe')](_0x4911('0xf'),_0x1e0e12,_0x4911('0x10'));_0x4d8b52(_0xc3726f['result']['message']);}})[_0x4911('0x17')](function(_0x3563f7){logger[_0x4911('0x14')](_0x4911('0xf'),_0x1e0e12,_0x3563f7);_0x5b6031(_0x3563f7);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index b1c6328..421e412 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 _0x98c9=['delete','destroy','exports','multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','show','post','create','put','update'];(function(_0x25248b,_0x3c8491){var _0x509939=function(_0x457a27){while(--_0x457a27){_0x25248b['push'](_0x25248b['shift']());}};_0x509939(++_0x3c8491);}(_0x98c9,0x19b));var _0x998c=function(_0x326e79,_0x33dc91){_0x326e79=_0x326e79-0x0;var _0x37eb89=_0x98c9[_0x326e79];return _0x37eb89;};'use strict';var multer=require(_0x998c('0x0'));var util=require(_0x998c('0x1'));var path=require('path');var timeout=require(_0x998c('0x2'));var express=require(_0x998c('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x998c('0x4'));var interaction=require(_0x998c('0x5'));var config=require('../../config/environment');var controller=require('./intDynamics365Field.controller');router[_0x998c('0x6')]('/',auth[_0x998c('0x7')](),controller[_0x998c('0x8')]);router[_0x998c('0x6')]('/:id',auth[_0x998c('0x7')](),controller[_0x998c('0x9')]);router[_0x998c('0xa')]('/',auth['isAuthenticated'](),controller[_0x998c('0xb')]);router[_0x998c('0xc')]('/:id',auth[_0x998c('0x7')](),controller[_0x998c('0xd')]);router[_0x998c('0xe')]('/:id',auth[_0x998c('0x7')](),controller[_0x998c('0xf')]);module[_0x998c('0x10')]=router; \ No newline at end of file +var _0x4907=['Router','../../components/auth/service','../../config/environment','./intDynamics365Field.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x4cb241,_0x5de20a){var _0x3b6b11=function(_0x3bb54f){while(--_0x3bb54f){_0x4cb241['push'](_0x4cb241['shift']());}};_0x3b6b11(++_0x5de20a);}(_0x4907,0xaf));var _0x7490=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4907[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x7490('0x0'));var util=require(_0x7490('0x1'));var path=require(_0x7490('0x2'));var timeout=require(_0x7490('0x3'));var express=require(_0x7490('0x4'));var router=express[_0x7490('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x7490('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x7490('0x7'));var controller=require(_0x7490('0x8'));router[_0x7490('0x9')]('/',auth[_0x7490('0xa')](),controller[_0x7490('0xb')]);router['get'](_0x7490('0xc'),auth[_0x7490('0xa')](),controller[_0x7490('0xd')]);router[_0x7490('0xe')]('/',auth['isAuthenticated'](),controller[_0x7490('0xf')]);router[_0x7490('0x10')]('/:id',auth[_0x7490('0xa')](),controller[_0x7490('0x11')]);router['delete'](_0x7490('0xc'),auth[_0x7490('0xa')](),controller[_0x7490('0x12')]);module[_0x7490('0x13')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.attributes.js b/server/api/intDynamics365Field/intDynamics365Field.attributes.js index be50c7d..5f29d74 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 _0xf237=['sequelize','exports','ENUM','string','variable','customVariable','keyValue','picklist','STRING','BOOLEAN'];(function(_0x30de31,_0x3e36fa){var _0x418371=function(_0x25ffd8){while(--_0x25ffd8){_0x30de31['push'](_0x30de31['shift']());}};_0x418371(++_0x3e36fa);}(_0xf237,0x1d6));var _0x7f23=function(_0x5dbbbe,_0x44c170){_0x5dbbbe=_0x5dbbbe-0x0;var _0x2cb72b=_0xf237[_0x5dbbbe];return _0x2cb72b;};'use strict';var Sequelize=require(_0x7f23('0x0'));module[_0x7f23('0x1')]={'type':{'type':Sequelize[_0x7f23('0x2')](_0x7f23('0x3'),_0x7f23('0x4'),_0x7f23('0x5'),_0x7f23('0x6'),_0x7f23('0x7')),'defaultValue':_0x7f23('0x3')},'content':{'type':Sequelize[_0x7f23('0x8')]},'key':{'type':Sequelize[_0x7f23('0x8')]},'keyType':{'type':Sequelize[_0x7f23('0x2')]('string','variable',_0x7f23('0x5'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x7f23('0x8')]},'nameField':{'type':Sequelize[_0x7f23('0x8')]},'customField':{'type':Sequelize[_0x7f23('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x7f23('0x8')]}}; \ No newline at end of file +var _0xdf4c=['STRING','BOOLEAN','sequelize','exports','ENUM','customVariable','keyValue','picklist','string'];(function(_0x525c7b,_0x488fcc){var _0x27b33e=function(_0x56d43b){while(--_0x56d43b){_0x525c7b['push'](_0x525c7b['shift']());}};_0x27b33e(++_0x488fcc);}(_0xdf4c,0x65));var _0xcdf4=function(_0x4b5f91,_0x26c295){_0x4b5f91=_0x4b5f91-0x0;var _0x3c3a04=_0xdf4c[_0x4b5f91];return _0x3c3a04;};'use strict';var Sequelize=require(_0xcdf4('0x0'));module[_0xcdf4('0x1')]={'type':{'type':Sequelize[_0xcdf4('0x2')]('string','variable',_0xcdf4('0x3'),_0xcdf4('0x4'),_0xcdf4('0x5')),'defaultValue':_0xcdf4('0x6')},'content':{'type':Sequelize[_0xcdf4('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xcdf4('0x2')](_0xcdf4('0x6'),'variable','customVariable')},'keyContent':{'type':Sequelize[_0xcdf4('0x7')]},'idField':{'type':Sequelize[_0xcdf4('0x7')]},'nameField':{'type':Sequelize[_0xcdf4('0x7')]},'customField':{'type':Sequelize[_0xcdf4('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xcdf4('0x7')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.controller.js b/server/api/intDynamics365Field/intDynamics365Field.controller.js index 4d17709..0b02f52 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 _0x3986=['../../config/environment','../../config/license/util','sendStatus','end','status','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','map','Dynamics365Field','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','params','include','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','sox','to-csv','lodash','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils'];(function(_0x1ad487,_0x3e711d){var _0x39d539=function(_0x408f9c){while(--_0x408f9c){_0x1ad487['push'](_0x1ad487['shift']());}};_0x39d539(++_0x3e711d);}(_0x3986,0x1a2));var _0x6398=function(_0x2940c1,_0x3f8dc1){_0x2940c1=_0x2940c1-0x0;var _0xd59d9c=_0x3986[_0x2940c1];return _0xd59d9c;};'use strict';var emlformat=require(_0x6398('0x0'));var rimraf=require(_0x6398('0x1'));var zipdir=require(_0x6398('0x2'));var jsonpatch=require(_0x6398('0x3'));var rp=require(_0x6398('0x4'));var moment=require('moment');var BPromise=require(_0x6398('0x5'));var Mustache=require('mustache');var util=require(_0x6398('0x6'));var path=require('path');var sox=require(_0x6398('0x7'));var csv=require(_0x6398('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6398('0x9'));var squel=require('squel');var crypto=require(_0x6398('0xa'));var jsforce=require(_0x6398('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x6398('0x8'));var querystring=require(_0x6398('0xc'));var Papa=require(_0x6398('0xd'));var Redis=require('ioredis');var authService=require(_0x6398('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x6398('0xf'));var hardwareService=require(_0x6398('0x10'));var logger=require(_0x6398('0x11'))(_0x6398('0x12'));var utils=require(_0x6398('0x13'));var config=require(_0x6398('0x14'));var licenseUtil=require(_0x6398('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3d9988,_0x543fa0){_0x543fa0=_0x543fa0||0xcc;return function(_0x14f2fa){if(_0x14f2fa){return _0x3d9988[_0x6398('0x16')](_0x543fa0);}return _0x3d9988['status'](_0x543fa0)[_0x6398('0x17')]();};}function respondWithResult(_0x1be28c,_0x425fb7){_0x425fb7=_0x425fb7||0xc8;return function(_0x4d9a5e){if(_0x4d9a5e){return _0x1be28c[_0x6398('0x18')](_0x425fb7)[_0x6398('0x19')](_0x4d9a5e);}};}function respondWithFilteredResult(_0x2880d0,_0x400bdd){return function(_0x311da2){if(_0x311da2){var _0x3926a5=typeof _0x400bdd['offset']===_0x6398('0x1a')&&typeof _0x400bdd['limit']===_0x6398('0x1a');var _0x4b0fe1=_0x311da2[_0x6398('0x1b')];var _0x3f00ea=_0x3926a5?0x0:_0x400bdd[_0x6398('0x1c')];var _0x39b9a2=_0x3926a5?_0x311da2[_0x6398('0x1b')]:_0x400bdd['offset']+_0x400bdd[_0x6398('0x1d')];var _0x5d2e10;if(_0x39b9a2>=_0x4b0fe1){_0x39b9a2=_0x4b0fe1;_0x5d2e10=0xc8;}else{_0x5d2e10=0xce;}_0x2880d0[_0x6398('0x18')](_0x5d2e10);return _0x2880d0[_0x6398('0x1e')](_0x6398('0x1f'),_0x3f00ea+'-'+_0x39b9a2+'/'+_0x4b0fe1)['json'](_0x311da2);}return null;};}function patchUpdates(_0x37b41b){return function(_0x15cc83){try{jsonpatch[_0x6398('0x20')](_0x15cc83,_0x37b41b,!![]);}catch(_0x10e5a3){return BPromise[_0x6398('0x21')](_0x10e5a3);}return _0x15cc83[_0x6398('0x22')]();};}function saveUpdates(_0x41ea97,_0x2d2023){return function(_0x189b2e){if(_0x189b2e){return _0x189b2e[_0x6398('0x23')](_0x41ea97)[_0x6398('0x24')](function(_0x1687c4){return _0x1687c4;});}return null;};}function removeEntity(_0x137cdd,_0x1b3cdd){return function(_0x51e1bc){if(_0x51e1bc){return _0x51e1bc[_0x6398('0x25')]()['then'](function(){_0x137cdd['status'](0xcc)[_0x6398('0x17')]();});}};}function handleEntityNotFound(_0x8af719,_0x568d6e){return function(_0x2196cd){if(!_0x2196cd){_0x8af719['sendStatus'](0x194);}return _0x2196cd;};}function handleError(_0x46f3f0,_0x37ff54){_0x37ff54=_0x37ff54||0x1f4;return function(_0xb92de6){logger[_0x6398('0x26')](_0xb92de6[_0x6398('0x27')]);if(_0xb92de6['name']){delete _0xb92de6[_0x6398('0x28')];}_0x46f3f0['status'](_0x37ff54)[_0x6398('0x29')](_0xb92de6);};}exports['index']=function(_0x3e09dc,_0x4eebcb){var _0x2b0895={},_0x4a7042={},_0x48ddf8={'count':0x0,'rows':[]};var _0x357bc7=_[_0x6398('0x2a')](db[_0x6398('0x2b')][_0x6398('0x2c')],function(_0x15c44d){return{'name':_0x15c44d[_0x6398('0x2d')],'type':_0x15c44d[_0x6398('0x2e')][_0x6398('0x2f')]};});_0x4a7042[_0x6398('0x30')]=_[_0x6398('0x2a')](_0x357bc7,_0x6398('0x28'));_0x4a7042[_0x6398('0x31')]=_[_0x6398('0x32')](_0x3e09dc[_0x6398('0x31')]);_0x4a7042[_0x6398('0x33')]=_[_0x6398('0x34')](_0x4a7042[_0x6398('0x30')],_0x4a7042[_0x6398('0x31')]);_0x2b0895[_0x6398('0x35')]=_[_0x6398('0x34')](_0x4a7042['model'],qs[_0x6398('0x36')](_0x3e09dc[_0x6398('0x31')][_0x6398('0x36')]));_0x2b0895[_0x6398('0x35')]=_0x2b0895[_0x6398('0x35')][_0x6398('0x37')]?_0x2b0895[_0x6398('0x35')]:_0x4a7042['model'];if(!_0x3e09dc['query']['hasOwnProperty'](_0x6398('0x38'))){_0x2b0895[_0x6398('0x1d')]=qs[_0x6398('0x1d')](_0x3e09dc[_0x6398('0x31')]['limit']);_0x2b0895[_0x6398('0x1c')]=qs[_0x6398('0x1c')](_0x3e09dc['query'][_0x6398('0x1c')]);}_0x2b0895[_0x6398('0x39')]=qs[_0x6398('0x3a')](_0x3e09dc['query'][_0x6398('0x3a')]);_0x2b0895[_0x6398('0x3b')]=qs[_0x6398('0x33')](_['pick'](_0x3e09dc['query'],_0x4a7042['filters']),_0x357bc7);if(_0x3e09dc[_0x6398('0x31')][_0x6398('0x3c')]){_0x2b0895['where']=_[_0x6398('0x3d')](_0x2b0895[_0x6398('0x3b')],{'$or':_['map'](_0x357bc7,function(_0x5da619){if(_0x5da619['type']!==_0x6398('0x3e')){var _0x301b39={};_0x301b39[_0x5da619['name']]={'$like':'%'+_0x3e09dc[_0x6398('0x31')][_0x6398('0x3c')]+'%'};return _0x301b39;}})});}_0x2b0895=_[_0x6398('0x3d')]({},_0x2b0895,_0x3e09dc[_0x6398('0x3f')]);var _0x3e2964={'where':_0x2b0895[_0x6398('0x3b')]};return db[_0x6398('0x2b')][_0x6398('0x1b')](_0x3e2964)['then'](function(_0x54d889){_0x48ddf8[_0x6398('0x1b')]=_0x54d889;if(_0x3e09dc['query'][_0x6398('0x40')]){_0x2b0895['include']=[{'all':!![]}];}return db[_0x6398('0x2b')][_0x6398('0x41')](_0x2b0895);})[_0x6398('0x24')](function(_0xfcd83b){_0x48ddf8[_0x6398('0x42')]=_0xfcd83b;return _0x48ddf8;})[_0x6398('0x24')](respondWithFilteredResult(_0x4eebcb,_0x2b0895))[_0x6398('0x43')](handleError(_0x4eebcb,null));};exports['show']=function(_0x3b78b8,_0x4c42a0){var _0x2612fb={'raw':!![],'where':{'id':_0x3b78b8[_0x6398('0x44')]['id']}},_0x15b2f1={};_0x15b2f1[_0x6398('0x30')]=_[_0x6398('0x32')](db[_0x6398('0x2b')][_0x6398('0x2c')]);_0x15b2f1[_0x6398('0x31')]=_[_0x6398('0x32')](_0x3b78b8['query']);_0x15b2f1[_0x6398('0x33')]=_[_0x6398('0x34')](_0x15b2f1[_0x6398('0x30')],_0x15b2f1[_0x6398('0x31')]);_0x2612fb['attributes']=_['intersection'](_0x15b2f1[_0x6398('0x30')],qs[_0x6398('0x36')](_0x3b78b8['query'][_0x6398('0x36')]));_0x2612fb[_0x6398('0x35')]=_0x2612fb['attributes'][_0x6398('0x37')]?_0x2612fb['attributes']:_0x15b2f1[_0x6398('0x30')];if(_0x3b78b8[_0x6398('0x31')]['includeAll']){_0x2612fb[_0x6398('0x45')]=[{'all':!![]}];}_0x2612fb=_['merge']({},_0x2612fb,_0x3b78b8[_0x6398('0x3f')]);return db[_0x6398('0x2b')][_0x6398('0x46')](_0x2612fb)[_0x6398('0x24')](handleEntityNotFound(_0x4c42a0,null))['then'](respondWithResult(_0x4c42a0,null))[_0x6398('0x43')](handleError(_0x4c42a0,null));};exports[_0x6398('0x47')]=function(_0x2714b8,_0x3ff510){return db[_0x6398('0x2b')][_0x6398('0x47')](_0x2714b8['body'],{})[_0x6398('0x24')](respondWithResult(_0x3ff510,0xc9))[_0x6398('0x43')](handleError(_0x3ff510,null));};exports['update']=function(_0x420e1c,_0x54772c){if(_0x420e1c[_0x6398('0x48')]['id']){delete _0x420e1c['body']['id'];}return db[_0x6398('0x2b')][_0x6398('0x46')]({'where':{'id':_0x420e1c[_0x6398('0x44')]['id']}})[_0x6398('0x24')](handleEntityNotFound(_0x54772c,null))[_0x6398('0x24')](saveUpdates(_0x420e1c['body'],null))[_0x6398('0x24')](respondWithResult(_0x54772c,null))[_0x6398('0x43')](handleError(_0x54772c,null));};exports['destroy']=function(_0x405501,_0x533fb0){return db[_0x6398('0x2b')]['find']({'where':{'id':_0x405501[_0x6398('0x44')]['id']}})[_0x6398('0x24')](handleEntityNotFound(_0x533fb0,null))['then'](removeEntity(_0x533fb0,null))[_0x6398('0x43')](handleError(_0x533fb0,null));}; \ No newline at end of file +var _0xef02=['ejs','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','sendStatus','end','status','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','error','stack','name','index','map','Dynamics365Field','fieldName','type','key','keys','query','filters','model','attributes','intersection','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv'];(function(_0x55957e,_0x2d1769){var _0x37b31b=function(_0x48ba79){while(--_0x48ba79){_0x55957e['push'](_0x55957e['shift']());}};_0x37b31b(++_0x2d1769);}(_0xef02,0x87));var _0x2ef0=function(_0x567bcb,_0x4978c1){_0x567bcb=_0x567bcb-0x0;var _0x4eebc2=_0xef02[_0x567bcb];return _0x4eebc2;};'use strict';var emlformat=require(_0x2ef0('0x0'));var rimraf=require(_0x2ef0('0x1'));var zipdir=require(_0x2ef0('0x2'));var jsonpatch=require(_0x2ef0('0x3'));var rp=require('request-promise');var moment=require(_0x2ef0('0x4'));var BPromise=require(_0x2ef0('0x5'));var Mustache=require(_0x2ef0('0x6'));var util=require(_0x2ef0('0x7'));var path=require(_0x2ef0('0x8'));var sox=require(_0x2ef0('0x9'));var csv=require(_0x2ef0('0xa'));var ejs=require(_0x2ef0('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2ef0('0xc'));var squel=require(_0x2ef0('0xd'));var crypto=require(_0x2ef0('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x2ef0('0xf'));var toCsv=require(_0x2ef0('0xa'));var querystring=require('querystring');var Papa=require(_0x2ef0('0x10'));var Redis=require(_0x2ef0('0x11'));var authService=require(_0x2ef0('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x2ef0('0x13'));var hardwareService=require(_0x2ef0('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x2ef0('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xbf8e8f,_0x550638){_0x550638=_0x550638||0xcc;return function(_0x25f638){if(_0x25f638){return _0xbf8e8f[_0x2ef0('0x16')](_0x550638);}return _0xbf8e8f['status'](_0x550638)[_0x2ef0('0x17')]();};}function respondWithResult(_0xc204b3,_0xb5a219){_0xb5a219=_0xb5a219||0xc8;return function(_0x270f83){if(_0x270f83){return _0xc204b3[_0x2ef0('0x18')](_0xb5a219)[_0x2ef0('0x19')](_0x270f83);}};}function respondWithFilteredResult(_0x41a080,_0x2f61fa){return function(_0x4de20d){if(_0x4de20d){var _0x599bf2=typeof _0x2f61fa[_0x2ef0('0x1a')]===_0x2ef0('0x1b')&&typeof _0x2f61fa[_0x2ef0('0x1c')]===_0x2ef0('0x1b');var _0x3a23ef=_0x4de20d[_0x2ef0('0x1d')];var _0x4781e4=_0x599bf2?0x0:_0x2f61fa[_0x2ef0('0x1a')];var _0x7799eb=_0x599bf2?_0x4de20d[_0x2ef0('0x1d')]:_0x2f61fa[_0x2ef0('0x1a')]+_0x2f61fa[_0x2ef0('0x1c')];var _0x5a4adf;if(_0x7799eb>=_0x3a23ef){_0x7799eb=_0x3a23ef;_0x5a4adf=0xc8;}else{_0x5a4adf=0xce;}_0x41a080[_0x2ef0('0x18')](_0x5a4adf);return _0x41a080[_0x2ef0('0x1e')]('Content-Range',_0x4781e4+'-'+_0x7799eb+'/'+_0x3a23ef)['json'](_0x4de20d);}return null;};}function patchUpdates(_0x196ded){return function(_0xe23d2c){try{jsonpatch[_0x2ef0('0x1f')](_0xe23d2c,_0x196ded,!![]);}catch(_0x5a00a7){return BPromise[_0x2ef0('0x20')](_0x5a00a7);}return _0xe23d2c[_0x2ef0('0x21')]();};}function saveUpdates(_0x5cbcc5,_0x41bd58){return function(_0x5a6e35){if(_0x5a6e35){return _0x5a6e35[_0x2ef0('0x22')](_0x5cbcc5)[_0x2ef0('0x23')](function(_0x244e98){return _0x244e98;});}return null;};}function removeEntity(_0x5462cd,_0x560f68){return function(_0x29e095){if(_0x29e095){return _0x29e095[_0x2ef0('0x24')]()[_0x2ef0('0x23')](function(){_0x5462cd[_0x2ef0('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x235770,_0x5da1dd){return function(_0x3ba431){if(!_0x3ba431){_0x235770[_0x2ef0('0x16')](0x194);}return _0x3ba431;};}function handleError(_0x397a3d,_0xa7ef5a){_0xa7ef5a=_0xa7ef5a||0x1f4;return function(_0x8a4f71){logger[_0x2ef0('0x25')](_0x8a4f71[_0x2ef0('0x26')]);if(_0x8a4f71[_0x2ef0('0x27')]){delete _0x8a4f71[_0x2ef0('0x27')];}_0x397a3d[_0x2ef0('0x18')](_0xa7ef5a)['send'](_0x8a4f71);};}exports[_0x2ef0('0x28')]=function(_0x1cf945,_0x391393){var _0x32d6ba={},_0x575935={},_0x451b73={'count':0x0,'rows':[]};var _0xe9035f=_[_0x2ef0('0x29')](db[_0x2ef0('0x2a')]['rawAttributes'],function(_0x838599){return{'name':_0x838599[_0x2ef0('0x2b')],'type':_0x838599[_0x2ef0('0x2c')][_0x2ef0('0x2d')]};});_0x575935['model']=_[_0x2ef0('0x29')](_0xe9035f,_0x2ef0('0x27'));_0x575935['query']=_[_0x2ef0('0x2e')](_0x1cf945[_0x2ef0('0x2f')]);_0x575935[_0x2ef0('0x30')]=_['intersection'](_0x575935[_0x2ef0('0x31')],_0x575935['query']);_0x32d6ba[_0x2ef0('0x32')]=_[_0x2ef0('0x33')](_0x575935[_0x2ef0('0x31')],qs[_0x2ef0('0x34')](_0x1cf945[_0x2ef0('0x2f')][_0x2ef0('0x34')]));_0x32d6ba['attributes']=_0x32d6ba[_0x2ef0('0x32')][_0x2ef0('0x35')]?_0x32d6ba[_0x2ef0('0x32')]:_0x575935[_0x2ef0('0x31')];if(!_0x1cf945[_0x2ef0('0x2f')]['hasOwnProperty'](_0x2ef0('0x36'))){_0x32d6ba[_0x2ef0('0x1c')]=qs['limit'](_0x1cf945[_0x2ef0('0x2f')][_0x2ef0('0x1c')]);_0x32d6ba['offset']=qs[_0x2ef0('0x1a')](_0x1cf945[_0x2ef0('0x2f')][_0x2ef0('0x1a')]);}_0x32d6ba[_0x2ef0('0x37')]=qs[_0x2ef0('0x38')](_0x1cf945[_0x2ef0('0x2f')][_0x2ef0('0x38')]);_0x32d6ba[_0x2ef0('0x39')]=qs[_0x2ef0('0x30')](_[_0x2ef0('0x3a')](_0x1cf945['query'],_0x575935[_0x2ef0('0x30')]),_0xe9035f);if(_0x1cf945['query'][_0x2ef0('0x3b')]){_0x32d6ba[_0x2ef0('0x39')]=_[_0x2ef0('0x3c')](_0x32d6ba['where'],{'$or':_['map'](_0xe9035f,function(_0x84661f){if(_0x84661f[_0x2ef0('0x2c')]!==_0x2ef0('0x3d')){var _0x4fc5c0={};_0x4fc5c0[_0x84661f[_0x2ef0('0x27')]]={'$like':'%'+_0x1cf945['query']['filter']+'%'};return _0x4fc5c0;}})});}_0x32d6ba=_[_0x2ef0('0x3c')]({},_0x32d6ba,_0x1cf945[_0x2ef0('0x3e')]);var _0x12ec80={'where':_0x32d6ba[_0x2ef0('0x39')]};return db['Dynamics365Field'][_0x2ef0('0x1d')](_0x12ec80)[_0x2ef0('0x23')](function(_0x116130){_0x451b73[_0x2ef0('0x1d')]=_0x116130;if(_0x1cf945[_0x2ef0('0x2f')][_0x2ef0('0x3f')]){_0x32d6ba[_0x2ef0('0x40')]=[{'all':!![]}];}return db['Dynamics365Field'][_0x2ef0('0x41')](_0x32d6ba);})[_0x2ef0('0x23')](function(_0x632966){_0x451b73[_0x2ef0('0x42')]=_0x632966;return _0x451b73;})[_0x2ef0('0x23')](respondWithFilteredResult(_0x391393,_0x32d6ba))[_0x2ef0('0x43')](handleError(_0x391393,null));};exports[_0x2ef0('0x44')]=function(_0x3b48df,_0x3b4a7e){var _0x1f9b28={'raw':!![],'where':{'id':_0x3b48df[_0x2ef0('0x45')]['id']}},_0xc1ebde={};_0xc1ebde['model']=_['keys'](db[_0x2ef0('0x2a')]['rawAttributes']);_0xc1ebde[_0x2ef0('0x2f')]=_[_0x2ef0('0x2e')](_0x3b48df['query']);_0xc1ebde['filters']=_[_0x2ef0('0x33')](_0xc1ebde[_0x2ef0('0x31')],_0xc1ebde['query']);_0x1f9b28[_0x2ef0('0x32')]=_['intersection'](_0xc1ebde[_0x2ef0('0x31')],qs[_0x2ef0('0x34')](_0x3b48df[_0x2ef0('0x2f')][_0x2ef0('0x34')]));_0x1f9b28[_0x2ef0('0x32')]=_0x1f9b28[_0x2ef0('0x32')][_0x2ef0('0x35')]?_0x1f9b28[_0x2ef0('0x32')]:_0xc1ebde[_0x2ef0('0x31')];if(_0x3b48df['query'][_0x2ef0('0x3f')]){_0x1f9b28[_0x2ef0('0x40')]=[{'all':!![]}];}_0x1f9b28=_[_0x2ef0('0x3c')]({},_0x1f9b28,_0x3b48df[_0x2ef0('0x3e')]);return db[_0x2ef0('0x2a')][_0x2ef0('0x46')](_0x1f9b28)[_0x2ef0('0x23')](handleEntityNotFound(_0x3b4a7e,null))[_0x2ef0('0x23')](respondWithResult(_0x3b4a7e,null))[_0x2ef0('0x43')](handleError(_0x3b4a7e,null));};exports['create']=function(_0x271d63,_0x5919b7){return db[_0x2ef0('0x2a')][_0x2ef0('0x47')](_0x271d63[_0x2ef0('0x48')],{})[_0x2ef0('0x23')](respondWithResult(_0x5919b7,0xc9))['catch'](handleError(_0x5919b7,null));};exports[_0x2ef0('0x22')]=function(_0x24284a,_0x2eb266){if(_0x24284a[_0x2ef0('0x48')]['id']){delete _0x24284a[_0x2ef0('0x48')]['id'];}return db[_0x2ef0('0x2a')][_0x2ef0('0x46')]({'where':{'id':_0x24284a[_0x2ef0('0x45')]['id']}})[_0x2ef0('0x23')](handleEntityNotFound(_0x2eb266,null))[_0x2ef0('0x23')](saveUpdates(_0x24284a[_0x2ef0('0x48')],null))['then'](respondWithResult(_0x2eb266,null))[_0x2ef0('0x43')](handleError(_0x2eb266,null));};exports[_0x2ef0('0x24')]=function(_0x473b06,_0xf2ae3d){return db['Dynamics365Field'][_0x2ef0('0x46')]({'where':{'id':_0x473b06[_0x2ef0('0x45')]['id']}})[_0x2ef0('0x23')](handleEntityNotFound(_0xf2ae3d,null))[_0x2ef0('0x23')](removeEntity(_0xf2ae3d,null))[_0x2ef0('0x43')](handleError(_0xf2ae3d,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index cf894fb..92076ca 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 _0xe117=['./intDynamics365Field.attributes','exports','int_dynamics365_fields','dynamics365_unique_index','lodash','util','api','moment','bluebird','rimraf','../../config/environment'];(function(_0x4d606f,_0x5b3469){var _0x5a8182=function(_0x58fdb5){while(--_0x58fdb5){_0x4d606f['push'](_0x4d606f['shift']());}};_0x5a8182(++_0x5b3469);}(_0xe117,0xbf));var _0x7e11=function(_0x2f596a,_0x45b473){_0x2f596a=_0x2f596a-0x0;var _0x2639e4=_0xe117[_0x2f596a];return _0x2639e4;};'use strict';var _=require(_0x7e11('0x0'));var util=require(_0x7e11('0x1'));var logger=require('../../config/logger')(_0x7e11('0x2'));var moment=require(_0x7e11('0x3'));var BPromise=require(_0x7e11('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x7e11('0x5'));var config=require(_0x7e11('0x6'));var attributes=require(_0x7e11('0x7'));module[_0x7e11('0x8')]=function(_0x9372a5,_0x59b118){return _0x9372a5['define']('Dynamics365Field',attributes,{'tableName':_0x7e11('0x9'),'paranoid':![],'indexes':[{'name':_0x7e11('0xa'),'fields':['idField','FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x97d5=['moment','bluebird','path','rimraf','../../config/environment','exports','define','Dynamics365Field','dynamics365_unique_index','idField','lodash','util'];(function(_0x249564,_0x4af855){var _0x2e71ef=function(_0x3a56c5){while(--_0x3a56c5){_0x249564['push'](_0x249564['shift']());}};_0x2e71ef(++_0x4af855);}(_0x97d5,0x112));var _0x597d=function(_0x38fcee,_0x250061){_0x38fcee=_0x38fcee-0x0;var _0x2b1e5a=_0x97d5[_0x38fcee];return _0x2b1e5a;};'use strict';var _=require(_0x597d('0x0'));var util=require(_0x597d('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x597d('0x2'));var BPromise=require(_0x597d('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x597d('0x4'));var rimraf=require(_0x597d('0x5'));var config=require(_0x597d('0x6'));var attributes=require('./intDynamics365Field.attributes');module[_0x597d('0x7')]=function(_0x306ab5,_0x3ce894){return _0x306ab5[_0x597d('0x8')](_0x597d('0x9'),attributes,{'tableName':'int_dynamics365_fields','paranoid':![],'indexes':[{'name':_0x597d('0xa'),'fields':[_0x597d('0xb'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.rpc.js b/server/api/intDynamics365Field/intDynamics365Field.rpc.js index b14b049..2c13778 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 _0xacf3=['request\x20sent','debug','stringify','error','code','message','result','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Dynamics365Field,\x20%s,\x20%s'];(function(_0x5288be,_0xe4607e){var _0x1d1d13=function(_0x7b6979){while(--_0x7b6979){_0x5288be['push'](_0x5288be['shift']());}};_0x1d1d13(++_0xe4607e);}(_0xacf3,0xe3));var _0x3acf=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xacf3[_0x4565bf];return _0x5610ba;};'use strict';var _=require(_0x3acf('0x0'));var util=require(_0x3acf('0x1'));var moment=require('moment');var BPromise=require(_0x3acf('0x2'));var rs=require(_0x3acf('0x3'));var fs=require('fs');var Redis=require(_0x3acf('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x3acf('0x5'));var logger=require(_0x3acf('0x6'))(_0x3acf('0x7'));var config=require(_0x3acf('0x8'));var jayson=require(_0x3acf('0x9'));var client=jayson['client'][_0x3acf('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x235fde,_0x382c04,_0x283b4d){return new BPromise(function(_0x1be2d6,_0x4ac94f){return client[_0x3acf('0xb')](_0x235fde,_0x283b4d)[_0x3acf('0xc')](function(_0x3ebe3b){logger[_0x3acf('0xd')](_0x3acf('0xe'),_0x382c04,_0x3acf('0xf'));logger[_0x3acf('0x10')]('Dynamics365Field,\x20%s,\x20%s,\x20%s',_0x382c04,_0x3acf('0xf'),JSON[_0x3acf('0x11')](_0x3ebe3b));if(_0x3ebe3b[_0x3acf('0x12')]){if(_0x3ebe3b[_0x3acf('0x12')][_0x3acf('0x13')]===0x1f4){logger['error'](_0x3acf('0xe'),_0x382c04,_0x3ebe3b[_0x3acf('0x12')][_0x3acf('0x14')]);return _0x4ac94f(_0x3ebe3b[_0x3acf('0x12')][_0x3acf('0x14')]);}logger[_0x3acf('0x12')](_0x3acf('0xe'),_0x382c04,_0x3ebe3b['error'][_0x3acf('0x14')]);return _0x1be2d6(_0x3ebe3b[_0x3acf('0x12')][_0x3acf('0x14')]);}else{logger[_0x3acf('0xd')](_0x3acf('0xe'),_0x382c04,_0x3acf('0xf'));_0x1be2d6(_0x3ebe3b[_0x3acf('0x15')][_0x3acf('0x14')]);}})['catch'](function(_0x35fd05){logger[_0x3acf('0x12')](_0x3acf('0xe'),_0x382c04,_0x35fd05);_0x4ac94f(_0x35fd05);});});} \ No newline at end of file +var _0x799c=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','request\x20sent','Dynamics365Field,\x20%s,\x20%s,\x20%s','stringify','error','code','Dynamics365Field,\x20%s,\x20%s','message','result','catch','lodash','util'];(function(_0x4046fd,_0x290274){var _0x47ab97=function(_0x167c1c){while(--_0x167c1c){_0x4046fd['push'](_0x4046fd['shift']());}};_0x47ab97(++_0x290274);}(_0x799c,0xe4));var _0xc799=function(_0xd2b1d0,_0x5b3b08){_0xd2b1d0=_0xd2b1d0-0x0;var _0x4dbcc4=_0x799c[_0xd2b1d0];return _0x4dbcc4;};'use strict';var _=require(_0xc799('0x0'));var util=require(_0xc799('0x1'));var moment=require('moment');var BPromise=require(_0xc799('0x2'));var rs=require(_0xc799('0x3'));var fs=require('fs');var Redis=require(_0xc799('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xc799('0x5'));var logger=require(_0xc799('0x6'))(_0xc799('0x7'));var config=require('../../config/environment');var jayson=require(_0xc799('0x8'));var client=jayson[_0xc799('0x9')][_0xc799('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x596d51,_0x4867b9,_0x3402c4){return new BPromise(function(_0x1d2787,_0x266d62){return client[_0xc799('0xb')](_0x596d51,_0x3402c4)[_0xc799('0xc')](function(_0x356a80){logger[_0xc799('0xd')]('Dynamics365Field,\x20%s,\x20%s',_0x4867b9,_0xc799('0xe'));logger['debug'](_0xc799('0xf'),_0x4867b9,_0xc799('0xe'),JSON[_0xc799('0x10')](_0x356a80));if(_0x356a80[_0xc799('0x11')]){if(_0x356a80['error'][_0xc799('0x12')]===0x1f4){logger[_0xc799('0x11')](_0xc799('0x13'),_0x4867b9,_0x356a80['error'][_0xc799('0x14')]);return _0x266d62(_0x356a80[_0xc799('0x11')]['message']);}logger[_0xc799('0x11')](_0xc799('0x13'),_0x4867b9,_0x356a80[_0xc799('0x11')][_0xc799('0x14')]);return _0x1d2787(_0x356a80[_0xc799('0x11')][_0xc799('0x14')]);}else{logger['info'](_0xc799('0x13'),_0x4867b9,_0xc799('0xe'));_0x1d2787(_0x356a80[_0xc799('0x15')]['message']);}})[_0xc799('0x16')](function(_0x466a62){logger[_0xc799('0x11')](_0xc799('0x13'),_0x4867b9,_0x466a62);_0x266d62(_0x466a62);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index 5fb2975..b764904 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 _0x9fd9=['put','/:id','delete','destroy','multer','util','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intFreshdeskAccount.controller','get','isAuthenticated','show','/:id/fields','getFields','post','create','/:id/configurations','addConfiguration'];(function(_0x562450,_0x59cc7e){var _0x4b6da1=function(_0x8f5f71){while(--_0x8f5f71){_0x562450['push'](_0x562450['shift']());}};_0x4b6da1(++_0x59cc7e);}(_0x9fd9,0x17e));var _0x99fd=function(_0x24d1d5,_0x125999){_0x24d1d5=_0x24d1d5-0x0;var _0x249f15=_0x9fd9[_0x24d1d5];return _0x249f15;};'use strict';var multer=require(_0x99fd('0x0'));var util=require(_0x99fd('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x99fd('0x2'));var router=express[_0x99fd('0x3')]();var fs_extra=require(_0x99fd('0x4'));var auth=require(_0x99fd('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x99fd('0x6'));var controller=require(_0x99fd('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x99fd('0x8')]('/:id',auth[_0x99fd('0x9')](),controller[_0x99fd('0xa')]);router[_0x99fd('0x8')]('/:id/configurations',auth[_0x99fd('0x9')](),controller['getConfigurations']);router[_0x99fd('0x8')](_0x99fd('0xb'),auth[_0x99fd('0x9')](),controller[_0x99fd('0xc')]);router[_0x99fd('0xd')]('/',auth[_0x99fd('0x9')](),controller[_0x99fd('0xe')]);router['post'](_0x99fd('0xf'),auth[_0x99fd('0x9')](),controller[_0x99fd('0x10')]);router[_0x99fd('0x11')](_0x99fd('0x12'),auth[_0x99fd('0x9')](),controller['update']);router[_0x99fd('0x13')](_0x99fd('0x12'),auth['isAuthenticated'](),controller[_0x99fd('0x14')]);module['exports']=router; \ No newline at end of file +var _0xf83a=['addConfiguration','/:id','update','delete','destroy','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','show','/:id/configurations','isAuthenticated','getConfigurations','getFields','create','post'];(function(_0x4ae4ea,_0x327b6c){var _0x45dfe7=function(_0x3a7f75){while(--_0x3a7f75){_0x4ae4ea['push'](_0x4ae4ea['shift']());}};_0x45dfe7(++_0x327b6c);}(_0xf83a,0x1a8));var _0xaf83=function(_0x173441,_0x26b0d9){_0x173441=_0x173441-0x0;var _0x2423a8=_0xf83a[_0x173441];return _0x2423a8;};'use strict';var multer=require('multer');var util=require(_0xaf83('0x0'));var path=require(_0xaf83('0x1'));var timeout=require(_0xaf83('0x2'));var express=require('express');var router=express[_0xaf83('0x3')]();var fs_extra=require(_0xaf83('0x4'));var auth=require(_0xaf83('0x5'));var interaction=require(_0xaf83('0x6'));var config=require(_0xaf83('0x7'));var controller=require('./intFreshdeskAccount.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xaf83('0x8')]('/:id',auth['isAuthenticated'](),controller[_0xaf83('0x9')]);router[_0xaf83('0x8')](_0xaf83('0xa'),auth[_0xaf83('0xb')](),controller[_0xaf83('0xc')]);router[_0xaf83('0x8')]('/:id/fields',auth[_0xaf83('0xb')](),controller[_0xaf83('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0xaf83('0xe')]);router[_0xaf83('0xf')](_0xaf83('0xa'),auth[_0xaf83('0xb')](),controller[_0xaf83('0x10')]);router['put'](_0xaf83('0x11'),auth[_0xaf83('0xb')](),controller[_0xaf83('0x12')]);router[_0xaf83('0x13')](_0xaf83('0x11'),auth[_0xaf83('0xb')](),controller[_0xaf83('0x14')]);module[_0xaf83('0x15')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js index a2c6437..0f8211d 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 _0x0120=['remoteUri','sequelize','exports','STRING','username'];(function(_0x5ebbef,_0x2a7642){var _0x40db15=function(_0x60e7e5){while(--_0x60e7e5){_0x5ebbef['push'](_0x5ebbef['shift']());}};_0x40db15(++_0x2a7642);}(_0x0120,0x6f));var _0x0012=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x0120[_0x501510];return _0x1e6ee5;};'use strict';var Sequelize=require(_0x0012('0x0'));module[_0x0012('0x1')]={'name':{'type':Sequelize[_0x0012('0x2')]},'description':{'type':Sequelize[_0x0012('0x2')]},'username':{'type':Sequelize[_0x0012('0x2')],'unique':_0x0012('0x3')},'apiKey':{'type':Sequelize[_0x0012('0x2')]},'remoteUri':{'type':Sequelize[_0x0012('0x2')],'unique':_0x0012('0x4')},'serverUrl':{'type':Sequelize[_0x0012('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x4888=['exports','STRING','username'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0x4888,0x198));var _0x8488=function(_0x3893da,_0x22bffb){_0x3893da=_0x3893da-0x0;var _0x1c3533=_0x4888[_0x3893da];return _0x1c3533;};'use strict';var Sequelize=require('sequelize');module[_0x8488('0x0')]={'name':{'type':Sequelize[_0x8488('0x1')]},'description':{'type':Sequelize[_0x8488('0x1')]},'username':{'type':Sequelize[_0x8488('0x1')],'unique':_0x8488('0x2')},'apiKey':{'type':Sequelize[_0x8488('0x1')]},'remoteUri':{'type':Sequelize[_0x8488('0x1')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0x8488('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js index 883235a..994d994 100644 --- a/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js +++ b/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x082b=['choices','capitalize','test','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','json','offset','undefined','limit','Content-Range','save','update','destroy','then','end','stack','name','send','index','map','FreshdeskAccount','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','nolimit','order','where','pick','merge','VIRTUAL','filter','count','includeAll','include','findAll','rows','catch','show','params','keys','rawAttributes','options','find','create','body','getConfigurations','findOne','FreshdeskConfiguration','sort','hasOwnProperty','addConfiguration','AccountId','getSubjects','channel','Descriptions','getDescriptions','FreshdeskField','Subjects','getFields','remoteUri','apiKey','slice','lastIndexOf','format','%s/%s','api/v2/ticket_fields','Basic\x20%s','%s:X','toString','base64','requester','subject','agent','description','priority','group','source','company','remove','default','custom_text','custom_dropdown','label'];(function(_0x434804,_0x415f68){var _0x573fc8=function(_0x3ce265){while(--_0x3ce265){_0x434804['push'](_0x434804['shift']());}};_0x573fc8(++_0x415f68);}(_0x082b,0x1ec));var _0xb082=function(_0x44c15e,_0x96ed4c){_0x44c15e=_0x44c15e-0x0;var _0x13fc14=_0x082b[_0x44c15e];return _0x13fc14;};'use strict';var emlformat=require(_0xb082('0x0'));var rimraf=require(_0xb082('0x1'));var zipdir=require(_0xb082('0x2'));var jsonpatch=require(_0xb082('0x3'));var rp=require('request-promise');var moment=require(_0xb082('0x4'));var BPromise=require(_0xb082('0x5'));var Mustache=require('mustache');var util=require(_0xb082('0x6'));var path=require(_0xb082('0x7'));var sox=require('sox');var csv=require(_0xb082('0x8'));var ejs=require(_0xb082('0x9'));var fs=require('fs');var fs_extra=require(_0xb082('0xa'));var _=require(_0xb082('0xb'));var squel=require('squel');var crypto=require(_0xb082('0xc'));var jsforce=require(_0xb082('0xd'));var deskjs=require(_0xb082('0xe'));var toCsv=require('to-csv');var querystring=require(_0xb082('0xf'));var Papa=require(_0xb082('0x10'));var Redis=require(_0xb082('0x11'));var authService=require(_0xb082('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xb082('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb082('0x14'))(_0xb082('0x15'));var utils=require(_0xb082('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xb082('0x17'));var db=require(_0xb082('0x18'))['db'];var integrations=require(_0xb082('0x19'));function respondWithStatusCode(_0x4426db,_0x20a748){_0x20a748=_0x20a748||0xcc;return function(_0xe23a4c){if(_0xe23a4c){return _0x4426db[_0xb082('0x1a')](_0x20a748);}return _0x4426db[_0xb082('0x1b')](_0x20a748)['end']();};}function respondWithResult(_0x1853f3,_0xbf588f){_0xbf588f=_0xbf588f||0xc8;return function(_0x41bace){if(_0x41bace){return _0x1853f3[_0xb082('0x1b')](_0xbf588f)[_0xb082('0x1c')](_0x41bace);}};}function respondWithFilteredResult(_0x4dec1b,_0x1738f2){return function(_0x37aa44){if(_0x37aa44){var _0x1afef2=typeof _0x1738f2[_0xb082('0x1d')]===_0xb082('0x1e')&&typeof _0x1738f2[_0xb082('0x1f')]===_0xb082('0x1e');var _0x4a46ad=_0x37aa44['count'];var _0x5c81bd=_0x1afef2?0x0:_0x1738f2[_0xb082('0x1d')];var _0x410965=_0x1afef2?_0x37aa44['count']:_0x1738f2[_0xb082('0x1d')]+_0x1738f2[_0xb082('0x1f')];var _0x383b57;if(_0x410965>=_0x4a46ad){_0x410965=_0x4a46ad;_0x383b57=0xc8;}else{_0x383b57=0xce;}_0x4dec1b[_0xb082('0x1b')](_0x383b57);return _0x4dec1b['set'](_0xb082('0x20'),_0x5c81bd+'-'+_0x410965+'/'+_0x4a46ad)[_0xb082('0x1c')](_0x37aa44);}return null;};}function patchUpdates(_0x74e6cc){return function(_0x3ad816){try{jsonpatch['apply'](_0x3ad816,_0x74e6cc,!![]);}catch(_0x3d7004){return BPromise['reject'](_0x3d7004);}return _0x3ad816[_0xb082('0x21')]();};}function saveUpdates(_0x470420,_0x158caa){return function(_0x3ef4cd){if(_0x3ef4cd){return _0x3ef4cd[_0xb082('0x22')](_0x470420)['then'](function(_0x3becee){return _0x3becee;});}return null;};}function removeEntity(_0x1f7c68,_0x3c8c9f){return function(_0x53f797){if(_0x53f797){return _0x53f797[_0xb082('0x23')]()[_0xb082('0x24')](function(){_0x1f7c68[_0xb082('0x1b')](0xcc)[_0xb082('0x25')]();});}};}function handleEntityNotFound(_0x484c15,_0x5ca741){return function(_0x554a33){if(!_0x554a33){_0x484c15[_0xb082('0x1a')](0x194);}return _0x554a33;};}function handleError(_0x325e4b,_0x28e122){_0x28e122=_0x28e122||0x1f4;return function(_0x5eb860){logger['error'](_0x5eb860[_0xb082('0x26')]);if(_0x5eb860[_0xb082('0x27')]){delete _0x5eb860[_0xb082('0x27')];}_0x325e4b[_0xb082('0x1b')](_0x28e122)[_0xb082('0x28')](_0x5eb860);};}exports[_0xb082('0x29')]=function(_0x48eb43,_0x2b57e7){var _0x504d1c={},_0x569978={},_0x54b633={'count':0x0,'rows':[]};var _0xbfce1=_[_0xb082('0x2a')](db[_0xb082('0x2b')]['rawAttributes'],function(_0x22efe){return{'name':_0x22efe[_0xb082('0x2c')],'type':_0x22efe[_0xb082('0x2d')][_0xb082('0x2e')]};});_0x569978[_0xb082('0x2f')]=_[_0xb082('0x2a')](_0xbfce1,_0xb082('0x27'));_0x569978[_0xb082('0x30')]=_['keys'](_0x48eb43[_0xb082('0x30')]);_0x569978[_0xb082('0x31')]=_[_0xb082('0x32')](_0x569978[_0xb082('0x2f')],_0x569978[_0xb082('0x30')]);_0x504d1c[_0xb082('0x33')]=_[_0xb082('0x32')](_0x569978[_0xb082('0x2f')],qs[_0xb082('0x34')](_0x48eb43[_0xb082('0x30')][_0xb082('0x34')]));_0x504d1c[_0xb082('0x33')]=_0x504d1c[_0xb082('0x33')][_0xb082('0x35')]?_0x504d1c[_0xb082('0x33')]:_0x569978[_0xb082('0x2f')];if(!_0x48eb43['query']['hasOwnProperty'](_0xb082('0x36'))){_0x504d1c[_0xb082('0x1f')]=qs[_0xb082('0x1f')](_0x48eb43[_0xb082('0x30')]['limit']);_0x504d1c['offset']=qs['offset'](_0x48eb43[_0xb082('0x30')][_0xb082('0x1d')]);}_0x504d1c[_0xb082('0x37')]=qs['sort'](_0x48eb43[_0xb082('0x30')]['sort']);_0x504d1c[_0xb082('0x38')]=qs['filters'](_[_0xb082('0x39')](_0x48eb43[_0xb082('0x30')],_0x569978[_0xb082('0x31')]),_0xbfce1);if(_0x48eb43[_0xb082('0x30')]['filter']){_0x504d1c[_0xb082('0x38')]=_[_0xb082('0x3a')](_0x504d1c[_0xb082('0x38')],{'$or':_[_0xb082('0x2a')](_0xbfce1,function(_0x50ebd7){if(_0x50ebd7['type']!==_0xb082('0x3b')){var _0x5927cb={};_0x5927cb[_0x50ebd7[_0xb082('0x27')]]={'$like':'%'+_0x48eb43[_0xb082('0x30')][_0xb082('0x3c')]+'%'};return _0x5927cb;}})});}_0x504d1c=_[_0xb082('0x3a')]({},_0x504d1c,_0x48eb43['options']);var _0x12ac74={'where':_0x504d1c[_0xb082('0x38')]};return db['FreshdeskAccount'][_0xb082('0x3d')](_0x12ac74)[_0xb082('0x24')](function(_0x267c06){_0x54b633['count']=_0x267c06;if(_0x48eb43[_0xb082('0x30')][_0xb082('0x3e')]){_0x504d1c[_0xb082('0x3f')]=[{'all':!![]}];}return db[_0xb082('0x2b')][_0xb082('0x40')](_0x504d1c);})['then'](function(_0x3516cf){_0x54b633[_0xb082('0x41')]=_0x3516cf;return _0x54b633;})[_0xb082('0x24')](respondWithFilteredResult(_0x2b57e7,_0x504d1c))[_0xb082('0x42')](handleError(_0x2b57e7,null));};exports[_0xb082('0x43')]=function(_0x172c7f,_0x23d000){var _0x4038f5={'raw':![],'where':{'id':_0x172c7f[_0xb082('0x44')]['id']}},_0x2044de={};_0x2044de['model']=_[_0xb082('0x45')](db[_0xb082('0x2b')][_0xb082('0x46')]);_0x2044de[_0xb082('0x30')]=_[_0xb082('0x45')](_0x172c7f[_0xb082('0x30')]);_0x2044de[_0xb082('0x31')]=_[_0xb082('0x32')](_0x2044de[_0xb082('0x2f')],_0x2044de[_0xb082('0x30')]);_0x4038f5[_0xb082('0x33')]=_[_0xb082('0x32')](_0x2044de[_0xb082('0x2f')],qs[_0xb082('0x34')](_0x172c7f[_0xb082('0x30')][_0xb082('0x34')]));_0x4038f5[_0xb082('0x33')]=_0x4038f5[_0xb082('0x33')][_0xb082('0x35')]?_0x4038f5[_0xb082('0x33')]:_0x2044de[_0xb082('0x2f')];if(_0x172c7f[_0xb082('0x30')][_0xb082('0x3e')]){_0x4038f5[_0xb082('0x3f')]=[{'all':!![]}];}_0x4038f5=_[_0xb082('0x3a')]({},_0x4038f5,_0x172c7f[_0xb082('0x47')]);return db[_0xb082('0x2b')][_0xb082('0x48')](_0x4038f5)[_0xb082('0x24')](handleEntityNotFound(_0x23d000,null))[_0xb082('0x24')](respondWithResult(_0x23d000,null))['catch'](handleError(_0x23d000,null));};exports[_0xb082('0x49')]=function(_0x4b1b96,_0xcdf8b0){return db['FreshdeskAccount'][_0xb082('0x49')](_0x4b1b96[_0xb082('0x4a')],{})[_0xb082('0x24')](respondWithResult(_0xcdf8b0,0xc9))[_0xb082('0x42')](handleError(_0xcdf8b0,null));};exports[_0xb082('0x22')]=function(_0x20076f,_0x479a13){if(_0x20076f['body']['id']){delete _0x20076f[_0xb082('0x4a')]['id'];}return db[_0xb082('0x2b')][_0xb082('0x48')]({'where':{'id':_0x20076f[_0xb082('0x44')]['id']}})['then'](handleEntityNotFound(_0x479a13,null))[_0xb082('0x24')](saveUpdates(_0x20076f['body'],null))[_0xb082('0x24')](respondWithResult(_0x479a13,null))[_0xb082('0x42')](handleError(_0x479a13,null));};exports['destroy']=function(_0x5a1581,_0x5d93e5){return db[_0xb082('0x2b')]['find']({'where':{'id':_0x5a1581[_0xb082('0x44')]['id']}})[_0xb082('0x24')](handleEntityNotFound(_0x5d93e5,null))[_0xb082('0x24')](removeEntity(_0x5d93e5,null))[_0xb082('0x42')](handleError(_0x5d93e5,null));};exports[_0xb082('0x4b')]=function(_0x1f7895,_0x5dd96d,_0x3ea246){var _0x489385={};var _0x2936b7={};var _0x3c4c3c;var _0x113746;return db[_0xb082('0x2b')][_0xb082('0x4c')]({'where':{'id':_0x1f7895[_0xb082('0x44')]['id']}})[_0xb082('0x24')](handleEntityNotFound(_0x5dd96d,null))['then'](function(_0x3fde0c){if(_0x3fde0c){_0x3c4c3c=_0x3fde0c;_0x2936b7[_0xb082('0x2f')]=_[_0xb082('0x45')](db[_0xb082('0x4d')]['rawAttributes']);_0x2936b7[_0xb082('0x30')]=_[_0xb082('0x45')](_0x1f7895[_0xb082('0x30')]);_0x2936b7[_0xb082('0x31')]=_[_0xb082('0x32')](_0x2936b7[_0xb082('0x2f')],_0x2936b7[_0xb082('0x30')]);_0x489385[_0xb082('0x33')]=_[_0xb082('0x32')](_0x2936b7[_0xb082('0x2f')],qs[_0xb082('0x34')](_0x1f7895[_0xb082('0x30')]['fields']));_0x489385['attributes']=_0x489385[_0xb082('0x33')][_0xb082('0x35')]?_0x489385[_0xb082('0x33')]:_0x2936b7[_0xb082('0x2f')];_0x489385[_0xb082('0x37')]=qs[_0xb082('0x4e')](_0x1f7895[_0xb082('0x30')][_0xb082('0x4e')]);_0x489385[_0xb082('0x38')]=qs[_0xb082('0x31')](_[_0xb082('0x39')](_0x1f7895[_0xb082('0x30')],_0x2936b7[_0xb082('0x31')]));if(_0x1f7895[_0xb082('0x30')][_0xb082('0x3c')]){_0x489385[_0xb082('0x38')]=_[_0xb082('0x3a')](_0x489385['where'],{'$or':_[_0xb082('0x2a')](_0x489385[_0xb082('0x33')],function(_0x38fa68){var _0x59d025={};_0x59d025[_0x38fa68]={'$like':'%'+_0x1f7895[_0xb082('0x30')][_0xb082('0x3c')]+'%'};return _0x59d025;})});}_0x489385=_[_0xb082('0x3a')]({},_0x489385,_0x1f7895[_0xb082('0x47')]);return _0x3c4c3c[_0xb082('0x4b')](_0x489385);}})[_0xb082('0x24')](function(_0x2e54fd){if(_0x2e54fd){_0x113746=_0x2e54fd[_0xb082('0x35')];if(!_0x1f7895[_0xb082('0x30')][_0xb082('0x4f')](_0xb082('0x36'))){_0x489385[_0xb082('0x1f')]=qs['limit'](_0x1f7895[_0xb082('0x30')][_0xb082('0x1f')]);_0x489385['offset']=qs[_0xb082('0x1d')](_0x1f7895[_0xb082('0x30')][_0xb082('0x1d')]);}return _0x3c4c3c['getConfigurations'](_0x489385);}})['then'](function(_0x2399a0){if(_0x2399a0){return _0x2399a0?{'count':_0x113746,'rows':_0x2399a0}:null;}})[_0xb082('0x24')](respondWithResult(_0x5dd96d,null))[_0xb082('0x42')](handleError(_0x5dd96d,null));};exports[_0xb082('0x50')]=function(_0x44047c,_0x1c1c6e,_0x4016d6){if(_0x44047c['body']['id']){delete _0x44047c[_0xb082('0x4a')]['id'];}return db[_0xb082('0x2b')]['findOne']({'where':{'id':_0x44047c[_0xb082('0x44')]['id']}})[_0xb082('0x24')](handleEntityNotFound(_0x1c1c6e,null))[_0xb082('0x24')](function(_0x490010){if(_0x490010){_0x44047c[_0xb082('0x4a')][_0xb082('0x51')]=_0x490010['id'];_0x44047c['body']['Subjects']=integrations[_0xb082('0x52')](_0x44047c['body'][_0xb082('0x53')],_0x44047c[_0xb082('0x4a')][_0xb082('0x2d')]);_0x44047c[_0xb082('0x4a')][_0xb082('0x54')]=integrations[_0xb082('0x55')](_0x44047c['body']['channel'],_0x44047c[_0xb082('0x4a')][_0xb082('0x2d')]);return db[_0xb082('0x4d')][_0xb082('0x49')](_0x44047c[_0xb082('0x4a')],{'include':[{'model':db[_0xb082('0x56')],'as':_0xb082('0x57')},{'model':db[_0xb082('0x56')],'as':'Descriptions'}]});}return null;})[_0xb082('0x24')](respondWithResult(_0x1c1c6e,null))['catch'](handleError(_0x1c1c6e,null));};exports[_0xb082('0x58')]=function(_0x4db9ed,_0x1ccca4,_0x957710){var _0xb411f7='';return db[_0xb082('0x2b')][_0xb082('0x4c')]({'where':{'id':_0x4db9ed[_0xb082('0x44')]['id']},'attributes':['id',_0xb082('0x59'),_0xb082('0x5a')]})[_0xb082('0x24')](handleEntityNotFound(_0x1ccca4,null))['then'](function(_0x203d6a){if(_0x203d6a){_0xb411f7=_0x203d6a[_0xb082('0x59')];var _0x2eff43=_0xb411f7[_0xb082('0x5b')](-0x1);if(_0x2eff43==='/'){_0xb411f7=_0xb411f7['substring'](0x0,_0xb411f7[_0xb082('0x5c')](_0x2eff43));}return rp({'method':'GET','uri':util[_0xb082('0x5d')](_0xb082('0x5e'),_0xb411f7,_0xb082('0x5f')),'headers':{'Authorization':util[_0xb082('0x5d')](_0xb082('0x60'),new Buffer(util['format'](_0xb082('0x61'),_0x203d6a[_0xb082('0x5a')]))[_0xb082('0x62')](_0xb082('0x63')))},'json':!![]});}})['then'](function(_0x48a65c){if(_0x48a65c){var _0x5829d4=[_0xb082('0x64'),_0xb082('0x65'),_0xb082('0x66'),_0xb082('0x67'),_0xb082('0x1b'),_0xb082('0x68'),_0xb082('0x69'),_0xb082('0x6a'),'ticket_type',_0xb082('0x69'),_0xb082('0x6b')];_[_0xb082('0x6c')](_0x48a65c,function(_0x25c7a8){return _0x5829d4['includes'](_0x25c7a8[_0xb082('0x27')])||!_0x25c7a8[_0xb082('0x6d')]&&_0x25c7a8['type']!==_0xb082('0x6e')&&_0x25c7a8[_0xb082('0x2d')]!==_0xb082('0x6f');});return{'count':_0x48a65c['length'],'rows':_[_0xb082('0x2a')](_0x48a65c,function(_0x13f054){return{'id':_0x13f054[_0xb082('0x27')],'name':_0x13f054[_0xb082('0x70')],'custom':!_0x13f054[_0xb082('0x6d')],'options':_0x13f054[_0xb082('0x71')]?_[_0xb082('0x2a')](_0x13f054[_0xb082('0x71')],function(_0x5aaceb){return{'name':_[_0xb082('0x72')](_0x5aaceb),'value':_0x5aaceb};}):[]};})};}})['then'](respondWithResult(_0x1ccca4,null))[_0xb082('0x42')](function(_0x4258a3){var _0x3b1acd=_0x4db9ed['query'][_0xb082('0x73')]?0x1f4:_0x4258a3[_0xb082('0x74')]||0x1f4;logger[_0xb082('0x75')](_0xb082('0x76'),_0xb082('0x58'),_0x3b1acd,JSON[_0xb082('0x77')](_0x4258a3));delete _0x4258a3['name'];if(_0x3b1acd===0x191){_0x3b1acd=0x190;}_0x1ccca4['status'](_0x3b1acd)['send'](_0x4db9ed[_0xb082('0x30')][_0xb082('0x73')]?{'message':_0xb082('0x78'),'statusCode':_0x4258a3[_0xb082('0x74')]}:_0x4258a3);});}; \ No newline at end of file +var _0x082b=['choices','capitalize','test','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','json','offset','undefined','limit','Content-Range','save','update','destroy','then','end','stack','name','send','index','map','FreshdeskAccount','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','nolimit','order','where','pick','merge','VIRTUAL','filter','count','includeAll','include','findAll','rows','catch','show','params','keys','rawAttributes','options','find','create','body','getConfigurations','findOne','FreshdeskConfiguration','sort','hasOwnProperty','addConfiguration','AccountId','getSubjects','channel','Descriptions','getDescriptions','FreshdeskField','Subjects','getFields','remoteUri','apiKey','slice','lastIndexOf','format','%s/%s','api/v2/ticket_fields','Basic\x20%s','%s:X','toString','base64','requester','subject','agent','description','priority','group','source','company','remove','default','custom_text','custom_dropdown','label'];(function(_0x242a4f,_0x369c57){var _0x122117=function(_0x55a797){while(--_0x55a797){_0x242a4f['push'](_0x242a4f['shift']());}};_0x122117(++_0x369c57);}(_0x082b,0x1ec));var _0xb082=function(_0x2fc9fc,_0x112f57){_0x2fc9fc=_0x2fc9fc-0x0;var _0x2e4946=_0x082b[_0x2fc9fc];return _0x2e4946;};'use strict';var emlformat=require(_0xb082('0x0'));var rimraf=require(_0xb082('0x1'));var zipdir=require(_0xb082('0x2'));var jsonpatch=require(_0xb082('0x3'));var rp=require('request-promise');var moment=require(_0xb082('0x4'));var BPromise=require(_0xb082('0x5'));var Mustache=require('mustache');var util=require(_0xb082('0x6'));var path=require(_0xb082('0x7'));var sox=require('sox');var csv=require(_0xb082('0x8'));var ejs=require(_0xb082('0x9'));var fs=require('fs');var fs_extra=require(_0xb082('0xa'));var _=require(_0xb082('0xb'));var squel=require('squel');var crypto=require(_0xb082('0xc'));var jsforce=require(_0xb082('0xd'));var deskjs=require(_0xb082('0xe'));var toCsv=require('to-csv');var querystring=require(_0xb082('0xf'));var Papa=require(_0xb082('0x10'));var Redis=require(_0xb082('0x11'));var authService=require(_0xb082('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xb082('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb082('0x14'))(_0xb082('0x15'));var utils=require(_0xb082('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xb082('0x17'));var db=require(_0xb082('0x18'))['db'];var integrations=require(_0xb082('0x19'));function respondWithStatusCode(_0x4426db,_0x20a748){_0x20a748=_0x20a748||0xcc;return function(_0xe23a4c){if(_0xe23a4c){return _0x4426db[_0xb082('0x1a')](_0x20a748);}return _0x4426db[_0xb082('0x1b')](_0x20a748)['end']();};}function respondWithResult(_0x1853f3,_0xbf588f){_0xbf588f=_0xbf588f||0xc8;return function(_0x41bace){if(_0x41bace){return _0x1853f3[_0xb082('0x1b')](_0xbf588f)[_0xb082('0x1c')](_0x41bace);}};}function respondWithFilteredResult(_0x4dec1b,_0x1738f2){return function(_0x37aa44){if(_0x37aa44){var _0x1afef2=typeof _0x1738f2[_0xb082('0x1d')]===_0xb082('0x1e')&&typeof _0x1738f2[_0xb082('0x1f')]===_0xb082('0x1e');var _0x4a46ad=_0x37aa44['count'];var _0x5c81bd=_0x1afef2?0x0:_0x1738f2[_0xb082('0x1d')];var _0x410965=_0x1afef2?_0x37aa44['count']:_0x1738f2[_0xb082('0x1d')]+_0x1738f2[_0xb082('0x1f')];var _0x383b57;if(_0x410965>=_0x4a46ad){_0x410965=_0x4a46ad;_0x383b57=0xc8;}else{_0x383b57=0xce;}_0x4dec1b[_0xb082('0x1b')](_0x383b57);return _0x4dec1b['set'](_0xb082('0x20'),_0x5c81bd+'-'+_0x410965+'/'+_0x4a46ad)[_0xb082('0x1c')](_0x37aa44);}return null;};}function patchUpdates(_0x74e6cc){return function(_0x3ad816){try{jsonpatch['apply'](_0x3ad816,_0x74e6cc,!![]);}catch(_0x3d7004){return BPromise['reject'](_0x3d7004);}return _0x3ad816[_0xb082('0x21')]();};}function saveUpdates(_0x470420,_0x158caa){return function(_0x3ef4cd){if(_0x3ef4cd){return _0x3ef4cd[_0xb082('0x22')](_0x470420)['then'](function(_0x3becee){return _0x3becee;});}return null;};}function removeEntity(_0x1f7c68,_0x3c8c9f){return function(_0x53f797){if(_0x53f797){return _0x53f797[_0xb082('0x23')]()[_0xb082('0x24')](function(){_0x1f7c68[_0xb082('0x1b')](0xcc)[_0xb082('0x25')]();});}};}function handleEntityNotFound(_0x484c15,_0x5ca741){return function(_0x554a33){if(!_0x554a33){_0x484c15[_0xb082('0x1a')](0x194);}return _0x554a33;};}function handleError(_0x325e4b,_0x28e122){_0x28e122=_0x28e122||0x1f4;return function(_0x5eb860){logger['error'](_0x5eb860[_0xb082('0x26')]);if(_0x5eb860[_0xb082('0x27')]){delete _0x5eb860[_0xb082('0x27')];}_0x325e4b[_0xb082('0x1b')](_0x28e122)[_0xb082('0x28')](_0x5eb860);};}exports[_0xb082('0x29')]=function(_0x48eb43,_0x2b57e7){var _0x504d1c={},_0x569978={},_0x54b633={'count':0x0,'rows':[]};var _0xbfce1=_[_0xb082('0x2a')](db[_0xb082('0x2b')]['rawAttributes'],function(_0x22efe){return{'name':_0x22efe[_0xb082('0x2c')],'type':_0x22efe[_0xb082('0x2d')][_0xb082('0x2e')]};});_0x569978[_0xb082('0x2f')]=_[_0xb082('0x2a')](_0xbfce1,_0xb082('0x27'));_0x569978[_0xb082('0x30')]=_['keys'](_0x48eb43[_0xb082('0x30')]);_0x569978[_0xb082('0x31')]=_[_0xb082('0x32')](_0x569978[_0xb082('0x2f')],_0x569978[_0xb082('0x30')]);_0x504d1c[_0xb082('0x33')]=_[_0xb082('0x32')](_0x569978[_0xb082('0x2f')],qs[_0xb082('0x34')](_0x48eb43[_0xb082('0x30')][_0xb082('0x34')]));_0x504d1c[_0xb082('0x33')]=_0x504d1c[_0xb082('0x33')][_0xb082('0x35')]?_0x504d1c[_0xb082('0x33')]:_0x569978[_0xb082('0x2f')];if(!_0x48eb43['query']['hasOwnProperty'](_0xb082('0x36'))){_0x504d1c[_0xb082('0x1f')]=qs[_0xb082('0x1f')](_0x48eb43[_0xb082('0x30')]['limit']);_0x504d1c['offset']=qs['offset'](_0x48eb43[_0xb082('0x30')][_0xb082('0x1d')]);}_0x504d1c[_0xb082('0x37')]=qs['sort'](_0x48eb43[_0xb082('0x30')]['sort']);_0x504d1c[_0xb082('0x38')]=qs['filters'](_[_0xb082('0x39')](_0x48eb43[_0xb082('0x30')],_0x569978[_0xb082('0x31')]),_0xbfce1);if(_0x48eb43[_0xb082('0x30')]['filter']){_0x504d1c[_0xb082('0x38')]=_[_0xb082('0x3a')](_0x504d1c[_0xb082('0x38')],{'$or':_[_0xb082('0x2a')](_0xbfce1,function(_0x50ebd7){if(_0x50ebd7['type']!==_0xb082('0x3b')){var _0x5927cb={};_0x5927cb[_0x50ebd7[_0xb082('0x27')]]={'$like':'%'+_0x48eb43[_0xb082('0x30')][_0xb082('0x3c')]+'%'};return _0x5927cb;}})});}_0x504d1c=_[_0xb082('0x3a')]({},_0x504d1c,_0x48eb43['options']);var _0x12ac74={'where':_0x504d1c[_0xb082('0x38')]};return db['FreshdeskAccount'][_0xb082('0x3d')](_0x12ac74)[_0xb082('0x24')](function(_0x267c06){_0x54b633['count']=_0x267c06;if(_0x48eb43[_0xb082('0x30')][_0xb082('0x3e')]){_0x504d1c[_0xb082('0x3f')]=[{'all':!![]}];}return db[_0xb082('0x2b')][_0xb082('0x40')](_0x504d1c);})['then'](function(_0x3516cf){_0x54b633[_0xb082('0x41')]=_0x3516cf;return _0x54b633;})[_0xb082('0x24')](respondWithFilteredResult(_0x2b57e7,_0x504d1c))[_0xb082('0x42')](handleError(_0x2b57e7,null));};exports[_0xb082('0x43')]=function(_0x172c7f,_0x23d000){var _0x4038f5={'raw':![],'where':{'id':_0x172c7f[_0xb082('0x44')]['id']}},_0x2044de={};_0x2044de['model']=_[_0xb082('0x45')](db[_0xb082('0x2b')][_0xb082('0x46')]);_0x2044de[_0xb082('0x30')]=_[_0xb082('0x45')](_0x172c7f[_0xb082('0x30')]);_0x2044de[_0xb082('0x31')]=_[_0xb082('0x32')](_0x2044de[_0xb082('0x2f')],_0x2044de[_0xb082('0x30')]);_0x4038f5[_0xb082('0x33')]=_[_0xb082('0x32')](_0x2044de[_0xb082('0x2f')],qs[_0xb082('0x34')](_0x172c7f[_0xb082('0x30')][_0xb082('0x34')]));_0x4038f5[_0xb082('0x33')]=_0x4038f5[_0xb082('0x33')][_0xb082('0x35')]?_0x4038f5[_0xb082('0x33')]:_0x2044de[_0xb082('0x2f')];if(_0x172c7f[_0xb082('0x30')][_0xb082('0x3e')]){_0x4038f5[_0xb082('0x3f')]=[{'all':!![]}];}_0x4038f5=_[_0xb082('0x3a')]({},_0x4038f5,_0x172c7f[_0xb082('0x47')]);return db[_0xb082('0x2b')][_0xb082('0x48')](_0x4038f5)[_0xb082('0x24')](handleEntityNotFound(_0x23d000,null))[_0xb082('0x24')](respondWithResult(_0x23d000,null))['catch'](handleError(_0x23d000,null));};exports[_0xb082('0x49')]=function(_0x4b1b96,_0xcdf8b0){return db['FreshdeskAccount'][_0xb082('0x49')](_0x4b1b96[_0xb082('0x4a')],{})[_0xb082('0x24')](respondWithResult(_0xcdf8b0,0xc9))[_0xb082('0x42')](handleError(_0xcdf8b0,null));};exports[_0xb082('0x22')]=function(_0x20076f,_0x479a13){if(_0x20076f['body']['id']){delete _0x20076f[_0xb082('0x4a')]['id'];}return db[_0xb082('0x2b')][_0xb082('0x48')]({'where':{'id':_0x20076f[_0xb082('0x44')]['id']}})['then'](handleEntityNotFound(_0x479a13,null))[_0xb082('0x24')](saveUpdates(_0x20076f['body'],null))[_0xb082('0x24')](respondWithResult(_0x479a13,null))[_0xb082('0x42')](handleError(_0x479a13,null));};exports['destroy']=function(_0x5a1581,_0x5d93e5){return db[_0xb082('0x2b')]['find']({'where':{'id':_0x5a1581[_0xb082('0x44')]['id']}})[_0xb082('0x24')](handleEntityNotFound(_0x5d93e5,null))[_0xb082('0x24')](removeEntity(_0x5d93e5,null))[_0xb082('0x42')](handleError(_0x5d93e5,null));};exports[_0xb082('0x4b')]=function(_0x1f7895,_0x5dd96d,_0x3ea246){var _0x489385={};var _0x2936b7={};var _0x3c4c3c;var _0x113746;return db[_0xb082('0x2b')][_0xb082('0x4c')]({'where':{'id':_0x1f7895[_0xb082('0x44')]['id']}})[_0xb082('0x24')](handleEntityNotFound(_0x5dd96d,null))['then'](function(_0x3fde0c){if(_0x3fde0c){_0x3c4c3c=_0x3fde0c;_0x2936b7[_0xb082('0x2f')]=_[_0xb082('0x45')](db[_0xb082('0x4d')]['rawAttributes']);_0x2936b7[_0xb082('0x30')]=_[_0xb082('0x45')](_0x1f7895[_0xb082('0x30')]);_0x2936b7[_0xb082('0x31')]=_[_0xb082('0x32')](_0x2936b7[_0xb082('0x2f')],_0x2936b7[_0xb082('0x30')]);_0x489385[_0xb082('0x33')]=_[_0xb082('0x32')](_0x2936b7[_0xb082('0x2f')],qs[_0xb082('0x34')](_0x1f7895[_0xb082('0x30')]['fields']));_0x489385['attributes']=_0x489385[_0xb082('0x33')][_0xb082('0x35')]?_0x489385[_0xb082('0x33')]:_0x2936b7[_0xb082('0x2f')];_0x489385[_0xb082('0x37')]=qs[_0xb082('0x4e')](_0x1f7895[_0xb082('0x30')][_0xb082('0x4e')]);_0x489385[_0xb082('0x38')]=qs[_0xb082('0x31')](_[_0xb082('0x39')](_0x1f7895[_0xb082('0x30')],_0x2936b7[_0xb082('0x31')]));if(_0x1f7895[_0xb082('0x30')][_0xb082('0x3c')]){_0x489385[_0xb082('0x38')]=_[_0xb082('0x3a')](_0x489385['where'],{'$or':_[_0xb082('0x2a')](_0x489385[_0xb082('0x33')],function(_0x38fa68){var _0x59d025={};_0x59d025[_0x38fa68]={'$like':'%'+_0x1f7895[_0xb082('0x30')][_0xb082('0x3c')]+'%'};return _0x59d025;})});}_0x489385=_[_0xb082('0x3a')]({},_0x489385,_0x1f7895[_0xb082('0x47')]);return _0x3c4c3c[_0xb082('0x4b')](_0x489385);}})[_0xb082('0x24')](function(_0x2e54fd){if(_0x2e54fd){_0x113746=_0x2e54fd[_0xb082('0x35')];if(!_0x1f7895[_0xb082('0x30')][_0xb082('0x4f')](_0xb082('0x36'))){_0x489385[_0xb082('0x1f')]=qs['limit'](_0x1f7895[_0xb082('0x30')][_0xb082('0x1f')]);_0x489385['offset']=qs[_0xb082('0x1d')](_0x1f7895[_0xb082('0x30')][_0xb082('0x1d')]);}return _0x3c4c3c['getConfigurations'](_0x489385);}})['then'](function(_0x2399a0){if(_0x2399a0){return _0x2399a0?{'count':_0x113746,'rows':_0x2399a0}:null;}})[_0xb082('0x24')](respondWithResult(_0x5dd96d,null))[_0xb082('0x42')](handleError(_0x5dd96d,null));};exports[_0xb082('0x50')]=function(_0x44047c,_0x1c1c6e,_0x4016d6){if(_0x44047c['body']['id']){delete _0x44047c[_0xb082('0x4a')]['id'];}return db[_0xb082('0x2b')]['findOne']({'where':{'id':_0x44047c[_0xb082('0x44')]['id']}})[_0xb082('0x24')](handleEntityNotFound(_0x1c1c6e,null))[_0xb082('0x24')](function(_0x490010){if(_0x490010){_0x44047c[_0xb082('0x4a')][_0xb082('0x51')]=_0x490010['id'];_0x44047c['body']['Subjects']=integrations[_0xb082('0x52')](_0x44047c['body'][_0xb082('0x53')],_0x44047c[_0xb082('0x4a')][_0xb082('0x2d')]);_0x44047c[_0xb082('0x4a')][_0xb082('0x54')]=integrations[_0xb082('0x55')](_0x44047c['body']['channel'],_0x44047c[_0xb082('0x4a')][_0xb082('0x2d')]);return db[_0xb082('0x4d')][_0xb082('0x49')](_0x44047c[_0xb082('0x4a')],{'include':[{'model':db[_0xb082('0x56')],'as':_0xb082('0x57')},{'model':db[_0xb082('0x56')],'as':'Descriptions'}]});}return null;})[_0xb082('0x24')](respondWithResult(_0x1c1c6e,null))['catch'](handleError(_0x1c1c6e,null));};exports[_0xb082('0x58')]=function(_0x4db9ed,_0x1ccca4,_0x957710){var _0xb411f7='';return db[_0xb082('0x2b')][_0xb082('0x4c')]({'where':{'id':_0x4db9ed[_0xb082('0x44')]['id']},'attributes':['id',_0xb082('0x59'),_0xb082('0x5a')]})[_0xb082('0x24')](handleEntityNotFound(_0x1ccca4,null))['then'](function(_0x203d6a){if(_0x203d6a){_0xb411f7=_0x203d6a[_0xb082('0x59')];var _0x2eff43=_0xb411f7[_0xb082('0x5b')](-0x1);if(_0x2eff43==='/'){_0xb411f7=_0xb411f7['substring'](0x0,_0xb411f7[_0xb082('0x5c')](_0x2eff43));}return rp({'method':'GET','uri':util[_0xb082('0x5d')](_0xb082('0x5e'),_0xb411f7,_0xb082('0x5f')),'headers':{'Authorization':util[_0xb082('0x5d')](_0xb082('0x60'),new Buffer(util['format'](_0xb082('0x61'),_0x203d6a[_0xb082('0x5a')]))[_0xb082('0x62')](_0xb082('0x63')))},'json':!![]});}})['then'](function(_0x48a65c){if(_0x48a65c){var _0x5829d4=[_0xb082('0x64'),_0xb082('0x65'),_0xb082('0x66'),_0xb082('0x67'),_0xb082('0x1b'),_0xb082('0x68'),_0xb082('0x69'),_0xb082('0x6a'),'ticket_type',_0xb082('0x69'),_0xb082('0x6b')];_[_0xb082('0x6c')](_0x48a65c,function(_0x25c7a8){return _0x5829d4['includes'](_0x25c7a8[_0xb082('0x27')])||!_0x25c7a8[_0xb082('0x6d')]&&_0x25c7a8['type']!==_0xb082('0x6e')&&_0x25c7a8[_0xb082('0x2d')]!==_0xb082('0x6f');});return{'count':_0x48a65c['length'],'rows':_[_0xb082('0x2a')](_0x48a65c,function(_0x13f054){return{'id':_0x13f054[_0xb082('0x27')],'name':_0x13f054[_0xb082('0x70')],'custom':!_0x13f054[_0xb082('0x6d')],'options':_0x13f054[_0xb082('0x71')]?_[_0xb082('0x2a')](_0x13f054[_0xb082('0x71')],function(_0x5aaceb){return{'name':_[_0xb082('0x72')](_0x5aaceb),'value':_0x5aaceb};}):[]};})};}})['then'](respondWithResult(_0x1ccca4,null))[_0xb082('0x42')](function(_0x4258a3){var _0x3b1acd=_0x4db9ed['query'][_0xb082('0x73')]?0x1f4:_0x4258a3[_0xb082('0x74')]||0x1f4;logger[_0xb082('0x75')](_0xb082('0x76'),_0xb082('0x58'),_0x3b1acd,JSON[_0xb082('0x77')](_0x4258a3));delete _0x4258a3['name'];if(_0x3b1acd===0x191){_0x3b1acd=0x190;}_0x1ccca4['status'](_0x3b1acd)['send'](_0x4db9ed[_0xb082('0x30')][_0xb082('0x73')]?{'message':_0xb082('0x78'),'statusCode':_0x4258a3[_0xb082('0x74')]}:_0x4258a3);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index 2a0132d..184760a 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 _0xd493=['rimraf','../../config/environment','./intFreshdeskAccount.attributes','../../components/integrations/configuration','exports','define','FreshdeskAccount','int_freshdesk_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0xecb8dc,_0x353bd9){var _0x32fb23=function(_0x570fd7){while(--_0x570fd7){_0xecb8dc['push'](_0xecb8dc['shift']());}};_0x32fb23(++_0x353bd9);}(_0xd493,0x1ca));var _0x3d49=function(_0x16f630,_0x394d26){_0x16f630=_0x16f630-0x0;var _0x1d8e10=_0xd493[_0x16f630];return _0x1d8e10;};'use strict';var _=require(_0x3d49('0x0'));var util=require(_0x3d49('0x1'));var logger=require(_0x3d49('0x2'))(_0x3d49('0x3'));var moment=require(_0x3d49('0x4'));var BPromise=require(_0x3d49('0x5'));var rp=require(_0x3d49('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3d49('0x7'));var config=require(_0x3d49('0x8'));var attributes=require(_0x3d49('0x9'));var integrations=require(_0x3d49('0xa'));module[_0x3d49('0xb')]=function(_0x587a85,_0x34f7cf){return _0x587a85[_0x3d49('0xc')](_0x3d49('0xd'),attributes,{'tableName':_0x3d49('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5b40=['lodash','../../config/logger','api','moment','bluebird','rimraf','./intFreshdeskAccount.attributes','../../components/integrations/configuration','exports','define','FreshdeskAccount','int_freshdesk_accounts'];(function(_0x44e3af,_0x5a8602){var _0x535363=function(_0x369847){while(--_0x369847){_0x44e3af['push'](_0x44e3af['shift']());}};_0x535363(++_0x5a8602);}(_0x5b40,0x90));var _0x05b4=function(_0x28fd13,_0x36b8b8){_0x28fd13=_0x28fd13-0x0;var _0x32d4cf=_0x5b40[_0x28fd13];return _0x32d4cf;};'use strict';var _=require(_0x05b4('0x0'));var util=require('util');var logger=require(_0x05b4('0x1'))(_0x05b4('0x2'));var moment=require(_0x05b4('0x3'));var BPromise=require(_0x05b4('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x05b4('0x5'));var config=require('../../config/environment');var attributes=require(_0x05b4('0x6'));var integrations=require(_0x05b4('0x7'));module[_0x05b4('0x8')]=function(_0x2e4f82,_0x874b80){return _0x2e4f82[_0x05b4('0x9')](_0x05b4('0xa'),attributes,{'tableName':_0x05b4('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.rpc.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.rpc.js index 61471c8..21d29b4 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 _0x337e=['../../config/environment','jayson/promise','client','request','then','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetFreshdeskAccount','FreshdeskAccount','options','raw','attributes','limit','include','map','model','where','ShowFreshdeskAccount','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x40d79b,_0x22a83d){var _0x3ff7a7=function(_0x48e8ae){while(--_0x48e8ae){_0x40d79b['push'](_0x40d79b['shift']());}};_0x3ff7a7(++_0x22a83d);}(_0x337e,0x179));var _0xe337=function(_0x356aaa,_0x44dc26){_0x356aaa=_0x356aaa-0x0;var _0x4ed6fb=_0x337e[_0x356aaa];return _0x4ed6fb;};'use strict';var _=require(_0xe337('0x0'));var util=require('util');var moment=require(_0xe337('0x1'));var BPromise=require(_0xe337('0x2'));var rs=require(_0xe337('0x3'));var fs=require('fs');var Redis=require(_0xe337('0x4'));var db=require(_0xe337('0x5'))['db'];var utils=require(_0xe337('0x6'));var logger=require('../../config/logger')(_0xe337('0x7'));var config=require(_0xe337('0x8'));var jayson=require(_0xe337('0x9'));var client=jayson[_0xe337('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x48cdb0,_0xb75af,_0x32ab35){return new BPromise(function(_0x2c9f66,_0x3fbf26){return client[_0xe337('0xb')](_0x48cdb0,_0x32ab35)[_0xe337('0xc')](function(_0x12ddeb){logger['info'](_0xe337('0xd'),_0xb75af,_0xe337('0xe'));logger[_0xe337('0xf')](_0xe337('0x10'),_0xb75af,_0xe337('0xe'),JSON[_0xe337('0x11')](_0x12ddeb));if(_0x12ddeb[_0xe337('0x12')]){if(_0x12ddeb[_0xe337('0x12')][_0xe337('0x13')]===0x1f4){logger['error']('FreshdeskAccount,\x20%s,\x20%s',_0xb75af,_0x12ddeb[_0xe337('0x12')]['message']);return _0x3fbf26(_0x12ddeb[_0xe337('0x12')][_0xe337('0x14')]);}logger[_0xe337('0x12')](_0xe337('0xd'),_0xb75af,_0x12ddeb['error'][_0xe337('0x14')]);return _0x2c9f66(_0x12ddeb['error'][_0xe337('0x14')]);}else{logger[_0xe337('0x15')](_0xe337('0xd'),_0xb75af,_0xe337('0xe'));_0x2c9f66(_0x12ddeb[_0xe337('0x16')][_0xe337('0x14')]);}})[_0xe337('0x17')](function(_0x27a6f2){logger['error'](_0xe337('0xd'),_0xb75af,_0x27a6f2);_0x3fbf26(_0x27a6f2);});});}exports[_0xe337('0x18')]=function(_0xc57d2b){var _0x2a230e=this;return new Promise(function(_0x37df16,_0x3c8596){return db[_0xe337('0x19')]['findAll']({'raw':_0xc57d2b[_0xe337('0x1a')]?_0xc57d2b['options'][_0xe337('0x1b')]===undefined?!![]:![]:!![],'where':_0xc57d2b[_0xe337('0x1a')]?_0xc57d2b[_0xe337('0x1a')]['where']||null:null,'attributes':_0xc57d2b[_0xe337('0x1a')]?_0xc57d2b[_0xe337('0x1a')][_0xe337('0x1c')]||null:null,'limit':_0xc57d2b[_0xe337('0x1a')]?_0xc57d2b[_0xe337('0x1a')][_0xe337('0x1d')]||null:null,'include':_0xc57d2b[_0xe337('0x1a')]?_0xc57d2b['options'][_0xe337('0x1e')]?_['map'](_0xc57d2b[_0xe337('0x1a')][_0xe337('0x1e')],function(_0x2a3179){return{'model':db[_0x2a3179['model']],'as':_0x2a3179['as'],'attributes':_0x2a3179[_0xe337('0x1c')],'include':_0x2a3179[_0xe337('0x1e')]?_[_0xe337('0x1f')](_0x2a3179['include'],function(_0x3b9b8f){return{'model':db[_0x3b9b8f[_0xe337('0x20')]],'as':_0x3b9b8f['as'],'attributes':_0x3b9b8f[_0xe337('0x1c')],'include':_0x3b9b8f[_0xe337('0x1e')]?_[_0xe337('0x1f')](_0x3b9b8f[_0xe337('0x1e')],function(_0x5b2bc){return{'model':db[_0x5b2bc[_0xe337('0x20')]],'as':_0x5b2bc['as'],'attributes':_0x5b2bc['attributes']};}):[]};}):[]};}):[]:[]})[_0xe337('0xc')](function(_0x27dade){logger[_0xe337('0x15')]('GetFreshdeskAccount',_0xc57d2b);logger[_0xe337('0xf')](_0xe337('0x18'),_0xc57d2b,JSON[_0xe337('0x11')](_0x27dade));_0x37df16(_0x27dade);})[_0xe337('0x17')](function(_0x5cf11d){logger[_0xe337('0x12')](_0xe337('0x18'),_0x5cf11d[_0xe337('0x14')],_0xc57d2b);_0x3c8596(_0x2a230e[_0xe337('0x12')](0x1f4,_0x5cf11d['message']));});});};exports['ShowFreshdeskAccount']=function(_0x558523){var _0x3a6389=this;return new Promise(function(_0x3f4584,_0x2c7e30){return db['FreshdeskAccount']['find']({'raw':_0x558523[_0xe337('0x1a')]?_0x558523[_0xe337('0x1a')][_0xe337('0x1b')]===undefined?!![]:![]:!![],'where':_0x558523['options']?_0x558523['options'][_0xe337('0x21')]||null:null,'attributes':_0x558523['options']?_0x558523[_0xe337('0x1a')][_0xe337('0x1c')]||null:null,'include':_0x558523[_0xe337('0x1a')]?_0x558523[_0xe337('0x1a')][_0xe337('0x1e')]?_[_0xe337('0x1f')](_0x558523[_0xe337('0x1a')]['include'],function(_0x17d7ff){return{'model':db[_0x17d7ff[_0xe337('0x20')]],'as':_0x17d7ff['as'],'attributes':_0x17d7ff[_0xe337('0x1c')],'include':_0x17d7ff[_0xe337('0x1e')]?_[_0xe337('0x1f')](_0x17d7ff[_0xe337('0x1e')],function(_0x2670a8){return{'model':db[_0x2670a8[_0xe337('0x20')]],'as':_0x2670a8['as'],'attributes':_0x2670a8['attributes'],'include':_0x2670a8[_0xe337('0x1e')]?_['map'](_0x2670a8[_0xe337('0x1e')],function(_0x5669b4){return{'model':db[_0x5669b4[_0xe337('0x20')]],'as':_0x5669b4['as'],'attributes':_0x5669b4[_0xe337('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xe337('0xc')](function(_0x119b56){logger[_0xe337('0x15')](_0xe337('0x22'),_0x558523);logger[_0xe337('0xf')]('ShowFreshdeskAccount',_0x558523,JSON[_0xe337('0x11')](_0x119b56));_0x3f4584(_0x119b56);})[_0xe337('0x17')](function(_0x561138){logger['error'](_0xe337('0x22'),_0x561138[_0xe337('0x14')],_0x558523);_0x2c7e30(_0x3a6389[_0xe337('0x12')](0x1f4,_0x561138[_0xe337('0x14')]));});});}; \ No newline at end of file +var _0x1b4b=['model','attributes','map','then','ShowFreshdeskAccount','stringify','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','http','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','error','FreshdeskAccount,\x20%s,\x20%s','message','info','result','catch','GetFreshdeskAccount','FreshdeskAccount','options','where','limit','include'];(function(_0x252884,_0x117ddf){var _0x4de0e6=function(_0x442519){while(--_0x442519){_0x252884['push'](_0x252884['shift']());}};_0x4de0e6(++_0x117ddf);}(_0x1b4b,0xd8));var _0xb1b4=function(_0x1a7e92,_0x4f0b83){_0x1a7e92=_0x1a7e92-0x0;var _0x459060=_0x1b4b[_0x1a7e92];return _0x459060;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xb1b4('0x0'));var BPromise=require(_0xb1b4('0x1'));var rs=require(_0xb1b4('0x2'));var fs=require('fs');var Redis=require(_0xb1b4('0x3'));var db=require(_0xb1b4('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xb1b4('0x5'))(_0xb1b4('0x6'));var config=require('../../config/environment');var jayson=require(_0xb1b4('0x7'));var client=jayson['client'][_0xb1b4('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x157a06,_0x36f91a,_0x5e8a62){return new BPromise(function(_0x9f9286,_0x2f880e){return client['request'](_0x157a06,_0x5e8a62)['then'](function(_0x4be80d){logger['info']('FreshdeskAccount,\x20%s,\x20%s',_0x36f91a,_0xb1b4('0x9'));logger[_0xb1b4('0xa')](_0xb1b4('0xb'),_0x36f91a,'request\x20sent',JSON['stringify'](_0x4be80d));if(_0x4be80d[_0xb1b4('0xc')]){if(_0x4be80d[_0xb1b4('0xc')]['code']===0x1f4){logger[_0xb1b4('0xc')](_0xb1b4('0xd'),_0x36f91a,_0x4be80d['error'][_0xb1b4('0xe')]);return _0x2f880e(_0x4be80d[_0xb1b4('0xc')][_0xb1b4('0xe')]);}logger['error']('FreshdeskAccount,\x20%s,\x20%s',_0x36f91a,_0x4be80d[_0xb1b4('0xc')][_0xb1b4('0xe')]);return _0x9f9286(_0x4be80d[_0xb1b4('0xc')]['message']);}else{logger[_0xb1b4('0xf')](_0xb1b4('0xd'),_0x36f91a,_0xb1b4('0x9'));_0x9f9286(_0x4be80d[_0xb1b4('0x10')]['message']);}})[_0xb1b4('0x11')](function(_0x10a6cc){logger[_0xb1b4('0xc')](_0xb1b4('0xd'),_0x36f91a,_0x10a6cc);_0x2f880e(_0x10a6cc);});});}exports[_0xb1b4('0x12')]=function(_0x18e241){var _0x943577=this;return new Promise(function(_0xe3a94c,_0xe5e447){return db[_0xb1b4('0x13')]['findAll']({'raw':_0x18e241[_0xb1b4('0x14')]?_0x18e241[_0xb1b4('0x14')]['raw']===undefined?!![]:![]:!![],'where':_0x18e241[_0xb1b4('0x14')]?_0x18e241['options'][_0xb1b4('0x15')]||null:null,'attributes':_0x18e241[_0xb1b4('0x14')]?_0x18e241[_0xb1b4('0x14')]['attributes']||null:null,'limit':_0x18e241[_0xb1b4('0x14')]?_0x18e241['options'][_0xb1b4('0x16')]||null:null,'include':_0x18e241['options']?_0x18e241['options'][_0xb1b4('0x17')]?_['map'](_0x18e241['options'][_0xb1b4('0x17')],function(_0x29e636){return{'model':db[_0x29e636[_0xb1b4('0x18')]],'as':_0x29e636['as'],'attributes':_0x29e636['attributes'],'include':_0x29e636['include']?_['map'](_0x29e636['include'],function(_0x325b59){return{'model':db[_0x325b59[_0xb1b4('0x18')]],'as':_0x325b59['as'],'attributes':_0x325b59[_0xb1b4('0x19')],'include':_0x325b59[_0xb1b4('0x17')]?_[_0xb1b4('0x1a')](_0x325b59['include'],function(_0x7147ea){return{'model':db[_0x7147ea[_0xb1b4('0x18')]],'as':_0x7147ea['as'],'attributes':_0x7147ea[_0xb1b4('0x19')]};}):[]};}):[]};}):[]:[]})[_0xb1b4('0x1b')](function(_0x110a9e){logger[_0xb1b4('0xf')](_0xb1b4('0x12'),_0x18e241);logger[_0xb1b4('0xa')](_0xb1b4('0x12'),_0x18e241,JSON['stringify'](_0x110a9e));_0xe3a94c(_0x110a9e);})['catch'](function(_0x5be548){logger['error']('GetFreshdeskAccount',_0x5be548[_0xb1b4('0xe')],_0x18e241);_0xe5e447(_0x943577['error'](0x1f4,_0x5be548[_0xb1b4('0xe')]));});});};exports[_0xb1b4('0x1c')]=function(_0x3c5515){var _0x4a944a=this;return new Promise(function(_0x36d202,_0x365b4e){return db[_0xb1b4('0x13')]['find']({'raw':_0x3c5515['options']?_0x3c5515[_0xb1b4('0x14')]['raw']===undefined?!![]:![]:!![],'where':_0x3c5515[_0xb1b4('0x14')]?_0x3c5515[_0xb1b4('0x14')][_0xb1b4('0x15')]||null:null,'attributes':_0x3c5515[_0xb1b4('0x14')]?_0x3c5515[_0xb1b4('0x14')][_0xb1b4('0x19')]||null:null,'include':_0x3c5515[_0xb1b4('0x14')]?_0x3c5515[_0xb1b4('0x14')][_0xb1b4('0x17')]?_[_0xb1b4('0x1a')](_0x3c5515[_0xb1b4('0x14')]['include'],function(_0x2a8093){return{'model':db[_0x2a8093[_0xb1b4('0x18')]],'as':_0x2a8093['as'],'attributes':_0x2a8093[_0xb1b4('0x19')],'include':_0x2a8093[_0xb1b4('0x17')]?_[_0xb1b4('0x1a')](_0x2a8093['include'],function(_0x4632e2){return{'model':db[_0x4632e2[_0xb1b4('0x18')]],'as':_0x4632e2['as'],'attributes':_0x4632e2[_0xb1b4('0x19')],'include':_0x4632e2['include']?_[_0xb1b4('0x1a')](_0x4632e2[_0xb1b4('0x17')],function(_0x7920b1){return{'model':db[_0x7920b1['model']],'as':_0x7920b1['as'],'attributes':_0x7920b1[_0xb1b4('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x322b6f){logger[_0xb1b4('0xf')]('ShowFreshdeskAccount',_0x3c5515);logger[_0xb1b4('0xa')]('ShowFreshdeskAccount',_0x3c5515,JSON[_0xb1b4('0x1d')](_0x322b6f));_0x36d202(_0x322b6f);})[_0xb1b4('0x11')](function(_0x30baba){logger['error']('ShowFreshdeskAccount',_0x30baba[_0xb1b4('0xe')],_0x3c5515);_0x365b4e(_0x4a944a[_0xb1b4('0xc')](0x1f4,_0x30baba[_0xb1b4('0xe')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index 659cff9..e9e9acc 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 _0xd238=['/:id/tags','post','create','setTags','put','destroy','multer','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./intFreshdeskConfiguration.controller','isAuthenticated','index','get','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','getDescriptions'];(function(_0xba0394,_0x2c6844){var _0x1789dd=function(_0x437c00){while(--_0x437c00){_0xba0394['push'](_0xba0394['shift']());}};_0x1789dd(++_0x2c6844);}(_0xd238,0x15f));var _0x8d23=function(_0xdf0f66,_0x5f3953){_0xdf0f66=_0xdf0f66-0x0;var _0x55be21=_0xd238[_0xdf0f66];return _0x55be21;};'use strict';var multer=require(_0x8d23('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x8d23('0x1'));var express=require(_0x8d23('0x2'));var router=express['Router']();var fs_extra=require(_0x8d23('0x3'));var auth=require(_0x8d23('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x8d23('0x5'));var controller=require(_0x8d23('0x6'));router['get']('/',auth[_0x8d23('0x7')](),controller[_0x8d23('0x8')]);router[_0x8d23('0x9')](_0x8d23('0xa'),auth[_0x8d23('0x7')](),controller[_0x8d23('0xb')]);router[_0x8d23('0x9')](_0x8d23('0xc'),auth['isAuthenticated'](),controller[_0x8d23('0xd')]);router['get'](_0x8d23('0xe'),auth[_0x8d23('0x7')](),controller[_0x8d23('0xf')]);router[_0x8d23('0x9')]('/:id/descriptions',auth[_0x8d23('0x7')](),controller[_0x8d23('0x10')]);router[_0x8d23('0x9')](_0x8d23('0x11'),auth[_0x8d23('0x7')](),controller['getTags']);router[_0x8d23('0x12')]('/',auth[_0x8d23('0x7')](),controller[_0x8d23('0x13')]);router[_0x8d23('0x12')](_0x8d23('0x11'),auth[_0x8d23('0x7')](),controller[_0x8d23('0x14')]);router[_0x8d23('0x15')](_0x8d23('0xa'),auth[_0x8d23('0x7')](),controller['update']);router['delete']('/:id',auth[_0x8d23('0x7')](),controller[_0x8d23('0x16')]);module['exports']=router; \ No newline at end of file +var _0xcf98=['destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./intFreshdeskConfiguration.controller','get','isAuthenticated','index','/:id','show','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','post','create','setTags','update','delete'];(function(_0x4e11e7,_0x42d0b6){var _0x1d7d39=function(_0x416030){while(--_0x416030){_0x4e11e7['push'](_0x4e11e7['shift']());}};_0x1d7d39(++_0x42d0b6);}(_0xcf98,0x154));var _0x8cf9=function(_0x2046ed,_0x2b1391){_0x2046ed=_0x2046ed-0x0;var _0x541a07=_0xcf98[_0x2046ed];return _0x541a07;};'use strict';var multer=require(_0x8cf9('0x0'));var util=require('util');var path=require(_0x8cf9('0x1'));var timeout=require(_0x8cf9('0x2'));var express=require(_0x8cf9('0x3'));var router=express['Router']();var fs_extra=require(_0x8cf9('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x8cf9('0x5'));var config=require(_0x8cf9('0x6'));var controller=require(_0x8cf9('0x7'));router[_0x8cf9('0x8')]('/',auth[_0x8cf9('0x9')](),controller[_0x8cf9('0xa')]);router[_0x8cf9('0x8')](_0x8cf9('0xb'),auth[_0x8cf9('0x9')](),controller[_0x8cf9('0xc')]);router[_0x8cf9('0x8')]('/:id/fields',auth[_0x8cf9('0x9')](),controller[_0x8cf9('0xd')]);router['get'](_0x8cf9('0xe'),auth[_0x8cf9('0x9')](),controller[_0x8cf9('0xf')]);router['get'](_0x8cf9('0x10'),auth[_0x8cf9('0x9')](),controller[_0x8cf9('0x11')]);router[_0x8cf9('0x8')](_0x8cf9('0x12'),auth['isAuthenticated'](),controller['getTags']);router[_0x8cf9('0x13')]('/',auth[_0x8cf9('0x9')](),controller[_0x8cf9('0x14')]);router[_0x8cf9('0x13')](_0x8cf9('0x12'),auth['isAuthenticated'](),controller[_0x8cf9('0x15')]);router['put'](_0x8cf9('0xb'),auth['isAuthenticated'](),controller[_0x8cf9('0x16')]);router[_0x8cf9('0x17')](_0x8cf9('0xb'),auth[_0x8cf9('0x9')](),controller[_0x8cf9('0x18')]);module[_0x8cf9('0x19')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js index e52858c..2eeaef7 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 _0x4fff=['STRING','exports'];(function(_0x2bf141,_0x31eac7){var _0x48277b=function(_0x9fe560){while(--_0x9fe560){_0x2bf141['push'](_0x2bf141['shift']());}};_0x48277b(++_0x31eac7);}(_0x4fff,0xa5));var _0xf4ff=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x4fff[_0x3ab51d];return _0x29a04e;};'use strict';var Sequelize=require('sequelize');module[_0xf4ff('0x0')]={'name':{'type':Sequelize[_0xf4ff('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x27b5=['STRING','sequelize'];(function(_0x16dfb3,_0x1613fc){var _0x1d8030=function(_0x1bd5da){while(--_0x1bd5da){_0x16dfb3['push'](_0x16dfb3['shift']());}};_0x1d8030(++_0x1613fc);}(_0x27b5,0x85));var _0x527b=function(_0x34b821,_0x504e55){_0x34b821=_0x34b821-0x0;var _0x5e00a0=_0x27b5[_0x34b821];return _0x5e00a0;};'use strict';var Sequelize=require(_0x527b('0x0'));module['exports']={'name':{'type':Sequelize[_0x527b('0x1')]},'description':{'type':Sequelize[_0x527b('0x1')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js index 73c164f..72ea18e 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 _0x72b3=['api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','map','FreshdeskConfiguration','rawAttributes','fieldName','type','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','rows','catch','show','options','find','create','body','params','getFields','findOne','FreshdeskField','getSubjects','getDescriptions','Tag','getTags','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x3f763e,_0x701e4e){var _0xbaeae3=function(_0x3bc827){while(--_0x3bc827){_0x3f763e['push'](_0x3f763e['shift']());}};_0xbaeae3(++_0x701e4e);}(_0x72b3,0x99));var _0x372b=function(_0x228ac9,_0x42f065){_0x228ac9=_0x228ac9-0x0;var _0x69fe02=_0x72b3[_0x228ac9];return _0x69fe02;};'use strict';var emlformat=require(_0x372b('0x0'));var rimraf=require(_0x372b('0x1'));var zipdir=require(_0x372b('0x2'));var jsonpatch=require(_0x372b('0x3'));var rp=require('request-promise');var moment=require(_0x372b('0x4'));var BPromise=require(_0x372b('0x5'));var Mustache=require('mustache');var util=require(_0x372b('0x6'));var path=require(_0x372b('0x7'));var sox=require(_0x372b('0x8'));var csv=require(_0x372b('0x9'));var ejs=require(_0x372b('0xa'));var fs=require('fs');var fs_extra=require(_0x372b('0xb'));var _=require(_0x372b('0xc'));var squel=require(_0x372b('0xd'));var crypto=require('crypto');var jsforce=require(_0x372b('0xe'));var deskjs=require(_0x372b('0xf'));var toCsv=require(_0x372b('0x9'));var querystring=require(_0x372b('0x10'));var Papa=require('papaparse');var Redis=require(_0x372b('0x11'));var authService=require(_0x372b('0x12'));var qs=require(_0x372b('0x13'));var as=require(_0x372b('0x14'));var hardwareService=require(_0x372b('0x15'));var logger=require(_0x372b('0x16'))(_0x372b('0x17'));var utils=require(_0x372b('0x18'));var config=require(_0x372b('0x19'));var licenseUtil=require(_0x372b('0x1a'));var db=require(_0x372b('0x1b'))['db'];function respondWithStatusCode(_0x383d2e,_0xbf533f){_0xbf533f=_0xbf533f||0xcc;return function(_0x3b5c49){if(_0x3b5c49){return _0x383d2e[_0x372b('0x1c')](_0xbf533f);}return _0x383d2e[_0x372b('0x1d')](_0xbf533f)[_0x372b('0x1e')]();};}function respondWithResult(_0x25d7a4,_0x52aded){_0x52aded=_0x52aded||0xc8;return function(_0x5cbcde){if(_0x5cbcde){return _0x25d7a4[_0x372b('0x1d')](_0x52aded)[_0x372b('0x1f')](_0x5cbcde);}};}function respondWithFilteredResult(_0x79ffac,_0x55cd8a){return function(_0x4b0def){if(_0x4b0def){var _0xf17ca9=typeof _0x55cd8a[_0x372b('0x20')]===_0x372b('0x21')&&typeof _0x55cd8a[_0x372b('0x22')]===_0x372b('0x21');var _0xb226c=_0x4b0def[_0x372b('0x23')];var _0x56e78=_0xf17ca9?0x0:_0x55cd8a[_0x372b('0x20')];var _0x257ad0=_0xf17ca9?_0x4b0def[_0x372b('0x23')]:_0x55cd8a[_0x372b('0x20')]+_0x55cd8a[_0x372b('0x22')];var _0x3693b1;if(_0x257ad0>=_0xb226c){_0x257ad0=_0xb226c;_0x3693b1=0xc8;}else{_0x3693b1=0xce;}_0x79ffac[_0x372b('0x1d')](_0x3693b1);return _0x79ffac[_0x372b('0x24')](_0x372b('0x25'),_0x56e78+'-'+_0x257ad0+'/'+_0xb226c)[_0x372b('0x1f')](_0x4b0def);}return null;};}function patchUpdates(_0x34660b){return function(_0x55874f){try{jsonpatch['apply'](_0x55874f,_0x34660b,!![]);}catch(_0x779125){return BPromise[_0x372b('0x26')](_0x779125);}return _0x55874f[_0x372b('0x27')]();};}function saveUpdates(_0x18df50,_0x39d5fe){return function(_0x11434f){if(_0x11434f){return _0x11434f[_0x372b('0x28')](_0x18df50)[_0x372b('0x29')](function(_0x484941){return _0x484941;});}return null;};}function removeEntity(_0x521ed2,_0x3f0c6a){return function(_0x5dac83){if(_0x5dac83){return _0x5dac83[_0x372b('0x2a')]()[_0x372b('0x29')](function(){_0x521ed2[_0x372b('0x1d')](0xcc)[_0x372b('0x1e')]();});}};}function handleEntityNotFound(_0x228956,_0x493c5b){return function(_0xf75127){if(!_0xf75127){_0x228956['sendStatus'](0x194);}return _0xf75127;};}function handleError(_0x5edb31,_0x3c0d05){_0x3c0d05=_0x3c0d05||0x1f4;return function(_0x39f68d){logger[_0x372b('0x2b')](_0x39f68d[_0x372b('0x2c')]);if(_0x39f68d[_0x372b('0x2d')]){delete _0x39f68d[_0x372b('0x2d')];}_0x5edb31[_0x372b('0x1d')](_0x3c0d05)[_0x372b('0x2e')](_0x39f68d);};}exports['index']=function(_0x4e750a,_0x13fd3b){var _0x3c652f={},_0x245857={},_0x3e5396={'count':0x0,'rows':[]};var _0x599e30=_[_0x372b('0x2f')](db[_0x372b('0x30')][_0x372b('0x31')],function(_0x48647b){return{'name':_0x48647b[_0x372b('0x32')],'type':_0x48647b[_0x372b('0x33')]['key']};});_0x245857[_0x372b('0x34')]=_[_0x372b('0x2f')](_0x599e30,_0x372b('0x2d'));_0x245857['query']=_[_0x372b('0x35')](_0x4e750a['query']);_0x245857[_0x372b('0x36')]=_[_0x372b('0x37')](_0x245857[_0x372b('0x34')],_0x245857[_0x372b('0x38')]);_0x3c652f[_0x372b('0x39')]=_[_0x372b('0x37')](_0x245857[_0x372b('0x34')],qs['fields'](_0x4e750a['query'][_0x372b('0x3a')]));_0x3c652f['attributes']=_0x3c652f['attributes'][_0x372b('0x3b')]?_0x3c652f[_0x372b('0x39')]:_0x245857[_0x372b('0x34')];if(!_0x4e750a[_0x372b('0x38')][_0x372b('0x3c')](_0x372b('0x3d'))){_0x3c652f[_0x372b('0x22')]=qs[_0x372b('0x22')](_0x4e750a[_0x372b('0x38')][_0x372b('0x22')]);_0x3c652f[_0x372b('0x20')]=qs[_0x372b('0x20')](_0x4e750a['query'][_0x372b('0x20')]);}_0x3c652f[_0x372b('0x3e')]=qs[_0x372b('0x3f')](_0x4e750a[_0x372b('0x38')][_0x372b('0x3f')]);_0x3c652f[_0x372b('0x40')]=qs[_0x372b('0x36')](_[_0x372b('0x41')](_0x4e750a[_0x372b('0x38')],_0x245857['filters']),_0x599e30);if(_0x4e750a[_0x372b('0x38')][_0x372b('0x42')]){_0x3c652f[_0x372b('0x40')]=_[_0x372b('0x43')](_0x3c652f[_0x372b('0x40')],{'$or':_[_0x372b('0x2f')](_0x599e30,function(_0x50be8e){if(_0x50be8e[_0x372b('0x33')]!==_0x372b('0x44')){var _0x33e9d7={};_0x33e9d7[_0x50be8e[_0x372b('0x2d')]]={'$like':'%'+_0x4e750a['query'][_0x372b('0x42')]+'%'};return _0x33e9d7;}})});}_0x3c652f=_['merge']({},_0x3c652f,_0x4e750a['options']);var _0x64423d={'where':_0x3c652f[_0x372b('0x40')]};return db[_0x372b('0x30')]['count'](_0x64423d)[_0x372b('0x29')](function(_0x1912c3){_0x3e5396[_0x372b('0x23')]=_0x1912c3;if(_0x4e750a['query'][_0x372b('0x45')]){_0x3c652f[_0x372b('0x46')]=[{'all':!![]}];}return db[_0x372b('0x30')]['findAll'](_0x3c652f);})[_0x372b('0x29')](function(_0x560c50){_0x3e5396[_0x372b('0x47')]=_0x560c50;return _0x3e5396;})['then'](respondWithFilteredResult(_0x13fd3b,_0x3c652f))[_0x372b('0x48')](handleError(_0x13fd3b,null));};exports[_0x372b('0x49')]=function(_0xce9b83,_0x224108){var _0x434200={'raw':![],'where':{'id':_0xce9b83['params']['id']}},_0x45d357={};_0x45d357['model']=_[_0x372b('0x35')](db[_0x372b('0x30')][_0x372b('0x31')]);_0x45d357['query']=_[_0x372b('0x35')](_0xce9b83[_0x372b('0x38')]);_0x45d357['filters']=_[_0x372b('0x37')](_0x45d357[_0x372b('0x34')],_0x45d357[_0x372b('0x38')]);_0x434200['attributes']=_[_0x372b('0x37')](_0x45d357[_0x372b('0x34')],qs['fields'](_0xce9b83[_0x372b('0x38')]['fields']));_0x434200['attributes']=_0x434200[_0x372b('0x39')][_0x372b('0x3b')]?_0x434200[_0x372b('0x39')]:_0x45d357[_0x372b('0x34')];if(_0xce9b83['query'][_0x372b('0x45')]){_0x434200[_0x372b('0x46')]=[{'all':!![]}];}_0x434200=_[_0x372b('0x43')]({},_0x434200,_0xce9b83[_0x372b('0x4a')]);return db[_0x372b('0x30')][_0x372b('0x4b')](_0x434200)['then'](handleEntityNotFound(_0x224108,null))['then'](respondWithResult(_0x224108,null))['catch'](handleError(_0x224108,null));};exports[_0x372b('0x4c')]=function(_0x554e4d,_0x3ddfdb){return db[_0x372b('0x30')][_0x372b('0x4c')](_0x554e4d[_0x372b('0x4d')],{})[_0x372b('0x29')](respondWithResult(_0x3ddfdb,0xc9))['catch'](handleError(_0x3ddfdb,null));};exports[_0x372b('0x28')]=function(_0xae8605,_0x25a08f){if(_0xae8605[_0x372b('0x4d')]['id']){delete _0xae8605[_0x372b('0x4d')]['id'];}return db[_0x372b('0x30')][_0x372b('0x4b')]({'where':{'id':_0xae8605[_0x372b('0x4e')]['id']}})[_0x372b('0x29')](handleEntityNotFound(_0x25a08f,null))['then'](saveUpdates(_0xae8605[_0x372b('0x4d')],null))[_0x372b('0x29')](respondWithResult(_0x25a08f,null))[_0x372b('0x48')](handleError(_0x25a08f,null));};exports[_0x372b('0x2a')]=function(_0x3d1bc1,_0x3a388b){return db[_0x372b('0x30')][_0x372b('0x4b')]({'where':{'id':_0x3d1bc1[_0x372b('0x4e')]['id']}})[_0x372b('0x29')](handleEntityNotFound(_0x3a388b,null))[_0x372b('0x29')](removeEntity(_0x3a388b,null))[_0x372b('0x48')](handleError(_0x3a388b,null));};exports[_0x372b('0x4f')]=function(_0x53bc8d,_0x1753bb,_0x2ad625){var _0x9a4171={};var _0x2fbe7e={};var _0x657d14;var _0x2c7841;return db['FreshdeskConfiguration'][_0x372b('0x50')]({'where':{'id':_0x53bc8d[_0x372b('0x4e')]['id']}})[_0x372b('0x29')](handleEntityNotFound(_0x1753bb,null))[_0x372b('0x29')](function(_0x334682){if(_0x334682){_0x657d14=_0x334682;_0x2fbe7e[_0x372b('0x34')]=_['keys'](db['FreshdeskField']['rawAttributes']);_0x2fbe7e[_0x372b('0x38')]=_[_0x372b('0x35')](_0x53bc8d[_0x372b('0x38')]);_0x2fbe7e[_0x372b('0x36')]=_[_0x372b('0x37')](_0x2fbe7e[_0x372b('0x34')],_0x2fbe7e[_0x372b('0x38')]);_0x9a4171['attributes']=_[_0x372b('0x37')](_0x2fbe7e['model'],qs[_0x372b('0x3a')](_0x53bc8d[_0x372b('0x38')]['fields']));_0x9a4171[_0x372b('0x39')]=_0x9a4171[_0x372b('0x39')][_0x372b('0x3b')]?_0x9a4171[_0x372b('0x39')]:_0x2fbe7e[_0x372b('0x34')];_0x9a4171[_0x372b('0x3e')]=qs[_0x372b('0x3f')](_0x53bc8d[_0x372b('0x38')][_0x372b('0x3f')]);_0x9a4171[_0x372b('0x40')]=qs[_0x372b('0x36')](_['pick'](_0x53bc8d[_0x372b('0x38')],_0x2fbe7e['filters']));if(_0x53bc8d[_0x372b('0x38')][_0x372b('0x42')]){_0x9a4171['where']=_[_0x372b('0x43')](_0x9a4171[_0x372b('0x40')],{'$or':_['map'](_0x9a4171[_0x372b('0x39')],function(_0x29ddab){var _0x23637c={};_0x23637c[_0x29ddab]={'$like':'%'+_0x53bc8d[_0x372b('0x38')]['filter']+'%'};return _0x23637c;})});}_0x9a4171=_['merge']({},_0x9a4171,_0x53bc8d[_0x372b('0x4a')]);return _0x657d14[_0x372b('0x4f')](_0x9a4171);}})[_0x372b('0x29')](function(_0x4f20a8){if(_0x4f20a8){_0x2c7841=_0x4f20a8[_0x372b('0x3b')];if(!_0x53bc8d[_0x372b('0x38')][_0x372b('0x3c')]('nolimit')){_0x9a4171[_0x372b('0x22')]=qs[_0x372b('0x22')](_0x53bc8d['query'][_0x372b('0x22')]);_0x9a4171[_0x372b('0x20')]=qs['offset'](_0x53bc8d[_0x372b('0x38')][_0x372b('0x20')]);}return _0x657d14[_0x372b('0x4f')](_0x9a4171);}})[_0x372b('0x29')](function(_0xc57c36){if(_0xc57c36){return _0xc57c36?{'count':_0x2c7841,'rows':_0xc57c36}:null;}})[_0x372b('0x29')](respondWithResult(_0x1753bb,null))[_0x372b('0x48')](handleError(_0x1753bb,null));};exports['getSubjects']=function(_0x4b4ebc,_0x164d21,_0x3ea159){var _0xb1e824={};var _0x1e0e61={};var _0x3b2612;var _0x4b0fd5;return db['FreshdeskConfiguration'][_0x372b('0x50')]({'where':{'id':_0x4b4ebc['params']['id']}})['then'](handleEntityNotFound(_0x164d21,null))['then'](function(_0xb33b26){if(_0xb33b26){_0x3b2612=_0xb33b26;_0x1e0e61['model']=_['keys'](db[_0x372b('0x51')][_0x372b('0x31')]);_0x1e0e61[_0x372b('0x38')]=_['keys'](_0x4b4ebc[_0x372b('0x38')]);_0x1e0e61[_0x372b('0x36')]=_[_0x372b('0x37')](_0x1e0e61['model'],_0x1e0e61[_0x372b('0x38')]);_0xb1e824[_0x372b('0x39')]=_[_0x372b('0x37')](_0x1e0e61['model'],qs['fields'](_0x4b4ebc[_0x372b('0x38')]['fields']));_0xb1e824['attributes']=_0xb1e824[_0x372b('0x39')][_0x372b('0x3b')]?_0xb1e824[_0x372b('0x39')]:_0x1e0e61['model'];_0xb1e824['order']=qs['sort'](_0x4b4ebc[_0x372b('0x38')][_0x372b('0x3f')]);_0xb1e824['where']=qs[_0x372b('0x36')](_[_0x372b('0x41')](_0x4b4ebc['query'],_0x1e0e61[_0x372b('0x36')]));if(_0x4b4ebc[_0x372b('0x38')][_0x372b('0x42')]){_0xb1e824[_0x372b('0x40')]=_[_0x372b('0x43')](_0xb1e824[_0x372b('0x40')],{'$or':_['map'](_0xb1e824[_0x372b('0x39')],function(_0x5d2e6b){var _0x2184d0={};_0x2184d0[_0x5d2e6b]={'$like':'%'+_0x4b4ebc[_0x372b('0x38')]['filter']+'%'};return _0x2184d0;})});}_0xb1e824=_[_0x372b('0x43')]({},_0xb1e824,_0x4b4ebc[_0x372b('0x4a')]);return _0x3b2612[_0x372b('0x52')](_0xb1e824);}})[_0x372b('0x29')](function(_0x3a0bee){if(_0x3a0bee){_0x4b0fd5=_0x3a0bee[_0x372b('0x3b')];if(!_0x4b4ebc[_0x372b('0x38')][_0x372b('0x3c')](_0x372b('0x3d'))){_0xb1e824[_0x372b('0x22')]=qs['limit'](_0x4b4ebc[_0x372b('0x38')][_0x372b('0x22')]);_0xb1e824[_0x372b('0x20')]=qs['offset'](_0x4b4ebc[_0x372b('0x38')][_0x372b('0x20')]);}return _0x3b2612[_0x372b('0x52')](_0xb1e824);}})[_0x372b('0x29')](function(_0x2833e7){if(_0x2833e7){return _0x2833e7?{'count':_0x4b0fd5,'rows':_0x2833e7}:null;}})['then'](respondWithResult(_0x164d21,null))[_0x372b('0x48')](handleError(_0x164d21,null));};exports[_0x372b('0x53')]=function(_0x53b656,_0x2fe47d,_0x44cedf){var _0x2187a4={};var _0x83a3e8={};var _0x643479;var _0xd80e28;return db[_0x372b('0x30')][_0x372b('0x50')]({'where':{'id':_0x53b656[_0x372b('0x4e')]['id']}})[_0x372b('0x29')](handleEntityNotFound(_0x2fe47d,null))[_0x372b('0x29')](function(_0x3144e4){if(_0x3144e4){_0x643479=_0x3144e4;_0x83a3e8[_0x372b('0x34')]=_['keys'](db[_0x372b('0x51')][_0x372b('0x31')]);_0x83a3e8[_0x372b('0x38')]=_[_0x372b('0x35')](_0x53b656[_0x372b('0x38')]);_0x83a3e8[_0x372b('0x36')]=_['intersection'](_0x83a3e8['model'],_0x83a3e8[_0x372b('0x38')]);_0x2187a4['attributes']=_[_0x372b('0x37')](_0x83a3e8[_0x372b('0x34')],qs['fields'](_0x53b656[_0x372b('0x38')]['fields']));_0x2187a4[_0x372b('0x39')]=_0x2187a4[_0x372b('0x39')][_0x372b('0x3b')]?_0x2187a4[_0x372b('0x39')]:_0x83a3e8['model'];_0x2187a4['order']=qs['sort'](_0x53b656[_0x372b('0x38')][_0x372b('0x3f')]);_0x2187a4[_0x372b('0x40')]=qs[_0x372b('0x36')](_['pick'](_0x53b656[_0x372b('0x38')],_0x83a3e8[_0x372b('0x36')]));if(_0x53b656[_0x372b('0x38')][_0x372b('0x42')]){_0x2187a4[_0x372b('0x40')]=_[_0x372b('0x43')](_0x2187a4[_0x372b('0x40')],{'$or':_[_0x372b('0x2f')](_0x2187a4[_0x372b('0x39')],function(_0x35a180){var _0x307b54={};_0x307b54[_0x35a180]={'$like':'%'+_0x53b656[_0x372b('0x38')][_0x372b('0x42')]+'%'};return _0x307b54;})});}_0x2187a4=_[_0x372b('0x43')]({},_0x2187a4,_0x53b656[_0x372b('0x4a')]);return _0x643479[_0x372b('0x53')](_0x2187a4);}})['then'](function(_0x235f9f){if(_0x235f9f){_0xd80e28=_0x235f9f['length'];if(!_0x53b656['query']['hasOwnProperty'](_0x372b('0x3d'))){_0x2187a4[_0x372b('0x22')]=qs[_0x372b('0x22')](_0x53b656[_0x372b('0x38')][_0x372b('0x22')]);_0x2187a4[_0x372b('0x20')]=qs[_0x372b('0x20')](_0x53b656[_0x372b('0x38')][_0x372b('0x20')]);}return _0x643479[_0x372b('0x53')](_0x2187a4);}})[_0x372b('0x29')](function(_0xf717a6){if(_0xf717a6){return _0xf717a6?{'count':_0xd80e28,'rows':_0xf717a6}:null;}})[_0x372b('0x29')](respondWithResult(_0x2fe47d,null))['catch'](handleError(_0x2fe47d,null));};exports['getTags']=function(_0x5f50c1,_0x24ab50,_0x2a19d3){var _0x1dd6ab={};var _0x3f6016={};var _0x5c6725;var _0x7c00ca;return db[_0x372b('0x30')][_0x372b('0x50')]({'where':{'id':_0x5f50c1[_0x372b('0x4e')]['id']}})['then'](handleEntityNotFound(_0x24ab50,null))[_0x372b('0x29')](function(_0x25a6fc){if(_0x25a6fc){_0x5c6725=_0x25a6fc;_0x3f6016[_0x372b('0x34')]=_['keys'](db[_0x372b('0x54')][_0x372b('0x31')]);_0x3f6016[_0x372b('0x38')]=_[_0x372b('0x35')](_0x5f50c1[_0x372b('0x38')]);_0x3f6016[_0x372b('0x36')]=_[_0x372b('0x37')](_0x3f6016[_0x372b('0x34')],_0x3f6016['query']);_0x1dd6ab[_0x372b('0x39')]=_[_0x372b('0x37')](_0x3f6016['model'],qs['fields'](_0x5f50c1[_0x372b('0x38')][_0x372b('0x3a')]));_0x1dd6ab[_0x372b('0x39')]=_0x1dd6ab[_0x372b('0x39')][_0x372b('0x3b')]?_0x1dd6ab[_0x372b('0x39')]:_0x3f6016['model'];_0x1dd6ab['order']=qs[_0x372b('0x3f')](_0x5f50c1[_0x372b('0x38')]['sort']);_0x1dd6ab['where']=qs['filters'](_[_0x372b('0x41')](_0x5f50c1[_0x372b('0x38')],_0x3f6016[_0x372b('0x36')]));if(_0x5f50c1[_0x372b('0x38')][_0x372b('0x42')]){_0x1dd6ab[_0x372b('0x40')]=_[_0x372b('0x43')](_0x1dd6ab[_0x372b('0x40')],{'$or':_[_0x372b('0x2f')](_0x1dd6ab['attributes'],function(_0x20fb7d){var _0x1c7021={};_0x1c7021[_0x20fb7d]={'$like':'%'+_0x5f50c1[_0x372b('0x38')]['filter']+'%'};return _0x1c7021;})});}_0x1dd6ab=_[_0x372b('0x43')]({},_0x1dd6ab,_0x5f50c1[_0x372b('0x4a')]);return _0x5c6725[_0x372b('0x55')](_0x1dd6ab);}})['then'](function(_0x32f7bc){if(_0x32f7bc){_0x7c00ca=_0x32f7bc[_0x372b('0x3b')];if(!_0x5f50c1[_0x372b('0x38')][_0x372b('0x3c')](_0x372b('0x3d'))){_0x1dd6ab[_0x372b('0x22')]=qs[_0x372b('0x22')](_0x5f50c1[_0x372b('0x38')][_0x372b('0x22')]);_0x1dd6ab['offset']=qs['offset'](_0x5f50c1[_0x372b('0x38')][_0x372b('0x20')]);}return _0x5c6725[_0x372b('0x55')](_0x1dd6ab);}})[_0x372b('0x29')](function(_0x1583ef){if(_0x1583ef){return _0x1583ef?{'count':_0x7c00ca,'rows':_0x1583ef}:null;}})[_0x372b('0x29')](respondWithResult(_0x24ab50,null))[_0x372b('0x48')](handleError(_0x24ab50,null));};exports[_0x372b('0x56')]=function(_0x47f97a,_0x1fb554,_0x32e902){if(_0x47f97a['body']['id']){delete _0x47f97a[_0x372b('0x4d')]['id'];}return db[_0x372b('0x30')][_0x372b('0x50')]({'where':{'id':_0x47f97a[_0x372b('0x4e')]['id']}})['then'](handleEntityNotFound(_0x1fb554,null))['then'](function(_0x328135){if(_0x328135){return _0x328135[_0x372b('0x56')](_0x47f97a[_0x372b('0x4d')][_0x372b('0x57')]||[]);}return null;})['then'](respondWithResult(_0x1fb554,null))['catch'](handleError(_0x1fb554,null));}; \ No newline at end of file +var _0x1bab=['limit','count','set','Content-Range','apply','destroy','then','end','sendStatus','stack','name','index','FreshdeskConfiguration','rawAttributes','fieldName','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','type','VIRTUAL','options','include','findAll','rows','catch','params','includeAll','find','create','body','getFields','findOne','pick','getSubjects','FreshdeskField','getDescriptions','getTags','Tag','setTags','ids','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','json','offset','undefined'];(function(_0x1a7f5b,_0x2821e9){var _0x464a32=function(_0x436e80){while(--_0x436e80){_0x1a7f5b['push'](_0x1a7f5b['shift']());}};_0x464a32(++_0x2821e9);}(_0x1bab,0x1d9));var _0xb1ba=function(_0x46c98e,_0x3bc084){_0x46c98e=_0x46c98e-0x0;var _0x5bfd75=_0x1bab[_0x46c98e];return _0x5bfd75;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb1ba('0x0'));var zipdir=require(_0xb1ba('0x1'));var jsonpatch=require(_0xb1ba('0x2'));var rp=require(_0xb1ba('0x3'));var moment=require('moment');var BPromise=require(_0xb1ba('0x4'));var Mustache=require(_0xb1ba('0x5'));var util=require(_0xb1ba('0x6'));var path=require(_0xb1ba('0x7'));var sox=require('sox');var csv=require(_0xb1ba('0x8'));var ejs=require(_0xb1ba('0x9'));var fs=require('fs');var fs_extra=require(_0xb1ba('0xa'));var _=require(_0xb1ba('0xb'));var squel=require('squel');var crypto=require(_0xb1ba('0xc'));var jsforce=require(_0xb1ba('0xd'));var deskjs=require(_0xb1ba('0xe'));var toCsv=require(_0xb1ba('0x8'));var querystring=require(_0xb1ba('0xf'));var Papa=require(_0xb1ba('0x10'));var Redis=require(_0xb1ba('0x11'));var authService=require(_0xb1ba('0x12'));var qs=require(_0xb1ba('0x13'));var as=require(_0xb1ba('0x14'));var hardwareService=require(_0xb1ba('0x15'));var logger=require(_0xb1ba('0x16'))(_0xb1ba('0x17'));var utils=require(_0xb1ba('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xb1ba('0x19'));var db=require(_0xb1ba('0x1a'))['db'];function respondWithStatusCode(_0x1b213f,_0x3dc620){_0x3dc620=_0x3dc620||0xcc;return function(_0x4a69b8){if(_0x4a69b8){return _0x1b213f['sendStatus'](_0x3dc620);}return _0x1b213f[_0xb1ba('0x1b')](_0x3dc620)['end']();};}function respondWithResult(_0x2d165d,_0xdb50ba){_0xdb50ba=_0xdb50ba||0xc8;return function(_0x2d431d){if(_0x2d431d){return _0x2d165d[_0xb1ba('0x1b')](_0xdb50ba)[_0xb1ba('0x1c')](_0x2d431d);}};}function respondWithFilteredResult(_0x831041,_0x313a02){return function(_0x4ea962){if(_0x4ea962){var _0x29d9b7=typeof _0x313a02[_0xb1ba('0x1d')]===_0xb1ba('0x1e')&&typeof _0x313a02[_0xb1ba('0x1f')]==='undefined';var _0x2466bd=_0x4ea962[_0xb1ba('0x20')];var _0x4f2526=_0x29d9b7?0x0:_0x313a02[_0xb1ba('0x1d')];var _0x23e1d3=_0x29d9b7?_0x4ea962[_0xb1ba('0x20')]:_0x313a02[_0xb1ba('0x1d')]+_0x313a02[_0xb1ba('0x1f')];var _0x11eb71;if(_0x23e1d3>=_0x2466bd){_0x23e1d3=_0x2466bd;_0x11eb71=0xc8;}else{_0x11eb71=0xce;}_0x831041[_0xb1ba('0x1b')](_0x11eb71);return _0x831041[_0xb1ba('0x21')](_0xb1ba('0x22'),_0x4f2526+'-'+_0x23e1d3+'/'+_0x2466bd)[_0xb1ba('0x1c')](_0x4ea962);}return null;};}function patchUpdates(_0x48dcd3){return function(_0x4e7d18){try{jsonpatch[_0xb1ba('0x23')](_0x4e7d18,_0x48dcd3,!![]);}catch(_0x23eea9){return BPromise['reject'](_0x23eea9);}return _0x4e7d18['save']();};}function saveUpdates(_0x5bb37c,_0x54874f){return function(_0x297bd3){if(_0x297bd3){return _0x297bd3['update'](_0x5bb37c)['then'](function(_0x5cce43){return _0x5cce43;});}return null;};}function removeEntity(_0x1b1de3,_0x245e84){return function(_0x50a33c){if(_0x50a33c){return _0x50a33c[_0xb1ba('0x24')]()[_0xb1ba('0x25')](function(){_0x1b1de3[_0xb1ba('0x1b')](0xcc)[_0xb1ba('0x26')]();});}};}function handleEntityNotFound(_0x2ac327,_0x21ebd7){return function(_0x3919b9){if(!_0x3919b9){_0x2ac327[_0xb1ba('0x27')](0x194);}return _0x3919b9;};}function handleError(_0x110f31,_0x21406e){_0x21406e=_0x21406e||0x1f4;return function(_0x5d602f){logger['error'](_0x5d602f[_0xb1ba('0x28')]);if(_0x5d602f[_0xb1ba('0x29')]){delete _0x5d602f[_0xb1ba('0x29')];}_0x110f31[_0xb1ba('0x1b')](_0x21406e)['send'](_0x5d602f);};}exports[_0xb1ba('0x2a')]=function(_0x36ec82,_0x51aa4a){var _0x1b5d01={},_0x4d1e9f={},_0x418c3a={'count':0x0,'rows':[]};var _0x23fae3=_['map'](db[_0xb1ba('0x2b')][_0xb1ba('0x2c')],function(_0x5a5f6d){return{'name':_0x5a5f6d[_0xb1ba('0x2d')],'type':_0x5a5f6d['type']['key']};});_0x4d1e9f[_0xb1ba('0x2e')]=_[_0xb1ba('0x2f')](_0x23fae3,_0xb1ba('0x29'));_0x4d1e9f[_0xb1ba('0x30')]=_[_0xb1ba('0x31')](_0x36ec82['query']);_0x4d1e9f[_0xb1ba('0x32')]=_[_0xb1ba('0x33')](_0x4d1e9f[_0xb1ba('0x2e')],_0x4d1e9f[_0xb1ba('0x30')]);_0x1b5d01[_0xb1ba('0x34')]=_['intersection'](_0x4d1e9f[_0xb1ba('0x2e')],qs[_0xb1ba('0x35')](_0x36ec82[_0xb1ba('0x30')]['fields']));_0x1b5d01[_0xb1ba('0x34')]=_0x1b5d01[_0xb1ba('0x34')][_0xb1ba('0x36')]?_0x1b5d01[_0xb1ba('0x34')]:_0x4d1e9f['model'];if(!_0x36ec82[_0xb1ba('0x30')][_0xb1ba('0x37')](_0xb1ba('0x38'))){_0x1b5d01[_0xb1ba('0x1f')]=qs[_0xb1ba('0x1f')](_0x36ec82[_0xb1ba('0x30')][_0xb1ba('0x1f')]);_0x1b5d01[_0xb1ba('0x1d')]=qs[_0xb1ba('0x1d')](_0x36ec82['query'][_0xb1ba('0x1d')]);}_0x1b5d01[_0xb1ba('0x39')]=qs[_0xb1ba('0x3a')](_0x36ec82['query'][_0xb1ba('0x3a')]);_0x1b5d01['where']=qs[_0xb1ba('0x32')](_['pick'](_0x36ec82[_0xb1ba('0x30')],_0x4d1e9f['filters']),_0x23fae3);if(_0x36ec82['query'][_0xb1ba('0x3b')]){_0x1b5d01[_0xb1ba('0x3c')]=_[_0xb1ba('0x3d')](_0x1b5d01[_0xb1ba('0x3c')],{'$or':_[_0xb1ba('0x2f')](_0x23fae3,function(_0x1ea6aa){if(_0x1ea6aa[_0xb1ba('0x3e')]!==_0xb1ba('0x3f')){var _0x932b0b={};_0x932b0b[_0x1ea6aa[_0xb1ba('0x29')]]={'$like':'%'+_0x36ec82[_0xb1ba('0x30')][_0xb1ba('0x3b')]+'%'};return _0x932b0b;}})});}_0x1b5d01=_[_0xb1ba('0x3d')]({},_0x1b5d01,_0x36ec82[_0xb1ba('0x40')]);var _0x3d9074={'where':_0x1b5d01['where']};return db['FreshdeskConfiguration'][_0xb1ba('0x20')](_0x3d9074)[_0xb1ba('0x25')](function(_0x7c2537){_0x418c3a['count']=_0x7c2537;if(_0x36ec82[_0xb1ba('0x30')]['includeAll']){_0x1b5d01[_0xb1ba('0x41')]=[{'all':!![]}];}return db['FreshdeskConfiguration'][_0xb1ba('0x42')](_0x1b5d01);})[_0xb1ba('0x25')](function(_0x1b64dc){_0x418c3a[_0xb1ba('0x43')]=_0x1b64dc;return _0x418c3a;})['then'](respondWithFilteredResult(_0x51aa4a,_0x1b5d01))[_0xb1ba('0x44')](handleError(_0x51aa4a,null));};exports['show']=function(_0x1f8430,_0x381333){var _0x5d9bfc={'raw':![],'where':{'id':_0x1f8430[_0xb1ba('0x45')]['id']}},_0x5c3797={};_0x5c3797['model']=_[_0xb1ba('0x31')](db[_0xb1ba('0x2b')][_0xb1ba('0x2c')]);_0x5c3797['query']=_['keys'](_0x1f8430[_0xb1ba('0x30')]);_0x5c3797[_0xb1ba('0x32')]=_[_0xb1ba('0x33')](_0x5c3797[_0xb1ba('0x2e')],_0x5c3797[_0xb1ba('0x30')]);_0x5d9bfc[_0xb1ba('0x34')]=_[_0xb1ba('0x33')](_0x5c3797[_0xb1ba('0x2e')],qs[_0xb1ba('0x35')](_0x1f8430[_0xb1ba('0x30')][_0xb1ba('0x35')]));_0x5d9bfc[_0xb1ba('0x34')]=_0x5d9bfc['attributes'][_0xb1ba('0x36')]?_0x5d9bfc[_0xb1ba('0x34')]:_0x5c3797[_0xb1ba('0x2e')];if(_0x1f8430['query'][_0xb1ba('0x46')]){_0x5d9bfc[_0xb1ba('0x41')]=[{'all':!![]}];}_0x5d9bfc=_[_0xb1ba('0x3d')]({},_0x5d9bfc,_0x1f8430[_0xb1ba('0x40')]);return db['FreshdeskConfiguration'][_0xb1ba('0x47')](_0x5d9bfc)[_0xb1ba('0x25')](handleEntityNotFound(_0x381333,null))[_0xb1ba('0x25')](respondWithResult(_0x381333,null))[_0xb1ba('0x44')](handleError(_0x381333,null));};exports[_0xb1ba('0x48')]=function(_0x2b6fe8,_0x334c6f){return db[_0xb1ba('0x2b')]['create'](_0x2b6fe8['body'],{})['then'](respondWithResult(_0x334c6f,0xc9))[_0xb1ba('0x44')](handleError(_0x334c6f,null));};exports['update']=function(_0x3ce14b,_0x376e09){if(_0x3ce14b['body']['id']){delete _0x3ce14b[_0xb1ba('0x49')]['id'];}return db[_0xb1ba('0x2b')][_0xb1ba('0x47')]({'where':{'id':_0x3ce14b[_0xb1ba('0x45')]['id']}})['then'](handleEntityNotFound(_0x376e09,null))[_0xb1ba('0x25')](saveUpdates(_0x3ce14b[_0xb1ba('0x49')],null))[_0xb1ba('0x25')](respondWithResult(_0x376e09,null))[_0xb1ba('0x44')](handleError(_0x376e09,null));};exports['destroy']=function(_0x5acd30,_0x3b4d06){return db[_0xb1ba('0x2b')][_0xb1ba('0x47')]({'where':{'id':_0x5acd30[_0xb1ba('0x45')]['id']}})[_0xb1ba('0x25')](handleEntityNotFound(_0x3b4d06,null))['then'](removeEntity(_0x3b4d06,null))[_0xb1ba('0x44')](handleError(_0x3b4d06,null));};exports[_0xb1ba('0x4a')]=function(_0x2c0f81,_0x5fb877,_0x31e4f2){var _0x36dab4={};var _0x1064c8={};var _0x54d95d;var _0xeada1e;return db['FreshdeskConfiguration'][_0xb1ba('0x4b')]({'where':{'id':_0x2c0f81[_0xb1ba('0x45')]['id']}})[_0xb1ba('0x25')](handleEntityNotFound(_0x5fb877,null))[_0xb1ba('0x25')](function(_0x2cad12){if(_0x2cad12){_0x54d95d=_0x2cad12;_0x1064c8['model']=_[_0xb1ba('0x31')](db['FreshdeskField']['rawAttributes']);_0x1064c8['query']=_[_0xb1ba('0x31')](_0x2c0f81['query']);_0x1064c8[_0xb1ba('0x32')]=_[_0xb1ba('0x33')](_0x1064c8['model'],_0x1064c8[_0xb1ba('0x30')]);_0x36dab4['attributes']=_[_0xb1ba('0x33')](_0x1064c8[_0xb1ba('0x2e')],qs[_0xb1ba('0x35')](_0x2c0f81[_0xb1ba('0x30')][_0xb1ba('0x35')]));_0x36dab4[_0xb1ba('0x34')]=_0x36dab4[_0xb1ba('0x34')][_0xb1ba('0x36')]?_0x36dab4['attributes']:_0x1064c8[_0xb1ba('0x2e')];_0x36dab4[_0xb1ba('0x39')]=qs[_0xb1ba('0x3a')](_0x2c0f81[_0xb1ba('0x30')][_0xb1ba('0x3a')]);_0x36dab4[_0xb1ba('0x3c')]=qs[_0xb1ba('0x32')](_[_0xb1ba('0x4c')](_0x2c0f81['query'],_0x1064c8[_0xb1ba('0x32')]));if(_0x2c0f81[_0xb1ba('0x30')][_0xb1ba('0x3b')]){_0x36dab4[_0xb1ba('0x3c')]=_[_0xb1ba('0x3d')](_0x36dab4[_0xb1ba('0x3c')],{'$or':_[_0xb1ba('0x2f')](_0x36dab4['attributes'],function(_0x3c40ac){var _0x5dc556={};_0x5dc556[_0x3c40ac]={'$like':'%'+_0x2c0f81[_0xb1ba('0x30')][_0xb1ba('0x3b')]+'%'};return _0x5dc556;})});}_0x36dab4=_[_0xb1ba('0x3d')]({},_0x36dab4,_0x2c0f81[_0xb1ba('0x40')]);return _0x54d95d[_0xb1ba('0x4a')](_0x36dab4);}})[_0xb1ba('0x25')](function(_0x1b87f5){if(_0x1b87f5){_0xeada1e=_0x1b87f5[_0xb1ba('0x36')];if(!_0x2c0f81[_0xb1ba('0x30')][_0xb1ba('0x37')](_0xb1ba('0x38'))){_0x36dab4[_0xb1ba('0x1f')]=qs[_0xb1ba('0x1f')](_0x2c0f81[_0xb1ba('0x30')][_0xb1ba('0x1f')]);_0x36dab4[_0xb1ba('0x1d')]=qs[_0xb1ba('0x1d')](_0x2c0f81[_0xb1ba('0x30')][_0xb1ba('0x1d')]);}return _0x54d95d[_0xb1ba('0x4a')](_0x36dab4);}})[_0xb1ba('0x25')](function(_0x412a6b){if(_0x412a6b){return _0x412a6b?{'count':_0xeada1e,'rows':_0x412a6b}:null;}})[_0xb1ba('0x25')](respondWithResult(_0x5fb877,null))[_0xb1ba('0x44')](handleError(_0x5fb877,null));};exports[_0xb1ba('0x4d')]=function(_0x2e383f,_0x47f0c8,_0x176624){var _0x1038dd={};var _0x7f42eb={};var _0x4dc122;var _0x16cb12;return db[_0xb1ba('0x2b')]['findOne']({'where':{'id':_0x2e383f[_0xb1ba('0x45')]['id']}})[_0xb1ba('0x25')](handleEntityNotFound(_0x47f0c8,null))[_0xb1ba('0x25')](function(_0x931b48){if(_0x931b48){_0x4dc122=_0x931b48;_0x7f42eb[_0xb1ba('0x2e')]=_['keys'](db[_0xb1ba('0x4e')]['rawAttributes']);_0x7f42eb['query']=_['keys'](_0x2e383f[_0xb1ba('0x30')]);_0x7f42eb[_0xb1ba('0x32')]=_['intersection'](_0x7f42eb['model'],_0x7f42eb['query']);_0x1038dd['attributes']=_['intersection'](_0x7f42eb['model'],qs['fields'](_0x2e383f['query'][_0xb1ba('0x35')]));_0x1038dd[_0xb1ba('0x34')]=_0x1038dd[_0xb1ba('0x34')][_0xb1ba('0x36')]?_0x1038dd['attributes']:_0x7f42eb['model'];_0x1038dd[_0xb1ba('0x39')]=qs[_0xb1ba('0x3a')](_0x2e383f[_0xb1ba('0x30')]['sort']);_0x1038dd[_0xb1ba('0x3c')]=qs[_0xb1ba('0x32')](_[_0xb1ba('0x4c')](_0x2e383f[_0xb1ba('0x30')],_0x7f42eb[_0xb1ba('0x32')]));if(_0x2e383f[_0xb1ba('0x30')]['filter']){_0x1038dd['where']=_[_0xb1ba('0x3d')](_0x1038dd[_0xb1ba('0x3c')],{'$or':_[_0xb1ba('0x2f')](_0x1038dd[_0xb1ba('0x34')],function(_0x2dabac){var _0x258323={};_0x258323[_0x2dabac]={'$like':'%'+_0x2e383f[_0xb1ba('0x30')][_0xb1ba('0x3b')]+'%'};return _0x258323;})});}_0x1038dd=_[_0xb1ba('0x3d')]({},_0x1038dd,_0x2e383f[_0xb1ba('0x40')]);return _0x4dc122[_0xb1ba('0x4d')](_0x1038dd);}})['then'](function(_0x3594f4){if(_0x3594f4){_0x16cb12=_0x3594f4[_0xb1ba('0x36')];if(!_0x2e383f[_0xb1ba('0x30')][_0xb1ba('0x37')](_0xb1ba('0x38'))){_0x1038dd[_0xb1ba('0x1f')]=qs[_0xb1ba('0x1f')](_0x2e383f[_0xb1ba('0x30')][_0xb1ba('0x1f')]);_0x1038dd[_0xb1ba('0x1d')]=qs['offset'](_0x2e383f[_0xb1ba('0x30')]['offset']);}return _0x4dc122[_0xb1ba('0x4d')](_0x1038dd);}})[_0xb1ba('0x25')](function(_0x3f64f5){if(_0x3f64f5){return _0x3f64f5?{'count':_0x16cb12,'rows':_0x3f64f5}:null;}})[_0xb1ba('0x25')](respondWithResult(_0x47f0c8,null))[_0xb1ba('0x44')](handleError(_0x47f0c8,null));};exports[_0xb1ba('0x4f')]=function(_0x3ef9eb,_0x4b3545,_0x395f33){var _0x957e33={};var _0xfbe5b5={};var _0x22626a;var _0x436a1d;return db[_0xb1ba('0x2b')]['findOne']({'where':{'id':_0x3ef9eb[_0xb1ba('0x45')]['id']}})['then'](handleEntityNotFound(_0x4b3545,null))[_0xb1ba('0x25')](function(_0x29e071){if(_0x29e071){_0x22626a=_0x29e071;_0xfbe5b5[_0xb1ba('0x2e')]=_[_0xb1ba('0x31')](db[_0xb1ba('0x4e')]['rawAttributes']);_0xfbe5b5[_0xb1ba('0x30')]=_[_0xb1ba('0x31')](_0x3ef9eb[_0xb1ba('0x30')]);_0xfbe5b5[_0xb1ba('0x32')]=_[_0xb1ba('0x33')](_0xfbe5b5[_0xb1ba('0x2e')],_0xfbe5b5['query']);_0x957e33[_0xb1ba('0x34')]=_[_0xb1ba('0x33')](_0xfbe5b5[_0xb1ba('0x2e')],qs[_0xb1ba('0x35')](_0x3ef9eb['query'][_0xb1ba('0x35')]));_0x957e33[_0xb1ba('0x34')]=_0x957e33['attributes']['length']?_0x957e33[_0xb1ba('0x34')]:_0xfbe5b5[_0xb1ba('0x2e')];_0x957e33[_0xb1ba('0x39')]=qs[_0xb1ba('0x3a')](_0x3ef9eb['query'][_0xb1ba('0x3a')]);_0x957e33['where']=qs['filters'](_[_0xb1ba('0x4c')](_0x3ef9eb[_0xb1ba('0x30')],_0xfbe5b5[_0xb1ba('0x32')]));if(_0x3ef9eb[_0xb1ba('0x30')][_0xb1ba('0x3b')]){_0x957e33[_0xb1ba('0x3c')]=_[_0xb1ba('0x3d')](_0x957e33[_0xb1ba('0x3c')],{'$or':_[_0xb1ba('0x2f')](_0x957e33['attributes'],function(_0x11b406){var _0x56013f={};_0x56013f[_0x11b406]={'$like':'%'+_0x3ef9eb['query']['filter']+'%'};return _0x56013f;})});}_0x957e33=_[_0xb1ba('0x3d')]({},_0x957e33,_0x3ef9eb[_0xb1ba('0x40')]);return _0x22626a[_0xb1ba('0x4f')](_0x957e33);}})[_0xb1ba('0x25')](function(_0x50e22f){if(_0x50e22f){_0x436a1d=_0x50e22f[_0xb1ba('0x36')];if(!_0x3ef9eb[_0xb1ba('0x30')][_0xb1ba('0x37')](_0xb1ba('0x38'))){_0x957e33[_0xb1ba('0x1f')]=qs['limit'](_0x3ef9eb['query'][_0xb1ba('0x1f')]);_0x957e33[_0xb1ba('0x1d')]=qs[_0xb1ba('0x1d')](_0x3ef9eb['query']['offset']);}return _0x22626a[_0xb1ba('0x4f')](_0x957e33);}})[_0xb1ba('0x25')](function(_0x159484){if(_0x159484){return _0x159484?{'count':_0x436a1d,'rows':_0x159484}:null;}})['then'](respondWithResult(_0x4b3545,null))[_0xb1ba('0x44')](handleError(_0x4b3545,null));};exports[_0xb1ba('0x50')]=function(_0x5d7b83,_0x10d43a,_0x470717){var _0x529f53={};var _0x56e57e={};var _0x5d6071;var _0x1c4a43;return db[_0xb1ba('0x2b')]['findOne']({'where':{'id':_0x5d7b83[_0xb1ba('0x45')]['id']}})[_0xb1ba('0x25')](handleEntityNotFound(_0x10d43a,null))[_0xb1ba('0x25')](function(_0x1b7efe){if(_0x1b7efe){_0x5d6071=_0x1b7efe;_0x56e57e[_0xb1ba('0x2e')]=_['keys'](db[_0xb1ba('0x51')]['rawAttributes']);_0x56e57e[_0xb1ba('0x30')]=_[_0xb1ba('0x31')](_0x5d7b83[_0xb1ba('0x30')]);_0x56e57e[_0xb1ba('0x32')]=_['intersection'](_0x56e57e[_0xb1ba('0x2e')],_0x56e57e[_0xb1ba('0x30')]);_0x529f53[_0xb1ba('0x34')]=_[_0xb1ba('0x33')](_0x56e57e[_0xb1ba('0x2e')],qs[_0xb1ba('0x35')](_0x5d7b83['query']['fields']));_0x529f53[_0xb1ba('0x34')]=_0x529f53['attributes']['length']?_0x529f53[_0xb1ba('0x34')]:_0x56e57e[_0xb1ba('0x2e')];_0x529f53[_0xb1ba('0x39')]=qs['sort'](_0x5d7b83[_0xb1ba('0x30')]['sort']);_0x529f53[_0xb1ba('0x3c')]=qs[_0xb1ba('0x32')](_[_0xb1ba('0x4c')](_0x5d7b83[_0xb1ba('0x30')],_0x56e57e[_0xb1ba('0x32')]));if(_0x5d7b83[_0xb1ba('0x30')][_0xb1ba('0x3b')]){_0x529f53[_0xb1ba('0x3c')]=_[_0xb1ba('0x3d')](_0x529f53[_0xb1ba('0x3c')],{'$or':_['map'](_0x529f53['attributes'],function(_0x161f60){var _0xb67cae={};_0xb67cae[_0x161f60]={'$like':'%'+_0x5d7b83[_0xb1ba('0x30')][_0xb1ba('0x3b')]+'%'};return _0xb67cae;})});}_0x529f53=_[_0xb1ba('0x3d')]({},_0x529f53,_0x5d7b83[_0xb1ba('0x40')]);return _0x5d6071[_0xb1ba('0x50')](_0x529f53);}})[_0xb1ba('0x25')](function(_0x30adac){if(_0x30adac){_0x1c4a43=_0x30adac[_0xb1ba('0x36')];if(!_0x5d7b83['query']['hasOwnProperty'](_0xb1ba('0x38'))){_0x529f53[_0xb1ba('0x1f')]=qs[_0xb1ba('0x1f')](_0x5d7b83[_0xb1ba('0x30')][_0xb1ba('0x1f')]);_0x529f53[_0xb1ba('0x1d')]=qs[_0xb1ba('0x1d')](_0x5d7b83[_0xb1ba('0x30')][_0xb1ba('0x1d')]);}return _0x5d6071[_0xb1ba('0x50')](_0x529f53);}})[_0xb1ba('0x25')](function(_0x2b33bb){if(_0x2b33bb){return _0x2b33bb?{'count':_0x1c4a43,'rows':_0x2b33bb}:null;}})['then'](respondWithResult(_0x10d43a,null))[_0xb1ba('0x44')](handleError(_0x10d43a,null));};exports[_0xb1ba('0x52')]=function(_0x3b1197,_0x45486b,_0x770769){if(_0x3b1197[_0xb1ba('0x49')]['id']){delete _0x3b1197[_0xb1ba('0x49')]['id'];}return db[_0xb1ba('0x2b')]['findOne']({'where':{'id':_0x3b1197[_0xb1ba('0x45')]['id']}})[_0xb1ba('0x25')](handleEntityNotFound(_0x45486b,null))[_0xb1ba('0x25')](function(_0x205267){if(_0x205267){return _0x205267[_0xb1ba('0x52')](_0x3b1197[_0xb1ba('0x49')][_0xb1ba('0x53')]||[]);}return null;})[_0xb1ba('0x25')](respondWithResult(_0x45486b,null))['catch'](handleError(_0x45486b,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index 2f679f2..7eec989 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 _0xdcc5=['api','moment','bluebird','path','rimraf','../../config/environment','./intFreshdeskConfiguration.attributes','define','FreshdeskConfiguration','int_freshdesk_configurations','lodash'];(function(_0x364850,_0x1f653a){var _0x5c4749=function(_0x5a16d0){while(--_0x5a16d0){_0x364850['push'](_0x364850['shift']());}};_0x5c4749(++_0x1f653a);}(_0xdcc5,0x1ee));var _0x5dcc=function(_0x5c0fbd,_0x469440){_0x5c0fbd=_0x5c0fbd-0x0;var _0x3d9619=_0xdcc5[_0x5c0fbd];return _0x3d9619;};'use strict';var _=require(_0x5dcc('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x5dcc('0x1'));var moment=require(_0x5dcc('0x2'));var BPromise=require(_0x5dcc('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5dcc('0x4'));var rimraf=require(_0x5dcc('0x5'));var config=require(_0x5dcc('0x6'));var attributes=require(_0x5dcc('0x7'));module['exports']=function(_0x5b08d7,_0x17208b){return _0x5b08d7[_0x5dcc('0x8')](_0x5dcc('0x9'),attributes,{'tableName':_0x5dcc('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3025=['lodash','util','moment','path','../../config/environment','FreshdeskConfiguration'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x3025,0x156));var _0x5302=function(_0x239cfb,_0x2539d9){_0x239cfb=_0x239cfb-0x0;var _0x35eab8=_0x3025[_0x239cfb];return _0x35eab8;};'use strict';var _=require(_0x5302('0x0'));var util=require(_0x5302('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x5302('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x5302('0x3'));var rimraf=require('rimraf');var config=require(_0x5302('0x4'));var attributes=require('./intFreshdeskConfiguration.attributes');module['exports']=function(_0x4236ef,_0x17f39a){return _0x4236ef['define'](_0x5302('0x5'),attributes,{'tableName':'int_freshdesk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.rpc.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.rpc.js index 796a6d7..b7f43cd 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 _0x6d7a=['util','moment','ioredis','../../mysqldb','rpc','jayson/promise','client','http','request','then','info','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','lodash'];(function(_0x3d2255,_0x450a7c){var _0x42540d=function(_0x3e1ccf){while(--_0x3e1ccf){_0x3d2255['push'](_0x3d2255['shift']());}};_0x42540d(++_0x450a7c);}(_0x6d7a,0x168));var _0xa6d7=function(_0xbff4b9,_0xf8cf41){_0xbff4b9=_0xbff4b9-0x0;var _0x40e841=_0x6d7a[_0xbff4b9];return _0x40e841;};'use strict';var _=require(_0xa6d7('0x0'));var util=require(_0xa6d7('0x1'));var moment=require(_0xa6d7('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa6d7('0x3'));var db=require(_0xa6d7('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xa6d7('0x5'));var config=require('../../config/environment');var jayson=require(_0xa6d7('0x6'));var client=jayson[_0xa6d7('0x7')][_0xa6d7('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1122d1,_0x1e5766,_0x3ceee1){return new BPromise(function(_0xb78bd4,_0x1b88e4){return client[_0xa6d7('0x9')](_0x1122d1,_0x3ceee1)[_0xa6d7('0xa')](function(_0x375022){logger[_0xa6d7('0xb')](_0xa6d7('0xc'),_0x1e5766,_0xa6d7('0xd'));logger[_0xa6d7('0xe')]('FreshdeskConfiguration,\x20%s,\x20%s,\x20%s',_0x1e5766,_0xa6d7('0xd'),JSON[_0xa6d7('0xf')](_0x375022));if(_0x375022[_0xa6d7('0x10')]){if(_0x375022['error'][_0xa6d7('0x11')]===0x1f4){logger[_0xa6d7('0x10')](_0xa6d7('0xc'),_0x1e5766,_0x375022[_0xa6d7('0x10')][_0xa6d7('0x12')]);return _0x1b88e4(_0x375022['error'][_0xa6d7('0x12')]);}logger['error']('FreshdeskConfiguration,\x20%s,\x20%s',_0x1e5766,_0x375022[_0xa6d7('0x10')][_0xa6d7('0x12')]);return _0xb78bd4(_0x375022[_0xa6d7('0x10')]['message']);}else{logger[_0xa6d7('0xb')](_0xa6d7('0xc'),_0x1e5766,_0xa6d7('0xd'));_0xb78bd4(_0x375022['result'][_0xa6d7('0x12')]);}})['catch'](function(_0x59f145){logger[_0xa6d7('0x10')](_0xa6d7('0xc'),_0x1e5766,_0x59f145);_0x1b88e4(_0x59f145);});});} \ No newline at end of file +var _0x4ce1=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','FreshdeskConfiguration,\x20%s,\x20%s','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger'];(function(_0x2d5023,_0x23178e){var _0x459de3=function(_0x97d826){while(--_0x97d826){_0x2d5023['push'](_0x2d5023['shift']());}};_0x459de3(++_0x23178e);}(_0x4ce1,0x9b));var _0x14ce=function(_0x2886a4,_0x36e326){_0x2886a4=_0x2886a4-0x0;var _0x12c717=_0x4ce1[_0x2886a4];return _0x12c717;};'use strict';var _=require('lodash');var util=require(_0x14ce('0x0'));var moment=require(_0x14ce('0x1'));var BPromise=require('bluebird');var rs=require(_0x14ce('0x2'));var fs=require('fs');var Redis=require(_0x14ce('0x3'));var db=require(_0x14ce('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x14ce('0x5'))(_0x14ce('0x6'));var config=require(_0x14ce('0x7'));var jayson=require(_0x14ce('0x8'));var client=jayson[_0x14ce('0x9')][_0x14ce('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1ec4cd,_0x2ef4df,_0x2863b1){return new BPromise(function(_0x2946fb,_0x43edbd){return client[_0x14ce('0xb')](_0x1ec4cd,_0x2863b1)[_0x14ce('0xc')](function(_0x1405cf){logger[_0x14ce('0xd')](_0x14ce('0xe'),_0x2ef4df,'request\x20sent');logger[_0x14ce('0xf')](_0x14ce('0x10'),_0x2ef4df,'request\x20sent',JSON['stringify'](_0x1405cf));if(_0x1405cf[_0x14ce('0x11')]){if(_0x1405cf[_0x14ce('0x11')][_0x14ce('0x12')]===0x1f4){logger['error'](_0x14ce('0xe'),_0x2ef4df,_0x1405cf['error'][_0x14ce('0x13')]);return _0x43edbd(_0x1405cf[_0x14ce('0x11')][_0x14ce('0x13')]);}logger[_0x14ce('0x11')](_0x14ce('0xe'),_0x2ef4df,_0x1405cf[_0x14ce('0x11')]['message']);return _0x2946fb(_0x1405cf[_0x14ce('0x11')][_0x14ce('0x13')]);}else{logger['info']('FreshdeskConfiguration,\x20%s,\x20%s',_0x2ef4df,_0x14ce('0x14'));_0x2946fb(_0x1405cf[_0x14ce('0x15')][_0x14ce('0x13')]);}})[_0x14ce('0x16')](function(_0xb970d7){logger[_0x14ce('0x11')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x2ef4df,_0xb970d7);_0x43edbd(_0xb970d7);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index 97719bc..c0e7d0d 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 _0x66f1=['../../components/auth/service','../../config/environment','./intFreshdeskField.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','multer','express','Router','fs-extra'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x66f1,0xd4));var _0x166f=function(_0x2a5740,_0x559005){_0x2a5740=_0x2a5740-0x0;var _0x411239=_0x66f1[_0x2a5740];return _0x411239;};'use strict';var multer=require(_0x166f('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x166f('0x1'));var router=express[_0x166f('0x2')]();var fs_extra=require(_0x166f('0x3'));var auth=require(_0x166f('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x166f('0x5'));var controller=require(_0x166f('0x6'));router[_0x166f('0x7')]('/',auth[_0x166f('0x8')](),controller[_0x166f('0x9')]);router['get'](_0x166f('0xa'),auth[_0x166f('0x8')](),controller[_0x166f('0xb')]);router[_0x166f('0xc')]('/',auth['isAuthenticated'](),controller[_0x166f('0xd')]);router[_0x166f('0xe')](_0x166f('0xa'),auth['isAuthenticated'](),controller[_0x166f('0xf')]);router[_0x166f('0x10')](_0x166f('0xa'),auth['isAuthenticated'](),controller[_0x166f('0x11')]);module['exports']=router; \ No newline at end of file +var _0x6b66=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intFreshdeskField.controller','index','/:id','isAuthenticated','post','create','put','update','delete','destroy','exports','util','path','connect-timeout'];(function(_0x4b5fe3,_0x2ec7f6){var _0x9d9aa5=function(_0x434e5d){while(--_0x434e5d){_0x4b5fe3['push'](_0x4b5fe3['shift']());}};_0x9d9aa5(++_0x2ec7f6);}(_0x6b66,0xc3));var _0x66b6=function(_0x57962a,_0x51bab7){_0x57962a=_0x57962a-0x0;var _0x3d2141=_0x6b66[_0x57962a];return _0x3d2141;};'use strict';var multer=require('multer');var util=require(_0x66b6('0x0'));var path=require(_0x66b6('0x1'));var timeout=require(_0x66b6('0x2'));var express=require('express');var router=express[_0x66b6('0x3')]();var fs_extra=require(_0x66b6('0x4'));var auth=require(_0x66b6('0x5'));var interaction=require(_0x66b6('0x6'));var config=require('../../config/environment');var controller=require(_0x66b6('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x66b6('0x8')]);router['get'](_0x66b6('0x9'),auth[_0x66b6('0xa')](),controller['show']);router[_0x66b6('0xb')]('/',auth['isAuthenticated'](),controller[_0x66b6('0xc')]);router[_0x66b6('0xd')](_0x66b6('0x9'),auth['isAuthenticated'](),controller[_0x66b6('0xe')]);router[_0x66b6('0xf')]('/:id',auth[_0x66b6('0xa')](),controller[_0x66b6('0x10')]);module[_0x66b6('0x11')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.attributes.js b/server/api/intFreshdeskField/intFreshdeskField.attributes.js index be4c4fa..a89b0ce 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 _0xa055=['customVariable','BOOLEAN','sequelize','exports','ENUM','string','variable','keyValue','picklist','STRING'];(function(_0x5e1ca7,_0xfbbac8){var _0x3a50cb=function(_0x1c726a){while(--_0x1c726a){_0x5e1ca7['push'](_0x5e1ca7['shift']());}};_0x3a50cb(++_0xfbbac8);}(_0xa055,0x11a));var _0x5a05=function(_0x436849,_0x430b00){_0x436849=_0x436849-0x0;var _0x5c5f73=_0xa055[_0x436849];return _0x5c5f73;};'use strict';var Sequelize=require(_0x5a05('0x0'));module[_0x5a05('0x1')]={'type':{'type':Sequelize[_0x5a05('0x2')](_0x5a05('0x3'),_0x5a05('0x4'),'customVariable',_0x5a05('0x5'),_0x5a05('0x6')),'defaultValue':_0x5a05('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x5a05('0x7')]},'keyType':{'type':Sequelize['ENUM'](_0x5a05('0x3'),_0x5a05('0x4'),_0x5a05('0x8'))},'keyContent':{'type':Sequelize[_0x5a05('0x7')]},'idField':{'type':Sequelize[_0x5a05('0x7')]},'nameField':{'type':Sequelize[_0x5a05('0x7')]},'customField':{'type':Sequelize[_0x5a05('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x5a05('0x7')]}}; \ No newline at end of file +var _0xa404=['sequelize','exports','string','customVariable','STRING','ENUM','variable','BOOLEAN'];(function(_0x2a0d54,_0xa5dc5d){var _0x5b6f0b=function(_0x4ab3cb){while(--_0x4ab3cb){_0x2a0d54['push'](_0x2a0d54['shift']());}};_0x5b6f0b(++_0xa5dc5d);}(_0xa404,0x100));var _0x4a40=function(_0x1fba9f,_0x2fe96f){_0x1fba9f=_0x1fba9f-0x0;var _0x34f78e=_0xa404[_0x1fba9f];return _0x34f78e;};'use strict';var Sequelize=require(_0x4a40('0x0'));module[_0x4a40('0x1')]={'type':{'type':Sequelize['ENUM'](_0x4a40('0x2'),'variable',_0x4a40('0x3'),'keyValue','picklist'),'defaultValue':'string'},'content':{'type':Sequelize[_0x4a40('0x4')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x4a40('0x5')](_0x4a40('0x2'),_0x4a40('0x6'),_0x4a40('0x3'))},'keyContent':{'type':Sequelize[_0x4a40('0x4')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x4a40('0x4')]},'customField':{'type':Sequelize[_0x4a40('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x4a40('0x4')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.controller.js b/server/api/intFreshdeskField/intFreshdeskField.controller.js index 67d5d14..43f9419 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 _0x2547=['filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','filter','merge','VIRTUAL','options','FreshdeskField','includeAll','include','rows','catch','params','find','create','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','../../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','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','index','map','rawAttributes','type','key','model','query','keys'];(function(_0x4d934b,_0x52f8e9){var _0xc0338b=function(_0x1a356c){while(--_0x1a356c){_0x4d934b['push'](_0x4d934b['shift']());}};_0xc0338b(++_0x52f8e9);}(_0x2547,0x1cd));var _0x7254=function(_0x24f7a4,_0x1da0d6){_0x24f7a4=_0x24f7a4-0x0;var _0x14428=_0x2547[_0x24f7a4];return _0x14428;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7254('0x0'));var zipdir=require(_0x7254('0x1'));var jsonpatch=require(_0x7254('0x2'));var rp=require(_0x7254('0x3'));var moment=require(_0x7254('0x4'));var BPromise=require(_0x7254('0x5'));var Mustache=require(_0x7254('0x6'));var util=require(_0x7254('0x7'));var path=require('path');var sox=require(_0x7254('0x8'));var csv=require(_0x7254('0x9'));var ejs=require(_0x7254('0xa'));var fs=require('fs');var fs_extra=require(_0x7254('0xb'));var _=require('lodash');var squel=require(_0x7254('0xc'));var crypto=require(_0x7254('0xd'));var jsforce=require(_0x7254('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x7254('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x7254('0xf'));var qs=require(_0x7254('0x10'));var as=require(_0x7254('0x11'));var hardwareService=require(_0x7254('0x12'));var logger=require(_0x7254('0x13'))(_0x7254('0x14'));var utils=require('../../config/utils');var config=require(_0x7254('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x7254('0x16'))['db'];function respondWithStatusCode(_0x53fc4f,_0x16c08e){_0x16c08e=_0x16c08e||0xcc;return function(_0x2bfff8){if(_0x2bfff8){return _0x53fc4f[_0x7254('0x17')](_0x16c08e);}return _0x53fc4f[_0x7254('0x18')](_0x16c08e)[_0x7254('0x19')]();};}function respondWithResult(_0x395a8a,_0x124192){_0x124192=_0x124192||0xc8;return function(_0x21cecc){if(_0x21cecc){return _0x395a8a[_0x7254('0x18')](_0x124192)[_0x7254('0x1a')](_0x21cecc);}};}function respondWithFilteredResult(_0x38a99c,_0x1ee5cb){return function(_0x163c8c){if(_0x163c8c){var _0x535065=typeof _0x1ee5cb[_0x7254('0x1b')]===_0x7254('0x1c')&&typeof _0x1ee5cb[_0x7254('0x1d')]===_0x7254('0x1c');var _0x3b5f06=_0x163c8c[_0x7254('0x1e')];var _0x2737e0=_0x535065?0x0:_0x1ee5cb['offset'];var _0x1f48f6=_0x535065?_0x163c8c[_0x7254('0x1e')]:_0x1ee5cb[_0x7254('0x1b')]+_0x1ee5cb[_0x7254('0x1d')];var _0x2a1ddc;if(_0x1f48f6>=_0x3b5f06){_0x1f48f6=_0x3b5f06;_0x2a1ddc=0xc8;}else{_0x2a1ddc=0xce;}_0x38a99c[_0x7254('0x18')](_0x2a1ddc);return _0x38a99c[_0x7254('0x1f')](_0x7254('0x20'),_0x2737e0+'-'+_0x1f48f6+'/'+_0x3b5f06)[_0x7254('0x1a')](_0x163c8c);}return null;};}function patchUpdates(_0x3b6cb6){return function(_0x2594b8){try{jsonpatch[_0x7254('0x21')](_0x2594b8,_0x3b6cb6,!![]);}catch(_0xc617b6){return BPromise[_0x7254('0x22')](_0xc617b6);}return _0x2594b8[_0x7254('0x23')]();};}function saveUpdates(_0x95ceaa,_0x2bb2fe){return function(_0x46c0a2){if(_0x46c0a2){return _0x46c0a2[_0x7254('0x24')](_0x95ceaa)[_0x7254('0x25')](function(_0x1be69b){return _0x1be69b;});}return null;};}function removeEntity(_0x50c34b,_0x493bfd){return function(_0x136ea3){if(_0x136ea3){return _0x136ea3[_0x7254('0x26')]()[_0x7254('0x25')](function(){_0x50c34b[_0x7254('0x18')](0xcc)[_0x7254('0x19')]();});}};}function handleEntityNotFound(_0x36b5d5,_0x133aee){return function(_0x5d6df5){if(!_0x5d6df5){_0x36b5d5[_0x7254('0x17')](0x194);}return _0x5d6df5;};}function handleError(_0x21a579,_0x2b4f46){_0x2b4f46=_0x2b4f46||0x1f4;return function(_0x494cdb){logger[_0x7254('0x27')](_0x494cdb['stack']);if(_0x494cdb[_0x7254('0x28')]){delete _0x494cdb[_0x7254('0x28')];}_0x21a579['status'](_0x2b4f46)[_0x7254('0x29')](_0x494cdb);};}exports[_0x7254('0x2a')]=function(_0x4f684c,_0x14cbea){var _0x6c4927={},_0x37cb5c={},_0xb9198b={'count':0x0,'rows':[]};var _0x43bf02=_[_0x7254('0x2b')](db['FreshdeskField'][_0x7254('0x2c')],function(_0x2dba3f){return{'name':_0x2dba3f['fieldName'],'type':_0x2dba3f[_0x7254('0x2d')][_0x7254('0x2e')]};});_0x37cb5c[_0x7254('0x2f')]=_['map'](_0x43bf02,_0x7254('0x28'));_0x37cb5c[_0x7254('0x30')]=_[_0x7254('0x31')](_0x4f684c[_0x7254('0x30')]);_0x37cb5c[_0x7254('0x32')]=_[_0x7254('0x33')](_0x37cb5c[_0x7254('0x2f')],_0x37cb5c['query']);_0x6c4927[_0x7254('0x34')]=_['intersection'](_0x37cb5c['model'],qs[_0x7254('0x35')](_0x4f684c[_0x7254('0x30')][_0x7254('0x35')]));_0x6c4927[_0x7254('0x34')]=_0x6c4927[_0x7254('0x34')][_0x7254('0x36')]?_0x6c4927[_0x7254('0x34')]:_0x37cb5c[_0x7254('0x2f')];if(!_0x4f684c[_0x7254('0x30')][_0x7254('0x37')](_0x7254('0x38'))){_0x6c4927[_0x7254('0x1d')]=qs[_0x7254('0x1d')](_0x4f684c[_0x7254('0x30')]['limit']);_0x6c4927[_0x7254('0x1b')]=qs[_0x7254('0x1b')](_0x4f684c[_0x7254('0x30')][_0x7254('0x1b')]);}_0x6c4927[_0x7254('0x39')]=qs['sort'](_0x4f684c[_0x7254('0x30')]['sort']);_0x6c4927[_0x7254('0x3a')]=qs[_0x7254('0x32')](_[_0x7254('0x3b')](_0x4f684c[_0x7254('0x30')],_0x37cb5c[_0x7254('0x32')]),_0x43bf02);if(_0x4f684c['query'][_0x7254('0x3c')]){_0x6c4927['where']=_[_0x7254('0x3d')](_0x6c4927[_0x7254('0x3a')],{'$or':_['map'](_0x43bf02,function(_0x1485a0){if(_0x1485a0[_0x7254('0x2d')]!==_0x7254('0x3e')){var _0x9273ee={};_0x9273ee[_0x1485a0[_0x7254('0x28')]]={'$like':'%'+_0x4f684c[_0x7254('0x30')]['filter']+'%'};return _0x9273ee;}})});}_0x6c4927=_[_0x7254('0x3d')]({},_0x6c4927,_0x4f684c[_0x7254('0x3f')]);var _0x105b8c={'where':_0x6c4927['where']};return db[_0x7254('0x40')][_0x7254('0x1e')](_0x105b8c)[_0x7254('0x25')](function(_0x4824d5){_0xb9198b[_0x7254('0x1e')]=_0x4824d5;if(_0x4f684c[_0x7254('0x30')][_0x7254('0x41')]){_0x6c4927[_0x7254('0x42')]=[{'all':!![]}];}return db[_0x7254('0x40')]['findAll'](_0x6c4927);})['then'](function(_0x25004f){_0xb9198b[_0x7254('0x43')]=_0x25004f;return _0xb9198b;})[_0x7254('0x25')](respondWithFilteredResult(_0x14cbea,_0x6c4927))[_0x7254('0x44')](handleError(_0x14cbea,null));};exports['show']=function(_0x53a7a7,_0x29821a){var _0x565cd8={'raw':!![],'where':{'id':_0x53a7a7[_0x7254('0x45')]['id']}},_0x2ae22e={};_0x2ae22e[_0x7254('0x2f')]=_[_0x7254('0x31')](db['FreshdeskField']['rawAttributes']);_0x2ae22e[_0x7254('0x30')]=_[_0x7254('0x31')](_0x53a7a7[_0x7254('0x30')]);_0x2ae22e[_0x7254('0x32')]=_[_0x7254('0x33')](_0x2ae22e['model'],_0x2ae22e['query']);_0x565cd8[_0x7254('0x34')]=_[_0x7254('0x33')](_0x2ae22e[_0x7254('0x2f')],qs['fields'](_0x53a7a7[_0x7254('0x30')][_0x7254('0x35')]));_0x565cd8['attributes']=_0x565cd8[_0x7254('0x34')][_0x7254('0x36')]?_0x565cd8[_0x7254('0x34')]:_0x2ae22e[_0x7254('0x2f')];if(_0x53a7a7['query'][_0x7254('0x41')]){_0x565cd8[_0x7254('0x42')]=[{'all':!![]}];}_0x565cd8=_['merge']({},_0x565cd8,_0x53a7a7[_0x7254('0x3f')]);return db[_0x7254('0x40')][_0x7254('0x46')](_0x565cd8)['then'](handleEntityNotFound(_0x29821a,null))[_0x7254('0x25')](respondWithResult(_0x29821a,null))[_0x7254('0x44')](handleError(_0x29821a,null));};exports['create']=function(_0x5f101e,_0x10b32f){return db['FreshdeskField'][_0x7254('0x47')](_0x5f101e[_0x7254('0x48')],{})['then'](respondWithResult(_0x10b32f,0xc9))['catch'](handleError(_0x10b32f,null));};exports[_0x7254('0x24')]=function(_0xc40bc5,_0x38bcd5){if(_0xc40bc5[_0x7254('0x48')]['id']){delete _0xc40bc5[_0x7254('0x48')]['id'];}return db[_0x7254('0x40')]['find']({'where':{'id':_0xc40bc5[_0x7254('0x45')]['id']}})['then'](handleEntityNotFound(_0x38bcd5,null))[_0x7254('0x25')](saveUpdates(_0xc40bc5[_0x7254('0x48')],null))[_0x7254('0x25')](respondWithResult(_0x38bcd5,null))['catch'](handleError(_0x38bcd5,null));};exports[_0x7254('0x26')]=function(_0x1c1a0e,_0x252758){return db['FreshdeskField'][_0x7254('0x46')]({'where':{'id':_0x1c1a0e[_0x7254('0x45')]['id']}})[_0x7254('0x25')](handleEntityNotFound(_0x252758,null))[_0x7254('0x25')](removeEntity(_0x252758,null))[_0x7254('0x44')](handleError(_0x252758,null));}; \ No newline at end of file +var _0xf45e=['Content-Range','json','apply','reject','save','destroy','then','sendStatus','stack','index','map','rawAttributes','type','key','model','name','filters','intersection','query','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','FreshdeskField','includeAll','include','findAll','rows','show','params','keys','length','merge','find','create','body','update','catch','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','end','status','offset','undefined','limit','count','set'];(function(_0x1f0390,_0xf8b214){var _0x1c43b6=function(_0x36a74f){while(--_0x36a74f){_0x1f0390['push'](_0x1f0390['shift']());}};_0x1c43b6(++_0xf8b214);}(_0xf45e,0x115));var _0xef45=function(_0x36ee51,_0x5cf108){_0x36ee51=_0x36ee51-0x0;var _0x18857b=_0xf45e[_0x36ee51];return _0x18857b;};'use strict';var emlformat=require(_0xef45('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xef45('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xef45('0x2'));var moment=require(_0xef45('0x3'));var BPromise=require(_0xef45('0x4'));var Mustache=require(_0xef45('0x5'));var util=require(_0xef45('0x6'));var path=require(_0xef45('0x7'));var sox=require(_0xef45('0x8'));var csv=require(_0xef45('0x9'));var ejs=require(_0xef45('0xa'));var fs=require('fs');var fs_extra=require(_0xef45('0xb'));var _=require(_0xef45('0xc'));var squel=require(_0xef45('0xd'));var crypto=require(_0xef45('0xe'));var jsforce=require(_0xef45('0xf'));var deskjs=require(_0xef45('0x10'));var toCsv=require(_0xef45('0x9'));var querystring=require(_0xef45('0x11'));var Papa=require(_0xef45('0x12'));var Redis=require(_0xef45('0x13'));var authService=require('../../components/auth/service');var qs=require(_0xef45('0x14'));var as=require(_0xef45('0x15'));var hardwareService=require(_0xef45('0x16'));var logger=require(_0xef45('0x17'))(_0xef45('0x18'));var utils=require(_0xef45('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0xef45('0x1a'));var db=require(_0xef45('0x1b'))['db'];function respondWithStatusCode(_0x30babb,_0x433be9){_0x433be9=_0x433be9||0xcc;return function(_0x476739){if(_0x476739){return _0x30babb['sendStatus'](_0x433be9);}return _0x30babb['status'](_0x433be9)[_0xef45('0x1c')]();};}function respondWithResult(_0x47fd96,_0x2ae89a){_0x2ae89a=_0x2ae89a||0xc8;return function(_0xb0fc43){if(_0xb0fc43){return _0x47fd96[_0xef45('0x1d')](_0x2ae89a)['json'](_0xb0fc43);}};}function respondWithFilteredResult(_0x5b3136,_0x29c0c4){return function(_0x5530e6){if(_0x5530e6){var _0x11cd3a=typeof _0x29c0c4[_0xef45('0x1e')]===_0xef45('0x1f')&&typeof _0x29c0c4[_0xef45('0x20')]==='undefined';var _0x560b2f=_0x5530e6[_0xef45('0x21')];var _0x219778=_0x11cd3a?0x0:_0x29c0c4[_0xef45('0x1e')];var _0x258785=_0x11cd3a?_0x5530e6['count']:_0x29c0c4['offset']+_0x29c0c4[_0xef45('0x20')];var _0x20ef26;if(_0x258785>=_0x560b2f){_0x258785=_0x560b2f;_0x20ef26=0xc8;}else{_0x20ef26=0xce;}_0x5b3136[_0xef45('0x1d')](_0x20ef26);return _0x5b3136[_0xef45('0x22')](_0xef45('0x23'),_0x219778+'-'+_0x258785+'/'+_0x560b2f)[_0xef45('0x24')](_0x5530e6);}return null;};}function patchUpdates(_0x375cbd){return function(_0x4a6217){try{jsonpatch[_0xef45('0x25')](_0x4a6217,_0x375cbd,!![]);}catch(_0x3e2a47){return BPromise[_0xef45('0x26')](_0x3e2a47);}return _0x4a6217[_0xef45('0x27')]();};}function saveUpdates(_0x27322f,_0x5205bf){return function(_0x40abc8){if(_0x40abc8){return _0x40abc8['update'](_0x27322f)['then'](function(_0x7707a1){return _0x7707a1;});}return null;};}function removeEntity(_0x2b41d8,_0xbb859b){return function(_0x7817d0){if(_0x7817d0){return _0x7817d0[_0xef45('0x28')]()[_0xef45('0x29')](function(){_0x2b41d8[_0xef45('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x208b35,_0x5f0593){return function(_0x38b470){if(!_0x38b470){_0x208b35[_0xef45('0x2a')](0x194);}return _0x38b470;};}function handleError(_0x578f03,_0x46e423){_0x46e423=_0x46e423||0x1f4;return function(_0x2c356d){logger['error'](_0x2c356d[_0xef45('0x2b')]);if(_0x2c356d['name']){delete _0x2c356d['name'];}_0x578f03['status'](_0x46e423)['send'](_0x2c356d);};}exports[_0xef45('0x2c')]=function(_0x2f72ef,_0x217e8d){var _0x15ad38={},_0x5782d0={},_0x18f304={'count':0x0,'rows':[]};var _0x4f028c=_[_0xef45('0x2d')](db['FreshdeskField'][_0xef45('0x2e')],function(_0x5bfd2d){return{'name':_0x5bfd2d['fieldName'],'type':_0x5bfd2d[_0xef45('0x2f')][_0xef45('0x30')]};});_0x5782d0[_0xef45('0x31')]=_[_0xef45('0x2d')](_0x4f028c,_0xef45('0x32'));_0x5782d0['query']=_['keys'](_0x2f72ef['query']);_0x5782d0[_0xef45('0x33')]=_[_0xef45('0x34')](_0x5782d0[_0xef45('0x31')],_0x5782d0[_0xef45('0x35')]);_0x15ad38[_0xef45('0x36')]=_[_0xef45('0x34')](_0x5782d0[_0xef45('0x31')],qs['fields'](_0x2f72ef['query'][_0xef45('0x37')]));_0x15ad38['attributes']=_0x15ad38[_0xef45('0x36')]['length']?_0x15ad38[_0xef45('0x36')]:_0x5782d0[_0xef45('0x31')];if(!_0x2f72ef[_0xef45('0x35')][_0xef45('0x38')](_0xef45('0x39'))){_0x15ad38['limit']=qs[_0xef45('0x20')](_0x2f72ef[_0xef45('0x35')][_0xef45('0x20')]);_0x15ad38['offset']=qs['offset'](_0x2f72ef[_0xef45('0x35')][_0xef45('0x1e')]);}_0x15ad38['order']=qs[_0xef45('0x3a')](_0x2f72ef['query']['sort']);_0x15ad38[_0xef45('0x3b')]=qs[_0xef45('0x33')](_[_0xef45('0x3c')](_0x2f72ef['query'],_0x5782d0[_0xef45('0x33')]),_0x4f028c);if(_0x2f72ef[_0xef45('0x35')][_0xef45('0x3d')]){_0x15ad38[_0xef45('0x3b')]=_['merge'](_0x15ad38['where'],{'$or':_[_0xef45('0x2d')](_0x4f028c,function(_0x474be1){if(_0x474be1[_0xef45('0x2f')]!==_0xef45('0x3e')){var _0x269a11={};_0x269a11[_0x474be1[_0xef45('0x32')]]={'$like':'%'+_0x2f72ef[_0xef45('0x35')][_0xef45('0x3d')]+'%'};return _0x269a11;}})});}_0x15ad38=_['merge']({},_0x15ad38,_0x2f72ef['options']);var _0x13f8b2={'where':_0x15ad38[_0xef45('0x3b')]};return db[_0xef45('0x3f')][_0xef45('0x21')](_0x13f8b2)[_0xef45('0x29')](function(_0x3bcada){_0x18f304[_0xef45('0x21')]=_0x3bcada;if(_0x2f72ef[_0xef45('0x35')][_0xef45('0x40')]){_0x15ad38[_0xef45('0x41')]=[{'all':!![]}];}return db[_0xef45('0x3f')][_0xef45('0x42')](_0x15ad38);})[_0xef45('0x29')](function(_0xd7d217){_0x18f304[_0xef45('0x43')]=_0xd7d217;return _0x18f304;})[_0xef45('0x29')](respondWithFilteredResult(_0x217e8d,_0x15ad38))['catch'](handleError(_0x217e8d,null));};exports[_0xef45('0x44')]=function(_0x5bdfad,_0x1b9d45){var _0x82c123={'raw':!![],'where':{'id':_0x5bdfad[_0xef45('0x45')]['id']}},_0x54ccb8={};_0x54ccb8['model']=_[_0xef45('0x46')](db['FreshdeskField'][_0xef45('0x2e')]);_0x54ccb8[_0xef45('0x35')]=_[_0xef45('0x46')](_0x5bdfad[_0xef45('0x35')]);_0x54ccb8[_0xef45('0x33')]=_[_0xef45('0x34')](_0x54ccb8[_0xef45('0x31')],_0x54ccb8['query']);_0x82c123[_0xef45('0x36')]=_[_0xef45('0x34')](_0x54ccb8[_0xef45('0x31')],qs[_0xef45('0x37')](_0x5bdfad[_0xef45('0x35')][_0xef45('0x37')]));_0x82c123[_0xef45('0x36')]=_0x82c123[_0xef45('0x36')][_0xef45('0x47')]?_0x82c123[_0xef45('0x36')]:_0x54ccb8[_0xef45('0x31')];if(_0x5bdfad[_0xef45('0x35')][_0xef45('0x40')]){_0x82c123[_0xef45('0x41')]=[{'all':!![]}];}_0x82c123=_[_0xef45('0x48')]({},_0x82c123,_0x5bdfad['options']);return db[_0xef45('0x3f')][_0xef45('0x49')](_0x82c123)[_0xef45('0x29')](handleEntityNotFound(_0x1b9d45,null))['then'](respondWithResult(_0x1b9d45,null))['catch'](handleError(_0x1b9d45,null));};exports['create']=function(_0x29aeab,_0x18143c){return db[_0xef45('0x3f')][_0xef45('0x4a')](_0x29aeab[_0xef45('0x4b')],{})[_0xef45('0x29')](respondWithResult(_0x18143c,0xc9))['catch'](handleError(_0x18143c,null));};exports[_0xef45('0x4c')]=function(_0x463796,_0x2b2419){if(_0x463796['body']['id']){delete _0x463796['body']['id'];}return db[_0xef45('0x3f')][_0xef45('0x49')]({'where':{'id':_0x463796['params']['id']}})[_0xef45('0x29')](handleEntityNotFound(_0x2b2419,null))[_0xef45('0x29')](saveUpdates(_0x463796[_0xef45('0x4b')],null))[_0xef45('0x29')](respondWithResult(_0x2b2419,null))[_0xef45('0x4d')](handleError(_0x2b2419,null));};exports[_0xef45('0x28')]=function(_0x23581f,_0xfa5fdd){return db[_0xef45('0x3f')][_0xef45('0x49')]({'where':{'id':_0x23581f[_0xef45('0x45')]['id']}})[_0xef45('0x29')](handleEntityNotFound(_0xfa5fdd,null))[_0xef45('0x29')](removeEntity(_0xfa5fdd,null))[_0xef45('0x4d')](handleError(_0xfa5fdd,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index 11c94a0..9de716d 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 _0x6343=['rimraf','./intFreshdeskField.attributes','exports','FreshdeskField','int_freshdesk_fields','freshdesk_unique_index','idField','FieldId','util','../../config/logger','api','request-promise','path'];(function(_0x44e350,_0x33d74f){var _0x52ccdb=function(_0x5d6138){while(--_0x5d6138){_0x44e350['push'](_0x44e350['shift']());}};_0x52ccdb(++_0x33d74f);}(_0x6343,0x1e9));var _0x3634=function(_0x5185c3,_0x36df34){_0x5185c3=_0x5185c3-0x0;var _0xe38fa5=_0x6343[_0x5185c3];return _0xe38fa5;};'use strict';var _=require('lodash');var util=require(_0x3634('0x0'));var logger=require(_0x3634('0x1'))(_0x3634('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x3634('0x3'));var fs=require('fs');var path=require(_0x3634('0x4'));var rimraf=require(_0x3634('0x5'));var config=require('../../config/environment');var attributes=require(_0x3634('0x6'));module[_0x3634('0x7')]=function(_0x5db25c,_0x4c5f9a){return _0x5db25c['define'](_0x3634('0x8'),attributes,{'tableName':_0x3634('0x9'),'paranoid':![],'indexes':[{'name':_0x3634('0xa'),'fields':[_0x3634('0xb'),_0x3634('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x24f5=['define','freshdesk_unique_index','idField','FieldId','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshdeskField.attributes','exports'];(function(_0x353890,_0x11c483){var _0x33eff3=function(_0x5273fa){while(--_0x5273fa){_0x353890['push'](_0x353890['shift']());}};_0x33eff3(++_0x11c483);}(_0x24f5,0x1ee));var _0x524f=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x24f5[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x524f('0x0'));var util=require(_0x524f('0x1'));var logger=require(_0x524f('0x2'))('api');var moment=require('moment');var BPromise=require(_0x524f('0x3'));var rp=require(_0x524f('0x4'));var fs=require('fs');var path=require(_0x524f('0x5'));var rimraf=require(_0x524f('0x6'));var config=require(_0x524f('0x7'));var attributes=require(_0x524f('0x8'));module[_0x524f('0x9')]=function(_0x4fc743,_0x3b7ff4){return _0x4fc743[_0x524f('0xa')]('FreshdeskField',attributes,{'tableName':'int_freshdesk_fields','paranoid':![],'indexes':[{'name':_0x524f('0xb'),'fields':[_0x524f('0xc'),_0x524f('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.rpc.js b/server/api/intFreshdeskField/intFreshdeskField.rpc.js index 651c2e7..d77b176 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 _0xfb1a=['../../config/environment','jayson/promise','client','http','then','FreshdeskField,\x20%s,\x20%s','request\x20sent','debug','FreshdeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfb1a,0xcf));var _0xafb1=function(_0x5e16d7,_0x4095cd){_0x5e16d7=_0x5e16d7-0x0;var _0x3de160=_0xfb1a[_0x5e16d7];return _0x3de160;};'use strict';var _=require(_0xafb1('0x0'));var util=require(_0xafb1('0x1'));var moment=require(_0xafb1('0x2'));var BPromise=require(_0xafb1('0x3'));var rs=require(_0xafb1('0x4'));var fs=require('fs');var Redis=require(_0xafb1('0x5'));var db=require(_0xafb1('0x6'))['db'];var utils=require(_0xafb1('0x7'));var logger=require(_0xafb1('0x8'))('rpc');var config=require(_0xafb1('0x9'));var jayson=require(_0xafb1('0xa'));var client=jayson[_0xafb1('0xb')][_0xafb1('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5e6064,_0x45a137,_0xc7d925){return new BPromise(function(_0x1e0a6b,_0x3b90c9){return client['request'](_0x5e6064,_0xc7d925)[_0xafb1('0xd')](function(_0x1b4af6){logger['info'](_0xafb1('0xe'),_0x45a137,_0xafb1('0xf'));logger[_0xafb1('0x10')](_0xafb1('0x11'),_0x45a137,_0xafb1('0xf'),JSON[_0xafb1('0x12')](_0x1b4af6));if(_0x1b4af6[_0xafb1('0x13')]){if(_0x1b4af6[_0xafb1('0x13')][_0xafb1('0x14')]===0x1f4){logger[_0xafb1('0x13')](_0xafb1('0xe'),_0x45a137,_0x1b4af6[_0xafb1('0x13')][_0xafb1('0x15')]);return _0x3b90c9(_0x1b4af6[_0xafb1('0x13')]['message']);}logger[_0xafb1('0x13')](_0xafb1('0xe'),_0x45a137,_0x1b4af6[_0xafb1('0x13')][_0xafb1('0x15')]);return _0x1e0a6b(_0x1b4af6[_0xafb1('0x13')][_0xafb1('0x15')]);}else{logger[_0xafb1('0x16')](_0xafb1('0xe'),_0x45a137,'request\x20sent');_0x1e0a6b(_0x1b4af6['result'][_0xafb1('0x15')]);}})[_0xafb1('0x17')](function(_0x40e7b3){logger[_0xafb1('0x13')](_0xafb1('0xe'),_0x45a137,_0x40e7b3);_0x3b90c9(_0x40e7b3);});});} \ No newline at end of file +var _0x63fe=['info','result','catch','lodash','util','bluebird','ioredis','../../config/environment','jayson/promise','client','http','request','then','FreshdeskField,\x20%s,\x20%s','request\x20sent','debug','FreshdeskField,\x20%s,\x20%s,\x20%s','error','message'];(function(_0x1720d6,_0x3e2308){var _0x48b5b7=function(_0x3e0a6a){while(--_0x3e0a6a){_0x1720d6['push'](_0x1720d6['shift']());}};_0x48b5b7(++_0x3e2308);}(_0x63fe,0xe7));var _0xe63f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x63fe[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xe63f('0x0'));var util=require(_0xe63f('0x1'));var moment=require('moment');var BPromise=require(_0xe63f('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe63f('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xe63f('0x4'));var jayson=require(_0xe63f('0x5'));var client=jayson[_0xe63f('0x6')][_0xe63f('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x53a14b,_0x16e69e,_0x297de0){return new BPromise(function(_0x278602,_0x3d2c03){return client[_0xe63f('0x8')](_0x53a14b,_0x297de0)[_0xe63f('0x9')](function(_0x27d42d){logger['info'](_0xe63f('0xa'),_0x16e69e,_0xe63f('0xb'));logger[_0xe63f('0xc')](_0xe63f('0xd'),_0x16e69e,_0xe63f('0xb'),JSON['stringify'](_0x27d42d));if(_0x27d42d[_0xe63f('0xe')]){if(_0x27d42d['error']['code']===0x1f4){logger[_0xe63f('0xe')](_0xe63f('0xa'),_0x16e69e,_0x27d42d[_0xe63f('0xe')][_0xe63f('0xf')]);return _0x3d2c03(_0x27d42d['error'][_0xe63f('0xf')]);}logger[_0xe63f('0xe')](_0xe63f('0xa'),_0x16e69e,_0x27d42d['error']['message']);return _0x278602(_0x27d42d[_0xe63f('0xe')][_0xe63f('0xf')]);}else{logger[_0xe63f('0x10')](_0xe63f('0xa'),_0x16e69e,_0xe63f('0xb'));_0x278602(_0x27d42d[_0xe63f('0x11')]['message']);}})[_0xe63f('0x12')](function(_0x43addf){logger[_0xe63f('0xe')](_0xe63f('0xa'),_0x16e69e,_0x43addf);_0x3d2c03(_0x43addf);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/index.js b/server/api/intFreshsalesAccount/index.js index 46b9069..631e547 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 _0xbc9d=['express','../../components/interaction/service','../../config/environment','./intFreshsalesAccount.controller','get','isAuthenticated','index','show','/:id/fields','getFields','post','create','/:id/configurations','addConfiguration','put','update','delete','/:id','destroy','multer','util','path','connect-timeout'];(function(_0x3b32b4,_0x129cfd){var _0xd575ea=function(_0x91290d){while(--_0x91290d){_0x3b32b4['push'](_0x3b32b4['shift']());}};_0xd575ea(++_0x129cfd);}(_0xbc9d,0xb4));var _0xdbc9=function(_0x1d070d,_0x44b1dc){_0x1d070d=_0x1d070d-0x0;var _0x150d9f=_0xbc9d[_0x1d070d];return _0x150d9f;};'use strict';var multer=require(_0xdbc9('0x0'));var util=require(_0xdbc9('0x1'));var path=require(_0xdbc9('0x2'));var timeout=require(_0xdbc9('0x3'));var express=require(_0xdbc9('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xdbc9('0x5'));var config=require(_0xdbc9('0x6'));var controller=require(_0xdbc9('0x7'));router[_0xdbc9('0x8')]('/',auth[_0xdbc9('0x9')](),controller[_0xdbc9('0xa')]);router[_0xdbc9('0x8')]('/:id',auth[_0xdbc9('0x9')](),controller[_0xdbc9('0xb')]);router[_0xdbc9('0x8')]('/:id/configurations',auth[_0xdbc9('0x9')](),controller['getConfigurations']);router['get'](_0xdbc9('0xc'),auth[_0xdbc9('0x9')](),controller[_0xdbc9('0xd')]);router[_0xdbc9('0xe')]('/',auth['isAuthenticated'](),controller[_0xdbc9('0xf')]);router[_0xdbc9('0xe')](_0xdbc9('0x10'),auth[_0xdbc9('0x9')](),controller[_0xdbc9('0x11')]);router[_0xdbc9('0x12')]('/:id',auth['isAuthenticated'](),controller[_0xdbc9('0x13')]);router[_0xdbc9('0x14')](_0xdbc9('0x15'),auth[_0xdbc9('0x9')](),controller[_0xdbc9('0x16')]);module['exports']=router; \ No newline at end of file +var _0xe605=['destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesAccount.controller','get','isAuthenticated','index','getConfigurations','/:id/fields','getFields','post','/:id/configurations','put','/:id','update','delete'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xe605,0x92));var _0x5e60=function(_0x56656e,_0x136e85){_0x56656e=_0x56656e-0x0;var _0x1b078b=_0xe605[_0x56656e];return _0x1b078b;};'use strict';var multer=require(_0x5e60('0x0'));var util=require(_0x5e60('0x1'));var path=require('path');var timeout=require(_0x5e60('0x2'));var express=require(_0x5e60('0x3'));var router=express[_0x5e60('0x4')]();var fs_extra=require(_0x5e60('0x5'));var auth=require(_0x5e60('0x6'));var interaction=require(_0x5e60('0x7'));var config=require(_0x5e60('0x8'));var controller=require(_0x5e60('0x9'));router[_0x5e60('0xa')]('/',auth[_0x5e60('0xb')](),controller[_0x5e60('0xc')]);router[_0x5e60('0xa')]('/:id',auth[_0x5e60('0xb')](),controller['show']);router['get']('/:id/configurations',auth[_0x5e60('0xb')](),controller[_0x5e60('0xd')]);router[_0x5e60('0xa')](_0x5e60('0xe'),auth[_0x5e60('0xb')](),controller[_0x5e60('0xf')]);router['post']('/',auth[_0x5e60('0xb')](),controller['create']);router[_0x5e60('0x10')](_0x5e60('0x11'),auth[_0x5e60('0xb')](),controller['addConfiguration']);router[_0x5e60('0x12')](_0x5e60('0x13'),auth[_0x5e60('0xb')](),controller[_0x5e60('0x14')]);router[_0x5e60('0x15')](_0x5e60('0x13'),auth['isAuthenticated'](),controller[_0x5e60('0x16')]);module[_0x5e60('0x17')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js index 251921a..a79cfe9 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 _0x6d38=['exports','STRING','remoteUri'];(function(_0x406696,_0x39f9b1){var _0x10e35c=function(_0x108de3){while(--_0x108de3){_0x406696['push'](_0x406696['shift']());}};_0x10e35c(++_0x39f9b1);}(_0x6d38,0x1ef));var _0x86d3=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x6d38[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require('sequelize');module[_0x86d3('0x0')]={'name':{'type':Sequelize[_0x86d3('0x1')]},'description':{'type':Sequelize[_0x86d3('0x1')]},'username':{'type':Sequelize['STRING'],'unique':'username'},'apiKey':{'type':Sequelize[_0x86d3('0x1')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0x86d3('0x2')},'serverUrl':{'type':Sequelize[_0x86d3('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0xd7d1=['sequelize','exports','STRING','username','remoteUri'];(function(_0x467899,_0x38addb){var _0x559f32=function(_0x95ad83){while(--_0x95ad83){_0x467899['push'](_0x467899['shift']());}};_0x559f32(++_0x38addb);}(_0xd7d1,0x1b3));var _0x1d7d=function(_0x478fdb,_0xa9f9ad){_0x478fdb=_0x478fdb-0x0;var _0x5858a9=_0xd7d1[_0x478fdb];return _0x5858a9;};'use strict';var Sequelize=require(_0x1d7d('0x0'));module[_0x1d7d('0x1')]={'name':{'type':Sequelize[_0x1d7d('0x2')]},'description':{'type':Sequelize[_0x1d7d('0x2')]},'username':{'type':Sequelize[_0x1d7d('0x2')],'unique':_0x1d7d('0x3')},'apiKey':{'type':Sequelize[_0x1d7d('0x2')]},'remoteUri':{'type':Sequelize[_0x1d7d('0x2')],'unique':_0x1d7d('0x4')},'serverUrl':{'type':Sequelize[_0x1d7d('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js index 7e958aa..08709f1 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 _0x69ef=['length','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','find','create','body','catch','params','getConfigurations','findOne','FreshsalesConfiguration','addConfiguration','AccountId','Subjects','channel','Descriptions','FreshsalesField','getFields','username','remoteUri','apiKey','slice','lastIndexOf','format','%s%s','/api/selector/owners','Token\x20token=','users','email','Requested\x20Resource\x20not\x20Found','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','rimraf','zip-dir','request-promise','moment','mustache','util','sox','to-csv','ejs','squel','jsforce','desk.js','querystring','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','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','FreshsalesAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields'];(function(_0x3d3fd7,_0x20a0c1){var _0x22b873=function(_0xf85fda){while(--_0xf85fda){_0x3d3fd7['push'](_0x3d3fd7['shift']());}};_0x22b873(++_0x20a0c1);}(_0x69ef,0xf4));var _0xf69e=function(_0x34d03a,_0x5828f9){_0x34d03a=_0x34d03a-0x0;var _0x53e53c=_0x69ef[_0x34d03a];return _0x53e53c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf69e('0x0'));var zipdir=require(_0xf69e('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf69e('0x2'));var moment=require(_0xf69e('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xf69e('0x4'));var util=require(_0xf69e('0x5'));var path=require('path');var sox=require(_0xf69e('0x6'));var csv=require(_0xf69e('0x7'));var ejs=require(_0xf69e('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xf69e('0x9'));var crypto=require('crypto');var jsforce=require(_0xf69e('0xa'));var deskjs=require(_0xf69e('0xb'));var toCsv=require('to-csv');var querystring=require(_0xf69e('0xc'));var Papa=require('papaparse');var Redis=require(_0xf69e('0xd'));var authService=require(_0xf69e('0xe'));var qs=require(_0xf69e('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf69e('0x10'));var logger=require('../../config/logger')(_0xf69e('0x11'));var utils=require('../../config/utils');var config=require(_0xf69e('0x12'));var licenseUtil=require(_0xf69e('0x13'));var db=require(_0xf69e('0x14'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x1fc5ce,_0x1e99c6){_0x1e99c6=_0x1e99c6||0xcc;return function(_0xd75af9){if(_0xd75af9){return _0x1fc5ce[_0xf69e('0x15')](_0x1e99c6);}return _0x1fc5ce['status'](_0x1e99c6)[_0xf69e('0x16')]();};}function respondWithResult(_0x1a16ab,_0x4fd4c4){_0x4fd4c4=_0x4fd4c4||0xc8;return function(_0x5e7f5f){if(_0x5e7f5f){return _0x1a16ab[_0xf69e('0x17')](_0x4fd4c4)[_0xf69e('0x18')](_0x5e7f5f);}};}function respondWithFilteredResult(_0x183ca6,_0x3e4106){return function(_0xe843e1){if(_0xe843e1){var _0x1539af=typeof _0x3e4106[_0xf69e('0x19')]==='undefined'&&typeof _0x3e4106[_0xf69e('0x1a')]===_0xf69e('0x1b');var _0x3ada91=_0xe843e1[_0xf69e('0x1c')];var _0x1ebdb0=_0x1539af?0x0:_0x3e4106[_0xf69e('0x19')];var _0x14d635=_0x1539af?_0xe843e1[_0xf69e('0x1c')]:_0x3e4106[_0xf69e('0x19')]+_0x3e4106[_0xf69e('0x1a')];var _0x22f0c1;if(_0x14d635>=_0x3ada91){_0x14d635=_0x3ada91;_0x22f0c1=0xc8;}else{_0x22f0c1=0xce;}_0x183ca6[_0xf69e('0x17')](_0x22f0c1);return _0x183ca6['set']('Content-Range',_0x1ebdb0+'-'+_0x14d635+'/'+_0x3ada91)[_0xf69e('0x18')](_0xe843e1);}return null;};}function patchUpdates(_0x49794a){return function(_0x397538){try{jsonpatch[_0xf69e('0x1d')](_0x397538,_0x49794a,!![]);}catch(_0x2d24b1){return BPromise[_0xf69e('0x1e')](_0x2d24b1);}return _0x397538[_0xf69e('0x1f')]();};}function saveUpdates(_0x5f3813,_0xc17518){return function(_0x2f18ed){if(_0x2f18ed){return _0x2f18ed[_0xf69e('0x20')](_0x5f3813)[_0xf69e('0x21')](function(_0x5c0c0d){return _0x5c0c0d;});}return null;};}function removeEntity(_0x24b3c4,_0x3f8722){return function(_0x4cfb3e){if(_0x4cfb3e){return _0x4cfb3e[_0xf69e('0x22')]()[_0xf69e('0x21')](function(){_0x24b3c4[_0xf69e('0x17')](0xcc)[_0xf69e('0x16')]();});}};}function handleEntityNotFound(_0x4ec1c0,_0xd220e6){return function(_0x426d5e){if(!_0x426d5e){_0x4ec1c0[_0xf69e('0x15')](0x194);}return _0x426d5e;};}function handleError(_0x1307c1,_0x2896fd){_0x2896fd=_0x2896fd||0x1f4;return function(_0x286048){logger[_0xf69e('0x23')](_0x286048[_0xf69e('0x24')]);if(_0x286048['name']){delete _0x286048[_0xf69e('0x25')];}_0x1307c1[_0xf69e('0x17')](_0x2896fd)[_0xf69e('0x26')](_0x286048);};}exports[_0xf69e('0x27')]=function(_0xfba6a3,_0x5008c5){var _0xc06c11={},_0x32f4d5={},_0x281e48={'count':0x0,'rows':[]};var _0x170707=_[_0xf69e('0x28')](db[_0xf69e('0x29')][_0xf69e('0x2a')],function(_0x22eff6){return{'name':_0x22eff6[_0xf69e('0x2b')],'type':_0x22eff6[_0xf69e('0x2c')][_0xf69e('0x2d')]};});_0x32f4d5[_0xf69e('0x2e')]=_[_0xf69e('0x28')](_0x170707,'name');_0x32f4d5[_0xf69e('0x2f')]=_[_0xf69e('0x30')](_0xfba6a3[_0xf69e('0x2f')]);_0x32f4d5[_0xf69e('0x31')]=_[_0xf69e('0x32')](_0x32f4d5['model'],_0x32f4d5['query']);_0xc06c11[_0xf69e('0x33')]=_['intersection'](_0x32f4d5[_0xf69e('0x2e')],qs['fields'](_0xfba6a3[_0xf69e('0x2f')][_0xf69e('0x34')]));_0xc06c11[_0xf69e('0x33')]=_0xc06c11[_0xf69e('0x33')][_0xf69e('0x35')]?_0xc06c11[_0xf69e('0x33')]:_0x32f4d5[_0xf69e('0x2e')];if(!_0xfba6a3[_0xf69e('0x2f')][_0xf69e('0x36')](_0xf69e('0x37'))){_0xc06c11[_0xf69e('0x1a')]=qs[_0xf69e('0x1a')](_0xfba6a3[_0xf69e('0x2f')][_0xf69e('0x1a')]);_0xc06c11[_0xf69e('0x19')]=qs[_0xf69e('0x19')](_0xfba6a3[_0xf69e('0x2f')][_0xf69e('0x19')]);}_0xc06c11[_0xf69e('0x38')]=qs['sort'](_0xfba6a3[_0xf69e('0x2f')][_0xf69e('0x39')]);_0xc06c11[_0xf69e('0x3a')]=qs[_0xf69e('0x31')](_['pick'](_0xfba6a3['query'],_0x32f4d5[_0xf69e('0x31')]),_0x170707);if(_0xfba6a3[_0xf69e('0x2f')][_0xf69e('0x3b')]){_0xc06c11['where']=_['merge'](_0xc06c11[_0xf69e('0x3a')],{'$or':_[_0xf69e('0x28')](_0x170707,function(_0x85ff9){if(_0x85ff9[_0xf69e('0x2c')]!==_0xf69e('0x3c')){var _0x4e7b87={};_0x4e7b87[_0x85ff9[_0xf69e('0x25')]]={'$like':'%'+_0xfba6a3['query'][_0xf69e('0x3b')]+'%'};return _0x4e7b87;}})});}_0xc06c11=_[_0xf69e('0x3d')]({},_0xc06c11,_0xfba6a3[_0xf69e('0x3e')]);var _0x3d3059={'where':_0xc06c11[_0xf69e('0x3a')]};return db[_0xf69e('0x29')][_0xf69e('0x1c')](_0x3d3059)['then'](function(_0x208c44){_0x281e48[_0xf69e('0x1c')]=_0x208c44;if(_0xfba6a3['query'][_0xf69e('0x3f')]){_0xc06c11[_0xf69e('0x40')]=[{'all':!![]}];}return db[_0xf69e('0x29')][_0xf69e('0x41')](_0xc06c11);})[_0xf69e('0x21')](function(_0x24ba5f){_0x281e48[_0xf69e('0x42')]=_0x24ba5f;return _0x281e48;})['then'](respondWithFilteredResult(_0x5008c5,_0xc06c11))['catch'](handleError(_0x5008c5,null));};exports['show']=function(_0x36691f,_0x373508){var _0x4cbd91={'raw':![],'where':{'id':_0x36691f['params']['id']}},_0x537c1c={};_0x537c1c[_0xf69e('0x2e')]=_[_0xf69e('0x30')](db[_0xf69e('0x29')][_0xf69e('0x2a')]);_0x537c1c[_0xf69e('0x2f')]=_[_0xf69e('0x30')](_0x36691f[_0xf69e('0x2f')]);_0x537c1c['filters']=_['intersection'](_0x537c1c[_0xf69e('0x2e')],_0x537c1c[_0xf69e('0x2f')]);_0x4cbd91['attributes']=_[_0xf69e('0x32')](_0x537c1c['model'],qs[_0xf69e('0x34')](_0x36691f[_0xf69e('0x2f')]['fields']));_0x4cbd91[_0xf69e('0x33')]=_0x4cbd91[_0xf69e('0x33')][_0xf69e('0x35')]?_0x4cbd91[_0xf69e('0x33')]:_0x537c1c['model'];if(_0x36691f['query'][_0xf69e('0x3f')]){_0x4cbd91[_0xf69e('0x40')]=[{'all':!![]}];}_0x4cbd91=_['merge']({},_0x4cbd91,_0x36691f[_0xf69e('0x3e')]);return db[_0xf69e('0x29')][_0xf69e('0x43')](_0x4cbd91)[_0xf69e('0x21')](handleEntityNotFound(_0x373508,null))[_0xf69e('0x21')](respondWithResult(_0x373508,null))['catch'](handleError(_0x373508,null));};exports[_0xf69e('0x44')]=function(_0x3d33dd,_0x5e18c1){return db['FreshsalesAccount']['create'](_0x3d33dd[_0xf69e('0x45')],{})['then'](respondWithResult(_0x5e18c1,0xc9))[_0xf69e('0x46')](handleError(_0x5e18c1,null));};exports[_0xf69e('0x20')]=function(_0xe9944f,_0x328a65){if(_0xe9944f['body']['id']){delete _0xe9944f[_0xf69e('0x45')]['id'];}return db[_0xf69e('0x29')]['find']({'where':{'id':_0xe9944f[_0xf69e('0x47')]['id']}})[_0xf69e('0x21')](handleEntityNotFound(_0x328a65,null))[_0xf69e('0x21')](saveUpdates(_0xe9944f[_0xf69e('0x45')],null))[_0xf69e('0x21')](respondWithResult(_0x328a65,null))[_0xf69e('0x46')](handleError(_0x328a65,null));};exports[_0xf69e('0x22')]=function(_0x150b42,_0x5d2b5d){return db[_0xf69e('0x29')][_0xf69e('0x43')]({'where':{'id':_0x150b42[_0xf69e('0x47')]['id']}})[_0xf69e('0x21')](handleEntityNotFound(_0x5d2b5d,null))[_0xf69e('0x21')](removeEntity(_0x5d2b5d,null))[_0xf69e('0x46')](handleError(_0x5d2b5d,null));};exports[_0xf69e('0x48')]=function(_0x1386f1,_0x1f11f3,_0x4bfd22){var _0x2adee3={};var _0xda9479={};var _0x27bc17;var _0x2c8c13;return db[_0xf69e('0x29')][_0xf69e('0x49')]({'where':{'id':_0x1386f1['params']['id']}})['then'](handleEntityNotFound(_0x1f11f3,null))[_0xf69e('0x21')](function(_0x44d0a0){if(_0x44d0a0){_0x27bc17=_0x44d0a0;_0xda9479[_0xf69e('0x2e')]=_[_0xf69e('0x30')](db[_0xf69e('0x4a')][_0xf69e('0x2a')]);_0xda9479[_0xf69e('0x2f')]=_[_0xf69e('0x30')](_0x1386f1[_0xf69e('0x2f')]);_0xda9479[_0xf69e('0x31')]=_['intersection'](_0xda9479['model'],_0xda9479['query']);_0x2adee3['attributes']=_[_0xf69e('0x32')](_0xda9479['model'],qs['fields'](_0x1386f1[_0xf69e('0x2f')]['fields']));_0x2adee3['attributes']=_0x2adee3['attributes'][_0xf69e('0x35')]?_0x2adee3['attributes']:_0xda9479[_0xf69e('0x2e')];_0x2adee3[_0xf69e('0x38')]=qs[_0xf69e('0x39')](_0x1386f1[_0xf69e('0x2f')][_0xf69e('0x39')]);_0x2adee3[_0xf69e('0x3a')]=qs[_0xf69e('0x31')](_['pick'](_0x1386f1[_0xf69e('0x2f')],_0xda9479['filters']));if(_0x1386f1[_0xf69e('0x2f')]['filter']){_0x2adee3[_0xf69e('0x3a')]=_[_0xf69e('0x3d')](_0x2adee3[_0xf69e('0x3a')],{'$or':_[_0xf69e('0x28')](_0x2adee3['attributes'],function(_0x7223c5){var _0x286741={};_0x286741[_0x7223c5]={'$like':'%'+_0x1386f1[_0xf69e('0x2f')][_0xf69e('0x3b')]+'%'};return _0x286741;})});}_0x2adee3=_[_0xf69e('0x3d')]({},_0x2adee3,_0x1386f1[_0xf69e('0x3e')]);return _0x27bc17[_0xf69e('0x48')](_0x2adee3);}})[_0xf69e('0x21')](function(_0x2007e4){if(_0x2007e4){_0x2c8c13=_0x2007e4[_0xf69e('0x35')];if(!_0x1386f1[_0xf69e('0x2f')][_0xf69e('0x36')](_0xf69e('0x37'))){_0x2adee3[_0xf69e('0x1a')]=qs[_0xf69e('0x1a')](_0x1386f1[_0xf69e('0x2f')][_0xf69e('0x1a')]);_0x2adee3[_0xf69e('0x19')]=qs['offset'](_0x1386f1['query'][_0xf69e('0x19')]);}return _0x27bc17[_0xf69e('0x48')](_0x2adee3);}})[_0xf69e('0x21')](function(_0x863483){if(_0x863483){return _0x863483?{'count':_0x2c8c13,'rows':_0x863483}:null;}})['then'](respondWithResult(_0x1f11f3,null))[_0xf69e('0x46')](handleError(_0x1f11f3,null));};exports[_0xf69e('0x4b')]=function(_0x189357,_0x2c155d,_0x4d1eb5){if(_0x189357[_0xf69e('0x45')]['id']){delete _0x189357[_0xf69e('0x45')]['id'];}return db[_0xf69e('0x29')][_0xf69e('0x49')]({'where':{'id':_0x189357[_0xf69e('0x47')]['id']}})[_0xf69e('0x21')](handleEntityNotFound(_0x2c155d,null))[_0xf69e('0x21')](function(_0x4422af){if(_0x4422af){_0x189357[_0xf69e('0x45')][_0xf69e('0x4c')]=_0x4422af['id'];_0x189357[_0xf69e('0x45')][_0xf69e('0x4d')]=integrations['getSubjects'](_0x189357['body'][_0xf69e('0x4e')],_0x189357[_0xf69e('0x45')]['type']);_0x189357[_0xf69e('0x45')][_0xf69e('0x4f')]=integrations['getDescriptions'](_0x189357['body'][_0xf69e('0x4e')],_0x189357['body'][_0xf69e('0x2c')]);return db[_0xf69e('0x4a')][_0xf69e('0x44')](_0x189357[_0xf69e('0x45')],{'include':[{'model':db[_0xf69e('0x50')],'as':'Subjects'},{'model':db[_0xf69e('0x50')],'as':_0xf69e('0x4f')}]});}return null;})[_0xf69e('0x21')](respondWithResult(_0x2c155d,null))[_0xf69e('0x46')](handleError(_0x2c155d,null));};exports[_0xf69e('0x51')]=function(_0x576759,_0x530b6d,_0x3af5c2){var _0x2c03bb='';var _0x2cb89c='';return db['FreshsalesAccount'][_0xf69e('0x49')]({'where':{'id':_0x576759[_0xf69e('0x47')]['id']},'attributes':['id',_0xf69e('0x52'),_0xf69e('0x53'),_0xf69e('0x54')]})[_0xf69e('0x21')](handleEntityNotFound(_0x530b6d,null))[_0xf69e('0x21')](function(_0x4b56da){if(_0x4b56da){_0x2cb89c=_0x4b56da[_0xf69e('0x52')];_0x2c03bb=_0x4b56da[_0xf69e('0x53')];var _0x32d1b6=_0x4b56da['remoteUri'][_0xf69e('0x55')](-0x1);if(_0x32d1b6==='/'){_0x2c03bb=_0x2c03bb['substring'](0x0,_0x2c03bb[_0xf69e('0x56')](_0x32d1b6));}return rp({'method':'GET','uri':util[_0xf69e('0x57')](_0xf69e('0x58'),_0x2c03bb,_0xf69e('0x59')),'headers':{'Authorization':_0xf69e('0x5a')+_0x4b56da[_0xf69e('0x54')]},'json':!![]});}})[_0xf69e('0x21')](function(_0x38aa4f){if(_0x38aa4f){var _0x57476e=_0x38aa4f[_0xf69e('0x5b')];var _0x1eb9f8=![];var _0x304c08=null;for(_0x304c08=0x0;_0x304c08<_0x57476e[_0xf69e('0x35')];_0x304c08++){if(_0x57476e[_0x304c08][_0xf69e('0x5c')]===_0x2cb89c){_0x1eb9f8=!![];}}if(_0x1eb9f8){return!![];}else{throw new Error({'statusCode':0x194,'message':_0xf69e('0x5d')});}}})[_0xf69e('0x21')](respondWithResult(_0x530b6d,null))['catch'](function(_0x20a052){var _0x5254c7=_0x576759[_0xf69e('0x2f')][_0xf69e('0x5e')]?0x1f4:_0x20a052[_0xf69e('0x5f')]||0x1f4;logger['error'](_0xf69e('0x60'),_0xf69e('0x51'),_0x5254c7,JSON[_0xf69e('0x61')](_0x20a052));delete _0x20a052[_0xf69e('0x25')];if(_0x5254c7===0x191){_0x5254c7=0x190;}_0x530b6d[_0xf69e('0x17')](_0x5254c7)[_0xf69e('0x26')](_0x576759[_0xf69e('0x2f')][_0xf69e('0x5e')]?{'message':_0xf69e('0x62'),'statusCode':_0x20a052[_0xf69e('0x5f')]}:_0x20a052);});}; \ No newline at end of file +var _0xaff3=['Token\x20token=','users','email','test','statusCode','getFields','stringify','send','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','to-csv','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','sendStatus','status','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','end','error','stack','name','index','map','rawAttributes','fieldName','type','key','model','query','intersection','fields','attributes','length','nolimit','order','pick','filters','filter','where','merge','VIRTUAL','options','includeAll','include','FreshsalesAccount','findAll','rows','catch','show','find','create','body','update','params','destroy','getConfigurations','keys','sort','hasOwnProperty','addConfiguration','findOne','AccountId','Subjects','getSubjects','Descriptions','FreshsalesConfiguration','FreshsalesField','username','remoteUri','apiKey','substring','lastIndexOf','GET','format','%s%s','/api/selector/owners'];(function(_0x3b3fb2,_0x21a7a7){var _0x2c998a=function(_0x9ad1df){while(--_0x9ad1df){_0x3b3fb2['push'](_0x3b3fb2['shift']());}};_0x2c998a(++_0x21a7a7);}(_0xaff3,0x70));var _0x3aff=function(_0x29d97e,_0x366218){_0x29d97e=_0x29d97e-0x0;var _0x4c2084=_0xaff3[_0x29d97e];return _0x4c2084;};'use strict';var emlformat=require(_0x3aff('0x0'));var rimraf=require(_0x3aff('0x1'));var zipdir=require(_0x3aff('0x2'));var jsonpatch=require(_0x3aff('0x3'));var rp=require(_0x3aff('0x4'));var moment=require(_0x3aff('0x5'));var BPromise=require(_0x3aff('0x6'));var Mustache=require(_0x3aff('0x7'));var util=require(_0x3aff('0x8'));var path=require(_0x3aff('0x9'));var sox=require(_0x3aff('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3aff('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x3aff('0xc'));var querystring=require(_0x3aff('0xd'));var Papa=require('papaparse');var Redis=require(_0x3aff('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x3aff('0xf'));var as=require(_0x3aff('0x10'));var hardwareService=require(_0x3aff('0x11'));var logger=require('../../config/logger')(_0x3aff('0x12'));var utils=require(_0x3aff('0x13'));var config=require(_0x3aff('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x3aff('0x15'))['db'];var integrations=require(_0x3aff('0x16'));function respondWithStatusCode(_0x547fa4,_0x51e642){_0x51e642=_0x51e642||0xcc;return function(_0x22fb91){if(_0x22fb91){return _0x547fa4[_0x3aff('0x17')](_0x51e642);}return _0x547fa4['status'](_0x51e642)['end']();};}function respondWithResult(_0x9ac48c,_0xbaf8a5){_0xbaf8a5=_0xbaf8a5||0xc8;return function(_0x59345a){if(_0x59345a){return _0x9ac48c[_0x3aff('0x18')](_0xbaf8a5)['json'](_0x59345a);}};}function respondWithFilteredResult(_0x6cf8da,_0x476c7b){return function(_0x567f17){if(_0x567f17){var _0x171a8f=typeof _0x476c7b[_0x3aff('0x19')]===_0x3aff('0x1a')&&typeof _0x476c7b[_0x3aff('0x1b')]===_0x3aff('0x1a');var _0x57965e=_0x567f17['count'];var _0x361410=_0x171a8f?0x0:_0x476c7b[_0x3aff('0x19')];var _0x5886fd=_0x171a8f?_0x567f17[_0x3aff('0x1c')]:_0x476c7b[_0x3aff('0x19')]+_0x476c7b[_0x3aff('0x1b')];var _0x90b4a9;if(_0x5886fd>=_0x57965e){_0x5886fd=_0x57965e;_0x90b4a9=0xc8;}else{_0x90b4a9=0xce;}_0x6cf8da[_0x3aff('0x18')](_0x90b4a9);return _0x6cf8da[_0x3aff('0x1d')](_0x3aff('0x1e'),_0x361410+'-'+_0x5886fd+'/'+_0x57965e)['json'](_0x567f17);}return null;};}function patchUpdates(_0x2547b7){return function(_0x1d5537){try{jsonpatch[_0x3aff('0x1f')](_0x1d5537,_0x2547b7,!![]);}catch(_0x4fff1e){return BPromise[_0x3aff('0x20')](_0x4fff1e);}return _0x1d5537[_0x3aff('0x21')]();};}function saveUpdates(_0xb9ede,_0x48fc56){return function(_0x2b9452){if(_0x2b9452){return _0x2b9452['update'](_0xb9ede)[_0x3aff('0x22')](function(_0x513e1f){return _0x513e1f;});}return null;};}function removeEntity(_0x212b33,_0xf30bc1){return function(_0x3c9bec){if(_0x3c9bec){return _0x3c9bec['destroy']()[_0x3aff('0x22')](function(){_0x212b33[_0x3aff('0x18')](0xcc)[_0x3aff('0x23')]();});}};}function handleEntityNotFound(_0x35f43d,_0x4bdaf9){return function(_0x2677ce){if(!_0x2677ce){_0x35f43d[_0x3aff('0x17')](0x194);}return _0x2677ce;};}function handleError(_0x32699c,_0x275964){_0x275964=_0x275964||0x1f4;return function(_0x451c7b){logger[_0x3aff('0x24')](_0x451c7b[_0x3aff('0x25')]);if(_0x451c7b[_0x3aff('0x26')]){delete _0x451c7b[_0x3aff('0x26')];}_0x32699c[_0x3aff('0x18')](_0x275964)['send'](_0x451c7b);};}exports[_0x3aff('0x27')]=function(_0x92abd9,_0x191325){var _0x1f3729={},_0x1acfc0={},_0x5aeae7={'count':0x0,'rows':[]};var _0x118a37=_[_0x3aff('0x28')](db['FreshsalesAccount'][_0x3aff('0x29')],function(_0x3694d7){return{'name':_0x3694d7[_0x3aff('0x2a')],'type':_0x3694d7[_0x3aff('0x2b')][_0x3aff('0x2c')]};});_0x1acfc0[_0x3aff('0x2d')]=_['map'](_0x118a37,'name');_0x1acfc0[_0x3aff('0x2e')]=_['keys'](_0x92abd9[_0x3aff('0x2e')]);_0x1acfc0['filters']=_[_0x3aff('0x2f')](_0x1acfc0['model'],_0x1acfc0[_0x3aff('0x2e')]);_0x1f3729['attributes']=_[_0x3aff('0x2f')](_0x1acfc0[_0x3aff('0x2d')],qs[_0x3aff('0x30')](_0x92abd9[_0x3aff('0x2e')][_0x3aff('0x30')]));_0x1f3729[_0x3aff('0x31')]=_0x1f3729[_0x3aff('0x31')][_0x3aff('0x32')]?_0x1f3729[_0x3aff('0x31')]:_0x1acfc0['model'];if(!_0x92abd9[_0x3aff('0x2e')]['hasOwnProperty'](_0x3aff('0x33'))){_0x1f3729[_0x3aff('0x1b')]=qs[_0x3aff('0x1b')](_0x92abd9['query']['limit']);_0x1f3729[_0x3aff('0x19')]=qs[_0x3aff('0x19')](_0x92abd9[_0x3aff('0x2e')]['offset']);}_0x1f3729[_0x3aff('0x34')]=qs['sort'](_0x92abd9['query']['sort']);_0x1f3729['where']=qs['filters'](_[_0x3aff('0x35')](_0x92abd9['query'],_0x1acfc0[_0x3aff('0x36')]),_0x118a37);if(_0x92abd9[_0x3aff('0x2e')][_0x3aff('0x37')]){_0x1f3729[_0x3aff('0x38')]=_[_0x3aff('0x39')](_0x1f3729[_0x3aff('0x38')],{'$or':_[_0x3aff('0x28')](_0x118a37,function(_0x1e6476){if(_0x1e6476['type']!==_0x3aff('0x3a')){var _0x110de2={};_0x110de2[_0x1e6476['name']]={'$like':'%'+_0x92abd9[_0x3aff('0x2e')][_0x3aff('0x37')]+'%'};return _0x110de2;}})});}_0x1f3729=_[_0x3aff('0x39')]({},_0x1f3729,_0x92abd9[_0x3aff('0x3b')]);var _0x436f8f={'where':_0x1f3729[_0x3aff('0x38')]};return db['FreshsalesAccount'][_0x3aff('0x1c')](_0x436f8f)[_0x3aff('0x22')](function(_0xd78ce7){_0x5aeae7[_0x3aff('0x1c')]=_0xd78ce7;if(_0x92abd9[_0x3aff('0x2e')][_0x3aff('0x3c')]){_0x1f3729[_0x3aff('0x3d')]=[{'all':!![]}];}return db[_0x3aff('0x3e')][_0x3aff('0x3f')](_0x1f3729);})[_0x3aff('0x22')](function(_0x2987a0){_0x5aeae7[_0x3aff('0x40')]=_0x2987a0;return _0x5aeae7;})[_0x3aff('0x22')](respondWithFilteredResult(_0x191325,_0x1f3729))[_0x3aff('0x41')](handleError(_0x191325,null));};exports[_0x3aff('0x42')]=function(_0x398c72,_0x5de3da){var _0x2a7952={'raw':![],'where':{'id':_0x398c72['params']['id']}},_0x2644a1={};_0x2644a1[_0x3aff('0x2d')]=_['keys'](db[_0x3aff('0x3e')][_0x3aff('0x29')]);_0x2644a1[_0x3aff('0x2e')]=_['keys'](_0x398c72[_0x3aff('0x2e')]);_0x2644a1[_0x3aff('0x36')]=_[_0x3aff('0x2f')](_0x2644a1[_0x3aff('0x2d')],_0x2644a1[_0x3aff('0x2e')]);_0x2a7952[_0x3aff('0x31')]=_['intersection'](_0x2644a1[_0x3aff('0x2d')],qs['fields'](_0x398c72['query'][_0x3aff('0x30')]));_0x2a7952[_0x3aff('0x31')]=_0x2a7952[_0x3aff('0x31')][_0x3aff('0x32')]?_0x2a7952[_0x3aff('0x31')]:_0x2644a1[_0x3aff('0x2d')];if(_0x398c72[_0x3aff('0x2e')]['includeAll']){_0x2a7952[_0x3aff('0x3d')]=[{'all':!![]}];}_0x2a7952=_['merge']({},_0x2a7952,_0x398c72[_0x3aff('0x3b')]);return db[_0x3aff('0x3e')][_0x3aff('0x43')](_0x2a7952)[_0x3aff('0x22')](handleEntityNotFound(_0x5de3da,null))[_0x3aff('0x22')](respondWithResult(_0x5de3da,null))[_0x3aff('0x41')](handleError(_0x5de3da,null));};exports[_0x3aff('0x44')]=function(_0x4bdb47,_0x132a2c){return db[_0x3aff('0x3e')]['create'](_0x4bdb47[_0x3aff('0x45')],{})[_0x3aff('0x22')](respondWithResult(_0x132a2c,0xc9))[_0x3aff('0x41')](handleError(_0x132a2c,null));};exports[_0x3aff('0x46')]=function(_0x295c18,_0x4f8fd7){if(_0x295c18[_0x3aff('0x45')]['id']){delete _0x295c18[_0x3aff('0x45')]['id'];}return db[_0x3aff('0x3e')]['find']({'where':{'id':_0x295c18[_0x3aff('0x47')]['id']}})[_0x3aff('0x22')](handleEntityNotFound(_0x4f8fd7,null))['then'](saveUpdates(_0x295c18[_0x3aff('0x45')],null))[_0x3aff('0x22')](respondWithResult(_0x4f8fd7,null))[_0x3aff('0x41')](handleError(_0x4f8fd7,null));};exports[_0x3aff('0x48')]=function(_0x4aeb15,_0x1ea376){return db['FreshsalesAccount'][_0x3aff('0x43')]({'where':{'id':_0x4aeb15[_0x3aff('0x47')]['id']}})[_0x3aff('0x22')](handleEntityNotFound(_0x1ea376,null))[_0x3aff('0x22')](removeEntity(_0x1ea376,null))[_0x3aff('0x41')](handleError(_0x1ea376,null));};exports[_0x3aff('0x49')]=function(_0x4718f0,_0x2f9535,_0xa8c30e){var _0x377b3b={};var _0x15f9ec={};var _0x5133f2;var _0x3fadb7;return db[_0x3aff('0x3e')]['findOne']({'where':{'id':_0x4718f0[_0x3aff('0x47')]['id']}})[_0x3aff('0x22')](handleEntityNotFound(_0x2f9535,null))[_0x3aff('0x22')](function(_0x37bc9e){if(_0x37bc9e){_0x5133f2=_0x37bc9e;_0x15f9ec[_0x3aff('0x2d')]=_[_0x3aff('0x4a')](db['FreshsalesConfiguration'][_0x3aff('0x29')]);_0x15f9ec['query']=_[_0x3aff('0x4a')](_0x4718f0[_0x3aff('0x2e')]);_0x15f9ec[_0x3aff('0x36')]=_[_0x3aff('0x2f')](_0x15f9ec[_0x3aff('0x2d')],_0x15f9ec[_0x3aff('0x2e')]);_0x377b3b['attributes']=_[_0x3aff('0x2f')](_0x15f9ec[_0x3aff('0x2d')],qs['fields'](_0x4718f0[_0x3aff('0x2e')][_0x3aff('0x30')]));_0x377b3b[_0x3aff('0x31')]=_0x377b3b[_0x3aff('0x31')][_0x3aff('0x32')]?_0x377b3b[_0x3aff('0x31')]:_0x15f9ec['model'];_0x377b3b[_0x3aff('0x34')]=qs[_0x3aff('0x4b')](_0x4718f0['query'][_0x3aff('0x4b')]);_0x377b3b[_0x3aff('0x38')]=qs[_0x3aff('0x36')](_[_0x3aff('0x35')](_0x4718f0[_0x3aff('0x2e')],_0x15f9ec[_0x3aff('0x36')]));if(_0x4718f0[_0x3aff('0x2e')]['filter']){_0x377b3b[_0x3aff('0x38')]=_['merge'](_0x377b3b['where'],{'$or':_[_0x3aff('0x28')](_0x377b3b[_0x3aff('0x31')],function(_0x155b36){var _0x2bf266={};_0x2bf266[_0x155b36]={'$like':'%'+_0x4718f0[_0x3aff('0x2e')][_0x3aff('0x37')]+'%'};return _0x2bf266;})});}_0x377b3b=_[_0x3aff('0x39')]({},_0x377b3b,_0x4718f0[_0x3aff('0x3b')]);return _0x5133f2[_0x3aff('0x49')](_0x377b3b);}})[_0x3aff('0x22')](function(_0x7d257b){if(_0x7d257b){_0x3fadb7=_0x7d257b[_0x3aff('0x32')];if(!_0x4718f0['query'][_0x3aff('0x4c')](_0x3aff('0x33'))){_0x377b3b['limit']=qs[_0x3aff('0x1b')](_0x4718f0['query'][_0x3aff('0x1b')]);_0x377b3b['offset']=qs[_0x3aff('0x19')](_0x4718f0[_0x3aff('0x2e')][_0x3aff('0x19')]);}return _0x5133f2[_0x3aff('0x49')](_0x377b3b);}})['then'](function(_0xe9d898){if(_0xe9d898){return _0xe9d898?{'count':_0x3fadb7,'rows':_0xe9d898}:null;}})[_0x3aff('0x22')](respondWithResult(_0x2f9535,null))[_0x3aff('0x41')](handleError(_0x2f9535,null));};exports[_0x3aff('0x4d')]=function(_0x23f28b,_0x224564,_0x3159dd){if(_0x23f28b[_0x3aff('0x45')]['id']){delete _0x23f28b[_0x3aff('0x45')]['id'];}return db[_0x3aff('0x3e')][_0x3aff('0x4e')]({'where':{'id':_0x23f28b[_0x3aff('0x47')]['id']}})[_0x3aff('0x22')](handleEntityNotFound(_0x224564,null))[_0x3aff('0x22')](function(_0x44f9e3){if(_0x44f9e3){_0x23f28b[_0x3aff('0x45')][_0x3aff('0x4f')]=_0x44f9e3['id'];_0x23f28b['body'][_0x3aff('0x50')]=integrations[_0x3aff('0x51')](_0x23f28b[_0x3aff('0x45')]['channel'],_0x23f28b[_0x3aff('0x45')]['type']);_0x23f28b['body'][_0x3aff('0x52')]=integrations['getDescriptions'](_0x23f28b[_0x3aff('0x45')]['channel'],_0x23f28b['body'][_0x3aff('0x2b')]);return db[_0x3aff('0x53')][_0x3aff('0x44')](_0x23f28b[_0x3aff('0x45')],{'include':[{'model':db[_0x3aff('0x54')],'as':_0x3aff('0x50')},{'model':db[_0x3aff('0x54')],'as':'Descriptions'}]});}return null;})[_0x3aff('0x22')](respondWithResult(_0x224564,null))[_0x3aff('0x41')](handleError(_0x224564,null));};exports['getFields']=function(_0x20e1f4,_0x562d91,_0x54fff8){var _0x3c7f16='';var _0x303c1a='';return db[_0x3aff('0x3e')][_0x3aff('0x4e')]({'where':{'id':_0x20e1f4[_0x3aff('0x47')]['id']},'attributes':['id',_0x3aff('0x55'),_0x3aff('0x56'),_0x3aff('0x57')]})[_0x3aff('0x22')](handleEntityNotFound(_0x562d91,null))[_0x3aff('0x22')](function(_0x536093){if(_0x536093){_0x303c1a=_0x536093[_0x3aff('0x55')];_0x3c7f16=_0x536093[_0x3aff('0x56')];var _0x85981f=_0x536093[_0x3aff('0x56')]['slice'](-0x1);if(_0x85981f==='/'){_0x3c7f16=_0x3c7f16[_0x3aff('0x58')](0x0,_0x3c7f16[_0x3aff('0x59')](_0x85981f));}return rp({'method':_0x3aff('0x5a'),'uri':util[_0x3aff('0x5b')](_0x3aff('0x5c'),_0x3c7f16,_0x3aff('0x5d')),'headers':{'Authorization':_0x3aff('0x5e')+_0x536093[_0x3aff('0x57')]},'json':!![]});}})[_0x3aff('0x22')](function(_0x4c1adf){if(_0x4c1adf){var _0xcada14=_0x4c1adf[_0x3aff('0x5f')];var _0xa1469c=![];var _0x33416c=null;for(_0x33416c=0x0;_0x33416c<_0xcada14[_0x3aff('0x32')];_0x33416c++){if(_0xcada14[_0x33416c][_0x3aff('0x60')]===_0x303c1a){_0xa1469c=!![];}}if(_0xa1469c){return!![];}else{throw new Error({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}})[_0x3aff('0x22')](respondWithResult(_0x562d91,null))[_0x3aff('0x41')](function(_0x5981b9){var _0x2c33bd=_0x20e1f4['query'][_0x3aff('0x61')]?0x1f4:_0x5981b9[_0x3aff('0x62')]||0x1f4;logger[_0x3aff('0x24')]('getFields,\x20%s,\x20%s,\x20%s',_0x3aff('0x63'),_0x2c33bd,JSON[_0x3aff('0x64')](_0x5981b9));delete _0x5981b9[_0x3aff('0x26')];if(_0x2c33bd===0x191){_0x2c33bd=0x190;}_0x562d91['status'](_0x2c33bd)[_0x3aff('0x65')](_0x20e1f4[_0x3aff('0x2e')][_0x3aff('0x61')]?{'message':_0x3aff('0x66'),'statusCode':_0x5981b9[_0x3aff('0x62')]}:_0x5981b9);});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js index 3519ac8..765d354 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 _0xb44a=['../../config/logger','moment','path','../../config/environment','./intFreshsalesAccount.attributes','../../components/integrations/configuration','exports','define','FreshsalesAccount','int_freshsales_accounts'];(function(_0x4e09a5,_0x4e721a){var _0x5bf9ad=function(_0x35e4fd){while(--_0x35e4fd){_0x4e09a5['push'](_0x4e09a5['shift']());}};_0x5bf9ad(++_0x4e721a);}(_0xb44a,0x1c2));var _0xab44=function(_0x4cf0b7,_0x560029){_0x4cf0b7=_0x4cf0b7-0x0;var _0x545f10=_0xb44a[_0x4cf0b7];return _0x545f10;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xab44('0x0'))('api');var moment=require(_0xab44('0x1'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xab44('0x2'));var rimraf=require('rimraf');var config=require(_0xab44('0x3'));var attributes=require(_0xab44('0x4'));var integrations=require(_0xab44('0x5'));module[_0xab44('0x6')]=function(_0x2f3948,_0x3303b1){return _0x2f3948[_0xab44('0x7')](_0xab44('0x8'),attributes,{'tableName':_0xab44('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x71ab=['path','rimraf','../../config/environment','./intFreshsalesAccount.attributes','../../components/integrations/configuration','exports','define','FreshsalesAccount','int_freshsales_accounts','util','api','bluebird','request-promise'];(function(_0x192431,_0x267a5c){var _0x41141b=function(_0x2fe304){while(--_0x2fe304){_0x192431['push'](_0x192431['shift']());}};_0x41141b(++_0x267a5c);}(_0x71ab,0x64));var _0xb71a=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x71ab[_0x2f5ac5];return _0x37c9a8;};'use strict';var _=require('lodash');var util=require(_0xb71a('0x0'));var logger=require('../../config/logger')(_0xb71a('0x1'));var moment=require('moment');var BPromise=require(_0xb71a('0x2'));var rp=require(_0xb71a('0x3'));var fs=require('fs');var path=require(_0xb71a('0x4'));var rimraf=require(_0xb71a('0x5'));var config=require(_0xb71a('0x6'));var attributes=require(_0xb71a('0x7'));var integrations=require(_0xb71a('0x8'));module[_0xb71a('0x9')]=function(_0x22c072,_0x35a84e){return _0x22c072[_0xb71a('0xa')](_0xb71a('0xb'),attributes,{'tableName':_0xb71a('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.rpc.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.rpc.js index 3782d56..8fc54af 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 _0x90b1=['ShowFreshsalesAccount','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','http','request','info','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetFreshsalesAccount','FreshsalesAccount','findAll','options','raw','where','attributes','limit','map','include','model','then','find'];(function(_0x1272cc,_0x49901c){var _0x3a0f4f=function(_0x19bf60){while(--_0x19bf60){_0x1272cc['push'](_0x1272cc['shift']());}};_0x3a0f4f(++_0x49901c);}(_0x90b1,0x1bb));var _0x190b=function(_0x5df445,_0x3d96e2){_0x5df445=_0x5df445-0x0;var _0x4f76b5=_0x90b1[_0x5df445];return _0x4f76b5;};'use strict';var _=require(_0x190b('0x0'));var util=require(_0x190b('0x1'));var moment=require(_0x190b('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x190b('0x3'));var db=require(_0x190b('0x4'))['db'];var utils=require(_0x190b('0x5'));var logger=require(_0x190b('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x190b('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x34a689,_0x3b57f7,_0x626aa1){return new BPromise(function(_0x311161,_0x802924){return client[_0x190b('0x8')](_0x34a689,_0x626aa1)['then'](function(_0x14b93d){logger[_0x190b('0x9')](_0x190b('0xa'),_0x3b57f7,_0x190b('0xb'));logger[_0x190b('0xc')](_0x190b('0xd'),_0x3b57f7,_0x190b('0xb'),JSON[_0x190b('0xe')](_0x14b93d));if(_0x14b93d['error']){if(_0x14b93d[_0x190b('0xf')][_0x190b('0x10')]===0x1f4){logger['error'](_0x190b('0xa'),_0x3b57f7,_0x14b93d[_0x190b('0xf')][_0x190b('0x11')]);return _0x802924(_0x14b93d[_0x190b('0xf')][_0x190b('0x11')]);}logger[_0x190b('0xf')](_0x190b('0xa'),_0x3b57f7,_0x14b93d[_0x190b('0xf')][_0x190b('0x11')]);return _0x311161(_0x14b93d[_0x190b('0xf')][_0x190b('0x11')]);}else{logger[_0x190b('0x9')](_0x190b('0xa'),_0x3b57f7,_0x190b('0xb'));_0x311161(_0x14b93d[_0x190b('0x12')][_0x190b('0x11')]);}})[_0x190b('0x13')](function(_0x5c63d9){logger[_0x190b('0xf')]('FreshsalesAccount,\x20%s,\x20%s',_0x3b57f7,_0x5c63d9);_0x802924(_0x5c63d9);});});}exports[_0x190b('0x14')]=function(_0x21e458){var _0x56d07a=this;return new Promise(function(_0x16c009,_0x50a3c4){return db[_0x190b('0x15')][_0x190b('0x16')]({'raw':_0x21e458[_0x190b('0x17')]?_0x21e458[_0x190b('0x17')][_0x190b('0x18')]===undefined?!![]:![]:!![],'where':_0x21e458[_0x190b('0x17')]?_0x21e458['options'][_0x190b('0x19')]||null:null,'attributes':_0x21e458[_0x190b('0x17')]?_0x21e458['options'][_0x190b('0x1a')]||null:null,'limit':_0x21e458['options']?_0x21e458['options'][_0x190b('0x1b')]||null:null,'include':_0x21e458[_0x190b('0x17')]?_0x21e458[_0x190b('0x17')]['include']?_[_0x190b('0x1c')](_0x21e458[_0x190b('0x17')][_0x190b('0x1d')],function(_0x292ce3){return{'model':db[_0x292ce3[_0x190b('0x1e')]],'as':_0x292ce3['as'],'attributes':_0x292ce3[_0x190b('0x1a')],'include':_0x292ce3[_0x190b('0x1d')]?_['map'](_0x292ce3['include'],function(_0x262a63){return{'model':db[_0x262a63[_0x190b('0x1e')]],'as':_0x262a63['as'],'attributes':_0x262a63['attributes'],'include':_0x262a63['include']?_[_0x190b('0x1c')](_0x262a63['include'],function(_0x328e5e){return{'model':db[_0x328e5e[_0x190b('0x1e')]],'as':_0x328e5e['as'],'attributes':_0x328e5e['attributes']};}):[]};}):[]};}):[]:[]})[_0x190b('0x1f')](function(_0x1deea6){logger['info'](_0x190b('0x14'),_0x21e458);logger[_0x190b('0xc')](_0x190b('0x14'),_0x21e458,JSON['stringify'](_0x1deea6));_0x16c009(_0x1deea6);})['catch'](function(_0x3730cc){logger['error'](_0x190b('0x14'),_0x3730cc[_0x190b('0x11')],_0x21e458);_0x50a3c4(_0x56d07a['error'](0x1f4,_0x3730cc[_0x190b('0x11')]));});});};exports['ShowFreshsalesAccount']=function(_0x40d060){var _0x4ff5a6=this;return new Promise(function(_0x19600d,_0x5650e1){return db[_0x190b('0x15')][_0x190b('0x20')]({'raw':_0x40d060['options']?_0x40d060[_0x190b('0x17')][_0x190b('0x18')]===undefined?!![]:![]:!![],'where':_0x40d060[_0x190b('0x17')]?_0x40d060[_0x190b('0x17')][_0x190b('0x19')]||null:null,'attributes':_0x40d060[_0x190b('0x17')]?_0x40d060[_0x190b('0x17')][_0x190b('0x1a')]||null:null,'include':_0x40d060['options']?_0x40d060['options'][_0x190b('0x1d')]?_[_0x190b('0x1c')](_0x40d060['options'][_0x190b('0x1d')],function(_0x2dcd39){return{'model':db[_0x2dcd39[_0x190b('0x1e')]],'as':_0x2dcd39['as'],'attributes':_0x2dcd39[_0x190b('0x1a')],'include':_0x2dcd39[_0x190b('0x1d')]?_[_0x190b('0x1c')](_0x2dcd39[_0x190b('0x1d')],function(_0x5492b0){return{'model':db[_0x5492b0['model']],'as':_0x5492b0['as'],'attributes':_0x5492b0[_0x190b('0x1a')],'include':_0x5492b0[_0x190b('0x1d')]?_[_0x190b('0x1c')](_0x5492b0['include'],function(_0x33e9db){return{'model':db[_0x33e9db[_0x190b('0x1e')]],'as':_0x33e9db['as'],'attributes':_0x33e9db[_0x190b('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2a8260){logger['info']('ShowFreshsalesAccount',_0x40d060);logger[_0x190b('0xc')](_0x190b('0x21'),_0x40d060,JSON['stringify'](_0x2a8260));_0x19600d(_0x2a8260);})[_0x190b('0x13')](function(_0xfd0d62){logger[_0x190b('0xf')]('ShowFreshsalesAccount',_0xfd0d62[_0x190b('0x11')],_0x40d060);_0x5650e1(_0x4ff5a6[_0x190b('0xf')](0x1f4,_0xfd0d62['message']));});});}; \ No newline at end of file +var _0x5f66=['debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','code','message','error','info','catch','GetFreshsalesAccount','findAll','options','attributes','limit','include','model','map','ShowFreshsalesAccount','FreshsalesAccount','raw','where','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','request','then','FreshsalesAccount,\x20%s,\x20%s','request\x20sent'];(function(_0x5b5a8b,_0xd4ada1){var _0x50f175=function(_0x4570bc){while(--_0x4570bc){_0x5b5a8b['push'](_0x5b5a8b['shift']());}};_0x50f175(++_0xd4ada1);}(_0x5f66,0x1a0));var _0x65f6=function(_0x122096,_0x60c295){_0x122096=_0x122096-0x0;var _0x3d1966=_0x5f66[_0x122096];return _0x3d1966;};'use strict';var _=require('lodash');var util=require(_0x65f6('0x0'));var moment=require('moment');var BPromise=require(_0x65f6('0x1'));var rs=require(_0x65f6('0x2'));var fs=require('fs');var Redis=require(_0x65f6('0x3'));var db=require(_0x65f6('0x4'))['db'];var utils=require(_0x65f6('0x5'));var logger=require('../../config/logger')(_0x65f6('0x6'));var config=require('../../config/environment');var jayson=require(_0x65f6('0x7'));var client=jayson[_0x65f6('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4ed98f,_0x1c0e12,_0x2c6571){return new BPromise(function(_0x112079,_0x8f6451){return client[_0x65f6('0x9')](_0x4ed98f,_0x2c6571)[_0x65f6('0xa')](function(_0x48d85c){logger['info'](_0x65f6('0xb'),_0x1c0e12,_0x65f6('0xc'));logger[_0x65f6('0xd')](_0x65f6('0xe'),_0x1c0e12,'request\x20sent',JSON[_0x65f6('0xf')](_0x48d85c));if(_0x48d85c['error']){if(_0x48d85c['error'][_0x65f6('0x10')]===0x1f4){logger['error'](_0x65f6('0xb'),_0x1c0e12,_0x48d85c['error'][_0x65f6('0x11')]);return _0x8f6451(_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);}logger[_0x65f6('0x12')](_0x65f6('0xb'),_0x1c0e12,_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);return _0x112079(_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);}else{logger[_0x65f6('0x13')]('FreshsalesAccount,\x20%s,\x20%s',_0x1c0e12,_0x65f6('0xc'));_0x112079(_0x48d85c['result']['message']);}})[_0x65f6('0x14')](function(_0x5c69f8){logger[_0x65f6('0x12')](_0x65f6('0xb'),_0x1c0e12,_0x5c69f8);_0x8f6451(_0x5c69f8);});});}exports[_0x65f6('0x15')]=function(_0x1f974c){var _0xc8660c=this;return new Promise(function(_0x18380e,_0x495dd6){return db['FreshsalesAccount'][_0x65f6('0x16')]({'raw':_0x1f974c['options']?_0x1f974c['options']['raw']===undefined?!![]:![]:!![],'where':_0x1f974c[_0x65f6('0x17')]?_0x1f974c[_0x65f6('0x17')]['where']||null:null,'attributes':_0x1f974c[_0x65f6('0x17')]?_0x1f974c[_0x65f6('0x17')][_0x65f6('0x18')]||null:null,'limit':_0x1f974c[_0x65f6('0x17')]?_0x1f974c[_0x65f6('0x17')][_0x65f6('0x19')]||null:null,'include':_0x1f974c['options']?_0x1f974c[_0x65f6('0x17')]['include']?_['map'](_0x1f974c[_0x65f6('0x17')][_0x65f6('0x1a')],function(_0x524e42){return{'model':db[_0x524e42[_0x65f6('0x1b')]],'as':_0x524e42['as'],'attributes':_0x524e42[_0x65f6('0x18')],'include':_0x524e42[_0x65f6('0x1a')]?_[_0x65f6('0x1c')](_0x524e42['include'],function(_0x9d7bb0){return{'model':db[_0x9d7bb0[_0x65f6('0x1b')]],'as':_0x9d7bb0['as'],'attributes':_0x9d7bb0[_0x65f6('0x18')],'include':_0x9d7bb0['include']?_['map'](_0x9d7bb0['include'],function(_0x29abdb){return{'model':db[_0x29abdb[_0x65f6('0x1b')]],'as':_0x29abdb['as'],'attributes':_0x29abdb['attributes']};}):[]};}):[]};}):[]:[]})[_0x65f6('0xa')](function(_0x28f710){logger['info'](_0x65f6('0x15'),_0x1f974c);logger[_0x65f6('0xd')](_0x65f6('0x15'),_0x1f974c,JSON['stringify'](_0x28f710));_0x18380e(_0x28f710);})['catch'](function(_0x488d36){logger[_0x65f6('0x12')](_0x65f6('0x15'),_0x488d36[_0x65f6('0x11')],_0x1f974c);_0x495dd6(_0xc8660c[_0x65f6('0x12')](0x1f4,_0x488d36[_0x65f6('0x11')]));});});};exports[_0x65f6('0x1d')]=function(_0x144e55){var _0x4ace4c=this;return new Promise(function(_0x4ea23d,_0x154cbd){return db[_0x65f6('0x1e')]['find']({'raw':_0x144e55['options']?_0x144e55[_0x65f6('0x17')][_0x65f6('0x1f')]===undefined?!![]:![]:!![],'where':_0x144e55[_0x65f6('0x17')]?_0x144e55[_0x65f6('0x17')][_0x65f6('0x20')]||null:null,'attributes':_0x144e55[_0x65f6('0x17')]?_0x144e55['options'][_0x65f6('0x18')]||null:null,'include':_0x144e55[_0x65f6('0x17')]?_0x144e55[_0x65f6('0x17')]['include']?_[_0x65f6('0x1c')](_0x144e55[_0x65f6('0x17')][_0x65f6('0x1a')],function(_0x45510a){return{'model':db[_0x45510a[_0x65f6('0x1b')]],'as':_0x45510a['as'],'attributes':_0x45510a[_0x65f6('0x18')],'include':_0x45510a['include']?_[_0x65f6('0x1c')](_0x45510a[_0x65f6('0x1a')],function(_0x4f3e22){return{'model':db[_0x4f3e22[_0x65f6('0x1b')]],'as':_0x4f3e22['as'],'attributes':_0x4f3e22['attributes'],'include':_0x4f3e22[_0x65f6('0x1a')]?_['map'](_0x4f3e22[_0x65f6('0x1a')],function(_0x24f7fd){return{'model':db[_0x24f7fd['model']],'as':_0x24f7fd['as'],'attributes':_0x24f7fd[_0x65f6('0x18')]};}):[]};}):[]};}):[]:[]})[_0x65f6('0xa')](function(_0x3b261d){logger['info']('ShowFreshsalesAccount',_0x144e55);logger[_0x65f6('0xd')]('ShowFreshsalesAccount',_0x144e55,JSON[_0x65f6('0xf')](_0x3b261d));_0x4ea23d(_0x3b261d);})['catch'](function(_0x22d760){logger[_0x65f6('0x12')]('ShowFreshsalesAccount',_0x22d760[_0x65f6('0x11')],_0x144e55);_0x154cbd(_0x4ace4c['error'](0x1f4,_0x22d760['message']));});});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/index.js b/server/api/intFreshsalesConfiguration/index.js index a769836..6ffc106 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 _0x743f=['/:id/descriptions','getDescriptions','/:id/fields','getFields','post','create','delete','exports','multer','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intFreshsalesConfiguration.controller','get','isAuthenticated','/:id','show','getSubjects'];(function(_0x229ede,_0x59f8c3){var _0x21ac90=function(_0x58c80e){while(--_0x58c80e){_0x229ede['push'](_0x229ede['shift']());}};_0x21ac90(++_0x59f8c3);}(_0x743f,0xb8));var _0xf743=function(_0x5442b9,_0xf39ebc){_0x5442b9=_0x5442b9-0x0;var _0x5f257d=_0x743f[_0x5442b9];return _0x5f257d;};'use strict';var multer=require(_0xf743('0x0'));var util=require(_0xf743('0x1'));var path=require(_0xf743('0x2'));var timeout=require('connect-timeout');var express=require(_0xf743('0x3'));var router=express[_0xf743('0x4')]();var fs_extra=require(_0xf743('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xf743('0x6'));var config=require(_0xf743('0x7'));var controller=require(_0xf743('0x8'));router[_0xf743('0x9')]('/',auth[_0xf743('0xa')](),controller['index']);router[_0xf743('0x9')](_0xf743('0xb'),auth['isAuthenticated'](),controller[_0xf743('0xc')]);router['get']('/:id/subjects',auth['isAuthenticated'](),controller[_0xf743('0xd')]);router[_0xf743('0x9')](_0xf743('0xe'),auth[_0xf743('0xa')](),controller[_0xf743('0xf')]);router[_0xf743('0x9')](_0xf743('0x10'),auth['isAuthenticated'](),controller[_0xf743('0x11')]);router[_0xf743('0x12')]('/',auth[_0xf743('0xa')](),controller[_0xf743('0x13')]);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router[_0xf743('0x14')](_0xf743('0xb'),auth[_0xf743('0xa')](),controller['destroy']);module[_0xf743('0x15')]=router; \ No newline at end of file +var _0x25cc=['Router','fs-extra','../../config/environment','./intFreshsalesConfiguration.controller','get','isAuthenticated','/:id','show','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/fields','getFields','post','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x2cef86,_0xbae0a6){var _0x46dfd6=function(_0x52e464){while(--_0x52e464){_0x2cef86['push'](_0x2cef86['shift']());}};_0x46dfd6(++_0xbae0a6);}(_0x25cc,0xdc));var _0xc25c=function(_0x430077,_0x286ded){_0x430077=_0x430077-0x0;var _0x240768=_0x25cc[_0x430077];return _0x240768;};'use strict';var multer=require(_0xc25c('0x0'));var util=require(_0xc25c('0x1'));var path=require(_0xc25c('0x2'));var timeout=require(_0xc25c('0x3'));var express=require(_0xc25c('0x4'));var router=express[_0xc25c('0x5')]();var fs_extra=require(_0xc25c('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xc25c('0x7'));var controller=require(_0xc25c('0x8'));router[_0xc25c('0x9')]('/',auth[_0xc25c('0xa')](),controller['index']);router[_0xc25c('0x9')](_0xc25c('0xb'),auth[_0xc25c('0xa')](),controller[_0xc25c('0xc')]);router[_0xc25c('0x9')](_0xc25c('0xd'),auth[_0xc25c('0xa')](),controller[_0xc25c('0xe')]);router[_0xc25c('0x9')](_0xc25c('0xf'),auth[_0xc25c('0xa')](),controller[_0xc25c('0x10')]);router[_0xc25c('0x9')](_0xc25c('0x11'),auth[_0xc25c('0xa')](),controller[_0xc25c('0x12')]);router[_0xc25c('0x13')]('/',auth[_0xc25c('0xa')](),controller['create']);router[_0xc25c('0x14')](_0xc25c('0xb'),auth[_0xc25c('0xa')](),controller[_0xc25c('0x15')]);router[_0xc25c('0x16')]('/:id',auth[_0xc25c('0xa')](),controller[_0xc25c('0x17')]);module[_0xc25c('0x18')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js index e77706b..c2d407b 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 _0xa54b=['sequelize','exports','STRING'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xa54b,0x192));var _0xba54=function(_0x5afa89,_0x4455c4){_0x5afa89=_0x5afa89-0x0;var _0x2c1685=_0xa54b[_0x5afa89];return _0x2c1685;};'use strict';var Sequelize=require(_0xba54('0x0'));module[_0xba54('0x1')]={'name':{'type':Sequelize[_0xba54('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x7a29=['sequelize','exports'];(function(_0x47733a,_0x1c2e18){var _0x2c985b=function(_0x510e6e){while(--_0x510e6e){_0x47733a['push'](_0x47733a['shift']());}};_0x2c985b(++_0x1c2e18);}(_0x7a29,0x190));var _0x97a2=function(_0x459acc,_0x60af18){_0x459acc=_0x459acc-0x0;var _0x3ed5db=_0x7a29[_0x459acc];return _0x3ed5db;};'use strict';var Sequelize=require(_0x97a2('0x0'));module[_0x97a2('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js index 8f297f9..d823edf 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 _0xc77c=['intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','type','VIRTUAL','filter','merge','options','FreshsalesConfiguration','includeAll','include','findAll','catch','params','rawAttributes','find','create','body','destroy','getSubjects','FreshsalesField','nolimit','getDescriptions','findOne','pick','getFields','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','error','stack','name','map','model','keys','query'];(function(_0x18f70b,_0x4beec0){var _0x4e1641=function(_0x5d8431){while(--_0x5d8431){_0x18f70b['push'](_0x18f70b['shift']());}};_0x4e1641(++_0x4beec0);}(_0xc77c,0x197));var _0xcc77=function(_0x16f1e9,_0x38ab11){_0x16f1e9=_0x16f1e9-0x0;var _0x30880c=_0xc77c[_0x16f1e9];return _0x30880c;};'use strict';var emlformat=require(_0xcc77('0x0'));var rimraf=require(_0xcc77('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xcc77('0x2'));var rp=require(_0xcc77('0x3'));var moment=require('moment');var BPromise=require(_0xcc77('0x4'));var Mustache=require(_0xcc77('0x5'));var util=require(_0xcc77('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0xcc77('0x7'));var ejs=require(_0xcc77('0x8'));var fs=require('fs');var fs_extra=require(_0xcc77('0x9'));var _=require(_0xcc77('0xa'));var squel=require(_0xcc77('0xb'));var crypto=require('crypto');var jsforce=require(_0xcc77('0xc'));var deskjs=require(_0xcc77('0xd'));var toCsv=require(_0xcc77('0x7'));var querystring=require(_0xcc77('0xe'));var Papa=require(_0xcc77('0xf'));var Redis=require(_0xcc77('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xcc77('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xcc77('0x12'));var utils=require('../../config/utils');var config=require(_0xcc77('0x13'));var licenseUtil=require(_0xcc77('0x14'));var db=require(_0xcc77('0x15'))['db'];function respondWithStatusCode(_0x57c9fd,_0x90d372){_0x90d372=_0x90d372||0xcc;return function(_0x370bba){if(_0x370bba){return _0x57c9fd[_0xcc77('0x16')](_0x90d372);}return _0x57c9fd[_0xcc77('0x17')](_0x90d372)[_0xcc77('0x18')]();};}function respondWithResult(_0x434477,_0x4a0ab2){_0x4a0ab2=_0x4a0ab2||0xc8;return function(_0x37ca85){if(_0x37ca85){return _0x434477['status'](_0x4a0ab2)[_0xcc77('0x19')](_0x37ca85);}};}function respondWithFilteredResult(_0x3f8d0b,_0x4abdec){return function(_0x32deae){if(_0x32deae){var _0x4dfdf6=typeof _0x4abdec[_0xcc77('0x1a')]===_0xcc77('0x1b')&&typeof _0x4abdec[_0xcc77('0x1c')]===_0xcc77('0x1b');var _0x52a35d=_0x32deae['count'];var _0x3d4ee7=_0x4dfdf6?0x0:_0x4abdec[_0xcc77('0x1a')];var _0x343107=_0x4dfdf6?_0x32deae[_0xcc77('0x1d')]:_0x4abdec[_0xcc77('0x1a')]+_0x4abdec['limit'];var _0x3e5a7a;if(_0x343107>=_0x52a35d){_0x343107=_0x52a35d;_0x3e5a7a=0xc8;}else{_0x3e5a7a=0xce;}_0x3f8d0b[_0xcc77('0x17')](_0x3e5a7a);return _0x3f8d0b[_0xcc77('0x1e')]('Content-Range',_0x3d4ee7+'-'+_0x343107+'/'+_0x52a35d)[_0xcc77('0x19')](_0x32deae);}return null;};}function patchUpdates(_0x48e03b){return function(_0x222966){try{jsonpatch[_0xcc77('0x1f')](_0x222966,_0x48e03b,!![]);}catch(_0x1be7c2){return BPromise[_0xcc77('0x20')](_0x1be7c2);}return _0x222966[_0xcc77('0x21')]();};}function saveUpdates(_0x1705a8,_0x2c6501){return function(_0x26bd85){if(_0x26bd85){return _0x26bd85[_0xcc77('0x22')](_0x1705a8)['then'](function(_0x5ae1c0){return _0x5ae1c0;});}return null;};}function removeEntity(_0x138766,_0x2d00aa){return function(_0x24b184){if(_0x24b184){return _0x24b184['destroy']()[_0xcc77('0x23')](function(){_0x138766[_0xcc77('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x32ee27,_0xd2c683){return function(_0x3342ab){if(!_0x3342ab){_0x32ee27[_0xcc77('0x16')](0x194);}return _0x3342ab;};}function handleError(_0x57fe22,_0x36835a){_0x36835a=_0x36835a||0x1f4;return function(_0x51db42){logger[_0xcc77('0x24')](_0x51db42[_0xcc77('0x25')]);if(_0x51db42[_0xcc77('0x26')]){delete _0x51db42[_0xcc77('0x26')];}_0x57fe22[_0xcc77('0x17')](_0x36835a)['send'](_0x51db42);};}exports['index']=function(_0x55b462,_0x28944c){var _0x4a46a0={},_0x5320d9={},_0x1da245={'count':0x0,'rows':[]};var _0x19c57f=_[_0xcc77('0x27')](db['FreshsalesConfiguration']['rawAttributes'],function(_0x27a7ad){return{'name':_0x27a7ad['fieldName'],'type':_0x27a7ad['type']['key']};});_0x5320d9[_0xcc77('0x28')]=_[_0xcc77('0x27')](_0x19c57f,_0xcc77('0x26'));_0x5320d9['query']=_[_0xcc77('0x29')](_0x55b462[_0xcc77('0x2a')]);_0x5320d9['filters']=_[_0xcc77('0x2b')](_0x5320d9[_0xcc77('0x28')],_0x5320d9[_0xcc77('0x2a')]);_0x4a46a0[_0xcc77('0x2c')]=_['intersection'](_0x5320d9[_0xcc77('0x28')],qs[_0xcc77('0x2d')](_0x55b462['query'][_0xcc77('0x2d')]));_0x4a46a0[_0xcc77('0x2c')]=_0x4a46a0['attributes'][_0xcc77('0x2e')]?_0x4a46a0[_0xcc77('0x2c')]:_0x5320d9[_0xcc77('0x28')];if(!_0x55b462[_0xcc77('0x2a')][_0xcc77('0x2f')]('nolimit')){_0x4a46a0[_0xcc77('0x1c')]=qs['limit'](_0x55b462['query'][_0xcc77('0x1c')]);_0x4a46a0['offset']=qs[_0xcc77('0x1a')](_0x55b462[_0xcc77('0x2a')][_0xcc77('0x1a')]);}_0x4a46a0[_0xcc77('0x30')]=qs[_0xcc77('0x31')](_0x55b462[_0xcc77('0x2a')][_0xcc77('0x31')]);_0x4a46a0[_0xcc77('0x32')]=qs[_0xcc77('0x33')](_['pick'](_0x55b462[_0xcc77('0x2a')],_0x5320d9[_0xcc77('0x33')]),_0x19c57f);if(_0x55b462[_0xcc77('0x2a')]['filter']){_0x4a46a0['where']=_['merge'](_0x4a46a0[_0xcc77('0x32')],{'$or':_[_0xcc77('0x27')](_0x19c57f,function(_0x5e422a){if(_0x5e422a[_0xcc77('0x34')]!==_0xcc77('0x35')){var _0x5791b0={};_0x5791b0[_0x5e422a[_0xcc77('0x26')]]={'$like':'%'+_0x55b462[_0xcc77('0x2a')][_0xcc77('0x36')]+'%'};return _0x5791b0;}})});}_0x4a46a0=_[_0xcc77('0x37')]({},_0x4a46a0,_0x55b462[_0xcc77('0x38')]);var _0x322d81={'where':_0x4a46a0['where']};return db[_0xcc77('0x39')][_0xcc77('0x1d')](_0x322d81)[_0xcc77('0x23')](function(_0x18ae88){_0x1da245[_0xcc77('0x1d')]=_0x18ae88;if(_0x55b462['query'][_0xcc77('0x3a')]){_0x4a46a0[_0xcc77('0x3b')]=[{'all':!![]}];}return db['FreshsalesConfiguration'][_0xcc77('0x3c')](_0x4a46a0);})[_0xcc77('0x23')](function(_0x602746){_0x1da245['rows']=_0x602746;return _0x1da245;})[_0xcc77('0x23')](respondWithFilteredResult(_0x28944c,_0x4a46a0))[_0xcc77('0x3d')](handleError(_0x28944c,null));};exports['show']=function(_0x5a8d8e,_0x3188c2){var _0x4ddf60={'raw':![],'where':{'id':_0x5a8d8e[_0xcc77('0x3e')]['id']}},_0x3d4072={};_0x3d4072[_0xcc77('0x28')]=_[_0xcc77('0x29')](db[_0xcc77('0x39')][_0xcc77('0x3f')]);_0x3d4072[_0xcc77('0x2a')]=_[_0xcc77('0x29')](_0x5a8d8e['query']);_0x3d4072[_0xcc77('0x33')]=_[_0xcc77('0x2b')](_0x3d4072['model'],_0x3d4072[_0xcc77('0x2a')]);_0x4ddf60[_0xcc77('0x2c')]=_[_0xcc77('0x2b')](_0x3d4072[_0xcc77('0x28')],qs[_0xcc77('0x2d')](_0x5a8d8e[_0xcc77('0x2a')][_0xcc77('0x2d')]));_0x4ddf60[_0xcc77('0x2c')]=_0x4ddf60[_0xcc77('0x2c')][_0xcc77('0x2e')]?_0x4ddf60[_0xcc77('0x2c')]:_0x3d4072[_0xcc77('0x28')];if(_0x5a8d8e[_0xcc77('0x2a')][_0xcc77('0x3a')]){_0x4ddf60[_0xcc77('0x3b')]=[{'all':!![]}];}_0x4ddf60=_[_0xcc77('0x37')]({},_0x4ddf60,_0x5a8d8e[_0xcc77('0x38')]);return db['FreshsalesConfiguration'][_0xcc77('0x40')](_0x4ddf60)[_0xcc77('0x23')](handleEntityNotFound(_0x3188c2,null))[_0xcc77('0x23')](respondWithResult(_0x3188c2,null))[_0xcc77('0x3d')](handleError(_0x3188c2,null));};exports[_0xcc77('0x41')]=function(_0x3de98e,_0x16943f){return db[_0xcc77('0x39')][_0xcc77('0x41')](_0x3de98e[_0xcc77('0x42')],{})[_0xcc77('0x23')](respondWithResult(_0x16943f,0xc9))[_0xcc77('0x3d')](handleError(_0x16943f,null));};exports[_0xcc77('0x22')]=function(_0xc76d66,_0x8e068){if(_0xc76d66[_0xcc77('0x42')]['id']){delete _0xc76d66[_0xcc77('0x42')]['id'];}return db[_0xcc77('0x39')][_0xcc77('0x40')]({'where':{'id':_0xc76d66[_0xcc77('0x3e')]['id']}})['then'](handleEntityNotFound(_0x8e068,null))[_0xcc77('0x23')](saveUpdates(_0xc76d66['body'],null))[_0xcc77('0x23')](respondWithResult(_0x8e068,null))['catch'](handleError(_0x8e068,null));};exports[_0xcc77('0x43')]=function(_0x4134b8,_0x90635c){return db['FreshsalesConfiguration'][_0xcc77('0x40')]({'where':{'id':_0x4134b8[_0xcc77('0x3e')]['id']}})[_0xcc77('0x23')](handleEntityNotFound(_0x90635c,null))[_0xcc77('0x23')](removeEntity(_0x90635c,null))[_0xcc77('0x3d')](handleError(_0x90635c,null));};exports[_0xcc77('0x44')]=function(_0x3396d8,_0x24d98d,_0x1b80be){var _0x2410c1={};var _0x4ba033={};var _0x50ddb1;var _0x332d51;return db[_0xcc77('0x39')]['findOne']({'where':{'id':_0x3396d8[_0xcc77('0x3e')]['id']}})[_0xcc77('0x23')](handleEntityNotFound(_0x24d98d,null))['then'](function(_0x121016){if(_0x121016){_0x50ddb1=_0x121016;_0x4ba033[_0xcc77('0x28')]=_[_0xcc77('0x29')](db[_0xcc77('0x45')][_0xcc77('0x3f')]);_0x4ba033[_0xcc77('0x2a')]=_[_0xcc77('0x29')](_0x3396d8[_0xcc77('0x2a')]);_0x4ba033[_0xcc77('0x33')]=_[_0xcc77('0x2b')](_0x4ba033['model'],_0x4ba033['query']);_0x2410c1[_0xcc77('0x2c')]=_[_0xcc77('0x2b')](_0x4ba033[_0xcc77('0x28')],qs[_0xcc77('0x2d')](_0x3396d8[_0xcc77('0x2a')]['fields']));_0x2410c1[_0xcc77('0x2c')]=_0x2410c1['attributes'][_0xcc77('0x2e')]?_0x2410c1[_0xcc77('0x2c')]:_0x4ba033[_0xcc77('0x28')];_0x2410c1[_0xcc77('0x30')]=qs[_0xcc77('0x31')](_0x3396d8[_0xcc77('0x2a')][_0xcc77('0x31')]);_0x2410c1[_0xcc77('0x32')]=qs[_0xcc77('0x33')](_['pick'](_0x3396d8['query'],_0x4ba033[_0xcc77('0x33')]));if(_0x3396d8['query'][_0xcc77('0x36')]){_0x2410c1[_0xcc77('0x32')]=_[_0xcc77('0x37')](_0x2410c1[_0xcc77('0x32')],{'$or':_['map'](_0x2410c1['attributes'],function(_0x6c433f){var _0x1ecb83={};_0x1ecb83[_0x6c433f]={'$like':'%'+_0x3396d8[_0xcc77('0x2a')]['filter']+'%'};return _0x1ecb83;})});}_0x2410c1=_[_0xcc77('0x37')]({},_0x2410c1,_0x3396d8[_0xcc77('0x38')]);return _0x50ddb1[_0xcc77('0x44')](_0x2410c1);}})['then'](function(_0x512cc5){if(_0x512cc5){_0x332d51=_0x512cc5['length'];if(!_0x3396d8[_0xcc77('0x2a')][_0xcc77('0x2f')](_0xcc77('0x46'))){_0x2410c1[_0xcc77('0x1c')]=qs[_0xcc77('0x1c')](_0x3396d8['query'][_0xcc77('0x1c')]);_0x2410c1[_0xcc77('0x1a')]=qs[_0xcc77('0x1a')](_0x3396d8[_0xcc77('0x2a')][_0xcc77('0x1a')]);}return _0x50ddb1[_0xcc77('0x44')](_0x2410c1);}})[_0xcc77('0x23')](function(_0x2618f9){if(_0x2618f9){return _0x2618f9?{'count':_0x332d51,'rows':_0x2618f9}:null;}})[_0xcc77('0x23')](respondWithResult(_0x24d98d,null))[_0xcc77('0x3d')](handleError(_0x24d98d,null));};exports[_0xcc77('0x47')]=function(_0x2cead0,_0x5d2982,_0xe4c9e7){var _0x204521={};var _0x560749={};var _0x4fc1a9;var _0x59016e;return db[_0xcc77('0x39')][_0xcc77('0x48')]({'where':{'id':_0x2cead0['params']['id']}})[_0xcc77('0x23')](handleEntityNotFound(_0x5d2982,null))[_0xcc77('0x23')](function(_0x383a59){if(_0x383a59){_0x4fc1a9=_0x383a59;_0x560749['model']=_[_0xcc77('0x29')](db[_0xcc77('0x45')][_0xcc77('0x3f')]);_0x560749[_0xcc77('0x2a')]=_[_0xcc77('0x29')](_0x2cead0[_0xcc77('0x2a')]);_0x560749['filters']=_['intersection'](_0x560749[_0xcc77('0x28')],_0x560749[_0xcc77('0x2a')]);_0x204521['attributes']=_[_0xcc77('0x2b')](_0x560749[_0xcc77('0x28')],qs['fields'](_0x2cead0['query'][_0xcc77('0x2d')]));_0x204521['attributes']=_0x204521[_0xcc77('0x2c')][_0xcc77('0x2e')]?_0x204521[_0xcc77('0x2c')]:_0x560749['model'];_0x204521[_0xcc77('0x30')]=qs[_0xcc77('0x31')](_0x2cead0[_0xcc77('0x2a')][_0xcc77('0x31')]);_0x204521[_0xcc77('0x32')]=qs[_0xcc77('0x33')](_[_0xcc77('0x49')](_0x2cead0[_0xcc77('0x2a')],_0x560749[_0xcc77('0x33')]));if(_0x2cead0[_0xcc77('0x2a')][_0xcc77('0x36')]){_0x204521['where']=_[_0xcc77('0x37')](_0x204521[_0xcc77('0x32')],{'$or':_[_0xcc77('0x27')](_0x204521[_0xcc77('0x2c')],function(_0x540ddf){var _0x2becfa={};_0x2becfa[_0x540ddf]={'$like':'%'+_0x2cead0['query'][_0xcc77('0x36')]+'%'};return _0x2becfa;})});}_0x204521=_['merge']({},_0x204521,_0x2cead0[_0xcc77('0x38')]);return _0x4fc1a9['getDescriptions'](_0x204521);}})[_0xcc77('0x23')](function(_0x34d8bb){if(_0x34d8bb){_0x59016e=_0x34d8bb['length'];if(!_0x2cead0[_0xcc77('0x2a')][_0xcc77('0x2f')](_0xcc77('0x46'))){_0x204521[_0xcc77('0x1c')]=qs[_0xcc77('0x1c')](_0x2cead0[_0xcc77('0x2a')]['limit']);_0x204521['offset']=qs[_0xcc77('0x1a')](_0x2cead0[_0xcc77('0x2a')][_0xcc77('0x1a')]);}return _0x4fc1a9['getDescriptions'](_0x204521);}})[_0xcc77('0x23')](function(_0x18d26b){if(_0x18d26b){return _0x18d26b?{'count':_0x59016e,'rows':_0x18d26b}:null;}})['then'](respondWithResult(_0x5d2982,null))[_0xcc77('0x3d')](handleError(_0x5d2982,null));};exports[_0xcc77('0x4a')]=function(_0x41c664,_0x3504ee,_0x4c5127){var _0x590eeb={};var _0x4d2b41={};var _0x1825b6;var _0x12eeff;return db[_0xcc77('0x39')][_0xcc77('0x48')]({'where':{'id':_0x41c664[_0xcc77('0x3e')]['id']}})[_0xcc77('0x23')](handleEntityNotFound(_0x3504ee,null))['then'](function(_0x3a6a0f){if(_0x3a6a0f){_0x1825b6=_0x3a6a0f;_0x4d2b41['model']=_[_0xcc77('0x29')](db['FreshsalesField'][_0xcc77('0x3f')]);_0x4d2b41[_0xcc77('0x2a')]=_['keys'](_0x41c664[_0xcc77('0x2a')]);_0x4d2b41[_0xcc77('0x33')]=_[_0xcc77('0x2b')](_0x4d2b41['model'],_0x4d2b41[_0xcc77('0x2a')]);_0x590eeb['attributes']=_['intersection'](_0x4d2b41[_0xcc77('0x28')],qs['fields'](_0x41c664['query'][_0xcc77('0x2d')]));_0x590eeb['attributes']=_0x590eeb[_0xcc77('0x2c')][_0xcc77('0x2e')]?_0x590eeb[_0xcc77('0x2c')]:_0x4d2b41[_0xcc77('0x28')];_0x590eeb[_0xcc77('0x30')]=qs[_0xcc77('0x31')](_0x41c664['query'][_0xcc77('0x31')]);_0x590eeb[_0xcc77('0x32')]=qs[_0xcc77('0x33')](_[_0xcc77('0x49')](_0x41c664[_0xcc77('0x2a')],_0x4d2b41[_0xcc77('0x33')]));if(_0x41c664[_0xcc77('0x2a')][_0xcc77('0x36')]){_0x590eeb[_0xcc77('0x32')]=_[_0xcc77('0x37')](_0x590eeb[_0xcc77('0x32')],{'$or':_[_0xcc77('0x27')](_0x590eeb['attributes'],function(_0x4df753){var _0x573805={};_0x573805[_0x4df753]={'$like':'%'+_0x41c664[_0xcc77('0x2a')][_0xcc77('0x36')]+'%'};return _0x573805;})});}_0x590eeb=_[_0xcc77('0x37')]({},_0x590eeb,_0x41c664[_0xcc77('0x38')]);return _0x1825b6[_0xcc77('0x4a')](_0x590eeb);}})[_0xcc77('0x23')](function(_0x464372){if(_0x464372){_0x12eeff=_0x464372[_0xcc77('0x2e')];if(!_0x41c664[_0xcc77('0x2a')]['hasOwnProperty']('nolimit')){_0x590eeb[_0xcc77('0x1c')]=qs[_0xcc77('0x1c')](_0x41c664['query']['limit']);_0x590eeb[_0xcc77('0x1a')]=qs[_0xcc77('0x1a')](_0x41c664[_0xcc77('0x2a')][_0xcc77('0x1a')]);}return _0x1825b6[_0xcc77('0x4a')](_0x590eeb);}})['then'](function(_0x4b42bc){if(_0x4b42bc){return _0x4b42bc?{'count':_0x12eeff,'rows':_0x4b42bc}:null;}})[_0xcc77('0x23')](respondWithResult(_0x3504ee,null))[_0xcc77('0x3d')](handleError(_0x3504ee,null));}; \ No newline at end of file +var _0x67a0=['then','destroy','error','stack','name','send','index','map','FreshsalesConfiguration','rawAttributes','fieldName','key','model','query','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','params','keys','find','catch','create','body','getSubjects','findOne','FreshsalesField','hasOwnProperty','getDescriptions','getFields','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','status','set','Content-Range','apply','reject','update'];(function(_0x44fb8f,_0x1e2ec8){var _0x4fbc0e=function(_0x2385c6){while(--_0x2385c6){_0x44fb8f['push'](_0x44fb8f['shift']());}};_0x4fbc0e(++_0x1e2ec8);}(_0x67a0,0x7e));var _0x067a=function(_0xf2a3e6,_0x2db48b){_0xf2a3e6=_0xf2a3e6-0x0;var _0x5497a7=_0x67a0[_0xf2a3e6];return _0x5497a7;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x067a('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x067a('0x1'));var moment=require(_0x067a('0x2'));var BPromise=require(_0x067a('0x3'));var Mustache=require(_0x067a('0x4'));var util=require(_0x067a('0x5'));var path=require(_0x067a('0x6'));var sox=require(_0x067a('0x7'));var csv=require(_0x067a('0x8'));var ejs=require(_0x067a('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x067a('0xa'));var squel=require(_0x067a('0xb'));var crypto=require(_0x067a('0xc'));var jsforce=require(_0x067a('0xd'));var deskjs=require(_0x067a('0xe'));var toCsv=require(_0x067a('0x8'));var querystring=require(_0x067a('0xf'));var Papa=require('papaparse');var Redis=require(_0x067a('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x067a('0x11'));var as=require(_0x067a('0x12'));var hardwareService=require(_0x067a('0x13'));var logger=require(_0x067a('0x14'))(_0x067a('0x15'));var utils=require(_0x067a('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x067a('0x17'));var db=require(_0x067a('0x18'))['db'];function respondWithStatusCode(_0x1f9650,_0x4cab33){_0x4cab33=_0x4cab33||0xcc;return function(_0x57a8d7){if(_0x57a8d7){return _0x1f9650[_0x067a('0x19')](_0x4cab33);}return _0x1f9650['status'](_0x4cab33)[_0x067a('0x1a')]();};}function respondWithResult(_0x132e05,_0x10a4b3){_0x10a4b3=_0x10a4b3||0xc8;return function(_0x2bf968){if(_0x2bf968){return _0x132e05['status'](_0x10a4b3)[_0x067a('0x1b')](_0x2bf968);}};}function respondWithFilteredResult(_0x50ca38,_0x100317){return function(_0x11d75a){if(_0x11d75a){var _0x470bbd=typeof _0x100317[_0x067a('0x1c')]===_0x067a('0x1d')&&typeof _0x100317[_0x067a('0x1e')]===_0x067a('0x1d');var _0x19977e=_0x11d75a['count'];var _0xf7984c=_0x470bbd?0x0:_0x100317['offset'];var _0x759117=_0x470bbd?_0x11d75a[_0x067a('0x1f')]:_0x100317[_0x067a('0x1c')]+_0x100317[_0x067a('0x1e')];var _0x279057;if(_0x759117>=_0x19977e){_0x759117=_0x19977e;_0x279057=0xc8;}else{_0x279057=0xce;}_0x50ca38[_0x067a('0x20')](_0x279057);return _0x50ca38[_0x067a('0x21')](_0x067a('0x22'),_0xf7984c+'-'+_0x759117+'/'+_0x19977e)[_0x067a('0x1b')](_0x11d75a);}return null;};}function patchUpdates(_0x4ff29e){return function(_0x242a77){try{jsonpatch[_0x067a('0x23')](_0x242a77,_0x4ff29e,!![]);}catch(_0x42aa1c){return BPromise[_0x067a('0x24')](_0x42aa1c);}return _0x242a77['save']();};}function saveUpdates(_0x44efab,_0xe0df0f){return function(_0x4a9318){if(_0x4a9318){return _0x4a9318[_0x067a('0x25')](_0x44efab)[_0x067a('0x26')](function(_0xee8c4a){return _0xee8c4a;});}return null;};}function removeEntity(_0x408fb3,_0x2d48b7){return function(_0x1c2df0){if(_0x1c2df0){return _0x1c2df0[_0x067a('0x27')]()[_0x067a('0x26')](function(){_0x408fb3[_0x067a('0x20')](0xcc)[_0x067a('0x1a')]();});}};}function handleEntityNotFound(_0x20a02e,_0x39f5ec){return function(_0x1df23f){if(!_0x1df23f){_0x20a02e['sendStatus'](0x194);}return _0x1df23f;};}function handleError(_0x59798c,_0x9acff6){_0x9acff6=_0x9acff6||0x1f4;return function(_0xb2c47a){logger[_0x067a('0x28')](_0xb2c47a[_0x067a('0x29')]);if(_0xb2c47a[_0x067a('0x2a')]){delete _0xb2c47a[_0x067a('0x2a')];}_0x59798c['status'](_0x9acff6)[_0x067a('0x2b')](_0xb2c47a);};}exports[_0x067a('0x2c')]=function(_0x54b20c,_0x1c08a6){var _0x32a13f={},_0x13d839={},_0x20f7c5={'count':0x0,'rows':[]};var _0x3f41fa=_[_0x067a('0x2d')](db[_0x067a('0x2e')][_0x067a('0x2f')],function(_0x1c700d){return{'name':_0x1c700d[_0x067a('0x30')],'type':_0x1c700d['type'][_0x067a('0x31')]};});_0x13d839[_0x067a('0x32')]=_[_0x067a('0x2d')](_0x3f41fa,_0x067a('0x2a'));_0x13d839[_0x067a('0x33')]=_['keys'](_0x54b20c[_0x067a('0x33')]);_0x13d839[_0x067a('0x34')]=_[_0x067a('0x35')](_0x13d839[_0x067a('0x32')],_0x13d839['query']);_0x32a13f['attributes']=_[_0x067a('0x35')](_0x13d839[_0x067a('0x32')],qs[_0x067a('0x36')](_0x54b20c[_0x067a('0x33')]['fields']));_0x32a13f[_0x067a('0x37')]=_0x32a13f[_0x067a('0x37')][_0x067a('0x38')]?_0x32a13f[_0x067a('0x37')]:_0x13d839[_0x067a('0x32')];if(!_0x54b20c[_0x067a('0x33')]['hasOwnProperty'](_0x067a('0x39'))){_0x32a13f[_0x067a('0x1e')]=qs[_0x067a('0x1e')](_0x54b20c[_0x067a('0x33')][_0x067a('0x1e')]);_0x32a13f[_0x067a('0x1c')]=qs[_0x067a('0x1c')](_0x54b20c['query']['offset']);}_0x32a13f[_0x067a('0x3a')]=qs[_0x067a('0x3b')](_0x54b20c[_0x067a('0x33')][_0x067a('0x3b')]);_0x32a13f[_0x067a('0x3c')]=qs[_0x067a('0x34')](_[_0x067a('0x3d')](_0x54b20c[_0x067a('0x33')],_0x13d839[_0x067a('0x34')]),_0x3f41fa);if(_0x54b20c['query'][_0x067a('0x3e')]){_0x32a13f[_0x067a('0x3c')]=_[_0x067a('0x3f')](_0x32a13f['where'],{'$or':_[_0x067a('0x2d')](_0x3f41fa,function(_0x593859){if(_0x593859['type']!==_0x067a('0x40')){var _0x2b3456={};_0x2b3456[_0x593859['name']]={'$like':'%'+_0x54b20c[_0x067a('0x33')][_0x067a('0x3e')]+'%'};return _0x2b3456;}})});}_0x32a13f=_['merge']({},_0x32a13f,_0x54b20c[_0x067a('0x41')]);var _0x4dcc55={'where':_0x32a13f[_0x067a('0x3c')]};return db[_0x067a('0x2e')][_0x067a('0x1f')](_0x4dcc55)[_0x067a('0x26')](function(_0x4cb589){_0x20f7c5[_0x067a('0x1f')]=_0x4cb589;if(_0x54b20c[_0x067a('0x33')][_0x067a('0x42')]){_0x32a13f[_0x067a('0x43')]=[{'all':!![]}];}return db[_0x067a('0x2e')][_0x067a('0x44')](_0x32a13f);})[_0x067a('0x26')](function(_0x433e46){_0x20f7c5[_0x067a('0x45')]=_0x433e46;return _0x20f7c5;})[_0x067a('0x26')](respondWithFilteredResult(_0x1c08a6,_0x32a13f))['catch'](handleError(_0x1c08a6,null));};exports['show']=function(_0x30389c,_0x4439c6){var _0x16f901={'raw':![],'where':{'id':_0x30389c[_0x067a('0x46')]['id']}},_0x445269={};_0x445269[_0x067a('0x32')]=_['keys'](db[_0x067a('0x2e')]['rawAttributes']);_0x445269[_0x067a('0x33')]=_[_0x067a('0x47')](_0x30389c[_0x067a('0x33')]);_0x445269[_0x067a('0x34')]=_[_0x067a('0x35')](_0x445269[_0x067a('0x32')],_0x445269[_0x067a('0x33')]);_0x16f901[_0x067a('0x37')]=_['intersection'](_0x445269[_0x067a('0x32')],qs[_0x067a('0x36')](_0x30389c[_0x067a('0x33')][_0x067a('0x36')]));_0x16f901[_0x067a('0x37')]=_0x16f901[_0x067a('0x37')][_0x067a('0x38')]?_0x16f901[_0x067a('0x37')]:_0x445269['model'];if(_0x30389c[_0x067a('0x33')][_0x067a('0x42')]){_0x16f901['include']=[{'all':!![]}];}_0x16f901=_['merge']({},_0x16f901,_0x30389c['options']);return db[_0x067a('0x2e')][_0x067a('0x48')](_0x16f901)['then'](handleEntityNotFound(_0x4439c6,null))[_0x067a('0x26')](respondWithResult(_0x4439c6,null))[_0x067a('0x49')](handleError(_0x4439c6,null));};exports[_0x067a('0x4a')]=function(_0x541102,_0x55cff6){return db[_0x067a('0x2e')][_0x067a('0x4a')](_0x541102[_0x067a('0x4b')],{})[_0x067a('0x26')](respondWithResult(_0x55cff6,0xc9))[_0x067a('0x49')](handleError(_0x55cff6,null));};exports[_0x067a('0x25')]=function(_0x3acd5e,_0x5814be){if(_0x3acd5e[_0x067a('0x4b')]['id']){delete _0x3acd5e[_0x067a('0x4b')]['id'];}return db['FreshsalesConfiguration'][_0x067a('0x48')]({'where':{'id':_0x3acd5e[_0x067a('0x46')]['id']}})[_0x067a('0x26')](handleEntityNotFound(_0x5814be,null))[_0x067a('0x26')](saveUpdates(_0x3acd5e[_0x067a('0x4b')],null))[_0x067a('0x26')](respondWithResult(_0x5814be,null))[_0x067a('0x49')](handleError(_0x5814be,null));};exports[_0x067a('0x27')]=function(_0x2893ff,_0x213873){return db[_0x067a('0x2e')][_0x067a('0x48')]({'where':{'id':_0x2893ff[_0x067a('0x46')]['id']}})['then'](handleEntityNotFound(_0x213873,null))['then'](removeEntity(_0x213873,null))['catch'](handleError(_0x213873,null));};exports[_0x067a('0x4c')]=function(_0x2f7d4c,_0x3b76ba,_0x30169e){var _0x42d4b4={};var _0x51d5fc={};var _0x213bd4;var _0x24790c;return db['FreshsalesConfiguration'][_0x067a('0x4d')]({'where':{'id':_0x2f7d4c[_0x067a('0x46')]['id']}})[_0x067a('0x26')](handleEntityNotFound(_0x3b76ba,null))[_0x067a('0x26')](function(_0x85ecab){if(_0x85ecab){_0x213bd4=_0x85ecab;_0x51d5fc[_0x067a('0x32')]=_[_0x067a('0x47')](db[_0x067a('0x4e')][_0x067a('0x2f')]);_0x51d5fc[_0x067a('0x33')]=_['keys'](_0x2f7d4c[_0x067a('0x33')]);_0x51d5fc['filters']=_[_0x067a('0x35')](_0x51d5fc[_0x067a('0x32')],_0x51d5fc['query']);_0x42d4b4[_0x067a('0x37')]=_[_0x067a('0x35')](_0x51d5fc['model'],qs['fields'](_0x2f7d4c['query']['fields']));_0x42d4b4[_0x067a('0x37')]=_0x42d4b4[_0x067a('0x37')]['length']?_0x42d4b4['attributes']:_0x51d5fc[_0x067a('0x32')];_0x42d4b4['order']=qs[_0x067a('0x3b')](_0x2f7d4c[_0x067a('0x33')][_0x067a('0x3b')]);_0x42d4b4[_0x067a('0x3c')]=qs[_0x067a('0x34')](_[_0x067a('0x3d')](_0x2f7d4c['query'],_0x51d5fc[_0x067a('0x34')]));if(_0x2f7d4c['query'][_0x067a('0x3e')]){_0x42d4b4[_0x067a('0x3c')]=_[_0x067a('0x3f')](_0x42d4b4[_0x067a('0x3c')],{'$or':_['map'](_0x42d4b4[_0x067a('0x37')],function(_0x27fe34){var _0x402da4={};_0x402da4[_0x27fe34]={'$like':'%'+_0x2f7d4c[_0x067a('0x33')][_0x067a('0x3e')]+'%'};return _0x402da4;})});}_0x42d4b4=_['merge']({},_0x42d4b4,_0x2f7d4c['options']);return _0x213bd4[_0x067a('0x4c')](_0x42d4b4);}})['then'](function(_0x1426fe){if(_0x1426fe){_0x24790c=_0x1426fe[_0x067a('0x38')];if(!_0x2f7d4c[_0x067a('0x33')][_0x067a('0x4f')](_0x067a('0x39'))){_0x42d4b4[_0x067a('0x1e')]=qs[_0x067a('0x1e')](_0x2f7d4c[_0x067a('0x33')]['limit']);_0x42d4b4[_0x067a('0x1c')]=qs[_0x067a('0x1c')](_0x2f7d4c[_0x067a('0x33')]['offset']);}return _0x213bd4[_0x067a('0x4c')](_0x42d4b4);}})[_0x067a('0x26')](function(_0x4273bd){if(_0x4273bd){return _0x4273bd?{'count':_0x24790c,'rows':_0x4273bd}:null;}})['then'](respondWithResult(_0x3b76ba,null))[_0x067a('0x49')](handleError(_0x3b76ba,null));};exports[_0x067a('0x50')]=function(_0x2cc206,_0x34ba50,_0x23ba73){var _0x200a35={};var _0x2c41d7={};var _0x3500ec;var _0x1034b0;return db[_0x067a('0x2e')][_0x067a('0x4d')]({'where':{'id':_0x2cc206[_0x067a('0x46')]['id']}})[_0x067a('0x26')](handleEntityNotFound(_0x34ba50,null))[_0x067a('0x26')](function(_0x1300a1){if(_0x1300a1){_0x3500ec=_0x1300a1;_0x2c41d7[_0x067a('0x32')]=_[_0x067a('0x47')](db[_0x067a('0x4e')][_0x067a('0x2f')]);_0x2c41d7['query']=_[_0x067a('0x47')](_0x2cc206['query']);_0x2c41d7[_0x067a('0x34')]=_[_0x067a('0x35')](_0x2c41d7[_0x067a('0x32')],_0x2c41d7[_0x067a('0x33')]);_0x200a35[_0x067a('0x37')]=_['intersection'](_0x2c41d7[_0x067a('0x32')],qs[_0x067a('0x36')](_0x2cc206['query'][_0x067a('0x36')]));_0x200a35[_0x067a('0x37')]=_0x200a35[_0x067a('0x37')]['length']?_0x200a35[_0x067a('0x37')]:_0x2c41d7[_0x067a('0x32')];_0x200a35[_0x067a('0x3a')]=qs[_0x067a('0x3b')](_0x2cc206[_0x067a('0x33')][_0x067a('0x3b')]);_0x200a35[_0x067a('0x3c')]=qs[_0x067a('0x34')](_[_0x067a('0x3d')](_0x2cc206[_0x067a('0x33')],_0x2c41d7['filters']));if(_0x2cc206[_0x067a('0x33')][_0x067a('0x3e')]){_0x200a35[_0x067a('0x3c')]=_[_0x067a('0x3f')](_0x200a35[_0x067a('0x3c')],{'$or':_['map'](_0x200a35[_0x067a('0x37')],function(_0x39bfe3){var _0x29a842={};_0x29a842[_0x39bfe3]={'$like':'%'+_0x2cc206[_0x067a('0x33')][_0x067a('0x3e')]+'%'};return _0x29a842;})});}_0x200a35=_[_0x067a('0x3f')]({},_0x200a35,_0x2cc206['options']);return _0x3500ec[_0x067a('0x50')](_0x200a35);}})[_0x067a('0x26')](function(_0x1b1d12){if(_0x1b1d12){_0x1034b0=_0x1b1d12[_0x067a('0x38')];if(!_0x2cc206[_0x067a('0x33')][_0x067a('0x4f')](_0x067a('0x39'))){_0x200a35[_0x067a('0x1e')]=qs[_0x067a('0x1e')](_0x2cc206['query'][_0x067a('0x1e')]);_0x200a35[_0x067a('0x1c')]=qs['offset'](_0x2cc206[_0x067a('0x33')][_0x067a('0x1c')]);}return _0x3500ec[_0x067a('0x50')](_0x200a35);}})[_0x067a('0x26')](function(_0xcf72fb){if(_0xcf72fb){return _0xcf72fb?{'count':_0x1034b0,'rows':_0xcf72fb}:null;}})[_0x067a('0x26')](respondWithResult(_0x34ba50,null))[_0x067a('0x49')](handleError(_0x34ba50,null));};exports[_0x067a('0x51')]=function(_0x5a73c1,_0x35a3c1,_0x389a59){var _0x5916ff={};var _0x3a74d1={};var _0x4efce1;var _0x4f8725;return db['FreshsalesConfiguration'][_0x067a('0x4d')]({'where':{'id':_0x5a73c1['params']['id']}})['then'](handleEntityNotFound(_0x35a3c1,null))[_0x067a('0x26')](function(_0x22d54f){if(_0x22d54f){_0x4efce1=_0x22d54f;_0x3a74d1[_0x067a('0x32')]=_[_0x067a('0x47')](db[_0x067a('0x4e')]['rawAttributes']);_0x3a74d1[_0x067a('0x33')]=_['keys'](_0x5a73c1['query']);_0x3a74d1[_0x067a('0x34')]=_[_0x067a('0x35')](_0x3a74d1[_0x067a('0x32')],_0x3a74d1['query']);_0x5916ff[_0x067a('0x37')]=_[_0x067a('0x35')](_0x3a74d1['model'],qs['fields'](_0x5a73c1[_0x067a('0x33')][_0x067a('0x36')]));_0x5916ff[_0x067a('0x37')]=_0x5916ff[_0x067a('0x37')][_0x067a('0x38')]?_0x5916ff[_0x067a('0x37')]:_0x3a74d1['model'];_0x5916ff['order']=qs[_0x067a('0x3b')](_0x5a73c1[_0x067a('0x33')][_0x067a('0x3b')]);_0x5916ff[_0x067a('0x3c')]=qs[_0x067a('0x34')](_[_0x067a('0x3d')](_0x5a73c1['query'],_0x3a74d1[_0x067a('0x34')]));if(_0x5a73c1[_0x067a('0x33')][_0x067a('0x3e')]){_0x5916ff['where']=_[_0x067a('0x3f')](_0x5916ff[_0x067a('0x3c')],{'$or':_[_0x067a('0x2d')](_0x5916ff['attributes'],function(_0x11335e){var _0x487b84={};_0x487b84[_0x11335e]={'$like':'%'+_0x5a73c1[_0x067a('0x33')][_0x067a('0x3e')]+'%'};return _0x487b84;})});}_0x5916ff=_[_0x067a('0x3f')]({},_0x5916ff,_0x5a73c1[_0x067a('0x41')]);return _0x4efce1[_0x067a('0x51')](_0x5916ff);}})[_0x067a('0x26')](function(_0x413697){if(_0x413697){_0x4f8725=_0x413697[_0x067a('0x38')];if(!_0x5a73c1[_0x067a('0x33')]['hasOwnProperty'](_0x067a('0x39'))){_0x5916ff['limit']=qs[_0x067a('0x1e')](_0x5a73c1['query'][_0x067a('0x1e')]);_0x5916ff[_0x067a('0x1c')]=qs['offset'](_0x5a73c1[_0x067a('0x33')][_0x067a('0x1c')]);}return _0x4efce1['getFields'](_0x5916ff);}})[_0x067a('0x26')](function(_0x4e3733){if(_0x4e3733){return _0x4e3733?{'count':_0x4f8725,'rows':_0x4e3733}:null;}})[_0x067a('0x26')](respondWithResult(_0x35a3c1,null))[_0x067a('0x49')](handleError(_0x35a3c1,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js index ab458af..922b280 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 _0xbe75=['../../config/logger','api','moment','request-promise','rimraf','../../config/environment','exports','define','FreshsalesConfiguration','util'];(function(_0x51758a,_0x37c2a5){var _0x193e61=function(_0x33ce01){while(--_0x33ce01){_0x51758a['push'](_0x51758a['shift']());}};_0x193e61(++_0x37c2a5);}(_0xbe75,0x8b));var _0x5be7=function(_0x37130a,_0x4df3a0){_0x37130a=_0x37130a-0x0;var _0x466769=_0xbe75[_0x37130a];return _0x466769;};'use strict';var _=require('lodash');var util=require(_0x5be7('0x0'));var logger=require(_0x5be7('0x1'))(_0x5be7('0x2'));var moment=require(_0x5be7('0x3'));var BPromise=require('bluebird');var rp=require(_0x5be7('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5be7('0x5'));var config=require(_0x5be7('0x6'));var attributes=require('./intFreshsalesConfiguration.attributes');module[_0x5be7('0x7')]=function(_0x436ad6,_0x2b58a9){return _0x436ad6[_0x5be7('0x8')](_0x5be7('0x9'),attributes,{'tableName':'int_freshsales_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0b02=['path','rimraf','../../config/environment','./intFreshsalesConfiguration.attributes','define','FreshsalesConfiguration','int_freshsales_configurations','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x10f8e8,_0x57865b){var _0x6699c6=function(_0xd4716d){while(--_0xd4716d){_0x10f8e8['push'](_0x10f8e8['shift']());}};_0x6699c6(++_0x57865b);}(_0x0b02,0x14c));var _0x20b0=function(_0x3ae95d,_0x3398e6){_0x3ae95d=_0x3ae95d-0x0;var _0x3435d1=_0x0b02[_0x3ae95d];return _0x3435d1;};'use strict';var _=require('lodash');var util=require(_0x20b0('0x0'));var logger=require(_0x20b0('0x1'))(_0x20b0('0x2'));var moment=require(_0x20b0('0x3'));var BPromise=require(_0x20b0('0x4'));var rp=require(_0x20b0('0x5'));var fs=require('fs');var path=require(_0x20b0('0x6'));var rimraf=require(_0x20b0('0x7'));var config=require(_0x20b0('0x8'));var attributes=require(_0x20b0('0x9'));module['exports']=function(_0x1c7f68,_0x17ecdf){return _0x1c7f68[_0x20b0('0xa')](_0x20b0('0xb'),attributes,{'tableName':_0x20b0('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.rpc.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.rpc.js index 76c901a..b765b4c 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 _0x2952=['../../config/utils','../../config/environment','jayson/promise','http','then','info','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','util','moment','bluebird','../../mysqldb'];(function(_0x44ab4b,_0x59e2c0){var _0x46abde=function(_0x46cff1){while(--_0x46cff1){_0x44ab4b['push'](_0x44ab4b['shift']());}};_0x46abde(++_0x59e2c0);}(_0x2952,0x7a));var _0x2295=function(_0x411017,_0x4a8117){_0x411017=_0x411017-0x0;var _0x2adeea=_0x2952[_0x411017];return _0x2adeea;};'use strict';var _=require('lodash');var util=require(_0x2295('0x0'));var moment=require(_0x2295('0x1'));var BPromise=require(_0x2295('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2295('0x3'))['db'];var utils=require(_0x2295('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x2295('0x5'));var jayson=require(_0x2295('0x6'));var client=jayson['client'][_0x2295('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x23328b,_0x543b35,_0x1b4e0e){return new BPromise(function(_0x4b912b,_0x4b4306){return client['request'](_0x23328b,_0x1b4e0e)[_0x2295('0x8')](function(_0x13474a){logger[_0x2295('0x9')](_0x2295('0xa'),_0x543b35,_0x2295('0xb'));logger[_0x2295('0xc')](_0x2295('0xd'),_0x543b35,_0x2295('0xb'),JSON[_0x2295('0xe')](_0x13474a));if(_0x13474a[_0x2295('0xf')]){if(_0x13474a[_0x2295('0xf')]['code']===0x1f4){logger[_0x2295('0xf')](_0x2295('0xa'),_0x543b35,_0x13474a[_0x2295('0xf')][_0x2295('0x10')]);return _0x4b4306(_0x13474a[_0x2295('0xf')][_0x2295('0x10')]);}logger[_0x2295('0xf')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x543b35,_0x13474a['error']['message']);return _0x4b912b(_0x13474a[_0x2295('0xf')][_0x2295('0x10')]);}else{logger[_0x2295('0x9')](_0x2295('0xa'),_0x543b35,_0x2295('0xb'));_0x4b912b(_0x13474a['result']['message']);}})[_0x2295('0x11')](function(_0x3e3713){logger[_0x2295('0xf')](_0x2295('0xa'),_0x543b35,_0x3e3713);_0x4b4306(_0x3e3713);});});} \ No newline at end of file +var _0x6058=['error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','request','then','info','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x68696,_0x2aef59){var _0x29d9b5=function(_0xbf7e8b){while(--_0xbf7e8b){_0x68696['push'](_0x68696['shift']());}};_0x29d9b5(++_0x2aef59);}(_0x6058,0x1ba));var _0x8605=function(_0x240362,_0x156794){_0x240362=_0x240362-0x0;var _0x26de18=_0x6058[_0x240362];return _0x26de18;};'use strict';var _=require(_0x8605('0x0'));var util=require(_0x8605('0x1'));var moment=require(_0x8605('0x2'));var BPromise=require(_0x8605('0x3'));var rs=require(_0x8605('0x4'));var fs=require('fs');var Redis=require(_0x8605('0x5'));var db=require(_0x8605('0x6'))['db'];var utils=require(_0x8605('0x7'));var logger=require(_0x8605('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0x8605('0x9'));var client=jayson[_0x8605('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x412d37,_0x2dd909,_0x4a7c54){return new BPromise(function(_0x414e7e,_0x32b950){return client[_0x8605('0xb')](_0x412d37,_0x4a7c54)[_0x8605('0xc')](function(_0xa233cf){logger[_0x8605('0xd')](_0x8605('0xe'),_0x2dd909,_0x8605('0xf'));logger['debug'](_0x8605('0x10'),_0x2dd909,_0x8605('0xf'),JSON[_0x8605('0x11')](_0xa233cf));if(_0xa233cf[_0x8605('0x12')]){if(_0xa233cf[_0x8605('0x12')][_0x8605('0x13')]===0x1f4){logger[_0x8605('0x12')](_0x8605('0xe'),_0x2dd909,_0xa233cf[_0x8605('0x12')]['message']);return _0x32b950(_0xa233cf[_0x8605('0x12')][_0x8605('0x14')]);}logger['error']('FreshsalesConfiguration,\x20%s,\x20%s',_0x2dd909,_0xa233cf['error'][_0x8605('0x14')]);return _0x414e7e(_0xa233cf[_0x8605('0x12')][_0x8605('0x14')]);}else{logger['info']('FreshsalesConfiguration,\x20%s,\x20%s',_0x2dd909,'request\x20sent');_0x414e7e(_0xa233cf[_0x8605('0x15')][_0x8605('0x14')]);}})[_0x8605('0x16')](function(_0x134a3f){logger[_0x8605('0x12')](_0x8605('0xe'),_0x2dd909,_0x134a3f);_0x32b950(_0x134a3f);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesField/index.js b/server/api/intFreshsalesField/index.js index 31450b6..c97dae9 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 _0xfc65=['fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','post','create','delete','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xfc65,0x1b4));var _0x5fc6=function(_0x3974a9,_0x9b3ce1){_0x3974a9=_0x3974a9-0x0;var _0x3f8ced=_0xfc65[_0x3974a9];return _0x3f8ced;};'use strict';var multer=require(_0x5fc6('0x0'));var util=require(_0x5fc6('0x1'));var path=require(_0x5fc6('0x2'));var timeout=require(_0x5fc6('0x3'));var express=require(_0x5fc6('0x4'));var router=express[_0x5fc6('0x5')]();var fs_extra=require(_0x5fc6('0x6'));var auth=require(_0x5fc6('0x7'));var interaction=require(_0x5fc6('0x8'));var config=require('../../config/environment');var controller=require('./intFreshsalesField.controller');router[_0x5fc6('0x9')]('/',auth[_0x5fc6('0xa')](),controller[_0x5fc6('0xb')]);router[_0x5fc6('0x9')](_0x5fc6('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x5fc6('0xd')]('/',auth[_0x5fc6('0xa')](),controller[_0x5fc6('0xe')]);router['put'](_0x5fc6('0xc'),auth[_0x5fc6('0xa')](),controller['update']);router[_0x5fc6('0xf')](_0x5fc6('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0x5fc6('0x10')]=router; \ No newline at end of file +var _0x6282=['path','connect-timeout','fs-extra','../../components/auth/service','../../config/environment','./intFreshsalesField.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports','multer','util'];(function(_0x46f3f8,_0x12c74b){var _0xbc57cd=function(_0x34df37){while(--_0x34df37){_0x46f3f8['push'](_0x46f3f8['shift']());}};_0xbc57cd(++_0x12c74b);}(_0x6282,0x76));var _0x2628=function(_0x5bfdbb,_0xefba86){_0x5bfdbb=_0x5bfdbb-0x0;var _0x16cf9a=_0x6282[_0x5bfdbb];return _0x16cf9a;};'use strict';var multer=require(_0x2628('0x0'));var util=require(_0x2628('0x1'));var path=require(_0x2628('0x2'));var timeout=require(_0x2628('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x2628('0x4'));var auth=require(_0x2628('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x2628('0x6'));var controller=require(_0x2628('0x7'));router[_0x2628('0x8')]('/',auth[_0x2628('0x9')](),controller[_0x2628('0xa')]);router['get'](_0x2628('0xb'),auth[_0x2628('0x9')](),controller[_0x2628('0xc')]);router[_0x2628('0xd')]('/',auth[_0x2628('0x9')](),controller[_0x2628('0xe')]);router[_0x2628('0xf')](_0x2628('0xb'),auth[_0x2628('0x9')](),controller[_0x2628('0x10')]);router[_0x2628('0x11')](_0x2628('0xb'),auth[_0x2628('0x9')](),controller[_0x2628('0x12')]);module[_0x2628('0x13')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.attributes.js b/server/api/intFreshsalesField/intFreshsalesField.attributes.js index 7068591..3f8d92a 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 _0x48d0=['STRING','BOOLEAN','sequelize','string','keyValue','picklist','variable'];(function(_0x449ba9,_0x5c875a){var _0xa55886=function(_0x16e2ca){while(--_0x16e2ca){_0x449ba9['push'](_0x449ba9['shift']());}};_0xa55886(++_0x5c875a);}(_0x48d0,0xf0));var _0x048d=function(_0x38f2bc,_0x83a4b6){_0x38f2bc=_0x38f2bc-0x0;var _0x2894d4=_0x48d0[_0x38f2bc];return _0x2894d4;};'use strict';var Sequelize=require(_0x048d('0x0'));module['exports']={'type':{'type':Sequelize['ENUM'](_0x048d('0x1'),'variable','customVariable',_0x048d('0x2'),_0x048d('0x3')),'defaultValue':_0x048d('0x1')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM'](_0x048d('0x1'),_0x048d('0x4'),'customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x048d('0x5')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x048d('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x048d('0x5')]}}; \ No newline at end of file +var _0x11dd=['picklist','STRING','string','sequelize','ENUM','variable','customVariable','keyValue'];(function(_0x34213c,_0x1aeb61){var _0x158ab5=function(_0x41029d){while(--_0x41029d){_0x34213c['push'](_0x34213c['shift']());}};_0x158ab5(++_0x1aeb61);}(_0x11dd,0x133));var _0xd11d=function(_0x557fd2,_0x2c0a7a){_0x557fd2=_0x557fd2-0x0;var _0x1b54a2=_0x11dd[_0x557fd2];return _0x1b54a2;};'use strict';var Sequelize=require(_0xd11d('0x0'));module['exports']={'type':{'type':Sequelize[_0xd11d('0x1')]('string',_0xd11d('0x2'),_0xd11d('0x3'),_0xd11d('0x4'),_0xd11d('0x5')),'defaultValue':'string'},'content':{'type':Sequelize[_0xd11d('0x6')]},'key':{'type':Sequelize[_0xd11d('0x6')]},'keyType':{'type':Sequelize[_0xd11d('0x1')](_0xd11d('0x7'),_0xd11d('0x2'),_0xd11d('0x3'))},'keyContent':{'type':Sequelize[_0xd11d('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xd11d('0x6')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.controller.js b/server/api/intFreshsalesField/intFreshsalesField.controller.js index 4ad65b8..0f16dfe 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 _0x6af7=['includeAll','include','findAll','rows','catch','show','params','rawAttributes','length','find','create','body','update','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','then','destroy','name','send','index','map','FreshsalesField','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','options'];(function(_0x1c67b3,_0x3fb1ca){var _0x54ecd2=function(_0x4fd560){while(--_0x4fd560){_0x1c67b3['push'](_0x1c67b3['shift']());}};_0x54ecd2(++_0x3fb1ca);}(_0x6af7,0xa5));var _0x76af=function(_0x251139,_0x3db092){_0x251139=_0x251139-0x0;var _0x2fe1f1=_0x6af7[_0x251139];return _0x2fe1f1;};'use strict';var emlformat=require(_0x76af('0x0'));var rimraf=require(_0x76af('0x1'));var zipdir=require(_0x76af('0x2'));var jsonpatch=require(_0x76af('0x3'));var rp=require(_0x76af('0x4'));var moment=require('moment');var BPromise=require(_0x76af('0x5'));var Mustache=require(_0x76af('0x6'));var util=require(_0x76af('0x7'));var path=require(_0x76af('0x8'));var sox=require(_0x76af('0x9'));var csv=require(_0x76af('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x76af('0xb'));var _=require(_0x76af('0xc'));var squel=require(_0x76af('0xd'));var crypto=require(_0x76af('0xe'));var jsforce=require(_0x76af('0xf'));var deskjs=require(_0x76af('0x10'));var toCsv=require(_0x76af('0xa'));var querystring=require(_0x76af('0x11'));var Papa=require(_0x76af('0x12'));var Redis=require(_0x76af('0x13'));var authService=require(_0x76af('0x14'));var qs=require(_0x76af('0x15'));var as=require(_0x76af('0x16'));var hardwareService=require(_0x76af('0x17'));var logger=require(_0x76af('0x18'))('api');var utils=require('../../config/utils');var config=require(_0x76af('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x539adc,_0x4c06ef){_0x4c06ef=_0x4c06ef||0xcc;return function(_0x49472f){if(_0x49472f){return _0x539adc[_0x76af('0x1a')](_0x4c06ef);}return _0x539adc[_0x76af('0x1b')](_0x4c06ef)[_0x76af('0x1c')]();};}function respondWithResult(_0xe195c5,_0xc1c6bc){_0xc1c6bc=_0xc1c6bc||0xc8;return function(_0x9e50ed){if(_0x9e50ed){return _0xe195c5[_0x76af('0x1b')](_0xc1c6bc)[_0x76af('0x1d')](_0x9e50ed);}};}function respondWithFilteredResult(_0x217d42,_0x242459){return function(_0x11ed2f){if(_0x11ed2f){var _0x2e01dc=typeof _0x242459[_0x76af('0x1e')]===_0x76af('0x1f')&&typeof _0x242459['limit']===_0x76af('0x1f');var _0x19bbb9=_0x11ed2f[_0x76af('0x20')];var _0x53f588=_0x2e01dc?0x0:_0x242459['offset'];var _0xefc1c3=_0x2e01dc?_0x11ed2f['count']:_0x242459[_0x76af('0x1e')]+_0x242459[_0x76af('0x21')];var _0x20368b;if(_0xefc1c3>=_0x19bbb9){_0xefc1c3=_0x19bbb9;_0x20368b=0xc8;}else{_0x20368b=0xce;}_0x217d42['status'](_0x20368b);return _0x217d42[_0x76af('0x22')](_0x76af('0x23'),_0x53f588+'-'+_0xefc1c3+'/'+_0x19bbb9)[_0x76af('0x1d')](_0x11ed2f);}return null;};}function patchUpdates(_0x1c122d){return function(_0x7dbcdf){try{jsonpatch[_0x76af('0x24')](_0x7dbcdf,_0x1c122d,!![]);}catch(_0x3d1f7e){return BPromise[_0x76af('0x25')](_0x3d1f7e);}return _0x7dbcdf[_0x76af('0x26')]();};}function saveUpdates(_0x20d8d9,_0x3581c3){return function(_0x25230a){if(_0x25230a){return _0x25230a['update'](_0x20d8d9)[_0x76af('0x27')](function(_0x19b170){return _0x19b170;});}return null;};}function removeEntity(_0x3226ba,_0x3f8a3c){return function(_0x1f91cd){if(_0x1f91cd){return _0x1f91cd[_0x76af('0x28')]()[_0x76af('0x27')](function(){_0x3226ba[_0x76af('0x1b')](0xcc)[_0x76af('0x1c')]();});}};}function handleEntityNotFound(_0xf86675,_0x4c2b43){return function(_0x4d1239){if(!_0x4d1239){_0xf86675['sendStatus'](0x194);}return _0x4d1239;};}function handleError(_0x19f6e9,_0x22fad9){_0x22fad9=_0x22fad9||0x1f4;return function(_0x3de196){logger['error'](_0x3de196['stack']);if(_0x3de196['name']){delete _0x3de196[_0x76af('0x29')];}_0x19f6e9[_0x76af('0x1b')](_0x22fad9)[_0x76af('0x2a')](_0x3de196);};}exports[_0x76af('0x2b')]=function(_0x18ca88,_0x33bb4d){var _0x3646d3={},_0x45d1f5={},_0x40ce94={'count':0x0,'rows':[]};var _0x1fec86=_[_0x76af('0x2c')](db[_0x76af('0x2d')]['rawAttributes'],function(_0x2c66fa){return{'name':_0x2c66fa['fieldName'],'type':_0x2c66fa[_0x76af('0x2e')]['key']};});_0x45d1f5[_0x76af('0x2f')]=_[_0x76af('0x2c')](_0x1fec86,_0x76af('0x29'));_0x45d1f5[_0x76af('0x30')]=_[_0x76af('0x31')](_0x18ca88[_0x76af('0x30')]);_0x45d1f5[_0x76af('0x32')]=_[_0x76af('0x33')](_0x45d1f5['model'],_0x45d1f5[_0x76af('0x30')]);_0x3646d3[_0x76af('0x34')]=_[_0x76af('0x33')](_0x45d1f5['model'],qs[_0x76af('0x35')](_0x18ca88[_0x76af('0x30')][_0x76af('0x35')]));_0x3646d3['attributes']=_0x3646d3[_0x76af('0x34')]['length']?_0x3646d3[_0x76af('0x34')]:_0x45d1f5['model'];if(!_0x18ca88[_0x76af('0x30')][_0x76af('0x36')]('nolimit')){_0x3646d3[_0x76af('0x21')]=qs[_0x76af('0x21')](_0x18ca88[_0x76af('0x30')]['limit']);_0x3646d3[_0x76af('0x1e')]=qs[_0x76af('0x1e')](_0x18ca88[_0x76af('0x30')][_0x76af('0x1e')]);}_0x3646d3[_0x76af('0x37')]=qs[_0x76af('0x38')](_0x18ca88[_0x76af('0x30')][_0x76af('0x38')]);_0x3646d3['where']=qs['filters'](_[_0x76af('0x39')](_0x18ca88['query'],_0x45d1f5[_0x76af('0x32')]),_0x1fec86);if(_0x18ca88[_0x76af('0x30')][_0x76af('0x3a')]){_0x3646d3[_0x76af('0x3b')]=_[_0x76af('0x3c')](_0x3646d3[_0x76af('0x3b')],{'$or':_[_0x76af('0x2c')](_0x1fec86,function(_0x361bd8){if(_0x361bd8['type']!==_0x76af('0x3d')){var _0x40b744={};_0x40b744[_0x361bd8[_0x76af('0x29')]]={'$like':'%'+_0x18ca88[_0x76af('0x30')][_0x76af('0x3a')]+'%'};return _0x40b744;}})});}_0x3646d3=_['merge']({},_0x3646d3,_0x18ca88[_0x76af('0x3e')]);var _0x7812f0={'where':_0x3646d3['where']};return db[_0x76af('0x2d')][_0x76af('0x20')](_0x7812f0)[_0x76af('0x27')](function(_0x2fb7ee){_0x40ce94[_0x76af('0x20')]=_0x2fb7ee;if(_0x18ca88[_0x76af('0x30')][_0x76af('0x3f')]){_0x3646d3[_0x76af('0x40')]=[{'all':!![]}];}return db['FreshsalesField'][_0x76af('0x41')](_0x3646d3);})[_0x76af('0x27')](function(_0x12e3dd){_0x40ce94[_0x76af('0x42')]=_0x12e3dd;return _0x40ce94;})[_0x76af('0x27')](respondWithFilteredResult(_0x33bb4d,_0x3646d3))[_0x76af('0x43')](handleError(_0x33bb4d,null));};exports[_0x76af('0x44')]=function(_0x14ccca,_0xbe7f2b){var _0x38a116={'raw':!![],'where':{'id':_0x14ccca[_0x76af('0x45')]['id']}},_0x48d7a9={};_0x48d7a9[_0x76af('0x2f')]=_[_0x76af('0x31')](db[_0x76af('0x2d')][_0x76af('0x46')]);_0x48d7a9[_0x76af('0x30')]=_['keys'](_0x14ccca[_0x76af('0x30')]);_0x48d7a9[_0x76af('0x32')]=_[_0x76af('0x33')](_0x48d7a9[_0x76af('0x2f')],_0x48d7a9[_0x76af('0x30')]);_0x38a116[_0x76af('0x34')]=_['intersection'](_0x48d7a9[_0x76af('0x2f')],qs['fields'](_0x14ccca[_0x76af('0x30')][_0x76af('0x35')]));_0x38a116['attributes']=_0x38a116[_0x76af('0x34')][_0x76af('0x47')]?_0x38a116['attributes']:_0x48d7a9['model'];if(_0x14ccca[_0x76af('0x30')][_0x76af('0x3f')]){_0x38a116[_0x76af('0x40')]=[{'all':!![]}];}_0x38a116=_[_0x76af('0x3c')]({},_0x38a116,_0x14ccca[_0x76af('0x3e')]);return db[_0x76af('0x2d')][_0x76af('0x48')](_0x38a116)[_0x76af('0x27')](handleEntityNotFound(_0xbe7f2b,null))[_0x76af('0x27')](respondWithResult(_0xbe7f2b,null))['catch'](handleError(_0xbe7f2b,null));};exports[_0x76af('0x49')]=function(_0x105d62,_0x5a14f3){return db[_0x76af('0x2d')][_0x76af('0x49')](_0x105d62[_0x76af('0x4a')],{})[_0x76af('0x27')](respondWithResult(_0x5a14f3,0xc9))[_0x76af('0x43')](handleError(_0x5a14f3,null));};exports[_0x76af('0x4b')]=function(_0x2f2f9f,_0x1289a0){if(_0x2f2f9f[_0x76af('0x4a')]['id']){delete _0x2f2f9f['body']['id'];}return db['FreshsalesField'][_0x76af('0x48')]({'where':{'id':_0x2f2f9f[_0x76af('0x45')]['id']}})[_0x76af('0x27')](handleEntityNotFound(_0x1289a0,null))[_0x76af('0x27')](saveUpdates(_0x2f2f9f['body'],null))[_0x76af('0x27')](respondWithResult(_0x1289a0,null))['catch'](handleError(_0x1289a0,null));};exports[_0x76af('0x28')]=function(_0x1e8108,_0x7d5814){return db[_0x76af('0x2d')][_0x76af('0x48')]({'where':{'id':_0x1e8108[_0x76af('0x45')]['id']}})[_0x76af('0x27')](handleEntityNotFound(_0x7d5814,null))[_0x76af('0x27')](removeEntity(_0x7d5814,null))['catch'](handleError(_0x7d5814,null));}; \ No newline at end of file +var _0x8c18=['undefined','limit','count','offset','json','apply','reject','save','update','destroy','then','sendStatus','stack','name','send','index','map','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','options','FreshsalesField','includeAll','include','findAll','rows','catch','show','find','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end'];(function(_0x1ab27e,_0x224d5a){var _0x31318f=function(_0x5068f6){while(--_0x5068f6){_0x1ab27e['push'](_0x1ab27e['shift']());}};_0x31318f(++_0x224d5a);}(_0x8c18,0x163));var _0x88c1=function(_0xb5c445,_0x50f56d){_0xb5c445=_0xb5c445-0x0;var _0x339d67=_0x8c18[_0xb5c445];return _0x339d67;};'use strict';var emlformat=require(_0x88c1('0x0'));var rimraf=require(_0x88c1('0x1'));var zipdir=require(_0x88c1('0x2'));var jsonpatch=require(_0x88c1('0x3'));var rp=require(_0x88c1('0x4'));var moment=require(_0x88c1('0x5'));var BPromise=require(_0x88c1('0x6'));var Mustache=require(_0x88c1('0x7'));var util=require(_0x88c1('0x8'));var path=require('path');var sox=require(_0x88c1('0x9'));var csv=require(_0x88c1('0xa'));var ejs=require(_0x88c1('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x88c1('0xc'));var squel=require(_0x88c1('0xd'));var crypto=require(_0x88c1('0xe'));var jsforce=require(_0x88c1('0xf'));var deskjs=require(_0x88c1('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x88c1('0x11'));var authService=require(_0x88c1('0x12'));var qs=require(_0x88c1('0x13'));var as=require(_0x88c1('0x14'));var hardwareService=require(_0x88c1('0x15'));var logger=require(_0x88c1('0x16'))(_0x88c1('0x17'));var utils=require(_0x88c1('0x18'));var config=require(_0x88c1('0x19'));var licenseUtil=require(_0x88c1('0x1a'));var db=require(_0x88c1('0x1b'))['db'];function respondWithStatusCode(_0x501676,_0x212472){_0x212472=_0x212472||0xcc;return function(_0x47b867){if(_0x47b867){return _0x501676['sendStatus'](_0x212472);}return _0x501676[_0x88c1('0x1c')](_0x212472)[_0x88c1('0x1d')]();};}function respondWithResult(_0x56098c,_0x405510){_0x405510=_0x405510||0xc8;return function(_0x573b58){if(_0x573b58){return _0x56098c['status'](_0x405510)['json'](_0x573b58);}};}function respondWithFilteredResult(_0x20370e,_0x145f3a){return function(_0x152f6e){if(_0x152f6e){var _0x5d7679=typeof _0x145f3a['offset']===_0x88c1('0x1e')&&typeof _0x145f3a[_0x88c1('0x1f')]===_0x88c1('0x1e');var _0x55b9cf=_0x152f6e[_0x88c1('0x20')];var _0x29fdfd=_0x5d7679?0x0:_0x145f3a['offset'];var _0x2ec881=_0x5d7679?_0x152f6e[_0x88c1('0x20')]:_0x145f3a[_0x88c1('0x21')]+_0x145f3a[_0x88c1('0x1f')];var _0x19062b;if(_0x2ec881>=_0x55b9cf){_0x2ec881=_0x55b9cf;_0x19062b=0xc8;}else{_0x19062b=0xce;}_0x20370e[_0x88c1('0x1c')](_0x19062b);return _0x20370e['set']('Content-Range',_0x29fdfd+'-'+_0x2ec881+'/'+_0x55b9cf)[_0x88c1('0x22')](_0x152f6e);}return null;};}function patchUpdates(_0x4a3e02){return function(_0x2ecfbc){try{jsonpatch[_0x88c1('0x23')](_0x2ecfbc,_0x4a3e02,!![]);}catch(_0x32a85f){return BPromise[_0x88c1('0x24')](_0x32a85f);}return _0x2ecfbc[_0x88c1('0x25')]();};}function saveUpdates(_0x44fad7,_0x402775){return function(_0x176a66){if(_0x176a66){return _0x176a66[_0x88c1('0x26')](_0x44fad7)['then'](function(_0x17d0fb){return _0x17d0fb;});}return null;};}function removeEntity(_0x223655,_0x1ebb78){return function(_0x4a65ee){if(_0x4a65ee){return _0x4a65ee[_0x88c1('0x27')]()[_0x88c1('0x28')](function(){_0x223655[_0x88c1('0x1c')](0xcc)[_0x88c1('0x1d')]();});}};}function handleEntityNotFound(_0x1c2d63,_0x574eb9){return function(_0x144fce){if(!_0x144fce){_0x1c2d63[_0x88c1('0x29')](0x194);}return _0x144fce;};}function handleError(_0x24e576,_0x385a7a){_0x385a7a=_0x385a7a||0x1f4;return function(_0x2ceafe){logger['error'](_0x2ceafe[_0x88c1('0x2a')]);if(_0x2ceafe[_0x88c1('0x2b')]){delete _0x2ceafe[_0x88c1('0x2b')];}_0x24e576[_0x88c1('0x1c')](_0x385a7a)[_0x88c1('0x2c')](_0x2ceafe);};}exports[_0x88c1('0x2d')]=function(_0x55191c,_0x16a79c){var _0x2ebadc={},_0x1b1a24={},_0x22b381={'count':0x0,'rows':[]};var _0x411f9f=_[_0x88c1('0x2e')](db['FreshsalesField'][_0x88c1('0x2f')],function(_0x4c89bb){return{'name':_0x4c89bb[_0x88c1('0x30')],'type':_0x4c89bb[_0x88c1('0x31')][_0x88c1('0x32')]};});_0x1b1a24['model']=_[_0x88c1('0x2e')](_0x411f9f,_0x88c1('0x2b'));_0x1b1a24['query']=_['keys'](_0x55191c[_0x88c1('0x33')]);_0x1b1a24[_0x88c1('0x34')]=_[_0x88c1('0x35')](_0x1b1a24[_0x88c1('0x36')],_0x1b1a24[_0x88c1('0x33')]);_0x2ebadc[_0x88c1('0x37')]=_[_0x88c1('0x35')](_0x1b1a24[_0x88c1('0x36')],qs[_0x88c1('0x38')](_0x55191c[_0x88c1('0x33')][_0x88c1('0x38')]));_0x2ebadc[_0x88c1('0x37')]=_0x2ebadc[_0x88c1('0x37')][_0x88c1('0x39')]?_0x2ebadc[_0x88c1('0x37')]:_0x1b1a24['model'];if(!_0x55191c[_0x88c1('0x33')]['hasOwnProperty'](_0x88c1('0x3a'))){_0x2ebadc[_0x88c1('0x1f')]=qs[_0x88c1('0x1f')](_0x55191c[_0x88c1('0x33')]['limit']);_0x2ebadc[_0x88c1('0x21')]=qs[_0x88c1('0x21')](_0x55191c[_0x88c1('0x33')][_0x88c1('0x21')]);}_0x2ebadc[_0x88c1('0x3b')]=qs['sort'](_0x55191c[_0x88c1('0x33')][_0x88c1('0x3c')]);_0x2ebadc[_0x88c1('0x3d')]=qs[_0x88c1('0x34')](_[_0x88c1('0x3e')](_0x55191c[_0x88c1('0x33')],_0x1b1a24[_0x88c1('0x34')]),_0x411f9f);if(_0x55191c[_0x88c1('0x33')][_0x88c1('0x3f')]){_0x2ebadc[_0x88c1('0x3d')]=_[_0x88c1('0x40')](_0x2ebadc[_0x88c1('0x3d')],{'$or':_[_0x88c1('0x2e')](_0x411f9f,function(_0x5009a1){if(_0x5009a1[_0x88c1('0x31')]!=='VIRTUAL'){var _0x3ea682={};_0x3ea682[_0x5009a1[_0x88c1('0x2b')]]={'$like':'%'+_0x55191c[_0x88c1('0x33')][_0x88c1('0x3f')]+'%'};return _0x3ea682;}})});}_0x2ebadc=_[_0x88c1('0x40')]({},_0x2ebadc,_0x55191c[_0x88c1('0x41')]);var _0x129dca={'where':_0x2ebadc['where']};return db[_0x88c1('0x42')]['count'](_0x129dca)[_0x88c1('0x28')](function(_0x1d9456){_0x22b381[_0x88c1('0x20')]=_0x1d9456;if(_0x55191c['query'][_0x88c1('0x43')]){_0x2ebadc[_0x88c1('0x44')]=[{'all':!![]}];}return db[_0x88c1('0x42')][_0x88c1('0x45')](_0x2ebadc);})[_0x88c1('0x28')](function(_0x4e85ce){_0x22b381[_0x88c1('0x46')]=_0x4e85ce;return _0x22b381;})[_0x88c1('0x28')](respondWithFilteredResult(_0x16a79c,_0x2ebadc))[_0x88c1('0x47')](handleError(_0x16a79c,null));};exports[_0x88c1('0x48')]=function(_0x232c97,_0x2c8502){var _0x54e4c2={'raw':!![],'where':{'id':_0x232c97['params']['id']}},_0xe30d89={};_0xe30d89[_0x88c1('0x36')]=_['keys'](db['FreshsalesField'][_0x88c1('0x2f')]);_0xe30d89['query']=_['keys'](_0x232c97['query']);_0xe30d89[_0x88c1('0x34')]=_[_0x88c1('0x35')](_0xe30d89[_0x88c1('0x36')],_0xe30d89[_0x88c1('0x33')]);_0x54e4c2[_0x88c1('0x37')]=_[_0x88c1('0x35')](_0xe30d89['model'],qs[_0x88c1('0x38')](_0x232c97['query'][_0x88c1('0x38')]));_0x54e4c2[_0x88c1('0x37')]=_0x54e4c2[_0x88c1('0x37')][_0x88c1('0x39')]?_0x54e4c2[_0x88c1('0x37')]:_0xe30d89['model'];if(_0x232c97[_0x88c1('0x33')][_0x88c1('0x43')]){_0x54e4c2[_0x88c1('0x44')]=[{'all':!![]}];}_0x54e4c2=_[_0x88c1('0x40')]({},_0x54e4c2,_0x232c97['options']);return db['FreshsalesField'][_0x88c1('0x49')](_0x54e4c2)[_0x88c1('0x28')](handleEntityNotFound(_0x2c8502,null))[_0x88c1('0x28')](respondWithResult(_0x2c8502,null))['catch'](handleError(_0x2c8502,null));};exports[_0x88c1('0x4a')]=function(_0x3f7d6d,_0x4c4dba){return db[_0x88c1('0x42')][_0x88c1('0x4a')](_0x3f7d6d[_0x88c1('0x4b')],{})[_0x88c1('0x28')](respondWithResult(_0x4c4dba,0xc9))['catch'](handleError(_0x4c4dba,null));};exports[_0x88c1('0x26')]=function(_0x182fef,_0x1b72ed){if(_0x182fef[_0x88c1('0x4b')]['id']){delete _0x182fef[_0x88c1('0x4b')]['id'];}return db[_0x88c1('0x42')]['find']({'where':{'id':_0x182fef[_0x88c1('0x4c')]['id']}})[_0x88c1('0x28')](handleEntityNotFound(_0x1b72ed,null))[_0x88c1('0x28')](saveUpdates(_0x182fef[_0x88c1('0x4b')],null))[_0x88c1('0x28')](respondWithResult(_0x1b72ed,null))[_0x88c1('0x47')](handleError(_0x1b72ed,null));};exports[_0x88c1('0x27')]=function(_0x35b8c6,_0x4a8465){return db['FreshsalesField'][_0x88c1('0x49')]({'where':{'id':_0x35b8c6[_0x88c1('0x4c')]['id']}})[_0x88c1('0x28')](handleEntityNotFound(_0x4a8465,null))[_0x88c1('0x28')](removeEntity(_0x4a8465,null))['catch'](handleError(_0x4a8465,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.model.js b/server/api/intFreshsalesField/intFreshsalesField.model.js index 812d9f4..689bf0e 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 _0x5b6e=['request-promise','path','./intFreshsalesField.attributes','exports','FreshsalesField','int_freshsales_fields','freshsales_unique_index','FieldId','lodash','util','api','bluebird'];(function(_0x557fd2,_0x2c0a7a){var _0x1b54a2=function(_0x2e439b){while(--_0x2e439b){_0x557fd2['push'](_0x557fd2['shift']());}};_0x1b54a2(++_0x2c0a7a);}(_0x5b6e,0x14c));var _0xe5b6=function(_0xd0455d,_0x4b5333){_0xd0455d=_0xd0455d-0x0;var _0x4eeb63=_0x5b6e[_0xd0455d];return _0x4eeb63;};'use strict';var _=require(_0xe5b6('0x0'));var util=require(_0xe5b6('0x1'));var logger=require('../../config/logger')(_0xe5b6('0x2'));var moment=require('moment');var BPromise=require(_0xe5b6('0x3'));var rp=require(_0xe5b6('0x4'));var fs=require('fs');var path=require(_0xe5b6('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xe5b6('0x6'));module[_0xe5b6('0x7')]=function(_0x2dea90,_0x2dea7d){return _0x2dea90['define'](_0xe5b6('0x8'),attributes,{'tableName':_0xe5b6('0x9'),'paranoid':![],'indexes':[{'name':_0xe5b6('0xa'),'fields':['idField',_0xe5b6('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd943=['api','bluebird','request-promise','path','rimraf','../../config/environment','int_freshsales_fields','freshsales_unique_index','lodash','util','../../config/logger'];(function(_0x4f75d3,_0x1016c9){var _0x3688e6=function(_0x1607e7){while(--_0x1607e7){_0x4f75d3['push'](_0x4f75d3['shift']());}};_0x3688e6(++_0x1016c9);}(_0xd943,0x15d));var _0x3d94=function(_0x1de2fa,_0x701bf){_0x1de2fa=_0x1de2fa-0x0;var _0x6a79e5=_0xd943[_0x1de2fa];return _0x6a79e5;};'use strict';var _=require(_0x3d94('0x0'));var util=require(_0x3d94('0x1'));var logger=require(_0x3d94('0x2'))(_0x3d94('0x3'));var moment=require('moment');var BPromise=require(_0x3d94('0x4'));var rp=require(_0x3d94('0x5'));var fs=require('fs');var path=require(_0x3d94('0x6'));var rimraf=require(_0x3d94('0x7'));var config=require(_0x3d94('0x8'));var attributes=require('./intFreshsalesField.attributes');module['exports']=function(_0x34c9c3,_0x51cf1f){return _0x34c9c3['define']('FreshsalesField',attributes,{'tableName':_0x3d94('0x9'),'paranoid':![],'indexes':[{'name':_0x3d94('0xa'),'fields':['idField','FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.rpc.js b/server/api/intFreshsalesField/intFreshsalesField.rpc.js index 3703d5b..0c4211a 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 _0x5fc3=['../../config/environment','jayson/promise','request','then','info','request\x20sent','debug','stringify','error','code','message','FreshsalesField,\x20%s,\x20%s','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x1f08df,_0x40f60a){var _0x4b3015=function(_0x33e881){while(--_0x33e881){_0x1f08df['push'](_0x1f08df['shift']());}};_0x4b3015(++_0x40f60a);}(_0x5fc3,0xa8));var _0x35fc=function(_0x37c07d,_0xdbdb5f){_0x37c07d=_0x37c07d-0x0;var _0x10dadc=_0x5fc3[_0x37c07d];return _0x10dadc;};'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')]('FreshsalesField,\x20%s,\x20%s',_0x508b32,_0x35fc('0xd'));logger[_0x35fc('0xe')]('FreshsalesField,\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']('FreshsalesField,\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 +var _0x2542=['info','FreshsalesField,\x20%s,\x20%s','debug','FreshsalesField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then'];(function(_0x2416ef,_0x319324){var _0x384693=function(_0x2d42ae){while(--_0x2d42ae){_0x2416ef['push'](_0x2416ef['shift']());}};_0x384693(++_0x319324);}(_0x2542,0x169));var _0x2254=function(_0x39053a,_0x45bbea){_0x39053a=_0x39053a-0x0;var _0x1fdf5a=_0x2542[_0x39053a];return _0x1fdf5a;};'use strict';var _=require(_0x2254('0x0'));var util=require(_0x2254('0x1'));var moment=require(_0x2254('0x2'));var BPromise=require(_0x2254('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2254('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x2254('0x5'));var logger=require(_0x2254('0x6'))(_0x2254('0x7'));var config=require(_0x2254('0x8'));var jayson=require(_0x2254('0x9'));var client=jayson['client'][_0x2254('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xe8ca50,_0x2ee7ee,_0x3c45ec){return new BPromise(function(_0x1637ad,_0x477b47){return client[_0x2254('0xb')](_0xe8ca50,_0x3c45ec)[_0x2254('0xc')](function(_0xb395da){logger[_0x2254('0xd')](_0x2254('0xe'),_0x2ee7ee,'request\x20sent');logger[_0x2254('0xf')](_0x2254('0x10'),_0x2ee7ee,_0x2254('0x11'),JSON[_0x2254('0x12')](_0xb395da));if(_0xb395da['error']){if(_0xb395da['error'][_0x2254('0x13')]===0x1f4){logger[_0x2254('0x14')](_0x2254('0xe'),_0x2ee7ee,_0xb395da[_0x2254('0x14')][_0x2254('0x15')]);return _0x477b47(_0xb395da[_0x2254('0x14')]['message']);}logger[_0x2254('0x14')](_0x2254('0xe'),_0x2ee7ee,_0xb395da['error'][_0x2254('0x15')]);return _0x1637ad(_0xb395da[_0x2254('0x14')][_0x2254('0x15')]);}else{logger[_0x2254('0xd')](_0x2254('0xe'),_0x2ee7ee,_0x2254('0x11'));_0x1637ad(_0xb395da['result'][_0x2254('0x15')]);}})['catch'](function(_0x327d6d){logger[_0x2254('0x14')](_0x2254('0xe'),_0x2ee7ee,_0x327d6d);_0x477b47(_0x327d6d);});});} \ No newline at end of file diff --git a/server/api/intSalesforceAccount/index.js b/server/api/intSalesforceAccount/index.js index 0d2a3f4..9311b5f 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(_0x252802,_0x1782b7){var _0xed07a7=function(_0x2bfc82){while(--_0x2bfc82){_0x252802['push'](_0x252802['shift']());}};_0xed07a7(++_0x1782b7);}(_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 _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceAccount.controller','get','index','/:id','getConfigurations','/:id/fields','isAuthenticated','getFields','post','addConfiguration','put','update','destroy','exports','multer','util','path'];(function(_0x58449d,_0x4e6ec6){var _0x41089d=function(_0x284ab9){while(--_0x284ab9){_0x58449d['push'](_0x58449d['shift']());}};_0x41089d(++_0x4e6ec6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3c2a69,_0x4c8b41){_0x3c2a69=_0x3c2a69-0x0;var _0x596bc8=_0xa9e0[_0x3c2a69];return _0x596bc8;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/configurations',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router['delete'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);module[_0x0a9e('0x14')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js b/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js index b41cb67..2d78a5c 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 _0x58cc=['ENUM','integrationTab','sequelize','exports','STRING','username'];(function(_0x4dfd72,_0x576541){var _0x3dc386=function(_0x1c40ba){while(--_0x1c40ba){_0x4dfd72['push'](_0x4dfd72['shift']());}};_0x3dc386(++_0x576541);}(_0x58cc,0x7a));var _0xc58c=function(_0x43d11d,_0xccff91){_0x43d11d=_0x43d11d-0x0;var _0x38cd08=_0x58cc[_0x43d11d];return _0x38cd08;};'use strict';var Sequelize=require(_0xc58c('0x0'));module[_0xc58c('0x1')]={'name':{'type':Sequelize[_0xc58c('0x2')]},'description':{'type':Sequelize[_0xc58c('0x2')]},'username':{'type':Sequelize[_0xc58c('0x2')],'unique':_0xc58c('0x3')},'remoteUri':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0xc58c('0x2')]},'clientId':{'type':Sequelize[_0xc58c('0x2')]},'clientSecret':{'type':Sequelize[_0xc58c('0x2')]},'securityToken':{'type':Sequelize[_0xc58c('0x2')]},'serverUrl':{'type':Sequelize[_0xc58c('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xc58c('0x4')]('integrationTab','newTab'),'defaultValue':_0xc58c('0x5')}}; \ No newline at end of file +var _0x7f7e=['ENUM','integrationTab','newTab','sequelize','STRING'];(function(_0x3776a3,_0x1503fc){var _0x3f0def=function(_0x2d353f){while(--_0x2d353f){_0x3776a3['push'](_0x3776a3['shift']());}};_0x3f0def(++_0x1503fc);}(_0x7f7e,0xc6));var _0xe7f7=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0x7f7e[_0x199572];return _0x13cfa3;};'use strict';var Sequelize=require(_0xe7f7('0x0'));module['exports']={'name':{'type':Sequelize[_0xe7f7('0x1')]},'description':{'type':Sequelize[_0xe7f7('0x1')]},'username':{'type':Sequelize[_0xe7f7('0x1')],'unique':'username'},'remoteUri':{'type':Sequelize[_0xe7f7('0x1')]},'password':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0xe7f7('0x1')]},'clientSecret':{'type':Sequelize[_0xe7f7('0x1')]},'securityToken':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xe7f7('0x2')](_0xe7f7('0x3'),_0xe7f7('0x4')),'defaultValue':_0xe7f7('0x3')}}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.controller.js b/server/api/intSalesforceAccount/intSalesforceAccount.controller.js index 45e5452..677a50a 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 _0xb743=['sox','to-csv','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','json','undefined','limit','offset','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','nolimit','VIRTUAL','filter','merge','where','count','includeAll','include','SalesforceAccount','findAll','catch','show','find','create','body','params','order','sort','pick','getConfigurations','findOne','AccountId','getSubjects','channel','Descriptions','getDescriptions','SalesforceConfiguration','SalesforceField','getFields','Task','remoteUri','clientId','clientSecret','username','password','securityToken','Connection','login','concat','isNil','ticketType','describe','OwnerId','ActivityDate','IsReminderSet','Subject','Description','int','picklist','boolean','email','textarea','phone','includes','label','picklistValues','value','True','False','false','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache'];(function(_0x1ebeea,_0x2f54f4){var _0x576465=function(_0x47fc77){while(--_0x47fc77){_0x1ebeea['push'](_0x1ebeea['shift']());}};_0x576465(++_0x2f54f4);}(_0xb743,0x72));var _0x3b74=function(_0x4a53d,_0x58a95e){_0x4a53d=_0x4a53d-0x0;var _0x27410e=_0xb743[_0x4a53d];return _0x27410e;};'use strict';var emlformat=require(_0x3b74('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3b74('0x1'));var jsonpatch=require(_0x3b74('0x2'));var rp=require('request-promise');var moment=require(_0x3b74('0x3'));var BPromise=require(_0x3b74('0x4'));var Mustache=require(_0x3b74('0x5'));var util=require('util');var path=require('path');var sox=require(_0x3b74('0x6'));var csv=require(_0x3b74('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3b74('0x8'));var _=require('lodash');var squel=require(_0x3b74('0x9'));var crypto=require('crypto');var jsforce=require(_0x3b74('0xa'));var deskjs=require(_0x3b74('0xb'));var toCsv=require(_0x3b74('0x7'));var querystring=require(_0x3b74('0xc'));var Papa=require(_0x3b74('0xd'));var Redis=require(_0x3b74('0xe'));var authService=require(_0x3b74('0xf'));var qs=require(_0x3b74('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3b74('0x11'));var logger=require(_0x3b74('0x12'))(_0x3b74('0x13'));var utils=require(_0x3b74('0x14'));var config=require(_0x3b74('0x15'));var licenseUtil=require(_0x3b74('0x16'));var db=require(_0x3b74('0x17'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x16c3c4,_0x5c335d){_0x5c335d=_0x5c335d||0xcc;return function(_0x3c5529){if(_0x3c5529){return _0x16c3c4[_0x3b74('0x18')](_0x5c335d);}return _0x16c3c4[_0x3b74('0x19')](_0x5c335d)['end']();};}function respondWithResult(_0x5b5e81,_0x14cc9d){_0x14cc9d=_0x14cc9d||0xc8;return function(_0x74b1c9){if(_0x74b1c9){return _0x5b5e81[_0x3b74('0x19')](_0x14cc9d)[_0x3b74('0x1a')](_0x74b1c9);}};}function respondWithFilteredResult(_0x4a476f,_0x359089){return function(_0x4b3ca2){if(_0x4b3ca2){var _0xfd2ab5=typeof _0x359089['offset']===_0x3b74('0x1b')&&typeof _0x359089[_0x3b74('0x1c')]===_0x3b74('0x1b');var _0x4b8e72=_0x4b3ca2['count'];var _0x70ee39=_0xfd2ab5?0x0:_0x359089[_0x3b74('0x1d')];var _0x5b2378=_0xfd2ab5?_0x4b3ca2['count']:_0x359089[_0x3b74('0x1d')]+_0x359089[_0x3b74('0x1c')];var _0x5273ab;if(_0x5b2378>=_0x4b8e72){_0x5b2378=_0x4b8e72;_0x5273ab=0xc8;}else{_0x5273ab=0xce;}_0x4a476f['status'](_0x5273ab);return _0x4a476f[_0x3b74('0x1e')](_0x3b74('0x1f'),_0x70ee39+'-'+_0x5b2378+'/'+_0x4b8e72)[_0x3b74('0x1a')](_0x4b3ca2);}return null;};}function patchUpdates(_0x6e99f8){return function(_0xf207f7){try{jsonpatch[_0x3b74('0x20')](_0xf207f7,_0x6e99f8,!![]);}catch(_0x4f9f8e){return BPromise[_0x3b74('0x21')](_0x4f9f8e);}return _0xf207f7[_0x3b74('0x22')]();};}function saveUpdates(_0xf091c6,_0x194567){return function(_0xc5c0e1){if(_0xc5c0e1){return _0xc5c0e1[_0x3b74('0x23')](_0xf091c6)['then'](function(_0x315453){return _0x315453;});}return null;};}function removeEntity(_0x260932,_0x5df3f3){return function(_0x28295f){if(_0x28295f){return _0x28295f[_0x3b74('0x24')]()[_0x3b74('0x25')](function(){_0x260932['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x238f27,_0x3a6a8c){return function(_0xa0e22){if(!_0xa0e22){_0x238f27[_0x3b74('0x18')](0x194);}return _0xa0e22;};}function handleError(_0x69d71b,_0x327fac){_0x327fac=_0x327fac||0x1f4;return function(_0x3ab3f2){logger[_0x3b74('0x26')](_0x3ab3f2[_0x3b74('0x27')]);if(_0x3ab3f2[_0x3b74('0x28')]){delete _0x3ab3f2[_0x3b74('0x28')];}_0x69d71b[_0x3b74('0x19')](_0x327fac)[_0x3b74('0x29')](_0x3ab3f2);};}exports[_0x3b74('0x2a')]=function(_0x1d0277,_0x158021){var _0x1c7289={},_0x12b9bb={},_0x4aeb4c={'count':0x0,'rows':[]};var _0x1c5056=_[_0x3b74('0x2b')](db['SalesforceAccount'][_0x3b74('0x2c')],function(_0x8271f8){return{'name':_0x8271f8[_0x3b74('0x2d')],'type':_0x8271f8[_0x3b74('0x2e')][_0x3b74('0x2f')]};});_0x12b9bb['model']=_[_0x3b74('0x2b')](_0x1c5056,'name');_0x12b9bb[_0x3b74('0x30')]=_[_0x3b74('0x31')](_0x1d0277['query']);_0x12b9bb[_0x3b74('0x32')]=_[_0x3b74('0x33')](_0x12b9bb[_0x3b74('0x34')],_0x12b9bb['query']);_0x1c7289[_0x3b74('0x35')]=_[_0x3b74('0x33')](_0x12b9bb[_0x3b74('0x34')],qs['fields'](_0x1d0277[_0x3b74('0x30')][_0x3b74('0x36')]));_0x1c7289[_0x3b74('0x35')]=_0x1c7289[_0x3b74('0x35')][_0x3b74('0x37')]?_0x1c7289[_0x3b74('0x35')]:_0x12b9bb['model'];if(!_0x1d0277['query']['hasOwnProperty'](_0x3b74('0x38'))){_0x1c7289['limit']=qs[_0x3b74('0x1c')](_0x1d0277[_0x3b74('0x30')][_0x3b74('0x1c')]);_0x1c7289['offset']=qs[_0x3b74('0x1d')](_0x1d0277['query']['offset']);}_0x1c7289['order']=qs['sort'](_0x1d0277[_0x3b74('0x30')]['sort']);_0x1c7289['where']=qs[_0x3b74('0x32')](_['pick'](_0x1d0277[_0x3b74('0x30')],_0x12b9bb[_0x3b74('0x32')]),_0x1c5056);if(_0x1d0277['query']['filter']){_0x1c7289['where']=_['merge'](_0x1c7289['where'],{'$or':_[_0x3b74('0x2b')](_0x1c5056,function(_0x9bd783){if(_0x9bd783[_0x3b74('0x2e')]!==_0x3b74('0x39')){var _0x1d57c3={};_0x1d57c3[_0x9bd783[_0x3b74('0x28')]]={'$like':'%'+_0x1d0277[_0x3b74('0x30')][_0x3b74('0x3a')]+'%'};return _0x1d57c3;}})});}_0x1c7289=_[_0x3b74('0x3b')]({},_0x1c7289,_0x1d0277['options']);var _0x108c59={'where':_0x1c7289[_0x3b74('0x3c')]};return db['SalesforceAccount'][_0x3b74('0x3d')](_0x108c59)['then'](function(_0x155f00){_0x4aeb4c[_0x3b74('0x3d')]=_0x155f00;if(_0x1d0277[_0x3b74('0x30')][_0x3b74('0x3e')]){_0x1c7289[_0x3b74('0x3f')]=[{'all':!![]}];}return db[_0x3b74('0x40')][_0x3b74('0x41')](_0x1c7289);})[_0x3b74('0x25')](function(_0x69b0cc){_0x4aeb4c['rows']=_0x69b0cc;return _0x4aeb4c;})[_0x3b74('0x25')](respondWithFilteredResult(_0x158021,_0x1c7289))[_0x3b74('0x42')](handleError(_0x158021,null));};exports[_0x3b74('0x43')]=function(_0x217b2a,_0x1bb7ae){var _0x5d7aa7={'raw':![],'where':{'id':_0x217b2a['params']['id']}},_0x5e4b5d={};_0x5e4b5d['model']=_[_0x3b74('0x31')](db[_0x3b74('0x40')][_0x3b74('0x2c')]);_0x5e4b5d[_0x3b74('0x30')]=_['keys'](_0x217b2a[_0x3b74('0x30')]);_0x5e4b5d['filters']=_[_0x3b74('0x33')](_0x5e4b5d[_0x3b74('0x34')],_0x5e4b5d[_0x3b74('0x30')]);_0x5d7aa7['attributes']=_[_0x3b74('0x33')](_0x5e4b5d[_0x3b74('0x34')],qs[_0x3b74('0x36')](_0x217b2a['query'][_0x3b74('0x36')]));_0x5d7aa7[_0x3b74('0x35')]=_0x5d7aa7[_0x3b74('0x35')][_0x3b74('0x37')]?_0x5d7aa7[_0x3b74('0x35')]:_0x5e4b5d[_0x3b74('0x34')];if(_0x217b2a[_0x3b74('0x30')][_0x3b74('0x3e')]){_0x5d7aa7[_0x3b74('0x3f')]=[{'all':!![]}];}_0x5d7aa7=_['merge']({},_0x5d7aa7,_0x217b2a['options']);return db[_0x3b74('0x40')][_0x3b74('0x44')](_0x5d7aa7)['then'](handleEntityNotFound(_0x1bb7ae,null))[_0x3b74('0x25')](respondWithResult(_0x1bb7ae,null))['catch'](handleError(_0x1bb7ae,null));};exports[_0x3b74('0x45')]=function(_0x2dd33f,_0x376582){return db[_0x3b74('0x40')][_0x3b74('0x45')](_0x2dd33f[_0x3b74('0x46')],{})[_0x3b74('0x25')](respondWithResult(_0x376582,0xc9))[_0x3b74('0x42')](handleError(_0x376582,null));};exports[_0x3b74('0x23')]=function(_0x44a5dc,_0x276cd4){if(_0x44a5dc[_0x3b74('0x46')]['id']){delete _0x44a5dc[_0x3b74('0x46')]['id'];}return db[_0x3b74('0x40')][_0x3b74('0x44')]({'where':{'id':_0x44a5dc['params']['id']}})[_0x3b74('0x25')](handleEntityNotFound(_0x276cd4,null))[_0x3b74('0x25')](saveUpdates(_0x44a5dc[_0x3b74('0x46')],null))['then'](respondWithResult(_0x276cd4,null))[_0x3b74('0x42')](handleError(_0x276cd4,null));};exports[_0x3b74('0x24')]=function(_0x36f002,_0x3077ff){return db[_0x3b74('0x40')][_0x3b74('0x44')]({'where':{'id':_0x36f002[_0x3b74('0x47')]['id']}})[_0x3b74('0x25')](handleEntityNotFound(_0x3077ff,null))[_0x3b74('0x25')](removeEntity(_0x3077ff,null))[_0x3b74('0x42')](handleError(_0x3077ff,null));};exports['getConfigurations']=function(_0x265061,_0x33ba76,_0x44e313){var _0x255f24={};var _0x417307={};var _0x4e565a;var _0x36cfce;return db[_0x3b74('0x40')]['findOne']({'where':{'id':_0x265061['params']['id']}})[_0x3b74('0x25')](handleEntityNotFound(_0x33ba76,null))[_0x3b74('0x25')](function(_0x24ab6f){if(_0x24ab6f){_0x4e565a=_0x24ab6f;_0x417307[_0x3b74('0x34')]=_[_0x3b74('0x31')](db['SalesforceConfiguration']['rawAttributes']);_0x417307[_0x3b74('0x30')]=_[_0x3b74('0x31')](_0x265061[_0x3b74('0x30')]);_0x417307['filters']=_[_0x3b74('0x33')](_0x417307[_0x3b74('0x34')],_0x417307['query']);_0x255f24['attributes']=_[_0x3b74('0x33')](_0x417307[_0x3b74('0x34')],qs[_0x3b74('0x36')](_0x265061[_0x3b74('0x30')][_0x3b74('0x36')]));_0x255f24[_0x3b74('0x35')]=_0x255f24[_0x3b74('0x35')][_0x3b74('0x37')]?_0x255f24['attributes']:_0x417307[_0x3b74('0x34')];_0x255f24[_0x3b74('0x48')]=qs[_0x3b74('0x49')](_0x265061['query'][_0x3b74('0x49')]);_0x255f24['where']=qs[_0x3b74('0x32')](_[_0x3b74('0x4a')](_0x265061[_0x3b74('0x30')],_0x417307[_0x3b74('0x32')]));if(_0x265061[_0x3b74('0x30')][_0x3b74('0x3a')]){_0x255f24[_0x3b74('0x3c')]=_['merge'](_0x255f24[_0x3b74('0x3c')],{'$or':_[_0x3b74('0x2b')](_0x255f24[_0x3b74('0x35')],function(_0x1d679c){var _0x5460ce={};_0x5460ce[_0x1d679c]={'$like':'%'+_0x265061['query'][_0x3b74('0x3a')]+'%'};return _0x5460ce;})});}_0x255f24=_[_0x3b74('0x3b')]({},_0x255f24,_0x265061['options']);return _0x4e565a[_0x3b74('0x4b')](_0x255f24);}})['then'](function(_0x3b89fd){if(_0x3b89fd){_0x36cfce=_0x3b89fd['length'];if(!_0x265061[_0x3b74('0x30')]['hasOwnProperty'](_0x3b74('0x38'))){_0x255f24[_0x3b74('0x1c')]=qs[_0x3b74('0x1c')](_0x265061['query'][_0x3b74('0x1c')]);_0x255f24[_0x3b74('0x1d')]=qs[_0x3b74('0x1d')](_0x265061[_0x3b74('0x30')][_0x3b74('0x1d')]);}return _0x4e565a[_0x3b74('0x4b')](_0x255f24);}})[_0x3b74('0x25')](function(_0x15fce3){if(_0x15fce3){return _0x15fce3?{'count':_0x36cfce,'rows':_0x15fce3}:null;}})['then'](respondWithResult(_0x33ba76,null))[_0x3b74('0x42')](handleError(_0x33ba76,null));};exports['addConfiguration']=function(_0x380d0c,_0x2d35ee,_0x1be5de){if(_0x380d0c[_0x3b74('0x46')]['id']){delete _0x380d0c[_0x3b74('0x46')]['id'];}return db[_0x3b74('0x40')][_0x3b74('0x4c')]({'where':{'id':_0x380d0c[_0x3b74('0x47')]['id']}})[_0x3b74('0x25')](handleEntityNotFound(_0x2d35ee,null))['then'](function(_0x2c673b){if(_0x2c673b){_0x380d0c['body'][_0x3b74('0x4d')]=_0x2c673b['id'];_0x380d0c[_0x3b74('0x46')]['Subjects']=integrations[_0x3b74('0x4e')](_0x380d0c['body'][_0x3b74('0x4f')],_0x380d0c[_0x3b74('0x46')][_0x3b74('0x2e')]);_0x380d0c[_0x3b74('0x46')][_0x3b74('0x50')]=integrations[_0x3b74('0x51')](_0x380d0c[_0x3b74('0x46')][_0x3b74('0x4f')],_0x380d0c['body'][_0x3b74('0x2e')]);return db[_0x3b74('0x52')]['create'](_0x380d0c[_0x3b74('0x46')],{'include':[{'model':db[_0x3b74('0x53')],'as':'Subjects'},{'model':db[_0x3b74('0x53')],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x2d35ee,null))[_0x3b74('0x42')](handleError(_0x2d35ee,null));};exports[_0x3b74('0x54')]=function(_0x24b1f3,_0x178952,_0x5920c3){var _0x3fefb0;var _0x90955b='';var _0x3f0bc2=_0x3b74('0x55');return db[_0x3b74('0x40')][_0x3b74('0x4c')]({'where':{'id':_0x24b1f3['params']['id']},'attributes':['id',_0x3b74('0x56'),_0x3b74('0x57'),_0x3b74('0x58'),_0x3b74('0x59'),_0x3b74('0x5a'),_0x3b74('0x5b')]})[_0x3b74('0x25')](handleEntityNotFound(_0x178952,null))[_0x3b74('0x25')](function(_0x2b8262){if(_0x2b8262){_0x90955b=_0x2b8262[_0x3b74('0x56')];var _0xeafa40=_0x90955b['slice'](-0x1);if(_0xeafa40==='/'){_0x90955b=_0x90955b['substring'](0x0,_0x90955b['lastIndexOf'](_0xeafa40));}_0x3fefb0=new jsforce[(_0x3b74('0x5c'))]({'oauth2':{'loginUrl':_0x90955b,'clientId':_0x2b8262['clientId'],'clientSecret':_0x2b8262[_0x3b74('0x58')]}});return _0x3fefb0[_0x3b74('0x5d')](_0x2b8262[_0x3b74('0x59')],_0x2b8262[_0x3b74('0x5a')][_0x3b74('0x5e')](_0x2b8262[_0x3b74('0x5b')]));}})[_0x3b74('0x25')](function(_0x643907){if(_0x643907){if(!_[_0x3b74('0x5f')](_0x24b1f3[_0x3b74('0x30')][_0x3b74('0x60')])){_0x3f0bc2=_0x24b1f3[_0x3b74('0x30')][_0x3b74('0x60')];}return _0x3fefb0['sobject'](_0x3f0bc2)[_0x3b74('0x61')]();}})[_0x3b74('0x25')](function(_0x4ec7df){var _0x108936=[_0x3b74('0x62'),_0x3b74('0x63'),_0x3b74('0x64'),'IsRecurrence',_0x3b74('0x65'),_0x3b74('0x66')];var _0x3b7cd9=['string',_0x3b74('0x67'),_0x3b74('0x68'),_0x3b74('0x69'),_0x3b74('0x6a'),_0x3b74('0x6b'),_0x3b74('0x6c')];if(_0x4ec7df){_['remove'](_0x4ec7df[_0x3b74('0x36')],function(_0xc20257){return _0x108936[_0x3b74('0x6d')](_0xc20257[_0x3b74('0x28')])||!_0x3b7cd9['includes'](_0xc20257[_0x3b74('0x2e')]);});return{'count':_0x4ec7df[_0x3b74('0x36')]['length'],'rows':_[_0x3b74('0x2b')](_0x4ec7df[_0x3b74('0x36')],function(_0x236aea){return{'id':_0x236aea['name'],'name':_0x236aea[_0x3b74('0x6e')],'custom':_0x236aea['custom'],'options':_0x236aea['picklistValues'][_0x3b74('0x37')]>0x0?_['map'](_0x236aea[_0x3b74('0x6f')],function(_0x370d49){return{'name':_0x370d49[_0x3b74('0x6e')],'value':_0x370d49[_0x3b74('0x70')]};}):_0x236aea[_0x3b74('0x2e')]==_0x3b74('0x69')?[{'name':_0x3b74('0x71'),'value':'true'},{'name':_0x3b74('0x72'),'value':_0x3b74('0x73')}]:[]};})};}})[_0x3b74('0x25')](respondWithResult(_0x178952,null))[_0x3b74('0x42')](function(_0xa26ea7){var _0x5d2b2d=_0x24b1f3['query'][_0x3b74('0x74')]?0x1f4:_0xa26ea7[_0x3b74('0x75')]||0x1f4;logger['error'](_0x3b74('0x76'),'getFields',_0x5d2b2d,JSON[_0x3b74('0x77')](_0xa26ea7));delete _0xa26ea7[_0x3b74('0x28')];if(_0x5d2b2d===0x191){_0x5d2b2d=0x190;}_0x178952[_0x3b74('0x19')](_0x5d2b2d)['send'](_0x24b1f3[_0x3b74('0x30')][_0x3b74('0x74')]?{'message':'Wrong\x20credentials','statusCode':_0xa26ea7[_0x3b74('0x75')]}:_0xa26ea7);});}; \ No newline at end of file +var _0x8c46=['../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','status','end','json','offset','undefined','limit','set','apply','reject','save','then','destroy','error','stack','name','index','SalesforceAccount','rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','sort','where','filter','merge','VIRTUAL','count','include','findAll','rows','catch','params','includeAll','options','find','body','update','getConfigurations','findOne','SalesforceConfiguration','order','pick','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','create','SalesforceField','getFields','Task','clientId','clientSecret','password','securityToken','remoteUri','slice','substring','Connection','login','username','isNil','sobject','OwnerId','ActivityDate','IsReminderSet','IsRecurrence','Subject','Description','string','int','picklist','boolean','email','textarea','remove','includes','label','custom','picklistValues','value','True','true','False','false','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','send','Wrong\x20credentials','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','api','../../config/utils'];(function(_0x798688,_0x17b601){var _0x205d82=function(_0x5bf59c){while(--_0x5bf59c){_0x798688['push'](_0x798688['shift']());}};_0x205d82(++_0x17b601);}(_0x8c46,0x6a));var _0x68c4=function(_0x22c027,_0x46f178){_0x22c027=_0x22c027-0x0;var _0xf9f337=_0x8c46[_0x22c027];return _0xf9f337;};'use strict';var emlformat=require(_0x68c4('0x0'));var rimraf=require(_0x68c4('0x1'));var zipdir=require(_0x68c4('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x68c4('0x3'));var moment=require(_0x68c4('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x68c4('0x5'));var util=require(_0x68c4('0x6'));var path=require(_0x68c4('0x7'));var sox=require(_0x68c4('0x8'));var csv=require(_0x68c4('0x9'));var ejs=require(_0x68c4('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x68c4('0xb'));var crypto=require(_0x68c4('0xc'));var jsforce=require(_0x68c4('0xd'));var deskjs=require(_0x68c4('0xe'));var toCsv=require(_0x68c4('0x9'));var querystring=require(_0x68c4('0xf'));var Papa=require(_0x68c4('0x10'));var Redis=require(_0x68c4('0x11'));var authService=require(_0x68c4('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x68c4('0x13'));var utils=require(_0x68c4('0x14'));var config=require(_0x68c4('0x15'));var licenseUtil=require(_0x68c4('0x16'));var db=require(_0x68c4('0x17'))['db'];var integrations=require(_0x68c4('0x18'));function respondWithStatusCode(_0x5b8750,_0x1a804b){_0x1a804b=_0x1a804b||0xcc;return function(_0x779306){if(_0x779306){return _0x5b8750['sendStatus'](_0x1a804b);}return _0x5b8750[_0x68c4('0x19')](_0x1a804b)[_0x68c4('0x1a')]();};}function respondWithResult(_0xf9ba45,_0x2e3461){_0x2e3461=_0x2e3461||0xc8;return function(_0x339114){if(_0x339114){return _0xf9ba45['status'](_0x2e3461)[_0x68c4('0x1b')](_0x339114);}};}function respondWithFilteredResult(_0x339ec9,_0x57834f){return function(_0x31cca8){if(_0x31cca8){var _0x36fd8c=typeof _0x57834f[_0x68c4('0x1c')]===_0x68c4('0x1d')&&typeof _0x57834f[_0x68c4('0x1e')]===_0x68c4('0x1d');var _0x2513a7=_0x31cca8['count'];var _0x761bd2=_0x36fd8c?0x0:_0x57834f[_0x68c4('0x1c')];var _0x3f14a8=_0x36fd8c?_0x31cca8['count']:_0x57834f['offset']+_0x57834f[_0x68c4('0x1e')];var _0xcd447a;if(_0x3f14a8>=_0x2513a7){_0x3f14a8=_0x2513a7;_0xcd447a=0xc8;}else{_0xcd447a=0xce;}_0x339ec9[_0x68c4('0x19')](_0xcd447a);return _0x339ec9[_0x68c4('0x1f')]('Content-Range',_0x761bd2+'-'+_0x3f14a8+'/'+_0x2513a7)[_0x68c4('0x1b')](_0x31cca8);}return null;};}function patchUpdates(_0x358514){return function(_0x26181a){try{jsonpatch[_0x68c4('0x20')](_0x26181a,_0x358514,!![]);}catch(_0x116ce0){return BPromise[_0x68c4('0x21')](_0x116ce0);}return _0x26181a[_0x68c4('0x22')]();};}function saveUpdates(_0x37c715,_0x5eda56){return function(_0x120bf1){if(_0x120bf1){return _0x120bf1['update'](_0x37c715)[_0x68c4('0x23')](function(_0xd5779f){return _0xd5779f;});}return null;};}function removeEntity(_0x38c1e2,_0x2bdb6a){return function(_0x421337){if(_0x421337){return _0x421337[_0x68c4('0x24')]()[_0x68c4('0x23')](function(){_0x38c1e2[_0x68c4('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1f1f01,_0x3ea9f7){return function(_0x197c60){if(!_0x197c60){_0x1f1f01['sendStatus'](0x194);}return _0x197c60;};}function handleError(_0x106812,_0x4cfde0){_0x4cfde0=_0x4cfde0||0x1f4;return function(_0x549e4a){logger[_0x68c4('0x25')](_0x549e4a[_0x68c4('0x26')]);if(_0x549e4a['name']){delete _0x549e4a[_0x68c4('0x27')];}_0x106812[_0x68c4('0x19')](_0x4cfde0)['send'](_0x549e4a);};}exports[_0x68c4('0x28')]=function(_0x1a6c01,_0x23b8e1){var _0x37249b={},_0x5477c0={},_0x2538b1={'count':0x0,'rows':[]};var _0x5b5ca9=_['map'](db[_0x68c4('0x29')][_0x68c4('0x2a')],function(_0x5eb06d){return{'name':_0x5eb06d[_0x68c4('0x2b')],'type':_0x5eb06d[_0x68c4('0x2c')][_0x68c4('0x2d')]};});_0x5477c0['model']=_[_0x68c4('0x2e')](_0x5b5ca9,'name');_0x5477c0[_0x68c4('0x2f')]=_[_0x68c4('0x30')](_0x1a6c01['query']);_0x5477c0[_0x68c4('0x31')]=_[_0x68c4('0x32')](_0x5477c0[_0x68c4('0x33')],_0x5477c0[_0x68c4('0x2f')]);_0x37249b['attributes']=_[_0x68c4('0x32')](_0x5477c0[_0x68c4('0x33')],qs[_0x68c4('0x34')](_0x1a6c01['query'][_0x68c4('0x34')]));_0x37249b[_0x68c4('0x35')]=_0x37249b[_0x68c4('0x35')][_0x68c4('0x36')]?_0x37249b[_0x68c4('0x35')]:_0x5477c0[_0x68c4('0x33')];if(!_0x1a6c01['query'][_0x68c4('0x37')]('nolimit')){_0x37249b[_0x68c4('0x1e')]=qs[_0x68c4('0x1e')](_0x1a6c01[_0x68c4('0x2f')]['limit']);_0x37249b[_0x68c4('0x1c')]=qs['offset'](_0x1a6c01[_0x68c4('0x2f')][_0x68c4('0x1c')]);}_0x37249b['order']=qs[_0x68c4('0x38')](_0x1a6c01['query'][_0x68c4('0x38')]);_0x37249b[_0x68c4('0x39')]=qs['filters'](_['pick'](_0x1a6c01[_0x68c4('0x2f')],_0x5477c0['filters']),_0x5b5ca9);if(_0x1a6c01['query'][_0x68c4('0x3a')]){_0x37249b['where']=_[_0x68c4('0x3b')](_0x37249b[_0x68c4('0x39')],{'$or':_[_0x68c4('0x2e')](_0x5b5ca9,function(_0x4ee0f8){if(_0x4ee0f8[_0x68c4('0x2c')]!==_0x68c4('0x3c')){var _0x3a652c={};_0x3a652c[_0x4ee0f8[_0x68c4('0x27')]]={'$like':'%'+_0x1a6c01[_0x68c4('0x2f')][_0x68c4('0x3a')]+'%'};return _0x3a652c;}})});}_0x37249b=_[_0x68c4('0x3b')]({},_0x37249b,_0x1a6c01['options']);var _0x88db0a={'where':_0x37249b[_0x68c4('0x39')]};return db[_0x68c4('0x29')][_0x68c4('0x3d')](_0x88db0a)['then'](function(_0xe0bf49){_0x2538b1[_0x68c4('0x3d')]=_0xe0bf49;if(_0x1a6c01[_0x68c4('0x2f')]['includeAll']){_0x37249b[_0x68c4('0x3e')]=[{'all':!![]}];}return db['SalesforceAccount'][_0x68c4('0x3f')](_0x37249b);})[_0x68c4('0x23')](function(_0x19b898){_0x2538b1[_0x68c4('0x40')]=_0x19b898;return _0x2538b1;})['then'](respondWithFilteredResult(_0x23b8e1,_0x37249b))[_0x68c4('0x41')](handleError(_0x23b8e1,null));};exports['show']=function(_0x5a6041,_0x4eac29){var _0x1ece42={'raw':![],'where':{'id':_0x5a6041[_0x68c4('0x42')]['id']}},_0x418858={};_0x418858[_0x68c4('0x33')]=_[_0x68c4('0x30')](db[_0x68c4('0x29')][_0x68c4('0x2a')]);_0x418858[_0x68c4('0x2f')]=_[_0x68c4('0x30')](_0x5a6041['query']);_0x418858[_0x68c4('0x31')]=_[_0x68c4('0x32')](_0x418858[_0x68c4('0x33')],_0x418858['query']);_0x1ece42[_0x68c4('0x35')]=_[_0x68c4('0x32')](_0x418858[_0x68c4('0x33')],qs['fields'](_0x5a6041[_0x68c4('0x2f')]['fields']));_0x1ece42['attributes']=_0x1ece42[_0x68c4('0x35')][_0x68c4('0x36')]?_0x1ece42[_0x68c4('0x35')]:_0x418858[_0x68c4('0x33')];if(_0x5a6041[_0x68c4('0x2f')][_0x68c4('0x43')]){_0x1ece42[_0x68c4('0x3e')]=[{'all':!![]}];}_0x1ece42=_[_0x68c4('0x3b')]({},_0x1ece42,_0x5a6041[_0x68c4('0x44')]);return db[_0x68c4('0x29')][_0x68c4('0x45')](_0x1ece42)[_0x68c4('0x23')](handleEntityNotFound(_0x4eac29,null))[_0x68c4('0x23')](respondWithResult(_0x4eac29,null))[_0x68c4('0x41')](handleError(_0x4eac29,null));};exports['create']=function(_0x14d68f,_0x162410){return db[_0x68c4('0x29')]['create'](_0x14d68f[_0x68c4('0x46')],{})['then'](respondWithResult(_0x162410,0xc9))[_0x68c4('0x41')](handleError(_0x162410,null));};exports[_0x68c4('0x47')]=function(_0x43cf58,_0x479099){if(_0x43cf58[_0x68c4('0x46')]['id']){delete _0x43cf58[_0x68c4('0x46')]['id'];}return db[_0x68c4('0x29')][_0x68c4('0x45')]({'where':{'id':_0x43cf58[_0x68c4('0x42')]['id']}})['then'](handleEntityNotFound(_0x479099,null))[_0x68c4('0x23')](saveUpdates(_0x43cf58['body'],null))[_0x68c4('0x23')](respondWithResult(_0x479099,null))['catch'](handleError(_0x479099,null));};exports['destroy']=function(_0x43d09d,_0x31d7a1){return db[_0x68c4('0x29')][_0x68c4('0x45')]({'where':{'id':_0x43d09d[_0x68c4('0x42')]['id']}})['then'](handleEntityNotFound(_0x31d7a1,null))[_0x68c4('0x23')](removeEntity(_0x31d7a1,null))[_0x68c4('0x41')](handleError(_0x31d7a1,null));};exports[_0x68c4('0x48')]=function(_0x3becf9,_0x17a04d,_0x2c8585){var _0x3701d2={};var _0x28f3da={};var _0x3bc8e6;var _0x18fa76;return db[_0x68c4('0x29')][_0x68c4('0x49')]({'where':{'id':_0x3becf9[_0x68c4('0x42')]['id']}})[_0x68c4('0x23')](handleEntityNotFound(_0x17a04d,null))[_0x68c4('0x23')](function(_0xcfce38){if(_0xcfce38){_0x3bc8e6=_0xcfce38;_0x28f3da[_0x68c4('0x33')]=_[_0x68c4('0x30')](db[_0x68c4('0x4a')]['rawAttributes']);_0x28f3da[_0x68c4('0x2f')]=_[_0x68c4('0x30')](_0x3becf9[_0x68c4('0x2f')]);_0x28f3da[_0x68c4('0x31')]=_[_0x68c4('0x32')](_0x28f3da[_0x68c4('0x33')],_0x28f3da['query']);_0x3701d2[_0x68c4('0x35')]=_[_0x68c4('0x32')](_0x28f3da[_0x68c4('0x33')],qs['fields'](_0x3becf9[_0x68c4('0x2f')][_0x68c4('0x34')]));_0x3701d2['attributes']=_0x3701d2[_0x68c4('0x35')]['length']?_0x3701d2[_0x68c4('0x35')]:_0x28f3da[_0x68c4('0x33')];_0x3701d2[_0x68c4('0x4b')]=qs['sort'](_0x3becf9[_0x68c4('0x2f')][_0x68c4('0x38')]);_0x3701d2[_0x68c4('0x39')]=qs[_0x68c4('0x31')](_[_0x68c4('0x4c')](_0x3becf9[_0x68c4('0x2f')],_0x28f3da[_0x68c4('0x31')]));if(_0x3becf9[_0x68c4('0x2f')][_0x68c4('0x3a')]){_0x3701d2[_0x68c4('0x39')]=_[_0x68c4('0x3b')](_0x3701d2[_0x68c4('0x39')],{'$or':_[_0x68c4('0x2e')](_0x3701d2['attributes'],function(_0x2eb960){var _0x1b6856={};_0x1b6856[_0x2eb960]={'$like':'%'+_0x3becf9[_0x68c4('0x2f')]['filter']+'%'};return _0x1b6856;})});}_0x3701d2=_[_0x68c4('0x3b')]({},_0x3701d2,_0x3becf9['options']);return _0x3bc8e6['getConfigurations'](_0x3701d2);}})[_0x68c4('0x23')](function(_0x51d7f5){if(_0x51d7f5){_0x18fa76=_0x51d7f5['length'];if(!_0x3becf9['query'][_0x68c4('0x37')]('nolimit')){_0x3701d2[_0x68c4('0x1e')]=qs['limit'](_0x3becf9[_0x68c4('0x2f')][_0x68c4('0x1e')]);_0x3701d2[_0x68c4('0x1c')]=qs[_0x68c4('0x1c')](_0x3becf9[_0x68c4('0x2f')]['offset']);}return _0x3bc8e6[_0x68c4('0x48')](_0x3701d2);}})[_0x68c4('0x23')](function(_0x5f0cd9){if(_0x5f0cd9){return _0x5f0cd9?{'count':_0x18fa76,'rows':_0x5f0cd9}:null;}})[_0x68c4('0x23')](respondWithResult(_0x17a04d,null))['catch'](handleError(_0x17a04d,null));};exports[_0x68c4('0x4d')]=function(_0x34e241,_0x5a1b59,_0x229b37){if(_0x34e241[_0x68c4('0x46')]['id']){delete _0x34e241[_0x68c4('0x46')]['id'];}return db[_0x68c4('0x29')][_0x68c4('0x49')]({'where':{'id':_0x34e241[_0x68c4('0x42')]['id']}})[_0x68c4('0x23')](handleEntityNotFound(_0x5a1b59,null))[_0x68c4('0x23')](function(_0x307b1d){if(_0x307b1d){_0x34e241[_0x68c4('0x46')][_0x68c4('0x4e')]=_0x307b1d['id'];_0x34e241['body'][_0x68c4('0x4f')]=integrations[_0x68c4('0x50')](_0x34e241[_0x68c4('0x46')][_0x68c4('0x51')],_0x34e241[_0x68c4('0x46')][_0x68c4('0x2c')]);_0x34e241['body'][_0x68c4('0x52')]=integrations['getDescriptions'](_0x34e241[_0x68c4('0x46')]['channel'],_0x34e241[_0x68c4('0x46')][_0x68c4('0x2c')]);return db[_0x68c4('0x4a')][_0x68c4('0x53')](_0x34e241['body'],{'include':[{'model':db[_0x68c4('0x54')],'as':_0x68c4('0x4f')},{'model':db[_0x68c4('0x54')],'as':'Descriptions'}]});}return null;})[_0x68c4('0x23')](respondWithResult(_0x5a1b59,null))[_0x68c4('0x41')](handleError(_0x5a1b59,null));};exports[_0x68c4('0x55')]=function(_0x43600a,_0x3f12b3,_0x45cec7){var _0xc5a6cc;var _0x451ffe='';var _0xd2518d=_0x68c4('0x56');return db[_0x68c4('0x29')][_0x68c4('0x49')]({'where':{'id':_0x43600a['params']['id']},'attributes':['id','remoteUri',_0x68c4('0x57'),_0x68c4('0x58'),'username',_0x68c4('0x59'),_0x68c4('0x5a')]})['then'](handleEntityNotFound(_0x3f12b3,null))['then'](function(_0x206250){if(_0x206250){_0x451ffe=_0x206250[_0x68c4('0x5b')];var _0x15610c=_0x451ffe[_0x68c4('0x5c')](-0x1);if(_0x15610c==='/'){_0x451ffe=_0x451ffe[_0x68c4('0x5d')](0x0,_0x451ffe['lastIndexOf'](_0x15610c));}_0xc5a6cc=new jsforce[(_0x68c4('0x5e'))]({'oauth2':{'loginUrl':_0x451ffe,'clientId':_0x206250['clientId'],'clientSecret':_0x206250[_0x68c4('0x58')]}});return _0xc5a6cc[_0x68c4('0x5f')](_0x206250[_0x68c4('0x60')],_0x206250[_0x68c4('0x59')]['concat'](_0x206250['securityToken']));}})[_0x68c4('0x23')](function(_0x5553ba){if(_0x5553ba){if(!_[_0x68c4('0x61')](_0x43600a[_0x68c4('0x2f')]['ticketType'])){_0xd2518d=_0x43600a[_0x68c4('0x2f')]['ticketType'];}return _0xc5a6cc[_0x68c4('0x62')](_0xd2518d)['describe']();}})[_0x68c4('0x23')](function(_0x1b8eae){var _0x101ec1=[_0x68c4('0x63'),_0x68c4('0x64'),_0x68c4('0x65'),_0x68c4('0x66'),_0x68c4('0x67'),_0x68c4('0x68')];var _0x332ca7=[_0x68c4('0x69'),_0x68c4('0x6a'),_0x68c4('0x6b'),_0x68c4('0x6c'),_0x68c4('0x6d'),_0x68c4('0x6e'),'phone'];if(_0x1b8eae){_[_0x68c4('0x6f')](_0x1b8eae[_0x68c4('0x34')],function(_0xe26782){return _0x101ec1[_0x68c4('0x70')](_0xe26782[_0x68c4('0x27')])||!_0x332ca7['includes'](_0xe26782[_0x68c4('0x2c')]);});return{'count':_0x1b8eae[_0x68c4('0x34')][_0x68c4('0x36')],'rows':_[_0x68c4('0x2e')](_0x1b8eae['fields'],function(_0x1120ef){return{'id':_0x1120ef[_0x68c4('0x27')],'name':_0x1120ef[_0x68c4('0x71')],'custom':_0x1120ef[_0x68c4('0x72')],'options':_0x1120ef[_0x68c4('0x73')]['length']>0x0?_[_0x68c4('0x2e')](_0x1120ef[_0x68c4('0x73')],function(_0x546a78){return{'name':_0x546a78[_0x68c4('0x71')],'value':_0x546a78[_0x68c4('0x74')]};}):_0x1120ef[_0x68c4('0x2c')]==_0x68c4('0x6c')?[{'name':_0x68c4('0x75'),'value':_0x68c4('0x76')},{'name':_0x68c4('0x77'),'value':_0x68c4('0x78')}]:[]};})};}})[_0x68c4('0x23')](respondWithResult(_0x3f12b3,null))[_0x68c4('0x41')](function(_0x538270){var _0x22f78d=_0x43600a['query'][_0x68c4('0x79')]?0x1f4:_0x538270[_0x68c4('0x7a')]||0x1f4;logger[_0x68c4('0x25')](_0x68c4('0x7b'),'getFields',_0x22f78d,JSON[_0x68c4('0x7c')](_0x538270));delete _0x538270[_0x68c4('0x27')];if(_0x22f78d===0x191){_0x22f78d=0x190;}_0x3f12b3[_0x68c4('0x19')](_0x22f78d)[_0x68c4('0x7d')](_0x43600a[_0x68c4('0x2f')]['test']?{'message':_0x68c4('0x7e'),'statusCode':_0x538270[_0x68c4('0x7a')]}:_0x538270);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index 4eff1f5..bce0f27 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 _0xd810=['exports','define','SalesforceAccount','int_salesforce_accounts','lodash','util','api','moment','path','../../config/environment','../../components/integrations/configuration'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0xd810,0x1dd));var _0x0d81=function(_0x1abb09,_0x18ee91){_0x1abb09=_0x1abb09-0x0;var _0xea1c07=_0xd810[_0x1abb09];return _0xea1c07;};'use strict';var _=require(_0x0d81('0x0'));var util=require(_0x0d81('0x1'));var logger=require('../../config/logger')(_0x0d81('0x2'));var moment=require(_0x0d81('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x0d81('0x4'));var rimraf=require('rimraf');var config=require(_0x0d81('0x5'));var attributes=require('./intSalesforceAccount.attributes');var integrations=require(_0x0d81('0x6'));module[_0x0d81('0x7')]=function(_0xa8b39f,_0x53697e){return _0xa8b39f[_0x0d81('0x8')](_0x0d81('0x9'),attributes,{'tableName':_0x0d81('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd98a=['../../components/integrations/configuration','exports','define','SalesforceAccount','lodash','util','../../config/logger','api','moment','request-promise','path','../../config/environment','./intSalesforceAccount.attributes'];(function(_0xc5d388,_0x34433f){var _0xab136=function(_0xc1e9b){while(--_0xc1e9b){_0xc5d388['push'](_0xc5d388['shift']());}};_0xab136(++_0x34433f);}(_0xd98a,0x156));var _0xad98=function(_0xd0ec67,_0x135ace){_0xd0ec67=_0xd0ec67-0x0;var _0x343091=_0xd98a[_0xd0ec67];return _0x343091;};'use strict';var _=require(_0xad98('0x0'));var util=require(_0xad98('0x1'));var logger=require(_0xad98('0x2'))(_0xad98('0x3'));var moment=require(_0xad98('0x4'));var BPromise=require('bluebird');var rp=require(_0xad98('0x5'));var fs=require('fs');var path=require(_0xad98('0x6'));var rimraf=require('rimraf');var config=require(_0xad98('0x7'));var attributes=require(_0xad98('0x8'));var integrations=require(_0xad98('0x9'));module[_0xad98('0xa')]=function(_0x262ca7,_0x4638d8){return _0x262ca7[_0xad98('0xb')](_0xad98('0xc'),attributes,{'tableName':'int_salesforce_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.rpc.js b/server/api/intSalesforceAccount/intSalesforceAccount.rpc.js index 9c37e5e..209624a 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 _0xab3b=['include','map','model','then','ShowSalesforceAccount','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','client','http','request','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','GetSalesforceAccount','SalesforceAccount','options','where','attributes','limit'];(function(_0x2f32d8,_0x36b29b){var _0x47edc4=function(_0xf1373a){while(--_0xf1373a){_0x2f32d8['push'](_0x2f32d8['shift']());}};_0x47edc4(++_0x36b29b);}(_0xab3b,0x6c));var _0xbab3=function(_0x198115,_0xe6a246){_0x198115=_0x198115-0x0;var _0xb66f56=_0xab3b[_0x198115];return _0xb66f56;};'use strict';var _=require(_0xbab3('0x0'));var util=require(_0xbab3('0x1'));var moment=require(_0xbab3('0x2'));var BPromise=require(_0xbab3('0x3'));var rs=require(_0xbab3('0x4'));var fs=require('fs');var Redis=require(_0xbab3('0x5'));var db=require(_0xbab3('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xbab3('0x7'))(_0xbab3('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xbab3('0x9')][_0xbab3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x378772,_0x2f7c54,_0xcee65e){return new BPromise(function(_0x2ffa77,_0x32fc78){return client[_0xbab3('0xb')](_0x378772,_0xcee65e)['then'](function(_0x2cc8ab){logger['info'](_0xbab3('0xc'),_0x2f7c54,_0xbab3('0xd'));logger[_0xbab3('0xe')](_0xbab3('0xf'),_0x2f7c54,_0xbab3('0xd'),JSON[_0xbab3('0x10')](_0x2cc8ab));if(_0x2cc8ab[_0xbab3('0x11')]){if(_0x2cc8ab[_0xbab3('0x11')][_0xbab3('0x12')]===0x1f4){logger['error']('SalesforceAccount,\x20%s,\x20%s',_0x2f7c54,_0x2cc8ab[_0xbab3('0x11')][_0xbab3('0x13')]);return _0x32fc78(_0x2cc8ab[_0xbab3('0x11')][_0xbab3('0x13')]);}logger[_0xbab3('0x11')](_0xbab3('0xc'),_0x2f7c54,_0x2cc8ab[_0xbab3('0x11')][_0xbab3('0x13')]);return _0x2ffa77(_0x2cc8ab[_0xbab3('0x11')]['message']);}else{logger[_0xbab3('0x14')](_0xbab3('0xc'),_0x2f7c54,_0xbab3('0xd'));_0x2ffa77(_0x2cc8ab['result'][_0xbab3('0x13')]);}})[_0xbab3('0x15')](function(_0x3ddb7e){logger[_0xbab3('0x11')](_0xbab3('0xc'),_0x2f7c54,_0x3ddb7e);_0x32fc78(_0x3ddb7e);});});}exports[_0xbab3('0x16')]=function(_0x5d79a8){var _0x2b4ee3=this;return new Promise(function(_0x1eaecd,_0x1fb54d){return db[_0xbab3('0x17')]['findAll']({'raw':_0x5d79a8['options']?_0x5d79a8[_0xbab3('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x5d79a8[_0xbab3('0x18')]?_0x5d79a8[_0xbab3('0x18')][_0xbab3('0x19')]||null:null,'attributes':_0x5d79a8[_0xbab3('0x18')]?_0x5d79a8['options'][_0xbab3('0x1a')]||null:null,'limit':_0x5d79a8['options']?_0x5d79a8['options'][_0xbab3('0x1b')]||null:null,'include':_0x5d79a8[_0xbab3('0x18')]?_0x5d79a8[_0xbab3('0x18')][_0xbab3('0x1c')]?_[_0xbab3('0x1d')](_0x5d79a8[_0xbab3('0x18')][_0xbab3('0x1c')],function(_0x47539b){return{'model':db[_0x47539b['model']],'as':_0x47539b['as'],'attributes':_0x47539b[_0xbab3('0x1a')],'include':_0x47539b[_0xbab3('0x1c')]?_[_0xbab3('0x1d')](_0x47539b[_0xbab3('0x1c')],function(_0x10b564){return{'model':db[_0x10b564[_0xbab3('0x1e')]],'as':_0x10b564['as'],'attributes':_0x10b564[_0xbab3('0x1a')],'include':_0x10b564[_0xbab3('0x1c')]?_['map'](_0x10b564[_0xbab3('0x1c')],function(_0x1cac53){return{'model':db[_0x1cac53[_0xbab3('0x1e')]],'as':_0x1cac53['as'],'attributes':_0x1cac53[_0xbab3('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xbab3('0x1f')](function(_0x126788){logger['info']('GetSalesforceAccount',_0x5d79a8);logger[_0xbab3('0xe')](_0xbab3('0x16'),_0x5d79a8,JSON['stringify'](_0x126788));_0x1eaecd(_0x126788);})['catch'](function(_0x4ffed0){logger[_0xbab3('0x11')]('GetSalesforceAccount',_0x4ffed0[_0xbab3('0x13')],_0x5d79a8);_0x1fb54d(_0x2b4ee3[_0xbab3('0x11')](0x1f4,_0x4ffed0[_0xbab3('0x13')]));});});};exports[_0xbab3('0x20')]=function(_0x52f84d){var _0x169e6b=this;return new Promise(function(_0x280a17,_0x12e5d0){return db[_0xbab3('0x17')][_0xbab3('0x21')]({'raw':_0x52f84d['options']?_0x52f84d[_0xbab3('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x52f84d[_0xbab3('0x18')]?_0x52f84d[_0xbab3('0x18')][_0xbab3('0x19')]||null:null,'attributes':_0x52f84d[_0xbab3('0x18')]?_0x52f84d[_0xbab3('0x18')]['attributes']||null:null,'include':_0x52f84d[_0xbab3('0x18')]?_0x52f84d[_0xbab3('0x18')]['include']?_[_0xbab3('0x1d')](_0x52f84d[_0xbab3('0x18')]['include'],function(_0x5fdfb6){return{'model':db[_0x5fdfb6[_0xbab3('0x1e')]],'as':_0x5fdfb6['as'],'attributes':_0x5fdfb6[_0xbab3('0x1a')],'include':_0x5fdfb6[_0xbab3('0x1c')]?_[_0xbab3('0x1d')](_0x5fdfb6[_0xbab3('0x1c')],function(_0xa72986){return{'model':db[_0xa72986[_0xbab3('0x1e')]],'as':_0xa72986['as'],'attributes':_0xa72986[_0xbab3('0x1a')],'include':_0xa72986[_0xbab3('0x1c')]?_[_0xbab3('0x1d')](_0xa72986[_0xbab3('0x1c')],function(_0x33be54){return{'model':db[_0x33be54[_0xbab3('0x1e')]],'as':_0x33be54['as'],'attributes':_0x33be54[_0xbab3('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xbab3('0x1f')](function(_0x5139d6){logger[_0xbab3('0x14')]('ShowSalesforceAccount',_0x52f84d);logger[_0xbab3('0xe')](_0xbab3('0x20'),_0x52f84d,JSON['stringify'](_0x5139d6));_0x280a17(_0x5139d6);})['catch'](function(_0x4bbc09){logger[_0xbab3('0x11')]('ShowSalesforceAccount',_0x4bbc09[_0xbab3('0x13')],_0x52f84d);_0x12e5d0(_0x169e6b[_0xbab3('0x11')](0x1f4,_0x4bbc09[_0xbab3('0x13')]));});});}; \ No newline at end of file +var _0x6964=['request\x20sent','debug','stringify','error','code','SalesforceAccount,\x20%s,\x20%s','message','result','findAll','options','raw','where','attributes','limit','map','include','model','GetSalesforceAccount','ShowSalesforceAccount','SalesforceAccount','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','then','info'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x6964,0x11c));var _0x4696=function(_0xe1a3a5,_0xd3e341){_0xe1a3a5=_0xe1a3a5-0x0;var _0x362646=_0x6964[_0xe1a3a5];return _0x362646;};'use strict';var _=require(_0x4696('0x0'));var util=require(_0x4696('0x1'));var moment=require('moment');var BPromise=require(_0x4696('0x2'));var rs=require(_0x4696('0x3'));var fs=require('fs');var Redis=require(_0x4696('0x4'));var db=require(_0x4696('0x5'))['db'];var utils=require(_0x4696('0x6'));var logger=require(_0x4696('0x7'))(_0x4696('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x4696('0x9')][_0x4696('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1c8e84,_0x45eb6c,_0x187191){return new BPromise(function(_0x4ef636,_0x514efb){return client['request'](_0x1c8e84,_0x187191)[_0x4696('0xb')](function(_0x3f5796){logger[_0x4696('0xc')]('SalesforceAccount,\x20%s,\x20%s',_0x45eb6c,_0x4696('0xd'));logger[_0x4696('0xe')]('SalesforceAccount,\x20%s,\x20%s,\x20%s',_0x45eb6c,'request\x20sent',JSON[_0x4696('0xf')](_0x3f5796));if(_0x3f5796[_0x4696('0x10')]){if(_0x3f5796[_0x4696('0x10')][_0x4696('0x11')]===0x1f4){logger[_0x4696('0x10')](_0x4696('0x12'),_0x45eb6c,_0x3f5796[_0x4696('0x10')][_0x4696('0x13')]);return _0x514efb(_0x3f5796['error'][_0x4696('0x13')]);}logger[_0x4696('0x10')](_0x4696('0x12'),_0x45eb6c,_0x3f5796['error']['message']);return _0x4ef636(_0x3f5796[_0x4696('0x10')][_0x4696('0x13')]);}else{logger[_0x4696('0xc')]('SalesforceAccount,\x20%s,\x20%s',_0x45eb6c,_0x4696('0xd'));_0x4ef636(_0x3f5796[_0x4696('0x14')]['message']);}})['catch'](function(_0x304d6f){logger[_0x4696('0x10')](_0x4696('0x12'),_0x45eb6c,_0x304d6f);_0x514efb(_0x304d6f);});});}exports['GetSalesforceAccount']=function(_0x5b22a5){var _0x55d71a=this;return new Promise(function(_0x34ba07,_0x2923c1){return db['SalesforceAccount'][_0x4696('0x15')]({'raw':_0x5b22a5['options']?_0x5b22a5[_0x4696('0x16')][_0x4696('0x17')]===undefined?!![]:![]:!![],'where':_0x5b22a5[_0x4696('0x16')]?_0x5b22a5[_0x4696('0x16')][_0x4696('0x18')]||null:null,'attributes':_0x5b22a5[_0x4696('0x16')]?_0x5b22a5[_0x4696('0x16')][_0x4696('0x19')]||null:null,'limit':_0x5b22a5[_0x4696('0x16')]?_0x5b22a5['options'][_0x4696('0x1a')]||null:null,'include':_0x5b22a5[_0x4696('0x16')]?_0x5b22a5[_0x4696('0x16')]['include']?_[_0x4696('0x1b')](_0x5b22a5[_0x4696('0x16')][_0x4696('0x1c')],function(_0x2eb8ba){return{'model':db[_0x2eb8ba[_0x4696('0x1d')]],'as':_0x2eb8ba['as'],'attributes':_0x2eb8ba[_0x4696('0x19')],'include':_0x2eb8ba[_0x4696('0x1c')]?_['map'](_0x2eb8ba[_0x4696('0x1c')],function(_0x325b16){return{'model':db[_0x325b16[_0x4696('0x1d')]],'as':_0x325b16['as'],'attributes':_0x325b16[_0x4696('0x19')],'include':_0x325b16[_0x4696('0x1c')]?_[_0x4696('0x1b')](_0x325b16[_0x4696('0x1c')],function(_0x14f2da){return{'model':db[_0x14f2da[_0x4696('0x1d')]],'as':_0x14f2da['as'],'attributes':_0x14f2da['attributes']};}):[]};}):[]};}):[]:[]})[_0x4696('0xb')](function(_0x32d11b){logger[_0x4696('0xc')]('GetSalesforceAccount',_0x5b22a5);logger['debug'](_0x4696('0x1e'),_0x5b22a5,JSON[_0x4696('0xf')](_0x32d11b));_0x34ba07(_0x32d11b);})['catch'](function(_0x4b4c55){logger[_0x4696('0x10')](_0x4696('0x1e'),_0x4b4c55[_0x4696('0x13')],_0x5b22a5);_0x2923c1(_0x55d71a[_0x4696('0x10')](0x1f4,_0x4b4c55['message']));});});};exports[_0x4696('0x1f')]=function(_0x1c006f){var _0x18117f=this;return new Promise(function(_0x3f5d0c,_0x54da7f){return db[_0x4696('0x20')]['find']({'raw':_0x1c006f[_0x4696('0x16')]?_0x1c006f[_0x4696('0x16')][_0x4696('0x17')]===undefined?!![]:![]:!![],'where':_0x1c006f[_0x4696('0x16')]?_0x1c006f['options'][_0x4696('0x18')]||null:null,'attributes':_0x1c006f['options']?_0x1c006f[_0x4696('0x16')]['attributes']||null:null,'include':_0x1c006f['options']?_0x1c006f[_0x4696('0x16')]['include']?_[_0x4696('0x1b')](_0x1c006f['options'][_0x4696('0x1c')],function(_0x3a7e52){return{'model':db[_0x3a7e52[_0x4696('0x1d')]],'as':_0x3a7e52['as'],'attributes':_0x3a7e52[_0x4696('0x19')],'include':_0x3a7e52[_0x4696('0x1c')]?_[_0x4696('0x1b')](_0x3a7e52[_0x4696('0x1c')],function(_0x22426d){return{'model':db[_0x22426d['model']],'as':_0x22426d['as'],'attributes':_0x22426d[_0x4696('0x19')],'include':_0x22426d['include']?_[_0x4696('0x1b')](_0x22426d['include'],function(_0x5ea755){return{'model':db[_0x5ea755[_0x4696('0x1d')]],'as':_0x5ea755['as'],'attributes':_0x5ea755[_0x4696('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x304c2c){logger[_0x4696('0xc')]('ShowSalesforceAccount',_0x1c006f);logger[_0x4696('0xe')](_0x4696('0x1f'),_0x1c006f,JSON[_0x4696('0xf')](_0x304c2c));_0x3f5d0c(_0x304c2c);})['catch'](function(_0x1a851e){logger[_0x4696('0x10')]('ShowSalesforceAccount',_0x1a851e[_0x4696('0x13')],_0x1c006f);_0x54da7f(_0x18117f['error'](0x1f4,_0x1a851e[_0x4696('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index c966924..4d4d1fe 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 _0x5f66=['express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/fields','/:id/subjects','getSubjects','put','update','delete','destroy','exports','util','connect-timeout'];(function(_0x2ca7db,_0x152bd5){var _0xc249d=function(_0x17a93d){while(--_0x17a93d){_0x2ca7db['push'](_0x2ca7db['shift']());}};_0xc249d(++_0x152bd5);}(_0x5f66,0x1a0));var _0x65f6=function(_0x4c12ec,_0x2e9103){_0x4c12ec=_0x4c12ec-0x0;var _0x3ae42c=_0x5f66[_0x4c12ec];return _0x3ae42c;};'use strict';var multer=require('multer');var util=require(_0x65f6('0x0'));var path=require('path');var timeout=require(_0x65f6('0x1'));var express=require(_0x65f6('0x2'));var router=express[_0x65f6('0x3')]();var fs_extra=require(_0x65f6('0x4'));var auth=require(_0x65f6('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x65f6('0x6'));var controller=require('./intSalesforceConfiguration.controller');router[_0x65f6('0x7')]('/',auth[_0x65f6('0x8')](),controller['index']);router['get'](_0x65f6('0x9'),auth[_0x65f6('0x8')](),controller[_0x65f6('0xa')]);router[_0x65f6('0x7')](_0x65f6('0xb'),auth[_0x65f6('0x8')](),controller['getFields']);router['get'](_0x65f6('0xc'),auth[_0x65f6('0x8')](),controller[_0x65f6('0xd')]);router[_0x65f6('0x7')]('/:id/descriptions',auth[_0x65f6('0x8')](),controller['getDescriptions']);router['post']('/',auth[_0x65f6('0x8')](),controller['create']);router[_0x65f6('0xe')]('/:id',auth[_0x65f6('0x8')](),controller[_0x65f6('0xf')]);router[_0x65f6('0x10')](_0x65f6('0x9'),auth[_0x65f6('0x8')](),controller[_0x65f6('0x11')]);module[_0x65f6('0x12')]=router; \ No newline at end of file +var _0x0b0e=['post','create','put','/:id','update','destroy','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceConfiguration.controller','get','isAuthenticated','index','show','/:id/fields','/:id/subjects','getSubjects','getDescriptions'];(function(_0x28d18d,_0x55896b){var _0x470640=function(_0x57e78b){while(--_0x57e78b){_0x28d18d['push'](_0x28d18d['shift']());}};_0x470640(++_0x55896b);}(_0x0b0e,0x187));var _0xe0b0=function(_0x1a5946,_0x426991){_0x1a5946=_0x1a5946-0x0;var _0x25e9d5=_0x0b0e[_0x1a5946];return _0x25e9d5;};'use strict';var multer=require(_0xe0b0('0x0'));var util=require('util');var path=require(_0xe0b0('0x1'));var timeout=require('connect-timeout');var express=require(_0xe0b0('0x2'));var router=express[_0xe0b0('0x3')]();var fs_extra=require(_0xe0b0('0x4'));var auth=require(_0xe0b0('0x5'));var interaction=require(_0xe0b0('0x6'));var config=require(_0xe0b0('0x7'));var controller=require(_0xe0b0('0x8'));router[_0xe0b0('0x9')]('/',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0xb')]);router[_0xe0b0('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xe0b0('0xc')]);router[_0xe0b0('0x9')](_0xe0b0('0xd'),auth[_0xe0b0('0xa')](),controller['getFields']);router[_0xe0b0('0x9')](_0xe0b0('0xe'),auth['isAuthenticated'](),controller[_0xe0b0('0xf')]);router[_0xe0b0('0x9')]('/:id/descriptions',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0x10')]);router[_0xe0b0('0x11')]('/',auth['isAuthenticated'](),controller[_0xe0b0('0x12')]);router[_0xe0b0('0x13')](_0xe0b0('0x14'),auth[_0xe0b0('0xa')](),controller[_0xe0b0('0x15')]);router['delete'](_0xe0b0('0x14'),auth[_0xe0b0('0xa')](),controller[_0xe0b0('0x16')]);module[_0xe0b0('0x17')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js index 768f8f6..ed9ff55 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 _0xfe4a=['lead','account_contact_lead','account','sequelize','exports','STRING','ENUM','Task','Case','contact_lead','contact'];(function(_0x3e71cc,_0x15b3de){var _0x3b7519=function(_0x2294a1){while(--_0x2294a1){_0x3e71cc['push'](_0x3e71cc['shift']());}};_0x3b7519(++_0x15b3de);}(_0xfe4a,0x10b));var _0xafe4=function(_0x3ab9ee,_0x4a74b8){_0x3ab9ee=_0x3ab9ee-0x0;var _0x82ee88=_0xfe4a[_0x3ab9ee];return _0x82ee88;};'use strict';var Sequelize=require(_0xafe4('0x0'));module[_0xafe4('0x1')]={'name':{'type':Sequelize[_0xafe4('0x2')]},'description':{'type':Sequelize[_0xafe4('0x2')]},'ticketType':{'type':Sequelize[_0xafe4('0x3')](_0xafe4('0x4'),_0xafe4('0x5')),'defaultValue':_0xafe4('0x4')},'moduleSearch':{'type':Sequelize['ENUM'](_0xafe4('0x6'),_0xafe4('0x7'),_0xafe4('0x8'),_0xafe4('0x9'),'account'),'defaultValue':_0xafe4('0x6')},'moduleCreate':{'type':Sequelize[_0xafe4('0x3')]('nothing',_0xafe4('0x7'),_0xafe4('0x8'),_0xafe4('0xa')),'defaultValue':'lead'},'leadId':{'type':Sequelize['STRING']},'additionalSearchAccount':{'type':Sequelize['STRING']},'additionalSearchContact':{'type':Sequelize[_0xafe4('0x2')]},'additionalSearchLead':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xd876=['lead','account_contact_lead','account','sequelize','STRING','Case','Task','ENUM','contact_lead','contact'];(function(_0x4a4922,_0x82cb8f){var _0x55a8c6=function(_0x59712e){while(--_0x59712e){_0x4a4922['push'](_0x4a4922['shift']());}};_0x55a8c6(++_0x82cb8f);}(_0xd876,0x11b));var _0x6d87=function(_0x5c1898,_0x12825b){_0x5c1898=_0x5c1898-0x0;var _0x45e004=_0xd876[_0x5c1898];return _0x45e004;};'use strict';var Sequelize=require(_0x6d87('0x0'));module['exports']={'name':{'type':Sequelize[_0x6d87('0x1')]},'description':{'type':Sequelize[_0x6d87('0x1')]},'ticketType':{'type':Sequelize['ENUM']('Task',_0x6d87('0x2')),'defaultValue':_0x6d87('0x3')},'moduleSearch':{'type':Sequelize[_0x6d87('0x4')](_0x6d87('0x5'),_0x6d87('0x6'),_0x6d87('0x7'),_0x6d87('0x8'),_0x6d87('0x9')),'defaultValue':_0x6d87('0x5')},'moduleCreate':{'type':Sequelize['ENUM']('nothing',_0x6d87('0x6'),_0x6d87('0x7'),_0x6d87('0x9')),'defaultValue':'lead'},'leadId':{'type':Sequelize[_0x6d87('0x1')]},'additionalSearchAccount':{'type':Sequelize[_0x6d87('0x1')]},'additionalSearchContact':{'type':Sequelize[_0x6d87('0x1')]},'additionalSearchLead':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js index 7cfc903..708b6e8 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 _0xa600=['attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','SalesforceConfiguration','includeAll','findAll','rows','catch','show','params','include','find','create','body','getFields','SalesforceField','nolimit','findOne','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters'];(function(_0xbb7885,_0x30c84f){var _0xfdd112=function(_0x2feb7d){while(--_0x2feb7d){_0xbb7885['push'](_0xbb7885['shift']());}};_0xfdd112(++_0x30c84f);}(_0xa600,0x1c7));var _0x0a60=function(_0x37cc52,_0x459a9b){_0x37cc52=_0x37cc52-0x0;var _0x2b4a90=_0xa600[_0x37cc52];return _0x2b4a90;};'use strict';var emlformat=require(_0x0a60('0x0'));var rimraf=require(_0x0a60('0x1'));var zipdir=require(_0x0a60('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0a60('0x3'));var moment=require(_0x0a60('0x4'));var BPromise=require(_0x0a60('0x5'));var Mustache=require(_0x0a60('0x6'));var util=require('util');var path=require(_0x0a60('0x7'));var sox=require(_0x0a60('0x8'));var csv=require('to-csv');var ejs=require(_0x0a60('0x9'));var fs=require('fs');var fs_extra=require(_0x0a60('0xa'));var _=require(_0x0a60('0xb'));var squel=require(_0x0a60('0xc'));var crypto=require(_0x0a60('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x0a60('0xe'));var toCsv=require('to-csv');var querystring=require(_0x0a60('0xf'));var Papa=require(_0x0a60('0x10'));var Redis=require(_0x0a60('0x11'));var authService=require(_0x0a60('0x12'));var qs=require(_0x0a60('0x13'));var as=require(_0x0a60('0x14'));var hardwareService=require(_0x0a60('0x15'));var logger=require(_0x0a60('0x16'))(_0x0a60('0x17'));var utils=require(_0x0a60('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x0a60('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3f1836,_0x45d76b){_0x45d76b=_0x45d76b||0xcc;return function(_0x34637e){if(_0x34637e){return _0x3f1836['sendStatus'](_0x45d76b);}return _0x3f1836['status'](_0x45d76b)['end']();};}function respondWithResult(_0x3f3c02,_0x1cfabe){_0x1cfabe=_0x1cfabe||0xc8;return function(_0x42024f){if(_0x42024f){return _0x3f3c02[_0x0a60('0x1a')](_0x1cfabe)[_0x0a60('0x1b')](_0x42024f);}};}function respondWithFilteredResult(_0xb9d969,_0x44d45a){return function(_0x5b9eef){if(_0x5b9eef){var _0x45e396=typeof _0x44d45a[_0x0a60('0x1c')]===_0x0a60('0x1d')&&typeof _0x44d45a[_0x0a60('0x1e')]==='undefined';var _0x4b2012=_0x5b9eef[_0x0a60('0x1f')];var _0x19ae6f=_0x45e396?0x0:_0x44d45a[_0x0a60('0x1c')];var _0x57df7f=_0x45e396?_0x5b9eef['count']:_0x44d45a[_0x0a60('0x1c')]+_0x44d45a['limit'];var _0x50e589;if(_0x57df7f>=_0x4b2012){_0x57df7f=_0x4b2012;_0x50e589=0xc8;}else{_0x50e589=0xce;}_0xb9d969[_0x0a60('0x1a')](_0x50e589);return _0xb9d969[_0x0a60('0x20')](_0x0a60('0x21'),_0x19ae6f+'-'+_0x57df7f+'/'+_0x4b2012)[_0x0a60('0x1b')](_0x5b9eef);}return null;};}function patchUpdates(_0x1c1ee5){return function(_0x532599){try{jsonpatch[_0x0a60('0x22')](_0x532599,_0x1c1ee5,!![]);}catch(_0x1d2070){return BPromise[_0x0a60('0x23')](_0x1d2070);}return _0x532599[_0x0a60('0x24')]();};}function saveUpdates(_0x2832c3,_0x1f86d0){return function(_0x112bbc){if(_0x112bbc){return _0x112bbc[_0x0a60('0x25')](_0x2832c3)[_0x0a60('0x26')](function(_0x137861){return _0x137861;});}return null;};}function removeEntity(_0x4cb09b,_0x17350a){return function(_0x305720){if(_0x305720){return _0x305720[_0x0a60('0x27')]()[_0x0a60('0x26')](function(){_0x4cb09b['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4433aa,_0x1ad71d){return function(_0xc4cea8){if(!_0xc4cea8){_0x4433aa[_0x0a60('0x28')](0x194);}return _0xc4cea8;};}function handleError(_0x571855,_0x247e96){_0x247e96=_0x247e96||0x1f4;return function(_0xffda8){logger[_0x0a60('0x29')](_0xffda8[_0x0a60('0x2a')]);if(_0xffda8['name']){delete _0xffda8[_0x0a60('0x2b')];}_0x571855['status'](_0x247e96)[_0x0a60('0x2c')](_0xffda8);};}exports[_0x0a60('0x2d')]=function(_0x30d6d0,_0x578992){var _0x5895ef={},_0x436d34={},_0x56f38c={'count':0x0,'rows':[]};var _0x1a1b4d=_[_0x0a60('0x2e')](db['SalesforceConfiguration'][_0x0a60('0x2f')],function(_0x5c91ea){return{'name':_0x5c91ea[_0x0a60('0x30')],'type':_0x5c91ea[_0x0a60('0x31')][_0x0a60('0x32')]};});_0x436d34[_0x0a60('0x33')]=_[_0x0a60('0x2e')](_0x1a1b4d,_0x0a60('0x2b'));_0x436d34[_0x0a60('0x34')]=_[_0x0a60('0x35')](_0x30d6d0['query']);_0x436d34[_0x0a60('0x36')]=_['intersection'](_0x436d34['model'],_0x436d34[_0x0a60('0x34')]);_0x5895ef[_0x0a60('0x37')]=_[_0x0a60('0x38')](_0x436d34[_0x0a60('0x33')],qs[_0x0a60('0x39')](_0x30d6d0[_0x0a60('0x34')][_0x0a60('0x39')]));_0x5895ef['attributes']=_0x5895ef[_0x0a60('0x37')][_0x0a60('0x3a')]?_0x5895ef[_0x0a60('0x37')]:_0x436d34['model'];if(!_0x30d6d0['query'][_0x0a60('0x3b')]('nolimit')){_0x5895ef[_0x0a60('0x1e')]=qs[_0x0a60('0x1e')](_0x30d6d0[_0x0a60('0x34')][_0x0a60('0x1e')]);_0x5895ef['offset']=qs[_0x0a60('0x1c')](_0x30d6d0[_0x0a60('0x34')][_0x0a60('0x1c')]);}_0x5895ef[_0x0a60('0x3c')]=qs[_0x0a60('0x3d')](_0x30d6d0['query'][_0x0a60('0x3d')]);_0x5895ef[_0x0a60('0x3e')]=qs['filters'](_[_0x0a60('0x3f')](_0x30d6d0[_0x0a60('0x34')],_0x436d34[_0x0a60('0x36')]),_0x1a1b4d);if(_0x30d6d0['query'][_0x0a60('0x40')]){_0x5895ef[_0x0a60('0x3e')]=_[_0x0a60('0x41')](_0x5895ef[_0x0a60('0x3e')],{'$or':_[_0x0a60('0x2e')](_0x1a1b4d,function(_0x439bfb){if(_0x439bfb[_0x0a60('0x31')]!==_0x0a60('0x42')){var _0xb3a564={};_0xb3a564[_0x439bfb[_0x0a60('0x2b')]]={'$like':'%'+_0x30d6d0[_0x0a60('0x34')]['filter']+'%'};return _0xb3a564;}})});}_0x5895ef=_[_0x0a60('0x41')]({},_0x5895ef,_0x30d6d0[_0x0a60('0x43')]);var _0x43303b={'where':_0x5895ef[_0x0a60('0x3e')]};return db[_0x0a60('0x44')]['count'](_0x43303b)[_0x0a60('0x26')](function(_0xdafb58){_0x56f38c[_0x0a60('0x1f')]=_0xdafb58;if(_0x30d6d0[_0x0a60('0x34')][_0x0a60('0x45')]){_0x5895ef['include']=[{'all':!![]}];}return db[_0x0a60('0x44')][_0x0a60('0x46')](_0x5895ef);})[_0x0a60('0x26')](function(_0x2c28e7){_0x56f38c[_0x0a60('0x47')]=_0x2c28e7;return _0x56f38c;})[_0x0a60('0x26')](respondWithFilteredResult(_0x578992,_0x5895ef))[_0x0a60('0x48')](handleError(_0x578992,null));};exports[_0x0a60('0x49')]=function(_0x2e632f,_0x4c366d){var _0x486992={'raw':![],'where':{'id':_0x2e632f[_0x0a60('0x4a')]['id']}},_0x5e1324={};_0x5e1324[_0x0a60('0x33')]=_['keys'](db[_0x0a60('0x44')]['rawAttributes']);_0x5e1324[_0x0a60('0x34')]=_[_0x0a60('0x35')](_0x2e632f[_0x0a60('0x34')]);_0x5e1324[_0x0a60('0x36')]=_[_0x0a60('0x38')](_0x5e1324[_0x0a60('0x33')],_0x5e1324[_0x0a60('0x34')]);_0x486992[_0x0a60('0x37')]=_[_0x0a60('0x38')](_0x5e1324[_0x0a60('0x33')],qs[_0x0a60('0x39')](_0x2e632f[_0x0a60('0x34')][_0x0a60('0x39')]));_0x486992[_0x0a60('0x37')]=_0x486992[_0x0a60('0x37')]['length']?_0x486992[_0x0a60('0x37')]:_0x5e1324[_0x0a60('0x33')];if(_0x2e632f[_0x0a60('0x34')]['includeAll']){_0x486992[_0x0a60('0x4b')]=[{'all':!![]}];}_0x486992=_[_0x0a60('0x41')]({},_0x486992,_0x2e632f[_0x0a60('0x43')]);return db[_0x0a60('0x44')][_0x0a60('0x4c')](_0x486992)[_0x0a60('0x26')](handleEntityNotFound(_0x4c366d,null))['then'](respondWithResult(_0x4c366d,null))['catch'](handleError(_0x4c366d,null));};exports['create']=function(_0x3d4e74,_0x58f7c4){return db['SalesforceConfiguration'][_0x0a60('0x4d')](_0x3d4e74[_0x0a60('0x4e')],{})[_0x0a60('0x26')](respondWithResult(_0x58f7c4,0xc9))['catch'](handleError(_0x58f7c4,null));};exports['update']=function(_0x52aab7,_0x489302){if(_0x52aab7[_0x0a60('0x4e')]['id']){delete _0x52aab7[_0x0a60('0x4e')]['id'];}return db[_0x0a60('0x44')]['find']({'where':{'id':_0x52aab7['params']['id']}})[_0x0a60('0x26')](handleEntityNotFound(_0x489302,null))[_0x0a60('0x26')](saveUpdates(_0x52aab7[_0x0a60('0x4e')],null))[_0x0a60('0x26')](respondWithResult(_0x489302,null))[_0x0a60('0x48')](handleError(_0x489302,null));};exports[_0x0a60('0x27')]=function(_0x187c36,_0x4783a7){return db['SalesforceConfiguration']['find']({'where':{'id':_0x187c36[_0x0a60('0x4a')]['id']}})[_0x0a60('0x26')](handleEntityNotFound(_0x4783a7,null))['then'](removeEntity(_0x4783a7,null))['catch'](handleError(_0x4783a7,null));};exports[_0x0a60('0x4f')]=function(_0xa571db,_0x483aba,_0x2c2838){var _0x4bfe2a={};var _0x31d653={};var _0x4705e4;var _0x44a61f;return db['SalesforceConfiguration']['findOne']({'where':{'id':_0xa571db[_0x0a60('0x4a')]['id']}})[_0x0a60('0x26')](handleEntityNotFound(_0x483aba,null))[_0x0a60('0x26')](function(_0x3fe2ac){if(_0x3fe2ac){_0x4705e4=_0x3fe2ac;_0x31d653['model']=_[_0x0a60('0x35')](db[_0x0a60('0x50')][_0x0a60('0x2f')]);_0x31d653[_0x0a60('0x34')]=_['keys'](_0xa571db['query']);_0x31d653[_0x0a60('0x36')]=_[_0x0a60('0x38')](_0x31d653[_0x0a60('0x33')],_0x31d653[_0x0a60('0x34')]);_0x4bfe2a['attributes']=_['intersection'](_0x31d653[_0x0a60('0x33')],qs[_0x0a60('0x39')](_0xa571db[_0x0a60('0x34')][_0x0a60('0x39')]));_0x4bfe2a[_0x0a60('0x37')]=_0x4bfe2a[_0x0a60('0x37')][_0x0a60('0x3a')]?_0x4bfe2a[_0x0a60('0x37')]:_0x31d653['model'];_0x4bfe2a[_0x0a60('0x3c')]=qs['sort'](_0xa571db[_0x0a60('0x34')]['sort']);_0x4bfe2a['where']=qs[_0x0a60('0x36')](_[_0x0a60('0x3f')](_0xa571db[_0x0a60('0x34')],_0x31d653[_0x0a60('0x36')]));if(_0xa571db[_0x0a60('0x34')][_0x0a60('0x40')]){_0x4bfe2a['where']=_[_0x0a60('0x41')](_0x4bfe2a[_0x0a60('0x3e')],{'$or':_['map'](_0x4bfe2a['attributes'],function(_0x3139ea){var _0x4bb0fe={};_0x4bb0fe[_0x3139ea]={'$like':'%'+_0xa571db[_0x0a60('0x34')][_0x0a60('0x40')]+'%'};return _0x4bb0fe;})});}_0x4bfe2a=_[_0x0a60('0x41')]({},_0x4bfe2a,_0xa571db[_0x0a60('0x43')]);return _0x4705e4[_0x0a60('0x4f')](_0x4bfe2a);}})[_0x0a60('0x26')](function(_0x129063){if(_0x129063){_0x44a61f=_0x129063[_0x0a60('0x3a')];if(!_0xa571db[_0x0a60('0x34')][_0x0a60('0x3b')](_0x0a60('0x51'))){_0x4bfe2a['limit']=qs[_0x0a60('0x1e')](_0xa571db[_0x0a60('0x34')][_0x0a60('0x1e')]);_0x4bfe2a[_0x0a60('0x1c')]=qs[_0x0a60('0x1c')](_0xa571db[_0x0a60('0x34')][_0x0a60('0x1c')]);}return _0x4705e4[_0x0a60('0x4f')](_0x4bfe2a);}})[_0x0a60('0x26')](function(_0x5a933c){if(_0x5a933c){return _0x5a933c?{'count':_0x44a61f,'rows':_0x5a933c}:null;}})['then'](respondWithResult(_0x483aba,null))[_0x0a60('0x48')](handleError(_0x483aba,null));};exports['getSubjects']=function(_0x2aacfb,_0x465eb5,_0x513037){var _0x2d07c2={};var _0x1aa1dc={};var _0x4c1dd2;var _0x3c787d;return db[_0x0a60('0x44')][_0x0a60('0x52')]({'where':{'id':_0x2aacfb['params']['id']}})[_0x0a60('0x26')](handleEntityNotFound(_0x465eb5,null))[_0x0a60('0x26')](function(_0x55284f){if(_0x55284f){_0x4c1dd2=_0x55284f;_0x1aa1dc[_0x0a60('0x33')]=_[_0x0a60('0x35')](db[_0x0a60('0x50')][_0x0a60('0x2f')]);_0x1aa1dc['query']=_['keys'](_0x2aacfb[_0x0a60('0x34')]);_0x1aa1dc[_0x0a60('0x36')]=_['intersection'](_0x1aa1dc[_0x0a60('0x33')],_0x1aa1dc[_0x0a60('0x34')]);_0x2d07c2['attributes']=_[_0x0a60('0x38')](_0x1aa1dc['model'],qs['fields'](_0x2aacfb[_0x0a60('0x34')][_0x0a60('0x39')]));_0x2d07c2[_0x0a60('0x37')]=_0x2d07c2['attributes'][_0x0a60('0x3a')]?_0x2d07c2[_0x0a60('0x37')]:_0x1aa1dc[_0x0a60('0x33')];_0x2d07c2[_0x0a60('0x3c')]=qs[_0x0a60('0x3d')](_0x2aacfb[_0x0a60('0x34')][_0x0a60('0x3d')]);_0x2d07c2[_0x0a60('0x3e')]=qs['filters'](_['pick'](_0x2aacfb[_0x0a60('0x34')],_0x1aa1dc[_0x0a60('0x36')]));if(_0x2aacfb[_0x0a60('0x34')][_0x0a60('0x40')]){_0x2d07c2[_0x0a60('0x3e')]=_[_0x0a60('0x41')](_0x2d07c2[_0x0a60('0x3e')],{'$or':_[_0x0a60('0x2e')](_0x2d07c2[_0x0a60('0x37')],function(_0x2b060f){var _0x24cf59={};_0x24cf59[_0x2b060f]={'$like':'%'+_0x2aacfb[_0x0a60('0x34')]['filter']+'%'};return _0x24cf59;})});}_0x2d07c2=_[_0x0a60('0x41')]({},_0x2d07c2,_0x2aacfb[_0x0a60('0x43')]);return _0x4c1dd2[_0x0a60('0x53')](_0x2d07c2);}})[_0x0a60('0x26')](function(_0x34c038){if(_0x34c038){_0x3c787d=_0x34c038[_0x0a60('0x3a')];if(!_0x2aacfb[_0x0a60('0x34')][_0x0a60('0x3b')](_0x0a60('0x51'))){_0x2d07c2[_0x0a60('0x1e')]=qs['limit'](_0x2aacfb[_0x0a60('0x34')][_0x0a60('0x1e')]);_0x2d07c2[_0x0a60('0x1c')]=qs[_0x0a60('0x1c')](_0x2aacfb[_0x0a60('0x34')][_0x0a60('0x1c')]);}return _0x4c1dd2[_0x0a60('0x53')](_0x2d07c2);}})[_0x0a60('0x26')](function(_0x5e749f){if(_0x5e749f){return _0x5e749f?{'count':_0x3c787d,'rows':_0x5e749f}:null;}})[_0x0a60('0x26')](respondWithResult(_0x465eb5,null))[_0x0a60('0x48')](handleError(_0x465eb5,null));};exports[_0x0a60('0x54')]=function(_0x2e4140,_0x55d2ac,_0x30c752){var _0x3100b3={};var _0x56068b={};var _0x3c47cb;var _0x5809b6;return db[_0x0a60('0x44')]['findOne']({'where':{'id':_0x2e4140[_0x0a60('0x4a')]['id']}})[_0x0a60('0x26')](handleEntityNotFound(_0x55d2ac,null))[_0x0a60('0x26')](function(_0x8687b7){if(_0x8687b7){_0x3c47cb=_0x8687b7;_0x56068b[_0x0a60('0x33')]=_[_0x0a60('0x35')](db[_0x0a60('0x50')][_0x0a60('0x2f')]);_0x56068b[_0x0a60('0x34')]=_[_0x0a60('0x35')](_0x2e4140[_0x0a60('0x34')]);_0x56068b['filters']=_[_0x0a60('0x38')](_0x56068b[_0x0a60('0x33')],_0x56068b[_0x0a60('0x34')]);_0x3100b3['attributes']=_[_0x0a60('0x38')](_0x56068b[_0x0a60('0x33')],qs['fields'](_0x2e4140['query'][_0x0a60('0x39')]));_0x3100b3[_0x0a60('0x37')]=_0x3100b3[_0x0a60('0x37')]['length']?_0x3100b3[_0x0a60('0x37')]:_0x56068b[_0x0a60('0x33')];_0x3100b3[_0x0a60('0x3c')]=qs['sort'](_0x2e4140[_0x0a60('0x34')][_0x0a60('0x3d')]);_0x3100b3[_0x0a60('0x3e')]=qs[_0x0a60('0x36')](_[_0x0a60('0x3f')](_0x2e4140[_0x0a60('0x34')],_0x56068b[_0x0a60('0x36')]));if(_0x2e4140[_0x0a60('0x34')][_0x0a60('0x40')]){_0x3100b3[_0x0a60('0x3e')]=_[_0x0a60('0x41')](_0x3100b3['where'],{'$or':_[_0x0a60('0x2e')](_0x3100b3['attributes'],function(_0x2f3820){var _0x51c0ea={};_0x51c0ea[_0x2f3820]={'$like':'%'+_0x2e4140[_0x0a60('0x34')][_0x0a60('0x40')]+'%'};return _0x51c0ea;})});}_0x3100b3=_[_0x0a60('0x41')]({},_0x3100b3,_0x2e4140[_0x0a60('0x43')]);return _0x3c47cb[_0x0a60('0x54')](_0x3100b3);}})[_0x0a60('0x26')](function(_0x5b2cc4){if(_0x5b2cc4){_0x5809b6=_0x5b2cc4['length'];if(!_0x2e4140[_0x0a60('0x34')][_0x0a60('0x3b')](_0x0a60('0x51'))){_0x3100b3[_0x0a60('0x1e')]=qs[_0x0a60('0x1e')](_0x2e4140['query'][_0x0a60('0x1e')]);_0x3100b3[_0x0a60('0x1c')]=qs[_0x0a60('0x1c')](_0x2e4140[_0x0a60('0x34')]['offset']);}return _0x3c47cb[_0x0a60('0x54')](_0x3100b3);}})['then'](function(_0x1fe6a6){if(_0x1fe6a6){return _0x1fe6a6?{'count':_0x5809b6,'rows':_0x1fe6a6}:null;}})['then'](respondWithResult(_0x55d2ac,null))[_0x0a60('0x48')](handleError(_0x55d2ac,null));}; \ No newline at end of file +var _0x1bfd=['body','destroy','findOne','SalesforceField','getFields','length','getSubjects','getDescriptions','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','json','apply','reject','update','then','error','send','map','SalesforceConfiguration','rawAttributes','fieldName','type','model','filters','intersection','query','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','include','findAll','catch','params','keys','includeAll','find','create'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x1bfd,0x1dc));var _0xd1bf=function(_0x378789,_0x894ede){_0x378789=_0x378789-0x0;var _0x493aa7=_0x1bfd[_0x378789];return _0x493aa7;};'use strict';var emlformat=require(_0xd1bf('0x0'));var rimraf=require(_0xd1bf('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd1bf('0x2'));var rp=require(_0xd1bf('0x3'));var moment=require(_0xd1bf('0x4'));var BPromise=require(_0xd1bf('0x5'));var Mustache=require(_0xd1bf('0x6'));var util=require(_0xd1bf('0x7'));var path=require(_0xd1bf('0x8'));var sox=require(_0xd1bf('0x9'));var csv=require(_0xd1bf('0xa'));var ejs=require(_0xd1bf('0xb'));var fs=require('fs');var fs_extra=require(_0xd1bf('0xc'));var _=require(_0xd1bf('0xd'));var squel=require('squel');var crypto=require(_0xd1bf('0xe'));var jsforce=require(_0xd1bf('0xf'));var deskjs=require(_0xd1bf('0x10'));var toCsv=require(_0xd1bf('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xd1bf('0x11'));var authService=require(_0xd1bf('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd1bf('0x13'));var logger=require(_0xd1bf('0x14'))(_0xd1bf('0x15'));var utils=require('../../config/utils');var config=require(_0xd1bf('0x16'));var licenseUtil=require(_0xd1bf('0x17'));var db=require(_0xd1bf('0x18'))['db'];function respondWithStatusCode(_0x4f9f3e,_0x5d75ec){_0x5d75ec=_0x5d75ec||0xcc;return function(_0x211661){if(_0x211661){return _0x4f9f3e[_0xd1bf('0x19')](_0x5d75ec);}return _0x4f9f3e[_0xd1bf('0x1a')](_0x5d75ec)[_0xd1bf('0x1b')]();};}function respondWithResult(_0x575766,_0x3c227c){_0x3c227c=_0x3c227c||0xc8;return function(_0x7e22a0){if(_0x7e22a0){return _0x575766[_0xd1bf('0x1a')](_0x3c227c)['json'](_0x7e22a0);}};}function respondWithFilteredResult(_0x28707d,_0x1d9448){return function(_0x40d52a){if(_0x40d52a){var _0x362454=typeof _0x1d9448['offset']===_0xd1bf('0x1c')&&typeof _0x1d9448[_0xd1bf('0x1d')]===_0xd1bf('0x1c');var _0x2e7535=_0x40d52a[_0xd1bf('0x1e')];var _0x5c8165=_0x362454?0x0:_0x1d9448[_0xd1bf('0x1f')];var _0x33f2f6=_0x362454?_0x40d52a['count']:_0x1d9448[_0xd1bf('0x1f')]+_0x1d9448[_0xd1bf('0x1d')];var _0x45e4d2;if(_0x33f2f6>=_0x2e7535){_0x33f2f6=_0x2e7535;_0x45e4d2=0xc8;}else{_0x45e4d2=0xce;}_0x28707d['status'](_0x45e4d2);return _0x28707d[_0xd1bf('0x20')](_0xd1bf('0x21'),_0x5c8165+'-'+_0x33f2f6+'/'+_0x2e7535)[_0xd1bf('0x22')](_0x40d52a);}return null;};}function patchUpdates(_0x34e56d){return function(_0x10f3f7){try{jsonpatch[_0xd1bf('0x23')](_0x10f3f7,_0x34e56d,!![]);}catch(_0x5df9a9){return BPromise[_0xd1bf('0x24')](_0x5df9a9);}return _0x10f3f7['save']();};}function saveUpdates(_0x2901d6,_0x382b24){return function(_0x2e1aef){if(_0x2e1aef){return _0x2e1aef[_0xd1bf('0x25')](_0x2901d6)[_0xd1bf('0x26')](function(_0x539356){return _0x539356;});}return null;};}function removeEntity(_0xf1a9d0,_0xd19cac){return function(_0x162481){if(_0x162481){return _0x162481['destroy']()[_0xd1bf('0x26')](function(){_0xf1a9d0[_0xd1bf('0x1a')](0xcc)[_0xd1bf('0x1b')]();});}};}function handleEntityNotFound(_0x1c0591,_0x3761d3){return function(_0x11ecad){if(!_0x11ecad){_0x1c0591[_0xd1bf('0x19')](0x194);}return _0x11ecad;};}function handleError(_0x27c3b9,_0x1cdfab){_0x1cdfab=_0x1cdfab||0x1f4;return function(_0x1f8df4){logger[_0xd1bf('0x27')](_0x1f8df4['stack']);if(_0x1f8df4['name']){delete _0x1f8df4['name'];}_0x27c3b9[_0xd1bf('0x1a')](_0x1cdfab)[_0xd1bf('0x28')](_0x1f8df4);};}exports['index']=function(_0x3f83cc,_0xf976b){var _0x5c95d3={},_0x3e518f={},_0x5b15ca={'count':0x0,'rows':[]};var _0x400863=_[_0xd1bf('0x29')](db[_0xd1bf('0x2a')][_0xd1bf('0x2b')],function(_0x1c4beb){return{'name':_0x1c4beb[_0xd1bf('0x2c')],'type':_0x1c4beb[_0xd1bf('0x2d')]['key']};});_0x3e518f[_0xd1bf('0x2e')]=_[_0xd1bf('0x29')](_0x400863,'name');_0x3e518f['query']=_['keys'](_0x3f83cc['query']);_0x3e518f[_0xd1bf('0x2f')]=_[_0xd1bf('0x30')](_0x3e518f[_0xd1bf('0x2e')],_0x3e518f[_0xd1bf('0x31')]);_0x5c95d3[_0xd1bf('0x32')]=_[_0xd1bf('0x30')](_0x3e518f[_0xd1bf('0x2e')],qs['fields'](_0x3f83cc[_0xd1bf('0x31')][_0xd1bf('0x33')]));_0x5c95d3[_0xd1bf('0x32')]=_0x5c95d3[_0xd1bf('0x32')]['length']?_0x5c95d3[_0xd1bf('0x32')]:_0x3e518f['model'];if(!_0x3f83cc[_0xd1bf('0x31')][_0xd1bf('0x34')](_0xd1bf('0x35'))){_0x5c95d3['limit']=qs[_0xd1bf('0x1d')](_0x3f83cc[_0xd1bf('0x31')]['limit']);_0x5c95d3[_0xd1bf('0x1f')]=qs[_0xd1bf('0x1f')](_0x3f83cc['query'][_0xd1bf('0x1f')]);}_0x5c95d3[_0xd1bf('0x36')]=qs[_0xd1bf('0x37')](_0x3f83cc[_0xd1bf('0x31')][_0xd1bf('0x37')]);_0x5c95d3[_0xd1bf('0x38')]=qs['filters'](_[_0xd1bf('0x39')](_0x3f83cc['query'],_0x3e518f['filters']),_0x400863);if(_0x3f83cc[_0xd1bf('0x31')][_0xd1bf('0x3a')]){_0x5c95d3['where']=_['merge'](_0x5c95d3[_0xd1bf('0x38')],{'$or':_[_0xd1bf('0x29')](_0x400863,function(_0xc02901){if(_0xc02901[_0xd1bf('0x2d')]!==_0xd1bf('0x3b')){var _0x1b0a5c={};_0x1b0a5c[_0xc02901['name']]={'$like':'%'+_0x3f83cc[_0xd1bf('0x31')][_0xd1bf('0x3a')]+'%'};return _0x1b0a5c;}})});}_0x5c95d3=_[_0xd1bf('0x3c')]({},_0x5c95d3,_0x3f83cc[_0xd1bf('0x3d')]);var _0x457e18={'where':_0x5c95d3[_0xd1bf('0x38')]};return db[_0xd1bf('0x2a')][_0xd1bf('0x1e')](_0x457e18)[_0xd1bf('0x26')](function(_0x28aef){_0x5b15ca[_0xd1bf('0x1e')]=_0x28aef;if(_0x3f83cc[_0xd1bf('0x31')]['includeAll']){_0x5c95d3[_0xd1bf('0x3e')]=[{'all':!![]}];}return db['SalesforceConfiguration'][_0xd1bf('0x3f')](_0x5c95d3);})[_0xd1bf('0x26')](function(_0x723f93){_0x5b15ca['rows']=_0x723f93;return _0x5b15ca;})[_0xd1bf('0x26')](respondWithFilteredResult(_0xf976b,_0x5c95d3))[_0xd1bf('0x40')](handleError(_0xf976b,null));};exports['show']=function(_0x428361,_0x4814a7){var _0x49df2e={'raw':![],'where':{'id':_0x428361[_0xd1bf('0x41')]['id']}},_0x138285={};_0x138285[_0xd1bf('0x2e')]=_[_0xd1bf('0x42')](db['SalesforceConfiguration'][_0xd1bf('0x2b')]);_0x138285[_0xd1bf('0x31')]=_[_0xd1bf('0x42')](_0x428361[_0xd1bf('0x31')]);_0x138285[_0xd1bf('0x2f')]=_['intersection'](_0x138285[_0xd1bf('0x2e')],_0x138285[_0xd1bf('0x31')]);_0x49df2e[_0xd1bf('0x32')]=_[_0xd1bf('0x30')](_0x138285['model'],qs[_0xd1bf('0x33')](_0x428361[_0xd1bf('0x31')][_0xd1bf('0x33')]));_0x49df2e[_0xd1bf('0x32')]=_0x49df2e[_0xd1bf('0x32')]['length']?_0x49df2e[_0xd1bf('0x32')]:_0x138285[_0xd1bf('0x2e')];if(_0x428361['query'][_0xd1bf('0x43')]){_0x49df2e[_0xd1bf('0x3e')]=[{'all':!![]}];}_0x49df2e=_[_0xd1bf('0x3c')]({},_0x49df2e,_0x428361[_0xd1bf('0x3d')]);return db[_0xd1bf('0x2a')][_0xd1bf('0x44')](_0x49df2e)[_0xd1bf('0x26')](handleEntityNotFound(_0x4814a7,null))[_0xd1bf('0x26')](respondWithResult(_0x4814a7,null))['catch'](handleError(_0x4814a7,null));};exports[_0xd1bf('0x45')]=function(_0xea929c,_0x4e2fc5){return db[_0xd1bf('0x2a')][_0xd1bf('0x45')](_0xea929c['body'],{})[_0xd1bf('0x26')](respondWithResult(_0x4e2fc5,0xc9))['catch'](handleError(_0x4e2fc5,null));};exports[_0xd1bf('0x25')]=function(_0x4a0e21,_0x45a8ca){if(_0x4a0e21[_0xd1bf('0x46')]['id']){delete _0x4a0e21['body']['id'];}return db['SalesforceConfiguration'][_0xd1bf('0x44')]({'where':{'id':_0x4a0e21[_0xd1bf('0x41')]['id']}})[_0xd1bf('0x26')](handleEntityNotFound(_0x45a8ca,null))[_0xd1bf('0x26')](saveUpdates(_0x4a0e21[_0xd1bf('0x46')],null))[_0xd1bf('0x26')](respondWithResult(_0x45a8ca,null))[_0xd1bf('0x40')](handleError(_0x45a8ca,null));};exports[_0xd1bf('0x47')]=function(_0x473944,_0x352360){return db['SalesforceConfiguration'][_0xd1bf('0x44')]({'where':{'id':_0x473944[_0xd1bf('0x41')]['id']}})[_0xd1bf('0x26')](handleEntityNotFound(_0x352360,null))[_0xd1bf('0x26')](removeEntity(_0x352360,null))[_0xd1bf('0x40')](handleError(_0x352360,null));};exports['getFields']=function(_0x2144cf,_0xa8b037,_0x1d3d8b){var _0x52638b={};var _0x274c0e={};var _0x1bd006;var _0x18d41f;return db[_0xd1bf('0x2a')][_0xd1bf('0x48')]({'where':{'id':_0x2144cf['params']['id']}})[_0xd1bf('0x26')](handleEntityNotFound(_0xa8b037,null))[_0xd1bf('0x26')](function(_0x4c79fe){if(_0x4c79fe){_0x1bd006=_0x4c79fe;_0x274c0e['model']=_[_0xd1bf('0x42')](db[_0xd1bf('0x49')][_0xd1bf('0x2b')]);_0x274c0e[_0xd1bf('0x31')]=_[_0xd1bf('0x42')](_0x2144cf[_0xd1bf('0x31')]);_0x274c0e['filters']=_[_0xd1bf('0x30')](_0x274c0e['model'],_0x274c0e[_0xd1bf('0x31')]);_0x52638b[_0xd1bf('0x32')]=_[_0xd1bf('0x30')](_0x274c0e[_0xd1bf('0x2e')],qs[_0xd1bf('0x33')](_0x2144cf['query'][_0xd1bf('0x33')]));_0x52638b[_0xd1bf('0x32')]=_0x52638b[_0xd1bf('0x32')]['length']?_0x52638b['attributes']:_0x274c0e[_0xd1bf('0x2e')];_0x52638b[_0xd1bf('0x36')]=qs[_0xd1bf('0x37')](_0x2144cf['query'][_0xd1bf('0x37')]);_0x52638b[_0xd1bf('0x38')]=qs[_0xd1bf('0x2f')](_['pick'](_0x2144cf[_0xd1bf('0x31')],_0x274c0e['filters']));if(_0x2144cf[_0xd1bf('0x31')]['filter']){_0x52638b[_0xd1bf('0x38')]=_[_0xd1bf('0x3c')](_0x52638b['where'],{'$or':_[_0xd1bf('0x29')](_0x52638b[_0xd1bf('0x32')],function(_0x3af6f9){var _0x30a2c2={};_0x30a2c2[_0x3af6f9]={'$like':'%'+_0x2144cf[_0xd1bf('0x31')][_0xd1bf('0x3a')]+'%'};return _0x30a2c2;})});}_0x52638b=_[_0xd1bf('0x3c')]({},_0x52638b,_0x2144cf[_0xd1bf('0x3d')]);return _0x1bd006[_0xd1bf('0x4a')](_0x52638b);}})[_0xd1bf('0x26')](function(_0x3999e7){if(_0x3999e7){_0x18d41f=_0x3999e7[_0xd1bf('0x4b')];if(!_0x2144cf[_0xd1bf('0x31')][_0xd1bf('0x34')](_0xd1bf('0x35'))){_0x52638b['limit']=qs[_0xd1bf('0x1d')](_0x2144cf[_0xd1bf('0x31')][_0xd1bf('0x1d')]);_0x52638b[_0xd1bf('0x1f')]=qs[_0xd1bf('0x1f')](_0x2144cf[_0xd1bf('0x31')][_0xd1bf('0x1f')]);}return _0x1bd006[_0xd1bf('0x4a')](_0x52638b);}})['then'](function(_0x2613cd){if(_0x2613cd){return _0x2613cd?{'count':_0x18d41f,'rows':_0x2613cd}:null;}})[_0xd1bf('0x26')](respondWithResult(_0xa8b037,null))[_0xd1bf('0x40')](handleError(_0xa8b037,null));};exports[_0xd1bf('0x4c')]=function(_0x31f445,_0x1c33f7,_0x45351f){var _0x19b03d={};var _0x30b045={};var _0x4c925d;var _0x40b99f;return db[_0xd1bf('0x2a')]['findOne']({'where':{'id':_0x31f445[_0xd1bf('0x41')]['id']}})[_0xd1bf('0x26')](handleEntityNotFound(_0x1c33f7,null))[_0xd1bf('0x26')](function(_0x1d79b4){if(_0x1d79b4){_0x4c925d=_0x1d79b4;_0x30b045['model']=_[_0xd1bf('0x42')](db[_0xd1bf('0x49')][_0xd1bf('0x2b')]);_0x30b045[_0xd1bf('0x31')]=_['keys'](_0x31f445[_0xd1bf('0x31')]);_0x30b045[_0xd1bf('0x2f')]=_['intersection'](_0x30b045[_0xd1bf('0x2e')],_0x30b045['query']);_0x19b03d[_0xd1bf('0x32')]=_[_0xd1bf('0x30')](_0x30b045[_0xd1bf('0x2e')],qs[_0xd1bf('0x33')](_0x31f445['query']['fields']));_0x19b03d['attributes']=_0x19b03d[_0xd1bf('0x32')][_0xd1bf('0x4b')]?_0x19b03d['attributes']:_0x30b045[_0xd1bf('0x2e')];_0x19b03d[_0xd1bf('0x36')]=qs[_0xd1bf('0x37')](_0x31f445[_0xd1bf('0x31')]['sort']);_0x19b03d[_0xd1bf('0x38')]=qs[_0xd1bf('0x2f')](_[_0xd1bf('0x39')](_0x31f445[_0xd1bf('0x31')],_0x30b045[_0xd1bf('0x2f')]));if(_0x31f445[_0xd1bf('0x31')][_0xd1bf('0x3a')]){_0x19b03d['where']=_[_0xd1bf('0x3c')](_0x19b03d['where'],{'$or':_[_0xd1bf('0x29')](_0x19b03d[_0xd1bf('0x32')],function(_0x260389){var _0x3fb575={};_0x3fb575[_0x260389]={'$like':'%'+_0x31f445['query']['filter']+'%'};return _0x3fb575;})});}_0x19b03d=_[_0xd1bf('0x3c')]({},_0x19b03d,_0x31f445[_0xd1bf('0x3d')]);return _0x4c925d[_0xd1bf('0x4c')](_0x19b03d);}})[_0xd1bf('0x26')](function(_0x4dfa58){if(_0x4dfa58){_0x40b99f=_0x4dfa58['length'];if(!_0x31f445[_0xd1bf('0x31')][_0xd1bf('0x34')]('nolimit')){_0x19b03d['limit']=qs['limit'](_0x31f445[_0xd1bf('0x31')][_0xd1bf('0x1d')]);_0x19b03d['offset']=qs['offset'](_0x31f445[_0xd1bf('0x31')][_0xd1bf('0x1f')]);}return _0x4c925d[_0xd1bf('0x4c')](_0x19b03d);}})['then'](function(_0x5ceeea){if(_0x5ceeea){return _0x5ceeea?{'count':_0x40b99f,'rows':_0x5ceeea}:null;}})[_0xd1bf('0x26')](respondWithResult(_0x1c33f7,null))[_0xd1bf('0x40')](handleError(_0x1c33f7,null));};exports['getDescriptions']=function(_0x56b312,_0x1cd1dd,_0x1b439c){var _0x1b4054={};var _0x2b2d14={};var _0x5ee121;var _0x29dc78;return db[_0xd1bf('0x2a')][_0xd1bf('0x48')]({'where':{'id':_0x56b312[_0xd1bf('0x41')]['id']}})[_0xd1bf('0x26')](handleEntityNotFound(_0x1cd1dd,null))[_0xd1bf('0x26')](function(_0x7c874c){if(_0x7c874c){_0x5ee121=_0x7c874c;_0x2b2d14[_0xd1bf('0x2e')]=_[_0xd1bf('0x42')](db[_0xd1bf('0x49')][_0xd1bf('0x2b')]);_0x2b2d14[_0xd1bf('0x31')]=_[_0xd1bf('0x42')](_0x56b312[_0xd1bf('0x31')]);_0x2b2d14[_0xd1bf('0x2f')]=_[_0xd1bf('0x30')](_0x2b2d14['model'],_0x2b2d14['query']);_0x1b4054['attributes']=_['intersection'](_0x2b2d14[_0xd1bf('0x2e')],qs[_0xd1bf('0x33')](_0x56b312[_0xd1bf('0x31')][_0xd1bf('0x33')]));_0x1b4054[_0xd1bf('0x32')]=_0x1b4054['attributes'][_0xd1bf('0x4b')]?_0x1b4054[_0xd1bf('0x32')]:_0x2b2d14[_0xd1bf('0x2e')];_0x1b4054[_0xd1bf('0x36')]=qs['sort'](_0x56b312['query'][_0xd1bf('0x37')]);_0x1b4054['where']=qs[_0xd1bf('0x2f')](_['pick'](_0x56b312['query'],_0x2b2d14[_0xd1bf('0x2f')]));if(_0x56b312['query'][_0xd1bf('0x3a')]){_0x1b4054['where']=_[_0xd1bf('0x3c')](_0x1b4054[_0xd1bf('0x38')],{'$or':_[_0xd1bf('0x29')](_0x1b4054[_0xd1bf('0x32')],function(_0x14cb89){var _0x1ef68a={};_0x1ef68a[_0x14cb89]={'$like':'%'+_0x56b312['query']['filter']+'%'};return _0x1ef68a;})});}_0x1b4054=_['merge']({},_0x1b4054,_0x56b312['options']);return _0x5ee121[_0xd1bf('0x4d')](_0x1b4054);}})[_0xd1bf('0x26')](function(_0x20904e){if(_0x20904e){_0x29dc78=_0x20904e[_0xd1bf('0x4b')];if(!_0x56b312[_0xd1bf('0x31')][_0xd1bf('0x34')](_0xd1bf('0x35'))){_0x1b4054[_0xd1bf('0x1d')]=qs['limit'](_0x56b312[_0xd1bf('0x31')][_0xd1bf('0x1d')]);_0x1b4054[_0xd1bf('0x1f')]=qs[_0xd1bf('0x1f')](_0x56b312[_0xd1bf('0x31')][_0xd1bf('0x1f')]);}return _0x5ee121[_0xd1bf('0x4d')](_0x1b4054);}})[_0xd1bf('0x26')](function(_0x4d2143){if(_0x4d2143){return _0x4d2143?{'count':_0x29dc78,'rows':_0x4d2143}:null;}})[_0xd1bf('0x26')](respondWithResult(_0x1cd1dd,null))[_0xd1bf('0x40')](handleError(_0x1cd1dd,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index 4574857..bf2cfd2 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 _0x004c=['../../config/environment','exports','define','SalesforceConfiguration','int_salesforce_configurations','../../config/logger','api','moment','bluebird','request-promise','rimraf'];(function(_0x5d4600,_0x2c572f){var _0x5e71ef=function(_0x4f046f){while(--_0x4f046f){_0x5d4600['push'](_0x5d4600['shift']());}};_0x5e71ef(++_0x2c572f);}(_0x004c,0x1de));var _0xc004=function(_0x35885a,_0x42fed7){_0x35885a=_0x35885a-0x0;var _0xe86249=_0x004c[_0x35885a];return _0xe86249;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xc004('0x0'))(_0xc004('0x1'));var moment=require(_0xc004('0x2'));var BPromise=require(_0xc004('0x3'));var rp=require(_0xc004('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc004('0x5'));var config=require(_0xc004('0x6'));var attributes=require('./intSalesforceConfiguration.attributes');module[_0xc004('0x7')]=function(_0x27a9d6,_0x2b72c1){return _0x27a9d6[_0xc004('0x8')](_0xc004('0x9'),attributes,{'tableName':_0xc004('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdc84=['../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./intSalesforceConfiguration.attributes','exports','define','SalesforceConfiguration','int_salesforce_configurations','lodash','util'];(function(_0x4a5f3d,_0x3902a8){var _0xadc96f=function(_0x1ab8d2){while(--_0x1ab8d2){_0x4a5f3d['push'](_0x4a5f3d['shift']());}};_0xadc96f(++_0x3902a8);}(_0xdc84,0x132));var _0x4dc8=function(_0x22342c,_0x218835){_0x22342c=_0x22342c-0x0;var _0xd3b434=_0xdc84[_0x22342c];return _0xd3b434;};'use strict';var _=require(_0x4dc8('0x0'));var util=require(_0x4dc8('0x1'));var logger=require(_0x4dc8('0x2'))(_0x4dc8('0x3'));var moment=require(_0x4dc8('0x4'));var BPromise=require(_0x4dc8('0x5'));var rp=require(_0x4dc8('0x6'));var fs=require('fs');var path=require(_0x4dc8('0x7'));var rimraf=require('rimraf');var config=require(_0x4dc8('0x8'));var attributes=require(_0x4dc8('0x9'));module[_0x4dc8('0xa')]=function(_0x5df835,_0x308080){return _0x5df835[_0x4dc8('0xb')](_0x4dc8('0xc'),attributes,{'tableName':_0x4dc8('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.rpc.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.rpc.js index 15382e3..13fb0d7 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 _0x0d9f=['client','http','request','then','info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x0d9f,0xf4));var _0xf0d9=function(_0x1b1e76,_0x31695b){_0x1b1e76=_0x1b1e76-0x0;var _0x3d743a=_0x0d9f[_0x1b1e76];return _0x3d743a;};'use strict';var _=require(_0xf0d9('0x0'));var util=require(_0xf0d9('0x1'));var moment=require(_0xf0d9('0x2'));var BPromise=require('bluebird');var rs=require(_0xf0d9('0x3'));var fs=require('fs');var Redis=require(_0xf0d9('0x4'));var db=require(_0xf0d9('0x5'))['db'];var utils=require(_0xf0d9('0x6'));var logger=require(_0xf0d9('0x7'))('rpc');var config=require(_0xf0d9('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xf0d9('0x9')][_0xf0d9('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x18a691,_0x13ef44,_0x2bbc7c){return new BPromise(function(_0x4be50d,_0x4f85a3){return client[_0xf0d9('0xb')](_0x18a691,_0x2bbc7c)[_0xf0d9('0xc')](function(_0x330ac1){logger[_0xf0d9('0xd')](_0xf0d9('0xe'),_0x13ef44,_0xf0d9('0xf'));logger['debug'](_0xf0d9('0x10'),_0x13ef44,_0xf0d9('0xf'),JSON[_0xf0d9('0x11')](_0x330ac1));if(_0x330ac1[_0xf0d9('0x12')]){if(_0x330ac1[_0xf0d9('0x12')][_0xf0d9('0x13')]===0x1f4){logger['error'](_0xf0d9('0xe'),_0x13ef44,_0x330ac1[_0xf0d9('0x12')]['message']);return _0x4f85a3(_0x330ac1['error']['message']);}logger[_0xf0d9('0x12')](_0xf0d9('0xe'),_0x13ef44,_0x330ac1[_0xf0d9('0x12')][_0xf0d9('0x14')]);return _0x4be50d(_0x330ac1[_0xf0d9('0x12')]['message']);}else{logger['info']('SalesforceConfiguration,\x20%s,\x20%s',_0x13ef44,'request\x20sent');_0x4be50d(_0x330ac1[_0xf0d9('0x15')]['message']);}})[_0xf0d9('0x16')](function(_0x5e2281){logger[_0xf0d9('0x12')]('SalesforceConfiguration,\x20%s,\x20%s',_0x13ef44,_0x5e2281);_0x4f85a3(_0x5e2281);});});} \ No newline at end of file +var _0xf2da=['http','request','then','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','SalesforceConfiguration,\x20%s,\x20%s','message','info','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x3b1832,_0x3e7cff){var _0x5e2bc5=function(_0x369a0e){while(--_0x369a0e){_0x3b1832['push'](_0x3b1832['shift']());}};_0x5e2bc5(++_0x3e7cff);}(_0xf2da,0xd1));var _0xaf2d=function(_0x69a451,_0x49fd37){_0x69a451=_0x69a451-0x0;var _0x3d6ef5=_0xf2da[_0x69a451];return _0x3d6ef5;};'use strict';var _=require(_0xaf2d('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xaf2d('0x1'));var rs=require(_0xaf2d('0x2'));var fs=require('fs');var Redis=require(_0xaf2d('0x3'));var db=require(_0xaf2d('0x4'))['db'];var utils=require(_0xaf2d('0x5'));var logger=require(_0xaf2d('0x6'))(_0xaf2d('0x7'));var config=require(_0xaf2d('0x8'));var jayson=require(_0xaf2d('0x9'));var client=jayson[_0xaf2d('0xa')][_0xaf2d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x528f6e,_0x6bf7de,_0x1b4fa6){return new BPromise(function(_0x140270,_0xeb1d2c){return client[_0xaf2d('0xc')](_0x528f6e,_0x1b4fa6)[_0xaf2d('0xd')](function(_0x5e9a95){logger['info']('SalesforceConfiguration,\x20%s,\x20%s',_0x6bf7de,'request\x20sent');logger[_0xaf2d('0xe')](_0xaf2d('0xf'),_0x6bf7de,_0xaf2d('0x10'),JSON[_0xaf2d('0x11')](_0x5e9a95));if(_0x5e9a95[_0xaf2d('0x12')]){if(_0x5e9a95['error']['code']===0x1f4){logger['error'](_0xaf2d('0x13'),_0x6bf7de,_0x5e9a95['error']['message']);return _0xeb1d2c(_0x5e9a95[_0xaf2d('0x12')][_0xaf2d('0x14')]);}logger[_0xaf2d('0x12')](_0xaf2d('0x13'),_0x6bf7de,_0x5e9a95['error'][_0xaf2d('0x14')]);return _0x140270(_0x5e9a95[_0xaf2d('0x12')][_0xaf2d('0x14')]);}else{logger[_0xaf2d('0x15')](_0xaf2d('0x13'),_0x6bf7de,_0xaf2d('0x10'));_0x140270(_0x5e9a95['result'][_0xaf2d('0x14')]);}})['catch'](function(_0x15ea11){logger[_0xaf2d('0x12')](_0xaf2d('0x13'),_0x6bf7de,_0x15ea11);_0xeb1d2c(_0x15ea11);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index 884a048..615f404 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 _0x91d6=['get','/:id','create','put','update','delete','destroy','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceField.controller','isAuthenticated','index'];(function(_0x345690,_0xd8f66a){var _0x200bb5=function(_0x11236c){while(--_0x11236c){_0x345690['push'](_0x345690['shift']());}};_0x200bb5(++_0xd8f66a);}(_0x91d6,0x15e));var _0x691d=function(_0xc4001c,_0x1bf8f0){_0xc4001c=_0xc4001c-0x0;var _0x49f7bc=_0x91d6[_0xc4001c];return _0x49f7bc;};'use strict';var multer=require(_0x691d('0x0'));var util=require(_0x691d('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x691d('0x2'));var router=express[_0x691d('0x3')]();var fs_extra=require(_0x691d('0x4'));var auth=require(_0x691d('0x5'));var interaction=require(_0x691d('0x6'));var config=require(_0x691d('0x7'));var controller=require(_0x691d('0x8'));router['get']('/',auth[_0x691d('0x9')](),controller[_0x691d('0xa')]);router[_0x691d('0xb')](_0x691d('0xc'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0x691d('0x9')](),controller[_0x691d('0xd')]);router[_0x691d('0xe')](_0x691d('0xc'),auth[_0x691d('0x9')](),controller[_0x691d('0xf')]);router[_0x691d('0x10')](_0x691d('0xc'),auth['isAuthenticated'](),controller[_0x691d('0x11')]);module[_0x691d('0x12')]=router; \ No newline at end of file +var _0x1fc1=['multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceField.controller','get','isAuthenticated','index','/:id','show','create','put'];(function(_0x42be26,_0x105f3f){var _0x221b19=function(_0x3554ba){while(--_0x3554ba){_0x42be26['push'](_0x42be26['shift']());}};_0x221b19(++_0x105f3f);}(_0x1fc1,0x154));var _0x11fc=function(_0x212588,_0x2e76d8){_0x212588=_0x212588-0x0;var _0x365f74=_0x1fc1[_0x212588];return _0x365f74;};'use strict';var multer=require(_0x11fc('0x0'));var util=require(_0x11fc('0x1'));var path=require(_0x11fc('0x2'));var timeout=require('connect-timeout');var express=require(_0x11fc('0x3'));var router=express[_0x11fc('0x4')]();var fs_extra=require(_0x11fc('0x5'));var auth=require(_0x11fc('0x6'));var interaction=require(_0x11fc('0x7'));var config=require(_0x11fc('0x8'));var controller=require(_0x11fc('0x9'));router[_0x11fc('0xa')]('/',auth[_0x11fc('0xb')](),controller[_0x11fc('0xc')]);router[_0x11fc('0xa')](_0x11fc('0xd'),auth[_0x11fc('0xb')](),controller[_0x11fc('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0x11fc('0xf')]);router[_0x11fc('0x10')]('/:id',auth[_0x11fc('0xb')](),controller['update']);router['delete'](_0x11fc('0xd'),auth[_0x11fc('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.attributes.js b/server/api/intSalesforceField/intSalesforceField.attributes.js index 7201ce8..5fa7f9f 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 _0xaac4=['string','variable','STRING','sequelize','exports','customVariable'];(function(_0xbb9a59,_0x422b0f){var _0x3bf326=function(_0x386f7d){while(--_0x386f7d){_0xbb9a59['push'](_0xbb9a59['shift']());}};_0x3bf326(++_0x422b0f);}(_0xaac4,0x19b));var _0x4aac=function(_0x774a25,_0x46f547){_0x774a25=_0x774a25-0x0;var _0x3dc2fd=_0xaac4[_0x774a25];return _0x3dc2fd;};'use strict';var Sequelize=require(_0x4aac('0x0'));module[_0x4aac('0x1')]={'type':{'type':Sequelize['ENUM']('string','variable',_0x4aac('0x2'),'keyValue','picklist'),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM'](_0x4aac('0x3'),_0x4aac('0x4'),'customVariable')},'keyContent':{'type':Sequelize[_0x4aac('0x5')]},'idField':{'type':Sequelize[_0x4aac('0x5')]},'variableName':{'type':Sequelize[_0x4aac('0x5')]}}; \ No newline at end of file +var _0x68d9=['exports','ENUM','string','variable','customVariable','keyValue','picklist','STRING','sequelize'];(function(_0x3465b0,_0x594297){var _0x5cabe3=function(_0x121b5f){while(--_0x121b5f){_0x3465b0['push'](_0x3465b0['shift']());}};_0x5cabe3(++_0x594297);}(_0x68d9,0x6b));var _0x968d=function(_0x54bfd5,_0x4ba093){_0x54bfd5=_0x54bfd5-0x0;var _0x9bb31e=_0x68d9[_0x54bfd5];return _0x9bb31e;};'use strict';var Sequelize=require(_0x968d('0x0'));module[_0x968d('0x1')]={'type':{'type':Sequelize[_0x968d('0x2')](_0x968d('0x3'),_0x968d('0x4'),_0x968d('0x5'),_0x968d('0x6'),_0x968d('0x7')),'defaultValue':_0x968d('0x3')},'content':{'type':Sequelize[_0x968d('0x8')]},'key':{'type':Sequelize[_0x968d('0x8')]},'keyType':{'type':Sequelize['ENUM']('string',_0x968d('0x4'),_0x968d('0x5'))},'keyContent':{'type':Sequelize[_0x968d('0x8')]},'idField':{'type':Sequelize[_0x968d('0x8')]},'variableName':{'type':Sequelize[_0x968d('0x8')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.controller.js b/server/api/intSalesforceField/intSalesforceField.controller.js index fb737a1..1225bf0 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 _0x257c=['order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','params','fields','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','error','name','send','index','SalesforceField','rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','model','attributes','length','hasOwnProperty','nolimit'];(function(_0x7e2389,_0x192bcf){var _0x17a1bb=function(_0x582713){while(--_0x582713){_0x7e2389['push'](_0x7e2389['shift']());}};_0x17a1bb(++_0x192bcf);}(_0x257c,0x1ec));var _0xc257=function(_0x151381,_0x97b314){_0x151381=_0x151381-0x0;var _0x2afab6=_0x257c[_0x151381];return _0x2afab6;};'use strict';var emlformat=require(_0xc257('0x0'));var rimraf=require(_0xc257('0x1'));var zipdir=require(_0xc257('0x2'));var jsonpatch=require(_0xc257('0x3'));var rp=require(_0xc257('0x4'));var moment=require(_0xc257('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xc257('0x6'));var path=require(_0xc257('0x7'));var sox=require(_0xc257('0x8'));var csv=require('to-csv');var ejs=require(_0xc257('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc257('0xa'));var squel=require(_0xc257('0xb'));var crypto=require(_0xc257('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xc257('0xd'));var toCsv=require(_0xc257('0xe'));var querystring=require(_0xc257('0xf'));var Papa=require(_0xc257('0x10'));var Redis=require(_0xc257('0x11'));var authService=require(_0xc257('0x12'));var qs=require(_0xc257('0x13'));var as=require(_0xc257('0x14'));var hardwareService=require(_0xc257('0x15'));var logger=require(_0xc257('0x16'))(_0xc257('0x17'));var utils=require(_0xc257('0x18'));var config=require(_0xc257('0x19'));var licenseUtil=require(_0xc257('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x25a6f9,_0x597dbe){_0x597dbe=_0x597dbe||0xcc;return function(_0x1b30a8){if(_0x1b30a8){return _0x25a6f9[_0xc257('0x1b')](_0x597dbe);}return _0x25a6f9[_0xc257('0x1c')](_0x597dbe)[_0xc257('0x1d')]();};}function respondWithResult(_0x33abbc,_0x5ccbca){_0x5ccbca=_0x5ccbca||0xc8;return function(_0x4e7f11){if(_0x4e7f11){return _0x33abbc['status'](_0x5ccbca)[_0xc257('0x1e')](_0x4e7f11);}};}function respondWithFilteredResult(_0x2dc79b,_0x250560){return function(_0x4dde18){if(_0x4dde18){var _0x2f9029=typeof _0x250560[_0xc257('0x1f')]===_0xc257('0x20')&&typeof _0x250560[_0xc257('0x21')]===_0xc257('0x20');var _0x1fb1c8=_0x4dde18[_0xc257('0x22')];var _0x35897b=_0x2f9029?0x0:_0x250560[_0xc257('0x1f')];var _0x1e83e9=_0x2f9029?_0x4dde18['count']:_0x250560['offset']+_0x250560['limit'];var _0x5701f7;if(_0x1e83e9>=_0x1fb1c8){_0x1e83e9=_0x1fb1c8;_0x5701f7=0xc8;}else{_0x5701f7=0xce;}_0x2dc79b['status'](_0x5701f7);return _0x2dc79b['set'](_0xc257('0x23'),_0x35897b+'-'+_0x1e83e9+'/'+_0x1fb1c8)[_0xc257('0x1e')](_0x4dde18);}return null;};}function patchUpdates(_0x28bc54){return function(_0xc6e3e7){try{jsonpatch[_0xc257('0x24')](_0xc6e3e7,_0x28bc54,!![]);}catch(_0x18e792){return BPromise[_0xc257('0x25')](_0x18e792);}return _0xc6e3e7[_0xc257('0x26')]();};}function saveUpdates(_0x1058ee,_0x78be66){return function(_0xf120e0){if(_0xf120e0){return _0xf120e0[_0xc257('0x27')](_0x1058ee)[_0xc257('0x28')](function(_0x1c2185){return _0x1c2185;});}return null;};}function removeEntity(_0x31fc25,_0x483f5c){return function(_0x2e01d4){if(_0x2e01d4){return _0x2e01d4[_0xc257('0x29')]()[_0xc257('0x28')](function(){_0x31fc25[_0xc257('0x1c')](0xcc)[_0xc257('0x1d')]();});}};}function handleEntityNotFound(_0x3f8ee3,_0x59f844){return function(_0x59adfd){if(!_0x59adfd){_0x3f8ee3[_0xc257('0x1b')](0x194);}return _0x59adfd;};}function handleError(_0x136f18,_0x14e70c){_0x14e70c=_0x14e70c||0x1f4;return function(_0x1ca434){logger[_0xc257('0x2a')](_0x1ca434['stack']);if(_0x1ca434[_0xc257('0x2b')]){delete _0x1ca434[_0xc257('0x2b')];}_0x136f18[_0xc257('0x1c')](_0x14e70c)[_0xc257('0x2c')](_0x1ca434);};}exports[_0xc257('0x2d')]=function(_0x30ef20,_0x1656df){var _0x25a689={},_0x43371c={},_0x2ef8fb={'count':0x0,'rows':[]};var _0x4d7ada=_['map'](db[_0xc257('0x2e')][_0xc257('0x2f')],function(_0x6e1547){return{'name':_0x6e1547[_0xc257('0x30')],'type':_0x6e1547[_0xc257('0x31')][_0xc257('0x32')]};});_0x43371c['model']=_[_0xc257('0x33')](_0x4d7ada,_0xc257('0x2b'));_0x43371c[_0xc257('0x34')]=_[_0xc257('0x35')](_0x30ef20[_0xc257('0x34')]);_0x43371c[_0xc257('0x36')]=_[_0xc257('0x37')](_0x43371c[_0xc257('0x38')],_0x43371c[_0xc257('0x34')]);_0x25a689[_0xc257('0x39')]=_[_0xc257('0x37')](_0x43371c[_0xc257('0x38')],qs['fields'](_0x30ef20[_0xc257('0x34')]['fields']));_0x25a689[_0xc257('0x39')]=_0x25a689[_0xc257('0x39')][_0xc257('0x3a')]?_0x25a689[_0xc257('0x39')]:_0x43371c[_0xc257('0x38')];if(!_0x30ef20[_0xc257('0x34')][_0xc257('0x3b')](_0xc257('0x3c'))){_0x25a689[_0xc257('0x21')]=qs[_0xc257('0x21')](_0x30ef20[_0xc257('0x34')][_0xc257('0x21')]);_0x25a689[_0xc257('0x1f')]=qs['offset'](_0x30ef20[_0xc257('0x34')][_0xc257('0x1f')]);}_0x25a689[_0xc257('0x3d')]=qs['sort'](_0x30ef20[_0xc257('0x34')][_0xc257('0x3e')]);_0x25a689[_0xc257('0x3f')]=qs[_0xc257('0x36')](_[_0xc257('0x40')](_0x30ef20[_0xc257('0x34')],_0x43371c[_0xc257('0x36')]),_0x4d7ada);if(_0x30ef20[_0xc257('0x34')]['filter']){_0x25a689[_0xc257('0x3f')]=_[_0xc257('0x41')](_0x25a689[_0xc257('0x3f')],{'$or':_['map'](_0x4d7ada,function(_0x72aaaa){if(_0x72aaaa[_0xc257('0x31')]!==_0xc257('0x42')){var _0x513acf={};_0x513acf[_0x72aaaa[_0xc257('0x2b')]]={'$like':'%'+_0x30ef20['query'][_0xc257('0x43')]+'%'};return _0x513acf;}})});}_0x25a689=_['merge']({},_0x25a689,_0x30ef20[_0xc257('0x44')]);var _0x32142b={'where':_0x25a689[_0xc257('0x3f')]};return db[_0xc257('0x2e')][_0xc257('0x22')](_0x32142b)[_0xc257('0x28')](function(_0x39d8ed){_0x2ef8fb[_0xc257('0x22')]=_0x39d8ed;if(_0x30ef20[_0xc257('0x34')][_0xc257('0x45')]){_0x25a689[_0xc257('0x46')]=[{'all':!![]}];}return db[_0xc257('0x2e')][_0xc257('0x47')](_0x25a689);})[_0xc257('0x28')](function(_0x1e5fbd){_0x2ef8fb[_0xc257('0x48')]=_0x1e5fbd;return _0x2ef8fb;})[_0xc257('0x28')](respondWithFilteredResult(_0x1656df,_0x25a689))[_0xc257('0x49')](handleError(_0x1656df,null));};exports['show']=function(_0x40663a,_0x15b349){var _0x313f1d={'raw':!![],'where':{'id':_0x40663a[_0xc257('0x4a')]['id']}},_0x4cd72c={};_0x4cd72c['model']=_[_0xc257('0x35')](db[_0xc257('0x2e')][_0xc257('0x2f')]);_0x4cd72c[_0xc257('0x34')]=_[_0xc257('0x35')](_0x40663a[_0xc257('0x34')]);_0x4cd72c[_0xc257('0x36')]=_['intersection'](_0x4cd72c['model'],_0x4cd72c[_0xc257('0x34')]);_0x313f1d[_0xc257('0x39')]=_[_0xc257('0x37')](_0x4cd72c[_0xc257('0x38')],qs[_0xc257('0x4b')](_0x40663a[_0xc257('0x34')]['fields']));_0x313f1d[_0xc257('0x39')]=_0x313f1d[_0xc257('0x39')][_0xc257('0x3a')]?_0x313f1d[_0xc257('0x39')]:_0x4cd72c[_0xc257('0x38')];if(_0x40663a[_0xc257('0x34')][_0xc257('0x45')]){_0x313f1d[_0xc257('0x46')]=[{'all':!![]}];}_0x313f1d=_[_0xc257('0x41')]({},_0x313f1d,_0x40663a[_0xc257('0x44')]);return db['SalesforceField'][_0xc257('0x4c')](_0x313f1d)['then'](handleEntityNotFound(_0x15b349,null))[_0xc257('0x28')](respondWithResult(_0x15b349,null))[_0xc257('0x49')](handleError(_0x15b349,null));};exports[_0xc257('0x4d')]=function(_0x51c044,_0x5ca823){return db['SalesforceField'][_0xc257('0x4d')](_0x51c044[_0xc257('0x4e')],{})[_0xc257('0x28')](respondWithResult(_0x5ca823,0xc9))['catch'](handleError(_0x5ca823,null));};exports[_0xc257('0x27')]=function(_0x2a2189,_0x184d02){if(_0x2a2189['body']['id']){delete _0x2a2189['body']['id'];}return db['SalesforceField'][_0xc257('0x4c')]({'where':{'id':_0x2a2189[_0xc257('0x4a')]['id']}})['then'](handleEntityNotFound(_0x184d02,null))['then'](saveUpdates(_0x2a2189[_0xc257('0x4e')],null))[_0xc257('0x28')](respondWithResult(_0x184d02,null))[_0xc257('0x49')](handleError(_0x184d02,null));};exports[_0xc257('0x29')]=function(_0x467a6e,_0x45116f){return db[_0xc257('0x2e')][_0xc257('0x4c')]({'where':{'id':_0x467a6e['params']['id']}})['then'](handleEntityNotFound(_0x45116f,null))[_0xc257('0x28')](removeEntity(_0x45116f,null))[_0xc257('0x49')](handleError(_0x45116f,null));}; \ No newline at end of file +var _0xda94=['limit','count','offset','set','Content-Range','save','update','then','destroy','error','stack','name','index','map','SalesforceField','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','options','findAll','rows','catch','show','params','keys','rawAttributes','includeAll','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined'];(function(_0x2fdc1f,_0x1be5ce){var _0x1e6857=function(_0xd00861){while(--_0xd00861){_0x2fdc1f['push'](_0x2fdc1f['shift']());}};_0x1e6857(++_0x1be5ce);}(_0xda94,0x77));var _0x4da9=function(_0x4792c8,_0x5158a1){_0x4792c8=_0x4792c8-0x0;var _0x35edb1=_0xda94[_0x4792c8];return _0x35edb1;};'use strict';var emlformat=require(_0x4da9('0x0'));var rimraf=require(_0x4da9('0x1'));var zipdir=require(_0x4da9('0x2'));var jsonpatch=require(_0x4da9('0x3'));var rp=require('request-promise');var moment=require(_0x4da9('0x4'));var BPromise=require(_0x4da9('0x5'));var Mustache=require('mustache');var util=require(_0x4da9('0x6'));var path=require(_0x4da9('0x7'));var sox=require(_0x4da9('0x8'));var csv=require(_0x4da9('0x9'));var ejs=require(_0x4da9('0xa'));var fs=require('fs');var fs_extra=require(_0x4da9('0xb'));var _=require(_0x4da9('0xc'));var squel=require('squel');var crypto=require(_0x4da9('0xd'));var jsforce=require(_0x4da9('0xe'));var deskjs=require(_0x4da9('0xf'));var toCsv=require(_0x4da9('0x9'));var querystring=require(_0x4da9('0x10'));var Papa=require(_0x4da9('0x11'));var Redis=require(_0x4da9('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x4da9('0x13'));var as=require(_0x4da9('0x14'));var hardwareService=require(_0x4da9('0x15'));var logger=require('../../config/logger')(_0x4da9('0x16'));var utils=require(_0x4da9('0x17'));var config=require(_0x4da9('0x18'));var licenseUtil=require(_0x4da9('0x19'));var db=require(_0x4da9('0x1a'))['db'];function respondWithStatusCode(_0x16c674,_0x4fcca1){_0x4fcca1=_0x4fcca1||0xcc;return function(_0x239a1c){if(_0x239a1c){return _0x16c674[_0x4da9('0x1b')](_0x4fcca1);}return _0x16c674[_0x4da9('0x1c')](_0x4fcca1)[_0x4da9('0x1d')]();};}function respondWithResult(_0x119804,_0x30c0ee){_0x30c0ee=_0x30c0ee||0xc8;return function(_0x47f329){if(_0x47f329){return _0x119804[_0x4da9('0x1c')](_0x30c0ee)['json'](_0x47f329);}};}function respondWithFilteredResult(_0x44cda1,_0x3306df){return function(_0xdc8a10){if(_0xdc8a10){var _0x211688=typeof _0x3306df['offset']===_0x4da9('0x1e')&&typeof _0x3306df[_0x4da9('0x1f')]===_0x4da9('0x1e');var _0x290304=_0xdc8a10[_0x4da9('0x20')];var _0x58de11=_0x211688?0x0:_0x3306df[_0x4da9('0x21')];var _0x5a0fdb=_0x211688?_0xdc8a10['count']:_0x3306df[_0x4da9('0x21')]+_0x3306df[_0x4da9('0x1f')];var _0x2b75b0;if(_0x5a0fdb>=_0x290304){_0x5a0fdb=_0x290304;_0x2b75b0=0xc8;}else{_0x2b75b0=0xce;}_0x44cda1[_0x4da9('0x1c')](_0x2b75b0);return _0x44cda1[_0x4da9('0x22')](_0x4da9('0x23'),_0x58de11+'-'+_0x5a0fdb+'/'+_0x290304)['json'](_0xdc8a10);}return null;};}function patchUpdates(_0x56e1fc){return function(_0x1b3795){try{jsonpatch['apply'](_0x1b3795,_0x56e1fc,!![]);}catch(_0x1fc2c0){return BPromise['reject'](_0x1fc2c0);}return _0x1b3795[_0x4da9('0x24')]();};}function saveUpdates(_0x527369,_0x300b97){return function(_0x5a62f6){if(_0x5a62f6){return _0x5a62f6[_0x4da9('0x25')](_0x527369)[_0x4da9('0x26')](function(_0x193ad4){return _0x193ad4;});}return null;};}function removeEntity(_0x38a8c4,_0x19c508){return function(_0x45ab3d){if(_0x45ab3d){return _0x45ab3d[_0x4da9('0x27')]()[_0x4da9('0x26')](function(){_0x38a8c4[_0x4da9('0x1c')](0xcc)[_0x4da9('0x1d')]();});}};}function handleEntityNotFound(_0xa2c40f,_0x59061f){return function(_0x38e633){if(!_0x38e633){_0xa2c40f[_0x4da9('0x1b')](0x194);}return _0x38e633;};}function handleError(_0x1679ff,_0x4bf044){_0x4bf044=_0x4bf044||0x1f4;return function(_0x1b30e6){logger[_0x4da9('0x28')](_0x1b30e6[_0x4da9('0x29')]);if(_0x1b30e6[_0x4da9('0x2a')]){delete _0x1b30e6[_0x4da9('0x2a')];}_0x1679ff[_0x4da9('0x1c')](_0x4bf044)['send'](_0x1b30e6);};}exports[_0x4da9('0x2b')]=function(_0x32dabb,_0x91024d){var _0x41022d={},_0x4d3c56={},_0x5722c1={'count':0x0,'rows':[]};var _0x354aec=_[_0x4da9('0x2c')](db[_0x4da9('0x2d')]['rawAttributes'],function(_0x1017ba){return{'name':_0x1017ba[_0x4da9('0x2e')],'type':_0x1017ba[_0x4da9('0x2f')][_0x4da9('0x30')]};});_0x4d3c56['model']=_[_0x4da9('0x2c')](_0x354aec,'name');_0x4d3c56['query']=_['keys'](_0x32dabb[_0x4da9('0x31')]);_0x4d3c56[_0x4da9('0x32')]=_[_0x4da9('0x33')](_0x4d3c56[_0x4da9('0x34')],_0x4d3c56[_0x4da9('0x31')]);_0x41022d[_0x4da9('0x35')]=_['intersection'](_0x4d3c56[_0x4da9('0x34')],qs[_0x4da9('0x36')](_0x32dabb['query']['fields']));_0x41022d[_0x4da9('0x35')]=_0x41022d['attributes'][_0x4da9('0x37')]?_0x41022d[_0x4da9('0x35')]:_0x4d3c56[_0x4da9('0x34')];if(!_0x32dabb[_0x4da9('0x31')][_0x4da9('0x38')]('nolimit')){_0x41022d['limit']=qs['limit'](_0x32dabb[_0x4da9('0x31')][_0x4da9('0x1f')]);_0x41022d[_0x4da9('0x21')]=qs[_0x4da9('0x21')](_0x32dabb[_0x4da9('0x31')][_0x4da9('0x21')]);}_0x41022d['order']=qs[_0x4da9('0x39')](_0x32dabb[_0x4da9('0x31')][_0x4da9('0x39')]);_0x41022d[_0x4da9('0x3a')]=qs[_0x4da9('0x32')](_[_0x4da9('0x3b')](_0x32dabb[_0x4da9('0x31')],_0x4d3c56[_0x4da9('0x32')]),_0x354aec);if(_0x32dabb[_0x4da9('0x31')][_0x4da9('0x3c')]){_0x41022d[_0x4da9('0x3a')]=_[_0x4da9('0x3d')](_0x41022d[_0x4da9('0x3a')],{'$or':_[_0x4da9('0x2c')](_0x354aec,function(_0x56c6b0){if(_0x56c6b0['type']!==_0x4da9('0x3e')){var _0x267b1b={};_0x267b1b[_0x56c6b0[_0x4da9('0x2a')]]={'$like':'%'+_0x32dabb[_0x4da9('0x31')][_0x4da9('0x3c')]+'%'};return _0x267b1b;}})});}_0x41022d=_[_0x4da9('0x3d')]({},_0x41022d,_0x32dabb[_0x4da9('0x3f')]);var _0x5dda54={'where':_0x41022d['where']};return db[_0x4da9('0x2d')][_0x4da9('0x20')](_0x5dda54)[_0x4da9('0x26')](function(_0x86af69){_0x5722c1['count']=_0x86af69;if(_0x32dabb['query']['includeAll']){_0x41022d['include']=[{'all':!![]}];}return db['SalesforceField'][_0x4da9('0x40')](_0x41022d);})[_0x4da9('0x26')](function(_0x5e94c1){_0x5722c1[_0x4da9('0x41')]=_0x5e94c1;return _0x5722c1;})[_0x4da9('0x26')](respondWithFilteredResult(_0x91024d,_0x41022d))[_0x4da9('0x42')](handleError(_0x91024d,null));};exports[_0x4da9('0x43')]=function(_0x285c3f,_0x706e90){var _0x27c022={'raw':!![],'where':{'id':_0x285c3f[_0x4da9('0x44')]['id']}},_0x1394f7={};_0x1394f7['model']=_[_0x4da9('0x45')](db[_0x4da9('0x2d')][_0x4da9('0x46')]);_0x1394f7['query']=_[_0x4da9('0x45')](_0x285c3f['query']);_0x1394f7[_0x4da9('0x32')]=_['intersection'](_0x1394f7['model'],_0x1394f7[_0x4da9('0x31')]);_0x27c022['attributes']=_['intersection'](_0x1394f7[_0x4da9('0x34')],qs[_0x4da9('0x36')](_0x285c3f[_0x4da9('0x31')][_0x4da9('0x36')]));_0x27c022['attributes']=_0x27c022[_0x4da9('0x35')][_0x4da9('0x37')]?_0x27c022[_0x4da9('0x35')]:_0x1394f7['model'];if(_0x285c3f[_0x4da9('0x31')][_0x4da9('0x47')]){_0x27c022['include']=[{'all':!![]}];}_0x27c022=_[_0x4da9('0x3d')]({},_0x27c022,_0x285c3f[_0x4da9('0x3f')]);return db[_0x4da9('0x2d')][_0x4da9('0x48')](_0x27c022)[_0x4da9('0x26')](handleEntityNotFound(_0x706e90,null))[_0x4da9('0x26')](respondWithResult(_0x706e90,null))[_0x4da9('0x42')](handleError(_0x706e90,null));};exports[_0x4da9('0x49')]=function(_0x4c84b9,_0x500dc4){return db['SalesforceField']['create'](_0x4c84b9['body'],{})[_0x4da9('0x26')](respondWithResult(_0x500dc4,0xc9))['catch'](handleError(_0x500dc4,null));};exports['update']=function(_0x4577d3,_0x2b9987){if(_0x4577d3[_0x4da9('0x4a')]['id']){delete _0x4577d3['body']['id'];}return db[_0x4da9('0x2d')]['find']({'where':{'id':_0x4577d3['params']['id']}})['then'](handleEntityNotFound(_0x2b9987,null))[_0x4da9('0x26')](saveUpdates(_0x4577d3[_0x4da9('0x4a')],null))[_0x4da9('0x26')](respondWithResult(_0x2b9987,null))[_0x4da9('0x42')](handleError(_0x2b9987,null));};exports['destroy']=function(_0x124c3d,_0xc18c7f){return db['SalesforceField']['find']({'where':{'id':_0x124c3d[_0x4da9('0x44')]['id']}})['then'](handleEntityNotFound(_0xc18c7f,null))['then'](removeEntity(_0xc18c7f,null))[_0x4da9('0x42')](handleError(_0xc18c7f,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index 7f598a5..2c0d495 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 _0xfeaa=['rimraf','../../config/environment','./intSalesforceField.attributes','define','SalesforceField','int_salesforce_fields','FieldId','lodash','api','moment','request-promise'];(function(_0x54bac5,_0x8d3a16){var _0xc15971=function(_0x254653){while(--_0x254653){_0x54bac5['push'](_0x54bac5['shift']());}};_0xc15971(++_0x8d3a16);}(_0xfeaa,0x193));var _0xafea=function(_0x59a0e0,_0x1ef52c){_0x59a0e0=_0x59a0e0-0x0;var _0x51a1b3=_0xfeaa[_0x59a0e0];return _0x51a1b3;};'use strict';var _=require(_0xafea('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xafea('0x1'));var moment=require(_0xafea('0x2'));var BPromise=require('bluebird');var rp=require(_0xafea('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xafea('0x4'));var config=require(_0xafea('0x5'));var attributes=require(_0xafea('0x6'));module['exports']=function(_0x97da30,_0x4d8221){return _0x97da30[_0xafea('0x7')](_0xafea('0x8'),attributes,{'tableName':_0xafea('0x9'),'paranoid':![],'indexes':[{'name':'salesforce_unique_index','fields':['idField',_0xafea('0xa')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb84f=['path','rimraf','./intSalesforceField.attributes','exports','define','SalesforceField','int_salesforce_fields','salesforce_unique_index','idField','lodash','util','api','moment','bluebird'];(function(_0x4c3d14,_0x16bc41){var _0x54cfde=function(_0x2d6ea5){while(--_0x2d6ea5){_0x4c3d14['push'](_0x4c3d14['shift']());}};_0x54cfde(++_0x16bc41);}(_0xb84f,0x113));var _0xfb84=function(_0x44ad29,_0x3f5205){_0x44ad29=_0x44ad29-0x0;var _0x33fa3e=_0xb84f[_0x44ad29];return _0x33fa3e;};'use strict';var _=require(_0xfb84('0x0'));var util=require(_0xfb84('0x1'));var logger=require('../../config/logger')(_0xfb84('0x2'));var moment=require(_0xfb84('0x3'));var BPromise=require(_0xfb84('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xfb84('0x5'));var rimraf=require(_0xfb84('0x6'));var config=require('../../config/environment');var attributes=require(_0xfb84('0x7'));module[_0xfb84('0x8')]=function(_0x518f5e,_0x1aff3c){return _0x518f5e[_0xfb84('0x9')](_0xfb84('0xa'),attributes,{'tableName':_0xfb84('0xb'),'paranoid':![],'indexes':[{'name':_0xfb84('0xc'),'fields':[_0xfb84('0xd'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.rpc.js b/server/api/intSalesforceField/intSalesforceField.rpc.js index 8f25473..2cc7647 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 _0x83c6=['../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info','SalesforceField,\x20%s,\x20%s','request\x20sent','debug','SalesforceField,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0x83c6,0x1c6));var _0x683c=function(_0x2cf3c6,_0x22a2dd){_0x2cf3c6=_0x2cf3c6-0x0;var _0x54792b=_0x83c6[_0x2cf3c6];return _0x54792b;};'use strict';var _=require(_0x683c('0x0'));var util=require(_0x683c('0x1'));var moment=require(_0x683c('0x2'));var BPromise=require(_0x683c('0x3'));var rs=require(_0x683c('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x683c('0x5'))['db'];var utils=require(_0x683c('0x6'));var logger=require(_0x683c('0x7'))(_0x683c('0x8'));var config=require('../../config/environment');var jayson=require(_0x683c('0x9'));var client=jayson[_0x683c('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x359ceb,_0x584424,_0x487450){return new BPromise(function(_0x38c6fb,_0x1be6f6){return client[_0x683c('0xb')](_0x359ceb,_0x487450)[_0x683c('0xc')](function(_0x137713){logger[_0x683c('0xd')](_0x683c('0xe'),_0x584424,_0x683c('0xf'));logger[_0x683c('0x10')](_0x683c('0x11'),_0x584424,'request\x20sent',JSON[_0x683c('0x12')](_0x137713));if(_0x137713[_0x683c('0x13')]){if(_0x137713[_0x683c('0x13')]['code']===0x1f4){logger[_0x683c('0x13')]('SalesforceField,\x20%s,\x20%s',_0x584424,_0x137713[_0x683c('0x13')][_0x683c('0x14')]);return _0x1be6f6(_0x137713[_0x683c('0x13')]['message']);}logger[_0x683c('0x13')]('SalesforceField,\x20%s,\x20%s',_0x584424,_0x137713['error'][_0x683c('0x14')]);return _0x38c6fb(_0x137713[_0x683c('0x13')][_0x683c('0x14')]);}else{logger['info'](_0x683c('0xe'),_0x584424,_0x683c('0xf'));_0x38c6fb(_0x137713[_0x683c('0x15')][_0x683c('0x14')]);}})[_0x683c('0x16')](function(_0x1e23c5){logger[_0x683c('0x13')](_0x683c('0xe'),_0x584424,_0x1e23c5);_0x1be6f6(_0x1e23c5);});});} \ No newline at end of file +var _0x4daf=['SalesforceField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','../../mysqldb','jayson/promise','client','http','request','SalesforceField,\x20%s,\x20%s','debug'];(function(_0x3fc456,_0x3d9cc6){var _0x501a1b=function(_0x5201b1){while(--_0x5201b1){_0x3fc456['push'](_0x3fc456['shift']());}};_0x501a1b(++_0x3d9cc6);}(_0x4daf,0x139));var _0xf4da=function(_0x334570,_0x23d405){_0x334570=_0x334570-0x0;var _0x45c6dc=_0x4daf[_0x334570];return _0x45c6dc;};'use strict';var _=require(_0xf4da('0x0'));var util=require(_0xf4da('0x1'));var moment=require('moment');var BPromise=require(_0xf4da('0x2'));var rs=require(_0xf4da('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf4da('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xf4da('0x5'));var client=jayson[_0xf4da('0x6')][_0xf4da('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x5511ee,_0xddcaee,_0x462d4b){return new BPromise(function(_0x185b02,_0x15ed2b){return client[_0xf4da('0x8')](_0x5511ee,_0x462d4b)['then'](function(_0xdad73d){logger['info'](_0xf4da('0x9'),_0xddcaee,'request\x20sent');logger[_0xf4da('0xa')](_0xf4da('0xb'),_0xddcaee,'request\x20sent',JSON[_0xf4da('0xc')](_0xdad73d));if(_0xdad73d['error']){if(_0xdad73d[_0xf4da('0xd')][_0xf4da('0xe')]===0x1f4){logger[_0xf4da('0xd')](_0xf4da('0x9'),_0xddcaee,_0xdad73d['error']['message']);return _0x15ed2b(_0xdad73d[_0xf4da('0xd')][_0xf4da('0xf')]);}logger[_0xf4da('0xd')](_0xf4da('0x9'),_0xddcaee,_0xdad73d[_0xf4da('0xd')][_0xf4da('0xf')]);return _0x185b02(_0xdad73d['error'][_0xf4da('0xf')]);}else{logger['info'](_0xf4da('0x9'),_0xddcaee,'request\x20sent');_0x185b02(_0xdad73d[_0xf4da('0x10')][_0xf4da('0xf')]);}})[_0xf4da('0x11')](function(_0x8bcbf5){logger['error'](_0xf4da('0x9'),_0xddcaee,_0x8bcbf5);_0x15ed2b(_0x8bcbf5);});});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/index.js b/server/api/intServicenowAccount/index.js index b4a07b9..aae310d 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 _0xe18e=['util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intServicenowAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','getFields','post','create','addConfiguration','put','update','delete','destroy','multer'];(function(_0x4232d8,_0x13fd09){var _0x324de2=function(_0x167ad5){while(--_0x167ad5){_0x4232d8['push'](_0x4232d8['shift']());}};_0x324de2(++_0x13fd09);}(_0xe18e,0xe5));var _0xee18=function(_0x1e5c69,_0xc93352){_0x1e5c69=_0x1e5c69-0x0;var _0xe0e1ca=_0xe18e[_0x1e5c69];return _0xe0e1ca;};'use strict';var multer=require(_0xee18('0x0'));var util=require(_0xee18('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xee18('0x2'));var router=express[_0xee18('0x3')]();var fs_extra=require(_0xee18('0x4'));var auth=require(_0xee18('0x5'));var interaction=require(_0xee18('0x6'));var config=require('../../config/environment');var controller=require(_0xee18('0x7'));router[_0xee18('0x8')]('/',auth[_0xee18('0x9')](),controller[_0xee18('0xa')]);router[_0xee18('0x8')](_0xee18('0xb'),auth[_0xee18('0x9')](),controller[_0xee18('0xc')]);router[_0xee18('0x8')](_0xee18('0xd'),auth['isAuthenticated'](),controller[_0xee18('0xe')]);router['get']('/:id/fields',auth[_0xee18('0x9')](),controller[_0xee18('0xf')]);router[_0xee18('0x10')]('/',auth[_0xee18('0x9')](),controller[_0xee18('0x11')]);router[_0xee18('0x10')](_0xee18('0xd'),auth[_0xee18('0x9')](),controller[_0xee18('0x12')]);router[_0xee18('0x13')]('/:id',auth[_0xee18('0x9')](),controller[_0xee18('0x14')]);router[_0xee18('0x15')](_0xee18('0xb'),auth[_0xee18('0x9')](),controller[_0xee18('0x16')]);module['exports']=router; \ No newline at end of file +var _0xa2ae=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intServicenowAccount.controller','isAuthenticated','index','get','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','update','delete','destroy','exports','util','connect-timeout','express'];(function(_0x667f22,_0x8aa81f){var _0x1faacf=function(_0x9b0e0c){while(--_0x9b0e0c){_0x667f22['push'](_0x667f22['shift']());}};_0x1faacf(++_0x8aa81f);}(_0xa2ae,0x1dd));var _0xea2a=function(_0x57aec1,_0x2b6744){_0x57aec1=_0x57aec1-0x0;var _0x4597ae=_0xa2ae[_0x57aec1];return _0x4597ae;};'use strict';var multer=require('multer');var util=require(_0xea2a('0x0'));var path=require('path');var timeout=require(_0xea2a('0x1'));var express=require(_0xea2a('0x2'));var router=express[_0xea2a('0x3')]();var fs_extra=require(_0xea2a('0x4'));var auth=require(_0xea2a('0x5'));var interaction=require(_0xea2a('0x6'));var config=require('../../config/environment');var controller=require(_0xea2a('0x7'));router['get']('/',auth[_0xea2a('0x8')](),controller[_0xea2a('0x9')]);router[_0xea2a('0xa')](_0xea2a('0xb'),auth[_0xea2a('0x8')](),controller[_0xea2a('0xc')]);router[_0xea2a('0xa')](_0xea2a('0xd'),auth[_0xea2a('0x8')](),controller[_0xea2a('0xe')]);router[_0xea2a('0xa')](_0xea2a('0xf'),auth[_0xea2a('0x8')](),controller[_0xea2a('0x10')]);router[_0xea2a('0x11')]('/',auth[_0xea2a('0x8')](),controller[_0xea2a('0x12')]);router[_0xea2a('0x11')]('/:id/configurations',auth[_0xea2a('0x8')](),controller[_0xea2a('0x13')]);router['put']('/:id',auth[_0xea2a('0x8')](),controller[_0xea2a('0x14')]);router[_0xea2a('0x15')](_0xea2a('0xb'),auth[_0xea2a('0x8')](),controller[_0xea2a('0x16')]);module[_0xea2a('0x17')]=router; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.attributes.js b/server/api/intServicenowAccount/intServicenowAccount.attributes.js index f07baa6..f227b60 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 _0x1d9d=['STRING','username','remoteUri'];(function(_0x5304d9,_0x432768){var _0x4fc7d0=function(_0x4da8e1){while(--_0x4da8e1){_0x5304d9['push'](_0x5304d9['shift']());}};_0x4fc7d0(++_0x432768);}(_0x1d9d,0x1d4));var _0xd1d9=function(_0x1e042b,_0x23792a){_0x1e042b=_0x1e042b-0x0;var _0x46cf43=_0x1d9d[_0x1e042b];return _0x46cf43;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xd1d9('0x0')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING'],'unique':_0xd1d9('0x1')},'password':{'type':Sequelize[_0xd1d9('0x0')]},'email':{'type':Sequelize[_0xd1d9('0x0')]},'remoteUri':{'type':Sequelize[_0xd1d9('0x0')],'unique':_0xd1d9('0x2')},'serverUrl':{'type':Sequelize[_0xd1d9('0x0')],'allowNull':![]}}; \ No newline at end of file +var _0xe91c=['remoteUri','sequelize','STRING'];(function(_0x514c8f,_0x687151){var _0xf4b515=function(_0x5b5a45){while(--_0x5b5a45){_0x514c8f['push'](_0x514c8f['shift']());}};_0xf4b515(++_0x687151);}(_0xe91c,0x1b4));var _0xce91=function(_0x1fdcfa,_0x2d6485){_0x1fdcfa=_0x1fdcfa-0x0;var _0x53d024=_0xe91c[_0x1fdcfa];return _0x53d024;};'use strict';var Sequelize=require(_0xce91('0x0'));module['exports']={'name':{'type':Sequelize[_0xce91('0x1')]},'description':{'type':Sequelize[_0xce91('0x1')]},'username':{'type':Sequelize[_0xce91('0x1')],'unique':'username'},'password':{'type':Sequelize[_0xce91('0x1')]},'email':{'type':Sequelize[_0xce91('0x1')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0xce91('0x2')},'serverUrl':{'type':Sequelize[_0xce91('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.controller.js b/server/api/intServicenowAccount/intServicenowAccount.controller.js index 20f0542..212d571 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 _0xadc2=['result','log','incident\x20table\x20objects','assign','includes','forEach','label','push','all','TCL:\x20_object','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','internalType','ServiceNow\x20error:\x20','test','statusCode','error','stack','Wrong\x20credentials','True','true','False','false','value','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','offset','undefined','count','limit','Content-Range','json','apply','save','update','name','send','index','ServicenowAccount','rawAttributes','fieldName','type','key','model','map','query','keys','intersection','attributes','fields','length','nolimit','order','sort','filters','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','then','catch','params','create','body','find','destroy','getConfigurations','findOne','addConfiguration','AccountId','Subjects','getSubjects','channel','getDescriptions','ServicenowConfiguration','ServicenowField','Descriptions','getFields','made_sla','hold_reason','knowledge','subcategory','incident_state','severity','category','parent','caused_by','child_incidents','approval_history','number','resolved_by','sys_updated_by','opened_by','user_input','sys_created_on','state','calendar_stc','closed_at','cmdb_ci','delivery_plan','impact','active','sys_domain_path','rfc','time_worked','opened_at','business_duration','group_list','work_end','reopened_time','resolved_at','caller_id','work_notes','close_code','correlation_display','work_start','assignment_group','business_stc','additional_assignee_list','calendar_duration','notify','sys_class_name','close_notes','closed_by','follow_up','parent_incident','sys_id','reopened_by','urgency','problem_id','company','reassignment_count','assigned_to','comments','sla_due','approval','due_date','sys_mod_count','sys_tags','upon_approval','correlation_id','password','email','remoteUri','serverUrl','substring','lastIndexOf','format','%s/api/now/table/','username','GET','incident?sysparm_display_value=all'];(function(_0x2800c4,_0x5ac031){var _0x3b166d=function(_0x37a770){while(--_0x37a770){_0x2800c4['push'](_0x2800c4['shift']());}};_0x3b166d(++_0x5ac031);}(_0xadc2,0xcf));var _0x2adc=function(_0x164609,_0x45890e){_0x164609=_0x164609-0x0;var _0x4a1a05=_0xadc2[_0x164609];return _0x4a1a05;};'use strict';var emlformat=require(_0x2adc('0x0'));var rimraf=require(_0x2adc('0x1'));var zipdir=require(_0x2adc('0x2'));var jsonpatch=require(_0x2adc('0x3'));var rp=require(_0x2adc('0x4'));var moment=require(_0x2adc('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x2adc('0x6'));var path=require(_0x2adc('0x7'));var sox=require(_0x2adc('0x8'));var csv=require(_0x2adc('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2adc('0xa'));var squel=require('squel');var crypto=require(_0x2adc('0xb'));var jsforce=require(_0x2adc('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x2adc('0x9'));var querystring=require(_0x2adc('0xd'));var Papa=require(_0x2adc('0xe'));var Redis=require(_0x2adc('0xf'));var authService=require(_0x2adc('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x2adc('0x11'));var hardwareService=require(_0x2adc('0x12'));var logger=require(_0x2adc('0x13'))(_0x2adc('0x14'));var utils=require(_0x2adc('0x15'));var config=require(_0x2adc('0x16'));var licenseUtil=require(_0x2adc('0x17'));var db=require(_0x2adc('0x18'))['db'];var integrations=require(_0x2adc('0x19'));function respondWithStatusCode(_0x5170e0,_0x57831d){_0x57831d=_0x57831d||0xcc;return function(_0x38443c){if(_0x38443c){return _0x5170e0[_0x2adc('0x1a')](_0x57831d);}return _0x5170e0[_0x2adc('0x1b')](_0x57831d)[_0x2adc('0x1c')]();};}function respondWithResult(_0x5e0086,_0x536e2b){_0x536e2b=_0x536e2b||0xc8;return function(_0x3ff952){if(_0x3ff952){return _0x5e0086[_0x2adc('0x1b')](_0x536e2b)['json'](_0x3ff952);}};}function respondWithFilteredResult(_0x2eaa36,_0x213f21){return function(_0x133dc9){if(_0x133dc9){var _0x427e15=typeof _0x213f21[_0x2adc('0x1d')]===_0x2adc('0x1e')&&typeof _0x213f21['limit']===_0x2adc('0x1e');var _0x2117ac=_0x133dc9[_0x2adc('0x1f')];var _0x18d701=_0x427e15?0x0:_0x213f21['offset'];var _0x301a27=_0x427e15?_0x133dc9[_0x2adc('0x1f')]:_0x213f21['offset']+_0x213f21[_0x2adc('0x20')];var _0x3c9b18;if(_0x301a27>=_0x2117ac){_0x301a27=_0x2117ac;_0x3c9b18=0xc8;}else{_0x3c9b18=0xce;}_0x2eaa36[_0x2adc('0x1b')](_0x3c9b18);return _0x2eaa36['set'](_0x2adc('0x21'),_0x18d701+'-'+_0x301a27+'/'+_0x2117ac)[_0x2adc('0x22')](_0x133dc9);}return null;};}function patchUpdates(_0xc392c3){return function(_0x400c30){try{jsonpatch[_0x2adc('0x23')](_0x400c30,_0xc392c3,!![]);}catch(_0x93349){return BPromise['reject'](_0x93349);}return _0x400c30[_0x2adc('0x24')]();};}function saveUpdates(_0x2d6c8b,_0x51dbeb){return function(_0x1e672d){if(_0x1e672d){return _0x1e672d[_0x2adc('0x25')](_0x2d6c8b)['then'](function(_0x3772aa){return _0x3772aa;});}return null;};}function removeEntity(_0x2031c2,_0x2c1674){return function(_0x32ba39){if(_0x32ba39){return _0x32ba39['destroy']()['then'](function(){_0x2031c2[_0x2adc('0x1b')](0xcc)[_0x2adc('0x1c')]();});}};}function handleEntityNotFound(_0x158cc4,_0x216b4e){return function(_0x25c888){if(!_0x25c888){_0x158cc4[_0x2adc('0x1a')](0x194);}return _0x25c888;};}function handleError(_0x221e48,_0x32c47b){_0x32c47b=_0x32c47b||0x1f4;return function(_0x2a4076){logger['error'](_0x2a4076['stack']);if(_0x2a4076[_0x2adc('0x26')]){delete _0x2a4076['name'];}_0x221e48[_0x2adc('0x1b')](_0x32c47b)[_0x2adc('0x27')](_0x2a4076);};}exports[_0x2adc('0x28')]=function(_0x2344eb,_0x4a5e8f){var _0x21bfcc={},_0x176169={},_0x3535b4={'count':0x0,'rows':[]};var _0x3688fa=_['map'](db[_0x2adc('0x29')][_0x2adc('0x2a')],function(_0x2f5a1c){return{'name':_0x2f5a1c[_0x2adc('0x2b')],'type':_0x2f5a1c[_0x2adc('0x2c')][_0x2adc('0x2d')]};});_0x176169[_0x2adc('0x2e')]=_[_0x2adc('0x2f')](_0x3688fa,_0x2adc('0x26'));_0x176169[_0x2adc('0x30')]=_[_0x2adc('0x31')](_0x2344eb[_0x2adc('0x30')]);_0x176169['filters']=_[_0x2adc('0x32')](_0x176169[_0x2adc('0x2e')],_0x176169[_0x2adc('0x30')]);_0x21bfcc[_0x2adc('0x33')]=_[_0x2adc('0x32')](_0x176169[_0x2adc('0x2e')],qs[_0x2adc('0x34')](_0x2344eb[_0x2adc('0x30')]['fields']));_0x21bfcc[_0x2adc('0x33')]=_0x21bfcc[_0x2adc('0x33')][_0x2adc('0x35')]?_0x21bfcc['attributes']:_0x176169[_0x2adc('0x2e')];if(!_0x2344eb[_0x2adc('0x30')]['hasOwnProperty'](_0x2adc('0x36'))){_0x21bfcc['limit']=qs[_0x2adc('0x20')](_0x2344eb[_0x2adc('0x30')][_0x2adc('0x20')]);_0x21bfcc['offset']=qs['offset'](_0x2344eb[_0x2adc('0x30')]['offset']);}_0x21bfcc[_0x2adc('0x37')]=qs[_0x2adc('0x38')](_0x2344eb[_0x2adc('0x30')][_0x2adc('0x38')]);_0x21bfcc['where']=qs[_0x2adc('0x39')](_[_0x2adc('0x3a')](_0x2344eb['query'],_0x176169['filters']),_0x3688fa);if(_0x2344eb[_0x2adc('0x30')][_0x2adc('0x3b')]){_0x21bfcc[_0x2adc('0x3c')]=_[_0x2adc('0x3d')](_0x21bfcc[_0x2adc('0x3c')],{'$or':_[_0x2adc('0x2f')](_0x3688fa,function(_0x263126){if(_0x263126['type']!==_0x2adc('0x3e')){var _0x1ec2b2={};_0x1ec2b2[_0x263126[_0x2adc('0x26')]]={'$like':'%'+_0x2344eb['query'][_0x2adc('0x3b')]+'%'};return _0x1ec2b2;}})});}_0x21bfcc=_['merge']({},_0x21bfcc,_0x2344eb[_0x2adc('0x3f')]);var _0x3cd504={'where':_0x21bfcc[_0x2adc('0x3c')]};return db[_0x2adc('0x29')][_0x2adc('0x1f')](_0x3cd504)['then'](function(_0x4685f1){_0x3535b4['count']=_0x4685f1;if(_0x2344eb[_0x2adc('0x30')][_0x2adc('0x40')]){_0x21bfcc[_0x2adc('0x41')]=[{'all':!![]}];}return db[_0x2adc('0x29')][_0x2adc('0x42')](_0x21bfcc);})['then'](function(_0xb61a34){_0x3535b4[_0x2adc('0x43')]=_0xb61a34;return _0x3535b4;})[_0x2adc('0x44')](respondWithFilteredResult(_0x4a5e8f,_0x21bfcc))[_0x2adc('0x45')](handleError(_0x4a5e8f,null));};exports['show']=function(_0x1955ea,_0x59d0a6){var _0x16f88f={'raw':![],'where':{'id':_0x1955ea[_0x2adc('0x46')]['id']}},_0x1c2e04={};_0x1c2e04[_0x2adc('0x2e')]=_[_0x2adc('0x31')](db[_0x2adc('0x29')][_0x2adc('0x2a')]);_0x1c2e04['query']=_[_0x2adc('0x31')](_0x1955ea[_0x2adc('0x30')]);_0x1c2e04['filters']=_[_0x2adc('0x32')](_0x1c2e04[_0x2adc('0x2e')],_0x1c2e04[_0x2adc('0x30')]);_0x16f88f[_0x2adc('0x33')]=_[_0x2adc('0x32')](_0x1c2e04[_0x2adc('0x2e')],qs[_0x2adc('0x34')](_0x1955ea['query'][_0x2adc('0x34')]));_0x16f88f[_0x2adc('0x33')]=_0x16f88f[_0x2adc('0x33')][_0x2adc('0x35')]?_0x16f88f['attributes']:_0x1c2e04[_0x2adc('0x2e')];if(_0x1955ea['query'][_0x2adc('0x40')]){_0x16f88f[_0x2adc('0x41')]=[{'all':!![]}];}_0x16f88f=_[_0x2adc('0x3d')]({},_0x16f88f,_0x1955ea[_0x2adc('0x3f')]);return db[_0x2adc('0x29')]['find'](_0x16f88f)['then'](handleEntityNotFound(_0x59d0a6,null))[_0x2adc('0x44')](respondWithResult(_0x59d0a6,null))['catch'](handleError(_0x59d0a6,null));};exports['create']=function(_0x4765be,_0x576d0a){return db[_0x2adc('0x29')][_0x2adc('0x47')](_0x4765be['body'],{})[_0x2adc('0x44')](respondWithResult(_0x576d0a,0xc9))[_0x2adc('0x45')](handleError(_0x576d0a,null));};exports['update']=function(_0x7814f1,_0x2def97){if(_0x7814f1[_0x2adc('0x48')]['id']){delete _0x7814f1[_0x2adc('0x48')]['id'];}return db['ServicenowAccount'][_0x2adc('0x49')]({'where':{'id':_0x7814f1['params']['id']}})['then'](handleEntityNotFound(_0x2def97,null))[_0x2adc('0x44')](saveUpdates(_0x7814f1[_0x2adc('0x48')],null))[_0x2adc('0x44')](respondWithResult(_0x2def97,null))[_0x2adc('0x45')](handleError(_0x2def97,null));};exports[_0x2adc('0x4a')]=function(_0x4307c8,_0x2483cd){return db['ServicenowAccount'][_0x2adc('0x49')]({'where':{'id':_0x4307c8['params']['id']}})[_0x2adc('0x44')](handleEntityNotFound(_0x2483cd,null))[_0x2adc('0x44')](removeEntity(_0x2483cd,null))[_0x2adc('0x45')](handleError(_0x2483cd,null));};exports[_0x2adc('0x4b')]=function(_0x492a44,_0x4f9daf,_0x49f07f){var _0x5e16ad={};var _0x5d91a3={};var _0xcc9c7d;var _0xd248c5;return db[_0x2adc('0x29')][_0x2adc('0x4c')]({'where':{'id':_0x492a44[_0x2adc('0x46')]['id']}})['then'](handleEntityNotFound(_0x4f9daf,null))[_0x2adc('0x44')](function(_0x5c7015){if(_0x5c7015){_0xcc9c7d=_0x5c7015;_0x5d91a3[_0x2adc('0x2e')]=_[_0x2adc('0x31')](db['ServicenowConfiguration'][_0x2adc('0x2a')]);_0x5d91a3[_0x2adc('0x30')]=_[_0x2adc('0x31')](_0x492a44['query']);_0x5d91a3[_0x2adc('0x39')]=_['intersection'](_0x5d91a3[_0x2adc('0x2e')],_0x5d91a3['query']);_0x5e16ad[_0x2adc('0x33')]=_['intersection'](_0x5d91a3['model'],qs[_0x2adc('0x34')](_0x492a44[_0x2adc('0x30')][_0x2adc('0x34')]));_0x5e16ad[_0x2adc('0x33')]=_0x5e16ad[_0x2adc('0x33')]['length']?_0x5e16ad[_0x2adc('0x33')]:_0x5d91a3['model'];_0x5e16ad[_0x2adc('0x37')]=qs[_0x2adc('0x38')](_0x492a44[_0x2adc('0x30')][_0x2adc('0x38')]);_0x5e16ad[_0x2adc('0x3c')]=qs[_0x2adc('0x39')](_[_0x2adc('0x3a')](_0x492a44[_0x2adc('0x30')],_0x5d91a3[_0x2adc('0x39')]));if(_0x492a44[_0x2adc('0x30')]['filter']){_0x5e16ad['where']=_[_0x2adc('0x3d')](_0x5e16ad[_0x2adc('0x3c')],{'$or':_[_0x2adc('0x2f')](_0x5e16ad[_0x2adc('0x33')],function(_0x38171f){var _0x351a3b={};_0x351a3b[_0x38171f]={'$like':'%'+_0x492a44[_0x2adc('0x30')][_0x2adc('0x3b')]+'%'};return _0x351a3b;})});}_0x5e16ad=_['merge']({},_0x5e16ad,_0x492a44[_0x2adc('0x3f')]);return _0xcc9c7d[_0x2adc('0x4b')](_0x5e16ad);}})[_0x2adc('0x44')](function(_0xce6c){if(_0xce6c){_0xd248c5=_0xce6c[_0x2adc('0x35')];if(!_0x492a44[_0x2adc('0x30')]['hasOwnProperty']('nolimit')){_0x5e16ad[_0x2adc('0x20')]=qs[_0x2adc('0x20')](_0x492a44['query']['limit']);_0x5e16ad[_0x2adc('0x1d')]=qs['offset'](_0x492a44['query'][_0x2adc('0x1d')]);}return _0xcc9c7d[_0x2adc('0x4b')](_0x5e16ad);}})[_0x2adc('0x44')](function(_0x38b235){if(_0x38b235){return _0x38b235?{'count':_0xd248c5,'rows':_0x38b235}:null;}})['then'](respondWithResult(_0x4f9daf,null))[_0x2adc('0x45')](handleError(_0x4f9daf,null));};exports[_0x2adc('0x4d')]=function(_0x2c80d3,_0xe2ac39,_0x1d7ab4){if(_0x2c80d3[_0x2adc('0x48')]['id']){delete _0x2c80d3[_0x2adc('0x48')]['id'];}return db['ServicenowAccount'][_0x2adc('0x4c')]({'where':{'id':_0x2c80d3[_0x2adc('0x46')]['id']}})[_0x2adc('0x44')](handleEntityNotFound(_0xe2ac39,null))['then'](function(_0x2bbe1a){if(_0x2bbe1a){_0x2c80d3[_0x2adc('0x48')][_0x2adc('0x4e')]=_0x2bbe1a['id'];_0x2c80d3[_0x2adc('0x48')][_0x2adc('0x4f')]=integrations[_0x2adc('0x50')](_0x2c80d3['body'][_0x2adc('0x51')],_0x2c80d3[_0x2adc('0x48')][_0x2adc('0x2c')]);_0x2c80d3[_0x2adc('0x48')]['Descriptions']=integrations[_0x2adc('0x52')](_0x2c80d3[_0x2adc('0x48')]['channel'],_0x2c80d3[_0x2adc('0x48')]['type']);return db[_0x2adc('0x53')]['create'](_0x2c80d3['body'],{'include':[{'model':db['ServicenowField'],'as':_0x2adc('0x4f')},{'model':db[_0x2adc('0x54')],'as':_0x2adc('0x55')}]});}return null;})['then'](respondWithResult(_0xe2ac39,null))[_0x2adc('0x45')](handleError(_0xe2ac39,null));};exports[_0x2adc('0x56')]=function(_0x2b71cc,_0x2eb3fd,_0x2bb703){var _0x2bccc1=[_0x2adc('0x57'),_0x2adc('0x58'),_0x2adc('0x59'),_0x2adc('0x5a'),'close_code','notify',_0x2adc('0x5b'),_0x2adc('0x5c'),_0x2adc('0x5d')];var _0x3de849=[_0x2adc('0x5e'),_0x2adc('0x57'),_0x2adc('0x5f'),'watch_list','upon_reject','sys_updated_on',_0x2adc('0x60'),_0x2adc('0x58'),_0x2adc('0x61'),_0x2adc('0x62'),_0x2adc('0x63'),_0x2adc('0x64'),_0x2adc('0x65'),_0x2adc('0x66'),_0x2adc('0x67'),'sys_domain',_0x2adc('0x68'),'sys_created_by',_0x2adc('0x59'),_0x2adc('0x37'),_0x2adc('0x69'),_0x2adc('0x6a'),_0x2adc('0x6b'),_0x2adc('0x6c'),_0x2adc('0x6d'),_0x2adc('0x6e'),'work_notes_list','business_service','priority',_0x2adc('0x6f'),_0x2adc('0x70'),_0x2adc('0x71'),'expected_start',_0x2adc('0x72'),_0x2adc('0x73'),_0x2adc('0x74'),_0x2adc('0x75'),_0x2adc('0x76'),_0x2adc('0x77'),_0x2adc('0x78'),'approval_set','subcategory',_0x2adc('0x79'),'short_description',_0x2adc('0x7a'),_0x2adc('0x7b'),'delivery_task',_0x2adc('0x7c'),_0x2adc('0x7d'),_0x2adc('0x7e'),_0x2adc('0x7f'),'description',_0x2adc('0x80'),_0x2adc('0x81'),_0x2adc('0x82'),_0x2adc('0x83'),_0x2adc('0x84'),_0x2adc('0x85'),_0x2adc('0x86'),_0x2adc('0x87'),'contact_type',_0x2adc('0x88'),_0x2adc('0x5b'),_0x2adc('0x89'),_0x2adc('0x8a'),_0x2adc('0x8b'),_0x2adc('0x8c'),'activity_due',_0x2adc('0x8d'),_0x2adc('0x5c'),_0x2adc('0x8e'),_0x2adc('0x8f'),_0x2adc('0x90'),'comments_and_work_notes',_0x2adc('0x91'),_0x2adc('0x92'),'reopen_count',_0x2adc('0x93'),'escalation',_0x2adc('0x94'),_0x2adc('0x95'),'location',_0x2adc('0x5d')];var _0x2d3445='';var _0x297618='';var _0x4e2810=[];var _0x1c9c18='';var _0x410171='';var _0x2adced=[];var _0x603011='';var _0x4fe5aa='';var _0x38b513={};var _0x28cc96='';return db[_0x2adc('0x29')][_0x2adc('0x4c')]({'where':{'id':_0x2b71cc[_0x2adc('0x46')]['id']},'attributes':['id','username',_0x2adc('0x96'),_0x2adc('0x97'),_0x2adc('0x98'),_0x2adc('0x99')]})[_0x2adc('0x44')](handleEntityNotFound(_0x2eb3fd,null))[_0x2adc('0x44')](function(_0x196589){if(_0x196589){_0x28cc96=_0x196589[_0x2adc('0x98')];var _0x3f77e5=_0x28cc96['slice'](-0x1);if(_0x3f77e5==='/'){_0x28cc96=_0x28cc96[_0x2adc('0x9a')](0x0,_0x28cc96[_0x2adc('0x9b')](_0x3f77e5));}_0x4fe5aa=util['format']('%s/api/now/doc/table/schema/',_0x28cc96);_0x603011=util[_0x2adc('0x9c')](_0x2adc('0x9d'),_0x28cc96);_0x38b513={'user':_0x196589[_0x2adc('0x9e')],'pass':_0x196589[_0x2adc('0x96')]};var _0xc8bcff={'method':_0x2adc('0x9f'),'uri':_0x4fe5aa+_0x2adc('0xa0'),'auth':_0x38b513,'json':!![]};return rp(_0xc8bcff);}})[_0x2adc('0x44')](function(_0x16dae4){if(_0x16dae4[_0x2adc('0xa1')][_0x2adc('0x35')]>0x0){_0x2d3445=_0x16dae4[_0x2adc('0xa1')];}console[_0x2adc('0xa2')](_0x2adc('0xa3'),_0x2d3445);_0x2adced=[];_0x297618=Object[_0x2adc('0xa4')]([],_0x2d3445);_['remove'](_0x297618,function(_0x3300fe){return!_0x2bccc1[_0x2adc('0xa5')](_0x3300fe['name']);});_0x297618[_0x2adc('0xa6')](function(_0x2c4fdb){var _0x1231b3=createFieldObject(_0x603011,_0x38b513,_0x2c4fdb['internalType'],_0x2c4fdb[_0x2adc('0x26')],_0x2c4fdb[_0x2adc('0xa7')],![]);_0x2adced[_0x2adc('0xa8')](_0x1231b3);});return Promise[_0x2adc('0xa9')](_0x2adced);})['then'](function(_0xb2c508){_0x4e2810=_0xb2c508;_0x1c9c18=Object[_0x2adc('0xa4')]([],_0x2d3445);console[_0x2adc('0xa2')](_0x2adc('0xaa'),_0x2d3445);_['remove'](_0x1c9c18,function(_0x16cdb3){return _0x3de849[_0x2adc('0xa5')](_0x16cdb3['name']);});console['log'](_0x2adc('0xab'),_0x1c9c18);_0x2adced=[];_0x1c9c18[_0x2adc('0xa6')](function(_0xdf8de8){var _0x52d301=createFieldObject(_0x603011,_0x38b513,_0xdf8de8[_0x2adc('0xac')],_0xdf8de8['name'],_0xdf8de8[_0x2adc('0xa7')],!![]);_0x2adced[_0x2adc('0xa8')](_0x52d301);});return Promise[_0x2adc('0xa9')](_0x2adced);})[_0x2adc('0x44')](function(_0x309a18){_0x410171=_0x309a18;var _0x95e872=_0x4e2810['concat'](_0x410171);return{'count':_0x95e872[_0x2adc('0x35')],'rows':_0x95e872};})[_0x2adc('0x44')](respondWithResult(_0x2eb3fd,null))[_0x2adc('0x45')](function(_0x3d2cd8){console[_0x2adc('0xa2')](_0x2adc('0xad')+_0x3d2cd8);var _0x304fa8=_0x2b71cc['query'][_0x2adc('0xae')]?0x1f4:_0x3d2cd8[_0x2adc('0xaf')]||0x1f4;logger[_0x2adc('0xb0')](_0x3d2cd8[_0x2adc('0xb1')]);delete _0x3d2cd8[_0x2adc('0x26')];if(_0x304fa8===0x191){_0x304fa8=0x190;}_0x2eb3fd[_0x2adc('0x1b')](_0x304fa8)[_0x2adc('0x27')](_0x2b71cc['query'][_0x2adc('0xae')]?{'message':_0x2adc('0xb2'),'statusCode':_0x3d2cd8[_0x2adc('0xaf')]}:_0x3d2cd8);});};function createFieldObject(_0x3d165a,_0x5495ea,_0x163ab7,_0x306916,_0x368a0a,_0x487ce5){return new Promise(function(_0x5e74c6,_0x51ed31){var _0x17db70={'id':_0x306916,'name':_0x368a0a,'custom':_0x487ce5};if(_0x163ab7==='boolean'){_0x17db70['options']=[{'name':_0x2adc('0xb3'),'value':_0x2adc('0xb4')},{'name':_0x2adc('0xb5'),'value':_0x2adc('0xb6')}];_0x5e74c6(_0x17db70);}else{var _0x41c73a={'method':'GET','uri':_0x3d165a+'sys_choice?sysparm_query=name=incident^element='+_0x306916,'auth':_0x5495ea,'json':!![]};return rp(_0x41c73a)[_0x2adc('0x44')](function(_0x6ca33){var _0x477a18=[];if(_0x6ca33[_0x2adc('0xa1')]['length']>0x0){_0x6ca33['result'][_0x2adc('0xa6')](function(_0x482e4e){if(_0x482e4e['inactive']===_0x2adc('0xb6')){var _0x28f392={'name':_0x482e4e[_0x2adc('0xa7')],'value':_0x482e4e[_0x2adc('0xb7')]};_0x477a18['push'](_0x28f392);}});}_0x17db70[_0x2adc('0x3f')]=_0x477a18;if(_0x17db70[_0x2adc('0x3f')][_0x2adc('0x35')]>0x0){_0x5e74c6(_0x17db70);}else{if(_0x487ce5==![]){_0x5e74c6();}else{_0x5e74c6(_0x17db70);}}});}});} \ No newline at end of file +var _0x8b78=['order','nolimit','addConfiguration','findOne','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','channel','ServicenowField','getFields','hold_reason','knowledge','close_code','incident_state','category','parent','caused_by','upon_reject','sys_updated_on','child_incidents','approval_history','number','resolved_by','opened_by','user_input','sys_created_on','state','sys_created_by','calendar_stc','closed_at','delivery_plan','impact','active','work_notes_list','priority','opened_at','business_duration','group_list','work_end','reopened_time','resolved_at','work_notes','short_description','correlation_display','delivery_task','work_start','assignment_group','business_stc','additional_assignee_list','notify','close_notes','closed_by','follow_up','parent_incident','sys_id','contact_type','urgency','problem_id','company','reassignment_count','assigned_to','severity','sla_due','approval','due_date','sys_mod_count','reopen_count','sys_tags','escalation','upon_approval','correlation_id','location','username','password','email','remoteUri','slice','substring','lastIndexOf','format','%s/api/now/table/','GET','incident?sysparm_display_value=all','result','log','incident\x20table\x20objects','remove','includes','forEach','label','all','assign','TCL:\x20_object','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','push','concat','ServiceNow\x20error:\x20','statusCode','test','Wrong\x20credentials','True','true','False','false','sys_choice?sysparm_query=name=incident^element=','value','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','path','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','update','then','destroy','error','send','ServicenowAccount','rawAttributes','fieldName','map','name','query','keys','filters','attributes','intersection','model','fields','hasOwnProperty','sort','pick','filter','where','merge','type','VIRTUAL','options','findAll','rows','catch','params','includeAll','include','find','create','body','getConfigurations','ServicenowConfiguration','length'];(function(_0xbff4e1,_0xbcc71a){var _0x2f6dcc=function(_0x32fae1){while(--_0x32fae1){_0xbff4e1['push'](_0xbff4e1['shift']());}};_0x2f6dcc(++_0xbcc71a);}(_0x8b78,0x6c));var _0x88b7=function(_0x7f176e,_0x240ec2){_0x7f176e=_0x7f176e-0x0;var _0x3c7877=_0x8b78[_0x7f176e];return _0x3c7877;};'use strict';var emlformat=require(_0x88b7('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x88b7('0x1'));var rp=require(_0x88b7('0x2'));var moment=require(_0x88b7('0x3'));var BPromise=require(_0x88b7('0x4'));var Mustache=require(_0x88b7('0x5'));var util=require('util');var path=require(_0x88b7('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x88b7('0x7'));var fs=require('fs');var fs_extra=require(_0x88b7('0x8'));var _=require(_0x88b7('0x9'));var squel=require(_0x88b7('0xa'));var crypto=require('crypto');var jsforce=require(_0x88b7('0xb'));var deskjs=require(_0x88b7('0xc'));var toCsv=require(_0x88b7('0xd'));var querystring=require(_0x88b7('0xe'));var Papa=require(_0x88b7('0xf'));var Redis=require(_0x88b7('0x10'));var authService=require(_0x88b7('0x11'));var qs=require(_0x88b7('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x88b7('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x88b7('0x14'));var config=require(_0x88b7('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x88b7('0x16'))['db'];var integrations=require(_0x88b7('0x17'));function respondWithStatusCode(_0x5cdf72,_0x2ee7ef){_0x2ee7ef=_0x2ee7ef||0xcc;return function(_0x454c4c){if(_0x454c4c){return _0x5cdf72[_0x88b7('0x18')](_0x2ee7ef);}return _0x5cdf72[_0x88b7('0x19')](_0x2ee7ef)[_0x88b7('0x1a')]();};}function respondWithResult(_0x46cdcc,_0x165c00){_0x165c00=_0x165c00||0xc8;return function(_0xab5d68){if(_0xab5d68){return _0x46cdcc['status'](_0x165c00)[_0x88b7('0x1b')](_0xab5d68);}};}function respondWithFilteredResult(_0x4b3b0e,_0x346b8a){return function(_0xfcbfbe){if(_0xfcbfbe){var _0x2a93d2=typeof _0x346b8a[_0x88b7('0x1c')]===_0x88b7('0x1d')&&typeof _0x346b8a['limit']===_0x88b7('0x1d');var _0x279675=_0xfcbfbe[_0x88b7('0x1e')];var _0x4f557e=_0x2a93d2?0x0:_0x346b8a[_0x88b7('0x1c')];var _0x593980=_0x2a93d2?_0xfcbfbe['count']:_0x346b8a['offset']+_0x346b8a[_0x88b7('0x1f')];var _0x4d5479;if(_0x593980>=_0x279675){_0x593980=_0x279675;_0x4d5479=0xc8;}else{_0x4d5479=0xce;}_0x4b3b0e[_0x88b7('0x19')](_0x4d5479);return _0x4b3b0e[_0x88b7('0x20')](_0x88b7('0x21'),_0x4f557e+'-'+_0x593980+'/'+_0x279675)[_0x88b7('0x1b')](_0xfcbfbe);}return null;};}function patchUpdates(_0x153ffe){return function(_0x55e84f){try{jsonpatch[_0x88b7('0x22')](_0x55e84f,_0x153ffe,!![]);}catch(_0x1d9b8d){return BPromise[_0x88b7('0x23')](_0x1d9b8d);}return _0x55e84f['save']();};}function saveUpdates(_0x34f391,_0x30bbaa){return function(_0x7ac9cf){if(_0x7ac9cf){return _0x7ac9cf[_0x88b7('0x24')](_0x34f391)[_0x88b7('0x25')](function(_0x3c7f88){return _0x3c7f88;});}return null;};}function removeEntity(_0x116ce2,_0xdab059){return function(_0x1f7a3b){if(_0x1f7a3b){return _0x1f7a3b[_0x88b7('0x26')]()['then'](function(){_0x116ce2[_0x88b7('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x257985,_0x4ec954){return function(_0x50047c){if(!_0x50047c){_0x257985[_0x88b7('0x18')](0x194);}return _0x50047c;};}function handleError(_0x3d3f2a,_0x40b2a4){_0x40b2a4=_0x40b2a4||0x1f4;return function(_0x322d5d){logger[_0x88b7('0x27')](_0x322d5d['stack']);if(_0x322d5d['name']){delete _0x322d5d['name'];}_0x3d3f2a['status'](_0x40b2a4)[_0x88b7('0x28')](_0x322d5d);};}exports['index']=function(_0x3bf3ef,_0x35c3d6){var _0x189bde={},_0x3c792f={},_0x5162e3={'count':0x0,'rows':[]};var _0x50f925=_['map'](db[_0x88b7('0x29')][_0x88b7('0x2a')],function(_0x18bced){return{'name':_0x18bced[_0x88b7('0x2b')],'type':_0x18bced['type']['key']};});_0x3c792f['model']=_[_0x88b7('0x2c')](_0x50f925,_0x88b7('0x2d'));_0x3c792f[_0x88b7('0x2e')]=_[_0x88b7('0x2f')](_0x3bf3ef[_0x88b7('0x2e')]);_0x3c792f[_0x88b7('0x30')]=_['intersection'](_0x3c792f['model'],_0x3c792f[_0x88b7('0x2e')]);_0x189bde[_0x88b7('0x31')]=_[_0x88b7('0x32')](_0x3c792f[_0x88b7('0x33')],qs[_0x88b7('0x34')](_0x3bf3ef[_0x88b7('0x2e')][_0x88b7('0x34')]));_0x189bde['attributes']=_0x189bde['attributes']['length']?_0x189bde[_0x88b7('0x31')]:_0x3c792f['model'];if(!_0x3bf3ef[_0x88b7('0x2e')][_0x88b7('0x35')]('nolimit')){_0x189bde['limit']=qs[_0x88b7('0x1f')](_0x3bf3ef[_0x88b7('0x2e')][_0x88b7('0x1f')]);_0x189bde[_0x88b7('0x1c')]=qs['offset'](_0x3bf3ef[_0x88b7('0x2e')]['offset']);}_0x189bde['order']=qs[_0x88b7('0x36')](_0x3bf3ef[_0x88b7('0x2e')][_0x88b7('0x36')]);_0x189bde['where']=qs[_0x88b7('0x30')](_[_0x88b7('0x37')](_0x3bf3ef['query'],_0x3c792f['filters']),_0x50f925);if(_0x3bf3ef['query'][_0x88b7('0x38')]){_0x189bde[_0x88b7('0x39')]=_[_0x88b7('0x3a')](_0x189bde[_0x88b7('0x39')],{'$or':_[_0x88b7('0x2c')](_0x50f925,function(_0x5a37bb){if(_0x5a37bb[_0x88b7('0x3b')]!==_0x88b7('0x3c')){var _0x15ef76={};_0x15ef76[_0x5a37bb[_0x88b7('0x2d')]]={'$like':'%'+_0x3bf3ef[_0x88b7('0x2e')]['filter']+'%'};return _0x15ef76;}})});}_0x189bde=_[_0x88b7('0x3a')]({},_0x189bde,_0x3bf3ef[_0x88b7('0x3d')]);var _0x32cca8={'where':_0x189bde[_0x88b7('0x39')]};return db[_0x88b7('0x29')]['count'](_0x32cca8)[_0x88b7('0x25')](function(_0x2c2be7){_0x5162e3[_0x88b7('0x1e')]=_0x2c2be7;if(_0x3bf3ef[_0x88b7('0x2e')]['includeAll']){_0x189bde['include']=[{'all':!![]}];}return db[_0x88b7('0x29')][_0x88b7('0x3e')](_0x189bde);})[_0x88b7('0x25')](function(_0x311c66){_0x5162e3[_0x88b7('0x3f')]=_0x311c66;return _0x5162e3;})['then'](respondWithFilteredResult(_0x35c3d6,_0x189bde))[_0x88b7('0x40')](handleError(_0x35c3d6,null));};exports['show']=function(_0x55a607,_0x4d07eb){var _0x1ba3dc={'raw':![],'where':{'id':_0x55a607[_0x88b7('0x41')]['id']}},_0x206c6f={};_0x206c6f['model']=_['keys'](db[_0x88b7('0x29')]['rawAttributes']);_0x206c6f[_0x88b7('0x2e')]=_[_0x88b7('0x2f')](_0x55a607[_0x88b7('0x2e')]);_0x206c6f[_0x88b7('0x30')]=_[_0x88b7('0x32')](_0x206c6f[_0x88b7('0x33')],_0x206c6f[_0x88b7('0x2e')]);_0x1ba3dc[_0x88b7('0x31')]=_[_0x88b7('0x32')](_0x206c6f[_0x88b7('0x33')],qs[_0x88b7('0x34')](_0x55a607[_0x88b7('0x2e')]['fields']));_0x1ba3dc['attributes']=_0x1ba3dc[_0x88b7('0x31')]['length']?_0x1ba3dc[_0x88b7('0x31')]:_0x206c6f[_0x88b7('0x33')];if(_0x55a607[_0x88b7('0x2e')][_0x88b7('0x42')]){_0x1ba3dc[_0x88b7('0x43')]=[{'all':!![]}];}_0x1ba3dc=_['merge']({},_0x1ba3dc,_0x55a607[_0x88b7('0x3d')]);return db[_0x88b7('0x29')][_0x88b7('0x44')](_0x1ba3dc)[_0x88b7('0x25')](handleEntityNotFound(_0x4d07eb,null))[_0x88b7('0x25')](respondWithResult(_0x4d07eb,null))[_0x88b7('0x40')](handleError(_0x4d07eb,null));};exports['create']=function(_0x2c3fff,_0x488355){return db[_0x88b7('0x29')][_0x88b7('0x45')](_0x2c3fff[_0x88b7('0x46')],{})[_0x88b7('0x25')](respondWithResult(_0x488355,0xc9))[_0x88b7('0x40')](handleError(_0x488355,null));};exports[_0x88b7('0x24')]=function(_0x2c2a69,_0x67bcec){if(_0x2c2a69[_0x88b7('0x46')]['id']){delete _0x2c2a69['body']['id'];}return db['ServicenowAccount'][_0x88b7('0x44')]({'where':{'id':_0x2c2a69[_0x88b7('0x41')]['id']}})[_0x88b7('0x25')](handleEntityNotFound(_0x67bcec,null))[_0x88b7('0x25')](saveUpdates(_0x2c2a69[_0x88b7('0x46')],null))['then'](respondWithResult(_0x67bcec,null))[_0x88b7('0x40')](handleError(_0x67bcec,null));};exports[_0x88b7('0x26')]=function(_0x77dddd,_0x552e9c){return db['ServicenowAccount'][_0x88b7('0x44')]({'where':{'id':_0x77dddd['params']['id']}})['then'](handleEntityNotFound(_0x552e9c,null))[_0x88b7('0x25')](removeEntity(_0x552e9c,null))[_0x88b7('0x40')](handleError(_0x552e9c,null));};exports[_0x88b7('0x47')]=function(_0xf57cfd,_0x2fdca7,_0x39d08a){var _0x2eb1e6={};var _0x30ef87={};var _0x280579;var _0xb9e41b;return db[_0x88b7('0x29')]['findOne']({'where':{'id':_0xf57cfd[_0x88b7('0x41')]['id']}})[_0x88b7('0x25')](handleEntityNotFound(_0x2fdca7,null))['then'](function(_0x575021){if(_0x575021){_0x280579=_0x575021;_0x30ef87[_0x88b7('0x33')]=_[_0x88b7('0x2f')](db[_0x88b7('0x48')]['rawAttributes']);_0x30ef87[_0x88b7('0x2e')]=_['keys'](_0xf57cfd[_0x88b7('0x2e')]);_0x30ef87['filters']=_['intersection'](_0x30ef87[_0x88b7('0x33')],_0x30ef87[_0x88b7('0x2e')]);_0x2eb1e6[_0x88b7('0x31')]=_['intersection'](_0x30ef87[_0x88b7('0x33')],qs[_0x88b7('0x34')](_0xf57cfd[_0x88b7('0x2e')][_0x88b7('0x34')]));_0x2eb1e6[_0x88b7('0x31')]=_0x2eb1e6['attributes'][_0x88b7('0x49')]?_0x2eb1e6['attributes']:_0x30ef87['model'];_0x2eb1e6[_0x88b7('0x4a')]=qs[_0x88b7('0x36')](_0xf57cfd['query']['sort']);_0x2eb1e6['where']=qs['filters'](_[_0x88b7('0x37')](_0xf57cfd[_0x88b7('0x2e')],_0x30ef87[_0x88b7('0x30')]));if(_0xf57cfd['query']['filter']){_0x2eb1e6[_0x88b7('0x39')]=_[_0x88b7('0x3a')](_0x2eb1e6[_0x88b7('0x39')],{'$or':_[_0x88b7('0x2c')](_0x2eb1e6[_0x88b7('0x31')],function(_0x2a4db1){var _0x330c2c={};_0x330c2c[_0x2a4db1]={'$like':'%'+_0xf57cfd[_0x88b7('0x2e')][_0x88b7('0x38')]+'%'};return _0x330c2c;})});}_0x2eb1e6=_[_0x88b7('0x3a')]({},_0x2eb1e6,_0xf57cfd[_0x88b7('0x3d')]);return _0x280579[_0x88b7('0x47')](_0x2eb1e6);}})[_0x88b7('0x25')](function(_0x339c72){if(_0x339c72){_0xb9e41b=_0x339c72['length'];if(!_0xf57cfd[_0x88b7('0x2e')][_0x88b7('0x35')](_0x88b7('0x4b'))){_0x2eb1e6[_0x88b7('0x1f')]=qs[_0x88b7('0x1f')](_0xf57cfd['query'][_0x88b7('0x1f')]);_0x2eb1e6[_0x88b7('0x1c')]=qs[_0x88b7('0x1c')](_0xf57cfd[_0x88b7('0x2e')]['offset']);}return _0x280579[_0x88b7('0x47')](_0x2eb1e6);}})[_0x88b7('0x25')](function(_0x7310b1){if(_0x7310b1){return _0x7310b1?{'count':_0xb9e41b,'rows':_0x7310b1}:null;}})['then'](respondWithResult(_0x2fdca7,null))[_0x88b7('0x40')](handleError(_0x2fdca7,null));};exports[_0x88b7('0x4c')]=function(_0x39d77e,_0x251b13,_0x52ebbb){if(_0x39d77e[_0x88b7('0x46')]['id']){delete _0x39d77e[_0x88b7('0x46')]['id'];}return db['ServicenowAccount'][_0x88b7('0x4d')]({'where':{'id':_0x39d77e[_0x88b7('0x41')]['id']}})['then'](handleEntityNotFound(_0x251b13,null))[_0x88b7('0x25')](function(_0x4cdea2){if(_0x4cdea2){_0x39d77e['body'][_0x88b7('0x4e')]=_0x4cdea2['id'];_0x39d77e[_0x88b7('0x46')][_0x88b7('0x4f')]=integrations[_0x88b7('0x50')](_0x39d77e[_0x88b7('0x46')]['channel'],_0x39d77e[_0x88b7('0x46')][_0x88b7('0x3b')]);_0x39d77e[_0x88b7('0x46')][_0x88b7('0x51')]=integrations[_0x88b7('0x52')](_0x39d77e[_0x88b7('0x46')][_0x88b7('0x53')],_0x39d77e[_0x88b7('0x46')][_0x88b7('0x3b')]);return db[_0x88b7('0x48')][_0x88b7('0x45')](_0x39d77e[_0x88b7('0x46')],{'include':[{'model':db[_0x88b7('0x54')],'as':'Subjects'},{'model':db[_0x88b7('0x54')],'as':_0x88b7('0x51')}]});}return null;})[_0x88b7('0x25')](respondWithResult(_0x251b13,null))[_0x88b7('0x40')](handleError(_0x251b13,null));};exports[_0x88b7('0x55')]=function(_0x32419e,_0x636e8c,_0x3ab745){var _0xf8f1d8=['made_sla',_0x88b7('0x56'),_0x88b7('0x57'),'subcategory',_0x88b7('0x58'),'notify',_0x88b7('0x59'),'severity',_0x88b7('0x5a')];var _0x26477d=[_0x88b7('0x5b'),'made_sla',_0x88b7('0x5c'),'watch_list',_0x88b7('0x5d'),_0x88b7('0x5e'),_0x88b7('0x5f'),_0x88b7('0x56'),_0x88b7('0x60'),_0x88b7('0x61'),_0x88b7('0x62'),'sys_updated_by',_0x88b7('0x63'),_0x88b7('0x64'),_0x88b7('0x65'),'sys_domain',_0x88b7('0x66'),_0x88b7('0x67'),'knowledge',_0x88b7('0x4a'),_0x88b7('0x68'),_0x88b7('0x69'),'cmdb_ci',_0x88b7('0x6a'),_0x88b7('0x6b'),_0x88b7('0x6c'),_0x88b7('0x6d'),'business_service',_0x88b7('0x6e'),'sys_domain_path','rfc','time_worked','expected_start',_0x88b7('0x6f'),_0x88b7('0x70'),_0x88b7('0x71'),_0x88b7('0x72'),_0x88b7('0x73'),_0x88b7('0x74'),'caller_id','approval_set','subcategory',_0x88b7('0x75'),_0x88b7('0x76'),_0x88b7('0x58'),_0x88b7('0x77'),_0x88b7('0x78'),_0x88b7('0x79'),_0x88b7('0x7a'),_0x88b7('0x7b'),_0x88b7('0x7c'),'description','calendar_duration',_0x88b7('0x7d'),'sys_class_name',_0x88b7('0x7e'),_0x88b7('0x7f'),_0x88b7('0x80'),_0x88b7('0x81'),_0x88b7('0x82'),_0x88b7('0x83'),'reopened_by',_0x88b7('0x59'),_0x88b7('0x84'),_0x88b7('0x85'),_0x88b7('0x86'),_0x88b7('0x87'),'activity_due',_0x88b7('0x88'),_0x88b7('0x89'),'comments',_0x88b7('0x8a'),_0x88b7('0x8b'),'comments_and_work_notes',_0x88b7('0x8c'),_0x88b7('0x8d'),_0x88b7('0x8e'),_0x88b7('0x8f'),_0x88b7('0x90'),_0x88b7('0x91'),_0x88b7('0x92'),_0x88b7('0x93'),_0x88b7('0x5a')];var _0x41fe79='';var _0x598a5e='';var _0x3cf1d0=[];var _0xc4e3c1='';var _0x309208='';var _0x1cb882=[];var _0x2209ce='';var _0x33019c='';var _0x1649b0={};var _0x532c8b='';return db['ServicenowAccount'][_0x88b7('0x4d')]({'where':{'id':_0x32419e[_0x88b7('0x41')]['id']},'attributes':['id',_0x88b7('0x94'),_0x88b7('0x95'),_0x88b7('0x96'),_0x88b7('0x97'),'serverUrl']})[_0x88b7('0x25')](handleEntityNotFound(_0x636e8c,null))[_0x88b7('0x25')](function(_0x4bdbf8){if(_0x4bdbf8){_0x532c8b=_0x4bdbf8['remoteUri'];var _0x1e63eb=_0x532c8b[_0x88b7('0x98')](-0x1);if(_0x1e63eb==='/'){_0x532c8b=_0x532c8b[_0x88b7('0x99')](0x0,_0x532c8b[_0x88b7('0x9a')](_0x1e63eb));}_0x33019c=util[_0x88b7('0x9b')]('%s/api/now/doc/table/schema/',_0x532c8b);_0x2209ce=util[_0x88b7('0x9b')](_0x88b7('0x9c'),_0x532c8b);_0x1649b0={'user':_0x4bdbf8[_0x88b7('0x94')],'pass':_0x4bdbf8[_0x88b7('0x95')]};var _0x9f1eee={'method':_0x88b7('0x9d'),'uri':_0x33019c+_0x88b7('0x9e'),'auth':_0x1649b0,'json':!![]};return rp(_0x9f1eee);}})[_0x88b7('0x25')](function(_0x3386b0){if(_0x3386b0[_0x88b7('0x9f')][_0x88b7('0x49')]>0x0){_0x41fe79=_0x3386b0[_0x88b7('0x9f')];}console[_0x88b7('0xa0')](_0x88b7('0xa1'),_0x41fe79);_0x1cb882=[];_0x598a5e=Object['assign']([],_0x41fe79);_[_0x88b7('0xa2')](_0x598a5e,function(_0xdec9fc){return!_0xf8f1d8[_0x88b7('0xa3')](_0xdec9fc[_0x88b7('0x2d')]);});_0x598a5e[_0x88b7('0xa4')](function(_0x507e07){var _0x4951fb=createFieldObject(_0x2209ce,_0x1649b0,_0x507e07['internalType'],_0x507e07['name'],_0x507e07[_0x88b7('0xa5')],![]);_0x1cb882['push'](_0x4951fb);});return Promise[_0x88b7('0xa6')](_0x1cb882);})[_0x88b7('0x25')](function(_0x410a0a){_0x3cf1d0=_0x410a0a;_0xc4e3c1=Object[_0x88b7('0xa7')]([],_0x41fe79);console[_0x88b7('0xa0')](_0x88b7('0xa8'),_0x41fe79);_[_0x88b7('0xa2')](_0xc4e3c1,function(_0x340ae9){return _0x26477d[_0x88b7('0xa3')](_0x340ae9[_0x88b7('0x2d')]);});console[_0x88b7('0xa0')](_0x88b7('0xa9'),_0xc4e3c1);_0x1cb882=[];_0xc4e3c1[_0x88b7('0xa4')](function(_0x41924d){var _0x450561=createFieldObject(_0x2209ce,_0x1649b0,_0x41924d['internalType'],_0x41924d[_0x88b7('0x2d')],_0x41924d['label'],!![]);_0x1cb882[_0x88b7('0xaa')](_0x450561);});return Promise[_0x88b7('0xa6')](_0x1cb882);})['then'](function(_0x15f872){_0x309208=_0x15f872;var _0x44506a=_0x3cf1d0[_0x88b7('0xab')](_0x309208);return{'count':_0x44506a['length'],'rows':_0x44506a};})['then'](respondWithResult(_0x636e8c,null))[_0x88b7('0x40')](function(_0x37898f){console['log'](_0x88b7('0xac')+_0x37898f);var _0xa00353=_0x32419e['query']['test']?0x1f4:_0x37898f[_0x88b7('0xad')]||0x1f4;logger[_0x88b7('0x27')](_0x37898f['stack']);delete _0x37898f['name'];if(_0xa00353===0x191){_0xa00353=0x190;}_0x636e8c[_0x88b7('0x19')](_0xa00353)[_0x88b7('0x28')](_0x32419e[_0x88b7('0x2e')][_0x88b7('0xae')]?{'message':_0x88b7('0xaf'),'statusCode':_0x37898f[_0x88b7('0xad')]}:_0x37898f);});};function createFieldObject(_0x15225e,_0x5df686,_0x184174,_0x59d4ef,_0x5e3a38,_0x2105ee){return new Promise(function(_0x3858cd,_0x2091fd){var _0x135225={'id':_0x59d4ef,'name':_0x5e3a38,'custom':_0x2105ee};if(_0x184174==='boolean'){_0x135225[_0x88b7('0x3d')]=[{'name':_0x88b7('0xb0'),'value':_0x88b7('0xb1')},{'name':_0x88b7('0xb2'),'value':_0x88b7('0xb3')}];_0x3858cd(_0x135225);}else{var _0x2b997b={'method':_0x88b7('0x9d'),'uri':_0x15225e+_0x88b7('0xb4')+_0x59d4ef,'auth':_0x5df686,'json':!![]};return rp(_0x2b997b)[_0x88b7('0x25')](function(_0x3ec506){var _0x4492f2=[];if(_0x3ec506[_0x88b7('0x9f')][_0x88b7('0x49')]>0x0){_0x3ec506[_0x88b7('0x9f')]['forEach'](function(_0x49a5d5){if(_0x49a5d5['inactive']===_0x88b7('0xb3')){var _0x46f094={'name':_0x49a5d5[_0x88b7('0xa5')],'value':_0x49a5d5[_0x88b7('0xb5')]};_0x4492f2[_0x88b7('0xaa')](_0x46f094);}});}_0x135225['options']=_0x4492f2;if(_0x135225[_0x88b7('0x3d')][_0x88b7('0x49')]>0x0){_0x3858cd(_0x135225);}else{if(_0x2105ee==![]){_0x3858cd();}else{_0x3858cd(_0x135225);}}});}});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index 2709bba..eec844f 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 _0x187d=['exports','define','ServicenowAccount','int_servicenow_accounts','lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./intServicenowAccount.attributes'];(function(_0x456a84,_0x46bc0b){var _0x1117d6=function(_0x20f9d1){while(--_0x20f9d1){_0x456a84['push'](_0x456a84['shift']());}};_0x1117d6(++_0x46bc0b);}(_0x187d,0x93));var _0xd187=function(_0x1cfa0d,_0x4391f2){_0x1cfa0d=_0x1cfa0d-0x0;var _0xe33279=_0x187d[_0x1cfa0d];return _0xe33279;};'use strict';var _=require(_0xd187('0x0'));var util=require('util');var logger=require(_0xd187('0x1'))(_0xd187('0x2'));var moment=require(_0xd187('0x3'));var BPromise=require(_0xd187('0x4'));var rp=require(_0xd187('0x5'));var fs=require('fs');var path=require(_0xd187('0x6'));var rimraf=require('rimraf');var config=require(_0xd187('0x7'));var attributes=require(_0xd187('0x8'));var integrations=require('../../components/integrations/configuration');module[_0xd187('0x9')]=function(_0x58ee7,_0x444a60){return _0x58ee7[_0xd187('0xa')](_0xd187('0xb'),attributes,{'tableName':_0xd187('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xafc4=['path','../../components/integrations/configuration','exports','define','ServicenowAccount','lodash','../../config/logger','moment','bluebird','request-promise'];(function(_0x2853a2,_0x30a79c){var _0x5460ff=function(_0x4ec34e){while(--_0x4ec34e){_0x2853a2['push'](_0x2853a2['shift']());}};_0x5460ff(++_0x30a79c);}(_0xafc4,0x69));var _0x4afc=function(_0x1b04a6,_0x5825f3){_0x1b04a6=_0x1b04a6-0x0;var _0x406fdc=_0xafc4[_0x1b04a6];return _0x406fdc;};'use strict';var _=require(_0x4afc('0x0'));var util=require('util');var logger=require(_0x4afc('0x1'))('api');var moment=require(_0x4afc('0x2'));var BPromise=require(_0x4afc('0x3'));var rp=require(_0x4afc('0x4'));var fs=require('fs');var path=require(_0x4afc('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./intServicenowAccount.attributes');var integrations=require(_0x4afc('0x6'));module[_0x4afc('0x7')]=function(_0x16953b,_0x1bb281){return _0x16953b[_0x4afc('0x8')](_0x4afc('0x9'),attributes,{'tableName':'int_servicenow_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.rpc.js b/server/api/intServicenowAccount/intServicenowAccount.rpc.js index 10cded7..9d39a22 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 _0x8cc2=['catch','GetServicenowAccount','ServicenowAccount','options','raw','attributes','include','map','ShowServicenowAccount','find','model','stringify','lodash','ioredis','../../config/utils','rpc','jayson/promise','request','then','info','ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','error','code','message','result'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x8cc2,0x178));var _0x28cc=function(_0xcd004c,_0x27dd43){_0xcd004c=_0xcd004c-0x0;var _0x227714=_0x8cc2[_0xcd004c];return _0x227714;};'use strict';var _=require(_0x28cc('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x28cc('0x1'));var db=require('../../mysqldb')['db'];var utils=require(_0x28cc('0x2'));var logger=require('../../config/logger')(_0x28cc('0x3'));var config=require('../../config/environment');var jayson=require(_0x28cc('0x4'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3578d4,_0x9bfd0f,_0x336161){return new BPromise(function(_0x3a87b9,_0x29e5c5){return client[_0x28cc('0x5')](_0x3578d4,_0x336161)[_0x28cc('0x6')](function(_0x1ae315){logger[_0x28cc('0x7')](_0x28cc('0x8'),_0x9bfd0f,_0x28cc('0x9'));logger[_0x28cc('0xa')](_0x28cc('0xb'),_0x9bfd0f,_0x28cc('0x9'),JSON['stringify'](_0x1ae315));if(_0x1ae315[_0x28cc('0xc')]){if(_0x1ae315[_0x28cc('0xc')][_0x28cc('0xd')]===0x1f4){logger[_0x28cc('0xc')]('ServicenowAccount,\x20%s,\x20%s',_0x9bfd0f,_0x1ae315['error'][_0x28cc('0xe')]);return _0x29e5c5(_0x1ae315[_0x28cc('0xc')][_0x28cc('0xe')]);}logger[_0x28cc('0xc')]('ServicenowAccount,\x20%s,\x20%s',_0x9bfd0f,_0x1ae315['error'][_0x28cc('0xe')]);return _0x3a87b9(_0x1ae315[_0x28cc('0xc')][_0x28cc('0xe')]);}else{logger[_0x28cc('0x7')](_0x28cc('0x8'),_0x9bfd0f,_0x28cc('0x9'));_0x3a87b9(_0x1ae315[_0x28cc('0xf')]['message']);}})[_0x28cc('0x10')](function(_0x3c668e){logger['error'](_0x28cc('0x8'),_0x9bfd0f,_0x3c668e);_0x29e5c5(_0x3c668e);});});}exports[_0x28cc('0x11')]=function(_0x482dc4){var _0x5dd996=this;return new Promise(function(_0x4abdf7,_0x1d20d5){return db[_0x28cc('0x12')]['findAll']({'raw':_0x482dc4[_0x28cc('0x13')]?_0x482dc4[_0x28cc('0x13')][_0x28cc('0x14')]===undefined?!![]:![]:!![],'where':_0x482dc4[_0x28cc('0x13')]?_0x482dc4[_0x28cc('0x13')]['where']||null:null,'attributes':_0x482dc4[_0x28cc('0x13')]?_0x482dc4[_0x28cc('0x13')][_0x28cc('0x15')]||null:null,'limit':_0x482dc4[_0x28cc('0x13')]?_0x482dc4['options']['limit']||null:null,'include':_0x482dc4[_0x28cc('0x13')]?_0x482dc4[_0x28cc('0x13')][_0x28cc('0x16')]?_[_0x28cc('0x17')](_0x482dc4[_0x28cc('0x13')][_0x28cc('0x16')],function(_0x104644){return{'model':db[_0x104644['model']],'as':_0x104644['as'],'attributes':_0x104644['attributes'],'include':_0x104644[_0x28cc('0x16')]?_['map'](_0x104644['include'],function(_0x4d3123){return{'model':db[_0x4d3123['model']],'as':_0x4d3123['as'],'attributes':_0x4d3123[_0x28cc('0x15')],'include':_0x4d3123[_0x28cc('0x16')]?_[_0x28cc('0x17')](_0x4d3123[_0x28cc('0x16')],function(_0x3eec41){return{'model':db[_0x3eec41['model']],'as':_0x3eec41['as'],'attributes':_0x3eec41[_0x28cc('0x15')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3c8434){logger[_0x28cc('0x7')]('GetServicenowAccount',_0x482dc4);logger[_0x28cc('0xa')](_0x28cc('0x11'),_0x482dc4,JSON['stringify'](_0x3c8434));_0x4abdf7(_0x3c8434);})[_0x28cc('0x10')](function(_0x385feb){logger[_0x28cc('0xc')](_0x28cc('0x11'),_0x385feb[_0x28cc('0xe')],_0x482dc4);_0x1d20d5(_0x5dd996[_0x28cc('0xc')](0x1f4,_0x385feb[_0x28cc('0xe')]));});});};exports[_0x28cc('0x18')]=function(_0x301c6e){var _0x50ac0f=this;return new Promise(function(_0x216bae,_0x5ee9ee){return db[_0x28cc('0x12')][_0x28cc('0x19')]({'raw':_0x301c6e[_0x28cc('0x13')]?_0x301c6e[_0x28cc('0x13')]['raw']===undefined?!![]:![]:!![],'where':_0x301c6e['options']?_0x301c6e[_0x28cc('0x13')]['where']||null:null,'attributes':_0x301c6e[_0x28cc('0x13')]?_0x301c6e[_0x28cc('0x13')][_0x28cc('0x15')]||null:null,'include':_0x301c6e[_0x28cc('0x13')]?_0x301c6e[_0x28cc('0x13')][_0x28cc('0x16')]?_['map'](_0x301c6e['options'][_0x28cc('0x16')],function(_0x4f5436){return{'model':db[_0x4f5436['model']],'as':_0x4f5436['as'],'attributes':_0x4f5436[_0x28cc('0x15')],'include':_0x4f5436[_0x28cc('0x16')]?_[_0x28cc('0x17')](_0x4f5436[_0x28cc('0x16')],function(_0x33d926){return{'model':db[_0x33d926['model']],'as':_0x33d926['as'],'attributes':_0x33d926['attributes'],'include':_0x33d926['include']?_['map'](_0x33d926[_0x28cc('0x16')],function(_0x3cbb2d){return{'model':db[_0x3cbb2d[_0x28cc('0x1a')]],'as':_0x3cbb2d['as'],'attributes':_0x3cbb2d[_0x28cc('0x15')]};}):[]};}):[]};}):[]:[]})[_0x28cc('0x6')](function(_0x51d89b){logger['info'](_0x28cc('0x18'),_0x301c6e);logger[_0x28cc('0xa')](_0x28cc('0x18'),_0x301c6e,JSON[_0x28cc('0x1b')](_0x51d89b));_0x216bae(_0x51d89b);})[_0x28cc('0x10')](function(_0x39798c){logger[_0x28cc('0xc')](_0x28cc('0x18'),_0x39798c['message'],_0x301c6e);_0x5ee9ee(_0x50ac0f['error'](0x1f4,_0x39798c[_0x28cc('0xe')]));});});}; \ No newline at end of file +var _0x98f5=['then','info','ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','ServicenowAccount','findAll','options','raw','attributes','include','map','model','GetServicenowAccount','ShowServicenowAccount','find','where','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x41b0a8,_0x1b05cc){var _0x3a83d4=function(_0x3d1011){while(--_0x3d1011){_0x41b0a8['push'](_0x41b0a8['shift']());}};_0x3a83d4(++_0x1b05cc);}(_0x98f5,0xc6));var _0x598f=function(_0x3cab90,_0x214670){_0x3cab90=_0x3cab90-0x0;var _0x5720a3=_0x98f5[_0x3cab90];return _0x5720a3;};'use strict';var _=require(_0x598f('0x0'));var util=require('util');var moment=require(_0x598f('0x1'));var BPromise=require(_0x598f('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x598f('0x3'));var db=require(_0x598f('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x598f('0x5'))(_0x598f('0x6'));var config=require(_0x598f('0x7'));var jayson=require(_0x598f('0x8'));var client=jayson[_0x598f('0x9')][_0x598f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x52e361,_0x759d8,_0x4ec79f){return new BPromise(function(_0xb0076a,_0x19ba7f){return client[_0x598f('0xb')](_0x52e361,_0x4ec79f)[_0x598f('0xc')](function(_0x305984){logger[_0x598f('0xd')](_0x598f('0xe'),_0x759d8,_0x598f('0xf'));logger[_0x598f('0x10')]('ServicenowAccount,\x20%s,\x20%s,\x20%s',_0x759d8,'request\x20sent',JSON[_0x598f('0x11')](_0x305984));if(_0x305984[_0x598f('0x12')]){if(_0x305984[_0x598f('0x12')][_0x598f('0x13')]===0x1f4){logger[_0x598f('0x12')]('ServicenowAccount,\x20%s,\x20%s',_0x759d8,_0x305984[_0x598f('0x12')][_0x598f('0x14')]);return _0x19ba7f(_0x305984['error'][_0x598f('0x14')]);}logger[_0x598f('0x12')](_0x598f('0xe'),_0x759d8,_0x305984[_0x598f('0x12')][_0x598f('0x14')]);return _0xb0076a(_0x305984['error'][_0x598f('0x14')]);}else{logger[_0x598f('0xd')]('ServicenowAccount,\x20%s,\x20%s',_0x759d8,_0x598f('0xf'));_0xb0076a(_0x305984[_0x598f('0x15')][_0x598f('0x14')]);}})[_0x598f('0x16')](function(_0x190f3e){logger[_0x598f('0x12')](_0x598f('0xe'),_0x759d8,_0x190f3e);_0x19ba7f(_0x190f3e);});});}exports['GetServicenowAccount']=function(_0x4f79fd){var _0x47de35=this;return new Promise(function(_0x5805d0,_0x4b4c26){return db[_0x598f('0x17')][_0x598f('0x18')]({'raw':_0x4f79fd[_0x598f('0x19')]?_0x4f79fd['options'][_0x598f('0x1a')]===undefined?!![]:![]:!![],'where':_0x4f79fd[_0x598f('0x19')]?_0x4f79fd[_0x598f('0x19')]['where']||null:null,'attributes':_0x4f79fd[_0x598f('0x19')]?_0x4f79fd[_0x598f('0x19')][_0x598f('0x1b')]||null:null,'limit':_0x4f79fd[_0x598f('0x19')]?_0x4f79fd[_0x598f('0x19')]['limit']||null:null,'include':_0x4f79fd[_0x598f('0x19')]?_0x4f79fd[_0x598f('0x19')][_0x598f('0x1c')]?_[_0x598f('0x1d')](_0x4f79fd[_0x598f('0x19')]['include'],function(_0x9b4446){return{'model':db[_0x9b4446[_0x598f('0x1e')]],'as':_0x9b4446['as'],'attributes':_0x9b4446[_0x598f('0x1b')],'include':_0x9b4446['include']?_[_0x598f('0x1d')](_0x9b4446['include'],function(_0x40f16c){return{'model':db[_0x40f16c[_0x598f('0x1e')]],'as':_0x40f16c['as'],'attributes':_0x40f16c[_0x598f('0x1b')],'include':_0x40f16c[_0x598f('0x1c')]?_['map'](_0x40f16c[_0x598f('0x1c')],function(_0x2d8839){return{'model':db[_0x2d8839[_0x598f('0x1e')]],'as':_0x2d8839['as'],'attributes':_0x2d8839[_0x598f('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x598f('0xc')](function(_0xa9f226){logger[_0x598f('0xd')](_0x598f('0x1f'),_0x4f79fd);logger['debug'](_0x598f('0x1f'),_0x4f79fd,JSON[_0x598f('0x11')](_0xa9f226));_0x5805d0(_0xa9f226);})[_0x598f('0x16')](function(_0x36c3be){logger[_0x598f('0x12')]('GetServicenowAccount',_0x36c3be[_0x598f('0x14')],_0x4f79fd);_0x4b4c26(_0x47de35[_0x598f('0x12')](0x1f4,_0x36c3be['message']));});});};exports[_0x598f('0x20')]=function(_0x5a5e8b){var _0x578999=this;return new Promise(function(_0x20142f,_0x514888){return db[_0x598f('0x17')][_0x598f('0x21')]({'raw':_0x5a5e8b[_0x598f('0x19')]?_0x5a5e8b[_0x598f('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x5a5e8b[_0x598f('0x19')]?_0x5a5e8b[_0x598f('0x19')][_0x598f('0x22')]||null:null,'attributes':_0x5a5e8b['options']?_0x5a5e8b[_0x598f('0x19')][_0x598f('0x1b')]||null:null,'include':_0x5a5e8b[_0x598f('0x19')]?_0x5a5e8b['options']['include']?_[_0x598f('0x1d')](_0x5a5e8b['options'][_0x598f('0x1c')],function(_0x219caf){return{'model':db[_0x219caf[_0x598f('0x1e')]],'as':_0x219caf['as'],'attributes':_0x219caf[_0x598f('0x1b')],'include':_0x219caf[_0x598f('0x1c')]?_[_0x598f('0x1d')](_0x219caf[_0x598f('0x1c')],function(_0x37583d){return{'model':db[_0x37583d['model']],'as':_0x37583d['as'],'attributes':_0x37583d[_0x598f('0x1b')],'include':_0x37583d[_0x598f('0x1c')]?_[_0x598f('0x1d')](_0x37583d['include'],function(_0x1d3406){return{'model':db[_0x1d3406[_0x598f('0x1e')]],'as':_0x1d3406['as'],'attributes':_0x1d3406[_0x598f('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x598f('0xc')](function(_0x4c4853){logger[_0x598f('0xd')](_0x598f('0x20'),_0x5a5e8b);logger[_0x598f('0x10')](_0x598f('0x20'),_0x5a5e8b,JSON[_0x598f('0x11')](_0x4c4853));_0x20142f(_0x4c4853);})['catch'](function(_0x36f026){logger['error'](_0x598f('0x20'),_0x36f026['message'],_0x5a5e8b);_0x514888(_0x578999['error'](0x1f4,_0x36f026[_0x598f('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index 1693977..851092b 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 _0x5475=['exports','multer','util','connect-timeout','express','fs-extra','../../config/environment','get','isAuthenticated','index','/:id','/:id/fields','getSubjects','/:id/descriptions','post','create','delete'];(function(_0x2faddb,_0xc18b78){var _0x273c05=function(_0x1a3785){while(--_0x1a3785){_0x2faddb['push'](_0x2faddb['shift']());}};_0x273c05(++_0xc18b78);}(_0x5475,0x111));var _0x5547=function(_0x255d5b,_0x4f6f35){_0x255d5b=_0x255d5b-0x0;var _0x3e141a=_0x5475[_0x255d5b];return _0x3e141a;};'use strict';var multer=require(_0x5547('0x0'));var util=require(_0x5547('0x1'));var path=require('path');var timeout=require(_0x5547('0x2'));var express=require(_0x5547('0x3'));var router=express['Router']();var fs_extra=require(_0x5547('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x5547('0x5'));var controller=require('./intServicenowConfiguration.controller');router[_0x5547('0x6')]('/',auth[_0x5547('0x7')](),controller[_0x5547('0x8')]);router[_0x5547('0x6')](_0x5547('0x9'),auth[_0x5547('0x7')](),controller['show']);router[_0x5547('0x6')](_0x5547('0xa'),auth['isAuthenticated'](),controller['getFields']);router['get']('/:id/subjects',auth[_0x5547('0x7')](),controller[_0x5547('0xb')]);router['get'](_0x5547('0xc'),auth[_0x5547('0x7')](),controller['getDescriptions']);router[_0x5547('0xd')]('/',auth[_0x5547('0x7')](),controller[_0x5547('0xe')]);router['put'](_0x5547('0x9'),auth['isAuthenticated'](),controller['update']);router[_0x5547('0xf')]('/:id',auth[_0x5547('0x7')](),controller['destroy']);module[_0x5547('0x10')]=router; \ No newline at end of file +var _0x9a28=['delete','exports','multer','path','connect-timeout','express','Router','fs-extra','./intServicenowConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','create','update'];(function(_0x41db99,_0x333f4b){var _0xb8637a=function(_0x18faa9){while(--_0x18faa9){_0x41db99['push'](_0x41db99['shift']());}};_0xb8637a(++_0x333f4b);}(_0x9a28,0x95));var _0x89a2=function(_0x45f951,_0x2750c8){_0x45f951=_0x45f951-0x0;var _0x24756c=_0x9a28[_0x45f951];return _0x24756c;};'use strict';var multer=require(_0x89a2('0x0'));var util=require('util');var path=require(_0x89a2('0x1'));var timeout=require(_0x89a2('0x2'));var express=require(_0x89a2('0x3'));var router=express[_0x89a2('0x4')]();var fs_extra=require(_0x89a2('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x89a2('0x6'));router[_0x89a2('0x7')]('/',auth[_0x89a2('0x8')](),controller[_0x89a2('0x9')]);router['get'](_0x89a2('0xa'),auth['isAuthenticated'](),controller[_0x89a2('0xb')]);router[_0x89a2('0x7')](_0x89a2('0xc'),auth['isAuthenticated'](),controller[_0x89a2('0xd')]);router[_0x89a2('0x7')](_0x89a2('0xe'),auth[_0x89a2('0x8')](),controller['getSubjects']);router[_0x89a2('0x7')](_0x89a2('0xf'),auth[_0x89a2('0x8')](),controller[_0x89a2('0x10')]);router['post']('/',auth['isAuthenticated'](),controller[_0x89a2('0x11')]);router['put'](_0x89a2('0xa'),auth[_0x89a2('0x8')](),controller[_0x89a2('0x12')]);router[_0x89a2('0x13')](_0x89a2('0xa'),auth[_0x89a2('0x8')](),controller['destroy']);module[_0x89a2('0x14')]=router; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js index 767cafe..ccfae83 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 _0x1735=['exports','STRING','sequelize'];(function(_0x5656e9,_0x4e029d){var _0x30fe5a=function(_0x365c83){while(--_0x365c83){_0x5656e9['push'](_0x5656e9['shift']());}};_0x30fe5a(++_0x4e029d);}(_0x1735,0x18b));var _0x5173=function(_0x46c5d7,_0x13ec1f){_0x46c5d7=_0x46c5d7-0x0;var _0x512f9b=_0x1735[_0x46c5d7];return _0x512f9b;};'use strict';var Sequelize=require(_0x5173('0x0'));module[_0x5173('0x1')]={'name':{'type':Sequelize[_0x5173('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x38df=['STRING','sequelize','exports'];(function(_0x36f284,_0x24cbd1){var _0x4ea099=function(_0xea729e){while(--_0xea729e){_0x36f284['push'](_0x36f284['shift']());}};_0x4ea099(++_0x24cbd1);}(_0x38df,0x17e));var _0xf38d=function(_0x5ef1d3,_0x1feca1){_0x5ef1d3=_0x5ef1d3-0x0;var _0x3c990e=_0x38df[_0x5ef1d3];return _0x3c990e;};'use strict';var Sequelize=require(_0xf38d('0x0'));module[_0xf38d('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xf38d('0x2')]}}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js index ec1de96..b498795 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 _0x34b6=['order','sort','pick','filter','where','merge','VIRTUAL','options','ServicenowConfiguration','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','getFields','findOne','ServicenowField','getSubjects','nolimit','getDescriptions','fast-json-patch','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','stack','name','send','index','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty'];(function(_0x49c246,_0x215b1b){var _0x1ffff9=function(_0x32c3aa){while(--_0x32c3aa){_0x49c246['push'](_0x49c246['shift']());}};_0x1ffff9(++_0x215b1b);}(_0x34b6,0x15e));var _0x634b=function(_0x20580a,_0xc57976){_0x20580a=_0x20580a-0x0;var _0x2732ec=_0x34b6[_0x20580a];return _0x2732ec;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x634b('0x0'));var rp=require('request-promise');var moment=require(_0x634b('0x1'));var BPromise=require(_0x634b('0x2'));var Mustache=require('mustache');var util=require(_0x634b('0x3'));var path=require('path');var sox=require(_0x634b('0x4'));var csv=require(_0x634b('0x5'));var ejs=require(_0x634b('0x6'));var fs=require('fs');var fs_extra=require(_0x634b('0x7'));var _=require(_0x634b('0x8'));var squel=require(_0x634b('0x9'));var crypto=require(_0x634b('0xa'));var jsforce=require(_0x634b('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x634b('0x5'));var querystring=require('querystring');var Papa=require(_0x634b('0xc'));var Redis=require(_0x634b('0xd'));var authService=require(_0x634b('0xe'));var qs=require(_0x634b('0xf'));var as=require(_0x634b('0x10'));var hardwareService=require(_0x634b('0x11'));var logger=require(_0x634b('0x12'))(_0x634b('0x13'));var utils=require('../../config/utils');var config=require(_0x634b('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x634b('0x15'))['db'];function respondWithStatusCode(_0x579c44,_0x462044){_0x462044=_0x462044||0xcc;return function(_0x51dc78){if(_0x51dc78){return _0x579c44[_0x634b('0x16')](_0x462044);}return _0x579c44['status'](_0x462044)[_0x634b('0x17')]();};}function respondWithResult(_0x37a042,_0x583017){_0x583017=_0x583017||0xc8;return function(_0x8f9413){if(_0x8f9413){return _0x37a042[_0x634b('0x18')](_0x583017)[_0x634b('0x19')](_0x8f9413);}};}function respondWithFilteredResult(_0x293125,_0xcb825e){return function(_0x235119){if(_0x235119){var _0x46831d=typeof _0xcb825e[_0x634b('0x1a')]===_0x634b('0x1b')&&typeof _0xcb825e[_0x634b('0x1c')]===_0x634b('0x1b');var _0xcce721=_0x235119[_0x634b('0x1d')];var _0x46b78c=_0x46831d?0x0:_0xcb825e[_0x634b('0x1a')];var _0x7c1c2=_0x46831d?_0x235119[_0x634b('0x1d')]:_0xcb825e['offset']+_0xcb825e[_0x634b('0x1c')];var _0x2b9461;if(_0x7c1c2>=_0xcce721){_0x7c1c2=_0xcce721;_0x2b9461=0xc8;}else{_0x2b9461=0xce;}_0x293125[_0x634b('0x18')](_0x2b9461);return _0x293125[_0x634b('0x1e')](_0x634b('0x1f'),_0x46b78c+'-'+_0x7c1c2+'/'+_0xcce721)['json'](_0x235119);}return null;};}function patchUpdates(_0x3a4332){return function(_0x2fec41){try{jsonpatch[_0x634b('0x20')](_0x2fec41,_0x3a4332,!![]);}catch(_0x40159a){return BPromise[_0x634b('0x21')](_0x40159a);}return _0x2fec41[_0x634b('0x22')]();};}function saveUpdates(_0x2588e4,_0x25c50b){return function(_0x14e7cf){if(_0x14e7cf){return _0x14e7cf[_0x634b('0x23')](_0x2588e4)['then'](function(_0x1af428){return _0x1af428;});}return null;};}function removeEntity(_0x508373,_0x4d2a55){return function(_0x45afc6){if(_0x45afc6){return _0x45afc6[_0x634b('0x24')]()[_0x634b('0x25')](function(){_0x508373[_0x634b('0x18')](0xcc)[_0x634b('0x17')]();});}};}function handleEntityNotFound(_0x5bec7d,_0x30e042){return function(_0x55adb2){if(!_0x55adb2){_0x5bec7d[_0x634b('0x16')](0x194);}return _0x55adb2;};}function handleError(_0x1351ef,_0x33a754){_0x33a754=_0x33a754||0x1f4;return function(_0x54622d){logger['error'](_0x54622d[_0x634b('0x26')]);if(_0x54622d[_0x634b('0x27')]){delete _0x54622d[_0x634b('0x27')];}_0x1351ef['status'](_0x33a754)[_0x634b('0x28')](_0x54622d);};}exports[_0x634b('0x29')]=function(_0x494071,_0x44ddf5){var _0x968f46={},_0x1ed14a={},_0x972dcd={'count':0x0,'rows':[]};var _0x5db25d=_['map'](db['ServicenowConfiguration']['rawAttributes'],function(_0x28ecf6){return{'name':_0x28ecf6[_0x634b('0x2a')],'type':_0x28ecf6[_0x634b('0x2b')][_0x634b('0x2c')]};});_0x1ed14a[_0x634b('0x2d')]=_[_0x634b('0x2e')](_0x5db25d,_0x634b('0x27'));_0x1ed14a[_0x634b('0x2f')]=_[_0x634b('0x30')](_0x494071[_0x634b('0x2f')]);_0x1ed14a[_0x634b('0x31')]=_[_0x634b('0x32')](_0x1ed14a['model'],_0x1ed14a[_0x634b('0x2f')]);_0x968f46[_0x634b('0x33')]=_['intersection'](_0x1ed14a[_0x634b('0x2d')],qs['fields'](_0x494071[_0x634b('0x2f')][_0x634b('0x34')]));_0x968f46['attributes']=_0x968f46[_0x634b('0x33')][_0x634b('0x35')]?_0x968f46['attributes']:_0x1ed14a['model'];if(!_0x494071[_0x634b('0x2f')][_0x634b('0x36')]('nolimit')){_0x968f46[_0x634b('0x1c')]=qs[_0x634b('0x1c')](_0x494071[_0x634b('0x2f')][_0x634b('0x1c')]);_0x968f46[_0x634b('0x1a')]=qs[_0x634b('0x1a')](_0x494071[_0x634b('0x2f')][_0x634b('0x1a')]);}_0x968f46[_0x634b('0x37')]=qs[_0x634b('0x38')](_0x494071[_0x634b('0x2f')][_0x634b('0x38')]);_0x968f46['where']=qs['filters'](_[_0x634b('0x39')](_0x494071['query'],_0x1ed14a[_0x634b('0x31')]),_0x5db25d);if(_0x494071[_0x634b('0x2f')][_0x634b('0x3a')]){_0x968f46[_0x634b('0x3b')]=_[_0x634b('0x3c')](_0x968f46[_0x634b('0x3b')],{'$or':_['map'](_0x5db25d,function(_0x51907e){if(_0x51907e[_0x634b('0x2b')]!==_0x634b('0x3d')){var _0x425d67={};_0x425d67[_0x51907e['name']]={'$like':'%'+_0x494071['query'][_0x634b('0x3a')]+'%'};return _0x425d67;}})});}_0x968f46=_[_0x634b('0x3c')]({},_0x968f46,_0x494071[_0x634b('0x3e')]);var _0x229c1a={'where':_0x968f46[_0x634b('0x3b')]};return db[_0x634b('0x3f')][_0x634b('0x1d')](_0x229c1a)['then'](function(_0x211607){_0x972dcd[_0x634b('0x1d')]=_0x211607;if(_0x494071[_0x634b('0x2f')][_0x634b('0x40')]){_0x968f46[_0x634b('0x41')]=[{'all':!![]}];}return db[_0x634b('0x3f')][_0x634b('0x42')](_0x968f46);})[_0x634b('0x25')](function(_0xafd5ed){_0x972dcd[_0x634b('0x43')]=_0xafd5ed;return _0x972dcd;})[_0x634b('0x25')](respondWithFilteredResult(_0x44ddf5,_0x968f46))[_0x634b('0x44')](handleError(_0x44ddf5,null));};exports[_0x634b('0x45')]=function(_0x5c78a1,_0x5748cd){var _0x46c183={'raw':![],'where':{'id':_0x5c78a1[_0x634b('0x46')]['id']}},_0x2834c7={};_0x2834c7[_0x634b('0x2d')]=_[_0x634b('0x30')](db['ServicenowConfiguration'][_0x634b('0x47')]);_0x2834c7[_0x634b('0x2f')]=_[_0x634b('0x30')](_0x5c78a1[_0x634b('0x2f')]);_0x2834c7[_0x634b('0x31')]=_[_0x634b('0x32')](_0x2834c7['model'],_0x2834c7[_0x634b('0x2f')]);_0x46c183[_0x634b('0x33')]=_[_0x634b('0x32')](_0x2834c7[_0x634b('0x2d')],qs[_0x634b('0x34')](_0x5c78a1['query'][_0x634b('0x34')]));_0x46c183[_0x634b('0x33')]=_0x46c183[_0x634b('0x33')][_0x634b('0x35')]?_0x46c183[_0x634b('0x33')]:_0x2834c7[_0x634b('0x2d')];if(_0x5c78a1[_0x634b('0x2f')][_0x634b('0x40')]){_0x46c183[_0x634b('0x41')]=[{'all':!![]}];}_0x46c183=_['merge']({},_0x46c183,_0x5c78a1[_0x634b('0x3e')]);return db[_0x634b('0x3f')][_0x634b('0x48')](_0x46c183)[_0x634b('0x25')](handleEntityNotFound(_0x5748cd,null))[_0x634b('0x25')](respondWithResult(_0x5748cd,null))['catch'](handleError(_0x5748cd,null));};exports[_0x634b('0x49')]=function(_0x3fd25f,_0x327985){return db[_0x634b('0x3f')]['create'](_0x3fd25f[_0x634b('0x4a')],{})[_0x634b('0x25')](respondWithResult(_0x327985,0xc9))['catch'](handleError(_0x327985,null));};exports[_0x634b('0x23')]=function(_0x289e19,_0x2ba3c3){if(_0x289e19['body']['id']){delete _0x289e19[_0x634b('0x4a')]['id'];}return db[_0x634b('0x3f')][_0x634b('0x48')]({'where':{'id':_0x289e19[_0x634b('0x46')]['id']}})['then'](handleEntityNotFound(_0x2ba3c3,null))['then'](saveUpdates(_0x289e19[_0x634b('0x4a')],null))[_0x634b('0x25')](respondWithResult(_0x2ba3c3,null))['catch'](handleError(_0x2ba3c3,null));};exports['destroy']=function(_0x2f5e5a,_0x425854){return db[_0x634b('0x3f')]['find']({'where':{'id':_0x2f5e5a[_0x634b('0x46')]['id']}})[_0x634b('0x25')](handleEntityNotFound(_0x425854,null))['then'](removeEntity(_0x425854,null))[_0x634b('0x44')](handleError(_0x425854,null));};exports[_0x634b('0x4b')]=function(_0x263538,_0x509ad5,_0x4a65ee){var _0x305e51={};var _0x57f05c={};var _0x1e1f04;var _0x134072;return db['ServicenowConfiguration'][_0x634b('0x4c')]({'where':{'id':_0x263538[_0x634b('0x46')]['id']}})[_0x634b('0x25')](handleEntityNotFound(_0x509ad5,null))[_0x634b('0x25')](function(_0x12d254){if(_0x12d254){_0x1e1f04=_0x12d254;_0x57f05c[_0x634b('0x2d')]=_['keys'](db[_0x634b('0x4d')]['rawAttributes']);_0x57f05c[_0x634b('0x2f')]=_[_0x634b('0x30')](_0x263538[_0x634b('0x2f')]);_0x57f05c[_0x634b('0x31')]=_['intersection'](_0x57f05c[_0x634b('0x2d')],_0x57f05c[_0x634b('0x2f')]);_0x305e51[_0x634b('0x33')]=_[_0x634b('0x32')](_0x57f05c[_0x634b('0x2d')],qs['fields'](_0x263538[_0x634b('0x2f')][_0x634b('0x34')]));_0x305e51[_0x634b('0x33')]=_0x305e51[_0x634b('0x33')][_0x634b('0x35')]?_0x305e51[_0x634b('0x33')]:_0x57f05c['model'];_0x305e51[_0x634b('0x37')]=qs['sort'](_0x263538[_0x634b('0x2f')][_0x634b('0x38')]);_0x305e51[_0x634b('0x3b')]=qs[_0x634b('0x31')](_[_0x634b('0x39')](_0x263538[_0x634b('0x2f')],_0x57f05c[_0x634b('0x31')]));if(_0x263538[_0x634b('0x2f')]['filter']){_0x305e51[_0x634b('0x3b')]=_[_0x634b('0x3c')](_0x305e51[_0x634b('0x3b')],{'$or':_[_0x634b('0x2e')](_0x305e51[_0x634b('0x33')],function(_0x22d20a){var _0x8cce08={};_0x8cce08[_0x22d20a]={'$like':'%'+_0x263538[_0x634b('0x2f')][_0x634b('0x3a')]+'%'};return _0x8cce08;})});}_0x305e51=_[_0x634b('0x3c')]({},_0x305e51,_0x263538[_0x634b('0x3e')]);return _0x1e1f04[_0x634b('0x4b')](_0x305e51);}})[_0x634b('0x25')](function(_0x2d7765){if(_0x2d7765){_0x134072=_0x2d7765[_0x634b('0x35')];if(!_0x263538['query']['hasOwnProperty']('nolimit')){_0x305e51[_0x634b('0x1c')]=qs[_0x634b('0x1c')](_0x263538[_0x634b('0x2f')][_0x634b('0x1c')]);_0x305e51[_0x634b('0x1a')]=qs['offset'](_0x263538['query'][_0x634b('0x1a')]);}return _0x1e1f04[_0x634b('0x4b')](_0x305e51);}})['then'](function(_0x46ab86){if(_0x46ab86){return _0x46ab86?{'count':_0x134072,'rows':_0x46ab86}:null;}})[_0x634b('0x25')](respondWithResult(_0x509ad5,null))['catch'](handleError(_0x509ad5,null));};exports[_0x634b('0x4e')]=function(_0x13195a,_0x3c19ae,_0x4db474){var _0x5dff41={};var _0x200ef4={};var _0x12600a;var _0x5a2302;return db[_0x634b('0x3f')]['findOne']({'where':{'id':_0x13195a['params']['id']}})[_0x634b('0x25')](handleEntityNotFound(_0x3c19ae,null))[_0x634b('0x25')](function(_0x4f83cd){if(_0x4f83cd){_0x12600a=_0x4f83cd;_0x200ef4[_0x634b('0x2d')]=_[_0x634b('0x30')](db['ServicenowField'][_0x634b('0x47')]);_0x200ef4[_0x634b('0x2f')]=_['keys'](_0x13195a[_0x634b('0x2f')]);_0x200ef4[_0x634b('0x31')]=_[_0x634b('0x32')](_0x200ef4['model'],_0x200ef4[_0x634b('0x2f')]);_0x5dff41[_0x634b('0x33')]=_['intersection'](_0x200ef4['model'],qs[_0x634b('0x34')](_0x13195a[_0x634b('0x2f')]['fields']));_0x5dff41[_0x634b('0x33')]=_0x5dff41[_0x634b('0x33')]['length']?_0x5dff41['attributes']:_0x200ef4[_0x634b('0x2d')];_0x5dff41[_0x634b('0x37')]=qs['sort'](_0x13195a[_0x634b('0x2f')][_0x634b('0x38')]);_0x5dff41[_0x634b('0x3b')]=qs['filters'](_[_0x634b('0x39')](_0x13195a['query'],_0x200ef4[_0x634b('0x31')]));if(_0x13195a[_0x634b('0x2f')]['filter']){_0x5dff41[_0x634b('0x3b')]=_[_0x634b('0x3c')](_0x5dff41[_0x634b('0x3b')],{'$or':_[_0x634b('0x2e')](_0x5dff41[_0x634b('0x33')],function(_0xc6b3e2){var _0xa7174e={};_0xa7174e[_0xc6b3e2]={'$like':'%'+_0x13195a['query'][_0x634b('0x3a')]+'%'};return _0xa7174e;})});}_0x5dff41=_[_0x634b('0x3c')]({},_0x5dff41,_0x13195a[_0x634b('0x3e')]);return _0x12600a['getSubjects'](_0x5dff41);}})[_0x634b('0x25')](function(_0x1e985b){if(_0x1e985b){_0x5a2302=_0x1e985b[_0x634b('0x35')];if(!_0x13195a[_0x634b('0x2f')][_0x634b('0x36')](_0x634b('0x4f'))){_0x5dff41[_0x634b('0x1c')]=qs[_0x634b('0x1c')](_0x13195a[_0x634b('0x2f')]['limit']);_0x5dff41[_0x634b('0x1a')]=qs[_0x634b('0x1a')](_0x13195a['query']['offset']);}return _0x12600a[_0x634b('0x4e')](_0x5dff41);}})['then'](function(_0x4721fb){if(_0x4721fb){return _0x4721fb?{'count':_0x5a2302,'rows':_0x4721fb}:null;}})[_0x634b('0x25')](respondWithResult(_0x3c19ae,null))[_0x634b('0x44')](handleError(_0x3c19ae,null));};exports[_0x634b('0x50')]=function(_0x531ac5,_0x188b75,_0x3ca515){var _0x552b0c={};var _0x44a8de={};var _0x47fb3c;var _0xae94d7;return db[_0x634b('0x3f')]['findOne']({'where':{'id':_0x531ac5['params']['id']}})[_0x634b('0x25')](handleEntityNotFound(_0x188b75,null))[_0x634b('0x25')](function(_0x4cbf18){if(_0x4cbf18){_0x47fb3c=_0x4cbf18;_0x44a8de[_0x634b('0x2d')]=_[_0x634b('0x30')](db[_0x634b('0x4d')]['rawAttributes']);_0x44a8de[_0x634b('0x2f')]=_[_0x634b('0x30')](_0x531ac5[_0x634b('0x2f')]);_0x44a8de[_0x634b('0x31')]=_[_0x634b('0x32')](_0x44a8de[_0x634b('0x2d')],_0x44a8de[_0x634b('0x2f')]);_0x552b0c[_0x634b('0x33')]=_[_0x634b('0x32')](_0x44a8de[_0x634b('0x2d')],qs['fields'](_0x531ac5[_0x634b('0x2f')][_0x634b('0x34')]));_0x552b0c[_0x634b('0x33')]=_0x552b0c[_0x634b('0x33')]['length']?_0x552b0c[_0x634b('0x33')]:_0x44a8de[_0x634b('0x2d')];_0x552b0c[_0x634b('0x37')]=qs['sort'](_0x531ac5['query']['sort']);_0x552b0c['where']=qs[_0x634b('0x31')](_[_0x634b('0x39')](_0x531ac5['query'],_0x44a8de[_0x634b('0x31')]));if(_0x531ac5['query'][_0x634b('0x3a')]){_0x552b0c[_0x634b('0x3b')]=_[_0x634b('0x3c')](_0x552b0c[_0x634b('0x3b')],{'$or':_['map'](_0x552b0c[_0x634b('0x33')],function(_0x91aa7a){var _0x522c4e={};_0x522c4e[_0x91aa7a]={'$like':'%'+_0x531ac5['query']['filter']+'%'};return _0x522c4e;})});}_0x552b0c=_['merge']({},_0x552b0c,_0x531ac5[_0x634b('0x3e')]);return _0x47fb3c[_0x634b('0x50')](_0x552b0c);}})[_0x634b('0x25')](function(_0x3b5a27){if(_0x3b5a27){_0xae94d7=_0x3b5a27['length'];if(!_0x531ac5[_0x634b('0x2f')]['hasOwnProperty'](_0x634b('0x4f'))){_0x552b0c[_0x634b('0x1c')]=qs[_0x634b('0x1c')](_0x531ac5[_0x634b('0x2f')][_0x634b('0x1c')]);_0x552b0c[_0x634b('0x1a')]=qs[_0x634b('0x1a')](_0x531ac5[_0x634b('0x2f')][_0x634b('0x1a')]);}return _0x47fb3c[_0x634b('0x50')](_0x552b0c);}})[_0x634b('0x25')](function(_0x5b87e5){if(_0x5b87e5){return _0x5b87e5?{'count':_0xae94d7,'rows':_0x5b87e5}:null;}})[_0x634b('0x25')](respondWithResult(_0x188b75,null))[_0x634b('0x44')](handleError(_0x188b75,null));}; \ No newline at end of file +var _0x7ba4=['then','destroy','end','stack','name','send','index','map','ServicenowConfiguration','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','show','catch','create','body','find','params','getFields','findOne','ServicenowField','hasOwnProperty','getSubjects','getDescriptions','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','undefined','limit','offset','count','set','Content-Range','apply','save','update'];(function(_0x14e799,_0x5aba4e){var _0x45e6f0=function(_0x4d7820){while(--_0x4d7820){_0x14e799['push'](_0x14e799['shift']());}};_0x45e6f0(++_0x5aba4e);}(_0x7ba4,0xd8));var _0x47ba=function(_0x32d546,_0xa35096){_0x32d546=_0x32d546-0x0;var _0x5236bb=_0x7ba4[_0x32d546];return _0x5236bb;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x47ba('0x0'));var zipdir=require(_0x47ba('0x1'));var jsonpatch=require(_0x47ba('0x2'));var rp=require(_0x47ba('0x3'));var moment=require(_0x47ba('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47ba('0x5'));var util=require(_0x47ba('0x6'));var path=require(_0x47ba('0x7'));var sox=require(_0x47ba('0x8'));var csv=require(_0x47ba('0x9'));var ejs=require(_0x47ba('0xa'));var fs=require('fs');var fs_extra=require(_0x47ba('0xb'));var _=require(_0x47ba('0xc'));var squel=require(_0x47ba('0xd'));var crypto=require('crypto');var jsforce=require(_0x47ba('0xe'));var deskjs=require(_0x47ba('0xf'));var toCsv=require(_0x47ba('0x9'));var querystring=require(_0x47ba('0x10'));var Papa=require(_0x47ba('0x11'));var Redis=require('ioredis');var authService=require(_0x47ba('0x12'));var qs=require(_0x47ba('0x13'));var as=require(_0x47ba('0x14'));var hardwareService=require(_0x47ba('0x15'));var logger=require(_0x47ba('0x16'))(_0x47ba('0x17'));var utils=require(_0x47ba('0x18'));var config=require(_0x47ba('0x19'));var licenseUtil=require(_0x47ba('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5c6fb5,_0x853a5a){_0x853a5a=_0x853a5a||0xcc;return function(_0x5a5bc9){if(_0x5a5bc9){return _0x5c6fb5[_0x47ba('0x1b')](_0x853a5a);}return _0x5c6fb5[_0x47ba('0x1c')](_0x853a5a)['end']();};}function respondWithResult(_0x531572,_0x21a9d9){_0x21a9d9=_0x21a9d9||0xc8;return function(_0x406bdc){if(_0x406bdc){return _0x531572[_0x47ba('0x1c')](_0x21a9d9)[_0x47ba('0x1d')](_0x406bdc);}};}function respondWithFilteredResult(_0x593432,_0x204e7d){return function(_0x324b9f){if(_0x324b9f){var _0x11945f=typeof _0x204e7d['offset']===_0x47ba('0x1e')&&typeof _0x204e7d[_0x47ba('0x1f')]===_0x47ba('0x1e');var _0x5b679a=_0x324b9f['count'];var _0x279379=_0x11945f?0x0:_0x204e7d[_0x47ba('0x20')];var _0x1f9797=_0x11945f?_0x324b9f[_0x47ba('0x21')]:_0x204e7d[_0x47ba('0x20')]+_0x204e7d['limit'];var _0x577484;if(_0x1f9797>=_0x5b679a){_0x1f9797=_0x5b679a;_0x577484=0xc8;}else{_0x577484=0xce;}_0x593432[_0x47ba('0x1c')](_0x577484);return _0x593432[_0x47ba('0x22')](_0x47ba('0x23'),_0x279379+'-'+_0x1f9797+'/'+_0x5b679a)[_0x47ba('0x1d')](_0x324b9f);}return null;};}function patchUpdates(_0x10ddfd){return function(_0x43e2f4){try{jsonpatch[_0x47ba('0x24')](_0x43e2f4,_0x10ddfd,!![]);}catch(_0x58ec3a){return BPromise['reject'](_0x58ec3a);}return _0x43e2f4[_0x47ba('0x25')]();};}function saveUpdates(_0x70f82a,_0x42b594){return function(_0x5386ac){if(_0x5386ac){return _0x5386ac[_0x47ba('0x26')](_0x70f82a)[_0x47ba('0x27')](function(_0x2901f3){return _0x2901f3;});}return null;};}function removeEntity(_0x2111e6,_0x1076be){return function(_0x610986){if(_0x610986){return _0x610986[_0x47ba('0x28')]()['then'](function(){_0x2111e6[_0x47ba('0x1c')](0xcc)[_0x47ba('0x29')]();});}};}function handleEntityNotFound(_0x170ff1,_0x230216){return function(_0x3eb2c7){if(!_0x3eb2c7){_0x170ff1['sendStatus'](0x194);}return _0x3eb2c7;};}function handleError(_0x273df9,_0xc1cefd){_0xc1cefd=_0xc1cefd||0x1f4;return function(_0x323d72){logger['error'](_0x323d72[_0x47ba('0x2a')]);if(_0x323d72[_0x47ba('0x2b')]){delete _0x323d72[_0x47ba('0x2b')];}_0x273df9[_0x47ba('0x1c')](_0xc1cefd)[_0x47ba('0x2c')](_0x323d72);};}exports[_0x47ba('0x2d')]=function(_0x3403e1,_0x5122ff){var _0x2cb043={},_0x2907d5={},_0x4541b0={'count':0x0,'rows':[]};var _0x284082=_[_0x47ba('0x2e')](db[_0x47ba('0x2f')][_0x47ba('0x30')],function(_0x38f4c1){return{'name':_0x38f4c1[_0x47ba('0x31')],'type':_0x38f4c1['type'][_0x47ba('0x32')]};});_0x2907d5[_0x47ba('0x33')]=_[_0x47ba('0x2e')](_0x284082,_0x47ba('0x2b'));_0x2907d5[_0x47ba('0x34')]=_[_0x47ba('0x35')](_0x3403e1[_0x47ba('0x34')]);_0x2907d5[_0x47ba('0x36')]=_[_0x47ba('0x37')](_0x2907d5[_0x47ba('0x33')],_0x2907d5[_0x47ba('0x34')]);_0x2cb043[_0x47ba('0x38')]=_[_0x47ba('0x37')](_0x2907d5[_0x47ba('0x33')],qs[_0x47ba('0x39')](_0x3403e1[_0x47ba('0x34')][_0x47ba('0x39')]));_0x2cb043[_0x47ba('0x38')]=_0x2cb043[_0x47ba('0x38')][_0x47ba('0x3a')]?_0x2cb043[_0x47ba('0x38')]:_0x2907d5[_0x47ba('0x33')];if(!_0x3403e1[_0x47ba('0x34')]['hasOwnProperty'](_0x47ba('0x3b'))){_0x2cb043[_0x47ba('0x1f')]=qs['limit'](_0x3403e1['query'][_0x47ba('0x1f')]);_0x2cb043[_0x47ba('0x20')]=qs[_0x47ba('0x20')](_0x3403e1[_0x47ba('0x34')][_0x47ba('0x20')]);}_0x2cb043[_0x47ba('0x3c')]=qs[_0x47ba('0x3d')](_0x3403e1[_0x47ba('0x34')][_0x47ba('0x3d')]);_0x2cb043[_0x47ba('0x3e')]=qs[_0x47ba('0x36')](_[_0x47ba('0x3f')](_0x3403e1[_0x47ba('0x34')],_0x2907d5['filters']),_0x284082);if(_0x3403e1[_0x47ba('0x34')][_0x47ba('0x40')]){_0x2cb043[_0x47ba('0x3e')]=_[_0x47ba('0x41')](_0x2cb043['where'],{'$or':_['map'](_0x284082,function(_0x1256a6){if(_0x1256a6[_0x47ba('0x42')]!==_0x47ba('0x43')){var _0x4b5e17={};_0x4b5e17[_0x1256a6['name']]={'$like':'%'+_0x3403e1[_0x47ba('0x34')][_0x47ba('0x40')]+'%'};return _0x4b5e17;}})});}_0x2cb043=_[_0x47ba('0x41')]({},_0x2cb043,_0x3403e1[_0x47ba('0x44')]);var _0x3dd34f={'where':_0x2cb043['where']};return db[_0x47ba('0x2f')][_0x47ba('0x21')](_0x3dd34f)[_0x47ba('0x27')](function(_0x380827){_0x4541b0[_0x47ba('0x21')]=_0x380827;if(_0x3403e1[_0x47ba('0x34')][_0x47ba('0x45')]){_0x2cb043[_0x47ba('0x46')]=[{'all':!![]}];}return db[_0x47ba('0x2f')][_0x47ba('0x47')](_0x2cb043);})[_0x47ba('0x27')](function(_0x351758){_0x4541b0[_0x47ba('0x48')]=_0x351758;return _0x4541b0;})[_0x47ba('0x27')](respondWithFilteredResult(_0x5122ff,_0x2cb043))['catch'](handleError(_0x5122ff,null));};exports[_0x47ba('0x49')]=function(_0x440478,_0x244d67){var _0x5ed369={'raw':![],'where':{'id':_0x440478['params']['id']}},_0x313094={};_0x313094[_0x47ba('0x33')]=_[_0x47ba('0x35')](db[_0x47ba('0x2f')][_0x47ba('0x30')]);_0x313094[_0x47ba('0x34')]=_[_0x47ba('0x35')](_0x440478[_0x47ba('0x34')]);_0x313094[_0x47ba('0x36')]=_[_0x47ba('0x37')](_0x313094['model'],_0x313094[_0x47ba('0x34')]);_0x5ed369[_0x47ba('0x38')]=_[_0x47ba('0x37')](_0x313094['model'],qs[_0x47ba('0x39')](_0x440478[_0x47ba('0x34')][_0x47ba('0x39')]));_0x5ed369[_0x47ba('0x38')]=_0x5ed369['attributes'][_0x47ba('0x3a')]?_0x5ed369[_0x47ba('0x38')]:_0x313094[_0x47ba('0x33')];if(_0x440478[_0x47ba('0x34')]['includeAll']){_0x5ed369[_0x47ba('0x46')]=[{'all':!![]}];}_0x5ed369=_[_0x47ba('0x41')]({},_0x5ed369,_0x440478[_0x47ba('0x44')]);return db['ServicenowConfiguration']['find'](_0x5ed369)[_0x47ba('0x27')](handleEntityNotFound(_0x244d67,null))[_0x47ba('0x27')](respondWithResult(_0x244d67,null))[_0x47ba('0x4a')](handleError(_0x244d67,null));};exports[_0x47ba('0x4b')]=function(_0x5af7e0,_0xc336c){return db[_0x47ba('0x2f')][_0x47ba('0x4b')](_0x5af7e0['body'],{})['then'](respondWithResult(_0xc336c,0xc9))['catch'](handleError(_0xc336c,null));};exports[_0x47ba('0x26')]=function(_0x417f44,_0x529345){if(_0x417f44[_0x47ba('0x4c')]['id']){delete _0x417f44[_0x47ba('0x4c')]['id'];}return db['ServicenowConfiguration'][_0x47ba('0x4d')]({'where':{'id':_0x417f44[_0x47ba('0x4e')]['id']}})[_0x47ba('0x27')](handleEntityNotFound(_0x529345,null))[_0x47ba('0x27')](saveUpdates(_0x417f44[_0x47ba('0x4c')],null))[_0x47ba('0x27')](respondWithResult(_0x529345,null))[_0x47ba('0x4a')](handleError(_0x529345,null));};exports['destroy']=function(_0x595ce8,_0x637d02){return db[_0x47ba('0x2f')][_0x47ba('0x4d')]({'where':{'id':_0x595ce8[_0x47ba('0x4e')]['id']}})[_0x47ba('0x27')](handleEntityNotFound(_0x637d02,null))[_0x47ba('0x27')](removeEntity(_0x637d02,null))['catch'](handleError(_0x637d02,null));};exports[_0x47ba('0x4f')]=function(_0x4418ef,_0x5e820f,_0x7d9af9){var _0xba629e={};var _0x5176ab={};var _0x37a0cb;var _0x2563d2;return db[_0x47ba('0x2f')][_0x47ba('0x50')]({'where':{'id':_0x4418ef[_0x47ba('0x4e')]['id']}})[_0x47ba('0x27')](handleEntityNotFound(_0x5e820f,null))[_0x47ba('0x27')](function(_0x169911){if(_0x169911){_0x37a0cb=_0x169911;_0x5176ab[_0x47ba('0x33')]=_[_0x47ba('0x35')](db[_0x47ba('0x51')][_0x47ba('0x30')]);_0x5176ab[_0x47ba('0x34')]=_[_0x47ba('0x35')](_0x4418ef[_0x47ba('0x34')]);_0x5176ab[_0x47ba('0x36')]=_[_0x47ba('0x37')](_0x5176ab[_0x47ba('0x33')],_0x5176ab[_0x47ba('0x34')]);_0xba629e['attributes']=_[_0x47ba('0x37')](_0x5176ab[_0x47ba('0x33')],qs[_0x47ba('0x39')](_0x4418ef['query'][_0x47ba('0x39')]));_0xba629e[_0x47ba('0x38')]=_0xba629e[_0x47ba('0x38')][_0x47ba('0x3a')]?_0xba629e['attributes']:_0x5176ab['model'];_0xba629e[_0x47ba('0x3c')]=qs[_0x47ba('0x3d')](_0x4418ef[_0x47ba('0x34')][_0x47ba('0x3d')]);_0xba629e[_0x47ba('0x3e')]=qs[_0x47ba('0x36')](_['pick'](_0x4418ef[_0x47ba('0x34')],_0x5176ab[_0x47ba('0x36')]));if(_0x4418ef[_0x47ba('0x34')][_0x47ba('0x40')]){_0xba629e[_0x47ba('0x3e')]=_[_0x47ba('0x41')](_0xba629e[_0x47ba('0x3e')],{'$or':_[_0x47ba('0x2e')](_0xba629e['attributes'],function(_0x77ed9){var _0x32acd7={};_0x32acd7[_0x77ed9]={'$like':'%'+_0x4418ef[_0x47ba('0x34')]['filter']+'%'};return _0x32acd7;})});}_0xba629e=_[_0x47ba('0x41')]({},_0xba629e,_0x4418ef[_0x47ba('0x44')]);return _0x37a0cb[_0x47ba('0x4f')](_0xba629e);}})[_0x47ba('0x27')](function(_0x21a883){if(_0x21a883){_0x2563d2=_0x21a883['length'];if(!_0x4418ef[_0x47ba('0x34')][_0x47ba('0x52')](_0x47ba('0x3b'))){_0xba629e['limit']=qs[_0x47ba('0x1f')](_0x4418ef[_0x47ba('0x34')][_0x47ba('0x1f')]);_0xba629e[_0x47ba('0x20')]=qs[_0x47ba('0x20')](_0x4418ef[_0x47ba('0x34')]['offset']);}return _0x37a0cb[_0x47ba('0x4f')](_0xba629e);}})[_0x47ba('0x27')](function(_0x1fea64){if(_0x1fea64){return _0x1fea64?{'count':_0x2563d2,'rows':_0x1fea64}:null;}})[_0x47ba('0x27')](respondWithResult(_0x5e820f,null))[_0x47ba('0x4a')](handleError(_0x5e820f,null));};exports[_0x47ba('0x53')]=function(_0x5a380f,_0x4fd965,_0x410342){var _0x5a97d4={};var _0x585954={};var _0x5a9e40;var _0x59afc8;return db[_0x47ba('0x2f')][_0x47ba('0x50')]({'where':{'id':_0x5a380f[_0x47ba('0x4e')]['id']}})[_0x47ba('0x27')](handleEntityNotFound(_0x4fd965,null))[_0x47ba('0x27')](function(_0x3a5aff){if(_0x3a5aff){_0x5a9e40=_0x3a5aff;_0x585954['model']=_[_0x47ba('0x35')](db[_0x47ba('0x51')][_0x47ba('0x30')]);_0x585954[_0x47ba('0x34')]=_[_0x47ba('0x35')](_0x5a380f['query']);_0x585954['filters']=_[_0x47ba('0x37')](_0x585954[_0x47ba('0x33')],_0x585954[_0x47ba('0x34')]);_0x5a97d4[_0x47ba('0x38')]=_['intersection'](_0x585954[_0x47ba('0x33')],qs[_0x47ba('0x39')](_0x5a380f[_0x47ba('0x34')][_0x47ba('0x39')]));_0x5a97d4[_0x47ba('0x38')]=_0x5a97d4['attributes']['length']?_0x5a97d4[_0x47ba('0x38')]:_0x585954['model'];_0x5a97d4['order']=qs[_0x47ba('0x3d')](_0x5a380f['query']['sort']);_0x5a97d4[_0x47ba('0x3e')]=qs[_0x47ba('0x36')](_['pick'](_0x5a380f[_0x47ba('0x34')],_0x585954[_0x47ba('0x36')]));if(_0x5a380f[_0x47ba('0x34')][_0x47ba('0x40')]){_0x5a97d4['where']=_[_0x47ba('0x41')](_0x5a97d4[_0x47ba('0x3e')],{'$or':_[_0x47ba('0x2e')](_0x5a97d4[_0x47ba('0x38')],function(_0x4574be){var _0x50e2fb={};_0x50e2fb[_0x4574be]={'$like':'%'+_0x5a380f[_0x47ba('0x34')][_0x47ba('0x40')]+'%'};return _0x50e2fb;})});}_0x5a97d4=_[_0x47ba('0x41')]({},_0x5a97d4,_0x5a380f[_0x47ba('0x44')]);return _0x5a9e40[_0x47ba('0x53')](_0x5a97d4);}})[_0x47ba('0x27')](function(_0x4c84c1){if(_0x4c84c1){_0x59afc8=_0x4c84c1[_0x47ba('0x3a')];if(!_0x5a380f['query'][_0x47ba('0x52')]('nolimit')){_0x5a97d4[_0x47ba('0x1f')]=qs[_0x47ba('0x1f')](_0x5a380f[_0x47ba('0x34')][_0x47ba('0x1f')]);_0x5a97d4[_0x47ba('0x20')]=qs[_0x47ba('0x20')](_0x5a380f['query']['offset']);}return _0x5a9e40[_0x47ba('0x53')](_0x5a97d4);}})[_0x47ba('0x27')](function(_0x2839fc){if(_0x2839fc){return _0x2839fc?{'count':_0x59afc8,'rows':_0x2839fc}:null;}})[_0x47ba('0x27')](respondWithResult(_0x4fd965,null))[_0x47ba('0x4a')](handleError(_0x4fd965,null));};exports[_0x47ba('0x54')]=function(_0x41d2db,_0x122bfc,_0x203569){var _0x59d2e6={};var _0x4325e7={};var _0x2738b4;var _0x243746;return db['ServicenowConfiguration'][_0x47ba('0x50')]({'where':{'id':_0x41d2db[_0x47ba('0x4e')]['id']}})['then'](handleEntityNotFound(_0x122bfc,null))['then'](function(_0x403fef){if(_0x403fef){_0x2738b4=_0x403fef;_0x4325e7['model']=_['keys'](db[_0x47ba('0x51')][_0x47ba('0x30')]);_0x4325e7[_0x47ba('0x34')]=_[_0x47ba('0x35')](_0x41d2db['query']);_0x4325e7[_0x47ba('0x36')]=_[_0x47ba('0x37')](_0x4325e7[_0x47ba('0x33')],_0x4325e7[_0x47ba('0x34')]);_0x59d2e6[_0x47ba('0x38')]=_[_0x47ba('0x37')](_0x4325e7[_0x47ba('0x33')],qs[_0x47ba('0x39')](_0x41d2db[_0x47ba('0x34')]['fields']));_0x59d2e6[_0x47ba('0x38')]=_0x59d2e6[_0x47ba('0x38')][_0x47ba('0x3a')]?_0x59d2e6[_0x47ba('0x38')]:_0x4325e7[_0x47ba('0x33')];_0x59d2e6['order']=qs['sort'](_0x41d2db['query'][_0x47ba('0x3d')]);_0x59d2e6['where']=qs['filters'](_['pick'](_0x41d2db['query'],_0x4325e7[_0x47ba('0x36')]));if(_0x41d2db[_0x47ba('0x34')][_0x47ba('0x40')]){_0x59d2e6[_0x47ba('0x3e')]=_[_0x47ba('0x41')](_0x59d2e6[_0x47ba('0x3e')],{'$or':_[_0x47ba('0x2e')](_0x59d2e6[_0x47ba('0x38')],function(_0x1912c9){var _0x55f4be={};_0x55f4be[_0x1912c9]={'$like':'%'+_0x41d2db[_0x47ba('0x34')][_0x47ba('0x40')]+'%'};return _0x55f4be;})});}_0x59d2e6=_['merge']({},_0x59d2e6,_0x41d2db['options']);return _0x2738b4[_0x47ba('0x54')](_0x59d2e6);}})[_0x47ba('0x27')](function(_0x2cdf34){if(_0x2cdf34){_0x243746=_0x2cdf34[_0x47ba('0x3a')];if(!_0x41d2db['query'][_0x47ba('0x52')](_0x47ba('0x3b'))){_0x59d2e6[_0x47ba('0x1f')]=qs['limit'](_0x41d2db[_0x47ba('0x34')][_0x47ba('0x1f')]);_0x59d2e6['offset']=qs['offset'](_0x41d2db[_0x47ba('0x34')]['offset']);}return _0x2738b4[_0x47ba('0x54')](_0x59d2e6);}})[_0x47ba('0x27')](function(_0x4f8e15){if(_0x4f8e15){return _0x4f8e15?{'count':_0x243746,'rows':_0x4f8e15}:null;}})[_0x47ba('0x27')](respondWithResult(_0x122bfc,null))['catch'](handleError(_0x122bfc,null));}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index 1e436dc..24999fc 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 _0x1aab=['ServicenowConfiguration','int_servicenow_configurations','lodash','util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./intServicenowConfiguration.attributes','define'];(function(_0x503574,_0x69fb63){var _0x4049d5=function(_0x272689){while(--_0x272689){_0x503574['push'](_0x503574['shift']());}};_0x4049d5(++_0x69fb63);}(_0x1aab,0x122));var _0xb1aa=function(_0x21331a,_0x57fc48){_0x21331a=_0x21331a-0x0;var _0x325c55=_0x1aab[_0x21331a];return _0x325c55;};'use strict';var _=require(_0xb1aa('0x0'));var util=require(_0xb1aa('0x1'));var logger=require(_0xb1aa('0x2'))('api');var moment=require(_0xb1aa('0x3'));var BPromise=require('bluebird');var rp=require(_0xb1aa('0x4'));var fs=require('fs');var path=require(_0xb1aa('0x5'));var rimraf=require(_0xb1aa('0x6'));var config=require(_0xb1aa('0x7'));var attributes=require(_0xb1aa('0x8'));module['exports']=function(_0x5eb27f,_0x34e0f4){return _0x5eb27f[_0xb1aa('0x9')](_0xb1aa('0xa'),attributes,{'tableName':_0xb1aa('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf65d=['../../config/logger','api','moment','bluebird','request-promise','path','exports','define','int_servicenow_configurations','lodash'];(function(_0x54e358,_0x283f4c){var _0x27211f=function(_0x40f439){while(--_0x40f439){_0x54e358['push'](_0x54e358['shift']());}};_0x27211f(++_0x283f4c);}(_0xf65d,0x9f));var _0xdf65=function(_0x47e3f8,_0x517bcd){_0x47e3f8=_0x47e3f8-0x0;var _0x4742d5=_0xf65d[_0x47e3f8];return _0x4742d5;};'use strict';var _=require(_0xdf65('0x0'));var util=require('util');var logger=require(_0xdf65('0x1'))(_0xdf65('0x2'));var moment=require(_0xdf65('0x3'));var BPromise=require(_0xdf65('0x4'));var rp=require(_0xdf65('0x5'));var fs=require('fs');var path=require(_0xdf65('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./intServicenowConfiguration.attributes');module[_0xdf65('0x7')]=function(_0x4ac44a,_0x254ddf){return _0x4ac44a[_0xdf65('0x8')]('ServicenowConfiguration',attributes,{'tableName':_0xdf65('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.rpc.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.rpc.js index 1c8f1cd..a520306 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 _0x11d1=['then','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http'];(function(_0x4a81b7,_0x157887){var _0xc4742d=function(_0xff6fbe){while(--_0xff6fbe){_0x4a81b7['push'](_0x4a81b7['shift']());}};_0xc4742d(++_0x157887);}(_0x11d1,0x184));var _0x111d=function(_0x374478,_0x50bbe8){_0x374478=_0x374478-0x0;var _0xa700b=_0x11d1[_0x374478];return _0xa700b;};'use strict';var _=require(_0x111d('0x0'));var util=require('util');var moment=require(_0x111d('0x1'));var BPromise=require(_0x111d('0x2'));var rs=require(_0x111d('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x111d('0x4'))['db'];var utils=require(_0x111d('0x5'));var logger=require(_0x111d('0x6'))('rpc');var config=require(_0x111d('0x7'));var jayson=require(_0x111d('0x8'));var client=jayson[_0x111d('0x9')][_0x111d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x12b249,_0x497138,_0x4af8b4){return new BPromise(function(_0x1ba64c,_0xdf4197){return client['request'](_0x12b249,_0x4af8b4)[_0x111d('0xb')](function(_0xe864cf){logger['info'](_0x111d('0xc'),_0x497138,_0x111d('0xd'));logger[_0x111d('0xe')](_0x111d('0xf'),_0x497138,_0x111d('0xd'),JSON[_0x111d('0x10')](_0xe864cf));if(_0xe864cf[_0x111d('0x11')]){if(_0xe864cf[_0x111d('0x11')]['code']===0x1f4){logger[_0x111d('0x11')](_0x111d('0xc'),_0x497138,_0xe864cf[_0x111d('0x11')]['message']);return _0xdf4197(_0xe864cf['error'][_0x111d('0x12')]);}logger[_0x111d('0x11')]('ServicenowConfiguration,\x20%s,\x20%s',_0x497138,_0xe864cf['error'][_0x111d('0x12')]);return _0x1ba64c(_0xe864cf[_0x111d('0x11')]['message']);}else{logger['info'](_0x111d('0xc'),_0x497138,'request\x20sent');_0x1ba64c(_0xe864cf[_0x111d('0x13')]['message']);}})[_0x111d('0x14')](function(_0x38b393){logger[_0x111d('0x11')]('ServicenowConfiguration,\x20%s,\x20%s',_0x497138,_0x38b393);_0xdf4197(_0x38b393);});});} \ No newline at end of file +var _0x7ea9=['../../config/logger','rpc','jayson/promise','client','http','request','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils'];(function(_0x47a5bd,_0x508329){var _0x5c2184=function(_0x40ddea){while(--_0x40ddea){_0x47a5bd['push'](_0x47a5bd['shift']());}};_0x5c2184(++_0x508329);}(_0x7ea9,0xec));var _0x97ea=function(_0x59f54c,_0x456855){_0x59f54c=_0x59f54c-0x0;var _0x34802f=_0x7ea9[_0x59f54c];return _0x34802f;};'use strict';var _=require('lodash');var util=require(_0x97ea('0x0'));var moment=require(_0x97ea('0x1'));var BPromise=require(_0x97ea('0x2'));var rs=require(_0x97ea('0x3'));var fs=require('fs');var Redis=require(_0x97ea('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x97ea('0x5'));var logger=require(_0x97ea('0x6'))(_0x97ea('0x7'));var config=require('../../config/environment');var jayson=require(_0x97ea('0x8'));var client=jayson[_0x97ea('0x9')][_0x97ea('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x17209a,_0x517067,_0x41fb15){return new BPromise(function(_0x424a73,_0x4af95f){return client[_0x97ea('0xb')](_0x17209a,_0x41fb15)['then'](function(_0x179953){logger['info'](_0x97ea('0xc'),_0x517067,_0x97ea('0xd'));logger['debug'](_0x97ea('0xe'),_0x517067,_0x97ea('0xd'),JSON[_0x97ea('0xf')](_0x179953));if(_0x179953[_0x97ea('0x10')]){if(_0x179953[_0x97ea('0x10')][_0x97ea('0x11')]===0x1f4){logger[_0x97ea('0x10')](_0x97ea('0xc'),_0x517067,_0x179953[_0x97ea('0x10')][_0x97ea('0x12')]);return _0x4af95f(_0x179953['error'][_0x97ea('0x12')]);}logger[_0x97ea('0x10')]('ServicenowConfiguration,\x20%s,\x20%s',_0x517067,_0x179953[_0x97ea('0x10')][_0x97ea('0x12')]);return _0x424a73(_0x179953[_0x97ea('0x10')]['message']);}else{logger[_0x97ea('0x13')](_0x97ea('0xc'),_0x517067,'request\x20sent');_0x424a73(_0x179953[_0x97ea('0x14')]['message']);}})[_0x97ea('0x15')](function(_0x135018){logger[_0x97ea('0x10')](_0x97ea('0xc'),_0x517067,_0x135018);_0x4af95f(_0x135018);});});} \ No newline at end of file diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index 5946a48..e911725 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 _0xfd23=['./intServicenowField.controller','get','isAuthenticated','index','show','create','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment'];(function(_0x24eab7,_0x29f395){var _0x4bdf65=function(_0x1ee652){while(--_0x1ee652){_0x24eab7['push'](_0x24eab7['shift']());}};_0x4bdf65(++_0x29f395);}(_0xfd23,0x1b0));var _0x3fd2=function(_0x164af1,_0x3cf772){_0x164af1=_0x164af1-0x0;var _0x5d81a2=_0xfd23[_0x164af1];return _0x5d81a2;};'use strict';var multer=require(_0x3fd2('0x0'));var util=require(_0x3fd2('0x1'));var path=require(_0x3fd2('0x2'));var timeout=require(_0x3fd2('0x3'));var express=require(_0x3fd2('0x4'));var router=express[_0x3fd2('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x3fd2('0x6'));var config=require(_0x3fd2('0x7'));var controller=require(_0x3fd2('0x8'));router[_0x3fd2('0x9')]('/',auth[_0x3fd2('0xa')](),controller[_0x3fd2('0xb')]);router['get']('/:id',auth[_0x3fd2('0xa')](),controller[_0x3fd2('0xc')]);router['post']('/',auth[_0x3fd2('0xa')](),controller[_0x3fd2('0xd')]);router[_0x3fd2('0xe')](_0x3fd2('0xf'),auth[_0x3fd2('0xa')](),controller[_0x3fd2('0x10')]);router[_0x3fd2('0x11')](_0x3fd2('0xf'),auth[_0x3fd2('0xa')](),controller[_0x3fd2('0x12')]);module[_0x3fd2('0x13')]=router; \ No newline at end of file +var _0x012b=['/:id','show','post','create','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','./intServicenowField.controller','get','isAuthenticated','index'];(function(_0x26df48,_0x22aa50){var _0x209047=function(_0x1d068b){while(--_0x1d068b){_0x26df48['push'](_0x26df48['shift']());}};_0x209047(++_0x22aa50);}(_0x012b,0x6d));var _0xb012=function(_0x2a6d53,_0x4aacb3){_0x2a6d53=_0x2a6d53-0x0;var _0x5654ff=_0x012b[_0x2a6d53];return _0x5654ff;};'use strict';var multer=require('multer');var util=require(_0xb012('0x0'));var path=require(_0xb012('0x1'));var timeout=require(_0xb012('0x2'));var express=require(_0xb012('0x3'));var router=express[_0xb012('0x4')]();var fs_extra=require(_0xb012('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xb012('0x6'));var controller=require(_0xb012('0x7'));router[_0xb012('0x8')]('/',auth[_0xb012('0x9')](),controller[_0xb012('0xa')]);router[_0xb012('0x8')](_0xb012('0xb'),auth['isAuthenticated'](),controller[_0xb012('0xc')]);router[_0xb012('0xd')]('/',auth[_0xb012('0x9')](),controller[_0xb012('0xe')]);router[_0xb012('0xf')](_0xb012('0xb'),auth[_0xb012('0x9')](),controller[_0xb012('0x10')]);router[_0xb012('0x11')](_0xb012('0xb'),auth['isAuthenticated'](),controller[_0xb012('0x12')]);module[_0xb012('0x13')]=router; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.attributes.js b/server/api/intServicenowField/intServicenowField.attributes.js index 08b7a64..fce5561 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 _0xd4a0=['STRING','BOOLEAN','sequelize','exports','ENUM','string','variable','customVariable','picklist'];(function(_0x3511d3,_0x4107ae){var _0x5d6321=function(_0x1a23da){while(--_0x1a23da){_0x3511d3['push'](_0x3511d3['shift']());}};_0x5d6321(++_0x4107ae);}(_0xd4a0,0x1a9));var _0x0d4a=function(_0x368e96,_0x3bc021){_0x368e96=_0x368e96-0x0;var _0x257e97=_0xd4a0[_0x368e96];return _0x257e97;};'use strict';var Sequelize=require(_0x0d4a('0x0'));module[_0x0d4a('0x1')]={'type':{'type':Sequelize[_0x0d4a('0x2')](_0x0d4a('0x3'),_0x0d4a('0x4'),_0x0d4a('0x5'),'keyValue',_0x0d4a('0x6')),'defaultValue':_0x0d4a('0x3')},'content':{'type':Sequelize[_0x0d4a('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x0d4a('0x2')](_0x0d4a('0x3'),_0x0d4a('0x4'),_0x0d4a('0x5'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x0d4a('0x7')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x0d4a('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x0d4a('0x7')]}}; \ No newline at end of file +var _0xa283=['keyValue','picklist','STRING','customVariable','sequelize','exports','ENUM','string','variable'];(function(_0x3ae4bf,_0x554978){var _0x27f7dd=function(_0x406997){while(--_0x406997){_0x3ae4bf['push'](_0x3ae4bf['shift']());}};_0x27f7dd(++_0x554978);}(_0xa283,0x1ab));var _0x3a28=function(_0x5d3ac6,_0x89ce9a){_0x5d3ac6=_0x5d3ac6-0x0;var _0x23eedb=_0xa283[_0x5d3ac6];return _0x23eedb;};'use strict';var Sequelize=require(_0x3a28('0x0'));module[_0x3a28('0x1')]={'type':{'type':Sequelize[_0x3a28('0x2')](_0x3a28('0x3'),_0x3a28('0x4'),'customVariable',_0x3a28('0x5'),_0x3a28('0x6')),'defaultValue':_0x3a28('0x3')},'content':{'type':Sequelize[_0x3a28('0x7')]},'key':{'type':Sequelize[_0x3a28('0x7')]},'keyType':{'type':Sequelize['ENUM'](_0x3a28('0x3'),'variable',_0x3a28('0x8'))},'keyContent':{'type':Sequelize[_0x3a28('0x7')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x3a28('0x7')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.controller.js b/server/api/intServicenowField/intServicenowField.controller.js index 87d3d41..eb858c1 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 _0xa36d=['../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','count','limit','Content-Range','save','update','destroy','then','error','stack','name','send','index','map','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','ServicenowField','includeAll','include','findAll','rows','show','params','find','create','body','catch','rimraf','zip-dir','request-promise','bluebird','util','path','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service'];(function(_0x24b045,_0x5910f3){var _0x27f2b4=function(_0x4332e3){while(--_0x4332e3){_0x24b045['push'](_0x24b045['shift']());}};_0x27f2b4(++_0x5910f3);}(_0xa36d,0x10e));var _0xda36=function(_0x21317c,_0x435b0f){_0x21317c=_0x21317c-0x0;var _0x19c315=_0xa36d[_0x21317c];return _0x19c315;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xda36('0x0'));var zipdir=require(_0xda36('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xda36('0x2'));var moment=require('moment');var BPromise=require(_0xda36('0x3'));var Mustache=require('mustache');var util=require(_0xda36('0x4'));var path=require(_0xda36('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xda36('0x6'));var fs=require('fs');var fs_extra=require(_0xda36('0x7'));var _=require(_0xda36('0x8'));var squel=require(_0xda36('0x9'));var crypto=require(_0xda36('0xa'));var jsforce=require(_0xda36('0xb'));var deskjs=require(_0xda36('0xc'));var toCsv=require(_0xda36('0xd'));var querystring=require(_0xda36('0xe'));var Papa=require(_0xda36('0xf'));var Redis=require(_0xda36('0x10'));var authService=require(_0xda36('0x11'));var qs=require(_0xda36('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xda36('0x13'));var logger=require(_0xda36('0x14'))('api');var utils=require(_0xda36('0x15'));var config=require(_0xda36('0x16'));var licenseUtil=require(_0xda36('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x59d5ae,_0x520e8c){_0x520e8c=_0x520e8c||0xcc;return function(_0x2936d4){if(_0x2936d4){return _0x59d5ae[_0xda36('0x18')](_0x520e8c);}return _0x59d5ae[_0xda36('0x19')](_0x520e8c)[_0xda36('0x1a')]();};}function respondWithResult(_0x4d6e1b,_0x11c58c){_0x11c58c=_0x11c58c||0xc8;return function(_0x45a7f5){if(_0x45a7f5){return _0x4d6e1b['status'](_0x11c58c)['json'](_0x45a7f5);}};}function respondWithFilteredResult(_0x376742,_0x3576fb){return function(_0x4e4e51){if(_0x4e4e51){var _0x104c31=typeof _0x3576fb[_0xda36('0x1b')]===_0xda36('0x1c')&&typeof _0x3576fb['limit']===_0xda36('0x1c');var _0x2d75a9=_0x4e4e51[_0xda36('0x1d')];var _0x1ed860=_0x104c31?0x0:_0x3576fb[_0xda36('0x1b')];var _0x18efa1=_0x104c31?_0x4e4e51[_0xda36('0x1d')]:_0x3576fb[_0xda36('0x1b')]+_0x3576fb[_0xda36('0x1e')];var _0x5099c2;if(_0x18efa1>=_0x2d75a9){_0x18efa1=_0x2d75a9;_0x5099c2=0xc8;}else{_0x5099c2=0xce;}_0x376742[_0xda36('0x19')](_0x5099c2);return _0x376742['set'](_0xda36('0x1f'),_0x1ed860+'-'+_0x18efa1+'/'+_0x2d75a9)['json'](_0x4e4e51);}return null;};}function patchUpdates(_0x522c1e){return function(_0x5c2784){try{jsonpatch['apply'](_0x5c2784,_0x522c1e,!![]);}catch(_0x50071b){return BPromise['reject'](_0x50071b);}return _0x5c2784[_0xda36('0x20')]();};}function saveUpdates(_0xd6351a,_0x472a1b){return function(_0x2cf667){if(_0x2cf667){return _0x2cf667[_0xda36('0x21')](_0xd6351a)['then'](function(_0x3613a2){return _0x3613a2;});}return null;};}function removeEntity(_0x2cc87f,_0x2f3139){return function(_0x28af04){if(_0x28af04){return _0x28af04[_0xda36('0x22')]()[_0xda36('0x23')](function(){_0x2cc87f['status'](0xcc)[_0xda36('0x1a')]();});}};}function handleEntityNotFound(_0x48bede,_0x1e30c0){return function(_0x450824){if(!_0x450824){_0x48bede[_0xda36('0x18')](0x194);}return _0x450824;};}function handleError(_0x45ea8c,_0x2e064c){_0x2e064c=_0x2e064c||0x1f4;return function(_0x3bbd91){logger[_0xda36('0x24')](_0x3bbd91[_0xda36('0x25')]);if(_0x3bbd91[_0xda36('0x26')]){delete _0x3bbd91['name'];}_0x45ea8c[_0xda36('0x19')](_0x2e064c)[_0xda36('0x27')](_0x3bbd91);};}exports[_0xda36('0x28')]=function(_0x578c6c,_0x2a663d){var _0x48a407={},_0x28c742={},_0x5386ef={'count':0x0,'rows':[]};var _0x5df456=_[_0xda36('0x29')](db['ServicenowField'][_0xda36('0x2a')],function(_0x4014a3){return{'name':_0x4014a3['fieldName'],'type':_0x4014a3[_0xda36('0x2b')]['key']};});_0x28c742[_0xda36('0x2c')]=_[_0xda36('0x29')](_0x5df456,_0xda36('0x26'));_0x28c742[_0xda36('0x2d')]=_[_0xda36('0x2e')](_0x578c6c[_0xda36('0x2d')]);_0x28c742[_0xda36('0x2f')]=_[_0xda36('0x30')](_0x28c742[_0xda36('0x2c')],_0x28c742[_0xda36('0x2d')]);_0x48a407[_0xda36('0x31')]=_[_0xda36('0x30')](_0x28c742[_0xda36('0x2c')],qs[_0xda36('0x32')](_0x578c6c['query'][_0xda36('0x32')]));_0x48a407['attributes']=_0x48a407['attributes'][_0xda36('0x33')]?_0x48a407[_0xda36('0x31')]:_0x28c742[_0xda36('0x2c')];if(!_0x578c6c['query']['hasOwnProperty'](_0xda36('0x34'))){_0x48a407['limit']=qs[_0xda36('0x1e')](_0x578c6c[_0xda36('0x2d')]['limit']);_0x48a407[_0xda36('0x1b')]=qs['offset'](_0x578c6c[_0xda36('0x2d')][_0xda36('0x1b')]);}_0x48a407[_0xda36('0x35')]=qs[_0xda36('0x36')](_0x578c6c['query'][_0xda36('0x36')]);_0x48a407[_0xda36('0x37')]=qs[_0xda36('0x2f')](_[_0xda36('0x38')](_0x578c6c[_0xda36('0x2d')],_0x28c742[_0xda36('0x2f')]),_0x5df456);if(_0x578c6c[_0xda36('0x2d')][_0xda36('0x39')]){_0x48a407[_0xda36('0x37')]=_[_0xda36('0x3a')](_0x48a407[_0xda36('0x37')],{'$or':_[_0xda36('0x29')](_0x5df456,function(_0xde8cb){if(_0xde8cb[_0xda36('0x2b')]!==_0xda36('0x3b')){var _0x14045f={};_0x14045f[_0xde8cb[_0xda36('0x26')]]={'$like':'%'+_0x578c6c[_0xda36('0x2d')][_0xda36('0x39')]+'%'};return _0x14045f;}})});}_0x48a407=_[_0xda36('0x3a')]({},_0x48a407,_0x578c6c[_0xda36('0x3c')]);var _0x5e2106={'where':_0x48a407['where']};return db[_0xda36('0x3d')][_0xda36('0x1d')](_0x5e2106)[_0xda36('0x23')](function(_0x4db0e4){_0x5386ef[_0xda36('0x1d')]=_0x4db0e4;if(_0x578c6c[_0xda36('0x2d')][_0xda36('0x3e')]){_0x48a407[_0xda36('0x3f')]=[{'all':!![]}];}return db[_0xda36('0x3d')][_0xda36('0x40')](_0x48a407);})[_0xda36('0x23')](function(_0x5a6db0){_0x5386ef[_0xda36('0x41')]=_0x5a6db0;return _0x5386ef;})[_0xda36('0x23')](respondWithFilteredResult(_0x2a663d,_0x48a407))['catch'](handleError(_0x2a663d,null));};exports[_0xda36('0x42')]=function(_0x444bb5,_0x1990ae){var _0x314e25={'raw':!![],'where':{'id':_0x444bb5[_0xda36('0x43')]['id']}},_0x52a953={};_0x52a953[_0xda36('0x2c')]=_[_0xda36('0x2e')](db[_0xda36('0x3d')]['rawAttributes']);_0x52a953[_0xda36('0x2d')]=_[_0xda36('0x2e')](_0x444bb5['query']);_0x52a953[_0xda36('0x2f')]=_['intersection'](_0x52a953[_0xda36('0x2c')],_0x52a953[_0xda36('0x2d')]);_0x314e25[_0xda36('0x31')]=_[_0xda36('0x30')](_0x52a953[_0xda36('0x2c')],qs[_0xda36('0x32')](_0x444bb5[_0xda36('0x2d')][_0xda36('0x32')]));_0x314e25[_0xda36('0x31')]=_0x314e25[_0xda36('0x31')][_0xda36('0x33')]?_0x314e25[_0xda36('0x31')]:_0x52a953[_0xda36('0x2c')];if(_0x444bb5[_0xda36('0x2d')][_0xda36('0x3e')]){_0x314e25['include']=[{'all':!![]}];}_0x314e25=_[_0xda36('0x3a')]({},_0x314e25,_0x444bb5[_0xda36('0x3c')]);return db[_0xda36('0x3d')][_0xda36('0x44')](_0x314e25)[_0xda36('0x23')](handleEntityNotFound(_0x1990ae,null))[_0xda36('0x23')](respondWithResult(_0x1990ae,null))['catch'](handleError(_0x1990ae,null));};exports[_0xda36('0x45')]=function(_0x45fac1,_0x315846){return db[_0xda36('0x3d')]['create'](_0x45fac1[_0xda36('0x46')],{})[_0xda36('0x23')](respondWithResult(_0x315846,0xc9))[_0xda36('0x47')](handleError(_0x315846,null));};exports[_0xda36('0x21')]=function(_0x5dfbe0,_0x3259e2){if(_0x5dfbe0[_0xda36('0x46')]['id']){delete _0x5dfbe0['body']['id'];}return db['ServicenowField'][_0xda36('0x44')]({'where':{'id':_0x5dfbe0[_0xda36('0x43')]['id']}})[_0xda36('0x23')](handleEntityNotFound(_0x3259e2,null))['then'](saveUpdates(_0x5dfbe0[_0xda36('0x46')],null))[_0xda36('0x23')](respondWithResult(_0x3259e2,null))['catch'](handleError(_0x3259e2,null));};exports[_0xda36('0x22')]=function(_0x4f4aef,_0xb4fac8){return db['ServicenowField'][_0xda36('0x44')]({'where':{'id':_0x4f4aef[_0xda36('0x43')]['id']}})[_0xda36('0x23')](handleEntityNotFound(_0xb4fac8,null))[_0xda36('0x23')](removeEntity(_0xb4fac8,null))[_0xda36('0x47')](handleError(_0xb4fac8,null));}; \ No newline at end of file +var _0x1559=['error','stack','name','send','ServicenowField','rawAttributes','fieldName','type','key','map','keys','intersection','query','model','fields','attributes','length','hasOwnProperty','order','sort','where','filters','pick','merge','filter','options','includeAll','include','findAll','rows','catch','show','find','create','body','params','destroy','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','fs-extra','lodash','crypto','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','apply','save','update','then'];(function(_0x20beae,_0x5eac6d){var _0xf5725=function(_0x926a3b){while(--_0x926a3b){_0x20beae['push'](_0x20beae['shift']());}};_0xf5725(++_0x5eac6d);}(_0x1559,0x188));var _0x9155=function(_0x2d01df,_0x429d33){_0x2d01df=_0x2d01df-0x0;var _0x56e944=_0x1559[_0x2d01df];return _0x56e944;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9155('0x0'));var zipdir=require(_0x9155('0x1'));var jsonpatch=require(_0x9155('0x2'));var rp=require(_0x9155('0x3'));var moment=require(_0x9155('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x9155('0x5'));var util=require(_0x9155('0x6'));var path=require(_0x9155('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9155('0x8'));var _=require(_0x9155('0x9'));var squel=require('squel');var crypto=require(_0x9155('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x9155('0xb'));var toCsv=require(_0x9155('0xc'));var querystring=require('querystring');var Papa=require(_0x9155('0xd'));var Redis=require(_0x9155('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x9155('0xf'));var as=require(_0x9155('0x10'));var hardwareService=require(_0x9155('0x11'));var logger=require(_0x9155('0x12'))('api');var utils=require('../../config/utils');var config=require(_0x9155('0x13'));var licenseUtil=require(_0x9155('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x36f49c,_0x7192db){_0x7192db=_0x7192db||0xcc;return function(_0x24965b){if(_0x24965b){return _0x36f49c[_0x9155('0x15')](_0x7192db);}return _0x36f49c[_0x9155('0x16')](_0x7192db)[_0x9155('0x17')]();};}function respondWithResult(_0x4d3911,_0x50db7c){_0x50db7c=_0x50db7c||0xc8;return function(_0x158a95){if(_0x158a95){return _0x4d3911[_0x9155('0x16')](_0x50db7c)['json'](_0x158a95);}};}function respondWithFilteredResult(_0x52f690,_0x270795){return function(_0x49b5f5){if(_0x49b5f5){var _0x135be8=typeof _0x270795[_0x9155('0x18')]===_0x9155('0x19')&&typeof _0x270795[_0x9155('0x1a')]===_0x9155('0x19');var _0x550b95=_0x49b5f5[_0x9155('0x1b')];var _0x8555db=_0x135be8?0x0:_0x270795[_0x9155('0x18')];var _0xe42b72=_0x135be8?_0x49b5f5[_0x9155('0x1b')]:_0x270795['offset']+_0x270795['limit'];var _0x339050;if(_0xe42b72>=_0x550b95){_0xe42b72=_0x550b95;_0x339050=0xc8;}else{_0x339050=0xce;}_0x52f690[_0x9155('0x16')](_0x339050);return _0x52f690[_0x9155('0x1c')](_0x9155('0x1d'),_0x8555db+'-'+_0xe42b72+'/'+_0x550b95)['json'](_0x49b5f5);}return null;};}function patchUpdates(_0xa6656a){return function(_0xa3b193){try{jsonpatch[_0x9155('0x1e')](_0xa3b193,_0xa6656a,!![]);}catch(_0x427ad8){return BPromise['reject'](_0x427ad8);}return _0xa3b193[_0x9155('0x1f')]();};}function saveUpdates(_0x2f1ec8,_0x1c38a5){return function(_0x33196b){if(_0x33196b){return _0x33196b[_0x9155('0x20')](_0x2f1ec8)[_0x9155('0x21')](function(_0x1a463a){return _0x1a463a;});}return null;};}function removeEntity(_0x42b697,_0xd82ec1){return function(_0xe1e8ae){if(_0xe1e8ae){return _0xe1e8ae['destroy']()[_0x9155('0x21')](function(){_0x42b697['status'](0xcc)[_0x9155('0x17')]();});}};}function handleEntityNotFound(_0x1ddc2b,_0x5623d0){return function(_0x236b02){if(!_0x236b02){_0x1ddc2b[_0x9155('0x15')](0x194);}return _0x236b02;};}function handleError(_0x341fa2,_0x528317){_0x528317=_0x528317||0x1f4;return function(_0x52fcbc){logger[_0x9155('0x22')](_0x52fcbc[_0x9155('0x23')]);if(_0x52fcbc[_0x9155('0x24')]){delete _0x52fcbc[_0x9155('0x24')];}_0x341fa2[_0x9155('0x16')](_0x528317)[_0x9155('0x25')](_0x52fcbc);};}exports['index']=function(_0x5dde55,_0x1a5952){var _0x43dfb6={},_0x227f6c={},_0x58cad0={'count':0x0,'rows':[]};var _0x33fa18=_['map'](db[_0x9155('0x26')][_0x9155('0x27')],function(_0x39f651){return{'name':_0x39f651[_0x9155('0x28')],'type':_0x39f651[_0x9155('0x29')][_0x9155('0x2a')]};});_0x227f6c['model']=_[_0x9155('0x2b')](_0x33fa18,_0x9155('0x24'));_0x227f6c['query']=_[_0x9155('0x2c')](_0x5dde55['query']);_0x227f6c['filters']=_[_0x9155('0x2d')](_0x227f6c['model'],_0x227f6c[_0x9155('0x2e')]);_0x43dfb6['attributes']=_[_0x9155('0x2d')](_0x227f6c[_0x9155('0x2f')],qs[_0x9155('0x30')](_0x5dde55[_0x9155('0x2e')][_0x9155('0x30')]));_0x43dfb6[_0x9155('0x31')]=_0x43dfb6['attributes'][_0x9155('0x32')]?_0x43dfb6['attributes']:_0x227f6c[_0x9155('0x2f')];if(!_0x5dde55['query'][_0x9155('0x33')]('nolimit')){_0x43dfb6[_0x9155('0x1a')]=qs[_0x9155('0x1a')](_0x5dde55[_0x9155('0x2e')][_0x9155('0x1a')]);_0x43dfb6['offset']=qs[_0x9155('0x18')](_0x5dde55[_0x9155('0x2e')][_0x9155('0x18')]);}_0x43dfb6[_0x9155('0x34')]=qs[_0x9155('0x35')](_0x5dde55['query'][_0x9155('0x35')]);_0x43dfb6[_0x9155('0x36')]=qs[_0x9155('0x37')](_[_0x9155('0x38')](_0x5dde55[_0x9155('0x2e')],_0x227f6c[_0x9155('0x37')]),_0x33fa18);if(_0x5dde55[_0x9155('0x2e')]['filter']){_0x43dfb6[_0x9155('0x36')]=_[_0x9155('0x39')](_0x43dfb6[_0x9155('0x36')],{'$or':_[_0x9155('0x2b')](_0x33fa18,function(_0xb8f0bd){if(_0xb8f0bd[_0x9155('0x29')]!=='VIRTUAL'){var _0x56afe1={};_0x56afe1[_0xb8f0bd[_0x9155('0x24')]]={'$like':'%'+_0x5dde55[_0x9155('0x2e')][_0x9155('0x3a')]+'%'};return _0x56afe1;}})});}_0x43dfb6=_['merge']({},_0x43dfb6,_0x5dde55[_0x9155('0x3b')]);var _0x5857cc={'where':_0x43dfb6[_0x9155('0x36')]};return db['ServicenowField']['count'](_0x5857cc)[_0x9155('0x21')](function(_0x4c5883){_0x58cad0[_0x9155('0x1b')]=_0x4c5883;if(_0x5dde55[_0x9155('0x2e')][_0x9155('0x3c')]){_0x43dfb6[_0x9155('0x3d')]=[{'all':!![]}];}return db['ServicenowField'][_0x9155('0x3e')](_0x43dfb6);})[_0x9155('0x21')](function(_0x184846){_0x58cad0[_0x9155('0x3f')]=_0x184846;return _0x58cad0;})[_0x9155('0x21')](respondWithFilteredResult(_0x1a5952,_0x43dfb6))[_0x9155('0x40')](handleError(_0x1a5952,null));};exports[_0x9155('0x41')]=function(_0x36fadf,_0x2534dd){var _0x282de4={'raw':!![],'where':{'id':_0x36fadf['params']['id']}},_0x15c678={};_0x15c678[_0x9155('0x2f')]=_[_0x9155('0x2c')](db[_0x9155('0x26')][_0x9155('0x27')]);_0x15c678[_0x9155('0x2e')]=_[_0x9155('0x2c')](_0x36fadf[_0x9155('0x2e')]);_0x15c678[_0x9155('0x37')]=_[_0x9155('0x2d')](_0x15c678['model'],_0x15c678['query']);_0x282de4[_0x9155('0x31')]=_[_0x9155('0x2d')](_0x15c678['model'],qs['fields'](_0x36fadf[_0x9155('0x2e')][_0x9155('0x30')]));_0x282de4[_0x9155('0x31')]=_0x282de4['attributes'][_0x9155('0x32')]?_0x282de4[_0x9155('0x31')]:_0x15c678[_0x9155('0x2f')];if(_0x36fadf[_0x9155('0x2e')][_0x9155('0x3c')]){_0x282de4['include']=[{'all':!![]}];}_0x282de4=_[_0x9155('0x39')]({},_0x282de4,_0x36fadf[_0x9155('0x3b')]);return db['ServicenowField'][_0x9155('0x42')](_0x282de4)[_0x9155('0x21')](handleEntityNotFound(_0x2534dd,null))[_0x9155('0x21')](respondWithResult(_0x2534dd,null))[_0x9155('0x40')](handleError(_0x2534dd,null));};exports[_0x9155('0x43')]=function(_0x58d88b,_0x229e9f){return db[_0x9155('0x26')][_0x9155('0x43')](_0x58d88b[_0x9155('0x44')],{})[_0x9155('0x21')](respondWithResult(_0x229e9f,0xc9))[_0x9155('0x40')](handleError(_0x229e9f,null));};exports['update']=function(_0x17d7c5,_0x363cbe){if(_0x17d7c5['body']['id']){delete _0x17d7c5['body']['id'];}return db[_0x9155('0x26')][_0x9155('0x42')]({'where':{'id':_0x17d7c5[_0x9155('0x45')]['id']}})[_0x9155('0x21')](handleEntityNotFound(_0x363cbe,null))[_0x9155('0x21')](saveUpdates(_0x17d7c5['body'],null))[_0x9155('0x21')](respondWithResult(_0x363cbe,null))[_0x9155('0x40')](handleError(_0x363cbe,null));};exports[_0x9155('0x46')]=function(_0x2dc2bb,_0x332479){return db[_0x9155('0x26')][_0x9155('0x42')]({'where':{'id':_0x2dc2bb['params']['id']}})[_0x9155('0x21')](handleEntityNotFound(_0x332479,null))[_0x9155('0x21')](removeEntity(_0x332479,null))[_0x9155('0x40')](handleError(_0x332479,null));}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.model.js b/server/api/intServicenowField/intServicenowField.model.js index 5d30567..66b7fd1 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 _0x2bd9=['../../config/environment','./intServicenowField.attributes','define','ServicenowField','int_servicenow_fields','servicenow_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird','path'];(function(_0x247994,_0x502fa8){var _0x33f211=function(_0x231a0e){while(--_0x231a0e){_0x247994['push'](_0x247994['shift']());}};_0x33f211(++_0x502fa8);}(_0x2bd9,0x1e8));var _0x92bd=function(_0x5a1d30,_0x245dae){_0x5a1d30=_0x5a1d30-0x0;var _0x1b1e46=_0x2bd9[_0x5a1d30];return _0x1b1e46;};'use strict';var _=require(_0x92bd('0x0'));var util=require(_0x92bd('0x1'));var logger=require(_0x92bd('0x2'))(_0x92bd('0x3'));var moment=require(_0x92bd('0x4'));var BPromise=require(_0x92bd('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x92bd('0x6'));var rimraf=require('rimraf');var config=require(_0x92bd('0x7'));var attributes=require(_0x92bd('0x8'));module['exports']=function(_0x3f7a6c,_0x3bb6f0){return _0x3f7a6c[_0x92bd('0x9')](_0x92bd('0xa'),attributes,{'tableName':_0x92bd('0xb'),'paranoid':![],'indexes':[{'name':_0x92bd('0xc'),'fields':[_0x92bd('0xd'),_0x92bd('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x570c=['exports','define','ServicenowField','servicenow_unique_index','idField','FieldId','lodash','util','api','moment','bluebird','request-promise','path','../../config/environment','./intServicenowField.attributes'];(function(_0x4d67b8,_0x565134){var _0x55af3b=function(_0x145904){while(--_0x145904){_0x4d67b8['push'](_0x4d67b8['shift']());}};_0x55af3b(++_0x565134);}(_0x570c,0xf6));var _0xc570=function(_0x427489,_0x2edbc4){_0x427489=_0x427489-0x0;var _0x51f6ab=_0x570c[_0x427489];return _0x51f6ab;};'use strict';var _=require(_0xc570('0x0'));var util=require(_0xc570('0x1'));var logger=require('../../config/logger')(_0xc570('0x2'));var moment=require(_0xc570('0x3'));var BPromise=require(_0xc570('0x4'));var rp=require(_0xc570('0x5'));var fs=require('fs');var path=require(_0xc570('0x6'));var rimraf=require('rimraf');var config=require(_0xc570('0x7'));var attributes=require(_0xc570('0x8'));module[_0xc570('0x9')]=function(_0xe4fdee,_0x131a59){return _0xe4fdee[_0xc570('0xa')](_0xc570('0xb'),attributes,{'tableName':'int_servicenow_fields','paranoid':![],'indexes':[{'name':_0xc570('0xc'),'fields':[_0xc570('0xd'),_0xc570('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.rpc.js b/server/api/intServicenowField/intServicenowField.rpc.js index 0883b15..709a78f 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 _0xf4eb=['ServicenowField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','lodash','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x35e507,_0x171e16){var _0x51b71b=function(_0x20a51e){while(--_0x20a51e){_0x35e507['push'](_0x35e507['shift']());}};_0x51b71b(++_0x171e16);}(_0xf4eb,0xec));var _0xbf4e=function(_0x4bacf0,_0x2b9b70){_0x4bacf0=_0x4bacf0-0x0;var _0x59d2a7=_0xf4eb[_0x4bacf0];return _0x59d2a7;};'use strict';var _=require(_0xbf4e('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbf4e('0x1'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xbf4e('0x2'))(_0xbf4e('0x3'));var config=require(_0xbf4e('0x4'));var jayson=require(_0xbf4e('0x5'));var client=jayson[_0xbf4e('0x6')][_0xbf4e('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x15b99f,_0x540736,_0x449d55){return new BPromise(function(_0x5013c2,_0x5e23d4){return client[_0xbf4e('0x8')](_0x15b99f,_0x449d55)[_0xbf4e('0x9')](function(_0xcc4097){logger[_0xbf4e('0xa')](_0xbf4e('0xb'),_0x540736,_0xbf4e('0xc'));logger[_0xbf4e('0xd')]('ServicenowField,\x20%s,\x20%s,\x20%s',_0x540736,'request\x20sent',JSON[_0xbf4e('0xe')](_0xcc4097));if(_0xcc4097['error']){if(_0xcc4097[_0xbf4e('0xf')][_0xbf4e('0x10')]===0x1f4){logger['error'](_0xbf4e('0xb'),_0x540736,_0xcc4097['error']['message']);return _0x5e23d4(_0xcc4097[_0xbf4e('0xf')][_0xbf4e('0x11')]);}logger[_0xbf4e('0xf')](_0xbf4e('0xb'),_0x540736,_0xcc4097[_0xbf4e('0xf')][_0xbf4e('0x11')]);return _0x5013c2(_0xcc4097['error']['message']);}else{logger[_0xbf4e('0xa')](_0xbf4e('0xb'),_0x540736,_0xbf4e('0xc'));_0x5013c2(_0xcc4097['result'][_0xbf4e('0x11')]);}})[_0xbf4e('0x12')](function(_0x912fc0){logger[_0xbf4e('0xf')]('ServicenowField,\x20%s,\x20%s',_0x540736,_0x912fc0);_0x5e23d4(_0x912fc0);});});} \ No newline at end of file +var _0xe706=['http','request','then','info','ServicenowField,\x20%s,\x20%s','request\x20sent','debug','ServicenowField,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x5d4d36,_0x42ec13){var _0x279402=function(_0x3ca9dd){while(--_0x3ca9dd){_0x5d4d36['push'](_0x5d4d36['shift']());}};_0x279402(++_0x42ec13);}(_0xe706,0xa3));var _0x6e70=function(_0x1d5a18,_0x585dc8){_0x1d5a18=_0x1d5a18-0x0;var _0x411450=_0xe706[_0x1d5a18];return _0x411450;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var moment=require(_0x6e70('0x2'));var BPromise=require('bluebird');var rs=require(_0x6e70('0x3'));var fs=require('fs');var Redis=require(_0x6e70('0x4'));var db=require(_0x6e70('0x5'))['db'];var utils=require(_0x6e70('0x6'));var logger=require(_0x6e70('0x7'))(_0x6e70('0x8'));var config=require(_0x6e70('0x9'));var jayson=require(_0x6e70('0xa'));var client=jayson[_0x6e70('0xb')][_0x6e70('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x36357b,_0x293ce7,_0x45a2d4){return new BPromise(function(_0x188ed3,_0x3c4843){return client[_0x6e70('0xd')](_0x36357b,_0x45a2d4)[_0x6e70('0xe')](function(_0x25e61c){logger[_0x6e70('0xf')](_0x6e70('0x10'),_0x293ce7,_0x6e70('0x11'));logger[_0x6e70('0x12')](_0x6e70('0x13'),_0x293ce7,_0x6e70('0x11'),JSON['stringify'](_0x25e61c));if(_0x25e61c['error']){if(_0x25e61c[_0x6e70('0x14')][_0x6e70('0x15')]===0x1f4){logger[_0x6e70('0x14')](_0x6e70('0x10'),_0x293ce7,_0x25e61c[_0x6e70('0x14')][_0x6e70('0x16')]);return _0x3c4843(_0x25e61c[_0x6e70('0x14')][_0x6e70('0x16')]);}logger['error']('ServicenowField,\x20%s,\x20%s',_0x293ce7,_0x25e61c['error'][_0x6e70('0x16')]);return _0x188ed3(_0x25e61c['error']['message']);}else{logger[_0x6e70('0xf')](_0x6e70('0x10'),_0x293ce7,'request\x20sent');_0x188ed3(_0x25e61c[_0x6e70('0x17')]['message']);}})[_0x6e70('0x18')](function(_0x161f23){logger['error']('ServicenowField,\x20%s,\x20%s',_0x293ce7,_0x161f23);_0x3c4843(_0x161f23);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/index.js b/server/api/intSugarcrmAccount/index.js index 9048646..7864766 100644 --- a/server/api/intSugarcrmAccount/index.js +++ b/server/api/intSugarcrmAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmAccount.controller','get','index','/:id','getConfigurations','/:id/fields','isAuthenticated','getFields','post','addConfiguration','put','update','destroy','exports','multer','util','path'];(function(_0x3564d4,_0x36cd14){var _0x2cb500=function(_0x5e5d50){while(--_0x5e5d50){_0x3564d4['push'](_0x3564d4['shift']());}};_0x2cb500(++_0x36cd14);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbb091,_0x3fe7ee){_0xbb091=_0xbb091-0x0;var _0x467a04=_0xa9e0[_0xbb091];return _0x467a04;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/configurations',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router['delete'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);module[_0x0a9e('0x14')]=router; \ No newline at end of file +var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmAccount.controller','get','index','/:id','getConfigurations','/:id/fields','isAuthenticated','getFields','post','addConfiguration','put','update','destroy','exports','multer','util','path'];(function(_0x35009a,_0x4c647b){var _0x41ae8a=function(_0x594c04){while(--_0x594c04){_0x35009a['push'](_0x35009a['shift']());}};_0x41ae8a(++_0x4c647b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x220dbb,_0x99328d){_0x220dbb=_0x220dbb-0x0;var _0x2b77de=_0xa9e0[_0x220dbb];return _0x2b77de;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/configurations',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router['delete'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);module[_0x0a9e('0x14')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js index 63e6e46..76921fa 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(_0x4a709b,_0x30474b){var _0x3b4cc=function(_0x5f38e2){while(--_0x5f38e2){_0x4a709b['push'](_0x4a709b['shift']());}};_0x3b4cc(++_0x30474b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x37c22c,_0x28a70d){_0x37c22c=_0x37c22c-0x0;var _0x119d79=_0xa9e0[_0x37c22c];return _0x119d79;};'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(_0x4e6d48,_0x51d7b5){var _0x58bc21=function(_0xb40ff){while(--_0xb40ff){_0x4e6d48['push'](_0x4e6d48['shift']());}};_0x58bc21(++_0x51d7b5);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4ea69d,_0x290f53){_0x4ea69d=_0x4ea69d-0x0;var _0x5318e0=_0xa9e0[_0x4ea69d];return _0x5318e0;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'name':{'type':Sequelize[_0x0a9e('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING'],'unique':_0x0a9e('0x3')},'password':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x0a9e('0x2')],'unique':_0x0a9e('0x4')},'serverUrl':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.controller.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.controller.js index 890d354..40d2195 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 _0xe7f0=['module_fields','remove','includes','label','endsWith','value','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','send','Wrong\x20credentials','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','nolimit','order','sort','pick','filter','merge','VIRTUAL','options','where','SugarcrmAccount','includeAll','include','findAll','rows','show','params','length','find','catch','create','body','findOne','SugarcrmConfiguration','getConfigurations','hasOwnProperty','addConfiguration','getSubjects','channel','Descriptions','getDescriptions','SugarcrmField','Subjects','getFields','assigned_user_id','created_by','description','duration_hours','duration_minutes','parent_type','parent_name','direction','password','remoteUri','slice','substring','lastIndexOf','POST','format','%s%s','login','JSON','xCALLY\x20Motion\x20Integration','Invalid\x20Login','/service/v4_1/rest.php','get_module_fields','Calls','values'];(function(_0x8afdd0,_0x548ad1){var _0x3de7ac=function(_0x2dc2c4){while(--_0x2dc2c4){_0x8afdd0['push'](_0x8afdd0['shift']());}};_0x3de7ac(++_0x548ad1);}(_0xe7f0,0x183));var _0x0e7f=function(_0x1875c8,_0x4e5f7a){_0x1875c8=_0x1875c8-0x0;var _0x28ed91=_0xe7f0[_0x1875c8];return _0x28ed91;};'use strict';var emlformat=require(_0x0e7f('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x0e7f('0x1'));var rp=require(_0x0e7f('0x2'));var moment=require(_0x0e7f('0x3'));var BPromise=require(_0x0e7f('0x4'));var Mustache=require(_0x0e7f('0x5'));var util=require(_0x0e7f('0x6'));var path=require(_0x0e7f('0x7'));var sox=require(_0x0e7f('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0e7f('0x9'));var _=require(_0x0e7f('0xa'));var squel=require(_0x0e7f('0xb'));var crypto=require('crypto');var jsforce=require(_0x0e7f('0xc'));var deskjs=require(_0x0e7f('0xd'));var toCsv=require(_0x0e7f('0xe'));var querystring=require('querystring');var Papa=require(_0x0e7f('0xf'));var Redis=require(_0x0e7f('0x10'));var authService=require(_0x0e7f('0x11'));var qs=require(_0x0e7f('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x0e7f('0x13'))(_0x0e7f('0x14'));var utils=require(_0x0e7f('0x15'));var config=require(_0x0e7f('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require(_0x0e7f('0x17'));function respondWithStatusCode(_0x4b2974,_0x56ae9c){_0x56ae9c=_0x56ae9c||0xcc;return function(_0x208716){if(_0x208716){return _0x4b2974[_0x0e7f('0x18')](_0x56ae9c);}return _0x4b2974[_0x0e7f('0x19')](_0x56ae9c)[_0x0e7f('0x1a')]();};}function respondWithResult(_0x10cdc3,_0x5bc27a){_0x5bc27a=_0x5bc27a||0xc8;return function(_0x3a1f28){if(_0x3a1f28){return _0x10cdc3[_0x0e7f('0x19')](_0x5bc27a)[_0x0e7f('0x1b')](_0x3a1f28);}};}function respondWithFilteredResult(_0x2d7a6f,_0x15d488){return function(_0x21b63d){if(_0x21b63d){var _0x53ca45=typeof _0x15d488[_0x0e7f('0x1c')]===_0x0e7f('0x1d')&&typeof _0x15d488[_0x0e7f('0x1e')]===_0x0e7f('0x1d');var _0x869990=_0x21b63d[_0x0e7f('0x1f')];var _0x3f96a4=_0x53ca45?0x0:_0x15d488[_0x0e7f('0x1c')];var _0x5e8605=_0x53ca45?_0x21b63d['count']:_0x15d488[_0x0e7f('0x1c')]+_0x15d488[_0x0e7f('0x1e')];var _0x36099b;if(_0x5e8605>=_0x869990){_0x5e8605=_0x869990;_0x36099b=0xc8;}else{_0x36099b=0xce;}_0x2d7a6f[_0x0e7f('0x19')](_0x36099b);return _0x2d7a6f[_0x0e7f('0x20')](_0x0e7f('0x21'),_0x3f96a4+'-'+_0x5e8605+'/'+_0x869990)[_0x0e7f('0x1b')](_0x21b63d);}return null;};}function patchUpdates(_0x2b280e){return function(_0x154a69){try{jsonpatch[_0x0e7f('0x22')](_0x154a69,_0x2b280e,!![]);}catch(_0x31adb0){return BPromise[_0x0e7f('0x23')](_0x31adb0);}return _0x154a69[_0x0e7f('0x24')]();};}function saveUpdates(_0x1fae4d,_0x41a8cc){return function(_0x319d62){if(_0x319d62){return _0x319d62[_0x0e7f('0x25')](_0x1fae4d)[_0x0e7f('0x26')](function(_0x5dbbed){return _0x5dbbed;});}return null;};}function removeEntity(_0x36c90b,_0x45f854){return function(_0x43a053){if(_0x43a053){return _0x43a053[_0x0e7f('0x27')]()[_0x0e7f('0x26')](function(){_0x36c90b[_0x0e7f('0x19')](0xcc)[_0x0e7f('0x1a')]();});}};}function handleEntityNotFound(_0x48e34e,_0x25d04f){return function(_0x37afd7){if(!_0x37afd7){_0x48e34e[_0x0e7f('0x18')](0x194);}return _0x37afd7;};}function handleError(_0x39c245,_0x20f11c){_0x20f11c=_0x20f11c||0x1f4;return function(_0xd94690){logger[_0x0e7f('0x28')](_0xd94690[_0x0e7f('0x29')]);if(_0xd94690['name']){delete _0xd94690[_0x0e7f('0x2a')];}_0x39c245['status'](_0x20f11c)['send'](_0xd94690);};}exports[_0x0e7f('0x2b')]=function(_0x3b19cd,_0x229602){var _0x5c5826={},_0x430dca={},_0x9044df={'count':0x0,'rows':[]};var _0xe41794=_[_0x0e7f('0x2c')](db['SugarcrmAccount'][_0x0e7f('0x2d')],function(_0x5b7570){return{'name':_0x5b7570[_0x0e7f('0x2e')],'type':_0x5b7570[_0x0e7f('0x2f')][_0x0e7f('0x30')]};});_0x430dca[_0x0e7f('0x31')]=_['map'](_0xe41794,'name');_0x430dca[_0x0e7f('0x32')]=_[_0x0e7f('0x33')](_0x3b19cd['query']);_0x430dca[_0x0e7f('0x34')]=_[_0x0e7f('0x35')](_0x430dca['model'],_0x430dca[_0x0e7f('0x32')]);_0x5c5826['attributes']=_[_0x0e7f('0x35')](_0x430dca['model'],qs[_0x0e7f('0x36')](_0x3b19cd[_0x0e7f('0x32')][_0x0e7f('0x36')]));_0x5c5826['attributes']=_0x5c5826['attributes']['length']?_0x5c5826[_0x0e7f('0x37')]:_0x430dca['model'];if(!_0x3b19cd['query']['hasOwnProperty'](_0x0e7f('0x38'))){_0x5c5826[_0x0e7f('0x1e')]=qs[_0x0e7f('0x1e')](_0x3b19cd[_0x0e7f('0x32')][_0x0e7f('0x1e')]);_0x5c5826[_0x0e7f('0x1c')]=qs['offset'](_0x3b19cd[_0x0e7f('0x32')][_0x0e7f('0x1c')]);}_0x5c5826[_0x0e7f('0x39')]=qs[_0x0e7f('0x3a')](_0x3b19cd[_0x0e7f('0x32')][_0x0e7f('0x3a')]);_0x5c5826['where']=qs[_0x0e7f('0x34')](_[_0x0e7f('0x3b')](_0x3b19cd[_0x0e7f('0x32')],_0x430dca['filters']),_0xe41794);if(_0x3b19cd[_0x0e7f('0x32')][_0x0e7f('0x3c')]){_0x5c5826['where']=_[_0x0e7f('0x3d')](_0x5c5826['where'],{'$or':_[_0x0e7f('0x2c')](_0xe41794,function(_0x2c7c22){if(_0x2c7c22[_0x0e7f('0x2f')]!==_0x0e7f('0x3e')){var _0x398a12={};_0x398a12[_0x2c7c22['name']]={'$like':'%'+_0x3b19cd[_0x0e7f('0x32')][_0x0e7f('0x3c')]+'%'};return _0x398a12;}})});}_0x5c5826=_[_0x0e7f('0x3d')]({},_0x5c5826,_0x3b19cd[_0x0e7f('0x3f')]);var _0x5c9acc={'where':_0x5c5826[_0x0e7f('0x40')]};return db[_0x0e7f('0x41')]['count'](_0x5c9acc)[_0x0e7f('0x26')](function(_0x10eb7e){_0x9044df[_0x0e7f('0x1f')]=_0x10eb7e;if(_0x3b19cd['query'][_0x0e7f('0x42')]){_0x5c5826[_0x0e7f('0x43')]=[{'all':!![]}];}return db['SugarcrmAccount'][_0x0e7f('0x44')](_0x5c5826);})['then'](function(_0x8e202a){_0x9044df[_0x0e7f('0x45')]=_0x8e202a;return _0x9044df;})['then'](respondWithFilteredResult(_0x229602,_0x5c5826))['catch'](handleError(_0x229602,null));};exports[_0x0e7f('0x46')]=function(_0x4e11bf,_0x1a0764){var _0x4e609a={'raw':![],'where':{'id':_0x4e11bf[_0x0e7f('0x47')]['id']}},_0x4a45d3={};_0x4a45d3[_0x0e7f('0x31')]=_[_0x0e7f('0x33')](db['SugarcrmAccount'][_0x0e7f('0x2d')]);_0x4a45d3['query']=_[_0x0e7f('0x33')](_0x4e11bf['query']);_0x4a45d3['filters']=_[_0x0e7f('0x35')](_0x4a45d3[_0x0e7f('0x31')],_0x4a45d3['query']);_0x4e609a[_0x0e7f('0x37')]=_['intersection'](_0x4a45d3[_0x0e7f('0x31')],qs['fields'](_0x4e11bf[_0x0e7f('0x32')][_0x0e7f('0x36')]));_0x4e609a['attributes']=_0x4e609a[_0x0e7f('0x37')][_0x0e7f('0x48')]?_0x4e609a[_0x0e7f('0x37')]:_0x4a45d3[_0x0e7f('0x31')];if(_0x4e11bf[_0x0e7f('0x32')][_0x0e7f('0x42')]){_0x4e609a[_0x0e7f('0x43')]=[{'all':!![]}];}_0x4e609a=_['merge']({},_0x4e609a,_0x4e11bf[_0x0e7f('0x3f')]);return db[_0x0e7f('0x41')][_0x0e7f('0x49')](_0x4e609a)[_0x0e7f('0x26')](handleEntityNotFound(_0x1a0764,null))[_0x0e7f('0x26')](respondWithResult(_0x1a0764,null))[_0x0e7f('0x4a')](handleError(_0x1a0764,null));};exports[_0x0e7f('0x4b')]=function(_0x4e1708,_0x445b4e){return db[_0x0e7f('0x41')][_0x0e7f('0x4b')](_0x4e1708[_0x0e7f('0x4c')],{})[_0x0e7f('0x26')](respondWithResult(_0x445b4e,0xc9))['catch'](handleError(_0x445b4e,null));};exports[_0x0e7f('0x25')]=function(_0x2ffbf0,_0x123f1a){if(_0x2ffbf0[_0x0e7f('0x4c')]['id']){delete _0x2ffbf0[_0x0e7f('0x4c')]['id'];}return db[_0x0e7f('0x41')][_0x0e7f('0x49')]({'where':{'id':_0x2ffbf0['params']['id']}})[_0x0e7f('0x26')](handleEntityNotFound(_0x123f1a,null))['then'](saveUpdates(_0x2ffbf0[_0x0e7f('0x4c')],null))['then'](respondWithResult(_0x123f1a,null))[_0x0e7f('0x4a')](handleError(_0x123f1a,null));};exports[_0x0e7f('0x27')]=function(_0x12246a,_0x384ee9){return db['SugarcrmAccount'][_0x0e7f('0x49')]({'where':{'id':_0x12246a['params']['id']}})[_0x0e7f('0x26')](handleEntityNotFound(_0x384ee9,null))[_0x0e7f('0x26')](removeEntity(_0x384ee9,null))[_0x0e7f('0x4a')](handleError(_0x384ee9,null));};exports['getConfigurations']=function(_0x367506,_0x30b5fe,_0xaa04dd){var _0x203a6d={};var _0x15247b={};var _0x29b978;var _0x2d7f45;return db[_0x0e7f('0x41')][_0x0e7f('0x4d')]({'where':{'id':_0x367506[_0x0e7f('0x47')]['id']}})['then'](handleEntityNotFound(_0x30b5fe,null))[_0x0e7f('0x26')](function(_0x164c44){if(_0x164c44){_0x29b978=_0x164c44;_0x15247b[_0x0e7f('0x31')]=_[_0x0e7f('0x33')](db[_0x0e7f('0x4e')][_0x0e7f('0x2d')]);_0x15247b[_0x0e7f('0x32')]=_[_0x0e7f('0x33')](_0x367506[_0x0e7f('0x32')]);_0x15247b[_0x0e7f('0x34')]=_[_0x0e7f('0x35')](_0x15247b[_0x0e7f('0x31')],_0x15247b[_0x0e7f('0x32')]);_0x203a6d['attributes']=_[_0x0e7f('0x35')](_0x15247b[_0x0e7f('0x31')],qs[_0x0e7f('0x36')](_0x367506['query'][_0x0e7f('0x36')]));_0x203a6d[_0x0e7f('0x37')]=_0x203a6d[_0x0e7f('0x37')][_0x0e7f('0x48')]?_0x203a6d[_0x0e7f('0x37')]:_0x15247b[_0x0e7f('0x31')];_0x203a6d[_0x0e7f('0x39')]=qs['sort'](_0x367506[_0x0e7f('0x32')][_0x0e7f('0x3a')]);_0x203a6d[_0x0e7f('0x40')]=qs[_0x0e7f('0x34')](_[_0x0e7f('0x3b')](_0x367506[_0x0e7f('0x32')],_0x15247b[_0x0e7f('0x34')]));if(_0x367506['query'][_0x0e7f('0x3c')]){_0x203a6d['where']=_[_0x0e7f('0x3d')](_0x203a6d[_0x0e7f('0x40')],{'$or':_[_0x0e7f('0x2c')](_0x203a6d['attributes'],function(_0x5903c5){var _0x32bb52={};_0x32bb52[_0x5903c5]={'$like':'%'+_0x367506['query'][_0x0e7f('0x3c')]+'%'};return _0x32bb52;})});}_0x203a6d=_[_0x0e7f('0x3d')]({},_0x203a6d,_0x367506[_0x0e7f('0x3f')]);return _0x29b978[_0x0e7f('0x4f')](_0x203a6d);}})[_0x0e7f('0x26')](function(_0x1057d4){if(_0x1057d4){_0x2d7f45=_0x1057d4[_0x0e7f('0x48')];if(!_0x367506[_0x0e7f('0x32')][_0x0e7f('0x50')]('nolimit')){_0x203a6d['limit']=qs[_0x0e7f('0x1e')](_0x367506[_0x0e7f('0x32')][_0x0e7f('0x1e')]);_0x203a6d[_0x0e7f('0x1c')]=qs['offset'](_0x367506[_0x0e7f('0x32')][_0x0e7f('0x1c')]);}return _0x29b978['getConfigurations'](_0x203a6d);}})[_0x0e7f('0x26')](function(_0xe95436){if(_0xe95436){return _0xe95436?{'count':_0x2d7f45,'rows':_0xe95436}:null;}})[_0x0e7f('0x26')](respondWithResult(_0x30b5fe,null))[_0x0e7f('0x4a')](handleError(_0x30b5fe,null));};exports[_0x0e7f('0x51')]=function(_0x43b76c,_0xe9ee65,_0x2270d9){if(_0x43b76c[_0x0e7f('0x4c')]['id']){delete _0x43b76c['body']['id'];}return db['SugarcrmAccount'][_0x0e7f('0x4d')]({'where':{'id':_0x43b76c['params']['id']}})[_0x0e7f('0x26')](handleEntityNotFound(_0xe9ee65,null))[_0x0e7f('0x26')](function(_0x4dcfa4){if(_0x4dcfa4){_0x43b76c[_0x0e7f('0x4c')]['AccountId']=_0x4dcfa4['id'];_0x43b76c['body']['Subjects']=integrations[_0x0e7f('0x52')](_0x43b76c[_0x0e7f('0x4c')][_0x0e7f('0x53')],_0x43b76c['body'][_0x0e7f('0x2f')]);_0x43b76c[_0x0e7f('0x4c')][_0x0e7f('0x54')]=integrations[_0x0e7f('0x55')](_0x43b76c[_0x0e7f('0x4c')][_0x0e7f('0x53')],_0x43b76c[_0x0e7f('0x4c')]['type']);return db['SugarcrmConfiguration'][_0x0e7f('0x4b')](_0x43b76c[_0x0e7f('0x4c')],{'include':[{'model':db[_0x0e7f('0x56')],'as':_0x0e7f('0x57')},{'model':db[_0x0e7f('0x56')],'as':_0x0e7f('0x54')}]});}return null;})[_0x0e7f('0x26')](respondWithResult(_0xe9ee65,null))[_0x0e7f('0x4a')](handleError(_0xe9ee65,null));};exports[_0x0e7f('0x58')]=function(_0x5d351b,_0x26a4b0,_0x45f2a4){var _0x4c6f17='';var _0x3509ee=['id',_0x0e7f('0x2a'),_0x0e7f('0x59'),_0x0e7f('0x5a'),_0x0e7f('0x5b'),'date_start',_0x0e7f('0x5c'),_0x0e7f('0x5d'),'parent_id',_0x0e7f('0x5e'),_0x0e7f('0x5f'),_0x0e7f('0x60')];return db['SugarcrmAccount'][_0x0e7f('0x4d')]({'where':{'id':_0x5d351b[_0x0e7f('0x47')]['id']},'attributes':['id','username',_0x0e7f('0x61'),_0x0e7f('0x62')]})[_0x0e7f('0x26')](handleEntityNotFound(_0x26a4b0,null))['then'](function(_0x3fc516){if(_0x3fc516){_0x4c6f17=_0x3fc516[_0x0e7f('0x62')];var _0x18982b=_0x4c6f17[_0x0e7f('0x63')](-0x1);if(_0x18982b==='/'){_0x4c6f17=_0x4c6f17[_0x0e7f('0x64')](0x0,_0x4c6f17[_0x0e7f('0x65')](_0x18982b));}return rp({'method':_0x0e7f('0x66'),'uri':util[_0x0e7f('0x67')](_0x0e7f('0x68'),_0x4c6f17,'/service/v4_1/rest.php'),'json':!![],'form':{'method':_0x0e7f('0x69'),'input_type':_0x0e7f('0x6a'),'response_type':_0x0e7f('0x6a'),'rest_data':JSON['stringify']({'user_auth':{'user_name':_0x3fc516['username'],'password':_0x3fc516[_0x0e7f('0x61')],'encryption':'PLAIN'},'application':_0x0e7f('0x6b')})}});}})[_0x0e7f('0x26')](function(_0x144086){if(_0x144086&&_0x144086[_0x0e7f('0x2a')]!==_0x0e7f('0x6c')&&_0x144086[_0x0e7f('0x2a')]!=='Password\x20Expired'){return rp({'method':'POST','uri':util['format']('%s%s',_0x4c6f17,_0x0e7f('0x6d')),'json':!![],'form':{'method':_0x0e7f('0x6e'),'input_type':_0x0e7f('0x6a'),'response_type':_0x0e7f('0x6a'),'rest_data':JSON['stringify']({'session':_0x144086['id'],'module_name':_0x0e7f('0x6f')})}})[_0x0e7f('0x26')](function(_0x4a25c5){if(_0x4a25c5){var _0x11a772=_[_0x0e7f('0x70')](_0x4a25c5[_0x0e7f('0x71')]);_[_0x0e7f('0x72')](_0x11a772,function(_0x49775d){return _0x3509ee[_0x0e7f('0x73')](_0x49775d[_0x0e7f('0x2a')]);});return{'count':_0x11a772['length'],'rows':_[_0x0e7f('0x2c')](_0x11a772,function(_0x598aab){return{'id':_0x598aab[_0x0e7f('0x2a')],'name':_0x598aab[_0x0e7f('0x74')],'custom':_[_0x0e7f('0x75')](_0x598aab[_0x0e7f('0x2a')],'_c')?!![]:![],'options':_0x598aab[_0x0e7f('0x3f')]?_[_0x0e7f('0x2c')](_[_0x0e7f('0x70')](_0x598aab[_0x0e7f('0x3f')]),function(_0x3da9d0){return{'name':_0x3da9d0[_0x0e7f('0x76')],'value':_0x3da9d0[_0x0e7f('0x2a')]};}):[]};})};}})['then'](respondWithResult(_0x26a4b0,null))[_0x0e7f('0x4a')](function(_0x263039){var _0x3f108e=_0x5d351b[_0x0e7f('0x32')][_0x0e7f('0x77')]?0x1f4:_0x263039[_0x0e7f('0x78')]||0x1f4;logger[_0x0e7f('0x28')](_0x0e7f('0x79'),_0x0e7f('0x58'),_0x3f108e,JSON[_0x0e7f('0x7a')](_0x263039));delete _0x263039['name'];if(_0x3f108e===0x191){_0x3f108e=0x190;}_0x26a4b0['status'](_0x3f108e)[_0x0e7f('0x7b')](_0x5d351b[_0x0e7f('0x32')][_0x0e7f('0x77')]?{'message':_0x0e7f('0x7c'),'statusCode':_0x263039[_0x0e7f('0x78')]}:_0x263039);});}else{var _0x2075b6=0x1f4;_0x26a4b0[_0x0e7f('0x19')](_0x2075b6)[_0x0e7f('0x7b')]({'message':_0x0e7f('0x7c'),'statusCode':0x190});}});}; \ No newline at end of file +var _0x779d=['nolimit','order','sort','where','pick','merge','type','filter','options','includeAll','include','catch','show','keys','find','create','body','params','findOne','rawAttributes','getConfigurations','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','SugarcrmConfiguration','SugarcrmField','getFields','assigned_user_id','description','date_start','duration_hours','duration_minutes','parent_id','parent_name','direction','username','password','remoteUri','slice','substring','lastIndexOf','POST','format','%s%s','/service/v4_1/rest.php','login','JSON','stringify','xCALLY\x20Motion\x20Integration','Password\x20Expired','Calls','values','module_fields','remove','includes','endsWith','value','test','statusCode','error','Wrong\x20credentials','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','json','undefined','limit','count','offset','status','set','apply','reject','update','then','end','stack','name','send','index','map','SugarcrmAccount','fieldName','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty'];(function(_0x401944,_0x552dbb){var _0x5b1d81=function(_0x1ab67b){while(--_0x1ab67b){_0x401944['push'](_0x401944['shift']());}};_0x5b1d81(++_0x552dbb);}(_0x779d,0x1a2));var _0xd779=function(_0x1b68d3,_0x52bdf7){_0x1b68d3=_0x1b68d3-0x0;var _0x123897=_0x779d[_0x1b68d3];return _0x123897;};'use strict';var emlformat=require(_0xd779('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xd779('0x1'));var rp=require(_0xd779('0x2'));var moment=require(_0xd779('0x3'));var BPromise=require(_0xd779('0x4'));var Mustache=require(_0xd779('0x5'));var util=require(_0xd779('0x6'));var path=require(_0xd779('0x7'));var sox=require(_0xd779('0x8'));var csv=require(_0xd779('0x9'));var ejs=require(_0xd779('0xa'));var fs=require('fs');var fs_extra=require(_0xd779('0xb'));var _=require(_0xd779('0xc'));var squel=require(_0xd779('0xd'));var crypto=require(_0xd779('0xe'));var jsforce=require(_0xd779('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xd779('0x9'));var querystring=require('querystring');var Papa=require(_0xd779('0x10'));var Redis=require(_0xd779('0x11'));var authService=require(_0xd779('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd779('0x13'));var logger=require('../../config/logger')(_0xd779('0x14'));var utils=require('../../config/utils');var config=require(_0xd779('0x15'));var licenseUtil=require(_0xd779('0x16'));var db=require(_0xd779('0x17'))['db'];var integrations=require(_0xd779('0x18'));function respondWithStatusCode(_0x16055f,_0x4e736b){_0x4e736b=_0x4e736b||0xcc;return function(_0x2b85b2){if(_0x2b85b2){return _0x16055f[_0xd779('0x19')](_0x4e736b);}return _0x16055f['status'](_0x4e736b)['end']();};}function respondWithResult(_0x29d8bf,_0x583b5e){_0x583b5e=_0x583b5e||0xc8;return function(_0x1a1ba4){if(_0x1a1ba4){return _0x29d8bf['status'](_0x583b5e)[_0xd779('0x1a')](_0x1a1ba4);}};}function respondWithFilteredResult(_0x13bc7d,_0x30e29f){return function(_0x362d5a){if(_0x362d5a){var _0x18f690=typeof _0x30e29f['offset']===_0xd779('0x1b')&&typeof _0x30e29f[_0xd779('0x1c')]===_0xd779('0x1b');var _0x5784c4=_0x362d5a['count'];var _0x3290b4=_0x18f690?0x0:_0x30e29f['offset'];var _0x34708e=_0x18f690?_0x362d5a[_0xd779('0x1d')]:_0x30e29f[_0xd779('0x1e')]+_0x30e29f[_0xd779('0x1c')];var _0x5e5cad;if(_0x34708e>=_0x5784c4){_0x34708e=_0x5784c4;_0x5e5cad=0xc8;}else{_0x5e5cad=0xce;}_0x13bc7d[_0xd779('0x1f')](_0x5e5cad);return _0x13bc7d[_0xd779('0x20')]('Content-Range',_0x3290b4+'-'+_0x34708e+'/'+_0x5784c4)[_0xd779('0x1a')](_0x362d5a);}return null;};}function patchUpdates(_0x299cdb){return function(_0x57e52a){try{jsonpatch[_0xd779('0x21')](_0x57e52a,_0x299cdb,!![]);}catch(_0x50a4fc){return BPromise[_0xd779('0x22')](_0x50a4fc);}return _0x57e52a['save']();};}function saveUpdates(_0x57d4ae,_0x324edc){return function(_0x58e516){if(_0x58e516){return _0x58e516[_0xd779('0x23')](_0x57d4ae)[_0xd779('0x24')](function(_0x30293c){return _0x30293c;});}return null;};}function removeEntity(_0xc9fc89,_0xa813f4){return function(_0x4b1b32){if(_0x4b1b32){return _0x4b1b32['destroy']()[_0xd779('0x24')](function(){_0xc9fc89['status'](0xcc)[_0xd779('0x25')]();});}};}function handleEntityNotFound(_0xa89953,_0x326768){return function(_0x2cc8d7){if(!_0x2cc8d7){_0xa89953['sendStatus'](0x194);}return _0x2cc8d7;};}function handleError(_0x490763,_0x15ab23){_0x15ab23=_0x15ab23||0x1f4;return function(_0x3aad63){logger['error'](_0x3aad63[_0xd779('0x26')]);if(_0x3aad63['name']){delete _0x3aad63[_0xd779('0x27')];}_0x490763[_0xd779('0x1f')](_0x15ab23)[_0xd779('0x28')](_0x3aad63);};}exports[_0xd779('0x29')]=function(_0x9b2994,_0x2a8ad8){var _0xb4de8d={},_0x5e4686={},_0x4eb20f={'count':0x0,'rows':[]};var _0x4037e6=_[_0xd779('0x2a')](db[_0xd779('0x2b')]['rawAttributes'],function(_0x356c5b){return{'name':_0x356c5b[_0xd779('0x2c')],'type':_0x356c5b['type'][_0xd779('0x2d')]};});_0x5e4686[_0xd779('0x2e')]=_[_0xd779('0x2a')](_0x4037e6,_0xd779('0x27'));_0x5e4686[_0xd779('0x2f')]=_['keys'](_0x9b2994[_0xd779('0x2f')]);_0x5e4686[_0xd779('0x30')]=_['intersection'](_0x5e4686[_0xd779('0x2e')],_0x5e4686[_0xd779('0x2f')]);_0xb4de8d['attributes']=_[_0xd779('0x31')](_0x5e4686[_0xd779('0x2e')],qs[_0xd779('0x32')](_0x9b2994[_0xd779('0x2f')][_0xd779('0x32')]));_0xb4de8d[_0xd779('0x33')]=_0xb4de8d['attributes'][_0xd779('0x34')]?_0xb4de8d[_0xd779('0x33')]:_0x5e4686['model'];if(!_0x9b2994[_0xd779('0x2f')][_0xd779('0x35')](_0xd779('0x36'))){_0xb4de8d[_0xd779('0x1c')]=qs['limit'](_0x9b2994['query'][_0xd779('0x1c')]);_0xb4de8d[_0xd779('0x1e')]=qs['offset'](_0x9b2994[_0xd779('0x2f')][_0xd779('0x1e')]);}_0xb4de8d[_0xd779('0x37')]=qs[_0xd779('0x38')](_0x9b2994[_0xd779('0x2f')][_0xd779('0x38')]);_0xb4de8d[_0xd779('0x39')]=qs[_0xd779('0x30')](_[_0xd779('0x3a')](_0x9b2994['query'],_0x5e4686[_0xd779('0x30')]),_0x4037e6);if(_0x9b2994[_0xd779('0x2f')]['filter']){_0xb4de8d['where']=_[_0xd779('0x3b')](_0xb4de8d[_0xd779('0x39')],{'$or':_['map'](_0x4037e6,function(_0x332be8){if(_0x332be8[_0xd779('0x3c')]!=='VIRTUAL'){var _0x2a08d4={};_0x2a08d4[_0x332be8[_0xd779('0x27')]]={'$like':'%'+_0x9b2994[_0xd779('0x2f')][_0xd779('0x3d')]+'%'};return _0x2a08d4;}})});}_0xb4de8d=_['merge']({},_0xb4de8d,_0x9b2994[_0xd779('0x3e')]);var _0xf7935d={'where':_0xb4de8d[_0xd779('0x39')]};return db[_0xd779('0x2b')]['count'](_0xf7935d)[_0xd779('0x24')](function(_0x5ab8a0){_0x4eb20f[_0xd779('0x1d')]=_0x5ab8a0;if(_0x9b2994[_0xd779('0x2f')][_0xd779('0x3f')]){_0xb4de8d[_0xd779('0x40')]=[{'all':!![]}];}return db[_0xd779('0x2b')]['findAll'](_0xb4de8d);})[_0xd779('0x24')](function(_0x2cc352){_0x4eb20f['rows']=_0x2cc352;return _0x4eb20f;})[_0xd779('0x24')](respondWithFilteredResult(_0x2a8ad8,_0xb4de8d))[_0xd779('0x41')](handleError(_0x2a8ad8,null));};exports[_0xd779('0x42')]=function(_0x4894af,_0x414050){var _0x3cb0cd={'raw':![],'where':{'id':_0x4894af['params']['id']}},_0x2d16c7={};_0x2d16c7['model']=_['keys'](db[_0xd779('0x2b')]['rawAttributes']);_0x2d16c7['query']=_[_0xd779('0x43')](_0x4894af[_0xd779('0x2f')]);_0x2d16c7['filters']=_['intersection'](_0x2d16c7['model'],_0x2d16c7[_0xd779('0x2f')]);_0x3cb0cd[_0xd779('0x33')]=_[_0xd779('0x31')](_0x2d16c7[_0xd779('0x2e')],qs[_0xd779('0x32')](_0x4894af[_0xd779('0x2f')][_0xd779('0x32')]));_0x3cb0cd[_0xd779('0x33')]=_0x3cb0cd[_0xd779('0x33')][_0xd779('0x34')]?_0x3cb0cd[_0xd779('0x33')]:_0x2d16c7[_0xd779('0x2e')];if(_0x4894af[_0xd779('0x2f')][_0xd779('0x3f')]){_0x3cb0cd['include']=[{'all':!![]}];}_0x3cb0cd=_[_0xd779('0x3b')]({},_0x3cb0cd,_0x4894af[_0xd779('0x3e')]);return db['SugarcrmAccount'][_0xd779('0x44')](_0x3cb0cd)['then'](handleEntityNotFound(_0x414050,null))[_0xd779('0x24')](respondWithResult(_0x414050,null))[_0xd779('0x41')](handleError(_0x414050,null));};exports['create']=function(_0x3c8e45,_0x255eea){return db['SugarcrmAccount'][_0xd779('0x45')](_0x3c8e45['body'],{})[_0xd779('0x24')](respondWithResult(_0x255eea,0xc9))[_0xd779('0x41')](handleError(_0x255eea,null));};exports[_0xd779('0x23')]=function(_0x456426,_0x9e4057){if(_0x456426[_0xd779('0x46')]['id']){delete _0x456426[_0xd779('0x46')]['id'];}return db[_0xd779('0x2b')][_0xd779('0x44')]({'where':{'id':_0x456426[_0xd779('0x47')]['id']}})[_0xd779('0x24')](handleEntityNotFound(_0x9e4057,null))[_0xd779('0x24')](saveUpdates(_0x456426[_0xd779('0x46')],null))['then'](respondWithResult(_0x9e4057,null))[_0xd779('0x41')](handleError(_0x9e4057,null));};exports['destroy']=function(_0x5ee059,_0x4fb26f){return db[_0xd779('0x2b')]['find']({'where':{'id':_0x5ee059[_0xd779('0x47')]['id']}})['then'](handleEntityNotFound(_0x4fb26f,null))[_0xd779('0x24')](removeEntity(_0x4fb26f,null))[_0xd779('0x41')](handleError(_0x4fb26f,null));};exports['getConfigurations']=function(_0x3f9814,_0x2defbe,_0xc58910){var _0xf96f52={};var _0x55cf6b={};var _0x3d99b6;var _0x33c882;return db[_0xd779('0x2b')][_0xd779('0x48')]({'where':{'id':_0x3f9814['params']['id']}})[_0xd779('0x24')](handleEntityNotFound(_0x2defbe,null))[_0xd779('0x24')](function(_0x182d66){if(_0x182d66){_0x3d99b6=_0x182d66;_0x55cf6b[_0xd779('0x2e')]=_['keys'](db['SugarcrmConfiguration'][_0xd779('0x49')]);_0x55cf6b[_0xd779('0x2f')]=_[_0xd779('0x43')](_0x3f9814[_0xd779('0x2f')]);_0x55cf6b[_0xd779('0x30')]=_[_0xd779('0x31')](_0x55cf6b['model'],_0x55cf6b[_0xd779('0x2f')]);_0xf96f52[_0xd779('0x33')]=_[_0xd779('0x31')](_0x55cf6b[_0xd779('0x2e')],qs[_0xd779('0x32')](_0x3f9814[_0xd779('0x2f')]['fields']));_0xf96f52[_0xd779('0x33')]=_0xf96f52[_0xd779('0x33')][_0xd779('0x34')]?_0xf96f52[_0xd779('0x33')]:_0x55cf6b['model'];_0xf96f52[_0xd779('0x37')]=qs['sort'](_0x3f9814[_0xd779('0x2f')][_0xd779('0x38')]);_0xf96f52[_0xd779('0x39')]=qs['filters'](_[_0xd779('0x3a')](_0x3f9814[_0xd779('0x2f')],_0x55cf6b[_0xd779('0x30')]));if(_0x3f9814[_0xd779('0x2f')]['filter']){_0xf96f52[_0xd779('0x39')]=_[_0xd779('0x3b')](_0xf96f52[_0xd779('0x39')],{'$or':_[_0xd779('0x2a')](_0xf96f52[_0xd779('0x33')],function(_0x6d966f){var _0x543cdd={};_0x543cdd[_0x6d966f]={'$like':'%'+_0x3f9814[_0xd779('0x2f')][_0xd779('0x3d')]+'%'};return _0x543cdd;})});}_0xf96f52=_['merge']({},_0xf96f52,_0x3f9814['options']);return _0x3d99b6['getConfigurations'](_0xf96f52);}})[_0xd779('0x24')](function(_0x186a71){if(_0x186a71){_0x33c882=_0x186a71[_0xd779('0x34')];if(!_0x3f9814[_0xd779('0x2f')][_0xd779('0x35')]('nolimit')){_0xf96f52['limit']=qs[_0xd779('0x1c')](_0x3f9814['query']['limit']);_0xf96f52[_0xd779('0x1e')]=qs[_0xd779('0x1e')](_0x3f9814[_0xd779('0x2f')][_0xd779('0x1e')]);}return _0x3d99b6[_0xd779('0x4a')](_0xf96f52);}})['then'](function(_0x290276){if(_0x290276){return _0x290276?{'count':_0x33c882,'rows':_0x290276}:null;}})[_0xd779('0x24')](respondWithResult(_0x2defbe,null))[_0xd779('0x41')](handleError(_0x2defbe,null));};exports['addConfiguration']=function(_0x254ddc,_0x4741bd,_0x2514ee){if(_0x254ddc[_0xd779('0x46')]['id']){delete _0x254ddc['body']['id'];}return db[_0xd779('0x2b')]['findOne']({'where':{'id':_0x254ddc[_0xd779('0x47')]['id']}})['then'](handleEntityNotFound(_0x4741bd,null))['then'](function(_0x554b9e){if(_0x554b9e){_0x254ddc['body'][_0xd779('0x4b')]=_0x554b9e['id'];_0x254ddc['body'][_0xd779('0x4c')]=integrations[_0xd779('0x4d')](_0x254ddc[_0xd779('0x46')][_0xd779('0x4e')],_0x254ddc[_0xd779('0x46')][_0xd779('0x3c')]);_0x254ddc['body'][_0xd779('0x4f')]=integrations[_0xd779('0x50')](_0x254ddc[_0xd779('0x46')][_0xd779('0x4e')],_0x254ddc[_0xd779('0x46')][_0xd779('0x3c')]);return db[_0xd779('0x51')][_0xd779('0x45')](_0x254ddc['body'],{'include':[{'model':db[_0xd779('0x52')],'as':_0xd779('0x4c')},{'model':db[_0xd779('0x52')],'as':_0xd779('0x4f')}]});}return null;})[_0xd779('0x24')](respondWithResult(_0x4741bd,null))[_0xd779('0x41')](handleError(_0x4741bd,null));};exports[_0xd779('0x53')]=function(_0x2d29c6,_0x4d20cf,_0x38b201){var _0x369d6a='';var _0x2898bf=['id',_0xd779('0x27'),_0xd779('0x54'),'created_by',_0xd779('0x55'),_0xd779('0x56'),_0xd779('0x57'),_0xd779('0x58'),_0xd779('0x59'),'parent_type',_0xd779('0x5a'),_0xd779('0x5b')];return db[_0xd779('0x2b')][_0xd779('0x48')]({'where':{'id':_0x2d29c6['params']['id']},'attributes':['id',_0xd779('0x5c'),_0xd779('0x5d'),_0xd779('0x5e')]})[_0xd779('0x24')](handleEntityNotFound(_0x4d20cf,null))[_0xd779('0x24')](function(_0x745cb0){if(_0x745cb0){_0x369d6a=_0x745cb0[_0xd779('0x5e')];var _0x447d66=_0x369d6a[_0xd779('0x5f')](-0x1);if(_0x447d66==='/'){_0x369d6a=_0x369d6a[_0xd779('0x60')](0x0,_0x369d6a[_0xd779('0x61')](_0x447d66));}return rp({'method':_0xd779('0x62'),'uri':util[_0xd779('0x63')](_0xd779('0x64'),_0x369d6a,_0xd779('0x65')),'json':!![],'form':{'method':_0xd779('0x66'),'input_type':_0xd779('0x67'),'response_type':'JSON','rest_data':JSON[_0xd779('0x68')]({'user_auth':{'user_name':_0x745cb0[_0xd779('0x5c')],'password':_0x745cb0[_0xd779('0x5d')],'encryption':'PLAIN'},'application':_0xd779('0x69')})}});}})[_0xd779('0x24')](function(_0xad1a57){if(_0xad1a57&&_0xad1a57['name']!=='Invalid\x20Login'&&_0xad1a57['name']!==_0xd779('0x6a')){return rp({'method':_0xd779('0x62'),'uri':util['format']('%s%s',_0x369d6a,_0xd779('0x65')),'json':!![],'form':{'method':'get_module_fields','input_type':_0xd779('0x67'),'response_type':_0xd779('0x67'),'rest_data':JSON[_0xd779('0x68')]({'session':_0xad1a57['id'],'module_name':_0xd779('0x6b')})}})[_0xd779('0x24')](function(_0x11d03e){if(_0x11d03e){var _0xe9dc2d=_[_0xd779('0x6c')](_0x11d03e[_0xd779('0x6d')]);_[_0xd779('0x6e')](_0xe9dc2d,function(_0x3cc5e5){return _0x2898bf[_0xd779('0x6f')](_0x3cc5e5[_0xd779('0x27')]);});return{'count':_0xe9dc2d[_0xd779('0x34')],'rows':_[_0xd779('0x2a')](_0xe9dc2d,function(_0x3d1a38){return{'id':_0x3d1a38[_0xd779('0x27')],'name':_0x3d1a38['label'],'custom':_[_0xd779('0x70')](_0x3d1a38[_0xd779('0x27')],'_c')?!![]:![],'options':_0x3d1a38[_0xd779('0x3e')]?_[_0xd779('0x2a')](_[_0xd779('0x6c')](_0x3d1a38[_0xd779('0x3e')]),function(_0x5d060c){return{'name':_0x5d060c[_0xd779('0x71')],'value':_0x5d060c['name']};}):[]};})};}})[_0xd779('0x24')](respondWithResult(_0x4d20cf,null))[_0xd779('0x41')](function(_0x3aa87f){var _0x47d717=_0x2d29c6[_0xd779('0x2f')][_0xd779('0x72')]?0x1f4:_0x3aa87f[_0xd779('0x73')]||0x1f4;logger[_0xd779('0x74')]('getFields,\x20%s,\x20%s,\x20%s',_0xd779('0x53'),_0x47d717,JSON[_0xd779('0x68')](_0x3aa87f));delete _0x3aa87f['name'];if(_0x47d717===0x191){_0x47d717=0x190;}_0x4d20cf[_0xd779('0x1f')](_0x47d717)[_0xd779('0x28')](_0x2d29c6[_0xd779('0x2f')][_0xd779('0x72')]?{'message':_0xd779('0x75'),'statusCode':_0x3aa87f[_0xd779('0x73')]}:_0x3aa87f);});}else{var _0x55bc33=0x1f4;_0x4d20cf['status'](_0x55bc33)[_0xd779('0x28')]({'message':_0xd779('0x75'),'statusCode':0x190});}});}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.model.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.model.js index 0924461..db81156 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 _0x1ef7=['path','rimraf','../../config/environment','../../components/integrations/configuration','int_sugarcrm_accounts','util'];(function(_0x1e3d9c,_0x5ebbda){var _0x19248d=function(_0x2408ee){while(--_0x2408ee){_0x1e3d9c['push'](_0x1e3d9c['shift']());}};_0x19248d(++_0x5ebbda);}(_0x1ef7,0x173));var _0x71ef=function(_0x25efdf,_0x521462){_0x25efdf=_0x25efdf-0x0;var _0x22c495=_0x1ef7[_0x25efdf];return _0x22c495;};'use strict';var _=require('lodash');var util=require(_0x71ef('0x0'));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(_0x71ef('0x1'));var rimraf=require(_0x71ef('0x2'));var config=require(_0x71ef('0x3'));var attributes=require('./intSugarcrmAccount.attributes');var integrations=require(_0x71ef('0x4'));module['exports']=function(_0xc5ae43,_0x17aa97){return _0xc5ae43['define']('SugarcrmAccount',attributes,{'tableName':_0x71ef('0x5'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf79e=['../../config/logger','api','bluebird','request-promise','../../config/environment','./intSugarcrmAccount.attributes','../../components/integrations/configuration','exports','SugarcrmAccount','util'];(function(_0x31d6c2,_0x422dcd){var _0x295dd0=function(_0x2b5dd1){while(--_0x2b5dd1){_0x31d6c2['push'](_0x31d6c2['shift']());}};_0x295dd0(++_0x422dcd);}(_0xf79e,0x185));var _0xef79=function(_0x105114,_0x553156){_0x105114=_0x105114-0x0;var _0x511a69=_0xf79e[_0x105114];return _0x511a69;};'use strict';var _=require('lodash');var util=require(_0xef79('0x0'));var logger=require(_0xef79('0x1'))(_0xef79('0x2'));var moment=require('moment');var BPromise=require(_0xef79('0x3'));var rp=require(_0xef79('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xef79('0x5'));var attributes=require(_0xef79('0x6'));var integrations=require(_0xef79('0x7'));module[_0xef79('0x8')]=function(_0x396c51,_0x2fa668){return _0x396c51['define'](_0xef79('0x9'),attributes,{'tableName':'int_sugarcrm_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.rpc.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.rpc.js index 47ade9e..b2f2360 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 _0xef86=['error','code','message','result','catch','GetSugarcrmAccount','findAll','options','raw','where','attributes','map','include','model','ShowSugarcrmAccount','SugarcrmAccount','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','client','http','then','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','stringify'];(function(_0x5b9688,_0x4c9393){var _0x1945ab=function(_0x333c99){while(--_0x333c99){_0x5b9688['push'](_0x5b9688['shift']());}};_0x1945ab(++_0x4c9393);}(_0xef86,0x165));var _0x6ef8=function(_0x307012,_0x37a31d){_0x307012=_0x307012-0x0;var _0x2b74cc=_0xef86[_0x307012];return _0x2b74cc;};'use strict';var _=require(_0x6ef8('0x0'));var util=require(_0x6ef8('0x1'));var moment=require(_0x6ef8('0x2'));var BPromise=require(_0x6ef8('0x3'));var rs=require(_0x6ef8('0x4'));var fs=require('fs');var Redis=require(_0x6ef8('0x5'));var db=require(_0x6ef8('0x6'))['db'];var utils=require(_0x6ef8('0x7'));var logger=require('../../config/logger')(_0x6ef8('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x6ef8('0x9')][_0x6ef8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x308877,_0x35cc99,_0xe4a741){return new BPromise(function(_0x4c42af,_0x4b93b2){return client['request'](_0x308877,_0xe4a741)[_0x6ef8('0xb')](function(_0x47b0f6){logger[_0x6ef8('0xc')](_0x6ef8('0xd'),_0x35cc99,_0x6ef8('0xe'));logger[_0x6ef8('0xf')]('SugarcrmAccount,\x20%s,\x20%s,\x20%s',_0x35cc99,_0x6ef8('0xe'),JSON[_0x6ef8('0x10')](_0x47b0f6));if(_0x47b0f6[_0x6ef8('0x11')]){if(_0x47b0f6[_0x6ef8('0x11')][_0x6ef8('0x12')]===0x1f4){logger[_0x6ef8('0x11')]('SugarcrmAccount,\x20%s,\x20%s',_0x35cc99,_0x47b0f6[_0x6ef8('0x11')][_0x6ef8('0x13')]);return _0x4b93b2(_0x47b0f6[_0x6ef8('0x11')][_0x6ef8('0x13')]);}logger[_0x6ef8('0x11')](_0x6ef8('0xd'),_0x35cc99,_0x47b0f6[_0x6ef8('0x11')][_0x6ef8('0x13')]);return _0x4c42af(_0x47b0f6[_0x6ef8('0x11')][_0x6ef8('0x13')]);}else{logger[_0x6ef8('0xc')](_0x6ef8('0xd'),_0x35cc99,_0x6ef8('0xe'));_0x4c42af(_0x47b0f6[_0x6ef8('0x14')][_0x6ef8('0x13')]);}})[_0x6ef8('0x15')](function(_0xb886d5){logger['error'](_0x6ef8('0xd'),_0x35cc99,_0xb886d5);_0x4b93b2(_0xb886d5);});});}exports[_0x6ef8('0x16')]=function(_0x9a8544){var _0x5cb80f=this;return new Promise(function(_0x1e5c86,_0x1f15ce){return db['SugarcrmAccount'][_0x6ef8('0x17')]({'raw':_0x9a8544[_0x6ef8('0x18')]?_0x9a8544['options'][_0x6ef8('0x19')]===undefined?!![]:![]:!![],'where':_0x9a8544[_0x6ef8('0x18')]?_0x9a8544[_0x6ef8('0x18')][_0x6ef8('0x1a')]||null:null,'attributes':_0x9a8544[_0x6ef8('0x18')]?_0x9a8544[_0x6ef8('0x18')][_0x6ef8('0x1b')]||null:null,'limit':_0x9a8544[_0x6ef8('0x18')]?_0x9a8544[_0x6ef8('0x18')]['limit']||null:null,'include':_0x9a8544[_0x6ef8('0x18')]?_0x9a8544[_0x6ef8('0x18')]['include']?_[_0x6ef8('0x1c')](_0x9a8544['options'][_0x6ef8('0x1d')],function(_0x5854a2){return{'model':db[_0x5854a2[_0x6ef8('0x1e')]],'as':_0x5854a2['as'],'attributes':_0x5854a2[_0x6ef8('0x1b')],'include':_0x5854a2[_0x6ef8('0x1d')]?_[_0x6ef8('0x1c')](_0x5854a2[_0x6ef8('0x1d')],function(_0xe00b47){return{'model':db[_0xe00b47[_0x6ef8('0x1e')]],'as':_0xe00b47['as'],'attributes':_0xe00b47[_0x6ef8('0x1b')],'include':_0xe00b47[_0x6ef8('0x1d')]?_['map'](_0xe00b47[_0x6ef8('0x1d')],function(_0x1e3ee1){return{'model':db[_0x1e3ee1[_0x6ef8('0x1e')]],'as':_0x1e3ee1['as'],'attributes':_0x1e3ee1['attributes']};}):[]};}):[]};}):[]:[]})[_0x6ef8('0xb')](function(_0x9fd82c){logger[_0x6ef8('0xc')]('GetSugarcrmAccount',_0x9a8544);logger[_0x6ef8('0xf')](_0x6ef8('0x16'),_0x9a8544,JSON[_0x6ef8('0x10')](_0x9fd82c));_0x1e5c86(_0x9fd82c);})[_0x6ef8('0x15')](function(_0x4aac0b){logger[_0x6ef8('0x11')](_0x6ef8('0x16'),_0x4aac0b[_0x6ef8('0x13')],_0x9a8544);_0x1f15ce(_0x5cb80f[_0x6ef8('0x11')](0x1f4,_0x4aac0b[_0x6ef8('0x13')]));});});};exports[_0x6ef8('0x1f')]=function(_0x824268){var _0x4a7f17=this;return new Promise(function(_0x4eb295,_0x24271f){return db[_0x6ef8('0x20')][_0x6ef8('0x21')]({'raw':_0x824268['options']?_0x824268[_0x6ef8('0x18')][_0x6ef8('0x19')]===undefined?!![]:![]:!![],'where':_0x824268[_0x6ef8('0x18')]?_0x824268[_0x6ef8('0x18')][_0x6ef8('0x1a')]||null:null,'attributes':_0x824268[_0x6ef8('0x18')]?_0x824268[_0x6ef8('0x18')][_0x6ef8('0x1b')]||null:null,'include':_0x824268[_0x6ef8('0x18')]?_0x824268[_0x6ef8('0x18')][_0x6ef8('0x1d')]?_['map'](_0x824268[_0x6ef8('0x18')]['include'],function(_0x4f9244){return{'model':db[_0x4f9244[_0x6ef8('0x1e')]],'as':_0x4f9244['as'],'attributes':_0x4f9244[_0x6ef8('0x1b')],'include':_0x4f9244[_0x6ef8('0x1d')]?_[_0x6ef8('0x1c')](_0x4f9244[_0x6ef8('0x1d')],function(_0x3a8d3b){return{'model':db[_0x3a8d3b['model']],'as':_0x3a8d3b['as'],'attributes':_0x3a8d3b[_0x6ef8('0x1b')],'include':_0x3a8d3b[_0x6ef8('0x1d')]?_[_0x6ef8('0x1c')](_0x3a8d3b[_0x6ef8('0x1d')],function(_0xeac924){return{'model':db[_0xeac924[_0x6ef8('0x1e')]],'as':_0xeac924['as'],'attributes':_0xeac924[_0x6ef8('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x6ef8('0xb')](function(_0x35579b){logger[_0x6ef8('0xc')](_0x6ef8('0x1f'),_0x824268);logger['debug']('ShowSugarcrmAccount',_0x824268,JSON[_0x6ef8('0x10')](_0x35579b));_0x4eb295(_0x35579b);})[_0x6ef8('0x15')](function(_0x5d78f0){logger[_0x6ef8('0x11')]('ShowSugarcrmAccount',_0x5d78f0[_0x6ef8('0x13')],_0x824268);_0x24271f(_0x4a7f17['error'](0x1f4,_0x5d78f0[_0x6ef8('0x13')]));});});}; \ No newline at end of file +var _0x60ba=['../../config/environment','jayson/promise','http','request','then','info','SugarcrmAccount,\x20%s,\x20%s','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','result','catch','SugarcrmAccount','options','raw','attributes','limit','include','model','map','GetSugarcrmAccount','ShowSugarcrmAccount','find','where','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x3d3379,_0x4c9bc1){var _0x358633=function(_0x54510c){while(--_0x54510c){_0x3d3379['push'](_0x3d3379['shift']());}};_0x358633(++_0x4c9bc1);}(_0x60ba,0x160));var _0xa60b=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x60ba[_0x1facfa];return _0x9ec701;};'use strict';var _=require(_0xa60b('0x0'));var util=require(_0xa60b('0x1'));var moment=require('moment');var BPromise=require(_0xa60b('0x2'));var rs=require(_0xa60b('0x3'));var fs=require('fs');var Redis=require(_0xa60b('0x4'));var db=require(_0xa60b('0x5'))['db'];var utils=require(_0xa60b('0x6'));var logger=require(_0xa60b('0x7'))('rpc');var config=require(_0xa60b('0x8'));var jayson=require(_0xa60b('0x9'));var client=jayson['client'][_0xa60b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x22997f,_0x3ab1aa,_0x25b6eb){return new BPromise(function(_0x4d3155,_0x1690be){return client[_0xa60b('0xb')](_0x22997f,_0x25b6eb)[_0xa60b('0xc')](function(_0x1a61da){logger[_0xa60b('0xd')](_0xa60b('0xe'),_0x3ab1aa,'request\x20sent');logger[_0xa60b('0xf')](_0xa60b('0x10'),_0x3ab1aa,_0xa60b('0x11'),JSON[_0xa60b('0x12')](_0x1a61da));if(_0x1a61da['error']){if(_0x1a61da['error'][_0xa60b('0x13')]===0x1f4){logger[_0xa60b('0x14')](_0xa60b('0xe'),_0x3ab1aa,_0x1a61da['error'][_0xa60b('0x15')]);return _0x1690be(_0x1a61da[_0xa60b('0x14')][_0xa60b('0x15')]);}logger[_0xa60b('0x14')](_0xa60b('0xe'),_0x3ab1aa,_0x1a61da[_0xa60b('0x14')][_0xa60b('0x15')]);return _0x4d3155(_0x1a61da[_0xa60b('0x14')][_0xa60b('0x15')]);}else{logger['info'](_0xa60b('0xe'),_0x3ab1aa,_0xa60b('0x11'));_0x4d3155(_0x1a61da[_0xa60b('0x16')][_0xa60b('0x15')]);}})[_0xa60b('0x17')](function(_0x10f0b4){logger[_0xa60b('0x14')](_0xa60b('0xe'),_0x3ab1aa,_0x10f0b4);_0x1690be(_0x10f0b4);});});}exports['GetSugarcrmAccount']=function(_0x480262){var _0x177d92=this;return new Promise(function(_0x4f70a1,_0x550e2c){return db[_0xa60b('0x18')]['findAll']({'raw':_0x480262[_0xa60b('0x19')]?_0x480262[_0xa60b('0x19')][_0xa60b('0x1a')]===undefined?!![]:![]:!![],'where':_0x480262['options']?_0x480262['options']['where']||null:null,'attributes':_0x480262[_0xa60b('0x19')]?_0x480262['options'][_0xa60b('0x1b')]||null:null,'limit':_0x480262[_0xa60b('0x19')]?_0x480262['options'][_0xa60b('0x1c')]||null:null,'include':_0x480262[_0xa60b('0x19')]?_0x480262[_0xa60b('0x19')][_0xa60b('0x1d')]?_['map'](_0x480262[_0xa60b('0x19')]['include'],function(_0x197ae2){return{'model':db[_0x197ae2[_0xa60b('0x1e')]],'as':_0x197ae2['as'],'attributes':_0x197ae2['attributes'],'include':_0x197ae2['include']?_[_0xa60b('0x1f')](_0x197ae2[_0xa60b('0x1d')],function(_0x593e17){return{'model':db[_0x593e17[_0xa60b('0x1e')]],'as':_0x593e17['as'],'attributes':_0x593e17[_0xa60b('0x1b')],'include':_0x593e17['include']?_['map'](_0x593e17[_0xa60b('0x1d')],function(_0x5a5a13){return{'model':db[_0x5a5a13[_0xa60b('0x1e')]],'as':_0x5a5a13['as'],'attributes':_0x5a5a13['attributes']};}):[]};}):[]};}):[]:[]})[_0xa60b('0xc')](function(_0x50fe45){logger[_0xa60b('0xd')](_0xa60b('0x20'),_0x480262);logger[_0xa60b('0xf')](_0xa60b('0x20'),_0x480262,JSON['stringify'](_0x50fe45));_0x4f70a1(_0x50fe45);})[_0xa60b('0x17')](function(_0x2abe6f){logger[_0xa60b('0x14')](_0xa60b('0x20'),_0x2abe6f[_0xa60b('0x15')],_0x480262);_0x550e2c(_0x177d92[_0xa60b('0x14')](0x1f4,_0x2abe6f[_0xa60b('0x15')]));});});};exports[_0xa60b('0x21')]=function(_0x44b75b){var _0x28ac7b=this;return new Promise(function(_0x2f4b87,_0x24d4b6){return db[_0xa60b('0x18')][_0xa60b('0x22')]({'raw':_0x44b75b[_0xa60b('0x19')]?_0x44b75b[_0xa60b('0x19')][_0xa60b('0x1a')]===undefined?!![]:![]:!![],'where':_0x44b75b[_0xa60b('0x19')]?_0x44b75b['options'][_0xa60b('0x23')]||null:null,'attributes':_0x44b75b[_0xa60b('0x19')]?_0x44b75b['options'][_0xa60b('0x1b')]||null:null,'include':_0x44b75b[_0xa60b('0x19')]?_0x44b75b['options'][_0xa60b('0x1d')]?_[_0xa60b('0x1f')](_0x44b75b[_0xa60b('0x19')][_0xa60b('0x1d')],function(_0x20b694){return{'model':db[_0x20b694[_0xa60b('0x1e')]],'as':_0x20b694['as'],'attributes':_0x20b694[_0xa60b('0x1b')],'include':_0x20b694['include']?_[_0xa60b('0x1f')](_0x20b694[_0xa60b('0x1d')],function(_0x252ae8){return{'model':db[_0x252ae8[_0xa60b('0x1e')]],'as':_0x252ae8['as'],'attributes':_0x252ae8[_0xa60b('0x1b')],'include':_0x252ae8[_0xa60b('0x1d')]?_[_0xa60b('0x1f')](_0x252ae8['include'],function(_0x4995ae){return{'model':db[_0x4995ae['model']],'as':_0x4995ae['as'],'attributes':_0x4995ae[_0xa60b('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x40ffe3){logger[_0xa60b('0xd')]('ShowSugarcrmAccount',_0x44b75b);logger[_0xa60b('0xf')](_0xa60b('0x21'),_0x44b75b,JSON['stringify'](_0x40ffe3));_0x2f4b87(_0x40ffe3);})[_0xa60b('0x17')](function(_0x49d8a9){logger['error'](_0xa60b('0x21'),_0x49d8a9[_0xa60b('0x15')],_0x44b75b);_0x24d4b6(_0x28ac7b[_0xa60b('0x14')](0x1f4,_0x49d8a9['message']));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index 7b3b760..088855c 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 _0x8027=['/:id/descriptions','getDescriptions','post','put','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','/:id/fields','getFields','/:id/subjects'];(function(_0x267c52,_0x3c0df3){var _0x46c47b=function(_0x3c3740){while(--_0x3c3740){_0x267c52['push'](_0x267c52['shift']());}};_0x46c47b(++_0x3c0df3);}(_0x8027,0x91));var _0x7802=function(_0xcb8fde,_0x24399c){_0xcb8fde=_0xcb8fde-0x0;var _0x16dd77=_0x8027[_0xcb8fde];return _0x16dd77;};'use strict';var multer=require(_0x7802('0x0'));var util=require(_0x7802('0x1'));var path=require(_0x7802('0x2'));var timeout=require(_0x7802('0x3'));var express=require('express');var router=express[_0x7802('0x4')]();var fs_extra=require(_0x7802('0x5'));var auth=require(_0x7802('0x6'));var interaction=require(_0x7802('0x7'));var config=require(_0x7802('0x8'));var controller=require('./intSugarcrmConfiguration.controller');router[_0x7802('0x9')]('/',auth['isAuthenticated'](),controller[_0x7802('0xa')]);router[_0x7802('0x9')](_0x7802('0xb'),auth[_0x7802('0xc')](),controller['show']);router[_0x7802('0x9')](_0x7802('0xd'),auth['isAuthenticated'](),controller[_0x7802('0xe')]);router[_0x7802('0x9')](_0x7802('0xf'),auth[_0x7802('0xc')](),controller['getSubjects']);router[_0x7802('0x9')](_0x7802('0x10'),auth[_0x7802('0xc')](),controller[_0x7802('0x11')]);router[_0x7802('0x12')]('/',auth['isAuthenticated'](),controller['create']);router[_0x7802('0x13')](_0x7802('0xb'),auth[_0x7802('0xc')](),controller['update']);router[_0x7802('0x14')]('/:id',auth[_0x7802('0xc')](),controller[_0x7802('0x15')]);module[_0x7802('0x16')]=router; \ No newline at end of file +var _0x17b4=['express','Router','../../components/interaction/service','../../config/environment','./intSugarcrmConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','put','update','delete','destroy','exports','multer','path'];(function(_0x4ebd2f,_0x109629){var _0x1c0650=function(_0xc2a4e9){while(--_0xc2a4e9){_0x4ebd2f['push'](_0x4ebd2f['shift']());}};_0x1c0650(++_0x109629);}(_0x17b4,0x1b6));var _0x417b=function(_0x543084,_0x4337f5){_0x543084=_0x543084-0x0;var _0x306a57=_0x17b4[_0x543084];return _0x306a57;};'use strict';var multer=require(_0x417b('0x0'));var util=require('util');var path=require(_0x417b('0x1'));var timeout=require('connect-timeout');var express=require(_0x417b('0x2'));var router=express[_0x417b('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x417b('0x4'));var config=require(_0x417b('0x5'));var controller=require(_0x417b('0x6'));router[_0x417b('0x7')]('/',auth[_0x417b('0x8')](),controller[_0x417b('0x9')]);router[_0x417b('0x7')](_0x417b('0xa'),auth[_0x417b('0x8')](),controller[_0x417b('0xb')]);router['get'](_0x417b('0xc'),auth[_0x417b('0x8')](),controller[_0x417b('0xd')]);router['get'](_0x417b('0xe'),auth['isAuthenticated'](),controller['getSubjects']);router[_0x417b('0x7')](_0x417b('0xf'),auth[_0x417b('0x8')](),controller[_0x417b('0x10')]);router['post']('/',auth[_0x417b('0x8')](),controller['create']);router[_0x417b('0x11')](_0x417b('0xa'),auth['isAuthenticated'](),controller[_0x417b('0x12')]);router[_0x417b('0x13')](_0x417b('0xa'),auth['isAuthenticated'](),controller[_0x417b('0x14')]);module[_0x417b('0x15')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js index 19fa478..53a13ed 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 _0xc1ca=['STRING','exports'];(function(_0x505919,_0x15ad93){var _0x672df9=function(_0x2ab2e5){while(--_0x2ab2e5){_0x505919['push'](_0x505919['shift']());}};_0x672df9(++_0x15ad93);}(_0xc1ca,0x12f));var _0xac1c=function(_0x42cb3d,_0x2a6b89){_0x42cb3d=_0x42cb3d-0x0;var _0x480c2b=_0xc1ca[_0x42cb3d];return _0x480c2b;};'use strict';var Sequelize=require('sequelize');module[_0xac1c('0x0')]={'name':{'type':Sequelize[_0xac1c('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x05c5=['exports','STRING'];(function(_0x2efccf,_0x6d7311){var _0x433d78=function(_0xc68641){while(--_0xc68641){_0x2efccf['push'](_0x2efccf['shift']());}};_0x433d78(++_0x6d7311);}(_0x05c5,0x198));var _0x505c=function(_0xa69592,_0x571583){_0xa69592=_0xa69592-0x0;var _0x4c5ec5=_0x05c5[_0xa69592];return _0x4c5ec5;};'use strict';var Sequelize=require('sequelize');module[_0x505c('0x0')]={'name':{'type':Sequelize[_0x505c('0x1')]},'description':{'type':Sequelize[_0x505c('0x1')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js index 8386040..c44e1af 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 _0xf717=['show','params','includeAll','find','create','body','getFields','findOne','order','SugarcrmField','getSubjects','getDescriptions','hasOwnProperty','zip-dir','request-promise','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','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','undefined','count','offset','limit','set','Content-Range','apply','update','then','destroy','name','map','SugarcrmConfiguration','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','merge','VIRTUAL','filter','options','include','rows','catch'];(function(_0x540e95,_0x291a4d){var _0x3fc67e=function(_0x2a426e){while(--_0x2a426e){_0x540e95['push'](_0x540e95['shift']());}};_0x3fc67e(++_0x291a4d);}(_0xf717,0x139));var _0x7f71=function(_0x574c48,_0x332df7){_0x574c48=_0x574c48-0x0;var _0x5ed59d=_0xf717[_0x574c48];return _0x5ed59d;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x7f71('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7f71('0x1'));var moment=require('moment');var BPromise=require(_0x7f71('0x2'));var Mustache=require(_0x7f71('0x3'));var util=require(_0x7f71('0x4'));var path=require(_0x7f71('0x5'));var sox=require(_0x7f71('0x6'));var csv=require(_0x7f71('0x7'));var ejs=require(_0x7f71('0x8'));var fs=require('fs');var fs_extra=require(_0x7f71('0x9'));var _=require(_0x7f71('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x7f71('0xb'));var deskjs=require(_0x7f71('0xc'));var toCsv=require(_0x7f71('0x7'));var querystring=require(_0x7f71('0xd'));var Papa=require(_0x7f71('0xe'));var Redis=require(_0x7f71('0xf'));var authService=require(_0x7f71('0x10'));var qs=require(_0x7f71('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7f71('0x12'));var logger=require(_0x7f71('0x13'))(_0x7f71('0x14'));var utils=require(_0x7f71('0x15'));var config=require(_0x7f71('0x16'));var licenseUtil=require(_0x7f71('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x199714,_0x43a1ad){_0x43a1ad=_0x43a1ad||0xcc;return function(_0x371e1f){if(_0x371e1f){return _0x199714[_0x7f71('0x18')](_0x43a1ad);}return _0x199714['status'](_0x43a1ad)[_0x7f71('0x19')]();};}function respondWithResult(_0x2b5c1b,_0x508bf5){_0x508bf5=_0x508bf5||0xc8;return function(_0x21c53d){if(_0x21c53d){return _0x2b5c1b[_0x7f71('0x1a')](_0x508bf5)[_0x7f71('0x1b')](_0x21c53d);}};}function respondWithFilteredResult(_0x418808,_0x35a925){return function(_0x5267ac){if(_0x5267ac){var _0x3dde18=typeof _0x35a925['offset']===_0x7f71('0x1c')&&typeof _0x35a925['limit']===_0x7f71('0x1c');var _0x3479f9=_0x5267ac['count'];var _0x123b4e=_0x3dde18?0x0:_0x35a925['offset'];var _0x2f53f8=_0x3dde18?_0x5267ac[_0x7f71('0x1d')]:_0x35a925[_0x7f71('0x1e')]+_0x35a925[_0x7f71('0x1f')];var _0x59e824;if(_0x2f53f8>=_0x3479f9){_0x2f53f8=_0x3479f9;_0x59e824=0xc8;}else{_0x59e824=0xce;}_0x418808[_0x7f71('0x1a')](_0x59e824);return _0x418808[_0x7f71('0x20')](_0x7f71('0x21'),_0x123b4e+'-'+_0x2f53f8+'/'+_0x3479f9)[_0x7f71('0x1b')](_0x5267ac);}return null;};}function patchUpdates(_0x740441){return function(_0x1739d3){try{jsonpatch[_0x7f71('0x22')](_0x1739d3,_0x740441,!![]);}catch(_0x5185a2){return BPromise['reject'](_0x5185a2);}return _0x1739d3['save']();};}function saveUpdates(_0x13f05c,_0x1ee13d){return function(_0x4eb509){if(_0x4eb509){return _0x4eb509[_0x7f71('0x23')](_0x13f05c)[_0x7f71('0x24')](function(_0x6a8179){return _0x6a8179;});}return null;};}function removeEntity(_0x223569,_0x4cba55){return function(_0x158159){if(_0x158159){return _0x158159[_0x7f71('0x25')]()[_0x7f71('0x24')](function(){_0x223569[_0x7f71('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x313e3c,_0x82338b){return function(_0x22b637){if(!_0x22b637){_0x313e3c['sendStatus'](0x194);}return _0x22b637;};}function handleError(_0x5a4d09,_0x225116){_0x225116=_0x225116||0x1f4;return function(_0xa524d0){logger['error'](_0xa524d0['stack']);if(_0xa524d0[_0x7f71('0x26')]){delete _0xa524d0[_0x7f71('0x26')];}_0x5a4d09[_0x7f71('0x1a')](_0x225116)['send'](_0xa524d0);};}exports['index']=function(_0x129e5b,_0x3342c9){var _0x2618de={},_0x1a1302={},_0x1806f3={'count':0x0,'rows':[]};var _0x5ced35=_[_0x7f71('0x27')](db[_0x7f71('0x28')][_0x7f71('0x29')],function(_0xe3f0d6){return{'name':_0xe3f0d6['fieldName'],'type':_0xe3f0d6[_0x7f71('0x2a')]['key']};});_0x1a1302[_0x7f71('0x2b')]=_[_0x7f71('0x27')](_0x5ced35,_0x7f71('0x26'));_0x1a1302[_0x7f71('0x2c')]=_[_0x7f71('0x2d')](_0x129e5b[_0x7f71('0x2c')]);_0x1a1302[_0x7f71('0x2e')]=_[_0x7f71('0x2f')](_0x1a1302[_0x7f71('0x2b')],_0x1a1302[_0x7f71('0x2c')]);_0x2618de[_0x7f71('0x30')]=_[_0x7f71('0x2f')](_0x1a1302['model'],qs[_0x7f71('0x31')](_0x129e5b[_0x7f71('0x2c')]['fields']));_0x2618de[_0x7f71('0x30')]=_0x2618de[_0x7f71('0x30')][_0x7f71('0x32')]?_0x2618de[_0x7f71('0x30')]:_0x1a1302[_0x7f71('0x2b')];if(!_0x129e5b[_0x7f71('0x2c')]['hasOwnProperty'](_0x7f71('0x33'))){_0x2618de[_0x7f71('0x1f')]=qs[_0x7f71('0x1f')](_0x129e5b[_0x7f71('0x2c')][_0x7f71('0x1f')]);_0x2618de['offset']=qs[_0x7f71('0x1e')](_0x129e5b[_0x7f71('0x2c')][_0x7f71('0x1e')]);}_0x2618de['order']=qs[_0x7f71('0x34')](_0x129e5b[_0x7f71('0x2c')][_0x7f71('0x34')]);_0x2618de[_0x7f71('0x35')]=qs[_0x7f71('0x2e')](_[_0x7f71('0x36')](_0x129e5b[_0x7f71('0x2c')],_0x1a1302[_0x7f71('0x2e')]),_0x5ced35);if(_0x129e5b[_0x7f71('0x2c')]['filter']){_0x2618de[_0x7f71('0x35')]=_[_0x7f71('0x37')](_0x2618de[_0x7f71('0x35')],{'$or':_[_0x7f71('0x27')](_0x5ced35,function(_0x4da925){if(_0x4da925[_0x7f71('0x2a')]!==_0x7f71('0x38')){var _0x521b54={};_0x521b54[_0x4da925[_0x7f71('0x26')]]={'$like':'%'+_0x129e5b[_0x7f71('0x2c')][_0x7f71('0x39')]+'%'};return _0x521b54;}})});}_0x2618de=_['merge']({},_0x2618de,_0x129e5b[_0x7f71('0x3a')]);var _0x2ead66={'where':_0x2618de[_0x7f71('0x35')]};return db[_0x7f71('0x28')][_0x7f71('0x1d')](_0x2ead66)[_0x7f71('0x24')](function(_0xb43bc0){_0x1806f3[_0x7f71('0x1d')]=_0xb43bc0;if(_0x129e5b[_0x7f71('0x2c')]['includeAll']){_0x2618de[_0x7f71('0x3b')]=[{'all':!![]}];}return db[_0x7f71('0x28')]['findAll'](_0x2618de);})['then'](function(_0x577807){_0x1806f3[_0x7f71('0x3c')]=_0x577807;return _0x1806f3;})['then'](respondWithFilteredResult(_0x3342c9,_0x2618de))[_0x7f71('0x3d')](handleError(_0x3342c9,null));};exports[_0x7f71('0x3e')]=function(_0x330967,_0x8e737b){var _0x249bf3={'raw':![],'where':{'id':_0x330967[_0x7f71('0x3f')]['id']}},_0x37a114={};_0x37a114[_0x7f71('0x2b')]=_[_0x7f71('0x2d')](db[_0x7f71('0x28')]['rawAttributes']);_0x37a114[_0x7f71('0x2c')]=_[_0x7f71('0x2d')](_0x330967[_0x7f71('0x2c')]);_0x37a114[_0x7f71('0x2e')]=_[_0x7f71('0x2f')](_0x37a114[_0x7f71('0x2b')],_0x37a114[_0x7f71('0x2c')]);_0x249bf3[_0x7f71('0x30')]=_[_0x7f71('0x2f')](_0x37a114['model'],qs[_0x7f71('0x31')](_0x330967['query'][_0x7f71('0x31')]));_0x249bf3['attributes']=_0x249bf3['attributes'][_0x7f71('0x32')]?_0x249bf3[_0x7f71('0x30')]:_0x37a114[_0x7f71('0x2b')];if(_0x330967[_0x7f71('0x2c')][_0x7f71('0x40')]){_0x249bf3[_0x7f71('0x3b')]=[{'all':!![]}];}_0x249bf3=_[_0x7f71('0x37')]({},_0x249bf3,_0x330967[_0x7f71('0x3a')]);return db['SugarcrmConfiguration'][_0x7f71('0x41')](_0x249bf3)[_0x7f71('0x24')](handleEntityNotFound(_0x8e737b,null))[_0x7f71('0x24')](respondWithResult(_0x8e737b,null))['catch'](handleError(_0x8e737b,null));};exports['create']=function(_0x44300e,_0x5d5612){return db[_0x7f71('0x28')][_0x7f71('0x42')](_0x44300e[_0x7f71('0x43')],{})['then'](respondWithResult(_0x5d5612,0xc9))[_0x7f71('0x3d')](handleError(_0x5d5612,null));};exports[_0x7f71('0x23')]=function(_0x255f99,_0x1e54d4){if(_0x255f99['body']['id']){delete _0x255f99[_0x7f71('0x43')]['id'];}return db[_0x7f71('0x28')][_0x7f71('0x41')]({'where':{'id':_0x255f99[_0x7f71('0x3f')]['id']}})['then'](handleEntityNotFound(_0x1e54d4,null))[_0x7f71('0x24')](saveUpdates(_0x255f99['body'],null))[_0x7f71('0x24')](respondWithResult(_0x1e54d4,null))[_0x7f71('0x3d')](handleError(_0x1e54d4,null));};exports[_0x7f71('0x25')]=function(_0x32cd29,_0x21bbd8){return db[_0x7f71('0x28')][_0x7f71('0x41')]({'where':{'id':_0x32cd29[_0x7f71('0x3f')]['id']}})[_0x7f71('0x24')](handleEntityNotFound(_0x21bbd8,null))[_0x7f71('0x24')](removeEntity(_0x21bbd8,null))[_0x7f71('0x3d')](handleError(_0x21bbd8,null));};exports[_0x7f71('0x44')]=function(_0xc74d2,_0x34beea,_0x148ab4){var _0x413e22={};var _0x138d67={};var _0x49ccd0;var _0x2f7543;return db['SugarcrmConfiguration'][_0x7f71('0x45')]({'where':{'id':_0xc74d2[_0x7f71('0x3f')]['id']}})[_0x7f71('0x24')](handleEntityNotFound(_0x34beea,null))[_0x7f71('0x24')](function(_0x13dc42){if(_0x13dc42){_0x49ccd0=_0x13dc42;_0x138d67['model']=_[_0x7f71('0x2d')](db['SugarcrmField'][_0x7f71('0x29')]);_0x138d67[_0x7f71('0x2c')]=_['keys'](_0xc74d2[_0x7f71('0x2c')]);_0x138d67['filters']=_[_0x7f71('0x2f')](_0x138d67['model'],_0x138d67[_0x7f71('0x2c')]);_0x413e22['attributes']=_[_0x7f71('0x2f')](_0x138d67['model'],qs['fields'](_0xc74d2['query'][_0x7f71('0x31')]));_0x413e22[_0x7f71('0x30')]=_0x413e22[_0x7f71('0x30')][_0x7f71('0x32')]?_0x413e22[_0x7f71('0x30')]:_0x138d67[_0x7f71('0x2b')];_0x413e22[_0x7f71('0x46')]=qs['sort'](_0xc74d2[_0x7f71('0x2c')][_0x7f71('0x34')]);_0x413e22['where']=qs['filters'](_[_0x7f71('0x36')](_0xc74d2[_0x7f71('0x2c')],_0x138d67['filters']));if(_0xc74d2[_0x7f71('0x2c')]['filter']){_0x413e22[_0x7f71('0x35')]=_['merge'](_0x413e22[_0x7f71('0x35')],{'$or':_[_0x7f71('0x27')](_0x413e22[_0x7f71('0x30')],function(_0x300471){var _0x18dc30={};_0x18dc30[_0x300471]={'$like':'%'+_0xc74d2[_0x7f71('0x2c')][_0x7f71('0x39')]+'%'};return _0x18dc30;})});}_0x413e22=_[_0x7f71('0x37')]({},_0x413e22,_0xc74d2[_0x7f71('0x3a')]);return _0x49ccd0['getFields'](_0x413e22);}})[_0x7f71('0x24')](function(_0x5b5f75){if(_0x5b5f75){_0x2f7543=_0x5b5f75[_0x7f71('0x32')];if(!_0xc74d2[_0x7f71('0x2c')]['hasOwnProperty'](_0x7f71('0x33'))){_0x413e22[_0x7f71('0x1f')]=qs[_0x7f71('0x1f')](_0xc74d2[_0x7f71('0x2c')]['limit']);_0x413e22[_0x7f71('0x1e')]=qs[_0x7f71('0x1e')](_0xc74d2[_0x7f71('0x2c')][_0x7f71('0x1e')]);}return _0x49ccd0[_0x7f71('0x44')](_0x413e22);}})['then'](function(_0xa59012){if(_0xa59012){return _0xa59012?{'count':_0x2f7543,'rows':_0xa59012}:null;}})[_0x7f71('0x24')](respondWithResult(_0x34beea,null))[_0x7f71('0x3d')](handleError(_0x34beea,null));};exports['getSubjects']=function(_0x226cfd,_0x27874b,_0x162f73){var _0x3615b1={};var _0x2060f1={};var _0x25ceff;var _0x5a074f;return db[_0x7f71('0x28')][_0x7f71('0x45')]({'where':{'id':_0x226cfd[_0x7f71('0x3f')]['id']}})[_0x7f71('0x24')](handleEntityNotFound(_0x27874b,null))[_0x7f71('0x24')](function(_0x5e8a14){if(_0x5e8a14){_0x25ceff=_0x5e8a14;_0x2060f1[_0x7f71('0x2b')]=_[_0x7f71('0x2d')](db[_0x7f71('0x47')][_0x7f71('0x29')]);_0x2060f1[_0x7f71('0x2c')]=_[_0x7f71('0x2d')](_0x226cfd['query']);_0x2060f1[_0x7f71('0x2e')]=_[_0x7f71('0x2f')](_0x2060f1[_0x7f71('0x2b')],_0x2060f1[_0x7f71('0x2c')]);_0x3615b1[_0x7f71('0x30')]=_[_0x7f71('0x2f')](_0x2060f1[_0x7f71('0x2b')],qs[_0x7f71('0x31')](_0x226cfd[_0x7f71('0x2c')][_0x7f71('0x31')]));_0x3615b1[_0x7f71('0x30')]=_0x3615b1[_0x7f71('0x30')][_0x7f71('0x32')]?_0x3615b1[_0x7f71('0x30')]:_0x2060f1[_0x7f71('0x2b')];_0x3615b1[_0x7f71('0x46')]=qs[_0x7f71('0x34')](_0x226cfd[_0x7f71('0x2c')][_0x7f71('0x34')]);_0x3615b1['where']=qs[_0x7f71('0x2e')](_[_0x7f71('0x36')](_0x226cfd[_0x7f71('0x2c')],_0x2060f1['filters']));if(_0x226cfd[_0x7f71('0x2c')][_0x7f71('0x39')]){_0x3615b1['where']=_[_0x7f71('0x37')](_0x3615b1[_0x7f71('0x35')],{'$or':_[_0x7f71('0x27')](_0x3615b1['attributes'],function(_0x486ecb){var _0x357b48={};_0x357b48[_0x486ecb]={'$like':'%'+_0x226cfd[_0x7f71('0x2c')]['filter']+'%'};return _0x357b48;})});}_0x3615b1=_[_0x7f71('0x37')]({},_0x3615b1,_0x226cfd[_0x7f71('0x3a')]);return _0x25ceff['getSubjects'](_0x3615b1);}})[_0x7f71('0x24')](function(_0x26bfe0){if(_0x26bfe0){_0x5a074f=_0x26bfe0[_0x7f71('0x32')];if(!_0x226cfd[_0x7f71('0x2c')]['hasOwnProperty'](_0x7f71('0x33'))){_0x3615b1['limit']=qs[_0x7f71('0x1f')](_0x226cfd['query']['limit']);_0x3615b1[_0x7f71('0x1e')]=qs[_0x7f71('0x1e')](_0x226cfd['query']['offset']);}return _0x25ceff[_0x7f71('0x48')](_0x3615b1);}})['then'](function(_0x2c88f6){if(_0x2c88f6){return _0x2c88f6?{'count':_0x5a074f,'rows':_0x2c88f6}:null;}})['then'](respondWithResult(_0x27874b,null))[_0x7f71('0x3d')](handleError(_0x27874b,null));};exports[_0x7f71('0x49')]=function(_0x1d0708,_0x2cfc6a,_0x170239){var _0x3e0d80={};var _0x31a459={};var _0x52fa7f;var _0x2d824a;return db[_0x7f71('0x28')][_0x7f71('0x45')]({'where':{'id':_0x1d0708[_0x7f71('0x3f')]['id']}})['then'](handleEntityNotFound(_0x2cfc6a,null))[_0x7f71('0x24')](function(_0x9a842){if(_0x9a842){_0x52fa7f=_0x9a842;_0x31a459[_0x7f71('0x2b')]=_[_0x7f71('0x2d')](db[_0x7f71('0x47')][_0x7f71('0x29')]);_0x31a459[_0x7f71('0x2c')]=_[_0x7f71('0x2d')](_0x1d0708[_0x7f71('0x2c')]);_0x31a459[_0x7f71('0x2e')]=_[_0x7f71('0x2f')](_0x31a459[_0x7f71('0x2b')],_0x31a459[_0x7f71('0x2c')]);_0x3e0d80[_0x7f71('0x30')]=_[_0x7f71('0x2f')](_0x31a459[_0x7f71('0x2b')],qs[_0x7f71('0x31')](_0x1d0708[_0x7f71('0x2c')][_0x7f71('0x31')]));_0x3e0d80[_0x7f71('0x30')]=_0x3e0d80[_0x7f71('0x30')][_0x7f71('0x32')]?_0x3e0d80[_0x7f71('0x30')]:_0x31a459[_0x7f71('0x2b')];_0x3e0d80['order']=qs['sort'](_0x1d0708[_0x7f71('0x2c')][_0x7f71('0x34')]);_0x3e0d80[_0x7f71('0x35')]=qs[_0x7f71('0x2e')](_[_0x7f71('0x36')](_0x1d0708[_0x7f71('0x2c')],_0x31a459[_0x7f71('0x2e')]));if(_0x1d0708[_0x7f71('0x2c')][_0x7f71('0x39')]){_0x3e0d80[_0x7f71('0x35')]=_[_0x7f71('0x37')](_0x3e0d80[_0x7f71('0x35')],{'$or':_[_0x7f71('0x27')](_0x3e0d80[_0x7f71('0x30')],function(_0xc1c12){var _0x10f5d1={};_0x10f5d1[_0xc1c12]={'$like':'%'+_0x1d0708[_0x7f71('0x2c')][_0x7f71('0x39')]+'%'};return _0x10f5d1;})});}_0x3e0d80=_[_0x7f71('0x37')]({},_0x3e0d80,_0x1d0708['options']);return _0x52fa7f['getDescriptions'](_0x3e0d80);}})[_0x7f71('0x24')](function(_0x464b4e){if(_0x464b4e){_0x2d824a=_0x464b4e[_0x7f71('0x32')];if(!_0x1d0708[_0x7f71('0x2c')][_0x7f71('0x4a')](_0x7f71('0x33'))){_0x3e0d80[_0x7f71('0x1f')]=qs[_0x7f71('0x1f')](_0x1d0708[_0x7f71('0x2c')][_0x7f71('0x1f')]);_0x3e0d80[_0x7f71('0x1e')]=qs[_0x7f71('0x1e')](_0x1d0708[_0x7f71('0x2c')]['offset']);}return _0x52fa7f[_0x7f71('0x49')](_0x3e0d80);}})[_0x7f71('0x24')](function(_0x3e5962){if(_0x3e5962){return _0x3e5962?{'count':_0x2d824a,'rows':_0x3e5962}:null;}})['then'](respondWithResult(_0x2cfc6a,null))[_0x7f71('0x3d')](handleError(_0x2cfc6a,null));}; \ No newline at end of file +var _0x12b5=['index','map','SugarcrmConfiguration','fieldName','type','key','model','query','filters','intersection','fields','attributes','hasOwnProperty','order','sort','pick','filter','merge','where','VIRTUAL','options','includeAll','catch','show','params','keys','rawAttributes','length','include','create','body','find','getFields','SugarcrmField','getSubjects','findOne','nolimit','getDescriptions','eml-format','rimraf','zip-dir','request-promise','bluebird','util','path','sox','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send'];(function(_0x101525,_0x31d3e3){var _0x5d5f44=function(_0xd81e33){while(--_0xd81e33){_0x101525['push'](_0x101525['shift']());}};_0x5d5f44(++_0x31d3e3);}(_0x12b5,0xc8));var _0x512b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x12b5[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x512b('0x0'));var rimraf=require(_0x512b('0x1'));var zipdir=require(_0x512b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x512b('0x3'));var moment=require('moment');var BPromise=require(_0x512b('0x4'));var Mustache=require('mustache');var util=require(_0x512b('0x5'));var path=require(_0x512b('0x6'));var sox=require(_0x512b('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x512b('0x8'));var _=require(_0x512b('0x9'));var squel=require(_0x512b('0xa'));var crypto=require('crypto');var jsforce=require(_0x512b('0xb'));var deskjs=require(_0x512b('0xc'));var toCsv=require(_0x512b('0xd'));var querystring=require(_0x512b('0xe'));var Papa=require(_0x512b('0xf'));var Redis=require(_0x512b('0x10'));var authService=require(_0x512b('0x11'));var qs=require(_0x512b('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x512b('0x13'));var logger=require(_0x512b('0x14'))(_0x512b('0x15'));var utils=require(_0x512b('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x512b('0x17'))['db'];function respondWithStatusCode(_0x41310d,_0x49705e){_0x49705e=_0x49705e||0xcc;return function(_0x534041){if(_0x534041){return _0x41310d[_0x512b('0x18')](_0x49705e);}return _0x41310d[_0x512b('0x19')](_0x49705e)[_0x512b('0x1a')]();};}function respondWithResult(_0x45fde6,_0x22dce5){_0x22dce5=_0x22dce5||0xc8;return function(_0x3b2e57){if(_0x3b2e57){return _0x45fde6[_0x512b('0x19')](_0x22dce5)[_0x512b('0x1b')](_0x3b2e57);}};}function respondWithFilteredResult(_0x1ecbab,_0x3a06b6){return function(_0x4d1c96){if(_0x4d1c96){var _0x429c86=typeof _0x3a06b6[_0x512b('0x1c')]==='undefined'&&typeof _0x3a06b6[_0x512b('0x1d')]===_0x512b('0x1e');var _0x5b8f0e=_0x4d1c96[_0x512b('0x1f')];var _0x4fcf3c=_0x429c86?0x0:_0x3a06b6[_0x512b('0x1c')];var _0x64ae02=_0x429c86?_0x4d1c96[_0x512b('0x1f')]:_0x3a06b6['offset']+_0x3a06b6[_0x512b('0x1d')];var _0x15f114;if(_0x64ae02>=_0x5b8f0e){_0x64ae02=_0x5b8f0e;_0x15f114=0xc8;}else{_0x15f114=0xce;}_0x1ecbab['status'](_0x15f114);return _0x1ecbab[_0x512b('0x20')](_0x512b('0x21'),_0x4fcf3c+'-'+_0x64ae02+'/'+_0x5b8f0e)[_0x512b('0x1b')](_0x4d1c96);}return null;};}function patchUpdates(_0x56300b){return function(_0x3dfd60){try{jsonpatch['apply'](_0x3dfd60,_0x56300b,!![]);}catch(_0x27ff97){return BPromise[_0x512b('0x22')](_0x27ff97);}return _0x3dfd60[_0x512b('0x23')]();};}function saveUpdates(_0x28bca3,_0x155da1){return function(_0x164be3){if(_0x164be3){return _0x164be3[_0x512b('0x24')](_0x28bca3)[_0x512b('0x25')](function(_0x362f2c){return _0x362f2c;});}return null;};}function removeEntity(_0x1bcdaa,_0x27ef9f){return function(_0x2644dd){if(_0x2644dd){return _0x2644dd[_0x512b('0x26')]()['then'](function(){_0x1bcdaa[_0x512b('0x19')](0xcc)[_0x512b('0x1a')]();});}};}function handleEntityNotFound(_0xbc9d28,_0x4af69c){return function(_0x24c88e){if(!_0x24c88e){_0xbc9d28[_0x512b('0x18')](0x194);}return _0x24c88e;};}function handleError(_0xa177e7,_0x48f9ea){_0x48f9ea=_0x48f9ea||0x1f4;return function(_0x47111c){logger[_0x512b('0x27')](_0x47111c[_0x512b('0x28')]);if(_0x47111c[_0x512b('0x29')]){delete _0x47111c[_0x512b('0x29')];}_0xa177e7[_0x512b('0x19')](_0x48f9ea)[_0x512b('0x2a')](_0x47111c);};}exports[_0x512b('0x2b')]=function(_0x1b5f50,_0xa64db){var _0x520d5f={},_0x36ac37={},_0x393494={'count':0x0,'rows':[]};var _0x42fa2e=_[_0x512b('0x2c')](db[_0x512b('0x2d')]['rawAttributes'],function(_0x14d0f8){return{'name':_0x14d0f8[_0x512b('0x2e')],'type':_0x14d0f8[_0x512b('0x2f')][_0x512b('0x30')]};});_0x36ac37[_0x512b('0x31')]=_[_0x512b('0x2c')](_0x42fa2e,_0x512b('0x29'));_0x36ac37[_0x512b('0x32')]=_['keys'](_0x1b5f50[_0x512b('0x32')]);_0x36ac37[_0x512b('0x33')]=_[_0x512b('0x34')](_0x36ac37['model'],_0x36ac37[_0x512b('0x32')]);_0x520d5f['attributes']=_[_0x512b('0x34')](_0x36ac37[_0x512b('0x31')],qs[_0x512b('0x35')](_0x1b5f50[_0x512b('0x32')]['fields']));_0x520d5f[_0x512b('0x36')]=_0x520d5f['attributes']['length']?_0x520d5f[_0x512b('0x36')]:_0x36ac37[_0x512b('0x31')];if(!_0x1b5f50['query'][_0x512b('0x37')]('nolimit')){_0x520d5f['limit']=qs[_0x512b('0x1d')](_0x1b5f50[_0x512b('0x32')]['limit']);_0x520d5f[_0x512b('0x1c')]=qs['offset'](_0x1b5f50['query'][_0x512b('0x1c')]);}_0x520d5f[_0x512b('0x38')]=qs[_0x512b('0x39')](_0x1b5f50[_0x512b('0x32')][_0x512b('0x39')]);_0x520d5f['where']=qs[_0x512b('0x33')](_[_0x512b('0x3a')](_0x1b5f50[_0x512b('0x32')],_0x36ac37[_0x512b('0x33')]),_0x42fa2e);if(_0x1b5f50['query'][_0x512b('0x3b')]){_0x520d5f['where']=_[_0x512b('0x3c')](_0x520d5f[_0x512b('0x3d')],{'$or':_[_0x512b('0x2c')](_0x42fa2e,function(_0x28cfad){if(_0x28cfad[_0x512b('0x2f')]!==_0x512b('0x3e')){var _0x530c62={};_0x530c62[_0x28cfad['name']]={'$like':'%'+_0x1b5f50['query']['filter']+'%'};return _0x530c62;}})});}_0x520d5f=_[_0x512b('0x3c')]({},_0x520d5f,_0x1b5f50[_0x512b('0x3f')]);var _0x4293e5={'where':_0x520d5f[_0x512b('0x3d')]};return db[_0x512b('0x2d')][_0x512b('0x1f')](_0x4293e5)[_0x512b('0x25')](function(_0x415122){_0x393494[_0x512b('0x1f')]=_0x415122;if(_0x1b5f50[_0x512b('0x32')][_0x512b('0x40')]){_0x520d5f['include']=[{'all':!![]}];}return db[_0x512b('0x2d')]['findAll'](_0x520d5f);})[_0x512b('0x25')](function(_0xfb18db){_0x393494['rows']=_0xfb18db;return _0x393494;})[_0x512b('0x25')](respondWithFilteredResult(_0xa64db,_0x520d5f))[_0x512b('0x41')](handleError(_0xa64db,null));};exports[_0x512b('0x42')]=function(_0x3277f2,_0x22694e){var _0x277381={'raw':![],'where':{'id':_0x3277f2[_0x512b('0x43')]['id']}},_0x289c68={};_0x289c68['model']=_[_0x512b('0x44')](db['SugarcrmConfiguration'][_0x512b('0x45')]);_0x289c68[_0x512b('0x32')]=_[_0x512b('0x44')](_0x3277f2['query']);_0x289c68[_0x512b('0x33')]=_['intersection'](_0x289c68[_0x512b('0x31')],_0x289c68[_0x512b('0x32')]);_0x277381[_0x512b('0x36')]=_['intersection'](_0x289c68[_0x512b('0x31')],qs[_0x512b('0x35')](_0x3277f2[_0x512b('0x32')]['fields']));_0x277381['attributes']=_0x277381['attributes'][_0x512b('0x46')]?_0x277381[_0x512b('0x36')]:_0x289c68[_0x512b('0x31')];if(_0x3277f2[_0x512b('0x32')][_0x512b('0x40')]){_0x277381[_0x512b('0x47')]=[{'all':!![]}];}_0x277381=_[_0x512b('0x3c')]({},_0x277381,_0x3277f2['options']);return db[_0x512b('0x2d')]['find'](_0x277381)['then'](handleEntityNotFound(_0x22694e,null))[_0x512b('0x25')](respondWithResult(_0x22694e,null))[_0x512b('0x41')](handleError(_0x22694e,null));};exports[_0x512b('0x48')]=function(_0x2f6ff9,_0x31ca81){return db[_0x512b('0x2d')]['create'](_0x2f6ff9[_0x512b('0x49')],{})[_0x512b('0x25')](respondWithResult(_0x31ca81,0xc9))[_0x512b('0x41')](handleError(_0x31ca81,null));};exports[_0x512b('0x24')]=function(_0x15a564,_0xb88610){if(_0x15a564[_0x512b('0x49')]['id']){delete _0x15a564[_0x512b('0x49')]['id'];}return db[_0x512b('0x2d')][_0x512b('0x4a')]({'where':{'id':_0x15a564[_0x512b('0x43')]['id']}})[_0x512b('0x25')](handleEntityNotFound(_0xb88610,null))['then'](saveUpdates(_0x15a564[_0x512b('0x49')],null))[_0x512b('0x25')](respondWithResult(_0xb88610,null))[_0x512b('0x41')](handleError(_0xb88610,null));};exports[_0x512b('0x26')]=function(_0x58fdaa,_0x45162c){return db[_0x512b('0x2d')][_0x512b('0x4a')]({'where':{'id':_0x58fdaa[_0x512b('0x43')]['id']}})[_0x512b('0x25')](handleEntityNotFound(_0x45162c,null))[_0x512b('0x25')](removeEntity(_0x45162c,null))['catch'](handleError(_0x45162c,null));};exports[_0x512b('0x4b')]=function(_0x3157ee,_0x162a01,_0x2db32a){var _0x3035fb={};var _0x5e0a20={};var _0x45c817;var _0x2398f6;return db[_0x512b('0x2d')]['findOne']({'where':{'id':_0x3157ee[_0x512b('0x43')]['id']}})[_0x512b('0x25')](handleEntityNotFound(_0x162a01,null))['then'](function(_0x56186f){if(_0x56186f){_0x45c817=_0x56186f;_0x5e0a20[_0x512b('0x31')]=_[_0x512b('0x44')](db[_0x512b('0x4c')][_0x512b('0x45')]);_0x5e0a20[_0x512b('0x32')]=_[_0x512b('0x44')](_0x3157ee[_0x512b('0x32')]);_0x5e0a20[_0x512b('0x33')]=_[_0x512b('0x34')](_0x5e0a20[_0x512b('0x31')],_0x5e0a20['query']);_0x3035fb[_0x512b('0x36')]=_['intersection'](_0x5e0a20['model'],qs['fields'](_0x3157ee[_0x512b('0x32')][_0x512b('0x35')]));_0x3035fb[_0x512b('0x36')]=_0x3035fb['attributes']['length']?_0x3035fb[_0x512b('0x36')]:_0x5e0a20[_0x512b('0x31')];_0x3035fb[_0x512b('0x38')]=qs['sort'](_0x3157ee[_0x512b('0x32')][_0x512b('0x39')]);_0x3035fb['where']=qs[_0x512b('0x33')](_['pick'](_0x3157ee[_0x512b('0x32')],_0x5e0a20[_0x512b('0x33')]));if(_0x3157ee['query'][_0x512b('0x3b')]){_0x3035fb[_0x512b('0x3d')]=_[_0x512b('0x3c')](_0x3035fb[_0x512b('0x3d')],{'$or':_[_0x512b('0x2c')](_0x3035fb['attributes'],function(_0x1c063a){var _0x276f5c={};_0x276f5c[_0x1c063a]={'$like':'%'+_0x3157ee[_0x512b('0x32')]['filter']+'%'};return _0x276f5c;})});}_0x3035fb=_[_0x512b('0x3c')]({},_0x3035fb,_0x3157ee['options']);return _0x45c817[_0x512b('0x4b')](_0x3035fb);}})[_0x512b('0x25')](function(_0x46111b){if(_0x46111b){_0x2398f6=_0x46111b[_0x512b('0x46')];if(!_0x3157ee[_0x512b('0x32')]['hasOwnProperty']('nolimit')){_0x3035fb['limit']=qs[_0x512b('0x1d')](_0x3157ee[_0x512b('0x32')]['limit']);_0x3035fb['offset']=qs[_0x512b('0x1c')](_0x3157ee[_0x512b('0x32')][_0x512b('0x1c')]);}return _0x45c817['getFields'](_0x3035fb);}})[_0x512b('0x25')](function(_0x433c4c){if(_0x433c4c){return _0x433c4c?{'count':_0x2398f6,'rows':_0x433c4c}:null;}})[_0x512b('0x25')](respondWithResult(_0x162a01,null))[_0x512b('0x41')](handleError(_0x162a01,null));};exports[_0x512b('0x4d')]=function(_0x3f7c71,_0x465279,_0x5b7a69){var _0x37bf39={};var _0x1e61d9={};var _0x740bea;var _0x1d0051;return db['SugarcrmConfiguration'][_0x512b('0x4e')]({'where':{'id':_0x3f7c71['params']['id']}})[_0x512b('0x25')](handleEntityNotFound(_0x465279,null))[_0x512b('0x25')](function(_0x128cdd){if(_0x128cdd){_0x740bea=_0x128cdd;_0x1e61d9[_0x512b('0x31')]=_['keys'](db[_0x512b('0x4c')][_0x512b('0x45')]);_0x1e61d9['query']=_[_0x512b('0x44')](_0x3f7c71[_0x512b('0x32')]);_0x1e61d9['filters']=_[_0x512b('0x34')](_0x1e61d9['model'],_0x1e61d9['query']);_0x37bf39['attributes']=_[_0x512b('0x34')](_0x1e61d9['model'],qs[_0x512b('0x35')](_0x3f7c71[_0x512b('0x32')]['fields']));_0x37bf39[_0x512b('0x36')]=_0x37bf39[_0x512b('0x36')]['length']?_0x37bf39[_0x512b('0x36')]:_0x1e61d9['model'];_0x37bf39[_0x512b('0x38')]=qs[_0x512b('0x39')](_0x3f7c71[_0x512b('0x32')][_0x512b('0x39')]);_0x37bf39[_0x512b('0x3d')]=qs[_0x512b('0x33')](_[_0x512b('0x3a')](_0x3f7c71[_0x512b('0x32')],_0x1e61d9[_0x512b('0x33')]));if(_0x3f7c71['query'][_0x512b('0x3b')]){_0x37bf39['where']=_[_0x512b('0x3c')](_0x37bf39[_0x512b('0x3d')],{'$or':_[_0x512b('0x2c')](_0x37bf39[_0x512b('0x36')],function(_0x3be517){var _0x534575={};_0x534575[_0x3be517]={'$like':'%'+_0x3f7c71['query'][_0x512b('0x3b')]+'%'};return _0x534575;})});}_0x37bf39=_[_0x512b('0x3c')]({},_0x37bf39,_0x3f7c71['options']);return _0x740bea[_0x512b('0x4d')](_0x37bf39);}})[_0x512b('0x25')](function(_0x19434a){if(_0x19434a){_0x1d0051=_0x19434a[_0x512b('0x46')];if(!_0x3f7c71[_0x512b('0x32')][_0x512b('0x37')](_0x512b('0x4f'))){_0x37bf39[_0x512b('0x1d')]=qs[_0x512b('0x1d')](_0x3f7c71[_0x512b('0x32')][_0x512b('0x1d')]);_0x37bf39[_0x512b('0x1c')]=qs['offset'](_0x3f7c71[_0x512b('0x32')][_0x512b('0x1c')]);}return _0x740bea[_0x512b('0x4d')](_0x37bf39);}})[_0x512b('0x25')](function(_0x23cb45){if(_0x23cb45){return _0x23cb45?{'count':_0x1d0051,'rows':_0x23cb45}:null;}})[_0x512b('0x25')](respondWithResult(_0x465279,null))[_0x512b('0x41')](handleError(_0x465279,null));};exports['getDescriptions']=function(_0x151489,_0x5a483e,_0x2dcdc3){var _0x4eb5f1={};var _0xbbdbba={};var _0x13f246;var _0x38d2e3;return db['SugarcrmConfiguration'][_0x512b('0x4e')]({'where':{'id':_0x151489[_0x512b('0x43')]['id']}})[_0x512b('0x25')](handleEntityNotFound(_0x5a483e,null))[_0x512b('0x25')](function(_0x343f6a){if(_0x343f6a){_0x13f246=_0x343f6a;_0xbbdbba[_0x512b('0x31')]=_[_0x512b('0x44')](db['SugarcrmField'][_0x512b('0x45')]);_0xbbdbba[_0x512b('0x32')]=_['keys'](_0x151489[_0x512b('0x32')]);_0xbbdbba[_0x512b('0x33')]=_[_0x512b('0x34')](_0xbbdbba[_0x512b('0x31')],_0xbbdbba['query']);_0x4eb5f1[_0x512b('0x36')]=_['intersection'](_0xbbdbba[_0x512b('0x31')],qs[_0x512b('0x35')](_0x151489[_0x512b('0x32')][_0x512b('0x35')]));_0x4eb5f1[_0x512b('0x36')]=_0x4eb5f1['attributes'][_0x512b('0x46')]?_0x4eb5f1[_0x512b('0x36')]:_0xbbdbba[_0x512b('0x31')];_0x4eb5f1['order']=qs[_0x512b('0x39')](_0x151489[_0x512b('0x32')]['sort']);_0x4eb5f1[_0x512b('0x3d')]=qs['filters'](_[_0x512b('0x3a')](_0x151489[_0x512b('0x32')],_0xbbdbba[_0x512b('0x33')]));if(_0x151489['query'][_0x512b('0x3b')]){_0x4eb5f1[_0x512b('0x3d')]=_[_0x512b('0x3c')](_0x4eb5f1[_0x512b('0x3d')],{'$or':_[_0x512b('0x2c')](_0x4eb5f1['attributes'],function(_0x1f9a9a){var _0x408a7a={};_0x408a7a[_0x1f9a9a]={'$like':'%'+_0x151489[_0x512b('0x32')]['filter']+'%'};return _0x408a7a;})});}_0x4eb5f1=_[_0x512b('0x3c')]({},_0x4eb5f1,_0x151489['options']);return _0x13f246[_0x512b('0x50')](_0x4eb5f1);}})[_0x512b('0x25')](function(_0xfa6c63){if(_0xfa6c63){_0x38d2e3=_0xfa6c63[_0x512b('0x46')];if(!_0x151489['query'][_0x512b('0x37')](_0x512b('0x4f'))){_0x4eb5f1[_0x512b('0x1d')]=qs[_0x512b('0x1d')](_0x151489[_0x512b('0x32')][_0x512b('0x1d')]);_0x4eb5f1[_0x512b('0x1c')]=qs[_0x512b('0x1c')](_0x151489[_0x512b('0x32')][_0x512b('0x1c')]);}return _0x13f246['getDescriptions'](_0x4eb5f1);}})[_0x512b('0x25')](function(_0x35f016){if(_0x35f016){return _0x35f016?{'count':_0x38d2e3,'rows':_0x35f016}:null;}})[_0x512b('0x25')](respondWithResult(_0x5a483e,null))[_0x512b('0x41')](handleError(_0x5a483e,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index 18c8751..6818758 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 _0x9d28=['SugarcrmConfiguration','int_sugarcrm_configurations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intSugarcrmConfiguration.attributes','exports','define'];(function(_0x2766b4,_0xb9c42c){var _0x3c72ba=function(_0x3c4117){while(--_0x3c4117){_0x2766b4['push'](_0x2766b4['shift']());}};_0x3c72ba(++_0xb9c42c);}(_0x9d28,0x89));var _0x89d2=function(_0x3c414c,_0x399dbb){_0x3c414c=_0x3c414c-0x0;var _0x4f3062=_0x9d28[_0x3c414c];return _0x4f3062;};'use strict';var _=require(_0x89d2('0x0'));var util=require(_0x89d2('0x1'));var logger=require(_0x89d2('0x2'))(_0x89d2('0x3'));var moment=require(_0x89d2('0x4'));var BPromise=require(_0x89d2('0x5'));var rp=require(_0x89d2('0x6'));var fs=require('fs');var path=require(_0x89d2('0x7'));var rimraf=require(_0x89d2('0x8'));var config=require(_0x89d2('0x9'));var attributes=require(_0x89d2('0xa'));module[_0x89d2('0xb')]=function(_0x1358dd,_0x4d9d4f){return _0x1358dd[_0x89d2('0xc')](_0x89d2('0xd'),attributes,{'tableName':_0x89d2('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa6d8=['moment','request-promise','path','../../config/environment','./intSugarcrmConfiguration.attributes','exports','SugarcrmConfiguration','int_sugarcrm_configurations','util'];(function(_0x15d4c4,_0xff0966){var _0x1da308=function(_0x4f4772){while(--_0x4f4772){_0x15d4c4['push'](_0x15d4c4['shift']());}};_0x1da308(++_0xff0966);}(_0xa6d8,0x1dc));var _0x8a6d=function(_0x7d78f,_0x22d980){_0x7d78f=_0x7d78f-0x0;var _0x1005c3=_0xa6d8[_0x7d78f];return _0x1005c3;};'use strict';var _=require('lodash');var util=require(_0x8a6d('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x8a6d('0x1'));var BPromise=require('bluebird');var rp=require(_0x8a6d('0x2'));var fs=require('fs');var path=require(_0x8a6d('0x3'));var rimraf=require('rimraf');var config=require(_0x8a6d('0x4'));var attributes=require(_0x8a6d('0x5'));module[_0x8a6d('0x6')]=function(_0x3e9bb4,_0xc279c9){return _0x3e9bb4['define'](_0x8a6d('0x7'),attributes,{'tableName':_0x8a6d('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.rpc.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.rpc.js index 3a48e7d..fa2716f 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 _0x1bf3=['catch','util','moment','randomstring','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x1d5426,_0xc7bc4e){var _0x54fed9=function(_0x423eec){while(--_0x423eec){_0x1d5426['push'](_0x1d5426['shift']());}};_0x54fed9(++_0xc7bc4e);}(_0x1bf3,0x7f));var _0x31bf=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x1bf3[_0x59ee6f];return _0x4c0979;};'use strict';var _=require('lodash');var util=require(_0x31bf('0x0'));var moment=require(_0x31bf('0x1'));var BPromise=require('bluebird');var rs=require(_0x31bf('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x31bf('0x3'))(_0x31bf('0x4'));var config=require(_0x31bf('0x5'));var jayson=require(_0x31bf('0x6'));var client=jayson[_0x31bf('0x7')][_0x31bf('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x62ea56,_0x5a2341,_0x2b34c9){return new BPromise(function(_0x59b448,_0x2d688c){return client[_0x31bf('0x9')](_0x62ea56,_0x2b34c9)['then'](function(_0x2c05b3){logger[_0x31bf('0xa')](_0x31bf('0xb'),_0x5a2341,_0x31bf('0xc'));logger[_0x31bf('0xd')](_0x31bf('0xe'),_0x5a2341,_0x31bf('0xc'),JSON[_0x31bf('0xf')](_0x2c05b3));if(_0x2c05b3[_0x31bf('0x10')]){if(_0x2c05b3[_0x31bf('0x10')][_0x31bf('0x11')]===0x1f4){logger[_0x31bf('0x10')](_0x31bf('0xb'),_0x5a2341,_0x2c05b3['error'][_0x31bf('0x12')]);return _0x2d688c(_0x2c05b3[_0x31bf('0x10')]['message']);}logger[_0x31bf('0x10')](_0x31bf('0xb'),_0x5a2341,_0x2c05b3[_0x31bf('0x10')][_0x31bf('0x12')]);return _0x59b448(_0x2c05b3[_0x31bf('0x10')][_0x31bf('0x12')]);}else{logger[_0x31bf('0xa')](_0x31bf('0xb'),_0x5a2341,_0x31bf('0xc'));_0x59b448(_0x2c05b3[_0x31bf('0x13')][_0x31bf('0x12')]);}})[_0x31bf('0x14')](function(_0x121fb8){logger['error'](_0x31bf('0xb'),_0x5a2341,_0x121fb8);_0x2d688c(_0x121fb8);});});} \ No newline at end of file +var _0xdae4=['error','message','result','catch','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','info','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x92c450,_0x41f1e3){var _0x2a9599=function(_0x4f27df){while(--_0x4f27df){_0x92c450['push'](_0x92c450['shift']());}};_0x2a9599(++_0x41f1e3);}(_0xdae4,0x10e));var _0x4dae=function(_0x948d2f,_0x56b6f7){_0x948d2f=_0x948d2f-0x0;var _0x39984a=_0xdae4[_0x948d2f];return _0x39984a;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x4dae('0x0'));var BPromise=require(_0x4dae('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4dae('0x2'))['db'];var utils=require(_0x4dae('0x3'));var logger=require(_0x4dae('0x4'))(_0x4dae('0x5'));var config=require('../../config/environment');var jayson=require(_0x4dae('0x6'));var client=jayson['client'][_0x4dae('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x3f204e,_0x23432c,_0x23c803){return new BPromise(function(_0x4db7c4,_0x1a03b1){return client[_0x4dae('0x8')](_0x3f204e,_0x23c803)['then'](function(_0xbf02dc){logger[_0x4dae('0x9')](_0x4dae('0xa'),_0x23432c,_0x4dae('0xb'));logger[_0x4dae('0xc')](_0x4dae('0xd'),_0x23432c,_0x4dae('0xb'),JSON[_0x4dae('0xe')](_0xbf02dc));if(_0xbf02dc[_0x4dae('0xf')]){if(_0xbf02dc['error']['code']===0x1f4){logger[_0x4dae('0xf')](_0x4dae('0xa'),_0x23432c,_0xbf02dc[_0x4dae('0xf')][_0x4dae('0x10')]);return _0x1a03b1(_0xbf02dc[_0x4dae('0xf')]['message']);}logger['error'](_0x4dae('0xa'),_0x23432c,_0xbf02dc[_0x4dae('0xf')][_0x4dae('0x10')]);return _0x4db7c4(_0xbf02dc[_0x4dae('0xf')][_0x4dae('0x10')]);}else{logger[_0x4dae('0x9')](_0x4dae('0xa'),_0x23432c,_0x4dae('0xb'));_0x4db7c4(_0xbf02dc[_0x4dae('0x11')][_0x4dae('0x10')]);}})[_0x4dae('0x12')](function(_0x22e191){logger[_0x4dae('0xf')](_0x4dae('0xa'),_0x23432c,_0x22e191);_0x1a03b1(_0x22e191);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index 79dcd04..da2dbf3 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 _0x1d7a=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmField.controller','isAuthenticated','index','get','/:id','show','create','put','update','delete','exports','multer','util','path','connect-timeout'];(function(_0x44f974,_0x4db616){var _0x805dbd=function(_0x1a56b7){while(--_0x1a56b7){_0x44f974['push'](_0x44f974['shift']());}};_0x805dbd(++_0x4db616);}(_0x1d7a,0x176));var _0xa1d7=function(_0x191c44,_0x20a896){_0x191c44=_0x191c44-0x0;var _0x1086cd=_0x1d7a[_0x191c44];return _0x1086cd;};'use strict';var multer=require(_0xa1d7('0x0'));var util=require(_0xa1d7('0x1'));var path=require(_0xa1d7('0x2'));var timeout=require(_0xa1d7('0x3'));var express=require(_0xa1d7('0x4'));var router=express[_0xa1d7('0x5')]();var fs_extra=require(_0xa1d7('0x6'));var auth=require(_0xa1d7('0x7'));var interaction=require(_0xa1d7('0x8'));var config=require(_0xa1d7('0x9'));var controller=require(_0xa1d7('0xa'));router['get']('/',auth[_0xa1d7('0xb')](),controller[_0xa1d7('0xc')]);router[_0xa1d7('0xd')](_0xa1d7('0xe'),auth[_0xa1d7('0xb')](),controller[_0xa1d7('0xf')]);router['post']('/',auth[_0xa1d7('0xb')](),controller[_0xa1d7('0x10')]);router[_0xa1d7('0x11')](_0xa1d7('0xe'),auth['isAuthenticated'](),controller[_0xa1d7('0x12')]);router[_0xa1d7('0x13')]('/:id',auth[_0xa1d7('0xb')](),controller['destroy']);module[_0xa1d7('0x14')]=router; \ No newline at end of file +var _0x21f2=['get','isAuthenticated','index','show','put','/:id','update','delete','destroy','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','./intSugarcrmField.controller'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x21f2,0x108));var _0x221f=function(_0x4ae586,_0x30a323){_0x4ae586=_0x4ae586-0x0;var _0x231890=_0x21f2[_0x4ae586];return _0x231890;};'use strict';var multer=require(_0x221f('0x0'));var util=require(_0x221f('0x1'));var path=require(_0x221f('0x2'));var timeout=require(_0x221f('0x3'));var express=require(_0x221f('0x4'));var router=express['Router']();var fs_extra=require(_0x221f('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x221f('0x6'));var config=require('../../config/environment');var controller=require(_0x221f('0x7'));router[_0x221f('0x8')]('/',auth[_0x221f('0x9')](),controller[_0x221f('0xa')]);router[_0x221f('0x8')]('/:id',auth[_0x221f('0x9')](),controller[_0x221f('0xb')]);router['post']('/',auth[_0x221f('0x9')](),controller['create']);router[_0x221f('0xc')](_0x221f('0xd'),auth[_0x221f('0x9')](),controller[_0x221f('0xe')]);router[_0x221f('0xf')](_0x221f('0xd'),auth[_0x221f('0x9')](),controller[_0x221f('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.attributes.js b/server/api/intSugarcrmField/intSugarcrmField.attributes.js index 956f0c5..881b547 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 _0xb144=['variable','customVariable','picklist','string','STRING','BOOLEAN','sequelize','exports','ENUM'];(function(_0x477fa5,_0x33837d){var _0x30e4a4=function(_0x151b4a){while(--_0x151b4a){_0x477fa5['push'](_0x477fa5['shift']());}};_0x30e4a4(++_0x33837d);}(_0xb144,0x16e));var _0x4b14=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xb144[_0x122ef9];return _0x42fba0;};'use strict';var Sequelize=require(_0x4b14('0x0'));module[_0x4b14('0x1')]={'type':{'type':Sequelize[_0x4b14('0x2')]('string',_0x4b14('0x3'),_0x4b14('0x4'),'keyValue',_0x4b14('0x5')),'defaultValue':_0x4b14('0x6')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x4b14('0x7')]},'keyType':{'type':Sequelize['ENUM'](_0x4b14('0x6'),'variable',_0x4b14('0x4'))},'keyContent':{'type':Sequelize[_0x4b14('0x7')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x4b14('0x7')]},'customField':{'type':Sequelize[_0x4b14('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x4b14('0x7')]}}; \ No newline at end of file +var _0xe48f=['string','customVariable','keyValue','picklist','STRING','variable','BOOLEAN','sequelize','exports','ENUM'];(function(_0xad9a4b,_0x16468d){var _0x1d044a=function(_0x13f82d){while(--_0x13f82d){_0xad9a4b['push'](_0xad9a4b['shift']());}};_0x1d044a(++_0x16468d);}(_0xe48f,0x16f));var _0xfe48=function(_0x5cbb32,_0x233ace){_0x5cbb32=_0x5cbb32-0x0;var _0x49363c=_0xe48f[_0x5cbb32];return _0x49363c;};'use strict';var Sequelize=require(_0xfe48('0x0'));module[_0xfe48('0x1')]={'type':{'type':Sequelize[_0xfe48('0x2')](_0xfe48('0x3'),'variable',_0xfe48('0x4'),_0xfe48('0x5'),_0xfe48('0x6')),'defaultValue':'string'},'content':{'type':Sequelize[_0xfe48('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xfe48('0x2')](_0xfe48('0x3'),_0xfe48('0x8'),'customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xfe48('0x7')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xfe48('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xfe48('0x7')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.controller.js b/server/api/intSugarcrmField/intSugarcrmField.controller.js index e3754a7..771cfcd 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 _0x6a6e=['length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','include','rows','catch','show','rawAttributes','includeAll','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','limit','undefined','count','set','apply','reject','update','then','destroy','sendStatus','error','stack','name','send','index','map','SugarcrmField','fieldName','type','key','model','query','filters','intersection','fields','attributes'];(function(_0x861e02,_0x33f772){var _0x48fc24=function(_0x21b4d3){while(--_0x21b4d3){_0x861e02['push'](_0x861e02['shift']());}};_0x48fc24(++_0x33f772);}(_0x6a6e,0xa7));var _0xe6a6=function(_0x3c7e74,_0x431a67){_0x3c7e74=_0x3c7e74-0x0;var _0x5e7924=_0x6a6e[_0x3c7e74];return _0x5e7924;};'use strict';var emlformat=require(_0xe6a6('0x0'));var rimraf=require(_0xe6a6('0x1'));var zipdir=require(_0xe6a6('0x2'));var jsonpatch=require(_0xe6a6('0x3'));var rp=require(_0xe6a6('0x4'));var moment=require(_0xe6a6('0x5'));var BPromise=require(_0xe6a6('0x6'));var Mustache=require('mustache');var util=require(_0xe6a6('0x7'));var path=require(_0xe6a6('0x8'));var sox=require('sox');var csv=require(_0xe6a6('0x9'));var ejs=require(_0xe6a6('0xa'));var fs=require('fs');var fs_extra=require(_0xe6a6('0xb'));var _=require(_0xe6a6('0xc'));var squel=require(_0xe6a6('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xe6a6('0xe'));var toCsv=require(_0xe6a6('0x9'));var querystring=require(_0xe6a6('0xf'));var Papa=require('papaparse');var Redis=require(_0xe6a6('0x10'));var authService=require(_0xe6a6('0x11'));var qs=require(_0xe6a6('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe6a6('0x13'));var logger=require(_0xe6a6('0x14'))('api');var utils=require(_0xe6a6('0x15'));var config=require(_0xe6a6('0x16'));var licenseUtil=require(_0xe6a6('0x17'));var db=require(_0xe6a6('0x18'))['db'];function respondWithStatusCode(_0x58a7bf,_0x3e2058){_0x3e2058=_0x3e2058||0xcc;return function(_0x5dd0cc){if(_0x5dd0cc){return _0x58a7bf['sendStatus'](_0x3e2058);}return _0x58a7bf[_0xe6a6('0x19')](_0x3e2058)[_0xe6a6('0x1a')]();};}function respondWithResult(_0xf17f41,_0x518d74){_0x518d74=_0x518d74||0xc8;return function(_0x2e1122){if(_0x2e1122){return _0xf17f41[_0xe6a6('0x19')](_0x518d74)[_0xe6a6('0x1b')](_0x2e1122);}};}function respondWithFilteredResult(_0x3f0df8,_0x514dd8){return function(_0x3254af){if(_0x3254af){var _0x11c28b=typeof _0x514dd8[_0xe6a6('0x1c')]==='undefined'&&typeof _0x514dd8[_0xe6a6('0x1d')]===_0xe6a6('0x1e');var _0x305ab7=_0x3254af[_0xe6a6('0x1f')];var _0x1a4967=_0x11c28b?0x0:_0x514dd8[_0xe6a6('0x1c')];var _0x4d3d09=_0x11c28b?_0x3254af[_0xe6a6('0x1f')]:_0x514dd8[_0xe6a6('0x1c')]+_0x514dd8[_0xe6a6('0x1d')];var _0xc3ede;if(_0x4d3d09>=_0x305ab7){_0x4d3d09=_0x305ab7;_0xc3ede=0xc8;}else{_0xc3ede=0xce;}_0x3f0df8[_0xe6a6('0x19')](_0xc3ede);return _0x3f0df8[_0xe6a6('0x20')]('Content-Range',_0x1a4967+'-'+_0x4d3d09+'/'+_0x305ab7)['json'](_0x3254af);}return null;};}function patchUpdates(_0x2d3c9a){return function(_0x1175b8){try{jsonpatch[_0xe6a6('0x21')](_0x1175b8,_0x2d3c9a,!![]);}catch(_0x4f3aae){return BPromise[_0xe6a6('0x22')](_0x4f3aae);}return _0x1175b8['save']();};}function saveUpdates(_0x238a2e,_0x51fa49){return function(_0x4fd149){if(_0x4fd149){return _0x4fd149[_0xe6a6('0x23')](_0x238a2e)[_0xe6a6('0x24')](function(_0x370df3){return _0x370df3;});}return null;};}function removeEntity(_0xc02bcc,_0x408c56){return function(_0x510ab3){if(_0x510ab3){return _0x510ab3[_0xe6a6('0x25')]()[_0xe6a6('0x24')](function(){_0xc02bcc[_0xe6a6('0x19')](0xcc)[_0xe6a6('0x1a')]();});}};}function handleEntityNotFound(_0x1e58df,_0x4e853a){return function(_0x380ad8){if(!_0x380ad8){_0x1e58df[_0xe6a6('0x26')](0x194);}return _0x380ad8;};}function handleError(_0x384ad8,_0x3fc533){_0x3fc533=_0x3fc533||0x1f4;return function(_0x1a14bc){logger[_0xe6a6('0x27')](_0x1a14bc[_0xe6a6('0x28')]);if(_0x1a14bc[_0xe6a6('0x29')]){delete _0x1a14bc['name'];}_0x384ad8[_0xe6a6('0x19')](_0x3fc533)[_0xe6a6('0x2a')](_0x1a14bc);};}exports[_0xe6a6('0x2b')]=function(_0x56422a,_0x2c5e7c){var _0x53c87e={},_0x51faf1={},_0x4bb445={'count':0x0,'rows':[]};var _0x368e98=_[_0xe6a6('0x2c')](db[_0xe6a6('0x2d')]['rawAttributes'],function(_0x11e535){return{'name':_0x11e535[_0xe6a6('0x2e')],'type':_0x11e535[_0xe6a6('0x2f')][_0xe6a6('0x30')]};});_0x51faf1[_0xe6a6('0x31')]=_['map'](_0x368e98,_0xe6a6('0x29'));_0x51faf1[_0xe6a6('0x32')]=_['keys'](_0x56422a['query']);_0x51faf1[_0xe6a6('0x33')]=_[_0xe6a6('0x34')](_0x51faf1['model'],_0x51faf1['query']);_0x53c87e['attributes']=_[_0xe6a6('0x34')](_0x51faf1[_0xe6a6('0x31')],qs[_0xe6a6('0x35')](_0x56422a['query'][_0xe6a6('0x35')]));_0x53c87e[_0xe6a6('0x36')]=_0x53c87e[_0xe6a6('0x36')][_0xe6a6('0x37')]?_0x53c87e['attributes']:_0x51faf1[_0xe6a6('0x31')];if(!_0x56422a[_0xe6a6('0x32')][_0xe6a6('0x38')](_0xe6a6('0x39'))){_0x53c87e[_0xe6a6('0x1d')]=qs[_0xe6a6('0x1d')](_0x56422a[_0xe6a6('0x32')]['limit']);_0x53c87e[_0xe6a6('0x1c')]=qs[_0xe6a6('0x1c')](_0x56422a[_0xe6a6('0x32')][_0xe6a6('0x1c')]);}_0x53c87e[_0xe6a6('0x3a')]=qs[_0xe6a6('0x3b')](_0x56422a[_0xe6a6('0x32')][_0xe6a6('0x3b')]);_0x53c87e[_0xe6a6('0x3c')]=qs[_0xe6a6('0x33')](_[_0xe6a6('0x3d')](_0x56422a['query'],_0x51faf1[_0xe6a6('0x33')]),_0x368e98);if(_0x56422a[_0xe6a6('0x32')][_0xe6a6('0x3e')]){_0x53c87e['where']=_[_0xe6a6('0x3f')](_0x53c87e[_0xe6a6('0x3c')],{'$or':_[_0xe6a6('0x2c')](_0x368e98,function(_0x1319a0){if(_0x1319a0[_0xe6a6('0x2f')]!=='VIRTUAL'){var _0xe3ed9c={};_0xe3ed9c[_0x1319a0[_0xe6a6('0x29')]]={'$like':'%'+_0x56422a[_0xe6a6('0x32')][_0xe6a6('0x3e')]+'%'};return _0xe3ed9c;}})});}_0x53c87e=_[_0xe6a6('0x3f')]({},_0x53c87e,_0x56422a[_0xe6a6('0x40')]);var _0x15499a={'where':_0x53c87e[_0xe6a6('0x3c')]};return db[_0xe6a6('0x2d')][_0xe6a6('0x1f')](_0x15499a)[_0xe6a6('0x24')](function(_0x5614d0){_0x4bb445[_0xe6a6('0x1f')]=_0x5614d0;if(_0x56422a[_0xe6a6('0x32')]['includeAll']){_0x53c87e[_0xe6a6('0x41')]=[{'all':!![]}];}return db['SugarcrmField']['findAll'](_0x53c87e);})[_0xe6a6('0x24')](function(_0x192124){_0x4bb445[_0xe6a6('0x42')]=_0x192124;return _0x4bb445;})[_0xe6a6('0x24')](respondWithFilteredResult(_0x2c5e7c,_0x53c87e))[_0xe6a6('0x43')](handleError(_0x2c5e7c,null));};exports[_0xe6a6('0x44')]=function(_0x3ea9c2,_0x53e107){var _0xe50718={'raw':!![],'where':{'id':_0x3ea9c2['params']['id']}},_0xfec8ad={};_0xfec8ad[_0xe6a6('0x31')]=_['keys'](db['SugarcrmField'][_0xe6a6('0x45')]);_0xfec8ad[_0xe6a6('0x32')]=_['keys'](_0x3ea9c2['query']);_0xfec8ad[_0xe6a6('0x33')]=_[_0xe6a6('0x34')](_0xfec8ad['model'],_0xfec8ad[_0xe6a6('0x32')]);_0xe50718[_0xe6a6('0x36')]=_[_0xe6a6('0x34')](_0xfec8ad[_0xe6a6('0x31')],qs[_0xe6a6('0x35')](_0x3ea9c2[_0xe6a6('0x32')][_0xe6a6('0x35')]));_0xe50718[_0xe6a6('0x36')]=_0xe50718['attributes'][_0xe6a6('0x37')]?_0xe50718[_0xe6a6('0x36')]:_0xfec8ad[_0xe6a6('0x31')];if(_0x3ea9c2[_0xe6a6('0x32')][_0xe6a6('0x46')]){_0xe50718['include']=[{'all':!![]}];}_0xe50718=_[_0xe6a6('0x3f')]({},_0xe50718,_0x3ea9c2[_0xe6a6('0x40')]);return db[_0xe6a6('0x2d')][_0xe6a6('0x47')](_0xe50718)[_0xe6a6('0x24')](handleEntityNotFound(_0x53e107,null))[_0xe6a6('0x24')](respondWithResult(_0x53e107,null))[_0xe6a6('0x43')](handleError(_0x53e107,null));};exports[_0xe6a6('0x48')]=function(_0x336272,_0x5e7acc){return db['SugarcrmField'][_0xe6a6('0x48')](_0x336272[_0xe6a6('0x49')],{})[_0xe6a6('0x24')](respondWithResult(_0x5e7acc,0xc9))['catch'](handleError(_0x5e7acc,null));};exports[_0xe6a6('0x23')]=function(_0x170b25,_0x287bac){if(_0x170b25[_0xe6a6('0x49')]['id']){delete _0x170b25[_0xe6a6('0x49')]['id'];}return db['SugarcrmField'][_0xe6a6('0x47')]({'where':{'id':_0x170b25['params']['id']}})[_0xe6a6('0x24')](handleEntityNotFound(_0x287bac,null))[_0xe6a6('0x24')](saveUpdates(_0x170b25[_0xe6a6('0x49')],null))['then'](respondWithResult(_0x287bac,null))[_0xe6a6('0x43')](handleError(_0x287bac,null));};exports[_0xe6a6('0x25')]=function(_0x5540cd,_0xbc5efd){return db[_0xe6a6('0x2d')][_0xe6a6('0x47')]({'where':{'id':_0x5540cd['params']['id']}})[_0xe6a6('0x24')](handleEntityNotFound(_0xbc5efd,null))['then'](removeEntity(_0xbc5efd,null))[_0xe6a6('0x43')](handleError(_0xbc5efd,null));}; \ No newline at end of file +var _0x1d52=['type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','undefined','limit','count','offset','status','set','Content-Range','json','apply','reject','update','then','destroy','error','stack','name','index','map','SugarcrmField','fieldName'];(function(_0x15a077,_0x317493){var _0x35637c=function(_0x3c97fc){while(--_0x3c97fc){_0x15a077['push'](_0x15a077['shift']());}};_0x35637c(++_0x317493);}(_0x1d52,0x1d9));var _0x21d5=function(_0x32fbd8,_0x244dd9){_0x32fbd8=_0x32fbd8-0x0;var _0x280bd8=_0x1d52[_0x32fbd8];return _0x280bd8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x21d5('0x0'));var zipdir=require(_0x21d5('0x1'));var jsonpatch=require(_0x21d5('0x2'));var rp=require('request-promise');var moment=require(_0x21d5('0x3'));var BPromise=require(_0x21d5('0x4'));var Mustache=require(_0x21d5('0x5'));var util=require(_0x21d5('0x6'));var path=require(_0x21d5('0x7'));var sox=require('sox');var csv=require(_0x21d5('0x8'));var ejs=require(_0x21d5('0x9'));var fs=require('fs');var fs_extra=require(_0x21d5('0xa'));var _=require('lodash');var squel=require(_0x21d5('0xb'));var crypto=require(_0x21d5('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x21d5('0xd'));var Papa=require('papaparse');var Redis=require(_0x21d5('0xe'));var authService=require(_0x21d5('0xf'));var qs=require(_0x21d5('0x10'));var as=require(_0x21d5('0x11'));var hardwareService=require(_0x21d5('0x12'));var logger=require('../../config/logger')(_0x21d5('0x13'));var utils=require(_0x21d5('0x14'));var config=require(_0x21d5('0x15'));var licenseUtil=require(_0x21d5('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x577e73,_0x812ebc){_0x812ebc=_0x812ebc||0xcc;return function(_0x3c9f38){if(_0x3c9f38){return _0x577e73[_0x21d5('0x17')](_0x812ebc);}return _0x577e73['status'](_0x812ebc)[_0x21d5('0x18')]();};}function respondWithResult(_0x2dd158,_0x1456f8){_0x1456f8=_0x1456f8||0xc8;return function(_0x4d14db){if(_0x4d14db){return _0x2dd158['status'](_0x1456f8)['json'](_0x4d14db);}};}function respondWithFilteredResult(_0xa55eba,_0xa9a5e2){return function(_0x25dad5){if(_0x25dad5){var _0xd80b77=typeof _0xa9a5e2['offset']===_0x21d5('0x19')&&typeof _0xa9a5e2[_0x21d5('0x1a')]===_0x21d5('0x19');var _0x3d0992=_0x25dad5[_0x21d5('0x1b')];var _0x584a1d=_0xd80b77?0x0:_0xa9a5e2[_0x21d5('0x1c')];var _0x468e88=_0xd80b77?_0x25dad5[_0x21d5('0x1b')]:_0xa9a5e2[_0x21d5('0x1c')]+_0xa9a5e2[_0x21d5('0x1a')];var _0x4c4da3;if(_0x468e88>=_0x3d0992){_0x468e88=_0x3d0992;_0x4c4da3=0xc8;}else{_0x4c4da3=0xce;}_0xa55eba[_0x21d5('0x1d')](_0x4c4da3);return _0xa55eba[_0x21d5('0x1e')](_0x21d5('0x1f'),_0x584a1d+'-'+_0x468e88+'/'+_0x3d0992)[_0x21d5('0x20')](_0x25dad5);}return null;};}function patchUpdates(_0x54ae39){return function(_0x21f8fb){try{jsonpatch[_0x21d5('0x21')](_0x21f8fb,_0x54ae39,!![]);}catch(_0x239e05){return BPromise[_0x21d5('0x22')](_0x239e05);}return _0x21f8fb['save']();};}function saveUpdates(_0x4a357a,_0x37d560){return function(_0xe967e4){if(_0xe967e4){return _0xe967e4[_0x21d5('0x23')](_0x4a357a)[_0x21d5('0x24')](function(_0x57cfe5){return _0x57cfe5;});}return null;};}function removeEntity(_0x2d31d1,_0x3de7ef){return function(_0x48533b){if(_0x48533b){return _0x48533b[_0x21d5('0x25')]()['then'](function(){_0x2d31d1[_0x21d5('0x1d')](0xcc)[_0x21d5('0x18')]();});}};}function handleEntityNotFound(_0x5c975e,_0xe1926d){return function(_0xe0342f){if(!_0xe0342f){_0x5c975e['sendStatus'](0x194);}return _0xe0342f;};}function handleError(_0x59244c,_0x5ca053){_0x5ca053=_0x5ca053||0x1f4;return function(_0x408618){logger[_0x21d5('0x26')](_0x408618[_0x21d5('0x27')]);if(_0x408618[_0x21d5('0x28')]){delete _0x408618[_0x21d5('0x28')];}_0x59244c[_0x21d5('0x1d')](_0x5ca053)['send'](_0x408618);};}exports[_0x21d5('0x29')]=function(_0x2f0a1f,_0x43a495){var _0x57bdab={},_0x26ded2={},_0xcc618={'count':0x0,'rows':[]};var _0x2f1abf=_[_0x21d5('0x2a')](db[_0x21d5('0x2b')]['rawAttributes'],function(_0x1df6ad){return{'name':_0x1df6ad[_0x21d5('0x2c')],'type':_0x1df6ad[_0x21d5('0x2d')][_0x21d5('0x2e')]};});_0x26ded2[_0x21d5('0x2f')]=_[_0x21d5('0x2a')](_0x2f1abf,_0x21d5('0x28'));_0x26ded2[_0x21d5('0x30')]=_[_0x21d5('0x31')](_0x2f0a1f[_0x21d5('0x30')]);_0x26ded2[_0x21d5('0x32')]=_[_0x21d5('0x33')](_0x26ded2[_0x21d5('0x2f')],_0x26ded2['query']);_0x57bdab[_0x21d5('0x34')]=_['intersection'](_0x26ded2[_0x21d5('0x2f')],qs[_0x21d5('0x35')](_0x2f0a1f[_0x21d5('0x30')][_0x21d5('0x35')]));_0x57bdab['attributes']=_0x57bdab[_0x21d5('0x34')][_0x21d5('0x36')]?_0x57bdab[_0x21d5('0x34')]:_0x26ded2[_0x21d5('0x2f')];if(!_0x2f0a1f['query']['hasOwnProperty'](_0x21d5('0x37'))){_0x57bdab[_0x21d5('0x1a')]=qs[_0x21d5('0x1a')](_0x2f0a1f['query'][_0x21d5('0x1a')]);_0x57bdab['offset']=qs[_0x21d5('0x1c')](_0x2f0a1f[_0x21d5('0x30')][_0x21d5('0x1c')]);}_0x57bdab[_0x21d5('0x38')]=qs['sort'](_0x2f0a1f[_0x21d5('0x30')][_0x21d5('0x39')]);_0x57bdab[_0x21d5('0x3a')]=qs[_0x21d5('0x32')](_[_0x21d5('0x3b')](_0x2f0a1f[_0x21d5('0x30')],_0x26ded2[_0x21d5('0x32')]),_0x2f1abf);if(_0x2f0a1f['query'][_0x21d5('0x3c')]){_0x57bdab[_0x21d5('0x3a')]=_[_0x21d5('0x3d')](_0x57bdab[_0x21d5('0x3a')],{'$or':_[_0x21d5('0x2a')](_0x2f1abf,function(_0x2e20ed){if(_0x2e20ed[_0x21d5('0x2d')]!==_0x21d5('0x3e')){var _0x4fb6b3={};_0x4fb6b3[_0x2e20ed['name']]={'$like':'%'+_0x2f0a1f['query'][_0x21d5('0x3c')]+'%'};return _0x4fb6b3;}})});}_0x57bdab=_[_0x21d5('0x3d')]({},_0x57bdab,_0x2f0a1f['options']);var _0x1507d8={'where':_0x57bdab[_0x21d5('0x3a')]};return db[_0x21d5('0x2b')]['count'](_0x1507d8)[_0x21d5('0x24')](function(_0x420446){_0xcc618[_0x21d5('0x1b')]=_0x420446;if(_0x2f0a1f[_0x21d5('0x30')][_0x21d5('0x3f')]){_0x57bdab[_0x21d5('0x40')]=[{'all':!![]}];}return db[_0x21d5('0x2b')][_0x21d5('0x41')](_0x57bdab);})[_0x21d5('0x24')](function(_0xf5ef22){_0xcc618[_0x21d5('0x42')]=_0xf5ef22;return _0xcc618;})[_0x21d5('0x24')](respondWithFilteredResult(_0x43a495,_0x57bdab))[_0x21d5('0x43')](handleError(_0x43a495,null));};exports[_0x21d5('0x44')]=function(_0x476aa7,_0x2ea811){var _0x146d85={'raw':!![],'where':{'id':_0x476aa7[_0x21d5('0x45')]['id']}},_0x53c402={};_0x53c402[_0x21d5('0x2f')]=_['keys'](db[_0x21d5('0x2b')][_0x21d5('0x46')]);_0x53c402[_0x21d5('0x30')]=_[_0x21d5('0x31')](_0x476aa7[_0x21d5('0x30')]);_0x53c402['filters']=_[_0x21d5('0x33')](_0x53c402[_0x21d5('0x2f')],_0x53c402['query']);_0x146d85[_0x21d5('0x34')]=_[_0x21d5('0x33')](_0x53c402['model'],qs[_0x21d5('0x35')](_0x476aa7[_0x21d5('0x30')]['fields']));_0x146d85[_0x21d5('0x34')]=_0x146d85[_0x21d5('0x34')]['length']?_0x146d85[_0x21d5('0x34')]:_0x53c402[_0x21d5('0x2f')];if(_0x476aa7[_0x21d5('0x30')][_0x21d5('0x3f')]){_0x146d85[_0x21d5('0x40')]=[{'all':!![]}];}_0x146d85=_[_0x21d5('0x3d')]({},_0x146d85,_0x476aa7['options']);return db['SugarcrmField'][_0x21d5('0x47')](_0x146d85)[_0x21d5('0x24')](handleEntityNotFound(_0x2ea811,null))[_0x21d5('0x24')](respondWithResult(_0x2ea811,null))[_0x21d5('0x43')](handleError(_0x2ea811,null));};exports[_0x21d5('0x48')]=function(_0x182126,_0x133c6f){return db[_0x21d5('0x2b')][_0x21d5('0x48')](_0x182126['body'],{})[_0x21d5('0x24')](respondWithResult(_0x133c6f,0xc9))[_0x21d5('0x43')](handleError(_0x133c6f,null));};exports[_0x21d5('0x23')]=function(_0x5e528c,_0x66e0a0){if(_0x5e528c[_0x21d5('0x49')]['id']){delete _0x5e528c[_0x21d5('0x49')]['id'];}return db[_0x21d5('0x2b')][_0x21d5('0x47')]({'where':{'id':_0x5e528c[_0x21d5('0x45')]['id']}})[_0x21d5('0x24')](handleEntityNotFound(_0x66e0a0,null))[_0x21d5('0x24')](saveUpdates(_0x5e528c['body'],null))['then'](respondWithResult(_0x66e0a0,null))[_0x21d5('0x43')](handleError(_0x66e0a0,null));};exports[_0x21d5('0x25')]=function(_0xc146ee,_0x48eaf8){return db[_0x21d5('0x2b')][_0x21d5('0x47')]({'where':{'id':_0xc146ee['params']['id']}})['then'](handleEntityNotFound(_0x48eaf8,null))[_0x21d5('0x24')](removeEntity(_0x48eaf8,null))['catch'](handleError(_0x48eaf8,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index 44f7917..f0c2602 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 _0xff97=['rimraf','../../config/environment','exports','define','sugarcrm_unique_index','idField','FieldId','lodash','util','../../config/logger','moment','request-promise','path'];(function(_0x2c3aa9,_0x2bf7b1){var _0xcce2da=function(_0x27e771){while(--_0x27e771){_0x2c3aa9['push'](_0x2c3aa9['shift']());}};_0xcce2da(++_0x2bf7b1);}(_0xff97,0x132));var _0x7ff9=function(_0x248dbf,_0x1f7786){_0x248dbf=_0x248dbf-0x0;var _0x317602=_0xff97[_0x248dbf];return _0x317602;};'use strict';var _=require(_0x7ff9('0x0'));var util=require(_0x7ff9('0x1'));var logger=require(_0x7ff9('0x2'))('api');var moment=require(_0x7ff9('0x3'));var BPromise=require('bluebird');var rp=require(_0x7ff9('0x4'));var fs=require('fs');var path=require(_0x7ff9('0x5'));var rimraf=require(_0x7ff9('0x6'));var config=require(_0x7ff9('0x7'));var attributes=require('./intSugarcrmField.attributes');module[_0x7ff9('0x8')]=function(_0x222af5,_0x36f350){return _0x222af5[_0x7ff9('0x9')]('SugarcrmField',attributes,{'tableName':'int_sugarcrm_fields','paranoid':![],'indexes':[{'name':_0x7ff9('0xa'),'fields':[_0x7ff9('0xb'),_0x7ff9('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x3b31=['SugarcrmField','sugarcrm_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','exports','define'];(function(_0x4ff202,_0x5a5536){var _0x53fa84=function(_0x170adb){while(--_0x170adb){_0x4ff202['push'](_0x4ff202['shift']());}};_0x53fa84(++_0x5a5536);}(_0x3b31,0xc7));var _0x13b3=function(_0x3b7180,_0x307063){_0x3b7180=_0x3b7180-0x0;var _0x3accec=_0x3b31[_0x3b7180];return _0x3accec;};'use strict';var _=require(_0x13b3('0x0'));var util=require(_0x13b3('0x1'));var logger=require(_0x13b3('0x2'))(_0x13b3('0x3'));var moment=require(_0x13b3('0x4'));var BPromise=require(_0x13b3('0x5'));var rp=require(_0x13b3('0x6'));var fs=require('fs');var path=require(_0x13b3('0x7'));var rimraf=require('rimraf');var config=require(_0x13b3('0x8'));var attributes=require('./intSugarcrmField.attributes');module[_0x13b3('0x9')]=function(_0x3ebbe5,_0x213d68){return _0x3ebbe5[_0x13b3('0xa')](_0x13b3('0xb'),attributes,{'tableName':'int_sugarcrm_fields','paranoid':![],'indexes':[{'name':_0x13b3('0xc'),'fields':[_0x13b3('0xd'),_0x13b3('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.rpc.js b/server/api/intSugarcrmField/intSugarcrmField.rpc.js index 00b3ba9..cba4188 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 _0x2eec=['request','info','request\x20sent','debug','SugarcrmField,\x20%s,\x20%s,\x20%s','SugarcrmField,\x20%s,\x20%s','message','error','catch','moment','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http'];(function(_0x850b85,_0x5d5a47){var _0x592390=function(_0x2bdc33){while(--_0x2bdc33){_0x850b85['push'](_0x850b85['shift']());}};_0x592390(++_0x5d5a47);}(_0x2eec,0x91));var _0xc2ee=function(_0xd4f135,_0x5cad9a){_0xd4f135=_0xd4f135-0x0;var _0x55f089=_0x2eec[_0xd4f135];return _0x55f089;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xc2ee('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc2ee('0x1'));var db=require('../../mysqldb')['db'];var utils=require(_0xc2ee('0x2'));var logger=require(_0xc2ee('0x3'))(_0xc2ee('0x4'));var config=require('../../config/environment');var jayson=require(_0xc2ee('0x5'));var client=jayson[_0xc2ee('0x6')][_0xc2ee('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x3b9b7b,_0x545637,_0x504d09){return new BPromise(function(_0x2f2767,_0x19f83c){return client[_0xc2ee('0x8')](_0x3b9b7b,_0x504d09)['then'](function(_0x54edaf){logger[_0xc2ee('0x9')]('SugarcrmField,\x20%s,\x20%s',_0x545637,_0xc2ee('0xa'));logger[_0xc2ee('0xb')](_0xc2ee('0xc'),_0x545637,_0xc2ee('0xa'),JSON['stringify'](_0x54edaf));if(_0x54edaf['error']){if(_0x54edaf['error']['code']===0x1f4){logger['error'](_0xc2ee('0xd'),_0x545637,_0x54edaf['error'][_0xc2ee('0xe')]);return _0x19f83c(_0x54edaf[_0xc2ee('0xf')][_0xc2ee('0xe')]);}logger[_0xc2ee('0xf')](_0xc2ee('0xd'),_0x545637,_0x54edaf['error'][_0xc2ee('0xe')]);return _0x2f2767(_0x54edaf[_0xc2ee('0xf')]['message']);}else{logger[_0xc2ee('0x9')](_0xc2ee('0xd'),_0x545637,'request\x20sent');_0x2f2767(_0x54edaf['result'][_0xc2ee('0xe')]);}})[_0xc2ee('0x10')](function(_0x46d084){logger[_0xc2ee('0xf')](_0xc2ee('0xd'),_0x545637,_0x46d084);_0x19f83c(_0x46d084);});});} \ No newline at end of file +var _0xa304=['jayson/promise','client','request','then','info','request\x20sent','debug','stringify','error','code','SugarcrmField,\x20%s,\x20%s','message','result','catch','lodash','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment'];(function(_0x29df9a,_0x42aff3){var _0x3a8e96=function(_0x70fbe7){while(--_0x70fbe7){_0x29df9a['push'](_0x29df9a['shift']());}};_0x3a8e96(++_0x42aff3);}(_0xa304,0x173));var _0x4a30=function(_0x121b1a,_0x42fdb7){_0x121b1a=_0x121b1a-0x0;var _0x2d89a6=_0xa304[_0x121b1a];return _0x2d89a6;};'use strict';var _=require(_0x4a30('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x4a30('0x1'));var rs=require(_0x4a30('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4a30('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x4a30('0x4'))(_0x4a30('0x5'));var config=require(_0x4a30('0x6'));var jayson=require(_0x4a30('0x7'));var client=jayson[_0x4a30('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x585f4e,_0x30b3bd,_0x22f202){return new BPromise(function(_0x20ac10,_0x595506){return client[_0x4a30('0x9')](_0x585f4e,_0x22f202)[_0x4a30('0xa')](function(_0x633850){logger[_0x4a30('0xb')]('SugarcrmField,\x20%s,\x20%s',_0x30b3bd,_0x4a30('0xc'));logger[_0x4a30('0xd')]('SugarcrmField,\x20%s,\x20%s,\x20%s',_0x30b3bd,_0x4a30('0xc'),JSON[_0x4a30('0xe')](_0x633850));if(_0x633850[_0x4a30('0xf')]){if(_0x633850[_0x4a30('0xf')][_0x4a30('0x10')]===0x1f4){logger[_0x4a30('0xf')](_0x4a30('0x11'),_0x30b3bd,_0x633850[_0x4a30('0xf')][_0x4a30('0x12')]);return _0x595506(_0x633850['error'][_0x4a30('0x12')]);}logger['error']('SugarcrmField,\x20%s,\x20%s',_0x30b3bd,_0x633850[_0x4a30('0xf')][_0x4a30('0x12')]);return _0x20ac10(_0x633850[_0x4a30('0xf')][_0x4a30('0x12')]);}else{logger[_0x4a30('0xb')]('SugarcrmField,\x20%s,\x20%s',_0x30b3bd,_0x4a30('0xc'));_0x20ac10(_0x633850[_0x4a30('0x13')][_0x4a30('0x12')]);}})[_0x4a30('0x14')](function(_0x456683){logger['error'](_0x4a30('0x11'),_0x30b3bd,_0x456683);_0x595506(_0x456683);});});} \ No newline at end of file diff --git a/server/api/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index 77275d9..6272b97 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 _0x6fb8=['getFields','post','create','addConfiguration','put','update','delete','exports','multer','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./intVtigerAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations'];(function(_0x2cdee6,_0xda8a29){var _0x537e75=function(_0x239aff){while(--_0x239aff){_0x2cdee6['push'](_0x2cdee6['shift']());}};_0x537e75(++_0xda8a29);}(_0x6fb8,0x104));var _0x86fb=function(_0x263a74,_0xc31414){_0x263a74=_0x263a74-0x0;var _0x2aa86c=_0x6fb8[_0x263a74];return _0x2aa86c;};'use strict';var multer=require(_0x86fb('0x0'));var util=require('util');var path=require(_0x86fb('0x1'));var timeout=require(_0x86fb('0x2'));var express=require('express');var router=express[_0x86fb('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x86fb('0x4'));var config=require(_0x86fb('0x5'));var controller=require(_0x86fb('0x6'));router[_0x86fb('0x7')]('/',auth[_0x86fb('0x8')](),controller[_0x86fb('0x9')]);router[_0x86fb('0x7')](_0x86fb('0xa'),auth[_0x86fb('0x8')](),controller[_0x86fb('0xb')]);router[_0x86fb('0x7')](_0x86fb('0xc'),auth[_0x86fb('0x8')](),controller['getConfigurations']);router[_0x86fb('0x7')]('/:id/fields',auth[_0x86fb('0x8')](),controller[_0x86fb('0xd')]);router[_0x86fb('0xe')]('/',auth['isAuthenticated'](),controller[_0x86fb('0xf')]);router['post'](_0x86fb('0xc'),auth[_0x86fb('0x8')](),controller[_0x86fb('0x10')]);router[_0x86fb('0x11')](_0x86fb('0xa'),auth[_0x86fb('0x8')](),controller[_0x86fb('0x12')]);router[_0x86fb('0x13')](_0x86fb('0xa'),auth[_0x86fb('0x8')](),controller['destroy']);module[_0x86fb('0x14')]=router; \ No newline at end of file +var _0x2123=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerAccount.controller','get','index','/:id','show','/:id/configurations','isAuthenticated','getConfigurations','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x13f3cd,_0xad118b){var _0x82fe1a=function(_0x424372){while(--_0x424372){_0x13f3cd['push'](_0x13f3cd['shift']());}};_0x82fe1a(++_0xad118b);}(_0x2123,0x190));var _0x3212=function(_0x51dc0d,_0x17ab91){_0x51dc0d=_0x51dc0d-0x0;var _0x84f152=_0x2123[_0x51dc0d];return _0x84f152;};'use strict';var multer=require(_0x3212('0x0'));var util=require(_0x3212('0x1'));var path=require(_0x3212('0x2'));var timeout=require(_0x3212('0x3'));var express=require(_0x3212('0x4'));var router=express[_0x3212('0x5')]();var fs_extra=require(_0x3212('0x6'));var auth=require(_0x3212('0x7'));var interaction=require(_0x3212('0x8'));var config=require(_0x3212('0x9'));var controller=require(_0x3212('0xa'));router[_0x3212('0xb')]('/',auth['isAuthenticated'](),controller[_0x3212('0xc')]);router[_0x3212('0xb')](_0x3212('0xd'),auth['isAuthenticated'](),controller[_0x3212('0xe')]);router['get'](_0x3212('0xf'),auth[_0x3212('0x10')](),controller[_0x3212('0x11')]);router[_0x3212('0xb')]('/:id/fields',auth['isAuthenticated'](),controller[_0x3212('0x12')]);router[_0x3212('0x13')]('/',auth[_0x3212('0x10')](),controller[_0x3212('0x14')]);router[_0x3212('0x13')](_0x3212('0xf'),auth[_0x3212('0x10')](),controller[_0x3212('0x15')]);router[_0x3212('0x16')](_0x3212('0xd'),auth[_0x3212('0x10')](),controller[_0x3212('0x17')]);router[_0x3212('0x18')](_0x3212('0xd'),auth[_0x3212('0x10')](),controller[_0x3212('0x19')]);module[_0x3212('0x1a')]=router; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.attributes.js b/server/api/intVtigerAccount/intVtigerAccount.attributes.js index 57068d8..4154446 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 _0x0773=['HelpDesk','sequelize','exports','STRING'];(function(_0x57b56f,_0x5cc57c){var _0x1484a8=function(_0x4e2ecb){while(--_0x4e2ecb){_0x57b56f['push'](_0x57b56f['shift']());}};_0x1484a8(++_0x5cc57c);}(_0x0773,0x79));var _0x3077=function(_0x1e9634,_0xc0847d){_0x1e9634=_0x1e9634-0x0;var _0x276212=_0x0773[_0x1e9634];return _0x276212;};'use strict';var Sequelize=require(_0x3077('0x0'));module[_0x3077('0x1')]={'name':{'type':Sequelize[_0x3077('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x3077('0x2')]},'username':{'type':Sequelize[_0x3077('0x2')],'allowNull':![]},'moduleName':{'type':Sequelize[_0x3077('0x2')],'allowNull':![],'defaultValue':_0x3077('0x3')},'remoteUri':{'type':Sequelize[_0x3077('0x2')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x3077('0x2')],'allowNull':![]},'accessKey':{'type':Sequelize[_0x3077('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0xe160=['STRING','HelpDesk','sequelize','exports'];(function(_0x41ed78,_0x4be044){var _0x40fc6c=function(_0x3aa630){while(--_0x3aa630){_0x41ed78['push'](_0x41ed78['shift']());}};_0x40fc6c(++_0x4be044);}(_0xe160,0x1ba));var _0x0e16=function(_0x2e235a,_0x172afd){_0x2e235a=_0x2e235a-0x0;var _0x1353c3=_0xe160[_0x2e235a];return _0x1353c3;};'use strict';var Sequelize=require(_0x0e16('0x0'));module[_0x0e16('0x1')]={'name':{'type':Sequelize[_0x0e16('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x0e16('0x2')]},'username':{'type':Sequelize[_0x0e16('0x2')],'allowNull':![]},'moduleName':{'type':Sequelize[_0x0e16('0x2')],'allowNull':![],'defaultValue':_0x0e16('0x3')},'remoteUri':{'type':Sequelize[_0x0e16('0x2')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x0e16('0x2')],'allowNull':![]},'accessKey':{'type':Sequelize[_0x0e16('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.controller.js b/server/api/intVtigerAccount/intVtigerAccount.controller.js index c3be44c..55934da 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 _0x0883=['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','path','sox','to-csv','fs-extra','squel','crypto','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','json','offset','undefined','limit','count','Content-Range','save','update','then','end','name','send','index','map','VtigerAccount','rawAttributes','fieldName','type','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','params','filters','create','body','find','VtigerConfiguration','getConfigurations','addConfiguration','findOne','Subjects','channel','getDescriptions','Descriptions','getFields','username','description','moduleName','remoteUri','serverUrl','accessKey','slice','substring','lastIndexOf','format','%s/webservice.php','getchallenge','POST','login','result','token','GET','describe','sessionName','success','autogenerated','reference','owner','includes','editable','false','label','startsWith','picklistValues'];(function(_0x4a8915,_0x12b7fb){var _0x1e2e44=function(_0x5c9bea){while(--_0x5c9bea){_0x4a8915['push'](_0x4a8915['shift']());}};_0x1e2e44(++_0x12b7fb);}(_0x0883,0x15e));var _0x3088=function(_0x32b30c,_0x2d5ec8){_0x32b30c=_0x32b30c-0x0;var _0xcfc212=_0x0883[_0x32b30c];return _0xcfc212;};'use strict';var emlformat=require(_0x3088('0x0'));var rimraf=require(_0x3088('0x1'));var zipdir=require(_0x3088('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3088('0x3'));var moment=require('moment');var BPromise=require(_0x3088('0x4'));var Mustache=require(_0x3088('0x5'));var util=require('util');var path=require(_0x3088('0x6'));var sox=require(_0x3088('0x7'));var csv=require(_0x3088('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3088('0x9'));var _=require('lodash');var squel=require(_0x3088('0xa'));var crypto=require(_0x3088('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x3088('0xc'));var Redis=require('ioredis');var authService=require(_0x3088('0xd'));var qs=require(_0x3088('0xe'));var as=require(_0x3088('0xf'));var hardwareService=require(_0x3088('0x10'));var logger=require('../../config/logger')(_0x3088('0x11'));var utils=require(_0x3088('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x3088('0x13'));var db=require(_0x3088('0x14'))['db'];var integrations=require(_0x3088('0x15'));function respondWithStatusCode(_0x526b9e,_0x152364){_0x152364=_0x152364||0xcc;return function(_0x327d36){if(_0x327d36){return _0x526b9e[_0x3088('0x16')](_0x152364);}return _0x526b9e[_0x3088('0x17')](_0x152364)['end']();};}function respondWithResult(_0x478b67,_0x59d4c3){_0x59d4c3=_0x59d4c3||0xc8;return function(_0x4e1a6c){if(_0x4e1a6c){return _0x478b67[_0x3088('0x17')](_0x59d4c3)[_0x3088('0x18')](_0x4e1a6c);}};}function respondWithFilteredResult(_0x34597b,_0x4c00ae){return function(_0x256fac){if(_0x256fac){var _0x410113=typeof _0x4c00ae[_0x3088('0x19')]===_0x3088('0x1a')&&typeof _0x4c00ae[_0x3088('0x1b')]===_0x3088('0x1a');var _0x13ec7e=_0x256fac[_0x3088('0x1c')];var _0x5df10f=_0x410113?0x0:_0x4c00ae[_0x3088('0x19')];var _0x5b5938=_0x410113?_0x256fac[_0x3088('0x1c')]:_0x4c00ae['offset']+_0x4c00ae[_0x3088('0x1b')];var _0xe3947c;if(_0x5b5938>=_0x13ec7e){_0x5b5938=_0x13ec7e;_0xe3947c=0xc8;}else{_0xe3947c=0xce;}_0x34597b['status'](_0xe3947c);return _0x34597b['set'](_0x3088('0x1d'),_0x5df10f+'-'+_0x5b5938+'/'+_0x13ec7e)[_0x3088('0x18')](_0x256fac);}return null;};}function patchUpdates(_0x5e15dc){return function(_0x5d8574){try{jsonpatch['apply'](_0x5d8574,_0x5e15dc,!![]);}catch(_0x52db0a){return BPromise['reject'](_0x52db0a);}return _0x5d8574[_0x3088('0x1e')]();};}function saveUpdates(_0x1af531,_0xf8b6ae){return function(_0x180d14){if(_0x180d14){return _0x180d14[_0x3088('0x1f')](_0x1af531)[_0x3088('0x20')](function(_0x2b5347){return _0x2b5347;});}return null;};}function removeEntity(_0x632c06,_0x3bf914){return function(_0x253726){if(_0x253726){return _0x253726['destroy']()[_0x3088('0x20')](function(){_0x632c06[_0x3088('0x17')](0xcc)[_0x3088('0x21')]();});}};}function handleEntityNotFound(_0x4151dd,_0x2f81ff){return function(_0x1e30bc){if(!_0x1e30bc){_0x4151dd[_0x3088('0x16')](0x194);}return _0x1e30bc;};}function handleError(_0x7170a5,_0x118b22){_0x118b22=_0x118b22||0x1f4;return function(_0xe3cb01){logger['error'](_0xe3cb01['stack']);if(_0xe3cb01[_0x3088('0x22')]){delete _0xe3cb01[_0x3088('0x22')];}_0x7170a5[_0x3088('0x17')](_0x118b22)[_0x3088('0x23')](_0xe3cb01);};}exports[_0x3088('0x24')]=function(_0x486541,_0x7bf3d){var _0x304657={},_0x6194f7={},_0x4f653e={'count':0x0,'rows':[]};var _0x221333=_[_0x3088('0x25')](db[_0x3088('0x26')][_0x3088('0x27')],function(_0x13fce1){return{'name':_0x13fce1[_0x3088('0x28')],'type':_0x13fce1[_0x3088('0x29')]['key']};});_0x6194f7[_0x3088('0x2a')]=_[_0x3088('0x25')](_0x221333,_0x3088('0x22'));_0x6194f7['query']=_[_0x3088('0x2b')](_0x486541[_0x3088('0x2c')]);_0x6194f7['filters']=_[_0x3088('0x2d')](_0x6194f7['model'],_0x6194f7[_0x3088('0x2c')]);_0x304657[_0x3088('0x2e')]=_[_0x3088('0x2d')](_0x6194f7[_0x3088('0x2a')],qs[_0x3088('0x2f')](_0x486541[_0x3088('0x2c')][_0x3088('0x2f')]));_0x304657[_0x3088('0x2e')]=_0x304657[_0x3088('0x2e')][_0x3088('0x30')]?_0x304657[_0x3088('0x2e')]:_0x6194f7[_0x3088('0x2a')];if(!_0x486541[_0x3088('0x2c')][_0x3088('0x31')](_0x3088('0x32'))){_0x304657[_0x3088('0x1b')]=qs['limit'](_0x486541[_0x3088('0x2c')][_0x3088('0x1b')]);_0x304657[_0x3088('0x19')]=qs['offset'](_0x486541[_0x3088('0x2c')][_0x3088('0x19')]);}_0x304657[_0x3088('0x33')]=qs[_0x3088('0x34')](_0x486541[_0x3088('0x2c')]['sort']);_0x304657[_0x3088('0x35')]=qs['filters'](_[_0x3088('0x36')](_0x486541[_0x3088('0x2c')],_0x6194f7['filters']),_0x221333);if(_0x486541[_0x3088('0x2c')][_0x3088('0x37')]){_0x304657['where']=_[_0x3088('0x38')](_0x304657[_0x3088('0x35')],{'$or':_[_0x3088('0x25')](_0x221333,function(_0x29c829){if(_0x29c829[_0x3088('0x29')]!=='VIRTUAL'){var _0x33c3c8={};_0x33c3c8[_0x29c829[_0x3088('0x22')]]={'$like':'%'+_0x486541[_0x3088('0x2c')][_0x3088('0x37')]+'%'};return _0x33c3c8;}})});}_0x304657=_['merge']({},_0x304657,_0x486541[_0x3088('0x39')]);var _0x1cf906={'where':_0x304657['where']};return db[_0x3088('0x26')][_0x3088('0x1c')](_0x1cf906)[_0x3088('0x20')](function(_0x3fb5f8){_0x4f653e[_0x3088('0x1c')]=_0x3fb5f8;if(_0x486541[_0x3088('0x2c')][_0x3088('0x3a')]){_0x304657[_0x3088('0x3b')]=[{'all':!![]}];}return db['VtigerAccount'][_0x3088('0x3c')](_0x304657);})[_0x3088('0x20')](function(_0x531855){_0x4f653e[_0x3088('0x3d')]=_0x531855;return _0x4f653e;})[_0x3088('0x20')](respondWithFilteredResult(_0x7bf3d,_0x304657))[_0x3088('0x3e')](handleError(_0x7bf3d,null));};exports['show']=function(_0x136b65,_0x35557a){var _0x227ff4={'raw':![],'where':{'id':_0x136b65[_0x3088('0x3f')]['id']}},_0x532669={};_0x532669[_0x3088('0x2a')]=_[_0x3088('0x2b')](db[_0x3088('0x26')][_0x3088('0x27')]);_0x532669[_0x3088('0x2c')]=_[_0x3088('0x2b')](_0x136b65[_0x3088('0x2c')]);_0x532669[_0x3088('0x40')]=_[_0x3088('0x2d')](_0x532669[_0x3088('0x2a')],_0x532669[_0x3088('0x2c')]);_0x227ff4[_0x3088('0x2e')]=_[_0x3088('0x2d')](_0x532669[_0x3088('0x2a')],qs[_0x3088('0x2f')](_0x136b65[_0x3088('0x2c')]['fields']));_0x227ff4[_0x3088('0x2e')]=_0x227ff4[_0x3088('0x2e')][_0x3088('0x30')]?_0x227ff4['attributes']:_0x532669[_0x3088('0x2a')];if(_0x136b65[_0x3088('0x2c')]['includeAll']){_0x227ff4['include']=[{'all':!![]}];}_0x227ff4=_['merge']({},_0x227ff4,_0x136b65[_0x3088('0x39')]);return db[_0x3088('0x26')]['find'](_0x227ff4)[_0x3088('0x20')](handleEntityNotFound(_0x35557a,null))[_0x3088('0x20')](respondWithResult(_0x35557a,null))[_0x3088('0x3e')](handleError(_0x35557a,null));};exports[_0x3088('0x41')]=function(_0x522236,_0x33beec){return db[_0x3088('0x26')][_0x3088('0x41')](_0x522236[_0x3088('0x42')],{})[_0x3088('0x20')](respondWithResult(_0x33beec,0xc9))[_0x3088('0x3e')](handleError(_0x33beec,null));};exports[_0x3088('0x1f')]=function(_0x215e13,_0x20edc0){if(_0x215e13['body']['id']){delete _0x215e13[_0x3088('0x42')]['id'];}return db[_0x3088('0x26')][_0x3088('0x43')]({'where':{'id':_0x215e13[_0x3088('0x3f')]['id']}})[_0x3088('0x20')](handleEntityNotFound(_0x20edc0,null))['then'](saveUpdates(_0x215e13['body'],null))['then'](respondWithResult(_0x20edc0,null))[_0x3088('0x3e')](handleError(_0x20edc0,null));};exports['destroy']=function(_0x50719c,_0xb36613){return db[_0x3088('0x26')]['find']({'where':{'id':_0x50719c[_0x3088('0x3f')]['id']}})[_0x3088('0x20')](handleEntityNotFound(_0xb36613,null))['then'](removeEntity(_0xb36613,null))[_0x3088('0x3e')](handleError(_0xb36613,null));};exports['getConfigurations']=function(_0x44817f,_0x130d40,_0x3a09f5){var _0x1ecb53={};var _0x3324c7={};var _0x11eb80;var _0x48e34d;return db['VtigerAccount']['findOne']({'where':{'id':_0x44817f['params']['id']}})[_0x3088('0x20')](handleEntityNotFound(_0x130d40,null))['then'](function(_0x579f4e){if(_0x579f4e){_0x11eb80=_0x579f4e;_0x3324c7[_0x3088('0x2a')]=_[_0x3088('0x2b')](db[_0x3088('0x44')]['rawAttributes']);_0x3324c7['query']=_[_0x3088('0x2b')](_0x44817f[_0x3088('0x2c')]);_0x3324c7[_0x3088('0x40')]=_['intersection'](_0x3324c7[_0x3088('0x2a')],_0x3324c7[_0x3088('0x2c')]);_0x1ecb53[_0x3088('0x2e')]=_[_0x3088('0x2d')](_0x3324c7[_0x3088('0x2a')],qs[_0x3088('0x2f')](_0x44817f[_0x3088('0x2c')][_0x3088('0x2f')]));_0x1ecb53[_0x3088('0x2e')]=_0x1ecb53[_0x3088('0x2e')][_0x3088('0x30')]?_0x1ecb53[_0x3088('0x2e')]:_0x3324c7[_0x3088('0x2a')];_0x1ecb53[_0x3088('0x33')]=qs['sort'](_0x44817f[_0x3088('0x2c')][_0x3088('0x34')]);_0x1ecb53[_0x3088('0x35')]=qs['filters'](_[_0x3088('0x36')](_0x44817f[_0x3088('0x2c')],_0x3324c7[_0x3088('0x40')]));if(_0x44817f[_0x3088('0x2c')][_0x3088('0x37')]){_0x1ecb53[_0x3088('0x35')]=_[_0x3088('0x38')](_0x1ecb53['where'],{'$or':_[_0x3088('0x25')](_0x1ecb53[_0x3088('0x2e')],function(_0x116686){var _0x453f26={};_0x453f26[_0x116686]={'$like':'%'+_0x44817f[_0x3088('0x2c')][_0x3088('0x37')]+'%'};return _0x453f26;})});}_0x1ecb53=_[_0x3088('0x38')]({},_0x1ecb53,_0x44817f[_0x3088('0x39')]);return _0x11eb80[_0x3088('0x45')](_0x1ecb53);}})['then'](function(_0x29d1fa){if(_0x29d1fa){_0x48e34d=_0x29d1fa['length'];if(!_0x44817f['query'][_0x3088('0x31')]('nolimit')){_0x1ecb53[_0x3088('0x1b')]=qs[_0x3088('0x1b')](_0x44817f[_0x3088('0x2c')][_0x3088('0x1b')]);_0x1ecb53['offset']=qs[_0x3088('0x19')](_0x44817f[_0x3088('0x2c')][_0x3088('0x19')]);}return _0x11eb80[_0x3088('0x45')](_0x1ecb53);}})[_0x3088('0x20')](function(_0x40c179){if(_0x40c179){return _0x40c179?{'count':_0x48e34d,'rows':_0x40c179}:null;}})[_0x3088('0x20')](respondWithResult(_0x130d40,null))[_0x3088('0x3e')](handleError(_0x130d40,null));};exports[_0x3088('0x46')]=function(_0xc0e32c,_0x245327,_0x3ab047){if(_0xc0e32c[_0x3088('0x42')]['id']){delete _0xc0e32c[_0x3088('0x42')]['id'];}return db[_0x3088('0x26')][_0x3088('0x47')]({'where':{'id':_0xc0e32c['params']['id']}})[_0x3088('0x20')](handleEntityNotFound(_0x245327,null))[_0x3088('0x20')](function(_0x515f20){if(_0x515f20){_0xc0e32c[_0x3088('0x42')]['AccountId']=_0x515f20['id'];_0xc0e32c[_0x3088('0x42')][_0x3088('0x48')]=integrations['getSubjects'](_0xc0e32c[_0x3088('0x42')][_0x3088('0x49')],_0xc0e32c[_0x3088('0x42')]['type']);_0xc0e32c['body']['Descriptions']=integrations[_0x3088('0x4a')](_0xc0e32c['body']['channel'],_0xc0e32c[_0x3088('0x42')][_0x3088('0x29')]);return db[_0x3088('0x44')][_0x3088('0x41')](_0xc0e32c[_0x3088('0x42')],{'include':[{'model':db['VtigerField'],'as':'Subjects'},{'model':db['VtigerField'],'as':_0x3088('0x4b')}]});}return null;})[_0x3088('0x20')](respondWithResult(_0x245327,null))[_0x3088('0x3e')](handleError(_0x245327,null));};var md5=require('md5');exports[_0x3088('0x4c')]=function(_0x3f0790,_0x1cfc49,_0x1467a2){var _0x299ac9=null;var _0x29b934=null;var _0x1010e8=null;var _0x4e2b98=null;var _0x1ba6d7='';return db[_0x3088('0x26')]['findOne']({'where':{'id':_0x3f0790[_0x3088('0x3f')]['id']},'attributes':['id',_0x3088('0x22'),_0x3088('0x4d'),_0x3088('0x4e'),_0x3088('0x4f'),_0x3088('0x50'),_0x3088('0x51'),_0x3088('0x52')]})['then'](handleEntityNotFound(_0x1cfc49,null))[_0x3088('0x20')](function(_0x5e1292){if(_0x5e1292){_0x299ac9=_0x5e1292[_0x3088('0x4d')];_0x29b934=_0x5e1292[_0x3088('0x52')];_0x1010e8=_0x5e1292[_0x3088('0x4f')];_0x1ba6d7=_0x5e1292['remoteUri'];var _0x1102b5=_0x1ba6d7[_0x3088('0x53')](-0x1);if(_0x1102b5==='/'){_0x1ba6d7=_0x1ba6d7[_0x3088('0x54')](0x0,_0x1ba6d7[_0x3088('0x55')](_0x1102b5));}_0x4e2b98=util[_0x3088('0x56')](_0x3088('0x57'),_0x1ba6d7);var _0x5b1963={'method':'GET','uri':_0x4e2b98,'qs':{'operation':_0x3088('0x58'),'username':_0x5e1292[_0x3088('0x4d')]},'json':!![]};return rp(_0x5b1963);}})[_0x3088('0x20')](function(_0x378600){if(_0x378600['success']){var _0x5debb6={'method':_0x3088('0x59'),'uri':_0x4e2b98,'form':{'operation':_0x3088('0x5a'),'username':_0x299ac9,'accessKey':md5(_0x378600[_0x3088('0x5b')][_0x3088('0x5c')]+_0x29b934)},'json':!![]};return rp(_0x5debb6);}})[_0x3088('0x20')](function(_0x48cc38){if(_0x48cc38['success']){var _0x3ce176={'method':_0x3088('0x5d'),'uri':_0x4e2b98,'qs':{'operation':_0x3088('0x5e'),'username':_0x299ac9,'sessionName':_0x48cc38[_0x3088('0x5b')][_0x3088('0x5f')],'elementType':_0x1010e8},'json':!![]};return rp(_0x3ce176);}})[_0x3088('0x20')](function(_0x4b0280){if(_0x4b0280[_0x3088('0x60')]){var _0x34f3cd=[_0x3088('0x61'),_0x3088('0x62'),_0x3088('0x63')];_['remove'](_0x4b0280[_0x3088('0x5b')]['fields'],function(_0x18f189){return _0x34f3cd[_0x3088('0x64')](_0x18f189[_0x3088('0x29')][_0x3088('0x22')]);});_['remove'](_0x4b0280[_0x3088('0x5b')][_0x3088('0x2f')],function(_0x341c16){return _0x341c16[_0x3088('0x65')]===_0x3088('0x66');});return{'count':_0x4b0280[_0x3088('0x5b')][_0x3088('0x2f')][_0x3088('0x30')],'rows':_[_0x3088('0x25')](_0x4b0280[_0x3088('0x5b')]['fields'],function(_0x1a7d65){return{'id':_0x1a7d65['name'],'name':_0x1a7d65[_0x3088('0x67')],'custom':_[_0x3088('0x68')](_0x1a7d65[_0x3088('0x22')],'cf_')?!![]:![],'options':_0x1a7d65['type'][_0x3088('0x22')]==='picklist'&&_0x1a7d65[_0x3088('0x29')]['picklistValues']['length']>0x0?_[_0x3088('0x25')](_0x1a7d65['type'][_0x3088('0x69')],function(_0x45c069){return{'name':_0x45c069[_0x3088('0x67')],'value':_0x45c069[_0x3088('0x6a')]};}):[]};})};}})['then'](respondWithResult(_0x1cfc49,null))[_0x3088('0x3e')](function(_0x438078){console[_0x3088('0x6b')](_0x3088('0x6c')+_0x438078);var _0x5abce6=_0x3f0790[_0x3088('0x2c')][_0x3088('0x6d')]?0x1f4:_0x438078[_0x3088('0x6e')]||0x1f4;logger['error'](_0x3088('0x6f'),'getFields',_0x5abce6,JSON[_0x3088('0x70')](_0x438078));delete _0x438078[_0x3088('0x22')];if(_0x5abce6===0x191){_0x5abce6=0x190;}_0x1cfc49['status'](_0x5abce6)[_0x3088('0x23')](_0x3f0790['query'][_0x3088('0x6d')]?{'message':_0x3088('0x71'),'statusCode':_0x438078[_0x3088('0x6e')]}:_0x438078);});}; \ No newline at end of file +var _0x11ea=['mustache','util','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','offset','undefined','limit','count','set','apply','reject','save','update','then','error','stack','name','send','index','map','VtigerAccount','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','filter','options','include','findAll','rows','catch','show','params','fields','length','includeAll','create','body','find','getConfigurations','findOne','VtigerConfiguration','nolimit','addConfiguration','AccountId','Subjects','getSubjects','Descriptions','channel','VtigerField','md5','getFields','description','moduleName','remoteUri','serverUrl','accessKey','substring','lastIndexOf','%s/webservice.php','getchallenge','username','success','POST','login','result','GET','describe','sessionName','autogenerated','reference','remove','includes','editable','false','startsWith','cf_','picklist','picklistValues','value','log','test','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','statusCode','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird'];(function(_0x281f02,_0xa970fb){var _0x2d773e=function(_0x496e60){while(--_0x496e60){_0x281f02['push'](_0x281f02['shift']());}};_0x2d773e(++_0xa970fb);}(_0x11ea,0x16e));var _0xa11e=function(_0x5b793f,_0x13acbc){_0x5b793f=_0x5b793f-0x0;var _0x534599=_0x11ea[_0x5b793f];return _0x534599;};'use strict';var emlformat=require(_0xa11e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa11e('0x1'));var jsonpatch=require(_0xa11e('0x2'));var rp=require(_0xa11e('0x3'));var moment=require(_0xa11e('0x4'));var BPromise=require(_0xa11e('0x5'));var Mustache=require(_0xa11e('0x6'));var util=require(_0xa11e('0x7'));var path=require('path');var sox=require(_0xa11e('0x8'));var csv=require('to-csv');var ejs=require(_0xa11e('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa11e('0xa'));var squel=require('squel');var crypto=require(_0xa11e('0xb'));var jsforce=require(_0xa11e('0xc'));var deskjs=require(_0xa11e('0xd'));var toCsv=require(_0xa11e('0xe'));var querystring=require(_0xa11e('0xf'));var Papa=require(_0xa11e('0x10'));var Redis=require(_0xa11e('0x11'));var authService=require(_0xa11e('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xa11e('0x13'));var hardwareService=require(_0xa11e('0x14'));var logger=require('../../config/logger')(_0xa11e('0x15'));var utils=require(_0xa11e('0x16'));var config=require(_0xa11e('0x17'));var licenseUtil=require(_0xa11e('0x18'));var db=require(_0xa11e('0x19'))['db'];var integrations=require(_0xa11e('0x1a'));function respondWithStatusCode(_0x41f36d,_0x376c27){_0x376c27=_0x376c27||0xcc;return function(_0x3ddf17){if(_0x3ddf17){return _0x41f36d[_0xa11e('0x1b')](_0x376c27);}return _0x41f36d[_0xa11e('0x1c')](_0x376c27)[_0xa11e('0x1d')]();};}function respondWithResult(_0x4426de,_0x2ceb4c){_0x2ceb4c=_0x2ceb4c||0xc8;return function(_0x17f2a0){if(_0x17f2a0){return _0x4426de['status'](_0x2ceb4c)['json'](_0x17f2a0);}};}function respondWithFilteredResult(_0x2ec75c,_0x31c506){return function(_0x5247da){if(_0x5247da){var _0x55ce58=typeof _0x31c506[_0xa11e('0x1e')]===_0xa11e('0x1f')&&typeof _0x31c506[_0xa11e('0x20')]===_0xa11e('0x1f');var _0x5667aa=_0x5247da[_0xa11e('0x21')];var _0x5e26cc=_0x55ce58?0x0:_0x31c506[_0xa11e('0x1e')];var _0x524f3d=_0x55ce58?_0x5247da['count']:_0x31c506[_0xa11e('0x1e')]+_0x31c506[_0xa11e('0x20')];var _0x1619e0;if(_0x524f3d>=_0x5667aa){_0x524f3d=_0x5667aa;_0x1619e0=0xc8;}else{_0x1619e0=0xce;}_0x2ec75c[_0xa11e('0x1c')](_0x1619e0);return _0x2ec75c[_0xa11e('0x22')]('Content-Range',_0x5e26cc+'-'+_0x524f3d+'/'+_0x5667aa)['json'](_0x5247da);}return null;};}function patchUpdates(_0x6d446b){return function(_0x4dde95){try{jsonpatch[_0xa11e('0x23')](_0x4dde95,_0x6d446b,!![]);}catch(_0x2b9bbb){return BPromise[_0xa11e('0x24')](_0x2b9bbb);}return _0x4dde95[_0xa11e('0x25')]();};}function saveUpdates(_0x28d5fc,_0x2a5360){return function(_0x329051){if(_0x329051){return _0x329051[_0xa11e('0x26')](_0x28d5fc)[_0xa11e('0x27')](function(_0x28f2f3){return _0x28f2f3;});}return null;};}function removeEntity(_0xb01d82,_0x56b4f5){return function(_0x3544eb){if(_0x3544eb){return _0x3544eb['destroy']()[_0xa11e('0x27')](function(){_0xb01d82[_0xa11e('0x1c')](0xcc)[_0xa11e('0x1d')]();});}};}function handleEntityNotFound(_0xd46468,_0x17fa7e){return function(_0x31ca08){if(!_0x31ca08){_0xd46468[_0xa11e('0x1b')](0x194);}return _0x31ca08;};}function handleError(_0x57c5c0,_0x2e6b47){_0x2e6b47=_0x2e6b47||0x1f4;return function(_0x4ec650){logger[_0xa11e('0x28')](_0x4ec650[_0xa11e('0x29')]);if(_0x4ec650[_0xa11e('0x2a')]){delete _0x4ec650[_0xa11e('0x2a')];}_0x57c5c0[_0xa11e('0x1c')](_0x2e6b47)[_0xa11e('0x2b')](_0x4ec650);};}exports[_0xa11e('0x2c')]=function(_0x36af95,_0x38148a){var _0xdf1594={},_0x49f454={},_0x44e6cb={'count':0x0,'rows':[]};var _0x435770=_[_0xa11e('0x2d')](db[_0xa11e('0x2e')][_0xa11e('0x2f')],function(_0x16b15c){return{'name':_0x16b15c[_0xa11e('0x30')],'type':_0x16b15c[_0xa11e('0x31')]['key']};});_0x49f454[_0xa11e('0x32')]=_['map'](_0x435770,_0xa11e('0x2a'));_0x49f454[_0xa11e('0x33')]=_[_0xa11e('0x34')](_0x36af95['query']);_0x49f454[_0xa11e('0x35')]=_[_0xa11e('0x36')](_0x49f454['model'],_0x49f454[_0xa11e('0x33')]);_0xdf1594['attributes']=_[_0xa11e('0x36')](_0x49f454['model'],qs['fields'](_0x36af95[_0xa11e('0x33')]['fields']));_0xdf1594[_0xa11e('0x37')]=_0xdf1594['attributes']['length']?_0xdf1594[_0xa11e('0x37')]:_0x49f454[_0xa11e('0x32')];if(!_0x36af95['query'][_0xa11e('0x38')]('nolimit')){_0xdf1594['limit']=qs[_0xa11e('0x20')](_0x36af95[_0xa11e('0x33')][_0xa11e('0x20')]);_0xdf1594[_0xa11e('0x1e')]=qs[_0xa11e('0x1e')](_0x36af95['query']['offset']);}_0xdf1594[_0xa11e('0x39')]=qs[_0xa11e('0x3a')](_0x36af95[_0xa11e('0x33')][_0xa11e('0x3a')]);_0xdf1594[_0xa11e('0x3b')]=qs['filters'](_[_0xa11e('0x3c')](_0x36af95[_0xa11e('0x33')],_0x49f454[_0xa11e('0x35')]),_0x435770);if(_0x36af95['query']['filter']){_0xdf1594[_0xa11e('0x3b')]=_[_0xa11e('0x3d')](_0xdf1594[_0xa11e('0x3b')],{'$or':_[_0xa11e('0x2d')](_0x435770,function(_0x5aef1d){if(_0x5aef1d['type']!==_0xa11e('0x3e')){var _0x16a02a={};_0x16a02a[_0x5aef1d[_0xa11e('0x2a')]]={'$like':'%'+_0x36af95[_0xa11e('0x33')][_0xa11e('0x3f')]+'%'};return _0x16a02a;}})});}_0xdf1594=_[_0xa11e('0x3d')]({},_0xdf1594,_0x36af95[_0xa11e('0x40')]);var _0x1d70c6={'where':_0xdf1594[_0xa11e('0x3b')]};return db[_0xa11e('0x2e')][_0xa11e('0x21')](_0x1d70c6)[_0xa11e('0x27')](function(_0x574a1a){_0x44e6cb[_0xa11e('0x21')]=_0x574a1a;if(_0x36af95[_0xa11e('0x33')]['includeAll']){_0xdf1594[_0xa11e('0x41')]=[{'all':!![]}];}return db[_0xa11e('0x2e')][_0xa11e('0x42')](_0xdf1594);})[_0xa11e('0x27')](function(_0x27a4e4){_0x44e6cb[_0xa11e('0x43')]=_0x27a4e4;return _0x44e6cb;})[_0xa11e('0x27')](respondWithFilteredResult(_0x38148a,_0xdf1594))[_0xa11e('0x44')](handleError(_0x38148a,null));};exports[_0xa11e('0x45')]=function(_0x2a0e98,_0x1086ae){var _0x5e72cc={'raw':![],'where':{'id':_0x2a0e98[_0xa11e('0x46')]['id']}},_0x3e8a9b={};_0x3e8a9b[_0xa11e('0x32')]=_['keys'](db[_0xa11e('0x2e')]['rawAttributes']);_0x3e8a9b[_0xa11e('0x33')]=_[_0xa11e('0x34')](_0x2a0e98[_0xa11e('0x33')]);_0x3e8a9b['filters']=_[_0xa11e('0x36')](_0x3e8a9b[_0xa11e('0x32')],_0x3e8a9b[_0xa11e('0x33')]);_0x5e72cc[_0xa11e('0x37')]=_[_0xa11e('0x36')](_0x3e8a9b['model'],qs['fields'](_0x2a0e98[_0xa11e('0x33')][_0xa11e('0x47')]));_0x5e72cc[_0xa11e('0x37')]=_0x5e72cc['attributes'][_0xa11e('0x48')]?_0x5e72cc[_0xa11e('0x37')]:_0x3e8a9b['model'];if(_0x2a0e98[_0xa11e('0x33')][_0xa11e('0x49')]){_0x5e72cc[_0xa11e('0x41')]=[{'all':!![]}];}_0x5e72cc=_['merge']({},_0x5e72cc,_0x2a0e98['options']);return db['VtigerAccount']['find'](_0x5e72cc)['then'](handleEntityNotFound(_0x1086ae,null))[_0xa11e('0x27')](respondWithResult(_0x1086ae,null))[_0xa11e('0x44')](handleError(_0x1086ae,null));};exports['create']=function(_0x2f5a9a,_0x30efd4){return db['VtigerAccount'][_0xa11e('0x4a')](_0x2f5a9a['body'],{})[_0xa11e('0x27')](respondWithResult(_0x30efd4,0xc9))[_0xa11e('0x44')](handleError(_0x30efd4,null));};exports[_0xa11e('0x26')]=function(_0x3bd757,_0xd0e863){if(_0x3bd757[_0xa11e('0x4b')]['id']){delete _0x3bd757['body']['id'];}return db[_0xa11e('0x2e')][_0xa11e('0x4c')]({'where':{'id':_0x3bd757['params']['id']}})[_0xa11e('0x27')](handleEntityNotFound(_0xd0e863,null))[_0xa11e('0x27')](saveUpdates(_0x3bd757[_0xa11e('0x4b')],null))['then'](respondWithResult(_0xd0e863,null))[_0xa11e('0x44')](handleError(_0xd0e863,null));};exports['destroy']=function(_0x15e007,_0x51dcea){return db[_0xa11e('0x2e')][_0xa11e('0x4c')]({'where':{'id':_0x15e007[_0xa11e('0x46')]['id']}})[_0xa11e('0x27')](handleEntityNotFound(_0x51dcea,null))[_0xa11e('0x27')](removeEntity(_0x51dcea,null))[_0xa11e('0x44')](handleError(_0x51dcea,null));};exports[_0xa11e('0x4d')]=function(_0x2b3f4c,_0x507079,_0xe357f6){var _0x1edb1d={};var _0x5b7d69={};var _0x4b4a16;var _0x5cf8b7;return db[_0xa11e('0x2e')][_0xa11e('0x4e')]({'where':{'id':_0x2b3f4c[_0xa11e('0x46')]['id']}})['then'](handleEntityNotFound(_0x507079,null))[_0xa11e('0x27')](function(_0x3a6a4f){if(_0x3a6a4f){_0x4b4a16=_0x3a6a4f;_0x5b7d69[_0xa11e('0x32')]=_['keys'](db[_0xa11e('0x4f')][_0xa11e('0x2f')]);_0x5b7d69[_0xa11e('0x33')]=_[_0xa11e('0x34')](_0x2b3f4c[_0xa11e('0x33')]);_0x5b7d69['filters']=_['intersection'](_0x5b7d69[_0xa11e('0x32')],_0x5b7d69[_0xa11e('0x33')]);_0x1edb1d['attributes']=_['intersection'](_0x5b7d69[_0xa11e('0x32')],qs[_0xa11e('0x47')](_0x2b3f4c[_0xa11e('0x33')]['fields']));_0x1edb1d[_0xa11e('0x37')]=_0x1edb1d[_0xa11e('0x37')]['length']?_0x1edb1d[_0xa11e('0x37')]:_0x5b7d69[_0xa11e('0x32')];_0x1edb1d[_0xa11e('0x39')]=qs[_0xa11e('0x3a')](_0x2b3f4c['query']['sort']);_0x1edb1d[_0xa11e('0x3b')]=qs[_0xa11e('0x35')](_[_0xa11e('0x3c')](_0x2b3f4c[_0xa11e('0x33')],_0x5b7d69[_0xa11e('0x35')]));if(_0x2b3f4c[_0xa11e('0x33')][_0xa11e('0x3f')]){_0x1edb1d['where']=_[_0xa11e('0x3d')](_0x1edb1d['where'],{'$or':_['map'](_0x1edb1d[_0xa11e('0x37')],function(_0x3fffe0){var _0x59b8b8={};_0x59b8b8[_0x3fffe0]={'$like':'%'+_0x2b3f4c[_0xa11e('0x33')]['filter']+'%'};return _0x59b8b8;})});}_0x1edb1d=_['merge']({},_0x1edb1d,_0x2b3f4c[_0xa11e('0x40')]);return _0x4b4a16['getConfigurations'](_0x1edb1d);}})['then'](function(_0x2457cd){if(_0x2457cd){_0x5cf8b7=_0x2457cd[_0xa11e('0x48')];if(!_0x2b3f4c[_0xa11e('0x33')][_0xa11e('0x38')](_0xa11e('0x50'))){_0x1edb1d['limit']=qs[_0xa11e('0x20')](_0x2b3f4c[_0xa11e('0x33')]['limit']);_0x1edb1d[_0xa11e('0x1e')]=qs[_0xa11e('0x1e')](_0x2b3f4c[_0xa11e('0x33')]['offset']);}return _0x4b4a16[_0xa11e('0x4d')](_0x1edb1d);}})[_0xa11e('0x27')](function(_0x5e4480){if(_0x5e4480){return _0x5e4480?{'count':_0x5cf8b7,'rows':_0x5e4480}:null;}})[_0xa11e('0x27')](respondWithResult(_0x507079,null))['catch'](handleError(_0x507079,null));};exports[_0xa11e('0x51')]=function(_0xf9bb3b,_0x4de90d,_0x4e81d1){if(_0xf9bb3b['body']['id']){delete _0xf9bb3b[_0xa11e('0x4b')]['id'];}return db['VtigerAccount'][_0xa11e('0x4e')]({'where':{'id':_0xf9bb3b[_0xa11e('0x46')]['id']}})[_0xa11e('0x27')](handleEntityNotFound(_0x4de90d,null))[_0xa11e('0x27')](function(_0x448cb9){if(_0x448cb9){_0xf9bb3b[_0xa11e('0x4b')][_0xa11e('0x52')]=_0x448cb9['id'];_0xf9bb3b['body'][_0xa11e('0x53')]=integrations[_0xa11e('0x54')](_0xf9bb3b[_0xa11e('0x4b')]['channel'],_0xf9bb3b[_0xa11e('0x4b')][_0xa11e('0x31')]);_0xf9bb3b[_0xa11e('0x4b')][_0xa11e('0x55')]=integrations['getDescriptions'](_0xf9bb3b[_0xa11e('0x4b')][_0xa11e('0x56')],_0xf9bb3b[_0xa11e('0x4b')][_0xa11e('0x31')]);return db['VtigerConfiguration'][_0xa11e('0x4a')](_0xf9bb3b[_0xa11e('0x4b')],{'include':[{'model':db['VtigerField'],'as':_0xa11e('0x53')},{'model':db[_0xa11e('0x57')],'as':_0xa11e('0x55')}]});}return null;})['then'](respondWithResult(_0x4de90d,null))[_0xa11e('0x44')](handleError(_0x4de90d,null));};var md5=require(_0xa11e('0x58'));exports[_0xa11e('0x59')]=function(_0x56163e,_0x547767,_0x567d11){var _0x280772=null;var _0x2eab8f=null;var _0x23c6d2=null;var _0x354f15=null;var _0x519cc7='';return db[_0xa11e('0x2e')][_0xa11e('0x4e')]({'where':{'id':_0x56163e[_0xa11e('0x46')]['id']},'attributes':['id',_0xa11e('0x2a'),'username',_0xa11e('0x5a'),_0xa11e('0x5b'),_0xa11e('0x5c'),_0xa11e('0x5d'),'accessKey']})[_0xa11e('0x27')](handleEntityNotFound(_0x547767,null))[_0xa11e('0x27')](function(_0x5d0d7a){if(_0x5d0d7a){_0x280772=_0x5d0d7a['username'];_0x2eab8f=_0x5d0d7a[_0xa11e('0x5e')];_0x23c6d2=_0x5d0d7a[_0xa11e('0x5b')];_0x519cc7=_0x5d0d7a[_0xa11e('0x5c')];var _0x2a02d5=_0x519cc7['slice'](-0x1);if(_0x2a02d5==='/'){_0x519cc7=_0x519cc7[_0xa11e('0x5f')](0x0,_0x519cc7[_0xa11e('0x60')](_0x2a02d5));}_0x354f15=util['format'](_0xa11e('0x61'),_0x519cc7);var _0x1b7f9e={'method':'GET','uri':_0x354f15,'qs':{'operation':_0xa11e('0x62'),'username':_0x5d0d7a[_0xa11e('0x63')]},'json':!![]};return rp(_0x1b7f9e);}})[_0xa11e('0x27')](function(_0x2c20ad){if(_0x2c20ad[_0xa11e('0x64')]){var _0x510df1={'method':_0xa11e('0x65'),'uri':_0x354f15,'form':{'operation':_0xa11e('0x66'),'username':_0x280772,'accessKey':md5(_0x2c20ad[_0xa11e('0x67')]['token']+_0x2eab8f)},'json':!![]};return rp(_0x510df1);}})[_0xa11e('0x27')](function(_0x3d2f76){if(_0x3d2f76['success']){var _0x3787cd={'method':_0xa11e('0x68'),'uri':_0x354f15,'qs':{'operation':_0xa11e('0x69'),'username':_0x280772,'sessionName':_0x3d2f76[_0xa11e('0x67')][_0xa11e('0x6a')],'elementType':_0x23c6d2},'json':!![]};return rp(_0x3787cd);}})[_0xa11e('0x27')](function(_0x1ae530){if(_0x1ae530[_0xa11e('0x64')]){var _0x4be17d=[_0xa11e('0x6b'),_0xa11e('0x6c'),'owner'];_[_0xa11e('0x6d')](_0x1ae530[_0xa11e('0x67')]['fields'],function(_0x4addae){return _0x4be17d[_0xa11e('0x6e')](_0x4addae[_0xa11e('0x31')][_0xa11e('0x2a')]);});_[_0xa11e('0x6d')](_0x1ae530[_0xa11e('0x67')]['fields'],function(_0x3b53ac){return _0x3b53ac[_0xa11e('0x6f')]===_0xa11e('0x70');});return{'count':_0x1ae530['result'][_0xa11e('0x47')][_0xa11e('0x48')],'rows':_['map'](_0x1ae530[_0xa11e('0x67')][_0xa11e('0x47')],function(_0x1f50ca){return{'id':_0x1f50ca['name'],'name':_0x1f50ca['label'],'custom':_[_0xa11e('0x71')](_0x1f50ca[_0xa11e('0x2a')],_0xa11e('0x72'))?!![]:![],'options':_0x1f50ca[_0xa11e('0x31')]['name']===_0xa11e('0x73')&&_0x1f50ca['type'][_0xa11e('0x74')]['length']>0x0?_['map'](_0x1f50ca[_0xa11e('0x31')][_0xa11e('0x74')],function(_0x47c00e){return{'name':_0x47c00e['label'],'value':_0x47c00e[_0xa11e('0x75')]};}):[]};})};}})[_0xa11e('0x27')](respondWithResult(_0x547767,null))[_0xa11e('0x44')](function(_0x3d30df){console[_0xa11e('0x76')]('vTiger\x20error:\x20'+_0x3d30df);var _0x998da1=_0x56163e[_0xa11e('0x33')][_0xa11e('0x77')]?0x1f4:_0x3d30df['statusCode']||0x1f4;logger[_0xa11e('0x28')](_0xa11e('0x78'),_0xa11e('0x59'),_0x998da1,JSON[_0xa11e('0x79')](_0x3d30df));delete _0x3d30df[_0xa11e('0x2a')];if(_0x998da1===0x191){_0x998da1=0x190;}_0x547767[_0xa11e('0x1c')](_0x998da1)[_0xa11e('0x2b')](_0x56163e['query']['test']?{'message':_0xa11e('0x7a'),'statusCode':_0x3d30df[_0xa11e('0x7b')]}:_0x3d30df);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index 469effd..d01b4ee 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 _0xc847=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intVtigerAccount.attributes','../../components/integrations/configuration','exports','int_vtiger_accounts','util'];(function(_0x4b728,_0x5c4706){var _0xb6c42f=function(_0x4ad25a){while(--_0x4ad25a){_0x4b728['push'](_0x4b728['shift']());}};_0xb6c42f(++_0x5c4706);}(_0xc847,0x15b));var _0x7c84=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc847[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x7c84('0x0'));var logger=require(_0x7c84('0x1'))('api');var moment=require(_0x7c84('0x2'));var BPromise=require(_0x7c84('0x3'));var rp=require(_0x7c84('0x4'));var fs=require('fs');var path=require(_0x7c84('0x5'));var rimraf=require(_0x7c84('0x6'));var config=require(_0x7c84('0x7'));var attributes=require(_0x7c84('0x8'));var integrations=require(_0x7c84('0x9'));module[_0x7c84('0xa')]=function(_0x2ad3bd,_0x215ebe){return _0x2ad3bd['define']('VtigerAccount',attributes,{'tableName':_0x7c84('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x161d=['bluebird','request-promise','path','rimraf','../../config/environment','./intVtigerAccount.attributes','define','lodash','../../config/logger','api','moment'];(function(_0x57bb26,_0xefbc2f){var _0xe63497=function(_0xa02d3a){while(--_0xa02d3a){_0x57bb26['push'](_0x57bb26['shift']());}};_0xe63497(++_0xefbc2f);}(_0x161d,0x13b));var _0xd161=function(_0x5a4fba,_0x2eea9c){_0x5a4fba=_0x5a4fba-0x0;var _0x3e99a3=_0x161d[_0x5a4fba];return _0x3e99a3;};'use strict';var _=require(_0xd161('0x0'));var util=require('util');var logger=require(_0xd161('0x1'))(_0xd161('0x2'));var moment=require(_0xd161('0x3'));var BPromise=require(_0xd161('0x4'));var rp=require(_0xd161('0x5'));var fs=require('fs');var path=require(_0xd161('0x6'));var rimraf=require(_0xd161('0x7'));var config=require(_0xd161('0x8'));var attributes=require(_0xd161('0x9'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x2aa712,_0x4ec2f8){return _0x2aa712[_0xd161('0xa')]('VtigerAccount',attributes,{'tableName':'int_vtiger_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.rpc.js b/server/api/intVtigerAccount/intVtigerAccount.rpc.js index c8e371a..366d24b 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 _0xb574=['where','attributes','include','map','model','ShowVtigerAccount','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','GetVtigerAccount','VtigerAccount','findAll','options','raw'];(function(_0x5413f5,_0x3154c7){var _0x639288=function(_0x4b85e9){while(--_0x4b85e9){_0x5413f5['push'](_0x5413f5['shift']());}};_0x639288(++_0x3154c7);}(_0xb574,0x106));var _0x4b57=function(_0x4778ae,_0x28c4cf){_0x4778ae=_0x4778ae-0x0;var _0x13078a=_0xb574[_0x4778ae];return _0x13078a;};'use strict';var _=require(_0x4b57('0x0'));var util=require(_0x4b57('0x1'));var moment=require('moment');var BPromise=require(_0x4b57('0x2'));var rs=require(_0x4b57('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4b57('0x4'))['db'];var utils=require(_0x4b57('0x5'));var logger=require(_0x4b57('0x6'))(_0x4b57('0x7'));var config=require(_0x4b57('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x4b57('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4a4a0f,_0x585d86,_0x4b2d65){return new BPromise(function(_0x548ee8,_0x291e54){return client[_0x4b57('0xa')](_0x4a4a0f,_0x4b2d65)[_0x4b57('0xb')](function(_0x3b112d){logger[_0x4b57('0xc')](_0x4b57('0xd'),_0x585d86,_0x4b57('0xe'));logger[_0x4b57('0xf')]('VtigerAccount,\x20%s,\x20%s,\x20%s',_0x585d86,_0x4b57('0xe'),JSON[_0x4b57('0x10')](_0x3b112d));if(_0x3b112d[_0x4b57('0x11')]){if(_0x3b112d['error']['code']===0x1f4){logger[_0x4b57('0x11')](_0x4b57('0xd'),_0x585d86,_0x3b112d[_0x4b57('0x11')][_0x4b57('0x12')]);return _0x291e54(_0x3b112d[_0x4b57('0x11')][_0x4b57('0x12')]);}logger[_0x4b57('0x11')](_0x4b57('0xd'),_0x585d86,_0x3b112d[_0x4b57('0x11')]['message']);return _0x548ee8(_0x3b112d['error'][_0x4b57('0x12')]);}else{logger[_0x4b57('0xc')](_0x4b57('0xd'),_0x585d86,'request\x20sent');_0x548ee8(_0x3b112d[_0x4b57('0x13')]['message']);}})[_0x4b57('0x14')](function(_0x42aff4){logger[_0x4b57('0x11')](_0x4b57('0xd'),_0x585d86,_0x42aff4);_0x291e54(_0x42aff4);});});}exports[_0x4b57('0x15')]=function(_0xfb71cc){var _0x4ede42=this;return new Promise(function(_0x1b35ff,_0x1a0b72){return db[_0x4b57('0x16')][_0x4b57('0x17')]({'raw':_0xfb71cc['options']?_0xfb71cc[_0x4b57('0x18')][_0x4b57('0x19')]===undefined?!![]:![]:!![],'where':_0xfb71cc[_0x4b57('0x18')]?_0xfb71cc[_0x4b57('0x18')][_0x4b57('0x1a')]||null:null,'attributes':_0xfb71cc[_0x4b57('0x18')]?_0xfb71cc['options'][_0x4b57('0x1b')]||null:null,'limit':_0xfb71cc[_0x4b57('0x18')]?_0xfb71cc[_0x4b57('0x18')]['limit']||null:null,'include':_0xfb71cc[_0x4b57('0x18')]?_0xfb71cc[_0x4b57('0x18')][_0x4b57('0x1c')]?_[_0x4b57('0x1d')](_0xfb71cc['options'][_0x4b57('0x1c')],function(_0x368c5f){return{'model':db[_0x368c5f['model']],'as':_0x368c5f['as'],'attributes':_0x368c5f[_0x4b57('0x1b')],'include':_0x368c5f[_0x4b57('0x1c')]?_[_0x4b57('0x1d')](_0x368c5f[_0x4b57('0x1c')],function(_0x540eff){return{'model':db[_0x540eff[_0x4b57('0x1e')]],'as':_0x540eff['as'],'attributes':_0x540eff['attributes'],'include':_0x540eff[_0x4b57('0x1c')]?_['map'](_0x540eff[_0x4b57('0x1c')],function(_0x2dc9d8){return{'model':db[_0x2dc9d8[_0x4b57('0x1e')]],'as':_0x2dc9d8['as'],'attributes':_0x2dc9d8[_0x4b57('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x4b57('0xb')](function(_0x392e37){logger['info']('GetVtigerAccount',_0xfb71cc);logger[_0x4b57('0xf')]('GetVtigerAccount',_0xfb71cc,JSON[_0x4b57('0x10')](_0x392e37));_0x1b35ff(_0x392e37);})[_0x4b57('0x14')](function(_0x874cf7){logger[_0x4b57('0x11')](_0x4b57('0x15'),_0x874cf7[_0x4b57('0x12')],_0xfb71cc);_0x1a0b72(_0x4ede42['error'](0x1f4,_0x874cf7[_0x4b57('0x12')]));});});};exports[_0x4b57('0x1f')]=function(_0x68be27){var _0x3cd331=this;return new Promise(function(_0x4ccf89,_0xa91ba){return db[_0x4b57('0x16')]['find']({'raw':_0x68be27[_0x4b57('0x18')]?_0x68be27[_0x4b57('0x18')][_0x4b57('0x19')]===undefined?!![]:![]:!![],'where':_0x68be27[_0x4b57('0x18')]?_0x68be27['options']['where']||null:null,'attributes':_0x68be27['options']?_0x68be27[_0x4b57('0x18')][_0x4b57('0x1b')]||null:null,'include':_0x68be27[_0x4b57('0x18')]?_0x68be27[_0x4b57('0x18')][_0x4b57('0x1c')]?_['map'](_0x68be27[_0x4b57('0x18')][_0x4b57('0x1c')],function(_0x1fd3f7){return{'model':db[_0x1fd3f7['model']],'as':_0x1fd3f7['as'],'attributes':_0x1fd3f7[_0x4b57('0x1b')],'include':_0x1fd3f7[_0x4b57('0x1c')]?_[_0x4b57('0x1d')](_0x1fd3f7['include'],function(_0x28a0ee){return{'model':db[_0x28a0ee[_0x4b57('0x1e')]],'as':_0x28a0ee['as'],'attributes':_0x28a0ee['attributes'],'include':_0x28a0ee[_0x4b57('0x1c')]?_[_0x4b57('0x1d')](_0x28a0ee[_0x4b57('0x1c')],function(_0x91f32e){return{'model':db[_0x91f32e[_0x4b57('0x1e')]],'as':_0x91f32e['as'],'attributes':_0x91f32e[_0x4b57('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1f9f76){logger[_0x4b57('0xc')](_0x4b57('0x1f'),_0x68be27);logger[_0x4b57('0xf')](_0x4b57('0x1f'),_0x68be27,JSON[_0x4b57('0x10')](_0x1f9f76));_0x4ccf89(_0x1f9f76);})[_0x4b57('0x14')](function(_0x4c5b82){logger['error'](_0x4b57('0x1f'),_0x4c5b82[_0x4b57('0x12')],_0x68be27);_0xa91ba(_0x3cd331[_0x4b57('0x11')](0x1f4,_0x4c5b82['message']));});});}; \ No newline at end of file +var _0x4fc2=['rpc','../../config/environment','client','http','request','then','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','findAll','options','where','attributes','include','model','map','GetVtigerAccount','VtigerAccount','find','raw','ShowVtigerAccount','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils'];(function(_0x587439,_0x153c32){var _0x138c81=function(_0x36bb26){while(--_0x36bb26){_0x587439['push'](_0x587439['shift']());}};_0x138c81(++_0x153c32);}(_0x4fc2,0x111));var _0x24fc=function(_0x4e2861,_0x199be0){_0x4e2861=_0x4e2861-0x0;var _0x2265e3=_0x4fc2[_0x4e2861];return _0x2265e3;};'use strict';var _=require(_0x24fc('0x0'));var util=require(_0x24fc('0x1'));var moment=require(_0x24fc('0x2'));var BPromise=require(_0x24fc('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x24fc('0x4'));var db=require(_0x24fc('0x5'))['db'];var utils=require(_0x24fc('0x6'));var logger=require('../../config/logger')(_0x24fc('0x7'));var config=require(_0x24fc('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x24fc('0x9')][_0x24fc('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4889f4,_0x115851,_0x22a0c8){return new BPromise(function(_0x220f9a,_0x123eff){return client[_0x24fc('0xb')](_0x4889f4,_0x22a0c8)[_0x24fc('0xc')](function(_0x5afdf1){logger[_0x24fc('0xd')](_0x24fc('0xe'),_0x115851,_0x24fc('0xf'));logger[_0x24fc('0x10')](_0x24fc('0x11'),_0x115851,_0x24fc('0xf'),JSON[_0x24fc('0x12')](_0x5afdf1));if(_0x5afdf1[_0x24fc('0x13')]){if(_0x5afdf1['error'][_0x24fc('0x14')]===0x1f4){logger[_0x24fc('0x13')]('VtigerAccount,\x20%s,\x20%s',_0x115851,_0x5afdf1[_0x24fc('0x13')][_0x24fc('0x15')]);return _0x123eff(_0x5afdf1[_0x24fc('0x13')][_0x24fc('0x15')]);}logger[_0x24fc('0x13')](_0x24fc('0xe'),_0x115851,_0x5afdf1['error'][_0x24fc('0x15')]);return _0x220f9a(_0x5afdf1[_0x24fc('0x13')][_0x24fc('0x15')]);}else{logger[_0x24fc('0xd')]('VtigerAccount,\x20%s,\x20%s',_0x115851,_0x24fc('0xf'));_0x220f9a(_0x5afdf1['result'][_0x24fc('0x15')]);}})[_0x24fc('0x16')](function(_0x218fb6){logger[_0x24fc('0x13')](_0x24fc('0xe'),_0x115851,_0x218fb6);_0x123eff(_0x218fb6);});});}exports['GetVtigerAccount']=function(_0x23873c){var _0x1cb3d0=this;return new Promise(function(_0x6cfa0a,_0x8ac114){return db['VtigerAccount'][_0x24fc('0x17')]({'raw':_0x23873c[_0x24fc('0x18')]?_0x23873c[_0x24fc('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x23873c[_0x24fc('0x18')]?_0x23873c[_0x24fc('0x18')][_0x24fc('0x19')]||null:null,'attributes':_0x23873c[_0x24fc('0x18')]?_0x23873c['options'][_0x24fc('0x1a')]||null:null,'limit':_0x23873c['options']?_0x23873c[_0x24fc('0x18')]['limit']||null:null,'include':_0x23873c[_0x24fc('0x18')]?_0x23873c[_0x24fc('0x18')][_0x24fc('0x1b')]?_['map'](_0x23873c[_0x24fc('0x18')]['include'],function(_0x35a9c7){return{'model':db[_0x35a9c7[_0x24fc('0x1c')]],'as':_0x35a9c7['as'],'attributes':_0x35a9c7[_0x24fc('0x1a')],'include':_0x35a9c7[_0x24fc('0x1b')]?_[_0x24fc('0x1d')](_0x35a9c7[_0x24fc('0x1b')],function(_0x3f0875){return{'model':db[_0x3f0875[_0x24fc('0x1c')]],'as':_0x3f0875['as'],'attributes':_0x3f0875[_0x24fc('0x1a')],'include':_0x3f0875[_0x24fc('0x1b')]?_['map'](_0x3f0875[_0x24fc('0x1b')],function(_0x16f27f){return{'model':db[_0x16f27f[_0x24fc('0x1c')]],'as':_0x16f27f['as'],'attributes':_0x16f27f['attributes']};}):[]};}):[]};}):[]:[]})[_0x24fc('0xc')](function(_0x3d1ec8){logger[_0x24fc('0xd')](_0x24fc('0x1e'),_0x23873c);logger[_0x24fc('0x10')](_0x24fc('0x1e'),_0x23873c,JSON['stringify'](_0x3d1ec8));_0x6cfa0a(_0x3d1ec8);})[_0x24fc('0x16')](function(_0x29a461){logger[_0x24fc('0x13')](_0x24fc('0x1e'),_0x29a461[_0x24fc('0x15')],_0x23873c);_0x8ac114(_0x1cb3d0['error'](0x1f4,_0x29a461['message']));});});};exports['ShowVtigerAccount']=function(_0x3df6f4){var _0x574ba3=this;return new Promise(function(_0x3f2464,_0x3e6389){return db[_0x24fc('0x1f')][_0x24fc('0x20')]({'raw':_0x3df6f4['options']?_0x3df6f4[_0x24fc('0x18')][_0x24fc('0x21')]===undefined?!![]:![]:!![],'where':_0x3df6f4['options']?_0x3df6f4[_0x24fc('0x18')][_0x24fc('0x19')]||null:null,'attributes':_0x3df6f4['options']?_0x3df6f4['options'][_0x24fc('0x1a')]||null:null,'include':_0x3df6f4['options']?_0x3df6f4[_0x24fc('0x18')][_0x24fc('0x1b')]?_['map'](_0x3df6f4[_0x24fc('0x18')][_0x24fc('0x1b')],function(_0x3b2862){return{'model':db[_0x3b2862[_0x24fc('0x1c')]],'as':_0x3b2862['as'],'attributes':_0x3b2862[_0x24fc('0x1a')],'include':_0x3b2862[_0x24fc('0x1b')]?_[_0x24fc('0x1d')](_0x3b2862[_0x24fc('0x1b')],function(_0x379a4a){return{'model':db[_0x379a4a['model']],'as':_0x379a4a['as'],'attributes':_0x379a4a[_0x24fc('0x1a')],'include':_0x379a4a[_0x24fc('0x1b')]?_[_0x24fc('0x1d')](_0x379a4a[_0x24fc('0x1b')],function(_0x242bd5){return{'model':db[_0x242bd5['model']],'as':_0x242bd5['as'],'attributes':_0x242bd5['attributes']};}):[]};}):[]};}):[]:[]})[_0x24fc('0xc')](function(_0x5d48fe){logger[_0x24fc('0xd')](_0x24fc('0x22'),_0x3df6f4);logger[_0x24fc('0x10')](_0x24fc('0x22'),_0x3df6f4,JSON['stringify'](_0x5d48fe));_0x3f2464(_0x5d48fe);})[_0x24fc('0x16')](function(_0x4f4ec8){logger[_0x24fc('0x13')](_0x24fc('0x22'),_0x4f4ec8[_0x24fc('0x15')],_0x3df6f4);_0x3e6389(_0x574ba3[_0x24fc('0x13')](0x1f4,_0x4f4ec8[_0x24fc('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index 599a54a..56db0ad 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 _0xb772=['put','update','destroy','exports','multer','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerConfiguration.controller','get','/:id','show','isAuthenticated','/:id/subjects','/:id/descriptions','create'];(function(_0x15c421,_0x6366f7){var _0x5e5ed5=function(_0x206e66){while(--_0x206e66){_0x15c421['push'](_0x15c421['shift']());}};_0x5e5ed5(++_0x6366f7);}(_0xb772,0xfb));var _0x2b77=function(_0x1485ec,_0x4f5d8c){_0x1485ec=_0x1485ec-0x0;var _0x423000=_0xb772[_0x1485ec];return _0x423000;};'use strict';var multer=require(_0x2b77('0x0'));var util=require('util');var path=require(_0x2b77('0x1'));var timeout=require(_0x2b77('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x2b77('0x3'));var auth=require(_0x2b77('0x4'));var interaction=require(_0x2b77('0x5'));var config=require(_0x2b77('0x6'));var controller=require(_0x2b77('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x2b77('0x8')](_0x2b77('0x9'),auth['isAuthenticated'](),controller[_0x2b77('0xa')]);router[_0x2b77('0x8')]('/:id/fields',auth[_0x2b77('0xb')](),controller['getFields']);router[_0x2b77('0x8')](_0x2b77('0xc'),auth['isAuthenticated'](),controller['getSubjects']);router[_0x2b77('0x8')](_0x2b77('0xd'),auth[_0x2b77('0xb')](),controller['getDescriptions']);router['post']('/',auth[_0x2b77('0xb')](),controller[_0x2b77('0xe')]);router[_0x2b77('0xf')](_0x2b77('0x9'),auth['isAuthenticated'](),controller[_0x2b77('0x10')]);router['delete'](_0x2b77('0x9'),auth['isAuthenticated'](),controller[_0x2b77('0x11')]);module[_0x2b77('0x12')]=router; \ No newline at end of file +var _0x4412=['/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put','/:id','update','destroy','multer','util','connect-timeout','express','Router','../../components/auth/service','../../config/environment','isAuthenticated','get','show','/:id/fields'];(function(_0xa16567,_0x28f3c0){var _0x28ff4c=function(_0x2f374c){while(--_0x2f374c){_0xa16567['push'](_0xa16567['shift']());}};_0x28ff4c(++_0x28f3c0);}(_0x4412,0x130));var _0x2441=function(_0x535128,_0x24e02b){_0x535128=_0x535128-0x0;var _0x1de4a8=_0x4412[_0x535128];return _0x1de4a8;};'use strict';var multer=require(_0x2441('0x0'));var util=require(_0x2441('0x1'));var path=require('path');var timeout=require(_0x2441('0x2'));var express=require(_0x2441('0x3'));var router=express[_0x2441('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x2441('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x2441('0x6'));var controller=require('./intVtigerConfiguration.controller');router['get']('/',auth[_0x2441('0x7')](),controller['index']);router[_0x2441('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x2441('0x9')]);router['get'](_0x2441('0xa'),auth[_0x2441('0x7')](),controller['getFields']);router[_0x2441('0x8')](_0x2441('0xb'),auth[_0x2441('0x7')](),controller[_0x2441('0xc')]);router[_0x2441('0x8')](_0x2441('0xd'),auth[_0x2441('0x7')](),controller[_0x2441('0xe')]);router[_0x2441('0xf')]('/',auth[_0x2441('0x7')](),controller[_0x2441('0x10')]);router[_0x2441('0x11')](_0x2441('0x12'),auth[_0x2441('0x7')](),controller[_0x2441('0x13')]);router['delete'](_0x2441('0x12'),auth[_0x2441('0x7')](),controller[_0x2441('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js index db89e41..7d6073d 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 _0x308d=['sequelize','exports','STRING'];(function(_0x5c2502,_0x2c66a){var _0x3c2bf1=function(_0x5be190){while(--_0x5be190){_0x5c2502['push'](_0x5c2502['shift']());}};_0x3c2bf1(++_0x2c66a);}(_0x308d,0x84));var _0xd308=function(_0x111794,_0x3e9bdc){_0x111794=_0x111794-0x0;var _0x55114b=_0x308d[_0x111794];return _0x55114b;};'use strict';var Sequelize=require(_0xd308('0x0'));module[_0xd308('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xd308('0x2')]}}; \ No newline at end of file +var _0x7e87=['sequelize'];(function(_0x1942fe,_0x19f152){var _0x2a95a4=function(_0x1b98b6){while(--_0x1b98b6){_0x1942fe['push'](_0x1942fe['shift']());}};_0x2a95a4(++_0x19f152);}(_0x7e87,0xeb));var _0x77e8=function(_0xfccf09,_0xc6c445){_0xfccf09=_0xfccf09-0x0;var _0x1793ee=_0x7e87[_0xfccf09];return _0x1793ee;};'use strict';var Sequelize=require(_0x77e8('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js index 915c5e7..4d2175b 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 _0x59a0=['path','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range','apply','save','then','name','index','map','VtigerConfiguration','rawAttributes','fieldName','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','show','params','keys','find','catch','create','body','update','pick','getFields','findOne','VtigerField','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x59a0,0x184));var _0x059a=function(_0x2d2073,_0x2401d5){_0x2d2073=_0x2d2073-0x0;var _0x272aaa=_0x59a0[_0x2d2073];return _0x272aaa;};'use strict';var emlformat=require(_0x059a('0x0'));var rimraf=require(_0x059a('0x1'));var zipdir=require(_0x059a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x059a('0x3'));var moment=require(_0x059a('0x4'));var BPromise=require(_0x059a('0x5'));var Mustache=require(_0x059a('0x6'));var util=require('util');var path=require(_0x059a('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x059a('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x059a('0x9'));var squel=require(_0x059a('0xa'));var crypto=require(_0x059a('0xb'));var jsforce=require(_0x059a('0xc'));var deskjs=require(_0x059a('0xd'));var toCsv=require(_0x059a('0xe'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x059a('0xf'));var authService=require(_0x059a('0x10'));var qs=require(_0x059a('0x11'));var as=require(_0x059a('0x12'));var hardwareService=require(_0x059a('0x13'));var logger=require(_0x059a('0x14'))(_0x059a('0x15'));var utils=require(_0x059a('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x059a('0x17'));var db=require(_0x059a('0x18'))['db'];function respondWithStatusCode(_0x321146,_0x541108){_0x541108=_0x541108||0xcc;return function(_0x5bd78f){if(_0x5bd78f){return _0x321146[_0x059a('0x19')](_0x541108);}return _0x321146['status'](_0x541108)[_0x059a('0x1a')]();};}function respondWithResult(_0x3c5dcb,_0x52a634){_0x52a634=_0x52a634||0xc8;return function(_0xa9f4f){if(_0xa9f4f){return _0x3c5dcb[_0x059a('0x1b')](_0x52a634)[_0x059a('0x1c')](_0xa9f4f);}};}function respondWithFilteredResult(_0x33e526,_0x2f02f2){return function(_0x50fdb4){if(_0x50fdb4){var _0x2047e6=typeof _0x2f02f2[_0x059a('0x1d')]===_0x059a('0x1e')&&typeof _0x2f02f2[_0x059a('0x1f')]==='undefined';var _0x425ace=_0x50fdb4[_0x059a('0x20')];var _0x72c52d=_0x2047e6?0x0:_0x2f02f2[_0x059a('0x1d')];var _0x4e581b=_0x2047e6?_0x50fdb4[_0x059a('0x20')]:_0x2f02f2[_0x059a('0x1d')]+_0x2f02f2[_0x059a('0x1f')];var _0x76e0d9;if(_0x4e581b>=_0x425ace){_0x4e581b=_0x425ace;_0x76e0d9=0xc8;}else{_0x76e0d9=0xce;}_0x33e526['status'](_0x76e0d9);return _0x33e526['set'](_0x059a('0x21'),_0x72c52d+'-'+_0x4e581b+'/'+_0x425ace)[_0x059a('0x1c')](_0x50fdb4);}return null;};}function patchUpdates(_0x2cd746){return function(_0x38ab20){try{jsonpatch[_0x059a('0x22')](_0x38ab20,_0x2cd746,!![]);}catch(_0x4ee7e8){return BPromise['reject'](_0x4ee7e8);}return _0x38ab20[_0x059a('0x23')]();};}function saveUpdates(_0x384844,_0x13f449){return function(_0x84bb3b){if(_0x84bb3b){return _0x84bb3b['update'](_0x384844)[_0x059a('0x24')](function(_0x3c775b){return _0x3c775b;});}return null;};}function removeEntity(_0x356b9d,_0x244259){return function(_0x5ea859){if(_0x5ea859){return _0x5ea859['destroy']()[_0x059a('0x24')](function(){_0x356b9d['status'](0xcc)[_0x059a('0x1a')]();});}};}function handleEntityNotFound(_0xefebe4,_0x642a99){return function(_0x5e85f1){if(!_0x5e85f1){_0xefebe4[_0x059a('0x19')](0x194);}return _0x5e85f1;};}function handleError(_0x827a62,_0x75e88){_0x75e88=_0x75e88||0x1f4;return function(_0x4b6db9){logger['error'](_0x4b6db9['stack']);if(_0x4b6db9['name']){delete _0x4b6db9[_0x059a('0x25')];}_0x827a62[_0x059a('0x1b')](_0x75e88)['send'](_0x4b6db9);};}exports[_0x059a('0x26')]=function(_0x3b9200,_0xc0dbcc){var _0x50e593={},_0xb57d0a={},_0x4d64e5={'count':0x0,'rows':[]};var _0x50863b=_[_0x059a('0x27')](db[_0x059a('0x28')][_0x059a('0x29')],function(_0x35dfd9){return{'name':_0x35dfd9[_0x059a('0x2a')],'type':_0x35dfd9['type'][_0x059a('0x2b')]};});_0xb57d0a['model']=_[_0x059a('0x27')](_0x50863b,_0x059a('0x25'));_0xb57d0a[_0x059a('0x2c')]=_['keys'](_0x3b9200['query']);_0xb57d0a[_0x059a('0x2d')]=_[_0x059a('0x2e')](_0xb57d0a[_0x059a('0x2f')],_0xb57d0a[_0x059a('0x2c')]);_0x50e593[_0x059a('0x30')]=_['intersection'](_0xb57d0a[_0x059a('0x2f')],qs[_0x059a('0x31')](_0x3b9200[_0x059a('0x2c')][_0x059a('0x31')]));_0x50e593[_0x059a('0x30')]=_0x50e593[_0x059a('0x30')][_0x059a('0x32')]?_0x50e593['attributes']:_0xb57d0a['model'];if(!_0x3b9200[_0x059a('0x2c')][_0x059a('0x33')](_0x059a('0x34'))){_0x50e593[_0x059a('0x1f')]=qs[_0x059a('0x1f')](_0x3b9200[_0x059a('0x2c')][_0x059a('0x1f')]);_0x50e593[_0x059a('0x1d')]=qs[_0x059a('0x1d')](_0x3b9200['query'][_0x059a('0x1d')]);}_0x50e593[_0x059a('0x35')]=qs[_0x059a('0x36')](_0x3b9200[_0x059a('0x2c')][_0x059a('0x36')]);_0x50e593[_0x059a('0x37')]=qs['filters'](_['pick'](_0x3b9200['query'],_0xb57d0a[_0x059a('0x2d')]),_0x50863b);if(_0x3b9200[_0x059a('0x2c')][_0x059a('0x38')]){_0x50e593[_0x059a('0x37')]=_[_0x059a('0x39')](_0x50e593['where'],{'$or':_[_0x059a('0x27')](_0x50863b,function(_0x621c39){if(_0x621c39[_0x059a('0x3a')]!==_0x059a('0x3b')){var _0x342717={};_0x342717[_0x621c39[_0x059a('0x25')]]={'$like':'%'+_0x3b9200[_0x059a('0x2c')][_0x059a('0x38')]+'%'};return _0x342717;}})});}_0x50e593=_[_0x059a('0x39')]({},_0x50e593,_0x3b9200[_0x059a('0x3c')]);var _0x5ea328={'where':_0x50e593[_0x059a('0x37')]};return db[_0x059a('0x28')]['count'](_0x5ea328)[_0x059a('0x24')](function(_0xbd137f){_0x4d64e5[_0x059a('0x20')]=_0xbd137f;if(_0x3b9200[_0x059a('0x2c')][_0x059a('0x3d')]){_0x50e593[_0x059a('0x3e')]=[{'all':!![]}];}return db[_0x059a('0x28')][_0x059a('0x3f')](_0x50e593);})['then'](function(_0x2d4b9f){_0x4d64e5[_0x059a('0x40')]=_0x2d4b9f;return _0x4d64e5;})[_0x059a('0x24')](respondWithFilteredResult(_0xc0dbcc,_0x50e593))['catch'](handleError(_0xc0dbcc,null));};exports[_0x059a('0x41')]=function(_0x20fc07,_0x17e1f7){var _0x297804={'raw':![],'where':{'id':_0x20fc07[_0x059a('0x42')]['id']}},_0x592dd6={};_0x592dd6[_0x059a('0x2f')]=_[_0x059a('0x43')](db[_0x059a('0x28')]['rawAttributes']);_0x592dd6[_0x059a('0x2c')]=_['keys'](_0x20fc07[_0x059a('0x2c')]);_0x592dd6[_0x059a('0x2d')]=_[_0x059a('0x2e')](_0x592dd6['model'],_0x592dd6[_0x059a('0x2c')]);_0x297804['attributes']=_[_0x059a('0x2e')](_0x592dd6['model'],qs[_0x059a('0x31')](_0x20fc07[_0x059a('0x2c')]['fields']));_0x297804[_0x059a('0x30')]=_0x297804[_0x059a('0x30')][_0x059a('0x32')]?_0x297804[_0x059a('0x30')]:_0x592dd6['model'];if(_0x20fc07[_0x059a('0x2c')]['includeAll']){_0x297804['include']=[{'all':!![]}];}_0x297804=_[_0x059a('0x39')]({},_0x297804,_0x20fc07[_0x059a('0x3c')]);return db['VtigerConfiguration'][_0x059a('0x44')](_0x297804)[_0x059a('0x24')](handleEntityNotFound(_0x17e1f7,null))['then'](respondWithResult(_0x17e1f7,null))[_0x059a('0x45')](handleError(_0x17e1f7,null));};exports[_0x059a('0x46')]=function(_0x3054c7,_0x132d67){return db[_0x059a('0x28')]['create'](_0x3054c7[_0x059a('0x47')],{})[_0x059a('0x24')](respondWithResult(_0x132d67,0xc9))['catch'](handleError(_0x132d67,null));};exports[_0x059a('0x48')]=function(_0x4ab629,_0x2aaa32){if(_0x4ab629[_0x059a('0x47')]['id']){delete _0x4ab629[_0x059a('0x47')]['id'];}return db['VtigerConfiguration'][_0x059a('0x44')]({'where':{'id':_0x4ab629[_0x059a('0x42')]['id']}})[_0x059a('0x24')](handleEntityNotFound(_0x2aaa32,null))[_0x059a('0x24')](saveUpdates(_0x4ab629[_0x059a('0x47')],null))[_0x059a('0x24')](respondWithResult(_0x2aaa32,null))['catch'](handleError(_0x2aaa32,null));};exports['destroy']=function(_0xc32aff,_0x2ca113){return db[_0x059a('0x28')][_0x059a('0x44')]({'where':{'id':_0xc32aff[_0x059a('0x42')]['id']}})[_0x059a('0x24')](handleEntityNotFound(_0x2ca113,null))[_0x059a('0x24')](removeEntity(_0x2ca113,null))['catch'](handleError(_0x2ca113,null));};exports['getFields']=function(_0x1909ca,_0x8c094e,_0x128727){var _0x4c2e64={};var _0xdcc0d8={};var _0x2c7586;var _0x4699d4;return db[_0x059a('0x28')]['findOne']({'where':{'id':_0x1909ca['params']['id']}})[_0x059a('0x24')](handleEntityNotFound(_0x8c094e,null))['then'](function(_0x5adf8e){if(_0x5adf8e){_0x2c7586=_0x5adf8e;_0xdcc0d8['model']=_[_0x059a('0x43')](db['VtigerField'][_0x059a('0x29')]);_0xdcc0d8['query']=_[_0x059a('0x43')](_0x1909ca[_0x059a('0x2c')]);_0xdcc0d8['filters']=_[_0x059a('0x2e')](_0xdcc0d8[_0x059a('0x2f')],_0xdcc0d8['query']);_0x4c2e64[_0x059a('0x30')]=_[_0x059a('0x2e')](_0xdcc0d8[_0x059a('0x2f')],qs[_0x059a('0x31')](_0x1909ca[_0x059a('0x2c')][_0x059a('0x31')]));_0x4c2e64['attributes']=_0x4c2e64[_0x059a('0x30')][_0x059a('0x32')]?_0x4c2e64['attributes']:_0xdcc0d8['model'];_0x4c2e64[_0x059a('0x35')]=qs['sort'](_0x1909ca[_0x059a('0x2c')]['sort']);_0x4c2e64['where']=qs['filters'](_[_0x059a('0x49')](_0x1909ca[_0x059a('0x2c')],_0xdcc0d8[_0x059a('0x2d')]));if(_0x1909ca['query'][_0x059a('0x38')]){_0x4c2e64[_0x059a('0x37')]=_[_0x059a('0x39')](_0x4c2e64['where'],{'$or':_[_0x059a('0x27')](_0x4c2e64[_0x059a('0x30')],function(_0x4cdc05){var _0x1c5806={};_0x1c5806[_0x4cdc05]={'$like':'%'+_0x1909ca['query'][_0x059a('0x38')]+'%'};return _0x1c5806;})});}_0x4c2e64=_[_0x059a('0x39')]({},_0x4c2e64,_0x1909ca[_0x059a('0x3c')]);return _0x2c7586[_0x059a('0x4a')](_0x4c2e64);}})[_0x059a('0x24')](function(_0x24eed4){if(_0x24eed4){_0x4699d4=_0x24eed4[_0x059a('0x32')];if(!_0x1909ca[_0x059a('0x2c')][_0x059a('0x33')](_0x059a('0x34'))){_0x4c2e64[_0x059a('0x1f')]=qs['limit'](_0x1909ca['query']['limit']);_0x4c2e64[_0x059a('0x1d')]=qs[_0x059a('0x1d')](_0x1909ca['query']['offset']);}return _0x2c7586['getFields'](_0x4c2e64);}})['then'](function(_0x12d87e){if(_0x12d87e){return _0x12d87e?{'count':_0x4699d4,'rows':_0x12d87e}:null;}})[_0x059a('0x24')](respondWithResult(_0x8c094e,null))[_0x059a('0x45')](handleError(_0x8c094e,null));};exports['getSubjects']=function(_0x2d5815,_0x165cb9,_0x49a704){var _0x28c7c6={};var _0x1edd78={};var _0x519a7f;var _0x2c6f29;return db[_0x059a('0x28')][_0x059a('0x4b')]({'where':{'id':_0x2d5815['params']['id']}})['then'](handleEntityNotFound(_0x165cb9,null))[_0x059a('0x24')](function(_0x5449d9){if(_0x5449d9){_0x519a7f=_0x5449d9;_0x1edd78['model']=_[_0x059a('0x43')](db[_0x059a('0x4c')][_0x059a('0x29')]);_0x1edd78['query']=_[_0x059a('0x43')](_0x2d5815[_0x059a('0x2c')]);_0x1edd78[_0x059a('0x2d')]=_[_0x059a('0x2e')](_0x1edd78[_0x059a('0x2f')],_0x1edd78[_0x059a('0x2c')]);_0x28c7c6['attributes']=_[_0x059a('0x2e')](_0x1edd78[_0x059a('0x2f')],qs['fields'](_0x2d5815[_0x059a('0x2c')]['fields']));_0x28c7c6['attributes']=_0x28c7c6['attributes'][_0x059a('0x32')]?_0x28c7c6[_0x059a('0x30')]:_0x1edd78['model'];_0x28c7c6[_0x059a('0x35')]=qs[_0x059a('0x36')](_0x2d5815[_0x059a('0x2c')]['sort']);_0x28c7c6['where']=qs[_0x059a('0x2d')](_[_0x059a('0x49')](_0x2d5815[_0x059a('0x2c')],_0x1edd78['filters']));if(_0x2d5815[_0x059a('0x2c')]['filter']){_0x28c7c6[_0x059a('0x37')]=_[_0x059a('0x39')](_0x28c7c6[_0x059a('0x37')],{'$or':_['map'](_0x28c7c6['attributes'],function(_0x230adc){var _0x136ebe={};_0x136ebe[_0x230adc]={'$like':'%'+_0x2d5815[_0x059a('0x2c')][_0x059a('0x38')]+'%'};return _0x136ebe;})});}_0x28c7c6=_[_0x059a('0x39')]({},_0x28c7c6,_0x2d5815['options']);return _0x519a7f[_0x059a('0x4d')](_0x28c7c6);}})[_0x059a('0x24')](function(_0x399889){if(_0x399889){_0x2c6f29=_0x399889[_0x059a('0x32')];if(!_0x2d5815[_0x059a('0x2c')][_0x059a('0x33')]('nolimit')){_0x28c7c6[_0x059a('0x1f')]=qs[_0x059a('0x1f')](_0x2d5815[_0x059a('0x2c')][_0x059a('0x1f')]);_0x28c7c6[_0x059a('0x1d')]=qs['offset'](_0x2d5815['query'][_0x059a('0x1d')]);}return _0x519a7f[_0x059a('0x4d')](_0x28c7c6);}})['then'](function(_0x46f2b5){if(_0x46f2b5){return _0x46f2b5?{'count':_0x2c6f29,'rows':_0x46f2b5}:null;}})[_0x059a('0x24')](respondWithResult(_0x165cb9,null))[_0x059a('0x45')](handleError(_0x165cb9,null));};exports[_0x059a('0x4e')]=function(_0x70c8c,_0x1bf7c0,_0xb0d145){var _0x2c4539={};var _0x22c909={};var _0x2125aa;var _0x218be8;return db['VtigerConfiguration'][_0x059a('0x4b')]({'where':{'id':_0x70c8c['params']['id']}})[_0x059a('0x24')](handleEntityNotFound(_0x1bf7c0,null))[_0x059a('0x24')](function(_0x4d68c9){if(_0x4d68c9){_0x2125aa=_0x4d68c9;_0x22c909[_0x059a('0x2f')]=_['keys'](db['VtigerField'][_0x059a('0x29')]);_0x22c909[_0x059a('0x2c')]=_['keys'](_0x70c8c[_0x059a('0x2c')]);_0x22c909[_0x059a('0x2d')]=_[_0x059a('0x2e')](_0x22c909[_0x059a('0x2f')],_0x22c909[_0x059a('0x2c')]);_0x2c4539['attributes']=_[_0x059a('0x2e')](_0x22c909['model'],qs[_0x059a('0x31')](_0x70c8c[_0x059a('0x2c')][_0x059a('0x31')]));_0x2c4539[_0x059a('0x30')]=_0x2c4539[_0x059a('0x30')]['length']?_0x2c4539[_0x059a('0x30')]:_0x22c909[_0x059a('0x2f')];_0x2c4539[_0x059a('0x35')]=qs[_0x059a('0x36')](_0x70c8c['query'][_0x059a('0x36')]);_0x2c4539['where']=qs['filters'](_[_0x059a('0x49')](_0x70c8c[_0x059a('0x2c')],_0x22c909[_0x059a('0x2d')]));if(_0x70c8c['query'][_0x059a('0x38')]){_0x2c4539['where']=_[_0x059a('0x39')](_0x2c4539[_0x059a('0x37')],{'$or':_[_0x059a('0x27')](_0x2c4539[_0x059a('0x30')],function(_0x744f59){var _0xd0e9c2={};_0xd0e9c2[_0x744f59]={'$like':'%'+_0x70c8c[_0x059a('0x2c')][_0x059a('0x38')]+'%'};return _0xd0e9c2;})});}_0x2c4539=_['merge']({},_0x2c4539,_0x70c8c[_0x059a('0x3c')]);return _0x2125aa[_0x059a('0x4e')](_0x2c4539);}})[_0x059a('0x24')](function(_0x337811){if(_0x337811){_0x218be8=_0x337811[_0x059a('0x32')];if(!_0x70c8c[_0x059a('0x2c')][_0x059a('0x33')]('nolimit')){_0x2c4539['limit']=qs[_0x059a('0x1f')](_0x70c8c[_0x059a('0x2c')]['limit']);_0x2c4539[_0x059a('0x1d')]=qs[_0x059a('0x1d')](_0x70c8c[_0x059a('0x2c')][_0x059a('0x1d')]);}return _0x2125aa['getDescriptions'](_0x2c4539);}})[_0x059a('0x24')](function(_0x9b8b6){if(_0x9b8b6){return _0x9b8b6?{'count':_0x218be8,'rows':_0x9b8b6}:null;}})['then'](respondWithResult(_0x1bf7c0,null))[_0x059a('0x45')](handleError(_0x1bf7c0,null));}; \ No newline at end of file +var _0x86be=['merge','includeAll','findAll','rows','show','params','include','catch','create','body','find','getFields','VtigerField','options','getSubjects','findOne','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','end','stack','name','send','index','map','VtigerConfiguration','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter'];(function(_0x43d3b3,_0x1939aa){var _0x3fc7a9=function(_0x5215df){while(--_0x5215df){_0x43d3b3['push'](_0x43d3b3['shift']());}};_0x3fc7a9(++_0x1939aa);}(_0x86be,0x1b5));var _0xe86b=function(_0x4e9051,_0x59ec5e){_0x4e9051=_0x4e9051-0x0;var _0x3f0d7c=_0x86be[_0x4e9051];return _0x3f0d7c;};'use strict';var emlformat=require(_0xe86b('0x0'));var rimraf=require(_0xe86b('0x1'));var zipdir=require(_0xe86b('0x2'));var jsonpatch=require(_0xe86b('0x3'));var rp=require(_0xe86b('0x4'));var moment=require(_0xe86b('0x5'));var BPromise=require(_0xe86b('0x6'));var Mustache=require(_0xe86b('0x7'));var util=require(_0xe86b('0x8'));var path=require(_0xe86b('0x9'));var sox=require(_0xe86b('0xa'));var csv=require(_0xe86b('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe86b('0xc'));var _=require('lodash');var squel=require(_0xe86b('0xd'));var crypto=require('crypto');var jsforce=require(_0xe86b('0xe'));var deskjs=require(_0xe86b('0xf'));var toCsv=require('to-csv');var querystring=require(_0xe86b('0x10'));var Papa=require('papaparse');var Redis=require(_0xe86b('0x11'));var authService=require(_0xe86b('0x12'));var qs=require(_0xe86b('0x13'));var as=require(_0xe86b('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe86b('0x15'))(_0xe86b('0x16'));var utils=require(_0xe86b('0x17'));var config=require(_0xe86b('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xe86b('0x19'))['db'];function respondWithStatusCode(_0x15a859,_0x145ce9){_0x145ce9=_0x145ce9||0xcc;return function(_0x19b174){if(_0x19b174){return _0x15a859[_0xe86b('0x1a')](_0x145ce9);}return _0x15a859['status'](_0x145ce9)['end']();};}function respondWithResult(_0x3677a1,_0x21614d){_0x21614d=_0x21614d||0xc8;return function(_0x8e8606){if(_0x8e8606){return _0x3677a1[_0xe86b('0x1b')](_0x21614d)[_0xe86b('0x1c')](_0x8e8606);}};}function respondWithFilteredResult(_0x5f45fd,_0x4ce0d6){return function(_0x318c29){if(_0x318c29){var _0x585c2d=typeof _0x4ce0d6[_0xe86b('0x1d')]===_0xe86b('0x1e')&&typeof _0x4ce0d6['limit']===_0xe86b('0x1e');var _0x4b8e96=_0x318c29[_0xe86b('0x1f')];var _0x42f8ac=_0x585c2d?0x0:_0x4ce0d6['offset'];var _0x2eec52=_0x585c2d?_0x318c29[_0xe86b('0x1f')]:_0x4ce0d6['offset']+_0x4ce0d6[_0xe86b('0x20')];var _0x1b55a2;if(_0x2eec52>=_0x4b8e96){_0x2eec52=_0x4b8e96;_0x1b55a2=0xc8;}else{_0x1b55a2=0xce;}_0x5f45fd[_0xe86b('0x1b')](_0x1b55a2);return _0x5f45fd[_0xe86b('0x21')](_0xe86b('0x22'),_0x42f8ac+'-'+_0x2eec52+'/'+_0x4b8e96)['json'](_0x318c29);}return null;};}function patchUpdates(_0x58f491){return function(_0x9ea697){try{jsonpatch[_0xe86b('0x23')](_0x9ea697,_0x58f491,!![]);}catch(_0xb26f27){return BPromise[_0xe86b('0x24')](_0xb26f27);}return _0x9ea697[_0xe86b('0x25')]();};}function saveUpdates(_0x12321d,_0x34ad2d){return function(_0x3e1918){if(_0x3e1918){return _0x3e1918[_0xe86b('0x26')](_0x12321d)[_0xe86b('0x27')](function(_0x375d54){return _0x375d54;});}return null;};}function removeEntity(_0x1d3064,_0x49eec2){return function(_0x5903d9){if(_0x5903d9){return _0x5903d9[_0xe86b('0x28')]()[_0xe86b('0x27')](function(){_0x1d3064['status'](0xcc)[_0xe86b('0x29')]();});}};}function handleEntityNotFound(_0x5af486,_0x31c3f3){return function(_0x4c7a4e){if(!_0x4c7a4e){_0x5af486[_0xe86b('0x1a')](0x194);}return _0x4c7a4e;};}function handleError(_0x200ab6,_0x533043){_0x533043=_0x533043||0x1f4;return function(_0x25d248){logger['error'](_0x25d248[_0xe86b('0x2a')]);if(_0x25d248[_0xe86b('0x2b')]){delete _0x25d248['name'];}_0x200ab6[_0xe86b('0x1b')](_0x533043)[_0xe86b('0x2c')](_0x25d248);};}exports[_0xe86b('0x2d')]=function(_0x41e2d5,_0x5c3d17){var _0x489ed7={},_0x1e7941={},_0x29f799={'count':0x0,'rows':[]};var _0x2a3367=_[_0xe86b('0x2e')](db[_0xe86b('0x2f')][_0xe86b('0x30')],function(_0x508bef){return{'name':_0x508bef[_0xe86b('0x31')],'type':_0x508bef[_0xe86b('0x32')][_0xe86b('0x33')]};});_0x1e7941[_0xe86b('0x34')]=_[_0xe86b('0x2e')](_0x2a3367,_0xe86b('0x2b'));_0x1e7941[_0xe86b('0x35')]=_[_0xe86b('0x36')](_0x41e2d5[_0xe86b('0x35')]);_0x1e7941[_0xe86b('0x37')]=_[_0xe86b('0x38')](_0x1e7941[_0xe86b('0x34')],_0x1e7941[_0xe86b('0x35')]);_0x489ed7[_0xe86b('0x39')]=_[_0xe86b('0x38')](_0x1e7941[_0xe86b('0x34')],qs[_0xe86b('0x3a')](_0x41e2d5[_0xe86b('0x35')][_0xe86b('0x3a')]));_0x489ed7['attributes']=_0x489ed7[_0xe86b('0x39')][_0xe86b('0x3b')]?_0x489ed7['attributes']:_0x1e7941[_0xe86b('0x34')];if(!_0x41e2d5['query'][_0xe86b('0x3c')](_0xe86b('0x3d'))){_0x489ed7[_0xe86b('0x20')]=qs['limit'](_0x41e2d5['query'][_0xe86b('0x20')]);_0x489ed7[_0xe86b('0x1d')]=qs[_0xe86b('0x1d')](_0x41e2d5['query'][_0xe86b('0x1d')]);}_0x489ed7[_0xe86b('0x3e')]=qs[_0xe86b('0x3f')](_0x41e2d5[_0xe86b('0x35')]['sort']);_0x489ed7[_0xe86b('0x40')]=qs[_0xe86b('0x37')](_[_0xe86b('0x41')](_0x41e2d5[_0xe86b('0x35')],_0x1e7941[_0xe86b('0x37')]),_0x2a3367);if(_0x41e2d5['query'][_0xe86b('0x42')]){_0x489ed7[_0xe86b('0x40')]=_['merge'](_0x489ed7[_0xe86b('0x40')],{'$or':_['map'](_0x2a3367,function(_0x512823){if(_0x512823[_0xe86b('0x32')]!=='VIRTUAL'){var _0x54f7ad={};_0x54f7ad[_0x512823[_0xe86b('0x2b')]]={'$like':'%'+_0x41e2d5[_0xe86b('0x35')][_0xe86b('0x42')]+'%'};return _0x54f7ad;}})});}_0x489ed7=_[_0xe86b('0x43')]({},_0x489ed7,_0x41e2d5['options']);var _0x1d6d97={'where':_0x489ed7[_0xe86b('0x40')]};return db[_0xe86b('0x2f')][_0xe86b('0x1f')](_0x1d6d97)[_0xe86b('0x27')](function(_0x1333ba){_0x29f799[_0xe86b('0x1f')]=_0x1333ba;if(_0x41e2d5[_0xe86b('0x35')][_0xe86b('0x44')]){_0x489ed7['include']=[{'all':!![]}];}return db[_0xe86b('0x2f')][_0xe86b('0x45')](_0x489ed7);})[_0xe86b('0x27')](function(_0x2697d5){_0x29f799[_0xe86b('0x46')]=_0x2697d5;return _0x29f799;})['then'](respondWithFilteredResult(_0x5c3d17,_0x489ed7))['catch'](handleError(_0x5c3d17,null));};exports[_0xe86b('0x47')]=function(_0x34e169,_0x36cf2b){var _0x38df55={'raw':![],'where':{'id':_0x34e169[_0xe86b('0x48')]['id']}},_0x5f193d={};_0x5f193d['model']=_[_0xe86b('0x36')](db['VtigerConfiguration'][_0xe86b('0x30')]);_0x5f193d[_0xe86b('0x35')]=_[_0xe86b('0x36')](_0x34e169[_0xe86b('0x35')]);_0x5f193d[_0xe86b('0x37')]=_['intersection'](_0x5f193d['model'],_0x5f193d[_0xe86b('0x35')]);_0x38df55[_0xe86b('0x39')]=_['intersection'](_0x5f193d[_0xe86b('0x34')],qs[_0xe86b('0x3a')](_0x34e169[_0xe86b('0x35')]['fields']));_0x38df55[_0xe86b('0x39')]=_0x38df55['attributes']['length']?_0x38df55[_0xe86b('0x39')]:_0x5f193d[_0xe86b('0x34')];if(_0x34e169[_0xe86b('0x35')][_0xe86b('0x44')]){_0x38df55[_0xe86b('0x49')]=[{'all':!![]}];}_0x38df55=_['merge']({},_0x38df55,_0x34e169['options']);return db[_0xe86b('0x2f')]['find'](_0x38df55)[_0xe86b('0x27')](handleEntityNotFound(_0x36cf2b,null))[_0xe86b('0x27')](respondWithResult(_0x36cf2b,null))[_0xe86b('0x4a')](handleError(_0x36cf2b,null));};exports[_0xe86b('0x4b')]=function(_0x2ac988,_0x2ac609){return db[_0xe86b('0x2f')][_0xe86b('0x4b')](_0x2ac988[_0xe86b('0x4c')],{})[_0xe86b('0x27')](respondWithResult(_0x2ac609,0xc9))[_0xe86b('0x4a')](handleError(_0x2ac609,null));};exports['update']=function(_0xa27f8f,_0xd4182){if(_0xa27f8f['body']['id']){delete _0xa27f8f['body']['id'];}return db[_0xe86b('0x2f')][_0xe86b('0x4d')]({'where':{'id':_0xa27f8f[_0xe86b('0x48')]['id']}})[_0xe86b('0x27')](handleEntityNotFound(_0xd4182,null))[_0xe86b('0x27')](saveUpdates(_0xa27f8f[_0xe86b('0x4c')],null))[_0xe86b('0x27')](respondWithResult(_0xd4182,null))['catch'](handleError(_0xd4182,null));};exports[_0xe86b('0x28')]=function(_0x50235f,_0x52eff2){return db[_0xe86b('0x2f')][_0xe86b('0x4d')]({'where':{'id':_0x50235f[_0xe86b('0x48')]['id']}})[_0xe86b('0x27')](handleEntityNotFound(_0x52eff2,null))[_0xe86b('0x27')](removeEntity(_0x52eff2,null))[_0xe86b('0x4a')](handleError(_0x52eff2,null));};exports[_0xe86b('0x4e')]=function(_0x1bb0bd,_0x4510d6,_0x52af83){var _0x2b9baf={};var _0x1803a4={};var _0xa39de1;var _0x17f263;return db[_0xe86b('0x2f')]['findOne']({'where':{'id':_0x1bb0bd[_0xe86b('0x48')]['id']}})[_0xe86b('0x27')](handleEntityNotFound(_0x4510d6,null))['then'](function(_0x4114df){if(_0x4114df){_0xa39de1=_0x4114df;_0x1803a4[_0xe86b('0x34')]=_[_0xe86b('0x36')](db[_0xe86b('0x4f')]['rawAttributes']);_0x1803a4['query']=_[_0xe86b('0x36')](_0x1bb0bd['query']);_0x1803a4[_0xe86b('0x37')]=_[_0xe86b('0x38')](_0x1803a4[_0xe86b('0x34')],_0x1803a4[_0xe86b('0x35')]);_0x2b9baf[_0xe86b('0x39')]=_[_0xe86b('0x38')](_0x1803a4[_0xe86b('0x34')],qs[_0xe86b('0x3a')](_0x1bb0bd['query'][_0xe86b('0x3a')]));_0x2b9baf['attributes']=_0x2b9baf[_0xe86b('0x39')]['length']?_0x2b9baf['attributes']:_0x1803a4[_0xe86b('0x34')];_0x2b9baf[_0xe86b('0x3e')]=qs[_0xe86b('0x3f')](_0x1bb0bd[_0xe86b('0x35')][_0xe86b('0x3f')]);_0x2b9baf[_0xe86b('0x40')]=qs[_0xe86b('0x37')](_[_0xe86b('0x41')](_0x1bb0bd[_0xe86b('0x35')],_0x1803a4['filters']));if(_0x1bb0bd[_0xe86b('0x35')][_0xe86b('0x42')]){_0x2b9baf[_0xe86b('0x40')]=_[_0xe86b('0x43')](_0x2b9baf['where'],{'$or':_['map'](_0x2b9baf[_0xe86b('0x39')],function(_0x153f1b){var _0x1ee8ed={};_0x1ee8ed[_0x153f1b]={'$like':'%'+_0x1bb0bd[_0xe86b('0x35')][_0xe86b('0x42')]+'%'};return _0x1ee8ed;})});}_0x2b9baf=_[_0xe86b('0x43')]({},_0x2b9baf,_0x1bb0bd[_0xe86b('0x50')]);return _0xa39de1[_0xe86b('0x4e')](_0x2b9baf);}})['then'](function(_0x145120){if(_0x145120){_0x17f263=_0x145120[_0xe86b('0x3b')];if(!_0x1bb0bd['query'][_0xe86b('0x3c')](_0xe86b('0x3d'))){_0x2b9baf[_0xe86b('0x20')]=qs[_0xe86b('0x20')](_0x1bb0bd['query'][_0xe86b('0x20')]);_0x2b9baf[_0xe86b('0x1d')]=qs[_0xe86b('0x1d')](_0x1bb0bd[_0xe86b('0x35')][_0xe86b('0x1d')]);}return _0xa39de1[_0xe86b('0x4e')](_0x2b9baf);}})[_0xe86b('0x27')](function(_0x2b1fb6){if(_0x2b1fb6){return _0x2b1fb6?{'count':_0x17f263,'rows':_0x2b1fb6}:null;}})[_0xe86b('0x27')](respondWithResult(_0x4510d6,null))[_0xe86b('0x4a')](handleError(_0x4510d6,null));};exports[_0xe86b('0x51')]=function(_0x30e340,_0x42b854,_0x5db5e9){var _0x4e94bb={};var _0x2063b4={};var _0x1226cd;var _0x3523e9;return db[_0xe86b('0x2f')][_0xe86b('0x52')]({'where':{'id':_0x30e340[_0xe86b('0x48')]['id']}})[_0xe86b('0x27')](handleEntityNotFound(_0x42b854,null))[_0xe86b('0x27')](function(_0x1d8204){if(_0x1d8204){_0x1226cd=_0x1d8204;_0x2063b4['model']=_[_0xe86b('0x36')](db[_0xe86b('0x4f')]['rawAttributes']);_0x2063b4[_0xe86b('0x35')]=_[_0xe86b('0x36')](_0x30e340['query']);_0x2063b4[_0xe86b('0x37')]=_[_0xe86b('0x38')](_0x2063b4['model'],_0x2063b4['query']);_0x4e94bb[_0xe86b('0x39')]=_[_0xe86b('0x38')](_0x2063b4[_0xe86b('0x34')],qs['fields'](_0x30e340[_0xe86b('0x35')]['fields']));_0x4e94bb[_0xe86b('0x39')]=_0x4e94bb[_0xe86b('0x39')][_0xe86b('0x3b')]?_0x4e94bb[_0xe86b('0x39')]:_0x2063b4[_0xe86b('0x34')];_0x4e94bb['order']=qs[_0xe86b('0x3f')](_0x30e340[_0xe86b('0x35')][_0xe86b('0x3f')]);_0x4e94bb[_0xe86b('0x40')]=qs[_0xe86b('0x37')](_[_0xe86b('0x41')](_0x30e340['query'],_0x2063b4[_0xe86b('0x37')]));if(_0x30e340[_0xe86b('0x35')][_0xe86b('0x42')]){_0x4e94bb[_0xe86b('0x40')]=_[_0xe86b('0x43')](_0x4e94bb[_0xe86b('0x40')],{'$or':_['map'](_0x4e94bb[_0xe86b('0x39')],function(_0x15cf4f){var _0x64af41={};_0x64af41[_0x15cf4f]={'$like':'%'+_0x30e340[_0xe86b('0x35')][_0xe86b('0x42')]+'%'};return _0x64af41;})});}_0x4e94bb=_[_0xe86b('0x43')]({},_0x4e94bb,_0x30e340[_0xe86b('0x50')]);return _0x1226cd[_0xe86b('0x51')](_0x4e94bb);}})['then'](function(_0x1637b3){if(_0x1637b3){_0x3523e9=_0x1637b3[_0xe86b('0x3b')];if(!_0x30e340['query'][_0xe86b('0x3c')]('nolimit')){_0x4e94bb[_0xe86b('0x20')]=qs['limit'](_0x30e340[_0xe86b('0x35')][_0xe86b('0x20')]);_0x4e94bb[_0xe86b('0x1d')]=qs[_0xe86b('0x1d')](_0x30e340['query'][_0xe86b('0x1d')]);}return _0x1226cd[_0xe86b('0x51')](_0x4e94bb);}})[_0xe86b('0x27')](function(_0x95003d){if(_0x95003d){return _0x95003d?{'count':_0x3523e9,'rows':_0x95003d}:null;}})[_0xe86b('0x27')](respondWithResult(_0x42b854,null))[_0xe86b('0x4a')](handleError(_0x42b854,null));};exports[_0xe86b('0x53')]=function(_0x5b6dfc,_0x2f403a,_0x1913d4){var _0x383ee2={};var _0x3ba9db={};var _0x321fcc;var _0xae59b6;return db[_0xe86b('0x2f')][_0xe86b('0x52')]({'where':{'id':_0x5b6dfc[_0xe86b('0x48')]['id']}})[_0xe86b('0x27')](handleEntityNotFound(_0x2f403a,null))[_0xe86b('0x27')](function(_0x4b8a1a){if(_0x4b8a1a){_0x321fcc=_0x4b8a1a;_0x3ba9db[_0xe86b('0x34')]=_[_0xe86b('0x36')](db['VtigerField'][_0xe86b('0x30')]);_0x3ba9db[_0xe86b('0x35')]=_[_0xe86b('0x36')](_0x5b6dfc['query']);_0x3ba9db['filters']=_['intersection'](_0x3ba9db[_0xe86b('0x34')],_0x3ba9db['query']);_0x383ee2[_0xe86b('0x39')]=_[_0xe86b('0x38')](_0x3ba9db[_0xe86b('0x34')],qs[_0xe86b('0x3a')](_0x5b6dfc[_0xe86b('0x35')][_0xe86b('0x3a')]));_0x383ee2[_0xe86b('0x39')]=_0x383ee2[_0xe86b('0x39')][_0xe86b('0x3b')]?_0x383ee2[_0xe86b('0x39')]:_0x3ba9db[_0xe86b('0x34')];_0x383ee2['order']=qs[_0xe86b('0x3f')](_0x5b6dfc[_0xe86b('0x35')]['sort']);_0x383ee2['where']=qs[_0xe86b('0x37')](_['pick'](_0x5b6dfc[_0xe86b('0x35')],_0x3ba9db[_0xe86b('0x37')]));if(_0x5b6dfc[_0xe86b('0x35')]['filter']){_0x383ee2[_0xe86b('0x40')]=_[_0xe86b('0x43')](_0x383ee2[_0xe86b('0x40')],{'$or':_[_0xe86b('0x2e')](_0x383ee2[_0xe86b('0x39')],function(_0xe57610){var _0x4988d1={};_0x4988d1[_0xe57610]={'$like':'%'+_0x5b6dfc[_0xe86b('0x35')][_0xe86b('0x42')]+'%'};return _0x4988d1;})});}_0x383ee2=_[_0xe86b('0x43')]({},_0x383ee2,_0x5b6dfc['options']);return _0x321fcc[_0xe86b('0x53')](_0x383ee2);}})[_0xe86b('0x27')](function(_0x4b10fc){if(_0x4b10fc){_0xae59b6=_0x4b10fc[_0xe86b('0x3b')];if(!_0x5b6dfc[_0xe86b('0x35')][_0xe86b('0x3c')](_0xe86b('0x3d'))){_0x383ee2['limit']=qs[_0xe86b('0x20')](_0x5b6dfc[_0xe86b('0x35')][_0xe86b('0x20')]);_0x383ee2[_0xe86b('0x1d')]=qs['offset'](_0x5b6dfc[_0xe86b('0x35')]['offset']);}return _0x321fcc['getDescriptions'](_0x383ee2);}})['then'](function(_0x11d7c6){if(_0x11d7c6){return _0x11d7c6?{'count':_0xae59b6,'rows':_0x11d7c6}:null;}})[_0xe86b('0x27')](respondWithResult(_0x2f403a,null))[_0xe86b('0x4a')](handleError(_0x2f403a,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index a2f465a..fc0a7f6 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 _0x70e4=['util','../../config/logger','api','path','../../config/environment','./intVtigerConfiguration.attributes','exports','VtigerConfiguration','lodash'];(function(_0x3944d4,_0x422a31){var _0x3f74fb=function(_0x2f4028){while(--_0x2f4028){_0x3944d4['push'](_0x3944d4['shift']());}};_0x3f74fb(++_0x422a31);}(_0x70e4,0x19d));var _0x470e=function(_0x5ddaac,_0x2697a8){_0x5ddaac=_0x5ddaac-0x0;var _0x2a9c58=_0x70e4[_0x5ddaac];return _0x2a9c58;};'use strict';var _=require(_0x470e('0x0'));var util=require(_0x470e('0x1'));var logger=require(_0x470e('0x2'))(_0x470e('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x470e('0x4'));var rimraf=require('rimraf');var config=require(_0x470e('0x5'));var attributes=require(_0x470e('0x6'));module[_0x470e('0x7')]=function(_0x3f783b,_0x8c30a8){return _0x3f783b['define'](_0x470e('0x8'),attributes,{'tableName':'int_vtiger_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe22b=['./intVtigerConfiguration.attributes','exports','define','VtigerConfiguration','lodash','util','moment','bluebird','request-promise','path'];(function(_0x3145af,_0x53a1d5){var _0x37758a=function(_0x4b1627){while(--_0x4b1627){_0x3145af['push'](_0x3145af['shift']());}};_0x37758a(++_0x53a1d5);}(_0xe22b,0x72));var _0xbe22=function(_0x26402c,_0x1623a3){_0x26402c=_0x26402c-0x0;var _0x3a4ef4=_0xe22b[_0x26402c];return _0x3a4ef4;};'use strict';var _=require(_0xbe22('0x0'));var util=require(_0xbe22('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xbe22('0x2'));var BPromise=require(_0xbe22('0x3'));var rp=require(_0xbe22('0x4'));var fs=require('fs');var path=require(_0xbe22('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xbe22('0x6'));module[_0xbe22('0x7')]=function(_0x2b4c47,_0x509271){return _0x2b4c47[_0xbe22('0x8')](_0xbe22('0x9'),attributes,{'tableName':'int_vtiger_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.rpc.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.rpc.js index 17dcbc0..db0c2b3 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 _0x6b87=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils'];(function(_0x2dbd93,_0x4026b6){var _0x10a297=function(_0x5ae9d5){while(--_0x5ae9d5){_0x2dbd93['push'](_0x2dbd93['shift']());}};_0x10a297(++_0x4026b6);}(_0x6b87,0x14a));var _0x76b8=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x6b87[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x76b8('0x0'));var util=require(_0x76b8('0x1'));var moment=require('moment');var BPromise=require(_0x76b8('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x76b8('0x3'));var db=require(_0x76b8('0x4'))['db'];var utils=require(_0x76b8('0x5'));var logger=require(_0x76b8('0x6'))(_0x76b8('0x7'));var config=require(_0x76b8('0x8'));var jayson=require(_0x76b8('0x9'));var client=jayson[_0x76b8('0xa')][_0x76b8('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x34c31c,_0xeef62e,_0x4e76d7){return new BPromise(function(_0x114481,_0x4d7134){return client[_0x76b8('0xc')](_0x34c31c,_0x4e76d7)[_0x76b8('0xd')](function(_0x2fb6fb){logger[_0x76b8('0xe')](_0x76b8('0xf'),_0xeef62e,_0x76b8('0x10'));logger[_0x76b8('0x11')](_0x76b8('0x12'),_0xeef62e,_0x76b8('0x10'),JSON[_0x76b8('0x13')](_0x2fb6fb));if(_0x2fb6fb[_0x76b8('0x14')]){if(_0x2fb6fb['error'][_0x76b8('0x15')]===0x1f4){logger[_0x76b8('0x14')](_0x76b8('0xf'),_0xeef62e,_0x2fb6fb[_0x76b8('0x14')][_0x76b8('0x16')]);return _0x4d7134(_0x2fb6fb[_0x76b8('0x14')][_0x76b8('0x16')]);}logger[_0x76b8('0x14')]('VtigerConfiguration,\x20%s,\x20%s',_0xeef62e,_0x2fb6fb[_0x76b8('0x14')]['message']);return _0x114481(_0x2fb6fb[_0x76b8('0x14')][_0x76b8('0x16')]);}else{logger[_0x76b8('0xe')](_0x76b8('0xf'),_0xeef62e,_0x76b8('0x10'));_0x114481(_0x2fb6fb[_0x76b8('0x17')][_0x76b8('0x16')]);}})['catch'](function(_0x44e403){logger[_0x76b8('0x14')]('VtigerConfiguration,\x20%s,\x20%s',_0xeef62e,_0x44e403);_0x4d7134(_0x44e403);});});} \ No newline at end of file +var _0xd29a=['request','then','info','request\x20sent','VtigerConfiguration,\x20%s,\x20%s,\x20%s','error','code','VtigerConfiguration,\x20%s,\x20%s','message','catch','lodash','util','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http'];(function(_0x164b5b,_0x354855){var _0x4bf67f=function(_0x3c2589){while(--_0x3c2589){_0x164b5b['push'](_0x164b5b['shift']());}};_0x4bf67f(++_0x354855);}(_0xd29a,0x114));var _0xad29=function(_0x830d69,_0x50c662){_0x830d69=_0x830d69-0x0;var _0x205a08=_0xd29a[_0x830d69];return _0x205a08;};'use strict';var _=require(_0xad29('0x0'));var util=require(_0xad29('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xad29('0x2'));var db=require(_0xad29('0x3'))['db'];var utils=require(_0xad29('0x4'));var logger=require('../../config/logger')(_0xad29('0x5'));var config=require('../../config/environment');var jayson=require(_0xad29('0x6'));var client=jayson[_0xad29('0x7')][_0xad29('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x17d3d6,_0x3c98d7,_0x598ca5){return new BPromise(function(_0x106585,_0x2ccab6){return client[_0xad29('0x9')](_0x17d3d6,_0x598ca5)[_0xad29('0xa')](function(_0x286847){logger[_0xad29('0xb')]('VtigerConfiguration,\x20%s,\x20%s',_0x3c98d7,_0xad29('0xc'));logger['debug'](_0xad29('0xd'),_0x3c98d7,_0xad29('0xc'),JSON['stringify'](_0x286847));if(_0x286847[_0xad29('0xe')]){if(_0x286847['error'][_0xad29('0xf')]===0x1f4){logger[_0xad29('0xe')](_0xad29('0x10'),_0x3c98d7,_0x286847[_0xad29('0xe')][_0xad29('0x11')]);return _0x2ccab6(_0x286847['error'][_0xad29('0x11')]);}logger[_0xad29('0xe')](_0xad29('0x10'),_0x3c98d7,_0x286847[_0xad29('0xe')][_0xad29('0x11')]);return _0x106585(_0x286847['error']['message']);}else{logger[_0xad29('0xb')](_0xad29('0x10'),_0x3c98d7,_0xad29('0xc'));_0x106585(_0x286847['result']['message']);}})[_0xad29('0x12')](function(_0x154adb){logger[_0xad29('0xe')](_0xad29('0x10'),_0x3c98d7,_0x154adb);_0x2ccab6(_0x154adb);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index 32a1586..5965475 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 _0x64f5=['update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','get','isAuthenticated','index','/:id','post','create','put'];(function(_0x2a332d,_0x3d5865){var _0x5d24c4=function(_0x255e6c){while(--_0x255e6c){_0x2a332d['push'](_0x2a332d['shift']());}};_0x5d24c4(++_0x3d5865);}(_0x64f5,0x17e));var _0x564f=function(_0x2c2f3a,_0x5de935){_0x2c2f3a=_0x2c2f3a-0x0;var _0x42f4c8=_0x64f5[_0x2c2f3a];return _0x42f4c8;};'use strict';var multer=require(_0x564f('0x0'));var util=require(_0x564f('0x1'));var path=require(_0x564f('0x2'));var timeout=require(_0x564f('0x3'));var express=require('express');var router=express[_0x564f('0x4')]();var fs_extra=require(_0x564f('0x5'));var auth=require(_0x564f('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./intVtigerField.controller');router[_0x564f('0x7')]('/',auth[_0x564f('0x8')](),controller[_0x564f('0x9')]);router[_0x564f('0x7')](_0x564f('0xa'),auth[_0x564f('0x8')](),controller['show']);router[_0x564f('0xb')]('/',auth[_0x564f('0x8')](),controller[_0x564f('0xc')]);router[_0x564f('0xd')](_0x564f('0xa'),auth[_0x564f('0x8')](),controller[_0x564f('0xe')]);router[_0x564f('0xf')](_0x564f('0xa'),auth[_0x564f('0x8')](),controller[_0x564f('0x10')]);module[_0x564f('0x11')]=router; \ No newline at end of file +var _0xd6e3=['create','put','update','delete','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','get','/:id','isAuthenticated','show','post'];(function(_0x440617,_0x10b888){var _0x7c113a=function(_0x58d6ec){while(--_0x58d6ec){_0x440617['push'](_0x440617['shift']());}};_0x7c113a(++_0x10b888);}(_0xd6e3,0x1bf));var _0x3d6e=function(_0x2d4835,_0x25821d){_0x2d4835=_0x2d4835-0x0;var _0x46be08=_0xd6e3[_0x2d4835];return _0x46be08;};'use strict';var multer=require('multer');var util=require(_0x3d6e('0x0'));var path=require(_0x3d6e('0x1'));var timeout=require(_0x3d6e('0x2'));var express=require('express');var router=express[_0x3d6e('0x3')]();var fs_extra=require(_0x3d6e('0x4'));var auth=require(_0x3d6e('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x3d6e('0x6'));var controller=require('./intVtigerField.controller');router[_0x3d6e('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0x3d6e('0x7')](_0x3d6e('0x8'),auth[_0x3d6e('0x9')](),controller[_0x3d6e('0xa')]);router[_0x3d6e('0xb')]('/',auth['isAuthenticated'](),controller[_0x3d6e('0xc')]);router[_0x3d6e('0xd')](_0x3d6e('0x8'),auth['isAuthenticated'](),controller[_0x3d6e('0xe')]);router[_0x3d6e('0xf')](_0x3d6e('0x8'),auth[_0x3d6e('0x9')](),controller['destroy']);module[_0x3d6e('0x10')]=router; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.attributes.js b/server/api/intVtigerField/intVtigerField.attributes.js index e2f98e8..925ac52 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 _0x7657=['ENUM','string','customVariable','keyValue','picklist','STRING','variable','BOOLEAN','sequelize','exports'];(function(_0x2fe4e9,_0x2f18c4){var _0x2ccbf7=function(_0xba7035){while(--_0xba7035){_0x2fe4e9['push'](_0x2fe4e9['shift']());}};_0x2ccbf7(++_0x2f18c4);}(_0x7657,0x10c));var _0x7765=function(_0x1c6227,_0x576ad5){_0x1c6227=_0x1c6227-0x0;var _0x4762a7=_0x7657[_0x1c6227];return _0x4762a7;};'use strict';var Sequelize=require(_0x7765('0x0'));module[_0x7765('0x1')]={'type':{'type':Sequelize[_0x7765('0x2')](_0x7765('0x3'),'variable',_0x7765('0x4'),_0x7765('0x5'),_0x7765('0x6')),'defaultValue':_0x7765('0x3')},'content':{'type':Sequelize[_0x7765('0x7')]},'key':{'type':Sequelize[_0x7765('0x7')]},'keyType':{'type':Sequelize['ENUM'](_0x7765('0x3'),_0x7765('0x8'),_0x7765('0x4'))},'keyContent':{'type':Sequelize[_0x7765('0x7')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x7765('0x7')]},'customField':{'type':Sequelize[_0x7765('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x453c=['picklist','STRING','BOOLEAN','sequelize','exports','ENUM','string','variable','customVariable'];(function(_0x1044e5,_0x498e01){var _0x5ad0dd=function(_0x458548){while(--_0x458548){_0x1044e5['push'](_0x1044e5['shift']());}};_0x5ad0dd(++_0x498e01);}(_0x453c,0x78));var _0xc453=function(_0x1d50f2,_0x3c3ec6){_0x1d50f2=_0x1d50f2-0x0;var _0x3769b8=_0x453c[_0x1d50f2];return _0x3769b8;};'use strict';var Sequelize=require(_0xc453('0x0'));module[_0xc453('0x1')]={'type':{'type':Sequelize[_0xc453('0x2')](_0xc453('0x3'),_0xc453('0x4'),_0xc453('0x5'),'keyValue',_0xc453('0x6')),'defaultValue':_0xc453('0x3')},'content':{'type':Sequelize[_0xc453('0x7')]},'key':{'type':Sequelize[_0xc453('0x7')]},'keyType':{'type':Sequelize['ENUM'](_0xc453('0x3'),_0xc453('0x4'),_0xc453('0x5'))},'keyContent':{'type':Sequelize[_0xc453('0x7')]},'idField':{'type':Sequelize[_0xc453('0x7')]},'nameField':{'type':Sequelize[_0xc453('0x7')]},'customField':{'type':Sequelize[_0xc453('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xc453('0x7')]}}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.controller.js b/server/api/intVtigerField/intVtigerField.controller.js index 1d40f45..538a961 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 _0x8f88=['ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','apply','save','update','then','destroy','error','stack','name','send','index','VtigerField','type','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','filters','pick','filter','where','map','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','rawAttributes','include','find','create','body','rimraf','fast-json-patch','request-promise','moment','bluebird','to-csv','crypto','jsforce','desk.js','querystring','papaparse'];(function(_0x567fff,_0xd8acd8){var _0x465a37=function(_0x9d7bf7){while(--_0x9d7bf7){_0x567fff['push'](_0x567fff['shift']());}};_0x465a37(++_0xd8acd8);}(_0x8f88,0x19f));var _0x88f8=function(_0x506e4e,_0x1e893b){_0x506e4e=_0x506e4e-0x0;var _0x23719c=_0x8f88[_0x506e4e];return _0x23719c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x88f8('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x88f8('0x1'));var rp=require(_0x88f8('0x2'));var moment=require(_0x88f8('0x3'));var BPromise=require(_0x88f8('0x4'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x88f8('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x88f8('0x6'));var jsforce=require(_0x88f8('0x7'));var deskjs=require(_0x88f8('0x8'));var toCsv=require(_0x88f8('0x5'));var querystring=require(_0x88f8('0x9'));var Papa=require(_0x88f8('0xa'));var Redis=require(_0x88f8('0xb'));var authService=require(_0x88f8('0xc'));var qs=require(_0x88f8('0xd'));var as=require(_0x88f8('0xe'));var hardwareService=require(_0x88f8('0xf'));var logger=require(_0x88f8('0x10'))('api');var utils=require(_0x88f8('0x11'));var config=require(_0x88f8('0x12'));var licenseUtil=require(_0x88f8('0x13'));var db=require(_0x88f8('0x14'))['db'];function respondWithStatusCode(_0x1fce8c,_0x497d7b){_0x497d7b=_0x497d7b||0xcc;return function(_0x1de610){if(_0x1de610){return _0x1fce8c[_0x88f8('0x15')](_0x497d7b);}return _0x1fce8c[_0x88f8('0x16')](_0x497d7b)[_0x88f8('0x17')]();};}function respondWithResult(_0x2d065f,_0x577ebf){_0x577ebf=_0x577ebf||0xc8;return function(_0x245ced){if(_0x245ced){return _0x2d065f[_0x88f8('0x16')](_0x577ebf)[_0x88f8('0x18')](_0x245ced);}};}function respondWithFilteredResult(_0xe1e132,_0x5d4ab5){return function(_0x32a27c){if(_0x32a27c){var _0x2cc700=typeof _0x5d4ab5[_0x88f8('0x19')]==='undefined'&&typeof _0x5d4ab5[_0x88f8('0x1a')]===_0x88f8('0x1b');var _0x5da3ac=_0x32a27c[_0x88f8('0x1c')];var _0x5e4d1b=_0x2cc700?0x0:_0x5d4ab5[_0x88f8('0x19')];var _0x58dc89=_0x2cc700?_0x32a27c[_0x88f8('0x1c')]:_0x5d4ab5[_0x88f8('0x19')]+_0x5d4ab5['limit'];var _0x1167ae;if(_0x58dc89>=_0x5da3ac){_0x58dc89=_0x5da3ac;_0x1167ae=0xc8;}else{_0x1167ae=0xce;}_0xe1e132[_0x88f8('0x16')](_0x1167ae);return _0xe1e132['set'](_0x88f8('0x1d'),_0x5e4d1b+'-'+_0x58dc89+'/'+_0x5da3ac)[_0x88f8('0x18')](_0x32a27c);}return null;};}function patchUpdates(_0x3a6722){return function(_0xf2070){try{jsonpatch[_0x88f8('0x1e')](_0xf2070,_0x3a6722,!![]);}catch(_0x5436c4){return BPromise['reject'](_0x5436c4);}return _0xf2070[_0x88f8('0x1f')]();};}function saveUpdates(_0x389414,_0x319bf7){return function(_0x5dab14){if(_0x5dab14){return _0x5dab14[_0x88f8('0x20')](_0x389414)[_0x88f8('0x21')](function(_0x2ab045){return _0x2ab045;});}return null;};}function removeEntity(_0x1efeeb,_0xe31c2a){return function(_0x3a6e64){if(_0x3a6e64){return _0x3a6e64[_0x88f8('0x22')]()['then'](function(){_0x1efeeb[_0x88f8('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0xc4bff9,_0x11bdca){return function(_0x126f8d){if(!_0x126f8d){_0xc4bff9[_0x88f8('0x15')](0x194);}return _0x126f8d;};}function handleError(_0x4262f3,_0x2275c0){_0x2275c0=_0x2275c0||0x1f4;return function(_0x1d15cc){logger[_0x88f8('0x23')](_0x1d15cc[_0x88f8('0x24')]);if(_0x1d15cc[_0x88f8('0x25')]){delete _0x1d15cc[_0x88f8('0x25')];}_0x4262f3['status'](_0x2275c0)[_0x88f8('0x26')](_0x1d15cc);};}exports[_0x88f8('0x27')]=function(_0x1388b3,_0x2e77b0){var _0xcef673={},_0x44eb20={},_0x4ec89a={'count':0x0,'rows':[]};var _0x1c99cf=_['map'](db[_0x88f8('0x28')]['rawAttributes'],function(_0x3298d2){return{'name':_0x3298d2['fieldName'],'type':_0x3298d2[_0x88f8('0x29')][_0x88f8('0x2a')]};});_0x44eb20['model']=_['map'](_0x1c99cf,_0x88f8('0x25'));_0x44eb20[_0x88f8('0x2b')]=_[_0x88f8('0x2c')](_0x1388b3[_0x88f8('0x2b')]);_0x44eb20['filters']=_[_0x88f8('0x2d')](_0x44eb20[_0x88f8('0x2e')],_0x44eb20[_0x88f8('0x2b')]);_0xcef673[_0x88f8('0x2f')]=_[_0x88f8('0x2d')](_0x44eb20[_0x88f8('0x2e')],qs[_0x88f8('0x30')](_0x1388b3[_0x88f8('0x2b')][_0x88f8('0x30')]));_0xcef673['attributes']=_0xcef673[_0x88f8('0x2f')][_0x88f8('0x31')]?_0xcef673[_0x88f8('0x2f')]:_0x44eb20[_0x88f8('0x2e')];if(!_0x1388b3[_0x88f8('0x2b')][_0x88f8('0x32')](_0x88f8('0x33'))){_0xcef673[_0x88f8('0x1a')]=qs['limit'](_0x1388b3['query'][_0x88f8('0x1a')]);_0xcef673[_0x88f8('0x19')]=qs[_0x88f8('0x19')](_0x1388b3[_0x88f8('0x2b')][_0x88f8('0x19')]);}_0xcef673['order']=qs[_0x88f8('0x34')](_0x1388b3[_0x88f8('0x2b')][_0x88f8('0x34')]);_0xcef673['where']=qs[_0x88f8('0x35')](_[_0x88f8('0x36')](_0x1388b3[_0x88f8('0x2b')],_0x44eb20[_0x88f8('0x35')]),_0x1c99cf);if(_0x1388b3[_0x88f8('0x2b')][_0x88f8('0x37')]){_0xcef673[_0x88f8('0x38')]=_['merge'](_0xcef673[_0x88f8('0x38')],{'$or':_[_0x88f8('0x39')](_0x1c99cf,function(_0x54c941){if(_0x54c941[_0x88f8('0x29')]!==_0x88f8('0x3a')){var _0x3e9a13={};_0x3e9a13[_0x54c941[_0x88f8('0x25')]]={'$like':'%'+_0x1388b3[_0x88f8('0x2b')][_0x88f8('0x37')]+'%'};return _0x3e9a13;}})});}_0xcef673=_['merge']({},_0xcef673,_0x1388b3[_0x88f8('0x3b')]);var _0x496adf={'where':_0xcef673[_0x88f8('0x38')]};return db[_0x88f8('0x28')][_0x88f8('0x1c')](_0x496adf)['then'](function(_0x1b6e75){_0x4ec89a[_0x88f8('0x1c')]=_0x1b6e75;if(_0x1388b3[_0x88f8('0x2b')][_0x88f8('0x3c')]){_0xcef673['include']=[{'all':!![]}];}return db[_0x88f8('0x28')][_0x88f8('0x3d')](_0xcef673);})[_0x88f8('0x21')](function(_0x1cc4d6){_0x4ec89a[_0x88f8('0x3e')]=_0x1cc4d6;return _0x4ec89a;})[_0x88f8('0x21')](respondWithFilteredResult(_0x2e77b0,_0xcef673))[_0x88f8('0x3f')](handleError(_0x2e77b0,null));};exports[_0x88f8('0x40')]=function(_0x9d9bba,_0x48ba5e){var _0xd277ba={'raw':!![],'where':{'id':_0x9d9bba[_0x88f8('0x41')]['id']}},_0x5530ca={};_0x5530ca[_0x88f8('0x2e')]=_['keys'](db['VtigerField'][_0x88f8('0x42')]);_0x5530ca['query']=_[_0x88f8('0x2c')](_0x9d9bba[_0x88f8('0x2b')]);_0x5530ca[_0x88f8('0x35')]=_[_0x88f8('0x2d')](_0x5530ca[_0x88f8('0x2e')],_0x5530ca[_0x88f8('0x2b')]);_0xd277ba[_0x88f8('0x2f')]=_[_0x88f8('0x2d')](_0x5530ca[_0x88f8('0x2e')],qs[_0x88f8('0x30')](_0x9d9bba[_0x88f8('0x2b')][_0x88f8('0x30')]));_0xd277ba[_0x88f8('0x2f')]=_0xd277ba[_0x88f8('0x2f')][_0x88f8('0x31')]?_0xd277ba[_0x88f8('0x2f')]:_0x5530ca[_0x88f8('0x2e')];if(_0x9d9bba[_0x88f8('0x2b')]['includeAll']){_0xd277ba[_0x88f8('0x43')]=[{'all':!![]}];}_0xd277ba=_['merge']({},_0xd277ba,_0x9d9bba[_0x88f8('0x3b')]);return db[_0x88f8('0x28')][_0x88f8('0x44')](_0xd277ba)['then'](handleEntityNotFound(_0x48ba5e,null))[_0x88f8('0x21')](respondWithResult(_0x48ba5e,null))[_0x88f8('0x3f')](handleError(_0x48ba5e,null));};exports[_0x88f8('0x45')]=function(_0x3aef4e,_0x5bde78){return db[_0x88f8('0x28')][_0x88f8('0x45')](_0x3aef4e[_0x88f8('0x46')],{})[_0x88f8('0x21')](respondWithResult(_0x5bde78,0xc9))[_0x88f8('0x3f')](handleError(_0x5bde78,null));};exports[_0x88f8('0x20')]=function(_0x739e5,_0x42360f){if(_0x739e5[_0x88f8('0x46')]['id']){delete _0x739e5[_0x88f8('0x46')]['id'];}return db[_0x88f8('0x28')][_0x88f8('0x44')]({'where':{'id':_0x739e5[_0x88f8('0x41')]['id']}})[_0x88f8('0x21')](handleEntityNotFound(_0x42360f,null))[_0x88f8('0x21')](saveUpdates(_0x739e5[_0x88f8('0x46')],null))[_0x88f8('0x21')](respondWithResult(_0x42360f,null))[_0x88f8('0x3f')](handleError(_0x42360f,null));};exports['destroy']=function(_0x2c7b93,_0x2eb2ee){return db[_0x88f8('0x28')][_0x88f8('0x44')]({'where':{'id':_0x2c7b93['params']['id']}})[_0x88f8('0x21')](handleEntityNotFound(_0x2eb2ee,null))['then'](removeEntity(_0x2eb2ee,null))['catch'](handleError(_0x2eb2ee,null));}; \ No newline at end of file +var _0xaf0f=['catch','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','reject','save','update','then','destroy','name','send','map','rawAttributes','fieldName','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','VIRTUAL','options','VtigerField','include','findAll','params','find'];(function(_0x295a3d,_0x56d487){var _0x23a732=function(_0x15cfc2){while(--_0x15cfc2){_0x295a3d['push'](_0x295a3d['shift']());}};_0x23a732(++_0x56d487);}(_0xaf0f,0xde));var _0xfaf0=function(_0x3a940e,_0x6ca612){_0x3a940e=_0x3a940e-0x0;var _0x1414dd=_0xaf0f[_0x3a940e];return _0x1414dd;};'use strict';var emlformat=require(_0xfaf0('0x0'));var rimraf=require(_0xfaf0('0x1'));var zipdir=require(_0xfaf0('0x2'));var jsonpatch=require(_0xfaf0('0x3'));var rp=require(_0xfaf0('0x4'));var moment=require(_0xfaf0('0x5'));var BPromise=require(_0xfaf0('0x6'));var Mustache=require(_0xfaf0('0x7'));var util=require(_0xfaf0('0x8'));var path=require(_0xfaf0('0x9'));var sox=require(_0xfaf0('0xa'));var csv=require(_0xfaf0('0xb'));var ejs=require(_0xfaf0('0xc'));var fs=require('fs');var fs_extra=require(_0xfaf0('0xd'));var _=require(_0xfaf0('0xe'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xfaf0('0xf'));var deskjs=require(_0xfaf0('0x10'));var toCsv=require('to-csv');var querystring=require(_0xfaf0('0x11'));var Papa=require(_0xfaf0('0x12'));var Redis=require(_0xfaf0('0x13'));var authService=require(_0xfaf0('0x14'));var qs=require(_0xfaf0('0x15'));var as=require(_0xfaf0('0x16'));var hardwareService=require(_0xfaf0('0x17'));var logger=require(_0xfaf0('0x18'))(_0xfaf0('0x19'));var utils=require(_0xfaf0('0x1a'));var config=require(_0xfaf0('0x1b'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2289d3,_0x16f73e){_0x16f73e=_0x16f73e||0xcc;return function(_0x47db0d){if(_0x47db0d){return _0x2289d3[_0xfaf0('0x1c')](_0x16f73e);}return _0x2289d3[_0xfaf0('0x1d')](_0x16f73e)[_0xfaf0('0x1e')]();};}function respondWithResult(_0x1fe2b9,_0x3683ba){_0x3683ba=_0x3683ba||0xc8;return function(_0x3d9f4d){if(_0x3d9f4d){return _0x1fe2b9[_0xfaf0('0x1d')](_0x3683ba)[_0xfaf0('0x1f')](_0x3d9f4d);}};}function respondWithFilteredResult(_0x357275,_0x5afc39){return function(_0x675d8e){if(_0x675d8e){var _0x17b224=typeof _0x5afc39[_0xfaf0('0x20')]==='undefined'&&typeof _0x5afc39[_0xfaf0('0x21')]===_0xfaf0('0x22');var _0x2942aa=_0x675d8e[_0xfaf0('0x23')];var _0x1b4568=_0x17b224?0x0:_0x5afc39[_0xfaf0('0x20')];var _0x2488b6=_0x17b224?_0x675d8e[_0xfaf0('0x23')]:_0x5afc39[_0xfaf0('0x20')]+_0x5afc39[_0xfaf0('0x21')];var _0x8397a;if(_0x2488b6>=_0x2942aa){_0x2488b6=_0x2942aa;_0x8397a=0xc8;}else{_0x8397a=0xce;}_0x357275[_0xfaf0('0x1d')](_0x8397a);return _0x357275['set'](_0xfaf0('0x24'),_0x1b4568+'-'+_0x2488b6+'/'+_0x2942aa)[_0xfaf0('0x1f')](_0x675d8e);}return null;};}function patchUpdates(_0x5c3236){return function(_0x5ac6dc){try{jsonpatch['apply'](_0x5ac6dc,_0x5c3236,!![]);}catch(_0x245afc){return BPromise[_0xfaf0('0x25')](_0x245afc);}return _0x5ac6dc[_0xfaf0('0x26')]();};}function saveUpdates(_0x58387f,_0x39ed86){return function(_0x268d16){if(_0x268d16){return _0x268d16[_0xfaf0('0x27')](_0x58387f)[_0xfaf0('0x28')](function(_0x14a1e3){return _0x14a1e3;});}return null;};}function removeEntity(_0xc09626,_0x3a0a2a){return function(_0x2a4a65){if(_0x2a4a65){return _0x2a4a65[_0xfaf0('0x29')]()[_0xfaf0('0x28')](function(){_0xc09626[_0xfaf0('0x1d')](0xcc)[_0xfaf0('0x1e')]();});}};}function handleEntityNotFound(_0x436a1c,_0x1d67a8){return function(_0x1f4dde){if(!_0x1f4dde){_0x436a1c[_0xfaf0('0x1c')](0x194);}return _0x1f4dde;};}function handleError(_0x315de1,_0x31628e){_0x31628e=_0x31628e||0x1f4;return function(_0x47a1ca){logger['error'](_0x47a1ca['stack']);if(_0x47a1ca[_0xfaf0('0x2a')]){delete _0x47a1ca[_0xfaf0('0x2a')];}_0x315de1['status'](_0x31628e)[_0xfaf0('0x2b')](_0x47a1ca);};}exports['index']=function(_0x323ff4,_0x3416f9){var _0x23480d={},_0x430c6c={},_0x8d5065={'count':0x0,'rows':[]};var _0x3d0049=_[_0xfaf0('0x2c')](db['VtigerField'][_0xfaf0('0x2d')],function(_0x335cba){return{'name':_0x335cba[_0xfaf0('0x2e')],'type':_0x335cba['type']['key']};});_0x430c6c['model']=_['map'](_0x3d0049,_0xfaf0('0x2a'));_0x430c6c[_0xfaf0('0x2f')]=_[_0xfaf0('0x30')](_0x323ff4[_0xfaf0('0x2f')]);_0x430c6c[_0xfaf0('0x31')]=_['intersection'](_0x430c6c[_0xfaf0('0x32')],_0x430c6c['query']);_0x23480d[_0xfaf0('0x33')]=_[_0xfaf0('0x34')](_0x430c6c[_0xfaf0('0x32')],qs[_0xfaf0('0x35')](_0x323ff4[_0xfaf0('0x2f')][_0xfaf0('0x35')]));_0x23480d['attributes']=_0x23480d[_0xfaf0('0x33')][_0xfaf0('0x36')]?_0x23480d['attributes']:_0x430c6c[_0xfaf0('0x32')];if(!_0x323ff4[_0xfaf0('0x2f')][_0xfaf0('0x37')](_0xfaf0('0x38'))){_0x23480d['limit']=qs[_0xfaf0('0x21')](_0x323ff4[_0xfaf0('0x2f')][_0xfaf0('0x21')]);_0x23480d[_0xfaf0('0x20')]=qs['offset'](_0x323ff4[_0xfaf0('0x2f')][_0xfaf0('0x20')]);}_0x23480d[_0xfaf0('0x39')]=qs[_0xfaf0('0x3a')](_0x323ff4['query'][_0xfaf0('0x3a')]);_0x23480d[_0xfaf0('0x3b')]=qs[_0xfaf0('0x31')](_['pick'](_0x323ff4['query'],_0x430c6c[_0xfaf0('0x31')]),_0x3d0049);if(_0x323ff4[_0xfaf0('0x2f')][_0xfaf0('0x3c')]){_0x23480d[_0xfaf0('0x3b')]=_[_0xfaf0('0x3d')](_0x23480d[_0xfaf0('0x3b')],{'$or':_['map'](_0x3d0049,function(_0x551103){if(_0x551103[_0xfaf0('0x3e')]!==_0xfaf0('0x3f')){var _0x1005b5={};_0x1005b5[_0x551103[_0xfaf0('0x2a')]]={'$like':'%'+_0x323ff4[_0xfaf0('0x2f')][_0xfaf0('0x3c')]+'%'};return _0x1005b5;}})});}_0x23480d=_[_0xfaf0('0x3d')]({},_0x23480d,_0x323ff4[_0xfaf0('0x40')]);var _0x52d910={'where':_0x23480d[_0xfaf0('0x3b')]};return db[_0xfaf0('0x41')][_0xfaf0('0x23')](_0x52d910)['then'](function(_0x51241c){_0x8d5065['count']=_0x51241c;if(_0x323ff4['query']['includeAll']){_0x23480d[_0xfaf0('0x42')]=[{'all':!![]}];}return db[_0xfaf0('0x41')][_0xfaf0('0x43')](_0x23480d);})['then'](function(_0x57c3bc){_0x8d5065['rows']=_0x57c3bc;return _0x8d5065;})[_0xfaf0('0x28')](respondWithFilteredResult(_0x3416f9,_0x23480d))['catch'](handleError(_0x3416f9,null));};exports['show']=function(_0x20d0bc,_0x43be33){var _0x30b977={'raw':!![],'where':{'id':_0x20d0bc[_0xfaf0('0x44')]['id']}},_0x4ce2f4={};_0x4ce2f4[_0xfaf0('0x32')]=_[_0xfaf0('0x30')](db[_0xfaf0('0x41')]['rawAttributes']);_0x4ce2f4[_0xfaf0('0x2f')]=_[_0xfaf0('0x30')](_0x20d0bc[_0xfaf0('0x2f')]);_0x4ce2f4[_0xfaf0('0x31')]=_[_0xfaf0('0x34')](_0x4ce2f4[_0xfaf0('0x32')],_0x4ce2f4[_0xfaf0('0x2f')]);_0x30b977['attributes']=_[_0xfaf0('0x34')](_0x4ce2f4[_0xfaf0('0x32')],qs[_0xfaf0('0x35')](_0x20d0bc[_0xfaf0('0x2f')][_0xfaf0('0x35')]));_0x30b977[_0xfaf0('0x33')]=_0x30b977['attributes'][_0xfaf0('0x36')]?_0x30b977['attributes']:_0x4ce2f4[_0xfaf0('0x32')];if(_0x20d0bc[_0xfaf0('0x2f')]['includeAll']){_0x30b977[_0xfaf0('0x42')]=[{'all':!![]}];}_0x30b977=_[_0xfaf0('0x3d')]({},_0x30b977,_0x20d0bc[_0xfaf0('0x40')]);return db[_0xfaf0('0x41')][_0xfaf0('0x45')](_0x30b977)[_0xfaf0('0x28')](handleEntityNotFound(_0x43be33,null))['then'](respondWithResult(_0x43be33,null))[_0xfaf0('0x46')](handleError(_0x43be33,null));};exports[_0xfaf0('0x47')]=function(_0x51f020,_0x2ba3e9){return db[_0xfaf0('0x41')][_0xfaf0('0x47')](_0x51f020['body'],{})[_0xfaf0('0x28')](respondWithResult(_0x2ba3e9,0xc9))[_0xfaf0('0x46')](handleError(_0x2ba3e9,null));};exports[_0xfaf0('0x27')]=function(_0x1ed4c9,_0x30ed99){if(_0x1ed4c9['body']['id']){delete _0x1ed4c9[_0xfaf0('0x48')]['id'];}return db[_0xfaf0('0x41')][_0xfaf0('0x45')]({'where':{'id':_0x1ed4c9[_0xfaf0('0x44')]['id']}})[_0xfaf0('0x28')](handleEntityNotFound(_0x30ed99,null))[_0xfaf0('0x28')](saveUpdates(_0x1ed4c9[_0xfaf0('0x48')],null))[_0xfaf0('0x28')](respondWithResult(_0x30ed99,null))[_0xfaf0('0x46')](handleError(_0x30ed99,null));};exports[_0xfaf0('0x29')]=function(_0x240136,_0x18dd16){return db[_0xfaf0('0x41')][_0xfaf0('0x45')]({'where':{'id':_0x240136['params']['id']}})[_0xfaf0('0x28')](handleEntityNotFound(_0x18dd16,null))[_0xfaf0('0x28')](removeEntity(_0x18dd16,null))['catch'](handleError(_0x18dd16,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index b4c1e74..b13a75c 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 _0x6790=['define','VtigerField','int_vtiger_fields','vtiger_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird','path','./intVtigerField.attributes','exports'];(function(_0x4ae6ef,_0xc2af80){var _0x3cbb4e=function(_0x569ad5){while(--_0x569ad5){_0x4ae6ef['push'](_0x4ae6ef['shift']());}};_0x3cbb4e(++_0xc2af80);}(_0x6790,0x105));var _0x0679=function(_0x3a0f24,_0x55ddb7){_0x3a0f24=_0x3a0f24-0x0;var _0x3b6dd2=_0x6790[_0x3a0f24];return _0x3b6dd2;};'use strict';var _=require(_0x0679('0x0'));var util=require(_0x0679('0x1'));var logger=require(_0x0679('0x2'))(_0x0679('0x3'));var moment=require(_0x0679('0x4'));var BPromise=require(_0x0679('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0679('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x0679('0x7'));module[_0x0679('0x8')]=function(_0x5723c3,_0x41a409){return _0x5723c3[_0x0679('0x9')](_0x0679('0xa'),attributes,{'tableName':_0x0679('0xb'),'paranoid':![],'indexes':[{'name':_0x0679('0xc'),'fields':[_0x0679('0xd'),_0x0679('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1d22=['vtiger_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./intVtigerField.attributes','VtigerField','int_vtiger_fields'];(function(_0x414188,_0x3c81bd){var _0x209084=function(_0x49d6d0){while(--_0x49d6d0){_0x414188['push'](_0x414188['shift']());}};_0x209084(++_0x3c81bd);}(_0x1d22,0x6c));var _0x21d2=function(_0x315cb1,_0xa84f84){_0x315cb1=_0x315cb1-0x0;var _0xac454d=_0x1d22[_0x315cb1];return _0xac454d;};'use strict';var _=require(_0x21d2('0x0'));var util=require(_0x21d2('0x1'));var logger=require(_0x21d2('0x2'))(_0x21d2('0x3'));var moment=require(_0x21d2('0x4'));var BPromise=require(_0x21d2('0x5'));var rp=require(_0x21d2('0x6'));var fs=require('fs');var path=require(_0x21d2('0x7'));var rimraf=require(_0x21d2('0x8'));var config=require('../../config/environment');var attributes=require(_0x21d2('0x9'));module['exports']=function(_0x4d3742,_0x41a2e3){return _0x4d3742['define'](_0x21d2('0xa'),attributes,{'tableName':_0x21d2('0xb'),'paranoid':![],'indexes':[{'name':_0x21d2('0xc'),'fields':[_0x21d2('0xd'),_0x21d2('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.rpc.js b/server/api/intVtigerField/intVtigerField.rpc.js index 18038be..5eb538e 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 _0x5c38=['http','request','then','info','VtigerField,\x20%s,\x20%s','request\x20sent','debug','VtigerField,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client'];(function(_0x21255b,_0x18a038){var _0x401d85=function(_0x5179a1){while(--_0x5179a1){_0x21255b['push'](_0x21255b['shift']());}};_0x401d85(++_0x18a038);}(_0x5c38,0x1f0));var _0x85c3=function(_0x2bf66e,_0xfb08f0){_0x2bf66e=_0x2bf66e-0x0;var _0x10179b=_0x5c38[_0x2bf66e];return _0x10179b;};'use strict';var _=require(_0x85c3('0x0'));var util=require(_0x85c3('0x1'));var moment=require(_0x85c3('0x2'));var BPromise=require(_0x85c3('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x85c3('0x4'));var db=require(_0x85c3('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x85c3('0x6'))('rpc');var config=require(_0x85c3('0x7'));var jayson=require(_0x85c3('0x8'));var client=jayson[_0x85c3('0x9')][_0x85c3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1153bd,_0x4db231,_0x403e7f){return new BPromise(function(_0x358fb6,_0x154611){return client[_0x85c3('0xb')](_0x1153bd,_0x403e7f)[_0x85c3('0xc')](function(_0x50e0f4){logger[_0x85c3('0xd')](_0x85c3('0xe'),_0x4db231,_0x85c3('0xf'));logger[_0x85c3('0x10')](_0x85c3('0x11'),_0x4db231,_0x85c3('0xf'),JSON[_0x85c3('0x12')](_0x50e0f4));if(_0x50e0f4['error']){if(_0x50e0f4[_0x85c3('0x13')]['code']===0x1f4){logger['error'](_0x85c3('0xe'),_0x4db231,_0x50e0f4[_0x85c3('0x13')][_0x85c3('0x14')]);return _0x154611(_0x50e0f4['error']['message']);}logger[_0x85c3('0x13')](_0x85c3('0xe'),_0x4db231,_0x50e0f4[_0x85c3('0x13')]['message']);return _0x358fb6(_0x50e0f4[_0x85c3('0x13')][_0x85c3('0x14')]);}else{logger[_0x85c3('0xd')](_0x85c3('0xe'),_0x4db231,'request\x20sent');_0x358fb6(_0x50e0f4[_0x85c3('0x15')][_0x85c3('0x14')]);}})[_0x85c3('0x16')](function(_0x1571de){logger[_0x85c3('0x13')]('VtigerField,\x20%s,\x20%s',_0x4db231,_0x1571de);_0x154611(_0x1571de);});});} \ No newline at end of file +var _0x7d1a=['error','code','message','VtigerField,\x20%s,\x20%s','result','catch','lodash','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','then','info','request\x20sent','debug','VtigerField,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x420f2a,_0x2cc58d){var _0x28f802=function(_0x3329cc){while(--_0x3329cc){_0x420f2a['push'](_0x420f2a['shift']());}};_0x28f802(++_0x2cc58d);}(_0x7d1a,0xae));var _0xa7d1=function(_0x4a5a0e,_0x3c7fd2){_0x4a5a0e=_0x4a5a0e-0x0;var _0x62cc5c=_0x7d1a[_0x4a5a0e];return _0x62cc5c;};'use strict';var _=require(_0xa7d1('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xa7d1('0x1'));var rs=require(_0xa7d1('0x2'));var fs=require('fs');var Redis=require(_0xa7d1('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xa7d1('0x4'));var logger=require(_0xa7d1('0x5'))(_0xa7d1('0x6'));var config=require(_0xa7d1('0x7'));var jayson=require(_0xa7d1('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3f8f71,_0x38c23d,_0xe62247){return new BPromise(function(_0x56d4a3,_0x381ec0){return client['request'](_0x3f8f71,_0xe62247)[_0xa7d1('0x9')](function(_0x4fcc46){logger[_0xa7d1('0xa')]('VtigerField,\x20%s,\x20%s',_0x38c23d,_0xa7d1('0xb'));logger[_0xa7d1('0xc')](_0xa7d1('0xd'),_0x38c23d,'request\x20sent',JSON[_0xa7d1('0xe')](_0x4fcc46));if(_0x4fcc46[_0xa7d1('0xf')]){if(_0x4fcc46[_0xa7d1('0xf')][_0xa7d1('0x10')]===0x1f4){logger[_0xa7d1('0xf')]('VtigerField,\x20%s,\x20%s',_0x38c23d,_0x4fcc46[_0xa7d1('0xf')]['message']);return _0x381ec0(_0x4fcc46[_0xa7d1('0xf')][_0xa7d1('0x11')]);}logger[_0xa7d1('0xf')](_0xa7d1('0x12'),_0x38c23d,_0x4fcc46[_0xa7d1('0xf')]['message']);return _0x56d4a3(_0x4fcc46[_0xa7d1('0xf')][_0xa7d1('0x11')]);}else{logger[_0xa7d1('0xa')](_0xa7d1('0x12'),_0x38c23d,_0xa7d1('0xb'));_0x56d4a3(_0x4fcc46[_0xa7d1('0x13')][_0xa7d1('0x11')]);}})[_0xa7d1('0x14')](function(_0x130c95){logger[_0xa7d1('0xf')](_0xa7d1('0x12'),_0x38c23d,_0x130c95);_0x381ec0(_0x130c95);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index 53899cd..5447e84 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 _0xaf11=['get','index','/:id','isAuthenticated','getConfigurations','/:id/fields','getFields','post','create','/:id/configurations','addConfiguration','put','update','delete','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./intZendeskAccount.controller'];(function(_0x5c2e3e,_0x26ecd3){var _0x53f64a=function(_0x2b5df8){while(--_0x2b5df8){_0x5c2e3e['push'](_0x5c2e3e['shift']());}};_0x53f64a(++_0x26ecd3);}(_0xaf11,0x12f));var _0x1af1=function(_0x4b4190,_0x493353){_0x4b4190=_0x4b4190-0x0;var _0x6df6de=_0xaf11[_0x4b4190];return _0x6df6de;};'use strict';var multer=require(_0x1af1('0x0'));var util=require(_0x1af1('0x1'));var path=require(_0x1af1('0x2'));var timeout=require(_0x1af1('0x3'));var express=require('express');var router=express[_0x1af1('0x4')]();var fs_extra=require(_0x1af1('0x5'));var auth=require(_0x1af1('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x1af1('0x7'));var controller=require(_0x1af1('0x8'));router[_0x1af1('0x9')]('/',auth['isAuthenticated'](),controller[_0x1af1('0xa')]);router['get'](_0x1af1('0xb'),auth[_0x1af1('0xc')](),controller['show']);router[_0x1af1('0x9')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x1af1('0xd')]);router[_0x1af1('0x9')](_0x1af1('0xe'),auth[_0x1af1('0xc')](),controller[_0x1af1('0xf')]);router[_0x1af1('0x10')]('/',auth['isAuthenticated'](),controller[_0x1af1('0x11')]);router[_0x1af1('0x10')](_0x1af1('0x12'),auth[_0x1af1('0xc')](),controller[_0x1af1('0x13')]);router[_0x1af1('0x14')](_0x1af1('0xb'),auth['isAuthenticated'](),controller[_0x1af1('0x15')]);router[_0x1af1('0x16')](_0x1af1('0xb'),auth[_0x1af1('0xc')](),controller['destroy']);module[_0x1af1('0x17')]=router; \ No newline at end of file +var _0xe685=['/:id/fields','getFields','addConfiguration','put','update','/:id','destroy','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','show'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xe685,0x1ed));var _0x5e68=function(_0x136b97,_0x1eb433){_0x136b97=_0x136b97-0x0;var _0x261a19=_0xe685[_0x136b97];return _0x261a19;};'use strict';var multer=require('multer');var util=require(_0x5e68('0x0'));var path=require(_0x5e68('0x1'));var timeout=require('connect-timeout');var express=require(_0x5e68('0x2'));var router=express[_0x5e68('0x3')]();var fs_extra=require(_0x5e68('0x4'));var auth=require(_0x5e68('0x5'));var interaction=require(_0x5e68('0x6'));var config=require('../../config/environment');var controller=require('./intZendeskAccount.controller');router[_0x5e68('0x7')]('/',auth[_0x5e68('0x8')](),controller[_0x5e68('0x9')]);router[_0x5e68('0x7')]('/:id',auth[_0x5e68('0x8')](),controller[_0x5e68('0xa')]);router[_0x5e68('0x7')]('/:id/configurations',auth['isAuthenticated'](),controller['getConfigurations']);router[_0x5e68('0x7')](_0x5e68('0xb'),auth[_0x5e68('0x8')](),controller[_0x5e68('0xc')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/configurations',auth[_0x5e68('0x8')](),controller[_0x5e68('0xd')]);router[_0x5e68('0xe')]('/:id',auth[_0x5e68('0x8')](),controller[_0x5e68('0xf')]);router['delete'](_0x5e68('0x10'),auth['isAuthenticated'](),controller[_0x5e68('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.attributes.js b/server/api/intZendeskAccount/intZendeskAccount.attributes.js index 8adfa1c..4b844f0 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 _0x598a=['token','newTab','integrationTab','sequelize','exports','STRING','ENUM','password'];(function(_0x18f152,_0x41585a){var _0xa10b34=function(_0x1e9798){while(--_0x1e9798){_0x18f152['push'](_0x18f152['shift']());}};_0xa10b34(++_0x41585a);}(_0x598a,0xfb));var _0xa598=function(_0x1b738c,_0x5a54fb){_0x1b738c=_0x1b738c-0x0;var _0x188a82=_0x598a[_0x1b738c];return _0x188a82;};'use strict';var Sequelize=require(_0xa598('0x0'));module[_0xa598('0x1')]={'name':{'type':Sequelize[_0xa598('0x2')]},'description':{'type':Sequelize[_0xa598('0x2')]},'username':{'type':Sequelize[_0xa598('0x2')],'unique':'username'},'password':{'type':Sequelize[_0xa598('0x2')]},'token':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize['STRING'],'unique':'remoteUri'},'authType':{'type':Sequelize[_0xa598('0x3')](_0xa598('0x4'),_0xa598('0x5')),'defaultValue':_0xa598('0x4')},'serverUrl':{'type':Sequelize[_0xa598('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM']('integrationTab',_0xa598('0x6')),'defaultValue':_0xa598('0x7')}}; \ No newline at end of file +var _0x3e24=['exports','STRING','remoteUri','ENUM','password','token','newTab','integrationTab','sequelize'];(function(_0x42623f,_0x35ba47){var _0x1a7f0e=function(_0x26ee37){while(--_0x26ee37){_0x42623f['push'](_0x42623f['shift']());}};_0x1a7f0e(++_0x35ba47);}(_0x3e24,0x167));var _0x43e2=function(_0x2d7842,_0x5e1932){_0x2d7842=_0x2d7842-0x0;var _0x35485d=_0x3e24[_0x2d7842];return _0x35485d;};'use strict';var Sequelize=require(_0x43e2('0x0'));module[_0x43e2('0x1')]={'name':{'type':Sequelize[_0x43e2('0x2')]},'description':{'type':Sequelize[_0x43e2('0x2')]},'username':{'type':Sequelize[_0x43e2('0x2')],'unique':'username'},'password':{'type':Sequelize[_0x43e2('0x2')]},'token':{'type':Sequelize[_0x43e2('0x2')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0x43e2('0x3')},'authType':{'type':Sequelize[_0x43e2('0x4')](_0x43e2('0x5'),_0x43e2('0x6')),'defaultValue':_0x43e2('0x5')},'serverUrl':{'type':Sequelize[_0x43e2('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x43e2('0x4')]('integrationTab',_0x43e2('0x7')),'defaultValue':_0x43e2('0x8')}}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.controller.js b/server/api/intZendeskAccount/intZendeskAccount.controller.js index 11272d6..3f7dc78 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 _0xe511=['getConfigurations','addConfiguration','findOne','Subjects','getSubjects','channel','Descriptions','ZendeskConfiguration','create','getFields','username','password','authType','remoteUri','substring','format','ticket_fields','headers','Basic\x20%s','%s:%s','toString','token','%s/token:%s','base64','ValidationError','Unknown\x20authentication\x20type','subject','description','assignee','remove','includes','position','system_field_options','custom_field_options','send','test','statusCode','eml-format','rimraf','fast-json-patch','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','reject','update','then','stack','index','fieldName','type','key','model','map','name','query','keys','filters','attributes','intersection','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','ZendeskAccount','includeAll','include','findAll','catch','show','params','rawAttributes','fields','options','body','find','nolimit'];(function(_0xde041,_0xce2c39){var _0x4b0b98=function(_0x53532d){while(--_0x53532d){_0xde041['push'](_0xde041['shift']());}};_0x4b0b98(++_0xce2c39);}(_0xe511,0x16f));var _0x1e51=function(_0x53bec3,_0x550a58){_0x53bec3=_0x53bec3-0x0;var _0x159317=_0xe511[_0x53bec3];return _0x159317;};'use strict';var emlformat=require(_0x1e51('0x0'));var rimraf=require(_0x1e51('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1e51('0x2'));var rp=require('request-promise');var moment=require(_0x1e51('0x3'));var BPromise=require(_0x1e51('0x4'));var Mustache=require('mustache');var util=require(_0x1e51('0x5'));var path=require(_0x1e51('0x6'));var sox=require(_0x1e51('0x7'));var csv=require(_0x1e51('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1e51('0x9'));var _=require(_0x1e51('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x1e51('0xb'));var deskjs=require(_0x1e51('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x1e51('0xd'));var Redis=require(_0x1e51('0xe'));var authService=require(_0x1e51('0xf'));var qs=require(_0x1e51('0x10'));var as=require(_0x1e51('0x11'));var hardwareService=require(_0x1e51('0x12'));var logger=require('../../config/logger')(_0x1e51('0x13'));var utils=require(_0x1e51('0x14'));var config=require(_0x1e51('0x15'));var licenseUtil=require(_0x1e51('0x16'));var db=require(_0x1e51('0x17'))['db'];var integrations=require(_0x1e51('0x18'));function respondWithStatusCode(_0x5544eb,_0x408a77){_0x408a77=_0x408a77||0xcc;return function(_0x102f01){if(_0x102f01){return _0x5544eb[_0x1e51('0x19')](_0x408a77);}return _0x5544eb[_0x1e51('0x1a')](_0x408a77)[_0x1e51('0x1b')]();};}function respondWithResult(_0x32945d,_0x441c70){_0x441c70=_0x441c70||0xc8;return function(_0x467e77){if(_0x467e77){return _0x32945d[_0x1e51('0x1a')](_0x441c70)[_0x1e51('0x1c')](_0x467e77);}};}function respondWithFilteredResult(_0x5a5c07,_0x3b01b7){return function(_0x24db4f){if(_0x24db4f){var _0x4526b4=typeof _0x3b01b7['offset']===_0x1e51('0x1d')&&typeof _0x3b01b7['limit']==='undefined';var _0x1f6f4e=_0x24db4f[_0x1e51('0x1e')];var _0x40ae4c=_0x4526b4?0x0:_0x3b01b7[_0x1e51('0x1f')];var _0x4d1aae=_0x4526b4?_0x24db4f[_0x1e51('0x1e')]:_0x3b01b7['offset']+_0x3b01b7[_0x1e51('0x20')];var _0x4a9272;if(_0x4d1aae>=_0x1f6f4e){_0x4d1aae=_0x1f6f4e;_0x4a9272=0xc8;}else{_0x4a9272=0xce;}_0x5a5c07[_0x1e51('0x1a')](_0x4a9272);return _0x5a5c07[_0x1e51('0x21')](_0x1e51('0x22'),_0x40ae4c+'-'+_0x4d1aae+'/'+_0x1f6f4e)[_0x1e51('0x1c')](_0x24db4f);}return null;};}function patchUpdates(_0x506f40){return function(_0x5223c3){try{jsonpatch['apply'](_0x5223c3,_0x506f40,!![]);}catch(_0x548c32){return BPromise[_0x1e51('0x23')](_0x548c32);}return _0x5223c3['save']();};}function saveUpdates(_0x3f7340,_0x28aacb){return function(_0x415154){if(_0x415154){return _0x415154[_0x1e51('0x24')](_0x3f7340)[_0x1e51('0x25')](function(_0xf9298){return _0xf9298;});}return null;};}function removeEntity(_0x270adf,_0x461d3d){return function(_0x4bcdd3){if(_0x4bcdd3){return _0x4bcdd3['destroy']()[_0x1e51('0x25')](function(){_0x270adf[_0x1e51('0x1a')](0xcc)[_0x1e51('0x1b')]();});}};}function handleEntityNotFound(_0x1386db,_0x505d79){return function(_0x54d031){if(!_0x54d031){_0x1386db['sendStatus'](0x194);}return _0x54d031;};}function handleError(_0x1eb83f,_0x2a1561){_0x2a1561=_0x2a1561||0x1f4;return function(_0x433c2d){logger['error'](_0x433c2d[_0x1e51('0x26')]);if(_0x433c2d['name']){delete _0x433c2d['name'];}_0x1eb83f[_0x1e51('0x1a')](_0x2a1561)['send'](_0x433c2d);};}exports[_0x1e51('0x27')]=function(_0x1eb79f,_0x56722f){var _0x3e6ef2={},_0x10ee23={},_0x71c7af={'count':0x0,'rows':[]};var _0x6862d1=_['map'](db['ZendeskAccount']['rawAttributes'],function(_0x20eb9b){return{'name':_0x20eb9b[_0x1e51('0x28')],'type':_0x20eb9b[_0x1e51('0x29')][_0x1e51('0x2a')]};});_0x10ee23[_0x1e51('0x2b')]=_[_0x1e51('0x2c')](_0x6862d1,_0x1e51('0x2d'));_0x10ee23[_0x1e51('0x2e')]=_[_0x1e51('0x2f')](_0x1eb79f[_0x1e51('0x2e')]);_0x10ee23[_0x1e51('0x30')]=_['intersection'](_0x10ee23[_0x1e51('0x2b')],_0x10ee23[_0x1e51('0x2e')]);_0x3e6ef2[_0x1e51('0x31')]=_[_0x1e51('0x32')](_0x10ee23[_0x1e51('0x2b')],qs['fields'](_0x1eb79f[_0x1e51('0x2e')]['fields']));_0x3e6ef2[_0x1e51('0x31')]=_0x3e6ef2[_0x1e51('0x31')][_0x1e51('0x33')]?_0x3e6ef2['attributes']:_0x10ee23[_0x1e51('0x2b')];if(!_0x1eb79f['query'][_0x1e51('0x34')]('nolimit')){_0x3e6ef2['limit']=qs[_0x1e51('0x20')](_0x1eb79f[_0x1e51('0x2e')][_0x1e51('0x20')]);_0x3e6ef2['offset']=qs[_0x1e51('0x1f')](_0x1eb79f['query'][_0x1e51('0x1f')]);}_0x3e6ef2[_0x1e51('0x35')]=qs['sort'](_0x1eb79f[_0x1e51('0x2e')][_0x1e51('0x36')]);_0x3e6ef2[_0x1e51('0x37')]=qs[_0x1e51('0x30')](_[_0x1e51('0x38')](_0x1eb79f[_0x1e51('0x2e')],_0x10ee23['filters']),_0x6862d1);if(_0x1eb79f['query'][_0x1e51('0x39')]){_0x3e6ef2['where']=_[_0x1e51('0x3a')](_0x3e6ef2[_0x1e51('0x37')],{'$or':_[_0x1e51('0x2c')](_0x6862d1,function(_0xcfa1d8){if(_0xcfa1d8[_0x1e51('0x29')]!==_0x1e51('0x3b')){var _0x845a62={};_0x845a62[_0xcfa1d8[_0x1e51('0x2d')]]={'$like':'%'+_0x1eb79f[_0x1e51('0x2e')][_0x1e51('0x39')]+'%'};return _0x845a62;}})});}_0x3e6ef2=_[_0x1e51('0x3a')]({},_0x3e6ef2,_0x1eb79f['options']);var _0x29a689={'where':_0x3e6ef2['where']};return db[_0x1e51('0x3c')][_0x1e51('0x1e')](_0x29a689)[_0x1e51('0x25')](function(_0x471386){_0x71c7af[_0x1e51('0x1e')]=_0x471386;if(_0x1eb79f[_0x1e51('0x2e')][_0x1e51('0x3d')]){_0x3e6ef2[_0x1e51('0x3e')]=[{'all':!![]}];}return db[_0x1e51('0x3c')][_0x1e51('0x3f')](_0x3e6ef2);})[_0x1e51('0x25')](function(_0x5b4b3f){_0x71c7af['rows']=_0x5b4b3f;return _0x71c7af;})[_0x1e51('0x25')](respondWithFilteredResult(_0x56722f,_0x3e6ef2))[_0x1e51('0x40')](handleError(_0x56722f,null));};exports[_0x1e51('0x41')]=function(_0x4650e4,_0x1ef3d3){var _0x1a9e0d={'raw':![],'where':{'id':_0x4650e4[_0x1e51('0x42')]['id']}},_0x25592c={};_0x25592c['model']=_[_0x1e51('0x2f')](db[_0x1e51('0x3c')][_0x1e51('0x43')]);_0x25592c[_0x1e51('0x2e')]=_[_0x1e51('0x2f')](_0x4650e4[_0x1e51('0x2e')]);_0x25592c[_0x1e51('0x30')]=_['intersection'](_0x25592c[_0x1e51('0x2b')],_0x25592c[_0x1e51('0x2e')]);_0x1a9e0d['attributes']=_[_0x1e51('0x32')](_0x25592c[_0x1e51('0x2b')],qs[_0x1e51('0x44')](_0x4650e4['query'][_0x1e51('0x44')]));_0x1a9e0d[_0x1e51('0x31')]=_0x1a9e0d[_0x1e51('0x31')][_0x1e51('0x33')]?_0x1a9e0d[_0x1e51('0x31')]:_0x25592c[_0x1e51('0x2b')];if(_0x4650e4[_0x1e51('0x2e')][_0x1e51('0x3d')]){_0x1a9e0d[_0x1e51('0x3e')]=[{'all':!![]}];}_0x1a9e0d=_['merge']({},_0x1a9e0d,_0x4650e4[_0x1e51('0x45')]);return db[_0x1e51('0x3c')]['find'](_0x1a9e0d)[_0x1e51('0x25')](handleEntityNotFound(_0x1ef3d3,null))[_0x1e51('0x25')](respondWithResult(_0x1ef3d3,null))[_0x1e51('0x40')](handleError(_0x1ef3d3,null));};exports['create']=function(_0x44468a,_0x4634de){return db[_0x1e51('0x3c')]['create'](_0x44468a[_0x1e51('0x46')],{})['then'](respondWithResult(_0x4634de,0xc9))['catch'](handleError(_0x4634de,null));};exports['update']=function(_0x169e6c,_0x2e79ca){if(_0x169e6c['body']['id']){delete _0x169e6c['body']['id'];}return db[_0x1e51('0x3c')][_0x1e51('0x47')]({'where':{'id':_0x169e6c[_0x1e51('0x42')]['id']}})[_0x1e51('0x25')](handleEntityNotFound(_0x2e79ca,null))[_0x1e51('0x25')](saveUpdates(_0x169e6c[_0x1e51('0x46')],null))['then'](respondWithResult(_0x2e79ca,null))[_0x1e51('0x40')](handleError(_0x2e79ca,null));};exports['destroy']=function(_0xf6bd35,_0x43589a){return db['ZendeskAccount']['find']({'where':{'id':_0xf6bd35['params']['id']}})[_0x1e51('0x25')](handleEntityNotFound(_0x43589a,null))[_0x1e51('0x25')](removeEntity(_0x43589a,null))[_0x1e51('0x40')](handleError(_0x43589a,null));};exports['getConfigurations']=function(_0x2fdee1,_0x1fe669,_0x4226da){var _0x2100d4={};var _0x1ccb55={};var _0x12584c;var _0x32fe1f;return db[_0x1e51('0x3c')]['findOne']({'where':{'id':_0x2fdee1[_0x1e51('0x42')]['id']}})[_0x1e51('0x25')](handleEntityNotFound(_0x1fe669,null))[_0x1e51('0x25')](function(_0x213edb){if(_0x213edb){_0x12584c=_0x213edb;_0x1ccb55[_0x1e51('0x2b')]=_[_0x1e51('0x2f')](db['ZendeskConfiguration'][_0x1e51('0x43')]);_0x1ccb55['query']=_['keys'](_0x2fdee1['query']);_0x1ccb55[_0x1e51('0x30')]=_[_0x1e51('0x32')](_0x1ccb55[_0x1e51('0x2b')],_0x1ccb55['query']);_0x2100d4[_0x1e51('0x31')]=_[_0x1e51('0x32')](_0x1ccb55[_0x1e51('0x2b')],qs['fields'](_0x2fdee1[_0x1e51('0x2e')][_0x1e51('0x44')]));_0x2100d4[_0x1e51('0x31')]=_0x2100d4['attributes'][_0x1e51('0x33')]?_0x2100d4[_0x1e51('0x31')]:_0x1ccb55[_0x1e51('0x2b')];_0x2100d4[_0x1e51('0x35')]=qs[_0x1e51('0x36')](_0x2fdee1[_0x1e51('0x2e')][_0x1e51('0x36')]);_0x2100d4[_0x1e51('0x37')]=qs['filters'](_[_0x1e51('0x38')](_0x2fdee1[_0x1e51('0x2e')],_0x1ccb55['filters']));if(_0x2fdee1['query']['filter']){_0x2100d4[_0x1e51('0x37')]=_[_0x1e51('0x3a')](_0x2100d4[_0x1e51('0x37')],{'$or':_[_0x1e51('0x2c')](_0x2100d4[_0x1e51('0x31')],function(_0x3c322c){var _0x45b649={};_0x45b649[_0x3c322c]={'$like':'%'+_0x2fdee1[_0x1e51('0x2e')][_0x1e51('0x39')]+'%'};return _0x45b649;})});}_0x2100d4=_['merge']({},_0x2100d4,_0x2fdee1['options']);return _0x12584c['getConfigurations'](_0x2100d4);}})[_0x1e51('0x25')](function(_0x4048a4){if(_0x4048a4){_0x32fe1f=_0x4048a4['length'];if(!_0x2fdee1['query'][_0x1e51('0x34')](_0x1e51('0x48'))){_0x2100d4['limit']=qs[_0x1e51('0x20')](_0x2fdee1[_0x1e51('0x2e')][_0x1e51('0x20')]);_0x2100d4[_0x1e51('0x1f')]=qs[_0x1e51('0x1f')](_0x2fdee1[_0x1e51('0x2e')][_0x1e51('0x1f')]);}return _0x12584c[_0x1e51('0x49')](_0x2100d4);}})[_0x1e51('0x25')](function(_0x32863f){if(_0x32863f){return _0x32863f?{'count':_0x32fe1f,'rows':_0x32863f}:null;}})['then'](respondWithResult(_0x1fe669,null))[_0x1e51('0x40')](handleError(_0x1fe669,null));};exports[_0x1e51('0x4a')]=function(_0x3657a2,_0x402bbd,_0xc720e2){if(_0x3657a2[_0x1e51('0x46')]['id']){delete _0x3657a2['body']['id'];}return db['ZendeskAccount'][_0x1e51('0x4b')]({'where':{'id':_0x3657a2[_0x1e51('0x42')]['id']}})[_0x1e51('0x25')](handleEntityNotFound(_0x402bbd,null))[_0x1e51('0x25')](function(_0x52a439){if(_0x52a439){_0x3657a2['body']['AccountId']=_0x52a439['id'];_0x3657a2[_0x1e51('0x46')][_0x1e51('0x4c')]=integrations[_0x1e51('0x4d')](_0x3657a2[_0x1e51('0x46')][_0x1e51('0x4e')],_0x3657a2['body'][_0x1e51('0x29')]);_0x3657a2[_0x1e51('0x46')][_0x1e51('0x4f')]=integrations['getDescriptions'](_0x3657a2[_0x1e51('0x46')][_0x1e51('0x4e')],_0x3657a2[_0x1e51('0x46')]['type']);return db[_0x1e51('0x50')][_0x1e51('0x51')](_0x3657a2['body'],{'include':[{'model':db['ZendeskField'],'as':_0x1e51('0x4c')},{'model':db['ZendeskField'],'as':_0x1e51('0x4f')}]});}return null;})['then'](respondWithResult(_0x402bbd,null))[_0x1e51('0x40')](handleError(_0x402bbd,null));};exports[_0x1e51('0x52')]=function(_0x35f12e,_0x457e4a,_0x5142ed){var _0x37f3e6='';return db['ZendeskAccount']['findOne']({'where':{'id':_0x35f12e[_0x1e51('0x42')]['id']},'attributes':['id',_0x1e51('0x53'),_0x1e51('0x54'),'token',_0x1e51('0x55'),_0x1e51('0x56')]})[_0x1e51('0x25')](handleEntityNotFound(_0x457e4a,null))[_0x1e51('0x25')](function(_0x5b76ae){if(_0x5b76ae){_0x37f3e6=_0x5b76ae[_0x1e51('0x56')];var _0x5ef17b=_0x37f3e6['slice'](-0x1);if(_0x5ef17b==='/'){_0x37f3e6=_0x37f3e6[_0x1e51('0x57')](0x0,_0x37f3e6['lastIndexOf'](_0x5ef17b));}var _0x35ece9={'method':'GET','uri':util[_0x1e51('0x58')]('%s/%s',_0x37f3e6,_0x1e51('0x59')),'json':!![]};switch(_0x5b76ae[_0x1e51('0x55')]){case'password':_0x35ece9[_0x1e51('0x5a')]={'Authorization':util['format'](_0x1e51('0x5b'),new Buffer(util[_0x1e51('0x58')](_0x1e51('0x5c'),_0x5b76ae[_0x1e51('0x53')],_0x5b76ae[_0x1e51('0x54')]))[_0x1e51('0x5d')]('base64'))};break;case _0x1e51('0x5e'):_0x35ece9['headers']={'Authorization':util['format'](_0x1e51('0x5b'),new Buffer(util[_0x1e51('0x58')](_0x1e51('0x5f'),_0x5b76ae[_0x1e51('0x53')],_0x5b76ae[_0x1e51('0x5e')]))[_0x1e51('0x5d')](_0x1e51('0x60')))};break;default:throw new db['Sequelize'][(_0x1e51('0x61'))](_0x1e51('0x62'));}return rp(_0x35ece9);}})[_0x1e51('0x25')](function(_0x4c6920){if(_0x4c6920){var _0x4da887=[_0x1e51('0x63'),_0x1e51('0x64'),'group',_0x1e51('0x65')];_[_0x1e51('0x66')](_0x4c6920['ticket_fields'],function(_0x5eb939){return _0x4da887[_0x1e51('0x67')](_0x5eb939[_0x1e51('0x29')]);});return{'count':_0x4c6920[_0x1e51('0x59')][_0x1e51('0x33')],'rows':_[_0x1e51('0x2c')](_0x4c6920[_0x1e51('0x59')],function(_0x3718d9){return{'id':_0x3718d9['id'],'name':_0x3718d9['position']>0x7?_0x3718d9['title']:_0x3718d9[_0x1e51('0x29')],'custom':_0x3718d9[_0x1e51('0x68')]>0x7?!![]:![],'options':_0x3718d9['system_field_options']?_0x3718d9[_0x1e51('0x69')]:_0x3718d9[_0x1e51('0x6a')]?_0x3718d9['custom_field_options']:[]};})};}})[_0x1e51('0x25')](respondWithResult(_0x457e4a,null))['catch'](function(_0x34b98f){var _0x561812=_0x35f12e['query']['test']?0x1f4:_0x34b98f['statusCode']||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s',_0x1e51('0x52'),_0x561812,JSON['stringify'](_0x34b98f));delete _0x34b98f[_0x1e51('0x2d')];if(_0x561812===0x191){_0x561812=0x190;}_0x457e4a['status'](_0x561812)[_0x1e51('0x6b')](_0x35f12e[_0x1e51('0x2e')][_0x1e51('0x6c')]?{'message':'Wrong\x20credentials','statusCode':_0x34b98f[_0x1e51('0x6d')]}:_0x34b98f);});}; \ No newline at end of file +var _0x63a5=['username','password','token','remoteUri','substring','lastIndexOf','GET','%s/%s','ticket_fields','authType','headers','format','toString','base64','Basic\x20%s','%s/token:%s','Sequelize','Unknown\x20authentication\x20type','description','group','assignee','remove','includes','position','title','system_field_options','custom_field_options','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','ejs','lodash','squel','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','status','offset','undefined','limit','set','Content-Range','json','apply','reject','save','update','destroy','then','end','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','options','ZendeskAccount','count','includeAll','rows','params','length','include','find','catch','create','body','getConfigurations','findOne','ZendeskConfiguration','addConfiguration','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','channel','ZendeskField','getFields'];(function(_0x5c3f8b,_0x59587a){var _0x2dbdd0=function(_0x26d0a9){while(--_0x26d0a9){_0x5c3f8b['push'](_0x5c3f8b['shift']());}};_0x2dbdd0(++_0x59587a);}(_0x63a5,0x18e));var _0x563a=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x63a5[_0xfae23b];return _0x200640;};'use strict';var emlformat=require(_0x563a('0x0'));var rimraf=require(_0x563a('0x1'));var zipdir=require(_0x563a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x563a('0x3'));var moment=require('moment');var BPromise=require(_0x563a('0x4'));var Mustache=require(_0x563a('0x5'));var util=require(_0x563a('0x6'));var path=require(_0x563a('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x563a('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x563a('0x9'));var squel=require(_0x563a('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x563a('0xb'));var toCsv=require(_0x563a('0xc'));var querystring=require(_0x563a('0xd'));var Papa=require(_0x563a('0xe'));var Redis=require(_0x563a('0xf'));var authService=require(_0x563a('0x10'));var qs=require(_0x563a('0x11'));var as=require(_0x563a('0x12'));var hardwareService=require(_0x563a('0x13'));var logger=require(_0x563a('0x14'))(_0x563a('0x15'));var utils=require(_0x563a('0x16'));var config=require(_0x563a('0x17'));var licenseUtil=require(_0x563a('0x18'));var db=require('../../mysqldb')['db'];var integrations=require(_0x563a('0x19'));function respondWithStatusCode(_0x214f42,_0x10de2e){_0x10de2e=_0x10de2e||0xcc;return function(_0x27034c){if(_0x27034c){return _0x214f42[_0x563a('0x1a')](_0x10de2e);}return _0x214f42[_0x563a('0x1b')](_0x10de2e)['end']();};}function respondWithResult(_0x2cf052,_0x3045ac){_0x3045ac=_0x3045ac||0xc8;return function(_0x8c3727){if(_0x8c3727){return _0x2cf052[_0x563a('0x1b')](_0x3045ac)['json'](_0x8c3727);}};}function respondWithFilteredResult(_0x504cb7,_0x414535){return function(_0x2ad667){if(_0x2ad667){var _0x5b291f=typeof _0x414535[_0x563a('0x1c')]===_0x563a('0x1d')&&typeof _0x414535[_0x563a('0x1e')]===_0x563a('0x1d');var _0x4f947d=_0x2ad667['count'];var _0xe3d2bd=_0x5b291f?0x0:_0x414535[_0x563a('0x1c')];var _0x54a3b4=_0x5b291f?_0x2ad667['count']:_0x414535['offset']+_0x414535['limit'];var _0x4c15c1;if(_0x54a3b4>=_0x4f947d){_0x54a3b4=_0x4f947d;_0x4c15c1=0xc8;}else{_0x4c15c1=0xce;}_0x504cb7[_0x563a('0x1b')](_0x4c15c1);return _0x504cb7[_0x563a('0x1f')](_0x563a('0x20'),_0xe3d2bd+'-'+_0x54a3b4+'/'+_0x4f947d)[_0x563a('0x21')](_0x2ad667);}return null;};}function patchUpdates(_0x562fce){return function(_0x4e3b67){try{jsonpatch[_0x563a('0x22')](_0x4e3b67,_0x562fce,!![]);}catch(_0x9f8b29){return BPromise[_0x563a('0x23')](_0x9f8b29);}return _0x4e3b67[_0x563a('0x24')]();};}function saveUpdates(_0x1bf502,_0x2dc7e2){return function(_0x44b460){if(_0x44b460){return _0x44b460[_0x563a('0x25')](_0x1bf502)['then'](function(_0xd59ba8){return _0xd59ba8;});}return null;};}function removeEntity(_0x5422f6,_0x44e2c1){return function(_0xd3e0ae){if(_0xd3e0ae){return _0xd3e0ae[_0x563a('0x26')]()[_0x563a('0x27')](function(){_0x5422f6[_0x563a('0x1b')](0xcc)[_0x563a('0x28')]();});}};}function handleEntityNotFound(_0x3642b3,_0x173990){return function(_0x4de4c3){if(!_0x4de4c3){_0x3642b3[_0x563a('0x1a')](0x194);}return _0x4de4c3;};}function handleError(_0x2b688e,_0x2311f2){_0x2311f2=_0x2311f2||0x1f4;return function(_0x3d79ac){logger[_0x563a('0x29')](_0x3d79ac[_0x563a('0x2a')]);if(_0x3d79ac[_0x563a('0x2b')]){delete _0x3d79ac[_0x563a('0x2b')];}_0x2b688e[_0x563a('0x1b')](_0x2311f2)[_0x563a('0x2c')](_0x3d79ac);};}exports[_0x563a('0x2d')]=function(_0x24d1a8,_0x1bdfb0){var _0x7696c2={},_0x579cb5={},_0x43379c={'count':0x0,'rows':[]};var _0x3c16d0=_[_0x563a('0x2e')](db['ZendeskAccount'][_0x563a('0x2f')],function(_0x2e5c4b){return{'name':_0x2e5c4b[_0x563a('0x30')],'type':_0x2e5c4b[_0x563a('0x31')][_0x563a('0x32')]};});_0x579cb5[_0x563a('0x33')]=_[_0x563a('0x2e')](_0x3c16d0,'name');_0x579cb5[_0x563a('0x34')]=_[_0x563a('0x35')](_0x24d1a8[_0x563a('0x34')]);_0x579cb5[_0x563a('0x36')]=_[_0x563a('0x37')](_0x579cb5['model'],_0x579cb5['query']);_0x7696c2['attributes']=_['intersection'](_0x579cb5[_0x563a('0x33')],qs[_0x563a('0x38')](_0x24d1a8[_0x563a('0x34')][_0x563a('0x38')]));_0x7696c2[_0x563a('0x39')]=_0x7696c2[_0x563a('0x39')]['length']?_0x7696c2['attributes']:_0x579cb5[_0x563a('0x33')];if(!_0x24d1a8[_0x563a('0x34')][_0x563a('0x3a')](_0x563a('0x3b'))){_0x7696c2[_0x563a('0x1e')]=qs[_0x563a('0x1e')](_0x24d1a8[_0x563a('0x34')][_0x563a('0x1e')]);_0x7696c2[_0x563a('0x1c')]=qs[_0x563a('0x1c')](_0x24d1a8[_0x563a('0x34')][_0x563a('0x1c')]);}_0x7696c2[_0x563a('0x3c')]=qs[_0x563a('0x3d')](_0x24d1a8[_0x563a('0x34')][_0x563a('0x3d')]);_0x7696c2['where']=qs[_0x563a('0x36')](_[_0x563a('0x3e')](_0x24d1a8[_0x563a('0x34')],_0x579cb5['filters']),_0x3c16d0);if(_0x24d1a8[_0x563a('0x34')]['filter']){_0x7696c2[_0x563a('0x3f')]=_[_0x563a('0x40')](_0x7696c2['where'],{'$or':_['map'](_0x3c16d0,function(_0x1b48f1){if(_0x1b48f1['type']!==_0x563a('0x41')){var _0x92bd6={};_0x92bd6[_0x1b48f1[_0x563a('0x2b')]]={'$like':'%'+_0x24d1a8[_0x563a('0x34')]['filter']+'%'};return _0x92bd6;}})});}_0x7696c2=_['merge']({},_0x7696c2,_0x24d1a8[_0x563a('0x42')]);var _0x598ee3={'where':_0x7696c2[_0x563a('0x3f')]};return db[_0x563a('0x43')][_0x563a('0x44')](_0x598ee3)[_0x563a('0x27')](function(_0x3a2eb0){_0x43379c[_0x563a('0x44')]=_0x3a2eb0;if(_0x24d1a8[_0x563a('0x34')][_0x563a('0x45')]){_0x7696c2['include']=[{'all':!![]}];}return db[_0x563a('0x43')]['findAll'](_0x7696c2);})[_0x563a('0x27')](function(_0x3de697){_0x43379c[_0x563a('0x46')]=_0x3de697;return _0x43379c;})[_0x563a('0x27')](respondWithFilteredResult(_0x1bdfb0,_0x7696c2))['catch'](handleError(_0x1bdfb0,null));};exports['show']=function(_0x54ac1e,_0x2221d4){var _0x1255da={'raw':![],'where':{'id':_0x54ac1e[_0x563a('0x47')]['id']}},_0x19b18f={};_0x19b18f[_0x563a('0x33')]=_[_0x563a('0x35')](db[_0x563a('0x43')][_0x563a('0x2f')]);_0x19b18f[_0x563a('0x34')]=_[_0x563a('0x35')](_0x54ac1e[_0x563a('0x34')]);_0x19b18f[_0x563a('0x36')]=_[_0x563a('0x37')](_0x19b18f[_0x563a('0x33')],_0x19b18f[_0x563a('0x34')]);_0x1255da[_0x563a('0x39')]=_[_0x563a('0x37')](_0x19b18f[_0x563a('0x33')],qs[_0x563a('0x38')](_0x54ac1e['query']['fields']));_0x1255da[_0x563a('0x39')]=_0x1255da[_0x563a('0x39')][_0x563a('0x48')]?_0x1255da[_0x563a('0x39')]:_0x19b18f[_0x563a('0x33')];if(_0x54ac1e[_0x563a('0x34')][_0x563a('0x45')]){_0x1255da[_0x563a('0x49')]=[{'all':!![]}];}_0x1255da=_['merge']({},_0x1255da,_0x54ac1e['options']);return db[_0x563a('0x43')][_0x563a('0x4a')](_0x1255da)[_0x563a('0x27')](handleEntityNotFound(_0x2221d4,null))[_0x563a('0x27')](respondWithResult(_0x2221d4,null))[_0x563a('0x4b')](handleError(_0x2221d4,null));};exports[_0x563a('0x4c')]=function(_0x2689b5,_0x276642){return db['ZendeskAccount'][_0x563a('0x4c')](_0x2689b5[_0x563a('0x4d')],{})['then'](respondWithResult(_0x276642,0xc9))[_0x563a('0x4b')](handleError(_0x276642,null));};exports['update']=function(_0x3ea787,_0xab7b16){if(_0x3ea787[_0x563a('0x4d')]['id']){delete _0x3ea787['body']['id'];}return db[_0x563a('0x43')][_0x563a('0x4a')]({'where':{'id':_0x3ea787[_0x563a('0x47')]['id']}})[_0x563a('0x27')](handleEntityNotFound(_0xab7b16,null))[_0x563a('0x27')](saveUpdates(_0x3ea787[_0x563a('0x4d')],null))[_0x563a('0x27')](respondWithResult(_0xab7b16,null))[_0x563a('0x4b')](handleError(_0xab7b16,null));};exports[_0x563a('0x26')]=function(_0x2008d4,_0x3c98d5){return db[_0x563a('0x43')][_0x563a('0x4a')]({'where':{'id':_0x2008d4['params']['id']}})['then'](handleEntityNotFound(_0x3c98d5,null))[_0x563a('0x27')](removeEntity(_0x3c98d5,null))[_0x563a('0x4b')](handleError(_0x3c98d5,null));};exports[_0x563a('0x4e')]=function(_0x4a807f,_0x5ae08f,_0x13530f){var _0x1fc4d2={};var _0x50ebde={};var _0x4b6ba9;var _0x51e142;return db[_0x563a('0x43')][_0x563a('0x4f')]({'where':{'id':_0x4a807f[_0x563a('0x47')]['id']}})[_0x563a('0x27')](handleEntityNotFound(_0x5ae08f,null))[_0x563a('0x27')](function(_0x2805eb){if(_0x2805eb){_0x4b6ba9=_0x2805eb;_0x50ebde['model']=_['keys'](db[_0x563a('0x50')]['rawAttributes']);_0x50ebde[_0x563a('0x34')]=_[_0x563a('0x35')](_0x4a807f[_0x563a('0x34')]);_0x50ebde[_0x563a('0x36')]=_[_0x563a('0x37')](_0x50ebde[_0x563a('0x33')],_0x50ebde[_0x563a('0x34')]);_0x1fc4d2['attributes']=_[_0x563a('0x37')](_0x50ebde[_0x563a('0x33')],qs['fields'](_0x4a807f[_0x563a('0x34')][_0x563a('0x38')]));_0x1fc4d2[_0x563a('0x39')]=_0x1fc4d2[_0x563a('0x39')][_0x563a('0x48')]?_0x1fc4d2[_0x563a('0x39')]:_0x50ebde[_0x563a('0x33')];_0x1fc4d2[_0x563a('0x3c')]=qs[_0x563a('0x3d')](_0x4a807f[_0x563a('0x34')]['sort']);_0x1fc4d2[_0x563a('0x3f')]=qs[_0x563a('0x36')](_['pick'](_0x4a807f['query'],_0x50ebde[_0x563a('0x36')]));if(_0x4a807f[_0x563a('0x34')]['filter']){_0x1fc4d2[_0x563a('0x3f')]=_['merge'](_0x1fc4d2[_0x563a('0x3f')],{'$or':_[_0x563a('0x2e')](_0x1fc4d2[_0x563a('0x39')],function(_0xbe9fff){var _0x7fa423={};_0x7fa423[_0xbe9fff]={'$like':'%'+_0x4a807f['query']['filter']+'%'};return _0x7fa423;})});}_0x1fc4d2=_['merge']({},_0x1fc4d2,_0x4a807f['options']);return _0x4b6ba9[_0x563a('0x4e')](_0x1fc4d2);}})['then'](function(_0x111444){if(_0x111444){_0x51e142=_0x111444['length'];if(!_0x4a807f[_0x563a('0x34')][_0x563a('0x3a')](_0x563a('0x3b'))){_0x1fc4d2[_0x563a('0x1e')]=qs[_0x563a('0x1e')](_0x4a807f['query'][_0x563a('0x1e')]);_0x1fc4d2['offset']=qs['offset'](_0x4a807f[_0x563a('0x34')][_0x563a('0x1c')]);}return _0x4b6ba9[_0x563a('0x4e')](_0x1fc4d2);}})[_0x563a('0x27')](function(_0x1c8ad7){if(_0x1c8ad7){return _0x1c8ad7?{'count':_0x51e142,'rows':_0x1c8ad7}:null;}})['then'](respondWithResult(_0x5ae08f,null))[_0x563a('0x4b')](handleError(_0x5ae08f,null));};exports[_0x563a('0x51')]=function(_0x20bd36,_0x3bbe7c,_0x36d40c){if(_0x20bd36['body']['id']){delete _0x20bd36[_0x563a('0x4d')]['id'];}return db['ZendeskAccount'][_0x563a('0x4f')]({'where':{'id':_0x20bd36[_0x563a('0x47')]['id']}})['then'](handleEntityNotFound(_0x3bbe7c,null))[_0x563a('0x27')](function(_0x30bf2b){if(_0x30bf2b){_0x20bd36[_0x563a('0x4d')][_0x563a('0x52')]=_0x30bf2b['id'];_0x20bd36[_0x563a('0x4d')][_0x563a('0x53')]=integrations[_0x563a('0x54')](_0x20bd36[_0x563a('0x4d')]['channel'],_0x20bd36[_0x563a('0x4d')][_0x563a('0x31')]);_0x20bd36[_0x563a('0x4d')][_0x563a('0x55')]=integrations[_0x563a('0x56')](_0x20bd36[_0x563a('0x4d')][_0x563a('0x57')],_0x20bd36['body'][_0x563a('0x31')]);return db['ZendeskConfiguration']['create'](_0x20bd36['body'],{'include':[{'model':db[_0x563a('0x58')],'as':'Subjects'},{'model':db['ZendeskField'],'as':_0x563a('0x55')}]});}return null;})[_0x563a('0x27')](respondWithResult(_0x3bbe7c,null))[_0x563a('0x4b')](handleError(_0x3bbe7c,null));};exports[_0x563a('0x59')]=function(_0x2e442f,_0x51220c,_0x4814b3){var _0x4c9ad7='';return db[_0x563a('0x43')][_0x563a('0x4f')]({'where':{'id':_0x2e442f[_0x563a('0x47')]['id']},'attributes':['id',_0x563a('0x5a'),_0x563a('0x5b'),_0x563a('0x5c'),'authType',_0x563a('0x5d')]})[_0x563a('0x27')](handleEntityNotFound(_0x51220c,null))['then'](function(_0x1983e5){if(_0x1983e5){_0x4c9ad7=_0x1983e5[_0x563a('0x5d')];var _0x15e9ce=_0x4c9ad7['slice'](-0x1);if(_0x15e9ce==='/'){_0x4c9ad7=_0x4c9ad7[_0x563a('0x5e')](0x0,_0x4c9ad7[_0x563a('0x5f')](_0x15e9ce));}var _0x332428={'method':_0x563a('0x60'),'uri':util['format'](_0x563a('0x61'),_0x4c9ad7,_0x563a('0x62')),'json':!![]};switch(_0x1983e5[_0x563a('0x63')]){case _0x563a('0x5b'):_0x332428[_0x563a('0x64')]={'Authorization':util['format']('Basic\x20%s',new Buffer(util[_0x563a('0x65')]('%s:%s',_0x1983e5[_0x563a('0x5a')],_0x1983e5[_0x563a('0x5b')]))[_0x563a('0x66')](_0x563a('0x67')))};break;case _0x563a('0x5c'):_0x332428[_0x563a('0x64')]={'Authorization':util[_0x563a('0x65')](_0x563a('0x68'),new Buffer(util[_0x563a('0x65')](_0x563a('0x69'),_0x1983e5['username'],_0x1983e5[_0x563a('0x5c')]))['toString'](_0x563a('0x67')))};break;default:throw new db[(_0x563a('0x6a'))]['ValidationError'](_0x563a('0x6b'));}return rp(_0x332428);}})['then'](function(_0x41f530){if(_0x41f530){var _0x42c448=['subject',_0x563a('0x6c'),_0x563a('0x6d'),_0x563a('0x6e')];_[_0x563a('0x6f')](_0x41f530['ticket_fields'],function(_0x418646){return _0x42c448[_0x563a('0x70')](_0x418646[_0x563a('0x31')]);});return{'count':_0x41f530[_0x563a('0x62')][_0x563a('0x48')],'rows':_[_0x563a('0x2e')](_0x41f530[_0x563a('0x62')],function(_0x137d52){return{'id':_0x137d52['id'],'name':_0x137d52[_0x563a('0x71')]>0x7?_0x137d52[_0x563a('0x72')]:_0x137d52['type'],'custom':_0x137d52[_0x563a('0x71')]>0x7?!![]:![],'options':_0x137d52[_0x563a('0x73')]?_0x137d52[_0x563a('0x73')]:_0x137d52['custom_field_options']?_0x137d52[_0x563a('0x74')]:[]};})};}})[_0x563a('0x27')](respondWithResult(_0x51220c,null))[_0x563a('0x4b')](function(_0xe27e02){var _0x2cca62=_0x2e442f[_0x563a('0x34')][_0x563a('0x75')]?0x1f4:_0xe27e02[_0x563a('0x76')]||0x1f4;logger[_0x563a('0x29')](_0x563a('0x77'),_0x563a('0x59'),_0x2cca62,JSON[_0x563a('0x78')](_0xe27e02));delete _0xe27e02[_0x563a('0x2b')];if(_0x2cca62===0x191){_0x2cca62=0x190;}_0x51220c['status'](_0x2cca62)[_0x563a('0x2c')](_0x2e442f[_0x563a('0x34')]['test']?{'message':_0x563a('0x79'),'statusCode':_0xe27e02[_0x563a('0x76')]}:_0xe27e02);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index b3c2600..d32fd97 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 _0xe71a=['bluebird','request-promise','path','rimraf','../../config/environment','./intZendeskAccount.attributes','../../components/integrations/configuration','exports','ZendeskAccount','int_zendesk_accounts','lodash','../../config/logger','api'];(function(_0x8d693f,_0x652a29){var _0xc7c885=function(_0x228e43){while(--_0x228e43){_0x8d693f['push'](_0x8d693f['shift']());}};_0xc7c885(++_0x652a29);}(_0xe71a,0xcd));var _0xae71=function(_0x5d976d,_0x3dbc8e){_0x5d976d=_0x5d976d-0x0;var _0x4f80fa=_0xe71a[_0x5d976d];return _0x4f80fa;};'use strict';var _=require(_0xae71('0x0'));var util=require('util');var logger=require(_0xae71('0x1'))(_0xae71('0x2'));var moment=require('moment');var BPromise=require(_0xae71('0x3'));var rp=require(_0xae71('0x4'));var fs=require('fs');var path=require(_0xae71('0x5'));var rimraf=require(_0xae71('0x6'));var config=require(_0xae71('0x7'));var attributes=require(_0xae71('0x8'));var integrations=require(_0xae71('0x9'));module[_0xae71('0xa')]=function(_0x174272,_0x1610b3){return _0x174272['define'](_0xae71('0xb'),attributes,{'tableName':_0xae71('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa5fd=['util','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intZendeskAccount.attributes','../../components/integrations/configuration','exports','ZendeskAccount','int_zendesk_accounts','lodash'];(function(_0x3a2a3c,_0x37bd31){var _0x50ac9a=function(_0x494a7f){while(--_0x494a7f){_0x3a2a3c['push'](_0x3a2a3c['shift']());}};_0x50ac9a(++_0x37bd31);}(_0xa5fd,0x1ed));var _0xda5f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa5fd[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xda5f('0x0'));var util=require(_0xda5f('0x1'));var logger=require('../../config/logger')(_0xda5f('0x2'));var moment=require(_0xda5f('0x3'));var BPromise=require(_0xda5f('0x4'));var rp=require(_0xda5f('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xda5f('0x6'));var config=require(_0xda5f('0x7'));var attributes=require(_0xda5f('0x8'));var integrations=require(_0xda5f('0x9'));module[_0xda5f('0xa')]=function(_0x5d62f1,_0x2bef99){return _0x5d62f1['define'](_0xda5f('0xb'),attributes,{'tableName':_0xda5f('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.rpc.js b/server/api/intZendeskAccount/intZendeskAccount.rpc.js index 81a2113..a9a7214 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 _0x6eed=['ZendeskAccount,\x20%s,\x20%s','message','result','GetZendeskAccount','ZendeskAccount','options','raw','attributes','limit','map','include','model','then','ShowZendeskAccount','find','where','stringify','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','info','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x4996ad,_0x452c82){var _0x39c3d3=function(_0x3d9cce){while(--_0x3d9cce){_0x4996ad['push'](_0x4996ad['shift']());}};_0x39c3d3(++_0x452c82);}(_0x6eed,0xff));var _0xd6ee=function(_0x2e8e7b,_0x5e4613){_0x2e8e7b=_0x2e8e7b-0x0;var _0x15fdab=_0x6eed[_0x2e8e7b];return _0x15fdab;};'use strict';var _=require(_0xd6ee('0x0'));var util=require(_0xd6ee('0x1'));var moment=require(_0xd6ee('0x2'));var BPromise=require(_0xd6ee('0x3'));var rs=require(_0xd6ee('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd6ee('0x5'))['db'];var utils=require(_0xd6ee('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xd6ee('0x7'));var jayson=require(_0xd6ee('0x8'));var client=jayson[_0xd6ee('0x9')][_0xd6ee('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x10c1d7,_0x48a812,_0x514dc3){return new BPromise(function(_0x2e6369,_0x5134ea){return client['request'](_0x10c1d7,_0x514dc3)['then'](function(_0x2c4f23){logger[_0xd6ee('0xb')]('ZendeskAccount,\x20%s,\x20%s',_0x48a812,_0xd6ee('0xc'));logger[_0xd6ee('0xd')](_0xd6ee('0xe'),_0x48a812,_0xd6ee('0xc'),JSON['stringify'](_0x2c4f23));if(_0x2c4f23[_0xd6ee('0xf')]){if(_0x2c4f23[_0xd6ee('0xf')][_0xd6ee('0x10')]===0x1f4){logger[_0xd6ee('0xf')](_0xd6ee('0x11'),_0x48a812,_0x2c4f23[_0xd6ee('0xf')]['message']);return _0x5134ea(_0x2c4f23[_0xd6ee('0xf')][_0xd6ee('0x12')]);}logger['error'](_0xd6ee('0x11'),_0x48a812,_0x2c4f23[_0xd6ee('0xf')][_0xd6ee('0x12')]);return _0x2e6369(_0x2c4f23[_0xd6ee('0xf')][_0xd6ee('0x12')]);}else{logger[_0xd6ee('0xb')]('ZendeskAccount,\x20%s,\x20%s',_0x48a812,_0xd6ee('0xc'));_0x2e6369(_0x2c4f23[_0xd6ee('0x13')][_0xd6ee('0x12')]);}})['catch'](function(_0x3196c0){logger['error'](_0xd6ee('0x11'),_0x48a812,_0x3196c0);_0x5134ea(_0x3196c0);});});}exports[_0xd6ee('0x14')]=function(_0x81d533){var _0x572d04=this;return new Promise(function(_0x8a2718,_0x51ad1c){return db[_0xd6ee('0x15')]['findAll']({'raw':_0x81d533[_0xd6ee('0x16')]?_0x81d533[_0xd6ee('0x16')][_0xd6ee('0x17')]===undefined?!![]:![]:!![],'where':_0x81d533[_0xd6ee('0x16')]?_0x81d533[_0xd6ee('0x16')]['where']||null:null,'attributes':_0x81d533[_0xd6ee('0x16')]?_0x81d533['options'][_0xd6ee('0x18')]||null:null,'limit':_0x81d533[_0xd6ee('0x16')]?_0x81d533[_0xd6ee('0x16')][_0xd6ee('0x19')]||null:null,'include':_0x81d533[_0xd6ee('0x16')]?_0x81d533['options']['include']?_[_0xd6ee('0x1a')](_0x81d533['options'][_0xd6ee('0x1b')],function(_0x519373){return{'model':db[_0x519373[_0xd6ee('0x1c')]],'as':_0x519373['as'],'attributes':_0x519373[_0xd6ee('0x18')],'include':_0x519373[_0xd6ee('0x1b')]?_[_0xd6ee('0x1a')](_0x519373[_0xd6ee('0x1b')],function(_0x5476f2){return{'model':db[_0x5476f2['model']],'as':_0x5476f2['as'],'attributes':_0x5476f2[_0xd6ee('0x18')],'include':_0x5476f2[_0xd6ee('0x1b')]?_['map'](_0x5476f2[_0xd6ee('0x1b')],function(_0xa1e700){return{'model':db[_0xa1e700[_0xd6ee('0x1c')]],'as':_0xa1e700['as'],'attributes':_0xa1e700[_0xd6ee('0x18')]};}):[]};}):[]};}):[]:[]})[_0xd6ee('0x1d')](function(_0x1769a2){logger[_0xd6ee('0xb')]('GetZendeskAccount',_0x81d533);logger[_0xd6ee('0xd')](_0xd6ee('0x14'),_0x81d533,JSON['stringify'](_0x1769a2));_0x8a2718(_0x1769a2);})['catch'](function(_0x1578b3){logger[_0xd6ee('0xf')](_0xd6ee('0x14'),_0x1578b3[_0xd6ee('0x12')],_0x81d533);_0x51ad1c(_0x572d04[_0xd6ee('0xf')](0x1f4,_0x1578b3['message']));});});};exports[_0xd6ee('0x1e')]=function(_0x2f981e){var _0x21ce09=this;return new Promise(function(_0x4a9bdb,_0x3a3ce6){return db[_0xd6ee('0x15')][_0xd6ee('0x1f')]({'raw':_0x2f981e['options']?_0x2f981e[_0xd6ee('0x16')][_0xd6ee('0x17')]===undefined?!![]:![]:!![],'where':_0x2f981e[_0xd6ee('0x16')]?_0x2f981e[_0xd6ee('0x16')][_0xd6ee('0x20')]||null:null,'attributes':_0x2f981e[_0xd6ee('0x16')]?_0x2f981e['options'][_0xd6ee('0x18')]||null:null,'include':_0x2f981e[_0xd6ee('0x16')]?_0x2f981e[_0xd6ee('0x16')][_0xd6ee('0x1b')]?_['map'](_0x2f981e[_0xd6ee('0x16')][_0xd6ee('0x1b')],function(_0x2916a3){return{'model':db[_0x2916a3['model']],'as':_0x2916a3['as'],'attributes':_0x2916a3['attributes'],'include':_0x2916a3[_0xd6ee('0x1b')]?_[_0xd6ee('0x1a')](_0x2916a3[_0xd6ee('0x1b')],function(_0x139a15){return{'model':db[_0x139a15[_0xd6ee('0x1c')]],'as':_0x139a15['as'],'attributes':_0x139a15[_0xd6ee('0x18')],'include':_0x139a15[_0xd6ee('0x1b')]?_[_0xd6ee('0x1a')](_0x139a15[_0xd6ee('0x1b')],function(_0x1e9f94){return{'model':db[_0x1e9f94[_0xd6ee('0x1c')]],'as':_0x1e9f94['as'],'attributes':_0x1e9f94[_0xd6ee('0x18')]};}):[]};}):[]};}):[]:[]})[_0xd6ee('0x1d')](function(_0x15b752){logger[_0xd6ee('0xb')]('ShowZendeskAccount',_0x2f981e);logger[_0xd6ee('0xd')](_0xd6ee('0x1e'),_0x2f981e,JSON[_0xd6ee('0x21')](_0x15b752));_0x4a9bdb(_0x15b752);})['catch'](function(_0x564adc){logger['error']('ShowZendeskAccount',_0x564adc[_0xd6ee('0x12')],_0x2f981e);_0x3a3ce6(_0x21ce09[_0xd6ee('0xf')](0x1f4,_0x564adc[_0xd6ee('0x12')]));});});}; \ No newline at end of file +var _0x5ab3=['ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetZendeskAccount','findAll','options','attributes','include','map','model','stringify','ShowZendeskAccount','ZendeskAccount','find','where','lodash','util','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','request','then','info'];(function(_0x317d1e,_0x179218){var _0x40dd65=function(_0x51fc89){while(--_0x51fc89){_0x317d1e['push'](_0x317d1e['shift']());}};_0x40dd65(++_0x179218);}(_0x5ab3,0x180));var _0x35ab=function(_0x4f0cc4,_0x143255){_0x4f0cc4=_0x4f0cc4-0x0;var _0x54cb8a=_0x5ab3[_0x4f0cc4];return _0x54cb8a;};'use strict';var _=require(_0x35ab('0x0'));var util=require(_0x35ab('0x1'));var moment=require('moment');var BPromise=require(_0x35ab('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x35ab('0x3'));var db=require(_0x35ab('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x35ab('0x5'))(_0x35ab('0x6'));var config=require(_0x35ab('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x35ab('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x467284,_0xff8443,_0x1f5c31){return new BPromise(function(_0x3eea92,_0x2bfee7){return client[_0x35ab('0x9')](_0x467284,_0x1f5c31)[_0x35ab('0xa')](function(_0x2e12e2){logger[_0x35ab('0xb')](_0x35ab('0xc'),_0xff8443,_0x35ab('0xd'));logger[_0x35ab('0xe')](_0x35ab('0xf'),_0xff8443,_0x35ab('0xd'),JSON['stringify'](_0x2e12e2));if(_0x2e12e2[_0x35ab('0x10')]){if(_0x2e12e2[_0x35ab('0x10')][_0x35ab('0x11')]===0x1f4){logger['error'](_0x35ab('0xc'),_0xff8443,_0x2e12e2[_0x35ab('0x10')]['message']);return _0x2bfee7(_0x2e12e2[_0x35ab('0x10')][_0x35ab('0x12')]);}logger[_0x35ab('0x10')](_0x35ab('0xc'),_0xff8443,_0x2e12e2[_0x35ab('0x10')][_0x35ab('0x12')]);return _0x3eea92(_0x2e12e2['error'][_0x35ab('0x12')]);}else{logger[_0x35ab('0xb')](_0x35ab('0xc'),_0xff8443,'request\x20sent');_0x3eea92(_0x2e12e2[_0x35ab('0x13')][_0x35ab('0x12')]);}})[_0x35ab('0x14')](function(_0x2dde0c){logger[_0x35ab('0x10')](_0x35ab('0xc'),_0xff8443,_0x2dde0c);_0x2bfee7(_0x2dde0c);});});}exports[_0x35ab('0x15')]=function(_0x2f1bb3){var _0x5e4934=this;return new Promise(function(_0x15b3e3,_0x5be3b4){return db['ZendeskAccount'][_0x35ab('0x16')]({'raw':_0x2f1bb3['options']?_0x2f1bb3['options']['raw']===undefined?!![]:![]:!![],'where':_0x2f1bb3[_0x35ab('0x17')]?_0x2f1bb3['options']['where']||null:null,'attributes':_0x2f1bb3[_0x35ab('0x17')]?_0x2f1bb3[_0x35ab('0x17')][_0x35ab('0x18')]||null:null,'limit':_0x2f1bb3[_0x35ab('0x17')]?_0x2f1bb3[_0x35ab('0x17')]['limit']||null:null,'include':_0x2f1bb3[_0x35ab('0x17')]?_0x2f1bb3[_0x35ab('0x17')][_0x35ab('0x19')]?_['map'](_0x2f1bb3[_0x35ab('0x17')][_0x35ab('0x19')],function(_0x4f4448){return{'model':db[_0x4f4448['model']],'as':_0x4f4448['as'],'attributes':_0x4f4448[_0x35ab('0x18')],'include':_0x4f4448[_0x35ab('0x19')]?_[_0x35ab('0x1a')](_0x4f4448[_0x35ab('0x19')],function(_0x432d12){return{'model':db[_0x432d12[_0x35ab('0x1b')]],'as':_0x432d12['as'],'attributes':_0x432d12[_0x35ab('0x18')],'include':_0x432d12[_0x35ab('0x19')]?_[_0x35ab('0x1a')](_0x432d12[_0x35ab('0x19')],function(_0x6ac982){return{'model':db[_0x6ac982[_0x35ab('0x1b')]],'as':_0x6ac982['as'],'attributes':_0x6ac982['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x26d694){logger[_0x35ab('0xb')](_0x35ab('0x15'),_0x2f1bb3);logger[_0x35ab('0xe')](_0x35ab('0x15'),_0x2f1bb3,JSON[_0x35ab('0x1c')](_0x26d694));_0x15b3e3(_0x26d694);})[_0x35ab('0x14')](function(_0x2073a5){logger['error'](_0x35ab('0x15'),_0x2073a5[_0x35ab('0x12')],_0x2f1bb3);_0x5be3b4(_0x5e4934[_0x35ab('0x10')](0x1f4,_0x2073a5[_0x35ab('0x12')]));});});};exports[_0x35ab('0x1d')]=function(_0x242d1b){var _0x3fd5d=this;return new Promise(function(_0x4f0945,_0x218a4c){return db[_0x35ab('0x1e')][_0x35ab('0x1f')]({'raw':_0x242d1b[_0x35ab('0x17')]?_0x242d1b[_0x35ab('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x242d1b[_0x35ab('0x17')]?_0x242d1b['options'][_0x35ab('0x20')]||null:null,'attributes':_0x242d1b[_0x35ab('0x17')]?_0x242d1b[_0x35ab('0x17')][_0x35ab('0x18')]||null:null,'include':_0x242d1b['options']?_0x242d1b['options']['include']?_[_0x35ab('0x1a')](_0x242d1b[_0x35ab('0x17')][_0x35ab('0x19')],function(_0x12a406){return{'model':db[_0x12a406['model']],'as':_0x12a406['as'],'attributes':_0x12a406[_0x35ab('0x18')],'include':_0x12a406[_0x35ab('0x19')]?_['map'](_0x12a406[_0x35ab('0x19')],function(_0x48857a){return{'model':db[_0x48857a['model']],'as':_0x48857a['as'],'attributes':_0x48857a[_0x35ab('0x18')],'include':_0x48857a[_0x35ab('0x19')]?_[_0x35ab('0x1a')](_0x48857a['include'],function(_0x2202ec){return{'model':db[_0x2202ec[_0x35ab('0x1b')]],'as':_0x2202ec['as'],'attributes':_0x2202ec[_0x35ab('0x18')]};}):[]};}):[]};}):[]:[]})[_0x35ab('0xa')](function(_0x3a16fd){logger[_0x35ab('0xb')](_0x35ab('0x1d'),_0x242d1b);logger['debug'](_0x35ab('0x1d'),_0x242d1b,JSON[_0x35ab('0x1c')](_0x3a16fd));_0x4f0945(_0x3a16fd);})[_0x35ab('0x14')](function(_0x2a0676){logger[_0x35ab('0x10')](_0x35ab('0x1d'),_0x2a0676[_0x35ab('0x12')],_0x242d1b);_0x218a4c(_0x3fd5d[_0x35ab('0x10')](0x1f4,_0x2a0676['message']));});});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/index.js b/server/api/intZendeskConfiguration/index.js index fdd585e..42ead46 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 _0xac4a=['../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','isAuthenticated','get','show','getSubjects','/:id/descriptions','getDescriptions','getTags','post','create','setTags','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x2be3b1,_0x58685a){var _0x54dc5b=function(_0x56e6f2){while(--_0x56e6f2){_0x2be3b1['push'](_0x2be3b1['shift']());}};_0x54dc5b(++_0x58685a);}(_0xac4a,0x13f));var _0xaac4=function(_0x47a526,_0x2f1a33){_0x47a526=_0x47a526-0x0;var _0x550c20=_0xac4a[_0x47a526];return _0x550c20;};'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['get']('/:id/fields',auth[_0xaac4('0x9')](),controller['getFields']);router[_0xaac4('0xa')]('/:id/subjects',auth['isAuthenticated'](),controller[_0xaac4('0xc')]);router[_0xaac4('0xa')](_0xaac4('0xd'),auth[_0xaac4('0x9')](),controller[_0xaac4('0xe')]);router['get']('/:id/tags',auth[_0xaac4('0x9')](),controller[_0xaac4('0xf')]);router[_0xaac4('0x10')]('/',auth['isAuthenticated'](),controller[_0xaac4('0x11')]);router[_0xaac4('0x10')]('/:id/tags',auth[_0xaac4('0x9')](),controller[_0xaac4('0x12')]);router[_0xaac4('0x13')](_0xaac4('0x14'),auth[_0xaac4('0x9')](),controller[_0xaac4('0x15')]);router[_0xaac4('0x16')](_0xaac4('0x14'),auth[_0xaac4('0x9')](),controller[_0xaac4('0x17')]);module[_0xaac4('0x18')]=router; \ No newline at end of file +var _0x9ffd=['update','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intZendeskConfiguration.controller','isAuthenticated','index','get','/:id','show','/:id/fields','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','create','post','put'];(function(_0x575057,_0x14baf3){var _0x49dbc8=function(_0x23599a){while(--_0x23599a){_0x575057['push'](_0x575057['shift']());}};_0x49dbc8(++_0x14baf3);}(_0x9ffd,0xaa));var _0xd9ff=function(_0x5640cf,_0x1a1355){_0x5640cf=_0x5640cf-0x0;var _0x33f309=_0x9ffd[_0x5640cf];return _0x33f309;};'use strict';var multer=require(_0xd9ff('0x0'));var util=require(_0xd9ff('0x1'));var path=require(_0xd9ff('0x2'));var timeout=require('connect-timeout');var express=require(_0xd9ff('0x3'));var router=express[_0xd9ff('0x4')]();var fs_extra=require(_0xd9ff('0x5'));var auth=require(_0xd9ff('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xd9ff('0x7'));var controller=require(_0xd9ff('0x8'));router['get']('/',auth[_0xd9ff('0x9')](),controller[_0xd9ff('0xa')]);router[_0xd9ff('0xb')](_0xd9ff('0xc'),auth[_0xd9ff('0x9')](),controller[_0xd9ff('0xd')]);router[_0xd9ff('0xb')](_0xd9ff('0xe'),auth[_0xd9ff('0x9')](),controller['getFields']);router['get']('/:id/subjects',auth['isAuthenticated'](),controller[_0xd9ff('0xf')]);router[_0xd9ff('0xb')](_0xd9ff('0x10'),auth[_0xd9ff('0x9')](),controller[_0xd9ff('0x11')]);router[_0xd9ff('0xb')](_0xd9ff('0x12'),auth[_0xd9ff('0x9')](),controller['getTags']);router['post']('/',auth[_0xd9ff('0x9')](),controller[_0xd9ff('0x13')]);router[_0xd9ff('0x14')](_0xd9ff('0x12'),auth[_0xd9ff('0x9')](),controller['setTags']);router[_0xd9ff('0x15')](_0xd9ff('0xc'),auth['isAuthenticated'](),controller[_0xd9ff('0x16')]);router['delete']('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0xd9ff('0x17')]=router; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js index 737e14a..d6e4bea 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 _0xe8ff=['exports','STRING','sequelize'];(function(_0x3a3b99,_0x5bc51e){var _0x15dc23=function(_0x5b88ec){while(--_0x5b88ec){_0x3a3b99['push'](_0x3a3b99['shift']());}};_0x15dc23(++_0x5bc51e);}(_0xe8ff,0x10d));var _0xfe8f=function(_0x35344a,_0x1790b6){_0x35344a=_0x35344a-0x0;var _0x285085=_0xe8ff[_0x35344a];return _0x285085;};'use strict';var Sequelize=require(_0xfe8f('0x0'));module[_0xfe8f('0x1')]={'name':{'type':Sequelize[_0xfe8f('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x36c1=['STRING','sequelize','exports'];(function(_0x2d7680,_0x2e9318){var _0x4276de=function(_0x3ec76b){while(--_0x3ec76b){_0x2d7680['push'](_0x2d7680['shift']());}};_0x4276de(++_0x2e9318);}(_0x36c1,0x1ae));var _0x136c=function(_0x8b0f43,_0x1c57b8){_0x8b0f43=_0x8b0f43-0x0;var _0x3f4425=_0x36c1[_0x8b0f43];return _0x3f4425;};'use strict';var Sequelize=require(_0x136c('0x0'));module[_0x136c('0x1')]={'name':{'type':Sequelize[_0x136c('0x2')]},'description':{'type':Sequelize[_0x136c('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js index 6a3aad9..1c2f3fc 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 _0xdd70=['squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','end','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','then','destroy','sendStatus','error','stack','send','index','map','ZendeskConfiguration','rawAttributes','type','key','query','keys','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','filters','merge','VIRTUAL','name','filter','options','where','include','findAll','catch','params','includeAll','find','create','body','update','getFields','findOne','ZendeskField','pick','getSubjects','getDescriptions','getTags','setTags','ids','eml-format','rimraf','zip-dir','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash'];(function(_0x1d79a1,_0x1c4bac){var _0x5e5ed1=function(_0xd39dd8){while(--_0xd39dd8){_0x1d79a1['push'](_0x1d79a1['shift']());}};_0x5e5ed1(++_0x1c4bac);}(_0xdd70,0x9e));var _0x0dd7=function(_0x527583,_0x2192a6){_0x527583=_0x527583-0x0;var _0x21c304=_0xdd70[_0x527583];return _0x21c304;};'use strict';var emlformat=require(_0x0dd7('0x0'));var rimraf=require(_0x0dd7('0x1'));var zipdir=require(_0x0dd7('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x0dd7('0x3'));var Mustache=require(_0x0dd7('0x4'));var util=require(_0x0dd7('0x5'));var path=require(_0x0dd7('0x6'));var sox=require(_0x0dd7('0x7'));var csv=require(_0x0dd7('0x8'));var ejs=require(_0x0dd7('0x9'));var fs=require('fs');var fs_extra=require(_0x0dd7('0xa'));var _=require(_0x0dd7('0xb'));var squel=require(_0x0dd7('0xc'));var crypto=require(_0x0dd7('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x0dd7('0xe'));var toCsv=require(_0x0dd7('0x8'));var querystring=require(_0x0dd7('0xf'));var Papa=require(_0x0dd7('0x10'));var Redis=require(_0x0dd7('0x11'));var authService=require(_0x0dd7('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x0dd7('0x13'));var hardwareService=require(_0x0dd7('0x14'));var logger=require('../../config/logger')(_0x0dd7('0x15'));var utils=require(_0x0dd7('0x16'));var config=require(_0x0dd7('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x0dd7('0x18'))['db'];function respondWithStatusCode(_0x5ef6d1,_0x6942ec){_0x6942ec=_0x6942ec||0xcc;return function(_0x9e7635){if(_0x9e7635){return _0x5ef6d1['sendStatus'](_0x6942ec);}return _0x5ef6d1['status'](_0x6942ec)[_0x0dd7('0x19')]();};}function respondWithResult(_0x440419,_0x3c9ee9){_0x3c9ee9=_0x3c9ee9||0xc8;return function(_0x186a42){if(_0x186a42){return _0x440419[_0x0dd7('0x1a')](_0x3c9ee9)[_0x0dd7('0x1b')](_0x186a42);}};}function respondWithFilteredResult(_0x3e2a4e,_0x1819e7){return function(_0x370d04){if(_0x370d04){var _0x3bbeb2=typeof _0x1819e7[_0x0dd7('0x1c')]==='undefined'&&typeof _0x1819e7['limit']===_0x0dd7('0x1d');var _0x4272e5=_0x370d04[_0x0dd7('0x1e')];var _0x5d8ac5=_0x3bbeb2?0x0:_0x1819e7['offset'];var _0x48568a=_0x3bbeb2?_0x370d04[_0x0dd7('0x1e')]:_0x1819e7[_0x0dd7('0x1c')]+_0x1819e7[_0x0dd7('0x1f')];var _0x57f572;if(_0x48568a>=_0x4272e5){_0x48568a=_0x4272e5;_0x57f572=0xc8;}else{_0x57f572=0xce;}_0x3e2a4e['status'](_0x57f572);return _0x3e2a4e[_0x0dd7('0x20')](_0x0dd7('0x21'),_0x5d8ac5+'-'+_0x48568a+'/'+_0x4272e5)[_0x0dd7('0x1b')](_0x370d04);}return null;};}function patchUpdates(_0x358938){return function(_0x50f7ba){try{jsonpatch[_0x0dd7('0x22')](_0x50f7ba,_0x358938,!![]);}catch(_0x464706){return BPromise[_0x0dd7('0x23')](_0x464706);}return _0x50f7ba[_0x0dd7('0x24')]();};}function saveUpdates(_0x1ed70c,_0x23cbdf){return function(_0x1fa871){if(_0x1fa871){return _0x1fa871['update'](_0x1ed70c)[_0x0dd7('0x25')](function(_0x724612){return _0x724612;});}return null;};}function removeEntity(_0x4228e6,_0x4117a6){return function(_0x26977e){if(_0x26977e){return _0x26977e[_0x0dd7('0x26')]()[_0x0dd7('0x25')](function(){_0x4228e6[_0x0dd7('0x1a')](0xcc)[_0x0dd7('0x19')]();});}};}function handleEntityNotFound(_0xb58e6a,_0x36131f){return function(_0x26f341){if(!_0x26f341){_0xb58e6a[_0x0dd7('0x27')](0x194);}return _0x26f341;};}function handleError(_0x3f1276,_0x24a638){_0x24a638=_0x24a638||0x1f4;return function(_0x4caa02){logger[_0x0dd7('0x28')](_0x4caa02[_0x0dd7('0x29')]);if(_0x4caa02['name']){delete _0x4caa02['name'];}_0x3f1276[_0x0dd7('0x1a')](_0x24a638)[_0x0dd7('0x2a')](_0x4caa02);};}exports[_0x0dd7('0x2b')]=function(_0x1dafc0,_0x229570){var _0x327216={},_0x298132={},_0x3d3e8a={'count':0x0,'rows':[]};var _0x4ba47f=_[_0x0dd7('0x2c')](db[_0x0dd7('0x2d')][_0x0dd7('0x2e')],function(_0x3908fe){return{'name':_0x3908fe['fieldName'],'type':_0x3908fe[_0x0dd7('0x2f')][_0x0dd7('0x30')]};});_0x298132['model']=_['map'](_0x4ba47f,'name');_0x298132[_0x0dd7('0x31')]=_[_0x0dd7('0x32')](_0x1dafc0['query']);_0x298132['filters']=_[_0x0dd7('0x33')](_0x298132['model'],_0x298132[_0x0dd7('0x31')]);_0x327216[_0x0dd7('0x34')]=_['intersection'](_0x298132[_0x0dd7('0x35')],qs['fields'](_0x1dafc0['query'][_0x0dd7('0x36')]));_0x327216['attributes']=_0x327216[_0x0dd7('0x34')][_0x0dd7('0x37')]?_0x327216['attributes']:_0x298132['model'];if(!_0x1dafc0['query'][_0x0dd7('0x38')](_0x0dd7('0x39'))){_0x327216['limit']=qs[_0x0dd7('0x1f')](_0x1dafc0[_0x0dd7('0x31')]['limit']);_0x327216[_0x0dd7('0x1c')]=qs['offset'](_0x1dafc0['query'][_0x0dd7('0x1c')]);}_0x327216[_0x0dd7('0x3a')]=qs[_0x0dd7('0x3b')](_0x1dafc0[_0x0dd7('0x31')][_0x0dd7('0x3b')]);_0x327216['where']=qs[_0x0dd7('0x3c')](_['pick'](_0x1dafc0[_0x0dd7('0x31')],_0x298132[_0x0dd7('0x3c')]),_0x4ba47f);if(_0x1dafc0[_0x0dd7('0x31')]['filter']){_0x327216['where']=_[_0x0dd7('0x3d')](_0x327216['where'],{'$or':_[_0x0dd7('0x2c')](_0x4ba47f,function(_0x2b5dcc){if(_0x2b5dcc[_0x0dd7('0x2f')]!==_0x0dd7('0x3e')){var _0x5a9b6c={};_0x5a9b6c[_0x2b5dcc[_0x0dd7('0x3f')]]={'$like':'%'+_0x1dafc0[_0x0dd7('0x31')][_0x0dd7('0x40')]+'%'};return _0x5a9b6c;}})});}_0x327216=_[_0x0dd7('0x3d')]({},_0x327216,_0x1dafc0[_0x0dd7('0x41')]);var _0x5008b9={'where':_0x327216[_0x0dd7('0x42')]};return db[_0x0dd7('0x2d')]['count'](_0x5008b9)[_0x0dd7('0x25')](function(_0x26c2fc){_0x3d3e8a[_0x0dd7('0x1e')]=_0x26c2fc;if(_0x1dafc0[_0x0dd7('0x31')]['includeAll']){_0x327216[_0x0dd7('0x43')]=[{'all':!![]}];}return db[_0x0dd7('0x2d')][_0x0dd7('0x44')](_0x327216);})[_0x0dd7('0x25')](function(_0xd31208){_0x3d3e8a['rows']=_0xd31208;return _0x3d3e8a;})[_0x0dd7('0x25')](respondWithFilteredResult(_0x229570,_0x327216))[_0x0dd7('0x45')](handleError(_0x229570,null));};exports['show']=function(_0x54ead4,_0x202dac){var _0x5a424e={'raw':![],'where':{'id':_0x54ead4[_0x0dd7('0x46')]['id']}},_0x3c8370={};_0x3c8370[_0x0dd7('0x35')]=_[_0x0dd7('0x32')](db[_0x0dd7('0x2d')]['rawAttributes']);_0x3c8370[_0x0dd7('0x31')]=_[_0x0dd7('0x32')](_0x54ead4[_0x0dd7('0x31')]);_0x3c8370[_0x0dd7('0x3c')]=_[_0x0dd7('0x33')](_0x3c8370[_0x0dd7('0x35')],_0x3c8370[_0x0dd7('0x31')]);_0x5a424e['attributes']=_['intersection'](_0x3c8370[_0x0dd7('0x35')],qs[_0x0dd7('0x36')](_0x54ead4['query'][_0x0dd7('0x36')]));_0x5a424e['attributes']=_0x5a424e[_0x0dd7('0x34')][_0x0dd7('0x37')]?_0x5a424e['attributes']:_0x3c8370[_0x0dd7('0x35')];if(_0x54ead4[_0x0dd7('0x31')][_0x0dd7('0x47')]){_0x5a424e[_0x0dd7('0x43')]=[{'all':!![]}];}_0x5a424e=_[_0x0dd7('0x3d')]({},_0x5a424e,_0x54ead4['options']);return db['ZendeskConfiguration'][_0x0dd7('0x48')](_0x5a424e)[_0x0dd7('0x25')](handleEntityNotFound(_0x202dac,null))[_0x0dd7('0x25')](respondWithResult(_0x202dac,null))[_0x0dd7('0x45')](handleError(_0x202dac,null));};exports[_0x0dd7('0x49')]=function(_0xbfb96d,_0x38cb38){return db['ZendeskConfiguration']['create'](_0xbfb96d[_0x0dd7('0x4a')],{})['then'](respondWithResult(_0x38cb38,0xc9))[_0x0dd7('0x45')](handleError(_0x38cb38,null));};exports[_0x0dd7('0x4b')]=function(_0x2151a0,_0xc4e0ed){if(_0x2151a0[_0x0dd7('0x4a')]['id']){delete _0x2151a0[_0x0dd7('0x4a')]['id'];}return db[_0x0dd7('0x2d')]['find']({'where':{'id':_0x2151a0[_0x0dd7('0x46')]['id']}})['then'](handleEntityNotFound(_0xc4e0ed,null))[_0x0dd7('0x25')](saveUpdates(_0x2151a0[_0x0dd7('0x4a')],null))[_0x0dd7('0x25')](respondWithResult(_0xc4e0ed,null))[_0x0dd7('0x45')](handleError(_0xc4e0ed,null));};exports[_0x0dd7('0x26')]=function(_0x268ff4,_0x29adf8){return db[_0x0dd7('0x2d')]['find']({'where':{'id':_0x268ff4[_0x0dd7('0x46')]['id']}})['then'](handleEntityNotFound(_0x29adf8,null))['then'](removeEntity(_0x29adf8,null))['catch'](handleError(_0x29adf8,null));};exports[_0x0dd7('0x4c')]=function(_0x2940bd,_0x59b2df,_0x1660a2){var _0x40a7ae={};var _0x649b17={};var _0x3f7d48;var _0x2d6b89;return db[_0x0dd7('0x2d')][_0x0dd7('0x4d')]({'where':{'id':_0x2940bd[_0x0dd7('0x46')]['id']}})[_0x0dd7('0x25')](handleEntityNotFound(_0x59b2df,null))[_0x0dd7('0x25')](function(_0x157e33){if(_0x157e33){_0x3f7d48=_0x157e33;_0x649b17[_0x0dd7('0x35')]=_[_0x0dd7('0x32')](db[_0x0dd7('0x4e')]['rawAttributes']);_0x649b17[_0x0dd7('0x31')]=_['keys'](_0x2940bd['query']);_0x649b17[_0x0dd7('0x3c')]=_[_0x0dd7('0x33')](_0x649b17[_0x0dd7('0x35')],_0x649b17[_0x0dd7('0x31')]);_0x40a7ae['attributes']=_[_0x0dd7('0x33')](_0x649b17[_0x0dd7('0x35')],qs[_0x0dd7('0x36')](_0x2940bd['query'][_0x0dd7('0x36')]));_0x40a7ae[_0x0dd7('0x34')]=_0x40a7ae[_0x0dd7('0x34')][_0x0dd7('0x37')]?_0x40a7ae['attributes']:_0x649b17[_0x0dd7('0x35')];_0x40a7ae[_0x0dd7('0x3a')]=qs[_0x0dd7('0x3b')](_0x2940bd[_0x0dd7('0x31')][_0x0dd7('0x3b')]);_0x40a7ae[_0x0dd7('0x42')]=qs[_0x0dd7('0x3c')](_[_0x0dd7('0x4f')](_0x2940bd[_0x0dd7('0x31')],_0x649b17['filters']));if(_0x2940bd[_0x0dd7('0x31')]['filter']){_0x40a7ae[_0x0dd7('0x42')]=_[_0x0dd7('0x3d')](_0x40a7ae[_0x0dd7('0x42')],{'$or':_[_0x0dd7('0x2c')](_0x40a7ae[_0x0dd7('0x34')],function(_0x48ba8a){var _0x5d0c7c={};_0x5d0c7c[_0x48ba8a]={'$like':'%'+_0x2940bd[_0x0dd7('0x31')][_0x0dd7('0x40')]+'%'};return _0x5d0c7c;})});}_0x40a7ae=_[_0x0dd7('0x3d')]({},_0x40a7ae,_0x2940bd[_0x0dd7('0x41')]);return _0x3f7d48['getFields'](_0x40a7ae);}})['then'](function(_0x43e02c){if(_0x43e02c){_0x2d6b89=_0x43e02c[_0x0dd7('0x37')];if(!_0x2940bd[_0x0dd7('0x31')][_0x0dd7('0x38')]('nolimit')){_0x40a7ae[_0x0dd7('0x1f')]=qs[_0x0dd7('0x1f')](_0x2940bd['query'][_0x0dd7('0x1f')]);_0x40a7ae[_0x0dd7('0x1c')]=qs['offset'](_0x2940bd['query'][_0x0dd7('0x1c')]);}return _0x3f7d48['getFields'](_0x40a7ae);}})[_0x0dd7('0x25')](function(_0x3627c0){if(_0x3627c0){return _0x3627c0?{'count':_0x2d6b89,'rows':_0x3627c0}:null;}})[_0x0dd7('0x25')](respondWithResult(_0x59b2df,null))[_0x0dd7('0x45')](handleError(_0x59b2df,null));};exports[_0x0dd7('0x50')]=function(_0x123dff,_0x257db8,_0xb42fc6){var _0x2e1f8a={};var _0x541403={};var _0x144f5e;var _0x5709ad;return db['ZendeskConfiguration'][_0x0dd7('0x4d')]({'where':{'id':_0x123dff[_0x0dd7('0x46')]['id']}})[_0x0dd7('0x25')](handleEntityNotFound(_0x257db8,null))['then'](function(_0x5e9b96){if(_0x5e9b96){_0x144f5e=_0x5e9b96;_0x541403[_0x0dd7('0x35')]=_['keys'](db[_0x0dd7('0x4e')][_0x0dd7('0x2e')]);_0x541403[_0x0dd7('0x31')]=_[_0x0dd7('0x32')](_0x123dff[_0x0dd7('0x31')]);_0x541403['filters']=_[_0x0dd7('0x33')](_0x541403['model'],_0x541403['query']);_0x2e1f8a['attributes']=_[_0x0dd7('0x33')](_0x541403[_0x0dd7('0x35')],qs[_0x0dd7('0x36')](_0x123dff[_0x0dd7('0x31')][_0x0dd7('0x36')]));_0x2e1f8a[_0x0dd7('0x34')]=_0x2e1f8a[_0x0dd7('0x34')][_0x0dd7('0x37')]?_0x2e1f8a['attributes']:_0x541403[_0x0dd7('0x35')];_0x2e1f8a[_0x0dd7('0x3a')]=qs['sort'](_0x123dff['query'][_0x0dd7('0x3b')]);_0x2e1f8a[_0x0dd7('0x42')]=qs['filters'](_[_0x0dd7('0x4f')](_0x123dff[_0x0dd7('0x31')],_0x541403['filters']));if(_0x123dff[_0x0dd7('0x31')][_0x0dd7('0x40')]){_0x2e1f8a[_0x0dd7('0x42')]=_[_0x0dd7('0x3d')](_0x2e1f8a['where'],{'$or':_['map'](_0x2e1f8a[_0x0dd7('0x34')],function(_0xa1361d){var _0x2d8e3b={};_0x2d8e3b[_0xa1361d]={'$like':'%'+_0x123dff[_0x0dd7('0x31')][_0x0dd7('0x40')]+'%'};return _0x2d8e3b;})});}_0x2e1f8a=_[_0x0dd7('0x3d')]({},_0x2e1f8a,_0x123dff[_0x0dd7('0x41')]);return _0x144f5e[_0x0dd7('0x50')](_0x2e1f8a);}})['then'](function(_0x10dab4){if(_0x10dab4){_0x5709ad=_0x10dab4[_0x0dd7('0x37')];if(!_0x123dff[_0x0dd7('0x31')][_0x0dd7('0x38')](_0x0dd7('0x39'))){_0x2e1f8a['limit']=qs[_0x0dd7('0x1f')](_0x123dff[_0x0dd7('0x31')]['limit']);_0x2e1f8a[_0x0dd7('0x1c')]=qs[_0x0dd7('0x1c')](_0x123dff['query'][_0x0dd7('0x1c')]);}return _0x144f5e[_0x0dd7('0x50')](_0x2e1f8a);}})[_0x0dd7('0x25')](function(_0x2d0c0d){if(_0x2d0c0d){return _0x2d0c0d?{'count':_0x5709ad,'rows':_0x2d0c0d}:null;}})[_0x0dd7('0x25')](respondWithResult(_0x257db8,null))[_0x0dd7('0x45')](handleError(_0x257db8,null));};exports[_0x0dd7('0x51')]=function(_0x44037f,_0x47dcdc,_0x3eb1ad){var _0x1e8163={};var _0x4ed4e9={};var _0x76ea7f;var _0x2746c8;return db[_0x0dd7('0x2d')][_0x0dd7('0x4d')]({'where':{'id':_0x44037f[_0x0dd7('0x46')]['id']}})[_0x0dd7('0x25')](handleEntityNotFound(_0x47dcdc,null))['then'](function(_0x5d0aa0){if(_0x5d0aa0){_0x76ea7f=_0x5d0aa0;_0x4ed4e9[_0x0dd7('0x35')]=_[_0x0dd7('0x32')](db[_0x0dd7('0x4e')][_0x0dd7('0x2e')]);_0x4ed4e9[_0x0dd7('0x31')]=_[_0x0dd7('0x32')](_0x44037f[_0x0dd7('0x31')]);_0x4ed4e9['filters']=_[_0x0dd7('0x33')](_0x4ed4e9[_0x0dd7('0x35')],_0x4ed4e9['query']);_0x1e8163[_0x0dd7('0x34')]=_[_0x0dd7('0x33')](_0x4ed4e9[_0x0dd7('0x35')],qs[_0x0dd7('0x36')](_0x44037f['query'][_0x0dd7('0x36')]));_0x1e8163[_0x0dd7('0x34')]=_0x1e8163[_0x0dd7('0x34')]['length']?_0x1e8163[_0x0dd7('0x34')]:_0x4ed4e9['model'];_0x1e8163['order']=qs[_0x0dd7('0x3b')](_0x44037f['query']['sort']);_0x1e8163[_0x0dd7('0x42')]=qs[_0x0dd7('0x3c')](_[_0x0dd7('0x4f')](_0x44037f[_0x0dd7('0x31')],_0x4ed4e9[_0x0dd7('0x3c')]));if(_0x44037f['query'][_0x0dd7('0x40')]){_0x1e8163[_0x0dd7('0x42')]=_[_0x0dd7('0x3d')](_0x1e8163[_0x0dd7('0x42')],{'$or':_['map'](_0x1e8163['attributes'],function(_0x3b21e4){var _0x33104f={};_0x33104f[_0x3b21e4]={'$like':'%'+_0x44037f[_0x0dd7('0x31')][_0x0dd7('0x40')]+'%'};return _0x33104f;})});}_0x1e8163=_[_0x0dd7('0x3d')]({},_0x1e8163,_0x44037f['options']);return _0x76ea7f[_0x0dd7('0x51')](_0x1e8163);}})[_0x0dd7('0x25')](function(_0x1f0b86){if(_0x1f0b86){_0x2746c8=_0x1f0b86['length'];if(!_0x44037f['query'][_0x0dd7('0x38')]('nolimit')){_0x1e8163['limit']=qs[_0x0dd7('0x1f')](_0x44037f['query'][_0x0dd7('0x1f')]);_0x1e8163[_0x0dd7('0x1c')]=qs['offset'](_0x44037f['query']['offset']);}return _0x76ea7f[_0x0dd7('0x51')](_0x1e8163);}})[_0x0dd7('0x25')](function(_0x3f2438){if(_0x3f2438){return _0x3f2438?{'count':_0x2746c8,'rows':_0x3f2438}:null;}})[_0x0dd7('0x25')](respondWithResult(_0x47dcdc,null))[_0x0dd7('0x45')](handleError(_0x47dcdc,null));};exports[_0x0dd7('0x52')]=function(_0x209b7c,_0x1762af,_0xe22f1c){var _0x256948={};var _0x596c72={};var _0x402254;var _0x7b0840;return db['ZendeskConfiguration'][_0x0dd7('0x4d')]({'where':{'id':_0x209b7c[_0x0dd7('0x46')]['id']}})[_0x0dd7('0x25')](handleEntityNotFound(_0x1762af,null))[_0x0dd7('0x25')](function(_0x4ba8c3){if(_0x4ba8c3){_0x402254=_0x4ba8c3;_0x596c72['model']=_[_0x0dd7('0x32')](db['Tag']['rawAttributes']);_0x596c72['query']=_[_0x0dd7('0x32')](_0x209b7c[_0x0dd7('0x31')]);_0x596c72[_0x0dd7('0x3c')]=_['intersection'](_0x596c72[_0x0dd7('0x35')],_0x596c72[_0x0dd7('0x31')]);_0x256948['attributes']=_[_0x0dd7('0x33')](_0x596c72[_0x0dd7('0x35')],qs[_0x0dd7('0x36')](_0x209b7c[_0x0dd7('0x31')][_0x0dd7('0x36')]));_0x256948['attributes']=_0x256948[_0x0dd7('0x34')][_0x0dd7('0x37')]?_0x256948['attributes']:_0x596c72['model'];_0x256948[_0x0dd7('0x3a')]=qs[_0x0dd7('0x3b')](_0x209b7c['query'][_0x0dd7('0x3b')]);_0x256948['where']=qs[_0x0dd7('0x3c')](_[_0x0dd7('0x4f')](_0x209b7c[_0x0dd7('0x31')],_0x596c72[_0x0dd7('0x3c')]));if(_0x209b7c[_0x0dd7('0x31')][_0x0dd7('0x40')]){_0x256948[_0x0dd7('0x42')]=_[_0x0dd7('0x3d')](_0x256948[_0x0dd7('0x42')],{'$or':_[_0x0dd7('0x2c')](_0x256948['attributes'],function(_0x3b8d68){var _0x17734f={};_0x17734f[_0x3b8d68]={'$like':'%'+_0x209b7c['query'][_0x0dd7('0x40')]+'%'};return _0x17734f;})});}_0x256948=_['merge']({},_0x256948,_0x209b7c[_0x0dd7('0x41')]);return _0x402254[_0x0dd7('0x52')](_0x256948);}})[_0x0dd7('0x25')](function(_0x28e603){if(_0x28e603){_0x7b0840=_0x28e603['length'];if(!_0x209b7c[_0x0dd7('0x31')][_0x0dd7('0x38')]('nolimit')){_0x256948[_0x0dd7('0x1f')]=qs['limit'](_0x209b7c[_0x0dd7('0x31')]['limit']);_0x256948[_0x0dd7('0x1c')]=qs['offset'](_0x209b7c[_0x0dd7('0x31')][_0x0dd7('0x1c')]);}return _0x402254[_0x0dd7('0x52')](_0x256948);}})[_0x0dd7('0x25')](function(_0x38ae8e){if(_0x38ae8e){return _0x38ae8e?{'count':_0x7b0840,'rows':_0x38ae8e}:null;}})[_0x0dd7('0x25')](respondWithResult(_0x1762af,null))[_0x0dd7('0x45')](handleError(_0x1762af,null));};exports[_0x0dd7('0x53')]=function(_0x51853c,_0x82f668,_0x33a026){if(_0x51853c[_0x0dd7('0x4a')]['id']){delete _0x51853c[_0x0dd7('0x4a')]['id'];}return db[_0x0dd7('0x2d')][_0x0dd7('0x4d')]({'where':{'id':_0x51853c['params']['id']}})['then'](handleEntityNotFound(_0x82f668,null))['then'](function(_0x4bf985){if(_0x4bf985){return _0x4bf985['setTags'](_0x51853c[_0x0dd7('0x4a')][_0x0dd7('0x54')]||[]);}return null;})[_0x0dd7('0x25')](respondWithResult(_0x82f668,null))[_0x0dd7('0x45')](handleError(_0x82f668,null));}; \ No newline at end of file +var _0xed8a=['findAll','show','keys','rawAttributes','includeAll','include','options','find','catch','create','body','destroy','getFields','findOne','params','ZendeskField','nolimit','getSubjects','pick','getDescriptions','getTags','Tag','setTags','ids','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','error','name','send','index','map','ZendeskConfiguration','fieldName','type','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','offset','order','sort','where','filter','merge'];(function(_0x1b02bb,_0x3d9fde){var _0x131245=function(_0x2fd1d8){while(--_0x2fd1d8){_0x1b02bb['push'](_0x1b02bb['shift']());}};_0x131245(++_0x3d9fde);}(_0xed8a,0x6e));var _0xaed8=function(_0x53c682,_0xf31a4e){_0x53c682=_0x53c682-0x0;var _0x37ed7c=_0xed8a[_0x53c682];return _0x37ed7c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xaed8('0x0'));var zipdir=require(_0xaed8('0x1'));var jsonpatch=require(_0xaed8('0x2'));var rp=require(_0xaed8('0x3'));var moment=require(_0xaed8('0x4'));var BPromise=require(_0xaed8('0x5'));var Mustache=require(_0xaed8('0x6'));var util=require(_0xaed8('0x7'));var path=require(_0xaed8('0x8'));var sox=require(_0xaed8('0x9'));var csv=require(_0xaed8('0xa'));var ejs=require(_0xaed8('0xb'));var fs=require('fs');var fs_extra=require(_0xaed8('0xc'));var _=require('lodash');var squel=require(_0xaed8('0xd'));var crypto=require('crypto');var jsforce=require(_0xaed8('0xe'));var deskjs=require(_0xaed8('0xf'));var toCsv=require(_0xaed8('0xa'));var querystring=require(_0xaed8('0x10'));var Papa=require(_0xaed8('0x11'));var Redis=require(_0xaed8('0x12'));var authService=require(_0xaed8('0x13'));var qs=require(_0xaed8('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xaed8('0x15'))(_0xaed8('0x16'));var utils=require(_0xaed8('0x17'));var config=require(_0xaed8('0x18'));var licenseUtil=require(_0xaed8('0x19'));var db=require(_0xaed8('0x1a'))['db'];function respondWithStatusCode(_0x85b5ef,_0x31d352){_0x31d352=_0x31d352||0xcc;return function(_0x556715){if(_0x556715){return _0x85b5ef[_0xaed8('0x1b')](_0x31d352);}return _0x85b5ef[_0xaed8('0x1c')](_0x31d352)['end']();};}function respondWithResult(_0x38e979,_0x128bad){_0x128bad=_0x128bad||0xc8;return function(_0x396463){if(_0x396463){return _0x38e979[_0xaed8('0x1c')](_0x128bad)[_0xaed8('0x1d')](_0x396463);}};}function respondWithFilteredResult(_0x162067,_0x3a4519){return function(_0x16dd74){if(_0x16dd74){var _0x5593b9=typeof _0x3a4519['offset']===_0xaed8('0x1e')&&typeof _0x3a4519[_0xaed8('0x1f')]===_0xaed8('0x1e');var _0xc91ba6=_0x16dd74[_0xaed8('0x20')];var _0x1cc3c0=_0x5593b9?0x0:_0x3a4519['offset'];var _0x27e951=_0x5593b9?_0x16dd74['count']:_0x3a4519['offset']+_0x3a4519[_0xaed8('0x1f')];var _0xc01a1b;if(_0x27e951>=_0xc91ba6){_0x27e951=_0xc91ba6;_0xc01a1b=0xc8;}else{_0xc01a1b=0xce;}_0x162067[_0xaed8('0x1c')](_0xc01a1b);return _0x162067[_0xaed8('0x21')](_0xaed8('0x22'),_0x1cc3c0+'-'+_0x27e951+'/'+_0xc91ba6)[_0xaed8('0x1d')](_0x16dd74);}return null;};}function patchUpdates(_0x996349){return function(_0x3db2a9){try{jsonpatch[_0xaed8('0x23')](_0x3db2a9,_0x996349,!![]);}catch(_0x52f81c){return BPromise[_0xaed8('0x24')](_0x52f81c);}return _0x3db2a9[_0xaed8('0x25')]();};}function saveUpdates(_0x3b5a08,_0x3e70bf){return function(_0x1ed87f){if(_0x1ed87f){return _0x1ed87f[_0xaed8('0x26')](_0x3b5a08)[_0xaed8('0x27')](function(_0x25b9b4){return _0x25b9b4;});}return null;};}function removeEntity(_0x59d990,_0x27aba6){return function(_0x1cb9ee){if(_0x1cb9ee){return _0x1cb9ee['destroy']()['then'](function(){_0x59d990['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xaad365,_0x20fe66){return function(_0x154a7a){if(!_0x154a7a){_0xaad365[_0xaed8('0x1b')](0x194);}return _0x154a7a;};}function handleError(_0x51ce56,_0x1d6c91){_0x1d6c91=_0x1d6c91||0x1f4;return function(_0x50c57f){logger[_0xaed8('0x28')](_0x50c57f['stack']);if(_0x50c57f[_0xaed8('0x29')]){delete _0x50c57f[_0xaed8('0x29')];}_0x51ce56[_0xaed8('0x1c')](_0x1d6c91)[_0xaed8('0x2a')](_0x50c57f);};}exports[_0xaed8('0x2b')]=function(_0x4d116f,_0x2dd237){var _0x50bda5={},_0x5814d3={},_0x354042={'count':0x0,'rows':[]};var _0x2de16d=_[_0xaed8('0x2c')](db[_0xaed8('0x2d')]['rawAttributes'],function(_0x19f7ed){return{'name':_0x19f7ed[_0xaed8('0x2e')],'type':_0x19f7ed[_0xaed8('0x2f')]['key']};});_0x5814d3[_0xaed8('0x30')]=_[_0xaed8('0x2c')](_0x2de16d,'name');_0x5814d3[_0xaed8('0x31')]=_['keys'](_0x4d116f['query']);_0x5814d3[_0xaed8('0x32')]=_['intersection'](_0x5814d3[_0xaed8('0x30')],_0x5814d3[_0xaed8('0x31')]);_0x50bda5[_0xaed8('0x33')]=_[_0xaed8('0x34')](_0x5814d3[_0xaed8('0x30')],qs[_0xaed8('0x35')](_0x4d116f[_0xaed8('0x31')][_0xaed8('0x35')]));_0x50bda5[_0xaed8('0x33')]=_0x50bda5[_0xaed8('0x33')][_0xaed8('0x36')]?_0x50bda5['attributes']:_0x5814d3[_0xaed8('0x30')];if(!_0x4d116f['query'][_0xaed8('0x37')]('nolimit')){_0x50bda5['limit']=qs[_0xaed8('0x1f')](_0x4d116f['query'][_0xaed8('0x1f')]);_0x50bda5[_0xaed8('0x38')]=qs['offset'](_0x4d116f[_0xaed8('0x31')][_0xaed8('0x38')]);}_0x50bda5[_0xaed8('0x39')]=qs[_0xaed8('0x3a')](_0x4d116f['query'][_0xaed8('0x3a')]);_0x50bda5[_0xaed8('0x3b')]=qs[_0xaed8('0x32')](_['pick'](_0x4d116f[_0xaed8('0x31')],_0x5814d3[_0xaed8('0x32')]),_0x2de16d);if(_0x4d116f[_0xaed8('0x31')][_0xaed8('0x3c')]){_0x50bda5[_0xaed8('0x3b')]=_[_0xaed8('0x3d')](_0x50bda5['where'],{'$or':_[_0xaed8('0x2c')](_0x2de16d,function(_0x2623a0){if(_0x2623a0[_0xaed8('0x2f')]!=='VIRTUAL'){var _0x3beacc={};_0x3beacc[_0x2623a0[_0xaed8('0x29')]]={'$like':'%'+_0x4d116f['query']['filter']+'%'};return _0x3beacc;}})});}_0x50bda5=_['merge']({},_0x50bda5,_0x4d116f['options']);var _0x49bb57={'where':_0x50bda5[_0xaed8('0x3b')]};return db[_0xaed8('0x2d')][_0xaed8('0x20')](_0x49bb57)[_0xaed8('0x27')](function(_0x437318){_0x354042[_0xaed8('0x20')]=_0x437318;if(_0x4d116f[_0xaed8('0x31')]['includeAll']){_0x50bda5['include']=[{'all':!![]}];}return db[_0xaed8('0x2d')][_0xaed8('0x3e')](_0x50bda5);})[_0xaed8('0x27')](function(_0x5d8de4){_0x354042['rows']=_0x5d8de4;return _0x354042;})[_0xaed8('0x27')](respondWithFilteredResult(_0x2dd237,_0x50bda5))['catch'](handleError(_0x2dd237,null));};exports[_0xaed8('0x3f')]=function(_0x3b2c22,_0x4783e0){var _0x4bd1ed={'raw':![],'where':{'id':_0x3b2c22['params']['id']}},_0x1a8bf1={};_0x1a8bf1[_0xaed8('0x30')]=_[_0xaed8('0x40')](db[_0xaed8('0x2d')][_0xaed8('0x41')]);_0x1a8bf1['query']=_[_0xaed8('0x40')](_0x3b2c22[_0xaed8('0x31')]);_0x1a8bf1[_0xaed8('0x32')]=_[_0xaed8('0x34')](_0x1a8bf1[_0xaed8('0x30')],_0x1a8bf1[_0xaed8('0x31')]);_0x4bd1ed[_0xaed8('0x33')]=_[_0xaed8('0x34')](_0x1a8bf1[_0xaed8('0x30')],qs[_0xaed8('0x35')](_0x3b2c22['query'][_0xaed8('0x35')]));_0x4bd1ed[_0xaed8('0x33')]=_0x4bd1ed[_0xaed8('0x33')][_0xaed8('0x36')]?_0x4bd1ed[_0xaed8('0x33')]:_0x1a8bf1[_0xaed8('0x30')];if(_0x3b2c22[_0xaed8('0x31')][_0xaed8('0x42')]){_0x4bd1ed[_0xaed8('0x43')]=[{'all':!![]}];}_0x4bd1ed=_['merge']({},_0x4bd1ed,_0x3b2c22[_0xaed8('0x44')]);return db[_0xaed8('0x2d')][_0xaed8('0x45')](_0x4bd1ed)[_0xaed8('0x27')](handleEntityNotFound(_0x4783e0,null))['then'](respondWithResult(_0x4783e0,null))[_0xaed8('0x46')](handleError(_0x4783e0,null));};exports['create']=function(_0x13afec,_0x25ed82){return db[_0xaed8('0x2d')][_0xaed8('0x47')](_0x13afec[_0xaed8('0x48')],{})[_0xaed8('0x27')](respondWithResult(_0x25ed82,0xc9))[_0xaed8('0x46')](handleError(_0x25ed82,null));};exports[_0xaed8('0x26')]=function(_0x21c2b0,_0x5d237e){if(_0x21c2b0[_0xaed8('0x48')]['id']){delete _0x21c2b0[_0xaed8('0x48')]['id'];}return db[_0xaed8('0x2d')][_0xaed8('0x45')]({'where':{'id':_0x21c2b0['params']['id']}})[_0xaed8('0x27')](handleEntityNotFound(_0x5d237e,null))[_0xaed8('0x27')](saveUpdates(_0x21c2b0[_0xaed8('0x48')],null))['then'](respondWithResult(_0x5d237e,null))['catch'](handleError(_0x5d237e,null));};exports[_0xaed8('0x49')]=function(_0x348462,_0x3953ac){return db[_0xaed8('0x2d')][_0xaed8('0x45')]({'where':{'id':_0x348462['params']['id']}})[_0xaed8('0x27')](handleEntityNotFound(_0x3953ac,null))['then'](removeEntity(_0x3953ac,null))[_0xaed8('0x46')](handleError(_0x3953ac,null));};exports[_0xaed8('0x4a')]=function(_0x3a7fd7,_0x2d82f4,_0x3f6743){var _0x203b5f={};var _0x4119b9={};var _0x26ddb5;var _0x6a1ac;return db[_0xaed8('0x2d')][_0xaed8('0x4b')]({'where':{'id':_0x3a7fd7[_0xaed8('0x4c')]['id']}})[_0xaed8('0x27')](handleEntityNotFound(_0x2d82f4,null))[_0xaed8('0x27')](function(_0x33c7c5){if(_0x33c7c5){_0x26ddb5=_0x33c7c5;_0x4119b9[_0xaed8('0x30')]=_[_0xaed8('0x40')](db[_0xaed8('0x4d')][_0xaed8('0x41')]);_0x4119b9['query']=_[_0xaed8('0x40')](_0x3a7fd7[_0xaed8('0x31')]);_0x4119b9[_0xaed8('0x32')]=_[_0xaed8('0x34')](_0x4119b9[_0xaed8('0x30')],_0x4119b9[_0xaed8('0x31')]);_0x203b5f['attributes']=_[_0xaed8('0x34')](_0x4119b9[_0xaed8('0x30')],qs[_0xaed8('0x35')](_0x3a7fd7[_0xaed8('0x31')]['fields']));_0x203b5f[_0xaed8('0x33')]=_0x203b5f[_0xaed8('0x33')][_0xaed8('0x36')]?_0x203b5f[_0xaed8('0x33')]:_0x4119b9[_0xaed8('0x30')];_0x203b5f[_0xaed8('0x39')]=qs[_0xaed8('0x3a')](_0x3a7fd7['query'][_0xaed8('0x3a')]);_0x203b5f[_0xaed8('0x3b')]=qs['filters'](_['pick'](_0x3a7fd7[_0xaed8('0x31')],_0x4119b9['filters']));if(_0x3a7fd7[_0xaed8('0x31')][_0xaed8('0x3c')]){_0x203b5f[_0xaed8('0x3b')]=_[_0xaed8('0x3d')](_0x203b5f[_0xaed8('0x3b')],{'$or':_[_0xaed8('0x2c')](_0x203b5f[_0xaed8('0x33')],function(_0x190602){var _0x293dff={};_0x293dff[_0x190602]={'$like':'%'+_0x3a7fd7['query']['filter']+'%'};return _0x293dff;})});}_0x203b5f=_[_0xaed8('0x3d')]({},_0x203b5f,_0x3a7fd7[_0xaed8('0x44')]);return _0x26ddb5['getFields'](_0x203b5f);}})[_0xaed8('0x27')](function(_0x444c67){if(_0x444c67){_0x6a1ac=_0x444c67['length'];if(!_0x3a7fd7[_0xaed8('0x31')]['hasOwnProperty'](_0xaed8('0x4e'))){_0x203b5f['limit']=qs['limit'](_0x3a7fd7[_0xaed8('0x31')][_0xaed8('0x1f')]);_0x203b5f[_0xaed8('0x38')]=qs[_0xaed8('0x38')](_0x3a7fd7[_0xaed8('0x31')][_0xaed8('0x38')]);}return _0x26ddb5['getFields'](_0x203b5f);}})['then'](function(_0x13b00b){if(_0x13b00b){return _0x13b00b?{'count':_0x6a1ac,'rows':_0x13b00b}:null;}})[_0xaed8('0x27')](respondWithResult(_0x2d82f4,null))[_0xaed8('0x46')](handleError(_0x2d82f4,null));};exports[_0xaed8('0x4f')]=function(_0x36943b,_0x2acd11,_0x45602a){var _0x274265={};var _0x438079={};var _0x3b11f3;var _0x40070b;return db[_0xaed8('0x2d')][_0xaed8('0x4b')]({'where':{'id':_0x36943b[_0xaed8('0x4c')]['id']}})['then'](handleEntityNotFound(_0x2acd11,null))['then'](function(_0x5005da){if(_0x5005da){_0x3b11f3=_0x5005da;_0x438079[_0xaed8('0x30')]=_[_0xaed8('0x40')](db['ZendeskField'][_0xaed8('0x41')]);_0x438079[_0xaed8('0x31')]=_['keys'](_0x36943b['query']);_0x438079[_0xaed8('0x32')]=_['intersection'](_0x438079['model'],_0x438079[_0xaed8('0x31')]);_0x274265[_0xaed8('0x33')]=_[_0xaed8('0x34')](_0x438079[_0xaed8('0x30')],qs['fields'](_0x36943b[_0xaed8('0x31')]['fields']));_0x274265[_0xaed8('0x33')]=_0x274265[_0xaed8('0x33')][_0xaed8('0x36')]?_0x274265[_0xaed8('0x33')]:_0x438079[_0xaed8('0x30')];_0x274265[_0xaed8('0x39')]=qs[_0xaed8('0x3a')](_0x36943b['query'][_0xaed8('0x3a')]);_0x274265[_0xaed8('0x3b')]=qs[_0xaed8('0x32')](_[_0xaed8('0x50')](_0x36943b[_0xaed8('0x31')],_0x438079['filters']));if(_0x36943b['query'][_0xaed8('0x3c')]){_0x274265[_0xaed8('0x3b')]=_[_0xaed8('0x3d')](_0x274265['where'],{'$or':_[_0xaed8('0x2c')](_0x274265[_0xaed8('0x33')],function(_0x121f9c){var _0x46ecae={};_0x46ecae[_0x121f9c]={'$like':'%'+_0x36943b[_0xaed8('0x31')][_0xaed8('0x3c')]+'%'};return _0x46ecae;})});}_0x274265=_[_0xaed8('0x3d')]({},_0x274265,_0x36943b['options']);return _0x3b11f3[_0xaed8('0x4f')](_0x274265);}})[_0xaed8('0x27')](function(_0x21b9fc){if(_0x21b9fc){_0x40070b=_0x21b9fc[_0xaed8('0x36')];if(!_0x36943b['query'][_0xaed8('0x37')](_0xaed8('0x4e'))){_0x274265['limit']=qs[_0xaed8('0x1f')](_0x36943b[_0xaed8('0x31')][_0xaed8('0x1f')]);_0x274265[_0xaed8('0x38')]=qs[_0xaed8('0x38')](_0x36943b[_0xaed8('0x31')][_0xaed8('0x38')]);}return _0x3b11f3[_0xaed8('0x4f')](_0x274265);}})['then'](function(_0x40ddc2){if(_0x40ddc2){return _0x40ddc2?{'count':_0x40070b,'rows':_0x40ddc2}:null;}})[_0xaed8('0x27')](respondWithResult(_0x2acd11,null))[_0xaed8('0x46')](handleError(_0x2acd11,null));};exports[_0xaed8('0x51')]=function(_0x3f3f4e,_0x46dbce,_0x1b3b26){var _0x331a74={};var _0x5abd22={};var _0x56ae6f;var _0x2e51ee;return db[_0xaed8('0x2d')][_0xaed8('0x4b')]({'where':{'id':_0x3f3f4e[_0xaed8('0x4c')]['id']}})[_0xaed8('0x27')](handleEntityNotFound(_0x46dbce,null))['then'](function(_0x152805){if(_0x152805){_0x56ae6f=_0x152805;_0x5abd22['model']=_[_0xaed8('0x40')](db['ZendeskField'][_0xaed8('0x41')]);_0x5abd22[_0xaed8('0x31')]=_[_0xaed8('0x40')](_0x3f3f4e['query']);_0x5abd22[_0xaed8('0x32')]=_[_0xaed8('0x34')](_0x5abd22[_0xaed8('0x30')],_0x5abd22[_0xaed8('0x31')]);_0x331a74['attributes']=_[_0xaed8('0x34')](_0x5abd22['model'],qs[_0xaed8('0x35')](_0x3f3f4e[_0xaed8('0x31')][_0xaed8('0x35')]));_0x331a74['attributes']=_0x331a74[_0xaed8('0x33')][_0xaed8('0x36')]?_0x331a74['attributes']:_0x5abd22[_0xaed8('0x30')];_0x331a74[_0xaed8('0x39')]=qs['sort'](_0x3f3f4e[_0xaed8('0x31')][_0xaed8('0x3a')]);_0x331a74[_0xaed8('0x3b')]=qs['filters'](_[_0xaed8('0x50')](_0x3f3f4e[_0xaed8('0x31')],_0x5abd22['filters']));if(_0x3f3f4e[_0xaed8('0x31')]['filter']){_0x331a74[_0xaed8('0x3b')]=_['merge'](_0x331a74['where'],{'$or':_[_0xaed8('0x2c')](_0x331a74[_0xaed8('0x33')],function(_0x5a8924){var _0x31e4c7={};_0x31e4c7[_0x5a8924]={'$like':'%'+_0x3f3f4e['query'][_0xaed8('0x3c')]+'%'};return _0x31e4c7;})});}_0x331a74=_[_0xaed8('0x3d')]({},_0x331a74,_0x3f3f4e[_0xaed8('0x44')]);return _0x56ae6f[_0xaed8('0x51')](_0x331a74);}})[_0xaed8('0x27')](function(_0x24dad2){if(_0x24dad2){_0x2e51ee=_0x24dad2[_0xaed8('0x36')];if(!_0x3f3f4e['query'][_0xaed8('0x37')](_0xaed8('0x4e'))){_0x331a74[_0xaed8('0x1f')]=qs[_0xaed8('0x1f')](_0x3f3f4e[_0xaed8('0x31')][_0xaed8('0x1f')]);_0x331a74['offset']=qs[_0xaed8('0x38')](_0x3f3f4e[_0xaed8('0x31')]['offset']);}return _0x56ae6f[_0xaed8('0x51')](_0x331a74);}})[_0xaed8('0x27')](function(_0x33fe15){if(_0x33fe15){return _0x33fe15?{'count':_0x2e51ee,'rows':_0x33fe15}:null;}})[_0xaed8('0x27')](respondWithResult(_0x46dbce,null))[_0xaed8('0x46')](handleError(_0x46dbce,null));};exports[_0xaed8('0x52')]=function(_0x413b6c,_0x2e3f1f,_0x2dd769){var _0x2199db={};var _0x3481ae={};var _0x10603e;var _0x1c9f46;return db[_0xaed8('0x2d')][_0xaed8('0x4b')]({'where':{'id':_0x413b6c[_0xaed8('0x4c')]['id']}})[_0xaed8('0x27')](handleEntityNotFound(_0x2e3f1f,null))[_0xaed8('0x27')](function(_0x451ef3){if(_0x451ef3){_0x10603e=_0x451ef3;_0x3481ae[_0xaed8('0x30')]=_[_0xaed8('0x40')](db[_0xaed8('0x53')][_0xaed8('0x41')]);_0x3481ae[_0xaed8('0x31')]=_[_0xaed8('0x40')](_0x413b6c['query']);_0x3481ae[_0xaed8('0x32')]=_[_0xaed8('0x34')](_0x3481ae['model'],_0x3481ae[_0xaed8('0x31')]);_0x2199db[_0xaed8('0x33')]=_[_0xaed8('0x34')](_0x3481ae[_0xaed8('0x30')],qs[_0xaed8('0x35')](_0x413b6c[_0xaed8('0x31')]['fields']));_0x2199db[_0xaed8('0x33')]=_0x2199db[_0xaed8('0x33')][_0xaed8('0x36')]?_0x2199db[_0xaed8('0x33')]:_0x3481ae[_0xaed8('0x30')];_0x2199db[_0xaed8('0x39')]=qs[_0xaed8('0x3a')](_0x413b6c['query'][_0xaed8('0x3a')]);_0x2199db[_0xaed8('0x3b')]=qs[_0xaed8('0x32')](_[_0xaed8('0x50')](_0x413b6c[_0xaed8('0x31')],_0x3481ae[_0xaed8('0x32')]));if(_0x413b6c[_0xaed8('0x31')][_0xaed8('0x3c')]){_0x2199db[_0xaed8('0x3b')]=_[_0xaed8('0x3d')](_0x2199db[_0xaed8('0x3b')],{'$or':_[_0xaed8('0x2c')](_0x2199db['attributes'],function(_0x38531f){var _0x47394f={};_0x47394f[_0x38531f]={'$like':'%'+_0x413b6c[_0xaed8('0x31')][_0xaed8('0x3c')]+'%'};return _0x47394f;})});}_0x2199db=_[_0xaed8('0x3d')]({},_0x2199db,_0x413b6c[_0xaed8('0x44')]);return _0x10603e[_0xaed8('0x52')](_0x2199db);}})[_0xaed8('0x27')](function(_0x2487ac){if(_0x2487ac){_0x1c9f46=_0x2487ac[_0xaed8('0x36')];if(!_0x413b6c[_0xaed8('0x31')][_0xaed8('0x37')](_0xaed8('0x4e'))){_0x2199db[_0xaed8('0x1f')]=qs[_0xaed8('0x1f')](_0x413b6c[_0xaed8('0x31')][_0xaed8('0x1f')]);_0x2199db[_0xaed8('0x38')]=qs[_0xaed8('0x38')](_0x413b6c[_0xaed8('0x31')][_0xaed8('0x38')]);}return _0x10603e['getTags'](_0x2199db);}})[_0xaed8('0x27')](function(_0x438e1a){if(_0x438e1a){return _0x438e1a?{'count':_0x1c9f46,'rows':_0x438e1a}:null;}})[_0xaed8('0x27')](respondWithResult(_0x2e3f1f,null))[_0xaed8('0x46')](handleError(_0x2e3f1f,null));};exports[_0xaed8('0x54')]=function(_0x1abcd0,_0x46bd5e,_0x5d67f8){if(_0x1abcd0[_0xaed8('0x48')]['id']){delete _0x1abcd0[_0xaed8('0x48')]['id'];}return db[_0xaed8('0x2d')]['findOne']({'where':{'id':_0x1abcd0[_0xaed8('0x4c')]['id']}})[_0xaed8('0x27')](handleEntityNotFound(_0x46bd5e,null))[_0xaed8('0x27')](function(_0x435bb0){if(_0x435bb0){return _0x435bb0[_0xaed8('0x54')](_0x1abcd0[_0xaed8('0x48')][_0xaed8('0x55')]||[]);}return null;})[_0xaed8('0x27')](respondWithResult(_0x46bd5e,null))['catch'](handleError(_0x46bd5e,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index ca01f14..84de555 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 _0xbbbc=['request-promise','rimraf','../../config/environment','./intZendeskConfiguration.attributes','exports','define','ZendeskConfiguration','int_zendesk_configurations','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xbbbc,0xf6));var _0xcbbb=function(_0x4a29a9,_0x58cd04){_0x4a29a9=_0x4a29a9-0x0;var _0x386570=_0xbbbc[_0x4a29a9];return _0x386570;};'use strict';var _=require(_0xcbbb('0x0'));var util=require(_0xcbbb('0x1'));var logger=require(_0xcbbb('0x2'))(_0xcbbb('0x3'));var moment=require(_0xcbbb('0x4'));var BPromise=require(_0xcbbb('0x5'));var rp=require(_0xcbbb('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xcbbb('0x7'));var config=require(_0xcbbb('0x8'));var attributes=require(_0xcbbb('0x9'));module[_0xcbbb('0xa')]=function(_0x43ff05,_0x4978a9){return _0x43ff05[_0xcbbb('0xb')](_0xcbbb('0xc'),attributes,{'tableName':_0xcbbb('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5c00=['moment','request-promise','path','rimraf','../../config/environment','exports','define','int_zendesk_configurations','lodash','util','../../config/logger'];(function(_0x529526,_0x2b98de){var _0x3606de=function(_0x3ca40e){while(--_0x3ca40e){_0x529526['push'](_0x529526['shift']());}};_0x3606de(++_0x2b98de);}(_0x5c00,0x17e));var _0x05c0=function(_0x19cd29,_0x1ac3e7){_0x19cd29=_0x19cd29-0x0;var _0x27c96d=_0x5c00[_0x19cd29];return _0x27c96d;};'use strict';var _=require(_0x05c0('0x0'));var util=require(_0x05c0('0x1'));var logger=require(_0x05c0('0x2'))('api');var moment=require(_0x05c0('0x3'));var BPromise=require('bluebird');var rp=require(_0x05c0('0x4'));var fs=require('fs');var path=require(_0x05c0('0x5'));var rimraf=require(_0x05c0('0x6'));var config=require(_0x05c0('0x7'));var attributes=require('./intZendeskConfiguration.attributes');module[_0x05c0('0x8')]=function(_0x3521fe,_0x261624){return _0x3521fe[_0x05c0('0x9')]('ZendeskConfiguration',attributes,{'tableName':_0x05c0('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.rpc.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.rpc.js index 766fc1a..ae48189 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 _0x6abd=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch'];(function(_0x5f09c5,_0x2bfca0){var _0x426ad9=function(_0x18fe5f){while(--_0x18fe5f){_0x5f09c5['push'](_0x5f09c5['shift']());}};_0x426ad9(++_0x2bfca0);}(_0x6abd,0xa8));var _0xd6ab=function(_0x19754a,_0x3050aa){_0x19754a=_0x19754a-0x0;var _0x4f8f3f=_0x6abd[_0x19754a];return _0x4f8f3f;};'use strict';var _=require(_0xd6ab('0x0'));var util=require(_0xd6ab('0x1'));var moment=require(_0xd6ab('0x2'));var BPromise=require(_0xd6ab('0x3'));var rs=require(_0xd6ab('0x4'));var fs=require('fs');var Redis=require(_0xd6ab('0x5'));var db=require(_0xd6ab('0x6'))['db'];var utils=require(_0xd6ab('0x7'));var logger=require(_0xd6ab('0x8'))(_0xd6ab('0x9'));var config=require(_0xd6ab('0xa'));var jayson=require(_0xd6ab('0xb'));var client=jayson[_0xd6ab('0xc')][_0xd6ab('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x182c1d,_0x245175,_0x27b9c4){return new BPromise(function(_0x231d19,_0x16fa40){return client[_0xd6ab('0xe')](_0x182c1d,_0x27b9c4)['then'](function(_0x2d5b85){logger['info'](_0xd6ab('0xf'),_0x245175,_0xd6ab('0x10'));logger[_0xd6ab('0x11')](_0xd6ab('0x12'),_0x245175,'request\x20sent',JSON[_0xd6ab('0x13')](_0x2d5b85));if(_0x2d5b85['error']){if(_0x2d5b85[_0xd6ab('0x14')][_0xd6ab('0x15')]===0x1f4){logger['error']('ZendeskConfiguration,\x20%s,\x20%s',_0x245175,_0x2d5b85['error'][_0xd6ab('0x16')]);return _0x16fa40(_0x2d5b85[_0xd6ab('0x14')]['message']);}logger[_0xd6ab('0x14')](_0xd6ab('0xf'),_0x245175,_0x2d5b85[_0xd6ab('0x14')][_0xd6ab('0x16')]);return _0x231d19(_0x2d5b85[_0xd6ab('0x14')][_0xd6ab('0x16')]);}else{logger['info'](_0xd6ab('0xf'),_0x245175,_0xd6ab('0x10'));_0x231d19(_0x2d5b85['result'][_0xd6ab('0x16')]);}})[_0xd6ab('0x17')](function(_0x252185){logger[_0xd6ab('0x14')]('ZendeskConfiguration,\x20%s,\x20%s',_0x245175,_0x252185);_0x16fa40(_0x252185);});});} \ No newline at end of file +var _0xc556=['then','info','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request'];(function(_0x2bed2c,_0x4b9a60){var _0x174f26=function(_0x205c65){while(--_0x205c65){_0x2bed2c['push'](_0x2bed2c['shift']());}};_0x174f26(++_0x4b9a60);}(_0xc556,0x11b));var _0x6c55=function(_0x1034bb,_0x4e20b3){_0x1034bb=_0x1034bb-0x0;var _0x453fdb=_0xc556[_0x1034bb];return _0x453fdb;};'use strict';var _=require('lodash');var util=require(_0x6c55('0x0'));var moment=require(_0x6c55('0x1'));var BPromise=require(_0x6c55('0x2'));var rs=require(_0x6c55('0x3'));var fs=require('fs');var Redis=require(_0x6c55('0x4'));var db=require(_0x6c55('0x5'))['db'];var utils=require(_0x6c55('0x6'));var logger=require(_0x6c55('0x7'))('rpc');var config=require(_0x6c55('0x8'));var jayson=require(_0x6c55('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4819c0,_0x50ec95,_0x4a5d29){return new BPromise(function(_0x6801cd,_0x3f67ff){return client[_0x6c55('0xa')](_0x4819c0,_0x4a5d29)[_0x6c55('0xb')](function(_0x26349d){logger[_0x6c55('0xc')](_0x6c55('0xd'),_0x50ec95,_0x6c55('0xe'));logger[_0x6c55('0xf')]('ZendeskConfiguration,\x20%s,\x20%s,\x20%s',_0x50ec95,_0x6c55('0xe'),JSON[_0x6c55('0x10')](_0x26349d));if(_0x26349d[_0x6c55('0x11')]){if(_0x26349d['error']['code']===0x1f4){logger['error']('ZendeskConfiguration,\x20%s,\x20%s',_0x50ec95,_0x26349d['error'][_0x6c55('0x12')]);return _0x3f67ff(_0x26349d[_0x6c55('0x11')]['message']);}logger[_0x6c55('0x11')](_0x6c55('0xd'),_0x50ec95,_0x26349d[_0x6c55('0x11')][_0x6c55('0x12')]);return _0x6801cd(_0x26349d[_0x6c55('0x11')][_0x6c55('0x12')]);}else{logger[_0x6c55('0xc')]('ZendeskConfiguration,\x20%s,\x20%s',_0x50ec95,_0x6c55('0xe'));_0x6801cd(_0x26349d[_0x6c55('0x13')][_0x6c55('0x12')]);}})[_0x6c55('0x14')](function(_0x2e574c){logger[_0x6c55('0x11')](_0x6c55('0xd'),_0x50ec95,_0x2e574c);_0x3f67ff(_0x2e574c);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index d40374f..90ddef8 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 _0x98ab=['show','post','create','put','update','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskField.controller','get','isAuthenticated','index','/:id'];(function(_0x754eeb,_0x5296e6){var _0x4c272e=function(_0x27e1f3){while(--_0x27e1f3){_0x754eeb['push'](_0x754eeb['shift']());}};_0x4c272e(++_0x5296e6);}(_0x98ab,0x10a));var _0xb98a=function(_0xe73d1,_0x4b596b){_0xe73d1=_0xe73d1-0x0;var _0x4aadbd=_0x98ab[_0xe73d1];return _0x4aadbd;};'use strict';var multer=require(_0xb98a('0x0'));var util=require(_0xb98a('0x1'));var path=require(_0xb98a('0x2'));var timeout=require(_0xb98a('0x3'));var express=require(_0xb98a('0x4'));var router=express['Router']();var fs_extra=require(_0xb98a('0x5'));var auth=require(_0xb98a('0x6'));var interaction=require(_0xb98a('0x7'));var config=require(_0xb98a('0x8'));var controller=require(_0xb98a('0x9'));router[_0xb98a('0xa')]('/',auth[_0xb98a('0xb')](),controller[_0xb98a('0xc')]);router['get'](_0xb98a('0xd'),auth['isAuthenticated'](),controller[_0xb98a('0xe')]);router[_0xb98a('0xf')]('/',auth[_0xb98a('0xb')](),controller[_0xb98a('0x10')]);router[_0xb98a('0x11')](_0xb98a('0xd'),auth['isAuthenticated'](),controller[_0xb98a('0x12')]);router['delete']('/:id',auth[_0xb98a('0xb')](),controller['destroy']);module[_0xb98a('0x13')]=router; \ No newline at end of file +var _0xa8dc=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskField.controller','isAuthenticated','index','get','/:id','show','post','create','put','update','delete','destroy','multer','util','path','express'];(function(_0xc4d76d,_0x216adb){var _0x10eb09=function(_0x46e2e4){while(--_0x46e2e4){_0xc4d76d['push'](_0xc4d76d['shift']());}};_0x10eb09(++_0x216adb);}(_0xa8dc,0xce));var _0xca8d=function(_0x483e50,_0xf30714){_0x483e50=_0x483e50-0x0;var _0x4e3456=_0xa8dc[_0x483e50];return _0x4e3456;};'use strict';var multer=require(_0xca8d('0x0'));var util=require(_0xca8d('0x1'));var path=require(_0xca8d('0x2'));var timeout=require('connect-timeout');var express=require(_0xca8d('0x3'));var router=express[_0xca8d('0x4')]();var fs_extra=require(_0xca8d('0x5'));var auth=require(_0xca8d('0x6'));var interaction=require(_0xca8d('0x7'));var config=require(_0xca8d('0x8'));var controller=require(_0xca8d('0x9'));router['get']('/',auth[_0xca8d('0xa')](),controller[_0xca8d('0xb')]);router[_0xca8d('0xc')](_0xca8d('0xd'),auth[_0xca8d('0xa')](),controller[_0xca8d('0xe')]);router[_0xca8d('0xf')]('/',auth['isAuthenticated'](),controller[_0xca8d('0x10')]);router[_0xca8d('0x11')](_0xca8d('0xd'),auth[_0xca8d('0xa')](),controller[_0xca8d('0x12')]);router[_0xca8d('0x13')]('/:id',auth[_0xca8d('0xa')](),controller[_0xca8d('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.attributes.js b/server/api/intZendeskField/intZendeskField.attributes.js index d7259f0..15a3925 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 _0x2895=['ENUM','string','customVariable','keyValue','picklist','STRING','variable','BOOLEAN','sequelize','exports'];(function(_0x3b0731,_0xcf9925){var _0x4204d7=function(_0x635ac5){while(--_0x635ac5){_0x3b0731['push'](_0x3b0731['shift']());}};_0x4204d7(++_0xcf9925);}(_0x2895,0x80));var _0x5289=function(_0x42ded4,_0x4a5684){_0x42ded4=_0x42ded4-0x0;var _0x255d48=_0x2895[_0x42ded4];return _0x255d48;};'use strict';var Sequelize=require(_0x5289('0x0'));module[_0x5289('0x1')]={'type':{'type':Sequelize[_0x5289('0x2')](_0x5289('0x3'),'variable',_0x5289('0x4'),_0x5289('0x5'),_0x5289('0x6')),'defaultValue':'string'},'content':{'type':Sequelize[_0x5289('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x5289('0x2')](_0x5289('0x3'),_0x5289('0x8'),_0x5289('0x4'))},'keyContent':{'type':Sequelize[_0x5289('0x7')]},'idField':{'type':Sequelize[_0x5289('0x7')]},'nameField':{'type':Sequelize[_0x5289('0x7')]},'customField':{'type':Sequelize[_0x5289('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x5289('0x7')]}}; \ No newline at end of file +var _0x610e=['customVariable','keyValue','picklist','string','STRING','ENUM','variable','BOOLEAN','sequelize','exports'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x610e,0x1f2));var _0xe610=function(_0x38cd90,_0x4a5c49){_0x38cd90=_0x38cd90-0x0;var _0x5ebe32=_0x610e[_0x38cd90];return _0x5ebe32;};'use strict';var Sequelize=require(_0xe610('0x0'));module[_0xe610('0x1')]={'type':{'type':Sequelize['ENUM']('string','variable',_0xe610('0x2'),_0xe610('0x3'),_0xe610('0x4')),'defaultValue':_0xe610('0x5')},'content':{'type':Sequelize[_0xe610('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xe610('0x7')]('string',_0xe610('0x8'),'customVariable')},'keyContent':{'type':Sequelize[_0xe610('0x6')]},'idField':{'type':Sequelize[_0xe610('0x6')]},'nameField':{'type':Sequelize[_0xe610('0x6')]},'customField':{'type':Sequelize[_0xe610('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.controller.js b/server/api/intZendeskField/intZendeskField.controller.js index ef02c91..8bd5005 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 _0xd6d5=['error','stack','name','send','index','map','ZendeskField','rawAttributes','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options','includeAll','catch','params','include','find','create','body','eml-format','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','end','sendStatus'];(function(_0x413354,_0x583cae){var _0x31f617=function(_0x10ea2c){while(--_0x10ea2c){_0x413354['push'](_0x413354['shift']());}};_0x31f617(++_0x583cae);}(_0xd6d5,0x1de));var _0x5d6d=function(_0x28c939,_0x110e29){_0x28c939=_0x28c939-0x0;var _0x527fe9=_0xd6d5[_0x28c939];return _0x527fe9;};'use strict';var emlformat=require(_0x5d6d('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x5d6d('0x1'));var rp=require(_0x5d6d('0x2'));var moment=require('moment');var BPromise=require(_0x5d6d('0x3'));var Mustache=require(_0x5d6d('0x4'));var util=require(_0x5d6d('0x5'));var path=require(_0x5d6d('0x6'));var sox=require(_0x5d6d('0x7'));var csv=require(_0x5d6d('0x8'));var ejs=require(_0x5d6d('0x9'));var fs=require('fs');var fs_extra=require(_0x5d6d('0xa'));var _=require(_0x5d6d('0xb'));var squel=require(_0x5d6d('0xc'));var crypto=require(_0x5d6d('0xd'));var jsforce=require(_0x5d6d('0xe'));var deskjs=require(_0x5d6d('0xf'));var toCsv=require(_0x5d6d('0x8'));var querystring=require(_0x5d6d('0x10'));var Papa=require(_0x5d6d('0x11'));var Redis=require(_0x5d6d('0x12'));var authService=require(_0x5d6d('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x5d6d('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x5d6d('0x15'));var config=require(_0x5d6d('0x16'));var licenseUtil=require(_0x5d6d('0x17'));var db=require(_0x5d6d('0x18'))['db'];function respondWithStatusCode(_0xd55c9b,_0xaff3d0){_0xaff3d0=_0xaff3d0||0xcc;return function(_0x5d2e6c){if(_0x5d2e6c){return _0xd55c9b['sendStatus'](_0xaff3d0);}return _0xd55c9b[_0x5d6d('0x19')](_0xaff3d0)['end']();};}function respondWithResult(_0x55441e,_0x127d8f){_0x127d8f=_0x127d8f||0xc8;return function(_0x1ceebd){if(_0x1ceebd){return _0x55441e[_0x5d6d('0x19')](_0x127d8f)[_0x5d6d('0x1a')](_0x1ceebd);}};}function respondWithFilteredResult(_0x5382df,_0x9b6f54){return function(_0x5c0d5b){if(_0x5c0d5b){var _0x53de41=typeof _0x9b6f54[_0x5d6d('0x1b')]===_0x5d6d('0x1c')&&typeof _0x9b6f54[_0x5d6d('0x1d')]===_0x5d6d('0x1c');var _0x498823=_0x5c0d5b[_0x5d6d('0x1e')];var _0x42122c=_0x53de41?0x0:_0x9b6f54[_0x5d6d('0x1b')];var _0x432412=_0x53de41?_0x5c0d5b[_0x5d6d('0x1e')]:_0x9b6f54[_0x5d6d('0x1b')]+_0x9b6f54['limit'];var _0x350ed3;if(_0x432412>=_0x498823){_0x432412=_0x498823;_0x350ed3=0xc8;}else{_0x350ed3=0xce;}_0x5382df[_0x5d6d('0x19')](_0x350ed3);return _0x5382df[_0x5d6d('0x1f')](_0x5d6d('0x20'),_0x42122c+'-'+_0x432412+'/'+_0x498823)[_0x5d6d('0x1a')](_0x5c0d5b);}return null;};}function patchUpdates(_0x4a7310){return function(_0x2d3a35){try{jsonpatch[_0x5d6d('0x21')](_0x2d3a35,_0x4a7310,!![]);}catch(_0x1aa87f){return BPromise['reject'](_0x1aa87f);}return _0x2d3a35[_0x5d6d('0x22')]();};}function saveUpdates(_0x4c93cb,_0x22cd07){return function(_0x269dfc){if(_0x269dfc){return _0x269dfc[_0x5d6d('0x23')](_0x4c93cb)[_0x5d6d('0x24')](function(_0x3b61ff){return _0x3b61ff;});}return null;};}function removeEntity(_0x1164f5,_0x31b123){return function(_0x532b3e){if(_0x532b3e){return _0x532b3e[_0x5d6d('0x25')]()[_0x5d6d('0x24')](function(){_0x1164f5['status'](0xcc)[_0x5d6d('0x26')]();});}};}function handleEntityNotFound(_0x3b891d,_0x4fb809){return function(_0x29128b){if(!_0x29128b){_0x3b891d[_0x5d6d('0x27')](0x194);}return _0x29128b;};}function handleError(_0x3c1ddf,_0x7cc66c){_0x7cc66c=_0x7cc66c||0x1f4;return function(_0x5cce30){logger[_0x5d6d('0x28')](_0x5cce30[_0x5d6d('0x29')]);if(_0x5cce30[_0x5d6d('0x2a')]){delete _0x5cce30[_0x5d6d('0x2a')];}_0x3c1ddf[_0x5d6d('0x19')](_0x7cc66c)[_0x5d6d('0x2b')](_0x5cce30);};}exports[_0x5d6d('0x2c')]=function(_0x5c7255,_0x305297){var _0x24625d={},_0x3098ac={},_0x50f6a8={'count':0x0,'rows':[]};var _0x5b9f5f=_[_0x5d6d('0x2d')](db[_0x5d6d('0x2e')][_0x5d6d('0x2f')],function(_0x711e18){return{'name':_0x711e18['fieldName'],'type':_0x711e18[_0x5d6d('0x30')][_0x5d6d('0x31')]};});_0x3098ac[_0x5d6d('0x32')]=_[_0x5d6d('0x2d')](_0x5b9f5f,_0x5d6d('0x2a'));_0x3098ac[_0x5d6d('0x33')]=_[_0x5d6d('0x34')](_0x5c7255[_0x5d6d('0x33')]);_0x3098ac[_0x5d6d('0x35')]=_['intersection'](_0x3098ac[_0x5d6d('0x32')],_0x3098ac[_0x5d6d('0x33')]);_0x24625d[_0x5d6d('0x36')]=_[_0x5d6d('0x37')](_0x3098ac[_0x5d6d('0x32')],qs[_0x5d6d('0x38')](_0x5c7255[_0x5d6d('0x33')]['fields']));_0x24625d['attributes']=_0x24625d[_0x5d6d('0x36')][_0x5d6d('0x39')]?_0x24625d['attributes']:_0x3098ac[_0x5d6d('0x32')];if(!_0x5c7255['query'][_0x5d6d('0x3a')](_0x5d6d('0x3b'))){_0x24625d[_0x5d6d('0x1d')]=qs['limit'](_0x5c7255[_0x5d6d('0x33')][_0x5d6d('0x1d')]);_0x24625d[_0x5d6d('0x1b')]=qs[_0x5d6d('0x1b')](_0x5c7255[_0x5d6d('0x33')][_0x5d6d('0x1b')]);}_0x24625d[_0x5d6d('0x3c')]=qs[_0x5d6d('0x3d')](_0x5c7255[_0x5d6d('0x33')]['sort']);_0x24625d['where']=qs[_0x5d6d('0x35')](_[_0x5d6d('0x3e')](_0x5c7255[_0x5d6d('0x33')],_0x3098ac[_0x5d6d('0x35')]),_0x5b9f5f);if(_0x5c7255['query'][_0x5d6d('0x3f')]){_0x24625d['where']=_['merge'](_0x24625d[_0x5d6d('0x40')],{'$or':_[_0x5d6d('0x2d')](_0x5b9f5f,function(_0x503ce4){if(_0x503ce4[_0x5d6d('0x30')]!=='VIRTUAL'){var _0x5f4836={};_0x5f4836[_0x503ce4[_0x5d6d('0x2a')]]={'$like':'%'+_0x5c7255[_0x5d6d('0x33')][_0x5d6d('0x3f')]+'%'};return _0x5f4836;}})});}_0x24625d=_[_0x5d6d('0x41')]({},_0x24625d,_0x5c7255[_0x5d6d('0x42')]);var _0x2764d3={'where':_0x24625d[_0x5d6d('0x40')]};return db[_0x5d6d('0x2e')][_0x5d6d('0x1e')](_0x2764d3)[_0x5d6d('0x24')](function(_0x3152d0){_0x50f6a8[_0x5d6d('0x1e')]=_0x3152d0;if(_0x5c7255[_0x5d6d('0x33')][_0x5d6d('0x43')]){_0x24625d['include']=[{'all':!![]}];}return db[_0x5d6d('0x2e')]['findAll'](_0x24625d);})['then'](function(_0x2fd04f){_0x50f6a8['rows']=_0x2fd04f;return _0x50f6a8;})[_0x5d6d('0x24')](respondWithFilteredResult(_0x305297,_0x24625d))[_0x5d6d('0x44')](handleError(_0x305297,null));};exports['show']=function(_0x4472b7,_0xdb66b4){var _0x597f4f={'raw':!![],'where':{'id':_0x4472b7[_0x5d6d('0x45')]['id']}},_0x5ae8ca={};_0x5ae8ca[_0x5d6d('0x32')]=_[_0x5d6d('0x34')](db[_0x5d6d('0x2e')]['rawAttributes']);_0x5ae8ca[_0x5d6d('0x33')]=_[_0x5d6d('0x34')](_0x4472b7[_0x5d6d('0x33')]);_0x5ae8ca[_0x5d6d('0x35')]=_[_0x5d6d('0x37')](_0x5ae8ca[_0x5d6d('0x32')],_0x5ae8ca[_0x5d6d('0x33')]);_0x597f4f[_0x5d6d('0x36')]=_[_0x5d6d('0x37')](_0x5ae8ca[_0x5d6d('0x32')],qs[_0x5d6d('0x38')](_0x4472b7[_0x5d6d('0x33')][_0x5d6d('0x38')]));_0x597f4f[_0x5d6d('0x36')]=_0x597f4f[_0x5d6d('0x36')][_0x5d6d('0x39')]?_0x597f4f['attributes']:_0x5ae8ca[_0x5d6d('0x32')];if(_0x4472b7[_0x5d6d('0x33')][_0x5d6d('0x43')]){_0x597f4f[_0x5d6d('0x46')]=[{'all':!![]}];}_0x597f4f=_[_0x5d6d('0x41')]({},_0x597f4f,_0x4472b7['options']);return db[_0x5d6d('0x2e')][_0x5d6d('0x47')](_0x597f4f)['then'](handleEntityNotFound(_0xdb66b4,null))[_0x5d6d('0x24')](respondWithResult(_0xdb66b4,null))[_0x5d6d('0x44')](handleError(_0xdb66b4,null));};exports[_0x5d6d('0x48')]=function(_0x3b4dd8,_0x51e8d6){return db[_0x5d6d('0x2e')]['create'](_0x3b4dd8['body'],{})['then'](respondWithResult(_0x51e8d6,0xc9))[_0x5d6d('0x44')](handleError(_0x51e8d6,null));};exports[_0x5d6d('0x23')]=function(_0x1e1618,_0x4b83b9){if(_0x1e1618[_0x5d6d('0x49')]['id']){delete _0x1e1618[_0x5d6d('0x49')]['id'];}return db[_0x5d6d('0x2e')][_0x5d6d('0x47')]({'where':{'id':_0x1e1618[_0x5d6d('0x45')]['id']}})['then'](handleEntityNotFound(_0x4b83b9,null))['then'](saveUpdates(_0x1e1618['body'],null))[_0x5d6d('0x24')](respondWithResult(_0x4b83b9,null))[_0x5d6d('0x44')](handleError(_0x4b83b9,null));};exports[_0x5d6d('0x25')]=function(_0x4d57b1,_0x3bb5e4){return db['ZendeskField'][_0x5d6d('0x47')]({'where':{'id':_0x4d57b1[_0x5d6d('0x45')]['id']}})[_0x5d6d('0x24')](handleEntityNotFound(_0x3bb5e4,null))[_0x5d6d('0x24')](removeEntity(_0x3bb5e4,null))[_0x5d6d('0x44')](handleError(_0x3bb5e4,null));}; \ No newline at end of file +var _0xd45b=['find','create','body','eml-format','rimraf','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','undefined','limit','count','offset','set','Content-Range','json','save','update','then','destroy','error','name','send','index','map','rawAttributes','fieldName','key','query','keys','filters','intersection','model','attributes','fields','length','nolimit','sort','where','filter','type','VIRTUAL','merge','ZendeskField','includeAll','include','rows','catch','params','options'];(function(_0x2b5eae,_0x55010d){var _0x5f3ac9=function(_0x397bfc){while(--_0x397bfc){_0x2b5eae['push'](_0x2b5eae['shift']());}};_0x5f3ac9(++_0x55010d);}(_0xd45b,0x11f));var _0xbd45=function(_0x5d3c2c,_0x4f8f8d){_0x5d3c2c=_0x5d3c2c-0x0;var _0x116df2=_0xd45b[_0x5d3c2c];return _0x116df2;};'use strict';var emlformat=require(_0xbd45('0x0'));var rimraf=require(_0xbd45('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xbd45('0x2'));var moment=require(_0xbd45('0x3'));var BPromise=require(_0xbd45('0x4'));var Mustache=require('mustache');var util=require(_0xbd45('0x5'));var path=require(_0xbd45('0x6'));var sox=require(_0xbd45('0x7'));var csv=require(_0xbd45('0x8'));var ejs=require(_0xbd45('0x9'));var fs=require('fs');var fs_extra=require(_0xbd45('0xa'));var _=require(_0xbd45('0xb'));var squel=require(_0xbd45('0xc'));var crypto=require('crypto');var jsforce=require(_0xbd45('0xd'));var deskjs=require(_0xbd45('0xe'));var toCsv=require(_0xbd45('0x8'));var querystring=require(_0xbd45('0xf'));var Papa=require('papaparse');var Redis=require(_0xbd45('0x10'));var authService=require(_0xbd45('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbd45('0x12'));var logger=require(_0xbd45('0x13'))(_0xbd45('0x14'));var utils=require(_0xbd45('0x15'));var config=require(_0xbd45('0x16'));var licenseUtil=require(_0xbd45('0x17'));var db=require(_0xbd45('0x18'))['db'];function respondWithStatusCode(_0x9e2aab,_0x5903fc){_0x5903fc=_0x5903fc||0xcc;return function(_0x460d8c){if(_0x460d8c){return _0x9e2aab[_0xbd45('0x19')](_0x5903fc);}return _0x9e2aab[_0xbd45('0x1a')](_0x5903fc)['end']();};}function respondWithResult(_0x143bfb,_0x1fa426){_0x1fa426=_0x1fa426||0xc8;return function(_0x3fe212){if(_0x3fe212){return _0x143bfb[_0xbd45('0x1a')](_0x1fa426)['json'](_0x3fe212);}};}function respondWithFilteredResult(_0x67a704,_0x566efd){return function(_0x346a1e){if(_0x346a1e){var _0x22d361=typeof _0x566efd['offset']===_0xbd45('0x1b')&&typeof _0x566efd[_0xbd45('0x1c')]===_0xbd45('0x1b');var _0x51e0e1=_0x346a1e[_0xbd45('0x1d')];var _0x467795=_0x22d361?0x0:_0x566efd[_0xbd45('0x1e')];var _0x36457f=_0x22d361?_0x346a1e[_0xbd45('0x1d')]:_0x566efd['offset']+_0x566efd[_0xbd45('0x1c')];var _0xb0c281;if(_0x36457f>=_0x51e0e1){_0x36457f=_0x51e0e1;_0xb0c281=0xc8;}else{_0xb0c281=0xce;}_0x67a704[_0xbd45('0x1a')](_0xb0c281);return _0x67a704[_0xbd45('0x1f')](_0xbd45('0x20'),_0x467795+'-'+_0x36457f+'/'+_0x51e0e1)[_0xbd45('0x21')](_0x346a1e);}return null;};}function patchUpdates(_0x55e8ee){return function(_0x56f138){try{jsonpatch['apply'](_0x56f138,_0x55e8ee,!![]);}catch(_0x1a1451){return BPromise['reject'](_0x1a1451);}return _0x56f138[_0xbd45('0x22')]();};}function saveUpdates(_0x2f3c9f,_0x4d2884){return function(_0x2d6577){if(_0x2d6577){return _0x2d6577[_0xbd45('0x23')](_0x2f3c9f)[_0xbd45('0x24')](function(_0x277a71){return _0x277a71;});}return null;};}function removeEntity(_0x26b8e0,_0x4f864d){return function(_0x2a376a){if(_0x2a376a){return _0x2a376a[_0xbd45('0x25')]()[_0xbd45('0x24')](function(){_0x26b8e0[_0xbd45('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x33efe9,_0x163512){return function(_0xdf11cf){if(!_0xdf11cf){_0x33efe9[_0xbd45('0x19')](0x194);}return _0xdf11cf;};}function handleError(_0x39aeb7,_0x50f5fa){_0x50f5fa=_0x50f5fa||0x1f4;return function(_0x5f1428){logger[_0xbd45('0x26')](_0x5f1428['stack']);if(_0x5f1428['name']){delete _0x5f1428[_0xbd45('0x27')];}_0x39aeb7[_0xbd45('0x1a')](_0x50f5fa)[_0xbd45('0x28')](_0x5f1428);};}exports[_0xbd45('0x29')]=function(_0x4a8b12,_0x3d9959){var _0x43ac01={},_0x1f5798={},_0x436149={'count':0x0,'rows':[]};var _0xc46e47=_[_0xbd45('0x2a')](db['ZendeskField'][_0xbd45('0x2b')],function(_0x37655f){return{'name':_0x37655f[_0xbd45('0x2c')],'type':_0x37655f['type'][_0xbd45('0x2d')]};});_0x1f5798['model']=_[_0xbd45('0x2a')](_0xc46e47,_0xbd45('0x27'));_0x1f5798[_0xbd45('0x2e')]=_[_0xbd45('0x2f')](_0x4a8b12['query']);_0x1f5798[_0xbd45('0x30')]=_[_0xbd45('0x31')](_0x1f5798[_0xbd45('0x32')],_0x1f5798['query']);_0x43ac01[_0xbd45('0x33')]=_['intersection'](_0x1f5798[_0xbd45('0x32')],qs[_0xbd45('0x34')](_0x4a8b12[_0xbd45('0x2e')][_0xbd45('0x34')]));_0x43ac01[_0xbd45('0x33')]=_0x43ac01[_0xbd45('0x33')][_0xbd45('0x35')]?_0x43ac01[_0xbd45('0x33')]:_0x1f5798[_0xbd45('0x32')];if(!_0x4a8b12['query']['hasOwnProperty'](_0xbd45('0x36'))){_0x43ac01['limit']=qs[_0xbd45('0x1c')](_0x4a8b12[_0xbd45('0x2e')][_0xbd45('0x1c')]);_0x43ac01[_0xbd45('0x1e')]=qs[_0xbd45('0x1e')](_0x4a8b12[_0xbd45('0x2e')][_0xbd45('0x1e')]);}_0x43ac01['order']=qs[_0xbd45('0x37')](_0x4a8b12[_0xbd45('0x2e')][_0xbd45('0x37')]);_0x43ac01[_0xbd45('0x38')]=qs[_0xbd45('0x30')](_['pick'](_0x4a8b12[_0xbd45('0x2e')],_0x1f5798[_0xbd45('0x30')]),_0xc46e47);if(_0x4a8b12[_0xbd45('0x2e')][_0xbd45('0x39')]){_0x43ac01[_0xbd45('0x38')]=_['merge'](_0x43ac01[_0xbd45('0x38')],{'$or':_[_0xbd45('0x2a')](_0xc46e47,function(_0x4c8f27){if(_0x4c8f27[_0xbd45('0x3a')]!==_0xbd45('0x3b')){var _0x154cb7={};_0x154cb7[_0x4c8f27['name']]={'$like':'%'+_0x4a8b12[_0xbd45('0x2e')][_0xbd45('0x39')]+'%'};return _0x154cb7;}})});}_0x43ac01=_[_0xbd45('0x3c')]({},_0x43ac01,_0x4a8b12['options']);var _0x200cd9={'where':_0x43ac01[_0xbd45('0x38')]};return db[_0xbd45('0x3d')]['count'](_0x200cd9)[_0xbd45('0x24')](function(_0x4a9c63){_0x436149[_0xbd45('0x1d')]=_0x4a9c63;if(_0x4a8b12[_0xbd45('0x2e')][_0xbd45('0x3e')]){_0x43ac01[_0xbd45('0x3f')]=[{'all':!![]}];}return db['ZendeskField']['findAll'](_0x43ac01);})['then'](function(_0x111e85){_0x436149[_0xbd45('0x40')]=_0x111e85;return _0x436149;})[_0xbd45('0x24')](respondWithFilteredResult(_0x3d9959,_0x43ac01))[_0xbd45('0x41')](handleError(_0x3d9959,null));};exports['show']=function(_0x4dd69e,_0x46bd14){var _0x53b291={'raw':!![],'where':{'id':_0x4dd69e[_0xbd45('0x42')]['id']}},_0x4a4f82={};_0x4a4f82[_0xbd45('0x32')]=_[_0xbd45('0x2f')](db[_0xbd45('0x3d')][_0xbd45('0x2b')]);_0x4a4f82['query']=_[_0xbd45('0x2f')](_0x4dd69e['query']);_0x4a4f82[_0xbd45('0x30')]=_[_0xbd45('0x31')](_0x4a4f82['model'],_0x4a4f82[_0xbd45('0x2e')]);_0x53b291[_0xbd45('0x33')]=_[_0xbd45('0x31')](_0x4a4f82[_0xbd45('0x32')],qs[_0xbd45('0x34')](_0x4dd69e[_0xbd45('0x2e')]['fields']));_0x53b291['attributes']=_0x53b291['attributes'][_0xbd45('0x35')]?_0x53b291[_0xbd45('0x33')]:_0x4a4f82[_0xbd45('0x32')];if(_0x4dd69e[_0xbd45('0x2e')]['includeAll']){_0x53b291[_0xbd45('0x3f')]=[{'all':!![]}];}_0x53b291=_[_0xbd45('0x3c')]({},_0x53b291,_0x4dd69e[_0xbd45('0x43')]);return db[_0xbd45('0x3d')][_0xbd45('0x44')](_0x53b291)[_0xbd45('0x24')](handleEntityNotFound(_0x46bd14,null))['then'](respondWithResult(_0x46bd14,null))[_0xbd45('0x41')](handleError(_0x46bd14,null));};exports['create']=function(_0x563342,_0x9d12be){return db[_0xbd45('0x3d')][_0xbd45('0x45')](_0x563342[_0xbd45('0x46')],{})[_0xbd45('0x24')](respondWithResult(_0x9d12be,0xc9))[_0xbd45('0x41')](handleError(_0x9d12be,null));};exports[_0xbd45('0x23')]=function(_0x4d9c3a,_0x140a09){if(_0x4d9c3a[_0xbd45('0x46')]['id']){delete _0x4d9c3a[_0xbd45('0x46')]['id'];}return db[_0xbd45('0x3d')][_0xbd45('0x44')]({'where':{'id':_0x4d9c3a[_0xbd45('0x42')]['id']}})['then'](handleEntityNotFound(_0x140a09,null))[_0xbd45('0x24')](saveUpdates(_0x4d9c3a[_0xbd45('0x46')],null))[_0xbd45('0x24')](respondWithResult(_0x140a09,null))[_0xbd45('0x41')](handleError(_0x140a09,null));};exports[_0xbd45('0x25')]=function(_0x3d2955,_0x4e2ab8){return db[_0xbd45('0x3d')]['find']({'where':{'id':_0x3d2955[_0xbd45('0x42')]['id']}})['then'](handleEntityNotFound(_0x4e2ab8,null))[_0xbd45('0x24')](removeEntity(_0x4e2ab8,null))[_0xbd45('0x41')](handleError(_0x4e2ab8,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index 6e11185..2d04cf5 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 _0x5f6d=['path','../../config/environment','exports','ZendeskField','int_zendesk_fields','zendesk_unique_index','FieldId','lodash','util','moment','bluebird'];(function(_0x50641c,_0x22186b){var _0x3b48a0=function(_0x43df62){while(--_0x43df62){_0x50641c['push'](_0x50641c['shift']());}};_0x3b48a0(++_0x22186b);}(_0x5f6d,0xa1));var _0xd5f6=function(_0x14594a,_0x399bde){_0x14594a=_0x14594a-0x0;var _0x238ea0=_0x5f6d[_0x14594a];return _0x238ea0;};'use strict';var _=require(_0xd5f6('0x0'));var util=require(_0xd5f6('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xd5f6('0x2'));var BPromise=require(_0xd5f6('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd5f6('0x4'));var rimraf=require('rimraf');var config=require(_0xd5f6('0x5'));var attributes=require('./intZendeskField.attributes');module[_0xd5f6('0x6')]=function(_0xe7ccdf,_0xad62b8){return _0xe7ccdf['define'](_0xd5f6('0x7'),attributes,{'tableName':_0xd5f6('0x8'),'paranoid':![],'indexes':[{'name':_0xd5f6('0x9'),'fields':['idField',_0xd5f6('0xa')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb176=['ZendeskField','zendesk_unique_index','idField','FieldId','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./intZendeskField.attributes','exports','define'];(function(_0x3a6efd,_0x2a5102){var _0x487b9a=function(_0x104f89){while(--_0x104f89){_0x3a6efd['push'](_0x3a6efd['shift']());}};_0x487b9a(++_0x2a5102);}(_0xb176,0x74));var _0x6b17=function(_0x36f47c,_0x38ef4d){_0x36f47c=_0x36f47c-0x0;var _0x296c55=_0xb176[_0x36f47c];return _0x296c55;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x6b17('0x0'))(_0x6b17('0x1'));var moment=require(_0x6b17('0x2'));var BPromise=require(_0x6b17('0x3'));var rp=require(_0x6b17('0x4'));var fs=require('fs');var path=require(_0x6b17('0x5'));var rimraf=require('rimraf');var config=require(_0x6b17('0x6'));var attributes=require(_0x6b17('0x7'));module[_0x6b17('0x8')]=function(_0x5265d2,_0x2db88f){return _0x5265d2[_0x6b17('0x9')](_0x6b17('0xa'),attributes,{'tableName':'int_zendesk_fields','paranoid':![],'indexes':[{'name':_0x6b17('0xb'),'fields':[_0x6b17('0xc'),_0x6b17('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.rpc.js b/server/api/intZendeskField/intZendeskField.rpc.js index 5c353b4..5343672 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 _0xe39e=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','ZendeskField,\x20%s,\x20%s','request\x20sent','ZendeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring'];(function(_0xe34bbc,_0xd894af){var _0x2f3f01=function(_0xed759f){while(--_0xed759f){_0xe34bbc['push'](_0xe34bbc['shift']());}};_0x2f3f01(++_0xd894af);}(_0xe39e,0x1a4));var _0xee39=function(_0xe5e3fb,_0x2fa636){_0xe5e3fb=_0xe5e3fb-0x0;var _0xdc5834=_0xe39e[_0xe5e3fb];return _0xdc5834;};'use strict';var _=require(_0xee39('0x0'));var util=require(_0xee39('0x1'));var moment=require(_0xee39('0x2'));var BPromise=require(_0xee39('0x3'));var rs=require(_0xee39('0x4'));var fs=require('fs');var Redis=require(_0xee39('0x5'));var db=require(_0xee39('0x6'))['db'];var utils=require(_0xee39('0x7'));var logger=require(_0xee39('0x8'))(_0xee39('0x9'));var config=require(_0xee39('0xa'));var jayson=require(_0xee39('0xb'));var client=jayson[_0xee39('0xc')][_0xee39('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x26308e,_0x4f4245,_0x31eeb9){return new BPromise(function(_0x50eb65,_0x56a7ae){return client[_0xee39('0xe')](_0x26308e,_0x31eeb9)['then'](function(_0x311cc8){logger[_0xee39('0xf')](_0xee39('0x10'),_0x4f4245,_0xee39('0x11'));logger['debug'](_0xee39('0x12'),_0x4f4245,_0xee39('0x11'),JSON[_0xee39('0x13')](_0x311cc8));if(_0x311cc8[_0xee39('0x14')]){if(_0x311cc8[_0xee39('0x14')][_0xee39('0x15')]===0x1f4){logger['error']('ZendeskField,\x20%s,\x20%s',_0x4f4245,_0x311cc8['error'][_0xee39('0x16')]);return _0x56a7ae(_0x311cc8['error']['message']);}logger[_0xee39('0x14')](_0xee39('0x10'),_0x4f4245,_0x311cc8[_0xee39('0x14')][_0xee39('0x16')]);return _0x50eb65(_0x311cc8[_0xee39('0x14')]['message']);}else{logger['info']('ZendeskField,\x20%s,\x20%s',_0x4f4245,_0xee39('0x11'));_0x50eb65(_0x311cc8[_0xee39('0x17')][_0xee39('0x16')]);}})[_0xee39('0x18')](function(_0x51db0b){logger[_0xee39('0x14')](_0xee39('0x10'),_0x4f4245,_0x51db0b);_0x56a7ae(_0x51db0b);});});} \ No newline at end of file +var _0xd830=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','request','info','ZendeskField,\x20%s,\x20%s','ZendeskField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash'];(function(_0x6a020a,_0x16fd42){var _0x161aa2=function(_0x4d6846){while(--_0x4d6846){_0x6a020a['push'](_0x6a020a['shift']());}};_0x161aa2(++_0x16fd42);}(_0xd830,0xaf));var _0x0d83=function(_0x26d567,_0x58c8b3){_0x26d567=_0x26d567-0x0;var _0x597464=_0xd830[_0x26d567];return _0x597464;};'use strict';var _=require(_0x0d83('0x0'));var util=require(_0x0d83('0x1'));var moment=require(_0x0d83('0x2'));var BPromise=require(_0x0d83('0x3'));var rs=require(_0x0d83('0x4'));var fs=require('fs');var Redis=require(_0x0d83('0x5'));var db=require(_0x0d83('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x0d83('0x7'));var config=require(_0x0d83('0x8'));var jayson=require(_0x0d83('0x9'));var client=jayson[_0x0d83('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x258e28,_0x5b14c4,_0x34549c){return new BPromise(function(_0x31cefa,_0x194166){return client[_0x0d83('0xb')](_0x258e28,_0x34549c)['then'](function(_0x3fc721){logger[_0x0d83('0xc')](_0x0d83('0xd'),_0x5b14c4,'request\x20sent');logger['debug'](_0x0d83('0xe'),_0x5b14c4,_0x0d83('0xf'),JSON[_0x0d83('0x10')](_0x3fc721));if(_0x3fc721[_0x0d83('0x11')]){if(_0x3fc721[_0x0d83('0x11')][_0x0d83('0x12')]===0x1f4){logger[_0x0d83('0x11')]('ZendeskField,\x20%s,\x20%s',_0x5b14c4,_0x3fc721[_0x0d83('0x11')][_0x0d83('0x13')]);return _0x194166(_0x3fc721['error'][_0x0d83('0x13')]);}logger['error'](_0x0d83('0xd'),_0x5b14c4,_0x3fc721[_0x0d83('0x11')][_0x0d83('0x13')]);return _0x31cefa(_0x3fc721[_0x0d83('0x11')][_0x0d83('0x13')]);}else{logger[_0x0d83('0xc')](_0x0d83('0xd'),_0x5b14c4,'request\x20sent');_0x31cefa(_0x3fc721[_0x0d83('0x14')][_0x0d83('0x13')]);}})[_0x0d83('0x15')](function(_0x4cb185){logger[_0x0d83('0x11')](_0x0d83('0xd'),_0x5b14c4,_0x4cb185);_0x194166(_0x4cb185);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index f04d916..3b2833e 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 _0x082b=['show','/:id/configurations','/:id/fields','getFields','post','create','addConfiguration','update','delete','destroy','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoAccount.controller','get','index','/:id','isAuthenticated'];(function(_0x787e75,_0x1e6bc7){var _0x5ab1d8=function(_0x52b598){while(--_0x52b598){_0x787e75['push'](_0x787e75['shift']());}};_0x5ab1d8(++_0x1e6bc7);}(_0x082b,0xc2));var _0xb082=function(_0x295c11,_0x54b9e0){_0x295c11=_0x295c11-0x0;var _0xe56efc=_0x082b[_0x295c11];return _0xe56efc;};'use strict';var multer=require(_0xb082('0x0'));var util=require(_0xb082('0x1'));var path=require('path');var timeout=require(_0xb082('0x2'));var express=require(_0xb082('0x3'));var router=express[_0xb082('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xb082('0x5'));var interaction=require(_0xb082('0x6'));var config=require(_0xb082('0x7'));var controller=require(_0xb082('0x8'));router[_0xb082('0x9')]('/',auth['isAuthenticated'](),controller[_0xb082('0xa')]);router[_0xb082('0x9')](_0xb082('0xb'),auth[_0xb082('0xc')](),controller[_0xb082('0xd')]);router['get'](_0xb082('0xe'),auth[_0xb082('0xc')](),controller['getConfigurations']);router['get'](_0xb082('0xf'),auth[_0xb082('0xc')](),controller[_0xb082('0x10')]);router[_0xb082('0x11')]('/',auth[_0xb082('0xc')](),controller[_0xb082('0x12')]);router['post']('/:id/configurations',auth[_0xb082('0xc')](),controller[_0xb082('0x13')]);router['put'](_0xb082('0xb'),auth[_0xb082('0xc')](),controller[_0xb082('0x14')]);router[_0xb082('0x15')](_0xb082('0xb'),auth[_0xb082('0xc')](),controller[_0xb082('0x16')]);module['exports']=router; \ No newline at end of file +var _0x3925=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','getFields','post','addConfiguration','put','update','delete','multer','util','path','connect-timeout'];(function(_0x1269dc,_0x5cc0bc){var _0x2a93fb=function(_0x2950e3){while(--_0x2950e3){_0x1269dc['push'](_0x1269dc['shift']());}};_0x2a93fb(++_0x5cc0bc);}(_0x3925,0x104));var _0x5392=function(_0x25c662,_0x2a558f){_0x25c662=_0x25c662-0x0;var _0x1389a1=_0x3925[_0x25c662];return _0x1389a1;};'use strict';var multer=require(_0x5392('0x0'));var util=require(_0x5392('0x1'));var path=require(_0x5392('0x2'));var timeout=require(_0x5392('0x3'));var express=require(_0x5392('0x4'));var router=express[_0x5392('0x5')]();var fs_extra=require(_0x5392('0x6'));var auth=require(_0x5392('0x7'));var interaction=require(_0x5392('0x8'));var config=require(_0x5392('0x9'));var controller=require(_0x5392('0xa'));router[_0x5392('0xb')]('/',auth[_0x5392('0xc')](),controller[_0x5392('0xd')]);router[_0x5392('0xb')](_0x5392('0xe'),auth[_0x5392('0xc')](),controller[_0x5392('0xf')]);router[_0x5392('0xb')](_0x5392('0x10'),auth['isAuthenticated'](),controller[_0x5392('0x11')]);router[_0x5392('0xb')]('/:id/fields',auth[_0x5392('0xc')](),controller[_0x5392('0x12')]);router[_0x5392('0x13')]('/',auth['isAuthenticated'](),controller['create']);router[_0x5392('0x13')](_0x5392('0x10'),auth[_0x5392('0xc')](),controller[_0x5392('0x14')]);router[_0x5392('0x15')](_0x5392('0xe'),auth[_0x5392('0xc')](),controller[_0x5392('0x16')]);router[_0x5392('0x17')]('/:id',auth[_0x5392('0xc')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.attributes.js b/server/api/intZohoAccount/intZohoAccount.attributes.js index bc749ac..af01fe7 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 _0xd64b=['STRING','sequelize'];(function(_0x4a9399,_0x56271c){var _0x3c18e4=function(_0x2d6d06){while(--_0x2d6d06){_0x4a9399['push'](_0x4a9399['shift']());}};_0x3c18e4(++_0x56271c);}(_0xd64b,0xc1));var _0xbd64=function(_0x56b04e,_0x471ebc){_0x56b04e=_0x56b04e-0x0;var _0x4149b9=_0xd64b[_0x56b04e];return _0x4149b9;};'use strict';var Sequelize=require(_0xbd64('0x0'));module['exports']={'name':{'type':Sequelize[_0xbd64('0x1')]},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0xbd64('0x1')]},'zone':{'type':Sequelize[_0xbd64('0x1')]},'clientId':{'type':Sequelize[_0xbd64('0x1')]},'clientSecret':{'type':Sequelize[_0xbd64('0x1')]},'serverUrl':{'type':Sequelize[_0xbd64('0x1')],'allowNull':![]},'code':{'type':Sequelize['STRING']},'refreshToken':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x702d=['sequelize','exports','STRING'];(function(_0x17b28b,_0x50a595){var _0x5aed68=function(_0x5005f3){while(--_0x5005f3){_0x17b28b['push'](_0x17b28b['shift']());}};_0x5aed68(++_0x50a595);}(_0x702d,0x147));var _0xd702=function(_0x4dedee,_0x16da92){_0x4dedee=_0x4dedee-0x0;var _0x1acb8f=_0x702d[_0x4dedee];return _0x1acb8f;};'use strict';var Sequelize=require(_0xd702('0x0'));module[_0xd702('0x1')]={'name':{'type':Sequelize[_0xd702('0x2')]},'description':{'type':Sequelize[_0xd702('0x2')]},'host':{'type':Sequelize[_0xd702('0x2')]},'zone':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0xd702('0x2')]},'clientSecret':{'type':Sequelize[_0xd702('0x2')]},'serverUrl':{'type':Sequelize[_0xd702('0x2')],'allowNull':![]},'code':{'type':Sequelize[_0xd702('0x2')]},'refreshToken':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.controller.js b/server/api/intZohoAccount/intZohoAccount.controller.js index 5c6fc97..cd1ab4a 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 _0xd033=['../../config/utils','../../config/environment','../../components/integrations/configuration','status','offset','undefined','count','limit','set','Content-Range','update','then','end','sendStatus','stack','name','send','map','ZohoAccount','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','find','create','body','destroy','getConfigurations','params','ZohoConfiguration','hasOwnProperty','addConfiguration','findOne','AccountId','Subjects','getSubjects','Descriptions','channel','ZohoField','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','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','serverUrl','code','com','slice','substring','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','format','https://www.zohoapis.%s/crm/v2/settings/fields','Calls','error','response','Owner','Subject','Description','Call_Duration','Call_Result','Call_Type','api_name','system_mandatory','push','custom_field','picklist','pick_list_values','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','test','Wrong\x20credentials','statusCode','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api'];(function(_0x4e4e83,_0x2f29a7){var _0x4cbeb6=function(_0x6e3854){while(--_0x6e3854){_0x4e4e83['push'](_0x4e4e83['shift']());}};_0x4cbeb6(++_0x2f29a7);}(_0xd033,0xe7));var _0x3d03=function(_0x101e7b,_0x4ef05b){_0x101e7b=_0x101e7b-0x0;var _0x4995c0=_0xd033[_0x101e7b];return _0x4995c0;};'use strict';var emlformat=require(_0x3d03('0x0'));var rimraf=require(_0x3d03('0x1'));var zipdir=require(_0x3d03('0x2'));var jsonpatch=require(_0x3d03('0x3'));var rp=require(_0x3d03('0x4'));var moment=require(_0x3d03('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x3d03('0x6'));var util=require(_0x3d03('0x7'));var path=require(_0x3d03('0x8'));var sox=require(_0x3d03('0x9'));var csv=require(_0x3d03('0xa'));var ejs=require(_0x3d03('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3d03('0xc'));var squel=require(_0x3d03('0xd'));var crypto=require(_0x3d03('0xe'));var jsforce=require(_0x3d03('0xf'));var deskjs=require(_0x3d03('0x10'));var toCsv=require(_0x3d03('0xa'));var querystring=require('querystring');var Papa=require(_0x3d03('0x11'));var Redis=require(_0x3d03('0x12'));var authService=require(_0x3d03('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x3d03('0x14'));var hardwareService=require(_0x3d03('0x15'));var logger=require('../../config/logger')(_0x3d03('0x16'));var utils=require(_0x3d03('0x17'));var config=require(_0x3d03('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require(_0x3d03('0x19'));function respondWithStatusCode(_0x359788,_0x22594a){_0x22594a=_0x22594a||0xcc;return function(_0x43c52c){if(_0x43c52c){return _0x359788['sendStatus'](_0x22594a);}return _0x359788['status'](_0x22594a)['end']();};}function respondWithResult(_0x503315,_0x9519a1){_0x9519a1=_0x9519a1||0xc8;return function(_0x43b5bb){if(_0x43b5bb){return _0x503315[_0x3d03('0x1a')](_0x9519a1)['json'](_0x43b5bb);}};}function respondWithFilteredResult(_0x57c8b3,_0x498491){return function(_0x516eaf){if(_0x516eaf){var _0x3ac3be=typeof _0x498491[_0x3d03('0x1b')]===_0x3d03('0x1c')&&typeof _0x498491['limit']===_0x3d03('0x1c');var _0x37363b=_0x516eaf[_0x3d03('0x1d')];var _0x73d567=_0x3ac3be?0x0:_0x498491[_0x3d03('0x1b')];var _0x1818a2=_0x3ac3be?_0x516eaf[_0x3d03('0x1d')]:_0x498491['offset']+_0x498491[_0x3d03('0x1e')];var _0x543fb1;if(_0x1818a2>=_0x37363b){_0x1818a2=_0x37363b;_0x543fb1=0xc8;}else{_0x543fb1=0xce;}_0x57c8b3[_0x3d03('0x1a')](_0x543fb1);return _0x57c8b3[_0x3d03('0x1f')](_0x3d03('0x20'),_0x73d567+'-'+_0x1818a2+'/'+_0x37363b)['json'](_0x516eaf);}return null;};}function patchUpdates(_0x2d89cf){return function(_0x376bc5){try{jsonpatch['apply'](_0x376bc5,_0x2d89cf,!![]);}catch(_0x4c31b0){return BPromise['reject'](_0x4c31b0);}return _0x376bc5['save']();};}function saveUpdates(_0x407484,_0x34db19){return function(_0x534b8a){if(_0x534b8a){return _0x534b8a[_0x3d03('0x21')](_0x407484)[_0x3d03('0x22')](function(_0x42121c){return _0x42121c;});}return null;};}function removeEntity(_0x20391b,_0x2c3345){return function(_0x5693b4){if(_0x5693b4){return _0x5693b4['destroy']()[_0x3d03('0x22')](function(){_0x20391b['status'](0xcc)[_0x3d03('0x23')]();});}};}function handleEntityNotFound(_0xed9c7e,_0x35629f){return function(_0x5e948c){if(!_0x5e948c){_0xed9c7e[_0x3d03('0x24')](0x194);}return _0x5e948c;};}function handleError(_0x2227d4,_0x141a1a){_0x141a1a=_0x141a1a||0x1f4;return function(_0x27cbf6){logger['error'](_0x27cbf6[_0x3d03('0x25')]);if(_0x27cbf6[_0x3d03('0x26')]){delete _0x27cbf6['name'];}_0x2227d4[_0x3d03('0x1a')](_0x141a1a)[_0x3d03('0x27')](_0x27cbf6);};}exports['index']=function(_0x50262c,_0xd82c4b){var _0x27742b={},_0x400568={},_0x1a1e5b={'count':0x0,'rows':[]};var _0xe6b051=_[_0x3d03('0x28')](db[_0x3d03('0x29')][_0x3d03('0x2a')],function(_0x216b83){return{'name':_0x216b83[_0x3d03('0x2b')],'type':_0x216b83[_0x3d03('0x2c')][_0x3d03('0x2d')]};});_0x400568[_0x3d03('0x2e')]=_[_0x3d03('0x28')](_0xe6b051,_0x3d03('0x26'));_0x400568['query']=_[_0x3d03('0x2f')](_0x50262c[_0x3d03('0x30')]);_0x400568[_0x3d03('0x31')]=_[_0x3d03('0x32')](_0x400568[_0x3d03('0x2e')],_0x400568['query']);_0x27742b['attributes']=_['intersection'](_0x400568[_0x3d03('0x2e')],qs[_0x3d03('0x33')](_0x50262c[_0x3d03('0x30')]['fields']));_0x27742b[_0x3d03('0x34')]=_0x27742b['attributes'][_0x3d03('0x35')]?_0x27742b[_0x3d03('0x34')]:_0x400568[_0x3d03('0x2e')];if(!_0x50262c['query']['hasOwnProperty'](_0x3d03('0x36'))){_0x27742b[_0x3d03('0x1e')]=qs[_0x3d03('0x1e')](_0x50262c['query'][_0x3d03('0x1e')]);_0x27742b[_0x3d03('0x1b')]=qs['offset'](_0x50262c[_0x3d03('0x30')]['offset']);}_0x27742b[_0x3d03('0x37')]=qs[_0x3d03('0x38')](_0x50262c[_0x3d03('0x30')]['sort']);_0x27742b[_0x3d03('0x39')]=qs[_0x3d03('0x31')](_[_0x3d03('0x3a')](_0x50262c[_0x3d03('0x30')],_0x400568[_0x3d03('0x31')]),_0xe6b051);if(_0x50262c[_0x3d03('0x30')][_0x3d03('0x3b')]){_0x27742b[_0x3d03('0x39')]=_[_0x3d03('0x3c')](_0x27742b[_0x3d03('0x39')],{'$or':_[_0x3d03('0x28')](_0xe6b051,function(_0xd4373b){if(_0xd4373b['type']!==_0x3d03('0x3d')){var _0x5de1bc={};_0x5de1bc[_0xd4373b[_0x3d03('0x26')]]={'$like':'%'+_0x50262c[_0x3d03('0x30')]['filter']+'%'};return _0x5de1bc;}})});}_0x27742b=_['merge']({},_0x27742b,_0x50262c[_0x3d03('0x3e')]);var _0x3224f9={'where':_0x27742b[_0x3d03('0x39')]};return db[_0x3d03('0x29')][_0x3d03('0x1d')](_0x3224f9)[_0x3d03('0x22')](function(_0xa9143b){_0x1a1e5b[_0x3d03('0x1d')]=_0xa9143b;if(_0x50262c[_0x3d03('0x30')][_0x3d03('0x3f')]){_0x27742b[_0x3d03('0x40')]=[{'all':!![]}];}return db[_0x3d03('0x29')][_0x3d03('0x41')](_0x27742b);})[_0x3d03('0x22')](function(_0x233175){_0x1a1e5b[_0x3d03('0x42')]=_0x233175;return _0x1a1e5b;})[_0x3d03('0x22')](respondWithFilteredResult(_0xd82c4b,_0x27742b))[_0x3d03('0x43')](handleError(_0xd82c4b,null));};exports['show']=function(_0x565038,_0xf0efc3){var _0x3f25d6={'raw':![],'where':{'id':_0x565038['params']['id']}},_0x5af7b1={};_0x5af7b1[_0x3d03('0x2e')]=_[_0x3d03('0x2f')](db[_0x3d03('0x29')]['rawAttributes']);_0x5af7b1[_0x3d03('0x30')]=_[_0x3d03('0x2f')](_0x565038[_0x3d03('0x30')]);_0x5af7b1['filters']=_[_0x3d03('0x32')](_0x5af7b1['model'],_0x5af7b1[_0x3d03('0x30')]);_0x3f25d6[_0x3d03('0x34')]=_[_0x3d03('0x32')](_0x5af7b1[_0x3d03('0x2e')],qs[_0x3d03('0x33')](_0x565038['query'][_0x3d03('0x33')]));_0x3f25d6[_0x3d03('0x34')]=_0x3f25d6[_0x3d03('0x34')][_0x3d03('0x35')]?_0x3f25d6[_0x3d03('0x34')]:_0x5af7b1[_0x3d03('0x2e')];if(_0x565038[_0x3d03('0x30')][_0x3d03('0x3f')]){_0x3f25d6[_0x3d03('0x40')]=[{'all':!![]}];}_0x3f25d6=_[_0x3d03('0x3c')]({},_0x3f25d6,_0x565038[_0x3d03('0x3e')]);return db[_0x3d03('0x29')][_0x3d03('0x44')](_0x3f25d6)[_0x3d03('0x22')](handleEntityNotFound(_0xf0efc3,null))[_0x3d03('0x22')](respondWithResult(_0xf0efc3,null))[_0x3d03('0x43')](handleError(_0xf0efc3,null));};exports[_0x3d03('0x45')]=function(_0x8e120c,_0x14bfd6){return db[_0x3d03('0x29')][_0x3d03('0x45')](_0x8e120c[_0x3d03('0x46')],{})[_0x3d03('0x22')](respondWithResult(_0x14bfd6,0xc9))[_0x3d03('0x43')](handleError(_0x14bfd6,null));};exports[_0x3d03('0x21')]=function(_0x3602c3,_0x2be35b){if(_0x3602c3[_0x3d03('0x46')]['id']){delete _0x3602c3[_0x3d03('0x46')]['id'];}return db[_0x3d03('0x29')][_0x3d03('0x44')]({'where':{'id':_0x3602c3['params']['id']}})[_0x3d03('0x22')](handleEntityNotFound(_0x2be35b,null))['then'](saveUpdates(_0x3602c3[_0x3d03('0x46')],null))[_0x3d03('0x22')](respondWithResult(_0x2be35b,null))['catch'](handleError(_0x2be35b,null));};exports[_0x3d03('0x47')]=function(_0x179ddc,_0x1c4a6f){return db[_0x3d03('0x29')][_0x3d03('0x44')]({'where':{'id':_0x179ddc['params']['id']}})[_0x3d03('0x22')](handleEntityNotFound(_0x1c4a6f,null))[_0x3d03('0x22')](removeEntity(_0x1c4a6f,null))['catch'](handleError(_0x1c4a6f,null));};exports[_0x3d03('0x48')]=function(_0xea1a9e,_0x289fc4,_0x4206f7){var _0x3af626={};var _0x20374c={};var _0x5a30e2;var _0x18c597;return db[_0x3d03('0x29')]['findOne']({'where':{'id':_0xea1a9e[_0x3d03('0x49')]['id']}})[_0x3d03('0x22')](handleEntityNotFound(_0x289fc4,null))[_0x3d03('0x22')](function(_0x53aa8c){if(_0x53aa8c){_0x5a30e2=_0x53aa8c;_0x20374c[_0x3d03('0x2e')]=_[_0x3d03('0x2f')](db[_0x3d03('0x4a')][_0x3d03('0x2a')]);_0x20374c['query']=_[_0x3d03('0x2f')](_0xea1a9e['query']);_0x20374c[_0x3d03('0x31')]=_[_0x3d03('0x32')](_0x20374c[_0x3d03('0x2e')],_0x20374c[_0x3d03('0x30')]);_0x3af626[_0x3d03('0x34')]=_['intersection'](_0x20374c[_0x3d03('0x2e')],qs[_0x3d03('0x33')](_0xea1a9e[_0x3d03('0x30')]['fields']));_0x3af626['attributes']=_0x3af626['attributes'][_0x3d03('0x35')]?_0x3af626[_0x3d03('0x34')]:_0x20374c['model'];_0x3af626[_0x3d03('0x37')]=qs[_0x3d03('0x38')](_0xea1a9e[_0x3d03('0x30')][_0x3d03('0x38')]);_0x3af626[_0x3d03('0x39')]=qs[_0x3d03('0x31')](_[_0x3d03('0x3a')](_0xea1a9e[_0x3d03('0x30')],_0x20374c[_0x3d03('0x31')]));if(_0xea1a9e[_0x3d03('0x30')][_0x3d03('0x3b')]){_0x3af626['where']=_[_0x3d03('0x3c')](_0x3af626[_0x3d03('0x39')],{'$or':_[_0x3d03('0x28')](_0x3af626['attributes'],function(_0x438cb0){var _0x44c200={};_0x44c200[_0x438cb0]={'$like':'%'+_0xea1a9e[_0x3d03('0x30')][_0x3d03('0x3b')]+'%'};return _0x44c200;})});}_0x3af626=_[_0x3d03('0x3c')]({},_0x3af626,_0xea1a9e[_0x3d03('0x3e')]);return _0x5a30e2[_0x3d03('0x48')](_0x3af626);}})[_0x3d03('0x22')](function(_0x1a61db){if(_0x1a61db){_0x18c597=_0x1a61db[_0x3d03('0x35')];if(!_0xea1a9e['query'][_0x3d03('0x4b')]('nolimit')){_0x3af626[_0x3d03('0x1e')]=qs[_0x3d03('0x1e')](_0xea1a9e[_0x3d03('0x30')][_0x3d03('0x1e')]);_0x3af626[_0x3d03('0x1b')]=qs[_0x3d03('0x1b')](_0xea1a9e[_0x3d03('0x30')][_0x3d03('0x1b')]);}return _0x5a30e2['getConfigurations'](_0x3af626);}})[_0x3d03('0x22')](function(_0x49fe6b){if(_0x49fe6b){return _0x49fe6b?{'count':_0x18c597,'rows':_0x49fe6b}:null;}})['then'](respondWithResult(_0x289fc4,null))['catch'](handleError(_0x289fc4,null));};exports[_0x3d03('0x4c')]=function(_0x48f2e6,_0x586410,_0x2ef53a){if(_0x48f2e6[_0x3d03('0x46')]['id']){delete _0x48f2e6[_0x3d03('0x46')]['id'];}return db[_0x3d03('0x29')][_0x3d03('0x4d')]({'where':{'id':_0x48f2e6[_0x3d03('0x49')]['id']}})[_0x3d03('0x22')](handleEntityNotFound(_0x586410,null))[_0x3d03('0x22')](function(_0x13491c){if(_0x13491c){_0x48f2e6['body'][_0x3d03('0x4e')]=_0x13491c['id'];_0x48f2e6['body'][_0x3d03('0x4f')]=integrations[_0x3d03('0x50')](_0x48f2e6[_0x3d03('0x46')]['channel'],_0x48f2e6[_0x3d03('0x46')][_0x3d03('0x2c')]);_0x48f2e6[_0x3d03('0x46')][_0x3d03('0x51')]=integrations['getDescriptions'](_0x48f2e6[_0x3d03('0x46')][_0x3d03('0x52')],_0x48f2e6[_0x3d03('0x46')][_0x3d03('0x2c')]);return db[_0x3d03('0x4a')]['create'](_0x48f2e6['body'],{'include':[{'model':db[_0x3d03('0x53')],'as':_0x3d03('0x4f')},{'model':db[_0x3d03('0x53')],'as':_0x3d03('0x51')}]});}return null;})[_0x3d03('0x22')](respondWithResult(_0x586410,null))[_0x3d03('0x43')](handleError(_0x586410,null));};function getAccessToken(_0x38799a){return new Promise(function(_0x12bc94,_0x4811ee){var _0x469b62;switch(_0x38799a[_0x3d03('0x54')]){case'US':_0x469b62=_0x3d03('0x55');break;case'AU':_0x469b62=_0x3d03('0x56');break;case'EU':_0x469b62=_0x3d03('0x57');break;case'IN':_0x469b62='https://accounts.zoho.in';break;case'CN':_0x469b62=_0x3d03('0x58');break;default:_0x469b62=_0x3d03('0x57');break;}var _0x563212={'method':_0x3d03('0x59'),'uri':_0x469b62+_0x3d03('0x5a'),'qs':{'refresh_token':_0x38799a[_0x3d03('0x5b')],'client_id':_0x38799a[_0x3d03('0x5c')],'client_secret':_0x38799a[_0x3d03('0x5d')],'grant_type':_0x3d03('0x5e')},'json':!![]};return rp(_0x563212)[_0x3d03('0x22')](function(_0x12b78a){if(_0x12b78a['access_token']){_0x12bc94(_0x12b78a[_0x3d03('0x5f')]);}else{_0x4811ee(_0x3d03('0x60'));}})['catch'](function(_0xb9c66){_0x4811ee(_0xb9c66);});});}exports['getFields']=function(_0x1e3b83,_0x1cf934,_0x35225a){var _0xd8c05,_0x186197,_0x319f10,_0x18f72c,_0x16521b;return db[_0x3d03('0x29')][_0x3d03('0x4d')]({'where':{'id':_0x1e3b83[_0x3d03('0x49')]['id']},'attributes':['id','host',_0x3d03('0x54'),_0x3d03('0x5c'),_0x3d03('0x5d'),_0x3d03('0x61'),_0x3d03('0x62'),_0x3d03('0x5b')]})[_0x3d03('0x22')](handleEntityNotFound(_0x1cf934,null))[_0x3d03('0x22')](function(_0x30cfa7){_0x16521b=_0x30cfa7;_0xd8c05=_0x16521b['host'];_0x186197=_0xd8c05==='zoho.eu'?'eu':_0x3d03('0x63');_0x319f10=_0x16521b['serverUrl'];var _0x8fd869=_0x319f10[_0x3d03('0x64')](-0x1);if(_0x8fd869==='/'||_0x8fd869==='\x5c'||_0x8fd869===':'){_0x319f10=_0x319f10[_0x3d03('0x65')](0x0,_0x319f10['lastIndexOf'](_0x8fd869));}if(!_0x16521b['refreshToken']){throw new Error(_0x3d03('0x66'));}return getAccessToken(_0x16521b);})[_0x3d03('0x22')](function(_0x12d400){if(_0x12d400){return rp({'method':_0x3d03('0x67'),'uri':util[_0x3d03('0x68')](_0x3d03('0x69'),_0x186197),'qs':{'module':_0x3d03('0x6a')},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x12d400},'json':!![]});}})[_0x3d03('0x22')](function(_0x200493){if(_0x200493){if(_0x200493['response']&&_0x200493['response'][_0x3d03('0x6b')]){throw new Error(_0x200493[_0x3d03('0x6c')][_0x3d03('0x6b')]['message']);}var _0x422c80=[];var _0x1b50c8=[];var _0x1abbd4=[_0x3d03('0x6d'),_0x3d03('0x6e'),_0x3d03('0x6f'),'WhoId',_0x3d03('0x70'),_0x3d03('0x71'),'Call_Start_Time',_0x3d03('0x72')];_0x1b50c8=_['remove'](_0x200493[_0x3d03('0x33')],function(_0x2b084a){return _0x1abbd4['includes'](_0x2b084a[_0x3d03('0x73')]);});for(var _0x39f8e0=0x0;_0x39f8e0<_0x1b50c8[_0x3d03('0x35')];_0x39f8e0++){if(_0x1b50c8[_0x39f8e0][_0x3d03('0x74')]===![]){_0x422c80[_0x3d03('0x75')]({'id':_0x1b50c8[_0x39f8e0]['id'],'name':_0x1b50c8[_0x39f8e0]['display_label'],'custom':_0x1b50c8[_0x39f8e0][_0x3d03('0x76')],'options':_0x1b50c8[_0x39f8e0]['data_type']===_0x3d03('0x77')&&_0x1b50c8[_0x39f8e0][_0x3d03('0x78')][_0x3d03('0x35')]>-0x1?_[_0x3d03('0x28')](_0x1b50c8[_0x39f8e0]['pick_list_values'],function(_0x3f4952){return{'name':_0x3f4952,'value':_0x3f4952};}):[]});}}return{'count':_0x422c80[_0x3d03('0x35')],'rows':_0x422c80};}else{return{'count':0x0,'rows':[]};}})[_0x3d03('0x22')](respondWithResult(_0x1cf934,null))[_0x3d03('0x43')](function(_0x5ca5a7){var _0x99eedf=_0x1e3b83['query']['test']?0x1f4:_0x5ca5a7['statusCode']||0x1f4;logger['error'](_0x3d03('0x79'),_0x3d03('0x7a'),_0x99eedf,JSON[_0x3d03('0x7b')](_0x5ca5a7));delete _0x5ca5a7[_0x3d03('0x26')];if(_0x99eedf===0x191){_0x99eedf=0x190;}_0x1cf934[_0x3d03('0x1a')](_0x99eedf)['send'](_0x1e3b83['query'][_0x3d03('0x7c')]?{'message':_0x3d03('0x7d'),'statusCode':_0x5ca5a7[_0x3d03('0x7e')]}:_0x5ca5a7);});}; \ No newline at end of file +var _0x72e0=['host','zoho.eu','com','slice','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','format','https://www.zohoapis.%s/crm/v2/settings/fields','Zoho-oauthtoken\x20','response','message','Owner','Subject','Description','WhoId','Call_Result','Call_Start_Time','Call_Type','remove','api_name','push','display_label','custom_field','data_type','picklist','pick_list_values','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','end','status','undefined','limit','count','offset','set','json','apply','reject','update','destroy','then','error','send','map','ZohoAccount','rawAttributes','key','name','keys','intersection','model','query','attributes','fields','order','sort','filters','pick','filter','where','merge','VIRTUAL','options','findAll','rows','catch','show','params','length','includeAll','include','find','create','body','getConfigurations','hasOwnProperty','findOne','Subjects','getSubjects','channel','type','Descriptions','getDescriptions','ZohoConfiguration','ZohoField','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','/oauth/v2/token','refreshToken','clientId','refresh_token','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','clientSecret','serverUrl','code'];(function(_0x33e96a,_0x536f82){var _0x4d4c0d=function(_0x2f2f4b){while(--_0x2f2f4b){_0x33e96a['push'](_0x33e96a['shift']());}};_0x4d4c0d(++_0x536f82);}(_0x72e0,0x124));var _0x072e=function(_0x269bce,_0x8f7efd){_0x269bce=_0x269bce-0x0;var _0x2f6671=_0x72e0[_0x269bce];return _0x2f6671;};'use strict';var emlformat=require(_0x072e('0x0'));var rimraf=require(_0x072e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x072e('0x2'));var rp=require(_0x072e('0x3'));var moment=require(_0x072e('0x4'));var BPromise=require(_0x072e('0x5'));var Mustache=require(_0x072e('0x6'));var util=require(_0x072e('0x7'));var path=require('path');var sox=require(_0x072e('0x8'));var csv=require(_0x072e('0x9'));var ejs=require(_0x072e('0xa'));var fs=require('fs');var fs_extra=require(_0x072e('0xb'));var _=require(_0x072e('0xc'));var squel=require(_0x072e('0xd'));var crypto=require(_0x072e('0xe'));var jsforce=require(_0x072e('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x072e('0x9'));var querystring=require(_0x072e('0x10'));var Papa=require(_0x072e('0x11'));var Redis=require(_0x072e('0x12'));var authService=require(_0x072e('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x072e('0x14'));var hardwareService=require(_0x072e('0x15'));var logger=require(_0x072e('0x16'))(_0x072e('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x072e('0x18'));var db=require(_0x072e('0x19'))['db'];var integrations=require(_0x072e('0x1a'));function respondWithStatusCode(_0x588b49,_0x200400){_0x200400=_0x200400||0xcc;return function(_0x3030d9){if(_0x3030d9){return _0x588b49[_0x072e('0x1b')](_0x200400);}return _0x588b49['status'](_0x200400)[_0x072e('0x1c')]();};}function respondWithResult(_0x3bd4f8,_0x35588c){_0x35588c=_0x35588c||0xc8;return function(_0x38e5a0){if(_0x38e5a0){return _0x3bd4f8[_0x072e('0x1d')](_0x35588c)['json'](_0x38e5a0);}};}function respondWithFilteredResult(_0x3b76c8,_0x19dd54){return function(_0x242b11){if(_0x242b11){var _0x2f5e51=typeof _0x19dd54['offset']===_0x072e('0x1e')&&typeof _0x19dd54[_0x072e('0x1f')]===_0x072e('0x1e');var _0x52edbc=_0x242b11[_0x072e('0x20')];var _0x56a681=_0x2f5e51?0x0:_0x19dd54['offset'];var _0x33c933=_0x2f5e51?_0x242b11['count']:_0x19dd54[_0x072e('0x21')]+_0x19dd54[_0x072e('0x1f')];var _0x1e6fb2;if(_0x33c933>=_0x52edbc){_0x33c933=_0x52edbc;_0x1e6fb2=0xc8;}else{_0x1e6fb2=0xce;}_0x3b76c8[_0x072e('0x1d')](_0x1e6fb2);return _0x3b76c8[_0x072e('0x22')]('Content-Range',_0x56a681+'-'+_0x33c933+'/'+_0x52edbc)[_0x072e('0x23')](_0x242b11);}return null;};}function patchUpdates(_0x2f1a28){return function(_0x8a7cd3){try{jsonpatch[_0x072e('0x24')](_0x8a7cd3,_0x2f1a28,!![]);}catch(_0x12271e){return BPromise[_0x072e('0x25')](_0x12271e);}return _0x8a7cd3['save']();};}function saveUpdates(_0x325b82,_0x2f2384){return function(_0x324894){if(_0x324894){return _0x324894[_0x072e('0x26')](_0x325b82)['then'](function(_0x110219){return _0x110219;});}return null;};}function removeEntity(_0x29afb6,_0x3587ec){return function(_0x271c22){if(_0x271c22){return _0x271c22[_0x072e('0x27')]()[_0x072e('0x28')](function(){_0x29afb6[_0x072e('0x1d')](0xcc)[_0x072e('0x1c')]();});}};}function handleEntityNotFound(_0x3dfee6,_0x271078){return function(_0x5b17f2){if(!_0x5b17f2){_0x3dfee6[_0x072e('0x1b')](0x194);}return _0x5b17f2;};}function handleError(_0x1fc5aa,_0x26b5cc){_0x26b5cc=_0x26b5cc||0x1f4;return function(_0x322bf9){logger[_0x072e('0x29')](_0x322bf9['stack']);if(_0x322bf9['name']){delete _0x322bf9['name'];}_0x1fc5aa[_0x072e('0x1d')](_0x26b5cc)[_0x072e('0x2a')](_0x322bf9);};}exports['index']=function(_0x3abc3e,_0x2d428a){var _0x5d7fb6={},_0x5e4045={},_0x242e2e={'count':0x0,'rows':[]};var _0x5ef83d=_[_0x072e('0x2b')](db[_0x072e('0x2c')][_0x072e('0x2d')],function(_0x4ffabe){return{'name':_0x4ffabe['fieldName'],'type':_0x4ffabe['type'][_0x072e('0x2e')]};});_0x5e4045['model']=_[_0x072e('0x2b')](_0x5ef83d,_0x072e('0x2f'));_0x5e4045['query']=_[_0x072e('0x30')](_0x3abc3e['query']);_0x5e4045['filters']=_[_0x072e('0x31')](_0x5e4045[_0x072e('0x32')],_0x5e4045[_0x072e('0x33')]);_0x5d7fb6[_0x072e('0x34')]=_[_0x072e('0x31')](_0x5e4045[_0x072e('0x32')],qs[_0x072e('0x35')](_0x3abc3e[_0x072e('0x33')][_0x072e('0x35')]));_0x5d7fb6[_0x072e('0x34')]=_0x5d7fb6[_0x072e('0x34')]['length']?_0x5d7fb6[_0x072e('0x34')]:_0x5e4045[_0x072e('0x32')];if(!_0x3abc3e['query']['hasOwnProperty']('nolimit')){_0x5d7fb6[_0x072e('0x1f')]=qs['limit'](_0x3abc3e[_0x072e('0x33')]['limit']);_0x5d7fb6['offset']=qs['offset'](_0x3abc3e[_0x072e('0x33')]['offset']);}_0x5d7fb6[_0x072e('0x36')]=qs[_0x072e('0x37')](_0x3abc3e[_0x072e('0x33')]['sort']);_0x5d7fb6['where']=qs[_0x072e('0x38')](_[_0x072e('0x39')](_0x3abc3e[_0x072e('0x33')],_0x5e4045[_0x072e('0x38')]),_0x5ef83d);if(_0x3abc3e[_0x072e('0x33')][_0x072e('0x3a')]){_0x5d7fb6[_0x072e('0x3b')]=_[_0x072e('0x3c')](_0x5d7fb6['where'],{'$or':_[_0x072e('0x2b')](_0x5ef83d,function(_0x26860f){if(_0x26860f['type']!==_0x072e('0x3d')){var _0xbfcdf0={};_0xbfcdf0[_0x26860f[_0x072e('0x2f')]]={'$like':'%'+_0x3abc3e[_0x072e('0x33')]['filter']+'%'};return _0xbfcdf0;}})});}_0x5d7fb6=_[_0x072e('0x3c')]({},_0x5d7fb6,_0x3abc3e[_0x072e('0x3e')]);var _0x5edaba={'where':_0x5d7fb6[_0x072e('0x3b')]};return db[_0x072e('0x2c')][_0x072e('0x20')](_0x5edaba)['then'](function(_0x48b0e3){_0x242e2e[_0x072e('0x20')]=_0x48b0e3;if(_0x3abc3e[_0x072e('0x33')]['includeAll']){_0x5d7fb6['include']=[{'all':!![]}];}return db[_0x072e('0x2c')][_0x072e('0x3f')](_0x5d7fb6);})[_0x072e('0x28')](function(_0xbd8337){_0x242e2e[_0x072e('0x40')]=_0xbd8337;return _0x242e2e;})[_0x072e('0x28')](respondWithFilteredResult(_0x2d428a,_0x5d7fb6))[_0x072e('0x41')](handleError(_0x2d428a,null));};exports[_0x072e('0x42')]=function(_0x334de1,_0x53138a){var _0x53d505={'raw':![],'where':{'id':_0x334de1[_0x072e('0x43')]['id']}},_0x40be61={};_0x40be61['model']=_[_0x072e('0x30')](db[_0x072e('0x2c')][_0x072e('0x2d')]);_0x40be61[_0x072e('0x33')]=_[_0x072e('0x30')](_0x334de1[_0x072e('0x33')]);_0x40be61[_0x072e('0x38')]=_['intersection'](_0x40be61[_0x072e('0x32')],_0x40be61[_0x072e('0x33')]);_0x53d505[_0x072e('0x34')]=_[_0x072e('0x31')](_0x40be61['model'],qs['fields'](_0x334de1[_0x072e('0x33')][_0x072e('0x35')]));_0x53d505['attributes']=_0x53d505[_0x072e('0x34')][_0x072e('0x44')]?_0x53d505['attributes']:_0x40be61[_0x072e('0x32')];if(_0x334de1[_0x072e('0x33')][_0x072e('0x45')]){_0x53d505[_0x072e('0x46')]=[{'all':!![]}];}_0x53d505=_[_0x072e('0x3c')]({},_0x53d505,_0x334de1[_0x072e('0x3e')]);return db[_0x072e('0x2c')][_0x072e('0x47')](_0x53d505)[_0x072e('0x28')](handleEntityNotFound(_0x53138a,null))[_0x072e('0x28')](respondWithResult(_0x53138a,null))[_0x072e('0x41')](handleError(_0x53138a,null));};exports[_0x072e('0x48')]=function(_0x3e7ce9,_0x3ce3e0){return db[_0x072e('0x2c')]['create'](_0x3e7ce9[_0x072e('0x49')],{})[_0x072e('0x28')](respondWithResult(_0x3ce3e0,0xc9))[_0x072e('0x41')](handleError(_0x3ce3e0,null));};exports[_0x072e('0x26')]=function(_0x569d31,_0x8d38e5){if(_0x569d31['body']['id']){delete _0x569d31[_0x072e('0x49')]['id'];}return db[_0x072e('0x2c')][_0x072e('0x47')]({'where':{'id':_0x569d31[_0x072e('0x43')]['id']}})['then'](handleEntityNotFound(_0x8d38e5,null))[_0x072e('0x28')](saveUpdates(_0x569d31[_0x072e('0x49')],null))['then'](respondWithResult(_0x8d38e5,null))['catch'](handleError(_0x8d38e5,null));};exports['destroy']=function(_0x25b452,_0x1938fc){return db[_0x072e('0x2c')][_0x072e('0x47')]({'where':{'id':_0x25b452[_0x072e('0x43')]['id']}})['then'](handleEntityNotFound(_0x1938fc,null))[_0x072e('0x28')](removeEntity(_0x1938fc,null))[_0x072e('0x41')](handleError(_0x1938fc,null));};exports[_0x072e('0x4a')]=function(_0x2795cb,_0x493371,_0x5c52fa){var _0xc556f3={};var _0x20fa1f={};var _0x263dea;var _0x4df0e2;return db[_0x072e('0x2c')]['findOne']({'where':{'id':_0x2795cb['params']['id']}})[_0x072e('0x28')](handleEntityNotFound(_0x493371,null))['then'](function(_0x5fa6be){if(_0x5fa6be){_0x263dea=_0x5fa6be;_0x20fa1f[_0x072e('0x32')]=_[_0x072e('0x30')](db['ZohoConfiguration'][_0x072e('0x2d')]);_0x20fa1f[_0x072e('0x33')]=_[_0x072e('0x30')](_0x2795cb[_0x072e('0x33')]);_0x20fa1f[_0x072e('0x38')]=_[_0x072e('0x31')](_0x20fa1f[_0x072e('0x32')],_0x20fa1f[_0x072e('0x33')]);_0xc556f3[_0x072e('0x34')]=_['intersection'](_0x20fa1f[_0x072e('0x32')],qs[_0x072e('0x35')](_0x2795cb[_0x072e('0x33')][_0x072e('0x35')]));_0xc556f3[_0x072e('0x34')]=_0xc556f3[_0x072e('0x34')][_0x072e('0x44')]?_0xc556f3[_0x072e('0x34')]:_0x20fa1f[_0x072e('0x32')];_0xc556f3['order']=qs[_0x072e('0x37')](_0x2795cb['query'][_0x072e('0x37')]);_0xc556f3[_0x072e('0x3b')]=qs[_0x072e('0x38')](_['pick'](_0x2795cb['query'],_0x20fa1f[_0x072e('0x38')]));if(_0x2795cb['query'][_0x072e('0x3a')]){_0xc556f3[_0x072e('0x3b')]=_[_0x072e('0x3c')](_0xc556f3[_0x072e('0x3b')],{'$or':_['map'](_0xc556f3['attributes'],function(_0x480ab6){var _0x48bdd6={};_0x48bdd6[_0x480ab6]={'$like':'%'+_0x2795cb[_0x072e('0x33')][_0x072e('0x3a')]+'%'};return _0x48bdd6;})});}_0xc556f3=_[_0x072e('0x3c')]({},_0xc556f3,_0x2795cb[_0x072e('0x3e')]);return _0x263dea[_0x072e('0x4a')](_0xc556f3);}})['then'](function(_0x2c8544){if(_0x2c8544){_0x4df0e2=_0x2c8544[_0x072e('0x44')];if(!_0x2795cb['query'][_0x072e('0x4b')]('nolimit')){_0xc556f3[_0x072e('0x1f')]=qs[_0x072e('0x1f')](_0x2795cb[_0x072e('0x33')][_0x072e('0x1f')]);_0xc556f3['offset']=qs[_0x072e('0x21')](_0x2795cb[_0x072e('0x33')][_0x072e('0x21')]);}return _0x263dea[_0x072e('0x4a')](_0xc556f3);}})[_0x072e('0x28')](function(_0x7c09b7){if(_0x7c09b7){return _0x7c09b7?{'count':_0x4df0e2,'rows':_0x7c09b7}:null;}})[_0x072e('0x28')](respondWithResult(_0x493371,null))['catch'](handleError(_0x493371,null));};exports['addConfiguration']=function(_0x44ce3b,_0x525e02,_0x101e69){if(_0x44ce3b['body']['id']){delete _0x44ce3b[_0x072e('0x49')]['id'];}return db[_0x072e('0x2c')][_0x072e('0x4c')]({'where':{'id':_0x44ce3b[_0x072e('0x43')]['id']}})[_0x072e('0x28')](handleEntityNotFound(_0x525e02,null))[_0x072e('0x28')](function(_0x1a0b97){if(_0x1a0b97){_0x44ce3b[_0x072e('0x49')]['AccountId']=_0x1a0b97['id'];_0x44ce3b['body'][_0x072e('0x4d')]=integrations[_0x072e('0x4e')](_0x44ce3b[_0x072e('0x49')][_0x072e('0x4f')],_0x44ce3b[_0x072e('0x49')][_0x072e('0x50')]);_0x44ce3b[_0x072e('0x49')][_0x072e('0x51')]=integrations[_0x072e('0x52')](_0x44ce3b['body'][_0x072e('0x4f')],_0x44ce3b[_0x072e('0x49')]['type']);return db[_0x072e('0x53')]['create'](_0x44ce3b[_0x072e('0x49')],{'include':[{'model':db[_0x072e('0x54')],'as':_0x072e('0x4d')},{'model':db[_0x072e('0x54')],'as':_0x072e('0x51')}]});}return null;})[_0x072e('0x28')](respondWithResult(_0x525e02,null))['catch'](handleError(_0x525e02,null));};function getAccessToken(_0x1924e9){return new Promise(function(_0x3f5e77,_0x2bb7ce){var _0x4c2907;switch(_0x1924e9[_0x072e('0x55')]){case'US':_0x4c2907=_0x072e('0x56');break;case'AU':_0x4c2907=_0x072e('0x57');break;case'EU':_0x4c2907=_0x072e('0x58');break;case'IN':_0x4c2907=_0x072e('0x59');break;case'CN':_0x4c2907=_0x072e('0x5a');break;default:_0x4c2907=_0x072e('0x58');break;}var _0x1d17e0={'method':'POST','uri':_0x4c2907+_0x072e('0x5b'),'qs':{'refresh_token':_0x1924e9[_0x072e('0x5c')],'client_id':_0x1924e9[_0x072e('0x5d')],'client_secret':_0x1924e9['clientSecret'],'grant_type':_0x072e('0x5e')},'json':!![]};return rp(_0x1d17e0)[_0x072e('0x28')](function(_0x2e93ee){if(_0x2e93ee[_0x072e('0x5f')]){_0x3f5e77(_0x2e93ee['access_token']);}else{_0x2bb7ce(_0x072e('0x60'));}})['catch'](function(_0x5bb016){_0x2bb7ce(_0x5bb016);});});}exports[_0x072e('0x61')]=function(_0x21a411,_0xc43c58,_0x3a4890){var _0x3818a7,_0x127727,_0x257c21,_0x5f0d6c,_0xe13b98;return db[_0x072e('0x2c')][_0x072e('0x4c')]({'where':{'id':_0x21a411['params']['id']},'attributes':['id','host',_0x072e('0x55'),_0x072e('0x5d'),_0x072e('0x62'),_0x072e('0x63'),_0x072e('0x64'),_0x072e('0x5c')]})[_0x072e('0x28')](handleEntityNotFound(_0xc43c58,null))[_0x072e('0x28')](function(_0x3f3447){_0xe13b98=_0x3f3447;_0x3818a7=_0xe13b98[_0x072e('0x65')];_0x127727=_0x3818a7===_0x072e('0x66')?'eu':_0x072e('0x67');_0x257c21=_0xe13b98[_0x072e('0x63')];var _0x1499d5=_0x257c21[_0x072e('0x68')](-0x1);if(_0x1499d5==='/'||_0x1499d5==='\x5c'||_0x1499d5===':'){_0x257c21=_0x257c21['substring'](0x0,_0x257c21[_0x072e('0x69')](_0x1499d5));}if(!_0xe13b98['refreshToken']){throw new Error(_0x072e('0x6a'));}return getAccessToken(_0xe13b98);})[_0x072e('0x28')](function(_0x27fcdd){if(_0x27fcdd){return rp({'method':_0x072e('0x6b'),'uri':util[_0x072e('0x6c')](_0x072e('0x6d'),_0x127727),'qs':{'module':'Calls'},'headers':{'Authorization':_0x072e('0x6e')+_0x27fcdd},'json':!![]});}})[_0x072e('0x28')](function(_0x8c3435){if(_0x8c3435){if(_0x8c3435[_0x072e('0x6f')]&&_0x8c3435[_0x072e('0x6f')][_0x072e('0x29')]){throw new Error(_0x8c3435[_0x072e('0x6f')][_0x072e('0x29')][_0x072e('0x70')]);}var _0x45eea0=[];var _0x33fbae=[];var _0x427851=[_0x072e('0x71'),_0x072e('0x72'),_0x072e('0x73'),_0x072e('0x74'),'Call_Duration',_0x072e('0x75'),_0x072e('0x76'),_0x072e('0x77')];_0x33fbae=_[_0x072e('0x78')](_0x8c3435[_0x072e('0x35')],function(_0x3780c1){return _0x427851['includes'](_0x3780c1[_0x072e('0x79')]);});for(var _0x408afa=0x0;_0x408afa<_0x33fbae[_0x072e('0x44')];_0x408afa++){if(_0x33fbae[_0x408afa]['system_mandatory']===![]){_0x45eea0[_0x072e('0x7a')]({'id':_0x33fbae[_0x408afa]['id'],'name':_0x33fbae[_0x408afa][_0x072e('0x7b')],'custom':_0x33fbae[_0x408afa][_0x072e('0x7c')],'options':_0x33fbae[_0x408afa][_0x072e('0x7d')]===_0x072e('0x7e')&&_0x33fbae[_0x408afa][_0x072e('0x7f')]['length']>-0x1?_[_0x072e('0x2b')](_0x33fbae[_0x408afa]['pick_list_values'],function(_0x552f2c){return{'name':_0x552f2c,'value':_0x552f2c};}):[]});}}return{'count':_0x45eea0[_0x072e('0x44')],'rows':_0x45eea0};}else{return{'count':0x0,'rows':[]};}})[_0x072e('0x28')](respondWithResult(_0xc43c58,null))[_0x072e('0x41')](function(_0xaeb1c7){var _0x7d9af1=_0x21a411[_0x072e('0x33')][_0x072e('0x80')]?0x1f4:_0xaeb1c7[_0x072e('0x81')]||0x1f4;logger['error'](_0x072e('0x82'),_0x072e('0x61'),_0x7d9af1,JSON['stringify'](_0xaeb1c7));delete _0xaeb1c7[_0x072e('0x2f')];if(_0x7d9af1===0x191){_0x7d9af1=0x190;}_0xc43c58[_0x072e('0x1d')](_0x7d9af1)[_0x072e('0x2a')](_0x21a411[_0x072e('0x33')][_0x072e('0x80')]?{'message':'Wrong\x20credentials','statusCode':_0xaeb1c7[_0x072e('0x81')]}:_0xaeb1c7);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index e3efe26..403131f 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 _0x22ad=['https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','/oauth/v2/token','application/x-www-form-urlencoded','then','parse','refresh_token','refreshToken','info','format','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name','error','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','inspect','authorization_code','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','../../components/integrations/configuration','define','ZohoAccount','int_zoho_accounts','changed','zone','serverUrl','clientId','clientSecret','code','host','slice','substring','lastIndexOf'];(function(_0x4da78e,_0x13cb84){var _0x4463b1=function(_0x41aaf1){while(--_0x41aaf1){_0x4da78e['push'](_0x4da78e['shift']());}};_0x4463b1(++_0x13cb84);}(_0x22ad,0xc0));var _0xd22a=function(_0x411d10,_0x2906f5){_0x411d10=_0x411d10-0x0;var _0x1b20c5=_0x22ad[_0x411d10];return _0x1b20c5;};'use strict';var _=require(_0xd22a('0x0'));var util=require(_0xd22a('0x1'));var logger=require('../../config/logger')(_0xd22a('0x2'));var moment=require(_0xd22a('0x3'));var BPromise=require(_0xd22a('0x4'));var rp=require(_0xd22a('0x5'));var fs=require('fs');var path=require(_0xd22a('0x6'));var rimraf=require(_0xd22a('0x7'));var config=require(_0xd22a('0x8'));var attributes=require('./intZohoAccount.attributes');var integrations=require(_0xd22a('0x9'));module['exports']=function(_0x12bae1,_0x45a457){return _0x12bae1[_0xd22a('0xa')](_0xd22a('0xb'),attributes,{'tableName':_0xd22a('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x33138e,_0x1ac53c,_0x44a16c){if(_0x33138e[_0xd22a('0xd')](_0xd22a('0xe'))||_0x33138e[_0xd22a('0xd')](_0xd22a('0xf'))||_0x33138e[_0xd22a('0xd')](_0xd22a('0x10'))||_0x33138e[_0xd22a('0xd')](_0xd22a('0x11'))||_0x33138e['changed'](_0xd22a('0x12'))||_0x33138e[_0xd22a('0xd')](_0xd22a('0x13'))){var _0x1257b4,_0x5a6f6d;_0x1257b4=_0x33138e['serverUrl'];var _0x257565=_0x1257b4[_0xd22a('0x14')](-0x1);if(_0x257565==='/'||_0x257565==='\x5c'||_0x257565===':'){_0x1257b4=_0x1257b4[_0xd22a('0x15')](0x0,_0x1257b4[_0xd22a('0x16')](_0x257565));}switch(_0x33138e['zone']){case'US':_0x5a6f6d=_0xd22a('0x17');break;case'AU':_0x5a6f6d=_0xd22a('0x18');break;case'IN':_0x5a6f6d=_0xd22a('0x19');break;case'CN':_0x5a6f6d=_0xd22a('0x1a');break;default:_0x5a6f6d=_0xd22a('0x1b');break;}var _0x4c7b09={'method':_0xd22a('0x1c'),'uri':_0x5a6f6d+_0xd22a('0x1d'),'form':{'grant_type':'authorization_code','client_id':_0x33138e[_0xd22a('0x10')],'client_secret':_0x33138e['clientSecret'],'redirect_uri':_0x33138e[_0xd22a('0xf')],'code':_0x33138e[_0xd22a('0x12')]},'headers':{'Content-Type':_0xd22a('0x1e')}};return rp(_0x4c7b09)[_0xd22a('0x1f')](function(_0x579d4b){var _0x32d415=JSON[_0xd22a('0x20')](_0x579d4b);if(_0x32d415[_0xd22a('0x21')]){_0x33138e[_0xd22a('0x22')]=_0x32d415[_0xd22a('0x21')];logger[_0xd22a('0x23')](util[_0xd22a('0x24')](_0xd22a('0x25'),_0x33138e[_0xd22a('0x26')],_0x33138e['id']));}else{logger[_0xd22a('0x27')](util[_0xd22a('0x24')](_0xd22a('0x28'),_0x33138e['name'],_0x33138e['id']),util[_0xd22a('0x29')](_0x32d415,{'showHidden':![],'depth':null}));}return _0x44a16c(null,_0x1ac53c);})['catch'](function(_0x30d8e2){logger['error'](util['format'](_0xd22a('0x28'),_0x33138e['name'],_0x33138e['id']),util[_0xd22a('0x29')](parsedResult,{'showHidden':![],'depth':null}));return _0x44a16c(_0x30d8e2);});}else{return _0x44a16c(null,_0x1ac53c);}},'beforeUpdate':function(_0x4e55d0,_0x5637e3,_0x4628b8){if(_0x4e55d0[_0xd22a('0xd')]('zone')||_0x4e55d0[_0xd22a('0xd')](_0xd22a('0xf'))||_0x4e55d0['changed'](_0xd22a('0x10'))||_0x4e55d0[_0xd22a('0xd')]('clientSecret')||_0x4e55d0['changed'](_0xd22a('0x12'))||_0x4e55d0[_0xd22a('0xd')]('host')){var _0x5b2720,_0x4a08f1;_0x5b2720=_0x4e55d0['serverUrl'];var _0x387352=_0x5b2720[_0xd22a('0x14')](-0x1);if(_0x387352==='/'||_0x387352==='\x5c'||_0x387352===':'){_0x5b2720=_0x5b2720['substring'](0x0,_0x5b2720['lastIndexOf'](_0x387352));}switch(_0x4e55d0[_0xd22a('0xe')]){case'US':_0x4a08f1=_0xd22a('0x17');break;case'AU':_0x4a08f1=_0xd22a('0x18');break;case'IN':_0x4a08f1=_0xd22a('0x19');break;case'CN':_0x4a08f1='https://accounts.zoho.com.cn';break;default:_0x4a08f1=_0xd22a('0x1b');break;}var _0x5ab0c4={'method':_0xd22a('0x1c'),'uri':_0x4a08f1+_0xd22a('0x1d'),'form':{'grant_type':_0xd22a('0x2a'),'client_id':_0x4e55d0[_0xd22a('0x10')],'client_secret':_0x4e55d0[_0xd22a('0x11')],'redirect_uri':_0x4e55d0[_0xd22a('0xf')],'code':_0x4e55d0['code']},'headers':{'Content-Type':_0xd22a('0x1e')}};return rp(_0x5ab0c4)[_0xd22a('0x1f')](function(_0xd21547){var _0x16eea7=JSON[_0xd22a('0x20')](_0xd21547);if(_0x16eea7[_0xd22a('0x21')]){_0x4e55d0[_0xd22a('0x22')]=_0x16eea7[_0xd22a('0x21')];logger['info'](util[_0xd22a('0x24')]('ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d',_0x4e55d0[_0xd22a('0x26')],_0x4e55d0['id']));}else{logger[_0xd22a('0x27')](util[_0xd22a('0x24')](_0xd22a('0x28'),_0x4e55d0[_0xd22a('0x26')],_0x4e55d0['id']),util[_0xd22a('0x29')](_0x16eea7,{'showHidden':![],'depth':null}));}return _0x4628b8(null,_0x5637e3);})['catch'](function(_0x2d550c){logger[_0xd22a('0x27')](util[_0xd22a('0x24')](_0xd22a('0x28'),_0x4e55d0['name'],_0x4e55d0['id']),util[_0xd22a('0x29')](parsedResult,{'showHidden':![],'depth':null}));return _0x4628b8(_0x2d550c);});}else{return _0x4628b8(null,_0x5637e3);}}}});}; \ No newline at end of file +var _0x39a3=['serverUrl','clientId','clientSecret','slice','substring','lastIndexOf','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','authorization_code','application/x-www-form-urlencoded','then','parse','refresh_token','info','format','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name','error','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','inspect','catch','host','POST','refreshToken','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intZohoAccount.attributes','../../components/integrations/configuration','exports','define','ZohoAccount','int_zoho_accounts','zone','changed'];(function(_0x40f3f0,_0x3a681a){var _0x16802d=function(_0x378489){while(--_0x378489){_0x40f3f0['push'](_0x40f3f0['shift']());}};_0x16802d(++_0x3a681a);}(_0x39a3,0x9f));var _0x339a=function(_0xa8369a,_0x3d2319){_0xa8369a=_0xa8369a-0x0;var _0x4b74b7=_0x39a3[_0xa8369a];return _0x4b74b7;};'use strict';var _=require(_0x339a('0x0'));var util=require(_0x339a('0x1'));var logger=require(_0x339a('0x2'))(_0x339a('0x3'));var moment=require(_0x339a('0x4'));var BPromise=require(_0x339a('0x5'));var rp=require(_0x339a('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x339a('0x7'));var config=require(_0x339a('0x8'));var attributes=require(_0x339a('0x9'));var integrations=require(_0x339a('0xa'));module[_0x339a('0xb')]=function(_0x46e0da,_0x21a8b9){return _0x46e0da[_0x339a('0xc')](_0x339a('0xd'),attributes,{'tableName':_0x339a('0xe'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x27b94e,_0x28746a,_0x6997e4){if(_0x27b94e['changed'](_0x339a('0xf'))||_0x27b94e[_0x339a('0x10')](_0x339a('0x11'))||_0x27b94e['changed'](_0x339a('0x12'))||_0x27b94e[_0x339a('0x10')](_0x339a('0x13'))||_0x27b94e[_0x339a('0x10')]('code')||_0x27b94e[_0x339a('0x10')]('host')){var _0x3889fd,_0x3c12f5;_0x3889fd=_0x27b94e['serverUrl'];var _0x288da8=_0x3889fd[_0x339a('0x14')](-0x1);if(_0x288da8==='/'||_0x288da8==='\x5c'||_0x288da8===':'){_0x3889fd=_0x3889fd[_0x339a('0x15')](0x0,_0x3889fd[_0x339a('0x16')](_0x288da8));}switch(_0x27b94e['zone']){case'US':_0x3c12f5=_0x339a('0x17');break;case'AU':_0x3c12f5=_0x339a('0x18');break;case'IN':_0x3c12f5=_0x339a('0x19');break;case'CN':_0x3c12f5=_0x339a('0x1a');break;default:_0x3c12f5=_0x339a('0x1b');break;}var _0x1f856b={'method':'POST','uri':_0x3c12f5+'/oauth/v2/token','form':{'grant_type':_0x339a('0x1c'),'client_id':_0x27b94e[_0x339a('0x12')],'client_secret':_0x27b94e['clientSecret'],'redirect_uri':_0x27b94e[_0x339a('0x11')],'code':_0x27b94e['code']},'headers':{'Content-Type':_0x339a('0x1d')}};return rp(_0x1f856b)[_0x339a('0x1e')](function(_0x4ebb01){var _0x5dac41=JSON[_0x339a('0x1f')](_0x4ebb01);if(_0x5dac41[_0x339a('0x20')]){_0x27b94e['refreshToken']=_0x5dac41[_0x339a('0x20')];logger[_0x339a('0x21')](util[_0x339a('0x22')](_0x339a('0x23'),_0x27b94e[_0x339a('0x24')],_0x27b94e['id']));}else{logger[_0x339a('0x25')](util[_0x339a('0x22')](_0x339a('0x26'),_0x27b94e[_0x339a('0x24')],_0x27b94e['id']),util[_0x339a('0x27')](_0x5dac41,{'showHidden':![],'depth':null}));}return _0x6997e4(null,_0x28746a);})[_0x339a('0x28')](function(_0x12fc66){logger['error'](util['format'](_0x339a('0x26'),_0x27b94e['name'],_0x27b94e['id']),util[_0x339a('0x27')](parsedResult,{'showHidden':![],'depth':null}));return _0x6997e4(_0x12fc66);});}else{return _0x6997e4(null,_0x28746a);}},'beforeUpdate':function(_0x55ff13,_0x23fe3b,_0x5ef29c){if(_0x55ff13[_0x339a('0x10')](_0x339a('0xf'))||_0x55ff13[_0x339a('0x10')](_0x339a('0x11'))||_0x55ff13[_0x339a('0x10')](_0x339a('0x12'))||_0x55ff13[_0x339a('0x10')](_0x339a('0x13'))||_0x55ff13['changed']('code')||_0x55ff13[_0x339a('0x10')](_0x339a('0x29'))){var _0x38b0cb,_0x18d441;_0x38b0cb=_0x55ff13[_0x339a('0x11')];var _0x385074=_0x38b0cb[_0x339a('0x14')](-0x1);if(_0x385074==='/'||_0x385074==='\x5c'||_0x385074===':'){_0x38b0cb=_0x38b0cb['substring'](0x0,_0x38b0cb['lastIndexOf'](_0x385074));}switch(_0x55ff13[_0x339a('0xf')]){case'US':_0x18d441=_0x339a('0x17');break;case'AU':_0x18d441='https://accounts.zoho.com.au';break;case'IN':_0x18d441=_0x339a('0x19');break;case'CN':_0x18d441=_0x339a('0x1a');break;default:_0x18d441=_0x339a('0x1b');break;}var _0x3f16c2={'method':_0x339a('0x2a'),'uri':_0x18d441+'/oauth/v2/token','form':{'grant_type':'authorization_code','client_id':_0x55ff13[_0x339a('0x12')],'client_secret':_0x55ff13[_0x339a('0x13')],'redirect_uri':_0x55ff13[_0x339a('0x11')],'code':_0x55ff13['code']},'headers':{'Content-Type':'application/x-www-form-urlencoded'}};return rp(_0x3f16c2)[_0x339a('0x1e')](function(_0x275c75){var _0x38758a=JSON[_0x339a('0x1f')](_0x275c75);if(_0x38758a[_0x339a('0x20')]){_0x55ff13[_0x339a('0x2b')]=_0x38758a[_0x339a('0x20')];logger[_0x339a('0x21')](util['format'](_0x339a('0x23'),_0x55ff13['name'],_0x55ff13['id']));}else{logger[_0x339a('0x25')](util[_0x339a('0x22')](_0x339a('0x26'),_0x55ff13[_0x339a('0x24')],_0x55ff13['id']),util['inspect'](_0x38758a,{'showHidden':![],'depth':null}));}return _0x5ef29c(null,_0x23fe3b);})[_0x339a('0x28')](function(_0x272ed6){logger[_0x339a('0x25')](util[_0x339a('0x22')](_0x339a('0x26'),_0x55ff13[_0x339a('0x24')],_0x55ff13['id']),util[_0x339a('0x27')](parsedResult,{'showHidden':![],'depth':null}));return _0x5ef29c(_0x272ed6);});}else{return _0x5ef29c(null,_0x23fe3b);}}}});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index 21ac018..7c53c83 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 _0x9962=['client','then','info','ZohoAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','ZohoAccount','findAll','options','raw','where','limit','map','include','model','attributes','GetZohoAccount','ShowZohoAccount','find','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','jayson/promise'];(function(_0x4063a4,_0x19d730){var _0x17908d=function(_0x3ce714){while(--_0x3ce714){_0x4063a4['push'](_0x4063a4['shift']());}};_0x17908d(++_0x19d730);}(_0x9962,0xb8));var _0x2996=function(_0x2a424d,_0x12f5aa){_0x2a424d=_0x2a424d-0x0;var _0x7891e9=_0x9962[_0x2a424d];return _0x7891e9;};'use strict';var _=require(_0x2996('0x0'));var util=require('util');var moment=require(_0x2996('0x1'));var BPromise=require(_0x2996('0x2'));var rs=require(_0x2996('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2996('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x2996('0x5'))(_0x2996('0x6'));var config=require('../../config/environment');var jayson=require(_0x2996('0x7'));var client=jayson[_0x2996('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0xca00e4,_0x9a6998,_0x2f385d){return new BPromise(function(_0x871918,_0x295aad){return client['request'](_0xca00e4,_0x2f385d)[_0x2996('0x9')](function(_0x5a24dd){logger[_0x2996('0xa')](_0x2996('0xb'),_0x9a6998,_0x2996('0xc'));logger[_0x2996('0xd')]('ZohoAccount,\x20%s,\x20%s,\x20%s',_0x9a6998,_0x2996('0xc'),JSON[_0x2996('0xe')](_0x5a24dd));if(_0x5a24dd[_0x2996('0xf')]){if(_0x5a24dd[_0x2996('0xf')]['code']===0x1f4){logger[_0x2996('0xf')](_0x2996('0xb'),_0x9a6998,_0x5a24dd[_0x2996('0xf')][_0x2996('0x10')]);return _0x295aad(_0x5a24dd['error'][_0x2996('0x10')]);}logger['error'](_0x2996('0xb'),_0x9a6998,_0x5a24dd[_0x2996('0xf')]['message']);return _0x871918(_0x5a24dd[_0x2996('0xf')][_0x2996('0x10')]);}else{logger[_0x2996('0xa')](_0x2996('0xb'),_0x9a6998,_0x2996('0xc'));_0x871918(_0x5a24dd[_0x2996('0x11')][_0x2996('0x10')]);}})['catch'](function(_0x4e5d53){logger[_0x2996('0xf')](_0x2996('0xb'),_0x9a6998,_0x4e5d53);_0x295aad(_0x4e5d53);});});}exports['GetZohoAccount']=function(_0x4c29bd){var _0x31c5ca=this;return new Promise(function(_0x149c68,_0x49a938){return db[_0x2996('0x12')][_0x2996('0x13')]({'raw':_0x4c29bd[_0x2996('0x14')]?_0x4c29bd[_0x2996('0x14')][_0x2996('0x15')]===undefined?!![]:![]:!![],'where':_0x4c29bd[_0x2996('0x14')]?_0x4c29bd[_0x2996('0x14')][_0x2996('0x16')]||null:null,'attributes':_0x4c29bd[_0x2996('0x14')]?_0x4c29bd[_0x2996('0x14')]['attributes']||null:null,'limit':_0x4c29bd[_0x2996('0x14')]?_0x4c29bd[_0x2996('0x14')][_0x2996('0x17')]||null:null,'include':_0x4c29bd[_0x2996('0x14')]?_0x4c29bd[_0x2996('0x14')]['include']?_[_0x2996('0x18')](_0x4c29bd[_0x2996('0x14')][_0x2996('0x19')],function(_0x4de34d){return{'model':db[_0x4de34d[_0x2996('0x1a')]],'as':_0x4de34d['as'],'attributes':_0x4de34d[_0x2996('0x1b')],'include':_0x4de34d[_0x2996('0x19')]?_['map'](_0x4de34d[_0x2996('0x19')],function(_0x88f1c5){return{'model':db[_0x88f1c5[_0x2996('0x1a')]],'as':_0x88f1c5['as'],'attributes':_0x88f1c5['attributes'],'include':_0x88f1c5[_0x2996('0x19')]?_[_0x2996('0x18')](_0x88f1c5['include'],function(_0x229fad){return{'model':db[_0x229fad[_0x2996('0x1a')]],'as':_0x229fad['as'],'attributes':_0x229fad[_0x2996('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x2996('0x9')](function(_0x52b693){logger[_0x2996('0xa')](_0x2996('0x1c'),_0x4c29bd);logger['debug']('GetZohoAccount',_0x4c29bd,JSON[_0x2996('0xe')](_0x52b693));_0x149c68(_0x52b693);})['catch'](function(_0x3adddd){logger[_0x2996('0xf')](_0x2996('0x1c'),_0x3adddd[_0x2996('0x10')],_0x4c29bd);_0x49a938(_0x31c5ca['error'](0x1f4,_0x3adddd['message']));});});};exports[_0x2996('0x1d')]=function(_0xbfcf64){var _0x3b6503=this;return new Promise(function(_0x165d39,_0x27ed0d){return db[_0x2996('0x12')][_0x2996('0x1e')]({'raw':_0xbfcf64[_0x2996('0x14')]?_0xbfcf64['options'][_0x2996('0x15')]===undefined?!![]:![]:!![],'where':_0xbfcf64[_0x2996('0x14')]?_0xbfcf64['options'][_0x2996('0x16')]||null:null,'attributes':_0xbfcf64['options']?_0xbfcf64[_0x2996('0x14')][_0x2996('0x1b')]||null:null,'include':_0xbfcf64[_0x2996('0x14')]?_0xbfcf64['options']['include']?_[_0x2996('0x18')](_0xbfcf64['options'][_0x2996('0x19')],function(_0x200aff){return{'model':db[_0x200aff['model']],'as':_0x200aff['as'],'attributes':_0x200aff[_0x2996('0x1b')],'include':_0x200aff[_0x2996('0x19')]?_[_0x2996('0x18')](_0x200aff[_0x2996('0x19')],function(_0x33c6a1){return{'model':db[_0x33c6a1[_0x2996('0x1a')]],'as':_0x33c6a1['as'],'attributes':_0x33c6a1['attributes'],'include':_0x33c6a1['include']?_[_0x2996('0x18')](_0x33c6a1[_0x2996('0x19')],function(_0x2b1c3b){return{'model':db[_0x2b1c3b[_0x2996('0x1a')]],'as':_0x2b1c3b['as'],'attributes':_0x2b1c3b[_0x2996('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x2996('0x9')](function(_0x50d873){logger[_0x2996('0xa')](_0x2996('0x1d'),_0xbfcf64);logger['debug']('ShowZohoAccount',_0xbfcf64,JSON[_0x2996('0xe')](_0x50d873));_0x165d39(_0x50d873);})[_0x2996('0x1f')](function(_0x506f83){logger[_0x2996('0xf')](_0x2996('0x1d'),_0x506f83[_0x2996('0x10')],_0xbfcf64);_0x27ed0d(_0x3b6503[_0x2996('0xf')](0x1f4,_0x506f83[_0x2996('0x10')]));});});}; \ No newline at end of file +var _0x0e56=['lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','ZohoAccount,\x20%s,\x20%s','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetZohoAccount','options','raw','where','attributes','limit','include','map','model','ShowZohoAccount','ZohoAccount'];(function(_0x3811e9,_0xe0a068){var _0x20e779=function(_0x40dd69){while(--_0x40dd69){_0x3811e9['push'](_0x3811e9['shift']());}};_0x20e779(++_0xe0a068);}(_0x0e56,0xf5));var _0x60e5=function(_0x3ccea2,_0x624323){_0x3ccea2=_0x3ccea2-0x0;var _0xeb988=_0x0e56[_0x3ccea2];return _0xeb988;};'use strict';var _=require(_0x60e5('0x0'));var util=require(_0x60e5('0x1'));var moment=require('moment');var BPromise=require(_0x60e5('0x2'));var rs=require(_0x60e5('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x60e5('0x4'))['db'];var utils=require(_0x60e5('0x5'));var logger=require(_0x60e5('0x6'))(_0x60e5('0x7'));var config=require(_0x60e5('0x8'));var jayson=require(_0x60e5('0x9'));var client=jayson[_0x60e5('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1b44b9,_0x5513f2,_0x31765c){return new BPromise(function(_0x3083a0,_0x59389e){return client[_0x60e5('0xb')](_0x1b44b9,_0x31765c)[_0x60e5('0xc')](function(_0x46d531){logger[_0x60e5('0xd')](_0x60e5('0xe'),_0x5513f2,_0x60e5('0xf'));logger[_0x60e5('0x10')](_0x60e5('0x11'),_0x5513f2,_0x60e5('0xf'),JSON[_0x60e5('0x12')](_0x46d531));if(_0x46d531[_0x60e5('0x13')]){if(_0x46d531[_0x60e5('0x13')][_0x60e5('0x14')]===0x1f4){logger[_0x60e5('0x13')](_0x60e5('0xe'),_0x5513f2,_0x46d531[_0x60e5('0x13')]['message']);return _0x59389e(_0x46d531[_0x60e5('0x13')]['message']);}logger['error'](_0x60e5('0xe'),_0x5513f2,_0x46d531[_0x60e5('0x13')]['message']);return _0x3083a0(_0x46d531[_0x60e5('0x13')][_0x60e5('0x15')]);}else{logger[_0x60e5('0xd')](_0x60e5('0xe'),_0x5513f2,'request\x20sent');_0x3083a0(_0x46d531[_0x60e5('0x16')][_0x60e5('0x15')]);}})[_0x60e5('0x17')](function(_0x1ed08d){logger[_0x60e5('0x13')](_0x60e5('0xe'),_0x5513f2,_0x1ed08d);_0x59389e(_0x1ed08d);});});}exports[_0x60e5('0x18')]=function(_0x12aee7){var _0x3060b6=this;return new Promise(function(_0x51688a,_0x599dc4){return db['ZohoAccount']['findAll']({'raw':_0x12aee7[_0x60e5('0x19')]?_0x12aee7[_0x60e5('0x19')][_0x60e5('0x1a')]===undefined?!![]:![]:!![],'where':_0x12aee7['options']?_0x12aee7[_0x60e5('0x19')][_0x60e5('0x1b')]||null:null,'attributes':_0x12aee7[_0x60e5('0x19')]?_0x12aee7[_0x60e5('0x19')][_0x60e5('0x1c')]||null:null,'limit':_0x12aee7[_0x60e5('0x19')]?_0x12aee7[_0x60e5('0x19')][_0x60e5('0x1d')]||null:null,'include':_0x12aee7[_0x60e5('0x19')]?_0x12aee7[_0x60e5('0x19')][_0x60e5('0x1e')]?_['map'](_0x12aee7['options'][_0x60e5('0x1e')],function(_0x518741){return{'model':db[_0x518741['model']],'as':_0x518741['as'],'attributes':_0x518741[_0x60e5('0x1c')],'include':_0x518741['include']?_[_0x60e5('0x1f')](_0x518741[_0x60e5('0x1e')],function(_0x476d0a){return{'model':db[_0x476d0a[_0x60e5('0x20')]],'as':_0x476d0a['as'],'attributes':_0x476d0a[_0x60e5('0x1c')],'include':_0x476d0a['include']?_[_0x60e5('0x1f')](_0x476d0a['include'],function(_0xd13043){return{'model':db[_0xd13043[_0x60e5('0x20')]],'as':_0xd13043['as'],'attributes':_0xd13043[_0x60e5('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xefae42){logger[_0x60e5('0xd')]('GetZohoAccount',_0x12aee7);logger[_0x60e5('0x10')](_0x60e5('0x18'),_0x12aee7,JSON[_0x60e5('0x12')](_0xefae42));_0x51688a(_0xefae42);})['catch'](function(_0xb1d302){logger[_0x60e5('0x13')](_0x60e5('0x18'),_0xb1d302[_0x60e5('0x15')],_0x12aee7);_0x599dc4(_0x3060b6[_0x60e5('0x13')](0x1f4,_0xb1d302[_0x60e5('0x15')]));});});};exports[_0x60e5('0x21')]=function(_0x22116d){var _0x2707df=this;return new Promise(function(_0x3bc937,_0x285798){return db[_0x60e5('0x22')]['find']({'raw':_0x22116d[_0x60e5('0x19')]?_0x22116d[_0x60e5('0x19')][_0x60e5('0x1a')]===undefined?!![]:![]:!![],'where':_0x22116d[_0x60e5('0x19')]?_0x22116d['options']['where']||null:null,'attributes':_0x22116d['options']?_0x22116d[_0x60e5('0x19')][_0x60e5('0x1c')]||null:null,'include':_0x22116d[_0x60e5('0x19')]?_0x22116d[_0x60e5('0x19')][_0x60e5('0x1e')]?_['map'](_0x22116d[_0x60e5('0x19')][_0x60e5('0x1e')],function(_0x2467f5){return{'model':db[_0x2467f5[_0x60e5('0x20')]],'as':_0x2467f5['as'],'attributes':_0x2467f5['attributes'],'include':_0x2467f5['include']?_[_0x60e5('0x1f')](_0x2467f5['include'],function(_0x44ae5e){return{'model':db[_0x44ae5e[_0x60e5('0x20')]],'as':_0x44ae5e['as'],'attributes':_0x44ae5e[_0x60e5('0x1c')],'include':_0x44ae5e[_0x60e5('0x1e')]?_['map'](_0x44ae5e[_0x60e5('0x1e')],function(_0x1d967a){return{'model':db[_0x1d967a[_0x60e5('0x20')]],'as':_0x1d967a['as'],'attributes':_0x1d967a[_0x60e5('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3b5548){logger[_0x60e5('0xd')](_0x60e5('0x21'),_0x22116d);logger['debug'](_0x60e5('0x21'),_0x22116d,JSON[_0x60e5('0x12')](_0x3b5548));_0x3bc937(_0x3b5548);})[_0x60e5('0x17')](function(_0x2f3bfd){logger[_0x60e5('0x13')](_0x60e5('0x21'),_0x2f3bfd['message'],_0x22116d);_0x285798(_0x2707df['error'](0x1f4,_0x2f3bfd[_0x60e5('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index 1b09eb4..922a953 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 _0x544d=['getDescriptions','post','put','update','delete','exports','multer','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoConfiguration.controller','get','isAuthenticated','/:id','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions'];(function(_0x167da1,_0x5e0ba2){var _0x438896=function(_0x59e9d2){while(--_0x59e9d2){_0x167da1['push'](_0x167da1['shift']());}};_0x438896(++_0x5e0ba2);}(_0x544d,0x156));var _0xd544=function(_0x3c098d,_0x5b72c6){_0x3c098d=_0x3c098d-0x0;var _0x4681a2=_0x544d[_0x3c098d];return _0x4681a2;};'use strict';var multer=require(_0xd544('0x0'));var util=require('util');var path=require(_0xd544('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xd544('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xd544('0x3'));var interaction=require(_0xd544('0x4'));var config=require(_0xd544('0x5'));var controller=require(_0xd544('0x6'));router[_0xd544('0x7')]('/',auth[_0xd544('0x8')](),controller['index']);router[_0xd544('0x7')](_0xd544('0x9'),auth[_0xd544('0x8')](),controller['show']);router['get'](_0xd544('0xa'),auth['isAuthenticated'](),controller[_0xd544('0xb')]);router[_0xd544('0x7')](_0xd544('0xc'),auth[_0xd544('0x8')](),controller[_0xd544('0xd')]);router['get'](_0xd544('0xe'),auth[_0xd544('0x8')](),controller[_0xd544('0xf')]);router[_0xd544('0x10')]('/',auth[_0xd544('0x8')](),controller['create']);router[_0xd544('0x11')](_0xd544('0x9'),auth['isAuthenticated'](),controller[_0xd544('0x12')]);router[_0xd544('0x13')](_0xd544('0x9'),auth[_0xd544('0x8')](),controller['destroy']);module[_0xd544('0x14')]=router; \ No newline at end of file +var _0x8350=['./intZohoConfiguration.controller','get','index','/:id','show','isAuthenticated','getFields','/:id/subjects','/:id/descriptions','post','create','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment'];(function(_0x346a11,_0x38b1a3){var _0x5efd8a=function(_0x2664fb){while(--_0x2664fb){_0x346a11['push'](_0x346a11['shift']());}};_0x5efd8a(++_0x38b1a3);}(_0x8350,0x196));var _0x0835=function(_0x458684,_0x51963a){_0x458684=_0x458684-0x0;var _0x41330b=_0x8350[_0x458684];return _0x41330b;};'use strict';var multer=require(_0x0835('0x0'));var util=require(_0x0835('0x1'));var path=require(_0x0835('0x2'));var timeout=require(_0x0835('0x3'));var express=require(_0x0835('0x4'));var router=express[_0x0835('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x0835('0x6'));var config=require(_0x0835('0x7'));var controller=require(_0x0835('0x8'));router[_0x0835('0x9')]('/',auth['isAuthenticated'](),controller[_0x0835('0xa')]);router[_0x0835('0x9')](_0x0835('0xb'),auth['isAuthenticated'](),controller[_0x0835('0xc')]);router[_0x0835('0x9')]('/:id/fields',auth[_0x0835('0xd')](),controller[_0x0835('0xe')]);router[_0x0835('0x9')](_0x0835('0xf'),auth['isAuthenticated'](),controller['getSubjects']);router[_0x0835('0x9')](_0x0835('0x10'),auth[_0x0835('0xd')](),controller['getDescriptions']);router[_0x0835('0x11')]('/',auth[_0x0835('0xd')](),controller[_0x0835('0x12')]);router[_0x0835('0x13')](_0x0835('0xb'),auth[_0x0835('0xd')](),controller[_0x0835('0x14')]);router[_0x0835('0x15')](_0x0835('0xb'),auth[_0x0835('0xd')](),controller['destroy']);module[_0x0835('0x16')]=router; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js b/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js index 146e6a7..a2f2044 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 _0x8417=['sequelize','exports','STRING','ENUM','lead','contact','nothing','contact_lead'];(function(_0x4c9380,_0x2fefc0){var _0x49a523=function(_0x165e85){while(--_0x165e85){_0x4c9380['push'](_0x4c9380['shift']());}};_0x49a523(++_0x2fefc0);}(_0x8417,0x1d8));var _0x7841=function(_0x1044da,_0xc0e279){_0x1044da=_0x1044da-0x0;var _0x131681=_0x8417[_0x1044da];return _0x131681;};'use strict';var Sequelize=require(_0x7841('0x0'));module[_0x7841('0x1')]={'name':{'type':Sequelize[_0x7841('0x2')]},'moduleCreate':{'type':Sequelize[_0x7841('0x3')](_0x7841('0x4'),_0x7841('0x5'),_0x7841('0x6')),'defaultValue':_0x7841('0x4')},'moduleSearch':{'type':Sequelize[_0x7841('0x3')]('contact_lead',_0x7841('0x5'),_0x7841('0x4')),'defaultValue':_0x7841('0x7')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x4f1c=['lead','contact','nothing','sequelize','exports','STRING'];(function(_0x23a299,_0x30e49c){var _0x560bb3=function(_0x1c8073){while(--_0x1c8073){_0x23a299['push'](_0x23a299['shift']());}};_0x560bb3(++_0x30e49c);}(_0x4f1c,0x18f));var _0xc4f1=function(_0x2cea8f,_0x4a17c2){_0x2cea8f=_0x2cea8f-0x0;var _0x4a6eb4=_0x4f1c[_0x2cea8f];return _0x4a6eb4;};'use strict';var Sequelize=require(_0xc4f1('0x0'));module[_0xc4f1('0x1')]={'name':{'type':Sequelize[_0xc4f1('0x2')]},'moduleCreate':{'type':Sequelize['ENUM'](_0xc4f1('0x3'),_0xc4f1('0x4'),_0xc4f1('0x5')),'defaultValue':_0xc4f1('0x3')},'moduleSearch':{'type':Sequelize['ENUM']('contact_lead',_0xc4f1('0x4'),_0xc4f1('0x3')),'defaultValue':'contact_lead'},'description':{'type':Sequelize[_0xc4f1('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.controller.js b/server/api/intZohoConfiguration/intZohoConfiguration.controller.js index 374225c..7a5578d 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 _0xcc58=['rows','catch','params','keys','merge','create','body','find','getFields','ZohoField','order','getSubjects','getDescriptions','findOne','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','destroy','sendStatus','error','stack','name','send','index','map','ZohoConfiguration','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','options','then','includeAll','include','findAll'];(function(_0x3f2c4d,_0x55c45d){var _0x124d2f=function(_0x32eb98){while(--_0x32eb98){_0x3f2c4d['push'](_0x3f2c4d['shift']());}};_0x124d2f(++_0x55c45d);}(_0xcc58,0x199));var _0x8cc5=function(_0x5d54c7,_0x11500e){_0x5d54c7=_0x5d54c7-0x0;var _0x30863d=_0xcc58[_0x5d54c7];return _0x30863d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8cc5('0x0'));var zipdir=require(_0x8cc5('0x1'));var jsonpatch=require(_0x8cc5('0x2'));var rp=require(_0x8cc5('0x3'));var moment=require('moment');var BPromise=require(_0x8cc5('0x4'));var Mustache=require('mustache');var util=require(_0x8cc5('0x5'));var path=require(_0x8cc5('0x6'));var sox=require(_0x8cc5('0x7'));var csv=require(_0x8cc5('0x8'));var ejs=require(_0x8cc5('0x9'));var fs=require('fs');var fs_extra=require(_0x8cc5('0xa'));var _=require('lodash');var squel=require(_0x8cc5('0xb'));var crypto=require(_0x8cc5('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x8cc5('0x8'));var querystring=require('querystring');var Papa=require(_0x8cc5('0xd'));var Redis=require('ioredis');var authService=require(_0x8cc5('0xe'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8cc5('0xf'));var logger=require(_0x8cc5('0x10'))(_0x8cc5('0x11'));var utils=require(_0x8cc5('0x12'));var config=require(_0x8cc5('0x13'));var licenseUtil=require(_0x8cc5('0x14'));var db=require(_0x8cc5('0x15'))['db'];function respondWithStatusCode(_0x256d4d,_0x65422a){_0x65422a=_0x65422a||0xcc;return function(_0x403c9d){if(_0x403c9d){return _0x256d4d['sendStatus'](_0x65422a);}return _0x256d4d[_0x8cc5('0x16')](_0x65422a)[_0x8cc5('0x17')]();};}function respondWithResult(_0x5deb9a,_0x109826){_0x109826=_0x109826||0xc8;return function(_0x437868){if(_0x437868){return _0x5deb9a[_0x8cc5('0x16')](_0x109826)[_0x8cc5('0x18')](_0x437868);}};}function respondWithFilteredResult(_0x30b684,_0x21a6a4){return function(_0xce4cf8){if(_0xce4cf8){var _0x4fdb6c=typeof _0x21a6a4[_0x8cc5('0x19')]===_0x8cc5('0x1a')&&typeof _0x21a6a4[_0x8cc5('0x1b')]===_0x8cc5('0x1a');var _0x26f5b1=_0xce4cf8['count'];var _0x26949b=_0x4fdb6c?0x0:_0x21a6a4[_0x8cc5('0x19')];var _0x349b66=_0x4fdb6c?_0xce4cf8[_0x8cc5('0x1c')]:_0x21a6a4[_0x8cc5('0x19')]+_0x21a6a4[_0x8cc5('0x1b')];var _0x3bd315;if(_0x349b66>=_0x26f5b1){_0x349b66=_0x26f5b1;_0x3bd315=0xc8;}else{_0x3bd315=0xce;}_0x30b684[_0x8cc5('0x16')](_0x3bd315);return _0x30b684[_0x8cc5('0x1d')](_0x8cc5('0x1e'),_0x26949b+'-'+_0x349b66+'/'+_0x26f5b1)[_0x8cc5('0x18')](_0xce4cf8);}return null;};}function patchUpdates(_0x33d717){return function(_0x598349){try{jsonpatch[_0x8cc5('0x1f')](_0x598349,_0x33d717,!![]);}catch(_0xebc134){return BPromise[_0x8cc5('0x20')](_0xebc134);}return _0x598349['save']();};}function saveUpdates(_0x5e94e3,_0x223fb4){return function(_0x10b65c){if(_0x10b65c){return _0x10b65c[_0x8cc5('0x21')](_0x5e94e3)['then'](function(_0x2fa629){return _0x2fa629;});}return null;};}function removeEntity(_0x367fde,_0x6101ff){return function(_0x57fda0){if(_0x57fda0){return _0x57fda0[_0x8cc5('0x22')]()['then'](function(){_0x367fde[_0x8cc5('0x16')](0xcc)[_0x8cc5('0x17')]();});}};}function handleEntityNotFound(_0x1c028d,_0x1badf6){return function(_0x263b85){if(!_0x263b85){_0x1c028d[_0x8cc5('0x23')](0x194);}return _0x263b85;};}function handleError(_0x6160ed,_0x55b3b8){_0x55b3b8=_0x55b3b8||0x1f4;return function(_0x16b8a9){logger[_0x8cc5('0x24')](_0x16b8a9[_0x8cc5('0x25')]);if(_0x16b8a9[_0x8cc5('0x26')]){delete _0x16b8a9[_0x8cc5('0x26')];}_0x6160ed[_0x8cc5('0x16')](_0x55b3b8)[_0x8cc5('0x27')](_0x16b8a9);};}exports[_0x8cc5('0x28')]=function(_0x1e2132,_0x1e5858){var _0x2c3148={},_0x35b26f={},_0x26984f={'count':0x0,'rows':[]};var _0x305aef=_[_0x8cc5('0x29')](db[_0x8cc5('0x2a')][_0x8cc5('0x2b')],function(_0x1d5b89){return{'name':_0x1d5b89['fieldName'],'type':_0x1d5b89[_0x8cc5('0x2c')][_0x8cc5('0x2d')]};});_0x35b26f[_0x8cc5('0x2e')]=_[_0x8cc5('0x29')](_0x305aef,_0x8cc5('0x26'));_0x35b26f[_0x8cc5('0x2f')]=_['keys'](_0x1e2132[_0x8cc5('0x2f')]);_0x35b26f[_0x8cc5('0x30')]=_[_0x8cc5('0x31')](_0x35b26f[_0x8cc5('0x2e')],_0x35b26f[_0x8cc5('0x2f')]);_0x2c3148[_0x8cc5('0x32')]=_[_0x8cc5('0x31')](_0x35b26f[_0x8cc5('0x2e')],qs[_0x8cc5('0x33')](_0x1e2132[_0x8cc5('0x2f')][_0x8cc5('0x33')]));_0x2c3148['attributes']=_0x2c3148[_0x8cc5('0x32')][_0x8cc5('0x34')]?_0x2c3148[_0x8cc5('0x32')]:_0x35b26f[_0x8cc5('0x2e')];if(!_0x1e2132['query'][_0x8cc5('0x35')](_0x8cc5('0x36'))){_0x2c3148[_0x8cc5('0x1b')]=qs['limit'](_0x1e2132[_0x8cc5('0x2f')][_0x8cc5('0x1b')]);_0x2c3148[_0x8cc5('0x19')]=qs[_0x8cc5('0x19')](_0x1e2132['query'][_0x8cc5('0x19')]);}_0x2c3148['order']=qs[_0x8cc5('0x37')](_0x1e2132[_0x8cc5('0x2f')]['sort']);_0x2c3148[_0x8cc5('0x38')]=qs[_0x8cc5('0x30')](_[_0x8cc5('0x39')](_0x1e2132['query'],_0x35b26f[_0x8cc5('0x30')]),_0x305aef);if(_0x1e2132[_0x8cc5('0x2f')][_0x8cc5('0x3a')]){_0x2c3148[_0x8cc5('0x38')]=_['merge'](_0x2c3148[_0x8cc5('0x38')],{'$or':_['map'](_0x305aef,function(_0x4365d8){if(_0x4365d8[_0x8cc5('0x2c')]!==_0x8cc5('0x3b')){var _0x2a7003={};_0x2a7003[_0x4365d8[_0x8cc5('0x26')]]={'$like':'%'+_0x1e2132['query'][_0x8cc5('0x3a')]+'%'};return _0x2a7003;}})});}_0x2c3148=_['merge']({},_0x2c3148,_0x1e2132[_0x8cc5('0x3c')]);var _0x4e90bc={'where':_0x2c3148[_0x8cc5('0x38')]};return db[_0x8cc5('0x2a')][_0x8cc5('0x1c')](_0x4e90bc)[_0x8cc5('0x3d')](function(_0x333a48){_0x26984f['count']=_0x333a48;if(_0x1e2132[_0x8cc5('0x2f')][_0x8cc5('0x3e')]){_0x2c3148[_0x8cc5('0x3f')]=[{'all':!![]}];}return db[_0x8cc5('0x2a')][_0x8cc5('0x40')](_0x2c3148);})['then'](function(_0x1ca090){_0x26984f[_0x8cc5('0x41')]=_0x1ca090;return _0x26984f;})['then'](respondWithFilteredResult(_0x1e5858,_0x2c3148))[_0x8cc5('0x42')](handleError(_0x1e5858,null));};exports['show']=function(_0x22bf37,_0x39e519){var _0x6ca4e4={'raw':![],'where':{'id':_0x22bf37[_0x8cc5('0x43')]['id']}},_0x14700c={};_0x14700c[_0x8cc5('0x2e')]=_[_0x8cc5('0x44')](db[_0x8cc5('0x2a')][_0x8cc5('0x2b')]);_0x14700c[_0x8cc5('0x2f')]=_[_0x8cc5('0x44')](_0x22bf37[_0x8cc5('0x2f')]);_0x14700c[_0x8cc5('0x30')]=_[_0x8cc5('0x31')](_0x14700c[_0x8cc5('0x2e')],_0x14700c[_0x8cc5('0x2f')]);_0x6ca4e4[_0x8cc5('0x32')]=_[_0x8cc5('0x31')](_0x14700c[_0x8cc5('0x2e')],qs['fields'](_0x22bf37['query'][_0x8cc5('0x33')]));_0x6ca4e4[_0x8cc5('0x32')]=_0x6ca4e4[_0x8cc5('0x32')][_0x8cc5('0x34')]?_0x6ca4e4['attributes']:_0x14700c['model'];if(_0x22bf37['query']['includeAll']){_0x6ca4e4[_0x8cc5('0x3f')]=[{'all':!![]}];}_0x6ca4e4=_[_0x8cc5('0x45')]({},_0x6ca4e4,_0x22bf37[_0x8cc5('0x3c')]);return db[_0x8cc5('0x2a')]['find'](_0x6ca4e4)[_0x8cc5('0x3d')](handleEntityNotFound(_0x39e519,null))[_0x8cc5('0x3d')](respondWithResult(_0x39e519,null))[_0x8cc5('0x42')](handleError(_0x39e519,null));};exports[_0x8cc5('0x46')]=function(_0xc5161,_0x54d438){return db['ZohoConfiguration'][_0x8cc5('0x46')](_0xc5161['body'],{})[_0x8cc5('0x3d')](respondWithResult(_0x54d438,0xc9))['catch'](handleError(_0x54d438,null));};exports['update']=function(_0x43eddc,_0x5e597b){if(_0x43eddc[_0x8cc5('0x47')]['id']){delete _0x43eddc[_0x8cc5('0x47')]['id'];}return db['ZohoConfiguration'][_0x8cc5('0x48')]({'where':{'id':_0x43eddc[_0x8cc5('0x43')]['id']}})[_0x8cc5('0x3d')](handleEntityNotFound(_0x5e597b,null))['then'](saveUpdates(_0x43eddc[_0x8cc5('0x47')],null))[_0x8cc5('0x3d')](respondWithResult(_0x5e597b,null))[_0x8cc5('0x42')](handleError(_0x5e597b,null));};exports[_0x8cc5('0x22')]=function(_0xe7f6a3,_0x1db8e9){return db['ZohoConfiguration']['find']({'where':{'id':_0xe7f6a3[_0x8cc5('0x43')]['id']}})[_0x8cc5('0x3d')](handleEntityNotFound(_0x1db8e9,null))[_0x8cc5('0x3d')](removeEntity(_0x1db8e9,null))[_0x8cc5('0x42')](handleError(_0x1db8e9,null));};exports[_0x8cc5('0x49')]=function(_0x746ba6,_0x1c585e,_0x278502){var _0x3dce1d={};var _0x1094c1={};var _0x3ed9b9;var _0x292126;return db[_0x8cc5('0x2a')]['findOne']({'where':{'id':_0x746ba6[_0x8cc5('0x43')]['id']}})['then'](handleEntityNotFound(_0x1c585e,null))[_0x8cc5('0x3d')](function(_0x512d6a){if(_0x512d6a){_0x3ed9b9=_0x512d6a;_0x1094c1['model']=_['keys'](db[_0x8cc5('0x4a')][_0x8cc5('0x2b')]);_0x1094c1[_0x8cc5('0x2f')]=_[_0x8cc5('0x44')](_0x746ba6[_0x8cc5('0x2f')]);_0x1094c1[_0x8cc5('0x30')]=_[_0x8cc5('0x31')](_0x1094c1[_0x8cc5('0x2e')],_0x1094c1[_0x8cc5('0x2f')]);_0x3dce1d['attributes']=_[_0x8cc5('0x31')](_0x1094c1['model'],qs['fields'](_0x746ba6[_0x8cc5('0x2f')][_0x8cc5('0x33')]));_0x3dce1d[_0x8cc5('0x32')]=_0x3dce1d[_0x8cc5('0x32')][_0x8cc5('0x34')]?_0x3dce1d[_0x8cc5('0x32')]:_0x1094c1[_0x8cc5('0x2e')];_0x3dce1d[_0x8cc5('0x4b')]=qs[_0x8cc5('0x37')](_0x746ba6[_0x8cc5('0x2f')]['sort']);_0x3dce1d[_0x8cc5('0x38')]=qs['filters'](_[_0x8cc5('0x39')](_0x746ba6[_0x8cc5('0x2f')],_0x1094c1['filters']));if(_0x746ba6[_0x8cc5('0x2f')]['filter']){_0x3dce1d[_0x8cc5('0x38')]=_['merge'](_0x3dce1d[_0x8cc5('0x38')],{'$or':_[_0x8cc5('0x29')](_0x3dce1d[_0x8cc5('0x32')],function(_0x48a894){var _0x43b061={};_0x43b061[_0x48a894]={'$like':'%'+_0x746ba6['query']['filter']+'%'};return _0x43b061;})});}_0x3dce1d=_['merge']({},_0x3dce1d,_0x746ba6[_0x8cc5('0x3c')]);return _0x3ed9b9[_0x8cc5('0x49')](_0x3dce1d);}})[_0x8cc5('0x3d')](function(_0x41f214){if(_0x41f214){_0x292126=_0x41f214['length'];if(!_0x746ba6[_0x8cc5('0x2f')][_0x8cc5('0x35')](_0x8cc5('0x36'))){_0x3dce1d[_0x8cc5('0x1b')]=qs['limit'](_0x746ba6[_0x8cc5('0x2f')]['limit']);_0x3dce1d[_0x8cc5('0x19')]=qs[_0x8cc5('0x19')](_0x746ba6[_0x8cc5('0x2f')][_0x8cc5('0x19')]);}return _0x3ed9b9[_0x8cc5('0x49')](_0x3dce1d);}})[_0x8cc5('0x3d')](function(_0x79be98){if(_0x79be98){return _0x79be98?{'count':_0x292126,'rows':_0x79be98}:null;}})[_0x8cc5('0x3d')](respondWithResult(_0x1c585e,null))[_0x8cc5('0x42')](handleError(_0x1c585e,null));};exports['getSubjects']=function(_0x18958e,_0x18877a,_0x275dfd){var _0x1cbdc0={};var _0x52642f={};var _0x99fe69;var _0x560799;return db[_0x8cc5('0x2a')]['findOne']({'where':{'id':_0x18958e[_0x8cc5('0x43')]['id']}})[_0x8cc5('0x3d')](handleEntityNotFound(_0x18877a,null))[_0x8cc5('0x3d')](function(_0x57c9c9){if(_0x57c9c9){_0x99fe69=_0x57c9c9;_0x52642f[_0x8cc5('0x2e')]=_['keys'](db[_0x8cc5('0x4a')]['rawAttributes']);_0x52642f[_0x8cc5('0x2f')]=_['keys'](_0x18958e['query']);_0x52642f['filters']=_[_0x8cc5('0x31')](_0x52642f['model'],_0x52642f[_0x8cc5('0x2f')]);_0x1cbdc0[_0x8cc5('0x32')]=_[_0x8cc5('0x31')](_0x52642f[_0x8cc5('0x2e')],qs['fields'](_0x18958e['query'][_0x8cc5('0x33')]));_0x1cbdc0[_0x8cc5('0x32')]=_0x1cbdc0[_0x8cc5('0x32')][_0x8cc5('0x34')]?_0x1cbdc0['attributes']:_0x52642f[_0x8cc5('0x2e')];_0x1cbdc0['order']=qs['sort'](_0x18958e[_0x8cc5('0x2f')][_0x8cc5('0x37')]);_0x1cbdc0[_0x8cc5('0x38')]=qs['filters'](_[_0x8cc5('0x39')](_0x18958e[_0x8cc5('0x2f')],_0x52642f[_0x8cc5('0x30')]));if(_0x18958e[_0x8cc5('0x2f')][_0x8cc5('0x3a')]){_0x1cbdc0['where']=_[_0x8cc5('0x45')](_0x1cbdc0[_0x8cc5('0x38')],{'$or':_[_0x8cc5('0x29')](_0x1cbdc0[_0x8cc5('0x32')],function(_0x5407c6){var _0x587d2e={};_0x587d2e[_0x5407c6]={'$like':'%'+_0x18958e[_0x8cc5('0x2f')][_0x8cc5('0x3a')]+'%'};return _0x587d2e;})});}_0x1cbdc0=_['merge']({},_0x1cbdc0,_0x18958e['options']);return _0x99fe69['getSubjects'](_0x1cbdc0);}})[_0x8cc5('0x3d')](function(_0x3ea89a){if(_0x3ea89a){_0x560799=_0x3ea89a['length'];if(!_0x18958e['query']['hasOwnProperty'](_0x8cc5('0x36'))){_0x1cbdc0[_0x8cc5('0x1b')]=qs[_0x8cc5('0x1b')](_0x18958e['query']['limit']);_0x1cbdc0[_0x8cc5('0x19')]=qs[_0x8cc5('0x19')](_0x18958e['query'][_0x8cc5('0x19')]);}return _0x99fe69[_0x8cc5('0x4c')](_0x1cbdc0);}})[_0x8cc5('0x3d')](function(_0x3a2b2e){if(_0x3a2b2e){return _0x3a2b2e?{'count':_0x560799,'rows':_0x3a2b2e}:null;}})[_0x8cc5('0x3d')](respondWithResult(_0x18877a,null))[_0x8cc5('0x42')](handleError(_0x18877a,null));};exports[_0x8cc5('0x4d')]=function(_0x21e1bf,_0x1186f0,_0x556df3){var _0x477722={};var _0x2d9072={};var _0xe8ba9e;var _0x4ea328;return db[_0x8cc5('0x2a')][_0x8cc5('0x4e')]({'where':{'id':_0x21e1bf['params']['id']}})['then'](handleEntityNotFound(_0x1186f0,null))[_0x8cc5('0x3d')](function(_0x4132ab){if(_0x4132ab){_0xe8ba9e=_0x4132ab;_0x2d9072['model']=_[_0x8cc5('0x44')](db[_0x8cc5('0x4a')]['rawAttributes']);_0x2d9072[_0x8cc5('0x2f')]=_[_0x8cc5('0x44')](_0x21e1bf['query']);_0x2d9072[_0x8cc5('0x30')]=_[_0x8cc5('0x31')](_0x2d9072['model'],_0x2d9072['query']);_0x477722[_0x8cc5('0x32')]=_[_0x8cc5('0x31')](_0x2d9072[_0x8cc5('0x2e')],qs[_0x8cc5('0x33')](_0x21e1bf[_0x8cc5('0x2f')][_0x8cc5('0x33')]));_0x477722[_0x8cc5('0x32')]=_0x477722[_0x8cc5('0x32')][_0x8cc5('0x34')]?_0x477722[_0x8cc5('0x32')]:_0x2d9072[_0x8cc5('0x2e')];_0x477722[_0x8cc5('0x4b')]=qs[_0x8cc5('0x37')](_0x21e1bf['query'][_0x8cc5('0x37')]);_0x477722[_0x8cc5('0x38')]=qs[_0x8cc5('0x30')](_[_0x8cc5('0x39')](_0x21e1bf['query'],_0x2d9072[_0x8cc5('0x30')]));if(_0x21e1bf[_0x8cc5('0x2f')]['filter']){_0x477722[_0x8cc5('0x38')]=_['merge'](_0x477722[_0x8cc5('0x38')],{'$or':_[_0x8cc5('0x29')](_0x477722[_0x8cc5('0x32')],function(_0x1a3ef2){var _0x4d978c={};_0x4d978c[_0x1a3ef2]={'$like':'%'+_0x21e1bf[_0x8cc5('0x2f')][_0x8cc5('0x3a')]+'%'};return _0x4d978c;})});}_0x477722=_[_0x8cc5('0x45')]({},_0x477722,_0x21e1bf[_0x8cc5('0x3c')]);return _0xe8ba9e[_0x8cc5('0x4d')](_0x477722);}})[_0x8cc5('0x3d')](function(_0x73e275){if(_0x73e275){_0x4ea328=_0x73e275[_0x8cc5('0x34')];if(!_0x21e1bf[_0x8cc5('0x2f')]['hasOwnProperty'](_0x8cc5('0x36'))){_0x477722[_0x8cc5('0x1b')]=qs[_0x8cc5('0x1b')](_0x21e1bf[_0x8cc5('0x2f')]['limit']);_0x477722[_0x8cc5('0x19')]=qs[_0x8cc5('0x19')](_0x21e1bf[_0x8cc5('0x2f')][_0x8cc5('0x19')]);}return _0xe8ba9e[_0x8cc5('0x4d')](_0x477722);}})[_0x8cc5('0x3d')](function(_0x3246b9){if(_0x3246b9){return _0x3246b9?{'count':_0x4ea328,'rows':_0x3246b9}:null;}})[_0x8cc5('0x3d')](respondWithResult(_0x1186f0,null))[_0x8cc5('0x42')](handleError(_0x1186f0,null));}; \ No newline at end of file +var _0x617d=['save','update','then','destroy','end','stack','name','send','map','ZohoConfiguration','rawAttributes','fieldName','type','key','query','intersection','model','attributes','fields','nolimit','sort','filters','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','length','find','create','body','getFields','findOne','ZohoField','order','pick','hasOwnProperty','getSubjects','getDescriptions','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply'];(function(_0x595c86,_0xf73913){var _0x1db390=function(_0x188ad6){while(--_0x188ad6){_0x595c86['push'](_0x595c86['shift']());}};_0x1db390(++_0xf73913);}(_0x617d,0x1ba));var _0xd617=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x617d[_0x5b644e];return _0x49c6bf;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd617('0x0'));var zipdir=require(_0xd617('0x1'));var jsonpatch=require(_0xd617('0x2'));var rp=require(_0xd617('0x3'));var moment=require(_0xd617('0x4'));var BPromise=require(_0xd617('0x5'));var Mustache=require('mustache');var util=require(_0xd617('0x6'));var path=require(_0xd617('0x7'));var sox=require(_0xd617('0x8'));var csv=require(_0xd617('0x9'));var ejs=require(_0xd617('0xa'));var fs=require('fs');var fs_extra=require(_0xd617('0xb'));var _=require(_0xd617('0xc'));var squel=require(_0xd617('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xd617('0x9'));var querystring=require('querystring');var Papa=require(_0xd617('0xe'));var Redis=require(_0xd617('0xf'));var authService=require(_0xd617('0x10'));var qs=require(_0xd617('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xd617('0x12'))(_0xd617('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xd617('0x14'));var db=require(_0xd617('0x15'))['db'];function respondWithStatusCode(_0x43845f,_0x269bec){_0x269bec=_0x269bec||0xcc;return function(_0x533275){if(_0x533275){return _0x43845f[_0xd617('0x16')](_0x269bec);}return _0x43845f[_0xd617('0x17')](_0x269bec)['end']();};}function respondWithResult(_0x35348c,_0x5ca9ae){_0x5ca9ae=_0x5ca9ae||0xc8;return function(_0xe16ad2){if(_0xe16ad2){return _0x35348c['status'](_0x5ca9ae)[_0xd617('0x18')](_0xe16ad2);}};}function respondWithFilteredResult(_0x3e2b3f,_0x4032f5){return function(_0x236a29){if(_0x236a29){var _0x1f5d5c=typeof _0x4032f5[_0xd617('0x19')]===_0xd617('0x1a')&&typeof _0x4032f5[_0xd617('0x1b')]===_0xd617('0x1a');var _0x5d7281=_0x236a29[_0xd617('0x1c')];var _0x2ed4d8=_0x1f5d5c?0x0:_0x4032f5[_0xd617('0x19')];var _0x2ec07c=_0x1f5d5c?_0x236a29['count']:_0x4032f5[_0xd617('0x19')]+_0x4032f5[_0xd617('0x1b')];var _0x31cbdf;if(_0x2ec07c>=_0x5d7281){_0x2ec07c=_0x5d7281;_0x31cbdf=0xc8;}else{_0x31cbdf=0xce;}_0x3e2b3f[_0xd617('0x17')](_0x31cbdf);return _0x3e2b3f[_0xd617('0x1d')](_0xd617('0x1e'),_0x2ed4d8+'-'+_0x2ec07c+'/'+_0x5d7281)[_0xd617('0x18')](_0x236a29);}return null;};}function patchUpdates(_0x2caccb){return function(_0x169dcb){try{jsonpatch[_0xd617('0x1f')](_0x169dcb,_0x2caccb,!![]);}catch(_0x15f13d){return BPromise['reject'](_0x15f13d);}return _0x169dcb[_0xd617('0x20')]();};}function saveUpdates(_0x306d3c,_0x2dc45b){return function(_0x5e67c6){if(_0x5e67c6){return _0x5e67c6[_0xd617('0x21')](_0x306d3c)[_0xd617('0x22')](function(_0x499a02){return _0x499a02;});}return null;};}function removeEntity(_0x174c64,_0x4dbafe){return function(_0x5ee7bf){if(_0x5ee7bf){return _0x5ee7bf[_0xd617('0x23')]()[_0xd617('0x22')](function(){_0x174c64[_0xd617('0x17')](0xcc)[_0xd617('0x24')]();});}};}function handleEntityNotFound(_0x4254f4,_0x1cf7bd){return function(_0x388602){if(!_0x388602){_0x4254f4['sendStatus'](0x194);}return _0x388602;};}function handleError(_0x3236ac,_0x220e30){_0x220e30=_0x220e30||0x1f4;return function(_0x19bc17){logger['error'](_0x19bc17[_0xd617('0x25')]);if(_0x19bc17[_0xd617('0x26')]){delete _0x19bc17[_0xd617('0x26')];}_0x3236ac[_0xd617('0x17')](_0x220e30)[_0xd617('0x27')](_0x19bc17);};}exports['index']=function(_0x3ff478,_0x2acff3){var _0x1c3fa0={},_0x1950d1={},_0x4cc5fb={'count':0x0,'rows':[]};var _0x47afa6=_[_0xd617('0x28')](db[_0xd617('0x29')][_0xd617('0x2a')],function(_0x503ff7){return{'name':_0x503ff7[_0xd617('0x2b')],'type':_0x503ff7[_0xd617('0x2c')][_0xd617('0x2d')]};});_0x1950d1['model']=_['map'](_0x47afa6,_0xd617('0x26'));_0x1950d1[_0xd617('0x2e')]=_['keys'](_0x3ff478[_0xd617('0x2e')]);_0x1950d1['filters']=_[_0xd617('0x2f')](_0x1950d1[_0xd617('0x30')],_0x1950d1['query']);_0x1c3fa0[_0xd617('0x31')]=_[_0xd617('0x2f')](_0x1950d1['model'],qs['fields'](_0x3ff478[_0xd617('0x2e')][_0xd617('0x32')]));_0x1c3fa0[_0xd617('0x31')]=_0x1c3fa0[_0xd617('0x31')]['length']?_0x1c3fa0['attributes']:_0x1950d1[_0xd617('0x30')];if(!_0x3ff478[_0xd617('0x2e')]['hasOwnProperty'](_0xd617('0x33'))){_0x1c3fa0[_0xd617('0x1b')]=qs['limit'](_0x3ff478[_0xd617('0x2e')][_0xd617('0x1b')]);_0x1c3fa0[_0xd617('0x19')]=qs[_0xd617('0x19')](_0x3ff478[_0xd617('0x2e')][_0xd617('0x19')]);}_0x1c3fa0['order']=qs['sort'](_0x3ff478['query'][_0xd617('0x34')]);_0x1c3fa0['where']=qs[_0xd617('0x35')](_['pick'](_0x3ff478['query'],_0x1950d1[_0xd617('0x35')]),_0x47afa6);if(_0x3ff478['query'][_0xd617('0x36')]){_0x1c3fa0[_0xd617('0x37')]=_[_0xd617('0x38')](_0x1c3fa0[_0xd617('0x37')],{'$or':_[_0xd617('0x28')](_0x47afa6,function(_0x37fd7e){if(_0x37fd7e[_0xd617('0x2c')]!==_0xd617('0x39')){var _0x4febeb={};_0x4febeb[_0x37fd7e[_0xd617('0x26')]]={'$like':'%'+_0x3ff478[_0xd617('0x2e')][_0xd617('0x36')]+'%'};return _0x4febeb;}})});}_0x1c3fa0=_[_0xd617('0x38')]({},_0x1c3fa0,_0x3ff478[_0xd617('0x3a')]);var _0x197327={'where':_0x1c3fa0[_0xd617('0x37')]};return db[_0xd617('0x29')]['count'](_0x197327)[_0xd617('0x22')](function(_0x1c619f){_0x4cc5fb['count']=_0x1c619f;if(_0x3ff478[_0xd617('0x2e')][_0xd617('0x3b')]){_0x1c3fa0[_0xd617('0x3c')]=[{'all':!![]}];}return db['ZohoConfiguration'][_0xd617('0x3d')](_0x1c3fa0);})[_0xd617('0x22')](function(_0x148d46){_0x4cc5fb[_0xd617('0x3e')]=_0x148d46;return _0x4cc5fb;})['then'](respondWithFilteredResult(_0x2acff3,_0x1c3fa0))[_0xd617('0x3f')](handleError(_0x2acff3,null));};exports[_0xd617('0x40')]=function(_0x576dab,_0x2f398d){var _0x5077f4={'raw':![],'where':{'id':_0x576dab[_0xd617('0x41')]['id']}},_0x3e64aa={};_0x3e64aa[_0xd617('0x30')]=_[_0xd617('0x42')](db[_0xd617('0x29')]['rawAttributes']);_0x3e64aa[_0xd617('0x2e')]=_[_0xd617('0x42')](_0x576dab['query']);_0x3e64aa[_0xd617('0x35')]=_['intersection'](_0x3e64aa[_0xd617('0x30')],_0x3e64aa[_0xd617('0x2e')]);_0x5077f4[_0xd617('0x31')]=_[_0xd617('0x2f')](_0x3e64aa['model'],qs[_0xd617('0x32')](_0x576dab[_0xd617('0x2e')][_0xd617('0x32')]));_0x5077f4['attributes']=_0x5077f4[_0xd617('0x31')][_0xd617('0x43')]?_0x5077f4['attributes']:_0x3e64aa[_0xd617('0x30')];if(_0x576dab[_0xd617('0x2e')]['includeAll']){_0x5077f4[_0xd617('0x3c')]=[{'all':!![]}];}_0x5077f4=_[_0xd617('0x38')]({},_0x5077f4,_0x576dab[_0xd617('0x3a')]);return db['ZohoConfiguration'][_0xd617('0x44')](_0x5077f4)[_0xd617('0x22')](handleEntityNotFound(_0x2f398d,null))['then'](respondWithResult(_0x2f398d,null))['catch'](handleError(_0x2f398d,null));};exports[_0xd617('0x45')]=function(_0x9daf0,_0x1fe3f5){return db[_0xd617('0x29')][_0xd617('0x45')](_0x9daf0[_0xd617('0x46')],{})[_0xd617('0x22')](respondWithResult(_0x1fe3f5,0xc9))[_0xd617('0x3f')](handleError(_0x1fe3f5,null));};exports[_0xd617('0x21')]=function(_0x2f7ce3,_0x10fd9d){if(_0x2f7ce3[_0xd617('0x46')]['id']){delete _0x2f7ce3[_0xd617('0x46')]['id'];}return db[_0xd617('0x29')][_0xd617('0x44')]({'where':{'id':_0x2f7ce3['params']['id']}})[_0xd617('0x22')](handleEntityNotFound(_0x10fd9d,null))[_0xd617('0x22')](saveUpdates(_0x2f7ce3[_0xd617('0x46')],null))[_0xd617('0x22')](respondWithResult(_0x10fd9d,null))[_0xd617('0x3f')](handleError(_0x10fd9d,null));};exports['destroy']=function(_0x3f0c8c,_0x3dfc2d){return db[_0xd617('0x29')][_0xd617('0x44')]({'where':{'id':_0x3f0c8c[_0xd617('0x41')]['id']}})[_0xd617('0x22')](handleEntityNotFound(_0x3dfc2d,null))[_0xd617('0x22')](removeEntity(_0x3dfc2d,null))[_0xd617('0x3f')](handleError(_0x3dfc2d,null));};exports[_0xd617('0x47')]=function(_0x7f4c0e,_0x1d53bc,_0x3c28a6){var _0x46bf6b={};var _0x6aaebd={};var _0x1b19fe;var _0x3fa5b9;return db[_0xd617('0x29')][_0xd617('0x48')]({'where':{'id':_0x7f4c0e[_0xd617('0x41')]['id']}})[_0xd617('0x22')](handleEntityNotFound(_0x1d53bc,null))['then'](function(_0x3ba091){if(_0x3ba091){_0x1b19fe=_0x3ba091;_0x6aaebd[_0xd617('0x30')]=_['keys'](db[_0xd617('0x49')]['rawAttributes']);_0x6aaebd[_0xd617('0x2e')]=_[_0xd617('0x42')](_0x7f4c0e[_0xd617('0x2e')]);_0x6aaebd[_0xd617('0x35')]=_['intersection'](_0x6aaebd[_0xd617('0x30')],_0x6aaebd[_0xd617('0x2e')]);_0x46bf6b[_0xd617('0x31')]=_[_0xd617('0x2f')](_0x6aaebd[_0xd617('0x30')],qs[_0xd617('0x32')](_0x7f4c0e[_0xd617('0x2e')][_0xd617('0x32')]));_0x46bf6b[_0xd617('0x31')]=_0x46bf6b['attributes'][_0xd617('0x43')]?_0x46bf6b[_0xd617('0x31')]:_0x6aaebd[_0xd617('0x30')];_0x46bf6b[_0xd617('0x4a')]=qs['sort'](_0x7f4c0e[_0xd617('0x2e')][_0xd617('0x34')]);_0x46bf6b[_0xd617('0x37')]=qs[_0xd617('0x35')](_[_0xd617('0x4b')](_0x7f4c0e[_0xd617('0x2e')],_0x6aaebd[_0xd617('0x35')]));if(_0x7f4c0e[_0xd617('0x2e')][_0xd617('0x36')]){_0x46bf6b[_0xd617('0x37')]=_['merge'](_0x46bf6b[_0xd617('0x37')],{'$or':_['map'](_0x46bf6b['attributes'],function(_0x1ddec7){var _0x356939={};_0x356939[_0x1ddec7]={'$like':'%'+_0x7f4c0e[_0xd617('0x2e')][_0xd617('0x36')]+'%'};return _0x356939;})});}_0x46bf6b=_[_0xd617('0x38')]({},_0x46bf6b,_0x7f4c0e[_0xd617('0x3a')]);return _0x1b19fe[_0xd617('0x47')](_0x46bf6b);}})[_0xd617('0x22')](function(_0x42914e){if(_0x42914e){_0x3fa5b9=_0x42914e[_0xd617('0x43')];if(!_0x7f4c0e[_0xd617('0x2e')][_0xd617('0x4c')](_0xd617('0x33'))){_0x46bf6b[_0xd617('0x1b')]=qs['limit'](_0x7f4c0e[_0xd617('0x2e')][_0xd617('0x1b')]);_0x46bf6b['offset']=qs['offset'](_0x7f4c0e['query'][_0xd617('0x19')]);}return _0x1b19fe[_0xd617('0x47')](_0x46bf6b);}})[_0xd617('0x22')](function(_0x8d888e){if(_0x8d888e){return _0x8d888e?{'count':_0x3fa5b9,'rows':_0x8d888e}:null;}})[_0xd617('0x22')](respondWithResult(_0x1d53bc,null))[_0xd617('0x3f')](handleError(_0x1d53bc,null));};exports[_0xd617('0x4d')]=function(_0x5e3d61,_0x307090,_0x58ba94){var _0x24309e={};var _0x450241={};var _0x567968;var _0x2709bd;return db[_0xd617('0x29')][_0xd617('0x48')]({'where':{'id':_0x5e3d61['params']['id']}})['then'](handleEntityNotFound(_0x307090,null))[_0xd617('0x22')](function(_0x531b0c){if(_0x531b0c){_0x567968=_0x531b0c;_0x450241['model']=_['keys'](db['ZohoField']['rawAttributes']);_0x450241[_0xd617('0x2e')]=_[_0xd617('0x42')](_0x5e3d61[_0xd617('0x2e')]);_0x450241['filters']=_[_0xd617('0x2f')](_0x450241[_0xd617('0x30')],_0x450241[_0xd617('0x2e')]);_0x24309e[_0xd617('0x31')]=_[_0xd617('0x2f')](_0x450241[_0xd617('0x30')],qs[_0xd617('0x32')](_0x5e3d61[_0xd617('0x2e')][_0xd617('0x32')]));_0x24309e[_0xd617('0x31')]=_0x24309e['attributes'][_0xd617('0x43')]?_0x24309e['attributes']:_0x450241[_0xd617('0x30')];_0x24309e[_0xd617('0x4a')]=qs[_0xd617('0x34')](_0x5e3d61['query'][_0xd617('0x34')]);_0x24309e['where']=qs['filters'](_[_0xd617('0x4b')](_0x5e3d61['query'],_0x450241[_0xd617('0x35')]));if(_0x5e3d61['query'][_0xd617('0x36')]){_0x24309e[_0xd617('0x37')]=_['merge'](_0x24309e[_0xd617('0x37')],{'$or':_[_0xd617('0x28')](_0x24309e[_0xd617('0x31')],function(_0x88591d){var _0x4c6d06={};_0x4c6d06[_0x88591d]={'$like':'%'+_0x5e3d61[_0xd617('0x2e')][_0xd617('0x36')]+'%'};return _0x4c6d06;})});}_0x24309e=_['merge']({},_0x24309e,_0x5e3d61[_0xd617('0x3a')]);return _0x567968['getSubjects'](_0x24309e);}})[_0xd617('0x22')](function(_0x145c99){if(_0x145c99){_0x2709bd=_0x145c99[_0xd617('0x43')];if(!_0x5e3d61[_0xd617('0x2e')][_0xd617('0x4c')](_0xd617('0x33'))){_0x24309e['limit']=qs[_0xd617('0x1b')](_0x5e3d61[_0xd617('0x2e')][_0xd617('0x1b')]);_0x24309e[_0xd617('0x19')]=qs[_0xd617('0x19')](_0x5e3d61[_0xd617('0x2e')][_0xd617('0x19')]);}return _0x567968['getSubjects'](_0x24309e);}})[_0xd617('0x22')](function(_0x25e176){if(_0x25e176){return _0x25e176?{'count':_0x2709bd,'rows':_0x25e176}:null;}})[_0xd617('0x22')](respondWithResult(_0x307090,null))[_0xd617('0x3f')](handleError(_0x307090,null));};exports[_0xd617('0x4e')]=function(_0x1410d3,_0x58c922,_0x299c1d){var _0x3a6f64={};var _0x13abe2={};var _0x18dcf9;var _0x49115d;return db[_0xd617('0x29')][_0xd617('0x48')]({'where':{'id':_0x1410d3[_0xd617('0x41')]['id']}})['then'](handleEntityNotFound(_0x58c922,null))[_0xd617('0x22')](function(_0xb661df){if(_0xb661df){_0x18dcf9=_0xb661df;_0x13abe2[_0xd617('0x30')]=_[_0xd617('0x42')](db[_0xd617('0x49')]['rawAttributes']);_0x13abe2['query']=_[_0xd617('0x42')](_0x1410d3['query']);_0x13abe2[_0xd617('0x35')]=_[_0xd617('0x2f')](_0x13abe2[_0xd617('0x30')],_0x13abe2[_0xd617('0x2e')]);_0x3a6f64['attributes']=_[_0xd617('0x2f')](_0x13abe2[_0xd617('0x30')],qs[_0xd617('0x32')](_0x1410d3['query'][_0xd617('0x32')]));_0x3a6f64[_0xd617('0x31')]=_0x3a6f64['attributes'][_0xd617('0x43')]?_0x3a6f64[_0xd617('0x31')]:_0x13abe2['model'];_0x3a6f64['order']=qs['sort'](_0x1410d3[_0xd617('0x2e')][_0xd617('0x34')]);_0x3a6f64[_0xd617('0x37')]=qs[_0xd617('0x35')](_[_0xd617('0x4b')](_0x1410d3[_0xd617('0x2e')],_0x13abe2['filters']));if(_0x1410d3[_0xd617('0x2e')][_0xd617('0x36')]){_0x3a6f64['where']=_[_0xd617('0x38')](_0x3a6f64[_0xd617('0x37')],{'$or':_[_0xd617('0x28')](_0x3a6f64[_0xd617('0x31')],function(_0x38f49c){var _0xff481d={};_0xff481d[_0x38f49c]={'$like':'%'+_0x1410d3['query'][_0xd617('0x36')]+'%'};return _0xff481d;})});}_0x3a6f64=_[_0xd617('0x38')]({},_0x3a6f64,_0x1410d3[_0xd617('0x3a')]);return _0x18dcf9['getDescriptions'](_0x3a6f64);}})[_0xd617('0x22')](function(_0x1403a6){if(_0x1403a6){_0x49115d=_0x1403a6[_0xd617('0x43')];if(!_0x1410d3['query'][_0xd617('0x4c')](_0xd617('0x33'))){_0x3a6f64[_0xd617('0x1b')]=qs[_0xd617('0x1b')](_0x1410d3[_0xd617('0x2e')][_0xd617('0x1b')]);_0x3a6f64[_0xd617('0x19')]=qs['offset'](_0x1410d3['query']['offset']);}return _0x18dcf9[_0xd617('0x4e')](_0x3a6f64);}})[_0xd617('0x22')](function(_0x28a8cd){if(_0x28a8cd){return _0x28a8cd?{'count':_0x49115d,'rows':_0x28a8cd}:null;}})[_0xd617('0x22')](respondWithResult(_0x58c922,null))[_0xd617('0x3f')](handleError(_0x58c922,null));}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.model.js b/server/api/intZohoConfiguration/intZohoConfiguration.model.js index 57d25b3..707ea77 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 _0xe1d0=['exports','ZohoConfiguration','int_zoho_configurations','util','../../config/logger','api','bluebird','../../config/environment','./intZohoConfiguration.attributes'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xe1d0,0x186));var _0x0e1d=function(_0x3864e7,_0xd65515){_0x3864e7=_0x3864e7-0x0;var _0x563b9d=_0xe1d0[_0x3864e7];return _0x563b9d;};'use strict';var _=require('lodash');var util=require(_0x0e1d('0x0'));var logger=require(_0x0e1d('0x1'))(_0x0e1d('0x2'));var moment=require('moment');var BPromise=require(_0x0e1d('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x0e1d('0x4'));var attributes=require(_0x0e1d('0x5'));module[_0x0e1d('0x6')]=function(_0x111165,_0x13cd69){return _0x111165['define'](_0x0e1d('0x7'),attributes,{'tableName':_0x0e1d('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x855a=['moment','request-promise','path','../../config/environment','./intZohoConfiguration.attributes','exports','define','int_zoho_configurations','util','../../config/logger','api'];(function(_0x5a3cf0,_0x160a68){var _0x5a64ee=function(_0x34cd1d){while(--_0x34cd1d){_0x5a3cf0['push'](_0x5a3cf0['shift']());}};_0x5a64ee(++_0x160a68);}(_0x855a,0x168));var _0xa855=function(_0x156dba,_0x4e513e){_0x156dba=_0x156dba-0x0;var _0xa401c=_0x855a[_0x156dba];return _0xa401c;};'use strict';var _=require('lodash');var util=require(_0xa855('0x0'));var logger=require(_0xa855('0x1'))(_0xa855('0x2'));var moment=require(_0xa855('0x3'));var BPromise=require('bluebird');var rp=require(_0xa855('0x4'));var fs=require('fs');var path=require(_0xa855('0x5'));var rimraf=require('rimraf');var config=require(_0xa855('0x6'));var attributes=require(_0xa855('0x7'));module[_0xa855('0x8')]=function(_0x214248,_0x7b5a9){return _0x214248[_0xa855('0x9')]('ZohoConfiguration',attributes,{'tableName':_0xa855('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.rpc.js b/server/api/intZohoConfiguration/intZohoConfiguration.rpc.js index 02da4c1..fb417da 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 _0x090a=['stringify','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','info','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x434566,_0x4b8b8e){var _0x537999=function(_0x5ece22){while(--_0x5ece22){_0x434566['push'](_0x434566['shift']());}};_0x537999(++_0x4b8b8e);}(_0x090a,0x1bb));var _0xa090=function(_0x508b05,_0x4698aa){_0x508b05=_0x508b05-0x0;var _0x43fab6=_0x090a[_0x508b05];return _0x43fab6;};'use strict';var _=require(_0xa090('0x0'));var util=require(_0xa090('0x1'));var moment=require(_0xa090('0x2'));var BPromise=require('bluebird');var rs=require(_0xa090('0x3'));var fs=require('fs');var Redis=require(_0xa090('0x4'));var db=require(_0xa090('0x5'))['db'];var utils=require(_0xa090('0x6'));var logger=require(_0xa090('0x7'))(_0xa090('0x8'));var config=require(_0xa090('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xa090('0xa')][_0xa090('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2565c9,_0x1a7fd7,_0x41c22a){return new BPromise(function(_0x450ff2,_0x4ea5bc){return client['request'](_0x2565c9,_0x41c22a)[_0xa090('0xc')](function(_0x1c9ee4){logger[_0xa090('0xd')](_0xa090('0xe'),_0x1a7fd7,_0xa090('0xf'));logger[_0xa090('0x10')]('ZohoConfiguration,\x20%s,\x20%s,\x20%s',_0x1a7fd7,_0xa090('0xf'),JSON[_0xa090('0x11')](_0x1c9ee4));if(_0x1c9ee4['error']){if(_0x1c9ee4[_0xa090('0x12')][_0xa090('0x13')]===0x1f4){logger[_0xa090('0x12')]('ZohoConfiguration,\x20%s,\x20%s',_0x1a7fd7,_0x1c9ee4[_0xa090('0x12')][_0xa090('0x14')]);return _0x4ea5bc(_0x1c9ee4[_0xa090('0x12')][_0xa090('0x14')]);}logger[_0xa090('0x12')](_0xa090('0xe'),_0x1a7fd7,_0x1c9ee4[_0xa090('0x12')][_0xa090('0x14')]);return _0x450ff2(_0x1c9ee4[_0xa090('0x12')][_0xa090('0x14')]);}else{logger[_0xa090('0xd')](_0xa090('0xe'),_0x1a7fd7,'request\x20sent');_0x450ff2(_0x1c9ee4[_0xa090('0x15')]['message']);}})[_0xa090('0x16')](function(_0x379a82){logger[_0xa090('0x12')](_0xa090('0xe'),_0x1a7fd7,_0x379a82);_0x4ea5bc(_0x379a82);});});} \ No newline at end of file +var _0xb171=['jayson/promise','client','request','then','info','ZohoConfiguration,\x20%s,\x20%s','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xb171,0x199));var _0x1b17=function(_0x413430,_0x51d70b){_0x413430=_0x413430-0x0;var _0x122170=_0xb171[_0x413430];return _0x122170;};'use strict';var _=require('lodash');var util=require(_0x1b17('0x0'));var moment=require(_0x1b17('0x1'));var BPromise=require(_0x1b17('0x2'));var rs=require(_0x1b17('0x3'));var fs=require('fs');var Redis=require(_0x1b17('0x4'));var db=require(_0x1b17('0x5'))['db'];var utils=require(_0x1b17('0x6'));var logger=require('../../config/logger')(_0x1b17('0x7'));var config=require(_0x1b17('0x8'));var jayson=require(_0x1b17('0x9'));var client=jayson[_0x1b17('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x54b301,_0x5ebdc5,_0x5bbf75){return new BPromise(function(_0x24b894,_0x2fc557){return client[_0x1b17('0xb')](_0x54b301,_0x5bbf75)[_0x1b17('0xc')](function(_0x2c354a){logger[_0x1b17('0xd')](_0x1b17('0xe'),_0x5ebdc5,'request\x20sent');logger[_0x1b17('0xf')](_0x1b17('0x10'),_0x5ebdc5,_0x1b17('0x11'),JSON['stringify'](_0x2c354a));if(_0x2c354a[_0x1b17('0x12')]){if(_0x2c354a[_0x1b17('0x12')]['code']===0x1f4){logger[_0x1b17('0x12')](_0x1b17('0xe'),_0x5ebdc5,_0x2c354a[_0x1b17('0x12')]['message']);return _0x2fc557(_0x2c354a[_0x1b17('0x12')]['message']);}logger[_0x1b17('0x12')](_0x1b17('0xe'),_0x5ebdc5,_0x2c354a['error'][_0x1b17('0x13')]);return _0x24b894(_0x2c354a['error'][_0x1b17('0x13')]);}else{logger['info']('ZohoConfiguration,\x20%s,\x20%s',_0x5ebdc5,_0x1b17('0x11'));_0x24b894(_0x2c354a[_0x1b17('0x14')][_0x1b17('0x13')]);}})[_0x1b17('0x15')](function(_0x27998a){logger[_0x1b17('0x12')]('ZohoConfiguration,\x20%s,\x20%s',_0x5ebdc5,_0x27998a);_0x2fc557(_0x27998a);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index c9543cd..37be85f 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 _0xd419=['path','connect-timeout','express','../../components/interaction/service','../../config/environment','./intZohoField.controller','get','isAuthenticated','/:id','show','post','create','update','destroy','exports','multer','util'];(function(_0xe0bbdd,_0x5cba7f){var _0x48775d=function(_0x423606){while(--_0x423606){_0xe0bbdd['push'](_0xe0bbdd['shift']());}};_0x48775d(++_0x5cba7f);}(_0xd419,0x10e));var _0x9d41=function(_0x44c8bc,_0x4b8f9c){_0x44c8bc=_0x44c8bc-0x0;var _0x17e4d9=_0xd419[_0x44c8bc];return _0x17e4d9;};'use strict';var multer=require(_0x9d41('0x0'));var util=require(_0x9d41('0x1'));var path=require(_0x9d41('0x2'));var timeout=require(_0x9d41('0x3'));var express=require(_0x9d41('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x9d41('0x5'));var config=require(_0x9d41('0x6'));var controller=require(_0x9d41('0x7'));router[_0x9d41('0x8')]('/',auth[_0x9d41('0x9')](),controller['index']);router[_0x9d41('0x8')](_0x9d41('0xa'),auth[_0x9d41('0x9')](),controller[_0x9d41('0xb')]);router[_0x9d41('0xc')]('/',auth['isAuthenticated'](),controller[_0x9d41('0xd')]);router['put'](_0x9d41('0xa'),auth['isAuthenticated'](),controller[_0x9d41('0xe')]);router['delete'](_0x9d41('0xa'),auth[_0x9d41('0x9')](),controller[_0x9d41('0xf')]);module[_0x9d41('0x10')]=router; \ No newline at end of file +var _0xa454=['/:id','show','post','update','destroy','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./intZohoField.controller','get','isAuthenticated','index'];(function(_0x4b22de,_0x2313f3){var _0x535c17=function(_0xa55161){while(--_0xa55161){_0x4b22de['push'](_0x4b22de['shift']());}};_0x535c17(++_0x2313f3);}(_0xa454,0x125));var _0x4a45=function(_0x1b08ad,_0xebd037){_0x1b08ad=_0x1b08ad-0x0;var _0xb5e51f=_0xa454[_0x1b08ad];return _0xb5e51f;};'use strict';var multer=require(_0x4a45('0x0'));var util=require(_0x4a45('0x1'));var path=require('path');var timeout=require(_0x4a45('0x2'));var express=require('express');var router=express[_0x4a45('0x3')]();var fs_extra=require(_0x4a45('0x4'));var auth=require(_0x4a45('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x4a45('0x6'));var controller=require(_0x4a45('0x7'));router[_0x4a45('0x8')]('/',auth[_0x4a45('0x9')](),controller[_0x4a45('0xa')]);router[_0x4a45('0x8')](_0x4a45('0xb'),auth['isAuthenticated'](),controller[_0x4a45('0xc')]);router[_0x4a45('0xd')]('/',auth[_0x4a45('0x9')](),controller['create']);router['put'](_0x4a45('0xb'),auth[_0x4a45('0x9')](),controller[_0x4a45('0xe')]);router['delete'](_0x4a45('0xb'),auth[_0x4a45('0x9')](),controller[_0x4a45('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.attributes.js b/server/api/intZohoField/intZohoField.attributes.js index cf2efaa..1d8c5b5 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 _0xea64=['customVariable','keyValue','picklist','STRING','BOOLEAN','sequelize','ENUM','string','variable'];(function(_0x127d28,_0x308891){var _0x1b1383=function(_0xae56ae){while(--_0xae56ae){_0x127d28['push'](_0x127d28['shift']());}};_0x1b1383(++_0x308891);}(_0xea64,0x101));var _0x4ea6=function(_0x1cc519,_0x295249){_0x1cc519=_0x1cc519-0x0;var _0x5cf583=_0xea64[_0x1cc519];return _0x5cf583;};'use strict';var Sequelize=require(_0x4ea6('0x0'));module['exports']={'type':{'type':Sequelize[_0x4ea6('0x1')](_0x4ea6('0x2'),_0x4ea6('0x3'),_0x4ea6('0x4'),_0x4ea6('0x5'),_0x4ea6('0x6')),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x4ea6('0x7')]},'keyType':{'type':Sequelize[_0x4ea6('0x1')](_0x4ea6('0x2'),_0x4ea6('0x3'),_0x4ea6('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x4ea6('0x7')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x4ea6('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x4ea6('0x7')]}}; \ No newline at end of file +var _0x4542=['variable','keyValue','STRING','customVariable','sequelize','ENUM','string'];(function(_0x174b74,_0x383d70){var _0x2d2ddc=function(_0x55c3cb){while(--_0x55c3cb){_0x174b74['push'](_0x174b74['shift']());}};_0x2d2ddc(++_0x383d70);}(_0x4542,0xcf));var _0x2454=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x4542[_0x4565bf];return _0x5610ba;};'use strict';var Sequelize=require(_0x2454('0x0'));module['exports']={'type':{'type':Sequelize[_0x2454('0x1')](_0x2454('0x2'),_0x2454('0x3'),'customVariable',_0x2454('0x4'),'picklist'),'defaultValue':_0x2454('0x2')},'content':{'type':Sequelize[_0x2454('0x5')]},'key':{'type':Sequelize[_0x2454('0x5')]},'keyType':{'type':Sequelize[_0x2454('0x1')]('string',_0x2454('0x3'),_0x2454('0x6'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x2454('0x5')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x2454('0x5')]}}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.controller.js b/server/api/intZohoField/intZohoField.controller.js index 8aad71f..3b29030 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 _0x3325=['../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','set','json','apply','reject','save','then','destroy','error','stack','name','index','map','ZohoField','rawAttributes','fieldName','key','model','keys','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','count','includeAll','include','findAll','rows','catch','show','params','fields','options','create','body','find','zip-dir','fast-json-patch','request-promise','moment','bluebird','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api'];(function(_0x24ea1f,_0x42a5ec){var _0x4f0da6=function(_0x1043cd){while(--_0x1043cd){_0x24ea1f['push'](_0x24ea1f['shift']());}};_0x4f0da6(++_0x42a5ec);}(_0x3325,0x155));var _0x5332=function(_0x596565,_0x1258ad){_0x596565=_0x596565-0x0;var _0x474b1b=_0x3325[_0x596565];return _0x474b1b;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x5332('0x0'));var jsonpatch=require(_0x5332('0x1'));var rp=require(_0x5332('0x2'));var moment=require(_0x5332('0x3'));var BPromise=require(_0x5332('0x4'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x5332('0x5'));var csv=require(_0x5332('0x6'));var ejs=require(_0x5332('0x7'));var fs=require('fs');var fs_extra=require(_0x5332('0x8'));var _=require('lodash');var squel=require(_0x5332('0x9'));var crypto=require(_0x5332('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x5332('0xb'));var toCsv=require('to-csv');var querystring=require(_0x5332('0xc'));var Papa=require(_0x5332('0xd'));var Redis=require(_0x5332('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x5332('0xf'));var as=require(_0x5332('0x10'));var hardwareService=require(_0x5332('0x11'));var logger=require('../../config/logger')(_0x5332('0x12'));var utils=require('../../config/utils');var config=require(_0x5332('0x13'));var licenseUtil=require(_0x5332('0x14'));var db=require(_0x5332('0x15'))['db'];function respondWithStatusCode(_0x596b23,_0x37a8f0){_0x37a8f0=_0x37a8f0||0xcc;return function(_0xba181f){if(_0xba181f){return _0x596b23[_0x5332('0x16')](_0x37a8f0);}return _0x596b23[_0x5332('0x17')](_0x37a8f0)[_0x5332('0x18')]();};}function respondWithResult(_0x4802ae,_0xbfa5b3){_0xbfa5b3=_0xbfa5b3||0xc8;return function(_0x282001){if(_0x282001){return _0x4802ae[_0x5332('0x17')](_0xbfa5b3)['json'](_0x282001);}};}function respondWithFilteredResult(_0x49107b,_0x249a10){return function(_0x42ccf2){if(_0x42ccf2){var _0x46844d=typeof _0x249a10[_0x5332('0x19')]===_0x5332('0x1a')&&typeof _0x249a10[_0x5332('0x1b')]===_0x5332('0x1a');var _0x520b21=_0x42ccf2['count'];var _0x29ad0e=_0x46844d?0x0:_0x249a10['offset'];var _0x4801da=_0x46844d?_0x42ccf2['count']:_0x249a10[_0x5332('0x19')]+_0x249a10[_0x5332('0x1b')];var _0x5dbd8f;if(_0x4801da>=_0x520b21){_0x4801da=_0x520b21;_0x5dbd8f=0xc8;}else{_0x5dbd8f=0xce;}_0x49107b[_0x5332('0x17')](_0x5dbd8f);return _0x49107b[_0x5332('0x1c')]('Content-Range',_0x29ad0e+'-'+_0x4801da+'/'+_0x520b21)[_0x5332('0x1d')](_0x42ccf2);}return null;};}function patchUpdates(_0x829cbb){return function(_0x30ee02){try{jsonpatch[_0x5332('0x1e')](_0x30ee02,_0x829cbb,!![]);}catch(_0x4766b2){return BPromise[_0x5332('0x1f')](_0x4766b2);}return _0x30ee02[_0x5332('0x20')]();};}function saveUpdates(_0x2fb500,_0x3587f7){return function(_0x885ba3){if(_0x885ba3){return _0x885ba3['update'](_0x2fb500)[_0x5332('0x21')](function(_0x50ae74){return _0x50ae74;});}return null;};}function removeEntity(_0x323114,_0x217fc7){return function(_0x3141f3){if(_0x3141f3){return _0x3141f3[_0x5332('0x22')]()[_0x5332('0x21')](function(){_0x323114[_0x5332('0x17')](0xcc)[_0x5332('0x18')]();});}};}function handleEntityNotFound(_0x340733,_0x3f73f6){return function(_0x512074){if(!_0x512074){_0x340733[_0x5332('0x16')](0x194);}return _0x512074;};}function handleError(_0x1e1293,_0x14d2f2){_0x14d2f2=_0x14d2f2||0x1f4;return function(_0x4584b2){logger[_0x5332('0x23')](_0x4584b2[_0x5332('0x24')]);if(_0x4584b2[_0x5332('0x25')]){delete _0x4584b2[_0x5332('0x25')];}_0x1e1293['status'](_0x14d2f2)['send'](_0x4584b2);};}exports[_0x5332('0x26')]=function(_0x4228e2,_0x1dfa81){var _0x1a032f={},_0x1198da={},_0x1ce4ab={'count':0x0,'rows':[]};var _0x5fdce7=_[_0x5332('0x27')](db[_0x5332('0x28')][_0x5332('0x29')],function(_0x33b709){return{'name':_0x33b709[_0x5332('0x2a')],'type':_0x33b709['type'][_0x5332('0x2b')]};});_0x1198da[_0x5332('0x2c')]=_[_0x5332('0x27')](_0x5fdce7,_0x5332('0x25'));_0x1198da['query']=_[_0x5332('0x2d')](_0x4228e2[_0x5332('0x2e')]);_0x1198da[_0x5332('0x2f')]=_[_0x5332('0x30')](_0x1198da[_0x5332('0x2c')],_0x1198da['query']);_0x1a032f[_0x5332('0x31')]=_[_0x5332('0x30')](_0x1198da[_0x5332('0x2c')],qs['fields'](_0x4228e2[_0x5332('0x2e')]['fields']));_0x1a032f[_0x5332('0x31')]=_0x1a032f[_0x5332('0x31')][_0x5332('0x32')]?_0x1a032f[_0x5332('0x31')]:_0x1198da[_0x5332('0x2c')];if(!_0x4228e2[_0x5332('0x2e')][_0x5332('0x33')](_0x5332('0x34'))){_0x1a032f[_0x5332('0x1b')]=qs[_0x5332('0x1b')](_0x4228e2[_0x5332('0x2e')][_0x5332('0x1b')]);_0x1a032f[_0x5332('0x19')]=qs[_0x5332('0x19')](_0x4228e2[_0x5332('0x2e')][_0x5332('0x19')]);}_0x1a032f['order']=qs['sort'](_0x4228e2[_0x5332('0x2e')][_0x5332('0x35')]);_0x1a032f[_0x5332('0x36')]=qs[_0x5332('0x2f')](_[_0x5332('0x37')](_0x4228e2[_0x5332('0x2e')],_0x1198da[_0x5332('0x2f')]),_0x5fdce7);if(_0x4228e2[_0x5332('0x2e')][_0x5332('0x38')]){_0x1a032f[_0x5332('0x36')]=_[_0x5332('0x39')](_0x1a032f[_0x5332('0x36')],{'$or':_[_0x5332('0x27')](_0x5fdce7,function(_0x5da868){if(_0x5da868['type']!==_0x5332('0x3a')){var _0x25d440={};_0x25d440[_0x5da868[_0x5332('0x25')]]={'$like':'%'+_0x4228e2[_0x5332('0x2e')][_0x5332('0x38')]+'%'};return _0x25d440;}})});}_0x1a032f=_[_0x5332('0x39')]({},_0x1a032f,_0x4228e2['options']);var _0x45efb8={'where':_0x1a032f['where']};return db[_0x5332('0x28')][_0x5332('0x3b')](_0x45efb8)[_0x5332('0x21')](function(_0x58b216){_0x1ce4ab['count']=_0x58b216;if(_0x4228e2[_0x5332('0x2e')][_0x5332('0x3c')]){_0x1a032f[_0x5332('0x3d')]=[{'all':!![]}];}return db[_0x5332('0x28')][_0x5332('0x3e')](_0x1a032f);})[_0x5332('0x21')](function(_0xcbb54c){_0x1ce4ab[_0x5332('0x3f')]=_0xcbb54c;return _0x1ce4ab;})[_0x5332('0x21')](respondWithFilteredResult(_0x1dfa81,_0x1a032f))[_0x5332('0x40')](handleError(_0x1dfa81,null));};exports[_0x5332('0x41')]=function(_0x13f68a,_0x2f7c46){var _0x390491={'raw':!![],'where':{'id':_0x13f68a[_0x5332('0x42')]['id']}},_0x6a9e74={};_0x6a9e74[_0x5332('0x2c')]=_[_0x5332('0x2d')](db[_0x5332('0x28')][_0x5332('0x29')]);_0x6a9e74[_0x5332('0x2e')]=_[_0x5332('0x2d')](_0x13f68a[_0x5332('0x2e')]);_0x6a9e74['filters']=_[_0x5332('0x30')](_0x6a9e74[_0x5332('0x2c')],_0x6a9e74['query']);_0x390491[_0x5332('0x31')]=_[_0x5332('0x30')](_0x6a9e74[_0x5332('0x2c')],qs[_0x5332('0x43')](_0x13f68a[_0x5332('0x2e')][_0x5332('0x43')]));_0x390491['attributes']=_0x390491[_0x5332('0x31')][_0x5332('0x32')]?_0x390491['attributes']:_0x6a9e74[_0x5332('0x2c')];if(_0x13f68a['query'][_0x5332('0x3c')]){_0x390491[_0x5332('0x3d')]=[{'all':!![]}];}_0x390491=_[_0x5332('0x39')]({},_0x390491,_0x13f68a[_0x5332('0x44')]);return db['ZohoField']['find'](_0x390491)[_0x5332('0x21')](handleEntityNotFound(_0x2f7c46,null))[_0x5332('0x21')](respondWithResult(_0x2f7c46,null))['catch'](handleError(_0x2f7c46,null));};exports[_0x5332('0x45')]=function(_0x508040,_0x390ca8){return db['ZohoField'][_0x5332('0x45')](_0x508040[_0x5332('0x46')],{})[_0x5332('0x21')](respondWithResult(_0x390ca8,0xc9))[_0x5332('0x40')](handleError(_0x390ca8,null));};exports['update']=function(_0x1bfcc0,_0x478833){if(_0x1bfcc0[_0x5332('0x46')]['id']){delete _0x1bfcc0['body']['id'];}return db[_0x5332('0x28')][_0x5332('0x47')]({'where':{'id':_0x1bfcc0[_0x5332('0x42')]['id']}})['then'](handleEntityNotFound(_0x478833,null))['then'](saveUpdates(_0x1bfcc0[_0x5332('0x46')],null))[_0x5332('0x21')](respondWithResult(_0x478833,null))[_0x5332('0x40')](handleError(_0x478833,null));};exports[_0x5332('0x22')]=function(_0x524dad,_0x5ab6e5){return db[_0x5332('0x28')][_0x5332('0x47')]({'where':{'id':_0x524dad[_0x5332('0x42')]['id']}})['then'](handleEntityNotFound(_0x5ab6e5,null))['then'](removeEntity(_0x5ab6e5,null))[_0x5332('0x40')](handleError(_0x5ab6e5,null));}; \ No newline at end of file +var _0x7599=['fields','length','hasOwnProperty','nolimit','limit','order','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','Content-Range','reject','save','update','then','destroy','error','name','index','map','ZohoField','rawAttributes','type','key','query','filters','intersection','model','attributes'];(function(_0xadb49b,_0x4f60b5){var _0x57f89c=function(_0x1bb8b6){while(--_0x1bb8b6){_0xadb49b['push'](_0xadb49b['shift']());}};_0x57f89c(++_0x4f60b5);}(_0x7599,0xfb));var _0x9759=function(_0x41486b,_0x1c242e){_0x41486b=_0x41486b-0x0;var _0x4576a4=_0x7599[_0x41486b];return _0x4576a4;};'use strict';var emlformat=require(_0x9759('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9759('0x1'));var jsonpatch=require(_0x9759('0x2'));var rp=require(_0x9759('0x3'));var moment=require(_0x9759('0x4'));var BPromise=require(_0x9759('0x5'));var Mustache=require(_0x9759('0x6'));var util=require(_0x9759('0x7'));var path=require(_0x9759('0x8'));var sox=require(_0x9759('0x9'));var csv=require(_0x9759('0xa'));var ejs=require(_0x9759('0xb'));var fs=require('fs');var fs_extra=require(_0x9759('0xc'));var _=require(_0x9759('0xd'));var squel=require(_0x9759('0xe'));var crypto=require(_0x9759('0xf'));var jsforce=require(_0x9759('0x10'));var deskjs=require('desk.js');var toCsv=require(_0x9759('0xa'));var querystring=require(_0x9759('0x11'));var Papa=require(_0x9759('0x12'));var Redis=require(_0x9759('0x13'));var authService=require(_0x9759('0x14'));var qs=require(_0x9759('0x15'));var as=require(_0x9759('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9759('0x17'))(_0x9759('0x18'));var utils=require('../../config/utils');var config=require(_0x9759('0x19'));var licenseUtil=require(_0x9759('0x1a'));var db=require(_0x9759('0x1b'))['db'];function respondWithStatusCode(_0x3fba27,_0x4b9b73){_0x4b9b73=_0x4b9b73||0xcc;return function(_0x326304){if(_0x326304){return _0x3fba27[_0x9759('0x1c')](_0x4b9b73);}return _0x3fba27[_0x9759('0x1d')](_0x4b9b73)[_0x9759('0x1e')]();};}function respondWithResult(_0x125882,_0x4cde92){_0x4cde92=_0x4cde92||0xc8;return function(_0x3544bc){if(_0x3544bc){return _0x125882['status'](_0x4cde92)['json'](_0x3544bc);}};}function respondWithFilteredResult(_0x484f84,_0x1e603b){return function(_0x4f6eea){if(_0x4f6eea){var _0x4b4e93=typeof _0x1e603b[_0x9759('0x1f')]===_0x9759('0x20')&&typeof _0x1e603b['limit']===_0x9759('0x20');var _0x23063d=_0x4f6eea['count'];var _0x4054e2=_0x4b4e93?0x0:_0x1e603b[_0x9759('0x1f')];var _0x5a99b6=_0x4b4e93?_0x4f6eea[_0x9759('0x21')]:_0x1e603b['offset']+_0x1e603b['limit'];var _0xf9d023;if(_0x5a99b6>=_0x23063d){_0x5a99b6=_0x23063d;_0xf9d023=0xc8;}else{_0xf9d023=0xce;}_0x484f84[_0x9759('0x1d')](_0xf9d023);return _0x484f84['set'](_0x9759('0x22'),_0x4054e2+'-'+_0x5a99b6+'/'+_0x23063d)['json'](_0x4f6eea);}return null;};}function patchUpdates(_0x40c760){return function(_0x569c31){try{jsonpatch['apply'](_0x569c31,_0x40c760,!![]);}catch(_0x487baf){return BPromise[_0x9759('0x23')](_0x487baf);}return _0x569c31[_0x9759('0x24')]();};}function saveUpdates(_0x8f3230,_0x5d2f3e){return function(_0x25778e){if(_0x25778e){return _0x25778e[_0x9759('0x25')](_0x8f3230)[_0x9759('0x26')](function(_0x291524){return _0x291524;});}return null;};}function removeEntity(_0xaee556,_0x8197d6){return function(_0x47a762){if(_0x47a762){return _0x47a762[_0x9759('0x27')]()['then'](function(){_0xaee556['status'](0xcc)[_0x9759('0x1e')]();});}};}function handleEntityNotFound(_0x442449,_0x2ed1ae){return function(_0x22c1f0){if(!_0x22c1f0){_0x442449[_0x9759('0x1c')](0x194);}return _0x22c1f0;};}function handleError(_0x19de1f,_0x52bea5){_0x52bea5=_0x52bea5||0x1f4;return function(_0x2e7007){logger[_0x9759('0x28')](_0x2e7007['stack']);if(_0x2e7007[_0x9759('0x29')]){delete _0x2e7007['name'];}_0x19de1f[_0x9759('0x1d')](_0x52bea5)['send'](_0x2e7007);};}exports[_0x9759('0x2a')]=function(_0x59f84c,_0x3042af){var _0x3e24a2={},_0x3f8153={},_0x44b076={'count':0x0,'rows':[]};var _0x178a1d=_[_0x9759('0x2b')](db[_0x9759('0x2c')][_0x9759('0x2d')],function(_0x5b96ab){return{'name':_0x5b96ab['fieldName'],'type':_0x5b96ab[_0x9759('0x2e')][_0x9759('0x2f')]};});_0x3f8153['model']=_[_0x9759('0x2b')](_0x178a1d,'name');_0x3f8153['query']=_['keys'](_0x59f84c[_0x9759('0x30')]);_0x3f8153[_0x9759('0x31')]=_[_0x9759('0x32')](_0x3f8153[_0x9759('0x33')],_0x3f8153['query']);_0x3e24a2[_0x9759('0x34')]=_[_0x9759('0x32')](_0x3f8153['model'],qs[_0x9759('0x35')](_0x59f84c[_0x9759('0x30')]['fields']));_0x3e24a2[_0x9759('0x34')]=_0x3e24a2[_0x9759('0x34')][_0x9759('0x36')]?_0x3e24a2[_0x9759('0x34')]:_0x3f8153[_0x9759('0x33')];if(!_0x59f84c[_0x9759('0x30')][_0x9759('0x37')](_0x9759('0x38'))){_0x3e24a2[_0x9759('0x39')]=qs['limit'](_0x59f84c[_0x9759('0x30')][_0x9759('0x39')]);_0x3e24a2[_0x9759('0x1f')]=qs[_0x9759('0x1f')](_0x59f84c[_0x9759('0x30')][_0x9759('0x1f')]);}_0x3e24a2[_0x9759('0x3a')]=qs['sort'](_0x59f84c[_0x9759('0x30')]['sort']);_0x3e24a2[_0x9759('0x3b')]=qs['filters'](_[_0x9759('0x3c')](_0x59f84c[_0x9759('0x30')],_0x3f8153[_0x9759('0x31')]),_0x178a1d);if(_0x59f84c[_0x9759('0x30')]['filter']){_0x3e24a2[_0x9759('0x3b')]=_[_0x9759('0x3d')](_0x3e24a2[_0x9759('0x3b')],{'$or':_[_0x9759('0x2b')](_0x178a1d,function(_0x561f2c){if(_0x561f2c[_0x9759('0x2e')]!==_0x9759('0x3e')){var _0x5ade40={};_0x5ade40[_0x561f2c[_0x9759('0x29')]]={'$like':'%'+_0x59f84c[_0x9759('0x30')][_0x9759('0x3f')]+'%'};return _0x5ade40;}})});}_0x3e24a2=_[_0x9759('0x3d')]({},_0x3e24a2,_0x59f84c[_0x9759('0x40')]);var _0x19dc98={'where':_0x3e24a2[_0x9759('0x3b')]};return db[_0x9759('0x2c')][_0x9759('0x21')](_0x19dc98)[_0x9759('0x26')](function(_0xbd6716){_0x44b076[_0x9759('0x21')]=_0xbd6716;if(_0x59f84c[_0x9759('0x30')][_0x9759('0x41')]){_0x3e24a2[_0x9759('0x42')]=[{'all':!![]}];}return db[_0x9759('0x2c')][_0x9759('0x43')](_0x3e24a2);})['then'](function(_0xec61bb){_0x44b076[_0x9759('0x44')]=_0xec61bb;return _0x44b076;})['then'](respondWithFilteredResult(_0x3042af,_0x3e24a2))[_0x9759('0x45')](handleError(_0x3042af,null));};exports[_0x9759('0x46')]=function(_0x4fb7fc,_0x19df61){var _0x358bab={'raw':!![],'where':{'id':_0x4fb7fc[_0x9759('0x47')]['id']}},_0xcaa87f={};_0xcaa87f['model']=_[_0x9759('0x48')](db['ZohoField'][_0x9759('0x2d')]);_0xcaa87f[_0x9759('0x30')]=_[_0x9759('0x48')](_0x4fb7fc[_0x9759('0x30')]);_0xcaa87f['filters']=_[_0x9759('0x32')](_0xcaa87f['model'],_0xcaa87f[_0x9759('0x30')]);_0x358bab[_0x9759('0x34')]=_[_0x9759('0x32')](_0xcaa87f[_0x9759('0x33')],qs[_0x9759('0x35')](_0x4fb7fc[_0x9759('0x30')][_0x9759('0x35')]));_0x358bab[_0x9759('0x34')]=_0x358bab[_0x9759('0x34')][_0x9759('0x36')]?_0x358bab[_0x9759('0x34')]:_0xcaa87f['model'];if(_0x4fb7fc[_0x9759('0x30')][_0x9759('0x41')]){_0x358bab[_0x9759('0x42')]=[{'all':!![]}];}_0x358bab=_[_0x9759('0x3d')]({},_0x358bab,_0x4fb7fc[_0x9759('0x40')]);return db['ZohoField'][_0x9759('0x49')](_0x358bab)[_0x9759('0x26')](handleEntityNotFound(_0x19df61,null))[_0x9759('0x26')](respondWithResult(_0x19df61,null))['catch'](handleError(_0x19df61,null));};exports['create']=function(_0x45c141,_0xa74d82){return db[_0x9759('0x2c')][_0x9759('0x4a')](_0x45c141[_0x9759('0x4b')],{})[_0x9759('0x26')](respondWithResult(_0xa74d82,0xc9))[_0x9759('0x45')](handleError(_0xa74d82,null));};exports['update']=function(_0xd1040a,_0x1267fa){if(_0xd1040a[_0x9759('0x4b')]['id']){delete _0xd1040a['body']['id'];}return db['ZohoField'][_0x9759('0x49')]({'where':{'id':_0xd1040a[_0x9759('0x47')]['id']}})['then'](handleEntityNotFound(_0x1267fa,null))[_0x9759('0x26')](saveUpdates(_0xd1040a[_0x9759('0x4b')],null))[_0x9759('0x26')](respondWithResult(_0x1267fa,null))[_0x9759('0x45')](handleError(_0x1267fa,null));};exports[_0x9759('0x27')]=function(_0x3a7aaf,_0x1b5e20){return db[_0x9759('0x2c')][_0x9759('0x49')]({'where':{'id':_0x3a7aaf[_0x9759('0x47')]['id']}})[_0x9759('0x26')](handleEntityNotFound(_0x1b5e20,null))[_0x9759('0x26')](removeEntity(_0x1b5e20,null))[_0x9759('0x45')](handleError(_0x1b5e20,null));}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.model.js b/server/api/intZohoField/intZohoField.model.js index f843419..6d84826 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 _0xb091=['./intZohoField.attributes','define','int_zoho_fields','zoho_unique_index','idField','FieldId','util','../../config/logger','api','moment','request-promise','../../config/environment'];(function(_0x4052c0,_0x4271ab){var _0x296f04=function(_0x5373fc){while(--_0x5373fc){_0x4052c0['push'](_0x4052c0['shift']());}};_0x296f04(++_0x4271ab);}(_0xb091,0x16e));var _0x1b09=function(_0x556556,_0x142e91){_0x556556=_0x556556-0x0;var _0x2f83fb=_0xb091[_0x556556];return _0x2f83fb;};'use strict';var _=require('lodash');var util=require(_0x1b09('0x0'));var logger=require(_0x1b09('0x1'))(_0x1b09('0x2'));var moment=require(_0x1b09('0x3'));var BPromise=require('bluebird');var rp=require(_0x1b09('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x1b09('0x5'));var attributes=require(_0x1b09('0x6'));module['exports']=function(_0xda8caa,_0x5fa348){return _0xda8caa[_0x1b09('0x7')]('ZohoField',attributes,{'tableName':_0x1b09('0x8'),'paranoid':![],'indexes':[{'name':_0x1b09('0x9'),'fields':[_0x1b09('0xa'),_0x1b09('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1893=['rimraf','./intZohoField.attributes','exports','define','ZohoField','int_zoho_fields','zoho_unique_index','FieldId','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x5473da,_0x49396c){var _0x3b0928=function(_0x556ba7){while(--_0x556ba7){_0x5473da['push'](_0x5473da['shift']());}};_0x3b0928(++_0x49396c);}(_0x1893,0xa2));var _0x3189=function(_0x2a98e3,_0x488997){_0x2a98e3=_0x2a98e3-0x0;var _0x370a71=_0x1893[_0x2a98e3];return _0x370a71;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3189('0x0'))(_0x3189('0x1'));var moment=require(_0x3189('0x2'));var BPromise=require(_0x3189('0x3'));var rp=require(_0x3189('0x4'));var fs=require('fs');var path=require(_0x3189('0x5'));var rimraf=require(_0x3189('0x6'));var config=require('../../config/environment');var attributes=require(_0x3189('0x7'));module[_0x3189('0x8')]=function(_0x2333e6,_0x4080a9){return _0x2333e6[_0x3189('0x9')](_0x3189('0xa'),attributes,{'tableName':_0x3189('0xb'),'paranoid':![],'indexes':[{'name':_0x3189('0xc'),'fields':['idField',_0x3189('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.rpc.js b/server/api/intZohoField/intZohoField.rpc.js index f0f0446..79951b4 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 _0x955c=['result','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','then','info','ZohoField,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message'];(function(_0x543084,_0x4337f5){var _0x306a57=function(_0x2769ed){while(--_0x2769ed){_0x543084['push'](_0x543084['shift']());}};_0x306a57(++_0x4337f5);}(_0x955c,0x86));var _0xc955=function(_0xeee4b8,_0xe4e535){_0xeee4b8=_0xeee4b8-0x0;var _0x47609d=_0x955c[_0xeee4b8];return _0x47609d;};'use strict';var _=require('lodash');var util=require(_0xc955('0x0'));var moment=require('moment');var BPromise=require(_0xc955('0x1'));var rs=require(_0xc955('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc955('0x3'))['db'];var utils=require(_0xc955('0x4'));var logger=require(_0xc955('0x5'))('rpc');var config=require(_0xc955('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xc955('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x109078,_0x25f593,_0x23e9fe){return new BPromise(function(_0x491c69,_0x4bf6f3){return client[_0xc955('0x8')](_0x109078,_0x23e9fe)[_0xc955('0x9')](function(_0x598341){logger[_0xc955('0xa')](_0xc955('0xb'),_0x25f593,'request\x20sent');logger[_0xc955('0xc')]('ZohoField,\x20%s,\x20%s,\x20%s',_0x25f593,_0xc955('0xd'),JSON[_0xc955('0xe')](_0x598341));if(_0x598341[_0xc955('0xf')]){if(_0x598341[_0xc955('0xf')][_0xc955('0x10')]===0x1f4){logger[_0xc955('0xf')](_0xc955('0xb'),_0x25f593,_0x598341['error'][_0xc955('0x11')]);return _0x4bf6f3(_0x598341[_0xc955('0xf')][_0xc955('0x11')]);}logger['error'](_0xc955('0xb'),_0x25f593,_0x598341['error'][_0xc955('0x11')]);return _0x491c69(_0x598341['error'][_0xc955('0x11')]);}else{logger[_0xc955('0xa')]('ZohoField,\x20%s,\x20%s',_0x25f593,'request\x20sent');_0x491c69(_0x598341[_0xc955('0x12')][_0xc955('0x11')]);}})['catch'](function(_0x12b918){logger[_0xc955('0xf')](_0xc955('0xb'),_0x25f593,_0x12b918);_0x4bf6f3(_0x12b918);});});} \ No newline at end of file +var _0xa177=['catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','request\x20sent','ZohoField,\x20%s,\x20%s,\x20%s','stringify','error','code','ZohoField,\x20%s,\x20%s','message'];(function(_0xde13d8,_0x113262){var _0xe71924=function(_0x32ce0a){while(--_0x32ce0a){_0xde13d8['push'](_0xde13d8['shift']());}};_0xe71924(++_0x113262);}(_0xa177,0xe8));var _0x7a17=function(_0x4203a7,_0x1da276){_0x4203a7=_0x4203a7-0x0;var _0x4413a3=_0xa177[_0x4203a7];return _0x4413a3;};'use strict';var _=require(_0x7a17('0x0'));var util=require(_0x7a17('0x1'));var moment=require('moment');var BPromise=require(_0x7a17('0x2'));var rs=require(_0x7a17('0x3'));var fs=require('fs');var Redis=require(_0x7a17('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x7a17('0x5'));var logger=require(_0x7a17('0x6'))(_0x7a17('0x7'));var config=require(_0x7a17('0x8'));var jayson=require(_0x7a17('0x9'));var client=jayson[_0x7a17('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0xf67767,_0x5b49ad,_0x513c92){return new BPromise(function(_0x2dda82,_0x3a443c){return client[_0x7a17('0xb')](_0xf67767,_0x513c92)['then'](function(_0x2e0ecf){logger[_0x7a17('0xc')]('ZohoField,\x20%s,\x20%s',_0x5b49ad,_0x7a17('0xd'));logger['debug'](_0x7a17('0xe'),_0x5b49ad,_0x7a17('0xd'),JSON[_0x7a17('0xf')](_0x2e0ecf));if(_0x2e0ecf[_0x7a17('0x10')]){if(_0x2e0ecf[_0x7a17('0x10')][_0x7a17('0x11')]===0x1f4){logger['error'](_0x7a17('0x12'),_0x5b49ad,_0x2e0ecf[_0x7a17('0x10')]['message']);return _0x3a443c(_0x2e0ecf['error']['message']);}logger[_0x7a17('0x10')](_0x7a17('0x12'),_0x5b49ad,_0x2e0ecf[_0x7a17('0x10')][_0x7a17('0x13')]);return _0x2dda82(_0x2e0ecf[_0x7a17('0x10')][_0x7a17('0x13')]);}else{logger[_0x7a17('0xc')](_0x7a17('0x12'),_0x5b49ad,_0x7a17('0xd'));_0x2dda82(_0x2e0ecf['result']['message']);}})[_0x7a17('0x14')](function(_0x4d9e08){logger[_0x7a17('0x10')]('ZohoField,\x20%s,\x20%s',_0x5b49ad,_0x4d9e08);_0x3a443c(_0x4d9e08);});});} \ No newline at end of file diff --git a/server/api/integration/index.js b/server/api/integration/index.js index 8c71bba..15c3660 100644 --- a/server/api/integration/index.js +++ b/server/api/integration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x5dfa29,_0x7efcaf){var _0x43d944=function(_0x243932){while(--_0x243932){_0x5dfa29['push'](_0x5dfa29['shift']());}};_0x43d944(++_0x7efcaf);}(_0xe706,0xa3));var _0x6e70=function(_0x33501f,_0x2cae5){_0x33501f=_0x33501f-0x0;var _0x3e3713=_0xe706[_0x33501f];return _0x3e3713;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file +var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x36ca6e,_0x1bcabc){var _0x1e774c=function(_0x59930b){while(--_0x59930b){_0x36ca6e['push'](_0x36ca6e['shift']());}};_0x1e774c(++_0x1bcabc);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file diff --git a/server/api/integration/integration.attributes.js b/server/api/integration/integration.attributes.js index 4832a70..007ad8b 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 _0xfc47=['INTEGER','BOOLEAN','state','sequelize','STRING','unique_name_and_version','app.js'];(function(_0x4bb3a3,_0x1fdc7f){var _0x31e780=function(_0x3d6a0d){while(--_0x3d6a0d){_0x4bb3a3['push'](_0x4bb3a3['shift']());}};_0x31e780(++_0x1fdc7f);}(_0xfc47,0x192));var _0x7fc4=function(_0x4cfc1d,_0x2c0927){_0x4cfc1d=_0x4cfc1d-0x0;var _0x1c01a0=_0xfc47[_0x4cfc1d];return _0x1c01a0;};'use strict';var Sequelize=require(_0x7fc4('0x0'));module['exports']={'name':{'type':Sequelize[_0x7fc4('0x1')],'allowNull':![],'unique':_0x7fc4('0x2')},'version':{'type':Sequelize[_0x7fc4('0x1')],'allowNull':![],'unique':'unique_name_and_version'},'main':{'type':Sequelize[_0x7fc4('0x1')],'defaultValue':_0x7fc4('0x3')},'filename':{'type':Sequelize[_0x7fc4('0x1')]},'path':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x7fc4('0x1')]},'size':{'type':Sequelize[_0x7fc4('0x4')]},'active':{'type':Sequelize[_0x7fc4('0x5')],'defaultValue':![]},'author':{'type':Sequelize[_0x7fc4('0x1')]},'logo':{'type':Sequelize['STRING']},'state':{'type':Sequelize[_0x7fc4('0x1')],'unique':_0x7fc4('0x6')},'description':{'type':Sequelize['STRING']},'title':{'type':Sequelize[_0x7fc4('0x1')]},'remoteUri':{'type':Sequelize[_0x7fc4('0x1')]},'link':{'type':Sequelize['STRING'],'defaultValue':'#'}}; \ No newline at end of file +var _0xa699=['INTEGER','BOOLEAN','state','sequelize','exports','STRING','unique_name_and_version','app.js'];(function(_0x1edaa4,_0x7d9b0d){var _0x343826=function(_0x316583){while(--_0x316583){_0x1edaa4['push'](_0x1edaa4['shift']());}};_0x343826(++_0x7d9b0d);}(_0xa699,0x6b));var _0x9a69=function(_0x2d4065,_0x38dc95){_0x2d4065=_0x2d4065-0x0;var _0xef6016=_0xa699[_0x2d4065];return _0xef6016;};'use strict';var Sequelize=require(_0x9a69('0x0'));module[_0x9a69('0x1')]={'name':{'type':Sequelize[_0x9a69('0x2')],'allowNull':![],'unique':_0x9a69('0x3')},'version':{'type':Sequelize[_0x9a69('0x2')],'allowNull':![],'unique':_0x9a69('0x3')},'main':{'type':Sequelize[_0x9a69('0x2')],'defaultValue':_0x9a69('0x4')},'filename':{'type':Sequelize[_0x9a69('0x2')]},'path':{'type':Sequelize[_0x9a69('0x2')]},'type':{'type':Sequelize[_0x9a69('0x2')]},'size':{'type':Sequelize[_0x9a69('0x5')]},'active':{'type':Sequelize[_0x9a69('0x6')],'defaultValue':![]},'author':{'type':Sequelize['STRING']},'logo':{'type':Sequelize[_0x9a69('0x2')]},'state':{'type':Sequelize[_0x9a69('0x2')],'unique':_0x9a69('0x7')},'description':{'type':Sequelize[_0x9a69('0x2')]},'title':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x9a69('0x2')]},'link':{'type':Sequelize[_0x9a69('0x2')],'defaultValue':'#'}}; \ No newline at end of file diff --git a/server/api/integration/integration.controller.js b/server/api/integration/integration.controller.js index 2bc3b08..301b3e1 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 _0x9536=['includeAll','include','findAll','rows','catch','params','rawAttributes','intersection','length','options','find','body','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','update','error','stack','name','index','map','Integration','fieldName','model','query','keys','filters','fields','attributes','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','then'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9536,0x179));var _0x6953=function(_0x3ec122,_0x55150a){_0x3ec122=_0x3ec122-0x0;var _0x4ecf41=_0x9536[_0x3ec122];return _0x4ecf41;};'use strict';var emlformat=require(_0x6953('0x0'));var rimraf=require(_0x6953('0x1'));var zipdir=require(_0x6953('0x2'));var jsonpatch=require(_0x6953('0x3'));var rp=require('request-promise');var moment=require(_0x6953('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x6953('0x5'));var util=require(_0x6953('0x6'));var path=require(_0x6953('0x7'));var sox=require(_0x6953('0x8'));var csv=require(_0x6953('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6953('0xa'));var _=require(_0x6953('0xb'));var squel=require(_0x6953('0xc'));var crypto=require(_0x6953('0xd'));var jsforce=require(_0x6953('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x6953('0x9'));var querystring=require(_0x6953('0xf'));var Papa=require(_0x6953('0x10'));var Redis=require('ioredis');var authService=require(_0x6953('0x11'));var qs=require(_0x6953('0x12'));var as=require(_0x6953('0x13'));var hardwareService=require(_0x6953('0x14'));var logger=require(_0x6953('0x15'))(_0x6953('0x16'));var utils=require(_0x6953('0x17'));var config=require(_0x6953('0x18'));var licenseUtil=require(_0x6953('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x358388,_0x513dd0){_0x513dd0=_0x513dd0||0xcc;return function(_0x8de91e){if(_0x8de91e){return _0x358388[_0x6953('0x1a')](_0x513dd0);}return _0x358388[_0x6953('0x1b')](_0x513dd0)[_0x6953('0x1c')]();};}function respondWithResult(_0x1b5221,_0x244713){_0x244713=_0x244713||0xc8;return function(_0x175fa9){if(_0x175fa9){return _0x1b5221[_0x6953('0x1b')](_0x244713)[_0x6953('0x1d')](_0x175fa9);}};}function respondWithFilteredResult(_0x31d182,_0xae5515){return function(_0x548473){if(_0x548473){var _0x5f49db=typeof _0xae5515[_0x6953('0x1e')]===_0x6953('0x1f')&&typeof _0xae5515[_0x6953('0x20')]===_0x6953('0x1f');var _0x510d46=_0x548473[_0x6953('0x21')];var _0x2da771=_0x5f49db?0x0:_0xae5515['offset'];var _0x10858a=_0x5f49db?_0x548473[_0x6953('0x21')]:_0xae5515[_0x6953('0x1e')]+_0xae5515[_0x6953('0x20')];var _0xc714d3;if(_0x10858a>=_0x510d46){_0x10858a=_0x510d46;_0xc714d3=0xc8;}else{_0xc714d3=0xce;}_0x31d182['status'](_0xc714d3);return _0x31d182[_0x6953('0x22')](_0x6953('0x23'),_0x2da771+'-'+_0x10858a+'/'+_0x510d46)[_0x6953('0x1d')](_0x548473);}return null;};}function patchUpdates(_0x2ba433){return function(_0x41f021){try{jsonpatch['apply'](_0x41f021,_0x2ba433,!![]);}catch(_0xf96d07){return BPromise[_0x6953('0x24')](_0xf96d07);}return _0x41f021['save']();};}function saveUpdates(_0x317979,_0x40c9d1){return function(_0xb92529){if(_0xb92529){return _0xb92529[_0x6953('0x25')](_0x317979)['then'](function(_0x37f339){return _0x37f339;});}return null;};}function removeEntity(_0x231cb2,_0x2a7f6a){return function(_0x508ea7){if(_0x508ea7){return _0x508ea7['destroy']()['then'](function(){_0x231cb2[_0x6953('0x1b')](0xcc)[_0x6953('0x1c')]();});}};}function handleEntityNotFound(_0x550be4,_0x1a32f4){return function(_0x587df0){if(!_0x587df0){_0x550be4[_0x6953('0x1a')](0x194);}return _0x587df0;};}function handleError(_0x2bf39b,_0xcdbce8){_0xcdbce8=_0xcdbce8||0x1f4;return function(_0x2cc01e){logger[_0x6953('0x26')](_0x2cc01e[_0x6953('0x27')]);if(_0x2cc01e['name']){delete _0x2cc01e[_0x6953('0x28')];}_0x2bf39b[_0x6953('0x1b')](_0xcdbce8)['send'](_0x2cc01e);};}exports[_0x6953('0x29')]=function(_0x4af39d,_0x173b3c){var _0x3b1175={},_0x426c7c={},_0x4b0325={'count':0x0,'rows':[]};var _0x131992=_[_0x6953('0x2a')](db[_0x6953('0x2b')]['rawAttributes'],function(_0x4c49fc){return{'name':_0x4c49fc[_0x6953('0x2c')],'type':_0x4c49fc['type']['key']};});_0x426c7c[_0x6953('0x2d')]=_[_0x6953('0x2a')](_0x131992,_0x6953('0x28'));_0x426c7c[_0x6953('0x2e')]=_[_0x6953('0x2f')](_0x4af39d['query']);_0x426c7c[_0x6953('0x30')]=_['intersection'](_0x426c7c[_0x6953('0x2d')],_0x426c7c[_0x6953('0x2e')]);_0x3b1175['attributes']=_['intersection'](_0x426c7c[_0x6953('0x2d')],qs[_0x6953('0x31')](_0x4af39d[_0x6953('0x2e')]['fields']));_0x3b1175[_0x6953('0x32')]=_0x3b1175['attributes']['length']?_0x3b1175['attributes']:_0x426c7c['model'];if(!_0x4af39d[_0x6953('0x2e')][_0x6953('0x33')](_0x6953('0x34'))){_0x3b1175[_0x6953('0x20')]=qs[_0x6953('0x20')](_0x4af39d[_0x6953('0x2e')]['limit']);_0x3b1175[_0x6953('0x1e')]=qs['offset'](_0x4af39d[_0x6953('0x2e')]['offset']);}_0x3b1175[_0x6953('0x35')]=qs[_0x6953('0x36')](_0x4af39d[_0x6953('0x2e')][_0x6953('0x36')]);_0x3b1175['where']=qs[_0x6953('0x30')](_[_0x6953('0x37')](_0x4af39d[_0x6953('0x2e')],_0x426c7c[_0x6953('0x30')]),_0x131992);if(_0x4af39d[_0x6953('0x2e')][_0x6953('0x38')]){_0x3b1175[_0x6953('0x39')]=_[_0x6953('0x3a')](_0x3b1175[_0x6953('0x39')],{'$or':_[_0x6953('0x2a')](_0x131992,function(_0x2d9d81){if(_0x2d9d81['type']!==_0x6953('0x3b')){var _0x3c03ab={};_0x3c03ab[_0x2d9d81[_0x6953('0x28')]]={'$like':'%'+_0x4af39d['query']['filter']+'%'};return _0x3c03ab;}})});}_0x3b1175=_[_0x6953('0x3a')]({},_0x3b1175,_0x4af39d['options']);var _0x5abaf2={'where':_0x3b1175[_0x6953('0x39')]};return db[_0x6953('0x2b')]['count'](_0x5abaf2)[_0x6953('0x3c')](function(_0x263728){_0x4b0325[_0x6953('0x21')]=_0x263728;if(_0x4af39d[_0x6953('0x2e')][_0x6953('0x3d')]){_0x3b1175[_0x6953('0x3e')]=[{'all':!![]}];}return db['Integration'][_0x6953('0x3f')](_0x3b1175);})[_0x6953('0x3c')](function(_0x30a27a){_0x4b0325[_0x6953('0x40')]=_0x30a27a;return _0x4b0325;})[_0x6953('0x3c')](respondWithFilteredResult(_0x173b3c,_0x3b1175))[_0x6953('0x41')](handleError(_0x173b3c,null));};exports['show']=function(_0x5a40de,_0xeef91a){var _0x54d7c2={'raw':![],'where':{'id':_0x5a40de[_0x6953('0x42')]['id']}},_0x588ff8={};_0x588ff8[_0x6953('0x2d')]=_[_0x6953('0x2f')](db[_0x6953('0x2b')][_0x6953('0x43')]);_0x588ff8['query']=_['keys'](_0x5a40de[_0x6953('0x2e')]);_0x588ff8[_0x6953('0x30')]=_['intersection'](_0x588ff8[_0x6953('0x2d')],_0x588ff8['query']);_0x54d7c2[_0x6953('0x32')]=_[_0x6953('0x44')](_0x588ff8[_0x6953('0x2d')],qs[_0x6953('0x31')](_0x5a40de['query'][_0x6953('0x31')]));_0x54d7c2[_0x6953('0x32')]=_0x54d7c2['attributes'][_0x6953('0x45')]?_0x54d7c2[_0x6953('0x32')]:_0x588ff8[_0x6953('0x2d')];if(_0x5a40de[_0x6953('0x2e')][_0x6953('0x3d')]){_0x54d7c2[_0x6953('0x3e')]=[{'all':!![]}];}_0x54d7c2=_[_0x6953('0x3a')]({},_0x54d7c2,_0x5a40de[_0x6953('0x46')]);return db[_0x6953('0x2b')][_0x6953('0x47')](_0x54d7c2)[_0x6953('0x3c')](handleEntityNotFound(_0xeef91a,null))['then'](respondWithResult(_0xeef91a,null))[_0x6953('0x41')](handleError(_0xeef91a,null));};exports['create']=function(_0x15c142,_0x1d5979){return db[_0x6953('0x2b')]['create'](_0x15c142[_0x6953('0x48')],{})[_0x6953('0x3c')](respondWithResult(_0x1d5979,0xc9))['catch'](handleError(_0x1d5979,null));};exports['update']=function(_0xbf5b61,_0x265b44){if(_0xbf5b61[_0x6953('0x48')]['id']){delete _0xbf5b61[_0x6953('0x48')]['id'];}return db[_0x6953('0x2b')][_0x6953('0x47')]({'where':{'id':_0xbf5b61[_0x6953('0x42')]['id']}})[_0x6953('0x3c')](handleEntityNotFound(_0x265b44,null))[_0x6953('0x3c')](saveUpdates(_0xbf5b61[_0x6953('0x48')],null))[_0x6953('0x3c')](respondWithResult(_0x265b44,null))['catch'](handleError(_0x265b44,null));};exports['destroy']=function(_0x14a7bf,_0x38e3e8){return db[_0x6953('0x2b')][_0x6953('0x47')]({'where':{'id':_0x14a7bf[_0x6953('0x42')]['id']}})[_0x6953('0x3c')](handleEntityNotFound(_0x38e3e8,null))[_0x6953('0x3c')](removeEntity(_0x38e3e8,null))[_0x6953('0x41')](handleError(_0x38e3e8,null));}; \ No newline at end of file +var _0x66fa=['../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','rawAttributes','type','key','map','query','keys','intersection','attributes','fields','length','model','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','VIRTUAL','includeAll','include','Integration','findAll','rows','catch','merge','options','find','create','body','params','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x66fa,0x117));var _0xa66f=function(_0x175035,_0x25c70f){_0x175035=_0x175035-0x0;var _0x2456f5=_0x66fa[_0x175035];return _0x2456f5;};'use strict';var emlformat=require(_0xa66f('0x0'));var rimraf=require(_0xa66f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa66f('0x2'));var rp=require(_0xa66f('0x3'));var moment=require(_0xa66f('0x4'));var BPromise=require(_0xa66f('0x5'));var Mustache=require(_0xa66f('0x6'));var util=require(_0xa66f('0x7'));var path=require(_0xa66f('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xa66f('0x9'));var fs=require('fs');var fs_extra=require(_0xa66f('0xa'));var _=require(_0xa66f('0xb'));var squel=require(_0xa66f('0xc'));var crypto=require(_0xa66f('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xa66f('0xe'));var toCsv=require('to-csv');var querystring=require(_0xa66f('0xf'));var Papa=require('papaparse');var Redis=require(_0xa66f('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa66f('0x11'));var logger=require(_0xa66f('0x12'))('api');var utils=require(_0xa66f('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xa66f('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x251189,_0x14af70){_0x14af70=_0x14af70||0xcc;return function(_0xca12f8){if(_0xca12f8){return _0x251189['sendStatus'](_0x14af70);}return _0x251189['status'](_0x14af70)[_0xa66f('0x15')]();};}function respondWithResult(_0x4e09cf,_0x528427){_0x528427=_0x528427||0xc8;return function(_0x5a7b16){if(_0x5a7b16){return _0x4e09cf[_0xa66f('0x16')](_0x528427)[_0xa66f('0x17')](_0x5a7b16);}};}function respondWithFilteredResult(_0x267129,_0x236d64){return function(_0xd348f9){if(_0xd348f9){var _0x567d4f=typeof _0x236d64['offset']===_0xa66f('0x18')&&typeof _0x236d64[_0xa66f('0x19')]===_0xa66f('0x18');var _0x403f4d=_0xd348f9['count'];var _0x1cbe64=_0x567d4f?0x0:_0x236d64['offset'];var _0x4a28d4=_0x567d4f?_0xd348f9[_0xa66f('0x1a')]:_0x236d64[_0xa66f('0x1b')]+_0x236d64[_0xa66f('0x19')];var _0x355ddc;if(_0x4a28d4>=_0x403f4d){_0x4a28d4=_0x403f4d;_0x355ddc=0xc8;}else{_0x355ddc=0xce;}_0x267129[_0xa66f('0x16')](_0x355ddc);return _0x267129[_0xa66f('0x1c')](_0xa66f('0x1d'),_0x1cbe64+'-'+_0x4a28d4+'/'+_0x403f4d)[_0xa66f('0x17')](_0xd348f9);}return null;};}function patchUpdates(_0x2033a4){return function(_0x2d9602){try{jsonpatch[_0xa66f('0x1e')](_0x2d9602,_0x2033a4,!![]);}catch(_0xbba376){return BPromise[_0xa66f('0x1f')](_0xbba376);}return _0x2d9602[_0xa66f('0x20')]();};}function saveUpdates(_0x82924d,_0x5cd613){return function(_0x27f570){if(_0x27f570){return _0x27f570[_0xa66f('0x21')](_0x82924d)[_0xa66f('0x22')](function(_0x37ee13){return _0x37ee13;});}return null;};}function removeEntity(_0x5cbd82,_0x337602){return function(_0x473822){if(_0x473822){return _0x473822[_0xa66f('0x23')]()[_0xa66f('0x22')](function(){_0x5cbd82['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xed98b9,_0x598942){return function(_0x3a3e4f){if(!_0x3a3e4f){_0xed98b9[_0xa66f('0x24')](0x194);}return _0x3a3e4f;};}function handleError(_0x384164,_0x57da7f){_0x57da7f=_0x57da7f||0x1f4;return function(_0x4683c7){logger[_0xa66f('0x25')](_0x4683c7[_0xa66f('0x26')]);if(_0x4683c7[_0xa66f('0x27')]){delete _0x4683c7[_0xa66f('0x27')];}_0x384164[_0xa66f('0x16')](_0x57da7f)[_0xa66f('0x28')](_0x4683c7);};}exports[_0xa66f('0x29')]=function(_0x20ee67,_0x117d03){var _0x45f71c={},_0x63650b={},_0x42b966={'count':0x0,'rows':[]};var _0xeeb22e=_['map'](db['Integration'][_0xa66f('0x2a')],function(_0x27ceae){return{'name':_0x27ceae['fieldName'],'type':_0x27ceae[_0xa66f('0x2b')][_0xa66f('0x2c')]};});_0x63650b['model']=_[_0xa66f('0x2d')](_0xeeb22e,_0xa66f('0x27'));_0x63650b[_0xa66f('0x2e')]=_[_0xa66f('0x2f')](_0x20ee67[_0xa66f('0x2e')]);_0x63650b['filters']=_[_0xa66f('0x30')](_0x63650b['model'],_0x63650b[_0xa66f('0x2e')]);_0x45f71c[_0xa66f('0x31')]=_[_0xa66f('0x30')](_0x63650b['model'],qs[_0xa66f('0x32')](_0x20ee67[_0xa66f('0x2e')]['fields']));_0x45f71c[_0xa66f('0x31')]=_0x45f71c[_0xa66f('0x31')][_0xa66f('0x33')]?_0x45f71c[_0xa66f('0x31')]:_0x63650b[_0xa66f('0x34')];if(!_0x20ee67[_0xa66f('0x2e')][_0xa66f('0x35')](_0xa66f('0x36'))){_0x45f71c[_0xa66f('0x19')]=qs[_0xa66f('0x19')](_0x20ee67['query'][_0xa66f('0x19')]);_0x45f71c['offset']=qs[_0xa66f('0x1b')](_0x20ee67[_0xa66f('0x2e')][_0xa66f('0x1b')]);}_0x45f71c[_0xa66f('0x37')]=qs[_0xa66f('0x38')](_0x20ee67[_0xa66f('0x2e')][_0xa66f('0x38')]);_0x45f71c[_0xa66f('0x39')]=qs['filters'](_[_0xa66f('0x3a')](_0x20ee67['query'],_0x63650b[_0xa66f('0x3b')]),_0xeeb22e);if(_0x20ee67[_0xa66f('0x2e')][_0xa66f('0x3c')]){_0x45f71c['where']=_['merge'](_0x45f71c[_0xa66f('0x39')],{'$or':_[_0xa66f('0x2d')](_0xeeb22e,function(_0x20b07e){if(_0x20b07e[_0xa66f('0x2b')]!==_0xa66f('0x3d')){var _0x581dca={};_0x581dca[_0x20b07e['name']]={'$like':'%'+_0x20ee67['query'][_0xa66f('0x3c')]+'%'};return _0x581dca;}})});}_0x45f71c=_['merge']({},_0x45f71c,_0x20ee67['options']);var _0x5bf856={'where':_0x45f71c[_0xa66f('0x39')]};return db['Integration'][_0xa66f('0x1a')](_0x5bf856)[_0xa66f('0x22')](function(_0x23a546){_0x42b966[_0xa66f('0x1a')]=_0x23a546;if(_0x20ee67[_0xa66f('0x2e')][_0xa66f('0x3e')]){_0x45f71c[_0xa66f('0x3f')]=[{'all':!![]}];}return db[_0xa66f('0x40')][_0xa66f('0x41')](_0x45f71c);})[_0xa66f('0x22')](function(_0x3a7929){_0x42b966[_0xa66f('0x42')]=_0x3a7929;return _0x42b966;})[_0xa66f('0x22')](respondWithFilteredResult(_0x117d03,_0x45f71c))[_0xa66f('0x43')](handleError(_0x117d03,null));};exports['show']=function(_0x36037c,_0x25c2cb){var _0x58c1f2={'raw':![],'where':{'id':_0x36037c['params']['id']}},_0x248587={};_0x248587[_0xa66f('0x34')]=_[_0xa66f('0x2f')](db['Integration'][_0xa66f('0x2a')]);_0x248587[_0xa66f('0x2e')]=_[_0xa66f('0x2f')](_0x36037c['query']);_0x248587[_0xa66f('0x3b')]=_['intersection'](_0x248587[_0xa66f('0x34')],_0x248587[_0xa66f('0x2e')]);_0x58c1f2[_0xa66f('0x31')]=_[_0xa66f('0x30')](_0x248587[_0xa66f('0x34')],qs[_0xa66f('0x32')](_0x36037c[_0xa66f('0x2e')]['fields']));_0x58c1f2[_0xa66f('0x31')]=_0x58c1f2[_0xa66f('0x31')][_0xa66f('0x33')]?_0x58c1f2[_0xa66f('0x31')]:_0x248587[_0xa66f('0x34')];if(_0x36037c['query']['includeAll']){_0x58c1f2[_0xa66f('0x3f')]=[{'all':!![]}];}_0x58c1f2=_[_0xa66f('0x44')]({},_0x58c1f2,_0x36037c[_0xa66f('0x45')]);return db[_0xa66f('0x40')][_0xa66f('0x46')](_0x58c1f2)[_0xa66f('0x22')](handleEntityNotFound(_0x25c2cb,null))['then'](respondWithResult(_0x25c2cb,null))[_0xa66f('0x43')](handleError(_0x25c2cb,null));};exports[_0xa66f('0x47')]=function(_0x3f9cdd,_0x5651e9){return db['Integration'][_0xa66f('0x47')](_0x3f9cdd[_0xa66f('0x48')],{})[_0xa66f('0x22')](respondWithResult(_0x5651e9,0xc9))['catch'](handleError(_0x5651e9,null));};exports['update']=function(_0x52054e,_0x19e7ce){if(_0x52054e[_0xa66f('0x48')]['id']){delete _0x52054e[_0xa66f('0x48')]['id'];}return db[_0xa66f('0x40')][_0xa66f('0x46')]({'where':{'id':_0x52054e[_0xa66f('0x49')]['id']}})[_0xa66f('0x22')](handleEntityNotFound(_0x19e7ce,null))[_0xa66f('0x22')](saveUpdates(_0x52054e['body'],null))[_0xa66f('0x22')](respondWithResult(_0x19e7ce,null))[_0xa66f('0x43')](handleError(_0x19e7ce,null));};exports[_0xa66f('0x23')]=function(_0x393755,_0x11597b){return db[_0xa66f('0x40')]['find']({'where':{'id':_0x393755[_0xa66f('0x49')]['id']}})[_0xa66f('0x22')](handleEntityNotFound(_0x11597b,null))[_0xa66f('0x22')](removeEntity(_0x11597b,null))[_0xa66f('0x43')](handleError(_0x11597b,null));}; \ No newline at end of file diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index c3fe9af..631a756 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 _0x78de=['integrations','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','exports','define','Integration'];(function(_0x30b0fe,_0x542156){var _0x412d11=function(_0x39cf5d){while(--_0x39cf5d){_0x30b0fe['push'](_0x30b0fe['shift']());}};_0x412d11(++_0x542156);}(_0x78de,0x175));var _0xe78d=function(_0x2730ad,_0x4d247d){_0x2730ad=_0x2730ad-0x0;var _0x1d4363=_0x78de[_0x2730ad];return _0x1d4363;};'use strict';var _=require(_0xe78d('0x0'));var util=require(_0xe78d('0x1'));var logger=require(_0xe78d('0x2'))('api');var moment=require(_0xe78d('0x3'));var BPromise=require(_0xe78d('0x4'));var rp=require(_0xe78d('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe78d('0x6'));var config=require(_0xe78d('0x7'));var attributes=require('./integration.attributes');module[_0xe78d('0x8')]=function(_0x340386,_0x59ab93){return _0x340386[_0xe78d('0x9')](_0xe78d('0xa'),attributes,{'tableName':_0xe78d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa89c=['../../config/environment','exports','define','Integration','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x36909d,_0x2795f1){var _0x1fd29d=function(_0x27d0fa){while(--_0x27d0fa){_0x36909d['push'](_0x36909d['shift']());}};_0x1fd29d(++_0x2795f1);}(_0xa89c,0xd4));var _0xca89=function(_0x1e2138,_0x2cf8fc){_0x1e2138=_0x1e2138-0x0;var _0x12066a=_0xa89c[_0x1e2138];return _0x12066a;};'use strict';var _=require(_0xca89('0x0'));var util=require(_0xca89('0x1'));var logger=require(_0xca89('0x2'))(_0xca89('0x3'));var moment=require(_0xca89('0x4'));var BPromise=require(_0xca89('0x5'));var rp=require(_0xca89('0x6'));var fs=require('fs');var path=require(_0xca89('0x7'));var rimraf=require(_0xca89('0x8'));var config=require(_0xca89('0x9'));var attributes=require('./integration.attributes');module[_0xca89('0xa')]=function(_0x51f81d,_0x246980){return _0x51f81d[_0xca89('0xb')](_0xca89('0xc'),attributes,{'tableName':'integrations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/integration/integration.rpc.js b/server/api/integration/integration.rpc.js index 15afc14..8565c2e 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 _0x6d38=['request','then','Integration,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','util','moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http'];(function(_0x1d50c1,_0x1e8b29){var _0x129602=function(_0x35c00d){while(--_0x35c00d){_0x1d50c1['push'](_0x1d50c1['shift']());}};_0x129602(++_0x1e8b29);}(_0x6d38,0x1ef));var _0x86d3=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0x6d38[_0x13d07a];return _0x5ee0ee;};'use strict';var _=require('lodash');var util=require(_0x86d3('0x0'));var moment=require(_0x86d3('0x1'));var BPromise=require(_0x86d3('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x86d3('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x86d3('0x4'))(_0x86d3('0x5'));var config=require(_0x86d3('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x86d3('0x7')][_0x86d3('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x33d4aa,_0x2eaa15,_0x47e654){return new BPromise(function(_0x552b07,_0x2aea31){return client[_0x86d3('0x9')](_0x33d4aa,_0x47e654)[_0x86d3('0xa')](function(_0x499640){logger['info'](_0x86d3('0xb'),_0x2eaa15,_0x86d3('0xc'));logger['debug']('Integration,\x20%s,\x20%s,\x20%s',_0x2eaa15,_0x86d3('0xc'),JSON[_0x86d3('0xd')](_0x499640));if(_0x499640['error']){if(_0x499640[_0x86d3('0xe')]['code']===0x1f4){logger[_0x86d3('0xe')](_0x86d3('0xb'),_0x2eaa15,_0x499640[_0x86d3('0xe')][_0x86d3('0xf')]);return _0x2aea31(_0x499640[_0x86d3('0xe')][_0x86d3('0xf')]);}logger[_0x86d3('0xe')](_0x86d3('0xb'),_0x2eaa15,_0x499640['error'][_0x86d3('0xf')]);return _0x552b07(_0x499640[_0x86d3('0xe')][_0x86d3('0xf')]);}else{logger[_0x86d3('0x10')](_0x86d3('0xb'),_0x2eaa15,_0x86d3('0xc'));_0x552b07(_0x499640[_0x86d3('0x11')][_0x86d3('0xf')]);}})['catch'](function(_0x2d5ba9){logger[_0x86d3('0xe')](_0x86d3('0xb'),_0x2eaa15,_0x2d5ba9);_0x2aea31(_0x2d5ba9);});});} \ No newline at end of file +var _0xef0f=['lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','Integration,\x20%s,\x20%s','request\x20sent','debug','Integration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x2c5fe8,_0x39a6da){var _0x3a4c8b=function(_0x3d4e36){while(--_0x3d4e36){_0x2c5fe8['push'](_0x2c5fe8['shift']());}};_0x3a4c8b(++_0x39a6da);}(_0xef0f,0x168));var _0xfef0=function(_0x2cb240,_0x1374ba){_0x2cb240=_0x2cb240-0x0;var _0x59984d=_0xef0f[_0x2cb240];return _0x59984d;};'use strict';var _=require(_0xfef0('0x0'));var util=require('util');var moment=require(_0xfef0('0x1'));var BPromise=require(_0xfef0('0x2'));var rs=require(_0xfef0('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfef0('0x4'))['db'];var utils=require(_0xfef0('0x5'));var logger=require(_0xfef0('0x6'))('rpc');var config=require(_0xfef0('0x7'));var jayson=require(_0xfef0('0x8'));var client=jayson[_0xfef0('0x9')][_0xfef0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xad43e,_0x11dfd7,_0x5130bd){return new BPromise(function(_0x41ec94,_0x58cf6d){return client[_0xfef0('0xb')](_0xad43e,_0x5130bd)[_0xfef0('0xc')](function(_0x3a81cc){logger[_0xfef0('0xd')](_0xfef0('0xe'),_0x11dfd7,_0xfef0('0xf'));logger[_0xfef0('0x10')](_0xfef0('0x11'),_0x11dfd7,_0xfef0('0xf'),JSON[_0xfef0('0x12')](_0x3a81cc));if(_0x3a81cc[_0xfef0('0x13')]){if(_0x3a81cc[_0xfef0('0x13')][_0xfef0('0x14')]===0x1f4){logger[_0xfef0('0x13')]('Integration,\x20%s,\x20%s',_0x11dfd7,_0x3a81cc[_0xfef0('0x13')][_0xfef0('0x15')]);return _0x58cf6d(_0x3a81cc[_0xfef0('0x13')][_0xfef0('0x15')]);}logger[_0xfef0('0x13')](_0xfef0('0xe'),_0x11dfd7,_0x3a81cc[_0xfef0('0x13')]['message']);return _0x41ec94(_0x3a81cc[_0xfef0('0x13')]['message']);}else{logger['info']('Integration,\x20%s,\x20%s',_0x11dfd7,_0xfef0('0xf'));_0x41ec94(_0x3a81cc[_0xfef0('0x16')][_0xfef0('0x15')]);}})[_0xfef0('0x17')](function(_0x2a96d9){logger[_0xfef0('0x13')](_0xfef0('0xe'),_0x11dfd7,_0x2a96d9);_0x58cf6d(_0x2a96d9);});});} \ No newline at end of file diff --git a/server/api/integrationReport/index.js b/server/api/integrationReport/index.js index 6ee8ab0..c0fb45e 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 _0xdb28=['destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','show','create','put','update'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0xdb28,0x106));var _0x8db2=function(_0x2ea956,_0x4b9151){_0x2ea956=_0x2ea956-0x0;var _0x1c2eb6=_0xdb28[_0x2ea956];return _0x1c2eb6;};'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('./integrationReport.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']('/',auth[_0x8db2('0xa')](),controller[_0x8db2('0xf')]);router[_0x8db2('0x10')]('/:id',auth[_0x8db2('0xa')](),controller[_0x8db2('0x11')]);router['delete'](_0x8db2('0xd'),auth[_0x8db2('0xa')](),controller[_0x8db2('0x12')]);module[_0x8db2('0x13')]=router; \ No newline at end of file +var _0x2ef3=['express','Router','../../components/auth/service','../../components/interaction/service','./integrationReport.controller','get','/describe','isAuthenticated','describe','/:id','show','post','update','delete','exports','multer','util','path','connect-timeout'];(function(_0x5531e7,_0x503c03){var _0x466bff=function(_0x54cc5d){while(--_0x54cc5d){_0x5531e7['push'](_0x5531e7['shift']());}};_0x466bff(++_0x503c03);}(_0x2ef3,0xba));var _0x32ef=function(_0x3a925b,_0x510ca1){_0x3a925b=_0x3a925b-0x0;var _0x43c53b=_0x2ef3[_0x3a925b];return _0x43c53b;};'use strict';var multer=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var path=require(_0x32ef('0x2'));var timeout=require(_0x32ef('0x3'));var express=require(_0x32ef('0x4'));var router=express[_0x32ef('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x32ef('0x6'));var interaction=require(_0x32ef('0x7'));var config=require('../../config/environment');var controller=require(_0x32ef('0x8'));router[_0x32ef('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x32ef('0x9')](_0x32ef('0xa'),auth[_0x32ef('0xb')](),controller[_0x32ef('0xc')]);router[_0x32ef('0x9')](_0x32ef('0xd'),auth[_0x32ef('0xb')](),controller[_0x32ef('0xe')]);router[_0x32ef('0xf')]('/',auth[_0x32ef('0xb')](),controller['create']);router['put'](_0x32ef('0xd'),auth[_0x32ef('0xb')](),controller[_0x32ef('0x10')]);router[_0x32ef('0x11')]('/:id',auth[_0x32ef('0xb')](),controller['destroy']);module[_0x32ef('0x12')]=router; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.attributes.js b/server/api/integrationReport/integrationReport.attributes.js index c4e08ed..72f9494 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 _0xd5f8=['ENUM','SENT','SENDING','exports','STRING','INTEGER','DATE','BOOLEAN','TEXT'];(function(_0xfcebbb,_0x1949e5){var _0x487d29=function(_0x504b4d){while(--_0x504b4d){_0xfcebbb['push'](_0xfcebbb['shift']());}};_0x487d29(++_0x1949e5);}(_0xd5f8,0x1e9));var _0x8d5f=function(_0x43e34c,_0x3d93e5){_0x43e34c=_0x43e34c-0x0;var _0x35e8bb=_0xd5f8[_0x43e34c];return _0x35e8bb;};'use strict';var Sequelize=require('sequelize');module[_0x8d5f('0x0')]={'integration':{'type':Sequelize[_0x8d5f('0x1')]},'eventChannel':{'type':Sequelize[_0x8d5f('0x1')]},'exitStatus':{'type':Sequelize['STRING']},'ticketId':{'type':Sequelize['STRING']},'integrationId':{'type':Sequelize[_0x8d5f('0x2')]},'contacts':{'type':Sequelize[_0x8d5f('0x1')]},'uniqueid':{'type':Sequelize[_0x8d5f('0x1')]},'calleridnum':{'type':Sequelize[_0x8d5f('0x1')]},'calleridname':{'type':Sequelize[_0x8d5f('0x1')]},'queue':{'type':Sequelize[_0x8d5f('0x1')]},'interface':{'type':Sequelize[_0x8d5f('0x1')]},'membername':{'type':Sequelize[_0x8d5f('0x1')]},'agentcalledAt':{'type':Sequelize[_0x8d5f('0x3')]},'agentconnectAt':{'type':Sequelize[_0x8d5f('0x3')]},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize[_0x8d5f('0x4')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize['DATE']},'talktime':{'type':Sequelize[_0x8d5f('0x2')]},'agentacw':{'type':Sequelize[_0x8d5f('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x8d5f('0x2')]},'reason':{'type':Sequelize[_0x8d5f('0x1')]},'agentringnoanswer':{'type':Sequelize[_0x8d5f('0x4')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0x8d5f('0x3')]},'agentdump':{'type':Sequelize[_0x8d5f('0x4')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize['DATE']},'lastevent':{'type':Sequelize[_0x8d5f('0x1')]},'channel':{'type':Sequelize[_0x8d5f('0x1')]},'channelstate':{'type':Sequelize[_0x8d5f('0x2')]},'channelstatedesc':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x8d5f('0x1')]},'connectedlinename':{'type':Sequelize[_0x8d5f('0x1')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x8d5f('0x1')]},'context':{'type':Sequelize[_0x8d5f('0x1')]},'exten':{'type':Sequelize[_0x8d5f('0x1')]},'priority':{'type':Sequelize[_0x8d5f('0x1')]},'destchannel':{'type':Sequelize[_0x8d5f('0x1')]},'destchannelstate':{'type':Sequelize[_0x8d5f('0x2')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0x8d5f('0x1')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0x8d5f('0x1')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize[_0x8d5f('0x1')]},'destcontext':{'type':Sequelize[_0x8d5f('0x1')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize['STRING']},'destuniqueid':{'type':Sequelize[_0x8d5f('0x1')]},'messageId':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize[_0x8d5f('0x1')]},'subject':{'type':Sequelize[_0x8d5f('0x1')]},'from':{'type':Sequelize[_0x8d5f('0x1')]},'to':{'type':Sequelize[_0x8d5f('0x1')]},'cc':{'type':Sequelize[_0x8d5f('0x1')]},'attachment':{'type':Sequelize['TEXT']},'html':{'type':Sequelize[_0x8d5f('0x5')]},'text':{'type':Sequelize[_0x8d5f('0x5')]},'status':{'type':Sequelize[_0x8d5f('0x6')](_0x8d5f('0x7'),_0x8d5f('0x8'),'RECEIVED','FAILED')},'url':{'type':Sequelize[_0x8d5f('0x1')]},'app':{'type':Sequelize[_0x8d5f('0x1')]},'appdata':{'type':Sequelize[_0x8d5f('0x1')]},'projectId':{'type':Sequelize[_0x8d5f('0x2')]}}; \ No newline at end of file +var _0x203f=['ENUM','RECEIVED','sequelize','exports','STRING','INTEGER','DATE','BOOLEAN','TEXT'];(function(_0x110607,_0x133f1d){var _0x412a5d=function(_0x582604){while(--_0x582604){_0x110607['push'](_0x110607['shift']());}};_0x412a5d(++_0x133f1d);}(_0x203f,0xe3));var _0xf203=function(_0x55c1f0,_0x4f574f){_0x55c1f0=_0x55c1f0-0x0;var _0x1530fa=_0x203f[_0x55c1f0];return _0x1530fa;};'use strict';var Sequelize=require(_0xf203('0x0'));module[_0xf203('0x1')]={'integration':{'type':Sequelize[_0xf203('0x2')]},'eventChannel':{'type':Sequelize[_0xf203('0x2')]},'exitStatus':{'type':Sequelize[_0xf203('0x2')]},'ticketId':{'type':Sequelize[_0xf203('0x2')]},'integrationId':{'type':Sequelize[_0xf203('0x3')]},'contacts':{'type':Sequelize[_0xf203('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xf203('0x2')]},'calleridname':{'type':Sequelize[_0xf203('0x2')]},'queue':{'type':Sequelize['STRING']},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0xf203('0x2')]},'agentcalledAt':{'type':Sequelize[_0xf203('0x4')]},'agentconnectAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize[_0xf203('0x3')]},'agentcomplete':{'type':Sequelize[_0xf203('0x5')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0xf203('0x4')]},'talktime':{'type':Sequelize['INTEGER']},'agentacw':{'type':Sequelize[_0xf203('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize[_0xf203('0x2')]},'agentringnoanswer':{'type':Sequelize[_0xf203('0x5')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0xf203('0x4')]},'agentdump':{'type':Sequelize[_0xf203('0x5')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0xf203('0x4')]},'lastevent':{'type':Sequelize[_0xf203('0x2')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0xf203('0x3')]},'channelstatedesc':{'type':Sequelize[_0xf203('0x2')]},'connectedlinenum':{'type':Sequelize[_0xf203('0x2')]},'connectedlinename':{'type':Sequelize[_0xf203('0x2')]},'language':{'type':Sequelize[_0xf203('0x2')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0xf203('0x2')]},'priority':{'type':Sequelize[_0xf203('0x2')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0xf203('0x3')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0xf203('0x2')]},'destcalleridname':{'type':Sequelize[_0xf203('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0xf203('0x2')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0xf203('0x2')]},'destaccountcode':{'type':Sequelize[_0xf203('0x2')]},'destcontext':{'type':Sequelize[_0xf203('0x2')]},'destexten':{'type':Sequelize[_0xf203('0x2')]},'destpriority':{'type':Sequelize['STRING']},'destuniqueid':{'type':Sequelize[_0xf203('0x2')]},'messageId':{'type':Sequelize[_0xf203('0x2')]},'inReplyTo':{'type':Sequelize[_0xf203('0x2')]},'subject':{'type':Sequelize[_0xf203('0x2')]},'from':{'type':Sequelize[_0xf203('0x2')]},'to':{'type':Sequelize[_0xf203('0x2')]},'cc':{'type':Sequelize[_0xf203('0x2')]},'attachment':{'type':Sequelize[_0xf203('0x6')]},'html':{'type':Sequelize['TEXT']},'text':{'type':Sequelize[_0xf203('0x6')]},'status':{'type':Sequelize[_0xf203('0x7')]('SENT','SENDING',_0xf203('0x8'),'FAILED')},'url':{'type':Sequelize[_0xf203('0x2')]},'app':{'type':Sequelize[_0xf203('0x2')]},'appdata':{'type':Sequelize[_0xf203('0x2')]},'projectId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.controller.js b/server/api/integrationReport/integrationReport.controller.js index d6c6eed..300171a 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 _0x7670=['zip-dir','fast-json-patch','request-promise','moment','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','name','send','map','IntegrationReport','rawAttributes','fieldName','type','key','query','keys','intersection','attributes','model','fields','hasOwnProperty','order','sort','where','filters','merge','VIRTUAL','options','includeAll','include','catch','show','find','create','body','params','describe','eml-format'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x7670,0x8f));var _0x0767=function(_0x552c03,_0x247fab){_0x552c03=_0x552c03-0x0;var _0x25e104=_0x7670[_0x552c03];return _0x25e104;};'use strict';var emlformat=require(_0x0767('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0767('0x1'));var jsonpatch=require(_0x0767('0x2'));var rp=require(_0x0767('0x3'));var moment=require(_0x0767('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x0767('0x5'));var path=require('path');var sox=require(_0x0767('0x6'));var csv=require(_0x0767('0x7'));var ejs=require(_0x0767('0x8'));var fs=require('fs');var fs_extra=require(_0x0767('0x9'));var _=require(_0x0767('0xa'));var squel=require(_0x0767('0xb'));var crypto=require(_0x0767('0xc'));var jsforce=require(_0x0767('0xd'));var deskjs=require(_0x0767('0xe'));var toCsv=require(_0x0767('0x7'));var querystring=require(_0x0767('0xf'));var Papa=require(_0x0767('0x10'));var Redis=require(_0x0767('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x0767('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0767('0x13'));var logger=require('../../config/logger')(_0x0767('0x14'));var utils=require(_0x0767('0x15'));var config=require(_0x0767('0x16'));var licenseUtil=require(_0x0767('0x17'));var db=require(_0x0767('0x18'))['db'];function respondWithStatusCode(_0x440a2d,_0x4dbf91){_0x4dbf91=_0x4dbf91||0xcc;return function(_0x3feaf3){if(_0x3feaf3){return _0x440a2d[_0x0767('0x19')](_0x4dbf91);}return _0x440a2d[_0x0767('0x1a')](_0x4dbf91)[_0x0767('0x1b')]();};}function respondWithResult(_0x242132,_0x553a52){_0x553a52=_0x553a52||0xc8;return function(_0x544938){if(_0x544938){return _0x242132[_0x0767('0x1a')](_0x553a52)[_0x0767('0x1c')](_0x544938);}};}function respondWithFilteredResult(_0x4cd33f,_0x27850b){return function(_0x2e9615){if(_0x2e9615){var _0x3fcf8e=typeof _0x27850b[_0x0767('0x1d')]===_0x0767('0x1e')&&typeof _0x27850b['limit']===_0x0767('0x1e');var _0xb81ec3=_0x2e9615[_0x0767('0x1f')];var _0x462043=_0x3fcf8e?0x0:_0x27850b[_0x0767('0x1d')];var _0x13e943=_0x3fcf8e?_0x2e9615[_0x0767('0x1f')]:_0x27850b[_0x0767('0x1d')]+_0x27850b[_0x0767('0x20')];var _0x1c7b78;if(_0x13e943>=_0xb81ec3){_0x13e943=_0xb81ec3;_0x1c7b78=0xc8;}else{_0x1c7b78=0xce;}_0x4cd33f[_0x0767('0x1a')](_0x1c7b78);return _0x4cd33f[_0x0767('0x21')](_0x0767('0x22'),_0x462043+'-'+_0x13e943+'/'+_0xb81ec3)[_0x0767('0x1c')](_0x2e9615);}return null;};}function patchUpdates(_0x3b593f){return function(_0x49a2b7){try{jsonpatch[_0x0767('0x23')](_0x49a2b7,_0x3b593f,!![]);}catch(_0x3f037a){return BPromise[_0x0767('0x24')](_0x3f037a);}return _0x49a2b7[_0x0767('0x25')]();};}function saveUpdates(_0x71d2d5,_0xb4ca93){return function(_0x3a0990){if(_0x3a0990){return _0x3a0990[_0x0767('0x26')](_0x71d2d5)[_0x0767('0x27')](function(_0x287601){return _0x287601;});}return null;};}function removeEntity(_0x58fd4d,_0x20ef40){return function(_0x2f0faf){if(_0x2f0faf){return _0x2f0faf[_0x0767('0x28')]()[_0x0767('0x27')](function(){_0x58fd4d[_0x0767('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x59c7fc,_0x58e38e){return function(_0x2a59a8){if(!_0x2a59a8){_0x59c7fc[_0x0767('0x19')](0x194);}return _0x2a59a8;};}function handleError(_0x5ddf36,_0x487cdc){_0x487cdc=_0x487cdc||0x1f4;return function(_0x38ae13){logger['error'](_0x38ae13['stack']);if(_0x38ae13[_0x0767('0x29')]){delete _0x38ae13[_0x0767('0x29')];}_0x5ddf36['status'](_0x487cdc)[_0x0767('0x2a')](_0x38ae13);};}exports['index']=function(_0x4cc5c8,_0x9a439e){var _0x1a3be3={},_0x16a469={},_0x2d191b={'count':0x0,'rows':[]};var _0x5d8c35=_[_0x0767('0x2b')](db[_0x0767('0x2c')][_0x0767('0x2d')],function(_0x2ec38c){return{'name':_0x2ec38c[_0x0767('0x2e')],'type':_0x2ec38c[_0x0767('0x2f')][_0x0767('0x30')]};});_0x16a469['model']=_[_0x0767('0x2b')](_0x5d8c35,_0x0767('0x29'));_0x16a469[_0x0767('0x31')]=_[_0x0767('0x32')](_0x4cc5c8[_0x0767('0x31')]);_0x16a469['filters']=_[_0x0767('0x33')](_0x16a469['model'],_0x16a469[_0x0767('0x31')]);_0x1a3be3[_0x0767('0x34')]=_[_0x0767('0x33')](_0x16a469[_0x0767('0x35')],qs[_0x0767('0x36')](_0x4cc5c8[_0x0767('0x31')][_0x0767('0x36')]));_0x1a3be3[_0x0767('0x34')]=_0x1a3be3['attributes']['length']?_0x1a3be3[_0x0767('0x34')]:_0x16a469[_0x0767('0x35')];if(!_0x4cc5c8['query'][_0x0767('0x37')]('nolimit')){_0x1a3be3['limit']=qs[_0x0767('0x20')](_0x4cc5c8[_0x0767('0x31')][_0x0767('0x20')]);_0x1a3be3['offset']=qs[_0x0767('0x1d')](_0x4cc5c8['query']['offset']);}_0x1a3be3[_0x0767('0x38')]=qs[_0x0767('0x39')](_0x4cc5c8[_0x0767('0x31')][_0x0767('0x39')]);_0x1a3be3[_0x0767('0x3a')]=qs[_0x0767('0x3b')](_['pick'](_0x4cc5c8['query'],_0x16a469[_0x0767('0x3b')]),_0x5d8c35);if(_0x4cc5c8[_0x0767('0x31')]['filter']){_0x1a3be3[_0x0767('0x3a')]=_[_0x0767('0x3c')](_0x1a3be3[_0x0767('0x3a')],{'$or':_[_0x0767('0x2b')](_0x5d8c35,function(_0x28b5fa){if(_0x28b5fa['type']!==_0x0767('0x3d')){var _0x2e9063={};_0x2e9063[_0x28b5fa['name']]={'$like':'%'+_0x4cc5c8[_0x0767('0x31')]['filter']+'%'};return _0x2e9063;}})});}_0x1a3be3=_[_0x0767('0x3c')]({},_0x1a3be3,_0x4cc5c8[_0x0767('0x3e')]);var _0x492195={'where':_0x1a3be3[_0x0767('0x3a')]};return db[_0x0767('0x2c')]['count'](_0x492195)[_0x0767('0x27')](function(_0x4a5606){_0x2d191b[_0x0767('0x1f')]=_0x4a5606;if(_0x4cc5c8[_0x0767('0x31')][_0x0767('0x3f')]){_0x1a3be3[_0x0767('0x40')]=[{'all':!![]}];}return db[_0x0767('0x2c')]['findAll'](_0x1a3be3);})[_0x0767('0x27')](function(_0xb9ba97){_0x2d191b['rows']=_0xb9ba97;return _0x2d191b;})[_0x0767('0x27')](respondWithFilteredResult(_0x9a439e,_0x1a3be3))[_0x0767('0x41')](handleError(_0x9a439e,null));};exports[_0x0767('0x42')]=function(_0x4497ff,_0x1254f0){var _0x25a053={'raw':![],'where':{'id':_0x4497ff['params']['id']}},_0x1b2505={};_0x1b2505[_0x0767('0x35')]=_[_0x0767('0x32')](db['IntegrationReport'][_0x0767('0x2d')]);_0x1b2505[_0x0767('0x31')]=_[_0x0767('0x32')](_0x4497ff[_0x0767('0x31')]);_0x1b2505[_0x0767('0x3b')]=_[_0x0767('0x33')](_0x1b2505[_0x0767('0x35')],_0x1b2505['query']);_0x25a053[_0x0767('0x34')]=_['intersection'](_0x1b2505[_0x0767('0x35')],qs['fields'](_0x4497ff[_0x0767('0x31')][_0x0767('0x36')]));_0x25a053[_0x0767('0x34')]=_0x25a053[_0x0767('0x34')]['length']?_0x25a053[_0x0767('0x34')]:_0x1b2505['model'];if(_0x4497ff[_0x0767('0x31')][_0x0767('0x3f')]){_0x25a053[_0x0767('0x40')]=[{'all':!![]}];}_0x25a053=_['merge']({},_0x25a053,_0x4497ff[_0x0767('0x3e')]);return db[_0x0767('0x2c')][_0x0767('0x43')](_0x25a053)[_0x0767('0x27')](handleEntityNotFound(_0x1254f0,null))[_0x0767('0x27')](respondWithResult(_0x1254f0,null))[_0x0767('0x41')](handleError(_0x1254f0,null));};exports[_0x0767('0x44')]=function(_0xe36419,_0x49eab2){return db[_0x0767('0x2c')][_0x0767('0x44')](_0xe36419[_0x0767('0x45')],{})[_0x0767('0x27')](respondWithResult(_0x49eab2,0xc9))[_0x0767('0x41')](handleError(_0x49eab2,null));};exports[_0x0767('0x26')]=function(_0x7d4d51,_0x5e8855){if(_0x7d4d51[_0x0767('0x45')]['id']){delete _0x7d4d51[_0x0767('0x45')]['id'];}return db[_0x0767('0x2c')]['find']({'where':{'id':_0x7d4d51[_0x0767('0x46')]['id']}})['then'](handleEntityNotFound(_0x5e8855,null))[_0x0767('0x27')](saveUpdates(_0x7d4d51['body'],null))[_0x0767('0x27')](respondWithResult(_0x5e8855,null))[_0x0767('0x41')](handleError(_0x5e8855,null));};exports[_0x0767('0x28')]=function(_0x4418cb,_0x30e2d5){return db[_0x0767('0x2c')][_0x0767('0x43')]({'where':{'id':_0x4418cb[_0x0767('0x46')]['id']}})[_0x0767('0x27')](handleEntityNotFound(_0x30e2d5,null))['then'](removeEntity(_0x30e2d5,null))[_0x0767('0x41')](handleError(_0x30e2d5,null));};exports[_0x0767('0x47')]=function(_0x1a45b0,_0x460ba7){return db['IntegrationReport'][_0x0767('0x47')]()['then'](respondWithResult(_0x460ba7,null))[_0x0767('0x41')](handleError(_0x460ba7,null));}; \ No newline at end of file +var _0x8739=['crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','apply','reject','save','update','then','destroy','error','name','send','index','IntegrationReport','fieldName','type','model','map','query','keys','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','options','includeAll','include','rows','show','params','rawAttributes','catch','create','body','find','describe','eml-format','zip-dir','fast-json-patch','request-promise','mustache','sox','to-csv','ejs','fs-extra','lodash','squel'];(function(_0x153644,_0xd1dd25){var _0x1f2da6=function(_0xc7447f){while(--_0xc7447f){_0x153644['push'](_0x153644['shift']());}};_0x1f2da6(++_0xd1dd25);}(_0x8739,0x1f4));var _0x9873=function(_0x9e678b,_0x56cab9){_0x9e678b=_0x9e678b-0x0;var _0x57774d=_0x8739[_0x9e678b];return _0x57774d;};'use strict';var emlformat=require(_0x9873('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9873('0x1'));var jsonpatch=require(_0x9873('0x2'));var rp=require(_0x9873('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x9873('0x4'));var util=require('util');var path=require('path');var sox=require(_0x9873('0x5'));var csv=require(_0x9873('0x6'));var ejs=require(_0x9873('0x7'));var fs=require('fs');var fs_extra=require(_0x9873('0x8'));var _=require(_0x9873('0x9'));var squel=require(_0x9873('0xa'));var crypto=require(_0x9873('0xb'));var jsforce=require(_0x9873('0xc'));var deskjs=require(_0x9873('0xd'));var toCsv=require(_0x9873('0x6'));var querystring=require(_0x9873('0xe'));var Papa=require('papaparse');var Redis=require(_0x9873('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x9873('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9873('0x11'));var logger=require(_0x9873('0x12'))(_0x9873('0x13'));var utils=require(_0x9873('0x14'));var config=require(_0x9873('0x15'));var licenseUtil=require(_0x9873('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x87197c,_0x2584f8){_0x2584f8=_0x2584f8||0xcc;return function(_0x2784f2){if(_0x2784f2){return _0x87197c[_0x9873('0x17')](_0x2584f8);}return _0x87197c[_0x9873('0x18')](_0x2584f8)[_0x9873('0x19')]();};}function respondWithResult(_0x8ddcc1,_0x165bd5){_0x165bd5=_0x165bd5||0xc8;return function(_0x144d59){if(_0x144d59){return _0x8ddcc1[_0x9873('0x18')](_0x165bd5)[_0x9873('0x1a')](_0x144d59);}};}function respondWithFilteredResult(_0x3770c4,_0x30d70f){return function(_0x57ed93){if(_0x57ed93){var _0x3f870b=typeof _0x30d70f[_0x9873('0x1b')]==='undefined'&&typeof _0x30d70f[_0x9873('0x1c')]===_0x9873('0x1d');var _0x16bdfe=_0x57ed93['count'];var _0x541af3=_0x3f870b?0x0:_0x30d70f[_0x9873('0x1b')];var _0x585330=_0x3f870b?_0x57ed93[_0x9873('0x1e')]:_0x30d70f['offset']+_0x30d70f[_0x9873('0x1c')];var _0x1cc7f7;if(_0x585330>=_0x16bdfe){_0x585330=_0x16bdfe;_0x1cc7f7=0xc8;}else{_0x1cc7f7=0xce;}_0x3770c4[_0x9873('0x18')](_0x1cc7f7);return _0x3770c4['set'](_0x9873('0x1f'),_0x541af3+'-'+_0x585330+'/'+_0x16bdfe)['json'](_0x57ed93);}return null;};}function patchUpdates(_0x32c2f7){return function(_0x961453){try{jsonpatch[_0x9873('0x20')](_0x961453,_0x32c2f7,!![]);}catch(_0x50de2b){return BPromise[_0x9873('0x21')](_0x50de2b);}return _0x961453[_0x9873('0x22')]();};}function saveUpdates(_0x5ef70a,_0x39e081){return function(_0x1944b8){if(_0x1944b8){return _0x1944b8[_0x9873('0x23')](_0x5ef70a)[_0x9873('0x24')](function(_0x58fd77){return _0x58fd77;});}return null;};}function removeEntity(_0x49522c,_0xe7f6d8){return function(_0x2a7aef){if(_0x2a7aef){return _0x2a7aef[_0x9873('0x25')]()[_0x9873('0x24')](function(){_0x49522c[_0x9873('0x18')](0xcc)[_0x9873('0x19')]();});}};}function handleEntityNotFound(_0x41d4df,_0x22ef54){return function(_0x45b0db){if(!_0x45b0db){_0x41d4df[_0x9873('0x17')](0x194);}return _0x45b0db;};}function handleError(_0x5874fc,_0x16eba){_0x16eba=_0x16eba||0x1f4;return function(_0x29d98){logger[_0x9873('0x26')](_0x29d98['stack']);if(_0x29d98[_0x9873('0x27')]){delete _0x29d98['name'];}_0x5874fc[_0x9873('0x18')](_0x16eba)[_0x9873('0x28')](_0x29d98);};}exports[_0x9873('0x29')]=function(_0x433f65,_0x5d4394){var _0x4de45e={},_0x3045f5={},_0x49297f={'count':0x0,'rows':[]};var _0x1a8c23=_['map'](db[_0x9873('0x2a')]['rawAttributes'],function(_0x2d64fb){return{'name':_0x2d64fb[_0x9873('0x2b')],'type':_0x2d64fb[_0x9873('0x2c')]['key']};});_0x3045f5[_0x9873('0x2d')]=_[_0x9873('0x2e')](_0x1a8c23,_0x9873('0x27'));_0x3045f5[_0x9873('0x2f')]=_[_0x9873('0x30')](_0x433f65['query']);_0x3045f5['filters']=_['intersection'](_0x3045f5['model'],_0x3045f5[_0x9873('0x2f')]);_0x4de45e[_0x9873('0x31')]=_[_0x9873('0x32')](_0x3045f5[_0x9873('0x2d')],qs[_0x9873('0x33')](_0x433f65[_0x9873('0x2f')][_0x9873('0x33')]));_0x4de45e[_0x9873('0x31')]=_0x4de45e[_0x9873('0x31')]['length']?_0x4de45e[_0x9873('0x31')]:_0x3045f5[_0x9873('0x2d')];if(!_0x433f65[_0x9873('0x2f')][_0x9873('0x34')](_0x9873('0x35'))){_0x4de45e[_0x9873('0x1c')]=qs[_0x9873('0x1c')](_0x433f65[_0x9873('0x2f')][_0x9873('0x1c')]);_0x4de45e[_0x9873('0x1b')]=qs[_0x9873('0x1b')](_0x433f65['query'][_0x9873('0x1b')]);}_0x4de45e[_0x9873('0x36')]=qs[_0x9873('0x37')](_0x433f65[_0x9873('0x2f')][_0x9873('0x37')]);_0x4de45e[_0x9873('0x38')]=qs[_0x9873('0x39')](_[_0x9873('0x3a')](_0x433f65[_0x9873('0x2f')],_0x3045f5[_0x9873('0x39')]),_0x1a8c23);if(_0x433f65[_0x9873('0x2f')][_0x9873('0x3b')]){_0x4de45e['where']=_[_0x9873('0x3c')](_0x4de45e[_0x9873('0x38')],{'$or':_[_0x9873('0x2e')](_0x1a8c23,function(_0x32d52a){if(_0x32d52a['type']!=='VIRTUAL'){var _0x42c0be={};_0x42c0be[_0x32d52a[_0x9873('0x27')]]={'$like':'%'+_0x433f65[_0x9873('0x2f')][_0x9873('0x3b')]+'%'};return _0x42c0be;}})});}_0x4de45e=_[_0x9873('0x3c')]({},_0x4de45e,_0x433f65[_0x9873('0x3d')]);var _0x570766={'where':_0x4de45e[_0x9873('0x38')]};return db[_0x9873('0x2a')][_0x9873('0x1e')](_0x570766)[_0x9873('0x24')](function(_0x166d99){_0x49297f[_0x9873('0x1e')]=_0x166d99;if(_0x433f65[_0x9873('0x2f')][_0x9873('0x3e')]){_0x4de45e[_0x9873('0x3f')]=[{'all':!![]}];}return db['IntegrationReport']['findAll'](_0x4de45e);})[_0x9873('0x24')](function(_0x1d1c74){_0x49297f[_0x9873('0x40')]=_0x1d1c74;return _0x49297f;})[_0x9873('0x24')](respondWithFilteredResult(_0x5d4394,_0x4de45e))['catch'](handleError(_0x5d4394,null));};exports[_0x9873('0x41')]=function(_0x9f2d9,_0x3d87bb){var _0x10d6b9={'raw':![],'where':{'id':_0x9f2d9[_0x9873('0x42')]['id']}},_0x1831ce={};_0x1831ce[_0x9873('0x2d')]=_['keys'](db['IntegrationReport'][_0x9873('0x43')]);_0x1831ce[_0x9873('0x2f')]=_['keys'](_0x9f2d9[_0x9873('0x2f')]);_0x1831ce['filters']=_[_0x9873('0x32')](_0x1831ce[_0x9873('0x2d')],_0x1831ce[_0x9873('0x2f')]);_0x10d6b9[_0x9873('0x31')]=_['intersection'](_0x1831ce[_0x9873('0x2d')],qs['fields'](_0x9f2d9[_0x9873('0x2f')][_0x9873('0x33')]));_0x10d6b9[_0x9873('0x31')]=_0x10d6b9[_0x9873('0x31')]['length']?_0x10d6b9[_0x9873('0x31')]:_0x1831ce[_0x9873('0x2d')];if(_0x9f2d9[_0x9873('0x2f')][_0x9873('0x3e')]){_0x10d6b9[_0x9873('0x3f')]=[{'all':!![]}];}_0x10d6b9=_['merge']({},_0x10d6b9,_0x9f2d9['options']);return db[_0x9873('0x2a')]['find'](_0x10d6b9)['then'](handleEntityNotFound(_0x3d87bb,null))['then'](respondWithResult(_0x3d87bb,null))[_0x9873('0x44')](handleError(_0x3d87bb,null));};exports[_0x9873('0x45')]=function(_0x21c735,_0x1b03b8){return db['IntegrationReport']['create'](_0x21c735[_0x9873('0x46')],{})[_0x9873('0x24')](respondWithResult(_0x1b03b8,0xc9))[_0x9873('0x44')](handleError(_0x1b03b8,null));};exports[_0x9873('0x23')]=function(_0x3ea4b1,_0x217945){if(_0x3ea4b1['body']['id']){delete _0x3ea4b1[_0x9873('0x46')]['id'];}return db[_0x9873('0x2a')][_0x9873('0x47')]({'where':{'id':_0x3ea4b1[_0x9873('0x42')]['id']}})[_0x9873('0x24')](handleEntityNotFound(_0x217945,null))['then'](saveUpdates(_0x3ea4b1[_0x9873('0x46')],null))['then'](respondWithResult(_0x217945,null))['catch'](handleError(_0x217945,null));};exports[_0x9873('0x25')]=function(_0x5034aa,_0x57742c){return db[_0x9873('0x2a')][_0x9873('0x47')]({'where':{'id':_0x5034aa[_0x9873('0x42')]['id']}})[_0x9873('0x24')](handleEntityNotFound(_0x57742c,null))[_0x9873('0x24')](removeEntity(_0x57742c,null))[_0x9873('0x44')](handleError(_0x57742c,null));};exports[_0x9873('0x48')]=function(_0x3ef7f2,_0x5853d5){return db[_0x9873('0x2a')][_0x9873('0x48')]()[_0x9873('0x24')](respondWithResult(_0x5853d5,null))[_0x9873('0x44')](handleError(_0x5853d5,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index 00cb45d..d2d103e 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 _0xd676=['report_integration','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','IntegrationReport'];(function(_0x21d584,_0x5b82c2){var _0x55ac42=function(_0x52f581){while(--_0x52f581){_0x21d584['push'](_0x21d584['shift']());}};_0x55ac42(++_0x5b82c2);}(_0xd676,0x1e1));var _0x6d67=function(_0x2b7dcf,_0x4f9a4f){_0x2b7dcf=_0x2b7dcf-0x0;var _0x448baf=_0xd676[_0x2b7dcf];return _0x448baf;};'use strict';var _=require(_0x6d67('0x0'));var util=require('util');var logger=require(_0x6d67('0x1'))('api');var moment=require(_0x6d67('0x2'));var BPromise=require(_0x6d67('0x3'));var rp=require(_0x6d67('0x4'));var fs=require('fs');var path=require(_0x6d67('0x5'));var rimraf=require(_0x6d67('0x6'));var config=require(_0x6d67('0x7'));var attributes=require('./integrationReport.attributes');module[_0x6d67('0x8')]=function(_0x5c5c2f,_0x3811f7){return _0x5c5c2f[_0x6d67('0x9')](_0x6d67('0xa'),attributes,{'tableName':_0x6d67('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0f16=['bluebird','request-promise','path','rimraf','./integrationReport.attributes','exports','define','IntegrationReport','report_integration','lodash','util','../../config/logger','api'];(function(_0xa8a9a0,_0x52208e){var _0x2ffe10=function(_0x1baeca){while(--_0x1baeca){_0xa8a9a0['push'](_0xa8a9a0['shift']());}};_0x2ffe10(++_0x52208e);}(_0x0f16,0x71));var _0x60f1=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x0f16[_0x167cc1];return _0x10bc4b;};'use strict';var _=require(_0x60f1('0x0'));var util=require(_0x60f1('0x1'));var logger=require(_0x60f1('0x2'))(_0x60f1('0x3'));var moment=require('moment');var BPromise=require(_0x60f1('0x4'));var rp=require(_0x60f1('0x5'));var fs=require('fs');var path=require(_0x60f1('0x6'));var rimraf=require(_0x60f1('0x7'));var config=require('../../config/environment');var attributes=require(_0x60f1('0x8'));module[_0x60f1('0x9')]=function(_0x41023c,_0x382677){return _0x41023c[_0x60f1('0xa')](_0x60f1('0xb'),attributes,{'tableName':_0x60f1('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.rpc.js b/server/api/integrationReport/integrationReport.rpc.js index f7db326..42879ae 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 _0xda19=['error','message','info','result','util','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','IntegrationReport,\x20%s,\x20%s','request\x20sent','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x3ce85e,_0x2b8488){var _0x4e4f12=function(_0xe252f8){while(--_0xe252f8){_0x3ce85e['push'](_0x3ce85e['shift']());}};_0x4e4f12(++_0x2b8488);}(_0xda19,0xd5));var _0x9da1=function(_0x25929f,_0x1e7561){_0x25929f=_0x25929f-0x0;var _0x2d1664=_0xda19[_0x25929f];return _0x2d1664;};'use strict';var _=require('lodash');var util=require(_0x9da1('0x0'));var moment=require(_0x9da1('0x1'));var BPromise=require('bluebird');var rs=require(_0x9da1('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9da1('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x9da1('0x4'))(_0x9da1('0x5'));var config=require(_0x9da1('0x6'));var jayson=require(_0x9da1('0x7'));var client=jayson[_0x9da1('0x8')][_0x9da1('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x23e4f7,_0x2c3cdd,_0x1c24e6){return new BPromise(function(_0x5e2d18,_0x47df89){return client['request'](_0x23e4f7,_0x1c24e6)['then'](function(_0x417312){logger['info'](_0x9da1('0xa'),_0x2c3cdd,_0x9da1('0xb'));logger[_0x9da1('0xc')](_0x9da1('0xd'),_0x2c3cdd,_0x9da1('0xb'),JSON[_0x9da1('0xe')](_0x417312));if(_0x417312[_0x9da1('0xf')]){if(_0x417312['error']['code']===0x1f4){logger[_0x9da1('0xf')]('IntegrationReport,\x20%s,\x20%s',_0x2c3cdd,_0x417312[_0x9da1('0xf')][_0x9da1('0x10')]);return _0x47df89(_0x417312[_0x9da1('0xf')][_0x9da1('0x10')]);}logger['error'](_0x9da1('0xa'),_0x2c3cdd,_0x417312['error']['message']);return _0x5e2d18(_0x417312[_0x9da1('0xf')]['message']);}else{logger[_0x9da1('0x11')](_0x9da1('0xa'),_0x2c3cdd,_0x9da1('0xb'));_0x5e2d18(_0x417312[_0x9da1('0x12')][_0x9da1('0x10')]);}})['catch'](function(_0x16f75a){logger[_0x9da1('0xf')](_0x9da1('0xa'),_0x2c3cdd,_0x16f75a);_0x47df89(_0x16f75a);});});} \ No newline at end of file +var _0x687b=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','IntegrationReport,\x20%s,\x20%s','request\x20sent','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils'];(function(_0x44ca6e,_0x5e2c91){var _0x2edab2=function(_0x3afa91){while(--_0x3afa91){_0x44ca6e['push'](_0x44ca6e['shift']());}};_0x2edab2(++_0x5e2c91);}(_0x687b,0x14a));var _0xb687=function(_0x3051d9,_0x3de423){_0x3051d9=_0x3051d9-0x0;var _0xcc0a87=_0x687b[_0x3051d9];return _0xcc0a87;};'use strict';var _=require(_0xb687('0x0'));var util=require(_0xb687('0x1'));var moment=require(_0xb687('0x2'));var BPromise=require(_0xb687('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb687('0x4'))['db'];var utils=require(_0xb687('0x5'));var logger=require(_0xb687('0x6'))(_0xb687('0x7'));var config=require(_0xb687('0x8'));var jayson=require(_0xb687('0x9'));var client=jayson[_0xb687('0xa')][_0xb687('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x47ffea,_0x27b750,_0x48942b){return new BPromise(function(_0x2aea59,_0xd40346){return client['request'](_0x47ffea,_0x48942b)[_0xb687('0xc')](function(_0x21e3ab){logger[_0xb687('0xd')](_0xb687('0xe'),_0x27b750,_0xb687('0xf'));logger[_0xb687('0x10')](_0xb687('0x11'),_0x27b750,_0xb687('0xf'),JSON[_0xb687('0x12')](_0x21e3ab));if(_0x21e3ab['error']){if(_0x21e3ab[_0xb687('0x13')][_0xb687('0x14')]===0x1f4){logger[_0xb687('0x13')](_0xb687('0xe'),_0x27b750,_0x21e3ab['error']['message']);return _0xd40346(_0x21e3ab[_0xb687('0x13')][_0xb687('0x15')]);}logger['error'](_0xb687('0xe'),_0x27b750,_0x21e3ab[_0xb687('0x13')][_0xb687('0x15')]);return _0x2aea59(_0x21e3ab[_0xb687('0x13')][_0xb687('0x15')]);}else{logger[_0xb687('0xd')](_0xb687('0xe'),_0x27b750,_0xb687('0xf'));_0x2aea59(_0x21e3ab[_0xb687('0x16')][_0xb687('0x15')]);}})[_0xb687('0x17')](function(_0x19bb29){logger['error'](_0xb687('0xe'),_0x27b750,_0x19bb29);_0xd40346(_0x19bb29);});});} \ No newline at end of file diff --git a/server/api/interval/index.js b/server/api/interval/index.js index b8f2ffe..cd0228e 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 _0x0be3=['./interval.controller','index','get','isAuthenticated','show','getIntervals','post','/:id/sub_intervals/create_many','addIntervals','put','/:id','update','delete','exports','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0x11ecea,_0xac684e){var _0x3c033b=function(_0x5926a1){while(--_0x5926a1){_0x11ecea['push'](_0x11ecea['shift']());}};_0x3c033b(++_0xac684e);}(_0x0be3,0x9a));var _0x30be=function(_0x3005d5,_0xf588c7){_0x3005d5=_0x3005d5-0x0;var _0x547c7e=_0x0be3[_0x3005d5];return _0x547c7e;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x30be('0x0'));var timeout=require(_0x30be('0x1'));var express=require(_0x30be('0x2'));var router=express['Router']();var fs_extra=require(_0x30be('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x30be('0x4'));var config=require(_0x30be('0x5'));var controller=require(_0x30be('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x30be('0x7')]);router[_0x30be('0x8')]('/:id',auth[_0x30be('0x9')](),controller[_0x30be('0xa')]);router[_0x30be('0x8')]('/:id/sub_intervals',auth[_0x30be('0x9')](),controller[_0x30be('0xb')]);router[_0x30be('0xc')]('/',auth[_0x30be('0x9')](),controller['create']);router['post']('/:id/sub_intervals',auth[_0x30be('0x9')](),controller['addInterval']);router[_0x30be('0xc')](_0x30be('0xd'),auth[_0x30be('0x9')](),controller[_0x30be('0xe')]);router[_0x30be('0xf')](_0x30be('0x10'),auth[_0x30be('0x9')](),controller[_0x30be('0x11')]);router[_0x30be('0x12')]('/:id',auth[_0x30be('0x9')](),controller['destroy']);module[_0x30be('0x13')]=router; \ No newline at end of file +var _0x5a2a=['post','create','addInterval','/:id/sub_intervals/create_many','addIntervals','put','update','delete','/:id','destroy','multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','./interval.controller','get','isAuthenticated','show','getIntervals'];(function(_0x57fcd6,_0x70b457){var _0x5b6c73=function(_0x366b6a){while(--_0x366b6a){_0x57fcd6['push'](_0x57fcd6['shift']());}};_0x5b6c73(++_0x70b457);}(_0x5a2a,0x1c3));var _0xa5a2=function(_0x5d51f8,_0x6a145d){_0x5d51f8=_0x5d51f8-0x0;var _0x1e813e=_0x5a2a[_0x5d51f8];return _0x1e813e;};'use strict';var multer=require(_0xa5a2('0x0'));var util=require(_0xa5a2('0x1'));var path=require(_0xa5a2('0x2'));var timeout=require(_0xa5a2('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xa5a2('0x4'));var interaction=require(_0xa5a2('0x5'));var config=require('../../config/environment');var controller=require(_0xa5a2('0x6'));router[_0xa5a2('0x7')]('/',auth[_0xa5a2('0x8')](),controller['index']);router[_0xa5a2('0x7')]('/:id',auth[_0xa5a2('0x8')](),controller[_0xa5a2('0x9')]);router[_0xa5a2('0x7')]('/:id/sub_intervals',auth['isAuthenticated'](),controller[_0xa5a2('0xa')]);router[_0xa5a2('0xb')]('/',auth[_0xa5a2('0x8')](),controller[_0xa5a2('0xc')]);router[_0xa5a2('0xb')]('/:id/sub_intervals',auth[_0xa5a2('0x8')](),controller[_0xa5a2('0xd')]);router[_0xa5a2('0xb')](_0xa5a2('0xe'),auth[_0xa5a2('0x8')](),controller[_0xa5a2('0xf')]);router[_0xa5a2('0x10')]('/:id',auth['isAuthenticated'](),controller[_0xa5a2('0x11')]);router[_0xa5a2('0x12')](_0xa5a2('0x13'),auth[_0xa5a2('0x8')](),controller[_0xa5a2('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/interval/interval.attributes.js b/server/api/interval/interval.attributes.js index 77467b3..98d3c05 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 _0xf29e=['STRING'];(function(_0x2606bd,_0x31d50f){var _0x676e0=function(_0x204b97){while(--_0x204b97){_0x2606bd['push'](_0x2606bd['shift']());}};_0x676e0(++_0x31d50f);}(_0xf29e,0x1b9));var _0xef29=function(_0x2b7e95,_0x17629b){_0x2b7e95=_0x2b7e95-0x0;var _0x2a719d=_0xf29e[_0x2b7e95];return _0x2a719d;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xef29('0x0')]},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file +var _0x5b72=['sequelize','exports','STRING'];(function(_0x5f09c5,_0x2bfca0){var _0x426ad9=function(_0x18fe5f){while(--_0x18fe5f){_0x5f09c5['push'](_0x5f09c5['shift']());}};_0x426ad9(++_0x2bfca0);}(_0x5b72,0x16e));var _0x25b7=function(_0x4168b8,_0x17c9a4){_0x4168b8=_0x4168b8-0x0;var _0x571f59=_0x5b72[_0x4168b8];return _0x571f59;};'use strict';var Sequelize=require(_0x25b7('0x0'));module[_0x25b7('0x1')]={'name':{'type':Sequelize[_0x25b7('0x2')]},'description':{'type':Sequelize[_0x25b7('0x2')]},'interval':{'type':Sequelize[_0x25b7('0x2')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/interval/interval.controller.js b/server/api/interval/interval.controller.js index b1eb1bc..809d9f1 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 _0x898d=['Content-Range','apply','reject','save','update','then','destroy','get','sendStatus','error','stack','name','send','map','Interval','rawAttributes','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','type','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','addInterval','IntervalId','options','getIntervals','addIntervals','sequelize','transaction','bulkCreate','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','ejs','squel','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../components/extensions/rewrite','end','status','json','offset','undefined','count','limit','set'];(function(_0x39a97f,_0x2516d6){var _0x349479=function(_0x58423a){while(--_0x58423a){_0x39a97f['push'](_0x39a97f['shift']());}};_0x349479(++_0x2516d6);}(_0x898d,0x1b1));var _0xd898=function(_0x1d2bc8,_0x2860bc){_0x1d2bc8=_0x1d2bc8-0x0;var _0x1857e1=_0x898d[_0x1d2bc8];return _0x1857e1;};'use strict';var emlformat=require(_0xd898('0x0'));var rimraf=require(_0xd898('0x1'));var zipdir=require(_0xd898('0x2'));var jsonpatch=require(_0xd898('0x3'));var rp=require(_0xd898('0x4'));var moment=require(_0xd898('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xd898('0x6'));var util=require('util');var path=require(_0xd898('0x7'));var sox=require(_0xd898('0x8'));var csv=require('to-csv');var ejs=require(_0xd898('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xd898('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xd898('0xb'));var toCsv=require(_0xd898('0xc'));var querystring=require(_0xd898('0xd'));var Papa=require(_0xd898('0xe'));var Redis=require(_0xd898('0xf'));var authService=require(_0xd898('0x10'));var qs=require(_0xd898('0x11'));var as=require(_0xd898('0x12'));var hardwareService=require(_0xd898('0x13'));var logger=require(_0xd898('0x14'))(_0xd898('0x15'));var utils=require('../../config/utils');var config=require(_0xd898('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var extensions=require(_0xd898('0x17'));function respondWithStatusCode(_0x40fffe,_0x1c793c){_0x1c793c=_0x1c793c||0xcc;return function(_0xa7e515){if(_0xa7e515){return _0x40fffe['sendStatus'](_0x1c793c);}return _0x40fffe['status'](_0x1c793c)[_0xd898('0x18')]();};}function respondWithResult(_0x47cbad,_0x22c1a1){_0x22c1a1=_0x22c1a1||0xc8;return function(_0x2997e1){if(_0x2997e1){return _0x47cbad[_0xd898('0x19')](_0x22c1a1)[_0xd898('0x1a')](_0x2997e1);}};}function respondWithFilteredResult(_0x2149c8,_0x5ba721){return function(_0x2fc299){if(_0x2fc299){var _0x5ba1f6=typeof _0x5ba721[_0xd898('0x1b')]===_0xd898('0x1c')&&typeof _0x5ba721['limit']==='undefined';var _0x5e1a08=_0x2fc299[_0xd898('0x1d')];var _0x10d843=_0x5ba1f6?0x0:_0x5ba721[_0xd898('0x1b')];var _0x2c5a4f=_0x5ba1f6?_0x2fc299['count']:_0x5ba721[_0xd898('0x1b')]+_0x5ba721[_0xd898('0x1e')];var _0x144c09;if(_0x2c5a4f>=_0x5e1a08){_0x2c5a4f=_0x5e1a08;_0x144c09=0xc8;}else{_0x144c09=0xce;}_0x2149c8['status'](_0x144c09);return _0x2149c8[_0xd898('0x1f')](_0xd898('0x20'),_0x10d843+'-'+_0x2c5a4f+'/'+_0x5e1a08)[_0xd898('0x1a')](_0x2fc299);}return null;};}function patchUpdates(_0x497ec2){return function(_0x318bd5){try{jsonpatch[_0xd898('0x21')](_0x318bd5,_0x497ec2,!![]);}catch(_0x3036e7){return BPromise[_0xd898('0x22')](_0x3036e7);}return _0x318bd5[_0xd898('0x23')]();};}function saveUpdates(_0x2fae3b,_0x420e20){return function(_0x28b1a0){if(_0x28b1a0){return _0x28b1a0[_0xd898('0x24')](_0x2fae3b)[_0xd898('0x25')](function(_0x55036a){return _0x55036a;});}return null;};}function removeEntity(_0x19009f,_0x2cc819){return function(_0x304561){if(_0x304561){return _0x304561[_0xd898('0x26')]()[_0xd898('0x25')](function(){var _0x3f7f75=_0x304561[_0xd898('0x27')]({'plain':!![]});var _0x4904f='Intervals';return db['UserProfileResource'][_0xd898('0x26')]({'where':{'type':_0x4904f,'resourceId':_0x3f7f75['id']}})[_0xd898('0x25')](function(){return _0x304561;});})['then'](function(){_0x19009f[_0xd898('0x19')](0xcc)[_0xd898('0x18')]();});}};}function handleEntityNotFound(_0x32f098,_0x33538e){return function(_0x359a5f){if(!_0x359a5f){_0x32f098[_0xd898('0x28')](0x194);}return _0x359a5f;};}function handleError(_0x4e378b,_0x550ede){_0x550ede=_0x550ede||0x1f4;return function(_0xc6fbeb){logger[_0xd898('0x29')](_0xc6fbeb[_0xd898('0x2a')]);if(_0xc6fbeb[_0xd898('0x2b')]){delete _0xc6fbeb['name'];}_0x4e378b[_0xd898('0x19')](_0x550ede)[_0xd898('0x2c')](_0xc6fbeb);};}exports['index']=function(_0x542c80,_0xa23033){var _0x26658c={},_0x73dfad={},_0x63b3a={'count':0x0,'rows':[]};var _0xa75be2=_[_0xd898('0x2d')](db[_0xd898('0x2e')][_0xd898('0x2f')],function(_0x189ca2){return{'name':_0x189ca2['fieldName'],'type':_0x189ca2['type'][_0xd898('0x30')]};});_0x73dfad['model']=_[_0xd898('0x2d')](_0xa75be2,_0xd898('0x2b'));_0x73dfad[_0xd898('0x31')]=_[_0xd898('0x32')](_0x542c80[_0xd898('0x31')]);_0x73dfad[_0xd898('0x33')]=_[_0xd898('0x34')](_0x73dfad[_0xd898('0x35')],_0x73dfad['query']);_0x26658c[_0xd898('0x36')]=_[_0xd898('0x34')](_0x73dfad[_0xd898('0x35')],qs[_0xd898('0x37')](_0x542c80[_0xd898('0x31')][_0xd898('0x37')]));_0x26658c[_0xd898('0x36')]=_0x26658c[_0xd898('0x36')][_0xd898('0x38')]?_0x26658c['attributes']:_0x73dfad['model'];if(!_0x542c80[_0xd898('0x31')][_0xd898('0x39')](_0xd898('0x3a'))){_0x26658c[_0xd898('0x1e')]=qs[_0xd898('0x1e')](_0x542c80[_0xd898('0x31')]['limit']);_0x26658c['offset']=qs[_0xd898('0x1b')](_0x542c80[_0xd898('0x31')][_0xd898('0x1b')]);}_0x26658c[_0xd898('0x3b')]=qs[_0xd898('0x3c')](_0x542c80[_0xd898('0x31')]['sort']);_0x26658c['where']=qs['filters'](_[_0xd898('0x3d')](_0x542c80[_0xd898('0x31')],_0x73dfad[_0xd898('0x33')]),_0xa75be2);if(_0x542c80[_0xd898('0x31')][_0xd898('0x3e')]){_0x26658c['where']=_[_0xd898('0x3f')](_0x26658c[_0xd898('0x40')],{'$or':_['map'](_0xa75be2,function(_0x4bd516){if(_0x4bd516[_0xd898('0x41')]!==_0xd898('0x42')){var _0x40d752={};_0x40d752[_0x4bd516[_0xd898('0x2b')]]={'$like':'%'+_0x542c80[_0xd898('0x31')][_0xd898('0x3e')]+'%'};return _0x40d752;}})});}_0x26658c=_[_0xd898('0x3f')]({},_0x26658c,_0x542c80['options']);var _0x1b184a={'where':_0x26658c[_0xd898('0x40')]};return db[_0xd898('0x2e')][_0xd898('0x1d')](_0x1b184a)[_0xd898('0x25')](function(_0x1bb180){_0x63b3a['count']=_0x1bb180;if(_0x542c80[_0xd898('0x31')][_0xd898('0x43')]){_0x26658c[_0xd898('0x44')]=[{'all':!![]}];}return db['Interval'][_0xd898('0x45')](_0x26658c);})['then'](function(_0x5abe68){_0x63b3a[_0xd898('0x46')]=_0x5abe68;return _0x63b3a;})[_0xd898('0x25')](respondWithFilteredResult(_0xa23033,_0x26658c))[_0xd898('0x47')](handleError(_0xa23033,null));};exports[_0xd898('0x48')]=function(_0x21280d,_0x3314a9){var _0x535ab9={'raw':!![],'where':{'id':_0x21280d[_0xd898('0x49')]['id']}},_0x41a2fb={};_0x41a2fb[_0xd898('0x35')]=_[_0xd898('0x32')](db[_0xd898('0x2e')]['rawAttributes']);_0x41a2fb[_0xd898('0x31')]=_[_0xd898('0x32')](_0x21280d['query']);_0x41a2fb[_0xd898('0x33')]=_[_0xd898('0x34')](_0x41a2fb[_0xd898('0x35')],_0x41a2fb[_0xd898('0x31')]);_0x535ab9[_0xd898('0x36')]=_['intersection'](_0x41a2fb['model'],qs['fields'](_0x21280d[_0xd898('0x31')][_0xd898('0x37')]));_0x535ab9[_0xd898('0x36')]=_0x535ab9['attributes']['length']?_0x535ab9['attributes']:_0x41a2fb[_0xd898('0x35')];if(_0x21280d[_0xd898('0x31')]['includeAll']){_0x535ab9[_0xd898('0x44')]=[{'all':!![]}];}_0x535ab9=_[_0xd898('0x3f')]({},_0x535ab9,_0x21280d['options']);return db[_0xd898('0x2e')][_0xd898('0x4a')](_0x535ab9)[_0xd898('0x25')](handleEntityNotFound(_0x3314a9,null))['then'](respondWithResult(_0x3314a9,null))[_0xd898('0x47')](handleError(_0x3314a9,null));};exports[_0xd898('0x4b')]=function(_0x3df694,_0x1128bd){return db[_0xd898('0x2e')][_0xd898('0x4b')](_0x3df694['body'],{})['then'](function(_0x5be5f5){var _0x2549fe=_0x3df694[_0xd898('0x4c')][_0xd898('0x27')]({'plain':!![]});if(!_0x2549fe)throw new Error(_0xd898('0x4d'));if(_0x2549fe[_0xd898('0x4e')]===_0xd898('0x4c')){var _0x2ef51c=_0x5be5f5[_0xd898('0x27')]({'plain':!![]});var _0x4e5de9='Intervals';return db[_0xd898('0x4f')]['find']({'where':{'name':_0x4e5de9,'userProfileId':_0x2549fe[_0xd898('0x50')]},'raw':!![]})[_0xd898('0x25')](function(_0x3da31a){if(_0x3da31a&&_0x3da31a[_0xd898('0x51')]===0x0){return db[_0xd898('0x52')][_0xd898('0x4b')]({'name':_0x2ef51c[_0xd898('0x2b')],'resourceId':_0x2ef51c['id'],'type':_0x3da31a[_0xd898('0x2b')],'sectionId':_0x3da31a['id']},{})[_0xd898('0x25')](function(){return _0x5be5f5;});}else{return _0x5be5f5;}})['catch'](function(_0x10cb4e){logger[_0xd898('0x29')](_0xd898('0x53'),_0x10cb4e);throw _0x10cb4e;});}return _0x5be5f5;})[_0xd898('0x25')](respondWithResult(_0x1128bd,0xc9))[_0xd898('0x47')](handleError(_0x1128bd,null));};exports['update']=function(_0x189a26,_0x2aa353){if(_0x189a26[_0xd898('0x54')]['id']){delete _0x189a26['body']['id'];}return db[_0xd898('0x2e')][_0xd898('0x4a')]({'where':{'id':_0x189a26['params']['id']}})[_0xd898('0x25')](handleEntityNotFound(_0x2aa353,null))[_0xd898('0x25')](saveUpdates(_0x189a26['body'],null))['then'](respondWithResult(_0x2aa353,null))['catch'](handleError(_0x2aa353,null));};exports[_0xd898('0x26')]=function(_0x14bbac,_0x26068c){return db[_0xd898('0x2e')]['find']({'where':{'id':_0x14bbac[_0xd898('0x49')]['id']}})[_0xd898('0x25')](handleEntityNotFound(_0x26068c,null))['then'](removeEntity(_0x26068c,null))[_0xd898('0x47')](handleError(_0x26068c,null));};exports[_0xd898('0x55')]=function(_0x5c19bb,_0x4942a5,_0x5b35dc){if(_0x5c19bb[_0xd898('0x54')]['id']){delete _0x5c19bb['body']['id'];}return db[_0xd898('0x2e')][_0xd898('0x4a')]({'where':{'id':_0x5c19bb[_0xd898('0x49')]['id']}})[_0xd898('0x25')](handleEntityNotFound(_0x4942a5,null))[_0xd898('0x25')](function(_0x4b05e3){if(_0x4b05e3){_0x5c19bb[_0xd898('0x54')][_0xd898('0x56')]=_0x4b05e3['id'];return db[_0xd898('0x2e')][_0xd898('0x4b')](_0x5c19bb[_0xd898('0x54')]);}})[_0xd898('0x25')](respondWithResult(_0x4942a5,null))[_0xd898('0x47')](handleError(_0x4942a5,null));};exports['getIntervals']=function(_0xcba941,_0x5dd559,_0x572f08){var _0x6ff9b3={};var _0x1133ba={};var _0x4942ae;var _0x10b646;return db[_0xd898('0x2e')]['findOne']({'where':{'id':_0xcba941[_0xd898('0x49')]['id']}})[_0xd898('0x25')](handleEntityNotFound(_0x5dd559,null))['then'](function(_0x22f7c3){if(_0x22f7c3){_0x4942ae=_0x22f7c3;_0x1133ba[_0xd898('0x35')]=_['keys'](db[_0xd898('0x2e')][_0xd898('0x2f')]);_0x1133ba['query']=_[_0xd898('0x32')](_0xcba941['query']);_0x1133ba['filters']=_[_0xd898('0x34')](_0x1133ba['model'],_0x1133ba[_0xd898('0x31')]);_0x6ff9b3[_0xd898('0x36')]=_[_0xd898('0x34')](_0x1133ba[_0xd898('0x35')],qs['fields'](_0xcba941['query'][_0xd898('0x37')]));_0x6ff9b3[_0xd898('0x36')]=_0x6ff9b3['attributes'][_0xd898('0x38')]?_0x6ff9b3[_0xd898('0x36')]:_0x1133ba['model'];_0x6ff9b3[_0xd898('0x3b')]=qs[_0xd898('0x3c')](_0xcba941[_0xd898('0x31')][_0xd898('0x3c')]);_0x6ff9b3[_0xd898('0x40')]=qs[_0xd898('0x33')](_[_0xd898('0x3d')](_0xcba941[_0xd898('0x31')],_0x1133ba[_0xd898('0x33')]));if(_0xcba941[_0xd898('0x31')]['filter']){_0x6ff9b3['where']=_[_0xd898('0x3f')](_0x6ff9b3[_0xd898('0x40')],{'$or':_['map'](_0x6ff9b3[_0xd898('0x36')],function(_0x2587ec){var _0x517e87={};_0x517e87[_0x2587ec]={'$like':'%'+_0xcba941['query'][_0xd898('0x3e')]+'%'};return _0x517e87;})});}_0x6ff9b3=_[_0xd898('0x3f')]({},_0x6ff9b3,_0xcba941[_0xd898('0x57')]);return _0x4942ae['getIntervals'](_0x6ff9b3);}})[_0xd898('0x25')](function(_0x4c66fb){if(_0x4c66fb){_0x10b646=_0x4c66fb[_0xd898('0x38')];if(!_0xcba941[_0xd898('0x31')]['hasOwnProperty']('nolimit')){_0x6ff9b3[_0xd898('0x1e')]=qs[_0xd898('0x1e')](_0xcba941[_0xd898('0x31')]['limit']);_0x6ff9b3[_0xd898('0x1b')]=qs[_0xd898('0x1b')](_0xcba941[_0xd898('0x31')]['offset']);}return _0x4942ae[_0xd898('0x58')](_0x6ff9b3);}})['then'](function(_0x215cf2){if(_0x215cf2){return _0x215cf2?{'count':_0x10b646,'rows':_0x215cf2}:null;}})[_0xd898('0x25')](respondWithResult(_0x5dd559,null))[_0xd898('0x47')](handleError(_0x5dd559,null));};exports[_0xd898('0x59')]=function(_0x92e773,_0x4bc60b,_0x29374f){return db[_0xd898('0x2e')]['findOne']({'where':{'id':_0x92e773[_0xd898('0x49')]['id']}})[_0xd898('0x25')](handleEntityNotFound(_0x4bc60b,null))['then'](function(_0x295de0){if(_0x295de0){return db[_0xd898('0x5a')][_0xd898('0x5b')](function(_0xe59bca){return db[_0xd898('0x2e')][_0xd898('0x26')]({'where':{'IntervalId':_0x92e773[_0xd898('0x49')]['id']},'transaction':_0xe59bca})[_0xd898('0x25')](function(_0x3b5af6){var _0x821f9c=_[_0xd898('0x2d')](_0x92e773[_0xd898('0x54')],function(_0x1a02b4){delete _0x1a02b4['id'];_0x1a02b4['IntervalId']=_0x92e773[_0xd898('0x49')]['id'];return _0x1a02b4;});return db['Interval'][_0xd898('0x5c')](_0x821f9c,{'transaction':_0xe59bca});});})[_0xd898('0x25')](function(){return db[_0xd898('0x2e')]['findAll']({'where':{'IntervalId':_0x92e773[_0xd898('0x49')]['id']}});});}})[_0xd898('0x25')](respondWithResult(_0x4bc60b,null))['catch'](handleError(_0x4bc60b,null));}; \ No newline at end of file +var _0xae6a=['get','UserProfileResource','stack','name','send','index','map','Interval','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','catch','show','params','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','Intervals','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addInterval','findOne','getIntervals','sequelize','transaction','IntervalId','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../config/logger','../../config/license/util','../../components/extensions/rewrite','sendStatus','end','status','json','undefined','count','offset','limit','set','Content-Range','apply','update','then','destroy'];(function(_0x302507,_0x40de06){var _0x4f255f=function(_0x1a5d76){while(--_0x1a5d76){_0x302507['push'](_0x302507['shift']());}};_0x4f255f(++_0x40de06);}(_0xae6a,0x1e6));var _0xaae6=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0xae6a[_0x618414];return _0x21c19a;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xaae6('0x0'));var jsonpatch=require(_0xaae6('0x1'));var rp=require(_0xaae6('0x2'));var moment=require(_0xaae6('0x3'));var BPromise=require(_0xaae6('0x4'));var Mustache=require(_0xaae6('0x5'));var util=require(_0xaae6('0x6'));var path=require(_0xaae6('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xaae6('0x8'));var fs=require('fs');var fs_extra=require(_0xaae6('0x9'));var _=require(_0xaae6('0xa'));var squel=require(_0xaae6('0xb'));var crypto=require(_0xaae6('0xc'));var jsforce=require(_0xaae6('0xd'));var deskjs=require(_0xaae6('0xe'));var toCsv=require(_0xaae6('0xf'));var querystring=require('querystring');var Papa=require(_0xaae6('0x10'));var Redis=require(_0xaae6('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xaae6('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xaae6('0x13'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xaae6('0x14'));var db=require('../../mysqldb')['db'];var extensions=require(_0xaae6('0x15'));function respondWithStatusCode(_0x30e8d2,_0x596419){_0x596419=_0x596419||0xcc;return function(_0x2970c0){if(_0x2970c0){return _0x30e8d2[_0xaae6('0x16')](_0x596419);}return _0x30e8d2['status'](_0x596419)[_0xaae6('0x17')]();};}function respondWithResult(_0x8be7e,_0x16ff96){_0x16ff96=_0x16ff96||0xc8;return function(_0x110686){if(_0x110686){return _0x8be7e[_0xaae6('0x18')](_0x16ff96)[_0xaae6('0x19')](_0x110686);}};}function respondWithFilteredResult(_0x530da1,_0x3d58c9){return function(_0x10ad21){if(_0x10ad21){var _0x278cc1=typeof _0x3d58c9['offset']===_0xaae6('0x1a')&&typeof _0x3d58c9['limit']===_0xaae6('0x1a');var _0x129167=_0x10ad21[_0xaae6('0x1b')];var _0x25af32=_0x278cc1?0x0:_0x3d58c9[_0xaae6('0x1c')];var _0xf69219=_0x278cc1?_0x10ad21[_0xaae6('0x1b')]:_0x3d58c9['offset']+_0x3d58c9[_0xaae6('0x1d')];var _0x446342;if(_0xf69219>=_0x129167){_0xf69219=_0x129167;_0x446342=0xc8;}else{_0x446342=0xce;}_0x530da1[_0xaae6('0x18')](_0x446342);return _0x530da1[_0xaae6('0x1e')](_0xaae6('0x1f'),_0x25af32+'-'+_0xf69219+'/'+_0x129167)[_0xaae6('0x19')](_0x10ad21);}return null;};}function patchUpdates(_0x2b9188){return function(_0x4b4c0f){try{jsonpatch[_0xaae6('0x20')](_0x4b4c0f,_0x2b9188,!![]);}catch(_0x2bbc5f){return BPromise['reject'](_0x2bbc5f);}return _0x4b4c0f['save']();};}function saveUpdates(_0x2dd4d0,_0x5c7a5c){return function(_0x48bf18){if(_0x48bf18){return _0x48bf18[_0xaae6('0x21')](_0x2dd4d0)[_0xaae6('0x22')](function(_0x552cb5){return _0x552cb5;});}return null;};}function removeEntity(_0x50f197,_0x5e67ca){return function(_0x20f3b3){if(_0x20f3b3){return _0x20f3b3[_0xaae6('0x23')]()[_0xaae6('0x22')](function(){var _0x52de23=_0x20f3b3[_0xaae6('0x24')]({'plain':!![]});var _0x45662e='Intervals';return db[_0xaae6('0x25')][_0xaae6('0x23')]({'where':{'type':_0x45662e,'resourceId':_0x52de23['id']}})[_0xaae6('0x22')](function(){return _0x20f3b3;});})[_0xaae6('0x22')](function(){_0x50f197[_0xaae6('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0xce0b7a,_0x359928){return function(_0x1aac61){if(!_0x1aac61){_0xce0b7a['sendStatus'](0x194);}return _0x1aac61;};}function handleError(_0x13f539,_0xaf1b7b){_0xaf1b7b=_0xaf1b7b||0x1f4;return function(_0x47c22b){logger['error'](_0x47c22b[_0xaae6('0x26')]);if(_0x47c22b['name']){delete _0x47c22b[_0xaae6('0x27')];}_0x13f539[_0xaae6('0x18')](_0xaf1b7b)[_0xaae6('0x28')](_0x47c22b);};}exports[_0xaae6('0x29')]=function(_0xc570a6,_0x2deeca){var _0xbea00b={},_0x268662={},_0x490e6b={'count':0x0,'rows':[]};var _0x21cf28=_[_0xaae6('0x2a')](db[_0xaae6('0x2b')][_0xaae6('0x2c')],function(_0xc1f7ed){return{'name':_0xc1f7ed['fieldName'],'type':_0xc1f7ed[_0xaae6('0x2d')][_0xaae6('0x2e')]};});_0x268662[_0xaae6('0x2f')]=_[_0xaae6('0x2a')](_0x21cf28,_0xaae6('0x27'));_0x268662[_0xaae6('0x30')]=_[_0xaae6('0x31')](_0xc570a6[_0xaae6('0x30')]);_0x268662[_0xaae6('0x32')]=_['intersection'](_0x268662[_0xaae6('0x2f')],_0x268662[_0xaae6('0x30')]);_0xbea00b['attributes']=_[_0xaae6('0x33')](_0x268662[_0xaae6('0x2f')],qs[_0xaae6('0x34')](_0xc570a6[_0xaae6('0x30')][_0xaae6('0x34')]));_0xbea00b[_0xaae6('0x35')]=_0xbea00b[_0xaae6('0x35')][_0xaae6('0x36')]?_0xbea00b[_0xaae6('0x35')]:_0x268662[_0xaae6('0x2f')];if(!_0xc570a6[_0xaae6('0x30')][_0xaae6('0x37')](_0xaae6('0x38'))){_0xbea00b['limit']=qs[_0xaae6('0x1d')](_0xc570a6['query'][_0xaae6('0x1d')]);_0xbea00b[_0xaae6('0x1c')]=qs[_0xaae6('0x1c')](_0xc570a6['query'][_0xaae6('0x1c')]);}_0xbea00b[_0xaae6('0x39')]=qs[_0xaae6('0x3a')](_0xc570a6[_0xaae6('0x30')]['sort']);_0xbea00b[_0xaae6('0x3b')]=qs['filters'](_[_0xaae6('0x3c')](_0xc570a6['query'],_0x268662[_0xaae6('0x32')]),_0x21cf28);if(_0xc570a6[_0xaae6('0x30')][_0xaae6('0x3d')]){_0xbea00b[_0xaae6('0x3b')]=_['merge'](_0xbea00b[_0xaae6('0x3b')],{'$or':_[_0xaae6('0x2a')](_0x21cf28,function(_0x3b7804){if(_0x3b7804[_0xaae6('0x2d')]!==_0xaae6('0x3e')){var _0x1a64a2={};_0x1a64a2[_0x3b7804[_0xaae6('0x27')]]={'$like':'%'+_0xc570a6['query'][_0xaae6('0x3d')]+'%'};return _0x1a64a2;}})});}_0xbea00b=_[_0xaae6('0x3f')]({},_0xbea00b,_0xc570a6[_0xaae6('0x40')]);var _0x527aa0={'where':_0xbea00b[_0xaae6('0x3b')]};return db[_0xaae6('0x2b')][_0xaae6('0x1b')](_0x527aa0)[_0xaae6('0x22')](function(_0x225026){_0x490e6b[_0xaae6('0x1b')]=_0x225026;if(_0xc570a6[_0xaae6('0x30')][_0xaae6('0x41')]){_0xbea00b[_0xaae6('0x42')]=[{'all':!![]}];}return db[_0xaae6('0x2b')][_0xaae6('0x43')](_0xbea00b);})[_0xaae6('0x22')](function(_0xbcc1a8){_0x490e6b['rows']=_0xbcc1a8;return _0x490e6b;})[_0xaae6('0x22')](respondWithFilteredResult(_0x2deeca,_0xbea00b))[_0xaae6('0x44')](handleError(_0x2deeca,null));};exports[_0xaae6('0x45')]=function(_0x1537f6,_0x3bea9c){var _0x50e2ec={'raw':!![],'where':{'id':_0x1537f6[_0xaae6('0x46')]['id']}},_0x2e6fc9={};_0x2e6fc9[_0xaae6('0x2f')]=_['keys'](db[_0xaae6('0x2b')][_0xaae6('0x2c')]);_0x2e6fc9[_0xaae6('0x30')]=_[_0xaae6('0x31')](_0x1537f6[_0xaae6('0x30')]);_0x2e6fc9[_0xaae6('0x32')]=_['intersection'](_0x2e6fc9[_0xaae6('0x2f')],_0x2e6fc9[_0xaae6('0x30')]);_0x50e2ec[_0xaae6('0x35')]=_[_0xaae6('0x33')](_0x2e6fc9[_0xaae6('0x2f')],qs[_0xaae6('0x34')](_0x1537f6[_0xaae6('0x30')][_0xaae6('0x34')]));_0x50e2ec[_0xaae6('0x35')]=_0x50e2ec[_0xaae6('0x35')]['length']?_0x50e2ec[_0xaae6('0x35')]:_0x2e6fc9['model'];if(_0x1537f6[_0xaae6('0x30')][_0xaae6('0x41')]){_0x50e2ec[_0xaae6('0x42')]=[{'all':!![]}];}_0x50e2ec=_[_0xaae6('0x3f')]({},_0x50e2ec,_0x1537f6[_0xaae6('0x40')]);return db[_0xaae6('0x2b')][_0xaae6('0x47')](_0x50e2ec)[_0xaae6('0x22')](handleEntityNotFound(_0x3bea9c,null))['then'](respondWithResult(_0x3bea9c,null))['catch'](handleError(_0x3bea9c,null));};exports['create']=function(_0x224b7e,_0x1471f7){return db[_0xaae6('0x2b')][_0xaae6('0x48')](_0x224b7e[_0xaae6('0x49')],{})[_0xaae6('0x22')](function(_0x549f23){var _0x35f5c6=_0x224b7e['user'][_0xaae6('0x24')]({'plain':!![]});if(!_0x35f5c6)throw new Error(_0xaae6('0x4a'));if(_0x35f5c6[_0xaae6('0x4b')]===_0xaae6('0x4c')){var _0x19e59a=_0x549f23['get']({'plain':!![]});var _0x562bae=_0xaae6('0x4d');return db[_0xaae6('0x4e')]['find']({'where':{'name':_0x562bae,'userProfileId':_0x35f5c6['userProfileId']},'raw':!![]})[_0xaae6('0x22')](function(_0x454ecc){if(_0x454ecc&&_0x454ecc[_0xaae6('0x4f')]===0x0){return db[_0xaae6('0x25')]['create']({'name':_0x19e59a[_0xaae6('0x27')],'resourceId':_0x19e59a['id'],'type':_0x454ecc[_0xaae6('0x27')],'sectionId':_0x454ecc['id']},{})[_0xaae6('0x22')](function(){return _0x549f23;});}else{return _0x549f23;}})['catch'](function(_0x263068){logger['error'](_0xaae6('0x50'),_0x263068);throw _0x263068;});}return _0x549f23;})['then'](respondWithResult(_0x1471f7,0xc9))[_0xaae6('0x44')](handleError(_0x1471f7,null));};exports[_0xaae6('0x21')]=function(_0x55f9a2,_0x33def7){if(_0x55f9a2[_0xaae6('0x49')]['id']){delete _0x55f9a2[_0xaae6('0x49')]['id'];}return db[_0xaae6('0x2b')]['find']({'where':{'id':_0x55f9a2[_0xaae6('0x46')]['id']}})[_0xaae6('0x22')](handleEntityNotFound(_0x33def7,null))['then'](saveUpdates(_0x55f9a2[_0xaae6('0x49')],null))[_0xaae6('0x22')](respondWithResult(_0x33def7,null))[_0xaae6('0x44')](handleError(_0x33def7,null));};exports[_0xaae6('0x23')]=function(_0x2bce64,_0x5c6353){return db['Interval'][_0xaae6('0x47')]({'where':{'id':_0x2bce64[_0xaae6('0x46')]['id']}})[_0xaae6('0x22')](handleEntityNotFound(_0x5c6353,null))['then'](removeEntity(_0x5c6353,null))[_0xaae6('0x44')](handleError(_0x5c6353,null));};exports[_0xaae6('0x51')]=function(_0x48fc3c,_0x13e158,_0xff5f87){if(_0x48fc3c['body']['id']){delete _0x48fc3c[_0xaae6('0x49')]['id'];}return db[_0xaae6('0x2b')][_0xaae6('0x47')]({'where':{'id':_0x48fc3c['params']['id']}})['then'](handleEntityNotFound(_0x13e158,null))['then'](function(_0x31f687){if(_0x31f687){_0x48fc3c[_0xaae6('0x49')]['IntervalId']=_0x31f687['id'];return db[_0xaae6('0x2b')][_0xaae6('0x48')](_0x48fc3c['body']);}})[_0xaae6('0x22')](respondWithResult(_0x13e158,null))['catch'](handleError(_0x13e158,null));};exports['getIntervals']=function(_0x2f38a0,_0x498bd1,_0x3d9b20){var _0x20db35={};var _0x12155e={};var _0x1f6ee1;var _0x484d80;return db[_0xaae6('0x2b')][_0xaae6('0x52')]({'where':{'id':_0x2f38a0[_0xaae6('0x46')]['id']}})[_0xaae6('0x22')](handleEntityNotFound(_0x498bd1,null))[_0xaae6('0x22')](function(_0x507c62){if(_0x507c62){_0x1f6ee1=_0x507c62;_0x12155e[_0xaae6('0x2f')]=_['keys'](db[_0xaae6('0x2b')][_0xaae6('0x2c')]);_0x12155e['query']=_[_0xaae6('0x31')](_0x2f38a0[_0xaae6('0x30')]);_0x12155e[_0xaae6('0x32')]=_[_0xaae6('0x33')](_0x12155e[_0xaae6('0x2f')],_0x12155e[_0xaae6('0x30')]);_0x20db35[_0xaae6('0x35')]=_[_0xaae6('0x33')](_0x12155e[_0xaae6('0x2f')],qs[_0xaae6('0x34')](_0x2f38a0[_0xaae6('0x30')][_0xaae6('0x34')]));_0x20db35[_0xaae6('0x35')]=_0x20db35['attributes'][_0xaae6('0x36')]?_0x20db35[_0xaae6('0x35')]:_0x12155e[_0xaae6('0x2f')];_0x20db35[_0xaae6('0x39')]=qs[_0xaae6('0x3a')](_0x2f38a0[_0xaae6('0x30')][_0xaae6('0x3a')]);_0x20db35[_0xaae6('0x3b')]=qs[_0xaae6('0x32')](_[_0xaae6('0x3c')](_0x2f38a0[_0xaae6('0x30')],_0x12155e['filters']));if(_0x2f38a0[_0xaae6('0x30')][_0xaae6('0x3d')]){_0x20db35[_0xaae6('0x3b')]=_[_0xaae6('0x3f')](_0x20db35[_0xaae6('0x3b')],{'$or':_[_0xaae6('0x2a')](_0x20db35[_0xaae6('0x35')],function(_0x5605e9){var _0x495e5a={};_0x495e5a[_0x5605e9]={'$like':'%'+_0x2f38a0[_0xaae6('0x30')][_0xaae6('0x3d')]+'%'};return _0x495e5a;})});}_0x20db35=_[_0xaae6('0x3f')]({},_0x20db35,_0x2f38a0[_0xaae6('0x40')]);return _0x1f6ee1[_0xaae6('0x53')](_0x20db35);}})[_0xaae6('0x22')](function(_0x3cdc38){if(_0x3cdc38){_0x484d80=_0x3cdc38[_0xaae6('0x36')];if(!_0x2f38a0['query'][_0xaae6('0x37')](_0xaae6('0x38'))){_0x20db35['limit']=qs[_0xaae6('0x1d')](_0x2f38a0[_0xaae6('0x30')][_0xaae6('0x1d')]);_0x20db35[_0xaae6('0x1c')]=qs[_0xaae6('0x1c')](_0x2f38a0[_0xaae6('0x30')][_0xaae6('0x1c')]);}return _0x1f6ee1[_0xaae6('0x53')](_0x20db35);}})[_0xaae6('0x22')](function(_0x22f082){if(_0x22f082){return _0x22f082?{'count':_0x484d80,'rows':_0x22f082}:null;}})[_0xaae6('0x22')](respondWithResult(_0x498bd1,null))[_0xaae6('0x44')](handleError(_0x498bd1,null));};exports['addIntervals']=function(_0x5b9c17,_0x2966c4,_0x3cd04a){return db[_0xaae6('0x2b')][_0xaae6('0x52')]({'where':{'id':_0x5b9c17[_0xaae6('0x46')]['id']}})[_0xaae6('0x22')](handleEntityNotFound(_0x2966c4,null))[_0xaae6('0x22')](function(_0x24e54f){if(_0x24e54f){return db[_0xaae6('0x54')][_0xaae6('0x55')](function(_0x1985d1){return db['Interval']['destroy']({'where':{'IntervalId':_0x5b9c17['params']['id']},'transaction':_0x1985d1})['then'](function(_0x2aef14){var _0x21958f=_[_0xaae6('0x2a')](_0x5b9c17['body'],function(_0x2a34a1){delete _0x2a34a1['id'];_0x2a34a1[_0xaae6('0x56')]=_0x5b9c17[_0xaae6('0x46')]['id'];return _0x2a34a1;});return db[_0xaae6('0x2b')]['bulkCreate'](_0x21958f,{'transaction':_0x1985d1});});})[_0xaae6('0x22')](function(){return db['Interval'][_0xaae6('0x43')]({'where':{'IntervalId':_0x5b9c17[_0xaae6('0x46')]['id']}});});}})[_0xaae6('0x22')](respondWithResult(_0x2966c4,null))[_0xaae6('0x44')](handleError(_0x2966c4,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index c161250..403fc64 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 _0xebb1=['../../config/logger','moment','bluebird','request-promise','path','./interval.attributes','exports','define','Interval','rewrite','lodash','util'];(function(_0x3eadcb,_0x58fac6){var _0x367dc0=function(_0x30bf37){while(--_0x30bf37){_0x3eadcb['push'](_0x3eadcb['shift']());}};_0x367dc0(++_0x58fac6);}(_0xebb1,0xa6));var _0x1ebb=function(_0x15fce6,_0x542138){_0x15fce6=_0x15fce6-0x0;var _0x1ccfe6=_0xebb1[_0x15fce6];return _0x1ccfe6;};'use strict';var _=require(_0x1ebb('0x0'));var util=require(_0x1ebb('0x1'));var logger=require(_0x1ebb('0x2'))('api');var moment=require(_0x1ebb('0x3'));var BPromise=require(_0x1ebb('0x4'));var rp=require(_0x1ebb('0x5'));var fs=require('fs');var path=require(_0x1ebb('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x1ebb('0x7'));var extensions=require('../../components/extensions/rewrite');module[_0x1ebb('0x8')]=function(_0xa56c9,_0x479085){return _0xa56c9[_0x1ebb('0x9')](_0x1ebb('0xa'),attributes,{'tableName':'tools_intervals','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x1751ec,_0x147fcf){extensions['rewrite'](_0xa56c9,_0x1751ec);},'afterBulkCreate':function(_0x51c879,_0x2dcec3,_0x1f8522){_0x1f8522();extensions[_0x1ebb('0xb')](_0xa56c9,_0x51c879[0x0]);},'afterUpdate':function(_0x49501c,_0x2e15cb){extensions[_0x1ebb('0xb')](_0xa56c9,_0x49501c);},'afterDestroy':function(_0x14dbc2,_0x2cdd15){extensions['rewrite'](_0xa56c9,_0x14dbc2);}}});}; \ No newline at end of file +var _0xfe4a=['exports','Interval','rewrite','util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','../../components/extensions/rewrite'];(function(_0x1eb1b8,_0xfb6868){var _0x61a862=function(_0x13ae47){while(--_0x13ae47){_0x1eb1b8['push'](_0x1eb1b8['shift']());}};_0x61a862(++_0xfb6868);}(_0xfe4a,0x142));var _0xafe4=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0xfe4a[_0x138adb];return _0x1b27f2;};'use strict';var _=require('lodash');var util=require(_0xafe4('0x0'));var logger=require(_0xafe4('0x1'))(_0xafe4('0x2'));var moment=require(_0xafe4('0x3'));var BPromise=require(_0xafe4('0x4'));var rp=require(_0xafe4('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xafe4('0x6'));var attributes=require('./interval.attributes');var extensions=require(_0xafe4('0x7'));module[_0xafe4('0x8')]=function(_0x2294fa,_0x45c3c2){return _0x2294fa['define'](_0xafe4('0x9'),attributes,{'tableName':'tools_intervals','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x19ceb1,_0x320283){extensions[_0xafe4('0xa')](_0x2294fa,_0x19ceb1);},'afterBulkCreate':function(_0x21e07c,_0x4f4ed0,_0x598569){_0x598569();extensions[_0xafe4('0xa')](_0x2294fa,_0x21e07c[0x0]);},'afterUpdate':function(_0x123e90,_0x3ece0a){extensions[_0xafe4('0xa')](_0x2294fa,_0x123e90);},'afterDestroy':function(_0x44fe2a,_0x5053af){extensions[_0xafe4('0xa')](_0x2294fa,_0x44fe2a);}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index 880f2b3..4c32c5f 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(_0x4a96ca,_0x13754e){var _0x2aed48=function(_0x361330){while(--_0x361330){_0x4a96ca['push'](_0x4a96ca['shift']());}};_0x2aed48(++_0x13754e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0xa9e0[_0x5b561d];return _0x431060;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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(_0x2d460c,_0x4f08c0){var _0xf6fc4c=function(_0x4fb81c){while(--_0x4fb81c){_0x2d460c['push'](_0x2d460c['shift']());}};_0xf6fc4c(++_0x4f08c0);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3ce3c,_0x319337){_0x3ce3c=_0x3ce3c-0x0;var _0x55a2c9=_0xa9e0[_0x3ce3c];return _0x55a2c9;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});}exports['GetInterval']=function(_0x459eb1){var _0x478723=this;return new Promise(function(_0x106033,_0x205fd6){return db[_0x0a9e('0x14')][_0x0a9e('0x15')]({'raw':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x17')]===undefined?!![]:![]:!![],'where':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x18')]||null:null,'attributes':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x19')]||null:null,'limit':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')]['limit']||null:null,'include':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x459eb1[_0x0a9e('0x16')]['include'],function(_0xfb6e48){return{'model':db[_0xfb6e48[_0x0a9e('0x1c')]],'as':_0xfb6e48['as'],'attributes':_0xfb6e48[_0x0a9e('0x19')],'include':_0xfb6e48[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0xfb6e48[_0x0a9e('0x1a')],function(_0x16b1ca){return{'model':db[_0x16b1ca['model']],'as':_0x16b1ca['as'],'attributes':_0x16b1ca['attributes'],'include':_0x16b1ca[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x16b1ca[_0x0a9e('0x1a')],function(_0x33161b){return{'model':db[_0x33161b['model']],'as':_0x33161b['as'],'attributes':_0x33161b[_0x0a9e('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x45a1e7){logger['info'](_0x0a9e('0x1d'),_0x459eb1);logger[_0x0a9e('0xd')](_0x0a9e('0x1d'),_0x459eb1,JSON[_0x0a9e('0x1e')](_0x45a1e7));_0x106033(_0x45a1e7);})[_0x0a9e('0x13')](function(_0x1538a4){logger[_0x0a9e('0x10')](_0x0a9e('0x1d'),_0x1538a4['message'],_0x459eb1);_0x205fd6(_0x478723[_0x0a9e('0x10')](0x1f4,_0x1538a4[_0x0a9e('0x11')]));});});};exports[_0x0a9e('0x1f')]=function(_0x2ec755){var _0x5c877d=this;return new Promise(function(_0x15b200,_0x40e7a3){return db[_0x0a9e('0x14')][_0x0a9e('0x20')]({'raw':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')][_0x0a9e('0x17')]===undefined?!![]:![]:!![],'where':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')]['where']||null:null,'attributes':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755['options'][_0x0a9e('0x19')]||null:null,'include':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')][_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x2ec755['options'][_0x0a9e('0x1a')],function(_0x46f0a5){return{'model':db[_0x46f0a5[_0x0a9e('0x1c')]],'as':_0x46f0a5['as'],'attributes':_0x46f0a5[_0x0a9e('0x19')],'include':_0x46f0a5[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x46f0a5[_0x0a9e('0x1a')],function(_0x39e565){return{'model':db[_0x39e565['model']],'as':_0x39e565['as'],'attributes':_0x39e565[_0x0a9e('0x19')],'include':_0x39e565['include']?_[_0x0a9e('0x1b')](_0x39e565[_0x0a9e('0x1a')],function(_0x2b7e7f){return{'model':db[_0x2b7e7f[_0x0a9e('0x1c')]],'as':_0x2b7e7f['as'],'attributes':_0x2b7e7f['attributes']};}):[]};}):[]};}):[]:[]})[_0x0a9e('0x21')](function(_0xd1836d){logger[_0x0a9e('0xa')](_0x0a9e('0x1f'),_0x2ec755);logger['debug']('ShowInterval',_0x2ec755,JSON[_0x0a9e('0x1e')](_0xd1836d));_0x15b200(_0xd1836d);})['catch'](function(_0x24936a){logger[_0x0a9e('0x10')](_0x0a9e('0x1f'),_0x24936a[_0x0a9e('0x11')],_0x2ec755);_0x40e7a3(_0x5c877d['error'](0x1f4,_0x24936a[_0x0a9e('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/jira/index.js b/server/api/jira/index.js index e2d340e..be3f04f 100644 --- a/server/api/jira/index.js +++ b/server/api/jira/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0b0e=['exports','express','../../components/auth/service','post','isAuthenticated','send'];(function(_0x5a776b,_0x46f785){var _0xbbef59=function(_0x38313e){while(--_0x38313e){_0x5a776b['push'](_0x5a776b['shift']());}};_0xbbef59(++_0x46f785);}(_0x0b0e,0x187));var _0xe0b0=function(_0xcfcbaa,_0x369d95){_0xcfcbaa=_0xcfcbaa-0x0;var _0x157ed0=_0x0b0e[_0xcfcbaa];return _0x157ed0;};'use strict';var express=require(_0xe0b0('0x0'));var router=express['Router']();var auth=require(_0xe0b0('0x1'));var controller=require('./jira.controller');router[_0xe0b0('0x2')]('/',auth[_0xe0b0('0x3')](),controller[_0xe0b0('0x4')]);module[_0xe0b0('0x5')]=router; \ No newline at end of file +var _0x0b0e=['exports','express','../../components/auth/service','post','isAuthenticated','send'];(function(_0x2261ce,_0x9ed8b6){var _0x524640=function(_0x3cbb90){while(--_0x3cbb90){_0x2261ce['push'](_0x2261ce['shift']());}};_0x524640(++_0x9ed8b6);}(_0x0b0e,0x187));var _0xe0b0=function(_0x57474e,_0x4178b8){_0x57474e=_0x57474e-0x0;var _0xfaae8c=_0x0b0e[_0x57474e];return _0xfaae8c;};'use strict';var express=require(_0xe0b0('0x0'));var router=express['Router']();var auth=require(_0xe0b0('0x1'));var controller=require('./jira.controller');router[_0xe0b0('0x2')]('/',auth[_0xe0b0('0x3')](),controller[_0xe0b0('0x4')]);module[_0xe0b0('0x5')]=router; \ No newline at end of file diff --git a/server/api/jira/jira.controller.js b/server/api/jira/jira.controller.js index 5304e2c..5ed4bca 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 _0x9239=['api','support','3eAmWpBVP0','key','MOTGUI','summary','Report','\x20from\x20','stringify','issuetype','Bug','fields','customfield_11500','customfield_11501','oldToken','customfield_11502','newToken','customfield_11504','reason','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','api.jira','write','body','headers','connection','socket','remoteAddress','bluebird','https','../../config/logger'];(function(_0x214c7f,_0x1d9263){var _0x1b6871=function(_0x30d4c8){while(--_0x30d4c8){_0x214c7f['push'](_0x214c7f['shift']());}};_0x1b6871(++_0x1d9263);}(_0x9239,0xe8));var _0x9923=function(_0x18e091,_0x3d8d0f){_0x18e091=_0x18e091-0x0;var _0x5c7c4e=_0x9239[_0x18e091];return _0x5c7c4e;};'use strict';var BPromise=require(_0x9923('0x0'));var https=require(_0x9923('0x1'));var logger=require(_0x9923('0x2'))(_0x9923('0x3'));var USERNAME=_0x9923('0x4');var PASSWORD=_0x9923('0x5');function openIssue(_0x58c3bb,_0x176381){var _0x4d09a8={'fields':{'project':{'key':_0x58c3bb[_0x9923('0x6')]||_0x9923('0x7')},'summary':(_0x58c3bb[_0x9923('0x8')]||_0x9923('0x9'))+_0x9923('0xa')+_0x58c3bb['ip'],'description':_0x58c3bb['description']||JSON[_0x9923('0xb')](_0x58c3bb),'issuetype':{'name':_0x58c3bb[_0x9923('0xc')]||_0x9923('0xd')}}};_0x4d09a8[_0x9923('0xe')][_0x9923('0xf')]=_0x58c3bb['email'];_0x4d09a8[_0x9923('0xe')][_0x9923('0x10')]=_0x58c3bb[_0x9923('0x11')];_0x4d09a8['fields'][_0x9923('0x12')]=_0x58c3bb[_0x9923('0x13')];_0x4d09a8[_0x9923('0xe')]['customfield_11503']=_0x58c3bb['name'];_0x4d09a8['fields'][_0x9923('0x14')]=_0x58c3bb[_0x9923('0x15')];_0x4d09a8[_0x9923('0xe')][_0x9923('0x16')]=_0x58c3bb['ip'];var _0x2494ee={'host':_0x9923('0x17'),'port':0x1bb,'path':_0x9923('0x18'),'method':_0x9923('0x19'),'timeout':0x4e20,'headers':{'Content-Type':_0x9923('0x1a'),'Authorization':_0x9923('0x1b')+new Buffer(USERNAME+':'+PASSWORD)[_0x9923('0x1c')](_0x9923('0x1d'))}};var _0x8cd985=JSON['stringify'](_0x4d09a8);var _0x30d853=https[_0x9923('0x1e')](_0x2494ee,function(_0x465c17){_0x465c17[_0x9923('0x1f')](_0x9923('0x20'));var _0x260f22='';_0x465c17['on'](_0x9923('0x21'),function(_0x350e9d){_0x260f22+=_0x350e9d;});_0x465c17['on'](_0x9923('0x22'),function(){if(_0x176381){return _0x176381[_0x9923('0x23')](_0x465c17[_0x9923('0x24')])['json'](JSON[_0x9923('0x25')](_0x260f22));}});});_0x30d853['on'](_0x9923('0x26'),function(_0x1f3b63){if(_0x176381){return _0x176381[_0x9923('0x23')](0x1f4)[_0x9923('0x27')]({'errors':[{'message':'Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','type':_0x9923('0x28')}]});}});_0x30d853[_0x9923('0x29')](_0x8cd985);_0x30d853[_0x9923('0x22')]();}exports['openIssue']=openIssue;exports['send']=function(_0xdaa22f,_0x5a2e5d){_0xdaa22f[_0x9923('0x2a')]['ip']=_0xdaa22f[_0x9923('0x2b')]['x-forwarded-for']||_0xdaa22f[_0x9923('0x2c')]['remoteAddress']||_0xdaa22f[_0x9923('0x2d')][_0x9923('0x2e')]||_0xdaa22f[_0x9923('0x2c')][_0x9923('0x2d')][_0x9923('0x2e')];return openIssue(_0xdaa22f[_0x9923('0x2a')],_0x5a2e5d);}; \ No newline at end of file +var _0x3233=['openIssue','send','body','headers','x-forwarded-for','remoteAddress','socket','connection','bluebird','https','../../config/logger','api','3eAmWpBVP0','key','MOTGUI','summary','Report','\x20from\x20','description','Bug','fields','customfield_11500','email','customfield_11501','oldToken','customfield_11502','newToken','customfield_11503','name','reason','customfield_10102','track.xcallymotion.com','/rest/api/2/issue','POST','application/json','Basic\x20','stringify','setEncoding','data','end','status','parse','error','json','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0x3233,0x14a));var _0x3323=function(_0x394dea,_0x5e8720){_0x394dea=_0x394dea-0x0;var _0x2d659d=_0x3233[_0x394dea];return _0x2d659d;};'use strict';var BPromise=require(_0x3323('0x0'));var https=require(_0x3323('0x1'));var logger=require(_0x3323('0x2'))(_0x3323('0x3'));var USERNAME='support';var PASSWORD=_0x3323('0x4');function openIssue(_0x41ed4f,_0x615bc1){var _0x32d74f={'fields':{'project':{'key':_0x41ed4f[_0x3323('0x5')]||_0x3323('0x6')},'summary':(_0x41ed4f[_0x3323('0x7')]||_0x3323('0x8'))+_0x3323('0x9')+_0x41ed4f['ip'],'description':_0x41ed4f[_0x3323('0xa')]||JSON['stringify'](_0x41ed4f),'issuetype':{'name':_0x41ed4f['issuetype']||_0x3323('0xb')}}};_0x32d74f[_0x3323('0xc')][_0x3323('0xd')]=_0x41ed4f[_0x3323('0xe')];_0x32d74f[_0x3323('0xc')][_0x3323('0xf')]=_0x41ed4f[_0x3323('0x10')];_0x32d74f['fields'][_0x3323('0x11')]=_0x41ed4f[_0x3323('0x12')];_0x32d74f[_0x3323('0xc')][_0x3323('0x13')]=_0x41ed4f[_0x3323('0x14')];_0x32d74f['fields']['customfield_11504']=_0x41ed4f[_0x3323('0x15')];_0x32d74f[_0x3323('0xc')][_0x3323('0x16')]=_0x41ed4f['ip'];var _0x43a420={'host':_0x3323('0x17'),'port':0x1bb,'path':_0x3323('0x18'),'method':_0x3323('0x19'),'timeout':0x4e20,'headers':{'Content-Type':_0x3323('0x1a'),'Authorization':_0x3323('0x1b')+new Buffer(USERNAME+':'+PASSWORD)['toString']('base64')}};var _0x5353ea=JSON[_0x3323('0x1c')](_0x32d74f);var _0x1cce2d=https['request'](_0x43a420,function(_0x3c4920){_0x3c4920[_0x3323('0x1d')]('utf8');var _0xbb82b='';_0x3c4920['on'](_0x3323('0x1e'),function(_0x5223bf){_0xbb82b+=_0x5223bf;});_0x3c4920['on'](_0x3323('0x1f'),function(){if(_0x615bc1){return _0x615bc1[_0x3323('0x20')](_0x3c4920['statusCode'])['json'](JSON[_0x3323('0x21')](_0xbb82b));}});});_0x1cce2d['on'](_0x3323('0x22'),function(_0x49a250){if(_0x615bc1){return _0x615bc1[_0x3323('0x20')](0x1f4)[_0x3323('0x23')]({'errors':[{'message':_0x3323('0x24'),'type':_0x3323('0x25')}]});}});_0x1cce2d['write'](_0x5353ea);_0x1cce2d['end']();}exports[_0x3323('0x26')]=openIssue;exports[_0x3323('0x27')]=function(_0x1277a6,_0x19cbbb){_0x1277a6[_0x3323('0x28')]['ip']=_0x1277a6[_0x3323('0x29')][_0x3323('0x2a')]||_0x1277a6['connection'][_0x3323('0x2b')]||_0x1277a6[_0x3323('0x2c')]['remoteAddress']||_0x1277a6[_0x3323('0x2d')][_0x3323('0x2c')][_0x3323('0x2b')];return openIssue(_0x1277a6[_0x3323('0x28')],_0x19cbbb);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index 25c13ec..8dcc464 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 _0x1be1=['fs-extra','../../components/auth/service','../../components/interaction/service','./jscriptyAnswerReport.controller','get','isAuthenticated','describe','/:id','post','put','update','destroy','path','connect-timeout','Router'];(function(_0x2de187,_0x2f0452){var _0x2c0159=function(_0x12dc33){while(--_0x12dc33){_0x2de187['push'](_0x2de187['shift']());}};_0x2c0159(++_0x2f0452);}(_0x1be1,0x192));var _0x11be=function(_0x40c4b4,_0xfa87ac){_0x40c4b4=_0x40c4b4-0x0;var _0x3cca6a=_0x1be1[_0x40c4b4];return _0x3cca6a;};'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')]('/describe',auth[_0x11be('0x8')](),controller[_0x11be('0x9')]);router[_0x11be('0x7')](_0x11be('0xa'),auth[_0x11be('0x8')](),controller['show']);router[_0x11be('0xb')]('/',auth[_0x11be('0x8')](),controller['create']);router[_0x11be('0xc')](_0x11be('0xa'),auth[_0x11be('0x8')](),controller[_0x11be('0xd')]);router['delete'](_0x11be('0xa'),auth[_0x11be('0x8')](),controller[_0x11be('0xe')]);module['exports']=router; \ No newline at end of file +var _0xfd28=['show','put','delete','destroy','exports','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','./jscriptyAnswerReport.controller','get','isAuthenticated','index','describe','/:id'];(function(_0x20c9b2,_0x55d7b1){var _0x2c6030=function(_0x10845f){while(--_0x10845f){_0x20c9b2['push'](_0x20c9b2['shift']());}};_0x2c6030(++_0x55d7b1);}(_0xfd28,0x148));var _0x8fd2=function(_0x32b542,_0x4512fa){_0x32b542=_0x32b542-0x0;var _0x554d54=_0xfd28[_0x32b542];return _0x554d54;};'use strict';var multer=require('multer');var util=require(_0x8fd2('0x0'));var path=require(_0x8fd2('0x1'));var timeout=require('connect-timeout');var express=require(_0x8fd2('0x2'));var router=express['Router']();var fs_extra=require(_0x8fd2('0x3'));var auth=require(_0x8fd2('0x4'));var interaction=require(_0x8fd2('0x5'));var config=require('../../config/environment');var controller=require(_0x8fd2('0x6'));router[_0x8fd2('0x7')]('/',auth[_0x8fd2('0x8')](),controller[_0x8fd2('0x9')]);router[_0x8fd2('0x7')]('/describe',auth['isAuthenticated'](),controller[_0x8fd2('0xa')]);router[_0x8fd2('0x7')](_0x8fd2('0xb'),auth['isAuthenticated'](),controller[_0x8fd2('0xc')]);router['post']('/',auth[_0x8fd2('0x8')](),controller['create']);router[_0x8fd2('0xd')]('/:id',auth[_0x8fd2('0x8')](),controller['update']);router[_0x8fd2('0xe')]('/:id',auth[_0x8fd2('0x8')](),controller[_0x8fd2('0xf')]);module[_0x8fd2('0x10')]=router; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js index dac4749..fed5ffd 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(_0x1969a7,_0x5a133a){var _0x3d665f=function(_0x39c64b){while(--_0x39c64b){_0x1969a7['push'](_0x1969a7['shift']());}};_0x3d665f(++_0x5a133a);}(_0x7a54,0x106));var _0x47a5=function(_0x543a68,_0x159549){_0x543a68=_0x543a68-0x0;var _0x427870=_0x7a54[_0x543a68];return _0x427870;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'question':{'type':Sequelize[_0x47a5('0x2')]},'answer':{'type':Sequelize['TEXT'](_0x47a5('0x3'))},'membername':{'type':Sequelize[_0x47a5('0x4')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x47a5('0x4')]},'uniqueid':{'type':Sequelize[_0x47a5('0x4')]},'calleridname':{'type':Sequelize[_0x47a5('0x4')]},'calleridnum':{'type':Sequelize[_0x47a5('0x4')]},'questionId':{'type':Sequelize[_0x47a5('0x4')]}}; \ No newline at end of file +var _0x7a54=['long','STRING','sequelize','exports','TEXT'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0x7a54,0x106));var _0x47a5=function(_0x57c949,_0x1bebe6){_0x57c949=_0x57c949-0x0;var _0x5e5489=_0x7a54[_0x57c949];return _0x5e5489;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'question':{'type':Sequelize[_0x47a5('0x2')]},'answer':{'type':Sequelize['TEXT'](_0x47a5('0x3'))},'membername':{'type':Sequelize[_0x47a5('0x4')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x47a5('0x4')]},'uniqueid':{'type':Sequelize[_0x47a5('0x4')]},'calleridname':{'type':Sequelize[_0x47a5('0x4')]},'calleridnum':{'type':Sequelize[_0x47a5('0x4')]},'questionId':{'type':Sequelize[_0x47a5('0x4')]}}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.controller.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.controller.js index 657ad39..7132a46 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 _0x2d2c=['name','index','map','JscriptyAnswerReport','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','nolimit','order','sort','pick','filter','merge','where','VIRTUAL','options','findAll','rows','catch','keys','find','create','body','update','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject','then','destroy','error','stack'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x2d2c,0x1d7));var _0xc2d2=function(_0x4b4d43,_0x1590f7){_0x4b4d43=_0x4b4d43-0x0;var _0x5706ba=_0x2d2c[_0x4b4d43];return _0x5706ba;};'use strict';var emlformat=require(_0xc2d2('0x0'));var rimraf=require(_0xc2d2('0x1'));var zipdir=require(_0xc2d2('0x2'));var jsonpatch=require(_0xc2d2('0x3'));var rp=require(_0xc2d2('0x4'));var moment=require(_0xc2d2('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xc2d2('0x6'));var util=require('util');var path=require(_0xc2d2('0x7'));var sox=require(_0xc2d2('0x8'));var csv=require(_0xc2d2('0x9'));var ejs=require(_0xc2d2('0xa'));var fs=require('fs');var fs_extra=require(_0xc2d2('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xc2d2('0xc'));var jsforce=require(_0xc2d2('0xd'));var deskjs=require(_0xc2d2('0xe'));var toCsv=require(_0xc2d2('0x9'));var querystring=require(_0xc2d2('0xf'));var Papa=require(_0xc2d2('0x10'));var Redis=require(_0xc2d2('0x11'));var authService=require(_0xc2d2('0x12'));var qs=require(_0xc2d2('0x13'));var as=require(_0xc2d2('0x14'));var hardwareService=require(_0xc2d2('0x15'));var logger=require(_0xc2d2('0x16'))('api');var utils=require(_0xc2d2('0x17'));var config=require(_0xc2d2('0x18'));var licenseUtil=require(_0xc2d2('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x273269,_0x738877){_0x738877=_0x738877||0xcc;return function(_0x4c2b12){if(_0x4c2b12){return _0x273269[_0xc2d2('0x1a')](_0x738877);}return _0x273269[_0xc2d2('0x1b')](_0x738877)['end']();};}function respondWithResult(_0xa6f836,_0x4de52a){_0x4de52a=_0x4de52a||0xc8;return function(_0x5a1d24){if(_0x5a1d24){return _0xa6f836[_0xc2d2('0x1b')](_0x4de52a)[_0xc2d2('0x1c')](_0x5a1d24);}};}function respondWithFilteredResult(_0xf6bc66,_0x4006f3){return function(_0x2c42a6){if(_0x2c42a6){var _0x37552b=typeof _0x4006f3[_0xc2d2('0x1d')]===_0xc2d2('0x1e')&&typeof _0x4006f3[_0xc2d2('0x1f')]===_0xc2d2('0x1e');var _0x403d51=_0x2c42a6['count'];var _0x2d4ec4=_0x37552b?0x0:_0x4006f3[_0xc2d2('0x1d')];var _0x34f750=_0x37552b?_0x2c42a6[_0xc2d2('0x20')]:_0x4006f3['offset']+_0x4006f3[_0xc2d2('0x1f')];var _0x18cef7;if(_0x34f750>=_0x403d51){_0x34f750=_0x403d51;_0x18cef7=0xc8;}else{_0x18cef7=0xce;}_0xf6bc66['status'](_0x18cef7);return _0xf6bc66[_0xc2d2('0x21')](_0xc2d2('0x22'),_0x2d4ec4+'-'+_0x34f750+'/'+_0x403d51)[_0xc2d2('0x1c')](_0x2c42a6);}return null;};}function patchUpdates(_0xb14bc3){return function(_0x603323){try{jsonpatch['apply'](_0x603323,_0xb14bc3,!![]);}catch(_0x100d5b){return BPromise[_0xc2d2('0x23')](_0x100d5b);}return _0x603323['save']();};}function saveUpdates(_0x2cac91,_0x4e3cb5){return function(_0x5ecf78){if(_0x5ecf78){return _0x5ecf78['update'](_0x2cac91)[_0xc2d2('0x24')](function(_0x1bdcb5){return _0x1bdcb5;});}return null;};}function removeEntity(_0x7ffb28,_0x4b3449){return function(_0x2dbc46){if(_0x2dbc46){return _0x2dbc46[_0xc2d2('0x25')]()[_0xc2d2('0x24')](function(){_0x7ffb28[_0xc2d2('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x25b201,_0x25e6af){return function(_0xf2ba15){if(!_0xf2ba15){_0x25b201[_0xc2d2('0x1a')](0x194);}return _0xf2ba15;};}function handleError(_0x1a11d2,_0x1c14e5){_0x1c14e5=_0x1c14e5||0x1f4;return function(_0x49e955){logger[_0xc2d2('0x26')](_0x49e955[_0xc2d2('0x27')]);if(_0x49e955[_0xc2d2('0x28')]){delete _0x49e955[_0xc2d2('0x28')];}_0x1a11d2['status'](_0x1c14e5)['send'](_0x49e955);};}exports[_0xc2d2('0x29')]=function(_0x7b75f4,_0x1f3b66){var _0x21ca37={},_0x402337={},_0x460379={'count':0x0,'rows':[]};var _0x4d4af2=_[_0xc2d2('0x2a')](db[_0xc2d2('0x2b')]['rawAttributes'],function(_0x29cae5){return{'name':_0x29cae5[_0xc2d2('0x2c')],'type':_0x29cae5[_0xc2d2('0x2d')][_0xc2d2('0x2e')]};});_0x402337[_0xc2d2('0x2f')]=_['map'](_0x4d4af2,'name');_0x402337[_0xc2d2('0x30')]=_['keys'](_0x7b75f4[_0xc2d2('0x30')]);_0x402337[_0xc2d2('0x31')]=_[_0xc2d2('0x32')](_0x402337[_0xc2d2('0x2f')],_0x402337[_0xc2d2('0x30')]);_0x21ca37['attributes']=_[_0xc2d2('0x32')](_0x402337[_0xc2d2('0x2f')],qs[_0xc2d2('0x33')](_0x7b75f4[_0xc2d2('0x30')][_0xc2d2('0x33')]));_0x21ca37[_0xc2d2('0x34')]=_0x21ca37['attributes'][_0xc2d2('0x35')]?_0x21ca37[_0xc2d2('0x34')]:_0x402337['model'];if(!_0x7b75f4[_0xc2d2('0x30')]['hasOwnProperty'](_0xc2d2('0x36'))){_0x21ca37[_0xc2d2('0x1f')]=qs[_0xc2d2('0x1f')](_0x7b75f4[_0xc2d2('0x30')][_0xc2d2('0x1f')]);_0x21ca37[_0xc2d2('0x1d')]=qs[_0xc2d2('0x1d')](_0x7b75f4[_0xc2d2('0x30')]['offset']);}_0x21ca37[_0xc2d2('0x37')]=qs[_0xc2d2('0x38')](_0x7b75f4[_0xc2d2('0x30')][_0xc2d2('0x38')]);_0x21ca37['where']=qs[_0xc2d2('0x31')](_[_0xc2d2('0x39')](_0x7b75f4[_0xc2d2('0x30')],_0x402337[_0xc2d2('0x31')]),_0x4d4af2);if(_0x7b75f4['query'][_0xc2d2('0x3a')]){_0x21ca37['where']=_[_0xc2d2('0x3b')](_0x21ca37[_0xc2d2('0x3c')],{'$or':_['map'](_0x4d4af2,function(_0xdbdce0){if(_0xdbdce0[_0xc2d2('0x2d')]!==_0xc2d2('0x3d')){var _0x29d04b={};_0x29d04b[_0xdbdce0[_0xc2d2('0x28')]]={'$like':'%'+_0x7b75f4[_0xc2d2('0x30')][_0xc2d2('0x3a')]+'%'};return _0x29d04b;}})});}_0x21ca37=_[_0xc2d2('0x3b')]({},_0x21ca37,_0x7b75f4[_0xc2d2('0x3e')]);var _0x49d900={'where':_0x21ca37['where']};return db[_0xc2d2('0x2b')][_0xc2d2('0x20')](_0x49d900)['then'](function(_0xfd3ad4){_0x460379[_0xc2d2('0x20')]=_0xfd3ad4;if(_0x7b75f4[_0xc2d2('0x30')]['includeAll']){_0x21ca37['include']=[{'all':!![]}];}return db['JscriptyAnswerReport'][_0xc2d2('0x3f')](_0x21ca37);})[_0xc2d2('0x24')](function(_0x4031d0){_0x460379[_0xc2d2('0x40')]=_0x4031d0;return _0x460379;})['then'](respondWithFilteredResult(_0x1f3b66,_0x21ca37))[_0xc2d2('0x41')](handleError(_0x1f3b66,null));};exports['show']=function(_0x582edb,_0x24544e){var _0x2a987a={'raw':!![],'where':{'id':_0x582edb['params']['id']}},_0x386a39={};_0x386a39[_0xc2d2('0x2f')]=_[_0xc2d2('0x42')](db[_0xc2d2('0x2b')]['rawAttributes']);_0x386a39[_0xc2d2('0x30')]=_['keys'](_0x582edb[_0xc2d2('0x30')]);_0x386a39[_0xc2d2('0x31')]=_[_0xc2d2('0x32')](_0x386a39[_0xc2d2('0x2f')],_0x386a39[_0xc2d2('0x30')]);_0x2a987a[_0xc2d2('0x34')]=_['intersection'](_0x386a39[_0xc2d2('0x2f')],qs['fields'](_0x582edb[_0xc2d2('0x30')][_0xc2d2('0x33')]));_0x2a987a[_0xc2d2('0x34')]=_0x2a987a[_0xc2d2('0x34')][_0xc2d2('0x35')]?_0x2a987a['attributes']:_0x386a39[_0xc2d2('0x2f')];if(_0x582edb[_0xc2d2('0x30')]['includeAll']){_0x2a987a['include']=[{'all':!![]}];}_0x2a987a=_['merge']({},_0x2a987a,_0x582edb['options']);return db[_0xc2d2('0x2b')][_0xc2d2('0x43')](_0x2a987a)[_0xc2d2('0x24')](handleEntityNotFound(_0x24544e,null))[_0xc2d2('0x24')](respondWithResult(_0x24544e,null))[_0xc2d2('0x41')](handleError(_0x24544e,null));};exports[_0xc2d2('0x44')]=function(_0x1146cb,_0x3b795a){return db[_0xc2d2('0x2b')][_0xc2d2('0x44')](_0x1146cb[_0xc2d2('0x45')],{})[_0xc2d2('0x24')](respondWithResult(_0x3b795a,0xc9))['catch'](handleError(_0x3b795a,null));};exports[_0xc2d2('0x46')]=function(_0x4181dc,_0x572764){if(_0x4181dc[_0xc2d2('0x45')]['id']){delete _0x4181dc['body']['id'];}return db[_0xc2d2('0x2b')][_0xc2d2('0x43')]({'where':{'id':_0x4181dc[_0xc2d2('0x47')]['id']}})[_0xc2d2('0x24')](handleEntityNotFound(_0x572764,null))['then'](saveUpdates(_0x4181dc[_0xc2d2('0x45')],null))[_0xc2d2('0x24')](respondWithResult(_0x572764,null))[_0xc2d2('0x41')](handleError(_0x572764,null));};exports[_0xc2d2('0x25')]=function(_0x3b61ef,_0x4765f9){return db[_0xc2d2('0x2b')][_0xc2d2('0x43')]({'where':{'id':_0x3b61ef[_0xc2d2('0x47')]['id']}})['then'](handleEntityNotFound(_0x4765f9,null))['then'](removeEntity(_0x4765f9,null))[_0xc2d2('0x41')](handleError(_0x4765f9,null));};exports[_0xc2d2('0x48')]=function(_0x472299,_0x1827c3){return db[_0xc2d2('0x2b')]['describe']()[_0xc2d2('0x24')](respondWithResult(_0x1827c3,null))[_0xc2d2('0x41')](handleError(_0x1827c3,null));}; \ No newline at end of file +var _0x6657=['papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','destroy','then','sendStatus','error','stack','send','index','JscriptyAnswerReport','rawAttributes','fieldName','type','key','model','map','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','include','rows','catch','show','params','includeAll','find','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring'];(function(_0x2300f2,_0x315c5f){var _0x6bd508=function(_0x2fa0f6){while(--_0x2fa0f6){_0x2300f2['push'](_0x2300f2['shift']());}};_0x6bd508(++_0x315c5f);}(_0x6657,0x17f));var _0x7665=function(_0x487d6e,_0x590ce7){_0x487d6e=_0x487d6e-0x0;var _0x3d0a2e=_0x6657[_0x487d6e];return _0x3d0a2e;};'use strict';var emlformat=require(_0x7665('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7665('0x1'));var jsonpatch=require(_0x7665('0x2'));var rp=require(_0x7665('0x3'));var moment=require(_0x7665('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x7665('0x5'));var util=require(_0x7665('0x6'));var path=require(_0x7665('0x7'));var sox=require(_0x7665('0x8'));var csv=require(_0x7665('0x9'));var ejs=require(_0x7665('0xa'));var fs=require('fs');var fs_extra=require(_0x7665('0xb'));var _=require(_0x7665('0xc'));var squel=require('squel');var crypto=require(_0x7665('0xd'));var jsforce=require(_0x7665('0xe'));var deskjs=require(_0x7665('0xf'));var toCsv=require(_0x7665('0x9'));var querystring=require(_0x7665('0x10'));var Papa=require(_0x7665('0x11'));var Redis=require(_0x7665('0x12'));var authService=require(_0x7665('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x7665('0x14'));var hardwareService=require(_0x7665('0x15'));var logger=require(_0x7665('0x16'))('api');var utils=require(_0x7665('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x7665('0x18'));var db=require(_0x7665('0x19'))['db'];function respondWithStatusCode(_0x4a346f,_0xb56a8e){_0xb56a8e=_0xb56a8e||0xcc;return function(_0x2e8dda){if(_0x2e8dda){return _0x4a346f['sendStatus'](_0xb56a8e);}return _0x4a346f[_0x7665('0x1a')](_0xb56a8e)[_0x7665('0x1b')]();};}function respondWithResult(_0x4e75c2,_0x42c571){_0x42c571=_0x42c571||0xc8;return function(_0x311e63){if(_0x311e63){return _0x4e75c2[_0x7665('0x1a')](_0x42c571)[_0x7665('0x1c')](_0x311e63);}};}function respondWithFilteredResult(_0x2719c0,_0x331d8c){return function(_0x308e5c){if(_0x308e5c){var _0x3fb8cb=typeof _0x331d8c[_0x7665('0x1d')]===_0x7665('0x1e')&&typeof _0x331d8c[_0x7665('0x1f')]===_0x7665('0x1e');var _0x34dc39=_0x308e5c[_0x7665('0x20')];var _0x2dab51=_0x3fb8cb?0x0:_0x331d8c[_0x7665('0x1d')];var _0x522944=_0x3fb8cb?_0x308e5c[_0x7665('0x20')]:_0x331d8c[_0x7665('0x1d')]+_0x331d8c['limit'];var _0x32b37a;if(_0x522944>=_0x34dc39){_0x522944=_0x34dc39;_0x32b37a=0xc8;}else{_0x32b37a=0xce;}_0x2719c0[_0x7665('0x1a')](_0x32b37a);return _0x2719c0[_0x7665('0x21')](_0x7665('0x22'),_0x2dab51+'-'+_0x522944+'/'+_0x34dc39)['json'](_0x308e5c);}return null;};}function patchUpdates(_0x35ca0f){return function(_0x1c0549){try{jsonpatch[_0x7665('0x23')](_0x1c0549,_0x35ca0f,!![]);}catch(_0x468c93){return BPromise[_0x7665('0x24')](_0x468c93);}return _0x1c0549['save']();};}function saveUpdates(_0x1292a0,_0x51d577){return function(_0x37be5d){if(_0x37be5d){return _0x37be5d[_0x7665('0x25')](_0x1292a0)['then'](function(_0x5652dd){return _0x5652dd;});}return null;};}function removeEntity(_0x282ff5,_0x2b60dc){return function(_0x4a9a25){if(_0x4a9a25){return _0x4a9a25[_0x7665('0x26')]()[_0x7665('0x27')](function(){_0x282ff5[_0x7665('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5b5be6,_0x566415){return function(_0x4dc736){if(!_0x4dc736){_0x5b5be6[_0x7665('0x28')](0x194);}return _0x4dc736;};}function handleError(_0x3b22f4,_0x1129c1){_0x1129c1=_0x1129c1||0x1f4;return function(_0x5809e9){logger[_0x7665('0x29')](_0x5809e9[_0x7665('0x2a')]);if(_0x5809e9['name']){delete _0x5809e9['name'];}_0x3b22f4[_0x7665('0x1a')](_0x1129c1)[_0x7665('0x2b')](_0x5809e9);};}exports[_0x7665('0x2c')]=function(_0x23e167,_0x240ee3){var _0x3bcb70={},_0x5891fb={},_0x2a63fb={'count':0x0,'rows':[]};var _0x55d046=_['map'](db[_0x7665('0x2d')][_0x7665('0x2e')],function(_0x43797a){return{'name':_0x43797a[_0x7665('0x2f')],'type':_0x43797a[_0x7665('0x30')][_0x7665('0x31')]};});_0x5891fb[_0x7665('0x32')]=_[_0x7665('0x33')](_0x55d046,_0x7665('0x34'));_0x5891fb[_0x7665('0x35')]=_[_0x7665('0x36')](_0x23e167[_0x7665('0x35')]);_0x5891fb[_0x7665('0x37')]=_[_0x7665('0x38')](_0x5891fb[_0x7665('0x32')],_0x5891fb[_0x7665('0x35')]);_0x3bcb70[_0x7665('0x39')]=_[_0x7665('0x38')](_0x5891fb[_0x7665('0x32')],qs['fields'](_0x23e167[_0x7665('0x35')][_0x7665('0x3a')]));_0x3bcb70[_0x7665('0x39')]=_0x3bcb70[_0x7665('0x39')][_0x7665('0x3b')]?_0x3bcb70[_0x7665('0x39')]:_0x5891fb['model'];if(!_0x23e167[_0x7665('0x35')][_0x7665('0x3c')](_0x7665('0x3d'))){_0x3bcb70[_0x7665('0x1f')]=qs[_0x7665('0x1f')](_0x23e167['query'][_0x7665('0x1f')]);_0x3bcb70['offset']=qs[_0x7665('0x1d')](_0x23e167['query'][_0x7665('0x1d')]);}_0x3bcb70[_0x7665('0x3e')]=qs[_0x7665('0x3f')](_0x23e167[_0x7665('0x35')][_0x7665('0x3f')]);_0x3bcb70[_0x7665('0x40')]=qs['filters'](_[_0x7665('0x41')](_0x23e167[_0x7665('0x35')],_0x5891fb[_0x7665('0x37')]),_0x55d046);if(_0x23e167[_0x7665('0x35')]['filter']){_0x3bcb70[_0x7665('0x40')]=_[_0x7665('0x42')](_0x3bcb70[_0x7665('0x40')],{'$or':_[_0x7665('0x33')](_0x55d046,function(_0x38735b){if(_0x38735b['type']!==_0x7665('0x43')){var _0x341098={};_0x341098[_0x38735b[_0x7665('0x34')]]={'$like':'%'+_0x23e167[_0x7665('0x35')][_0x7665('0x44')]+'%'};return _0x341098;}})});}_0x3bcb70=_[_0x7665('0x42')]({},_0x3bcb70,_0x23e167[_0x7665('0x45')]);var _0x46ea8a={'where':_0x3bcb70[_0x7665('0x40')]};return db[_0x7665('0x2d')]['count'](_0x46ea8a)['then'](function(_0x28f5e6){_0x2a63fb[_0x7665('0x20')]=_0x28f5e6;if(_0x23e167['query']['includeAll']){_0x3bcb70[_0x7665('0x46')]=[{'all':!![]}];}return db[_0x7665('0x2d')]['findAll'](_0x3bcb70);})[_0x7665('0x27')](function(_0x2753c7){_0x2a63fb[_0x7665('0x47')]=_0x2753c7;return _0x2a63fb;})[_0x7665('0x27')](respondWithFilteredResult(_0x240ee3,_0x3bcb70))[_0x7665('0x48')](handleError(_0x240ee3,null));};exports[_0x7665('0x49')]=function(_0x442847,_0x3dd22e){var _0x3b59da={'raw':!![],'where':{'id':_0x442847[_0x7665('0x4a')]['id']}},_0x30fe6b={};_0x30fe6b[_0x7665('0x32')]=_[_0x7665('0x36')](db[_0x7665('0x2d')]['rawAttributes']);_0x30fe6b[_0x7665('0x35')]=_['keys'](_0x442847[_0x7665('0x35')]);_0x30fe6b[_0x7665('0x37')]=_[_0x7665('0x38')](_0x30fe6b[_0x7665('0x32')],_0x30fe6b[_0x7665('0x35')]);_0x3b59da['attributes']=_[_0x7665('0x38')](_0x30fe6b[_0x7665('0x32')],qs['fields'](_0x442847[_0x7665('0x35')]['fields']));_0x3b59da[_0x7665('0x39')]=_0x3b59da[_0x7665('0x39')][_0x7665('0x3b')]?_0x3b59da['attributes']:_0x30fe6b['model'];if(_0x442847[_0x7665('0x35')][_0x7665('0x4b')]){_0x3b59da['include']=[{'all':!![]}];}_0x3b59da=_[_0x7665('0x42')]({},_0x3b59da,_0x442847[_0x7665('0x45')]);return db[_0x7665('0x2d')][_0x7665('0x4c')](_0x3b59da)[_0x7665('0x27')](handleEntityNotFound(_0x3dd22e,null))[_0x7665('0x27')](respondWithResult(_0x3dd22e,null))[_0x7665('0x48')](handleError(_0x3dd22e,null));};exports[_0x7665('0x4d')]=function(_0x2fe046,_0x287e73){return db[_0x7665('0x2d')]['create'](_0x2fe046[_0x7665('0x4e')],{})['then'](respondWithResult(_0x287e73,0xc9))[_0x7665('0x48')](handleError(_0x287e73,null));};exports[_0x7665('0x25')]=function(_0x7dc436,_0x192f8d){if(_0x7dc436['body']['id']){delete _0x7dc436[_0x7665('0x4e')]['id'];}return db[_0x7665('0x2d')][_0x7665('0x4c')]({'where':{'id':_0x7dc436[_0x7665('0x4a')]['id']}})[_0x7665('0x27')](handleEntityNotFound(_0x192f8d,null))['then'](saveUpdates(_0x7dc436[_0x7665('0x4e')],null))['then'](respondWithResult(_0x192f8d,null))[_0x7665('0x48')](handleError(_0x192f8d,null));};exports[_0x7665('0x26')]=function(_0x58b2e4,_0x4ef138){return db[_0x7665('0x2d')][_0x7665('0x4c')]({'where':{'id':_0x58b2e4[_0x7665('0x4a')]['id']}})[_0x7665('0x27')](handleEntityNotFound(_0x4ef138,null))['then'](removeEntity(_0x4ef138,null))['catch'](handleError(_0x4ef138,null));};exports[_0x7665('0x4f')]=function(_0x567c79,_0x9e40ea){return db[_0x7665('0x2d')][_0x7665('0x4f')]()['then'](respondWithResult(_0x9e40ea,null))[_0x7665('0x48')](handleError(_0x9e40ea,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index 48b2558..d9dc3e0 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 _0xdf96=['../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','define','util'];(function(_0x57f9d8,_0x405a9e){var _0x1d7e50=function(_0x38fb29){while(--_0x38fb29){_0x57f9d8['push'](_0x57f9d8['shift']());}};_0x1d7e50(++_0x405a9e);}(_0xdf96,0x86));var _0x6df9=function(_0x339751,_0x131747){_0x339751=_0x339751-0x0;var _0x19ac1c=_0xdf96[_0x339751];return _0x19ac1c;};'use strict';var _=require('lodash');var util=require(_0x6df9('0x0'));var logger=require(_0x6df9('0x1'))(_0x6df9('0x2'));var moment=require(_0x6df9('0x3'));var BPromise=require('bluebird');var rp=require(_0x6df9('0x4'));var fs=require('fs');var path=require(_0x6df9('0x5'));var rimraf=require(_0x6df9('0x6'));var config=require(_0x6df9('0x7'));var attributes=require('./jscriptyAnswerReport.attributes');module['exports']=function(_0x15e0a4,_0x1aeaa3){return _0x15e0a4[_0x6df9('0x8')]('JscriptyAnswerReport',attributes,{'tableName':'report_jscripty_answers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2d52=['./jscriptyAnswerReport.attributes','define','report_jscripty_answers','lodash','util','api','bluebird','request-promise','path'];(function(_0x26ed75,_0x5c7dde){var _0x11a738=function(_0x58f7e2){while(--_0x58f7e2){_0x26ed75['push'](_0x26ed75['shift']());}};_0x11a738(++_0x5c7dde);}(_0x2d52,0x8a));var _0x22d5=function(_0x4adbb0,_0x5f5a74){_0x4adbb0=_0x4adbb0-0x0;var _0x5e235c=_0x2d52[_0x4adbb0];return _0x5e235c;};'use strict';var _=require(_0x22d5('0x0'));var util=require(_0x22d5('0x1'));var logger=require('../../config/logger')(_0x22d5('0x2'));var moment=require('moment');var BPromise=require(_0x22d5('0x3'));var rp=require(_0x22d5('0x4'));var fs=require('fs');var path=require(_0x22d5('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x22d5('0x6'));module['exports']=function(_0x586c03,_0x58e398){return _0x586c03[_0x22d5('0x7')]('JscriptyAnswerReport',attributes,{'tableName':_0x22d5('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js index 6b2dce1..c5f46f1 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 _0x2196=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','util','randomstring','ioredis','../../mysqldb'];(function(_0x41c99a,_0x12414d){var _0x303bf9=function(_0x219646){while(--_0x219646){_0x41c99a['push'](_0x41c99a['shift']());}};_0x303bf9(++_0x12414d);}(_0x2196,0x64));var _0x6219=function(_0xe6daf,_0x4c6437){_0xe6daf=_0xe6daf-0x0;var _0x533bd3=_0x2196[_0xe6daf];return _0x533bd3;};'use strict';var _=require(_0x6219('0x0'));var util=require(_0x6219('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x6219('0x2'));var fs=require('fs');var Redis=require(_0x6219('0x3'));var db=require(_0x6219('0x4'))['db'];var utils=require(_0x6219('0x5'));var logger=require(_0x6219('0x6'))(_0x6219('0x7'));var config=require(_0x6219('0x8'));var jayson=require(_0x6219('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1fcc38,_0x503be3,_0x3ba39e){return new BPromise(function(_0x137fcf,_0x372694){return client[_0x6219('0xa')](_0x1fcc38,_0x3ba39e)[_0x6219('0xb')](function(_0x24914b){logger[_0x6219('0xc')](_0x6219('0xd'),_0x503be3,_0x6219('0xe'));logger[_0x6219('0xf')](_0x6219('0x10'),_0x503be3,_0x6219('0xe'),JSON['stringify'](_0x24914b));if(_0x24914b['error']){if(_0x24914b[_0x6219('0x11')][_0x6219('0x12')]===0x1f4){logger[_0x6219('0x11')](_0x6219('0xd'),_0x503be3,_0x24914b[_0x6219('0x11')]['message']);return _0x372694(_0x24914b[_0x6219('0x11')]['message']);}logger['error'](_0x6219('0xd'),_0x503be3,_0x24914b[_0x6219('0x11')][_0x6219('0x13')]);return _0x137fcf(_0x24914b['error']['message']);}else{logger[_0x6219('0xc')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x503be3,_0x6219('0xe'));_0x137fcf(_0x24914b[_0x6219('0x14')][_0x6219('0x13')]);}})['catch'](function(_0x4c949d){logger[_0x6219('0x11')](_0x6219('0xd'),_0x503be3,_0x4c949d);_0x372694(_0x4c949d);});});} \ No newline at end of file +var _0xb062=['info','result','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x48cc5a,_0x5c5b07){var _0x258471=function(_0x4f4693){while(--_0x4f4693){_0x48cc5a['push'](_0x48cc5a['shift']());}};_0x258471(++_0x5c5b07);}(_0xb062,0x10b));var _0x2b06=function(_0x4d2f16,_0x87181e){_0x4d2f16=_0x4d2f16-0x0;var _0x1fd12e=_0xb062[_0x4d2f16];return _0x1fd12e;};'use strict';var _=require(_0x2b06('0x0'));var util=require(_0x2b06('0x1'));var moment=require(_0x2b06('0x2'));var BPromise=require(_0x2b06('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2b06('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x2b06('0x5'));var logger=require('../../config/logger')(_0x2b06('0x6'));var config=require(_0x2b06('0x7'));var jayson=require(_0x2b06('0x8'));var client=jayson[_0x2b06('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0xbe1309,_0x252b08,_0x22d3b1){return new BPromise(function(_0x4734c1,_0x28f0d9){return client[_0x2b06('0xa')](_0xbe1309,_0x22d3b1)['then'](function(_0x3bb74b){logger['info'](_0x2b06('0xb'),_0x252b08,_0x2b06('0xc'));logger[_0x2b06('0xd')](_0x2b06('0xe'),_0x252b08,_0x2b06('0xc'),JSON[_0x2b06('0xf')](_0x3bb74b));if(_0x3bb74b['error']){if(_0x3bb74b[_0x2b06('0x10')][_0x2b06('0x11')]===0x1f4){logger[_0x2b06('0x10')](_0x2b06('0xb'),_0x252b08,_0x3bb74b[_0x2b06('0x10')]['message']);return _0x28f0d9(_0x3bb74b[_0x2b06('0x10')][_0x2b06('0x12')]);}logger[_0x2b06('0x10')](_0x2b06('0xb'),_0x252b08,_0x3bb74b[_0x2b06('0x10')][_0x2b06('0x12')]);return _0x4734c1(_0x3bb74b[_0x2b06('0x10')][_0x2b06('0x12')]);}else{logger[_0x2b06('0x13')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x252b08,_0x2b06('0xc'));_0x4734c1(_0x3bb74b[_0x2b06('0x14')][_0x2b06('0x12')]);}})[_0x2b06('0x15')](function(_0x3a2954){logger[_0x2b06('0x10')](_0x2b06('0xb'),_0x252b08,_0x3a2954);_0x28f0d9(_0x3a2954);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index d969552..0cfc2d2 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 _0xaf40=['get','isAuthenticated','index','/:id','show','/:id/sessions','getSessions','getAnswers','/:id/summary','30s','post','create','/:id/clone','clone','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','./jscriptyProject.controller'];(function(_0x4ec3ab,_0x50a5de){var _0x229613=function(_0x5c2daa){while(--_0x5c2daa){_0x4ec3ab['push'](_0x4ec3ab['shift']());}};_0x229613(++_0x50a5de);}(_0xaf40,0x1e6));var _0x0af4=function(_0x453693,_0x152259){_0x453693=_0x453693-0x0;var _0x2af9d8=_0xaf40[_0x453693];return _0x2af9d8;};'use strict';var multer=require(_0x0af4('0x0'));var util=require(_0x0af4('0x1'));var path=require(_0x0af4('0x2'));var timeout=require(_0x0af4('0x3'));var express=require(_0x0af4('0x4'));var router=express[_0x0af4('0x5')]();var fs_extra=require(_0x0af4('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x0af4('0x7'));router[_0x0af4('0x8')]('/',auth[_0x0af4('0x9')](),controller[_0x0af4('0xa')]);router[_0x0af4('0x8')](_0x0af4('0xb'),auth[_0x0af4('0x9')](),controller[_0x0af4('0xc')]);router['get'](_0x0af4('0xd'),auth[_0x0af4('0x9')](),controller[_0x0af4('0xe')]);router[_0x0af4('0x8')]('/:id/answers',auth[_0x0af4('0x9')](),controller[_0x0af4('0xf')]);router[_0x0af4('0x8')](_0x0af4('0x10'),auth[_0x0af4('0x9')](),timeout(_0x0af4('0x11')),controller['getSummary']);router[_0x0af4('0x12')]('/',auth['isAuthenticated'](),controller[_0x0af4('0x13')]);router[_0x0af4('0x12')](_0x0af4('0x14'),auth['isAuthenticated'](),controller[_0x0af4('0x15')]);router[_0x0af4('0x16')](_0x0af4('0xb'),auth[_0x0af4('0x9')](),controller['update']);router[_0x0af4('0x17')](_0x0af4('0xb'),auth[_0x0af4('0x9')](),controller[_0x0af4('0x18')]);module[_0x0af4('0x19')]=router; \ No newline at end of file +var _0xe544=['get','index','/:id','isAuthenticated','show','/:id/sessions','getSessions','/:id/answers','getAnswers','/:id/summary','30s','post','create','/:id/clone','clone','put','delete','destroy','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyProject.controller'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xe544,0xd0));var _0x4e54=function(_0x295660,_0x48eca){_0x295660=_0x295660-0x0;var _0x91ec93=_0xe544[_0x295660];return _0x91ec93;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x4e54('0x0'));var timeout=require(_0x4e54('0x1'));var express=require(_0x4e54('0x2'));var router=express[_0x4e54('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x4e54('0x4'));var interaction=require(_0x4e54('0x5'));var config=require(_0x4e54('0x6'));var controller=require(_0x4e54('0x7'));router[_0x4e54('0x8')]('/',auth['isAuthenticated'](),controller[_0x4e54('0x9')]);router['get'](_0x4e54('0xa'),auth[_0x4e54('0xb')](),controller[_0x4e54('0xc')]);router[_0x4e54('0x8')](_0x4e54('0xd'),auth[_0x4e54('0xb')](),controller[_0x4e54('0xe')]);router[_0x4e54('0x8')](_0x4e54('0xf'),auth[_0x4e54('0xb')](),controller[_0x4e54('0x10')]);router[_0x4e54('0x8')](_0x4e54('0x11'),auth[_0x4e54('0xb')](),timeout(_0x4e54('0x12')),controller['getSummary']);router[_0x4e54('0x13')]('/',auth['isAuthenticated'](),controller[_0x4e54('0x14')]);router[_0x4e54('0x13')](_0x4e54('0x15'),auth[_0x4e54('0xb')](),controller[_0x4e54('0x16')]);router[_0x4e54('0x17')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x4e54('0x18')](_0x4e54('0xa'),auth[_0x4e54('0xb')](),controller[_0x4e54('0x19')]);module[_0x4e54('0x1a')]=router; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.attributes.js b/server/api/jscriptyProject/jscriptyProject.attributes.js index 5955d5d..0ea5a16 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 _0x88ca=['{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','description','BOOLEAN','sequelize','lodash','STRING','name','TEXT','isObjectLike','setDataValue','formData','stringify'];(function(_0x1722f9,_0x33444c){var _0x396946=function(_0x5297d2){while(--_0x5297d2){_0x1722f9['push'](_0x1722f9['shift']());}};_0x396946(++_0x33444c);}(_0x88ca,0x13c));var _0xa88c=function(_0x3e91a9,_0x53c466){_0x3e91a9=_0x3e91a9-0x0;var _0x25c9ad=_0x88ca[_0x3e91a9];return _0x25c9ad;};'use strict';var Sequelize=require(_0xa88c('0x0'));var _=require(_0xa88c('0x1'));var util=require('util');module['exports']={'name':{'type':Sequelize[_0xa88c('0x2')],'unique':_0xa88c('0x3')},'description':{'type':Sequelize['STRING']},'formData':{'type':Sequelize[_0xa88c('0x4')]('long'),'set':function(_0x58d159){if(_[_0xa88c('0x5')](_0x58d159)){this[_0xa88c('0x6')](_0xa88c('0x7'),JSON[_0xa88c('0x8')](_0x58d159));}else if(_['isString'](_0x58d159)){this[_0xa88c('0x6')]('formData',_0x58d159);}else{this[_0xa88c('0x6')]('formData',util['format'](_0xa88c('0x9'),this['getDataValue'](_0xa88c('0x3'))||'',this[_0xa88c('0xa')](_0xa88c('0xb'))||''));}}},'enableUncompleteSave':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0xa88c('0xc')],'defaultValue':![]}}; \ No newline at end of file +var _0x7eb3=['name','description','BOOLEAN','sequelize','util','STRING','TEXT','long','isObjectLike','formData','stringify','isString','setDataValue','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue'];(function(_0x361e9e,_0x460e6d){var _0x30fd5a=function(_0x5bad01){while(--_0x5bad01){_0x361e9e['push'](_0x361e9e['shift']());}};_0x30fd5a(++_0x460e6d);}(_0x7eb3,0x1b3));var _0x37eb=function(_0x530fd7,_0x2534be){_0x530fd7=_0x530fd7-0x0;var _0x2ddad6=_0x7eb3[_0x530fd7];return _0x2ddad6;};'use strict';var Sequelize=require(_0x37eb('0x0'));var _=require('lodash');var util=require(_0x37eb('0x1'));module['exports']={'name':{'type':Sequelize[_0x37eb('0x2')],'unique':'name'},'description':{'type':Sequelize['STRING']},'formData':{'type':Sequelize[_0x37eb('0x3')](_0x37eb('0x4')),'set':function(_0x325907){if(_[_0x37eb('0x5')](_0x325907)){this['setDataValue'](_0x37eb('0x6'),JSON[_0x37eb('0x7')](_0x325907));}else if(_[_0x37eb('0x8')](_0x325907)){this[_0x37eb('0x9')](_0x37eb('0x6'),_0x325907);}else{this[_0x37eb('0x9')]('formData',util[_0x37eb('0xa')](_0x37eb('0xb'),this[_0x37eb('0xc')](_0x37eb('0xd'))||'',this[_0x37eb('0xc')](_0x37eb('0xe'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0x37eb('0xf')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0x37eb('0xf')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.controller.js b/server/api/jscriptyProject/jscriptyProject.controller.js index cdaeec4..0e40f64 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 _0xf4c9=['query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','options','JscriptyProject','includeAll','include','rows','catch','show','keys','find','create','body','user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','params','omit','createdAt','updatedAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','Projects','findOne','ProjectId','JscriptySessionReport','JscriptyAnswerReport','findAll','number','fromCharCode','apply','toString','indexOf','replace','getSummary','startTime','JscriptyQuestionReport','-createdAt','questionId','question','starttime','format','YYYY-MM-DD\x20HH:mm:ss','SessionId','answer','push','isEmpty','now','writeFileSync','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','Jscripty_Project_%d_Summary_%s.csv','Content-type','text/csv','download','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','sox','ejs','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','status','json','offset','undefined','limit','count','reject','update','destroy','then','get','UserProfileResource','end','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','model'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf4c9,0x1aa));var _0x9f4c=function(_0x525c7b,_0x488fcc){_0x525c7b=_0x525c7b-0x0;var _0x27b33e=_0xf4c9[_0x525c7b];return _0x27b33e;};'use strict';var emlformat=require(_0x9f4c('0x0'));var rimraf=require(_0x9f4c('0x1'));var zipdir=require(_0x9f4c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9f4c('0x3'));var moment=require('moment');var BPromise=require(_0x9f4c('0x4'));var Mustache=require(_0x9f4c('0x5'));var util=require(_0x9f4c('0x6'));var path=require('path');var sox=require(_0x9f4c('0x7'));var csv=require('to-csv');var ejs=require(_0x9f4c('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x9f4c('0x9'));var jsforce=require(_0x9f4c('0xa'));var deskjs=require(_0x9f4c('0xb'));var toCsv=require(_0x9f4c('0xc'));var querystring=require(_0x9f4c('0xd'));var Papa=require(_0x9f4c('0xe'));var Redis=require('ioredis');var authService=require(_0x9f4c('0xf'));var qs=require(_0x9f4c('0x10'));var as=require(_0x9f4c('0x11'));var hardwareService=require(_0x9f4c('0x12'));var logger=require(_0x9f4c('0x13'))(_0x9f4c('0x14'));var utils=require(_0x9f4c('0x15'));var config=require(_0x9f4c('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4d71a9,_0x124492){_0x124492=_0x124492||0xcc;return function(_0x53159a){if(_0x53159a){return _0x4d71a9['sendStatus'](_0x124492);}return _0x4d71a9[_0x9f4c('0x17')](_0x124492)['end']();};}function respondWithResult(_0x5a9cb0,_0xf217d4){_0xf217d4=_0xf217d4||0xc8;return function(_0x4ce352){if(_0x4ce352){return _0x5a9cb0['status'](_0xf217d4)[_0x9f4c('0x18')](_0x4ce352);}};}function respondWithFilteredResult(_0x516787,_0x25f8ed){return function(_0x336fc2){if(_0x336fc2){var _0x46abfe=typeof _0x25f8ed[_0x9f4c('0x19')]===_0x9f4c('0x1a')&&typeof _0x25f8ed[_0x9f4c('0x1b')]==='undefined';var _0x2be1ba=_0x336fc2[_0x9f4c('0x1c')];var _0x143335=_0x46abfe?0x0:_0x25f8ed[_0x9f4c('0x19')];var _0x3f862c=_0x46abfe?_0x336fc2['count']:_0x25f8ed[_0x9f4c('0x19')]+_0x25f8ed[_0x9f4c('0x1b')];var _0x8efbfe;if(_0x3f862c>=_0x2be1ba){_0x3f862c=_0x2be1ba;_0x8efbfe=0xc8;}else{_0x8efbfe=0xce;}_0x516787['status'](_0x8efbfe);return _0x516787['set']('Content-Range',_0x143335+'-'+_0x3f862c+'/'+_0x2be1ba)['json'](_0x336fc2);}return null;};}function patchUpdates(_0x2040a5){return function(_0x47accd){try{jsonpatch['apply'](_0x47accd,_0x2040a5,!![]);}catch(_0x603a8d){return BPromise[_0x9f4c('0x1d')](_0x603a8d);}return _0x47accd['save']();};}function saveUpdates(_0x341693,_0x1d0df9){return function(_0x57b636){if(_0x57b636){return _0x57b636[_0x9f4c('0x1e')](_0x341693)['then'](function(_0x5e6632){return _0x5e6632;});}return null;};}function removeEntity(_0x36e15f,_0x49d6d6){return function(_0xa4a8e9){if(_0xa4a8e9){return _0xa4a8e9[_0x9f4c('0x1f')]()[_0x9f4c('0x20')](function(){var _0x4698b3=_0xa4a8e9[_0x9f4c('0x21')]({'plain':!![]});var _0x10c9a9='Projects';return db[_0x9f4c('0x22')][_0x9f4c('0x1f')]({'where':{'type':_0x10c9a9,'resourceId':_0x4698b3['id']}})[_0x9f4c('0x20')](function(){return _0xa4a8e9;});})[_0x9f4c('0x20')](function(){_0x36e15f[_0x9f4c('0x17')](0xcc)[_0x9f4c('0x23')]();});}};}function handleEntityNotFound(_0x945f00,_0xadd84c){return function(_0x3bcc3f){if(!_0x3bcc3f){_0x945f00[_0x9f4c('0x24')](0x194);}return _0x3bcc3f;};}function handleError(_0x4712c7,_0x4f0d37){_0x4f0d37=_0x4f0d37||0x1f4;return function(_0x168ed8){logger[_0x9f4c('0x25')](_0x168ed8[_0x9f4c('0x26')]);if(_0x168ed8[_0x9f4c('0x27')]){delete _0x168ed8[_0x9f4c('0x27')];}_0x4712c7[_0x9f4c('0x17')](_0x4f0d37)[_0x9f4c('0x28')](_0x168ed8);};}exports[_0x9f4c('0x29')]=function(_0x20d2f4,_0x2158ac){var _0x4e9b77={},_0x4b6d91={},_0x52ef31={'count':0x0,'rows':[]};var _0x101c13=_[_0x9f4c('0x2a')](db['JscriptyProject'][_0x9f4c('0x2b')],function(_0x8cd2b3){return{'name':_0x8cd2b3[_0x9f4c('0x2c')],'type':_0x8cd2b3['type']['key']};});_0x4b6d91[_0x9f4c('0x2d')]=_[_0x9f4c('0x2a')](_0x101c13,'name');_0x4b6d91[_0x9f4c('0x2e')]=_['keys'](_0x20d2f4['query']);_0x4b6d91[_0x9f4c('0x2f')]=_[_0x9f4c('0x30')](_0x4b6d91[_0x9f4c('0x2d')],_0x4b6d91[_0x9f4c('0x2e')]);_0x4e9b77[_0x9f4c('0x31')]=_[_0x9f4c('0x30')](_0x4b6d91['model'],qs[_0x9f4c('0x32')](_0x20d2f4[_0x9f4c('0x2e')][_0x9f4c('0x32')]));_0x4e9b77[_0x9f4c('0x31')]=_0x4e9b77[_0x9f4c('0x31')][_0x9f4c('0x33')]?_0x4e9b77[_0x9f4c('0x31')]:_0x4b6d91[_0x9f4c('0x2d')];if(!_0x20d2f4[_0x9f4c('0x2e')][_0x9f4c('0x34')](_0x9f4c('0x35'))){_0x4e9b77[_0x9f4c('0x1b')]=qs[_0x9f4c('0x1b')](_0x20d2f4['query'][_0x9f4c('0x1b')]);_0x4e9b77['offset']=qs[_0x9f4c('0x19')](_0x20d2f4[_0x9f4c('0x2e')][_0x9f4c('0x19')]);}_0x4e9b77[_0x9f4c('0x36')]=qs[_0x9f4c('0x37')](_0x20d2f4[_0x9f4c('0x2e')][_0x9f4c('0x37')]);_0x4e9b77[_0x9f4c('0x38')]=qs[_0x9f4c('0x2f')](_[_0x9f4c('0x39')](_0x20d2f4[_0x9f4c('0x2e')],_0x4b6d91[_0x9f4c('0x2f')]),_0x101c13);if(_0x20d2f4['query'][_0x9f4c('0x3a')]){_0x4e9b77[_0x9f4c('0x38')]=_[_0x9f4c('0x3b')](_0x4e9b77['where'],{'$or':_[_0x9f4c('0x2a')](_0x101c13,function(_0x380c08){if(_0x380c08[_0x9f4c('0x3c')]!=='VIRTUAL'){var _0xb58e5a={};_0xb58e5a[_0x380c08[_0x9f4c('0x27')]]={'$like':'%'+_0x20d2f4[_0x9f4c('0x2e')][_0x9f4c('0x3a')]+'%'};return _0xb58e5a;}})});}_0x4e9b77=_[_0x9f4c('0x3b')]({},_0x4e9b77,_0x20d2f4[_0x9f4c('0x3d')]);var _0x44b920={'where':_0x4e9b77[_0x9f4c('0x38')]};return db[_0x9f4c('0x3e')][_0x9f4c('0x1c')](_0x44b920)['then'](function(_0x167363){_0x52ef31[_0x9f4c('0x1c')]=_0x167363;if(_0x20d2f4['query'][_0x9f4c('0x3f')]){_0x4e9b77[_0x9f4c('0x40')]=[{'all':!![]}];}return db[_0x9f4c('0x3e')]['findAll'](_0x4e9b77);})[_0x9f4c('0x20')](function(_0x4da3ed){_0x52ef31[_0x9f4c('0x41')]=_0x4da3ed;return _0x52ef31;})['then'](respondWithFilteredResult(_0x2158ac,_0x4e9b77))[_0x9f4c('0x42')](handleError(_0x2158ac,null));};exports[_0x9f4c('0x43')]=function(_0x10437e,_0x437558){var _0x3ee559={'raw':![],'where':{'id':_0x10437e['params']['id']}},_0x51553d={};_0x51553d[_0x9f4c('0x2d')]=_[_0x9f4c('0x44')](db[_0x9f4c('0x3e')]['rawAttributes']);_0x51553d[_0x9f4c('0x2e')]=_['keys'](_0x10437e['query']);_0x51553d[_0x9f4c('0x2f')]=_['intersection'](_0x51553d[_0x9f4c('0x2d')],_0x51553d[_0x9f4c('0x2e')]);_0x3ee559[_0x9f4c('0x31')]=_['intersection'](_0x51553d[_0x9f4c('0x2d')],qs['fields'](_0x10437e[_0x9f4c('0x2e')][_0x9f4c('0x32')]));_0x3ee559[_0x9f4c('0x31')]=_0x3ee559[_0x9f4c('0x31')]['length']?_0x3ee559[_0x9f4c('0x31')]:_0x51553d['model'];if(_0x10437e[_0x9f4c('0x2e')]['includeAll']){_0x3ee559[_0x9f4c('0x40')]=[{'all':!![]}];}_0x3ee559=_[_0x9f4c('0x3b')]({},_0x3ee559,_0x10437e['options']);return db[_0x9f4c('0x3e')][_0x9f4c('0x45')](_0x3ee559)['then'](handleEntityNotFound(_0x437558,null))[_0x9f4c('0x20')](respondWithResult(_0x437558,null))['catch'](handleError(_0x437558,null));};exports[_0x9f4c('0x46')]=function(_0x384f47,_0x5b8fca){return db['JscriptyProject']['create'](_0x384f47[_0x9f4c('0x47')],{})[_0x9f4c('0x20')](function(_0x5e93ae){var _0x2c7f9a=_0x384f47[_0x9f4c('0x48')][_0x9f4c('0x21')]({'plain':!![]});if(!_0x2c7f9a)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2c7f9a[_0x9f4c('0x49')]==='user'){var _0x1830e7=_0x5e93ae[_0x9f4c('0x21')]({'plain':!![]});var _0x50edbd='Projects';return db[_0x9f4c('0x4a')][_0x9f4c('0x45')]({'where':{'name':_0x50edbd,'userProfileId':_0x2c7f9a['userProfileId']},'raw':!![]})[_0x9f4c('0x20')](function(_0x885938){if(_0x885938&&_0x885938[_0x9f4c('0x4b')]===0x0){return db['UserProfileResource']['create']({'name':_0x1830e7[_0x9f4c('0x27')],'resourceId':_0x1830e7['id'],'type':_0x885938[_0x9f4c('0x27')],'sectionId':_0x885938['id']},{})[_0x9f4c('0x20')](function(){return _0x5e93ae;});}else{return _0x5e93ae;}})[_0x9f4c('0x42')](function(_0x558102){logger[_0x9f4c('0x25')](_0x9f4c('0x4c'),_0x558102);throw _0x558102;});}return _0x5e93ae;})[_0x9f4c('0x20')](respondWithResult(_0x5b8fca,0xc9))[_0x9f4c('0x42')](handleError(_0x5b8fca,null));};exports[_0x9f4c('0x4d')]=function(_0x200190,_0x2fbaaa){var _0x1e88b0={'where':{'id':_0x200190[_0x9f4c('0x4e')]['id']}},_0x20ea33={};_0x20ea33[_0x9f4c('0x2d')]=_['keys'](db[_0x9f4c('0x3e')][_0x9f4c('0x2b')]);_0x1e88b0[_0x9f4c('0x31')]=_[_0x9f4c('0x30')](_0x20ea33[_0x9f4c('0x2d')],qs['fields'](_0x200190['query'][_0x9f4c('0x32')]));_0x1e88b0['attributes']=_0x1e88b0[_0x9f4c('0x31')]['length']?_0x1e88b0[_0x9f4c('0x31')]:_0x20ea33[_0x9f4c('0x2d')];if(_0x200190[_0x9f4c('0x2e')][_0x9f4c('0x3f')]){_0x1e88b0[_0x9f4c('0x40')]=[{'all':!![]}];}_0x1e88b0=_[_0x9f4c('0x3b')]({},_0x1e88b0,_0x200190['options']);return db[_0x9f4c('0x3e')][_0x9f4c('0x45')](_0x1e88b0)[_0x9f4c('0x20')](handleEntityNotFound(_0x2fbaaa,null))[_0x9f4c('0x20')](function(_0x440576){if(_0x440576){var _0x584744=_0x440576[_0x9f4c('0x21')]({'plain':!![]});_0x584744=qs[_0x9f4c('0x4f')](_0x584744,['id',_0x9f4c('0x50'),_0x9f4c('0x51')]);_0x200190[_0x9f4c('0x47')]=_[_0x9f4c('0x4f')](_0x200190[_0x9f4c('0x47')],['id',_0x9f4c('0x50'),_0x9f4c('0x51')]);return db['JscriptyProject'][_0x9f4c('0x46')](_[_0x9f4c('0x3b')](_0x584744,_0x200190[_0x9f4c('0x47')]),{'include':_0x200190[_0x9f4c('0x2e')][_0x9f4c('0x3f')]?[{'all':!![]}]:undefined})[_0x9f4c('0x20')](function(_0x5ae1ef){var _0x36d619=_0x200190[_0x9f4c('0x48')][_0x9f4c('0x21')]({'plain':!![]});if(!_0x36d619)throw new Error(_0x9f4c('0x52'));if(_0x36d619[_0x9f4c('0x49')]===_0x9f4c('0x48')){var _0x4a488f=_0x5ae1ef['get']({'plain':!![]});var _0x484151=_0x9f4c('0x53');return db[_0x9f4c('0x4a')][_0x9f4c('0x45')]({'where':{'name':_0x484151,'userProfileId':_0x36d619['userProfileId']},'raw':!![]})[_0x9f4c('0x20')](function(_0x108bee){if(_0x108bee&&_0x108bee[_0x9f4c('0x4b')]===0x0){return db[_0x9f4c('0x22')][_0x9f4c('0x46')]({'name':_0x4a488f[_0x9f4c('0x27')],'resourceId':_0x4a488f['id'],'type':_0x108bee[_0x9f4c('0x27')],'sectionId':_0x108bee['id']},{})[_0x9f4c('0x20')](function(){return _0x5ae1ef;});}else{return _0x5ae1ef;}})[_0x9f4c('0x42')](function(_0x10ba77){logger['error'](_0x9f4c('0x4c'),_0x10ba77);throw _0x10ba77;});}return _0x5ae1ef;});}})[_0x9f4c('0x20')](respondWithResult(_0x2fbaaa,0xc9))[_0x9f4c('0x42')](handleError(_0x2fbaaa,null));};exports[_0x9f4c('0x1e')]=function(_0x528cc5,_0x5294a2){if(_0x528cc5['body']['id']){delete _0x528cc5[_0x9f4c('0x47')]['id'];}return db[_0x9f4c('0x3e')]['find']({'where':{'id':_0x528cc5[_0x9f4c('0x4e')]['id']}})['then'](handleEntityNotFound(_0x5294a2,null))['then'](saveUpdates(_0x528cc5[_0x9f4c('0x47')],null))['then'](respondWithResult(_0x5294a2,null))[_0x9f4c('0x42')](handleError(_0x5294a2,null));};exports[_0x9f4c('0x1f')]=function(_0x4e3904,_0x13c7a7){return db['JscriptyProject']['find']({'where':{'id':_0x4e3904[_0x9f4c('0x4e')]['id']}})[_0x9f4c('0x20')](handleEntityNotFound(_0x13c7a7,null))[_0x9f4c('0x20')](removeEntity(_0x13c7a7,null))[_0x9f4c('0x42')](handleError(_0x13c7a7,null));};exports['getSessions']=function(_0x33967a,_0x5514a1,_0x5505f3){var _0x161e0d={'raw':!![],'where':{}};var _0x558648={};var _0x108845={'count':0x0,'rows':[]};return db[_0x9f4c('0x3e')][_0x9f4c('0x54')]({'where':{'id':_0x33967a[_0x9f4c('0x4e')]['id']}})[_0x9f4c('0x20')](handleEntityNotFound(_0x5514a1,null))['then'](function(_0x5c0366){if(_0x5c0366){_0x558648['model']=_[_0x9f4c('0x44')](db['JscriptySessionReport'][_0x9f4c('0x2b')]);_0x558648[_0x9f4c('0x2e')]=_[_0x9f4c('0x44')](_0x33967a['query']);_0x558648[_0x9f4c('0x2f')]=_[_0x9f4c('0x30')](_0x558648[_0x9f4c('0x2d')],_0x558648[_0x9f4c('0x2e')]);_0x161e0d['attributes']=_[_0x9f4c('0x30')](_0x558648[_0x9f4c('0x2d')],qs[_0x9f4c('0x32')](_0x33967a[_0x9f4c('0x2e')]['fields']));_0x161e0d['attributes']=_0x161e0d['attributes']['length']?_0x161e0d['attributes']:_0x558648[_0x9f4c('0x2d')];if(!_0x33967a['query'][_0x9f4c('0x34')](_0x9f4c('0x35'))){_0x161e0d['limit']=qs['limit'](_0x33967a[_0x9f4c('0x2e')][_0x9f4c('0x1b')]);_0x161e0d[_0x9f4c('0x19')]=qs[_0x9f4c('0x19')](_0x33967a['query'][_0x9f4c('0x19')]);}_0x161e0d['order']=qs['sort'](_0x33967a['query'][_0x9f4c('0x37')]);_0x161e0d[_0x9f4c('0x38')]=qs['filters'](_[_0x9f4c('0x39')](_0x33967a[_0x9f4c('0x2e')],_0x558648[_0x9f4c('0x2f')]));_0x161e0d[_0x9f4c('0x38')][_0x9f4c('0x55')]=_0x5c0366['id'];if(_0x33967a[_0x9f4c('0x2e')][_0x9f4c('0x3a')]){_0x161e0d[_0x9f4c('0x38')]=_[_0x9f4c('0x3b')](_0x161e0d[_0x9f4c('0x38')],{'$or':_[_0x9f4c('0x2a')](_0x161e0d[_0x9f4c('0x31')],function(_0x289028){var _0x4804af={};_0x4804af[_0x289028]={'$like':'%'+_0x33967a[_0x9f4c('0x2e')][_0x9f4c('0x3a')]+'%'};return _0x4804af;})});}_0x161e0d=_[_0x9f4c('0x3b')]({},_0x161e0d,_0x33967a[_0x9f4c('0x3d')]);return db[_0x9f4c('0x56')]['count']({'where':_0x161e0d[_0x9f4c('0x38')]})['then'](function(_0x416d88){_0x108845[_0x9f4c('0x1c')]=_0x416d88;if(_0x33967a['query'][_0x9f4c('0x3f')]){_0x161e0d['include']=[{'all':!![]}];}return db['JscriptySessionReport']['findAll'](_0x161e0d);})['then'](function(_0x11112c){_0x108845[_0x9f4c('0x41')]=_0x11112c;return _0x108845;});}})[_0x9f4c('0x20')](respondWithFilteredResult(_0x5514a1,_0x161e0d))[_0x9f4c('0x42')](handleError(_0x5514a1,null));};exports['getAnswers']=function(_0x2138f1,_0x36cbc6,_0x12bf39){var _0x55a4ac={'raw':!![],'where':{}};var _0x2aa997={};var _0x1ffbd6={'count':0x0,'rows':[]};return db[_0x9f4c('0x3e')]['findOne']({'where':{'id':_0x2138f1[_0x9f4c('0x4e')]['id']}})['then'](handleEntityNotFound(_0x36cbc6,null))['then'](function(_0x12603f){if(_0x12603f){_0x2aa997[_0x9f4c('0x2d')]=_[_0x9f4c('0x44')](db['JscriptyAnswerReport'][_0x9f4c('0x2b')]);_0x2aa997[_0x9f4c('0x2e')]=_[_0x9f4c('0x44')](_0x2138f1['query']);_0x2aa997[_0x9f4c('0x2f')]=_[_0x9f4c('0x30')](_0x2aa997[_0x9f4c('0x2d')],_0x2aa997['query']);_0x55a4ac['attributes']=_[_0x9f4c('0x30')](_0x2aa997[_0x9f4c('0x2d')],qs[_0x9f4c('0x32')](_0x2138f1['query'][_0x9f4c('0x32')]));_0x55a4ac[_0x9f4c('0x31')]=_0x55a4ac['attributes'][_0x9f4c('0x33')]?_0x55a4ac[_0x9f4c('0x31')]:_0x2aa997[_0x9f4c('0x2d')];if(!_0x2138f1[_0x9f4c('0x2e')]['hasOwnProperty'](_0x9f4c('0x35'))){_0x55a4ac[_0x9f4c('0x1b')]=qs[_0x9f4c('0x1b')](_0x2138f1[_0x9f4c('0x2e')]['limit']);_0x55a4ac[_0x9f4c('0x19')]=qs['offset'](_0x2138f1[_0x9f4c('0x2e')][_0x9f4c('0x19')]);}_0x55a4ac[_0x9f4c('0x36')]=qs[_0x9f4c('0x37')](_0x2138f1[_0x9f4c('0x2e')][_0x9f4c('0x37')]);_0x55a4ac[_0x9f4c('0x38')]=qs[_0x9f4c('0x2f')](_[_0x9f4c('0x39')](_0x2138f1[_0x9f4c('0x2e')],_0x2aa997['filters']));_0x55a4ac[_0x9f4c('0x38')]['ProjectId']=_0x12603f['id'];if(_0x2138f1[_0x9f4c('0x2e')][_0x9f4c('0x3a')]){_0x55a4ac[_0x9f4c('0x38')]=_[_0x9f4c('0x3b')](_0x55a4ac[_0x9f4c('0x38')],{'$or':_[_0x9f4c('0x2a')](_0x55a4ac[_0x9f4c('0x31')],function(_0x5db3be){var _0x19b09b={};_0x19b09b[_0x5db3be]={'$like':'%'+_0x2138f1[_0x9f4c('0x2e')]['filter']+'%'};return _0x19b09b;})});}_0x55a4ac=_[_0x9f4c('0x3b')]({},_0x55a4ac,_0x2138f1[_0x9f4c('0x3d')]);return db[_0x9f4c('0x57')][_0x9f4c('0x1c')]({'where':_0x55a4ac[_0x9f4c('0x38')]})[_0x9f4c('0x20')](function(_0x44cc1f){_0x1ffbd6[_0x9f4c('0x1c')]=_0x44cc1f;if(_0x2138f1[_0x9f4c('0x2e')]['includeAll']){_0x55a4ac[_0x9f4c('0x40')]=[{'all':!![]}];}return db[_0x9f4c('0x57')][_0x9f4c('0x58')](_0x55a4ac);})[_0x9f4c('0x20')](function(_0x371e82){_0x1ffbd6[_0x9f4c('0x41')]=_0x371e82;return _0x1ffbd6;});}})[_0x9f4c('0x20')](respondWithFilteredResult(_0x36cbc6,_0x55a4ac))['catch'](handleError(_0x36cbc6,null));};function char(_0x49c366){return _0x9f4c('0x59')===typeof _0x49c366?String[_0x9f4c('0x5a')][_0x9f4c('0x5b')](null,arguments):_0x49c366;}function needsEncapsulation(_0x127215){return!!_0x127215&&(_0x127215[_0x9f4c('0x5c')]()['indexOf'](char(0xd))>=0x0||_0x127215[_0x9f4c('0x5c')]()[_0x9f4c('0x5d')](char(0xa))>=0x0||_0x127215[_0x9f4c('0x5c')]()[_0x9f4c('0x5d')](char(0x2c))>=0x0||_0x127215[_0x9f4c('0x5c')]()[_0x9f4c('0x5d')](char(0x22))>=0x0);}function encapsulate(_0x224eb5){var _0x498cc8=char(0x22),_0x214e48='\x5c'+char(0x22),_0x1de423=_0x224eb5['toString']()[_0x9f4c('0x5e')](new RegExp(_0x498cc8,'g'),_0x214e48);return _0x498cc8+_0x1de423+_0x498cc8;}exports[_0x9f4c('0x5f')]=function(_0x22ef54,_0x1912c9,_0x1b49cd){var _0xcb283d,_0x3fbb63;var _0x472946={'where':{'ProjectId':_0x22ef54['params']['id']}};if(_0x22ef54[_0x9f4c('0x2e')]['startTime']){_0x472946[_0x9f4c('0x38')]['starttime']=JSON['parse'](_0x22ef54[_0x9f4c('0x2e')][_0x9f4c('0x60')]);}return db[_0x9f4c('0x56')][_0x9f4c('0x58')](_0x472946)[_0x9f4c('0x20')](handleEntityNotFound(_0x1912c9,null))[_0x9f4c('0x20')](function(_0x632ae){if(_0x632ae){_0xcb283d=_0x632ae;return db[_0x9f4c('0x61')][_0x9f4c('0x58')]({'where':{'SessionId':{'$in':_[_0x9f4c('0x2a')](_0xcb283d,'id')},'ProjectId':_0x22ef54[_0x9f4c('0x4e')]['id']},'order':_0x9f4c('0x62')});}})[_0x9f4c('0x20')](handleEntityNotFound(_0x1912c9,null))[_0x9f4c('0x20')](function(_0x285722){if(_0x285722){_0x3fbb63=_0x285722;var _0x2c8f1c={};for(var _0x333edd=0x0,_0x406d47=_0x3fbb63[_0x9f4c('0x33')];_0x333edd<_0x406d47;_0x333edd++){if(!_0x2c8f1c[_0x9f4c('0x34')](_0x3fbb63[_0x333edd][_0x9f4c('0x63')])){_0x2c8f1c[_0x3fbb63[_0x333edd][_0x9f4c('0x63')]]=needsEncapsulation(_0x3fbb63[_0x333edd][_0x9f4c('0x64')])?encapsulate(_0x3fbb63[_0x333edd][_0x9f4c('0x64')]):_0x3fbb63[_0x333edd][_0x9f4c('0x64')];}}var _0x104d21=[],_0x29e563={};for(var _0x5568a3=0x0,_0x7c5300=_0xcb283d[_0x9f4c('0x33')];_0x5568a3<_0x7c5300;_0x5568a3++){_0x29e563={'ProjectId':_0x22ef54[_0x9f4c('0x4e')]['id'],'SessionId':_0xcb283d[_0x5568a3]['id'],'StartTime':moment(_0xcb283d[_0x5568a3][_0x9f4c('0x65')])[_0x9f4c('0x66')](_0x9f4c('0x67'))};for(var _0x594f15=0x0,_0x302a65=_0x3fbb63['length'];_0x594f15<_0x302a65;_0x594f15++){if(_0x3fbb63[_0x594f15][_0x9f4c('0x68')]==_0xcb283d[_0x5568a3]['id']&&_0x2c8f1c[_0x9f4c('0x34')](_0x3fbb63[_0x594f15][_0x9f4c('0x63')])){_0x29e563[_0x2c8f1c[_0x3fbb63[_0x594f15][_0x9f4c('0x63')]]]=_0x3fbb63[_0x594f15][_0x9f4c('0x69')];}}for(var _0x1bef4c in _0x2c8f1c){if(!_0x29e563[_0x9f4c('0x34')](_0x2c8f1c[_0x1bef4c])){_0x29e563[_0x2c8f1c[_0x1bef4c]]=null;}}_0x104d21[_0x9f4c('0x6a')](_0x29e563);}return _0x104d21;}})[_0x9f4c('0x20')](function(_0x3b5658){if(!_[_0x9f4c('0x6b')](_0x3b5658)){var _0x1cb837=toCsv(_0x3b5658);var _0x5f4596=Date[_0x9f4c('0x6c')]();fs[_0x9f4c('0x6d')](util[_0x9f4c('0x66')](_0x9f4c('0x6e'),_0x22ef54[_0x9f4c('0x4e')]['id'],_0x5f4596),_0x1cb837);_0x1912c9[_0x9f4c('0x6f')](_0x9f4c('0x70'),_0x9f4c('0x71')+util['format'](_0x9f4c('0x72'),_0x22ef54[_0x9f4c('0x4e')]['id'],_0x5f4596));_0x1912c9[_0x9f4c('0x6f')](_0x9f4c('0x73'),_0x9f4c('0x74'));return _0x1912c9[_0x9f4c('0x75')](util[_0x9f4c('0x66')]('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x22ef54['params']['id'],_0x5f4596));}else{return _0x1912c9[_0x9f4c('0x24')](0xcc);}})['catch'](handleError(_0x1912c9,null));}; \ No newline at end of file +var _0x8b5c=['JscriptyAnswerReport','ProjectId','number','toString','indexOf','replace','getSummary','startTime','starttime','parse','JscriptyQuestionReport','-createdAt','questionId','question','format','YYYY-MM-DD\x20HH:mm:ss','SessionId','answer','push','isEmpty','now','/tmp/Jscripty_Project_%d_Summary_%s.csv','Content-disposition','setHeader','Content-type','rimraf','fast-json-patch','request-promise','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','update','then','destroy','get','Projects','error','stack','name','send','map','rawAttributes','fieldName','key','model','keys','query','intersection','attributes','length','hasOwnProperty','order','sort','where','filters','filter','merge','type','VIRTUAL','JscriptyProject','includeAll','include','findAll','rows','catch','show','params','fields','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','clone','omit','updatedAt','createdAt','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getSessions','findOne','JscriptySessionReport','nolimit','pick','getAnswers'];(function(_0x2e4e19,_0x493b50){var _0x9ba20b=function(_0x2f6456){while(--_0x2f6456){_0x2e4e19['push'](_0x2e4e19['shift']());}};_0x9ba20b(++_0x493b50);}(_0x8b5c,0x10d));var _0xc8b5=function(_0x427c8f,_0x92dcda){_0x427c8f=_0x427c8f-0x0;var _0x1a7eff=_0x8b5c[_0x427c8f];return _0x1a7eff;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc8b5('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc8b5('0x1'));var rp=require(_0xc8b5('0x2'));var moment=require('moment');var BPromise=require(_0xc8b5('0x3'));var Mustache=require(_0xc8b5('0x4'));var util=require('util');var path=require(_0xc8b5('0x5'));var sox=require('sox');var csv=require(_0xc8b5('0x6'));var ejs=require(_0xc8b5('0x7'));var fs=require('fs');var fs_extra=require(_0xc8b5('0x8'));var _=require(_0xc8b5('0x9'));var squel=require(_0xc8b5('0xa'));var crypto=require(_0xc8b5('0xb'));var jsforce=require(_0xc8b5('0xc'));var deskjs=require(_0xc8b5('0xd'));var toCsv=require('to-csv');var querystring=require(_0xc8b5('0xe'));var Papa=require(_0xc8b5('0xf'));var Redis=require(_0xc8b5('0x10'));var authService=require(_0xc8b5('0x11'));var qs=require(_0xc8b5('0x12'));var as=require(_0xc8b5('0x13'));var hardwareService=require(_0xc8b5('0x14'));var logger=require(_0xc8b5('0x15'))(_0xc8b5('0x16'));var utils=require(_0xc8b5('0x17'));var config=require(_0xc8b5('0x18'));var licenseUtil=require(_0xc8b5('0x19'));var db=require(_0xc8b5('0x1a'))['db'];function respondWithStatusCode(_0x7e1b00,_0x17ece2){_0x17ece2=_0x17ece2||0xcc;return function(_0x19c8e5){if(_0x19c8e5){return _0x7e1b00[_0xc8b5('0x1b')](_0x17ece2);}return _0x7e1b00[_0xc8b5('0x1c')](_0x17ece2)[_0xc8b5('0x1d')]();};}function respondWithResult(_0x3d6db3,_0xe15aad){_0xe15aad=_0xe15aad||0xc8;return function(_0x26bab7){if(_0x26bab7){return _0x3d6db3[_0xc8b5('0x1c')](_0xe15aad)[_0xc8b5('0x1e')](_0x26bab7);}};}function respondWithFilteredResult(_0x4b5c21,_0x593bc1){return function(_0x5c9bc7){if(_0x5c9bc7){var _0x557f1a=typeof _0x593bc1[_0xc8b5('0x1f')]==='undefined'&&typeof _0x593bc1['limit']===_0xc8b5('0x20');var _0x546e4d=_0x5c9bc7[_0xc8b5('0x21')];var _0x5b2064=_0x557f1a?0x0:_0x593bc1[_0xc8b5('0x1f')];var _0x24820b=_0x557f1a?_0x5c9bc7[_0xc8b5('0x21')]:_0x593bc1[_0xc8b5('0x1f')]+_0x593bc1[_0xc8b5('0x22')];var _0x222fc6;if(_0x24820b>=_0x546e4d){_0x24820b=_0x546e4d;_0x222fc6=0xc8;}else{_0x222fc6=0xce;}_0x4b5c21[_0xc8b5('0x1c')](_0x222fc6);return _0x4b5c21[_0xc8b5('0x23')](_0xc8b5('0x24'),_0x5b2064+'-'+_0x24820b+'/'+_0x546e4d)['json'](_0x5c9bc7);}return null;};}function patchUpdates(_0x460630){return function(_0x2394a4){try{jsonpatch[_0xc8b5('0x25')](_0x2394a4,_0x460630,!![]);}catch(_0x46c586){return BPromise['reject'](_0x46c586);}return _0x2394a4['save']();};}function saveUpdates(_0x3642f7,_0x15ff36){return function(_0x33bec7){if(_0x33bec7){return _0x33bec7[_0xc8b5('0x26')](_0x3642f7)[_0xc8b5('0x27')](function(_0x15d9d4){return _0x15d9d4;});}return null;};}function removeEntity(_0x175525,_0x469857){return function(_0xbd2a41){if(_0xbd2a41){return _0xbd2a41[_0xc8b5('0x28')]()['then'](function(){var _0x22510f=_0xbd2a41[_0xc8b5('0x29')]({'plain':!![]});var _0x51b64f=_0xc8b5('0x2a');return db['UserProfileResource'][_0xc8b5('0x28')]({'where':{'type':_0x51b64f,'resourceId':_0x22510f['id']}})[_0xc8b5('0x27')](function(){return _0xbd2a41;});})[_0xc8b5('0x27')](function(){_0x175525['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1008c5,_0x3008b6){return function(_0x3bc71e){if(!_0x3bc71e){_0x1008c5['sendStatus'](0x194);}return _0x3bc71e;};}function handleError(_0x2ed053,_0x2cd662){_0x2cd662=_0x2cd662||0x1f4;return function(_0x5317d2){logger[_0xc8b5('0x2b')](_0x5317d2[_0xc8b5('0x2c')]);if(_0x5317d2['name']){delete _0x5317d2[_0xc8b5('0x2d')];}_0x2ed053[_0xc8b5('0x1c')](_0x2cd662)[_0xc8b5('0x2e')](_0x5317d2);};}exports['index']=function(_0x5e89d6,_0x173ae9){var _0x2067ff={},_0x1007f7={},_0x151ad5={'count':0x0,'rows':[]};var _0x46dc5f=_[_0xc8b5('0x2f')](db['JscriptyProject'][_0xc8b5('0x30')],function(_0x350471){return{'name':_0x350471[_0xc8b5('0x31')],'type':_0x350471['type'][_0xc8b5('0x32')]};});_0x1007f7[_0xc8b5('0x33')]=_[_0xc8b5('0x2f')](_0x46dc5f,_0xc8b5('0x2d'));_0x1007f7['query']=_[_0xc8b5('0x34')](_0x5e89d6[_0xc8b5('0x35')]);_0x1007f7['filters']=_[_0xc8b5('0x36')](_0x1007f7['model'],_0x1007f7[_0xc8b5('0x35')]);_0x2067ff[_0xc8b5('0x37')]=_['intersection'](_0x1007f7['model'],qs['fields'](_0x5e89d6['query']['fields']));_0x2067ff[_0xc8b5('0x37')]=_0x2067ff[_0xc8b5('0x37')][_0xc8b5('0x38')]?_0x2067ff[_0xc8b5('0x37')]:_0x1007f7[_0xc8b5('0x33')];if(!_0x5e89d6[_0xc8b5('0x35')][_0xc8b5('0x39')]('nolimit')){_0x2067ff[_0xc8b5('0x22')]=qs[_0xc8b5('0x22')](_0x5e89d6[_0xc8b5('0x35')][_0xc8b5('0x22')]);_0x2067ff[_0xc8b5('0x1f')]=qs[_0xc8b5('0x1f')](_0x5e89d6['query']['offset']);}_0x2067ff[_0xc8b5('0x3a')]=qs[_0xc8b5('0x3b')](_0x5e89d6[_0xc8b5('0x35')][_0xc8b5('0x3b')]);_0x2067ff[_0xc8b5('0x3c')]=qs[_0xc8b5('0x3d')](_['pick'](_0x5e89d6[_0xc8b5('0x35')],_0x1007f7['filters']),_0x46dc5f);if(_0x5e89d6[_0xc8b5('0x35')][_0xc8b5('0x3e')]){_0x2067ff['where']=_[_0xc8b5('0x3f')](_0x2067ff[_0xc8b5('0x3c')],{'$or':_[_0xc8b5('0x2f')](_0x46dc5f,function(_0x369e5f){if(_0x369e5f[_0xc8b5('0x40')]!==_0xc8b5('0x41')){var _0x52eeb5={};_0x52eeb5[_0x369e5f[_0xc8b5('0x2d')]]={'$like':'%'+_0x5e89d6['query']['filter']+'%'};return _0x52eeb5;}})});}_0x2067ff=_[_0xc8b5('0x3f')]({},_0x2067ff,_0x5e89d6['options']);var _0x25d113={'where':_0x2067ff[_0xc8b5('0x3c')]};return db[_0xc8b5('0x42')][_0xc8b5('0x21')](_0x25d113)[_0xc8b5('0x27')](function(_0x475b0f){_0x151ad5[_0xc8b5('0x21')]=_0x475b0f;if(_0x5e89d6['query'][_0xc8b5('0x43')]){_0x2067ff[_0xc8b5('0x44')]=[{'all':!![]}];}return db['JscriptyProject'][_0xc8b5('0x45')](_0x2067ff);})[_0xc8b5('0x27')](function(_0x45e6b3){_0x151ad5[_0xc8b5('0x46')]=_0x45e6b3;return _0x151ad5;})['then'](respondWithFilteredResult(_0x173ae9,_0x2067ff))[_0xc8b5('0x47')](handleError(_0x173ae9,null));};exports[_0xc8b5('0x48')]=function(_0x821059,_0x140548){var _0x4cadb1={'raw':![],'where':{'id':_0x821059[_0xc8b5('0x49')]['id']}},_0x4b3e6a={};_0x4b3e6a[_0xc8b5('0x33')]=_[_0xc8b5('0x34')](db[_0xc8b5('0x42')][_0xc8b5('0x30')]);_0x4b3e6a[_0xc8b5('0x35')]=_[_0xc8b5('0x34')](_0x821059[_0xc8b5('0x35')]);_0x4b3e6a[_0xc8b5('0x3d')]=_[_0xc8b5('0x36')](_0x4b3e6a[_0xc8b5('0x33')],_0x4b3e6a[_0xc8b5('0x35')]);_0x4cadb1[_0xc8b5('0x37')]=_[_0xc8b5('0x36')](_0x4b3e6a[_0xc8b5('0x33')],qs['fields'](_0x821059[_0xc8b5('0x35')][_0xc8b5('0x4a')]));_0x4cadb1[_0xc8b5('0x37')]=_0x4cadb1[_0xc8b5('0x37')][_0xc8b5('0x38')]?_0x4cadb1[_0xc8b5('0x37')]:_0x4b3e6a[_0xc8b5('0x33')];if(_0x821059['query']['includeAll']){_0x4cadb1[_0xc8b5('0x44')]=[{'all':!![]}];}_0x4cadb1=_['merge']({},_0x4cadb1,_0x821059[_0xc8b5('0x4b')]);return db[_0xc8b5('0x42')][_0xc8b5('0x4c')](_0x4cadb1)['then'](handleEntityNotFound(_0x140548,null))['then'](respondWithResult(_0x140548,null))['catch'](handleError(_0x140548,null));};exports['create']=function(_0x25a977,_0x327186){return db[_0xc8b5('0x42')][_0xc8b5('0x4d')](_0x25a977[_0xc8b5('0x4e')],{})[_0xc8b5('0x27')](function(_0x3330b7){var _0x455e18=_0x25a977[_0xc8b5('0x4f')][_0xc8b5('0x29')]({'plain':!![]});if(!_0x455e18)throw new Error(_0xc8b5('0x50'));if(_0x455e18[_0xc8b5('0x51')]==='user'){var _0x15ddce=_0x3330b7[_0xc8b5('0x29')]({'plain':!![]});var _0x284b44=_0xc8b5('0x2a');return db[_0xc8b5('0x52')][_0xc8b5('0x4c')]({'where':{'name':_0x284b44,'userProfileId':_0x455e18[_0xc8b5('0x53')]},'raw':!![]})[_0xc8b5('0x27')](function(_0x404bff){if(_0x404bff&&_0x404bff[_0xc8b5('0x54')]===0x0){return db[_0xc8b5('0x55')][_0xc8b5('0x4d')]({'name':_0x15ddce['name'],'resourceId':_0x15ddce['id'],'type':_0x404bff['name'],'sectionId':_0x404bff['id']},{})[_0xc8b5('0x27')](function(){return _0x3330b7;});}else{return _0x3330b7;}})['catch'](function(_0x346e63){logger[_0xc8b5('0x2b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x346e63);throw _0x346e63;});}return _0x3330b7;})['then'](respondWithResult(_0x327186,0xc9))[_0xc8b5('0x47')](handleError(_0x327186,null));};exports[_0xc8b5('0x56')]=function(_0x4dfb72,_0x9b7a56){var _0x29aa3b={'where':{'id':_0x4dfb72['params']['id']}},_0x5296a2={};_0x5296a2[_0xc8b5('0x33')]=_['keys'](db['JscriptyProject']['rawAttributes']);_0x29aa3b[_0xc8b5('0x37')]=_[_0xc8b5('0x36')](_0x5296a2[_0xc8b5('0x33')],qs['fields'](_0x4dfb72[_0xc8b5('0x35')]['fields']));_0x29aa3b[_0xc8b5('0x37')]=_0x29aa3b[_0xc8b5('0x37')][_0xc8b5('0x38')]?_0x29aa3b[_0xc8b5('0x37')]:_0x5296a2[_0xc8b5('0x33')];if(_0x4dfb72['query'][_0xc8b5('0x43')]){_0x29aa3b[_0xc8b5('0x44')]=[{'all':!![]}];}_0x29aa3b=_['merge']({},_0x29aa3b,_0x4dfb72[_0xc8b5('0x4b')]);return db[_0xc8b5('0x42')][_0xc8b5('0x4c')](_0x29aa3b)[_0xc8b5('0x27')](handleEntityNotFound(_0x9b7a56,null))[_0xc8b5('0x27')](function(_0x2db99c){if(_0x2db99c){var _0x166145=_0x2db99c[_0xc8b5('0x29')]({'plain':!![]});_0x166145=qs[_0xc8b5('0x57')](_0x166145,['id','createdAt',_0xc8b5('0x58')]);_0x4dfb72[_0xc8b5('0x4e')]=_[_0xc8b5('0x57')](_0x4dfb72[_0xc8b5('0x4e')],['id',_0xc8b5('0x59'),'updatedAt']);return db[_0xc8b5('0x42')]['create'](_[_0xc8b5('0x3f')](_0x166145,_0x4dfb72['body']),{'include':_0x4dfb72['query'][_0xc8b5('0x43')]?[{'all':!![]}]:undefined})[_0xc8b5('0x27')](function(_0x452546){var _0x520677=_0x4dfb72[_0xc8b5('0x4f')][_0xc8b5('0x29')]({'plain':!![]});if(!_0x520677)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x520677[_0xc8b5('0x51')]===_0xc8b5('0x4f')){var _0x4d21d8=_0x452546['get']({'plain':!![]});var _0x54e791=_0xc8b5('0x2a');return db[_0xc8b5('0x52')][_0xc8b5('0x4c')]({'where':{'name':_0x54e791,'userProfileId':_0x520677['userProfileId']},'raw':!![]})[_0xc8b5('0x27')](function(_0x1eb3e1){if(_0x1eb3e1&&_0x1eb3e1[_0xc8b5('0x54')]===0x0){return db[_0xc8b5('0x55')][_0xc8b5('0x4d')]({'name':_0x4d21d8[_0xc8b5('0x2d')],'resourceId':_0x4d21d8['id'],'type':_0x1eb3e1[_0xc8b5('0x2d')],'sectionId':_0x1eb3e1['id']},{})[_0xc8b5('0x27')](function(){return _0x452546;});}else{return _0x452546;}})[_0xc8b5('0x47')](function(_0x19f8ea){logger[_0xc8b5('0x2b')](_0xc8b5('0x5a'),_0x19f8ea);throw _0x19f8ea;});}return _0x452546;});}})[_0xc8b5('0x27')](respondWithResult(_0x9b7a56,0xc9))[_0xc8b5('0x47')](handleError(_0x9b7a56,null));};exports[_0xc8b5('0x26')]=function(_0x50e016,_0x20463a){if(_0x50e016[_0xc8b5('0x4e')]['id']){delete _0x50e016['body']['id'];}return db[_0xc8b5('0x42')]['find']({'where':{'id':_0x50e016['params']['id']}})[_0xc8b5('0x27')](handleEntityNotFound(_0x20463a,null))['then'](saveUpdates(_0x50e016[_0xc8b5('0x4e')],null))[_0xc8b5('0x27')](respondWithResult(_0x20463a,null))[_0xc8b5('0x47')](handleError(_0x20463a,null));};exports['destroy']=function(_0x183824,_0x3d0910){return db[_0xc8b5('0x42')]['find']({'where':{'id':_0x183824[_0xc8b5('0x49')]['id']}})[_0xc8b5('0x27')](handleEntityNotFound(_0x3d0910,null))['then'](removeEntity(_0x3d0910,null))[_0xc8b5('0x47')](handleError(_0x3d0910,null));};exports[_0xc8b5('0x5b')]=function(_0x17f585,_0x1f8358,_0x2f5d35){var _0x456f4a={'raw':!![],'where':{}};var _0x2f4453={};var _0x1ab9eb={'count':0x0,'rows':[]};return db[_0xc8b5('0x42')][_0xc8b5('0x5c')]({'where':{'id':_0x17f585['params']['id']}})[_0xc8b5('0x27')](handleEntityNotFound(_0x1f8358,null))[_0xc8b5('0x27')](function(_0x3aaa22){if(_0x3aaa22){_0x2f4453[_0xc8b5('0x33')]=_[_0xc8b5('0x34')](db[_0xc8b5('0x5d')][_0xc8b5('0x30')]);_0x2f4453[_0xc8b5('0x35')]=_[_0xc8b5('0x34')](_0x17f585[_0xc8b5('0x35')]);_0x2f4453[_0xc8b5('0x3d')]=_[_0xc8b5('0x36')](_0x2f4453[_0xc8b5('0x33')],_0x2f4453[_0xc8b5('0x35')]);_0x456f4a[_0xc8b5('0x37')]=_[_0xc8b5('0x36')](_0x2f4453[_0xc8b5('0x33')],qs[_0xc8b5('0x4a')](_0x17f585['query'][_0xc8b5('0x4a')]));_0x456f4a[_0xc8b5('0x37')]=_0x456f4a[_0xc8b5('0x37')][_0xc8b5('0x38')]?_0x456f4a[_0xc8b5('0x37')]:_0x2f4453[_0xc8b5('0x33')];if(!_0x17f585[_0xc8b5('0x35')]['hasOwnProperty'](_0xc8b5('0x5e'))){_0x456f4a['limit']=qs[_0xc8b5('0x22')](_0x17f585[_0xc8b5('0x35')]['limit']);_0x456f4a[_0xc8b5('0x1f')]=qs['offset'](_0x17f585[_0xc8b5('0x35')][_0xc8b5('0x1f')]);}_0x456f4a[_0xc8b5('0x3a')]=qs['sort'](_0x17f585[_0xc8b5('0x35')][_0xc8b5('0x3b')]);_0x456f4a[_0xc8b5('0x3c')]=qs[_0xc8b5('0x3d')](_[_0xc8b5('0x5f')](_0x17f585[_0xc8b5('0x35')],_0x2f4453[_0xc8b5('0x3d')]));_0x456f4a[_0xc8b5('0x3c')]['ProjectId']=_0x3aaa22['id'];if(_0x17f585[_0xc8b5('0x35')][_0xc8b5('0x3e')]){_0x456f4a['where']=_['merge'](_0x456f4a[_0xc8b5('0x3c')],{'$or':_['map'](_0x456f4a[_0xc8b5('0x37')],function(_0x5627bd){var _0x33ec10={};_0x33ec10[_0x5627bd]={'$like':'%'+_0x17f585[_0xc8b5('0x35')]['filter']+'%'};return _0x33ec10;})});}_0x456f4a=_[_0xc8b5('0x3f')]({},_0x456f4a,_0x17f585['options']);return db[_0xc8b5('0x5d')]['count']({'where':_0x456f4a[_0xc8b5('0x3c')]})['then'](function(_0xa4f145){_0x1ab9eb[_0xc8b5('0x21')]=_0xa4f145;if(_0x17f585[_0xc8b5('0x35')][_0xc8b5('0x43')]){_0x456f4a['include']=[{'all':!![]}];}return db[_0xc8b5('0x5d')][_0xc8b5('0x45')](_0x456f4a);})[_0xc8b5('0x27')](function(_0xe2bbe2){_0x1ab9eb[_0xc8b5('0x46')]=_0xe2bbe2;return _0x1ab9eb;});}})[_0xc8b5('0x27')](respondWithFilteredResult(_0x1f8358,_0x456f4a))[_0xc8b5('0x47')](handleError(_0x1f8358,null));};exports[_0xc8b5('0x60')]=function(_0x152832,_0x21a3b7,_0x4f87ff){var _0x5e062d={'raw':!![],'where':{}};var _0x5e4fbf={};var _0x17c3ed={'count':0x0,'rows':[]};return db['JscriptyProject'][_0xc8b5('0x5c')]({'where':{'id':_0x152832[_0xc8b5('0x49')]['id']}})[_0xc8b5('0x27')](handleEntityNotFound(_0x21a3b7,null))[_0xc8b5('0x27')](function(_0x2d1418){if(_0x2d1418){_0x5e4fbf[_0xc8b5('0x33')]=_[_0xc8b5('0x34')](db[_0xc8b5('0x61')][_0xc8b5('0x30')]);_0x5e4fbf[_0xc8b5('0x35')]=_[_0xc8b5('0x34')](_0x152832[_0xc8b5('0x35')]);_0x5e4fbf[_0xc8b5('0x3d')]=_['intersection'](_0x5e4fbf[_0xc8b5('0x33')],_0x5e4fbf[_0xc8b5('0x35')]);_0x5e062d[_0xc8b5('0x37')]=_[_0xc8b5('0x36')](_0x5e4fbf[_0xc8b5('0x33')],qs[_0xc8b5('0x4a')](_0x152832['query'][_0xc8b5('0x4a')]));_0x5e062d[_0xc8b5('0x37')]=_0x5e062d[_0xc8b5('0x37')]['length']?_0x5e062d[_0xc8b5('0x37')]:_0x5e4fbf[_0xc8b5('0x33')];if(!_0x152832['query']['hasOwnProperty']('nolimit')){_0x5e062d[_0xc8b5('0x22')]=qs[_0xc8b5('0x22')](_0x152832[_0xc8b5('0x35')]['limit']);_0x5e062d[_0xc8b5('0x1f')]=qs[_0xc8b5('0x1f')](_0x152832[_0xc8b5('0x35')]['offset']);}_0x5e062d['order']=qs[_0xc8b5('0x3b')](_0x152832[_0xc8b5('0x35')][_0xc8b5('0x3b')]);_0x5e062d[_0xc8b5('0x3c')]=qs[_0xc8b5('0x3d')](_[_0xc8b5('0x5f')](_0x152832['query'],_0x5e4fbf[_0xc8b5('0x3d')]));_0x5e062d['where'][_0xc8b5('0x62')]=_0x2d1418['id'];if(_0x152832['query'][_0xc8b5('0x3e')]){_0x5e062d['where']=_['merge'](_0x5e062d[_0xc8b5('0x3c')],{'$or':_[_0xc8b5('0x2f')](_0x5e062d[_0xc8b5('0x37')],function(_0x3c004e){var _0x9ae6e9={};_0x9ae6e9[_0x3c004e]={'$like':'%'+_0x152832[_0xc8b5('0x35')][_0xc8b5('0x3e')]+'%'};return _0x9ae6e9;})});}_0x5e062d=_[_0xc8b5('0x3f')]({},_0x5e062d,_0x152832[_0xc8b5('0x4b')]);return db[_0xc8b5('0x61')][_0xc8b5('0x21')]({'where':_0x5e062d[_0xc8b5('0x3c')]})[_0xc8b5('0x27')](function(_0xdb1c93){_0x17c3ed[_0xc8b5('0x21')]=_0xdb1c93;if(_0x152832[_0xc8b5('0x35')][_0xc8b5('0x43')]){_0x5e062d[_0xc8b5('0x44')]=[{'all':!![]}];}return db['JscriptyAnswerReport'][_0xc8b5('0x45')](_0x5e062d);})[_0xc8b5('0x27')](function(_0x39da75){_0x17c3ed[_0xc8b5('0x46')]=_0x39da75;return _0x17c3ed;});}})['then'](respondWithFilteredResult(_0x21a3b7,_0x5e062d))['catch'](handleError(_0x21a3b7,null));};function char(_0x4555c4){return _0xc8b5('0x63')===typeof _0x4555c4?String['fromCharCode'][_0xc8b5('0x25')](null,arguments):_0x4555c4;}function needsEncapsulation(_0xbe6def){return!!_0xbe6def&&(_0xbe6def[_0xc8b5('0x64')]()[_0xc8b5('0x65')](char(0xd))>=0x0||_0xbe6def['toString']()[_0xc8b5('0x65')](char(0xa))>=0x0||_0xbe6def['toString']()['indexOf'](char(0x2c))>=0x0||_0xbe6def['toString']()['indexOf'](char(0x22))>=0x0);}function encapsulate(_0x87e46a){var _0x544607=char(0x22),_0x3ed66b='\x5c'+char(0x22),_0xc2713c=_0x87e46a[_0xc8b5('0x64')]()[_0xc8b5('0x66')](new RegExp(_0x544607,'g'),_0x3ed66b);return _0x544607+_0xc2713c+_0x544607;}exports[_0xc8b5('0x67')]=function(_0x1f9ee2,_0x318124,_0x367d65){var _0x3d2ce6,_0x415c43;var _0x2edd13={'where':{'ProjectId':_0x1f9ee2[_0xc8b5('0x49')]['id']}};if(_0x1f9ee2[_0xc8b5('0x35')][_0xc8b5('0x68')]){_0x2edd13[_0xc8b5('0x3c')][_0xc8b5('0x69')]=JSON[_0xc8b5('0x6a')](_0x1f9ee2['query']['startTime']);}return db['JscriptySessionReport'][_0xc8b5('0x45')](_0x2edd13)[_0xc8b5('0x27')](handleEntityNotFound(_0x318124,null))['then'](function(_0x3df4d9){if(_0x3df4d9){_0x3d2ce6=_0x3df4d9;return db[_0xc8b5('0x6b')]['findAll']({'where':{'SessionId':{'$in':_[_0xc8b5('0x2f')](_0x3d2ce6,'id')},'ProjectId':_0x1f9ee2[_0xc8b5('0x49')]['id']},'order':_0xc8b5('0x6c')});}})[_0xc8b5('0x27')](handleEntityNotFound(_0x318124,null))[_0xc8b5('0x27')](function(_0x56bb91){if(_0x56bb91){_0x415c43=_0x56bb91;var _0xbf4e56={};for(var _0x4890bd=0x0,_0x3ded01=_0x415c43['length'];_0x4890bd<_0x3ded01;_0x4890bd++){if(!_0xbf4e56[_0xc8b5('0x39')](_0x415c43[_0x4890bd][_0xc8b5('0x6d')])){_0xbf4e56[_0x415c43[_0x4890bd][_0xc8b5('0x6d')]]=needsEncapsulation(_0x415c43[_0x4890bd][_0xc8b5('0x6e')])?encapsulate(_0x415c43[_0x4890bd][_0xc8b5('0x6e')]):_0x415c43[_0x4890bd]['question'];}}var _0x32ecd7=[],_0x3caa41={};for(var _0x5b8b36=0x0,_0xf7bddd=_0x3d2ce6['length'];_0x5b8b36<_0xf7bddd;_0x5b8b36++){_0x3caa41={'ProjectId':_0x1f9ee2[_0xc8b5('0x49')]['id'],'SessionId':_0x3d2ce6[_0x5b8b36]['id'],'StartTime':moment(_0x3d2ce6[_0x5b8b36][_0xc8b5('0x69')])[_0xc8b5('0x6f')](_0xc8b5('0x70'))};for(var _0x1ee2df=0x0,_0x468955=_0x415c43[_0xc8b5('0x38')];_0x1ee2df<_0x468955;_0x1ee2df++){if(_0x415c43[_0x1ee2df][_0xc8b5('0x71')]==_0x3d2ce6[_0x5b8b36]['id']&&_0xbf4e56[_0xc8b5('0x39')](_0x415c43[_0x1ee2df][_0xc8b5('0x6d')])){_0x3caa41[_0xbf4e56[_0x415c43[_0x1ee2df][_0xc8b5('0x6d')]]]=_0x415c43[_0x1ee2df][_0xc8b5('0x72')];}}for(var _0x536ad6 in _0xbf4e56){if(!_0x3caa41['hasOwnProperty'](_0xbf4e56[_0x536ad6])){_0x3caa41[_0xbf4e56[_0x536ad6]]=null;}}_0x32ecd7[_0xc8b5('0x73')](_0x3caa41);}return _0x32ecd7;}})[_0xc8b5('0x27')](function(_0x55f03b){if(!_[_0xc8b5('0x74')](_0x55f03b)){var _0x2e35f0=toCsv(_0x55f03b);var _0x5bf6bd=Date[_0xc8b5('0x75')]();fs['writeFileSync'](util[_0xc8b5('0x6f')](_0xc8b5('0x76'),_0x1f9ee2[_0xc8b5('0x49')]['id'],_0x5bf6bd),_0x2e35f0);_0x318124['setHeader'](_0xc8b5('0x77'),'attachment;\x20filename='+util[_0xc8b5('0x6f')]('Jscripty_Project_%d_Summary_%s.csv',_0x1f9ee2[_0xc8b5('0x49')]['id'],_0x5bf6bd));_0x318124[_0xc8b5('0x78')](_0xc8b5('0x79'),'text/csv');return _0x318124['download'](util['format'](_0xc8b5('0x76'),_0x1f9ee2[_0xc8b5('0x49')]['id'],_0x5bf6bd));}else{return _0x318124['sendStatus'](0xcc);}})[_0xc8b5('0x47')](handleError(_0x318124,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index f5420aa..3346c7e 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 _0x4abf=['rimraf','exports','define','jscripty_projects','lodash','util','api','path'];(function(_0x35b69d,_0x3f08b){var _0x4ccc26=function(_0x2d2403){while(--_0x2d2403){_0x35b69d['push'](_0x35b69d['shift']());}};_0x4ccc26(++_0x3f08b);}(_0x4abf,0xac));var _0xf4ab=function(_0x255a85,_0x43ea4c){_0x255a85=_0x255a85-0x0;var _0x5ee089=_0x4abf[_0x255a85];return _0x5ee089;};'use strict';var _=require(_0xf4ab('0x0'));var util=require(_0xf4ab('0x1'));var logger=require('../../config/logger')(_0xf4ab('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xf4ab('0x3'));var rimraf=require(_0xf4ab('0x4'));var config=require('../../config/environment');var attributes=require('./jscriptyProject.attributes');module[_0xf4ab('0x5')]=function(_0x4160fb,_0x2e6efe){return _0x4160fb[_0xf4ab('0x6')]('JscriptyProject',attributes,{'tableName':_0xf4ab('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd6d6=['path','rimraf','../../config/environment','./jscriptyProject.attributes','exports','define','JscriptyProject','jscripty_projects','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x356896,_0x50b8b2){var _0x5a1207=function(_0x20b02c){while(--_0x20b02c){_0x356896['push'](_0x356896['shift']());}};_0x5a1207(++_0x50b8b2);}(_0xd6d6,0xbe));var _0x6d6d=function(_0x34290b,_0x149d03){_0x34290b=_0x34290b-0x0;var _0x4147d7=_0xd6d6[_0x34290b];return _0x4147d7;};'use strict';var _=require(_0x6d6d('0x0'));var util=require(_0x6d6d('0x1'));var logger=require(_0x6d6d('0x2'))(_0x6d6d('0x3'));var moment=require('moment');var BPromise=require(_0x6d6d('0x4'));var rp=require(_0x6d6d('0x5'));var fs=require('fs');var path=require(_0x6d6d('0x6'));var rimraf=require(_0x6d6d('0x7'));var config=require(_0x6d6d('0x8'));var attributes=require(_0x6d6d('0x9'));module[_0x6d6d('0xa')]=function(_0x5702dc,_0x210ff7){return _0x5702dc[_0x6d6d('0xb')](_0x6d6d('0xc'),attributes,{'tableName':_0x6d6d('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.rpc.js b/server/api/jscriptyProject/jscriptyProject.rpc.js index e2ebd92..0884670 100644 --- a/server/api/jscriptyProject/jscriptyProject.rpc.js +++ b/server/api/jscriptyProject/jscriptyProject.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xaa88=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','then','info','request\x20sent','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','error','JscriptyProject,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird'];(function(_0x38fcbb,_0xd2b478){var _0x4bbb75=function(_0x3575d5){while(--_0x3575d5){_0x38fcbb['push'](_0x38fcbb['shift']());}};_0x4bbb75(++_0xd2b478);}(_0xaa88,0x137));var _0x8aa8=function(_0x349148,_0x31eabb){_0x349148=_0x349148-0x0;var _0x2f2b0f=_0xaa88[_0x349148];return _0x2f2b0f;};'use strict';var _=require(_0x8aa8('0x0'));var util=require(_0x8aa8('0x1'));var moment=require(_0x8aa8('0x2'));var BPromise=require(_0x8aa8('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8aa8('0x4'));var db=require(_0x8aa8('0x5'))['db'];var utils=require(_0x8aa8('0x6'));var logger=require(_0x8aa8('0x7'))(_0x8aa8('0x8'));var config=require(_0x8aa8('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x8aa8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5264ff,_0x449d2d,_0x1ed84d){return new BPromise(function(_0x27c08d,_0x40826f){return client['request'](_0x5264ff,_0x1ed84d)[_0x8aa8('0xb')](function(_0x2d974c){logger[_0x8aa8('0xc')]('JscriptyProject,\x20%s,\x20%s',_0x449d2d,_0x8aa8('0xd'));logger[_0x8aa8('0xe')](_0x8aa8('0xf'),_0x449d2d,_0x8aa8('0xd'),JSON['stringify'](_0x2d974c));if(_0x2d974c[_0x8aa8('0x10')]){if(_0x2d974c[_0x8aa8('0x10')]['code']===0x1f4){logger[_0x8aa8('0x10')](_0x8aa8('0x11'),_0x449d2d,_0x2d974c[_0x8aa8('0x10')]['message']);return _0x40826f(_0x2d974c[_0x8aa8('0x10')][_0x8aa8('0x12')]);}logger[_0x8aa8('0x10')]('JscriptyProject,\x20%s,\x20%s',_0x449d2d,_0x2d974c[_0x8aa8('0x10')]['message']);return _0x27c08d(_0x2d974c['error'][_0x8aa8('0x12')]);}else{logger[_0x8aa8('0xc')](_0x8aa8('0x11'),_0x449d2d,_0x8aa8('0xd'));_0x27c08d(_0x2d974c[_0x8aa8('0x13')][_0x8aa8('0x12')]);}})[_0x8aa8('0x14')](function(_0xd59fb8){logger[_0x8aa8('0x10')]('JscriptyProject,\x20%s,\x20%s',_0x449d2d,_0xd59fb8);_0x40826f(_0xd59fb8);});});} \ No newline at end of file +var _0x70e0=['code','JscriptyProject,\x20%s,\x20%s','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','then','info','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x421256,_0x3bf022){var _0x5ccfe8=function(_0x19ab87){while(--_0x19ab87){_0x421256['push'](_0x421256['shift']());}};_0x5ccfe8(++_0x3bf022);}(_0x70e0,0x17b));var _0x070e=function(_0x225673,_0x527b21){_0x225673=_0x225673-0x0;var _0xb9d9f3=_0x70e0[_0x225673];return _0xb9d9f3;};'use strict';var _=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var moment=require(_0x070e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x070e('0x3'));var db=require(_0x070e('0x4'))['db'];var utils=require(_0x070e('0x5'));var logger=require(_0x070e('0x6'))('rpc');var config=require(_0x070e('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x070e('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x56e420,_0x5032e5,_0x35ab0c){return new BPromise(function(_0x1e11f0,_0x604664){return client[_0x070e('0x9')](_0x56e420,_0x35ab0c)[_0x070e('0xa')](function(_0x68a09e){logger[_0x070e('0xb')]('JscriptyProject,\x20%s,\x20%s',_0x5032e5,'request\x20sent');logger[_0x070e('0xc')](_0x070e('0xd'),_0x5032e5,_0x070e('0xe'),JSON[_0x070e('0xf')](_0x68a09e));if(_0x68a09e[_0x070e('0x10')]){if(_0x68a09e[_0x070e('0x10')][_0x070e('0x11')]===0x1f4){logger[_0x070e('0x10')](_0x070e('0x12'),_0x5032e5,_0x68a09e[_0x070e('0x10')][_0x070e('0x13')]);return _0x604664(_0x68a09e['error']['message']);}logger[_0x070e('0x10')]('JscriptyProject,\x20%s,\x20%s',_0x5032e5,_0x68a09e['error']['message']);return _0x1e11f0(_0x68a09e[_0x070e('0x10')][_0x070e('0x13')]);}else{logger['info']('JscriptyProject,\x20%s,\x20%s',_0x5032e5,_0x070e('0xe'));_0x1e11f0(_0x68a09e[_0x070e('0x14')][_0x070e('0x13')]);}})[_0x070e('0x15')](function(_0x5bc71e){logger['error'](_0x070e('0x12'),_0x5032e5,_0x5bc71e);_0x604664(_0x5bc71e);});});} \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index 82a8e17..d6bee01 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 _0xaf56=['update','destroy','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyQuestionReport.controller','isAuthenticated','index','/describe','describe','get','show','post','create'];(function(_0x1e081a,_0x482d6b){var _0x428209=function(_0x524b53){while(--_0x524b53){_0x1e081a['push'](_0x1e081a['shift']());}};_0x428209(++_0x482d6b);}(_0xaf56,0x145));var _0x6af5=function(_0x456b77,_0x4fed12){_0x456b77=_0x456b77-0x0;var _0x118bb6=_0xaf56[_0x456b77];return _0x118bb6;};'use strict';var multer=require('multer');var util=require(_0x6af5('0x0'));var path=require(_0x6af5('0x1'));var timeout=require('connect-timeout');var express=require(_0x6af5('0x2'));var router=express[_0x6af5('0x3')]();var fs_extra=require(_0x6af5('0x4'));var auth=require(_0x6af5('0x5'));var interaction=require(_0x6af5('0x6'));var config=require(_0x6af5('0x7'));var controller=require(_0x6af5('0x8'));router['get']('/',auth[_0x6af5('0x9')](),controller[_0x6af5('0xa')]);router['get'](_0x6af5('0xb'),auth[_0x6af5('0x9')](),controller[_0x6af5('0xc')]);router[_0x6af5('0xd')]('/:id',auth[_0x6af5('0x9')](),controller[_0x6af5('0xe')]);router[_0x6af5('0xf')]('/',auth['isAuthenticated'](),controller[_0x6af5('0x10')]);router['put']('/:id',auth[_0x6af5('0x9')](),controller[_0x6af5('0x11')]);router['delete']('/:id',auth[_0x6af5('0x9')](),controller[_0x6af5('0x12')]);module['exports']=router; \ No newline at end of file +var _0x12e5=['isAuthenticated','/describe','describe','/:id','show','create','put','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyQuestionReport.controller','get'];(function(_0x5e9906,_0x61ae75){var _0x2b8c25=function(_0x3e1789){while(--_0x3e1789){_0x5e9906['push'](_0x5e9906['shift']());}};_0x2b8c25(++_0x61ae75);}(_0x12e5,0xd1));var _0x512e=function(_0x23da4c,_0x25a58f){_0x23da4c=_0x23da4c-0x0;var _0x359022=_0x12e5[_0x23da4c];return _0x359022;};'use strict';var multer=require(_0x512e('0x0'));var util=require(_0x512e('0x1'));var path=require('path');var timeout=require(_0x512e('0x2'));var express=require(_0x512e('0x3'));var router=express[_0x512e('0x4')]();var fs_extra=require(_0x512e('0x5'));var auth=require(_0x512e('0x6'));var interaction=require(_0x512e('0x7'));var config=require(_0x512e('0x8'));var controller=require(_0x512e('0x9'));router[_0x512e('0xa')]('/',auth[_0x512e('0xb')](),controller['index']);router[_0x512e('0xa')](_0x512e('0xc'),auth[_0x512e('0xb')](),controller[_0x512e('0xd')]);router[_0x512e('0xa')](_0x512e('0xe'),auth[_0x512e('0xb')](),controller[_0x512e('0xf')]);router['post']('/',auth[_0x512e('0xb')](),controller[_0x512e('0x10')]);router[_0x512e('0x11')]('/:id',auth[_0x512e('0xb')](),controller['update']);router['delete'](_0x512e('0xe'),auth[_0x512e('0xb')](),controller[_0x512e('0x12')]);module[_0x512e('0x13')]=router; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js index 2375e94..e1cae9a 100644 --- a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js +++ b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['long','STRING','sequelize','exports','TEXT'];(function(_0x1928c9,_0x13a6d1){var _0x51b5fb=function(_0x24cf70){while(--_0x24cf70){_0x1928c9['push'](_0x1928c9['shift']());}};_0x51b5fb(++_0x13a6d1);}(_0x7a54,0x106));var _0x47a5=function(_0x18818b,_0x49fd1d){_0x18818b=_0x18818b-0x0;var _0x464d5c=_0x7a54[_0x18818b];return _0x464d5c;};'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(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x7a54,0x106));var _0x47a5=function(_0x3c4951,_0x15fdb7){_0x3c4951=_0x3c4951-0x0;var _0x10ff3e=_0x7a54[_0x3c4951];return _0x10ff3e;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'question':{'type':Sequelize[_0x47a5('0x2')]},'answer':{'type':Sequelize['TEXT'](_0x47a5('0x3'))},'membername':{'type':Sequelize[_0x47a5('0x4')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x47a5('0x4')]},'uniqueid':{'type':Sequelize[_0x47a5('0x4')]},'calleridname':{'type':Sequelize[_0x47a5('0x4')]},'calleridnum':{'type':Sequelize[_0x47a5('0x4')]},'questionId':{'type':Sequelize[_0x47a5('0x4')]}}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.controller.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.controller.js index dcac53d..dbfee1e 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 _0xdfdc=['jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','apply','reject','save','update','then','destroy','error','stack','name','index','map','JscriptyQuestionReport','rawAttributes','type','keys','filters','intersection','model','query','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','describe','eml-format','zip-dir','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','crypto'];(function(_0x5cabfd,_0x5dea47){var _0x4bc06c=function(_0x4a2fea){while(--_0x4a2fea){_0x5cabfd['push'](_0x5cabfd['shift']());}};_0x4bc06c(++_0x5dea47);}(_0xdfdc,0x16b));var _0xcdfd=function(_0x250e66,_0x59b2e5){_0x250e66=_0x250e66-0x0;var _0x4f2835=_0xdfdc[_0x250e66];return _0x4f2835;};'use strict';var emlformat=require(_0xcdfd('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xcdfd('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xcdfd('0x2'));var moment=require(_0xcdfd('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xcdfd('0x4'));var util=require(_0xcdfd('0x5'));var path=require('path');var sox=require(_0xcdfd('0x6'));var csv=require(_0xcdfd('0x7'));var ejs=require(_0xcdfd('0x8'));var fs=require('fs');var fs_extra=require(_0xcdfd('0x9'));var _=require(_0xcdfd('0xa'));var squel=require('squel');var crypto=require(_0xcdfd('0xb'));var jsforce=require(_0xcdfd('0xc'));var deskjs=require(_0xcdfd('0xd'));var toCsv=require(_0xcdfd('0x7'));var querystring=require(_0xcdfd('0xe'));var Papa=require('papaparse');var Redis=require(_0xcdfd('0xf'));var authService=require(_0xcdfd('0x10'));var qs=require(_0xcdfd('0x11'));var as=require(_0xcdfd('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xcdfd('0x13'));var utils=require(_0xcdfd('0x14'));var config=require(_0xcdfd('0x15'));var licenseUtil=require(_0xcdfd('0x16'));var db=require(_0xcdfd('0x17'))['db'];function respondWithStatusCode(_0x28666b,_0x6e542f){_0x6e542f=_0x6e542f||0xcc;return function(_0x537ab1){if(_0x537ab1){return _0x28666b[_0xcdfd('0x18')](_0x6e542f);}return _0x28666b[_0xcdfd('0x19')](_0x6e542f)[_0xcdfd('0x1a')]();};}function respondWithResult(_0x1a854e,_0x17ec92){_0x17ec92=_0x17ec92||0xc8;return function(_0x21f151){if(_0x21f151){return _0x1a854e['status'](_0x17ec92)[_0xcdfd('0x1b')](_0x21f151);}};}function respondWithFilteredResult(_0x460490,_0x40b220){return function(_0x106c7f){if(_0x106c7f){var _0x2ebcc0=typeof _0x40b220[_0xcdfd('0x1c')]===_0xcdfd('0x1d')&&typeof _0x40b220['limit']===_0xcdfd('0x1d');var _0x309638=_0x106c7f[_0xcdfd('0x1e')];var _0x3fc2c1=_0x2ebcc0?0x0:_0x40b220['offset'];var _0x1f7820=_0x2ebcc0?_0x106c7f['count']:_0x40b220[_0xcdfd('0x1c')]+_0x40b220['limit'];var _0x32989a;if(_0x1f7820>=_0x309638){_0x1f7820=_0x309638;_0x32989a=0xc8;}else{_0x32989a=0xce;}_0x460490[_0xcdfd('0x19')](_0x32989a);return _0x460490['set']('Content-Range',_0x3fc2c1+'-'+_0x1f7820+'/'+_0x309638)[_0xcdfd('0x1b')](_0x106c7f);}return null;};}function patchUpdates(_0x4f720b){return function(_0x5e13f9){try{jsonpatch[_0xcdfd('0x1f')](_0x5e13f9,_0x4f720b,!![]);}catch(_0x90c02a){return BPromise[_0xcdfd('0x20')](_0x90c02a);}return _0x5e13f9[_0xcdfd('0x21')]();};}function saveUpdates(_0x4d4d89,_0x2c35bf){return function(_0x5ae3e6){if(_0x5ae3e6){return _0x5ae3e6[_0xcdfd('0x22')](_0x4d4d89)[_0xcdfd('0x23')](function(_0x43cb74){return _0x43cb74;});}return null;};}function removeEntity(_0xa1f9f9,_0x17b637){return function(_0x5cb0e9){if(_0x5cb0e9){return _0x5cb0e9[_0xcdfd('0x24')]()[_0xcdfd('0x23')](function(){_0xa1f9f9[_0xcdfd('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1fc27d,_0x153e67){return function(_0x5142a3){if(!_0x5142a3){_0x1fc27d['sendStatus'](0x194);}return _0x5142a3;};}function handleError(_0x12fe3b,_0xbc982f){_0xbc982f=_0xbc982f||0x1f4;return function(_0x1dfd77){logger[_0xcdfd('0x25')](_0x1dfd77[_0xcdfd('0x26')]);if(_0x1dfd77[_0xcdfd('0x27')]){delete _0x1dfd77[_0xcdfd('0x27')];}_0x12fe3b[_0xcdfd('0x19')](_0xbc982f)['send'](_0x1dfd77);};}exports[_0xcdfd('0x28')]=function(_0x198fa8,_0x464c33){var _0x195522={},_0x505b3c={},_0x9572ea={'count':0x0,'rows':[]};var _0x57ce1d=_[_0xcdfd('0x29')](db[_0xcdfd('0x2a')][_0xcdfd('0x2b')],function(_0x452c66){return{'name':_0x452c66['fieldName'],'type':_0x452c66[_0xcdfd('0x2c')]['key']};});_0x505b3c['model']=_['map'](_0x57ce1d,'name');_0x505b3c['query']=_[_0xcdfd('0x2d')](_0x198fa8['query']);_0x505b3c[_0xcdfd('0x2e')]=_[_0xcdfd('0x2f')](_0x505b3c[_0xcdfd('0x30')],_0x505b3c[_0xcdfd('0x31')]);_0x195522[_0xcdfd('0x32')]=_[_0xcdfd('0x2f')](_0x505b3c[_0xcdfd('0x30')],qs[_0xcdfd('0x33')](_0x198fa8[_0xcdfd('0x31')][_0xcdfd('0x33')]));_0x195522[_0xcdfd('0x32')]=_0x195522[_0xcdfd('0x32')][_0xcdfd('0x34')]?_0x195522['attributes']:_0x505b3c[_0xcdfd('0x30')];if(!_0x198fa8[_0xcdfd('0x31')][_0xcdfd('0x35')](_0xcdfd('0x36'))){_0x195522[_0xcdfd('0x37')]=qs['limit'](_0x198fa8[_0xcdfd('0x31')][_0xcdfd('0x37')]);_0x195522[_0xcdfd('0x1c')]=qs[_0xcdfd('0x1c')](_0x198fa8[_0xcdfd('0x31')]['offset']);}_0x195522[_0xcdfd('0x38')]=qs[_0xcdfd('0x39')](_0x198fa8[_0xcdfd('0x31')][_0xcdfd('0x39')]);_0x195522[_0xcdfd('0x3a')]=qs[_0xcdfd('0x2e')](_[_0xcdfd('0x3b')](_0x198fa8[_0xcdfd('0x31')],_0x505b3c['filters']),_0x57ce1d);if(_0x198fa8[_0xcdfd('0x31')][_0xcdfd('0x3c')]){_0x195522[_0xcdfd('0x3a')]=_[_0xcdfd('0x3d')](_0x195522['where'],{'$or':_['map'](_0x57ce1d,function(_0xe7ab38){if(_0xe7ab38[_0xcdfd('0x2c')]!==_0xcdfd('0x3e')){var _0x195a44={};_0x195a44[_0xe7ab38[_0xcdfd('0x27')]]={'$like':'%'+_0x198fa8[_0xcdfd('0x31')][_0xcdfd('0x3c')]+'%'};return _0x195a44;}})});}_0x195522=_[_0xcdfd('0x3d')]({},_0x195522,_0x198fa8[_0xcdfd('0x3f')]);var _0x4c81c9={'where':_0x195522[_0xcdfd('0x3a')]};return db[_0xcdfd('0x2a')][_0xcdfd('0x1e')](_0x4c81c9)[_0xcdfd('0x23')](function(_0x469ed9){_0x9572ea[_0xcdfd('0x1e')]=_0x469ed9;if(_0x198fa8['query'][_0xcdfd('0x40')]){_0x195522[_0xcdfd('0x41')]=[{'all':!![]}];}return db[_0xcdfd('0x2a')][_0xcdfd('0x42')](_0x195522);})['then'](function(_0x4afc51){_0x9572ea[_0xcdfd('0x43')]=_0x4afc51;return _0x9572ea;})['then'](respondWithFilteredResult(_0x464c33,_0x195522))[_0xcdfd('0x44')](handleError(_0x464c33,null));};exports[_0xcdfd('0x45')]=function(_0x5a339a,_0x2ff9f4){var _0x2c64a4={'raw':!![],'where':{'id':_0x5a339a[_0xcdfd('0x46')]['id']}},_0x1b0275={};_0x1b0275[_0xcdfd('0x30')]=_['keys'](db[_0xcdfd('0x2a')][_0xcdfd('0x2b')]);_0x1b0275['query']=_[_0xcdfd('0x2d')](_0x5a339a[_0xcdfd('0x31')]);_0x1b0275['filters']=_[_0xcdfd('0x2f')](_0x1b0275[_0xcdfd('0x30')],_0x1b0275[_0xcdfd('0x31')]);_0x2c64a4['attributes']=_[_0xcdfd('0x2f')](_0x1b0275[_0xcdfd('0x30')],qs[_0xcdfd('0x33')](_0x5a339a[_0xcdfd('0x31')][_0xcdfd('0x33')]));_0x2c64a4['attributes']=_0x2c64a4[_0xcdfd('0x32')][_0xcdfd('0x34')]?_0x2c64a4[_0xcdfd('0x32')]:_0x1b0275[_0xcdfd('0x30')];if(_0x5a339a['query'][_0xcdfd('0x40')]){_0x2c64a4[_0xcdfd('0x41')]=[{'all':!![]}];}_0x2c64a4=_[_0xcdfd('0x3d')]({},_0x2c64a4,_0x5a339a[_0xcdfd('0x3f')]);return db[_0xcdfd('0x2a')][_0xcdfd('0x47')](_0x2c64a4)[_0xcdfd('0x23')](handleEntityNotFound(_0x2ff9f4,null))['then'](respondWithResult(_0x2ff9f4,null))[_0xcdfd('0x44')](handleError(_0x2ff9f4,null));};exports['create']=function(_0x3ffab1,_0x380ab0){return db[_0xcdfd('0x2a')][_0xcdfd('0x48')](_0x3ffab1[_0xcdfd('0x49')],{})['then'](respondWithResult(_0x380ab0,0xc9))[_0xcdfd('0x44')](handleError(_0x380ab0,null));};exports[_0xcdfd('0x22')]=function(_0x3a46b4,_0x3dce21){if(_0x3a46b4['body']['id']){delete _0x3a46b4[_0xcdfd('0x49')]['id'];}return db[_0xcdfd('0x2a')][_0xcdfd('0x47')]({'where':{'id':_0x3a46b4[_0xcdfd('0x46')]['id']}})[_0xcdfd('0x23')](handleEntityNotFound(_0x3dce21,null))[_0xcdfd('0x23')](saveUpdates(_0x3a46b4[_0xcdfd('0x49')],null))[_0xcdfd('0x23')](respondWithResult(_0x3dce21,null))[_0xcdfd('0x44')](handleError(_0x3dce21,null));};exports['destroy']=function(_0x3bac9a,_0xa6c062){return db[_0xcdfd('0x2a')][_0xcdfd('0x47')]({'where':{'id':_0x3bac9a['params']['id']}})[_0xcdfd('0x23')](handleEntityNotFound(_0xa6c062,null))['then'](removeEntity(_0xa6c062,null))[_0xcdfd('0x44')](handleError(_0xa6c062,null));};exports[_0xcdfd('0x4a')]=function(_0x261eae,_0x53b855){return db['JscriptyQuestionReport'][_0xcdfd('0x4a')]()[_0xcdfd('0x23')](respondWithResult(_0x53b855,null))[_0xcdfd('0x44')](handleError(_0x53b855,null));}; \ No newline at end of file +var _0x9f53=['squel','jsforce','desk.js','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','sendStatus','status','end','offset','undefined','count','set','Content-Range','json','apply','then','destroy','error','name','send','index','map','JscriptyQuestionReport','fieldName','model','query','keys','filters','intersection','fields','attributes','length','limit','order','sort','pick','filter','where','merge','type','options','includeAll','catch','params','include','find','create','body','update','describe','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x9f53,0xfb));var _0x39f5=function(_0x192359,_0x59a2da){_0x192359=_0x192359-0x0;var _0x4ae7d1=_0x9f53[_0x192359];return _0x4ae7d1;};'use strict';var emlformat=require(_0x39f5('0x0'));var rimraf=require(_0x39f5('0x1'));var zipdir=require(_0x39f5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x39f5('0x3'));var moment=require(_0x39f5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x39f5('0x5'));var util=require(_0x39f5('0x6'));var path=require(_0x39f5('0x7'));var sox=require(_0x39f5('0x8'));var csv=require(_0x39f5('0x9'));var ejs=require(_0x39f5('0xa'));var fs=require('fs');var fs_extra=require(_0x39f5('0xb'));var _=require(_0x39f5('0xc'));var squel=require(_0x39f5('0xd'));var crypto=require('crypto');var jsforce=require(_0x39f5('0xe'));var deskjs=require(_0x39f5('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x39f5('0x10'));var qs=require(_0x39f5('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x39f5('0x12'));var logger=require(_0x39f5('0x13'))('api');var utils=require('../../config/utils');var config=require(_0x39f5('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x26450e,_0x46f793){_0x46f793=_0x46f793||0xcc;return function(_0x19f6a0){if(_0x19f6a0){return _0x26450e[_0x39f5('0x15')](_0x46f793);}return _0x26450e[_0x39f5('0x16')](_0x46f793)[_0x39f5('0x17')]();};}function respondWithResult(_0x5255c9,_0x4ed374){_0x4ed374=_0x4ed374||0xc8;return function(_0x35e8a4){if(_0x35e8a4){return _0x5255c9['status'](_0x4ed374)['json'](_0x35e8a4);}};}function respondWithFilteredResult(_0x387500,_0x515e5b){return function(_0x4adec3){if(_0x4adec3){var _0x55d708=typeof _0x515e5b[_0x39f5('0x18')]==='undefined'&&typeof _0x515e5b['limit']===_0x39f5('0x19');var _0x224f61=_0x4adec3[_0x39f5('0x1a')];var _0x124c79=_0x55d708?0x0:_0x515e5b[_0x39f5('0x18')];var _0x3fb103=_0x55d708?_0x4adec3[_0x39f5('0x1a')]:_0x515e5b['offset']+_0x515e5b['limit'];var _0x29c93a;if(_0x3fb103>=_0x224f61){_0x3fb103=_0x224f61;_0x29c93a=0xc8;}else{_0x29c93a=0xce;}_0x387500['status'](_0x29c93a);return _0x387500[_0x39f5('0x1b')](_0x39f5('0x1c'),_0x124c79+'-'+_0x3fb103+'/'+_0x224f61)[_0x39f5('0x1d')](_0x4adec3);}return null;};}function patchUpdates(_0x58e524){return function(_0x14f950){try{jsonpatch[_0x39f5('0x1e')](_0x14f950,_0x58e524,!![]);}catch(_0x2624fd){return BPromise['reject'](_0x2624fd);}return _0x14f950['save']();};}function saveUpdates(_0x387f8c,_0x36849b){return function(_0x51d83a){if(_0x51d83a){return _0x51d83a['update'](_0x387f8c)[_0x39f5('0x1f')](function(_0x36a9ca){return _0x36a9ca;});}return null;};}function removeEntity(_0x2b1181,_0x2e20ac){return function(_0x177caa){if(_0x177caa){return _0x177caa[_0x39f5('0x20')]()[_0x39f5('0x1f')](function(){_0x2b1181[_0x39f5('0x16')](0xcc)[_0x39f5('0x17')]();});}};}function handleEntityNotFound(_0x1f3933,_0x15fd7e){return function(_0x497ba9){if(!_0x497ba9){_0x1f3933[_0x39f5('0x15')](0x194);}return _0x497ba9;};}function handleError(_0x52acfa,_0x5e3a2f){_0x5e3a2f=_0x5e3a2f||0x1f4;return function(_0x46b90a){logger[_0x39f5('0x21')](_0x46b90a['stack']);if(_0x46b90a['name']){delete _0x46b90a[_0x39f5('0x22')];}_0x52acfa['status'](_0x5e3a2f)[_0x39f5('0x23')](_0x46b90a);};}exports[_0x39f5('0x24')]=function(_0x4803c2,_0x41c3c6){var _0x3260b4={},_0x5438fa={},_0xa207e0={'count':0x0,'rows':[]};var _0x4a226e=_[_0x39f5('0x25')](db[_0x39f5('0x26')]['rawAttributes'],function(_0x17c1f8){return{'name':_0x17c1f8[_0x39f5('0x27')],'type':_0x17c1f8['type']['key']};});_0x5438fa[_0x39f5('0x28')]=_[_0x39f5('0x25')](_0x4a226e,'name');_0x5438fa[_0x39f5('0x29')]=_[_0x39f5('0x2a')](_0x4803c2[_0x39f5('0x29')]);_0x5438fa[_0x39f5('0x2b')]=_[_0x39f5('0x2c')](_0x5438fa[_0x39f5('0x28')],_0x5438fa[_0x39f5('0x29')]);_0x3260b4['attributes']=_[_0x39f5('0x2c')](_0x5438fa['model'],qs['fields'](_0x4803c2[_0x39f5('0x29')][_0x39f5('0x2d')]));_0x3260b4[_0x39f5('0x2e')]=_0x3260b4[_0x39f5('0x2e')][_0x39f5('0x2f')]?_0x3260b4[_0x39f5('0x2e')]:_0x5438fa[_0x39f5('0x28')];if(!_0x4803c2[_0x39f5('0x29')]['hasOwnProperty']('nolimit')){_0x3260b4[_0x39f5('0x30')]=qs[_0x39f5('0x30')](_0x4803c2['query'][_0x39f5('0x30')]);_0x3260b4[_0x39f5('0x18')]=qs['offset'](_0x4803c2['query'][_0x39f5('0x18')]);}_0x3260b4[_0x39f5('0x31')]=qs[_0x39f5('0x32')](_0x4803c2['query'][_0x39f5('0x32')]);_0x3260b4['where']=qs[_0x39f5('0x2b')](_[_0x39f5('0x33')](_0x4803c2[_0x39f5('0x29')],_0x5438fa[_0x39f5('0x2b')]),_0x4a226e);if(_0x4803c2[_0x39f5('0x29')][_0x39f5('0x34')]){_0x3260b4[_0x39f5('0x35')]=_[_0x39f5('0x36')](_0x3260b4[_0x39f5('0x35')],{'$or':_[_0x39f5('0x25')](_0x4a226e,function(_0x37e27c){if(_0x37e27c[_0x39f5('0x37')]!=='VIRTUAL'){var _0x2544a0={};_0x2544a0[_0x37e27c['name']]={'$like':'%'+_0x4803c2['query'][_0x39f5('0x34')]+'%'};return _0x2544a0;}})});}_0x3260b4=_['merge']({},_0x3260b4,_0x4803c2[_0x39f5('0x38')]);var _0x989b3f={'where':_0x3260b4['where']};return db[_0x39f5('0x26')]['count'](_0x989b3f)[_0x39f5('0x1f')](function(_0x2a8098){_0xa207e0[_0x39f5('0x1a')]=_0x2a8098;if(_0x4803c2[_0x39f5('0x29')][_0x39f5('0x39')]){_0x3260b4['include']=[{'all':!![]}];}return db['JscriptyQuestionReport']['findAll'](_0x3260b4);})[_0x39f5('0x1f')](function(_0x24a82c){_0xa207e0['rows']=_0x24a82c;return _0xa207e0;})[_0x39f5('0x1f')](respondWithFilteredResult(_0x41c3c6,_0x3260b4))[_0x39f5('0x3a')](handleError(_0x41c3c6,null));};exports['show']=function(_0x2355a0,_0x2957c4){var _0x523fc0={'raw':!![],'where':{'id':_0x2355a0[_0x39f5('0x3b')]['id']}},_0x3f6688={};_0x3f6688['model']=_[_0x39f5('0x2a')](db[_0x39f5('0x26')]['rawAttributes']);_0x3f6688[_0x39f5('0x29')]=_['keys'](_0x2355a0[_0x39f5('0x29')]);_0x3f6688['filters']=_[_0x39f5('0x2c')](_0x3f6688[_0x39f5('0x28')],_0x3f6688['query']);_0x523fc0[_0x39f5('0x2e')]=_[_0x39f5('0x2c')](_0x3f6688[_0x39f5('0x28')],qs['fields'](_0x2355a0[_0x39f5('0x29')]['fields']));_0x523fc0[_0x39f5('0x2e')]=_0x523fc0[_0x39f5('0x2e')]['length']?_0x523fc0[_0x39f5('0x2e')]:_0x3f6688[_0x39f5('0x28')];if(_0x2355a0[_0x39f5('0x29')][_0x39f5('0x39')]){_0x523fc0[_0x39f5('0x3c')]=[{'all':!![]}];}_0x523fc0=_[_0x39f5('0x36')]({},_0x523fc0,_0x2355a0[_0x39f5('0x38')]);return db[_0x39f5('0x26')][_0x39f5('0x3d')](_0x523fc0)[_0x39f5('0x1f')](handleEntityNotFound(_0x2957c4,null))[_0x39f5('0x1f')](respondWithResult(_0x2957c4,null))[_0x39f5('0x3a')](handleError(_0x2957c4,null));};exports['create']=function(_0x27d8be,_0x581485){return db[_0x39f5('0x26')][_0x39f5('0x3e')](_0x27d8be[_0x39f5('0x3f')],{})[_0x39f5('0x1f')](respondWithResult(_0x581485,0xc9))[_0x39f5('0x3a')](handleError(_0x581485,null));};exports[_0x39f5('0x40')]=function(_0x15edeb,_0x25b119){if(_0x15edeb[_0x39f5('0x3f')]['id']){delete _0x15edeb[_0x39f5('0x3f')]['id'];}return db[_0x39f5('0x26')][_0x39f5('0x3d')]({'where':{'id':_0x15edeb['params']['id']}})[_0x39f5('0x1f')](handleEntityNotFound(_0x25b119,null))[_0x39f5('0x1f')](saveUpdates(_0x15edeb[_0x39f5('0x3f')],null))[_0x39f5('0x1f')](respondWithResult(_0x25b119,null))[_0x39f5('0x3a')](handleError(_0x25b119,null));};exports[_0x39f5('0x20')]=function(_0x3adef3,_0x1ed4a7){return db[_0x39f5('0x26')][_0x39f5('0x3d')]({'where':{'id':_0x3adef3[_0x39f5('0x3b')]['id']}})[_0x39f5('0x1f')](handleEntityNotFound(_0x1ed4a7,null))[_0x39f5('0x1f')](removeEntity(_0x1ed4a7,null))[_0x39f5('0x3a')](handleError(_0x1ed4a7,null));};exports[_0x39f5('0x41')]=function(_0x4738ff,_0x36e781){return db[_0x39f5('0x26')][_0x39f5('0x41')]()[_0x39f5('0x1f')](respondWithResult(_0x36e781,null))[_0x39f5('0x3a')](handleError(_0x36e781,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index 197ef45..d185264 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 _0x7e1d=['bluebird','path','rimraf','./jscriptyQuestionReport.attributes','JscriptyQuestionReport','report_jscripty_questions','util','api','moment'];(function(_0x2708c7,_0x518322){var _0x52c498=function(_0xa53f9b){while(--_0xa53f9b){_0x2708c7['push'](_0x2708c7['shift']());}};_0x52c498(++_0x518322);}(_0x7e1d,0x1e3));var _0xd7e1=function(_0x34fd3b,_0x3ae84e){_0x34fd3b=_0x34fd3b-0x0;var _0x14a44e=_0x7e1d[_0x34fd3b];return _0x14a44e;};'use strict';var _=require('lodash');var util=require(_0xd7e1('0x0'));var logger=require('../../config/logger')(_0xd7e1('0x1'));var moment=require(_0xd7e1('0x2'));var BPromise=require(_0xd7e1('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd7e1('0x4'));var rimraf=require(_0xd7e1('0x5'));var config=require('../../config/environment');var attributes=require(_0xd7e1('0x6'));module['exports']=function(_0x51446f,_0x592068){return _0x51446f['define'](_0xd7e1('0x7'),attributes,{'tableName':_0xd7e1('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xabba=['../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./jscriptyQuestionReport.attributes','exports','define','JscriptyQuestionReport','lodash','util'];(function(_0x310abd,_0x31f749){var _0xafa4f8=function(_0x477029){while(--_0x477029){_0x310abd['push'](_0x310abd['shift']());}};_0xafa4f8(++_0x31f749);}(_0xabba,0x166));var _0xaabb=function(_0x2d55d5,_0x51e668){_0x2d55d5=_0x2d55d5-0x0;var _0x3ea899=_0xabba[_0x2d55d5];return _0x3ea899;};'use strict';var _=require(_0xaabb('0x0'));var util=require(_0xaabb('0x1'));var logger=require(_0xaabb('0x2'))(_0xaabb('0x3'));var moment=require(_0xaabb('0x4'));var BPromise=require('bluebird');var rp=require(_0xaabb('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xaabb('0x6'));var config=require(_0xaabb('0x7'));var attributes=require(_0xaabb('0x8'));module[_0xaabb('0x9')]=function(_0x47efa5,_0x3a1c32){return _0x47efa5[_0xaabb('0xa')](_0xaabb('0xb'),attributes,{'tableName':'report_jscripty_questions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.rpc.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.rpc.js index 2297417..0568185 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 _0x45c7=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','stringify','error','message','info','JscriptyQuestionReport,\x20%s,\x20%s','result','catch','lodash','util','moment','randomstring','ioredis'];(function(_0xd00f2e,_0x577cb8){var _0x363a92=function(_0x2f0afc){while(--_0x2f0afc){_0xd00f2e['push'](_0xd00f2e['shift']());}};_0x363a92(++_0x577cb8);}(_0x45c7,0x126));var _0x745c=function(_0x4c4ec3,_0xbf55c9){_0x4c4ec3=_0x4c4ec3-0x0;var _0x5a2b6b=_0x45c7[_0x4c4ec3];return _0x5a2b6b;};'use strict';var _=require(_0x745c('0x0'));var util=require(_0x745c('0x1'));var moment=require(_0x745c('0x2'));var BPromise=require('bluebird');var rs=require(_0x745c('0x3'));var fs=require('fs');var Redis=require(_0x745c('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x745c('0x5'));var logger=require(_0x745c('0x6'))('rpc');var config=require(_0x745c('0x7'));var jayson=require(_0x745c('0x8'));var client=jayson[_0x745c('0x9')][_0x745c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5172bd,_0x3f0d30,_0x7f553){return new BPromise(function(_0xa12b64,_0x3f9e2e){return client[_0x745c('0xb')](_0x5172bd,_0x7f553)[_0x745c('0xc')](function(_0x1730f4){logger['info']('JscriptyQuestionReport,\x20%s,\x20%s',_0x3f0d30,_0x745c('0xd'));logger[_0x745c('0xe')](_0x745c('0xf'),_0x3f0d30,_0x745c('0xd'),JSON[_0x745c('0x10')](_0x1730f4));if(_0x1730f4[_0x745c('0x11')]){if(_0x1730f4[_0x745c('0x11')]['code']===0x1f4){logger[_0x745c('0x11')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x3f0d30,_0x1730f4[_0x745c('0x11')][_0x745c('0x12')]);return _0x3f9e2e(_0x1730f4[_0x745c('0x11')][_0x745c('0x12')]);}logger[_0x745c('0x11')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x3f0d30,_0x1730f4['error'][_0x745c('0x12')]);return _0xa12b64(_0x1730f4[_0x745c('0x11')][_0x745c('0x12')]);}else{logger[_0x745c('0x13')](_0x745c('0x14'),_0x3f0d30,'request\x20sent');_0xa12b64(_0x1730f4[_0x745c('0x15')][_0x745c('0x12')]);}})[_0x745c('0x16')](function(_0x25d3f8){logger[_0x745c('0x11')](_0x745c('0x14'),_0x3f0d30,_0x25d3f8);_0x3f9e2e(_0x25d3f8);});});} \ No newline at end of file +var _0x8bef=['JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x55d830,_0x45a1b0){var _0x39ee37=function(_0x4314c9){while(--_0x4314c9){_0x55d830['push'](_0x55d830['shift']());}};_0x39ee37(++_0x45a1b0);}(_0x8bef,0x66));var _0xf8be=function(_0x5fb0f1,_0x18deb0){_0x5fb0f1=_0x5fb0f1-0x0;var _0x617eaf=_0x8bef[_0x5fb0f1];return _0x617eaf;};'use strict';var _=require(_0xf8be('0x0'));var util=require(_0xf8be('0x1'));var moment=require(_0xf8be('0x2'));var BPromise=require(_0xf8be('0x3'));var rs=require(_0xf8be('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf8be('0x5'))['db'];var utils=require(_0xf8be('0x6'));var logger=require(_0xf8be('0x7'))(_0xf8be('0x8'));var config=require(_0xf8be('0x9'));var jayson=require(_0xf8be('0xa'));var client=jayson[_0xf8be('0xb')][_0xf8be('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x226cb8,_0x37cb93,_0x5a53f9){return new BPromise(function(_0x3ff5d2,_0x21f521){return client[_0xf8be('0xd')](_0x226cb8,_0x5a53f9)['then'](function(_0x5ec699){logger[_0xf8be('0xe')](_0xf8be('0xf'),_0x37cb93,_0xf8be('0x10'));logger[_0xf8be('0x11')](_0xf8be('0x12'),_0x37cb93,'request\x20sent',JSON[_0xf8be('0x13')](_0x5ec699));if(_0x5ec699[_0xf8be('0x14')]){if(_0x5ec699[_0xf8be('0x14')]['code']===0x1f4){logger['error'](_0xf8be('0xf'),_0x37cb93,_0x5ec699[_0xf8be('0x14')][_0xf8be('0x15')]);return _0x21f521(_0x5ec699[_0xf8be('0x14')][_0xf8be('0x15')]);}logger['error']('JscriptyQuestionReport,\x20%s,\x20%s',_0x37cb93,_0x5ec699[_0xf8be('0x14')][_0xf8be('0x15')]);return _0x3ff5d2(_0x5ec699[_0xf8be('0x14')]['message']);}else{logger[_0xf8be('0xe')](_0xf8be('0xf'),_0x37cb93,_0xf8be('0x10'));_0x3ff5d2(_0x5ec699[_0xf8be('0x16')][_0xf8be('0x15')]);}})[_0xf8be('0x17')](function(_0x35c766){logger['error'](_0xf8be('0xf'),_0x37cb93,_0x35c766);_0x21f521(_0x35c766);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index c2e7016..e722493 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 _0xdcc9=['multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptySessionReport.controller','get','isAuthenticated','index','describe','/:id','show','/:id/questions','getQuestions','post','create','put','update','delete','destroy','exports'];(function(_0x439083,_0x18f6e2){var _0x54c089=function(_0x40de42){while(--_0x40de42){_0x439083['push'](_0x439083['shift']());}};_0x54c089(++_0x18f6e2);}(_0xdcc9,0xe1));var _0x9dcc=function(_0xd1d19a,_0x1933f0){_0xd1d19a=_0xd1d19a-0x0;var _0x52a79d=_0xdcc9[_0xd1d19a];return _0x52a79d;};'use strict';var multer=require(_0x9dcc('0x0'));var util=require(_0x9dcc('0x1'));var path=require(_0x9dcc('0x2'));var timeout=require('connect-timeout');var express=require(_0x9dcc('0x3'));var router=express[_0x9dcc('0x4')]();var fs_extra=require(_0x9dcc('0x5'));var auth=require(_0x9dcc('0x6'));var interaction=require(_0x9dcc('0x7'));var config=require(_0x9dcc('0x8'));var controller=require(_0x9dcc('0x9'));router[_0x9dcc('0xa')]('/',auth[_0x9dcc('0xb')](),controller[_0x9dcc('0xc')]);router[_0x9dcc('0xa')]('/describe',auth[_0x9dcc('0xb')](),controller[_0x9dcc('0xd')]);router[_0x9dcc('0xa')](_0x9dcc('0xe'),auth['isAuthenticated'](),controller[_0x9dcc('0xf')]);router[_0x9dcc('0xa')](_0x9dcc('0x10'),auth[_0x9dcc('0xb')](),controller[_0x9dcc('0x11')]);router[_0x9dcc('0x12')]('/',auth[_0x9dcc('0xb')](),controller[_0x9dcc('0x13')]);router[_0x9dcc('0x14')](_0x9dcc('0xe'),auth[_0x9dcc('0xb')](),controller[_0x9dcc('0x15')]);router[_0x9dcc('0x16')](_0x9dcc('0xe'),auth['isAuthenticated'](),controller[_0x9dcc('0x17')]);module[_0x9dcc('0x18')]=router; \ No newline at end of file +var _0x05c6=['destroy','exports','multer','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','/:id/questions','post','create','update','delete'];(function(_0x23da4d,_0x63498c){var _0x4ae55=function(_0x323d75){while(--_0x323d75){_0x23da4d['push'](_0x23da4d['shift']());}};_0x4ae55(++_0x63498c);}(_0x05c6,0xb6));var _0x605c=function(_0x1521cf,_0x1857c1){_0x1521cf=_0x1521cf-0x0;var _0x1b0dd9=_0x05c6[_0x1521cf];return _0x1b0dd9;};'use strict';var multer=require(_0x605c('0x0'));var util=require('util');var path=require(_0x605c('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x605c('0x2')]();var fs_extra=require(_0x605c('0x3'));var auth=require(_0x605c('0x4'));var interaction=require(_0x605c('0x5'));var config=require(_0x605c('0x6'));var controller=require('./jscriptySessionReport.controller');router[_0x605c('0x7')]('/',auth[_0x605c('0x8')](),controller[_0x605c('0x9')]);router['get']('/describe',auth[_0x605c('0x8')](),controller['describe']);router[_0x605c('0x7')](_0x605c('0xa'),auth['isAuthenticated'](),controller['show']);router['get'](_0x605c('0xb'),auth[_0x605c('0x8')](),controller['getQuestions']);router[_0x605c('0xc')]('/',auth[_0x605c('0x8')](),controller[_0x605c('0xd')]);router['put']('/:id',auth[_0x605c('0x8')](),controller[_0x605c('0xe')]);router[_0x605c('0xf')](_0x605c('0xa'),auth[_0x605c('0x8')](),controller[_0x605c('0x10')]);module[_0x605c('0x11')]=router; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js b/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js index cfa4166..35488c2 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 _0xd37e=['setDataValue','endtime','format','STRING','BOOLEAN','moment','sequelize','exports'];(function(_0x9c2427,_0x17c865){var _0x51984f=function(_0x177af6){while(--_0x177af6){_0x9c2427['push'](_0x9c2427['shift']());}};_0x51984f(++_0x17c865);}(_0xd37e,0x17d));var _0xed37=function(_0x414584,_0x1a1da6){_0x414584=_0x414584-0x0;var _0x50b255=_0xd37e[_0x414584];return _0x50b255;};'use strict';var moment=require(_0xed37('0x0'));var Sequelize=require(_0xed37('0x1'));module[_0xed37('0x2')]={'starttime':{'type':Sequelize['DATE'],'set':function(_0x425abb){this[_0xed37('0x3')]('starttime',_0x425abb);this[_0xed37('0x3')](_0xed37('0x4'),moment()[_0xed37('0x5')]('YYYY-MM-DD\x20HH:mm:ss'));}},'endtime':{'type':Sequelize['DATE']},'membername':{'type':Sequelize[_0xed37('0x6')]},'projectname':{'type':Sequelize[_0xed37('0x6')]},'queue':{'type':Sequelize[_0xed37('0x6')]},'uniqueid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xed37('0x6')]},'calleridnum':{'type':Sequelize[_0xed37('0x6')]},'completed':{'type':Sequelize[_0xed37('0x7')],'defaultValue':![]}}; \ No newline at end of file +var _0xbfb9=['endtime','format','STRING','BOOLEAN','moment','sequelize','exports','DATE','setDataValue','starttime'];(function(_0x2db796,_0x2a07a3){var _0x1870dc=function(_0x1c3b92){while(--_0x1c3b92){_0x2db796['push'](_0x2db796['shift']());}};_0x1870dc(++_0x2a07a3);}(_0xbfb9,0x144));var _0x9bfb=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xbfb9[_0x502c7d];return _0x30b7ed;};'use strict';var moment=require(_0x9bfb('0x0'));var Sequelize=require(_0x9bfb('0x1'));module[_0x9bfb('0x2')]={'starttime':{'type':Sequelize[_0x9bfb('0x3')],'set':function(_0x2b2402){this[_0x9bfb('0x4')](_0x9bfb('0x5'),_0x2b2402);this[_0x9bfb('0x4')](_0x9bfb('0x6'),moment()[_0x9bfb('0x7')]('YYYY-MM-DD\x20HH:mm:ss'));}},'endtime':{'type':Sequelize[_0x9bfb('0x3')]},'membername':{'type':Sequelize[_0x9bfb('0x8')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x9bfb('0x8')]},'calleridname':{'type':Sequelize[_0x9bfb('0x8')]},'calleridnum':{'type':Sequelize[_0x9bfb('0x8')]},'completed':{'type':Sequelize[_0x9bfb('0x9')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.controller.js b/server/api/jscriptySessionReport/jscriptySessionReport.controller.js index 1237fb3..4cdbe15 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 _0x4816=['mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','reject','save','update','then','error','stack','name','send','index','map','JscriptySessionReport','rawAttributes','fieldName','type','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','rows','catch','show','params','filters','find','create','body','destroy','describe','getQuestions','findOne','JscriptyQuestionReport','order','SessionId','findAll','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird'];(function(_0x4d8ed9,_0x2ae284){var _0x1e2140=function(_0x9cca89){while(--_0x9cca89){_0x4d8ed9['push'](_0x4d8ed9['shift']());}};_0x1e2140(++_0x2ae284);}(_0x4816,0x152));var _0x6481=function(_0x502953,_0x28de83){_0x502953=_0x502953-0x0;var _0x2fa32d=_0x4816[_0x502953];return _0x2fa32d;};'use strict';var emlformat=require(_0x6481('0x0'));var rimraf=require(_0x6481('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6481('0x2'));var rp=require(_0x6481('0x3'));var moment=require(_0x6481('0x4'));var BPromise=require(_0x6481('0x5'));var Mustache=require(_0x6481('0x6'));var util=require(_0x6481('0x7'));var path=require(_0x6481('0x8'));var sox=require(_0x6481('0x9'));var csv=require(_0x6481('0xa'));var ejs=require(_0x6481('0xb'));var fs=require('fs');var fs_extra=require(_0x6481('0xc'));var _=require(_0x6481('0xd'));var squel=require(_0x6481('0xe'));var crypto=require(_0x6481('0xf'));var jsforce=require(_0x6481('0x10'));var deskjs=require(_0x6481('0x11'));var toCsv=require(_0x6481('0xa'));var querystring=require('querystring');var Papa=require(_0x6481('0x12'));var Redis=require(_0x6481('0x13'));var authService=require(_0x6481('0x14'));var qs=require(_0x6481('0x15'));var as=require(_0x6481('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6481('0x17'))(_0x6481('0x18'));var utils=require(_0x6481('0x19'));var config=require(_0x6481('0x1a'));var licenseUtil=require(_0x6481('0x1b'));var db=require(_0x6481('0x1c'))['db'];function respondWithStatusCode(_0x30259,_0x1fa7ed){_0x1fa7ed=_0x1fa7ed||0xcc;return function(_0x5419f6){if(_0x5419f6){return _0x30259[_0x6481('0x1d')](_0x1fa7ed);}return _0x30259[_0x6481('0x1e')](_0x1fa7ed)[_0x6481('0x1f')]();};}function respondWithResult(_0x574ddd,_0x6b858a){_0x6b858a=_0x6b858a||0xc8;return function(_0x155dcd){if(_0x155dcd){return _0x574ddd[_0x6481('0x1e')](_0x6b858a)['json'](_0x155dcd);}};}function respondWithFilteredResult(_0x1f0032,_0x25ba19){return function(_0x382dde){if(_0x382dde){var _0x51544b=typeof _0x25ba19[_0x6481('0x20')]===_0x6481('0x21')&&typeof _0x25ba19[_0x6481('0x22')]===_0x6481('0x21');var _0xaf7868=_0x382dde[_0x6481('0x23')];var _0x199977=_0x51544b?0x0:_0x25ba19[_0x6481('0x20')];var _0x2467b4=_0x51544b?_0x382dde[_0x6481('0x23')]:_0x25ba19['offset']+_0x25ba19[_0x6481('0x22')];var _0x853bd8;if(_0x2467b4>=_0xaf7868){_0x2467b4=_0xaf7868;_0x853bd8=0xc8;}else{_0x853bd8=0xce;}_0x1f0032['status'](_0x853bd8);return _0x1f0032[_0x6481('0x24')]('Content-Range',_0x199977+'-'+_0x2467b4+'/'+_0xaf7868)['json'](_0x382dde);}return null;};}function patchUpdates(_0x51195c){return function(_0x21f90e){try{jsonpatch['apply'](_0x21f90e,_0x51195c,!![]);}catch(_0x540248){return BPromise[_0x6481('0x25')](_0x540248);}return _0x21f90e[_0x6481('0x26')]();};}function saveUpdates(_0x23ca12,_0x53fd75){return function(_0x5e20b1){if(_0x5e20b1){return _0x5e20b1[_0x6481('0x27')](_0x23ca12)[_0x6481('0x28')](function(_0x4b4cb6){return _0x4b4cb6;});}return null;};}function removeEntity(_0x1cc8b1,_0x55dc33){return function(_0x123959){if(_0x123959){return _0x123959['destroy']()[_0x6481('0x28')](function(){_0x1cc8b1[_0x6481('0x1e')](0xcc)[_0x6481('0x1f')]();});}};}function handleEntityNotFound(_0x3df49b,_0x2df704){return function(_0x324178){if(!_0x324178){_0x3df49b[_0x6481('0x1d')](0x194);}return _0x324178;};}function handleError(_0x1a9ac8,_0x4b57ee){_0x4b57ee=_0x4b57ee||0x1f4;return function(_0x366a9f){logger[_0x6481('0x29')](_0x366a9f[_0x6481('0x2a')]);if(_0x366a9f[_0x6481('0x2b')]){delete _0x366a9f[_0x6481('0x2b')];}_0x1a9ac8[_0x6481('0x1e')](_0x4b57ee)[_0x6481('0x2c')](_0x366a9f);};}exports[_0x6481('0x2d')]=function(_0x55e3bd,_0xd992de){var _0x2f595c={},_0x3efd8d={},_0x185436={'count':0x0,'rows':[]};var _0x33a13e=_[_0x6481('0x2e')](db[_0x6481('0x2f')][_0x6481('0x30')],function(_0x359e65){return{'name':_0x359e65[_0x6481('0x31')],'type':_0x359e65[_0x6481('0x32')][_0x6481('0x33')]};});_0x3efd8d[_0x6481('0x34')]=_[_0x6481('0x2e')](_0x33a13e,_0x6481('0x2b'));_0x3efd8d[_0x6481('0x35')]=_[_0x6481('0x36')](_0x55e3bd[_0x6481('0x35')]);_0x3efd8d['filters']=_['intersection'](_0x3efd8d['model'],_0x3efd8d[_0x6481('0x35')]);_0x2f595c[_0x6481('0x37')]=_[_0x6481('0x38')](_0x3efd8d[_0x6481('0x34')],qs[_0x6481('0x39')](_0x55e3bd[_0x6481('0x35')][_0x6481('0x39')]));_0x2f595c[_0x6481('0x37')]=_0x2f595c[_0x6481('0x37')][_0x6481('0x3a')]?_0x2f595c['attributes']:_0x3efd8d[_0x6481('0x34')];if(!_0x55e3bd['query'][_0x6481('0x3b')](_0x6481('0x3c'))){_0x2f595c[_0x6481('0x22')]=qs[_0x6481('0x22')](_0x55e3bd[_0x6481('0x35')][_0x6481('0x22')]);_0x2f595c[_0x6481('0x20')]=qs['offset'](_0x55e3bd[_0x6481('0x35')]['offset']);}_0x2f595c['order']=qs[_0x6481('0x3d')](_0x55e3bd['query'][_0x6481('0x3d')]);_0x2f595c[_0x6481('0x3e')]=qs['filters'](_[_0x6481('0x3f')](_0x55e3bd[_0x6481('0x35')],_0x3efd8d['filters']),_0x33a13e);if(_0x55e3bd[_0x6481('0x35')][_0x6481('0x40')]){_0x2f595c[_0x6481('0x3e')]=_['merge'](_0x2f595c['where'],{'$or':_[_0x6481('0x2e')](_0x33a13e,function(_0x3d07f1){if(_0x3d07f1[_0x6481('0x32')]!==_0x6481('0x41')){var _0x1b7768={};_0x1b7768[_0x3d07f1[_0x6481('0x2b')]]={'$like':'%'+_0x55e3bd[_0x6481('0x35')]['filter']+'%'};return _0x1b7768;}})});}_0x2f595c=_[_0x6481('0x42')]({},_0x2f595c,_0x55e3bd[_0x6481('0x43')]);var _0x1ab721={'where':_0x2f595c[_0x6481('0x3e')]};return db[_0x6481('0x2f')]['count'](_0x1ab721)[_0x6481('0x28')](function(_0x39e6a2){_0x185436[_0x6481('0x23')]=_0x39e6a2;if(_0x55e3bd['query'][_0x6481('0x44')]){_0x2f595c[_0x6481('0x45')]=[{'all':!![]}];}return db[_0x6481('0x2f')]['findAll'](_0x2f595c);})[_0x6481('0x28')](function(_0x413adf){_0x185436[_0x6481('0x46')]=_0x413adf;return _0x185436;})[_0x6481('0x28')](respondWithFilteredResult(_0xd992de,_0x2f595c))[_0x6481('0x47')](handleError(_0xd992de,null));};exports[_0x6481('0x48')]=function(_0x2c9aaf,_0x344e59){var _0x37f9b9={'raw':!![],'where':{'id':_0x2c9aaf[_0x6481('0x49')]['id']}},_0x2ecd86={};_0x2ecd86['model']=_[_0x6481('0x36')](db['JscriptySessionReport']['rawAttributes']);_0x2ecd86[_0x6481('0x35')]=_['keys'](_0x2c9aaf[_0x6481('0x35')]);_0x2ecd86[_0x6481('0x4a')]=_[_0x6481('0x38')](_0x2ecd86['model'],_0x2ecd86[_0x6481('0x35')]);_0x37f9b9[_0x6481('0x37')]=_[_0x6481('0x38')](_0x2ecd86[_0x6481('0x34')],qs['fields'](_0x2c9aaf[_0x6481('0x35')][_0x6481('0x39')]));_0x37f9b9['attributes']=_0x37f9b9[_0x6481('0x37')]['length']?_0x37f9b9[_0x6481('0x37')]:_0x2ecd86[_0x6481('0x34')];if(_0x2c9aaf['query'][_0x6481('0x44')]){_0x37f9b9[_0x6481('0x45')]=[{'all':!![]}];}_0x37f9b9=_['merge']({},_0x37f9b9,_0x2c9aaf[_0x6481('0x43')]);return db[_0x6481('0x2f')][_0x6481('0x4b')](_0x37f9b9)[_0x6481('0x28')](handleEntityNotFound(_0x344e59,null))[_0x6481('0x28')](respondWithResult(_0x344e59,null))[_0x6481('0x47')](handleError(_0x344e59,null));};exports[_0x6481('0x4c')]=function(_0x4c2210,_0x283ae0){return db[_0x6481('0x2f')][_0x6481('0x4c')](_0x4c2210[_0x6481('0x4d')],{})[_0x6481('0x28')](respondWithResult(_0x283ae0,0xc9))[_0x6481('0x47')](handleError(_0x283ae0,null));};exports[_0x6481('0x27')]=function(_0x287013,_0x5ff65c){if(_0x287013[_0x6481('0x4d')]['id']){delete _0x287013['body']['id'];}return db[_0x6481('0x2f')]['find']({'where':{'id':_0x287013[_0x6481('0x49')]['id']}})['then'](handleEntityNotFound(_0x5ff65c,null))[_0x6481('0x28')](saveUpdates(_0x287013[_0x6481('0x4d')],null))[_0x6481('0x28')](respondWithResult(_0x5ff65c,null))['catch'](handleError(_0x5ff65c,null));};exports[_0x6481('0x4e')]=function(_0x4d22db,_0x5945b3){return db[_0x6481('0x2f')][_0x6481('0x4b')]({'where':{'id':_0x4d22db['params']['id']}})[_0x6481('0x28')](handleEntityNotFound(_0x5945b3,null))[_0x6481('0x28')](removeEntity(_0x5945b3,null))[_0x6481('0x47')](handleError(_0x5945b3,null));};exports[_0x6481('0x4f')]=function(_0xd9e523,_0x311909){return db['JscriptySessionReport']['describe']()['then'](respondWithResult(_0x311909,null))[_0x6481('0x47')](handleError(_0x311909,null));};exports[_0x6481('0x50')]=function(_0x188f97,_0x51dc18,_0x1bb3a2){var _0x7a42c5={'raw':!![],'where':{}};var _0x3d8e48={};var _0x40b978={'count':0x0,'rows':[]};return db[_0x6481('0x2f')][_0x6481('0x51')]({'where':{'id':_0x188f97[_0x6481('0x49')]['id']}})[_0x6481('0x28')](handleEntityNotFound(_0x51dc18,null))[_0x6481('0x28')](function(_0x383394){if(_0x383394){_0x3d8e48[_0x6481('0x34')]=_[_0x6481('0x36')](db[_0x6481('0x52')]['rawAttributes']);_0x3d8e48[_0x6481('0x35')]=_[_0x6481('0x36')](_0x188f97[_0x6481('0x35')]);_0x3d8e48[_0x6481('0x4a')]=_[_0x6481('0x38')](_0x3d8e48[_0x6481('0x34')],_0x3d8e48['query']);_0x7a42c5[_0x6481('0x37')]=_['intersection'](_0x3d8e48[_0x6481('0x34')],qs[_0x6481('0x39')](_0x188f97['query'][_0x6481('0x39')]));_0x7a42c5[_0x6481('0x37')]=_0x7a42c5['attributes'][_0x6481('0x3a')]?_0x7a42c5[_0x6481('0x37')]:_0x3d8e48['model'];if(!_0x188f97[_0x6481('0x35')][_0x6481('0x3b')](_0x6481('0x3c'))){_0x7a42c5['limit']=qs[_0x6481('0x22')](_0x188f97[_0x6481('0x35')][_0x6481('0x22')]);_0x7a42c5[_0x6481('0x20')]=qs[_0x6481('0x20')](_0x188f97[_0x6481('0x35')][_0x6481('0x20')]);}_0x7a42c5[_0x6481('0x53')]=qs[_0x6481('0x3d')](_0x188f97['query'][_0x6481('0x3d')]);_0x7a42c5['where']=qs[_0x6481('0x4a')](_[_0x6481('0x3f')](_0x188f97[_0x6481('0x35')],_0x3d8e48[_0x6481('0x4a')]));_0x7a42c5[_0x6481('0x3e')][_0x6481('0x54')]=_0x383394['id'];if(_0x188f97['query'][_0x6481('0x40')]){_0x7a42c5[_0x6481('0x3e')]=_['merge'](_0x7a42c5[_0x6481('0x3e')],{'$or':_[_0x6481('0x2e')](_0x7a42c5[_0x6481('0x37')],function(_0x2f2eaa){var _0x40e1ef={};_0x40e1ef[_0x2f2eaa]={'$like':'%'+_0x188f97[_0x6481('0x35')][_0x6481('0x40')]+'%'};return _0x40e1ef;})});}_0x7a42c5=_[_0x6481('0x42')]({},_0x7a42c5,_0x188f97[_0x6481('0x43')]);return db[_0x6481('0x52')]['count']({'where':_0x7a42c5['where']})['then'](function(_0x2d1fdb){_0x40b978[_0x6481('0x23')]=_0x2d1fdb;if(_0x188f97[_0x6481('0x35')]['includeAll']){_0x7a42c5[_0x6481('0x45')]=[{'all':!![]}];}return db[_0x6481('0x52')][_0x6481('0x55')](_0x7a42c5);})['then'](function(_0x38a1f5){_0x40b978['rows']=_0x38a1f5;return _0x40b978;});}})[_0x6481('0x28')](respondWithFilteredResult(_0x51dc18,_0x7a42c5))[_0x6481('0x47')](handleError(_0x51dc18,null));}; \ No newline at end of file +var _0x9073=['to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','map','rawAttributes','fieldName','key','query','filters','intersection','model','fields','attributes','length','nolimit','order','sort','where','pick','merge','type','VIRTUAL','filter','options','includeAll','include','JscriptySessionReport','findAll','rows','catch','show','params','keys','find','create','body','describe','findOne','JscriptyQuestionReport','hasOwnProperty','SessionId','eml-format','fast-json-patch','request-promise','bluebird','mustache','path','ejs','fs-extra','lodash','crypto','jsforce','desk.js'];(function(_0x486f4a,_0x478dc7){var _0x135d99=function(_0x434008){while(--_0x434008){_0x486f4a['push'](_0x486f4a['shift']());}};_0x135d99(++_0x478dc7);}(_0x9073,0x1da));var _0x3907=function(_0x4fc9e6,_0xc51915){_0x4fc9e6=_0x4fc9e6-0x0;var _0x551d28=_0x9073[_0x4fc9e6];return _0x551d28;};'use strict';var emlformat=require(_0x3907('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x3907('0x1'));var rp=require(_0x3907('0x2'));var moment=require('moment');var BPromise=require(_0x3907('0x3'));var Mustache=require(_0x3907('0x4'));var util=require('util');var path=require(_0x3907('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x3907('0x6'));var fs=require('fs');var fs_extra=require(_0x3907('0x7'));var _=require(_0x3907('0x8'));var squel=require('squel');var crypto=require(_0x3907('0x9'));var jsforce=require(_0x3907('0xa'));var deskjs=require(_0x3907('0xb'));var toCsv=require(_0x3907('0xc'));var querystring=require(_0x3907('0xd'));var Papa=require(_0x3907('0xe'));var Redis=require('ioredis');var authService=require(_0x3907('0xf'));var qs=require(_0x3907('0x10'));var as=require(_0x3907('0x11'));var hardwareService=require(_0x3907('0x12'));var logger=require(_0x3907('0x13'))(_0x3907('0x14'));var utils=require('../../config/utils');var config=require(_0x3907('0x15'));var licenseUtil=require(_0x3907('0x16'));var db=require(_0x3907('0x17'))['db'];function respondWithStatusCode(_0x1c3438,_0x84e7cc){_0x84e7cc=_0x84e7cc||0xcc;return function(_0x138f72){if(_0x138f72){return _0x1c3438[_0x3907('0x18')](_0x84e7cc);}return _0x1c3438[_0x3907('0x19')](_0x84e7cc)[_0x3907('0x1a')]();};}function respondWithResult(_0x218f39,_0x32df84){_0x32df84=_0x32df84||0xc8;return function(_0x4689af){if(_0x4689af){return _0x218f39[_0x3907('0x19')](_0x32df84)[_0x3907('0x1b')](_0x4689af);}};}function respondWithFilteredResult(_0x22df63,_0x427edd){return function(_0x2c6d0f){if(_0x2c6d0f){var _0x4dd2fb=typeof _0x427edd[_0x3907('0x1c')]==='undefined'&&typeof _0x427edd[_0x3907('0x1d')]==='undefined';var _0x459d44=_0x2c6d0f[_0x3907('0x1e')];var _0x3a3778=_0x4dd2fb?0x0:_0x427edd[_0x3907('0x1c')];var _0x31528a=_0x4dd2fb?_0x2c6d0f['count']:_0x427edd[_0x3907('0x1c')]+_0x427edd['limit'];var _0x1fdb56;if(_0x31528a>=_0x459d44){_0x31528a=_0x459d44;_0x1fdb56=0xc8;}else{_0x1fdb56=0xce;}_0x22df63[_0x3907('0x19')](_0x1fdb56);return _0x22df63[_0x3907('0x1f')](_0x3907('0x20'),_0x3a3778+'-'+_0x31528a+'/'+_0x459d44)[_0x3907('0x1b')](_0x2c6d0f);}return null;};}function patchUpdates(_0x299332){return function(_0x1bb219){try{jsonpatch[_0x3907('0x21')](_0x1bb219,_0x299332,!![]);}catch(_0xe19ea1){return BPromise[_0x3907('0x22')](_0xe19ea1);}return _0x1bb219[_0x3907('0x23')]();};}function saveUpdates(_0x357269,_0x4a1f53){return function(_0xc00e52){if(_0xc00e52){return _0xc00e52[_0x3907('0x24')](_0x357269)[_0x3907('0x25')](function(_0x4cc9b8){return _0x4cc9b8;});}return null;};}function removeEntity(_0x21a2f9,_0x1d2ca0){return function(_0x45da8a){if(_0x45da8a){return _0x45da8a[_0x3907('0x26')]()['then'](function(){_0x21a2f9['status'](0xcc)[_0x3907('0x1a')]();});}};}function handleEntityNotFound(_0xea791f,_0x3e7165){return function(_0x32c38a){if(!_0x32c38a){_0xea791f[_0x3907('0x18')](0x194);}return _0x32c38a;};}function handleError(_0x1fb57b,_0xbd959){_0xbd959=_0xbd959||0x1f4;return function(_0x2bd7b4){logger['error'](_0x2bd7b4[_0x3907('0x27')]);if(_0x2bd7b4[_0x3907('0x28')]){delete _0x2bd7b4['name'];}_0x1fb57b['status'](_0xbd959)[_0x3907('0x29')](_0x2bd7b4);};}exports[_0x3907('0x2a')]=function(_0x430a74,_0x30843b){var _0x247a88={},_0x33d096={},_0x1b1390={'count':0x0,'rows':[]};var _0x36e9d0=_[_0x3907('0x2b')](db['JscriptySessionReport'][_0x3907('0x2c')],function(_0x3ce102){return{'name':_0x3ce102[_0x3907('0x2d')],'type':_0x3ce102['type'][_0x3907('0x2e')]};});_0x33d096['model']=_[_0x3907('0x2b')](_0x36e9d0,_0x3907('0x28'));_0x33d096['query']=_['keys'](_0x430a74[_0x3907('0x2f')]);_0x33d096[_0x3907('0x30')]=_[_0x3907('0x31')](_0x33d096[_0x3907('0x32')],_0x33d096['query']);_0x247a88['attributes']=_[_0x3907('0x31')](_0x33d096['model'],qs[_0x3907('0x33')](_0x430a74[_0x3907('0x2f')][_0x3907('0x33')]));_0x247a88['attributes']=_0x247a88[_0x3907('0x34')][_0x3907('0x35')]?_0x247a88[_0x3907('0x34')]:_0x33d096[_0x3907('0x32')];if(!_0x430a74[_0x3907('0x2f')]['hasOwnProperty'](_0x3907('0x36'))){_0x247a88[_0x3907('0x1d')]=qs[_0x3907('0x1d')](_0x430a74[_0x3907('0x2f')][_0x3907('0x1d')]);_0x247a88[_0x3907('0x1c')]=qs[_0x3907('0x1c')](_0x430a74[_0x3907('0x2f')][_0x3907('0x1c')]);}_0x247a88[_0x3907('0x37')]=qs[_0x3907('0x38')](_0x430a74[_0x3907('0x2f')][_0x3907('0x38')]);_0x247a88[_0x3907('0x39')]=qs[_0x3907('0x30')](_[_0x3907('0x3a')](_0x430a74[_0x3907('0x2f')],_0x33d096[_0x3907('0x30')]),_0x36e9d0);if(_0x430a74['query']['filter']){_0x247a88[_0x3907('0x39')]=_[_0x3907('0x3b')](_0x247a88['where'],{'$or':_[_0x3907('0x2b')](_0x36e9d0,function(_0x257eb4){if(_0x257eb4[_0x3907('0x3c')]!==_0x3907('0x3d')){var _0x2a1e00={};_0x2a1e00[_0x257eb4[_0x3907('0x28')]]={'$like':'%'+_0x430a74[_0x3907('0x2f')][_0x3907('0x3e')]+'%'};return _0x2a1e00;}})});}_0x247a88=_[_0x3907('0x3b')]({},_0x247a88,_0x430a74[_0x3907('0x3f')]);var _0x1c7ad4={'where':_0x247a88['where']};return db['JscriptySessionReport']['count'](_0x1c7ad4)[_0x3907('0x25')](function(_0x323530){_0x1b1390['count']=_0x323530;if(_0x430a74[_0x3907('0x2f')][_0x3907('0x40')]){_0x247a88[_0x3907('0x41')]=[{'all':!![]}];}return db[_0x3907('0x42')][_0x3907('0x43')](_0x247a88);})['then'](function(_0x2f9b65){_0x1b1390[_0x3907('0x44')]=_0x2f9b65;return _0x1b1390;})[_0x3907('0x25')](respondWithFilteredResult(_0x30843b,_0x247a88))[_0x3907('0x45')](handleError(_0x30843b,null));};exports[_0x3907('0x46')]=function(_0xec3f20,_0x436803){var _0x48f6ba={'raw':!![],'where':{'id':_0xec3f20[_0x3907('0x47')]['id']}},_0x493162={};_0x493162['model']=_[_0x3907('0x48')](db[_0x3907('0x42')][_0x3907('0x2c')]);_0x493162['query']=_['keys'](_0xec3f20[_0x3907('0x2f')]);_0x493162[_0x3907('0x30')]=_[_0x3907('0x31')](_0x493162[_0x3907('0x32')],_0x493162[_0x3907('0x2f')]);_0x48f6ba[_0x3907('0x34')]=_[_0x3907('0x31')](_0x493162[_0x3907('0x32')],qs[_0x3907('0x33')](_0xec3f20[_0x3907('0x2f')][_0x3907('0x33')]));_0x48f6ba[_0x3907('0x34')]=_0x48f6ba['attributes'][_0x3907('0x35')]?_0x48f6ba[_0x3907('0x34')]:_0x493162[_0x3907('0x32')];if(_0xec3f20['query']['includeAll']){_0x48f6ba[_0x3907('0x41')]=[{'all':!![]}];}_0x48f6ba=_[_0x3907('0x3b')]({},_0x48f6ba,_0xec3f20[_0x3907('0x3f')]);return db['JscriptySessionReport'][_0x3907('0x49')](_0x48f6ba)['then'](handleEntityNotFound(_0x436803,null))[_0x3907('0x25')](respondWithResult(_0x436803,null))[_0x3907('0x45')](handleError(_0x436803,null));};exports[_0x3907('0x4a')]=function(_0x146af6,_0x480780){return db[_0x3907('0x42')][_0x3907('0x4a')](_0x146af6[_0x3907('0x4b')],{})[_0x3907('0x25')](respondWithResult(_0x480780,0xc9))[_0x3907('0x45')](handleError(_0x480780,null));};exports['update']=function(_0x4a3322,_0x3d5b8a){if(_0x4a3322['body']['id']){delete _0x4a3322[_0x3907('0x4b')]['id'];}return db[_0x3907('0x42')]['find']({'where':{'id':_0x4a3322[_0x3907('0x47')]['id']}})['then'](handleEntityNotFound(_0x3d5b8a,null))[_0x3907('0x25')](saveUpdates(_0x4a3322[_0x3907('0x4b')],null))[_0x3907('0x25')](respondWithResult(_0x3d5b8a,null))['catch'](handleError(_0x3d5b8a,null));};exports[_0x3907('0x26')]=function(_0x2e3a16,_0x5d480e){return db[_0x3907('0x42')][_0x3907('0x49')]({'where':{'id':_0x2e3a16[_0x3907('0x47')]['id']}})['then'](handleEntityNotFound(_0x5d480e,null))[_0x3907('0x25')](removeEntity(_0x5d480e,null))[_0x3907('0x45')](handleError(_0x5d480e,null));};exports[_0x3907('0x4c')]=function(_0x1a113a,_0x267dac){return db[_0x3907('0x42')][_0x3907('0x4c')]()[_0x3907('0x25')](respondWithResult(_0x267dac,null))[_0x3907('0x45')](handleError(_0x267dac,null));};exports['getQuestions']=function(_0x3feca9,_0x227a75,_0x4e72d3){var _0x3d1480={'raw':!![],'where':{}};var _0xb6991f={};var _0x4d2a23={'count':0x0,'rows':[]};return db[_0x3907('0x42')][_0x3907('0x4d')]({'where':{'id':_0x3feca9['params']['id']}})['then'](handleEntityNotFound(_0x227a75,null))[_0x3907('0x25')](function(_0x10d7c8){if(_0x10d7c8){_0xb6991f[_0x3907('0x32')]=_[_0x3907('0x48')](db[_0x3907('0x4e')][_0x3907('0x2c')]);_0xb6991f[_0x3907('0x2f')]=_[_0x3907('0x48')](_0x3feca9['query']);_0xb6991f[_0x3907('0x30')]=_['intersection'](_0xb6991f['model'],_0xb6991f[_0x3907('0x2f')]);_0x3d1480['attributes']=_[_0x3907('0x31')](_0xb6991f[_0x3907('0x32')],qs[_0x3907('0x33')](_0x3feca9['query'][_0x3907('0x33')]));_0x3d1480[_0x3907('0x34')]=_0x3d1480[_0x3907('0x34')]['length']?_0x3d1480[_0x3907('0x34')]:_0xb6991f[_0x3907('0x32')];if(!_0x3feca9[_0x3907('0x2f')][_0x3907('0x4f')]('nolimit')){_0x3d1480['limit']=qs[_0x3907('0x1d')](_0x3feca9[_0x3907('0x2f')][_0x3907('0x1d')]);_0x3d1480['offset']=qs[_0x3907('0x1c')](_0x3feca9[_0x3907('0x2f')][_0x3907('0x1c')]);}_0x3d1480[_0x3907('0x37')]=qs[_0x3907('0x38')](_0x3feca9[_0x3907('0x2f')]['sort']);_0x3d1480[_0x3907('0x39')]=qs[_0x3907('0x30')](_[_0x3907('0x3a')](_0x3feca9[_0x3907('0x2f')],_0xb6991f[_0x3907('0x30')]));_0x3d1480[_0x3907('0x39')][_0x3907('0x50')]=_0x10d7c8['id'];if(_0x3feca9[_0x3907('0x2f')][_0x3907('0x3e')]){_0x3d1480['where']=_[_0x3907('0x3b')](_0x3d1480[_0x3907('0x39')],{'$or':_[_0x3907('0x2b')](_0x3d1480[_0x3907('0x34')],function(_0x58fd4a){var _0x1e35f6={};_0x1e35f6[_0x58fd4a]={'$like':'%'+_0x3feca9[_0x3907('0x2f')]['filter']+'%'};return _0x1e35f6;})});}_0x3d1480=_[_0x3907('0x3b')]({},_0x3d1480,_0x3feca9['options']);return db[_0x3907('0x4e')][_0x3907('0x1e')]({'where':_0x3d1480[_0x3907('0x39')]})[_0x3907('0x25')](function(_0x4d1dc9){_0x4d2a23[_0x3907('0x1e')]=_0x4d1dc9;if(_0x3feca9[_0x3907('0x2f')][_0x3907('0x40')]){_0x3d1480[_0x3907('0x41')]=[{'all':!![]}];}return db[_0x3907('0x4e')][_0x3907('0x43')](_0x3d1480);})[_0x3907('0x25')](function(_0x1fdb60){_0x4d2a23[_0x3907('0x44')]=_0x1fdb60;return _0x4d2a23;});}})[_0x3907('0x25')](respondWithFilteredResult(_0x227a75,_0x3d1480))[_0x3907('0x45')](handleError(_0x227a75,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index 1e25ac2..786e17b 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 _0xef17=['./jscriptySessionReport.attributes','define','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x301dab,_0x38050a){var _0x2500a2=function(_0x4d3dff){while(--_0x4d3dff){_0x301dab['push'](_0x301dab['shift']());}};_0x2500a2(++_0x38050a);}(_0xef17,0x136));var _0x7ef1=function(_0x52cfaf,_0x34fec9){_0x52cfaf=_0x52cfaf-0x0;var _0x55dd61=_0xef17[_0x52cfaf];return _0x55dd61;};'use strict';var _=require(_0x7ef1('0x0'));var util=require(_0x7ef1('0x1'));var logger=require(_0x7ef1('0x2'))(_0x7ef1('0x3'));var moment=require(_0x7ef1('0x4'));var BPromise=require(_0x7ef1('0x5'));var rp=require(_0x7ef1('0x6'));var fs=require('fs');var path=require(_0x7ef1('0x7'));var rimraf=require(_0x7ef1('0x8'));var config=require('../../config/environment');var attributes=require(_0x7ef1('0x9'));module['exports']=function(_0x138ed1,_0x498596){return _0x138ed1[_0x7ef1('0xa')]('JscriptySessionReport',attributes,{'tableName':'report_jscripty_sessions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2d72=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./jscriptySessionReport.attributes','exports','JscriptySessionReport','report_jscripty_sessions'];(function(_0x134032,_0x2a9876){var _0x2b87a3=function(_0x2245ae){while(--_0x2245ae){_0x134032['push'](_0x134032['shift']());}};_0x2b87a3(++_0x2a9876);}(_0x2d72,0xa8));var _0x22d7=function(_0x24b74b,_0x5df7db){_0x24b74b=_0x24b74b-0x0;var _0x4bfda3=_0x2d72[_0x24b74b];return _0x4bfda3;};'use strict';var _=require(_0x22d7('0x0'));var util=require(_0x22d7('0x1'));var logger=require(_0x22d7('0x2'))(_0x22d7('0x3'));var moment=require(_0x22d7('0x4'));var BPromise=require(_0x22d7('0x5'));var rp=require(_0x22d7('0x6'));var fs=require('fs');var path=require(_0x22d7('0x7'));var rimraf=require(_0x22d7('0x8'));var config=require(_0x22d7('0x9'));var attributes=require(_0x22d7('0xa'));module[_0x22d7('0xb')]=function(_0x208b5b,_0x100426){return _0x208b5b['define'](_0x22d7('0xc'),attributes,{'tableName':_0x22d7('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js b/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js index e5ca604..7b0bac9 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 _0x323f=['then','info','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request'];(function(_0x25cc97,_0x3277a0){var _0x171c81=function(_0x2ca9c4){while(--_0x2ca9c4){_0x25cc97['push'](_0x25cc97['shift']());}};_0x171c81(++_0x3277a0);}(_0x323f,0x1ee));var _0xf323=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0x323f[_0x30ae5e];return _0x1f2e93;};'use strict';var _=require('lodash');var util=require(_0xf323('0x0'));var moment=require('moment');var BPromise=require(_0xf323('0x1'));var rs=require(_0xf323('0x2'));var fs=require('fs');var Redis=require(_0xf323('0x3'));var db=require(_0xf323('0x4'))['db'];var utils=require(_0xf323('0x5'));var logger=require(_0xf323('0x6'))(_0xf323('0x7'));var config=require(_0xf323('0x8'));var jayson=require(_0xf323('0x9'));var client=jayson[_0xf323('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0xb9a667,_0x444cba,_0x1af70d){return new BPromise(function(_0x2c8271,_0x8abeac){return client[_0xf323('0xb')](_0xb9a667,_0x1af70d)[_0xf323('0xc')](function(_0x2b24a2){logger[_0xf323('0xd')](_0xf323('0xe'),_0x444cba,_0xf323('0xf'));logger[_0xf323('0x10')](_0xf323('0x11'),_0x444cba,_0xf323('0xf'),JSON[_0xf323('0x12')](_0x2b24a2));if(_0x2b24a2[_0xf323('0x13')]){if(_0x2b24a2[_0xf323('0x13')]['code']===0x1f4){logger[_0xf323('0x13')](_0xf323('0xe'),_0x444cba,_0x2b24a2[_0xf323('0x13')]['message']);return _0x8abeac(_0x2b24a2[_0xf323('0x13')][_0xf323('0x14')]);}logger[_0xf323('0x13')](_0xf323('0xe'),_0x444cba,_0x2b24a2[_0xf323('0x13')][_0xf323('0x14')]);return _0x2c8271(_0x2b24a2['error']['message']);}else{logger[_0xf323('0xd')](_0xf323('0xe'),_0x444cba,_0xf323('0xf'));_0x2c8271(_0x2b24a2[_0xf323('0x15')][_0xf323('0x14')]);}})['catch'](function(_0xd6c25){logger[_0xf323('0x13')](_0xf323('0xe'),_0x444cba,_0xd6c25);_0x8abeac(_0xd6c25);});});} \ No newline at end of file +var _0x8aad=['stringify','error','code','message','result','catch','lodash','util','bluebird','ioredis','../../mysqldb','rpc','client','http','request','info','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s'];(function(_0x683723,_0x568943){var _0x1e4abe=function(_0x3f8bac){while(--_0x3f8bac){_0x683723['push'](_0x683723['shift']());}};_0x1e4abe(++_0x568943);}(_0x8aad,0x146));var _0xd8aa=function(_0xaa6fc4,_0x1cf96a){_0xaa6fc4=_0xaa6fc4-0x0;var _0x285461=_0x8aad[_0xaa6fc4];return _0x285461;};'use strict';var _=require(_0xd8aa('0x0'));var util=require(_0xd8aa('0x1'));var moment=require('moment');var BPromise=require(_0xd8aa('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd8aa('0x3'));var db=require(_0xd8aa('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xd8aa('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xd8aa('0x6')][_0xd8aa('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x16ea12,_0x4a4b10,_0x2a559d){return new BPromise(function(_0x1da411,_0x2a23b5){return client[_0xd8aa('0x8')](_0x16ea12,_0x2a559d)['then'](function(_0x5de228){logger[_0xd8aa('0x9')](_0xd8aa('0xa'),_0x4a4b10,_0xd8aa('0xb'));logger[_0xd8aa('0xc')](_0xd8aa('0xd'),_0x4a4b10,'request\x20sent',JSON[_0xd8aa('0xe')](_0x5de228));if(_0x5de228[_0xd8aa('0xf')]){if(_0x5de228[_0xd8aa('0xf')][_0xd8aa('0x10')]===0x1f4){logger[_0xd8aa('0xf')](_0xd8aa('0xa'),_0x4a4b10,_0x5de228[_0xd8aa('0xf')][_0xd8aa('0x11')]);return _0x2a23b5(_0x5de228[_0xd8aa('0xf')][_0xd8aa('0x11')]);}logger['error']('JscriptySessionReport,\x20%s,\x20%s',_0x4a4b10,_0x5de228[_0xd8aa('0xf')][_0xd8aa('0x11')]);return _0x1da411(_0x5de228[_0xd8aa('0xf')]['message']);}else{logger[_0xd8aa('0x9')](_0xd8aa('0xa'),_0x4a4b10,_0xd8aa('0xb'));_0x1da411(_0x5de228[_0xd8aa('0x12')]['message']);}})[_0xd8aa('0x13')](function(_0xa9ba1b){logger['error'](_0xd8aa('0xa'),_0x4a4b10,_0xa9ba1b);_0x2a23b5(_0xa9ba1b);});});} \ No newline at end of file diff --git a/server/api/license/index.js b/server/api/license/index.js index a5a7c69..4ef161d 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 _0x5785=['../../components/interaction/service','../../config/environment','./license.controller','get','index','put','/:id','isAuthenticated','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5785,0x119));var _0x5578=function(_0x263a74,_0xc31414){_0x263a74=_0x263a74-0x0;var _0x2aa86c=_0x5785[_0x263a74];return _0x2aa86c;};'use strict';var multer=require(_0x5578('0x0'));var util=require(_0x5578('0x1'));var path=require(_0x5578('0x2'));var timeout=require(_0x5578('0x3'));var express=require(_0x5578('0x4'));var router=express['Router']();var fs_extra=require(_0x5578('0x5'));var auth=require(_0x5578('0x6'));var interaction=require(_0x5578('0x7'));var config=require(_0x5578('0x8'));var controller=require(_0x5578('0x9'));router[_0x5578('0xa')]('/',controller[_0x5578('0xb')]);router[_0x5578('0xc')](_0x5578('0xd'),auth[_0x5578('0xe')](),controller['update']);module[_0x5578('0xf')]=router; \ No newline at end of file +var _0x5d01=['../../config/environment','./license.controller','get','index','put','/:id','isAuthenticated','update','multer','path','connect-timeout','Router','fs-extra'];(function(_0x454bcb,_0x4f3bce){var _0x5f4ef5=function(_0x49dcd8){while(--_0x49dcd8){_0x454bcb['push'](_0x454bcb['shift']());}};_0x5f4ef5(++_0x4f3bce);}(_0x5d01,0xe5));var _0x15d0=function(_0x3d38b0,_0x4b8506){_0x3d38b0=_0x3d38b0-0x0;var _0x2aa708=_0x5d01[_0x3d38b0];return _0x2aa708;};'use strict';var multer=require(_0x15d0('0x0'));var util=require('util');var path=require(_0x15d0('0x1'));var timeout=require(_0x15d0('0x2'));var express=require('express');var router=express[_0x15d0('0x3')]();var fs_extra=require(_0x15d0('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x15d0('0x5'));var controller=require(_0x15d0('0x6'));router[_0x15d0('0x7')]('/',controller[_0x15d0('0x8')]);router[_0x15d0('0x9')](_0x15d0('0xa'),auth[_0x15d0('0xb')](),controller[_0x15d0('0xc')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/license/license.attributes.js b/server/api/license/license.attributes.js index 869a691..64807cb 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 _0x403a=['INTEGER','sequelize','exports','TEXT','STRING'];(function(_0x13bc8c,_0x56bd37){var _0x1e8c8d=function(_0x2d6f87){while(--_0x2d6f87){_0x13bc8c['push'](_0x13bc8c['shift']());}};_0x1e8c8d(++_0x56bd37);}(_0x403a,0xab));var _0xa403=function(_0x14a0a0,_0x45d0cf){_0x14a0a0=_0x14a0a0-0x0;var _0x56b651=_0x403a[_0x14a0a0];return _0x56b651;};'use strict';var Sequelize=require(_0xa403('0x0'));module[_0xa403('0x1')]={'license':{'type':Sequelize[_0xa403('0x2')]},'data1':{'type':Sequelize[_0xa403('0x3')]},'data2':{'type':Sequelize[_0xa403('0x3')]},'chatLicenseExceeded':{'type':Sequelize[_0xa403('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0x3a0a=['sequelize','exports','STRING','INTEGER'];(function(_0xb0f7c3,_0x4eae95){var _0x28ea68=function(_0x4395a7){while(--_0x4395a7){_0xb0f7c3['push'](_0xb0f7c3['shift']());}};_0x28ea68(++_0x4eae95);}(_0x3a0a,0xac));var _0xa3a0=function(_0x3541e3,_0x5e6812){_0x3541e3=_0x3541e3-0x0;var _0xbe2f25=_0x3a0a[_0x3541e3];return _0xbe2f25;};'use strict';var Sequelize=require(_0xa3a0('0x0'));module[_0xa3a0('0x1')]={'license':{'type':Sequelize['TEXT']},'data1':{'type':Sequelize['STRING']},'data2':{'type':Sequelize[_0xa3a0('0x2')]},'chatLicenseExceeded':{'type':Sequelize[_0xa3a0('0x3')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/license/license.controller.js b/server/api/license/license.controller.js index b5aafa0..8f85f58 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 _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(_0x22ffbf,_0x16f31e){var _0x360c17=function(_0x40807f){while(--_0x40807f){_0x22ffbf['push'](_0x22ffbf['shift']());}};_0x360c17(++_0x16f31e);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xc4aa[_0x321bb2];return _0x9c12ed;};'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 +var _0x0295=['demo','eml-format','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','end','status','json','offset','undefined','limit','count','set','apply','save','update','then','destroy','stack','name','send','../../config/license/util','model','keys','rawAttributes','query','filters','intersection','attributes','fields','merge','options','catch','body','License','find','checkLicense','key'];(function(_0x3c8e9a,_0x384306){var _0x2d4c57=function(_0x43d408){while(--_0x43d408){_0x3c8e9a['push'](_0x3c8e9a['shift']());}};_0x2d4c57(++_0x384306);}(_0x0295,0x1f0));var _0x5029=function(_0x13ec2b,_0x40b664){_0x13ec2b=_0x13ec2b-0x0;var _0x1fb3f4=_0x0295[_0x13ec2b];return _0x1fb3f4;};'use strict';var emlformat=require(_0x5029('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x5029('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x5029('0x2'));var Mustache=require(_0x5029('0x3'));var util=require(_0x5029('0x4'));var path=require(_0x5029('0x5'));var sox=require(_0x5029('0x6'));var csv=require(_0x5029('0x7'));var ejs=require(_0x5029('0x8'));var fs=require('fs');var fs_extra=require(_0x5029('0x9'));var _=require(_0x5029('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x5029('0xb'));var toCsv=require('to-csv');var querystring=require(_0x5029('0xc'));var Papa=require('papaparse');var Redis=require(_0x5029('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x5029('0xe'));var as=require(_0x5029('0xf'));var hardwareService=require(_0x5029('0x10'));var logger=require('../../config/logger')(_0x5029('0x11'));var utils=require(_0x5029('0x12'));var config=require(_0x5029('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x5029('0x14'))['db'];function respondWithStatusCode(_0x2442b2,_0x4cced9){_0x4cced9=_0x4cced9||0xcc;return function(_0x4fa22d){if(_0x4fa22d){return _0x2442b2['sendStatus'](_0x4cced9);}return _0x2442b2['status'](_0x4cced9)[_0x5029('0x15')]();};}function respondWithResult(_0x2e0369,_0x12c237){_0x12c237=_0x12c237||0xc8;return function(_0x434630){if(_0x434630){return _0x2e0369[_0x5029('0x16')](_0x12c237)[_0x5029('0x17')](_0x434630);}};}function respondWithFilteredResult(_0xe278b7,_0x317c20){return function(_0x10bf55){if(_0x10bf55){var _0x326923=typeof _0x317c20[_0x5029('0x18')]===_0x5029('0x19')&&typeof _0x317c20[_0x5029('0x1a')]===_0x5029('0x19');var _0x343918=_0x10bf55['count'];var _0x1ed567=_0x326923?0x0:_0x317c20[_0x5029('0x18')];var _0x35de81=_0x326923?_0x10bf55[_0x5029('0x1b')]:_0x317c20[_0x5029('0x18')]+_0x317c20[_0x5029('0x1a')];var _0xaba461;if(_0x35de81>=_0x343918){_0x35de81=_0x343918;_0xaba461=0xc8;}else{_0xaba461=0xce;}_0xe278b7['status'](_0xaba461);return _0xe278b7[_0x5029('0x1c')]('Content-Range',_0x1ed567+'-'+_0x35de81+'/'+_0x343918)[_0x5029('0x17')](_0x10bf55);}return null;};}function patchUpdates(_0x8a414c){return function(_0x2710aa){try{jsonpatch[_0x5029('0x1d')](_0x2710aa,_0x8a414c,!![]);}catch(_0x4b5854){return BPromise['reject'](_0x4b5854);}return _0x2710aa[_0x5029('0x1e')]();};}function saveUpdates(_0x4a49b6,_0x3f657d){return function(_0x853a34){if(_0x853a34){return _0x853a34[_0x5029('0x1f')](_0x4a49b6)[_0x5029('0x20')](function(_0x16bd22){return _0x16bd22;});}return null;};}function removeEntity(_0x3a3e52,_0x125c26){return function(_0x356dac){if(_0x356dac){return _0x356dac[_0x5029('0x21')]()['then'](function(){_0x3a3e52['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x588d90,_0x45666c){return function(_0x51093c){if(!_0x51093c){_0x588d90['sendStatus'](0x194);}return _0x51093c;};}function handleError(_0x181da0,_0x1e7e61){_0x1e7e61=_0x1e7e61||0x1f4;return function(_0x36d810){logger['error'](_0x36d810[_0x5029('0x22')]);if(_0x36d810[_0x5029('0x23')]){delete _0x36d810['name'];}_0x181da0[_0x5029('0x16')](_0x1e7e61)[_0x5029('0x24')](_0x36d810);};}var utilLicense=require(_0x5029('0x25'));exports['index']=function(_0x32da06,_0x251f99){var _0xe5313e={'raw':!![],'where':{'id':0x1}},_0x4b6f92={};_0x4b6f92[_0x5029('0x26')]=_[_0x5029('0x27')](db['License'][_0x5029('0x28')]);_0x4b6f92[_0x5029('0x29')]=_[_0x5029('0x27')](_0x32da06[_0x5029('0x29')]);_0x4b6f92[_0x5029('0x2a')]=_[_0x5029('0x2b')](_0x4b6f92[_0x5029('0x26')],_0x4b6f92[_0x5029('0x29')]);_0xe5313e[_0x5029('0x2c')]=_[_0x5029('0x2b')](_0x4b6f92[_0x5029('0x26')],qs[_0x5029('0x2d')](_0x32da06['query'][_0x5029('0x2d')]));_0xe5313e['attributes']=_0xe5313e[_0x5029('0x2c')]['length']?_0xe5313e['attributes']:_0x4b6f92[_0x5029('0x26')];_0xe5313e=_[_0x5029('0x2e')]({},_0xe5313e,_0x32da06[_0x5029('0x2f')]);return utilLicense['getLicense'](_0xe5313e)[_0x5029('0x20')](respondWithResult(_0x251f99,null))[_0x5029('0x30')](handleError(_0x251f99,null));};exports[_0x5029('0x1f')]=function(_0x29c59a,_0x1bb896){if(_0x29c59a[_0x5029('0x31')]['id']){delete _0x29c59a[_0x5029('0x31')]['id'];}return db[_0x5029('0x32')][_0x5029('0x33')]({'where':{'id':_0x29c59a['params']['id']}})[_0x5029('0x20')](handleEntityNotFound(_0x1bb896,null))[_0x5029('0x20')](function(_0xc110e8){var _0x1b3817=_0xc110e8['get']({'plain':!![]});return utilLicense[_0x5029('0x34')](_0x1b3817,_0x29c59a[_0x5029('0x31')][_0x5029('0x35')]);})['then'](function(_0x4904cc){if(!_0x4904cc[_0x5029('0x36')]){return saveUpdates(_0x29c59a[_0x5029('0x31')],null);}return _0x4904cc;})['then'](respondWithResult(_0x1bb896,null))['catch'](handleError(_0x1bb896,null));}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index 6c944b6..4a790a5 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 _0x6aa8=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./license.attributes','exports','define','License','license','util'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x6aa8,0x113));var _0x86aa=function(_0x1ae892,_0x19c818){_0x1ae892=_0x1ae892-0x0;var _0x5af3fa=_0x6aa8[_0x1ae892];return _0x5af3fa;};'use strict';var _=require('lodash');var util=require(_0x86aa('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x86aa('0x1'));var BPromise=require(_0x86aa('0x2'));var rp=require(_0x86aa('0x3'));var fs=require('fs');var path=require(_0x86aa('0x4'));var rimraf=require(_0x86aa('0x5'));var config=require(_0x86aa('0x6'));var attributes=require(_0x86aa('0x7'));module[_0x86aa('0x8')]=function(_0x447be3,_0xdde82e){return _0x447be3[_0x86aa('0x9')](_0x86aa('0xa'),attributes,{'tableName':_0x86aa('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x10fc=['request-promise','path','rimraf','./license.attributes','define','License','license','lodash','moment','bluebird'];(function(_0x4d534b,_0x40ade7){var _0x5226bf=function(_0x570d60){while(--_0x570d60){_0x4d534b['push'](_0x4d534b['shift']());}};_0x5226bf(++_0x40ade7);}(_0x10fc,0x10b));var _0xc10f=function(_0x170337,_0xe7c4e7){_0x170337=_0x170337-0x0;var _0x5c39c1=_0x10fc[_0x170337];return _0x5c39c1;};'use strict';var _=require(_0xc10f('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xc10f('0x1'));var BPromise=require(_0xc10f('0x2'));var rp=require(_0xc10f('0x3'));var fs=require('fs');var path=require(_0xc10f('0x4'));var rimraf=require(_0xc10f('0x5'));var config=require('../../config/environment');var attributes=require(_0xc10f('0x6'));module['exports']=function(_0x29dc93,_0x28f6e3){return _0x29dc93[_0xc10f('0x7')](_0xc10f('0x8'),attributes,{'tableName':_0xc10f('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/license/license.rpc.js b/server/api/license/license.rpc.js index 2abea53..1bc0f3d 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 _0x972d=['result','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','info','License,\x20%s,\x20%s','request\x20sent','debug','License,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0x5f25b3,_0x542537){var _0x46c4cc=function(_0x5c9001){while(--_0x5c9001){_0x5f25b3['push'](_0x5f25b3['shift']());}};_0x46c4cc(++_0x542537);}(_0x972d,0x14b));var _0xd972=function(_0x3c0ad6,_0x26ebc2){_0x3c0ad6=_0x3c0ad6-0x0;var _0x3f1e08=_0x972d[_0x3c0ad6];return _0x3f1e08;};'use strict';var _=require('lodash');var util=require(_0xd972('0x0'));var moment=require(_0xd972('0x1'));var BPromise=require(_0xd972('0x2'));var rs=require(_0xd972('0x3'));var fs=require('fs');var Redis=require(_0xd972('0x4'));var db=require(_0xd972('0x5'))['db'];var utils=require(_0xd972('0x6'));var logger=require('../../config/logger')(_0xd972('0x7'));var config=require(_0xd972('0x8'));var jayson=require(_0xd972('0x9'));var client=jayson[_0xd972('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x55af8e,_0x1e210f,_0x40c53a){return new BPromise(function(_0x20b843,_0x3bf69d){return client[_0xd972('0xb')](_0x55af8e,_0x40c53a)[_0xd972('0xc')](function(_0x4ba3cf){logger[_0xd972('0xd')](_0xd972('0xe'),_0x1e210f,_0xd972('0xf'));logger[_0xd972('0x10')](_0xd972('0x11'),_0x1e210f,'request\x20sent',JSON['stringify'](_0x4ba3cf));if(_0x4ba3cf[_0xd972('0x12')]){if(_0x4ba3cf[_0xd972('0x12')][_0xd972('0x13')]===0x1f4){logger['error'](_0xd972('0xe'),_0x1e210f,_0x4ba3cf[_0xd972('0x12')][_0xd972('0x14')]);return _0x3bf69d(_0x4ba3cf[_0xd972('0x12')][_0xd972('0x14')]);}logger['error']('License,\x20%s,\x20%s',_0x1e210f,_0x4ba3cf[_0xd972('0x12')][_0xd972('0x14')]);return _0x20b843(_0x4ba3cf[_0xd972('0x12')][_0xd972('0x14')]);}else{logger['info']('License,\x20%s,\x20%s',_0x1e210f,'request\x20sent');_0x20b843(_0x4ba3cf[_0xd972('0x15')][_0xd972('0x14')]);}})['catch'](function(_0x58fb8b){logger[_0xd972('0x12')]('License,\x20%s,\x20%s',_0x1e210f,_0x58fb8b);_0x3bf69d(_0x58fb8b);});});} \ No newline at end of file +var _0x8980=['debug','License,\x20%s,\x20%s,\x20%s','error','message','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','info','License,\x20%s,\x20%s','request\x20sent'];(function(_0x4e9665,_0x4cabd8){var _0x38e12c=function(_0x270d8c){while(--_0x270d8c){_0x4e9665['push'](_0x4e9665['shift']());}};_0x38e12c(++_0x4cabd8);}(_0x8980,0x195));var _0x0898=function(_0x588a9c,_0x434e22){_0x588a9c=_0x588a9c-0x0;var _0x32ab03=_0x8980[_0x588a9c];return _0x32ab03;};'use strict';var _=require(_0x0898('0x0'));var util=require('util');var moment=require(_0x0898('0x1'));var BPromise=require(_0x0898('0x2'));var rs=require(_0x0898('0x3'));var fs=require('fs');var Redis=require(_0x0898('0x4'));var db=require(_0x0898('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0898('0x6'))(_0x0898('0x7'));var config=require('../../config/environment');var jayson=require(_0x0898('0x8'));var client=jayson[_0x0898('0x9')][_0x0898('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x312760,_0x7a1583,_0x1f5096){return new BPromise(function(_0x1725ba,_0x3f301f){return client[_0x0898('0xb')](_0x312760,_0x1f5096)['then'](function(_0x3920d9){logger[_0x0898('0xc')](_0x0898('0xd'),_0x7a1583,_0x0898('0xe'));logger[_0x0898('0xf')](_0x0898('0x10'),_0x7a1583,'request\x20sent',JSON['stringify'](_0x3920d9));if(_0x3920d9['error']){if(_0x3920d9[_0x0898('0x11')]['code']===0x1f4){logger[_0x0898('0x11')](_0x0898('0xd'),_0x7a1583,_0x3920d9['error'][_0x0898('0x12')]);return _0x3f301f(_0x3920d9[_0x0898('0x11')][_0x0898('0x12')]);}logger[_0x0898('0x11')]('License,\x20%s,\x20%s',_0x7a1583,_0x3920d9[_0x0898('0x11')]['message']);return _0x1725ba(_0x3920d9[_0x0898('0x11')][_0x0898('0x12')]);}else{logger['info'](_0x0898('0xd'),_0x7a1583,_0x0898('0xe'));_0x1725ba(_0x3920d9['result'][_0x0898('0x12')]);}})[_0x0898('0x13')](function(_0x161f58){logger[_0x0898('0x11')](_0x0898('0xd'),_0x7a1583,_0x161f58);_0x3f301f(_0x161f58);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index 5233e6f..a3a0203 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 _0x3a7c=['addInteraction','/:id/applications','send','addAgents','put','update','removeDispositions','delete','removeImap','removeSmtp','destroy','removeAgents','exports','express','fs-extra','../../components/interaction/service','../../config/environment','./mailAccount.controller','index','get','/describe','isAuthenticated','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','/:id/in_servers','getImap','/:id/out_servers','/:id/interactions','getApplications','/:id/messages','getMessages','/:id/verify','/:id/users','getAgents','addDisposition','post','create','addImap','addSmtp'];(function(_0x9641f8,_0x5c2372){var _0x3881b4=function(_0x45b7d9){while(--_0x45b7d9){_0x9641f8['push'](_0x9641f8['shift']());}};_0x3881b4(++_0x5c2372);}(_0x3a7c,0x1bb));var _0xc3a7=function(_0x3a0b7f,_0x550d3b){_0x3a0b7f=_0x3a0b7f-0x0;var _0x551562=_0x3a7c[_0x3a0b7f];return _0x551562;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xc3a7('0x0'));var router=express['Router']();var fs_extra=require(_0xc3a7('0x1'));var auth=require('../../components/auth/service');var interaction=require(_0xc3a7('0x2'));var config=require(_0xc3a7('0x3'));var controller=require(_0xc3a7('0x4'));router['get']('/',auth['isAuthenticated'](),controller[_0xc3a7('0x5')]);router[_0xc3a7('0x6')](_0xc3a7('0x7'),auth[_0xc3a7('0x8')](),controller[_0xc3a7('0x9')]);router[_0xc3a7('0x6')](_0xc3a7('0xa'),auth[_0xc3a7('0x8')](),controller[_0xc3a7('0xb')]);router[_0xc3a7('0x6')](_0xc3a7('0xc'),auth[_0xc3a7('0x8')](),controller[_0xc3a7('0xd')]);router[_0xc3a7('0x6')](_0xc3a7('0xe'),auth[_0xc3a7('0x8')](),controller['getAnswers']);router[_0xc3a7('0x6')](_0xc3a7('0xf'),auth['isAuthenticated'](),controller[_0xc3a7('0x10')]);router[_0xc3a7('0x6')](_0xc3a7('0x11'),auth[_0xc3a7('0x8')](),controller['getSmtp']);router[_0xc3a7('0x6')](_0xc3a7('0x12'),auth[_0xc3a7('0x8')](),controller['getInteractions']);router[_0xc3a7('0x6')]('/:id/applications',auth[_0xc3a7('0x8')](),controller[_0xc3a7('0x13')]);router[_0xc3a7('0x6')](_0xc3a7('0x14'),auth[_0xc3a7('0x8')](),controller[_0xc3a7('0x15')]);router[_0xc3a7('0x6')](_0xc3a7('0x16'),auth[_0xc3a7('0x8')](),controller['verifySmtp']);router[_0xc3a7('0x6')](_0xc3a7('0x17'),auth['isAuthenticated'](),controller[_0xc3a7('0x18')]);router['post'](_0xc3a7('0xc'),auth[_0xc3a7('0x8')](),controller[_0xc3a7('0x19')]);router[_0xc3a7('0x1a')]('/:id/canned_answers',auth['isAuthenticated'](),controller['addAnswer']);router['post']('/',auth['isAuthenticated'](),controller[_0xc3a7('0x1b')]);router[_0xc3a7('0x1a')]('/:id/in_servers',auth[_0xc3a7('0x8')](),controller[_0xc3a7('0x1c')]);router[_0xc3a7('0x1a')](_0xc3a7('0x11'),auth['isAuthenticated'](),controller[_0xc3a7('0x1d')]);router[_0xc3a7('0x1a')]('/:id/interactions',auth[_0xc3a7('0x8')](),controller[_0xc3a7('0x1e')]);router[_0xc3a7('0x1a')](_0xc3a7('0x1f'),auth['isAuthenticated'](),controller['addApplications']);router['post']('/:id/send',auth['isAuthenticated'](),controller[_0xc3a7('0x20')]);router['post'](_0xc3a7('0x17'),auth[_0xc3a7('0x8')](),controller[_0xc3a7('0x21')]);router[_0xc3a7('0x22')](_0xc3a7('0xa'),auth[_0xc3a7('0x8')](),controller[_0xc3a7('0x23')]);router['delete'](_0xc3a7('0xc'),auth[_0xc3a7('0x8')](),controller[_0xc3a7('0x24')]);router[_0xc3a7('0x25')]('/:id/canned_answers',auth[_0xc3a7('0x8')](),controller['removeAnswers']);router[_0xc3a7('0x25')]('/:id/in_servers',auth[_0xc3a7('0x8')](),controller[_0xc3a7('0x26')]);router[_0xc3a7('0x25')]('/:id/out_servers',auth['isAuthenticated'](),controller[_0xc3a7('0x27')]);router['delete'](_0xc3a7('0xa'),auth[_0xc3a7('0x8')](),controller[_0xc3a7('0x28')]);router[_0xc3a7('0x25')](_0xc3a7('0x17'),auth[_0xc3a7('0x8')](),controller[_0xc3a7('0x29')]);module[_0xc3a7('0x2a')]=router; \ No newline at end of file +var _0x138f=['index','get','/describe','isAuthenticated','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/in_servers','getImap','/:id/interactions','getInteractions','getApplications','/:id/messages','getMessages','/:id/verify','verifySmtp','getAgents','post','addDisposition','addAnswer','create','addImap','/:id/out_servers','addSmtp','addInteraction','addApplications','send','/:id/users','addAgents','put','delete','removeDispositions','removeAnswers','removeImap','removeSmtp','destroy','removeAgents','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x1dcf0b,_0x4ab222){var _0x17cf9f=function(_0x1a2048){while(--_0x1a2048){_0x1dcf0b['push'](_0x1dcf0b['shift']());}};_0x17cf9f(++_0x4ab222);}(_0x138f,0x143));var _0xf138=function(_0x1fd5eb,_0x235203){_0x1fd5eb=_0x1fd5eb-0x0;var _0x102365=_0x138f[_0x1fd5eb];return _0x102365;};'use strict';var multer=require('multer');var util=require(_0xf138('0x0'));var path=require('path');var timeout=require(_0xf138('0x1'));var express=require('express');var router=express[_0xf138('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xf138('0x3'));var interaction=require(_0xf138('0x4'));var config=require(_0xf138('0x5'));var controller=require('./mailAccount.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xf138('0x6')]);router[_0xf138('0x7')](_0xf138('0x8'),auth[_0xf138('0x9')](),controller[_0xf138('0xa')]);router['get'](_0xf138('0xb'),auth['isAuthenticated'](),controller[_0xf138('0xc')]);router['get'](_0xf138('0xd'),auth['isAuthenticated'](),controller[_0xf138('0xe')]);router[_0xf138('0x7')](_0xf138('0xf'),auth[_0xf138('0x9')](),controller[_0xf138('0x10')]);router[_0xf138('0x7')](_0xf138('0x11'),auth['isAuthenticated'](),controller[_0xf138('0x12')]);router[_0xf138('0x7')]('/:id/out_servers',auth['isAuthenticated'](),controller['getSmtp']);router['get'](_0xf138('0x13'),auth[_0xf138('0x9')](),controller[_0xf138('0x14')]);router['get']('/:id/applications',auth['isAuthenticated'](),controller[_0xf138('0x15')]);router[_0xf138('0x7')](_0xf138('0x16'),auth[_0xf138('0x9')](),controller[_0xf138('0x17')]);router[_0xf138('0x7')](_0xf138('0x18'),auth[_0xf138('0x9')](),controller[_0xf138('0x19')]);router['get']('/:id/users',auth[_0xf138('0x9')](),controller[_0xf138('0x1a')]);router[_0xf138('0x1b')](_0xf138('0xd'),auth[_0xf138('0x9')](),controller[_0xf138('0x1c')]);router[_0xf138('0x1b')](_0xf138('0xf'),auth[_0xf138('0x9')](),controller[_0xf138('0x1d')]);router['post']('/',auth[_0xf138('0x9')](),controller[_0xf138('0x1e')]);router[_0xf138('0x1b')]('/:id/in_servers',auth[_0xf138('0x9')](),controller[_0xf138('0x1f')]);router['post'](_0xf138('0x20'),auth['isAuthenticated'](),controller[_0xf138('0x21')]);router[_0xf138('0x1b')]('/:id/interactions',auth[_0xf138('0x9')](),controller[_0xf138('0x22')]);router[_0xf138('0x1b')]('/:id/applications',auth[_0xf138('0x9')](),controller[_0xf138('0x23')]);router[_0xf138('0x1b')]('/:id/send',auth[_0xf138('0x9')](),controller[_0xf138('0x24')]);router[_0xf138('0x1b')](_0xf138('0x25'),auth[_0xf138('0x9')](),controller[_0xf138('0x26')]);router[_0xf138('0x27')]('/:id',auth[_0xf138('0x9')](),controller['update']);router[_0xf138('0x28')](_0xf138('0xd'),auth[_0xf138('0x9')](),controller[_0xf138('0x29')]);router['delete']('/:id/canned_answers',auth['isAuthenticated'](),controller[_0xf138('0x2a')]);router[_0xf138('0x28')](_0xf138('0x11'),auth[_0xf138('0x9')](),controller[_0xf138('0x2b')]);router[_0xf138('0x28')](_0xf138('0x20'),auth['isAuthenticated'](),controller[_0xf138('0x2c')]);router['delete'](_0xf138('0xb'),auth[_0xf138('0x9')](),controller[_0xf138('0x2d')]);router[_0xf138('0x28')](_0xf138('0x25'),auth['isAuthenticated'](),controller[_0xf138('0x2e')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.attributes.js b/server/api/mailAccount/mailAccount.attributes.js index 7c35213..30986e2 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 _0x4006=['Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','exports','STRING','BOOLEAN','INTEGER','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'];(function(_0xd0b415,_0x149675){var _0x2bdf2c=function(_0x59fbfa){while(--_0x59fbfa){_0xd0b415['push'](_0xd0b415['shift']());}};_0x2bdf2c(++_0x149675);}(_0x4006,0x1c7));var _0x6400=function(_0x446848,_0x4c7cc8){_0x446848=_0x446848-0x0;var _0x19337d=_0x4006[_0x446848];return _0x19337d;};'use strict';var Sequelize=require('sequelize');module[_0x6400('0x0')]={'description':{'type':Sequelize[_0x6400('0x1')]},'name':{'type':Sequelize[_0x6400('0x1')],'allowNull':![]},'service':{'type':Sequelize[_0x6400('0x2')],'defaultValue':![]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'key':{'type':Sequelize[_0x6400('0x1')],'allowNull':![]},'template':{'type':Sequelize['TEXT']},'markAsUnread':{'type':Sequelize[_0x6400('0x2')],'defaultValue':![]},'fontFamily':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'Arial,Helvetica,sans-serif'},'fontSize':{'type':Sequelize[_0x6400('0x3')](0x2)['UNSIGNED'],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0x6400('0x4')],'defaultValue':function(){return _0x6400('0x5');}},'notificationSound':{'type':Sequelize[_0x6400('0x2')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x6400('0x2')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x6400('0x2')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x6400('0x3')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x6400('0x2')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x6400('0x3')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x6400('0x3')],'allowNull':!![],'defaultValue':null,'comment':_0x6400('0x6')},'mandatoryDisposition':{'type':Sequelize[_0x6400('0x2')],'defaultValue':![],'comment':_0x6400('0x7'),'set':function(_0x237e22){if(!_0x237e22)this[_0x6400('0x8')](_0x6400('0x9'),null);this['setDataValue'](_0x6400('0xa'),_0x237e22);}}}; \ No newline at end of file +var _0x7d86=['setDataValue','mandatoryDispositionPauseId','sequelize','STRING','BOOLEAN','TEXT','Arial,Helvetica,sans-serif','INTEGER','UNSIGNED','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue'];(function(_0x2fbc2d,_0x2450cc){var _0x31155f=function(_0x437864){while(--_0x437864){_0x2fbc2d['push'](_0x2fbc2d['shift']());}};_0x31155f(++_0x2450cc);}(_0x7d86,0x86));var _0x67d8=function(_0x327eee,_0x48918f){_0x327eee=_0x327eee-0x0;var _0xe83c68=_0x7d86[_0x327eee];return _0xe83c68;};'use strict';var Sequelize=require(_0x67d8('0x0'));module['exports']={'description':{'type':Sequelize[_0x67d8('0x1')]},'name':{'type':Sequelize[_0x67d8('0x1')],'allowNull':![]},'service':{'type':Sequelize[_0x67d8('0x2')],'defaultValue':![]},'email':{'type':Sequelize[_0x67d8('0x1')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0x67d8('0x2')],'defaultValue':!![]},'key':{'type':Sequelize[_0x67d8('0x1')],'allowNull':![]},'template':{'type':Sequelize[_0x67d8('0x3')]},'markAsUnread':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0x67d8('0x1')],'allowNull':![],'defaultValue':_0x67d8('0x4')},'fontSize':{'type':Sequelize[_0x67d8('0x5')](0x2)[_0x67d8('0x6')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0x67d8('0x3')],'defaultValue':function(){return _0x67d8('0x7');}},'notificationSound':{'type':Sequelize[_0x67d8('0x2')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x67d8('0x2')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x67d8('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x67d8('0x2')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x67d8('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x67d8('0x2')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x67d8('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x67d8('0x5')],'allowNull':!![],'defaultValue':null,'comment':_0x67d8('0x8')},'mandatoryDisposition':{'type':Sequelize[_0x67d8('0x2')],'defaultValue':![],'comment':_0x67d8('0x9'),'set':function(_0x14d7be){if(!_0x14d7be)this[_0x67d8('0xa')](_0x67d8('0xb'),null);this[_0x67d8('0xa')]('mandatoryDisposition',_0x14d7be);}}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index 504adf6..5fc5f74 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 _0xa450=['papaparse','html-to-text','juice','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','defaults','redis','./mailAccount.socket','register','http','then','info','MailAccount,\x20%s,\x20%s','debug','stringify','error','code','message','result','catch','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','apply','destroy','get','MailAccounts','UserProfileResource','stack','name','send','index','MailServerOut','Smtp','Pause','mandatoryDispositionPause','map','MailAccount','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','show','MailServerIn','Imap','length','find','update','body','params','describe','create','getDispositions','Disposition','order','MailAccountId','rows','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','findOne','removeAnswers','key','email','isNil','active','description','cauthentication','user','password','authentication','host','port','service','cservice','cuser','pass','cpassword','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','removeImap','setImap','getSmtp','removeSmtp','MailInteraction','addInteraction','omit','getInteractions','CmContact','Contact','fullname','internal','Tag','Tags','color','tag','addApplications','sequelize','MailApplication','bulkCreate','findAndCountAll','priority','getApplications','getMessages','MailMessage','$gte','format','split','Contacts','updatedAt','DESC','from','%s\x20<%s>','attachments','join','root','server/files/attachments','basename','auth','secure','SendMail','List\x20not\x20found','List','subject','attach','out','YYYY-MM-DD\x20HH:mm:ss','Messages','verifySmtp','Sequelize','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','spread','emit','userMailAccount:save','removeAgents','isArray','userMailAccount:remove','getAgents','User','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','jsforce','querystring'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa450,0x176));var _0x0a45=function(_0x2ad980,_0x22ba69){_0x2ad980=_0x2ad980-0x0;var _0x54f7d1=_0xa450[_0x2ad980];return _0x54f7d1;};'use strict';var emlformat=require(_0x0a45('0x0'));var rimraf=require(_0x0a45('0x1'));var zipdir=require(_0x0a45('0x2'));var jsonpatch=require(_0x0a45('0x3'));var rp=require(_0x0a45('0x4'));var moment=require(_0x0a45('0x5'));var BPromise=require(_0x0a45('0x6'));var Mustache=require(_0x0a45('0x7'));var util=require(_0x0a45('0x8'));var path=require(_0x0a45('0x9'));var sox=require('sox');var csv=require(_0x0a45('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0a45('0xb'));var _=require(_0x0a45('0xc'));var squel=require(_0x0a45('0xd'));var crypto=require('crypto');var jsforce=require(_0x0a45('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x0a45('0xa'));var querystring=require(_0x0a45('0xf'));var Papa=require(_0x0a45('0x10'));var htmlToText=require(_0x0a45('0x11'));var juice=require(_0x0a45('0x12'));var Redis=require(_0x0a45('0x13'));var authService=require(_0x0a45('0x14'));var qs=require(_0x0a45('0x15'));var as=require(_0x0a45('0x16'));var hardwareService=require(_0x0a45('0x17'));var logger=require(_0x0a45('0x18'))(_0x0a45('0x19'));var utils=require(_0x0a45('0x1a'));var config=require('../../config/environment');var licenseUtil=require(_0x0a45('0x1b'));var db=require(_0x0a45('0x1c'))['db'];config['redis']=_[_0x0a45('0x1d')](config[_0x0a45('0x1e')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x0a45('0x1f'))[_0x0a45('0x20')](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0x0a45('0x21')]({'port':0x232b});function respondWithRpcPromise(_0x4badb4,_0x18231b,_0x37e9bc,_0x28e8ef){return new BPromise(function(_0xab6e1a,_0x573dd5){var _0x47ac71=_0x28e8ef||client;return _0x47ac71['request'](_0x4badb4,_0x37e9bc)[_0x0a45('0x22')](function(_0x3e32a3){logger[_0x0a45('0x23')](_0x0a45('0x24'),_0x18231b,'request\x20sent');logger[_0x0a45('0x25')]('MailAccount,\x20%s,\x20%s,\x20%s',_0x18231b,'request\x20sent',JSON[_0x0a45('0x26')](_0x3e32a3));if(_0x3e32a3[_0x0a45('0x27')]){if(_0x3e32a3[_0x0a45('0x27')][_0x0a45('0x28')]===0x1f4){logger[_0x0a45('0x27')](_0x0a45('0x24'),_0x18231b,_0x3e32a3[_0x0a45('0x27')]['message']);return _0x573dd5(_0x3e32a3['error'][_0x0a45('0x29')]);}logger[_0x0a45('0x27')](_0x0a45('0x24'),_0x18231b,_0x3e32a3[_0x0a45('0x27')][_0x0a45('0x29')]);return _0xab6e1a(_0x3e32a3['error']['message']);}else{logger[_0x0a45('0x23')](_0x0a45('0x24'),_0x18231b,'request\x20sent');_0xab6e1a(_0x3e32a3[_0x0a45('0x2a')][_0x0a45('0x29')]);}})[_0x0a45('0x2b')](function(_0x4b454f){logger[_0x0a45('0x27')](_0x0a45('0x24'),_0x18231b,_0x4b454f);_0x573dd5(_0x4b454f);});});}function respondWithStatusCode(_0x2a1523,_0x1206ac){_0x1206ac=_0x1206ac||0xcc;return function(_0x68d6d2){if(_0x68d6d2){return _0x2a1523[_0x0a45('0x2c')](_0x1206ac);}return _0x2a1523['status'](_0x1206ac)[_0x0a45('0x2d')]();};}function respondWithResult(_0x3d6236,_0x19a393){_0x19a393=_0x19a393||0xc8;return function(_0x50cee5){if(_0x50cee5){return _0x3d6236[_0x0a45('0x2e')](_0x19a393)[_0x0a45('0x2f')](_0x50cee5);}};}function respondWithFilteredResult(_0x10fe2a,_0x47d242){return function(_0x40150a){if(_0x40150a){var _0x221142=typeof _0x47d242[_0x0a45('0x30')]===_0x0a45('0x31')&&typeof _0x47d242['limit']==='undefined';var _0x1c0625=_0x40150a[_0x0a45('0x32')];var _0x425312=_0x221142?0x0:_0x47d242[_0x0a45('0x30')];var _0x186b6c=_0x221142?_0x40150a[_0x0a45('0x32')]:_0x47d242[_0x0a45('0x30')]+_0x47d242[_0x0a45('0x33')];var _0x2e0d30;if(_0x186b6c>=_0x1c0625){_0x186b6c=_0x1c0625;_0x2e0d30=0xc8;}else{_0x2e0d30=0xce;}_0x10fe2a[_0x0a45('0x2e')](_0x2e0d30);return _0x10fe2a[_0x0a45('0x34')](_0x0a45('0x35'),_0x425312+'-'+_0x186b6c+'/'+_0x1c0625)[_0x0a45('0x2f')](_0x40150a);}return null;};}function patchUpdates(_0x4a9f7e){return function(_0x2c50c6){try{jsonpatch[_0x0a45('0x36')](_0x2c50c6,_0x4a9f7e,!![]);}catch(_0x31761a){return BPromise['reject'](_0x31761a);}return _0x2c50c6['save']();};}function saveUpdates(_0x1cb5e3,_0xf8eb95){return function(_0x1b4d9c){if(_0x1b4d9c){return _0x1b4d9c['update'](_0x1cb5e3)[_0x0a45('0x22')](function(_0x4b8ca1){return _0x4b8ca1;});}return null;};}function removeEntity(_0x1331ac,_0x2f68a0){return function(_0x1d2822){if(_0x1d2822){return _0x1d2822[_0x0a45('0x37')]()[_0x0a45('0x22')](function(){var _0x5a0071=_0x1d2822[_0x0a45('0x38')]({'plain':!![]});var _0x350ec0=_0x0a45('0x39');return db[_0x0a45('0x3a')][_0x0a45('0x37')]({'where':{'type':_0x350ec0,'resourceId':_0x5a0071['id']}})['then'](function(){return _0x1d2822;});})[_0x0a45('0x22')](function(){_0x1331ac[_0x0a45('0x2e')](0xcc)[_0x0a45('0x2d')]();});}};}function handleEntityNotFound(_0xdb8534,_0x4d1913){return function(_0x2f3146){if(!_0x2f3146){_0xdb8534[_0x0a45('0x2c')](0x194);}return _0x2f3146;};}function handleError(_0x5ae995,_0x507c10){_0x507c10=_0x507c10||0x1f4;return function(_0x1c7219){logger[_0x0a45('0x27')](_0x1c7219[_0x0a45('0x3b')]);if(_0x1c7219[_0x0a45('0x3c')]){delete _0x1c7219[_0x0a45('0x3c')];}_0x5ae995[_0x0a45('0x2e')](_0x507c10)[_0x0a45('0x3d')](_0x1c7219);};}exports[_0x0a45('0x3e')]=function(_0x537946,_0x2fd471){var _0x3c2b5e={'include':[{'model':db['MailServerIn'],'as':'Imap'},{'model':db[_0x0a45('0x3f')],'as':_0x0a45('0x40')},{'model':db[_0x0a45('0x41')],'as':_0x0a45('0x42')}]},_0x32bf93={},_0x4b17ac={'count':0x0,'rows':[]};var _0x85b3c6=_[_0x0a45('0x43')](db[_0x0a45('0x44')][_0x0a45('0x45')],function(_0x37d5b0){return{'name':_0x37d5b0['fieldName'],'type':_0x37d5b0[_0x0a45('0x46')]['key']};});_0x32bf93[_0x0a45('0x47')]=_['map'](_0x85b3c6,_0x0a45('0x3c'));_0x32bf93[_0x0a45('0x48')]=_[_0x0a45('0x49')](_0x537946['query']);_0x32bf93[_0x0a45('0x4a')]=_[_0x0a45('0x4b')](_0x32bf93[_0x0a45('0x47')],_0x32bf93[_0x0a45('0x48')]);_0x3c2b5e[_0x0a45('0x4c')]=_['intersection'](_0x32bf93[_0x0a45('0x47')],qs[_0x0a45('0x4d')](_0x537946[_0x0a45('0x48')][_0x0a45('0x4d')]));_0x3c2b5e[_0x0a45('0x4c')]=_0x3c2b5e[_0x0a45('0x4c')]['length']?_0x3c2b5e[_0x0a45('0x4c')]:_0x32bf93[_0x0a45('0x47')];if(!_0x537946[_0x0a45('0x48')][_0x0a45('0x4e')](_0x0a45('0x4f'))){_0x3c2b5e[_0x0a45('0x33')]=qs['limit'](_0x537946[_0x0a45('0x48')][_0x0a45('0x33')]);_0x3c2b5e['offset']=qs[_0x0a45('0x30')](_0x537946[_0x0a45('0x48')][_0x0a45('0x30')]);}_0x3c2b5e['order']=qs[_0x0a45('0x50')](_0x537946['query'][_0x0a45('0x50')]);_0x3c2b5e[_0x0a45('0x51')]=qs[_0x0a45('0x4a')](_[_0x0a45('0x52')](_0x537946['query'],_0x32bf93[_0x0a45('0x4a')]),_0x85b3c6);if(_0x537946[_0x0a45('0x48')][_0x0a45('0x53')]){_0x3c2b5e[_0x0a45('0x51')]=_[_0x0a45('0x54')](_0x3c2b5e[_0x0a45('0x51')],{'$or':_[_0x0a45('0x43')](_0x85b3c6,function(_0x22fd97){if(_0x22fd97[_0x0a45('0x46')]!==_0x0a45('0x55')){var _0x3d1517={};_0x3d1517[_0x22fd97[_0x0a45('0x3c')]]={'$like':'%'+_0x537946[_0x0a45('0x48')][_0x0a45('0x53')]+'%'};return _0x3d1517;}})});}_0x3c2b5e=_[_0x0a45('0x54')]({},_0x3c2b5e,_0x537946[_0x0a45('0x56')]);var _0x1a169d={'where':_0x3c2b5e[_0x0a45('0x51')]};return db['MailAccount']['count'](_0x1a169d)['then'](function(_0x45311c){_0x4b17ac[_0x0a45('0x32')]=_0x45311c;if(_0x537946[_0x0a45('0x48')][_0x0a45('0x57')]){_0x3c2b5e[_0x0a45('0x58')]=[{'all':!![]}];}return db[_0x0a45('0x44')][_0x0a45('0x59')](_0x3c2b5e);})[_0x0a45('0x22')](function(_0x486964){_0x4b17ac['rows']=_0x486964;return _0x4b17ac;})[_0x0a45('0x22')](respondWithFilteredResult(_0x2fd471,_0x3c2b5e))[_0x0a45('0x2b')](handleError(_0x2fd471,null));};exports[_0x0a45('0x5a')]=function(_0x203903,_0x234c13){var _0x4987d8={'raw':![],'where':{'id':_0x203903['params']['id']},'include':[{'model':db[_0x0a45('0x5b')],'as':_0x0a45('0x5c')},{'model':db[_0x0a45('0x3f')],'as':'Smtp'},{'model':db[_0x0a45('0x41')],'as':_0x0a45('0x42')}]},_0x4cebd7={};_0x4cebd7['model']=_['keys'](db['MailAccount'][_0x0a45('0x45')]);_0x4cebd7[_0x0a45('0x48')]=_[_0x0a45('0x49')](_0x203903[_0x0a45('0x48')]);_0x4cebd7[_0x0a45('0x4a')]=_[_0x0a45('0x4b')](_0x4cebd7[_0x0a45('0x47')],_0x4cebd7[_0x0a45('0x48')]);_0x4987d8['attributes']=_[_0x0a45('0x4b')](_0x4cebd7[_0x0a45('0x47')],qs[_0x0a45('0x4d')](_0x203903['query'][_0x0a45('0x4d')]));_0x4987d8['attributes']=_0x4987d8[_0x0a45('0x4c')][_0x0a45('0x5d')]?_0x4987d8[_0x0a45('0x4c')]:_0x4cebd7[_0x0a45('0x47')];if(_0x203903[_0x0a45('0x48')][_0x0a45('0x57')]){_0x4987d8[_0x0a45('0x58')]=[{'all':!![]}];}_0x4987d8=_[_0x0a45('0x54')]({},_0x4987d8,_0x203903['options']);return db[_0x0a45('0x44')][_0x0a45('0x5e')](_0x4987d8)[_0x0a45('0x22')](handleEntityNotFound(_0x234c13,null))[_0x0a45('0x22')](respondWithResult(_0x234c13,null))['catch'](handleError(_0x234c13,null));};exports[_0x0a45('0x5f')]=function(_0x43c09a,_0x15608d){if(_0x43c09a[_0x0a45('0x60')]['id']){delete _0x43c09a[_0x0a45('0x60')]['id'];}return db[_0x0a45('0x44')][_0x0a45('0x5e')]({'where':{'id':_0x43c09a[_0x0a45('0x61')]['id']},'include':[{'model':db[_0x0a45('0x5b')],'as':_0x0a45('0x5c')},{'model':db[_0x0a45('0x3f')],'as':_0x0a45('0x40')},{'model':db[_0x0a45('0x41')],'as':_0x0a45('0x42')}]})[_0x0a45('0x22')](handleEntityNotFound(_0x15608d,null))[_0x0a45('0x22')](saveUpdates(_0x43c09a[_0x0a45('0x60')],null))['then'](function(_0x2bb12f){if(_0x2bb12f&&_0x43c09a['body'][_0x0a45('0x5c')]){return db[_0x0a45('0x5b')][_0x0a45('0x5f')](_0x43c09a[_0x0a45('0x60')][_0x0a45('0x5c')],{'where':{'MailAccountId':_0x2bb12f['id']}})[_0x0a45('0x22')](function(){return _0x2bb12f;});}return _0x2bb12f;})[_0x0a45('0x22')](function(_0x170440){if(_0x170440&&_0x43c09a[_0x0a45('0x60')][_0x0a45('0x40')]){return db['MailServerOut'][_0x0a45('0x5f')](_0x43c09a['body'][_0x0a45('0x40')],{'where':{'MailAccountId':_0x170440['id']}})[_0x0a45('0x22')](function(){return _0x170440;});}return _0x170440;})[_0x0a45('0x22')](respondWithResult(_0x15608d,null))[_0x0a45('0x2b')](handleError(_0x15608d,null));};exports[_0x0a45('0x62')]=function(_0x3c90f9,_0x2f2a85){return db[_0x0a45('0x44')]['describe']()['then'](respondWithResult(_0x2f2a85,null))[_0x0a45('0x2b')](handleError(_0x2f2a85,null));};exports['addDisposition']=function(_0x4d2a2f,_0x235ae9,_0x4bf5b4){if(_0x4d2a2f[_0x0a45('0x60')]['id']){delete _0x4d2a2f[_0x0a45('0x60')]['id'];}return db[_0x0a45('0x44')]['find']({'where':{'id':_0x4d2a2f['params']['id']}})['then'](handleEntityNotFound(_0x235ae9,null))['then'](function(_0xce8b24){if(_0xce8b24){_0x4d2a2f[_0x0a45('0x60')]['MailAccountId']=_0xce8b24['id'];return db['Disposition'][_0x0a45('0x63')](_0x4d2a2f[_0x0a45('0x60')]);}})['then'](respondWithResult(_0x235ae9,null))[_0x0a45('0x2b')](handleError(_0x235ae9,null));};exports[_0x0a45('0x64')]=function(_0x42d853,_0x483f13,_0x3a4a85){var _0x29b1da={'raw':![],'where':{}};var _0x28813f={};var _0x5c287c={'count':0x0,'rows':[]};return db[_0x0a45('0x44')]['findOne']({'where':{'id':_0x42d853[_0x0a45('0x61')]['id']}})[_0x0a45('0x22')](handleEntityNotFound(_0x483f13,null))[_0x0a45('0x22')](function(_0x44f958){if(_0x44f958){_0x28813f[_0x0a45('0x47')]=_[_0x0a45('0x49')](db[_0x0a45('0x65')][_0x0a45('0x45')]);_0x28813f['query']=_[_0x0a45('0x49')](_0x42d853['query']);_0x28813f[_0x0a45('0x4a')]=_[_0x0a45('0x4b')](_0x28813f['model'],_0x28813f[_0x0a45('0x48')]);_0x29b1da[_0x0a45('0x4c')]=_[_0x0a45('0x4b')](_0x28813f[_0x0a45('0x47')],qs[_0x0a45('0x4d')](_0x42d853['query'][_0x0a45('0x4d')]));_0x29b1da[_0x0a45('0x4c')]=_0x29b1da['attributes'][_0x0a45('0x5d')]?_0x29b1da[_0x0a45('0x4c')]:_0x28813f[_0x0a45('0x47')];if(!_0x42d853[_0x0a45('0x48')]['hasOwnProperty']('nolimit')){_0x29b1da[_0x0a45('0x33')]=qs[_0x0a45('0x33')](_0x42d853[_0x0a45('0x48')]['limit']);_0x29b1da['offset']=qs[_0x0a45('0x30')](_0x42d853[_0x0a45('0x48')][_0x0a45('0x30')]);}_0x29b1da[_0x0a45('0x66')]=qs[_0x0a45('0x50')](_0x42d853[_0x0a45('0x48')][_0x0a45('0x50')]);_0x29b1da['where']=qs[_0x0a45('0x4a')](_[_0x0a45('0x52')](_0x42d853[_0x0a45('0x48')],_0x28813f[_0x0a45('0x4a')]));_0x29b1da['where'][_0x0a45('0x67')]=_0x44f958['id'];if(_0x42d853['query']['filter']){_0x29b1da[_0x0a45('0x51')]=_[_0x0a45('0x54')](_0x29b1da[_0x0a45('0x51')],{'$or':_[_0x0a45('0x43')](_0x29b1da[_0x0a45('0x4c')],function(_0x1295f7){var _0x5acc0f={};_0x5acc0f[_0x1295f7]={'$like':'%'+_0x42d853[_0x0a45('0x48')][_0x0a45('0x53')]+'%'};return _0x5acc0f;})});}_0x29b1da=_[_0x0a45('0x54')]({},_0x29b1da,_0x42d853[_0x0a45('0x56')]);return db[_0x0a45('0x65')][_0x0a45('0x32')]({'where':_0x29b1da['where']})[_0x0a45('0x22')](function(_0x458513){_0x5c287c[_0x0a45('0x32')]=_0x458513;if(_0x42d853[_0x0a45('0x48')][_0x0a45('0x57')]){_0x29b1da[_0x0a45('0x58')]=[{'all':!![]}];}return db[_0x0a45('0x65')][_0x0a45('0x59')](_0x29b1da);})['then'](function(_0x4ef7ab){_0x5c287c[_0x0a45('0x68')]=_0x4ef7ab;return _0x5c287c;});}})[_0x0a45('0x22')](respondWithFilteredResult(_0x483f13,_0x29b1da))[_0x0a45('0x2b')](handleError(_0x483f13,null));};exports[_0x0a45('0x69')]=function(_0x52bad6,_0x48707e,_0x48c15f){return db['MailAccount'][_0x0a45('0x5e')]({'where':{'id':_0x52bad6[_0x0a45('0x61')]['id']}})[_0x0a45('0x22')](handleEntityNotFound(_0x48707e,null))['then'](function(_0x20e301){if(_0x20e301){return _0x20e301['removeDispositions'](_0x52bad6[_0x0a45('0x48')][_0x0a45('0x6a')]);}})['then'](respondWithStatusCode(_0x48707e,null))[_0x0a45('0x2b')](handleError(_0x48707e,null));};exports[_0x0a45('0x6b')]=function(_0x490f11,_0x9c9c29,_0x2955f8){if(_0x490f11[_0x0a45('0x60')]['id']){delete _0x490f11[_0x0a45('0x60')]['id'];}return db[_0x0a45('0x44')][_0x0a45('0x5e')]({'where':{'id':_0x490f11[_0x0a45('0x61')]['id']}})['then'](handleEntityNotFound(_0x9c9c29,null))[_0x0a45('0x22')](function(_0x1814c3){if(_0x1814c3){_0x490f11['body'][_0x0a45('0x67')]=_0x1814c3['id'];return db[_0x0a45('0x6c')][_0x0a45('0x63')](_0x490f11[_0x0a45('0x60')]);}})[_0x0a45('0x22')](respondWithResult(_0x9c9c29,null))[_0x0a45('0x2b')](handleError(_0x9c9c29,null));};exports[_0x0a45('0x6d')]=function(_0x2b0d20,_0x4a84a9,_0x40962c){var _0x258774={'raw':![],'where':{}};var _0x24111e={};var _0x10170e={'count':0x0,'rows':[]};return db[_0x0a45('0x44')][_0x0a45('0x6e')]({'where':{'id':_0x2b0d20[_0x0a45('0x61')]['id']}})['then'](handleEntityNotFound(_0x4a84a9,null))[_0x0a45('0x22')](function(_0x7f360a){if(_0x7f360a){_0x24111e[_0x0a45('0x47')]=_[_0x0a45('0x49')](db[_0x0a45('0x6c')]['rawAttributes']);_0x24111e[_0x0a45('0x48')]=_['keys'](_0x2b0d20['query']);_0x24111e[_0x0a45('0x4a')]=_[_0x0a45('0x4b')](_0x24111e[_0x0a45('0x47')],_0x24111e[_0x0a45('0x48')]);_0x258774[_0x0a45('0x4c')]=_[_0x0a45('0x4b')](_0x24111e[_0x0a45('0x47')],qs[_0x0a45('0x4d')](_0x2b0d20['query'][_0x0a45('0x4d')]));_0x258774['attributes']=_0x258774[_0x0a45('0x4c')][_0x0a45('0x5d')]?_0x258774[_0x0a45('0x4c')]:_0x24111e[_0x0a45('0x47')];if(!_0x2b0d20[_0x0a45('0x48')][_0x0a45('0x4e')](_0x0a45('0x4f'))){_0x258774[_0x0a45('0x33')]=qs['limit'](_0x2b0d20[_0x0a45('0x48')][_0x0a45('0x33')]);_0x258774['offset']=qs[_0x0a45('0x30')](_0x2b0d20[_0x0a45('0x48')][_0x0a45('0x30')]);}_0x258774[_0x0a45('0x66')]=qs['sort'](_0x2b0d20['query'][_0x0a45('0x50')]);_0x258774['where']=qs[_0x0a45('0x4a')](_[_0x0a45('0x52')](_0x2b0d20[_0x0a45('0x48')],_0x24111e[_0x0a45('0x4a')]));_0x258774[_0x0a45('0x51')]['MailAccountId']=_0x7f360a['id'];if(_0x2b0d20[_0x0a45('0x48')][_0x0a45('0x53')]){_0x258774[_0x0a45('0x51')]=_[_0x0a45('0x54')](_0x258774[_0x0a45('0x51')],{'$or':_[_0x0a45('0x43')](_0x258774[_0x0a45('0x4c')],function(_0x432966){var _0x34c99c={};_0x34c99c[_0x432966]={'$like':'%'+_0x2b0d20[_0x0a45('0x48')][_0x0a45('0x53')]+'%'};return _0x34c99c;})});}_0x258774=_[_0x0a45('0x54')]({},_0x258774,_0x2b0d20['options']);return db[_0x0a45('0x6c')]['count']({'where':_0x258774[_0x0a45('0x51')]})[_0x0a45('0x22')](function(_0x35da2e){_0x10170e[_0x0a45('0x32')]=_0x35da2e;if(_0x2b0d20['query']['includeAll']){_0x258774[_0x0a45('0x58')]=[{'all':!![]}];}return db[_0x0a45('0x6c')][_0x0a45('0x59')](_0x258774);})[_0x0a45('0x22')](function(_0xa3739){_0x10170e[_0x0a45('0x68')]=_0xa3739;return _0x10170e;});}})[_0x0a45('0x22')](respondWithFilteredResult(_0x4a84a9,_0x258774))[_0x0a45('0x2b')](handleError(_0x4a84a9,null));};exports[_0x0a45('0x6f')]=function(_0x5a0bea,_0x302c26,_0x3afcd5){return db[_0x0a45('0x44')][_0x0a45('0x5e')]({'where':{'id':_0x5a0bea[_0x0a45('0x61')]['id']}})[_0x0a45('0x22')](handleEntityNotFound(_0x302c26,null))[_0x0a45('0x22')](function(_0x552e93){if(_0x552e93){return _0x552e93[_0x0a45('0x6f')](_0x5a0bea[_0x0a45('0x48')][_0x0a45('0x6a')]);}})[_0x0a45('0x22')](respondWithStatusCode(_0x302c26,null))[_0x0a45('0x2b')](handleError(_0x302c26,null));};exports[_0x0a45('0x63')]=function(_0x3ff33c,_0xbc7443){var _0x4e4db0={'name':_0x3ff33c[_0x0a45('0x60')][_0x0a45('0x3c')],'key':_0x3ff33c[_0x0a45('0x60')][_0x0a45('0x70')],'email':_0x3ff33c[_0x0a45('0x60')][_0x0a45('0x71')],'ListId':_0x3ff33c[_0x0a45('0x60')]['ListId'],'active':!_[_0x0a45('0x72')](_0x3ff33c[_0x0a45('0x60')][_0x0a45('0x73')])?_0x3ff33c[_0x0a45('0x60')][_0x0a45('0x73')]:!![],'description':_0x3ff33c[_0x0a45('0x60')][_0x0a45('0x74')]||null,'Imap':{},'Smtp':{}};if(_[_0x0a45('0x72')](_0x3ff33c[_0x0a45('0x60')]['cservice'])){if(_0x3ff33c['body'][_0x0a45('0x75')]){_0x4e4db0['Imap'][_0x0a45('0x76')]=_0x4e4db0[_0x0a45('0x40')][_0x0a45('0x76')]=_0x3ff33c[_0x0a45('0x60')]['cuser'];_0x4e4db0[_0x0a45('0x5c')][_0x0a45('0x77')]=_0x4e4db0['Smtp']['pass']=_0x3ff33c[_0x0a45('0x60')]['cpassword'];}else{_0x4e4db0[_0x0a45('0x5c')][_0x0a45('0x78')]=_0x4e4db0[_0x0a45('0x40')]['authentication']=![];}_0x4e4db0[_0x0a45('0x5c')]['host']=_0x3ff33c[_0x0a45('0x60')]['Imap'][_0x0a45('0x79')];_0x4e4db0[_0x0a45('0x5c')]['port']=_0x3ff33c[_0x0a45('0x60')][_0x0a45('0x5c')][_0x0a45('0x7a')];_0x4e4db0[_0x0a45('0x40')][_0x0a45('0x79')]=_0x3ff33c[_0x0a45('0x60')][_0x0a45('0x40')][_0x0a45('0x79')];_0x4e4db0[_0x0a45('0x40')]['port']=_0x3ff33c[_0x0a45('0x60')]['Smtp'][_0x0a45('0x7a')];}else{_0x4e4db0[_0x0a45('0x5c')][_0x0a45('0x7b')]=_0x4e4db0[_0x0a45('0x40')][_0x0a45('0x7b')]=_0x3ff33c[_0x0a45('0x60')][_0x0a45('0x7c')];_0x4e4db0['Imap'][_0x0a45('0x76')]=_0x4e4db0[_0x0a45('0x40')]['user']=_0x3ff33c['body'][_0x0a45('0x7d')];_0x4e4db0['Imap'][_0x0a45('0x77')]=_0x4e4db0[_0x0a45('0x40')][_0x0a45('0x7e')]=_0x3ff33c[_0x0a45('0x60')][_0x0a45('0x7f')];}return db['MailAccount'][_0x0a45('0x63')](_0x4e4db0,{'include':[{'model':db[_0x0a45('0x3f')],'as':_0x0a45('0x40')},{'model':db[_0x0a45('0x5b')],'as':'Imap'}]})[_0x0a45('0x22')](function(_0x4640af){var _0xd6bd0f=_0x3ff33c[_0x0a45('0x76')][_0x0a45('0x38')]({'plain':!![]});if(!_0xd6bd0f)throw new Error(_0x0a45('0x80'));if(_0xd6bd0f['role']===_0x0a45('0x76')){var _0x2f183c=_0x4640af[_0x0a45('0x38')]({'plain':!![]});return db[_0x0a45('0x81')]['find']({'where':{'name':_0x0a45('0x39'),'userProfileId':_0xd6bd0f['userProfileId']},'raw':!![]})['then'](function(_0x46a651){if(_0x46a651&&_0x46a651[_0x0a45('0x82')]===0x0){return db['UserProfileResource'][_0x0a45('0x63')]({'name':_0x2f183c[_0x0a45('0x3c')],'resourceId':_0x2f183c['id'],'type':_0x46a651[_0x0a45('0x3c')],'sectionId':_0x46a651['id']},{})[_0x0a45('0x22')](function(){return _0x4640af;});}else{return _0x4640af;}})['catch'](function(_0x1dfd22){logger[_0x0a45('0x27')](_0x0a45('0x83'),_0x1dfd22);throw _0x1dfd22;});}return _0x4640af;})['then'](respondWithResult(_0xbc7443,0xc9))[_0x0a45('0x2b')](handleError(_0xbc7443,null));};exports[_0x0a45('0x84')]=function(_0x3bdeb8,_0x14063f,_0x4f1ac6){return db[_0x0a45('0x44')][_0x0a45('0x6e')]({'where':{'id':_0x3bdeb8['params']['id']}})['then'](handleEntityNotFound(_0x14063f,null))['then'](function(_0x291f90){if(_0x291f90){return _0x291f90[_0x0a45('0x84')]();}return null;})[_0x0a45('0x22')](respondWithResult(_0x14063f,null))[_0x0a45('0x2b')](handleError(_0x14063f,null));};exports[_0x0a45('0x85')]=function(_0x5b9376,_0x18069f,_0x3e9eb9){if(_0x5b9376[_0x0a45('0x60')]['id']){delete _0x5b9376['body']['id'];}return db['MailAccount']['find']({'where':{'id':_0x5b9376['params']['id']}})[_0x0a45('0x22')](handleEntityNotFound(_0x18069f,null))[_0x0a45('0x22')](function(_0x84c110){if(_0x84c110){_0x5b9376[_0x0a45('0x60')][_0x0a45('0x67')]=_0x84c110['id'];return db[_0x0a45('0x5b')][_0x0a45('0x63')](_0x5b9376[_0x0a45('0x60')]);}})[_0x0a45('0x22')](respondWithResult(_0x18069f,null))[_0x0a45('0x2b')](handleError(_0x18069f,null));};exports[_0x0a45('0x86')]=function(_0x76d686,_0x1e7778,_0x4303ef){return db[_0x0a45('0x44')][_0x0a45('0x6e')]({'where':{'id':_0x76d686[_0x0a45('0x61')]['id']}})[_0x0a45('0x22')](handleEntityNotFound(_0x1e7778,null))[_0x0a45('0x22')](function(_0x283a42){if(_0x283a42){return _0x283a42[_0x0a45('0x87')](null);}return null;})[_0x0a45('0x22')](respondWithStatusCode(_0x1e7778,null))[_0x0a45('0x2b')](handleError(_0x1e7778,null));};exports[_0x0a45('0x88')]=function(_0x50afa9,_0x5950af,_0x26329a){return db[_0x0a45('0x44')][_0x0a45('0x6e')]({'where':{'id':_0x50afa9[_0x0a45('0x61')]['id']}})[_0x0a45('0x22')](handleEntityNotFound(_0x5950af,null))[_0x0a45('0x22')](function(_0x1e6238){if(_0x1e6238){return _0x1e6238[_0x0a45('0x88')]();}return null;})['then'](respondWithResult(_0x5950af,null))[_0x0a45('0x2b')](handleError(_0x5950af,null));};exports['addSmtp']=function(_0x3456a8,_0x5e9de8,_0x532f8a){if(_0x3456a8[_0x0a45('0x60')]['id']){delete _0x3456a8['body']['id'];}return db[_0x0a45('0x44')][_0x0a45('0x5e')]({'where':{'id':_0x3456a8[_0x0a45('0x61')]['id']}})['then'](handleEntityNotFound(_0x5e9de8,null))[_0x0a45('0x22')](function(_0x4c667e){if(_0x4c667e){_0x3456a8[_0x0a45('0x60')][_0x0a45('0x67')]=_0x4c667e['id'];return db[_0x0a45('0x3f')][_0x0a45('0x63')](_0x3456a8[_0x0a45('0x60')]);}})[_0x0a45('0x22')](respondWithResult(_0x5e9de8,null))[_0x0a45('0x2b')](handleError(_0x5e9de8,null));};exports[_0x0a45('0x89')]=function(_0x49fea0,_0x2afcae,_0xb33147){return db[_0x0a45('0x44')][_0x0a45('0x6e')]({'where':{'id':_0x49fea0[_0x0a45('0x61')]['id']}})[_0x0a45('0x22')](handleEntityNotFound(_0x2afcae,null))[_0x0a45('0x22')](function(_0x5bfaeb){if(_0x5bfaeb){return _0x5bfaeb['setSmtp'](null);}return null;})[_0x0a45('0x22')](respondWithStatusCode(_0x2afcae,null))[_0x0a45('0x2b')](handleError(_0x2afcae,null));};exports['addInteraction']=function(_0x296e22,_0x2a074f,_0x534d6a){return db[_0x0a45('0x8a')][_0x0a45('0x5e')]({'where':{'id':_0x296e22[_0x0a45('0x61')]['id']}})['then'](handleEntityNotFound(_0x2a074f,null))[_0x0a45('0x22')](function(_0x3d2f8e){if(_0x3d2f8e){return _0x3d2f8e[_0x0a45('0x8b')](_0x296e22[_0x0a45('0x60')][_0x0a45('0x6a')],_[_0x0a45('0x8c')](_0x296e22['body'],['ids','id'])||{});}})['then'](respondWithResult(_0x2a074f,null))[_0x0a45('0x2b')](handleError(_0x2a074f,null));};exports[_0x0a45('0x8d')]=function(_0xafb97d,_0x490d4b,_0xd3cc6b){var _0x2ea92b={'raw':![],'where':{}};var _0x50ee20={};var _0x188591={'count':0x0,'rows':[]};return db[_0x0a45('0x44')][_0x0a45('0x6e')]({'where':{'id':_0xafb97d[_0x0a45('0x61')]['id']}})[_0x0a45('0x22')](handleEntityNotFound(_0x490d4b,null))[_0x0a45('0x22')](function(_0x2f1322){if(_0x2f1322){_0x50ee20['model']=_['keys'](db[_0x0a45('0x8a')][_0x0a45('0x45')]);_0x50ee20[_0x0a45('0x48')]=_['keys'](_0xafb97d[_0x0a45('0x48')]);_0x50ee20['filters']=_[_0x0a45('0x4b')](_0x50ee20[_0x0a45('0x47')],_0x50ee20['query']);_0x2ea92b[_0x0a45('0x4c')]=_[_0x0a45('0x4b')](_0x50ee20[_0x0a45('0x47')],qs[_0x0a45('0x4d')](_0xafb97d['query']['fields']));_0x2ea92b[_0x0a45('0x4c')]=_0x2ea92b['attributes'][_0x0a45('0x5d')]?_0x2ea92b[_0x0a45('0x4c')]:_0x50ee20['model'];if(!_0xafb97d[_0x0a45('0x48')][_0x0a45('0x4e')]('nolimit')){_0x2ea92b[_0x0a45('0x33')]=qs[_0x0a45('0x33')](_0xafb97d[_0x0a45('0x48')][_0x0a45('0x33')]);_0x2ea92b[_0x0a45('0x30')]=qs[_0x0a45('0x30')](_0xafb97d[_0x0a45('0x48')][_0x0a45('0x30')]);}_0x2ea92b[_0x0a45('0x66')]=qs[_0x0a45('0x50')](_0xafb97d[_0x0a45('0x48')][_0x0a45('0x50')]);_0x2ea92b[_0x0a45('0x51')]=qs[_0x0a45('0x4a')](_[_0x0a45('0x52')](_0xafb97d['query'],_0x50ee20[_0x0a45('0x4a')]));_0x2ea92b[_0x0a45('0x51')]['MailAccountId']=_0x2f1322['id'];if(_0xafb97d['query'][_0x0a45('0x53')]){_0x2ea92b[_0x0a45('0x51')]=_['merge'](_0x2ea92b[_0x0a45('0x51')],{'$or':_[_0x0a45('0x43')](_0x2ea92b[_0x0a45('0x4c')],function(_0x6fca7d){var _0x3425d5={};_0x3425d5[_0x6fca7d]={'$like':'%'+_0xafb97d['query'][_0x0a45('0x53')]+'%'};return _0x3425d5;})});}_0x2ea92b=_[_0x0a45('0x54')]({},_0x2ea92b,_0xafb97d[_0x0a45('0x56')]);return db[_0x0a45('0x8a')]['count']({'where':_0x2ea92b[_0x0a45('0x51')]})[_0x0a45('0x22')](function(_0x306329){_0x188591[_0x0a45('0x32')]=_0x306329;if(_0xafb97d[_0x0a45('0x48')][_0x0a45('0x57')]){_0x2ea92b['include']=[{'model':db[_0x0a45('0x8e')],'as':_0x0a45('0x8f'),'required':![]},{'model':db['User'],'as':'Owner','attributes':[_0x0a45('0x3c'),_0x0a45('0x90'),_0x0a45('0x91')],'required':![]},{'model':db[_0x0a45('0x92')],'as':_0x0a45('0x93'),'attributes':['id',_0x0a45('0x3c'),_0x0a45('0x94')],'where':_0xafb97d[_0x0a45('0x48')][_0x0a45('0x95')]?{'id':_0xafb97d[_0x0a45('0x48')][_0x0a45('0x95')]}:undefined,'required':_0xafb97d[_0x0a45('0x48')][_0x0a45('0x95')]?!![]:![]}];}return db[_0x0a45('0x8a')]['findAll'](_0x2ea92b);})[_0x0a45('0x22')](function(_0x1f2ce2){_0x188591[_0x0a45('0x68')]=_0x1f2ce2;return _0x188591;});}})[_0x0a45('0x22')](respondWithFilteredResult(_0x490d4b,_0x2ea92b))[_0x0a45('0x2b')](handleError(_0x490d4b,null));};exports[_0x0a45('0x96')]=function(_0x4ab38f,_0x374172,_0x171365){return db['MailAccount'][_0x0a45('0x6e')]({'where':{'id':_0x4ab38f['params']['id']}})[_0x0a45('0x22')](handleEntityNotFound(_0x374172,null))[_0x0a45('0x22')](function(_0xd31283){if(_0xd31283){return db[_0x0a45('0x97')]['transaction'](function(_0x13668e){return db[_0x0a45('0x98')][_0x0a45('0x37')]({'where':{'MailAccountId':_0x4ab38f['params']['id']},'transaction':_0x13668e})[_0x0a45('0x22')](function(_0x3615c2){var _0x5adc38=_[_0x0a45('0x43')](_0x4ab38f[_0x0a45('0x60')],function(_0x3193c3){_0x3193c3[_0x0a45('0x67')]=_0x4ab38f[_0x0a45('0x61')]['id'];return _0x3193c3;});return db[_0x0a45('0x98')][_0x0a45('0x99')](_0x5adc38,{'transaction':_0x13668e});});})[_0x0a45('0x22')](function(){return db[_0x0a45('0x98')][_0x0a45('0x9a')]({'where':{'MailAccountId':_0x4ab38f[_0x0a45('0x61')]['id']},'order':_0x0a45('0x9b')});});}})[_0x0a45('0x22')](respondWithResult(_0x374172,null))[_0x0a45('0x2b')](handleError(_0x374172,null));};exports[_0x0a45('0x9c')]=function(_0x33c023,_0x173d48,_0x411263){var _0x54a007={};var _0x1babbb={};var _0xa36d87;var _0x4df869;return db[_0x0a45('0x44')][_0x0a45('0x6e')]({'where':{'id':_0x33c023[_0x0a45('0x61')]['id']}})[_0x0a45('0x22')](handleEntityNotFound(_0x173d48,null))[_0x0a45('0x22')](function(_0x376dce){if(_0x376dce){_0xa36d87=_0x376dce;_0x1babbb[_0x0a45('0x47')]=_['keys'](db[_0x0a45('0x98')][_0x0a45('0x45')]);_0x1babbb[_0x0a45('0x48')]=_['keys'](_0x33c023[_0x0a45('0x48')]);_0x1babbb[_0x0a45('0x4a')]=_[_0x0a45('0x4b')](_0x1babbb[_0x0a45('0x47')],_0x1babbb[_0x0a45('0x48')]);_0x54a007[_0x0a45('0x4c')]=_[_0x0a45('0x4b')](_0x1babbb[_0x0a45('0x47')],qs[_0x0a45('0x4d')](_0x33c023[_0x0a45('0x48')]['fields']));_0x54a007[_0x0a45('0x4c')]=_0x54a007['attributes'][_0x0a45('0x5d')]?_0x54a007['attributes']:_0x1babbb[_0x0a45('0x47')];_0x54a007[_0x0a45('0x66')]=qs[_0x0a45('0x50')](_0x33c023[_0x0a45('0x48')][_0x0a45('0x50')]);_0x54a007[_0x0a45('0x51')]=qs[_0x0a45('0x4a')](_[_0x0a45('0x52')](_0x33c023['query'],_0x1babbb['filters']));if(_0x33c023['query'][_0x0a45('0x53')]){_0x54a007[_0x0a45('0x51')]=_['merge'](_0x54a007['where'],{'$or':_[_0x0a45('0x43')](_0x54a007[_0x0a45('0x4c')],function(_0x5c2e80){var _0x176333={};_0x176333[_0x5c2e80]={'$like':'%'+_0x33c023[_0x0a45('0x48')][_0x0a45('0x53')]+'%'};return _0x176333;})});}_0x54a007=_[_0x0a45('0x54')]({},_0x54a007,_0x33c023[_0x0a45('0x56')]);return _0xa36d87[_0x0a45('0x9c')](_0x54a007);}})[_0x0a45('0x22')](function(_0x23c9a1){if(_0x23c9a1){_0x4df869=_0x23c9a1[_0x0a45('0x5d')];if(!_0x33c023[_0x0a45('0x48')][_0x0a45('0x4e')](_0x0a45('0x4f'))){_0x54a007[_0x0a45('0x33')]=qs[_0x0a45('0x33')](_0x33c023['query']['limit']);_0x54a007[_0x0a45('0x30')]=qs[_0x0a45('0x30')](_0x33c023['query'][_0x0a45('0x30')]);}return _0xa36d87[_0x0a45('0x9c')](_0x54a007);}})[_0x0a45('0x22')](function(_0x5449f6){if(_0x5449f6){return _0x5449f6?{'count':_0x4df869,'rows':_0x5449f6}:null;}})['then'](respondWithResult(_0x173d48,null))['catch'](handleError(_0x173d48,null));};exports[_0x0a45('0x9d')]=function(_0x364690,_0x4578fb,_0x1818a3){var _0xf0af0f={'raw':!![],'where':{}};var _0x17308e={};var _0x189ce4={'count':0x0,'rows':[]};return db[_0x0a45('0x44')][_0x0a45('0x6e')]({'where':{'id':_0x364690[_0x0a45('0x61')]['id']}})['then'](handleEntityNotFound(_0x4578fb,null))[_0x0a45('0x22')](function(_0x50537e){if(_0x50537e){_0x17308e[_0x0a45('0x47')]=_[_0x0a45('0x49')](db[_0x0a45('0x9e')][_0x0a45('0x45')]);_0x17308e[_0x0a45('0x48')]=_[_0x0a45('0x49')](_0x364690[_0x0a45('0x48')]);_0x17308e['filters']=_[_0x0a45('0x4b')](_0x17308e[_0x0a45('0x47')],_0x17308e[_0x0a45('0x48')]);_0xf0af0f[_0x0a45('0x4c')]=_[_0x0a45('0x4b')](_0x17308e[_0x0a45('0x47')],qs[_0x0a45('0x4d')](_0x364690[_0x0a45('0x48')]['fields']));_0xf0af0f[_0x0a45('0x4c')]=_0xf0af0f[_0x0a45('0x4c')][_0x0a45('0x5d')]?_0xf0af0f[_0x0a45('0x4c')]:_0x17308e[_0x0a45('0x47')];if(!_0x364690[_0x0a45('0x48')]['hasOwnProperty']('nolimit')){_0xf0af0f[_0x0a45('0x33')]=qs['limit'](_0x364690[_0x0a45('0x48')][_0x0a45('0x33')]);_0xf0af0f['offset']=qs[_0x0a45('0x30')](_0x364690[_0x0a45('0x48')][_0x0a45('0x30')]);}_0xf0af0f[_0x0a45('0x66')]=qs['sort'](_0x364690[_0x0a45('0x48')][_0x0a45('0x50')]);_0xf0af0f[_0x0a45('0x51')]=qs[_0x0a45('0x4a')](_[_0x0a45('0x52')](_0x364690[_0x0a45('0x48')],_0x17308e[_0x0a45('0x4a')]));_0xf0af0f[_0x0a45('0x51')][_0x0a45('0x67')]=_0x50537e['id'];if(_0x364690['query'][_0x0a45('0x53')]){_0xf0af0f[_0x0a45('0x51')]=_[_0x0a45('0x54')](_0xf0af0f[_0x0a45('0x51')],{'$or':_[_0x0a45('0x43')](_0xf0af0f['attributes'],function(_0x3d97d7){var _0x33abbc={};_0x33abbc[_0x3d97d7]={'$like':'%'+_0x364690[_0x0a45('0x48')][_0x0a45('0x53')]+'%'};return _0x33abbc;})});}if(_0x364690['query'][_0x0a45('0x9f')]){var _0x15a647=_0x364690[_0x0a45('0x48')][_0x0a45('0x9f')]['split'](',');var _0x1f5c2b={};_0x1f5c2b[_0x15a647[0x0]]={'$gte':moment(_0x15a647[0x1])[_0x0a45('0xa0')]('YYYY-MM-DD\x20HH:mm:ss')};_0xf0af0f[_0x0a45('0x51')]=_['merge'](_0xf0af0f[_0x0a45('0x51')],_0x1f5c2b);}_0xf0af0f=_['merge']({},_0xf0af0f,_0x364690['options']);return db[_0x0a45('0x9e')]['count']({'where':_0xf0af0f['where']})[_0x0a45('0x22')](function(_0x4abb90){_0x189ce4['count']=_0x4abb90;if(_0x364690[_0x0a45('0x48')][_0x0a45('0x57')]){_0xf0af0f[_0x0a45('0x58')]=[{'all':!![]}];}return db[_0x0a45('0x9e')][_0x0a45('0x59')](_0xf0af0f);})[_0x0a45('0x22')](function(_0x22b56e){if(_0x364690['query']['inlineCss']==='true'){for(var _0x50ee8c=0x0;_0x50ee8c<_0x22b56e[_0x0a45('0x5d')];_0x50ee8c++){_0x22b56e[_0x50ee8c][_0x0a45('0x60')]=juice(_0x22b56e[_0x50ee8c][_0x0a45('0x60')]);}}_0x189ce4['rows']=_0x22b56e;return _0x189ce4;});}})[_0x0a45('0x22')](respondWithFilteredResult(_0x4578fb,_0xf0af0f))['catch'](handleError(_0x4578fb,null));};exports[_0x0a45('0x3d')]=function(_0x53176c,_0x192290,_0x223a57){var _0x4a17b7,_0x55a8ae={},_0x1814a0;if(_0x53176c[_0x0a45('0x60')]['to']){_0x1814a0=_0x53176c[_0x0a45('0x60')]['to'][_0x0a45('0xa1')](',')[0x0];}return db[_0x0a45('0x44')][_0x0a45('0x5e')]({'where':{'id':_0x53176c['params']['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db[_0x0a45('0x8e')],'as':_0x0a45('0xa2'),'where':{'email':_0x1814a0},'limit':0x1,'order':[[_0x0a45('0xa3'),_0x0a45('0xa4')]]}]},{'model':db[_0x0a45('0x3f')],'as':'Smtp','raw':!![]}]})[_0x0a45('0x22')](handleEntityNotFound(_0x192290,null))['then'](function(_0x259c18){if(_0x259c18){_0x4a17b7=_0x259c18;if(_0x259c18[_0x0a45('0x40')]){if(_['isNil'](_0x53176c[_0x0a45('0x60')][_0x0a45('0xa5')])){_0x53176c[_0x0a45('0x60')][_0x0a45('0xa5')]=util[_0x0a45('0xa0')](_0x0a45('0xa6'),_0x259c18[_0x0a45('0x3c')],_0x259c18[_0x0a45('0x71')]||_0x259c18[_0x0a45('0x40')][_0x0a45('0x76')]);}if(_0x53176c[_0x0a45('0x60')][_0x0a45('0xa7')]&&_0x53176c[_0x0a45('0x60')][_0x0a45('0xa7')][_0x0a45('0x5d')]){for(var _0x3ca404=0x0;_0x3ca404<_0x53176c[_0x0a45('0x60')]['attachments']['length'];_0x3ca404+=0x1){_0x53176c[_0x0a45('0x60')][_0x0a45('0xa7')][_0x3ca404]={'filename':_0x53176c[_0x0a45('0x60')][_0x0a45('0xa7')][_0x3ca404][_0x0a45('0x3c')],'path':path[_0x0a45('0xa8')](config[_0x0a45('0xa9')],_0x0a45('0xaa'),_0x53176c[_0x0a45('0x60')][_0x0a45('0xa7')][_0x3ca404][_0x0a45('0xab')])};}}var _0x2cfb74={'tls':{'rejectUnauthorized':![]}};if(_[_0x0a45('0x72')](_0x259c18[_0x0a45('0x40')][_0x0a45('0x7b')])){if(_0x259c18[_0x0a45('0x40')][_0x0a45('0x78')]){_0x2cfb74[_0x0a45('0xac')]={'user':_0x259c18['Smtp'][_0x0a45('0x76')],'pass':_0x259c18['Smtp'][_0x0a45('0x7e')]};}_0x2cfb74['host']=_0x259c18[_0x0a45('0x40')][_0x0a45('0x79')];_0x2cfb74['port']=_0x259c18[_0x0a45('0x40')][_0x0a45('0x7a')];_0x2cfb74[_0x0a45('0xad')]=_0x259c18[_0x0a45('0x40')][_0x0a45('0xad')];}else{_0x2cfb74[_0x0a45('0x7b')]=_0x259c18[_0x0a45('0x40')][_0x0a45('0x7b')];_0x2cfb74[_0x0a45('0xac')]={'user':_0x259c18['Smtp']['user'],'pass':_0x259c18[_0x0a45('0x40')][_0x0a45('0x7e')]};}return respondWithRpcPromise(_0x0a45('0xae'),'sendMail',{'account':_0x2cfb74,'message':_0x53176c[_0x0a45('0x60')]});}else{throw new Error(_0x0a45('0xaf'));}}})[_0x0a45('0x22')](function(_0x8f3958){if(_0x8f3958){_0x55a8ae=_0x8f3958;if(_0x4a17b7[_0x0a45('0xb0')]){if(_0x4a17b7[_0x0a45('0xb0')]['Contacts'][_0x0a45('0x5d')]){return _0x4a17b7[_0x0a45('0xb0')][_0x0a45('0xa2')][0x0];}else{return db['CmContact'][_0x0a45('0x63')](_[_0x0a45('0x1d')](_0x53176c['body'],{'firstName':_0x53176c[_0x0a45('0x60')]['to'],'email':_0x53176c['body']['to'],'phone':_0x53176c['body']['to'],'ListId':_0x4a17b7['ListId']}));}}else{throw new Error(_0x0a45('0xaf'));}}})['then'](function(_0x483c15){if(_0x483c15){var _0x1c8230={'UserId':_0x53176c['user']['id'],'ContactId':_0x483c15['id'],'MailAccountId':_0x4a17b7['id'],'inReplyTo':_0x55a8ae['messageId'],'to':_0x53176c['body'][_0x0a45('0xa5')],'cc':_0x53176c[_0x0a45('0x60')]['cc'],'subject':_0x53176c[_0x0a45('0x60')][_0x0a45('0xb1')],'attach':_0x53176c[_0x0a45('0x60')][_0x0a45('0xb2')],'firstMsgDirection':_0x0a45('0xb3'),'lastMsgAt':moment()[_0x0a45('0xa0')](_0x0a45('0xb4')),'lastMsgDirection':_0x0a45('0xb3'),'Messages':[_[_0x0a45('0x54')](_0x53176c[_0x0a45('0x60')],{'messageId':_0x55a8ae['messageId'],'sentAt':moment()[_0x0a45('0xa0')](_0x0a45('0xb4')),'read':!![],'MailAccountId':_0x4a17b7['id'],'UserId':_0x53176c[_0x0a45('0x76')]['id'],'ContactId':_0x483c15['id']})]};if(_0x53176c[_0x0a45('0x60')]['Interaction']){_0x1c8230=_[_0x0a45('0x54')](_0x1c8230,_0x53176c[_0x0a45('0x60')]['Interaction']);}return db['MailInteraction']['create'](_0x1c8230,{'include':[{'model':db[_0x0a45('0x9e')],'as':_0x0a45('0xb5')}]});}})[_0x0a45('0x22')](respondWithResult(_0x192290,null))['catch'](handleError(_0x192290,null));};exports[_0x0a45('0xb6')]=function(_0x333735,_0x3cadfa,_0x41e993){return db[_0x0a45('0x44')][_0x0a45('0x5e')]({'where':{'id':_0x333735['params']['id']},'include':[{'model':db[_0x0a45('0x3f')],'as':_0x0a45('0x40'),'raw':!![]}]})['then'](handleEntityNotFound(_0x3cadfa,null))[_0x0a45('0x22')](function(_0x5e9b6f){if(_0x5e9b6f&&_0x5e9b6f['Smtp']){var _0x3eac6f={'id':_0x5e9b6f['id'],'tls':{'rejectUnauthorized':![]}};if(_0x5e9b6f['Smtp']['service']){_0x3eac6f['service']=_0x5e9b6f[_0x0a45('0x40')]['service'];}else{_0x3eac6f['host']=_0x5e9b6f['Smtp'][_0x0a45('0x79')];_0x3eac6f[_0x0a45('0x7a')]=_0x5e9b6f[_0x0a45('0x40')]['port'];_0x3eac6f['secure']=_0x5e9b6f[_0x0a45('0x40')][_0x0a45('0xad')];}if(_0x5e9b6f['Smtp'][_0x0a45('0x78')]){_0x3eac6f[_0x0a45('0xac')]={'user':_0x5e9b6f['Smtp'][_0x0a45('0x76')],'pass':_0x5e9b6f[_0x0a45('0x40')]['pass']};}return respondWithRpcPromise('VerifySmtp',_0x0a45('0xb6'),{'account':_0x3eac6f});}})[_0x0a45('0x22')](respondWithResult(_0x3cadfa,null))[_0x0a45('0x2b')](handleError(_0x3cadfa,null));};exports[_0x0a45('0x37')]=function(_0x25a1d8,_0x1d2810){return db['MailAccount']['find']({'where':{'id':_0x25a1d8[_0x0a45('0x61')]['id']}})[_0x0a45('0x22')](handleEntityNotFound(_0x1d2810,null))[_0x0a45('0x22')](function(_0x388810){if(_0x388810&&_0x388810[_0x0a45('0x7b')]){throw new db[(_0x0a45('0xb7'))][(_0x0a45('0xb8'))](_0x0a45('0xb9'));}return _0x388810;})['then'](removeEntity(_0x1d2810,null))[_0x0a45('0x2b')](handleError(_0x1d2810,null));};exports['addAgents']=function(_0x3e0667,_0x352442,_0x3b846){return db[_0x0a45('0x44')][_0x0a45('0x5e')]({'where':{'id':_0x3e0667['params']['id']}})[_0x0a45('0x22')](handleEntityNotFound(_0x352442,null))[_0x0a45('0x22')](function(_0x187a3c){if(_0x187a3c){return _0x187a3c[_0x0a45('0xba')](_0x3e0667['body'][_0x0a45('0x6a')],_[_0x0a45('0x8c')](_0x3e0667[_0x0a45('0x60')],[_0x0a45('0x6a'),'id'])||{})[_0x0a45('0xbb')](function(_0x12f56d){for(var _0x56b923=0x0;_0x56b923<_0x3e0667['body'][_0x0a45('0x6a')][_0x0a45('0x5d')];_0x56b923+=0x1){socket[_0x0a45('0xbc')](_0x0a45('0xbd'),{'UserId':Number(_0x3e0667[_0x0a45('0x60')][_0x0a45('0x6a')][_0x56b923]),'MailAccountId':Number(_0x3e0667['params']['id'])});}return _0x12f56d;});}})['then'](respondWithResult(_0x352442,null))[_0x0a45('0x2b')](handleError(_0x352442,null));};exports['removeAgents']=function(_0x9498a1,_0x2ca4f8,_0x431c25){return db['MailAccount'][_0x0a45('0x5e')]({'where':{'id':_0x9498a1['params']['id']}})[_0x0a45('0x22')](handleEntityNotFound(_0x2ca4f8,null))[_0x0a45('0x22')](function(_0x49aec7){if(_0x49aec7){return _0x49aec7[_0x0a45('0xbe')](_0x9498a1[_0x0a45('0x48')][_0x0a45('0x6a')])[_0x0a45('0x22')](function(){if(_[_0x0a45('0xbf')](_0x9498a1[_0x0a45('0x48')][_0x0a45('0x6a')])){for(var _0x4bddb5=0x0;_0x4bddb5<_0x9498a1['query']['ids'][_0x0a45('0x5d')];_0x4bddb5+=0x1){socket[_0x0a45('0xbc')](_0x0a45('0xc0'),{'UserId':Number(_0x9498a1[_0x0a45('0x48')][_0x0a45('0x6a')][_0x4bddb5]),'MailAccountId':Number(_0x9498a1[_0x0a45('0x61')]['id'])});}}else{socket['emit'](_0x0a45('0xc0'),{'UserId':Number(_0x9498a1[_0x0a45('0x48')][_0x0a45('0x6a')]),'MailAccountId':Number(_0x9498a1[_0x0a45('0x61')]['id'])});}});}})[_0x0a45('0x22')](respondWithStatusCode(_0x2ca4f8,null))[_0x0a45('0x2b')](handleError(_0x2ca4f8,null));};exports[_0x0a45('0xc1')]=function(_0x188e00,_0x39f22f,_0x4e7484){var _0x18a1b4={};var _0x3341f6={};var _0x27bd25;var _0x378bed;return db[_0x0a45('0x44')][_0x0a45('0x6e')]({'where':{'id':_0x188e00['params']['id']}})[_0x0a45('0x22')](handleEntityNotFound(_0x39f22f,null))[_0x0a45('0x22')](function(_0x1d58ce){if(_0x1d58ce){_0x27bd25=_0x1d58ce;_0x3341f6[_0x0a45('0x47')]=_[_0x0a45('0x49')](db[_0x0a45('0xc2')][_0x0a45('0x45')]);_0x3341f6[_0x0a45('0x48')]=_[_0x0a45('0x49')](_0x188e00[_0x0a45('0x48')]);_0x3341f6['filters']=_[_0x0a45('0x4b')](_0x3341f6[_0x0a45('0x47')],_0x3341f6[_0x0a45('0x48')]);_0x18a1b4[_0x0a45('0x4c')]=_['intersection'](_0x3341f6['model'],qs[_0x0a45('0x4d')](_0x188e00[_0x0a45('0x48')][_0x0a45('0x4d')]));_0x18a1b4['attributes']=_0x18a1b4[_0x0a45('0x4c')][_0x0a45('0x5d')]?_0x18a1b4[_0x0a45('0x4c')]:_0x3341f6[_0x0a45('0x47')];_0x18a1b4[_0x0a45('0x66')]=qs[_0x0a45('0x50')](_0x188e00[_0x0a45('0x48')]['sort']);_0x18a1b4[_0x0a45('0x51')]=qs[_0x0a45('0x4a')](_[_0x0a45('0x52')](_0x188e00[_0x0a45('0x48')],_0x3341f6['filters']));if(_0x188e00[_0x0a45('0x48')]['filter']){_0x18a1b4[_0x0a45('0x51')]=_[_0x0a45('0x54')](_0x18a1b4['where'],{'$or':_[_0x0a45('0x43')](_0x18a1b4[_0x0a45('0x4c')],function(_0x478288){var _0x1c0a37={};_0x1c0a37[_0x478288]={'$like':'%'+_0x188e00[_0x0a45('0x48')][_0x0a45('0x53')]+'%'};return _0x1c0a37;})});}_0x18a1b4=_[_0x0a45('0x54')]({},_0x18a1b4,_0x188e00['options']);return _0x27bd25['getAgents'](_0x18a1b4);}})[_0x0a45('0x22')](function(_0x572d95){if(_0x572d95){_0x378bed=_0x572d95[_0x0a45('0x5d')];if(!_0x188e00[_0x0a45('0x48')][_0x0a45('0x4e')](_0x0a45('0x4f'))){_0x18a1b4[_0x0a45('0x33')]=qs[_0x0a45('0x33')](_0x188e00[_0x0a45('0x48')]['limit']);_0x18a1b4['offset']=qs[_0x0a45('0x30')](_0x188e00[_0x0a45('0x48')]['offset']);}return _0x27bd25['getAgents'](_0x18a1b4);}})['then'](function(_0x25e04a){if(_0x25e04a){return _0x25e04a?{'count':_0x378bed,'rows':_0x25e04a}:null;}})[_0x0a45('0x22')](respondWithResult(_0x39f22f,null))[_0x0a45('0x2b')](handleError(_0x39f22f,null));}; \ No newline at end of file +var _0x35e2=['ids','CannedAnswer','create','getAnswers','removeAnswers','key','email','ListId','description','isNil','cservice','cauthentication','user','cuser','password','authentication','host','port','service','pass','cpassword','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','MailAccounts','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','removeImap','setImap','getSmtp','addSmtp','setSmtp','addInteraction','MailInteraction','omit','getInteractions','Contact','Owner','fullname','Tag','color','tag','addApplications','sequelize','transaction','MailApplication','findAndCountAll','priority','getApplications','getMessages','MailMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','true','CmList','updatedAt','from','%s\x20<%s>','attachments','join','root','server/files/attachments','basename','auth','secure','SendMail','List','Contacts','CmContact','List\x20not\x20found','subject','attach','out','messageId','Interaction','Messages','verifySmtp','VerifySmtp','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','emit','userMailAccount:save','removeAgents','isArray','userMailAccount:remove','getAgents','User','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','fs-extra','lodash','crypto','jsforce','desk.js','querystring','html-to-text','ioredis','../../components/parsers/qs','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','redis','socket.io-emitter','./mailAccount.socket','register','jayson/promise','client','http','request','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','destroy','stack','name','index','MailServerIn','Smtp','map','MailAccount','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','Imap','MailServerOut','Pause','mandatoryDispositionPause','find','body','describe','addDisposition','MailAccountId','Disposition','getDispositions','findOne','hasOwnProperty','order','removeDispositions'];(function(_0x1fc122,_0x5e2c17){var _0xa2cb13=function(_0x263b13){while(--_0x263b13){_0x1fc122['push'](_0x1fc122['shift']());}};_0xa2cb13(++_0x5e2c17);}(_0x35e2,0x122));var _0x235e=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0x35e2[_0x1035c1];return _0x308d67;};'use strict';var emlformat=require(_0x235e('0x0'));var rimraf=require(_0x235e('0x1'));var zipdir=require(_0x235e('0x2'));var jsonpatch=require(_0x235e('0x3'));var rp=require(_0x235e('0x4'));var moment=require(_0x235e('0x5'));var BPromise=require(_0x235e('0x6'));var Mustache=require(_0x235e('0x7'));var util=require(_0x235e('0x8'));var path=require(_0x235e('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x235e('0xa'));var _=require(_0x235e('0xb'));var squel=require('squel');var crypto=require(_0x235e('0xc'));var jsforce=require(_0x235e('0xd'));var deskjs=require(_0x235e('0xe'));var toCsv=require('to-csv');var querystring=require(_0x235e('0xf'));var Papa=require('papaparse');var htmlToText=require(_0x235e('0x10'));var juice=require('juice');var Redis=require(_0x235e('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x235e('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x235e('0x13'))('api');var utils=require('../../config/utils');var config=require(_0x235e('0x14'));var licenseUtil=require(_0x235e('0x15'));var db=require(_0x235e('0x16'))['db'];config[_0x235e('0x17')]=_['defaults'](config[_0x235e('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0x235e('0x18'))(new Redis(config['redis']));require(_0x235e('0x19'))[_0x235e('0x1a')](socket);var jayson=require(_0x235e('0x1b'));var client=jayson[_0x235e('0x1c')][_0x235e('0x1d')]({'port':0x232b});function respondWithRpcPromise(_0x34327f,_0x5e7deb,_0x46e490,_0x36dbdf){return new BPromise(function(_0x2fd124,_0x25c404){var _0x1fc692=_0x36dbdf||client;return _0x1fc692[_0x235e('0x1e')](_0x34327f,_0x46e490)[_0x235e('0x1f')](function(_0x21c912){logger[_0x235e('0x20')](_0x235e('0x21'),_0x5e7deb,_0x235e('0x22'));logger[_0x235e('0x23')](_0x235e('0x24'),_0x5e7deb,_0x235e('0x22'),JSON[_0x235e('0x25')](_0x21c912));if(_0x21c912['error']){if(_0x21c912['error'][_0x235e('0x26')]===0x1f4){logger[_0x235e('0x27')](_0x235e('0x21'),_0x5e7deb,_0x21c912[_0x235e('0x27')]['message']);return _0x25c404(_0x21c912[_0x235e('0x27')]['message']);}logger[_0x235e('0x27')](_0x235e('0x21'),_0x5e7deb,_0x21c912[_0x235e('0x27')][_0x235e('0x28')]);return _0x2fd124(_0x21c912[_0x235e('0x27')]['message']);}else{logger[_0x235e('0x20')](_0x235e('0x21'),_0x5e7deb,'request\x20sent');_0x2fd124(_0x21c912[_0x235e('0x29')]['message']);}})[_0x235e('0x2a')](function(_0x412cfc){logger[_0x235e('0x27')](_0x235e('0x21'),_0x5e7deb,_0x412cfc);_0x25c404(_0x412cfc);});});}function respondWithStatusCode(_0x5b8ee4,_0x5cca54){_0x5cca54=_0x5cca54||0xcc;return function(_0x3a638b){if(_0x3a638b){return _0x5b8ee4[_0x235e('0x2b')](_0x5cca54);}return _0x5b8ee4['status'](_0x5cca54)[_0x235e('0x2c')]();};}function respondWithResult(_0x5c74ca,_0x37ea03){_0x37ea03=_0x37ea03||0xc8;return function(_0x1751a5){if(_0x1751a5){return _0x5c74ca[_0x235e('0x2d')](_0x37ea03)[_0x235e('0x2e')](_0x1751a5);}};}function respondWithFilteredResult(_0x568713,_0x4c0b67){return function(_0x315d74){if(_0x315d74){var _0x5c45f6=typeof _0x4c0b67[_0x235e('0x2f')]===_0x235e('0x30')&&typeof _0x4c0b67[_0x235e('0x31')]===_0x235e('0x30');var _0x1bbafe=_0x315d74[_0x235e('0x32')];var _0x26f5a5=_0x5c45f6?0x0:_0x4c0b67[_0x235e('0x2f')];var _0x3003e1=_0x5c45f6?_0x315d74[_0x235e('0x32')]:_0x4c0b67[_0x235e('0x2f')]+_0x4c0b67[_0x235e('0x31')];var _0x1617d0;if(_0x3003e1>=_0x1bbafe){_0x3003e1=_0x1bbafe;_0x1617d0=0xc8;}else{_0x1617d0=0xce;}_0x568713['status'](_0x1617d0);return _0x568713[_0x235e('0x33')](_0x235e('0x34'),_0x26f5a5+'-'+_0x3003e1+'/'+_0x1bbafe)[_0x235e('0x2e')](_0x315d74);}return null;};}function patchUpdates(_0x25533f){return function(_0x5c14fa){try{jsonpatch['apply'](_0x5c14fa,_0x25533f,!![]);}catch(_0x21c20b){return BPromise[_0x235e('0x35')](_0x21c20b);}return _0x5c14fa[_0x235e('0x36')]();};}function saveUpdates(_0x409d53,_0x147e11){return function(_0xadccc7){if(_0xadccc7){return _0xadccc7[_0x235e('0x37')](_0x409d53)[_0x235e('0x1f')](function(_0x13f062){return _0x13f062;});}return null;};}function removeEntity(_0x5c7693,_0x48401d){return function(_0x5e123a){if(_0x5e123a){return _0x5e123a[_0x235e('0x38')]()['then'](function(){var _0x22c0d1=_0x5e123a['get']({'plain':!![]});var _0xd35541='MailAccounts';return db['UserProfileResource'][_0x235e('0x38')]({'where':{'type':_0xd35541,'resourceId':_0x22c0d1['id']}})[_0x235e('0x1f')](function(){return _0x5e123a;});})[_0x235e('0x1f')](function(){_0x5c7693[_0x235e('0x2d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x961d4a,_0x58537c){return function(_0x981a13){if(!_0x981a13){_0x961d4a['sendStatus'](0x194);}return _0x981a13;};}function handleError(_0x1aa9ba,_0x3b6228){_0x3b6228=_0x3b6228||0x1f4;return function(_0x5d34b2){logger[_0x235e('0x27')](_0x5d34b2[_0x235e('0x39')]);if(_0x5d34b2[_0x235e('0x3a')]){delete _0x5d34b2[_0x235e('0x3a')];}_0x1aa9ba['status'](_0x3b6228)['send'](_0x5d34b2);};}exports[_0x235e('0x3b')]=function(_0x372e84,_0x20fdbc){var _0x2c98e6={'include':[{'model':db[_0x235e('0x3c')],'as':'Imap'},{'model':db['MailServerOut'],'as':_0x235e('0x3d')},{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x343b82={},_0x5a90aa={'count':0x0,'rows':[]};var _0x5b0925=_[_0x235e('0x3e')](db[_0x235e('0x3f')][_0x235e('0x40')],function(_0x5c05dd){return{'name':_0x5c05dd[_0x235e('0x41')],'type':_0x5c05dd[_0x235e('0x42')]['key']};});_0x343b82[_0x235e('0x43')]=_[_0x235e('0x3e')](_0x5b0925,_0x235e('0x3a'));_0x343b82[_0x235e('0x44')]=_[_0x235e('0x45')](_0x372e84[_0x235e('0x44')]);_0x343b82[_0x235e('0x46')]=_[_0x235e('0x47')](_0x343b82[_0x235e('0x43')],_0x343b82['query']);_0x2c98e6[_0x235e('0x48')]=_['intersection'](_0x343b82[_0x235e('0x43')],qs['fields'](_0x372e84['query'][_0x235e('0x49')]));_0x2c98e6[_0x235e('0x48')]=_0x2c98e6[_0x235e('0x48')][_0x235e('0x4a')]?_0x2c98e6['attributes']:_0x343b82[_0x235e('0x43')];if(!_0x372e84[_0x235e('0x44')]['hasOwnProperty'](_0x235e('0x4b'))){_0x2c98e6[_0x235e('0x31')]=qs['limit'](_0x372e84[_0x235e('0x44')]['limit']);_0x2c98e6[_0x235e('0x2f')]=qs['offset'](_0x372e84['query']['offset']);}_0x2c98e6['order']=qs[_0x235e('0x4c')](_0x372e84[_0x235e('0x44')]['sort']);_0x2c98e6[_0x235e('0x4d')]=qs[_0x235e('0x46')](_[_0x235e('0x4e')](_0x372e84['query'],_0x343b82['filters']),_0x5b0925);if(_0x372e84[_0x235e('0x44')][_0x235e('0x4f')]){_0x2c98e6[_0x235e('0x4d')]=_[_0x235e('0x50')](_0x2c98e6[_0x235e('0x4d')],{'$or':_[_0x235e('0x3e')](_0x5b0925,function(_0x5440d4){if(_0x5440d4['type']!==_0x235e('0x51')){var _0x108327={};_0x108327[_0x5440d4[_0x235e('0x3a')]]={'$like':'%'+_0x372e84[_0x235e('0x44')][_0x235e('0x4f')]+'%'};return _0x108327;}})});}_0x2c98e6=_[_0x235e('0x50')]({},_0x2c98e6,_0x372e84[_0x235e('0x52')]);var _0x3e9e56={'where':_0x2c98e6[_0x235e('0x4d')]};return db[_0x235e('0x3f')][_0x235e('0x32')](_0x3e9e56)['then'](function(_0x39803b){_0x5a90aa[_0x235e('0x32')]=_0x39803b;if(_0x372e84[_0x235e('0x44')][_0x235e('0x53')]){_0x2c98e6[_0x235e('0x54')]=[{'all':!![]}];}return db[_0x235e('0x3f')][_0x235e('0x55')](_0x2c98e6);})['then'](function(_0x5cdf80){_0x5a90aa[_0x235e('0x56')]=_0x5cdf80;return _0x5a90aa;})['then'](respondWithFilteredResult(_0x20fdbc,_0x2c98e6))[_0x235e('0x2a')](handleError(_0x20fdbc,null));};exports[_0x235e('0x57')]=function(_0x1f82a6,_0x2dff67){var _0x11ed26={'raw':![],'where':{'id':_0x1f82a6[_0x235e('0x58')]['id']},'include':[{'model':db[_0x235e('0x3c')],'as':_0x235e('0x59')},{'model':db[_0x235e('0x5a')],'as':_0x235e('0x3d')},{'model':db[_0x235e('0x5b')],'as':_0x235e('0x5c')}]},_0x52cb23={};_0x52cb23[_0x235e('0x43')]=_[_0x235e('0x45')](db[_0x235e('0x3f')][_0x235e('0x40')]);_0x52cb23[_0x235e('0x44')]=_[_0x235e('0x45')](_0x1f82a6[_0x235e('0x44')]);_0x52cb23[_0x235e('0x46')]=_['intersection'](_0x52cb23['model'],_0x52cb23[_0x235e('0x44')]);_0x11ed26[_0x235e('0x48')]=_[_0x235e('0x47')](_0x52cb23[_0x235e('0x43')],qs[_0x235e('0x49')](_0x1f82a6['query'][_0x235e('0x49')]));_0x11ed26[_0x235e('0x48')]=_0x11ed26[_0x235e('0x48')]['length']?_0x11ed26[_0x235e('0x48')]:_0x52cb23[_0x235e('0x43')];if(_0x1f82a6[_0x235e('0x44')][_0x235e('0x53')]){_0x11ed26[_0x235e('0x54')]=[{'all':!![]}];}_0x11ed26=_[_0x235e('0x50')]({},_0x11ed26,_0x1f82a6[_0x235e('0x52')]);return db[_0x235e('0x3f')][_0x235e('0x5d')](_0x11ed26)['then'](handleEntityNotFound(_0x2dff67,null))[_0x235e('0x1f')](respondWithResult(_0x2dff67,null))[_0x235e('0x2a')](handleError(_0x2dff67,null));};exports[_0x235e('0x37')]=function(_0x1adcd6,_0x2fec51){if(_0x1adcd6[_0x235e('0x5e')]['id']){delete _0x1adcd6[_0x235e('0x5e')]['id'];}return db[_0x235e('0x3f')]['find']({'where':{'id':_0x1adcd6['params']['id']},'include':[{'model':db[_0x235e('0x3c')],'as':'Imap'},{'model':db[_0x235e('0x5a')],'as':_0x235e('0x3d')},{'model':db[_0x235e('0x5b')],'as':_0x235e('0x5c')}]})[_0x235e('0x1f')](handleEntityNotFound(_0x2fec51,null))[_0x235e('0x1f')](saveUpdates(_0x1adcd6['body'],null))['then'](function(_0x3d5f6b){if(_0x3d5f6b&&_0x1adcd6[_0x235e('0x5e')]['Imap']){return db[_0x235e('0x3c')][_0x235e('0x37')](_0x1adcd6[_0x235e('0x5e')][_0x235e('0x59')],{'where':{'MailAccountId':_0x3d5f6b['id']}})[_0x235e('0x1f')](function(){return _0x3d5f6b;});}return _0x3d5f6b;})[_0x235e('0x1f')](function(_0xd30dc2){if(_0xd30dc2&&_0x1adcd6[_0x235e('0x5e')][_0x235e('0x3d')]){return db[_0x235e('0x5a')]['update'](_0x1adcd6[_0x235e('0x5e')][_0x235e('0x3d')],{'where':{'MailAccountId':_0xd30dc2['id']}})[_0x235e('0x1f')](function(){return _0xd30dc2;});}return _0xd30dc2;})['then'](respondWithResult(_0x2fec51,null))['catch'](handleError(_0x2fec51,null));};exports[_0x235e('0x5f')]=function(_0x3dd019,_0xf9c864){return db['MailAccount'][_0x235e('0x5f')]()[_0x235e('0x1f')](respondWithResult(_0xf9c864,null))[_0x235e('0x2a')](handleError(_0xf9c864,null));};exports[_0x235e('0x60')]=function(_0x46cb0d,_0x157362,_0xda96da){if(_0x46cb0d[_0x235e('0x5e')]['id']){delete _0x46cb0d['body']['id'];}return db[_0x235e('0x3f')][_0x235e('0x5d')]({'where':{'id':_0x46cb0d[_0x235e('0x58')]['id']}})[_0x235e('0x1f')](handleEntityNotFound(_0x157362,null))[_0x235e('0x1f')](function(_0x4f9e51){if(_0x4f9e51){_0x46cb0d[_0x235e('0x5e')][_0x235e('0x61')]=_0x4f9e51['id'];return db[_0x235e('0x62')]['create'](_0x46cb0d[_0x235e('0x5e')]);}})[_0x235e('0x1f')](respondWithResult(_0x157362,null))[_0x235e('0x2a')](handleError(_0x157362,null));};exports[_0x235e('0x63')]=function(_0x59654d,_0x192c9d,_0x422c73){var _0x992578={'raw':![],'where':{}};var _0x4a3ef5={};var _0x3ee7d7={'count':0x0,'rows':[]};return db['MailAccount'][_0x235e('0x64')]({'where':{'id':_0x59654d['params']['id']}})[_0x235e('0x1f')](handleEntityNotFound(_0x192c9d,null))[_0x235e('0x1f')](function(_0x405569){if(_0x405569){_0x4a3ef5[_0x235e('0x43')]=_[_0x235e('0x45')](db[_0x235e('0x62')]['rawAttributes']);_0x4a3ef5[_0x235e('0x44')]=_[_0x235e('0x45')](_0x59654d[_0x235e('0x44')]);_0x4a3ef5['filters']=_[_0x235e('0x47')](_0x4a3ef5['model'],_0x4a3ef5[_0x235e('0x44')]);_0x992578[_0x235e('0x48')]=_[_0x235e('0x47')](_0x4a3ef5[_0x235e('0x43')],qs[_0x235e('0x49')](_0x59654d[_0x235e('0x44')][_0x235e('0x49')]));_0x992578[_0x235e('0x48')]=_0x992578['attributes'][_0x235e('0x4a')]?_0x992578[_0x235e('0x48')]:_0x4a3ef5[_0x235e('0x43')];if(!_0x59654d[_0x235e('0x44')][_0x235e('0x65')](_0x235e('0x4b'))){_0x992578['limit']=qs[_0x235e('0x31')](_0x59654d[_0x235e('0x44')][_0x235e('0x31')]);_0x992578[_0x235e('0x2f')]=qs[_0x235e('0x2f')](_0x59654d['query'][_0x235e('0x2f')]);}_0x992578[_0x235e('0x66')]=qs[_0x235e('0x4c')](_0x59654d['query'][_0x235e('0x4c')]);_0x992578[_0x235e('0x4d')]=qs['filters'](_[_0x235e('0x4e')](_0x59654d[_0x235e('0x44')],_0x4a3ef5[_0x235e('0x46')]));_0x992578[_0x235e('0x4d')]['MailAccountId']=_0x405569['id'];if(_0x59654d[_0x235e('0x44')][_0x235e('0x4f')]){_0x992578['where']=_[_0x235e('0x50')](_0x992578['where'],{'$or':_[_0x235e('0x3e')](_0x992578['attributes'],function(_0x4f8383){var _0x50b4e2={};_0x50b4e2[_0x4f8383]={'$like':'%'+_0x59654d[_0x235e('0x44')][_0x235e('0x4f')]+'%'};return _0x50b4e2;})});}_0x992578=_[_0x235e('0x50')]({},_0x992578,_0x59654d['options']);return db[_0x235e('0x62')]['count']({'where':_0x992578[_0x235e('0x4d')]})[_0x235e('0x1f')](function(_0x173b17){_0x3ee7d7[_0x235e('0x32')]=_0x173b17;if(_0x59654d['query']['includeAll']){_0x992578[_0x235e('0x54')]=[{'all':!![]}];}return db[_0x235e('0x62')][_0x235e('0x55')](_0x992578);})[_0x235e('0x1f')](function(_0x27a80b){_0x3ee7d7[_0x235e('0x56')]=_0x27a80b;return _0x3ee7d7;});}})['then'](respondWithFilteredResult(_0x192c9d,_0x992578))[_0x235e('0x2a')](handleError(_0x192c9d,null));};exports[_0x235e('0x67')]=function(_0x34c4db,_0x16a5e7,_0x3bc9c4){return db[_0x235e('0x3f')][_0x235e('0x5d')]({'where':{'id':_0x34c4db[_0x235e('0x58')]['id']}})[_0x235e('0x1f')](handleEntityNotFound(_0x16a5e7,null))[_0x235e('0x1f')](function(_0x586f2d){if(_0x586f2d){return _0x586f2d[_0x235e('0x67')](_0x34c4db[_0x235e('0x44')][_0x235e('0x68')]);}})[_0x235e('0x1f')](respondWithStatusCode(_0x16a5e7,null))['catch'](handleError(_0x16a5e7,null));};exports['addAnswer']=function(_0x1ffae0,_0x4e1fd7,_0x32bd16){if(_0x1ffae0[_0x235e('0x5e')]['id']){delete _0x1ffae0['body']['id'];}return db['MailAccount'][_0x235e('0x5d')]({'where':{'id':_0x1ffae0[_0x235e('0x58')]['id']}})['then'](handleEntityNotFound(_0x4e1fd7,null))[_0x235e('0x1f')](function(_0x20834d){if(_0x20834d){_0x1ffae0[_0x235e('0x5e')][_0x235e('0x61')]=_0x20834d['id'];return db[_0x235e('0x69')][_0x235e('0x6a')](_0x1ffae0[_0x235e('0x5e')]);}})[_0x235e('0x1f')](respondWithResult(_0x4e1fd7,null))[_0x235e('0x2a')](handleError(_0x4e1fd7,null));};exports[_0x235e('0x6b')]=function(_0x51f21b,_0x1529a6,_0x3aa04d){var _0x181fc8={'raw':![],'where':{}};var _0x264fdf={};var _0x9116c4={'count':0x0,'rows':[]};return db['MailAccount'][_0x235e('0x64')]({'where':{'id':_0x51f21b[_0x235e('0x58')]['id']}})[_0x235e('0x1f')](handleEntityNotFound(_0x1529a6,null))[_0x235e('0x1f')](function(_0x36ab43){if(_0x36ab43){_0x264fdf[_0x235e('0x43')]=_['keys'](db[_0x235e('0x69')][_0x235e('0x40')]);_0x264fdf[_0x235e('0x44')]=_[_0x235e('0x45')](_0x51f21b[_0x235e('0x44')]);_0x264fdf['filters']=_[_0x235e('0x47')](_0x264fdf[_0x235e('0x43')],_0x264fdf[_0x235e('0x44')]);_0x181fc8[_0x235e('0x48')]=_[_0x235e('0x47')](_0x264fdf[_0x235e('0x43')],qs[_0x235e('0x49')](_0x51f21b[_0x235e('0x44')][_0x235e('0x49')]));_0x181fc8[_0x235e('0x48')]=_0x181fc8[_0x235e('0x48')][_0x235e('0x4a')]?_0x181fc8[_0x235e('0x48')]:_0x264fdf[_0x235e('0x43')];if(!_0x51f21b['query'][_0x235e('0x65')](_0x235e('0x4b'))){_0x181fc8[_0x235e('0x31')]=qs[_0x235e('0x31')](_0x51f21b[_0x235e('0x44')]['limit']);_0x181fc8[_0x235e('0x2f')]=qs[_0x235e('0x2f')](_0x51f21b[_0x235e('0x44')][_0x235e('0x2f')]);}_0x181fc8['order']=qs['sort'](_0x51f21b[_0x235e('0x44')][_0x235e('0x4c')]);_0x181fc8[_0x235e('0x4d')]=qs['filters'](_[_0x235e('0x4e')](_0x51f21b[_0x235e('0x44')],_0x264fdf[_0x235e('0x46')]));_0x181fc8[_0x235e('0x4d')]['MailAccountId']=_0x36ab43['id'];if(_0x51f21b[_0x235e('0x44')][_0x235e('0x4f')]){_0x181fc8['where']=_[_0x235e('0x50')](_0x181fc8[_0x235e('0x4d')],{'$or':_[_0x235e('0x3e')](_0x181fc8[_0x235e('0x48')],function(_0x3f3e6f){var _0x3b708d={};_0x3b708d[_0x3f3e6f]={'$like':'%'+_0x51f21b[_0x235e('0x44')]['filter']+'%'};return _0x3b708d;})});}_0x181fc8=_['merge']({},_0x181fc8,_0x51f21b['options']);return db[_0x235e('0x69')][_0x235e('0x32')]({'where':_0x181fc8[_0x235e('0x4d')]})[_0x235e('0x1f')](function(_0x23a68d){_0x9116c4[_0x235e('0x32')]=_0x23a68d;if(_0x51f21b['query'][_0x235e('0x53')]){_0x181fc8[_0x235e('0x54')]=[{'all':!![]}];}return db['CannedAnswer'][_0x235e('0x55')](_0x181fc8);})['then'](function(_0x44593b){_0x9116c4['rows']=_0x44593b;return _0x9116c4;});}})[_0x235e('0x1f')](respondWithFilteredResult(_0x1529a6,_0x181fc8))[_0x235e('0x2a')](handleError(_0x1529a6,null));};exports['removeAnswers']=function(_0x57b623,_0x1146ca,_0x581a68){return db[_0x235e('0x3f')][_0x235e('0x5d')]({'where':{'id':_0x57b623[_0x235e('0x58')]['id']}})[_0x235e('0x1f')](handleEntityNotFound(_0x1146ca,null))['then'](function(_0x1213dc){if(_0x1213dc){return _0x1213dc[_0x235e('0x6c')](_0x57b623[_0x235e('0x44')][_0x235e('0x68')]);}})[_0x235e('0x1f')](respondWithStatusCode(_0x1146ca,null))[_0x235e('0x2a')](handleError(_0x1146ca,null));};exports[_0x235e('0x6a')]=function(_0x34c8e0,_0x3e5c83){var _0x17dc0b={'name':_0x34c8e0[_0x235e('0x5e')]['name'],'key':_0x34c8e0[_0x235e('0x5e')][_0x235e('0x6d')],'email':_0x34c8e0['body'][_0x235e('0x6e')],'ListId':_0x34c8e0[_0x235e('0x5e')][_0x235e('0x6f')],'active':!_['isNil'](_0x34c8e0['body']['active'])?_0x34c8e0[_0x235e('0x5e')]['active']:!![],'description':_0x34c8e0[_0x235e('0x5e')][_0x235e('0x70')]||null,'Imap':{},'Smtp':{}};if(_[_0x235e('0x71')](_0x34c8e0['body'][_0x235e('0x72')])){if(_0x34c8e0[_0x235e('0x5e')][_0x235e('0x73')]){_0x17dc0b[_0x235e('0x59')][_0x235e('0x74')]=_0x17dc0b['Smtp'][_0x235e('0x74')]=_0x34c8e0[_0x235e('0x5e')][_0x235e('0x75')];_0x17dc0b[_0x235e('0x59')][_0x235e('0x76')]=_0x17dc0b[_0x235e('0x3d')]['pass']=_0x34c8e0['body']['cpassword'];}else{_0x17dc0b[_0x235e('0x59')]['authentication']=_0x17dc0b[_0x235e('0x3d')][_0x235e('0x77')]=![];}_0x17dc0b['Imap'][_0x235e('0x78')]=_0x34c8e0[_0x235e('0x5e')]['Imap'][_0x235e('0x78')];_0x17dc0b['Imap']['port']=_0x34c8e0[_0x235e('0x5e')][_0x235e('0x59')][_0x235e('0x79')];_0x17dc0b[_0x235e('0x3d')][_0x235e('0x78')]=_0x34c8e0[_0x235e('0x5e')][_0x235e('0x3d')][_0x235e('0x78')];_0x17dc0b[_0x235e('0x3d')][_0x235e('0x79')]=_0x34c8e0['body']['Smtp'][_0x235e('0x79')];}else{_0x17dc0b[_0x235e('0x59')][_0x235e('0x7a')]=_0x17dc0b[_0x235e('0x3d')][_0x235e('0x7a')]=_0x34c8e0[_0x235e('0x5e')]['cservice'];_0x17dc0b['Imap']['user']=_0x17dc0b[_0x235e('0x3d')][_0x235e('0x74')]=_0x34c8e0[_0x235e('0x5e')][_0x235e('0x75')];_0x17dc0b['Imap'][_0x235e('0x76')]=_0x17dc0b[_0x235e('0x3d')][_0x235e('0x7b')]=_0x34c8e0[_0x235e('0x5e')][_0x235e('0x7c')];}return db[_0x235e('0x3f')]['create'](_0x17dc0b,{'include':[{'model':db[_0x235e('0x5a')],'as':_0x235e('0x3d')},{'model':db[_0x235e('0x3c')],'as':_0x235e('0x59')}]})[_0x235e('0x1f')](function(_0x8c9f82){var _0x4020be=_0x34c8e0['user'][_0x235e('0x7d')]({'plain':!![]});if(!_0x4020be)throw new Error(_0x235e('0x7e'));if(_0x4020be[_0x235e('0x7f')]===_0x235e('0x74')){var _0xa8652e=_0x8c9f82[_0x235e('0x7d')]({'plain':!![]});return db['UserProfileSection']['find']({'where':{'name':_0x235e('0x80'),'userProfileId':_0x4020be[_0x235e('0x81')]},'raw':!![]})[_0x235e('0x1f')](function(_0x7e52bb){if(_0x7e52bb&&_0x7e52bb[_0x235e('0x82')]===0x0){return db[_0x235e('0x83')][_0x235e('0x6a')]({'name':_0xa8652e['name'],'resourceId':_0xa8652e['id'],'type':_0x7e52bb['name'],'sectionId':_0x7e52bb['id']},{})[_0x235e('0x1f')](function(){return _0x8c9f82;});}else{return _0x8c9f82;}})[_0x235e('0x2a')](function(_0x3fca0b){logger['error'](_0x235e('0x84'),_0x3fca0b);throw _0x3fca0b;});}return _0x8c9f82;})['then'](respondWithResult(_0x3e5c83,0xc9))[_0x235e('0x2a')](handleError(_0x3e5c83,null));};exports[_0x235e('0x85')]=function(_0x286295,_0x523bf9,_0x54ecb6){return db[_0x235e('0x3f')]['findOne']({'where':{'id':_0x286295[_0x235e('0x58')]['id']}})[_0x235e('0x1f')](handleEntityNotFound(_0x523bf9,null))[_0x235e('0x1f')](function(_0xd6ce9){if(_0xd6ce9){return _0xd6ce9[_0x235e('0x85')]();}return null;})[_0x235e('0x1f')](respondWithResult(_0x523bf9,null))[_0x235e('0x2a')](handleError(_0x523bf9,null));};exports['addImap']=function(_0x154f75,_0x11cb1b,_0x2ba4ad){if(_0x154f75[_0x235e('0x5e')]['id']){delete _0x154f75[_0x235e('0x5e')]['id'];}return db[_0x235e('0x3f')][_0x235e('0x5d')]({'where':{'id':_0x154f75[_0x235e('0x58')]['id']}})[_0x235e('0x1f')](handleEntityNotFound(_0x11cb1b,null))[_0x235e('0x1f')](function(_0x12745c){if(_0x12745c){_0x154f75[_0x235e('0x5e')][_0x235e('0x61')]=_0x12745c['id'];return db[_0x235e('0x3c')]['create'](_0x154f75[_0x235e('0x5e')]);}})[_0x235e('0x1f')](respondWithResult(_0x11cb1b,null))['catch'](handleError(_0x11cb1b,null));};exports[_0x235e('0x86')]=function(_0x523a40,_0xe2c190,_0x5843d8){return db[_0x235e('0x3f')][_0x235e('0x64')]({'where':{'id':_0x523a40[_0x235e('0x58')]['id']}})[_0x235e('0x1f')](handleEntityNotFound(_0xe2c190,null))[_0x235e('0x1f')](function(_0x54a098){if(_0x54a098){return _0x54a098[_0x235e('0x87')](null);}return null;})[_0x235e('0x1f')](respondWithStatusCode(_0xe2c190,null))[_0x235e('0x2a')](handleError(_0xe2c190,null));};exports[_0x235e('0x88')]=function(_0xef1128,_0x3b01c2,_0x203f8e){return db[_0x235e('0x3f')][_0x235e('0x64')]({'where':{'id':_0xef1128['params']['id']}})[_0x235e('0x1f')](handleEntityNotFound(_0x3b01c2,null))[_0x235e('0x1f')](function(_0x4b50fc){if(_0x4b50fc){return _0x4b50fc[_0x235e('0x88')]();}return null;})['then'](respondWithResult(_0x3b01c2,null))[_0x235e('0x2a')](handleError(_0x3b01c2,null));};exports[_0x235e('0x89')]=function(_0x1692e5,_0x10b812,_0x2c32c5){if(_0x1692e5[_0x235e('0x5e')]['id']){delete _0x1692e5[_0x235e('0x5e')]['id'];}return db[_0x235e('0x3f')][_0x235e('0x5d')]({'where':{'id':_0x1692e5[_0x235e('0x58')]['id']}})['then'](handleEntityNotFound(_0x10b812,null))['then'](function(_0x162757){if(_0x162757){_0x1692e5['body']['MailAccountId']=_0x162757['id'];return db[_0x235e('0x5a')][_0x235e('0x6a')](_0x1692e5[_0x235e('0x5e')]);}})['then'](respondWithResult(_0x10b812,null))[_0x235e('0x2a')](handleError(_0x10b812,null));};exports['removeSmtp']=function(_0x1b0914,_0x5e1be7,_0x39aa6f){return db[_0x235e('0x3f')][_0x235e('0x64')]({'where':{'id':_0x1b0914[_0x235e('0x58')]['id']}})[_0x235e('0x1f')](handleEntityNotFound(_0x5e1be7,null))[_0x235e('0x1f')](function(_0x158a28){if(_0x158a28){return _0x158a28[_0x235e('0x8a')](null);}return null;})[_0x235e('0x1f')](respondWithStatusCode(_0x5e1be7,null))['catch'](handleError(_0x5e1be7,null));};exports[_0x235e('0x8b')]=function(_0x5c7b9b,_0x2f6ecb,_0x40fc89){return db[_0x235e('0x8c')][_0x235e('0x5d')]({'where':{'id':_0x5c7b9b[_0x235e('0x58')]['id']}})[_0x235e('0x1f')](handleEntityNotFound(_0x2f6ecb,null))[_0x235e('0x1f')](function(_0x297b84){if(_0x297b84){return _0x297b84[_0x235e('0x8b')](_0x5c7b9b[_0x235e('0x5e')]['ids'],_[_0x235e('0x8d')](_0x5c7b9b[_0x235e('0x5e')],[_0x235e('0x68'),'id'])||{});}})['then'](respondWithResult(_0x2f6ecb,null))[_0x235e('0x2a')](handleError(_0x2f6ecb,null));};exports[_0x235e('0x8e')]=function(_0x17844a,_0x2c2eff,_0x18c7f0){var _0x543a2a={'raw':![],'where':{}};var _0x2e79e6={};var _0x4f2cc6={'count':0x0,'rows':[]};return db[_0x235e('0x3f')]['findOne']({'where':{'id':_0x17844a[_0x235e('0x58')]['id']}})[_0x235e('0x1f')](handleEntityNotFound(_0x2c2eff,null))[_0x235e('0x1f')](function(_0x54e005){if(_0x54e005){_0x2e79e6['model']=_[_0x235e('0x45')](db['MailInteraction'][_0x235e('0x40')]);_0x2e79e6[_0x235e('0x44')]=_[_0x235e('0x45')](_0x17844a[_0x235e('0x44')]);_0x2e79e6['filters']=_[_0x235e('0x47')](_0x2e79e6[_0x235e('0x43')],_0x2e79e6[_0x235e('0x44')]);_0x543a2a[_0x235e('0x48')]=_['intersection'](_0x2e79e6[_0x235e('0x43')],qs[_0x235e('0x49')](_0x17844a[_0x235e('0x44')][_0x235e('0x49')]));_0x543a2a['attributes']=_0x543a2a[_0x235e('0x48')][_0x235e('0x4a')]?_0x543a2a[_0x235e('0x48')]:_0x2e79e6['model'];if(!_0x17844a['query'][_0x235e('0x65')](_0x235e('0x4b'))){_0x543a2a[_0x235e('0x31')]=qs[_0x235e('0x31')](_0x17844a[_0x235e('0x44')][_0x235e('0x31')]);_0x543a2a[_0x235e('0x2f')]=qs[_0x235e('0x2f')](_0x17844a[_0x235e('0x44')][_0x235e('0x2f')]);}_0x543a2a[_0x235e('0x66')]=qs[_0x235e('0x4c')](_0x17844a[_0x235e('0x44')][_0x235e('0x4c')]);_0x543a2a[_0x235e('0x4d')]=qs[_0x235e('0x46')](_['pick'](_0x17844a['query'],_0x2e79e6[_0x235e('0x46')]));_0x543a2a[_0x235e('0x4d')]['MailAccountId']=_0x54e005['id'];if(_0x17844a[_0x235e('0x44')][_0x235e('0x4f')]){_0x543a2a[_0x235e('0x4d')]=_['merge'](_0x543a2a[_0x235e('0x4d')],{'$or':_['map'](_0x543a2a[_0x235e('0x48')],function(_0x4f76e4){var _0x2c1025={};_0x2c1025[_0x4f76e4]={'$like':'%'+_0x17844a[_0x235e('0x44')][_0x235e('0x4f')]+'%'};return _0x2c1025;})});}_0x543a2a=_[_0x235e('0x50')]({},_0x543a2a,_0x17844a[_0x235e('0x52')]);return db[_0x235e('0x8c')][_0x235e('0x32')]({'where':_0x543a2a['where']})['then'](function(_0x370e29){_0x4f2cc6[_0x235e('0x32')]=_0x370e29;if(_0x17844a[_0x235e('0x44')][_0x235e('0x53')]){_0x543a2a[_0x235e('0x54')]=[{'model':db['CmContact'],'as':_0x235e('0x8f'),'required':![]},{'model':db['User'],'as':_0x235e('0x90'),'attributes':[_0x235e('0x3a'),_0x235e('0x91'),'internal'],'required':![]},{'model':db[_0x235e('0x92')],'as':'Tags','attributes':['id',_0x235e('0x3a'),_0x235e('0x93')],'where':_0x17844a['query'][_0x235e('0x94')]?{'id':_0x17844a[_0x235e('0x44')]['tag']}:undefined,'required':_0x17844a[_0x235e('0x44')][_0x235e('0x94')]?!![]:![]}];}return db['MailInteraction'][_0x235e('0x55')](_0x543a2a);})['then'](function(_0x482963){_0x4f2cc6[_0x235e('0x56')]=_0x482963;return _0x4f2cc6;});}})[_0x235e('0x1f')](respondWithFilteredResult(_0x2c2eff,_0x543a2a))[_0x235e('0x2a')](handleError(_0x2c2eff,null));};exports[_0x235e('0x95')]=function(_0x101573,_0x3aded8,_0x4cdc98){return db[_0x235e('0x3f')][_0x235e('0x64')]({'where':{'id':_0x101573[_0x235e('0x58')]['id']}})[_0x235e('0x1f')](handleEntityNotFound(_0x3aded8,null))[_0x235e('0x1f')](function(_0x8367d0){if(_0x8367d0){return db[_0x235e('0x96')][_0x235e('0x97')](function(_0x4361a8){return db['MailApplication'][_0x235e('0x38')]({'where':{'MailAccountId':_0x101573['params']['id']},'transaction':_0x4361a8})['then'](function(_0x80d93e){var _0x10cc04=_['map'](_0x101573['body'],function(_0x55ce62){_0x55ce62[_0x235e('0x61')]=_0x101573['params']['id'];return _0x55ce62;});return db[_0x235e('0x98')]['bulkCreate'](_0x10cc04,{'transaction':_0x4361a8});});})['then'](function(){return db[_0x235e('0x98')][_0x235e('0x99')]({'where':{'MailAccountId':_0x101573[_0x235e('0x58')]['id']},'order':_0x235e('0x9a')});});}})[_0x235e('0x1f')](respondWithResult(_0x3aded8,null))[_0x235e('0x2a')](handleError(_0x3aded8,null));};exports[_0x235e('0x9b')]=function(_0x4f621c,_0x56310c,_0x44c005){var _0x2df9ef={};var _0x139218={};var _0x3da2c8;var _0x3aecdd;return db[_0x235e('0x3f')][_0x235e('0x64')]({'where':{'id':_0x4f621c['params']['id']}})[_0x235e('0x1f')](handleEntityNotFound(_0x56310c,null))['then'](function(_0x3c6c33){if(_0x3c6c33){_0x3da2c8=_0x3c6c33;_0x139218[_0x235e('0x43')]=_[_0x235e('0x45')](db[_0x235e('0x98')]['rawAttributes']);_0x139218[_0x235e('0x44')]=_[_0x235e('0x45')](_0x4f621c['query']);_0x139218[_0x235e('0x46')]=_[_0x235e('0x47')](_0x139218[_0x235e('0x43')],_0x139218[_0x235e('0x44')]);_0x2df9ef[_0x235e('0x48')]=_['intersection'](_0x139218[_0x235e('0x43')],qs[_0x235e('0x49')](_0x4f621c[_0x235e('0x44')]['fields']));_0x2df9ef['attributes']=_0x2df9ef['attributes'][_0x235e('0x4a')]?_0x2df9ef[_0x235e('0x48')]:_0x139218[_0x235e('0x43')];_0x2df9ef[_0x235e('0x66')]=qs['sort'](_0x4f621c[_0x235e('0x44')]['sort']);_0x2df9ef[_0x235e('0x4d')]=qs[_0x235e('0x46')](_[_0x235e('0x4e')](_0x4f621c['query'],_0x139218[_0x235e('0x46')]));if(_0x4f621c[_0x235e('0x44')][_0x235e('0x4f')]){_0x2df9ef['where']=_['merge'](_0x2df9ef['where'],{'$or':_['map'](_0x2df9ef[_0x235e('0x48')],function(_0x5a957c){var _0x4c4a47={};_0x4c4a47[_0x5a957c]={'$like':'%'+_0x4f621c[_0x235e('0x44')][_0x235e('0x4f')]+'%'};return _0x4c4a47;})});}_0x2df9ef=_['merge']({},_0x2df9ef,_0x4f621c[_0x235e('0x52')]);return _0x3da2c8[_0x235e('0x9b')](_0x2df9ef);}})['then'](function(_0x51e6d9){if(_0x51e6d9){_0x3aecdd=_0x51e6d9[_0x235e('0x4a')];if(!_0x4f621c[_0x235e('0x44')][_0x235e('0x65')](_0x235e('0x4b'))){_0x2df9ef[_0x235e('0x31')]=qs[_0x235e('0x31')](_0x4f621c[_0x235e('0x44')][_0x235e('0x31')]);_0x2df9ef[_0x235e('0x2f')]=qs[_0x235e('0x2f')](_0x4f621c[_0x235e('0x44')][_0x235e('0x2f')]);}return _0x3da2c8[_0x235e('0x9b')](_0x2df9ef);}})[_0x235e('0x1f')](function(_0x1c5fd8){if(_0x1c5fd8){return _0x1c5fd8?{'count':_0x3aecdd,'rows':_0x1c5fd8}:null;}})[_0x235e('0x1f')](respondWithResult(_0x56310c,null))[_0x235e('0x2a')](handleError(_0x56310c,null));};exports[_0x235e('0x9c')]=function(_0x2e2eea,_0x5bea23,_0x5f31c8){var _0x336490={'raw':!![],'where':{}};var _0x1cc24d={};var _0x2b7ad7={'count':0x0,'rows':[]};return db[_0x235e('0x3f')][_0x235e('0x64')]({'where':{'id':_0x2e2eea[_0x235e('0x58')]['id']}})[_0x235e('0x1f')](handleEntityNotFound(_0x5bea23,null))[_0x235e('0x1f')](function(_0x58e7ba){if(_0x58e7ba){_0x1cc24d[_0x235e('0x43')]=_[_0x235e('0x45')](db[_0x235e('0x9d')]['rawAttributes']);_0x1cc24d['query']=_[_0x235e('0x45')](_0x2e2eea[_0x235e('0x44')]);_0x1cc24d['filters']=_[_0x235e('0x47')](_0x1cc24d[_0x235e('0x43')],_0x1cc24d['query']);_0x336490[_0x235e('0x48')]=_[_0x235e('0x47')](_0x1cc24d[_0x235e('0x43')],qs['fields'](_0x2e2eea[_0x235e('0x44')][_0x235e('0x49')]));_0x336490['attributes']=_0x336490[_0x235e('0x48')][_0x235e('0x4a')]?_0x336490[_0x235e('0x48')]:_0x1cc24d[_0x235e('0x43')];if(!_0x2e2eea[_0x235e('0x44')][_0x235e('0x65')](_0x235e('0x4b'))){_0x336490[_0x235e('0x31')]=qs['limit'](_0x2e2eea['query'][_0x235e('0x31')]);_0x336490[_0x235e('0x2f')]=qs['offset'](_0x2e2eea[_0x235e('0x44')][_0x235e('0x2f')]);}_0x336490['order']=qs['sort'](_0x2e2eea[_0x235e('0x44')][_0x235e('0x4c')]);_0x336490[_0x235e('0x4d')]=qs[_0x235e('0x46')](_[_0x235e('0x4e')](_0x2e2eea[_0x235e('0x44')],_0x1cc24d['filters']));_0x336490[_0x235e('0x4d')][_0x235e('0x61')]=_0x58e7ba['id'];if(_0x2e2eea[_0x235e('0x44')]['filter']){_0x336490[_0x235e('0x4d')]=_[_0x235e('0x50')](_0x336490[_0x235e('0x4d')],{'$or':_['map'](_0x336490['attributes'],function(_0x47d7b6){var _0x145491={};_0x145491[_0x47d7b6]={'$like':'%'+_0x2e2eea[_0x235e('0x44')][_0x235e('0x4f')]+'%'};return _0x145491;})});}if(_0x2e2eea[_0x235e('0x44')][_0x235e('0x9e')]){var _0x408fd2=_0x2e2eea['query'][_0x235e('0x9e')][_0x235e('0x9f')](',');var _0x4be3ce={};_0x4be3ce[_0x408fd2[0x0]]={'$gte':moment(_0x408fd2[0x1])[_0x235e('0xa0')](_0x235e('0xa1'))};_0x336490['where']=_[_0x235e('0x50')](_0x336490['where'],_0x4be3ce);}_0x336490=_[_0x235e('0x50')]({},_0x336490,_0x2e2eea[_0x235e('0x52')]);return db[_0x235e('0x9d')][_0x235e('0x32')]({'where':_0x336490[_0x235e('0x4d')]})[_0x235e('0x1f')](function(_0x192e8b){_0x2b7ad7['count']=_0x192e8b;if(_0x2e2eea[_0x235e('0x44')][_0x235e('0x53')]){_0x336490[_0x235e('0x54')]=[{'all':!![]}];}return db[_0x235e('0x9d')][_0x235e('0x55')](_0x336490);})['then'](function(_0x280522){if(_0x2e2eea[_0x235e('0x44')]['inlineCss']===_0x235e('0xa2')){for(var _0x2c7f9c=0x0;_0x2c7f9c<_0x280522['length'];_0x2c7f9c++){_0x280522[_0x2c7f9c]['body']=juice(_0x280522[_0x2c7f9c]['body']);}}_0x2b7ad7['rows']=_0x280522;return _0x2b7ad7;});}})[_0x235e('0x1f')](respondWithFilteredResult(_0x5bea23,_0x336490))[_0x235e('0x2a')](handleError(_0x5bea23,null));};exports['send']=function(_0x3db4de,_0x1f4dbf,_0x5c5758){var _0x1b5e0e,_0x1d7ad5={},_0x470266;if(_0x3db4de[_0x235e('0x5e')]['to']){_0x470266=_0x3db4de['body']['to']['split'](',')[0x0];}return db['MailAccount']['find']({'where':{'id':_0x3db4de['params']['id']},'include':[{'model':db[_0x235e('0xa3')],'as':'List','include':[{'model':db['CmContact'],'as':'Contacts','where':{'email':_0x470266},'limit':0x1,'order':[[_0x235e('0xa4'),'DESC']]}]},{'model':db[_0x235e('0x5a')],'as':_0x235e('0x3d'),'raw':!![]}]})[_0x235e('0x1f')](handleEntityNotFound(_0x1f4dbf,null))['then'](function(_0x2ab4f9){if(_0x2ab4f9){_0x1b5e0e=_0x2ab4f9;if(_0x2ab4f9[_0x235e('0x3d')]){if(_[_0x235e('0x71')](_0x3db4de[_0x235e('0x5e')]['from'])){_0x3db4de[_0x235e('0x5e')][_0x235e('0xa5')]=util[_0x235e('0xa0')](_0x235e('0xa6'),_0x2ab4f9['name'],_0x2ab4f9[_0x235e('0x6e')]||_0x2ab4f9[_0x235e('0x3d')][_0x235e('0x74')]);}if(_0x3db4de[_0x235e('0x5e')][_0x235e('0xa7')]&&_0x3db4de[_0x235e('0x5e')][_0x235e('0xa7')][_0x235e('0x4a')]){for(var _0x2cf56d=0x0;_0x2cf56d<_0x3db4de[_0x235e('0x5e')][_0x235e('0xa7')]['length'];_0x2cf56d+=0x1){_0x3db4de[_0x235e('0x5e')][_0x235e('0xa7')][_0x2cf56d]={'filename':_0x3db4de[_0x235e('0x5e')][_0x235e('0xa7')][_0x2cf56d][_0x235e('0x3a')],'path':path[_0x235e('0xa8')](config[_0x235e('0xa9')],_0x235e('0xaa'),_0x3db4de[_0x235e('0x5e')][_0x235e('0xa7')][_0x2cf56d][_0x235e('0xab')])};}}var _0x15cf7f={'tls':{'rejectUnauthorized':![]}};if(_[_0x235e('0x71')](_0x2ab4f9[_0x235e('0x3d')][_0x235e('0x7a')])){if(_0x2ab4f9[_0x235e('0x3d')]['authentication']){_0x15cf7f[_0x235e('0xac')]={'user':_0x2ab4f9['Smtp'][_0x235e('0x74')],'pass':_0x2ab4f9[_0x235e('0x3d')][_0x235e('0x7b')]};}_0x15cf7f['host']=_0x2ab4f9[_0x235e('0x3d')]['host'];_0x15cf7f['port']=_0x2ab4f9[_0x235e('0x3d')][_0x235e('0x79')];_0x15cf7f[_0x235e('0xad')]=_0x2ab4f9[_0x235e('0x3d')][_0x235e('0xad')];}else{_0x15cf7f[_0x235e('0x7a')]=_0x2ab4f9[_0x235e('0x3d')]['service'];_0x15cf7f[_0x235e('0xac')]={'user':_0x2ab4f9[_0x235e('0x3d')][_0x235e('0x74')],'pass':_0x2ab4f9[_0x235e('0x3d')]['pass']};}return respondWithRpcPromise(_0x235e('0xae'),'sendMail',{'account':_0x15cf7f,'message':_0x3db4de[_0x235e('0x5e')]});}else{throw new Error('List\x20not\x20found');}}})[_0x235e('0x1f')](function(_0x4de3c1){if(_0x4de3c1){_0x1d7ad5=_0x4de3c1;if(_0x1b5e0e['List']){if(_0x1b5e0e[_0x235e('0xaf')][_0x235e('0xb0')][_0x235e('0x4a')]){return _0x1b5e0e[_0x235e('0xaf')][_0x235e('0xb0')][0x0];}else{return db[_0x235e('0xb1')][_0x235e('0x6a')](_['defaults'](_0x3db4de[_0x235e('0x5e')],{'firstName':_0x3db4de[_0x235e('0x5e')]['to'],'email':_0x3db4de[_0x235e('0x5e')]['to'],'phone':_0x3db4de[_0x235e('0x5e')]['to'],'ListId':_0x1b5e0e[_0x235e('0x6f')]}));}}else{throw new Error(_0x235e('0xb2'));}}})['then'](function(_0x5d9e94){if(_0x5d9e94){var _0x42f30c={'UserId':_0x3db4de[_0x235e('0x74')]['id'],'ContactId':_0x5d9e94['id'],'MailAccountId':_0x1b5e0e['id'],'inReplyTo':_0x1d7ad5['messageId'],'to':_0x3db4de['body'][_0x235e('0xa5')],'cc':_0x3db4de[_0x235e('0x5e')]['cc'],'subject':_0x3db4de['body'][_0x235e('0xb3')],'attach':_0x3db4de[_0x235e('0x5e')][_0x235e('0xb4')],'firstMsgDirection':'out','lastMsgAt':moment()[_0x235e('0xa0')](_0x235e('0xa1')),'lastMsgDirection':_0x235e('0xb5'),'Messages':[_[_0x235e('0x50')](_0x3db4de[_0x235e('0x5e')],{'messageId':_0x1d7ad5[_0x235e('0xb6')],'sentAt':moment()[_0x235e('0xa0')](_0x235e('0xa1')),'read':!![],'MailAccountId':_0x1b5e0e['id'],'UserId':_0x3db4de[_0x235e('0x74')]['id'],'ContactId':_0x5d9e94['id']})]};if(_0x3db4de[_0x235e('0x5e')][_0x235e('0xb7')]){_0x42f30c=_[_0x235e('0x50')](_0x42f30c,_0x3db4de[_0x235e('0x5e')][_0x235e('0xb7')]);}return db['MailInteraction'][_0x235e('0x6a')](_0x42f30c,{'include':[{'model':db[_0x235e('0x9d')],'as':_0x235e('0xb8')}]});}})[_0x235e('0x1f')](respondWithResult(_0x1f4dbf,null))[_0x235e('0x2a')](handleError(_0x1f4dbf,null));};exports[_0x235e('0xb9')]=function(_0x56631f,_0xc9bf1,_0x4e00ba){return db[_0x235e('0x3f')]['find']({'where':{'id':_0x56631f[_0x235e('0x58')]['id']},'include':[{'model':db['MailServerOut'],'as':_0x235e('0x3d'),'raw':!![]}]})[_0x235e('0x1f')](handleEntityNotFound(_0xc9bf1,null))[_0x235e('0x1f')](function(_0xea4181){if(_0xea4181&&_0xea4181[_0x235e('0x3d')]){var _0x3161cd={'id':_0xea4181['id'],'tls':{'rejectUnauthorized':![]}};if(_0xea4181[_0x235e('0x3d')]['service']){_0x3161cd['service']=_0xea4181[_0x235e('0x3d')][_0x235e('0x7a')];}else{_0x3161cd[_0x235e('0x78')]=_0xea4181[_0x235e('0x3d')][_0x235e('0x78')];_0x3161cd[_0x235e('0x79')]=_0xea4181[_0x235e('0x3d')][_0x235e('0x79')];_0x3161cd[_0x235e('0xad')]=_0xea4181[_0x235e('0x3d')]['secure'];}if(_0xea4181['Smtp'][_0x235e('0x77')]){_0x3161cd[_0x235e('0xac')]={'user':_0xea4181[_0x235e('0x3d')][_0x235e('0x74')],'pass':_0xea4181[_0x235e('0x3d')][_0x235e('0x7b')]};}return respondWithRpcPromise(_0x235e('0xba'),'verifySmtp',{'account':_0x3161cd});}})[_0x235e('0x1f')](respondWithResult(_0xc9bf1,null))[_0x235e('0x2a')](handleError(_0xc9bf1,null));};exports[_0x235e('0x38')]=function(_0x1a0fc6,_0x37157c){return db['MailAccount'][_0x235e('0x5d')]({'where':{'id':_0x1a0fc6[_0x235e('0x58')]['id']}})[_0x235e('0x1f')](handleEntityNotFound(_0x37157c,null))[_0x235e('0x1f')](function(_0x5ba3e4){if(_0x5ba3e4&&_0x5ba3e4['service']){throw new db['Sequelize'][(_0x235e('0xbb'))](_0x235e('0xbc'));}return _0x5ba3e4;})[_0x235e('0x1f')](removeEntity(_0x37157c,null))[_0x235e('0x2a')](handleError(_0x37157c,null));};exports[_0x235e('0xbd')]=function(_0x4c12d3,_0x577d05,_0x44fca1){return db[_0x235e('0x3f')][_0x235e('0x5d')]({'where':{'id':_0x4c12d3['params']['id']}})['then'](handleEntityNotFound(_0x577d05,null))[_0x235e('0x1f')](function(_0x21855f){if(_0x21855f){return _0x21855f[_0x235e('0xbd')](_0x4c12d3['body'][_0x235e('0x68')],_[_0x235e('0x8d')](_0x4c12d3['body'],['ids','id'])||{})['spread'](function(_0x4d1499){for(var _0x55b0ab=0x0;_0x55b0ab<_0x4c12d3[_0x235e('0x5e')][_0x235e('0x68')][_0x235e('0x4a')];_0x55b0ab+=0x1){socket[_0x235e('0xbe')](_0x235e('0xbf'),{'UserId':Number(_0x4c12d3['body'][_0x235e('0x68')][_0x55b0ab]),'MailAccountId':Number(_0x4c12d3[_0x235e('0x58')]['id'])});}return _0x4d1499;});}})['then'](respondWithResult(_0x577d05,null))[_0x235e('0x2a')](handleError(_0x577d05,null));};exports[_0x235e('0xc0')]=function(_0x31c4c1,_0x247153,_0x4a0ef8){return db[_0x235e('0x3f')][_0x235e('0x5d')]({'where':{'id':_0x31c4c1['params']['id']}})['then'](handleEntityNotFound(_0x247153,null))[_0x235e('0x1f')](function(_0x5e81dd){if(_0x5e81dd){return _0x5e81dd[_0x235e('0xc0')](_0x31c4c1['query'][_0x235e('0x68')])['then'](function(){if(_[_0x235e('0xc1')](_0x31c4c1[_0x235e('0x44')]['ids'])){for(var _0x2b7747=0x0;_0x2b7747<_0x31c4c1['query'][_0x235e('0x68')][_0x235e('0x4a')];_0x2b7747+=0x1){socket[_0x235e('0xbe')](_0x235e('0xc2'),{'UserId':Number(_0x31c4c1[_0x235e('0x44')][_0x235e('0x68')][_0x2b7747]),'MailAccountId':Number(_0x31c4c1[_0x235e('0x58')]['id'])});}}else{socket[_0x235e('0xbe')](_0x235e('0xc2'),{'UserId':Number(_0x31c4c1[_0x235e('0x44')][_0x235e('0x68')]),'MailAccountId':Number(_0x31c4c1[_0x235e('0x58')]['id'])});}});}})[_0x235e('0x1f')](respondWithStatusCode(_0x247153,null))['catch'](handleError(_0x247153,null));};exports[_0x235e('0xc3')]=function(_0x553682,_0x4c6a7a,_0x4cd4ae){var _0x57b397={};var _0x552657={};var _0x5191b4;var _0x4393f9;return db[_0x235e('0x3f')][_0x235e('0x64')]({'where':{'id':_0x553682['params']['id']}})[_0x235e('0x1f')](handleEntityNotFound(_0x4c6a7a,null))['then'](function(_0x45241f){if(_0x45241f){_0x5191b4=_0x45241f;_0x552657['model']=_[_0x235e('0x45')](db[_0x235e('0xc4')][_0x235e('0x40')]);_0x552657[_0x235e('0x44')]=_[_0x235e('0x45')](_0x553682[_0x235e('0x44')]);_0x552657['filters']=_[_0x235e('0x47')](_0x552657[_0x235e('0x43')],_0x552657[_0x235e('0x44')]);_0x57b397[_0x235e('0x48')]=_[_0x235e('0x47')](_0x552657[_0x235e('0x43')],qs[_0x235e('0x49')](_0x553682[_0x235e('0x44')][_0x235e('0x49')]));_0x57b397['attributes']=_0x57b397['attributes'][_0x235e('0x4a')]?_0x57b397[_0x235e('0x48')]:_0x552657['model'];_0x57b397['order']=qs[_0x235e('0x4c')](_0x553682[_0x235e('0x44')][_0x235e('0x4c')]);_0x57b397[_0x235e('0x4d')]=qs[_0x235e('0x46')](_['pick'](_0x553682['query'],_0x552657[_0x235e('0x46')]));if(_0x553682[_0x235e('0x44')]['filter']){_0x57b397[_0x235e('0x4d')]=_['merge'](_0x57b397['where'],{'$or':_[_0x235e('0x3e')](_0x57b397['attributes'],function(_0x31db69){var _0x4f73be={};_0x4f73be[_0x31db69]={'$like':'%'+_0x553682[_0x235e('0x44')][_0x235e('0x4f')]+'%'};return _0x4f73be;})});}_0x57b397=_[_0x235e('0x50')]({},_0x57b397,_0x553682['options']);return _0x5191b4[_0x235e('0xc3')](_0x57b397);}})[_0x235e('0x1f')](function(_0x3142a9){if(_0x3142a9){_0x4393f9=_0x3142a9[_0x235e('0x4a')];if(!_0x553682[_0x235e('0x44')]['hasOwnProperty'](_0x235e('0x4b'))){_0x57b397[_0x235e('0x31')]=qs[_0x235e('0x31')](_0x553682[_0x235e('0x44')]['limit']);_0x57b397[_0x235e('0x2f')]=qs[_0x235e('0x2f')](_0x553682[_0x235e('0x44')][_0x235e('0x2f')]);}return _0x5191b4[_0x235e('0xc3')](_0x57b397);}})[_0x235e('0x1f')](function(_0x3882f6){if(_0x3882f6){return _0x3882f6?{'count':_0x4393f9,'rows':_0x3882f6}:null;}})[_0x235e('0x1f')](respondWithResult(_0x4c6a7a,null))[_0x235e('0x2a')](handleError(_0x4c6a7a,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index 8fed573..6867a90 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 _0xbdc2=['events','../../mysqldb','MailAccount','setMaxListeners','remove','emit','hook','exports'];(function(_0x3477ae,_0x15257f){var _0x2f0e2e=function(_0x1855b2){while(--_0x1855b2){_0x3477ae['push'](_0x3477ae['shift']());}};_0x2f0e2e(++_0x15257f);}(_0xbdc2,0x148));var _0x2bdc=function(_0x57f1bc,_0x103651){_0x57f1bc=_0x57f1bc-0x0;var _0x57649d=_0xbdc2[_0x57f1bc];return _0x57649d;};'use strict';var EventEmitter=require(_0x2bdc('0x0'));var MailAccount=require(_0x2bdc('0x1'))['db'][_0x2bdc('0x2')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x2bdc('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x2bdc('0x4')};function emitEvent(_0x1d9116){return function(_0x522434,_0x1855bd,_0x378db8){MailAccountEvents['emit'](_0x1d9116+':'+_0x522434['id'],_0x522434);MailAccountEvents[_0x2bdc('0x5')](_0x1d9116,_0x522434);_0x378db8(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailAccount[_0x2bdc('0x6')](e,emitEvent(event));}}module[_0x2bdc('0x7')]=MailAccountEvents; \ No newline at end of file +var _0xcd2f=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x39a9d5,_0x3975b4){var _0x130c30=function(_0x3106df){while(--_0x3106df){_0x39a9d5['push'](_0x39a9d5['shift']());}};_0x130c30(++_0x3975b4);}(_0xcd2f,0xf8));var _0xfcd2=function(_0x278e3c,_0x1c9cfd){_0x278e3c=_0x278e3c-0x0;var _0x3e2d9b=_0xcd2f[_0x278e3c];return _0x3e2d9b;};'use strict';var EventEmitter=require('events');var MailAccount=require('../../mysqldb')['db']['MailAccount'];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0xfcd2('0x0')](0x0);var events={'afterCreate':_0xfcd2('0x1'),'afterUpdate':_0xfcd2('0x2'),'afterDestroy':_0xfcd2('0x3')};function emitEvent(_0x131baf){return function(_0x248361,_0x8a26c,_0x11562c){MailAccountEvents['emit'](_0x131baf+':'+_0x248361['id'],_0x248361);MailAccountEvents[_0xfcd2('0x4')](_0x131baf,_0x248361);_0x11562c(null);};}for(var e in events){if(events[_0xfcd2('0x5')](e)){var event=events[e];MailAccount[_0xfcd2('0x6')](e,emitEvent(event));}}module[_0xfcd2('0x7')]=MailAccountEvents; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.model.js b/server/api/mailAccount/mailAccount.model.js index 3599c61..672e0a3 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 _0x596e=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailAccount.attributes','exports','MailAccount','mail_accounts','lodash'];(function(_0x2ea857,_0x466b31){var _0x20429a=function(_0x3145a6){while(--_0x3145a6){_0x2ea857['push'](_0x2ea857['shift']());}};_0x20429a(++_0x466b31);}(_0x596e,0x9b));var _0xe596=function(_0x16ab1b,_0x5249f7){_0x16ab1b=_0x16ab1b-0x0;var _0xc8facb=_0x596e[_0x16ab1b];return _0xc8facb;};'use strict';var _=require(_0xe596('0x0'));var util=require('util');var logger=require(_0xe596('0x1'))(_0xe596('0x2'));var moment=require(_0xe596('0x3'));var BPromise=require(_0xe596('0x4'));var rp=require(_0xe596('0x5'));var fs=require('fs');var path=require(_0xe596('0x6'));var rimraf=require(_0xe596('0x7'));var config=require(_0xe596('0x8'));var attributes=require(_0xe596('0x9'));module[_0xe596('0xa')]=function(_0x1f766b,_0x5a952a){return _0x1f766b['define'](_0xe596('0xb'),attributes,{'tableName':_0xe596('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa2ba=['util','api','moment','bluebird','request-promise','path','rimraf','exports','define','MailAccount','lodash'];(function(_0x311909,_0x414bf7){var _0x8d3163=function(_0x226f55){while(--_0x226f55){_0x311909['push'](_0x311909['shift']());}};_0x8d3163(++_0x414bf7);}(_0xa2ba,0xd0));var _0xaa2b=function(_0x2e893b,_0x335691){_0x2e893b=_0x2e893b-0x0;var _0x5c6338=_0xa2ba[_0x2e893b];return _0x5c6338;};'use strict';var _=require(_0xaa2b('0x0'));var util=require(_0xaa2b('0x1'));var logger=require('../../config/logger')(_0xaa2b('0x2'));var moment=require(_0xaa2b('0x3'));var BPromise=require(_0xaa2b('0x4'));var rp=require(_0xaa2b('0x5'));var fs=require('fs');var path=require(_0xaa2b('0x6'));var rimraf=require(_0xaa2b('0x7'));var config=require('../../config/environment');var attributes=require('./mailAccount.attributes');module[_0xaa2b('0x8')]=function(_0x282ad1,_0x31c318){return _0x282ad1[_0xaa2b('0x9')](_0xaa2b('0xa'),attributes,{'tableName':'mail_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.rpc.js b/server/api/mailAccount/mailAccount.rpc.js index 7a80570..b474de3 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 _0x348c=['DESC','MailApplication','Applications','MailServerOut','Smtp','then','get','omit','applications','list','orderBy','priority','asc','length','close','autoclose','ListId','create','messageId','generate','subject','attach','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','MailMessage','Messages','Contact\x20not\x20found','spread','update','format','interaction','created','contact','attachments','originTo','originCc','bcc','originChannel','Email','Attachment','Attachments','User','name','agent','waitForTheAssignedAgent','*,*,*,*','Start','startRouting','lodash','util','bluebird','randomstring','../../config/utils','rpc','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./mailAccount.socket','register','request','info','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','MailAccount,\x20%s,\x20%s','message','result','GetMailAccount','MailAccount','findAll','options','raw','attributes','include','map','model','where','ShowMailAccount','catch','body','difference','keys','CmContact','rawAttributes','CompanyId','isNil','from','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','find','account','CmList','List','Contacts'];(function(_0x45f421,_0x2fc75c){var _0x50f2ab=function(_0x245ac7){while(--_0x245ac7){_0x45f421['push'](_0x45f421['shift']());}};_0x50f2ab(++_0x2fc75c);}(_0x348c,0x96));var _0xc348=function(_0x268876,_0x57e4e7){_0x268876=_0x268876-0x0;var _0x177d78=_0x348c[_0x268876];return _0x177d78;};'use strict';var _=require(_0xc348('0x0'));var util=require(_0xc348('0x1'));var moment=require('moment');var BPromise=require(_0xc348('0x2'));var rs=require(_0xc348('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xc348('0x4'));var logger=require('../../config/logger')(_0xc348('0x5'));var config=require('../../config/environment');var jayson=require(_0xc348('0x6'));var client=jayson[_0xc348('0x7')]['http']({'port':0x232c});config[_0xc348('0x8')]=_[_0xc348('0x9')](config[_0xc348('0x8')],{'host':_0xc348('0xa'),'port':0x18eb});var socket=require(_0xc348('0xb'))(new Redis(config['redis']));require(_0xc348('0xc'))[_0xc348('0xd')](socket);function respondWithRpcPromise(_0x34f51d,_0x1e1954,_0x3c9a83){return new BPromise(function(_0x2b1795,_0x5c75bb){return client[_0xc348('0xe')](_0x34f51d,_0x3c9a83)['then'](function(_0x5a2b3a){logger[_0xc348('0xf')]('MailAccount,\x20%s,\x20%s',_0x1e1954,_0xc348('0x10'));logger[_0xc348('0x11')](_0xc348('0x12'),_0x1e1954,'request\x20sent',JSON[_0xc348('0x13')](_0x5a2b3a));if(_0x5a2b3a[_0xc348('0x14')]){if(_0x5a2b3a[_0xc348('0x14')][_0xc348('0x15')]===0x1f4){logger[_0xc348('0x14')](_0xc348('0x16'),_0x1e1954,_0x5a2b3a[_0xc348('0x14')][_0xc348('0x17')]);return _0x5c75bb(_0x5a2b3a['error'][_0xc348('0x17')]);}logger[_0xc348('0x14')](_0xc348('0x16'),_0x1e1954,_0x5a2b3a['error'][_0xc348('0x17')]);return _0x2b1795(_0x5a2b3a[_0xc348('0x14')][_0xc348('0x17')]);}else{logger['info'](_0xc348('0x16'),_0x1e1954,_0xc348('0x10'));_0x2b1795(_0x5a2b3a[_0xc348('0x18')]['message']);}})['catch'](function(_0x44844d){logger[_0xc348('0x14')](_0xc348('0x16'),_0x1e1954,_0x44844d);_0x5c75bb(_0x44844d);});});}exports[_0xc348('0x19')]=function(_0x18c913){var _0x278d3d=this;return new Promise(function(_0x51bb32,_0xf782f3){return db[_0xc348('0x1a')][_0xc348('0x1b')]({'raw':_0x18c913[_0xc348('0x1c')]?_0x18c913[_0xc348('0x1c')][_0xc348('0x1d')]===undefined?!![]:![]:!![],'where':_0x18c913[_0xc348('0x1c')]?_0x18c913['options']['where']||null:null,'attributes':_0x18c913[_0xc348('0x1c')]?_0x18c913[_0xc348('0x1c')][_0xc348('0x1e')]||null:null,'limit':_0x18c913[_0xc348('0x1c')]?_0x18c913[_0xc348('0x1c')]['limit']||null:null,'include':_0x18c913['options']?_0x18c913[_0xc348('0x1c')][_0xc348('0x1f')]?_[_0xc348('0x20')](_0x18c913[_0xc348('0x1c')][_0xc348('0x1f')],function(_0x45a573){return{'model':db[_0x45a573[_0xc348('0x21')]],'as':_0x45a573['as'],'attributes':_0x45a573[_0xc348('0x1e')],'include':_0x45a573['include']?_[_0xc348('0x20')](_0x45a573['include'],function(_0x49cad6){return{'model':db[_0x49cad6[_0xc348('0x21')]],'as':_0x49cad6['as'],'attributes':_0x49cad6[_0xc348('0x1e')],'include':_0x49cad6[_0xc348('0x1f')]?_['map'](_0x49cad6[_0xc348('0x1f')],function(_0x48f767){return{'model':db[_0x48f767[_0xc348('0x21')]],'as':_0x48f767['as'],'attributes':_0x48f767['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x1ddf3f){logger['info']('GetMailAccount',_0x18c913);logger['debug'](_0xc348('0x19'),_0x18c913,JSON[_0xc348('0x13')](_0x1ddf3f));_0x51bb32(_0x1ddf3f);})['catch'](function(_0x2dfca2){logger['error']('GetMailAccount',_0x2dfca2[_0xc348('0x17')],_0x18c913);_0xf782f3(_0x278d3d[_0xc348('0x14')](0x1f4,_0x2dfca2[_0xc348('0x17')]));});});};exports['ShowMailAccount']=function(_0x27f72a){var _0x447f67=this;return new Promise(function(_0x35c6dc,_0xa08e74){return db['MailAccount']['find']({'raw':_0x27f72a[_0xc348('0x1c')]?_0x27f72a[_0xc348('0x1c')][_0xc348('0x1d')]===undefined?!![]:![]:!![],'where':_0x27f72a[_0xc348('0x1c')]?_0x27f72a[_0xc348('0x1c')][_0xc348('0x22')]||null:null,'attributes':_0x27f72a[_0xc348('0x1c')]?_0x27f72a[_0xc348('0x1c')][_0xc348('0x1e')]||null:null,'include':_0x27f72a[_0xc348('0x1c')]?_0x27f72a['options'][_0xc348('0x1f')]?_[_0xc348('0x20')](_0x27f72a[_0xc348('0x1c')][_0xc348('0x1f')],function(_0x222ba1){return{'model':db[_0x222ba1['model']],'as':_0x222ba1['as'],'attributes':_0x222ba1[_0xc348('0x1e')],'include':_0x222ba1['include']?_['map'](_0x222ba1[_0xc348('0x1f')],function(_0x51ce70){return{'model':db[_0x51ce70[_0xc348('0x21')]],'as':_0x51ce70['as'],'attributes':_0x51ce70[_0xc348('0x1e')],'include':_0x51ce70[_0xc348('0x1f')]?_[_0xc348('0x20')](_0x51ce70[_0xc348('0x1f')],function(_0x52a845){return{'model':db[_0x52a845[_0xc348('0x21')]],'as':_0x52a845['as'],'attributes':_0x52a845[_0xc348('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3ceda9){logger[_0xc348('0xf')](_0xc348('0x23'),_0x27f72a);logger[_0xc348('0x11')](_0xc348('0x23'),_0x27f72a,JSON[_0xc348('0x13')](_0x3ceda9));_0x35c6dc(_0x3ceda9);})[_0xc348('0x24')](function(_0x332443){logger[_0xc348('0x14')](_0xc348('0x23'),_0x332443[_0xc348('0x17')],_0x27f72a);_0xa08e74(_0x447f67[_0xc348('0x14')](0x1f4,_0x332443[_0xc348('0x17')]));});});};exports['NotifyMailAccount']=function(_0x2c0fdd){var _0x1d4bcf=this;return new Promise(function(_0x5bd5b5,_0x32838e){var _0x40c7df={'body':_0x2c0fdd[_0xc348('0x25')],'channel':'mail'};var _0x5a7039=_[_0xc348('0x26')](_[_0xc348('0x27')](db[_0xc348('0x28')][_0xc348('0x29')]),['createdAt','updatedAt',_0xc348('0x2a'),'ListId']);var _0x50633d=![];if(_0x2c0fdd['body']['id']){delete _0x2c0fdd[_0xc348('0x25')]['id'];}if(_[_0xc348('0x2b')](_0x2c0fdd['body'][_0xc348('0x2c')])){return _0x32838e(_0x1d4bcf[_0xc348('0x14')](0x1f4,'from\x20is\x20mandatory'));}if(_['isNil'](_0x2c0fdd[_0xc348('0x25')][_0xc348('0x25')])||_0x2c0fdd['body']['body']===''){return _0x32838e(_0x1d4bcf[_0xc348('0x14')](0x1f4,_0xc348('0x2d')));}if(_['isNil'](_0x2c0fdd['body'][_0xc348('0x2e')])){return _0x32838e(_0x1d4bcf[_0xc348('0x14')](0x1f4,_0xc348('0x2f')+_0x5a7039));}if(!_['includes'](_0x5a7039,_0x2c0fdd['body'][_0xc348('0x2e')])){return _0x32838e(_0x1d4bcf[_0xc348('0x14')](0x1f4,_0xc348('0x30')+_0x5a7039));}var _0x1e7852={};_0x1e7852[_0x2c0fdd[_0xc348('0x25')][_0xc348('0x2e')]]=_0x2c0fdd[_0xc348('0x25')]['from'];return db['MailAccount'][_0xc348('0x31')]({'where':{'id':_0x2c0fdd[_0xc348('0x32')]['id']},'include':[{'model':db[_0xc348('0x33')],'as':_0xc348('0x34'),'include':[{'model':db[_0xc348('0x28')],'as':_0xc348('0x35'),'where':_0x1e7852,'limit':0x1,'order':[['updatedAt',_0xc348('0x36')]]}]},{'model':db[_0xc348('0x37')],'as':_0xc348('0x38')},{'model':db[_0xc348('0x39')],'as':_0xc348('0x3a')}]})[_0xc348('0x3b')](function(_0x10cfbd){if(_0x10cfbd&&_0x10cfbd[_0xc348('0x34')]){var _0x1dcb26=_0x10cfbd[_0xc348('0x3c')]({'plain':!![]});_0x40c7df[_0xc348('0x32')]=_[_0xc348('0x3d')](_0x1dcb26,['Applications',_0xc348('0x34')]);_0x40c7df[_0xc348('0x3e')]=_0x1dcb26[_0xc348('0x38')];_0x40c7df[_0xc348('0x3f')]=_0x1dcb26[_0xc348('0x34')];_0x40c7df[_0xc348('0x3e')]=_[_0xc348('0x40')](_0x40c7df['applications'],[_0xc348('0x41')],[_0xc348('0x42')]);if(_0x40c7df[_0xc348('0x32')]&&_0x40c7df[_0xc348('0x32')]['autoclose']){_0x40c7df[_0xc348('0x3e')]['push']({'id':0x0,'priority':_0x40c7df[_0xc348('0x3e')][_0xc348('0x43')]+0x1,'app':_0xc348('0x44'),'appdata':_0xc348('0x45'),'interval':'*,*,*,*'});}if(_0x40c7df[_0xc348('0x32')][_0xc348('0x38')]){delete _0x40c7df[_0xc348('0x32')][_0xc348('0x38')];}if(_0x40c7df[_0xc348('0x32')][_0xc348('0x34')]){delete _0x40c7df[_0xc348('0x32')][_0xc348('0x34')];}if(_0x1dcb26[_0xc348('0x34')][_0xc348('0x35')][_0xc348('0x43')]){return _0x1dcb26[_0xc348('0x34')][_0xc348('0x35')][0x0];}var _0x331c69=_[_0xc348('0x9')](_0x2c0fdd[_0xc348('0x25')],{'firstName':_0x2c0fdd[_0xc348('0x25')]['from'],'ListId':_0x1dcb26[_0xc348('0x46')]});_0x331c69[_0x2c0fdd[_0xc348('0x25')][_0xc348('0x2e')]]=_0x2c0fdd[_0xc348('0x25')][_0xc348('0x2c')];return db[_0xc348('0x28')][_0xc348('0x47')](_0x331c69);}else{throw new Error('List\x20not\x20found');}})[_0xc348('0x3b')](function(_0x3523bd){_0x40c7df['contact']=_0x3523bd;if(_0x3523bd){if(!_0x2c0fdd[_0xc348('0x25')][_0xc348('0x17')][_0xc348('0x48')]){_0x2c0fdd[_0xc348('0x25')][_0xc348('0x17')][_0xc348('0x48')]=rs[_0xc348('0x49')]()+'\x20'+_0x2c0fdd[_0xc348('0x25')][_0xc348('0x17')]['from'];}var _0x5ed2b8={'ContactId':_0x3523bd['id'],'MailAccountId':_0x2c0fdd[_0xc348('0x32')]['id'],'inReplyTo':_0x2c0fdd['body'][_0xc348('0x17')][_0xc348('0x48')],'to':_0x2c0fdd['body'][_0xc348('0x17')]['from'],'cc':_0x2c0fdd[_0xc348('0x25')][_0xc348('0x17')]['cc'],'subject':_0x2c0fdd[_0xc348('0x25')]['message'][_0xc348('0x4a')],'attach':_0x2c0fdd[_0xc348('0x25')][_0xc348('0x17')][_0xc348('0x4b')],'lastMsgAt':moment()['format'](_0xc348('0x4c')),'lastMsgDirection':'in'};return db[_0xc348('0x4d')][_0xc348('0x31')]({'where':{'closed':![],'MailAccountId':_0x2c0fdd[_0xc348('0x32')]['id']},'include':[{'model':db[_0xc348('0x4e')],'as':_0xc348('0x4f'),'attributes':['messageId'],'where':{'messageId':_0x2c0fdd['body'][_0xc348('0x17')]['inReplyTo']}}]})[_0xc348('0x3b')](function(_0x160838){if(_0x160838){return[_0x160838,![]];}return db['MailInteraction']['create'](_0x5ed2b8)[_0xc348('0x3b')](function(_0x238968){return[_0x238968,!![]];});});}else{throw new Error(_0xc348('0x50'));}})[_0xc348('0x51')](function(_0x39b0ce,_0x2451e9){if(_0x39b0ce){_0x50633d=_0x2451e9;if(!_0x2451e9){return _0x39b0ce[_0xc348('0x52')]({'inReplyTo':_0x2c0fdd[_0xc348('0x25')]['message'][_0xc348('0x48')],'to':_0x2c0fdd[_0xc348('0x25')][_0xc348('0x17')][_0xc348('0x2c')],'cc':_0x2c0fdd['body'][_0xc348('0x17')]['cc'],'subject':_0x2c0fdd[_0xc348('0x25')]['message'][_0xc348('0x4a')],'attach':_0x39b0ce['attach']?_0x39b0ce[_0xc348('0x4b')]:_0x2c0fdd[_0xc348('0x25')][_0xc348('0x17')][_0xc348('0x4b')],'substatus':null,'substatusAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgAt':moment()[_0xc348('0x53')](_0xc348('0x4c')),'lastMsgDirection':'in'});}else{return _0x39b0ce;}}})[_0xc348('0x3b')](function(_0x1be0f0){_0x40c7df[_0xc348('0x54')]=_0x1be0f0[_0xc348('0x3c')]({'plain':!![]});_0x40c7df[_0xc348('0x54')][_0xc348('0x55')]=_0x50633d;return db[_0xc348('0x4e')][_0xc348('0x47')]({'body':_0x2c0fdd[_0xc348('0x25')]['body'],'MailAccountId':_0x2c0fdd['account']['id'],'MailInteractionId':_0x1be0f0['id'],'direction':'in','ContactId':_0x40c7df[_0xc348('0x56')]['id'],'messageId':_0x2c0fdd['body']['message'][_0xc348('0x48')],'from':_0x2c0fdd[_0xc348('0x25')]['message']['from'],'to':_0x2c0fdd[_0xc348('0x25')]['message']['to'],'cc':_0x2c0fdd['body']['message']['cc'],'subject':_0x2c0fdd[_0xc348('0x25')][_0xc348('0x17')][_0xc348('0x4a')],'attach':_0x2c0fdd[_0xc348('0x25')]['message'][_0xc348('0x4b')],'Attachments':_0x2c0fdd[_0xc348('0x25')][_0xc348('0x17')][_0xc348('0x57')],'originTo':_0x2c0fdd[_0xc348('0x25')][_0xc348('0x17')][_0xc348('0x58')],'originCc':_0x2c0fdd['body'][_0xc348('0x17')][_0xc348('0x59')],'bcc':_0x2c0fdd['body'][_0xc348('0x17')][_0xc348('0x5a')],'ChatWebsiteId':_0x2c0fdd[_0xc348('0x25')][_0xc348('0x17')]['ChatWebsiteId']||null,'originChannel':_0x2c0fdd[_0xc348('0x25')][_0xc348('0x17')][_0xc348('0x5b')]||_0xc348('0x5c'),'ChatOfflineMessageId':_0x2c0fdd[_0xc348('0x25')][_0xc348('0x17')]['ChatOfflineMessageId']||null},{'include':[{'model':db[_0xc348('0x5d')],'as':_0xc348('0x5e')}]});})[_0xc348('0x3b')](function(_0x4f1a93){_0x40c7df[_0xc348('0x17')]=_0x4f1a93;if(_0x40c7df[_0xc348('0x54')]['UserId']){return db[_0xc348('0x5f')][_0xc348('0x31')]({'attributes':['id',_0xc348('0x60')],'where':{'id':_0x40c7df[_0xc348('0x54')]['UserId']}})['then'](function(_0x481efa){if(_0x481efa){_0x40c7df[_0xc348('0x3e')]['unshift']({'id':0x0,'priority':0x0,'app':_0xc348('0x61'),'appdata':_0x481efa['name']+','+(_0x40c7df['account'][_0xc348('0x62')]||0xa),'interval':_0xc348('0x63')});}return respondWithRpcPromise(_0xc348('0x64'),'startRouting',_0x40c7df);});}return respondWithRpcPromise(_0xc348('0x64'),_0xc348('0x65'),_0x40c7df);})['then'](function(_0x529c69){_0x5bd5b5(_0x529c69);})['catch'](function(_0x4e8a8f){_0x32838e(_0x1d4bcf[_0xc348('0x14')](0x1f4,_0x4e8a8f[_0xc348('0x17')]));});});}; \ No newline at end of file +var _0xdc79=['find','NotifyMailAccount','body','mail','difference','keys','CmContact','rawAttributes','updatedAt','CompanyId','ListId','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','account','CmList','List','Contacts','DESC','MailServerOut','Smtp','get','omit','Applications','applications','list','orderBy','priority','asc','autoclose','push','close','*,*,*,*','create','List\x20not\x20found','contact','messageId','generate','attach','format','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','MailMessage','Messages','inReplyTo','spread','update','subject','created','originTo','originCc','bcc','ChatWebsiteId','originChannel','Email','ChatOfflineMessageId','Attachment','interaction','UserId','User','unshift','agent','name','waitForTheAssignedAgent','Start','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','request','then','MailAccount,\x20%s,\x20%s','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','info','request\x20sent','catch','MailAccount','findAll','options','raw','attributes','include','map','model','GetMailAccount','ShowMailAccount'];(function(_0x38aec6,_0x2ad06a){var _0x56a203=function(_0x3a3821){while(--_0x3a3821){_0x38aec6['push'](_0x38aec6['shift']());}};_0x56a203(++_0x2ad06a);}(_0xdc79,0x117));var _0x9dc7=function(_0x3c8ec4,_0x3bd8c6){_0x3c8ec4=_0x3c8ec4-0x0;var _0x2175a9=_0xdc79[_0x3c8ec4];return _0x2175a9;};'use strict';var _=require(_0x9dc7('0x0'));var util=require(_0x9dc7('0x1'));var moment=require(_0x9dc7('0x2'));var BPromise=require(_0x9dc7('0x3'));var rs=require(_0x9dc7('0x4'));var fs=require('fs');var Redis=require(_0x9dc7('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x9dc7('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x9dc7('0x7'));var jayson=require(_0x9dc7('0x8'));var client=jayson[_0x9dc7('0x9')][_0x9dc7('0xa')]({'port':0x232c});config[_0x9dc7('0xb')]=_[_0x9dc7('0xc')](config[_0x9dc7('0xb')],{'host':_0x9dc7('0xd'),'port':0x18eb});var socket=require(_0x9dc7('0xe'))(new Redis(config[_0x9dc7('0xb')]));require('./mailAccount.socket')['register'](socket);function respondWithRpcPromise(_0x103210,_0x46599c,_0x44997b){return new BPromise(function(_0x3924ae,_0x2ab051){return client[_0x9dc7('0xf')](_0x103210,_0x44997b)[_0x9dc7('0x10')](function(_0x5b6647){logger['info'](_0x9dc7('0x11'),_0x46599c,'request\x20sent');logger[_0x9dc7('0x12')](_0x9dc7('0x13'),_0x46599c,'request\x20sent',JSON[_0x9dc7('0x14')](_0x5b6647));if(_0x5b6647['error']){if(_0x5b6647['error']['code']===0x1f4){logger['error'](_0x9dc7('0x11'),_0x46599c,_0x5b6647[_0x9dc7('0x15')]['message']);return _0x2ab051(_0x5b6647[_0x9dc7('0x15')][_0x9dc7('0x16')]);}logger[_0x9dc7('0x15')](_0x9dc7('0x11'),_0x46599c,_0x5b6647[_0x9dc7('0x15')][_0x9dc7('0x16')]);return _0x3924ae(_0x5b6647[_0x9dc7('0x15')][_0x9dc7('0x16')]);}else{logger[_0x9dc7('0x17')](_0x9dc7('0x11'),_0x46599c,_0x9dc7('0x18'));_0x3924ae(_0x5b6647['result'][_0x9dc7('0x16')]);}})[_0x9dc7('0x19')](function(_0x385484){logger[_0x9dc7('0x15')](_0x9dc7('0x11'),_0x46599c,_0x385484);_0x2ab051(_0x385484);});});}exports['GetMailAccount']=function(_0x31354b){var _0x8a0ec4=this;return new Promise(function(_0x1e4c18,_0x3c000b){return db[_0x9dc7('0x1a')][_0x9dc7('0x1b')]({'raw':_0x31354b[_0x9dc7('0x1c')]?_0x31354b[_0x9dc7('0x1c')][_0x9dc7('0x1d')]===undefined?!![]:![]:!![],'where':_0x31354b['options']?_0x31354b[_0x9dc7('0x1c')]['where']||null:null,'attributes':_0x31354b['options']?_0x31354b[_0x9dc7('0x1c')][_0x9dc7('0x1e')]||null:null,'limit':_0x31354b[_0x9dc7('0x1c')]?_0x31354b['options']['limit']||null:null,'include':_0x31354b[_0x9dc7('0x1c')]?_0x31354b[_0x9dc7('0x1c')][_0x9dc7('0x1f')]?_[_0x9dc7('0x20')](_0x31354b[_0x9dc7('0x1c')][_0x9dc7('0x1f')],function(_0x54a7a0){return{'model':db[_0x54a7a0[_0x9dc7('0x21')]],'as':_0x54a7a0['as'],'attributes':_0x54a7a0['attributes'],'include':_0x54a7a0[_0x9dc7('0x1f')]?_[_0x9dc7('0x20')](_0x54a7a0['include'],function(_0x169c2a){return{'model':db[_0x169c2a[_0x9dc7('0x21')]],'as':_0x169c2a['as'],'attributes':_0x169c2a['attributes'],'include':_0x169c2a['include']?_[_0x9dc7('0x20')](_0x169c2a['include'],function(_0x1682b9){return{'model':db[_0x1682b9[_0x9dc7('0x21')]],'as':_0x1682b9['as'],'attributes':_0x1682b9['attributes']};}):[]};}):[]};}):[]:[]})[_0x9dc7('0x10')](function(_0x1aa8ec){logger[_0x9dc7('0x17')](_0x9dc7('0x22'),_0x31354b);logger[_0x9dc7('0x12')](_0x9dc7('0x22'),_0x31354b,JSON[_0x9dc7('0x14')](_0x1aa8ec));_0x1e4c18(_0x1aa8ec);})[_0x9dc7('0x19')](function(_0x6145ca){logger[_0x9dc7('0x15')](_0x9dc7('0x22'),_0x6145ca['message'],_0x31354b);_0x3c000b(_0x8a0ec4[_0x9dc7('0x15')](0x1f4,_0x6145ca['message']));});});};exports[_0x9dc7('0x23')]=function(_0x54599f){var _0x549e9f=this;return new Promise(function(_0x15e418,_0x326f3c){return db[_0x9dc7('0x1a')][_0x9dc7('0x24')]({'raw':_0x54599f['options']?_0x54599f[_0x9dc7('0x1c')][_0x9dc7('0x1d')]===undefined?!![]:![]:!![],'where':_0x54599f[_0x9dc7('0x1c')]?_0x54599f[_0x9dc7('0x1c')]['where']||null:null,'attributes':_0x54599f[_0x9dc7('0x1c')]?_0x54599f[_0x9dc7('0x1c')]['attributes']||null:null,'include':_0x54599f[_0x9dc7('0x1c')]?_0x54599f[_0x9dc7('0x1c')][_0x9dc7('0x1f')]?_[_0x9dc7('0x20')](_0x54599f['options']['include'],function(_0x478ccc){return{'model':db[_0x478ccc[_0x9dc7('0x21')]],'as':_0x478ccc['as'],'attributes':_0x478ccc[_0x9dc7('0x1e')],'include':_0x478ccc[_0x9dc7('0x1f')]?_[_0x9dc7('0x20')](_0x478ccc[_0x9dc7('0x1f')],function(_0x847d0){return{'model':db[_0x847d0['model']],'as':_0x847d0['as'],'attributes':_0x847d0['attributes'],'include':_0x847d0[_0x9dc7('0x1f')]?_[_0x9dc7('0x20')](_0x847d0['include'],function(_0x531a73){return{'model':db[_0x531a73[_0x9dc7('0x21')]],'as':_0x531a73['as'],'attributes':_0x531a73[_0x9dc7('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x9dc7('0x10')](function(_0x5a63e0){logger[_0x9dc7('0x17')](_0x9dc7('0x23'),_0x54599f);logger['debug'](_0x9dc7('0x23'),_0x54599f,JSON[_0x9dc7('0x14')](_0x5a63e0));_0x15e418(_0x5a63e0);})[_0x9dc7('0x19')](function(_0x4483ab){logger[_0x9dc7('0x15')](_0x9dc7('0x23'),_0x4483ab['message'],_0x54599f);_0x326f3c(_0x549e9f['error'](0x1f4,_0x4483ab[_0x9dc7('0x16')]));});});};exports[_0x9dc7('0x25')]=function(_0x5c0b14){var _0x21c94f=this;return new Promise(function(_0x5dada9,_0x13b255){var _0xe220d8={'body':_0x5c0b14[_0x9dc7('0x26')],'channel':_0x9dc7('0x27')};var _0x2e1be1=_[_0x9dc7('0x28')](_[_0x9dc7('0x29')](db[_0x9dc7('0x2a')][_0x9dc7('0x2b')]),['createdAt',_0x9dc7('0x2c'),_0x9dc7('0x2d'),_0x9dc7('0x2e')]);var _0x5642be=![];if(_0x5c0b14[_0x9dc7('0x26')]['id']){delete _0x5c0b14[_0x9dc7('0x26')]['id'];}if(_[_0x9dc7('0x2f')](_0x5c0b14[_0x9dc7('0x26')][_0x9dc7('0x30')])){return _0x13b255(_0x21c94f[_0x9dc7('0x15')](0x1f4,_0x9dc7('0x31')));}if(_[_0x9dc7('0x2f')](_0x5c0b14[_0x9dc7('0x26')][_0x9dc7('0x26')])||_0x5c0b14['body'][_0x9dc7('0x26')]===''){return _0x13b255(_0x21c94f[_0x9dc7('0x15')](0x1f4,_0x9dc7('0x32')));}if(_[_0x9dc7('0x2f')](_0x5c0b14[_0x9dc7('0x26')][_0x9dc7('0x33')])){return _0x13b255(_0x21c94f[_0x9dc7('0x15')](0x1f4,_0x9dc7('0x34')+_0x2e1be1));}if(!_[_0x9dc7('0x35')](_0x2e1be1,_0x5c0b14[_0x9dc7('0x26')][_0x9dc7('0x33')])){return _0x13b255(_0x21c94f[_0x9dc7('0x15')](0x1f4,'mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x2e1be1));}var _0x19081d={};_0x19081d[_0x5c0b14['body'][_0x9dc7('0x33')]]=_0x5c0b14[_0x9dc7('0x26')]['from'];return db['MailAccount'][_0x9dc7('0x24')]({'where':{'id':_0x5c0b14[_0x9dc7('0x36')]['id']},'include':[{'model':db[_0x9dc7('0x37')],'as':_0x9dc7('0x38'),'include':[{'model':db[_0x9dc7('0x2a')],'as':_0x9dc7('0x39'),'where':_0x19081d,'limit':0x1,'order':[[_0x9dc7('0x2c'),_0x9dc7('0x3a')]]}]},{'model':db['MailApplication'],'as':'Applications'},{'model':db[_0x9dc7('0x3b')],'as':_0x9dc7('0x3c')}]})['then'](function(_0x3022f9){if(_0x3022f9&&_0x3022f9[_0x9dc7('0x38')]){var _0x460727=_0x3022f9[_0x9dc7('0x3d')]({'plain':!![]});_0xe220d8[_0x9dc7('0x36')]=_[_0x9dc7('0x3e')](_0x460727,[_0x9dc7('0x3f'),'List']);_0xe220d8[_0x9dc7('0x40')]=_0x460727[_0x9dc7('0x3f')];_0xe220d8[_0x9dc7('0x41')]=_0x460727[_0x9dc7('0x38')];_0xe220d8[_0x9dc7('0x40')]=_[_0x9dc7('0x42')](_0xe220d8[_0x9dc7('0x40')],[_0x9dc7('0x43')],[_0x9dc7('0x44')]);if(_0xe220d8['account']&&_0xe220d8[_0x9dc7('0x36')][_0x9dc7('0x45')]){_0xe220d8['applications'][_0x9dc7('0x46')]({'id':0x0,'priority':_0xe220d8[_0x9dc7('0x40')]['length']+0x1,'app':_0x9dc7('0x47'),'appdata':_0x9dc7('0x45'),'interval':_0x9dc7('0x48')});}if(_0xe220d8[_0x9dc7('0x36')][_0x9dc7('0x3f')]){delete _0xe220d8[_0x9dc7('0x36')]['Applications'];}if(_0xe220d8['account'][_0x9dc7('0x38')]){delete _0xe220d8[_0x9dc7('0x36')][_0x9dc7('0x38')];}if(_0x460727[_0x9dc7('0x38')][_0x9dc7('0x39')]['length']){return _0x460727[_0x9dc7('0x38')][_0x9dc7('0x39')][0x0];}var _0x5cc5fb=_[_0x9dc7('0xc')](_0x5c0b14[_0x9dc7('0x26')],{'firstName':_0x5c0b14[_0x9dc7('0x26')][_0x9dc7('0x30')],'ListId':_0x460727[_0x9dc7('0x2e')]});_0x5cc5fb[_0x5c0b14[_0x9dc7('0x26')]['mapKey']]=_0x5c0b14[_0x9dc7('0x26')][_0x9dc7('0x30')];return db[_0x9dc7('0x2a')][_0x9dc7('0x49')](_0x5cc5fb);}else{throw new Error(_0x9dc7('0x4a'));}})[_0x9dc7('0x10')](function(_0x33aeef){_0xe220d8[_0x9dc7('0x4b')]=_0x33aeef;if(_0x33aeef){if(!_0x5c0b14[_0x9dc7('0x26')][_0x9dc7('0x16')][_0x9dc7('0x4c')]){_0x5c0b14[_0x9dc7('0x26')][_0x9dc7('0x16')]['messageId']=rs[_0x9dc7('0x4d')]()+'\x20'+_0x5c0b14['body']['message'][_0x9dc7('0x30')];}var _0x3aa28a={'ContactId':_0x33aeef['id'],'MailAccountId':_0x5c0b14[_0x9dc7('0x36')]['id'],'inReplyTo':_0x5c0b14[_0x9dc7('0x26')][_0x9dc7('0x16')][_0x9dc7('0x4c')],'to':_0x5c0b14['body']['message'][_0x9dc7('0x30')],'cc':_0x5c0b14[_0x9dc7('0x26')][_0x9dc7('0x16')]['cc'],'subject':_0x5c0b14[_0x9dc7('0x26')]['message']['subject'],'attach':_0x5c0b14['body'][_0x9dc7('0x16')][_0x9dc7('0x4e')],'lastMsgAt':moment()[_0x9dc7('0x4f')](_0x9dc7('0x50')),'lastMsgDirection':'in'};return db[_0x9dc7('0x51')][_0x9dc7('0x24')]({'where':{'closed':![],'MailAccountId':_0x5c0b14[_0x9dc7('0x36')]['id']},'include':[{'model':db[_0x9dc7('0x52')],'as':_0x9dc7('0x53'),'attributes':['messageId'],'where':{'messageId':_0x5c0b14[_0x9dc7('0x26')][_0x9dc7('0x16')][_0x9dc7('0x54')]}}]})[_0x9dc7('0x10')](function(_0x28d30b){if(_0x28d30b){return[_0x28d30b,![]];}return db[_0x9dc7('0x51')][_0x9dc7('0x49')](_0x3aa28a)[_0x9dc7('0x10')](function(_0x2a62d5){return[_0x2a62d5,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0x9dc7('0x55')](function(_0x24d664,_0x12d27c){if(_0x24d664){_0x5642be=_0x12d27c;if(!_0x12d27c){return _0x24d664[_0x9dc7('0x56')]({'inReplyTo':_0x5c0b14[_0x9dc7('0x26')]['message'][_0x9dc7('0x4c')],'to':_0x5c0b14[_0x9dc7('0x26')][_0x9dc7('0x16')][_0x9dc7('0x30')],'cc':_0x5c0b14[_0x9dc7('0x26')][_0x9dc7('0x16')]['cc'],'subject':_0x5c0b14['body'][_0x9dc7('0x16')][_0x9dc7('0x57')],'attach':_0x24d664[_0x9dc7('0x4e')]?_0x24d664[_0x9dc7('0x4e')]:_0x5c0b14['body'][_0x9dc7('0x16')][_0x9dc7('0x4e')],'substatus':null,'substatusAt':moment()[_0x9dc7('0x4f')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgAt':moment()[_0x9dc7('0x4f')](_0x9dc7('0x50')),'lastMsgDirection':'in'});}else{return _0x24d664;}}})[_0x9dc7('0x10')](function(_0x12c1f0){_0xe220d8['interaction']=_0x12c1f0['get']({'plain':!![]});_0xe220d8['interaction'][_0x9dc7('0x58')]=_0x5642be;return db[_0x9dc7('0x52')][_0x9dc7('0x49')]({'body':_0x5c0b14[_0x9dc7('0x26')][_0x9dc7('0x26')],'MailAccountId':_0x5c0b14[_0x9dc7('0x36')]['id'],'MailInteractionId':_0x12c1f0['id'],'direction':'in','ContactId':_0xe220d8[_0x9dc7('0x4b')]['id'],'messageId':_0x5c0b14['body'][_0x9dc7('0x16')][_0x9dc7('0x4c')],'from':_0x5c0b14[_0x9dc7('0x26')][_0x9dc7('0x16')]['from'],'to':_0x5c0b14[_0x9dc7('0x26')][_0x9dc7('0x16')]['to'],'cc':_0x5c0b14['body'][_0x9dc7('0x16')]['cc'],'subject':_0x5c0b14[_0x9dc7('0x26')][_0x9dc7('0x16')]['subject'],'attach':_0x5c0b14['body'][_0x9dc7('0x16')]['attach'],'Attachments':_0x5c0b14['body'][_0x9dc7('0x16')]['attachments'],'originTo':_0x5c0b14[_0x9dc7('0x26')][_0x9dc7('0x16')][_0x9dc7('0x59')],'originCc':_0x5c0b14[_0x9dc7('0x26')][_0x9dc7('0x16')][_0x9dc7('0x5a')],'bcc':_0x5c0b14[_0x9dc7('0x26')][_0x9dc7('0x16')][_0x9dc7('0x5b')],'ChatWebsiteId':_0x5c0b14[_0x9dc7('0x26')][_0x9dc7('0x16')][_0x9dc7('0x5c')]||null,'originChannel':_0x5c0b14[_0x9dc7('0x26')][_0x9dc7('0x16')][_0x9dc7('0x5d')]||_0x9dc7('0x5e'),'ChatOfflineMessageId':_0x5c0b14[_0x9dc7('0x26')][_0x9dc7('0x16')][_0x9dc7('0x5f')]||null},{'include':[{'model':db[_0x9dc7('0x60')],'as':'Attachments'}]});})[_0x9dc7('0x10')](function(_0x2b9f60){_0xe220d8[_0x9dc7('0x16')]=_0x2b9f60;if(_0xe220d8[_0x9dc7('0x61')][_0x9dc7('0x62')]){return db[_0x9dc7('0x63')][_0x9dc7('0x24')]({'attributes':['id','name'],'where':{'id':_0xe220d8[_0x9dc7('0x61')][_0x9dc7('0x62')]}})[_0x9dc7('0x10')](function(_0x409094){if(_0x409094){_0xe220d8[_0x9dc7('0x40')][_0x9dc7('0x64')]({'id':0x0,'priority':0x0,'app':_0x9dc7('0x65'),'appdata':_0x409094[_0x9dc7('0x66')]+','+(_0xe220d8[_0x9dc7('0x36')][_0x9dc7('0x67')]||0xa),'interval':_0x9dc7('0x48')});}return respondWithRpcPromise(_0x9dc7('0x68'),'startRouting',_0xe220d8);});}return respondWithRpcPromise(_0x9dc7('0x68'),'startRouting',_0xe220d8);})[_0x9dc7('0x10')](function(_0x308a0b){_0x5dada9(_0x308a0b);})['catch'](function(_0x5e7208){_0x13b255(_0x21c94f[_0x9dc7('0x15')](0x1f4,_0x5e7208[_0x9dc7('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index b1656a9..068c14e 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 _0xcdf0=['./mailAccount.events','save','remove','update','register','length','mailAccount:'];(function(_0x5bf9cc,_0x632d62){var _0xfed799=function(_0x1102de){while(--_0x1102de){_0x5bf9cc['push'](_0x5bf9cc['shift']());}};_0xfed799(++_0x632d62);}(_0xcdf0,0xa8));var _0x0cdf=function(_0x28a0df,_0x249ac1){_0x28a0df=_0x28a0df-0x0;var _0xdf7b06=_0xcdf0[_0x28a0df];return _0xdf7b06;};'use strict';var MailAccountEvents=require(_0x0cdf('0x0'));var events=[_0x0cdf('0x1'),_0x0cdf('0x2'),_0x0cdf('0x3')];function createListener(_0xcf2a96,_0x56f648){return function(_0x107772){_0x56f648['emit'](_0xcf2a96,_0x107772);};}function removeListener(_0x2e6209,_0x5076b0){return function(){MailAccountEvents['removeListener'](_0x2e6209,_0x5076b0);};}exports[_0x0cdf('0x4')]=function(_0x330940){for(var _0x1a58bd=0x0,_0x658ceb=events[_0x0cdf('0x5')];_0x1a58bd<_0x658ceb;_0x1a58bd++){var _0x5415ef=events[_0x1a58bd];var _0x47f3ea=createListener(_0x0cdf('0x6')+_0x5415ef,_0x330940);MailAccountEvents['on'](_0x5415ef,_0x47f3ea);}}; \ No newline at end of file +var _0x3eea=['emit','removeListener','register','length','mailAccount:','./mailAccount.events','save','remove'];(function(_0x3705f7,_0x2553c4){var _0x2a1cf2=function(_0x51f080){while(--_0x51f080){_0x3705f7['push'](_0x3705f7['shift']());}};_0x2a1cf2(++_0x2553c4);}(_0x3eea,0x1bd));var _0xa3ee=function(_0x557f44,_0x164975){_0x557f44=_0x557f44-0x0;var _0x5375f8=_0x3eea[_0x557f44];return _0x5375f8;};'use strict';var MailAccountEvents=require(_0xa3ee('0x0'));var events=[_0xa3ee('0x1'),_0xa3ee('0x2'),'update'];function createListener(_0x347a30,_0x137355){return function(_0x36fd22){_0x137355[_0xa3ee('0x3')](_0x347a30,_0x36fd22);};}function removeListener(_0x215a0d,_0x153906){return function(){MailAccountEvents[_0xa3ee('0x4')](_0x215a0d,_0x153906);};}exports[_0xa3ee('0x5')]=function(_0x3e19e3){for(var _0x4263f9=0x0,_0x3eedc7=events[_0xa3ee('0x6')];_0x4263f9<_0x3eedc7;_0x4263f9++){var _0x4841ef=events[_0x4263f9];var _0x21ebbb=createListener(_0xa3ee('0x7')+_0x4841ef,_0x3e19e3);MailAccountEvents['on'](_0x4841ef,_0x21ebbb);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index e1bafed..fc93773 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 _0xf56a=['util','path','connect-timeout','fs-extra','../../components/interaction/service','./mailApplication.controller','get','/:id','show','put','update','isAuthenticated','multer'];(function(_0x502b33,_0x50ae8d){var _0x5e2653=function(_0x5705ec){while(--_0x5705ec){_0x502b33['push'](_0x502b33['shift']());}};_0x5e2653(++_0x50ae8d);}(_0xf56a,0x178));var _0xaf56=function(_0x210718,_0x247b55){_0x210718=_0x210718-0x0;var _0x541bfc=_0xf56a[_0x210718];return _0x541bfc;};'use strict';var multer=require(_0xaf56('0x0'));var util=require(_0xaf56('0x1'));var path=require(_0xaf56('0x2'));var timeout=require(_0xaf56('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xaf56('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xaf56('0x5'));var config=require('../../config/environment');var controller=require(_0xaf56('0x6'));router[_0xaf56('0x7')](_0xaf56('0x8'),auth['isAuthenticated'](),controller[_0xaf56('0x9')]);router[_0xaf56('0xa')](_0xaf56('0x8'),auth['isAuthenticated'](),controller[_0xaf56('0xb')]);router['delete']('/:id',auth[_0xaf56('0xc')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xa7d0=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailApplication.controller','get','/:id','isAuthenticated','put','delete','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x249df7,_0x34e4eb){var _0xd7d77f=function(_0x50cebd){while(--_0x50cebd){_0x249df7['push'](_0x249df7['shift']());}};_0xd7d77f(++_0x34e4eb);}(_0xa7d0,0x1d6));var _0x0a7d=function(_0x409f57,_0x527b4a){_0x409f57=_0x409f57-0x0;var _0x420539=_0xa7d0[_0x409f57];return _0x420539;};'use strict';var multer=require(_0x0a7d('0x0'));var util=require(_0x0a7d('0x1'));var path=require(_0x0a7d('0x2'));var timeout=require(_0x0a7d('0x3'));var express=require(_0x0a7d('0x4'));var router=express[_0x0a7d('0x5')]();var fs_extra=require(_0x0a7d('0x6'));var auth=require(_0x0a7d('0x7'));var interaction=require(_0x0a7d('0x8'));var config=require(_0x0a7d('0x9'));var controller=require(_0x0a7d('0xa'));router[_0x0a7d('0xb')](_0x0a7d('0xc'),auth[_0x0a7d('0xd')](),controller['show']);router[_0x0a7d('0xe')](_0x0a7d('0xc'),auth[_0x0a7d('0xd')](),controller['update']);router[_0x0a7d('0xf')](_0x0a7d('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0x0a7d('0x10')]=router; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.attributes.js b/server/api/mailApplication/mailApplication.attributes.js index d0924ee..3b1beb5 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 _0x1215=['*,*,*,*','sequelize','INTEGER','STRING','noop','TEXT'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x1215,0x115));var _0x5121=function(_0x47131b,_0x4750e6){_0x47131b=_0x47131b-0x0;var _0x40ccf1=_0x1215[_0x47131b];return _0x40ccf1;};'use strict';var Sequelize=require(_0x5121('0x0'));module['exports']={'priority':{'type':Sequelize[_0x5121('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x5121('0x2')],'allowNull':![],'defaultValue':_0x5121('0x3')},'appdata':{'type':Sequelize[_0x5121('0x4')]()},'description':{'type':Sequelize[_0x5121('0x2')]},'interval':{'type':Sequelize[_0x5121('0x2')],'defaultValue':_0x5121('0x5')}}; \ No newline at end of file +var _0x5a67=['INTEGER','noop','TEXT','STRING','sequelize','exports'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x5a67,0x70));var _0x75a6=function(_0x2763f2,_0x416af8){_0x2763f2=_0x2763f2-0x0;var _0x3ef471=_0x5a67[_0x2763f2];return _0x3ef471;};'use strict';var Sequelize=require(_0x75a6('0x0'));module[_0x75a6('0x1')]={'priority':{'type':Sequelize[_0x75a6('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x75a6('0x3')},'appdata':{'type':Sequelize[_0x75a6('0x4')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x75a6('0x5')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index 642dd30..82b8c38 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 _0xcb91=['send','show','params','keys','rawAttributes','query','intersection','attributes','fields','length','model','includeAll','include','merge','options','MailApplication','find','catch','body','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','fs-extra','lodash','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','update','then','destroy','error','stack','name'];(function(_0x471204,_0x3ab980){var _0x349fd3=function(_0x1f92fd){while(--_0x1f92fd){_0x471204['push'](_0x471204['shift']());}};_0x349fd3(++_0x3ab980);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x4cce65,_0x40021e){_0x4cce65=_0x4cce65-0x0;var _0x4d1b45=_0xcb91[_0x4cce65];return _0x4d1b45;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x1cb9('0x0'));var jsonpatch=require(_0x1cb9('0x1'));var rp=require(_0x1cb9('0x2'));var moment=require(_0x1cb9('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x1cb9('0x4'));var util=require(_0x1cb9('0x5'));var path=require('path');var sox=require(_0x1cb9('0x6'));var csv=require(_0x1cb9('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1cb9('0x8'));var _=require(_0x1cb9('0x9'));var squel=require('squel');var crypto=require(_0x1cb9('0xa'));var jsforce=require(_0x1cb9('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x1cb9('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x1cb9('0xc'));var authService=require(_0x1cb9('0xd'));var qs=require(_0x1cb9('0xe'));var as=require(_0x1cb9('0xf'));var hardwareService=require(_0x1cb9('0x10'));var logger=require('../../config/logger')(_0x1cb9('0x11'));var utils=require(_0x1cb9('0x12'));var config=require(_0x1cb9('0x13'));var licenseUtil=require(_0x1cb9('0x14'));var db=require(_0x1cb9('0x15'))['db'];function respondWithStatusCode(_0x5445e1,_0x5e3c19){_0x5e3c19=_0x5e3c19||0xcc;return function(_0x59dec3){if(_0x59dec3){return _0x5445e1[_0x1cb9('0x16')](_0x5e3c19);}return _0x5445e1[_0x1cb9('0x17')](_0x5e3c19)[_0x1cb9('0x18')]();};}function respondWithResult(_0x1c714f,_0x56884d){_0x56884d=_0x56884d||0xc8;return function(_0x397727){if(_0x397727){return _0x1c714f[_0x1cb9('0x17')](_0x56884d)[_0x1cb9('0x19')](_0x397727);}};}function respondWithFilteredResult(_0x8dfa55,_0x3e2d11){return function(_0x5806d8){if(_0x5806d8){var _0x5572cb=typeof _0x3e2d11[_0x1cb9('0x1a')]===_0x1cb9('0x1b')&&typeof _0x3e2d11[_0x1cb9('0x1c')]===_0x1cb9('0x1b');var _0x3e21e0=_0x5806d8[_0x1cb9('0x1d')];var _0x23d3a9=_0x5572cb?0x0:_0x3e2d11['offset'];var _0x479d43=_0x5572cb?_0x5806d8[_0x1cb9('0x1d')]:_0x3e2d11[_0x1cb9('0x1a')]+_0x3e2d11[_0x1cb9('0x1c')];var _0x31481a;if(_0x479d43>=_0x3e21e0){_0x479d43=_0x3e21e0;_0x31481a=0xc8;}else{_0x31481a=0xce;}_0x8dfa55[_0x1cb9('0x17')](_0x31481a);return _0x8dfa55[_0x1cb9('0x1e')](_0x1cb9('0x1f'),_0x23d3a9+'-'+_0x479d43+'/'+_0x3e21e0)['json'](_0x5806d8);}return null;};}function patchUpdates(_0x559bcc){return function(_0x1a5a72){try{jsonpatch['apply'](_0x1a5a72,_0x559bcc,!![]);}catch(_0x4750b1){return BPromise[_0x1cb9('0x20')](_0x4750b1);}return _0x1a5a72['save']();};}function saveUpdates(_0x599275,_0x2e3854){return function(_0x325637){if(_0x325637){return _0x325637[_0x1cb9('0x21')](_0x599275)[_0x1cb9('0x22')](function(_0x45b8d3){return _0x45b8d3;});}return null;};}function removeEntity(_0x27db16,_0x59ebea){return function(_0x55b232){if(_0x55b232){return _0x55b232[_0x1cb9('0x23')]()['then'](function(){_0x27db16[_0x1cb9('0x17')](0xcc)[_0x1cb9('0x18')]();});}};}function handleEntityNotFound(_0x69b4c8,_0x44d3c4){return function(_0x43a100){if(!_0x43a100){_0x69b4c8['sendStatus'](0x194);}return _0x43a100;};}function handleError(_0x195f16,_0x9df250){_0x9df250=_0x9df250||0x1f4;return function(_0x4c8d76){logger[_0x1cb9('0x24')](_0x4c8d76[_0x1cb9('0x25')]);if(_0x4c8d76[_0x1cb9('0x26')]){delete _0x4c8d76[_0x1cb9('0x26')];}_0x195f16[_0x1cb9('0x17')](_0x9df250)[_0x1cb9('0x27')](_0x4c8d76);};}exports[_0x1cb9('0x28')]=function(_0xb644b3,_0x41e5c2){var _0x9de64b={'raw':!![],'where':{'id':_0xb644b3[_0x1cb9('0x29')]['id']}},_0x48888d={};_0x48888d['model']=_[_0x1cb9('0x2a')](db['MailApplication'][_0x1cb9('0x2b')]);_0x48888d[_0x1cb9('0x2c')]=_[_0x1cb9('0x2a')](_0xb644b3[_0x1cb9('0x2c')]);_0x48888d['filters']=_[_0x1cb9('0x2d')](_0x48888d['model'],_0x48888d[_0x1cb9('0x2c')]);_0x9de64b[_0x1cb9('0x2e')]=_[_0x1cb9('0x2d')](_0x48888d['model'],qs[_0x1cb9('0x2f')](_0xb644b3['query'][_0x1cb9('0x2f')]));_0x9de64b['attributes']=_0x9de64b[_0x1cb9('0x2e')][_0x1cb9('0x30')]?_0x9de64b[_0x1cb9('0x2e')]:_0x48888d[_0x1cb9('0x31')];if(_0xb644b3['query'][_0x1cb9('0x32')]){_0x9de64b[_0x1cb9('0x33')]=[{'all':!![]}];}_0x9de64b=_[_0x1cb9('0x34')]({},_0x9de64b,_0xb644b3[_0x1cb9('0x35')]);return db[_0x1cb9('0x36')][_0x1cb9('0x37')](_0x9de64b)[_0x1cb9('0x22')](handleEntityNotFound(_0x41e5c2,null))[_0x1cb9('0x22')](respondWithResult(_0x41e5c2,null))[_0x1cb9('0x38')](handleError(_0x41e5c2,null));};exports[_0x1cb9('0x21')]=function(_0x294eec,_0x26b950){if(_0x294eec[_0x1cb9('0x39')]['id']){delete _0x294eec['body']['id'];}return db['MailApplication'][_0x1cb9('0x37')]({'where':{'id':_0x294eec[_0x1cb9('0x29')]['id']}})[_0x1cb9('0x22')](handleEntityNotFound(_0x26b950,null))[_0x1cb9('0x22')](saveUpdates(_0x294eec[_0x1cb9('0x39')],null))[_0x1cb9('0x22')](respondWithResult(_0x26b950,null))[_0x1cb9('0x38')](handleError(_0x26b950,null));};exports[_0x1cb9('0x23')]=function(_0x4d3e39,_0x2aa59b){return db[_0x1cb9('0x36')][_0x1cb9('0x37')]({'where':{'id':_0x4d3e39['params']['id']}})[_0x1cb9('0x22')](handleEntityNotFound(_0x2aa59b,null))['then'](removeEntity(_0x2aa59b,null))[_0x1cb9('0x38')](handleError(_0x2aa59b,null));}; \ No newline at end of file +var _0xe706=['limit','count','offset','set','Content-Range','json','apply','save','update','then','end','name','send','show','params','model','keys','MailApplication','rawAttributes','query','filters','attributes','intersection','fields','length','includeAll','include','merge','options','find','body','catch','destroy','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','undefined'];(function(_0x606fe8,_0x10b084){var _0x28b517=function(_0x5e90f4){while(--_0x5e90f4){_0x606fe8['push'](_0x606fe8['shift']());}};_0x28b517(++_0x10b084);}(_0xe706,0xa3));var _0x6e70=function(_0x5a461e,_0xe83e49){_0x5a461e=_0x5a461e-0x0;var _0x1fac23=_0xe706[_0x5a461e];return _0x1fac23;};'use strict';var emlformat=require(_0x6e70('0x0'));var rimraf=require(_0x6e70('0x1'));var zipdir=require(_0x6e70('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6e70('0x3'));var moment=require(_0x6e70('0x4'));var BPromise=require(_0x6e70('0x5'));var Mustache=require(_0x6e70('0x6'));var util=require(_0x6e70('0x7'));var path=require(_0x6e70('0x8'));var sox=require(_0x6e70('0x9'));var csv=require(_0x6e70('0xa'));var ejs=require(_0x6e70('0xb'));var fs=require('fs');var fs_extra=require(_0x6e70('0xc'));var _=require(_0x6e70('0xd'));var squel=require(_0x6e70('0xe'));var crypto=require(_0x6e70('0xf'));var jsforce=require(_0x6e70('0x10'));var deskjs=require(_0x6e70('0x11'));var toCsv=require(_0x6e70('0xa'));var querystring=require(_0x6e70('0x12'));var Papa=require(_0x6e70('0x13'));var Redis=require(_0x6e70('0x14'));var authService=require(_0x6e70('0x15'));var qs=require(_0x6e70('0x16'));var as=require(_0x6e70('0x17'));var hardwareService=require(_0x6e70('0x18'));var logger=require(_0x6e70('0x19'))('api');var utils=require('../../config/utils');var config=require(_0x6e70('0x1a'));var licenseUtil=require(_0x6e70('0x1b'));var db=require(_0x6e70('0x1c'))['db'];function respondWithStatusCode(_0x27dd9b,_0x3b38f3){_0x3b38f3=_0x3b38f3||0xcc;return function(_0x310eb7){if(_0x310eb7){return _0x27dd9b[_0x6e70('0x1d')](_0x3b38f3);}return _0x27dd9b[_0x6e70('0x1e')](_0x3b38f3)['end']();};}function respondWithResult(_0x52737e,_0x48bc72){_0x48bc72=_0x48bc72||0xc8;return function(_0x257e81){if(_0x257e81){return _0x52737e['status'](_0x48bc72)['json'](_0x257e81);}};}function respondWithFilteredResult(_0x304716,_0x22c50c){return function(_0x5d9263){if(_0x5d9263){var _0x24f3ac=typeof _0x22c50c['offset']===_0x6e70('0x1f')&&typeof _0x22c50c[_0x6e70('0x20')]==='undefined';var _0x49029f=_0x5d9263[_0x6e70('0x21')];var _0x5ea7a5=_0x24f3ac?0x0:_0x22c50c[_0x6e70('0x22')];var _0x173afe=_0x24f3ac?_0x5d9263['count']:_0x22c50c['offset']+_0x22c50c[_0x6e70('0x20')];var _0x208e21;if(_0x173afe>=_0x49029f){_0x173afe=_0x49029f;_0x208e21=0xc8;}else{_0x208e21=0xce;}_0x304716[_0x6e70('0x1e')](_0x208e21);return _0x304716[_0x6e70('0x23')](_0x6e70('0x24'),_0x5ea7a5+'-'+_0x173afe+'/'+_0x49029f)[_0x6e70('0x25')](_0x5d9263);}return null;};}function patchUpdates(_0x1b2453){return function(_0x44a49f){try{jsonpatch[_0x6e70('0x26')](_0x44a49f,_0x1b2453,!![]);}catch(_0xb29a2a){return BPromise['reject'](_0xb29a2a);}return _0x44a49f[_0x6e70('0x27')]();};}function saveUpdates(_0x344b65,_0x27b294){return function(_0x502b2d){if(_0x502b2d){return _0x502b2d[_0x6e70('0x28')](_0x344b65)[_0x6e70('0x29')](function(_0x3337a6){return _0x3337a6;});}return null;};}function removeEntity(_0x50da2c,_0x10fc91){return function(_0x538b9c){if(_0x538b9c){return _0x538b9c['destroy']()['then'](function(){_0x50da2c[_0x6e70('0x1e')](0xcc)[_0x6e70('0x2a')]();});}};}function handleEntityNotFound(_0x51d292,_0x3ecdf1){return function(_0x1196ed){if(!_0x1196ed){_0x51d292['sendStatus'](0x194);}return _0x1196ed;};}function handleError(_0x338ad6,_0x67fb43){_0x67fb43=_0x67fb43||0x1f4;return function(_0x2bb231){logger['error'](_0x2bb231['stack']);if(_0x2bb231[_0x6e70('0x2b')]){delete _0x2bb231[_0x6e70('0x2b')];}_0x338ad6[_0x6e70('0x1e')](_0x67fb43)[_0x6e70('0x2c')](_0x2bb231);};}exports[_0x6e70('0x2d')]=function(_0x5d772a,_0x1952ea){var _0x406f29={'raw':!![],'where':{'id':_0x5d772a[_0x6e70('0x2e')]['id']}},_0xecf336={};_0xecf336[_0x6e70('0x2f')]=_[_0x6e70('0x30')](db[_0x6e70('0x31')][_0x6e70('0x32')]);_0xecf336[_0x6e70('0x33')]=_[_0x6e70('0x30')](_0x5d772a['query']);_0xecf336[_0x6e70('0x34')]=_['intersection'](_0xecf336[_0x6e70('0x2f')],_0xecf336['query']);_0x406f29[_0x6e70('0x35')]=_[_0x6e70('0x36')](_0xecf336[_0x6e70('0x2f')],qs['fields'](_0x5d772a[_0x6e70('0x33')][_0x6e70('0x37')]));_0x406f29['attributes']=_0x406f29[_0x6e70('0x35')][_0x6e70('0x38')]?_0x406f29['attributes']:_0xecf336[_0x6e70('0x2f')];if(_0x5d772a[_0x6e70('0x33')][_0x6e70('0x39')]){_0x406f29[_0x6e70('0x3a')]=[{'all':!![]}];}_0x406f29=_[_0x6e70('0x3b')]({},_0x406f29,_0x5d772a[_0x6e70('0x3c')]);return db[_0x6e70('0x31')][_0x6e70('0x3d')](_0x406f29)[_0x6e70('0x29')](handleEntityNotFound(_0x1952ea,null))[_0x6e70('0x29')](respondWithResult(_0x1952ea,null))['catch'](handleError(_0x1952ea,null));};exports[_0x6e70('0x28')]=function(_0x4795a0,_0x23cd1a){if(_0x4795a0[_0x6e70('0x3e')]['id']){delete _0x4795a0[_0x6e70('0x3e')]['id'];}return db[_0x6e70('0x31')][_0x6e70('0x3d')]({'where':{'id':_0x4795a0[_0x6e70('0x2e')]['id']}})[_0x6e70('0x29')](handleEntityNotFound(_0x23cd1a,null))[_0x6e70('0x29')](saveUpdates(_0x4795a0[_0x6e70('0x3e')],null))[_0x6e70('0x29')](respondWithResult(_0x23cd1a,null))[_0x6e70('0x3f')](handleError(_0x23cd1a,null));};exports[_0x6e70('0x40')]=function(_0x5594d3,_0x501b53){return db['MailApplication']['find']({'where':{'id':_0x5594d3[_0x6e70('0x2e')]['id']}})[_0x6e70('0x29')](handleEntityNotFound(_0x501b53,null))[_0x6e70('0x29')](removeEntity(_0x501b53,null))[_0x6e70('0x3f')](handleError(_0x501b53,null));}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.model.js b/server/api/mailApplication/mailApplication.model.js index c0d9805..60ea095 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 _0x2a7d=['MailApplication','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./mailApplication.attributes','exports','define'];(function(_0x5570c2,_0x12c406){var _0x1f320c=function(_0x242a06){while(--_0x242a06){_0x5570c2['push'](_0x5570c2['shift']());}};_0x1f320c(++_0x12c406);}(_0x2a7d,0xc6));var _0xd2a7=function(_0x46720b,_0x232685){_0x46720b=_0x46720b-0x0;var _0x2de15c=_0x2a7d[_0x46720b];return _0x2de15c;};'use strict';var _=require(_0xd2a7('0x0'));var util=require(_0xd2a7('0x1'));var logger=require(_0xd2a7('0x2'))(_0xd2a7('0x3'));var moment=require(_0xd2a7('0x4'));var BPromise=require(_0xd2a7('0x5'));var rp=require(_0xd2a7('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd2a7('0x7'));var config=require(_0xd2a7('0x8'));var attributes=require(_0xd2a7('0x9'));module[_0xd2a7('0xa')]=function(_0x496877,_0x33f5f2){return _0x496877[_0xd2a7('0xb')](_0xd2a7('0xc'),attributes,{'tableName':'mail_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xd2a7('0xd')});}; \ No newline at end of file +var _0x3ac9=['utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./mailApplication.attributes','define','MailApplication'];(function(_0x4a8791,_0x362a48){var _0xa8bdba=function(_0x4ad336){while(--_0x4ad336){_0x4a8791['push'](_0x4a8791['shift']());}};_0xa8bdba(++_0x362a48);}(_0x3ac9,0x16e));var _0x93ac=function(_0x21a0c5,_0x586032){_0x21a0c5=_0x21a0c5-0x0;var _0x13d439=_0x3ac9[_0x21a0c5];return _0x13d439;};'use strict';var _=require(_0x93ac('0x0'));var util=require(_0x93ac('0x1'));var logger=require(_0x93ac('0x2'))(_0x93ac('0x3'));var moment=require(_0x93ac('0x4'));var BPromise=require(_0x93ac('0x5'));var rp=require(_0x93ac('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x93ac('0x7'));var config=require(_0x93ac('0x8'));var attributes=require(_0x93ac('0x9'));module['exports']=function(_0x37f31d,_0x26f972){return _0x37f31d[_0x93ac('0xa')](_0x93ac('0xb'),attributes,{'tableName':'mail_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x93ac('0xc'),'collate':_0x93ac('0xd')});}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.rpc.js b/server/api/mailApplication/mailApplication.rpc.js index 3f94e38..1316a4f 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 _0x5d9d=['catch','MailApplication','body','options','raw','where','attributes','UpdateMailApplication','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','http','then','debug','request\x20sent','stringify','error','code','MailApplication,\x20%s,\x20%s','message','info','result'];(function(_0x1983ec,_0x2aa4a2){var _0x46d9dc=function(_0xb7e303){while(--_0xb7e303){_0x1983ec['push'](_0x1983ec['shift']());}};_0x46d9dc(++_0x2aa4a2);}(_0x5d9d,0xcc));var _0xd5d9=function(_0x3f45fb,_0x5d9ea1){_0x3f45fb=_0x3f45fb-0x0;var _0x113f7a=_0x5d9d[_0x3f45fb];return _0x113f7a;};'use strict';var _=require('lodash');var util=require(_0xd5d9('0x0'));var moment=require(_0xd5d9('0x1'));var BPromise=require(_0xd5d9('0x2'));var rs=require(_0xd5d9('0x3'));var fs=require('fs');var Redis=require(_0xd5d9('0x4'));var db=require(_0xd5d9('0x5'))['db'];var utils=require(_0xd5d9('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xd5d9('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xd5d9('0x8')][_0xd5d9('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x9db4db,_0x216b07,_0x4918ad){return new BPromise(function(_0x12df13,_0x396244){return client['request'](_0x9db4db,_0x4918ad)[_0xd5d9('0xa')](function(_0x401a9a){logger['info']('MailApplication,\x20%s,\x20%s',_0x216b07,'request\x20sent');logger[_0xd5d9('0xb')]('MailApplication,\x20%s,\x20%s,\x20%s',_0x216b07,_0xd5d9('0xc'),JSON[_0xd5d9('0xd')](_0x401a9a));if(_0x401a9a['error']){if(_0x401a9a[_0xd5d9('0xe')][_0xd5d9('0xf')]===0x1f4){logger[_0xd5d9('0xe')](_0xd5d9('0x10'),_0x216b07,_0x401a9a[_0xd5d9('0xe')][_0xd5d9('0x11')]);return _0x396244(_0x401a9a[_0xd5d9('0xe')]['message']);}logger[_0xd5d9('0xe')](_0xd5d9('0x10'),_0x216b07,_0x401a9a[_0xd5d9('0xe')]['message']);return _0x12df13(_0x401a9a[_0xd5d9('0xe')][_0xd5d9('0x11')]);}else{logger[_0xd5d9('0x12')](_0xd5d9('0x10'),_0x216b07,_0xd5d9('0xc'));_0x12df13(_0x401a9a[_0xd5d9('0x13')][_0xd5d9('0x11')]);}})[_0xd5d9('0x14')](function(_0x2f2733){logger['error'](_0xd5d9('0x10'),_0x216b07,_0x2f2733);_0x396244(_0x2f2733);});});}exports['UpdateMailApplication']=function(_0x456587){var _0x3c81cc=this;return new Promise(function(_0x499e67,_0x18c8c9){return db[_0xd5d9('0x15')]['update'](_0x456587[_0xd5d9('0x16')],{'raw':_0x456587[_0xd5d9('0x17')]?_0x456587['options'][_0xd5d9('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x456587[_0xd5d9('0x17')]?_0x456587[_0xd5d9('0x17')][_0xd5d9('0x19')]||null:null,'attributes':_0x456587[_0xd5d9('0x17')]?_0x456587[_0xd5d9('0x17')][_0xd5d9('0x1a')]||null:null,'limit':_0x456587[_0xd5d9('0x17')]?_0x456587[_0xd5d9('0x17')]['limit']||null:null})[_0xd5d9('0xa')](function(_0x586498){logger[_0xd5d9('0x12')]('UpdateMailApplication',_0x456587);logger[_0xd5d9('0xb')](_0xd5d9('0x1b'),_0x456587,JSON[_0xd5d9('0xd')](_0x586498));_0x499e67(_0x586498);})[_0xd5d9('0x14')](function(_0xb2245f){logger[_0xd5d9('0xe')](_0xd5d9('0x1b'),_0xb2245f[_0xd5d9('0x11')],_0x456587);_0x18c8c9(_0x3c81cc[_0xd5d9('0xe')](0x1f4,_0xb2245f[_0xd5d9('0x11')]));});});}; \ No newline at end of file +var _0xb4aa=['ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','MailApplication,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','MailApplication','update','body','raw','options','where','limit','UpdateMailApplication','lodash','util','moment','bluebird','randomstring'];(function(_0x45facf,_0x3ed4dd){var _0x1781de=function(_0x2037f7){while(--_0x2037f7){_0x45facf['push'](_0x45facf['shift']());}};_0x1781de(++_0x3ed4dd);}(_0xb4aa,0x1db));var _0xab4a=function(_0x31a577,_0x8a3c76){_0x31a577=_0x31a577-0x0;var _0x2769df=_0xb4aa[_0x31a577];return _0x2769df;};'use strict';var _=require(_0xab4a('0x0'));var util=require(_0xab4a('0x1'));var moment=require(_0xab4a('0x2'));var BPromise=require(_0xab4a('0x3'));var rs=require(_0xab4a('0x4'));var fs=require('fs');var Redis=require(_0xab4a('0x5'));var db=require(_0xab4a('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xab4a('0x7'));var config=require(_0xab4a('0x8'));var jayson=require(_0xab4a('0x9'));var client=jayson[_0xab4a('0xa')][_0xab4a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1d7266,_0x27a044,_0x46dff8){return new BPromise(function(_0x46b781,_0x248629){return client[_0xab4a('0xc')](_0x1d7266,_0x46dff8)[_0xab4a('0xd')](function(_0x3dbf32){logger[_0xab4a('0xe')](_0xab4a('0xf'),_0x27a044,_0xab4a('0x10'));logger[_0xab4a('0x11')]('MailApplication,\x20%s,\x20%s,\x20%s',_0x27a044,_0xab4a('0x10'),JSON[_0xab4a('0x12')](_0x3dbf32));if(_0x3dbf32[_0xab4a('0x13')]){if(_0x3dbf32[_0xab4a('0x13')][_0xab4a('0x14')]===0x1f4){logger[_0xab4a('0x13')](_0xab4a('0xf'),_0x27a044,_0x3dbf32[_0xab4a('0x13')][_0xab4a('0x15')]);return _0x248629(_0x3dbf32['error'][_0xab4a('0x15')]);}logger[_0xab4a('0x13')](_0xab4a('0xf'),_0x27a044,_0x3dbf32['error'][_0xab4a('0x15')]);return _0x46b781(_0x3dbf32[_0xab4a('0x13')][_0xab4a('0x15')]);}else{logger[_0xab4a('0xe')]('MailApplication,\x20%s,\x20%s',_0x27a044,'request\x20sent');_0x46b781(_0x3dbf32[_0xab4a('0x16')][_0xab4a('0x15')]);}})[_0xab4a('0x17')](function(_0x238f69){logger[_0xab4a('0x13')]('MailApplication,\x20%s,\x20%s',_0x27a044,_0x238f69);_0x248629(_0x238f69);});});}exports['UpdateMailApplication']=function(_0x4f50f9){var _0x4da448=this;return new Promise(function(_0x4f4a7b,_0x19cb38){return db[_0xab4a('0x18')][_0xab4a('0x19')](_0x4f50f9[_0xab4a('0x1a')],{'raw':_0x4f50f9['options']?_0x4f50f9['options'][_0xab4a('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4f50f9['options']?_0x4f50f9[_0xab4a('0x1c')][_0xab4a('0x1d')]||null:null,'attributes':_0x4f50f9['options']?_0x4f50f9['options']['attributes']||null:null,'limit':_0x4f50f9[_0xab4a('0x1c')]?_0x4f50f9[_0xab4a('0x1c')][_0xab4a('0x1e')]||null:null})[_0xab4a('0xd')](function(_0x1f5de2){logger['info'](_0xab4a('0x1f'),_0x4f50f9);logger[_0xab4a('0x11')](_0xab4a('0x1f'),_0x4f50f9,JSON[_0xab4a('0x12')](_0x1f5de2));_0x4f4a7b(_0x1f5de2);})[_0xab4a('0x17')](function(_0x3ecc78){logger[_0xab4a('0x13')](_0xab4a('0x1f'),_0x3ecc78[_0xab4a('0x15')],_0x4f50f9);_0x19cb38(_0x4da448[_0xab4a('0x13')](0x1f4,_0x3ecc78[_0xab4a('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index 38dff3d..32ced71 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 _0x5257=['download','post','addMessage','/:id/tags','mail','mailinteraction:addtags','put','mailinteraction:update','update','delete','tracked','destroy','removeTags','exports','express','../../components/auth/service','../../components/interaction/service','./mailInteraction.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/messages'];(function(_0x4de877,_0x340170){var _0xb2cfeb=function(_0x488634){while(--_0x488634){_0x4de877['push'](_0x4de877['shift']());}};_0xb2cfeb(++_0x340170);}(_0x5257,0x72));var _0x7525=function(_0x119d5a,_0x19b457){_0x119d5a=_0x119d5a-0x0;var _0x15bff4=_0x5257[_0x119d5a];return _0x15bff4;};'use strict';var express=require(_0x7525('0x0'));var router=express['Router']();var auth=require(_0x7525('0x1'));var interaction=require(_0x7525('0x2'));var controller=require(_0x7525('0x3'));router[_0x7525('0x4')]('/',auth[_0x7525('0x5')](),controller['index']);router['get'](_0x7525('0x6'),auth['isAuthenticated'](),controller[_0x7525('0x7')]);router[_0x7525('0x4')](_0x7525('0x8'),auth[_0x7525('0x5')](),controller[_0x7525('0x9')]);router[_0x7525('0x4')](_0x7525('0xa'),auth[_0x7525('0x5')](),controller['getMessages']);router[_0x7525('0x4')]('/:id/download',auth[_0x7525('0x5')](),controller[_0x7525('0xb')]);router['post']('/',auth[_0x7525('0x5')](),controller['create']);router[_0x7525('0xc')](_0x7525('0xa'),auth[_0x7525('0x5')](),controller[_0x7525('0xd')]);router['post'](_0x7525('0xe'),auth[_0x7525('0x5')](),interaction['tracked'](_0x7525('0xf'),_0x7525('0x10')),controller['addTags']);router[_0x7525('0x11')]('/:id',auth[_0x7525('0x5')](),interaction['tracked'](_0x7525('0xf'),_0x7525('0x12')),controller[_0x7525('0x13')]);router[_0x7525('0x14')]('/:id',auth[_0x7525('0x5')](),interaction[_0x7525('0x15')](_0x7525('0xf'),'mailinteraction:destroy'),controller[_0x7525('0x16')]);router['delete'](_0x7525('0xe'),auth[_0x7525('0x5')](),controller[_0x7525('0x17')]);module[_0x7525('0x18')]=router; \ No newline at end of file +var _0x940c=['mail','addTags','put','mailinteraction:update','delete','tracked','mailinteraction:destroy','destroy','removeTags','exports','express','../../components/auth/service','../../components/interaction/service','./mailInteraction.controller','get','/describe','describe','/:id','isAuthenticated','getMessages','download','create','post','/:id/messages','/:id/tags'];(function(_0x5b311b,_0x3e0280){var _0x4fa0de=function(_0x5363ed){while(--_0x5363ed){_0x5b311b['push'](_0x5b311b['shift']());}};_0x4fa0de(++_0x3e0280);}(_0x940c,0x1b3));var _0xc940=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x940c[_0x3dd15e];return _0x231fd0;};'use strict';var express=require(_0xc940('0x0'));var router=express['Router']();var auth=require(_0xc940('0x1'));var interaction=require(_0xc940('0x2'));var controller=require(_0xc940('0x3'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xc940('0x4')](_0xc940('0x5'),auth['isAuthenticated'](),controller[_0xc940('0x6')]);router[_0xc940('0x4')](_0xc940('0x7'),auth[_0xc940('0x8')](),controller['show']);router[_0xc940('0x4')]('/:id/messages',auth[_0xc940('0x8')](),controller[_0xc940('0x9')]);router[_0xc940('0x4')]('/:id/download',auth[_0xc940('0x8')](),controller[_0xc940('0xa')]);router['post']('/',auth['isAuthenticated'](),controller[_0xc940('0xb')]);router[_0xc940('0xc')](_0xc940('0xd'),auth[_0xc940('0x8')](),controller['addMessage']);router[_0xc940('0xc')](_0xc940('0xe'),auth[_0xc940('0x8')](),interaction['tracked'](_0xc940('0xf'),'mailinteraction:addtags'),controller[_0xc940('0x10')]);router[_0xc940('0x11')](_0xc940('0x7'),auth[_0xc940('0x8')](),interaction['tracked'](_0xc940('0xf'),_0xc940('0x12')),controller['update']);router[_0xc940('0x13')](_0xc940('0x7'),auth[_0xc940('0x8')](),interaction[_0xc940('0x14')](_0xc940('0xf'),_0xc940('0x15')),controller[_0xc940('0x16')]);router['delete'](_0xc940('0xe'),auth[_0xc940('0x8')](),controller[_0xc940('0x17')]);module[_0xc940('0x18')]=router; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.attributes.js b/server/api/mailInteraction/mailInteraction.attributes.js index a7e00b6..ef5d79c 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 _0xc298=['ENUM','out','iconv','BOOLEAN','STRING','TEXT','long','DATE'];(function(_0xdc9149,_0x2a85ab){var _0x4c18be=function(_0x236b45){while(--_0x236b45){_0xdc9149['push'](_0xdc9149['shift']());}};_0x4c18be(++_0x2a85ab);}(_0xc298,0x142));var _0x8c29=function(_0x5b1687,_0x557f6c){_0x5b1687=_0x5b1687-0x0;var _0x5f57cb=_0xc298[_0x5b1687];return _0x5f57cb;};'use strict';var Sequelize=require('sequelize');var iconv=require(_0x8c29('0x0'));module['exports']={'closed':{'type':Sequelize[_0x8c29('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x8c29('0x2')]},'secondDisposition':{'type':Sequelize[_0x8c29('0x2')]},'thirdDisposition':{'type':Sequelize[_0x8c29('0x2')]},'note':{'type':Sequelize[_0x8c29('0x2')]},'inReplyTo':{'type':Sequelize[_0x8c29('0x2')](0x1fe)},'to':{'type':Sequelize[_0x8c29('0x2')]},'cc':{'type':Sequelize[_0x8c29('0x3')](_0x8c29('0x4'))},'subject':{'type':Sequelize['TEXT']()},'attach':{'type':Sequelize[_0x8c29('0x1')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0x8c29('0x5')]},'substatus':{'type':Sequelize[_0x8c29('0x2')](0x3c)},'substatusAt':{'type':Sequelize[_0x8c29('0x5')]},'firstMsgDirection':{'type':Sequelize[_0x8c29('0x6')]('in',_0x8c29('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x8c29('0x5')]},'lastMsgDirection':{'type':Sequelize[_0x8c29('0x6')]('in',_0x8c29('0x7')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x8c29('0x1')],'defaultValue':![]}}; \ No newline at end of file +var _0x926e=['iconv','exports','BOOLEAN','DATE','STRING','TEXT','out','ENUM','sequelize'];(function(_0x71c2ac,_0x32eb1f){var _0x47582e=function(_0x2365f8){while(--_0x2365f8){_0x71c2ac['push'](_0x71c2ac['shift']());}};_0x47582e(++_0x32eb1f);}(_0x926e,0x1e5));var _0xe926=function(_0x917ac,_0x379435){_0x917ac=_0x917ac-0x0;var _0xec149c=_0x926e[_0x917ac];return _0xec149c;};'use strict';var Sequelize=require(_0xe926('0x0'));var iconv=require(_0xe926('0x1'));module[_0xe926('0x2')]={'closed':{'type':Sequelize[_0xe926('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xe926('0x4')]},'disposition':{'type':Sequelize[_0xe926('0x5')]},'secondDisposition':{'type':Sequelize[_0xe926('0x5')]},'thirdDisposition':{'type':Sequelize[_0xe926('0x5')]},'note':{'type':Sequelize[_0xe926('0x5')]},'inReplyTo':{'type':Sequelize[_0xe926('0x5')](0x1fe)},'to':{'type':Sequelize[_0xe926('0x5')]},'cc':{'type':Sequelize[_0xe926('0x6')]('long')},'subject':{'type':Sequelize['TEXT']()},'attach':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0xe926('0x4')]},'substatus':{'type':Sequelize['STRING'](0x3c)},'substatusAt':{'type':Sequelize[_0xe926('0x4')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0xe926('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0xe926('0x8')]('in',_0xe926('0x7')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xe926('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.controller.js b/server/api/mailInteraction/mailInteraction.controller.js index add40d7..a97c4cd 100644 --- a/server/api/mailInteraction/mailInteraction.controller.js +++ b/server/api/mailInteraction/mailInteraction.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','groupBy','Setting','enableEmailPreview','all','rows','show','params','includeAll','include','options','create','body','addMessage','ids','omit','getMessages','nolimit','MailInteractionId','format','YYYY-MM-DD\x20HH:mm:ss','findAll','inlineCss','true','addTags','setTags','Tag','mailInteractionTags:save','download','join','root','server','tmp','attachments','Attachment','Attachments','subject','Messages','get','mkdirSync','each','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','bcc','Bcc','basename','existsSync','readFileSync','writeFileSync','message%d.eml','unlinkSync','eml-format','rimraf','zip-dir','util','lodash','squel','juice','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','defaults','socket.io-emitter','redis','./mailInteraction.socket','register','status','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','end','sendStatus','error','stack','name','send','Users','fullname','Tags','split','forEach','push','TagIds','MailMessage','findOne','out','-id','plainBody','lastMsgText','trimStart','catch','index','MailInteraction','rawAttributes','fieldName','key','model','map','query','intersection','attributes','fields','length','hasOwnProperty','sort','filters','pick','select','field','color','from','tools_tags','u.id','u.fullname','ui.MailInteractionId','user_has_mail_interactions','left_join','users','u.id\x20=\x20ui.UserId','mail_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','a.id\x20=\x20i.MailAccountId','mail_messages','me.MailInteractionId\x20=\x20i.id','it.MailInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','value','having','`\x20>\x200','Contact','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','type','text','start','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','operator','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','buildExpression','keys','some','compact','where','i.MailAccountId\x20IN\x20?','concat','createdAt','parse','$gte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','isArray','tag','filter','replace','isNumeric','i.id\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','group','QueryTypes','SELECT','clone','i.id','order','contactName','DESC','t.id\x20IN\x20?','resolve','MailAccountId','i.MailAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getMailAccounts','i.MailAccountId\x20IS\x20NULL','sequelize','toString','merge','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','Account.key','Account.mandatoryDisposition','i.createdAt','i.updatedAt','i.closed','i.closedAt','i.attach','i.lastMsgDirection','i.disposition','i.secondDisposition','i.thirdDisposition','i.substatus','i.to','i.MailAccountId','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname'];(function(_0x595dd0,_0x1473e4){var _0x9e3cde=function(_0x4e0471){while(--_0x4e0471){_0x595dd0['push'](_0x595dd0['shift']());}};_0x9e3cde(++_0x1473e4);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1cfa0d,_0x4391f2){_0x1cfa0d=_0x1cfa0d-0x0;var _0xe33279=_0xa9e0[_0x1cfa0d];return _0xe33279;};'use strict';var emlformat=require(_0x0a9e('0x0'));var rimraf=require(_0x0a9e('0x1'));var zipdir=require(_0x0a9e('0x2'));var moment=require('moment');var BPromise=require('bluebird');var util=require(_0x0a9e('0x3'));var path=require('path');var fs=require('fs');var _=require(_0x0a9e('0x4'));var squel=require(_0x0a9e('0x5'));var juice=require(_0x0a9e('0x6'));var Redis=require(_0x0a9e('0x7'));var qs=require(_0x0a9e('0x8'));var as=require('../../components/parsers/advancedSearch');var logger=require(_0x0a9e('0x9'))(_0x0a9e('0xa'));var config=require(_0x0a9e('0xb'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x0a9e('0xc')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x0a9e('0xd'))(new Redis(config[_0x0a9e('0xe')]));require(_0x0a9e('0xf'))[_0x0a9e('0x10')](socket);function respondWithStatusCode(_0xfeb75b,_0xbd1168){_0xbd1168=_0xbd1168||0xcc;return function(_0x4a4c56){if(_0x4a4c56){return _0xfeb75b['sendStatus'](_0xbd1168);}return _0xfeb75b['status'](_0xbd1168)['end']();};}function respondWithResult(_0x273d4d,_0x36471c){_0x36471c=_0x36471c||0xc8;return function(_0xd5b662){if(_0xd5b662){return _0x273d4d[_0x0a9e('0x11')](_0x36471c)[_0x0a9e('0x12')](_0xd5b662);}};}function respondWithFilteredResult(_0x69aeb7,_0x5db4b0){return function(_0x4283ce){if(_0x4283ce){var _0x239b12=typeof _0x5db4b0[_0x0a9e('0x13')]===_0x0a9e('0x14')&&typeof _0x5db4b0[_0x0a9e('0x15')]===_0x0a9e('0x14');var _0x52a03d=_0x4283ce[_0x0a9e('0x16')];var _0x5d0880=_0x239b12?0x0:_0x5db4b0[_0x0a9e('0x13')];var _0x519dfd=_0x239b12?_0x4283ce[_0x0a9e('0x16')]:_0x5db4b0[_0x0a9e('0x13')]+_0x5db4b0['limit'];var _0x225616;if(_0x519dfd>=_0x52a03d){_0x519dfd=_0x52a03d;_0x225616=0xc8;}else{_0x225616=0xce;}_0x69aeb7['status'](_0x225616);return _0x69aeb7[_0x0a9e('0x17')](_0x0a9e('0x18'),_0x5d0880+'-'+_0x519dfd+'/'+_0x52a03d)[_0x0a9e('0x12')](_0x4283ce);}return null;};}function saveUpdates(_0x205fd6){return function(_0x31b1ca){if(_0x31b1ca){return _0x31b1ca[_0x0a9e('0x19')](_0x205fd6)[_0x0a9e('0x1a')](function(_0x20559e){return _0x20559e;});}return null;};}function removeEntity(_0x1314ae){return function(_0x112016){if(_0x112016){return _0x112016[_0x0a9e('0x1b')]()[_0x0a9e('0x1a')](function(){_0x1314ae['status'](0xcc)[_0x0a9e('0x1c')]();});}};}function handleEntityNotFound(_0x155cce){return function(_0x53682f){if(!_0x53682f){_0x155cce[_0x0a9e('0x1d')](0x194);}return _0x53682f;};}function handleError(_0x5a09ef,_0x588269){_0x588269=_0x588269||0x1f4;return function(_0x3a02e1){logger[_0x0a9e('0x1e')](_0x3a02e1[_0x0a9e('0x1f')]);if(_0x3a02e1[_0x0a9e('0x20')]){delete _0x3a02e1['name'];}_0x5a09ef[_0x0a9e('0x11')](_0x588269)[_0x0a9e('0x21')](_0x3a02e1);};}function getInteractionUsers(_0x3b45bc,_0x4d00e6){return new BPromise(function(_0x370d86,_0x42ac8f){try{if(_0x4d00e6[_0x3b45bc['id']]){_0x3b45bc[_0x0a9e('0x22')]=_['map'](_0x4d00e6[_0x3b45bc['id']],function(_0x59181e){return{'id':_0x59181e['id'],'fullname':_0x59181e[_0x0a9e('0x23')]};});}}catch(_0x3a8e58){_0x42ac8f(_0x3a8e58);}_0x370d86(_0x3b45bc);});}function getInteractionTags(_0x40c424,_0x33161b){return new BPromise(function(_0x526cf3,_0x384319){try{if(_0x40c424['TagIds']){_0x40c424[_0x0a9e('0x24')]=[];_0x40c424['TagIds'][_0x0a9e('0x25')](',')[_0x0a9e('0x26')](function(_0x25fba9){_0x40c424[_0x0a9e('0x24')][_0x0a9e('0x27')](_0x33161b[_0x25fba9]);});}delete _0x40c424[_0x0a9e('0x28')];}catch(_0x11c3b6){_0x384319(_0x11c3b6);}_0x526cf3(_0x40c424);});}function getLastMessageText(_0x14de77){return new BPromise(function(_0x5a101a,_0x3652a7){return db[_0x0a9e('0x29')][_0x0a9e('0x2a')]({'where':{'$and':[{'MailInteractionId':_0x14de77['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0x0a9e('0x2b')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':['plainBody'],'order':_0x0a9e('0x2c'),'raw':!![]})[_0x0a9e('0x1a')](function(_0x1843b2){if(_0x1843b2&&_0x1843b2[_0x0a9e('0x2d')]){_0x14de77[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x1843b2[_0x0a9e('0x2d')]);}_0x5a101a(_0x14de77);})[_0x0a9e('0x30')](function(_0x1dbde2){_0x3652a7(_0x1dbde2);});});}function updateMailInteraction(_0x540530,_0x426950,_0x5d1e0e,_0x2407f9){return new BPromise(function(_0x3ae878,_0x1122db){return getInteractionUsers(_0x540530,_0x5d1e0e)[_0x0a9e('0x1a')](function(_0x25ce3a){return getInteractionTags(_0x25ce3a,_0x426950);})['then'](function(_0x66c1d2){if(_0x2407f9){_0x3ae878(getLastMessageText(_0x66c1d2));}else{_0x3ae878(_0x66c1d2);}})[_0x0a9e('0x30')](function(_0x40cb85){_0x1122db(_0x40cb85);});});}exports[_0x0a9e('0x31')]=function(_0x2b45ea,_0x409319){var _0x332d35={},_0x39e565={},_0x5583a4={'count':0x0,'rows':[]};var _0x44295a=_['map'](db[_0x0a9e('0x32')][_0x0a9e('0x33')],function(_0x2b7e7f){return{'name':_0x2b7e7f[_0x0a9e('0x34')],'type':_0x2b7e7f['type'][_0x0a9e('0x35')]};});_0x39e565[_0x0a9e('0x36')]=_[_0x0a9e('0x37')](_0x44295a,_0x0a9e('0x20'));_0x39e565['query']=_['keys'](_0x2b45ea[_0x0a9e('0x38')]);_0x39e565['filters']=_[_0x0a9e('0x39')](_0x39e565[_0x0a9e('0x36')],_0x39e565[_0x0a9e('0x38')]);_0x332d35[_0x0a9e('0x3a')]=_['intersection'](_0x39e565[_0x0a9e('0x36')],qs[_0x0a9e('0x3b')](_0x2b45ea[_0x0a9e('0x38')]['fields']));_0x332d35[_0x0a9e('0x3a')]=_0x332d35[_0x0a9e('0x3a')][_0x0a9e('0x3c')]?_0x332d35['attributes']:_0x39e565['model'];if(!_0x2b45ea[_0x0a9e('0x38')][_0x0a9e('0x3d')]('nolimit')){_0x332d35[_0x0a9e('0x15')]=qs[_0x0a9e('0x15')](_0x2b45ea[_0x0a9e('0x38')][_0x0a9e('0x15')]);_0x332d35['offset']=qs['offset'](_0x2b45ea[_0x0a9e('0x38')][_0x0a9e('0x13')]);}_0x332d35['order']=qs[_0x0a9e('0x3e')](_0x2b45ea[_0x0a9e('0x38')][_0x0a9e('0x3e')]);_0x332d35['where']=qs[_0x0a9e('0x3f')](_[_0x0a9e('0x40')](_0x2b45ea[_0x0a9e('0x38')],_0x39e565[_0x0a9e('0x3f')]),_0x44295a);var _0x13cb1f=[];var _0xeaa5e5=squel[_0x0a9e('0x41')]()[_0x0a9e('0x42')]('id')[_0x0a9e('0x42')](_0x0a9e('0x20'))[_0x0a9e('0x42')](_0x0a9e('0x43'))[_0x0a9e('0x44')](_0x0a9e('0x45'));var _0x37f6cc=squel['select']()['field'](_0x0a9e('0x46'))[_0x0a9e('0x42')](_0x0a9e('0x47'))[_0x0a9e('0x42')](_0x0a9e('0x48'))[_0x0a9e('0x44')](_0x0a9e('0x49'),'ui')[_0x0a9e('0x4a')](_0x0a9e('0x4b'),'u',_0x0a9e('0x4c'));var _0x2c2cb0=squel[_0x0a9e('0x41')]()['from'](_0x0a9e('0x4d'),'i')[_0x0a9e('0x4a')](_0x0a9e('0x4e'),'c',_0x0a9e('0x4f'))[_0x0a9e('0x4a')](_0x0a9e('0x4b'),'o',_0x0a9e('0x50'))[_0x0a9e('0x4a')]('mail_accounts','a',_0x0a9e('0x51'))['left_join'](_0x0a9e('0x52'),'me',_0x0a9e('0x53'))[_0x0a9e('0x4a')]('mail_interaction_has_tags','it',_0x0a9e('0x54'))[_0x0a9e('0x4a')](_0x0a9e('0x45'),'t',_0x0a9e('0x55'));var _0x45c845=squel[_0x0a9e('0x56')]();var _0x45bf7f=[];var _0x5bbcde=squel[_0x0a9e('0x56')]();var _0x1bde3c;if(_0x2b45ea[_0x0a9e('0x38')][_0x0a9e('0x57')]){_0x1bde3c=as[_0x0a9e('0x58')](_0x2b45ea[_0x0a9e('0x38')][_0x0a9e('0x57')]);var _0x19383e=_0x1bde3c[_0x0a9e('0x59')];for(var _0x58a5c2=0x0;_0x58a5c2<_0x1bde3c[_0x0a9e('0x5a')][_0x0a9e('0x3c')];_0x58a5c2++){var _0x4f7240=_0x1bde3c['conditions'][_0x58a5c2];var _0x5ddf84='i';var _0x1adfee=_[_0x0a9e('0x5b')](_0x44295a,[_0x0a9e('0x20'),_0x4f7240[_0x0a9e('0x42')]]);if(!_0x1adfee){switch(_0x4f7240[_0x0a9e('0x42')]){case _0x0a9e('0x5c'):if(_0x4f7240[_0x0a9e('0x5d')]==0x1){_0x2c2cb0[_0x0a9e('0x5e')]('`'+_0x4f7240['field']+'`\x20=\x200');}else{_0x2c2cb0['having']('`'+_0x4f7240[_0x0a9e('0x42')]+_0x0a9e('0x5f'));}break;case _0x0a9e('0x60'):if(_0x4f7240['operator']===_0x0a9e('0x61')){if(_0x4f7240[_0x0a9e('0x5d')]['split']('\x20')['length']>0x1){_0x45c845[_0x19383e](_0x0a9e('0x62'),qs['getFullTextValue'](_0x4f7240[_0x0a9e('0x5d')]),null);}else{var _0x4c3845='%'+_0x4f7240[_0x0a9e('0x5d')]+'%';_0x45c845[_0x19383e](_0x0a9e('0x63'),_0x4c3845,_0x4c3845,_0x4c3845);}}else{_0x1adfee=_[_0x0a9e('0x5b')](_0x44295a,['name',_0x0a9e('0x64')]);_0x4f7240[_0x0a9e('0x42')]='ContactId';_0x2244d6=as['buildExpression'](_0x5ddf84,_0x1adfee[_0x0a9e('0x65')],_0x4f7240);_0x45c845[_0x19383e](_0x2244d6[_0x0a9e('0x66')],_0x2244d6['value'][_0x0a9e('0x67')],_0x2244d6['value'][_0x0a9e('0x1c')]);}break;case'Tag':var _0xe22ccc=_0x4f7240['value']['split'](',')['map'](function(_0x2da03c){return Number(_0x2da03c);});_0xe22ccc['forEach'](function(_0x2f7092){_0x5bbcde['or'](_0x0a9e('0x68'),'%,'+_0x2f7092+',%');});_0x45bf7f=_[_0x0a9e('0x69')](_0x45bf7f,_0xe22ccc);break;case _0x0a9e('0x6a'):if(_0x4f7240[_0x0a9e('0x6b')]===_0x0a9e('0x61')){_0x45c845[_0x19383e](_0x0a9e('0x6c'),'%'+_0x4f7240[_0x0a9e('0x5d')]+'%',null);}else{_0x1adfee=_['find'](_0x44295a,[_0x0a9e('0x20'),_0x0a9e('0x6d')]);_0x4f7240[_0x0a9e('0x42')]=_0x0a9e('0x6d');_0x2244d6=as[_0x0a9e('0x6e')](_0x5ddf84,_0x1adfee[_0x0a9e('0x65')],_0x4f7240);_0x45c845[_0x19383e](_0x2244d6['text'],_0x2244d6[_0x0a9e('0x5d')][_0x0a9e('0x67')],_0x2244d6['value'][_0x0a9e('0x1c')]);}break;case'plainBody':_0x2244d6=as[_0x0a9e('0x6e')]('me',null,_0x4f7240);_0x45c845[_0x19383e](_0x2244d6['text'],_0x2244d6['value']['start'],_0x2244d6[_0x0a9e('0x5d')]['end']);break;}}else{var _0x2244d6=as[_0x0a9e('0x6e')](_0x5ddf84,_0x1adfee[_0x0a9e('0x65')],_0x4f7240);_0x45c845[_0x19383e](_0x2244d6[_0x0a9e('0x66')],_0x2244d6[_0x0a9e('0x5d')][_0x0a9e('0x67')],_0x2244d6['value'][_0x0a9e('0x1c')]);}}}else{var _0x5854cc=_(_0x2b45ea[_0x0a9e('0x38')])[_0x0a9e('0x6f')]()[_0x0a9e('0x37')](function(_0x5adf8f){return _[_0x0a9e('0x70')](_0x44295a,[_0x0a9e('0x20'),_0x5adf8f])?_0x5adf8f:undefined;})[_0x0a9e('0x71')]()[_0x0a9e('0x5d')]();if(!_['isEmpty'](_0x5854cc)){_0x5854cc[_0x0a9e('0x26')](function(_0xe05a5a){if(_0xe05a5a==='MailAccountId'){_0x2c2cb0[_0x0a9e('0x72')](_0x0a9e('0x73'),[][_0x0a9e('0x74')](_0x2b45ea[_0x0a9e('0x38')][_0xe05a5a]));}else if(_0xe05a5a===_0x0a9e('0x75')){var _0x4d4a35=JSON[_0x0a9e('0x76')](_0x2b45ea[_0x0a9e('0x38')][_0xe05a5a])[_0x0a9e('0x77')];var _0x47bb43=JSON[_0x0a9e('0x76')](_0x2b45ea['query'][_0xe05a5a])['$lte'];_0x2c2cb0[_0x0a9e('0x72')](_0x0a9e('0x78'),_0x4d4a35,_0x47bb43);}else{if(_0x2b45ea[_0x0a9e('0x38')][_0xe05a5a]===_0x0a9e('0x79')){_0x2c2cb0[_0x0a9e('0x72')]('i.'+_0xe05a5a+_0x0a9e('0x7a'));}else{_0x2c2cb0[_0x0a9e('0x72')]('i.'+_0xe05a5a+_0x0a9e('0x7b'),_0x2b45ea[_0x0a9e('0x38')][_0xe05a5a]);}}});}if(_0x2b45ea[_0x0a9e('0x38')][_0x0a9e('0x7c')]){if(_0x2b45ea[_0x0a9e('0x38')][_0x0a9e('0x7c')]==0x1){_0x2c2cb0[_0x0a9e('0x5e')](_0x0a9e('0x7d'));}else{_0x2c2cb0[_0x0a9e('0x5e')](_0x0a9e('0x7e'));}}if(_0x2b45ea[_0x0a9e('0x38')]['tag']){_0x45bf7f=_[_0x0a9e('0x7f')](_0x2b45ea[_0x0a9e('0x38')][_0x0a9e('0x80')])?_0x2b45ea['query'][_0x0a9e('0x80')]:new Array(_0x2b45ea[_0x0a9e('0x38')]['tag']);_0x45bf7f[_0x0a9e('0x26')](function(_0x56e31e){_0x5bbcde['or'](_0x0a9e('0x68'),'%,'+_0x56e31e+',%');});}if(_0x2b45ea[_0x0a9e('0x38')][_0x0a9e('0x81')]){var _0x4a43a8=_0x2b45ea['query']['filter'][_0x0a9e('0x82')]('\x5c','\x5c\x5c')[_0x0a9e('0x82')](/'/g,'\x27\x27');if(qs[_0x0a9e('0x83')](_0x4a43a8)){_0x45c845['or'](_0x0a9e('0x84'),_0x4a43a8+'%');}else if(qs[_0x0a9e('0x85')](_0x4a43a8)){_0x45c845['or'](_0x0a9e('0x86'),_0x4a43a8+'%');}else{_0x45c845['or'](_0x0a9e('0x87'),qs[_0x0a9e('0x88')](_0x4a43a8))['or']('MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x0a9e('0x88')](_0x4a43a8));}}}_0x2c2cb0[_0x0a9e('0x72')](_0x45c845);_0x2c2cb0[_0x0a9e('0x89')]('i.id');var _0x2bdc44={'type':db['Sequelize'][_0x0a9e('0x8a')][_0x0a9e('0x8b')],'raw':!![]};var _0x4c46c1=_0x2c2cb0[_0x0a9e('0x8c')]();_0x4c46c1[_0x0a9e('0x42')](_0x0a9e('0x8d'));_0x4c46c1[_0x0a9e('0x42')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x0a9e('0x5c'));if(_0x332d35[_0x0a9e('0x8e')]){_0x332d35[_0x0a9e('0x8e')][_0x0a9e('0x26')](function(_0x5b7fc3){var _0x109ccb=_0x5b7fc3[0x0]===_0x0a9e('0x8f')?_0x5b7fc3[0x0]:'i.'+_0x5b7fc3[0x0];_0x2c2cb0[_0x0a9e('0x8e')](_0x109ccb,_0x5b7fc3[0x1]===_0x0a9e('0x90')?![]:!![]);});}if(!_['isEmpty'](_0x45bf7f)){_0x2c2cb0[_0x0a9e('0x5e')](_0x5bbcde);_0x4c46c1[_0x0a9e('0x72')](_0x0a9e('0x91'),_0x45bf7f);}BPromise[_0x0a9e('0x92')]()[_0x0a9e('0x1a')](function(){if(!_0x1bde3c){if(_0x2b45ea[_0x0a9e('0x38')][_0x0a9e('0x93')])return;_0x4c46c1[_0x0a9e('0x72')](_0x0a9e('0x94'));_0x2c2cb0[_0x0a9e('0x72')](_0x0a9e('0x94'));return;}if(_0x2b45ea[_0x0a9e('0x95')][_0x0a9e('0x96')]!==_0x0a9e('0x97'))return;return _0x2b45ea['user'][_0x0a9e('0x98')]({'attributes':['id'],'raw':!![]})[_0x0a9e('0x1a')](function(_0xc599b3){if(_['isEmpty'](_0xc599b3)){_0x4c46c1[_0x0a9e('0x72')](_0x0a9e('0x99'));_0x2c2cb0[_0x0a9e('0x72')](_0x0a9e('0x99'));}else{_0x4c46c1['where']('i.MailAccountId\x20IN\x20?',_[_0x0a9e('0x37')](_0xc599b3,'id'));_0x2c2cb0[_0x0a9e('0x72')]('i.MailAccountId\x20IN\x20?',_[_0x0a9e('0x37')](_0xc599b3,'id'));}});})['then'](function(){if(_0x2b45ea[_0x0a9e('0x95')][_0x0a9e('0x96')]==='agent'&&!_0x1bde3c&&!_0x2b45ea[_0x0a9e('0x38')][_0x0a9e('0x93')])return[];return db[_0x0a9e('0x9a')][_0x0a9e('0x38')](_0x4c46c1[_0x0a9e('0x9b')](),_0x2bdc44);})[_0x0a9e('0x1a')](function(_0x444f1f){_0x5583a4['count']=_0x444f1f[_0x0a9e('0x3c')];if(_0x5583a4[_0x0a9e('0x16')]===0x0)return[];return db[_0x0a9e('0x9a')][_0x0a9e('0x38')](_0xeaa5e5['toString'](),_0x2bdc44)[_0x0a9e('0x1a')](function(_0xf0db1){_0x13cb1f=_['keyBy'](_0xf0db1,'id');_0x2bdc44=_[_0x0a9e('0x9c')](_0x2bdc44,{'model':db['MailInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x2b45ea[_0x0a9e('0x38')][_0x0a9e('0x3b')]){_0x332d35[_0x0a9e('0x3a')][_0x0a9e('0x26')](function(_0x5af453){_0x2c2cb0['field']('i.'+_0x5af453);});}else{_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0x9d'),_0x0a9e('0x5c'));_0x2c2cb0['field'](_0x0a9e('0x9e'),_0x0a9e('0x9f'));_0x2c2cb0['field']('a.mandatoryDisposition',_0x0a9e('0xa0'));_0x2c2cb0['field']('CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20(\x27%\x27\x20+\x20a.email\x20+\x20\x27%\x27)\x20THEN\x20SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201)\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName');_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0x8d'));_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xa1'));_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xa2'));_0x2c2cb0['field'](_0x0a9e('0xa3'));_0x2c2cb0['field'](_0x0a9e('0xa4'));_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xa5'));_0x2c2cb0[_0x0a9e('0x42')]('i.lastMsgAt');_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xa6'));_0x2c2cb0[_0x0a9e('0x42')]('i.subject');_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xa7'));_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xa8'));_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xa9'));_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xaa'));_0x2c2cb0['field'](_0x0a9e('0xab'));_0x2c2cb0[_0x0a9e('0x42')]('i.ContactId');_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xac'));_0x2c2cb0[_0x0a9e('0x42')]('i.UserId');_0x2c2cb0[_0x0a9e('0x42')]('c.firstName',_0x0a9e('0xad'));_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xae'),_0x0a9e('0xaf'));_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xb0'),_0x0a9e('0xb1'));_0x2c2cb0[_0x0a9e('0x42')]('c.phone',_0x0a9e('0xb2'));_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xb3'),_0x0a9e('0xb4'));_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xb5'),_0x0a9e('0xb6'));_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xb7'),_0x0a9e('0xb8'));_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xb9'),_0x0a9e('0xba'));_0x2c2cb0['field'](_0x0a9e('0xbb'),_0x0a9e('0x28'));}if(_0x332d35[_0x0a9e('0x15')])_0x2c2cb0[_0x0a9e('0x15')](_0x332d35[_0x0a9e('0x15')]);if(_0x332d35['offset'])_0x2c2cb0[_0x0a9e('0x13')](_0x332d35[_0x0a9e('0x13')]);return db['sequelize'][_0x0a9e('0x38')](_0x2c2cb0['toString'](),_0x2bdc44);})[_0x0a9e('0x1a')](function(_0x27041d){if(_0x27041d[_0x0a9e('0x3c')]>0x0)_0x37f6cc[_0x0a9e('0x72')]('ui.MailInteractionId\x20IN\x20?',_[_0x0a9e('0x37')](_0x27041d,'id'));return db['sequelize'][_0x0a9e('0x38')](_0x37f6cc[_0x0a9e('0x9b')](),_0x2bdc44)['then'](function(_0x231c6a){var _0x63c9f7=_[_0x0a9e('0xbc')](_0x231c6a,'MailInteractionId');var _0x4c788f=[];return db[_0x0a9e('0xbd')][_0x0a9e('0x2a')]({'attributes':[_0x0a9e('0xbe')],'raw':!![]})[_0x0a9e('0x1a')](function(_0x3f2f40){var _0x2450a8=_0x3f2f40[_0x0a9e('0xbe')];_0x27041d[_0x0a9e('0x26')](function(_0x3f8124){_0x4c788f['push'](updateMailInteraction(_0x3f8124,_0x13cb1f,_0x63c9f7,_0x2450a8));});return BPromise[_0x0a9e('0xbf')](_0x4c788f);});});});})['then'](function(_0x287324){_0x5583a4[_0x0a9e('0xc0')]=_0x287324;return _0x5583a4;})[_0x0a9e('0x1a')](respondWithFilteredResult(_0x409319,_0x332d35))[_0x0a9e('0x30')](handleError(_0x409319,null));};exports[_0x0a9e('0xc1')]=function(_0x4e7273,_0x436313){var _0x4667bf={'raw':![],'where':{'id':_0x4e7273[_0x0a9e('0xc2')]['id']}},_0x2791c5={};_0x2791c5[_0x0a9e('0x36')]=_['keys'](db['MailInteraction'][_0x0a9e('0x33')]);_0x2791c5['query']=_[_0x0a9e('0x6f')](_0x4e7273[_0x0a9e('0x38')]);_0x2791c5[_0x0a9e('0x3f')]=_[_0x0a9e('0x39')](_0x2791c5[_0x0a9e('0x36')],_0x2791c5[_0x0a9e('0x38')]);_0x4667bf['attributes']=_['intersection'](_0x2791c5[_0x0a9e('0x36')],qs['fields'](_0x4e7273[_0x0a9e('0x38')]['fields']));_0x4667bf[_0x0a9e('0x3a')]=_0x4667bf['attributes']['length']?_0x4667bf[_0x0a9e('0x3a')]:_0x2791c5[_0x0a9e('0x36')];if(_0x4e7273['query'][_0x0a9e('0xc3')]){_0x4667bf[_0x0a9e('0xc4')]=[{'all':!![]}];}_0x4667bf=_[_0x0a9e('0x9c')]({},_0x4667bf,_0x4e7273[_0x0a9e('0xc5')]);return db[_0x0a9e('0x32')]['find'](_0x4667bf)['then'](handleEntityNotFound(_0x436313,null))[_0x0a9e('0x1a')](respondWithResult(_0x436313,null))[_0x0a9e('0x30')](handleError(_0x436313,null));};exports[_0x0a9e('0xc6')]=function(_0x24beb6,_0x59303b){return db['MailInteraction'][_0x0a9e('0xc6')](_0x24beb6[_0x0a9e('0xc7')],{})['then'](respondWithResult(_0x59303b,0xc9))[_0x0a9e('0x30')](handleError(_0x59303b,null));};exports[_0x0a9e('0x19')]=function(_0xcacabb,_0x2427d5){if(_0xcacabb[_0x0a9e('0xc7')]['id']){delete _0xcacabb[_0x0a9e('0xc7')]['id'];}return db[_0x0a9e('0x32')][_0x0a9e('0x5b')]({'where':{'id':_0xcacabb[_0x0a9e('0xc2')]['id']}})[_0x0a9e('0x1a')](handleEntityNotFound(_0x2427d5,null))['then'](saveUpdates(_0xcacabb[_0x0a9e('0xc7')],null))[_0x0a9e('0x1a')](respondWithResult(_0x2427d5,null))[_0x0a9e('0x30')](handleError(_0x2427d5,null));};exports[_0x0a9e('0x1b')]=function(_0x1d0b02,_0x547e37){return db['MailInteraction'][_0x0a9e('0x5b')]({'where':{'id':_0x1d0b02[_0x0a9e('0xc2')]['id']}})[_0x0a9e('0x1a')](handleEntityNotFound(_0x547e37,null))[_0x0a9e('0x1a')](removeEntity(_0x547e37,null))[_0x0a9e('0x30')](handleError(_0x547e37,null));};exports['describe']=function(_0x1339d0,_0x3c775a){return db[_0x0a9e('0x32')]['describe']()[_0x0a9e('0x1a')](respondWithResult(_0x3c775a,null))['catch'](handleError(_0x3c775a,null));};exports[_0x0a9e('0xc8')]=function(_0x4799d4,_0x25b745){return db[_0x0a9e('0x29')][_0x0a9e('0x5b')]({'where':{'id':_0x4799d4['params']['id']}})[_0x0a9e('0x1a')](handleEntityNotFound(_0x25b745,null))['then'](function(_0x4383da){if(_0x4383da){return _0x4383da[_0x0a9e('0xc8')](_0x4799d4[_0x0a9e('0xc7')][_0x0a9e('0xc9')],_[_0x0a9e('0xca')](_0x4799d4[_0x0a9e('0xc7')],[_0x0a9e('0xc9'),'id'])||{});}})[_0x0a9e('0x1a')](respondWithResult(_0x25b745,null))[_0x0a9e('0x30')](handleError(_0x25b745,null));};exports[_0x0a9e('0xcb')]=function(_0x4262d0,_0xc876d4){var _0x2415fe={'raw':![],'where':{}};var _0x399def={};var _0x98c62c={'count':0x0,'rows':[]};return db[_0x0a9e('0x32')]['findOne']({'where':{'id':_0x4262d0['params']['id']}})[_0x0a9e('0x1a')](handleEntityNotFound(_0xc876d4,null))['then'](function(_0x1d999b){if(_0x1d999b){_0x399def[_0x0a9e('0x36')]=_['keys'](db[_0x0a9e('0x29')][_0x0a9e('0x33')]);_0x399def[_0x0a9e('0x38')]=_[_0x0a9e('0x6f')](_0x4262d0['query']);_0x399def[_0x0a9e('0x3f')]=_[_0x0a9e('0x39')](_0x399def[_0x0a9e('0x36')],_0x399def[_0x0a9e('0x38')]);_0x2415fe['attributes']=_[_0x0a9e('0x39')](_0x399def[_0x0a9e('0x36')],qs[_0x0a9e('0x3b')](_0x4262d0['query'][_0x0a9e('0x3b')]));_0x2415fe[_0x0a9e('0x3a')]=_0x2415fe[_0x0a9e('0x3a')]['length']?_0x2415fe[_0x0a9e('0x3a')]:_0x399def[_0x0a9e('0x36')];if(!_0x4262d0[_0x0a9e('0x38')][_0x0a9e('0x3d')](_0x0a9e('0xcc'))){_0x2415fe['limit']=qs[_0x0a9e('0x15')](_0x4262d0[_0x0a9e('0x38')]['limit']);_0x2415fe[_0x0a9e('0x13')]=qs[_0x0a9e('0x13')](_0x4262d0[_0x0a9e('0x38')]['offset']);}_0x2415fe['order']=qs['sort'](_0x4262d0[_0x0a9e('0x38')][_0x0a9e('0x3e')]);_0x2415fe['where']=qs[_0x0a9e('0x3f')](_[_0x0a9e('0x40')](_0x4262d0[_0x0a9e('0x38')],_0x399def['filters']));_0x2415fe[_0x0a9e('0x72')][_0x0a9e('0xcd')]=_0x1d999b['id'];if(_0x4262d0[_0x0a9e('0x38')][_0x0a9e('0x81')]){_0x2415fe[_0x0a9e('0x72')]=_[_0x0a9e('0x9c')](_0x2415fe[_0x0a9e('0x72')],{'$or':_[_0x0a9e('0x37')](_0x2415fe[_0x0a9e('0x3a')],function(_0x5a1848){var _0x43c397={};_0x43c397[_0x5a1848]={'$like':'%'+_0x4262d0['query'][_0x0a9e('0x81')]+'%'};return _0x43c397;})});}if(_0x4262d0[_0x0a9e('0x38')][_0x0a9e('0x77')]){var _0x3cf222=_0x4262d0[_0x0a9e('0x38')][_0x0a9e('0x77')]['split'](',');var _0x1a0314={};_0x1a0314[_0x3cf222[0x0]]={'$gte':moment(_0x3cf222[0x1])[_0x0a9e('0xce')](_0x0a9e('0xcf'))};_0x2415fe[_0x0a9e('0x72')]=_['merge'](_0x2415fe[_0x0a9e('0x72')],_0x1a0314);}_0x2415fe=_[_0x0a9e('0x9c')]({},_0x2415fe,_0x4262d0[_0x0a9e('0xc5')]);return db[_0x0a9e('0x29')][_0x0a9e('0x16')]({'where':_0x2415fe[_0x0a9e('0x72')]})[_0x0a9e('0x1a')](function(_0x25931e){_0x98c62c[_0x0a9e('0x16')]=_0x25931e;if(_0x4262d0[_0x0a9e('0x38')]['includeAll']){_0x2415fe[_0x0a9e('0xc4')]=[{'all':!![]}];}return db[_0x0a9e('0x29')][_0x0a9e('0xd0')](_0x2415fe);})[_0x0a9e('0x1a')](function(_0xea8bd1){if(_0x4262d0[_0x0a9e('0x38')][_0x0a9e('0xd1')]===_0x0a9e('0xd2')){for(var _0x566b90=0x0;_0x566b90<_0xea8bd1[_0x0a9e('0x3c')];_0x566b90++){_0xea8bd1[_0x566b90][_0x0a9e('0xc7')]=juice(_0xea8bd1[_0x566b90][_0x0a9e('0xc7')]);}}_0x98c62c['rows']=_0xea8bd1;return _0x98c62c;});}})[_0x0a9e('0x1a')](respondWithFilteredResult(_0xc876d4,_0x2415fe))[_0x0a9e('0x30')](handleError(_0xc876d4,null));};exports[_0x0a9e('0xd3')]=function(_0x97d5b5,_0x370b5e){return db[_0x0a9e('0x32')][_0x0a9e('0x5b')]({'where':{'id':_0x97d5b5[_0x0a9e('0xc2')]['id']}})[_0x0a9e('0x1a')](handleEntityNotFound(_0x370b5e,null))[_0x0a9e('0x1a')](function(_0x5a7dad){if(_0x5a7dad){return _0x5a7dad[_0x0a9e('0xd4')](_0x97d5b5[_0x0a9e('0xc7')][_0x0a9e('0xc9')],_[_0x0a9e('0xca')](_0x97d5b5[_0x0a9e('0xc7')],[_0x0a9e('0xc9'),'id'])||{})['spread'](function(){return db[_0x0a9e('0xd5')]['findAll']({'attributes':['id','name','color'],'where':{'id':_0x97d5b5[_0x0a9e('0xc7')][_0x0a9e('0xc9')]}});})[_0x0a9e('0x1a')](function(_0x2a07d0){socket['emit'](_0x0a9e('0xd6'),{'id':Number(_0x97d5b5[_0x0a9e('0xc2')]['id']),'tags':_0x2a07d0||[]});return{'id':Number(_0x97d5b5[_0x0a9e('0xc2')]['id']),'tags':_0x2a07d0||[]};});}})[_0x0a9e('0x1a')](respondWithResult(_0x370b5e,null))[_0x0a9e('0x30')](handleError(_0x370b5e,null));};exports['removeTags']=function(_0x57b1b1,_0x9484c8){return db[_0x0a9e('0x32')][_0x0a9e('0x5b')]({'where':{'id':_0x57b1b1['params']['id']}})[_0x0a9e('0x1a')](handleEntityNotFound(_0x9484c8,null))[_0x0a9e('0x1a')](function(_0x422f0a){if(_0x422f0a){return _0x422f0a['removeTags'](_0x57b1b1[_0x0a9e('0x38')][_0x0a9e('0xc9')]);}})[_0x0a9e('0x1a')](respondWithStatusCode(_0x9484c8,null))['catch'](handleError(_0x9484c8,null));};exports[_0x0a9e('0xd7')]=function(_0x336b30,_0x3b7213){var _0x549e03=moment()['unix']()['toString']();var _0x3b04fd=path[_0x0a9e('0xd8')](config[_0x0a9e('0xd9')],_0x0a9e('0xda'),'files',_0x0a9e('0xdb'));var _0x532424=path[_0x0a9e('0xd8')](config[_0x0a9e('0xd9')],_0x0a9e('0xda'),'files',_0x0a9e('0xdc'));var _0x33a26c=path[_0x0a9e('0xd8')](_0x3b04fd,_0x549e03);var _0x580dd6=util[_0x0a9e('0xce')]('transcript-%d-%s.zip',_0x336b30[_0x0a9e('0xc2')]['id'],_0x549e03);var _0x5c57e1=path[_0x0a9e('0xd8')](_0x3b04fd,_0x580dd6);var _0x57b7d4=[];if(_0x336b30[_0x0a9e('0x38')][_0x0a9e('0xdc')]){_0x57b7d4[_0x0a9e('0x27')]({'model':db[_0x0a9e('0xdd')],'as':_0x0a9e('0xde'),'raw':!![]});}var _0x251dd9=[{'model':db[_0x0a9e('0x29')],'as':'Messages','attributes':['id',_0x0a9e('0xc7'),_0x0a9e('0x44'),'to','cc','bcc',_0x0a9e('0xdf'),_0x0a9e('0x75')],'where':{'secret':![]},'order':qs['sort']('id'),'include':_0x57b7d4}];return db[_0x0a9e('0x32')][_0x0a9e('0x5b')]({'where':{'id':_0x336b30[_0x0a9e('0xc2')]['id']},'include':_0x251dd9})['then'](handleEntityNotFound(_0x3b7213,null))[_0x0a9e('0x1a')](function(_0xf49ed4){if(_0xf49ed4&&_0xf49ed4[_0x0a9e('0xe0')]){var _0x3f0d64=_0xf49ed4[_0x0a9e('0xe1')]({'plain':!![]});fs[_0x0a9e('0xe2')](_0x33a26c);return BPromise[_0x0a9e('0xe3')](_0x3f0d64[_0x0a9e('0xe0')],function(_0x22767f,_0x426c3c){var _0x56e148={'from':_0x22767f[_0x0a9e('0x44')],'to':_0x22767f['to'],'subject':_0x22767f['subject'],'html':_0x22767f[_0x0a9e('0xc7')],'headers':{'Date':moment(_0x22767f[_0x0a9e('0x75')])[_0x0a9e('0xce')](_0x0a9e('0xe4'))},'attachments':[]};if(_0x22767f['cc']){_0x56e148[_0x0a9e('0xe5')]['Cc']=_0x22767f['cc'];}if(_0x22767f[_0x0a9e('0xe6')]){_0x56e148['headers'][_0x0a9e('0xe7')]=_0x22767f[_0x0a9e('0xe6')];}return new BPromise(function(_0x2977a7,_0x55a599){if(_0x22767f[_0x0a9e('0xde')]){for(var _0x402544=0x0;_0x402544<_0x22767f[_0x0a9e('0xde')][_0x0a9e('0x3c')];_0x402544++){var _0x31e1e0=_0x22767f[_0x0a9e('0xde')][_0x402544];var _0x1e93f5=path['join'](_0x532424,_0x31e1e0[_0x0a9e('0xe8')]);if(fs[_0x0a9e('0xe9')](_0x1e93f5)){_0x56e148[_0x0a9e('0xdc')][_0x0a9e('0x27')]({'name':_0x31e1e0[_0x0a9e('0x20')],'contentType':_0x31e1e0[_0x0a9e('0x65')],'data':fs[_0x0a9e('0xea')](_0x1e93f5)});}}}emlformat['build'](_0x56e148,function(_0x5c8720,_0x10aa22){if(_0x5c8720)return _0x55a599(_0x5c8720);fs[_0x0a9e('0xeb')](path[_0x0a9e('0xd8')](_0x33a26c,util[_0x0a9e('0xce')](_0x0a9e('0xec'),_0x426c3c)),_0x10aa22);return _0x2977a7(_0x10aa22);});});})[_0x0a9e('0x1a')](function(){return new BPromise(function(_0x609711,_0x584854){zipdir(_0x33a26c,{'saveTo':_0x5c57e1},function(_0x39ea62,_0x1d7fc4){if(_0x39ea62)return _0x584854(_0x39ea62);return _0x609711(_0x1d7fc4);});})[_0x0a9e('0x1a')](function(){return new BPromise(function(_0x2675a5,_0x1b1757){rimraf(_0x33a26c,function(_0x3c6082){if(_0x3c6082)_0x1b1757(_0x3c6082);return _0x2675a5();});});})[_0x0a9e('0x1a')](function(){return _0x3b7213['download'](_0x5c57e1,_0x580dd6,function(_0x311288){if(!_0x311288)fs[_0x0a9e('0xed')](_0x5c57e1);});});});}else{return _0x3b7213[_0x0a9e('0x1d')](0xc8);}})['catch'](handleError(_0x3b7213,null));}; \ No newline at end of file +var _0xa9e0=['o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','groupBy','Setting','enableEmailPreview','all','rows','show','params','includeAll','include','options','create','body','addMessage','ids','omit','getMessages','nolimit','MailInteractionId','format','YYYY-MM-DD\x20HH:mm:ss','findAll','inlineCss','true','addTags','setTags','Tag','mailInteractionTags:save','download','join','root','server','tmp','attachments','Attachment','Attachments','subject','Messages','get','mkdirSync','each','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','bcc','Bcc','basename','existsSync','readFileSync','writeFileSync','message%d.eml','unlinkSync','eml-format','rimraf','zip-dir','util','lodash','squel','juice','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','defaults','socket.io-emitter','redis','./mailInteraction.socket','register','status','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','end','sendStatus','error','stack','name','send','Users','fullname','Tags','split','forEach','push','TagIds','MailMessage','findOne','out','-id','plainBody','lastMsgText','trimStart','catch','index','MailInteraction','rawAttributes','fieldName','key','model','map','query','intersection','attributes','fields','length','hasOwnProperty','sort','filters','pick','select','field','color','from','tools_tags','u.id','u.fullname','ui.MailInteractionId','user_has_mail_interactions','left_join','users','u.id\x20=\x20ui.UserId','mail_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','a.id\x20=\x20i.MailAccountId','mail_messages','me.MailInteractionId\x20=\x20i.id','it.MailInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','value','having','`\x20>\x200','Contact','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','type','text','start','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','operator','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','buildExpression','keys','some','compact','where','i.MailAccountId\x20IN\x20?','concat','createdAt','parse','$gte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','isArray','tag','filter','replace','isNumeric','i.id\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','group','QueryTypes','SELECT','clone','i.id','order','contactName','DESC','t.id\x20IN\x20?','resolve','MailAccountId','i.MailAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getMailAccounts','i.MailAccountId\x20IS\x20NULL','sequelize','toString','merge','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','Account.key','Account.mandatoryDisposition','i.createdAt','i.updatedAt','i.closed','i.closedAt','i.attach','i.lastMsgDirection','i.disposition','i.secondDisposition','i.thirdDisposition','i.substatus','i.to','i.MailAccountId','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname'];(function(_0xe00d2e,_0x199d53){var _0x5904e2=function(_0x24629f){while(--_0x24629f){_0xe00d2e['push'](_0xe00d2e['shift']());}};_0x5904e2(++_0x199d53);}(_0xa9e0,0x123));var _0x0a9e=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0xa9e0[_0x484e36];return _0xafc85d;};'use strict';var emlformat=require(_0x0a9e('0x0'));var rimraf=require(_0x0a9e('0x1'));var zipdir=require(_0x0a9e('0x2'));var moment=require('moment');var BPromise=require('bluebird');var util=require(_0x0a9e('0x3'));var path=require('path');var fs=require('fs');var _=require(_0x0a9e('0x4'));var squel=require(_0x0a9e('0x5'));var juice=require(_0x0a9e('0x6'));var Redis=require(_0x0a9e('0x7'));var qs=require(_0x0a9e('0x8'));var as=require('../../components/parsers/advancedSearch');var logger=require(_0x0a9e('0x9'))(_0x0a9e('0xa'));var config=require(_0x0a9e('0xb'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x0a9e('0xc')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x0a9e('0xd'))(new Redis(config[_0x0a9e('0xe')]));require(_0x0a9e('0xf'))[_0x0a9e('0x10')](socket);function respondWithStatusCode(_0xfeb75b,_0xbd1168){_0xbd1168=_0xbd1168||0xcc;return function(_0x4a4c56){if(_0x4a4c56){return _0xfeb75b['sendStatus'](_0xbd1168);}return _0xfeb75b['status'](_0xbd1168)['end']();};}function respondWithResult(_0x273d4d,_0x36471c){_0x36471c=_0x36471c||0xc8;return function(_0xd5b662){if(_0xd5b662){return _0x273d4d[_0x0a9e('0x11')](_0x36471c)[_0x0a9e('0x12')](_0xd5b662);}};}function respondWithFilteredResult(_0x69aeb7,_0x5db4b0){return function(_0x4283ce){if(_0x4283ce){var _0x239b12=typeof _0x5db4b0[_0x0a9e('0x13')]===_0x0a9e('0x14')&&typeof _0x5db4b0[_0x0a9e('0x15')]===_0x0a9e('0x14');var _0x52a03d=_0x4283ce[_0x0a9e('0x16')];var _0x5d0880=_0x239b12?0x0:_0x5db4b0[_0x0a9e('0x13')];var _0x519dfd=_0x239b12?_0x4283ce[_0x0a9e('0x16')]:_0x5db4b0[_0x0a9e('0x13')]+_0x5db4b0['limit'];var _0x225616;if(_0x519dfd>=_0x52a03d){_0x519dfd=_0x52a03d;_0x225616=0xc8;}else{_0x225616=0xce;}_0x69aeb7['status'](_0x225616);return _0x69aeb7[_0x0a9e('0x17')](_0x0a9e('0x18'),_0x5d0880+'-'+_0x519dfd+'/'+_0x52a03d)[_0x0a9e('0x12')](_0x4283ce);}return null;};}function saveUpdates(_0x205fd6){return function(_0x31b1ca){if(_0x31b1ca){return _0x31b1ca[_0x0a9e('0x19')](_0x205fd6)[_0x0a9e('0x1a')](function(_0x20559e){return _0x20559e;});}return null;};}function removeEntity(_0x1314ae){return function(_0x112016){if(_0x112016){return _0x112016[_0x0a9e('0x1b')]()[_0x0a9e('0x1a')](function(){_0x1314ae['status'](0xcc)[_0x0a9e('0x1c')]();});}};}function handleEntityNotFound(_0x155cce){return function(_0x53682f){if(!_0x53682f){_0x155cce[_0x0a9e('0x1d')](0x194);}return _0x53682f;};}function handleError(_0x5a09ef,_0x588269){_0x588269=_0x588269||0x1f4;return function(_0x3a02e1){logger[_0x0a9e('0x1e')](_0x3a02e1[_0x0a9e('0x1f')]);if(_0x3a02e1[_0x0a9e('0x20')]){delete _0x3a02e1['name'];}_0x5a09ef[_0x0a9e('0x11')](_0x588269)[_0x0a9e('0x21')](_0x3a02e1);};}function getInteractionUsers(_0x3b45bc,_0x4d00e6){return new BPromise(function(_0x370d86,_0x42ac8f){try{if(_0x4d00e6[_0x3b45bc['id']]){_0x3b45bc[_0x0a9e('0x22')]=_['map'](_0x4d00e6[_0x3b45bc['id']],function(_0x59181e){return{'id':_0x59181e['id'],'fullname':_0x59181e[_0x0a9e('0x23')]};});}}catch(_0x3a8e58){_0x42ac8f(_0x3a8e58);}_0x370d86(_0x3b45bc);});}function getInteractionTags(_0x40c424,_0x33161b){return new BPromise(function(_0x526cf3,_0x384319){try{if(_0x40c424['TagIds']){_0x40c424[_0x0a9e('0x24')]=[];_0x40c424['TagIds'][_0x0a9e('0x25')](',')[_0x0a9e('0x26')](function(_0x25fba9){_0x40c424[_0x0a9e('0x24')][_0x0a9e('0x27')](_0x33161b[_0x25fba9]);});}delete _0x40c424[_0x0a9e('0x28')];}catch(_0x11c3b6){_0x384319(_0x11c3b6);}_0x526cf3(_0x40c424);});}function getLastMessageText(_0x14de77){return new BPromise(function(_0x5a101a,_0x3652a7){return db[_0x0a9e('0x29')][_0x0a9e('0x2a')]({'where':{'$and':[{'MailInteractionId':_0x14de77['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0x0a9e('0x2b')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':['plainBody'],'order':_0x0a9e('0x2c'),'raw':!![]})[_0x0a9e('0x1a')](function(_0x1843b2){if(_0x1843b2&&_0x1843b2[_0x0a9e('0x2d')]){_0x14de77[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x1843b2[_0x0a9e('0x2d')]);}_0x5a101a(_0x14de77);})[_0x0a9e('0x30')](function(_0x1dbde2){_0x3652a7(_0x1dbde2);});});}function updateMailInteraction(_0x540530,_0x426950,_0x5d1e0e,_0x2407f9){return new BPromise(function(_0x3ae878,_0x1122db){return getInteractionUsers(_0x540530,_0x5d1e0e)[_0x0a9e('0x1a')](function(_0x25ce3a){return getInteractionTags(_0x25ce3a,_0x426950);})['then'](function(_0x66c1d2){if(_0x2407f9){_0x3ae878(getLastMessageText(_0x66c1d2));}else{_0x3ae878(_0x66c1d2);}})[_0x0a9e('0x30')](function(_0x40cb85){_0x1122db(_0x40cb85);});});}exports[_0x0a9e('0x31')]=function(_0x2b45ea,_0x409319){var _0x332d35={},_0x39e565={},_0x5583a4={'count':0x0,'rows':[]};var _0x44295a=_['map'](db[_0x0a9e('0x32')][_0x0a9e('0x33')],function(_0x2b7e7f){return{'name':_0x2b7e7f[_0x0a9e('0x34')],'type':_0x2b7e7f['type'][_0x0a9e('0x35')]};});_0x39e565[_0x0a9e('0x36')]=_[_0x0a9e('0x37')](_0x44295a,_0x0a9e('0x20'));_0x39e565['query']=_['keys'](_0x2b45ea[_0x0a9e('0x38')]);_0x39e565['filters']=_[_0x0a9e('0x39')](_0x39e565[_0x0a9e('0x36')],_0x39e565[_0x0a9e('0x38')]);_0x332d35[_0x0a9e('0x3a')]=_['intersection'](_0x39e565[_0x0a9e('0x36')],qs[_0x0a9e('0x3b')](_0x2b45ea[_0x0a9e('0x38')]['fields']));_0x332d35[_0x0a9e('0x3a')]=_0x332d35[_0x0a9e('0x3a')][_0x0a9e('0x3c')]?_0x332d35['attributes']:_0x39e565['model'];if(!_0x2b45ea[_0x0a9e('0x38')][_0x0a9e('0x3d')]('nolimit')){_0x332d35[_0x0a9e('0x15')]=qs[_0x0a9e('0x15')](_0x2b45ea[_0x0a9e('0x38')][_0x0a9e('0x15')]);_0x332d35['offset']=qs['offset'](_0x2b45ea[_0x0a9e('0x38')][_0x0a9e('0x13')]);}_0x332d35['order']=qs[_0x0a9e('0x3e')](_0x2b45ea[_0x0a9e('0x38')][_0x0a9e('0x3e')]);_0x332d35['where']=qs[_0x0a9e('0x3f')](_[_0x0a9e('0x40')](_0x2b45ea[_0x0a9e('0x38')],_0x39e565[_0x0a9e('0x3f')]),_0x44295a);var _0x13cb1f=[];var _0xeaa5e5=squel[_0x0a9e('0x41')]()[_0x0a9e('0x42')]('id')[_0x0a9e('0x42')](_0x0a9e('0x20'))[_0x0a9e('0x42')](_0x0a9e('0x43'))[_0x0a9e('0x44')](_0x0a9e('0x45'));var _0x37f6cc=squel['select']()['field'](_0x0a9e('0x46'))[_0x0a9e('0x42')](_0x0a9e('0x47'))[_0x0a9e('0x42')](_0x0a9e('0x48'))[_0x0a9e('0x44')](_0x0a9e('0x49'),'ui')[_0x0a9e('0x4a')](_0x0a9e('0x4b'),'u',_0x0a9e('0x4c'));var _0x2c2cb0=squel[_0x0a9e('0x41')]()['from'](_0x0a9e('0x4d'),'i')[_0x0a9e('0x4a')](_0x0a9e('0x4e'),'c',_0x0a9e('0x4f'))[_0x0a9e('0x4a')](_0x0a9e('0x4b'),'o',_0x0a9e('0x50'))[_0x0a9e('0x4a')]('mail_accounts','a',_0x0a9e('0x51'))['left_join'](_0x0a9e('0x52'),'me',_0x0a9e('0x53'))[_0x0a9e('0x4a')]('mail_interaction_has_tags','it',_0x0a9e('0x54'))[_0x0a9e('0x4a')](_0x0a9e('0x45'),'t',_0x0a9e('0x55'));var _0x45c845=squel[_0x0a9e('0x56')]();var _0x45bf7f=[];var _0x5bbcde=squel[_0x0a9e('0x56')]();var _0x1bde3c;if(_0x2b45ea[_0x0a9e('0x38')][_0x0a9e('0x57')]){_0x1bde3c=as[_0x0a9e('0x58')](_0x2b45ea[_0x0a9e('0x38')][_0x0a9e('0x57')]);var _0x19383e=_0x1bde3c[_0x0a9e('0x59')];for(var _0x58a5c2=0x0;_0x58a5c2<_0x1bde3c[_0x0a9e('0x5a')][_0x0a9e('0x3c')];_0x58a5c2++){var _0x4f7240=_0x1bde3c['conditions'][_0x58a5c2];var _0x5ddf84='i';var _0x1adfee=_[_0x0a9e('0x5b')](_0x44295a,[_0x0a9e('0x20'),_0x4f7240[_0x0a9e('0x42')]]);if(!_0x1adfee){switch(_0x4f7240[_0x0a9e('0x42')]){case _0x0a9e('0x5c'):if(_0x4f7240[_0x0a9e('0x5d')]==0x1){_0x2c2cb0[_0x0a9e('0x5e')]('`'+_0x4f7240['field']+'`\x20=\x200');}else{_0x2c2cb0['having']('`'+_0x4f7240[_0x0a9e('0x42')]+_0x0a9e('0x5f'));}break;case _0x0a9e('0x60'):if(_0x4f7240['operator']===_0x0a9e('0x61')){if(_0x4f7240[_0x0a9e('0x5d')]['split']('\x20')['length']>0x1){_0x45c845[_0x19383e](_0x0a9e('0x62'),qs['getFullTextValue'](_0x4f7240[_0x0a9e('0x5d')]),null);}else{var _0x4c3845='%'+_0x4f7240[_0x0a9e('0x5d')]+'%';_0x45c845[_0x19383e](_0x0a9e('0x63'),_0x4c3845,_0x4c3845,_0x4c3845);}}else{_0x1adfee=_[_0x0a9e('0x5b')](_0x44295a,['name',_0x0a9e('0x64')]);_0x4f7240[_0x0a9e('0x42')]='ContactId';_0x2244d6=as['buildExpression'](_0x5ddf84,_0x1adfee[_0x0a9e('0x65')],_0x4f7240);_0x45c845[_0x19383e](_0x2244d6[_0x0a9e('0x66')],_0x2244d6['value'][_0x0a9e('0x67')],_0x2244d6['value'][_0x0a9e('0x1c')]);}break;case'Tag':var _0xe22ccc=_0x4f7240['value']['split'](',')['map'](function(_0x2da03c){return Number(_0x2da03c);});_0xe22ccc['forEach'](function(_0x2f7092){_0x5bbcde['or'](_0x0a9e('0x68'),'%,'+_0x2f7092+',%');});_0x45bf7f=_[_0x0a9e('0x69')](_0x45bf7f,_0xe22ccc);break;case _0x0a9e('0x6a'):if(_0x4f7240[_0x0a9e('0x6b')]===_0x0a9e('0x61')){_0x45c845[_0x19383e](_0x0a9e('0x6c'),'%'+_0x4f7240[_0x0a9e('0x5d')]+'%',null);}else{_0x1adfee=_['find'](_0x44295a,[_0x0a9e('0x20'),_0x0a9e('0x6d')]);_0x4f7240[_0x0a9e('0x42')]=_0x0a9e('0x6d');_0x2244d6=as[_0x0a9e('0x6e')](_0x5ddf84,_0x1adfee[_0x0a9e('0x65')],_0x4f7240);_0x45c845[_0x19383e](_0x2244d6['text'],_0x2244d6[_0x0a9e('0x5d')][_0x0a9e('0x67')],_0x2244d6['value'][_0x0a9e('0x1c')]);}break;case'plainBody':_0x2244d6=as[_0x0a9e('0x6e')]('me',null,_0x4f7240);_0x45c845[_0x19383e](_0x2244d6['text'],_0x2244d6['value']['start'],_0x2244d6[_0x0a9e('0x5d')]['end']);break;}}else{var _0x2244d6=as[_0x0a9e('0x6e')](_0x5ddf84,_0x1adfee[_0x0a9e('0x65')],_0x4f7240);_0x45c845[_0x19383e](_0x2244d6[_0x0a9e('0x66')],_0x2244d6[_0x0a9e('0x5d')][_0x0a9e('0x67')],_0x2244d6['value'][_0x0a9e('0x1c')]);}}}else{var _0x5854cc=_(_0x2b45ea[_0x0a9e('0x38')])[_0x0a9e('0x6f')]()[_0x0a9e('0x37')](function(_0x5adf8f){return _[_0x0a9e('0x70')](_0x44295a,[_0x0a9e('0x20'),_0x5adf8f])?_0x5adf8f:undefined;})[_0x0a9e('0x71')]()[_0x0a9e('0x5d')]();if(!_['isEmpty'](_0x5854cc)){_0x5854cc[_0x0a9e('0x26')](function(_0xe05a5a){if(_0xe05a5a==='MailAccountId'){_0x2c2cb0[_0x0a9e('0x72')](_0x0a9e('0x73'),[][_0x0a9e('0x74')](_0x2b45ea[_0x0a9e('0x38')][_0xe05a5a]));}else if(_0xe05a5a===_0x0a9e('0x75')){var _0x4d4a35=JSON[_0x0a9e('0x76')](_0x2b45ea[_0x0a9e('0x38')][_0xe05a5a])[_0x0a9e('0x77')];var _0x47bb43=JSON[_0x0a9e('0x76')](_0x2b45ea['query'][_0xe05a5a])['$lte'];_0x2c2cb0[_0x0a9e('0x72')](_0x0a9e('0x78'),_0x4d4a35,_0x47bb43);}else{if(_0x2b45ea[_0x0a9e('0x38')][_0xe05a5a]===_0x0a9e('0x79')){_0x2c2cb0[_0x0a9e('0x72')]('i.'+_0xe05a5a+_0x0a9e('0x7a'));}else{_0x2c2cb0[_0x0a9e('0x72')]('i.'+_0xe05a5a+_0x0a9e('0x7b'),_0x2b45ea[_0x0a9e('0x38')][_0xe05a5a]);}}});}if(_0x2b45ea[_0x0a9e('0x38')][_0x0a9e('0x7c')]){if(_0x2b45ea[_0x0a9e('0x38')][_0x0a9e('0x7c')]==0x1){_0x2c2cb0[_0x0a9e('0x5e')](_0x0a9e('0x7d'));}else{_0x2c2cb0[_0x0a9e('0x5e')](_0x0a9e('0x7e'));}}if(_0x2b45ea[_0x0a9e('0x38')]['tag']){_0x45bf7f=_[_0x0a9e('0x7f')](_0x2b45ea[_0x0a9e('0x38')][_0x0a9e('0x80')])?_0x2b45ea['query'][_0x0a9e('0x80')]:new Array(_0x2b45ea[_0x0a9e('0x38')]['tag']);_0x45bf7f[_0x0a9e('0x26')](function(_0x56e31e){_0x5bbcde['or'](_0x0a9e('0x68'),'%,'+_0x56e31e+',%');});}if(_0x2b45ea[_0x0a9e('0x38')][_0x0a9e('0x81')]){var _0x4a43a8=_0x2b45ea['query']['filter'][_0x0a9e('0x82')]('\x5c','\x5c\x5c')[_0x0a9e('0x82')](/'/g,'\x27\x27');if(qs[_0x0a9e('0x83')](_0x4a43a8)){_0x45c845['or'](_0x0a9e('0x84'),_0x4a43a8+'%');}else if(qs[_0x0a9e('0x85')](_0x4a43a8)){_0x45c845['or'](_0x0a9e('0x86'),_0x4a43a8+'%');}else{_0x45c845['or'](_0x0a9e('0x87'),qs[_0x0a9e('0x88')](_0x4a43a8))['or']('MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x0a9e('0x88')](_0x4a43a8));}}}_0x2c2cb0[_0x0a9e('0x72')](_0x45c845);_0x2c2cb0[_0x0a9e('0x89')]('i.id');var _0x2bdc44={'type':db['Sequelize'][_0x0a9e('0x8a')][_0x0a9e('0x8b')],'raw':!![]};var _0x4c46c1=_0x2c2cb0[_0x0a9e('0x8c')]();_0x4c46c1[_0x0a9e('0x42')](_0x0a9e('0x8d'));_0x4c46c1[_0x0a9e('0x42')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x0a9e('0x5c'));if(_0x332d35[_0x0a9e('0x8e')]){_0x332d35[_0x0a9e('0x8e')][_0x0a9e('0x26')](function(_0x5b7fc3){var _0x109ccb=_0x5b7fc3[0x0]===_0x0a9e('0x8f')?_0x5b7fc3[0x0]:'i.'+_0x5b7fc3[0x0];_0x2c2cb0[_0x0a9e('0x8e')](_0x109ccb,_0x5b7fc3[0x1]===_0x0a9e('0x90')?![]:!![]);});}if(!_['isEmpty'](_0x45bf7f)){_0x2c2cb0[_0x0a9e('0x5e')](_0x5bbcde);_0x4c46c1[_0x0a9e('0x72')](_0x0a9e('0x91'),_0x45bf7f);}BPromise[_0x0a9e('0x92')]()[_0x0a9e('0x1a')](function(){if(!_0x1bde3c){if(_0x2b45ea[_0x0a9e('0x38')][_0x0a9e('0x93')])return;_0x4c46c1[_0x0a9e('0x72')](_0x0a9e('0x94'));_0x2c2cb0[_0x0a9e('0x72')](_0x0a9e('0x94'));return;}if(_0x2b45ea[_0x0a9e('0x95')][_0x0a9e('0x96')]!==_0x0a9e('0x97'))return;return _0x2b45ea['user'][_0x0a9e('0x98')]({'attributes':['id'],'raw':!![]})[_0x0a9e('0x1a')](function(_0xc599b3){if(_['isEmpty'](_0xc599b3)){_0x4c46c1[_0x0a9e('0x72')](_0x0a9e('0x99'));_0x2c2cb0[_0x0a9e('0x72')](_0x0a9e('0x99'));}else{_0x4c46c1['where']('i.MailAccountId\x20IN\x20?',_[_0x0a9e('0x37')](_0xc599b3,'id'));_0x2c2cb0[_0x0a9e('0x72')]('i.MailAccountId\x20IN\x20?',_[_0x0a9e('0x37')](_0xc599b3,'id'));}});})['then'](function(){if(_0x2b45ea[_0x0a9e('0x95')][_0x0a9e('0x96')]==='agent'&&!_0x1bde3c&&!_0x2b45ea[_0x0a9e('0x38')][_0x0a9e('0x93')])return[];return db[_0x0a9e('0x9a')][_0x0a9e('0x38')](_0x4c46c1[_0x0a9e('0x9b')](),_0x2bdc44);})[_0x0a9e('0x1a')](function(_0x444f1f){_0x5583a4['count']=_0x444f1f[_0x0a9e('0x3c')];if(_0x5583a4[_0x0a9e('0x16')]===0x0)return[];return db[_0x0a9e('0x9a')][_0x0a9e('0x38')](_0xeaa5e5['toString'](),_0x2bdc44)[_0x0a9e('0x1a')](function(_0xf0db1){_0x13cb1f=_['keyBy'](_0xf0db1,'id');_0x2bdc44=_[_0x0a9e('0x9c')](_0x2bdc44,{'model':db['MailInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x2b45ea[_0x0a9e('0x38')][_0x0a9e('0x3b')]){_0x332d35[_0x0a9e('0x3a')][_0x0a9e('0x26')](function(_0x5af453){_0x2c2cb0['field']('i.'+_0x5af453);});}else{_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0x9d'),_0x0a9e('0x5c'));_0x2c2cb0['field'](_0x0a9e('0x9e'),_0x0a9e('0x9f'));_0x2c2cb0['field']('a.mandatoryDisposition',_0x0a9e('0xa0'));_0x2c2cb0['field']('CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20(\x27%\x27\x20+\x20a.email\x20+\x20\x27%\x27)\x20THEN\x20SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201)\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName');_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0x8d'));_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xa1'));_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xa2'));_0x2c2cb0['field'](_0x0a9e('0xa3'));_0x2c2cb0['field'](_0x0a9e('0xa4'));_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xa5'));_0x2c2cb0[_0x0a9e('0x42')]('i.lastMsgAt');_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xa6'));_0x2c2cb0[_0x0a9e('0x42')]('i.subject');_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xa7'));_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xa8'));_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xa9'));_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xaa'));_0x2c2cb0['field'](_0x0a9e('0xab'));_0x2c2cb0[_0x0a9e('0x42')]('i.ContactId');_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xac'));_0x2c2cb0[_0x0a9e('0x42')]('i.UserId');_0x2c2cb0[_0x0a9e('0x42')]('c.firstName',_0x0a9e('0xad'));_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xae'),_0x0a9e('0xaf'));_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xb0'),_0x0a9e('0xb1'));_0x2c2cb0[_0x0a9e('0x42')]('c.phone',_0x0a9e('0xb2'));_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xb3'),_0x0a9e('0xb4'));_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xb5'),_0x0a9e('0xb6'));_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xb7'),_0x0a9e('0xb8'));_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xb9'),_0x0a9e('0xba'));_0x2c2cb0['field'](_0x0a9e('0xbb'),_0x0a9e('0x28'));}if(_0x332d35[_0x0a9e('0x15')])_0x2c2cb0[_0x0a9e('0x15')](_0x332d35[_0x0a9e('0x15')]);if(_0x332d35['offset'])_0x2c2cb0[_0x0a9e('0x13')](_0x332d35[_0x0a9e('0x13')]);return db['sequelize'][_0x0a9e('0x38')](_0x2c2cb0['toString'](),_0x2bdc44);})[_0x0a9e('0x1a')](function(_0x27041d){if(_0x27041d[_0x0a9e('0x3c')]>0x0)_0x37f6cc[_0x0a9e('0x72')]('ui.MailInteractionId\x20IN\x20?',_[_0x0a9e('0x37')](_0x27041d,'id'));return db['sequelize'][_0x0a9e('0x38')](_0x37f6cc[_0x0a9e('0x9b')](),_0x2bdc44)['then'](function(_0x231c6a){var _0x63c9f7=_[_0x0a9e('0xbc')](_0x231c6a,'MailInteractionId');var _0x4c788f=[];return db[_0x0a9e('0xbd')][_0x0a9e('0x2a')]({'attributes':[_0x0a9e('0xbe')],'raw':!![]})[_0x0a9e('0x1a')](function(_0x3f2f40){var _0x2450a8=_0x3f2f40[_0x0a9e('0xbe')];_0x27041d[_0x0a9e('0x26')](function(_0x3f8124){_0x4c788f['push'](updateMailInteraction(_0x3f8124,_0x13cb1f,_0x63c9f7,_0x2450a8));});return BPromise[_0x0a9e('0xbf')](_0x4c788f);});});});})['then'](function(_0x287324){_0x5583a4[_0x0a9e('0xc0')]=_0x287324;return _0x5583a4;})[_0x0a9e('0x1a')](respondWithFilteredResult(_0x409319,_0x332d35))[_0x0a9e('0x30')](handleError(_0x409319,null));};exports[_0x0a9e('0xc1')]=function(_0x4e7273,_0x436313){var _0x4667bf={'raw':![],'where':{'id':_0x4e7273[_0x0a9e('0xc2')]['id']}},_0x2791c5={};_0x2791c5[_0x0a9e('0x36')]=_['keys'](db['MailInteraction'][_0x0a9e('0x33')]);_0x2791c5['query']=_[_0x0a9e('0x6f')](_0x4e7273[_0x0a9e('0x38')]);_0x2791c5[_0x0a9e('0x3f')]=_[_0x0a9e('0x39')](_0x2791c5[_0x0a9e('0x36')],_0x2791c5[_0x0a9e('0x38')]);_0x4667bf['attributes']=_['intersection'](_0x2791c5[_0x0a9e('0x36')],qs['fields'](_0x4e7273[_0x0a9e('0x38')]['fields']));_0x4667bf[_0x0a9e('0x3a')]=_0x4667bf['attributes']['length']?_0x4667bf[_0x0a9e('0x3a')]:_0x2791c5[_0x0a9e('0x36')];if(_0x4e7273['query'][_0x0a9e('0xc3')]){_0x4667bf[_0x0a9e('0xc4')]=[{'all':!![]}];}_0x4667bf=_[_0x0a9e('0x9c')]({},_0x4667bf,_0x4e7273[_0x0a9e('0xc5')]);return db[_0x0a9e('0x32')]['find'](_0x4667bf)['then'](handleEntityNotFound(_0x436313,null))[_0x0a9e('0x1a')](respondWithResult(_0x436313,null))[_0x0a9e('0x30')](handleError(_0x436313,null));};exports[_0x0a9e('0xc6')]=function(_0x24beb6,_0x59303b){return db['MailInteraction'][_0x0a9e('0xc6')](_0x24beb6[_0x0a9e('0xc7')],{})['then'](respondWithResult(_0x59303b,0xc9))[_0x0a9e('0x30')](handleError(_0x59303b,null));};exports[_0x0a9e('0x19')]=function(_0xcacabb,_0x2427d5){if(_0xcacabb[_0x0a9e('0xc7')]['id']){delete _0xcacabb[_0x0a9e('0xc7')]['id'];}return db[_0x0a9e('0x32')][_0x0a9e('0x5b')]({'where':{'id':_0xcacabb[_0x0a9e('0xc2')]['id']}})[_0x0a9e('0x1a')](handleEntityNotFound(_0x2427d5,null))['then'](saveUpdates(_0xcacabb[_0x0a9e('0xc7')],null))[_0x0a9e('0x1a')](respondWithResult(_0x2427d5,null))[_0x0a9e('0x30')](handleError(_0x2427d5,null));};exports[_0x0a9e('0x1b')]=function(_0x1d0b02,_0x547e37){return db['MailInteraction'][_0x0a9e('0x5b')]({'where':{'id':_0x1d0b02[_0x0a9e('0xc2')]['id']}})[_0x0a9e('0x1a')](handleEntityNotFound(_0x547e37,null))[_0x0a9e('0x1a')](removeEntity(_0x547e37,null))[_0x0a9e('0x30')](handleError(_0x547e37,null));};exports['describe']=function(_0x1339d0,_0x3c775a){return db[_0x0a9e('0x32')]['describe']()[_0x0a9e('0x1a')](respondWithResult(_0x3c775a,null))['catch'](handleError(_0x3c775a,null));};exports[_0x0a9e('0xc8')]=function(_0x4799d4,_0x25b745){return db[_0x0a9e('0x29')][_0x0a9e('0x5b')]({'where':{'id':_0x4799d4['params']['id']}})[_0x0a9e('0x1a')](handleEntityNotFound(_0x25b745,null))['then'](function(_0x4383da){if(_0x4383da){return _0x4383da[_0x0a9e('0xc8')](_0x4799d4[_0x0a9e('0xc7')][_0x0a9e('0xc9')],_[_0x0a9e('0xca')](_0x4799d4[_0x0a9e('0xc7')],[_0x0a9e('0xc9'),'id'])||{});}})[_0x0a9e('0x1a')](respondWithResult(_0x25b745,null))[_0x0a9e('0x30')](handleError(_0x25b745,null));};exports[_0x0a9e('0xcb')]=function(_0x4262d0,_0xc876d4){var _0x2415fe={'raw':![],'where':{}};var _0x399def={};var _0x98c62c={'count':0x0,'rows':[]};return db[_0x0a9e('0x32')]['findOne']({'where':{'id':_0x4262d0['params']['id']}})[_0x0a9e('0x1a')](handleEntityNotFound(_0xc876d4,null))['then'](function(_0x1d999b){if(_0x1d999b){_0x399def[_0x0a9e('0x36')]=_['keys'](db[_0x0a9e('0x29')][_0x0a9e('0x33')]);_0x399def[_0x0a9e('0x38')]=_[_0x0a9e('0x6f')](_0x4262d0['query']);_0x399def[_0x0a9e('0x3f')]=_[_0x0a9e('0x39')](_0x399def[_0x0a9e('0x36')],_0x399def[_0x0a9e('0x38')]);_0x2415fe['attributes']=_[_0x0a9e('0x39')](_0x399def[_0x0a9e('0x36')],qs[_0x0a9e('0x3b')](_0x4262d0['query'][_0x0a9e('0x3b')]));_0x2415fe[_0x0a9e('0x3a')]=_0x2415fe[_0x0a9e('0x3a')]['length']?_0x2415fe[_0x0a9e('0x3a')]:_0x399def[_0x0a9e('0x36')];if(!_0x4262d0[_0x0a9e('0x38')][_0x0a9e('0x3d')](_0x0a9e('0xcc'))){_0x2415fe['limit']=qs[_0x0a9e('0x15')](_0x4262d0[_0x0a9e('0x38')]['limit']);_0x2415fe[_0x0a9e('0x13')]=qs[_0x0a9e('0x13')](_0x4262d0[_0x0a9e('0x38')]['offset']);}_0x2415fe['order']=qs['sort'](_0x4262d0[_0x0a9e('0x38')][_0x0a9e('0x3e')]);_0x2415fe['where']=qs[_0x0a9e('0x3f')](_[_0x0a9e('0x40')](_0x4262d0[_0x0a9e('0x38')],_0x399def['filters']));_0x2415fe[_0x0a9e('0x72')][_0x0a9e('0xcd')]=_0x1d999b['id'];if(_0x4262d0[_0x0a9e('0x38')][_0x0a9e('0x81')]){_0x2415fe[_0x0a9e('0x72')]=_[_0x0a9e('0x9c')](_0x2415fe[_0x0a9e('0x72')],{'$or':_[_0x0a9e('0x37')](_0x2415fe[_0x0a9e('0x3a')],function(_0x5a1848){var _0x43c397={};_0x43c397[_0x5a1848]={'$like':'%'+_0x4262d0['query'][_0x0a9e('0x81')]+'%'};return _0x43c397;})});}if(_0x4262d0[_0x0a9e('0x38')][_0x0a9e('0x77')]){var _0x3cf222=_0x4262d0[_0x0a9e('0x38')][_0x0a9e('0x77')]['split'](',');var _0x1a0314={};_0x1a0314[_0x3cf222[0x0]]={'$gte':moment(_0x3cf222[0x1])[_0x0a9e('0xce')](_0x0a9e('0xcf'))};_0x2415fe[_0x0a9e('0x72')]=_['merge'](_0x2415fe[_0x0a9e('0x72')],_0x1a0314);}_0x2415fe=_[_0x0a9e('0x9c')]({},_0x2415fe,_0x4262d0[_0x0a9e('0xc5')]);return db[_0x0a9e('0x29')][_0x0a9e('0x16')]({'where':_0x2415fe[_0x0a9e('0x72')]})[_0x0a9e('0x1a')](function(_0x25931e){_0x98c62c[_0x0a9e('0x16')]=_0x25931e;if(_0x4262d0[_0x0a9e('0x38')]['includeAll']){_0x2415fe[_0x0a9e('0xc4')]=[{'all':!![]}];}return db[_0x0a9e('0x29')][_0x0a9e('0xd0')](_0x2415fe);})[_0x0a9e('0x1a')](function(_0xea8bd1){if(_0x4262d0[_0x0a9e('0x38')][_0x0a9e('0xd1')]===_0x0a9e('0xd2')){for(var _0x566b90=0x0;_0x566b90<_0xea8bd1[_0x0a9e('0x3c')];_0x566b90++){_0xea8bd1[_0x566b90][_0x0a9e('0xc7')]=juice(_0xea8bd1[_0x566b90][_0x0a9e('0xc7')]);}}_0x98c62c['rows']=_0xea8bd1;return _0x98c62c;});}})[_0x0a9e('0x1a')](respondWithFilteredResult(_0xc876d4,_0x2415fe))[_0x0a9e('0x30')](handleError(_0xc876d4,null));};exports[_0x0a9e('0xd3')]=function(_0x97d5b5,_0x370b5e){return db[_0x0a9e('0x32')][_0x0a9e('0x5b')]({'where':{'id':_0x97d5b5[_0x0a9e('0xc2')]['id']}})[_0x0a9e('0x1a')](handleEntityNotFound(_0x370b5e,null))[_0x0a9e('0x1a')](function(_0x5a7dad){if(_0x5a7dad){return _0x5a7dad[_0x0a9e('0xd4')](_0x97d5b5[_0x0a9e('0xc7')][_0x0a9e('0xc9')],_[_0x0a9e('0xca')](_0x97d5b5[_0x0a9e('0xc7')],[_0x0a9e('0xc9'),'id'])||{})['spread'](function(){return db[_0x0a9e('0xd5')]['findAll']({'attributes':['id','name','color'],'where':{'id':_0x97d5b5[_0x0a9e('0xc7')][_0x0a9e('0xc9')]}});})[_0x0a9e('0x1a')](function(_0x2a07d0){socket['emit'](_0x0a9e('0xd6'),{'id':Number(_0x97d5b5[_0x0a9e('0xc2')]['id']),'tags':_0x2a07d0||[]});return{'id':Number(_0x97d5b5[_0x0a9e('0xc2')]['id']),'tags':_0x2a07d0||[]};});}})[_0x0a9e('0x1a')](respondWithResult(_0x370b5e,null))[_0x0a9e('0x30')](handleError(_0x370b5e,null));};exports['removeTags']=function(_0x57b1b1,_0x9484c8){return db[_0x0a9e('0x32')][_0x0a9e('0x5b')]({'where':{'id':_0x57b1b1['params']['id']}})[_0x0a9e('0x1a')](handleEntityNotFound(_0x9484c8,null))[_0x0a9e('0x1a')](function(_0x422f0a){if(_0x422f0a){return _0x422f0a['removeTags'](_0x57b1b1[_0x0a9e('0x38')][_0x0a9e('0xc9')]);}})[_0x0a9e('0x1a')](respondWithStatusCode(_0x9484c8,null))['catch'](handleError(_0x9484c8,null));};exports[_0x0a9e('0xd7')]=function(_0x336b30,_0x3b7213){var _0x549e03=moment()['unix']()['toString']();var _0x3b04fd=path[_0x0a9e('0xd8')](config[_0x0a9e('0xd9')],_0x0a9e('0xda'),'files',_0x0a9e('0xdb'));var _0x532424=path[_0x0a9e('0xd8')](config[_0x0a9e('0xd9')],_0x0a9e('0xda'),'files',_0x0a9e('0xdc'));var _0x33a26c=path[_0x0a9e('0xd8')](_0x3b04fd,_0x549e03);var _0x580dd6=util[_0x0a9e('0xce')]('transcript-%d-%s.zip',_0x336b30[_0x0a9e('0xc2')]['id'],_0x549e03);var _0x5c57e1=path[_0x0a9e('0xd8')](_0x3b04fd,_0x580dd6);var _0x57b7d4=[];if(_0x336b30[_0x0a9e('0x38')][_0x0a9e('0xdc')]){_0x57b7d4[_0x0a9e('0x27')]({'model':db[_0x0a9e('0xdd')],'as':_0x0a9e('0xde'),'raw':!![]});}var _0x251dd9=[{'model':db[_0x0a9e('0x29')],'as':'Messages','attributes':['id',_0x0a9e('0xc7'),_0x0a9e('0x44'),'to','cc','bcc',_0x0a9e('0xdf'),_0x0a9e('0x75')],'where':{'secret':![]},'order':qs['sort']('id'),'include':_0x57b7d4}];return db[_0x0a9e('0x32')][_0x0a9e('0x5b')]({'where':{'id':_0x336b30[_0x0a9e('0xc2')]['id']},'include':_0x251dd9})['then'](handleEntityNotFound(_0x3b7213,null))[_0x0a9e('0x1a')](function(_0xf49ed4){if(_0xf49ed4&&_0xf49ed4[_0x0a9e('0xe0')]){var _0x3f0d64=_0xf49ed4[_0x0a9e('0xe1')]({'plain':!![]});fs[_0x0a9e('0xe2')](_0x33a26c);return BPromise[_0x0a9e('0xe3')](_0x3f0d64[_0x0a9e('0xe0')],function(_0x22767f,_0x426c3c){var _0x56e148={'from':_0x22767f[_0x0a9e('0x44')],'to':_0x22767f['to'],'subject':_0x22767f['subject'],'html':_0x22767f[_0x0a9e('0xc7')],'headers':{'Date':moment(_0x22767f[_0x0a9e('0x75')])[_0x0a9e('0xce')](_0x0a9e('0xe4'))},'attachments':[]};if(_0x22767f['cc']){_0x56e148[_0x0a9e('0xe5')]['Cc']=_0x22767f['cc'];}if(_0x22767f[_0x0a9e('0xe6')]){_0x56e148['headers'][_0x0a9e('0xe7')]=_0x22767f[_0x0a9e('0xe6')];}return new BPromise(function(_0x2977a7,_0x55a599){if(_0x22767f[_0x0a9e('0xde')]){for(var _0x402544=0x0;_0x402544<_0x22767f[_0x0a9e('0xde')][_0x0a9e('0x3c')];_0x402544++){var _0x31e1e0=_0x22767f[_0x0a9e('0xde')][_0x402544];var _0x1e93f5=path['join'](_0x532424,_0x31e1e0[_0x0a9e('0xe8')]);if(fs[_0x0a9e('0xe9')](_0x1e93f5)){_0x56e148[_0x0a9e('0xdc')][_0x0a9e('0x27')]({'name':_0x31e1e0[_0x0a9e('0x20')],'contentType':_0x31e1e0[_0x0a9e('0x65')],'data':fs[_0x0a9e('0xea')](_0x1e93f5)});}}}emlformat['build'](_0x56e148,function(_0x5c8720,_0x10aa22){if(_0x5c8720)return _0x55a599(_0x5c8720);fs[_0x0a9e('0xeb')](path[_0x0a9e('0xd8')](_0x33a26c,util[_0x0a9e('0xce')](_0x0a9e('0xec'),_0x426c3c)),_0x10aa22);return _0x2977a7(_0x10aa22);});});})[_0x0a9e('0x1a')](function(){return new BPromise(function(_0x609711,_0x584854){zipdir(_0x33a26c,{'saveTo':_0x5c57e1},function(_0x39ea62,_0x1d7fc4){if(_0x39ea62)return _0x584854(_0x39ea62);return _0x609711(_0x1d7fc4);});})[_0x0a9e('0x1a')](function(){return new BPromise(function(_0x2675a5,_0x1b1757){rimraf(_0x33a26c,function(_0x3c6082){if(_0x3c6082)_0x1b1757(_0x3c6082);return _0x2675a5();});});})[_0x0a9e('0x1a')](function(){return _0x3b7213['download'](_0x5c57e1,_0x580dd6,function(_0x311288){if(!_0x311288)fs[_0x0a9e('0xed')](_0x5c57e1);});});});}else{return _0x3b7213[_0x0a9e('0x1d')](0xc8);}})['catch'](handleError(_0x3b7213,null));}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.events.js b/server/api/mailInteraction/mailInteraction.events.js index f552300..cbad3aa 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 _0x04a3=['unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','MailInteraction','MailMessage','setMaxListeners','update','then','setDataValue','Users','map','findAll'];(function(_0x1db498,_0x4589c4){var _0x5a171f=function(_0x24dd12){while(--_0x24dd12){_0x1db498['push'](_0x1db498['shift']());}};_0x5a171f(++_0x4589c4);}(_0x04a3,0x16f));var _0x304a=function(_0xdbd382,_0xd6fe19){_0xdbd382=_0xdbd382-0x0;var _0x5b8f82=_0x04a3[_0xdbd382];return _0x5b8f82;};'use strict';var EventEmitter=require(_0x304a('0x0'));var MailInteraction=require(_0x304a('0x1'))['db'][_0x304a('0x2')];var MailMessage=require('../../mysqldb')['db'][_0x304a('0x3')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0x304a('0x4')](0x0);var events={'afterCreate':'save','afterUpdate':_0x304a('0x5'),'afterDestroy':'remove'};function emitEvent(_0x3558ab){return function(_0x20748c,_0x383cfc,_0x56a2c9){_0x20748c['getUsers']({'attributes':['id'],'raw':!![]})[_0x304a('0x6')](function(_0x5155fb){_0x20748c[_0x304a('0x7')](_0x304a('0x8'),_0x5155fb[_0x304a('0x9')](function(_0x386943){return{'id':_0x386943['id']};}));return MailMessage[_0x304a('0xa')]({'where':{'MailInteractionId':_0x20748c['id'],'direction':'in','read':![]},'raw':!![]});})[_0x304a('0x6')](function(_0x52097a){_0x20748c['setDataValue'](_0x304a('0xb'),_0x52097a[_0x304a('0xc')]);MailInteractionEvents[_0x304a('0xd')](_0x3558ab+':'+_0x20748c['id'],_0x20748c);MailInteractionEvents[_0x304a('0xd')](_0x3558ab,_0x20748c);_0x56a2c9(null);})[_0x304a('0xe')](_0x56a2c9(null));};}for(var e in events){if(events[_0x304a('0xf')](e)){var event=events[e];MailInteraction[_0x304a('0x10')](e,emitEvent(event));}}module[_0x304a('0x11')]=MailInteractionEvents; \ No newline at end of file +var _0xe45e=['unreadMessages','length','emit','hook','exports','../../mysqldb','MailMessage','setMaxListeners','save','update','remove','then','Users','map','findAll'];(function(_0x53f72a,_0x4b7999){var _0x3d49cf=function(_0xe8d3b){while(--_0xe8d3b){_0x53f72a['push'](_0x53f72a['shift']());}};_0x3d49cf(++_0x4b7999);}(_0xe45e,0x17c));var _0xee45=function(_0x1177d5,_0x22b649){_0x1177d5=_0x1177d5-0x0;var _0xc3ddc2=_0xe45e[_0x1177d5];return _0xc3ddc2;};'use strict';var EventEmitter=require('events');var MailInteraction=require(_0xee45('0x0'))['db']['MailInteraction'];var MailMessage=require('../../mysqldb')['db'][_0xee45('0x1')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0xee45('0x2')](0x0);var events={'afterCreate':_0xee45('0x3'),'afterUpdate':_0xee45('0x4'),'afterDestroy':_0xee45('0x5')};function emitEvent(_0x37efc1){return function(_0x132141,_0xddb1fe,_0x32c90a){_0x132141['getUsers']({'attributes':['id'],'raw':!![]})[_0xee45('0x6')](function(_0x21f141){_0x132141['setDataValue'](_0xee45('0x7'),_0x21f141[_0xee45('0x8')](function(_0x55888b){return{'id':_0x55888b['id']};}));return MailMessage[_0xee45('0x9')]({'where':{'MailInteractionId':_0x132141['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x2b8de7){_0x132141['setDataValue'](_0xee45('0xa'),_0x2b8de7[_0xee45('0xb')]);MailInteractionEvents['emit'](_0x37efc1+':'+_0x132141['id'],_0x132141);MailInteractionEvents[_0xee45('0xc')](_0x37efc1,_0x132141);_0x32c90a(null);})['catch'](_0x32c90a(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailInteraction[_0xee45('0xd')](e,emitEvent(event));}}module[_0xee45('0xe')]=MailInteractionEvents; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.model.js b/server/api/mailInteraction/mailInteraction.model.js index 36f70e9..407e970 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 _0x35f7=['../../config/logger','path','rimraf','../../config/environment','./mailInteraction.attributes','define','fti_mail_interactions','subject','FULLTEXT','substatusAt','format','YYYY-MM-DD\x20HH:mm:ss','closed','changed','substatus','closedAt','models','get','MailMessage','update','then','catch','utf8mb4','utf8mb4_unicode_ci','util'];(function(_0x227e00,_0x1d74ed){var _0x359bce=function(_0x4f8e03){while(--_0x4f8e03){_0x227e00['push'](_0x227e00['shift']());}};_0x359bce(++_0x1d74ed);}(_0x35f7,0x18f));var _0x735f=function(_0x5cf599,_0x8e94e9){_0x5cf599=_0x5cf599-0x0;var _0x3d4c38=_0x35f7[_0x5cf599];return _0x3d4c38;};'use strict';var _=require('lodash');var util=require(_0x735f('0x0'));var logger=require(_0x735f('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x735f('0x2'));var rimraf=require(_0x735f('0x3'));var config=require(_0x735f('0x4'));var attributes=require(_0x735f('0x5'));module['exports']=function(_0x46a744,_0x5ad3e5){return _0x46a744[_0x735f('0x6')]('MailInteraction',attributes,{'tableName':'mail_interactions','paranoid':![],'indexes':[{'name':_0x735f('0x7'),'fields':[_0x735f('0x8'),'to'],'type':_0x735f('0x9')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x32febd,_0x46b87f,_0x12c1f4){if(_0x32febd['substatus']){_0x32febd[_0x735f('0xa')]=moment()[_0x735f('0xb')](_0x735f('0xc'));}if(_0x32febd[_0x735f('0xd')]){_0x32febd['closedAt']=moment()[_0x735f('0xb')](_0x735f('0xc'));}_0x12c1f4(null,_0x46b87f);},'beforeUpdate':function(_0x1d76de,_0x26f8c4,_0x79d8ff){if(_0x1d76de[_0x735f('0xe')]('substatus')){_0x1d76de[_0x735f('0xa')]=_0x1d76de[_0x735f('0xf')]?moment()['format'](_0x735f('0xc')):null;}if(_0x1d76de[_0x735f('0xe')](_0x735f('0xd'))){_0x1d76de[_0x735f('0x10')]=moment()[_0x735f('0xb')](_0x735f('0xc'));_0x1d76de[_0x735f('0xf')]=null;_0x1d76de[_0x735f('0xa')]=null;}_0x79d8ff(null,_0x1d76de);},'afterUpdate':function(_0x1d708b,_0x11bda8,_0x491882){var _0x347ca4=_0x46a744[_0x735f('0x11')];var _0x252b59=_0x1d708b[_0x735f('0x12')]({'plain':!![]});if(_0x252b59[_0x735f('0xd')]){return _0x347ca4[_0x735f('0x13')][_0x735f('0x14')]({'read':!![]},{'where':{'MailInteractionId':_0x252b59['id']}})[_0x735f('0x15')](function(){_0x491882();})[_0x735f('0x16')](function(_0x37d205){_0x491882(_0x37d205);});}else{_0x491882();}}},'charset':_0x735f('0x17'),'collate':_0x735f('0x18')});}; \ No newline at end of file +var _0x2964=['format','YYYY-MM-DD\x20HH:mm:ss','closedAt','changed','closed','models','get','MailMessage','update','then','catch','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','request-promise','../../config/environment','./mailInteraction.attributes','exports','MailInteraction','mail_interactions','fti_mail_interactions','subject','FULLTEXT','substatus','substatusAt'];(function(_0x46d58e,_0x14c017){var _0x23fd3d=function(_0x2afc31){while(--_0x2afc31){_0x46d58e['push'](_0x46d58e['shift']());}};_0x23fd3d(++_0x14c017);}(_0x2964,0xd1));var _0x4296=function(_0x3ed5d4,_0x4fa01a){_0x3ed5d4=_0x3ed5d4-0x0;var _0x22b925=_0x2964[_0x3ed5d4];return _0x22b925;};'use strict';var _=require(_0x4296('0x0'));var util=require(_0x4296('0x1'));var logger=require(_0x4296('0x2'))('api');var moment=require(_0x4296('0x3'));var BPromise=require('bluebird');var rp=require(_0x4296('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x4296('0x5'));var attributes=require(_0x4296('0x6'));module[_0x4296('0x7')]=function(_0x74fe96,_0x3c6e18){return _0x74fe96['define'](_0x4296('0x8'),attributes,{'tableName':_0x4296('0x9'),'paranoid':![],'indexes':[{'name':_0x4296('0xa'),'fields':[_0x4296('0xb'),'to'],'type':_0x4296('0xc')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x10bc9d,_0x3367b9,_0x103a6c){if(_0x10bc9d[_0x4296('0xd')]){_0x10bc9d[_0x4296('0xe')]=moment()[_0x4296('0xf')](_0x4296('0x10'));}if(_0x10bc9d['closed']){_0x10bc9d[_0x4296('0x11')]=moment()[_0x4296('0xf')](_0x4296('0x10'));}_0x103a6c(null,_0x3367b9);},'beforeUpdate':function(_0x2bef6e,_0x394812,_0x43f2f7){if(_0x2bef6e[_0x4296('0x12')]('substatus')){_0x2bef6e[_0x4296('0xe')]=_0x2bef6e[_0x4296('0xd')]?moment()[_0x4296('0xf')](_0x4296('0x10')):null;}if(_0x2bef6e[_0x4296('0x12')](_0x4296('0x13'))){_0x2bef6e[_0x4296('0x11')]=moment()[_0x4296('0xf')](_0x4296('0x10'));_0x2bef6e[_0x4296('0xd')]=null;_0x2bef6e['substatusAt']=null;}_0x43f2f7(null,_0x2bef6e);},'afterUpdate':function(_0x2dd33c,_0x207038,_0x2a7429){var _0x47598d=_0x74fe96[_0x4296('0x14')];var _0x1349c9=_0x2dd33c[_0x4296('0x15')]({'plain':!![]});if(_0x1349c9['closed']){return _0x47598d[_0x4296('0x16')][_0x4296('0x17')]({'read':!![]},{'where':{'MailInteractionId':_0x1349c9['id']}})[_0x4296('0x18')](function(){_0x2a7429();})[_0x4296('0x19')](function(_0x2d8934){_0x2a7429(_0x2d8934);});}else{_0x2a7429();}}},'charset':_0x4296('0x1a'),'collate':_0x4296('0x1b')});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.rpc.js b/server/api/mailInteraction/mailInteraction.rpc.js index 5876dbd..d1df210 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 _0xefe2=['message','catch','UpdateMailInteraction','MailInteraction','update','body','options','raw','where','attributes','AddTagsToMailInteraction','find','addTags','ids','omit','AddTags','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','./mailInteraction.socket','register','then','info','MailInteraction,\x20%s,\x20%s','debug','MailInteraction,\x20%s,\x20%s,\x20%s','stringify','code','error'];(function(_0x37c375,_0x4fc5b7){var _0x2452ee=function(_0x52c083){while(--_0x52c083){_0x37c375['push'](_0x37c375['shift']());}};_0x2452ee(++_0x4fc5b7);}(_0xefe2,0x178));var _0x2efe=function(_0x58e319,_0x28e3ae){_0x58e319=_0x58e319-0x0;var _0x577fc2=_0xefe2[_0x58e319];return _0x577fc2;};'use strict';var _=require(_0x2efe('0x0'));var util=require(_0x2efe('0x1'));var moment=require('moment');var BPromise=require(_0x2efe('0x2'));var rs=require(_0x2efe('0x3'));var fs=require('fs');var Redis=require(_0x2efe('0x4'));var db=require(_0x2efe('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x2efe('0x6'))(_0x2efe('0x7'));var config=require(_0x2efe('0x8'));var jayson=require(_0x2efe('0x9'));var client=jayson[_0x2efe('0xa')][_0x2efe('0xb')]({'port':0x232a});config[_0x2efe('0xc')]=_['defaults'](config[_0x2efe('0xc')],{'host':_0x2efe('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2efe('0xc')]));require(_0x2efe('0xe'))[_0x2efe('0xf')](socket);function respondWithRpcPromise(_0x4f3648,_0x4f402e,_0x32eca4){return new BPromise(function(_0x121fbb,_0x60f280){return client['request'](_0x4f3648,_0x32eca4)[_0x2efe('0x10')](function(_0x25e1ac){logger[_0x2efe('0x11')](_0x2efe('0x12'),_0x4f402e,'request\x20sent');logger[_0x2efe('0x13')](_0x2efe('0x14'),_0x4f402e,'request\x20sent',JSON[_0x2efe('0x15')](_0x25e1ac));if(_0x25e1ac['error']){if(_0x25e1ac['error'][_0x2efe('0x16')]===0x1f4){logger['error'](_0x2efe('0x12'),_0x4f402e,_0x25e1ac[_0x2efe('0x17')][_0x2efe('0x18')]);return _0x60f280(_0x25e1ac[_0x2efe('0x17')]['message']);}logger[_0x2efe('0x17')]('MailInteraction,\x20%s,\x20%s',_0x4f402e,_0x25e1ac[_0x2efe('0x17')]['message']);return _0x121fbb(_0x25e1ac['error'][_0x2efe('0x18')]);}else{logger[_0x2efe('0x11')](_0x2efe('0x12'),_0x4f402e,'request\x20sent');_0x121fbb(_0x25e1ac['result'][_0x2efe('0x18')]);}})[_0x2efe('0x19')](function(_0x21d12e){logger[_0x2efe('0x17')](_0x2efe('0x12'),_0x4f402e,_0x21d12e);_0x60f280(_0x21d12e);});});}exports[_0x2efe('0x1a')]=function(_0x346cad){var _0x5e11ea=this;return new Promise(function(_0x5fe657,_0x2b316b){return db[_0x2efe('0x1b')][_0x2efe('0x1c')](_0x346cad[_0x2efe('0x1d')],{'raw':_0x346cad[_0x2efe('0x1e')]?_0x346cad[_0x2efe('0x1e')][_0x2efe('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x346cad['options']?_0x346cad[_0x2efe('0x1e')][_0x2efe('0x20')]||null:null,'attributes':_0x346cad['options']?_0x346cad['options'][_0x2efe('0x21')]||null:null,'limit':_0x346cad[_0x2efe('0x1e')]?_0x346cad[_0x2efe('0x1e')]['limit']||null:null})[_0x2efe('0x10')](function(_0x400e64){logger[_0x2efe('0x11')](_0x2efe('0x1a'),_0x346cad);logger['debug'](_0x2efe('0x1a'),_0x346cad,JSON[_0x2efe('0x15')](_0x400e64));_0x5fe657(_0x400e64);})['catch'](function(_0x4a8a39){logger[_0x2efe('0x17')](_0x2efe('0x1a'),_0x4a8a39['message'],_0x346cad);_0x2b316b(_0x5e11ea[_0x2efe('0x17')](0x1f4,_0x4a8a39['message']));});});};exports[_0x2efe('0x22')]=function(_0x2db43d){return new Promise(function(_0x5ed680,_0x13bb84){return db['MailInteraction'][_0x2efe('0x23')]({'where':_0x2db43d['options']?_0x2db43d[_0x2efe('0x1e')][_0x2efe('0x20')]||null:null})[_0x2efe('0x10')](function(_0x3dfd30){if(_0x3dfd30){return _0x3dfd30[_0x2efe('0x24')](_0x2db43d[_0x2efe('0x1d')][_0x2efe('0x25')],_[_0x2efe('0x26')](_0x2db43d['body'],[_0x2efe('0x25'),'id'])||{});}})['spread'](function(_0x54aaa0){logger[_0x2efe('0x11')](_0x2efe('0x27'),_0x2db43d);logger[_0x2efe('0x13')](_0x2efe('0x27'),_0x2db43d,JSON[_0x2efe('0x15')](_0x54aaa0));_0x5ed680(_0x54aaa0);})[_0x2efe('0x19')](function(_0x24107d){logger[_0x2efe('0x17')](_0x2efe('0x27'),_0x24107d[_0x2efe('0x18')],_0x2db43d);_0x13bb84(_this[_0x2efe('0x17')](0x1f4,_0x24107d[_0x2efe('0x18')]));});});}; \ No newline at end of file +var _0x2ba6=['result','catch','UpdateMailInteraction','MailInteraction','update','body','options','raw','where','attributes','limit','then','debug','find','ids','spread','AddTags','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','./mailInteraction.socket','register','request','info','MailInteraction,\x20%s,\x20%s','MailInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message'];(function(_0x175009,_0x5a32a0){var _0x1fc420=function(_0x3b15d1){while(--_0x3b15d1){_0x175009['push'](_0x175009['shift']());}};_0x1fc420(++_0x5a32a0);}(_0x2ba6,0x1ea));var _0x62ba=function(_0x4efc41,_0x188659){_0x4efc41=_0x4efc41-0x0;var _0x5de8e7=_0x2ba6[_0x4efc41];return _0x5de8e7;};'use strict';var _=require(_0x62ba('0x0'));var util=require(_0x62ba('0x1'));var moment=require(_0x62ba('0x2'));var BPromise=require(_0x62ba('0x3'));var rs=require(_0x62ba('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x62ba('0x5'))['db'];var utils=require(_0x62ba('0x6'));var logger=require(_0x62ba('0x7'))(_0x62ba('0x8'));var config=require(_0x62ba('0x9'));var jayson=require(_0x62ba('0xa'));var client=jayson['client'][_0x62ba('0xb')]({'port':0x232a});config[_0x62ba('0xc')]=_[_0x62ba('0xd')](config['redis'],{'host':_0x62ba('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x62ba('0xc')]));require(_0x62ba('0xf'))[_0x62ba('0x10')](socket);function respondWithRpcPromise(_0x15d2fa,_0x405e92,_0x1c5e97){return new BPromise(function(_0x22e81e,_0x22c473){return client[_0x62ba('0x11')](_0x15d2fa,_0x1c5e97)['then'](function(_0x1a8a5b){logger[_0x62ba('0x12')](_0x62ba('0x13'),_0x405e92,'request\x20sent');logger['debug'](_0x62ba('0x14'),_0x405e92,_0x62ba('0x15'),JSON[_0x62ba('0x16')](_0x1a8a5b));if(_0x1a8a5b[_0x62ba('0x17')]){if(_0x1a8a5b[_0x62ba('0x17')][_0x62ba('0x18')]===0x1f4){logger[_0x62ba('0x17')](_0x62ba('0x13'),_0x405e92,_0x1a8a5b[_0x62ba('0x17')][_0x62ba('0x19')]);return _0x22c473(_0x1a8a5b[_0x62ba('0x17')][_0x62ba('0x19')]);}logger['error'](_0x62ba('0x13'),_0x405e92,_0x1a8a5b[_0x62ba('0x17')][_0x62ba('0x19')]);return _0x22e81e(_0x1a8a5b[_0x62ba('0x17')]['message']);}else{logger[_0x62ba('0x12')](_0x62ba('0x13'),_0x405e92,_0x62ba('0x15'));_0x22e81e(_0x1a8a5b[_0x62ba('0x1a')][_0x62ba('0x19')]);}})[_0x62ba('0x1b')](function(_0x5750ca){logger[_0x62ba('0x17')](_0x62ba('0x13'),_0x405e92,_0x5750ca);_0x22c473(_0x5750ca);});});}exports[_0x62ba('0x1c')]=function(_0x4318cc){var _0xf00b36=this;return new Promise(function(_0x3a5679,_0x4296b9){return db[_0x62ba('0x1d')][_0x62ba('0x1e')](_0x4318cc[_0x62ba('0x1f')],{'raw':_0x4318cc[_0x62ba('0x20')]?_0x4318cc[_0x62ba('0x20')][_0x62ba('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4318cc[_0x62ba('0x20')]?_0x4318cc[_0x62ba('0x20')][_0x62ba('0x22')]||null:null,'attributes':_0x4318cc[_0x62ba('0x20')]?_0x4318cc[_0x62ba('0x20')][_0x62ba('0x23')]||null:null,'limit':_0x4318cc[_0x62ba('0x20')]?_0x4318cc[_0x62ba('0x20')][_0x62ba('0x24')]||null:null})[_0x62ba('0x25')](function(_0x5afeb1){logger[_0x62ba('0x12')](_0x62ba('0x1c'),_0x4318cc);logger[_0x62ba('0x26')](_0x62ba('0x1c'),_0x4318cc,JSON[_0x62ba('0x16')](_0x5afeb1));_0x3a5679(_0x5afeb1);})['catch'](function(_0x1f7612){logger[_0x62ba('0x17')](_0x62ba('0x1c'),_0x1f7612['message'],_0x4318cc);_0x4296b9(_0xf00b36[_0x62ba('0x17')](0x1f4,_0x1f7612[_0x62ba('0x19')]));});});};exports['AddTagsToMailInteraction']=function(_0x405a73){return new Promise(function(_0x1c0759,_0x8c0e7a){return db['MailInteraction'][_0x62ba('0x27')]({'where':_0x405a73[_0x62ba('0x20')]?_0x405a73[_0x62ba('0x20')][_0x62ba('0x22')]||null:null})[_0x62ba('0x25')](function(_0x15597a){if(_0x15597a){return _0x15597a['addTags'](_0x405a73[_0x62ba('0x1f')][_0x62ba('0x28')],_['omit'](_0x405a73[_0x62ba('0x1f')],[_0x62ba('0x28'),'id'])||{});}})[_0x62ba('0x29')](function(_0x528d2d){logger['info'](_0x62ba('0x2a'),_0x405a73);logger[_0x62ba('0x26')]('AddTags',_0x405a73,JSON['stringify'](_0x528d2d));_0x1c0759(_0x528d2d);})[_0x62ba('0x1b')](function(_0x4b09b0){logger[_0x62ba('0x17')](_0x62ba('0x2a'),_0x4b09b0[_0x62ba('0x19')],_0x405a73);_0x8c0e7a(_this[_0x62ba('0x17')](0x1f4,_0x4b09b0['message']));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index aa96362..5468b0e 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 _0xa89d=['save','remove','update','emit','removeListener','register','length','mailInteraction:','./mailInteraction.events'];(function(_0x29d915,_0x54a040){var _0x160f86=function(_0x237dfa){while(--_0x237dfa){_0x29d915['push'](_0x29d915['shift']());}};_0x160f86(++_0x54a040);}(_0xa89d,0x155));var _0xda89=function(_0x2add1d,_0x59d0c4){_0x2add1d=_0x2add1d-0x0;var _0x1cdff0=_0xa89d[_0x2add1d];return _0x1cdff0;};'use strict';var MailInteractionEvents=require(_0xda89('0x0'));var events=[_0xda89('0x1'),_0xda89('0x2'),_0xda89('0x3')];function createListener(_0x51de46,_0x1197ce){return function(_0x5cd748){_0x1197ce[_0xda89('0x4')](_0x51de46,_0x5cd748);};}function removeListener(_0x49215f,_0x399908){return function(){MailInteractionEvents[_0xda89('0x5')](_0x49215f,_0x399908);};}exports[_0xda89('0x6')]=function(_0x11d9c1){for(var _0x3ce3ab=0x0,_0x58056b=events[_0xda89('0x7')];_0x3ce3ab<_0x58056b;_0x3ce3ab++){var _0x5d826b=events[_0x3ce3ab];var _0x38190c=createListener(_0xda89('0x8')+_0x5d826b,_0x11d9c1);MailInteractionEvents['on'](_0x5d826b,_0x38190c);}}; \ No newline at end of file +var _0x58e9=['register','./mailInteraction.events','save','remove','update','removeListener'];(function(_0x6f9784,_0x40f20b){var _0x13a71f=function(_0x4263d9){while(--_0x4263d9){_0x6f9784['push'](_0x6f9784['shift']());}};_0x13a71f(++_0x40f20b);}(_0x58e9,0xd3));var _0x958e=function(_0x2c045f,_0x4b1fdd){_0x2c045f=_0x2c045f-0x0;var _0x272b17=_0x58e9[_0x2c045f];return _0x272b17;};'use strict';var MailInteractionEvents=require(_0x958e('0x0'));var events=[_0x958e('0x1'),_0x958e('0x2'),_0x958e('0x3')];function createListener(_0x15dce8,_0x492379){return function(_0x4765b3){_0x492379['emit'](_0x15dce8,_0x4765b3);};}function removeListener(_0x3edcc9,_0x317ab1){return function(){MailInteractionEvents[_0x958e('0x4')](_0x3edcc9,_0x317ab1);};}exports[_0x958e('0x5')]=function(_0x51bf1a){for(var _0x19ce6e=0x0,_0x3ce18=events['length'];_0x19ce6e<_0x3ce18;_0x19ce6e++){var _0x18978a=events[_0x19ce6e];var _0x2c6200=createListener('mailInteraction:'+_0x18978a,_0x51bf1a);MailInteractionEvents['on'](_0x18978a,_0x2c6200);}}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index 6ddcada..6be27c6 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 _0x0abe=['reject','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailMessage.controller','isAuthenticated','index','describe','get','/:id','show','/:id/download','download','tracked','mailmessage:create','create','update','put','/:id/accept','accept'];(function(_0x492ac8,_0x1386c4){var _0x4e8a27=function(_0x1febd6){while(--_0x1febd6){_0x492ac8['push'](_0x492ac8['shift']());}};_0x4e8a27(++_0x1386c4);}(_0x0abe,0x188));var _0xe0ab=function(_0x2891d8,_0x2d60ae){_0x2891d8=_0x2891d8-0x0;var _0x5e0e8b=_0x0abe[_0x2891d8];return _0x5e0e8b;};'use strict';var multer=require(_0xe0ab('0x0'));var util=require('util');var path=require(_0xe0ab('0x1'));var timeout=require('connect-timeout');var express=require(_0xe0ab('0x2'));var router=express[_0xe0ab('0x3')]();var fs_extra=require(_0xe0ab('0x4'));var auth=require(_0xe0ab('0x5'));var interaction=require(_0xe0ab('0x6'));var config=require(_0xe0ab('0x7'));var controller=require(_0xe0ab('0x8'));router['get']('/',auth[_0xe0ab('0x9')](),controller[_0xe0ab('0xa')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0xe0ab('0xb')]);router[_0xe0ab('0xc')](_0xe0ab('0xd'),auth['isAuthenticated'](),controller[_0xe0ab('0xe')]);router[_0xe0ab('0xc')](_0xe0ab('0xf'),auth[_0xe0ab('0x9')](),controller[_0xe0ab('0x10')]);router['post']('/',auth['isAuthenticated'](),interaction[_0xe0ab('0x11')]('mail',_0xe0ab('0x12')),controller[_0xe0ab('0x13')]);router['put'](_0xe0ab('0xd'),auth['isAuthenticated'](),controller[_0xe0ab('0x14')]);router[_0xe0ab('0x15')](_0xe0ab('0x16'),auth[_0xe0ab('0x9')](),controller[_0xe0ab('0x17')]);router['put']('/:id/reject',auth[_0xe0ab('0x9')](),controller[_0xe0ab('0x18')]);router['delete'](_0xe0ab('0xd'),auth[_0xe0ab('0x9')](),controller['destroy']);module[_0xe0ab('0x19')]=router; \ No newline at end of file +var _0x55ea=['accept','/:id/reject','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./mailMessage.controller','/describe','isAuthenticated','describe','get','/:id','show','/:id/download','post','tracked','mail','mailmessage:create','put','update','/:id/accept'];(function(_0x2afb28,_0x19e8b0){var _0x41d764=function(_0x566707){while(--_0x566707){_0x2afb28['push'](_0x2afb28['shift']());}};_0x41d764(++_0x19e8b0);}(_0x55ea,0xc9));var _0xa55e=function(_0x46aaaa,_0x1078ea){_0x46aaaa=_0x46aaaa-0x0;var _0x4ff218=_0x55ea[_0x46aaaa];return _0x4ff218;};'use strict';var multer=require(_0xa55e('0x0'));var util=require(_0xa55e('0x1'));var path=require(_0xa55e('0x2'));var timeout=require('connect-timeout');var express=require(_0xa55e('0x3'));var router=express[_0xa55e('0x4')]();var fs_extra=require(_0xa55e('0x5'));var auth=require(_0xa55e('0x6'));var interaction=require(_0xa55e('0x7'));var config=require('../../config/environment');var controller=require(_0xa55e('0x8'));router['get']('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xa55e('0x9'),auth[_0xa55e('0xa')](),controller[_0xa55e('0xb')]);router[_0xa55e('0xc')](_0xa55e('0xd'),auth[_0xa55e('0xa')](),controller[_0xa55e('0xe')]);router[_0xa55e('0xc')](_0xa55e('0xf'),auth['isAuthenticated'](),controller['download']);router[_0xa55e('0x10')]('/',auth[_0xa55e('0xa')](),interaction[_0xa55e('0x11')](_0xa55e('0x12'),_0xa55e('0x13')),controller['create']);router[_0xa55e('0x14')]('/:id',auth[_0xa55e('0xa')](),controller[_0xa55e('0x15')]);router[_0xa55e('0x14')](_0xa55e('0x16'),auth[_0xa55e('0xa')](),controller[_0xa55e('0x17')]);router[_0xa55e('0x14')](_0xa55e('0x18'),auth[_0xa55e('0xa')](),controller['reject']);router[_0xa55e('0x19')](_0xa55e('0xd'),auth[_0xa55e('0xa')](),controller[_0xa55e('0x1a')]);module[_0xa55e('0x1b')]=router; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.attributes.js b/server/api/mailMessage/mailMessage.attributes.js index 218970d..ea8bd5a 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 _0x72a1=['lodash','TEXT','medium','BOOLEAN','out','STRING','long','DATE','ENUM','Email','Chat'];(function(_0x5a79e2,_0x319b1a){var _0x266c45=function(_0x172478){while(--_0x172478){_0x5a79e2['push'](_0x5a79e2['shift']());}};_0x266c45(++_0x319b1a);}(_0x72a1,0x1ce));var _0x172a=function(_0x1846f2,_0x353922){_0x1846f2=_0x1846f2-0x0;var _0x3f2021=_0x72a1[_0x1846f2];return _0x3f2021;};'use strict';var Sequelize=require('sequelize');var _=require(_0x172a('0x0'));module['exports']={'body':{'type':Sequelize[_0x172a('0x1')]('long'),'allowNull':![]},'plainBody':{'type':Sequelize[_0x172a('0x1')](_0x172a('0x2'))},'read':{'type':Sequelize[_0x172a('0x3')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x172a('0x4')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0x172a('0x5')](0x1fe)},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize[_0x172a('0x1')]('long')},'cc':{'type':Sequelize[_0x172a('0x1')](_0x172a('0x6'))},'bcc':{'type':Sequelize[_0x172a('0x1')](_0x172a('0x6'))},'subject':{'type':Sequelize['TEXT']},'sentAt':{'type':Sequelize[_0x172a('0x7')]},'attach':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'secret':{'type':Sequelize[_0x172a('0x3')],'defaultValue':![]},'readAt':{'type':Sequelize[_0x172a('0x7')]},'originTo':{'type':Sequelize[_0x172a('0x1')]('long')},'originCc':{'type':Sequelize[_0x172a('0x1')](_0x172a('0x6'))},'originChannel':{'type':Sequelize[_0x172a('0x8')](_0x172a('0x9'),_0x172a('0xa')),'defaultValue':'Email','allowNull':![]}}; \ No newline at end of file +var _0x4df5=['exports','TEXT','long','medium','ENUM','out','STRING','DATE','INTEGER','BOOLEAN','Email','Chat','sequelize','lodash'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x4df5,0x140));var _0x54df=function(_0x3f037c,_0x222d42){_0x3f037c=_0x3f037c-0x0;var _0x535eb7=_0x4df5[_0x3f037c];return _0x535eb7;};'use strict';var Sequelize=require(_0x54df('0x0'));var _=require(_0x54df('0x1'));module[_0x54df('0x2')]={'body':{'type':Sequelize[_0x54df('0x3')](_0x54df('0x4')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x54df('0x3')](_0x54df('0x5'))},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x54df('0x6')]('in',_0x54df('0x7')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0x54df('0x8')](0x1fe)},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize['TEXT'](_0x54df('0x4'))},'cc':{'type':Sequelize[_0x54df('0x3')](_0x54df('0x4'))},'bcc':{'type':Sequelize[_0x54df('0x3')]('long')},'subject':{'type':Sequelize[_0x54df('0x3')]},'sentAt':{'type':Sequelize[_0x54df('0x9')]},'attach':{'type':Sequelize[_0x54df('0xa')],'defaultValue':0x0},'secret':{'type':Sequelize[_0x54df('0xb')],'defaultValue':![]},'readAt':{'type':Sequelize[_0x54df('0x9')]},'originTo':{'type':Sequelize[_0x54df('0x3')]('long')},'originCc':{'type':Sequelize[_0x54df('0x3')](_0x54df('0x4'))},'originChannel':{'type':Sequelize[_0x54df('0x6')](_0x54df('0xc'),_0x54df('0xd')),'defaultValue':'Email','allowNull':![]}}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.controller.js b/server/api/mailMessage/mailMessage.controller.js index 572551e..0c69a8a 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 _0xa051=['findOne','MailAccountId','CmList','List','CmContact','Contacts','updatedAt','DESC','MailServerOut','Smtp','isNil','host','port','secure','authentication','auth','user','pass','service','attachments','join','root','basename','ListId','List\x20not\x20found','SendMail','messageId','format','YYYY-MM-DD\x20HH:mm:ss','accept','mail','read','readAt','UserId','agent','get','MailInteraction','MailInteractionId','read1stAt','interaction','[MAILMESSAGE: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','internal','manual','SIP/%s','channel','motionChannel','event','fromString','EventManager','acceptmessage','reject','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','RejectMessage','rejectMessage','sequelize','interface','rejectmessage','download','unix','files','server','from','bcc','subject','createdAt','Attachments','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','Bcc','existsSync','push','readFileSync','build','writeFileSync','eml-format','moment','util','path','lodash','ioredis','html-to-text','../../components/parsers/qs','../../config/logger','api','mail-interactions','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailMessage.socket','register','jayson/promise','client','http','then','info','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','MailMessage,\x20%s,\x20%s','message','result','catch','status','json','offset','limit','count','set','Content-Range','update','destroy','sendStatus','stack','name','index','map','MailMessage','rawAttributes','fieldName','type','key','query','keys','filters','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','rows','params','intersection','options','body','find','describe','create','direction','secret','split','MailAccount'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa051,0xfc));var _0x1a05=function(_0x2514cf,_0x796698){_0x2514cf=_0x2514cf-0x0;var _0x31a26e=_0xa051[_0x2514cf];return _0x31a26e;};'use strict';var emlformat=require(_0x1a05('0x0'));var moment=require(_0x1a05('0x1'));var BPromise=require('bluebird');var util=require(_0x1a05('0x2'));var path=require(_0x1a05('0x3'));var fs=require('fs');var _=require(_0x1a05('0x4'));var Redis=require(_0x1a05('0x5'));var htmlToText=require(_0x1a05('0x6'));var qs=require(_0x1a05('0x7'));var logger=require(_0x1a05('0x8'))(_0x1a05('0x9'));var interaction_log=require('../../config/logger')(_0x1a05('0xa'));var config=require('../../config/environment');var db=require(_0x1a05('0xb'))['db'];config[_0x1a05('0xc')]=_[_0x1a05('0xd')](config[_0x1a05('0xc')],{'host':_0x1a05('0xe'),'port':0x18eb});var socket=require(_0x1a05('0xf'))(new Redis(config[_0x1a05('0xc')]));require(_0x1a05('0x10'))[_0x1a05('0x11')](socket);var jayson=require(_0x1a05('0x12'));var client=jayson[_0x1a05('0x13')]['http']({'port':0x232c});var client9003=jayson['client'][_0x1a05('0x14')]({'port':0x232b});var client9002=jayson[_0x1a05('0x13')][_0x1a05('0x14')]({'port':0x232a});function respondWithRpcPromise(_0x3ce044,_0x51730b,_0x5c698b,_0x3b61ab){return new BPromise(function(_0x1fcb79,_0x457da3){var _0x508f88=_0x3b61ab||client;return _0x508f88['request'](_0x3ce044,_0x5c698b)[_0x1a05('0x15')](function(_0x3ecf8e){logger[_0x1a05('0x16')]('MailMessage,\x20%s,\x20%s',_0x51730b,_0x1a05('0x17'));logger[_0x1a05('0x18')](_0x1a05('0x19'),_0x51730b,_0x1a05('0x17'),JSON[_0x1a05('0x1a')](_0x3ecf8e));if(_0x3ecf8e[_0x1a05('0x1b')]){if(_0x3ecf8e[_0x1a05('0x1b')][_0x1a05('0x1c')]===0x1f4){logger[_0x1a05('0x1b')](_0x1a05('0x1d'),_0x51730b,_0x3ecf8e[_0x1a05('0x1b')][_0x1a05('0x1e')]);return _0x457da3(_0x3ecf8e[_0x1a05('0x1b')][_0x1a05('0x1e')]);}logger[_0x1a05('0x1b')](_0x1a05('0x1d'),_0x51730b,_0x3ecf8e[_0x1a05('0x1b')]['message']);return _0x1fcb79(_0x3ecf8e[_0x1a05('0x1b')][_0x1a05('0x1e')]);}else{logger[_0x1a05('0x16')]('MailMessage,\x20%s,\x20%s',_0x51730b,_0x1a05('0x17'));_0x1fcb79(_0x3ecf8e[_0x1a05('0x1f')][_0x1a05('0x1e')]);}})[_0x1a05('0x20')](function(_0x366a82){logger['error'](_0x1a05('0x1d'),_0x51730b,_0x366a82);_0x457da3(_0x366a82);});});}function respondWithResult(_0x5bd58b,_0x4edd8a){_0x4edd8a=_0x4edd8a||0xc8;return function(_0xfae1ee){if(_0xfae1ee){return _0x5bd58b[_0x1a05('0x21')](_0x4edd8a)[_0x1a05('0x22')](_0xfae1ee);}};}function respondWithFilteredResult(_0x1bdc19,_0x533986){return function(_0x52c4ea){if(_0x52c4ea){var _0x236ff9=typeof _0x533986[_0x1a05('0x23')]==='undefined'&&typeof _0x533986[_0x1a05('0x24')]==='undefined';var _0x2fbdeb=_0x52c4ea[_0x1a05('0x25')];var _0x5eaa63=_0x236ff9?0x0:_0x533986[_0x1a05('0x23')];var _0xdbfe37=_0x236ff9?_0x52c4ea[_0x1a05('0x25')]:_0x533986[_0x1a05('0x23')]+_0x533986[_0x1a05('0x24')];var _0x251e33;if(_0xdbfe37>=_0x2fbdeb){_0xdbfe37=_0x2fbdeb;_0x251e33=0xc8;}else{_0x251e33=0xce;}_0x1bdc19[_0x1a05('0x21')](_0x251e33);return _0x1bdc19[_0x1a05('0x26')](_0x1a05('0x27'),_0x5eaa63+'-'+_0xdbfe37+'/'+_0x2fbdeb)['json'](_0x52c4ea);}return null;};}function saveUpdates(_0xc419e2){return function(_0x571486){if(_0x571486){return _0x571486[_0x1a05('0x28')](_0xc419e2)[_0x1a05('0x15')](function(_0x53df59){return _0x53df59;});}return null;};}function removeEntity(_0x5319fc){return function(_0x29989a){if(_0x29989a){return _0x29989a[_0x1a05('0x29')]()[_0x1a05('0x15')](function(){_0x5319fc[_0x1a05('0x21')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3576c1){return function(_0x2f53b3){if(!_0x2f53b3){_0x3576c1[_0x1a05('0x2a')](0x194);}return _0x2f53b3;};}function handleError(_0x17420b,_0x11a79a){_0x11a79a=_0x11a79a||0x1f4;return function(_0x1bfb8f){logger[_0x1a05('0x1b')](_0x1bfb8f[_0x1a05('0x2b')]);if(_0x1bfb8f[_0x1a05('0x2c')]){delete _0x1bfb8f['name'];}_0x17420b[_0x1a05('0x21')](_0x11a79a)['send'](_0x1bfb8f);};}exports[_0x1a05('0x2d')]=function(_0x3d26ed,_0x18537b){var _0x39756a={},_0xd51b23={},_0x246d69={'count':0x0,'rows':[]};var _0x5d920e=_[_0x1a05('0x2e')](db[_0x1a05('0x2f')][_0x1a05('0x30')],function(_0x2af5dd){return{'name':_0x2af5dd[_0x1a05('0x31')],'type':_0x2af5dd[_0x1a05('0x32')][_0x1a05('0x33')]};});_0xd51b23['model']=_[_0x1a05('0x2e')](_0x5d920e,_0x1a05('0x2c'));_0xd51b23[_0x1a05('0x34')]=_[_0x1a05('0x35')](_0x3d26ed[_0x1a05('0x34')]);_0xd51b23[_0x1a05('0x36')]=_['intersection'](_0xd51b23[_0x1a05('0x37')],_0xd51b23['query']);_0x39756a[_0x1a05('0x38')]=_['intersection'](_0xd51b23[_0x1a05('0x37')],qs[_0x1a05('0x39')](_0x3d26ed[_0x1a05('0x34')][_0x1a05('0x39')]));_0x39756a['attributes']=_0x39756a[_0x1a05('0x38')][_0x1a05('0x3a')]?_0x39756a[_0x1a05('0x38')]:_0xd51b23['model'];if(!_0x3d26ed[_0x1a05('0x34')][_0x1a05('0x3b')](_0x1a05('0x3c'))){_0x39756a[_0x1a05('0x24')]=qs[_0x1a05('0x24')](_0x3d26ed[_0x1a05('0x34')][_0x1a05('0x24')]);_0x39756a['offset']=qs['offset'](_0x3d26ed[_0x1a05('0x34')]['offset']);}_0x39756a[_0x1a05('0x3d')]=qs[_0x1a05('0x3e')](_0x3d26ed[_0x1a05('0x34')]['sort']);_0x39756a[_0x1a05('0x3f')]=qs[_0x1a05('0x36')](_[_0x1a05('0x40')](_0x3d26ed[_0x1a05('0x34')],_0xd51b23[_0x1a05('0x36')]),_0x5d920e);if(_0x3d26ed['query'][_0x1a05('0x41')]){_0x39756a['where']=_[_0x1a05('0x42')](_0x39756a[_0x1a05('0x3f')],{'$or':_[_0x1a05('0x2e')](_0x5d920e,function(_0x25a900){if(_0x25a900[_0x1a05('0x32')]!==_0x1a05('0x43')){var _0x523abc={};_0x523abc[_0x25a900[_0x1a05('0x2c')]]={'$like':'%'+_0x3d26ed['query'][_0x1a05('0x41')]+'%'};return _0x523abc;}})});}_0x39756a=_[_0x1a05('0x42')]({},_0x39756a,_0x3d26ed['options']);var _0x3f421e={'where':_0x39756a['where']};return db[_0x1a05('0x2f')][_0x1a05('0x25')](_0x3f421e)['then'](function(_0x5aeb76){_0x246d69['count']=_0x5aeb76;if(_0x3d26ed[_0x1a05('0x34')]['includeAll']){_0x39756a['include']=[{'all':!![]}];}return db[_0x1a05('0x2f')]['findAll'](_0x39756a);})['then'](function(_0x233716){_0x246d69[_0x1a05('0x44')]=_0x233716;return _0x246d69;})['then'](respondWithFilteredResult(_0x18537b,_0x39756a))[_0x1a05('0x20')](handleError(_0x18537b,null));};exports['show']=function(_0x5da229,_0xa04c88){var _0x5f5be2={'raw':!![],'where':{'id':_0x5da229[_0x1a05('0x45')]['id']}},_0xbac046={};_0xbac046['model']=_['keys'](db[_0x1a05('0x2f')]['rawAttributes']);_0xbac046['query']=_['keys'](_0x5da229[_0x1a05('0x34')]);_0xbac046['filters']=_[_0x1a05('0x46')](_0xbac046['model'],_0xbac046['query']);_0x5f5be2[_0x1a05('0x38')]=_[_0x1a05('0x46')](_0xbac046[_0x1a05('0x37')],qs[_0x1a05('0x39')](_0x5da229[_0x1a05('0x34')][_0x1a05('0x39')]));_0x5f5be2['attributes']=_0x5f5be2[_0x1a05('0x38')][_0x1a05('0x3a')]?_0x5f5be2[_0x1a05('0x38')]:_0xbac046[_0x1a05('0x37')];if(_0x5da229[_0x1a05('0x34')]['includeAll']){_0x5f5be2['include']=[{'all':!![]}];}_0x5f5be2=_[_0x1a05('0x42')]({},_0x5f5be2,_0x5da229[_0x1a05('0x47')]);return db[_0x1a05('0x2f')]['find'](_0x5f5be2)[_0x1a05('0x15')](handleEntityNotFound(_0xa04c88,null))[_0x1a05('0x15')](respondWithResult(_0xa04c88,null))['catch'](handleError(_0xa04c88,null));};exports['update']=function(_0xef7278,_0x5f2c32){if(_0xef7278[_0x1a05('0x48')]['id']){delete _0xef7278['body']['id'];}return db[_0x1a05('0x2f')][_0x1a05('0x49')]({'where':{'id':_0xef7278[_0x1a05('0x45')]['id']}})[_0x1a05('0x15')](handleEntityNotFound(_0x5f2c32,null))[_0x1a05('0x15')](saveUpdates(_0xef7278[_0x1a05('0x48')],null))['then'](respondWithResult(_0x5f2c32,null))[_0x1a05('0x20')](handleError(_0x5f2c32,null));};exports['destroy']=function(_0x5cefe0,_0x45c436){return db[_0x1a05('0x2f')][_0x1a05('0x49')]({'where':{'id':_0x5cefe0[_0x1a05('0x45')]['id']}})['then'](handleEntityNotFound(_0x45c436,null))['then'](removeEntity(_0x45c436,null))['catch'](handleError(_0x45c436,null));};exports['describe']=function(_0x45c3f9,_0x4015eb){return db[_0x1a05('0x2f')][_0x1a05('0x4a')]()['then'](respondWithResult(_0x4015eb,null))[_0x1a05('0x20')](handleError(_0x4015eb,null));};exports[_0x1a05('0x4b')]=function(_0x483769,_0x5f3f28){return db[_0x1a05('0x2f')][_0x1a05('0x4b')](_0x483769[_0x1a05('0x48')])[_0x1a05('0x15')](function(_0x559b2d){if(_0x559b2d){if(_0x559b2d[_0x1a05('0x4c')]==='out'&&!_0x559b2d[_0x1a05('0x4d')]){var _0x4b3984,_0x497ddc,_0x3e2ef1;if(_0x483769[_0x1a05('0x48')]['to']){_0x497ddc=_0x483769['body']['to'][_0x1a05('0x4e')](',')[0x0];}return db[_0x1a05('0x4f')][_0x1a05('0x50')]({'where':{'id':_0x559b2d[_0x1a05('0x51')]},'include':[{'model':db[_0x1a05('0x52')],'as':_0x1a05('0x53'),'include':[{'model':db[_0x1a05('0x54')],'as':_0x1a05('0x55'),'where':{'email':_0x497ddc},'limit':0x1,'order':[[_0x1a05('0x56'),_0x1a05('0x57')]]}]},{'model':db[_0x1a05('0x58')],'as':_0x1a05('0x59'),'raw':!![]}]})['then'](function(_0x2c3b56){_0x4b3984=_0x2c3b56;if(_0x4b3984&&_0x4b3984[_0x1a05('0x59')]){var _0x5572fc={'tls':{'rejectUnauthorized':![]}};if(_[_0x1a05('0x5a')](_0x4b3984[_0x1a05('0x59')]['service'])){_0x5572fc[_0x1a05('0x5b')]=_0x4b3984[_0x1a05('0x59')][_0x1a05('0x5b')];_0x5572fc[_0x1a05('0x5c')]=_0x4b3984[_0x1a05('0x59')][_0x1a05('0x5c')];_0x5572fc[_0x1a05('0x5d')]=_0x4b3984[_0x1a05('0x59')][_0x1a05('0x5d')];if(_0x4b3984[_0x1a05('0x59')][_0x1a05('0x5e')]){_0x5572fc[_0x1a05('0x5f')]={'user':_0x4b3984['Smtp'][_0x1a05('0x60')],'pass':_0x4b3984[_0x1a05('0x59')][_0x1a05('0x61')]};}}else{_0x5572fc[_0x1a05('0x62')]=_0x4b3984['Smtp'][_0x1a05('0x62')];_0x5572fc[_0x1a05('0x5f')]={'user':_0x4b3984[_0x1a05('0x59')][_0x1a05('0x60')],'pass':_0x4b3984['Smtp'][_0x1a05('0x61')]};_0x5572fc[_0x1a05('0x5d')]=_0x4b3984[_0x1a05('0x59')][_0x1a05('0x5d')];}if(_0x483769[_0x1a05('0x48')][_0x1a05('0x63')]&&_0x483769['body'][_0x1a05('0x63')][_0x1a05('0x3a')]){for(var _0x2079c4=0x0;_0x2079c4<_0x483769['body']['attachments']['length'];_0x2079c4+=0x1){_0x483769[_0x1a05('0x48')][_0x1a05('0x63')][_0x2079c4]={'filename':_0x483769[_0x1a05('0x48')][_0x1a05('0x63')][_0x2079c4][_0x1a05('0x2c')],'path':path[_0x1a05('0x64')](config[_0x1a05('0x65')],'server/files/attachments',_0x483769[_0x1a05('0x48')][_0x1a05('0x63')][_0x2079c4][_0x1a05('0x66')])};}}_0x3e2ef1={'account':_0x5572fc,'message':_0x483769[_0x1a05('0x48')]};return;}})[_0x1a05('0x15')](function(){if(_0x4b3984[_0x1a05('0x53')]){if(_0x4b3984[_0x1a05('0x53')][_0x1a05('0x55')][_0x1a05('0x3a')]){return _0x4b3984[_0x1a05('0x53')][_0x1a05('0x55')][0x0];}else{return db['CmContact'][_0x1a05('0x4b')](_[_0x1a05('0xd')](_0x483769['body'],{'firstName':_0x483769[_0x1a05('0x48')]['to'],'email':_0x483769[_0x1a05('0x48')]['to'],'phone':_0x483769[_0x1a05('0x48')]['to'],'ListId':_0x4b3984[_0x1a05('0x67')]}));}}else{throw new Error(_0x1a05('0x68'));}})[_0x1a05('0x15')](function(){if(_0x3e2ef1){return respondWithRpcPromise(_0x1a05('0x69'),'sendMail',_0x3e2ef1,client9003)[_0x1a05('0x15')](function(_0x53a4d7){return _0x559b2d[_0x1a05('0x28')]({'read':!![],'messageId':_0x53a4d7[_0x1a05('0x6a')],'sentAt':moment()[_0x1a05('0x6b')](_0x1a05('0x6c'))});})[_0x1a05('0x20')](function(_0x72ee6f){logger[_0x1a05('0x1b')]('%s',JSON[_0x1a05('0x1a')](_0x72ee6f));return _0x559b2d;});}return _0x559b2d;});}return _0x559b2d;}})[_0x1a05('0x15')](respondWithResult(_0x5f3f28,0xc9))[_0x1a05('0x20')](handleError(_0x5f3f28,null));};exports[_0x1a05('0x6d')]=function(_0x31cc40,_0x27d441){var _0x4c3853={'agent':{},'channel':_0x1a05('0x6e')};if(_0x31cc40[_0x1a05('0x48')]['id']){delete _0x31cc40['body']['id'];}_0x31cc40[_0x1a05('0x48')][_0x1a05('0x6f')]=!![];_0x31cc40[_0x1a05('0x48')][_0x1a05('0x70')]=moment()[_0x1a05('0x6b')](_0x1a05('0x6c'));_0x31cc40[_0x1a05('0x48')][_0x1a05('0x71')]=_0x31cc40['body'][_0x1a05('0x71')]||_0x31cc40[_0x1a05('0x60')]['id'];_0x4c3853[_0x1a05('0x72')]['id']=_0x31cc40[_0x1a05('0x48')]['UserId'];return db[_0x1a05('0x2f')]['find']({'where':{'id':_0x31cc40[_0x1a05('0x45')]['id'],'UserId':null}})[_0x1a05('0x15')](handleEntityNotFound(_0x27d441,null))[_0x1a05('0x15')](saveUpdates(_0x31cc40[_0x1a05('0x48')],null))[_0x1a05('0x15')](function(_0xc1b25e){if(_0xc1b25e){_0x4c3853['message']=_0xc1b25e[_0x1a05('0x73')]({'plain':!![]});return db[_0x1a05('0x74')]['find']({'where':{'id':_0xc1b25e[_0x1a05('0x75')]}});}return null;})[_0x1a05('0x15')](handleEntityNotFound(_0x27d441,null))[_0x1a05('0x15')](function(_0x32d027){if(_0x32d027){return _0x32d027[_0x1a05('0x28')]({'UserId':_0x31cc40[_0x1a05('0x48')][_0x1a05('0x71')],'read1stAt':_[_0x1a05('0x5a')](_0x32d027[_0x1a05('0x76')])?moment()[_0x1a05('0x6b')](_0x1a05('0x6c')):undefined});}return null;})[_0x1a05('0x15')](function(_0x7c9a8){if(_0x7c9a8){_0x4c3853[_0x1a05('0x77')]=_0x7c9a8['get']({'plain':!![]});interaction_log[_0x1a05('0x16')](_0x1a05('0x78'),_0x31cc40[_0x1a05('0x60')]['id'],_0x31cc40[_0x1a05('0x60')]['name'],_0x31cc40[_0x1a05('0x60')][_0x1a05('0x79')],_0x4c3853[_0x1a05('0x77')]['id'],_0x31cc40[_0x1a05('0x48')]?JSON['stringify'](_0x31cc40['body']):'null');return respondWithRpcPromise(_0x1a05('0x7a'),_0x1a05('0x7b'),_0x4c3853);}return null;})[_0x1a05('0x15')](function(_0x2295d7){var _0x5e606a=_0x1a05('0x7c')+_0x2295d7[_0x1a05('0x1e')][_0x1a05('0x7d')];return db['sequelize'][_0x1a05('0x34')](_0x5e606a,{'type':db[_0x1a05('0x7e')][_0x1a05('0x7f')][_0x1a05('0x80')],'raw':!![]})[_0x1a05('0x15')](function(_0x141a39){return _0x141a39;});})[_0x1a05('0x15')](function(_0x21dc0a){if(_0x21dc0a){_0x4c3853[_0x1a05('0x1e')][_0x1a05('0x81')]=_0x21dc0a[0x0];if(!_0x31cc40[_0x1a05('0x48')]['UserId'])return;return db[_0x1a05('0x82')][_0x1a05('0x49')]({'where':{'id':_0x31cc40[_0x1a05('0x48')][_0x1a05('0x71')],'role':_0x1a05('0x72')},'attributes':['id',_0x1a05('0x2c'),_0x1a05('0x83'),_0x1a05('0x84'),_0x1a05('0x85')],'raw':!![]});}return null;})[_0x1a05('0x15')](function(_0x319b40){if(!_0x319b40)return null;_0x4c3853[_0x1a05('0x1e')][_0x1a05('0x72')]=_0x319b40;return _0x4c3853;})['then'](function(_0x3c015d){if(_0x3c015d){if(_0x31cc40[_0x1a05('0x48')][_0x1a05('0x86')]){_0x4c3853[_0x1a05('0x1e')]['interface']=util[_0x1a05('0x6b')](_0x1a05('0x87'),_0x31cc40[_0x1a05('0x60')][_0x1a05('0x2c')]);_0x4c3853[_0x1a05('0x1e')]['channel']=_0x4c3853[_0x1a05('0x88')];_0x4c3853[_0x1a05('0x1e')][_0x1a05('0x89')]=_0x4c3853[_0x1a05('0x88')];_0x4c3853[_0x1a05('0x1e')][_0x1a05('0x8a')]=_0x1a05('0x6d');_0x4c3853[_0x1a05('0x1e')][_0x1a05('0x48')]=htmlToText[_0x1a05('0x8b')](_0x4c3853[_0x1a05('0x1e')][_0x1a05('0x48')]);return respondWithRpcPromise('EventManager',_0x1a05('0x8c'),{'event':_0x1a05('0x8d'),'message':_0x4c3853[_0x1a05('0x1e')]},client9002)[_0x1a05('0x15')](function(){return _0x4c3853;});}return _0x4c3853;}return null;})[_0x1a05('0x15')](respondWithResult(_0x27d441,null))['catch'](handleError(_0x27d441,null));};exports[_0x1a05('0x8e')]=function(_0x5e0270,_0x4280eb){var _0x3ec59a={'agent':{},'channel':_0x1a05('0x6e')};if(_0x5e0270['body']['id']){delete _0x5e0270['body']['id'];}_0x5e0270['body']['UserId']=_0x5e0270['body'][_0x1a05('0x71')]||_0x5e0270[_0x1a05('0x60')]['id'];_0x3ec59a['agent']['id']=_0x5e0270[_0x1a05('0x48')][_0x1a05('0x71')];return db[_0x1a05('0x2f')][_0x1a05('0x49')]({'where':{'id':_0x5e0270[_0x1a05('0x45')]['id'],'UserId':null}})[_0x1a05('0x15')](handleEntityNotFound(_0x4280eb,null))['then'](function(_0x4cdbaa){if(_0x4cdbaa){_0x3ec59a[_0x1a05('0x1e')]=_0x4cdbaa[_0x1a05('0x73')]({'plain':!![]});return db[_0x1a05('0x74')][_0x1a05('0x49')]({'where':{'id':_0x4cdbaa[_0x1a05('0x75')]}});}return null;})[_0x1a05('0x15')](handleEntityNotFound(_0x4280eb,null))[_0x1a05('0x15')](function(_0xd68f8e){if(_0xd68f8e){_0x3ec59a['interaction']=_0xd68f8e[_0x1a05('0x73')]({'plain':!![]});interaction_log[_0x1a05('0x16')](_0x1a05('0x8f'),_0x5e0270[_0x1a05('0x60')]['id'],_0x5e0270['user'][_0x1a05('0x2c')],_0x5e0270[_0x1a05('0x60')][_0x1a05('0x79')],_0x3ec59a['interaction']['id'],_0x5e0270[_0x1a05('0x48')]?JSON[_0x1a05('0x1a')](_0x5e0270['body']):_0x1a05('0x90'));return respondWithRpcPromise(_0x1a05('0x91'),_0x1a05('0x92'),_0x3ec59a);}return null;})['then'](function(_0x12c428){var _0x189712='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x12c428[_0x1a05('0x1e')]['ContactId'];return db[_0x1a05('0x93')][_0x1a05('0x34')](_0x189712,{'type':db[_0x1a05('0x7e')][_0x1a05('0x7f')][_0x1a05('0x80')],'raw':!![]})[_0x1a05('0x15')](function(_0x543753){return _0x543753;});})[_0x1a05('0x15')](function(_0x3cef40){if(_0x3cef40){_0x3ec59a['message'][_0x1a05('0x81')]=_0x3cef40[0x0];if(!_0x5e0270['body']['UserId'])return;return db[_0x1a05('0x82')]['find']({'where':{'id':_0x5e0270[_0x1a05('0x48')][_0x1a05('0x71')],'role':_0x1a05('0x72')},'attributes':['id','name',_0x1a05('0x83'),_0x1a05('0x84'),_0x1a05('0x85')],'raw':!![]});}return null;})[_0x1a05('0x15')](function(_0x17f813){if(!_0x17f813)return null;_0x3ec59a['message']['agent']=_0x17f813;return _0x3ec59a;})[_0x1a05('0x15')](function(_0x5c07c8){if(_0x5c07c8){_0x5c07c8[_0x1a05('0x1e')][_0x1a05('0x94')]=util[_0x1a05('0x6b')](_0x1a05('0x87'),_0x5e0270[_0x1a05('0x60')][_0x1a05('0x2c')]);_0x5c07c8[_0x1a05('0x1e')][_0x1a05('0x88')]=_0x3ec59a[_0x1a05('0x88')];_0x5c07c8[_0x1a05('0x1e')][_0x1a05('0x89')]=_0x3ec59a['channel'];_0x5c07c8['message'][_0x1a05('0x8a')]=_0x1a05('0x8e');_0x5c07c8[_0x1a05('0x1e')][_0x1a05('0x48')]=htmlToText[_0x1a05('0x8b')](_0x3ec59a[_0x1a05('0x1e')][_0x1a05('0x48')]);respondWithRpcPromise(_0x1a05('0x8c'),'EventManager',{'event':_0x1a05('0x95'),'message':_0x5c07c8[_0x1a05('0x1e')]},client9002);return _0x3ec59a;}return null;})['then'](respondWithResult(_0x4280eb,null))[_0x1a05('0x20')](handleError(_0x4280eb,null));};exports[_0x1a05('0x96')]=function(_0x30861f,_0x227719){var _0x2d27c6=moment()[_0x1a05('0x97')]()['toString']();var _0x43b628=path[_0x1a05('0x64')](config[_0x1a05('0x65')],'server',_0x1a05('0x98'),'tmp');var _0x47f76d=path[_0x1a05('0x64')](config['root'],_0x1a05('0x99'),_0x1a05('0x98'),_0x1a05('0x63'));var _0x49319c=util[_0x1a05('0x6b')]('message-%s.eml',_0x2d27c6);return db[_0x1a05('0x2f')][_0x1a05('0x49')]({'where':{'id':_0x30861f['params']['id']},'attributes':['id',_0x1a05('0x48'),_0x1a05('0x9a'),'to','cc',_0x1a05('0x9b'),_0x1a05('0x9c'),_0x1a05('0x9d')],'include':_0x30861f['query']['attachments']?[{'model':db['Attachment'],'as':_0x1a05('0x9e')}]:undefined})[_0x1a05('0x15')](handleEntityNotFound(_0x227719,null))[_0x1a05('0x15')](function(_0x41e092){if(_0x41e092){var _0x358521=_0x41e092;var _0x2c50f8={'from':_0x358521[_0x1a05('0x9a')],'to':_0x358521['to'],'subject':_0x358521[_0x1a05('0x9c')],'html':_0x358521[_0x1a05('0x48')],'headers':{'Date':moment(_0x358521[_0x1a05('0x9d')])[_0x1a05('0x6b')](_0x1a05('0x9f'))},'attachments':[]};if(_0x41e092['cc']){_0x2c50f8['headers']['Cc']=_0x41e092['cc'];}if(_0x41e092['bcc']){_0x2c50f8['headers'][_0x1a05('0xa0')]=_0x41e092[_0x1a05('0x9b')];}return new BPromise(function(_0x2f8435,_0x2d70f1){if(_0x41e092[_0x1a05('0x9e')]){for(var _0x299648=0x0;_0x299648<_0x41e092['Attachments']['length'];_0x299648++){var _0x2fc7ab=_0x41e092[_0x1a05('0x9e')][_0x299648];var _0x9d4b59=path[_0x1a05('0x64')](_0x47f76d,_0x2fc7ab[_0x1a05('0x66')]);if(fs[_0x1a05('0xa1')](_0x9d4b59)){_0x2c50f8[_0x1a05('0x63')][_0x1a05('0xa2')]({'name':_0x2fc7ab[_0x1a05('0x2c')],'contentType':_0x2fc7ab[_0x1a05('0x32')],'data':fs[_0x1a05('0xa3')](_0x9d4b59)});}}}emlformat[_0x1a05('0xa4')](_0x2c50f8,function(_0x5b071e,_0x2c9029){if(_0x5b071e)return _0x2d70f1(_0x5b071e);fs[_0x1a05('0xa5')](path[_0x1a05('0x64')](_0x43b628,_0x49319c),_0x2c9029);return _0x2f8435(_0x2c9029);});});}})[_0x1a05('0x15')](function(_0x27b4dc){if(_0x27b4dc){return _0x227719[_0x1a05('0x96')](path['join'](_0x43b628,_0x49319c),_0x49319c,function(_0x3abb87){if(!_0x3abb87)fs['unlinkSync'](path[_0x1a05('0x64')](_0x43b628,_0x49319c));});}})[_0x1a05('0x20')](handleError(_0x227719,null));}; \ No newline at end of file +var _0xcb3a=['../../config/environment','redis','defaults','localhost','socket.io-emitter','jayson/promise','http','client','request','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','json','undefined','limit','count','offset','status','set','update','destroy','end','sendStatus','send','index','MailMessage','rawAttributes','fieldName','key','model','map','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','findAll','rows','params','include','body','find','describe','create','MailAccount','findOne','CmList','List','CmContact','updatedAt','DESC','Smtp','isNil','service','host','port','secure','authentication','pass','auth','user','attachments','join','root','basename','Contacts','ListId','List\x20not\x20found','SendMail','messageId','format','YYYY-MM-DD\x20HH:mm:ss','accept','mail','read','readAt','UserId','agent','MailInteraction','MailInteractionId','read1stAt','interaction','get','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','QueryTypes','SELECT','contact','User','fullname','email','internal','manual','SIP/%s','channel','motionChannel','event','fromString','EventManager','acceptmessage','reject','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','RejectMessage','rejectMessage','Sequelize','interface','download','unix','toString','server','files','from','bcc','subject','Attachment','createdAt','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Attachments','existsSync','push','type','build','writeFileSync','eml-format','util','path','lodash','ioredis','html-to-text','../../components/parsers/qs','../../config/logger','mail-interactions'];(function(_0x5196d9,_0x2d6111){var _0x29e1f4=function(_0x3a03d9){while(--_0x3a03d9){_0x5196d9['push'](_0x5196d9['shift']());}};_0x29e1f4(++_0x2d6111);}(_0xcb3a,0x1d7));var _0xacb3=function(_0x2941c4,_0x48780f){_0x2941c4=_0x2941c4-0x0;var _0x44152f=_0xcb3a[_0x2941c4];return _0x44152f;};'use strict';var emlformat=require(_0xacb3('0x0'));var moment=require('moment');var BPromise=require('bluebird');var util=require(_0xacb3('0x1'));var path=require(_0xacb3('0x2'));var fs=require('fs');var _=require(_0xacb3('0x3'));var Redis=require(_0xacb3('0x4'));var htmlToText=require(_0xacb3('0x5'));var qs=require(_0xacb3('0x6'));var logger=require(_0xacb3('0x7'))('api');var interaction_log=require(_0xacb3('0x7'))(_0xacb3('0x8'));var config=require(_0xacb3('0x9'));var db=require('../../mysqldb')['db'];config[_0xacb3('0xa')]=_[_0xacb3('0xb')](config[_0xacb3('0xa')],{'host':_0xacb3('0xc'),'port':0x18eb});var socket=require(_0xacb3('0xd'))(new Redis(config[_0xacb3('0xa')]));require('./mailMessage.socket')['register'](socket);var jayson=require(_0xacb3('0xe'));var client=jayson['client'][_0xacb3('0xf')]({'port':0x232c});var client9003=jayson[_0xacb3('0x10')][_0xacb3('0xf')]({'port':0x232b});var client9002=jayson[_0xacb3('0x10')][_0xacb3('0xf')]({'port':0x232a});function respondWithRpcPromise(_0x3c88fd,_0x3a0bd1,_0x1a7182,_0x43e8ce){return new BPromise(function(_0x45e03c,_0x354473){var _0xaa66e0=_0x43e8ce||client;return _0xaa66e0[_0xacb3('0x11')](_0x3c88fd,_0x1a7182)[_0xacb3('0x12')](function(_0x211c19){logger[_0xacb3('0x13')](_0xacb3('0x14'),_0x3a0bd1,_0xacb3('0x15'));logger[_0xacb3('0x16')](_0xacb3('0x17'),_0x3a0bd1,_0xacb3('0x15'),JSON[_0xacb3('0x18')](_0x211c19));if(_0x211c19[_0xacb3('0x19')]){if(_0x211c19['error'][_0xacb3('0x1a')]===0x1f4){logger[_0xacb3('0x19')](_0xacb3('0x14'),_0x3a0bd1,_0x211c19[_0xacb3('0x19')][_0xacb3('0x1b')]);return _0x354473(_0x211c19[_0xacb3('0x19')]['message']);}logger[_0xacb3('0x19')](_0xacb3('0x14'),_0x3a0bd1,_0x211c19[_0xacb3('0x19')][_0xacb3('0x1b')]);return _0x45e03c(_0x211c19[_0xacb3('0x19')][_0xacb3('0x1b')]);}else{logger[_0xacb3('0x13')](_0xacb3('0x14'),_0x3a0bd1,_0xacb3('0x15'));_0x45e03c(_0x211c19[_0xacb3('0x1c')][_0xacb3('0x1b')]);}})[_0xacb3('0x1d')](function(_0x1f3559){logger[_0xacb3('0x19')](_0xacb3('0x14'),_0x3a0bd1,_0x1f3559);_0x354473(_0x1f3559);});});}function respondWithResult(_0x41f05,_0x1d0b9a){_0x1d0b9a=_0x1d0b9a||0xc8;return function(_0x4dcf88){if(_0x4dcf88){return _0x41f05['status'](_0x1d0b9a)[_0xacb3('0x1e')](_0x4dcf88);}};}function respondWithFilteredResult(_0x120271,_0x2724cf){return function(_0x1a4119){if(_0x1a4119){var _0x4cb842=typeof _0x2724cf['offset']===_0xacb3('0x1f')&&typeof _0x2724cf[_0xacb3('0x20')]===_0xacb3('0x1f');var _0x40d565=_0x1a4119[_0xacb3('0x21')];var _0x4dbd29=_0x4cb842?0x0:_0x2724cf[_0xacb3('0x22')];var _0xbdb09=_0x4cb842?_0x1a4119[_0xacb3('0x21')]:_0x2724cf[_0xacb3('0x22')]+_0x2724cf[_0xacb3('0x20')];var _0x4503c6;if(_0xbdb09>=_0x40d565){_0xbdb09=_0x40d565;_0x4503c6=0xc8;}else{_0x4503c6=0xce;}_0x120271[_0xacb3('0x23')](_0x4503c6);return _0x120271[_0xacb3('0x24')]('Content-Range',_0x4dbd29+'-'+_0xbdb09+'/'+_0x40d565)[_0xacb3('0x1e')](_0x1a4119);}return null;};}function saveUpdates(_0x1b94de){return function(_0x2cebb9){if(_0x2cebb9){return _0x2cebb9[_0xacb3('0x25')](_0x1b94de)[_0xacb3('0x12')](function(_0x583337){return _0x583337;});}return null;};}function removeEntity(_0x45958d){return function(_0x29d72f){if(_0x29d72f){return _0x29d72f[_0xacb3('0x26')]()[_0xacb3('0x12')](function(){_0x45958d[_0xacb3('0x23')](0xcc)[_0xacb3('0x27')]();});}};}function handleEntityNotFound(_0x54c922){return function(_0x27475e){if(!_0x27475e){_0x54c922[_0xacb3('0x28')](0x194);}return _0x27475e;};}function handleError(_0xd67eeb,_0x3e43a9){_0x3e43a9=_0x3e43a9||0x1f4;return function(_0x59dbe5){logger[_0xacb3('0x19')](_0x59dbe5['stack']);if(_0x59dbe5['name']){delete _0x59dbe5['name'];}_0xd67eeb[_0xacb3('0x23')](_0x3e43a9)[_0xacb3('0x29')](_0x59dbe5);};}exports[_0xacb3('0x2a')]=function(_0x227cfd,_0x278cfa){var _0x2da64b={},_0x1710cd={},_0x254a34={'count':0x0,'rows':[]};var _0x5c3548=_['map'](db[_0xacb3('0x2b')][_0xacb3('0x2c')],function(_0x1bb4e9){return{'name':_0x1bb4e9[_0xacb3('0x2d')],'type':_0x1bb4e9['type'][_0xacb3('0x2e')]};});_0x1710cd[_0xacb3('0x2f')]=_[_0xacb3('0x30')](_0x5c3548,_0xacb3('0x31'));_0x1710cd[_0xacb3('0x32')]=_[_0xacb3('0x33')](_0x227cfd[_0xacb3('0x32')]);_0x1710cd[_0xacb3('0x34')]=_[_0xacb3('0x35')](_0x1710cd[_0xacb3('0x2f')],_0x1710cd[_0xacb3('0x32')]);_0x2da64b[_0xacb3('0x36')]=_[_0xacb3('0x35')](_0x1710cd[_0xacb3('0x2f')],qs[_0xacb3('0x37')](_0x227cfd[_0xacb3('0x32')]['fields']));_0x2da64b[_0xacb3('0x36')]=_0x2da64b[_0xacb3('0x36')][_0xacb3('0x38')]?_0x2da64b[_0xacb3('0x36')]:_0x1710cd[_0xacb3('0x2f')];if(!_0x227cfd[_0xacb3('0x32')][_0xacb3('0x39')](_0xacb3('0x3a'))){_0x2da64b['limit']=qs[_0xacb3('0x20')](_0x227cfd[_0xacb3('0x32')][_0xacb3('0x20')]);_0x2da64b[_0xacb3('0x22')]=qs['offset'](_0x227cfd[_0xacb3('0x32')][_0xacb3('0x22')]);}_0x2da64b['order']=qs[_0xacb3('0x3b')](_0x227cfd[_0xacb3('0x32')][_0xacb3('0x3b')]);_0x2da64b[_0xacb3('0x3c')]=qs[_0xacb3('0x34')](_[_0xacb3('0x3d')](_0x227cfd[_0xacb3('0x32')],_0x1710cd[_0xacb3('0x34')]),_0x5c3548);if(_0x227cfd[_0xacb3('0x32')][_0xacb3('0x3e')]){_0x2da64b[_0xacb3('0x3c')]=_['merge'](_0x2da64b[_0xacb3('0x3c')],{'$or':_[_0xacb3('0x30')](_0x5c3548,function(_0x2a5521){if(_0x2a5521['type']!==_0xacb3('0x3f')){var _0x93032={};_0x93032[_0x2a5521[_0xacb3('0x31')]]={'$like':'%'+_0x227cfd['query'][_0xacb3('0x3e')]+'%'};return _0x93032;}})});}_0x2da64b=_[_0xacb3('0x40')]({},_0x2da64b,_0x227cfd[_0xacb3('0x41')]);var _0x278b27={'where':_0x2da64b[_0xacb3('0x3c')]};return db[_0xacb3('0x2b')][_0xacb3('0x21')](_0x278b27)['then'](function(_0x3282ec){_0x254a34[_0xacb3('0x21')]=_0x3282ec;if(_0x227cfd[_0xacb3('0x32')][_0xacb3('0x42')]){_0x2da64b['include']=[{'all':!![]}];}return db[_0xacb3('0x2b')][_0xacb3('0x43')](_0x2da64b);})[_0xacb3('0x12')](function(_0x2c161e){_0x254a34[_0xacb3('0x44')]=_0x2c161e;return _0x254a34;})[_0xacb3('0x12')](respondWithFilteredResult(_0x278cfa,_0x2da64b))[_0xacb3('0x1d')](handleError(_0x278cfa,null));};exports['show']=function(_0x2c5417,_0x115660){var _0x24a173={'raw':!![],'where':{'id':_0x2c5417[_0xacb3('0x45')]['id']}},_0x405115={};_0x405115[_0xacb3('0x2f')]=_[_0xacb3('0x33')](db[_0xacb3('0x2b')]['rawAttributes']);_0x405115[_0xacb3('0x32')]=_[_0xacb3('0x33')](_0x2c5417[_0xacb3('0x32')]);_0x405115[_0xacb3('0x34')]=_['intersection'](_0x405115['model'],_0x405115[_0xacb3('0x32')]);_0x24a173[_0xacb3('0x36')]=_['intersection'](_0x405115[_0xacb3('0x2f')],qs['fields'](_0x2c5417[_0xacb3('0x32')][_0xacb3('0x37')]));_0x24a173[_0xacb3('0x36')]=_0x24a173[_0xacb3('0x36')]['length']?_0x24a173[_0xacb3('0x36')]:_0x405115[_0xacb3('0x2f')];if(_0x2c5417['query'][_0xacb3('0x42')]){_0x24a173[_0xacb3('0x46')]=[{'all':!![]}];}_0x24a173=_[_0xacb3('0x40')]({},_0x24a173,_0x2c5417[_0xacb3('0x41')]);return db[_0xacb3('0x2b')]['find'](_0x24a173)[_0xacb3('0x12')](handleEntityNotFound(_0x115660,null))[_0xacb3('0x12')](respondWithResult(_0x115660,null))['catch'](handleError(_0x115660,null));};exports['update']=function(_0x33aa39,_0x3c5172){if(_0x33aa39[_0xacb3('0x47')]['id']){delete _0x33aa39[_0xacb3('0x47')]['id'];}return db[_0xacb3('0x2b')][_0xacb3('0x48')]({'where':{'id':_0x33aa39[_0xacb3('0x45')]['id']}})[_0xacb3('0x12')](handleEntityNotFound(_0x3c5172,null))[_0xacb3('0x12')](saveUpdates(_0x33aa39[_0xacb3('0x47')],null))[_0xacb3('0x12')](respondWithResult(_0x3c5172,null))['catch'](handleError(_0x3c5172,null));};exports['destroy']=function(_0x34efd1,_0x5bfdd8){return db[_0xacb3('0x2b')]['find']({'where':{'id':_0x34efd1[_0xacb3('0x45')]['id']}})['then'](handleEntityNotFound(_0x5bfdd8,null))[_0xacb3('0x12')](removeEntity(_0x5bfdd8,null))[_0xacb3('0x1d')](handleError(_0x5bfdd8,null));};exports[_0xacb3('0x49')]=function(_0x1ecad8,_0xa89d61){return db[_0xacb3('0x2b')][_0xacb3('0x49')]()[_0xacb3('0x12')](respondWithResult(_0xa89d61,null))['catch'](handleError(_0xa89d61,null));};exports[_0xacb3('0x4a')]=function(_0x3a6978,_0x1e0474){return db[_0xacb3('0x2b')][_0xacb3('0x4a')](_0x3a6978['body'])[_0xacb3('0x12')](function(_0x4c121d){if(_0x4c121d){if(_0x4c121d['direction']==='out'&&!_0x4c121d['secret']){var _0x49a299,_0x36841c,_0xfdff45;if(_0x3a6978['body']['to']){_0x36841c=_0x3a6978[_0xacb3('0x47')]['to']['split'](',')[0x0];}return db[_0xacb3('0x4b')][_0xacb3('0x4c')]({'where':{'id':_0x4c121d['MailAccountId']},'include':[{'model':db[_0xacb3('0x4d')],'as':_0xacb3('0x4e'),'include':[{'model':db[_0xacb3('0x4f')],'as':'Contacts','where':{'email':_0x36841c},'limit':0x1,'order':[[_0xacb3('0x50'),_0xacb3('0x51')]]}]},{'model':db['MailServerOut'],'as':_0xacb3('0x52'),'raw':!![]}]})[_0xacb3('0x12')](function(_0x196fe6){_0x49a299=_0x196fe6;if(_0x49a299&&_0x49a299[_0xacb3('0x52')]){var _0x3ba181={'tls':{'rejectUnauthorized':![]}};if(_[_0xacb3('0x53')](_0x49a299[_0xacb3('0x52')][_0xacb3('0x54')])){_0x3ba181[_0xacb3('0x55')]=_0x49a299[_0xacb3('0x52')][_0xacb3('0x55')];_0x3ba181[_0xacb3('0x56')]=_0x49a299[_0xacb3('0x52')][_0xacb3('0x56')];_0x3ba181[_0xacb3('0x57')]=_0x49a299[_0xacb3('0x52')]['secure'];if(_0x49a299[_0xacb3('0x52')][_0xacb3('0x58')]){_0x3ba181['auth']={'user':_0x49a299[_0xacb3('0x52')]['user'],'pass':_0x49a299[_0xacb3('0x52')][_0xacb3('0x59')]};}}else{_0x3ba181['service']=_0x49a299[_0xacb3('0x52')][_0xacb3('0x54')];_0x3ba181[_0xacb3('0x5a')]={'user':_0x49a299[_0xacb3('0x52')][_0xacb3('0x5b')],'pass':_0x49a299['Smtp']['pass']};_0x3ba181[_0xacb3('0x57')]=_0x49a299['Smtp']['secure'];}if(_0x3a6978[_0xacb3('0x47')][_0xacb3('0x5c')]&&_0x3a6978[_0xacb3('0x47')][_0xacb3('0x5c')]['length']){for(var _0x51ea91=0x0;_0x51ea91<_0x3a6978[_0xacb3('0x47')][_0xacb3('0x5c')][_0xacb3('0x38')];_0x51ea91+=0x1){_0x3a6978['body'][_0xacb3('0x5c')][_0x51ea91]={'filename':_0x3a6978['body'][_0xacb3('0x5c')][_0x51ea91][_0xacb3('0x31')],'path':path[_0xacb3('0x5d')](config[_0xacb3('0x5e')],'server/files/attachments',_0x3a6978[_0xacb3('0x47')][_0xacb3('0x5c')][_0x51ea91][_0xacb3('0x5f')])};}}_0xfdff45={'account':_0x3ba181,'message':_0x3a6978[_0xacb3('0x47')]};return;}})[_0xacb3('0x12')](function(){if(_0x49a299[_0xacb3('0x4e')]){if(_0x49a299[_0xacb3('0x4e')]['Contacts'][_0xacb3('0x38')]){return _0x49a299[_0xacb3('0x4e')][_0xacb3('0x60')][0x0];}else{return db[_0xacb3('0x4f')]['create'](_[_0xacb3('0xb')](_0x3a6978[_0xacb3('0x47')],{'firstName':_0x3a6978[_0xacb3('0x47')]['to'],'email':_0x3a6978[_0xacb3('0x47')]['to'],'phone':_0x3a6978['body']['to'],'ListId':_0x49a299[_0xacb3('0x61')]}));}}else{throw new Error(_0xacb3('0x62'));}})['then'](function(){if(_0xfdff45){return respondWithRpcPromise(_0xacb3('0x63'),'sendMail',_0xfdff45,client9003)[_0xacb3('0x12')](function(_0x6cf3f7){return _0x4c121d['update']({'read':!![],'messageId':_0x6cf3f7[_0xacb3('0x64')],'sentAt':moment()[_0xacb3('0x65')](_0xacb3('0x66'))});})[_0xacb3('0x1d')](function(_0x1b8303){logger[_0xacb3('0x19')]('%s',JSON[_0xacb3('0x18')](_0x1b8303));return _0x4c121d;});}return _0x4c121d;});}return _0x4c121d;}})['then'](respondWithResult(_0x1e0474,0xc9))[_0xacb3('0x1d')](handleError(_0x1e0474,null));};exports[_0xacb3('0x67')]=function(_0x2b0f84,_0x3a9fb6){var _0x49eb49={'agent':{},'channel':_0xacb3('0x68')};if(_0x2b0f84[_0xacb3('0x47')]['id']){delete _0x2b0f84[_0xacb3('0x47')]['id'];}_0x2b0f84[_0xacb3('0x47')][_0xacb3('0x69')]=!![];_0x2b0f84['body'][_0xacb3('0x6a')]=moment()[_0xacb3('0x65')]('YYYY-MM-DD\x20HH:mm:ss');_0x2b0f84[_0xacb3('0x47')][_0xacb3('0x6b')]=_0x2b0f84[_0xacb3('0x47')][_0xacb3('0x6b')]||_0x2b0f84['user']['id'];_0x49eb49[_0xacb3('0x6c')]['id']=_0x2b0f84[_0xacb3('0x47')]['UserId'];return db[_0xacb3('0x2b')][_0xacb3('0x48')]({'where':{'id':_0x2b0f84[_0xacb3('0x45')]['id'],'UserId':null}})[_0xacb3('0x12')](handleEntityNotFound(_0x3a9fb6,null))[_0xacb3('0x12')](saveUpdates(_0x2b0f84['body'],null))[_0xacb3('0x12')](function(_0x2c5296){if(_0x2c5296){_0x49eb49['message']=_0x2c5296['get']({'plain':!![]});return db[_0xacb3('0x6d')]['find']({'where':{'id':_0x2c5296[_0xacb3('0x6e')]}});}return null;})[_0xacb3('0x12')](handleEntityNotFound(_0x3a9fb6,null))[_0xacb3('0x12')](function(_0x84d4dc){if(_0x84d4dc){return _0x84d4dc[_0xacb3('0x25')]({'UserId':_0x2b0f84[_0xacb3('0x47')][_0xacb3('0x6b')],'read1stAt':_[_0xacb3('0x53')](_0x84d4dc[_0xacb3('0x6f')])?moment()[_0xacb3('0x65')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})['then'](function(_0x5e4ae0){if(_0x5e4ae0){_0x49eb49[_0xacb3('0x70')]=_0x5e4ae0[_0xacb3('0x71')]({'plain':!![]});interaction_log[_0xacb3('0x13')]('[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x2b0f84['user']['id'],_0x2b0f84[_0xacb3('0x5b')][_0xacb3('0x31')],_0x2b0f84[_0xacb3('0x5b')]['role'],_0x49eb49[_0xacb3('0x70')]['id'],_0x2b0f84[_0xacb3('0x47')]?JSON[_0xacb3('0x18')](_0x2b0f84['body']):_0xacb3('0x72'));return respondWithRpcPromise(_0xacb3('0x73'),_0xacb3('0x74'),_0x49eb49);}return null;})[_0xacb3('0x12')](function(_0x3dda99){var _0x22c7a8=_0xacb3('0x75')+_0x3dda99['message'][_0xacb3('0x76')];return db[_0xacb3('0x77')][_0xacb3('0x32')](_0x22c7a8,{'type':db['Sequelize'][_0xacb3('0x78')][_0xacb3('0x79')],'raw':!![]})[_0xacb3('0x12')](function(_0x3f950e){return _0x3f950e;});})['then'](function(_0x471ee6){if(_0x471ee6){_0x49eb49[_0xacb3('0x1b')][_0xacb3('0x7a')]=_0x471ee6[0x0];if(!_0x2b0f84[_0xacb3('0x47')][_0xacb3('0x6b')])return;return db[_0xacb3('0x7b')][_0xacb3('0x48')]({'where':{'id':_0x2b0f84['body'][_0xacb3('0x6b')],'role':_0xacb3('0x6c')},'attributes':['id',_0xacb3('0x31'),_0xacb3('0x7c'),_0xacb3('0x7d'),_0xacb3('0x7e')],'raw':!![]});}return null;})[_0xacb3('0x12')](function(_0x524f22){if(!_0x524f22)return null;_0x49eb49['message'][_0xacb3('0x6c')]=_0x524f22;return _0x49eb49;})[_0xacb3('0x12')](function(_0x42d826){if(_0x42d826){if(_0x2b0f84[_0xacb3('0x47')][_0xacb3('0x7f')]){_0x49eb49[_0xacb3('0x1b')]['interface']=util[_0xacb3('0x65')](_0xacb3('0x80'),_0x2b0f84[_0xacb3('0x5b')][_0xacb3('0x31')]);_0x49eb49[_0xacb3('0x1b')][_0xacb3('0x81')]=_0x49eb49['channel'];_0x49eb49[_0xacb3('0x1b')][_0xacb3('0x82')]=_0x49eb49[_0xacb3('0x81')];_0x49eb49[_0xacb3('0x1b')][_0xacb3('0x83')]=_0xacb3('0x67');_0x49eb49['message'][_0xacb3('0x47')]=htmlToText[_0xacb3('0x84')](_0x49eb49[_0xacb3('0x1b')][_0xacb3('0x47')]);return respondWithRpcPromise(_0xacb3('0x85'),_0xacb3('0x85'),{'event':_0xacb3('0x86'),'message':_0x49eb49[_0xacb3('0x1b')]},client9002)['then'](function(){return _0x49eb49;});}return _0x49eb49;}return null;})[_0xacb3('0x12')](respondWithResult(_0x3a9fb6,null))[_0xacb3('0x1d')](handleError(_0x3a9fb6,null));};exports[_0xacb3('0x87')]=function(_0x565329,_0x887a1e){var _0x4780b7={'agent':{},'channel':_0xacb3('0x68')};if(_0x565329[_0xacb3('0x47')]['id']){delete _0x565329[_0xacb3('0x47')]['id'];}_0x565329[_0xacb3('0x47')][_0xacb3('0x6b')]=_0x565329[_0xacb3('0x47')]['UserId']||_0x565329[_0xacb3('0x5b')]['id'];_0x4780b7[_0xacb3('0x6c')]['id']=_0x565329[_0xacb3('0x47')][_0xacb3('0x6b')];return db[_0xacb3('0x2b')]['find']({'where':{'id':_0x565329[_0xacb3('0x45')]['id'],'UserId':null}})[_0xacb3('0x12')](handleEntityNotFound(_0x887a1e,null))[_0xacb3('0x12')](function(_0x3a7bcb){if(_0x3a7bcb){_0x4780b7[_0xacb3('0x1b')]=_0x3a7bcb[_0xacb3('0x71')]({'plain':!![]});return db[_0xacb3('0x6d')]['find']({'where':{'id':_0x3a7bcb[_0xacb3('0x6e')]}});}return null;})[_0xacb3('0x12')](handleEntityNotFound(_0x887a1e,null))['then'](function(_0x2dc9de){if(_0x2dc9de){_0x4780b7['interaction']=_0x2dc9de['get']({'plain':!![]});interaction_log[_0xacb3('0x13')](_0xacb3('0x88'),_0x565329[_0xacb3('0x5b')]['id'],_0x565329[_0xacb3('0x5b')]['name'],_0x565329[_0xacb3('0x5b')][_0xacb3('0x89')],_0x4780b7[_0xacb3('0x70')]['id'],_0x565329[_0xacb3('0x47')]?JSON[_0xacb3('0x18')](_0x565329[_0xacb3('0x47')]):_0xacb3('0x72'));return respondWithRpcPromise(_0xacb3('0x8a'),_0xacb3('0x8b'),_0x4780b7);}return null;})[_0xacb3('0x12')](function(_0x2aca79){var _0x103b02=_0xacb3('0x75')+_0x2aca79['message'][_0xacb3('0x76')];return db['sequelize'][_0xacb3('0x32')](_0x103b02,{'type':db[_0xacb3('0x8c')][_0xacb3('0x78')][_0xacb3('0x79')],'raw':!![]})['then'](function(_0x2cf689){return _0x2cf689;});})['then'](function(_0x14c968){if(_0x14c968){_0x4780b7[_0xacb3('0x1b')][_0xacb3('0x7a')]=_0x14c968[0x0];if(!_0x565329[_0xacb3('0x47')][_0xacb3('0x6b')])return;return db[_0xacb3('0x7b')][_0xacb3('0x48')]({'where':{'id':_0x565329[_0xacb3('0x47')][_0xacb3('0x6b')],'role':_0xacb3('0x6c')},'attributes':['id',_0xacb3('0x31'),_0xacb3('0x7c'),_0xacb3('0x7d'),_0xacb3('0x7e')],'raw':!![]});}return null;})[_0xacb3('0x12')](function(_0x212421){if(!_0x212421)return null;_0x4780b7[_0xacb3('0x1b')][_0xacb3('0x6c')]=_0x212421;return _0x4780b7;})[_0xacb3('0x12')](function(_0x1bbc45){if(_0x1bbc45){_0x1bbc45['message'][_0xacb3('0x8d')]=util[_0xacb3('0x65')](_0xacb3('0x80'),_0x565329[_0xacb3('0x5b')]['name']);_0x1bbc45[_0xacb3('0x1b')][_0xacb3('0x81')]=_0x4780b7[_0xacb3('0x81')];_0x1bbc45[_0xacb3('0x1b')]['motionChannel']=_0x4780b7[_0xacb3('0x81')];_0x1bbc45[_0xacb3('0x1b')][_0xacb3('0x83')]=_0xacb3('0x87');_0x1bbc45['message'][_0xacb3('0x47')]=htmlToText[_0xacb3('0x84')](_0x4780b7[_0xacb3('0x1b')][_0xacb3('0x47')]);respondWithRpcPromise(_0xacb3('0x85'),_0xacb3('0x85'),{'event':'rejectmessage','message':_0x1bbc45[_0xacb3('0x1b')]},client9002);return _0x4780b7;}return null;})[_0xacb3('0x12')](respondWithResult(_0x887a1e,null))[_0xacb3('0x1d')](handleError(_0x887a1e,null));};exports[_0xacb3('0x8e')]=function(_0x303f8d,_0x3180fa){var _0x574db0=moment()[_0xacb3('0x8f')]()[_0xacb3('0x90')]();var _0x44a88=path[_0xacb3('0x5d')](config[_0xacb3('0x5e')],_0xacb3('0x91'),'files','tmp');var _0x3a4612=path[_0xacb3('0x5d')](config[_0xacb3('0x5e')],'server',_0xacb3('0x92'),_0xacb3('0x5c'));var _0x578fd0=util['format']('message-%s.eml',_0x574db0);return db[_0xacb3('0x2b')][_0xacb3('0x48')]({'where':{'id':_0x303f8d[_0xacb3('0x45')]['id']},'attributes':['id',_0xacb3('0x47'),_0xacb3('0x93'),'to','cc',_0xacb3('0x94'),_0xacb3('0x95'),'createdAt'],'include':_0x303f8d[_0xacb3('0x32')][_0xacb3('0x5c')]?[{'model':db[_0xacb3('0x96')],'as':'Attachments'}]:undefined})[_0xacb3('0x12')](handleEntityNotFound(_0x3180fa,null))[_0xacb3('0x12')](function(_0x1bc704){if(_0x1bc704){var _0x3e1b26=_0x1bc704;var _0x3a5b8b={'from':_0x3e1b26['from'],'to':_0x3e1b26['to'],'subject':_0x3e1b26[_0xacb3('0x95')],'html':_0x3e1b26[_0xacb3('0x47')],'headers':{'Date':moment(_0x3e1b26[_0xacb3('0x97')])['format'](_0xacb3('0x98'))},'attachments':[]};if(_0x1bc704['cc']){_0x3a5b8b['headers']['Cc']=_0x1bc704['cc'];}if(_0x1bc704[_0xacb3('0x94')]){_0x3a5b8b[_0xacb3('0x99')]['Bcc']=_0x1bc704[_0xacb3('0x94')];}return new BPromise(function(_0x51e502,_0x9c793){if(_0x1bc704[_0xacb3('0x9a')]){for(var _0x35683f=0x0;_0x35683f<_0x1bc704[_0xacb3('0x9a')][_0xacb3('0x38')];_0x35683f++){var _0x28483c=_0x1bc704[_0xacb3('0x9a')][_0x35683f];var _0x100711=path['join'](_0x3a4612,_0x28483c['basename']);if(fs[_0xacb3('0x9b')](_0x100711)){_0x3a5b8b[_0xacb3('0x5c')][_0xacb3('0x9c')]({'name':_0x28483c[_0xacb3('0x31')],'contentType':_0x28483c[_0xacb3('0x9d')],'data':fs['readFileSync'](_0x100711)});}}}emlformat[_0xacb3('0x9e')](_0x3a5b8b,function(_0x52d503,_0x1e9627){if(_0x52d503)return _0x9c793(_0x52d503);fs[_0xacb3('0x9f')](path[_0xacb3('0x5d')](_0x44a88,_0x578fd0),_0x1e9627);return _0x51e502(_0x1e9627);});});}})[_0xacb3('0x12')](function(_0x30dac0){if(_0x30dac0){return _0x3180fa['download'](path[_0xacb3('0x5d')](_0x44a88,_0x578fd0),_0x578fd0,function(_0x212607){if(!_0x212607)fs['unlinkSync'](path[_0xacb3('0x5d')](_0x44a88,_0x578fd0));});}})[_0xacb3('0x1d')](handleError(_0x3180fa,null));}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.events.js b/server/api/mailMessage/mailMessage.events.js index 7f726c1..81b3126 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 _0x0b1b=['save','update','emit','hasOwnProperty','events','../../mysqldb','MailMessage'];(function(_0x12fcbd,_0x884804){var _0x28ec2a=function(_0xa5ff99){while(--_0xa5ff99){_0x12fcbd['push'](_0x12fcbd['shift']());}};_0x28ec2a(++_0x884804);}(_0x0b1b,0x1e7));var _0xb0b1=function(_0xfa634c,_0x414e0e){_0xfa634c=_0xfa634c-0x0;var _0x73e478=_0x0b1b[_0xfa634c];return _0x73e478;};'use strict';var EventEmitter=require(_0xb0b1('0x0'));var MailMessage=require(_0xb0b1('0x1'))['db'][_0xb0b1('0x2')];var MailMessageEvents=new EventEmitter();MailMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xb0b1('0x3'),'afterUpdate':_0xb0b1('0x4'),'afterDestroy':'remove'};function emitEvent(_0x5e5d6c){return function(_0x5f6e57,_0x340a16,_0xd7aab9){MailMessageEvents[_0xb0b1('0x5')](_0x5e5d6c+':'+_0x5f6e57['id'],_0x5f6e57);MailMessageEvents[_0xb0b1('0x5')](_0x5e5d6c,_0x5f6e57);_0xd7aab9(null);};}for(var e in events){if(events[_0xb0b1('0x6')](e)){var event=events[e];MailMessage['hook'](e,emitEvent(event));}}module['exports']=MailMessageEvents; \ No newline at end of file +var _0x329c=['update','remove','emit','hasOwnProperty','exports','events','MailMessage','setMaxListeners'];(function(_0x4b2436,_0x452299){var _0x4f5ab2=function(_0x5c6679){while(--_0x5c6679){_0x4b2436['push'](_0x4b2436['shift']());}};_0x4f5ab2(++_0x452299);}(_0x329c,0x9d));var _0xc329=function(_0x39e164,_0x2cb93b){_0x39e164=_0x39e164-0x0;var _0x13fa6b=_0x329c[_0x39e164];return _0x13fa6b;};'use strict';var EventEmitter=require(_0xc329('0x0'));var MailMessage=require('../../mysqldb')['db'][_0xc329('0x1')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0xc329('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xc329('0x3'),'afterDestroy':_0xc329('0x4')};function emitEvent(_0x1bab1e){return function(_0x54b61c,_0x166b61,_0x2800bd){MailMessageEvents[_0xc329('0x5')](_0x1bab1e+':'+_0x54b61c['id'],_0x54b61c);MailMessageEvents[_0xc329('0x5')](_0x1bab1e,_0x54b61c);_0x2800bd(null);};}for(var e in events){if(events[_0xc329('0x6')](e)){var event=events[e];MailMessage['hook'](e,emitEvent(event));}}module[_0xc329('0x7')]=MailMessageEvents; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.model.js b/server/api/mailMessage/mailMessage.model.js index b3fd85a..b02f7fe 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 _0x9fe1=['utf8mb4_unicode_ci','util','api','moment','html-to-text','path','rimraf','../../config/environment','./mailMessage.attributes','MailMessage','mail_messages','messageId','fti_mail_messages','plainBody','subject','FULLTEXT','body','models','get','toLowerCase','direction','secret','isNil','UserId','MailInteraction','findOne','MailInteractionId','then','createdAt','error','utf8mb4'];(function(_0x8361a,_0x19482e){var _0x3d7b1b=function(_0x5edbc3){while(--_0x5edbc3){_0x8361a['push'](_0x8361a['shift']());}};_0x3d7b1b(++_0x19482e);}(_0x9fe1,0x1d2));var _0x19fe=function(_0x5590fe,_0x287598){_0x5590fe=_0x5590fe-0x0;var _0xce3f28=_0x9fe1[_0x5590fe];return _0xce3f28;};'use strict';var _=require('lodash');var util=require(_0x19fe('0x0'));var logger=require('../../config/logger')(_0x19fe('0x1'));var moment=require(_0x19fe('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var htmlToText=require(_0x19fe('0x3'));var fs=require('fs');var path=require(_0x19fe('0x4'));var rimraf=require(_0x19fe('0x5'));var config=require(_0x19fe('0x6'));var attributes=require(_0x19fe('0x7'));module['exports']=function(_0x12a586,_0x100abf){return _0x12a586['define'](_0x19fe('0x8'),attributes,{'tableName':_0x19fe('0x9'),'paranoid':![],'indexes':[{'name':'messageId','fields':[_0x19fe('0xa')]},{'name':_0x19fe('0xb'),'fields':[_0x19fe('0xc'),_0x19fe('0xd')],'type':_0x19fe('0xe')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x31bc2a,_0x1eb063,_0x4033aa){if(_0x31bc2a[_0x19fe('0xf')]){_0x31bc2a['plainBody']=htmlToText['fromString'](_0x31bc2a[_0x19fe('0xf')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x4033aa(null,_0x1eb063);},'afterCreate':function(_0x29f370,_0x237ff6,_0x1bd4a9){var _0x2e042a=_0x12a586[_0x19fe('0x10')];var _0x4e93e6=_0x29f370[_0x19fe('0x11')]({'plain':!![]});if(_0x4e93e6['direction'][_0x19fe('0x12')]()==='in'||_0x4e93e6[_0x19fe('0x13')][_0x19fe('0x12')]()==='out'&&!_0x4e93e6[_0x19fe('0x14')]&&!_[_0x19fe('0x15')](_0x4e93e6[_0x19fe('0x16')])){_0x2e042a[_0x19fe('0x17')][_0x19fe('0x18')]({'where':{'id':_0x4e93e6[_0x19fe('0x19')]}})[_0x19fe('0x1a')](function(_0x1eab99){if(_0x1eab99){_0x1eab99['update']({'lastMsgAt':_0x4e93e6[_0x19fe('0x1b')],'lastMsgDirection':_0x4e93e6[_0x19fe('0x13')][_0x19fe('0x12')]()});}})['catch'](function(_0x21c2d6){console[_0x19fe('0x1c')](_0x21c2d6);});}_0x1bd4a9();}},'charset':_0x19fe('0x1d'),'collate':_0x19fe('0x1e')});}; \ No newline at end of file +var _0xffc2=['path','../../config/environment','./mailMessage.attributes','exports','define','messageId','fti_mail_messages','subject','FULLTEXT','body','fromString','models','get','direction','toLowerCase','out','secret','isNil','UserId','findOne','MailInteractionId','then','update','createdAt','catch','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','html-to-text'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xffc2,0x1b2));var _0x2ffc=function(_0x590a3a,_0xd9db9){_0x590a3a=_0x590a3a-0x0;var _0x49017f=_0xffc2[_0x590a3a];return _0x49017f;};'use strict';var _=require(_0x2ffc('0x0'));var util=require(_0x2ffc('0x1'));var logger=require(_0x2ffc('0x2'))(_0x2ffc('0x3'));var moment=require(_0x2ffc('0x4'));var BPromise=require(_0x2ffc('0x5'));var rp=require(_0x2ffc('0x6'));var htmlToText=require(_0x2ffc('0x7'));var fs=require('fs');var path=require(_0x2ffc('0x8'));var rimraf=require('rimraf');var config=require(_0x2ffc('0x9'));var attributes=require(_0x2ffc('0xa'));module[_0x2ffc('0xb')]=function(_0x442dfc,_0x25c876){return _0x442dfc[_0x2ffc('0xc')]('MailMessage',attributes,{'tableName':'mail_messages','paranoid':![],'indexes':[{'name':_0x2ffc('0xd'),'fields':['messageId']},{'name':_0x2ffc('0xe'),'fields':['plainBody',_0x2ffc('0xf')],'type':_0x2ffc('0x10')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x446121,_0x514d8d,_0x1d1c03){if(_0x446121[_0x2ffc('0x11')]){_0x446121['plainBody']=htmlToText[_0x2ffc('0x12')](_0x446121[_0x2ffc('0x11')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x1d1c03(null,_0x514d8d);},'afterCreate':function(_0x49c573,_0x5affb0,_0x2c062d){var _0x1cc490=_0x442dfc[_0x2ffc('0x13')];var _0x42a8d8=_0x49c573[_0x2ffc('0x14')]({'plain':!![]});if(_0x42a8d8[_0x2ffc('0x15')]['toLowerCase']()==='in'||_0x42a8d8[_0x2ffc('0x15')][_0x2ffc('0x16')]()===_0x2ffc('0x17')&&!_0x42a8d8[_0x2ffc('0x18')]&&!_[_0x2ffc('0x19')](_0x42a8d8[_0x2ffc('0x1a')])){_0x1cc490['MailInteraction'][_0x2ffc('0x1b')]({'where':{'id':_0x42a8d8[_0x2ffc('0x1c')]}})[_0x2ffc('0x1d')](function(_0x1e3776){if(_0x1e3776){_0x1e3776[_0x2ffc('0x1e')]({'lastMsgAt':_0x42a8d8[_0x2ffc('0x1f')],'lastMsgDirection':_0x42a8d8['direction']['toLowerCase']()});}})[_0x2ffc('0x20')](function(_0xad4883){console['error'](_0xad4883);});}_0x2c062d();}},'charset':'utf8mb4','collate':_0x2ffc('0x21')});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.rpc.js b/server/api/mailMessage/mailMessage.rpc.js index 43610f4..bf65f8b 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 _0x80ed=['create','options','raw','stringify','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./mailMessage.socket','register','request','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','CreateMailMessage','MailMessage'];(function(_0x3dbacb,_0x5eaf09){var _0x5eb0c5=function(_0x4b2919){while(--_0x4b2919){_0x3dbacb['push'](_0x3dbacb['shift']());}};_0x5eb0c5(++_0x5eaf09);}(_0x80ed,0x11c));var _0xd80e=function(_0x27886d,_0x58533a){_0x27886d=_0x27886d-0x0;var _0x509dc2=_0x80ed[_0x27886d];return _0x509dc2;};'use strict';var _=require(_0xd80e('0x0'));var util=require('util');var moment=require(_0xd80e('0x1'));var BPromise=require(_0xd80e('0x2'));var rs=require(_0xd80e('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd80e('0x4'))['db'];var utils=require(_0xd80e('0x5'));var logger=require(_0xd80e('0x6'))(_0xd80e('0x7'));var config=require('../../config/environment');var jayson=require(_0xd80e('0x8'));var client=jayson[_0xd80e('0x9')][_0xd80e('0xa')]({'port':0x232a});config['redis']=_[_0xd80e('0xb')](config[_0xd80e('0xc')],{'host':_0xd80e('0xd'),'port':0x18eb});var socket=require(_0xd80e('0xe'))(new Redis(config[_0xd80e('0xc')]));require(_0xd80e('0xf'))[_0xd80e('0x10')](socket);function respondWithRpcPromise(_0x2457f5,_0x68625,_0x7f93b4){return new BPromise(function(_0x4eee08,_0x450b44){return client[_0xd80e('0x11')](_0x2457f5,_0x7f93b4)[_0xd80e('0x12')](function(_0x30c9d0){logger[_0xd80e('0x13')](_0xd80e('0x14'),_0x68625,_0xd80e('0x15'));logger[_0xd80e('0x16')](_0xd80e('0x17'),_0x68625,'request\x20sent',JSON['stringify'](_0x30c9d0));if(_0x30c9d0['error']){if(_0x30c9d0['error'][_0xd80e('0x18')]===0x1f4){logger[_0xd80e('0x19')](_0xd80e('0x14'),_0x68625,_0x30c9d0[_0xd80e('0x19')][_0xd80e('0x1a')]);return _0x450b44(_0x30c9d0['error'][_0xd80e('0x1a')]);}logger[_0xd80e('0x19')](_0xd80e('0x14'),_0x68625,_0x30c9d0[_0xd80e('0x19')][_0xd80e('0x1a')]);return _0x4eee08(_0x30c9d0[_0xd80e('0x19')][_0xd80e('0x1a')]);}else{logger[_0xd80e('0x13')]('MailMessage,\x20%s,\x20%s',_0x68625,_0xd80e('0x15'));_0x4eee08(_0x30c9d0[_0xd80e('0x1b')][_0xd80e('0x1a')]);}})[_0xd80e('0x1c')](function(_0x593af6){logger[_0xd80e('0x19')](_0xd80e('0x14'),_0x68625,_0x593af6);_0x450b44(_0x593af6);});});}exports[_0xd80e('0x1d')]=function(_0x527237){var _0x41417d=this;return new Promise(function(_0x2ef8a1,_0x2765ea){return db[_0xd80e('0x1e')][_0xd80e('0x1f')](_0x527237['body'],{'raw':_0x527237['options']?_0x527237[_0xd80e('0x20')][_0xd80e('0x21')]===undefined?!![]:![]:!![]})[_0xd80e('0x12')](function(_0x2d46e7){logger[_0xd80e('0x13')](_0xd80e('0x1d'),_0x527237);logger[_0xd80e('0x16')]('CreateMailMessage',_0x527237,JSON[_0xd80e('0x22')](_0x2d46e7));_0x2ef8a1(_0x2d46e7);})[_0xd80e('0x1c')](function(_0x170109){logger['error'](_0xd80e('0x1d'),_0x170109[_0xd80e('0x1a')],_0x527237);_0x2765ea(_0x41417d[_0xd80e('0x19')](0x1f4,_0x170109['message']));});});}; \ No newline at end of file +var _0x8aad=['raw','catch','lodash','util','bluebird','ioredis','../../mysqldb','rpc','client','http','redis','localhost','socket.io-emitter','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','CreateMailMessage','MailMessage','create','options'];(function(_0x296e71,_0x500b29){var _0x15ccc0=function(_0x23d34b){while(--_0x23d34b){_0x296e71['push'](_0x296e71['shift']());}};_0x15ccc0(++_0x500b29);}(_0x8aad,0x146));var _0xd8aa=function(_0x553303,_0x4135c5){_0x553303=_0x553303-0x0;var _0x3669a5=_0x8aad[_0x553303];return _0x3669a5;};'use strict';var _=require(_0xd8aa('0x0'));var util=require(_0xd8aa('0x1'));var moment=require('moment');var BPromise=require(_0xd8aa('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd8aa('0x3'));var db=require(_0xd8aa('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xd8aa('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xd8aa('0x6')][_0xd8aa('0x7')]({'port':0x232a});config[_0xd8aa('0x8')]=_['defaults'](config[_0xd8aa('0x8')],{'host':_0xd8aa('0x9'),'port':0x18eb});var socket=require(_0xd8aa('0xa'))(new Redis(config[_0xd8aa('0x8')]));require('./mailMessage.socket')['register'](socket);function respondWithRpcPromise(_0x24f3f1,_0x1d4cf6,_0x152c0a){return new BPromise(function(_0x228fda,_0x2c7edb){return client['request'](_0x24f3f1,_0x152c0a)[_0xd8aa('0xb')](function(_0x1619c6){logger[_0xd8aa('0xc')](_0xd8aa('0xd'),_0x1d4cf6,_0xd8aa('0xe'));logger[_0xd8aa('0xf')](_0xd8aa('0x10'),_0x1d4cf6,_0xd8aa('0xe'),JSON[_0xd8aa('0x11')](_0x1619c6));if(_0x1619c6[_0xd8aa('0x12')]){if(_0x1619c6['error']['code']===0x1f4){logger[_0xd8aa('0x12')](_0xd8aa('0xd'),_0x1d4cf6,_0x1619c6[_0xd8aa('0x12')]['message']);return _0x2c7edb(_0x1619c6[_0xd8aa('0x12')][_0xd8aa('0x13')]);}logger[_0xd8aa('0x12')](_0xd8aa('0xd'),_0x1d4cf6,_0x1619c6['error'][_0xd8aa('0x13')]);return _0x228fda(_0x1619c6[_0xd8aa('0x12')]['message']);}else{logger[_0xd8aa('0xc')](_0xd8aa('0xd'),_0x1d4cf6,_0xd8aa('0xe'));_0x228fda(_0x1619c6[_0xd8aa('0x14')][_0xd8aa('0x13')]);}})['catch'](function(_0x43d3fa){logger[_0xd8aa('0x12')](_0xd8aa('0xd'),_0x1d4cf6,_0x43d3fa);_0x2c7edb(_0x43d3fa);});});}exports[_0xd8aa('0x15')]=function(_0x56936b){var _0x411b12=this;return new Promise(function(_0x3df281,_0x46d69b){return db[_0xd8aa('0x16')][_0xd8aa('0x17')](_0x56936b['body'],{'raw':_0x56936b[_0xd8aa('0x18')]?_0x56936b[_0xd8aa('0x18')][_0xd8aa('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0xa7cf85){logger[_0xd8aa('0xc')](_0xd8aa('0x15'),_0x56936b);logger[_0xd8aa('0xf')](_0xd8aa('0x15'),_0x56936b,JSON[_0xd8aa('0x11')](_0xa7cf85));_0x3df281(_0xa7cf85);})[_0xd8aa('0x1a')](function(_0x34d957){logger[_0xd8aa('0x12')](_0xd8aa('0x15'),_0x34d957[_0xd8aa('0x13')],_0x56936b);_0x46d69b(_0x411b12[_0xd8aa('0x12')](0x1f4,_0x34d957[_0xd8aa('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.socket.js b/server/api/mailMessage/mailMessage.socket.js index dba61c2..00bcff5 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 _0x2756=['length','./mailMessage.events','register'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0x2756,0x1ea));var _0x6275=function(_0x4c7935,_0x4a53fb){_0x4c7935=_0x4c7935-0x0;var _0x30651d=_0x2756[_0x4c7935];return _0x30651d;};'use strict';var MailMessageEvents=require(_0x6275('0x0'));var events=['save','remove','update'];function createListener(_0x54bfb2,_0x3b3e57){return function(_0x8a2d2a){_0x3b3e57['emit'](_0x54bfb2,_0x8a2d2a);};}function removeListener(_0x5024c0,_0x2f7511){return function(){MailMessageEvents['removeListener'](_0x5024c0,_0x2f7511);};}exports[_0x6275('0x1')]=function(_0x2043e7){for(var _0x3da4cd=0x0,_0x68166f=events[_0x6275('0x2')];_0x3da4cd<_0x68166f;_0x3da4cd++){var _0x25c318=events[_0x3da4cd];var _0x38d151=createListener('mailMessage:'+_0x25c318,_0x2043e7);MailMessageEvents['on'](_0x25c318,_0x38d151);}}; \ No newline at end of file +var _0x60ac=['mailMessage:','save','remove','update','emit','removeListener','register'];(function(_0x1fc3ca,_0x2b1de7){var _0xc5b490=function(_0x370bd1){while(--_0x370bd1){_0x1fc3ca['push'](_0x1fc3ca['shift']());}};_0xc5b490(++_0x2b1de7);}(_0x60ac,0xa2));var _0xc60a=function(_0x381e1d,_0x3afa2c){_0x381e1d=_0x381e1d-0x0;var _0x5f6a52=_0x60ac[_0x381e1d];return _0x5f6a52;};'use strict';var MailMessageEvents=require('./mailMessage.events');var events=[_0xc60a('0x0'),_0xc60a('0x1'),_0xc60a('0x2')];function createListener(_0x54a14c,_0x2166af){return function(_0x48a5cd){_0x2166af[_0xc60a('0x3')](_0x54a14c,_0x48a5cd);};}function removeListener(_0x3cd9db,_0x4bb263){return function(){MailMessageEvents[_0xc60a('0x4')](_0x3cd9db,_0x4bb263);};}exports[_0xc60a('0x5')]=function(_0x23f813){for(var _0x1e88ec=0x0,_0x1cf7cf=events['length'];_0x1e88ec<_0x1cf7cf;_0x1e88ec++){var _0x497391=events[_0x1e88ec];var _0x346d5d=createListener(_0xc60a('0x6')+_0x497391,_0x23f813);MailMessageEvents['on'](_0x497391,_0x346d5d);}}; \ No newline at end of file diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index f4cb101..ce60a3c 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 _0x5219=['addAgents','put','update','delete','removeTeams','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','/:id/members','/:id/teams','getTeams','/:id/users','getAgents','create','post','addTeams'];(function(_0x5cb265,_0x59a65b){var _0x594bc6=function(_0x580cae){while(--_0x580cae){_0x5cb265['push'](_0x5cb265['shift']());}};_0x594bc6(++_0x59a65b);}(_0x5219,0x7a));var _0x9521=function(_0x4fff63,_0x3155dc){_0x4fff63=_0x4fff63-0x0;var _0x3e5eb6=_0x5219[_0x4fff63];return _0x3e5eb6;};'use strict';var multer=require(_0x9521('0x0'));var util=require(_0x9521('0x1'));var path=require(_0x9521('0x2'));var timeout=require('connect-timeout');var express=require(_0x9521('0x3'));var router=express[_0x9521('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x9521('0x5'));var interaction=require(_0x9521('0x6'));var config=require(_0x9521('0x7'));var controller=require(_0x9521('0x8'));router[_0x9521('0x9')]('/',auth[_0x9521('0xa')](),controller[_0x9521('0xb')]);router[_0x9521('0x9')](_0x9521('0xc'),auth['isAuthenticated'](),controller[_0x9521('0xd')]);router[_0x9521('0x9')](_0x9521('0xe'),auth[_0x9521('0xa')](),controller['show']);router[_0x9521('0x9')](_0x9521('0xf'),auth[_0x9521('0xa')](),controller['getMembers']);router[_0x9521('0x9')](_0x9521('0x10'),auth[_0x9521('0xa')](),controller[_0x9521('0x11')]);router['get'](_0x9521('0x12'),auth[_0x9521('0xa')](),controller[_0x9521('0x13')]);router['post']('/',auth[_0x9521('0xa')](),controller[_0x9521('0x14')]);router[_0x9521('0x15')](_0x9521('0x10'),auth['isAuthenticated'](),controller[_0x9521('0x16')]);router['post'](_0x9521('0x12'),auth[_0x9521('0xa')](),controller[_0x9521('0x17')]);router[_0x9521('0x18')](_0x9521('0xe'),auth[_0x9521('0xa')](),controller[_0x9521('0x19')]);router[_0x9521('0x1a')](_0x9521('0xe'),auth[_0x9521('0xa')](),controller['destroy']);router[_0x9521('0x1a')](_0x9521('0x10'),auth[_0x9521('0xa')](),controller[_0x9521('0x1b')]);router[_0x9521('0x1a')](_0x9521('0x12'),auth[_0x9521('0xa')](),controller['removeAgents']);module[_0x9521('0x1c')]=router; \ No newline at end of file +var _0xbbbe=['getMembers','/:id/teams','getTeams','get','post','create','/:id/users','addAgents','put','/:id','update','delete','destroy','removeTeams','removeAgents','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','isAuthenticated','index','describe','show','/:id/members'];(function(_0x4efc43,_0x438b37){var _0x139e2f=function(_0x30ef16){while(--_0x30ef16){_0x4efc43['push'](_0x4efc43['shift']());}};_0x139e2f(++_0x438b37);}(_0xbbbe,0x132));var _0xebbb=function(_0x3de336,_0x2bab7f){_0x3de336=_0x3de336-0x0;var _0x1ae0bd=_0xbbbe[_0x3de336];return _0x1ae0bd;};'use strict';var multer=require(_0xebbb('0x0'));var util=require(_0xebbb('0x1'));var path=require(_0xebbb('0x2'));var timeout=require(_0xebbb('0x3'));var express=require('express');var router=express[_0xebbb('0x4')]();var fs_extra=require(_0xebbb('0x5'));var auth=require(_0xebbb('0x6'));var interaction=require(_0xebbb('0x7'));var config=require('../../config/environment');var controller=require('./mailQueue.controller');router['get']('/',auth[_0xebbb('0x8')](),controller[_0xebbb('0x9')]);router['get']('/describe',auth[_0xebbb('0x8')](),controller[_0xebbb('0xa')]);router['get']('/:id',auth[_0xebbb('0x8')](),controller[_0xebbb('0xb')]);router['get'](_0xebbb('0xc'),auth[_0xebbb('0x8')](),controller[_0xebbb('0xd')]);router['get'](_0xebbb('0xe'),auth[_0xebbb('0x8')](),controller[_0xebbb('0xf')]);router[_0xebbb('0x10')]('/:id/users',auth['isAuthenticated'](),controller['getAgents']);router[_0xebbb('0x11')]('/',auth['isAuthenticated'](),controller[_0xebbb('0x12')]);router[_0xebbb('0x11')]('/:id/teams',auth[_0xebbb('0x8')](),controller['addTeams']);router[_0xebbb('0x11')](_0xebbb('0x13'),auth[_0xebbb('0x8')](),controller[_0xebbb('0x14')]);router[_0xebbb('0x15')](_0xebbb('0x16'),auth[_0xebbb('0x8')](),controller[_0xebbb('0x17')]);router[_0xebbb('0x18')](_0xebbb('0x16'),auth[_0xebbb('0x8')](),controller[_0xebbb('0x19')]);router[_0xebbb('0x18')](_0xebbb('0xe'),auth[_0xebbb('0x8')](),controller[_0xebbb('0x1a')]);router[_0xebbb('0x18')](_0xebbb('0x13'),auth[_0xebbb('0x8')](),controller[_0xebbb('0x1b')]);module[_0xebbb('0x1c')]=router; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.attributes.js b/server/api/mailQueue/mailQueue.attributes.js index dae5d46..aae3334 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 _0xf193=['ENUM','rrmemory','beepall','roundrobin','sequelize','STRING','INTEGER'];(function(_0x1cc6c3,_0x156eee){var _0xd39a27=function(_0x5063dc){while(--_0x5063dc){_0x1cc6c3['push'](_0x1cc6c3['shift']());}};_0xd39a27(++_0x156eee);}(_0xf193,0xe4));var _0x3f19=function(_0x25359b,_0x21a796){_0x25359b=_0x25359b-0x0;var _0x28dc83=_0xf193[_0x25359b];return _0x28dc83;};'use strict';var Sequelize=require(_0x3f19('0x0'));module['exports']={'name':{'type':Sequelize[_0x3f19('0x1')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x3f19('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x3f19('0x3')](_0x3f19('0x4'),_0x3f19('0x5'),_0x3f19('0x6'))}}; \ No newline at end of file +var _0xd812=['roundrobin','sequelize','exports','name','STRING','INTEGER','ENUM'];(function(_0x2b9b7f,_0x4d47df){var _0x4ed19a=function(_0x72b5ff){while(--_0x72b5ff){_0x2b9b7f['push'](_0x2b9b7f['shift']());}};_0x4ed19a(++_0x4d47df);}(_0xd812,0xf6));var _0x2d81=function(_0x44039a,_0x2ac8a8){_0x44039a=_0x44039a-0x0;var _0x525de5=_0xd812[_0x44039a];return _0x525de5;};'use strict';var Sequelize=require(_0x2d81('0x0'));module[_0x2d81('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x2d81('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x2d81('0x3')]},'timeout':{'type':Sequelize[_0x2d81('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x2d81('0x5')]('rrmemory','beepall',_0x2d81('0x6'))}}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.controller.js b/server/api/mailQueue/mailQueue.controller.js index a3ee521..d85cb42 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 _0x22d3=['limit','Content-Range','json','apply','reject','save','update','destroy','then','MailQueues','UserProfileResource','error','stack','name','index','map','MailQueue','type','model','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','create','body','user','get','role','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','hasOwnProperty','order','UserMailQueue','User','findAndCountAll','UserId','agent','mailPause','updatedAt','createdAt','%s/%s','SIP','getTeams','Team','addTeams','Agents','online','interface','flatMap','transaction','each','findOrCreate','forEach','emit','userMailQueue:save','removeTeams','ids','field','tq.TeamId','from','team_has_mail_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','ut.UserId\x20=\x20?','sequelize','SELECT','every','TeamId','includes','all','union','compact','addAgents','spread','removeAgents','isArray','userMailQueue:remove','getAgents','findOne','eml-format','rimraf','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','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./mailQueue.socket','sendStatus','status','end','undefined','count','offset'];(function(_0x38a184,_0x6977d7){var _0x8c1f68=function(_0x9a43fa){while(--_0x9a43fa){_0x38a184['push'](_0x38a184['shift']());}};_0x8c1f68(++_0x6977d7);}(_0x22d3,0xf8));var _0x322d=function(_0x42ca15,_0x193ccb){_0x42ca15=_0x42ca15-0x0;var _0x1c6ded=_0x22d3[_0x42ca15];return _0x1c6ded;};'use strict';var emlformat=require(_0x322d('0x0'));var rimraf=require(_0x322d('0x1'));var zipdir=require(_0x322d('0x2'));var jsonpatch=require(_0x322d('0x3'));var rp=require(_0x322d('0x4'));var moment=require(_0x322d('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x322d('0x6'));var util=require(_0x322d('0x7'));var path=require(_0x322d('0x8'));var sox=require(_0x322d('0x9'));var csv=require('to-csv');var ejs=require(_0x322d('0xa'));var fs=require('fs');var fs_extra=require(_0x322d('0xb'));var _=require(_0x322d('0xc'));var squel=require(_0x322d('0xd'));var crypto=require(_0x322d('0xe'));var jsforce=require(_0x322d('0xf'));var deskjs=require(_0x322d('0x10'));var toCsv=require(_0x322d('0x11'));var querystring=require(_0x322d('0x12'));var Papa=require(_0x322d('0x13'));var Redis=require(_0x322d('0x14'));var authService=require('../../components/auth/service');var qs=require(_0x322d('0x15'));var as=require(_0x322d('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x322d('0x17'))(_0x322d('0x18'));var utils=require(_0x322d('0x19'));var config=require(_0x322d('0x1a'));var licenseUtil=require(_0x322d('0x1b'));var db=require(_0x322d('0x1c'))['db'];config['redis']=_[_0x322d('0x1d')](config[_0x322d('0x1e')],{'host':_0x322d('0x1f'),'port':0x18eb});var socket=require(_0x322d('0x20'))(new Redis(config['redis']));require(_0x322d('0x21'))['register'](socket);function respondWithStatusCode(_0xa5a8e4,_0x48bce0){_0x48bce0=_0x48bce0||0xcc;return function(_0x429dd4){if(_0x429dd4){return _0xa5a8e4[_0x322d('0x22')](_0x48bce0);}return _0xa5a8e4[_0x322d('0x23')](_0x48bce0)[_0x322d('0x24')]();};}function respondWithResult(_0x33140d,_0xb1ead4){_0xb1ead4=_0xb1ead4||0xc8;return function(_0x10d6a8){if(_0x10d6a8){return _0x33140d[_0x322d('0x23')](_0xb1ead4)['json'](_0x10d6a8);}};}function respondWithFilteredResult(_0x54725b,_0x357336){return function(_0x30a77a){if(_0x30a77a){var _0x5af47d=typeof _0x357336['offset']===_0x322d('0x25')&&typeof _0x357336['limit']===_0x322d('0x25');var _0x449b99=_0x30a77a[_0x322d('0x26')];var _0x2ace02=_0x5af47d?0x0:_0x357336[_0x322d('0x27')];var _0x367c4e=_0x5af47d?_0x30a77a[_0x322d('0x26')]:_0x357336[_0x322d('0x27')]+_0x357336[_0x322d('0x28')];var _0x2e2572;if(_0x367c4e>=_0x449b99){_0x367c4e=_0x449b99;_0x2e2572=0xc8;}else{_0x2e2572=0xce;}_0x54725b[_0x322d('0x23')](_0x2e2572);return _0x54725b['set'](_0x322d('0x29'),_0x2ace02+'-'+_0x367c4e+'/'+_0x449b99)[_0x322d('0x2a')](_0x30a77a);}return null;};}function patchUpdates(_0x39d5be){return function(_0x2dc114){try{jsonpatch[_0x322d('0x2b')](_0x2dc114,_0x39d5be,!![]);}catch(_0x367a19){return BPromise[_0x322d('0x2c')](_0x367a19);}return _0x2dc114[_0x322d('0x2d')]();};}function saveUpdates(_0x25c058,_0x36e003){return function(_0x270c91){if(_0x270c91){return _0x270c91[_0x322d('0x2e')](_0x25c058)['then'](function(_0x1bb912){return _0x1bb912;});}return null;};}function removeEntity(_0x4012c7,_0x506d7f){return function(_0x4a2947){if(_0x4a2947){return _0x4a2947[_0x322d('0x2f')]()[_0x322d('0x30')](function(){var _0x1ad384=_0x4a2947['get']({'plain':!![]});var _0xb87059=_0x322d('0x31');return db[_0x322d('0x32')][_0x322d('0x2f')]({'where':{'type':_0xb87059,'resourceId':_0x1ad384['id']}})[_0x322d('0x30')](function(){return _0x4a2947;});})[_0x322d('0x30')](function(){_0x4012c7['status'](0xcc)[_0x322d('0x24')]();});}};}function handleEntityNotFound(_0x159138,_0x42cd92){return function(_0x17d2d3){if(!_0x17d2d3){_0x159138[_0x322d('0x22')](0x194);}return _0x17d2d3;};}function handleError(_0x27b5d8,_0x560dee){_0x560dee=_0x560dee||0x1f4;return function(_0x340f64){logger[_0x322d('0x33')](_0x340f64[_0x322d('0x34')]);if(_0x340f64[_0x322d('0x35')]){delete _0x340f64[_0x322d('0x35')];}_0x27b5d8[_0x322d('0x23')](_0x560dee)['send'](_0x340f64);};}exports[_0x322d('0x36')]=function(_0x487a2e,_0x24af74){var _0x5a75a1={},_0x34fc88={},_0x54d2f9={'count':0x0,'rows':[]};var _0x530aa5=_[_0x322d('0x37')](db[_0x322d('0x38')]['rawAttributes'],function(_0x1f3176){return{'name':_0x1f3176['fieldName'],'type':_0x1f3176[_0x322d('0x39')]['key']};});_0x34fc88[_0x322d('0x3a')]=_['map'](_0x530aa5,_0x322d('0x35'));_0x34fc88[_0x322d('0x3b')]=_[_0x322d('0x3c')](_0x487a2e['query']);_0x34fc88[_0x322d('0x3d')]=_[_0x322d('0x3e')](_0x34fc88['model'],_0x34fc88['query']);_0x5a75a1[_0x322d('0x3f')]=_[_0x322d('0x3e')](_0x34fc88['model'],qs['fields'](_0x487a2e['query'][_0x322d('0x40')]));_0x5a75a1[_0x322d('0x3f')]=_0x5a75a1[_0x322d('0x3f')][_0x322d('0x41')]?_0x5a75a1[_0x322d('0x3f')]:_0x34fc88[_0x322d('0x3a')];if(!_0x487a2e[_0x322d('0x3b')]['hasOwnProperty'](_0x322d('0x42'))){_0x5a75a1[_0x322d('0x28')]=qs['limit'](_0x487a2e[_0x322d('0x3b')]['limit']);_0x5a75a1[_0x322d('0x27')]=qs['offset'](_0x487a2e[_0x322d('0x3b')][_0x322d('0x27')]);}_0x5a75a1['order']=qs[_0x322d('0x43')](_0x487a2e['query'][_0x322d('0x43')]);_0x5a75a1[_0x322d('0x44')]=qs[_0x322d('0x3d')](_[_0x322d('0x45')](_0x487a2e[_0x322d('0x3b')],_0x34fc88[_0x322d('0x3d')]),_0x530aa5);if(_0x487a2e[_0x322d('0x3b')][_0x322d('0x46')]){_0x5a75a1['where']=_['merge'](_0x5a75a1[_0x322d('0x44')],{'$or':_[_0x322d('0x37')](_0x530aa5,function(_0x1a6cca){if(_0x1a6cca[_0x322d('0x39')]!==_0x322d('0x47')){var _0x3914ef={};_0x3914ef[_0x1a6cca[_0x322d('0x35')]]={'$like':'%'+_0x487a2e[_0x322d('0x3b')]['filter']+'%'};return _0x3914ef;}})});}_0x5a75a1=_[_0x322d('0x48')]({},_0x5a75a1,_0x487a2e[_0x322d('0x49')]);var _0x58b070={'where':_0x5a75a1['where']};return db['MailQueue'][_0x322d('0x26')](_0x58b070)['then'](function(_0x43655e){_0x54d2f9['count']=_0x43655e;if(_0x487a2e['query'][_0x322d('0x4a')]){_0x5a75a1[_0x322d('0x4b')]=[{'all':!![]}];}return db[_0x322d('0x38')][_0x322d('0x4c')](_0x5a75a1);})[_0x322d('0x30')](function(_0x446158){_0x54d2f9[_0x322d('0x4d')]=_0x446158;return _0x54d2f9;})['then'](respondWithFilteredResult(_0x24af74,_0x5a75a1))[_0x322d('0x4e')](handleError(_0x24af74,null));};exports[_0x322d('0x4f')]=function(_0x4775ed,_0x2a6c35){var _0x1ef916={'raw':!![],'where':{'id':_0x4775ed[_0x322d('0x50')]['id']}},_0x3ff11c={};_0x3ff11c[_0x322d('0x3a')]=_[_0x322d('0x3c')](db[_0x322d('0x38')][_0x322d('0x51')]);_0x3ff11c['query']=_[_0x322d('0x3c')](_0x4775ed['query']);_0x3ff11c[_0x322d('0x3d')]=_[_0x322d('0x3e')](_0x3ff11c['model'],_0x3ff11c[_0x322d('0x3b')]);_0x1ef916['attributes']=_[_0x322d('0x3e')](_0x3ff11c[_0x322d('0x3a')],qs['fields'](_0x4775ed[_0x322d('0x3b')][_0x322d('0x40')]));_0x1ef916['attributes']=_0x1ef916[_0x322d('0x3f')][_0x322d('0x41')]?_0x1ef916[_0x322d('0x3f')]:_0x3ff11c['model'];if(_0x4775ed[_0x322d('0x3b')][_0x322d('0x4a')]){_0x1ef916[_0x322d('0x4b')]=[{'all':!![]}];}_0x1ef916=_[_0x322d('0x48')]({},_0x1ef916,_0x4775ed[_0x322d('0x49')]);return db['MailQueue']['find'](_0x1ef916)[_0x322d('0x30')](handleEntityNotFound(_0x2a6c35,null))[_0x322d('0x30')](respondWithResult(_0x2a6c35,null))['catch'](handleError(_0x2a6c35,null));};exports[_0x322d('0x52')]=function(_0x17e173,_0xb449e7){return db[_0x322d('0x38')][_0x322d('0x52')](_0x17e173[_0x322d('0x53')],{})[_0x322d('0x30')](function(_0x1ee377){var _0x405564=_0x17e173[_0x322d('0x54')][_0x322d('0x55')]({'plain':!![]});if(!_0x405564)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x405564[_0x322d('0x56')]==='user'){var _0x429c83=_0x1ee377[_0x322d('0x55')]({'plain':!![]});var _0xf9b65c=_0x322d('0x31');return db['UserProfileSection'][_0x322d('0x57')]({'where':{'name':_0xf9b65c,'userProfileId':_0x405564[_0x322d('0x58')]},'raw':!![]})[_0x322d('0x30')](function(_0x5682df){if(_0x5682df&&_0x5682df[_0x322d('0x59')]===0x0){return db[_0x322d('0x32')][_0x322d('0x52')]({'name':_0x429c83['name'],'resourceId':_0x429c83['id'],'type':_0x5682df[_0x322d('0x35')],'sectionId':_0x5682df['id']},{})[_0x322d('0x30')](function(){return _0x1ee377;});}else{return _0x1ee377;}})[_0x322d('0x4e')](function(_0x13ea4b){logger[_0x322d('0x33')](_0x322d('0x5a'),_0x13ea4b);throw _0x13ea4b;});}return _0x1ee377;})['then'](respondWithResult(_0xb449e7,0xc9))[_0x322d('0x4e')](handleError(_0xb449e7,null));};exports[_0x322d('0x2e')]=function(_0x8dae85,_0x4f0cfa){if(_0x8dae85[_0x322d('0x53')]['id']){delete _0x8dae85[_0x322d('0x53')]['id'];}return db[_0x322d('0x38')][_0x322d('0x57')]({'where':{'id':_0x8dae85['params']['id']}})[_0x322d('0x30')](handleEntityNotFound(_0x4f0cfa,null))[_0x322d('0x30')](saveUpdates(_0x8dae85['body'],null))[_0x322d('0x30')](respondWithResult(_0x4f0cfa,null))[_0x322d('0x4e')](handleError(_0x4f0cfa,null));};exports[_0x322d('0x2f')]=function(_0x4036ce,_0x4d0f2d){return db[_0x322d('0x38')][_0x322d('0x57')]({'where':{'id':_0x4036ce[_0x322d('0x50')]['id']}})[_0x322d('0x30')](handleEntityNotFound(_0x4d0f2d,null))[_0x322d('0x30')](removeEntity(_0x4d0f2d,null))[_0x322d('0x4e')](handleError(_0x4d0f2d,null));};exports[_0x322d('0x5b')]=function(_0xa8dba9,_0x4f54a9){return db[_0x322d('0x38')][_0x322d('0x5b')]()[_0x322d('0x30')](respondWithResult(_0x4f54a9,null))[_0x322d('0x4e')](handleError(_0x4f54a9,null));};exports[_0x322d('0x5c')]=function(_0x4c5f43,_0x33913b,_0x511041){var _0x1679d6={'raw':!![],'where':{}},_0x19b37f={},_0x4eced9;return db[_0x322d('0x38')]['findOne']({'where':{'id':_0x4c5f43[_0x322d('0x50')]['id']}})[_0x322d('0x30')](handleEntityNotFound(_0x33913b,null))[_0x322d('0x30')](function(_0xcaa86e){if(_0xcaa86e){_0x4eced9=_0xcaa86e['get']({'plain':!![]});_0x19b37f['model']=_['keys'](db['UserMailQueue'][_0x322d('0x51')]);_0x19b37f[_0x322d('0x3b')]=_[_0x322d('0x3c')](_0x4c5f43[_0x322d('0x3b')]);_0x19b37f[_0x322d('0x3d')]=_[_0x322d('0x3e')](_0x19b37f['model'],_0x19b37f['query']);_0x1679d6[_0x322d('0x3f')]=_[_0x322d('0x3e')](_0x19b37f[_0x322d('0x3a')],qs[_0x322d('0x40')](_0x4c5f43[_0x322d('0x3b')][_0x322d('0x40')]));_0x1679d6[_0x322d('0x3f')]=_0x1679d6[_0x322d('0x3f')][_0x322d('0x41')]?_0x1679d6[_0x322d('0x3f')]:_0x19b37f['model'];if(!_0x4c5f43[_0x322d('0x3b')][_0x322d('0x5d')](_0x322d('0x42'))){_0x1679d6[_0x322d('0x28')]=qs['limit'](_0x4c5f43['query']['limit']);_0x1679d6[_0x322d('0x27')]=qs['offset'](_0x4c5f43[_0x322d('0x3b')][_0x322d('0x27')]);}_0x1679d6[_0x322d('0x5e')]=qs['sort'](_0x4c5f43[_0x322d('0x3b')][_0x322d('0x43')]);_0x1679d6['where']=qs[_0x322d('0x3d')](_[_0x322d('0x45')](_0x4c5f43[_0x322d('0x3b')],_0x19b37f['filters']));_0x1679d6[_0x322d('0x44')]['MailQueueId']=_0xcaa86e['id'];if(_0x4c5f43[_0x322d('0x3b')][_0x322d('0x46')]){_0x1679d6['where']=_['merge'](_0x1679d6[_0x322d('0x44')],{'$or':_[_0x322d('0x37')](_0x1679d6[_0x322d('0x3f')],function(_0x2d091b){var _0x421612={};_0x421612[_0x2d091b]={'$like':'%'+_0x4c5f43[_0x322d('0x3b')][_0x322d('0x46')]+'%'};return _0x421612;})});}_0x1679d6=_['merge']({},_0x1679d6,_0x4c5f43['options']);return db[_0x322d('0x5f')][_0x322d('0x4c')](_0x1679d6);}})[_0x322d('0x30')](function(_0x287683){if(_0x287683){return db[_0x322d('0x60')][_0x322d('0x61')]({'where':{'id':_[_0x322d('0x37')](_0x287683,_0x322d('0x62')),'role':_0x322d('0x63')},'attributes':['id',_0x322d('0x35'),_0x322d('0x64'),_0x322d('0x65'),_0x322d('0x66')]});}})[_0x322d('0x30')](function(_0x3cab51){if(_0x3cab51){return{'count':_0x3cab51[_0x322d('0x26')],'rows':_['map'](_0x3cab51[_0x322d('0x4d')],function(_0x4c1dbc){return{'membername':_0x4c1dbc[_0x322d('0x35')],'UserId':_0x4c1dbc['id'],'queue_name':_0x4eced9[_0x322d('0x35')],'MailQueueId':_0x4eced9['id'],'interface':util['format'](_0x322d('0x67'),_0x322d('0x68'),_0x4c1dbc[_0x322d('0x35')]),'penalty':0x0,'paused':_0x4c1dbc[_0x322d('0x64')],'createdAt':_0x4c1dbc[_0x322d('0x66')],'updatedAt':_0x4c1dbc[_0x322d('0x65')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x322d('0x30')](respondWithFilteredResult(_0x33913b,_0x1679d6))[_0x322d('0x4e')](handleError(_0x33913b,null));};exports[_0x322d('0x69')]=function(_0x83c7b3,_0x3f5cfd,_0x29a273){var _0x21b983={};var _0x1fd017={};var _0x1afcb2;var _0x54fa17;return db[_0x322d('0x38')]['findOne']({'where':{'id':_0x83c7b3[_0x322d('0x50')]['id']}})['then'](handleEntityNotFound(_0x3f5cfd,null))[_0x322d('0x30')](function(_0x145a09){if(_0x145a09){_0x1afcb2=_0x145a09;_0x1fd017[_0x322d('0x3a')]=_['keys'](db[_0x322d('0x6a')][_0x322d('0x51')]);_0x1fd017[_0x322d('0x3b')]=_[_0x322d('0x3c')](_0x83c7b3[_0x322d('0x3b')]);_0x1fd017[_0x322d('0x3d')]=_[_0x322d('0x3e')](_0x1fd017['model'],_0x1fd017[_0x322d('0x3b')]);_0x21b983[_0x322d('0x3f')]=_[_0x322d('0x3e')](_0x1fd017['model'],qs['fields'](_0x83c7b3[_0x322d('0x3b')][_0x322d('0x40')]));_0x21b983[_0x322d('0x3f')]=_0x21b983['attributes']['length']?_0x21b983[_0x322d('0x3f')]:_0x1fd017[_0x322d('0x3a')];_0x21b983[_0x322d('0x5e')]=qs['sort'](_0x83c7b3[_0x322d('0x3b')][_0x322d('0x43')]);_0x21b983[_0x322d('0x44')]=qs['filters'](_['pick'](_0x83c7b3['query'],_0x1fd017[_0x322d('0x3d')]));if(_0x83c7b3[_0x322d('0x3b')][_0x322d('0x46')]){_0x21b983[_0x322d('0x44')]=_[_0x322d('0x48')](_0x21b983[_0x322d('0x44')],{'$or':_[_0x322d('0x37')](_0x21b983[_0x322d('0x3f')],function(_0x47ce4e){var _0x3e937f={};_0x3e937f[_0x47ce4e]={'$like':'%'+_0x83c7b3['query']['filter']+'%'};return _0x3e937f;})});}_0x21b983=_[_0x322d('0x48')]({},_0x21b983,_0x83c7b3['options']);return _0x1afcb2[_0x322d('0x69')](_0x21b983);}})['then'](function(_0x237f2e){if(_0x237f2e){_0x54fa17=_0x237f2e[_0x322d('0x41')];if(!_0x83c7b3[_0x322d('0x3b')][_0x322d('0x5d')](_0x322d('0x42'))){_0x21b983[_0x322d('0x28')]=qs['limit'](_0x83c7b3[_0x322d('0x3b')][_0x322d('0x28')]);_0x21b983['offset']=qs[_0x322d('0x27')](_0x83c7b3['query']['offset']);}return _0x1afcb2[_0x322d('0x69')](_0x21b983);}})[_0x322d('0x30')](function(_0x3fe7b9){if(_0x3fe7b9){return _0x3fe7b9?{'count':_0x54fa17,'rows':_0x3fe7b9}:null;}})['then'](respondWithResult(_0x3f5cfd,null))[_0x322d('0x4e')](handleError(_0x3f5cfd,null));};exports[_0x322d('0x6b')]=function(_0x141692,_0x488296,_0x2972cc){var _0x2722b4=_0x141692[_0x322d('0x53')]['ids'];return db[_0x322d('0x6a')][_0x322d('0x4c')]({'where':{'id':_0x2722b4},'attributes':['id'],'include':[{'model':db[_0x322d('0x60')],'as':_0x322d('0x6c'),'attributes':['id',_0x322d('0x35'),_0x322d('0x6d'),'voicePause',_0x322d('0x6e')],'raw':!![]}]})[_0x322d('0x30')](function(_0x3f4a0c){if(_0x3f4a0c){var _0x59d7fd=_[_0x322d('0x6f')](_0x3f4a0c,function(_0x1e7d6d){var _0x14a76f=_0x1e7d6d['get']({'plain':!![]});return _0x14a76f[_0x322d('0x6c')];});return db['MailQueue'][_0x322d('0x57')]({'where':{'id':_0x141692[_0x322d('0x50')]['id']}})['then'](function(_0x140194){return db['sequelize'][_0x322d('0x70')](function(_0x227348){return _0x140194[_0x322d('0x6b')](_0x2722b4,{'transaction':_0x227348})[_0x322d('0x30')](function(){return BPromise[_0x322d('0x71')](_0x59d7fd,function(_0x27d117){return db[_0x322d('0x5f')][_0x322d('0x72')]({'where':{'UserId':_0x27d117['id'],'MailQueueId':_0x141692[_0x322d('0x50')]['id']},'transaction':_0x227348});});})[_0x322d('0x30')](function(){_0x59d7fd[_0x322d('0x73')](function(_0x2bbc08){socket[_0x322d('0x74')](_0x322d('0x75'),{'UserId':_0x2bbc08['id'],'MailQueueId':_0x140194['id']});});});});});}})[_0x322d('0x30')](respondWithStatusCode(_0x488296,null))[_0x322d('0x4e')](handleError(_0x488296,null));};exports[_0x322d('0x76')]=function(_0x5a8e05,_0x287340,_0x3a7ca2){return db[_0x322d('0x6a')][_0x322d('0x4c')]({'where':{'id':_0x5a8e05[_0x322d('0x3b')][_0x322d('0x77')]},'attributes':['id'],'include':[{'model':db[_0x322d('0x60')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x322d('0x30')](handleEntityNotFound(_0x287340,null))[_0x322d('0x30')](function(_0x5be512){var _0x38806a=_[_0x322d('0x37')](_0x5be512,'id');var _0x472042=[];var _0x48a952=[];var _0x448e92=squel['select']();_0x448e92[_0x322d('0x78')](_0x322d('0x79'))[_0x322d('0x7a')](_0x322d('0x7b'),'tq')[_0x322d('0x7c')](_0x322d('0x7d'),'ut',_0x322d('0x7e'))[_0x322d('0x44')](_0x322d('0x7f'),_0x5a8e05[_0x322d('0x50')]['id']);for(var _0x5e2bb0=0x0;_0x5e2bb0<_0x5be512[_0x322d('0x41')];_0x5e2bb0+=0x1){let _0x41b9dc=_0x5be512[_0x5e2bb0];for(var _0x1a78a3=0x0;_0x1a78a3<_0x41b9dc[_0x322d('0x6c')]['length'];_0x1a78a3+=0x1){let _0x1834e4=_0x41b9dc[_0x322d('0x6c')][_0x1a78a3];var _0x27ea8f=_0x448e92['clone']();_0x27ea8f['where'](_0x322d('0x80'),_0x1834e4['id']);_0x48a952['push'](db[_0x322d('0x81')][_0x322d('0x3b')](_0x27ea8f['toString'](),{'type':db[_0x322d('0x81')]['QueryTypes'][_0x322d('0x82')]})['then'](function(_0xfd302c){if(_0xfd302c[_0x322d('0x41')]===0x1){return _0x1834e4['id'];}else{var _0x102141=_[_0x322d('0x83')](_[_0x322d('0x37')](_0xfd302c,_0x322d('0x84')),function(_0x3c772c){return _[_0x322d('0x85')](_0x38806a,_0x3c772c);});if(_0x102141){return _0x1834e4['id'];}}}));}}return BPromise[_0x322d('0x86')](_0x48a952)[_0x322d('0x30')](function(_0x593cda){_0x472042=_(_0x472042)[_0x322d('0x87')](_0x593cda)[_0x322d('0x88')]()['value']();return db[_0x322d('0x38')][_0x322d('0x57')]({'where':{'id':_0x5a8e05['params']['id']}})[_0x322d('0x30')](function(_0x14b22e){return db[_0x322d('0x81')][_0x322d('0x70')](function(_0x462aa0){return _0x14b22e[_0x322d('0x76')](_0x5a8e05[_0x322d('0x3b')][_0x322d('0x77')],{'transaction':_0x462aa0})[_0x322d('0x30')](function(){if(!_['isEmpty'](_0x472042)){return _0x14b22e['removeAgents'](_0x472042,{'transaction':_0x462aa0});}})[_0x322d('0x30')](function(){_0x472042[_0x322d('0x73')](function(_0x21b96a){socket[_0x322d('0x74')]('userMailQueue:remove',{'UserId':_0x21b96a,'MailQueueId':_0x14b22e['id']});});});});});});})[_0x322d('0x30')](respondWithStatusCode(_0x287340,null))[_0x322d('0x4e')](handleError(_0x287340,null));};exports[_0x322d('0x89')]=function(_0x53facf,_0x221c74,_0x1cc840){return db[_0x322d('0x38')][_0x322d('0x57')]({'where':{'id':_0x53facf[_0x322d('0x50')]['id']}})[_0x322d('0x30')](handleEntityNotFound(_0x221c74,null))['then'](function(_0x34e005){if(_0x34e005){return _0x34e005[_0x322d('0x89')](_0x53facf[_0x322d('0x53')][_0x322d('0x77')],_['omit'](_0x53facf[_0x322d('0x53')],['ids','id'])||{})[_0x322d('0x8a')](function(_0x5d1496){for(var _0x56378e=0x0;_0x56378e<_0x53facf['body']['ids'][_0x322d('0x41')];_0x56378e+=0x1){socket['emit'](_0x322d('0x75'),{'UserId':Number(_0x53facf[_0x322d('0x53')][_0x322d('0x77')][_0x56378e]),'MailQueueId':Number(_0x53facf[_0x322d('0x50')]['id'])});}return _0x5d1496;});}})[_0x322d('0x30')](respondWithResult(_0x221c74,null))[_0x322d('0x4e')](handleError(_0x221c74,null));};exports[_0x322d('0x8b')]=function(_0xc8a2a5,_0x24d19c,_0x5126db){return db[_0x322d('0x38')][_0x322d('0x57')]({'where':{'id':_0xc8a2a5[_0x322d('0x50')]['id']}})[_0x322d('0x30')](handleEntityNotFound(_0x24d19c,null))['then'](function(_0x4a1e1c){if(_0x4a1e1c){return _0x4a1e1c[_0x322d('0x8b')](_0xc8a2a5['query'][_0x322d('0x77')])[_0x322d('0x30')](function(){if(_[_0x322d('0x8c')](_0xc8a2a5[_0x322d('0x3b')][_0x322d('0x77')])){for(var _0x3261a2=0x0;_0x3261a2<_0xc8a2a5[_0x322d('0x3b')][_0x322d('0x77')][_0x322d('0x41')];_0x3261a2+=0x1){socket[_0x322d('0x74')](_0x322d('0x8d'),{'UserId':Number(_0xc8a2a5[_0x322d('0x3b')][_0x322d('0x77')][_0x3261a2]),'MailQueueId':Number(_0xc8a2a5[_0x322d('0x50')]['id'])});}}else{socket['emit'](_0x322d('0x8d'),{'UserId':Number(_0xc8a2a5[_0x322d('0x3b')]['ids']),'MailQueueId':Number(_0xc8a2a5['params']['id'])});}});}})[_0x322d('0x30')](respondWithStatusCode(_0x24d19c,null))['catch'](handleError(_0x24d19c,null));};exports[_0x322d('0x8e')]=function(_0x47924e,_0x4a2ed7,_0x4f20e5){var _0x58c1ee={};var _0x5297a7={};var _0xbb9cda;var _0x28020e;return db[_0x322d('0x38')][_0x322d('0x8f')]({'where':{'id':_0x47924e[_0x322d('0x50')]['id']}})[_0x322d('0x30')](handleEntityNotFound(_0x4a2ed7,null))[_0x322d('0x30')](function(_0x112efc){if(_0x112efc){_0xbb9cda=_0x112efc;_0x5297a7['model']=_[_0x322d('0x3c')](db[_0x322d('0x60')][_0x322d('0x51')]);_0x5297a7[_0x322d('0x3b')]=_['keys'](_0x47924e[_0x322d('0x3b')]);_0x5297a7[_0x322d('0x3d')]=_[_0x322d('0x3e')](_0x5297a7['model'],_0x5297a7[_0x322d('0x3b')]);_0x58c1ee[_0x322d('0x3f')]=_[_0x322d('0x3e')](_0x5297a7[_0x322d('0x3a')],qs[_0x322d('0x40')](_0x47924e['query']['fields']));_0x58c1ee[_0x322d('0x3f')]=_0x58c1ee[_0x322d('0x3f')][_0x322d('0x41')]?_0x58c1ee[_0x322d('0x3f')]:_0x5297a7[_0x322d('0x3a')];_0x58c1ee['order']=qs['sort'](_0x47924e['query'][_0x322d('0x43')]);_0x58c1ee[_0x322d('0x44')]=qs['filters'](_[_0x322d('0x45')](_0x47924e[_0x322d('0x3b')],_0x5297a7[_0x322d('0x3d')]));if(_0x47924e[_0x322d('0x3b')][_0x322d('0x46')]){_0x58c1ee[_0x322d('0x44')]=_[_0x322d('0x48')](_0x58c1ee['where'],{'$or':_[_0x322d('0x37')](_0x58c1ee[_0x322d('0x3f')],function(_0x1c8ca9){var _0x2dea86={};_0x2dea86[_0x1c8ca9]={'$like':'%'+_0x47924e[_0x322d('0x3b')][_0x322d('0x46')]+'%'};return _0x2dea86;})});}_0x58c1ee=_[_0x322d('0x48')]({},_0x58c1ee,_0x47924e[_0x322d('0x49')]);return _0xbb9cda[_0x322d('0x8e')](_0x58c1ee);}})['then'](function(_0x182ece){if(_0x182ece){_0x28020e=_0x182ece[_0x322d('0x41')];if(!_0x47924e['query'][_0x322d('0x5d')](_0x322d('0x42'))){_0x58c1ee[_0x322d('0x28')]=qs['limit'](_0x47924e[_0x322d('0x3b')][_0x322d('0x28')]);_0x58c1ee[_0x322d('0x27')]=qs[_0x322d('0x27')](_0x47924e[_0x322d('0x3b')][_0x322d('0x27')]);}return _0xbb9cda['getAgents'](_0x58c1ee);}})[_0x322d('0x30')](function(_0x496520){if(_0x496520){return _0x496520?{'count':_0x28020e,'rows':_0x496520}:null;}})[_0x322d('0x30')](respondWithResult(_0x4a2ed7,null))[_0x322d('0x4e')](handleError(_0x4a2ed7,null));}; \ No newline at end of file +var _0x1502=['toString','QueryTypes','SELECT','every','includes','all','union','compact','transaction','isEmpty','removeAgents','userMailQueue:remove','addAgents','omit','spread','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','squel','crypto','jsforce','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','redis','defaults','socket.io-emitter','./mailQueue.socket','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','save','update','then','MailQueues','destroy','error','stack','name','send','index','map','MailQueue','rawAttributes','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','order','sort','filters','pick','where','merge','VIRTUAL','filter','options','includeAll','include','rows','params','find','catch','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','UserMailQueue','limit','MailQueueId','findAll','User','findAndCountAll','UserId','agent','mailPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','findOne','Team','nolimit','addTeams','ids','Agents','online','voicePause','interface','flatMap','sequelize','each','forEach','emit','userMailQueue:save','removeTeams','select','from','team_has_mail_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','push'];(function(_0x1bb704,_0x2b9bac){var _0x128c93=function(_0x3e3ba3){while(--_0x3e3ba3){_0x1bb704['push'](_0x1bb704['shift']());}};_0x128c93(++_0x2b9bac);}(_0x1502,0x1c3));var _0x2150=function(_0x45d57e,_0x486090){_0x45d57e=_0x45d57e-0x0;var _0x5c7271=_0x1502[_0x45d57e];return _0x5c7271;};'use strict';var emlformat=require(_0x2150('0x0'));var rimraf=require(_0x2150('0x1'));var zipdir=require(_0x2150('0x2'));var jsonpatch=require(_0x2150('0x3'));var rp=require(_0x2150('0x4'));var moment=require(_0x2150('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x2150('0x6'));var util=require(_0x2150('0x7'));var path=require(_0x2150('0x8'));var sox=require(_0x2150('0x9'));var csv=require('to-csv');var ejs=require(_0x2150('0xa'));var fs=require('fs');var fs_extra=require(_0x2150('0xb'));var _=require('lodash');var squel=require(_0x2150('0xc'));var crypto=require(_0x2150('0xd'));var jsforce=require(_0x2150('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x2150('0xf'));var querystring=require(_0x2150('0x10'));var Papa=require(_0x2150('0x11'));var Redis=require('ioredis');var authService=require(_0x2150('0x12'));var qs=require(_0x2150('0x13'));var as=require(_0x2150('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2150('0x15'))(_0x2150('0x16'));var utils=require(_0x2150('0x17'));var config=require(_0x2150('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x2150('0x19')]=_[_0x2150('0x1a')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x2150('0x1b'))(new Redis(config[_0x2150('0x19')]));require(_0x2150('0x1c'))['register'](socket);function respondWithStatusCode(_0x5d959e,_0x1b019e){_0x1b019e=_0x1b019e||0xcc;return function(_0x36e0fa){if(_0x36e0fa){return _0x5d959e[_0x2150('0x1d')](_0x1b019e);}return _0x5d959e[_0x2150('0x1e')](_0x1b019e)[_0x2150('0x1f')]();};}function respondWithResult(_0x3543a1,_0x363636){_0x363636=_0x363636||0xc8;return function(_0x3f8a72){if(_0x3f8a72){return _0x3543a1[_0x2150('0x1e')](_0x363636)[_0x2150('0x20')](_0x3f8a72);}};}function respondWithFilteredResult(_0x22effb,_0x92d79d){return function(_0x2295f6){if(_0x2295f6){var _0x42f3d1=typeof _0x92d79d[_0x2150('0x21')]===_0x2150('0x22')&&typeof _0x92d79d['limit']==='undefined';var _0x2b301b=_0x2295f6[_0x2150('0x23')];var _0x2f5db1=_0x42f3d1?0x0:_0x92d79d[_0x2150('0x21')];var _0x53a3b9=_0x42f3d1?_0x2295f6['count']:_0x92d79d[_0x2150('0x21')]+_0x92d79d['limit'];var _0xf5d6f5;if(_0x53a3b9>=_0x2b301b){_0x53a3b9=_0x2b301b;_0xf5d6f5=0xc8;}else{_0xf5d6f5=0xce;}_0x22effb[_0x2150('0x1e')](_0xf5d6f5);return _0x22effb[_0x2150('0x24')](_0x2150('0x25'),_0x2f5db1+'-'+_0x53a3b9+'/'+_0x2b301b)[_0x2150('0x20')](_0x2295f6);}return null;};}function patchUpdates(_0x4afe8c){return function(_0x46c9fc){try{jsonpatch[_0x2150('0x26')](_0x46c9fc,_0x4afe8c,!![]);}catch(_0x57ba9f){return BPromise['reject'](_0x57ba9f);}return _0x46c9fc[_0x2150('0x27')]();};}function saveUpdates(_0x26958e,_0x3d78f7){return function(_0x40bf21){if(_0x40bf21){return _0x40bf21[_0x2150('0x28')](_0x26958e)[_0x2150('0x29')](function(_0x164ba8){return _0x164ba8;});}return null;};}function removeEntity(_0x4b4400,_0x1915f6){return function(_0x5efb98){if(_0x5efb98){return _0x5efb98['destroy']()[_0x2150('0x29')](function(){var _0x399d79=_0x5efb98['get']({'plain':!![]});var _0x4df670=_0x2150('0x2a');return db['UserProfileResource'][_0x2150('0x2b')]({'where':{'type':_0x4df670,'resourceId':_0x399d79['id']}})[_0x2150('0x29')](function(){return _0x5efb98;});})[_0x2150('0x29')](function(){_0x4b4400[_0x2150('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x394c43,_0x5f43ba){return function(_0x1b1d6a){if(!_0x1b1d6a){_0x394c43['sendStatus'](0x194);}return _0x1b1d6a;};}function handleError(_0x2e4d2f,_0x299c57){_0x299c57=_0x299c57||0x1f4;return function(_0x1f997a){logger[_0x2150('0x2c')](_0x1f997a[_0x2150('0x2d')]);if(_0x1f997a[_0x2150('0x2e')]){delete _0x1f997a[_0x2150('0x2e')];}_0x2e4d2f[_0x2150('0x1e')](_0x299c57)[_0x2150('0x2f')](_0x1f997a);};}exports[_0x2150('0x30')]=function(_0x332ac0,_0x2172ad){var _0x1ee730={},_0x581b65={},_0x37a84c={'count':0x0,'rows':[]};var _0x226799=_[_0x2150('0x31')](db[_0x2150('0x32')][_0x2150('0x33')],function(_0x15ae7c){return{'name':_0x15ae7c['fieldName'],'type':_0x15ae7c['type'][_0x2150('0x34')]};});_0x581b65[_0x2150('0x35')]=_[_0x2150('0x31')](_0x226799,'name');_0x581b65[_0x2150('0x36')]=_[_0x2150('0x37')](_0x332ac0[_0x2150('0x36')]);_0x581b65['filters']=_['intersection'](_0x581b65[_0x2150('0x35')],_0x581b65[_0x2150('0x36')]);_0x1ee730[_0x2150('0x38')]=_[_0x2150('0x39')](_0x581b65[_0x2150('0x35')],qs[_0x2150('0x3a')](_0x332ac0[_0x2150('0x36')][_0x2150('0x3a')]));_0x1ee730[_0x2150('0x38')]=_0x1ee730[_0x2150('0x38')][_0x2150('0x3b')]?_0x1ee730[_0x2150('0x38')]:_0x581b65[_0x2150('0x35')];if(!_0x332ac0[_0x2150('0x36')][_0x2150('0x3c')]('nolimit')){_0x1ee730['limit']=qs['limit'](_0x332ac0[_0x2150('0x36')]['limit']);_0x1ee730[_0x2150('0x21')]=qs['offset'](_0x332ac0['query'][_0x2150('0x21')]);}_0x1ee730[_0x2150('0x3d')]=qs[_0x2150('0x3e')](_0x332ac0[_0x2150('0x36')][_0x2150('0x3e')]);_0x1ee730['where']=qs[_0x2150('0x3f')](_[_0x2150('0x40')](_0x332ac0[_0x2150('0x36')],_0x581b65['filters']),_0x226799);if(_0x332ac0['query']['filter']){_0x1ee730[_0x2150('0x41')]=_[_0x2150('0x42')](_0x1ee730['where'],{'$or':_[_0x2150('0x31')](_0x226799,function(_0x19fa7d){if(_0x19fa7d['type']!==_0x2150('0x43')){var _0x5a4f50={};_0x5a4f50[_0x19fa7d[_0x2150('0x2e')]]={'$like':'%'+_0x332ac0['query'][_0x2150('0x44')]+'%'};return _0x5a4f50;}})});}_0x1ee730=_[_0x2150('0x42')]({},_0x1ee730,_0x332ac0[_0x2150('0x45')]);var _0x13edb7={'where':_0x1ee730[_0x2150('0x41')]};return db[_0x2150('0x32')][_0x2150('0x23')](_0x13edb7)[_0x2150('0x29')](function(_0x4cf8c9){_0x37a84c[_0x2150('0x23')]=_0x4cf8c9;if(_0x332ac0[_0x2150('0x36')][_0x2150('0x46')]){_0x1ee730[_0x2150('0x47')]=[{'all':!![]}];}return db[_0x2150('0x32')]['findAll'](_0x1ee730);})['then'](function(_0x494441){_0x37a84c[_0x2150('0x48')]=_0x494441;return _0x37a84c;})[_0x2150('0x29')](respondWithFilteredResult(_0x2172ad,_0x1ee730))['catch'](handleError(_0x2172ad,null));};exports['show']=function(_0x477010,_0x369eb3){var _0x57d7de={'raw':!![],'where':{'id':_0x477010[_0x2150('0x49')]['id']}},_0x19d601={};_0x19d601[_0x2150('0x35')]=_[_0x2150('0x37')](db['MailQueue']['rawAttributes']);_0x19d601[_0x2150('0x36')]=_[_0x2150('0x37')](_0x477010[_0x2150('0x36')]);_0x19d601[_0x2150('0x3f')]=_['intersection'](_0x19d601[_0x2150('0x35')],_0x19d601[_0x2150('0x36')]);_0x57d7de[_0x2150('0x38')]=_[_0x2150('0x39')](_0x19d601['model'],qs['fields'](_0x477010[_0x2150('0x36')]['fields']));_0x57d7de[_0x2150('0x38')]=_0x57d7de[_0x2150('0x38')][_0x2150('0x3b')]?_0x57d7de[_0x2150('0x38')]:_0x19d601['model'];if(_0x477010[_0x2150('0x36')][_0x2150('0x46')]){_0x57d7de['include']=[{'all':!![]}];}_0x57d7de=_[_0x2150('0x42')]({},_0x57d7de,_0x477010[_0x2150('0x45')]);return db[_0x2150('0x32')][_0x2150('0x4a')](_0x57d7de)[_0x2150('0x29')](handleEntityNotFound(_0x369eb3,null))[_0x2150('0x29')](respondWithResult(_0x369eb3,null))[_0x2150('0x4b')](handleError(_0x369eb3,null));};exports[_0x2150('0x4c')]=function(_0x102dbb,_0x2705bf){return db['MailQueue'][_0x2150('0x4c')](_0x102dbb[_0x2150('0x4d')],{})[_0x2150('0x29')](function(_0x59c1a2){var _0x4d8aad=_0x102dbb[_0x2150('0x4e')][_0x2150('0x4f')]({'plain':!![]});if(!_0x4d8aad)throw new Error(_0x2150('0x50'));if(_0x4d8aad[_0x2150('0x51')]===_0x2150('0x4e')){var _0x1343f8=_0x59c1a2[_0x2150('0x4f')]({'plain':!![]});var _0x29644d=_0x2150('0x2a');return db[_0x2150('0x52')][_0x2150('0x4a')]({'where':{'name':_0x29644d,'userProfileId':_0x4d8aad[_0x2150('0x53')]},'raw':!![]})[_0x2150('0x29')](function(_0x26dc4a){if(_0x26dc4a&&_0x26dc4a[_0x2150('0x54')]===0x0){return db[_0x2150('0x55')][_0x2150('0x4c')]({'name':_0x1343f8[_0x2150('0x2e')],'resourceId':_0x1343f8['id'],'type':_0x26dc4a[_0x2150('0x2e')],'sectionId':_0x26dc4a['id']},{})['then'](function(){return _0x59c1a2;});}else{return _0x59c1a2;}})['catch'](function(_0x16c976){logger[_0x2150('0x2c')](_0x2150('0x56'),_0x16c976);throw _0x16c976;});}return _0x59c1a2;})['then'](respondWithResult(_0x2705bf,0xc9))['catch'](handleError(_0x2705bf,null));};exports[_0x2150('0x28')]=function(_0x388069,_0x4c15ca){if(_0x388069[_0x2150('0x4d')]['id']){delete _0x388069[_0x2150('0x4d')]['id'];}return db[_0x2150('0x32')][_0x2150('0x4a')]({'where':{'id':_0x388069[_0x2150('0x49')]['id']}})['then'](handleEntityNotFound(_0x4c15ca,null))[_0x2150('0x29')](saveUpdates(_0x388069[_0x2150('0x4d')],null))[_0x2150('0x29')](respondWithResult(_0x4c15ca,null))[_0x2150('0x4b')](handleError(_0x4c15ca,null));};exports[_0x2150('0x2b')]=function(_0x299e50,_0x1ab8e9){return db[_0x2150('0x32')][_0x2150('0x4a')]({'where':{'id':_0x299e50['params']['id']}})[_0x2150('0x29')](handleEntityNotFound(_0x1ab8e9,null))[_0x2150('0x29')](removeEntity(_0x1ab8e9,null))[_0x2150('0x4b')](handleError(_0x1ab8e9,null));};exports['describe']=function(_0x1ff4b1,_0x3fce50){return db[_0x2150('0x32')][_0x2150('0x57')]()['then'](respondWithResult(_0x3fce50,null))['catch'](handleError(_0x3fce50,null));};exports[_0x2150('0x58')]=function(_0x50499a,_0x2a8786,_0x153038){var _0x5f3822={'raw':!![],'where':{}},_0x49b2ea={},_0x1bb0c0;return db[_0x2150('0x32')]['findOne']({'where':{'id':_0x50499a[_0x2150('0x49')]['id']}})[_0x2150('0x29')](handleEntityNotFound(_0x2a8786,null))['then'](function(_0x1d83a){if(_0x1d83a){_0x1bb0c0=_0x1d83a[_0x2150('0x4f')]({'plain':!![]});_0x49b2ea[_0x2150('0x35')]=_[_0x2150('0x37')](db[_0x2150('0x59')]['rawAttributes']);_0x49b2ea[_0x2150('0x36')]=_['keys'](_0x50499a['query']);_0x49b2ea[_0x2150('0x3f')]=_[_0x2150('0x39')](_0x49b2ea[_0x2150('0x35')],_0x49b2ea[_0x2150('0x36')]);_0x5f3822[_0x2150('0x38')]=_[_0x2150('0x39')](_0x49b2ea[_0x2150('0x35')],qs[_0x2150('0x3a')](_0x50499a[_0x2150('0x36')][_0x2150('0x3a')]));_0x5f3822[_0x2150('0x38')]=_0x5f3822[_0x2150('0x38')]['length']?_0x5f3822['attributes']:_0x49b2ea[_0x2150('0x35')];if(!_0x50499a[_0x2150('0x36')][_0x2150('0x3c')]('nolimit')){_0x5f3822[_0x2150('0x5a')]=qs[_0x2150('0x5a')](_0x50499a[_0x2150('0x36')][_0x2150('0x5a')]);_0x5f3822['offset']=qs[_0x2150('0x21')](_0x50499a[_0x2150('0x36')][_0x2150('0x21')]);}_0x5f3822['order']=qs[_0x2150('0x3e')](_0x50499a['query'][_0x2150('0x3e')]);_0x5f3822[_0x2150('0x41')]=qs['filters'](_['pick'](_0x50499a[_0x2150('0x36')],_0x49b2ea[_0x2150('0x3f')]));_0x5f3822[_0x2150('0x41')][_0x2150('0x5b')]=_0x1d83a['id'];if(_0x50499a[_0x2150('0x36')][_0x2150('0x44')]){_0x5f3822[_0x2150('0x41')]=_[_0x2150('0x42')](_0x5f3822[_0x2150('0x41')],{'$or':_[_0x2150('0x31')](_0x5f3822['attributes'],function(_0x1f46ce){var _0x50220c={};_0x50220c[_0x1f46ce]={'$like':'%'+_0x50499a[_0x2150('0x36')][_0x2150('0x44')]+'%'};return _0x50220c;})});}_0x5f3822=_[_0x2150('0x42')]({},_0x5f3822,_0x50499a[_0x2150('0x45')]);return db[_0x2150('0x59')][_0x2150('0x5c')](_0x5f3822);}})[_0x2150('0x29')](function(_0x4b1aa1){if(_0x4b1aa1){return db[_0x2150('0x5d')][_0x2150('0x5e')]({'where':{'id':_['map'](_0x4b1aa1,_0x2150('0x5f')),'role':_0x2150('0x60')},'attributes':['id',_0x2150('0x2e'),_0x2150('0x61'),_0x2150('0x62'),_0x2150('0x63')]});}})[_0x2150('0x29')](function(_0x20b998){if(_0x20b998){return{'count':_0x20b998[_0x2150('0x23')],'rows':_[_0x2150('0x31')](_0x20b998[_0x2150('0x48')],function(_0x4548da){return{'membername':_0x4548da[_0x2150('0x2e')],'UserId':_0x4548da['id'],'queue_name':_0x1bb0c0[_0x2150('0x2e')],'MailQueueId':_0x1bb0c0['id'],'interface':util[_0x2150('0x64')](_0x2150('0x65'),_0x2150('0x66'),_0x4548da[_0x2150('0x2e')]),'penalty':0x0,'paused':_0x4548da[_0x2150('0x61')],'createdAt':_0x4548da[_0x2150('0x63')],'updatedAt':_0x4548da[_0x2150('0x62')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x2150('0x29')](respondWithFilteredResult(_0x2a8786,_0x5f3822))[_0x2150('0x4b')](handleError(_0x2a8786,null));};exports[_0x2150('0x67')]=function(_0x2e08a6,_0x44f51d,_0x1fa723){var _0x2bd701={};var _0x404324={};var _0x25a450;var _0x4deb78;return db['MailQueue'][_0x2150('0x68')]({'where':{'id':_0x2e08a6[_0x2150('0x49')]['id']}})[_0x2150('0x29')](handleEntityNotFound(_0x44f51d,null))[_0x2150('0x29')](function(_0x470057){if(_0x470057){_0x25a450=_0x470057;_0x404324[_0x2150('0x35')]=_[_0x2150('0x37')](db[_0x2150('0x69')]['rawAttributes']);_0x404324[_0x2150('0x36')]=_[_0x2150('0x37')](_0x2e08a6[_0x2150('0x36')]);_0x404324['filters']=_['intersection'](_0x404324['model'],_0x404324[_0x2150('0x36')]);_0x2bd701[_0x2150('0x38')]=_[_0x2150('0x39')](_0x404324['model'],qs[_0x2150('0x3a')](_0x2e08a6[_0x2150('0x36')]['fields']));_0x2bd701[_0x2150('0x38')]=_0x2bd701[_0x2150('0x38')][_0x2150('0x3b')]?_0x2bd701['attributes']:_0x404324[_0x2150('0x35')];_0x2bd701[_0x2150('0x3d')]=qs['sort'](_0x2e08a6['query']['sort']);_0x2bd701[_0x2150('0x41')]=qs[_0x2150('0x3f')](_[_0x2150('0x40')](_0x2e08a6['query'],_0x404324['filters']));if(_0x2e08a6[_0x2150('0x36')][_0x2150('0x44')]){_0x2bd701[_0x2150('0x41')]=_['merge'](_0x2bd701[_0x2150('0x41')],{'$or':_[_0x2150('0x31')](_0x2bd701[_0x2150('0x38')],function(_0x1eb2a6){var _0xf07c5c={};_0xf07c5c[_0x1eb2a6]={'$like':'%'+_0x2e08a6['query'][_0x2150('0x44')]+'%'};return _0xf07c5c;})});}_0x2bd701=_['merge']({},_0x2bd701,_0x2e08a6['options']);return _0x25a450['getTeams'](_0x2bd701);}})[_0x2150('0x29')](function(_0x50dff0){if(_0x50dff0){_0x4deb78=_0x50dff0['length'];if(!_0x2e08a6['query'][_0x2150('0x3c')](_0x2150('0x6a'))){_0x2bd701['limit']=qs[_0x2150('0x5a')](_0x2e08a6[_0x2150('0x36')][_0x2150('0x5a')]);_0x2bd701['offset']=qs[_0x2150('0x21')](_0x2e08a6[_0x2150('0x36')][_0x2150('0x21')]);}return _0x25a450[_0x2150('0x67')](_0x2bd701);}})[_0x2150('0x29')](function(_0x1c3a22){if(_0x1c3a22){return _0x1c3a22?{'count':_0x4deb78,'rows':_0x1c3a22}:null;}})['then'](respondWithResult(_0x44f51d,null))['catch'](handleError(_0x44f51d,null));};exports[_0x2150('0x6b')]=function(_0x52251c,_0x954910,_0x5800b8){var _0xaef21b=_0x52251c[_0x2150('0x4d')][_0x2150('0x6c')];return db[_0x2150('0x69')]['findAll']({'where':{'id':_0xaef21b},'attributes':['id'],'include':[{'model':db['User'],'as':_0x2150('0x6d'),'attributes':['id','name',_0x2150('0x6e'),_0x2150('0x6f'),_0x2150('0x70')],'raw':!![]}]})[_0x2150('0x29')](function(_0x44038d){if(_0x44038d){var _0x13b603=_[_0x2150('0x71')](_0x44038d,function(_0x2a49ba){var _0x3ae089=_0x2a49ba[_0x2150('0x4f')]({'plain':!![]});return _0x3ae089[_0x2150('0x6d')];});return db['MailQueue'][_0x2150('0x4a')]({'where':{'id':_0x52251c[_0x2150('0x49')]['id']}})['then'](function(_0x55fba8){return db[_0x2150('0x72')]['transaction'](function(_0x46bc5a){return _0x55fba8[_0x2150('0x6b')](_0xaef21b,{'transaction':_0x46bc5a})[_0x2150('0x29')](function(){return BPromise[_0x2150('0x73')](_0x13b603,function(_0x3afc25){return db[_0x2150('0x59')]['findOrCreate']({'where':{'UserId':_0x3afc25['id'],'MailQueueId':_0x52251c[_0x2150('0x49')]['id']},'transaction':_0x46bc5a});});})[_0x2150('0x29')](function(){_0x13b603[_0x2150('0x74')](function(_0x25c89d){socket[_0x2150('0x75')](_0x2150('0x76'),{'UserId':_0x25c89d['id'],'MailQueueId':_0x55fba8['id']});});});});});}})['then'](respondWithStatusCode(_0x954910,null))[_0x2150('0x4b')](handleError(_0x954910,null));};exports[_0x2150('0x77')]=function(_0x472101,_0x4b165c,_0x17b233){return db[_0x2150('0x69')]['findAll']({'where':{'id':_0x472101['query']['ids']},'attributes':['id'],'include':[{'model':db[_0x2150('0x5d')],'as':_0x2150('0x6d'),'attributes':['id'],'raw':!![]}]})[_0x2150('0x29')](handleEntityNotFound(_0x4b165c,null))[_0x2150('0x29')](function(_0x7bd1f3){var _0x2e0fa3=_[_0x2150('0x31')](_0x7bd1f3,'id');var _0x55ab40=[];var _0x2fd048=[];var _0x429d22=squel[_0x2150('0x78')]();_0x429d22['field']('tq.TeamId')[_0x2150('0x79')](_0x2150('0x7a'),'tq')[_0x2150('0x7b')](_0x2150('0x7c'),'ut',_0x2150('0x7d'))[_0x2150('0x41')]('MailQueueId\x20=\x20?',_0x472101[_0x2150('0x49')]['id']);for(var _0x1c27cb=0x0;_0x1c27cb<_0x7bd1f3[_0x2150('0x3b')];_0x1c27cb+=0x1){let _0x4f5028=_0x7bd1f3[_0x1c27cb];for(var _0x21ed41=0x0;_0x21ed41<_0x4f5028[_0x2150('0x6d')][_0x2150('0x3b')];_0x21ed41+=0x1){let _0x46793c=_0x4f5028[_0x2150('0x6d')][_0x21ed41];var _0x589bd4=_0x429d22[_0x2150('0x7e')]();_0x589bd4[_0x2150('0x41')](_0x2150('0x7f'),_0x46793c['id']);_0x2fd048[_0x2150('0x80')](db[_0x2150('0x72')]['query'](_0x589bd4[_0x2150('0x81')](),{'type':db[_0x2150('0x72')][_0x2150('0x82')][_0x2150('0x83')]})[_0x2150('0x29')](function(_0x2145d7){if(_0x2145d7['length']===0x1){return _0x46793c['id'];}else{var _0xc4ff4=_[_0x2150('0x84')](_['map'](_0x2145d7,'TeamId'),function(_0x181202){return _[_0x2150('0x85')](_0x2e0fa3,_0x181202);});if(_0xc4ff4){return _0x46793c['id'];}}}));}}return BPromise[_0x2150('0x86')](_0x2fd048)[_0x2150('0x29')](function(_0x5a5571){_0x55ab40=_(_0x55ab40)[_0x2150('0x87')](_0x5a5571)[_0x2150('0x88')]()['value']();return db[_0x2150('0x32')]['find']({'where':{'id':_0x472101[_0x2150('0x49')]['id']}})[_0x2150('0x29')](function(_0x8fcf4){return db[_0x2150('0x72')][_0x2150('0x89')](function(_0x2f1105){return _0x8fcf4[_0x2150('0x77')](_0x472101[_0x2150('0x36')][_0x2150('0x6c')],{'transaction':_0x2f1105})[_0x2150('0x29')](function(){if(!_[_0x2150('0x8a')](_0x55ab40)){return _0x8fcf4[_0x2150('0x8b')](_0x55ab40,{'transaction':_0x2f1105});}})['then'](function(){_0x55ab40[_0x2150('0x74')](function(_0x59e17a){socket[_0x2150('0x75')](_0x2150('0x8c'),{'UserId':_0x59e17a,'MailQueueId':_0x8fcf4['id']});});});});});});})['then'](respondWithStatusCode(_0x4b165c,null))['catch'](handleError(_0x4b165c,null));};exports[_0x2150('0x8d')]=function(_0xfd0274,_0x208a26,_0x195fec){return db[_0x2150('0x32')][_0x2150('0x4a')]({'where':{'id':_0xfd0274['params']['id']}})[_0x2150('0x29')](handleEntityNotFound(_0x208a26,null))[_0x2150('0x29')](function(_0x1df43c){if(_0x1df43c){return _0x1df43c[_0x2150('0x8d')](_0xfd0274['body']['ids'],_[_0x2150('0x8e')](_0xfd0274[_0x2150('0x4d')],[_0x2150('0x6c'),'id'])||{})[_0x2150('0x8f')](function(_0x4b1203){for(var _0x221502=0x0;_0x221502<_0xfd0274[_0x2150('0x4d')][_0x2150('0x6c')][_0x2150('0x3b')];_0x221502+=0x1){socket[_0x2150('0x75')](_0x2150('0x76'),{'UserId':Number(_0xfd0274['body']['ids'][_0x221502]),'MailQueueId':Number(_0xfd0274[_0x2150('0x49')]['id'])});}return _0x4b1203;});}})[_0x2150('0x29')](respondWithResult(_0x208a26,null))['catch'](handleError(_0x208a26,null));};exports[_0x2150('0x8b')]=function(_0x1adcba,_0xe2c281,_0x1daba4){return db['MailQueue'][_0x2150('0x4a')]({'where':{'id':_0x1adcba[_0x2150('0x49')]['id']}})[_0x2150('0x29')](handleEntityNotFound(_0xe2c281,null))[_0x2150('0x29')](function(_0xcb7f12){if(_0xcb7f12){return _0xcb7f12[_0x2150('0x8b')](_0x1adcba[_0x2150('0x36')][_0x2150('0x6c')])[_0x2150('0x29')](function(){if(_['isArray'](_0x1adcba[_0x2150('0x36')][_0x2150('0x6c')])){for(var _0x37e71f=0x0;_0x37e71f<_0x1adcba[_0x2150('0x36')][_0x2150('0x6c')][_0x2150('0x3b')];_0x37e71f+=0x1){socket[_0x2150('0x75')](_0x2150('0x8c'),{'UserId':Number(_0x1adcba[_0x2150('0x36')][_0x2150('0x6c')][_0x37e71f]),'MailQueueId':Number(_0x1adcba[_0x2150('0x49')]['id'])});}}else{socket[_0x2150('0x75')](_0x2150('0x8c'),{'UserId':Number(_0x1adcba[_0x2150('0x36')][_0x2150('0x6c')]),'MailQueueId':Number(_0x1adcba['params']['id'])});}});}})[_0x2150('0x29')](respondWithStatusCode(_0xe2c281,null))[_0x2150('0x4b')](handleError(_0xe2c281,null));};exports[_0x2150('0x90')]=function(_0x4cc510,_0x3c2d5b,_0x33e30b){var _0x3416d={};var _0x25fca7={};var _0x41957e;var _0x348593;return db['MailQueue']['findOne']({'where':{'id':_0x4cc510[_0x2150('0x49')]['id']}})[_0x2150('0x29')](handleEntityNotFound(_0x3c2d5b,null))['then'](function(_0x2a2edd){if(_0x2a2edd){_0x41957e=_0x2a2edd;_0x25fca7[_0x2150('0x35')]=_[_0x2150('0x37')](db[_0x2150('0x5d')][_0x2150('0x33')]);_0x25fca7['query']=_['keys'](_0x4cc510[_0x2150('0x36')]);_0x25fca7['filters']=_[_0x2150('0x39')](_0x25fca7['model'],_0x25fca7[_0x2150('0x36')]);_0x3416d[_0x2150('0x38')]=_['intersection'](_0x25fca7[_0x2150('0x35')],qs[_0x2150('0x3a')](_0x4cc510[_0x2150('0x36')][_0x2150('0x3a')]));_0x3416d['attributes']=_0x3416d[_0x2150('0x38')][_0x2150('0x3b')]?_0x3416d[_0x2150('0x38')]:_0x25fca7[_0x2150('0x35')];_0x3416d['order']=qs['sort'](_0x4cc510[_0x2150('0x36')]['sort']);_0x3416d['where']=qs['filters'](_['pick'](_0x4cc510[_0x2150('0x36')],_0x25fca7['filters']));if(_0x4cc510[_0x2150('0x36')]['filter']){_0x3416d['where']=_[_0x2150('0x42')](_0x3416d['where'],{'$or':_[_0x2150('0x31')](_0x3416d[_0x2150('0x38')],function(_0x5d401f){var _0x1effb1={};_0x1effb1[_0x5d401f]={'$like':'%'+_0x4cc510[_0x2150('0x36')][_0x2150('0x44')]+'%'};return _0x1effb1;})});}_0x3416d=_[_0x2150('0x42')]({},_0x3416d,_0x4cc510[_0x2150('0x45')]);return _0x41957e['getAgents'](_0x3416d);}})[_0x2150('0x29')](function(_0x216277){if(_0x216277){_0x348593=_0x216277['length'];if(!_0x4cc510['query'][_0x2150('0x3c')](_0x2150('0x6a'))){_0x3416d[_0x2150('0x5a')]=qs[_0x2150('0x5a')](_0x4cc510[_0x2150('0x36')][_0x2150('0x5a')]);_0x3416d[_0x2150('0x21')]=qs[_0x2150('0x21')](_0x4cc510['query']['offset']);}return _0x41957e[_0x2150('0x90')](_0x3416d);}})[_0x2150('0x29')](function(_0x296c1e){if(_0x296c1e){return _0x296c1e?{'count':_0x348593,'rows':_0x296c1e}:null;}})[_0x2150('0x29')](respondWithResult(_0x3c2d5b,null))['catch'](handleError(_0x3c2d5b,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index 8ff10e2..d2aa897 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 _0x7076=['setMaxListeners','update','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x448313,_0x2b5e0f){var _0x3740be=function(_0x130a0d){while(--_0x130a0d){_0x448313['push'](_0x448313['shift']());}};_0x3740be(++_0x2b5e0f);}(_0x7076,0x66));var _0x6707=function(_0x10ffad,_0x1e507f){_0x10ffad=_0x10ffad-0x0;var _0x4f0b71=_0x7076[_0x10ffad];return _0x4f0b71;};'use strict';var EventEmitter=require(_0x6707('0x0'));var MailQueue=require(_0x6707('0x1'))['db']['MailQueue'];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0x6707('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x6707('0x3'),'afterDestroy':'remove'};function emitEvent(_0x40ca0c){return function(_0x17daff,_0x4efe7a,_0x400ac1){MailQueueEvents[_0x6707('0x4')](_0x40ca0c+':'+_0x17daff['id'],_0x17daff);MailQueueEvents['emit'](_0x40ca0c,_0x17daff);_0x400ac1(null);};}for(var e in events){if(events[_0x6707('0x5')](e)){var event=events[e];MailQueue[_0x6707('0x6')](e,emitEvent(event));}}module[_0x6707('0x7')]=MailQueueEvents; \ No newline at end of file +var _0xf5d8=['remove','emit','hasOwnProperty','hook','exports','events','MailQueue','setMaxListeners','save','update'];(function(_0x568a32,_0x17c98a){var _0x2a8e4f=function(_0x5438c9){while(--_0x5438c9){_0x568a32['push'](_0x568a32['shift']());}};_0x2a8e4f(++_0x17c98a);}(_0xf5d8,0x127));var _0x8f5d=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xf5d8[_0x321bb2];return _0x9c12ed;};'use strict';var EventEmitter=require(_0x8f5d('0x0'));var MailQueue=require('../../mysqldb')['db'][_0x8f5d('0x1')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0x8f5d('0x2')](0x0);var events={'afterCreate':_0x8f5d('0x3'),'afterUpdate':_0x8f5d('0x4'),'afterDestroy':_0x8f5d('0x5')};function emitEvent(_0x4e4a08){return function(_0x3f537e,_0x4fb9b1,_0xa8a042){MailQueueEvents[_0x8f5d('0x6')](_0x4e4a08+':'+_0x3f537e['id'],_0x3f537e);MailQueueEvents['emit'](_0x4e4a08,_0x3f537e);_0xa8a042(null);};}for(var e in events){if(events[_0x8f5d('0x7')](e)){var event=events[e];MailQueue[_0x8f5d('0x8')](e,emitEvent(event));}}module[_0x8f5d('0x9')]=MailQueueEvents; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.model.js b/server/api/mailQueue/mailQueue.model.js index e73da98..6586900 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 _0x7ba3=['exports','MailQueue','mail_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./mailQueue.attributes'];(function(_0x301c34,_0x15701e){var _0x1a8c5a=function(_0x297b4f){while(--_0x297b4f){_0x301c34['push'](_0x301c34['shift']());}};_0x1a8c5a(++_0x15701e);}(_0x7ba3,0x1ca));var _0x37ba=function(_0x29c934,_0x3c30e2){_0x29c934=_0x29c934-0x0;var _0x4302de=_0x7ba3[_0x29c934];return _0x4302de;};'use strict';var _=require(_0x37ba('0x0'));var util=require(_0x37ba('0x1'));var logger=require(_0x37ba('0x2'))(_0x37ba('0x3'));var moment=require(_0x37ba('0x4'));var BPromise=require(_0x37ba('0x5'));var rp=require(_0x37ba('0x6'));var fs=require('fs');var path=require(_0x37ba('0x7'));var rimraf=require('rimraf');var config=require(_0x37ba('0x8'));var attributes=require(_0x37ba('0x9'));module[_0x37ba('0xa')]=function(_0x3a8e35,_0x446c9b){return _0x3a8e35['define'](_0x37ba('0xb'),attributes,{'tableName':_0x37ba('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe870=['../../config/environment','./mailQueue.attributes','exports','define','MailQueue','mail_queues','lodash','../../config/logger','api','bluebird'];(function(_0x57da0a,_0x284aed){var _0x3145d5=function(_0xfe7c3b){while(--_0xfe7c3b){_0x57da0a['push'](_0x57da0a['shift']());}};_0x3145d5(++_0x284aed);}(_0xe870,0x88));var _0x0e87=function(_0x136169,_0x342894){_0x136169=_0x136169-0x0;var _0x6a24cf=_0xe870[_0x136169];return _0x6a24cf;};'use strict';var _=require(_0x0e87('0x0'));var util=require('util');var logger=require(_0x0e87('0x1'))(_0x0e87('0x2'));var moment=require('moment');var BPromise=require(_0x0e87('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x0e87('0x4'));var attributes=require(_0x0e87('0x5'));module[_0x0e87('0x6')]=function(_0x4c32dc,_0x385523){return _0x4c32dc[_0x0e87('0x7')](_0x0e87('0x8'),attributes,{'tableName':_0x0e87('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.rpc.js b/server/api/mailQueue/mailQueue.rpc.js index 3ad30e4..edf0c68 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 _0x222b=['limit','include','model','map','then','debug','GetMailQueue','catch','find','ShowMailQueue','lodash','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','register','info','MailQueue,\x20%s,\x20%s','MailQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','MailQueue','findAll','options','raw','where','attributes'];(function(_0xe66cf2,_0x32ba5f){var _0x2d84e7=function(_0x58a7d8){while(--_0x58a7d8){_0xe66cf2['push'](_0xe66cf2['shift']());}};_0x2d84e7(++_0x32ba5f);}(_0x222b,0xee));var _0xb222=function(_0x2e9b5b,_0x3e1332){_0x2e9b5b=_0x2e9b5b-0x0;var _0x734c46=_0x222b[_0x2e9b5b];return _0x734c46;};'use strict';var _=require(_0xb222('0x0'));var util=require('util');var moment=require(_0xb222('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb222('0x2'));var db=require(_0xb222('0x3'))['db'];var utils=require(_0xb222('0x4'));var logger=require(_0xb222('0x5'))('rpc');var config=require(_0xb222('0x6'));var jayson=require(_0xb222('0x7'));var client=jayson[_0xb222('0x8')][_0xb222('0x9')]({'port':0x232a});config[_0xb222('0xa')]=_['defaults'](config[_0xb222('0xa')],{'host':_0xb222('0xb'),'port':0x18eb});var socket=require(_0xb222('0xc'))(new Redis(config[_0xb222('0xa')]));require('./mailQueue.socket')[_0xb222('0xd')](socket);function respondWithRpcPromise(_0x229803,_0x6358f3,_0x131557){return new BPromise(function(_0x5db63b,_0x4a9d99){return client['request'](_0x229803,_0x131557)['then'](function(_0x26a8ed){logger[_0xb222('0xe')](_0xb222('0xf'),_0x6358f3,'request\x20sent');logger['debug'](_0xb222('0x10'),_0x6358f3,_0xb222('0x11'),JSON['stringify'](_0x26a8ed));if(_0x26a8ed[_0xb222('0x12')]){if(_0x26a8ed[_0xb222('0x12')][_0xb222('0x13')]===0x1f4){logger[_0xb222('0x12')](_0xb222('0xf'),_0x6358f3,_0x26a8ed[_0xb222('0x12')][_0xb222('0x14')]);return _0x4a9d99(_0x26a8ed['error']['message']);}logger[_0xb222('0x12')](_0xb222('0xf'),_0x6358f3,_0x26a8ed['error'][_0xb222('0x14')]);return _0x5db63b(_0x26a8ed[_0xb222('0x12')][_0xb222('0x14')]);}else{logger[_0xb222('0xe')](_0xb222('0xf'),_0x6358f3,'request\x20sent');_0x5db63b(_0x26a8ed[_0xb222('0x15')][_0xb222('0x14')]);}})['catch'](function(_0x3e1247){logger[_0xb222('0x12')](_0xb222('0xf'),_0x6358f3,_0x3e1247);_0x4a9d99(_0x3e1247);});});}exports['GetMailQueue']=function(_0x1d0765){var _0x58628d=this;return new Promise(function(_0x495abc,_0x36dd4b){return db[_0xb222('0x16')][_0xb222('0x17')]({'raw':_0x1d0765[_0xb222('0x18')]?_0x1d0765[_0xb222('0x18')][_0xb222('0x19')]===undefined?!![]:![]:!![],'where':_0x1d0765[_0xb222('0x18')]?_0x1d0765['options'][_0xb222('0x1a')]||null:null,'attributes':_0x1d0765['options']?_0x1d0765[_0xb222('0x18')][_0xb222('0x1b')]||null:null,'limit':_0x1d0765[_0xb222('0x18')]?_0x1d0765[_0xb222('0x18')][_0xb222('0x1c')]||null:null,'include':_0x1d0765[_0xb222('0x18')]?_0x1d0765[_0xb222('0x18')][_0xb222('0x1d')]?_['map'](_0x1d0765['options']['include'],function(_0x28ec9b){return{'model':db[_0x28ec9b[_0xb222('0x1e')]],'as':_0x28ec9b['as'],'attributes':_0x28ec9b[_0xb222('0x1b')],'include':_0x28ec9b[_0xb222('0x1d')]?_['map'](_0x28ec9b[_0xb222('0x1d')],function(_0x3f4856){return{'model':db[_0x3f4856[_0xb222('0x1e')]],'as':_0x3f4856['as'],'attributes':_0x3f4856[_0xb222('0x1b')],'include':_0x3f4856[_0xb222('0x1d')]?_[_0xb222('0x1f')](_0x3f4856[_0xb222('0x1d')],function(_0x17cad7){return{'model':db[_0x17cad7[_0xb222('0x1e')]],'as':_0x17cad7['as'],'attributes':_0x17cad7[_0xb222('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xb222('0x20')](function(_0x3a3340){logger[_0xb222('0xe')]('GetMailQueue',_0x1d0765);logger[_0xb222('0x21')](_0xb222('0x22'),_0x1d0765,JSON['stringify'](_0x3a3340));_0x495abc(_0x3a3340);})[_0xb222('0x23')](function(_0x422005){logger[_0xb222('0x12')](_0xb222('0x22'),_0x422005[_0xb222('0x14')],_0x1d0765);_0x36dd4b(_0x58628d['error'](0x1f4,_0x422005['message']));});});};exports['ShowMailQueue']=function(_0x1cbdf0){var _0x232b0d=this;return new Promise(function(_0x115aee,_0x11626c){return db[_0xb222('0x16')][_0xb222('0x24')]({'raw':_0x1cbdf0['options']?_0x1cbdf0['options'][_0xb222('0x19')]===undefined?!![]:![]:!![],'where':_0x1cbdf0[_0xb222('0x18')]?_0x1cbdf0[_0xb222('0x18')][_0xb222('0x1a')]||null:null,'attributes':_0x1cbdf0[_0xb222('0x18')]?_0x1cbdf0[_0xb222('0x18')][_0xb222('0x1b')]||null:null,'include':_0x1cbdf0[_0xb222('0x18')]?_0x1cbdf0[_0xb222('0x18')]['include']?_[_0xb222('0x1f')](_0x1cbdf0[_0xb222('0x18')][_0xb222('0x1d')],function(_0x55f0df){return{'model':db[_0x55f0df[_0xb222('0x1e')]],'as':_0x55f0df['as'],'attributes':_0x55f0df['attributes'],'include':_0x55f0df[_0xb222('0x1d')]?_[_0xb222('0x1f')](_0x55f0df[_0xb222('0x1d')],function(_0x1affb4){return{'model':db[_0x1affb4['model']],'as':_0x1affb4['as'],'attributes':_0x1affb4[_0xb222('0x1b')],'include':_0x1affb4[_0xb222('0x1d')]?_[_0xb222('0x1f')](_0x1affb4[_0xb222('0x1d')],function(_0x131f79){return{'model':db[_0x131f79[_0xb222('0x1e')]],'as':_0x131f79['as'],'attributes':_0x131f79[_0xb222('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xb222('0x20')](function(_0x15ca4e){logger[_0xb222('0xe')](_0xb222('0x25'),_0x1cbdf0);logger[_0xb222('0x21')](_0xb222('0x25'),_0x1cbdf0,JSON['stringify'](_0x15ca4e));_0x115aee(_0x15ca4e);})['catch'](function(_0x46717d){logger[_0xb222('0x12')](_0xb222('0x25'),_0x46717d[_0xb222('0x14')],_0x1cbdf0);_0x11626c(_0x232b0d[_0xb222('0x12')](0x1f4,_0x46717d[_0xb222('0x14')]));});});}; \ No newline at end of file +var _0xbb1e=['map','catch','find','where','ShowMailQueue','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','socket.io-emitter','register','request','then','info','MailQueue,\x20%s,\x20%s','request\x20sent','debug','MailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetMailQueue','findAll','options','raw','attributes','include','model'];(function(_0x29d2af,_0x4163a5){var _0x4de08a=function(_0x3fefa9){while(--_0x3fefa9){_0x29d2af['push'](_0x29d2af['shift']());}};_0x4de08a(++_0x4163a5);}(_0xbb1e,0x1bd));var _0xebb1=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xbb1e[_0x4cf98e];return _0x1623ac;};'use strict';var _=require('lodash');var util=require(_0xebb1('0x0'));var moment=require(_0xebb1('0x1'));var BPromise=require(_0xebb1('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xebb1('0x3'));var db=require(_0xebb1('0x4'))['db'];var utils=require(_0xebb1('0x5'));var logger=require(_0xebb1('0x6'))(_0xebb1('0x7'));var config=require(_0xebb1('0x8'));var jayson=require(_0xebb1('0x9'));var client=jayson[_0xebb1('0xa')][_0xebb1('0xb')]({'port':0x232a});config['redis']=_[_0xebb1('0xc')](config[_0xebb1('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0xebb1('0xe'))(new Redis(config['redis']));require('./mailQueue.socket')[_0xebb1('0xf')](socket);function respondWithRpcPromise(_0x5c2b6a,_0x5d47c4,_0x19e5e4){return new BPromise(function(_0x47cb67,_0x2dc840){return client[_0xebb1('0x10')](_0x5c2b6a,_0x19e5e4)[_0xebb1('0x11')](function(_0x49e678){logger[_0xebb1('0x12')](_0xebb1('0x13'),_0x5d47c4,_0xebb1('0x14'));logger[_0xebb1('0x15')](_0xebb1('0x16'),_0x5d47c4,_0xebb1('0x14'),JSON[_0xebb1('0x17')](_0x49e678));if(_0x49e678[_0xebb1('0x18')]){if(_0x49e678['error'][_0xebb1('0x19')]===0x1f4){logger[_0xebb1('0x18')](_0xebb1('0x13'),_0x5d47c4,_0x49e678['error'][_0xebb1('0x1a')]);return _0x2dc840(_0x49e678[_0xebb1('0x18')][_0xebb1('0x1a')]);}logger[_0xebb1('0x18')]('MailQueue,\x20%s,\x20%s',_0x5d47c4,_0x49e678[_0xebb1('0x18')][_0xebb1('0x1a')]);return _0x47cb67(_0x49e678[_0xebb1('0x18')]['message']);}else{logger[_0xebb1('0x12')](_0xebb1('0x13'),_0x5d47c4,_0xebb1('0x14'));_0x47cb67(_0x49e678[_0xebb1('0x1b')][_0xebb1('0x1a')]);}})['catch'](function(_0x3549fb){logger[_0xebb1('0x18')](_0xebb1('0x13'),_0x5d47c4,_0x3549fb);_0x2dc840(_0x3549fb);});});}exports[_0xebb1('0x1c')]=function(_0x2107b7){var _0x2418c2=this;return new Promise(function(_0x416bf3,_0x4f2583){return db['MailQueue'][_0xebb1('0x1d')]({'raw':_0x2107b7['options']?_0x2107b7[_0xebb1('0x1e')][_0xebb1('0x1f')]===undefined?!![]:![]:!![],'where':_0x2107b7[_0xebb1('0x1e')]?_0x2107b7['options']['where']||null:null,'attributes':_0x2107b7[_0xebb1('0x1e')]?_0x2107b7[_0xebb1('0x1e')][_0xebb1('0x20')]||null:null,'limit':_0x2107b7[_0xebb1('0x1e')]?_0x2107b7[_0xebb1('0x1e')]['limit']||null:null,'include':_0x2107b7[_0xebb1('0x1e')]?_0x2107b7[_0xebb1('0x1e')][_0xebb1('0x21')]?_['map'](_0x2107b7['options']['include'],function(_0x29e67f){return{'model':db[_0x29e67f[_0xebb1('0x22')]],'as':_0x29e67f['as'],'attributes':_0x29e67f[_0xebb1('0x20')],'include':_0x29e67f[_0xebb1('0x21')]?_[_0xebb1('0x23')](_0x29e67f['include'],function(_0xdfce1f){return{'model':db[_0xdfce1f[_0xebb1('0x22')]],'as':_0xdfce1f['as'],'attributes':_0xdfce1f['attributes'],'include':_0xdfce1f[_0xebb1('0x21')]?_[_0xebb1('0x23')](_0xdfce1f[_0xebb1('0x21')],function(_0x38c26a){return{'model':db[_0x38c26a[_0xebb1('0x22')]],'as':_0x38c26a['as'],'attributes':_0x38c26a[_0xebb1('0x20')]};}):[]};}):[]};}):[]:[]})[_0xebb1('0x11')](function(_0xc2d853){logger[_0xebb1('0x12')](_0xebb1('0x1c'),_0x2107b7);logger['debug']('GetMailQueue',_0x2107b7,JSON['stringify'](_0xc2d853));_0x416bf3(_0xc2d853);})[_0xebb1('0x24')](function(_0x22e0a6){logger['error'](_0xebb1('0x1c'),_0x22e0a6[_0xebb1('0x1a')],_0x2107b7);_0x4f2583(_0x2418c2[_0xebb1('0x18')](0x1f4,_0x22e0a6['message']));});});};exports['ShowMailQueue']=function(_0x185802){var _0x39b2ed=this;return new Promise(function(_0x31511f,_0x1d55c7){return db['MailQueue'][_0xebb1('0x25')]({'raw':_0x185802[_0xebb1('0x1e')]?_0x185802[_0xebb1('0x1e')][_0xebb1('0x1f')]===undefined?!![]:![]:!![],'where':_0x185802[_0xebb1('0x1e')]?_0x185802[_0xebb1('0x1e')][_0xebb1('0x26')]||null:null,'attributes':_0x185802[_0xebb1('0x1e')]?_0x185802[_0xebb1('0x1e')][_0xebb1('0x20')]||null:null,'include':_0x185802[_0xebb1('0x1e')]?_0x185802[_0xebb1('0x1e')][_0xebb1('0x21')]?_['map'](_0x185802[_0xebb1('0x1e')][_0xebb1('0x21')],function(_0x1138c1){return{'model':db[_0x1138c1[_0xebb1('0x22')]],'as':_0x1138c1['as'],'attributes':_0x1138c1[_0xebb1('0x20')],'include':_0x1138c1['include']?_[_0xebb1('0x23')](_0x1138c1[_0xebb1('0x21')],function(_0x127523){return{'model':db[_0x127523[_0xebb1('0x22')]],'as':_0x127523['as'],'attributes':_0x127523[_0xebb1('0x20')],'include':_0x127523[_0xebb1('0x21')]?_[_0xebb1('0x23')](_0x127523['include'],function(_0x17a8a0){return{'model':db[_0x17a8a0[_0xebb1('0x22')]],'as':_0x17a8a0['as'],'attributes':_0x17a8a0[_0xebb1('0x20')]};}):[]};}):[]};}):[]:[]})[_0xebb1('0x11')](function(_0x17376a){logger['info'](_0xebb1('0x27'),_0x185802);logger['debug'](_0xebb1('0x27'),_0x185802,JSON['stringify'](_0x17376a));_0x31511f(_0x17376a);})[_0xebb1('0x24')](function(_0x9d9cc6){logger[_0xebb1('0x18')]('ShowMailQueue',_0x9d9cc6[_0xebb1('0x1a')],_0x185802);_0x1d55c7(_0x39b2ed['error'](0x1f4,_0x9d9cc6[_0xebb1('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index 01719a7..9e7e9b9 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 _0xbe07=['register','mailQueue:','./mailQueue.events','save','remove','emit','removeListener'];(function(_0x1b6c6d,_0x2983b0){var _0x290d9d=function(_0x5b9779){while(--_0x5b9779){_0x1b6c6d['push'](_0x1b6c6d['shift']());}};_0x290d9d(++_0x2983b0);}(_0xbe07,0xf7));var _0x7be0=function(_0x5d21bb,_0x15337e){_0x5d21bb=_0x5d21bb-0x0;var _0x50f68d=_0xbe07[_0x5d21bb];return _0x50f68d;};'use strict';var MailQueueEvents=require(_0x7be0('0x0'));var events=[_0x7be0('0x1'),_0x7be0('0x2'),'update'];function createListener(_0x26afa2,_0xa0df33){return function(_0x2a2e13){_0xa0df33[_0x7be0('0x3')](_0x26afa2,_0x2a2e13);};}function removeListener(_0x2ea0f0,_0x4ecc50){return function(){MailQueueEvents[_0x7be0('0x4')](_0x2ea0f0,_0x4ecc50);};}exports[_0x7be0('0x5')]=function(_0x5341cf){for(var _0x24b775=0x0,_0x1f206e=events['length'];_0x24b775<_0x1f206e;_0x24b775++){var _0x31a6e6=events[_0x24b775];var _0x3d832c=createListener(_0x7be0('0x6')+_0x31a6e6,_0x5341cf);MailQueueEvents['on'](_0x31a6e6,_0x3d832c);}}; \ No newline at end of file +var _0xcfd1=['./mailQueue.events','save','remove','update','emit','register','length','mailQueue:'];(function(_0xe22f40,_0x3331e2){var _0x226c12=function(_0x213935){while(--_0x213935){_0xe22f40['push'](_0xe22f40['shift']());}};_0x226c12(++_0x3331e2);}(_0xcfd1,0x1b8));var _0x1cfd=function(_0x4a79bd,_0x3f7827){_0x4a79bd=_0x4a79bd-0x0;var _0x26fd6a=_0xcfd1[_0x4a79bd];return _0x26fd6a;};'use strict';var MailQueueEvents=require(_0x1cfd('0x0'));var events=[_0x1cfd('0x1'),_0x1cfd('0x2'),_0x1cfd('0x3')];function createListener(_0x4e60dd,_0x10bd1b){return function(_0xa03e47){_0x10bd1b[_0x1cfd('0x4')](_0x4e60dd,_0xa03e47);};}function removeListener(_0x5e074b,_0x4f182d){return function(){MailQueueEvents['removeListener'](_0x5e074b,_0x4f182d);};}exports[_0x1cfd('0x5')]=function(_0x512b92){for(var _0x262146=0x0,_0x1a95c3=events[_0x1cfd('0x6')];_0x262146<_0x1a95c3;_0x262146++){var _0x4f6534=events[_0x262146];var _0x32f89f=createListener(_0x1cfd('0x7')+_0x4f6534,_0x512b92);MailQueueEvents['on'](_0x4f6534,_0x32f89f);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index 1bc7412..c1a22ec 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 _0x663e=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./mailQueueReport.controller','get','isAuthenticated','index','describe','/:id','show','post','create','put','update','exports','multer'];(function(_0x29a29f,_0x155ce7){var _0x443ea3=function(_0xe0dd24){while(--_0xe0dd24){_0x29a29f['push'](_0x29a29f['shift']());}};_0x443ea3(++_0x155ce7);}(_0x663e,0x77));var _0xe663=function(_0x4db92f,_0x31f14a){_0x4db92f=_0x4db92f-0x0;var _0x2799ee=_0x663e[_0x4db92f];return _0x2799ee;};'use strict';var multer=require(_0xe663('0x0'));var util=require('util');var path=require(_0xe663('0x1'));var timeout=require(_0xe663('0x2'));var express=require(_0xe663('0x3'));var router=express[_0xe663('0x4')]();var fs_extra=require(_0xe663('0x5'));var auth=require(_0xe663('0x6'));var interaction=require(_0xe663('0x7'));var config=require('../../config/environment');var controller=require(_0xe663('0x8'));router[_0xe663('0x9')]('/',auth[_0xe663('0xa')](),controller[_0xe663('0xb')]);router[_0xe663('0x9')]('/describe',auth[_0xe663('0xa')](),controller[_0xe663('0xc')]);router[_0xe663('0x9')](_0xe663('0xd'),auth[_0xe663('0xa')](),controller[_0xe663('0xe')]);router[_0xe663('0xf')]('/',auth[_0xe663('0xa')](),controller[_0xe663('0x10')]);router[_0xe663('0x11')](_0xe663('0xd'),auth[_0xe663('0xa')](),controller[_0xe663('0x12')]);router['delete'](_0xe663('0xd'),auth[_0xe663('0xa')](),controller['destroy']);module[_0xe663('0x13')]=router; \ No newline at end of file +var _0x7925=['util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./mailQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','update','delete','destroy','exports','multer'];(function(_0x1f1aca,_0x13a17d){var _0x19e665=function(_0x568362){while(--_0x568362){_0x1f1aca['push'](_0x1f1aca['shift']());}};_0x19e665(++_0x13a17d);}(_0x7925,0x149));var _0x5792=function(_0x2d3f1e,_0x25f74a){_0x2d3f1e=_0x2d3f1e-0x0;var _0x256ee7=_0x7925[_0x2d3f1e];return _0x256ee7;};'use strict';var multer=require(_0x5792('0x0'));var util=require(_0x5792('0x1'));var path=require(_0x5792('0x2'));var timeout=require(_0x5792('0x3'));var express=require(_0x5792('0x4'));var router=express[_0x5792('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x5792('0x6'));var interaction=require(_0x5792('0x7'));var config=require('../../config/environment');var controller=require(_0x5792('0x8'));router[_0x5792('0x9')]('/',auth[_0x5792('0xa')](),controller[_0x5792('0xb')]);router[_0x5792('0x9')](_0x5792('0xc'),auth['isAuthenticated'](),controller[_0x5792('0xd')]);router[_0x5792('0x9')](_0x5792('0xe'),auth[_0x5792('0xa')](),controller[_0x5792('0xf')]);router[_0x5792('0x10')]('/',auth[_0x5792('0xa')](),controller[_0x5792('0x11')]);router['put'](_0x5792('0xe'),auth[_0x5792('0xa')](),controller[_0x5792('0x12')]);router[_0x5792('0x13')](_0x5792('0xe'),auth[_0x5792('0xa')](),controller[_0x5792('0x14')]);module[_0x5792('0x15')]=router; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.attributes.js b/server/api/mailQueueReport/mailQueueReport.attributes.js index cb1263e..be4850a 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 _0x32b6=['sequelize','exports','DATE','moment'];(function(_0x3f3b97,_0x395d93){var _0xb6ab0c=function(_0x330c5a){while(--_0x330c5a){_0x3f3b97['push'](_0x3f3b97['shift']());}};_0xb6ab0c(++_0x395d93);}(_0x32b6,0x18b));var _0x632b=function(_0x1c78cc,_0xc7b470){_0x1c78cc=_0x1c78cc-0x0;var _0x304a5f=_0x32b6[_0x1c78cc];return _0x304a5f;};'use strict';var moment=require(_0x632b('0x0'));var Sequelize=require(_0x632b('0x1'));module[_0x632b('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x632b('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x632b('0x3')]},'exitAt':{'type':Sequelize[_0x632b('0x3')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x93eb=['DATE','sequelize','exports','STRING'];(function(_0xe5dfdc,_0x23860f){var _0x35833c=function(_0x1ffbb3){while(--_0x1ffbb3){_0xe5dfdc['push'](_0xe5dfdc['shift']());}};_0x35833c(++_0x23860f);}(_0x93eb,0x1b5));var _0xb93e=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x93eb[_0x122ef9];return _0x42fba0;};'use strict';var moment=require('moment');var Sequelize=require(_0xb93e('0x0'));module[_0xb93e('0x1')]={'uniqueid':{'type':Sequelize[_0xb93e('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xb93e('0x2')]},'joinAt':{'type':Sequelize[_0xb93e('0x3')]},'leaveAt':{'type':Sequelize[_0xb93e('0x3')]},'acceptAt':{'type':Sequelize[_0xb93e('0x3')]},'exitAt':{'type':Sequelize[_0xb93e('0x3')]},'reason':{'type':Sequelize[_0xb93e('0x2')]}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.controller.js b/server/api/mailQueueReport/mailQueueReport.controller.js index abf5929..4e59254 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 _0x93e9=['end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','then','destroy','error','name','send','map','rawAttributes','fieldName','type','key','query','intersection','model','attributes','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','merge','MailQueueReport','includeAll','include','findAll','catch','show','params','keys','fields','length','options','find','create','body','update','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','sendStatus','status'];(function(_0x573db6,_0x205cfb){var _0x32cd2f=function(_0x199e0f){while(--_0x199e0f){_0x573db6['push'](_0x573db6['shift']());}};_0x32cd2f(++_0x205cfb);}(_0x93e9,0xcc));var _0x993e=function(_0x1161ed,_0x4d2e0e){_0x1161ed=_0x1161ed-0x0;var _0x2468c7=_0x93e9[_0x1161ed];return _0x2468c7;};'use strict';var emlformat=require(_0x993e('0x0'));var rimraf=require(_0x993e('0x1'));var zipdir=require(_0x993e('0x2'));var jsonpatch=require(_0x993e('0x3'));var rp=require(_0x993e('0x4'));var moment=require(_0x993e('0x5'));var BPromise=require(_0x993e('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x993e('0x7'));var sox=require(_0x993e('0x8'));var csv=require(_0x993e('0x9'));var ejs=require(_0x993e('0xa'));var fs=require('fs');var fs_extra=require(_0x993e('0xb'));var _=require(_0x993e('0xc'));var squel=require(_0x993e('0xd'));var crypto=require(_0x993e('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x993e('0xf'));var toCsv=require(_0x993e('0x9'));var querystring=require(_0x993e('0x10'));var Papa=require(_0x993e('0x11'));var Redis=require(_0x993e('0x12'));var authService=require(_0x993e('0x13'));var qs=require(_0x993e('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x993e('0x15'));var logger=require(_0x993e('0x16'))('api');var utils=require('../../config/utils');var config=require(_0x993e('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x993e('0x18'))['db'];function respondWithStatusCode(_0x5d5c0d,_0x4c2707){_0x4c2707=_0x4c2707||0xcc;return function(_0x31ece2){if(_0x31ece2){return _0x5d5c0d[_0x993e('0x19')](_0x4c2707);}return _0x5d5c0d[_0x993e('0x1a')](_0x4c2707)[_0x993e('0x1b')]();};}function respondWithResult(_0x3e082b,_0x397b42){_0x397b42=_0x397b42||0xc8;return function(_0x34ddda){if(_0x34ddda){return _0x3e082b[_0x993e('0x1a')](_0x397b42)[_0x993e('0x1c')](_0x34ddda);}};}function respondWithFilteredResult(_0xa43a4e,_0x1a7726){return function(_0x135771){if(_0x135771){var _0x3df0e7=typeof _0x1a7726[_0x993e('0x1d')]===_0x993e('0x1e')&&typeof _0x1a7726[_0x993e('0x1f')]===_0x993e('0x1e');var _0x526e06=_0x135771[_0x993e('0x20')];var _0x1acd21=_0x3df0e7?0x0:_0x1a7726[_0x993e('0x1d')];var _0x3d6109=_0x3df0e7?_0x135771[_0x993e('0x20')]:_0x1a7726[_0x993e('0x1d')]+_0x1a7726['limit'];var _0x11cd41;if(_0x3d6109>=_0x526e06){_0x3d6109=_0x526e06;_0x11cd41=0xc8;}else{_0x11cd41=0xce;}_0xa43a4e[_0x993e('0x1a')](_0x11cd41);return _0xa43a4e[_0x993e('0x21')](_0x993e('0x22'),_0x1acd21+'-'+_0x3d6109+'/'+_0x526e06)[_0x993e('0x1c')](_0x135771);}return null;};}function patchUpdates(_0x425ab4){return function(_0x29e48d){try{jsonpatch[_0x993e('0x23')](_0x29e48d,_0x425ab4,!![]);}catch(_0x4bbe9c){return BPromise[_0x993e('0x24')](_0x4bbe9c);}return _0x29e48d['save']();};}function saveUpdates(_0x11f6f4,_0x37ff57){return function(_0x32b09e){if(_0x32b09e){return _0x32b09e['update'](_0x11f6f4)[_0x993e('0x25')](function(_0x13db4e){return _0x13db4e;});}return null;};}function removeEntity(_0xfba00f,_0x1c52fd){return function(_0x3b45ef){if(_0x3b45ef){return _0x3b45ef[_0x993e('0x26')]()[_0x993e('0x25')](function(){_0xfba00f[_0x993e('0x1a')](0xcc)[_0x993e('0x1b')]();});}};}function handleEntityNotFound(_0x18f6ac,_0x3fe099){return function(_0x3603fa){if(!_0x3603fa){_0x18f6ac['sendStatus'](0x194);}return _0x3603fa;};}function handleError(_0x2756a7,_0x279bb8){_0x279bb8=_0x279bb8||0x1f4;return function(_0x52b727){logger[_0x993e('0x27')](_0x52b727['stack']);if(_0x52b727[_0x993e('0x28')]){delete _0x52b727[_0x993e('0x28')];}_0x2756a7[_0x993e('0x1a')](_0x279bb8)[_0x993e('0x29')](_0x52b727);};}exports['index']=function(_0x48d457,_0x32e332){var _0x466d63={},_0x4a4f00={},_0x223af0={'count':0x0,'rows':[]};var _0x46670a=_[_0x993e('0x2a')](db['MailQueueReport'][_0x993e('0x2b')],function(_0x9e0309){return{'name':_0x9e0309[_0x993e('0x2c')],'type':_0x9e0309[_0x993e('0x2d')][_0x993e('0x2e')]};});_0x4a4f00['model']=_[_0x993e('0x2a')](_0x46670a,'name');_0x4a4f00[_0x993e('0x2f')]=_['keys'](_0x48d457[_0x993e('0x2f')]);_0x4a4f00['filters']=_[_0x993e('0x30')](_0x4a4f00[_0x993e('0x31')],_0x4a4f00[_0x993e('0x2f')]);_0x466d63[_0x993e('0x32')]=_[_0x993e('0x30')](_0x4a4f00[_0x993e('0x31')],qs['fields'](_0x48d457[_0x993e('0x2f')]['fields']));_0x466d63['attributes']=_0x466d63[_0x993e('0x32')]['length']?_0x466d63[_0x993e('0x32')]:_0x4a4f00[_0x993e('0x31')];if(!_0x48d457[_0x993e('0x2f')][_0x993e('0x33')](_0x993e('0x34'))){_0x466d63[_0x993e('0x1f')]=qs[_0x993e('0x1f')](_0x48d457[_0x993e('0x2f')][_0x993e('0x1f')]);_0x466d63[_0x993e('0x1d')]=qs[_0x993e('0x1d')](_0x48d457[_0x993e('0x2f')][_0x993e('0x1d')]);}_0x466d63[_0x993e('0x35')]=qs[_0x993e('0x36')](_0x48d457['query'][_0x993e('0x36')]);_0x466d63[_0x993e('0x37')]=qs[_0x993e('0x38')](_[_0x993e('0x39')](_0x48d457[_0x993e('0x2f')],_0x4a4f00[_0x993e('0x38')]),_0x46670a);if(_0x48d457[_0x993e('0x2f')][_0x993e('0x3a')]){_0x466d63[_0x993e('0x37')]=_['merge'](_0x466d63[_0x993e('0x37')],{'$or':_['map'](_0x46670a,function(_0xf79f29){if(_0xf79f29[_0x993e('0x2d')]!==_0x993e('0x3b')){var _0x406f14={};_0x406f14[_0xf79f29[_0x993e('0x28')]]={'$like':'%'+_0x48d457[_0x993e('0x2f')][_0x993e('0x3a')]+'%'};return _0x406f14;}})});}_0x466d63=_[_0x993e('0x3c')]({},_0x466d63,_0x48d457['options']);var _0x186d55={'where':_0x466d63['where']};return db[_0x993e('0x3d')]['count'](_0x186d55)[_0x993e('0x25')](function(_0xbd9983){_0x223af0[_0x993e('0x20')]=_0xbd9983;if(_0x48d457[_0x993e('0x2f')][_0x993e('0x3e')]){_0x466d63[_0x993e('0x3f')]=[{'all':!![]}];}return db[_0x993e('0x3d')][_0x993e('0x40')](_0x466d63);})['then'](function(_0xe64c){_0x223af0['rows']=_0xe64c;return _0x223af0;})['then'](respondWithFilteredResult(_0x32e332,_0x466d63))[_0x993e('0x41')](handleError(_0x32e332,null));};exports[_0x993e('0x42')]=function(_0x1f058f,_0x5ed497){var _0x620b26={'raw':!![],'where':{'id':_0x1f058f[_0x993e('0x43')]['id']}},_0x40719d={};_0x40719d['model']=_['keys'](db['MailQueueReport'][_0x993e('0x2b')]);_0x40719d[_0x993e('0x2f')]=_[_0x993e('0x44')](_0x1f058f['query']);_0x40719d[_0x993e('0x38')]=_[_0x993e('0x30')](_0x40719d['model'],_0x40719d[_0x993e('0x2f')]);_0x620b26[_0x993e('0x32')]=_['intersection'](_0x40719d[_0x993e('0x31')],qs[_0x993e('0x45')](_0x1f058f[_0x993e('0x2f')]['fields']));_0x620b26['attributes']=_0x620b26['attributes'][_0x993e('0x46')]?_0x620b26[_0x993e('0x32')]:_0x40719d[_0x993e('0x31')];if(_0x1f058f[_0x993e('0x2f')]['includeAll']){_0x620b26[_0x993e('0x3f')]=[{'all':!![]}];}_0x620b26=_[_0x993e('0x3c')]({},_0x620b26,_0x1f058f[_0x993e('0x47')]);return db[_0x993e('0x3d')][_0x993e('0x48')](_0x620b26)[_0x993e('0x25')](handleEntityNotFound(_0x5ed497,null))['then'](respondWithResult(_0x5ed497,null))['catch'](handleError(_0x5ed497,null));};exports[_0x993e('0x49')]=function(_0x416f9f,_0x4d560d){return db['MailQueueReport'][_0x993e('0x49')](_0x416f9f[_0x993e('0x4a')],{})[_0x993e('0x25')](respondWithResult(_0x4d560d,0xc9))[_0x993e('0x41')](handleError(_0x4d560d,null));};exports[_0x993e('0x4b')]=function(_0x256ce3,_0x5b18e3){if(_0x256ce3[_0x993e('0x4a')]['id']){delete _0x256ce3['body']['id'];}return db[_0x993e('0x3d')][_0x993e('0x48')]({'where':{'id':_0x256ce3[_0x993e('0x43')]['id']}})[_0x993e('0x25')](handleEntityNotFound(_0x5b18e3,null))[_0x993e('0x25')](saveUpdates(_0x256ce3[_0x993e('0x4a')],null))[_0x993e('0x25')](respondWithResult(_0x5b18e3,null))[_0x993e('0x41')](handleError(_0x5b18e3,null));};exports['destroy']=function(_0x23f09c,_0x66ee65){return db[_0x993e('0x3d')]['find']({'where':{'id':_0x23f09c[_0x993e('0x43')]['id']}})['then'](handleEntityNotFound(_0x66ee65,null))[_0x993e('0x25')](removeEntity(_0x66ee65,null))[_0x993e('0x41')](handleError(_0x66ee65,null));};exports['describe']=function(_0xb2508b,_0xef78a1){return db['MailQueueReport'][_0x993e('0x4c')]()[_0x993e('0x25')](respondWithResult(_0xef78a1,null))[_0x993e('0x41')](handleError(_0xef78a1,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(_0x2005db,_0x340824){var _0x2bf6f6=function(_0x1cb7f3){while(--_0x1cb7f3){_0x2005db['push'](_0x2005db['shift']());}};_0x2bf6f6(++_0x340824);}(_0xfcbb,0x10d));var _0xbfcb=function(_0x40c59a,_0x190bf0){_0x40c59a=_0x40c59a-0x0;var _0x3546d0=_0xfcbb[_0x40c59a];return _0x3546d0;};'use strict';var emlformat=require(_0xbfcb('0x0'));var rimraf=require(_0xbfcb('0x1'));var zipdir=require(_0xbfcb('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xbfcb('0x3'));var BPromise=require(_0xbfcb('0x4'));var Mustache=require(_0xbfcb('0x5'));var util=require(_0xbfcb('0x6'));var path=require(_0xbfcb('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xbfcb('0x8'));var fs=require('fs');var fs_extra=require(_0xbfcb('0x9'));var _=require(_0xbfcb('0xa'));var squel=require(_0xbfcb('0xb'));var crypto=require(_0xbfcb('0xc'));var jsforce=require(_0xbfcb('0xd'));var deskjs=require(_0xbfcb('0xe'));var toCsv=require('to-csv');var querystring=require(_0xbfcb('0xf'));var Papa=require(_0xbfcb('0x10'));var Redis=require(_0xbfcb('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xbfcb('0x12'));var as=require(_0xbfcb('0x13'));var hardwareService=require(_0xbfcb('0x14'));var logger=require(_0xbfcb('0x15'))(_0xbfcb('0x16'));var utils=require(_0xbfcb('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xbfcb('0x18'));var db=require(_0xbfcb('0x19'))['db'];function respondWithStatusCode(_0xb2f601,_0x2268da){_0x2268da=_0x2268da||0xcc;return function(_0x4ba4f1){if(_0x4ba4f1){return _0xb2f601[_0xbfcb('0x1a')](_0x2268da);}return _0xb2f601['status'](_0x2268da)[_0xbfcb('0x1b')]();};}function respondWithResult(_0x1c52df,_0x44ad6c){_0x44ad6c=_0x44ad6c||0xc8;return function(_0x1047c4){if(_0x1047c4){return _0x1c52df[_0xbfcb('0x1c')](_0x44ad6c)[_0xbfcb('0x1d')](_0x1047c4);}};}function respondWithFilteredResult(_0x71304e,_0x2d314a){return function(_0x90ed8c){if(_0x90ed8c){var _0x339347=typeof _0x2d314a[_0xbfcb('0x1e')]===_0xbfcb('0x1f')&&typeof _0x2d314a[_0xbfcb('0x20')]===_0xbfcb('0x1f');var _0x318d07=_0x90ed8c[_0xbfcb('0x21')];var _0xba1d6=_0x339347?0x0:_0x2d314a[_0xbfcb('0x1e')];var _0x3404aa=_0x339347?_0x90ed8c[_0xbfcb('0x21')]:_0x2d314a[_0xbfcb('0x1e')]+_0x2d314a[_0xbfcb('0x20')];var _0x53c9e0;if(_0x3404aa>=_0x318d07){_0x3404aa=_0x318d07;_0x53c9e0=0xc8;}else{_0x53c9e0=0xce;}_0x71304e[_0xbfcb('0x1c')](_0x53c9e0);return _0x71304e[_0xbfcb('0x22')]('Content-Range',_0xba1d6+'-'+_0x3404aa+'/'+_0x318d07)[_0xbfcb('0x1d')](_0x90ed8c);}return null;};}function patchUpdates(_0x1a7225){return function(_0x48c3c8){try{jsonpatch['apply'](_0x48c3c8,_0x1a7225,!![]);}catch(_0x4199c5){return BPromise[_0xbfcb('0x23')](_0x4199c5);}return _0x48c3c8[_0xbfcb('0x24')]();};}function saveUpdates(_0x45661a,_0x1c5924){return function(_0x56c158){if(_0x56c158){return _0x56c158[_0xbfcb('0x25')](_0x45661a)[_0xbfcb('0x26')](function(_0x2d9288){return _0x2d9288;});}return null;};}function removeEntity(_0xd4d29,_0x1651e5){return function(_0x19616c){if(_0x19616c){return _0x19616c[_0xbfcb('0x27')]()[_0xbfcb('0x26')](function(){_0xd4d29[_0xbfcb('0x1c')](0xcc)[_0xbfcb('0x1b')]();});}};}function handleEntityNotFound(_0x1ca8c3,_0xf6dbb7){return function(_0x3ef71c){if(!_0x3ef71c){_0x1ca8c3[_0xbfcb('0x1a')](0x194);}return _0x3ef71c;};}function handleError(_0x3e954d,_0x2a1272){_0x2a1272=_0x2a1272||0x1f4;return function(_0x5cd703){logger[_0xbfcb('0x28')](_0x5cd703[_0xbfcb('0x29')]);if(_0x5cd703['name']){delete _0x5cd703[_0xbfcb('0x2a')];}_0x3e954d[_0xbfcb('0x1c')](_0x2a1272)[_0xbfcb('0x2b')](_0x5cd703);};}exports[_0xbfcb('0x2c')]=function(_0xf4b944,_0x3542e9){var _0x4069a7={},_0x1a5db2={},_0x434764={'count':0x0,'rows':[]};var _0x27606f=_['map'](db[_0xbfcb('0x2d')][_0xbfcb('0x2e')],function(_0x43c3c3){return{'name':_0x43c3c3[_0xbfcb('0x2f')],'type':_0x43c3c3[_0xbfcb('0x30')][_0xbfcb('0x31')]};});_0x1a5db2[_0xbfcb('0x32')]=_[_0xbfcb('0x33')](_0x27606f,_0xbfcb('0x2a'));_0x1a5db2['query']=_[_0xbfcb('0x34')](_0xf4b944[_0xbfcb('0x35')]);_0x1a5db2[_0xbfcb('0x36')]=_[_0xbfcb('0x37')](_0x1a5db2['model'],_0x1a5db2['query']);_0x4069a7[_0xbfcb('0x38')]=_[_0xbfcb('0x37')](_0x1a5db2[_0xbfcb('0x32')],qs[_0xbfcb('0x39')](_0xf4b944[_0xbfcb('0x35')][_0xbfcb('0x39')]));_0x4069a7[_0xbfcb('0x38')]=_0x4069a7['attributes']['length']?_0x4069a7['attributes']:_0x1a5db2[_0xbfcb('0x32')];if(!_0xf4b944['query'][_0xbfcb('0x3a')](_0xbfcb('0x3b'))){_0x4069a7['limit']=qs['limit'](_0xf4b944[_0xbfcb('0x35')][_0xbfcb('0x20')]);_0x4069a7[_0xbfcb('0x1e')]=qs[_0xbfcb('0x1e')](_0xf4b944['query'][_0xbfcb('0x1e')]);}_0x4069a7[_0xbfcb('0x3c')]=qs['sort'](_0xf4b944['query'][_0xbfcb('0x3d')]);_0x4069a7['where']=qs['filters'](_[_0xbfcb('0x3e')](_0xf4b944[_0xbfcb('0x35')],_0x1a5db2[_0xbfcb('0x36')]),_0x27606f);if(_0xf4b944[_0xbfcb('0x35')]['filter']){_0x4069a7[_0xbfcb('0x3f')]=_[_0xbfcb('0x40')](_0x4069a7[_0xbfcb('0x3f')],{'$or':_[_0xbfcb('0x33')](_0x27606f,function(_0x2289fd){if(_0x2289fd[_0xbfcb('0x30')]!=='VIRTUAL'){var _0x2fc01f={};_0x2fc01f[_0x2289fd['name']]={'$like':'%'+_0xf4b944[_0xbfcb('0x35')]['filter']+'%'};return _0x2fc01f;}})});}_0x4069a7=_[_0xbfcb('0x40')]({},_0x4069a7,_0xf4b944[_0xbfcb('0x41')]);var _0xe719cd={'where':_0x4069a7[_0xbfcb('0x3f')]};return db[_0xbfcb('0x2d')][_0xbfcb('0x21')](_0xe719cd)[_0xbfcb('0x26')](function(_0x149bd5){_0x434764[_0xbfcb('0x21')]=_0x149bd5;if(_0xf4b944[_0xbfcb('0x35')]['includeAll']){_0x4069a7[_0xbfcb('0x42')]=[{'all':!![]}];}return db[_0xbfcb('0x2d')]['findAll'](_0x4069a7);})[_0xbfcb('0x26')](function(_0x306ea4){_0x434764[_0xbfcb('0x43')]=_0x306ea4;return _0x434764;})[_0xbfcb('0x26')](respondWithFilteredResult(_0x3542e9,_0x4069a7))[_0xbfcb('0x44')](handleError(_0x3542e9,null));};exports[_0xbfcb('0x45')]=function(_0x500e7c,_0x96691c){var _0x10ffa0={'raw':!![],'where':{'id':_0x500e7c['params']['id']}},_0x10ea4f={};_0x10ea4f[_0xbfcb('0x32')]=_[_0xbfcb('0x34')](db[_0xbfcb('0x2d')]['rawAttributes']);_0x10ea4f[_0xbfcb('0x35')]=_[_0xbfcb('0x34')](_0x500e7c['query']);_0x10ea4f['filters']=_[_0xbfcb('0x37')](_0x10ea4f[_0xbfcb('0x32')],_0x10ea4f['query']);_0x10ffa0[_0xbfcb('0x38')]=_[_0xbfcb('0x37')](_0x10ea4f['model'],qs[_0xbfcb('0x39')](_0x500e7c[_0xbfcb('0x35')][_0xbfcb('0x39')]));_0x10ffa0[_0xbfcb('0x38')]=_0x10ffa0[_0xbfcb('0x38')][_0xbfcb('0x46')]?_0x10ffa0[_0xbfcb('0x38')]:_0x10ea4f[_0xbfcb('0x32')];if(_0x500e7c[_0xbfcb('0x35')][_0xbfcb('0x47')]){_0x10ffa0[_0xbfcb('0x42')]=[{'all':!![]}];}_0x10ffa0=_[_0xbfcb('0x40')]({},_0x10ffa0,_0x500e7c['options']);return db[_0xbfcb('0x2d')][_0xbfcb('0x48')](_0x10ffa0)[_0xbfcb('0x26')](handleEntityNotFound(_0x96691c,null))['then'](respondWithResult(_0x96691c,null))[_0xbfcb('0x44')](handleError(_0x96691c,null));};exports['create']=function(_0x4a3b40,_0x2dcfb3){return db[_0xbfcb('0x2d')][_0xbfcb('0x49')](_0x4a3b40['body'],{})[_0xbfcb('0x26')](respondWithResult(_0x2dcfb3,0xc9))['catch'](handleError(_0x2dcfb3,null));};exports['update']=function(_0x33725a,_0x588d32){if(_0x33725a[_0xbfcb('0x4a')]['id']){delete _0x33725a[_0xbfcb('0x4a')]['id'];}return db['MailQueueReport'][_0xbfcb('0x48')]({'where':{'id':_0x33725a['params']['id']}})[_0xbfcb('0x26')](handleEntityNotFound(_0x588d32,null))['then'](saveUpdates(_0x33725a[_0xbfcb('0x4a')],null))['then'](respondWithResult(_0x588d32,null))[_0xbfcb('0x44')](handleError(_0x588d32,null));};exports[_0xbfcb('0x27')]=function(_0x5efbe1,_0x131af7){return db['MailQueueReport']['find']({'where':{'id':_0x5efbe1[_0xbfcb('0x4b')]['id']}})[_0xbfcb('0x26')](handleEntityNotFound(_0x131af7,null))[_0xbfcb('0x26')](removeEntity(_0x131af7,null))['catch'](handleError(_0x131af7,null));};exports['describe']=function(_0x19dca9,_0x931bf){return db[_0xbfcb('0x2d')][_0xbfcb('0x4c')]()[_0xbfcb('0x26')](respondWithResult(_0x931bf,null))['catch'](handleError(_0x931bf,null));}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index 47a4afa..b061307 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 _0x8cbe=['../../config/logger','api','moment','path','rimraf','../../config/environment','./mailQueueReport.attributes','exports','MailQueueReport','report_mail_queue','uniqueid','lodash'];(function(_0x2197fa,_0x13590e){var _0xc2da70=function(_0x2a57e3){while(--_0x2a57e3){_0x2197fa['push'](_0x2197fa['shift']());}};_0xc2da70(++_0x13590e);}(_0x8cbe,0x14f));var _0xe8cb=function(_0x40aaee,_0x4bea67){_0x40aaee=_0x40aaee-0x0;var _0x18e0ed=_0x8cbe[_0x40aaee];return _0x18e0ed;};'use strict';var _=require(_0xe8cb('0x0'));var util=require('util');var logger=require(_0xe8cb('0x1'))(_0xe8cb('0x2'));var moment=require(_0xe8cb('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xe8cb('0x4'));var rimraf=require(_0xe8cb('0x5'));var config=require(_0xe8cb('0x6'));var attributes=require(_0xe8cb('0x7'));module[_0xe8cb('0x8')]=function(_0x554ff3,_0x4afe46){return _0x554ff3['define'](_0xe8cb('0x9'),attributes,{'tableName':_0xe8cb('0xa'),'paranoid':![],'indexes':[{'name':_0xe8cb('0xb'),'fields':[_0xe8cb('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd2ae=['uniqueid','util','../../config/logger','moment','request-promise','path','rimraf','./mailQueueReport.attributes','exports','define','MailQueueReport','report_mail_queue'];(function(_0x222b01,_0x13389c){var _0x2e3211=function(_0x85733a){while(--_0x85733a){_0x222b01['push'](_0x222b01['shift']());}};_0x2e3211(++_0x13389c);}(_0xd2ae,0x91));var _0xed2a=function(_0x11a1e4,_0x4c43ac){_0x11a1e4=_0x11a1e4-0x0;var _0x547c63=_0xd2ae[_0x11a1e4];return _0x547c63;};'use strict';var _=require('lodash');var util=require(_0xed2a('0x0'));var logger=require(_0xed2a('0x1'))('api');var moment=require(_0xed2a('0x2'));var BPromise=require('bluebird');var rp=require(_0xed2a('0x3'));var fs=require('fs');var path=require(_0xed2a('0x4'));var rimraf=require(_0xed2a('0x5'));var config=require('../../config/environment');var attributes=require(_0xed2a('0x6'));module[_0xed2a('0x7')]=function(_0xbcc416,_0xb1d3a4){return _0xbcc416[_0xed2a('0x8')](_0xed2a('0x9'),attributes,{'tableName':_0xed2a('0xa'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xed2a('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.rpc.js b/server/api/mailQueueReport/mailQueueReport.rpc.js index b83405b..e4755a0 100644 --- a/server/api/mailQueueReport/mailQueueReport.rpc.js +++ b/server/api/mailQueueReport/mailQueueReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2ef3=['options','raw','UpdateMailQueueReport','where','attributes','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','info','MailQueueReport,\x20%s,\x20%s','MailQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','CreateMailQueueReport','MailQueueReport','body'];(function(_0x137d80,_0x4ca815){var _0x406c15=function(_0x1f0e13){while(--_0x1f0e13){_0x137d80['push'](_0x137d80['shift']());}};_0x406c15(++_0x4ca815);}(_0x2ef3,0xba));var _0x32ef=function(_0x579c98,_0x1990cf){_0x579c98=_0x579c98-0x0;var _0x59f6c0=_0x2ef3[_0x579c98];return _0x59f6c0;};'use strict';var _=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var moment=require(_0x32ef('0x2'));var BPromise=require(_0x32ef('0x3'));var rs=require(_0x32ef('0x4'));var fs=require('fs');var Redis=require(_0x32ef('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x32ef('0x6'));var logger=require(_0x32ef('0x7'))('rpc');var config=require(_0x32ef('0x8'));var jayson=require(_0x32ef('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2c0089,_0x4bfcf8,_0x367c39){return new BPromise(function(_0x2fb8eb,_0x234863){return client[_0x32ef('0xa')](_0x2c0089,_0x367c39)[_0x32ef('0xb')](function(_0x2bbb50){logger[_0x32ef('0xc')](_0x32ef('0xd'),_0x4bfcf8,'request\x20sent');logger['debug'](_0x32ef('0xe'),_0x4bfcf8,_0x32ef('0xf'),JSON[_0x32ef('0x10')](_0x2bbb50));if(_0x2bbb50[_0x32ef('0x11')]){if(_0x2bbb50['error'][_0x32ef('0x12')]===0x1f4){logger['error'](_0x32ef('0xd'),_0x4bfcf8,_0x2bbb50['error'][_0x32ef('0x13')]);return _0x234863(_0x2bbb50[_0x32ef('0x11')]['message']);}logger['error'](_0x32ef('0xd'),_0x4bfcf8,_0x2bbb50['error'][_0x32ef('0x13')]);return _0x2fb8eb(_0x2bbb50[_0x32ef('0x11')][_0x32ef('0x13')]);}else{logger[_0x32ef('0xc')]('MailQueueReport,\x20%s,\x20%s',_0x4bfcf8,'request\x20sent');_0x2fb8eb(_0x2bbb50['result'][_0x32ef('0x13')]);}})[_0x32ef('0x14')](function(_0xb5aed2){logger['error']('MailQueueReport,\x20%s,\x20%s',_0x4bfcf8,_0xb5aed2);_0x234863(_0xb5aed2);});});}exports[_0x32ef('0x15')]=function(_0x1a9476){var _0x286bfb=this;return new Promise(function(_0x57863c,_0xbe37f6){return db[_0x32ef('0x16')]['create'](_0x1a9476[_0x32ef('0x17')],{'raw':_0x1a9476[_0x32ef('0x18')]?_0x1a9476[_0x32ef('0x18')][_0x32ef('0x19')]===undefined?!![]:![]:!![]})[_0x32ef('0xb')](function(_0x3aec05){logger['info'](_0x32ef('0x15'),_0x1a9476);logger['debug'](_0x32ef('0x15'),_0x1a9476,JSON[_0x32ef('0x10')](_0x3aec05));_0x57863c(_0x3aec05);})['catch'](function(_0x1af371){logger[_0x32ef('0x11')](_0x32ef('0x15'),_0x1af371['message'],_0x1a9476);_0xbe37f6(_0x286bfb['error'](0x1f4,_0x1af371[_0x32ef('0x13')]));});});};exports[_0x32ef('0x1a')]=function(_0x225feb){var _0x478bef=this;return new Promise(function(_0x59585f,_0x19ea6){return db['MailQueueReport']['update'](_0x225feb[_0x32ef('0x17')],{'raw':_0x225feb[_0x32ef('0x18')]?_0x225feb[_0x32ef('0x18')][_0x32ef('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x225feb[_0x32ef('0x18')]?_0x225feb[_0x32ef('0x18')][_0x32ef('0x1b')]||null:null,'attributes':_0x225feb[_0x32ef('0x18')]?_0x225feb[_0x32ef('0x18')][_0x32ef('0x1c')]||null:null,'limit':_0x225feb[_0x32ef('0x18')]?_0x225feb[_0x32ef('0x18')]['limit']||null:null})[_0x32ef('0xb')](function(_0x2f5d06){logger['info'](_0x32ef('0x1a'),_0x225feb);logger[_0x32ef('0x1d')](_0x32ef('0x1a'),_0x225feb,JSON[_0x32ef('0x10')](_0x2f5d06));_0x59585f(_0x2f5d06);})['catch'](function(_0x10e38c){logger[_0x32ef('0x11')](_0x32ef('0x1a'),_0x10e38c[_0x32ef('0x13')],_0x225feb);_0x19ea6(_0x478bef[_0x32ef('0x11')](0x1f4,_0x10e38c[_0x32ef('0x13')]));});});}; \ No newline at end of file +var _0x2ef3=['options','raw','UpdateMailQueueReport','where','attributes','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','info','MailQueueReport,\x20%s,\x20%s','MailQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','CreateMailQueueReport','MailQueueReport','body'];(function(_0x25f686,_0x199629){var _0x54ad10=function(_0x1f9083){while(--_0x1f9083){_0x25f686['push'](_0x25f686['shift']());}};_0x54ad10(++_0x199629);}(_0x2ef3,0xba));var _0x32ef=function(_0x22517d,_0x1f9659){_0x22517d=_0x22517d-0x0;var _0x11e60b=_0x2ef3[_0x22517d];return _0x11e60b;};'use strict';var _=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var moment=require(_0x32ef('0x2'));var BPromise=require(_0x32ef('0x3'));var rs=require(_0x32ef('0x4'));var fs=require('fs');var Redis=require(_0x32ef('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x32ef('0x6'));var logger=require(_0x32ef('0x7'))('rpc');var config=require(_0x32ef('0x8'));var jayson=require(_0x32ef('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2c0089,_0x4bfcf8,_0x367c39){return new BPromise(function(_0x2fb8eb,_0x234863){return client[_0x32ef('0xa')](_0x2c0089,_0x367c39)[_0x32ef('0xb')](function(_0x2bbb50){logger[_0x32ef('0xc')](_0x32ef('0xd'),_0x4bfcf8,'request\x20sent');logger['debug'](_0x32ef('0xe'),_0x4bfcf8,_0x32ef('0xf'),JSON[_0x32ef('0x10')](_0x2bbb50));if(_0x2bbb50[_0x32ef('0x11')]){if(_0x2bbb50['error'][_0x32ef('0x12')]===0x1f4){logger['error'](_0x32ef('0xd'),_0x4bfcf8,_0x2bbb50['error'][_0x32ef('0x13')]);return _0x234863(_0x2bbb50[_0x32ef('0x11')]['message']);}logger['error'](_0x32ef('0xd'),_0x4bfcf8,_0x2bbb50['error'][_0x32ef('0x13')]);return _0x2fb8eb(_0x2bbb50[_0x32ef('0x11')][_0x32ef('0x13')]);}else{logger[_0x32ef('0xc')]('MailQueueReport,\x20%s,\x20%s',_0x4bfcf8,'request\x20sent');_0x2fb8eb(_0x2bbb50['result'][_0x32ef('0x13')]);}})[_0x32ef('0x14')](function(_0xb5aed2){logger['error']('MailQueueReport,\x20%s,\x20%s',_0x4bfcf8,_0xb5aed2);_0x234863(_0xb5aed2);});});}exports[_0x32ef('0x15')]=function(_0x1a9476){var _0x286bfb=this;return new Promise(function(_0x57863c,_0xbe37f6){return db[_0x32ef('0x16')]['create'](_0x1a9476[_0x32ef('0x17')],{'raw':_0x1a9476[_0x32ef('0x18')]?_0x1a9476[_0x32ef('0x18')][_0x32ef('0x19')]===undefined?!![]:![]:!![]})[_0x32ef('0xb')](function(_0x3aec05){logger['info'](_0x32ef('0x15'),_0x1a9476);logger['debug'](_0x32ef('0x15'),_0x1a9476,JSON[_0x32ef('0x10')](_0x3aec05));_0x57863c(_0x3aec05);})['catch'](function(_0x1af371){logger[_0x32ef('0x11')](_0x32ef('0x15'),_0x1af371['message'],_0x1a9476);_0xbe37f6(_0x286bfb['error'](0x1f4,_0x1af371[_0x32ef('0x13')]));});});};exports[_0x32ef('0x1a')]=function(_0x225feb){var _0x478bef=this;return new Promise(function(_0x59585f,_0x19ea6){return db['MailQueueReport']['update'](_0x225feb[_0x32ef('0x17')],{'raw':_0x225feb[_0x32ef('0x18')]?_0x225feb[_0x32ef('0x18')][_0x32ef('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x225feb[_0x32ef('0x18')]?_0x225feb[_0x32ef('0x18')][_0x32ef('0x1b')]||null:null,'attributes':_0x225feb[_0x32ef('0x18')]?_0x225feb[_0x32ef('0x18')][_0x32ef('0x1c')]||null:null,'limit':_0x225feb[_0x32ef('0x18')]?_0x225feb[_0x32ef('0x18')]['limit']||null:null})[_0x32ef('0xb')](function(_0x2f5d06){logger['info'](_0x32ef('0x1a'),_0x225feb);logger[_0x32ef('0x1d')](_0x32ef('0x1a'),_0x225feb,JSON[_0x32ef('0x10')](_0x2f5d06));_0x59585f(_0x2f5d06);})['catch'](function(_0x10e38c){logger[_0x32ef('0x11')](_0x32ef('0x1a'),_0x10e38c[_0x32ef('0x13')],_0x225feb);_0x19ea6(_0x478bef[_0x32ef('0x11')](0x1f4,_0x10e38c[_0x32ef('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerIn/index.js b/server/api/mailServerIn/index.js index 63aaac2..56dc7fc 100644 --- a/server/api/mailServerIn/index.js +++ b/server/api/mailServerIn/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x5cde43,_0x5b96e2){var _0x73a1d0=function(_0x29ccea){while(--_0x29ccea){_0x5cde43['push'](_0x5cde43['shift']());}};_0x73a1d0(++_0x5b96e2);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file +var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x5bf704,_0x2bb565){var _0xf3daf8=function(_0x55e495){while(--_0x55e495){_0x5bf704['push'](_0x5bf704['shift']());}};_0xf3daf8(++_0x2bb565);}(_0xe706,0xa3));var _0x6e70=function(_0x6c40ba,_0x5e39fa){_0x6c40ba=_0x6c40ba-0x0;var _0x7a54dd=_0xe706[_0x6c40ba];return _0x7a54dd;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.attributes.js b/server/api/mailServerIn/mailServerIn.attributes.js index 2fbd3d5..9204022 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 _0x94df=['INBOX','sequelize','exports','STRING','BOOLEAN','INTEGER'];(function(_0x1b4d12,_0x32469c){var _0x24bced=function(_0x16a5c6){while(--_0x16a5c6){_0x1b4d12['push'](_0x1b4d12['shift']());}};_0x24bced(++_0x32469c);}(_0x94df,0xa3));var _0xf94d=function(_0x270189,_0x814b50){_0x270189=_0x270189-0x0;var _0x121150=_0x94df[_0x270189];return _0x121150;};'use strict';var Sequelize=require(_0xf94d('0x0'));module[_0xf94d('0x1')]={'description':{'type':Sequelize[_0xf94d('0x2')]},'host':{'type':Sequelize[_0xf94d('0x2')]},'authentication':{'type':Sequelize[_0xf94d('0x3')],'defaultValue':!![]},'user':{'type':Sequelize[_0xf94d('0x2')]},'password':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0xf94d('0x4')]},'tls':{'type':Sequelize[_0xf94d('0x3')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0xf94d('0x2')],'defaultValue':_0xf94d('0x5')},'connTimeout':{'type':Sequelize[_0xf94d('0x4')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0xf94d('0x4')],'defaultValue':0x5},'service':{'type':Sequelize[_0xf94d('0x2')]}}; \ No newline at end of file +var _0x049e=['INTEGER','BOOLEAN','sequelize','exports','STRING'];(function(_0x133fc0,_0x1edda8){var _0x4ce619=function(_0x308be5){while(--_0x308be5){_0x133fc0['push'](_0x133fc0['shift']());}};_0x4ce619(++_0x1edda8);}(_0x049e,0x16a));var _0xe049=function(_0xd336fa,_0x39d1b2){_0xd336fa=_0xd336fa-0x0;var _0x3370b1=_0x049e[_0xd336fa];return _0x3370b1;};'use strict';var Sequelize=require(_0xe049('0x0'));module[_0xe049('0x1')]={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0xe049('0x2')]},'authentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'user':{'type':Sequelize[_0xe049('0x2')]},'password':{'type':Sequelize[_0xe049('0x2')]},'port':{'type':Sequelize[_0xe049('0x3')]},'tls':{'type':Sequelize[_0xe049('0x4')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0xe049('0x2')],'defaultValue':'INBOX'},'connTimeout':{'type':Sequelize[_0xe049('0x3')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0xe049('0x3')],'defaultValue':0x5},'service':{'type':Sequelize[_0xe049('0x2')]}}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.model.js b/server/api/mailServerIn/mailServerIn.model.js index dc0bc53..6bdfd10 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 _0x308d=['./mailServerIn.attributes','exports','define','MailServerIn','lodash','util','api','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x4792c8,_0x5158a1){var _0x35edb1=function(_0x2472d3){while(--_0x2472d3){_0x4792c8['push'](_0x4792c8['shift']());}};_0x35edb1(++_0x5158a1);}(_0x308d,0x94));var _0xd308=function(_0x2f13f2,_0x1d795f){_0x2f13f2=_0x2f13f2-0x0;var _0x202927=_0x308d[_0x2f13f2];return _0x202927;};'use strict';var _=require(_0xd308('0x0'));var util=require(_0xd308('0x1'));var logger=require('../../config/logger')(_0xd308('0x2'));var moment=require(_0xd308('0x3'));var BPromise=require(_0xd308('0x4'));var rp=require(_0xd308('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd308('0x6'));var config=require(_0xd308('0x7'));var attributes=require(_0xd308('0x8'));module[_0xd308('0x9')]=function(_0x32552f,_0x1ec86e){return _0x32552f[_0xd308('0xa')](_0xd308('0xb'),attributes,{'tableName':'mail_servers_in','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5c50=['define','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./mailServerIn.attributes','exports'];(function(_0x258eaa,_0xcce177){var _0x5a4641=function(_0xdc0b8d){while(--_0xdc0b8d){_0x258eaa['push'](_0x258eaa['shift']());}};_0x5a4641(++_0xcce177);}(_0x5c50,0xf3));var _0x05c5=function(_0xbced40,_0x2fa5f0){_0xbced40=_0xbced40-0x0;var _0x230f2e=_0x5c50[_0xbced40];return _0x230f2e;};'use strict';var _=require(_0x05c5('0x0'));var util=require(_0x05c5('0x1'));var logger=require(_0x05c5('0x2'))('api');var moment=require('moment');var BPromise=require(_0x05c5('0x3'));var rp=require(_0x05c5('0x4'));var fs=require('fs');var path=require(_0x05c5('0x5'));var rimraf=require(_0x05c5('0x6'));var config=require(_0x05c5('0x7'));var attributes=require(_0x05c5('0x8'));module[_0x05c5('0x9')]=function(_0x319938,_0x111511){return _0x319938[_0x05c5('0xa')]('MailServerIn',attributes,{'tableName':'mail_servers_in','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.rpc.js b/server/api/mailServerIn/mailServerIn.rpc.js index e230266..e420da8 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 _0xa68c=['stringify','error','code','message','result','catch','GetMailServerIn','MailServerIn','findAll','options','raw','where','limit','include','map','model','attributes','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','request','then','info','MailServerIn,\x20%s,\x20%s','request\x20sent','debug'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xa68c,0x187));var _0xca68=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xa68c[_0x6c993a];return _0x27f547;};'use strict';var _=require(_0xca68('0x0'));var util=require(_0xca68('0x1'));var moment=require(_0xca68('0x2'));var BPromise=require(_0xca68('0x3'));var rs=require(_0xca68('0x4'));var fs=require('fs');var Redis=require(_0xca68('0x5'));var db=require(_0xca68('0x6'))['db'];var utils=require(_0xca68('0x7'));var logger=require(_0xca68('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0xca68('0x9'));var client=jayson['client'][_0xca68('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x346ed0,_0x3af3d8,_0x2e13c0){return new BPromise(function(_0x3a6783,_0x2ec4d3){return client[_0xca68('0xb')](_0x346ed0,_0x2e13c0)[_0xca68('0xc')](function(_0xe88c70){logger[_0xca68('0xd')](_0xca68('0xe'),_0x3af3d8,_0xca68('0xf'));logger[_0xca68('0x10')]('MailServerIn,\x20%s,\x20%s,\x20%s',_0x3af3d8,'request\x20sent',JSON[_0xca68('0x11')](_0xe88c70));if(_0xe88c70[_0xca68('0x12')]){if(_0xe88c70[_0xca68('0x12')][_0xca68('0x13')]===0x1f4){logger[_0xca68('0x12')](_0xca68('0xe'),_0x3af3d8,_0xe88c70['error'][_0xca68('0x14')]);return _0x2ec4d3(_0xe88c70[_0xca68('0x12')][_0xca68('0x14')]);}logger['error'](_0xca68('0xe'),_0x3af3d8,_0xe88c70['error'][_0xca68('0x14')]);return _0x3a6783(_0xe88c70[_0xca68('0x12')]['message']);}else{logger['info'](_0xca68('0xe'),_0x3af3d8,_0xca68('0xf'));_0x3a6783(_0xe88c70[_0xca68('0x15')][_0xca68('0x14')]);}})[_0xca68('0x16')](function(_0x207cbb){logger[_0xca68('0x12')](_0xca68('0xe'),_0x3af3d8,_0x207cbb);_0x2ec4d3(_0x207cbb);});});}exports[_0xca68('0x17')]=function(_0x21806e){var _0x9221a5=this;return new Promise(function(_0x1ccbf0,_0x30e34f){return db[_0xca68('0x18')][_0xca68('0x19')]({'raw':_0x21806e[_0xca68('0x1a')]?_0x21806e['options'][_0xca68('0x1b')]===undefined?!![]:![]:!![],'where':_0x21806e['options']?_0x21806e[_0xca68('0x1a')][_0xca68('0x1c')]||null:null,'attributes':_0x21806e[_0xca68('0x1a')]?_0x21806e['options']['attributes']||null:null,'limit':_0x21806e['options']?_0x21806e[_0xca68('0x1a')][_0xca68('0x1d')]||null:null,'include':_0x21806e[_0xca68('0x1a')]?_0x21806e[_0xca68('0x1a')][_0xca68('0x1e')]?_[_0xca68('0x1f')](_0x21806e[_0xca68('0x1a')]['include'],function(_0x1b2f41){return{'model':db[_0x1b2f41[_0xca68('0x20')]],'as':_0x1b2f41['as'],'attributes':_0x1b2f41[_0xca68('0x21')],'include':_0x1b2f41['include']?_['map'](_0x1b2f41[_0xca68('0x1e')],function(_0x4ccd8c){return{'model':db[_0x4ccd8c['model']],'as':_0x4ccd8c['as'],'attributes':_0x4ccd8c[_0xca68('0x21')],'include':_0x4ccd8c['include']?_[_0xca68('0x1f')](_0x4ccd8c[_0xca68('0x1e')],function(_0x2ebfe0){return{'model':db[_0x2ebfe0['model']],'as':_0x2ebfe0['as'],'attributes':_0x2ebfe0[_0xca68('0x21')]};}):[]};}):[]};}):[]:[]})[_0xca68('0xc')](function(_0x2844f9){logger[_0xca68('0xd')](_0xca68('0x17'),_0x21806e);logger[_0xca68('0x10')](_0xca68('0x17'),_0x21806e,JSON[_0xca68('0x11')](_0x2844f9));_0x1ccbf0(_0x2844f9);})['catch'](function(_0x51bd6f){logger[_0xca68('0x12')]('GetMailServerIn',_0x51bd6f[_0xca68('0x14')],_0x21806e);_0x30e34f(_0x9221a5[_0xca68('0x12')](0x1f4,_0x51bd6f[_0xca68('0x14')]));});});}; \ No newline at end of file +var _0xb11e=['message','result','GetMailServerIn','options','where','attributes','map','model','include','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','info','MailServerIn,\x20%s,\x20%s','request\x20sent','debug','MailServerIn,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x75b25d,_0x3fbae3){var _0x3400de=function(_0x380c27){while(--_0x380c27){_0x75b25d['push'](_0x75b25d['shift']());}};_0x3400de(++_0x3fbae3);}(_0xb11e,0x7d));var _0xeb11=function(_0x40d4ff,_0x36fa97){_0x40d4ff=_0x40d4ff-0x0;var _0x296811=_0xb11e[_0x40d4ff];return _0x296811;};'use strict';var _=require(_0xeb11('0x0'));var util=require(_0xeb11('0x1'));var moment=require(_0xeb11('0x2'));var BPromise=require(_0xeb11('0x3'));var rs=require(_0xeb11('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xeb11('0x5'));var logger=require(_0xeb11('0x6'))(_0xeb11('0x7'));var config=require(_0xeb11('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xeb11('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x53b7a1,_0x203d78,_0x4994a2){return new BPromise(function(_0x5e5648,_0xfa9ff7){return client[_0xeb11('0xa')](_0x53b7a1,_0x4994a2)[_0xeb11('0xb')](function(_0x4841d3){logger[_0xeb11('0xc')](_0xeb11('0xd'),_0x203d78,_0xeb11('0xe'));logger[_0xeb11('0xf')](_0xeb11('0x10'),_0x203d78,_0xeb11('0xe'),JSON[_0xeb11('0x11')](_0x4841d3));if(_0x4841d3[_0xeb11('0x12')]){if(_0x4841d3['error'][_0xeb11('0x13')]===0x1f4){logger[_0xeb11('0x12')](_0xeb11('0xd'),_0x203d78,_0x4841d3['error'][_0xeb11('0x14')]);return _0xfa9ff7(_0x4841d3['error'][_0xeb11('0x14')]);}logger['error']('MailServerIn,\x20%s,\x20%s',_0x203d78,_0x4841d3[_0xeb11('0x12')][_0xeb11('0x14')]);return _0x5e5648(_0x4841d3[_0xeb11('0x12')][_0xeb11('0x14')]);}else{logger['info']('MailServerIn,\x20%s,\x20%s',_0x203d78,_0xeb11('0xe'));_0x5e5648(_0x4841d3[_0xeb11('0x15')][_0xeb11('0x14')]);}})['catch'](function(_0x23acb4){logger['error'](_0xeb11('0xd'),_0x203d78,_0x23acb4);_0xfa9ff7(_0x23acb4);});});}exports[_0xeb11('0x16')]=function(_0x139ff8){var _0x4b2a4a=this;return new Promise(function(_0xf36770,_0x2ef18b){return db['MailServerIn']['findAll']({'raw':_0x139ff8[_0xeb11('0x17')]?_0x139ff8[_0xeb11('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x139ff8['options']?_0x139ff8[_0xeb11('0x17')][_0xeb11('0x18')]||null:null,'attributes':_0x139ff8['options']?_0x139ff8['options'][_0xeb11('0x19')]||null:null,'limit':_0x139ff8['options']?_0x139ff8['options']['limit']||null:null,'include':_0x139ff8[_0xeb11('0x17')]?_0x139ff8[_0xeb11('0x17')]['include']?_[_0xeb11('0x1a')](_0x139ff8[_0xeb11('0x17')]['include'],function(_0x1c526d){return{'model':db[_0x1c526d[_0xeb11('0x1b')]],'as':_0x1c526d['as'],'attributes':_0x1c526d[_0xeb11('0x19')],'include':_0x1c526d['include']?_[_0xeb11('0x1a')](_0x1c526d['include'],function(_0x5b97b5){return{'model':db[_0x5b97b5[_0xeb11('0x1b')]],'as':_0x5b97b5['as'],'attributes':_0x5b97b5[_0xeb11('0x19')],'include':_0x5b97b5[_0xeb11('0x1c')]?_['map'](_0x5b97b5['include'],function(_0xca08dd){return{'model':db[_0xca08dd['model']],'as':_0xca08dd['as'],'attributes':_0xca08dd[_0xeb11('0x19')]};}):[]};}):[]};}):[]:[]})[_0xeb11('0xb')](function(_0x377abf){logger[_0xeb11('0xc')](_0xeb11('0x16'),_0x139ff8);logger['debug'](_0xeb11('0x16'),_0x139ff8,JSON[_0xeb11('0x11')](_0x377abf));_0xf36770(_0x377abf);})['catch'](function(_0x104561){logger['error'](_0xeb11('0x16'),_0x104561[_0xeb11('0x14')],_0x139ff8);_0x2ef18b(_0x4b2a4a[_0xeb11('0x12')](0x1f4,_0x104561[_0xeb11('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index 21b5823..5548471 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(_0x3a6efd,_0x2a5102){var _0x487b9a=function(_0x104f89){while(--_0x104f89){_0x3a6efd['push'](_0x3a6efd['shift']());}};_0x487b9a(++_0x2a5102);}(_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 _0x7a54=['index','/:id','isAuthenticated','post','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailServerOut.controller','get'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0x7a54,0x106));var _0x47a5=function(_0x57165c,_0x492e1d){_0x57165c=_0x57165c-0x0;var _0x5c5b56=_0x7a54[_0x57165c];return _0x5c5b56;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x47a5('0x5'));var interaction=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var controller=require(_0x47a5('0x8'));router[_0x47a5('0x9')]('/',auth['isAuthenticated'](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['show']);router[_0x47a5('0xd')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['update']);router[_0x47a5('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x47a5('0xf')]);module[_0x47a5('0x10')]=router; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.attributes.js b/server/api/mailServerOut/mailServerOut.attributes.js index 23ac202..7ff2a36 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 _0xa4fc=['STRING','INTEGER','BOOLEAN','sequelize','exports'];(function(_0x6ffa12,_0x45a92a){var _0x17b047=function(_0x1bf1f6){while(--_0x1bf1f6){_0x6ffa12['push'](_0x6ffa12['shift']());}};_0x17b047(++_0x45a92a);}(_0xa4fc,0x12f));var _0xca4f=function(_0x101779,_0x5b879c){_0x101779=_0x101779-0x0;var _0x277029=_0xa4fc[_0x101779];return _0x277029;};'use strict';var Sequelize=require(_0xca4f('0x0'));module[_0xca4f('0x1')]={'description':{'type':Sequelize[_0xca4f('0x2')]},'host':{'type':Sequelize['STRING']},'user':{'type':Sequelize[_0xca4f('0x2')]},'pass':{'type':Sequelize[_0xca4f('0x2')]},'port':{'type':Sequelize[_0xca4f('0x3')]},'secure':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'service':{'type':Sequelize[_0xca4f('0x2')]},'authentication':{'type':Sequelize[_0xca4f('0x4')],'defaultValue':!![]}}; \ No newline at end of file +var _0x2bd4=['exports','STRING','BOOLEAN','sequelize'];(function(_0x57c8ba,_0x727b85){var _0x12411d=function(_0x18d56c){while(--_0x18d56c){_0x57c8ba['push'](_0x57c8ba['shift']());}};_0x12411d(++_0x727b85);}(_0x2bd4,0x103));var _0x42bd=function(_0x4e8378,_0x5c2ccc){_0x4e8378=_0x4e8378-0x0;var _0x546419=_0x2bd4[_0x4e8378];return _0x546419;};'use strict';var Sequelize=require(_0x42bd('0x0'));module[_0x42bd('0x1')]={'description':{'type':Sequelize[_0x42bd('0x2')]},'host':{'type':Sequelize[_0x42bd('0x2')]},'user':{'type':Sequelize[_0x42bd('0x2')]},'pass':{'type':Sequelize[_0x42bd('0x2')]},'port':{'type':Sequelize['INTEGER']},'secure':{'type':Sequelize[_0x42bd('0x3')],'defaultValue':![]},'service':{'type':Sequelize[_0x42bd('0x2')]},'authentication':{'type':Sequelize[_0x42bd('0x3')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.controller.js b/server/api/mailServerOut/mailServerOut.controller.js index a1e2558..724635f 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 _0x6fdf=['count','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','MailServerOut','rawAttributes','fieldName','type','key','query','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','keys','length','find','create','body','eml-format','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','limit','undefined'];(function(_0x5b7250,_0x13aa90){var _0x327181=function(_0x32daa3){while(--_0x32daa3){_0x5b7250['push'](_0x5b7250['shift']());}};_0x327181(++_0x13aa90);}(_0x6fdf,0x1b0));var _0xf6fd=function(_0x37e5ab,_0x2a45b2){_0x37e5ab=_0x37e5ab-0x0;var _0x25f15b=_0x6fdf[_0x37e5ab];return _0x25f15b;};'use strict';var emlformat=require(_0xf6fd('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf6fd('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf6fd('0x2'));var moment=require(_0xf6fd('0x3'));var BPromise=require(_0xf6fd('0x4'));var Mustache=require('mustache');var util=require(_0xf6fd('0x5'));var path=require(_0xf6fd('0x6'));var sox=require(_0xf6fd('0x7'));var csv=require(_0xf6fd('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf6fd('0x9'));var _=require('lodash');var squel=require(_0xf6fd('0xa'));var crypto=require(_0xf6fd('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xf6fd('0xc'));var toCsv=require('to-csv');var querystring=require(_0xf6fd('0xd'));var Papa=require('papaparse');var Redis=require(_0xf6fd('0xe'));var authService=require(_0xf6fd('0xf'));var qs=require(_0xf6fd('0x10'));var as=require(_0xf6fd('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf6fd('0x12'))(_0xf6fd('0x13'));var utils=require(_0xf6fd('0x14'));var config=require(_0xf6fd('0x15'));var licenseUtil=require(_0xf6fd('0x16'));var db=require(_0xf6fd('0x17'))['db'];function respondWithStatusCode(_0x285f32,_0x56788a){_0x56788a=_0x56788a||0xcc;return function(_0x96b25b){if(_0x96b25b){return _0x285f32['sendStatus'](_0x56788a);}return _0x285f32[_0xf6fd('0x18')](_0x56788a)[_0xf6fd('0x19')]();};}function respondWithResult(_0x23bc51,_0x238253){_0x238253=_0x238253||0xc8;return function(_0xb24a5d){if(_0xb24a5d){return _0x23bc51[_0xf6fd('0x18')](_0x238253)[_0xf6fd('0x1a')](_0xb24a5d);}};}function respondWithFilteredResult(_0x316ed6,_0x328175){return function(_0x4ac802){if(_0x4ac802){var _0x1b5351=typeof _0x328175[_0xf6fd('0x1b')]==='undefined'&&typeof _0x328175[_0xf6fd('0x1c')]===_0xf6fd('0x1d');var _0x48bd49=_0x4ac802['count'];var _0x279567=_0x1b5351?0x0:_0x328175['offset'];var _0x358d02=_0x1b5351?_0x4ac802[_0xf6fd('0x1e')]:_0x328175['offset']+_0x328175[_0xf6fd('0x1c')];var _0x5dd0e8;if(_0x358d02>=_0x48bd49){_0x358d02=_0x48bd49;_0x5dd0e8=0xc8;}else{_0x5dd0e8=0xce;}_0x316ed6[_0xf6fd('0x18')](_0x5dd0e8);return _0x316ed6[_0xf6fd('0x1f')](_0xf6fd('0x20'),_0x279567+'-'+_0x358d02+'/'+_0x48bd49)['json'](_0x4ac802);}return null;};}function patchUpdates(_0x122e37){return function(_0x1469b5){try{jsonpatch[_0xf6fd('0x21')](_0x1469b5,_0x122e37,!![]);}catch(_0x4e89b4){return BPromise[_0xf6fd('0x22')](_0x4e89b4);}return _0x1469b5[_0xf6fd('0x23')]();};}function saveUpdates(_0x1d96f6,_0xb1726){return function(_0x3d0670){if(_0x3d0670){return _0x3d0670[_0xf6fd('0x24')](_0x1d96f6)[_0xf6fd('0x25')](function(_0x25d494){return _0x25d494;});}return null;};}function removeEntity(_0x30e766,_0xc12018){return function(_0x1df792){if(_0x1df792){return _0x1df792[_0xf6fd('0x26')]()['then'](function(){_0x30e766[_0xf6fd('0x18')](0xcc)[_0xf6fd('0x19')]();});}};}function handleEntityNotFound(_0x5790bf,_0x4bd413){return function(_0x3490ad){if(!_0x3490ad){_0x5790bf[_0xf6fd('0x27')](0x194);}return _0x3490ad;};}function handleError(_0x51b14a,_0x175ba5){_0x175ba5=_0x175ba5||0x1f4;return function(_0x30dfe2){logger[_0xf6fd('0x28')](_0x30dfe2[_0xf6fd('0x29')]);if(_0x30dfe2[_0xf6fd('0x2a')]){delete _0x30dfe2[_0xf6fd('0x2a')];}_0x51b14a[_0xf6fd('0x18')](_0x175ba5)[_0xf6fd('0x2b')](_0x30dfe2);};}exports[_0xf6fd('0x2c')]=function(_0x5c15ca,_0x1802e6){var _0x5b1b78={},_0x1e99cc={},_0x40d216={'count':0x0,'rows':[]};var _0x2b8b7d=_[_0xf6fd('0x2d')](db[_0xf6fd('0x2e')][_0xf6fd('0x2f')],function(_0x222a07){return{'name':_0x222a07[_0xf6fd('0x30')],'type':_0x222a07[_0xf6fd('0x31')][_0xf6fd('0x32')]};});_0x1e99cc['model']=_[_0xf6fd('0x2d')](_0x2b8b7d,_0xf6fd('0x2a'));_0x1e99cc[_0xf6fd('0x33')]=_['keys'](_0x5c15ca['query']);_0x1e99cc['filters']=_[_0xf6fd('0x34')](_0x1e99cc[_0xf6fd('0x35')],_0x1e99cc[_0xf6fd('0x33')]);_0x5b1b78[_0xf6fd('0x36')]=_['intersection'](_0x1e99cc['model'],qs[_0xf6fd('0x37')](_0x5c15ca['query']['fields']));_0x5b1b78[_0xf6fd('0x36')]=_0x5b1b78['attributes']['length']?_0x5b1b78[_0xf6fd('0x36')]:_0x1e99cc[_0xf6fd('0x35')];if(!_0x5c15ca[_0xf6fd('0x33')][_0xf6fd('0x38')](_0xf6fd('0x39'))){_0x5b1b78['limit']=qs[_0xf6fd('0x1c')](_0x5c15ca[_0xf6fd('0x33')][_0xf6fd('0x1c')]);_0x5b1b78[_0xf6fd('0x1b')]=qs[_0xf6fd('0x1b')](_0x5c15ca[_0xf6fd('0x33')][_0xf6fd('0x1b')]);}_0x5b1b78[_0xf6fd('0x3a')]=qs['sort'](_0x5c15ca[_0xf6fd('0x33')]['sort']);_0x5b1b78[_0xf6fd('0x3b')]=qs[_0xf6fd('0x3c')](_[_0xf6fd('0x3d')](_0x5c15ca[_0xf6fd('0x33')],_0x1e99cc[_0xf6fd('0x3c')]),_0x2b8b7d);if(_0x5c15ca[_0xf6fd('0x33')][_0xf6fd('0x3e')]){_0x5b1b78['where']=_[_0xf6fd('0x3f')](_0x5b1b78[_0xf6fd('0x3b')],{'$or':_[_0xf6fd('0x2d')](_0x2b8b7d,function(_0x3ffbe5){if(_0x3ffbe5['type']!==_0xf6fd('0x40')){var _0x9a092e={};_0x9a092e[_0x3ffbe5[_0xf6fd('0x2a')]]={'$like':'%'+_0x5c15ca[_0xf6fd('0x33')][_0xf6fd('0x3e')]+'%'};return _0x9a092e;}})});}_0x5b1b78=_['merge']({},_0x5b1b78,_0x5c15ca[_0xf6fd('0x41')]);var _0x3d84bd={'where':_0x5b1b78[_0xf6fd('0x3b')]};return db['MailServerOut'][_0xf6fd('0x1e')](_0x3d84bd)[_0xf6fd('0x25')](function(_0x4219a2){_0x40d216[_0xf6fd('0x1e')]=_0x4219a2;if(_0x5c15ca[_0xf6fd('0x33')][_0xf6fd('0x42')]){_0x5b1b78[_0xf6fd('0x43')]=[{'all':!![]}];}return db[_0xf6fd('0x2e')]['findAll'](_0x5b1b78);})[_0xf6fd('0x25')](function(_0x6f080){_0x40d216[_0xf6fd('0x44')]=_0x6f080;return _0x40d216;})[_0xf6fd('0x25')](respondWithFilteredResult(_0x1802e6,_0x5b1b78))[_0xf6fd('0x45')](handleError(_0x1802e6,null));};exports[_0xf6fd('0x46')]=function(_0x20492e,_0x552482){var _0x2c356a={'raw':!![],'where':{'id':_0x20492e[_0xf6fd('0x47')]['id']}},_0x2bd751={};_0x2bd751[_0xf6fd('0x35')]=_[_0xf6fd('0x48')](db[_0xf6fd('0x2e')][_0xf6fd('0x2f')]);_0x2bd751[_0xf6fd('0x33')]=_[_0xf6fd('0x48')](_0x20492e['query']);_0x2bd751[_0xf6fd('0x3c')]=_[_0xf6fd('0x34')](_0x2bd751[_0xf6fd('0x35')],_0x2bd751[_0xf6fd('0x33')]);_0x2c356a[_0xf6fd('0x36')]=_[_0xf6fd('0x34')](_0x2bd751[_0xf6fd('0x35')],qs[_0xf6fd('0x37')](_0x20492e['query'][_0xf6fd('0x37')]));_0x2c356a[_0xf6fd('0x36')]=_0x2c356a['attributes'][_0xf6fd('0x49')]?_0x2c356a[_0xf6fd('0x36')]:_0x2bd751[_0xf6fd('0x35')];if(_0x20492e[_0xf6fd('0x33')][_0xf6fd('0x42')]){_0x2c356a[_0xf6fd('0x43')]=[{'all':!![]}];}_0x2c356a=_[_0xf6fd('0x3f')]({},_0x2c356a,_0x20492e[_0xf6fd('0x41')]);return db['MailServerOut'][_0xf6fd('0x4a')](_0x2c356a)[_0xf6fd('0x25')](handleEntityNotFound(_0x552482,null))[_0xf6fd('0x25')](respondWithResult(_0x552482,null))[_0xf6fd('0x45')](handleError(_0x552482,null));};exports[_0xf6fd('0x4b')]=function(_0x3c68a4,_0x49bdad){return db[_0xf6fd('0x2e')][_0xf6fd('0x4b')](_0x3c68a4[_0xf6fd('0x4c')],{})[_0xf6fd('0x25')](respondWithResult(_0x49bdad,0xc9))[_0xf6fd('0x45')](handleError(_0x49bdad,null));};exports[_0xf6fd('0x24')]=function(_0x3116c5,_0x42ca22){if(_0x3116c5[_0xf6fd('0x4c')]['id']){delete _0x3116c5[_0xf6fd('0x4c')]['id'];}return db['MailServerOut'][_0xf6fd('0x4a')]({'where':{'id':_0x3116c5[_0xf6fd('0x47')]['id']}})['then'](handleEntityNotFound(_0x42ca22,null))['then'](saveUpdates(_0x3116c5[_0xf6fd('0x4c')],null))[_0xf6fd('0x25')](respondWithResult(_0x42ca22,null))[_0xf6fd('0x45')](handleError(_0x42ca22,null));};exports['destroy']=function(_0x5ca3fd,_0x22d045){return db[_0xf6fd('0x2e')]['find']({'where':{'id':_0x5ca3fd['params']['id']}})[_0xf6fd('0x25')](handleEntityNotFound(_0x22d045,null))[_0xf6fd('0x25')](removeEntity(_0x22d045,null))[_0xf6fd('0x45')](handleError(_0x22d045,null));}; \ No newline at end of file +var _0x89b5=['offset','count','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','MailServerOut','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','limit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','include','find','create','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json'];(function(_0x589f05,_0x1c5a16){var _0x3a11b4=function(_0x1ec7fb){while(--_0x1ec7fb){_0x589f05['push'](_0x589f05['shift']());}};_0x3a11b4(++_0x1c5a16);}(_0x89b5,0x195));var _0x589b=function(_0x35d469,_0x4b319e){_0x35d469=_0x35d469-0x0;var _0xab1023=_0x89b5[_0x35d469];return _0xab1023;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x589b('0x0'));var zipdir=require(_0x589b('0x1'));var jsonpatch=require(_0x589b('0x2'));var rp=require(_0x589b('0x3'));var moment=require(_0x589b('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x589b('0x5'));var csv=require(_0x589b('0x6'));var ejs=require(_0x589b('0x7'));var fs=require('fs');var fs_extra=require(_0x589b('0x8'));var _=require(_0x589b('0x9'));var squel=require(_0x589b('0xa'));var crypto=require(_0x589b('0xb'));var jsforce=require(_0x589b('0xc'));var deskjs=require(_0x589b('0xd'));var toCsv=require(_0x589b('0x6'));var querystring=require('querystring');var Papa=require(_0x589b('0xe'));var Redis=require(_0x589b('0xf'));var authService=require(_0x589b('0x10'));var qs=require(_0x589b('0x11'));var as=require(_0x589b('0x12'));var hardwareService=require(_0x589b('0x13'));var logger=require(_0x589b('0x14'))('api');var utils=require(_0x589b('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x589b('0x16'));var db=require(_0x589b('0x17'))['db'];function respondWithStatusCode(_0x447253,_0x5d78bd){_0x5d78bd=_0x5d78bd||0xcc;return function(_0x4007ca){if(_0x4007ca){return _0x447253[_0x589b('0x18')](_0x5d78bd);}return _0x447253[_0x589b('0x19')](_0x5d78bd)['end']();};}function respondWithResult(_0x2862c7,_0x72d6f6){_0x72d6f6=_0x72d6f6||0xc8;return function(_0x539f90){if(_0x539f90){return _0x2862c7[_0x589b('0x19')](_0x72d6f6)[_0x589b('0x1a')](_0x539f90);}};}function respondWithFilteredResult(_0xaedeed,_0x1cd515){return function(_0x22045b){if(_0x22045b){var _0x3d64ff=typeof _0x1cd515[_0x589b('0x1b')]==='undefined'&&typeof _0x1cd515['limit']==='undefined';var _0x2f9586=_0x22045b[_0x589b('0x1c')];var _0x36589e=_0x3d64ff?0x0:_0x1cd515[_0x589b('0x1b')];var _0x2b58e0=_0x3d64ff?_0x22045b[_0x589b('0x1c')]:_0x1cd515[_0x589b('0x1b')]+_0x1cd515['limit'];var _0x30fe12;if(_0x2b58e0>=_0x2f9586){_0x2b58e0=_0x2f9586;_0x30fe12=0xc8;}else{_0x30fe12=0xce;}_0xaedeed[_0x589b('0x19')](_0x30fe12);return _0xaedeed['set'](_0x589b('0x1d'),_0x36589e+'-'+_0x2b58e0+'/'+_0x2f9586)[_0x589b('0x1a')](_0x22045b);}return null;};}function patchUpdates(_0x54a1ac){return function(_0x26fccd){try{jsonpatch[_0x589b('0x1e')](_0x26fccd,_0x54a1ac,!![]);}catch(_0x24f22b){return BPromise[_0x589b('0x1f')](_0x24f22b);}return _0x26fccd[_0x589b('0x20')]();};}function saveUpdates(_0x1afa99,_0x53bc6a){return function(_0x10cb1e){if(_0x10cb1e){return _0x10cb1e[_0x589b('0x21')](_0x1afa99)[_0x589b('0x22')](function(_0x49d3e7){return _0x49d3e7;});}return null;};}function removeEntity(_0x8cdc96,_0x495b68){return function(_0x5431d8){if(_0x5431d8){return _0x5431d8[_0x589b('0x23')]()[_0x589b('0x22')](function(){_0x8cdc96['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x33ad97,_0x3f10e8){return function(_0x666aa9){if(!_0x666aa9){_0x33ad97[_0x589b('0x18')](0x194);}return _0x666aa9;};}function handleError(_0x36f24a,_0x5ed0a0){_0x5ed0a0=_0x5ed0a0||0x1f4;return function(_0x2c9d45){logger[_0x589b('0x24')](_0x2c9d45[_0x589b('0x25')]);if(_0x2c9d45[_0x589b('0x26')]){delete _0x2c9d45[_0x589b('0x26')];}_0x36f24a[_0x589b('0x19')](_0x5ed0a0)[_0x589b('0x27')](_0x2c9d45);};}exports[_0x589b('0x28')]=function(_0x27c908,_0x51e856){var _0x58da74={},_0x5d8c81={},_0x51bd73={'count':0x0,'rows':[]};var _0x3a161f=_[_0x589b('0x29')](db[_0x589b('0x2a')]['rawAttributes'],function(_0xca558c){return{'name':_0xca558c[_0x589b('0x2b')],'type':_0xca558c[_0x589b('0x2c')][_0x589b('0x2d')]};});_0x5d8c81[_0x589b('0x2e')]=_[_0x589b('0x29')](_0x3a161f,_0x589b('0x26'));_0x5d8c81[_0x589b('0x2f')]=_[_0x589b('0x30')](_0x27c908[_0x589b('0x2f')]);_0x5d8c81[_0x589b('0x31')]=_[_0x589b('0x32')](_0x5d8c81[_0x589b('0x2e')],_0x5d8c81['query']);_0x58da74[_0x589b('0x33')]=_[_0x589b('0x32')](_0x5d8c81['model'],qs[_0x589b('0x34')](_0x27c908[_0x589b('0x2f')][_0x589b('0x34')]));_0x58da74[_0x589b('0x33')]=_0x58da74['attributes'][_0x589b('0x35')]?_0x58da74['attributes']:_0x5d8c81['model'];if(!_0x27c908[_0x589b('0x2f')]['hasOwnProperty']('nolimit')){_0x58da74['limit']=qs[_0x589b('0x36')](_0x27c908['query'][_0x589b('0x36')]);_0x58da74['offset']=qs[_0x589b('0x1b')](_0x27c908[_0x589b('0x2f')][_0x589b('0x1b')]);}_0x58da74[_0x589b('0x37')]=qs[_0x589b('0x38')](_0x27c908[_0x589b('0x2f')][_0x589b('0x38')]);_0x58da74[_0x589b('0x39')]=qs[_0x589b('0x31')](_['pick'](_0x27c908[_0x589b('0x2f')],_0x5d8c81[_0x589b('0x31')]),_0x3a161f);if(_0x27c908['query'][_0x589b('0x3a')]){_0x58da74[_0x589b('0x39')]=_[_0x589b('0x3b')](_0x58da74['where'],{'$or':_[_0x589b('0x29')](_0x3a161f,function(_0x1f714e){if(_0x1f714e[_0x589b('0x2c')]!==_0x589b('0x3c')){var _0x34e68c={};_0x34e68c[_0x1f714e[_0x589b('0x26')]]={'$like':'%'+_0x27c908[_0x589b('0x2f')][_0x589b('0x3a')]+'%'};return _0x34e68c;}})});}_0x58da74=_['merge']({},_0x58da74,_0x27c908[_0x589b('0x3d')]);var _0x952acc={'where':_0x58da74[_0x589b('0x39')]};return db[_0x589b('0x2a')][_0x589b('0x1c')](_0x952acc)['then'](function(_0x4bebc9){_0x51bd73[_0x589b('0x1c')]=_0x4bebc9;if(_0x27c908[_0x589b('0x2f')][_0x589b('0x3e')]){_0x58da74['include']=[{'all':!![]}];}return db[_0x589b('0x2a')][_0x589b('0x3f')](_0x58da74);})[_0x589b('0x22')](function(_0x27d6d8){_0x51bd73[_0x589b('0x40')]=_0x27d6d8;return _0x51bd73;})[_0x589b('0x22')](respondWithFilteredResult(_0x51e856,_0x58da74))[_0x589b('0x41')](handleError(_0x51e856,null));};exports[_0x589b('0x42')]=function(_0x59b089,_0x36fc8a){var _0x71df7d={'raw':!![],'where':{'id':_0x59b089[_0x589b('0x43')]['id']}},_0x5dc1ef={};_0x5dc1ef[_0x589b('0x2e')]=_[_0x589b('0x30')](db[_0x589b('0x2a')]['rawAttributes']);_0x5dc1ef[_0x589b('0x2f')]=_['keys'](_0x59b089['query']);_0x5dc1ef['filters']=_[_0x589b('0x32')](_0x5dc1ef[_0x589b('0x2e')],_0x5dc1ef[_0x589b('0x2f')]);_0x71df7d[_0x589b('0x33')]=_[_0x589b('0x32')](_0x5dc1ef[_0x589b('0x2e')],qs[_0x589b('0x34')](_0x59b089[_0x589b('0x2f')][_0x589b('0x34')]));_0x71df7d['attributes']=_0x71df7d[_0x589b('0x33')]['length']?_0x71df7d['attributes']:_0x5dc1ef[_0x589b('0x2e')];if(_0x59b089['query'][_0x589b('0x3e')]){_0x71df7d[_0x589b('0x44')]=[{'all':!![]}];}_0x71df7d=_[_0x589b('0x3b')]({},_0x71df7d,_0x59b089[_0x589b('0x3d')]);return db['MailServerOut'][_0x589b('0x45')](_0x71df7d)[_0x589b('0x22')](handleEntityNotFound(_0x36fc8a,null))[_0x589b('0x22')](respondWithResult(_0x36fc8a,null))[_0x589b('0x41')](handleError(_0x36fc8a,null));};exports[_0x589b('0x46')]=function(_0x4e3bc9,_0x4d0a79){return db[_0x589b('0x2a')][_0x589b('0x46')](_0x4e3bc9[_0x589b('0x47')],{})[_0x589b('0x22')](respondWithResult(_0x4d0a79,0xc9))['catch'](handleError(_0x4d0a79,null));};exports[_0x589b('0x21')]=function(_0x3482a2,_0x1a3548){if(_0x3482a2['body']['id']){delete _0x3482a2[_0x589b('0x47')]['id'];}return db[_0x589b('0x2a')][_0x589b('0x45')]({'where':{'id':_0x3482a2[_0x589b('0x43')]['id']}})['then'](handleEntityNotFound(_0x1a3548,null))[_0x589b('0x22')](saveUpdates(_0x3482a2[_0x589b('0x47')],null))['then'](respondWithResult(_0x1a3548,null))['catch'](handleError(_0x1a3548,null));};exports['destroy']=function(_0x1dfe14,_0xc19859){return db[_0x589b('0x2a')]['find']({'where':{'id':_0x1dfe14[_0x589b('0x43')]['id']}})[_0x589b('0x22')](handleEntityNotFound(_0xc19859,null))[_0x589b('0x22')](removeEntity(_0xc19859,null))['catch'](handleError(_0xc19859,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index 465c9f5..fd06b00 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 _0x8d6a=['path','rimraf','../../config/environment','./mailServerOut.attributes','exports','MailServerOut','mail_servers_out','lodash','util','../../config/logger','api','moment'];(function(_0x2f9263,_0x7c1100){var _0x5f1d47=function(_0xde84a2){while(--_0xde84a2){_0x2f9263['push'](_0x2f9263['shift']());}};_0x5f1d47(++_0x7c1100);}(_0x8d6a,0x193));var _0xa8d6=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0x8d6a[_0x110c3d];return _0x226d67;};'use strict';var _=require(_0xa8d6('0x0'));var util=require(_0xa8d6('0x1'));var logger=require(_0xa8d6('0x2'))(_0xa8d6('0x3'));var moment=require(_0xa8d6('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xa8d6('0x5'));var rimraf=require(_0xa8d6('0x6'));var config=require(_0xa8d6('0x7'));var attributes=require(_0xa8d6('0x8'));module[_0xa8d6('0x9')]=function(_0x286876,_0x39da63){return _0x286876['define'](_0xa8d6('0xa'),attributes,{'tableName':_0xa8d6('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xce6a=['define','mail_servers_out','lodash','api','moment','bluebird','request-promise','path','rimraf','./mailServerOut.attributes','exports'];(function(_0x4a3466,_0x35fb36){var _0x52baa2=function(_0x4a5b03){while(--_0x4a5b03){_0x4a3466['push'](_0x4a3466['shift']());}};_0x52baa2(++_0x35fb36);}(_0xce6a,0x65));var _0xace6=function(_0x5db61c,_0x1f4f1c){_0x5db61c=_0x5db61c-0x0;var _0x5347c9=_0xce6a[_0x5db61c];return _0x5347c9;};'use strict';var _=require(_0xace6('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xace6('0x1'));var moment=require(_0xace6('0x2'));var BPromise=require(_0xace6('0x3'));var rp=require(_0xace6('0x4'));var fs=require('fs');var path=require(_0xace6('0x5'));var rimraf=require(_0xace6('0x6'));var config=require('../../config/environment');var attributes=require(_0xace6('0x7'));module[_0xace6('0x8')]=function(_0x19dd5c,_0x4b16a7){return _0x19dd5c[_0xace6('0x9')]('MailServerOut',attributes,{'tableName':_0xace6('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.rpc.js b/server/api/mailServerOut/mailServerOut.rpc.js index d08c89e..3ca9481 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 _0xc4aa=['moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','request','then','MailServerOut,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','catch','lodash','util'];(function(_0x5da00c,_0x1f1e0f){var _0x379332=function(_0x4ebc04){while(--_0x4ebc04){_0x5da00c['push'](_0x5da00c['shift']());}};_0x379332(++_0x1f1e0f);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0xc4aa[_0x199572];return _0x13cfa3;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var moment=require(_0xac4a('0x2'));var BPromise=require(_0xac4a('0x3'));var rs=require(_0xac4a('0x4'));var fs=require('fs');var Redis=require(_0xac4a('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xac4a('0x6'));var config=require(_0xac4a('0x7'));var jayson=require(_0xac4a('0x8'));var client=jayson[_0xac4a('0x9')][_0xac4a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x15cd34,_0x3ef77c,_0x10525b){return new BPromise(function(_0x5c6179,_0x5b8339){return client[_0xac4a('0xb')](_0x15cd34,_0x10525b)[_0xac4a('0xc')](function(_0x26ec84){logger['info'](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));logger[_0xac4a('0xf')]('MailServerOut,\x20%s,\x20%s,\x20%s',_0x3ef77c,_0xac4a('0xe'),JSON['stringify'](_0x26ec84));if(_0x26ec84[_0xac4a('0x10')]){if(_0x26ec84['error'][_0xac4a('0x11')]===0x1f4){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84['error'][_0xac4a('0x12')]);return _0x5b8339(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);return _0x5c6179(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}else{logger[_0xac4a('0x13')](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));_0x5c6179(_0x26ec84['result'][_0xac4a('0x12')]);}})[_0xac4a('0x14')](function(_0x23eb66){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x23eb66);_0x5b8339(_0x23eb66);});});} \ No newline at end of file +var _0x5f2f=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','MailServerOut,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch'];(function(_0x81b249,_0x18f870){var _0xde41e6=function(_0x5dbdb0){while(--_0x5dbdb0){_0x81b249['push'](_0x81b249['shift']());}};_0xde41e6(++_0x18f870);}(_0x5f2f,0x73));var _0xf5f2=function(_0x5a40d5,_0x5adac9){_0x5a40d5=_0x5a40d5-0x0;var _0x4b2731=_0x5f2f[_0x5a40d5];return _0x4b2731;};'use strict';var _=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var moment=require(_0xf5f2('0x2'));var BPromise=require(_0xf5f2('0x3'));var rs=require(_0xf5f2('0x4'));var fs=require('fs');var Redis=require(_0xf5f2('0x5'));var db=require(_0xf5f2('0x6'))['db'];var utils=require(_0xf5f2('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xf5f2('0x8'));var jayson=require(_0xf5f2('0x9'));var client=jayson[_0xf5f2('0xa')][_0xf5f2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3133bc,_0x473100,_0x5907aa){return new BPromise(function(_0x466882,_0x46cd9c){return client[_0xf5f2('0xc')](_0x3133bc,_0x5907aa)['then'](function(_0x375da4){logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,'request\x20sent');logger[_0xf5f2('0xf')]('MailServerOut,\x20%s,\x20%s,\x20%s',_0x473100,'request\x20sent',JSON[_0xf5f2('0x10')](_0x375da4));if(_0x375da4[_0xf5f2('0x11')]){if(_0x375da4['error'][_0xf5f2('0x12')]===0x1f4){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x46cd9c(_0x375da4[_0xf5f2('0x11')]['message']);}logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x466882(_0x375da4[_0xf5f2('0x11')]['message']);}else{logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,_0xf5f2('0x14'));_0x466882(_0x375da4[_0xf5f2('0x15')][_0xf5f2('0x13')]);}})[_0xf5f2('0x16')](function(_0xdb61b3){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0xdb61b3);_0x46cd9c(_0xdb61b3);});});} \ No newline at end of file diff --git a/server/api/mailSubstatus/index.js b/server/api/mailSubstatus/index.js index 7a6215d..3417fdc 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 _0x8d97=['/describe','isAuthenticated','/:id','show','post','create','put','update','delete','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailSubstatus.controller','get','index'];(function(_0x529d93,_0x18017e){var _0x302538=function(_0x261dd0){while(--_0x261dd0){_0x529d93['push'](_0x529d93['shift']());}};_0x302538(++_0x18017e);}(_0x8d97,0x1ee));var _0x78d9=function(_0x171913,_0x14de92){_0x171913=_0x171913-0x0;var _0x58f132=_0x8d97[_0x171913];return _0x58f132;};'use strict';var multer=require(_0x78d9('0x0'));var util=require(_0x78d9('0x1'));var path=require(_0x78d9('0x2'));var timeout=require('connect-timeout');var express=require(_0x78d9('0x3'));var router=express[_0x78d9('0x4')]();var fs_extra=require(_0x78d9('0x5'));var auth=require(_0x78d9('0x6'));var interaction=require(_0x78d9('0x7'));var config=require(_0x78d9('0x8'));var controller=require(_0x78d9('0x9'));router[_0x78d9('0xa')]('/',auth['isAuthenticated'](),controller[_0x78d9('0xb')]);router[_0x78d9('0xa')](_0x78d9('0xc'),auth[_0x78d9('0xd')](),controller['describe']);router[_0x78d9('0xa')](_0x78d9('0xe'),auth[_0x78d9('0xd')](),controller[_0x78d9('0xf')]);router[_0x78d9('0x10')]('/',auth[_0x78d9('0xd')](),controller[_0x78d9('0x11')]);router[_0x78d9('0x12')](_0x78d9('0xe'),auth[_0x78d9('0xd')](),controller[_0x78d9('0x13')]);router[_0x78d9('0x14')](_0x78d9('0xe'),auth[_0x78d9('0xd')](),controller['destroy']);module[_0x78d9('0x15')]=router; \ No newline at end of file +var _0x2820=['create','put','update','delete','exports','util','path','express','../../config/environment','get','isAuthenticated','/describe','/:id','post'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x2820,0x1a9));var _0x0282=function(_0x136973,_0x479346){_0x136973=_0x136973-0x0;var _0x5459aa=_0x2820[_0x136973];return _0x5459aa;};'use strict';var multer=require('multer');var util=require(_0x0282('0x0'));var path=require(_0x0282('0x1'));var timeout=require('connect-timeout');var express=require(_0x0282('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x0282('0x3'));var controller=require('./mailSubstatus.controller');router[_0x0282('0x4')]('/',auth[_0x0282('0x5')](),controller['index']);router[_0x0282('0x4')](_0x0282('0x6'),auth[_0x0282('0x5')](),controller['describe']);router[_0x0282('0x4')](_0x0282('0x7'),auth['isAuthenticated'](),controller['show']);router[_0x0282('0x8')]('/',auth['isAuthenticated'](),controller[_0x0282('0x9')]);router[_0x0282('0xa')](_0x0282('0x7'),auth[_0x0282('0x5')](),controller[_0x0282('0xb')]);router[_0x0282('0xc')](_0x0282('0x7'),auth['isAuthenticated'](),controller['destroy']);module[_0x0282('0xd')]=router; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.attributes.js b/server/api/mailSubstatus/mailSubstatus.attributes.js index 9d4a906..7280fe7 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 _0xef17=['STRING','name','sequelize','exports'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xef17,0x136));var _0x7ef1=function(_0x4f8763,_0x4cb6b2){_0x4f8763=_0x4f8763-0x0;var _0x1cd4ee=_0xef17[_0x4f8763];return _0x1cd4ee;};'use strict';var Sequelize=require(_0x7ef1('0x0'));module[_0x7ef1('0x1')]={'name':{'type':Sequelize[_0x7ef1('0x2')],'unique':_0x7ef1('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x7ef1('0x2')]}}; \ No newline at end of file +var _0xdf98=['STRING','sequelize'];(function(_0x272d8b,_0x4a1218){var _0xce5c02=function(_0x379b25){while(--_0x379b25){_0x272d8b['push'](_0x272d8b['shift']());}};_0xce5c02(++_0x4a1218);}(_0xdf98,0xcf));var _0x8df9=function(_0x221a6f,_0x1674c8){_0x221a6f=_0x221a6f-0x0;var _0x3db53d=_0xdf98[_0x221a6f];return _0x3db53d;};'use strict';var Sequelize=require(_0x8df9('0x0'));module['exports']={'name':{'type':Sequelize[_0x8df9('0x1')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.controller.js b/server/api/mailSubstatus/mailSubstatus.controller.js index 787a6fb..4b3c2fb 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 _0x2a52=['params','find','catch','create','body','destroy','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','limit','undefined','count','offset','status','set','reject','save','update','then','stack','name','send','index','map','MailSubstatus','rawAttributes','fieldName','type','key','query','keys','intersection','model','attributes','fields','length','nolimit','sort','where','filters','pick','VIRTUAL','merge','options','includeAll','findAll','rows','show'];(function(_0x49e43d,_0x4a59e0){var _0x45135a=function(_0x384f85){while(--_0x384f85){_0x49e43d['push'](_0x49e43d['shift']());}};_0x45135a(++_0x4a59e0);}(_0x2a52,0x137));var _0x22a5=function(_0x3d0e66,_0x2d7452){_0x3d0e66=_0x3d0e66-0x0;var _0x9c2569=_0x2a52[_0x3d0e66];return _0x9c2569;};'use strict';var emlformat=require(_0x22a5('0x0'));var rimraf=require(_0x22a5('0x1'));var zipdir=require(_0x22a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x22a5('0x3'));var moment=require(_0x22a5('0x4'));var BPromise=require(_0x22a5('0x5'));var Mustache=require(_0x22a5('0x6'));var util=require(_0x22a5('0x7'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x22a5('0x8'));var _=require(_0x22a5('0x9'));var squel=require(_0x22a5('0xa'));var crypto=require(_0x22a5('0xb'));var jsforce=require(_0x22a5('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x22a5('0xd'));var querystring=require(_0x22a5('0xe'));var Papa=require(_0x22a5('0xf'));var Redis=require(_0x22a5('0x10'));var authService=require(_0x22a5('0x11'));var qs=require(_0x22a5('0x12'));var as=require(_0x22a5('0x13'));var hardwareService=require(_0x22a5('0x14'));var logger=require(_0x22a5('0x15'))(_0x22a5('0x16'));var utils=require(_0x22a5('0x17'));var config=require(_0x22a5('0x18'));var licenseUtil=require(_0x22a5('0x19'));var db=require(_0x22a5('0x1a'))['db'];function respondWithStatusCode(_0x538182,_0x5106df){_0x5106df=_0x5106df||0xcc;return function(_0x2d7e8c){if(_0x2d7e8c){return _0x538182[_0x22a5('0x1b')](_0x5106df);}return _0x538182['status'](_0x5106df)[_0x22a5('0x1c')]();};}function respondWithResult(_0x3a0942,_0x406b3a){_0x406b3a=_0x406b3a||0xc8;return function(_0x326dbc){if(_0x326dbc){return _0x3a0942['status'](_0x406b3a)[_0x22a5('0x1d')](_0x326dbc);}};}function respondWithFilteredResult(_0xd7a265,_0x59a4fe){return function(_0x295ae9){if(_0x295ae9){var _0xa320a1=typeof _0x59a4fe['offset']==='undefined'&&typeof _0x59a4fe[_0x22a5('0x1e')]===_0x22a5('0x1f');var _0x24fd6c=_0x295ae9[_0x22a5('0x20')];var _0xcd6c71=_0xa320a1?0x0:_0x59a4fe[_0x22a5('0x21')];var _0x5baf23=_0xa320a1?_0x295ae9['count']:_0x59a4fe[_0x22a5('0x21')]+_0x59a4fe[_0x22a5('0x1e')];var _0x2219d2;if(_0x5baf23>=_0x24fd6c){_0x5baf23=_0x24fd6c;_0x2219d2=0xc8;}else{_0x2219d2=0xce;}_0xd7a265[_0x22a5('0x22')](_0x2219d2);return _0xd7a265[_0x22a5('0x23')]('Content-Range',_0xcd6c71+'-'+_0x5baf23+'/'+_0x24fd6c)[_0x22a5('0x1d')](_0x295ae9);}return null;};}function patchUpdates(_0x135d14){return function(_0x4eda65){try{jsonpatch['apply'](_0x4eda65,_0x135d14,!![]);}catch(_0x1a3032){return BPromise[_0x22a5('0x24')](_0x1a3032);}return _0x4eda65[_0x22a5('0x25')]();};}function saveUpdates(_0x1ddcc7,_0x255f83){return function(_0x5dfa3d){if(_0x5dfa3d){return _0x5dfa3d[_0x22a5('0x26')](_0x1ddcc7)[_0x22a5('0x27')](function(_0x4e1e2d){return _0x4e1e2d;});}return null;};}function removeEntity(_0x15d1ae,_0x32d0f6){return function(_0x74e0b0){if(_0x74e0b0){return _0x74e0b0['destroy']()[_0x22a5('0x27')](function(){_0x15d1ae['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x48676e,_0x3e8a5a){return function(_0x370f46){if(!_0x370f46){_0x48676e[_0x22a5('0x1b')](0x194);}return _0x370f46;};}function handleError(_0x56f1d2,_0x29ce28){_0x29ce28=_0x29ce28||0x1f4;return function(_0x43dce9){logger['error'](_0x43dce9[_0x22a5('0x28')]);if(_0x43dce9['name']){delete _0x43dce9[_0x22a5('0x29')];}_0x56f1d2[_0x22a5('0x22')](_0x29ce28)[_0x22a5('0x2a')](_0x43dce9);};}exports[_0x22a5('0x2b')]=function(_0x2ab24d,_0x5c2f35){var _0x32afed={},_0x3e4626={},_0x46fed1={'count':0x0,'rows':[]};var _0x33aa36=_[_0x22a5('0x2c')](db[_0x22a5('0x2d')][_0x22a5('0x2e')],function(_0x3abaaf){return{'name':_0x3abaaf[_0x22a5('0x2f')],'type':_0x3abaaf[_0x22a5('0x30')][_0x22a5('0x31')]};});_0x3e4626['model']=_[_0x22a5('0x2c')](_0x33aa36,_0x22a5('0x29'));_0x3e4626[_0x22a5('0x32')]=_[_0x22a5('0x33')](_0x2ab24d[_0x22a5('0x32')]);_0x3e4626['filters']=_[_0x22a5('0x34')](_0x3e4626[_0x22a5('0x35')],_0x3e4626[_0x22a5('0x32')]);_0x32afed[_0x22a5('0x36')]=_[_0x22a5('0x34')](_0x3e4626['model'],qs[_0x22a5('0x37')](_0x2ab24d[_0x22a5('0x32')][_0x22a5('0x37')]));_0x32afed['attributes']=_0x32afed['attributes'][_0x22a5('0x38')]?_0x32afed['attributes']:_0x3e4626[_0x22a5('0x35')];if(!_0x2ab24d['query']['hasOwnProperty'](_0x22a5('0x39'))){_0x32afed[_0x22a5('0x1e')]=qs[_0x22a5('0x1e')](_0x2ab24d[_0x22a5('0x32')][_0x22a5('0x1e')]);_0x32afed[_0x22a5('0x21')]=qs[_0x22a5('0x21')](_0x2ab24d[_0x22a5('0x32')][_0x22a5('0x21')]);}_0x32afed['order']=qs['sort'](_0x2ab24d[_0x22a5('0x32')][_0x22a5('0x3a')]);_0x32afed[_0x22a5('0x3b')]=qs[_0x22a5('0x3c')](_[_0x22a5('0x3d')](_0x2ab24d[_0x22a5('0x32')],_0x3e4626[_0x22a5('0x3c')]),_0x33aa36);if(_0x2ab24d[_0x22a5('0x32')]['filter']){_0x32afed[_0x22a5('0x3b')]=_['merge'](_0x32afed['where'],{'$or':_[_0x22a5('0x2c')](_0x33aa36,function(_0x554ec6){if(_0x554ec6[_0x22a5('0x30')]!==_0x22a5('0x3e')){var _0x4432ff={};_0x4432ff[_0x554ec6[_0x22a5('0x29')]]={'$like':'%'+_0x2ab24d[_0x22a5('0x32')]['filter']+'%'};return _0x4432ff;}})});}_0x32afed=_[_0x22a5('0x3f')]({},_0x32afed,_0x2ab24d[_0x22a5('0x40')]);var _0x328819={'where':_0x32afed[_0x22a5('0x3b')]};return db[_0x22a5('0x2d')][_0x22a5('0x20')](_0x328819)[_0x22a5('0x27')](function(_0x301f96){_0x46fed1[_0x22a5('0x20')]=_0x301f96;if(_0x2ab24d[_0x22a5('0x32')][_0x22a5('0x41')]){_0x32afed['include']=[{'all':!![]}];}return db['MailSubstatus'][_0x22a5('0x42')](_0x32afed);})[_0x22a5('0x27')](function(_0x2b9118){_0x46fed1[_0x22a5('0x43')]=_0x2b9118;return _0x46fed1;})[_0x22a5('0x27')](respondWithFilteredResult(_0x5c2f35,_0x32afed))['catch'](handleError(_0x5c2f35,null));};exports[_0x22a5('0x44')]=function(_0x387826,_0x2b3445){var _0x3f74b5={'raw':!![],'where':{'id':_0x387826[_0x22a5('0x45')]['id']}},_0x29c43e={};_0x29c43e['model']=_[_0x22a5('0x33')](db[_0x22a5('0x2d')][_0x22a5('0x2e')]);_0x29c43e[_0x22a5('0x32')]=_['keys'](_0x387826[_0x22a5('0x32')]);_0x29c43e[_0x22a5('0x3c')]=_[_0x22a5('0x34')](_0x29c43e[_0x22a5('0x35')],_0x29c43e[_0x22a5('0x32')]);_0x3f74b5[_0x22a5('0x36')]=_[_0x22a5('0x34')](_0x29c43e[_0x22a5('0x35')],qs[_0x22a5('0x37')](_0x387826[_0x22a5('0x32')][_0x22a5('0x37')]));_0x3f74b5[_0x22a5('0x36')]=_0x3f74b5[_0x22a5('0x36')]['length']?_0x3f74b5[_0x22a5('0x36')]:_0x29c43e[_0x22a5('0x35')];if(_0x387826[_0x22a5('0x32')]['includeAll']){_0x3f74b5['include']=[{'all':!![]}];}_0x3f74b5=_[_0x22a5('0x3f')]({},_0x3f74b5,_0x387826[_0x22a5('0x40')]);return db[_0x22a5('0x2d')][_0x22a5('0x46')](_0x3f74b5)[_0x22a5('0x27')](handleEntityNotFound(_0x2b3445,null))[_0x22a5('0x27')](respondWithResult(_0x2b3445,null))[_0x22a5('0x47')](handleError(_0x2b3445,null));};exports[_0x22a5('0x48')]=function(_0x23f9bf,_0x466e28){return db[_0x22a5('0x2d')][_0x22a5('0x48')](_0x23f9bf[_0x22a5('0x49')],{})[_0x22a5('0x27')](respondWithResult(_0x466e28,0xc9))[_0x22a5('0x47')](handleError(_0x466e28,null));};exports['update']=function(_0x3d9463,_0x7e8252){if(_0x3d9463[_0x22a5('0x49')]['id']){delete _0x3d9463[_0x22a5('0x49')]['id'];}return db[_0x22a5('0x2d')][_0x22a5('0x46')]({'where':{'id':_0x3d9463[_0x22a5('0x45')]['id']}})[_0x22a5('0x27')](handleEntityNotFound(_0x7e8252,null))[_0x22a5('0x27')](saveUpdates(_0x3d9463[_0x22a5('0x49')],null))[_0x22a5('0x27')](respondWithResult(_0x7e8252,null))['catch'](handleError(_0x7e8252,null));};exports[_0x22a5('0x4a')]=function(_0x115f0f,_0x2a47bb){return db[_0x22a5('0x2d')][_0x22a5('0x46')]({'where':{'id':_0x115f0f[_0x22a5('0x45')]['id']}})[_0x22a5('0x27')](handleEntityNotFound(_0x2a47bb,null))[_0x22a5('0x27')](removeEntity(_0x2a47bb,null))[_0x22a5('0x47')](handleError(_0x2a47bb,null));};exports['describe']=function(_0x4d0cd8,_0x3b8d4f){return db[_0x22a5('0x2d')][_0x22a5('0x4b')]()[_0x22a5('0x27')](respondWithResult(_0x3b8d4f,null))['catch'](handleError(_0x3b8d4f,null));}; \ No newline at end of file +var _0xfa76=['status','json','offset','undefined','limit','set','Content-Range','apply','reject','update','then','destroy','error','send','index','map','rawAttributes','fieldName','type','key','model','name','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','VIRTUAL','options','count','includeAll','include','MailSubstatus','findAll','catch','show','params','merge','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus'];(function(_0x1172b6,_0x179946){var _0x2fdf5f=function(_0x47bcb2){while(--_0x47bcb2){_0x1172b6['push'](_0x1172b6['shift']());}};_0x2fdf5f(++_0x179946);}(_0xfa76,0x16a));var _0x6fa7=function(_0x537d8f,_0x40f96d){_0x537d8f=_0x537d8f-0x0;var _0x18d623=_0xfa76[_0x537d8f];return _0x18d623;};'use strict';var emlformat=require(_0x6fa7('0x0'));var rimraf=require(_0x6fa7('0x1'));var zipdir=require(_0x6fa7('0x2'));var jsonpatch=require(_0x6fa7('0x3'));var rp=require(_0x6fa7('0x4'));var moment=require(_0x6fa7('0x5'));var BPromise=require(_0x6fa7('0x6'));var Mustache=require(_0x6fa7('0x7'));var util=require(_0x6fa7('0x8'));var path=require(_0x6fa7('0x9'));var sox=require(_0x6fa7('0xa'));var csv=require('to-csv');var ejs=require(_0x6fa7('0xb'));var fs=require('fs');var fs_extra=require(_0x6fa7('0xc'));var _=require(_0x6fa7('0xd'));var squel=require('squel');var crypto=require(_0x6fa7('0xe'));var jsforce=require(_0x6fa7('0xf'));var deskjs=require(_0x6fa7('0x10'));var toCsv=require(_0x6fa7('0x11'));var querystring=require(_0x6fa7('0x12'));var Papa=require('papaparse');var Redis=require(_0x6fa7('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x6fa7('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6fa7('0x15'));var logger=require(_0x6fa7('0x16'))('api');var utils=require(_0x6fa7('0x17'));var config=require(_0x6fa7('0x18'));var licenseUtil=require(_0x6fa7('0x19'));var db=require(_0x6fa7('0x1a'))['db'];function respondWithStatusCode(_0x47f429,_0x4216d6){_0x4216d6=_0x4216d6||0xcc;return function(_0x5de862){if(_0x5de862){return _0x47f429[_0x6fa7('0x1b')](_0x4216d6);}return _0x47f429[_0x6fa7('0x1c')](_0x4216d6)['end']();};}function respondWithResult(_0x50d78a,_0x4b889e){_0x4b889e=_0x4b889e||0xc8;return function(_0x16ba9f){if(_0x16ba9f){return _0x50d78a['status'](_0x4b889e)[_0x6fa7('0x1d')](_0x16ba9f);}};}function respondWithFilteredResult(_0x548cea,_0x1318ef){return function(_0x2b1e12){if(_0x2b1e12){var _0x28d8cb=typeof _0x1318ef[_0x6fa7('0x1e')]===_0x6fa7('0x1f')&&typeof _0x1318ef[_0x6fa7('0x20')]===_0x6fa7('0x1f');var _0x3aaf63=_0x2b1e12['count'];var _0x327973=_0x28d8cb?0x0:_0x1318ef[_0x6fa7('0x1e')];var _0x4cb12d=_0x28d8cb?_0x2b1e12['count']:_0x1318ef[_0x6fa7('0x1e')]+_0x1318ef[_0x6fa7('0x20')];var _0x54cd79;if(_0x4cb12d>=_0x3aaf63){_0x4cb12d=_0x3aaf63;_0x54cd79=0xc8;}else{_0x54cd79=0xce;}_0x548cea[_0x6fa7('0x1c')](_0x54cd79);return _0x548cea[_0x6fa7('0x21')](_0x6fa7('0x22'),_0x327973+'-'+_0x4cb12d+'/'+_0x3aaf63)[_0x6fa7('0x1d')](_0x2b1e12);}return null;};}function patchUpdates(_0x5f2f08){return function(_0x2f2bce){try{jsonpatch[_0x6fa7('0x23')](_0x2f2bce,_0x5f2f08,!![]);}catch(_0xa1f1ae){return BPromise[_0x6fa7('0x24')](_0xa1f1ae);}return _0x2f2bce['save']();};}function saveUpdates(_0x4c3aee,_0x5e9613){return function(_0x5c87b0){if(_0x5c87b0){return _0x5c87b0[_0x6fa7('0x25')](_0x4c3aee)[_0x6fa7('0x26')](function(_0x119c96){return _0x119c96;});}return null;};}function removeEntity(_0x55b397,_0x5d5c46){return function(_0x3ce755){if(_0x3ce755){return _0x3ce755[_0x6fa7('0x27')]()[_0x6fa7('0x26')](function(){_0x55b397[_0x6fa7('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x248985,_0x31672c){return function(_0x38234c){if(!_0x38234c){_0x248985[_0x6fa7('0x1b')](0x194);}return _0x38234c;};}function handleError(_0x4d9616,_0x576380){_0x576380=_0x576380||0x1f4;return function(_0x28ff5c){logger[_0x6fa7('0x28')](_0x28ff5c['stack']);if(_0x28ff5c['name']){delete _0x28ff5c['name'];}_0x4d9616['status'](_0x576380)[_0x6fa7('0x29')](_0x28ff5c);};}exports[_0x6fa7('0x2a')]=function(_0x240a50,_0x430548){var _0x5721fc={},_0x13a839={},_0x475709={'count':0x0,'rows':[]};var _0x166ee1=_[_0x6fa7('0x2b')](db['MailSubstatus'][_0x6fa7('0x2c')],function(_0x274046){return{'name':_0x274046[_0x6fa7('0x2d')],'type':_0x274046[_0x6fa7('0x2e')][_0x6fa7('0x2f')]};});_0x13a839[_0x6fa7('0x30')]=_[_0x6fa7('0x2b')](_0x166ee1,_0x6fa7('0x31'));_0x13a839[_0x6fa7('0x32')]=_[_0x6fa7('0x33')](_0x240a50['query']);_0x13a839[_0x6fa7('0x34')]=_[_0x6fa7('0x35')](_0x13a839[_0x6fa7('0x30')],_0x13a839['query']);_0x5721fc[_0x6fa7('0x36')]=_[_0x6fa7('0x35')](_0x13a839[_0x6fa7('0x30')],qs[_0x6fa7('0x37')](_0x240a50['query']['fields']));_0x5721fc[_0x6fa7('0x36')]=_0x5721fc[_0x6fa7('0x36')][_0x6fa7('0x38')]?_0x5721fc[_0x6fa7('0x36')]:_0x13a839[_0x6fa7('0x30')];if(!_0x240a50[_0x6fa7('0x32')]['hasOwnProperty'](_0x6fa7('0x39'))){_0x5721fc[_0x6fa7('0x20')]=qs['limit'](_0x240a50[_0x6fa7('0x32')][_0x6fa7('0x20')]);_0x5721fc[_0x6fa7('0x1e')]=qs[_0x6fa7('0x1e')](_0x240a50['query'][_0x6fa7('0x1e')]);}_0x5721fc[_0x6fa7('0x3a')]=qs['sort'](_0x240a50[_0x6fa7('0x32')][_0x6fa7('0x3b')]);_0x5721fc[_0x6fa7('0x3c')]=qs[_0x6fa7('0x34')](_[_0x6fa7('0x3d')](_0x240a50['query'],_0x13a839[_0x6fa7('0x34')]),_0x166ee1);if(_0x240a50[_0x6fa7('0x32')][_0x6fa7('0x3e')]){_0x5721fc[_0x6fa7('0x3c')]=_['merge'](_0x5721fc[_0x6fa7('0x3c')],{'$or':_['map'](_0x166ee1,function(_0x4fefd9){if(_0x4fefd9[_0x6fa7('0x2e')]!==_0x6fa7('0x3f')){var _0x2a22e5={};_0x2a22e5[_0x4fefd9['name']]={'$like':'%'+_0x240a50[_0x6fa7('0x32')][_0x6fa7('0x3e')]+'%'};return _0x2a22e5;}})});}_0x5721fc=_['merge']({},_0x5721fc,_0x240a50[_0x6fa7('0x40')]);var _0x30255f={'where':_0x5721fc[_0x6fa7('0x3c')]};return db['MailSubstatus'][_0x6fa7('0x41')](_0x30255f)[_0x6fa7('0x26')](function(_0x189ff){_0x475709[_0x6fa7('0x41')]=_0x189ff;if(_0x240a50['query'][_0x6fa7('0x42')]){_0x5721fc[_0x6fa7('0x43')]=[{'all':!![]}];}return db[_0x6fa7('0x44')][_0x6fa7('0x45')](_0x5721fc);})[_0x6fa7('0x26')](function(_0x280f62){_0x475709['rows']=_0x280f62;return _0x475709;})[_0x6fa7('0x26')](respondWithFilteredResult(_0x430548,_0x5721fc))[_0x6fa7('0x46')](handleError(_0x430548,null));};exports[_0x6fa7('0x47')]=function(_0x493512,_0x2c3d7a){var _0x5a9559={'raw':!![],'where':{'id':_0x493512[_0x6fa7('0x48')]['id']}},_0x3f9271={};_0x3f9271[_0x6fa7('0x30')]=_[_0x6fa7('0x33')](db[_0x6fa7('0x44')]['rawAttributes']);_0x3f9271[_0x6fa7('0x32')]=_[_0x6fa7('0x33')](_0x493512['query']);_0x3f9271['filters']=_[_0x6fa7('0x35')](_0x3f9271['model'],_0x3f9271[_0x6fa7('0x32')]);_0x5a9559[_0x6fa7('0x36')]=_[_0x6fa7('0x35')](_0x3f9271['model'],qs[_0x6fa7('0x37')](_0x493512[_0x6fa7('0x32')]['fields']));_0x5a9559[_0x6fa7('0x36')]=_0x5a9559[_0x6fa7('0x36')]['length']?_0x5a9559['attributes']:_0x3f9271[_0x6fa7('0x30')];if(_0x493512[_0x6fa7('0x32')][_0x6fa7('0x42')]){_0x5a9559['include']=[{'all':!![]}];}_0x5a9559=_[_0x6fa7('0x49')]({},_0x5a9559,_0x493512['options']);return db[_0x6fa7('0x44')][_0x6fa7('0x4a')](_0x5a9559)[_0x6fa7('0x26')](handleEntityNotFound(_0x2c3d7a,null))[_0x6fa7('0x26')](respondWithResult(_0x2c3d7a,null))['catch'](handleError(_0x2c3d7a,null));};exports[_0x6fa7('0x4b')]=function(_0x2bf95c,_0x351d30){return db[_0x6fa7('0x44')][_0x6fa7('0x4b')](_0x2bf95c[_0x6fa7('0x4c')],{})[_0x6fa7('0x26')](respondWithResult(_0x351d30,0xc9))[_0x6fa7('0x46')](handleError(_0x351d30,null));};exports[_0x6fa7('0x25')]=function(_0x120fbb,_0x3fe181){if(_0x120fbb[_0x6fa7('0x4c')]['id']){delete _0x120fbb[_0x6fa7('0x4c')]['id'];}return db[_0x6fa7('0x44')][_0x6fa7('0x4a')]({'where':{'id':_0x120fbb[_0x6fa7('0x48')]['id']}})['then'](handleEntityNotFound(_0x3fe181,null))[_0x6fa7('0x26')](saveUpdates(_0x120fbb[_0x6fa7('0x4c')],null))[_0x6fa7('0x26')](respondWithResult(_0x3fe181,null))['catch'](handleError(_0x3fe181,null));};exports['destroy']=function(_0x53dd23,_0x42b143){return db[_0x6fa7('0x44')][_0x6fa7('0x4a')]({'where':{'id':_0x53dd23[_0x6fa7('0x48')]['id']}})['then'](handleEntityNotFound(_0x42b143,null))['then'](removeEntity(_0x42b143,null))[_0x6fa7('0x46')](handleError(_0x42b143,null));};exports[_0x6fa7('0x4d')]=function(_0x459f72,_0x41059e){return db['MailSubstatus']['describe']()['then'](respondWithResult(_0x41059e,null))[_0x6fa7('0x46')](handleError(_0x41059e,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.model.js b/server/api/mailSubstatus/mailSubstatus.model.js index d36cebf..0f18fa9 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 _0x858c=['define','MailSubstatus','mail_substatuses','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','exports'];(function(_0x269abf,_0x551380){var _0x322dd=function(_0x4d723c){while(--_0x4d723c){_0x269abf['push'](_0x269abf['shift']());}};_0x322dd(++_0x551380);}(_0x858c,0x92));var _0xc858=function(_0x5cf327,_0x2724f3){_0x5cf327=_0x5cf327-0x0;var _0x3bb17b=_0x858c[_0x5cf327];return _0x3bb17b;};'use strict';var _=require(_0xc858('0x0'));var util=require(_0xc858('0x1'));var logger=require(_0xc858('0x2'))(_0xc858('0x3'));var moment=require(_0xc858('0x4'));var BPromise=require(_0xc858('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc858('0x6'));var rimraf=require(_0xc858('0x7'));var config=require(_0xc858('0x8'));var attributes=require('./mailSubstatus.attributes');module[_0xc858('0x9')]=function(_0x566de8,_0x3e317c){return _0x566de8[_0xc858('0xa')](_0xc858('0xb'),attributes,{'tableName':_0xc858('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2c8a=['util','../../config/logger','request-promise','path','rimraf','./mailSubstatus.attributes','exports','define','MailSubstatus'];(function(_0x2b1e39,_0x3774d0){var _0xac4f7f=function(_0x5db8f9){while(--_0x5db8f9){_0x2b1e39['push'](_0x2b1e39['shift']());}};_0xac4f7f(++_0x3774d0);}(_0x2c8a,0x120));var _0xa2c8=function(_0x5d2803,_0xf375bd){_0x5d2803=_0x5d2803-0x0;var _0xdcad2c=_0x2c8a[_0x5d2803];return _0xdcad2c;};'use strict';var _=require('lodash');var util=require(_0xa2c8('0x0'));var logger=require(_0xa2c8('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xa2c8('0x2'));var fs=require('fs');var path=require(_0xa2c8('0x3'));var rimraf=require(_0xa2c8('0x4'));var config=require('../../config/environment');var attributes=require(_0xa2c8('0x5'));module[_0xa2c8('0x6')]=function(_0x5f4c15,_0x15ee3b){return _0x5f4c15[_0xa2c8('0x7')](_0xa2c8('0x8'),attributes,{'tableName':'mail_substatuses','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.rpc.js b/server/api/mailSubstatus/mailSubstatus.rpc.js index 7298af4..9336d4f 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 _0x7bbe=['jayson/promise','client','http','request','info','MailSubstatus,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment'];(function(_0x153224,_0x227874){var _0x534411=function(_0x348894){while(--_0x348894){_0x153224['push'](_0x153224['shift']());}};_0x534411(++_0x227874);}(_0x7bbe,0x80));var _0xe7bb=function(_0x3c2b2e,_0x3e6e53){_0x3c2b2e=_0x3c2b2e-0x0;var _0x27a338=_0x7bbe[_0x3c2b2e];return _0x27a338;};'use strict';var _=require(_0xe7bb('0x0'));var util=require(_0xe7bb('0x1'));var moment=require(_0xe7bb('0x2'));var BPromise=require(_0xe7bb('0x3'));var rs=require(_0xe7bb('0x4'));var fs=require('fs');var Redis=require(_0xe7bb('0x5'));var db=require(_0xe7bb('0x6'))['db'];var utils=require(_0xe7bb('0x7'));var logger=require('../../config/logger')(_0xe7bb('0x8'));var config=require(_0xe7bb('0x9'));var jayson=require(_0xe7bb('0xa'));var client=jayson[_0xe7bb('0xb')][_0xe7bb('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4b3f00,_0x4dbf40,_0x58abfc){return new BPromise(function(_0x56160c,_0x49f970){return client[_0xe7bb('0xd')](_0x4b3f00,_0x58abfc)['then'](function(_0x2995ff){logger[_0xe7bb('0xe')](_0xe7bb('0xf'),_0x4dbf40,_0xe7bb('0x10'));logger[_0xe7bb('0x11')]('MailSubstatus,\x20%s,\x20%s,\x20%s',_0x4dbf40,_0xe7bb('0x10'),JSON[_0xe7bb('0x12')](_0x2995ff));if(_0x2995ff[_0xe7bb('0x13')]){if(_0x2995ff[_0xe7bb('0x13')]['code']===0x1f4){logger[_0xe7bb('0x13')](_0xe7bb('0xf'),_0x4dbf40,_0x2995ff['error'][_0xe7bb('0x14')]);return _0x49f970(_0x2995ff[_0xe7bb('0x13')]['message']);}logger[_0xe7bb('0x13')](_0xe7bb('0xf'),_0x4dbf40,_0x2995ff[_0xe7bb('0x13')][_0xe7bb('0x14')]);return _0x56160c(_0x2995ff[_0xe7bb('0x13')]['message']);}else{logger['info'](_0xe7bb('0xf'),_0x4dbf40,'request\x20sent');_0x56160c(_0x2995ff[_0xe7bb('0x15')]['message']);}})[_0xe7bb('0x16')](function(_0x1a5563){logger[_0xe7bb('0x13')](_0xe7bb('0xf'),_0x4dbf40,_0x1a5563);_0x49f970(_0x1a5563);});});} \ No newline at end of file +var _0x0923=['code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','MailSubstatus,\x20%s,\x20%s','debug','MailSubstatus,\x20%s,\x20%s,\x20%s','request\x20sent','error'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0923,0x13c));var _0x3092=function(_0xd68210,_0x2d4a3c){_0xd68210=_0xd68210-0x0;var _0x298b83=_0x0923[_0xd68210];return _0x298b83;};'use strict';var _=require(_0x3092('0x0'));var util=require(_0x3092('0x1'));var moment=require('moment');var BPromise=require(_0x3092('0x2'));var rs=require(_0x3092('0x3'));var fs=require('fs');var Redis=require(_0x3092('0x4'));var db=require(_0x3092('0x5'))['db'];var utils=require(_0x3092('0x6'));var logger=require(_0x3092('0x7'))(_0x3092('0x8'));var config=require(_0x3092('0x9'));var jayson=require(_0x3092('0xa'));var client=jayson['client'][_0x3092('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1c6c0a,_0x3f53cf,_0x52a68e){return new BPromise(function(_0x402cc5,_0x3c0bf2){return client[_0x3092('0xc')](_0x1c6c0a,_0x52a68e)[_0x3092('0xd')](function(_0x823ed4){logger[_0x3092('0xe')](_0x3092('0xf'),_0x3f53cf,'request\x20sent');logger[_0x3092('0x10')](_0x3092('0x11'),_0x3f53cf,_0x3092('0x12'),JSON['stringify'](_0x823ed4));if(_0x823ed4[_0x3092('0x13')]){if(_0x823ed4[_0x3092('0x13')][_0x3092('0x14')]===0x1f4){logger[_0x3092('0x13')](_0x3092('0xf'),_0x3f53cf,_0x823ed4[_0x3092('0x13')][_0x3092('0x15')]);return _0x3c0bf2(_0x823ed4[_0x3092('0x13')][_0x3092('0x15')]);}logger['error'](_0x3092('0xf'),_0x3f53cf,_0x823ed4[_0x3092('0x13')][_0x3092('0x15')]);return _0x402cc5(_0x823ed4[_0x3092('0x13')][_0x3092('0x15')]);}else{logger[_0x3092('0xe')](_0x3092('0xf'),_0x3f53cf,_0x3092('0x12'));_0x402cc5(_0x823ed4[_0x3092('0x16')][_0x3092('0x15')]);}})[_0x3092('0x17')](function(_0x6a97c4){logger[_0x3092('0x13')](_0x3092('0xf'),_0x3f53cf,_0x6a97c4);_0x3c0bf2(_0x6a97c4);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index a02d64c..e54628e 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 _0xf974=['get','isAuthenticated','index','describe','/:id','show','post','create','put','delete','exports','util','path','express','Router','fs-extra'];(function(_0x4a94b1,_0x4f2518){var _0x20949f=function(_0x1c4aa6){while(--_0x1c4aa6){_0x4a94b1['push'](_0x4a94b1['shift']());}};_0x20949f(++_0x4f2518);}(_0xf974,0x6b));var _0x4f97=function(_0x405452,_0x215116){_0x405452=_0x405452-0x0;var _0x4f06b9=_0xf974[_0x405452];return _0x4f06b9;};'use strict';var multer=require('multer');var util=require(_0x4f97('0x0'));var path=require(_0x4f97('0x1'));var timeout=require('connect-timeout');var express=require(_0x4f97('0x2'));var router=express[_0x4f97('0x3')]();var fs_extra=require(_0x4f97('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./mailTransferReport.controller');router[_0x4f97('0x5')]('/',auth[_0x4f97('0x6')](),controller[_0x4f97('0x7')]);router[_0x4f97('0x5')]('/describe',auth[_0x4f97('0x6')](),controller[_0x4f97('0x8')]);router[_0x4f97('0x5')](_0x4f97('0x9'),auth[_0x4f97('0x6')](),controller[_0x4f97('0xa')]);router[_0x4f97('0xb')]('/',auth[_0x4f97('0x6')](),controller[_0x4f97('0xc')]);router[_0x4f97('0xd')](_0x4f97('0x9'),auth[_0x4f97('0x6')](),controller['update']);router[_0x4f97('0xe')]('/:id',auth[_0x4f97('0x6')](),controller['destroy']);module[_0x4f97('0xf')]=router; \ No newline at end of file +var _0x4d6b=['get','isAuthenticated','/describe','describe','/:id','show','post','create','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','./mailTransferReport.controller'];(function(_0x5e709a,_0x1d7975){var _0x57401a=function(_0x27eab5){while(--_0x27eab5){_0x5e709a['push'](_0x5e709a['shift']());}};_0x57401a(++_0x1d7975);}(_0x4d6b,0x1c4));var _0xb4d6=function(_0x75c3eb,_0x271b5a){_0x75c3eb=_0x75c3eb-0x0;var _0x6e6585=_0x4d6b[_0x75c3eb];return _0x6e6585;};'use strict';var multer=require(_0xb4d6('0x0'));var util=require(_0xb4d6('0x1'));var path=require(_0xb4d6('0x2'));var timeout=require(_0xb4d6('0x3'));var express=require(_0xb4d6('0x4'));var router=express[_0xb4d6('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xb4d6('0x6'));var config=require('../../config/environment');var controller=require(_0xb4d6('0x7'));router[_0xb4d6('0x8')]('/',auth[_0xb4d6('0x9')](),controller['index']);router[_0xb4d6('0x8')](_0xb4d6('0xa'),auth['isAuthenticated'](),controller[_0xb4d6('0xb')]);router[_0xb4d6('0x8')](_0xb4d6('0xc'),auth['isAuthenticated'](),controller[_0xb4d6('0xd')]);router[_0xb4d6('0xe')]('/',auth[_0xb4d6('0x9')](),controller[_0xb4d6('0xf')]);router[_0xb4d6('0x10')](_0xb4d6('0xc'),auth[_0xb4d6('0x9')](),controller[_0xb4d6('0x11')]);router[_0xb4d6('0x12')](_0xb4d6('0xc'),auth[_0xb4d6('0x9')](),controller[_0xb4d6('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.attributes.js b/server/api/mailTransferReport/mailTransferReport.attributes.js index 130a24f..d9b23f0 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 _0xa9e0=['account','queue','DATE','NOW','moment','sequelize','exports'];(function(_0x4b5965,_0x3909ca){var _0x3e7789=function(_0x33c2b0){while(--_0x33c2b0){_0x4b5965['push'](_0x4b5965['shift']());}};_0x3e7789(++_0x3909ca);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2d8fc2,_0x1c461d){_0x2d8fc2=_0x2d8fc2-0x0;var _0x3a9e53=_0xa9e0[_0x2d8fc2];return _0x3a9e53;};'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 _0x008c=['ENUM','agent','queue','DATE','NOW','moment','sequelize','exports','STRING'];(function(_0x45268e,_0x5ee19e){var _0x36d493=function(_0x59b799){while(--_0x59b799){_0x45268e['push'](_0x45268e['shift']());}};_0x36d493(++_0x5ee19e);}(_0x008c,0x188));var _0xc008=function(_0x477b78,_0x302499){_0x477b78=_0x477b78-0x0;var _0x2f3f99=_0x008c[_0x477b78];return _0x2f3f99;};'use strict';var moment=require(_0xc008('0x0'));var Sequelize=require(_0xc008('0x1'));module[_0xc008('0x2')]={'uniqueid':{'type':Sequelize[_0xc008('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xc008('0x4')]('account',_0xc008('0x5'),_0xc008('0x6')),'allowNull':![],'defaultValue':_0xc008('0x6')},'transferredAt':{'type':Sequelize[_0xc008('0x7')],'allowNull':![],'defaultValue':Sequelize[_0xc008('0x8')]}}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.controller.js b/server/api/mailTransferReport/mailTransferReport.controller.js index 0c89d3f..914b873 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 _0x064c=['destroy','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','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','sendStatus','end','json','offset','undefined','limit','count','status','set','apply','reject','save','update','then','stack','name','send','index','map','MailTransferReport','rawAttributes','type','key','query','keys','filters','intersection','model','attributes','fields','length','nolimit','sort','where','pick','merge','VIRTUAL','filter','options','include','rows','catch','show','params','includeAll','find','body'];(function(_0x2afbc8,_0xa56d64){var _0x33d443=function(_0x47cb52){while(--_0x47cb52){_0x2afbc8['push'](_0x2afbc8['shift']());}};_0x33d443(++_0xa56d64);}(_0x064c,0x95));var _0xc064=function(_0x358806,_0x322b66){_0x358806=_0x358806-0x0;var _0x19fdcb=_0x064c[_0x358806];return _0x19fdcb;};'use strict';var emlformat=require(_0xc064('0x0'));var rimraf=require(_0xc064('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc064('0x2'));var rp=require(_0xc064('0x3'));var moment=require(_0xc064('0x4'));var BPromise=require(_0xc064('0x5'));var Mustache=require(_0xc064('0x6'));var util=require('util');var path=require(_0xc064('0x7'));var sox=require(_0xc064('0x8'));var csv=require(_0xc064('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc064('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xc064('0xb'));var jsforce=require(_0xc064('0xc'));var deskjs=require(_0xc064('0xd'));var toCsv=require(_0xc064('0x9'));var querystring=require(_0xc064('0xe'));var Papa=require(_0xc064('0xf'));var Redis=require(_0xc064('0x10'));var authService=require(_0xc064('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xc064('0x12'));var hardwareService=require(_0xc064('0x13'));var logger=require(_0xc064('0x14'))(_0xc064('0x15'));var utils=require(_0xc064('0x16'));var config=require(_0xc064('0x17'));var licenseUtil=require(_0xc064('0x18'));var db=require(_0xc064('0x19'))['db'];function respondWithStatusCode(_0x70b5e5,_0x4be61f){_0x4be61f=_0x4be61f||0xcc;return function(_0x1db753){if(_0x1db753){return _0x70b5e5[_0xc064('0x1a')](_0x4be61f);}return _0x70b5e5['status'](_0x4be61f)[_0xc064('0x1b')]();};}function respondWithResult(_0xf28f91,_0x420950){_0x420950=_0x420950||0xc8;return function(_0x1a24b1){if(_0x1a24b1){return _0xf28f91['status'](_0x420950)[_0xc064('0x1c')](_0x1a24b1);}};}function respondWithFilteredResult(_0x4737d1,_0x4de351){return function(_0x4e283f){if(_0x4e283f){var _0x5d295b=typeof _0x4de351[_0xc064('0x1d')]===_0xc064('0x1e')&&typeof _0x4de351[_0xc064('0x1f')]===_0xc064('0x1e');var _0x251ba0=_0x4e283f['count'];var _0x3cfce9=_0x5d295b?0x0:_0x4de351[_0xc064('0x1d')];var _0x44faa8=_0x5d295b?_0x4e283f[_0xc064('0x20')]:_0x4de351[_0xc064('0x1d')]+_0x4de351['limit'];var _0x398051;if(_0x44faa8>=_0x251ba0){_0x44faa8=_0x251ba0;_0x398051=0xc8;}else{_0x398051=0xce;}_0x4737d1[_0xc064('0x21')](_0x398051);return _0x4737d1[_0xc064('0x22')]('Content-Range',_0x3cfce9+'-'+_0x44faa8+'/'+_0x251ba0)['json'](_0x4e283f);}return null;};}function patchUpdates(_0x5d940a){return function(_0x278fdc){try{jsonpatch[_0xc064('0x23')](_0x278fdc,_0x5d940a,!![]);}catch(_0x5be48b){return BPromise[_0xc064('0x24')](_0x5be48b);}return _0x278fdc[_0xc064('0x25')]();};}function saveUpdates(_0x2f2744,_0x280ea2){return function(_0x10b677){if(_0x10b677){return _0x10b677[_0xc064('0x26')](_0x2f2744)[_0xc064('0x27')](function(_0x1dd6b7){return _0x1dd6b7;});}return null;};}function removeEntity(_0x4edd95,_0x1d4d05){return function(_0x5947bc){if(_0x5947bc){return _0x5947bc['destroy']()[_0xc064('0x27')](function(){_0x4edd95[_0xc064('0x21')](0xcc)['end']();});}};}function handleEntityNotFound(_0x504f67,_0x404425){return function(_0xad4d64){if(!_0xad4d64){_0x504f67[_0xc064('0x1a')](0x194);}return _0xad4d64;};}function handleError(_0x15b6ba,_0x4ba3a2){_0x4ba3a2=_0x4ba3a2||0x1f4;return function(_0x17bc3b){logger['error'](_0x17bc3b[_0xc064('0x28')]);if(_0x17bc3b[_0xc064('0x29')]){delete _0x17bc3b['name'];}_0x15b6ba[_0xc064('0x21')](_0x4ba3a2)[_0xc064('0x2a')](_0x17bc3b);};}exports[_0xc064('0x2b')]=function(_0x938d77,_0x96cd71){var _0x41b4d={},_0x51368c={},_0x55a8d5={'count':0x0,'rows':[]};var _0x573be2=_[_0xc064('0x2c')](db[_0xc064('0x2d')][_0xc064('0x2e')],function(_0x2b98b9){return{'name':_0x2b98b9['fieldName'],'type':_0x2b98b9[_0xc064('0x2f')][_0xc064('0x30')]};});_0x51368c['model']=_[_0xc064('0x2c')](_0x573be2,'name');_0x51368c[_0xc064('0x31')]=_[_0xc064('0x32')](_0x938d77['query']);_0x51368c[_0xc064('0x33')]=_[_0xc064('0x34')](_0x51368c[_0xc064('0x35')],_0x51368c[_0xc064('0x31')]);_0x41b4d[_0xc064('0x36')]=_[_0xc064('0x34')](_0x51368c[_0xc064('0x35')],qs['fields'](_0x938d77[_0xc064('0x31')][_0xc064('0x37')]));_0x41b4d[_0xc064('0x36')]=_0x41b4d['attributes'][_0xc064('0x38')]?_0x41b4d[_0xc064('0x36')]:_0x51368c[_0xc064('0x35')];if(!_0x938d77[_0xc064('0x31')]['hasOwnProperty'](_0xc064('0x39'))){_0x41b4d[_0xc064('0x1f')]=qs[_0xc064('0x1f')](_0x938d77[_0xc064('0x31')][_0xc064('0x1f')]);_0x41b4d[_0xc064('0x1d')]=qs[_0xc064('0x1d')](_0x938d77[_0xc064('0x31')][_0xc064('0x1d')]);}_0x41b4d['order']=qs[_0xc064('0x3a')](_0x938d77[_0xc064('0x31')][_0xc064('0x3a')]);_0x41b4d[_0xc064('0x3b')]=qs[_0xc064('0x33')](_[_0xc064('0x3c')](_0x938d77['query'],_0x51368c[_0xc064('0x33')]),_0x573be2);if(_0x938d77[_0xc064('0x31')]['filter']){_0x41b4d['where']=_[_0xc064('0x3d')](_0x41b4d[_0xc064('0x3b')],{'$or':_['map'](_0x573be2,function(_0xe676a9){if(_0xe676a9[_0xc064('0x2f')]!==_0xc064('0x3e')){var _0x5abaaf={};_0x5abaaf[_0xe676a9[_0xc064('0x29')]]={'$like':'%'+_0x938d77[_0xc064('0x31')][_0xc064('0x3f')]+'%'};return _0x5abaaf;}})});}_0x41b4d=_[_0xc064('0x3d')]({},_0x41b4d,_0x938d77[_0xc064('0x40')]);var _0x1917ab={'where':_0x41b4d[_0xc064('0x3b')]};return db[_0xc064('0x2d')][_0xc064('0x20')](_0x1917ab)[_0xc064('0x27')](function(_0xecabce){_0x55a8d5[_0xc064('0x20')]=_0xecabce;if(_0x938d77[_0xc064('0x31')]['includeAll']){_0x41b4d[_0xc064('0x41')]=[{'all':!![]}];}return db['MailTransferReport']['findAll'](_0x41b4d);})[_0xc064('0x27')](function(_0x4600ef){_0x55a8d5[_0xc064('0x42')]=_0x4600ef;return _0x55a8d5;})[_0xc064('0x27')](respondWithFilteredResult(_0x96cd71,_0x41b4d))[_0xc064('0x43')](handleError(_0x96cd71,null));};exports[_0xc064('0x44')]=function(_0x304292,_0x3d028f){var _0xd46a7f={'raw':!![],'where':{'id':_0x304292[_0xc064('0x45')]['id']}},_0x3d8660={};_0x3d8660[_0xc064('0x35')]=_['keys'](db[_0xc064('0x2d')][_0xc064('0x2e')]);_0x3d8660[_0xc064('0x31')]=_[_0xc064('0x32')](_0x304292['query']);_0x3d8660['filters']=_['intersection'](_0x3d8660[_0xc064('0x35')],_0x3d8660['query']);_0xd46a7f[_0xc064('0x36')]=_[_0xc064('0x34')](_0x3d8660[_0xc064('0x35')],qs[_0xc064('0x37')](_0x304292[_0xc064('0x31')][_0xc064('0x37')]));_0xd46a7f[_0xc064('0x36')]=_0xd46a7f['attributes'][_0xc064('0x38')]?_0xd46a7f[_0xc064('0x36')]:_0x3d8660[_0xc064('0x35')];if(_0x304292['query'][_0xc064('0x46')]){_0xd46a7f[_0xc064('0x41')]=[{'all':!![]}];}_0xd46a7f=_[_0xc064('0x3d')]({},_0xd46a7f,_0x304292[_0xc064('0x40')]);return db[_0xc064('0x2d')][_0xc064('0x47')](_0xd46a7f)[_0xc064('0x27')](handleEntityNotFound(_0x3d028f,null))[_0xc064('0x27')](respondWithResult(_0x3d028f,null))[_0xc064('0x43')](handleError(_0x3d028f,null));};exports['create']=function(_0x5a4723,_0x59a8e7){return db[_0xc064('0x2d')]['create'](_0x5a4723[_0xc064('0x48')],{})[_0xc064('0x27')](respondWithResult(_0x59a8e7,0xc9))[_0xc064('0x43')](handleError(_0x59a8e7,null));};exports[_0xc064('0x26')]=function(_0x3d8042,_0x546df6){if(_0x3d8042[_0xc064('0x48')]['id']){delete _0x3d8042[_0xc064('0x48')]['id'];}return db[_0xc064('0x2d')][_0xc064('0x47')]({'where':{'id':_0x3d8042['params']['id']}})['then'](handleEntityNotFound(_0x546df6,null))['then'](saveUpdates(_0x3d8042[_0xc064('0x48')],null))['then'](respondWithResult(_0x546df6,null))[_0xc064('0x43')](handleError(_0x546df6,null));};exports[_0xc064('0x49')]=function(_0x360673,_0xab0193){return db[_0xc064('0x2d')][_0xc064('0x47')]({'where':{'id':_0x360673[_0xc064('0x45')]['id']}})[_0xc064('0x27')](handleEntityNotFound(_0xab0193,null))[_0xc064('0x27')](removeEntity(_0xab0193,null))[_0xc064('0x43')](handleError(_0xab0193,null));};exports['describe']=function(_0x1e7926,_0x456ca2){return db[_0xc064('0x2d')]['describe']()['then'](respondWithResult(_0x456ca2,null))[_0xc064('0x43')](handleError(_0x456ca2,null));}; \ No newline at end of file +var _0x2d40=['rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','merge','where','type','VIRTUAL','MailTransferReport','then','includeAll','findAll','rows','catch','params','options','find','create','body','describe','rimraf','zip-dir','fast-json-patch','moment','bluebird','path','sox','to-csv','ejs','fs-extra','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','reject','save','update','error','stack','name','send','index','map'];(function(_0x5949ac,_0x54900f){var _0x30c367=function(_0x29d457){while(--_0x29d457){_0x5949ac['push'](_0x5949ac['shift']());}};_0x30c367(++_0x54900f);}(_0x2d40,0x18d));var _0x02d4=function(_0x17bd21,_0x436810){_0x17bd21=_0x17bd21-0x0;var _0x379ba3=_0x2d40[_0x17bd21];return _0x379ba3;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x02d4('0x0'));var zipdir=require(_0x02d4('0x1'));var jsonpatch=require(_0x02d4('0x2'));var rp=require('request-promise');var moment=require(_0x02d4('0x3'));var BPromise=require(_0x02d4('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x02d4('0x5'));var sox=require(_0x02d4('0x6'));var csv=require(_0x02d4('0x7'));var ejs=require(_0x02d4('0x8'));var fs=require('fs');var fs_extra=require(_0x02d4('0x9'));var _=require('lodash');var squel=require(_0x02d4('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x02d4('0xb'));var toCsv=require(_0x02d4('0x7'));var querystring=require('querystring');var Papa=require(_0x02d4('0xc'));var Redis=require(_0x02d4('0xd'));var authService=require(_0x02d4('0xe'));var qs=require(_0x02d4('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x02d4('0x10'));var logger=require(_0x02d4('0x11'))(_0x02d4('0x12'));var utils=require(_0x02d4('0x13'));var config=require(_0x02d4('0x14'));var licenseUtil=require(_0x02d4('0x15'));var db=require(_0x02d4('0x16'))['db'];function respondWithStatusCode(_0x57bd97,_0xda89f7){_0xda89f7=_0xda89f7||0xcc;return function(_0x4784a3){if(_0x4784a3){return _0x57bd97[_0x02d4('0x17')](_0xda89f7);}return _0x57bd97[_0x02d4('0x18')](_0xda89f7)[_0x02d4('0x19')]();};}function respondWithResult(_0xd46f8d,_0x416a89){_0x416a89=_0x416a89||0xc8;return function(_0x4983af){if(_0x4983af){return _0xd46f8d[_0x02d4('0x18')](_0x416a89)['json'](_0x4983af);}};}function respondWithFilteredResult(_0x4ef935,_0x16cd6f){return function(_0x346270){if(_0x346270){var _0x1c8434=typeof _0x16cd6f[_0x02d4('0x1a')]===_0x02d4('0x1b')&&typeof _0x16cd6f[_0x02d4('0x1c')]==='undefined';var _0x5cbf7c=_0x346270[_0x02d4('0x1d')];var _0x43c29e=_0x1c8434?0x0:_0x16cd6f['offset'];var _0x5485ff=_0x1c8434?_0x346270[_0x02d4('0x1d')]:_0x16cd6f[_0x02d4('0x1a')]+_0x16cd6f[_0x02d4('0x1c')];var _0x37cd81;if(_0x5485ff>=_0x5cbf7c){_0x5485ff=_0x5cbf7c;_0x37cd81=0xc8;}else{_0x37cd81=0xce;}_0x4ef935[_0x02d4('0x18')](_0x37cd81);return _0x4ef935['set'](_0x02d4('0x1e'),_0x43c29e+'-'+_0x5485ff+'/'+_0x5cbf7c)[_0x02d4('0x1f')](_0x346270);}return null;};}function patchUpdates(_0x234cda){return function(_0x4a37ad){try{jsonpatch['apply'](_0x4a37ad,_0x234cda,!![]);}catch(_0x2a62eb){return BPromise[_0x02d4('0x20')](_0x2a62eb);}return _0x4a37ad[_0x02d4('0x21')]();};}function saveUpdates(_0xcd3c6f,_0x2716c0){return function(_0x57cc9d){if(_0x57cc9d){return _0x57cc9d[_0x02d4('0x22')](_0xcd3c6f)['then'](function(_0xfbc2cc){return _0xfbc2cc;});}return null;};}function removeEntity(_0x4e1d9c,_0x1956d0){return function(_0x2a35eb){if(_0x2a35eb){return _0x2a35eb['destroy']()['then'](function(){_0x4e1d9c[_0x02d4('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x363d59,_0x2582eb){return function(_0x2c4324){if(!_0x2c4324){_0x363d59['sendStatus'](0x194);}return _0x2c4324;};}function handleError(_0x5abe3b,_0x15e9f5){_0x15e9f5=_0x15e9f5||0x1f4;return function(_0x704ccb){logger[_0x02d4('0x23')](_0x704ccb[_0x02d4('0x24')]);if(_0x704ccb['name']){delete _0x704ccb[_0x02d4('0x25')];}_0x5abe3b['status'](_0x15e9f5)[_0x02d4('0x26')](_0x704ccb);};}exports[_0x02d4('0x27')]=function(_0x341b16,_0x42efdc){var _0x35ad70={},_0x336890={},_0x46d510={'count':0x0,'rows':[]};var _0x42674d=_[_0x02d4('0x28')](db['MailTransferReport'][_0x02d4('0x29')],function(_0x4b6100){return{'name':_0x4b6100[_0x02d4('0x2a')],'type':_0x4b6100['type'][_0x02d4('0x2b')]};});_0x336890[_0x02d4('0x2c')]=_[_0x02d4('0x28')](_0x42674d,'name');_0x336890[_0x02d4('0x2d')]=_[_0x02d4('0x2e')](_0x341b16['query']);_0x336890[_0x02d4('0x2f')]=_[_0x02d4('0x30')](_0x336890['model'],_0x336890[_0x02d4('0x2d')]);_0x35ad70[_0x02d4('0x31')]=_[_0x02d4('0x30')](_0x336890[_0x02d4('0x2c')],qs[_0x02d4('0x32')](_0x341b16[_0x02d4('0x2d')][_0x02d4('0x32')]));_0x35ad70['attributes']=_0x35ad70[_0x02d4('0x31')][_0x02d4('0x33')]?_0x35ad70[_0x02d4('0x31')]:_0x336890[_0x02d4('0x2c')];if(!_0x341b16['query'][_0x02d4('0x34')](_0x02d4('0x35'))){_0x35ad70[_0x02d4('0x1c')]=qs[_0x02d4('0x1c')](_0x341b16[_0x02d4('0x2d')]['limit']);_0x35ad70[_0x02d4('0x1a')]=qs[_0x02d4('0x1a')](_0x341b16[_0x02d4('0x2d')]['offset']);}_0x35ad70['order']=qs[_0x02d4('0x36')](_0x341b16[_0x02d4('0x2d')][_0x02d4('0x36')]);_0x35ad70['where']=qs[_0x02d4('0x2f')](_[_0x02d4('0x37')](_0x341b16['query'],_0x336890[_0x02d4('0x2f')]),_0x42674d);if(_0x341b16[_0x02d4('0x2d')][_0x02d4('0x38')]){_0x35ad70['where']=_[_0x02d4('0x39')](_0x35ad70[_0x02d4('0x3a')],{'$or':_['map'](_0x42674d,function(_0x73786){if(_0x73786[_0x02d4('0x3b')]!==_0x02d4('0x3c')){var _0x2fd60a={};_0x2fd60a[_0x73786[_0x02d4('0x25')]]={'$like':'%'+_0x341b16[_0x02d4('0x2d')][_0x02d4('0x38')]+'%'};return _0x2fd60a;}})});}_0x35ad70=_[_0x02d4('0x39')]({},_0x35ad70,_0x341b16['options']);var _0x17f19b={'where':_0x35ad70['where']};return db[_0x02d4('0x3d')][_0x02d4('0x1d')](_0x17f19b)[_0x02d4('0x3e')](function(_0x37bea0){_0x46d510[_0x02d4('0x1d')]=_0x37bea0;if(_0x341b16[_0x02d4('0x2d')][_0x02d4('0x3f')]){_0x35ad70['include']=[{'all':!![]}];}return db[_0x02d4('0x3d')][_0x02d4('0x40')](_0x35ad70);})['then'](function(_0x9918ed){_0x46d510[_0x02d4('0x41')]=_0x9918ed;return _0x46d510;})['then'](respondWithFilteredResult(_0x42efdc,_0x35ad70))[_0x02d4('0x42')](handleError(_0x42efdc,null));};exports['show']=function(_0xb0c8dd,_0x4b3f6a){var _0x159c1f={'raw':!![],'where':{'id':_0xb0c8dd[_0x02d4('0x43')]['id']}},_0x3b3f41={};_0x3b3f41[_0x02d4('0x2c')]=_[_0x02d4('0x2e')](db[_0x02d4('0x3d')][_0x02d4('0x29')]);_0x3b3f41[_0x02d4('0x2d')]=_[_0x02d4('0x2e')](_0xb0c8dd[_0x02d4('0x2d')]);_0x3b3f41[_0x02d4('0x2f')]=_[_0x02d4('0x30')](_0x3b3f41['model'],_0x3b3f41[_0x02d4('0x2d')]);_0x159c1f[_0x02d4('0x31')]=_[_0x02d4('0x30')](_0x3b3f41['model'],qs[_0x02d4('0x32')](_0xb0c8dd[_0x02d4('0x2d')]['fields']));_0x159c1f[_0x02d4('0x31')]=_0x159c1f[_0x02d4('0x31')]['length']?_0x159c1f['attributes']:_0x3b3f41[_0x02d4('0x2c')];if(_0xb0c8dd[_0x02d4('0x2d')][_0x02d4('0x3f')]){_0x159c1f['include']=[{'all':!![]}];}_0x159c1f=_[_0x02d4('0x39')]({},_0x159c1f,_0xb0c8dd[_0x02d4('0x44')]);return db[_0x02d4('0x3d')][_0x02d4('0x45')](_0x159c1f)[_0x02d4('0x3e')](handleEntityNotFound(_0x4b3f6a,null))['then'](respondWithResult(_0x4b3f6a,null))[_0x02d4('0x42')](handleError(_0x4b3f6a,null));};exports[_0x02d4('0x46')]=function(_0x4c5d14,_0x38703d){return db['MailTransferReport']['create'](_0x4c5d14[_0x02d4('0x47')],{})['then'](respondWithResult(_0x38703d,0xc9))[_0x02d4('0x42')](handleError(_0x38703d,null));};exports[_0x02d4('0x22')]=function(_0x2b5b72,_0x52bce0){if(_0x2b5b72['body']['id']){delete _0x2b5b72['body']['id'];}return db['MailTransferReport'][_0x02d4('0x45')]({'where':{'id':_0x2b5b72['params']['id']}})[_0x02d4('0x3e')](handleEntityNotFound(_0x52bce0,null))['then'](saveUpdates(_0x2b5b72['body'],null))[_0x02d4('0x3e')](respondWithResult(_0x52bce0,null))[_0x02d4('0x42')](handleError(_0x52bce0,null));};exports['destroy']=function(_0x1b1c2e,_0xdc8fad){return db['MailTransferReport'][_0x02d4('0x45')]({'where':{'id':_0x1b1c2e[_0x02d4('0x43')]['id']}})[_0x02d4('0x3e')](handleEntityNotFound(_0xdc8fad,null))[_0x02d4('0x3e')](removeEntity(_0xdc8fad,null))[_0x02d4('0x42')](handleError(_0xdc8fad,null));};exports[_0x02d4('0x48')]=function(_0x66d97c,_0x413906){return db['MailTransferReport'][_0x02d4('0x48')]()[_0x02d4('0x3e')](respondWithResult(_0x413906,null))[_0x02d4('0x42')](handleError(_0x413906,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index 389fcd7..2469715 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 _0x40c2=['./mailTransferReport.attributes','exports','MailTransferReport','report_mail_transfer','uniqueid','util','../../config/logger','api','moment','path','rimraf','../../config/environment'];(function(_0x46ea9a,_0x1f5337){var _0x5a474d=function(_0x1ac61c){while(--_0x1ac61c){_0x46ea9a['push'](_0x46ea9a['shift']());}};_0x5a474d(++_0x1f5337);}(_0x40c2,0x10d));var _0x240c=function(_0x2b1d94,_0x36febb){_0x2b1d94=_0x2b1d94-0x0;var _0x4d2cf7=_0x40c2[_0x2b1d94];return _0x4d2cf7;};'use strict';var _=require('lodash');var util=require(_0x240c('0x0'));var logger=require(_0x240c('0x1'))(_0x240c('0x2'));var moment=require(_0x240c('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x240c('0x4'));var rimraf=require(_0x240c('0x5'));var config=require(_0x240c('0x6'));var attributes=require(_0x240c('0x7'));module[_0x240c('0x8')]=function(_0xf776b7,_0x2d597f){return _0xf776b7['define'](_0x240c('0x9'),attributes,{'tableName':_0x240c('0xa'),'paranoid':![],'indexes':[{'name':_0x240c('0xb'),'fields':[_0x240c('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xfcda=['api','path','rimraf','../../config/environment','./mailTransferReport.attributes','exports','MailTransferReport','uniqueid','lodash','util'];(function(_0x27eacf,_0x5c8bf2){var _0x4276b9=function(_0x274ede){while(--_0x274ede){_0x27eacf['push'](_0x27eacf['shift']());}};_0x4276b9(++_0x5c8bf2);}(_0xfcda,0x198));var _0xafcd=function(_0x230784,_0x402618){_0x230784=_0x230784-0x0;var _0x4f54f=_0xfcda[_0x230784];return _0x4f54f;};'use strict';var _=require(_0xafcd('0x0'));var util=require(_0xafcd('0x1'));var logger=require('../../config/logger')(_0xafcd('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xafcd('0x3'));var rimraf=require(_0xafcd('0x4'));var config=require(_0xafcd('0x5'));var attributes=require(_0xafcd('0x6'));module[_0xafcd('0x7')]=function(_0x412e67,_0x2623cb){return _0x412e67['define'](_0xafcd('0x8'),attributes,{'tableName':'report_mail_transfer','paranoid':![],'indexes':[{'name':_0xafcd('0x9'),'fields':[_0xafcd('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.rpc.js b/server/api/mailTransferReport/mailTransferReport.rpc.js index 28bebf8..81c15ec 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 _0x4faf=['request','then','info','MailTransferReport,\x20%s,\x20%s','request\x20sent','MailTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http'];(function(_0x2cbec0,_0x262fef){var _0x3d4101=function(_0x549a36){while(--_0x549a36){_0x2cbec0['push'](_0x2cbec0['shift']());}};_0x3d4101(++_0x262fef);}(_0x4faf,0xb3));var _0xf4fa=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x4faf[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xf4fa('0x0'));var BPromise=require(_0xf4fa('0x1'));var rs=require(_0xf4fa('0x2'));var fs=require('fs');var Redis=require(_0xf4fa('0x3'));var db=require(_0xf4fa('0x4'))['db'];var utils=require(_0xf4fa('0x5'));var logger=require('../../config/logger')(_0xf4fa('0x6'));var config=require(_0xf4fa('0x7'));var jayson=require(_0xf4fa('0x8'));var client=jayson['client'][_0xf4fa('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1baa75,_0x4c396c,_0x3bc11f){return new BPromise(function(_0x418588,_0x23b703){return client[_0xf4fa('0xa')](_0x1baa75,_0x3bc11f)[_0xf4fa('0xb')](function(_0x5eda6f){logger[_0xf4fa('0xc')](_0xf4fa('0xd'),_0x4c396c,_0xf4fa('0xe'));logger['debug'](_0xf4fa('0xf'),_0x4c396c,_0xf4fa('0xe'),JSON[_0xf4fa('0x10')](_0x5eda6f));if(_0x5eda6f[_0xf4fa('0x11')]){if(_0x5eda6f[_0xf4fa('0x11')][_0xf4fa('0x12')]===0x1f4){logger[_0xf4fa('0x11')](_0xf4fa('0xd'),_0x4c396c,_0x5eda6f[_0xf4fa('0x11')][_0xf4fa('0x13')]);return _0x23b703(_0x5eda6f[_0xf4fa('0x11')][_0xf4fa('0x13')]);}logger[_0xf4fa('0x11')]('MailTransferReport,\x20%s,\x20%s',_0x4c396c,_0x5eda6f['error'][_0xf4fa('0x13')]);return _0x418588(_0x5eda6f[_0xf4fa('0x11')][_0xf4fa('0x13')]);}else{logger['info']('MailTransferReport,\x20%s,\x20%s',_0x4c396c,_0xf4fa('0xe'));_0x418588(_0x5eda6f[_0xf4fa('0x14')]['message']);}})['catch'](function(_0x3e5ad3){logger[_0xf4fa('0x11')](_0xf4fa('0xd'),_0x4c396c,_0x3e5ad3);_0x23b703(_0x3e5ad3);});});} \ No newline at end of file +var _0x03a6=['jayson/promise','client','http','request','then','info','MailTransferReport,\x20%s,\x20%s','request\x20sent','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x355ca3,_0xd3e1e7){var _0x55edba=function(_0x29ec8e){while(--_0x29ec8e){_0x355ca3['push'](_0x355ca3['shift']());}};_0x55edba(++_0xd3e1e7);}(_0x03a6,0xcf));var _0x603a=function(_0x35bde6,_0x56d846){_0x35bde6=_0x35bde6-0x0;var _0x971a1a=_0x03a6[_0x35bde6];return _0x971a1a;};'use strict';var _=require(_0x603a('0x0'));var util=require(_0x603a('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x603a('0x2'));var fs=require('fs');var Redis=require(_0x603a('0x3'));var db=require(_0x603a('0x4'))['db'];var utils=require(_0x603a('0x5'));var logger=require(_0x603a('0x6'))(_0x603a('0x7'));var config=require(_0x603a('0x8'));var jayson=require(_0x603a('0x9'));var client=jayson[_0x603a('0xa')][_0x603a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x386b8a,_0x379f15,_0xa02b22){return new BPromise(function(_0x3e5d4b,_0x5079f3){return client[_0x603a('0xc')](_0x386b8a,_0xa02b22)[_0x603a('0xd')](function(_0x27d70b){logger[_0x603a('0xe')](_0x603a('0xf'),_0x379f15,_0x603a('0x10'));logger[_0x603a('0x11')](_0x603a('0x12'),_0x379f15,_0x603a('0x10'),JSON[_0x603a('0x13')](_0x27d70b));if(_0x27d70b[_0x603a('0x14')]){if(_0x27d70b[_0x603a('0x14')][_0x603a('0x15')]===0x1f4){logger[_0x603a('0x14')]('MailTransferReport,\x20%s,\x20%s',_0x379f15,_0x27d70b[_0x603a('0x14')][_0x603a('0x16')]);return _0x5079f3(_0x27d70b[_0x603a('0x14')][_0x603a('0x16')]);}logger[_0x603a('0x14')](_0x603a('0xf'),_0x379f15,_0x27d70b[_0x603a('0x14')][_0x603a('0x16')]);return _0x3e5d4b(_0x27d70b[_0x603a('0x14')][_0x603a('0x16')]);}else{logger[_0x603a('0xe')]('MailTransferReport,\x20%s,\x20%s',_0x379f15,'request\x20sent');_0x3e5d4b(_0x27d70b['result'][_0x603a('0x16')]);}})[_0x603a('0x17')](function(_0x399241){logger[_0x603a('0x14')]('MailTransferReport,\x20%s,\x20%s',_0x379f15,_0x399241);_0x5079f3(_0x399241);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index b81225d..20833b5 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 _0x1ad4=['./memberReport.controller','get','isAuthenticated','index','/describe','show','post','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0x459cb8,_0xa8f310){var _0x703bb3=function(_0x1c460d){while(--_0x1c460d){_0x459cb8['push'](_0x459cb8['shift']());}};_0x703bb3(++_0xa8f310);}(_0x1ad4,0x116));var _0x41ad=function(_0x130705,_0x2d266b){_0x130705=_0x130705-0x0;var _0x1fa991=_0x1ad4[_0x130705];return _0x1fa991;};'use strict';var multer=require(_0x41ad('0x0'));var util=require(_0x41ad('0x1'));var path=require(_0x41ad('0x2'));var timeout=require(_0x41ad('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x41ad('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x41ad('0x5'));var config=require(_0x41ad('0x6'));var controller=require(_0x41ad('0x7'));router[_0x41ad('0x8')]('/',auth[_0x41ad('0x9')](),controller[_0x41ad('0xa')]);router[_0x41ad('0x8')](_0x41ad('0xb'),auth[_0x41ad('0x9')](),controller['describe']);router[_0x41ad('0x8')]('/:id',auth[_0x41ad('0x9')](),controller[_0x41ad('0xc')]);router[_0x41ad('0xd')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x41ad('0xe'),auth[_0x41ad('0x9')](),controller[_0x41ad('0xf')]);router[_0x41ad('0x10')](_0x41ad('0xe'),auth[_0x41ad('0x9')](),controller[_0x41ad('0x11')]);module[_0x41ad('0x12')]=router; \ No newline at end of file +var _0xd08d=['describe','/:id','post','create','put','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./memberReport.controller','get','isAuthenticated','index','/describe'];(function(_0x137b22,_0x39adfa){var _0x46f2e9=function(_0x39f4e7){while(--_0x39f4e7){_0x137b22['push'](_0x137b22['shift']());}};_0x46f2e9(++_0x39adfa);}(_0xd08d,0x1c0));var _0xdd08=function(_0x1a36a5,_0x746928){_0x1a36a5=_0x1a36a5-0x0;var _0x746243=_0xd08d[_0x1a36a5];return _0x746243;};'use strict';var multer=require('multer');var util=require(_0xdd08('0x0'));var path=require(_0xdd08('0x1'));var timeout=require(_0xdd08('0x2'));var express=require(_0xdd08('0x3'));var router=express[_0xdd08('0x4')]();var fs_extra=require(_0xdd08('0x5'));var auth=require(_0xdd08('0x6'));var interaction=require(_0xdd08('0x7'));var config=require(_0xdd08('0x8'));var controller=require(_0xdd08('0x9'));router[_0xdd08('0xa')]('/',auth[_0xdd08('0xb')](),controller[_0xdd08('0xc')]);router[_0xdd08('0xa')](_0xdd08('0xd'),auth['isAuthenticated'](),controller[_0xdd08('0xe')]);router['get'](_0xdd08('0xf'),auth[_0xdd08('0xb')](),controller['show']);router[_0xdd08('0x10')]('/',auth[_0xdd08('0xb')](),controller[_0xdd08('0x11')]);router[_0xdd08('0x12')](_0xdd08('0xf'),auth[_0xdd08('0xb')](),controller['update']);router[_0xdd08('0x13')]('/:id',auth[_0xdd08('0xb')](),controller[_0xdd08('0x14')]);module[_0xdd08('0x15')]=router; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.attributes.js b/server/api/memberReport/memberReport.attributes.js index 8c6d692..493dce0 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 _0xc112=['setDataValue','exitAt','duration','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]','talk:[destination]','talk:[dial\x20string]','talk:[queue]','sequelize','moment','exports','STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','DATE','getDataValue','enterAt','diff'];(function(_0x2d4619,_0x343487){var _0x21a085=function(_0x460f27){while(--_0x460f27){_0x2d4619['push'](_0x2d4619['shift']());}};_0x21a085(++_0x343487);}(_0xc112,0xec));var _0x2c11=function(_0x4ab82e,_0x227cea){_0x4ab82e=_0x4ab82e-0x0;var _0xd15e2a=_0xc112[_0x4ab82e];return _0xd15e2a;};'use strict';var Sequelize=require(_0x2c11('0x0'));var moment=require(_0x2c11('0x1'));module[_0x2c11('0x2')]={'channel':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x2c11('0x3')]},'interface':{'type':Sequelize[_0x2c11('0x3')]},'type':{'type':Sequelize[_0x2c11('0x3')],'defaultValue':_0x2c11('0x4'),'comment':_0x2c11('0x5')},'duration':{'type':Sequelize[_0x2c11('0x6')]},'enterAt':{'type':Sequelize[_0x2c11('0x7')]},'exitAt':{'type':Sequelize[_0x2c11('0x7')],'set':function(_0x2337d0){var _0x5c4748=moment(_0x2337d0);var _0x5c2399=moment(this[_0x2c11('0x8')](_0x2c11('0x9')));var _0x29dfcf=_0x5c4748[_0x2c11('0xa')](_0x5c2399,'seconds');this[_0x2c11('0xb')](_0x2c11('0xc'),_0x2337d0);this['setDataValue'](_0x2c11('0xd'),_0x29dfcf||null);}},'data1':{'type':Sequelize[_0x2c11('0x3')],'comment':_0x2c11('0xe')},'data2':{'type':Sequelize[_0x2c11('0x3')],'comment':_0x2c11('0xf')},'data3':{'type':Sequelize['STRING'],'comment':_0x2c11('0x10')},'data4':{'type':Sequelize[_0x2c11('0x3')],'comment':_0x2c11('0x11')},'data5':{'type':Sequelize[_0x2c11('0x3')],'comment':_0x2c11('0x12')},'role':{'type':Sequelize[_0x2c11('0x3')]},'internal':{'type':Sequelize[_0x2c11('0x6')]},'uniqueid':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x851c=['setDataValue','exitAt','duration','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]','talk:[destination]','talk:[dial\x20string]','talk:[queue]','sequelize','moment','exports','STRING','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','DATE'];(function(_0x815c23,_0x577e3a){var _0x357aa1=function(_0x289b7a){while(--_0x289b7a){_0x815c23['push'](_0x815c23['shift']());}};_0x357aa1(++_0x577e3a);}(_0x851c,0x19d));var _0xc851=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x851c[_0x501510];return _0x1e6ee5;};'use strict';var Sequelize=require(_0xc851('0x0'));var moment=require(_0xc851('0x1'));module[_0xc851('0x2')]={'channel':{'type':Sequelize[_0xc851('0x3')]},'membername':{'type':Sequelize[_0xc851('0x3')]},'interface':{'type':Sequelize[_0xc851('0x3')]},'type':{'type':Sequelize[_0xc851('0x3')],'defaultValue':'DEFAULT\x20PAUSE','comment':_0xc851('0x4')},'duration':{'type':Sequelize[_0xc851('0x5')]},'enterAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0xc851('0x6')],'set':function(_0x272e34){var _0x535cf1=moment(_0x272e34);var _0x3067e5=moment(this['getDataValue']('enterAt'));var _0x12a405=_0x535cf1['diff'](_0x3067e5,'seconds');this[_0xc851('0x7')](_0xc851('0x8'),_0x272e34);this[_0xc851('0x7')](_0xc851('0x9'),_0x12a405||null);}},'data1':{'type':Sequelize[_0xc851('0x3')],'comment':_0xc851('0xa')},'data2':{'type':Sequelize[_0xc851('0x3')],'comment':_0xc851('0xb')},'data3':{'type':Sequelize['STRING'],'comment':_0xc851('0xc')},'data4':{'type':Sequelize[_0xc851('0x3')],'comment':_0xc851('0xd')},'data5':{'type':Sequelize[_0xc851('0x3')],'comment':_0xc851('0xe')},'role':{'type':Sequelize[_0xc851('0x3')]},'internal':{'type':Sequelize[_0xc851('0x5')]},'uniqueid':{'type':Sequelize[_0xc851('0x3')]}}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index 51d6a9a..dbcab59 100644 --- a/server/api/memberReport/memberReport.controller.js +++ b/server/api/memberReport/memberReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xedd9=['keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','params','find','create','body','update','destroy','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','apply','then','end','error','stack','send','index','map','MemberReport','rawAttributes','fieldName','type','key','model','name','query'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0xedd9,0xfc));var _0x9edd=function(_0x930f73,_0xfe73ea){_0x930f73=_0x930f73-0x0;var _0x47762f=_0xedd9[_0x930f73];return _0x47762f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9edd('0x0'));var zipdir=require(_0x9edd('0x1'));var jsonpatch=require(_0x9edd('0x2'));var rp=require(_0x9edd('0x3'));var moment=require(_0x9edd('0x4'));var BPromise=require(_0x9edd('0x5'));var Mustache=require(_0x9edd('0x6'));var util=require(_0x9edd('0x7'));var path=require('path');var sox=require(_0x9edd('0x8'));var csv=require(_0x9edd('0x9'));var ejs=require(_0x9edd('0xa'));var fs=require('fs');var fs_extra=require(_0x9edd('0xb'));var _=require('lodash');var squel=require(_0x9edd('0xc'));var crypto=require('crypto');var jsforce=require(_0x9edd('0xd'));var deskjs=require(_0x9edd('0xe'));var toCsv=require(_0x9edd('0x9'));var querystring=require(_0x9edd('0xf'));var Papa=require('papaparse');var Redis=require(_0x9edd('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x9edd('0x11'));var as=require(_0x9edd('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9edd('0x13'))(_0x9edd('0x14'));var utils=require('../../config/utils');var config=require(_0x9edd('0x15'));var licenseUtil=require(_0x9edd('0x16'));var db=require(_0x9edd('0x17'))['db'];function respondWithStatusCode(_0xfd544a,_0x287ddd){_0x287ddd=_0x287ddd||0xcc;return function(_0x3a7b84){if(_0x3a7b84){return _0xfd544a[_0x9edd('0x18')](_0x287ddd);}return _0xfd544a[_0x9edd('0x19')](_0x287ddd)['end']();};}function respondWithResult(_0x176bfa,_0x44fc7c){_0x44fc7c=_0x44fc7c||0xc8;return function(_0x891832){if(_0x891832){return _0x176bfa[_0x9edd('0x19')](_0x44fc7c)[_0x9edd('0x1a')](_0x891832);}};}function respondWithFilteredResult(_0x338f3c,_0x1042aa){return function(_0x75a4ab){if(_0x75a4ab){var _0x4ea60f=typeof _0x1042aa[_0x9edd('0x1b')]===_0x9edd('0x1c')&&typeof _0x1042aa[_0x9edd('0x1d')]==='undefined';var _0x1b54c0=_0x75a4ab[_0x9edd('0x1e')];var _0x40ba32=_0x4ea60f?0x0:_0x1042aa['offset'];var _0x43dc70=_0x4ea60f?_0x75a4ab['count']:_0x1042aa[_0x9edd('0x1b')]+_0x1042aa[_0x9edd('0x1d')];var _0x4bdb88;if(_0x43dc70>=_0x1b54c0){_0x43dc70=_0x1b54c0;_0x4bdb88=0xc8;}else{_0x4bdb88=0xce;}_0x338f3c['status'](_0x4bdb88);return _0x338f3c[_0x9edd('0x1f')]('Content-Range',_0x40ba32+'-'+_0x43dc70+'/'+_0x1b54c0)[_0x9edd('0x1a')](_0x75a4ab);}return null;};}function patchUpdates(_0x54a03f){return function(_0x535f37){try{jsonpatch[_0x9edd('0x20')](_0x535f37,_0x54a03f,!![]);}catch(_0x1c46a8){return BPromise['reject'](_0x1c46a8);}return _0x535f37['save']();};}function saveUpdates(_0x341d67,_0x186186){return function(_0x477878){if(_0x477878){return _0x477878['update'](_0x341d67)[_0x9edd('0x21')](function(_0x1dca43){return _0x1dca43;});}return null;};}function removeEntity(_0x44a6c1,_0x2ca65f){return function(_0x339a0d){if(_0x339a0d){return _0x339a0d['destroy']()[_0x9edd('0x21')](function(){_0x44a6c1[_0x9edd('0x19')](0xcc)[_0x9edd('0x22')]();});}};}function handleEntityNotFound(_0x2f9f86,_0x310a4d){return function(_0x4d507f){if(!_0x4d507f){_0x2f9f86['sendStatus'](0x194);}return _0x4d507f;};}function handleError(_0x3276ee,_0xfeca7b){_0xfeca7b=_0xfeca7b||0x1f4;return function(_0x8d67aa){logger[_0x9edd('0x23')](_0x8d67aa[_0x9edd('0x24')]);if(_0x8d67aa['name']){delete _0x8d67aa['name'];}_0x3276ee[_0x9edd('0x19')](_0xfeca7b)[_0x9edd('0x25')](_0x8d67aa);};}exports[_0x9edd('0x26')]=function(_0x52746a,_0x238b22){var _0x28cfae={},_0x2ae8dd={},_0x41af53={'count':0x0,'rows':[]};var _0x5eccfb=_[_0x9edd('0x27')](db[_0x9edd('0x28')][_0x9edd('0x29')],function(_0x12c1bc){return{'name':_0x12c1bc[_0x9edd('0x2a')],'type':_0x12c1bc[_0x9edd('0x2b')][_0x9edd('0x2c')]};});_0x2ae8dd[_0x9edd('0x2d')]=_[_0x9edd('0x27')](_0x5eccfb,_0x9edd('0x2e'));_0x2ae8dd[_0x9edd('0x2f')]=_[_0x9edd('0x30')](_0x52746a[_0x9edd('0x2f')]);_0x2ae8dd[_0x9edd('0x31')]=_[_0x9edd('0x32')](_0x2ae8dd['model'],_0x2ae8dd[_0x9edd('0x2f')]);_0x28cfae[_0x9edd('0x33')]=_[_0x9edd('0x32')](_0x2ae8dd['model'],qs[_0x9edd('0x34')](_0x52746a[_0x9edd('0x2f')][_0x9edd('0x34')]));_0x28cfae[_0x9edd('0x33')]=_0x28cfae[_0x9edd('0x33')][_0x9edd('0x35')]?_0x28cfae[_0x9edd('0x33')]:_0x2ae8dd[_0x9edd('0x2d')];if(!_0x52746a[_0x9edd('0x2f')][_0x9edd('0x36')](_0x9edd('0x37'))){_0x28cfae[_0x9edd('0x1d')]=qs[_0x9edd('0x1d')](_0x52746a[_0x9edd('0x2f')]['limit']);_0x28cfae[_0x9edd('0x1b')]=qs['offset'](_0x52746a[_0x9edd('0x2f')][_0x9edd('0x1b')]);}_0x28cfae[_0x9edd('0x38')]=qs[_0x9edd('0x39')](_0x52746a[_0x9edd('0x2f')]['sort']);_0x28cfae[_0x9edd('0x3a')]=qs[_0x9edd('0x31')](_[_0x9edd('0x3b')](_0x52746a[_0x9edd('0x2f')],_0x2ae8dd[_0x9edd('0x31')]),_0x5eccfb);if(_0x52746a[_0x9edd('0x2f')][_0x9edd('0x3c')]){_0x28cfae[_0x9edd('0x3a')]=_[_0x9edd('0x3d')](_0x28cfae[_0x9edd('0x3a')],{'$or':_['map'](_0x5eccfb,function(_0x231604){if(_0x231604['type']!==_0x9edd('0x3e')){var _0x5658d6={};_0x5658d6[_0x231604[_0x9edd('0x2e')]]={'$like':'%'+_0x52746a[_0x9edd('0x2f')][_0x9edd('0x3c')]+'%'};return _0x5658d6;}})});}_0x28cfae=_['merge']({},_0x28cfae,_0x52746a[_0x9edd('0x3f')]);var _0xcbd0ef={'where':_0x28cfae[_0x9edd('0x3a')]};return db['MemberReport'][_0x9edd('0x1e')](_0xcbd0ef)['then'](function(_0x1fc4fb){_0x41af53[_0x9edd('0x1e')]=_0x1fc4fb;if(_0x52746a['query'][_0x9edd('0x40')]){_0x28cfae[_0x9edd('0x41')]=[{'all':!![]}];}return db[_0x9edd('0x28')][_0x9edd('0x42')](_0x28cfae);})['then'](function(_0x449f01){_0x41af53['rows']=_0x449f01;return _0x41af53;})[_0x9edd('0x21')](respondWithFilteredResult(_0x238b22,_0x28cfae))[_0x9edd('0x43')](handleError(_0x238b22,null));};exports['show']=function(_0x318757,_0x49a128){var _0x548299={'raw':!![],'where':{'id':_0x318757[_0x9edd('0x44')]['id']}},_0x369b69={};_0x369b69[_0x9edd('0x2d')]=_[_0x9edd('0x30')](db[_0x9edd('0x28')][_0x9edd('0x29')]);_0x369b69[_0x9edd('0x2f')]=_[_0x9edd('0x30')](_0x318757[_0x9edd('0x2f')]);_0x369b69[_0x9edd('0x31')]=_[_0x9edd('0x32')](_0x369b69[_0x9edd('0x2d')],_0x369b69[_0x9edd('0x2f')]);_0x548299[_0x9edd('0x33')]=_[_0x9edd('0x32')](_0x369b69['model'],qs[_0x9edd('0x34')](_0x318757[_0x9edd('0x2f')][_0x9edd('0x34')]));_0x548299[_0x9edd('0x33')]=_0x548299[_0x9edd('0x33')][_0x9edd('0x35')]?_0x548299[_0x9edd('0x33')]:_0x369b69['model'];if(_0x318757['query']['includeAll']){_0x548299[_0x9edd('0x41')]=[{'all':!![]}];}_0x548299=_['merge']({},_0x548299,_0x318757[_0x9edd('0x3f')]);return db[_0x9edd('0x28')][_0x9edd('0x45')](_0x548299)[_0x9edd('0x21')](handleEntityNotFound(_0x49a128,null))[_0x9edd('0x21')](respondWithResult(_0x49a128,null))['catch'](handleError(_0x49a128,null));};exports[_0x9edd('0x46')]=function(_0x35e63c,_0x40e33d){return db['MemberReport'][_0x9edd('0x46')](_0x35e63c[_0x9edd('0x47')],{})[_0x9edd('0x21')](respondWithResult(_0x40e33d,0xc9))[_0x9edd('0x43')](handleError(_0x40e33d,null));};exports[_0x9edd('0x48')]=function(_0x35bdec,_0x4d4f33){if(_0x35bdec[_0x9edd('0x47')]['id']){delete _0x35bdec[_0x9edd('0x47')]['id'];}return db['MemberReport'][_0x9edd('0x45')]({'where':{'id':_0x35bdec[_0x9edd('0x44')]['id']}})['then'](handleEntityNotFound(_0x4d4f33,null))[_0x9edd('0x21')](saveUpdates(_0x35bdec[_0x9edd('0x47')],null))[_0x9edd('0x21')](respondWithResult(_0x4d4f33,null))['catch'](handleError(_0x4d4f33,null));};exports[_0x9edd('0x49')]=function(_0x151157,_0x317a60){return db[_0x9edd('0x28')]['find']({'where':{'id':_0x151157[_0x9edd('0x44')]['id']}})[_0x9edd('0x21')](handleEntityNotFound(_0x317a60,null))[_0x9edd('0x21')](removeEntity(_0x317a60,null))['catch'](handleError(_0x317a60,null));};exports[_0x9edd('0x4a')]=function(_0x21f6ce,_0x57db43){return db[_0x9edd('0x28')]['describe']()[_0x9edd('0x21')](respondWithResult(_0x57db43,null))[_0x9edd('0x43')](handleError(_0x57db43,null));}; \ No newline at end of file +var _0x9957=['util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','then','destroy','error','name','send','index','fieldName','type','key','model','map','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','MemberReport','findAll','rows','show','rawAttributes','includeAll','include','find','create','catch','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache'];(function(_0x19a0bc,_0x2f7125){var _0x4d6c30=function(_0x35b981){while(--_0x35b981){_0x19a0bc['push'](_0x19a0bc['shift']());}};_0x4d6c30(++_0x2f7125);}(_0x9957,0x93));var _0x7995=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x9957[_0x3947c9];return _0x2e7871;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){var _0x514445={},_0x456a28={},_0x3250e0={'count':0x0,'rows':[]};var _0x4253e5=_['map'](db['MemberReport']['rawAttributes'],function(_0x3573be){return{'name':_0x3573be[_0x7995('0x2c')],'type':_0x3573be[_0x7995('0x2d')][_0x7995('0x2e')]};});_0x456a28[_0x7995('0x2f')]=_[_0x7995('0x30')](_0x4253e5,'name');_0x456a28['query']=_[_0x7995('0x31')](_0x4b6f99['query']);_0x456a28[_0x7995('0x32')]=_[_0x7995('0x33')](_0x456a28[_0x7995('0x2f')],_0x456a28[_0x7995('0x34')]);_0x514445[_0x7995('0x35')]=_['intersection'](_0x456a28[_0x7995('0x2f')],qs[_0x7995('0x36')](_0x4b6f99['query']['fields']));_0x514445['attributes']=_0x514445[_0x7995('0x35')][_0x7995('0x37')]?_0x514445['attributes']:_0x456a28[_0x7995('0x2f')];if(!_0x4b6f99['query'][_0x7995('0x38')](_0x7995('0x39'))){_0x514445[_0x7995('0x21')]=qs['limit'](_0x4b6f99['query'][_0x7995('0x21')]);_0x514445['offset']=qs['offset'](_0x4b6f99[_0x7995('0x34')][_0x7995('0x20')]);}_0x514445['order']=qs[_0x7995('0x3a')](_0x4b6f99[_0x7995('0x34')][_0x7995('0x3a')]);_0x514445[_0x7995('0x3b')]=qs[_0x7995('0x32')](_['pick'](_0x4b6f99[_0x7995('0x34')],_0x456a28[_0x7995('0x32')]),_0x4253e5);if(_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]){_0x514445['where']=_[_0x7995('0x3d')](_0x514445[_0x7995('0x3b')],{'$or':_[_0x7995('0x30')](_0x4253e5,function(_0xe5ea43){if(_0xe5ea43[_0x7995('0x2d')]!==_0x7995('0x3e')){var _0x5688a1={};_0x5688a1[_0xe5ea43[_0x7995('0x29')]]={'$like':'%'+_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]+'%'};return _0x5688a1;}})});}_0x514445=_[_0x7995('0x3d')]({},_0x514445,_0x4b6f99[_0x7995('0x3f')]);var _0x298fc2={'where':_0x514445[_0x7995('0x3b')]};return db[_0x7995('0x40')][_0x7995('0x1f')](_0x298fc2)[_0x7995('0x26')](function(_0x6fe77b){_0x3250e0[_0x7995('0x1f')]=_0x6fe77b;if(_0x4b6f99[_0x7995('0x34')]['includeAll']){_0x514445['include']=[{'all':!![]}];}return db[_0x7995('0x40')][_0x7995('0x41')](_0x514445);})['then'](function(_0x4b0855){_0x3250e0[_0x7995('0x42')]=_0x4b0855;return _0x3250e0;})['then'](respondWithFilteredResult(_0x9b2a15,_0x514445))['catch'](handleError(_0x9b2a15,null));};exports[_0x7995('0x43')]=function(_0x36e28b,_0x35c8ff){var _0x576b96={'raw':!![],'where':{'id':_0x36e28b['params']['id']}},_0x46ac4f={};_0x46ac4f[_0x7995('0x2f')]=_['keys'](db['MemberReport'][_0x7995('0x44')]);_0x46ac4f[_0x7995('0x34')]=_[_0x7995('0x31')](_0x36e28b[_0x7995('0x34')]);_0x46ac4f['filters']=_[_0x7995('0x33')](_0x46ac4f[_0x7995('0x2f')],_0x46ac4f[_0x7995('0x34')]);_0x576b96[_0x7995('0x35')]=_['intersection'](_0x46ac4f['model'],qs[_0x7995('0x36')](_0x36e28b['query'][_0x7995('0x36')]));_0x576b96['attributes']=_0x576b96[_0x7995('0x35')]['length']?_0x576b96[_0x7995('0x35')]:_0x46ac4f[_0x7995('0x2f')];if(_0x36e28b['query'][_0x7995('0x45')]){_0x576b96[_0x7995('0x46')]=[{'all':!![]}];}_0x576b96=_[_0x7995('0x3d')]({},_0x576b96,_0x36e28b[_0x7995('0x3f')]);return db['MemberReport'][_0x7995('0x47')](_0x576b96)[_0x7995('0x26')](handleEntityNotFound(_0x35c8ff,null))[_0x7995('0x26')](respondWithResult(_0x35c8ff,null))['catch'](handleError(_0x35c8ff,null));};exports[_0x7995('0x48')]=function(_0x44f516,_0x511567){return db[_0x7995('0x40')][_0x7995('0x48')](_0x44f516['body'],{})[_0x7995('0x26')](respondWithResult(_0x511567,0xc9))[_0x7995('0x49')](handleError(_0x511567,null));};exports['update']=function(_0x3d1dbb,_0x5843ba){if(_0x3d1dbb[_0x7995('0x4a')]['id']){delete _0x3d1dbb[_0x7995('0x4a')]['id'];}return db[_0x7995('0x40')][_0x7995('0x47')]({'where':{'id':_0x3d1dbb[_0x7995('0x4b')]['id']}})[_0x7995('0x26')](handleEntityNotFound(_0x5843ba,null))[_0x7995('0x26')](saveUpdates(_0x3d1dbb['body'],null))[_0x7995('0x26')](respondWithResult(_0x5843ba,null))[_0x7995('0x49')](handleError(_0x5843ba,null));};exports[_0x7995('0x27')]=function(_0x4ffc8a,_0x19da63){return db[_0x7995('0x40')][_0x7995('0x47')]({'where':{'id':_0x4ffc8a['params']['id']}})['then'](handleEntityNotFound(_0x19da63,null))['then'](removeEntity(_0x19da63,null))[_0x7995('0x49')](handleError(_0x19da63,null));};exports[_0x7995('0x4c')]=function(_0x4cf5db,_0x1cd85){return db[_0x7995('0x40')][_0x7995('0x4c')]()[_0x7995('0x26')](respondWithResult(_0x1cd85,null))[_0x7995('0x49')](handleError(_0x1cd85,null));}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.model.js b/server/api/memberReport/memberReport.model.js index 11f39ae..4fce45e 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 _0x213f=['../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./memberReport.attributes','exports','MemberReport','report_member','membername','util'];(function(_0x173dd9,_0x4ecf44){var _0x5a0d5a=function(_0x4d731a){while(--_0x4d731a){_0x173dd9['push'](_0x173dd9['shift']());}};_0x5a0d5a(++_0x4ecf44);}(_0x213f,0x1c7));var _0xf213=function(_0x53ceb7,_0x298447){_0x53ceb7=_0x53ceb7-0x0;var _0x10b0de=_0x213f[_0x53ceb7];return _0x10b0de;};'use strict';var _=require('lodash');var util=require(_0xf213('0x0'));var logger=require(_0xf213('0x1'))('api');var moment=require(_0xf213('0x2'));var BPromise=require('bluebird');var rp=require(_0xf213('0x3'));var fs=require('fs');var path=require(_0xf213('0x4'));var rimraf=require(_0xf213('0x5'));var config=require(_0xf213('0x6'));var attributes=require(_0xf213('0x7'));module[_0xf213('0x8')]=function(_0x4795b3,_0x513fed){return _0x4795b3['define'](_0xf213('0x9'),attributes,{'tableName':_0xf213('0xa'),'paranoid':![],'indexes':[{'name':'membername_interface','fields':[_0xf213('0xb'),'interface']}],'timestamps':!![]});}; \ No newline at end of file +var _0x2d95=['exports','define','MemberReport','report_member','membername_interface','membername','interface','lodash','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./memberReport.attributes'];(function(_0x54ef8a,_0x2c4f88){var _0x7d7b3a=function(_0x5b957b){while(--_0x5b957b){_0x54ef8a['push'](_0x54ef8a['shift']());}};_0x7d7b3a(++_0x2c4f88);}(_0x2d95,0xca));var _0x52d9=function(_0x520163,_0x34b794){_0x520163=_0x520163-0x0;var _0x57ab71=_0x2d95[_0x520163];return _0x57ab71;};'use strict';var _=require(_0x52d9('0x0'));var util=require('util');var logger=require(_0x52d9('0x1'))('api');var moment=require(_0x52d9('0x2'));var BPromise=require(_0x52d9('0x3'));var rp=require(_0x52d9('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x52d9('0x5'));var config=require(_0x52d9('0x6'));var attributes=require(_0x52d9('0x7'));module[_0x52d9('0x8')]=function(_0x16eb99,_0x2735cc){return _0x16eb99[_0x52d9('0x9')](_0x52d9('0xa'),attributes,{'tableName':_0x52d9('0xb'),'paranoid':![],'indexes':[{'name':_0x52d9('0xc'),'fields':[_0x52d9('0xd'),_0x52d9('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.rpc.js b/server/api/memberReport/memberReport.rpc.js index 05214ef..5d383d2 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 _0x9e54=['request','info','request\x20sent','debug','MemberReport,\x20%s,\x20%s,\x20%s','stringify','error','MemberReport,\x20%s,\x20%s','message','result','catch','GetMemberReport','findAll','options','raw','where','attributes','limit','include','model','map','CreateMemberReport','MemberReport','create','then','update','body','UpdateMemberReport','lodash','util','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9e54,0x88));var _0x49e5=function(_0x2eefb5,_0x4b29ab){_0x2eefb5=_0x2eefb5-0x0;var _0x451691=_0x9e54[_0x2eefb5];return _0x451691;};'use strict';var _=require(_0x49e5('0x0'));var util=require(_0x49e5('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x49e5('0x2'));var db=require(_0x49e5('0x3'))['db'];var utils=require(_0x49e5('0x4'));var logger=require('../../config/logger')(_0x49e5('0x5'));var config=require(_0x49e5('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x49e5('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x558b73,_0x21e166,_0x48059c){return new BPromise(function(_0x1a6b60,_0x234dd3){return client[_0x49e5('0x8')](_0x558b73,_0x48059c)['then'](function(_0x51bcbc){logger[_0x49e5('0x9')]('MemberReport,\x20%s,\x20%s',_0x21e166,_0x49e5('0xa'));logger[_0x49e5('0xb')](_0x49e5('0xc'),_0x21e166,_0x49e5('0xa'),JSON[_0x49e5('0xd')](_0x51bcbc));if(_0x51bcbc['error']){if(_0x51bcbc[_0x49e5('0xe')]['code']===0x1f4){logger[_0x49e5('0xe')](_0x49e5('0xf'),_0x21e166,_0x51bcbc[_0x49e5('0xe')][_0x49e5('0x10')]);return _0x234dd3(_0x51bcbc[_0x49e5('0xe')]['message']);}logger['error'](_0x49e5('0xf'),_0x21e166,_0x51bcbc[_0x49e5('0xe')]['message']);return _0x1a6b60(_0x51bcbc['error'][_0x49e5('0x10')]);}else{logger['info'](_0x49e5('0xf'),_0x21e166,'request\x20sent');_0x1a6b60(_0x51bcbc[_0x49e5('0x11')][_0x49e5('0x10')]);}})[_0x49e5('0x12')](function(_0x568cfb){logger[_0x49e5('0xe')](_0x49e5('0xf'),_0x21e166,_0x568cfb);_0x234dd3(_0x568cfb);});});}exports[_0x49e5('0x13')]=function(_0x1e2723){var _0xfc4935=this;return new Promise(function(_0xff869e,_0x3ba258){return db['MemberReport'][_0x49e5('0x14')]({'raw':_0x1e2723[_0x49e5('0x15')]?_0x1e2723['options'][_0x49e5('0x16')]===undefined?!![]:![]:!![],'where':_0x1e2723['options']?_0x1e2723[_0x49e5('0x15')][_0x49e5('0x17')]||null:null,'attributes':_0x1e2723['options']?_0x1e2723[_0x49e5('0x15')][_0x49e5('0x18')]||null:null,'limit':_0x1e2723[_0x49e5('0x15')]?_0x1e2723[_0x49e5('0x15')][_0x49e5('0x19')]||null:null,'include':_0x1e2723[_0x49e5('0x15')]?_0x1e2723['options'][_0x49e5('0x1a')]?_['map'](_0x1e2723[_0x49e5('0x15')][_0x49e5('0x1a')],function(_0x1033ed){return{'model':db[_0x1033ed[_0x49e5('0x1b')]],'as':_0x1033ed['as'],'attributes':_0x1033ed[_0x49e5('0x18')],'include':_0x1033ed[_0x49e5('0x1a')]?_['map'](_0x1033ed['include'],function(_0xd96520){return{'model':db[_0xd96520[_0x49e5('0x1b')]],'as':_0xd96520['as'],'attributes':_0xd96520['attributes'],'include':_0xd96520[_0x49e5('0x1a')]?_[_0x49e5('0x1c')](_0xd96520[_0x49e5('0x1a')],function(_0x16f98f){return{'model':db[_0x16f98f[_0x49e5('0x1b')]],'as':_0x16f98f['as'],'attributes':_0x16f98f[_0x49e5('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xadf789){logger[_0x49e5('0x9')](_0x49e5('0x13'),_0x1e2723);logger['debug'](_0x49e5('0x13'),_0x1e2723,JSON['stringify'](_0xadf789));_0xff869e(_0xadf789);})[_0x49e5('0x12')](function(_0x46a5be){logger['error']('GetMemberReport',_0x46a5be[_0x49e5('0x10')],_0x1e2723);_0x3ba258(_0xfc4935[_0x49e5('0xe')](0x1f4,_0x46a5be['message']));});});};exports[_0x49e5('0x1d')]=function(_0x5c0cb8){var _0x36d49e=this;return new Promise(function(_0x1ce332,_0x9408b6){return db[_0x49e5('0x1e')][_0x49e5('0x1f')](_0x5c0cb8['body'],{'raw':_0x5c0cb8[_0x49e5('0x15')]?_0x5c0cb8[_0x49e5('0x15')][_0x49e5('0x16')]===undefined?!![]:![]:!![]})[_0x49e5('0x20')](function(_0x29c72e){logger['info'](_0x49e5('0x1d'),_0x5c0cb8);logger[_0x49e5('0xb')]('CreateMemberReport',_0x5c0cb8,JSON[_0x49e5('0xd')](_0x29c72e));_0x1ce332(_0x29c72e);})['catch'](function(_0x579451){logger[_0x49e5('0xe')](_0x49e5('0x1d'),_0x579451['message'],_0x5c0cb8);_0x9408b6(_0x36d49e['error'](0x1f4,_0x579451[_0x49e5('0x10')]));});});};exports['UpdateMemberReport']=function(_0x163268){var _0x40b46b=this;return new Promise(function(_0x3dfda0,_0x3eb888){return db[_0x49e5('0x1e')][_0x49e5('0x21')](_0x163268[_0x49e5('0x22')],{'raw':_0x163268[_0x49e5('0x15')]?_0x163268[_0x49e5('0x15')][_0x49e5('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x163268['options']?_0x163268[_0x49e5('0x15')]['where']||null:null,'attributes':_0x163268['options']?_0x163268[_0x49e5('0x15')][_0x49e5('0x18')]||null:null,'limit':_0x163268[_0x49e5('0x15')]?_0x163268[_0x49e5('0x15')][_0x49e5('0x19')]||null:null})[_0x49e5('0x20')](function(_0x3d4810){logger[_0x49e5('0x9')](_0x49e5('0x23'),_0x163268);logger[_0x49e5('0xb')](_0x49e5('0x23'),_0x163268,JSON[_0x49e5('0xd')](_0x3d4810));_0x3dfda0(_0x3d4810);})[_0x49e5('0x12')](function(_0x2e5a10){logger[_0x49e5('0xe')]('UpdateMemberReport',_0x2e5a10[_0x49e5('0x10')],_0x163268);_0x3eb888(_0x40b46b['error'](0x1f4,_0x2e5a10[_0x49e5('0x10')]));});});}; \ No newline at end of file +var _0x644f=['options','raw','where','attributes','limit','map','include','model','GetMemberReport','create','body','CreateMemberReport','UpdateMemberReport','update','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','MemberReport,\x20%s,\x20%s','debug','MemberReport,\x20%s,\x20%s,\x20%s','stringify','error','message','info','catch','MemberReport'];(function(_0x2a6809,_0x44edde){var _0x11c371=function(_0x1a4888){while(--_0x1a4888){_0x2a6809['push'](_0x2a6809['shift']());}};_0x11c371(++_0x44edde);}(_0x644f,0xc2));var _0xf644=function(_0x329437,_0x1de73a){_0x329437=_0x329437-0x0;var _0x3789d9=_0x644f[_0x329437];return _0x3789d9;};'use strict';var _=require(_0xf644('0x0'));var util=require(_0xf644('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xf644('0x2'));var fs=require('fs');var Redis=require(_0xf644('0x3'));var db=require(_0xf644('0x4'))['db'];var utils=require(_0xf644('0x5'));var logger=require(_0xf644('0x6'))(_0xf644('0x7'));var config=require(_0xf644('0x8'));var jayson=require(_0xf644('0x9'));var client=jayson[_0xf644('0xa')][_0xf644('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2c7aaf,_0x454018,_0x50362e){return new BPromise(function(_0x2c2868,_0x11fa91){return client['request'](_0x2c7aaf,_0x50362e)[_0xf644('0xc')](function(_0x5746ae){logger['info'](_0xf644('0xd'),_0x454018,'request\x20sent');logger[_0xf644('0xe')](_0xf644('0xf'),_0x454018,'request\x20sent',JSON[_0xf644('0x10')](_0x5746ae));if(_0x5746ae[_0xf644('0x11')]){if(_0x5746ae[_0xf644('0x11')]['code']===0x1f4){logger[_0xf644('0x11')](_0xf644('0xd'),_0x454018,_0x5746ae['error'][_0xf644('0x12')]);return _0x11fa91(_0x5746ae[_0xf644('0x11')]['message']);}logger[_0xf644('0x11')](_0xf644('0xd'),_0x454018,_0x5746ae[_0xf644('0x11')][_0xf644('0x12')]);return _0x2c2868(_0x5746ae['error'][_0xf644('0x12')]);}else{logger[_0xf644('0x13')]('MemberReport,\x20%s,\x20%s',_0x454018,'request\x20sent');_0x2c2868(_0x5746ae['result']['message']);}})[_0xf644('0x14')](function(_0x331478){logger[_0xf644('0x11')](_0xf644('0xd'),_0x454018,_0x331478);_0x11fa91(_0x331478);});});}exports['GetMemberReport']=function(_0x5bd03c){var _0x15d065=this;return new Promise(function(_0x4650b5,_0x44fc39){return db[_0xf644('0x15')]['findAll']({'raw':_0x5bd03c['options']?_0x5bd03c[_0xf644('0x16')][_0xf644('0x17')]===undefined?!![]:![]:!![],'where':_0x5bd03c[_0xf644('0x16')]?_0x5bd03c[_0xf644('0x16')][_0xf644('0x18')]||null:null,'attributes':_0x5bd03c[_0xf644('0x16')]?_0x5bd03c[_0xf644('0x16')][_0xf644('0x19')]||null:null,'limit':_0x5bd03c['options']?_0x5bd03c[_0xf644('0x16')][_0xf644('0x1a')]||null:null,'include':_0x5bd03c[_0xf644('0x16')]?_0x5bd03c[_0xf644('0x16')]['include']?_[_0xf644('0x1b')](_0x5bd03c[_0xf644('0x16')][_0xf644('0x1c')],function(_0x17b2c6){return{'model':db[_0x17b2c6[_0xf644('0x1d')]],'as':_0x17b2c6['as'],'attributes':_0x17b2c6[_0xf644('0x19')],'include':_0x17b2c6[_0xf644('0x1c')]?_['map'](_0x17b2c6['include'],function(_0x22febe){return{'model':db[_0x22febe[_0xf644('0x1d')]],'as':_0x22febe['as'],'attributes':_0x22febe[_0xf644('0x19')],'include':_0x22febe[_0xf644('0x1c')]?_[_0xf644('0x1b')](_0x22febe[_0xf644('0x1c')],function(_0x2b2882){return{'model':db[_0x2b2882[_0xf644('0x1d')]],'as':_0x2b2882['as'],'attributes':_0x2b2882['attributes']};}):[]};}):[]};}):[]:[]})[_0xf644('0xc')](function(_0x3705a0){logger['info']('GetMemberReport',_0x5bd03c);logger[_0xf644('0xe')](_0xf644('0x1e'),_0x5bd03c,JSON[_0xf644('0x10')](_0x3705a0));_0x4650b5(_0x3705a0);})[_0xf644('0x14')](function(_0x2bcb20){logger[_0xf644('0x11')](_0xf644('0x1e'),_0x2bcb20['message'],_0x5bd03c);_0x44fc39(_0x15d065[_0xf644('0x11')](0x1f4,_0x2bcb20[_0xf644('0x12')]));});});};exports['CreateMemberReport']=function(_0x517a4e){var _0x279daa=this;return new Promise(function(_0x3efd75,_0x2cdca1){return db[_0xf644('0x15')][_0xf644('0x1f')](_0x517a4e[_0xf644('0x20')],{'raw':_0x517a4e[_0xf644('0x16')]?_0x517a4e[_0xf644('0x16')][_0xf644('0x17')]===undefined?!![]:![]:!![]})[_0xf644('0xc')](function(_0x5914d8){logger['info'](_0xf644('0x21'),_0x517a4e);logger[_0xf644('0xe')](_0xf644('0x21'),_0x517a4e,JSON[_0xf644('0x10')](_0x5914d8));_0x3efd75(_0x5914d8);})[_0xf644('0x14')](function(_0x37a72f){logger[_0xf644('0x11')]('CreateMemberReport',_0x37a72f[_0xf644('0x12')],_0x517a4e);_0x2cdca1(_0x279daa['error'](0x1f4,_0x37a72f['message']));});});};exports[_0xf644('0x22')]=function(_0x316d24){var _0xcef4ad=this;return new Promise(function(_0x54a537,_0x4f28d4){return db[_0xf644('0x15')][_0xf644('0x23')](_0x316d24[_0xf644('0x20')],{'raw':_0x316d24['options']?_0x316d24[_0xf644('0x16')][_0xf644('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x316d24['options']?_0x316d24[_0xf644('0x16')][_0xf644('0x18')]||null:null,'attributes':_0x316d24[_0xf644('0x16')]?_0x316d24[_0xf644('0x16')][_0xf644('0x19')]||null:null,'limit':_0x316d24[_0xf644('0x16')]?_0x316d24['options'][_0xf644('0x1a')]||null:null})['then'](function(_0x3f0248){logger[_0xf644('0x13')](_0xf644('0x22'),_0x316d24);logger[_0xf644('0xe')](_0xf644('0x22'),_0x316d24,JSON[_0xf644('0x10')](_0x3f0248));_0x54a537(_0x3f0248);})['catch'](function(_0x38b556){logger[_0xf644('0x11')](_0xf644('0x22'),_0x38b556['message'],_0x316d24);_0x4f28d4(_0xcef4ad['error'](0x1f4,_0x38b556[_0xf644('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index 3f82c9e..6abd675 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 _0xc627=['../../components/interaction/service','../../config/environment','./migration.controller','get','index','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service'];(function(_0x22f74d,_0x48057e){var _0x24c6a6=function(_0x21a0b0){while(--_0x21a0b0){_0x22f74d['push'](_0x22f74d['shift']());}};_0x24c6a6(++_0x48057e);}(_0xc627,0x14a));var _0x7c62=function(_0x283471,_0x26910c){_0x283471=_0x283471-0x0;var _0x5f48f1=_0xc627[_0x283471];return _0x5f48f1;};'use strict';var multer=require('multer');var util=require(_0x7c62('0x0'));var path=require(_0x7c62('0x1'));var timeout=require(_0x7c62('0x2'));var express=require('express');var router=express[_0x7c62('0x3')]();var fs_extra=require(_0x7c62('0x4'));var auth=require(_0x7c62('0x5'));var interaction=require(_0x7c62('0x6'));var config=require(_0x7c62('0x7'));var controller=require(_0x7c62('0x8'));router[_0x7c62('0x9')]('/',controller[_0x7c62('0xa')]);module[_0x7c62('0xb')]=router; \ No newline at end of file +var _0xc29c=['Router','fs-extra','../../components/interaction/service','../../config/environment','./migration.controller','index','util','connect-timeout'];(function(_0x260e4b,_0x54668d){var _0x18dfba=function(_0x37b530){while(--_0x37b530){_0x260e4b['push'](_0x260e4b['shift']());}};_0x18dfba(++_0x54668d);}(_0xc29c,0x1ae));var _0xcc29=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0xc29c[_0x110c3d];return _0x226d67;};'use strict';var multer=require('multer');var util=require(_0xcc29('0x0'));var path=require('path');var timeout=require(_0xcc29('0x1'));var express=require('express');var router=express[_0xcc29('0x2')]();var fs_extra=require(_0xcc29('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xcc29('0x4'));var config=require(_0xcc29('0x5'));var controller=require(_0xcc29('0x6'));router['get']('/',controller[_0xcc29('0x7')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/migration/migration.attributes.js b/server/api/migration/migration.attributes.js index 187d69c..0b4a837 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 _0x34ae=['exports','version'];(function(_0xe4964d,_0xc17f64){var _0x4d11db=function(_0xe76bdc){while(--_0xe76bdc){_0xe4964d['push'](_0xe4964d['shift']());}};_0x4d11db(++_0xc17f64);}(_0x34ae,0x1c6));var _0xe34a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x34ae[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0xe34a('0x0')]={'version':{'type':Sequelize['STRING'],'unique':_0xe34a('0x1')}}; \ No newline at end of file +var _0x9666=['sequelize','exports','version'];(function(_0x18ab2a,_0x4debcd){var _0x16dcee=function(_0x10107a){while(--_0x10107a){_0x18ab2a['push'](_0x18ab2a['shift']());}};_0x16dcee(++_0x4debcd);}(_0x9666,0x171));var _0x6966=function(_0x43a02c,_0x20b70f){_0x43a02c=_0x43a02c-0x0;var _0x171f65=_0x9666[_0x43a02c];return _0x171f65;};'use strict';var Sequelize=require(_0x6966('0x0'));module[_0x6966('0x1')]={'version':{'type':Sequelize['STRING'],'unique':_0x6966('0x2')}}; \ No newline at end of file diff --git a/server/api/migration/migration.controller.js b/server/api/migration/migration.controller.js index a945752..58f4b62 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 _0xf22e=['limit','set','json','apply','save','update','then','name','send','index','map','rawAttributes','type','key','model','query','keys','intersection','attributes','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','Migration','count','includeAll','include','findAll','rimraf','zip-dir','fast-json-patch','request-promise','moment','path','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined'];(function(_0x175a9c,_0x48c950){var _0x31a75f=function(_0xa8d5e1){while(--_0xa8d5e1){_0x175a9c['push'](_0x175a9c['shift']());}};_0x31a75f(++_0x48c950);}(_0xf22e,0x94));var _0xef22=function(_0x407318,_0x42f85e){_0x407318=_0x407318-0x0;var _0x398675=_0xf22e[_0x407318];return _0x398675;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xef22('0x0'));var zipdir=require(_0xef22('0x1'));var jsonpatch=require(_0xef22('0x2'));var rp=require(_0xef22('0x3'));var moment=require(_0xef22('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xef22('0x5'));var sox=require('sox');var csv=require(_0xef22('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xef22('0x7'));var _=require('lodash');var squel=require(_0xef22('0x8'));var crypto=require(_0xef22('0x9'));var jsforce=require(_0xef22('0xa'));var deskjs=require(_0xef22('0xb'));var toCsv=require(_0xef22('0x6'));var querystring=require(_0xef22('0xc'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xef22('0xd'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xef22('0xe'));var logger=require('../../config/logger')(_0xef22('0xf'));var utils=require('../../config/utils');var config=require(_0xef22('0x10'));var licenseUtil=require(_0xef22('0x11'));var db=require(_0xef22('0x12'))['db'];function respondWithStatusCode(_0x58d4a4,_0x442289){_0x442289=_0x442289||0xcc;return function(_0x12e081){if(_0x12e081){return _0x58d4a4[_0xef22('0x13')](_0x442289);}return _0x58d4a4[_0xef22('0x14')](_0x442289)['end']();};}function respondWithResult(_0xed415c,_0x52a54d){_0x52a54d=_0x52a54d||0xc8;return function(_0x326e9e){if(_0x326e9e){return _0xed415c[_0xef22('0x14')](_0x52a54d)['json'](_0x326e9e);}};}function respondWithFilteredResult(_0x362c1e,_0x15bca9){return function(_0x1d02ec){if(_0x1d02ec){var _0x19fa73=typeof _0x15bca9[_0xef22('0x15')]===_0xef22('0x16')&&typeof _0x15bca9['limit']===_0xef22('0x16');var _0x5049d3=_0x1d02ec['count'];var _0x555087=_0x19fa73?0x0:_0x15bca9[_0xef22('0x15')];var _0x386393=_0x19fa73?_0x1d02ec['count']:_0x15bca9[_0xef22('0x15')]+_0x15bca9[_0xef22('0x17')];var _0x673310;if(_0x386393>=_0x5049d3){_0x386393=_0x5049d3;_0x673310=0xc8;}else{_0x673310=0xce;}_0x362c1e[_0xef22('0x14')](_0x673310);return _0x362c1e[_0xef22('0x18')]('Content-Range',_0x555087+'-'+_0x386393+'/'+_0x5049d3)[_0xef22('0x19')](_0x1d02ec);}return null;};}function patchUpdates(_0x1f090c){return function(_0x19ffec){try{jsonpatch[_0xef22('0x1a')](_0x19ffec,_0x1f090c,!![]);}catch(_0x4da39f){return BPromise['reject'](_0x4da39f);}return _0x19ffec[_0xef22('0x1b')]();};}function saveUpdates(_0x516fd4,_0x1ae17e){return function(_0x421432){if(_0x421432){return _0x421432[_0xef22('0x1c')](_0x516fd4)[_0xef22('0x1d')](function(_0x344d08){return _0x344d08;});}return null;};}function removeEntity(_0x4debaf,_0x5ec2b8){return function(_0x24347e){if(_0x24347e){return _0x24347e['destroy']()['then'](function(){_0x4debaf[_0xef22('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x30f9b1,_0x4dd096){return function(_0x19b688){if(!_0x19b688){_0x30f9b1[_0xef22('0x13')](0x194);}return _0x19b688;};}function handleError(_0x1e12be,_0x1d7ecc){_0x1d7ecc=_0x1d7ecc||0x1f4;return function(_0x18c377){logger['error'](_0x18c377['stack']);if(_0x18c377[_0xef22('0x1e')]){delete _0x18c377[_0xef22('0x1e')];}_0x1e12be[_0xef22('0x14')](_0x1d7ecc)[_0xef22('0x1f')](_0x18c377);};}exports[_0xef22('0x20')]=function(_0x3811e2,_0x126218){var _0x504be1={},_0x1de764={},_0x4be2f6={'count':0x0,'rows':[]};var _0x26250b=_[_0xef22('0x21')](db['Migration'][_0xef22('0x22')],function(_0x41b760){return{'name':_0x41b760['fieldName'],'type':_0x41b760[_0xef22('0x23')][_0xef22('0x24')]};});_0x1de764[_0xef22('0x25')]=_[_0xef22('0x21')](_0x26250b,_0xef22('0x1e'));_0x1de764[_0xef22('0x26')]=_[_0xef22('0x27')](_0x3811e2[_0xef22('0x26')]);_0x1de764['filters']=_[_0xef22('0x28')](_0x1de764[_0xef22('0x25')],_0x1de764[_0xef22('0x26')]);_0x504be1[_0xef22('0x29')]=_[_0xef22('0x28')](_0x1de764[_0xef22('0x25')],qs['fields'](_0x3811e2[_0xef22('0x26')]['fields']));_0x504be1[_0xef22('0x29')]=_0x504be1[_0xef22('0x29')][_0xef22('0x2a')]?_0x504be1[_0xef22('0x29')]:_0x1de764[_0xef22('0x25')];if(!_0x3811e2[_0xef22('0x26')][_0xef22('0x2b')](_0xef22('0x2c'))){_0x504be1[_0xef22('0x17')]=qs[_0xef22('0x17')](_0x3811e2['query'][_0xef22('0x17')]);_0x504be1['offset']=qs['offset'](_0x3811e2[_0xef22('0x26')]['offset']);}_0x504be1['order']=qs[_0xef22('0x2d')](_0x3811e2[_0xef22('0x26')][_0xef22('0x2d')]);_0x504be1[_0xef22('0x2e')]=qs[_0xef22('0x2f')](_[_0xef22('0x30')](_0x3811e2[_0xef22('0x26')],_0x1de764['filters']),_0x26250b);if(_0x3811e2[_0xef22('0x26')][_0xef22('0x31')]){_0x504be1[_0xef22('0x2e')]=_[_0xef22('0x32')](_0x504be1[_0xef22('0x2e')],{'$or':_[_0xef22('0x21')](_0x26250b,function(_0x19e052){if(_0x19e052[_0xef22('0x23')]!==_0xef22('0x33')){var _0x4a9214={};_0x4a9214[_0x19e052['name']]={'$like':'%'+_0x3811e2[_0xef22('0x26')][_0xef22('0x31')]+'%'};return _0x4a9214;}})});}_0x504be1=_['merge']({},_0x504be1,_0x3811e2['options']);var _0x2aafd2={'where':_0x504be1[_0xef22('0x2e')]};return db[_0xef22('0x34')]['count'](_0x2aafd2)[_0xef22('0x1d')](function(_0xb10bc1){_0x4be2f6[_0xef22('0x35')]=_0xb10bc1;if(_0x3811e2[_0xef22('0x26')][_0xef22('0x36')]){_0x504be1[_0xef22('0x37')]=[{'all':!![]}];}return db[_0xef22('0x34')][_0xef22('0x38')](_0x504be1);})[_0xef22('0x1d')](function(_0x458deb){_0x4be2f6['rows']=_0x458deb;return _0x4be2f6;})[_0xef22('0x1d')](respondWithFilteredResult(_0x126218,_0x504be1))['catch'](handleError(_0x126218,null));}; \ No newline at end of file +var _0xd911=['rawAttributes','fieldName','type','key','model','query','intersection','fields','length','attributes','hasOwnProperty','order','sort','where','filters','filter','VIRTUAL','merge','options','Migration','then','findAll','rows','catch','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','apply','reject','update','destroy','error','stack','name','index','map'];(function(_0x5829d3,_0x2172a6){var _0x25c715=function(_0x5616d1){while(--_0x5616d1){_0x5829d3['push'](_0x5829d3['shift']());}};_0x25c715(++_0x2172a6);}(_0xd911,0x1df));var _0x1d91=function(_0x10772c,_0x1df6ad){_0x10772c=_0x10772c-0x0;var _0x806119=_0xd911[_0x10772c];return _0x806119;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x1d91('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1d91('0x1'));var moment=require(_0x1d91('0x2'));var BPromise=require(_0x1d91('0x3'));var Mustache=require(_0x1d91('0x4'));var util=require(_0x1d91('0x5'));var path=require(_0x1d91('0x6'));var sox=require(_0x1d91('0x7'));var csv=require(_0x1d91('0x8'));var ejs=require(_0x1d91('0x9'));var fs=require('fs');var fs_extra=require(_0x1d91('0xa'));var _=require('lodash');var squel=require(_0x1d91('0xb'));var crypto=require(_0x1d91('0xc'));var jsforce=require(_0x1d91('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x1d91('0x8'));var querystring=require(_0x1d91('0xe'));var Papa=require(_0x1d91('0xf'));var Redis=require('ioredis');var authService=require(_0x1d91('0x10'));var qs=require(_0x1d91('0x11'));var as=require(_0x1d91('0x12'));var hardwareService=require(_0x1d91('0x13'));var logger=require(_0x1d91('0x14'))(_0x1d91('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x1d91('0x16'));var db=require(_0x1d91('0x17'))['db'];function respondWithStatusCode(_0x5dc335,_0x4bb6f2){_0x4bb6f2=_0x4bb6f2||0xcc;return function(_0x33bc9b){if(_0x33bc9b){return _0x5dc335[_0x1d91('0x18')](_0x4bb6f2);}return _0x5dc335[_0x1d91('0x19')](_0x4bb6f2)[_0x1d91('0x1a')]();};}function respondWithResult(_0x98807c,_0x13a65e){_0x13a65e=_0x13a65e||0xc8;return function(_0x3c211c){if(_0x3c211c){return _0x98807c['status'](_0x13a65e)['json'](_0x3c211c);}};}function respondWithFilteredResult(_0x280aef,_0x4dfdec){return function(_0x1cc3b4){if(_0x1cc3b4){var _0x3ed277=typeof _0x4dfdec[_0x1d91('0x1b')]===_0x1d91('0x1c')&&typeof _0x4dfdec[_0x1d91('0x1d')]===_0x1d91('0x1c');var _0x6b1f69=_0x1cc3b4[_0x1d91('0x1e')];var _0x3c53fb=_0x3ed277?0x0:_0x4dfdec[_0x1d91('0x1b')];var _0x274d81=_0x3ed277?_0x1cc3b4[_0x1d91('0x1e')]:_0x4dfdec['offset']+_0x4dfdec[_0x1d91('0x1d')];var _0x4d935d;if(_0x274d81>=_0x6b1f69){_0x274d81=_0x6b1f69;_0x4d935d=0xc8;}else{_0x4d935d=0xce;}_0x280aef[_0x1d91('0x19')](_0x4d935d);return _0x280aef[_0x1d91('0x1f')]('Content-Range',_0x3c53fb+'-'+_0x274d81+'/'+_0x6b1f69)['json'](_0x1cc3b4);}return null;};}function patchUpdates(_0x436b01){return function(_0x55c641){try{jsonpatch[_0x1d91('0x20')](_0x55c641,_0x436b01,!![]);}catch(_0x362fb6){return BPromise[_0x1d91('0x21')](_0x362fb6);}return _0x55c641['save']();};}function saveUpdates(_0x3632d1,_0xd37820){return function(_0x117734){if(_0x117734){return _0x117734[_0x1d91('0x22')](_0x3632d1)['then'](function(_0x496500){return _0x496500;});}return null;};}function removeEntity(_0x505542,_0x17d60e){return function(_0x430a4e){if(_0x430a4e){return _0x430a4e[_0x1d91('0x23')]()['then'](function(){_0x505542['status'](0xcc)[_0x1d91('0x1a')]();});}};}function handleEntityNotFound(_0x25c026,_0x404fa1){return function(_0x5034c5){if(!_0x5034c5){_0x25c026[_0x1d91('0x18')](0x194);}return _0x5034c5;};}function handleError(_0x7029a1,_0x5f4910){_0x5f4910=_0x5f4910||0x1f4;return function(_0x29c6b6){logger[_0x1d91('0x24')](_0x29c6b6[_0x1d91('0x25')]);if(_0x29c6b6['name']){delete _0x29c6b6[_0x1d91('0x26')];}_0x7029a1[_0x1d91('0x19')](_0x5f4910)['send'](_0x29c6b6);};}exports[_0x1d91('0x27')]=function(_0x3a649b,_0x1f1d58){var _0x1a2f48={},_0x5ba168={},_0x2c4ad2={'count':0x0,'rows':[]};var _0x5d0f75=_[_0x1d91('0x28')](db['Migration'][_0x1d91('0x29')],function(_0x18400e){return{'name':_0x18400e[_0x1d91('0x2a')],'type':_0x18400e[_0x1d91('0x2b')][_0x1d91('0x2c')]};});_0x5ba168[_0x1d91('0x2d')]=_[_0x1d91('0x28')](_0x5d0f75,_0x1d91('0x26'));_0x5ba168[_0x1d91('0x2e')]=_['keys'](_0x3a649b['query']);_0x5ba168['filters']=_[_0x1d91('0x2f')](_0x5ba168[_0x1d91('0x2d')],_0x5ba168['query']);_0x1a2f48['attributes']=_[_0x1d91('0x2f')](_0x5ba168[_0x1d91('0x2d')],qs[_0x1d91('0x30')](_0x3a649b[_0x1d91('0x2e')][_0x1d91('0x30')]));_0x1a2f48['attributes']=_0x1a2f48['attributes'][_0x1d91('0x31')]?_0x1a2f48[_0x1d91('0x32')]:_0x5ba168[_0x1d91('0x2d')];if(!_0x3a649b[_0x1d91('0x2e')][_0x1d91('0x33')]('nolimit')){_0x1a2f48[_0x1d91('0x1d')]=qs[_0x1d91('0x1d')](_0x3a649b['query'][_0x1d91('0x1d')]);_0x1a2f48[_0x1d91('0x1b')]=qs[_0x1d91('0x1b')](_0x3a649b['query'][_0x1d91('0x1b')]);}_0x1a2f48[_0x1d91('0x34')]=qs[_0x1d91('0x35')](_0x3a649b['query']['sort']);_0x1a2f48[_0x1d91('0x36')]=qs[_0x1d91('0x37')](_['pick'](_0x3a649b[_0x1d91('0x2e')],_0x5ba168[_0x1d91('0x37')]),_0x5d0f75);if(_0x3a649b[_0x1d91('0x2e')][_0x1d91('0x38')]){_0x1a2f48[_0x1d91('0x36')]=_['merge'](_0x1a2f48[_0x1d91('0x36')],{'$or':_[_0x1d91('0x28')](_0x5d0f75,function(_0x3f65dc){if(_0x3f65dc[_0x1d91('0x2b')]!==_0x1d91('0x39')){var _0xb75777={};_0xb75777[_0x3f65dc['name']]={'$like':'%'+_0x3a649b[_0x1d91('0x2e')][_0x1d91('0x38')]+'%'};return _0xb75777;}})});}_0x1a2f48=_[_0x1d91('0x3a')]({},_0x1a2f48,_0x3a649b[_0x1d91('0x3b')]);var _0x2e28ce={'where':_0x1a2f48['where']};return db[_0x1d91('0x3c')][_0x1d91('0x1e')](_0x2e28ce)[_0x1d91('0x3d')](function(_0x28453e){_0x2c4ad2[_0x1d91('0x1e')]=_0x28453e;if(_0x3a649b[_0x1d91('0x2e')]['includeAll']){_0x1a2f48['include']=[{'all':!![]}];}return db[_0x1d91('0x3c')][_0x1d91('0x3e')](_0x1a2f48);})['then'](function(_0x1bfbe7){_0x2c4ad2[_0x1d91('0x3f')]=_0x1bfbe7;return _0x2c4ad2;})[_0x1d91('0x3d')](respondWithFilteredResult(_0x1f1d58,_0x1a2f48))[_0x1d91('0x40')](handleError(_0x1f1d58,null));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index 1cbf1fd..cc95217 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 _0xc4dd=['Migration','lodash','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./migration.attributes','define'];(function(_0x243a39,_0x4c9b51){var _0x5620a2=function(_0x16a997){while(--_0x16a997){_0x243a39['push'](_0x243a39['shift']());}};_0x5620a2(++_0x4c9b51);}(_0xc4dd,0x177));var _0xdc4d=function(_0x252df7,_0x394629){_0x252df7=_0x252df7-0x0;var _0x2f78d2=_0xc4dd[_0x252df7];return _0x2f78d2;};'use strict';var _=require(_0xdc4d('0x0'));var util=require(_0xdc4d('0x1'));var logger=require(_0xdc4d('0x2'))(_0xdc4d('0x3'));var moment=require('moment');var BPromise=require(_0xdc4d('0x4'));var rp=require(_0xdc4d('0x5'));var fs=require('fs');var path=require(_0xdc4d('0x6'));var rimraf=require('rimraf');var config=require(_0xdc4d('0x7'));var attributes=require(_0xdc4d('0x8'));module['exports']=function(_0x2f29d5,_0x7cd400){return _0x2f29d5[_0xdc4d('0x9')](_0xdc4d('0xa'),attributes,{'tableName':'migrations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1f46=['migrations','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./migration.attributes','exports','define','Migration'];(function(_0x50707e,_0x14fc7c){var _0x12b962=function(_0x2c77ff){while(--_0x2c77ff){_0x50707e['push'](_0x50707e['shift']());}};_0x12b962(++_0x14fc7c);}(_0x1f46,0x127));var _0x61f4=function(_0x35d733,_0x434691){_0x35d733=_0x35d733-0x0;var _0x13ebb6=_0x1f46[_0x35d733];return _0x13ebb6;};'use strict';var _=require(_0x61f4('0x0'));var util=require(_0x61f4('0x1'));var logger=require(_0x61f4('0x2'))(_0x61f4('0x3'));var moment=require('moment');var BPromise=require(_0x61f4('0x4'));var rp=require(_0x61f4('0x5'));var fs=require('fs');var path=require(_0x61f4('0x6'));var rimraf=require(_0x61f4('0x7'));var config=require(_0x61f4('0x8'));var attributes=require(_0x61f4('0x9'));module[_0x61f4('0xa')]=function(_0x192ed9,_0x4adc18){return _0x192ed9[_0x61f4('0xb')](_0x61f4('0xc'),attributes,{'tableName':_0x61f4('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/migration/migration.rpc.js b/server/api/migration/migration.rpc.js index 23c28c3..d5dc824 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 _0xd0a4=['http','request','then','info','Migration,\x20%s,\x20%s','request\x20sent','debug','Migration,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x2a40b3,_0xe1c253){var _0x4ac6cb=function(_0x5083fe){while(--_0x5083fe){_0x2a40b3['push'](_0x2a40b3['shift']());}};_0x4ac6cb(++_0xe1c253);}(_0xd0a4,0x166));var _0x4d0a=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0xd0a4[_0x3b380d];return _0x54502b;};'use strict';var _=require(_0x4d0a('0x0'));var util=require(_0x4d0a('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4d0a('0x2'));var db=require(_0x4d0a('0x3'))['db'];var utils=require(_0x4d0a('0x4'));var logger=require(_0x4d0a('0x5'))(_0x4d0a('0x6'));var config=require(_0x4d0a('0x7'));var jayson=require(_0x4d0a('0x8'));var client=jayson[_0x4d0a('0x9')][_0x4d0a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4a3a1a,_0x59fe32,_0xd6c889){return new BPromise(function(_0x1feaea,_0x5199b8){return client[_0x4d0a('0xb')](_0x4a3a1a,_0xd6c889)[_0x4d0a('0xc')](function(_0x4e049b){logger[_0x4d0a('0xd')](_0x4d0a('0xe'),_0x59fe32,_0x4d0a('0xf'));logger[_0x4d0a('0x10')](_0x4d0a('0x11'),_0x59fe32,'request\x20sent',JSON['stringify'](_0x4e049b));if(_0x4e049b['error']){if(_0x4e049b[_0x4d0a('0x12')][_0x4d0a('0x13')]===0x1f4){logger[_0x4d0a('0x12')]('Migration,\x20%s,\x20%s',_0x59fe32,_0x4e049b['error']['message']);return _0x5199b8(_0x4e049b['error'][_0x4d0a('0x14')]);}logger['error'](_0x4d0a('0xe'),_0x59fe32,_0x4e049b[_0x4d0a('0x12')][_0x4d0a('0x14')]);return _0x1feaea(_0x4e049b['error'][_0x4d0a('0x14')]);}else{logger[_0x4d0a('0xd')](_0x4d0a('0xe'),_0x59fe32,_0x4d0a('0xf'));_0x1feaea(_0x4e049b[_0x4d0a('0x15')][_0x4d0a('0x14')]);}})[_0x4d0a('0x16')](function(_0x4052e8){logger['error'](_0x4d0a('0xe'),_0x59fe32,_0x4052e8);_0x5199b8(_0x4052e8);});});} \ No newline at end of file +var _0x85de=['randomstring','../../mysqldb','rpc','../../config/environment','client','http','request','info','Migration,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','lodash','util','moment','bluebird'];(function(_0x58f84a,_0x56be79){var _0x247e6b=function(_0x5b110c){while(--_0x5b110c){_0x58f84a['push'](_0x58f84a['shift']());}};_0x247e6b(++_0x56be79);}(_0x85de,0x1f0));var _0xe85d=function(_0xd1e0d4,_0x314f95){_0xd1e0d4=_0xd1e0d4-0x0;var _0xb8b67e=_0x85de[_0xd1e0d4];return _0xb8b67e;};'use strict';var _=require(_0xe85d('0x0'));var util=require(_0xe85d('0x1'));var moment=require(_0xe85d('0x2'));var BPromise=require(_0xe85d('0x3'));var rs=require(_0xe85d('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe85d('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xe85d('0x6'));var config=require(_0xe85d('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xe85d('0x8')][_0xe85d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x220e10,_0xd468f9,_0x4608f4){return new BPromise(function(_0x888738,_0xc86467){return client[_0xe85d('0xa')](_0x220e10,_0x4608f4)['then'](function(_0x4128d5){logger[_0xe85d('0xb')](_0xe85d('0xc'),_0xd468f9,_0xe85d('0xd'));logger[_0xe85d('0xe')]('Migration,\x20%s,\x20%s,\x20%s',_0xd468f9,_0xe85d('0xd'),JSON['stringify'](_0x4128d5));if(_0x4128d5[_0xe85d('0xf')]){if(_0x4128d5['error'][_0xe85d('0x10')]===0x1f4){logger['error'](_0xe85d('0xc'),_0xd468f9,_0x4128d5[_0xe85d('0xf')][_0xe85d('0x11')]);return _0xc86467(_0x4128d5[_0xe85d('0xf')][_0xe85d('0x11')]);}logger[_0xe85d('0xf')](_0xe85d('0xc'),_0xd468f9,_0x4128d5['error'][_0xe85d('0x11')]);return _0x888738(_0x4128d5[_0xe85d('0xf')]['message']);}else{logger[_0xe85d('0xb')](_0xe85d('0xc'),_0xd468f9,_0xe85d('0xd'));_0x888738(_0x4128d5[_0xe85d('0x12')][_0xe85d('0x11')]);}})[_0xe85d('0x13')](function(_0x136fe6){logger[_0xe85d('0xf')](_0xe85d('0xc'),_0xd468f9,_0x136fe6);_0xc86467(_0x136fe6);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index 3df6982..633766e 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 _0x0a93=['path','express','Router','fs-extra','../../components/auth/service','index','get','show','post','isAuthenticated','put','/:id','update','delete','destroy','exports','multer','util'];(function(_0x5a5326,_0x29991a){var _0x37c270=function(_0x16dd07){while(--_0x16dd07){_0x5a5326['push'](_0x5a5326['shift']());}};_0x37c270(++_0x29991a);}(_0x0a93,0x6a));var _0x30a9=function(_0x411b85,_0x34903b){_0x411b85=_0x411b85-0x0;var _0x1ead92=_0x0a93[_0x411b85];return _0x1ead92;};'use strict';var multer=require(_0x30a9('0x0'));var util=require(_0x30a9('0x1'));var path=require(_0x30a9('0x2'));var timeout=require('connect-timeout');var express=require(_0x30a9('0x3'));var router=express[_0x30a9('0x4')]();var fs_extra=require(_0x30a9('0x5'));var auth=require(_0x30a9('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./network.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x30a9('0x7')]);router[_0x30a9('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x30a9('0x9')]);router[_0x30a9('0xa')]('/',auth[_0x30a9('0xb')](),controller['create']);router[_0x30a9('0xc')](_0x30a9('0xd'),auth[_0x30a9('0xb')](),controller[_0x30a9('0xe')]);router[_0x30a9('0xf')](_0x30a9('0xd'),auth[_0x30a9('0xb')](),controller[_0x30a9('0x10')]);module[_0x30a9('0x11')]=router; \ No newline at end of file +var _0xdca4=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./network.controller','isAuthenticated','index','get','/:id','show','post','create','put','update','delete','destroy','exports','multer','path','express'];(function(_0x327e47,_0x1f69a3){var _0xd2b5cd=function(_0x53feec){while(--_0x53feec){_0x327e47['push'](_0x327e47['shift']());}};_0xd2b5cd(++_0x1f69a3);}(_0xdca4,0x138));var _0x4dca=function(_0x518ac9,_0x4bbc8b){_0x518ac9=_0x518ac9-0x0;var _0x19ba5c=_0xdca4[_0x518ac9];return _0x19ba5c;};'use strict';var multer=require(_0x4dca('0x0'));var util=require('util');var path=require(_0x4dca('0x1'));var timeout=require('connect-timeout');var express=require(_0x4dca('0x2'));var router=express[_0x4dca('0x3')]();var fs_extra=require(_0x4dca('0x4'));var auth=require(_0x4dca('0x5'));var interaction=require(_0x4dca('0x6'));var config=require(_0x4dca('0x7'));var controller=require(_0x4dca('0x8'));router['get']('/',auth[_0x4dca('0x9')](),controller[_0x4dca('0xa')]);router[_0x4dca('0xb')](_0x4dca('0xc'),auth['isAuthenticated'](),controller[_0x4dca('0xd')]);router[_0x4dca('0xe')]('/',auth[_0x4dca('0x9')](),controller[_0x4dca('0xf')]);router[_0x4dca('0x10')](_0x4dca('0xc'),auth['isAuthenticated'](),controller[_0x4dca('0x11')]);router[_0x4dca('0x12')](_0x4dca('0xc'),auth['isAuthenticated'](),controller[_0x4dca('0x13')]);module[_0x4dca('0x14')]=router; \ No newline at end of file diff --git a/server/api/network/network.attributes.js b/server/api/network/network.attributes.js index db0e5f9..d03a46d 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 _0x7028=['turn','STRING','sequelize','exports','ENUM','localnet','externip','stun'];(function(_0x162d3a,_0x4db8ce){var _0x45f61a=function(_0xbf178c){while(--_0xbf178c){_0x162d3a['push'](_0x162d3a['shift']());}};_0x45f61a(++_0x4db8ce);}(_0x7028,0x11a));var _0x8702=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0x7028[_0x110c3d];return _0x226d67;};'use strict';var Sequelize=require(_0x8702('0x0'));module[_0x8702('0x1')]={'type':{'type':Sequelize[_0x8702('0x2')](_0x8702('0x3'),_0x8702('0x4'),_0x8702('0x5'),_0x8702('0x6'))},'value':{'type':Sequelize[_0x8702('0x7')]},'username':{'type':Sequelize[_0x8702('0x7')]},'password':{'type':Sequelize[_0x8702('0x7')]}}; \ No newline at end of file +var _0xd785=['STRING','exports','ENUM','localnet','externip','stun','turn'];(function(_0x3ff893,_0x53e2bd){var _0x246d70=function(_0x78da15){while(--_0x78da15){_0x3ff893['push'](_0x3ff893['shift']());}};_0x246d70(++_0x53e2bd);}(_0xd785,0x15f));var _0x5d78=function(_0x484c03,_0x13c1d2){_0x484c03=_0x484c03-0x0;var _0x294127=_0xd785[_0x484c03];return _0x294127;};'use strict';var Sequelize=require('sequelize');module[_0x5d78('0x0')]={'type':{'type':Sequelize[_0x5d78('0x1')](_0x5d78('0x2'),_0x5d78('0x3'),_0x5d78('0x4'),_0x5d78('0x5'))},'value':{'type':Sequelize[_0x5d78('0x6')]},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0x5d78('0x6')]}}; \ No newline at end of file diff --git a/server/api/network/network.controller.js b/server/api/network/network.controller.js index f74d4b1..0e0f7d2 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 _0x6816=['model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','map','name','includeAll','show','params','rawAttributes','find','create','sequelize','transaction','body','findAll','type','toUpperCase','STUN','readFileSync','root','server/files/templates/stun_multiple.ejs','writeFileSync','/etc/asterisk/stun_xcally.conf','Reload','res_stun_monitor.so','TURN','server/files/templates/turn_multiple.ejs','utf8','render','/etc/asterisk/turn_xcally.conf','join','format','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','server/files/templates/network.ejs','chan_sip.so','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','client','request','then','info','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','destroy','stack','Network','fieldName','key'];(function(_0x136faa,_0x1f79fd){var _0x4982c9=function(_0x2d747f){while(--_0x2d747f){_0x136faa['push'](_0x136faa['shift']());}};_0x4982c9(++_0x1f79fd);}(_0x6816,0x16f));var _0x6681=function(_0x652ad2,_0x150f9d){_0x652ad2=_0x652ad2-0x0;var _0x2c0951=_0x6816[_0x652ad2];return _0x2c0951;};'use strict';var emlformat=require(_0x6681('0x0'));var rimraf=require(_0x6681('0x1'));var zipdir=require(_0x6681('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6681('0x3'));var moment=require('moment');var BPromise=require(_0x6681('0x4'));var Mustache=require(_0x6681('0x5'));var util=require(_0x6681('0x6'));var path=require(_0x6681('0x7'));var sox=require(_0x6681('0x8'));var csv=require(_0x6681('0x9'));var ejs=require(_0x6681('0xa'));var fs=require('fs');var fs_extra=require(_0x6681('0xb'));var _=require(_0x6681('0xc'));var squel=require(_0x6681('0xd'));var crypto=require(_0x6681('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x6681('0x9'));var querystring=require(_0x6681('0xf'));var Papa=require(_0x6681('0x10'));var Redis=require(_0x6681('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x6681('0x12'));var as=require(_0x6681('0x13'));var hardwareService=require(_0x6681('0x14'));var logger=require(_0x6681('0x15'))('api');var utils=require(_0x6681('0x16'));var config=require(_0x6681('0x17'));var licenseUtil=require(_0x6681('0x18'));var db=require(_0x6681('0x19'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x6681('0x1a')]['http']({'port':0x232a});function respondWithRpcPromise(_0x152550,_0x320d5a,_0x1031fa,_0x2a4d07){return new BPromise(function(_0x25205a,_0x5c1edc){var _0x36935d=_0x2a4d07||client;return _0x36935d[_0x6681('0x1b')](_0x152550,_0x1031fa)[_0x6681('0x1c')](function(_0x5d4f10){logger[_0x6681('0x1d')](_0x6681('0x1e'),_0x320d5a,_0x6681('0x1f'));logger[_0x6681('0x20')](_0x6681('0x21'),_0x320d5a,_0x6681('0x1f'),JSON[_0x6681('0x22')](_0x5d4f10));if(_0x5d4f10[_0x6681('0x23')]){if(_0x5d4f10['error'][_0x6681('0x24')]===0x1f4){logger[_0x6681('0x23')](_0x6681('0x1e'),_0x320d5a,_0x5d4f10['error'][_0x6681('0x25')]);return _0x5c1edc(_0x5d4f10[_0x6681('0x23')][_0x6681('0x25')]);}logger['error'](_0x6681('0x1e'),_0x320d5a,_0x5d4f10[_0x6681('0x23')][_0x6681('0x25')]);return _0x25205a(_0x5d4f10['error'][_0x6681('0x25')]);}else{logger[_0x6681('0x1d')](_0x6681('0x1e'),_0x320d5a,_0x6681('0x1f'));_0x25205a(_0x5d4f10['result'][_0x6681('0x25')]);}})[_0x6681('0x26')](function(_0x40d2fa){logger[_0x6681('0x23')](_0x6681('0x1e'),_0x320d5a,_0x40d2fa);_0x5c1edc(_0x40d2fa);});});}function respondWithStatusCode(_0x495d59,_0xb50d60){_0xb50d60=_0xb50d60||0xcc;return function(_0x35a34f){if(_0x35a34f){return _0x495d59[_0x6681('0x27')](_0xb50d60);}return _0x495d59[_0x6681('0x28')](_0xb50d60)[_0x6681('0x29')]();};}function respondWithResult(_0x390334,_0x51ea7a){_0x51ea7a=_0x51ea7a||0xc8;return function(_0x244272){if(_0x244272){return _0x390334['status'](_0x51ea7a)[_0x6681('0x2a')](_0x244272);}};}function respondWithFilteredResult(_0xf7cfea,_0x18b16f){return function(_0x4acab0){if(_0x4acab0){var _0x2d61e9=typeof _0x18b16f[_0x6681('0x2b')]===_0x6681('0x2c')&&typeof _0x18b16f[_0x6681('0x2d')]==='undefined';var _0x47ced2=_0x4acab0[_0x6681('0x2e')];var _0x55906d=_0x2d61e9?0x0:_0x18b16f['offset'];var _0x55438c=_0x2d61e9?_0x4acab0['count']:_0x18b16f[_0x6681('0x2b')]+_0x18b16f[_0x6681('0x2d')];var _0x210abb;if(_0x55438c>=_0x47ced2){_0x55438c=_0x47ced2;_0x210abb=0xc8;}else{_0x210abb=0xce;}_0xf7cfea[_0x6681('0x28')](_0x210abb);return _0xf7cfea[_0x6681('0x2f')](_0x6681('0x30'),_0x55906d+'-'+_0x55438c+'/'+_0x47ced2)[_0x6681('0x2a')](_0x4acab0);}return null;};}function patchUpdates(_0x44f39a){return function(_0x1968c3){try{jsonpatch[_0x6681('0x31')](_0x1968c3,_0x44f39a,!![]);}catch(_0x35f980){return BPromise[_0x6681('0x32')](_0x35f980);}return _0x1968c3['save']();};}function saveUpdates(_0x901f5,_0x56dd3b){return function(_0x49d8b0){if(_0x49d8b0){return _0x49d8b0[_0x6681('0x33')](_0x901f5)[_0x6681('0x1c')](function(_0x34fa9f){return _0x34fa9f;});}return null;};}function removeEntity(_0x57d022,_0x2b845c){return function(_0x5c99d3){if(_0x5c99d3){return _0x5c99d3[_0x6681('0x34')]()[_0x6681('0x1c')](function(){_0x57d022[_0x6681('0x28')](0xcc)[_0x6681('0x29')]();});}};}function handleEntityNotFound(_0x5795f9,_0x372f64){return function(_0x4d9fc4){if(!_0x4d9fc4){_0x5795f9[_0x6681('0x27')](0x194);}return _0x4d9fc4;};}function handleError(_0x2583f8,_0xe1e0e0){_0xe1e0e0=_0xe1e0e0||0x1f4;return function(_0x1ee576){logger[_0x6681('0x23')](_0x1ee576[_0x6681('0x35')]);if(_0x1ee576['name']){delete _0x1ee576['name'];}_0x2583f8[_0x6681('0x28')](_0xe1e0e0)['send'](_0x1ee576);};}exports['index']=function(_0x72077e,_0x3ca6fe){var _0x15728d={},_0xcacb9e={},_0x14fa29={'count':0x0,'rows':[]};var _0x5de3a8=_['map'](db[_0x6681('0x36')]['rawAttributes'],function(_0x2872b4){return{'name':_0x2872b4[_0x6681('0x37')],'type':_0x2872b4['type'][_0x6681('0x38')]};});_0xcacb9e[_0x6681('0x39')]=_['map'](_0x5de3a8,'name');_0xcacb9e[_0x6681('0x3a')]=_[_0x6681('0x3b')](_0x72077e[_0x6681('0x3a')]);_0xcacb9e[_0x6681('0x3c')]=_[_0x6681('0x3d')](_0xcacb9e['model'],_0xcacb9e[_0x6681('0x3a')]);_0x15728d[_0x6681('0x3e')]=_['intersection'](_0xcacb9e['model'],qs[_0x6681('0x3f')](_0x72077e[_0x6681('0x3a')][_0x6681('0x3f')]));_0x15728d[_0x6681('0x3e')]=_0x15728d[_0x6681('0x3e')][_0x6681('0x40')]?_0x15728d[_0x6681('0x3e')]:_0xcacb9e[_0x6681('0x39')];if(!_0x72077e[_0x6681('0x3a')][_0x6681('0x41')](_0x6681('0x42'))){_0x15728d['limit']=qs[_0x6681('0x2d')](_0x72077e['query'][_0x6681('0x2d')]);_0x15728d[_0x6681('0x2b')]=qs[_0x6681('0x2b')](_0x72077e['query'][_0x6681('0x2b')]);}_0x15728d[_0x6681('0x43')]=qs[_0x6681('0x44')](_0x72077e['query'][_0x6681('0x44')]);_0x15728d['where']=qs['filters'](_[_0x6681('0x45')](_0x72077e[_0x6681('0x3a')],_0xcacb9e[_0x6681('0x3c')]),_0x5de3a8);if(_0x72077e[_0x6681('0x3a')][_0x6681('0x46')]){_0x15728d['where']=_[_0x6681('0x47')](_0x15728d[_0x6681('0x48')],{'$or':_[_0x6681('0x49')](_0x5de3a8,function(_0x49130d){if(_0x49130d['type']!=='VIRTUAL'){var _0x34f474={};_0x34f474[_0x49130d[_0x6681('0x4a')]]={'$like':'%'+_0x72077e[_0x6681('0x3a')]['filter']+'%'};return _0x34f474;}})});}_0x15728d=_[_0x6681('0x47')]({},_0x15728d,_0x72077e['options']);var _0x190256={'where':_0x15728d[_0x6681('0x48')]};return db[_0x6681('0x36')][_0x6681('0x2e')](_0x190256)['then'](function(_0x29c05f){_0x14fa29['count']=_0x29c05f;if(_0x72077e[_0x6681('0x3a')][_0x6681('0x4b')]){_0x15728d['include']=[{'all':!![]}];}return db[_0x6681('0x36')]['findAll'](_0x15728d);})[_0x6681('0x1c')](function(_0x391036){_0x14fa29['rows']=_0x391036;return _0x14fa29;})[_0x6681('0x1c')](respondWithFilteredResult(_0x3ca6fe,_0x15728d))[_0x6681('0x26')](handleError(_0x3ca6fe,null));};exports[_0x6681('0x4c')]=function(_0x41bb01,_0x37688e){var _0x60cf09={'raw':!![],'where':{'id':_0x41bb01[_0x6681('0x4d')]['id']}},_0x5c5d9b={};_0x5c5d9b[_0x6681('0x39')]=_[_0x6681('0x3b')](db[_0x6681('0x36')][_0x6681('0x4e')]);_0x5c5d9b[_0x6681('0x3a')]=_[_0x6681('0x3b')](_0x41bb01[_0x6681('0x3a')]);_0x5c5d9b[_0x6681('0x3c')]=_[_0x6681('0x3d')](_0x5c5d9b['model'],_0x5c5d9b['query']);_0x60cf09[_0x6681('0x3e')]=_[_0x6681('0x3d')](_0x5c5d9b[_0x6681('0x39')],qs['fields'](_0x41bb01[_0x6681('0x3a')]['fields']));_0x60cf09[_0x6681('0x3e')]=_0x60cf09[_0x6681('0x3e')]['length']?_0x60cf09['attributes']:_0x5c5d9b['model'];if(_0x41bb01[_0x6681('0x3a')][_0x6681('0x4b')]){_0x60cf09['include']=[{'all':!![]}];}_0x60cf09=_[_0x6681('0x47')]({},_0x60cf09,_0x41bb01['options']);return db[_0x6681('0x36')][_0x6681('0x4f')](_0x60cf09)[_0x6681('0x1c')](handleEntityNotFound(_0x37688e,null))[_0x6681('0x1c')](respondWithResult(_0x37688e,null))[_0x6681('0x26')](handleError(_0x37688e,null));};exports[_0x6681('0x50')]=function(_0x592b22,_0x2d7cac,_0x346190){var _0x1cedf5;return db[_0x6681('0x51')][_0x6681('0x52')](function(_0x520d07){return db['Network']['create'](_0x592b22[_0x6681('0x53')],{'raw':!![]})[_0x6681('0x1c')](function(_0x3cf5da){_0x1cedf5=_0x3cf5da;return db[_0x6681('0x36')][_0x6681('0x54')]({'where':{'type':_0x592b22[_0x6681('0x53')][_0x6681('0x55')]},'raw':!![]});})[_0x6681('0x1c')](function(_0x3b783c){if(_0x1cedf5[_0x6681('0x55')][_0x6681('0x56')]()==_0x6681('0x57')){var _0x1db480=fs[_0x6681('0x58')](path['join'](config[_0x6681('0x59')],_0x6681('0x5a')),'utf8');var _0x4c8e47=ejs['render'](_0x1db480,{'networks':_0x3b783c||[]});fs[_0x6681('0x5b')](_0x6681('0x5c'),_0x4c8e47);return respondWithRpcPromise(_0x6681('0x5d'),_0x6681('0x50'),{'module':_0x6681('0x5e')});}else if(_0x1cedf5['type']['toUpperCase']()==_0x6681('0x5f')){var _0x5d2c1d=fs[_0x6681('0x58')](path['join'](config[_0x6681('0x59')],_0x6681('0x60')),_0x6681('0x61'));var _0x4fcfc6=ejs[_0x6681('0x62')](_0x5d2c1d,{'networks':_0x3b783c||[]});fs[_0x6681('0x5b')](_0x6681('0x63'),_0x4fcfc6);return respondWithRpcPromise(_0x6681('0x5d'),_0x6681('0x50'),{'module':_0x6681('0x5e')});}else{var _0x36ee4e=fs['readFileSync'](path[_0x6681('0x64')](config[_0x6681('0x59')],'server/files/templates/network.ejs'),_0x6681('0x61'));var _0x219513=ejs['render'](_0x36ee4e,{'networks':_0x3b783c||[]});fs[_0x6681('0x5b')](util[_0x6681('0x65')](_0x6681('0x66'),_0x592b22[_0x6681('0x53')]['type'][_0x6681('0x67')]()),_0x219513);return respondWithRpcPromise(_0x6681('0x5d'),_0x6681('0x50'),{'module':'chan_sip.so'});}return null;})[_0x6681('0x1c')](function(){return _0x1cedf5;});})[_0x6681('0x1c')](respondWithResult(_0x2d7cac,0xc9))[_0x6681('0x26')](handleError(_0x2d7cac,null));};exports[_0x6681('0x33')]=function(_0x2fe75e,_0x4945e2,_0x4fe850){var _0x38ac26;return db['sequelize'][_0x6681('0x52')](function(_0x468560){return db[_0x6681('0x36')]['find']({'where':{'id':_0x2fe75e['params']['id']}})[_0x6681('0x1c')](handleEntityNotFound(_0x4945e2,null))[_0x6681('0x1c')](saveUpdates(_0x2fe75e[_0x6681('0x53')],null))['then'](function(_0x316999){if(_0x316999){_0x38ac26=_0x316999;return db['Network'][_0x6681('0x54')]({'where':{'type':_0x38ac26[_0x6681('0x55')]},'raw':!![]});}return null;})[_0x6681('0x1c')](function(_0x3f1064){if(_0x38ac26[_0x6681('0x55')][_0x6681('0x56')]()==_0x6681('0x57')){var _0x38e315=fs[_0x6681('0x58')](path['join'](config[_0x6681('0x59')],_0x6681('0x5a')),'utf8');var _0x390813=ejs[_0x6681('0x62')](_0x38e315,{'networks':_0x3f1064||[]});fs[_0x6681('0x5b')](_0x6681('0x5c'),_0x390813);return respondWithRpcPromise(_0x6681('0x5d'),_0x6681('0x33'),{'module':'res_stun_monitor.so'});}else if(_0x38ac26['type'][_0x6681('0x56')]()==_0x6681('0x5f')){var _0x5de06c=fs['readFileSync'](path[_0x6681('0x64')](config[_0x6681('0x59')],_0x6681('0x60')),_0x6681('0x61'));var _0x465b8c=ejs[_0x6681('0x62')](_0x5de06c,{'networks':_0x3f1064||[]});fs[_0x6681('0x5b')](_0x6681('0x63'),_0x465b8c);return respondWithRpcPromise(_0x6681('0x5d'),_0x6681('0x33'),{'module':'res_stun_monitor.so'});}else{var _0x467f0a=fs[_0x6681('0x58')](path['join'](config['root'],_0x6681('0x68')),_0x6681('0x61'));var _0x26e61e=ejs['render'](_0x467f0a,{'networks':_0x3f1064||[]});fs['writeFileSync'](util[_0x6681('0x65')](_0x6681('0x66'),_0x2fe75e['body'][_0x6681('0x55')][_0x6681('0x67')]()),_0x26e61e);return respondWithRpcPromise(_0x6681('0x5d'),_0x6681('0x33'),{'module':_0x6681('0x69')});}return null;})[_0x6681('0x1c')](function(_0x43bdc5){if(_0x43bdc5){return _0x38ac26;}return null;});})[_0x6681('0x1c')](respondWithResult(_0x4945e2,null))[_0x6681('0x26')](handleError(_0x4945e2,null));};exports[_0x6681('0x34')]=function(_0x400446,_0x2d5f82,_0x5206fb){var _0x1faef1;return db[_0x6681('0x36')][_0x6681('0x4f')]({'where':{'id':_0x400446['params']['id']}})[_0x6681('0x1c')](function(_0x527648){_0x1faef1=_0x527648;return _0x527648;})[_0x6681('0x1c')](handleEntityNotFound(_0x2d5f82,null))[_0x6681('0x1c')](removeEntity(_0x2d5f82,null))['then'](function(){if(_0x1faef1){return db[_0x6681('0x36')][_0x6681('0x54')]({'where':{'type':_0x1faef1[_0x6681('0x55')]},'raw':!![]});}})[_0x6681('0x1c')](function(_0x112512){if(_0x1faef1[_0x6681('0x55')]['toUpperCase']()==_0x6681('0x57')){var _0x56b47a=fs[_0x6681('0x58')](path[_0x6681('0x64')](config['root'],_0x6681('0x5a')),'utf8');var _0xfdb3c1=ejs['render'](_0x56b47a,{'networks':_0x112512||[]});fs['writeFileSync'](_0x6681('0x5c'),_0xfdb3c1);return respondWithRpcPromise('Reload',_0x6681('0x34'),{'module':_0x6681('0x5e')});}else if(_0x1faef1[_0x6681('0x55')]['toUpperCase']()==_0x6681('0x5f')){var _0x11ba92=fs[_0x6681('0x58')](path[_0x6681('0x64')](config[_0x6681('0x59')],_0x6681('0x60')),_0x6681('0x61'));var _0x237d5f=ejs[_0x6681('0x62')](_0x11ba92,{'networks':_0x112512||[]});fs[_0x6681('0x5b')](_0x6681('0x63'),_0x237d5f);return respondWithRpcPromise(_0x6681('0x5d'),_0x6681('0x34'),{'module':_0x6681('0x5e')});}else{var _0x5831fc=fs[_0x6681('0x58')](path['join'](config[_0x6681('0x59')],_0x6681('0x68')),_0x6681('0x61'));var _0x2efb8f=ejs['render'](_0x5831fc,{'networks':_0x112512||[]});fs[_0x6681('0x5b')](util['format'](_0x6681('0x66'),_0x400446['body'][_0x6681('0x55')][_0x6681('0x67')]()),_0x2efb8f);return respondWithRpcPromise('Reload',_0x6681('0x34'),{'module':_0x6681('0x69')});}return null;})[_0x6681('0x26')](handleError(_0x2d5f82,null));}; \ No newline at end of file +var _0xd1f5=['where','pick','merge','VIRTUAL','filter','Network','includeAll','include','findAll','show','params','keys','options','find','create','sequelize','transaction','body','toUpperCase','STUN','readFileSync','join','root','server/files/templates/stun_multiple.ejs','utf8','render','writeFileSync','/etc/asterisk/stun_xcally.conf','Reload','res_stun_monitor.so','TURN','server/files/templates/turn_multiple.ejs','/etc/asterisk/turn_xcally.conf','server/files/templates/network.ejs','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','format','chan_sip.so','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','path','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','request','info','Network,\x20%s,\x20%s','debug','Network,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','sendStatus','stack','name','send','index','rawAttributes','fieldName','type','key','map','query','filters','intersection','attributes','fields','length','model','hasOwnProperty','nolimit','order','sort'];(function(_0x2fd392,_0x372382){var _0x28b341=function(_0x264867){while(--_0x264867){_0x2fd392['push'](_0x2fd392['shift']());}};_0x28b341(++_0x372382);}(_0xd1f5,0x1de));var _0x5d1f=function(_0x29798b,_0xd3d41a){_0x29798b=_0x29798b-0x0;var _0x18c023=_0xd1f5[_0x29798b];return _0x18c023;};'use strict';var emlformat=require(_0x5d1f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5d1f('0x1'));var jsonpatch=require(_0x5d1f('0x2'));var rp=require('request-promise');var moment=require(_0x5d1f('0x3'));var BPromise=require(_0x5d1f('0x4'));var Mustache=require(_0x5d1f('0x5'));var util=require('util');var path=require(_0x5d1f('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5d1f('0x7'));var _=require(_0x5d1f('0x8'));var squel=require(_0x5d1f('0x9'));var crypto=require(_0x5d1f('0xa'));var jsforce=require(_0x5d1f('0xb'));var deskjs=require(_0x5d1f('0xc'));var toCsv=require(_0x5d1f('0xd'));var querystring=require('querystring');var Papa=require(_0x5d1f('0xe'));var Redis=require(_0x5d1f('0xf'));var authService=require(_0x5d1f('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x5d1f('0x11'));var hardwareService=require(_0x5d1f('0x12'));var logger=require('../../config/logger')(_0x5d1f('0x13'));var utils=require(_0x5d1f('0x14'));var config=require(_0x5d1f('0x15'));var licenseUtil=require(_0x5d1f('0x16'));var db=require(_0x5d1f('0x17'))['db'];var jayson=require(_0x5d1f('0x18'));var client=jayson[_0x5d1f('0x19')]['http']({'port':0x232a});function respondWithRpcPromise(_0x250b1e,_0x31f8aa,_0x221458,_0x103d34){return new BPromise(function(_0x530db6,_0x23e37b){var _0x43cadf=_0x103d34||client;return _0x43cadf[_0x5d1f('0x1a')](_0x250b1e,_0x221458)['then'](function(_0x95100c){logger[_0x5d1f('0x1b')](_0x5d1f('0x1c'),_0x31f8aa,'request\x20sent');logger[_0x5d1f('0x1d')](_0x5d1f('0x1e'),_0x31f8aa,_0x5d1f('0x1f'),JSON['stringify'](_0x95100c));if(_0x95100c[_0x5d1f('0x20')]){if(_0x95100c['error'][_0x5d1f('0x21')]===0x1f4){logger['error'](_0x5d1f('0x1c'),_0x31f8aa,_0x95100c[_0x5d1f('0x20')]['message']);return _0x23e37b(_0x95100c['error'][_0x5d1f('0x22')]);}logger[_0x5d1f('0x20')](_0x5d1f('0x1c'),_0x31f8aa,_0x95100c[_0x5d1f('0x20')][_0x5d1f('0x22')]);return _0x530db6(_0x95100c[_0x5d1f('0x20')]['message']);}else{logger[_0x5d1f('0x1b')]('Network,\x20%s,\x20%s',_0x31f8aa,_0x5d1f('0x1f'));_0x530db6(_0x95100c[_0x5d1f('0x23')][_0x5d1f('0x22')]);}})[_0x5d1f('0x24')](function(_0x1e0564){logger[_0x5d1f('0x20')](_0x5d1f('0x1c'),_0x31f8aa,_0x1e0564);_0x23e37b(_0x1e0564);});});}function respondWithStatusCode(_0x290a26,_0x21c79d){_0x21c79d=_0x21c79d||0xcc;return function(_0x2c7f7f){if(_0x2c7f7f){return _0x290a26['sendStatus'](_0x21c79d);}return _0x290a26[_0x5d1f('0x25')](_0x21c79d)[_0x5d1f('0x26')]();};}function respondWithResult(_0x598851,_0x41c6fd){_0x41c6fd=_0x41c6fd||0xc8;return function(_0x362879){if(_0x362879){return _0x598851['status'](_0x41c6fd)[_0x5d1f('0x27')](_0x362879);}};}function respondWithFilteredResult(_0x4d091a,_0x3c0f1d){return function(_0x21a999){if(_0x21a999){var _0x5ddd25=typeof _0x3c0f1d[_0x5d1f('0x28')]===_0x5d1f('0x29')&&typeof _0x3c0f1d[_0x5d1f('0x2a')]===_0x5d1f('0x29');var _0x541b39=_0x21a999[_0x5d1f('0x2b')];var _0x143a70=_0x5ddd25?0x0:_0x3c0f1d[_0x5d1f('0x28')];var _0x4f0152=_0x5ddd25?_0x21a999[_0x5d1f('0x2b')]:_0x3c0f1d[_0x5d1f('0x28')]+_0x3c0f1d[_0x5d1f('0x2a')];var _0x339c01;if(_0x4f0152>=_0x541b39){_0x4f0152=_0x541b39;_0x339c01=0xc8;}else{_0x339c01=0xce;}_0x4d091a['status'](_0x339c01);return _0x4d091a[_0x5d1f('0x2c')]('Content-Range',_0x143a70+'-'+_0x4f0152+'/'+_0x541b39)[_0x5d1f('0x27')](_0x21a999);}return null;};}function patchUpdates(_0x489ec4){return function(_0xacad0d){try{jsonpatch[_0x5d1f('0x2d')](_0xacad0d,_0x489ec4,!![]);}catch(_0x27afa3){return BPromise[_0x5d1f('0x2e')](_0x27afa3);}return _0xacad0d[_0x5d1f('0x2f')]();};}function saveUpdates(_0xe8055d,_0x1062d3){return function(_0x2deb35){if(_0x2deb35){return _0x2deb35[_0x5d1f('0x30')](_0xe8055d)[_0x5d1f('0x31')](function(_0x307883){return _0x307883;});}return null;};}function removeEntity(_0x29b4e0,_0x2f05fc){return function(_0x497a8f){if(_0x497a8f){return _0x497a8f[_0x5d1f('0x32')]()[_0x5d1f('0x31')](function(){_0x29b4e0[_0x5d1f('0x25')](0xcc)[_0x5d1f('0x26')]();});}};}function handleEntityNotFound(_0x3aabe5,_0x8065c1){return function(_0x71817b){if(!_0x71817b){_0x3aabe5[_0x5d1f('0x33')](0x194);}return _0x71817b;};}function handleError(_0x55ba50,_0x2787b9){_0x2787b9=_0x2787b9||0x1f4;return function(_0x368ea4){logger[_0x5d1f('0x20')](_0x368ea4[_0x5d1f('0x34')]);if(_0x368ea4['name']){delete _0x368ea4[_0x5d1f('0x35')];}_0x55ba50[_0x5d1f('0x25')](_0x2787b9)[_0x5d1f('0x36')](_0x368ea4);};}exports[_0x5d1f('0x37')]=function(_0x4df514,_0x3ea0b1){var _0x46ab8e={},_0x36635d={},_0x2b6d34={'count':0x0,'rows':[]};var _0x101902=_['map'](db['Network'][_0x5d1f('0x38')],function(_0x3f54ed){return{'name':_0x3f54ed[_0x5d1f('0x39')],'type':_0x3f54ed[_0x5d1f('0x3a')][_0x5d1f('0x3b')]};});_0x36635d['model']=_[_0x5d1f('0x3c')](_0x101902,_0x5d1f('0x35'));_0x36635d['query']=_['keys'](_0x4df514[_0x5d1f('0x3d')]);_0x36635d[_0x5d1f('0x3e')]=_[_0x5d1f('0x3f')](_0x36635d['model'],_0x36635d['query']);_0x46ab8e[_0x5d1f('0x40')]=_[_0x5d1f('0x3f')](_0x36635d['model'],qs[_0x5d1f('0x41')](_0x4df514[_0x5d1f('0x3d')]['fields']));_0x46ab8e[_0x5d1f('0x40')]=_0x46ab8e[_0x5d1f('0x40')][_0x5d1f('0x42')]?_0x46ab8e[_0x5d1f('0x40')]:_0x36635d[_0x5d1f('0x43')];if(!_0x4df514[_0x5d1f('0x3d')][_0x5d1f('0x44')](_0x5d1f('0x45'))){_0x46ab8e['limit']=qs[_0x5d1f('0x2a')](_0x4df514[_0x5d1f('0x3d')][_0x5d1f('0x2a')]);_0x46ab8e['offset']=qs[_0x5d1f('0x28')](_0x4df514[_0x5d1f('0x3d')]['offset']);}_0x46ab8e[_0x5d1f('0x46')]=qs[_0x5d1f('0x47')](_0x4df514[_0x5d1f('0x3d')][_0x5d1f('0x47')]);_0x46ab8e[_0x5d1f('0x48')]=qs[_0x5d1f('0x3e')](_[_0x5d1f('0x49')](_0x4df514[_0x5d1f('0x3d')],_0x36635d['filters']),_0x101902);if(_0x4df514['query']['filter']){_0x46ab8e['where']=_[_0x5d1f('0x4a')](_0x46ab8e[_0x5d1f('0x48')],{'$or':_[_0x5d1f('0x3c')](_0x101902,function(_0x3cd1ef){if(_0x3cd1ef[_0x5d1f('0x3a')]!==_0x5d1f('0x4b')){var _0xfe2fb1={};_0xfe2fb1[_0x3cd1ef['name']]={'$like':'%'+_0x4df514['query'][_0x5d1f('0x4c')]+'%'};return _0xfe2fb1;}})});}_0x46ab8e=_['merge']({},_0x46ab8e,_0x4df514['options']);var _0x157297={'where':_0x46ab8e['where']};return db[_0x5d1f('0x4d')][_0x5d1f('0x2b')](_0x157297)['then'](function(_0xa97909){_0x2b6d34['count']=_0xa97909;if(_0x4df514[_0x5d1f('0x3d')][_0x5d1f('0x4e')]){_0x46ab8e[_0x5d1f('0x4f')]=[{'all':!![]}];}return db[_0x5d1f('0x4d')][_0x5d1f('0x50')](_0x46ab8e);})['then'](function(_0x2e78b0){_0x2b6d34['rows']=_0x2e78b0;return _0x2b6d34;})[_0x5d1f('0x31')](respondWithFilteredResult(_0x3ea0b1,_0x46ab8e))[_0x5d1f('0x24')](handleError(_0x3ea0b1,null));};exports[_0x5d1f('0x51')]=function(_0x396cf4,_0xf9cedb){var _0x552735={'raw':!![],'where':{'id':_0x396cf4[_0x5d1f('0x52')]['id']}},_0x2e16f5={};_0x2e16f5[_0x5d1f('0x43')]=_[_0x5d1f('0x53')](db[_0x5d1f('0x4d')][_0x5d1f('0x38')]);_0x2e16f5[_0x5d1f('0x3d')]=_[_0x5d1f('0x53')](_0x396cf4[_0x5d1f('0x3d')]);_0x2e16f5['filters']=_[_0x5d1f('0x3f')](_0x2e16f5[_0x5d1f('0x43')],_0x2e16f5['query']);_0x552735[_0x5d1f('0x40')]=_[_0x5d1f('0x3f')](_0x2e16f5[_0x5d1f('0x43')],qs[_0x5d1f('0x41')](_0x396cf4[_0x5d1f('0x3d')]['fields']));_0x552735[_0x5d1f('0x40')]=_0x552735[_0x5d1f('0x40')][_0x5d1f('0x42')]?_0x552735[_0x5d1f('0x40')]:_0x2e16f5[_0x5d1f('0x43')];if(_0x396cf4[_0x5d1f('0x3d')][_0x5d1f('0x4e')]){_0x552735[_0x5d1f('0x4f')]=[{'all':!![]}];}_0x552735=_[_0x5d1f('0x4a')]({},_0x552735,_0x396cf4[_0x5d1f('0x54')]);return db[_0x5d1f('0x4d')][_0x5d1f('0x55')](_0x552735)['then'](handleEntityNotFound(_0xf9cedb,null))['then'](respondWithResult(_0xf9cedb,null))[_0x5d1f('0x24')](handleError(_0xf9cedb,null));};exports[_0x5d1f('0x56')]=function(_0x29162c,_0x56cc0b,_0x1b2c52){var _0x3ac6ee;return db[_0x5d1f('0x57')][_0x5d1f('0x58')](function(_0x1adca4){return db[_0x5d1f('0x4d')][_0x5d1f('0x56')](_0x29162c[_0x5d1f('0x59')],{'raw':!![]})[_0x5d1f('0x31')](function(_0x2a481a){_0x3ac6ee=_0x2a481a;return db[_0x5d1f('0x4d')]['findAll']({'where':{'type':_0x29162c['body'][_0x5d1f('0x3a')]},'raw':!![]});})[_0x5d1f('0x31')](function(_0x2f7583){if(_0x3ac6ee[_0x5d1f('0x3a')][_0x5d1f('0x5a')]()==_0x5d1f('0x5b')){var _0x1d1b9f=fs[_0x5d1f('0x5c')](path[_0x5d1f('0x5d')](config[_0x5d1f('0x5e')],_0x5d1f('0x5f')),_0x5d1f('0x60'));var _0x2fe25c=ejs[_0x5d1f('0x61')](_0x1d1b9f,{'networks':_0x2f7583||[]});fs[_0x5d1f('0x62')](_0x5d1f('0x63'),_0x2fe25c);return respondWithRpcPromise(_0x5d1f('0x64'),_0x5d1f('0x56'),{'module':_0x5d1f('0x65')});}else if(_0x3ac6ee[_0x5d1f('0x3a')]['toUpperCase']()==_0x5d1f('0x66')){var _0x314a36=fs['readFileSync'](path[_0x5d1f('0x5d')](config[_0x5d1f('0x5e')],_0x5d1f('0x67')),'utf8');var _0x410f19=ejs[_0x5d1f('0x61')](_0x314a36,{'networks':_0x2f7583||[]});fs[_0x5d1f('0x62')](_0x5d1f('0x68'),_0x410f19);return respondWithRpcPromise(_0x5d1f('0x64'),_0x5d1f('0x56'),{'module':_0x5d1f('0x65')});}else{var _0xc66d45=fs[_0x5d1f('0x5c')](path[_0x5d1f('0x5d')](config[_0x5d1f('0x5e')],_0x5d1f('0x69')),_0x5d1f('0x60'));var _0x11c4d1=ejs[_0x5d1f('0x61')](_0xc66d45,{'networks':_0x2f7583||[]});fs[_0x5d1f('0x62')](util['format'](_0x5d1f('0x6a'),_0x29162c[_0x5d1f('0x59')]['type'][_0x5d1f('0x6b')]()),_0x11c4d1);return respondWithRpcPromise(_0x5d1f('0x64'),_0x5d1f('0x56'),{'module':'chan_sip.so'});}return null;})['then'](function(){return _0x3ac6ee;});})[_0x5d1f('0x31')](respondWithResult(_0x56cc0b,0xc9))['catch'](handleError(_0x56cc0b,null));};exports[_0x5d1f('0x30')]=function(_0x3b0cb4,_0x5e4336,_0x2d954b){var _0x396b05;return db[_0x5d1f('0x57')][_0x5d1f('0x58')](function(_0x2f9886){return db[_0x5d1f('0x4d')][_0x5d1f('0x55')]({'where':{'id':_0x3b0cb4[_0x5d1f('0x52')]['id']}})[_0x5d1f('0x31')](handleEntityNotFound(_0x5e4336,null))[_0x5d1f('0x31')](saveUpdates(_0x3b0cb4[_0x5d1f('0x59')],null))['then'](function(_0x14e42a){if(_0x14e42a){_0x396b05=_0x14e42a;return db[_0x5d1f('0x4d')][_0x5d1f('0x50')]({'where':{'type':_0x396b05[_0x5d1f('0x3a')]},'raw':!![]});}return null;})[_0x5d1f('0x31')](function(_0x10feb8){if(_0x396b05['type'][_0x5d1f('0x5a')]()==_0x5d1f('0x5b')){var _0xbfdadb=fs['readFileSync'](path['join'](config[_0x5d1f('0x5e')],'server/files/templates/stun_multiple.ejs'),_0x5d1f('0x60'));var _0x81057e=ejs[_0x5d1f('0x61')](_0xbfdadb,{'networks':_0x10feb8||[]});fs[_0x5d1f('0x62')]('/etc/asterisk/stun_xcally.conf',_0x81057e);return respondWithRpcPromise('Reload',_0x5d1f('0x30'),{'module':'res_stun_monitor.so'});}else if(_0x396b05['type'][_0x5d1f('0x5a')]()==_0x5d1f('0x66')){var _0x2fa740=fs[_0x5d1f('0x5c')](path[_0x5d1f('0x5d')](config['root'],_0x5d1f('0x67')),_0x5d1f('0x60'));var _0x4369dc=ejs[_0x5d1f('0x61')](_0x2fa740,{'networks':_0x10feb8||[]});fs[_0x5d1f('0x62')](_0x5d1f('0x68'),_0x4369dc);return respondWithRpcPromise('Reload',_0x5d1f('0x30'),{'module':_0x5d1f('0x65')});}else{var _0x507d9b=fs[_0x5d1f('0x5c')](path['join'](config[_0x5d1f('0x5e')],_0x5d1f('0x69')),_0x5d1f('0x60'));var _0x3c3fe6=ejs['render'](_0x507d9b,{'networks':_0x10feb8||[]});fs[_0x5d1f('0x62')](util[_0x5d1f('0x6c')]('/etc/asterisk/sip_xcally_%s.conf',_0x3b0cb4[_0x5d1f('0x59')][_0x5d1f('0x3a')]['toLowerCase']()),_0x3c3fe6);return respondWithRpcPromise(_0x5d1f('0x64'),_0x5d1f('0x30'),{'module':'chan_sip.so'});}return null;})[_0x5d1f('0x31')](function(_0x4ba620){if(_0x4ba620){return _0x396b05;}return null;});})[_0x5d1f('0x31')](respondWithResult(_0x5e4336,null))['catch'](handleError(_0x5e4336,null));};exports[_0x5d1f('0x32')]=function(_0x393c96,_0xbee9a9,_0x25bdbf){var _0x51d299;return db[_0x5d1f('0x4d')][_0x5d1f('0x55')]({'where':{'id':_0x393c96[_0x5d1f('0x52')]['id']}})[_0x5d1f('0x31')](function(_0x11ae5c){_0x51d299=_0x11ae5c;return _0x11ae5c;})[_0x5d1f('0x31')](handleEntityNotFound(_0xbee9a9,null))[_0x5d1f('0x31')](removeEntity(_0xbee9a9,null))[_0x5d1f('0x31')](function(){if(_0x51d299){return db[_0x5d1f('0x4d')][_0x5d1f('0x50')]({'where':{'type':_0x51d299[_0x5d1f('0x3a')]},'raw':!![]});}})['then'](function(_0x56b068){if(_0x51d299['type'][_0x5d1f('0x5a')]()==_0x5d1f('0x5b')){var _0x23e8ce=fs[_0x5d1f('0x5c')](path[_0x5d1f('0x5d')](config[_0x5d1f('0x5e')],'server/files/templates/stun_multiple.ejs'),_0x5d1f('0x60'));var _0xc0680f=ejs[_0x5d1f('0x61')](_0x23e8ce,{'networks':_0x56b068||[]});fs[_0x5d1f('0x62')](_0x5d1f('0x63'),_0xc0680f);return respondWithRpcPromise(_0x5d1f('0x64'),_0x5d1f('0x32'),{'module':_0x5d1f('0x65')});}else if(_0x51d299[_0x5d1f('0x3a')][_0x5d1f('0x5a')]()==_0x5d1f('0x66')){var _0x2c6c8d=fs['readFileSync'](path[_0x5d1f('0x5d')](config[_0x5d1f('0x5e')],_0x5d1f('0x67')),_0x5d1f('0x60'));var _0x36d3d8=ejs[_0x5d1f('0x61')](_0x2c6c8d,{'networks':_0x56b068||[]});fs[_0x5d1f('0x62')]('/etc/asterisk/turn_xcally.conf',_0x36d3d8);return respondWithRpcPromise(_0x5d1f('0x64'),_0x5d1f('0x32'),{'module':_0x5d1f('0x65')});}else{var _0x5528f5=fs[_0x5d1f('0x5c')](path[_0x5d1f('0x5d')](config[_0x5d1f('0x5e')],_0x5d1f('0x69')),_0x5d1f('0x60'));var _0x580b52=ejs['render'](_0x5528f5,{'networks':_0x56b068||[]});fs[_0x5d1f('0x62')](util[_0x5d1f('0x6c')](_0x5d1f('0x6a'),_0x393c96['body'][_0x5d1f('0x3a')][_0x5d1f('0x6b')]()),_0x580b52);return respondWithRpcPromise(_0x5d1f('0x64'),'destroy',{'module':_0x5d1f('0x6d')});}return null;})[_0x5d1f('0x24')](handleError(_0xbee9a9,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index e508084..783e1fd 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 _0xd404=['util','api','moment','request-promise','path','rimraf','../../config/environment','./network.attributes','exports','define','network','lodash'];(function(_0xd299c3,_0x4ba0f1){var _0x376574=function(_0xc585f){while(--_0xc585f){_0xd299c3['push'](_0xd299c3['shift']());}};_0x376574(++_0x4ba0f1);}(_0xd404,0x15b));var _0x4d40=function(_0x12ecd7,_0x3eb217){_0x12ecd7=_0x12ecd7-0x0;var _0x391b77=_0xd404[_0x12ecd7];return _0x391b77;};'use strict';var _=require(_0x4d40('0x0'));var util=require(_0x4d40('0x1'));var logger=require('../../config/logger')(_0x4d40('0x2'));var moment=require(_0x4d40('0x3'));var BPromise=require('bluebird');var rp=require(_0x4d40('0x4'));var fs=require('fs');var path=require(_0x4d40('0x5'));var rimraf=require(_0x4d40('0x6'));var config=require(_0x4d40('0x7'));var attributes=require(_0x4d40('0x8'));module[_0x4d40('0x9')]=function(_0xc2a9db,_0x24a237){return _0xc2a9db[_0x4d40('0xa')]('Network',attributes,{'tableName':_0x4d40('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0a12=['util','bluebird','path','rimraf','../../config/environment','./network.attributes','exports','network'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x0a12,0xb8));var _0x20a1=function(_0x13b8f3,_0x442821){_0x13b8f3=_0x13b8f3-0x0;var _0x1a6d06=_0x0a12[_0x13b8f3];return _0x1a6d06;};'use strict';var _=require('lodash');var util=require(_0x20a1('0x0'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x20a1('0x1'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x20a1('0x2'));var rimraf=require(_0x20a1('0x3'));var config=require(_0x20a1('0x4'));var attributes=require(_0x20a1('0x5'));module[_0x20a1('0x6')]=function(_0x2e0ad3,_0x1fedd2){return _0x2e0ad3['define']('Network',attributes,{'tableName':_0x20a1('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/network/network.rpc.js b/server/api/network/network.rpc.js index 786ae83..1da76ce 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(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x7a54,0x106));var _0x47a5=function(_0x62a8a9,_0x44c600){_0x62a8a9=_0x62a8a9-0x0;var _0xdb37e2=_0x7a54[_0x62a8a9];return _0xdb37e2;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('Network,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});} \ No newline at end of file +var _0x9957=['message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x2a4bba,_0x1194ce){var _0x40e9c4=function(_0x3502a8){while(--_0x3502a8){_0x2a4bba['push'](_0x2a4bba['shift']());}};_0x40e9c4(++_0x1194ce);}(_0x9957,0x93));var _0x7995=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x9957[_0x3947c9];return _0x2e7871;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var moment=require(_0x7995('0x2'));var BPromise=require(_0x7995('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7995('0x4'));var db=require(_0x7995('0x5'))['db'];var utils=require(_0x7995('0x6'));var logger=require(_0x7995('0x7'))('rpc');var config=require(_0x7995('0x8'));var jayson=require(_0x7995('0x9'));var client=jayson[_0x7995('0xa')][_0x7995('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xbda126,_0x326741,_0x4996ca){return new BPromise(function(_0x465276,_0x1cad37){return client['request'](_0xbda126,_0x4996ca)[_0x7995('0xc')](function(_0x3116fb){logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));logger[_0x7995('0x10')](_0x7995('0x11'),_0x326741,'request\x20sent',JSON[_0x7995('0x12')](_0x3116fb));if(_0x3116fb[_0x7995('0x13')]){if(_0x3116fb['error'][_0x7995('0x14')]===0x1f4){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x1cad37(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}logger['error']('Network,\x20%s,\x20%s',_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x465276(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}else{logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));_0x465276(_0x3116fb[_0x7995('0x16')]['message']);}})[_0x7995('0x17')](function(_0x565d97){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x565d97);_0x1cad37(_0x565d97);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/index.js b/server/api/openchannelAccount/index.js index 474343a..feaf221 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 _0x0595=['/:id/send','send','put','/:id','destroy','delete','removeAnswers','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelAccount.controller','isAuthenticated','index','get','/describe','describe','show','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','/:id/interactions','getInteractions','/:id/users','getAgents','post','create','/:id/dispositions','addDisposition','addAnswer','/:id/notify','notify','addApplications','addAgents'];(function(_0x1ec6f2,_0x29c2ad){var _0xf8e955=function(_0x1aa948){while(--_0x1aa948){_0x1ec6f2['push'](_0x1ec6f2['shift']());}};_0xf8e955(++_0x29c2ad);}(_0x0595,0xda));var _0x5059=function(_0x4be8b3,_0x5e7a9e){_0x4be8b3=_0x4be8b3-0x0;var _0x43f4bd=_0x0595[_0x4be8b3];return _0x43f4bd;};'use strict';var multer=require(_0x5059('0x0'));var util=require(_0x5059('0x1'));var path=require(_0x5059('0x2'));var timeout=require(_0x5059('0x3'));var express=require('express');var router=express[_0x5059('0x4')]();var fs_extra=require(_0x5059('0x5'));var auth=require(_0x5059('0x6'));var interaction=require(_0x5059('0x7'));var config=require(_0x5059('0x8'));var controller=require(_0x5059('0x9'));router['get']('/',auth[_0x5059('0xa')](),controller[_0x5059('0xb')]);router[_0x5059('0xc')](_0x5059('0xd'),auth[_0x5059('0xa')](),controller[_0x5059('0xe')]);router['get']('/:id',auth[_0x5059('0xa')](),controller[_0x5059('0xf')]);router[_0x5059('0xc')]('/:id/dispositions',auth[_0x5059('0xa')](),controller[_0x5059('0x10')]);router[_0x5059('0xc')](_0x5059('0x11'),auth[_0x5059('0xa')](),controller[_0x5059('0x12')]);router[_0x5059('0xc')](_0x5059('0x13'),auth[_0x5059('0xa')](),controller[_0x5059('0x14')]);router['get'](_0x5059('0x15'),auth[_0x5059('0xa')](),controller[_0x5059('0x16')]);router[_0x5059('0xc')](_0x5059('0x17'),auth[_0x5059('0xa')](),controller[_0x5059('0x18')]);router[_0x5059('0x19')]('/',auth['isAuthenticated'](),controller[_0x5059('0x1a')]);router['post'](_0x5059('0x1b'),auth['isAuthenticated'](),controller[_0x5059('0x1c')]);router['post'](_0x5059('0x11'),auth[_0x5059('0xa')](),controller[_0x5059('0x1d')]);router[_0x5059('0x19')](_0x5059('0x1e'),controller[_0x5059('0x1f')]);router[_0x5059('0x19')](_0x5059('0x13'),auth['isAuthenticated'](),controller[_0x5059('0x20')]);router[_0x5059('0x19')](_0x5059('0x17'),auth['isAuthenticated'](),controller[_0x5059('0x21')]);router[_0x5059('0x19')](_0x5059('0x22'),auth[_0x5059('0xa')](),controller[_0x5059('0x23')]);router[_0x5059('0x24')](_0x5059('0x25'),auth[_0x5059('0xa')](),controller['update']);router['delete'](_0x5059('0x25'),auth[_0x5059('0xa')](),controller[_0x5059('0x26')]);router[_0x5059('0x27')](_0x5059('0x1b'),auth[_0x5059('0xa')](),controller['removeDispositions']);router[_0x5059('0x27')]('/:id/canned_answers',auth[_0x5059('0xa')](),controller[_0x5059('0x28')]);router['delete'](_0x5059('0x17'),auth[_0x5059('0xa')](),controller['removeAgents']);module[_0x5059('0x29')]=router; \ No newline at end of file +var _0x53b0=['describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','/:id/interactions','getAgents','post','create','addDisposition','addAnswer','/:id/notify','notify','addApplications','addAgents','/:id/send','send','put','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','multer','util','path','express','Router','../../components/interaction/service','./openchannelAccount.controller','isAuthenticated','get','/describe'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x53b0,0x8e));var _0x053b=function(_0x43533c,_0x4f1406){_0x43533c=_0x43533c-0x0;var _0x530f49=_0x53b0[_0x43533c];return _0x530f49;};'use strict';var multer=require(_0x053b('0x0'));var util=require(_0x053b('0x1'));var path=require(_0x053b('0x2'));var timeout=require('connect-timeout');var express=require(_0x053b('0x3'));var router=express[_0x053b('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x053b('0x5'));var config=require('../../config/environment');var controller=require(_0x053b('0x6'));router['get']('/',auth[_0x053b('0x7')](),controller['index']);router[_0x053b('0x8')](_0x053b('0x9'),auth[_0x053b('0x7')](),controller[_0x053b('0xa')]);router[_0x053b('0x8')](_0x053b('0xb'),auth[_0x053b('0x7')](),controller[_0x053b('0xc')]);router[_0x053b('0x8')](_0x053b('0xd'),auth['isAuthenticated'](),controller[_0x053b('0xe')]);router['get'](_0x053b('0xf'),auth[_0x053b('0x7')](),controller[_0x053b('0x10')]);router['get'](_0x053b('0x11'),auth[_0x053b('0x7')](),controller[_0x053b('0x12')]);router[_0x053b('0x8')](_0x053b('0x13'),auth['isAuthenticated'](),controller['getInteractions']);router[_0x053b('0x8')]('/:id/users',auth[_0x053b('0x7')](),controller[_0x053b('0x14')]);router[_0x053b('0x15')]('/',auth[_0x053b('0x7')](),controller[_0x053b('0x16')]);router[_0x053b('0x15')](_0x053b('0xd'),auth['isAuthenticated'](),controller[_0x053b('0x17')]);router[_0x053b('0x15')](_0x053b('0xf'),auth[_0x053b('0x7')](),controller[_0x053b('0x18')]);router[_0x053b('0x15')](_0x053b('0x19'),controller[_0x053b('0x1a')]);router[_0x053b('0x15')](_0x053b('0x11'),auth['isAuthenticated'](),controller[_0x053b('0x1b')]);router[_0x053b('0x15')]('/:id/users',auth[_0x053b('0x7')](),controller[_0x053b('0x1c')]);router[_0x053b('0x15')](_0x053b('0x1d'),auth[_0x053b('0x7')](),controller[_0x053b('0x1e')]);router[_0x053b('0x1f')](_0x053b('0xb'),auth[_0x053b('0x7')](),controller[_0x053b('0x20')]);router[_0x053b('0x21')]('/:id',auth[_0x053b('0x7')](),controller[_0x053b('0x22')]);router[_0x053b('0x21')]('/:id/dispositions',auth[_0x053b('0x7')](),controller[_0x053b('0x23')]);router[_0x053b('0x21')]('/:id/canned_answers',auth[_0x053b('0x7')](),controller[_0x053b('0x24')]);router[_0x053b('0x21')]('/:id/users',auth[_0x053b('0x7')](),controller[_0x053b('0x25')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.attributes.js b/server/api/openchannelAccount/openchannelAccount.attributes.js index bf82c2e..12cc838 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 _0xfb56=['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','sequelize','randomstring','name','STRING','generate'];(function(_0x434db2,_0x113541){var _0x4e9284=function(_0x5d59b4){while(--_0x5d59b4){_0x434db2['push'](_0x434db2['shift']());}};_0x4e9284(++_0x113541);}(_0xfb56,0x1bd));var _0x6fb5=function(_0x2d96f1,_0xa647e4){_0x2d96f1=_0x2d96f1-0x0;var _0x41a5b0=_0xfb56[_0x2d96f1];return _0x41a5b0;};'use strict';var Sequelize=require(_0x6fb5('0x0'));var rs=require(_0x6fb5('0x1'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x6fb5('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0x6fb5('0x3')]},'token':{'type':Sequelize[_0x6fb5('0x3')],'defaultValue':function(){return rs[_0x6fb5('0x4')]();}},'replyUri':{'type':Sequelize[_0x6fb5('0x3')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0x6fb5('0x3')],'allowNull':![]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x6fb5('0x5');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x6fb5('0x6')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x6fb5('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0x6fb5('0x3')]},'queueTransfer':{'type':Sequelize[_0x6fb5('0x6')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x6fb5('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x6fb5('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x6fb5('0x7')],'allowNull':!![],'defaultValue':null,'comment':_0x6fb5('0x8')},'mandatoryDisposition':{'type':Sequelize[_0x6fb5('0x6')],'defaultValue':![],'comment':_0x6fb5('0x9'),'set':function(_0x10ed6a){if(!_0x10ed6a)this['setDataValue']('mandatoryDispositionPauseId',null);this['setDataValue']('mandatoryDisposition',_0x10ed6a);}}}; \ No newline at end of file +var _0xcc6d=['sequelize','randomstring','exports','STRING','name','generate','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','setDataValue','mandatoryDisposition'];(function(_0x2e6744,_0x495160){var _0x20ef10=function(_0x5540d6){while(--_0x5540d6){_0x2e6744['push'](_0x2e6744['shift']());}};_0x20ef10(++_0x495160);}(_0xcc6d,0x118));var _0xdcc6=function(_0x3e6d1c,_0x196e1b){_0x3e6d1c=_0x3e6d1c-0x0;var _0x51f513=_0xcc6d[_0x3e6d1c];return _0x51f513;};'use strict';var Sequelize=require(_0xdcc6('0x0'));var rs=require(_0xdcc6('0x1'));module[_0xdcc6('0x2')]={'name':{'type':Sequelize[_0xdcc6('0x3')],'unique':_0xdcc6('0x4'),'allowNull':![]},'description':{'type':Sequelize[_0xdcc6('0x3')]},'token':{'type':Sequelize[_0xdcc6('0x3')],'defaultValue':function(){return rs[_0xdcc6('0x5')]();}},'replyUri':{'type':Sequelize[_0xdcc6('0x3')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0xdcc6('0x3')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xdcc6('0x6')],'defaultValue':function(){return _0xdcc6('0x7');}},'notificationSound':{'type':Sequelize[_0xdcc6('0x8')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xdcc6('0x8')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xdcc6('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0xdcc6('0x3')]},'queueTransfer':{'type':Sequelize[_0xdcc6('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xdcc6('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xdcc6('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xdcc6('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xdcc6('0x9')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0xdcc6('0x8')],'defaultValue':![],'comment':_0xdcc6('0xa'),'set':function(_0x3e6d33){if(!_0x3e6d33)this['setDataValue'](_0xdcc6('0xb'),null);this[_0xdcc6('0xc')](_0xdcc6('0xd'),_0x3e6d33);}}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index 50cd0c2..c9d6d47 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 _0xb336=['catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','OpenchannelAccounts','UserProfileSection','userProfileId','autoAssociation','describe','addDisposition','OpenchannelAccountId','Disposition','getDispositions','findOne','removeDispositions','ids','addAnswer','getAnswers','CannedAnswer','order','removeAnswers','notify','openchannel','CmContact','ValidationError','difference','createdAt','updatedAt','CompanyId','ListId','isNil','from','Sequelize','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','DESC','Applications','account','list','applications','orderBy','asc','Contacts','contact','firstName','lastName','threadId','OpenchannelInteraction','externalUrl','ContactId','spread','messageId','interaction','created','push','close','OpenchannelMessage','AttachmentId','User','unshift','agent','waitForTheAssignedAgent','*,*,*,*','startRouting','Start','EventManager','addApplications','transaction','OpenchannelApplication','bulkCreate','findAndCountAll','priority','getApplications','getInteractions','Contact','Owner','fullname','Tag','Tags','color','tag','addAgents','userOpenchannelAccount:save','removeAgents','isArray','emit','userOpenchannelAccount:remove','getAgents','out','dataValues','Messages','eml-format','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','./openchannelAccount.socket','jayson/promise','http','request','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','status','end','json','undefined','limit','offset','count','set','save','update','destroy','then','get','UserProfileResource','sendStatus','stack','name','send','index','map','OpenchannelAccount','type','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','include','findAll','rows','show','params','Pause','mandatoryDispositionPause','rawAttributes','fields','includeAll','find'];(function(_0x6cfdf6,_0x248972){var _0x18ffce=function(_0x386315){while(--_0x386315){_0x6cfdf6['push'](_0x6cfdf6['shift']());}};_0x18ffce(++_0x248972);}(_0xb336,0x1d1));var _0x6b33=function(_0x36d767,_0x90d8b8){_0x36d767=_0x36d767-0x0;var _0x91f50c=_0xb336[_0x36d767];return _0x91f50c;};'use strict';var emlformat=require(_0x6b33('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x6b33('0x1'));var moment=require(_0x6b33('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x6b33('0x3'));var util=require(_0x6b33('0x4'));var path=require(_0x6b33('0x5'));var sox=require('sox');var csv=require(_0x6b33('0x6'));var ejs=require(_0x6b33('0x7'));var fs=require('fs');var fs_extra=require(_0x6b33('0x8'));var _=require(_0x6b33('0x9'));var squel=require(_0x6b33('0xa'));var crypto=require(_0x6b33('0xb'));var jsforce=require(_0x6b33('0xc'));var deskjs=require(_0x6b33('0xd'));var toCsv=require(_0x6b33('0x6'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x6b33('0xe'));var authService=require(_0x6b33('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6b33('0x10'));var logger=require('../../config/logger')(_0x6b33('0x11'));var utils=require(_0x6b33('0x12'));var config=require(_0x6b33('0x13'));var licenseUtil=require(_0x6b33('0x14'));var db=require(_0x6b33('0x15'))['db'];config['redis']=_[_0x6b33('0x16')](config[_0x6b33('0x17')],{'host':_0x6b33('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6b33('0x17')]));require(_0x6b33('0x19'))['register'](socket);var jayson=require(_0x6b33('0x1a'));var client=jayson['client']['http']({'port':0x232c});var client9002=jayson['client'][_0x6b33('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x2c564a,_0x8ca04f,_0x2f9d66,_0x5b8608){return new BPromise(function(_0x182b09,_0x1c9701){var _0x147284=_0x5b8608||client;return _0x147284[_0x6b33('0x1c')](_0x2c564a,_0x2f9d66)['then'](function(_0x155448){logger[_0x6b33('0x1d')](_0x6b33('0x1e'),_0x8ca04f,_0x6b33('0x1f'));logger[_0x6b33('0x20')](_0x6b33('0x21'),_0x8ca04f,_0x6b33('0x1f'),JSON[_0x6b33('0x22')](_0x155448));if(_0x155448[_0x6b33('0x23')]){if(_0x155448[_0x6b33('0x23')]['code']===0x1f4){logger[_0x6b33('0x23')]('OpenchannelAccount,\x20%s,\x20%s',_0x8ca04f,_0x155448['error'][_0x6b33('0x24')]);return _0x1c9701(_0x155448[_0x6b33('0x23')][_0x6b33('0x24')]);}logger[_0x6b33('0x23')](_0x6b33('0x1e'),_0x8ca04f,_0x155448[_0x6b33('0x23')][_0x6b33('0x24')]);return _0x182b09(_0x155448[_0x6b33('0x23')]['message']);}else{logger['info'](_0x6b33('0x1e'),_0x8ca04f,_0x6b33('0x1f'));_0x182b09(_0x155448[_0x6b33('0x25')][_0x6b33('0x24')]);}})['catch'](function(_0x1e404e){logger['error']('OpenchannelAccount,\x20%s,\x20%s',_0x8ca04f,_0x1e404e);_0x1c9701(_0x1e404e);});});}function respondWithStatusCode(_0x2a943d,_0x3cd4c4){_0x3cd4c4=_0x3cd4c4||0xcc;return function(_0x903f49){if(_0x903f49){return _0x2a943d['sendStatus'](_0x3cd4c4);}return _0x2a943d[_0x6b33('0x26')](_0x3cd4c4)[_0x6b33('0x27')]();};}function respondWithResult(_0x581648,_0x2ecc66){_0x2ecc66=_0x2ecc66||0xc8;return function(_0x556d98){if(_0x556d98){return _0x581648[_0x6b33('0x26')](_0x2ecc66)[_0x6b33('0x28')](_0x556d98);}};}function respondWithFilteredResult(_0x1d5aef,_0x122df6){return function(_0x441dd8){if(_0x441dd8){var _0x464129=typeof _0x122df6['offset']===_0x6b33('0x29')&&typeof _0x122df6[_0x6b33('0x2a')]==='undefined';var _0x3d40ad=_0x441dd8['count'];var _0x156f23=_0x464129?0x0:_0x122df6[_0x6b33('0x2b')];var _0x5096e8=_0x464129?_0x441dd8[_0x6b33('0x2c')]:_0x122df6['offset']+_0x122df6['limit'];var _0x23cd76;if(_0x5096e8>=_0x3d40ad){_0x5096e8=_0x3d40ad;_0x23cd76=0xc8;}else{_0x23cd76=0xce;}_0x1d5aef[_0x6b33('0x26')](_0x23cd76);return _0x1d5aef[_0x6b33('0x2d')]('Content-Range',_0x156f23+'-'+_0x5096e8+'/'+_0x3d40ad)[_0x6b33('0x28')](_0x441dd8);}return null;};}function patchUpdates(_0x579ce6){return function(_0x4295cc){try{jsonpatch['apply'](_0x4295cc,_0x579ce6,!![]);}catch(_0x42c90c){return BPromise['reject'](_0x42c90c);}return _0x4295cc[_0x6b33('0x2e')]();};}function saveUpdates(_0x934f3c,_0x53a634){return function(_0x52f768){if(_0x52f768){return _0x52f768[_0x6b33('0x2f')](_0x934f3c)['then'](function(_0x5a1ec8){return _0x5a1ec8;});}return null;};}function removeEntity(_0x10f55d,_0x18ef6a){return function(_0x198808){if(_0x198808){return _0x198808[_0x6b33('0x30')]()[_0x6b33('0x31')](function(){var _0x9af0be=_0x198808[_0x6b33('0x32')]({'plain':!![]});var _0x17b281='OpenchannelAccounts';return db[_0x6b33('0x33')][_0x6b33('0x30')]({'where':{'type':_0x17b281,'resourceId':_0x9af0be['id']}})['then'](function(){return _0x198808;});})[_0x6b33('0x31')](function(){_0x10f55d[_0x6b33('0x26')](0xcc)[_0x6b33('0x27')]();});}};}function handleEntityNotFound(_0x145b47,_0x1ff3ed){return function(_0x27d1ca){if(!_0x27d1ca){_0x145b47[_0x6b33('0x34')](0x194);}return _0x27d1ca;};}function handleError(_0x35989b,_0x423634){_0x423634=_0x423634||0x1f4;return function(_0x320281){logger[_0x6b33('0x23')](_0x320281[_0x6b33('0x35')]);if(_0x320281[_0x6b33('0x36')]){delete _0x320281[_0x6b33('0x36')];}_0x35989b[_0x6b33('0x26')](_0x423634)[_0x6b33('0x37')](_0x320281);};}exports[_0x6b33('0x38')]=function(_0x192c3f,_0xaef810){var _0x2a2d9f={'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x2221b3={},_0x4354f7={'count':0x0,'rows':[]};var _0x479340=_[_0x6b33('0x39')](db[_0x6b33('0x3a')]['rawAttributes'],function(_0x1f6be9){return{'name':_0x1f6be9['fieldName'],'type':_0x1f6be9[_0x6b33('0x3b')][_0x6b33('0x3c')]};});_0x2221b3[_0x6b33('0x3d')]=_[_0x6b33('0x39')](_0x479340,'name');_0x2221b3[_0x6b33('0x3e')]=_[_0x6b33('0x3f')](_0x192c3f[_0x6b33('0x3e')]);_0x2221b3[_0x6b33('0x40')]=_['intersection'](_0x2221b3[_0x6b33('0x3d')],_0x2221b3[_0x6b33('0x3e')]);_0x2a2d9f['attributes']=_[_0x6b33('0x41')](_0x2221b3['model'],qs['fields'](_0x192c3f[_0x6b33('0x3e')]['fields']));_0x2a2d9f['attributes']=_0x2a2d9f[_0x6b33('0x42')][_0x6b33('0x43')]?_0x2a2d9f[_0x6b33('0x42')]:_0x2221b3[_0x6b33('0x3d')];if(!_0x192c3f[_0x6b33('0x3e')][_0x6b33('0x44')](_0x6b33('0x45'))){_0x2a2d9f[_0x6b33('0x2a')]=qs[_0x6b33('0x2a')](_0x192c3f[_0x6b33('0x3e')][_0x6b33('0x2a')]);_0x2a2d9f[_0x6b33('0x2b')]=qs[_0x6b33('0x2b')](_0x192c3f['query'][_0x6b33('0x2b')]);}_0x2a2d9f['order']=qs[_0x6b33('0x46')](_0x192c3f[_0x6b33('0x3e')][_0x6b33('0x46')]);_0x2a2d9f[_0x6b33('0x47')]=qs['filters'](_[_0x6b33('0x48')](_0x192c3f[_0x6b33('0x3e')],_0x2221b3['filters']),_0x479340);if(_0x192c3f[_0x6b33('0x3e')][_0x6b33('0x49')]){_0x2a2d9f[_0x6b33('0x47')]=_[_0x6b33('0x4a')](_0x2a2d9f[_0x6b33('0x47')],{'$or':_[_0x6b33('0x39')](_0x479340,function(_0x4f091b){if(_0x4f091b['type']!=='VIRTUAL'){var _0x60f4be={};_0x60f4be[_0x4f091b[_0x6b33('0x36')]]={'$like':'%'+_0x192c3f[_0x6b33('0x3e')][_0x6b33('0x49')]+'%'};return _0x60f4be;}})});}_0x2a2d9f=_[_0x6b33('0x4a')]({},_0x2a2d9f,_0x192c3f[_0x6b33('0x4b')]);var _0x148f0f={'where':_0x2a2d9f[_0x6b33('0x47')]};return db['OpenchannelAccount'][_0x6b33('0x2c')](_0x148f0f)[_0x6b33('0x31')](function(_0x2f3006){_0x4354f7['count']=_0x2f3006;if(_0x192c3f['query']['includeAll']){_0x2a2d9f[_0x6b33('0x4c')]=[{'all':!![]}];}return db[_0x6b33('0x3a')][_0x6b33('0x4d')](_0x2a2d9f);})[_0x6b33('0x31')](function(_0xa7fb24){_0x4354f7[_0x6b33('0x4e')]=_0xa7fb24;return _0x4354f7;})[_0x6b33('0x31')](respondWithFilteredResult(_0xaef810,_0x2a2d9f))['catch'](handleError(_0xaef810,null));};exports[_0x6b33('0x4f')]=function(_0x2488a3,_0x5d3176){var _0x3c9765={'raw':![],'where':{'id':_0x2488a3[_0x6b33('0x50')]['id']},'include':[{'model':db[_0x6b33('0x51')],'as':_0x6b33('0x52')}]},_0x4a425d={};_0x4a425d['model']=_['keys'](db[_0x6b33('0x3a')][_0x6b33('0x53')]);_0x4a425d['query']=_[_0x6b33('0x3f')](_0x2488a3[_0x6b33('0x3e')]);_0x4a425d[_0x6b33('0x40')]=_[_0x6b33('0x41')](_0x4a425d[_0x6b33('0x3d')],_0x4a425d['query']);_0x3c9765[_0x6b33('0x42')]=_[_0x6b33('0x41')](_0x4a425d[_0x6b33('0x3d')],qs[_0x6b33('0x54')](_0x2488a3[_0x6b33('0x3e')]['fields']));_0x3c9765[_0x6b33('0x42')]=_0x3c9765['attributes'][_0x6b33('0x43')]?_0x3c9765['attributes']:_0x4a425d['model'];if(_0x2488a3[_0x6b33('0x3e')][_0x6b33('0x55')]){_0x3c9765[_0x6b33('0x4c')]=[{'all':!![]}];}_0x3c9765=_['merge']({},_0x3c9765,_0x2488a3[_0x6b33('0x4b')]);return db[_0x6b33('0x3a')][_0x6b33('0x56')](_0x3c9765)['then'](handleEntityNotFound(_0x5d3176,null))[_0x6b33('0x31')](respondWithResult(_0x5d3176,null))[_0x6b33('0x57')](handleError(_0x5d3176,null));};exports[_0x6b33('0x58')]=function(_0x20710b,_0x2a250a){return db[_0x6b33('0x3a')]['create'](_0x20710b[_0x6b33('0x59')],{})['then'](function(_0x2dd5b1){var _0x49356f=_0x20710b['user'][_0x6b33('0x32')]({'plain':!![]});if(!_0x49356f)throw new Error(_0x6b33('0x5a'));if(_0x49356f['role']===_0x6b33('0x5b')){var _0x14fba2=_0x2dd5b1[_0x6b33('0x32')]({'plain':!![]});var _0x3a096e=_0x6b33('0x5c');return db[_0x6b33('0x5d')][_0x6b33('0x56')]({'where':{'name':_0x3a096e,'userProfileId':_0x49356f[_0x6b33('0x5e')]},'raw':!![]})[_0x6b33('0x31')](function(_0x52ead4){if(_0x52ead4&&_0x52ead4[_0x6b33('0x5f')]===0x0){return db[_0x6b33('0x33')][_0x6b33('0x58')]({'name':_0x14fba2[_0x6b33('0x36')],'resourceId':_0x14fba2['id'],'type':_0x52ead4[_0x6b33('0x36')],'sectionId':_0x52ead4['id']},{})[_0x6b33('0x31')](function(){return _0x2dd5b1;});}else{return _0x2dd5b1;}})[_0x6b33('0x57')](function(_0x1e50fd){logger[_0x6b33('0x23')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1e50fd);throw _0x1e50fd;});}return _0x2dd5b1;})[_0x6b33('0x31')](respondWithResult(_0x2a250a,0xc9))[_0x6b33('0x57')](handleError(_0x2a250a,null));};exports[_0x6b33('0x2f')]=function(_0x548f28,_0x5e4e82){if(_0x548f28[_0x6b33('0x59')]['id']){delete _0x548f28[_0x6b33('0x59')]['id'];}return db[_0x6b33('0x3a')]['find']({'where':{'id':_0x548f28['params']['id']},'include':[{'model':db[_0x6b33('0x51')],'as':_0x6b33('0x52')}]})['then'](handleEntityNotFound(_0x5e4e82,null))[_0x6b33('0x31')](saveUpdates(_0x548f28['body'],null))[_0x6b33('0x31')](respondWithResult(_0x5e4e82,null))[_0x6b33('0x57')](handleError(_0x5e4e82,null));};exports[_0x6b33('0x30')]=function(_0x3ca5d9,_0xeeed1c){return db[_0x6b33('0x3a')][_0x6b33('0x56')]({'where':{'id':_0x3ca5d9[_0x6b33('0x50')]['id']}})[_0x6b33('0x31')](handleEntityNotFound(_0xeeed1c,null))[_0x6b33('0x31')](removeEntity(_0xeeed1c,null))[_0x6b33('0x57')](handleError(_0xeeed1c,null));};exports[_0x6b33('0x60')]=function(_0x1c20cc,_0x5a3a5b){return db[_0x6b33('0x3a')]['describe']()['then'](respondWithResult(_0x5a3a5b,null))['catch'](handleError(_0x5a3a5b,null));};exports[_0x6b33('0x61')]=function(_0x4ca91d,_0x252c52,_0x20a5fb){if(_0x4ca91d[_0x6b33('0x59')]['id']){delete _0x4ca91d[_0x6b33('0x59')]['id'];}return db[_0x6b33('0x3a')][_0x6b33('0x56')]({'where':{'id':_0x4ca91d['params']['id']}})[_0x6b33('0x31')](handleEntityNotFound(_0x252c52,null))[_0x6b33('0x31')](function(_0x454b75){if(_0x454b75){_0x4ca91d[_0x6b33('0x59')][_0x6b33('0x62')]=_0x454b75['id'];return db[_0x6b33('0x63')][_0x6b33('0x58')](_0x4ca91d[_0x6b33('0x59')]);}})['then'](respondWithResult(_0x252c52,null))[_0x6b33('0x57')](handleError(_0x252c52,null));};exports[_0x6b33('0x64')]=function(_0x57baf3,_0x460742,_0x277235){var _0x2e2eb7={'raw':![],'where':{}};var _0x147b1f={};var _0x1af6b3={'count':0x0,'rows':[]};return db[_0x6b33('0x3a')][_0x6b33('0x65')]({'where':{'id':_0x57baf3['params']['id']}})[_0x6b33('0x31')](handleEntityNotFound(_0x460742,null))[_0x6b33('0x31')](function(_0x25a9c0){if(_0x25a9c0){_0x147b1f[_0x6b33('0x3d')]=_[_0x6b33('0x3f')](db[_0x6b33('0x63')]['rawAttributes']);_0x147b1f[_0x6b33('0x3e')]=_[_0x6b33('0x3f')](_0x57baf3['query']);_0x147b1f[_0x6b33('0x40')]=_[_0x6b33('0x41')](_0x147b1f['model'],_0x147b1f[_0x6b33('0x3e')]);_0x2e2eb7[_0x6b33('0x42')]=_[_0x6b33('0x41')](_0x147b1f[_0x6b33('0x3d')],qs[_0x6b33('0x54')](_0x57baf3[_0x6b33('0x3e')][_0x6b33('0x54')]));_0x2e2eb7['attributes']=_0x2e2eb7[_0x6b33('0x42')][_0x6b33('0x43')]?_0x2e2eb7['attributes']:_0x147b1f[_0x6b33('0x3d')];if(!_0x57baf3[_0x6b33('0x3e')][_0x6b33('0x44')](_0x6b33('0x45'))){_0x2e2eb7[_0x6b33('0x2a')]=qs[_0x6b33('0x2a')](_0x57baf3[_0x6b33('0x3e')][_0x6b33('0x2a')]);_0x2e2eb7[_0x6b33('0x2b')]=qs[_0x6b33('0x2b')](_0x57baf3['query'][_0x6b33('0x2b')]);}_0x2e2eb7['order']=qs[_0x6b33('0x46')](_0x57baf3[_0x6b33('0x3e')][_0x6b33('0x46')]);_0x2e2eb7['where']=qs[_0x6b33('0x40')](_[_0x6b33('0x48')](_0x57baf3[_0x6b33('0x3e')],_0x147b1f[_0x6b33('0x40')]));_0x2e2eb7[_0x6b33('0x47')]['OpenchannelAccountId']=_0x25a9c0['id'];if(_0x57baf3[_0x6b33('0x3e')]['filter']){_0x2e2eb7[_0x6b33('0x47')]=_['merge'](_0x2e2eb7[_0x6b33('0x47')],{'$or':_[_0x6b33('0x39')](_0x2e2eb7[_0x6b33('0x42')],function(_0x414b23){var _0x194387={};_0x194387[_0x414b23]={'$like':'%'+_0x57baf3[_0x6b33('0x3e')][_0x6b33('0x49')]+'%'};return _0x194387;})});}_0x2e2eb7=_[_0x6b33('0x4a')]({},_0x2e2eb7,_0x57baf3['options']);return db[_0x6b33('0x63')][_0x6b33('0x2c')]({'where':_0x2e2eb7[_0x6b33('0x47')]})[_0x6b33('0x31')](function(_0x4b449f){_0x1af6b3['count']=_0x4b449f;if(_0x57baf3['query'][_0x6b33('0x55')]){_0x2e2eb7['include']=[{'all':!![]}];}return db['Disposition'][_0x6b33('0x4d')](_0x2e2eb7);})[_0x6b33('0x31')](function(_0x43b9fd){_0x1af6b3['rows']=_0x43b9fd;return _0x1af6b3;});}})[_0x6b33('0x31')](respondWithFilteredResult(_0x460742,_0x2e2eb7))[_0x6b33('0x57')](handleError(_0x460742,null));};exports[_0x6b33('0x66')]=function(_0xd3ed5d,_0x48967d,_0x1d315a){return db[_0x6b33('0x3a')][_0x6b33('0x56')]({'where':{'id':_0xd3ed5d[_0x6b33('0x50')]['id']}})[_0x6b33('0x31')](handleEntityNotFound(_0x48967d,null))[_0x6b33('0x31')](function(_0x289ed6){if(_0x289ed6){return _0x289ed6[_0x6b33('0x66')](_0xd3ed5d['query'][_0x6b33('0x67')]);}})['then'](respondWithStatusCode(_0x48967d,null))[_0x6b33('0x57')](handleError(_0x48967d,null));};exports[_0x6b33('0x68')]=function(_0x2a86c5,_0x228e74,_0x30c0ae){if(_0x2a86c5[_0x6b33('0x59')]['id']){delete _0x2a86c5[_0x6b33('0x59')]['id'];}return db[_0x6b33('0x3a')][_0x6b33('0x56')]({'where':{'id':_0x2a86c5[_0x6b33('0x50')]['id']}})['then'](handleEntityNotFound(_0x228e74,null))[_0x6b33('0x31')](function(_0x4d6993){if(_0x4d6993){_0x2a86c5[_0x6b33('0x59')][_0x6b33('0x62')]=_0x4d6993['id'];return db['CannedAnswer'][_0x6b33('0x58')](_0x2a86c5[_0x6b33('0x59')]);}})[_0x6b33('0x31')](respondWithResult(_0x228e74,null))[_0x6b33('0x57')](handleError(_0x228e74,null));};exports[_0x6b33('0x69')]=function(_0x143ae8,_0x5ac75d,_0x415498){var _0x3ba231={'raw':![],'where':{}};var _0x52d3d5={};var _0x3ad278={'count':0x0,'rows':[]};return db[_0x6b33('0x3a')][_0x6b33('0x65')]({'where':{'id':_0x143ae8[_0x6b33('0x50')]['id']}})[_0x6b33('0x31')](handleEntityNotFound(_0x5ac75d,null))[_0x6b33('0x31')](function(_0x2ffde9){if(_0x2ffde9){_0x52d3d5['model']=_[_0x6b33('0x3f')](db[_0x6b33('0x6a')]['rawAttributes']);_0x52d3d5[_0x6b33('0x3e')]=_[_0x6b33('0x3f')](_0x143ae8['query']);_0x52d3d5[_0x6b33('0x40')]=_['intersection'](_0x52d3d5[_0x6b33('0x3d')],_0x52d3d5[_0x6b33('0x3e')]);_0x3ba231[_0x6b33('0x42')]=_[_0x6b33('0x41')](_0x52d3d5[_0x6b33('0x3d')],qs[_0x6b33('0x54')](_0x143ae8['query'][_0x6b33('0x54')]));_0x3ba231[_0x6b33('0x42')]=_0x3ba231[_0x6b33('0x42')][_0x6b33('0x43')]?_0x3ba231[_0x6b33('0x42')]:_0x52d3d5[_0x6b33('0x3d')];if(!_0x143ae8[_0x6b33('0x3e')][_0x6b33('0x44')](_0x6b33('0x45'))){_0x3ba231[_0x6b33('0x2a')]=qs[_0x6b33('0x2a')](_0x143ae8['query'][_0x6b33('0x2a')]);_0x3ba231[_0x6b33('0x2b')]=qs[_0x6b33('0x2b')](_0x143ae8['query'][_0x6b33('0x2b')]);}_0x3ba231[_0x6b33('0x6b')]=qs[_0x6b33('0x46')](_0x143ae8[_0x6b33('0x3e')][_0x6b33('0x46')]);_0x3ba231['where']=qs[_0x6b33('0x40')](_[_0x6b33('0x48')](_0x143ae8[_0x6b33('0x3e')],_0x52d3d5[_0x6b33('0x40')]));_0x3ba231[_0x6b33('0x47')][_0x6b33('0x62')]=_0x2ffde9['id'];if(_0x143ae8[_0x6b33('0x3e')]['filter']){_0x3ba231['where']=_[_0x6b33('0x4a')](_0x3ba231[_0x6b33('0x47')],{'$or':_['map'](_0x3ba231[_0x6b33('0x42')],function(_0x75c99c){var _0x1d6bfd={};_0x1d6bfd[_0x75c99c]={'$like':'%'+_0x143ae8[_0x6b33('0x3e')]['filter']+'%'};return _0x1d6bfd;})});}_0x3ba231=_[_0x6b33('0x4a')]({},_0x3ba231,_0x143ae8[_0x6b33('0x4b')]);return db[_0x6b33('0x6a')][_0x6b33('0x2c')]({'where':_0x3ba231[_0x6b33('0x47')]})[_0x6b33('0x31')](function(_0x4f625a){_0x3ad278['count']=_0x4f625a;if(_0x143ae8[_0x6b33('0x3e')]['includeAll']){_0x3ba231[_0x6b33('0x4c')]=[{'all':!![]}];}return db['CannedAnswer']['findAll'](_0x3ba231);})[_0x6b33('0x31')](function(_0x16fc92){_0x3ad278[_0x6b33('0x4e')]=_0x16fc92;return _0x3ad278;});}})[_0x6b33('0x31')](respondWithFilteredResult(_0x5ac75d,_0x3ba231))[_0x6b33('0x57')](handleError(_0x5ac75d,null));};exports[_0x6b33('0x6c')]=function(_0xd70186,_0x40aebe,_0x1b4851){return db[_0x6b33('0x3a')]['find']({'where':{'id':_0xd70186[_0x6b33('0x50')]['id']}})[_0x6b33('0x31')](handleEntityNotFound(_0x40aebe,null))[_0x6b33('0x31')](function(_0x72146b){if(_0x72146b){return _0x72146b['removeAnswers'](_0xd70186[_0x6b33('0x3e')]['ids']);}})[_0x6b33('0x31')](respondWithStatusCode(_0x40aebe,null))[_0x6b33('0x57')](handleError(_0x40aebe,null));};exports[_0x6b33('0x6d')]=function(_0x61d6dc,_0x3c1f71,_0x46369c){var _0x36d09a={'body':_0x61d6dc[_0x6b33('0x59')],'channel':_0x6b33('0x6e')};var _0x1234e4=[];var _0x5af386=[];var _0x4034b7={};var _0x53604f=![];return db[_0x6b33('0x6f')][_0x6b33('0x60')]()[_0x6b33('0x31')](function(_0x20cefe){if(!_0x20cefe){throw new db['Sequelize'][(_0x6b33('0x70'))]('no\x20available\x20attributes');}_0x1234e4=_[_0x6b33('0x71')](_[_0x6b33('0x3f')](_0x20cefe),[_0x6b33('0x72'),_0x6b33('0x73')]);_0x5af386=_[_0x6b33('0x71')](_[_0x6b33('0x3f')](_0x20cefe),[_0x6b33('0x72'),_0x6b33('0x73'),_0x6b33('0x74'),_0x6b33('0x75')]);if(_0x61d6dc[_0x6b33('0x59')]['id']){delete _0x61d6dc[_0x6b33('0x59')]['id'];}if(_[_0x6b33('0x76')](_0x61d6dc[_0x6b33('0x59')][_0x6b33('0x77')])){throw new db[(_0x6b33('0x78'))][(_0x6b33('0x70'))](_0x6b33('0x79'));}if(_[_0x6b33('0x76')](_0x61d6dc[_0x6b33('0x59')][_0x6b33('0x59')])||_0x61d6dc[_0x6b33('0x59')][_0x6b33('0x59')]===''){throw new db[(_0x6b33('0x78'))][(_0x6b33('0x70'))](_0x6b33('0x7a'));}if(_[_0x6b33('0x76')](_0x61d6dc[_0x6b33('0x59')][_0x6b33('0x7b')])){throw new db['Sequelize']['ValidationError'](_0x6b33('0x7c')+_0x5af386);}if(!_['includes'](_0x5af386,_0x61d6dc[_0x6b33('0x59')][_0x6b33('0x7b')])){throw new db[(_0x6b33('0x78'))][(_0x6b33('0x70'))](_0x6b33('0x7d')+_0x5af386);}_0x4034b7[_0x61d6dc[_0x6b33('0x59')][_0x6b33('0x7b')]]=_0x61d6dc[_0x6b33('0x59')][_0x6b33('0x77')];})[_0x6b33('0x31')](function(){return db[_0x6b33('0x3a')][_0x6b33('0x56')]({'where':{'id':_0x61d6dc[_0x6b33('0x50')]['id']},'include':[{'model':db[_0x6b33('0x7e')],'as':_0x6b33('0x7f'),'include':[{'model':db[_0x6b33('0x6f')],'as':'Contacts','where':_0x4034b7,'limit':0x1,'order':[[_0x6b33('0x73'),_0x6b33('0x80')]]}]},{'model':db['OpenchannelApplication'],'as':_0x6b33('0x81')}]});})[_0x6b33('0x31')](handleEntityNotFound(_0x3c1f71,null))['then'](function(_0x136f33){if(_0x136f33&&_0x136f33[_0x6b33('0x7f')]){_0x36d09a[_0x6b33('0x82')]=_0x136f33;_0x36d09a['applications']=_0x136f33[_0x6b33('0x81')];_0x36d09a[_0x6b33('0x83')]=_0x136f33[_0x6b33('0x7f')];_0x36d09a[_0x6b33('0x84')]=_[_0x6b33('0x85')](_0x36d09a[_0x6b33('0x84')],['priority'],[_0x6b33('0x86')]);if(_0x36d09a['account']['Applications']){delete _0x36d09a['account'][_0x6b33('0x81')];}if(_0x36d09a[_0x6b33('0x82')]['List']&&_0x36d09a['account'][_0x6b33('0x7f')]['Contacts'][_0x6b33('0x43')]){return _0x36d09a[_0x6b33('0x82')]['List'][_0x6b33('0x87')][0x0];}var _0x183a6e=_[_0x6b33('0x16')](_0x61d6dc[_0x6b33('0x59')],{'firstName':_0x61d6dc['body']['from'],'ListId':_0x136f33[_0x6b33('0x75')]});_0x183a6e[_0x61d6dc[_0x6b33('0x59')]['mapKey']]=_0x61d6dc['body'][_0x6b33('0x77')];return db[_0x6b33('0x6f')][_0x6b33('0x58')](_0x183a6e,{'fields':_0x1234e4,'raw':!![]});}})[_0x6b33('0x31')](handleEntityNotFound(_0x3c1f71,null))['then'](function(_0x43e61a){_0x36d09a[_0x6b33('0x88')]=_0x43e61a;if(_0x43e61a){var _0x21ad1b={'ContactId':_0x43e61a['id'],'OpenchannelAccountId':_0x61d6dc[_0x6b33('0x50')]['id'],'from':(_0x43e61a[_0x6b33('0x89')]||'')+'\x20'+(_0x43e61a[_0x6b33('0x8a')]||'')};var _0x56160c={'OpenchannelAccountId':_0x61d6dc[_0x6b33('0x50')]['id'],'closed':![]};if(_0x61d6dc[_0x6b33('0x59')]['threadId']){_0x56160c[_0x6b33('0x8b')]=_0x61d6dc['body']['threadId'];return db[_0x6b33('0x8c')][_0x6b33('0x56')]({'where':_0x56160c})[_0x6b33('0x31')](function(_0x11d580){if(_0x11d580){return[_0x11d580,![]];}_0x21ad1b[_0x6b33('0x8b')]=_0x61d6dc['body']['threadId'];_0x21ad1b[_0x6b33('0x8d')]=_0x61d6dc['body'][_0x6b33('0x8d')];return db[_0x6b33('0x8c')][_0x6b33('0x58')](_0x21ad1b)[_0x6b33('0x31')](function(_0x11b76f){return[_0x11b76f,!![]];});});}else{_0x56160c[_0x6b33('0x8b')]=null;}_0x56160c[_0x6b33('0x8e')]=_0x43e61a['id'];return db[_0x6b33('0x8c')][_0x6b33('0x56')]({'where':_0x56160c})[_0x6b33('0x31')](function(_0x591e36){if(_0x591e36){return[_0x591e36,![]];}return db['OpenchannelInteraction']['create'](_0x21ad1b)['then'](function(_0x490db5){return[_0x490db5,!![]];});});}})[_0x6b33('0x8f')](function(_0x631558,_0x2b9a13){if(_0x631558){_0x53604f=_0x2b9a13;if(!_0x2b9a13){var _0x28a27f={'from':(_0x36d09a[_0x6b33('0x88')]['firstName']||'')+'\x20'+(_0x36d09a[_0x6b33('0x88')]['lastName']||'')};if(_0x61d6dc[_0x6b33('0x59')][_0x6b33('0x8b')]&&_0x61d6dc['body'][_0x6b33('0x90')]&&_0x61d6dc['body']['threadId']!=_0x61d6dc[_0x6b33('0x59')][_0x6b33('0x90')]){_0x28a27f['threadId']=_0x61d6dc['body'][_0x6b33('0x90')];}return _0x631558[_0x6b33('0x2f')](_0x28a27f);}else{return _0x631558;}}})[_0x6b33('0x31')](function(_0x540c81){_0x36d09a[_0x6b33('0x91')]=_0x540c81[_0x6b33('0x32')]({'plain':!![]});_0x36d09a[_0x6b33('0x91')][_0x6b33('0x92')]=_0x53604f;if(_0x36d09a['interaction']['created']){if(_0x36d09a[_0x6b33('0x82')]['autoclose']){_0x36d09a['applications'][_0x6b33('0x93')]({'id':0x0,'priority':_0x36d09a[_0x6b33('0x84')][_0x6b33('0x43')]+0x1,'app':_0x6b33('0x94'),'appdata':'unmanaged','interval':'*,*,*,*'});}}return db[_0x6b33('0x95')][_0x6b33('0x58')]({'body':_0x61d6dc[_0x6b33('0x59')][_0x6b33('0x59')],'OpenchannelAccountId':_0x61d6dc[_0x6b33('0x50')]['id'],'OpenchannelInteractionId':_0x540c81['id'],'direction':'in','ContactId':_0x36d09a['contact']['id'],'AttachmentId':_0x61d6dc[_0x6b33('0x59')][_0x6b33('0x96')]});})[_0x6b33('0x31')](function(_0x2ae6d3){_0x36d09a[_0x6b33('0x24')]=_0x2ae6d3;if(_0x36d09a['interaction']['UserId']){return db[_0x6b33('0x97')]['find']({'attributes':['id',_0x6b33('0x36')],'where':{'id':_0x36d09a[_0x6b33('0x91')]['UserId']}})[_0x6b33('0x31')](function(_0xe9e156){if(_0xe9e156){_0x36d09a[_0x6b33('0x84')][_0x6b33('0x98')]({'id':0x0,'priority':0x0,'app':_0x6b33('0x99'),'appdata':_0xe9e156[_0x6b33('0x36')]+','+(_0x36d09a[_0x6b33('0x82')][_0x6b33('0x9a')]||0xa),'interval':_0x6b33('0x9b')});_0x36d09a['forcedOwnership']=![];}return respondWithRpcPromise('Start',_0x6b33('0x9c'),_0x36d09a);});}return respondWithRpcPromise(_0x6b33('0x9d'),_0x6b33('0x9c'),_0x36d09a);})[_0x6b33('0x31')](function(_0x226775){respondWithRpcPromise(_0x6b33('0x9e'),_0x6b33('0x9e'),{'event':_0x6b33('0x6d'),'message':_0x226775},client9002);return _0x226775;})[_0x6b33('0x31')](respondWithResult(_0x3c1f71,null))[_0x6b33('0x57')](handleError(_0x3c1f71,null));};exports[_0x6b33('0x9f')]=function(_0x3bf8be,_0x5d784b,_0x1685ea){return db[_0x6b33('0x3a')][_0x6b33('0x65')]({'where':{'id':_0x3bf8be[_0x6b33('0x50')]['id']}})[_0x6b33('0x31')](handleEntityNotFound(_0x5d784b,null))[_0x6b33('0x31')](function(_0x450a58){if(_0x450a58){return db['sequelize'][_0x6b33('0xa0')](function(_0x1313f5){return db['OpenchannelApplication'][_0x6b33('0x30')]({'where':{'OpenchannelAccountId':_0x3bf8be['params']['id']},'transaction':_0x1313f5})['then'](function(_0x150427){var _0x456ba4=_[_0x6b33('0x39')](_0x3bf8be[_0x6b33('0x59')],function(_0xac38f1){_0xac38f1[_0x6b33('0x62')]=_0x3bf8be[_0x6b33('0x50')]['id'];return _0xac38f1;});return db[_0x6b33('0xa1')][_0x6b33('0xa2')](_0x456ba4,{'transaction':_0x1313f5});});})[_0x6b33('0x31')](function(){return db['OpenchannelApplication'][_0x6b33('0xa3')]({'where':{'OpenchannelAccountId':_0x3bf8be['params']['id']},'order':_0x6b33('0xa4')});});}})[_0x6b33('0x31')](respondWithResult(_0x5d784b,null))[_0x6b33('0x57')](handleError(_0x5d784b,null));};exports['getApplications']=function(_0x855d66,_0x86f218,_0x4bc45b){var _0x13c2f8={};var _0x254311={};var _0x362f7c;var _0x16179b;return db[_0x6b33('0x3a')][_0x6b33('0x65')]({'where':{'id':_0x855d66[_0x6b33('0x50')]['id']}})['then'](handleEntityNotFound(_0x86f218,null))['then'](function(_0x7e2dae){if(_0x7e2dae){_0x362f7c=_0x7e2dae;_0x254311['model']=_[_0x6b33('0x3f')](db[_0x6b33('0xa1')][_0x6b33('0x53')]);_0x254311[_0x6b33('0x3e')]=_[_0x6b33('0x3f')](_0x855d66[_0x6b33('0x3e')]);_0x254311[_0x6b33('0x40')]=_[_0x6b33('0x41')](_0x254311[_0x6b33('0x3d')],_0x254311['query']);_0x13c2f8[_0x6b33('0x42')]=_[_0x6b33('0x41')](_0x254311['model'],qs[_0x6b33('0x54')](_0x855d66[_0x6b33('0x3e')][_0x6b33('0x54')]));_0x13c2f8[_0x6b33('0x42')]=_0x13c2f8[_0x6b33('0x42')][_0x6b33('0x43')]?_0x13c2f8[_0x6b33('0x42')]:_0x254311[_0x6b33('0x3d')];_0x13c2f8['order']=qs[_0x6b33('0x46')](_0x855d66[_0x6b33('0x3e')][_0x6b33('0x46')]);_0x13c2f8[_0x6b33('0x47')]=qs[_0x6b33('0x40')](_['pick'](_0x855d66[_0x6b33('0x3e')],_0x254311[_0x6b33('0x40')]));if(_0x855d66['query'][_0x6b33('0x49')]){_0x13c2f8[_0x6b33('0x47')]=_[_0x6b33('0x4a')](_0x13c2f8[_0x6b33('0x47')],{'$or':_[_0x6b33('0x39')](_0x13c2f8[_0x6b33('0x42')],function(_0x44555a){var _0x31fd46={};_0x31fd46[_0x44555a]={'$like':'%'+_0x855d66[_0x6b33('0x3e')][_0x6b33('0x49')]+'%'};return _0x31fd46;})});}_0x13c2f8=_[_0x6b33('0x4a')]({},_0x13c2f8,_0x855d66[_0x6b33('0x4b')]);return _0x362f7c[_0x6b33('0xa5')](_0x13c2f8);}})[_0x6b33('0x31')](function(_0x40bda2){if(_0x40bda2){_0x16179b=_0x40bda2['length'];if(!_0x855d66[_0x6b33('0x3e')][_0x6b33('0x44')](_0x6b33('0x45'))){_0x13c2f8[_0x6b33('0x2a')]=qs[_0x6b33('0x2a')](_0x855d66[_0x6b33('0x3e')][_0x6b33('0x2a')]);_0x13c2f8[_0x6b33('0x2b')]=qs[_0x6b33('0x2b')](_0x855d66[_0x6b33('0x3e')]['offset']);}return _0x362f7c[_0x6b33('0xa5')](_0x13c2f8);}})[_0x6b33('0x31')](function(_0x18a5bc){if(_0x18a5bc){return _0x18a5bc?{'count':_0x16179b,'rows':_0x18a5bc}:null;}})['then'](respondWithResult(_0x86f218,null))['catch'](handleError(_0x86f218,null));};exports[_0x6b33('0xa6')]=function(_0x117068,_0x1ca2c2,_0x395688){var _0x14ac9c={'raw':![],'where':{}};var _0x47b0ab={};var _0x37a538={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0x6b33('0x65')]({'where':{'id':_0x117068[_0x6b33('0x50')]['id']}})['then'](handleEntityNotFound(_0x1ca2c2,null))[_0x6b33('0x31')](function(_0x3506a9){if(_0x3506a9){_0x47b0ab[_0x6b33('0x3d')]=_[_0x6b33('0x3f')](db[_0x6b33('0x8c')][_0x6b33('0x53')]);_0x47b0ab['query']=_[_0x6b33('0x3f')](_0x117068[_0x6b33('0x3e')]);_0x47b0ab[_0x6b33('0x40')]=_[_0x6b33('0x41')](_0x47b0ab[_0x6b33('0x3d')],_0x47b0ab[_0x6b33('0x3e')]);_0x14ac9c[_0x6b33('0x42')]=_['intersection'](_0x47b0ab['model'],qs[_0x6b33('0x54')](_0x117068[_0x6b33('0x3e')][_0x6b33('0x54')]));_0x14ac9c[_0x6b33('0x42')]=_0x14ac9c[_0x6b33('0x42')][_0x6b33('0x43')]?_0x14ac9c[_0x6b33('0x42')]:_0x47b0ab['model'];if(!_0x117068['query'][_0x6b33('0x44')]('nolimit')){_0x14ac9c[_0x6b33('0x2a')]=qs[_0x6b33('0x2a')](_0x117068['query'][_0x6b33('0x2a')]);_0x14ac9c[_0x6b33('0x2b')]=qs[_0x6b33('0x2b')](_0x117068['query']['offset']);}_0x14ac9c['order']=qs[_0x6b33('0x46')](_0x117068[_0x6b33('0x3e')][_0x6b33('0x46')]);_0x14ac9c[_0x6b33('0x47')]=qs[_0x6b33('0x40')](_[_0x6b33('0x48')](_0x117068[_0x6b33('0x3e')],_0x47b0ab['filters']));_0x14ac9c[_0x6b33('0x47')]['OpenchannelAccountId']=_0x3506a9['id'];if(_0x117068['query'][_0x6b33('0x49')]){_0x14ac9c[_0x6b33('0x47')]=_[_0x6b33('0x4a')](_0x14ac9c[_0x6b33('0x47')],{'$or':_[_0x6b33('0x39')](_0x14ac9c[_0x6b33('0x42')],function(_0x4c58bd){var _0x3d4949={};_0x3d4949[_0x4c58bd]={'$like':'%'+_0x117068['query'][_0x6b33('0x49')]+'%'};return _0x3d4949;})});}_0x14ac9c=_['merge']({},_0x14ac9c,_0x117068[_0x6b33('0x4b')]);return db[_0x6b33('0x8c')][_0x6b33('0x2c')]({'where':_0x14ac9c[_0x6b33('0x47')]})[_0x6b33('0x31')](function(_0x165494){_0x37a538[_0x6b33('0x2c')]=_0x165494;if(_0x117068['query']['includeAll']){_0x14ac9c['include']=[{'model':db[_0x6b33('0x6f')],'as':_0x6b33('0xa7'),'required':![]},{'model':db[_0x6b33('0x97')],'as':_0x6b33('0xa8'),'attributes':[_0x6b33('0x36'),_0x6b33('0xa9'),'internal'],'required':![]},{'model':db[_0x6b33('0xaa')],'as':_0x6b33('0xab'),'attributes':['id','name',_0x6b33('0xac')],'where':_0x117068['query'][_0x6b33('0xad')]?{'id':_0x117068[_0x6b33('0x3e')][_0x6b33('0xad')]}:undefined,'required':_0x117068[_0x6b33('0x3e')][_0x6b33('0xad')]?!![]:![]}];}return db[_0x6b33('0x8c')][_0x6b33('0x4d')](_0x14ac9c);})['then'](function(_0x53f3fe){_0x37a538[_0x6b33('0x4e')]=_0x53f3fe;return _0x37a538;});}})[_0x6b33('0x31')](respondWithFilteredResult(_0x1ca2c2,_0x14ac9c))[_0x6b33('0x57')](handleError(_0x1ca2c2,null));};exports['addAgents']=function(_0x53b4e9,_0x1694db,_0x594a2b){return db[_0x6b33('0x3a')][_0x6b33('0x56')]({'where':{'id':_0x53b4e9[_0x6b33('0x50')]['id']}})[_0x6b33('0x31')](handleEntityNotFound(_0x1694db,null))[_0x6b33('0x31')](function(_0x55de92){if(_0x55de92){return _0x55de92[_0x6b33('0xae')](_0x53b4e9['body'][_0x6b33('0x67')],_['omit'](_0x53b4e9[_0x6b33('0x59')],[_0x6b33('0x67'),'id'])||{})[_0x6b33('0x8f')](function(_0x1fd72f){for(var _0x44bd1f=0x0;_0x44bd1f<_0x53b4e9['body'][_0x6b33('0x67')][_0x6b33('0x43')];_0x44bd1f+=0x1){socket['emit'](_0x6b33('0xaf'),{'UserId':Number(_0x53b4e9[_0x6b33('0x59')]['ids'][_0x44bd1f]),'OpenchannelAccountId':Number(_0x53b4e9[_0x6b33('0x50')]['id'])});}return _0x1fd72f;});}})[_0x6b33('0x31')](respondWithResult(_0x1694db,null))[_0x6b33('0x57')](handleError(_0x1694db,null));};exports[_0x6b33('0xb0')]=function(_0x2bdad0,_0x348a13,_0x4e0ec1){return db[_0x6b33('0x3a')][_0x6b33('0x56')]({'where':{'id':_0x2bdad0[_0x6b33('0x50')]['id']}})[_0x6b33('0x31')](handleEntityNotFound(_0x348a13,null))[_0x6b33('0x31')](function(_0x4c22c4){if(_0x4c22c4){return _0x4c22c4[_0x6b33('0xb0')](_0x2bdad0[_0x6b33('0x3e')][_0x6b33('0x67')])[_0x6b33('0x31')](function(){if(_[_0x6b33('0xb1')](_0x2bdad0['query'][_0x6b33('0x67')])){for(var _0x4a6cd5=0x0;_0x4a6cd5<_0x2bdad0['query']['ids'][_0x6b33('0x43')];_0x4a6cd5+=0x1){socket[_0x6b33('0xb2')](_0x6b33('0xb3'),{'UserId':Number(_0x2bdad0[_0x6b33('0x3e')]['ids'][_0x4a6cd5]),'OpenchannelAccountId':Number(_0x2bdad0[_0x6b33('0x50')]['id'])});}}else{socket['emit'](_0x6b33('0xb3'),{'UserId':Number(_0x2bdad0['query'][_0x6b33('0x67')]),'OpenchannelAccountId':Number(_0x2bdad0['params']['id'])});}});}})[_0x6b33('0x31')](respondWithStatusCode(_0x348a13,null))[_0x6b33('0x57')](handleError(_0x348a13,null));};exports[_0x6b33('0xb4')]=function(_0x26f70d,_0x59d419,_0x58889a){var _0x22fdaf={};var _0x446452={};var _0x4a9ed7;var _0x5279e6;return db[_0x6b33('0x3a')][_0x6b33('0x65')]({'where':{'id':_0x26f70d['params']['id']}})[_0x6b33('0x31')](handleEntityNotFound(_0x59d419,null))[_0x6b33('0x31')](function(_0x2009a4){if(_0x2009a4){_0x4a9ed7=_0x2009a4;_0x446452[_0x6b33('0x3d')]=_[_0x6b33('0x3f')](db[_0x6b33('0x97')][_0x6b33('0x53')]);_0x446452[_0x6b33('0x3e')]=_[_0x6b33('0x3f')](_0x26f70d[_0x6b33('0x3e')]);_0x446452[_0x6b33('0x40')]=_[_0x6b33('0x41')](_0x446452[_0x6b33('0x3d')],_0x446452[_0x6b33('0x3e')]);_0x22fdaf[_0x6b33('0x42')]=_[_0x6b33('0x41')](_0x446452[_0x6b33('0x3d')],qs[_0x6b33('0x54')](_0x26f70d['query']['fields']));_0x22fdaf[_0x6b33('0x42')]=_0x22fdaf['attributes'][_0x6b33('0x43')]?_0x22fdaf[_0x6b33('0x42')]:_0x446452[_0x6b33('0x3d')];_0x22fdaf[_0x6b33('0x6b')]=qs['sort'](_0x26f70d[_0x6b33('0x3e')]['sort']);_0x22fdaf['where']=qs[_0x6b33('0x40')](_[_0x6b33('0x48')](_0x26f70d[_0x6b33('0x3e')],_0x446452[_0x6b33('0x40')]));if(_0x26f70d[_0x6b33('0x3e')][_0x6b33('0x49')]){_0x22fdaf[_0x6b33('0x47')]=_['merge'](_0x22fdaf['where'],{'$or':_[_0x6b33('0x39')](_0x22fdaf[_0x6b33('0x42')],function(_0x382841){var _0x46cb2b={};_0x46cb2b[_0x382841]={'$like':'%'+_0x26f70d['query'][_0x6b33('0x49')]+'%'};return _0x46cb2b;})});}_0x22fdaf=_[_0x6b33('0x4a')]({},_0x22fdaf,_0x26f70d[_0x6b33('0x4b')]);return _0x4a9ed7[_0x6b33('0xb4')](_0x22fdaf);}})[_0x6b33('0x31')](function(_0x43bae3){if(_0x43bae3){_0x5279e6=_0x43bae3[_0x6b33('0x43')];if(!_0x26f70d[_0x6b33('0x3e')][_0x6b33('0x44')](_0x6b33('0x45'))){_0x22fdaf[_0x6b33('0x2a')]=qs[_0x6b33('0x2a')](_0x26f70d[_0x6b33('0x3e')][_0x6b33('0x2a')]);_0x22fdaf['offset']=qs[_0x6b33('0x2b')](_0x26f70d[_0x6b33('0x3e')]['offset']);}return _0x4a9ed7[_0x6b33('0xb4')](_0x22fdaf);}})[_0x6b33('0x31')](function(_0x4be26b){if(_0x4be26b){return _0x4be26b?{'count':_0x5279e6,'rows':_0x4be26b}:null;}})['then'](respondWithResult(_0x59d419,null))[_0x6b33('0x57')](handleError(_0x59d419,null));};exports[_0x6b33('0x37')]=function(_0x5486c4,_0x46878e,_0x35e493){var _0xb6e8a2,_0x1b4b8d,_0x59573a;if(_[_0x6b33('0x76')](_0x5486c4['body']['body'])||_0x5486c4[_0x6b33('0x59')]['body']===''){throw new db['Sequelize'][(_0x6b33('0x70'))](_0x6b33('0x7a'));}if(_[_0x6b33('0x76')](_0x5486c4[_0x6b33('0x59')]['to'])){}_0xb6e8a2=_0x5486c4['body']['to'];return db['OpenchannelAccount']['findOne']({'where':{'id':_0x5486c4['params']['id']}})[_0x6b33('0x31')](handleEntityNotFound(_0x46878e,null))[_0x6b33('0x31')](function(_0x3881e6){if(_0x3881e6){return db[_0x6b33('0x3a')][_0x6b33('0x56')]({'where':{'id':_0x3881e6['id']},'include':[{'model':db['CmList'],'as':_0x6b33('0x7f'),'include':[{'model':db['CmContact'],'as':_0x6b33('0x87'),'where':{[_0x3881e6['mapKey']]:_0xb6e8a2},'limit':0x1,'order':[['updatedAt','DESC']]}]}]})[_0x6b33('0x31')](handleEntityNotFound(_0x46878e,null))['then'](function(_0x4d688b){if(_0x4d688b&&_0x4d688b[_0x6b33('0x7f')]){_0x1b4b8d=_0x4d688b[_0x6b33('0x32')]({'plain':!![]});if(_0x1b4b8d[_0x6b33('0x7f')]&&_0x1b4b8d[_0x6b33('0x7f')]['Contacts'][_0x6b33('0x43')]){return _0x1b4b8d[_0x6b33('0x7f')][_0x6b33('0x87')][0x0];}return db['CmContact'][_0x6b33('0x58')](_['defaults'](_0x5486c4['body'],{'firstName':_0xb6e8a2,[_0x4d688b[_0x6b33('0x7b')]]:_0xb6e8a2,'phone':_0xb6e8a2,'ListId':_0x1b4b8d[_0x6b33('0x75')]}));}})[_0x6b33('0x31')](handleEntityNotFound(_0x46878e,null))['then'](function(_0x1fed66){if(_0x1fed66){_0x59573a=_0x1fed66;return db[_0x6b33('0x8c')][_0x6b33('0x56')]({'where':{'ContactId':_0x59573a['id'],'closed':![],'OpenchannelAccountId':_0x1b4b8d['id']}})[_0x6b33('0x31')](function(_0x5c5fff){if(_0x5c5fff){return[_0x5c5fff,![]];}return db['OpenchannelInteraction'][_0x6b33('0x58')]({'UserId':_0x5486c4[_0x6b33('0x5b')]['id'],'ContactId':_0x59573a['id'],'OpenchannelAccountId':_0x1b4b8d['id'],'lastMsgDirection':_0x6b33('0xb5'),'Messages':[_[_0x6b33('0x4a')](_0x5486c4[_0x6b33('0x59')],{'read':![],'body':_0x5486c4[_0x6b33('0x59')][_0x6b33('0x59')],'OpenchannelAccountId':_0x1b4b8d['id'],'UserId':_0x5486c4['user']['id'],'ContactId':_0x59573a['id']})]},{'include':[{'model':db[_0x6b33('0x95')],'as':'Messages'}]})[_0x6b33('0x31')](function(_0x2dda69){return[_0x2dda69,!![]];});});}})[_0x6b33('0x8f')](function(_0x222e22,_0x1c872e){if(_0x1c872e){return _0x222e22;}return db[_0x6b33('0x95')][_0x6b33('0x58')](_[_0x6b33('0x4a')](_0x5486c4[_0x6b33('0x59')],{'read':![],'body':_0x5486c4['body'][_0x6b33('0x59')],'OpenchannelAccountId':_0x1b4b8d['id'],'OpenchannelInteractionId':_0x222e22['id'],'UserId':_0x5486c4['user']['id'],'ContactId':_0x59573a['id']}))[_0x6b33('0x31')](function(_0x4f4c33){_0x222e22[_0x6b33('0xb6')][_0x6b33('0xb7')]=[];_0x222e22[_0x6b33('0xb6')][_0x6b33('0xb7')]['push'](_0x4f4c33[_0x6b33('0xb6')]);return _0x222e22;});});}})['then'](respondWithResult(_0x46878e,null))[_0x6b33('0x57')](handleError(_0x46878e,null));}; \ No newline at end of file +var _0xc3b1=['CannedAnswer','getAnswers','removeAnswers','notify','CmContact','Sequelize','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','isNil','from','ValidationError','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','Contacts','DESC','Applications','List','list','applications','priority','asc','account','mapKey','firstName','lastName','threadId','externalUrl','ContactId','OpenchannelInteraction','spread','contact','messageId','interaction','created','push','*,*,*,*','OpenchannelMessage','AttachmentId','UserId','agent','Start','startRouting','EventManager','addApplications','sequelize','transaction','OpenchannelApplication','bulkCreate','findAndCountAll','getApplications','Contact','User','Owner','Tag','color','tag','addAgents','emit','userOpenchannelAccount:save','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','body\x20is\x20mandatory\x20and\x20not\x20empty','CmList','out','Messages','dataValues','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','redis','defaults','./openchannelAccount.socket','register','jayson/promise','http','request','request\x20sent','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','OpenchannelAccount,\x20%s,\x20%s','message','info','result','catch','sendStatus','status','json','offset','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','get','OpenchannelAccounts','end','stack','send','mandatoryDispositionPause','OpenchannelAccount','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','filter','name','options','includeAll','include','findAll','show','params','Pause','length','merge','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','UserProfileResource','describe','addDisposition','OpenchannelAccountId','Disposition','getDispositions','findOne','order','pick','rows','removeDispositions','ids','addAnswer'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0xc3b1,0x1b4));var _0x1c3b=function(_0x345f37,_0x5dc9e5){_0x345f37=_0x345f37-0x0;var _0x1f21bd=_0xc3b1[_0x345f37];return _0x1f21bd;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1c3b('0x0'));var zipdir=require(_0x1c3b('0x1'));var jsonpatch=require(_0x1c3b('0x2'));var rp=require(_0x1c3b('0x3'));var moment=require(_0x1c3b('0x4'));var BPromise=require(_0x1c3b('0x5'));var Mustache=require(_0x1c3b('0x6'));var util=require(_0x1c3b('0x7'));var path=require(_0x1c3b('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x1c3b('0x9'));var fs=require('fs');var fs_extra=require(_0x1c3b('0xa'));var _=require(_0x1c3b('0xb'));var squel=require(_0x1c3b('0xc'));var crypto=require(_0x1c3b('0xd'));var jsforce=require(_0x1c3b('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x1c3b('0xf'));var querystring=require('querystring');var Papa=require(_0x1c3b('0x10'));var Redis=require(_0x1c3b('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x1c3b('0x12'));var as=require(_0x1c3b('0x13'));var hardwareService=require(_0x1c3b('0x14'));var logger=require(_0x1c3b('0x15'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x1c3b('0x16'));var db=require(_0x1c3b('0x17'))['db'];config[_0x1c3b('0x18')]=_[_0x1c3b('0x19')](config[_0x1c3b('0x18')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1c3b('0x18')]));require(_0x1c3b('0x1a'))[_0x1c3b('0x1b')](socket);var jayson=require(_0x1c3b('0x1c'));var client=jayson['client'][_0x1c3b('0x1d')]({'port':0x232c});var client9002=jayson['client'][_0x1c3b('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x274ef1,_0x42787d,_0x264a5c,_0x1a4d06){return new BPromise(function(_0x55e0b4,_0x2e7bc5){var _0x1146c1=_0x1a4d06||client;return _0x1146c1[_0x1c3b('0x1e')](_0x274ef1,_0x264a5c)['then'](function(_0x1fab88){logger['info']('OpenchannelAccount,\x20%s,\x20%s',_0x42787d,_0x1c3b('0x1f'));logger['debug'](_0x1c3b('0x20'),_0x42787d,_0x1c3b('0x1f'),JSON[_0x1c3b('0x21')](_0x1fab88));if(_0x1fab88['error']){if(_0x1fab88[_0x1c3b('0x22')][_0x1c3b('0x23')]===0x1f4){logger[_0x1c3b('0x22')](_0x1c3b('0x24'),_0x42787d,_0x1fab88[_0x1c3b('0x22')][_0x1c3b('0x25')]);return _0x2e7bc5(_0x1fab88[_0x1c3b('0x22')][_0x1c3b('0x25')]);}logger[_0x1c3b('0x22')]('OpenchannelAccount,\x20%s,\x20%s',_0x42787d,_0x1fab88[_0x1c3b('0x22')]['message']);return _0x55e0b4(_0x1fab88[_0x1c3b('0x22')][_0x1c3b('0x25')]);}else{logger[_0x1c3b('0x26')]('OpenchannelAccount,\x20%s,\x20%s',_0x42787d,_0x1c3b('0x1f'));_0x55e0b4(_0x1fab88[_0x1c3b('0x27')][_0x1c3b('0x25')]);}})[_0x1c3b('0x28')](function(_0x1ba3f3){logger['error']('OpenchannelAccount,\x20%s,\x20%s',_0x42787d,_0x1ba3f3);_0x2e7bc5(_0x1ba3f3);});});}function respondWithStatusCode(_0x21d6f6,_0x19b4a8){_0x19b4a8=_0x19b4a8||0xcc;return function(_0x485196){if(_0x485196){return _0x21d6f6[_0x1c3b('0x29')](_0x19b4a8);}return _0x21d6f6[_0x1c3b('0x2a')](_0x19b4a8)['end']();};}function respondWithResult(_0x5bdab9,_0x48bf8f){_0x48bf8f=_0x48bf8f||0xc8;return function(_0x47a341){if(_0x47a341){return _0x5bdab9[_0x1c3b('0x2a')](_0x48bf8f)[_0x1c3b('0x2b')](_0x47a341);}};}function respondWithFilteredResult(_0x345947,_0x3d699d){return function(_0x442e31){if(_0x442e31){var _0x34815f=typeof _0x3d699d[_0x1c3b('0x2c')]==='undefined'&&typeof _0x3d699d[_0x1c3b('0x2d')]==='undefined';var _0x361fcc=_0x442e31[_0x1c3b('0x2e')];var _0x582937=_0x34815f?0x0:_0x3d699d['offset'];var _0x32b84f=_0x34815f?_0x442e31[_0x1c3b('0x2e')]:_0x3d699d[_0x1c3b('0x2c')]+_0x3d699d['limit'];var _0x3abd49;if(_0x32b84f>=_0x361fcc){_0x32b84f=_0x361fcc;_0x3abd49=0xc8;}else{_0x3abd49=0xce;}_0x345947[_0x1c3b('0x2a')](_0x3abd49);return _0x345947[_0x1c3b('0x2f')](_0x1c3b('0x30'),_0x582937+'-'+_0x32b84f+'/'+_0x361fcc)[_0x1c3b('0x2b')](_0x442e31);}return null;};}function patchUpdates(_0x11e60e){return function(_0x56b811){try{jsonpatch[_0x1c3b('0x31')](_0x56b811,_0x11e60e,!![]);}catch(_0x428f20){return BPromise[_0x1c3b('0x32')](_0x428f20);}return _0x56b811[_0x1c3b('0x33')]();};}function saveUpdates(_0x6e39ec,_0x133a24){return function(_0x14a585){if(_0x14a585){return _0x14a585[_0x1c3b('0x34')](_0x6e39ec)['then'](function(_0x125248){return _0x125248;});}return null;};}function removeEntity(_0x1096f5,_0x725b75){return function(_0x36e91b){if(_0x36e91b){return _0x36e91b[_0x1c3b('0x35')]()[_0x1c3b('0x36')](function(){var _0x148d3c=_0x36e91b[_0x1c3b('0x37')]({'plain':!![]});var _0x444e08=_0x1c3b('0x38');return db['UserProfileResource'][_0x1c3b('0x35')]({'where':{'type':_0x444e08,'resourceId':_0x148d3c['id']}})[_0x1c3b('0x36')](function(){return _0x36e91b;});})[_0x1c3b('0x36')](function(){_0x1096f5[_0x1c3b('0x2a')](0xcc)[_0x1c3b('0x39')]();});}};}function handleEntityNotFound(_0x1c7501,_0x485e46){return function(_0x314c53){if(!_0x314c53){_0x1c7501[_0x1c3b('0x29')](0x194);}return _0x314c53;};}function handleError(_0x183d21,_0x463ab4){_0x463ab4=_0x463ab4||0x1f4;return function(_0x4de0ff){logger[_0x1c3b('0x22')](_0x4de0ff[_0x1c3b('0x3a')]);if(_0x4de0ff['name']){delete _0x4de0ff['name'];}_0x183d21[_0x1c3b('0x2a')](_0x463ab4)[_0x1c3b('0x3b')](_0x4de0ff);};}exports['index']=function(_0x49c84f,_0x19da90){var _0x42dd4b={'include':[{'model':db['Pause'],'as':_0x1c3b('0x3c')}]},_0x3a68e2={},_0x4e6be8={'count':0x0,'rows':[]};var _0x41494b=_['map'](db[_0x1c3b('0x3d')][_0x1c3b('0x3e')],function(_0x2f8ded){return{'name':_0x2f8ded[_0x1c3b('0x3f')],'type':_0x2f8ded[_0x1c3b('0x40')][_0x1c3b('0x41')]};});_0x3a68e2[_0x1c3b('0x42')]=_[_0x1c3b('0x43')](_0x41494b,'name');_0x3a68e2[_0x1c3b('0x44')]=_[_0x1c3b('0x45')](_0x49c84f['query']);_0x3a68e2[_0x1c3b('0x46')]=_[_0x1c3b('0x47')](_0x3a68e2[_0x1c3b('0x42')],_0x3a68e2['query']);_0x42dd4b[_0x1c3b('0x48')]=_['intersection'](_0x3a68e2['model'],qs[_0x1c3b('0x49')](_0x49c84f[_0x1c3b('0x44')]['fields']));_0x42dd4b[_0x1c3b('0x48')]=_0x42dd4b[_0x1c3b('0x48')]['length']?_0x42dd4b[_0x1c3b('0x48')]:_0x3a68e2[_0x1c3b('0x42')];if(!_0x49c84f[_0x1c3b('0x44')][_0x1c3b('0x4a')](_0x1c3b('0x4b'))){_0x42dd4b[_0x1c3b('0x2d')]=qs[_0x1c3b('0x2d')](_0x49c84f[_0x1c3b('0x44')][_0x1c3b('0x2d')]);_0x42dd4b[_0x1c3b('0x2c')]=qs[_0x1c3b('0x2c')](_0x49c84f[_0x1c3b('0x44')][_0x1c3b('0x2c')]);}_0x42dd4b['order']=qs[_0x1c3b('0x4c')](_0x49c84f['query'][_0x1c3b('0x4c')]);_0x42dd4b[_0x1c3b('0x4d')]=qs[_0x1c3b('0x46')](_['pick'](_0x49c84f[_0x1c3b('0x44')],_0x3a68e2[_0x1c3b('0x46')]),_0x41494b);if(_0x49c84f['query'][_0x1c3b('0x4e')]){_0x42dd4b[_0x1c3b('0x4d')]=_['merge'](_0x42dd4b[_0x1c3b('0x4d')],{'$or':_['map'](_0x41494b,function(_0xb9990f){if(_0xb9990f[_0x1c3b('0x40')]!=='VIRTUAL'){var _0x5cf17a={};_0x5cf17a[_0xb9990f[_0x1c3b('0x4f')]]={'$like':'%'+_0x49c84f[_0x1c3b('0x44')][_0x1c3b('0x4e')]+'%'};return _0x5cf17a;}})});}_0x42dd4b=_['merge']({},_0x42dd4b,_0x49c84f[_0x1c3b('0x50')]);var _0x2e323a={'where':_0x42dd4b[_0x1c3b('0x4d')]};return db[_0x1c3b('0x3d')][_0x1c3b('0x2e')](_0x2e323a)[_0x1c3b('0x36')](function(_0x49d6e5){_0x4e6be8[_0x1c3b('0x2e')]=_0x49d6e5;if(_0x49c84f['query'][_0x1c3b('0x51')]){_0x42dd4b[_0x1c3b('0x52')]=[{'all':!![]}];}return db[_0x1c3b('0x3d')][_0x1c3b('0x53')](_0x42dd4b);})['then'](function(_0x11e95a){_0x4e6be8['rows']=_0x11e95a;return _0x4e6be8;})[_0x1c3b('0x36')](respondWithFilteredResult(_0x19da90,_0x42dd4b))[_0x1c3b('0x28')](handleError(_0x19da90,null));};exports[_0x1c3b('0x54')]=function(_0x5a926b,_0x2e9ca3){var _0x26cd22={'raw':![],'where':{'id':_0x5a926b[_0x1c3b('0x55')]['id']},'include':[{'model':db[_0x1c3b('0x56')],'as':'mandatoryDispositionPause'}]},_0x1a32e1={};_0x1a32e1[_0x1c3b('0x42')]=_[_0x1c3b('0x45')](db['OpenchannelAccount'][_0x1c3b('0x3e')]);_0x1a32e1[_0x1c3b('0x44')]=_[_0x1c3b('0x45')](_0x5a926b[_0x1c3b('0x44')]);_0x1a32e1[_0x1c3b('0x46')]=_[_0x1c3b('0x47')](_0x1a32e1[_0x1c3b('0x42')],_0x1a32e1[_0x1c3b('0x44')]);_0x26cd22[_0x1c3b('0x48')]=_[_0x1c3b('0x47')](_0x1a32e1[_0x1c3b('0x42')],qs['fields'](_0x5a926b[_0x1c3b('0x44')]['fields']));_0x26cd22[_0x1c3b('0x48')]=_0x26cd22['attributes'][_0x1c3b('0x57')]?_0x26cd22[_0x1c3b('0x48')]:_0x1a32e1[_0x1c3b('0x42')];if(_0x5a926b[_0x1c3b('0x44')]['includeAll']){_0x26cd22[_0x1c3b('0x52')]=[{'all':!![]}];}_0x26cd22=_[_0x1c3b('0x58')]({},_0x26cd22,_0x5a926b[_0x1c3b('0x50')]);return db['OpenchannelAccount'][_0x1c3b('0x59')](_0x26cd22)[_0x1c3b('0x36')](handleEntityNotFound(_0x2e9ca3,null))[_0x1c3b('0x36')](respondWithResult(_0x2e9ca3,null))[_0x1c3b('0x28')](handleError(_0x2e9ca3,null));};exports[_0x1c3b('0x5a')]=function(_0x119597,_0x1e358d){return db[_0x1c3b('0x3d')][_0x1c3b('0x5a')](_0x119597[_0x1c3b('0x5b')],{})['then'](function(_0x17f203){var _0x3e915a=_0x119597[_0x1c3b('0x5c')][_0x1c3b('0x37')]({'plain':!![]});if(!_0x3e915a)throw new Error(_0x1c3b('0x5d'));if(_0x3e915a[_0x1c3b('0x5e')]===_0x1c3b('0x5c')){var _0x38a556=_0x17f203[_0x1c3b('0x37')]({'plain':!![]});var _0x21abdb='OpenchannelAccounts';return db[_0x1c3b('0x5f')][_0x1c3b('0x59')]({'where':{'name':_0x21abdb,'userProfileId':_0x3e915a['userProfileId']},'raw':!![]})['then'](function(_0x30d856){if(_0x30d856&&_0x30d856[_0x1c3b('0x60')]===0x0){return db[_0x1c3b('0x61')][_0x1c3b('0x5a')]({'name':_0x38a556[_0x1c3b('0x4f')],'resourceId':_0x38a556['id'],'type':_0x30d856[_0x1c3b('0x4f')],'sectionId':_0x30d856['id']},{})[_0x1c3b('0x36')](function(){return _0x17f203;});}else{return _0x17f203;}})[_0x1c3b('0x28')](function(_0x5c1b1b){logger[_0x1c3b('0x22')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5c1b1b);throw _0x5c1b1b;});}return _0x17f203;})[_0x1c3b('0x36')](respondWithResult(_0x1e358d,0xc9))[_0x1c3b('0x28')](handleError(_0x1e358d,null));};exports[_0x1c3b('0x34')]=function(_0x417323,_0x530102){if(_0x417323[_0x1c3b('0x5b')]['id']){delete _0x417323['body']['id'];}return db[_0x1c3b('0x3d')]['find']({'where':{'id':_0x417323[_0x1c3b('0x55')]['id']},'include':[{'model':db['Pause'],'as':_0x1c3b('0x3c')}]})[_0x1c3b('0x36')](handleEntityNotFound(_0x530102,null))['then'](saveUpdates(_0x417323[_0x1c3b('0x5b')],null))[_0x1c3b('0x36')](respondWithResult(_0x530102,null))['catch'](handleError(_0x530102,null));};exports[_0x1c3b('0x35')]=function(_0x3b76f2,_0x5d8664){return db[_0x1c3b('0x3d')][_0x1c3b('0x59')]({'where':{'id':_0x3b76f2[_0x1c3b('0x55')]['id']}})[_0x1c3b('0x36')](handleEntityNotFound(_0x5d8664,null))[_0x1c3b('0x36')](removeEntity(_0x5d8664,null))['catch'](handleError(_0x5d8664,null));};exports['describe']=function(_0x332448,_0x20e95a){return db[_0x1c3b('0x3d')][_0x1c3b('0x62')]()[_0x1c3b('0x36')](respondWithResult(_0x20e95a,null))[_0x1c3b('0x28')](handleError(_0x20e95a,null));};exports[_0x1c3b('0x63')]=function(_0x7f00ba,_0x55878a,_0x58e750){if(_0x7f00ba[_0x1c3b('0x5b')]['id']){delete _0x7f00ba['body']['id'];}return db[_0x1c3b('0x3d')]['find']({'where':{'id':_0x7f00ba[_0x1c3b('0x55')]['id']}})[_0x1c3b('0x36')](handleEntityNotFound(_0x55878a,null))['then'](function(_0x4f9bbb){if(_0x4f9bbb){_0x7f00ba[_0x1c3b('0x5b')][_0x1c3b('0x64')]=_0x4f9bbb['id'];return db[_0x1c3b('0x65')]['create'](_0x7f00ba['body']);}})[_0x1c3b('0x36')](respondWithResult(_0x55878a,null))[_0x1c3b('0x28')](handleError(_0x55878a,null));};exports[_0x1c3b('0x66')]=function(_0x506266,_0x44ae12,_0x83d07a){var _0x3cb6a5={'raw':![],'where':{}};var _0x3c434f={};var _0x59075b={'count':0x0,'rows':[]};return db[_0x1c3b('0x3d')][_0x1c3b('0x67')]({'where':{'id':_0x506266['params']['id']}})[_0x1c3b('0x36')](handleEntityNotFound(_0x44ae12,null))[_0x1c3b('0x36')](function(_0xdce05){if(_0xdce05){_0x3c434f['model']=_[_0x1c3b('0x45')](db[_0x1c3b('0x65')][_0x1c3b('0x3e')]);_0x3c434f['query']=_[_0x1c3b('0x45')](_0x506266[_0x1c3b('0x44')]);_0x3c434f[_0x1c3b('0x46')]=_[_0x1c3b('0x47')](_0x3c434f[_0x1c3b('0x42')],_0x3c434f[_0x1c3b('0x44')]);_0x3cb6a5['attributes']=_[_0x1c3b('0x47')](_0x3c434f[_0x1c3b('0x42')],qs[_0x1c3b('0x49')](_0x506266['query']['fields']));_0x3cb6a5[_0x1c3b('0x48')]=_0x3cb6a5[_0x1c3b('0x48')][_0x1c3b('0x57')]?_0x3cb6a5[_0x1c3b('0x48')]:_0x3c434f['model'];if(!_0x506266[_0x1c3b('0x44')][_0x1c3b('0x4a')](_0x1c3b('0x4b'))){_0x3cb6a5[_0x1c3b('0x2d')]=qs[_0x1c3b('0x2d')](_0x506266[_0x1c3b('0x44')]['limit']);_0x3cb6a5[_0x1c3b('0x2c')]=qs[_0x1c3b('0x2c')](_0x506266[_0x1c3b('0x44')][_0x1c3b('0x2c')]);}_0x3cb6a5[_0x1c3b('0x68')]=qs[_0x1c3b('0x4c')](_0x506266[_0x1c3b('0x44')]['sort']);_0x3cb6a5[_0x1c3b('0x4d')]=qs[_0x1c3b('0x46')](_[_0x1c3b('0x69')](_0x506266[_0x1c3b('0x44')],_0x3c434f['filters']));_0x3cb6a5[_0x1c3b('0x4d')][_0x1c3b('0x64')]=_0xdce05['id'];if(_0x506266['query'][_0x1c3b('0x4e')]){_0x3cb6a5[_0x1c3b('0x4d')]=_[_0x1c3b('0x58')](_0x3cb6a5[_0x1c3b('0x4d')],{'$or':_['map'](_0x3cb6a5['attributes'],function(_0xd35b25){var _0x3f8400={};_0x3f8400[_0xd35b25]={'$like':'%'+_0x506266['query']['filter']+'%'};return _0x3f8400;})});}_0x3cb6a5=_[_0x1c3b('0x58')]({},_0x3cb6a5,_0x506266[_0x1c3b('0x50')]);return db[_0x1c3b('0x65')][_0x1c3b('0x2e')]({'where':_0x3cb6a5['where']})[_0x1c3b('0x36')](function(_0x320404){_0x59075b[_0x1c3b('0x2e')]=_0x320404;if(_0x506266[_0x1c3b('0x44')][_0x1c3b('0x51')]){_0x3cb6a5['include']=[{'all':!![]}];}return db[_0x1c3b('0x65')][_0x1c3b('0x53')](_0x3cb6a5);})[_0x1c3b('0x36')](function(_0x1fa6b7){_0x59075b[_0x1c3b('0x6a')]=_0x1fa6b7;return _0x59075b;});}})['then'](respondWithFilteredResult(_0x44ae12,_0x3cb6a5))['catch'](handleError(_0x44ae12,null));};exports[_0x1c3b('0x6b')]=function(_0x4603a1,_0x4de3f4,_0x46653a){return db[_0x1c3b('0x3d')]['find']({'where':{'id':_0x4603a1['params']['id']}})[_0x1c3b('0x36')](handleEntityNotFound(_0x4de3f4,null))[_0x1c3b('0x36')](function(_0x4272f6){if(_0x4272f6){return _0x4272f6[_0x1c3b('0x6b')](_0x4603a1['query'][_0x1c3b('0x6c')]);}})[_0x1c3b('0x36')](respondWithStatusCode(_0x4de3f4,null))[_0x1c3b('0x28')](handleError(_0x4de3f4,null));};exports[_0x1c3b('0x6d')]=function(_0x5be6c6,_0x4ede14,_0x21028f){if(_0x5be6c6[_0x1c3b('0x5b')]['id']){delete _0x5be6c6['body']['id'];}return db['OpenchannelAccount'][_0x1c3b('0x59')]({'where':{'id':_0x5be6c6[_0x1c3b('0x55')]['id']}})[_0x1c3b('0x36')](handleEntityNotFound(_0x4ede14,null))['then'](function(_0x16e52f){if(_0x16e52f){_0x5be6c6[_0x1c3b('0x5b')][_0x1c3b('0x64')]=_0x16e52f['id'];return db[_0x1c3b('0x6e')]['create'](_0x5be6c6['body']);}})[_0x1c3b('0x36')](respondWithResult(_0x4ede14,null))['catch'](handleError(_0x4ede14,null));};exports[_0x1c3b('0x6f')]=function(_0x3b166f,_0x76c9ba,_0x138cae){var _0x507289={'raw':![],'where':{}};var _0x504bf9={};var _0xc7362d={'count':0x0,'rows':[]};return db[_0x1c3b('0x3d')][_0x1c3b('0x67')]({'where':{'id':_0x3b166f[_0x1c3b('0x55')]['id']}})['then'](handleEntityNotFound(_0x76c9ba,null))[_0x1c3b('0x36')](function(_0x40daac){if(_0x40daac){_0x504bf9['model']=_[_0x1c3b('0x45')](db[_0x1c3b('0x6e')][_0x1c3b('0x3e')]);_0x504bf9[_0x1c3b('0x44')]=_[_0x1c3b('0x45')](_0x3b166f[_0x1c3b('0x44')]);_0x504bf9['filters']=_[_0x1c3b('0x47')](_0x504bf9['model'],_0x504bf9[_0x1c3b('0x44')]);_0x507289[_0x1c3b('0x48')]=_[_0x1c3b('0x47')](_0x504bf9[_0x1c3b('0x42')],qs[_0x1c3b('0x49')](_0x3b166f[_0x1c3b('0x44')][_0x1c3b('0x49')]));_0x507289['attributes']=_0x507289[_0x1c3b('0x48')][_0x1c3b('0x57')]?_0x507289[_0x1c3b('0x48')]:_0x504bf9[_0x1c3b('0x42')];if(!_0x3b166f['query'][_0x1c3b('0x4a')]('nolimit')){_0x507289[_0x1c3b('0x2d')]=qs[_0x1c3b('0x2d')](_0x3b166f[_0x1c3b('0x44')][_0x1c3b('0x2d')]);_0x507289[_0x1c3b('0x2c')]=qs[_0x1c3b('0x2c')](_0x3b166f[_0x1c3b('0x44')][_0x1c3b('0x2c')]);}_0x507289['order']=qs[_0x1c3b('0x4c')](_0x3b166f[_0x1c3b('0x44')][_0x1c3b('0x4c')]);_0x507289['where']=qs['filters'](_['pick'](_0x3b166f[_0x1c3b('0x44')],_0x504bf9[_0x1c3b('0x46')]));_0x507289['where'][_0x1c3b('0x64')]=_0x40daac['id'];if(_0x3b166f[_0x1c3b('0x44')][_0x1c3b('0x4e')]){_0x507289[_0x1c3b('0x4d')]=_[_0x1c3b('0x58')](_0x507289[_0x1c3b('0x4d')],{'$or':_[_0x1c3b('0x43')](_0x507289[_0x1c3b('0x48')],function(_0x3584ac){var _0x85f9d0={};_0x85f9d0[_0x3584ac]={'$like':'%'+_0x3b166f[_0x1c3b('0x44')]['filter']+'%'};return _0x85f9d0;})});}_0x507289=_[_0x1c3b('0x58')]({},_0x507289,_0x3b166f[_0x1c3b('0x50')]);return db[_0x1c3b('0x6e')][_0x1c3b('0x2e')]({'where':_0x507289[_0x1c3b('0x4d')]})['then'](function(_0x2ef488){_0xc7362d[_0x1c3b('0x2e')]=_0x2ef488;if(_0x3b166f['query'][_0x1c3b('0x51')]){_0x507289[_0x1c3b('0x52')]=[{'all':!![]}];}return db[_0x1c3b('0x6e')][_0x1c3b('0x53')](_0x507289);})[_0x1c3b('0x36')](function(_0x1f6cb0){_0xc7362d[_0x1c3b('0x6a')]=_0x1f6cb0;return _0xc7362d;});}})[_0x1c3b('0x36')](respondWithFilteredResult(_0x76c9ba,_0x507289))[_0x1c3b('0x28')](handleError(_0x76c9ba,null));};exports[_0x1c3b('0x70')]=function(_0x75f8da,_0x223035,_0xc5daf){return db['OpenchannelAccount']['find']({'where':{'id':_0x75f8da[_0x1c3b('0x55')]['id']}})['then'](handleEntityNotFound(_0x223035,null))[_0x1c3b('0x36')](function(_0x5ac743){if(_0x5ac743){return _0x5ac743[_0x1c3b('0x70')](_0x75f8da[_0x1c3b('0x44')][_0x1c3b('0x6c')]);}})[_0x1c3b('0x36')](respondWithStatusCode(_0x223035,null))[_0x1c3b('0x28')](handleError(_0x223035,null));};exports[_0x1c3b('0x71')]=function(_0x1f2290,_0x2e5158,_0x4a0add){var _0x4d2532={'body':_0x1f2290[_0x1c3b('0x5b')],'channel':'openchannel'};var _0x55e8dd=[];var _0x1bffc4=[];var _0x419223={};var _0x17a88f=![];return db[_0x1c3b('0x72')][_0x1c3b('0x62')]()['then'](function(_0x28ade2){if(!_0x28ade2){throw new db[(_0x1c3b('0x73'))]['ValidationError'](_0x1c3b('0x74'));}_0x55e8dd=_[_0x1c3b('0x75')](_[_0x1c3b('0x45')](_0x28ade2),[_0x1c3b('0x76'),'updatedAt']);_0x1bffc4=_['difference'](_['keys'](_0x28ade2),[_0x1c3b('0x76'),_0x1c3b('0x77'),_0x1c3b('0x78'),_0x1c3b('0x79')]);if(_0x1f2290[_0x1c3b('0x5b')]['id']){delete _0x1f2290[_0x1c3b('0x5b')]['id'];}if(_[_0x1c3b('0x7a')](_0x1f2290[_0x1c3b('0x5b')][_0x1c3b('0x7b')])){throw new db[(_0x1c3b('0x73'))]['ValidationError']('from\x20is\x20mandatory');}if(_[_0x1c3b('0x7a')](_0x1f2290[_0x1c3b('0x5b')][_0x1c3b('0x5b')])||_0x1f2290[_0x1c3b('0x5b')][_0x1c3b('0x5b')]===''){throw new db[(_0x1c3b('0x73'))][(_0x1c3b('0x7c'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x1c3b('0x7a')](_0x1f2290[_0x1c3b('0x5b')]['mapKey'])){throw new db[(_0x1c3b('0x73'))][(_0x1c3b('0x7c'))](_0x1c3b('0x7d')+_0x1bffc4);}if(!_['includes'](_0x1bffc4,_0x1f2290[_0x1c3b('0x5b')]['mapKey'])){throw new db[(_0x1c3b('0x73'))][(_0x1c3b('0x7c'))](_0x1c3b('0x7e')+_0x1bffc4);}_0x419223[_0x1f2290[_0x1c3b('0x5b')]['mapKey']]=_0x1f2290[_0x1c3b('0x5b')]['from'];})[_0x1c3b('0x36')](function(){return db[_0x1c3b('0x3d')][_0x1c3b('0x59')]({'where':{'id':_0x1f2290[_0x1c3b('0x55')]['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db[_0x1c3b('0x72')],'as':_0x1c3b('0x7f'),'where':_0x419223,'limit':0x1,'order':[[_0x1c3b('0x77'),_0x1c3b('0x80')]]}]},{'model':db['OpenchannelApplication'],'as':_0x1c3b('0x81')}]});})[_0x1c3b('0x36')](handleEntityNotFound(_0x2e5158,null))[_0x1c3b('0x36')](function(_0xeb9231){if(_0xeb9231&&_0xeb9231[_0x1c3b('0x82')]){_0x4d2532['account']=_0xeb9231;_0x4d2532['applications']=_0xeb9231[_0x1c3b('0x81')];_0x4d2532[_0x1c3b('0x83')]=_0xeb9231['List'];_0x4d2532[_0x1c3b('0x84')]=_['orderBy'](_0x4d2532[_0x1c3b('0x84')],[_0x1c3b('0x85')],[_0x1c3b('0x86')]);if(_0x4d2532[_0x1c3b('0x87')][_0x1c3b('0x81')]){delete _0x4d2532[_0x1c3b('0x87')][_0x1c3b('0x81')];}if(_0x4d2532[_0x1c3b('0x87')][_0x1c3b('0x82')]&&_0x4d2532['account'][_0x1c3b('0x82')][_0x1c3b('0x7f')][_0x1c3b('0x57')]){return _0x4d2532[_0x1c3b('0x87')][_0x1c3b('0x82')][_0x1c3b('0x7f')][0x0];}var _0x3a28b8=_['defaults'](_0x1f2290[_0x1c3b('0x5b')],{'firstName':_0x1f2290['body'][_0x1c3b('0x7b')],'ListId':_0xeb9231[_0x1c3b('0x79')]});_0x3a28b8[_0x1f2290['body'][_0x1c3b('0x88')]]=_0x1f2290[_0x1c3b('0x5b')][_0x1c3b('0x7b')];return db['CmContact'][_0x1c3b('0x5a')](_0x3a28b8,{'fields':_0x55e8dd,'raw':!![]});}})[_0x1c3b('0x36')](handleEntityNotFound(_0x2e5158,null))[_0x1c3b('0x36')](function(_0x16f93c){_0x4d2532['contact']=_0x16f93c;if(_0x16f93c){var _0x2a145f={'ContactId':_0x16f93c['id'],'OpenchannelAccountId':_0x1f2290['params']['id'],'from':(_0x16f93c[_0x1c3b('0x89')]||'')+'\x20'+(_0x16f93c[_0x1c3b('0x8a')]||'')};var _0x1eff0d={'OpenchannelAccountId':_0x1f2290[_0x1c3b('0x55')]['id'],'closed':![]};if(_0x1f2290[_0x1c3b('0x5b')][_0x1c3b('0x8b')]){_0x1eff0d[_0x1c3b('0x8b')]=_0x1f2290[_0x1c3b('0x5b')][_0x1c3b('0x8b')];return db['OpenchannelInteraction'][_0x1c3b('0x59')]({'where':_0x1eff0d})[_0x1c3b('0x36')](function(_0x50ad21){if(_0x50ad21){return[_0x50ad21,![]];}_0x2a145f['threadId']=_0x1f2290[_0x1c3b('0x5b')][_0x1c3b('0x8b')];_0x2a145f[_0x1c3b('0x8c')]=_0x1f2290['body'][_0x1c3b('0x8c')];return db['OpenchannelInteraction'][_0x1c3b('0x5a')](_0x2a145f)[_0x1c3b('0x36')](function(_0x4d1c04){return[_0x4d1c04,!![]];});});}else{_0x1eff0d[_0x1c3b('0x8b')]=null;}_0x1eff0d[_0x1c3b('0x8d')]=_0x16f93c['id'];return db['OpenchannelInteraction']['find']({'where':_0x1eff0d})[_0x1c3b('0x36')](function(_0x3c19d4){if(_0x3c19d4){return[_0x3c19d4,![]];}return db[_0x1c3b('0x8e')]['create'](_0x2a145f)[_0x1c3b('0x36')](function(_0x41543c){return[_0x41543c,!![]];});});}})[_0x1c3b('0x8f')](function(_0x1fa936,_0x4b7b1c){if(_0x1fa936){_0x17a88f=_0x4b7b1c;if(!_0x4b7b1c){var _0x2699ac={'from':(_0x4d2532[_0x1c3b('0x90')][_0x1c3b('0x89')]||'')+'\x20'+(_0x4d2532[_0x1c3b('0x90')][_0x1c3b('0x8a')]||'')};if(_0x1f2290['body'][_0x1c3b('0x8b')]&&_0x1f2290[_0x1c3b('0x5b')][_0x1c3b('0x91')]&&_0x1f2290[_0x1c3b('0x5b')][_0x1c3b('0x8b')]!=_0x1f2290['body'][_0x1c3b('0x91')]){_0x2699ac[_0x1c3b('0x8b')]=_0x1f2290[_0x1c3b('0x5b')][_0x1c3b('0x91')];}return _0x1fa936[_0x1c3b('0x34')](_0x2699ac);}else{return _0x1fa936;}}})['then'](function(_0x1ca090){_0x4d2532['interaction']=_0x1ca090[_0x1c3b('0x37')]({'plain':!![]});_0x4d2532[_0x1c3b('0x92')][_0x1c3b('0x93')]=_0x17a88f;if(_0x4d2532['interaction'][_0x1c3b('0x93')]){if(_0x4d2532['account']['autoclose']){_0x4d2532[_0x1c3b('0x84')][_0x1c3b('0x94')]({'id':0x0,'priority':_0x4d2532[_0x1c3b('0x84')][_0x1c3b('0x57')]+0x1,'app':'close','appdata':'unmanaged','interval':_0x1c3b('0x95')});}}return db[_0x1c3b('0x96')][_0x1c3b('0x5a')]({'body':_0x1f2290['body'][_0x1c3b('0x5b')],'OpenchannelAccountId':_0x1f2290[_0x1c3b('0x55')]['id'],'OpenchannelInteractionId':_0x1ca090['id'],'direction':'in','ContactId':_0x4d2532[_0x1c3b('0x90')]['id'],'AttachmentId':_0x1f2290[_0x1c3b('0x5b')][_0x1c3b('0x97')]});})[_0x1c3b('0x36')](function(_0x13546c){_0x4d2532[_0x1c3b('0x25')]=_0x13546c;if(_0x4d2532[_0x1c3b('0x92')][_0x1c3b('0x98')]){return db['User']['find']({'attributes':['id',_0x1c3b('0x4f')],'where':{'id':_0x4d2532[_0x1c3b('0x92')][_0x1c3b('0x98')]}})[_0x1c3b('0x36')](function(_0x1ea554){if(_0x1ea554){_0x4d2532[_0x1c3b('0x84')]['unshift']({'id':0x0,'priority':0x0,'app':_0x1c3b('0x99'),'appdata':_0x1ea554[_0x1c3b('0x4f')]+','+(_0x4d2532[_0x1c3b('0x87')]['waitForTheAssignedAgent']||0xa),'interval':'*,*,*,*'});_0x4d2532['forcedOwnership']=![];}return respondWithRpcPromise(_0x1c3b('0x9a'),'startRouting',_0x4d2532);});}return respondWithRpcPromise('Start',_0x1c3b('0x9b'),_0x4d2532);})['then'](function(_0x478aa0){respondWithRpcPromise(_0x1c3b('0x9c'),_0x1c3b('0x9c'),{'event':_0x1c3b('0x71'),'message':_0x478aa0},client9002);return _0x478aa0;})['then'](respondWithResult(_0x2e5158,null))[_0x1c3b('0x28')](handleError(_0x2e5158,null));};exports[_0x1c3b('0x9d')]=function(_0x1c55a9,_0x11f0d9,_0x5dd3f9){return db[_0x1c3b('0x3d')]['findOne']({'where':{'id':_0x1c55a9[_0x1c3b('0x55')]['id']}})[_0x1c3b('0x36')](handleEntityNotFound(_0x11f0d9,null))['then'](function(_0x5e6408){if(_0x5e6408){return db[_0x1c3b('0x9e')][_0x1c3b('0x9f')](function(_0x2c2c61){return db['OpenchannelApplication']['destroy']({'where':{'OpenchannelAccountId':_0x1c55a9['params']['id']},'transaction':_0x2c2c61})['then'](function(_0x276ea0){var _0x1ae9c6=_['map'](_0x1c55a9['body'],function(_0x446185){_0x446185[_0x1c3b('0x64')]=_0x1c55a9[_0x1c3b('0x55')]['id'];return _0x446185;});return db[_0x1c3b('0xa0')][_0x1c3b('0xa1')](_0x1ae9c6,{'transaction':_0x2c2c61});});})[_0x1c3b('0x36')](function(){return db[_0x1c3b('0xa0')][_0x1c3b('0xa2')]({'where':{'OpenchannelAccountId':_0x1c55a9[_0x1c3b('0x55')]['id']},'order':_0x1c3b('0x85')});});}})[_0x1c3b('0x36')](respondWithResult(_0x11f0d9,null))[_0x1c3b('0x28')](handleError(_0x11f0d9,null));};exports[_0x1c3b('0xa3')]=function(_0x210044,_0x522a48,_0x21caee){var _0x2e7d75={};var _0x550d00={};var _0xc66271;var _0x2ece82;return db['OpenchannelAccount'][_0x1c3b('0x67')]({'where':{'id':_0x210044[_0x1c3b('0x55')]['id']}})[_0x1c3b('0x36')](handleEntityNotFound(_0x522a48,null))[_0x1c3b('0x36')](function(_0x5dce62){if(_0x5dce62){_0xc66271=_0x5dce62;_0x550d00[_0x1c3b('0x42')]=_[_0x1c3b('0x45')](db[_0x1c3b('0xa0')][_0x1c3b('0x3e')]);_0x550d00[_0x1c3b('0x44')]=_[_0x1c3b('0x45')](_0x210044[_0x1c3b('0x44')]);_0x550d00['filters']=_['intersection'](_0x550d00['model'],_0x550d00[_0x1c3b('0x44')]);_0x2e7d75[_0x1c3b('0x48')]=_[_0x1c3b('0x47')](_0x550d00[_0x1c3b('0x42')],qs[_0x1c3b('0x49')](_0x210044['query'][_0x1c3b('0x49')]));_0x2e7d75['attributes']=_0x2e7d75[_0x1c3b('0x48')]['length']?_0x2e7d75[_0x1c3b('0x48')]:_0x550d00['model'];_0x2e7d75[_0x1c3b('0x68')]=qs['sort'](_0x210044['query'][_0x1c3b('0x4c')]);_0x2e7d75['where']=qs[_0x1c3b('0x46')](_[_0x1c3b('0x69')](_0x210044['query'],_0x550d00[_0x1c3b('0x46')]));if(_0x210044[_0x1c3b('0x44')][_0x1c3b('0x4e')]){_0x2e7d75['where']=_[_0x1c3b('0x58')](_0x2e7d75[_0x1c3b('0x4d')],{'$or':_[_0x1c3b('0x43')](_0x2e7d75[_0x1c3b('0x48')],function(_0xb16183){var _0xf5ef12={};_0xf5ef12[_0xb16183]={'$like':'%'+_0x210044[_0x1c3b('0x44')]['filter']+'%'};return _0xf5ef12;})});}_0x2e7d75=_[_0x1c3b('0x58')]({},_0x2e7d75,_0x210044[_0x1c3b('0x50')]);return _0xc66271[_0x1c3b('0xa3')](_0x2e7d75);}})[_0x1c3b('0x36')](function(_0x5bf6fb){if(_0x5bf6fb){_0x2ece82=_0x5bf6fb['length'];if(!_0x210044[_0x1c3b('0x44')][_0x1c3b('0x4a')](_0x1c3b('0x4b'))){_0x2e7d75[_0x1c3b('0x2d')]=qs[_0x1c3b('0x2d')](_0x210044[_0x1c3b('0x44')][_0x1c3b('0x2d')]);_0x2e7d75[_0x1c3b('0x2c')]=qs[_0x1c3b('0x2c')](_0x210044[_0x1c3b('0x44')][_0x1c3b('0x2c')]);}return _0xc66271['getApplications'](_0x2e7d75);}})[_0x1c3b('0x36')](function(_0x303e53){if(_0x303e53){return _0x303e53?{'count':_0x2ece82,'rows':_0x303e53}:null;}})[_0x1c3b('0x36')](respondWithResult(_0x522a48,null))[_0x1c3b('0x28')](handleError(_0x522a48,null));};exports['getInteractions']=function(_0x35ae36,_0x25aaab,_0x3473d3){var _0x3f541c={'raw':![],'where':{}};var _0xa8b455={};var _0x50d630={'count':0x0,'rows':[]};return db['OpenchannelAccount']['findOne']({'where':{'id':_0x35ae36[_0x1c3b('0x55')]['id']}})['then'](handleEntityNotFound(_0x25aaab,null))[_0x1c3b('0x36')](function(_0x4a5a04){if(_0x4a5a04){_0xa8b455['model']=_[_0x1c3b('0x45')](db[_0x1c3b('0x8e')]['rawAttributes']);_0xa8b455['query']=_[_0x1c3b('0x45')](_0x35ae36['query']);_0xa8b455[_0x1c3b('0x46')]=_[_0x1c3b('0x47')](_0xa8b455['model'],_0xa8b455[_0x1c3b('0x44')]);_0x3f541c[_0x1c3b('0x48')]=_[_0x1c3b('0x47')](_0xa8b455[_0x1c3b('0x42')],qs['fields'](_0x35ae36['query'][_0x1c3b('0x49')]));_0x3f541c[_0x1c3b('0x48')]=_0x3f541c[_0x1c3b('0x48')][_0x1c3b('0x57')]?_0x3f541c[_0x1c3b('0x48')]:_0xa8b455[_0x1c3b('0x42')];if(!_0x35ae36[_0x1c3b('0x44')][_0x1c3b('0x4a')]('nolimit')){_0x3f541c['limit']=qs[_0x1c3b('0x2d')](_0x35ae36[_0x1c3b('0x44')]['limit']);_0x3f541c[_0x1c3b('0x2c')]=qs['offset'](_0x35ae36[_0x1c3b('0x44')][_0x1c3b('0x2c')]);}_0x3f541c[_0x1c3b('0x68')]=qs[_0x1c3b('0x4c')](_0x35ae36[_0x1c3b('0x44')]['sort']);_0x3f541c[_0x1c3b('0x4d')]=qs[_0x1c3b('0x46')](_[_0x1c3b('0x69')](_0x35ae36[_0x1c3b('0x44')],_0xa8b455[_0x1c3b('0x46')]));_0x3f541c['where'][_0x1c3b('0x64')]=_0x4a5a04['id'];if(_0x35ae36[_0x1c3b('0x44')][_0x1c3b('0x4e')]){_0x3f541c['where']=_[_0x1c3b('0x58')](_0x3f541c[_0x1c3b('0x4d')],{'$or':_['map'](_0x3f541c[_0x1c3b('0x48')],function(_0x20a337){var _0x338ae3={};_0x338ae3[_0x20a337]={'$like':'%'+_0x35ae36[_0x1c3b('0x44')]['filter']+'%'};return _0x338ae3;})});}_0x3f541c=_[_0x1c3b('0x58')]({},_0x3f541c,_0x35ae36[_0x1c3b('0x50')]);return db[_0x1c3b('0x8e')][_0x1c3b('0x2e')]({'where':_0x3f541c['where']})['then'](function(_0x3a0d22){_0x50d630['count']=_0x3a0d22;if(_0x35ae36[_0x1c3b('0x44')][_0x1c3b('0x51')]){_0x3f541c[_0x1c3b('0x52')]=[{'model':db['CmContact'],'as':_0x1c3b('0xa4'),'required':![]},{'model':db[_0x1c3b('0xa5')],'as':_0x1c3b('0xa6'),'attributes':[_0x1c3b('0x4f'),'fullname','internal'],'required':![]},{'model':db[_0x1c3b('0xa7')],'as':'Tags','attributes':['id',_0x1c3b('0x4f'),_0x1c3b('0xa8')],'where':_0x35ae36['query'][_0x1c3b('0xa9')]?{'id':_0x35ae36[_0x1c3b('0x44')][_0x1c3b('0xa9')]}:undefined,'required':_0x35ae36[_0x1c3b('0x44')]['tag']?!![]:![]}];}return db[_0x1c3b('0x8e')][_0x1c3b('0x53')](_0x3f541c);})[_0x1c3b('0x36')](function(_0x366d1e){_0x50d630[_0x1c3b('0x6a')]=_0x366d1e;return _0x50d630;});}})[_0x1c3b('0x36')](respondWithFilteredResult(_0x25aaab,_0x3f541c))[_0x1c3b('0x28')](handleError(_0x25aaab,null));};exports[_0x1c3b('0xaa')]=function(_0x48ca7d,_0x1816cb,_0x76ca61){return db[_0x1c3b('0x3d')][_0x1c3b('0x59')]({'where':{'id':_0x48ca7d['params']['id']}})[_0x1c3b('0x36')](handleEntityNotFound(_0x1816cb,null))['then'](function(_0x482c84){if(_0x482c84){return _0x482c84[_0x1c3b('0xaa')](_0x48ca7d['body']['ids'],_['omit'](_0x48ca7d['body'],['ids','id'])||{})[_0x1c3b('0x8f')](function(_0x45b95a){for(var _0x412694=0x0;_0x412694<_0x48ca7d['body'][_0x1c3b('0x6c')][_0x1c3b('0x57')];_0x412694+=0x1){socket[_0x1c3b('0xab')](_0x1c3b('0xac'),{'UserId':Number(_0x48ca7d['body'][_0x1c3b('0x6c')][_0x412694]),'OpenchannelAccountId':Number(_0x48ca7d[_0x1c3b('0x55')]['id'])});}return _0x45b95a;});}})['then'](respondWithResult(_0x1816cb,null))[_0x1c3b('0x28')](handleError(_0x1816cb,null));};exports['removeAgents']=function(_0x52a96c,_0x50924c,_0x9e9a31){return db[_0x1c3b('0x3d')][_0x1c3b('0x59')]({'where':{'id':_0x52a96c[_0x1c3b('0x55')]['id']}})['then'](handleEntityNotFound(_0x50924c,null))[_0x1c3b('0x36')](function(_0x4aa75f){if(_0x4aa75f){return _0x4aa75f[_0x1c3b('0xad')](_0x52a96c[_0x1c3b('0x44')][_0x1c3b('0x6c')])[_0x1c3b('0x36')](function(){if(_[_0x1c3b('0xae')](_0x52a96c[_0x1c3b('0x44')][_0x1c3b('0x6c')])){for(var _0x4b51ff=0x0;_0x4b51ff<_0x52a96c[_0x1c3b('0x44')][_0x1c3b('0x6c')][_0x1c3b('0x57')];_0x4b51ff+=0x1){socket[_0x1c3b('0xab')]('userOpenchannelAccount:remove',{'UserId':Number(_0x52a96c[_0x1c3b('0x44')][_0x1c3b('0x6c')][_0x4b51ff]),'OpenchannelAccountId':Number(_0x52a96c['params']['id'])});}}else{socket[_0x1c3b('0xab')](_0x1c3b('0xaf'),{'UserId':Number(_0x52a96c['query'][_0x1c3b('0x6c')]),'OpenchannelAccountId':Number(_0x52a96c['params']['id'])});}});}})[_0x1c3b('0x36')](respondWithStatusCode(_0x50924c,null))[_0x1c3b('0x28')](handleError(_0x50924c,null));};exports[_0x1c3b('0xb0')]=function(_0x1b7ca4,_0x3c268c,_0x144f5b){var _0x23deeb={};var _0x28e8e9={};var _0x4663cc;var _0x1ee0eb;return db[_0x1c3b('0x3d')][_0x1c3b('0x67')]({'where':{'id':_0x1b7ca4[_0x1c3b('0x55')]['id']}})['then'](handleEntityNotFound(_0x3c268c,null))[_0x1c3b('0x36')](function(_0x513ea0){if(_0x513ea0){_0x4663cc=_0x513ea0;_0x28e8e9['model']=_[_0x1c3b('0x45')](db[_0x1c3b('0xa5')][_0x1c3b('0x3e')]);_0x28e8e9['query']=_[_0x1c3b('0x45')](_0x1b7ca4[_0x1c3b('0x44')]);_0x28e8e9[_0x1c3b('0x46')]=_['intersection'](_0x28e8e9['model'],_0x28e8e9[_0x1c3b('0x44')]);_0x23deeb['attributes']=_[_0x1c3b('0x47')](_0x28e8e9['model'],qs[_0x1c3b('0x49')](_0x1b7ca4[_0x1c3b('0x44')][_0x1c3b('0x49')]));_0x23deeb[_0x1c3b('0x48')]=_0x23deeb[_0x1c3b('0x48')]['length']?_0x23deeb['attributes']:_0x28e8e9[_0x1c3b('0x42')];_0x23deeb[_0x1c3b('0x68')]=qs[_0x1c3b('0x4c')](_0x1b7ca4['query'][_0x1c3b('0x4c')]);_0x23deeb[_0x1c3b('0x4d')]=qs['filters'](_[_0x1c3b('0x69')](_0x1b7ca4[_0x1c3b('0x44')],_0x28e8e9[_0x1c3b('0x46')]));if(_0x1b7ca4['query'][_0x1c3b('0x4e')]){_0x23deeb[_0x1c3b('0x4d')]=_[_0x1c3b('0x58')](_0x23deeb[_0x1c3b('0x4d')],{'$or':_[_0x1c3b('0x43')](_0x23deeb[_0x1c3b('0x48')],function(_0x4c7458){var _0x452829={};_0x452829[_0x4c7458]={'$like':'%'+_0x1b7ca4['query'][_0x1c3b('0x4e')]+'%'};return _0x452829;})});}_0x23deeb=_[_0x1c3b('0x58')]({},_0x23deeb,_0x1b7ca4['options']);return _0x4663cc['getAgents'](_0x23deeb);}})['then'](function(_0x3ff5ee){if(_0x3ff5ee){_0x1ee0eb=_0x3ff5ee['length'];if(!_0x1b7ca4[_0x1c3b('0x44')][_0x1c3b('0x4a')](_0x1c3b('0x4b'))){_0x23deeb[_0x1c3b('0x2d')]=qs['limit'](_0x1b7ca4['query']['limit']);_0x23deeb[_0x1c3b('0x2c')]=qs[_0x1c3b('0x2c')](_0x1b7ca4[_0x1c3b('0x44')][_0x1c3b('0x2c')]);}return _0x4663cc['getAgents'](_0x23deeb);}})[_0x1c3b('0x36')](function(_0x4fca7c){if(_0x4fca7c){return _0x4fca7c?{'count':_0x1ee0eb,'rows':_0x4fca7c}:null;}})[_0x1c3b('0x36')](respondWithResult(_0x3c268c,null))[_0x1c3b('0x28')](handleError(_0x3c268c,null));};exports['send']=function(_0x34540d,_0x530a49,_0xfba7e2){var _0x708a72,_0x2325cb,_0x244c43;if(_[_0x1c3b('0x7a')](_0x34540d['body'][_0x1c3b('0x5b')])||_0x34540d['body'][_0x1c3b('0x5b')]===''){throw new db['Sequelize'][(_0x1c3b('0x7c'))](_0x1c3b('0xb1'));}if(_['isNil'](_0x34540d[_0x1c3b('0x5b')]['to'])){}_0x708a72=_0x34540d[_0x1c3b('0x5b')]['to'];return db[_0x1c3b('0x3d')]['findOne']({'where':{'id':_0x34540d[_0x1c3b('0x55')]['id']}})['then'](handleEntityNotFound(_0x530a49,null))[_0x1c3b('0x36')](function(_0x2c1854){if(_0x2c1854){return db[_0x1c3b('0x3d')][_0x1c3b('0x59')]({'where':{'id':_0x2c1854['id']},'include':[{'model':db[_0x1c3b('0xb2')],'as':_0x1c3b('0x82'),'include':[{'model':db['CmContact'],'as':_0x1c3b('0x7f'),'where':{[_0x2c1854['mapKey']]:_0x708a72},'limit':0x1,'order':[['updatedAt',_0x1c3b('0x80')]]}]}]})['then'](handleEntityNotFound(_0x530a49,null))['then'](function(_0x4a2d64){if(_0x4a2d64&&_0x4a2d64['List']){_0x2325cb=_0x4a2d64[_0x1c3b('0x37')]({'plain':!![]});if(_0x2325cb['List']&&_0x2325cb[_0x1c3b('0x82')][_0x1c3b('0x7f')]['length']){return _0x2325cb[_0x1c3b('0x82')]['Contacts'][0x0];}return db[_0x1c3b('0x72')]['create'](_[_0x1c3b('0x19')](_0x34540d[_0x1c3b('0x5b')],{'firstName':_0x708a72,[_0x4a2d64[_0x1c3b('0x88')]]:_0x708a72,'phone':_0x708a72,'ListId':_0x2325cb[_0x1c3b('0x79')]}));}})['then'](handleEntityNotFound(_0x530a49,null))['then'](function(_0x53c476){if(_0x53c476){_0x244c43=_0x53c476;return db[_0x1c3b('0x8e')]['find']({'where':{'ContactId':_0x244c43['id'],'closed':![],'OpenchannelAccountId':_0x2325cb['id']}})[_0x1c3b('0x36')](function(_0x111c85){if(_0x111c85){return[_0x111c85,![]];}return db['OpenchannelInteraction'][_0x1c3b('0x5a')]({'UserId':_0x34540d['user']['id'],'ContactId':_0x244c43['id'],'OpenchannelAccountId':_0x2325cb['id'],'lastMsgDirection':_0x1c3b('0xb3'),'Messages':[_[_0x1c3b('0x58')](_0x34540d[_0x1c3b('0x5b')],{'read':![],'body':_0x34540d['body'][_0x1c3b('0x5b')],'OpenchannelAccountId':_0x2325cb['id'],'UserId':_0x34540d[_0x1c3b('0x5c')]['id'],'ContactId':_0x244c43['id']})]},{'include':[{'model':db[_0x1c3b('0x96')],'as':_0x1c3b('0xb4')}]})[_0x1c3b('0x36')](function(_0x342e74){return[_0x342e74,!![]];});});}})['spread'](function(_0x4c1e95,_0x17533a){if(_0x17533a){return _0x4c1e95;}return db[_0x1c3b('0x96')][_0x1c3b('0x5a')](_[_0x1c3b('0x58')](_0x34540d[_0x1c3b('0x5b')],{'read':![],'body':_0x34540d[_0x1c3b('0x5b')][_0x1c3b('0x5b')],'OpenchannelAccountId':_0x2325cb['id'],'OpenchannelInteractionId':_0x4c1e95['id'],'UserId':_0x34540d['user']['id'],'ContactId':_0x244c43['id']}))['then'](function(_0x1716f8){_0x4c1e95[_0x1c3b('0xb5')][_0x1c3b('0xb4')]=[];_0x4c1e95[_0x1c3b('0xb5')]['Messages'][_0x1c3b('0x94')](_0x1716f8[_0x1c3b('0xb5')]);return _0x4c1e95;});});}})[_0x1c3b('0x36')](respondWithResult(_0x530a49,null))[_0x1c3b('0x28')](handleError(_0x530a49,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index 6d81f24..acafa6a 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 _0x70e0=['emit','events','../../mysqldb','OpenchannelAccount','update','remove'];(function(_0x1d3047,_0x15466a){var _0x37b7a2=function(_0x183825){while(--_0x183825){_0x1d3047['push'](_0x1d3047['shift']());}};_0x37b7a2(++_0x15466a);}(_0x70e0,0x17b));var _0x070e=function(_0x539250,_0x49ca3e){_0x539250=_0x539250-0x0;var _0x34e1d0=_0x70e0[_0x539250];return _0x34e1d0;};'use strict';var EventEmitter=require(_0x070e('0x0'));var OpenchannelAccount=require(_0x070e('0x1'))['db'][_0x070e('0x2')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x070e('0x3'),'afterDestroy':_0x070e('0x4')};function emitEvent(_0x277d32){return function(_0x2593e5,_0x5c90fc,_0x7bce9b){OpenchannelAccountEvents['emit'](_0x277d32+':'+_0x2593e5['id'],_0x2593e5);OpenchannelAccountEvents[_0x070e('0x5')](_0x277d32,_0x2593e5);_0x7bce9b(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelAccount['hook'](e,emitEvent(event));}}module['exports']=OpenchannelAccountEvents; \ No newline at end of file +var _0x0bb5=['events','../../mysqldb','save','update','remove','emit','hook','exports'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0x0bb5,0x148));var _0x50bb=function(_0x38aed0,_0x29d056){_0x38aed0=_0x38aed0-0x0;var _0x48526e=_0x0bb5[_0x38aed0];return _0x48526e;};'use strict';var EventEmitter=require(_0x50bb('0x0'));var OpenchannelAccount=require(_0x50bb('0x1'))['db']['OpenchannelAccount'];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x50bb('0x2'),'afterUpdate':_0x50bb('0x3'),'afterDestroy':_0x50bb('0x4')};function emitEvent(_0x117e36){return function(_0x29c72b,_0xfdc9d4,_0x451b4c){OpenchannelAccountEvents[_0x50bb('0x5')](_0x117e36+':'+_0x29c72b['id'],_0x29c72b);OpenchannelAccountEvents['emit'](_0x117e36,_0x29c72b);_0x451b4c(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelAccount[_0x50bb('0x6')](e,emitEvent(event));}}module[_0x50bb('0x7')]=OpenchannelAccountEvents; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.model.js b/server/api/openchannelAccount/openchannelAccount.model.js index ab41144..3c2a5d2 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(_0xbcbf80,_0x112fdc){var _0x591bed=function(_0x2dfc70){while(--_0x2dfc70){_0xbcbf80['push'](_0xbcbf80['shift']());}};_0x591bed(++_0x112fdc);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1b349a,_0x22222c){_0x1b349a=_0x1b349a-0x0;var _0x5d1f7c=_0xa9e0[_0x1b349a];return _0x5d1f7c;};'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(_0xdfdf21,_0x112e7d){var _0x41cb81=function(_0x578ccb){while(--_0x578ccb){_0xdfdf21['push'](_0xdfdf21['shift']());}};_0x41cb81(++_0x112e7d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x36dfbd,_0x5bfe2d){_0x36dfbd=_0x36dfbd-0x0;var _0x4ecad9=_0xa9e0[_0x36dfbd];return _0x4ecad9;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'openchannel_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.rpc.js b/server/api/openchannelAccount/openchannelAccount.rpc.js index 84a5ac9..b5d95ba 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 _0x6c76=['error','code','message','result','lodash','util','moment','randomstring','ioredis','../../config/logger','rpc','jayson/promise','client','redis','localhost','socket.io-emitter','register','request','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify'];(function(_0xb24a3e,_0x4a3594){var _0x4038d7=function(_0x1ea3c3){while(--_0x1ea3c3){_0xb24a3e['push'](_0xb24a3e['shift']());}};_0x4038d7(++_0x4a3594);}(_0x6c76,0x184));var _0x66c7=function(_0x2a725d,_0x2466f5){_0x2a725d=_0x2a725d-0x0;var _0x1d7453=_0x6c76[_0x2a725d];return _0x1d7453;};'use strict';var _=require(_0x66c7('0x0'));var util=require(_0x66c7('0x1'));var moment=require(_0x66c7('0x2'));var BPromise=require('bluebird');var rs=require(_0x66c7('0x3'));var fs=require('fs');var Redis=require(_0x66c7('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x66c7('0x5'))(_0x66c7('0x6'));var config=require('../../config/environment');var jayson=require(_0x66c7('0x7'));var client=jayson[_0x66c7('0x8')]['http']({'port':0x232a});config[_0x66c7('0x9')]=_['defaults'](config['redis'],{'host':_0x66c7('0xa'),'port':0x18eb});var socket=require(_0x66c7('0xb'))(new Redis(config[_0x66c7('0x9')]));require('./openchannelAccount.socket')[_0x66c7('0xc')](socket);function respondWithRpcPromise(_0xbc35d9,_0xf44e2,_0x2fff5e){return new BPromise(function(_0x492634,_0x464085){return client[_0x66c7('0xd')](_0xbc35d9,_0x2fff5e)[_0x66c7('0xe')](function(_0x187e00){logger[_0x66c7('0xf')](_0x66c7('0x10'),_0xf44e2,_0x66c7('0x11'));logger['debug'](_0x66c7('0x12'),_0xf44e2,_0x66c7('0x11'),JSON[_0x66c7('0x13')](_0x187e00));if(_0x187e00[_0x66c7('0x14')]){if(_0x187e00[_0x66c7('0x14')][_0x66c7('0x15')]===0x1f4){logger[_0x66c7('0x14')](_0x66c7('0x10'),_0xf44e2,_0x187e00[_0x66c7('0x14')]['message']);return _0x464085(_0x187e00[_0x66c7('0x14')]['message']);}logger[_0x66c7('0x14')](_0x66c7('0x10'),_0xf44e2,_0x187e00[_0x66c7('0x14')][_0x66c7('0x16')]);return _0x492634(_0x187e00[_0x66c7('0x14')]['message']);}else{logger['info']('OpenchannelAccount,\x20%s,\x20%s',_0xf44e2,'request\x20sent');_0x492634(_0x187e00[_0x66c7('0x17')][_0x66c7('0x16')]);}})['catch'](function(_0x524e87){logger[_0x66c7('0x14')](_0x66c7('0x10'),_0xf44e2,_0x524e87);_0x464085(_0x524e87);});});} \ No newline at end of file +var _0xeffd=['redis','defaults','localhost','socket.io-emitter','./openchannelAccount.socket','register','request','then','info','OpenchannelAccount,\x20%s,\x20%s','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x1c546c,_0x5c57cb){var _0x2cc384=function(_0x4dee11){while(--_0x4dee11){_0x1c546c['push'](_0x1c546c['shift']());}};_0x2cc384(++_0x5c57cb);}(_0xeffd,0x6b));var _0xdeff=function(_0x2edf1d,_0x195f6){_0x2edf1d=_0x2edf1d-0x0;var _0x1cca03=_0xeffd[_0x2edf1d];return _0x1cca03;};'use strict';var _=require(_0xdeff('0x0'));var util=require('util');var moment=require(_0xdeff('0x1'));var BPromise=require(_0xdeff('0x2'));var rs=require(_0xdeff('0x3'));var fs=require('fs');var Redis=require(_0xdeff('0x4'));var db=require(_0xdeff('0x5'))['db'];var utils=require(_0xdeff('0x6'));var logger=require(_0xdeff('0x7'))(_0xdeff('0x8'));var config=require(_0xdeff('0x9'));var jayson=require(_0xdeff('0xa'));var client=jayson[_0xdeff('0xb')][_0xdeff('0xc')]({'port':0x232a});config[_0xdeff('0xd')]=_[_0xdeff('0xe')](config[_0xdeff('0xd')],{'host':_0xdeff('0xf'),'port':0x18eb});var socket=require(_0xdeff('0x10'))(new Redis(config['redis']));require(_0xdeff('0x11'))[_0xdeff('0x12')](socket);function respondWithRpcPromise(_0xf6d58d,_0x51fcb7,_0x1ff265){return new BPromise(function(_0x4423e9,_0x3c1482){return client[_0xdeff('0x13')](_0xf6d58d,_0x1ff265)[_0xdeff('0x14')](function(_0x256b73){logger[_0xdeff('0x15')](_0xdeff('0x16'),_0x51fcb7,'request\x20sent');logger[_0xdeff('0x17')](_0xdeff('0x18'),_0x51fcb7,'request\x20sent',JSON[_0xdeff('0x19')](_0x256b73));if(_0x256b73['error']){if(_0x256b73['error'][_0xdeff('0x1a')]===0x1f4){logger[_0xdeff('0x1b')](_0xdeff('0x16'),_0x51fcb7,_0x256b73[_0xdeff('0x1b')]['message']);return _0x3c1482(_0x256b73[_0xdeff('0x1b')][_0xdeff('0x1c')]);}logger[_0xdeff('0x1b')](_0xdeff('0x16'),_0x51fcb7,_0x256b73[_0xdeff('0x1b')][_0xdeff('0x1c')]);return _0x4423e9(_0x256b73['error']['message']);}else{logger[_0xdeff('0x15')]('OpenchannelAccount,\x20%s,\x20%s',_0x51fcb7,'request\x20sent');_0x4423e9(_0x256b73[_0xdeff('0x1d')][_0xdeff('0x1c')]);}})['catch'](function(_0x2de203){logger[_0xdeff('0x1b')](_0xdeff('0x16'),_0x51fcb7,_0x2de203);_0x3c1482(_0x2de203);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index d452021..29deeb7 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 _0xa854=['./openchannelAccount.events','save','remove','update','removeListener','register','openchannelAccount:'];(function(_0x43d11d,_0xccff91){var _0x38cd08=function(_0x131ae2){while(--_0x131ae2){_0x43d11d['push'](_0x43d11d['shift']());}};_0x38cd08(++_0xccff91);}(_0xa854,0x103));var _0x4a85=function(_0x2df0a,_0x5cbd2e){_0x2df0a=_0x2df0a-0x0;var _0x47c013=_0xa854[_0x2df0a];return _0x47c013;};'use strict';var OpenchannelAccountEvents=require(_0x4a85('0x0'));var events=[_0x4a85('0x1'),_0x4a85('0x2'),_0x4a85('0x3')];function createListener(_0x3f3ec2,_0x491f7c){return function(_0x135ea5){_0x491f7c['emit'](_0x3f3ec2,_0x135ea5);};}function removeListener(_0x388052,_0x5bd2dd){return function(){OpenchannelAccountEvents[_0x4a85('0x4')](_0x388052,_0x5bd2dd);};}exports[_0x4a85('0x5')]=function(_0x494d91){for(var _0x445a95=0x0,_0x142b27=events['length'];_0x445a95<_0x142b27;_0x445a95++){var _0xb1605c=events[_0x445a95];var _0x507c59=createListener(_0x4a85('0x6')+_0xb1605c,_0x494d91);OpenchannelAccountEvents['on'](_0xb1605c,_0x507c59);}}; \ No newline at end of file +var _0xd691=['save','remove','emit','removeListener','register','openchannelAccount:','./openchannelAccount.events'];(function(_0x2a0bf3,_0x7f7285){var _0x519364=function(_0x4b6b98){while(--_0x4b6b98){_0x2a0bf3['push'](_0x2a0bf3['shift']());}};_0x519364(++_0x7f7285);}(_0xd691,0xe6));var _0x1d69=function(_0x1ca9a0,_0x17be2b){_0x1ca9a0=_0x1ca9a0-0x0;var _0x4a80d6=_0xd691[_0x1ca9a0];return _0x4a80d6;};'use strict';var OpenchannelAccountEvents=require(_0x1d69('0x0'));var events=[_0x1d69('0x1'),_0x1d69('0x2'),'update'];function createListener(_0x468419,_0x44899f){return function(_0x32502d){_0x44899f[_0x1d69('0x3')](_0x468419,_0x32502d);};}function removeListener(_0x1fbb5e,_0x2228be){return function(){OpenchannelAccountEvents[_0x1d69('0x4')](_0x1fbb5e,_0x2228be);};}exports[_0x1d69('0x5')]=function(_0xdbf1f2){for(var _0x3b36f5=0x0,_0x5a5b0c=events['length'];_0x3b36f5<_0x5a5b0c;_0x3b36f5++){var _0x267da3=events[_0x3b36f5];var _0x49f008=createListener(_0x1d69('0x6')+_0x267da3,_0xdbf1f2);OpenchannelAccountEvents['on'](_0x267da3,_0x49f008);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index 4f3a175..2bc02f9 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 _0xbc11=['../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','post','put','delete','multer','path','Router','../../components/auth/service'];(function(_0x166d93,_0x301f09){var _0xba708=function(_0x349bf7){while(--_0x349bf7){_0x166d93['push'](_0x166d93['shift']());}};_0xba708(++_0x301f09);}(_0xbc11,0x15b));var _0x1bc1=function(_0x51480e,_0x46794e){_0x51480e=_0x51480e-0x0;var _0x5596f0=_0xbc11[_0x51480e];return _0x5596f0;};'use strict';var multer=require(_0x1bc1('0x0'));var util=require('util');var path=require(_0x1bc1('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x1bc1('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x1bc1('0x3'));var interaction=require(_0x1bc1('0x4'));var config=require(_0x1bc1('0x5'));var controller=require('./openchannelApplication.controller');router[_0x1bc1('0x6')]('/',auth[_0x1bc1('0x7')](),controller[_0x1bc1('0x8')]);router[_0x1bc1('0x6')](_0x1bc1('0x9'),auth[_0x1bc1('0x7')](),controller['show']);router[_0x1bc1('0xa')]('/',auth['isAuthenticated'](),controller['create']);router[_0x1bc1('0xb')](_0x1bc1('0x9'),auth[_0x1bc1('0x7')](),controller['update']);router[_0x1bc1('0xc')]('/:id',auth[_0x1bc1('0x7')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x4c24=['../../config/environment','./openchannelApplication.controller','get','isAuthenticated','index','show','post','create','put','delete','/:id','destroy','exports','multer','util','express','fs-extra','../../components/interaction/service'];(function(_0x2baf40,_0x5ebef2){var _0x2bb2cb=function(_0x1a3fc1){while(--_0x1a3fc1){_0x2baf40['push'](_0x2baf40['shift']());}};_0x2bb2cb(++_0x5ebef2);}(_0x4c24,0x1e1));var _0x44c2=function(_0x2e7002,_0x217835){_0x2e7002=_0x2e7002-0x0;var _0x2cae37=_0x4c24[_0x2e7002];return _0x2cae37;};'use strict';var multer=require(_0x44c2('0x0'));var util=require(_0x44c2('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x44c2('0x2'));var router=express['Router']();var fs_extra=require(_0x44c2('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x44c2('0x4'));var config=require(_0x44c2('0x5'));var controller=require(_0x44c2('0x6'));router[_0x44c2('0x7')]('/',auth[_0x44c2('0x8')](),controller[_0x44c2('0x9')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x44c2('0xa')]);router[_0x44c2('0xb')]('/',auth['isAuthenticated'](),controller[_0x44c2('0xc')]);router[_0x44c2('0xd')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x44c2('0xe')](_0x44c2('0xf'),auth[_0x44c2('0x8')](),controller[_0x44c2('0x10')]);module[_0x44c2('0x11')]=router; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.attributes.js b/server/api/openchannelApplication/openchannelApplication.attributes.js index 6b566c1..291fe43 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 _0x6d7f=['exports','INTEGER','STRING','noop','*,*,*,*','sequelize'];(function(_0x446b0b,_0xac072f){var _0x303277=function(_0x5218e2){while(--_0x5218e2){_0x446b0b['push'](_0x446b0b['shift']());}};_0x303277(++_0xac072f);}(_0x6d7f,0xb3));var _0xf6d7=function(_0x32cd19,_0x274085){_0x32cd19=_0x32cd19-0x0;var _0xd696d5=_0x6d7f[_0x32cd19];return _0xd696d5;};'use strict';var Sequelize=require(_0xf6d7('0x0'));module[_0xf6d7('0x1')]={'priority':{'type':Sequelize[_0xf6d7('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xf6d7('0x3')],'allowNull':![],'defaultValue':_0xf6d7('0x4')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xf6d7('0x3')],'defaultValue':_0xf6d7('0x5')}}; \ No newline at end of file +var _0x8ed7=['noop','TEXT','*,*,*,*','sequelize','INTEGER','STRING'];(function(_0x29a91c,_0x5ac2c5){var _0x2ab4ff=function(_0x47fee7){while(--_0x47fee7){_0x29a91c['push'](_0x29a91c['shift']());}};_0x2ab4ff(++_0x5ac2c5);}(_0x8ed7,0x8d));var _0x78ed=function(_0x481413,_0x5d08ce){_0x481413=_0x481413-0x0;var _0xc1449a=_0x8ed7[_0x481413];return _0xc1449a;};'use strict';var Sequelize=require(_0x78ed('0x0'));module['exports']={'priority':{'type':Sequelize[_0x78ed('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x78ed('0x2')],'allowNull':![],'defaultValue':_0x78ed('0x3')},'appdata':{'type':Sequelize[_0x78ed('0x4')]()},'description':{'type':Sequelize[_0x78ed('0x2')]},'interval':{'type':Sequelize[_0x78ed('0x2')],'defaultValue':_0x78ed('0x5')}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index 8f7bc15..f28b33a 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 _0x543f=['api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','limit','undefined','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','OpenchannelApplication','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','merge','options','count','includeAll','include','findAll','catch','show','params','length','create','body','find','rimraf','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch'];(function(_0x4186a5,_0x1e2024){var _0x5c93bd=function(_0x48b85f){while(--_0x48b85f){_0x4186a5['push'](_0x4186a5['shift']());}};_0x5c93bd(++_0x1e2024);}(_0x543f,0x1b5));var _0xf543=function(_0x5392fa,_0x5be966){_0x5392fa=_0x5392fa-0x0;var _0x1b38f6=_0x543f[_0x5392fa];return _0x1b38f6;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf543('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf543('0x1'));var rp=require(_0xf543('0x2'));var moment=require(_0xf543('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xf543('0x4'));var util=require(_0xf543('0x5'));var path=require('path');var sox=require(_0xf543('0x6'));var csv=require(_0xf543('0x7'));var ejs=require(_0xf543('0x8'));var fs=require('fs');var fs_extra=require(_0xf543('0x9'));var _=require(_0xf543('0xa'));var squel=require(_0xf543('0xb'));var crypto=require(_0xf543('0xc'));var jsforce=require(_0xf543('0xd'));var deskjs=require(_0xf543('0xe'));var toCsv=require('to-csv');var querystring=require(_0xf543('0xf'));var Papa=require(_0xf543('0x10'));var Redis=require(_0xf543('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xf543('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xf543('0x13'));var utils=require(_0xf543('0x14'));var config=require(_0xf543('0x15'));var licenseUtil=require(_0xf543('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x403681,_0x4470b1){_0x4470b1=_0x4470b1||0xcc;return function(_0x45b3d4){if(_0x45b3d4){return _0x403681[_0xf543('0x17')](_0x4470b1);}return _0x403681[_0xf543('0x18')](_0x4470b1)[_0xf543('0x19')]();};}function respondWithResult(_0x5ba29a,_0x135124){_0x135124=_0x135124||0xc8;return function(_0x4e547c){if(_0x4e547c){return _0x5ba29a['status'](_0x135124)[_0xf543('0x1a')](_0x4e547c);}};}function respondWithFilteredResult(_0x2ff67e,_0x44cd79){return function(_0x58c89d){if(_0x58c89d){var _0xd7f89e=typeof _0x44cd79[_0xf543('0x1b')]==='undefined'&&typeof _0x44cd79[_0xf543('0x1c')]===_0xf543('0x1d');var _0x5ad118=_0x58c89d['count'];var _0x284aa8=_0xd7f89e?0x0:_0x44cd79[_0xf543('0x1b')];var _0x12b878=_0xd7f89e?_0x58c89d['count']:_0x44cd79[_0xf543('0x1b')]+_0x44cd79['limit'];var _0x4e6104;if(_0x12b878>=_0x5ad118){_0x12b878=_0x5ad118;_0x4e6104=0xc8;}else{_0x4e6104=0xce;}_0x2ff67e[_0xf543('0x18')](_0x4e6104);return _0x2ff67e[_0xf543('0x1e')](_0xf543('0x1f'),_0x284aa8+'-'+_0x12b878+'/'+_0x5ad118)[_0xf543('0x1a')](_0x58c89d);}return null;};}function patchUpdates(_0x247847){return function(_0x588f21){try{jsonpatch[_0xf543('0x20')](_0x588f21,_0x247847,!![]);}catch(_0x338e53){return BPromise[_0xf543('0x21')](_0x338e53);}return _0x588f21[_0xf543('0x22')]();};}function saveUpdates(_0x486637,_0x11e6bb){return function(_0x1586d4){if(_0x1586d4){return _0x1586d4[_0xf543('0x23')](_0x486637)[_0xf543('0x24')](function(_0x46fad9){return _0x46fad9;});}return null;};}function removeEntity(_0x25dfc9,_0x298806){return function(_0x1d72a9){if(_0x1d72a9){return _0x1d72a9[_0xf543('0x25')]()[_0xf543('0x24')](function(){_0x25dfc9[_0xf543('0x18')](0xcc)[_0xf543('0x19')]();});}};}function handleEntityNotFound(_0x1a5f12,_0x25efe3){return function(_0x40e4b0){if(!_0x40e4b0){_0x1a5f12[_0xf543('0x17')](0x194);}return _0x40e4b0;};}function handleError(_0x136250,_0x30949a){_0x30949a=_0x30949a||0x1f4;return function(_0x2f4024){logger[_0xf543('0x26')](_0x2f4024[_0xf543('0x27')]);if(_0x2f4024[_0xf543('0x28')]){delete _0x2f4024[_0xf543('0x28')];}_0x136250[_0xf543('0x18')](_0x30949a)[_0xf543('0x29')](_0x2f4024);};}exports[_0xf543('0x2a')]=function(_0x33af94,_0xcfa7ca){var _0x1ebde9={},_0x403f70={},_0x4efb60={'count':0x0,'rows':[]};var _0x1a01e1=_[_0xf543('0x2b')](db[_0xf543('0x2c')][_0xf543('0x2d')],function(_0x107d93){return{'name':_0x107d93[_0xf543('0x2e')],'type':_0x107d93[_0xf543('0x2f')][_0xf543('0x30')]};});_0x403f70[_0xf543('0x31')]=_[_0xf543('0x2b')](_0x1a01e1,_0xf543('0x28'));_0x403f70['query']=_[_0xf543('0x32')](_0x33af94[_0xf543('0x33')]);_0x403f70[_0xf543('0x34')]=_[_0xf543('0x35')](_0x403f70[_0xf543('0x31')],_0x403f70[_0xf543('0x33')]);_0x1ebde9['attributes']=_[_0xf543('0x35')](_0x403f70[_0xf543('0x31')],qs['fields'](_0x33af94[_0xf543('0x33')][_0xf543('0x36')]));_0x1ebde9[_0xf543('0x37')]=_0x1ebde9[_0xf543('0x37')]['length']?_0x1ebde9[_0xf543('0x37')]:_0x403f70[_0xf543('0x31')];if(!_0x33af94[_0xf543('0x33')][_0xf543('0x38')]('nolimit')){_0x1ebde9[_0xf543('0x1c')]=qs[_0xf543('0x1c')](_0x33af94['query'][_0xf543('0x1c')]);_0x1ebde9[_0xf543('0x1b')]=qs['offset'](_0x33af94[_0xf543('0x33')][_0xf543('0x1b')]);}_0x1ebde9[_0xf543('0x39')]=qs[_0xf543('0x3a')](_0x33af94['query']['sort']);_0x1ebde9[_0xf543('0x3b')]=qs[_0xf543('0x34')](_[_0xf543('0x3c')](_0x33af94[_0xf543('0x33')],_0x403f70[_0xf543('0x34')]),_0x1a01e1);if(_0x33af94[_0xf543('0x33')][_0xf543('0x3d')]){_0x1ebde9[_0xf543('0x3b')]=_['merge'](_0x1ebde9[_0xf543('0x3b')],{'$or':_[_0xf543('0x2b')](_0x1a01e1,function(_0x3807a1){if(_0x3807a1[_0xf543('0x2f')]!==_0xf543('0x3e')){var _0x421a10={};_0x421a10[_0x3807a1[_0xf543('0x28')]]={'$like':'%'+_0x33af94[_0xf543('0x33')][_0xf543('0x3d')]+'%'};return _0x421a10;}})});}_0x1ebde9=_[_0xf543('0x3f')]({},_0x1ebde9,_0x33af94[_0xf543('0x40')]);var _0x1cbc47={'where':_0x1ebde9[_0xf543('0x3b')]};return db['OpenchannelApplication'][_0xf543('0x41')](_0x1cbc47)['then'](function(_0x39ffe8){_0x4efb60['count']=_0x39ffe8;if(_0x33af94[_0xf543('0x33')][_0xf543('0x42')]){_0x1ebde9[_0xf543('0x43')]=[{'all':!![]}];}return db[_0xf543('0x2c')][_0xf543('0x44')](_0x1ebde9);})[_0xf543('0x24')](function(_0x56e7d2){_0x4efb60['rows']=_0x56e7d2;return _0x4efb60;})['then'](respondWithFilteredResult(_0xcfa7ca,_0x1ebde9))[_0xf543('0x45')](handleError(_0xcfa7ca,null));};exports[_0xf543('0x46')]=function(_0x1a0ca5,_0x26d910){var _0x5e440d={'raw':!![],'where':{'id':_0x1a0ca5[_0xf543('0x47')]['id']}},_0x368c9b={};_0x368c9b['model']=_['keys'](db['OpenchannelApplication']['rawAttributes']);_0x368c9b[_0xf543('0x33')]=_[_0xf543('0x32')](_0x1a0ca5[_0xf543('0x33')]);_0x368c9b[_0xf543('0x34')]=_['intersection'](_0x368c9b[_0xf543('0x31')],_0x368c9b['query']);_0x5e440d['attributes']=_['intersection'](_0x368c9b[_0xf543('0x31')],qs[_0xf543('0x36')](_0x1a0ca5[_0xf543('0x33')][_0xf543('0x36')]));_0x5e440d['attributes']=_0x5e440d[_0xf543('0x37')][_0xf543('0x48')]?_0x5e440d['attributes']:_0x368c9b[_0xf543('0x31')];if(_0x1a0ca5[_0xf543('0x33')][_0xf543('0x42')]){_0x5e440d[_0xf543('0x43')]=[{'all':!![]}];}_0x5e440d=_[_0xf543('0x3f')]({},_0x5e440d,_0x1a0ca5[_0xf543('0x40')]);return db[_0xf543('0x2c')]['find'](_0x5e440d)[_0xf543('0x24')](handleEntityNotFound(_0x26d910,null))['then'](respondWithResult(_0x26d910,null))[_0xf543('0x45')](handleError(_0x26d910,null));};exports[_0xf543('0x49')]=function(_0x93b423,_0x300a36){return db[_0xf543('0x2c')][_0xf543('0x49')](_0x93b423['body'],{})['then'](respondWithResult(_0x300a36,0xc9))[_0xf543('0x45')](handleError(_0x300a36,null));};exports[_0xf543('0x23')]=function(_0xb225fd,_0x27870a){if(_0xb225fd[_0xf543('0x4a')]['id']){delete _0xb225fd[_0xf543('0x4a')]['id'];}return db[_0xf543('0x2c')][_0xf543('0x4b')]({'where':{'id':_0xb225fd['params']['id']}})[_0xf543('0x24')](handleEntityNotFound(_0x27870a,null))['then'](saveUpdates(_0xb225fd[_0xf543('0x4a')],null))['then'](respondWithResult(_0x27870a,null))[_0xf543('0x45')](handleError(_0x27870a,null));};exports[_0xf543('0x25')]=function(_0x10fee7,_0x186277){return db[_0xf543('0x2c')][_0xf543('0x4b')]({'where':{'id':_0x10fee7[_0xf543('0x47')]['id']}})[_0xf543('0x24')](handleEntityNotFound(_0x186277,null))[_0xf543('0x24')](removeEntity(_0x186277,null))[_0xf543('0x45')](handleError(_0x186277,null));}; \ No newline at end of file +var _0x8013=['sendStatus','end','status','json','offset','undefined','limit','count','set','reject','save','update','destroy','then','error','stack','name','map','rawAttributes','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','filter','merge','options','include','OpenchannelApplication','findAll','rows','catch','params','find','create','body','rimraf','zip-dir','fast-json-patch','moment','path','sox','ejs','fs-extra','lodash','crypto','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb'];(function(_0x360697,_0x44badc){var _0xd4fe69=function(_0xd2bf65){while(--_0xd2bf65){_0x360697['push'](_0x360697['shift']());}};_0xd4fe69(++_0x44badc);}(_0x8013,0x17c));var _0x3801=function(_0x404b0e,_0x18b2e4){_0x404b0e=_0x404b0e-0x0;var _0x5638dd=_0x8013[_0x404b0e];return _0x5638dd;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3801('0x0'));var zipdir=require(_0x3801('0x1'));var jsonpatch=require(_0x3801('0x2'));var rp=require('request-promise');var moment=require(_0x3801('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x3801('0x4'));var sox=require(_0x3801('0x5'));var csv=require('to-csv');var ejs=require(_0x3801('0x6'));var fs=require('fs');var fs_extra=require(_0x3801('0x7'));var _=require(_0x3801('0x8'));var squel=require('squel');var crypto=require(_0x3801('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x3801('0xa'));var toCsv=require(_0x3801('0xb'));var querystring=require(_0x3801('0xc'));var Papa=require(_0x3801('0xd'));var Redis=require('ioredis');var authService=require(_0x3801('0xe'));var qs=require(_0x3801('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x3801('0x10'))(_0x3801('0x11'));var utils=require(_0x3801('0x12'));var config=require(_0x3801('0x13'));var licenseUtil=require(_0x3801('0x14'));var db=require(_0x3801('0x15'))['db'];function respondWithStatusCode(_0x482554,_0x4a459f){_0x4a459f=_0x4a459f||0xcc;return function(_0x483314){if(_0x483314){return _0x482554[_0x3801('0x16')](_0x4a459f);}return _0x482554['status'](_0x4a459f)[_0x3801('0x17')]();};}function respondWithResult(_0x456d3d,_0x5b4cb2){_0x5b4cb2=_0x5b4cb2||0xc8;return function(_0xe7371e){if(_0xe7371e){return _0x456d3d[_0x3801('0x18')](_0x5b4cb2)[_0x3801('0x19')](_0xe7371e);}};}function respondWithFilteredResult(_0x1807c7,_0x35bb2e){return function(_0x9f1ec7){if(_0x9f1ec7){var _0xdbb7ee=typeof _0x35bb2e[_0x3801('0x1a')]===_0x3801('0x1b')&&typeof _0x35bb2e[_0x3801('0x1c')]===_0x3801('0x1b');var _0x59e78f=_0x9f1ec7[_0x3801('0x1d')];var _0x18c82e=_0xdbb7ee?0x0:_0x35bb2e[_0x3801('0x1a')];var _0x4bdaa0=_0xdbb7ee?_0x9f1ec7['count']:_0x35bb2e['offset']+_0x35bb2e[_0x3801('0x1c')];var _0x3e5e27;if(_0x4bdaa0>=_0x59e78f){_0x4bdaa0=_0x59e78f;_0x3e5e27=0xc8;}else{_0x3e5e27=0xce;}_0x1807c7[_0x3801('0x18')](_0x3e5e27);return _0x1807c7[_0x3801('0x1e')]('Content-Range',_0x18c82e+'-'+_0x4bdaa0+'/'+_0x59e78f)['json'](_0x9f1ec7);}return null;};}function patchUpdates(_0x1a3ff0){return function(_0x1fd72d){try{jsonpatch['apply'](_0x1fd72d,_0x1a3ff0,!![]);}catch(_0x1c99ba){return BPromise[_0x3801('0x1f')](_0x1c99ba);}return _0x1fd72d[_0x3801('0x20')]();};}function saveUpdates(_0x404413,_0x55c20b){return function(_0x34cad3){if(_0x34cad3){return _0x34cad3[_0x3801('0x21')](_0x404413)['then'](function(_0x3ac70e){return _0x3ac70e;});}return null;};}function removeEntity(_0x132f65,_0x459695){return function(_0x302479){if(_0x302479){return _0x302479[_0x3801('0x22')]()[_0x3801('0x23')](function(){_0x132f65[_0x3801('0x18')](0xcc)[_0x3801('0x17')]();});}};}function handleEntityNotFound(_0x19dc01,_0x1d980d){return function(_0x5cb587){if(!_0x5cb587){_0x19dc01[_0x3801('0x16')](0x194);}return _0x5cb587;};}function handleError(_0x3f052c,_0x49436b){_0x49436b=_0x49436b||0x1f4;return function(_0x3d3de0){logger[_0x3801('0x24')](_0x3d3de0[_0x3801('0x25')]);if(_0x3d3de0[_0x3801('0x26')]){delete _0x3d3de0[_0x3801('0x26')];}_0x3f052c[_0x3801('0x18')](_0x49436b)['send'](_0x3d3de0);};}exports['index']=function(_0x3ff64b,_0x28fb1e){var _0xb71339={},_0x3fdb18={},_0x5d90e9={'count':0x0,'rows':[]};var _0x6eb0ca=_[_0x3801('0x27')](db['OpenchannelApplication'][_0x3801('0x28')],function(_0x43baca){return{'name':_0x43baca['fieldName'],'type':_0x43baca[_0x3801('0x29')][_0x3801('0x2a')]};});_0x3fdb18[_0x3801('0x2b')]=_[_0x3801('0x27')](_0x6eb0ca,'name');_0x3fdb18[_0x3801('0x2c')]=_[_0x3801('0x2d')](_0x3ff64b['query']);_0x3fdb18[_0x3801('0x2e')]=_['intersection'](_0x3fdb18['model'],_0x3fdb18[_0x3801('0x2c')]);_0xb71339[_0x3801('0x2f')]=_[_0x3801('0x30')](_0x3fdb18['model'],qs[_0x3801('0x31')](_0x3ff64b['query'][_0x3801('0x31')]));_0xb71339[_0x3801('0x2f')]=_0xb71339['attributes'][_0x3801('0x32')]?_0xb71339['attributes']:_0x3fdb18[_0x3801('0x2b')];if(!_0x3ff64b[_0x3801('0x2c')][_0x3801('0x33')]('nolimit')){_0xb71339[_0x3801('0x1c')]=qs[_0x3801('0x1c')](_0x3ff64b[_0x3801('0x2c')]['limit']);_0xb71339[_0x3801('0x1a')]=qs['offset'](_0x3ff64b[_0x3801('0x2c')]['offset']);}_0xb71339[_0x3801('0x34')]=qs[_0x3801('0x35')](_0x3ff64b['query']['sort']);_0xb71339[_0x3801('0x36')]=qs['filters'](_['pick'](_0x3ff64b['query'],_0x3fdb18['filters']),_0x6eb0ca);if(_0x3ff64b[_0x3801('0x2c')][_0x3801('0x37')]){_0xb71339[_0x3801('0x36')]=_['merge'](_0xb71339[_0x3801('0x36')],{'$or':_[_0x3801('0x27')](_0x6eb0ca,function(_0x2e9ab5){if(_0x2e9ab5['type']!=='VIRTUAL'){var _0x216eb5={};_0x216eb5[_0x2e9ab5[_0x3801('0x26')]]={'$like':'%'+_0x3ff64b['query'][_0x3801('0x37')]+'%'};return _0x216eb5;}})});}_0xb71339=_[_0x3801('0x38')]({},_0xb71339,_0x3ff64b[_0x3801('0x39')]);var _0x4f0233={'where':_0xb71339[_0x3801('0x36')]};return db['OpenchannelApplication'][_0x3801('0x1d')](_0x4f0233)[_0x3801('0x23')](function(_0x37f880){_0x5d90e9['count']=_0x37f880;if(_0x3ff64b[_0x3801('0x2c')]['includeAll']){_0xb71339[_0x3801('0x3a')]=[{'all':!![]}];}return db[_0x3801('0x3b')][_0x3801('0x3c')](_0xb71339);})['then'](function(_0x7bc983){_0x5d90e9[_0x3801('0x3d')]=_0x7bc983;return _0x5d90e9;})[_0x3801('0x23')](respondWithFilteredResult(_0x28fb1e,_0xb71339))[_0x3801('0x3e')](handleError(_0x28fb1e,null));};exports['show']=function(_0x22628e,_0x3b5460){var _0x439267={'raw':!![],'where':{'id':_0x22628e[_0x3801('0x3f')]['id']}},_0x1561ea={};_0x1561ea[_0x3801('0x2b')]=_[_0x3801('0x2d')](db[_0x3801('0x3b')][_0x3801('0x28')]);_0x1561ea[_0x3801('0x2c')]=_[_0x3801('0x2d')](_0x22628e[_0x3801('0x2c')]);_0x1561ea[_0x3801('0x2e')]=_[_0x3801('0x30')](_0x1561ea[_0x3801('0x2b')],_0x1561ea[_0x3801('0x2c')]);_0x439267[_0x3801('0x2f')]=_['intersection'](_0x1561ea[_0x3801('0x2b')],qs[_0x3801('0x31')](_0x22628e[_0x3801('0x2c')][_0x3801('0x31')]));_0x439267[_0x3801('0x2f')]=_0x439267[_0x3801('0x2f')]['length']?_0x439267[_0x3801('0x2f')]:_0x1561ea[_0x3801('0x2b')];if(_0x22628e[_0x3801('0x2c')]['includeAll']){_0x439267[_0x3801('0x3a')]=[{'all':!![]}];}_0x439267=_[_0x3801('0x38')]({},_0x439267,_0x22628e[_0x3801('0x39')]);return db['OpenchannelApplication'][_0x3801('0x40')](_0x439267)[_0x3801('0x23')](handleEntityNotFound(_0x3b5460,null))[_0x3801('0x23')](respondWithResult(_0x3b5460,null))[_0x3801('0x3e')](handleError(_0x3b5460,null));};exports[_0x3801('0x41')]=function(_0x151f7d,_0x3191fa){return db[_0x3801('0x3b')][_0x3801('0x41')](_0x151f7d[_0x3801('0x42')],{})[_0x3801('0x23')](respondWithResult(_0x3191fa,0xc9))[_0x3801('0x3e')](handleError(_0x3191fa,null));};exports[_0x3801('0x21')]=function(_0x19525a,_0xd502a8){if(_0x19525a['body']['id']){delete _0x19525a[_0x3801('0x42')]['id'];}return db[_0x3801('0x3b')][_0x3801('0x40')]({'where':{'id':_0x19525a[_0x3801('0x3f')]['id']}})[_0x3801('0x23')](handleEntityNotFound(_0xd502a8,null))['then'](saveUpdates(_0x19525a[_0x3801('0x42')],null))[_0x3801('0x23')](respondWithResult(_0xd502a8,null))[_0x3801('0x3e')](handleError(_0xd502a8,null));};exports[_0x3801('0x22')]=function(_0x230d9f,_0x2619f3){return db[_0x3801('0x3b')][_0x3801('0x40')]({'where':{'id':_0x230d9f[_0x3801('0x3f')]['id']}})[_0x3801('0x23')](handleEntityNotFound(_0x2619f3,null))[_0x3801('0x23')](removeEntity(_0x2619f3,null))[_0x3801('0x3e')](handleError(_0x2619f3,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index 7e9b2a8..27dc654 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 _0x6158=['rimraf','../../config/environment','./openchannelApplication.attributes','OpenchannelApplication','openchannel_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','path'];(function(_0x5de423,_0x36057e){var _0x418fdb=function(_0x1bfd73){while(--_0x1bfd73){_0x5de423['push'](_0x5de423['shift']());}};_0x418fdb(++_0x36057e);}(_0x6158,0x118));var _0x8615=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6158[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x8615('0x0'));var util=require(_0x8615('0x1'));var logger=require(_0x8615('0x2'))(_0x8615('0x3'));var moment=require(_0x8615('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x8615('0x5'));var rimraf=require(_0x8615('0x6'));var config=require(_0x8615('0x7'));var attributes=require(_0x8615('0x8'));module['exports']=function(_0x1d4241,_0x579990){return _0x1d4241['define'](_0x8615('0x9'),attributes,{'tableName':_0x8615('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x8615('0xb'),'collate':_0x8615('0xc')});}; \ No newline at end of file +var _0x711d=['openchannel_applications','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','define','OpenchannelApplication'];(function(_0x303f61,_0x3b64da){var _0x76f159=function(_0x17be44){while(--_0x17be44){_0x303f61['push'](_0x303f61['shift']());}};_0x76f159(++_0x3b64da);}(_0x711d,0x7b));var _0xd711=function(_0x2efae6,_0x324fe0){_0x2efae6=_0x2efae6-0x0;var _0x4ce762=_0x711d[_0x2efae6];return _0x4ce762;};'use strict';var _=require('lodash');var util=require(_0xd711('0x0'));var logger=require(_0xd711('0x1'))(_0xd711('0x2'));var moment=require(_0xd711('0x3'));var BPromise=require('bluebird');var rp=require(_0xd711('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd711('0x5'));var config=require(_0xd711('0x6'));var attributes=require('./openchannelApplication.attributes');module['exports']=function(_0xf9ffdd,_0x210dcc){return _0xf9ffdd[_0xd711('0x7')](_0xd711('0x8'),attributes,{'tableName':_0xd711('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xd711('0xa'),'collate':_0xd711('0xb')});}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.rpc.js b/server/api/openchannelApplication/openchannelApplication.rpc.js index cda2ad9..a772c15 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 _0x2de0=['update','body','options','raw','where','attributes','limit','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','OpenchannelApplication,\x20%s,\x20%s','request\x20sent','debug','OpenchannelApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','UpdateOpenchannelApplication','OpenchannelApplication'];(function(_0x4a9cfb,_0x229e89){var _0x4c00cf=function(_0x29eada){while(--_0x29eada){_0x4a9cfb['push'](_0x4a9cfb['shift']());}};_0x4c00cf(++_0x229e89);}(_0x2de0,0x87));var _0x02de=function(_0x2035ff,_0x4a27a2){_0x2035ff=_0x2035ff-0x0;var _0x21099b=_0x2de0[_0x2035ff];return _0x21099b;};'use strict';var _=require(_0x02de('0x0'));var util=require('util');var moment=require(_0x02de('0x1'));var BPromise=require(_0x02de('0x2'));var rs=require(_0x02de('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x02de('0x4'))['db'];var utils=require(_0x02de('0x5'));var logger=require(_0x02de('0x6'))(_0x02de('0x7'));var config=require(_0x02de('0x8'));var jayson=require(_0x02de('0x9'));var client=jayson[_0x02de('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x25d99f,_0x44c947,_0x50082a){return new BPromise(function(_0x400461,_0x4df3af){return client[_0x02de('0xb')](_0x25d99f,_0x50082a)[_0x02de('0xc')](function(_0xc1689f){logger[_0x02de('0xd')](_0x02de('0xe'),_0x44c947,_0x02de('0xf'));logger[_0x02de('0x10')](_0x02de('0x11'),_0x44c947,'request\x20sent',JSON[_0x02de('0x12')](_0xc1689f));if(_0xc1689f[_0x02de('0x13')]){if(_0xc1689f[_0x02de('0x13')][_0x02de('0x14')]===0x1f4){logger['error'](_0x02de('0xe'),_0x44c947,_0xc1689f[_0x02de('0x13')][_0x02de('0x15')]);return _0x4df3af(_0xc1689f[_0x02de('0x13')][_0x02de('0x15')]);}logger[_0x02de('0x13')](_0x02de('0xe'),_0x44c947,_0xc1689f[_0x02de('0x13')][_0x02de('0x15')]);return _0x400461(_0xc1689f['error'][_0x02de('0x15')]);}else{logger[_0x02de('0xd')](_0x02de('0xe'),_0x44c947,_0x02de('0xf'));_0x400461(_0xc1689f[_0x02de('0x16')][_0x02de('0x15')]);}})['catch'](function(_0x314d96){logger[_0x02de('0x13')](_0x02de('0xe'),_0x44c947,_0x314d96);_0x4df3af(_0x314d96);});});}exports[_0x02de('0x17')]=function(_0x445f3){var _0x53e249=this;return new Promise(function(_0x26d168,_0x39e943){return db[_0x02de('0x18')][_0x02de('0x19')](_0x445f3[_0x02de('0x1a')],{'raw':_0x445f3[_0x02de('0x1b')]?_0x445f3[_0x02de('0x1b')][_0x02de('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x445f3['options']?_0x445f3['options'][_0x02de('0x1d')]||null:null,'attributes':_0x445f3[_0x02de('0x1b')]?_0x445f3['options'][_0x02de('0x1e')]||null:null,'limit':_0x445f3[_0x02de('0x1b')]?_0x445f3['options'][_0x02de('0x1f')]||null:null})['then'](function(_0x1e10d6){logger[_0x02de('0xd')](_0x02de('0x17'),_0x445f3);logger[_0x02de('0x10')](_0x02de('0x17'),_0x445f3,JSON[_0x02de('0x12')](_0x1e10d6));_0x26d168(_0x1e10d6);})['catch'](function(_0x4d37f7){logger[_0x02de('0x13')]('UpdateOpenchannelApplication',_0x4d37f7['message'],_0x445f3);_0x39e943(_0x53e249[_0x02de('0x13')](0x1f4,_0x4d37f7['message']));});});}; \ No newline at end of file +var _0xc0bb=['bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','client','http','then','info','OpenchannelApplication,\x20%s,\x20%s','request\x20sent','debug','OpenchannelApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','UpdateOpenchannelApplication','OpenchannelApplication','body','options','raw','where','catch','lodash','util'];(function(_0x40359a,_0xcb63b){var _0x5efc0c=function(_0x3517df){while(--_0x3517df){_0x40359a['push'](_0x40359a['shift']());}};_0x5efc0c(++_0xcb63b);}(_0xc0bb,0x1be));var _0xbc0b=function(_0x3e5bc8,_0x457d89){_0x3e5bc8=_0x3e5bc8-0x0;var _0xfd84bc=_0xc0bb[_0x3e5bc8];return _0xfd84bc;};'use strict';var _=require(_0xbc0b('0x0'));var util=require(_0xbc0b('0x1'));var moment=require('moment');var BPromise=require(_0xbc0b('0x2'));var rs=require(_0xbc0b('0x3'));var fs=require('fs');var Redis=require(_0xbc0b('0x4'));var db=require(_0xbc0b('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xbc0b('0x6'))(_0xbc0b('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xbc0b('0x8')][_0xbc0b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2466d9,_0x1207a2,_0x5dab0c){return new BPromise(function(_0x234264,_0x5c6d96){return client['request'](_0x2466d9,_0x5dab0c)[_0xbc0b('0xa')](function(_0x1abd6d){logger[_0xbc0b('0xb')](_0xbc0b('0xc'),_0x1207a2,_0xbc0b('0xd'));logger[_0xbc0b('0xe')](_0xbc0b('0xf'),_0x1207a2,_0xbc0b('0xd'),JSON[_0xbc0b('0x10')](_0x1abd6d));if(_0x1abd6d[_0xbc0b('0x11')]){if(_0x1abd6d[_0xbc0b('0x11')][_0xbc0b('0x12')]===0x1f4){logger[_0xbc0b('0x11')](_0xbc0b('0xc'),_0x1207a2,_0x1abd6d[_0xbc0b('0x11')]['message']);return _0x5c6d96(_0x1abd6d[_0xbc0b('0x11')][_0xbc0b('0x13')]);}logger[_0xbc0b('0x11')]('OpenchannelApplication,\x20%s,\x20%s',_0x1207a2,_0x1abd6d[_0xbc0b('0x11')][_0xbc0b('0x13')]);return _0x234264(_0x1abd6d[_0xbc0b('0x11')][_0xbc0b('0x13')]);}else{logger['info'](_0xbc0b('0xc'),_0x1207a2,_0xbc0b('0xd'));_0x234264(_0x1abd6d[_0xbc0b('0x14')][_0xbc0b('0x13')]);}})['catch'](function(_0x3cf1f7){logger[_0xbc0b('0x11')](_0xbc0b('0xc'),_0x1207a2,_0x3cf1f7);_0x5c6d96(_0x3cf1f7);});});}exports[_0xbc0b('0x15')]=function(_0x11b230){var _0x1737aa=this;return new Promise(function(_0x5af003,_0x32aa9a){return db[_0xbc0b('0x16')]['update'](_0x11b230[_0xbc0b('0x17')],{'raw':_0x11b230[_0xbc0b('0x18')]?_0x11b230[_0xbc0b('0x18')][_0xbc0b('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x11b230[_0xbc0b('0x18')]?_0x11b230['options'][_0xbc0b('0x1a')]||null:null,'attributes':_0x11b230[_0xbc0b('0x18')]?_0x11b230[_0xbc0b('0x18')]['attributes']||null:null,'limit':_0x11b230['options']?_0x11b230['options']['limit']||null:null})[_0xbc0b('0xa')](function(_0x1a956f){logger['info'](_0xbc0b('0x15'),_0x11b230);logger['debug'](_0xbc0b('0x15'),_0x11b230,JSON['stringify'](_0x1a956f));_0x5af003(_0x1a956f);})[_0xbc0b('0x1b')](function(_0x534e59){logger[_0xbc0b('0x11')](_0xbc0b('0x15'),_0x534e59[_0xbc0b('0x13')],_0x11b230);_0x32aa9a(_0x1737aa[_0xbc0b('0x11')](0x1f4,_0x534e59[_0xbc0b('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/index.js b/server/api/openchannelInteraction/index.js index a82a727..825c08e 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 _0xa64a=['download','post','/:id/messages','addMessage','/:id/tags','tracked','openchannelinteraction:addtags','addTags','put','openchannel','update','delete','openchannelinteraction:destroy','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelInteraction.controller','get','index','isAuthenticated','describe','/:id','show','getMessages'];(function(_0x279090,_0x5b05f9){var _0x48a69a=function(_0x55d920){while(--_0x55d920){_0x279090['push'](_0x279090['shift']());}};_0x48a69a(++_0x5b05f9);}(_0xa64a,0x117));var _0xaa64=function(_0x1adf5f,_0x5f5508){_0x1adf5f=_0x1adf5f-0x0;var _0x52aba7=_0xa64a[_0x1adf5f];return _0x52aba7;};'use strict';var multer=require(_0xaa64('0x0'));var util=require(_0xaa64('0x1'));var path=require(_0xaa64('0x2'));var timeout=require(_0xaa64('0x3'));var express=require(_0xaa64('0x4'));var router=express[_0xaa64('0x5')]();var fs_extra=require(_0xaa64('0x6'));var auth=require(_0xaa64('0x7'));var interaction=require(_0xaa64('0x8'));var config=require(_0xaa64('0x9'));var controller=require(_0xaa64('0xa'));router[_0xaa64('0xb')]('/',auth['isAuthenticated'](),controller[_0xaa64('0xc')]);router['get']('/describe',auth[_0xaa64('0xd')](),controller[_0xaa64('0xe')]);router[_0xaa64('0xb')](_0xaa64('0xf'),auth[_0xaa64('0xd')](),controller[_0xaa64('0x10')]);router['get']('/:id/messages',auth[_0xaa64('0xd')](),controller[_0xaa64('0x11')]);router['get']('/:id/download',auth[_0xaa64('0xd')](),controller[_0xaa64('0x12')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0xaa64('0x13')](_0xaa64('0x14'),auth[_0xaa64('0xd')](),controller[_0xaa64('0x15')]);router['post'](_0xaa64('0x16'),auth[_0xaa64('0xd')](),interaction[_0xaa64('0x17')]('openchannel',_0xaa64('0x18')),controller[_0xaa64('0x19')]);router[_0xaa64('0x1a')](_0xaa64('0xf'),auth['isAuthenticated'](),interaction['tracked'](_0xaa64('0x1b'),'openchannelinteraction:update'),controller[_0xaa64('0x1c')]);router[_0xaa64('0x1d')](_0xaa64('0xf'),auth['isAuthenticated'](),interaction[_0xaa64('0x17')]('openchannel',_0xaa64('0x1e')),controller[_0xaa64('0x1f')]);router[_0xaa64('0x1d')](_0xaa64('0x16'),auth['isAuthenticated'](),controller['removeTags']);module[_0xaa64('0x20')]=router; \ No newline at end of file +var _0xccc4=['/:id/messages','getMessages','/:id/download','download','create','post','addMessage','/:id/tags','tracked','openchannelinteraction:addtags','addTags','put','openchannel','openchannelinteraction:update','update','delete','destroy','removeTags','exports','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','isAuthenticated','get','/describe','describe','/:id','show'];(function(_0x107b43,_0x24b938){var _0x14e3a0=function(_0x2195b8){while(--_0x2195b8){_0x107b43['push'](_0x107b43['shift']());}};_0x14e3a0(++_0x24b938);}(_0xccc4,0x1f3));var _0x4ccc=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xccc4[_0x5b644e];return _0x49c6bf;};'use strict';var multer=require('multer');var util=require(_0x4ccc('0x0'));var path=require('path');var timeout=require(_0x4ccc('0x1'));var express=require(_0x4ccc('0x2'));var router=express[_0x4ccc('0x3')]();var fs_extra=require(_0x4ccc('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x4ccc('0x5'));var config=require(_0x4ccc('0x6'));var controller=require('./openchannelInteraction.controller');router['get']('/',auth[_0x4ccc('0x7')](),controller['index']);router[_0x4ccc('0x8')](_0x4ccc('0x9'),auth['isAuthenticated'](),controller[_0x4ccc('0xa')]);router[_0x4ccc('0x8')](_0x4ccc('0xb'),auth[_0x4ccc('0x7')](),controller[_0x4ccc('0xc')]);router[_0x4ccc('0x8')](_0x4ccc('0xd'),auth[_0x4ccc('0x7')](),controller[_0x4ccc('0xe')]);router[_0x4ccc('0x8')](_0x4ccc('0xf'),auth[_0x4ccc('0x7')](),controller[_0x4ccc('0x10')]);router['post']('/',auth['isAuthenticated'](),controller[_0x4ccc('0x11')]);router[_0x4ccc('0x12')](_0x4ccc('0xd'),auth[_0x4ccc('0x7')](),controller[_0x4ccc('0x13')]);router['post'](_0x4ccc('0x14'),auth[_0x4ccc('0x7')](),interaction[_0x4ccc('0x15')]('openchannel',_0x4ccc('0x16')),controller[_0x4ccc('0x17')]);router[_0x4ccc('0x18')]('/:id',auth[_0x4ccc('0x7')](),interaction[_0x4ccc('0x15')](_0x4ccc('0x19'),_0x4ccc('0x1a')),controller[_0x4ccc('0x1b')]);router[_0x4ccc('0x1c')](_0x4ccc('0xb'),auth[_0x4ccc('0x7')](),interaction[_0x4ccc('0x15')](_0x4ccc('0x19'),'openchannelinteraction:destroy'),controller[_0x4ccc('0x1d')]);router[_0x4ccc('0x1c')](_0x4ccc('0x14'),auth['isAuthenticated'](),controller[_0x4ccc('0x1e')]);module[_0x4ccc('0x1f')]=router; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.attributes.js b/server/api/openchannelInteraction/openchannelInteraction.attributes.js index de3189f..5b6c7d6 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 _0xb613=['ENUM','out','BOOLEAN','sequelize','exports','STRING','DATE'];(function(_0x1cc325,_0x537298){var _0x33d644=function(_0x4cd101){while(--_0x4cd101){_0x1cc325['push'](_0x1cc325['shift']());}};_0x33d644(++_0x537298);}(_0xb613,0x9d));var _0x3b61=function(_0x2e6dee,_0x1a61b0){_0x2e6dee=_0x2e6dee-0x0;var _0x47706=_0xb613[_0x2e6dee];return _0x47706;};'use strict';var Sequelize=require(_0x3b61('0x0'));module[_0x3b61('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x3b61('0x2')]},'secondDisposition':{'type':Sequelize[_0x3b61('0x2')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x3b61('0x2')]},'read1stAt':{'type':Sequelize[_0x3b61('0x3')]},'threadId':{'type':Sequelize[_0x3b61('0x2')]},'externalUrl':{'type':Sequelize[_0x3b61('0x2')]},'lastMsgAt':{'type':Sequelize[_0x3b61('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x3b61('0x4')]('in',_0x3b61('0x5')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize['STRING']},'autoreplyExecuted':{'type':Sequelize[_0x3b61('0x6')],'defaultValue':![]}}; \ No newline at end of file +var _0x1501=['exports','BOOLEAN','DATE','STRING','ENUM','out'];(function(_0x5f3f88,_0x562baf){var _0xd08119=function(_0x42dbf7){while(--_0x42dbf7){_0x5f3f88['push'](_0x5f3f88['shift']());}};_0xd08119(++_0x562baf);}(_0x1501,0x126));var _0x1150=function(_0x16d3f8,_0x3f5dd3){_0x16d3f8=_0x16d3f8-0x0;var _0x49a172=_0x1501[_0x16d3f8];return _0x49a172;};'use strict';var Sequelize=require('sequelize');module[_0x1150('0x0')]={'closed':{'type':Sequelize[_0x1150('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x1150('0x2')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x1150('0x3')]},'thirdDisposition':{'type':Sequelize[_0x1150('0x3')]},'note':{'type':Sequelize[_0x1150('0x3')]},'read1stAt':{'type':Sequelize[_0x1150('0x2')]},'threadId':{'type':Sequelize['STRING']},'externalUrl':{'type':Sequelize[_0x1150('0x3')]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x1150('0x4')]('in',_0x1150('0x5')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0x1150('0x3')]},'autoreplyExecuted':{'type':Sequelize[_0x1150('0x1')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.controller.js b/server/api/openchannelInteraction/openchannelInteraction.controller.js index e5bb9ea..467b210 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 _0x6055=['basename','out','System','firstName','views','downloadInteraction.ejs','transcript-','.pdf','log','err','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./openchannelInteraction.socket','register','sendStatus','status','json','offset','undefined','limit','count','set','apply','reject','update','then','error','stack','name','Users','map','fullname','TagIds','Tags','index','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','select','field','color','from','tools_tags','u.id','u.fullname','ui.OpenchannelInteractionId','user_has_openchannel_interactions','left_join','users','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','openchannel_accounts','a.id\x20=\x20i.OpenchannelAccountId','openchannel_messages','me.OpenchannelInteractionId\x20=\x20i.id','openchannel_interaction_has_tags','it.OpenchannelInteractionId\x20=\x20i.id','expr','search','parseSearch','sqlOperator','length','conditions','find','unreadMessages','value','having','`\x20>\x200','Contact','operator','$substring','split','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','buildExpression','start','end','Tag','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','text','some','compact','isEmpty','forEach','OpenchannelAccountId','i.OpenchannelAccountId\x20IN\x20?','concat','createdAt','parse','\x20IS\x20NULL','read','`unreadMessages`\x20>\x200','tag','filter','replace','isNumeric','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','i.from\x20LIKE\x20?','i.id','Sequelize','QueryTypes','clone','contactName','DESC','t.id\x20IN\x20?','resolve','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','role','user','i.OpenchannelAccountId\x20IS\x20NULL','agent','sequelize','keyBy','merge','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20i.from\x20IS\x20NOT\x20NULL\x20AND\x20i.from\x20<>\x20\x27\x27\x20THEN\x20i.from\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','c.lastName','c.email','Contact.email','c.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','toString','ui.OpenchannelInteractionId\x20IN\x20?','OpenchannelInteractionId','all','rows','catch','show','params','OpenchannelInteraction','includeAll','options','create','body','describe','addMessage','OpenchannelMessage','ids','omit','hasOwnProperty','$gte','YYYY-MM-DD\x20HH:mm:ss','include','findAll','setTags','spread','openchannelInteractionTags:save','removeTags','download','unix','join','root','files','tmp','server','format','transcript-%d-%s.zip','push','User','CmContact','lastName','Attachment','direction','secret','OpenchannelAccount','Account','Owner','get','mkdirSync','Openchannel','closed','closedAt','disposition','Private','Messages','createWriteStream'];(function(_0x146755,_0x13d103){var _0x160744=function(_0x553ef9){while(--_0x553ef9){_0x146755['push'](_0x146755['shift']());}};_0x160744(++_0x13d103);}(_0x6055,0xf5));var _0x5605=function(_0x376ce,_0x12377c){_0x376ce=_0x376ce-0x0;var _0x3cfeec=_0x6055[_0x376ce];return _0x3cfeec;};'use strict';var emlformat=require(_0x5605('0x0'));var rimraf=require(_0x5605('0x1'));var zipdir=require(_0x5605('0x2'));var jsonpatch=require(_0x5605('0x3'));var rp=require(_0x5605('0x4'));var moment=require(_0x5605('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x5605('0x6'));var sox=require(_0x5605('0x7'));var csv=require('to-csv');var ejs=require(_0x5605('0x8'));var fs=require('fs');var fs_extra=require(_0x5605('0x9'));var _=require(_0x5605('0xa'));var squel=require(_0x5605('0xb'));var crypto=require(_0x5605('0xc'));var jsforce=require(_0x5605('0xd'));var deskjs=require(_0x5605('0xe'));var toCsv=require(_0x5605('0xf'));var querystring=require(_0x5605('0x10'));var Papa=require(_0x5605('0x11'));var Redis=require(_0x5605('0x12'));var authService=require(_0x5605('0x13'));var qs=require(_0x5605('0x14'));var as=require(_0x5605('0x15'));var pdf=require(_0x5605('0x16'));var hardwareService=require(_0x5605('0x17'));var logger=require(_0x5605('0x18'))(_0x5605('0x19'));var utils=require(_0x5605('0x1a'));var config=require(_0x5605('0x1b'));var licenseUtil=require(_0x5605('0x1c'));var db=require(_0x5605('0x1d'))['db'];config[_0x5605('0x1e')]=_[_0x5605('0x1f')](config[_0x5605('0x1e')],{'host':'localhost','port':0x18eb});var socket=require(_0x5605('0x20'))(new Redis(config[_0x5605('0x1e')]));require(_0x5605('0x21'))[_0x5605('0x22')](socket);function respondWithStatusCode(_0x369587,_0x300f25){_0x300f25=_0x300f25||0xcc;return function(_0x4126fc){if(_0x4126fc){return _0x369587[_0x5605('0x23')](_0x300f25);}return _0x369587[_0x5605('0x24')](_0x300f25)['end']();};}function respondWithResult(_0x5a5cd0,_0x18bd82){_0x18bd82=_0x18bd82||0xc8;return function(_0x55df1a){if(_0x55df1a){return _0x5a5cd0[_0x5605('0x24')](_0x18bd82)[_0x5605('0x25')](_0x55df1a);}};}function respondWithFilteredResult(_0x3dcb01,_0x1330ec){return function(_0x281505){if(_0x281505){var _0x2c9c3e=typeof _0x1330ec[_0x5605('0x26')]===_0x5605('0x27')&&typeof _0x1330ec[_0x5605('0x28')]===_0x5605('0x27');var _0x16eee0=_0x281505[_0x5605('0x29')];var _0x34d8b7=_0x2c9c3e?0x0:_0x1330ec['offset'];var _0x40a7da=_0x2c9c3e?_0x281505[_0x5605('0x29')]:_0x1330ec['offset']+_0x1330ec[_0x5605('0x28')];var _0x281454;if(_0x40a7da>=_0x16eee0){_0x40a7da=_0x16eee0;_0x281454=0xc8;}else{_0x281454=0xce;}_0x3dcb01['status'](_0x281454);return _0x3dcb01[_0x5605('0x2a')]('Content-Range',_0x34d8b7+'-'+_0x40a7da+'/'+_0x16eee0)['json'](_0x281505);}return null;};}function patchUpdates(_0x33b685){return function(_0xdfe44a){try{jsonpatch[_0x5605('0x2b')](_0xdfe44a,_0x33b685,!![]);}catch(_0x32ecbb){return BPromise[_0x5605('0x2c')](_0x32ecbb);}return _0xdfe44a['save']();};}function saveUpdates(_0x5e900b,_0x3cff0f){return function(_0x2d0219){if(_0x2d0219){return _0x2d0219[_0x5605('0x2d')](_0x5e900b)['then'](function(_0x1c8231){return _0x1c8231;});}return null;};}function removeEntity(_0x228fe1,_0xc3dd89){return function(_0x11dca7){if(_0x11dca7){return _0x11dca7['destroy']()[_0x5605('0x2e')](function(){_0x228fe1['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4cc082,_0x3b0939){return function(_0xf4a752){if(!_0xf4a752){_0x4cc082[_0x5605('0x23')](0x194);}return _0xf4a752;};}function handleError(_0xa267dd,_0x4f67c7){_0x4f67c7=_0x4f67c7||0x1f4;return function(_0x43b3cb){logger[_0x5605('0x2f')](_0x43b3cb[_0x5605('0x30')]);if(_0x43b3cb['name']){delete _0x43b3cb[_0x5605('0x31')];}_0xa267dd[_0x5605('0x24')](_0x4f67c7)['send'](_0x43b3cb);};}function getInteractionUsers(_0x49c6b8,_0x58389d){return new BPromise(function(_0x16e86e,_0x213b16){try{if(_0x58389d[_0x49c6b8['id']]){_0x49c6b8[_0x5605('0x32')]=_[_0x5605('0x33')](_0x58389d[_0x49c6b8['id']],function(_0x12b758){return{'id':_0x12b758['id'],'fullname':_0x12b758[_0x5605('0x34')]};});}}catch(_0x216a31){_0x213b16(_0x216a31);}_0x16e86e(_0x49c6b8);});}function getInteractionTags(_0x622d03,_0x294988){return new BPromise(function(_0x541b2d,_0x11ab7f){try{if(_0x622d03[_0x5605('0x35')]){_0x622d03[_0x5605('0x36')]=[];_0x622d03[_0x5605('0x35')]['split'](',')['forEach'](function(_0x508439){_0x622d03[_0x5605('0x36')]['push'](_0x294988[_0x508439]);});}delete _0x622d03[_0x5605('0x35')];}catch(_0x1d28eb){_0x11ab7f(_0x1d28eb);}_0x541b2d(_0x622d03);});}function updateOpenchannelInteraction(_0x20403d,_0xa9cad2,_0x45ce85){return new BPromise(function(_0x3a0a6a,_0x426c31){return getInteractionUsers(_0x20403d,_0x45ce85)[_0x5605('0x2e')](function(_0x2e8edf){return getInteractionTags(_0x2e8edf,_0xa9cad2);})[_0x5605('0x2e')](function(_0x34b102){_0x3a0a6a(_0x34b102);})['catch'](function(_0x8db8f1){_0x426c31(_0x8db8f1);});});}exports[_0x5605('0x37')]=function(_0x361c9b,_0x10814a){var _0x3ad6cb={},_0x57daa4={},_0x3a8131={'count':0x0,'rows':[]};var _0x34515b=_[_0x5605('0x33')](db['OpenchannelInteraction'][_0x5605('0x38')],function(_0x26e069){return{'name':_0x26e069[_0x5605('0x39')],'type':_0x26e069[_0x5605('0x3a')]['key']};});_0x57daa4[_0x5605('0x3b')]=_[_0x5605('0x33')](_0x34515b,'name');_0x57daa4[_0x5605('0x3c')]=_[_0x5605('0x3d')](_0x361c9b[_0x5605('0x3c')]);_0x57daa4[_0x5605('0x3e')]=_[_0x5605('0x3f')](_0x57daa4[_0x5605('0x3b')],_0x57daa4['query']);_0x3ad6cb[_0x5605('0x40')]=_[_0x5605('0x3f')](_0x57daa4['model'],qs['fields'](_0x361c9b['query'][_0x5605('0x41')]));_0x3ad6cb[_0x5605('0x40')]=_0x3ad6cb[_0x5605('0x40')]['length']?_0x3ad6cb[_0x5605('0x40')]:_0x57daa4['model'];if(!_0x361c9b[_0x5605('0x3c')]['hasOwnProperty'](_0x5605('0x42'))){_0x3ad6cb[_0x5605('0x28')]=qs[_0x5605('0x28')](_0x361c9b[_0x5605('0x3c')][_0x5605('0x28')]);_0x3ad6cb[_0x5605('0x26')]=qs[_0x5605('0x26')](_0x361c9b[_0x5605('0x3c')][_0x5605('0x26')]);}_0x3ad6cb[_0x5605('0x43')]=qs[_0x5605('0x44')](_0x361c9b[_0x5605('0x3c')][_0x5605('0x44')]);_0x3ad6cb[_0x5605('0x45')]=qs[_0x5605('0x3e')](_[_0x5605('0x46')](_0x361c9b['query'],_0x57daa4[_0x5605('0x3e')]),_0x34515b);var _0x51cd3e=[];var _0x4b7740=squel[_0x5605('0x47')]()['field']('id')['field'](_0x5605('0x31'))[_0x5605('0x48')](_0x5605('0x49'))[_0x5605('0x4a')](_0x5605('0x4b'));var _0x9260a0=squel[_0x5605('0x47')]()['field'](_0x5605('0x4c'))['field'](_0x5605('0x4d'))[_0x5605('0x48')](_0x5605('0x4e'))[_0x5605('0x4a')](_0x5605('0x4f'),'ui')[_0x5605('0x50')](_0x5605('0x51'),'u','u.id\x20=\x20ui.UserId');var _0x47776c=squel[_0x5605('0x47')]()['from']('openchannel_interactions','i')[_0x5605('0x50')](_0x5605('0x52'),'c',_0x5605('0x53'))['left_join'](_0x5605('0x51'),'o',_0x5605('0x54'))[_0x5605('0x50')](_0x5605('0x55'),'a',_0x5605('0x56'))[_0x5605('0x50')](_0x5605('0x57'),'me',_0x5605('0x58'))[_0x5605('0x50')](_0x5605('0x59'),'it',_0x5605('0x5a'))['left_join'](_0x5605('0x4b'),'t','t.id\x20=\x20it.TagId');var _0x25e2b5=squel[_0x5605('0x5b')]();var _0x2a50b1=[];var _0x3fd5b1=squel[_0x5605('0x5b')]();var _0x1bb77e;if(_0x361c9b['query'][_0x5605('0x5c')]){_0x1bb77e=as[_0x5605('0x5d')](_0x361c9b[_0x5605('0x3c')][_0x5605('0x5c')]);var _0x4d1bfd=_0x1bb77e[_0x5605('0x5e')];for(var _0x65c74=0x0;_0x65c74<_0x1bb77e['conditions'][_0x5605('0x5f')];_0x65c74++){var _0x33bc2a=_0x1bb77e[_0x5605('0x60')][_0x65c74];var _0x4d4e9b='i';var _0x2ccc7b=_[_0x5605('0x61')](_0x34515b,[_0x5605('0x31'),_0x33bc2a[_0x5605('0x48')]]);if(!_0x2ccc7b){switch(_0x33bc2a[_0x5605('0x48')]){case _0x5605('0x62'):if(_0x33bc2a[_0x5605('0x63')]==0x1){_0x47776c[_0x5605('0x64')]('`'+_0x33bc2a[_0x5605('0x48')]+'`\x20=\x200');}else{_0x47776c[_0x5605('0x64')]('`'+_0x33bc2a[_0x5605('0x48')]+_0x5605('0x65'));}break;case _0x5605('0x66'):if(_0x33bc2a[_0x5605('0x67')]===_0x5605('0x68')){if(_0x33bc2a[_0x5605('0x63')][_0x5605('0x69')]('\x20')[_0x5605('0x5f')]>0x1){_0x25e2b5[_0x4d1bfd](_0x5605('0x6a'),qs['getFullTextValue'](_0x33bc2a[_0x5605('0x63')]),null);}else{var _0x56e250='%'+_0x33bc2a[_0x5605('0x63')]+'%';_0x25e2b5[_0x4d1bfd]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x56e250,_0x56e250,_0x56e250);}}else{_0x2ccc7b=_[_0x5605('0x61')](_0x34515b,[_0x5605('0x31'),'ContactId']);_0x33bc2a[_0x5605('0x48')]='ContactId';_0x236805=as[_0x5605('0x6b')](_0x4d4e9b,_0x2ccc7b[_0x5605('0x3a')],_0x33bc2a);_0x25e2b5[_0x4d1bfd](_0x236805['text'],_0x236805[_0x5605('0x63')][_0x5605('0x6c')],_0x236805[_0x5605('0x63')][_0x5605('0x6d')]);}break;case _0x5605('0x6e'):var _0x1df43b=_0x33bc2a[_0x5605('0x63')]['split'](',')['map'](function(_0xf34db7){return Number(_0xf34db7);});_0x1df43b['forEach'](function(_0xdf2c8a){_0x3fd5b1['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0xdf2c8a+',%');});_0x2a50b1=_['union'](_0x2a50b1,_0x1df43b);break;case'User':if(_0x33bc2a[_0x5605('0x67')]==='$substring'){_0x25e2b5[_0x4d1bfd](_0x5605('0x6f'),'%'+_0x33bc2a[_0x5605('0x63')]+'%',null);}else{_0x2ccc7b=_['find'](_0x34515b,[_0x5605('0x31'),_0x5605('0x70')]);_0x33bc2a['field']=_0x5605('0x70');_0x236805=as[_0x5605('0x6b')](_0x4d4e9b,_0x2ccc7b[_0x5605('0x3a')],_0x33bc2a);_0x25e2b5[_0x4d1bfd](_0x236805[_0x5605('0x71')],_0x236805[_0x5605('0x63')][_0x5605('0x6c')],_0x236805[_0x5605('0x63')][_0x5605('0x6d')]);}break;case'body':_0x236805=as['buildExpression']('me',null,_0x33bc2a);_0x25e2b5[_0x4d1bfd](_0x236805[_0x5605('0x71')],_0x236805[_0x5605('0x63')][_0x5605('0x6c')],_0x236805[_0x5605('0x63')][_0x5605('0x6d')]);break;}}else{var _0x236805=as[_0x5605('0x6b')](_0x4d4e9b,_0x2ccc7b[_0x5605('0x3a')],_0x33bc2a);_0x25e2b5[_0x4d1bfd](_0x236805[_0x5605('0x71')],_0x236805['value']['start'],_0x236805[_0x5605('0x63')][_0x5605('0x6d')]);}}}else{var _0x261786=_(_0x361c9b[_0x5605('0x3c')])['keys']()[_0x5605('0x33')](function(_0x175b06){return _[_0x5605('0x72')](_0x34515b,['name',_0x175b06])?_0x175b06:undefined;})[_0x5605('0x73')]()[_0x5605('0x63')]();if(!_[_0x5605('0x74')](_0x261786)){_0x261786[_0x5605('0x75')](function(_0x2b0868){if(_0x2b0868===_0x5605('0x76')){_0x47776c[_0x5605('0x45')](_0x5605('0x77'),[][_0x5605('0x78')](_0x361c9b[_0x5605('0x3c')][_0x2b0868]));}else if(_0x2b0868===_0x5605('0x79')){var _0x5e6667=JSON[_0x5605('0x7a')](_0x361c9b[_0x5605('0x3c')][_0x2b0868])['$gte'];var _0x53373b=JSON[_0x5605('0x7a')](_0x361c9b[_0x5605('0x3c')][_0x2b0868])['$lte'];_0x47776c[_0x5605('0x45')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x5e6667,_0x53373b);}else{if(_0x361c9b[_0x5605('0x3c')][_0x2b0868]==='null'){_0x47776c[_0x5605('0x45')]('i.'+_0x2b0868+_0x5605('0x7b'));}else{_0x47776c[_0x5605('0x45')]('i.'+_0x2b0868+'\x20=\x20?',_0x361c9b[_0x5605('0x3c')][_0x2b0868]);}}});}if(_0x361c9b['query'][_0x5605('0x7c')]){if(_0x361c9b['query'][_0x5605('0x7c')]==0x1){_0x47776c['having']('`unreadMessages`\x20=\x200');}else{_0x47776c[_0x5605('0x64')](_0x5605('0x7d'));}}if(_0x361c9b['query']['tag']){_0x2a50b1=_['isArray'](_0x361c9b['query'][_0x5605('0x7e')])?_0x361c9b[_0x5605('0x3c')][_0x5605('0x7e')]:new Array(_0x361c9b['query'][_0x5605('0x7e')]);_0x2a50b1['forEach'](function(_0x309db4){_0x3fd5b1['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x309db4+',%');});}if(_0x361c9b[_0x5605('0x3c')][_0x5605('0x7f')]){var _0x43cbdf=_0x361c9b[_0x5605('0x3c')][_0x5605('0x7f')]['replace']('\x5c','\x5c\x5c')[_0x5605('0x80')](/'/g,'\x27\x27');if(qs[_0x5605('0x81')](_0x43cbdf)){_0x25e2b5['or'](_0x5605('0x82'),_0x43cbdf+'%');}else{_0x25e2b5['or'](_0x5605('0x83'),qs['getFullTextValue'](_0x43cbdf))['or'](_0x5605('0x84'),_0x43cbdf+'%')['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x43cbdf+'%');}}}_0x47776c[_0x5605('0x45')](_0x25e2b5);_0x47776c['group'](_0x5605('0x85'));var _0x2ff97b={'type':db[_0x5605('0x86')][_0x5605('0x87')]['SELECT'],'raw':!![]};var _0x5cbbf7=_0x47776c[_0x5605('0x88')]();_0x5cbbf7[_0x5605('0x48')](_0x5605('0x85'));_0x5cbbf7[_0x5605('0x48')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x5605('0x62'));if(_0x3ad6cb['order']){_0x3ad6cb[_0x5605('0x43')][_0x5605('0x75')](function(_0x4847ea){var _0x16bc3c=_0x4847ea[0x0]===_0x5605('0x89')?_0x4847ea[0x0]:'i.'+_0x4847ea[0x0];_0x47776c[_0x5605('0x43')](_0x16bc3c,_0x4847ea[0x1]===_0x5605('0x8a')?![]:!![]);});}if(!_[_0x5605('0x74')](_0x2a50b1)){_0x47776c[_0x5605('0x64')](_0x3fd5b1);_0x5cbbf7[_0x5605('0x45')](_0x5605('0x8b'),_0x2a50b1);}BPromise[_0x5605('0x8c')]()[_0x5605('0x2e')](function(){if(!_0x1bb77e){if(_0x361c9b[_0x5605('0x3c')]['OpenchannelAccountId'])return;_0x5cbbf7[_0x5605('0x45')]('i.OpenchannelAccountId\x20IS\x20NOT\x20NULL');_0x47776c[_0x5605('0x45')](_0x5605('0x8d'));return;}if(_0x361c9b['user'][_0x5605('0x8e')]!=='agent')return;return _0x361c9b[_0x5605('0x8f')]['getOpenchannelAccounts']({'attributes':['id'],'raw':!![]})['then'](function(_0x546096){if(_[_0x5605('0x74')](_0x546096)){_0x5cbbf7[_0x5605('0x45')](_0x5605('0x90'));_0x47776c['where'](_0x5605('0x90'));}else{_0x5cbbf7[_0x5605('0x45')](_0x5605('0x77'),_['map'](_0x546096,'id'));_0x47776c[_0x5605('0x45')](_0x5605('0x77'),_[_0x5605('0x33')](_0x546096,'id'));}});})[_0x5605('0x2e')](function(){if(_0x361c9b[_0x5605('0x8f')][_0x5605('0x8e')]===_0x5605('0x91')&&!_0x1bb77e&&!_0x361c9b[_0x5605('0x3c')][_0x5605('0x76')])return[];return db[_0x5605('0x92')][_0x5605('0x3c')](_0x5cbbf7['toString'](),_0x2ff97b);})[_0x5605('0x2e')](function(_0x2dcbf5){_0x3a8131[_0x5605('0x29')]=_0x2dcbf5['length'];if(_0x3a8131[_0x5605('0x29')]===0x0)return[];return db[_0x5605('0x92')][_0x5605('0x3c')](_0x4b7740['toString'](),_0x2ff97b)[_0x5605('0x2e')](function(_0x3afcb0){_0x51cd3e=_[_0x5605('0x93')](_0x3afcb0,'id');_0x2ff97b=_[_0x5605('0x94')](_0x2ff97b,{'model':db['OpenchannelInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x361c9b[_0x5605('0x3c')][_0x5605('0x41')]){_0x3ad6cb['attributes']['forEach'](function(_0x5c11bd){_0x47776c['field']('i.'+_0x5c11bd);});}else{_0x47776c['field'](_0x5605('0x95'),_0x5605('0x62'));_0x47776c[_0x5605('0x48')](_0x5605('0x96'),_0x5605('0x97'));_0x47776c[_0x5605('0x48')](_0x5605('0x98'),_0x5605('0x99'));_0x47776c['field'](_0x5605('0x9a'),_0x5605('0x89'));_0x47776c[_0x5605('0x48')](_0x5605('0x9b'));_0x47776c['field'](_0x5605('0x9c'),'Contact.firstName');_0x47776c[_0x5605('0x48')](_0x5605('0x9d'),'Contact.lastName');_0x47776c[_0x5605('0x48')](_0x5605('0x9e'),_0x5605('0x9f'));_0x47776c[_0x5605('0x48')](_0x5605('0xa0'),'Contact.phone');_0x47776c[_0x5605('0x48')](_0x5605('0xa1'),_0x5605('0xa2'));_0x47776c[_0x5605('0x48')](_0x5605('0xa3'),_0x5605('0xa4'));_0x47776c['field']('o.fullname','Owner.fullname');_0x47776c[_0x5605('0x48')](_0x5605('0xa5'),_0x5605('0xa6'));_0x47776c[_0x5605('0x48')](_0x5605('0xa7'),_0x5605('0x35'));}if(_0x3ad6cb[_0x5605('0x28')])_0x47776c['limit'](_0x3ad6cb['limit']);if(_0x3ad6cb[_0x5605('0x26')])_0x47776c[_0x5605('0x26')](_0x3ad6cb[_0x5605('0x26')]);return db['sequelize']['query'](_0x47776c[_0x5605('0xa8')](),_0x2ff97b);})['then'](function(_0x2b9e24){if(_0x2b9e24[_0x5605('0x5f')]>0x0)_0x9260a0[_0x5605('0x45')](_0x5605('0xa9'),_['map'](_0x2b9e24,'id'));return db[_0x5605('0x92')][_0x5605('0x3c')](_0x9260a0[_0x5605('0xa8')](),_0x2ff97b)['then'](function(_0x1aa788){var _0x29629d=_['groupBy'](_0x1aa788,_0x5605('0xaa'));var _0xf99d5a=[];_0x2b9e24[_0x5605('0x75')](function(_0x4112d8){_0xf99d5a['push'](updateOpenchannelInteraction(_0x4112d8,_0x51cd3e,_0x29629d));});return BPromise[_0x5605('0xab')](_0xf99d5a);});});})[_0x5605('0x2e')](function(_0x155c78){_0x3a8131[_0x5605('0xac')]=_0x155c78;return _0x3a8131;})[_0x5605('0x2e')](respondWithFilteredResult(_0x10814a,_0x3ad6cb))[_0x5605('0xad')](handleError(_0x10814a,null));};exports[_0x5605('0xae')]=function(_0x20d12c,_0x5b0ace){var _0x2fb85c={};if(_0x20d12c[_0x5605('0x3c')]['type']&&_0x20d12c['query'][_0x5605('0x3a')]===_0x5605('0x4a')){_0x2fb85c['from']=_0x20d12c[_0x5605('0xaf')]['id'];}else{_0x2fb85c['id']=_0x20d12c[_0x5605('0xaf')]['id'];}var _0x2353a1={'raw':![],'where':_0x2fb85c},_0x521e17={};_0x521e17[_0x5605('0x3b')]=_[_0x5605('0x3d')](db[_0x5605('0xb0')]['rawAttributes']);_0x521e17[_0x5605('0x3c')]=_[_0x5605('0x3d')](_0x20d12c[_0x5605('0x3c')]);_0x521e17[_0x5605('0x3e')]=_[_0x5605('0x3f')](_0x521e17[_0x5605('0x3b')],_0x521e17['query']);_0x2353a1['attributes']=_[_0x5605('0x3f')](_0x521e17['model'],qs[_0x5605('0x41')](_0x20d12c[_0x5605('0x3c')][_0x5605('0x41')]));_0x2353a1[_0x5605('0x40')]=_0x2353a1[_0x5605('0x40')][_0x5605('0x5f')]?_0x2353a1[_0x5605('0x40')]:_0x521e17[_0x5605('0x3b')];if(_0x20d12c[_0x5605('0x3c')][_0x5605('0xb1')]){_0x2353a1['include']=[{'all':!![]}];}_0x2353a1=_[_0x5605('0x94')]({},_0x2353a1,_0x20d12c[_0x5605('0xb2')]);return db[_0x5605('0xb0')][_0x5605('0x61')](_0x2353a1)[_0x5605('0x2e')](handleEntityNotFound(_0x5b0ace,null))[_0x5605('0x2e')](respondWithResult(_0x5b0ace,null))[_0x5605('0xad')](handleError(_0x5b0ace,null));};exports['create']=function(_0x55f8ec,_0x541de7){return db['OpenchannelInteraction'][_0x5605('0xb3')](_0x55f8ec['body'],{})['then'](respondWithResult(_0x541de7,0xc9))[_0x5605('0xad')](handleError(_0x541de7,null));};exports[_0x5605('0x2d')]=function(_0x2381a8,_0x598e52){if(_0x2381a8['body']['id']){delete _0x2381a8[_0x5605('0xb4')]['id'];}return db[_0x5605('0xb0')][_0x5605('0x61')]({'where':{'id':_0x2381a8[_0x5605('0xaf')]['id']}})[_0x5605('0x2e')](handleEntityNotFound(_0x598e52,null))[_0x5605('0x2e')](saveUpdates(_0x2381a8[_0x5605('0xb4')],null))[_0x5605('0x2e')](respondWithResult(_0x598e52,null))['catch'](handleError(_0x598e52,null));};exports['destroy']=function(_0x34991d,_0x548e71){return db['OpenchannelInteraction'][_0x5605('0x61')]({'where':{'id':_0x34991d[_0x5605('0xaf')]['id']}})[_0x5605('0x2e')](handleEntityNotFound(_0x548e71,null))[_0x5605('0x2e')](removeEntity(_0x548e71,null))['catch'](handleError(_0x548e71,null));};exports['describe']=function(_0x57eb53,_0x1a5f99){return db[_0x5605('0xb0')][_0x5605('0xb5')]()[_0x5605('0x2e')](respondWithResult(_0x1a5f99,null))[_0x5605('0xad')](handleError(_0x1a5f99,null));};exports[_0x5605('0xb6')]=function(_0x2e747e,_0x32dcaf,_0x1ff999){return db[_0x5605('0xb7')][_0x5605('0x61')]({'where':{'id':_0x2e747e['params']['id']}})[_0x5605('0x2e')](handleEntityNotFound(_0x32dcaf,null))[_0x5605('0x2e')](function(_0x246cd9){if(_0x246cd9){return _0x246cd9[_0x5605('0xb6')](_0x2e747e[_0x5605('0xb4')][_0x5605('0xb8')],_[_0x5605('0xb9')](_0x2e747e['body'],[_0x5605('0xb8'),'id'])||{});}})[_0x5605('0x2e')](respondWithResult(_0x32dcaf,null))[_0x5605('0xad')](handleError(_0x32dcaf,null));};exports['getMessages']=function(_0x4bb0d3,_0x11a381,_0x851d73){var _0x9c76a9={'raw':![],'where':{}};var _0x36fbb6={};var _0x498f70={'count':0x0,'rows':[]};return db[_0x5605('0xb0')]['findOne']({'where':{'id':_0x4bb0d3['params']['id']}})[_0x5605('0x2e')](handleEntityNotFound(_0x11a381,null))[_0x5605('0x2e')](function(_0x5c8cab){if(_0x5c8cab){_0x36fbb6[_0x5605('0x3b')]=_[_0x5605('0x3d')](db[_0x5605('0xb7')][_0x5605('0x38')]);_0x36fbb6[_0x5605('0x3c')]=_[_0x5605('0x3d')](_0x4bb0d3[_0x5605('0x3c')]);_0x36fbb6['filters']=_['intersection'](_0x36fbb6['model'],_0x36fbb6[_0x5605('0x3c')]);_0x9c76a9[_0x5605('0x40')]=_[_0x5605('0x3f')](_0x36fbb6[_0x5605('0x3b')],qs[_0x5605('0x41')](_0x4bb0d3[_0x5605('0x3c')][_0x5605('0x41')]));_0x9c76a9[_0x5605('0x40')]=_0x9c76a9[_0x5605('0x40')]['length']?_0x9c76a9[_0x5605('0x40')]:_0x36fbb6[_0x5605('0x3b')];if(!_0x4bb0d3[_0x5605('0x3c')][_0x5605('0xba')]('nolimit')){_0x9c76a9[_0x5605('0x28')]=qs[_0x5605('0x28')](_0x4bb0d3['query']['limit']);_0x9c76a9[_0x5605('0x26')]=qs[_0x5605('0x26')](_0x4bb0d3['query']['offset']);}_0x9c76a9[_0x5605('0x43')]=qs['sort'](_0x4bb0d3[_0x5605('0x3c')][_0x5605('0x44')]);_0x9c76a9[_0x5605('0x45')]=qs[_0x5605('0x3e')](_[_0x5605('0x46')](_0x4bb0d3[_0x5605('0x3c')],_0x36fbb6['filters']));_0x9c76a9['where'][_0x5605('0xaa')]=_0x5c8cab['id'];if(_0x4bb0d3[_0x5605('0x3c')]['filter']){_0x9c76a9[_0x5605('0x45')]=_[_0x5605('0x94')](_0x9c76a9['where'],{'$or':_[_0x5605('0x33')](_0x9c76a9['attributes'],function(_0x4fa7cc){var _0x38447e={};_0x38447e[_0x4fa7cc]={'$like':'%'+_0x4bb0d3[_0x5605('0x3c')]['filter']+'%'};return _0x38447e;})});}if(_0x4bb0d3[_0x5605('0x3c')]['$gte']){var _0x41247a=_0x4bb0d3[_0x5605('0x3c')][_0x5605('0xbb')]['split'](',');var _0x24a281={};_0x24a281[_0x41247a[0x0]]={'$gte':moment(_0x41247a[0x1])['format'](_0x5605('0xbc'))};_0x9c76a9[_0x5605('0x45')]=_['merge'](_0x9c76a9[_0x5605('0x45')],_0x24a281);}_0x9c76a9=_[_0x5605('0x94')]({},_0x9c76a9,_0x4bb0d3['options']);return db[_0x5605('0xb7')][_0x5605('0x29')]({'where':_0x9c76a9['where']})[_0x5605('0x2e')](function(_0x39bcfc){_0x498f70[_0x5605('0x29')]=_0x39bcfc;if(_0x4bb0d3[_0x5605('0x3c')][_0x5605('0xb1')]){_0x9c76a9[_0x5605('0xbd')]=[{'all':!![]}];}return db['OpenchannelMessage'][_0x5605('0xbe')](_0x9c76a9);})[_0x5605('0x2e')](function(_0x127e24){_0x498f70['rows']=_0x127e24;return _0x498f70;});}})[_0x5605('0x2e')](respondWithFilteredResult(_0x11a381,_0x9c76a9))[_0x5605('0xad')](handleError(_0x11a381,null));};exports['addTags']=function(_0x2b1563,_0x45990d,_0xf6bc04){return db[_0x5605('0xb0')][_0x5605('0x61')]({'where':{'id':_0x2b1563['params']['id']}})[_0x5605('0x2e')](handleEntityNotFound(_0x45990d,null))[_0x5605('0x2e')](function(_0x56d766){if(_0x56d766){return _0x56d766[_0x5605('0xbf')](_0x2b1563[_0x5605('0xb4')][_0x5605('0xb8')],_[_0x5605('0xb9')](_0x2b1563[_0x5605('0xb4')],['ids','id'])||{})[_0x5605('0xc0')](function(){return db[_0x5605('0x6e')][_0x5605('0xbe')]({'attributes':['id',_0x5605('0x31'),'color'],'where':{'id':_0x2b1563[_0x5605('0xb4')][_0x5605('0xb8')]}});})[_0x5605('0x2e')](function(_0x3941e5){socket['emit'](_0x5605('0xc1'),{'id':Number(_0x2b1563[_0x5605('0xaf')]['id']),'tags':_0x3941e5||[]});return{'id':Number(_0x2b1563[_0x5605('0xaf')]['id']),'tags':_0x3941e5||[]};});}})[_0x5605('0x2e')](respondWithResult(_0x45990d,null))[_0x5605('0xad')](handleError(_0x45990d,null));};exports[_0x5605('0xc2')]=function(_0x27d707,_0x1799ab,_0x20effc){return db[_0x5605('0xb0')][_0x5605('0x61')]({'where':{'id':_0x27d707['params']['id']}})[_0x5605('0x2e')](handleEntityNotFound(_0x1799ab,null))['then'](function(_0x5aeed1){if(_0x5aeed1){return _0x5aeed1[_0x5605('0xc2')](_0x27d707[_0x5605('0x3c')][_0x5605('0xb8')]);}})['then'](respondWithStatusCode(_0x1799ab,null))['catch'](handleError(_0x1799ab,null));};exports[_0x5605('0xc3')]=function(_0x167461,_0x49d7d8){var _0x226a81=moment()[_0x5605('0xc4')]()[_0x5605('0xa8')]();var _0x1f418d=path[_0x5605('0xc5')](config[_0x5605('0xc6')],'server',_0x5605('0xc7'),_0x5605('0xc8'));var _0x22f4a6=path['join'](config[_0x5605('0xc6')],_0x5605('0xc9'),'files','attachments');var _0x5a60f5=path[_0x5605('0xc5')](_0x1f418d,_0x226a81);var _0x370c9d=util[_0x5605('0xca')](_0x5605('0xcb'),_0x167461[_0x5605('0xaf')]['id'],_0x226a81);var _0x5787ab=path['join'](_0x1f418d,_0x370c9d);var _0x35fac4=[];_0x35fac4[_0x5605('0xcc')]({'model':db[_0x5605('0xcd')],'as':_0x5605('0xcd'),'attributes':['id','fullname'],'raw':!![]});_0x35fac4[_0x5605('0xcc')]({'model':db[_0x5605('0xce')],'as':_0x5605('0x66'),'attributes':['id','firstName',_0x5605('0xcf')],'raw':!![]});if(_0x167461[_0x5605('0x3c')]['attachments']){_0x35fac4[_0x5605('0xcc')]({'model':db[_0x5605('0xd0')],'as':_0x5605('0xd0'),'raw':!![]});}var _0x438bdb=[{'model':db['OpenchannelMessage'],'as':'Messages','attributes':['id','body',_0x5605('0x79'),_0x5605('0xd1'),_0x5605('0xd2'),'read'],'include':_0x35fac4}];_0x438bdb['push']({'model':db[_0x5605('0xd3')],'as':_0x5605('0xd4'),'attributes':['id',_0x5605('0x31')]});_0x438bdb['push']({'model':db['User'],'as':_0x5605('0xd5'),'attributes':['id',_0x5605('0x34')]});return db[_0x5605('0xb0')][_0x5605('0x61')]({'where':{'id':_0x167461['params']['id']},'include':_0x438bdb})[_0x5605('0x2e')](handleEntityNotFound(_0x49d7d8,null))[_0x5605('0x2e')](function(_0x284515){if(_0x284515){var _0x4a47b5=_0x284515[_0x5605('0xd6')]({'plain':!![]});fs[_0x5605('0xd7')](_0x5a60f5);var _0x33f58c={'channel':_0x5605('0xd8'),'account':_0x4a47b5['Account']['name'],'agent':_0x4a47b5[_0x5605('0xd5')]?_0x4a47b5[_0x5605('0xd5')][_0x5605('0x34')]:'N.A.','createdAt':moment(_0x4a47b5[_0x5605('0x79')])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0x5605('0xa8')](),'closedAt':_0x4a47b5[_0x5605('0xd9')]?moment(_0x4a47b5[_0x5605('0xda')])['format'](_0x5605('0xbc'))[_0x5605('0xa8')]():'','disposition':_0x4a47b5[_0x5605('0xdb')],'visibility':_0x4a47b5['threadId']?'Public':_0x5605('0xdc'),'messages':_(_0x4a47b5[_0x5605('0xdd')])['filter']({'secret':![]})[_0x5605('0x33')](function(_0x4c77a6){if(_0x4c77a6[_0x5605('0xd0')]){var _0x4874e0=path[_0x5605('0xc5')](_0x22f4a6,_0x4c77a6[_0x5605('0xd0')]['basename']);if(fs['existsSync'](_0x4874e0)){fs['createReadStream'](_0x4874e0)['pipe'](fs[_0x5605('0xde')](path[_0x5605('0xc5')](_0x5a60f5,_0x4c77a6[_0x5605('0xd0')][_0x5605('0xdf')])));}}return{'date':moment(_0x4c77a6['createdAt'])['format'](_0x5605('0xbc'))['toString'](),'sender':_0x4c77a6[_0x5605('0xd1')]===_0x5605('0xe0')?_0x4c77a6[_0x5605('0xcd')]?_0x4c77a6[_0x5605('0xcd')]['fullname']:_0x5605('0xe1'):_0x4c77a6[_0x5605('0x66')][_0x5605('0xe2')]+(_0x4c77a6['Contact'][_0x5605('0xcf')]?'\x20'+_0x4c77a6[_0x5605('0x66')][_0x5605('0xcf')]:''),'body':_0x4c77a6[_0x5605('0xd0')]?_0x4c77a6[_0x5605('0xd0')][_0x5605('0xdf')]:_0x4c77a6['body'],'direction':_0x4c77a6[_0x5605('0xd1')]===_0x5605('0xe0')?'A':'C','secret':_0x4c77a6[_0x5605('0xd2')],'read':_0x4c77a6[_0x5605('0x7c')],'attachment':_0x4c77a6[_0x5605('0xd0')]};})[_0x5605('0x63')]()};return ejs['renderFile'](path[_0x5605('0xc5')](config['root'],'server',_0x5605('0xe3'),_0x5605('0xe4')),{'interaction':_0x33f58c})[_0x5605('0x2e')](function(_0x5251f5){var _0x5ba696=path[_0x5605('0xc5')](_0x5a60f5,_0x5605('0xe5')+_0x4a47b5['id']+'-'+_0x226a81+_0x5605('0xe6'));var _0x12afee={'path':_0x5ba696,'channel':_0x5605('0xd8'),'interactionId':_0x4a47b5['id']};return pdf['createPdfFromHTML'](_0x5251f5,_0x12afee);})[_0x5605('0x2e')](function(){return new BPromise(function(_0x16ed7c,_0x36c404){zipdir(_0x5a60f5,{'saveTo':_0x5787ab},function(_0x392659,_0xa75060){if(_0x392659)return _0x36c404(_0x392659);return _0x16ed7c(_0xa75060);});})['then'](function(){return new BPromise(function(_0x405803,_0x205714){rimraf(_0x5a60f5,function(_0x20940c){if(_0x20940c)_0x205714(_0x20940c);return _0x405803();});});})[_0x5605('0x2e')](function(){return _0x49d7d8[_0x5605('0xc3')](_0x5787ab,_0x370c9d,function(_0x194f83){if(_0x194f83){console[_0x5605('0xe7')](_0x5605('0xe8'),_0x194f83);}else{fs[_0x5605('0xe9')](_0x5787ab);}});});});}else{return _0x49d7d8[_0x5605('0x23')](0xc8);}})[_0x5605('0xad')](handleError(_0x49d7d8,null));}; \ No newline at end of file +var _0x0070=['having','`\x20>\x200','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','type','start','body','text','some','isEmpty','OpenchannelAccountId','i.OpenchannelAccountId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','where','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','filter','replace','isNumeric','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','i.from\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','order','contactName','DESC','t.id\x20IN\x20?','resolve','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getOpenchannelAccounts','i.OpenchannelAccountId\x20IS\x20NULL','toString','sequelize','keyBy','merge','a.key','a.mandatoryDisposition','i.*','c.firstName','c.lastName','Contact.lastName','Contact.email','c.phone','Contact.phone','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.OpenchannelInteractionId\x20IN\x20?','groupBy','all','show','params','include','options','create','catch','describe','ids','omit','getMessages','findOne','OpenchannelMessage','includeAll','findAll','rows','addTags','setTags','spread','emit','removeTags','download','join','root','server','files','format','transcript-%d-%s.zip','CmContact','firstName','lastName','Attachment','direction','secret','OpenchannelAccount','Account','get','Openchannel','Owner','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','disposition','threadId','Private','Messages','existsSync','pipe','createWriteStream','basename','System','views','transcript-','.pdf','createPdfFromHTML','log','err','unlinkSync','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','register','end','status','json','offset','limit','undefined','count','set','Content-Range','apply','save','update','then','destroy','sendStatus','error','name','send','fullname','TagIds','split','forEach','Tags','push','index','map','OpenchannelInteraction','rawAttributes','fieldName','key','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','pick','field','color','from','tools_tags','select','u.id','u.fullname','ui.OpenchannelInteractionId','user_has_openchannel_interactions','left_join','users','openchannel_interactions','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','openchannel_accounts','a.id\x20=\x20i.OpenchannelAccountId','openchannel_messages','me.OpenchannelInteractionId\x20=\x20i.id','it.OpenchannelInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','parseSearch','search','conditions','find','unreadMessages','value'];(function(_0x2bf12b,_0x4fae21){var _0x5b54f7=function(_0x5d53fa){while(--_0x5d53fa){_0x2bf12b['push'](_0x2bf12b['shift']());}};_0x5b54f7(++_0x4fae21);}(_0x0070,0x8b));var _0x0007=function(_0x3f0c06,_0x3d0ecf){_0x3f0c06=_0x3f0c06-0x0;var _0x507d9f=_0x0070[_0x3f0c06];return _0x507d9f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0007('0x0'));var zipdir=require(_0x0007('0x1'));var jsonpatch=require(_0x0007('0x2'));var rp=require(_0x0007('0x3'));var moment=require(_0x0007('0x4'));var BPromise=require(_0x0007('0x5'));var Mustache=require(_0x0007('0x6'));var util=require(_0x0007('0x7'));var path=require(_0x0007('0x8'));var sox=require(_0x0007('0x9'));var csv=require(_0x0007('0xa'));var ejs=require(_0x0007('0xb'));var fs=require('fs');var fs_extra=require(_0x0007('0xc'));var _=require(_0x0007('0xd'));var squel=require(_0x0007('0xe'));var crypto=require(_0x0007('0xf'));var jsforce=require(_0x0007('0x10'));var deskjs=require(_0x0007('0x11'));var toCsv=require(_0x0007('0xa'));var querystring=require(_0x0007('0x12'));var Papa=require('papaparse');var Redis=require(_0x0007('0x13'));var authService=require(_0x0007('0x14'));var qs=require(_0x0007('0x15'));var as=require(_0x0007('0x16'));var pdf=require(_0x0007('0x17'));var hardwareService=require(_0x0007('0x18'));var logger=require(_0x0007('0x19'))(_0x0007('0x1a'));var utils=require(_0x0007('0x1b'));var config=require(_0x0007('0x1c'));var licenseUtil=require(_0x0007('0x1d'));var db=require(_0x0007('0x1e'))['db'];config[_0x0007('0x1f')]=_['defaults'](config[_0x0007('0x1f')],{'host':_0x0007('0x20'),'port':0x18eb});var socket=require(_0x0007('0x21'))(new Redis(config[_0x0007('0x1f')]));require('./openchannelInteraction.socket')[_0x0007('0x22')](socket);function respondWithStatusCode(_0x1e1259,_0x3077d7){_0x3077d7=_0x3077d7||0xcc;return function(_0x1dc228){if(_0x1dc228){return _0x1e1259['sendStatus'](_0x3077d7);}return _0x1e1259['status'](_0x3077d7)[_0x0007('0x23')]();};}function respondWithResult(_0x1f9c35,_0x596ece){_0x596ece=_0x596ece||0xc8;return function(_0x598d76){if(_0x598d76){return _0x1f9c35[_0x0007('0x24')](_0x596ece)[_0x0007('0x25')](_0x598d76);}};}function respondWithFilteredResult(_0x35ef66,_0x16f9a3){return function(_0x4db7fe){if(_0x4db7fe){var _0x19ac54=typeof _0x16f9a3[_0x0007('0x26')]==='undefined'&&typeof _0x16f9a3[_0x0007('0x27')]===_0x0007('0x28');var _0x40336d=_0x4db7fe[_0x0007('0x29')];var _0x457819=_0x19ac54?0x0:_0x16f9a3[_0x0007('0x26')];var _0x3e0692=_0x19ac54?_0x4db7fe['count']:_0x16f9a3['offset']+_0x16f9a3[_0x0007('0x27')];var _0x3e185e;if(_0x3e0692>=_0x40336d){_0x3e0692=_0x40336d;_0x3e185e=0xc8;}else{_0x3e185e=0xce;}_0x35ef66['status'](_0x3e185e);return _0x35ef66[_0x0007('0x2a')](_0x0007('0x2b'),_0x457819+'-'+_0x3e0692+'/'+_0x40336d)['json'](_0x4db7fe);}return null;};}function patchUpdates(_0x5cecc1){return function(_0x269788){try{jsonpatch[_0x0007('0x2c')](_0x269788,_0x5cecc1,!![]);}catch(_0x195b5b){return BPromise['reject'](_0x195b5b);}return _0x269788[_0x0007('0x2d')]();};}function saveUpdates(_0xfddb8b,_0x3ebaf2){return function(_0x4f3a3c){if(_0x4f3a3c){return _0x4f3a3c[_0x0007('0x2e')](_0xfddb8b)[_0x0007('0x2f')](function(_0x2bd394){return _0x2bd394;});}return null;};}function removeEntity(_0x1e8821,_0xd6fec6){return function(_0x5b5933){if(_0x5b5933){return _0x5b5933[_0x0007('0x30')]()['then'](function(){_0x1e8821[_0x0007('0x24')](0xcc)[_0x0007('0x23')]();});}};}function handleEntityNotFound(_0x3766c5,_0x2b4b88){return function(_0x26a43b){if(!_0x26a43b){_0x3766c5[_0x0007('0x31')](0x194);}return _0x26a43b;};}function handleError(_0x50d95e,_0x330895){_0x330895=_0x330895||0x1f4;return function(_0x557c54){logger[_0x0007('0x32')](_0x557c54['stack']);if(_0x557c54['name']){delete _0x557c54[_0x0007('0x33')];}_0x50d95e[_0x0007('0x24')](_0x330895)[_0x0007('0x34')](_0x557c54);};}function getInteractionUsers(_0x4ff2d3,_0x3c4983){return new BPromise(function(_0x4a84ec,_0x9955b8){try{if(_0x3c4983[_0x4ff2d3['id']]){_0x4ff2d3['Users']=_['map'](_0x3c4983[_0x4ff2d3['id']],function(_0x15d42b){return{'id':_0x15d42b['id'],'fullname':_0x15d42b[_0x0007('0x35')]};});}}catch(_0x599416){_0x9955b8(_0x599416);}_0x4a84ec(_0x4ff2d3);});}function getInteractionTags(_0x2e2148,_0x4d32c6){return new BPromise(function(_0x885f6e,_0x2ee329){try{if(_0x2e2148[_0x0007('0x36')]){_0x2e2148['Tags']=[];_0x2e2148[_0x0007('0x36')][_0x0007('0x37')](',')[_0x0007('0x38')](function(_0x218b9b){_0x2e2148[_0x0007('0x39')][_0x0007('0x3a')](_0x4d32c6[_0x218b9b]);});}delete _0x2e2148[_0x0007('0x36')];}catch(_0x49fdb9){_0x2ee329(_0x49fdb9);}_0x885f6e(_0x2e2148);});}function updateOpenchannelInteraction(_0x2ffe36,_0x31fea9,_0x8ac873){return new BPromise(function(_0x3dacf9,_0x1e848a){return getInteractionUsers(_0x2ffe36,_0x8ac873)['then'](function(_0x407bbd){return getInteractionTags(_0x407bbd,_0x31fea9);})['then'](function(_0x113b89){_0x3dacf9(_0x113b89);})['catch'](function(_0x23f705){_0x1e848a(_0x23f705);});});}exports[_0x0007('0x3b')]=function(_0x21bdcc,_0x2b8792){var _0x1e2baf={},_0x2662ef={},_0x49d9d4={'count':0x0,'rows':[]};var _0x139c41=_[_0x0007('0x3c')](db[_0x0007('0x3d')][_0x0007('0x3e')],function(_0x415e14){return{'name':_0x415e14[_0x0007('0x3f')],'type':_0x415e14['type'][_0x0007('0x40')]};});_0x2662ef['model']=_[_0x0007('0x3c')](_0x139c41,_0x0007('0x33'));_0x2662ef[_0x0007('0x41')]=_[_0x0007('0x42')](_0x21bdcc[_0x0007('0x41')]);_0x2662ef[_0x0007('0x43')]=_['intersection'](_0x2662ef[_0x0007('0x44')],_0x2662ef[_0x0007('0x41')]);_0x1e2baf[_0x0007('0x45')]=_[_0x0007('0x46')](_0x2662ef[_0x0007('0x44')],qs[_0x0007('0x47')](_0x21bdcc['query']['fields']));_0x1e2baf['attributes']=_0x1e2baf[_0x0007('0x45')][_0x0007('0x48')]?_0x1e2baf['attributes']:_0x2662ef[_0x0007('0x44')];if(!_0x21bdcc[_0x0007('0x41')][_0x0007('0x49')](_0x0007('0x4a'))){_0x1e2baf[_0x0007('0x27')]=qs[_0x0007('0x27')](_0x21bdcc[_0x0007('0x41')]['limit']);_0x1e2baf[_0x0007('0x26')]=qs[_0x0007('0x26')](_0x21bdcc['query'][_0x0007('0x26')]);}_0x1e2baf['order']=qs[_0x0007('0x4b')](_0x21bdcc['query']['sort']);_0x1e2baf['where']=qs['filters'](_[_0x0007('0x4c')](_0x21bdcc[_0x0007('0x41')],_0x2662ef[_0x0007('0x43')]),_0x139c41);var _0x5b8872=[];var _0x4a6cf7=squel['select']()[_0x0007('0x4d')]('id')[_0x0007('0x4d')](_0x0007('0x33'))['field'](_0x0007('0x4e'))[_0x0007('0x4f')](_0x0007('0x50'));var _0x1f1408=squel[_0x0007('0x51')]()[_0x0007('0x4d')](_0x0007('0x52'))[_0x0007('0x4d')](_0x0007('0x53'))[_0x0007('0x4d')](_0x0007('0x54'))[_0x0007('0x4f')](_0x0007('0x55'),'ui')[_0x0007('0x56')](_0x0007('0x57'),'u','u.id\x20=\x20ui.UserId');var _0x37be91=squel[_0x0007('0x51')]()[_0x0007('0x4f')](_0x0007('0x58'),'i')[_0x0007('0x56')]('cm_contacts','c',_0x0007('0x59'))[_0x0007('0x56')]('users','o','o.id\x20=\x20i.UserId')[_0x0007('0x56')](_0x0007('0x5a'),'a',_0x0007('0x5b'))[_0x0007('0x56')](_0x0007('0x5c'),'me',_0x0007('0x5d'))[_0x0007('0x56')]('openchannel_interaction_has_tags','it',_0x0007('0x5e'))[_0x0007('0x56')](_0x0007('0x50'),'t',_0x0007('0x5f'));var _0x348d5b=squel['expr']();var _0x5e7090=[];var _0x3d4070=squel['expr']();var _0x2857c2;if(_0x21bdcc['query']['search']){_0x2857c2=as[_0x0007('0x60')](_0x21bdcc[_0x0007('0x41')][_0x0007('0x61')]);var _0x32c079=_0x2857c2['sqlOperator'];for(var _0x1b74d2=0x0;_0x1b74d2<_0x2857c2[_0x0007('0x62')][_0x0007('0x48')];_0x1b74d2++){var _0x4c63f9=_0x2857c2[_0x0007('0x62')][_0x1b74d2];var _0xad8a40='i';var _0x55bad2=_[_0x0007('0x63')](_0x139c41,[_0x0007('0x33'),_0x4c63f9[_0x0007('0x4d')]]);if(!_0x55bad2){switch(_0x4c63f9[_0x0007('0x4d')]){case _0x0007('0x64'):if(_0x4c63f9[_0x0007('0x65')]==0x1){_0x37be91['having']('`'+_0x4c63f9[_0x0007('0x4d')]+'`\x20=\x200');}else{_0x37be91[_0x0007('0x66')]('`'+_0x4c63f9['field']+_0x0007('0x67'));}break;case _0x0007('0x68'):if(_0x4c63f9[_0x0007('0x69')]===_0x0007('0x6a')){if(_0x4c63f9[_0x0007('0x65')]['split']('\x20')['length']>0x1){_0x348d5b[_0x32c079](_0x0007('0x6b'),qs[_0x0007('0x6c')](_0x4c63f9[_0x0007('0x65')]),null);}else{var _0x3a9cc7='%'+_0x4c63f9[_0x0007('0x65')]+'%';_0x348d5b[_0x32c079](_0x0007('0x6d'),_0x3a9cc7,_0x3a9cc7,_0x3a9cc7);}}else{_0x55bad2=_[_0x0007('0x63')](_0x139c41,[_0x0007('0x33'),_0x0007('0x6e')]);_0x4c63f9[_0x0007('0x4d')]=_0x0007('0x6e');_0xbf7553=as[_0x0007('0x6f')](_0xad8a40,_0x55bad2['type'],_0x4c63f9);_0x348d5b[_0x32c079](_0xbf7553['text'],_0xbf7553[_0x0007('0x65')]['start'],_0xbf7553[_0x0007('0x65')]['end']);}break;case _0x0007('0x70'):var _0x34d53d=_0x4c63f9[_0x0007('0x65')][_0x0007('0x37')](',')[_0x0007('0x3c')](function(_0x566b24){return Number(_0x566b24);});_0x34d53d[_0x0007('0x38')](function(_0x51e488){_0x3d4070['or'](_0x0007('0x71'),'%,'+_0x51e488+',%');});_0x5e7090=_[_0x0007('0x72')](_0x5e7090,_0x34d53d);break;case _0x0007('0x73'):if(_0x4c63f9['operator']===_0x0007('0x6a')){_0x348d5b[_0x32c079](_0x0007('0x74'),'%'+_0x4c63f9[_0x0007('0x65')]+'%',null);}else{_0x55bad2=_[_0x0007('0x63')](_0x139c41,[_0x0007('0x33'),_0x0007('0x75')]);_0x4c63f9[_0x0007('0x4d')]='UserId';_0xbf7553=as[_0x0007('0x6f')](_0xad8a40,_0x55bad2[_0x0007('0x76')],_0x4c63f9);_0x348d5b[_0x32c079](_0xbf7553['text'],_0xbf7553[_0x0007('0x65')][_0x0007('0x77')],_0xbf7553[_0x0007('0x65')]['end']);}break;case _0x0007('0x78'):_0xbf7553=as[_0x0007('0x6f')]('me',null,_0x4c63f9);_0x348d5b[_0x32c079](_0xbf7553[_0x0007('0x79')],_0xbf7553[_0x0007('0x65')][_0x0007('0x77')],_0xbf7553['value'][_0x0007('0x23')]);break;}}else{var _0xbf7553=as[_0x0007('0x6f')](_0xad8a40,_0x55bad2[_0x0007('0x76')],_0x4c63f9);_0x348d5b[_0x32c079](_0xbf7553['text'],_0xbf7553[_0x0007('0x65')]['start'],_0xbf7553[_0x0007('0x65')][_0x0007('0x23')]);}}}else{var _0x168379=_(_0x21bdcc['query'])[_0x0007('0x42')]()[_0x0007('0x3c')](function(_0xb23627){return _[_0x0007('0x7a')](_0x139c41,['name',_0xb23627])?_0xb23627:undefined;})['compact']()[_0x0007('0x65')]();if(!_[_0x0007('0x7b')](_0x168379)){_0x168379[_0x0007('0x38')](function(_0x58761d){if(_0x58761d===_0x0007('0x7c')){_0x37be91['where'](_0x0007('0x7d'),[][_0x0007('0x7e')](_0x21bdcc[_0x0007('0x41')][_0x58761d]));}else if(_0x58761d===_0x0007('0x7f')){var _0x4b2b76=JSON[_0x0007('0x80')](_0x21bdcc[_0x0007('0x41')][_0x58761d])[_0x0007('0x81')];var _0x2901c5=JSON[_0x0007('0x80')](_0x21bdcc[_0x0007('0x41')][_0x58761d])[_0x0007('0x82')];_0x37be91['where'](_0x0007('0x83'),_0x4b2b76,_0x2901c5);}else{if(_0x21bdcc[_0x0007('0x41')][_0x58761d]==='null'){_0x37be91[_0x0007('0x84')]('i.'+_0x58761d+'\x20IS\x20NULL');}else{_0x37be91['where']('i.'+_0x58761d+'\x20=\x20?',_0x21bdcc['query'][_0x58761d]);}}});}if(_0x21bdcc[_0x0007('0x41')]['read']){if(_0x21bdcc[_0x0007('0x41')][_0x0007('0x85')]==0x1){_0x37be91[_0x0007('0x66')](_0x0007('0x86'));}else{_0x37be91[_0x0007('0x66')](_0x0007('0x87'));}}if(_0x21bdcc[_0x0007('0x41')][_0x0007('0x88')]){_0x5e7090=_['isArray'](_0x21bdcc['query'][_0x0007('0x88')])?_0x21bdcc[_0x0007('0x41')][_0x0007('0x88')]:new Array(_0x21bdcc[_0x0007('0x41')][_0x0007('0x88')]);_0x5e7090[_0x0007('0x38')](function(_0x28b705){_0x3d4070['or'](_0x0007('0x71'),'%,'+_0x28b705+',%');});}if(_0x21bdcc[_0x0007('0x41')][_0x0007('0x89')]){var _0x29b47f=_0x21bdcc[_0x0007('0x41')]['filter'][_0x0007('0x8a')]('\x5c','\x5c\x5c')[_0x0007('0x8a')](/'/g,'\x27\x27');if(qs[_0x0007('0x8b')](_0x29b47f)){_0x348d5b['or']('i.id\x20LIKE\x20?',_0x29b47f+'%');}else{_0x348d5b['or'](_0x0007('0x8c'),qs['getFullTextValue'](_0x29b47f))['or'](_0x0007('0x8d'),_0x29b47f+'%')['or'](_0x0007('0x8e'),_0x29b47f+'%');}}}_0x37be91[_0x0007('0x84')](_0x348d5b);_0x37be91[_0x0007('0x8f')](_0x0007('0x90'));var _0x17b43f={'type':db['Sequelize'][_0x0007('0x91')][_0x0007('0x92')],'raw':!![]};var _0x5084ac=_0x37be91[_0x0007('0x93')]();_0x5084ac[_0x0007('0x4d')](_0x0007('0x90'));_0x5084ac[_0x0007('0x4d')](_0x0007('0x94'),_0x0007('0x64'));if(_0x1e2baf[_0x0007('0x95')]){_0x1e2baf[_0x0007('0x95')][_0x0007('0x38')](function(_0x47fa9f){var _0x2fb229=_0x47fa9f[0x0]===_0x0007('0x96')?_0x47fa9f[0x0]:'i.'+_0x47fa9f[0x0];_0x37be91['order'](_0x2fb229,_0x47fa9f[0x1]===_0x0007('0x97')?![]:!![]);});}if(!_['isEmpty'](_0x5e7090)){_0x37be91[_0x0007('0x66')](_0x3d4070);_0x5084ac[_0x0007('0x84')](_0x0007('0x98'),_0x5e7090);}BPromise[_0x0007('0x99')]()['then'](function(){if(!_0x2857c2){if(_0x21bdcc['query'][_0x0007('0x7c')])return;_0x5084ac[_0x0007('0x84')](_0x0007('0x9a'));_0x37be91[_0x0007('0x84')](_0x0007('0x9a'));return;}if(_0x21bdcc[_0x0007('0x9b')][_0x0007('0x9c')]!==_0x0007('0x9d'))return;return _0x21bdcc[_0x0007('0x9b')][_0x0007('0x9e')]({'attributes':['id'],'raw':!![]})[_0x0007('0x2f')](function(_0x4d827e){if(_[_0x0007('0x7b')](_0x4d827e)){_0x5084ac[_0x0007('0x84')](_0x0007('0x9f'));_0x37be91[_0x0007('0x84')](_0x0007('0x9f'));}else{_0x5084ac[_0x0007('0x84')](_0x0007('0x7d'),_[_0x0007('0x3c')](_0x4d827e,'id'));_0x37be91[_0x0007('0x84')](_0x0007('0x7d'),_['map'](_0x4d827e,'id'));}});})[_0x0007('0x2f')](function(){if(_0x21bdcc['user'][_0x0007('0x9c')]===_0x0007('0x9d')&&!_0x2857c2&&!_0x21bdcc[_0x0007('0x41')][_0x0007('0x7c')])return[];return db['sequelize'][_0x0007('0x41')](_0x5084ac[_0x0007('0xa0')](),_0x17b43f);})[_0x0007('0x2f')](function(_0x2e5559){_0x49d9d4[_0x0007('0x29')]=_0x2e5559[_0x0007('0x48')];if(_0x49d9d4['count']===0x0)return[];return db[_0x0007('0xa1')][_0x0007('0x41')](_0x4a6cf7[_0x0007('0xa0')](),_0x17b43f)['then'](function(_0x4ca4){_0x5b8872=_[_0x0007('0xa2')](_0x4ca4,'id');_0x17b43f=_[_0x0007('0xa3')](_0x17b43f,{'model':db[_0x0007('0x3d')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x21bdcc[_0x0007('0x41')][_0x0007('0x47')]){_0x1e2baf['attributes'][_0x0007('0x38')](function(_0x1aaec5){_0x37be91[_0x0007('0x4d')]('i.'+_0x1aaec5);});}else{_0x37be91[_0x0007('0x4d')](_0x0007('0x94'),_0x0007('0x64'));_0x37be91['field'](_0x0007('0xa4'),'Account.key');_0x37be91[_0x0007('0x4d')](_0x0007('0xa5'),'Account.mandatoryDisposition');_0x37be91[_0x0007('0x4d')]('CASE\x20WHEN\x20i.from\x20IS\x20NOT\x20NULL\x20AND\x20i.from\x20<>\x20\x27\x27\x20THEN\x20i.from\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName');_0x37be91[_0x0007('0x4d')](_0x0007('0xa6'));_0x37be91[_0x0007('0x4d')](_0x0007('0xa7'),'Contact.firstName');_0x37be91[_0x0007('0x4d')](_0x0007('0xa8'),_0x0007('0xa9'));_0x37be91[_0x0007('0x4d')]('c.email',_0x0007('0xaa'));_0x37be91[_0x0007('0x4d')](_0x0007('0xab'),_0x0007('0xac'));_0x37be91[_0x0007('0x4d')]('c.mobile',_0x0007('0xad'));_0x37be91[_0x0007('0x4d')](_0x0007('0xae'),_0x0007('0xaf'));_0x37be91['field'](_0x0007('0xb0'),_0x0007('0xb1'));_0x37be91[_0x0007('0x4d')](_0x0007('0xb2'),_0x0007('0xb3'));_0x37be91[_0x0007('0x4d')](_0x0007('0xb4'),_0x0007('0x36'));}if(_0x1e2baf[_0x0007('0x27')])_0x37be91[_0x0007('0x27')](_0x1e2baf[_0x0007('0x27')]);if(_0x1e2baf[_0x0007('0x26')])_0x37be91[_0x0007('0x26')](_0x1e2baf[_0x0007('0x26')]);return db[_0x0007('0xa1')]['query'](_0x37be91[_0x0007('0xa0')](),_0x17b43f);})[_0x0007('0x2f')](function(_0x3509c0){if(_0x3509c0[_0x0007('0x48')]>0x0)_0x1f1408[_0x0007('0x84')](_0x0007('0xb5'),_[_0x0007('0x3c')](_0x3509c0,'id'));return db[_0x0007('0xa1')][_0x0007('0x41')](_0x1f1408['toString'](),_0x17b43f)[_0x0007('0x2f')](function(_0x5c3668){var _0x53e06f=_[_0x0007('0xb6')](_0x5c3668,'OpenchannelInteractionId');var _0x33f85c=[];_0x3509c0[_0x0007('0x38')](function(_0x52db37){_0x33f85c[_0x0007('0x3a')](updateOpenchannelInteraction(_0x52db37,_0x5b8872,_0x53e06f));});return BPromise[_0x0007('0xb7')](_0x33f85c);});});})[_0x0007('0x2f')](function(_0xe67d1c){_0x49d9d4['rows']=_0xe67d1c;return _0x49d9d4;})[_0x0007('0x2f')](respondWithFilteredResult(_0x2b8792,_0x1e2baf))['catch'](handleError(_0x2b8792,null));};exports[_0x0007('0xb8')]=function(_0x27525d,_0x57437e){var _0x505b1d={};if(_0x27525d[_0x0007('0x41')][_0x0007('0x76')]&&_0x27525d['query'][_0x0007('0x76')]==='from'){_0x505b1d[_0x0007('0x4f')]=_0x27525d[_0x0007('0xb9')]['id'];}else{_0x505b1d['id']=_0x27525d['params']['id'];}var _0x227398={'raw':![],'where':_0x505b1d},_0x3ae55c={};_0x3ae55c[_0x0007('0x44')]=_[_0x0007('0x42')](db[_0x0007('0x3d')][_0x0007('0x3e')]);_0x3ae55c[_0x0007('0x41')]=_[_0x0007('0x42')](_0x27525d[_0x0007('0x41')]);_0x3ae55c[_0x0007('0x43')]=_[_0x0007('0x46')](_0x3ae55c['model'],_0x3ae55c[_0x0007('0x41')]);_0x227398[_0x0007('0x45')]=_[_0x0007('0x46')](_0x3ae55c[_0x0007('0x44')],qs['fields'](_0x27525d[_0x0007('0x41')][_0x0007('0x47')]));_0x227398[_0x0007('0x45')]=_0x227398['attributes'][_0x0007('0x48')]?_0x227398[_0x0007('0x45')]:_0x3ae55c[_0x0007('0x44')];if(_0x27525d[_0x0007('0x41')]['includeAll']){_0x227398[_0x0007('0xba')]=[{'all':!![]}];}_0x227398=_['merge']({},_0x227398,_0x27525d[_0x0007('0xbb')]);return db[_0x0007('0x3d')][_0x0007('0x63')](_0x227398)['then'](handleEntityNotFound(_0x57437e,null))['then'](respondWithResult(_0x57437e,null))['catch'](handleError(_0x57437e,null));};exports[_0x0007('0xbc')]=function(_0x410a07,_0x3aa34b){return db['OpenchannelInteraction'][_0x0007('0xbc')](_0x410a07['body'],{})[_0x0007('0x2f')](respondWithResult(_0x3aa34b,0xc9))['catch'](handleError(_0x3aa34b,null));};exports['update']=function(_0x557dc1,_0x49a574){if(_0x557dc1[_0x0007('0x78')]['id']){delete _0x557dc1[_0x0007('0x78')]['id'];}return db['OpenchannelInteraction'][_0x0007('0x63')]({'where':{'id':_0x557dc1[_0x0007('0xb9')]['id']}})[_0x0007('0x2f')](handleEntityNotFound(_0x49a574,null))[_0x0007('0x2f')](saveUpdates(_0x557dc1[_0x0007('0x78')],null))[_0x0007('0x2f')](respondWithResult(_0x49a574,null))[_0x0007('0xbd')](handleError(_0x49a574,null));};exports[_0x0007('0x30')]=function(_0x3042ae,_0x41498f){return db[_0x0007('0x3d')][_0x0007('0x63')]({'where':{'id':_0x3042ae[_0x0007('0xb9')]['id']}})[_0x0007('0x2f')](handleEntityNotFound(_0x41498f,null))[_0x0007('0x2f')](removeEntity(_0x41498f,null))[_0x0007('0xbd')](handleError(_0x41498f,null));};exports[_0x0007('0xbe')]=function(_0x2303be,_0x428dac){return db[_0x0007('0x3d')][_0x0007('0xbe')]()['then'](respondWithResult(_0x428dac,null))[_0x0007('0xbd')](handleError(_0x428dac,null));};exports['addMessage']=function(_0x50f5b6,_0x245faa,_0x1ec121){return db['OpenchannelMessage'][_0x0007('0x63')]({'where':{'id':_0x50f5b6[_0x0007('0xb9')]['id']}})[_0x0007('0x2f')](handleEntityNotFound(_0x245faa,null))['then'](function(_0x16b245){if(_0x16b245){return _0x16b245['addMessage'](_0x50f5b6[_0x0007('0x78')][_0x0007('0xbf')],_[_0x0007('0xc0')](_0x50f5b6[_0x0007('0x78')],[_0x0007('0xbf'),'id'])||{});}})['then'](respondWithResult(_0x245faa,null))[_0x0007('0xbd')](handleError(_0x245faa,null));};exports[_0x0007('0xc1')]=function(_0x45741f,_0x6777ee,_0x24fea5){var _0x152bff={'raw':![],'where':{}};var _0x27ad0a={};var _0x117b33={'count':0x0,'rows':[]};return db[_0x0007('0x3d')][_0x0007('0xc2')]({'where':{'id':_0x45741f['params']['id']}})[_0x0007('0x2f')](handleEntityNotFound(_0x6777ee,null))['then'](function(_0x36eb2d){if(_0x36eb2d){_0x27ad0a[_0x0007('0x44')]=_[_0x0007('0x42')](db[_0x0007('0xc3')][_0x0007('0x3e')]);_0x27ad0a[_0x0007('0x41')]=_[_0x0007('0x42')](_0x45741f[_0x0007('0x41')]);_0x27ad0a['filters']=_[_0x0007('0x46')](_0x27ad0a[_0x0007('0x44')],_0x27ad0a[_0x0007('0x41')]);_0x152bff[_0x0007('0x45')]=_['intersection'](_0x27ad0a['model'],qs['fields'](_0x45741f['query']['fields']));_0x152bff[_0x0007('0x45')]=_0x152bff[_0x0007('0x45')][_0x0007('0x48')]?_0x152bff[_0x0007('0x45')]:_0x27ad0a['model'];if(!_0x45741f[_0x0007('0x41')][_0x0007('0x49')](_0x0007('0x4a'))){_0x152bff['limit']=qs['limit'](_0x45741f[_0x0007('0x41')][_0x0007('0x27')]);_0x152bff[_0x0007('0x26')]=qs['offset'](_0x45741f[_0x0007('0x41')][_0x0007('0x26')]);}_0x152bff[_0x0007('0x95')]=qs[_0x0007('0x4b')](_0x45741f['query']['sort']);_0x152bff[_0x0007('0x84')]=qs[_0x0007('0x43')](_[_0x0007('0x4c')](_0x45741f[_0x0007('0x41')],_0x27ad0a[_0x0007('0x43')]));_0x152bff[_0x0007('0x84')]['OpenchannelInteractionId']=_0x36eb2d['id'];if(_0x45741f['query'][_0x0007('0x89')]){_0x152bff[_0x0007('0x84')]=_[_0x0007('0xa3')](_0x152bff['where'],{'$or':_['map'](_0x152bff['attributes'],function(_0x1e5660){var _0x594035={};_0x594035[_0x1e5660]={'$like':'%'+_0x45741f[_0x0007('0x41')][_0x0007('0x89')]+'%'};return _0x594035;})});}if(_0x45741f[_0x0007('0x41')][_0x0007('0x81')]){var _0x161f58=_0x45741f[_0x0007('0x41')][_0x0007('0x81')][_0x0007('0x37')](',');var _0x3998ac={};_0x3998ac[_0x161f58[0x0]]={'$gte':moment(_0x161f58[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x152bff[_0x0007('0x84')]=_[_0x0007('0xa3')](_0x152bff[_0x0007('0x84')],_0x3998ac);}_0x152bff=_[_0x0007('0xa3')]({},_0x152bff,_0x45741f[_0x0007('0xbb')]);return db[_0x0007('0xc3')][_0x0007('0x29')]({'where':_0x152bff[_0x0007('0x84')]})[_0x0007('0x2f')](function(_0x2a3c9f){_0x117b33[_0x0007('0x29')]=_0x2a3c9f;if(_0x45741f['query'][_0x0007('0xc4')]){_0x152bff[_0x0007('0xba')]=[{'all':!![]}];}return db[_0x0007('0xc3')][_0x0007('0xc5')](_0x152bff);})[_0x0007('0x2f')](function(_0x2010f7){_0x117b33[_0x0007('0xc6')]=_0x2010f7;return _0x117b33;});}})[_0x0007('0x2f')](respondWithFilteredResult(_0x6777ee,_0x152bff))[_0x0007('0xbd')](handleError(_0x6777ee,null));};exports[_0x0007('0xc7')]=function(_0x49fb7c,_0x390761,_0x1c3c85){return db['OpenchannelInteraction'][_0x0007('0x63')]({'where':{'id':_0x49fb7c['params']['id']}})[_0x0007('0x2f')](handleEntityNotFound(_0x390761,null))[_0x0007('0x2f')](function(_0xaa4855){if(_0xaa4855){return _0xaa4855[_0x0007('0xc8')](_0x49fb7c['body'][_0x0007('0xbf')],_[_0x0007('0xc0')](_0x49fb7c[_0x0007('0x78')],[_0x0007('0xbf'),'id'])||{})[_0x0007('0xc9')](function(){return db['Tag'][_0x0007('0xc5')]({'attributes':['id',_0x0007('0x33'),_0x0007('0x4e')],'where':{'id':_0x49fb7c[_0x0007('0x78')][_0x0007('0xbf')]}});})['then'](function(_0x1680a8){socket[_0x0007('0xca')]('openchannelInteractionTags:save',{'id':Number(_0x49fb7c[_0x0007('0xb9')]['id']),'tags':_0x1680a8||[]});return{'id':Number(_0x49fb7c[_0x0007('0xb9')]['id']),'tags':_0x1680a8||[]};});}})[_0x0007('0x2f')](respondWithResult(_0x390761,null))[_0x0007('0xbd')](handleError(_0x390761,null));};exports[_0x0007('0xcb')]=function(_0x312c6b,_0x47374e,_0x4b5040){return db[_0x0007('0x3d')]['find']({'where':{'id':_0x312c6b['params']['id']}})[_0x0007('0x2f')](handleEntityNotFound(_0x47374e,null))[_0x0007('0x2f')](function(_0x13d21c){if(_0x13d21c){return _0x13d21c[_0x0007('0xcb')](_0x312c6b[_0x0007('0x41')][_0x0007('0xbf')]);}})[_0x0007('0x2f')](respondWithStatusCode(_0x47374e,null))['catch'](handleError(_0x47374e,null));};exports[_0x0007('0xcc')]=function(_0x561f2d,_0x153506){var _0x1cf6a6=moment()['unix']()[_0x0007('0xa0')]();var _0x5c028f=path[_0x0007('0xcd')](config[_0x0007('0xce')],_0x0007('0xcf'),_0x0007('0xd0'),'tmp');var _0x26d56c=path['join'](config[_0x0007('0xce')],_0x0007('0xcf'),_0x0007('0xd0'),'attachments');var _0x852f1b=path['join'](_0x5c028f,_0x1cf6a6);var _0x20aea8=util[_0x0007('0xd1')](_0x0007('0xd2'),_0x561f2d['params']['id'],_0x1cf6a6);var _0x1899bc=path[_0x0007('0xcd')](_0x5c028f,_0x20aea8);var _0x5a8804=[];_0x5a8804[_0x0007('0x3a')]({'model':db[_0x0007('0x73')],'as':_0x0007('0x73'),'attributes':['id',_0x0007('0x35')],'raw':!![]});_0x5a8804[_0x0007('0x3a')]({'model':db[_0x0007('0xd3')],'as':_0x0007('0x68'),'attributes':['id',_0x0007('0xd4'),_0x0007('0xd5')],'raw':!![]});if(_0x561f2d[_0x0007('0x41')]['attachments']){_0x5a8804['push']({'model':db[_0x0007('0xd6')],'as':_0x0007('0xd6'),'raw':!![]});}var _0x4f8ca9=[{'model':db[_0x0007('0xc3')],'as':'Messages','attributes':['id',_0x0007('0x78'),_0x0007('0x7f'),_0x0007('0xd7'),_0x0007('0xd8'),_0x0007('0x85')],'include':_0x5a8804}];_0x4f8ca9['push']({'model':db[_0x0007('0xd9')],'as':_0x0007('0xda'),'attributes':['id','name']});_0x4f8ca9[_0x0007('0x3a')]({'model':db[_0x0007('0x73')],'as':'Owner','attributes':['id',_0x0007('0x35')]});return db[_0x0007('0x3d')]['find']({'where':{'id':_0x561f2d['params']['id']},'include':_0x4f8ca9})[_0x0007('0x2f')](handleEntityNotFound(_0x153506,null))[_0x0007('0x2f')](function(_0xefee98){if(_0xefee98){var _0x3393d8=_0xefee98[_0x0007('0xdb')]({'plain':!![]});fs['mkdirSync'](_0x852f1b);var _0x121d36={'channel':_0x0007('0xdc'),'account':_0x3393d8[_0x0007('0xda')][_0x0007('0x33')],'agent':_0x3393d8[_0x0007('0xdd')]?_0x3393d8[_0x0007('0xdd')][_0x0007('0x35')]:'N.A.','createdAt':moment(_0x3393d8['createdAt'])[_0x0007('0xd1')](_0x0007('0xde'))['toString'](),'closedAt':_0x3393d8[_0x0007('0xdf')]?moment(_0x3393d8[_0x0007('0xe0')])[_0x0007('0xd1')](_0x0007('0xde'))[_0x0007('0xa0')]():'','disposition':_0x3393d8[_0x0007('0xe1')],'visibility':_0x3393d8[_0x0007('0xe2')]?'Public':_0x0007('0xe3'),'messages':_(_0x3393d8[_0x0007('0xe4')])[_0x0007('0x89')]({'secret':![]})[_0x0007('0x3c')](function(_0x223794){if(_0x223794[_0x0007('0xd6')]){var _0x56f783=path[_0x0007('0xcd')](_0x26d56c,_0x223794[_0x0007('0xd6')]['basename']);if(fs[_0x0007('0xe5')](_0x56f783)){fs['createReadStream'](_0x56f783)[_0x0007('0xe6')](fs[_0x0007('0xe7')](path[_0x0007('0xcd')](_0x852f1b,_0x223794[_0x0007('0xd6')][_0x0007('0xe8')])));}}return{'date':moment(_0x223794[_0x0007('0x7f')])['format'](_0x0007('0xde'))[_0x0007('0xa0')](),'sender':_0x223794['direction']==='out'?_0x223794[_0x0007('0x73')]?_0x223794[_0x0007('0x73')][_0x0007('0x35')]:_0x0007('0xe9'):_0x223794['Contact'][_0x0007('0xd4')]+(_0x223794['Contact'][_0x0007('0xd5')]?'\x20'+_0x223794[_0x0007('0x68')]['lastName']:''),'body':_0x223794[_0x0007('0xd6')]?_0x223794[_0x0007('0xd6')][_0x0007('0xe8')]:_0x223794[_0x0007('0x78')],'direction':_0x223794[_0x0007('0xd7')]==='out'?'A':'C','secret':_0x223794['secret'],'read':_0x223794[_0x0007('0x85')],'attachment':_0x223794[_0x0007('0xd6')]};})[_0x0007('0x65')]()};return ejs['renderFile'](path[_0x0007('0xcd')](config[_0x0007('0xce')],_0x0007('0xcf'),_0x0007('0xea'),'downloadInteraction.ejs'),{'interaction':_0x121d36})[_0x0007('0x2f')](function(_0xea6930){var _0x49aef0=path[_0x0007('0xcd')](_0x852f1b,_0x0007('0xeb')+_0x3393d8['id']+'-'+_0x1cf6a6+_0x0007('0xec'));var _0x3e8e38={'path':_0x49aef0,'channel':_0x0007('0xdc'),'interactionId':_0x3393d8['id']};return pdf[_0x0007('0xed')](_0xea6930,_0x3e8e38);})[_0x0007('0x2f')](function(){return new BPromise(function(_0x42a36d,_0x1efa39){zipdir(_0x852f1b,{'saveTo':_0x1899bc},function(_0xeb191b,_0x4c14be){if(_0xeb191b)return _0x1efa39(_0xeb191b);return _0x42a36d(_0x4c14be);});})[_0x0007('0x2f')](function(){return new BPromise(function(_0x56cd11,_0x2f1af2){rimraf(_0x852f1b,function(_0x25973a){if(_0x25973a)_0x2f1af2(_0x25973a);return _0x56cd11();});});})[_0x0007('0x2f')](function(){return _0x153506[_0x0007('0xcc')](_0x1899bc,_0x20aea8,function(_0x17fda6){if(_0x17fda6){console[_0x0007('0xee')](_0x0007('0xef'),_0x17fda6);}else{fs[_0x0007('0xf0')](_0x1899bc);}});});});}else{return _0x153506[_0x0007('0x31')](0xc8);}})['catch'](handleError(_0x153506,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index ddee2aa..c6dd48b 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 _0x2d7d=['events','OpenchannelInteraction','OpenchannelMessage','setMaxListeners','update','remove','getUsers','then','setDataValue','Users','findAll','unreadMessages','length','emit','catch'];(function(_0x40fafe,_0x378b8a){var _0x522c15=function(_0x4a566f){while(--_0x4a566f){_0x40fafe['push'](_0x40fafe['shift']());}};_0x522c15(++_0x378b8a);}(_0x2d7d,0xa5));var _0xd2d7=function(_0x5d0fda,_0x1c6026){_0x5d0fda=_0x5d0fda-0x0;var _0x57a922=_0x2d7d[_0x5d0fda];return _0x57a922;};'use strict';var EventEmitter=require(_0xd2d7('0x0'));var OpenchannelInteraction=require('../../mysqldb')['db'][_0xd2d7('0x1')];var OpenchannelMessage=require('../../mysqldb')['db'][_0xd2d7('0x2')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0xd2d7('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xd2d7('0x4'),'afterDestroy':_0xd2d7('0x5')};function emitEvent(_0x293c37){return function(_0x503682,_0xf650ce,_0x1dde92){_0x503682[_0xd2d7('0x6')]({'attributes':['id'],'raw':!![]})[_0xd2d7('0x7')](function(_0x496d7b){_0x503682[_0xd2d7('0x8')](_0xd2d7('0x9'),_0x496d7b['map'](function(_0x4655cb){return{'id':_0x4655cb['id']};}));return OpenchannelMessage[_0xd2d7('0xa')]({'where':{'OpenchannelInteractionId':_0x503682['id'],'direction':'in','read':![]},'raw':!![]});})[_0xd2d7('0x7')](function(_0x2d719e){_0x503682[_0xd2d7('0x8')](_0xd2d7('0xb'),_0x2d719e[_0xd2d7('0xc')]);OpenchannelInteractionEvents[_0xd2d7('0xd')](_0x293c37+':'+_0x503682['id'],_0x503682);OpenchannelInteractionEvents[_0xd2d7('0xd')](_0x293c37,_0x503682);_0x1dde92(null);})[_0xd2d7('0xe')](_0x1dde92(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelInteraction['hook'](e,emitEvent(event));}}module['exports']=OpenchannelInteractionEvents; \ No newline at end of file +var _0xe10b=['save','remove','then','setDataValue','map','findAll','unreadMessages','emit','catch','exports','../../mysqldb','OpenchannelInteraction','OpenchannelMessage','setMaxListeners'];(function(_0x4927dc,_0x54b3f6){var _0x45e1c3=function(_0x45f4f7){while(--_0x45f4f7){_0x4927dc['push'](_0x4927dc['shift']());}};_0x45e1c3(++_0x54b3f6);}(_0xe10b,0x1f4));var _0xbe10=function(_0x410e4f,_0xd72138){_0x410e4f=_0x410e4f-0x0;var _0x4d1d6f=_0xe10b[_0x410e4f];return _0x4d1d6f;};'use strict';var EventEmitter=require('events');var OpenchannelInteraction=require(_0xbe10('0x0'))['db'][_0xbe10('0x1')];var OpenchannelMessage=require(_0xbe10('0x0'))['db'][_0xbe10('0x2')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0xbe10('0x3')](0x0);var events={'afterCreate':_0xbe10('0x4'),'afterUpdate':'update','afterDestroy':_0xbe10('0x5')};function emitEvent(_0x4ef7fa){return function(_0x45e724,_0x8433d8,_0x5d4c2c){_0x45e724['getUsers']({'attributes':['id'],'raw':!![]})[_0xbe10('0x6')](function(_0x1bb39a){_0x45e724[_0xbe10('0x7')]('Users',_0x1bb39a[_0xbe10('0x8')](function(_0x2779c2){return{'id':_0x2779c2['id']};}));return OpenchannelMessage[_0xbe10('0x9')]({'where':{'OpenchannelInteractionId':_0x45e724['id'],'direction':'in','read':![]},'raw':!![]});})[_0xbe10('0x6')](function(_0x42311e){_0x45e724[_0xbe10('0x7')](_0xbe10('0xa'),_0x42311e['length']);OpenchannelInteractionEvents[_0xbe10('0xb')](_0x4ef7fa+':'+_0x45e724['id'],_0x45e724);OpenchannelInteractionEvents['emit'](_0x4ef7fa,_0x45e724);_0x5d4c2c(null);})[_0xbe10('0xc')](_0x5d4c2c(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelInteraction['hook'](e,emitEvent(event));}}module[_0xbe10('0xd')]=OpenchannelInteractionEvents; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.model.js b/server/api/openchannelInteraction/openchannelInteraction.model.js index 19db1ef..b61c7a1 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 _0xd51a=['openchannel_interactions','utf8mb4','utf8mb4_unicode_ci','changed','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','define','OpenchannelInteraction'];(function(_0x33b34e,_0x5f2983){var _0x205ba2=function(_0x538981){while(--_0x538981){_0x33b34e['push'](_0x33b34e['shift']());}};_0x205ba2(++_0x5f2983);}(_0xd51a,0x1c1));var _0xad51=function(_0x2b7ca6,_0x3232ff){_0x2b7ca6=_0x2b7ca6-0x0;var _0x1bc3b1=_0xd51a[_0x2b7ca6];return _0x1bc3b1;};'use strict';var _=require(_0xad51('0x0'));var util=require(_0xad51('0x1'));var logger=require(_0xad51('0x2'))(_0xad51('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xad51('0x4'));var fs=require('fs');var path=require(_0xad51('0x5'));var rimraf=require(_0xad51('0x6'));var config=require(_0xad51('0x7'));var attributes=require('./openchannelInteraction.attributes');module['exports']=function(_0x3fbb0a,_0x29637e){return _0x3fbb0a[_0xad51('0x8')](_0xad51('0x9'),attributes,{'tableName':_0xad51('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xad51('0xb'),'collate':_0xad51('0xc'),'hooks':{'beforeUpdate':function(_0x2c26a7,_0x1fb109,_0x17b256){if(_0x2c26a7[_0xad51('0xd')](_0xad51('0xe'))){_0x2c26a7[_0xad51('0xf')]=moment()['format'](_0xad51('0x10'));}_0x17b256(null,_0x2c26a7);}}});}; \ No newline at end of file +var _0xac4b=['YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','exports','define','openchannel_interactions','utf8mb4','utf8mb4_unicode_ci','changed','closedAt','format'];(function(_0xffd829,_0x3944a9){var _0x501df3=function(_0x34caa3){while(--_0x34caa3){_0xffd829['push'](_0xffd829['shift']());}};_0x501df3(++_0x3944a9);}(_0xac4b,0x145));var _0xbac4=function(_0x246a9c,_0x4df087){_0x246a9c=_0x246a9c-0x0;var _0x4bd0b3=_0xac4b[_0x246a9c];return _0x4bd0b3;};'use strict';var _=require(_0xbac4('0x0'));var util=require(_0xbac4('0x1'));var logger=require(_0xbac4('0x2'))(_0xbac4('0x3'));var moment=require(_0xbac4('0x4'));var BPromise=require(_0xbac4('0x5'));var rp=require(_0xbac4('0x6'));var fs=require('fs');var path=require(_0xbac4('0x7'));var rimraf=require(_0xbac4('0x8'));var config=require('../../config/environment');var attributes=require('./openchannelInteraction.attributes');module[_0xbac4('0x9')]=function(_0x3f5ef4,_0xba4dae){return _0x3f5ef4[_0xbac4('0xa')]('OpenchannelInteraction',attributes,{'tableName':_0xbac4('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xbac4('0xc'),'collate':_0xbac4('0xd'),'hooks':{'beforeUpdate':function(_0x127824,_0x2913b5,_0xd9d62d){if(_0x127824[_0xbac4('0xe')]('closed')){_0x127824[_0xbac4('0xf')]=moment()[_0xbac4('0x10')](_0xbac4('0x11'));}_0xd9d62d(null,_0x127824);}}});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index 93e0e72..23f2d6a 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 _0xfc30=['lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','redis','localhost','socket.io-emitter','./openchannelInteraction.socket','register','request','info','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','UpdateOpenchannelInteraction','OpenchannelInteraction','update','options','raw','where','attributes','find','then','addTags','body','ids','spread','AddTags'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfc30,0x118));var _0x0fc3=function(_0x39edc2,_0x15dbd7){_0x39edc2=_0x39edc2-0x0;var _0x201c43=_0xfc30[_0x39edc2];return _0x201c43;};'use strict';var _=require(_0x0fc3('0x0'));var util=require('util');var moment=require(_0x0fc3('0x1'));var BPromise=require(_0x0fc3('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0fc3('0x3'));var db=require(_0x0fc3('0x4'))['db'];var utils=require(_0x0fc3('0x5'));var logger=require(_0x0fc3('0x6'))(_0x0fc3('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0fc3('0x8')][_0x0fc3('0x9')]({'port':0x232a});config[_0x0fc3('0xa')]=_['defaults'](config[_0x0fc3('0xa')],{'host':_0x0fc3('0xb'),'port':0x18eb});var socket=require(_0x0fc3('0xc'))(new Redis(config[_0x0fc3('0xa')]));require(_0x0fc3('0xd'))[_0x0fc3('0xe')](socket);function respondWithRpcPromise(_0x353eb2,_0x43e8e8,_0x2986d2){return new BPromise(function(_0x1c4ad4,_0x4990bf){return client[_0x0fc3('0xf')](_0x353eb2,_0x2986d2)['then'](function(_0xffcc24){logger[_0x0fc3('0x10')](_0x0fc3('0x11'),_0x43e8e8,_0x0fc3('0x12'));logger[_0x0fc3('0x13')](_0x0fc3('0x14'),_0x43e8e8,_0x0fc3('0x12'),JSON[_0x0fc3('0x15')](_0xffcc24));if(_0xffcc24[_0x0fc3('0x16')]){if(_0xffcc24[_0x0fc3('0x16')][_0x0fc3('0x17')]===0x1f4){logger[_0x0fc3('0x16')](_0x0fc3('0x11'),_0x43e8e8,_0xffcc24[_0x0fc3('0x16')][_0x0fc3('0x18')]);return _0x4990bf(_0xffcc24[_0x0fc3('0x16')][_0x0fc3('0x18')]);}logger[_0x0fc3('0x16')](_0x0fc3('0x11'),_0x43e8e8,_0xffcc24['error'][_0x0fc3('0x18')]);return _0x1c4ad4(_0xffcc24[_0x0fc3('0x16')][_0x0fc3('0x18')]);}else{logger[_0x0fc3('0x10')](_0x0fc3('0x11'),_0x43e8e8,'request\x20sent');_0x1c4ad4(_0xffcc24[_0x0fc3('0x19')][_0x0fc3('0x18')]);}})['catch'](function(_0x22498d){logger[_0x0fc3('0x16')]('OpenchannelInteraction,\x20%s,\x20%s',_0x43e8e8,_0x22498d);_0x4990bf(_0x22498d);});});}exports[_0x0fc3('0x1a')]=function(_0x5bf6ff){var _0x385db5=this;return new Promise(function(_0x1931df,_0x3419fb){return db[_0x0fc3('0x1b')][_0x0fc3('0x1c')](_0x5bf6ff['body'],{'raw':_0x5bf6ff[_0x0fc3('0x1d')]?_0x5bf6ff[_0x0fc3('0x1d')][_0x0fc3('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5bf6ff[_0x0fc3('0x1d')]?_0x5bf6ff[_0x0fc3('0x1d')][_0x0fc3('0x1f')]||null:null,'attributes':_0x5bf6ff['options']?_0x5bf6ff['options'][_0x0fc3('0x20')]||null:null,'limit':_0x5bf6ff[_0x0fc3('0x1d')]?_0x5bf6ff['options']['limit']||null:null})['then'](function(_0x9faed9){logger['info'](_0x0fc3('0x1a'),_0x5bf6ff);logger[_0x0fc3('0x13')](_0x0fc3('0x1a'),_0x5bf6ff,JSON['stringify'](_0x9faed9));_0x1931df(_0x9faed9);})['catch'](function(_0x202eaf){logger[_0x0fc3('0x16')](_0x0fc3('0x1a'),_0x202eaf[_0x0fc3('0x18')],_0x5bf6ff);_0x3419fb(_0x385db5[_0x0fc3('0x16')](0x1f4,_0x202eaf[_0x0fc3('0x18')]));});});};exports['AddTagsToOpenchannelInteraction']=function(_0x2cea5d){return new Promise(function(_0x171425,_0x526b55){return db[_0x0fc3('0x1b')][_0x0fc3('0x21')]({'where':_0x2cea5d[_0x0fc3('0x1d')]?_0x2cea5d[_0x0fc3('0x1d')][_0x0fc3('0x1f')]||null:null})[_0x0fc3('0x22')](function(_0x223b86){if(_0x223b86){return _0x223b86[_0x0fc3('0x23')](_0x2cea5d[_0x0fc3('0x24')][_0x0fc3('0x25')],_['omit'](_0x2cea5d[_0x0fc3('0x24')],['ids','id'])||{});}})[_0x0fc3('0x26')](function(_0xb90c5a){logger['info'](_0x0fc3('0x27'),_0x2cea5d);logger['debug'](_0x0fc3('0x27'),_0x2cea5d,JSON['stringify'](_0xb90c5a));_0x171425(_0xb90c5a);})['catch'](function(_0x1e951b){logger[_0x0fc3('0x16')](_0x0fc3('0x27'),_0x1e951b[_0x0fc3('0x18')],_0x2cea5d);_0x526b55(_this[_0x0fc3('0x16')](0x1f4,_0x1e951b['message']));});});}; \ No newline at end of file +var _0x8871=['../../config/logger','../../config/environment','http','redis','localhost','socket.io-emitter','./openchannelInteraction.socket','register','request','then','info','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','UpdateOpenchannelInteraction','update','body','raw','options','where','limit','stringify','AddTagsToOpenchannelInteraction','OpenchannelInteraction','find','addTags','ids','omit','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x28e424,_0x4d6508){var _0x25ab59=function(_0x3ff7b4){while(--_0x3ff7b4){_0x28e424['push'](_0x28e424['shift']());}};_0x25ab59(++_0x4d6508);}(_0x8871,0xd4));var _0x1887=function(_0x102ff9,_0x907658){_0x102ff9=_0x102ff9-0x0;var _0x24fa97=_0x8871[_0x102ff9];return _0x24fa97;};'use strict';var _=require(_0x1887('0x0'));var util=require(_0x1887('0x1'));var moment=require(_0x1887('0x2'));var BPromise=require(_0x1887('0x3'));var rs=require(_0x1887('0x4'));var fs=require('fs');var Redis=require(_0x1887('0x5'));var db=require(_0x1887('0x6'))['db'];var utils=require(_0x1887('0x7'));var logger=require(_0x1887('0x8'))('rpc');var config=require(_0x1887('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1887('0xa')]({'port':0x232a});config[_0x1887('0xb')]=_['defaults'](config['redis'],{'host':_0x1887('0xc'),'port':0x18eb});var socket=require(_0x1887('0xd'))(new Redis(config[_0x1887('0xb')]));require(_0x1887('0xe'))[_0x1887('0xf')](socket);function respondWithRpcPromise(_0x29428f,_0x2e39a7,_0x2c4917){return new BPromise(function(_0x44fde8,_0x2f6112){return client[_0x1887('0x10')](_0x29428f,_0x2c4917)[_0x1887('0x11')](function(_0x4c728c){logger[_0x1887('0x12')](_0x1887('0x13'),_0x2e39a7,_0x1887('0x14'));logger[_0x1887('0x15')](_0x1887('0x16'),_0x2e39a7,'request\x20sent',JSON['stringify'](_0x4c728c));if(_0x4c728c[_0x1887('0x17')]){if(_0x4c728c['error'][_0x1887('0x18')]===0x1f4){logger['error'](_0x1887('0x13'),_0x2e39a7,_0x4c728c[_0x1887('0x17')]['message']);return _0x2f6112(_0x4c728c['error'][_0x1887('0x19')]);}logger['error'](_0x1887('0x13'),_0x2e39a7,_0x4c728c[_0x1887('0x17')][_0x1887('0x19')]);return _0x44fde8(_0x4c728c['error'][_0x1887('0x19')]);}else{logger[_0x1887('0x12')](_0x1887('0x13'),_0x2e39a7,'request\x20sent');_0x44fde8(_0x4c728c[_0x1887('0x1a')][_0x1887('0x19')]);}})[_0x1887('0x1b')](function(_0x4a3b5f){logger[_0x1887('0x17')](_0x1887('0x13'),_0x2e39a7,_0x4a3b5f);_0x2f6112(_0x4a3b5f);});});}exports[_0x1887('0x1c')]=function(_0x130b52){var _0x2cf4b0=this;return new Promise(function(_0x4bc4a8,_0x4876e2){return db['OpenchannelInteraction'][_0x1887('0x1d')](_0x130b52[_0x1887('0x1e')],{'raw':_0x130b52['options']?_0x130b52['options'][_0x1887('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x130b52[_0x1887('0x20')]?_0x130b52['options'][_0x1887('0x21')]||null:null,'attributes':_0x130b52[_0x1887('0x20')]?_0x130b52[_0x1887('0x20')]['attributes']||null:null,'limit':_0x130b52[_0x1887('0x20')]?_0x130b52['options'][_0x1887('0x22')]||null:null})[_0x1887('0x11')](function(_0x4d76e9){logger['info'](_0x1887('0x1c'),_0x130b52);logger[_0x1887('0x15')](_0x1887('0x1c'),_0x130b52,JSON[_0x1887('0x23')](_0x4d76e9));_0x4bc4a8(_0x4d76e9);})[_0x1887('0x1b')](function(_0x24107b){logger[_0x1887('0x17')](_0x1887('0x1c'),_0x24107b['message'],_0x130b52);_0x4876e2(_0x2cf4b0[_0x1887('0x17')](0x1f4,_0x24107b['message']));});});};exports[_0x1887('0x24')]=function(_0x5dea24){return new Promise(function(_0x3c00ea,_0x4243f3){return db[_0x1887('0x25')][_0x1887('0x26')]({'where':_0x5dea24[_0x1887('0x20')]?_0x5dea24[_0x1887('0x20')][_0x1887('0x21')]||null:null})[_0x1887('0x11')](function(_0x2b7cef){if(_0x2b7cef){return _0x2b7cef[_0x1887('0x27')](_0x5dea24[_0x1887('0x1e')][_0x1887('0x28')],_[_0x1887('0x29')](_0x5dea24[_0x1887('0x1e')],['ids','id'])||{});}})[_0x1887('0x2a')](function(_0x30e1e4){logger[_0x1887('0x12')](_0x1887('0x2b'),_0x5dea24);logger[_0x1887('0x15')]('AddTags',_0x5dea24,JSON[_0x1887('0x23')](_0x30e1e4));_0x3c00ea(_0x30e1e4);})[_0x1887('0x1b')](function(_0x7512a1){logger[_0x1887('0x17')](_0x1887('0x2b'),_0x7512a1[_0x1887('0x19')],_0x5dea24);_0x4243f3(_this[_0x1887('0x17')](0x1f4,_0x7512a1[_0x1887('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index e1e9699..25456a8 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 _0xd15c=['./openchannelInteraction.events','save','remove','update','emit','register','length','openchannelInteraction:'];(function(_0x44a4e9,_0x33ebcb){var _0x3a974b=function(_0x44a1eb){while(--_0x44a1eb){_0x44a4e9['push'](_0x44a4e9['shift']());}};_0x3a974b(++_0x33ebcb);}(_0xd15c,0xf0));var _0xcd15=function(_0x1f62ea,_0x3bc6a0){_0x1f62ea=_0x1f62ea-0x0;var _0x4b11fa=_0xd15c[_0x1f62ea];return _0x4b11fa;};'use strict';var OpenchannelInteractionEvents=require(_0xcd15('0x0'));var events=[_0xcd15('0x1'),_0xcd15('0x2'),_0xcd15('0x3')];function createListener(_0xe0c224,_0x5284ea){return function(_0x343e0f){_0x5284ea[_0xcd15('0x4')](_0xe0c224,_0x343e0f);};}function removeListener(_0x476dd0,_0x4daa4c){return function(){OpenchannelInteractionEvents['removeListener'](_0x476dd0,_0x4daa4c);};}exports[_0xcd15('0x5')]=function(_0x2ef86e){for(var _0x82d529=0x0,_0x179624=events[_0xcd15('0x6')];_0x82d529<_0x179624;_0x82d529++){var _0x1778e5=events[_0x82d529];var _0x294fa4=createListener(_0xcd15('0x7')+_0x1778e5,_0x2ef86e);OpenchannelInteractionEvents['on'](_0x1778e5,_0x294fa4);}}; \ No newline at end of file +var _0x24a4=['removeListener','register','length','save','emit'];(function(_0x45f111,_0x3a1a4a){var _0x483508=function(_0x3131ab){while(--_0x3131ab){_0x45f111['push'](_0x45f111['shift']());}};_0x483508(++_0x3a1a4a);}(_0x24a4,0x14d));var _0x424a=function(_0x1ba9da,_0x42ddc4){_0x1ba9da=_0x1ba9da-0x0;var _0x585e27=_0x24a4[_0x1ba9da];return _0x585e27;};'use strict';var OpenchannelInteractionEvents=require('./openchannelInteraction.events');var events=[_0x424a('0x0'),'remove','update'];function createListener(_0x999647,_0x3f5aa4){return function(_0x5f2a84){_0x3f5aa4[_0x424a('0x1')](_0x999647,_0x5f2a84);};}function removeListener(_0xd00027,_0xbbf7c8){return function(){OpenchannelInteractionEvents[_0x424a('0x2')](_0xd00027,_0xbbf7c8);};}exports[_0x424a('0x3')]=function(_0x51503d){for(var _0x273a43=0x0,_0x1657a5=events[_0x424a('0x4')];_0x273a43<_0x1657a5;_0x273a43++){var _0x436d55=events[_0x273a43];var _0x142889=createListener('openchannelInteraction:'+_0x436d55,_0x51503d);OpenchannelInteractionEvents['on'](_0x436d55,_0x142889);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index ffeb37a..bc9eee3 100644 --- a/server/api/openchannelMessage/index.js +++ b/server/api/openchannelMessage/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','/:id','show','post','tracked','openchannel','openchannelmessage:create','put','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','multer','util'];(function(_0x2b6e2e,_0x146ac4){var _0x53b86a=function(_0x4520e5){while(--_0x4520e5){_0x2b6e2e['push'](_0x2b6e2e['shift']());}};_0x53b86a(++_0x146ac4);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var controller=require('./openchannelMessage.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/describe',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0x7')](),interaction[_0x0d8b('0xe')](_0x0d8b('0xf'),_0x0d8b('0x10')),controller['create']);router[_0x0d8b('0x11')]('/:id',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x12')]);router[_0x0d8b('0x11')](_0x0d8b('0x13'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x14')]);router[_0x0d8b('0x11')](_0x0d8b('0x15'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x16')]);router[_0x0d8b('0x17')](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x18')]);module['exports']=router; \ No newline at end of file +var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','/:id','show','post','tracked','openchannel','openchannelmessage:create','put','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','multer','util'];(function(_0xf7a357,_0x1b9a26){var _0x57c8b=function(_0x509f6e){while(--_0x509f6e){_0xf7a357['push'](_0xf7a357['shift']());}};_0x57c8b(++_0x1b9a26);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var controller=require('./openchannelMessage.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/describe',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0x7')](),interaction[_0x0d8b('0xe')](_0x0d8b('0xf'),_0x0d8b('0x10')),controller['create']);router[_0x0d8b('0x11')]('/:id',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x12')]);router[_0x0d8b('0x11')](_0x0d8b('0x13'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x14')]);router[_0x0d8b('0x11')](_0x0d8b('0x15'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x16')]);router[_0x0d8b('0x17')](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x18')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.attributes.js b/server/api/openchannelMessage/openchannelMessage.attributes.js index ea24d9f..5b407c4 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 _0xdca3=['ENUM','out','DATE','STRING','sequelize','TEXT','medium','BOOLEAN'];(function(_0x4b02e4,_0x129a0f){var _0x5b2a52=function(_0xdbaf07){while(--_0xdbaf07){_0x4b02e4['push'](_0x4b02e4['shift']());}};_0x5b2a52(++_0x129a0f);}(_0xdca3,0x64));var _0x3dca=function(_0x4e35b8,_0x595a27){_0x4e35b8=_0x4e35b8-0x0;var _0x2198a6=_0xdca3[_0x4e35b8];return _0x2198a6;};'use strict';var Sequelize=require(_0x3dca('0x0'));module['exports']={'body':{'type':Sequelize[_0x3dca('0x1')](_0x3dca('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x3dca('0x3')],'defaultValue':![]},'secret':{'type':Sequelize[_0x3dca('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x3dca('0x4')]('in',_0x3dca('0x5')),'defaultValue':_0x3dca('0x5'),'allowNull':![]},'readAt':{'type':Sequelize[_0x3dca('0x6')]},'providerName':{'type':Sequelize[_0x3dca('0x7')]},'providerResponse':{'type':Sequelize[_0x3dca('0x1')]}}; \ No newline at end of file +var _0x7916=['out','STRING','sequelize','TEXT','medium','BOOLEAN','ENUM'];(function(_0x59bb17,_0x2a1cc5){var _0x57fda3=function(_0x475844){while(--_0x475844){_0x59bb17['push'](_0x59bb17['shift']());}};_0x57fda3(++_0x2a1cc5);}(_0x7916,0x128));var _0x6791=function(_0x282e7a,_0x36d4ed){_0x282e7a=_0x282e7a-0x0;var _0x1395cc=_0x7916[_0x282e7a];return _0x1395cc;};'use strict';var Sequelize=require(_0x6791('0x0'));module['exports']={'body':{'type':Sequelize[_0x6791('0x1')](_0x6791('0x2')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize[_0x6791('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x6791('0x4')]('in',_0x6791('0x5')),'defaultValue':_0x6791('0x5'),'allowNull':![]},'readAt':{'type':Sequelize['DATE']},'providerName':{'type':Sequelize[_0x6791('0x6')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.controller.js b/server/api/openchannelMessage/openchannelMessage.controller.js index 8ab9a5f..24a4eeb 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 _0x64c4=['user','get','OpenchannelInteraction','OpenchannelInteractionId','isNil','read1stAt','format','YYYY-MM-DD\x20HH:mm:ss','interaction','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','agent','fullname','email','internal','interface','SIP/%s','channel','motionChannel','EventManager','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','event','rejectmessage','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','fs-extra','lodash','squel','crypto','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/environment','../../config/license/util','../../mysqldb','redis','jayson/promise','client','http','request','then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','limit','count','set','Content-Range','reject','save','destroy','stack','name','index','map','OpenchannelMessage','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','rawAttributes','find','create','body','update','describe','../../config/logger','openchannel-interactions','accept','openchannel','read','readAt','UserId'];(function(_0x5be6e6,_0x5eb129){var _0xe2b850=function(_0x2fca20){while(--_0x2fca20){_0x5be6e6['push'](_0x5be6e6['shift']());}};_0xe2b850(++_0x5eb129);}(_0x64c4,0x1a6));var _0x464c=function(_0x2a7f7f,_0x5c336e){_0x2a7f7f=_0x2a7f7f-0x0;var _0x2a573d=_0x64c4[_0x2a7f7f];return _0x2a573d;};'use strict';var emlformat=require(_0x464c('0x0'));var rimraf=require(_0x464c('0x1'));var zipdir=require(_0x464c('0x2'));var jsonpatch=require(_0x464c('0x3'));var rp=require('request-promise');var moment=require(_0x464c('0x4'));var BPromise=require(_0x464c('0x5'));var Mustache=require(_0x464c('0x6'));var util=require('util');var path=require(_0x464c('0x7'));var sox=require(_0x464c('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x464c('0x9'));var _=require(_0x464c('0xa'));var squel=require(_0x464c('0xb'));var crypto=require(_0x464c('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x464c('0xd'));var querystring=require(_0x464c('0xe'));var Papa=require('papaparse');var Redis=require(_0x464c('0xf'));var authService=require(_0x464c('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x464c('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x464c('0x12'));var licenseUtil=require(_0x464c('0x13'));var db=require(_0x464c('0x14'))['db'];config[_0x464c('0x15')]=_['defaults'](config[_0x464c('0x15')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x464c('0x15')]));require('./openchannelMessage.socket')['register'](socket);var jayson=require(_0x464c('0x16'));var client=jayson[_0x464c('0x17')][_0x464c('0x18')]({'port':0x232c});var client9002=jayson['client'][_0x464c('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x4bf707,_0x1f3c08,_0x2e2bbe,_0x630264){return new BPromise(function(_0x36a8f2,_0x419270){var _0xb1c80b=_0x630264||client;return _0xb1c80b[_0x464c('0x19')](_0x4bf707,_0x2e2bbe)[_0x464c('0x1a')](function(_0x37501f){logger[_0x464c('0x1b')](_0x464c('0x1c'),_0x1f3c08,_0x464c('0x1d'));logger[_0x464c('0x1e')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x1f3c08,_0x464c('0x1d'),JSON[_0x464c('0x1f')](_0x37501f));if(_0x37501f[_0x464c('0x20')]){if(_0x37501f[_0x464c('0x20')][_0x464c('0x21')]===0x1f4){logger['error'](_0x464c('0x1c'),_0x1f3c08,_0x37501f[_0x464c('0x20')][_0x464c('0x22')]);return _0x419270(_0x37501f['error'][_0x464c('0x22')]);}logger[_0x464c('0x20')](_0x464c('0x1c'),_0x1f3c08,_0x37501f[_0x464c('0x20')][_0x464c('0x22')]);return _0x36a8f2(_0x37501f[_0x464c('0x20')]['message']);}else{logger['info'](_0x464c('0x1c'),_0x1f3c08,_0x464c('0x1d'));_0x36a8f2(_0x37501f[_0x464c('0x23')]['message']);}})[_0x464c('0x24')](function(_0x1bd49e){logger[_0x464c('0x20')]('OpenchannelMessage,\x20%s,\x20%s',_0x1f3c08,_0x1bd49e);_0x419270(_0x1bd49e);});});}function respondWithStatusCode(_0x569e79,_0x961a7){_0x961a7=_0x961a7||0xcc;return function(_0x27cec6){if(_0x27cec6){return _0x569e79[_0x464c('0x25')](_0x961a7);}return _0x569e79[_0x464c('0x26')](_0x961a7)[_0x464c('0x27')]();};}function respondWithResult(_0x2d4151,_0xd346a9){_0xd346a9=_0xd346a9||0xc8;return function(_0x3d2f45){if(_0x3d2f45){return _0x2d4151[_0x464c('0x26')](_0xd346a9)[_0x464c('0x28')](_0x3d2f45);}};}function respondWithFilteredResult(_0xedb71b,_0x2bbc7e){return function(_0x94a128){if(_0x94a128){var _0x15f9bc=typeof _0x2bbc7e[_0x464c('0x29')]==='undefined'&&typeof _0x2bbc7e[_0x464c('0x2a')]==='undefined';var _0x90ba11=_0x94a128[_0x464c('0x2b')];var _0x33f3cf=_0x15f9bc?0x0:_0x2bbc7e['offset'];var _0x538771=_0x15f9bc?_0x94a128['count']:_0x2bbc7e[_0x464c('0x29')]+_0x2bbc7e[_0x464c('0x2a')];var _0x5327c1;if(_0x538771>=_0x90ba11){_0x538771=_0x90ba11;_0x5327c1=0xc8;}else{_0x5327c1=0xce;}_0xedb71b['status'](_0x5327c1);return _0xedb71b[_0x464c('0x2c')](_0x464c('0x2d'),_0x33f3cf+'-'+_0x538771+'/'+_0x90ba11)[_0x464c('0x28')](_0x94a128);}return null;};}function patchUpdates(_0x19f156){return function(_0x13b2b8){try{jsonpatch['apply'](_0x13b2b8,_0x19f156,!![]);}catch(_0x24bb69){return BPromise[_0x464c('0x2e')](_0x24bb69);}return _0x13b2b8[_0x464c('0x2f')]();};}function saveUpdates(_0x56e51b,_0x41dfb4){return function(_0x1fa8f7){if(_0x1fa8f7){return _0x1fa8f7['update'](_0x56e51b)[_0x464c('0x1a')](function(_0x5be101){return _0x5be101;});}return null;};}function removeEntity(_0x5a1f7d,_0x2014a7){return function(_0x2204be){if(_0x2204be){return _0x2204be[_0x464c('0x30')]()['then'](function(){_0x5a1f7d[_0x464c('0x26')](0xcc)[_0x464c('0x27')]();});}};}function handleEntityNotFound(_0x4d4909,_0x229c71){return function(_0x24b25e){if(!_0x24b25e){_0x4d4909[_0x464c('0x25')](0x194);}return _0x24b25e;};}function handleError(_0x760d76,_0x4ff488){_0x4ff488=_0x4ff488||0x1f4;return function(_0x1f986f){logger[_0x464c('0x20')](_0x1f986f[_0x464c('0x31')]);if(_0x1f986f[_0x464c('0x32')]){delete _0x1f986f['name'];}_0x760d76[_0x464c('0x26')](_0x4ff488)['send'](_0x1f986f);};}exports[_0x464c('0x33')]=function(_0x4b0dfc,_0x5d9df2){var _0x4ad2ef={},_0x3d4a8e={},_0x100513={'count':0x0,'rows':[]};var _0x500856=_[_0x464c('0x34')](db[_0x464c('0x35')]['rawAttributes'],function(_0x4d47b8){return{'name':_0x4d47b8[_0x464c('0x36')],'type':_0x4d47b8[_0x464c('0x37')][_0x464c('0x38')]};});_0x3d4a8e[_0x464c('0x39')]=_[_0x464c('0x34')](_0x500856,_0x464c('0x32'));_0x3d4a8e[_0x464c('0x3a')]=_[_0x464c('0x3b')](_0x4b0dfc[_0x464c('0x3a')]);_0x3d4a8e[_0x464c('0x3c')]=_['intersection'](_0x3d4a8e[_0x464c('0x39')],_0x3d4a8e[_0x464c('0x3a')]);_0x4ad2ef[_0x464c('0x3d')]=_[_0x464c('0x3e')](_0x3d4a8e[_0x464c('0x39')],qs[_0x464c('0x3f')](_0x4b0dfc[_0x464c('0x3a')]['fields']));_0x4ad2ef['attributes']=_0x4ad2ef[_0x464c('0x3d')][_0x464c('0x40')]?_0x4ad2ef['attributes']:_0x3d4a8e[_0x464c('0x39')];if(!_0x4b0dfc['query'][_0x464c('0x41')](_0x464c('0x42'))){_0x4ad2ef[_0x464c('0x2a')]=qs['limit'](_0x4b0dfc['query'][_0x464c('0x2a')]);_0x4ad2ef[_0x464c('0x29')]=qs[_0x464c('0x29')](_0x4b0dfc['query']['offset']);}_0x4ad2ef[_0x464c('0x43')]=qs[_0x464c('0x44')](_0x4b0dfc['query'][_0x464c('0x44')]);_0x4ad2ef[_0x464c('0x45')]=qs[_0x464c('0x3c')](_[_0x464c('0x46')](_0x4b0dfc[_0x464c('0x3a')],_0x3d4a8e[_0x464c('0x3c')]),_0x500856);if(_0x4b0dfc[_0x464c('0x3a')][_0x464c('0x47')]){_0x4ad2ef[_0x464c('0x45')]=_[_0x464c('0x48')](_0x4ad2ef[_0x464c('0x45')],{'$or':_['map'](_0x500856,function(_0x157503){if(_0x157503[_0x464c('0x37')]!==_0x464c('0x49')){var _0x2abccd={};_0x2abccd[_0x157503['name']]={'$like':'%'+_0x4b0dfc[_0x464c('0x3a')]['filter']+'%'};return _0x2abccd;}})});}_0x4ad2ef=_[_0x464c('0x48')]({},_0x4ad2ef,_0x4b0dfc[_0x464c('0x4a')]);var _0x59e8b9={'where':_0x4ad2ef['where']};return db[_0x464c('0x35')][_0x464c('0x2b')](_0x59e8b9)['then'](function(_0x5676ce){_0x100513[_0x464c('0x2b')]=_0x5676ce;if(_0x4b0dfc[_0x464c('0x3a')][_0x464c('0x4b')]){_0x4ad2ef[_0x464c('0x4c')]=[{'all':!![]}];}return db[_0x464c('0x35')][_0x464c('0x4d')](_0x4ad2ef);})[_0x464c('0x1a')](function(_0x149d8c){_0x100513[_0x464c('0x4e')]=_0x149d8c;return _0x100513;})[_0x464c('0x1a')](respondWithFilteredResult(_0x5d9df2,_0x4ad2ef))['catch'](handleError(_0x5d9df2,null));};exports[_0x464c('0x4f')]=function(_0xfc118,_0x17e9f7){var _0x55b103={'raw':!![],'where':{'id':_0xfc118[_0x464c('0x50')]['id']}},_0x5bd39f={};_0x5bd39f[_0x464c('0x39')]=_['keys'](db[_0x464c('0x35')][_0x464c('0x51')]);_0x5bd39f[_0x464c('0x3a')]=_[_0x464c('0x3b')](_0xfc118[_0x464c('0x3a')]);_0x5bd39f[_0x464c('0x3c')]=_['intersection'](_0x5bd39f[_0x464c('0x39')],_0x5bd39f['query']);_0x55b103[_0x464c('0x3d')]=_[_0x464c('0x3e')](_0x5bd39f[_0x464c('0x39')],qs[_0x464c('0x3f')](_0xfc118[_0x464c('0x3a')]['fields']));_0x55b103[_0x464c('0x3d')]=_0x55b103['attributes']['length']?_0x55b103[_0x464c('0x3d')]:_0x5bd39f['model'];if(_0xfc118[_0x464c('0x3a')][_0x464c('0x4b')]){_0x55b103[_0x464c('0x4c')]=[{'all':!![]}];}_0x55b103=_['merge']({},_0x55b103,_0xfc118[_0x464c('0x4a')]);return db[_0x464c('0x35')][_0x464c('0x52')](_0x55b103)[_0x464c('0x1a')](handleEntityNotFound(_0x17e9f7,null))[_0x464c('0x1a')](respondWithResult(_0x17e9f7,null))[_0x464c('0x24')](handleError(_0x17e9f7,null));};exports[_0x464c('0x53')]=function(_0x4d4997,_0x1348e4){return db[_0x464c('0x35')]['create'](_0x4d4997[_0x464c('0x54')],{})[_0x464c('0x1a')](respondWithResult(_0x1348e4,0xc9))[_0x464c('0x24')](handleError(_0x1348e4,null));};exports[_0x464c('0x55')]=function(_0x3115e5,_0x52dd8b){if(_0x3115e5[_0x464c('0x54')]['id']){delete _0x3115e5[_0x464c('0x54')]['id'];}return db[_0x464c('0x35')][_0x464c('0x52')]({'where':{'id':_0x3115e5[_0x464c('0x50')]['id']}})[_0x464c('0x1a')](handleEntityNotFound(_0x52dd8b,null))[_0x464c('0x1a')](saveUpdates(_0x3115e5[_0x464c('0x54')],null))[_0x464c('0x1a')](respondWithResult(_0x52dd8b,null))['catch'](handleError(_0x52dd8b,null));};exports[_0x464c('0x30')]=function(_0x85957,_0x5c881f){return db['OpenchannelMessage'][_0x464c('0x52')]({'where':{'id':_0x85957[_0x464c('0x50')]['id']}})[_0x464c('0x1a')](handleEntityNotFound(_0x5c881f,null))['then'](removeEntity(_0x5c881f,null))[_0x464c('0x24')](handleError(_0x5c881f,null));};exports[_0x464c('0x56')]=function(_0x28999f,_0x426446){return db[_0x464c('0x35')]['describe']()[_0x464c('0x1a')](respondWithResult(_0x426446,null))['catch'](handleError(_0x426446,null));};var interaction_log=require(_0x464c('0x57'))(_0x464c('0x58'));exports[_0x464c('0x59')]=function(_0x58eb65,_0x25f40d,_0x2817a3){var _0x11731a={'agent':{},'channel':_0x464c('0x5a')};if(_0x58eb65['body']['id']){delete _0x58eb65[_0x464c('0x54')]['id'];}_0x58eb65['body'][_0x464c('0x5b')]=!![];_0x58eb65[_0x464c('0x54')][_0x464c('0x5c')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x58eb65[_0x464c('0x54')][_0x464c('0x5d')]=_0x58eb65[_0x464c('0x54')][_0x464c('0x5d')]||_0x58eb65[_0x464c('0x5e')]['id'];_0x11731a['agent']['id']=_0x58eb65[_0x464c('0x54')][_0x464c('0x5d')];return db['OpenchannelMessage']['find']({'where':{'id':_0x58eb65[_0x464c('0x50')]['id'],'UserId':null}})[_0x464c('0x1a')](handleEntityNotFound(_0x25f40d,null))[_0x464c('0x1a')](saveUpdates(_0x58eb65[_0x464c('0x54')],null))[_0x464c('0x1a')](function(_0x3885e5){if(_0x3885e5){_0x11731a['message']=_0x3885e5[_0x464c('0x5f')]({'plain':!![]});return db[_0x464c('0x60')][_0x464c('0x52')]({'where':{'id':_0x3885e5[_0x464c('0x61')]}});}return null;})['then'](handleEntityNotFound(_0x25f40d,null))[_0x464c('0x1a')](function(_0x222e4a){if(_0x222e4a){return _0x222e4a[_0x464c('0x55')]({'UserId':_0x58eb65['body'][_0x464c('0x5d')],'read1stAt':_[_0x464c('0x62')](_0x222e4a[_0x464c('0x63')])?moment()[_0x464c('0x64')](_0x464c('0x65')):undefined});}return null;})['then'](function(_0x34f17b){if(_0x34f17b){_0x11731a[_0x464c('0x66')]=_0x34f17b['get']({'plain':!![]});interaction_log['info'](_0x464c('0x67'),_0x58eb65['user']['id'],_0x58eb65[_0x464c('0x5e')][_0x464c('0x32')],_0x58eb65[_0x464c('0x5e')][_0x464c('0x68')],_0x11731a[_0x464c('0x66')]['id'],_0x58eb65['body']?JSON[_0x464c('0x1f')](_0x58eb65[_0x464c('0x54')]):_0x464c('0x69'));return respondWithRpcPromise(_0x464c('0x6a'),'acceptMessage',_0x11731a);}return null;})[_0x464c('0x1a')](function(_0x40797d){var _0x5aedc3=_0x464c('0x6b')+_0x40797d['message'][_0x464c('0x6c')];return db[_0x464c('0x6d')][_0x464c('0x3a')](_0x5aedc3,{'type':db[_0x464c('0x6e')][_0x464c('0x6f')][_0x464c('0x70')],'raw':!![]})['then'](function(_0x28dc06){return _0x28dc06;});})['then'](function(_0x3c551e){if(_0x3c551e){_0x11731a['message'][_0x464c('0x71')]=_0x3c551e[0x0];if(!_0x58eb65[_0x464c('0x54')]['UserId'])return;return db[_0x464c('0x72')][_0x464c('0x52')]({'where':{'id':_0x58eb65[_0x464c('0x54')][_0x464c('0x5d')],'role':_0x464c('0x73')},'attributes':['id',_0x464c('0x32'),_0x464c('0x74'),_0x464c('0x75'),_0x464c('0x76')],'raw':!![]});}return null;})['then'](function(_0x4c1896){if(!_0x4c1896)return null;_0x11731a[_0x464c('0x22')]['agent']=_0x4c1896;return _0x11731a;})[_0x464c('0x1a')](function(_0xcab4c){if(_0xcab4c){if(_0x58eb65[_0x464c('0x54')]['manual']){_0x11731a[_0x464c('0x22')][_0x464c('0x77')]=util['format'](_0x464c('0x78'),_0x58eb65[_0x464c('0x5e')][_0x464c('0x32')]);_0x11731a[_0x464c('0x22')][_0x464c('0x79')]=_0x11731a[_0x464c('0x79')];_0x11731a[_0x464c('0x22')][_0x464c('0x7a')]=_0x11731a[_0x464c('0x79')];_0x11731a[_0x464c('0x22')]['event']='accept';return respondWithRpcPromise(_0x464c('0x7b'),'EventManager',{'event':'acceptmessage','message':_0x11731a[_0x464c('0x22')]},client9002)[_0x464c('0x1a')](function(){return _0x11731a;});}return _0x11731a;}return null;})[_0x464c('0x1a')](respondWithResult(_0x25f40d,null))[_0x464c('0x24')](handleError(_0x25f40d,null));};var interaction_log=require(_0x464c('0x57'))(_0x464c('0x58'));exports[_0x464c('0x2e')]=function(_0x54ac09,_0x578208,_0x565bf4){var _0xdf7488={'agent':{},'channel':_0x464c('0x5a')};if(_0x54ac09[_0x464c('0x54')]['id']){delete _0x54ac09['body']['id'];}_0x54ac09[_0x464c('0x54')][_0x464c('0x5d')]=_0x54ac09[_0x464c('0x54')][_0x464c('0x5d')]||_0x54ac09[_0x464c('0x5e')]['id'];_0xdf7488['agent']['id']=_0x54ac09[_0x464c('0x54')][_0x464c('0x5d')];return db[_0x464c('0x35')][_0x464c('0x52')]({'where':{'id':_0x54ac09['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x578208,null))[_0x464c('0x1a')](function(_0x5bc911){if(_0x5bc911){_0xdf7488[_0x464c('0x22')]=_0x5bc911['get']({'plain':!![]});return db[_0x464c('0x60')][_0x464c('0x52')]({'where':{'id':_0x5bc911[_0x464c('0x61')]}});}return null;})[_0x464c('0x1a')](handleEntityNotFound(_0x578208,null))[_0x464c('0x1a')](function(_0x372e47){if(_0x372e47){_0xdf7488['interaction']=_0x372e47[_0x464c('0x5f')]({'plain':!![]});interaction_log['info'](_0x464c('0x7c'),_0x54ac09[_0x464c('0x5e')]['id'],_0x54ac09['user'][_0x464c('0x32')],_0x54ac09['user']['role'],_0xdf7488['interaction']['id'],_0x54ac09[_0x464c('0x54')]?JSON[_0x464c('0x1f')](_0x54ac09[_0x464c('0x54')]):_0x464c('0x69'));return respondWithRpcPromise(_0x464c('0x7d'),_0x464c('0x7e'),_0xdf7488);}return null;})[_0x464c('0x1a')](function(_0x178842){var _0x1baff7=_0x464c('0x6b')+_0x178842[_0x464c('0x22')][_0x464c('0x6c')];return db[_0x464c('0x6d')][_0x464c('0x3a')](_0x1baff7,{'type':db[_0x464c('0x6e')][_0x464c('0x6f')][_0x464c('0x70')],'raw':!![]})[_0x464c('0x1a')](function(_0xf27555){return _0xf27555;});})['then'](function(_0x1f4b7d){if(_0x1f4b7d){_0xdf7488['message'][_0x464c('0x71')]=_0x1f4b7d[0x0];if(!_0x54ac09[_0x464c('0x54')][_0x464c('0x5d')])return;return db[_0x464c('0x72')]['find']({'where':{'id':_0x54ac09['body'][_0x464c('0x5d')],'role':_0x464c('0x73')},'attributes':['id','name',_0x464c('0x74'),_0x464c('0x75'),_0x464c('0x76')],'raw':!![]});}return null;})['then'](function(_0x1c3ee1){if(!_0x1c3ee1)return null;_0xdf7488[_0x464c('0x22')][_0x464c('0x73')]=_0x1c3ee1;return _0xdf7488;})[_0x464c('0x1a')](function(_0x3ab5f5){if(_0x3ab5f5){_0x3ab5f5[_0x464c('0x22')][_0x464c('0x77')]=util[_0x464c('0x64')](_0x464c('0x78'),_0x54ac09[_0x464c('0x5e')]['name']);_0x3ab5f5[_0x464c('0x22')][_0x464c('0x79')]=_0xdf7488[_0x464c('0x79')];_0x3ab5f5[_0x464c('0x22')][_0x464c('0x7a')]=_0xdf7488[_0x464c('0x79')];_0x3ab5f5[_0x464c('0x22')][_0x464c('0x7f')]=_0x464c('0x2e');respondWithRpcPromise(_0x464c('0x7b'),'EventManager',{'event':_0x464c('0x80'),'message':_0x3ab5f5[_0x464c('0x22')]},client9002);return _0xdf7488;}return null;})[_0x464c('0x1a')](respondWithResult(_0x578208,null))[_0x464c('0x24')](handleError(_0x578208,null));}; \ No newline at end of file +var _0x6217=['show','params','find','create','body','describe','../../config/logger','openchannel-interactions','accept','openchannel','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','agent','get','OpenchannelInteraction','OpenchannelInteractionId','isNil','read1stAt','interaction','user','role','stringify','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','contact','User','manual','interface','channel','motionChannel','event','EventManager','acceptmessage','null','RejectMessage','rejectMessage','fullname','email','SIP/%s','rejectmessage','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./openchannelMessage.socket','client','http','request','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','OpenchannelMessage,\x20%s,\x20%s,\x20%s','error','message','catch','sendStatus','status','json','offset','undefined','limit','count','set','apply','reject','update','then','destroy','stack','name','send','map','rawAttributes','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','VIRTUAL','options','OpenchannelMessage','includeAll','include','rows'];(function(_0x3c2db8,_0x336c5d){var _0x4759eb=function(_0x5a4639){while(--_0x5a4639){_0x3c2db8['push'](_0x3c2db8['shift']());}};_0x4759eb(++_0x336c5d);}(_0x6217,0x1bc));var _0x7621=function(_0x3fa296,_0x2bd315){_0x3fa296=_0x3fa296-0x0;var _0x10b19f=_0x6217[_0x3fa296];return _0x10b19f;};'use strict';var emlformat=require(_0x7621('0x0'));var rimraf=require(_0x7621('0x1'));var zipdir=require(_0x7621('0x2'));var jsonpatch=require(_0x7621('0x3'));var rp=require(_0x7621('0x4'));var moment=require(_0x7621('0x5'));var BPromise=require(_0x7621('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x7621('0x7'));var sox=require(_0x7621('0x8'));var csv=require(_0x7621('0x9'));var ejs=require(_0x7621('0xa'));var fs=require('fs');var fs_extra=require(_0x7621('0xb'));var _=require(_0x7621('0xc'));var squel=require(_0x7621('0xd'));var crypto=require(_0x7621('0xe'));var jsforce=require(_0x7621('0xf'));var deskjs=require(_0x7621('0x10'));var toCsv=require(_0x7621('0x9'));var querystring=require(_0x7621('0x11'));var Papa=require(_0x7621('0x12'));var Redis=require(_0x7621('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x7621('0x14'));var as=require(_0x7621('0x15'));var hardwareService=require(_0x7621('0x16'));var logger=require('../../config/logger')(_0x7621('0x17'));var utils=require(_0x7621('0x18'));var config=require(_0x7621('0x19'));var licenseUtil=require(_0x7621('0x1a'));var db=require(_0x7621('0x1b'))['db'];config[_0x7621('0x1c')]=_[_0x7621('0x1d')](config[_0x7621('0x1c')],{'host':_0x7621('0x1e'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7621('0x1c')]));require(_0x7621('0x1f'))['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0x7621('0x20')]['http']({'port':0x232c});var client9002=jayson['client'][_0x7621('0x21')]({'port':0x232a});function respondWithRpcPromise(_0x1c6570,_0x19ba7e,_0x29d327,_0x3e7fcd){return new BPromise(function(_0x4bb86d,_0x35dd1a){var _0x13f53d=_0x3e7fcd||client;return _0x13f53d[_0x7621('0x22')](_0x1c6570,_0x29d327)['then'](function(_0x54ccc6){logger[_0x7621('0x23')](_0x7621('0x24'),_0x19ba7e,_0x7621('0x25'));logger['debug'](_0x7621('0x26'),_0x19ba7e,_0x7621('0x25'),JSON['stringify'](_0x54ccc6));if(_0x54ccc6[_0x7621('0x27')]){if(_0x54ccc6[_0x7621('0x27')]['code']===0x1f4){logger[_0x7621('0x27')](_0x7621('0x24'),_0x19ba7e,_0x54ccc6[_0x7621('0x27')][_0x7621('0x28')]);return _0x35dd1a(_0x54ccc6[_0x7621('0x27')]['message']);}logger[_0x7621('0x27')](_0x7621('0x24'),_0x19ba7e,_0x54ccc6['error'][_0x7621('0x28')]);return _0x4bb86d(_0x54ccc6[_0x7621('0x27')][_0x7621('0x28')]);}else{logger[_0x7621('0x23')]('OpenchannelMessage,\x20%s,\x20%s',_0x19ba7e,_0x7621('0x25'));_0x4bb86d(_0x54ccc6['result']['message']);}})[_0x7621('0x29')](function(_0xcdbf53){logger[_0x7621('0x27')]('OpenchannelMessage,\x20%s,\x20%s',_0x19ba7e,_0xcdbf53);_0x35dd1a(_0xcdbf53);});});}function respondWithStatusCode(_0x134463,_0x535cfe){_0x535cfe=_0x535cfe||0xcc;return function(_0xfbe9f7){if(_0xfbe9f7){return _0x134463[_0x7621('0x2a')](_0x535cfe);}return _0x134463[_0x7621('0x2b')](_0x535cfe)['end']();};}function respondWithResult(_0x15289e,_0x1c783d){_0x1c783d=_0x1c783d||0xc8;return function(_0x445ca6){if(_0x445ca6){return _0x15289e['status'](_0x1c783d)[_0x7621('0x2c')](_0x445ca6);}};}function respondWithFilteredResult(_0x8b071a,_0x115692){return function(_0x534e61){if(_0x534e61){var _0x3ecba6=typeof _0x115692[_0x7621('0x2d')]===_0x7621('0x2e')&&typeof _0x115692[_0x7621('0x2f')]===_0x7621('0x2e');var _0x4d8e21=_0x534e61[_0x7621('0x30')];var _0x59d511=_0x3ecba6?0x0:_0x115692[_0x7621('0x2d')];var _0x1564cd=_0x3ecba6?_0x534e61['count']:_0x115692['offset']+_0x115692[_0x7621('0x2f')];var _0xc45051;if(_0x1564cd>=_0x4d8e21){_0x1564cd=_0x4d8e21;_0xc45051=0xc8;}else{_0xc45051=0xce;}_0x8b071a[_0x7621('0x2b')](_0xc45051);return _0x8b071a[_0x7621('0x31')]('Content-Range',_0x59d511+'-'+_0x1564cd+'/'+_0x4d8e21)[_0x7621('0x2c')](_0x534e61);}return null;};}function patchUpdates(_0x549596){return function(_0x266d0a){try{jsonpatch[_0x7621('0x32')](_0x266d0a,_0x549596,!![]);}catch(_0x5d97dd){return BPromise[_0x7621('0x33')](_0x5d97dd);}return _0x266d0a['save']();};}function saveUpdates(_0x34b1ee,_0xb6eb6d){return function(_0x387bc1){if(_0x387bc1){return _0x387bc1[_0x7621('0x34')](_0x34b1ee)[_0x7621('0x35')](function(_0x4890a4){return _0x4890a4;});}return null;};}function removeEntity(_0x7190e1,_0x3384c1){return function(_0x481999){if(_0x481999){return _0x481999[_0x7621('0x36')]()['then'](function(){_0x7190e1['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4228d5,_0x1b0eca){return function(_0x4e1d0b){if(!_0x4e1d0b){_0x4228d5[_0x7621('0x2a')](0x194);}return _0x4e1d0b;};}function handleError(_0x26be67,_0x381336){_0x381336=_0x381336||0x1f4;return function(_0x33cfb1){logger[_0x7621('0x27')](_0x33cfb1[_0x7621('0x37')]);if(_0x33cfb1[_0x7621('0x38')]){delete _0x33cfb1['name'];}_0x26be67[_0x7621('0x2b')](_0x381336)[_0x7621('0x39')](_0x33cfb1);};}exports['index']=function(_0x931884,_0x434eeb){var _0x304b4e={},_0x2be32d={},_0x443e60={'count':0x0,'rows':[]};var _0x23b2b2=_[_0x7621('0x3a')](db['OpenchannelMessage'][_0x7621('0x3b')],function(_0x2cb59d){return{'name':_0x2cb59d['fieldName'],'type':_0x2cb59d[_0x7621('0x3c')][_0x7621('0x3d')]};});_0x2be32d[_0x7621('0x3e')]=_[_0x7621('0x3a')](_0x23b2b2,_0x7621('0x38'));_0x2be32d[_0x7621('0x3f')]=_[_0x7621('0x40')](_0x931884[_0x7621('0x3f')]);_0x2be32d['filters']=_[_0x7621('0x41')](_0x2be32d[_0x7621('0x3e')],_0x2be32d[_0x7621('0x3f')]);_0x304b4e[_0x7621('0x42')]=_[_0x7621('0x41')](_0x2be32d[_0x7621('0x3e')],qs['fields'](_0x931884[_0x7621('0x3f')][_0x7621('0x43')]));_0x304b4e['attributes']=_0x304b4e['attributes'][_0x7621('0x44')]?_0x304b4e['attributes']:_0x2be32d[_0x7621('0x3e')];if(!_0x931884[_0x7621('0x3f')][_0x7621('0x45')](_0x7621('0x46'))){_0x304b4e[_0x7621('0x2f')]=qs[_0x7621('0x2f')](_0x931884[_0x7621('0x3f')][_0x7621('0x2f')]);_0x304b4e[_0x7621('0x2d')]=qs[_0x7621('0x2d')](_0x931884[_0x7621('0x3f')][_0x7621('0x2d')]);}_0x304b4e[_0x7621('0x47')]=qs[_0x7621('0x48')](_0x931884[_0x7621('0x3f')][_0x7621('0x48')]);_0x304b4e[_0x7621('0x49')]=qs['filters'](_[_0x7621('0x4a')](_0x931884['query'],_0x2be32d[_0x7621('0x4b')]),_0x23b2b2);if(_0x931884['query'][_0x7621('0x4c')]){_0x304b4e[_0x7621('0x49')]=_[_0x7621('0x4d')](_0x304b4e['where'],{'$or':_['map'](_0x23b2b2,function(_0x3ea33b){if(_0x3ea33b[_0x7621('0x3c')]!==_0x7621('0x4e')){var _0x5a550d={};_0x5a550d[_0x3ea33b[_0x7621('0x38')]]={'$like':'%'+_0x931884[_0x7621('0x3f')][_0x7621('0x4c')]+'%'};return _0x5a550d;}})});}_0x304b4e=_[_0x7621('0x4d')]({},_0x304b4e,_0x931884[_0x7621('0x4f')]);var _0x2d4e3c={'where':_0x304b4e[_0x7621('0x49')]};return db[_0x7621('0x50')][_0x7621('0x30')](_0x2d4e3c)[_0x7621('0x35')](function(_0x4c1011){_0x443e60[_0x7621('0x30')]=_0x4c1011;if(_0x931884[_0x7621('0x3f')][_0x7621('0x51')]){_0x304b4e[_0x7621('0x52')]=[{'all':!![]}];}return db['OpenchannelMessage']['findAll'](_0x304b4e);})[_0x7621('0x35')](function(_0x307d01){_0x443e60[_0x7621('0x53')]=_0x307d01;return _0x443e60;})['then'](respondWithFilteredResult(_0x434eeb,_0x304b4e))['catch'](handleError(_0x434eeb,null));};exports[_0x7621('0x54')]=function(_0x29b5b3,_0x1d6db8){var _0x1ce6ad={'raw':!![],'where':{'id':_0x29b5b3[_0x7621('0x55')]['id']}},_0xb79d59={};_0xb79d59['model']=_[_0x7621('0x40')](db[_0x7621('0x50')]['rawAttributes']);_0xb79d59[_0x7621('0x3f')]=_['keys'](_0x29b5b3[_0x7621('0x3f')]);_0xb79d59[_0x7621('0x4b')]=_[_0x7621('0x41')](_0xb79d59['model'],_0xb79d59['query']);_0x1ce6ad[_0x7621('0x42')]=_[_0x7621('0x41')](_0xb79d59[_0x7621('0x3e')],qs['fields'](_0x29b5b3['query'][_0x7621('0x43')]));_0x1ce6ad['attributes']=_0x1ce6ad[_0x7621('0x42')][_0x7621('0x44')]?_0x1ce6ad[_0x7621('0x42')]:_0xb79d59[_0x7621('0x3e')];if(_0x29b5b3['query']['includeAll']){_0x1ce6ad['include']=[{'all':!![]}];}_0x1ce6ad=_[_0x7621('0x4d')]({},_0x1ce6ad,_0x29b5b3[_0x7621('0x4f')]);return db['OpenchannelMessage'][_0x7621('0x56')](_0x1ce6ad)[_0x7621('0x35')](handleEntityNotFound(_0x1d6db8,null))[_0x7621('0x35')](respondWithResult(_0x1d6db8,null))[_0x7621('0x29')](handleError(_0x1d6db8,null));};exports[_0x7621('0x57')]=function(_0x1fe707,_0x3e6450){return db[_0x7621('0x50')][_0x7621('0x57')](_0x1fe707['body'],{})[_0x7621('0x35')](respondWithResult(_0x3e6450,0xc9))[_0x7621('0x29')](handleError(_0x3e6450,null));};exports['update']=function(_0x4a0de1,_0x669243){if(_0x4a0de1[_0x7621('0x58')]['id']){delete _0x4a0de1['body']['id'];}return db[_0x7621('0x50')][_0x7621('0x56')]({'where':{'id':_0x4a0de1[_0x7621('0x55')]['id']}})['then'](handleEntityNotFound(_0x669243,null))[_0x7621('0x35')](saveUpdates(_0x4a0de1[_0x7621('0x58')],null))[_0x7621('0x35')](respondWithResult(_0x669243,null))[_0x7621('0x29')](handleError(_0x669243,null));};exports[_0x7621('0x36')]=function(_0x2c9eaa,_0xbab93e){return db[_0x7621('0x50')]['find']({'where':{'id':_0x2c9eaa[_0x7621('0x55')]['id']}})[_0x7621('0x35')](handleEntityNotFound(_0xbab93e,null))['then'](removeEntity(_0xbab93e,null))['catch'](handleError(_0xbab93e,null));};exports[_0x7621('0x59')]=function(_0x3888cd,_0x2c9c00){return db[_0x7621('0x50')][_0x7621('0x59')]()[_0x7621('0x35')](respondWithResult(_0x2c9c00,null))[_0x7621('0x29')](handleError(_0x2c9c00,null));};var interaction_log=require(_0x7621('0x5a'))(_0x7621('0x5b'));exports[_0x7621('0x5c')]=function(_0x2899f7,_0x3cc08b,_0x781528){var _0x4b08d2={'agent':{},'channel':_0x7621('0x5d')};if(_0x2899f7[_0x7621('0x58')]['id']){delete _0x2899f7[_0x7621('0x58')]['id'];}_0x2899f7[_0x7621('0x58')][_0x7621('0x5e')]=!![];_0x2899f7[_0x7621('0x58')][_0x7621('0x5f')]=moment()[_0x7621('0x60')](_0x7621('0x61'));_0x2899f7[_0x7621('0x58')][_0x7621('0x62')]=_0x2899f7[_0x7621('0x58')]['UserId']||_0x2899f7['user']['id'];_0x4b08d2[_0x7621('0x63')]['id']=_0x2899f7[_0x7621('0x58')][_0x7621('0x62')];return db['OpenchannelMessage'][_0x7621('0x56')]({'where':{'id':_0x2899f7[_0x7621('0x55')]['id'],'UserId':null}})[_0x7621('0x35')](handleEntityNotFound(_0x3cc08b,null))[_0x7621('0x35')](saveUpdates(_0x2899f7['body'],null))[_0x7621('0x35')](function(_0x2e91d4){if(_0x2e91d4){_0x4b08d2['message']=_0x2e91d4[_0x7621('0x64')]({'plain':!![]});return db[_0x7621('0x65')][_0x7621('0x56')]({'where':{'id':_0x2e91d4[_0x7621('0x66')]}});}return null;})['then'](handleEntityNotFound(_0x3cc08b,null))[_0x7621('0x35')](function(_0x23a656){if(_0x23a656){return _0x23a656['update']({'UserId':_0x2899f7[_0x7621('0x58')][_0x7621('0x62')],'read1stAt':_[_0x7621('0x67')](_0x23a656[_0x7621('0x68')])?moment()[_0x7621('0x60')](_0x7621('0x61')):undefined});}return null;})[_0x7621('0x35')](function(_0x2f3b6b){if(_0x2f3b6b){_0x4b08d2[_0x7621('0x69')]=_0x2f3b6b['get']({'plain':!![]});interaction_log[_0x7621('0x23')]('[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x2899f7[_0x7621('0x6a')]['id'],_0x2899f7[_0x7621('0x6a')][_0x7621('0x38')],_0x2899f7[_0x7621('0x6a')][_0x7621('0x6b')],_0x4b08d2[_0x7621('0x69')]['id'],_0x2899f7[_0x7621('0x58')]?JSON[_0x7621('0x6c')](_0x2899f7[_0x7621('0x58')]):'null');return respondWithRpcPromise(_0x7621('0x6d'),_0x7621('0x6e'),_0x4b08d2);}return null;})['then'](function(_0x223866){var _0x34fd6c=_0x7621('0x6f')+_0x223866[_0x7621('0x28')][_0x7621('0x70')];return db[_0x7621('0x71')][_0x7621('0x3f')](_0x34fd6c,{'type':db[_0x7621('0x72')][_0x7621('0x73')]['SELECT'],'raw':!![]})[_0x7621('0x35')](function(_0xc3cabe){return _0xc3cabe;});})[_0x7621('0x35')](function(_0x2be5cc){if(_0x2be5cc){_0x4b08d2[_0x7621('0x28')][_0x7621('0x74')]=_0x2be5cc[0x0];if(!_0x2899f7[_0x7621('0x58')][_0x7621('0x62')])return;return db[_0x7621('0x75')][_0x7621('0x56')]({'where':{'id':_0x2899f7[_0x7621('0x58')][_0x7621('0x62')],'role':_0x7621('0x63')},'attributes':['id',_0x7621('0x38'),'fullname','email','internal'],'raw':!![]});}return null;})[_0x7621('0x35')](function(_0x717f39){if(!_0x717f39)return null;_0x4b08d2[_0x7621('0x28')][_0x7621('0x63')]=_0x717f39;return _0x4b08d2;})[_0x7621('0x35')](function(_0x154dd7){if(_0x154dd7){if(_0x2899f7[_0x7621('0x58')][_0x7621('0x76')]){_0x4b08d2[_0x7621('0x28')][_0x7621('0x77')]=util[_0x7621('0x60')]('SIP/%s',_0x2899f7[_0x7621('0x6a')]['name']);_0x4b08d2['message'][_0x7621('0x78')]=_0x4b08d2[_0x7621('0x78')];_0x4b08d2[_0x7621('0x28')][_0x7621('0x79')]=_0x4b08d2[_0x7621('0x78')];_0x4b08d2['message'][_0x7621('0x7a')]=_0x7621('0x5c');return respondWithRpcPromise(_0x7621('0x7b'),'EventManager',{'event':_0x7621('0x7c'),'message':_0x4b08d2[_0x7621('0x28')]},client9002)[_0x7621('0x35')](function(){return _0x4b08d2;});}return _0x4b08d2;}return null;})['then'](respondWithResult(_0x3cc08b,null))[_0x7621('0x29')](handleError(_0x3cc08b,null));};var interaction_log=require(_0x7621('0x5a'))('openchannel-interactions');exports[_0x7621('0x33')]=function(_0xf9772a,_0x48c7a9,_0x4028a4){var _0x47439c={'agent':{},'channel':_0x7621('0x5d')};if(_0xf9772a[_0x7621('0x58')]['id']){delete _0xf9772a[_0x7621('0x58')]['id'];}_0xf9772a[_0x7621('0x58')][_0x7621('0x62')]=_0xf9772a[_0x7621('0x58')][_0x7621('0x62')]||_0xf9772a[_0x7621('0x6a')]['id'];_0x47439c[_0x7621('0x63')]['id']=_0xf9772a['body'][_0x7621('0x62')];return db[_0x7621('0x50')][_0x7621('0x56')]({'where':{'id':_0xf9772a[_0x7621('0x55')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x48c7a9,null))[_0x7621('0x35')](function(_0x1abe70){if(_0x1abe70){_0x47439c['message']=_0x1abe70[_0x7621('0x64')]({'plain':!![]});return db[_0x7621('0x65')][_0x7621('0x56')]({'where':{'id':_0x1abe70[_0x7621('0x66')]}});}return null;})[_0x7621('0x35')](handleEntityNotFound(_0x48c7a9,null))[_0x7621('0x35')](function(_0x494718){if(_0x494718){_0x47439c[_0x7621('0x69')]=_0x494718['get']({'plain':!![]});interaction_log['info']('[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0xf9772a['user']['id'],_0xf9772a[_0x7621('0x6a')][_0x7621('0x38')],_0xf9772a[_0x7621('0x6a')]['role'],_0x47439c['interaction']['id'],_0xf9772a[_0x7621('0x58')]?JSON[_0x7621('0x6c')](_0xf9772a[_0x7621('0x58')]):_0x7621('0x7d'));return respondWithRpcPromise(_0x7621('0x7e'),_0x7621('0x7f'),_0x47439c);}return null;})['then'](function(_0x23ac9a){var _0x106c32=_0x7621('0x6f')+_0x23ac9a[_0x7621('0x28')][_0x7621('0x70')];return db['sequelize'][_0x7621('0x3f')](_0x106c32,{'type':db['Sequelize']['QueryTypes']['SELECT'],'raw':!![]})['then'](function(_0x498a9d){return _0x498a9d;});})['then'](function(_0x4df97c){if(_0x4df97c){_0x47439c[_0x7621('0x28')][_0x7621('0x74')]=_0x4df97c[0x0];if(!_0xf9772a[_0x7621('0x58')][_0x7621('0x62')])return;return db[_0x7621('0x75')]['find']({'where':{'id':_0xf9772a[_0x7621('0x58')][_0x7621('0x62')],'role':_0x7621('0x63')},'attributes':['id','name',_0x7621('0x80'),_0x7621('0x81'),'internal'],'raw':!![]});}return null;})['then'](function(_0x3ddd90){if(!_0x3ddd90)return null;_0x47439c[_0x7621('0x28')][_0x7621('0x63')]=_0x3ddd90;return _0x47439c;})['then'](function(_0x152808){if(_0x152808){_0x152808[_0x7621('0x28')][_0x7621('0x77')]=util[_0x7621('0x60')](_0x7621('0x82'),_0xf9772a[_0x7621('0x6a')]['name']);_0x152808['message'][_0x7621('0x78')]=_0x47439c[_0x7621('0x78')];_0x152808[_0x7621('0x28')][_0x7621('0x79')]=_0x47439c['channel'];_0x152808['message'][_0x7621('0x7a')]=_0x7621('0x33');respondWithRpcPromise(_0x7621('0x7b'),_0x7621('0x7b'),{'event':_0x7621('0x83'),'message':_0x152808[_0x7621('0x28')]},client9002);return _0x47439c;}return null;})[_0x7621('0x35')](respondWithResult(_0x48c7a9,null))[_0x7621('0x29')](handleError(_0x48c7a9,null));}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index 1b75c7b..9475b3e 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 _0x5c2c=['hasOwnProperty','exports','../../mysqldb','OpenchannelMessage','setMaxListeners','save','update','remove','emit'];(function(_0x49cda1,_0x4f144e){var _0x138fdb=function(_0x44c40e){while(--_0x44c40e){_0x49cda1['push'](_0x49cda1['shift']());}};_0x138fdb(++_0x4f144e);}(_0x5c2c,0x1b2));var _0xc5c2=function(_0x17c483,_0xc69535){_0x17c483=_0x17c483-0x0;var _0x112bdb=_0x5c2c[_0x17c483];return _0x112bdb;};'use strict';var EventEmitter=require('events');var OpenchannelMessage=require(_0xc5c2('0x0'))['db'][_0xc5c2('0x1')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0xc5c2('0x2')](0x0);var events={'afterCreate':_0xc5c2('0x3'),'afterUpdate':_0xc5c2('0x4'),'afterDestroy':_0xc5c2('0x5')};function emitEvent(_0x29f2e0){return function(_0x1be06d,_0x4abfff,_0xe7fd3c){OpenchannelMessageEvents[_0xc5c2('0x6')](_0x29f2e0+':'+_0x1be06d['id'],_0x1be06d);OpenchannelMessageEvents[_0xc5c2('0x6')](_0x29f2e0,_0x1be06d);_0xe7fd3c(null);};}for(var e in events){if(events[_0xc5c2('0x7')](e)){var event=events[e];OpenchannelMessage['hook'](e,emitEvent(event));}}module[_0xc5c2('0x8')]=OpenchannelMessageEvents; \ No newline at end of file +var _0x26c1=['remove','emit','events','OpenchannelMessage','setMaxListeners','update'];(function(_0x1d81f1,_0x26d68f){var _0x8c5808=function(_0x22c219){while(--_0x22c219){_0x1d81f1['push'](_0x1d81f1['shift']());}};_0x8c5808(++_0x26d68f);}(_0x26c1,0x128));var _0x126c=function(_0x521e8d,_0x23a290){_0x521e8d=_0x521e8d-0x0;var _0x518bbd=_0x26c1[_0x521e8d];return _0x518bbd;};'use strict';var EventEmitter=require(_0x126c('0x0'));var OpenchannelMessage=require('../../mysqldb')['db'][_0x126c('0x1')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0x126c('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x126c('0x3'),'afterDestroy':_0x126c('0x4')};function emitEvent(_0x57400e){return function(_0x571e21,_0x37edff,_0x138d6d){OpenchannelMessageEvents[_0x126c('0x5')](_0x57400e+':'+_0x571e21['id'],_0x571e21);OpenchannelMessageEvents[_0x126c('0x5')](_0x57400e,_0x571e21);_0x138d6d(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelMessage['hook'](e,emitEvent(event));}}module['exports']=OpenchannelMessageEvents; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.model.js b/server/api/openchannelMessage/openchannelMessage.model.js index a69c58c..fb6f4e4 100644 --- a/server/api/openchannelMessage/openchannelMessage.model.js +++ b/server/api/openchannelMessage/openchannelMessage.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x34b7=['moment','bluebird','request-promise','path','./openchannelMessage.attributes','exports','define','OpenchannelMessage','fti_openchannel_messages','body','models','get','direction','toLowerCase','out','secret','isNil','UserId','OpenchannelInteraction','findOne','OpenchannelInteractionId','update','createdAt','catch','error','CmContact','describe','then','OpenchannelAccountId','Interactions','Contact','keys','replyUri','info','OpenchannelMessage,\x20%s,\x20%s','afterCreate','Forwarding\x20message\x20%d\x20to\x20%s','length','Interaction','omit','POST','method','format','Message\x20%d\x20forwarded\x20to\x20%s','threadId','inspect','finally','utf8mb4','utf8mb4_unicode_ci','../../config/logger','api'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x34b7,0x196));var _0x734b=function(_0x25601e,_0x3bd0f4){_0x25601e=_0x25601e-0x0;var _0x54d208=_0x34b7[_0x25601e];return _0x54d208;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x734b('0x0'))(_0x734b('0x1'));var moment=require(_0x734b('0x2'));var BPromise=require(_0x734b('0x3'));var rp=require(_0x734b('0x4'));var fs=require('fs');var path=require(_0x734b('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x734b('0x6'));module[_0x734b('0x7')]=function(_0x2f3128,_0x34fd70){return _0x2f3128[_0x734b('0x8')](_0x734b('0x9'),attributes,{'tableName':'openchannel_messages','paranoid':![],'indexes':[{'name':_0x734b('0xa'),'fields':[_0x734b('0xb')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x53f163,_0x5f4b3a,_0x19a88e){var _0x598dee=_0x2f3128[_0x734b('0xc')];var _0x333738=_0x53f163[_0x734b('0xd')]({'plain':!![]});if(_0x333738[_0x734b('0xe')][_0x734b('0xf')]()==='in'||_0x333738[_0x734b('0xe')][_0x734b('0xf')]()===_0x734b('0x10')&&!_0x333738[_0x734b('0x11')]&&!_[_0x734b('0x12')](_0x333738[_0x734b('0x13')])){_0x598dee[_0x734b('0x14')][_0x734b('0x15')]({'where':{'id':_0x333738[_0x734b('0x16')]}})['then'](function(_0x18fc18){if(_0x18fc18){_0x18fc18[_0x734b('0x17')]({'lastMsgAt':_0x333738[_0x734b('0x18')],'lastMsgDirection':_0x333738[_0x734b('0xe')][_0x734b('0xf')]()});}})[_0x734b('0x19')](function(_0x2372bd){console[_0x734b('0x1a')](_0x2372bd);});}if(_0x333738[_0x734b('0xe')]===_0x734b('0x10')&&!_0x333738[_0x734b('0x11')]){var _0x4d2d23;_0x598dee[_0x734b('0x1b')][_0x734b('0x1c')]()[_0x734b('0x1d')](function(_0x5edbe9){return _0x598dee['OpenchannelAccount']['find']({'where':{'id':_0x333738[_0x734b('0x1e')]},'include':[{'model':_0x598dee[_0x734b('0x14')],'as':_0x734b('0x1f'),'where':{'id':_0x333738[_0x734b('0x16')]},'limit':0x1,'include':[{'model':_0x598dee[_0x734b('0x1b')],'as':_0x734b('0x20'),'attributes':_[_0x734b('0x21')](_0x5edbe9)}]}]});})[_0x734b('0x1d')](function(_0x67eed){_0x4d2d23=_0x67eed[_0x734b('0xd')]({'plain':!![]});if(_0x4d2d23&&_0x4d2d23[_0x734b('0x22')]){logger[_0x734b('0x23')](_0x734b('0x24'),_0x734b('0x25'),util['format'](_0x734b('0x26'),_0x333738['id'],_0x4d2d23[_0x734b('0x22')]));if(_0x4d2d23['Interactions']&&_0x4d2d23[_0x734b('0x1f')][_0x734b('0x27')]){_0x333738[_0x734b('0x28')]=_[_0x734b('0x29')](_0x4d2d23[_0x734b('0x1f')][0x0],_0x734b('0x20'));_0x333738[_0x734b('0x20')]=_0x4d2d23[_0x734b('0x1f')][0x0][_0x734b('0x20')];}var _0x5f4b3a={'method':_0x734b('0x2a'),'uri':encodeURI(_0x4d2d23[_0x734b('0x22')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x5f4b3a[_0x734b('0x2b')]){case'GET':_0x5f4b3a['qs']=_0x333738;break;case'POST':_0x5f4b3a[_0x734b('0xb')]=_0x333738;break;}return rp(_0x5f4b3a)[_0x734b('0x1d')](function(_0x47a0a9){logger[_0x734b('0x23')](_0x734b('0x24'),_0x734b('0x25'),util[_0x734b('0x2c')](_0x734b('0x2d'),_0x333738['id'],_0x4d2d23[_0x734b('0x22')]));if(_0x47a0a9[_0x734b('0xb')]['threadId']&&_0x47a0a9[_0x734b('0xb')][_0x734b('0x2e')]!=_0x333738[_0x734b('0x28')][_0x734b('0x2e')]){return _0x598dee[_0x734b('0x14')][_0x734b('0x17')]({'threadId':_0x47a0a9[_0x734b('0xb')][_0x734b('0x2e')]},{'logging':!![],'where':{'id':_0x333738[_0x734b('0x28')]['id']}});}else{return;}})[_0x734b('0x1d')](function(){return _0x53f163['update']({'read':!![]});})[_0x734b('0x19')](function(_0x37f1a1){logger['error'](_0x734b('0x24'),_0x734b('0x25'),util[_0x734b('0x2f')](_0x37f1a1,{'showHidden':![],'depth':null}));_0x19a88e();});}else{_0x19a88e();}})[_0x734b('0x30')](function(){_0x19a88e();});}else{_0x19a88e();}}},'charset':_0x734b('0x31'),'collate':_0x734b('0x32')});}; \ No newline at end of file +var _0x8f4c=['lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','exports','OpenchannelMessage','fti_openchannel_messages','body','FULLTEXT','models','get','toLowerCase','out','secret','isNil','UserId','findOne','OpenchannelInteractionId','then','update','createdAt','catch','error','direction','describe','OpenchannelAccount','find','OpenchannelAccountId','OpenchannelInteraction','Interactions','CmContact','Contact','keys','replyUri','info','OpenchannelMessage,\x20%s,\x20%s','afterCreate','format','Forwarding\x20message\x20%d\x20to\x20%s','length','Interaction','omit','POST','method','GET','Message\x20%d\x20forwarded\x20to\x20%s','threadId','inspect','finally','utf8mb4_unicode_ci'];(function(_0x342eaa,_0x528349){var _0x5b09b4=function(_0x5c0096){while(--_0x5c0096){_0x342eaa['push'](_0x342eaa['shift']());}};_0x5b09b4(++_0x528349);}(_0x8f4c,0x113));var _0xc8f4=function(_0x3446af,_0x3b2f92){_0x3446af=_0x3446af-0x0;var _0x252b14=_0x8f4c[_0x3446af];return _0x252b14;};'use strict';var _=require(_0xc8f4('0x0'));var util=require(_0xc8f4('0x1'));var logger=require(_0xc8f4('0x2'))(_0xc8f4('0x3'));var moment=require(_0xc8f4('0x4'));var BPromise=require(_0xc8f4('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc8f4('0x6'));var rimraf=require(_0xc8f4('0x7'));var config=require(_0xc8f4('0x8'));var attributes=require('./openchannelMessage.attributes');module[_0xc8f4('0x9')]=function(_0x5208da,_0x4c86f8){return _0x5208da['define'](_0xc8f4('0xa'),attributes,{'tableName':'openchannel_messages','paranoid':![],'indexes':[{'name':_0xc8f4('0xb'),'fields':[_0xc8f4('0xc')],'type':_0xc8f4('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x39ed63,_0x34f05f,_0x599de3){var _0x38c41b=_0x5208da[_0xc8f4('0xe')];var _0x2fba62=_0x39ed63[_0xc8f4('0xf')]({'plain':!![]});if(_0x2fba62['direction'][_0xc8f4('0x10')]()==='in'||_0x2fba62['direction'][_0xc8f4('0x10')]()===_0xc8f4('0x11')&&!_0x2fba62[_0xc8f4('0x12')]&&!_[_0xc8f4('0x13')](_0x2fba62[_0xc8f4('0x14')])){_0x38c41b['OpenchannelInteraction'][_0xc8f4('0x15')]({'where':{'id':_0x2fba62[_0xc8f4('0x16')]}})[_0xc8f4('0x17')](function(_0x14bc11){if(_0x14bc11){_0x14bc11[_0xc8f4('0x18')]({'lastMsgAt':_0x2fba62[_0xc8f4('0x19')],'lastMsgDirection':_0x2fba62['direction'][_0xc8f4('0x10')]()});}})[_0xc8f4('0x1a')](function(_0x1518a6){console[_0xc8f4('0x1b')](_0x1518a6);});}if(_0x2fba62[_0xc8f4('0x1c')]==='out'&&!_0x2fba62[_0xc8f4('0x12')]){var _0x4d2b77;_0x38c41b['CmContact'][_0xc8f4('0x1d')]()[_0xc8f4('0x17')](function(_0x108076){return _0x38c41b[_0xc8f4('0x1e')][_0xc8f4('0x1f')]({'where':{'id':_0x2fba62[_0xc8f4('0x20')]},'include':[{'model':_0x38c41b[_0xc8f4('0x21')],'as':_0xc8f4('0x22'),'where':{'id':_0x2fba62[_0xc8f4('0x16')]},'limit':0x1,'include':[{'model':_0x38c41b[_0xc8f4('0x23')],'as':_0xc8f4('0x24'),'attributes':_[_0xc8f4('0x25')](_0x108076)}]}]});})[_0xc8f4('0x17')](function(_0x5f3264){_0x4d2b77=_0x5f3264[_0xc8f4('0xf')]({'plain':!![]});if(_0x4d2b77&&_0x4d2b77[_0xc8f4('0x26')]){logger[_0xc8f4('0x27')](_0xc8f4('0x28'),_0xc8f4('0x29'),util[_0xc8f4('0x2a')](_0xc8f4('0x2b'),_0x2fba62['id'],_0x4d2b77[_0xc8f4('0x26')]));if(_0x4d2b77['Interactions']&&_0x4d2b77[_0xc8f4('0x22')][_0xc8f4('0x2c')]){_0x2fba62[_0xc8f4('0x2d')]=_[_0xc8f4('0x2e')](_0x4d2b77['Interactions'][0x0],_0xc8f4('0x24'));_0x2fba62['Contact']=_0x4d2b77[_0xc8f4('0x22')][0x0]['Contact'];}var _0x34f05f={'method':_0xc8f4('0x2f'),'uri':encodeURI(_0x4d2b77['replyUri']),'json':!![],'resolveWithFullResponse':!![]};switch(_0x34f05f[_0xc8f4('0x30')]){case _0xc8f4('0x31'):_0x34f05f['qs']=_0x2fba62;break;case _0xc8f4('0x2f'):_0x34f05f[_0xc8f4('0xc')]=_0x2fba62;break;}return rp(_0x34f05f)['then'](function(_0x3db490){logger[_0xc8f4('0x27')]('OpenchannelMessage,\x20%s,\x20%s',_0xc8f4('0x29'),util[_0xc8f4('0x2a')](_0xc8f4('0x32'),_0x2fba62['id'],_0x4d2b77[_0xc8f4('0x26')]));if(_0x3db490[_0xc8f4('0xc')][_0xc8f4('0x33')]&&_0x3db490['body'][_0xc8f4('0x33')]!=_0x2fba62[_0xc8f4('0x2d')][_0xc8f4('0x33')]){return _0x38c41b['OpenchannelInteraction'][_0xc8f4('0x18')]({'threadId':_0x3db490[_0xc8f4('0xc')]['threadId']},{'logging':!![],'where':{'id':_0x2fba62['Interaction']['id']}});}else{return;}})['then'](function(){return _0x39ed63[_0xc8f4('0x18')]({'read':!![]});})[_0xc8f4('0x1a')](function(_0x2e9a2a){logger[_0xc8f4('0x1b')](_0xc8f4('0x28'),_0xc8f4('0x29'),util[_0xc8f4('0x34')](_0x2e9a2a,{'showHidden':![],'depth':null}));_0x599de3();});}else{_0x599de3();}})[_0xc8f4('0x35')](function(){_0x599de3();});}else{_0x599de3();}}},'charset':'utf8mb4','collate':_0xc8f4('0x36')});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.rpc.js b/server/api/openchannelMessage/openchannelMessage.rpc.js index d706194..3ace8f1 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(_0x220be7,_0x1de136){var _0x22cc57=function(_0x314d5f){while(--_0x314d5f){_0x220be7['push'](_0x220be7['shift']());}};_0x22cc57(++_0x1de136);}(_0xadb5,0xad));var _0x5adb=function(_0x159d47,_0x369a91){_0x159d47=_0x159d47-0x0;var _0x1700a4=_0xadb5[_0x159d47];return _0x1700a4;};'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 _0xdb28=['then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','CreateOpenchannelMessage','OpenchannelMessage','create','body','options','raw','stringify','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','./openchannelMessage.socket','register','request'];(function(_0x1ded25,_0x26be3d){var _0x8ec99f=function(_0x3017ac){while(--_0x3017ac){_0x1ded25['push'](_0x1ded25['shift']());}};_0x8ec99f(++_0x26be3d);}(_0xdb28,0x106));var _0x8db2=function(_0x5a21d7,_0x43c6ae){_0x5a21d7=_0x5a21d7-0x0;var _0x372af8=_0xdb28[_0x5a21d7];return _0x372af8;};'use strict';var _=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var moment=require(_0x8db2('0x2'));var BPromise=require(_0x8db2('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8db2('0x4'));var db=require(_0x8db2('0x5'))['db'];var utils=require(_0x8db2('0x6'));var logger=require(_0x8db2('0x7'))(_0x8db2('0x8'));var config=require('../../config/environment');var jayson=require(_0x8db2('0x9'));var client=jayson[_0x8db2('0xa')]['http']({'port':0x232a});config['redis']=_[_0x8db2('0xb')](config[_0x8db2('0xc')],{'host':_0x8db2('0xd'),'port':0x18eb});var socket=require(_0x8db2('0xe'))(new Redis(config[_0x8db2('0xc')]));require(_0x8db2('0xf'))[_0x8db2('0x10')](socket);function respondWithRpcPromise(_0x4ba340,_0x30dc90,_0x476216){return new BPromise(function(_0x1f62af,_0x57015f){return client[_0x8db2('0x11')](_0x4ba340,_0x476216)[_0x8db2('0x12')](function(_0x576475){logger[_0x8db2('0x13')](_0x8db2('0x14'),_0x30dc90,_0x8db2('0x15'));logger[_0x8db2('0x16')](_0x8db2('0x17'),_0x30dc90,'request\x20sent',JSON['stringify'](_0x576475));if(_0x576475[_0x8db2('0x18')]){if(_0x576475[_0x8db2('0x18')][_0x8db2('0x19')]===0x1f4){logger[_0x8db2('0x18')](_0x8db2('0x14'),_0x30dc90,_0x576475[_0x8db2('0x18')][_0x8db2('0x1a')]);return _0x57015f(_0x576475[_0x8db2('0x18')][_0x8db2('0x1a')]);}logger[_0x8db2('0x18')]('OpenchannelMessage,\x20%s,\x20%s',_0x30dc90,_0x576475[_0x8db2('0x18')][_0x8db2('0x1a')]);return _0x1f62af(_0x576475['error'][_0x8db2('0x1a')]);}else{logger[_0x8db2('0x13')](_0x8db2('0x14'),_0x30dc90,_0x8db2('0x15'));_0x1f62af(_0x576475[_0x8db2('0x1b')][_0x8db2('0x1a')]);}})['catch'](function(_0x5df464){logger[_0x8db2('0x18')](_0x8db2('0x14'),_0x30dc90,_0x5df464);_0x57015f(_0x5df464);});});}exports[_0x8db2('0x1c')]=function(_0x1b64e4){var _0x58562e=this;return new Promise(function(_0x431d60,_0x36a9ff){return db[_0x8db2('0x1d')][_0x8db2('0x1e')](_0x1b64e4[_0x8db2('0x1f')],{'raw':_0x1b64e4['options']?_0x1b64e4[_0x8db2('0x20')][_0x8db2('0x21')]===undefined?!![]:![]:!![]})[_0x8db2('0x12')](function(_0x125be2){logger[_0x8db2('0x13')](_0x8db2('0x1c'),_0x1b64e4);logger[_0x8db2('0x16')]('CreateOpenchannelMessage',_0x1b64e4,JSON[_0x8db2('0x22')](_0x125be2));_0x431d60(_0x125be2);})['catch'](function(_0x5725f0){logger['error']('CreateOpenchannelMessage',_0x5725f0[_0x8db2('0x1a')],_0x1b64e4);_0x36a9ff(_0x58562e[_0x8db2('0x18')](0x1f4,_0x5725f0[_0x8db2('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.socket.js b/server/api/openchannelMessage/openchannelMessage.socket.js index 8263dda..2752967 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 _0xedf2=['save','remove','update','openchannelMessage:'];(function(_0x28351c,_0x1bf1d0){var _0x3fd594=function(_0xb785b8){while(--_0xb785b8){_0x28351c['push'](_0x28351c['shift']());}};_0x3fd594(++_0x1bf1d0);}(_0xedf2,0x1ac));var _0x2edf=function(_0x4cc763,_0x54c97b){_0x4cc763=_0x4cc763-0x0;var _0xa8f5d1=_0xedf2[_0x4cc763];return _0xa8f5d1;};'use strict';var OpenchannelMessageEvents=require('./openchannelMessage.events');var events=[_0x2edf('0x0'),_0x2edf('0x1'),_0x2edf('0x2')];function createListener(_0x4b454e,_0xce87f7){return function(_0x1ad605){_0xce87f7['emit'](_0x4b454e,_0x1ad605);};}function removeListener(_0x43611a,_0x2c1515){return function(){OpenchannelMessageEvents['removeListener'](_0x43611a,_0x2c1515);};}exports['register']=function(_0x3cfc52){for(var _0x3601aa=0x0,_0x5af8d9=events['length'];_0x3601aa<_0x5af8d9;_0x3601aa++){var _0x2b7b21=events[_0x3601aa];var _0x498c41=createListener(_0x2edf('0x3')+_0x2b7b21,_0x3cfc52);OpenchannelMessageEvents['on'](_0x2b7b21,_0x498c41);}}; \ No newline at end of file +var _0xe51b=['register','./openchannelMessage.events','save','update','emit'];(function(_0x485457,_0x3ef5ae){var _0x208e90=function(_0xabb4de){while(--_0xabb4de){_0x485457['push'](_0x485457['shift']());}};_0x208e90(++_0x3ef5ae);}(_0xe51b,0x92));var _0xbe51=function(_0x2d6cae,_0x4578a7){_0x2d6cae=_0x2d6cae-0x0;var _0x1fc654=_0xe51b[_0x2d6cae];return _0x1fc654;};'use strict';var OpenchannelMessageEvents=require(_0xbe51('0x0'));var events=[_0xbe51('0x1'),'remove',_0xbe51('0x2')];function createListener(_0xc6213b,_0x102613){return function(_0x561484){_0x102613[_0xbe51('0x3')](_0xc6213b,_0x561484);};}function removeListener(_0xe3f02f,_0x38fe4c){return function(){OpenchannelMessageEvents['removeListener'](_0xe3f02f,_0x38fe4c);};}exports[_0xbe51('0x4')]=function(_0x1e589b){for(var _0x5d75dc=0x0,_0x1fb3c1=events['length'];_0x5d75dc<_0x1fb3c1;_0x5d75dc++){var _0x4b2308=events[_0x5d75dc];var _0x10ad9c=createListener('openchannelMessage:'+_0x4b2308,_0x1e589b);OpenchannelMessageEvents['on'](_0x4b2308,_0x10ad9c);}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/index.js b/server/api/openchannelQueue/index.js index 4fa3a18..766fde5 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 _0x8c00=['show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addAgents','put','delete','destroy','removeTeams','removeAgents','multer','util','path','express','../../components/auth/service','../../config/environment','./openchannelQueue.controller','get','isAuthenticated','index','/describe','describe','/:id'];(function(_0x2ccd09,_0x1b8918){var _0x3acb10=function(_0x5e9996){while(--_0x5e9996){_0x2ccd09['push'](_0x2ccd09['shift']());}};_0x3acb10(++_0x1b8918);}(_0x8c00,0xef));var _0x08c0=function(_0x1f09fa,_0x3265ca){_0x1f09fa=_0x1f09fa-0x0;var _0x197c8d=_0x8c00[_0x1f09fa];return _0x197c8d;};'use strict';var multer=require(_0x08c0('0x0'));var util=require(_0x08c0('0x1'));var path=require(_0x08c0('0x2'));var timeout=require('connect-timeout');var express=require(_0x08c0('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x08c0('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x08c0('0x5'));var controller=require(_0x08c0('0x6'));router[_0x08c0('0x7')]('/',auth[_0x08c0('0x8')](),controller[_0x08c0('0x9')]);router['get'](_0x08c0('0xa'),auth[_0x08c0('0x8')](),controller[_0x08c0('0xb')]);router['get'](_0x08c0('0xc'),auth[_0x08c0('0x8')](),controller[_0x08c0('0xd')]);router[_0x08c0('0x7')](_0x08c0('0xe'),auth[_0x08c0('0x8')](),controller[_0x08c0('0xf')]);router[_0x08c0('0x7')](_0x08c0('0x10'),auth[_0x08c0('0x8')](),controller[_0x08c0('0x11')]);router[_0x08c0('0x7')](_0x08c0('0x12'),auth[_0x08c0('0x8')](),controller[_0x08c0('0x13')]);router[_0x08c0('0x14')]('/',auth[_0x08c0('0x8')](),controller[_0x08c0('0x15')]);router['post'](_0x08c0('0x10'),auth[_0x08c0('0x8')](),controller['addTeams']);router[_0x08c0('0x14')]('/:id/users',auth[_0x08c0('0x8')](),controller[_0x08c0('0x16')]);router[_0x08c0('0x17')](_0x08c0('0xc'),auth[_0x08c0('0x8')](),controller['update']);router[_0x08c0('0x18')](_0x08c0('0xc'),auth[_0x08c0('0x8')](),controller[_0x08c0('0x19')]);router['delete'](_0x08c0('0x10'),auth[_0x08c0('0x8')](),controller[_0x08c0('0x1a')]);router[_0x08c0('0x18')](_0x08c0('0x12'),auth[_0x08c0('0x8')](),controller[_0x08c0('0x1b')]);module['exports']=router; \ No newline at end of file +var _0xbaf6=['index','/describe','describe','/:id','/:id/members','getMembers','/:id/teams','getTeams','post','addTeams','/:id/users','put','update','delete','destroy','removeTeams','removeAgents','exports','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated'];(function(_0x5623cb,_0x20b099){var _0x368ce6=function(_0x3439ad){while(--_0x3439ad){_0x5623cb['push'](_0x5623cb['shift']());}};_0x368ce6(++_0x20b099);}(_0xbaf6,0x1b2));var _0x6baf=function(_0x3be7ff,_0x12e714){_0x3be7ff=_0x3be7ff-0x0;var _0x186721=_0xbaf6[_0x3be7ff];return _0x186721;};'use strict';var multer=require('multer');var util=require(_0x6baf('0x0'));var path=require('path');var timeout=require(_0x6baf('0x1'));var express=require('express');var router=express[_0x6baf('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x6baf('0x3'));var interaction=require(_0x6baf('0x4'));var config=require(_0x6baf('0x5'));var controller=require('./openchannelQueue.controller');router[_0x6baf('0x6')]('/',auth[_0x6baf('0x7')](),controller[_0x6baf('0x8')]);router[_0x6baf('0x6')](_0x6baf('0x9'),auth[_0x6baf('0x7')](),controller[_0x6baf('0xa')]);router[_0x6baf('0x6')](_0x6baf('0xb'),auth[_0x6baf('0x7')](),controller['show']);router[_0x6baf('0x6')](_0x6baf('0xc'),auth[_0x6baf('0x7')](),controller[_0x6baf('0xd')]);router[_0x6baf('0x6')](_0x6baf('0xe'),auth['isAuthenticated'](),controller[_0x6baf('0xf')]);router[_0x6baf('0x6')]('/:id/users',auth[_0x6baf('0x7')](),controller['getAgents']);router[_0x6baf('0x10')]('/',auth[_0x6baf('0x7')](),controller['create']);router['post']('/:id/teams',auth[_0x6baf('0x7')](),controller[_0x6baf('0x11')]);router[_0x6baf('0x10')](_0x6baf('0x12'),auth[_0x6baf('0x7')](),controller['addAgents']);router[_0x6baf('0x13')](_0x6baf('0xb'),auth[_0x6baf('0x7')](),controller[_0x6baf('0x14')]);router[_0x6baf('0x15')](_0x6baf('0xb'),auth[_0x6baf('0x7')](),controller[_0x6baf('0x16')]);router[_0x6baf('0x15')](_0x6baf('0xe'),auth[_0x6baf('0x7')](),controller[_0x6baf('0x17')]);router[_0x6baf('0x15')]('/:id/users',auth[_0x6baf('0x7')](),controller[_0x6baf('0x18')]);module[_0x6baf('0x19')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.attributes.js b/server/api/openchannelQueue/openchannelQueue.attributes.js index 41aa53f..5a9f6a5 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 _0x9416=['roundrobin','sequelize','exports','STRING','name','INTEGER','ENUM','rrmemory'];(function(_0x4cfca4,_0x3ffe76){var _0xfa949f=function(_0x20e44a){while(--_0x20e44a){_0x4cfca4['push'](_0x4cfca4['shift']());}};_0xfa949f(++_0x3ffe76);}(_0x9416,0xb1));var _0x6941=function(_0x36d347,_0x5e3fa1){_0x36d347=_0x36d347-0x0;var _0x3965cb=_0x9416[_0x36d347];return _0x3965cb;};'use strict';var Sequelize=require(_0x6941('0x0'));module[_0x6941('0x1')]={'name':{'type':Sequelize[_0x6941('0x2')],'unique':_0x6941('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x6941('0x2')]},'timeout':{'type':Sequelize[_0x6941('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x6941('0x5')](_0x6941('0x6'),'beepall',_0x6941('0x7'))}}; \ No newline at end of file +var _0x1e5b=['roundrobin','exports','name','STRING','INTEGER','ENUM','beepall'];(function(_0x3f3e50,_0x2459ee){var _0x2082c4=function(_0x1e64c5){while(--_0x1e64c5){_0x3f3e50['push'](_0x3f3e50['shift']());}};_0x2082c4(++_0x2459ee);}(_0x1e5b,0x143));var _0xb1e5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1e5b[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0xb1e5('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0xb1e5('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xb1e5('0x2')]},'timeout':{'type':Sequelize[_0xb1e5('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xb1e5('0x4')]('rrmemory',_0xb1e5('0x5'),_0xb1e5('0x6'))}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.controller.js b/server/api/openchannelQueue/openchannelQueue.controller.js index 6684abf..46ea141 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 _0x8c0f=['OpenchannelQueueId','User','UserId','agent','openchannelPause','updatedAt','createdAt','format','%s/%s','SIP','Team','getTeams','addTeams','ids','online','interface','Agents','sequelize','transaction','each','findOrCreate','emit','userOpenchannelQueue:save','select','tq.TeamId','from','team_has_openchannel_queues','join','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','clone','push','toString','QueryTypes','every','TeamId','includes','union','compact','value','removeTeams','isEmpty','removeAgents','userOpenchannelQueue:remove','addAgents','omit','spread','isArray','getAgents','eml-format','rimraf','bluebird','mustache','path','sox','to-csv','fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','./openchannelQueue.socket','register','status','end','json','offset','undefined','count','set','Content-Range','apply','save','update','then','destroy','get','OpenchannelQueues','UserProfileResource','sendStatus','error','send','index','OpenchannelQueue','rawAttributes','fieldName','type','key','model','map','name','keys','query','intersection','attributes','fields','length','nolimit','limit','order','sort','where','filters','pick','filter','merge','options','include','findAll','rows','catch','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','findOne','UserOpenchannelQueue','hasOwnProperty'];(function(_0x50d0f3,_0x38148a){var _0x352976=function(_0x16c302){while(--_0x16c302){_0x50d0f3['push'](_0x50d0f3['shift']());}};_0x352976(++_0x38148a);}(_0x8c0f,0x1cc));var _0xf8c0=function(_0x1c2d3b,_0x2c3643){_0x1c2d3b=_0x1c2d3b-0x0;var _0x445aa8=_0x8c0f[_0x1c2d3b];return _0x445aa8;};'use strict';var emlformat=require(_0xf8c0('0x0'));var rimraf=require(_0xf8c0('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xf8c0('0x2'));var Mustache=require(_0xf8c0('0x3'));var util=require('util');var path=require(_0xf8c0('0x4'));var sox=require(_0xf8c0('0x5'));var csv=require(_0xf8c0('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf8c0('0x7'));var _=require('lodash');var squel=require(_0xf8c0('0x8'));var crypto=require('crypto');var jsforce=require(_0xf8c0('0x9'));var deskjs=require(_0xf8c0('0xa'));var toCsv=require(_0xf8c0('0x6'));var querystring=require(_0xf8c0('0xb'));var Papa=require(_0xf8c0('0xc'));var Redis=require(_0xf8c0('0xd'));var authService=require(_0xf8c0('0xe'));var qs=require(_0xf8c0('0xf'));var as=require(_0xf8c0('0x10'));var hardwareService=require(_0xf8c0('0x11'));var logger=require(_0xf8c0('0x12'))('api');var utils=require(_0xf8c0('0x13'));var config=require(_0xf8c0('0x14'));var licenseUtil=require(_0xf8c0('0x15'));var db=require(_0xf8c0('0x16'))['db'];config[_0xf8c0('0x17')]=_[_0xf8c0('0x18')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xf8c0('0x19'))[_0xf8c0('0x1a')](socket);function respondWithStatusCode(_0x3dc21e,_0x5648c1){_0x5648c1=_0x5648c1||0xcc;return function(_0x405321){if(_0x405321){return _0x3dc21e['sendStatus'](_0x5648c1);}return _0x3dc21e[_0xf8c0('0x1b')](_0x5648c1)[_0xf8c0('0x1c')]();};}function respondWithResult(_0x1ed130,_0xc39478){_0xc39478=_0xc39478||0xc8;return function(_0x370b69){if(_0x370b69){return _0x1ed130[_0xf8c0('0x1b')](_0xc39478)[_0xf8c0('0x1d')](_0x370b69);}};}function respondWithFilteredResult(_0x10f79d,_0x1d5352){return function(_0x5bdb38){if(_0x5bdb38){var _0x21faff=typeof _0x1d5352[_0xf8c0('0x1e')]===_0xf8c0('0x1f')&&typeof _0x1d5352['limit']===_0xf8c0('0x1f');var _0xa53f28=_0x5bdb38[_0xf8c0('0x20')];var _0x560a94=_0x21faff?0x0:_0x1d5352[_0xf8c0('0x1e')];var _0x38f013=_0x21faff?_0x5bdb38[_0xf8c0('0x20')]:_0x1d5352[_0xf8c0('0x1e')]+_0x1d5352['limit'];var _0x2be31e;if(_0x38f013>=_0xa53f28){_0x38f013=_0xa53f28;_0x2be31e=0xc8;}else{_0x2be31e=0xce;}_0x10f79d[_0xf8c0('0x1b')](_0x2be31e);return _0x10f79d[_0xf8c0('0x21')](_0xf8c0('0x22'),_0x560a94+'-'+_0x38f013+'/'+_0xa53f28)[_0xf8c0('0x1d')](_0x5bdb38);}return null;};}function patchUpdates(_0x16649e){return function(_0x45076d){try{jsonpatch[_0xf8c0('0x23')](_0x45076d,_0x16649e,!![]);}catch(_0x5e3445){return BPromise['reject'](_0x5e3445);}return _0x45076d[_0xf8c0('0x24')]();};}function saveUpdates(_0x19aec,_0x1285c1){return function(_0x42a31e){if(_0x42a31e){return _0x42a31e[_0xf8c0('0x25')](_0x19aec)[_0xf8c0('0x26')](function(_0x3f495d){return _0x3f495d;});}return null;};}function removeEntity(_0x4a2d96,_0x4356f2){return function(_0x5d366d){if(_0x5d366d){return _0x5d366d[_0xf8c0('0x27')]()['then'](function(){var _0x3034f2=_0x5d366d[_0xf8c0('0x28')]({'plain':!![]});var _0xd6186c=_0xf8c0('0x29');return db[_0xf8c0('0x2a')][_0xf8c0('0x27')]({'where':{'type':_0xd6186c,'resourceId':_0x3034f2['id']}})[_0xf8c0('0x26')](function(){return _0x5d366d;});})['then'](function(){_0x4a2d96[_0xf8c0('0x1b')](0xcc)[_0xf8c0('0x1c')]();});}};}function handleEntityNotFound(_0x2ae963,_0x195b80){return function(_0xbbd2b4){if(!_0xbbd2b4){_0x2ae963[_0xf8c0('0x2b')](0x194);}return _0xbbd2b4;};}function handleError(_0x111d84,_0x49e09d){_0x49e09d=_0x49e09d||0x1f4;return function(_0x3f3076){logger[_0xf8c0('0x2c')](_0x3f3076['stack']);if(_0x3f3076['name']){delete _0x3f3076['name'];}_0x111d84[_0xf8c0('0x1b')](_0x49e09d)[_0xf8c0('0x2d')](_0x3f3076);};}exports[_0xf8c0('0x2e')]=function(_0xb98a9d,_0x1bc299){var _0x37c162={},_0x3ab5fc={},_0x28cdab={'count':0x0,'rows':[]};var _0x41ef4b=_['map'](db[_0xf8c0('0x2f')][_0xf8c0('0x30')],function(_0x372f33){return{'name':_0x372f33[_0xf8c0('0x31')],'type':_0x372f33[_0xf8c0('0x32')][_0xf8c0('0x33')]};});_0x3ab5fc[_0xf8c0('0x34')]=_[_0xf8c0('0x35')](_0x41ef4b,_0xf8c0('0x36'));_0x3ab5fc['query']=_[_0xf8c0('0x37')](_0xb98a9d[_0xf8c0('0x38')]);_0x3ab5fc['filters']=_[_0xf8c0('0x39')](_0x3ab5fc[_0xf8c0('0x34')],_0x3ab5fc[_0xf8c0('0x38')]);_0x37c162[_0xf8c0('0x3a')]=_[_0xf8c0('0x39')](_0x3ab5fc[_0xf8c0('0x34')],qs[_0xf8c0('0x3b')](_0xb98a9d[_0xf8c0('0x38')]['fields']));_0x37c162['attributes']=_0x37c162[_0xf8c0('0x3a')][_0xf8c0('0x3c')]?_0x37c162[_0xf8c0('0x3a')]:_0x3ab5fc[_0xf8c0('0x34')];if(!_0xb98a9d[_0xf8c0('0x38')]['hasOwnProperty'](_0xf8c0('0x3d'))){_0x37c162['limit']=qs[_0xf8c0('0x3e')](_0xb98a9d[_0xf8c0('0x38')][_0xf8c0('0x3e')]);_0x37c162['offset']=qs['offset'](_0xb98a9d[_0xf8c0('0x38')][_0xf8c0('0x1e')]);}_0x37c162[_0xf8c0('0x3f')]=qs[_0xf8c0('0x40')](_0xb98a9d[_0xf8c0('0x38')][_0xf8c0('0x40')]);_0x37c162[_0xf8c0('0x41')]=qs[_0xf8c0('0x42')](_[_0xf8c0('0x43')](_0xb98a9d[_0xf8c0('0x38')],_0x3ab5fc['filters']),_0x41ef4b);if(_0xb98a9d[_0xf8c0('0x38')][_0xf8c0('0x44')]){_0x37c162[_0xf8c0('0x41')]=_[_0xf8c0('0x45')](_0x37c162[_0xf8c0('0x41')],{'$or':_[_0xf8c0('0x35')](_0x41ef4b,function(_0x3d88f3){if(_0x3d88f3[_0xf8c0('0x32')]!=='VIRTUAL'){var _0x4296ec={};_0x4296ec[_0x3d88f3[_0xf8c0('0x36')]]={'$like':'%'+_0xb98a9d[_0xf8c0('0x38')]['filter']+'%'};return _0x4296ec;}})});}_0x37c162=_[_0xf8c0('0x45')]({},_0x37c162,_0xb98a9d[_0xf8c0('0x46')]);var _0x32fb30={'where':_0x37c162[_0xf8c0('0x41')]};return db[_0xf8c0('0x2f')][_0xf8c0('0x20')](_0x32fb30)[_0xf8c0('0x26')](function(_0x165d17){_0x28cdab[_0xf8c0('0x20')]=_0x165d17;if(_0xb98a9d[_0xf8c0('0x38')]['includeAll']){_0x37c162[_0xf8c0('0x47')]=[{'all':!![]}];}return db['OpenchannelQueue'][_0xf8c0('0x48')](_0x37c162);})['then'](function(_0x2130ef){_0x28cdab[_0xf8c0('0x49')]=_0x2130ef;return _0x28cdab;})[_0xf8c0('0x26')](respondWithFilteredResult(_0x1bc299,_0x37c162))[_0xf8c0('0x4a')](handleError(_0x1bc299,null));};exports['show']=function(_0x1a178f,_0x5f0880){var _0x47a314={'raw':!![],'where':{'id':_0x1a178f[_0xf8c0('0x4b')]['id']}},_0x425c6f={};_0x425c6f[_0xf8c0('0x34')]=_[_0xf8c0('0x37')](db[_0xf8c0('0x2f')][_0xf8c0('0x30')]);_0x425c6f[_0xf8c0('0x38')]=_[_0xf8c0('0x37')](_0x1a178f[_0xf8c0('0x38')]);_0x425c6f[_0xf8c0('0x42')]=_[_0xf8c0('0x39')](_0x425c6f[_0xf8c0('0x34')],_0x425c6f[_0xf8c0('0x38')]);_0x47a314['attributes']=_[_0xf8c0('0x39')](_0x425c6f[_0xf8c0('0x34')],qs['fields'](_0x1a178f[_0xf8c0('0x38')]['fields']));_0x47a314['attributes']=_0x47a314[_0xf8c0('0x3a')]['length']?_0x47a314[_0xf8c0('0x3a')]:_0x425c6f['model'];if(_0x1a178f[_0xf8c0('0x38')]['includeAll']){_0x47a314[_0xf8c0('0x47')]=[{'all':!![]}];}_0x47a314=_[_0xf8c0('0x45')]({},_0x47a314,_0x1a178f[_0xf8c0('0x46')]);return db[_0xf8c0('0x2f')][_0xf8c0('0x4c')](_0x47a314)[_0xf8c0('0x26')](handleEntityNotFound(_0x5f0880,null))[_0xf8c0('0x26')](respondWithResult(_0x5f0880,null))['catch'](handleError(_0x5f0880,null));};exports[_0xf8c0('0x4d')]=function(_0xb43431,_0x597e93){return db['OpenchannelQueue'][_0xf8c0('0x4d')](_0xb43431[_0xf8c0('0x4e')],{})['then'](function(_0x3f1786){var _0x1bb05a=_0xb43431[_0xf8c0('0x4f')][_0xf8c0('0x28')]({'plain':!![]});if(!_0x1bb05a)throw new Error(_0xf8c0('0x50'));if(_0x1bb05a['role']==='user'){var _0x572a63=_0x3f1786[_0xf8c0('0x28')]({'plain':!![]});var _0x3d5dc2='OpenchannelQueues';return db[_0xf8c0('0x51')][_0xf8c0('0x4c')]({'where':{'name':_0x3d5dc2,'userProfileId':_0x1bb05a['userProfileId']},'raw':!![]})[_0xf8c0('0x26')](function(_0x118ddf){if(_0x118ddf&&_0x118ddf[_0xf8c0('0x52')]===0x0){return db[_0xf8c0('0x2a')][_0xf8c0('0x4d')]({'name':_0x572a63[_0xf8c0('0x36')],'resourceId':_0x572a63['id'],'type':_0x118ddf[_0xf8c0('0x36')],'sectionId':_0x118ddf['id']},{})[_0xf8c0('0x26')](function(){return _0x3f1786;});}else{return _0x3f1786;}})[_0xf8c0('0x4a')](function(_0x283206){logger['error'](_0xf8c0('0x53'),_0x283206);throw _0x283206;});}return _0x3f1786;})[_0xf8c0('0x26')](respondWithResult(_0x597e93,0xc9))[_0xf8c0('0x4a')](handleError(_0x597e93,null));};exports[_0xf8c0('0x25')]=function(_0x50d8fb,_0x137a89){if(_0x50d8fb['body']['id']){delete _0x50d8fb[_0xf8c0('0x4e')]['id'];}return db[_0xf8c0('0x2f')][_0xf8c0('0x4c')]({'where':{'id':_0x50d8fb[_0xf8c0('0x4b')]['id']}})['then'](handleEntityNotFound(_0x137a89,null))['then'](saveUpdates(_0x50d8fb[_0xf8c0('0x4e')],null))[_0xf8c0('0x26')](respondWithResult(_0x137a89,null))[_0xf8c0('0x4a')](handleError(_0x137a89,null));};exports[_0xf8c0('0x27')]=function(_0x142bc6,_0x3110b9){return db['OpenchannelQueue'][_0xf8c0('0x4c')]({'where':{'id':_0x142bc6[_0xf8c0('0x4b')]['id']}})['then'](handleEntityNotFound(_0x3110b9,null))[_0xf8c0('0x26')](removeEntity(_0x3110b9,null))[_0xf8c0('0x4a')](handleError(_0x3110b9,null));};exports['describe']=function(_0x341c44,_0x5be731){return db['OpenchannelQueue'][_0xf8c0('0x54')]()[_0xf8c0('0x26')](respondWithResult(_0x5be731,null))[_0xf8c0('0x4a')](handleError(_0x5be731,null));};exports['getMembers']=function(_0x374ba0,_0xe238d1,_0x2a95a3){var _0x31e135={'raw':!![],'where':{}},_0x331f34={},_0x326f8a;return db[_0xf8c0('0x2f')][_0xf8c0('0x55')]({'where':{'id':_0x374ba0[_0xf8c0('0x4b')]['id']}})[_0xf8c0('0x26')](handleEntityNotFound(_0xe238d1,null))['then'](function(_0x3094c1){if(_0x3094c1){_0x326f8a=_0x3094c1[_0xf8c0('0x28')]({'plain':!![]});_0x331f34[_0xf8c0('0x34')]=_[_0xf8c0('0x37')](db[_0xf8c0('0x56')][_0xf8c0('0x30')]);_0x331f34[_0xf8c0('0x38')]=_['keys'](_0x374ba0['query']);_0x331f34[_0xf8c0('0x42')]=_['intersection'](_0x331f34['model'],_0x331f34['query']);_0x31e135[_0xf8c0('0x3a')]=_[_0xf8c0('0x39')](_0x331f34[_0xf8c0('0x34')],qs[_0xf8c0('0x3b')](_0x374ba0['query']['fields']));_0x31e135[_0xf8c0('0x3a')]=_0x31e135[_0xf8c0('0x3a')][_0xf8c0('0x3c')]?_0x31e135[_0xf8c0('0x3a')]:_0x331f34[_0xf8c0('0x34')];if(!_0x374ba0[_0xf8c0('0x38')][_0xf8c0('0x57')](_0xf8c0('0x3d'))){_0x31e135[_0xf8c0('0x3e')]=qs[_0xf8c0('0x3e')](_0x374ba0[_0xf8c0('0x38')]['limit']);_0x31e135[_0xf8c0('0x1e')]=qs[_0xf8c0('0x1e')](_0x374ba0[_0xf8c0('0x38')][_0xf8c0('0x1e')]);}_0x31e135[_0xf8c0('0x3f')]=qs[_0xf8c0('0x40')](_0x374ba0[_0xf8c0('0x38')][_0xf8c0('0x40')]);_0x31e135[_0xf8c0('0x41')]=qs['filters'](_[_0xf8c0('0x43')](_0x374ba0[_0xf8c0('0x38')],_0x331f34[_0xf8c0('0x42')]));_0x31e135[_0xf8c0('0x41')][_0xf8c0('0x58')]=_0x3094c1['id'];if(_0x374ba0[_0xf8c0('0x38')][_0xf8c0('0x44')]){_0x31e135[_0xf8c0('0x41')]=_['merge'](_0x31e135['where'],{'$or':_[_0xf8c0('0x35')](_0x31e135[_0xf8c0('0x3a')],function(_0x3abc35){var _0x4f6a29={};_0x4f6a29[_0x3abc35]={'$like':'%'+_0x374ba0[_0xf8c0('0x38')][_0xf8c0('0x44')]+'%'};return _0x4f6a29;})});}_0x31e135=_[_0xf8c0('0x45')]({},_0x31e135,_0x374ba0[_0xf8c0('0x46')]);return db[_0xf8c0('0x56')][_0xf8c0('0x48')](_0x31e135);}})[_0xf8c0('0x26')](function(_0x2f4ec1){if(_0x2f4ec1){return db[_0xf8c0('0x59')]['findAndCountAll']({'where':{'id':_[_0xf8c0('0x35')](_0x2f4ec1,_0xf8c0('0x5a')),'role':_0xf8c0('0x5b')},'attributes':['id',_0xf8c0('0x36'),_0xf8c0('0x5c'),_0xf8c0('0x5d'),_0xf8c0('0x5e')]});}})[_0xf8c0('0x26')](function(_0x15f280){if(_0x15f280){return{'count':_0x15f280[_0xf8c0('0x20')],'rows':_['map'](_0x15f280[_0xf8c0('0x49')],function(_0x4d538b){return{'membername':_0x4d538b['name'],'UserId':_0x4d538b['id'],'queue_name':_0x326f8a['name'],'OpenchannelQueueId':_0x326f8a['id'],'interface':util[_0xf8c0('0x5f')](_0xf8c0('0x60'),_0xf8c0('0x61'),_0x4d538b['name']),'penalty':0x0,'paused':_0x4d538b['openchannelPause'],'createdAt':_0x4d538b['createdAt'],'updatedAt':_0x4d538b['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0xf8c0('0x26')](respondWithFilteredResult(_0xe238d1,_0x31e135))[_0xf8c0('0x4a')](handleError(_0xe238d1,null));};exports['getTeams']=function(_0x50519c,_0xaaed7d,_0x45e655){var _0x2bb7fe={};var _0x42184c={};var _0x3d9c3c;var _0xe2f86e;return db[_0xf8c0('0x2f')]['findOne']({'where':{'id':_0x50519c[_0xf8c0('0x4b')]['id']}})[_0xf8c0('0x26')](handleEntityNotFound(_0xaaed7d,null))[_0xf8c0('0x26')](function(_0x15ebdb){if(_0x15ebdb){_0x3d9c3c=_0x15ebdb;_0x42184c[_0xf8c0('0x34')]=_[_0xf8c0('0x37')](db[_0xf8c0('0x62')]['rawAttributes']);_0x42184c[_0xf8c0('0x38')]=_['keys'](_0x50519c[_0xf8c0('0x38')]);_0x42184c[_0xf8c0('0x42')]=_[_0xf8c0('0x39')](_0x42184c['model'],_0x42184c[_0xf8c0('0x38')]);_0x2bb7fe['attributes']=_[_0xf8c0('0x39')](_0x42184c[_0xf8c0('0x34')],qs[_0xf8c0('0x3b')](_0x50519c[_0xf8c0('0x38')][_0xf8c0('0x3b')]));_0x2bb7fe[_0xf8c0('0x3a')]=_0x2bb7fe[_0xf8c0('0x3a')][_0xf8c0('0x3c')]?_0x2bb7fe[_0xf8c0('0x3a')]:_0x42184c[_0xf8c0('0x34')];_0x2bb7fe[_0xf8c0('0x3f')]=qs[_0xf8c0('0x40')](_0x50519c[_0xf8c0('0x38')][_0xf8c0('0x40')]);_0x2bb7fe[_0xf8c0('0x41')]=qs[_0xf8c0('0x42')](_[_0xf8c0('0x43')](_0x50519c[_0xf8c0('0x38')],_0x42184c[_0xf8c0('0x42')]));if(_0x50519c[_0xf8c0('0x38')][_0xf8c0('0x44')]){_0x2bb7fe[_0xf8c0('0x41')]=_['merge'](_0x2bb7fe['where'],{'$or':_[_0xf8c0('0x35')](_0x2bb7fe[_0xf8c0('0x3a')],function(_0x256bdc){var _0x3de6da={};_0x3de6da[_0x256bdc]={'$like':'%'+_0x50519c[_0xf8c0('0x38')][_0xf8c0('0x44')]+'%'};return _0x3de6da;})});}_0x2bb7fe=_['merge']({},_0x2bb7fe,_0x50519c[_0xf8c0('0x46')]);return _0x3d9c3c[_0xf8c0('0x63')](_0x2bb7fe);}})['then'](function(_0x1391d3){if(_0x1391d3){_0xe2f86e=_0x1391d3['length'];if(!_0x50519c['query'][_0xf8c0('0x57')]('nolimit')){_0x2bb7fe['limit']=qs[_0xf8c0('0x3e')](_0x50519c[_0xf8c0('0x38')][_0xf8c0('0x3e')]);_0x2bb7fe[_0xf8c0('0x1e')]=qs[_0xf8c0('0x1e')](_0x50519c[_0xf8c0('0x38')][_0xf8c0('0x1e')]);}return _0x3d9c3c[_0xf8c0('0x63')](_0x2bb7fe);}})[_0xf8c0('0x26')](function(_0x153137){if(_0x153137){return _0x153137?{'count':_0xe2f86e,'rows':_0x153137}:null;}})['then'](respondWithResult(_0xaaed7d,null))['catch'](handleError(_0xaaed7d,null));};exports[_0xf8c0('0x64')]=function(_0x4385a9,_0x110aa8,_0x5e828d){var _0x2fe560=_0x4385a9[_0xf8c0('0x4e')][_0xf8c0('0x65')];return db['Team']['findAll']({'where':{'id':_0x2fe560},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id',_0xf8c0('0x36'),_0xf8c0('0x66'),'voicePause',_0xf8c0('0x67')],'raw':!![]}]})[_0xf8c0('0x26')](function(_0x391079){if(_0x391079){var _0x26b52e=_['flatMap'](_0x391079,function(_0x4e359a){var _0x55630e=_0x4e359a[_0xf8c0('0x28')]({'plain':!![]});return _0x55630e[_0xf8c0('0x68')];});return db[_0xf8c0('0x2f')]['find']({'where':{'id':_0x4385a9['params']['id']}})[_0xf8c0('0x26')](function(_0x3b1a1f){return db[_0xf8c0('0x69')][_0xf8c0('0x6a')](function(_0x19c798){return _0x3b1a1f[_0xf8c0('0x64')](_0x2fe560,{'transaction':_0x19c798})[_0xf8c0('0x26')](function(){return BPromise[_0xf8c0('0x6b')](_0x26b52e,function(_0x26f8a1){return db[_0xf8c0('0x56')][_0xf8c0('0x6c')]({'where':{'UserId':_0x26f8a1['id'],'OpenchannelQueueId':_0x4385a9[_0xf8c0('0x4b')]['id']},'transaction':_0x19c798});});})['then'](function(){_0x26b52e['forEach'](function(_0x389292){socket[_0xf8c0('0x6d')](_0xf8c0('0x6e'),{'UserId':_0x389292['id'],'OpenchannelQueueId':_0x3b1a1f['id']});});});});});}})[_0xf8c0('0x26')](respondWithStatusCode(_0x110aa8,null))['catch'](handleError(_0x110aa8,null));};exports['removeTeams']=function(_0x4c0044,_0x26c7f1,_0xdb9418){return db[_0xf8c0('0x62')]['findAll']({'where':{'id':_0x4c0044[_0xf8c0('0x38')][_0xf8c0('0x65')]},'attributes':['id'],'include':[{'model':db[_0xf8c0('0x59')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xf8c0('0x26')](handleEntityNotFound(_0x26c7f1,null))['then'](function(_0x4c655c){var _0x3ca09a=_[_0xf8c0('0x35')](_0x4c655c,'id');var _0x26f894=[];var _0x2983b0=[];var _0x1497df=squel[_0xf8c0('0x6f')]();_0x1497df['field'](_0xf8c0('0x70'))[_0xf8c0('0x71')](_0xf8c0('0x72'),'tq')[_0xf8c0('0x73')]('user_has_teams','ut',_0xf8c0('0x74'))[_0xf8c0('0x41')](_0xf8c0('0x75'),_0x4c0044['params']['id']);for(var _0x4c64da=0x0;_0x4c64da<_0x4c655c['length'];_0x4c64da+=0x1){let _0x313c83=_0x4c655c[_0x4c64da];for(var _0x160601=0x0;_0x160601<_0x313c83[_0xf8c0('0x68')]['length'];_0x160601+=0x1){let _0x23ff39=_0x313c83[_0xf8c0('0x68')][_0x160601];var _0x585e8c=_0x1497df[_0xf8c0('0x76')]();_0x585e8c['where']('ut.UserId\x20=\x20?',_0x23ff39['id']);_0x2983b0[_0xf8c0('0x77')](db[_0xf8c0('0x69')]['query'](_0x585e8c[_0xf8c0('0x78')](),{'type':db[_0xf8c0('0x69')][_0xf8c0('0x79')]['SELECT']})[_0xf8c0('0x26')](function(_0x5eba46){if(_0x5eba46[_0xf8c0('0x3c')]===0x1){return _0x23ff39['id'];}else{var _0x4a9ed5=_[_0xf8c0('0x7a')](_['map'](_0x5eba46,_0xf8c0('0x7b')),function(_0x55e60f){return _[_0xf8c0('0x7c')](_0x3ca09a,_0x55e60f);});if(_0x4a9ed5){return _0x23ff39['id'];}}}));}}return BPromise['all'](_0x2983b0)[_0xf8c0('0x26')](function(_0xe6d0d4){_0x26f894=_(_0x26f894)[_0xf8c0('0x7d')](_0xe6d0d4)[_0xf8c0('0x7e')]()[_0xf8c0('0x7f')]();return db[_0xf8c0('0x2f')][_0xf8c0('0x4c')]({'where':{'id':_0x4c0044['params']['id']}})[_0xf8c0('0x26')](function(_0x2511a6){return db['sequelize'][_0xf8c0('0x6a')](function(_0x1516e8){return _0x2511a6[_0xf8c0('0x80')](_0x4c0044['query'][_0xf8c0('0x65')],{'transaction':_0x1516e8})[_0xf8c0('0x26')](function(){if(!_[_0xf8c0('0x81')](_0x26f894)){return _0x2511a6[_0xf8c0('0x82')](_0x26f894,{'transaction':_0x1516e8});}})[_0xf8c0('0x26')](function(){_0x26f894['forEach'](function(_0x1206a5){socket[_0xf8c0('0x6d')](_0xf8c0('0x83'),{'UserId':_0x1206a5,'OpenchannelQueueId':_0x2511a6['id']});});});});});});})[_0xf8c0('0x26')](respondWithStatusCode(_0x26c7f1,null))['catch'](handleError(_0x26c7f1,null));};exports[_0xf8c0('0x84')]=function(_0x3c9d07,_0x199891,_0xbd3cef){return db[_0xf8c0('0x2f')][_0xf8c0('0x4c')]({'where':{'id':_0x3c9d07[_0xf8c0('0x4b')]['id']}})[_0xf8c0('0x26')](handleEntityNotFound(_0x199891,null))['then'](function(_0x527a2d){if(_0x527a2d){return _0x527a2d[_0xf8c0('0x84')](_0x3c9d07[_0xf8c0('0x4e')]['ids'],_[_0xf8c0('0x85')](_0x3c9d07[_0xf8c0('0x4e')],[_0xf8c0('0x65'),'id'])||{})[_0xf8c0('0x86')](function(_0x2a8e28){for(var _0x22dcfd=0x0;_0x22dcfd<_0x3c9d07['body'][_0xf8c0('0x65')][_0xf8c0('0x3c')];_0x22dcfd+=0x1){socket[_0xf8c0('0x6d')](_0xf8c0('0x6e'),{'UserId':Number(_0x3c9d07[_0xf8c0('0x4e')][_0xf8c0('0x65')][_0x22dcfd]),'OpenchannelQueueId':Number(_0x3c9d07[_0xf8c0('0x4b')]['id'])});}return _0x2a8e28;});}})[_0xf8c0('0x26')](respondWithResult(_0x199891,null))[_0xf8c0('0x4a')](handleError(_0x199891,null));};exports[_0xf8c0('0x82')]=function(_0x5e63f7,_0xcd1b07,_0x1ffc13){return db['OpenchannelQueue'][_0xf8c0('0x4c')]({'where':{'id':_0x5e63f7[_0xf8c0('0x4b')]['id']}})[_0xf8c0('0x26')](handleEntityNotFound(_0xcd1b07,null))['then'](function(_0xa2fdca){if(_0xa2fdca){return _0xa2fdca[_0xf8c0('0x82')](_0x5e63f7[_0xf8c0('0x38')][_0xf8c0('0x65')])[_0xf8c0('0x26')](function(){if(_[_0xf8c0('0x87')](_0x5e63f7[_0xf8c0('0x38')][_0xf8c0('0x65')])){for(var _0x3df3d7=0x0;_0x3df3d7<_0x5e63f7[_0xf8c0('0x38')][_0xf8c0('0x65')][_0xf8c0('0x3c')];_0x3df3d7+=0x1){socket[_0xf8c0('0x6d')](_0xf8c0('0x83'),{'UserId':Number(_0x5e63f7[_0xf8c0('0x38')]['ids'][_0x3df3d7]),'OpenchannelQueueId':Number(_0x5e63f7[_0xf8c0('0x4b')]['id'])});}}else{socket['emit'](_0xf8c0('0x83'),{'UserId':Number(_0x5e63f7[_0xf8c0('0x38')][_0xf8c0('0x65')]),'OpenchannelQueueId':Number(_0x5e63f7[_0xf8c0('0x4b')]['id'])});}});}})[_0xf8c0('0x26')](respondWithStatusCode(_0xcd1b07,null))['catch'](handleError(_0xcd1b07,null));};exports[_0xf8c0('0x88')]=function(_0x5457ac,_0xa49a91,_0x367ab1){var _0x396533={};var _0x57a5c7={};var _0x3cf54f;var _0x43b817;return db[_0xf8c0('0x2f')][_0xf8c0('0x55')]({'where':{'id':_0x5457ac[_0xf8c0('0x4b')]['id']}})[_0xf8c0('0x26')](handleEntityNotFound(_0xa49a91,null))['then'](function(_0x1055d1){if(_0x1055d1){_0x3cf54f=_0x1055d1;_0x57a5c7[_0xf8c0('0x34')]=_[_0xf8c0('0x37')](db[_0xf8c0('0x59')][_0xf8c0('0x30')]);_0x57a5c7[_0xf8c0('0x38')]=_[_0xf8c0('0x37')](_0x5457ac[_0xf8c0('0x38')]);_0x57a5c7[_0xf8c0('0x42')]=_[_0xf8c0('0x39')](_0x57a5c7[_0xf8c0('0x34')],_0x57a5c7['query']);_0x396533[_0xf8c0('0x3a')]=_['intersection'](_0x57a5c7[_0xf8c0('0x34')],qs[_0xf8c0('0x3b')](_0x5457ac[_0xf8c0('0x38')][_0xf8c0('0x3b')]));_0x396533[_0xf8c0('0x3a')]=_0x396533[_0xf8c0('0x3a')]['length']?_0x396533[_0xf8c0('0x3a')]:_0x57a5c7[_0xf8c0('0x34')];_0x396533[_0xf8c0('0x3f')]=qs[_0xf8c0('0x40')](_0x5457ac[_0xf8c0('0x38')]['sort']);_0x396533[_0xf8c0('0x41')]=qs[_0xf8c0('0x42')](_[_0xf8c0('0x43')](_0x5457ac[_0xf8c0('0x38')],_0x57a5c7['filters']));if(_0x5457ac[_0xf8c0('0x38')][_0xf8c0('0x44')]){_0x396533['where']=_[_0xf8c0('0x45')](_0x396533['where'],{'$or':_[_0xf8c0('0x35')](_0x396533[_0xf8c0('0x3a')],function(_0x46123e){var _0x4e3524={};_0x4e3524[_0x46123e]={'$like':'%'+_0x5457ac[_0xf8c0('0x38')][_0xf8c0('0x44')]+'%'};return _0x4e3524;})});}_0x396533=_['merge']({},_0x396533,_0x5457ac[_0xf8c0('0x46')]);return _0x3cf54f[_0xf8c0('0x88')](_0x396533);}})[_0xf8c0('0x26')](function(_0x2d3c41){if(_0x2d3c41){_0x43b817=_0x2d3c41[_0xf8c0('0x3c')];if(!_0x5457ac[_0xf8c0('0x38')][_0xf8c0('0x57')]('nolimit')){_0x396533['limit']=qs[_0xf8c0('0x3e')](_0x5457ac[_0xf8c0('0x38')][_0xf8c0('0x3e')]);_0x396533[_0xf8c0('0x1e')]=qs[_0xf8c0('0x1e')](_0x5457ac[_0xf8c0('0x38')][_0xf8c0('0x1e')]);}return _0x3cf54f[_0xf8c0('0x88')](_0x396533);}})[_0xf8c0('0x26')](function(_0x26ebf8){if(_0x26ebf8){return _0x26ebf8?{'count':_0x43b817,'rows':_0x26ebf8}:null;}})[_0xf8c0('0x26')](respondWithResult(_0xa49a91,null))[_0xf8c0('0x4a')](handleError(_0xa49a91,null));}; \ No newline at end of file +var _0x586a=['../../config/utils','../../config/environment','../../mysqldb','defaults','socket.io-emitter','redis','./openchannelQueue.socket','register','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','UserProfileResource','name','send','index','map','OpenchannelQueue','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','pick','filter','where','VIRTUAL','merge','include','findAll','rows','catch','params','options','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','OpenchannelQueues','userProfileId','autoAssociation','error','describe','findOne','UserOpenchannelQueue','hasOwnProperty','order','OpenchannelQueueId','User','findAndCountAll','UserId','agent','openchannelPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','addTeams','ids','Team','Agents','online','voicePause','flatMap','transaction','findOrCreate','forEach','removeTeams','field','from','team_has_openchannel_queues','user_has_teams','OpenchannelQueueId\x20=\x20?','clone','push','sequelize','toString','QueryTypes','SELECT','every','includes','all','compact','value','isEmpty','removeAgents','userOpenchannelQueue:remove','addAgents','omit','spread','emit','userOpenchannelQueue:save','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api'];(function(_0x2af29a,_0x21fd79){var _0x38d79=function(_0x22f591){while(--_0x22f591){_0x2af29a['push'](_0x2af29a['shift']());}};_0x38d79(++_0x21fd79);}(_0x586a,0x77));var _0xa586=function(_0x6ddae,_0x312d18){_0x6ddae=_0x6ddae-0x0;var _0x33889d=_0x586a[_0x6ddae];return _0x33889d;};'use strict';var emlformat=require(_0xa586('0x0'));var rimraf=require(_0xa586('0x1'));var zipdir=require(_0xa586('0x2'));var jsonpatch=require(_0xa586('0x3'));var rp=require(_0xa586('0x4'));var moment=require(_0xa586('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xa586('0x6'));var util=require(_0xa586('0x7'));var path=require(_0xa586('0x8'));var sox=require(_0xa586('0x9'));var csv=require(_0xa586('0xa'));var ejs=require(_0xa586('0xb'));var fs=require('fs');var fs_extra=require(_0xa586('0xc'));var _=require('lodash');var squel=require(_0xa586('0xd'));var crypto=require(_0xa586('0xe'));var jsforce=require(_0xa586('0xf'));var deskjs=require(_0xa586('0x10'));var toCsv=require(_0xa586('0xa'));var querystring=require(_0xa586('0x11'));var Papa=require(_0xa586('0x12'));var Redis=require(_0xa586('0x13'));var authService=require(_0xa586('0x14'));var qs=require(_0xa586('0x15'));var as=require(_0xa586('0x16'));var hardwareService=require(_0xa586('0x17'));var logger=require(_0xa586('0x18'))(_0xa586('0x19'));var utils=require(_0xa586('0x1a'));var config=require(_0xa586('0x1b'));var licenseUtil=require('../../config/license/util');var db=require(_0xa586('0x1c'))['db'];config['redis']=_[_0xa586('0x1d')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xa586('0x1e'))(new Redis(config[_0xa586('0x1f')]));require(_0xa586('0x20'))[_0xa586('0x21')](socket);function respondWithStatusCode(_0x17d914,_0x17ccbb){_0x17ccbb=_0x17ccbb||0xcc;return function(_0x2e0012){if(_0x2e0012){return _0x17d914[_0xa586('0x22')](_0x17ccbb);}return _0x17d914[_0xa586('0x23')](_0x17ccbb)[_0xa586('0x24')]();};}function respondWithResult(_0x47a256,_0x3ddd99){_0x3ddd99=_0x3ddd99||0xc8;return function(_0x12174b){if(_0x12174b){return _0x47a256[_0xa586('0x23')](_0x3ddd99)[_0xa586('0x25')](_0x12174b);}};}function respondWithFilteredResult(_0x9432e4,_0x26dfd5){return function(_0x2c2627){if(_0x2c2627){var _0x478f28=typeof _0x26dfd5[_0xa586('0x26')]===_0xa586('0x27')&&typeof _0x26dfd5['limit']===_0xa586('0x27');var _0x241410=_0x2c2627[_0xa586('0x28')];var _0x287172=_0x478f28?0x0:_0x26dfd5['offset'];var _0x5768f3=_0x478f28?_0x2c2627[_0xa586('0x28')]:_0x26dfd5[_0xa586('0x26')]+_0x26dfd5[_0xa586('0x29')];var _0x179d30;if(_0x5768f3>=_0x241410){_0x5768f3=_0x241410;_0x179d30=0xc8;}else{_0x179d30=0xce;}_0x9432e4['status'](_0x179d30);return _0x9432e4[_0xa586('0x2a')](_0xa586('0x2b'),_0x287172+'-'+_0x5768f3+'/'+_0x241410)['json'](_0x2c2627);}return null;};}function patchUpdates(_0x284176){return function(_0x32d3bc){try{jsonpatch[_0xa586('0x2c')](_0x32d3bc,_0x284176,!![]);}catch(_0x17cf02){return BPromise[_0xa586('0x2d')](_0x17cf02);}return _0x32d3bc[_0xa586('0x2e')]();};}function saveUpdates(_0x234a57,_0x1bc0c3){return function(_0x2e12a7){if(_0x2e12a7){return _0x2e12a7[_0xa586('0x2f')](_0x234a57)[_0xa586('0x30')](function(_0x24cc3e){return _0x24cc3e;});}return null;};}function removeEntity(_0x151056,_0x479e4d){return function(_0x55e164){if(_0x55e164){return _0x55e164[_0xa586('0x31')]()['then'](function(){var _0x3b57cc=_0x55e164['get']({'plain':!![]});var _0x65db12='OpenchannelQueues';return db[_0xa586('0x32')][_0xa586('0x31')]({'where':{'type':_0x65db12,'resourceId':_0x3b57cc['id']}})[_0xa586('0x30')](function(){return _0x55e164;});})[_0xa586('0x30')](function(){_0x151056[_0xa586('0x23')](0xcc)[_0xa586('0x24')]();});}};}function handleEntityNotFound(_0x26d214,_0x209e62){return function(_0x2668d6){if(!_0x2668d6){_0x26d214[_0xa586('0x22')](0x194);}return _0x2668d6;};}function handleError(_0x376512,_0x1c260d){_0x1c260d=_0x1c260d||0x1f4;return function(_0x4b7c82){logger['error'](_0x4b7c82['stack']);if(_0x4b7c82['name']){delete _0x4b7c82[_0xa586('0x33')];}_0x376512[_0xa586('0x23')](_0x1c260d)[_0xa586('0x34')](_0x4b7c82);};}exports[_0xa586('0x35')]=function(_0x3a388c,_0x1bb31c){var _0x42365b={},_0x1fff99={},_0x1eccd5={'count':0x0,'rows':[]};var _0x20aeaf=_[_0xa586('0x36')](db[_0xa586('0x37')][_0xa586('0x38')],function(_0x42485d){return{'name':_0x42485d['fieldName'],'type':_0x42485d[_0xa586('0x39')][_0xa586('0x3a')]};});_0x1fff99[_0xa586('0x3b')]=_[_0xa586('0x36')](_0x20aeaf,_0xa586('0x33'));_0x1fff99[_0xa586('0x3c')]=_[_0xa586('0x3d')](_0x3a388c['query']);_0x1fff99[_0xa586('0x3e')]=_[_0xa586('0x3f')](_0x1fff99[_0xa586('0x3b')],_0x1fff99[_0xa586('0x3c')]);_0x42365b[_0xa586('0x40')]=_[_0xa586('0x3f')](_0x1fff99[_0xa586('0x3b')],qs[_0xa586('0x41')](_0x3a388c[_0xa586('0x3c')][_0xa586('0x41')]));_0x42365b['attributes']=_0x42365b[_0xa586('0x40')][_0xa586('0x42')]?_0x42365b[_0xa586('0x40')]:_0x1fff99[_0xa586('0x3b')];if(!_0x3a388c[_0xa586('0x3c')]['hasOwnProperty'](_0xa586('0x43'))){_0x42365b['limit']=qs['limit'](_0x3a388c[_0xa586('0x3c')][_0xa586('0x29')]);_0x42365b['offset']=qs['offset'](_0x3a388c[_0xa586('0x3c')][_0xa586('0x26')]);}_0x42365b['order']=qs[_0xa586('0x44')](_0x3a388c[_0xa586('0x3c')][_0xa586('0x44')]);_0x42365b['where']=qs[_0xa586('0x3e')](_[_0xa586('0x45')](_0x3a388c['query'],_0x1fff99['filters']),_0x20aeaf);if(_0x3a388c['query'][_0xa586('0x46')]){_0x42365b['where']=_['merge'](_0x42365b[_0xa586('0x47')],{'$or':_[_0xa586('0x36')](_0x20aeaf,function(_0x3bab3c){if(_0x3bab3c[_0xa586('0x39')]!==_0xa586('0x48')){var _0x4a063d={};_0x4a063d[_0x3bab3c['name']]={'$like':'%'+_0x3a388c[_0xa586('0x3c')][_0xa586('0x46')]+'%'};return _0x4a063d;}})});}_0x42365b=_[_0xa586('0x49')]({},_0x42365b,_0x3a388c['options']);var _0x1458ff={'where':_0x42365b['where']};return db[_0xa586('0x37')][_0xa586('0x28')](_0x1458ff)[_0xa586('0x30')](function(_0x58843f){_0x1eccd5[_0xa586('0x28')]=_0x58843f;if(_0x3a388c['query']['includeAll']){_0x42365b[_0xa586('0x4a')]=[{'all':!![]}];}return db[_0xa586('0x37')][_0xa586('0x4b')](_0x42365b);})[_0xa586('0x30')](function(_0x36a176){_0x1eccd5[_0xa586('0x4c')]=_0x36a176;return _0x1eccd5;})['then'](respondWithFilteredResult(_0x1bb31c,_0x42365b))[_0xa586('0x4d')](handleError(_0x1bb31c,null));};exports['show']=function(_0x4d2400,_0x325281){var _0x2a3a22={'raw':!![],'where':{'id':_0x4d2400[_0xa586('0x4e')]['id']}},_0x480085={};_0x480085[_0xa586('0x3b')]=_['keys'](db[_0xa586('0x37')][_0xa586('0x38')]);_0x480085['query']=_['keys'](_0x4d2400[_0xa586('0x3c')]);_0x480085['filters']=_[_0xa586('0x3f')](_0x480085[_0xa586('0x3b')],_0x480085[_0xa586('0x3c')]);_0x2a3a22[_0xa586('0x40')]=_[_0xa586('0x3f')](_0x480085[_0xa586('0x3b')],qs[_0xa586('0x41')](_0x4d2400['query'][_0xa586('0x41')]));_0x2a3a22['attributes']=_0x2a3a22[_0xa586('0x40')]['length']?_0x2a3a22[_0xa586('0x40')]:_0x480085[_0xa586('0x3b')];if(_0x4d2400[_0xa586('0x3c')]['includeAll']){_0x2a3a22[_0xa586('0x4a')]=[{'all':!![]}];}_0x2a3a22=_[_0xa586('0x49')]({},_0x2a3a22,_0x4d2400[_0xa586('0x4f')]);return db['OpenchannelQueue'][_0xa586('0x50')](_0x2a3a22)[_0xa586('0x30')](handleEntityNotFound(_0x325281,null))[_0xa586('0x30')](respondWithResult(_0x325281,null))[_0xa586('0x4d')](handleError(_0x325281,null));};exports[_0xa586('0x51')]=function(_0x346f4c,_0x204701){return db['OpenchannelQueue']['create'](_0x346f4c[_0xa586('0x52')],{})[_0xa586('0x30')](function(_0x41de25){var _0xb3787=_0x346f4c[_0xa586('0x53')][_0xa586('0x54')]({'plain':!![]});if(!_0xb3787)throw new Error(_0xa586('0x55'));if(_0xb3787[_0xa586('0x56')]===_0xa586('0x53')){var _0x36a4cc=_0x41de25[_0xa586('0x54')]({'plain':!![]});var _0x284ae6=_0xa586('0x57');return db['UserProfileSection'][_0xa586('0x50')]({'where':{'name':_0x284ae6,'userProfileId':_0xb3787[_0xa586('0x58')]},'raw':!![]})[_0xa586('0x30')](function(_0x27a720){if(_0x27a720&&_0x27a720[_0xa586('0x59')]===0x0){return db[_0xa586('0x32')][_0xa586('0x51')]({'name':_0x36a4cc[_0xa586('0x33')],'resourceId':_0x36a4cc['id'],'type':_0x27a720[_0xa586('0x33')],'sectionId':_0x27a720['id']},{})['then'](function(){return _0x41de25;});}else{return _0x41de25;}})[_0xa586('0x4d')](function(_0x24cad9){logger[_0xa586('0x5a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x24cad9);throw _0x24cad9;});}return _0x41de25;})[_0xa586('0x30')](respondWithResult(_0x204701,0xc9))['catch'](handleError(_0x204701,null));};exports['update']=function(_0x1cc018,_0x4e0efc){if(_0x1cc018['body']['id']){delete _0x1cc018[_0xa586('0x52')]['id'];}return db[_0xa586('0x37')][_0xa586('0x50')]({'where':{'id':_0x1cc018[_0xa586('0x4e')]['id']}})['then'](handleEntityNotFound(_0x4e0efc,null))['then'](saveUpdates(_0x1cc018[_0xa586('0x52')],null))['then'](respondWithResult(_0x4e0efc,null))[_0xa586('0x4d')](handleError(_0x4e0efc,null));};exports['destroy']=function(_0x4703ab,_0x321e63){return db['OpenchannelQueue'][_0xa586('0x50')]({'where':{'id':_0x4703ab[_0xa586('0x4e')]['id']}})[_0xa586('0x30')](handleEntityNotFound(_0x321e63,null))[_0xa586('0x30')](removeEntity(_0x321e63,null))[_0xa586('0x4d')](handleError(_0x321e63,null));};exports['describe']=function(_0x5a43dd,_0xd2f92f){return db[_0xa586('0x37')][_0xa586('0x5b')]()[_0xa586('0x30')](respondWithResult(_0xd2f92f,null))[_0xa586('0x4d')](handleError(_0xd2f92f,null));};exports['getMembers']=function(_0x4e0de7,_0x1a3aaa,_0x2aba21){var _0x3a4176={'raw':!![],'where':{}},_0x3fe9ce={},_0x1cae11;return db['OpenchannelQueue'][_0xa586('0x5c')]({'where':{'id':_0x4e0de7[_0xa586('0x4e')]['id']}})[_0xa586('0x30')](handleEntityNotFound(_0x1a3aaa,null))['then'](function(_0x3a2b4a){if(_0x3a2b4a){_0x1cae11=_0x3a2b4a[_0xa586('0x54')]({'plain':!![]});_0x3fe9ce[_0xa586('0x3b')]=_[_0xa586('0x3d')](db[_0xa586('0x5d')][_0xa586('0x38')]);_0x3fe9ce[_0xa586('0x3c')]=_[_0xa586('0x3d')](_0x4e0de7['query']);_0x3fe9ce[_0xa586('0x3e')]=_[_0xa586('0x3f')](_0x3fe9ce[_0xa586('0x3b')],_0x3fe9ce[_0xa586('0x3c')]);_0x3a4176[_0xa586('0x40')]=_['intersection'](_0x3fe9ce['model'],qs[_0xa586('0x41')](_0x4e0de7[_0xa586('0x3c')][_0xa586('0x41')]));_0x3a4176[_0xa586('0x40')]=_0x3a4176['attributes']['length']?_0x3a4176[_0xa586('0x40')]:_0x3fe9ce[_0xa586('0x3b')];if(!_0x4e0de7[_0xa586('0x3c')][_0xa586('0x5e')]('nolimit')){_0x3a4176[_0xa586('0x29')]=qs['limit'](_0x4e0de7[_0xa586('0x3c')][_0xa586('0x29')]);_0x3a4176[_0xa586('0x26')]=qs[_0xa586('0x26')](_0x4e0de7[_0xa586('0x3c')]['offset']);}_0x3a4176[_0xa586('0x5f')]=qs[_0xa586('0x44')](_0x4e0de7[_0xa586('0x3c')][_0xa586('0x44')]);_0x3a4176[_0xa586('0x47')]=qs[_0xa586('0x3e')](_[_0xa586('0x45')](_0x4e0de7[_0xa586('0x3c')],_0x3fe9ce['filters']));_0x3a4176[_0xa586('0x47')][_0xa586('0x60')]=_0x3a2b4a['id'];if(_0x4e0de7[_0xa586('0x3c')][_0xa586('0x46')]){_0x3a4176[_0xa586('0x47')]=_[_0xa586('0x49')](_0x3a4176[_0xa586('0x47')],{'$or':_[_0xa586('0x36')](_0x3a4176['attributes'],function(_0x90ce09){var _0x4e8771={};_0x4e8771[_0x90ce09]={'$like':'%'+_0x4e0de7[_0xa586('0x3c')][_0xa586('0x46')]+'%'};return _0x4e8771;})});}_0x3a4176=_[_0xa586('0x49')]({},_0x3a4176,_0x4e0de7[_0xa586('0x4f')]);return db[_0xa586('0x5d')][_0xa586('0x4b')](_0x3a4176);}})[_0xa586('0x30')](function(_0x55fb9e){if(_0x55fb9e){return db[_0xa586('0x61')][_0xa586('0x62')]({'where':{'id':_[_0xa586('0x36')](_0x55fb9e,_0xa586('0x63')),'role':_0xa586('0x64')},'attributes':['id',_0xa586('0x33'),_0xa586('0x65'),_0xa586('0x66'),_0xa586('0x67')]});}})[_0xa586('0x30')](function(_0x5358ad){if(_0x5358ad){return{'count':_0x5358ad[_0xa586('0x28')],'rows':_[_0xa586('0x36')](_0x5358ad[_0xa586('0x4c')],function(_0xc9841f){return{'membername':_0xc9841f['name'],'UserId':_0xc9841f['id'],'queue_name':_0x1cae11[_0xa586('0x33')],'OpenchannelQueueId':_0x1cae11['id'],'interface':util[_0xa586('0x68')](_0xa586('0x69'),_0xa586('0x6a'),_0xc9841f[_0xa586('0x33')]),'penalty':0x0,'paused':_0xc9841f[_0xa586('0x65')],'createdAt':_0xc9841f[_0xa586('0x67')],'updatedAt':_0xc9841f[_0xa586('0x66')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xa586('0x30')](respondWithFilteredResult(_0x1a3aaa,_0x3a4176))[_0xa586('0x4d')](handleError(_0x1a3aaa,null));};exports[_0xa586('0x6b')]=function(_0x53bc48,_0x235182,_0x108b41){var _0x3f1810={};var _0x266cf4={};var _0x7af81;var _0x356106;return db[_0xa586('0x37')][_0xa586('0x5c')]({'where':{'id':_0x53bc48['params']['id']}})[_0xa586('0x30')](handleEntityNotFound(_0x235182,null))[_0xa586('0x30')](function(_0x3f6e78){if(_0x3f6e78){_0x7af81=_0x3f6e78;_0x266cf4[_0xa586('0x3b')]=_[_0xa586('0x3d')](db['Team'][_0xa586('0x38')]);_0x266cf4['query']=_[_0xa586('0x3d')](_0x53bc48['query']);_0x266cf4['filters']=_[_0xa586('0x3f')](_0x266cf4[_0xa586('0x3b')],_0x266cf4[_0xa586('0x3c')]);_0x3f1810['attributes']=_[_0xa586('0x3f')](_0x266cf4[_0xa586('0x3b')],qs['fields'](_0x53bc48[_0xa586('0x3c')][_0xa586('0x41')]));_0x3f1810[_0xa586('0x40')]=_0x3f1810[_0xa586('0x40')][_0xa586('0x42')]?_0x3f1810['attributes']:_0x266cf4[_0xa586('0x3b')];_0x3f1810[_0xa586('0x5f')]=qs[_0xa586('0x44')](_0x53bc48[_0xa586('0x3c')]['sort']);_0x3f1810[_0xa586('0x47')]=qs[_0xa586('0x3e')](_[_0xa586('0x45')](_0x53bc48['query'],_0x266cf4[_0xa586('0x3e')]));if(_0x53bc48[_0xa586('0x3c')][_0xa586('0x46')]){_0x3f1810[_0xa586('0x47')]=_[_0xa586('0x49')](_0x3f1810[_0xa586('0x47')],{'$or':_[_0xa586('0x36')](_0x3f1810['attributes'],function(_0x3dc4ed){var _0x2a37ef={};_0x2a37ef[_0x3dc4ed]={'$like':'%'+_0x53bc48[_0xa586('0x3c')][_0xa586('0x46')]+'%'};return _0x2a37ef;})});}_0x3f1810=_[_0xa586('0x49')]({},_0x3f1810,_0x53bc48[_0xa586('0x4f')]);return _0x7af81[_0xa586('0x6b')](_0x3f1810);}})[_0xa586('0x30')](function(_0x3dcc66){if(_0x3dcc66){_0x356106=_0x3dcc66[_0xa586('0x42')];if(!_0x53bc48[_0xa586('0x3c')]['hasOwnProperty']('nolimit')){_0x3f1810[_0xa586('0x29')]=qs[_0xa586('0x29')](_0x53bc48[_0xa586('0x3c')][_0xa586('0x29')]);_0x3f1810[_0xa586('0x26')]=qs['offset'](_0x53bc48['query'][_0xa586('0x26')]);}return _0x7af81[_0xa586('0x6b')](_0x3f1810);}})[_0xa586('0x30')](function(_0x5bd513){if(_0x5bd513){return _0x5bd513?{'count':_0x356106,'rows':_0x5bd513}:null;}})['then'](respondWithResult(_0x235182,null))[_0xa586('0x4d')](handleError(_0x235182,null));};exports[_0xa586('0x6c')]=function(_0xefc86f,_0x2fcc24,_0x15f1be){var _0x21cda0=_0xefc86f[_0xa586('0x52')][_0xa586('0x6d')];return db[_0xa586('0x6e')]['findAll']({'where':{'id':_0x21cda0},'attributes':['id'],'include':[{'model':db['User'],'as':_0xa586('0x6f'),'attributes':['id',_0xa586('0x33'),_0xa586('0x70'),_0xa586('0x71'),'interface'],'raw':!![]}]})['then'](function(_0xd958ae){if(_0xd958ae){var _0x3aec3f=_[_0xa586('0x72')](_0xd958ae,function(_0x26683b){var _0x5ac6ca=_0x26683b[_0xa586('0x54')]({'plain':!![]});return _0x5ac6ca['Agents'];});return db[_0xa586('0x37')][_0xa586('0x50')]({'where':{'id':_0xefc86f['params']['id']}})[_0xa586('0x30')](function(_0x55f53e){return db['sequelize'][_0xa586('0x73')](function(_0x297b81){return _0x55f53e[_0xa586('0x6c')](_0x21cda0,{'transaction':_0x297b81})[_0xa586('0x30')](function(){return BPromise['each'](_0x3aec3f,function(_0x4417fc){return db[_0xa586('0x5d')][_0xa586('0x74')]({'where':{'UserId':_0x4417fc['id'],'OpenchannelQueueId':_0xefc86f[_0xa586('0x4e')]['id']},'transaction':_0x297b81});});})[_0xa586('0x30')](function(){_0x3aec3f[_0xa586('0x75')](function(_0x286d80){socket['emit']('userOpenchannelQueue:save',{'UserId':_0x286d80['id'],'OpenchannelQueueId':_0x55f53e['id']});});});});});}})[_0xa586('0x30')](respondWithStatusCode(_0x2fcc24,null))['catch'](handleError(_0x2fcc24,null));};exports[_0xa586('0x76')]=function(_0x1efaf5,_0x41cff1,_0x2db2cb){return db[_0xa586('0x6e')][_0xa586('0x4b')]({'where':{'id':_0x1efaf5['query'][_0xa586('0x6d')]},'attributes':['id'],'include':[{'model':db[_0xa586('0x61')],'as':_0xa586('0x6f'),'attributes':['id'],'raw':!![]}]})[_0xa586('0x30')](handleEntityNotFound(_0x41cff1,null))[_0xa586('0x30')](function(_0x4b164e){var _0x1f1705=_[_0xa586('0x36')](_0x4b164e,'id');var _0x13734b=[];var _0x58086f=[];var _0x297a97=squel['select']();_0x297a97[_0xa586('0x77')]('tq.TeamId')[_0xa586('0x78')](_0xa586('0x79'),'tq')['join'](_0xa586('0x7a'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0xa586('0x47')](_0xa586('0x7b'),_0x1efaf5['params']['id']);for(var _0x14b677=0x0;_0x14b677<_0x4b164e['length'];_0x14b677+=0x1){let _0x117b23=_0x4b164e[_0x14b677];for(var _0x57bee1=0x0;_0x57bee1<_0x117b23['Agents'][_0xa586('0x42')];_0x57bee1+=0x1){let _0x5cedf3=_0x117b23['Agents'][_0x57bee1];var _0x21f9f6=_0x297a97[_0xa586('0x7c')]();_0x21f9f6['where']('ut.UserId\x20=\x20?',_0x5cedf3['id']);_0x58086f[_0xa586('0x7d')](db[_0xa586('0x7e')][_0xa586('0x3c')](_0x21f9f6[_0xa586('0x7f')](),{'type':db['sequelize'][_0xa586('0x80')][_0xa586('0x81')]})['then'](function(_0x2fdbbf){if(_0x2fdbbf[_0xa586('0x42')]===0x1){return _0x5cedf3['id'];}else{var _0x4e2811=_[_0xa586('0x82')](_['map'](_0x2fdbbf,'TeamId'),function(_0x208228){return _[_0xa586('0x83')](_0x1f1705,_0x208228);});if(_0x4e2811){return _0x5cedf3['id'];}}}));}}return BPromise[_0xa586('0x84')](_0x58086f)[_0xa586('0x30')](function(_0x11a72e){_0x13734b=_(_0x13734b)['union'](_0x11a72e)[_0xa586('0x85')]()[_0xa586('0x86')]();return db[_0xa586('0x37')][_0xa586('0x50')]({'where':{'id':_0x1efaf5[_0xa586('0x4e')]['id']}})[_0xa586('0x30')](function(_0xa5571f){return db[_0xa586('0x7e')][_0xa586('0x73')](function(_0xfafd84){return _0xa5571f[_0xa586('0x76')](_0x1efaf5[_0xa586('0x3c')]['ids'],{'transaction':_0xfafd84})[_0xa586('0x30')](function(){if(!_[_0xa586('0x87')](_0x13734b)){return _0xa5571f[_0xa586('0x88')](_0x13734b,{'transaction':_0xfafd84});}})[_0xa586('0x30')](function(){_0x13734b['forEach'](function(_0x245184){socket['emit'](_0xa586('0x89'),{'UserId':_0x245184,'OpenchannelQueueId':_0xa5571f['id']});});});});});});})[_0xa586('0x30')](respondWithStatusCode(_0x41cff1,null))[_0xa586('0x4d')](handleError(_0x41cff1,null));};exports[_0xa586('0x8a')]=function(_0x5becf7,_0x48c74e,_0x52078e){return db[_0xa586('0x37')][_0xa586('0x50')]({'where':{'id':_0x5becf7['params']['id']}})['then'](handleEntityNotFound(_0x48c74e,null))[_0xa586('0x30')](function(_0x512a0d){if(_0x512a0d){return _0x512a0d['addAgents'](_0x5becf7[_0xa586('0x52')][_0xa586('0x6d')],_[_0xa586('0x8b')](_0x5becf7[_0xa586('0x52')],['ids','id'])||{})[_0xa586('0x8c')](function(_0x55fd0f){for(var _0x585b1f=0x0;_0x585b1f<_0x5becf7[_0xa586('0x52')]['ids'][_0xa586('0x42')];_0x585b1f+=0x1){socket[_0xa586('0x8d')](_0xa586('0x8e'),{'UserId':Number(_0x5becf7[_0xa586('0x52')]['ids'][_0x585b1f]),'OpenchannelQueueId':Number(_0x5becf7[_0xa586('0x4e')]['id'])});}return _0x55fd0f;});}})[_0xa586('0x30')](respondWithResult(_0x48c74e,null))[_0xa586('0x4d')](handleError(_0x48c74e,null));};exports[_0xa586('0x88')]=function(_0x55360a,_0x597a81,_0x556614){return db[_0xa586('0x37')][_0xa586('0x50')]({'where':{'id':_0x55360a[_0xa586('0x4e')]['id']}})[_0xa586('0x30')](handleEntityNotFound(_0x597a81,null))['then'](function(_0x10e5d6){if(_0x10e5d6){return _0x10e5d6[_0xa586('0x88')](_0x55360a[_0xa586('0x3c')][_0xa586('0x6d')])[_0xa586('0x30')](function(){if(_[_0xa586('0x8f')](_0x55360a[_0xa586('0x3c')]['ids'])){for(var _0x1b247b=0x0;_0x1b247b<_0x55360a['query']['ids'][_0xa586('0x42')];_0x1b247b+=0x1){socket['emit']('userOpenchannelQueue:remove',{'UserId':Number(_0x55360a[_0xa586('0x3c')][_0xa586('0x6d')][_0x1b247b]),'OpenchannelQueueId':Number(_0x55360a[_0xa586('0x4e')]['id'])});}}else{socket[_0xa586('0x8d')](_0xa586('0x89'),{'UserId':Number(_0x55360a[_0xa586('0x3c')][_0xa586('0x6d')]),'OpenchannelQueueId':Number(_0x55360a[_0xa586('0x4e')]['id'])});}});}})[_0xa586('0x30')](respondWithStatusCode(_0x597a81,null))[_0xa586('0x4d')](handleError(_0x597a81,null));};exports[_0xa586('0x90')]=function(_0x9ec1cd,_0x149319,_0x1cbac3){var _0x4de130={};var _0x113321={};var _0x1cf3b1;var _0x1cccc8;return db[_0xa586('0x37')][_0xa586('0x5c')]({'where':{'id':_0x9ec1cd['params']['id']}})[_0xa586('0x30')](handleEntityNotFound(_0x149319,null))[_0xa586('0x30')](function(_0x74e164){if(_0x74e164){_0x1cf3b1=_0x74e164;_0x113321['model']=_[_0xa586('0x3d')](db['User'][_0xa586('0x38')]);_0x113321[_0xa586('0x3c')]=_['keys'](_0x9ec1cd[_0xa586('0x3c')]);_0x113321[_0xa586('0x3e')]=_['intersection'](_0x113321[_0xa586('0x3b')],_0x113321[_0xa586('0x3c')]);_0x4de130[_0xa586('0x40')]=_[_0xa586('0x3f')](_0x113321[_0xa586('0x3b')],qs['fields'](_0x9ec1cd[_0xa586('0x3c')][_0xa586('0x41')]));_0x4de130[_0xa586('0x40')]=_0x4de130[_0xa586('0x40')][_0xa586('0x42')]?_0x4de130[_0xa586('0x40')]:_0x113321[_0xa586('0x3b')];_0x4de130[_0xa586('0x5f')]=qs[_0xa586('0x44')](_0x9ec1cd[_0xa586('0x3c')]['sort']);_0x4de130[_0xa586('0x47')]=qs[_0xa586('0x3e')](_['pick'](_0x9ec1cd[_0xa586('0x3c')],_0x113321['filters']));if(_0x9ec1cd['query']['filter']){_0x4de130['where']=_[_0xa586('0x49')](_0x4de130[_0xa586('0x47')],{'$or':_[_0xa586('0x36')](_0x4de130[_0xa586('0x40')],function(_0x3c1206){var _0x52ca39={};_0x52ca39[_0x3c1206]={'$like':'%'+_0x9ec1cd['query'][_0xa586('0x46')]+'%'};return _0x52ca39;})});}_0x4de130=_[_0xa586('0x49')]({},_0x4de130,_0x9ec1cd[_0xa586('0x4f')]);return _0x1cf3b1[_0xa586('0x90')](_0x4de130);}})[_0xa586('0x30')](function(_0x20dd77){if(_0x20dd77){_0x1cccc8=_0x20dd77['length'];if(!_0x9ec1cd[_0xa586('0x3c')][_0xa586('0x5e')](_0xa586('0x43'))){_0x4de130['limit']=qs[_0xa586('0x29')](_0x9ec1cd[_0xa586('0x3c')][_0xa586('0x29')]);_0x4de130['offset']=qs['offset'](_0x9ec1cd[_0xa586('0x3c')]['offset']);}return _0x1cf3b1['getAgents'](_0x4de130);}})[_0xa586('0x30')](function(_0x57ff7e){if(_0x57ff7e){return _0x57ff7e?{'count':_0x1cccc8,'rows':_0x57ff7e}:null;}})[_0xa586('0x30')](respondWithResult(_0x149319,null))[_0xa586('0x4d')](handleError(_0x149319,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index a1d0be1..34e6d4a 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 _0x2219=['setMaxListeners','save','remove','emit','hasOwnProperty','hook','exports','events','OpenchannelQueue'];(function(_0x2e8450,_0x1e44a8){var _0x2edce7=function(_0x525300){while(--_0x525300){_0x2e8450['push'](_0x2e8450['shift']());}};_0x2edce7(++_0x1e44a8);}(_0x2219,0xc4));var _0x9221=function(_0x2fe689,_0x5794e5){_0x2fe689=_0x2fe689-0x0;var _0x35ea44=_0x2219[_0x2fe689];return _0x35ea44;};'use strict';var EventEmitter=require(_0x9221('0x0'));var OpenchannelQueue=require('../../mysqldb')['db'][_0x9221('0x1')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0x9221('0x2')](0x0);var events={'afterCreate':_0x9221('0x3'),'afterUpdate':'update','afterDestroy':_0x9221('0x4')};function emitEvent(_0x192360){return function(_0x2e5a85,_0x2538e,_0x2c51de){OpenchannelQueueEvents['emit'](_0x192360+':'+_0x2e5a85['id'],_0x2e5a85);OpenchannelQueueEvents[_0x9221('0x5')](_0x192360,_0x2e5a85);_0x2c51de(null);};}for(var e in events){if(events[_0x9221('0x6')](e)){var event=events[e];OpenchannelQueue[_0x9221('0x7')](e,emitEvent(event));}}module[_0x9221('0x8')]=OpenchannelQueueEvents; \ No newline at end of file +var _0x95d3=['emit','hasOwnProperty','hook','exports','events','OpenchannelQueue','setMaxListeners','save','update','remove'];(function(_0x43776a,_0x4eb74c){var _0x18eb8f=function(_0x319afb){while(--_0x319afb){_0x43776a['push'](_0x43776a['shift']());}};_0x18eb8f(++_0x4eb74c);}(_0x95d3,0x126));var _0x395d=function(_0x53bf29,_0x1d05f1){_0x53bf29=_0x53bf29-0x0;var _0xd7eecd=_0x95d3[_0x53bf29];return _0xd7eecd;};'use strict';var EventEmitter=require(_0x395d('0x0'));var OpenchannelQueue=require('../../mysqldb')['db'][_0x395d('0x1')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0x395d('0x2')](0x0);var events={'afterCreate':_0x395d('0x3'),'afterUpdate':_0x395d('0x4'),'afterDestroy':_0x395d('0x5')};function emitEvent(_0x17b3b3){return function(_0x3c4252,_0x388ba5,_0x22c05d){OpenchannelQueueEvents[_0x395d('0x6')](_0x17b3b3+':'+_0x3c4252['id'],_0x3c4252);OpenchannelQueueEvents[_0x395d('0x6')](_0x17b3b3,_0x3c4252);_0x22c05d(null);};}for(var e in events){if(events[_0x395d('0x7')](e)){var event=events[e];OpenchannelQueue[_0x395d('0x8')](e,emitEvent(event));}}module[_0x395d('0x9')]=OpenchannelQueueEvents; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.model.js b/server/api/openchannelQueue/openchannelQueue.model.js index 46cde70..2a3a9c1 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 _0xf1f6=['moment','request-promise','path','rimraf','../../config/environment','./openchannelQueue.attributes','define','openchannel_queues','lodash','util','../../config/logger','api'];(function(_0x49b207,_0x408ade){var _0x2dc8fa=function(_0x150975){while(--_0x150975){_0x49b207['push'](_0x49b207['shift']());}};_0x2dc8fa(++_0x408ade);}(_0xf1f6,0x164));var _0x6f1f=function(_0x4db0d5,_0x97e02a){_0x4db0d5=_0x4db0d5-0x0;var _0x14064b=_0xf1f6[_0x4db0d5];return _0x14064b;};'use strict';var _=require(_0x6f1f('0x0'));var util=require(_0x6f1f('0x1'));var logger=require(_0x6f1f('0x2'))(_0x6f1f('0x3'));var moment=require(_0x6f1f('0x4'));var BPromise=require('bluebird');var rp=require(_0x6f1f('0x5'));var fs=require('fs');var path=require(_0x6f1f('0x6'));var rimraf=require(_0x6f1f('0x7'));var config=require(_0x6f1f('0x8'));var attributes=require(_0x6f1f('0x9'));module['exports']=function(_0x156d25,_0x4818e4){return _0x156d25[_0x6f1f('0xa')]('OpenchannelQueue',attributes,{'tableName':_0x6f1f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x884f=['moment','bluebird','rimraf','../../config/environment','./openchannelQueue.attributes','exports','define','OpenchannelQueue','openchannel_queues','lodash','../../config/logger','api'];(function(_0x1d3c9e,_0x258d5b){var _0x17c826=function(_0x40d8f7){while(--_0x40d8f7){_0x1d3c9e['push'](_0x1d3c9e['shift']());}};_0x17c826(++_0x258d5b);}(_0x884f,0x81));var _0xf884=function(_0x3a58e9,_0x320aeb){_0x3a58e9=_0x3a58e9-0x0;var _0x5bda87=_0x884f[_0x3a58e9];return _0x5bda87;};'use strict';var _=require(_0xf884('0x0'));var util=require('util');var logger=require(_0xf884('0x1'))(_0xf884('0x2'));var moment=require(_0xf884('0x3'));var BPromise=require(_0xf884('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xf884('0x5'));var config=require(_0xf884('0x6'));var attributes=require(_0xf884('0x7'));module[_0xf884('0x8')]=function(_0x632c10,_0x4de21f){return _0x632c10[_0xf884('0x9')](_0xf884('0xa'),attributes,{'tableName':_0xf884('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.rpc.js b/server/api/openchannelQueue/openchannelQueue.rpc.js index 76938ec..37fc14e 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 _0x568a=['../../config/logger','rpc','../../config/environment','client','http','redis','localhost','./openchannelQueue.socket','register','request','then','OpenchannelQueue,\x20%s,\x20%s','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','catch','OpenchannelQueue','findAll','options','raw','limit','map','include','model','attributes','GetOpenchannelQueue','stringify','ShowOpenchannelQueue','find','where','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x406427,_0x413a81){var _0x5244f0=function(_0x2b000f){while(--_0x2b000f){_0x406427['push'](_0x406427['shift']());}};_0x5244f0(++_0x413a81);}(_0x568a,0x1c6));var _0xa568=function(_0x50007c,_0x1cbf11){_0x50007c=_0x50007c-0x0;var _0x5c1ec7=_0x568a[_0x50007c];return _0x5c1ec7;};'use strict';var _=require(_0xa568('0x0'));var util=require(_0xa568('0x1'));var moment=require(_0xa568('0x2'));var BPromise=require(_0xa568('0x3'));var rs=require(_0xa568('0x4'));var fs=require('fs');var Redis=require(_0xa568('0x5'));var db=require(_0xa568('0x6'))['db'];var utils=require(_0xa568('0x7'));var logger=require(_0xa568('0x8'))(_0xa568('0x9'));var config=require(_0xa568('0xa'));var jayson=require('jayson/promise');var client=jayson[_0xa568('0xb')][_0xa568('0xc')]({'port':0x232a});config[_0xa568('0xd')]=_['defaults'](config[_0xa568('0xd')],{'host':_0xa568('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa568('0xd')]));require(_0xa568('0xf'))[_0xa568('0x10')](socket);function respondWithRpcPromise(_0x251514,_0x21843f,_0x2b6705){return new BPromise(function(_0x48c706,_0x4cd73a){return client[_0xa568('0x11')](_0x251514,_0x2b6705)[_0xa568('0x12')](function(_0x476d98){logger['info'](_0xa568('0x13'),_0x21843f,'request\x20sent');logger[_0xa568('0x14')](_0xa568('0x15'),_0x21843f,_0xa568('0x16'),JSON['stringify'](_0x476d98));if(_0x476d98['error']){if(_0x476d98[_0xa568('0x17')][_0xa568('0x18')]===0x1f4){logger[_0xa568('0x17')](_0xa568('0x13'),_0x21843f,_0x476d98[_0xa568('0x17')][_0xa568('0x19')]);return _0x4cd73a(_0x476d98[_0xa568('0x17')][_0xa568('0x19')]);}logger[_0xa568('0x17')](_0xa568('0x13'),_0x21843f,_0x476d98[_0xa568('0x17')][_0xa568('0x19')]);return _0x48c706(_0x476d98[_0xa568('0x17')][_0xa568('0x19')]);}else{logger[_0xa568('0x1a')]('OpenchannelQueue,\x20%s,\x20%s',_0x21843f,_0xa568('0x16'));_0x48c706(_0x476d98['result'][_0xa568('0x19')]);}})[_0xa568('0x1b')](function(_0x36d108){logger['error'](_0xa568('0x13'),_0x21843f,_0x36d108);_0x4cd73a(_0x36d108);});});}exports['GetOpenchannelQueue']=function(_0xe155ea){var _0x32bfa8=this;return new Promise(function(_0x2d82b3,_0x3400c3){return db[_0xa568('0x1c')][_0xa568('0x1d')]({'raw':_0xe155ea[_0xa568('0x1e')]?_0xe155ea[_0xa568('0x1e')][_0xa568('0x1f')]===undefined?!![]:![]:!![],'where':_0xe155ea[_0xa568('0x1e')]?_0xe155ea[_0xa568('0x1e')]['where']||null:null,'attributes':_0xe155ea['options']?_0xe155ea[_0xa568('0x1e')]['attributes']||null:null,'limit':_0xe155ea[_0xa568('0x1e')]?_0xe155ea[_0xa568('0x1e')][_0xa568('0x20')]||null:null,'include':_0xe155ea['options']?_0xe155ea[_0xa568('0x1e')]['include']?_[_0xa568('0x21')](_0xe155ea[_0xa568('0x1e')][_0xa568('0x22')],function(_0x402f5e){return{'model':db[_0x402f5e[_0xa568('0x23')]],'as':_0x402f5e['as'],'attributes':_0x402f5e[_0xa568('0x24')],'include':_0x402f5e[_0xa568('0x22')]?_[_0xa568('0x21')](_0x402f5e[_0xa568('0x22')],function(_0x3fa258){return{'model':db[_0x3fa258['model']],'as':_0x3fa258['as'],'attributes':_0x3fa258[_0xa568('0x24')],'include':_0x3fa258[_0xa568('0x22')]?_[_0xa568('0x21')](_0x3fa258[_0xa568('0x22')],function(_0x59baf5){return{'model':db[_0x59baf5[_0xa568('0x23')]],'as':_0x59baf5['as'],'attributes':_0x59baf5[_0xa568('0x24')]};}):[]};}):[]};}):[]:[]})[_0xa568('0x12')](function(_0x2ab186){logger[_0xa568('0x1a')]('GetOpenchannelQueue',_0xe155ea);logger['debug'](_0xa568('0x25'),_0xe155ea,JSON[_0xa568('0x26')](_0x2ab186));_0x2d82b3(_0x2ab186);})[_0xa568('0x1b')](function(_0x502554){logger['error'](_0xa568('0x25'),_0x502554[_0xa568('0x19')],_0xe155ea);_0x3400c3(_0x32bfa8[_0xa568('0x17')](0x1f4,_0x502554[_0xa568('0x19')]));});});};exports[_0xa568('0x27')]=function(_0x2f6529){var _0x4e7d2c=this;return new Promise(function(_0x49e11b,_0x1a7dcb){return db[_0xa568('0x1c')][_0xa568('0x28')]({'raw':_0x2f6529['options']?_0x2f6529[_0xa568('0x1e')][_0xa568('0x1f')]===undefined?!![]:![]:!![],'where':_0x2f6529[_0xa568('0x1e')]?_0x2f6529[_0xa568('0x1e')][_0xa568('0x29')]||null:null,'attributes':_0x2f6529[_0xa568('0x1e')]?_0x2f6529[_0xa568('0x1e')][_0xa568('0x24')]||null:null,'include':_0x2f6529[_0xa568('0x1e')]?_0x2f6529['options'][_0xa568('0x22')]?_[_0xa568('0x21')](_0x2f6529[_0xa568('0x1e')][_0xa568('0x22')],function(_0x4e6a48){return{'model':db[_0x4e6a48[_0xa568('0x23')]],'as':_0x4e6a48['as'],'attributes':_0x4e6a48[_0xa568('0x24')],'include':_0x4e6a48['include']?_[_0xa568('0x21')](_0x4e6a48[_0xa568('0x22')],function(_0x2eef60){return{'model':db[_0x2eef60[_0xa568('0x23')]],'as':_0x2eef60['as'],'attributes':_0x2eef60['attributes'],'include':_0x2eef60['include']?_[_0xa568('0x21')](_0x2eef60['include'],function(_0x48dca0){return{'model':db[_0x48dca0[_0xa568('0x23')]],'as':_0x48dca0['as'],'attributes':_0x48dca0[_0xa568('0x24')]};}):[]};}):[]};}):[]:[]})[_0xa568('0x12')](function(_0x59318f){logger[_0xa568('0x1a')](_0xa568('0x27'),_0x2f6529);logger['debug'](_0xa568('0x27'),_0x2f6529,JSON[_0xa568('0x26')](_0x59318f));_0x49e11b(_0x59318f);})[_0xa568('0x1b')](function(_0xeafb0c){logger[_0xa568('0x17')](_0xa568('0x27'),_0xeafb0c[_0xa568('0x19')],_0x2f6529);_0x1a7dcb(_0x4e7d2c[_0xa568('0x17')](0x1f4,_0xeafb0c[_0xa568('0x19')]));});});}; \ No newline at end of file +var _0x986d=['map','model','attributes','then','ShowOpenchannelQueue','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./openchannelQueue.socket','register','info','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','GetOpenchannelQueue','OpenchannelQueue','findAll','options','raw','where','include'];(function(_0x141c88,_0x1e1412){var _0x319ad3=function(_0x2ec83d){while(--_0x2ec83d){_0x141c88['push'](_0x141c88['shift']());}};_0x319ad3(++_0x1e1412);}(_0x986d,0x77));var _0xd986=function(_0x8320e8,_0x26030f){_0x8320e8=_0x8320e8-0x0;var _0xd04d0=_0x986d[_0x8320e8];return _0xd04d0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xd986('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd986('0x1'));var db=require(_0xd986('0x2'))['db'];var utils=require(_0xd986('0x3'));var logger=require(_0xd986('0x4'))('rpc');var config=require(_0xd986('0x5'));var jayson=require(_0xd986('0x6'));var client=jayson[_0xd986('0x7')][_0xd986('0x8')]({'port':0x232a});config[_0xd986('0x9')]=_[_0xd986('0xa')](config[_0xd986('0x9')],{'host':_0xd986('0xb'),'port':0x18eb});var socket=require(_0xd986('0xc'))(new Redis(config['redis']));require(_0xd986('0xd'))[_0xd986('0xe')](socket);function respondWithRpcPromise(_0x365553,_0x1ef635,_0x1a5171){return new BPromise(function(_0x2f9d6b,_0xb5a1b){return client['request'](_0x365553,_0x1a5171)['then'](function(_0xda7de){logger[_0xd986('0xf')](_0xd986('0x10'),_0x1ef635,_0xd986('0x11'));logger[_0xd986('0x12')](_0xd986('0x13'),_0x1ef635,_0xd986('0x11'),JSON[_0xd986('0x14')](_0xda7de));if(_0xda7de['error']){if(_0xda7de['error'][_0xd986('0x15')]===0x1f4){logger[_0xd986('0x16')](_0xd986('0x10'),_0x1ef635,_0xda7de[_0xd986('0x16')][_0xd986('0x17')]);return _0xb5a1b(_0xda7de[_0xd986('0x16')][_0xd986('0x17')]);}logger[_0xd986('0x16')](_0xd986('0x10'),_0x1ef635,_0xda7de['error']['message']);return _0x2f9d6b(_0xda7de[_0xd986('0x16')][_0xd986('0x17')]);}else{logger[_0xd986('0xf')]('OpenchannelQueue,\x20%s,\x20%s',_0x1ef635,_0xd986('0x11'));_0x2f9d6b(_0xda7de[_0xd986('0x18')][_0xd986('0x17')]);}})[_0xd986('0x19')](function(_0x1e8e8a){logger['error'](_0xd986('0x10'),_0x1ef635,_0x1e8e8a);_0xb5a1b(_0x1e8e8a);});});}exports[_0xd986('0x1a')]=function(_0xcada25){var _0x4d1aee=this;return new Promise(function(_0x555401,_0x2f1d30){return db[_0xd986('0x1b')][_0xd986('0x1c')]({'raw':_0xcada25[_0xd986('0x1d')]?_0xcada25[_0xd986('0x1d')][_0xd986('0x1e')]===undefined?!![]:![]:!![],'where':_0xcada25['options']?_0xcada25[_0xd986('0x1d')][_0xd986('0x1f')]||null:null,'attributes':_0xcada25[_0xd986('0x1d')]?_0xcada25[_0xd986('0x1d')]['attributes']||null:null,'limit':_0xcada25[_0xd986('0x1d')]?_0xcada25[_0xd986('0x1d')]['limit']||null:null,'include':_0xcada25['options']?_0xcada25[_0xd986('0x1d')][_0xd986('0x20')]?_[_0xd986('0x21')](_0xcada25[_0xd986('0x1d')][_0xd986('0x20')],function(_0x56503b){return{'model':db[_0x56503b[_0xd986('0x22')]],'as':_0x56503b['as'],'attributes':_0x56503b[_0xd986('0x23')],'include':_0x56503b[_0xd986('0x20')]?_[_0xd986('0x21')](_0x56503b[_0xd986('0x20')],function(_0x27725f){return{'model':db[_0x27725f[_0xd986('0x22')]],'as':_0x27725f['as'],'attributes':_0x27725f[_0xd986('0x23')],'include':_0x27725f[_0xd986('0x20')]?_[_0xd986('0x21')](_0x27725f[_0xd986('0x20')],function(_0x177e09){return{'model':db[_0x177e09['model']],'as':_0x177e09['as'],'attributes':_0x177e09[_0xd986('0x23')]};}):[]};}):[]};}):[]:[]})[_0xd986('0x24')](function(_0x3b35a4){logger[_0xd986('0xf')]('GetOpenchannelQueue',_0xcada25);logger[_0xd986('0x12')](_0xd986('0x1a'),_0xcada25,JSON[_0xd986('0x14')](_0x3b35a4));_0x555401(_0x3b35a4);})['catch'](function(_0x331754){logger[_0xd986('0x16')](_0xd986('0x1a'),_0x331754[_0xd986('0x17')],_0xcada25);_0x2f1d30(_0x4d1aee[_0xd986('0x16')](0x1f4,_0x331754[_0xd986('0x17')]));});});};exports[_0xd986('0x25')]=function(_0x207f25){var _0x1fca91=this;return new Promise(function(_0x4be557,_0x52e94d){return db['OpenchannelQueue']['find']({'raw':_0x207f25[_0xd986('0x1d')]?_0x207f25[_0xd986('0x1d')][_0xd986('0x1e')]===undefined?!![]:![]:!![],'where':_0x207f25['options']?_0x207f25[_0xd986('0x1d')][_0xd986('0x1f')]||null:null,'attributes':_0x207f25[_0xd986('0x1d')]?_0x207f25[_0xd986('0x1d')]['attributes']||null:null,'include':_0x207f25[_0xd986('0x1d')]?_0x207f25[_0xd986('0x1d')]['include']?_[_0xd986('0x21')](_0x207f25[_0xd986('0x1d')][_0xd986('0x20')],function(_0x4a5cbd){return{'model':db[_0x4a5cbd[_0xd986('0x22')]],'as':_0x4a5cbd['as'],'attributes':_0x4a5cbd[_0xd986('0x23')],'include':_0x4a5cbd[_0xd986('0x20')]?_[_0xd986('0x21')](_0x4a5cbd[_0xd986('0x20')],function(_0x3beec7){return{'model':db[_0x3beec7['model']],'as':_0x3beec7['as'],'attributes':_0x3beec7[_0xd986('0x23')],'include':_0x3beec7[_0xd986('0x20')]?_[_0xd986('0x21')](_0x3beec7['include'],function(_0x39a598){return{'model':db[_0x39a598['model']],'as':_0x39a598['as'],'attributes':_0x39a598[_0xd986('0x23')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x39fa12){logger[_0xd986('0xf')]('ShowOpenchannelQueue',_0x207f25);logger[_0xd986('0x12')](_0xd986('0x25'),_0x207f25,JSON['stringify'](_0x39fa12));_0x4be557(_0x39fa12);})[_0xd986('0x19')](function(_0x56123f){logger['error'](_0xd986('0x25'),_0x56123f[_0xd986('0x17')],_0x207f25);_0x52e94d(_0x1fca91['error'](0x1f4,_0x56123f[_0xd986('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index 923f2a2..8019da8 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 _0x48e7=['length','remove','update','emit','removeListener','register'];(function(_0x37164c,_0xed71da){var _0x1da8ae=function(_0x14b5da){while(--_0x14b5da){_0x37164c['push'](_0x37164c['shift']());}};_0x1da8ae(++_0xed71da);}(_0x48e7,0x1db));var _0x748e=function(_0x4b2b6c,_0x2f1ab2){_0x4b2b6c=_0x4b2b6c-0x0;var _0x38ea4b=_0x48e7[_0x4b2b6c];return _0x38ea4b;};'use strict';var OpenchannelQueueEvents=require('./openchannelQueue.events');var events=['save',_0x748e('0x0'),_0x748e('0x1')];function createListener(_0xef995a,_0x3fae4e){return function(_0x37ed22){_0x3fae4e[_0x748e('0x2')](_0xef995a,_0x37ed22);};}function removeListener(_0x586485,_0x44e5c7){return function(){OpenchannelQueueEvents[_0x748e('0x3')](_0x586485,_0x44e5c7);};}exports[_0x748e('0x4')]=function(_0x5d51aa){for(var _0x3f21e7=0x0,_0x25228f=events[_0x748e('0x5')];_0x3f21e7<_0x25228f;_0x3f21e7++){var _0x53edb6=events[_0x3f21e7];var _0x313e39=createListener('openchannelQueue:'+_0x53edb6,_0x5d51aa);OpenchannelQueueEvents['on'](_0x53edb6,_0x313e39);}}; \ No newline at end of file +var _0x35a9=['./openchannelQueue.events','save','remove','emit','register','length','openchannelQueue:'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x35a9,0xe7));var _0x935a=function(_0x2c8c20,_0x295f94){_0x2c8c20=_0x2c8c20-0x0;var _0x11b8df=_0x35a9[_0x2c8c20];return _0x11b8df;};'use strict';var OpenchannelQueueEvents=require(_0x935a('0x0'));var events=[_0x935a('0x1'),_0x935a('0x2'),'update'];function createListener(_0x41fd18,_0x122ead){return function(_0x5c51a0){_0x122ead[_0x935a('0x3')](_0x41fd18,_0x5c51a0);};}function removeListener(_0x11164c,_0x7e1413){return function(){OpenchannelQueueEvents['removeListener'](_0x11164c,_0x7e1413);};}exports[_0x935a('0x4')]=function(_0x261356){for(var _0x16c3b6=0x0,_0x275f87=events[_0x935a('0x5')];_0x16c3b6<_0x275f87;_0x16c3b6++){var _0xbe858a=events[_0x16c3b6];var _0x40d58d=createListener(_0x935a('0x6')+_0xbe858a,_0x261356);OpenchannelQueueEvents['on'](_0xbe858a,_0x40d58d);}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index 7fbe4c2..11dcd89 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 _0x66a9=['isAuthenticated','describe','/:id','show','post','create','put','delete','destroy','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueueReport.controller','get','/describe'];(function(_0x291f8b,_0x3b5591){var _0x275171=function(_0xb33d67){while(--_0xb33d67){_0x291f8b['push'](_0x291f8b['shift']());}};_0x275171(++_0x3b5591);}(_0x66a9,0x16f));var _0x966a=function(_0x31688a,_0x588c7d){_0x31688a=_0x31688a-0x0;var _0xc7b088=_0x66a9[_0x31688a];return _0xc7b088;};'use strict';var multer=require(_0x966a('0x0'));var util=require(_0x966a('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x966a('0x2'));var router=express[_0x966a('0x3')]();var fs_extra=require(_0x966a('0x4'));var auth=require(_0x966a('0x5'));var interaction=require(_0x966a('0x6'));var config=require(_0x966a('0x7'));var controller=require(_0x966a('0x8'));router[_0x966a('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x966a('0x9')](_0x966a('0xa'),auth[_0x966a('0xb')](),controller[_0x966a('0xc')]);router[_0x966a('0x9')](_0x966a('0xd'),auth['isAuthenticated'](),controller[_0x966a('0xe')]);router[_0x966a('0xf')]('/',auth['isAuthenticated'](),controller[_0x966a('0x10')]);router[_0x966a('0x11')](_0x966a('0xd'),auth[_0x966a('0xb')](),controller['update']);router[_0x966a('0x12')]('/:id',auth[_0x966a('0xb')](),controller[_0x966a('0x13')]);module[_0x966a('0x14')]=router; \ No newline at end of file +var _0x0936=['multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./openchannelQueueReport.controller','isAuthenticated','index','describe','get','/:id','post','create','put','update','delete','destroy','exports'];(function(_0x35efc4,_0x3b7a25){var _0x5b5369=function(_0x32938a){while(--_0x32938a){_0x35efc4['push'](_0x35efc4['shift']());}};_0x5b5369(++_0x3b7a25);}(_0x0936,0x118));var _0x6093=function(_0x2aec86,_0x2f919a){_0x2aec86=_0x2aec86-0x0;var _0x103b5e=_0x0936[_0x2aec86];return _0x103b5e;};'use strict';var multer=require(_0x6093('0x0'));var util=require(_0x6093('0x1'));var path=require(_0x6093('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x6093('0x3')]();var fs_extra=require(_0x6093('0x4'));var auth=require(_0x6093('0x5'));var interaction=require(_0x6093('0x6'));var config=require('../../config/environment');var controller=require(_0x6093('0x7'));router['get']('/',auth[_0x6093('0x8')](),controller[_0x6093('0x9')]);router['get']('/describe',auth[_0x6093('0x8')](),controller[_0x6093('0xa')]);router[_0x6093('0xb')](_0x6093('0xc'),auth[_0x6093('0x8')](),controller['show']);router[_0x6093('0xd')]('/',auth[_0x6093('0x8')](),controller[_0x6093('0xe')]);router[_0x6093('0xf')](_0x6093('0xc'),auth[_0x6093('0x8')](),controller[_0x6093('0x10')]);router[_0x6093('0x11')]('/:id',auth[_0x6093('0x8')](),controller[_0x6093('0x12')]);module[_0x6093('0x13')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js b/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js index 083c64d..2370883 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 _0x2900=['sequelize','exports','STRING','DATE','moment'];(function(_0x5dcd17,_0x1614e1){var _0x59a412=function(_0x520e39){while(--_0x520e39){_0x5dcd17['push'](_0x5dcd17['shift']());}};_0x59a412(++_0x1614e1);}(_0x2900,0x108));var _0x0290=function(_0x2cc0b3,_0x120bf1){_0x2cc0b3=_0x2cc0b3-0x0;var _0x1667ef=_0x2900[_0x2cc0b3];return _0x1667ef;};'use strict';var moment=require(_0x0290('0x0'));var Sequelize=require(_0x0290('0x1'));module[_0x0290('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x0290('0x3')]},'joinAt':{'type':Sequelize[_0x0290('0x4')]},'leaveAt':{'type':Sequelize[_0x0290('0x4')]},'acceptAt':{'type':Sequelize[_0x0290('0x4')]},'exitAt':{'type':Sequelize[_0x0290('0x4')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x6599=['STRING','DATE','moment','sequelize','exports'];(function(_0x3ae8b7,_0x4f92f9){var _0x2c7ffd=function(_0x2de99e){while(--_0x2de99e){_0x3ae8b7['push'](_0x3ae8b7['shift']());}};_0x2c7ffd(++_0x4f92f9);}(_0x6599,0xa7));var _0x9659=function(_0x4e9274,_0x49576e){_0x4e9274=_0x4e9274-0x0;var _0x8b474c=_0x6599[_0x4e9274];return _0x8b474c;};'use strict';var moment=require(_0x9659('0x0'));var Sequelize=require(_0x9659('0x1'));module[_0x9659('0x2')]={'uniqueid':{'type':Sequelize[_0x9659('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x9659('0x3')]},'joinAt':{'type':Sequelize[_0x9659('0x4')]},'leaveAt':{'type':Sequelize[_0x9659('0x4')]},'acceptAt':{'type':Sequelize[_0x9659('0x4')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js index f6e9257..a1fa0a3 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 _0xcc4b=['find','create','body','params','describe','eml-format','rimraf','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','apply','reject','save','update','then','stack','name','index','OpenchannelQueueReport','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','keys'];(function(_0x47da7d,_0x1cefb6){var _0x2fe361=function(_0x152a45){while(--_0x152a45){_0x47da7d['push'](_0x47da7d['shift']());}};_0x2fe361(++_0x1cefb6);}(_0xcc4b,0x99));var _0xbcc4=function(_0x9b7a64,_0x38d4a8){_0x9b7a64=_0x9b7a64-0x0;var _0x33fd98=_0xcc4b[_0x9b7a64];return _0x33fd98;};'use strict';var emlformat=require(_0xbcc4('0x0'));var rimraf=require(_0xbcc4('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xbcc4('0x2'));var moment=require(_0xbcc4('0x3'));var BPromise=require(_0xbcc4('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0xbcc4('0x5'));var sox=require(_0xbcc4('0x6'));var csv=require(_0xbcc4('0x7'));var ejs=require(_0xbcc4('0x8'));var fs=require('fs');var fs_extra=require(_0xbcc4('0x9'));var _=require(_0xbcc4('0xa'));var squel=require(_0xbcc4('0xb'));var crypto=require(_0xbcc4('0xc'));var jsforce=require(_0xbcc4('0xd'));var deskjs=require(_0xbcc4('0xe'));var toCsv=require('to-csv');var querystring=require(_0xbcc4('0xf'));var Papa=require('papaparse');var Redis=require(_0xbcc4('0x10'));var authService=require(_0xbcc4('0x11'));var qs=require(_0xbcc4('0x12'));var as=require(_0xbcc4('0x13'));var hardwareService=require(_0xbcc4('0x14'));var logger=require(_0xbcc4('0x15'))(_0xbcc4('0x16'));var utils=require(_0xbcc4('0x17'));var config=require(_0xbcc4('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2bcd75,_0x58c738){_0x58c738=_0x58c738||0xcc;return function(_0x845960){if(_0x845960){return _0x2bcd75[_0xbcc4('0x19')](_0x58c738);}return _0x2bcd75[_0xbcc4('0x1a')](_0x58c738)[_0xbcc4('0x1b')]();};}function respondWithResult(_0x5d8538,_0x4bfad0){_0x4bfad0=_0x4bfad0||0xc8;return function(_0x2017f1){if(_0x2017f1){return _0x5d8538[_0xbcc4('0x1a')](_0x4bfad0)[_0xbcc4('0x1c')](_0x2017f1);}};}function respondWithFilteredResult(_0x3b44bf,_0x388be5){return function(_0x3f82ae){if(_0x3f82ae){var _0x8aa608=typeof _0x388be5[_0xbcc4('0x1d')]===_0xbcc4('0x1e')&&typeof _0x388be5['limit']===_0xbcc4('0x1e');var _0x1bce91=_0x3f82ae[_0xbcc4('0x1f')];var _0x5e3906=_0x8aa608?0x0:_0x388be5['offset'];var _0x5663a4=_0x8aa608?_0x3f82ae[_0xbcc4('0x1f')]:_0x388be5[_0xbcc4('0x1d')]+_0x388be5[_0xbcc4('0x20')];var _0x50812f;if(_0x5663a4>=_0x1bce91){_0x5663a4=_0x1bce91;_0x50812f=0xc8;}else{_0x50812f=0xce;}_0x3b44bf[_0xbcc4('0x1a')](_0x50812f);return _0x3b44bf['set'](_0xbcc4('0x21'),_0x5e3906+'-'+_0x5663a4+'/'+_0x1bce91)[_0xbcc4('0x1c')](_0x3f82ae);}return null;};}function patchUpdates(_0x5a78fc){return function(_0x4c0489){try{jsonpatch[_0xbcc4('0x22')](_0x4c0489,_0x5a78fc,!![]);}catch(_0x41fe95){return BPromise[_0xbcc4('0x23')](_0x41fe95);}return _0x4c0489[_0xbcc4('0x24')]();};}function saveUpdates(_0x240026,_0x2fca44){return function(_0x3ee842){if(_0x3ee842){return _0x3ee842[_0xbcc4('0x25')](_0x240026)[_0xbcc4('0x26')](function(_0x317a17){return _0x317a17;});}return null;};}function removeEntity(_0x44baed,_0x389b28){return function(_0x123383){if(_0x123383){return _0x123383['destroy']()[_0xbcc4('0x26')](function(){_0x44baed[_0xbcc4('0x1a')](0xcc)[_0xbcc4('0x1b')]();});}};}function handleEntityNotFound(_0x2021b3,_0x7946c){return function(_0x331e36){if(!_0x331e36){_0x2021b3[_0xbcc4('0x19')](0x194);}return _0x331e36;};}function handleError(_0x57ef11,_0x42126e){_0x42126e=_0x42126e||0x1f4;return function(_0x1ce704){logger['error'](_0x1ce704[_0xbcc4('0x27')]);if(_0x1ce704['name']){delete _0x1ce704[_0xbcc4('0x28')];}_0x57ef11[_0xbcc4('0x1a')](_0x42126e)['send'](_0x1ce704);};}exports[_0xbcc4('0x29')]=function(_0x437299,_0x2cb2d6){var _0x2beef0={},_0x49e3f8={},_0x247ffa={'count':0x0,'rows':[]};var _0x1863ea=_['map'](db[_0xbcc4('0x2a')][_0xbcc4('0x2b')],function(_0xefc1eb){return{'name':_0xefc1eb[_0xbcc4('0x2c')],'type':_0xefc1eb['type'][_0xbcc4('0x2d')]};});_0x49e3f8[_0xbcc4('0x2e')]=_['map'](_0x1863ea,_0xbcc4('0x28'));_0x49e3f8[_0xbcc4('0x2f')]=_['keys'](_0x437299[_0xbcc4('0x2f')]);_0x49e3f8[_0xbcc4('0x30')]=_[_0xbcc4('0x31')](_0x49e3f8[_0xbcc4('0x2e')],_0x49e3f8[_0xbcc4('0x2f')]);_0x2beef0[_0xbcc4('0x32')]=_[_0xbcc4('0x31')](_0x49e3f8[_0xbcc4('0x2e')],qs['fields'](_0x437299[_0xbcc4('0x2f')][_0xbcc4('0x33')]));_0x2beef0[_0xbcc4('0x32')]=_0x2beef0['attributes'][_0xbcc4('0x34')]?_0x2beef0[_0xbcc4('0x32')]:_0x49e3f8[_0xbcc4('0x2e')];if(!_0x437299[_0xbcc4('0x2f')][_0xbcc4('0x35')]('nolimit')){_0x2beef0[_0xbcc4('0x20')]=qs[_0xbcc4('0x20')](_0x437299[_0xbcc4('0x2f')][_0xbcc4('0x20')]);_0x2beef0[_0xbcc4('0x1d')]=qs['offset'](_0x437299[_0xbcc4('0x2f')][_0xbcc4('0x1d')]);}_0x2beef0[_0xbcc4('0x36')]=qs[_0xbcc4('0x37')](_0x437299['query'][_0xbcc4('0x37')]);_0x2beef0[_0xbcc4('0x38')]=qs[_0xbcc4('0x30')](_['pick'](_0x437299['query'],_0x49e3f8[_0xbcc4('0x30')]),_0x1863ea);if(_0x437299[_0xbcc4('0x2f')][_0xbcc4('0x39')]){_0x2beef0[_0xbcc4('0x38')]=_[_0xbcc4('0x3a')](_0x2beef0[_0xbcc4('0x38')],{'$or':_['map'](_0x1863ea,function(_0x561a18){if(_0x561a18[_0xbcc4('0x3b')]!==_0xbcc4('0x3c')){var _0x41a460={};_0x41a460[_0x561a18[_0xbcc4('0x28')]]={'$like':'%'+_0x437299[_0xbcc4('0x2f')]['filter']+'%'};return _0x41a460;}})});}_0x2beef0=_[_0xbcc4('0x3a')]({},_0x2beef0,_0x437299[_0xbcc4('0x3d')]);var _0x1caa3f={'where':_0x2beef0[_0xbcc4('0x38')]};return db[_0xbcc4('0x2a')][_0xbcc4('0x1f')](_0x1caa3f)[_0xbcc4('0x26')](function(_0x3a6240){_0x247ffa['count']=_0x3a6240;if(_0x437299['query'][_0xbcc4('0x3e')]){_0x2beef0[_0xbcc4('0x3f')]=[{'all':!![]}];}return db[_0xbcc4('0x2a')][_0xbcc4('0x40')](_0x2beef0);})['then'](function(_0x2e8375){_0x247ffa[_0xbcc4('0x41')]=_0x2e8375;return _0x247ffa;})['then'](respondWithFilteredResult(_0x2cb2d6,_0x2beef0))[_0xbcc4('0x42')](handleError(_0x2cb2d6,null));};exports[_0xbcc4('0x43')]=function(_0x36d321,_0x45e2d5){var _0x3a596e={'raw':!![],'where':{'id':_0x36d321['params']['id']}},_0x2ed0bf={};_0x2ed0bf[_0xbcc4('0x2e')]=_[_0xbcc4('0x44')](db[_0xbcc4('0x2a')][_0xbcc4('0x2b')]);_0x2ed0bf[_0xbcc4('0x2f')]=_[_0xbcc4('0x44')](_0x36d321['query']);_0x2ed0bf[_0xbcc4('0x30')]=_[_0xbcc4('0x31')](_0x2ed0bf[_0xbcc4('0x2e')],_0x2ed0bf[_0xbcc4('0x2f')]);_0x3a596e[_0xbcc4('0x32')]=_[_0xbcc4('0x31')](_0x2ed0bf[_0xbcc4('0x2e')],qs['fields'](_0x36d321[_0xbcc4('0x2f')][_0xbcc4('0x33')]));_0x3a596e['attributes']=_0x3a596e[_0xbcc4('0x32')]['length']?_0x3a596e[_0xbcc4('0x32')]:_0x2ed0bf[_0xbcc4('0x2e')];if(_0x36d321['query']['includeAll']){_0x3a596e[_0xbcc4('0x3f')]=[{'all':!![]}];}_0x3a596e=_['merge']({},_0x3a596e,_0x36d321[_0xbcc4('0x3d')]);return db[_0xbcc4('0x2a')][_0xbcc4('0x45')](_0x3a596e)[_0xbcc4('0x26')](handleEntityNotFound(_0x45e2d5,null))[_0xbcc4('0x26')](respondWithResult(_0x45e2d5,null))[_0xbcc4('0x42')](handleError(_0x45e2d5,null));};exports['create']=function(_0x7334da,_0x2f4805){return db[_0xbcc4('0x2a')][_0xbcc4('0x46')](_0x7334da[_0xbcc4('0x47')],{})[_0xbcc4('0x26')](respondWithResult(_0x2f4805,0xc9))[_0xbcc4('0x42')](handleError(_0x2f4805,null));};exports[_0xbcc4('0x25')]=function(_0xa64ec,_0x3dc17f){if(_0xa64ec['body']['id']){delete _0xa64ec[_0xbcc4('0x47')]['id'];}return db[_0xbcc4('0x2a')]['find']({'where':{'id':_0xa64ec[_0xbcc4('0x48')]['id']}})[_0xbcc4('0x26')](handleEntityNotFound(_0x3dc17f,null))[_0xbcc4('0x26')](saveUpdates(_0xa64ec[_0xbcc4('0x47')],null))[_0xbcc4('0x26')](respondWithResult(_0x3dc17f,null))[_0xbcc4('0x42')](handleError(_0x3dc17f,null));};exports['destroy']=function(_0x534b45,_0x8a7d0b){return db[_0xbcc4('0x2a')][_0xbcc4('0x45')]({'where':{'id':_0x534b45[_0xbcc4('0x48')]['id']}})[_0xbcc4('0x26')](handleEntityNotFound(_0x8a7d0b,null))[_0xbcc4('0x26')](removeEntity(_0x8a7d0b,null))[_0xbcc4('0x42')](handleError(_0x8a7d0b,null));};exports[_0xbcc4('0x49')]=function(_0xbbec7,_0x42a336){return db['OpenchannelQueueReport']['describe']()['then'](respondWithResult(_0x42a336,null))[_0xbcc4('0x42')](handleError(_0x42a336,null));}; \ No newline at end of file +var _0xcbf3=['bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','apply','reject','then','error','name','send','map','OpenchannelQueueReport','fieldName','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','includeAll','include','rows','catch','rawAttributes','find','create','update','body','params','destroy','describe','eml-format','rimraf','zip-dir','request-promise','moment'];(function(_0x2f0e53,_0x38b7b6){var _0x1557a0=function(_0x426e35){while(--_0x426e35){_0x2f0e53['push'](_0x2f0e53['shift']());}};_0x1557a0(++_0x38b7b6);}(_0xcbf3,0x8b));var _0x3cbf=function(_0x47fd36,_0x41535d){_0x47fd36=_0x47fd36-0x0;var _0x21a0fc=_0xcbf3[_0x47fd36];return _0x21a0fc;};'use strict';var emlformat=require(_0x3cbf('0x0'));var rimraf=require(_0x3cbf('0x1'));var zipdir=require(_0x3cbf('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3cbf('0x3'));var moment=require(_0x3cbf('0x4'));var BPromise=require(_0x3cbf('0x5'));var Mustache=require(_0x3cbf('0x6'));var util=require(_0x3cbf('0x7'));var path=require(_0x3cbf('0x8'));var sox=require('sox');var csv=require(_0x3cbf('0x9'));var ejs=require(_0x3cbf('0xa'));var fs=require('fs');var fs_extra=require(_0x3cbf('0xb'));var _=require(_0x3cbf('0xc'));var squel=require(_0x3cbf('0xd'));var crypto=require('crypto');var jsforce=require(_0x3cbf('0xe'));var deskjs=require(_0x3cbf('0xf'));var toCsv=require(_0x3cbf('0x9'));var querystring=require('querystring');var Papa=require(_0x3cbf('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x3cbf('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3cbf('0x12'))(_0x3cbf('0x13'));var utils=require(_0x3cbf('0x14'));var config=require(_0x3cbf('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x3cbf('0x16'))['db'];function respondWithStatusCode(_0xfba889,_0x21de87){_0x21de87=_0x21de87||0xcc;return function(_0x572e0d){if(_0x572e0d){return _0xfba889[_0x3cbf('0x17')](_0x21de87);}return _0xfba889[_0x3cbf('0x18')](_0x21de87)[_0x3cbf('0x19')]();};}function respondWithResult(_0x202f1e,_0x19b24a){_0x19b24a=_0x19b24a||0xc8;return function(_0x1788a7){if(_0x1788a7){return _0x202f1e['status'](_0x19b24a)[_0x3cbf('0x1a')](_0x1788a7);}};}function respondWithFilteredResult(_0x39b9cc,_0x4f728b){return function(_0x1069da){if(_0x1069da){var _0x4e4e2f=typeof _0x4f728b[_0x3cbf('0x1b')]===_0x3cbf('0x1c')&&typeof _0x4f728b[_0x3cbf('0x1d')]===_0x3cbf('0x1c');var _0x13d35d=_0x1069da[_0x3cbf('0x1e')];var _0x1780c3=_0x4e4e2f?0x0:_0x4f728b[_0x3cbf('0x1b')];var _0x12d9ec=_0x4e4e2f?_0x1069da[_0x3cbf('0x1e')]:_0x4f728b[_0x3cbf('0x1b')]+_0x4f728b[_0x3cbf('0x1d')];var _0x4226d8;if(_0x12d9ec>=_0x13d35d){_0x12d9ec=_0x13d35d;_0x4226d8=0xc8;}else{_0x4226d8=0xce;}_0x39b9cc['status'](_0x4226d8);return _0x39b9cc['set']('Content-Range',_0x1780c3+'-'+_0x12d9ec+'/'+_0x13d35d)[_0x3cbf('0x1a')](_0x1069da);}return null;};}function patchUpdates(_0x42518f){return function(_0x46d567){try{jsonpatch[_0x3cbf('0x1f')](_0x46d567,_0x42518f,!![]);}catch(_0xcc4ea1){return BPromise[_0x3cbf('0x20')](_0xcc4ea1);}return _0x46d567['save']();};}function saveUpdates(_0x1b821b,_0x5c97d6){return function(_0x2f7fcf){if(_0x2f7fcf){return _0x2f7fcf['update'](_0x1b821b)['then'](function(_0x2ac8db){return _0x2ac8db;});}return null;};}function removeEntity(_0x24de6f,_0x303997){return function(_0x1b8356){if(_0x1b8356){return _0x1b8356['destroy']()[_0x3cbf('0x21')](function(){_0x24de6f[_0x3cbf('0x18')](0xcc)[_0x3cbf('0x19')]();});}};}function handleEntityNotFound(_0x5ac1b1,_0x44883a){return function(_0x5f254e){if(!_0x5f254e){_0x5ac1b1[_0x3cbf('0x17')](0x194);}return _0x5f254e;};}function handleError(_0x3b94bc,_0x133f94){_0x133f94=_0x133f94||0x1f4;return function(_0x513981){logger[_0x3cbf('0x22')](_0x513981['stack']);if(_0x513981[_0x3cbf('0x23')]){delete _0x513981[_0x3cbf('0x23')];}_0x3b94bc[_0x3cbf('0x18')](_0x133f94)[_0x3cbf('0x24')](_0x513981);};}exports['index']=function(_0x1da838,_0xe45f97){var _0x1330a3={},_0x53d9cb={},_0x197e49={'count':0x0,'rows':[]};var _0x5980e4=_[_0x3cbf('0x25')](db[_0x3cbf('0x26')]['rawAttributes'],function(_0x438ce2){return{'name':_0x438ce2[_0x3cbf('0x27')],'type':_0x438ce2['type'][_0x3cbf('0x28')]};});_0x53d9cb[_0x3cbf('0x29')]=_[_0x3cbf('0x25')](_0x5980e4,_0x3cbf('0x23'));_0x53d9cb[_0x3cbf('0x2a')]=_[_0x3cbf('0x2b')](_0x1da838['query']);_0x53d9cb['filters']=_[_0x3cbf('0x2c')](_0x53d9cb[_0x3cbf('0x29')],_0x53d9cb[_0x3cbf('0x2a')]);_0x1330a3[_0x3cbf('0x2d')]=_[_0x3cbf('0x2c')](_0x53d9cb['model'],qs[_0x3cbf('0x2e')](_0x1da838[_0x3cbf('0x2a')][_0x3cbf('0x2e')]));_0x1330a3[_0x3cbf('0x2d')]=_0x1330a3[_0x3cbf('0x2d')][_0x3cbf('0x2f')]?_0x1330a3['attributes']:_0x53d9cb[_0x3cbf('0x29')];if(!_0x1da838[_0x3cbf('0x2a')][_0x3cbf('0x30')](_0x3cbf('0x31'))){_0x1330a3[_0x3cbf('0x1d')]=qs['limit'](_0x1da838[_0x3cbf('0x2a')]['limit']);_0x1330a3['offset']=qs[_0x3cbf('0x1b')](_0x1da838['query'][_0x3cbf('0x1b')]);}_0x1330a3[_0x3cbf('0x32')]=qs['sort'](_0x1da838[_0x3cbf('0x2a')][_0x3cbf('0x33')]);_0x1330a3[_0x3cbf('0x34')]=qs[_0x3cbf('0x35')](_[_0x3cbf('0x36')](_0x1da838[_0x3cbf('0x2a')],_0x53d9cb[_0x3cbf('0x35')]),_0x5980e4);if(_0x1da838[_0x3cbf('0x2a')][_0x3cbf('0x37')]){_0x1330a3[_0x3cbf('0x34')]=_[_0x3cbf('0x38')](_0x1330a3[_0x3cbf('0x34')],{'$or':_['map'](_0x5980e4,function(_0x18330a){if(_0x18330a[_0x3cbf('0x39')]!==_0x3cbf('0x3a')){var _0x49ee48={};_0x49ee48[_0x18330a['name']]={'$like':'%'+_0x1da838[_0x3cbf('0x2a')][_0x3cbf('0x37')]+'%'};return _0x49ee48;}})});}_0x1330a3=_[_0x3cbf('0x38')]({},_0x1330a3,_0x1da838[_0x3cbf('0x3b')]);var _0x416242={'where':_0x1330a3[_0x3cbf('0x34')]};return db[_0x3cbf('0x26')][_0x3cbf('0x1e')](_0x416242)[_0x3cbf('0x21')](function(_0x32825d){_0x197e49['count']=_0x32825d;if(_0x1da838['query'][_0x3cbf('0x3c')]){_0x1330a3[_0x3cbf('0x3d')]=[{'all':!![]}];}return db[_0x3cbf('0x26')]['findAll'](_0x1330a3);})[_0x3cbf('0x21')](function(_0x225909){_0x197e49[_0x3cbf('0x3e')]=_0x225909;return _0x197e49;})[_0x3cbf('0x21')](respondWithFilteredResult(_0xe45f97,_0x1330a3))[_0x3cbf('0x3f')](handleError(_0xe45f97,null));};exports['show']=function(_0x10455f,_0x1d371a){var _0x28bdad={'raw':!![],'where':{'id':_0x10455f['params']['id']}},_0x387991={};_0x387991[_0x3cbf('0x29')]=_[_0x3cbf('0x2b')](db[_0x3cbf('0x26')][_0x3cbf('0x40')]);_0x387991[_0x3cbf('0x2a')]=_[_0x3cbf('0x2b')](_0x10455f[_0x3cbf('0x2a')]);_0x387991[_0x3cbf('0x35')]=_[_0x3cbf('0x2c')](_0x387991['model'],_0x387991[_0x3cbf('0x2a')]);_0x28bdad['attributes']=_[_0x3cbf('0x2c')](_0x387991[_0x3cbf('0x29')],qs[_0x3cbf('0x2e')](_0x10455f[_0x3cbf('0x2a')]['fields']));_0x28bdad['attributes']=_0x28bdad[_0x3cbf('0x2d')]['length']?_0x28bdad[_0x3cbf('0x2d')]:_0x387991['model'];if(_0x10455f[_0x3cbf('0x2a')][_0x3cbf('0x3c')]){_0x28bdad[_0x3cbf('0x3d')]=[{'all':!![]}];}_0x28bdad=_[_0x3cbf('0x38')]({},_0x28bdad,_0x10455f[_0x3cbf('0x3b')]);return db['OpenchannelQueueReport'][_0x3cbf('0x41')](_0x28bdad)[_0x3cbf('0x21')](handleEntityNotFound(_0x1d371a,null))['then'](respondWithResult(_0x1d371a,null))[_0x3cbf('0x3f')](handleError(_0x1d371a,null));};exports[_0x3cbf('0x42')]=function(_0x31b084,_0xce1865){return db[_0x3cbf('0x26')][_0x3cbf('0x42')](_0x31b084['body'],{})[_0x3cbf('0x21')](respondWithResult(_0xce1865,0xc9))[_0x3cbf('0x3f')](handleError(_0xce1865,null));};exports[_0x3cbf('0x43')]=function(_0x288659,_0x5c6b78){if(_0x288659[_0x3cbf('0x44')]['id']){delete _0x288659[_0x3cbf('0x44')]['id'];}return db[_0x3cbf('0x26')][_0x3cbf('0x41')]({'where':{'id':_0x288659[_0x3cbf('0x45')]['id']}})['then'](handleEntityNotFound(_0x5c6b78,null))[_0x3cbf('0x21')](saveUpdates(_0x288659[_0x3cbf('0x44')],null))[_0x3cbf('0x21')](respondWithResult(_0x5c6b78,null))[_0x3cbf('0x3f')](handleError(_0x5c6b78,null));};exports[_0x3cbf('0x46')]=function(_0x54c6b3,_0x11a503){return db[_0x3cbf('0x26')][_0x3cbf('0x41')]({'where':{'id':_0x54c6b3[_0x3cbf('0x45')]['id']}})[_0x3cbf('0x21')](handleEntityNotFound(_0x11a503,null))[_0x3cbf('0x21')](removeEntity(_0x11a503,null))[_0x3cbf('0x3f')](handleError(_0x11a503,null));};exports[_0x3cbf('0x47')]=function(_0x4f2ff4,_0x110c7a){return db[_0x3cbf('0x26')][_0x3cbf('0x47')]()[_0x3cbf('0x21')](respondWithResult(_0x110c7a,null))[_0x3cbf('0x3f')](handleError(_0x110c7a,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index 0d78174..841c709 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 _0x2ef3=['define','OpenchannelQueueReport','report_openchannel_queue','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','./openchannelQueueReport.attributes','exports'];(function(_0x464e74,_0x583c17){var _0x439c03=function(_0x5069b7){while(--_0x5069b7){_0x464e74['push'](_0x464e74['shift']());}};_0x439c03(++_0x583c17);}(_0x2ef3,0xba));var _0x32ef=function(_0x54a9a6,_0x49f5b9){_0x54a9a6=_0x54a9a6-0x0;var _0x306c02=_0x2ef3[_0x54a9a6];return _0x306c02;};'use strict';var _=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var logger=require(_0x32ef('0x2'))(_0x32ef('0x3'));var moment=require(_0x32ef('0x4'));var BPromise=require(_0x32ef('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x32ef('0x6'));var rimraf=require(_0x32ef('0x7'));var config=require('../../config/environment');var attributes=require(_0x32ef('0x8'));module[_0x32ef('0x9')]=function(_0x4c8104,_0x5dfa09){return _0x4c8104[_0x32ef('0xa')](_0x32ef('0xb'),attributes,{'tableName':_0x32ef('0xc'),'paranoid':![],'indexes':[{'name':_0x32ef('0xd'),'fields':[_0x32ef('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5fc3=['util','api','moment','bluebird','request-promise','path','../../config/environment','./openchannelQueueReport.attributes','exports','define','report_openchannel_queue','uniqueid','lodash'];(function(_0xd1ead3,_0x112d6b){var _0x430828=function(_0x359bc7){while(--_0x359bc7){_0xd1ead3['push'](_0xd1ead3['shift']());}};_0x430828(++_0x112d6b);}(_0x5fc3,0xa8));var _0x35fc=function(_0x19ac6e,_0x435862){_0x19ac6e=_0x19ac6e-0x0;var _0x1cdcf3=_0x5fc3[_0x19ac6e];return _0x1cdcf3;};'use strict';var _=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var logger=require('../../config/logger')(_0x35fc('0x2'));var moment=require(_0x35fc('0x3'));var BPromise=require(_0x35fc('0x4'));var rp=require(_0x35fc('0x5'));var fs=require('fs');var path=require(_0x35fc('0x6'));var rimraf=require('rimraf');var config=require(_0x35fc('0x7'));var attributes=require(_0x35fc('0x8'));module[_0x35fc('0x9')]=function(_0x5b85ad,_0x5754be){return _0x5b85ad[_0x35fc('0xa')]('OpenchannelQueueReport',attributes,{'tableName':_0x35fc('0xb'),'paranoid':![],'indexes':[{'name':_0x35fc('0xc'),'fields':[_0x35fc('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js b/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js index 043b9e2..28da1d8 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 _0x536f=['../../config/logger','../../config/environment','client','http','request','then','OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','CreateOpenchannelQueueReport','OpenchannelQueueReport','create','options','debug','catch','update','body','raw','where','attributes','UpdateOpenchannelQueueReport','lodash','ioredis','../../mysqldb','../../config/utils'];(function(_0x1cec9c,_0x43ba99){var _0x4b880b=function(_0x22a967){while(--_0x22a967){_0x1cec9c['push'](_0x1cec9c['shift']());}};_0x4b880b(++_0x43ba99);}(_0x536f,0x70));var _0xf536=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x536f[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xf536('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf536('0x1'));var db=require(_0xf536('0x2'))['db'];var utils=require(_0xf536('0x3'));var logger=require(_0xf536('0x4'))('rpc');var config=require(_0xf536('0x5'));var jayson=require('jayson/promise');var client=jayson[_0xf536('0x6')][_0xf536('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x2fc517,_0x486ee3,_0x5952b7){return new BPromise(function(_0x3b5191,_0x422541){return client[_0xf536('0x8')](_0x2fc517,_0x5952b7)[_0xf536('0x9')](function(_0x4f2eaf){logger['info'](_0xf536('0xa'),_0x486ee3,_0xf536('0xb'));logger['debug']('OpenchannelQueueReport,\x20%s,\x20%s,\x20%s',_0x486ee3,_0xf536('0xb'),JSON[_0xf536('0xc')](_0x4f2eaf));if(_0x4f2eaf[_0xf536('0xd')]){if(_0x4f2eaf[_0xf536('0xd')][_0xf536('0xe')]===0x1f4){logger['error'](_0xf536('0xa'),_0x486ee3,_0x4f2eaf['error'][_0xf536('0xf')]);return _0x422541(_0x4f2eaf[_0xf536('0xd')][_0xf536('0xf')]);}logger[_0xf536('0xd')](_0xf536('0xa'),_0x486ee3,_0x4f2eaf[_0xf536('0xd')][_0xf536('0xf')]);return _0x3b5191(_0x4f2eaf[_0xf536('0xd')][_0xf536('0xf')]);}else{logger[_0xf536('0x10')](_0xf536('0xa'),_0x486ee3,_0xf536('0xb'));_0x3b5191(_0x4f2eaf['result'][_0xf536('0xf')]);}})['catch'](function(_0x238b9d){logger['error'](_0xf536('0xa'),_0x486ee3,_0x238b9d);_0x422541(_0x238b9d);});});}exports[_0xf536('0x11')]=function(_0xbca324){var _0x19756b=this;return new Promise(function(_0x4532a0,_0x189334){return db[_0xf536('0x12')][_0xf536('0x13')](_0xbca324['body'],{'raw':_0xbca324[_0xf536('0x14')]?_0xbca324[_0xf536('0x14')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x466f95){logger[_0xf536('0x10')](_0xf536('0x11'),_0xbca324);logger[_0xf536('0x15')](_0xf536('0x11'),_0xbca324,JSON[_0xf536('0xc')](_0x466f95));_0x4532a0(_0x466f95);})[_0xf536('0x16')](function(_0xe1d6a8){logger[_0xf536('0xd')](_0xf536('0x11'),_0xe1d6a8['message'],_0xbca324);_0x189334(_0x19756b[_0xf536('0xd')](0x1f4,_0xe1d6a8[_0xf536('0xf')]));});});};exports['UpdateOpenchannelQueueReport']=function(_0x1df79c){var _0xddf70e=this;return new Promise(function(_0x2d9dfb,_0x252cae){return db[_0xf536('0x12')][_0xf536('0x17')](_0x1df79c[_0xf536('0x18')],{'raw':_0x1df79c['options']?_0x1df79c[_0xf536('0x14')][_0xf536('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1df79c[_0xf536('0x14')]?_0x1df79c[_0xf536('0x14')][_0xf536('0x1a')]||null:null,'attributes':_0x1df79c['options']?_0x1df79c[_0xf536('0x14')][_0xf536('0x1b')]||null:null,'limit':_0x1df79c[_0xf536('0x14')]?_0x1df79c[_0xf536('0x14')]['limit']||null:null})[_0xf536('0x9')](function(_0x485da0){logger[_0xf536('0x10')](_0xf536('0x1c'),_0x1df79c);logger[_0xf536('0x15')](_0xf536('0x1c'),_0x1df79c,JSON[_0xf536('0xc')](_0x485da0));_0x2d9dfb(_0x485da0);})[_0xf536('0x16')](function(_0x330c47){logger[_0xf536('0xd')](_0xf536('0x1c'),_0x330c47[_0xf536('0xf')],_0x1df79c);_0x252cae(_0xddf70e[_0xf536('0xd')](0x1f4,_0x330c47[_0xf536('0xf')]));});});}; \ No newline at end of file +var _0x7334=['jayson/promise','client','http','request','then','info','OpenchannelQueueReport,\x20%s,\x20%s','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','CreateOpenchannelQueueReport','create','body','options','raw','catch','UpdateOpenchannelQueueReport','OpenchannelQueueReport','update','where','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x59d117,_0x5d376c){var _0x2d74b6=function(_0x3ea062){while(--_0x3ea062){_0x59d117['push'](_0x59d117['shift']());}};_0x2d74b6(++_0x5d376c);}(_0x7334,0x184));var _0x4733=function(_0x1a2c1d,_0x6faec5){_0x1a2c1d=_0x1a2c1d-0x0;var _0x1b22db=_0x7334[_0x1a2c1d];return _0x1b22db;};'use strict';var _=require(_0x4733('0x0'));var util=require(_0x4733('0x1'));var moment=require(_0x4733('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4733('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x4733('0x4'));var logger=require(_0x4733('0x5'))(_0x4733('0x6'));var config=require(_0x4733('0x7'));var jayson=require(_0x4733('0x8'));var client=jayson[_0x4733('0x9')][_0x4733('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x283754,_0x12cafa,_0x43d95c){return new BPromise(function(_0x8257cf,_0x3562b7){return client[_0x4733('0xb')](_0x283754,_0x43d95c)[_0x4733('0xc')](function(_0x2d5fde){logger[_0x4733('0xd')](_0x4733('0xe'),_0x12cafa,'request\x20sent');logger[_0x4733('0xf')](_0x4733('0x10'),_0x12cafa,'request\x20sent',JSON[_0x4733('0x11')](_0x2d5fde));if(_0x2d5fde['error']){if(_0x2d5fde[_0x4733('0x12')][_0x4733('0x13')]===0x1f4){logger[_0x4733('0x12')](_0x4733('0xe'),_0x12cafa,_0x2d5fde[_0x4733('0x12')][_0x4733('0x14')]);return _0x3562b7(_0x2d5fde[_0x4733('0x12')]['message']);}logger[_0x4733('0x12')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x12cafa,_0x2d5fde[_0x4733('0x12')][_0x4733('0x14')]);return _0x8257cf(_0x2d5fde[_0x4733('0x12')][_0x4733('0x14')]);}else{logger[_0x4733('0xd')](_0x4733('0xe'),_0x12cafa,_0x4733('0x15'));_0x8257cf(_0x2d5fde[_0x4733('0x16')][_0x4733('0x14')]);}})['catch'](function(_0x2c0031){logger[_0x4733('0x12')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x12cafa,_0x2c0031);_0x3562b7(_0x2c0031);});});}exports[_0x4733('0x17')]=function(_0x1d2fb6){var _0x2aa223=this;return new Promise(function(_0x384e0c,_0x579f67){return db['OpenchannelQueueReport'][_0x4733('0x18')](_0x1d2fb6[_0x4733('0x19')],{'raw':_0x1d2fb6['options']?_0x1d2fb6[_0x4733('0x1a')][_0x4733('0x1b')]===undefined?!![]:![]:!![]})[_0x4733('0xc')](function(_0x7a4e0){logger['info'](_0x4733('0x17'),_0x1d2fb6);logger[_0x4733('0xf')]('CreateOpenchannelQueueReport',_0x1d2fb6,JSON[_0x4733('0x11')](_0x7a4e0));_0x384e0c(_0x7a4e0);})[_0x4733('0x1c')](function(_0x478e34){logger[_0x4733('0x12')](_0x4733('0x17'),_0x478e34[_0x4733('0x14')],_0x1d2fb6);_0x579f67(_0x2aa223[_0x4733('0x12')](0x1f4,_0x478e34[_0x4733('0x14')]));});});};exports[_0x4733('0x1d')]=function(_0x180049){var _0x2bb78f=this;return new Promise(function(_0x523697,_0x3e6976){return db[_0x4733('0x1e')][_0x4733('0x1f')](_0x180049[_0x4733('0x19')],{'raw':_0x180049[_0x4733('0x1a')]?_0x180049[_0x4733('0x1a')][_0x4733('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x180049[_0x4733('0x1a')]?_0x180049[_0x4733('0x1a')][_0x4733('0x20')]||null:null,'attributes':_0x180049['options']?_0x180049[_0x4733('0x1a')]['attributes']||null:null,'limit':_0x180049['options']?_0x180049[_0x4733('0x1a')]['limit']||null:null})[_0x4733('0xc')](function(_0x479989){logger['info']('UpdateOpenchannelQueueReport',_0x180049);logger[_0x4733('0xf')](_0x4733('0x1d'),_0x180049,JSON[_0x4733('0x11')](_0x479989));_0x523697(_0x479989);})[_0x4733('0x1c')](function(_0x4fee4a){logger['error']('UpdateOpenchannelQueueReport',_0x4fee4a[_0x4733('0x14')],_0x180049);_0x3e6976(_0x2bb78f['error'](0x1f4,_0x4fee4a['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index 0b3fe2f..2a0bed5 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 _0xa803=['isAuthenticated','describe','/:id','show','create','put','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','index','get','/describe'];(function(_0x3d43c7,_0x3a09f2){var _0x32535d=function(_0x121582){while(--_0x121582){_0x3d43c7['push'](_0x3d43c7['shift']());}};_0x32535d(++_0x3a09f2);}(_0xa803,0xc6));var _0x3a80=function(_0x589df7,_0x1e5e94){_0x589df7=_0x589df7-0x0;var _0x3c20f6=_0xa803[_0x589df7];return _0x3c20f6;};'use strict';var multer=require(_0x3a80('0x0'));var util=require(_0x3a80('0x1'));var path=require(_0x3a80('0x2'));var timeout=require(_0x3a80('0x3'));var express=require(_0x3a80('0x4'));var router=express[_0x3a80('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x3a80('0x6'));var config=require(_0x3a80('0x7'));var controller=require('./openchannelTransferReport.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x3a80('0x8')]);router[_0x3a80('0x9')](_0x3a80('0xa'),auth[_0x3a80('0xb')](),controller[_0x3a80('0xc')]);router[_0x3a80('0x9')](_0x3a80('0xd'),auth[_0x3a80('0xb')](),controller[_0x3a80('0xe')]);router['post']('/',auth[_0x3a80('0xb')](),controller[_0x3a80('0xf')]);router[_0x3a80('0x10')](_0x3a80('0xd'),auth[_0x3a80('0xb')](),controller['update']);router[_0x3a80('0x11')](_0x3a80('0xd'),auth[_0x3a80('0xb')](),controller[_0x3a80('0x12')]);module['exports']=router; \ No newline at end of file +var _0x2725=['isAuthenticated','index','describe','/:id','post','put','update','delete','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./openchannelTransferReport.controller','get'];(function(_0x15af11,_0x244124){var _0x3f59de=function(_0x3a5517){while(--_0x3a5517){_0x15af11['push'](_0x15af11['shift']());}};_0x3f59de(++_0x244124);}(_0x2725,0x195));var _0x5272=function(_0x47623f,_0x148f3a){_0x47623f=_0x47623f-0x0;var _0x282ce8=_0x2725[_0x47623f];return _0x282ce8;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x5272('0x0'));var timeout=require(_0x5272('0x1'));var express=require(_0x5272('0x2'));var router=express[_0x5272('0x3')]();var fs_extra=require(_0x5272('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x5272('0x5'));var config=require(_0x5272('0x6'));var controller=require(_0x5272('0x7'));router[_0x5272('0x8')]('/',auth[_0x5272('0x9')](),controller[_0x5272('0xa')]);router[_0x5272('0x8')]('/describe',auth['isAuthenticated'](),controller[_0x5272('0xb')]);router[_0x5272('0x8')](_0x5272('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x5272('0xd')]('/',auth[_0x5272('0x9')](),controller['create']);router[_0x5272('0xe')](_0x5272('0xc'),auth['isAuthenticated'](),controller[_0x5272('0xf')]);router[_0x5272('0x10')]('/:id',auth[_0x5272('0x9')](),controller['destroy']);module[_0x5272('0x11')]=router; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js b/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js index 977d82c..274a022 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 _0x34e8=['queue','DATE','NOW','moment','sequelize','exports','STRING','account','agent'];(function(_0x124728,_0x463dca){var _0x8eb20f=function(_0x49d9de){while(--_0x49d9de){_0x124728['push'](_0x124728['shift']());}};_0x8eb20f(++_0x463dca);}(_0x34e8,0x12c));var _0x834e=function(_0x100fca,_0x4360d7){_0x100fca=_0x100fca-0x0;var _0x3242b9=_0x34e8[_0x100fca];return _0x3242b9;};'use strict';var moment=require(_0x834e('0x0'));var Sequelize=require(_0x834e('0x1'));module[_0x834e('0x2')]={'uniqueid':{'type':Sequelize[_0x834e('0x3')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x834e('0x4'),_0x834e('0x5'),_0x834e('0x6')),'allowNull':![],'defaultValue':_0x834e('0x6')},'transferredAt':{'type':Sequelize[_0x834e('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x834e('0x8')]}}; \ No newline at end of file +var _0xaa88=['account','agent','queue','DATE','NOW','moment','sequelize','exports','STRING'];(function(_0x4a7095,_0x570f2d){var _0x392629=function(_0x552ef6){while(--_0x552ef6){_0x4a7095['push'](_0x4a7095['shift']());}};_0x392629(++_0x570f2d);}(_0xaa88,0x137));var _0x8aa8=function(_0x60df74,_0x458e29){_0x60df74=_0x60df74-0x0;var _0x5ee872=_0xaa88[_0x60df74];return _0x5ee872;};'use strict';var moment=require(_0x8aa8('0x0'));var Sequelize=require(_0x8aa8('0x1'));module[_0x8aa8('0x2')]={'uniqueid':{'type':Sequelize[_0x8aa8('0x3')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x8aa8('0x4'),_0x8aa8('0x5'),_0x8aa8('0x6')),'allowNull':![],'defaultValue':_0x8aa8('0x6')},'transferredAt':{'type':Sequelize[_0x8aa8('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x8aa8('0x8')]}}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.controller.js b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js index 40568c7..eb8beaf 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 _0x245c=['index','map','OpenchannelTransferReport','type','key','model','query','filters','attributes','intersection','nolimit','limit','order','sort','where','pick','filter','VIRTUAL','options','includeAll','findAll','rows','show','params','rawAttributes','fields','length','include','catch','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','offset','undefined','count','set','Content-Range','json','reject','update','then','destroy','sendStatus','error','stack','name','send'];(function(_0x4cc492,_0x162c85){var _0x1f36b9=function(_0xce4b2){while(--_0xce4b2){_0x4cc492['push'](_0x4cc492['shift']());}};_0x1f36b9(++_0x162c85);}(_0x245c,0x1dc));var _0xc245=function(_0x3795e3,_0x51bbf1){_0x3795e3=_0x3795e3-0x0;var _0x5e7e19=_0x245c[_0x3795e3];return _0x5e7e19;};'use strict';var emlformat=require(_0xc245('0x0'));var rimraf=require(_0xc245('0x1'));var zipdir=require(_0xc245('0x2'));var jsonpatch=require(_0xc245('0x3'));var rp=require(_0xc245('0x4'));var moment=require('moment');var BPromise=require(_0xc245('0x5'));var Mustache=require('mustache');var util=require(_0xc245('0x6'));var path=require(_0xc245('0x7'));var sox=require(_0xc245('0x8'));var csv=require(_0xc245('0x9'));var ejs=require(_0xc245('0xa'));var fs=require('fs');var fs_extra=require(_0xc245('0xb'));var _=require('lodash');var squel=require(_0xc245('0xc'));var crypto=require('crypto');var jsforce=require(_0xc245('0xd'));var deskjs=require(_0xc245('0xe'));var toCsv=require(_0xc245('0x9'));var querystring=require(_0xc245('0xf'));var Papa=require(_0xc245('0x10'));var Redis=require('ioredis');var authService=require(_0xc245('0x11'));var qs=require(_0xc245('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc245('0x13'));var logger=require(_0xc245('0x14'))(_0xc245('0x15'));var utils=require(_0xc245('0x16'));var config=require(_0xc245('0x17'));var licenseUtil=require(_0xc245('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xb6fe31,_0x29fbe6){_0x29fbe6=_0x29fbe6||0xcc;return function(_0x1add0b){if(_0x1add0b){return _0xb6fe31['sendStatus'](_0x29fbe6);}return _0xb6fe31[_0xc245('0x19')](_0x29fbe6)[_0xc245('0x1a')]();};}function respondWithResult(_0x520da5,_0x3f7730){_0x3f7730=_0x3f7730||0xc8;return function(_0x11ef08){if(_0x11ef08){return _0x520da5[_0xc245('0x19')](_0x3f7730)['json'](_0x11ef08);}};}function respondWithFilteredResult(_0x8715eb,_0x335778){return function(_0x45fb16){if(_0x45fb16){var _0x22d9b9=typeof _0x335778[_0xc245('0x1b')]===_0xc245('0x1c')&&typeof _0x335778['limit']===_0xc245('0x1c');var _0x322d7e=_0x45fb16['count'];var _0x1b61b4=_0x22d9b9?0x0:_0x335778[_0xc245('0x1b')];var _0xbb3644=_0x22d9b9?_0x45fb16[_0xc245('0x1d')]:_0x335778[_0xc245('0x1b')]+_0x335778['limit'];var _0x43ef52;if(_0xbb3644>=_0x322d7e){_0xbb3644=_0x322d7e;_0x43ef52=0xc8;}else{_0x43ef52=0xce;}_0x8715eb['status'](_0x43ef52);return _0x8715eb[_0xc245('0x1e')](_0xc245('0x1f'),_0x1b61b4+'-'+_0xbb3644+'/'+_0x322d7e)[_0xc245('0x20')](_0x45fb16);}return null;};}function patchUpdates(_0x49a85a){return function(_0x2a73cc){try{jsonpatch['apply'](_0x2a73cc,_0x49a85a,!![]);}catch(_0x397f94){return BPromise[_0xc245('0x21')](_0x397f94);}return _0x2a73cc['save']();};}function saveUpdates(_0x1dea44,_0x3306ea){return function(_0x2214c1){if(_0x2214c1){return _0x2214c1[_0xc245('0x22')](_0x1dea44)[_0xc245('0x23')](function(_0x145f9c){return _0x145f9c;});}return null;};}function removeEntity(_0x191a1e,_0x12919e){return function(_0x530572){if(_0x530572){return _0x530572[_0xc245('0x24')]()[_0xc245('0x23')](function(){_0x191a1e[_0xc245('0x19')](0xcc)[_0xc245('0x1a')]();});}};}function handleEntityNotFound(_0x18dd38,_0x4bb78c){return function(_0x176d20){if(!_0x176d20){_0x18dd38[_0xc245('0x25')](0x194);}return _0x176d20;};}function handleError(_0x9d28f4,_0x4f0656){_0x4f0656=_0x4f0656||0x1f4;return function(_0x10da73){logger[_0xc245('0x26')](_0x10da73[_0xc245('0x27')]);if(_0x10da73[_0xc245('0x28')]){delete _0x10da73[_0xc245('0x28')];}_0x9d28f4[_0xc245('0x19')](_0x4f0656)[_0xc245('0x29')](_0x10da73);};}exports[_0xc245('0x2a')]=function(_0x18d849,_0xeec5a){var _0x6735b3={},_0x4c4b41={},_0x1baa49={'count':0x0,'rows':[]};var _0x5dee44=_[_0xc245('0x2b')](db[_0xc245('0x2c')]['rawAttributes'],function(_0x43c8bc){return{'name':_0x43c8bc['fieldName'],'type':_0x43c8bc[_0xc245('0x2d')][_0xc245('0x2e')]};});_0x4c4b41[_0xc245('0x2f')]=_[_0xc245('0x2b')](_0x5dee44,_0xc245('0x28'));_0x4c4b41[_0xc245('0x30')]=_['keys'](_0x18d849['query']);_0x4c4b41[_0xc245('0x31')]=_['intersection'](_0x4c4b41[_0xc245('0x2f')],_0x4c4b41[_0xc245('0x30')]);_0x6735b3[_0xc245('0x32')]=_[_0xc245('0x33')](_0x4c4b41[_0xc245('0x2f')],qs['fields'](_0x18d849['query']['fields']));_0x6735b3[_0xc245('0x32')]=_0x6735b3[_0xc245('0x32')]['length']?_0x6735b3[_0xc245('0x32')]:_0x4c4b41['model'];if(!_0x18d849[_0xc245('0x30')]['hasOwnProperty'](_0xc245('0x34'))){_0x6735b3['limit']=qs[_0xc245('0x35')](_0x18d849[_0xc245('0x30')][_0xc245('0x35')]);_0x6735b3[_0xc245('0x1b')]=qs[_0xc245('0x1b')](_0x18d849[_0xc245('0x30')][_0xc245('0x1b')]);}_0x6735b3[_0xc245('0x36')]=qs[_0xc245('0x37')](_0x18d849[_0xc245('0x30')][_0xc245('0x37')]);_0x6735b3[_0xc245('0x38')]=qs[_0xc245('0x31')](_[_0xc245('0x39')](_0x18d849[_0xc245('0x30')],_0x4c4b41['filters']),_0x5dee44);if(_0x18d849[_0xc245('0x30')][_0xc245('0x3a')]){_0x6735b3[_0xc245('0x38')]=_['merge'](_0x6735b3[_0xc245('0x38')],{'$or':_[_0xc245('0x2b')](_0x5dee44,function(_0x5018db){if(_0x5018db[_0xc245('0x2d')]!==_0xc245('0x3b')){var _0x3febc5={};_0x3febc5[_0x5018db[_0xc245('0x28')]]={'$like':'%'+_0x18d849[_0xc245('0x30')][_0xc245('0x3a')]+'%'};return _0x3febc5;}})});}_0x6735b3=_['merge']({},_0x6735b3,_0x18d849[_0xc245('0x3c')]);var _0x2c8e8a={'where':_0x6735b3[_0xc245('0x38')]};return db[_0xc245('0x2c')]['count'](_0x2c8e8a)[_0xc245('0x23')](function(_0x3716e4){_0x1baa49['count']=_0x3716e4;if(_0x18d849[_0xc245('0x30')][_0xc245('0x3d')]){_0x6735b3['include']=[{'all':!![]}];}return db[_0xc245('0x2c')][_0xc245('0x3e')](_0x6735b3);})[_0xc245('0x23')](function(_0x882709){_0x1baa49[_0xc245('0x3f')]=_0x882709;return _0x1baa49;})[_0xc245('0x23')](respondWithFilteredResult(_0xeec5a,_0x6735b3))['catch'](handleError(_0xeec5a,null));};exports[_0xc245('0x40')]=function(_0x5e2fcb,_0x349394){var _0x4e0d37={'raw':!![],'where':{'id':_0x5e2fcb[_0xc245('0x41')]['id']}},_0x33c5c2={};_0x33c5c2['model']=_['keys'](db[_0xc245('0x2c')][_0xc245('0x42')]);_0x33c5c2['query']=_['keys'](_0x5e2fcb[_0xc245('0x30')]);_0x33c5c2[_0xc245('0x31')]=_[_0xc245('0x33')](_0x33c5c2[_0xc245('0x2f')],_0x33c5c2[_0xc245('0x30')]);_0x4e0d37['attributes']=_['intersection'](_0x33c5c2[_0xc245('0x2f')],qs[_0xc245('0x43')](_0x5e2fcb[_0xc245('0x30')]['fields']));_0x4e0d37[_0xc245('0x32')]=_0x4e0d37[_0xc245('0x32')][_0xc245('0x44')]?_0x4e0d37[_0xc245('0x32')]:_0x33c5c2[_0xc245('0x2f')];if(_0x5e2fcb[_0xc245('0x30')][_0xc245('0x3d')]){_0x4e0d37[_0xc245('0x45')]=[{'all':!![]}];}_0x4e0d37=_['merge']({},_0x4e0d37,_0x5e2fcb['options']);return db[_0xc245('0x2c')]['find'](_0x4e0d37)[_0xc245('0x23')](handleEntityNotFound(_0x349394,null))[_0xc245('0x23')](respondWithResult(_0x349394,null))[_0xc245('0x46')](handleError(_0x349394,null));};exports[_0xc245('0x47')]=function(_0x343adc,_0x180c44){return db[_0xc245('0x2c')][_0xc245('0x47')](_0x343adc[_0xc245('0x48')],{})[_0xc245('0x23')](respondWithResult(_0x180c44,0xc9))[_0xc245('0x46')](handleError(_0x180c44,null));};exports[_0xc245('0x22')]=function(_0x58549b,_0x1bf0ab){if(_0x58549b[_0xc245('0x48')]['id']){delete _0x58549b[_0xc245('0x48')]['id'];}return db[_0xc245('0x2c')]['find']({'where':{'id':_0x58549b[_0xc245('0x41')]['id']}})[_0xc245('0x23')](handleEntityNotFound(_0x1bf0ab,null))[_0xc245('0x23')](saveUpdates(_0x58549b[_0xc245('0x48')],null))[_0xc245('0x23')](respondWithResult(_0x1bf0ab,null))[_0xc245('0x46')](handleError(_0x1bf0ab,null));};exports[_0xc245('0x24')]=function(_0x4bde36,_0x1688b9){return db[_0xc245('0x2c')]['find']({'where':{'id':_0x4bde36['params']['id']}})[_0xc245('0x23')](handleEntityNotFound(_0x1688b9,null))[_0xc245('0x23')](removeEntity(_0x1688b9,null))['catch'](handleError(_0x1688b9,null));};exports[_0xc245('0x49')]=function(_0x4bfc9f,_0x41b328){return db[_0xc245('0x2c')]['describe']()[_0xc245('0x23')](respondWithResult(_0x41b328,null))[_0xc245('0x46')](handleError(_0x41b328,null));}; \ No newline at end of file +var _0x23b2=['options','includeAll','findAll','catch','show','params','keys','find','create','body','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','ejs','fs-extra','lodash','squel','to-csv','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','end','error','name','send','index','map','OpenchannelTransferReport','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL'];(function(_0xbb692,_0x2d903e){var _0x382b4a=function(_0x1f48ae){while(--_0x1f48ae){_0xbb692['push'](_0xbb692['shift']());}};_0x382b4a(++_0x2d903e);}(_0x23b2,0x1c8));var _0x223b=function(_0x41bf13,_0x2eda5c){_0x41bf13=_0x41bf13-0x0;var _0x73c5d0=_0x23b2[_0x41bf13];return _0x73c5d0;};'use strict';var emlformat=require(_0x223b('0x0'));var rimraf=require(_0x223b('0x1'));var zipdir=require(_0x223b('0x2'));var jsonpatch=require(_0x223b('0x3'));var rp=require(_0x223b('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x223b('0x5'));var util=require(_0x223b('0x6'));var path=require(_0x223b('0x7'));var sox=require(_0x223b('0x8'));var csv=require('to-csv');var ejs=require(_0x223b('0x9'));var fs=require('fs');var fs_extra=require(_0x223b('0xa'));var _=require(_0x223b('0xb'));var squel=require(_0x223b('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x223b('0xd'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x223b('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x223b('0xf'));var logger=require(_0x223b('0x10'))(_0x223b('0x11'));var utils=require(_0x223b('0x12'));var config=require(_0x223b('0x13'));var licenseUtil=require(_0x223b('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x14d48e,_0x356b73){_0x356b73=_0x356b73||0xcc;return function(_0x1811fe){if(_0x1811fe){return _0x14d48e[_0x223b('0x15')](_0x356b73);}return _0x14d48e[_0x223b('0x16')](_0x356b73)['end']();};}function respondWithResult(_0x5ae189,_0x5cd689){_0x5cd689=_0x5cd689||0xc8;return function(_0x402440){if(_0x402440){return _0x5ae189['status'](_0x5cd689)[_0x223b('0x17')](_0x402440);}};}function respondWithFilteredResult(_0x4234cc,_0x5f0680){return function(_0x18c1d4){if(_0x18c1d4){var _0x261354=typeof _0x5f0680[_0x223b('0x18')]==='undefined'&&typeof _0x5f0680[_0x223b('0x19')]===_0x223b('0x1a');var _0x5230ba=_0x18c1d4[_0x223b('0x1b')];var _0x5ea7d9=_0x261354?0x0:_0x5f0680['offset'];var _0x4e0838=_0x261354?_0x18c1d4['count']:_0x5f0680['offset']+_0x5f0680[_0x223b('0x19')];var _0xeb8cd5;if(_0x4e0838>=_0x5230ba){_0x4e0838=_0x5230ba;_0xeb8cd5=0xc8;}else{_0xeb8cd5=0xce;}_0x4234cc[_0x223b('0x16')](_0xeb8cd5);return _0x4234cc[_0x223b('0x1c')](_0x223b('0x1d'),_0x5ea7d9+'-'+_0x4e0838+'/'+_0x5230ba)[_0x223b('0x17')](_0x18c1d4);}return null;};}function patchUpdates(_0x30ffac){return function(_0x5acacb){try{jsonpatch[_0x223b('0x1e')](_0x5acacb,_0x30ffac,!![]);}catch(_0x116a72){return BPromise[_0x223b('0x1f')](_0x116a72);}return _0x5acacb[_0x223b('0x20')]();};}function saveUpdates(_0x278ae6,_0x2ab0b8){return function(_0x235c7a){if(_0x235c7a){return _0x235c7a[_0x223b('0x21')](_0x278ae6)[_0x223b('0x22')](function(_0x5a3f06){return _0x5a3f06;});}return null;};}function removeEntity(_0x3fe507,_0x46aff8){return function(_0x5478f2){if(_0x5478f2){return _0x5478f2['destroy']()[_0x223b('0x22')](function(){_0x3fe507[_0x223b('0x16')](0xcc)[_0x223b('0x23')]();});}};}function handleEntityNotFound(_0x4ad362,_0x1705d9){return function(_0x11b398){if(!_0x11b398){_0x4ad362['sendStatus'](0x194);}return _0x11b398;};}function handleError(_0x4516ab,_0x48be0c){_0x48be0c=_0x48be0c||0x1f4;return function(_0x297e34){logger[_0x223b('0x24')](_0x297e34['stack']);if(_0x297e34[_0x223b('0x25')]){delete _0x297e34[_0x223b('0x25')];}_0x4516ab['status'](_0x48be0c)[_0x223b('0x26')](_0x297e34);};}exports[_0x223b('0x27')]=function(_0x53085d,_0x3da11c){var _0x23f5b8={},_0x2b3c7a={},_0x192417={'count':0x0,'rows':[]};var _0x19980d=_[_0x223b('0x28')](db[_0x223b('0x29')][_0x223b('0x2a')],function(_0x49e5dc){return{'name':_0x49e5dc[_0x223b('0x2b')],'type':_0x49e5dc[_0x223b('0x2c')][_0x223b('0x2d')]};});_0x2b3c7a[_0x223b('0x2e')]=_[_0x223b('0x28')](_0x19980d,'name');_0x2b3c7a[_0x223b('0x2f')]=_['keys'](_0x53085d[_0x223b('0x2f')]);_0x2b3c7a[_0x223b('0x30')]=_[_0x223b('0x31')](_0x2b3c7a['model'],_0x2b3c7a[_0x223b('0x2f')]);_0x23f5b8[_0x223b('0x32')]=_[_0x223b('0x31')](_0x2b3c7a[_0x223b('0x2e')],qs[_0x223b('0x33')](_0x53085d['query'][_0x223b('0x33')]));_0x23f5b8[_0x223b('0x32')]=_0x23f5b8['attributes'][_0x223b('0x34')]?_0x23f5b8[_0x223b('0x32')]:_0x2b3c7a['model'];if(!_0x53085d[_0x223b('0x2f')][_0x223b('0x35')](_0x223b('0x36'))){_0x23f5b8[_0x223b('0x19')]=qs[_0x223b('0x19')](_0x53085d['query'][_0x223b('0x19')]);_0x23f5b8[_0x223b('0x18')]=qs['offset'](_0x53085d['query'][_0x223b('0x18')]);}_0x23f5b8[_0x223b('0x37')]=qs[_0x223b('0x38')](_0x53085d[_0x223b('0x2f')]['sort']);_0x23f5b8[_0x223b('0x39')]=qs[_0x223b('0x30')](_[_0x223b('0x3a')](_0x53085d[_0x223b('0x2f')],_0x2b3c7a[_0x223b('0x30')]),_0x19980d);if(_0x53085d['query'][_0x223b('0x3b')]){_0x23f5b8['where']=_[_0x223b('0x3c')](_0x23f5b8['where'],{'$or':_[_0x223b('0x28')](_0x19980d,function(_0x548b99){if(_0x548b99[_0x223b('0x2c')]!==_0x223b('0x3d')){var _0x111b14={};_0x111b14[_0x548b99[_0x223b('0x25')]]={'$like':'%'+_0x53085d[_0x223b('0x2f')][_0x223b('0x3b')]+'%'};return _0x111b14;}})});}_0x23f5b8=_[_0x223b('0x3c')]({},_0x23f5b8,_0x53085d[_0x223b('0x3e')]);var _0x1cec45={'where':_0x23f5b8['where']};return db[_0x223b('0x29')]['count'](_0x1cec45)[_0x223b('0x22')](function(_0x438528){_0x192417[_0x223b('0x1b')]=_0x438528;if(_0x53085d[_0x223b('0x2f')][_0x223b('0x3f')]){_0x23f5b8['include']=[{'all':!![]}];}return db[_0x223b('0x29')][_0x223b('0x40')](_0x23f5b8);})['then'](function(_0x218cf8){_0x192417['rows']=_0x218cf8;return _0x192417;})['then'](respondWithFilteredResult(_0x3da11c,_0x23f5b8))[_0x223b('0x41')](handleError(_0x3da11c,null));};exports[_0x223b('0x42')]=function(_0xcf21a2,_0x170c65){var _0x168196={'raw':!![],'where':{'id':_0xcf21a2[_0x223b('0x43')]['id']}},_0x38a38c={};_0x38a38c[_0x223b('0x2e')]=_['keys'](db[_0x223b('0x29')][_0x223b('0x2a')]);_0x38a38c[_0x223b('0x2f')]=_[_0x223b('0x44')](_0xcf21a2['query']);_0x38a38c[_0x223b('0x30')]=_[_0x223b('0x31')](_0x38a38c[_0x223b('0x2e')],_0x38a38c[_0x223b('0x2f')]);_0x168196[_0x223b('0x32')]=_[_0x223b('0x31')](_0x38a38c[_0x223b('0x2e')],qs[_0x223b('0x33')](_0xcf21a2[_0x223b('0x2f')]['fields']));_0x168196[_0x223b('0x32')]=_0x168196[_0x223b('0x32')][_0x223b('0x34')]?_0x168196['attributes']:_0x38a38c[_0x223b('0x2e')];if(_0xcf21a2[_0x223b('0x2f')]['includeAll']){_0x168196['include']=[{'all':!![]}];}_0x168196=_['merge']({},_0x168196,_0xcf21a2[_0x223b('0x3e')]);return db[_0x223b('0x29')][_0x223b('0x45')](_0x168196)['then'](handleEntityNotFound(_0x170c65,null))[_0x223b('0x22')](respondWithResult(_0x170c65,null))[_0x223b('0x41')](handleError(_0x170c65,null));};exports[_0x223b('0x46')]=function(_0x2a9051,_0x4cedd7){return db[_0x223b('0x29')][_0x223b('0x46')](_0x2a9051['body'],{})[_0x223b('0x22')](respondWithResult(_0x4cedd7,0xc9))[_0x223b('0x41')](handleError(_0x4cedd7,null));};exports['update']=function(_0xe96752,_0x545152){if(_0xe96752['body']['id']){delete _0xe96752[_0x223b('0x47')]['id'];}return db[_0x223b('0x29')][_0x223b('0x45')]({'where':{'id':_0xe96752['params']['id']}})[_0x223b('0x22')](handleEntityNotFound(_0x545152,null))[_0x223b('0x22')](saveUpdates(_0xe96752[_0x223b('0x47')],null))[_0x223b('0x22')](respondWithResult(_0x545152,null))[_0x223b('0x41')](handleError(_0x545152,null));};exports[_0x223b('0x48')]=function(_0x2471db,_0x2aaa68){return db[_0x223b('0x29')][_0x223b('0x45')]({'where':{'id':_0x2471db[_0x223b('0x43')]['id']}})['then'](handleEntityNotFound(_0x2aaa68,null))[_0x223b('0x22')](removeEntity(_0x2aaa68,null))['catch'](handleError(_0x2aaa68,null));};exports['describe']=function(_0x4d6080,_0x1a5306){return db['OpenchannelTransferReport'][_0x223b('0x49')]()[_0x223b('0x22')](respondWithResult(_0x1a5306,null))[_0x223b('0x41')](handleError(_0x1a5306,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index db12d12..97a9437 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 _0xc77e=['uniqueid','util','../../config/logger','api','moment','request-promise','rimraf','exports','define','OpenchannelTransferReport'];(function(_0x3d1d35,_0x4b007a){var _0x472b27=function(_0x1ce7ad){while(--_0x1ce7ad){_0x3d1d35['push'](_0x3d1d35['shift']());}};_0x472b27(++_0x4b007a);}(_0xc77e,0x1eb));var _0xec77=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xc77e[_0x57b54c];return _0x59cc19;};'use strict';var _=require('lodash');var util=require(_0xec77('0x0'));var logger=require(_0xec77('0x1'))(_0xec77('0x2'));var moment=require(_0xec77('0x3'));var BPromise=require('bluebird');var rp=require(_0xec77('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xec77('0x5'));var config=require('../../config/environment');var attributes=require('./openchannelTransferReport.attributes');module[_0xec77('0x6')]=function(_0x4cb7ba,_0x1e15e5){return _0x4cb7ba[_0xec77('0x7')](_0xec77('0x8'),attributes,{'tableName':'report_openchannel_transfer','paranoid':![],'indexes':[{'name':_0xec77('0x9'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xc928=['path','rimraf','../../config/environment','exports','define','report_openchannel_transfer','uniqueid','util','../../config/logger','api','bluebird'];(function(_0x3b5ad9,_0x223867){var _0x611ae9=function(_0x1c5e28){while(--_0x1c5e28){_0x3b5ad9['push'](_0x3b5ad9['shift']());}};_0x611ae9(++_0x223867);}(_0xc928,0xf9));var _0x8c92=function(_0x26ab85,_0x197fce){_0x26ab85=_0x26ab85-0x0;var _0x4de276=_0xc928[_0x26ab85];return _0x4de276;};'use strict';var _=require('lodash');var util=require(_0x8c92('0x0'));var logger=require(_0x8c92('0x1'))(_0x8c92('0x2'));var moment=require('moment');var BPromise=require(_0x8c92('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8c92('0x4'));var rimraf=require(_0x8c92('0x5'));var config=require(_0x8c92('0x6'));var attributes=require('./openchannelTransferReport.attributes');module[_0x8c92('0x7')]=function(_0x433eda,_0x394ed0){return _0x433eda[_0x8c92('0x8')]('OpenchannelTransferReport',attributes,{'tableName':_0x8c92('0x9'),'paranoid':![],'indexes':[{'name':_0x8c92('0xa'),'fields':[_0x8c92('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js b/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js index 4269eec..2807880 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 _0x1a8f=['../../mysqldb','jayson/promise','client','http','request','OpenchannelTransferReport,\x20%s,\x20%s','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','catch','lodash','moment','bluebird','randomstring','ioredis'];(function(_0xfa38a8,_0x2d41bf){var _0x4c9b1d=function(_0x2ae306){while(--_0x2ae306){_0xfa38a8['push'](_0xfa38a8['shift']());}};_0x4c9b1d(++_0x2d41bf);}(_0x1a8f,0x87));var _0xf1a8=function(_0x50f92b,_0x32fab3){_0x50f92b=_0x50f92b-0x0;var _0x5cedbc=_0x1a8f[_0x50f92b];return _0x5cedbc;};'use strict';var _=require(_0xf1a8('0x0'));var util=require('util');var moment=require(_0xf1a8('0x1'));var BPromise=require(_0xf1a8('0x2'));var rs=require(_0xf1a8('0x3'));var fs=require('fs');var Redis=require(_0xf1a8('0x4'));var db=require(_0xf1a8('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xf1a8('0x6'));var client=jayson[_0xf1a8('0x7')][_0xf1a8('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x540101,_0x3f2b04,_0x4bf52d){return new BPromise(function(_0xea1eb2,_0xa74b7f){return client[_0xf1a8('0x9')](_0x540101,_0x4bf52d)['then'](function(_0x3e0a25){logger['info'](_0xf1a8('0xa'),_0x3f2b04,'request\x20sent');logger[_0xf1a8('0xb')](_0xf1a8('0xc'),_0x3f2b04,_0xf1a8('0xd'),JSON[_0xf1a8('0xe')](_0x3e0a25));if(_0x3e0a25['error']){if(_0x3e0a25[_0xf1a8('0xf')]['code']===0x1f4){logger[_0xf1a8('0xf')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x3f2b04,_0x3e0a25[_0xf1a8('0xf')][_0xf1a8('0x10')]);return _0xa74b7f(_0x3e0a25[_0xf1a8('0xf')][_0xf1a8('0x10')]);}logger[_0xf1a8('0xf')](_0xf1a8('0xa'),_0x3f2b04,_0x3e0a25[_0xf1a8('0xf')][_0xf1a8('0x10')]);return _0xea1eb2(_0x3e0a25[_0xf1a8('0xf')]['message']);}else{logger[_0xf1a8('0x11')](_0xf1a8('0xa'),_0x3f2b04,_0xf1a8('0xd'));_0xea1eb2(_0x3e0a25[_0xf1a8('0x12')][_0xf1a8('0x10')]);}})[_0xf1a8('0x13')](function(_0x671ef3){logger[_0xf1a8('0xf')](_0xf1a8('0xa'),_0x3f2b04,_0x671ef3);_0xa74b7f(_0x671ef3);});});} \ No newline at end of file +var _0x37c5=['../../config/environment','client','http','request','info','OpenchannelTransferReport,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0xa365e3,_0x695438){var _0x318a0b=function(_0x11f3f3){while(--_0x11f3f3){_0xa365e3['push'](_0xa365e3['shift']());}};_0x318a0b(++_0x695438);}(_0x37c5,0xa7));var _0x537c=function(_0x3d79d5,_0x93a1a7){_0x3d79d5=_0x3d79d5-0x0;var _0x3c664c=_0x37c5[_0x3d79d5];return _0x3c664c;};'use strict';var _=require('lodash');var util=require(_0x537c('0x0'));var moment=require(_0x537c('0x1'));var BPromise=require(_0x537c('0x2'));var rs=require(_0x537c('0x3'));var fs=require('fs');var Redis=require(_0x537c('0x4'));var db=require(_0x537c('0x5'))['db'];var utils=require(_0x537c('0x6'));var logger=require(_0x537c('0x7'))(_0x537c('0x8'));var config=require(_0x537c('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x537c('0xa')][_0x537c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x336920,_0x57666f,_0x36bf4a){return new BPromise(function(_0x67f986,_0x32b9c7){return client[_0x537c('0xc')](_0x336920,_0x36bf4a)['then'](function(_0x2c2f06){logger[_0x537c('0xd')](_0x537c('0xe'),_0x57666f,'request\x20sent');logger[_0x537c('0xf')]('OpenchannelTransferReport,\x20%s,\x20%s,\x20%s',_0x57666f,'request\x20sent',JSON[_0x537c('0x10')](_0x2c2f06));if(_0x2c2f06['error']){if(_0x2c2f06[_0x537c('0x11')][_0x537c('0x12')]===0x1f4){logger[_0x537c('0x11')](_0x537c('0xe'),_0x57666f,_0x2c2f06[_0x537c('0x11')][_0x537c('0x13')]);return _0x32b9c7(_0x2c2f06[_0x537c('0x11')][_0x537c('0x13')]);}logger[_0x537c('0x11')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x57666f,_0x2c2f06[_0x537c('0x11')][_0x537c('0x13')]);return _0x67f986(_0x2c2f06[_0x537c('0x11')][_0x537c('0x13')]);}else{logger[_0x537c('0xd')](_0x537c('0xe'),_0x57666f,_0x537c('0x14'));_0x67f986(_0x2c2f06[_0x537c('0x15')][_0x537c('0x13')]);}})['catch'](function(_0x3ae729){logger['error']('OpenchannelTransferReport,\x20%s,\x20%s',_0x57666f,_0x3ae729);_0x32b9c7(_0x3ae729);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index cfdce81..cc09e36 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 _0xd9cc=['multer','util','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','post','create','put','update','destroy','exports'];(function(_0x422e5b,_0x2e32d4){var _0x1aa264=function(_0xbf2e1f){while(--_0xbf2e1f){_0x422e5b['push'](_0x422e5b['shift']());}};_0x1aa264(++_0x2e32d4);}(_0xd9cc,0x66));var _0xcd9c=function(_0x3b5270,_0x5c48f1){_0x3b5270=_0x3b5270-0x0;var _0x34cd97=_0xd9cc[_0x3b5270];return _0x34cd97;};'use strict';var multer=require(_0xcd9c('0x0'));var util=require(_0xcd9c('0x1'));var path=require('path');var timeout=require(_0xcd9c('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xcd9c('0x3'));var auth=require(_0xcd9c('0x4'));var interaction=require(_0xcd9c('0x5'));var config=require(_0xcd9c('0x6'));var controller=require('./pause.controller');router[_0xcd9c('0x7')]('/',auth[_0xcd9c('0x8')](),controller[_0xcd9c('0x9')]);router[_0xcd9c('0x7')](_0xcd9c('0xa'),auth[_0xcd9c('0x8')](),controller['show']);router[_0xcd9c('0xb')]('/',auth[_0xcd9c('0x8')](),controller[_0xcd9c('0xc')]);router[_0xcd9c('0xd')](_0xcd9c('0xa'),auth[_0xcd9c('0x8')](),controller[_0xcd9c('0xe')]);router['delete'](_0xcd9c('0xa'),auth[_0xcd9c('0x8')](),controller[_0xcd9c('0xf')]);module[_0xcd9c('0x10')]=router; \ No newline at end of file +var _0xcc22=['post','create','isAuthenticated','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./pause.controller','get','/:id'];(function(_0x306290,_0x104eb0){var _0x28bd17=function(_0xa17e39){while(--_0xa17e39){_0x306290['push'](_0x306290['shift']());}};_0x28bd17(++_0x104eb0);}(_0xcc22,0x66));var _0x2cc2=function(_0x4431a2,_0x3c298d){_0x4431a2=_0x4431a2-0x0;var _0x31edb5=_0xcc22[_0x4431a2];return _0x31edb5;};'use strict';var multer=require(_0x2cc2('0x0'));var util=require(_0x2cc2('0x1'));var path=require(_0x2cc2('0x2'));var timeout=require('connect-timeout');var express=require(_0x2cc2('0x3'));var router=express[_0x2cc2('0x4')]();var fs_extra=require(_0x2cc2('0x5'));var auth=require(_0x2cc2('0x6'));var interaction=require(_0x2cc2('0x7'));var config=require(_0x2cc2('0x8'));var controller=require(_0x2cc2('0x9'));router[_0x2cc2('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0x2cc2('0xa')](_0x2cc2('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x2cc2('0xc')]('/',auth['isAuthenticated'](),controller[_0x2cc2('0xd')]);router['put']('/:id',auth[_0x2cc2('0xe')](),controller[_0x2cc2('0xf')]);router[_0x2cc2('0x10')](_0x2cc2('0xb'),auth[_0x2cc2('0xe')](),controller[_0x2cc2('0x11')]);module[_0x2cc2('0x12')]=router; \ No newline at end of file diff --git a/server/api/pause/pause.attributes.js b/server/api/pause/pause.attributes.js index 5dfb70d..457e504 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 _0xb77c=['exports','STRING','sequelize'];(function(_0x403fed,_0x1d78e){var _0x554177=function(_0x4c25c3){while(--_0x4c25c3){_0x403fed['push'](_0x403fed['shift']());}};_0x554177(++_0x1d78e);}(_0xb77c,0x1d9));var _0xcb77=function(_0x4c12ec,_0x2e9103){_0x4c12ec=_0x4c12ec-0x0;var _0x3ae42c=_0xb77c[_0x4c12ec];return _0x3ae42c;};'use strict';var Sequelize=require(_0xcb77('0x0'));module[_0xcb77('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0xcb77('0x2')]}}; \ No newline at end of file +var _0xfc70=['sequelize','exports','STRING','name'];(function(_0x4ceb9e,_0x291e82){var _0x259d85=function(_0x374762){while(--_0x374762){_0x4ceb9e['push'](_0x4ceb9e['shift']());}};_0x259d85(++_0x291e82);}(_0xfc70,0x8c));var _0x0fc7=function(_0x111f77,_0x804e1e){_0x111f77=_0x111f77-0x0;var _0x504550=_0xfc70[_0x111f77];return _0x504550;};'use strict';var Sequelize=require(_0x0fc7('0x0'));module[_0x0fc7('0x1')]={'name':{'type':Sequelize[_0x0fc7('0x2')],'unique':_0x0fc7('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x0fc7('0x2')]}}; \ No newline at end of file diff --git a/server/api/pause/pause.controller.js b/server/api/pause/pause.controller.js index 70346e6..3b3578b 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 _0xab9a=['update','params','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','offset','undefined','count','limit','set','Content-Range','json','apply','reject','then','destroy','get','UserProfileResource','error','stack','name','index','Pause','rawAttributes','fieldName','type','query','keys','filters','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','map','includeAll','include','findAll','catch','show','find','create','body','user','role','Pauses','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s'];(function(_0x374a3,_0x451296){var _0x38f7ad=function(_0x36c903){while(--_0x36c903){_0x374a3['push'](_0x374a3['shift']());}};_0x38f7ad(++_0x451296);}(_0xab9a,0x1ca));var _0xaab9=function(_0xc6be3a,_0x540e05){_0xc6be3a=_0xc6be3a-0x0;var _0x56a310=_0xab9a[_0xc6be3a];return _0x56a310;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xaab9('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xaab9('0x1'));var moment=require('moment');var BPromise=require(_0xaab9('0x2'));var Mustache=require(_0xaab9('0x3'));var util=require(_0xaab9('0x4'));var path=require(_0xaab9('0x5'));var sox=require(_0xaab9('0x6'));var csv=require('to-csv');var ejs=require(_0xaab9('0x7'));var fs=require('fs');var fs_extra=require(_0xaab9('0x8'));var _=require('lodash');var squel=require(_0xaab9('0x9'));var crypto=require('crypto');var jsforce=require(_0xaab9('0xa'));var deskjs=require(_0xaab9('0xb'));var toCsv=require(_0xaab9('0xc'));var querystring=require(_0xaab9('0xd'));var Papa=require(_0xaab9('0xe'));var Redis=require(_0xaab9('0xf'));var authService=require(_0xaab9('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xaab9('0x11'));var hardwareService=require(_0xaab9('0x12'));var logger=require(_0xaab9('0x13'))('api');var utils=require(_0xaab9('0x14'));var config=require(_0xaab9('0x15'));var licenseUtil=require(_0xaab9('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x742844,_0x1105e3){_0x1105e3=_0x1105e3||0xcc;return function(_0x1aac50){if(_0x1aac50){return _0x742844[_0xaab9('0x17')](_0x1105e3);}return _0x742844['status'](_0x1105e3)['end']();};}function respondWithResult(_0x32492c,_0x5aac1a){_0x5aac1a=_0x5aac1a||0xc8;return function(_0x2ace1e){if(_0x2ace1e){return _0x32492c[_0xaab9('0x18')](_0x5aac1a)['json'](_0x2ace1e);}};}function respondWithFilteredResult(_0x26da4d,_0x2b9f20){return function(_0x53ff75){if(_0x53ff75){var _0x229709=typeof _0x2b9f20[_0xaab9('0x19')]===_0xaab9('0x1a')&&typeof _0x2b9f20['limit']===_0xaab9('0x1a');var _0x272e5e=_0x53ff75[_0xaab9('0x1b')];var _0x4470c8=_0x229709?0x0:_0x2b9f20[_0xaab9('0x19')];var _0x300b85=_0x229709?_0x53ff75[_0xaab9('0x1b')]:_0x2b9f20[_0xaab9('0x19')]+_0x2b9f20[_0xaab9('0x1c')];var _0x1b0227;if(_0x300b85>=_0x272e5e){_0x300b85=_0x272e5e;_0x1b0227=0xc8;}else{_0x1b0227=0xce;}_0x26da4d[_0xaab9('0x18')](_0x1b0227);return _0x26da4d[_0xaab9('0x1d')](_0xaab9('0x1e'),_0x4470c8+'-'+_0x300b85+'/'+_0x272e5e)[_0xaab9('0x1f')](_0x53ff75);}return null;};}function patchUpdates(_0x4dcb50){return function(_0x16393c){try{jsonpatch[_0xaab9('0x20')](_0x16393c,_0x4dcb50,!![]);}catch(_0x3570bf){return BPromise[_0xaab9('0x21')](_0x3570bf);}return _0x16393c['save']();};}function saveUpdates(_0x4a254e,_0x223539){return function(_0xd35279){if(_0xd35279){return _0xd35279['update'](_0x4a254e)[_0xaab9('0x22')](function(_0x3b3688){return _0x3b3688;});}return null;};}function removeEntity(_0x43c468,_0x4b4f5b){return function(_0x569a7e){if(_0x569a7e){return _0x569a7e[_0xaab9('0x23')]()[_0xaab9('0x22')](function(){var _0x16e896=_0x569a7e[_0xaab9('0x24')]({'plain':!![]});var _0xb03b93='Pauses';return db[_0xaab9('0x25')][_0xaab9('0x23')]({'where':{'type':_0xb03b93,'resourceId':_0x16e896['id']}})[_0xaab9('0x22')](function(){return _0x569a7e;});})[_0xaab9('0x22')](function(){_0x43c468[_0xaab9('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x15091a,_0x23479e){return function(_0x48423f){if(!_0x48423f){_0x15091a[_0xaab9('0x17')](0x194);}return _0x48423f;};}function handleError(_0x2336a6,_0x3a265){_0x3a265=_0x3a265||0x1f4;return function(_0x105184){logger[_0xaab9('0x26')](_0x105184[_0xaab9('0x27')]);if(_0x105184['name']){delete _0x105184[_0xaab9('0x28')];}_0x2336a6['status'](_0x3a265)['send'](_0x105184);};}exports[_0xaab9('0x29')]=function(_0x3889b6,_0x5816cf){var _0x473589={},_0x27cbeb={},_0x1eba37={'count':0x0,'rows':[]};var _0x14f9b6=_['map'](db[_0xaab9('0x2a')][_0xaab9('0x2b')],function(_0x418696){return{'name':_0x418696[_0xaab9('0x2c')],'type':_0x418696[_0xaab9('0x2d')]['key']};});_0x27cbeb['model']=_['map'](_0x14f9b6,_0xaab9('0x28'));_0x27cbeb[_0xaab9('0x2e')]=_[_0xaab9('0x2f')](_0x3889b6[_0xaab9('0x2e')]);_0x27cbeb[_0xaab9('0x30')]=_['intersection'](_0x27cbeb[_0xaab9('0x31')],_0x27cbeb[_0xaab9('0x2e')]);_0x473589[_0xaab9('0x32')]=_['intersection'](_0x27cbeb[_0xaab9('0x31')],qs[_0xaab9('0x33')](_0x3889b6[_0xaab9('0x2e')][_0xaab9('0x33')]));_0x473589['attributes']=_0x473589[_0xaab9('0x32')]['length']?_0x473589[_0xaab9('0x32')]:_0x27cbeb[_0xaab9('0x31')];if(!_0x3889b6['query'][_0xaab9('0x34')](_0xaab9('0x35'))){_0x473589[_0xaab9('0x1c')]=qs['limit'](_0x3889b6[_0xaab9('0x2e')][_0xaab9('0x1c')]);_0x473589[_0xaab9('0x19')]=qs[_0xaab9('0x19')](_0x3889b6[_0xaab9('0x2e')][_0xaab9('0x19')]);}_0x473589[_0xaab9('0x36')]=qs['sort'](_0x3889b6[_0xaab9('0x2e')][_0xaab9('0x37')]);_0x473589[_0xaab9('0x38')]=qs[_0xaab9('0x30')](_[_0xaab9('0x39')](_0x3889b6['query'],_0x27cbeb[_0xaab9('0x30')]),_0x14f9b6);if(_0x3889b6[_0xaab9('0x2e')][_0xaab9('0x3a')]){_0x473589[_0xaab9('0x38')]=_['merge'](_0x473589[_0xaab9('0x38')],{'$or':_[_0xaab9('0x3b')](_0x14f9b6,function(_0x306412){if(_0x306412[_0xaab9('0x2d')]!=='VIRTUAL'){var _0x33ed0d={};_0x33ed0d[_0x306412['name']]={'$like':'%'+_0x3889b6[_0xaab9('0x2e')]['filter']+'%'};return _0x33ed0d;}})});}_0x473589=_['merge']({},_0x473589,_0x3889b6['options']);var _0x5eab7d={'where':_0x473589[_0xaab9('0x38')]};return db[_0xaab9('0x2a')]['count'](_0x5eab7d)['then'](function(_0x3ba16e){_0x1eba37[_0xaab9('0x1b')]=_0x3ba16e;if(_0x3889b6[_0xaab9('0x2e')][_0xaab9('0x3c')]){_0x473589[_0xaab9('0x3d')]=[{'all':!![]}];}return db['Pause'][_0xaab9('0x3e')](_0x473589);})[_0xaab9('0x22')](function(_0x12a4e3){_0x1eba37['rows']=_0x12a4e3;return _0x1eba37;})['then'](respondWithFilteredResult(_0x5816cf,_0x473589))[_0xaab9('0x3f')](handleError(_0x5816cf,null));};exports[_0xaab9('0x40')]=function(_0xbe2d42,_0x2c9108){var _0x5c99a0={'raw':!![],'where':{'id':_0xbe2d42['params']['id']}},_0x4ef488={};_0x4ef488[_0xaab9('0x31')]=_['keys'](db[_0xaab9('0x2a')]['rawAttributes']);_0x4ef488[_0xaab9('0x2e')]=_[_0xaab9('0x2f')](_0xbe2d42[_0xaab9('0x2e')]);_0x4ef488[_0xaab9('0x30')]=_['intersection'](_0x4ef488[_0xaab9('0x31')],_0x4ef488[_0xaab9('0x2e')]);_0x5c99a0[_0xaab9('0x32')]=_['intersection'](_0x4ef488[_0xaab9('0x31')],qs[_0xaab9('0x33')](_0xbe2d42[_0xaab9('0x2e')][_0xaab9('0x33')]));_0x5c99a0['attributes']=_0x5c99a0[_0xaab9('0x32')]['length']?_0x5c99a0[_0xaab9('0x32')]:_0x4ef488[_0xaab9('0x31')];if(_0xbe2d42[_0xaab9('0x2e')][_0xaab9('0x3c')]){_0x5c99a0[_0xaab9('0x3d')]=[{'all':!![]}];}_0x5c99a0=_['merge']({},_0x5c99a0,_0xbe2d42['options']);return db[_0xaab9('0x2a')][_0xaab9('0x41')](_0x5c99a0)[_0xaab9('0x22')](handleEntityNotFound(_0x2c9108,null))[_0xaab9('0x22')](respondWithResult(_0x2c9108,null))[_0xaab9('0x3f')](handleError(_0x2c9108,null));};exports[_0xaab9('0x42')]=function(_0x4c294a,_0x2c7371){return db[_0xaab9('0x2a')]['create'](_0x4c294a[_0xaab9('0x43')],{})['then'](function(_0x1b3fca){var _0x521b9d=_0x4c294a[_0xaab9('0x44')]['get']({'plain':!![]});if(!_0x521b9d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x521b9d[_0xaab9('0x45')]==='user'){var _0x48b523=_0x1b3fca['get']({'plain':!![]});var _0x4384b3=_0xaab9('0x46');return db[_0xaab9('0x47')]['find']({'where':{'name':_0x4384b3,'userProfileId':_0x521b9d[_0xaab9('0x48')]},'raw':!![]})[_0xaab9('0x22')](function(_0x486960){if(_0x486960&&_0x486960['autoAssociation']===0x0){return db[_0xaab9('0x25')][_0xaab9('0x42')]({'name':_0x48b523[_0xaab9('0x28')],'resourceId':_0x48b523['id'],'type':_0x486960[_0xaab9('0x28')],'sectionId':_0x486960['id']},{})['then'](function(){return _0x1b3fca;});}else{return _0x1b3fca;}})[_0xaab9('0x3f')](function(_0x2bd7f7){logger['error'](_0xaab9('0x49'),_0x2bd7f7);throw _0x2bd7f7;});}return _0x1b3fca;})['then'](respondWithResult(_0x2c7371,0xc9))[_0xaab9('0x3f')](handleError(_0x2c7371,null));};exports[_0xaab9('0x4a')]=function(_0x18a073,_0x1284ea){if(_0x18a073['body']['id']){delete _0x18a073[_0xaab9('0x43')]['id'];}return db[_0xaab9('0x2a')]['find']({'where':{'id':_0x18a073[_0xaab9('0x4b')]['id']}})['then'](handleEntityNotFound(_0x1284ea,null))[_0xaab9('0x22')](saveUpdates(_0x18a073['body'],null))[_0xaab9('0x22')](respondWithResult(_0x1284ea,null))[_0xaab9('0x3f')](handleError(_0x1284ea,null));};exports[_0xaab9('0x23')]=function(_0x50fafe,_0x2bd200){return db[_0xaab9('0x2a')][_0xaab9('0x41')]({'where':{'id':_0x50fafe[_0xaab9('0x4b')]['id']}})[_0xaab9('0x22')](handleEntityNotFound(_0x2bd200,null))[_0xaab9('0x22')](removeEntity(_0x2bd200,null))[_0xaab9('0x3f')](handleError(_0x2bd200,null));}; \ No newline at end of file +var _0x18ff=['../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','get','Pauses','UserProfileResource','end','stack','name','send','index','Pause','rawAttributes','fieldName','map','query','keys','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','type','VIRTUAL','includeAll','include','findAll','show','params','options','create','body','user','role','UserProfileSection','find','userProfileId','autoAssociation','catch','error','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs'];(function(_0x363ef8,_0x4ecb1a){var _0x148822=function(_0x232634){while(--_0x232634){_0x363ef8['push'](_0x363ef8['shift']());}};_0x148822(++_0x4ecb1a);}(_0x18ff,0x136));var _0xf18f=function(_0x37bd26,_0x5ad346){_0x37bd26=_0x37bd26-0x0;var _0xe83dc4=_0x18ff[_0x37bd26];return _0xe83dc4;};'use strict';var emlformat=require(_0xf18f('0x0'));var rimraf=require(_0xf18f('0x1'));var zipdir=require(_0xf18f('0x2'));var jsonpatch=require(_0xf18f('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xf18f('0x4'));var Mustache=require('mustache');var util=require(_0xf18f('0x5'));var path=require('path');var sox=require(_0xf18f('0x6'));var csv=require(_0xf18f('0x7'));var ejs=require(_0xf18f('0x8'));var fs=require('fs');var fs_extra=require(_0xf18f('0x9'));var _=require(_0xf18f('0xa'));var squel=require(_0xf18f('0xb'));var crypto=require(_0xf18f('0xc'));var jsforce=require(_0xf18f('0xd'));var deskjs=require(_0xf18f('0xe'));var toCsv=require(_0xf18f('0x7'));var querystring=require('querystring');var Papa=require(_0xf18f('0xf'));var Redis=require(_0xf18f('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xf18f('0x11'));var as=require(_0xf18f('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xf18f('0x13'));var utils=require('../../config/utils');var config=require(_0xf18f('0x14'));var licenseUtil=require(_0xf18f('0x15'));var db=require(_0xf18f('0x16'))['db'];function respondWithStatusCode(_0x476947,_0x288565){_0x288565=_0x288565||0xcc;return function(_0x519a6d){if(_0x519a6d){return _0x476947[_0xf18f('0x17')](_0x288565);}return _0x476947[_0xf18f('0x18')](_0x288565)['end']();};}function respondWithResult(_0x143806,_0x1b0c35){_0x1b0c35=_0x1b0c35||0xc8;return function(_0x3e1ce1){if(_0x3e1ce1){return _0x143806['status'](_0x1b0c35)[_0xf18f('0x19')](_0x3e1ce1);}};}function respondWithFilteredResult(_0x17af43,_0x2a5091){return function(_0x54680d){if(_0x54680d){var _0x2a3778=typeof _0x2a5091[_0xf18f('0x1a')]===_0xf18f('0x1b')&&typeof _0x2a5091[_0xf18f('0x1c')]===_0xf18f('0x1b');var _0x16b116=_0x54680d[_0xf18f('0x1d')];var _0x47fa28=_0x2a3778?0x0:_0x2a5091[_0xf18f('0x1a')];var _0x247823=_0x2a3778?_0x54680d['count']:_0x2a5091[_0xf18f('0x1a')]+_0x2a5091[_0xf18f('0x1c')];var _0x238a24;if(_0x247823>=_0x16b116){_0x247823=_0x16b116;_0x238a24=0xc8;}else{_0x238a24=0xce;}_0x17af43[_0xf18f('0x18')](_0x238a24);return _0x17af43[_0xf18f('0x1e')](_0xf18f('0x1f'),_0x47fa28+'-'+_0x247823+'/'+_0x16b116)['json'](_0x54680d);}return null;};}function patchUpdates(_0x5ef5a5){return function(_0x4b1ef0){try{jsonpatch[_0xf18f('0x20')](_0x4b1ef0,_0x5ef5a5,!![]);}catch(_0x26112f){return BPromise[_0xf18f('0x21')](_0x26112f);}return _0x4b1ef0[_0xf18f('0x22')]();};}function saveUpdates(_0x503323,_0x401db3){return function(_0x4d95b0){if(_0x4d95b0){return _0x4d95b0['update'](_0x503323)[_0xf18f('0x23')](function(_0x4a6fe9){return _0x4a6fe9;});}return null;};}function removeEntity(_0x447387,_0x12fd0b){return function(_0x542555){if(_0x542555){return _0x542555[_0xf18f('0x24')]()[_0xf18f('0x23')](function(){var _0x2b5db9=_0x542555[_0xf18f('0x25')]({'plain':!![]});var _0x4c5ac9=_0xf18f('0x26');return db[_0xf18f('0x27')][_0xf18f('0x24')]({'where':{'type':_0x4c5ac9,'resourceId':_0x2b5db9['id']}})[_0xf18f('0x23')](function(){return _0x542555;});})[_0xf18f('0x23')](function(){_0x447387[_0xf18f('0x18')](0xcc)[_0xf18f('0x28')]();});}};}function handleEntityNotFound(_0x51229e,_0x3c886f){return function(_0x31d931){if(!_0x31d931){_0x51229e['sendStatus'](0x194);}return _0x31d931;};}function handleError(_0x2a7fee,_0x403c34){_0x403c34=_0x403c34||0x1f4;return function(_0x10644a){logger['error'](_0x10644a[_0xf18f('0x29')]);if(_0x10644a[_0xf18f('0x2a')]){delete _0x10644a[_0xf18f('0x2a')];}_0x2a7fee['status'](_0x403c34)[_0xf18f('0x2b')](_0x10644a);};}exports[_0xf18f('0x2c')]=function(_0x318f95,_0x54c8d0){var _0x2ce8c0={},_0x5ce72e={},_0x438f26={'count':0x0,'rows':[]};var _0x39008f=_['map'](db[_0xf18f('0x2d')][_0xf18f('0x2e')],function(_0x39c2ee){return{'name':_0x39c2ee[_0xf18f('0x2f')],'type':_0x39c2ee['type']['key']};});_0x5ce72e['model']=_[_0xf18f('0x30')](_0x39008f,_0xf18f('0x2a'));_0x5ce72e[_0xf18f('0x31')]=_[_0xf18f('0x32')](_0x318f95[_0xf18f('0x31')]);_0x5ce72e['filters']=_['intersection'](_0x5ce72e[_0xf18f('0x33')],_0x5ce72e[_0xf18f('0x31')]);_0x2ce8c0[_0xf18f('0x34')]=_[_0xf18f('0x35')](_0x5ce72e['model'],qs[_0xf18f('0x36')](_0x318f95[_0xf18f('0x31')][_0xf18f('0x36')]));_0x2ce8c0[_0xf18f('0x34')]=_0x2ce8c0['attributes'][_0xf18f('0x37')]?_0x2ce8c0['attributes']:_0x5ce72e[_0xf18f('0x33')];if(!_0x318f95[_0xf18f('0x31')][_0xf18f('0x38')](_0xf18f('0x39'))){_0x2ce8c0['limit']=qs[_0xf18f('0x1c')](_0x318f95['query'][_0xf18f('0x1c')]);_0x2ce8c0[_0xf18f('0x1a')]=qs[_0xf18f('0x1a')](_0x318f95[_0xf18f('0x31')][_0xf18f('0x1a')]);}_0x2ce8c0[_0xf18f('0x3a')]=qs[_0xf18f('0x3b')](_0x318f95[_0xf18f('0x31')]['sort']);_0x2ce8c0[_0xf18f('0x3c')]=qs[_0xf18f('0x3d')](_['pick'](_0x318f95[_0xf18f('0x31')],_0x5ce72e[_0xf18f('0x3d')]),_0x39008f);if(_0x318f95['query'][_0xf18f('0x3e')]){_0x2ce8c0[_0xf18f('0x3c')]=_[_0xf18f('0x3f')](_0x2ce8c0[_0xf18f('0x3c')],{'$or':_[_0xf18f('0x30')](_0x39008f,function(_0x503fcb){if(_0x503fcb[_0xf18f('0x40')]!==_0xf18f('0x41')){var _0x11fac3={};_0x11fac3[_0x503fcb[_0xf18f('0x2a')]]={'$like':'%'+_0x318f95[_0xf18f('0x31')][_0xf18f('0x3e')]+'%'};return _0x11fac3;}})});}_0x2ce8c0=_[_0xf18f('0x3f')]({},_0x2ce8c0,_0x318f95['options']);var _0x28497e={'where':_0x2ce8c0['where']};return db['Pause'][_0xf18f('0x1d')](_0x28497e)['then'](function(_0x27bf41){_0x438f26[_0xf18f('0x1d')]=_0x27bf41;if(_0x318f95['query'][_0xf18f('0x42')]){_0x2ce8c0[_0xf18f('0x43')]=[{'all':!![]}];}return db[_0xf18f('0x2d')][_0xf18f('0x44')](_0x2ce8c0);})[_0xf18f('0x23')](function(_0x6be1b7){_0x438f26['rows']=_0x6be1b7;return _0x438f26;})[_0xf18f('0x23')](respondWithFilteredResult(_0x54c8d0,_0x2ce8c0))['catch'](handleError(_0x54c8d0,null));};exports[_0xf18f('0x45')]=function(_0x3b0b5e,_0x3df725){var _0x5f1f0d={'raw':!![],'where':{'id':_0x3b0b5e[_0xf18f('0x46')]['id']}},_0x16644e={};_0x16644e[_0xf18f('0x33')]=_[_0xf18f('0x32')](db[_0xf18f('0x2d')][_0xf18f('0x2e')]);_0x16644e[_0xf18f('0x31')]=_[_0xf18f('0x32')](_0x3b0b5e[_0xf18f('0x31')]);_0x16644e[_0xf18f('0x3d')]=_[_0xf18f('0x35')](_0x16644e['model'],_0x16644e[_0xf18f('0x31')]);_0x5f1f0d[_0xf18f('0x34')]=_[_0xf18f('0x35')](_0x16644e[_0xf18f('0x33')],qs['fields'](_0x3b0b5e[_0xf18f('0x31')][_0xf18f('0x36')]));_0x5f1f0d['attributes']=_0x5f1f0d['attributes'][_0xf18f('0x37')]?_0x5f1f0d['attributes']:_0x16644e[_0xf18f('0x33')];if(_0x3b0b5e[_0xf18f('0x31')][_0xf18f('0x42')]){_0x5f1f0d[_0xf18f('0x43')]=[{'all':!![]}];}_0x5f1f0d=_[_0xf18f('0x3f')]({},_0x5f1f0d,_0x3b0b5e[_0xf18f('0x47')]);return db[_0xf18f('0x2d')]['find'](_0x5f1f0d)['then'](handleEntityNotFound(_0x3df725,null))[_0xf18f('0x23')](respondWithResult(_0x3df725,null))['catch'](handleError(_0x3df725,null));};exports[_0xf18f('0x48')]=function(_0x38ed22,_0x15b44b){return db[_0xf18f('0x2d')][_0xf18f('0x48')](_0x38ed22[_0xf18f('0x49')],{})[_0xf18f('0x23')](function(_0x3f2906){var _0x52a185=_0x38ed22[_0xf18f('0x4a')][_0xf18f('0x25')]({'plain':!![]});if(!_0x52a185)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x52a185[_0xf18f('0x4b')]===_0xf18f('0x4a')){var _0x4dbbef=_0x3f2906['get']({'plain':!![]});var _0x496daa='Pauses';return db[_0xf18f('0x4c')][_0xf18f('0x4d')]({'where':{'name':_0x496daa,'userProfileId':_0x52a185[_0xf18f('0x4e')]},'raw':!![]})[_0xf18f('0x23')](function(_0x15b9de){if(_0x15b9de&&_0x15b9de[_0xf18f('0x4f')]===0x0){return db['UserProfileResource'][_0xf18f('0x48')]({'name':_0x4dbbef['name'],'resourceId':_0x4dbbef['id'],'type':_0x15b9de[_0xf18f('0x2a')],'sectionId':_0x15b9de['id']},{})[_0xf18f('0x23')](function(){return _0x3f2906;});}else{return _0x3f2906;}})[_0xf18f('0x50')](function(_0x2fe0d5){logger[_0xf18f('0x51')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2fe0d5);throw _0x2fe0d5;});}return _0x3f2906;})[_0xf18f('0x23')](respondWithResult(_0x15b44b,0xc9))['catch'](handleError(_0x15b44b,null));};exports['update']=function(_0x578c0f,_0x53039b){if(_0x578c0f[_0xf18f('0x49')]['id']){delete _0x578c0f[_0xf18f('0x49')]['id'];}return db['Pause']['find']({'where':{'id':_0x578c0f['params']['id']}})[_0xf18f('0x23')](handleEntityNotFound(_0x53039b,null))[_0xf18f('0x23')](saveUpdates(_0x578c0f[_0xf18f('0x49')],null))[_0xf18f('0x23')](respondWithResult(_0x53039b,null))[_0xf18f('0x50')](handleError(_0x53039b,null));};exports[_0xf18f('0x24')]=function(_0x240c54,_0x40bd66){return db['Pause'][_0xf18f('0x4d')]({'where':{'id':_0x240c54[_0xf18f('0x46')]['id']}})[_0xf18f('0x23')](handleEntityNotFound(_0x40bd66,null))[_0xf18f('0x23')](removeEntity(_0x40bd66,null))[_0xf18f('0x50')](handleError(_0x40bd66,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index ba45d84..c7d3377 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 _0xe14b=['bluebird','path','./pause.attributes','exports','define','Pause','tools_pauses','lodash','util','moment'];(function(_0x320cb1,_0x145acc){var _0x2b5b68=function(_0x31d673){while(--_0x31d673){_0x320cb1['push'](_0x320cb1['shift']());}};_0x2b5b68(++_0x145acc);}(_0xe14b,0x93));var _0xbe14=function(_0x38e228,_0x38c6d6){_0x38e228=_0x38e228-0x0;var _0x14de9e=_0xe14b[_0x38e228];return _0x14de9e;};'use strict';var _=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xbe14('0x2'));var BPromise=require(_0xbe14('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbe14('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xbe14('0x5'));module[_0xbe14('0x6')]=function(_0x1fe204,_0x1ff100){return _0x1fe204[_0xbe14('0x7')](_0xbe14('0x8'),attributes,{'tableName':_0xbe14('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9957=['exports','define','Pause','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./pause.attributes'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0x9957,0x93));var _0x7995=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x9957[_0x3b380d];return _0x54502b;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'tools_pauses','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/pause/pause.rpc.js b/server/api/pause/pause.rpc.js index 04c12df..615982b 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(_0x5098ae,_0x58c03e){var _0x160c2f=function(_0x257390){while(--_0x257390){_0x5098ae['push'](_0x5098ae['shift']());}};_0x160c2f(++_0x58c03e);}(_0xb10b,0x12a));var _0xbb10=function(_0x5baf32,_0x103278){_0x5baf32=_0x5baf32-0x0;var _0x539cae=_0xb10b[_0x5baf32];return _0x539cae;};'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 _0x7a54=['message','request\x20sent','result','catch','Pause','find','options','raw','where','attributes','map','include','model','ShowPause','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','Pause,\x20%s,\x20%s','debug','stringify','error','code'];(function(_0x53df8f,_0x11fec8){var _0x32c6d8=function(_0x1d9351){while(--_0x1d9351){_0x53df8f['push'](_0x53df8f['shift']());}};_0x32c6d8(++_0x11fec8);}(_0x7a54,0x106));var _0x47a5=function(_0x151908,_0x389063){_0x151908=_0x151908-0x0;var _0x55470a=_0x7a54[_0x151908];return _0x55470a;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('Pause,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});}exports['ShowPause']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')]({'raw':_0x5247fd[_0x47a5('0x17')]?_0x5247fd[_0x47a5('0x17')][_0x47a5('0x18')]===undefined?!![]:![]:!![],'where':_0x5247fd[_0x47a5('0x17')]?_0x5247fd['options'][_0x47a5('0x19')]||null:null,'attributes':_0x5247fd[_0x47a5('0x17')]?_0x5247fd['options'][_0x47a5('0x1a')]||null:null,'include':_0x5247fd[_0x47a5('0x17')]?_0x5247fd[_0x47a5('0x17')]['include']?_[_0x47a5('0x1b')](_0x5247fd[_0x47a5('0x17')][_0x47a5('0x1c')],function(_0x7a9f9e){return{'model':db[_0x7a9f9e['model']],'as':_0x7a9f9e['as'],'attributes':_0x7a9f9e[_0x47a5('0x1a')],'include':_0x7a9f9e[_0x47a5('0x1c')]?_['map'](_0x7a9f9e[_0x47a5('0x1c')],function(_0xc4cd63){return{'model':db[_0xc4cd63[_0x47a5('0x1d')]],'as':_0xc4cd63['as'],'attributes':_0xc4cd63[_0x47a5('0x1a')],'include':_0xc4cd63[_0x47a5('0x1c')]?_['map'](_0xc4cd63['include'],function(_0x136745){return{'model':db[_0x136745['model']],'as':_0x136745['as'],'attributes':_0x136745[_0x47a5('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x23cb77){logger[_0x47a5('0xb')](_0x47a5('0x1e'),_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1e'),_0x5247fd,JSON[_0x47a5('0xe')](_0x23cb77));_0xaf70a6(_0x23cb77);})[_0x47a5('0x14')](function(_0x136b14){logger[_0x47a5('0xf')](_0x47a5('0x1e'),_0x136b14[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81[_0x47a5('0xf')](0x1f4,_0x136b14[_0x47a5('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/index.js b/server/api/plugin/index.js index c9e793a..048ebe1 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 _0x984b=['Router','../../components/interaction/service','../../config/environment','isAuthenticated','index','/webhook','webhookGet','/:id','show','get','/:id/download','download','diskStorage','join','root','server/files/plugins','originalname','format','%s-%s%s','extname','now','post','file','upload','put','update','delete','exports','connect-timeout','express'];(function(_0x5aee3c,_0x21e0c2){var _0x359474=function(_0x80c424){while(--_0x80c424){_0x5aee3c['push'](_0x5aee3c['shift']());}};_0x359474(++_0x21e0c2);}(_0x984b,0xee));var _0xb984=function(_0x5bb0e9,_0x1aecd3){_0x5bb0e9=_0x5bb0e9-0x0;var _0x48b04e=_0x984b[_0x5bb0e9];return _0x48b04e;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xb984('0x0'));var express=require(_0xb984('0x1'));var router=express[_0xb984('0x2')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xb984('0x3'));var config=require(_0xb984('0x4'));var controller=require('./plugin.controller');router['get']('/',auth[_0xb984('0x5')](),controller[_0xb984('0x6')]);router['get'](_0xb984('0x7'),controller[_0xb984('0x8')]);router['get'](_0xb984('0x9'),auth['isAuthenticated'](),controller[_0xb984('0xa')]);router[_0xb984('0xb')](_0xb984('0xc'),auth[_0xb984('0x5')](),controller[_0xb984('0xd')]);var upload=multer({'storage':multer[_0xb984('0xe')]({'destination':function(_0x11525c,_0xfca315,_0x16d46f){_0x16d46f(null,path[_0xb984('0xf')](config[_0xb984('0x10')],_0xb984('0x11')));},'filename':function(_0x5b4add,_0x1b922b,_0x4b9c75){_0x1b922b[_0xb984('0x12')]=_0x1b922b[_0xb984('0x12')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x4b9c75(null,util[_0xb984('0x13')](_0xb984('0x14'),path['basename'](_0x1b922b[_0xb984('0x12')],path[_0xb984('0x15')](_0x1b922b['originalname'])),Date[_0xb984('0x16')](),path[_0xb984('0x15')](_0x1b922b['originalname'])));}})});router[_0xb984('0x17')]('/',upload['single'](_0xb984('0x18')),controller[_0xb984('0x19')]);router[_0xb984('0x17')](_0xb984('0x7'),controller['webhookPost']);router[_0xb984('0x1a')](_0xb984('0x9'),auth[_0xb984('0x5')](),controller[_0xb984('0x1b')]);router[_0xb984('0x1c')](_0xb984('0x9'),auth['isAuthenticated'](),controller[_0xb984('0x1c')]);module[_0xb984('0x1d')]=router; \ No newline at end of file +var _0x7bae=['../../components/interaction/service','../../config/environment','./plugin.controller','get','isAuthenticated','index','/webhook','webhookGet','/:id','show','/:id/download','download','diskStorage','join','root','originalname','replace','format','%s-%s%s','extname','now','upload','update','delete','exports','path','connect-timeout','Router','../../components/auth/service'];(function(_0x5b984b,_0x355e68){var _0x52e07d=function(_0x5b5064){while(--_0x5b5064){_0x5b984b['push'](_0x5b984b['shift']());}};_0x52e07d(++_0x355e68);}(_0x7bae,0x13b));var _0xe7ba=function(_0x5e3b04,_0xbb6795){_0x5e3b04=_0x5e3b04-0x0;var _0x1fc44d=_0x7bae[_0x5e3b04];return _0x1fc44d;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xe7ba('0x0'));var timeout=require(_0xe7ba('0x1'));var express=require('express');var router=express[_0xe7ba('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xe7ba('0x3'));var interaction=require(_0xe7ba('0x4'));var config=require(_0xe7ba('0x5'));var controller=require(_0xe7ba('0x6'));router[_0xe7ba('0x7')]('/',auth[_0xe7ba('0x8')](),controller[_0xe7ba('0x9')]);router[_0xe7ba('0x7')](_0xe7ba('0xa'),controller[_0xe7ba('0xb')]);router[_0xe7ba('0x7')](_0xe7ba('0xc'),auth[_0xe7ba('0x8')](),controller[_0xe7ba('0xd')]);router['get'](_0xe7ba('0xe'),auth[_0xe7ba('0x8')](),controller[_0xe7ba('0xf')]);var upload=multer({'storage':multer[_0xe7ba('0x10')]({'destination':function(_0x15083a,_0x1672f0,_0x99a86f){_0x99a86f(null,path[_0xe7ba('0x11')](config[_0xe7ba('0x12')],'server/files/plugins'));},'filename':function(_0xf4fcb0,_0x588c8b,_0x602b1){_0x588c8b[_0xe7ba('0x13')]=_0x588c8b[_0xe7ba('0x13')][_0xe7ba('0x14')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x602b1(null,util[_0xe7ba('0x15')](_0xe7ba('0x16'),path['basename'](_0x588c8b['originalname'],path[_0xe7ba('0x17')](_0x588c8b[_0xe7ba('0x13')])),Date[_0xe7ba('0x18')](),path['extname'](_0x588c8b[_0xe7ba('0x13')])));}})});router['post']('/',upload['single']('file'),controller[_0xe7ba('0x19')]);router['post'](_0xe7ba('0xa'),controller['webhookPost']);router['put']('/:id',auth[_0xe7ba('0x8')](),controller[_0xe7ba('0x1a')]);router[_0xe7ba('0x1b')](_0xe7ba('0xc'),auth[_0xe7ba('0x8')](),controller['delete']);module[_0xe7ba('0x1c')]=router; \ No newline at end of file diff --git a/server/api/plugin/plugin.attributes.js b/server/api/plugin/plugin.attributes.js index d03621a..53a6330 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 _0x11e8=['ENUM','html','script','TEXT','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','BOOLEAN','adminOnly','agentOnly','always','sequelize','STRING'];(function(_0x1190c2,_0x2c078b){var _0x6ec988=function(_0x333cdf){while(--_0x333cdf){_0x1190c2['push'](_0x1190c2['shift']());}};_0x6ec988(++_0x2c078b);}(_0x11e8,0x1b6));var _0x811e=function(_0x1da91c,_0x1758ec){_0x1da91c=_0x1da91c-0x0;var _0x407931=_0x11e8[_0x1da91c];return _0x407931;};'use strict';var Sequelize=require(_0x811e('0x0'));module['exports']={'name':{'type':Sequelize[_0x811e('0x1')]},'type':{'type':Sequelize[_0x811e('0x2')](_0x811e('0x3'),_0x811e('0x4'))},'description':{'type':Sequelize[_0x811e('0x5')]},'version':{'type':Sequelize[_0x811e('0x5')]},'path':{'type':Sequelize['STRING'],'comment':_0x811e('0x6')},'active':{'type':Sequelize[_0x811e('0x7')],'defaultValue':0x0,'comment':'Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.'},'sidebar':{'type':Sequelize['ENUM'](_0x811e('0x8'),_0x811e('0x9'),_0x811e('0xa'),'never'),'defaultValue':_0x811e('0xa'),'comment':'Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.'},'icon':{'type':Sequelize[_0x811e('0x1')]},'adminUrl':{'type':Sequelize[_0x811e('0x1')]},'agentUrl':{'type':Sequelize[_0x811e('0x1')]},'scriptName':{'type':Sequelize['STRING']},'scriptPath':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x4abb=['TEXT','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','adminOnly','agentOnly','always','never','sequelize','STRING','ENUM','html','script'];(function(_0x38537f,_0x252124){var _0x141e23=function(_0x2809b5){while(--_0x2809b5){_0x38537f['push'](_0x38537f['shift']());}};_0x141e23(++_0x252124);}(_0x4abb,0xb6));var _0xb4ab=function(_0x2918f9,_0x54494c){_0x2918f9=_0x2918f9-0x0;var _0x457968=_0x4abb[_0x2918f9];return _0x457968;};'use strict';var Sequelize=require(_0xb4ab('0x0'));module['exports']={'name':{'type':Sequelize[_0xb4ab('0x1')]},'type':{'type':Sequelize[_0xb4ab('0x2')](_0xb4ab('0x3'),_0xb4ab('0x4'))},'description':{'type':Sequelize[_0xb4ab('0x5')]},'version':{'type':Sequelize[_0xb4ab('0x5')]},'path':{'type':Sequelize[_0xb4ab('0x1')],'comment':_0xb4ab('0x6')},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':'Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.'},'sidebar':{'type':Sequelize[_0xb4ab('0x2')](_0xb4ab('0x7'),_0xb4ab('0x8'),_0xb4ab('0x9'),_0xb4ab('0xa')),'defaultValue':'always','comment':'Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.'},'icon':{'type':Sequelize['STRING']},'adminUrl':{'type':Sequelize[_0xb4ab('0x1')]},'agentUrl':{'type':Sequelize[_0xb4ab('0x1')]},'scriptName':{'type':Sequelize[_0xb4ab('0x1')]},'scriptPath':{'type':Sequelize[_0xb4ab('0x1')]}}; \ No newline at end of file diff --git a/server/api/plugin/plugin.controller.js b/server/api/plugin/plugin.controller.js index ea8294d..5fef175 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 _0xe339=['error','stack','name','send','index','map','Plugin','rawAttributes','fieldName','type','key','model','keys','query','attributes','intersection','fields','length','nolimit','order','sort','where','filters','pick','filter','merge','options','includeAll','rows','catch','show','params','find','download','path','join','server/files/plugins','format','%s.zip','basename','createWriteStream','zip','warning','code','ENOENT','Sequelize','Error\x20while\x20generating\x20the\x20zip\x20archive','Error','glob','**/*','root','node_modules/**/*','attachments/**/*','close','existsSync','Plugin\x20not\x20found','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','Download\x20completed','info','Temporary\x20file\x20removed','upload','file','filename','extname','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','chmodSync','0777','Invalid\x20plugin\x20structure','lstatSync','isFile','isDirectory','readdirSync','some','manifest.json','Plugin\x20manifest\x20missing','readFileSync','parse','Invalid\x20manifest:\x20name\x20missing','version','Invalid\x20manifest:\x20version\x20not\x20specified','Invalid\x20manifest:\x20parameters\x20missing','html','parameters','views','Invalid\x20manifest:\x20views\x20missing','admin','agent','Invalid\x20manifest:\x20no\x20view\x20specified','script','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','description','sidebar','always','icon','test','Warning:\x20admin\x20view\x20not\x20specified','plugins','Warning:\x20agent\x20view\x20not\x20specified','create','body','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Extracted\x20folder\x20removed','delete','webhookGet','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','http://localhost:','encoding','method','%s%s','headers','content-length','content-type','endsWith','statusCode','webhookPost','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','ejs','lodash','squel','crypto','to-csv','querystring','papaparse','extract-zip','archiver','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','then','get','Plugins','UserProfileResource','destroy'];(function(_0x1915bf,_0x3c427b){var _0x301bb8=function(_0x1dc17f){while(--_0x1dc17f){_0x1915bf['push'](_0x1915bf['shift']());}};_0x301bb8(++_0x3c427b);}(_0xe339,0x132));var _0x9e33=function(_0xa911e,_0x1a9f9a){_0xa911e=_0xa911e-0x0;var _0x28bd6f=_0xe339[_0xa911e];return _0x28bd6f;};'use strict';var emlformat=require(_0x9e33('0x0'));var rimraf=require(_0x9e33('0x1'));var zipdir=require(_0x9e33('0x2'));var jsonpatch=require(_0x9e33('0x3'));var rp=require(_0x9e33('0x4'));var moment=require(_0x9e33('0x5'));var BPromise=require(_0x9e33('0x6'));var Mustache=require('mustache');var util=require(_0x9e33('0x7'));var path=require('path');var sox=require(_0x9e33('0x8'));var csv=require('to-csv');var ejs=require(_0x9e33('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9e33('0xa'));var squel=require(_0x9e33('0xb'));var crypto=require(_0x9e33('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x9e33('0xd'));var querystring=require(_0x9e33('0xe'));var Papa=require(_0x9e33('0xf'));var extract=require(_0x9e33('0x10'));var rimraf=require(_0x9e33('0x1'));var archiver=require(_0x9e33('0x11'));var Redis=require(_0x9e33('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x9e33('0x13'));var as=require(_0x9e33('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9e33('0x15'))(_0x9e33('0x16'));var utils=require(_0x9e33('0x17'));var config=require(_0x9e33('0x18'));var licenseUtil=require(_0x9e33('0x19'));var db=require(_0x9e33('0x1a'))['db'];config[_0x9e33('0x1b')]=_[_0x9e33('0x1c')](config['redis'],{'host':_0x9e33('0x1d'),'port':0x18eb});var socket=require(_0x9e33('0x1e'))(new Redis(config[_0x9e33('0x1b')]));require('./plugin.socket')[_0x9e33('0x1f')](socket);function respondWithStatusCode(_0x1da9a3,_0x453eef){_0x453eef=_0x453eef||0xcc;return function(_0x5d3c3f){if(_0x5d3c3f){return _0x1da9a3[_0x9e33('0x20')](_0x453eef);}return _0x1da9a3[_0x9e33('0x21')](_0x453eef)[_0x9e33('0x22')]();};}function respondWithResult(_0x57c533,_0x77672c){_0x77672c=_0x77672c||0xc8;return function(_0x248c8d){if(_0x248c8d){return _0x57c533[_0x9e33('0x21')](_0x77672c)[_0x9e33('0x23')](_0x248c8d);}};}function respondWithFilteredResult(_0x3e7d23,_0x518350){return function(_0xc4d5fc){if(_0xc4d5fc){var _0x4cea0d=typeof _0x518350[_0x9e33('0x24')]===_0x9e33('0x25')&&typeof _0x518350[_0x9e33('0x26')]===_0x9e33('0x25');var _0x347d6d=_0xc4d5fc['count'];var _0x406293=_0x4cea0d?0x0:_0x518350[_0x9e33('0x24')];var _0x2a6a46=_0x4cea0d?_0xc4d5fc[_0x9e33('0x27')]:_0x518350[_0x9e33('0x24')]+_0x518350[_0x9e33('0x26')];var _0x2f6c2e;if(_0x2a6a46>=_0x347d6d){_0x2a6a46=_0x347d6d;_0x2f6c2e=0xc8;}else{_0x2f6c2e=0xce;}_0x3e7d23[_0x9e33('0x21')](_0x2f6c2e);return _0x3e7d23[_0x9e33('0x28')](_0x9e33('0x29'),_0x406293+'-'+_0x2a6a46+'/'+_0x347d6d)[_0x9e33('0x23')](_0xc4d5fc);}return null;};}function patchUpdates(_0x1a760e){return function(_0x50242d){try{jsonpatch['apply'](_0x50242d,_0x1a760e,!![]);}catch(_0x5f115b){return BPromise[_0x9e33('0x2a')](_0x5f115b);}return _0x50242d['save']();};}function saveUpdates(_0x1e5b3,_0xa98ae){return function(_0x5029f7){if(_0x5029f7){return _0x5029f7['update'](_0x1e5b3)[_0x9e33('0x2b')](function(_0x503e41){return _0x503e41;});}return null;};}function removeEntity(_0x522736,_0x4e5cf6){return function(_0x539bfc){if(_0x539bfc){return _0x539bfc['destroy']()[_0x9e33('0x2b')](function(){var _0x44ac29=_0x539bfc[_0x9e33('0x2c')]({'plain':!![]});var _0x4d586d=_0x9e33('0x2d');return db[_0x9e33('0x2e')][_0x9e33('0x2f')]({'where':{'type':_0x4d586d,'resourceId':_0x44ac29['id']}})[_0x9e33('0x2b')](function(){return _0x539bfc;});})[_0x9e33('0x2b')](function(){_0x522736[_0x9e33('0x21')](0xcc)[_0x9e33('0x22')]();});}};}function handleEntityNotFound(_0x3a5886,_0x4f0db6){return function(_0x470d1e){if(!_0x470d1e){_0x3a5886[_0x9e33('0x20')](0x194);}return _0x470d1e;};}function handleError(_0x32eac8,_0x169976){_0x169976=_0x169976||0x1f4;return function(_0x415e1e){logger[_0x9e33('0x30')](_0x415e1e[_0x9e33('0x31')]);if(_0x415e1e['name']){delete _0x415e1e[_0x9e33('0x32')];}_0x32eac8['status'](_0x169976)[_0x9e33('0x33')](_0x415e1e);};}exports[_0x9e33('0x34')]=function(_0x16e730,_0x3b2b31){var _0x121218={},_0x396db2={},_0x4d637a={'count':0x0,'rows':[]};var _0x2dae3b=_[_0x9e33('0x35')](db[_0x9e33('0x36')][_0x9e33('0x37')],function(_0x3ec0b0){return{'name':_0x3ec0b0[_0x9e33('0x38')],'type':_0x3ec0b0[_0x9e33('0x39')][_0x9e33('0x3a')]};});_0x396db2[_0x9e33('0x3b')]=_[_0x9e33('0x35')](_0x2dae3b,_0x9e33('0x32'));_0x396db2['query']=_[_0x9e33('0x3c')](_0x16e730[_0x9e33('0x3d')]);_0x396db2['filters']=_['intersection'](_0x396db2[_0x9e33('0x3b')],_0x396db2['query']);_0x121218[_0x9e33('0x3e')]=_[_0x9e33('0x3f')](_0x396db2[_0x9e33('0x3b')],qs['fields'](_0x16e730[_0x9e33('0x3d')][_0x9e33('0x40')]));_0x121218['attributes']=_0x121218['attributes'][_0x9e33('0x41')]?_0x121218['attributes']:_0x396db2['model'];if(!_0x16e730[_0x9e33('0x3d')]['hasOwnProperty'](_0x9e33('0x42'))){_0x121218[_0x9e33('0x26')]=qs[_0x9e33('0x26')](_0x16e730[_0x9e33('0x3d')][_0x9e33('0x26')]);_0x121218[_0x9e33('0x24')]=qs[_0x9e33('0x24')](_0x16e730['query'][_0x9e33('0x24')]);}_0x121218[_0x9e33('0x43')]=qs[_0x9e33('0x44')](_0x16e730['query'][_0x9e33('0x44')]);_0x121218[_0x9e33('0x45')]=qs[_0x9e33('0x46')](_[_0x9e33('0x47')](_0x16e730['query'],_0x396db2[_0x9e33('0x46')]),_0x2dae3b);if(_0x16e730[_0x9e33('0x3d')][_0x9e33('0x48')]){_0x121218[_0x9e33('0x45')]=_[_0x9e33('0x49')](_0x121218[_0x9e33('0x45')],{'$or':_[_0x9e33('0x35')](_0x2dae3b,function(_0x123ff9){if(_0x123ff9[_0x9e33('0x39')]!=='VIRTUAL'){var _0x25dff8={};_0x25dff8[_0x123ff9['name']]={'$like':'%'+_0x16e730[_0x9e33('0x3d')][_0x9e33('0x48')]+'%'};return _0x25dff8;}})});}_0x121218=_[_0x9e33('0x49')]({},_0x121218,_0x16e730[_0x9e33('0x4a')]);var _0x413c77={'where':_0x121218[_0x9e33('0x45')]};return db[_0x9e33('0x36')][_0x9e33('0x27')](_0x413c77)[_0x9e33('0x2b')](function(_0x547e45){_0x4d637a[_0x9e33('0x27')]=_0x547e45;if(_0x16e730[_0x9e33('0x3d')][_0x9e33('0x4b')]){_0x121218['include']=[{'all':!![]}];}return db[_0x9e33('0x36')]['findAll'](_0x121218);})['then'](function(_0x16f204){_0x4d637a[_0x9e33('0x4c')]=_0x16f204;return _0x4d637a;})[_0x9e33('0x2b')](respondWithFilteredResult(_0x3b2b31,_0x121218))[_0x9e33('0x4d')](handleError(_0x3b2b31,null));};exports[_0x9e33('0x4e')]=function(_0x4c3834,_0x1b5a53){var _0x155c8c={'raw':!![],'where':{'id':_0x4c3834[_0x9e33('0x4f')]['id']}},_0x48de25={};_0x48de25['model']=_[_0x9e33('0x3c')](db[_0x9e33('0x36')][_0x9e33('0x37')]);_0x48de25[_0x9e33('0x3d')]=_[_0x9e33('0x3c')](_0x4c3834[_0x9e33('0x3d')]);_0x48de25[_0x9e33('0x46')]=_[_0x9e33('0x3f')](_0x48de25[_0x9e33('0x3b')],_0x48de25['query']);_0x155c8c[_0x9e33('0x3e')]=_[_0x9e33('0x3f')](_0x48de25[_0x9e33('0x3b')],qs[_0x9e33('0x40')](_0x4c3834['query'][_0x9e33('0x40')]));_0x155c8c[_0x9e33('0x3e')]=_0x155c8c['attributes'][_0x9e33('0x41')]?_0x155c8c[_0x9e33('0x3e')]:_0x48de25[_0x9e33('0x3b')];if(_0x4c3834[_0x9e33('0x3d')][_0x9e33('0x4b')]){_0x155c8c['include']=[{'all':!![]}];}_0x155c8c=_[_0x9e33('0x49')]({},_0x155c8c,_0x4c3834[_0x9e33('0x4a')]);return db[_0x9e33('0x36')][_0x9e33('0x50')](_0x155c8c)[_0x9e33('0x2b')](handleEntityNotFound(_0x1b5a53,null))[_0x9e33('0x2b')](respondWithResult(_0x1b5a53,null))['catch'](handleError(_0x1b5a53,null));};exports[_0x9e33('0x51')]=function(_0x3b58c5,_0x599fdb,_0x3b7eeb){return db['Plugin'][_0x9e33('0x50')]({'where':{'id':_0x3b58c5[_0x9e33('0x4f')]['id']},'attributes':[_0x9e33('0x32'),_0x9e33('0x52')],'raw':!![]})['then'](handleEntityNotFound(_0x599fdb,null))[_0x9e33('0x2b')](function(_0x47d199){if(_0x47d199){var _0x12f56b=path[_0x9e33('0x53')](config['root'],_0x9e33('0x54'),util[_0x9e33('0x55')](_0x9e33('0x56'),path[_0x9e33('0x57')](_0x47d199[_0x9e33('0x52')])));var _0x41e6ff=fs[_0x9e33('0x58')](_0x12f56b);var _0x1b02d9=archiver(_0x9e33('0x59'),{'zlib':{'level':0x9}});_0x1b02d9['on'](_0x9e33('0x5a'),function(_0x2d2dae){if(_0x2d2dae[_0x9e33('0x5b')]===_0x9e33('0x5c')){logger[_0x9e33('0x30')](_0x2d2dae);}else{throw new db[(_0x9e33('0x5d'))]['Error'](_0x9e33('0x5e'));}});_0x1b02d9['on'](_0x9e33('0x30'),function(_0x1b9f73){throw new db[(_0x9e33('0x5d'))][(_0x9e33('0x5f'))](_0x9e33('0x5e'));});_0x1b02d9['pipe'](_0x41e6ff);_0x1b02d9[_0x9e33('0x60')](_0x9e33('0x61'),{'cwd':path[_0x9e33('0x53')](config[_0x9e33('0x62')],'server/files/plugins',path['dirname'](_0x47d199[_0x9e33('0x52')])),'ignore':[path[_0x9e33('0x53')](path['basename'](_0x47d199[_0x9e33('0x52')]),_0x9e33('0x63')),path[_0x9e33('0x53')](path[_0x9e33('0x57')](_0x47d199[_0x9e33('0x52')]),_0x9e33('0x64'))],'nodir':!![]})['finalize']();_0x41e6ff['on'](_0x9e33('0x65'),function(){if(!fs[_0x9e33('0x66')](_0x12f56b)){throw new db[(_0x9e33('0x5d'))][(_0x9e33('0x5f'))](_0x9e33('0x67'));}return _0x599fdb[_0x9e33('0x51')](_0x12f56b,util[_0x9e33('0x55')]('%s.zip',path[_0x9e33('0x57')](_0x47d199[_0x9e33('0x52')])),function(_0x5ef58b){if(_0x5ef58b){throw new db[(_0x9e33('0x5d'))][(_0x9e33('0x5f'))](_0x9e33('0x68'));}fs[_0x9e33('0x69')](_0x12f56b);logger['info'](_0x9e33('0x6a'));logger[_0x9e33('0x6b')](_0x9e33('0x6c'));});});}return null;})[_0x9e33('0x4d')](handleError(_0x599fdb,null));};exports[_0x9e33('0x6d')]=function(_0x115f4a,_0x4a741b,_0x1cb6c0){var _0x16d56a=path[_0x9e33('0x57')](_0x115f4a[_0x9e33('0x6e')][_0x9e33('0x6f')],path[_0x9e33('0x70')](_0x115f4a[_0x9e33('0x6e')]['filename']));var _0x49aab7=path[_0x9e33('0x53')](config[_0x9e33('0x62')],_0x9e33('0x54'),_0x115f4a[_0x9e33('0x6e')]['filename']);var _0x334bf8=path[_0x9e33('0x53')](config[_0x9e33('0x62')],_0x9e33('0x54'),_0x16d56a);logger[_0x9e33('0x6b')](_0x9e33('0x71'),_0x49aab7);logger[_0x9e33('0x6b')](_0x9e33('0x72'),_0x334bf8);try{fs[_0x9e33('0x73')](_0x49aab7,parseInt(_0x9e33('0x74'),0x8));extract(_0x49aab7,{'dir':_0x334bf8},function(_0x1d3726){if(_0x1d3726){logger[_0x9e33('0x30')](_0x1d3726);handleError(_0x1d3726,!![]);};var _0x508da2=fs['readdirSync'](_0x334bf8);if(_0x508da2[_0x9e33('0x41')]>0x1){removeReferences(_0x49aab7,_0x334bf8);logger[_0x9e33('0x30')](_0x9e33('0x75'));return _0x1cb6c0(new Error('Invalid\x20plugin\x20structure'));}var _0x27effb=fs[_0x9e33('0x76')](path[_0x9e33('0x53')](_0x334bf8,_0x508da2[0x0]));if(_0x27effb[_0x9e33('0x77')]()){removeReferences(_0x49aab7,_0x334bf8);logger[_0x9e33('0x30')](_0x9e33('0x75'));return _0x1cb6c0(new Error(_0x9e33('0x75')));}if(_0x27effb[_0x9e33('0x78')]()){var _0x54a8be=fs[_0x9e33('0x79')](path[_0x9e33('0x53')](_0x334bf8,_0x508da2[0x0]));if(_0x54a8be[_0x9e33('0x41')]===0x0){removeReferences(_0x49aab7,_0x334bf8);logger[_0x9e33('0x30')](_0x9e33('0x75'));return _0x1cb6c0(new Error('Invalid\x20plugin\x20structure'));}var _0x295a27=_0x54a8be[_0x9e33('0x7a')](function(_0x43afcc){return _0x43afcc===_0x9e33('0x7b');});if(!_0x295a27){return _0x1cb6c0(new Error(_0x9e33('0x7c')));}var _0xae408f=fs[_0x9e33('0x7d')](path[_0x9e33('0x53')](_0x334bf8,_0x508da2[0x0],_0x9e33('0x7b')));var _0x5c1fe2=JSON[_0x9e33('0x7e')](_0xae408f);if('undefined'==typeof _0x5c1fe2['name']){return _0x1cb6c0(new Error(_0x9e33('0x7f')));}if(_0x9e33('0x25')==typeof _0x5c1fe2['type']){return _0x1cb6c0(new Error('Invalid\x20manifest:\x20type\x20missing'));}if(_0x9e33('0x25')==typeof _0x5c1fe2[_0x9e33('0x80')]){return _0x1cb6c0(new Error(_0x9e33('0x81')));}if(_0x9e33('0x25')==typeof _0x5c1fe2['parameters']){return _0x1cb6c0(new Error(_0x9e33('0x82')));}if(_0x5c1fe2[_0x9e33('0x39')]===_0x9e33('0x83')){if('undefined'==typeof _0x5c1fe2[_0x9e33('0x84')][_0x9e33('0x85')]){return _0x1cb6c0(new Error(_0x9e33('0x86')));}if(_0x9e33('0x25')==typeof _0x5c1fe2[_0x9e33('0x84')][_0x9e33('0x85')][_0x9e33('0x87')]&&'undefined'==typeof _0x5c1fe2[_0x9e33('0x84')][_0x9e33('0x85')][_0x9e33('0x88')]){return _0x1cb6c0(new Error(_0x9e33('0x89')));}}else if(_0x5c1fe2['type']===_0x9e33('0x8a')){if(_0x9e33('0x25')==typeof _0x5c1fe2[_0x9e33('0x84')][_0x9e33('0x8b')]){return _0x1cb6c0(new Error(_0x9e33('0x8c')));}if(_0x9e33('0x25')==typeof _0x5c1fe2[_0x9e33('0x84')][_0x9e33('0x8d')]){return _0x1cb6c0(new Error(_0x9e33('0x8e')));}}else{return _0x1cb6c0(new Error('Invalid\x20manifest:\x20invalid\x20type'));}var _0x1b6bcf=_0x5c1fe2[_0x9e33('0x32')];var _0x263fea=_0x5c1fe2[_0x9e33('0x8f')];var _0x24b454=_0x5c1fe2[_0x9e33('0x39')];var _0x35a80b=_0x5c1fe2[_0x9e33('0x90')]?_0x5c1fe2[_0x9e33('0x90')]:_0x9e33('0x91');var _0x1814f0=_0x5c1fe2[_0x9e33('0x92')]?_0x5c1fe2[_0x9e33('0x92')]:'icon-apps';var _0xa5be4c='';var _0x12e917='';var _0x43d873='';var _0x1aedb7='';var _0x32b022=_0x5c1fe2[_0x9e33('0x80')];if(_0x24b454==='html'){if('undefined'!=typeof _0x5c1fe2[_0x9e33('0x84')]['views']['admin']){var _0x1ad6e8=_0x5c1fe2[_0x9e33('0x84')][_0x9e33('0x85')][_0x9e33('0x87')];if(!/^(f|ht)tps?:\/\//i[_0x9e33('0x93')](_0x1ad6e8)){_0xa5be4c=path['join']('plugins',_0x16d56a,_0x508da2[0x0],_0x1ad6e8);}else{_0xa5be4c=_0x1ad6e8;}}else{logger[_0x9e33('0x6b')](_0x9e33('0x94'));}if(_0x9e33('0x25')!=typeof _0x5c1fe2['parameters'][_0x9e33('0x85')][_0x9e33('0x88')]){var _0x5fa95e=_0x5c1fe2['parameters'][_0x9e33('0x85')]['agent'];if(!/^(f|ht)tps?:\/\//i[_0x9e33('0x93')](_0x5fa95e)){_0x12e917=path[_0x9e33('0x53')](_0x9e33('0x95'),_0x16d56a,_0x508da2[0x0],_0x5fa95e);}else{_0x12e917=_0x5fa95e;}}else{logger['info'](_0x9e33('0x96'));}}else if(_0x24b454===_0x9e33('0x8a')){_0x43d873=_0x5c1fe2[_0x9e33('0x84')][_0x9e33('0x8b')];_0x1aedb7=_0x5c1fe2['parameters'][_0x9e33('0x8d')];if('undefined'!=typeof _0x5c1fe2[_0x9e33('0x84')][_0x9e33('0x85')]){if('undefined'!=typeof _0x5c1fe2[_0x9e33('0x84')][_0x9e33('0x85')][_0x9e33('0x87')]){var _0x1ad6e8=_0x5c1fe2[_0x9e33('0x84')][_0x9e33('0x85')][_0x9e33('0x87')];if(!/^(f|ht)tps?:\/\//i[_0x9e33('0x93')](_0x1ad6e8)){_0xa5be4c=path[_0x9e33('0x53')]('plugins',_0x16d56a,_0x508da2[0x0],_0x1ad6e8);}else{_0xa5be4c=_0x1ad6e8;}}if(_0x9e33('0x25')!=typeof _0x5c1fe2['parameters'][_0x9e33('0x85')][_0x9e33('0x88')]){var _0x5fa95e=_0x5c1fe2['parameters']['views'][_0x9e33('0x88')];if(!/^(f|ht)tps?:\/\//i[_0x9e33('0x93')](_0x5fa95e)){_0x12e917=path[_0x9e33('0x53')](_0x9e33('0x95'),_0x16d56a,_0x508da2[0x0],_0x5fa95e);}else{_0x12e917=_0x5fa95e;}}}}var _0x1d3805={'name':_0x1b6bcf,'description':_0x263fea,'path':path[_0x9e33('0x53')](_0x16d56a,_0x508da2[0x0]),'type':_0x24b454,'sidebar':_0x35a80b,'icon':_0x1814f0,'adminUrl':_0xa5be4c,'agentUrl':_0x12e917,'scriptName':_0x43d873,'scriptPath':_0x1aedb7,'version':_0x32b022};removeReferences(_0x49aab7,null);return db['Plugin'][_0x9e33('0x97')](_0x1d3805)[_0x9e33('0x2b')](function(_0x2fffb0){var _0x38a2c7={'role':_0x115f4a[_0x9e33('0x98')]['role'],'userProfileId':_0x115f4a[_0x9e33('0x98')][_0x9e33('0x99')]};if(!_0x38a2c7)throw new Error(_0x9e33('0x9a'));if(_0x38a2c7['role']===_0x9e33('0x9b')){var _0x52d23d=_0x2fffb0['get']({'plain':!![]});return db[_0x9e33('0x9c')][_0x9e33('0x50')]({'where':{'name':_0x9e33('0x2d'),'userProfileId':_0x38a2c7['userProfileId']},'raw':!![]})['then'](function(_0x25c722){if(_0x25c722&&_0x25c722[_0x9e33('0x9d')]===0x0){return db[_0x9e33('0x2e')][_0x9e33('0x97')]({'name':_0x52d23d[_0x9e33('0x32')],'resourceId':_0x52d23d['id'],'type':_0x25c722[_0x9e33('0x32')],'sectionId':_0x25c722['id']},{})[_0x9e33('0x2b')](function(){return _0x2fffb0;});}else{return _0x2fffb0;}})['catch'](function(_0x3ff43e){logger[_0x9e33('0x30')](_0x9e33('0x9e'),_0x3ff43e);throw _0x3ff43e;});}return _0x2fffb0;})[_0x9e33('0x2b')](respondWithResult(_0x4a741b,null))[_0x9e33('0x4d')](handleError(_0x4a741b,null));}});}catch(_0xee5114){_0x4a741b[_0x9e33('0x21')](0x1f4)[_0x9e33('0x33')](_0xee5114);}};function removeReferences(_0x3b8eac,_0x4c02cf){try{if(_0x3b8eac){fs[_0x9e33('0x69')](_0x3b8eac);logger[_0x9e33('0x6b')]('Zip\x20archive\x20removed');}if(_0x4c02cf){rimraf(_0x4c02cf,function(){});logger['info'](_0x9e33('0x9f'));}}catch(_0x58eb21){logger[_0x9e33('0x30')](_0x58eb21);}}exports['update']=function(_0x5ca9e5,_0xe3ba22,_0x5632a2){return db['Plugin'][_0x9e33('0x50')]({'where':{'id':_0x5ca9e5[_0x9e33('0x4f')]['id']}})[_0x9e33('0x2b')](handleEntityNotFound(_0xe3ba22,null))[_0x9e33('0x2b')](saveUpdates(_0x5ca9e5['body'],null))['then'](respondWithResult(_0xe3ba22,null))[_0x9e33('0x4d')](handleError(_0xe3ba22,null));};exports[_0x9e33('0xa0')]=function(_0x24ac56,_0x552203,_0x273018){return db[_0x9e33('0x36')]['find']({'where':{'id':_0x24ac56['params']['id']}})['then'](function(_0x2a4149){if(_0x2a4149){return _0x2a4149[_0x9e33('0x2f')]();}})[_0x9e33('0x2b')](function(_0x504eb9){rimraf(path[_0x9e33('0x53')](config['root'],_0x9e33('0x54'),path['dirname'](_0x504eb9[_0x9e33('0x52')])),function(){});return _0x504eb9;})['then'](handleEntityNotFound(_0x552203,null))[_0x9e33('0x2b')](respondWithStatusCode(_0x552203,null))[_0x9e33('0x4d')](handleError(_0x552203,null));};exports[_0x9e33('0xa1')]=function(_0x13b0ef,_0x47c30f,_0x391ee6){return BPromise[_0x9e33('0xa2')]()[_0x9e33('0x2b')](function(){if(!_0x13b0ef[_0x9e33('0x3d')][_0x9e33('0x52')]){throw new Error(_0x9e33('0xa3'));}if(!_0x13b0ef[_0x9e33('0x3d')][_0x9e33('0xa4')]){throw new Error(_0x9e33('0xa5'));}var _0x403312=_0x13b0ef[_0x9e33('0x3d')][_0x9e33('0xa6')]?_0x13b0ef[_0x9e33('0x3d')][_0x9e33('0xa6')]+':'+_0x13b0ef[_0x9e33('0x3d')][_0x9e33('0xa4')]:_0x9e33('0xa7')+_0x13b0ef[_0x9e33('0x3d')][_0x9e33('0xa4')];var _0x3cfa69=_0x13b0ef[_0x9e33('0x3d')][_0x9e33('0x23')]?_0x13b0ef[_0x9e33('0x3d')][_0x9e33('0x23')]:!![];var _0xfe3d2a=_0x13b0ef['query']['encoding']?_0x13b0ef[_0x9e33('0x3d')][_0x9e33('0xa8')]:null;var _0x4e4a57={'method':_0x13b0ef[_0x9e33('0xa9')],'uri':util[_0x9e33('0x55')](_0x9e33('0xaa'),_0x403312,_0x13b0ef[_0x9e33('0x3d')][_0x9e33('0x52')]),'json':_0x3cfa69,'resolveWithFullResponse':!![],'encoding':_0xfe3d2a,'qs':_0x13b0ef[_0x9e33('0x3d')]};if(_0x13b0ef[_0x9e33('0xab')]){_0x4e4a57[_0x9e33('0xab')]=_0x13b0ef['headers'];if(_0x4e4a57[_0x9e33('0xab')][_0x9e33('0xac')]){delete _0x4e4a57[_0x9e33('0xab')][_0x9e33('0xac')];}}if(_0x4e4a57[_0x9e33('0xab')][_0x9e33('0xad')]){delete _0x4e4a57[_0x9e33('0xab')]['content-type'];}return rp(_0x4e4a57);})[_0x9e33('0x2b')](function(_0x5c4e9c){if(_0x5c4e9c){_0x47c30f[_0x9e33('0x28')](_0x5c4e9c['headers']);logger[_0x9e33('0x6b')](_0x5c4e9c['body']);if(_[_0x9e33('0xae')](_0x13b0ef['query'][_0x9e33('0x52')],_0x9e33('0x51'))&&_0x5c4e9c[_0x9e33('0xaf')]==0x1f4){return _0x47c30f[_0x9e33('0x20')](_0x5c4e9c[_0x9e33('0xaf')]);}else{return _0x47c30f[_0x9e33('0x21')](_0x5c4e9c['statusCode'])[_0x9e33('0x33')](_0x5c4e9c['body']);}}else{return _0x47c30f[_0x9e33('0x20')](0xc8);}})[_0x9e33('0x4d')](handleError(_0x47c30f,null));};exports[_0x9e33('0xb0')]=function(_0x2eb204,_0xc26204,_0xb1c4b){return BPromise['resolve']()[_0x9e33('0x2b')](function(){if(!_0x2eb204[_0x9e33('0x3d')][_0x9e33('0x52')]){throw new Error(_0x9e33('0xa3'));}if(!_0x2eb204['query'][_0x9e33('0xa4')]){throw new Error(_0x9e33('0xa5'));}var _0x3e2fa2=_0x2eb204['query'][_0x9e33('0xa6')]?_0x2eb204[_0x9e33('0x3d')]['hostname']+':'+_0x2eb204[_0x9e33('0x3d')][_0x9e33('0xa4')]:_0x9e33('0xa7')+_0x2eb204[_0x9e33('0x3d')][_0x9e33('0xa4')];var _0x1bf8be=_0x2eb204[_0x9e33('0x3d')][_0x9e33('0x23')]?_0x2eb204[_0x9e33('0x3d')][_0x9e33('0x23')]:!![];var _0x1e7828=_0x2eb204[_0x9e33('0x3d')][_0x9e33('0xa8')]?_0x2eb204[_0x9e33('0x3d')]['encoding']:null;var _0x338c10={'method':_0x2eb204['method'],'uri':util['format'](_0x9e33('0xaa'),_0x3e2fa2,_0x2eb204['query'][_0x9e33('0x52')]),'json':_0x1bf8be,'resolveWithFullResponse':!![],'encoding':_0x1e7828,'body':_0x2eb204[_0x9e33('0x98')]};if(_0x2eb204[_0x9e33('0xab')]){_0x338c10[_0x9e33('0xab')]=_0x2eb204[_0x9e33('0xab')];if(_0x338c10[_0x9e33('0xab')][_0x9e33('0xac')]){delete _0x338c10['headers']['content-length'];}}if(_0x338c10[_0x9e33('0xab')][_0x9e33('0xad')]){delete _0x338c10[_0x9e33('0xab')][_0x9e33('0xad')];}return rp(_0x338c10);})[_0x9e33('0x2b')](function(_0x198606){if(_0x198606){_0xc26204[_0x9e33('0x28')](_0x198606[_0x9e33('0xab')]);logger[_0x9e33('0x6b')](_0x198606['body']);return _0xc26204[_0x9e33('0x21')](_0x198606['statusCode'])[_0x9e33('0x33')](_0x198606[_0x9e33('0x98')]);}else{return _0xc26204['sendStatus'](0xc8);}})[_0x9e33('0x4d')](handleError(_0xc26204,null));}; \ No newline at end of file +var _0xbf3f=['nolimit','order','sort','where','merge','VIRTUAL','filter','options','include','findAll','rows','catch','show','params','keys','find','root','server/files/plugins','format','basename','path','createWriteStream','warning','code','ENOENT','Sequelize','Error\x20while\x20generating\x20the\x20zip\x20archive','Error','pipe','glob','**/*','join','node_modules/**/*','attachments/**/*','finalize','close','existsSync','Plugin\x20not\x20found','download','%s.zip','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','info','Download\x20completed','Temporary\x20file\x20removed','upload','file','filename','extname','Plugin\x20upload\x20destination:\x20%s','chmodSync','0777','readdirSync','Invalid\x20plugin\x20structure','lstatSync','some','manifest.json','Plugin\x20manifest\x20missing','readFileSync','parse','Invalid\x20manifest:\x20type\x20missing','version','parameters','html','views','Invalid\x20manifest:\x20views\x20missing','admin','agent','script','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','always','icon','icon-apps','plugins','Warning:\x20admin\x20view\x20not\x20specified','test','Warning:\x20agent\x20view\x20not\x20specified','create','body','role','user','UserProfileSection','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Extracted\x20folder\x20removed','update','delete','dirname','webhookGet','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','http://localhost:','encoding','method','%s%s','headers','content-length','content-type','set','endsWith','statusCode','webhookPost','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','extract-zip','archiver','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','end','offset','limit','undefined','count','status','Content-Range','json','apply','save','then','Plugins','error','stack','name','send','map','Plugin','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty'];(function(_0x14342f,_0x1e978c){var _0x58bf4f=function(_0x34a303){while(--_0x34a303){_0x14342f['push'](_0x14342f['shift']());}};_0x58bf4f(++_0x1e978c);}(_0xbf3f,0x11e));var _0xfbf3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbf3f[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xfbf3('0x0'));var rimraf=require(_0xfbf3('0x1'));var zipdir=require(_0xfbf3('0x2'));var jsonpatch=require(_0xfbf3('0x3'));var rp=require(_0xfbf3('0x4'));var moment=require(_0xfbf3('0x5'));var BPromise=require(_0xfbf3('0x6'));var Mustache=require('mustache');var util=require(_0xfbf3('0x7'));var path=require('path');var sox=require(_0xfbf3('0x8'));var csv=require(_0xfbf3('0x9'));var ejs=require(_0xfbf3('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xfbf3('0xb'));var squel=require(_0xfbf3('0xc'));var crypto=require(_0xfbf3('0xd'));var jsforce=require(_0xfbf3('0xe'));var deskjs=require(_0xfbf3('0xf'));var toCsv=require(_0xfbf3('0x9'));var querystring=require(_0xfbf3('0x10'));var Papa=require(_0xfbf3('0x11'));var extract=require(_0xfbf3('0x12'));var rimraf=require(_0xfbf3('0x1'));var archiver=require(_0xfbf3('0x13'));var Redis=require(_0xfbf3('0x14'));var authService=require(_0xfbf3('0x15'));var qs=require(_0xfbf3('0x16'));var as=require(_0xfbf3('0x17'));var hardwareService=require(_0xfbf3('0x18'));var logger=require('../../config/logger')(_0xfbf3('0x19'));var utils=require('../../config/utils');var config=require(_0xfbf3('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0xfbf3('0x1b'))['db'];config[_0xfbf3('0x1c')]=_[_0xfbf3('0x1d')](config[_0xfbf3('0x1c')],{'host':_0xfbf3('0x1e'),'port':0x18eb});var socket=require(_0xfbf3('0x1f'))(new Redis(config[_0xfbf3('0x1c')]));require('./plugin.socket')[_0xfbf3('0x20')](socket);function respondWithStatusCode(_0x425b16,_0xa987fa){_0xa987fa=_0xa987fa||0xcc;return function(_0xb3e1e1){if(_0xb3e1e1){return _0x425b16[_0xfbf3('0x21')](_0xa987fa);}return _0x425b16['status'](_0xa987fa)[_0xfbf3('0x22')]();};}function respondWithResult(_0xcb2a9f,_0x32f6b2){_0x32f6b2=_0x32f6b2||0xc8;return function(_0x16b753){if(_0x16b753){return _0xcb2a9f['status'](_0x32f6b2)['json'](_0x16b753);}};}function respondWithFilteredResult(_0x4488b1,_0x5b1b00){return function(_0x520a81){if(_0x520a81){var _0x4fce85=typeof _0x5b1b00[_0xfbf3('0x23')]==='undefined'&&typeof _0x5b1b00[_0xfbf3('0x24')]===_0xfbf3('0x25');var _0xdf038d=_0x520a81[_0xfbf3('0x26')];var _0x5ebae0=_0x4fce85?0x0:_0x5b1b00[_0xfbf3('0x23')];var _0x5b7ffd=_0x4fce85?_0x520a81[_0xfbf3('0x26')]:_0x5b1b00[_0xfbf3('0x23')]+_0x5b1b00['limit'];var _0x5cb245;if(_0x5b7ffd>=_0xdf038d){_0x5b7ffd=_0xdf038d;_0x5cb245=0xc8;}else{_0x5cb245=0xce;}_0x4488b1[_0xfbf3('0x27')](_0x5cb245);return _0x4488b1['set'](_0xfbf3('0x28'),_0x5ebae0+'-'+_0x5b7ffd+'/'+_0xdf038d)[_0xfbf3('0x29')](_0x520a81);}return null;};}function patchUpdates(_0x452f7b){return function(_0x4b4ff6){try{jsonpatch[_0xfbf3('0x2a')](_0x4b4ff6,_0x452f7b,!![]);}catch(_0x4618a8){return BPromise['reject'](_0x4618a8);}return _0x4b4ff6[_0xfbf3('0x2b')]();};}function saveUpdates(_0x3104cf,_0x222914){return function(_0x4f2118){if(_0x4f2118){return _0x4f2118['update'](_0x3104cf)[_0xfbf3('0x2c')](function(_0x5b4af4){return _0x5b4af4;});}return null;};}function removeEntity(_0x29b757,_0x37438b){return function(_0xf3f444){if(_0xf3f444){return _0xf3f444['destroy']()[_0xfbf3('0x2c')](function(){var _0x4c25e8=_0xf3f444['get']({'plain':!![]});var _0x559322=_0xfbf3('0x2d');return db['UserProfileResource']['destroy']({'where':{'type':_0x559322,'resourceId':_0x4c25e8['id']}})[_0xfbf3('0x2c')](function(){return _0xf3f444;});})[_0xfbf3('0x2c')](function(){_0x29b757[_0xfbf3('0x27')](0xcc)['end']();});}};}function handleEntityNotFound(_0x48ec92,_0x347740){return function(_0x361dc7){if(!_0x361dc7){_0x48ec92[_0xfbf3('0x21')](0x194);}return _0x361dc7;};}function handleError(_0x3ff55a,_0x5cca72){_0x5cca72=_0x5cca72||0x1f4;return function(_0x27bfd3){logger[_0xfbf3('0x2e')](_0x27bfd3[_0xfbf3('0x2f')]);if(_0x27bfd3[_0xfbf3('0x30')]){delete _0x27bfd3[_0xfbf3('0x30')];}_0x3ff55a['status'](_0x5cca72)[_0xfbf3('0x31')](_0x27bfd3);};}exports['index']=function(_0x41de63,_0x4e68bf){var _0x2fe4f6={},_0x562d1c={},_0x281f63={'count':0x0,'rows':[]};var _0x84bd4a=_[_0xfbf3('0x32')](db[_0xfbf3('0x33')][_0xfbf3('0x34')],function(_0xa6fb28){return{'name':_0xa6fb28[_0xfbf3('0x35')],'type':_0xa6fb28[_0xfbf3('0x36')][_0xfbf3('0x37')]};});_0x562d1c[_0xfbf3('0x38')]=_[_0xfbf3('0x32')](_0x84bd4a,_0xfbf3('0x30'));_0x562d1c[_0xfbf3('0x39')]=_['keys'](_0x41de63[_0xfbf3('0x39')]);_0x562d1c[_0xfbf3('0x3a')]=_[_0xfbf3('0x3b')](_0x562d1c['model'],_0x562d1c[_0xfbf3('0x39')]);_0x2fe4f6['attributes']=_[_0xfbf3('0x3b')](_0x562d1c[_0xfbf3('0x38')],qs[_0xfbf3('0x3c')](_0x41de63[_0xfbf3('0x39')][_0xfbf3('0x3c')]));_0x2fe4f6[_0xfbf3('0x3d')]=_0x2fe4f6[_0xfbf3('0x3d')][_0xfbf3('0x3e')]?_0x2fe4f6[_0xfbf3('0x3d')]:_0x562d1c[_0xfbf3('0x38')];if(!_0x41de63['query'][_0xfbf3('0x3f')](_0xfbf3('0x40'))){_0x2fe4f6[_0xfbf3('0x24')]=qs['limit'](_0x41de63[_0xfbf3('0x39')][_0xfbf3('0x24')]);_0x2fe4f6['offset']=qs[_0xfbf3('0x23')](_0x41de63[_0xfbf3('0x39')][_0xfbf3('0x23')]);}_0x2fe4f6[_0xfbf3('0x41')]=qs[_0xfbf3('0x42')](_0x41de63[_0xfbf3('0x39')][_0xfbf3('0x42')]);_0x2fe4f6[_0xfbf3('0x43')]=qs[_0xfbf3('0x3a')](_['pick'](_0x41de63['query'],_0x562d1c[_0xfbf3('0x3a')]),_0x84bd4a);if(_0x41de63['query']['filter']){_0x2fe4f6['where']=_[_0xfbf3('0x44')](_0x2fe4f6['where'],{'$or':_['map'](_0x84bd4a,function(_0x2a45c3){if(_0x2a45c3[_0xfbf3('0x36')]!==_0xfbf3('0x45')){var _0xac71f={};_0xac71f[_0x2a45c3[_0xfbf3('0x30')]]={'$like':'%'+_0x41de63[_0xfbf3('0x39')][_0xfbf3('0x46')]+'%'};return _0xac71f;}})});}_0x2fe4f6=_[_0xfbf3('0x44')]({},_0x2fe4f6,_0x41de63[_0xfbf3('0x47')]);var _0x1d3dc6={'where':_0x2fe4f6['where']};return db[_0xfbf3('0x33')]['count'](_0x1d3dc6)[_0xfbf3('0x2c')](function(_0x207ce1){_0x281f63[_0xfbf3('0x26')]=_0x207ce1;if(_0x41de63['query']['includeAll']){_0x2fe4f6[_0xfbf3('0x48')]=[{'all':!![]}];}return db[_0xfbf3('0x33')][_0xfbf3('0x49')](_0x2fe4f6);})['then'](function(_0x2feda3){_0x281f63[_0xfbf3('0x4a')]=_0x2feda3;return _0x281f63;})[_0xfbf3('0x2c')](respondWithFilteredResult(_0x4e68bf,_0x2fe4f6))[_0xfbf3('0x4b')](handleError(_0x4e68bf,null));};exports[_0xfbf3('0x4c')]=function(_0x5718c1,_0x512886){var _0x5880b7={'raw':!![],'where':{'id':_0x5718c1[_0xfbf3('0x4d')]['id']}},_0x5e5593={};_0x5e5593[_0xfbf3('0x38')]=_[_0xfbf3('0x4e')](db[_0xfbf3('0x33')][_0xfbf3('0x34')]);_0x5e5593[_0xfbf3('0x39')]=_['keys'](_0x5718c1[_0xfbf3('0x39')]);_0x5e5593[_0xfbf3('0x3a')]=_['intersection'](_0x5e5593[_0xfbf3('0x38')],_0x5e5593[_0xfbf3('0x39')]);_0x5880b7[_0xfbf3('0x3d')]=_[_0xfbf3('0x3b')](_0x5e5593[_0xfbf3('0x38')],qs[_0xfbf3('0x3c')](_0x5718c1['query'][_0xfbf3('0x3c')]));_0x5880b7[_0xfbf3('0x3d')]=_0x5880b7[_0xfbf3('0x3d')][_0xfbf3('0x3e')]?_0x5880b7[_0xfbf3('0x3d')]:_0x5e5593['model'];if(_0x5718c1[_0xfbf3('0x39')]['includeAll']){_0x5880b7[_0xfbf3('0x48')]=[{'all':!![]}];}_0x5880b7=_['merge']({},_0x5880b7,_0x5718c1[_0xfbf3('0x47')]);return db['Plugin'][_0xfbf3('0x4f')](_0x5880b7)[_0xfbf3('0x2c')](handleEntityNotFound(_0x512886,null))['then'](respondWithResult(_0x512886,null))[_0xfbf3('0x4b')](handleError(_0x512886,null));};exports['download']=function(_0xd6556b,_0x241d43,_0x184ed9){return db[_0xfbf3('0x33')]['find']({'where':{'id':_0xd6556b[_0xfbf3('0x4d')]['id']},'attributes':['name','path'],'raw':!![]})[_0xfbf3('0x2c')](handleEntityNotFound(_0x241d43,null))['then'](function(_0x377bf4){if(_0x377bf4){var _0x3f6b98=path['join'](config[_0xfbf3('0x50')],_0xfbf3('0x51'),util[_0xfbf3('0x52')]('%s.zip',path[_0xfbf3('0x53')](_0x377bf4[_0xfbf3('0x54')])));var _0x3be2f8=fs[_0xfbf3('0x55')](_0x3f6b98);var _0x4f2bdb=archiver('zip',{'zlib':{'level':0x9}});_0x4f2bdb['on'](_0xfbf3('0x56'),function(_0x4e89f0){if(_0x4e89f0[_0xfbf3('0x57')]===_0xfbf3('0x58')){logger['error'](_0x4e89f0);}else{throw new db[(_0xfbf3('0x59'))]['Error'](_0xfbf3('0x5a'));}});_0x4f2bdb['on'](_0xfbf3('0x2e'),function(_0x4e0906){throw new db[(_0xfbf3('0x59'))][(_0xfbf3('0x5b'))]('Error\x20while\x20generating\x20the\x20zip\x20archive');});_0x4f2bdb[_0xfbf3('0x5c')](_0x3be2f8);_0x4f2bdb[_0xfbf3('0x5d')](_0xfbf3('0x5e'),{'cwd':path[_0xfbf3('0x5f')](config[_0xfbf3('0x50')],_0xfbf3('0x51'),path['dirname'](_0x377bf4[_0xfbf3('0x54')])),'ignore':[path[_0xfbf3('0x5f')](path[_0xfbf3('0x53')](_0x377bf4[_0xfbf3('0x54')]),_0xfbf3('0x60')),path[_0xfbf3('0x5f')](path['basename'](_0x377bf4['path']),_0xfbf3('0x61'))],'nodir':!![]})[_0xfbf3('0x62')]();_0x3be2f8['on'](_0xfbf3('0x63'),function(){if(!fs[_0xfbf3('0x64')](_0x3f6b98)){throw new db[(_0xfbf3('0x59'))][(_0xfbf3('0x5b'))](_0xfbf3('0x65'));}return _0x241d43[_0xfbf3('0x66')](_0x3f6b98,util[_0xfbf3('0x52')](_0xfbf3('0x67'),path[_0xfbf3('0x53')](_0x377bf4['path'])),function(_0x17e813){if(_0x17e813){throw new db[(_0xfbf3('0x59'))][(_0xfbf3('0x5b'))](_0xfbf3('0x68'));}fs[_0xfbf3('0x69')](_0x3f6b98);logger[_0xfbf3('0x6a')](_0xfbf3('0x6b'));logger['info'](_0xfbf3('0x6c'));});});}return null;})[_0xfbf3('0x4b')](handleError(_0x241d43,null));};exports[_0xfbf3('0x6d')]=function(_0x456ed7,_0x3218ba,_0x1b8037){var _0x58d072=path[_0xfbf3('0x53')](_0x456ed7[_0xfbf3('0x6e')][_0xfbf3('0x6f')],path[_0xfbf3('0x70')](_0x456ed7['file'][_0xfbf3('0x6f')]));var _0x4aee8c=path[_0xfbf3('0x5f')](config[_0xfbf3('0x50')],'server/files/plugins',_0x456ed7['file'][_0xfbf3('0x6f')]);var _0x17ed75=path['join'](config[_0xfbf3('0x50')],_0xfbf3('0x51'),_0x58d072);logger[_0xfbf3('0x6a')]('Plugin\x20upload\x20filepath:\x20%s',_0x4aee8c);logger[_0xfbf3('0x6a')](_0xfbf3('0x71'),_0x17ed75);try{fs[_0xfbf3('0x72')](_0x4aee8c,parseInt(_0xfbf3('0x73'),0x8));extract(_0x4aee8c,{'dir':_0x17ed75},function(_0x4db6d1){if(_0x4db6d1){logger['error'](_0x4db6d1);handleError(_0x4db6d1,!![]);};var _0x14763a=fs[_0xfbf3('0x74')](_0x17ed75);if(_0x14763a[_0xfbf3('0x3e')]>0x1){removeReferences(_0x4aee8c,_0x17ed75);logger[_0xfbf3('0x2e')](_0xfbf3('0x75'));return _0x1b8037(new Error('Invalid\x20plugin\x20structure'));}var _0x4d9921=fs[_0xfbf3('0x76')](path[_0xfbf3('0x5f')](_0x17ed75,_0x14763a[0x0]));if(_0x4d9921['isFile']()){removeReferences(_0x4aee8c,_0x17ed75);logger[_0xfbf3('0x2e')]('Invalid\x20plugin\x20structure');return _0x1b8037(new Error('Invalid\x20plugin\x20structure'));}if(_0x4d9921['isDirectory']()){var _0x303248=fs['readdirSync'](path[_0xfbf3('0x5f')](_0x17ed75,_0x14763a[0x0]));if(_0x303248['length']===0x0){removeReferences(_0x4aee8c,_0x17ed75);logger['error'](_0xfbf3('0x75'));return _0x1b8037(new Error(_0xfbf3('0x75')));}var _0x3c11cf=_0x303248[_0xfbf3('0x77')](function(_0x219f55){return _0x219f55===_0xfbf3('0x78');});if(!_0x3c11cf){return _0x1b8037(new Error(_0xfbf3('0x79')));}var _0x2dcb6d=fs[_0xfbf3('0x7a')](path[_0xfbf3('0x5f')](_0x17ed75,_0x14763a[0x0],_0xfbf3('0x78')));var _0x4bfc1f=JSON[_0xfbf3('0x7b')](_0x2dcb6d);if(_0xfbf3('0x25')==typeof _0x4bfc1f[_0xfbf3('0x30')]){return _0x1b8037(new Error('Invalid\x20manifest:\x20name\x20missing'));}if(_0xfbf3('0x25')==typeof _0x4bfc1f[_0xfbf3('0x36')]){return _0x1b8037(new Error(_0xfbf3('0x7c')));}if('undefined'==typeof _0x4bfc1f[_0xfbf3('0x7d')]){return _0x1b8037(new Error('Invalid\x20manifest:\x20version\x20not\x20specified'));}if(_0xfbf3('0x25')==typeof _0x4bfc1f[_0xfbf3('0x7e')]){return _0x1b8037(new Error('Invalid\x20manifest:\x20parameters\x20missing'));}if(_0x4bfc1f[_0xfbf3('0x36')]===_0xfbf3('0x7f')){if('undefined'==typeof _0x4bfc1f[_0xfbf3('0x7e')][_0xfbf3('0x80')]){return _0x1b8037(new Error(_0xfbf3('0x81')));}if(_0xfbf3('0x25')==typeof _0x4bfc1f[_0xfbf3('0x7e')][_0xfbf3('0x80')][_0xfbf3('0x82')]&&_0xfbf3('0x25')==typeof _0x4bfc1f['parameters'][_0xfbf3('0x80')][_0xfbf3('0x83')]){return _0x1b8037(new Error('Invalid\x20manifest:\x20no\x20view\x20specified'));}}else if(_0x4bfc1f[_0xfbf3('0x36')]===_0xfbf3('0x84')){if(_0xfbf3('0x25')==typeof _0x4bfc1f['parameters'][_0xfbf3('0x85')]){return _0x1b8037(new Error(_0xfbf3('0x86')));}if('undefined'==typeof _0x4bfc1f[_0xfbf3('0x7e')][_0xfbf3('0x87')]){return _0x1b8037(new Error(_0xfbf3('0x88')));}}else{return _0x1b8037(new Error(_0xfbf3('0x89')));}var _0x354e04=_0x4bfc1f[_0xfbf3('0x30')];var _0x50dc7f=_0x4bfc1f[_0xfbf3('0x8a')];var _0x5d47c3=_0x4bfc1f['type'];var _0x40d9cd=_0x4bfc1f[_0xfbf3('0x8b')]?_0x4bfc1f[_0xfbf3('0x8b')]:_0xfbf3('0x8c');var _0x488d30=_0x4bfc1f[_0xfbf3('0x8d')]?_0x4bfc1f[_0xfbf3('0x8d')]:_0xfbf3('0x8e');var _0x146ea1='';var _0x53801d='';var _0x1d1755='';var _0x1894fe='';var _0x5ccbb4=_0x4bfc1f[_0xfbf3('0x7d')];if(_0x5d47c3==='html'){if(_0xfbf3('0x25')!=typeof _0x4bfc1f[_0xfbf3('0x7e')][_0xfbf3('0x80')][_0xfbf3('0x82')]){var _0x34b9f3=_0x4bfc1f['parameters'][_0xfbf3('0x80')][_0xfbf3('0x82')];if(!/^(f|ht)tps?:\/\//i['test'](_0x34b9f3)){_0x146ea1=path[_0xfbf3('0x5f')](_0xfbf3('0x8f'),_0x58d072,_0x14763a[0x0],_0x34b9f3);}else{_0x146ea1=_0x34b9f3;}}else{logger[_0xfbf3('0x6a')](_0xfbf3('0x90'));}if(_0xfbf3('0x25')!=typeof _0x4bfc1f[_0xfbf3('0x7e')][_0xfbf3('0x80')][_0xfbf3('0x83')]){var _0x23e267=_0x4bfc1f['parameters']['views'][_0xfbf3('0x83')];if(!/^(f|ht)tps?:\/\//i[_0xfbf3('0x91')](_0x23e267)){_0x53801d=path[_0xfbf3('0x5f')](_0xfbf3('0x8f'),_0x58d072,_0x14763a[0x0],_0x23e267);}else{_0x53801d=_0x23e267;}}else{logger['info'](_0xfbf3('0x92'));}}else if(_0x5d47c3==='script'){_0x1d1755=_0x4bfc1f[_0xfbf3('0x7e')][_0xfbf3('0x85')];_0x1894fe=_0x4bfc1f[_0xfbf3('0x7e')]['scriptPath'];if(_0xfbf3('0x25')!=typeof _0x4bfc1f[_0xfbf3('0x7e')][_0xfbf3('0x80')]){if(_0xfbf3('0x25')!=typeof _0x4bfc1f[_0xfbf3('0x7e')][_0xfbf3('0x80')][_0xfbf3('0x82')]){var _0x34b9f3=_0x4bfc1f[_0xfbf3('0x7e')]['views'][_0xfbf3('0x82')];if(!/^(f|ht)tps?:\/\//i['test'](_0x34b9f3)){_0x146ea1=path['join'](_0xfbf3('0x8f'),_0x58d072,_0x14763a[0x0],_0x34b9f3);}else{_0x146ea1=_0x34b9f3;}}if(_0xfbf3('0x25')!=typeof _0x4bfc1f[_0xfbf3('0x7e')]['views']['agent']){var _0x23e267=_0x4bfc1f[_0xfbf3('0x7e')][_0xfbf3('0x80')][_0xfbf3('0x83')];if(!/^(f|ht)tps?:\/\//i[_0xfbf3('0x91')](_0x23e267)){_0x53801d=path[_0xfbf3('0x5f')](_0xfbf3('0x8f'),_0x58d072,_0x14763a[0x0],_0x23e267);}else{_0x53801d=_0x23e267;}}}}var _0x1a6af5={'name':_0x354e04,'description':_0x50dc7f,'path':path[_0xfbf3('0x5f')](_0x58d072,_0x14763a[0x0]),'type':_0x5d47c3,'sidebar':_0x40d9cd,'icon':_0x488d30,'adminUrl':_0x146ea1,'agentUrl':_0x53801d,'scriptName':_0x1d1755,'scriptPath':_0x1894fe,'version':_0x5ccbb4};removeReferences(_0x4aee8c,null);return db[_0xfbf3('0x33')][_0xfbf3('0x93')](_0x1a6af5)[_0xfbf3('0x2c')](function(_0x2d3a62){var _0x397f50={'role':_0x456ed7[_0xfbf3('0x94')][_0xfbf3('0x95')],'userProfileId':_0x456ed7[_0xfbf3('0x94')]['userProfileId']};if(!_0x397f50)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x397f50[_0xfbf3('0x95')]===_0xfbf3('0x96')){var _0x4c0026=_0x2d3a62['get']({'plain':!![]});return db[_0xfbf3('0x97')][_0xfbf3('0x4f')]({'where':{'name':_0xfbf3('0x2d'),'userProfileId':_0x397f50['userProfileId']},'raw':!![]})[_0xfbf3('0x2c')](function(_0x3658c8){if(_0x3658c8&&_0x3658c8['autoAssociation']===0x0){return db[_0xfbf3('0x98')][_0xfbf3('0x93')]({'name':_0x4c0026['name'],'resourceId':_0x4c0026['id'],'type':_0x3658c8['name'],'sectionId':_0x3658c8['id']},{})[_0xfbf3('0x2c')](function(){return _0x2d3a62;});}else{return _0x2d3a62;}})[_0xfbf3('0x4b')](function(_0xc439e0){logger[_0xfbf3('0x2e')](_0xfbf3('0x99'),_0xc439e0);throw _0xc439e0;});}return _0x2d3a62;})[_0xfbf3('0x2c')](respondWithResult(_0x3218ba,null))[_0xfbf3('0x4b')](handleError(_0x3218ba,null));}});}catch(_0x10dcf8){_0x3218ba[_0xfbf3('0x27')](0x1f4)['send'](_0x10dcf8);}};function removeReferences(_0x466b53,_0x53f30c){try{if(_0x466b53){fs[_0xfbf3('0x69')](_0x466b53);logger['info']('Zip\x20archive\x20removed');}if(_0x53f30c){rimraf(_0x53f30c,function(){});logger[_0xfbf3('0x6a')](_0xfbf3('0x9a'));}}catch(_0x110041){logger[_0xfbf3('0x2e')](_0x110041);}}exports[_0xfbf3('0x9b')]=function(_0xd4cd0e,_0x21bd40,_0x1fb1e9){return db[_0xfbf3('0x33')][_0xfbf3('0x4f')]({'where':{'id':_0xd4cd0e['params']['id']}})['then'](handleEntityNotFound(_0x21bd40,null))[_0xfbf3('0x2c')](saveUpdates(_0xd4cd0e[_0xfbf3('0x94')],null))[_0xfbf3('0x2c')](respondWithResult(_0x21bd40,null))[_0xfbf3('0x4b')](handleError(_0x21bd40,null));};exports[_0xfbf3('0x9c')]=function(_0x52bfc5,_0x481c09,_0x453bb4){return db['Plugin'][_0xfbf3('0x4f')]({'where':{'id':_0x52bfc5[_0xfbf3('0x4d')]['id']}})[_0xfbf3('0x2c')](function(_0x39c726){if(_0x39c726){return _0x39c726['destroy']();}})['then'](function(_0x116d70){rimraf(path[_0xfbf3('0x5f')](config[_0xfbf3('0x50')],_0xfbf3('0x51'),path[_0xfbf3('0x9d')](_0x116d70[_0xfbf3('0x54')])),function(){});return _0x116d70;})['then'](handleEntityNotFound(_0x481c09,null))[_0xfbf3('0x2c')](respondWithStatusCode(_0x481c09,null))[_0xfbf3('0x4b')](handleError(_0x481c09,null));};exports[_0xfbf3('0x9e')]=function(_0x219731,_0x2b78ba,_0xf26b88){return BPromise[_0xfbf3('0x9f')]()[_0xfbf3('0x2c')](function(){if(!_0x219731[_0xfbf3('0x39')][_0xfbf3('0x54')]){throw new Error(_0xfbf3('0xa0'));}if(!_0x219731[_0xfbf3('0x39')][_0xfbf3('0xa1')]){throw new Error(_0xfbf3('0xa2'));}var _0x23d8f3=_0x219731[_0xfbf3('0x39')][_0xfbf3('0xa3')]?_0x219731[_0xfbf3('0x39')]['hostname']+':'+_0x219731[_0xfbf3('0x39')][_0xfbf3('0xa1')]:_0xfbf3('0xa4')+_0x219731['query'][_0xfbf3('0xa1')];var _0x4febf5=_0x219731[_0xfbf3('0x39')][_0xfbf3('0x29')]?_0x219731[_0xfbf3('0x39')][_0xfbf3('0x29')]:!![];var _0x36ac03=_0x219731[_0xfbf3('0x39')][_0xfbf3('0xa5')]?_0x219731[_0xfbf3('0x39')]['encoding']:null;var _0x44f827={'method':_0x219731[_0xfbf3('0xa6')],'uri':util['format'](_0xfbf3('0xa7'),_0x23d8f3,_0x219731[_0xfbf3('0x39')][_0xfbf3('0x54')]),'json':_0x4febf5,'resolveWithFullResponse':!![],'encoding':_0x36ac03,'qs':_0x219731['query']};if(_0x219731[_0xfbf3('0xa8')]){_0x44f827[_0xfbf3('0xa8')]=_0x219731['headers'];if(_0x44f827['headers'][_0xfbf3('0xa9')]){delete _0x44f827['headers'][_0xfbf3('0xa9')];}}if(_0x44f827[_0xfbf3('0xa8')][_0xfbf3('0xaa')]){delete _0x44f827[_0xfbf3('0xa8')][_0xfbf3('0xaa')];}return rp(_0x44f827);})[_0xfbf3('0x2c')](function(_0x41bd80){if(_0x41bd80){_0x2b78ba[_0xfbf3('0xab')](_0x41bd80[_0xfbf3('0xa8')]);logger['info'](_0x41bd80[_0xfbf3('0x94')]);if(_[_0xfbf3('0xac')](_0x219731[_0xfbf3('0x39')][_0xfbf3('0x54')],_0xfbf3('0x66'))&&_0x41bd80['statusCode']==0x1f4){return _0x2b78ba[_0xfbf3('0x21')](_0x41bd80['statusCode']);}else{return _0x2b78ba[_0xfbf3('0x27')](_0x41bd80[_0xfbf3('0xad')])[_0xfbf3('0x31')](_0x41bd80['body']);}}else{return _0x2b78ba['sendStatus'](0xc8);}})['catch'](handleError(_0x2b78ba,null));};exports[_0xfbf3('0xae')]=function(_0x56f522,_0x20e955,_0x1c81ec){return BPromise[_0xfbf3('0x9f')]()[_0xfbf3('0x2c')](function(){if(!_0x56f522['query'][_0xfbf3('0x54')]){throw new Error('\x27PATH\x27\x20parameter\x20not\x20specified');}if(!_0x56f522[_0xfbf3('0x39')][_0xfbf3('0xa1')]){throw new Error(_0xfbf3('0xa2'));}var _0x595fed=_0x56f522[_0xfbf3('0x39')][_0xfbf3('0xa3')]?_0x56f522[_0xfbf3('0x39')]['hostname']+':'+_0x56f522[_0xfbf3('0x39')]['port']:'http://localhost:'+_0x56f522[_0xfbf3('0x39')][_0xfbf3('0xa1')];var _0x30075e=_0x56f522[_0xfbf3('0x39')][_0xfbf3('0x29')]?_0x56f522[_0xfbf3('0x39')][_0xfbf3('0x29')]:!![];var _0x1f5c93=_0x56f522[_0xfbf3('0x39')][_0xfbf3('0xa5')]?_0x56f522['query'][_0xfbf3('0xa5')]:null;var _0x2d6165={'method':_0x56f522[_0xfbf3('0xa6')],'uri':util[_0xfbf3('0x52')]('%s%s',_0x595fed,_0x56f522['query'][_0xfbf3('0x54')]),'json':_0x30075e,'resolveWithFullResponse':!![],'encoding':_0x1f5c93,'body':_0x56f522[_0xfbf3('0x94')]};if(_0x56f522['headers']){_0x2d6165[_0xfbf3('0xa8')]=_0x56f522[_0xfbf3('0xa8')];if(_0x2d6165[_0xfbf3('0xa8')][_0xfbf3('0xa9')]){delete _0x2d6165[_0xfbf3('0xa8')][_0xfbf3('0xa9')];}}if(_0x2d6165[_0xfbf3('0xa8')][_0xfbf3('0xaa')]){delete _0x2d6165[_0xfbf3('0xa8')]['content-type'];}return rp(_0x2d6165);})['then'](function(_0x3d2b2e){if(_0x3d2b2e){_0x20e955[_0xfbf3('0xab')](_0x3d2b2e['headers']);logger[_0xfbf3('0x6a')](_0x3d2b2e[_0xfbf3('0x94')]);return _0x20e955[_0xfbf3('0x27')](_0x3d2b2e[_0xfbf3('0xad')])[_0xfbf3('0x31')](_0x3d2b2e[_0xfbf3('0x94')]);}else{return _0x20e955[_0xfbf3('0x21')](0xc8);}})[_0xfbf3('0x4b')](handleError(_0x20e955,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index e585e99..c4e93b8 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 _0x9c5a=['hook','events','../../mysqldb','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x943f7c,_0x68aa15){var _0x590d3e=function(_0x26bc6c){while(--_0x26bc6c){_0x943f7c['push'](_0x943f7c['shift']());}};_0x590d3e(++_0x68aa15);}(_0x9c5a,0x1c3));var _0xa9c5=function(_0x15a9b8,_0x5e3dbd){_0x15a9b8=_0x15a9b8-0x0;var _0xae4374=_0x9c5a[_0x15a9b8];return _0xae4374;};'use strict';var EventEmitter=require(_0xa9c5('0x0'));var Plugin=require(_0xa9c5('0x1'))['db']['Plugin'];var PluginEvents=new EventEmitter();PluginEvents[_0xa9c5('0x2')](0x0);var events={'afterCreate':_0xa9c5('0x3'),'afterUpdate':_0xa9c5('0x4'),'afterDestroy':_0xa9c5('0x5')};function emitEvent(_0x4f5552){return function(_0x2acfaf,_0x3051b1,_0x4e9403){PluginEvents[_0xa9c5('0x6')](_0x4f5552+':'+_0x2acfaf['id'],_0x2acfaf);PluginEvents['emit'](_0x4f5552,_0x2acfaf);_0x4e9403(null);};}for(var e in events){if(events[_0xa9c5('0x7')](e)){var event=events[e];Plugin[_0xa9c5('0x8')](e,emitEvent(event));}}module['exports']=PluginEvents; \ No newline at end of file +var _0x0f9f=['remove','emit','hasOwnProperty','exports','events','../../mysqldb','Plugin','setMaxListeners','save','update'];(function(_0x2736dc,_0x5f5ca6){var _0x314e56=function(_0x54b759){while(--_0x54b759){_0x2736dc['push'](_0x2736dc['shift']());}};_0x314e56(++_0x5f5ca6);}(_0x0f9f,0xae));var _0xf0f9=function(_0x1ba9bd,_0x3299e8){_0x1ba9bd=_0x1ba9bd-0x0;var _0x19aae2=_0x0f9f[_0x1ba9bd];return _0x19aae2;};'use strict';var EventEmitter=require(_0xf0f9('0x0'));var Plugin=require(_0xf0f9('0x1'))['db'][_0xf0f9('0x2')];var PluginEvents=new EventEmitter();PluginEvents[_0xf0f9('0x3')](0x0);var events={'afterCreate':_0xf0f9('0x4'),'afterUpdate':_0xf0f9('0x5'),'afterDestroy':_0xf0f9('0x6')};function emitEvent(_0x672fab){return function(_0x1d7a76,_0x1b4d6c,_0x4ed571){PluginEvents['emit'](_0x672fab+':'+_0x1d7a76['id'],_0x1d7a76);PluginEvents[_0xf0f9('0x7')](_0x672fab,_0x1d7a76);_0x4ed571(null);};}for(var e in events){if(events[_0xf0f9('0x8')](e)){var event=events[e];Plugin['hook'](e,emitEvent(event));}}module[_0xf0f9('0x9')]=PluginEvents; \ No newline at end of file diff --git a/server/api/plugin/plugin.model.js b/server/api/plugin/plugin.model.js index ac74e66..9eeaf2b 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 _0x54ad=['exports','define','Plugin','plugins','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./plugin.attributes'];(function(_0x3fe24b,_0xf6d828){var _0x49c03a=function(_0x9b5877){while(--_0x9b5877){_0x3fe24b['push'](_0x3fe24b['shift']());}};_0x49c03a(++_0xf6d828);}(_0x54ad,0x12a));var _0xd54a=function(_0x142496,_0x1d8964){_0x142496=_0x142496-0x0;var _0x412bb8=_0x54ad[_0x142496];return _0x412bb8;};'use strict';var _=require(_0xd54a('0x0'));var util=require(_0xd54a('0x1'));var logger=require(_0xd54a('0x2'))(_0xd54a('0x3'));var moment=require(_0xd54a('0x4'));var BPromise=require(_0xd54a('0x5'));var rp=require(_0xd54a('0x6'));var fs=require('fs');var path=require(_0xd54a('0x7'));var rimraf=require(_0xd54a('0x8'));var config=require('../../config/environment');var attributes=require(_0xd54a('0x9'));module[_0xd54a('0xa')]=function(_0x50d235,_0x575dba){return _0x50d235[_0xd54a('0xb')](_0xd54a('0xc'),attributes,{'tableName':_0xd54a('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe321=['./plugin.attributes','exports','Plugin','plugins','lodash','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment'];(function(_0x18867f,_0x39fe2f){var _0x282c81=function(_0x15a9ad){while(--_0x15a9ad){_0x18867f['push'](_0x18867f['shift']());}};_0x282c81(++_0x39fe2f);}(_0xe321,0x100));var _0x1e32=function(_0x4877e4,_0x1bb839){_0x4877e4=_0x4877e4-0x0;var _0x1dbe1a=_0xe321[_0x4877e4];return _0x1dbe1a;};'use strict';var _=require(_0x1e32('0x0'));var util=require(_0x1e32('0x1'));var logger=require(_0x1e32('0x2'))(_0x1e32('0x3'));var moment=require('moment');var BPromise=require(_0x1e32('0x4'));var rp=require(_0x1e32('0x5'));var fs=require('fs');var path=require(_0x1e32('0x6'));var rimraf=require('rimraf');var config=require(_0x1e32('0x7'));var attributes=require(_0x1e32('0x8'));module[_0x1e32('0x9')]=function(_0x64724d,_0x2de8b6){return _0x64724d['define'](_0x1e32('0xa'),attributes,{'tableName':_0x1e32('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.rpc.js b/server/api/plugin/plugin.rpc.js index 54c7af2..2f8a26e 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 _0x0060=['bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','redis','localhost','./plugin.socket','register','then','Plugin,\x20%s,\x20%s','request\x20sent','debug','Plugin,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','Plugin','create','body','options','raw','info','CreatePlugin','lodash','util'];(function(_0x9467a,_0x364e12){var _0x47d7a7=function(_0x6d38dd){while(--_0x6d38dd){_0x9467a['push'](_0x9467a['shift']());}};_0x47d7a7(++_0x364e12);}(_0x0060,0x11e));var _0x0006=function(_0x687ce7,_0x39db4f){_0x687ce7=_0x687ce7-0x0;var _0x8bb835=_0x0060[_0x687ce7];return _0x8bb835;};'use strict';var _=require(_0x0006('0x0'));var util=require(_0x0006('0x1'));var moment=require('moment');var BPromise=require(_0x0006('0x2'));var rs=require(_0x0006('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0006('0x4'))['db'];var utils=require(_0x0006('0x5'));var logger=require(_0x0006('0x6'))('rpc');var config=require(_0x0006('0x7'));var jayson=require(_0x0006('0x8'));var client=jayson[_0x0006('0x9')]['http']({'port':0x232a});config[_0x0006('0xa')]=_['defaults'](config[_0x0006('0xa')],{'host':_0x0006('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0006('0xa')]));require(_0x0006('0xc'))[_0x0006('0xd')](socket);function respondWithRpcPromise(_0x3fe2ad,_0x45f02d,_0x5acd68){return new BPromise(function(_0x12b3a9,_0xcd42dc){return client['request'](_0x3fe2ad,_0x5acd68)[_0x0006('0xe')](function(_0x218eff){logger['info'](_0x0006('0xf'),_0x45f02d,_0x0006('0x10'));logger[_0x0006('0x11')](_0x0006('0x12'),_0x45f02d,'request\x20sent',JSON[_0x0006('0x13')](_0x218eff));if(_0x218eff['error']){if(_0x218eff['error'][_0x0006('0x14')]===0x1f4){logger[_0x0006('0x15')](_0x0006('0xf'),_0x45f02d,_0x218eff[_0x0006('0x15')][_0x0006('0x16')]);return _0xcd42dc(_0x218eff[_0x0006('0x15')][_0x0006('0x16')]);}logger[_0x0006('0x15')](_0x0006('0xf'),_0x45f02d,_0x218eff[_0x0006('0x15')][_0x0006('0x16')]);return _0x12b3a9(_0x218eff['error']['message']);}else{logger['info']('Plugin,\x20%s,\x20%s',_0x45f02d,_0x0006('0x10'));_0x12b3a9(_0x218eff[_0x0006('0x17')][_0x0006('0x16')]);}})[_0x0006('0x18')](function(_0x39e987){logger[_0x0006('0x15')](_0x0006('0xf'),_0x45f02d,_0x39e987);_0xcd42dc(_0x39e987);});});}exports['CreatePlugin']=function(_0x318d29){var _0x58536a=this;return new Promise(function(_0x28d42b,_0x4c517c){return db[_0x0006('0x19')][_0x0006('0x1a')](_0x318d29[_0x0006('0x1b')],{'raw':_0x318d29[_0x0006('0x1c')]?_0x318d29['options'][_0x0006('0x1d')]===undefined?!![]:![]:!![]})['then'](function(_0x527510){logger[_0x0006('0x1e')]('CreatePlugin',_0x318d29);logger['debug']('CreatePlugin',_0x318d29,JSON['stringify'](_0x527510));_0x28d42b(_0x527510);})['catch'](function(_0x35042e){logger[_0x0006('0x15')](_0x0006('0x1f'),_0x35042e[_0x0006('0x16')],_0x318d29);_0x4c517c(_0x58536a[_0x0006('0x15')](0x1f4,_0x35042e[_0x0006('0x16')]));});});}; \ No newline at end of file +var _0xa811=['then','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','redis','localhost','./plugin.socket','register','request','info','Plugin,\x20%s,\x20%s','debug','Plugin,\x20%s,\x20%s,\x20%s','request\x20sent','code','error','message','result','catch','CreatePlugin','Plugin','create','body','options'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa811,0x1de));var _0x1a81=function(_0x3d0d33,_0xd3c0d4){_0x3d0d33=_0x3d0d33-0x0;var _0x27f88=_0xa811[_0x3d0d33];return _0x27f88;};'use strict';var _=require(_0x1a81('0x0'));var util=require(_0x1a81('0x1'));var moment=require(_0x1a81('0x2'));var BPromise=require(_0x1a81('0x3'));var rs=require(_0x1a81('0x4'));var fs=require('fs');var Redis=require(_0x1a81('0x5'));var db=require(_0x1a81('0x6'))['db'];var utils=require(_0x1a81('0x7'));var logger=require(_0x1a81('0x8'))(_0x1a81('0x9'));var config=require(_0x1a81('0xa'));var jayson=require(_0x1a81('0xb'));var client=jayson['client']['http']({'port':0x232a});config[_0x1a81('0xc')]=_['defaults'](config[_0x1a81('0xc')],{'host':_0x1a81('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1a81('0xc')]));require(_0x1a81('0xe'))[_0x1a81('0xf')](socket);function respondWithRpcPromise(_0x55c28d,_0x1ed250,_0x2696b6){return new BPromise(function(_0x33445b,_0x4a43eb){return client[_0x1a81('0x10')](_0x55c28d,_0x2696b6)['then'](function(_0x218fcf){logger[_0x1a81('0x11')](_0x1a81('0x12'),_0x1ed250,'request\x20sent');logger[_0x1a81('0x13')](_0x1a81('0x14'),_0x1ed250,_0x1a81('0x15'),JSON['stringify'](_0x218fcf));if(_0x218fcf['error']){if(_0x218fcf['error'][_0x1a81('0x16')]===0x1f4){logger['error'](_0x1a81('0x12'),_0x1ed250,_0x218fcf[_0x1a81('0x17')]['message']);return _0x4a43eb(_0x218fcf[_0x1a81('0x17')][_0x1a81('0x18')]);}logger[_0x1a81('0x17')](_0x1a81('0x12'),_0x1ed250,_0x218fcf[_0x1a81('0x17')][_0x1a81('0x18')]);return _0x33445b(_0x218fcf['error']['message']);}else{logger['info']('Plugin,\x20%s,\x20%s',_0x1ed250,'request\x20sent');_0x33445b(_0x218fcf[_0x1a81('0x19')][_0x1a81('0x18')]);}})[_0x1a81('0x1a')](function(_0x35f9f7){logger[_0x1a81('0x17')](_0x1a81('0x12'),_0x1ed250,_0x35f9f7);_0x4a43eb(_0x35f9f7);});});}exports[_0x1a81('0x1b')]=function(_0x535da4){var _0xe57b46=this;return new Promise(function(_0x1f5a47,_0x4f7c99){return db[_0x1a81('0x1c')][_0x1a81('0x1d')](_0x535da4[_0x1a81('0x1e')],{'raw':_0x535da4[_0x1a81('0x1f')]?_0x535da4[_0x1a81('0x1f')]['raw']===undefined?!![]:![]:!![]})[_0x1a81('0x20')](function(_0x1ecfa2){logger[_0x1a81('0x11')](_0x1a81('0x1b'),_0x535da4);logger[_0x1a81('0x13')](_0x1a81('0x1b'),_0x535da4,JSON[_0x1a81('0x21')](_0x1ecfa2));_0x1f5a47(_0x1ecfa2);})[_0x1a81('0x1a')](function(_0xd425ce){logger[_0x1a81('0x17')](_0x1a81('0x1b'),_0xd425ce[_0x1a81('0x18')],_0x535da4);_0x4f7c99(_0xe57b46[_0x1a81('0x17')](0x1f4,_0xd425ce[_0x1a81('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index 50e6b09..4f1e6df 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 _0x3d36=['register','length','plugin:','./plugin.events','save','emit'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x3d36,0x1ef));var _0x63d3=function(_0x2e4e19,_0x493b50){_0x2e4e19=_0x2e4e19-0x0;var _0x9ba20b=_0x3d36[_0x2e4e19];return _0x9ba20b;};'use strict';var PluginEvents=require(_0x63d3('0x0'));var events=[_0x63d3('0x1'),'remove','update'];function createListener(_0xbb19c4,_0x461506){return function(_0x46c028){_0x461506[_0x63d3('0x2')](_0xbb19c4,_0x46c028);};}function removeListener(_0xf0f7ab,_0x2bd828){return function(){PluginEvents['removeListener'](_0xf0f7ab,_0x2bd828);};}exports[_0x63d3('0x3')]=function(_0x208270){for(var _0x2669b5=0x0,_0x3a77d1=events[_0x63d3('0x4')];_0x2669b5<_0x3a77d1;_0x2669b5++){var _0x3123af=events[_0x2669b5];var _0x267140=createListener(_0x63d3('0x5')+_0x3123af,_0x208270);PluginEvents['on'](_0x3123af,_0x267140);}}; \ No newline at end of file +var _0xa33e=['./plugin.events','remove','update','removeListener','register','length','plugin:'];(function(_0x1f6310,_0x588981){var _0x65dd66=function(_0x593527){while(--_0x593527){_0x1f6310['push'](_0x1f6310['shift']());}};_0x65dd66(++_0x588981);}(_0xa33e,0x1b2));var _0xea33=function(_0x5d1b98,_0x178cb2){_0x5d1b98=_0x5d1b98-0x0;var _0x521582=_0xa33e[_0x5d1b98];return _0x521582;};'use strict';var PluginEvents=require(_0xea33('0x0'));var events=['save',_0xea33('0x1'),_0xea33('0x2')];function createListener(_0x519ab0,_0x8d3eb1){return function(_0x16b323){_0x8d3eb1['emit'](_0x519ab0,_0x16b323);};}function removeListener(_0x5ee1c5,_0x43c267){return function(){PluginEvents[_0xea33('0x3')](_0x5ee1c5,_0x43c267);};}exports[_0xea33('0x4')]=function(_0xae1294){for(var _0x2d8c7c=0x0,_0x461e1d=events[_0xea33('0x5')];_0x2d8c7c<_0x461e1d;_0x2d8c7c++){var _0x34b680=events[_0x2d8c7c];var _0x2afb01=createListener(_0xea33('0x6')+_0x34b680,_0xae1294);PluginEvents['on'](_0x34b680,_0x2afb01);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index 2cc3c42..55a5390 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(_0x48a49a,_0x3f74f1){var _0x2ed79b=function(_0x45aa0f){while(--_0x45aa0f){_0x48a49a['push'](_0x48a49a['shift']());}};_0x2ed79b(++_0x3f74f1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1ddedd,_0x485606){_0x1ddedd=_0x1ddedd-0x0;var _0xa3e1ac=_0xa9e0[_0x1ddedd];return _0xa3e1ac;};'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(_0x4b9b28,_0x49c88a){var _0x3243f2=function(_0x46cc7b){while(--_0x46cc7b){_0x4b9b28['push'](_0x4b9b28['shift']());}};_0x3243f2(++_0x49c88a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5783f4,_0x4a9e0a){_0x5783f4=_0x5783f4-0x0;var _0x28e380=_0xa9e0[_0x5783f4];return _0x28e380;};'use strict';var express=require(_0x0a9e('0x0'));var router=express[_0x0a9e('0x1')]();var auth=require(_0x0a9e('0x2'));var controller=require('./pm2.controller');router['get']('/',auth[_0x0a9e('0x3')](),controller['index']);router[_0x0a9e('0x4')](_0x0a9e('0x5'),auth[_0x0a9e('0x3')](),controller[_0x0a9e('0x6')]);router[_0x0a9e('0x7')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x8')]);router[_0x0a9e('0x9')](_0x0a9e('0x5'),auth['isAuthenticated'](),controller['update']);router[_0x0a9e('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);module[_0x0a9e('0xc')]=router; \ No newline at end of file diff --git a/server/api/pm2/pm2.controller.js b/server/api/pm2/pm2.controller.js index 751b81b..6a7d037 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 _0xd64b=['dump','send','Missing\x20name\x20and/or\x20path','update','stop','Unknown\x20status','delete','Unknown\x20id','lodash','../../config/logger','path','child_process','exec','bluebird','status','json','name','npm\x20install','info','error','index','list','then','express','motion2','show','describe','params','catch','body','script','join','../../files/plugins','cwd','chdir','dirname','start'];(function(_0x65b308,_0x1cc931){var _0x4c54de=function(_0x970b9){while(--_0x970b9){_0x65b308['push'](_0x65b308['shift']());}};_0x4c54de(++_0x1cc931);}(_0xd64b,0xc1));var _0xbd64=function(_0x498750,_0x2996c6){_0x498750=_0x498750-0x0;var _0x5a0702=_0xd64b[_0x498750];return _0x5a0702;};'use strict';var _=require(_0xbd64('0x0'));var pm2=require('../../config/pm2');var logger=require(_0xbd64('0x1'))('api');var path=require(_0xbd64('0x2'));var exec=require(_0xbd64('0x3'))[_0xbd64('0x4')];var BPromise=require(_0xbd64('0x5'));function handleEntityNotFound(_0x30fe29,_0x5458d8){return function(_0x5446e4){if(!_0x5446e4){_0x30fe29['sendStatus'](0x194);;}return _0x5446e4;};}function respondWithResult(_0x51e87d,_0x58e9e7){_0x58e9e7=_0x58e9e7||0xc8;return function(_0x32995f){if(_0x32995f){return _0x51e87d[_0xbd64('0x6')](_0x58e9e7)[_0xbd64('0x7')](_0x32995f);}return null;};}function handleError(_0x3f1f17,_0x2b8543){_0x2b8543=_0x2b8543||0x1f4;return function(_0x197a84){logger['error'](_0x197a84['stack']);if(_0x197a84[_0xbd64('0x8')]){delete _0x197a84[_0xbd64('0x8')];}_0x3f1f17[_0xbd64('0x6')](_0x2b8543)['send'](_0x197a84);};}function execChildProcess(){return new BPromise(function(_0xc80599,_0x3f908a){exec(_0xbd64('0x9'),function(_0x18bde8,_0x593c79,_0x431b29){logger['info'](_0x593c79);logger[_0xbd64('0xa')](_0x431b29);if(_0x18bde8){logger[_0xbd64('0xb')](_0x18bde8);return _0x3f908a(_0x18bde8);}return _0xc80599(_0x593c79);});});}exports[_0xbd64('0xc')]=function(_0x2183e2,_0x367824){return pm2[_0xbd64('0xd')]()[_0xbd64('0xe')](function(_0x269e2f){if(_0x269e2f){var _0x2b5808=_['reject'](_0x269e2f,function(_0x2d1159){return _0x2d1159[_0xbd64('0x8')]===_0xbd64('0xf')||_0x2d1159[_0xbd64('0x8')]===_0xbd64('0x10');});return{'rows':_0x2b5808,'count':_0x2b5808['length']};}return null;})[_0xbd64('0xe')](respondWithResult(_0x367824,null))['catch'](handleError(_0x367824,null));};exports[_0xbd64('0x11')]=function(_0x1432a6,_0x3aef70){return pm2[_0xbd64('0x12')](_0x1432a6[_0xbd64('0x13')]['id'])[_0xbd64('0xe')](respondWithResult(_0x3aef70,null))[_0xbd64('0xe')](handleEntityNotFound(_0x3aef70,null))[_0xbd64('0x14')](handleError(_0x3aef70,null));};exports['create']=function(_0x305545,_0x1f618b){if(_0x305545['body']['name']&&_0x305545[_0xbd64('0x15')][_0xbd64('0x16')]){var _0x196d21=path[_0xbd64('0x17')](__dirname,_0xbd64('0x18'),_0x305545[_0xbd64('0x15')]['script']);var _0x4d4a16=process[_0xbd64('0x19')]();process[_0xbd64('0x1a')](path[_0xbd64('0x1b')](_0x196d21));return execChildProcess()[_0xbd64('0xe')](function(_0x55e74c){process['chdir'](_0x4d4a16);return pm2[_0xbd64('0x1c')]({'name':_0x305545['body'][_0xbd64('0x8')],'script':_0x196d21});})['then'](function(_0x33452d){pm2[_0xbd64('0x1d')]();return _0x33452d[0x0];})[_0xbd64('0xe')](respondWithResult(_0x1f618b,0xc9))[_0xbd64('0x14')](handleError(_0x1f618b,null));}else{return _0x1f618b['status'](0x1f4)[_0xbd64('0x1e')]({'message':_0xbd64('0x1f')});}};exports[_0xbd64('0x20')]=function(_0x2a44d0,_0x4d1563){if(_0x2a44d0['body']['id']){delete _0x2a44d0[_0xbd64('0x15')]['id'];}var _0x49eac5={'online':'restart','stopped':_0xbd64('0x21')};if(_0x49eac5['hasOwnProperty'](_0x2a44d0[_0xbd64('0x15')]['status'])){return pm2[_0x49eac5[_0x2a44d0[_0xbd64('0x15')]['status']]](_0x2a44d0[_0xbd64('0x13')]['id'])[_0xbd64('0xe')](respondWithResult(_0x4d1563,0xc8))[_0xbd64('0x14')](handleError(_0x4d1563,null));}else{return _0x4d1563[_0xbd64('0x6')](0x1f4)[_0xbd64('0x1e')]({'message':_0xbd64('0x22')});}};exports['destroy']=function(_0x35bdd5,_0xe876c9){if(_0x35bdd5[_0xbd64('0x15')]['id']){delete _0x35bdd5[_0xbd64('0x15')]['id'];}if(_0x35bdd5[_0xbd64('0x13')]['id']){return pm2[_0xbd64('0x23')](_0x35bdd5['params']['id'])['then'](function(_0x1e4593){pm2['dump']();return _0x1e4593[0x0];})[_0xbd64('0xe')](respondWithResult(_0xe876c9,null))[_0xbd64('0x14')](handleError(_0xe876c9,null));}else{return _0xe876c9['status'](0x1f4)['send']({'message':_0xbd64('0x24')});}}; \ No newline at end of file +var _0x2750=['exec','bluebird','sendStatus','status','json','error','name','send','npm\x20install','info','list','then','motion2','catch','body','script','../../files/plugins','cwd','dirname','chdir','dump','Missing\x20name\x20and/or\x20path','stop','hasOwnProperty','params','Unknown\x20status','destroy','lodash','../../config/logger','api','path','child_process'];(function(_0x28d8d1,_0x1cd375){var _0x4eb781=function(_0x17f639){while(--_0x17f639){_0x28d8d1['push'](_0x28d8d1['shift']());}};_0x4eb781(++_0x1cd375);}(_0x2750,0x13b));var _0x0275=function(_0x543a91,_0x236841){_0x543a91=_0x543a91-0x0;var _0x51fd2d=_0x2750[_0x543a91];return _0x51fd2d;};'use strict';var _=require(_0x0275('0x0'));var pm2=require('../../config/pm2');var logger=require(_0x0275('0x1'))(_0x0275('0x2'));var path=require(_0x0275('0x3'));var exec=require(_0x0275('0x4'))[_0x0275('0x5')];var BPromise=require(_0x0275('0x6'));function handleEntityNotFound(_0x20273d,_0x4960){return function(_0x3d0c9c){if(!_0x3d0c9c){_0x20273d[_0x0275('0x7')](0x194);;}return _0x3d0c9c;};}function respondWithResult(_0x5953f9,_0x3f645f){_0x3f645f=_0x3f645f||0xc8;return function(_0x2421fd){if(_0x2421fd){return _0x5953f9[_0x0275('0x8')](_0x3f645f)[_0x0275('0x9')](_0x2421fd);}return null;};}function handleError(_0x4dffd1,_0x1f7c4a){_0x1f7c4a=_0x1f7c4a||0x1f4;return function(_0x30632d){logger[_0x0275('0xa')](_0x30632d['stack']);if(_0x30632d['name']){delete _0x30632d[_0x0275('0xb')];}_0x4dffd1['status'](_0x1f7c4a)[_0x0275('0xc')](_0x30632d);};}function execChildProcess(){return new BPromise(function(_0x377087,_0x14f68c){exec(_0x0275('0xd'),function(_0x14bc3e,_0x5ae208,_0x2e8723){logger[_0x0275('0xe')](_0x5ae208);logger[_0x0275('0xe')](_0x2e8723);if(_0x14bc3e){logger['error'](_0x14bc3e);return _0x14f68c(_0x14bc3e);}return _0x377087(_0x5ae208);});});}exports['index']=function(_0x292f93,_0x395398){return pm2[_0x0275('0xf')]()[_0x0275('0x10')](function(_0x28827b){if(_0x28827b){var _0x36921c=_['reject'](_0x28827b,function(_0x3e0791){return _0x3e0791[_0x0275('0xb')]==='express'||_0x3e0791[_0x0275('0xb')]===_0x0275('0x11');});return{'rows':_0x36921c,'count':_0x36921c['length']};}return null;})[_0x0275('0x10')](respondWithResult(_0x395398,null))[_0x0275('0x12')](handleError(_0x395398,null));};exports['show']=function(_0x5e7466,_0x56e719){return pm2['describe'](_0x5e7466['params']['id'])[_0x0275('0x10')](respondWithResult(_0x56e719,null))[_0x0275('0x10')](handleEntityNotFound(_0x56e719,null))[_0x0275('0x12')](handleError(_0x56e719,null));};exports['create']=function(_0x7075c9,_0x30730a){if(_0x7075c9[_0x0275('0x13')]['name']&&_0x7075c9[_0x0275('0x13')][_0x0275('0x14')]){var _0x575786=path['join'](__dirname,_0x0275('0x15'),_0x7075c9[_0x0275('0x13')][_0x0275('0x14')]);var _0x592a53=process[_0x0275('0x16')]();process['chdir'](path[_0x0275('0x17')](_0x575786));return execChildProcess()['then'](function(_0x26f2c2){process[_0x0275('0x18')](_0x592a53);return pm2['start']({'name':_0x7075c9[_0x0275('0x13')][_0x0275('0xb')],'script':_0x575786});})[_0x0275('0x10')](function(_0x52946b){pm2[_0x0275('0x19')]();return _0x52946b[0x0];})[_0x0275('0x10')](respondWithResult(_0x30730a,0xc9))[_0x0275('0x12')](handleError(_0x30730a,null));}else{return _0x30730a[_0x0275('0x8')](0x1f4)[_0x0275('0xc')]({'message':_0x0275('0x1a')});}};exports['update']=function(_0x35343c,_0x14d7d8){if(_0x35343c[_0x0275('0x13')]['id']){delete _0x35343c[_0x0275('0x13')]['id'];}var _0x4689a3={'online':'restart','stopped':_0x0275('0x1b')};if(_0x4689a3[_0x0275('0x1c')](_0x35343c[_0x0275('0x13')][_0x0275('0x8')])){return pm2[_0x4689a3[_0x35343c[_0x0275('0x13')]['status']]](_0x35343c[_0x0275('0x1d')]['id'])[_0x0275('0x10')](respondWithResult(_0x14d7d8,0xc8))[_0x0275('0x12')](handleError(_0x14d7d8,null));}else{return _0x14d7d8['status'](0x1f4)['send']({'message':_0x0275('0x1e')});}};exports[_0x0275('0x1f')]=function(_0x5dc2bc,_0x7eff96){if(_0x5dc2bc[_0x0275('0x13')]['id']){delete _0x5dc2bc[_0x0275('0x13')]['id'];}if(_0x5dc2bc[_0x0275('0x1d')]['id']){return pm2['delete'](_0x5dc2bc[_0x0275('0x1d')]['id'])[_0x0275('0x10')](function(_0x3bba47){pm2[_0x0275('0x19')]();return _0x3bba47[0x0];})['then'](respondWithResult(_0x7eff96,null))[_0x0275('0x12')](handleError(_0x7eff96,null));}else{return _0x7eff96['status'](0x1f4)[_0x0275('0xc')]({'message':'Unknown\x20id'});}}; \ No newline at end of file diff --git a/server/api/realtime/index.js b/server/api/realtime/index.js index dcef59c..f51f561 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 _0xdc7b=['/queues','isAuthenticated','exports','express','Router','../../components/auth/service','./realtime.controller','get'];(function(_0x1573ea,_0x434f02){var _0x51c0e2=function(_0x5c9b28){while(--_0x5c9b28){_0x1573ea['push'](_0x1573ea['shift']());}};_0x51c0e2(++_0x434f02);}(_0xdc7b,0x153));var _0xbdc7=function(_0x4e299d,_0xf1bbde){_0x4e299d=_0x4e299d-0x0;var _0x2a25df=_0xdc7b[_0x4e299d];return _0x2a25df;};'use strict';var express=require(_0xbdc7('0x0'));var router=express[_0xbdc7('0x1')]();var auth=require(_0xbdc7('0x2'));var controller=require(_0xbdc7('0x3'));router[_0xbdc7('0x4')](_0xbdc7('0x5'),auth[_0xbdc7('0x6')](),controller['getQueues']);module[_0xbdc7('0x7')]=router; \ No newline at end of file +var _0x2a2b=['./realtime.controller','get','/queues','express','Router'];(function(_0x5d2803,_0xf375bd){var _0xdcad2c=function(_0x3c3a98){while(--_0x3c3a98){_0x5d2803['push'](_0x5d2803['shift']());}};_0xdcad2c(++_0xf375bd);}(_0x2a2b,0x1de));var _0xb2a2=function(_0x1da80f,_0x62bf9e){_0x1da80f=_0x1da80f-0x0;var _0x3c46e4=_0x2a2b[_0x1da80f];return _0x3c46e4;};'use strict';var express=require(_0xb2a2('0x0'));var router=express[_0xb2a2('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0xb2a2('0x2'));router[_0xb2a2('0x3')](_0xb2a2('0x4'),auth['isAuthenticated'](),controller['getQueues']);module['exports']=router; \ No newline at end of file diff --git a/server/api/realtime/realtime.controller.js b/server/api/realtime/realtime.controller.js index 3e80117..7273abb 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 _0xafc4=['predictiveIntervalAvgTalktime','get','loggedInDb','agents','find','rows','merge','pick','getAgents','getMembers','length','online','User','Pause','findAll','QueueId','UserId','all','catch','util','jayson/promise','../../config/logger','api','../../mysqldb','client','offset','undefined','count','limit','status','set','json','error','stack','name','send','getQueues','chat','openchannel','fax','whatsapp','voice','resolve','then','query','channel','toLowerCase','Invalid\x20channel','startCase','Queue','map','fieldName','key','user','role','userProfileId','type','outbound','QueueCampaigns','Queues','findAndCountAll','format','result','loggedIn','available','waiting','talking','paused','push','pTalking','originated','message','dialActive','dialMethod','startPredictive','startProgressive','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','predictiveIntervalAvailable','predictiveIntervalTotalCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime'];(function(_0x9008bd,_0x16a66b){var _0x408d9f=function(_0x5a70b9){while(--_0x5a70b9){_0x9008bd['push'](_0x9008bd['shift']());}};_0x408d9f(++_0x16a66b);}(_0xafc4,0x69));var _0x4afc=function(_0x2ddfe4,_0x1130d9){_0x2ddfe4=_0x2ddfe4-0x0;var _0x396385=_0xafc4[_0x2ddfe4];return _0x396385;};'use strict';var util=require(_0x4afc('0x0'));var _=require('lodash');var jayson=require(_0x4afc('0x1'));var qs=require('../../components/parsers/qs');var logger=require(_0x4afc('0x2'))(_0x4afc('0x3'));var db=require(_0x4afc('0x4'))['db'];var client=jayson[_0x4afc('0x5')]['http']({'port':0x232a});var routingClient=jayson['client']['http']({'port':0x232c});function respondWithFilteredResult(_0x36cb50,_0x471d45){return function(_0x16953b){if(_0x16953b){var _0x1bb281=typeof _0x471d45[_0x4afc('0x6')]===_0x4afc('0x7')&&typeof _0x471d45['limit']===_0x4afc('0x7');var _0x1c740c=_0x16953b[_0x4afc('0x8')];var _0x1e6bf5=_0x1bb281?0x0:_0x471d45[_0x4afc('0x6')];var _0x458fde=_0x1bb281?_0x16953b['count']:_0x471d45['offset']+_0x471d45[_0x4afc('0x9')];var _0x49222e;if(_0x458fde>=_0x1c740c){_0x458fde=_0x1c740c;_0x49222e=0xc8;}else{_0x49222e=0xce;}_0x36cb50[_0x4afc('0xa')](_0x49222e);return _0x36cb50[_0x4afc('0xb')]('Content-Range',_0x1e6bf5+'-'+_0x458fde+'/'+_0x1c740c)[_0x4afc('0xc')](_0x16953b);}return null;};}function handleError(_0x3fb54a,_0x2b191c){_0x2b191c=_0x2b191c||0x1f4;return function(_0x2768bf){logger[_0x4afc('0xd')](_0x2768bf[_0x4afc('0xe')]);if(_0x2768bf[_0x4afc('0xf')]){delete _0x2768bf[_0x4afc('0xf')];}_0x3fb54a['status'](_0x2b191c)[_0x4afc('0x10')](_0x2768bf);};}exports[_0x4afc('0x11')]=function(_0x2c636b,_0x1e2c31){var _0x5f2dc9=['mail',_0x4afc('0x12'),'sms',_0x4afc('0x13'),_0x4afc('0x14'),_0x4afc('0x15'),_0x4afc('0x16')];var _0x3a306f={'count':0x0,'rows':[]},_0x3ebdc8={},_0x22f809;Promise[_0x4afc('0x17')]()[_0x4afc('0x18')](function(){if(_0x2c636b[_0x4afc('0x19')][_0x4afc('0x1a')]){if(!_['includes'](_0x5f2dc9,_0x2c636b[_0x4afc('0x19')][_0x4afc('0x1a')][_0x4afc('0x1b')]()))throw new Error(_0x4afc('0x1c'));_0x22f809=_0x2c636b['query'][_0x4afc('0x1a')][_0x4afc('0x1b')]();}var _0x2de6e9=_[_0x4afc('0x1d')](_0x22f809)+_0x4afc('0x1e');var _0x3add4c=_[_0x4afc('0x1f')](db[_0x2de6e9]['rawAttributes'],function(_0x5403e4){return{'name':_0x5403e4[_0x4afc('0x20')],'type':_0x5403e4['type'][_0x4afc('0x21')]};});_0x3ebdc8=qs['getOptions'](_0x3add4c,_0x2c636b);if(_0x2c636b[_0x4afc('0x22')][_0x4afc('0x23')]===_0x4afc('0x22')){var _0x2876f2={'params':{'id':_0x2c636b[_0x4afc('0x22')][_0x4afc('0x24')]},'query':{'section':_0x22f809===_0x4afc('0x16')&&_0x2c636b[_0x4afc('0x19')][_0x4afc('0x25')]===_0x4afc('0x26')?_0x4afc('0x27'):_[_0x4afc('0x1d')](_0x22f809)+_0x4afc('0x28'),'type':_0x2c636b['query'][_0x4afc('0x25')],'nolimit':!![],'sort':_0x4afc('0xf'),'filter':_0x2c636b[_0x4afc('0x19')]['filter']}};return db['UserProfile']['getResources'](_0x2876f2);}return db[_0x2de6e9][_0x4afc('0x29')](_0x3ebdc8);})[_0x4afc('0x18')](function(_0x5e4747){_0x3a306f[_0x4afc('0x8')]=_0x5e4747[_0x4afc('0x8')];var _0x494fe7=_0x22f809==='voice'?client:routingClient;return _0x494fe7['request'](_[_0x4afc('0x1d')](_0x22f809)+_0x4afc('0x28'),_0x2c636b)[_0x4afc('0x18')](function(_0x46357b){if(_0x46357b[_0x4afc('0xd')])throw new Error(util[_0x4afc('0x2a')]('Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues',_0x22f809));var _0x290391=_0x46357b[_0x4afc('0x2b')];var _0x1ba6b5=[_0x4afc('0x2c'),_0x4afc('0x2d'),_0x4afc('0x2e'),_0x4afc('0x2f'),_0x4afc('0x30')];if(_0x22f809==='voice'&&_0x2c636b[_0x4afc('0x19')]['type']==='outbound'){_0x1ba6b5[_0x4afc('0x31')](_0x4afc('0x32'),_0x4afc('0x33'),_0x4afc('0x34'),_0x4afc('0x35'),_0x4afc('0x36'),'Trunk',_0x4afc('0x37'),_0x4afc('0x38'),_0x4afc('0x39'),_0x4afc('0x3a'),_0x4afc('0x3b'),_0x4afc('0x3c'),'dialPredictiveInterval',_0x4afc('0x3d'),_0x4afc('0x3e'),_0x4afc('0x3f'),_0x4afc('0x40'),'predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout',_0x4afc('0x41'),_0x4afc('0x42'),_0x4afc('0x43'));}var _0x5edfe1=_0x5e4747['rows'][_0x4afc('0x1f')](function(_0x4a06cf){var _0x5947bb=_0x4a06cf[_0x4afc('0x44')]({'plain':!![]});_0x5947bb[_0x4afc('0x30')]=0x0;_0x5947bb[_0x4afc('0x45')]=0x0;_0x5947bb[_0x4afc('0x2c')]=0x0;_0x5947bb[_0x4afc('0x2d')]=0x0;_0x5947bb[_0x4afc('0x30')]=0x0;_0x5947bb[_0x4afc('0x2e')]=0x0;if(_0x22f809===_0x4afc('0x16')){_0x5947bb[_0x4afc('0x2f')]=0x0;if(_0x2c636b[_0x4afc('0x19')][_0x4afc('0x25')]===_0x4afc('0x26')){_0x5947bb[_0x4afc('0x32')]=0x0;_0x5947bb[_0x4afc('0x33')]=0x0;}}_0x5947bb[_0x4afc('0x46')]=[];var _0x5589be=_[_0x4afc('0x47')](_0x290391[_0x4afc('0x48')],['id',_0x5947bb['id']]);if(_0x5589be)_[_0x4afc('0x49')](_0x5947bb,_[_0x4afc('0x4a')](_0x5589be,_0x1ba6b5));if(_0x22f809===_0x4afc('0x16')){return _0x4a06cf[_0x4afc('0x4b')]({'attributes':['id',_0x4afc('0xf'),'online'],'joinTableAttributes':[],'raw':!![]})['then'](function(_0x5ee5d7){return _0x4a06cf[_0x4afc('0x4c')]({'raw':!![]})[_0x4afc('0x18')](function(_0x5c515a){for(var _0xe62748=0x0;_0xe62748<_0x5ee5d7[_0x4afc('0x4d')];_0xe62748++){var _0x8ba5e6=_[_0x4afc('0x47')](_0x5c515a,['UserId',_0x5ee5d7[_0xe62748]['id']]);var _0x12b5db={'id':_0x5ee5d7[_0xe62748]['id'],'name':_0x5ee5d7[_0xe62748][_0x4afc('0xf')],'online':Boolean(_0x5ee5d7[_0xe62748][_0x4afc('0x4e')]),'paused':_0x8ba5e6?Boolean(_0x8ba5e6[_0x4afc('0x30')]):![]};if(_0x12b5db[_0x4afc('0x4e')])_0x5947bb[_0x4afc('0x45')]++;if(_0x12b5db['paused'])_0x5947bb[_0x4afc('0x30')]++;_0x5947bb['agents'][_0x4afc('0x31')](_0x12b5db);}return _0x5947bb;});});}else{var _0x33117f=_0x4afc('0x4f')+_['startCase'](_0x22f809)+'Queue';var _0x366eac=_0x22f809+_0x4afc('0x50');return db[_0x33117f][_0x4afc('0x51')]({'where':{[_[_0x4afc('0x1d')](_0x22f809)+_0x4afc('0x52')]:_0x4a06cf['id']},'raw':!![]})[_0x4afc('0x18')](function(_0x42ecb6){return db[_0x4afc('0x4f')]['findAll']({'attributes':['id',_0x4afc('0xf'),_0x4afc('0x4e'),_0x366eac],'where':{'id':_['map'](_0x42ecb6,_0x4afc('0x53')),'role':'agent'},'raw':!![]});})[_0x4afc('0x18')](function(_0x24a731){for(var _0x16c6c4=0x0;_0x16c6c4<_0x24a731['length'];_0x16c6c4++){var _0xd0f517={'id':_0x24a731[_0x16c6c4]['id'],'name':_0x24a731[_0x16c6c4][_0x4afc('0xf')],'online':Boolean(_0x24a731[_0x16c6c4][_0x4afc('0x4e')]),'paused':Boolean(_0x24a731[_0x16c6c4][_0x366eac])};if(_0xd0f517[_0x4afc('0x4e')])_0x5947bb[_0x4afc('0x45')]++;if(_0xd0f517[_0x4afc('0x30')])_0x5947bb['paused']++;_0x5947bb['agents']['push'](_0xd0f517);}return _0x5947bb;});}});return Promise[_0x4afc('0x54')](_0x5edfe1);});})[_0x4afc('0x18')](function(_0x42e274){_0x3a306f[_0x4afc('0x48')]=_0x42e274;return _0x3a306f;})[_0x4afc('0x18')](respondWithFilteredResult(_0x1e2c31,_0x3ebdc8))[_0x4afc('0x55')](handleError(_0x1e2c31,null));}; \ No newline at end of file +var _0xef17=['send','getQueues','mail','sms','openchannel','channel','query','toLowerCase','startCase','Queue','map','rawAttributes','type','key','getOptions','user','role','outbound','QueueCampaigns','filter','UserProfile','getResources','then','request','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','waiting','talking','voice','pTalking','originated','message','dialActive','Trunk','startPredictive','erlangBusyFactor','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','predictiveIntervalAvailable','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','rows','paused','loggedInDb','loggedIn','available','agents','find','merge','pick','getAgents','online','getMembers','length','UserId','User','Pause','QueueId','findAll','agent','push','util','lodash','jayson/promise','../../components/parsers/qs','../../config/logger','api','../../mysqldb','client','http','limit','undefined','count','offset','set','error','stack','name','status'];(function(_0x818500,_0xe7620c){var _0x342023=function(_0x17c939){while(--_0x17c939){_0x818500['push'](_0x818500['shift']());}};_0x342023(++_0xe7620c);}(_0xef17,0x136));var _0x7ef1=function(_0x593122,_0x2e8bc7){_0x593122=_0x593122-0x0;var _0x4ae55b=_0xef17[_0x593122];return _0x4ae55b;};'use strict';var util=require(_0x7ef1('0x0'));var _=require(_0x7ef1('0x1'));var jayson=require(_0x7ef1('0x2'));var qs=require(_0x7ef1('0x3'));var logger=require(_0x7ef1('0x4'))(_0x7ef1('0x5'));var db=require(_0x7ef1('0x6'))['db'];var client=jayson[_0x7ef1('0x7')][_0x7ef1('0x8')]({'port':0x232a});var routingClient=jayson['client'][_0x7ef1('0x8')]({'port':0x232c});function respondWithFilteredResult(_0x514b70,_0x138ed1){return function(_0x498596){if(_0x498596){var _0x34a040=typeof _0x138ed1['offset']==='undefined'&&typeof _0x138ed1[_0x7ef1('0x9')]===_0x7ef1('0xa');var _0x56ab07=_0x498596[_0x7ef1('0xb')];var _0x1d5b33=_0x34a040?0x0:_0x138ed1[_0x7ef1('0xc')];var _0x3d47e2=_0x34a040?_0x498596[_0x7ef1('0xb')]:_0x138ed1[_0x7ef1('0xc')]+_0x138ed1[_0x7ef1('0x9')];var _0x4bedd1;if(_0x3d47e2>=_0x56ab07){_0x3d47e2=_0x56ab07;_0x4bedd1=0xc8;}else{_0x4bedd1=0xce;}_0x514b70['status'](_0x4bedd1);return _0x514b70[_0x7ef1('0xd')]('Content-Range',_0x1d5b33+'-'+_0x3d47e2+'/'+_0x56ab07)['json'](_0x498596);}return null;};}function handleError(_0x4d60ae,_0x122c8a){_0x122c8a=_0x122c8a||0x1f4;return function(_0x51e226){logger[_0x7ef1('0xe')](_0x51e226[_0x7ef1('0xf')]);if(_0x51e226[_0x7ef1('0x10')]){delete _0x51e226[_0x7ef1('0x10')];}_0x4d60ae[_0x7ef1('0x11')](_0x122c8a)[_0x7ef1('0x12')](_0x51e226);};}exports[_0x7ef1('0x13')]=function(_0x44d304,_0x57296a){var _0x4de80f=[_0x7ef1('0x14'),'chat',_0x7ef1('0x15'),_0x7ef1('0x16'),'fax','whatsapp','voice'];var _0x300645={'count':0x0,'rows':[]},_0x4da0fa={},_0x3a5835;Promise['resolve']()['then'](function(){if(_0x44d304['query'][_0x7ef1('0x17')]){if(!_['includes'](_0x4de80f,_0x44d304[_0x7ef1('0x18')][_0x7ef1('0x17')]['toLowerCase']()))throw new Error('Invalid\x20channel');_0x3a5835=_0x44d304[_0x7ef1('0x18')]['channel'][_0x7ef1('0x19')]();}var _0x33f89b=_[_0x7ef1('0x1a')](_0x3a5835)+_0x7ef1('0x1b');var _0x38edd8=_[_0x7ef1('0x1c')](db[_0x33f89b][_0x7ef1('0x1d')],function(_0xd71594){return{'name':_0xd71594['fieldName'],'type':_0xd71594[_0x7ef1('0x1e')][_0x7ef1('0x1f')]};});_0x4da0fa=qs[_0x7ef1('0x20')](_0x38edd8,_0x44d304);if(_0x44d304[_0x7ef1('0x21')][_0x7ef1('0x22')]===_0x7ef1('0x21')){var _0x423c42={'params':{'id':_0x44d304[_0x7ef1('0x21')]['userProfileId']},'query':{'section':_0x3a5835==='voice'&&_0x44d304[_0x7ef1('0x18')][_0x7ef1('0x1e')]===_0x7ef1('0x23')?_0x7ef1('0x24'):_[_0x7ef1('0x1a')](_0x3a5835)+'Queues','type':_0x44d304[_0x7ef1('0x18')][_0x7ef1('0x1e')],'nolimit':!![],'sort':_0x7ef1('0x10'),'filter':_0x44d304[_0x7ef1('0x18')][_0x7ef1('0x25')]}};return db[_0x7ef1('0x26')][_0x7ef1('0x27')](_0x423c42);}return db[_0x33f89b]['findAndCountAll'](_0x4da0fa);})[_0x7ef1('0x28')](function(_0x4b0380){_0x300645[_0x7ef1('0xb')]=_0x4b0380[_0x7ef1('0xb')];var _0x4b5fde=_0x3a5835==='voice'?client:routingClient;return _0x4b5fde[_0x7ef1('0x29')](_[_0x7ef1('0x1a')](_0x3a5835)+'Queues',_0x44d304)[_0x7ef1('0x28')](function(_0x56fe40){if(_0x56fe40[_0x7ef1('0xe')])throw new Error(util['format'](_0x7ef1('0x2a'),_0x3a5835));var _0x23414f=_0x56fe40['result'];var _0x536083=['loggedIn','available',_0x7ef1('0x2b'),_0x7ef1('0x2c'),'paused'];if(_0x3a5835===_0x7ef1('0x2d')&&_0x44d304['query']['type']===_0x7ef1('0x23')){_0x536083['push'](_0x7ef1('0x2e'),_0x7ef1('0x2f'),_0x7ef1('0x30'),_0x7ef1('0x31'),'dialMethod',_0x7ef1('0x32'),_0x7ef1('0x33'),'startProgressive','erlangCalls','erlangCallToSecond','erlangAbandonmentRate',_0x7ef1('0x34'),'dialPredictiveInterval',_0x7ef1('0x35'),_0x7ef1('0x36'),_0x7ef1('0x37'),_0x7ef1('0x38'),_0x7ef1('0x39'),_0x7ef1('0x3a'),_0x7ef1('0x3b'),_0x7ef1('0x3c'),_0x7ef1('0x3d'));}var _0x3eb9a3=_0x4b0380[_0x7ef1('0x3e')]['map'](function(_0x3a45df){var _0x1e9080=_0x3a45df['get']({'plain':!![]});_0x1e9080[_0x7ef1('0x3f')]=0x0;_0x1e9080[_0x7ef1('0x40')]=0x0;_0x1e9080[_0x7ef1('0x41')]=0x0;_0x1e9080[_0x7ef1('0x42')]=0x0;_0x1e9080[_0x7ef1('0x3f')]=0x0;_0x1e9080['waiting']=0x0;if(_0x3a5835===_0x7ef1('0x2d')){_0x1e9080[_0x7ef1('0x2c')]=0x0;if(_0x44d304[_0x7ef1('0x18')][_0x7ef1('0x1e')]===_0x7ef1('0x23')){_0x1e9080[_0x7ef1('0x2e')]=0x0;_0x1e9080[_0x7ef1('0x2f')]=0x0;}}_0x1e9080[_0x7ef1('0x43')]=[];var _0x1433df=_[_0x7ef1('0x44')](_0x23414f[_0x7ef1('0x3e')],['id',_0x1e9080['id']]);if(_0x1433df)_[_0x7ef1('0x45')](_0x1e9080,_[_0x7ef1('0x46')](_0x1433df,_0x536083));if(_0x3a5835===_0x7ef1('0x2d')){return _0x3a45df[_0x7ef1('0x47')]({'attributes':['id','name',_0x7ef1('0x48')],'joinTableAttributes':[],'raw':!![]})[_0x7ef1('0x28')](function(_0x302212){return _0x3a45df[_0x7ef1('0x49')]({'raw':!![]})[_0x7ef1('0x28')](function(_0x1328e2){for(var _0x18a3b3=0x0;_0x18a3b3<_0x302212[_0x7ef1('0x4a')];_0x18a3b3++){var _0xf76a03=_[_0x7ef1('0x44')](_0x1328e2,[_0x7ef1('0x4b'),_0x302212[_0x18a3b3]['id']]);var _0x374bf5={'id':_0x302212[_0x18a3b3]['id'],'name':_0x302212[_0x18a3b3][_0x7ef1('0x10')],'online':Boolean(_0x302212[_0x18a3b3]['online']),'paused':_0xf76a03?Boolean(_0xf76a03[_0x7ef1('0x3f')]):![]};if(_0x374bf5[_0x7ef1('0x48')])_0x1e9080[_0x7ef1('0x40')]++;if(_0x374bf5[_0x7ef1('0x3f')])_0x1e9080[_0x7ef1('0x3f')]++;_0x1e9080[_0x7ef1('0x43')]['push'](_0x374bf5);}return _0x1e9080;});});}else{var _0x4448ca=_0x7ef1('0x4c')+_[_0x7ef1('0x1a')](_0x3a5835)+_0x7ef1('0x1b');var _0x41debc=_0x3a5835+_0x7ef1('0x4d');return db[_0x4448ca]['findAll']({'where':{[_[_0x7ef1('0x1a')](_0x3a5835)+_0x7ef1('0x4e')]:_0x3a45df['id']},'raw':!![]})[_0x7ef1('0x28')](function(_0x43262e){return db['User'][_0x7ef1('0x4f')]({'attributes':['id','name','online',_0x41debc],'where':{'id':_[_0x7ef1('0x1c')](_0x43262e,'UserId'),'role':_0x7ef1('0x50')},'raw':!![]});})['then'](function(_0x45ab6){for(var _0x17e41f=0x0;_0x17e41f<_0x45ab6[_0x7ef1('0x4a')];_0x17e41f++){var _0x267903={'id':_0x45ab6[_0x17e41f]['id'],'name':_0x45ab6[_0x17e41f][_0x7ef1('0x10')],'online':Boolean(_0x45ab6[_0x17e41f][_0x7ef1('0x48')]),'paused':Boolean(_0x45ab6[_0x17e41f][_0x41debc])};if(_0x267903[_0x7ef1('0x48')])_0x1e9080[_0x7ef1('0x40')]++;if(_0x267903['paused'])_0x1e9080['paused']++;_0x1e9080[_0x7ef1('0x43')][_0x7ef1('0x51')](_0x267903);}return _0x1e9080;});}});return Promise['all'](_0x3eb9a3);});})[_0x7ef1('0x28')](function(_0x2b1141){_0x300645[_0x7ef1('0x3e')]=_0x2b1141;return _0x300645;})['then'](respondWithFilteredResult(_0x57296a,_0x4da0fa))['catch'](handleError(_0x57296a,null));}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index ef81e3f..b594cfa 100644 --- a/server/api/reportAgentPreview/index.js +++ b/server/api/reportAgentPreview/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x54e375,_0x36e6b4){var _0x582c74=function(_0x75e3a3){while(--_0x75e3a3){_0x54e375['push'](_0x54e375['shift']());}};_0x582c74(++_0x36e6b4);}(_0xe706,0xa3));var _0x6e70=function(_0x171ca9,_0x2bb32d){_0x171ca9=_0x171ca9-0x0;var _0x31668f=_0xe706[_0x171ca9];return _0x31668f;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file +var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x10f6f0,_0x5aa2af){var _0xb630fd=function(_0x4035ba){while(--_0x4035ba){_0x10f6f0['push'](_0x10f6f0['shift']());}};_0xb630fd(++_0x5aa2af);}(_0xe706,0xa3));var _0x6e70=function(_0x4932a6,_0x530e29){_0x4932a6=_0x4932a6-0x0;var _0x3b45b9=_0xe706[_0x4932a6];return _0x3b45b9;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.attributes.js b/server/api/reportAgentPreview/reportAgentPreview.attributes.js index b3ae0eb..5b325d6 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 _0x12e9=['INTEGER','DATE','STRING'];(function(_0x5dff66,_0x3ca5d0){var _0x214295=function(_0x5489d5){while(--_0x5489d5){_0x5dff66['push'](_0x5dff66['shift']());}};_0x214295(++_0x3ca5d0);}(_0x12e9,0x66));var _0x912e=function(_0xee70c2,_0x312884){_0xee70c2=_0xee70c2-0x0;var _0x519299=_0x12e9[_0xee70c2];return _0x519299;};'use strict';var Sequelize=require('sequelize');module['exports']={'state':{'type':Sequelize[_0x912e('0x0')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0x912e('0x1')]},'uniqueid':{'type':Sequelize[_0x912e('0x2')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0x912e('0x1')]},'ringtime':{'type':Sequelize[_0x912e('0x0')],'defaultValue':0x0},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0x912e('0x2')]},'membername':{'type':Sequelize[_0x912e('0x2')]}}; \ No newline at end of file +var _0x1a28=['sequelize','exports','INTEGER','STRING','DATE'];(function(_0x2213aa,_0x173e2a){var _0x4786e3=function(_0x8663e2){while(--_0x8663e2){_0x2213aa['push'](_0x2213aa['shift']());}};_0x4786e3(++_0x173e2a);}(_0x1a28,0x10e));var _0x81a2=function(_0x5a6de2,_0x5c8b10){_0x5a6de2=_0x5a6de2-0x0;var _0x2c0525=_0x1a28[_0x5a6de2];return _0x2c0525;};'use strict';var Sequelize=require(_0x81a2('0x0'));module[_0x81a2('0x1')]={'state':{'type':Sequelize[_0x81a2('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x81a2('0x3')]},'scheduledat':{'type':Sequelize[_0x81a2('0x4')]},'uniqueid':{'type':Sequelize[_0x81a2('0x3')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0x81a2('0x2')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0x81a2('0x3')]},'campaigntype':{'type':Sequelize[_0x81a2('0x3')]},'membername':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.model.js b/server/api/reportAgentPreview/reportAgentPreview.model.js index d4e9d77..4b50b7a 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 _0x44fe=['../../config/environment','./reportAgentPreview.attributes','define','ReportAgentPreview','report_agent_preview','lodash','moment','request-promise','path','rimraf'];(function(_0xdfb521,_0x5d7e49){var _0x5c0884=function(_0x53087d){while(--_0x53087d){_0xdfb521['push'](_0xdfb521['shift']());}};_0x5c0884(++_0x5d7e49);}(_0x44fe,0x1a9));var _0xe44f=function(_0x276d1f,_0x2da014){_0x276d1f=_0x276d1f-0x0;var _0x5e5685=_0x44fe[_0x276d1f];return _0x5e5685;};'use strict';var _=require(_0xe44f('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xe44f('0x1'));var BPromise=require('bluebird');var rp=require(_0xe44f('0x2'));var fs=require('fs');var path=require(_0xe44f('0x3'));var rimraf=require(_0xe44f('0x4'));var config=require(_0xe44f('0x5'));var attributes=require(_0xe44f('0x6'));module['exports']=function(_0x10e51f,_0x249525){return _0x10e51f[_0xe44f('0x7')](_0xe44f('0x8'),attributes,{'tableName':_0xe44f('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x24d9=['define','ReportAgentPreview','report_agent_preview','lodash','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./reportAgentPreview.attributes'];(function(_0x28d786,_0x21c3ac){var _0x1d8044=function(_0x10bce5){while(--_0x10bce5){_0x28d786['push'](_0x28d786['shift']());}};_0x1d8044(++_0x21c3ac);}(_0x24d9,0x1cb));var _0x924d=function(_0x250e25,_0x37faa3){_0x250e25=_0x250e25-0x0;var _0x1a1428=_0x24d9[_0x250e25];return _0x1a1428;};'use strict';var _=require(_0x924d('0x0'));var util=require(_0x924d('0x1'));var logger=require(_0x924d('0x2'))(_0x924d('0x3'));var moment=require(_0x924d('0x4'));var BPromise=require(_0x924d('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x924d('0x6'));var config=require(_0x924d('0x7'));var attributes=require(_0x924d('0x8'));module['exports']=function(_0x4d8a3d,_0x12f305){return _0x4d8a3d[_0x924d('0x9')](_0x924d('0xa'),attributes,{'tableName':_0x924d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.rpc.js b/server/api/reportAgentPreview/reportAgentPreview.rpc.js index 7018b1d..d35b14a 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 _0x5533=['request','then','info','ReportAgentPreview,\x20%s,\x20%s','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','catch','CreateReportAgentPreview','ReportAgentPreview','create','body','options','raw','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http'];(function(_0x489639,_0x18208){var _0x322afa=function(_0x2fbaa1){while(--_0x2fbaa1){_0x489639['push'](_0x489639['shift']());}};_0x322afa(++_0x18208);}(_0x5533,0xf9));var _0x3553=function(_0x2cfa66,_0x394e96){_0x2cfa66=_0x2cfa66-0x0;var _0x49fe74=_0x5533[_0x2cfa66];return _0x49fe74;};'use strict';var _=require(_0x3553('0x0'));var util=require(_0x3553('0x1'));var moment=require(_0x3553('0x2'));var BPromise=require('bluebird');var rs=require(_0x3553('0x3'));var fs=require('fs');var Redis=require(_0x3553('0x4'));var db=require(_0x3553('0x5'))['db'];var utils=require(_0x3553('0x6'));var logger=require(_0x3553('0x7'))(_0x3553('0x8'));var config=require(_0x3553('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x3553('0xa')][_0x3553('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x425598,_0x89ee7b,_0x393fce){return new BPromise(function(_0x3cbb8c,_0xc426de){return client[_0x3553('0xc')](_0x425598,_0x393fce)[_0x3553('0xd')](function(_0x3f31aa){logger[_0x3553('0xe')](_0x3553('0xf'),_0x89ee7b,'request\x20sent');logger[_0x3553('0x10')](_0x3553('0x11'),_0x89ee7b,_0x3553('0x12'),JSON['stringify'](_0x3f31aa));if(_0x3f31aa[_0x3553('0x13')]){if(_0x3f31aa[_0x3553('0x13')][_0x3553('0x14')]===0x1f4){logger['error'](_0x3553('0xf'),_0x89ee7b,_0x3f31aa[_0x3553('0x13')][_0x3553('0x15')]);return _0xc426de(_0x3f31aa['error'][_0x3553('0x15')]);}logger['error'](_0x3553('0xf'),_0x89ee7b,_0x3f31aa[_0x3553('0x13')][_0x3553('0x15')]);return _0x3cbb8c(_0x3f31aa[_0x3553('0x13')][_0x3553('0x15')]);}else{logger['info'](_0x3553('0xf'),_0x89ee7b,_0x3553('0x12'));_0x3cbb8c(_0x3f31aa['result'][_0x3553('0x15')]);}})[_0x3553('0x16')](function(_0x5c5778){logger['error'](_0x3553('0xf'),_0x89ee7b,_0x5c5778);_0xc426de(_0x5c5778);});});}exports[_0x3553('0x17')]=function(_0x4d301e){var _0x407f11=this;return new Promise(function(_0x305cdb,_0x16b224){return db[_0x3553('0x18')][_0x3553('0x19')](_0x4d301e[_0x3553('0x1a')],{'raw':_0x4d301e[_0x3553('0x1b')]?_0x4d301e[_0x3553('0x1b')][_0x3553('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x197f18){logger[_0x3553('0xe')](_0x3553('0x17'),_0x4d301e);logger[_0x3553('0x10')]('CreateReportAgentPreview',_0x4d301e,JSON['stringify'](_0x197f18));_0x305cdb(_0x197f18);})[_0x3553('0x16')](function(_0x3ab0d6){logger[_0x3553('0x13')](_0x3553('0x17'),_0x3ab0d6[_0x3553('0x15')],_0x4d301e);_0x16b224(_0x407f11[_0x3553('0x13')](0x1f4,_0x3ab0d6['message']));});});}; \ No newline at end of file +var _0x918d=['CreateReportAgentPreview','ReportAgentPreview','create','body','options','raw','debug','stringify','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','ReportAgentPreview,\x20%s,\x20%s,\x20%s','error','code','ReportAgentPreview,\x20%s,\x20%s','message','info','result','catch'];(function(_0x5a50e1,_0x23facf){var _0x25ba7f=function(_0x1c7b4a){while(--_0x1c7b4a){_0x5a50e1['push'](_0x5a50e1['shift']());}};_0x25ba7f(++_0x23facf);}(_0x918d,0x1ba));var _0xd918=function(_0x3544de,_0x358d94){_0x3544de=_0x3544de-0x0;var _0x54d68b=_0x918d[_0x3544de];return _0x54d68b;};'use strict';var _=require('lodash');var util=require(_0xd918('0x0'));var moment=require(_0xd918('0x1'));var BPromise=require(_0xd918('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd918('0x3'));var db=require(_0xd918('0x4'))['db'];var utils=require(_0xd918('0x5'));var logger=require(_0xd918('0x6'))(_0xd918('0x7'));var config=require(_0xd918('0x8'));var jayson=require(_0xd918('0x9'));var client=jayson[_0xd918('0xa')][_0xd918('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5d34d5,_0x48b211,_0x1523d3){return new BPromise(function(_0x2994a7,_0x1375b7){return client[_0xd918('0xc')](_0x5d34d5,_0x1523d3)[_0xd918('0xd')](function(_0x2f1548){logger['info']('ReportAgentPreview,\x20%s,\x20%s',_0x48b211,_0xd918('0xe'));logger['debug'](_0xd918('0xf'),_0x48b211,_0xd918('0xe'),JSON['stringify'](_0x2f1548));if(_0x2f1548['error']){if(_0x2f1548[_0xd918('0x10')][_0xd918('0x11')]===0x1f4){logger[_0xd918('0x10')](_0xd918('0x12'),_0x48b211,_0x2f1548['error'][_0xd918('0x13')]);return _0x1375b7(_0x2f1548[_0xd918('0x10')]['message']);}logger[_0xd918('0x10')](_0xd918('0x12'),_0x48b211,_0x2f1548['error'][_0xd918('0x13')]);return _0x2994a7(_0x2f1548[_0xd918('0x10')][_0xd918('0x13')]);}else{logger[_0xd918('0x14')]('ReportAgentPreview,\x20%s,\x20%s',_0x48b211,'request\x20sent');_0x2994a7(_0x2f1548[_0xd918('0x15')][_0xd918('0x13')]);}})[_0xd918('0x16')](function(_0x55219b){logger['error'](_0xd918('0x12'),_0x48b211,_0x55219b);_0x1375b7(_0x55219b);});});}exports[_0xd918('0x17')]=function(_0x92185d){var _0x287b64=this;return new Promise(function(_0x2af17c,_0x3e7ae2){return db[_0xd918('0x18')][_0xd918('0x19')](_0x92185d[_0xd918('0x1a')],{'raw':_0x92185d['options']?_0x92185d[_0xd918('0x1b')][_0xd918('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x2715c5){logger[_0xd918('0x14')](_0xd918('0x17'),_0x92185d);logger[_0xd918('0x1d')]('CreateReportAgentPreview',_0x92185d,JSON[_0xd918('0x1e')](_0x2715c5));_0x2af17c(_0x2715c5);})[_0xd918('0x16')](function(_0x40d2b3){logger['error'](_0xd918('0x17'),_0x40d2b3[_0xd918('0x13')],_0x92185d);_0x3e7ae2(_0x287b64[_0xd918('0x10')](0x1f4,_0x40d2b3[_0xd918('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index c5564d6..62f27ea 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 _0x31f9=['/voice/queues/preview/:id','voiceQueuesPreview','/voice/queues/channels','voiceQueuesChannels','/voice/queues/channels/:uniqueid','voiceQueuesChannel','voiceQueuesChannelHangup','/voice/queues/:id','showVoiceQueues','put','updateVoiceQueue','/outbound','outbound','/outbound/channels','outboundChannels','agents','agentCapacity','/telephones','/trunks','trunks','/campaigns','campaigns','/fax/accounts','faxAccounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','/openchannel/queues/:id/waitinginteractions','openchannelQueuesIdWaitingInteractions','/whatsapp/queues/waitinginteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','post','queueNotify','mail','/mail/queues/:id','/chat/queues/:id/notify','chat','/fax/queues/:id/notify','fax','showFaxQueues','/openchannel/queues/:id/notify','/openchannel/queues/:id','showOpenchannelQueues','/sms/queues/:id/notify','/whatsapp/queues/:id/notify','whatsapp','/sms/queues/:id','showSmsQueues','/whatsapp/queues/:id','showWhatsappQueues','agentNotify','exports','util','../../components/auth/service','get','/voice/channels','voiceChannels','/voice/channels/:uniqueid/mixmonitor','isAuthenticated','voiceChannelMixMonitor','voiceChannelStopMixMonitor','/voice/queues','/chat/queues','chatQueues','/mail/queues','mailQueues','/mail/accounts','mailAccounts','/openchannel/queues','openchannelQueues','/sms/queues','smsQueues','whatsappQueues','/fax/queues','faxQueues'];(function(_0x4fb62a,_0x3b8a9f){var _0x146a67=function(_0x167c72){while(--_0x167c72){_0x4fb62a['push'](_0x4fb62a['shift']());}};_0x146a67(++_0x3b8a9f);}(_0x31f9,0x87));var _0x931f=function(_0x518393,_0x3041f2){_0x518393=_0x518393-0x0;var _0x4141ff=_0x31f9[_0x518393];return _0x4141ff;};'use strict';var multer=require('multer');var util=require(_0x931f('0x0'));var path=require('path');var express=require('express');var router=express['Router']();var auth=require(_0x931f('0x1'));var controller=require('./rpc.controller');router[_0x931f('0x2')](_0x931f('0x3'),auth['isAuthenticated'](),controller[_0x931f('0x4')]);router[_0x931f('0x2')](_0x931f('0x5'),auth[_0x931f('0x6')](),controller[_0x931f('0x7')]);router['get']('/voice/channels/:uniqueid/stopmixmonitor',auth['isAuthenticated'](),controller[_0x931f('0x8')]);router[_0x931f('0x2')](_0x931f('0x9'),auth[_0x931f('0x6')](),controller['voiceQueues']);router['get'](_0x931f('0xa'),auth[_0x931f('0x6')](),controller[_0x931f('0xb')]);router[_0x931f('0x2')](_0x931f('0xc'),auth['isAuthenticated'](),controller[_0x931f('0xd')]);router[_0x931f('0x2')](_0x931f('0xe'),auth[_0x931f('0x6')](),controller[_0x931f('0xf')]);router['get'](_0x931f('0x10'),auth[_0x931f('0x6')](),controller[_0x931f('0x11')]);router[_0x931f('0x2')](_0x931f('0x12'),auth['isAuthenticated'](),controller[_0x931f('0x13')]);router[_0x931f('0x2')]('/whatsapp/queues',auth[_0x931f('0x6')](),controller[_0x931f('0x14')]);router['get'](_0x931f('0x15'),auth[_0x931f('0x6')](),controller[_0x931f('0x16')]);router[_0x931f('0x2')](_0x931f('0x17'),auth[_0x931f('0x6')](),controller[_0x931f('0x18')]);router[_0x931f('0x2')](_0x931f('0x19'),auth[_0x931f('0x6')](),controller[_0x931f('0x1a')]);router[_0x931f('0x2')](_0x931f('0x1b'),auth[_0x931f('0x6')](),controller[_0x931f('0x1c')]);router[_0x931f('0x2')]('/voice/queues/channels/:uniqueid/hangup',auth[_0x931f('0x6')](),controller[_0x931f('0x1d')]);router[_0x931f('0x2')]('/voice/queues/channels/:uniqueid/redirect/:exten',auth[_0x931f('0x6')](),controller['voiceQueuesChannelRedirect']);router['get'](_0x931f('0x1e'),auth[_0x931f('0x6')](),controller[_0x931f('0x1f')]);router[_0x931f('0x20')](_0x931f('0x1e'),auth[_0x931f('0x6')](),controller[_0x931f('0x21')]);router[_0x931f('0x2')](_0x931f('0x22'),auth[_0x931f('0x6')](),controller[_0x931f('0x23')]);router[_0x931f('0x2')](_0x931f('0x24'),auth[_0x931f('0x6')](),controller[_0x931f('0x25')]);router[_0x931f('0x2')]('/agents',auth[_0x931f('0x6')](),controller[_0x931f('0x26')]);router['put']('/agents/:id/capacity',auth['isAuthenticated'](),controller[_0x931f('0x27')]);router['get'](_0x931f('0x28'),auth[_0x931f('0x6')](),controller['telephones']);router[_0x931f('0x2')](_0x931f('0x29'),auth[_0x931f('0x6')](),controller[_0x931f('0x2a')]);router[_0x931f('0x2')](_0x931f('0x2b'),auth[_0x931f('0x6')](),controller[_0x931f('0x2c')]);router['get'](_0x931f('0x2d'),auth[_0x931f('0x6')](),controller[_0x931f('0x2e')]);router[_0x931f('0x2')](_0x931f('0x2f'),auth[_0x931f('0x6')](),controller[_0x931f('0x30')]);router['get'](_0x931f('0x31'),auth[_0x931f('0x6')](),controller[_0x931f('0x32')]);router[_0x931f('0x2')]('/openchannel/queues/waitinginteractions',auth[_0x931f('0x6')](),controller[_0x931f('0x33')]);router['get'](_0x931f('0x34'),auth[_0x931f('0x6')](),controller[_0x931f('0x35')]);router[_0x931f('0x2')]('/sms/queues/waitinginteractions',auth['isAuthenticated'](),controller['smsQueuesWaitingInteractions']);router[_0x931f('0x2')](_0x931f('0x36'),auth[_0x931f('0x6')](),controller[_0x931f('0x37')]);router[_0x931f('0x2')](_0x931f('0x38'),auth[_0x931f('0x6')](),controller[_0x931f('0x39')]);router[_0x931f('0x3a')]('/mail/queues/:id/notify',auth[_0x931f('0x6')](),controller[_0x931f('0x3b')](_0x931f('0x3c')));router[_0x931f('0x2')](_0x931f('0x3d'),auth[_0x931f('0x6')](),controller['showMailQueues']);router[_0x931f('0x3a')](_0x931f('0x3e'),auth[_0x931f('0x6')](),controller[_0x931f('0x3b')](_0x931f('0x3f')));router[_0x931f('0x2')]('/chat/queues/:id',auth[_0x931f('0x6')](),controller['showChatQueues']);router['post'](_0x931f('0x40'),auth[_0x931f('0x6')](),controller[_0x931f('0x3b')](_0x931f('0x41')));router[_0x931f('0x2')]('/fax/queues/:id',auth['isAuthenticated'](),controller[_0x931f('0x42')]);router[_0x931f('0x3a')](_0x931f('0x43'),auth[_0x931f('0x6')](),controller[_0x931f('0x3b')]('openchannel'));router[_0x931f('0x2')](_0x931f('0x44'),auth['isAuthenticated'](),controller[_0x931f('0x45')]);router[_0x931f('0x3a')](_0x931f('0x46'),auth[_0x931f('0x6')](),controller['queueNotify']('sms'));router['post'](_0x931f('0x47'),auth['isAuthenticated'](),controller[_0x931f('0x3b')](_0x931f('0x48')));router[_0x931f('0x2')](_0x931f('0x49'),auth[_0x931f('0x6')](),controller[_0x931f('0x4a')]);router['get'](_0x931f('0x4b'),auth[_0x931f('0x6')](),controller[_0x931f('0x4c')]);router['post']('/agents/:id/notify',auth[_0x931f('0x6')](),controller[_0x931f('0x4d')]);module[_0x931f('0x4e')]=router; \ No newline at end of file +var _0x9496=['agentCapacity','/telephones','/trunks','/fax/accounts','faxAccounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','/openchannel/queues/:id/waitinginteractions','openchannelQueuesIdWaitingInteractions','smsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','post','/mail/queues/:id/notify','queueNotify','mail','showMailQueues','/chat/queues/:id/notify','chat','/chat/queues/:id','/fax/queues/:id/notify','fax','showFaxQueues','/openchannel/queues/:id/notify','openchannel','/openchannel/queues/:id','showOpenchannelQueues','/sms/queues/:id/notify','sms','/whatsapp/queues/:id/notify','/whatsapp/queues/:id','showWhatsappQueues','/agents/:id/notify','agentNotify','exports','multer','util','express','../../components/auth/service','get','/voice/channels','voiceChannels','/voice/channels/:uniqueid/mixmonitor','isAuthenticated','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','voiceQueues','/chat/queues','chatQueues','/mail/queues','/mail/accounts','/openchannel/queues','openchannelQueues','/sms/queues','smsQueues','/fax/queues','/voice/queues/preview/:id','voiceQueuesPreview','/voice/queues/channels','/voice/queues/channels/:uniqueid','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','showVoiceQueues','put','/voice/queues/:id','outbound','/outbound/channels','/agents','/agents/:id/capacity'];(function(_0x4ce66b,_0x4130cb){var _0x1e732e=function(_0x195e99){while(--_0x195e99){_0x4ce66b['push'](_0x4ce66b['shift']());}};_0x1e732e(++_0x4130cb);}(_0x9496,0xc4));var _0x6949=function(_0xaa1b3e,_0x47d976){_0xaa1b3e=_0xaa1b3e-0x0;var _0x454d7d=_0x9496[_0xaa1b3e];return _0x454d7d;};'use strict';var multer=require(_0x6949('0x0'));var util=require(_0x6949('0x1'));var path=require('path');var express=require(_0x6949('0x2'));var router=express['Router']();var auth=require(_0x6949('0x3'));var controller=require('./rpc.controller');router[_0x6949('0x4')](_0x6949('0x5'),auth['isAuthenticated'](),controller[_0x6949('0x6')]);router[_0x6949('0x4')](_0x6949('0x7'),auth[_0x6949('0x8')](),controller[_0x6949('0x9')]);router[_0x6949('0x4')](_0x6949('0xa'),auth[_0x6949('0x8')](),controller[_0x6949('0xb')]);router[_0x6949('0x4')]('/voice/queues',auth[_0x6949('0x8')](),controller[_0x6949('0xc')]);router[_0x6949('0x4')](_0x6949('0xd'),auth[_0x6949('0x8')](),controller[_0x6949('0xe')]);router[_0x6949('0x4')](_0x6949('0xf'),auth[_0x6949('0x8')](),controller['mailQueues']);router[_0x6949('0x4')](_0x6949('0x10'),auth['isAuthenticated'](),controller['mailAccounts']);router[_0x6949('0x4')](_0x6949('0x11'),auth['isAuthenticated'](),controller[_0x6949('0x12')]);router[_0x6949('0x4')](_0x6949('0x13'),auth[_0x6949('0x8')](),controller[_0x6949('0x14')]);router[_0x6949('0x4')]('/whatsapp/queues',auth['isAuthenticated'](),controller['whatsappQueues']);router[_0x6949('0x4')](_0x6949('0x15'),auth[_0x6949('0x8')](),controller['faxQueues']);router[_0x6949('0x4')](_0x6949('0x16'),auth[_0x6949('0x8')](),controller[_0x6949('0x17')]);router['get'](_0x6949('0x18'),auth[_0x6949('0x8')](),controller['voiceQueuesChannels']);router['get'](_0x6949('0x19'),auth[_0x6949('0x8')](),controller[_0x6949('0x1a')]);router[_0x6949('0x4')](_0x6949('0x1b'),auth[_0x6949('0x8')](),controller[_0x6949('0x1c')]);router[_0x6949('0x4')](_0x6949('0x1d'),auth['isAuthenticated'](),controller[_0x6949('0x1e')]);router[_0x6949('0x4')]('/voice/queues/:id',auth[_0x6949('0x8')](),controller[_0x6949('0x1f')]);router[_0x6949('0x20')](_0x6949('0x21'),auth[_0x6949('0x8')](),controller['updateVoiceQueue']);router[_0x6949('0x4')]('/outbound',auth[_0x6949('0x8')](),controller[_0x6949('0x22')]);router[_0x6949('0x4')](_0x6949('0x23'),auth[_0x6949('0x8')](),controller['outboundChannels']);router[_0x6949('0x4')](_0x6949('0x24'),auth[_0x6949('0x8')](),controller['agents']);router[_0x6949('0x20')](_0x6949('0x25'),auth[_0x6949('0x8')](),controller[_0x6949('0x26')]);router['get'](_0x6949('0x27'),auth[_0x6949('0x8')](),controller['telephones']);router[_0x6949('0x4')](_0x6949('0x28'),auth['isAuthenticated'](),controller['trunks']);router[_0x6949('0x4')]('/campaigns',auth['isAuthenticated'](),controller['campaigns']);router[_0x6949('0x4')](_0x6949('0x29'),auth['isAuthenticated'](),controller[_0x6949('0x2a')]);router[_0x6949('0x4')](_0x6949('0x2b'),auth[_0x6949('0x8')](),controller[_0x6949('0x2c')]);router['get'](_0x6949('0x2d'),auth[_0x6949('0x8')](),controller[_0x6949('0x2e')]);router[_0x6949('0x4')](_0x6949('0x2f'),auth[_0x6949('0x8')](),controller[_0x6949('0x30')]);router[_0x6949('0x4')](_0x6949('0x31'),auth[_0x6949('0x8')](),controller[_0x6949('0x32')]);router[_0x6949('0x4')]('/sms/queues/waitinginteractions',auth[_0x6949('0x8')](),controller[_0x6949('0x33')]);router['get']('/whatsapp/queues/waitinginteractions',auth[_0x6949('0x8')](),controller[_0x6949('0x34')]);router[_0x6949('0x4')](_0x6949('0x35'),auth[_0x6949('0x8')](),controller[_0x6949('0x36')]);router[_0x6949('0x37')](_0x6949('0x38'),auth[_0x6949('0x8')](),controller[_0x6949('0x39')](_0x6949('0x3a')));router[_0x6949('0x4')]('/mail/queues/:id',auth[_0x6949('0x8')](),controller[_0x6949('0x3b')]);router[_0x6949('0x37')](_0x6949('0x3c'),auth['isAuthenticated'](),controller[_0x6949('0x39')](_0x6949('0x3d')));router[_0x6949('0x4')](_0x6949('0x3e'),auth[_0x6949('0x8')](),controller['showChatQueues']);router[_0x6949('0x37')](_0x6949('0x3f'),auth[_0x6949('0x8')](),controller[_0x6949('0x39')](_0x6949('0x40')));router[_0x6949('0x4')]('/fax/queues/:id',auth[_0x6949('0x8')](),controller[_0x6949('0x41')]);router[_0x6949('0x37')](_0x6949('0x42'),auth[_0x6949('0x8')](),controller[_0x6949('0x39')](_0x6949('0x43')));router[_0x6949('0x4')](_0x6949('0x44'),auth[_0x6949('0x8')](),controller[_0x6949('0x45')]);router['post'](_0x6949('0x46'),auth['isAuthenticated'](),controller[_0x6949('0x39')](_0x6949('0x47')));router[_0x6949('0x37')](_0x6949('0x48'),auth[_0x6949('0x8')](),controller[_0x6949('0x39')]('whatsapp'));router[_0x6949('0x4')]('/sms/queues/:id',auth['isAuthenticated'](),controller['showSmsQueues']);router[_0x6949('0x4')](_0x6949('0x49'),auth[_0x6949('0x8')](),controller[_0x6949('0x4a')]);router[_0x6949('0x37')](_0x6949('0x4b'),auth[_0x6949('0x8')](),controller[_0x6949('0x4c')]);module[_0x6949('0x4d')]=router; \ No newline at end of file diff --git a/server/api/rpc/rpc.controller.js b/server/api/rpc/rpc.controller.js index 3d5f717..8bfa2f3 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 _0xabce=['InteractionId','From','QueueId','TransferReport','create','queueTransferTimeout','*,*,*,*','agentNotify','channel','Channel\x20field\x20is\x20mandatory','Agent\x20not\x20found','update','agentTransferTimeout','bluebird','moment','lodash','util','../../mysqldb','jayson/promise','client','http','request','then','error','code','message','result','catch','json','sendStatus','stack','name','status','send','isNil','rows','find','voiceChannels','query','voiceChannelMixMonitor','VoiceChannelMixMonitor','merge','params','voiceChannelStopMixMonitor','VoiceChannelStopMixMonitor','VoiceQueues','showVoiceQueues','UpdateVoiceQueue','body','voiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','voiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','Outbound','OutboundChannels','Agents','agentCapacity','interaction','MemberReport','findAll','user','INTERACTION','length','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','findOrCreate','interface','agent','internal','AgentCapacity','telephones','Telephones','trunks','campaigns','Campaigns','chatQueues','ChatQueues','showChatQueues','mailQueues','MailQueues','showMailQueues','mailAccounts','MailAccounts','openchannelQueues','OpenchannelQueues','showOpenchannelQueues','smsQueues','SmsQueues','showSmsQueues','whatsappQueues','showWhatsappQueues','FaxAccounts','MailQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','type','map','value','indexOf','queue_id','filter','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','queueNotify','capitalize','chat','Website','Account','Queue','findOne','\x20Queue\x20not\x20found','Message','messageId','Interaction','queue','MessageId'];(function(_0x134c79,_0x2136d3){var _0x2c2142=function(_0x537f61){while(--_0x537f61){_0x134c79['push'](_0x134c79['shift']());}};_0x2c2142(++_0x2136d3);}(_0xabce,0x103));var _0xeabc=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0xabce[_0x1ac595];return _0x455fff;};'use strict';var BPromise=require(_0xeabc('0x0'));var moment=require(_0xeabc('0x1'));var _=require(_0xeabc('0x2'));var util=require(_0xeabc('0x3'));var db=require(_0xeabc('0x4'))['db'];var logger=require('../../config/logger')('api');var jayson=require(_0xeabc('0x5'));var amiClient=jayson[_0xeabc('0x6')][_0xeabc('0x7')]({'port':0x232a});var mailClient=jayson['client']['http']({'port':0x232b});var routingClient=jayson[_0xeabc('0x6')]['http']({'port':0x232c});function respondWithRpcPromise(_0x229ba4,_0x52ede8,_0x3bdc29){return new BPromise(function(_0x9417af,_0x8434c5){var _0x5d59d5=_0x3bdc29?_0x3bdc29:amiClient;return _0x5d59d5[_0xeabc('0x8')](_0x229ba4,_0x52ede8)[_0xeabc('0x9')](function(_0x2f73e9){if(_0x2f73e9[_0xeabc('0xa')]){if(_0x2f73e9[_0xeabc('0xa')][_0xeabc('0xb')]===0x1f4){return _0x8434c5(_0x2f73e9[_0xeabc('0xa')][_0xeabc('0xc')]);}return _0x9417af(_0x2f73e9[_0xeabc('0xa')][_0xeabc('0xc')]);}else{_0x9417af(_0x2f73e9[_0xeabc('0xd')]);}})[_0xeabc('0xe')](function(_0x435ea7){_0x8434c5(_0x435ea7);});});}function respondWithResult(_0x3fd0b5,_0x36a92e){_0x36a92e=_0x36a92e||0xc8;return function(_0xcfbf06){if(_0xcfbf06){return _0x3fd0b5['status'](_0x36a92e)[_0xeabc('0xf')](_0xcfbf06);}return _0x3fd0b5[_0xeabc('0x10')](0x194);};}function handleError(_0x3251c6,_0x55f0de){_0x55f0de=_0x55f0de||0x1f4;return function(_0x5f4ee8){logger[_0xeabc('0xa')](_0x5f4ee8[_0xeabc('0x11')]);if(_0x5f4ee8[_0xeabc('0x12')]){delete _0x5f4ee8['name'];}_0x3251c6[_0xeabc('0x13')](_0x55f0de)[_0xeabc('0x14')](_0x5f4ee8);};}function findById(_0x49f2d8){return function(_0x53fe28){if(!_[_0xeabc('0x15')](_0x49f2d8)&&!_['isNil'](_0x53fe28)&&!_[_0xeabc('0x15')](_0x53fe28[_0xeabc('0x16')])){return _[_0xeabc('0x17')](_0x53fe28[_0xeabc('0x16')],function(_0x31dd53){return _0x31dd53['id']==_0x49f2d8;});}return null;};}exports[_0xeabc('0x18')]=function(_0x384be5,_0x5e30ee){return respondWithRpcPromise('VoiceChannels',_0x384be5[_0xeabc('0x19')])['then'](respondWithResult(_0x5e30ee,null))[_0xeabc('0xe')](handleError(_0x5e30ee,null));};exports[_0xeabc('0x1a')]=function(_0x502947,_0x28063a){return respondWithRpcPromise(_0xeabc('0x1b'),_[_0xeabc('0x1c')](_0x502947[_0xeabc('0x19')],_0x502947[_0xeabc('0x1d')]))['then'](respondWithResult(_0x28063a,null))[_0xeabc('0xe')](handleError(_0x28063a,null));};exports[_0xeabc('0x1e')]=function(_0x91ab00,_0x5bdd57){return respondWithRpcPromise(_0xeabc('0x1f'),_[_0xeabc('0x1c')](_0x91ab00[_0xeabc('0x19')],_0x91ab00[_0xeabc('0x1d')]))['then'](respondWithResult(_0x5bdd57,null))[_0xeabc('0xe')](handleError(_0x5bdd57,null));};exports['voiceQueues']=function(_0x27dbaf,_0x4d4e29){return respondWithRpcPromise(_0xeabc('0x20'),_0x27dbaf[_0xeabc('0x19')])[_0xeabc('0x9')](respondWithResult(_0x4d4e29,null))[_0xeabc('0xe')](handleError(_0x4d4e29,null));};exports[_0xeabc('0x21')]=function(_0x137293,_0x131722){return respondWithRpcPromise('VoiceQueues',_0x137293['query'])[_0xeabc('0x9')](findById(_0x137293['params']['id']))[_0xeabc('0x9')](respondWithResult(_0x131722,null))[_0xeabc('0xe')](handleError(_0x131722,null));};exports['updateVoiceQueue']=function(_0x2163e6,_0x38572d){return respondWithRpcPromise(_0xeabc('0x22'),_[_0xeabc('0x1c')](_0x2163e6[_0xeabc('0x23')],_0x2163e6[_0xeabc('0x1d')]))[_0xeabc('0x9')](respondWithResult(_0x38572d,null))[_0xeabc('0xe')](handleError(_0x38572d,null));};exports[_0xeabc('0x24')]=function(_0x5ebb86,_0x5b34dd){return respondWithRpcPromise('VoiceQueuesPreview',_[_0xeabc('0x1c')](_0x5ebb86[_0xeabc('0x19')],_0x5ebb86[_0xeabc('0x1d')]))[_0xeabc('0x9')](respondWithResult(_0x5b34dd,null))[_0xeabc('0xe')](handleError(_0x5b34dd,null));};exports[_0xeabc('0x25')]=function(_0x61c0af,_0x545d7f){return respondWithRpcPromise(_0xeabc('0x26'),_0x61c0af[_0xeabc('0x19')])[_0xeabc('0x9')](respondWithResult(_0x545d7f,null))['catch'](handleError(_0x545d7f,null));};exports[_0xeabc('0x27')]=function(_0x3777c1,_0x4492fd){return respondWithRpcPromise('VoiceQueuesChannel',_[_0xeabc('0x1c')](_0x3777c1[_0xeabc('0x19')],_0x3777c1[_0xeabc('0x1d')]))['then'](respondWithResult(_0x4492fd,null))[_0xeabc('0xe')](handleError(_0x4492fd,null));};exports[_0xeabc('0x28')]=function(_0x5d9acf,_0x50cca2){return respondWithRpcPromise(_0xeabc('0x29'),_[_0xeabc('0x1c')](_0x5d9acf['query'],_0x5d9acf[_0xeabc('0x1d')]))[_0xeabc('0x9')](respondWithResult(_0x50cca2,null))[_0xeabc('0xe')](handleError(_0x50cca2,null));};exports[_0xeabc('0x2a')]=function(_0x34057c,_0x4b7923){return respondWithRpcPromise(_0xeabc('0x2b'),_['merge'](_0x34057c[_0xeabc('0x19')],_0x34057c[_0xeabc('0x1d')]))[_0xeabc('0x9')](respondWithResult(_0x4b7923,null))['catch'](handleError(_0x4b7923,null));};exports['outbound']=function(_0x452580,_0x560d4a){return respondWithRpcPromise(_0xeabc('0x2c'),_0x452580['query'])['then'](respondWithResult(_0x560d4a,null))['catch'](handleError(_0x560d4a,null));};exports['outboundChannels']=function(_0x1e222a,_0x593588){return respondWithRpcPromise(_0xeabc('0x2d'),_0x1e222a[_0xeabc('0x19')])['then'](respondWithResult(_0x593588,null))[_0xeabc('0xe')](handleError(_0x593588,null));};exports['agents']=function(_0x3d48f4,_0x58aafe){var _0xbd7f03;return respondWithRpcPromise(_0xeabc('0x2e'),_0x3d48f4[_0xeabc('0x19')])['then'](function(_0x5a00d0){_0xbd7f03=_0x5a00d0;return respondWithRpcPromise('Agents',_0x3d48f4[_0xeabc('0x19')],routingClient);})[_0xeabc('0x9')](function(_0xafa59b){return _['merge']({},_0xafa59b,_0xbd7f03);})['then'](respondWithResult(_0x58aafe,null))[_0xeabc('0xe')](handleError(_0x58aafe,null));};exports[_0xeabc('0x2f')]=function(_0x5e9cb3,_0xc6af4d){if(_0x5e9cb3['body']&&_0x5e9cb3[_0xeabc('0x23')]['interaction']&&_0x5e9cb3['user']&&_0x5e9cb3['user'][_0xeabc('0x12')]){for(var _0x37c926 in _0x5e9cb3[_0xeabc('0x23')][_0xeabc('0x30')]){if(_0x5e9cb3['body'][_0xeabc('0x30')]['hasOwnProperty'](_0x37c926)){db[_0xeabc('0x31')][_0xeabc('0x32')]({'where':{'channel':_0x37c926,'membername':_0x5e9cb3[_0xeabc('0x33')][_0xeabc('0x12')],'type':_0xeabc('0x34'),'exitAt':null,'uniqueid':_0x5e9cb3['body']['interaction'][_0x37c926]&&_0x5e9cb3[_0xeabc('0x23')]['interaction'][_0x37c926][_0xeabc('0x35')]?{'$notIn':_0x5e9cb3[_0xeabc('0x23')]['interaction'][_0x37c926]}:{'$ne':null}}})[_0xeabc('0x9')](function(_0x2b3c28){var _0x459c98=moment()[_0xeabc('0x36')](_0xeabc('0x37'));for(var _0xcaa5b9=0x0,_0x2003a7=_0x2b3c28['length'];_0xcaa5b9<_0x2003a7;_0xcaa5b9+=0x1){_0x2b3c28[_0xcaa5b9][_0xeabc('0x38')]({'exitAt':_0x459c98});}});for(var _0x2c85f0=0x0;_0x2c85f0<_0x5e9cb3[_0xeabc('0x23')][_0xeabc('0x30')][_0x37c926][_0xeabc('0x35')];_0x2c85f0+=0x1){db[_0xeabc('0x31')][_0xeabc('0x39')]({'where':{'channel':_0x37c926,'membername':_0x5e9cb3[_0xeabc('0x33')][_0xeabc('0x12')],'type':_0xeabc('0x34'),'uniqueid':_0x5e9cb3['body'][_0xeabc('0x30')][_0x37c926][_0x2c85f0],'exitAt':null},'defaults':{'channel':_0x37c926,'membername':_0x5e9cb3[_0xeabc('0x33')][_0xeabc('0x12')],'interface':_[_0xeabc('0x15')](_0x5e9cb3[_0xeabc('0x33')][_0xeabc('0x3a')])?util[_0xeabc('0x36')]('SIP/%s',_0x5e9cb3[_0xeabc('0x33')][_0xeabc('0x12')]):_0x5e9cb3[_0xeabc('0x33')][_0xeabc('0x3a')],'type':_0xeabc('0x34'),'enterAt':moment()['format'](_0xeabc('0x37')),'role':_0xeabc('0x3b'),'internal':_0x5e9cb3[_0xeabc('0x33')][_0xeabc('0x3c')],'uniqueid':_0x5e9cb3['body'][_0xeabc('0x30')][_0x37c926][_0x2c85f0]}});}}}}return respondWithRpcPromise(_0xeabc('0x3d'),{'id':_0x5e9cb3['params']['id'],'capacity':_0x5e9cb3[_0xeabc('0x23')]['capacity']},routingClient)[_0xeabc('0x9')](respondWithResult(_0xc6af4d,null))['catch'](handleError(_0xc6af4d,null));};exports[_0xeabc('0x3e')]=function(_0x2ec94c,_0x38f988){return respondWithRpcPromise(_0xeabc('0x3f'),_0x2ec94c[_0xeabc('0x19')])[_0xeabc('0x9')](respondWithResult(_0x38f988,null))[_0xeabc('0xe')](handleError(_0x38f988,null));};exports[_0xeabc('0x40')]=function(_0x31aedf,_0x6423f3){return respondWithRpcPromise('Trunks',_0x31aedf[_0xeabc('0x19')])[_0xeabc('0x9')](respondWithResult(_0x6423f3,null))[_0xeabc('0xe')](handleError(_0x6423f3,null));};exports[_0xeabc('0x41')]=function(_0x555d6b,_0x1cef45){return respondWithRpcPromise(_0xeabc('0x42'),_0x555d6b[_0xeabc('0x19')])[_0xeabc('0x9')](respondWithResult(_0x1cef45,null))['catch'](handleError(_0x1cef45,null));};exports[_0xeabc('0x43')]=function(_0x1c7679,_0x3a1b84){return respondWithRpcPromise(_0xeabc('0x44'),_0x1c7679[_0xeabc('0x19')],routingClient)[_0xeabc('0x9')](respondWithResult(_0x3a1b84,null))[_0xeabc('0xe')](handleError(_0x3a1b84,null));};exports[_0xeabc('0x45')]=function(_0x17acf8,_0x58ab08){return respondWithRpcPromise(_0xeabc('0x44'),_0x17acf8['query'],routingClient)['then'](findById(_0x17acf8['params']['id']))[_0xeabc('0x9')](respondWithResult(_0x58ab08,null))[_0xeabc('0xe')](handleError(_0x58ab08,null));};exports[_0xeabc('0x46')]=function(_0xb35103,_0xe89728){return respondWithRpcPromise(_0xeabc('0x47'),_0xb35103['query'],routingClient)[_0xeabc('0x9')](respondWithResult(_0xe89728,null))[_0xeabc('0xe')](handleError(_0xe89728,null));};exports[_0xeabc('0x48')]=function(_0x104c1e,_0x2ddc53){return respondWithRpcPromise(_0xeabc('0x47'),_0x104c1e[_0xeabc('0x19')],routingClient)[_0xeabc('0x9')](findById(_0x104c1e['params']['id']))['then'](respondWithResult(_0x2ddc53,null))[_0xeabc('0xe')](handleError(_0x2ddc53,null));};exports[_0xeabc('0x49')]=function(_0x2c0894,_0x4b3794){return respondWithRpcPromise(_0xeabc('0x4a'),_0x2c0894['query'],mailClient)['then'](respondWithResult(_0x4b3794,null))[_0xeabc('0xe')](handleError(_0x4b3794,null));};exports[_0xeabc('0x4b')]=function(_0x13f04f,_0x4f5451){return respondWithRpcPromise(_0xeabc('0x4c'),_0x13f04f[_0xeabc('0x19')],routingClient)['then'](respondWithResult(_0x4f5451,null))[_0xeabc('0xe')](handleError(_0x4f5451,null));};exports[_0xeabc('0x4d')]=function(_0x321a90,_0x7697f7){return respondWithRpcPromise(_0xeabc('0x4c'),_0x321a90[_0xeabc('0x19')],routingClient)['then'](findById(_0x321a90[_0xeabc('0x1d')]['id']))[_0xeabc('0x9')](respondWithResult(_0x7697f7,null))[_0xeabc('0xe')](handleError(_0x7697f7,null));};exports[_0xeabc('0x4e')]=function(_0x1b61a8,_0x19faa4){return respondWithRpcPromise(_0xeabc('0x4f'),_0x1b61a8[_0xeabc('0x19')],routingClient)[_0xeabc('0x9')](respondWithResult(_0x19faa4,null))['catch'](handleError(_0x19faa4,null));};exports[_0xeabc('0x50')]=function(_0x590439,_0x404846){return respondWithRpcPromise(_0xeabc('0x4f'),_0x590439[_0xeabc('0x19')],routingClient)[_0xeabc('0x9')](findById(_0x590439[_0xeabc('0x1d')]['id']))[_0xeabc('0x9')](respondWithResult(_0x404846,null))[_0xeabc('0xe')](handleError(_0x404846,null));};exports[_0xeabc('0x51')]=function(_0x5d4bc2,_0x24d0e5){return respondWithRpcPromise('WhatsappQueues',_0x5d4bc2[_0xeabc('0x19')],routingClient)[_0xeabc('0x9')](respondWithResult(_0x24d0e5,null))[_0xeabc('0xe')](handleError(_0x24d0e5,null));};exports[_0xeabc('0x52')]=function(_0x5b4430,_0x12fd48){return respondWithRpcPromise('WhatsappQueues',_0x5b4430['query'],routingClient)[_0xeabc('0x9')](findById(_0x5b4430[_0xeabc('0x1d')]['id']))[_0xeabc('0x9')](respondWithResult(_0x12fd48,null))[_0xeabc('0xe')](handleError(_0x12fd48,null));};exports['faxQueues']=function(_0x51a0c7,_0x2e712e){return respondWithRpcPromise('FaxQueues',_0x51a0c7['query'],routingClient)[_0xeabc('0x9')](respondWithResult(_0x2e712e,null))['catch'](handleError(_0x2e712e,null));};exports['showFaxQueues']=function(_0xa44f2d,_0x1c84b5){return respondWithRpcPromise('FaxQueues',_0xa44f2d['query'],routingClient)[_0xeabc('0x9')](findById(_0xa44f2d['params']['id']))[_0xeabc('0x9')](respondWithResult(_0x1c84b5,null))[_0xeabc('0xe')](handleError(_0x1c84b5,null));};exports['faxAccounts']=function(_0x5d6477,_0x24365a){return respondWithRpcPromise(_0xeabc('0x53'),_0x5d6477[_0xeabc('0x19')])[_0xeabc('0x9')](respondWithResult(_0x24365a,null))[_0xeabc('0xe')](handleError(_0x24365a,null));};exports['chatQueuesWaitingInteractions']=function(_0x53f578,_0x391cae){return respondWithRpcPromise('ChatQueuesWaitingInteractions',_0x53f578[_0xeabc('0x19')],routingClient)['then'](respondWithResult(_0x391cae,null))[_0xeabc('0xe')](handleError(_0x391cae,null));};exports['mailQueuesWaitingInteractions']=function(_0x1fdaba,_0x53ac31){return respondWithRpcPromise(_0xeabc('0x54'),_0x1fdaba[_0xeabc('0x19')],routingClient)[_0xeabc('0x9')](respondWithResult(_0x53ac31,null))[_0xeabc('0xe')](handleError(_0x53ac31,null));};exports['openchannelQueuesWaitingInteractions']=function(_0x6ee7cf,_0x4fa682){return respondWithRpcPromise(_0xeabc('0x55'),_0x6ee7cf[_0xeabc('0x19')],routingClient)[_0xeabc('0x9')](respondWithResult(_0x4fa682,null))[_0xeabc('0xe')](handleError(_0x4fa682,null));};exports[_0xeabc('0x56')]=function(_0x5c1ab2,_0x239350){return respondWithRpcPromise(_0xeabc('0x55'),_0x5c1ab2[_0xeabc('0x19')],routingClient)[_0xeabc('0x9')](function(_0x5427c8){if(_0x5c1ab2[_0xeabc('0x19')][_0xeabc('0x57')]!==undefined){var _0xe60b11=_(_0x5427c8[_0xeabc('0x16')])['filter']([_0x5c1ab2[_0xeabc('0x19')][_0xeabc('0x57')],_0x5c1ab2[_0xeabc('0x1d')]['id']])[_0xeabc('0x58')]('queue_id')['uniq']()[_0xeabc('0x59')]();return _0x5427c8['rows']['filter'](function(_0x3271b6){return _0xe60b11[_0xeabc('0x5a')](_0x3271b6[_0xeabc('0x5b')])>-0x1;});}else{return _0x5427c8['rows'][_0xeabc('0x5c')](function(_0x403b18){return _0x403b18['queue_id']===parseInt(_0x5c1ab2[_0xeabc('0x1d')]['id']);});}})[_0xeabc('0x9')](respondWithResult(_0x239350,null))[_0xeabc('0xe')](handleError(_0x239350,null));};exports[_0xeabc('0x5d')]=function(_0x2ece2c,_0x4bf9d8){return respondWithRpcPromise(_0xeabc('0x5e'),_0x2ece2c['query'],routingClient)['then'](respondWithResult(_0x4bf9d8,null))['catch'](handleError(_0x4bf9d8,null));};exports[_0xeabc('0x5f')]=function(_0x1c8a51,_0x1b6e9e){return respondWithRpcPromise(_0xeabc('0x60'),_0x1c8a51[_0xeabc('0x19')],routingClient)['then'](respondWithResult(_0x1b6e9e,null))[_0xeabc('0xe')](handleError(_0x1b6e9e,null));};exports['faxQueuesWaitingInteractions']=function(_0x1795fe,_0x2f95c7){return respondWithRpcPromise('FaxQueuesWaitingInteractions',_0x1795fe[_0xeabc('0x19')],routingClient)['then'](respondWithResult(_0x2f95c7,null))['catch'](handleError(_0x2f95c7,null));};exports[_0xeabc('0x61')]=function(_0xa5c4ca){return function(_0x439a48,_0x3acb88){var _0x3c6a49,_0x4dfc4b;var _0x399735=_[_0xeabc('0x62')](_0xa5c4ca);var _0x33e5fb=_0xa5c4ca===_0xeabc('0x63')?_0xeabc('0x64'):_0xeabc('0x65');return db[_0x399735+_0xeabc('0x66')][_0xeabc('0x67')]({'raw':!![],'where':{'id':_0x439a48[_0xeabc('0x1d')]['id']}})[_0xeabc('0x9')](function(_0x522c6e){if(_[_0xeabc('0x15')](_0x522c6e)){throw new Error(_0x399735+_0xeabc('0x68'));}_0x3c6a49=_0x522c6e;return db[_0x399735+_0xeabc('0x69')]['findOne']({'where':{'id':_0x439a48['body'][_0xeabc('0x6a')]},'include':[{'model':db[_0x399735+_0xeabc('0x6b')],'as':_0xeabc('0x6b')},{'model':db[_0x399735+_0x33e5fb],'as':_0xeabc('0x65')}]});})[_0xeabc('0x9')](function(_0x5f5a47){if(_[_0xeabc('0x15')](_0x5f5a47)){throw new Error(_0x399735+'\x20Message\x20not\x20found');}_0x4dfc4b=_0x5f5a47;return _0x5f5a47['update']({'read':0x0,'readAt':null,'UserId':null});})[_0xeabc('0x9')](function(){var _0x302e94={'uniqueid':_0xa5c4ca+'.'+_0x4dfc4b['id']+'.'+_0x4dfc4b['Interaction']['id'],'FromUserId':_0x439a48[_0xeabc('0x33')]['id'],'type':_0xeabc('0x6c')};_0x302e94[_0x399735+_0xeabc('0x6d')]=_0x4dfc4b['id'];_0x302e94[_0x399735+_0xeabc('0x6e')]=_0x4dfc4b[_0xeabc('0x6b')]['id'];_0x302e94[_0xeabc('0x6f')+_0x399735+_0x33e5fb+'Id']=_0x4dfc4b[_0xeabc('0x65')]['id'];_0x302e94['To'+_0x399735+_0xeabc('0x70')]=_0x3c6a49['id'];return db[_0x399735+_0xeabc('0x71')][_0xeabc('0x72')](_0x302e94);})[_0xeabc('0x9')](function(){return respondWithRpcPromise('Start',{'channel':_0xa5c4ca,'interaction':_0x4dfc4b[_0xeabc('0x6b')],'message':_0x4dfc4b,'account':_0x4dfc4b['Account'],'applications':[{'id':0x0,'priority':0x1,'app':_0xeabc('0x6c'),'appdata':_0x3c6a49[_0xeabc('0x12')]+','+(_0x4dfc4b[_0xeabc('0x65')][_0xeabc('0x73')]||0x12c),'interval':_0xeabc('0x74')}]},routingClient);})[_0xeabc('0x9')](respondWithResult(_0x3acb88,null))[_0xeabc('0xe')](handleError(_0x3acb88,null));};};exports[_0xeabc('0x75')]=function(_0xb85c3d,_0x156e20){var _0x42e92b,_0x5d471f;if(_[_0xeabc('0x15')](_0xb85c3d[_0xeabc('0x23')][_0xeabc('0x76')])){throw new Error(_0xeabc('0x77'));}var _0x5b00d6=_0xb85c3d[_0xeabc('0x23')][_0xeabc('0x76')];var _0x580661=_[_0xeabc('0x62')](_0x5b00d6);var _0x22ef88=_0x5b00d6==='chat'?'Website':'Account';return db['User'][_0xeabc('0x67')]({'raw':!![],'where':{'id':_0xb85c3d[_0xeabc('0x1d')]['id'],'role':_0xeabc('0x3b')}})[_0xeabc('0x9')](function(_0x1d8dca){if(_[_0xeabc('0x15')](_0x1d8dca)){throw new Error(_0xeabc('0x78'));}_0x42e92b=_0x1d8dca;return db[_0x580661+_0xeabc('0x69')][_0xeabc('0x67')]({'where':{'id':_0xb85c3d[_0xeabc('0x23')]['messageId']},'include':[{'model':db[_0x580661+_0xeabc('0x6b')],'as':_0xeabc('0x6b')},{'model':db[_0x580661+_0x22ef88],'as':'Account'}]});})[_0xeabc('0x9')](function(_0x32063c){if(_[_0xeabc('0x15')](_0x32063c)){throw new Error(_0x580661+'\x20Message\x20not\x20found');}_0x5d471f=_0x32063c;return _0x32063c[_0xeabc('0x79')]({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x425e5c={'uniqueid':_0x5b00d6+'.'+_0x5d471f['id']+'.'+_0x5d471f[_0xeabc('0x6b')]['id'],'FromUserId':_0xb85c3d[_0xeabc('0x33')]['id'],'type':_0xeabc('0x6c'),'ToUserId':_0x42e92b['id']};_0x425e5c[_0x580661+_0xeabc('0x6d')]=_0x5d471f['id'];_0x425e5c[_0x580661+'InteractionId']=_0x5d471f['Interaction']['id'];_0x425e5c['From'+_0x580661+_0x22ef88+'Id']=_0x5d471f['Account']['id'];return db[_0x580661+_0xeabc('0x71')][_0xeabc('0x72')](_0x425e5c);})[_0xeabc('0x9')](function(){return respondWithRpcPromise('Start',{'channel':_0x5b00d6,'interaction':_0x5d471f[_0xeabc('0x6b')],'message':_0x5d471f,'account':_0x5d471f[_0xeabc('0x65')],'applications':[{'id':0x0,'priority':0x1,'app':_0xeabc('0x3b'),'appdata':_0x42e92b[_0xeabc('0x12')]+','+(_0x5d471f[_0xeabc('0x65')][_0xeabc('0x7a')]||0x12c),'interval':_0xeabc('0x74')}]},routingClient);})[_0xeabc('0x9')](respondWithResult(_0x156e20,null))[_0xeabc('0xe')](handleError(_0x156e20,null));}; \ No newline at end of file +var _0xd6d6=['capacity','Telephones','Trunks','campaigns','Campaigns','chatQueues','ChatQueues','showChatQueues','mailQueues','MailQueues','showMailQueues','mailAccounts','MailAccounts','OpenchannelQueues','SmsQueues','showSmsQueues','whatsappQueues','WhatsappQueues','showWhatsappQueues','FaxQueues','showFaxQueues','FaxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','type','filter','map','queue_id','indexOf','SmsQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','chat','Website','Account','Queue','findOne','\x20Queue\x20not\x20found','Message','messageId','Interaction','\x20Message\x20not\x20found','queue','MessageId','InteractionId','From','QueueId','create','Start','*,*,*,*','agentNotify','channel','capitalize','User','Agent\x20not\x20found','TransferReport','agentTransferTimeout','bluebird','moment','lodash','util','../../config/logger','api','jayson/promise','client','http','error','code','message','status','json','sendStatus','stack','name','send','isNil','find','rows','voiceChannels','VoiceChannels','then','catch','voiceChannelMixMonitor','VoiceChannelMixMonitor','merge','query','params','voiceChannelStopMixMonitor','VoiceChannelStopMixMonitor','voiceQueues','VoiceQueues','showVoiceQueues','UpdateVoiceQueue','body','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','voiceQueuesChannel','VoiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','Outbound','OutboundChannels','agents','Agents','agentCapacity','interaction','user','hasOwnProperty','MemberReport','findAll','length','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','findOrCreate','INTERACTION','interface','agent','internal'];(function(_0x4f14bd,_0x28b9db){var _0x515b8b=function(_0x523703){while(--_0x523703){_0x4f14bd['push'](_0x4f14bd['shift']());}};_0x515b8b(++_0x28b9db);}(_0xd6d6,0xbe));var _0x6d6d=function(_0x479d7d,_0x36af63){_0x479d7d=_0x479d7d-0x0;var _0x6048c8=_0xd6d6[_0x479d7d];return _0x6048c8;};'use strict';var BPromise=require(_0x6d6d('0x0'));var moment=require(_0x6d6d('0x1'));var _=require(_0x6d6d('0x2'));var util=require(_0x6d6d('0x3'));var db=require('../../mysqldb')['db'];var logger=require(_0x6d6d('0x4'))(_0x6d6d('0x5'));var jayson=require(_0x6d6d('0x6'));var amiClient=jayson[_0x6d6d('0x7')][_0x6d6d('0x8')]({'port':0x232a});var mailClient=jayson[_0x6d6d('0x7')][_0x6d6d('0x8')]({'port':0x232b});var routingClient=jayson['client'][_0x6d6d('0x8')]({'port':0x232c});function respondWithRpcPromise(_0x1bf731,_0x44f83d,_0x18f824){return new BPromise(function(_0xd49f57,_0x408f88){var _0x3e69a4=_0x18f824?_0x18f824:amiClient;return _0x3e69a4['request'](_0x1bf731,_0x44f83d)['then'](function(_0x404c88){if(_0x404c88[_0x6d6d('0x9')]){if(_0x404c88[_0x6d6d('0x9')][_0x6d6d('0xa')]===0x1f4){return _0x408f88(_0x404c88[_0x6d6d('0x9')]['message']);}return _0xd49f57(_0x404c88[_0x6d6d('0x9')][_0x6d6d('0xb')]);}else{_0xd49f57(_0x404c88['result']);}})['catch'](function(_0x176618){_0x408f88(_0x176618);});});}function respondWithResult(_0x32146d,_0xe61c36){_0xe61c36=_0xe61c36||0xc8;return function(_0x3f8542){if(_0x3f8542){return _0x32146d[_0x6d6d('0xc')](_0xe61c36)[_0x6d6d('0xd')](_0x3f8542);}return _0x32146d[_0x6d6d('0xe')](0x194);};}function handleError(_0x2cb2dd,_0x5f4154){_0x5f4154=_0x5f4154||0x1f4;return function(_0xd09ea7){logger[_0x6d6d('0x9')](_0xd09ea7[_0x6d6d('0xf')]);if(_0xd09ea7[_0x6d6d('0x10')]){delete _0xd09ea7[_0x6d6d('0x10')];}_0x2cb2dd['status'](_0x5f4154)[_0x6d6d('0x11')](_0xd09ea7);};}function findById(_0x587338){return function(_0x27830d){if(!_[_0x6d6d('0x12')](_0x587338)&&!_[_0x6d6d('0x12')](_0x27830d)&&!_['isNil'](_0x27830d['rows'])){return _[_0x6d6d('0x13')](_0x27830d[_0x6d6d('0x14')],function(_0x2b59d4){return _0x2b59d4['id']==_0x587338;});}return null;};}exports[_0x6d6d('0x15')]=function(_0x51fff6,_0x554392){return respondWithRpcPromise(_0x6d6d('0x16'),_0x51fff6['query'])[_0x6d6d('0x17')](respondWithResult(_0x554392,null))[_0x6d6d('0x18')](handleError(_0x554392,null));};exports[_0x6d6d('0x19')]=function(_0x450352,_0x40d35b){return respondWithRpcPromise(_0x6d6d('0x1a'),_[_0x6d6d('0x1b')](_0x450352[_0x6d6d('0x1c')],_0x450352[_0x6d6d('0x1d')]))[_0x6d6d('0x17')](respondWithResult(_0x40d35b,null))[_0x6d6d('0x18')](handleError(_0x40d35b,null));};exports[_0x6d6d('0x1e')]=function(_0x466a29,_0x21b95d){return respondWithRpcPromise(_0x6d6d('0x1f'),_[_0x6d6d('0x1b')](_0x466a29[_0x6d6d('0x1c')],_0x466a29['params']))[_0x6d6d('0x17')](respondWithResult(_0x21b95d,null))[_0x6d6d('0x18')](handleError(_0x21b95d,null));};exports[_0x6d6d('0x20')]=function(_0x97ec9e,_0xf0df7f){return respondWithRpcPromise(_0x6d6d('0x21'),_0x97ec9e['query'])[_0x6d6d('0x17')](respondWithResult(_0xf0df7f,null))[_0x6d6d('0x18')](handleError(_0xf0df7f,null));};exports[_0x6d6d('0x22')]=function(_0x126ac8,_0x25c121){return respondWithRpcPromise(_0x6d6d('0x21'),_0x126ac8[_0x6d6d('0x1c')])['then'](findById(_0x126ac8[_0x6d6d('0x1d')]['id']))[_0x6d6d('0x17')](respondWithResult(_0x25c121,null))['catch'](handleError(_0x25c121,null));};exports['updateVoiceQueue']=function(_0x3edcce,_0x5273cd){return respondWithRpcPromise(_0x6d6d('0x23'),_['merge'](_0x3edcce[_0x6d6d('0x24')],_0x3edcce[_0x6d6d('0x1d')]))[_0x6d6d('0x17')](respondWithResult(_0x5273cd,null))[_0x6d6d('0x18')](handleError(_0x5273cd,null));};exports[_0x6d6d('0x25')]=function(_0x428c17,_0xdda3f2){return respondWithRpcPromise(_0x6d6d('0x26'),_[_0x6d6d('0x1b')](_0x428c17[_0x6d6d('0x1c')],_0x428c17['params']))[_0x6d6d('0x17')](respondWithResult(_0xdda3f2,null))['catch'](handleError(_0xdda3f2,null));};exports[_0x6d6d('0x27')]=function(_0x1ea9b2,_0xf527da){return respondWithRpcPromise(_0x6d6d('0x28'),_0x1ea9b2['query'])[_0x6d6d('0x17')](respondWithResult(_0xf527da,null))['catch'](handleError(_0xf527da,null));};exports[_0x6d6d('0x29')]=function(_0x219fd4,_0x5be8da){return respondWithRpcPromise(_0x6d6d('0x2a'),_[_0x6d6d('0x1b')](_0x219fd4[_0x6d6d('0x1c')],_0x219fd4[_0x6d6d('0x1d')]))[_0x6d6d('0x17')](respondWithResult(_0x5be8da,null))[_0x6d6d('0x18')](handleError(_0x5be8da,null));};exports[_0x6d6d('0x2b')]=function(_0x2d524d,_0x243555){return respondWithRpcPromise(_0x6d6d('0x2c'),_[_0x6d6d('0x1b')](_0x2d524d[_0x6d6d('0x1c')],_0x2d524d[_0x6d6d('0x1d')]))[_0x6d6d('0x17')](respondWithResult(_0x243555,null))['catch'](handleError(_0x243555,null));};exports[_0x6d6d('0x2d')]=function(_0xf98bfa,_0x3e2415){return respondWithRpcPromise(_0x6d6d('0x2e'),_['merge'](_0xf98bfa['query'],_0xf98bfa[_0x6d6d('0x1d')]))[_0x6d6d('0x17')](respondWithResult(_0x3e2415,null))[_0x6d6d('0x18')](handleError(_0x3e2415,null));};exports['outbound']=function(_0x2a3f67,_0x2607c1){return respondWithRpcPromise(_0x6d6d('0x2f'),_0x2a3f67[_0x6d6d('0x1c')])['then'](respondWithResult(_0x2607c1,null))['catch'](handleError(_0x2607c1,null));};exports['outboundChannels']=function(_0x62620d,_0x4196f0){return respondWithRpcPromise(_0x6d6d('0x30'),_0x62620d[_0x6d6d('0x1c')])['then'](respondWithResult(_0x4196f0,null))[_0x6d6d('0x18')](handleError(_0x4196f0,null));};exports[_0x6d6d('0x31')]=function(_0x344f6f,_0x3c6d23){var _0x3d632c;return respondWithRpcPromise(_0x6d6d('0x32'),_0x344f6f['query'])[_0x6d6d('0x17')](function(_0x3c7292){_0x3d632c=_0x3c7292;return respondWithRpcPromise(_0x6d6d('0x32'),_0x344f6f[_0x6d6d('0x1c')],routingClient);})[_0x6d6d('0x17')](function(_0x3e27b7){return _[_0x6d6d('0x1b')]({},_0x3e27b7,_0x3d632c);})['then'](respondWithResult(_0x3c6d23,null))[_0x6d6d('0x18')](handleError(_0x3c6d23,null));};exports[_0x6d6d('0x33')]=function(_0x16e177,_0x2107e0){if(_0x16e177[_0x6d6d('0x24')]&&_0x16e177['body'][_0x6d6d('0x34')]&&_0x16e177[_0x6d6d('0x35')]&&_0x16e177['user'][_0x6d6d('0x10')]){for(var _0x50dc17 in _0x16e177[_0x6d6d('0x24')][_0x6d6d('0x34')]){if(_0x16e177['body'][_0x6d6d('0x34')][_0x6d6d('0x36')](_0x50dc17)){db[_0x6d6d('0x37')][_0x6d6d('0x38')]({'where':{'channel':_0x50dc17,'membername':_0x16e177[_0x6d6d('0x35')]['name'],'type':'INTERACTION','exitAt':null,'uniqueid':_0x16e177[_0x6d6d('0x24')]['interaction'][_0x50dc17]&&_0x16e177['body'][_0x6d6d('0x34')][_0x50dc17][_0x6d6d('0x39')]?{'$notIn':_0x16e177[_0x6d6d('0x24')]['interaction'][_0x50dc17]}:{'$ne':null}}})[_0x6d6d('0x17')](function(_0x4cff80){var _0x1a2d4c=moment()[_0x6d6d('0x3a')](_0x6d6d('0x3b'));for(var _0x4606eb=0x0,_0x75f298=_0x4cff80[_0x6d6d('0x39')];_0x4606eb<_0x75f298;_0x4606eb+=0x1){_0x4cff80[_0x4606eb][_0x6d6d('0x3c')]({'exitAt':_0x1a2d4c});}});for(var _0x5c0495=0x0;_0x5c0495<_0x16e177[_0x6d6d('0x24')][_0x6d6d('0x34')][_0x50dc17][_0x6d6d('0x39')];_0x5c0495+=0x1){db[_0x6d6d('0x37')][_0x6d6d('0x3d')]({'where':{'channel':_0x50dc17,'membername':_0x16e177[_0x6d6d('0x35')][_0x6d6d('0x10')],'type':_0x6d6d('0x3e'),'uniqueid':_0x16e177[_0x6d6d('0x24')]['interaction'][_0x50dc17][_0x5c0495],'exitAt':null},'defaults':{'channel':_0x50dc17,'membername':_0x16e177['user'][_0x6d6d('0x10')],'interface':_[_0x6d6d('0x12')](_0x16e177[_0x6d6d('0x35')][_0x6d6d('0x3f')])?util[_0x6d6d('0x3a')]('SIP/%s',_0x16e177[_0x6d6d('0x35')][_0x6d6d('0x10')]):_0x16e177[_0x6d6d('0x35')][_0x6d6d('0x3f')],'type':_0x6d6d('0x3e'),'enterAt':moment()[_0x6d6d('0x3a')](_0x6d6d('0x3b')),'role':_0x6d6d('0x40'),'internal':_0x16e177[_0x6d6d('0x35')][_0x6d6d('0x41')],'uniqueid':_0x16e177[_0x6d6d('0x24')][_0x6d6d('0x34')][_0x50dc17][_0x5c0495]}});}}}}return respondWithRpcPromise('AgentCapacity',{'id':_0x16e177[_0x6d6d('0x1d')]['id'],'capacity':_0x16e177[_0x6d6d('0x24')][_0x6d6d('0x42')]},routingClient)[_0x6d6d('0x17')](respondWithResult(_0x2107e0,null))[_0x6d6d('0x18')](handleError(_0x2107e0,null));};exports['telephones']=function(_0x38c307,_0x36bc5a){return respondWithRpcPromise(_0x6d6d('0x43'),_0x38c307['query'])['then'](respondWithResult(_0x36bc5a,null))[_0x6d6d('0x18')](handleError(_0x36bc5a,null));};exports['trunks']=function(_0x3ea57e,_0x995fe2){return respondWithRpcPromise(_0x6d6d('0x44'),_0x3ea57e[_0x6d6d('0x1c')])[_0x6d6d('0x17')](respondWithResult(_0x995fe2,null))[_0x6d6d('0x18')](handleError(_0x995fe2,null));};exports[_0x6d6d('0x45')]=function(_0x26c23a,_0x1a8f33){return respondWithRpcPromise(_0x6d6d('0x46'),_0x26c23a['query'])[_0x6d6d('0x17')](respondWithResult(_0x1a8f33,null))[_0x6d6d('0x18')](handleError(_0x1a8f33,null));};exports[_0x6d6d('0x47')]=function(_0x8000b6,_0x1f98d4){return respondWithRpcPromise(_0x6d6d('0x48'),_0x8000b6[_0x6d6d('0x1c')],routingClient)['then'](respondWithResult(_0x1f98d4,null))['catch'](handleError(_0x1f98d4,null));};exports[_0x6d6d('0x49')]=function(_0x122865,_0x5cc644){return respondWithRpcPromise(_0x6d6d('0x48'),_0x122865[_0x6d6d('0x1c')],routingClient)[_0x6d6d('0x17')](findById(_0x122865[_0x6d6d('0x1d')]['id']))[_0x6d6d('0x17')](respondWithResult(_0x5cc644,null))[_0x6d6d('0x18')](handleError(_0x5cc644,null));};exports[_0x6d6d('0x4a')]=function(_0x1ef7fb,_0x2abd8c){return respondWithRpcPromise(_0x6d6d('0x4b'),_0x1ef7fb[_0x6d6d('0x1c')],routingClient)[_0x6d6d('0x17')](respondWithResult(_0x2abd8c,null))[_0x6d6d('0x18')](handleError(_0x2abd8c,null));};exports[_0x6d6d('0x4c')]=function(_0x3065ea,_0x50d8dd){return respondWithRpcPromise(_0x6d6d('0x4b'),_0x3065ea[_0x6d6d('0x1c')],routingClient)['then'](findById(_0x3065ea[_0x6d6d('0x1d')]['id']))[_0x6d6d('0x17')](respondWithResult(_0x50d8dd,null))[_0x6d6d('0x18')](handleError(_0x50d8dd,null));};exports[_0x6d6d('0x4d')]=function(_0x2d61cc,_0xd0a573){return respondWithRpcPromise(_0x6d6d('0x4e'),_0x2d61cc[_0x6d6d('0x1c')],mailClient)[_0x6d6d('0x17')](respondWithResult(_0xd0a573,null))['catch'](handleError(_0xd0a573,null));};exports['openchannelQueues']=function(_0x22c3a1,_0x325fe2){return respondWithRpcPromise(_0x6d6d('0x4f'),_0x22c3a1['query'],routingClient)['then'](respondWithResult(_0x325fe2,null))[_0x6d6d('0x18')](handleError(_0x325fe2,null));};exports['showOpenchannelQueues']=function(_0x30badc,_0x5b6f58){return respondWithRpcPromise(_0x6d6d('0x4f'),_0x30badc[_0x6d6d('0x1c')],routingClient)[_0x6d6d('0x17')](findById(_0x30badc[_0x6d6d('0x1d')]['id']))[_0x6d6d('0x17')](respondWithResult(_0x5b6f58,null))[_0x6d6d('0x18')](handleError(_0x5b6f58,null));};exports['smsQueues']=function(_0x41e576,_0x5eb78f){return respondWithRpcPromise(_0x6d6d('0x50'),_0x41e576['query'],routingClient)[_0x6d6d('0x17')](respondWithResult(_0x5eb78f,null))[_0x6d6d('0x18')](handleError(_0x5eb78f,null));};exports[_0x6d6d('0x51')]=function(_0xa71db1,_0x29b68b){return respondWithRpcPromise(_0x6d6d('0x50'),_0xa71db1[_0x6d6d('0x1c')],routingClient)['then'](findById(_0xa71db1['params']['id']))[_0x6d6d('0x17')](respondWithResult(_0x29b68b,null))['catch'](handleError(_0x29b68b,null));};exports[_0x6d6d('0x52')]=function(_0x53b77a,_0xe19d23){return respondWithRpcPromise(_0x6d6d('0x53'),_0x53b77a[_0x6d6d('0x1c')],routingClient)[_0x6d6d('0x17')](respondWithResult(_0xe19d23,null))[_0x6d6d('0x18')](handleError(_0xe19d23,null));};exports[_0x6d6d('0x54')]=function(_0x5dd3b0,_0x3cedc0){return respondWithRpcPromise(_0x6d6d('0x53'),_0x5dd3b0[_0x6d6d('0x1c')],routingClient)[_0x6d6d('0x17')](findById(_0x5dd3b0[_0x6d6d('0x1d')]['id']))[_0x6d6d('0x17')](respondWithResult(_0x3cedc0,null))[_0x6d6d('0x18')](handleError(_0x3cedc0,null));};exports['faxQueues']=function(_0x3fa820,_0x4ec43e){return respondWithRpcPromise(_0x6d6d('0x55'),_0x3fa820[_0x6d6d('0x1c')],routingClient)[_0x6d6d('0x17')](respondWithResult(_0x4ec43e,null))[_0x6d6d('0x18')](handleError(_0x4ec43e,null));};exports[_0x6d6d('0x56')]=function(_0x1d1d1d,_0x56feda){return respondWithRpcPromise(_0x6d6d('0x55'),_0x1d1d1d[_0x6d6d('0x1c')],routingClient)['then'](findById(_0x1d1d1d['params']['id']))[_0x6d6d('0x17')](respondWithResult(_0x56feda,null))['catch'](handleError(_0x56feda,null));};exports['faxAccounts']=function(_0x5b6ca7,_0x1e3b17){return respondWithRpcPromise(_0x6d6d('0x57'),_0x5b6ca7[_0x6d6d('0x1c')])[_0x6d6d('0x17')](respondWithResult(_0x1e3b17,null))[_0x6d6d('0x18')](handleError(_0x1e3b17,null));};exports[_0x6d6d('0x58')]=function(_0x4d4083,_0x48472d){return respondWithRpcPromise(_0x6d6d('0x59'),_0x4d4083['query'],routingClient)['then'](respondWithResult(_0x48472d,null))['catch'](handleError(_0x48472d,null));};exports[_0x6d6d('0x5a')]=function(_0x5cd494,_0x45a374){return respondWithRpcPromise('MailQueuesWaitingInteractions',_0x5cd494[_0x6d6d('0x1c')],routingClient)[_0x6d6d('0x17')](respondWithResult(_0x45a374,null))['catch'](handleError(_0x45a374,null));};exports['openchannelQueuesWaitingInteractions']=function(_0x167d0c,_0x202bf6){return respondWithRpcPromise(_0x6d6d('0x5b'),_0x167d0c[_0x6d6d('0x1c')],routingClient)['then'](respondWithResult(_0x202bf6,null))[_0x6d6d('0x18')](handleError(_0x202bf6,null));};exports[_0x6d6d('0x5c')]=function(_0x1fb21d,_0x2b53eb){return respondWithRpcPromise('OpenchannelQueuesWaitingInteractions',_0x1fb21d[_0x6d6d('0x1c')],routingClient)['then'](function(_0x4b6594){if(_0x1fb21d['query'][_0x6d6d('0x5d')]!==undefined){var _0x5bcfbd=_(_0x4b6594[_0x6d6d('0x14')])[_0x6d6d('0x5e')]([_0x1fb21d[_0x6d6d('0x1c')]['type'],_0x1fb21d['params']['id']])[_0x6d6d('0x5f')](_0x6d6d('0x60'))['uniq']()['value']();return _0x4b6594[_0x6d6d('0x14')][_0x6d6d('0x5e')](function(_0x14feba){return _0x5bcfbd[_0x6d6d('0x61')](_0x14feba[_0x6d6d('0x60')])>-0x1;});}else{return _0x4b6594[_0x6d6d('0x14')][_0x6d6d('0x5e')](function(_0x52f758){return _0x52f758['queue_id']===parseInt(_0x1fb21d['params']['id']);});}})['then'](respondWithResult(_0x2b53eb,null))['catch'](handleError(_0x2b53eb,null));};exports['smsQueuesWaitingInteractions']=function(_0x87dd34,_0x21e5a8){return respondWithRpcPromise(_0x6d6d('0x62'),_0x87dd34[_0x6d6d('0x1c')],routingClient)['then'](respondWithResult(_0x21e5a8,null))['catch'](handleError(_0x21e5a8,null));};exports['whatsappQueuesWaitingInteractions']=function(_0x39b34e,_0xfbad7a){return respondWithRpcPromise(_0x6d6d('0x63'),_0x39b34e[_0x6d6d('0x1c')],routingClient)['then'](respondWithResult(_0xfbad7a,null))['catch'](handleError(_0xfbad7a,null));};exports[_0x6d6d('0x64')]=function(_0x1e1c4e,_0x478ed4){return respondWithRpcPromise(_0x6d6d('0x65'),_0x1e1c4e[_0x6d6d('0x1c')],routingClient)[_0x6d6d('0x17')](respondWithResult(_0x478ed4,null))[_0x6d6d('0x18')](handleError(_0x478ed4,null));};exports[_0x6d6d('0x66')]=function(_0x581027){return function(_0xf5586f,_0x50eea6){var _0x39f986,_0x5885c5;var _0x108108=_['capitalize'](_0x581027);var _0x445196=_0x581027===_0x6d6d('0x67')?_0x6d6d('0x68'):_0x6d6d('0x69');return db[_0x108108+_0x6d6d('0x6a')][_0x6d6d('0x6b')]({'raw':!![],'where':{'id':_0xf5586f[_0x6d6d('0x1d')]['id']}})[_0x6d6d('0x17')](function(_0x139a7){if(_[_0x6d6d('0x12')](_0x139a7)){throw new Error(_0x108108+_0x6d6d('0x6c'));}_0x39f986=_0x139a7;return db[_0x108108+_0x6d6d('0x6d')][_0x6d6d('0x6b')]({'where':{'id':_0xf5586f[_0x6d6d('0x24')][_0x6d6d('0x6e')]},'include':[{'model':db[_0x108108+_0x6d6d('0x6f')],'as':'Interaction'},{'model':db[_0x108108+_0x445196],'as':'Account'}]});})[_0x6d6d('0x17')](function(_0x5a7b23){if(_[_0x6d6d('0x12')](_0x5a7b23)){throw new Error(_0x108108+_0x6d6d('0x70'));}_0x5885c5=_0x5a7b23;return _0x5a7b23['update']({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x1d2668={'uniqueid':_0x581027+'.'+_0x5885c5['id']+'.'+_0x5885c5['Interaction']['id'],'FromUserId':_0xf5586f[_0x6d6d('0x35')]['id'],'type':_0x6d6d('0x71')};_0x1d2668[_0x108108+_0x6d6d('0x72')]=_0x5885c5['id'];_0x1d2668[_0x108108+_0x6d6d('0x73')]=_0x5885c5[_0x6d6d('0x6f')]['id'];_0x1d2668[_0x6d6d('0x74')+_0x108108+_0x445196+'Id']=_0x5885c5[_0x6d6d('0x69')]['id'];_0x1d2668['To'+_0x108108+_0x6d6d('0x75')]=_0x39f986['id'];return db[_0x108108+'TransferReport'][_0x6d6d('0x76')](_0x1d2668);})[_0x6d6d('0x17')](function(){return respondWithRpcPromise(_0x6d6d('0x77'),{'channel':_0x581027,'interaction':_0x5885c5['Interaction'],'message':_0x5885c5,'account':_0x5885c5['Account'],'applications':[{'id':0x0,'priority':0x1,'app':_0x6d6d('0x71'),'appdata':_0x39f986[_0x6d6d('0x10')]+','+(_0x5885c5[_0x6d6d('0x69')]['queueTransferTimeout']||0x12c),'interval':_0x6d6d('0x78')}]},routingClient);})[_0x6d6d('0x17')](respondWithResult(_0x50eea6,null))['catch'](handleError(_0x50eea6,null));};};exports[_0x6d6d('0x79')]=function(_0x721d98,_0xa8ec98){var _0x155edb,_0x21057d;if(_['isNil'](_0x721d98[_0x6d6d('0x24')][_0x6d6d('0x7a')])){throw new Error('Channel\x20field\x20is\x20mandatory');}var _0x56825d=_0x721d98[_0x6d6d('0x24')][_0x6d6d('0x7a')];var _0xe80727=_[_0x6d6d('0x7b')](_0x56825d);var _0x5a8974=_0x56825d===_0x6d6d('0x67')?'Website':_0x6d6d('0x69');return db[_0x6d6d('0x7c')][_0x6d6d('0x6b')]({'raw':!![],'where':{'id':_0x721d98[_0x6d6d('0x1d')]['id'],'role':_0x6d6d('0x40')}})[_0x6d6d('0x17')](function(_0x39c1a5){if(_[_0x6d6d('0x12')](_0x39c1a5)){throw new Error(_0x6d6d('0x7d'));}_0x155edb=_0x39c1a5;return db[_0xe80727+_0x6d6d('0x6d')][_0x6d6d('0x6b')]({'where':{'id':_0x721d98[_0x6d6d('0x24')][_0x6d6d('0x6e')]},'include':[{'model':db[_0xe80727+_0x6d6d('0x6f')],'as':_0x6d6d('0x6f')},{'model':db[_0xe80727+_0x5a8974],'as':_0x6d6d('0x69')}]});})[_0x6d6d('0x17')](function(_0xccbc07){if(_[_0x6d6d('0x12')](_0xccbc07)){throw new Error(_0xe80727+_0x6d6d('0x70'));}_0x21057d=_0xccbc07;return _0xccbc07['update']({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x3445f5={'uniqueid':_0x56825d+'.'+_0x21057d['id']+'.'+_0x21057d[_0x6d6d('0x6f')]['id'],'FromUserId':_0x721d98[_0x6d6d('0x35')]['id'],'type':_0x6d6d('0x71'),'ToUserId':_0x155edb['id']};_0x3445f5[_0xe80727+_0x6d6d('0x72')]=_0x21057d['id'];_0x3445f5[_0xe80727+_0x6d6d('0x73')]=_0x21057d[_0x6d6d('0x6f')]['id'];_0x3445f5[_0x6d6d('0x74')+_0xe80727+_0x5a8974+'Id']=_0x21057d[_0x6d6d('0x69')]['id'];return db[_0xe80727+_0x6d6d('0x7e')][_0x6d6d('0x76')](_0x3445f5);})[_0x6d6d('0x17')](function(){return respondWithRpcPromise(_0x6d6d('0x77'),{'channel':_0x56825d,'interaction':_0x21057d[_0x6d6d('0x6f')],'message':_0x21057d,'account':_0x21057d[_0x6d6d('0x69')],'applications':[{'id':0x0,'priority':0x1,'app':'agent','appdata':_0x155edb[_0x6d6d('0x10')]+','+(_0x21057d[_0x6d6d('0x69')][_0x6d6d('0x7f')]||0x12c),'interval':'*,*,*,*'}]},routingClient);})['then'](respondWithResult(_0xa8ec98,null))['catch'](handleError(_0xa8ec98,null));}; \ No newline at end of file diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index 40c5e44..6f96484 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 _0xa0d5=['/:id','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./schedule.controller','get','isAuthenticated','show','/:id/run','run','post','create','put','delete'];(function(_0x52e363,_0x48062a){var _0x3fc2b5=function(_0x1b0cf9){while(--_0x1b0cf9){_0x52e363['push'](_0x52e363['shift']());}};_0x3fc2b5(++_0x48062a);}(_0xa0d5,0xea));var _0x5a0d=function(_0x5a433c,_0x423be6){_0x5a433c=_0x5a433c-0x0;var _0x310003=_0xa0d5[_0x5a433c];return _0x310003;};'use strict';var multer=require(_0x5a0d('0x0'));var util=require(_0x5a0d('0x1'));var path=require(_0x5a0d('0x2'));var timeout=require(_0x5a0d('0x3'));var express=require('express');var router=express[_0x5a0d('0x4')]();var fs_extra=require(_0x5a0d('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x5a0d('0x6'));var config=require(_0x5a0d('0x7'));var controller=require(_0x5a0d('0x8'));router[_0x5a0d('0x9')]('/',auth[_0x5a0d('0xa')](),controller['index']);router['get']('/:id',auth['isAuthenticated'](),controller[_0x5a0d('0xb')]);router['get'](_0x5a0d('0xc'),auth[_0x5a0d('0xa')](),controller[_0x5a0d('0xd')]);router[_0x5a0d('0xe')]('/',auth[_0x5a0d('0xa')](),controller[_0x5a0d('0xf')]);router[_0x5a0d('0x10')]('/:id',auth[_0x5a0d('0xa')](),controller['update']);router[_0x5a0d('0x11')](_0x5a0d('0x12'),auth[_0x5a0d('0xa')](),controller[_0x5a0d('0x13')]);module[_0x5a0d('0x14')]=router; \ No newline at end of file +var _0x49b3=['get','/:id','show','/:id/run','post','create','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./schedule.controller','isAuthenticated','index'];(function(_0x5cec25,_0x183dfe){var _0x2e221a=function(_0x4a721a){while(--_0x4a721a){_0x5cec25['push'](_0x5cec25['shift']());}};_0x2e221a(++_0x183dfe);}(_0x49b3,0x11b));var _0x349b=function(_0x4bfac3,_0x58324d){_0x4bfac3=_0x4bfac3-0x0;var _0x15f0f2=_0x49b3[_0x4bfac3];return _0x15f0f2;};'use strict';var multer=require(_0x349b('0x0'));var util=require(_0x349b('0x1'));var path=require(_0x349b('0x2'));var timeout=require(_0x349b('0x3'));var express=require(_0x349b('0x4'));var router=express[_0x349b('0x5')]();var fs_extra=require(_0x349b('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x349b('0x7'));var config=require('../../config/environment');var controller=require(_0x349b('0x8'));router['get']('/',auth[_0x349b('0x9')](),controller[_0x349b('0xa')]);router[_0x349b('0xb')](_0x349b('0xc'),auth[_0x349b('0x9')](),controller[_0x349b('0xd')]);router[_0x349b('0xb')](_0x349b('0xe'),auth[_0x349b('0x9')](),controller['run']);router[_0x349b('0xf')]('/',auth[_0x349b('0x9')](),controller[_0x349b('0x10')]);router[_0x349b('0x11')](_0x349b('0xc'),auth[_0x349b('0x9')](),controller[_0x349b('0x12')]);router[_0x349b('0x13')](_0x349b('0xc'),auth[_0x349b('0x9')](),controller['destroy']);module[_0x349b('0x14')]=router; \ No newline at end of file diff --git a/server/api/schedule/schedule.attributes.js b/server/api/schedule/schedule.attributes.js index ef106c8..466619c 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 _0xfbe2=['years','quarters','months','days','csv','pdf','xlsx','custom','default','BOOLEAN','TEXT','sequelize','exports','STRING','0\x200\x20*\x20*\x20*','DATE','INTEGER','ENUM'];(function(_0x2adaa9,_0x298fc0){var _0x2a3124=function(_0x31e45c){while(--_0x31e45c){_0x2adaa9['push'](_0x2adaa9['shift']());}};_0x2a3124(++_0x298fc0);}(_0xfbe2,0x12b));var _0x2fbe=function(_0x5a0b3b,_0x145ad4){_0x5a0b3b=_0x5a0b3b-0x0;var _0x398c01=_0xfbe2[_0x5a0b3b];return _0x398c01;};'use strict';var Sequelize=require(_0x2fbe('0x0'));module[_0x2fbe('0x1')]={'name':{'type':Sequelize[_0x2fbe('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x2fbe('0x2')]},'active':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0x2fbe('0x2')],'allowNull':![],'defaultValue':_0x2fbe('0x3')},'startAt':{'type':Sequelize['DATE'],'allowNull':![]},'endAt':{'type':Sequelize[_0x2fbe('0x4')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0x2fbe('0x5')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0x2fbe('0x6')](_0x2fbe('0x7'),_0x2fbe('0x8'),_0x2fbe('0x9'),'weeks',_0x2fbe('0xa'),'hours','minutes'),'allowNull':![],'defaultValue':_0x2fbe('0xa')},'output':{'type':Sequelize[_0x2fbe('0x6')](_0x2fbe('0xb'),_0x2fbe('0xc'),_0x2fbe('0xd')),'allowNull':![],'defaultValue':'csv'},'type':{'type':Sequelize[_0x2fbe('0x6')](_0x2fbe('0xe'),_0x2fbe('0xf')),'allowNull':![],'defaultValue':_0x2fbe('0xe')},'sendMail':{'type':Sequelize[_0x2fbe('0x10')],'defaultValue':![]},'email':{'type':Sequelize[_0x2fbe('0x2')]},'cc':{'type':Sequelize[_0x2fbe('0x11')]},'bcc':{'type':Sequelize[_0x2fbe('0x11')]},'sendIfEmpty':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0xfad2=['custom','default','STRING','TEXT','sequelize','exports','BOOLEAN','0\x200\x20*\x20*\x20*','DATE','ENUM','years','quarters','weeks','days','hours','minutes','csv','pdf','xlsx'];(function(_0x5b6f2c,_0x1f6ad3){var _0x5e0fb5=function(_0x270a2d){while(--_0x270a2d){_0x5b6f2c['push'](_0x5b6f2c['shift']());}};_0x5e0fb5(++_0x1f6ad3);}(_0xfad2,0x10e));var _0x2fad=function(_0x32f826,_0x209f22){_0x32f826=_0x32f826-0x0;var _0x180492=_0xfad2[_0x32f826];return _0x180492;};'use strict';var Sequelize=require(_0x2fad('0x0'));module[_0x2fad('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0x2fad('0x2')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x2fad('0x3')},'startAt':{'type':Sequelize['DATE'],'allowNull':![]},'endAt':{'type':Sequelize[_0x2fad('0x4')],'allowNull':![]},'subtractNumber':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0x2fad('0x5')](_0x2fad('0x6'),_0x2fad('0x7'),'months',_0x2fad('0x8'),_0x2fad('0x9'),_0x2fad('0xa'),_0x2fad('0xb')),'allowNull':![],'defaultValue':_0x2fad('0x9')},'output':{'type':Sequelize[_0x2fad('0x5')](_0x2fad('0xc'),_0x2fad('0xd'),_0x2fad('0xe')),'allowNull':![],'defaultValue':_0x2fad('0xc')},'type':{'type':Sequelize[_0x2fad('0x5')](_0x2fad('0xf'),_0x2fad('0x10')),'allowNull':![],'defaultValue':_0x2fad('0xf')},'sendMail':{'type':Sequelize[_0x2fad('0x2')],'defaultValue':![]},'email':{'type':Sequelize[_0x2fad('0x11')]},'cc':{'type':Sequelize['TEXT']},'bcc':{'type':Sequelize[_0x2fad('0x12')]},'sendIfEmpty':{'type':Sequelize[_0x2fad('0x2')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/schedule/schedule.controller.js b/server/api/schedule/schedule.controller.js index 5253aff..b479e2f 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 _0xb515=['sort','where','pick','merge','options','includeAll','catch','show','include','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','Scheduler','UserProfileSection','name','update','params','../../config/schedule','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','get','UserProfileResource','sendStatus','error','stack','send','index','map','Schedule','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order'];(function(_0x2b1134,_0x16b713){var _0x3bd569=function(_0x246b9d){while(--_0x246b9d){_0x2b1134['push'](_0x2b1134['shift']());}};_0x3bd569(++_0x16b713);}(_0xb515,0x111));var _0x5b51=function(_0x368e09,_0x2c1517){_0x368e09=_0x368e09-0x0;var _0x14b7df=_0xb515[_0x368e09];return _0x14b7df;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x5b51('0x0'));var jsonpatch=require(_0x5b51('0x1'));var rp=require(_0x5b51('0x2'));var moment=require(_0x5b51('0x3'));var BPromise=require(_0x5b51('0x4'));var Mustache=require(_0x5b51('0x5'));var util=require(_0x5b51('0x6'));var path=require(_0x5b51('0x7'));var sox=require(_0x5b51('0x8'));var csv=require(_0x5b51('0x9'));var ejs=require(_0x5b51('0xa'));var fs=require('fs');var fs_extra=require(_0x5b51('0xb'));var _=require('lodash');var squel=require(_0x5b51('0xc'));var crypto=require('crypto');var jsforce=require(_0x5b51('0xd'));var deskjs=require(_0x5b51('0xe'));var toCsv=require(_0x5b51('0x9'));var querystring=require(_0x5b51('0xf'));var Papa=require(_0x5b51('0x10'));var Redis=require(_0x5b51('0x11'));var authService=require(_0x5b51('0x12'));var qs=require(_0x5b51('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5b51('0x14'));var logger=require(_0x5b51('0x15'))(_0x5b51('0x16'));var utils=require('../../config/utils');var config=require(_0x5b51('0x17'));var licenseUtil=require(_0x5b51('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3a7980,_0x1d0de7){_0x1d0de7=_0x1d0de7||0xcc;return function(_0x1b3cf5){if(_0x1b3cf5){return _0x3a7980['sendStatus'](_0x1d0de7);}return _0x3a7980[_0x5b51('0x19')](_0x1d0de7)[_0x5b51('0x1a')]();};}function respondWithResult(_0x2fb355,_0x13d7d7){_0x13d7d7=_0x13d7d7||0xc8;return function(_0x420b8b){if(_0x420b8b){return _0x2fb355['status'](_0x13d7d7)[_0x5b51('0x1b')](_0x420b8b);}};}function respondWithFilteredResult(_0x4f9a55,_0x451e4e){return function(_0x2211bc){if(_0x2211bc){var _0x57661f=typeof _0x451e4e[_0x5b51('0x1c')]===_0x5b51('0x1d')&&typeof _0x451e4e[_0x5b51('0x1e')]===_0x5b51('0x1d');var _0x41ebd6=_0x2211bc[_0x5b51('0x1f')];var _0xafa5c6=_0x57661f?0x0:_0x451e4e[_0x5b51('0x1c')];var _0xd4937e=_0x57661f?_0x2211bc[_0x5b51('0x1f')]:_0x451e4e[_0x5b51('0x1c')]+_0x451e4e['limit'];var _0x306a35;if(_0xd4937e>=_0x41ebd6){_0xd4937e=_0x41ebd6;_0x306a35=0xc8;}else{_0x306a35=0xce;}_0x4f9a55[_0x5b51('0x19')](_0x306a35);return _0x4f9a55[_0x5b51('0x20')](_0x5b51('0x21'),_0xafa5c6+'-'+_0xd4937e+'/'+_0x41ebd6)[_0x5b51('0x1b')](_0x2211bc);}return null;};}function patchUpdates(_0x2fda57){return function(_0x15b71e){try{jsonpatch[_0x5b51('0x22')](_0x15b71e,_0x2fda57,!![]);}catch(_0x53231d){return BPromise[_0x5b51('0x23')](_0x53231d);}return _0x15b71e[_0x5b51('0x24')]();};}function saveUpdates(_0x2f02cf,_0xe7395d){return function(_0x1f4bd2){if(_0x1f4bd2){return _0x1f4bd2['update'](_0x2f02cf)[_0x5b51('0x25')](function(_0x5efb38){return _0x5efb38;});}return null;};}function removeEntity(_0x2c6c0c,_0x23d499){return function(_0x510169){if(_0x510169){return _0x510169[_0x5b51('0x26')]()['then'](function(){var _0xcce0cd=_0x510169[_0x5b51('0x27')]({'plain':!![]});var _0x404bd7='Scheduler';return db[_0x5b51('0x28')][_0x5b51('0x26')]({'where':{'type':_0x404bd7,'resourceId':_0xcce0cd['id']}})[_0x5b51('0x25')](function(){return _0x510169;});})[_0x5b51('0x25')](function(){_0x2c6c0c[_0x5b51('0x19')](0xcc)[_0x5b51('0x1a')]();});}};}function handleEntityNotFound(_0x453fb1,_0x413b34){return function(_0xfd4a7a){if(!_0xfd4a7a){_0x453fb1[_0x5b51('0x29')](0x194);}return _0xfd4a7a;};}function handleError(_0x2793a8,_0x3c556e){_0x3c556e=_0x3c556e||0x1f4;return function(_0x36c8b6){logger[_0x5b51('0x2a')](_0x36c8b6[_0x5b51('0x2b')]);if(_0x36c8b6['name']){delete _0x36c8b6['name'];}_0x2793a8[_0x5b51('0x19')](_0x3c556e)[_0x5b51('0x2c')](_0x36c8b6);};}exports[_0x5b51('0x2d')]=function(_0x52eed3,_0x1b60cc){var _0x3235f3={},_0x963272={},_0x325e11={'count':0x0,'rows':[]};var _0x36be4b=_[_0x5b51('0x2e')](db[_0x5b51('0x2f')][_0x5b51('0x30')],function(_0x1eb3b7){return{'name':_0x1eb3b7[_0x5b51('0x31')],'type':_0x1eb3b7[_0x5b51('0x32')][_0x5b51('0x33')]};});_0x963272[_0x5b51('0x34')]=_[_0x5b51('0x2e')](_0x36be4b,'name');_0x963272['query']=_[_0x5b51('0x35')](_0x52eed3[_0x5b51('0x36')]);_0x963272[_0x5b51('0x37')]=_['intersection'](_0x963272['model'],_0x963272['query']);_0x3235f3['attributes']=_[_0x5b51('0x38')](_0x963272[_0x5b51('0x34')],qs[_0x5b51('0x39')](_0x52eed3[_0x5b51('0x36')]['fields']));_0x3235f3[_0x5b51('0x3a')]=_0x3235f3['attributes'][_0x5b51('0x3b')]?_0x3235f3[_0x5b51('0x3a')]:_0x963272[_0x5b51('0x34')];if(!_0x52eed3[_0x5b51('0x36')][_0x5b51('0x3c')](_0x5b51('0x3d'))){_0x3235f3[_0x5b51('0x1e')]=qs[_0x5b51('0x1e')](_0x52eed3[_0x5b51('0x36')]['limit']);_0x3235f3[_0x5b51('0x1c')]=qs[_0x5b51('0x1c')](_0x52eed3[_0x5b51('0x36')][_0x5b51('0x1c')]);}_0x3235f3[_0x5b51('0x3e')]=qs[_0x5b51('0x3f')](_0x52eed3[_0x5b51('0x36')][_0x5b51('0x3f')]);_0x3235f3[_0x5b51('0x40')]=qs[_0x5b51('0x37')](_[_0x5b51('0x41')](_0x52eed3[_0x5b51('0x36')],_0x963272[_0x5b51('0x37')]),_0x36be4b);if(_0x52eed3[_0x5b51('0x36')]['filter']){_0x3235f3[_0x5b51('0x40')]=_[_0x5b51('0x42')](_0x3235f3['where'],{'$or':_[_0x5b51('0x2e')](_0x36be4b,function(_0x58553f){if(_0x58553f[_0x5b51('0x32')]!=='VIRTUAL'){var _0xb4ba94={};_0xb4ba94[_0x58553f['name']]={'$like':'%'+_0x52eed3[_0x5b51('0x36')]['filter']+'%'};return _0xb4ba94;}})});}_0x3235f3=_['merge']({},_0x3235f3,_0x52eed3[_0x5b51('0x43')]);var _0x26d1d4={'where':_0x3235f3[_0x5b51('0x40')]};return db['Schedule'][_0x5b51('0x1f')](_0x26d1d4)[_0x5b51('0x25')](function(_0x3811a4){_0x325e11['count']=_0x3811a4;if(_0x52eed3[_0x5b51('0x36')][_0x5b51('0x44')]){_0x3235f3['include']=[{'all':!![]}];}return db[_0x5b51('0x2f')]['findAll'](_0x3235f3);})[_0x5b51('0x25')](function(_0x28544a){_0x325e11['rows']=_0x28544a;return _0x325e11;})[_0x5b51('0x25')](respondWithFilteredResult(_0x1b60cc,_0x3235f3))[_0x5b51('0x45')](handleError(_0x1b60cc,null));};exports[_0x5b51('0x46')]=function(_0x9ea03b,_0x57e5d9){var _0x33612a={'raw':![],'where':{'id':_0x9ea03b['params']['id']}},_0x42a8c6={};_0x42a8c6[_0x5b51('0x34')]=_[_0x5b51('0x35')](db['Schedule'][_0x5b51('0x30')]);_0x42a8c6[_0x5b51('0x36')]=_[_0x5b51('0x35')](_0x9ea03b['query']);_0x42a8c6[_0x5b51('0x37')]=_[_0x5b51('0x38')](_0x42a8c6['model'],_0x42a8c6[_0x5b51('0x36')]);_0x33612a[_0x5b51('0x3a')]=_[_0x5b51('0x38')](_0x42a8c6[_0x5b51('0x34')],qs[_0x5b51('0x39')](_0x9ea03b[_0x5b51('0x36')][_0x5b51('0x39')]));_0x33612a[_0x5b51('0x3a')]=_0x33612a[_0x5b51('0x3a')][_0x5b51('0x3b')]?_0x33612a[_0x5b51('0x3a')]:_0x42a8c6[_0x5b51('0x34')];if(_0x9ea03b['query'][_0x5b51('0x44')]){_0x33612a[_0x5b51('0x47')]=[{'all':!![]}];}_0x33612a=_[_0x5b51('0x42')]({},_0x33612a,_0x9ea03b['options']);return db[_0x5b51('0x2f')][_0x5b51('0x48')](_0x33612a)[_0x5b51('0x25')](handleEntityNotFound(_0x57e5d9,null))[_0x5b51('0x25')](respondWithResult(_0x57e5d9,null))[_0x5b51('0x45')](handleError(_0x57e5d9,null));};exports[_0x5b51('0x49')]=function(_0x499071,_0x25c960){return db['Schedule'][_0x5b51('0x49')](_0x499071[_0x5b51('0x4a')],{})[_0x5b51('0x25')](function(_0x49707e){var _0x49457b=_0x499071['user'][_0x5b51('0x27')]({'plain':!![]});if(!_0x49457b)throw new Error(_0x5b51('0x4b'));if(_0x49457b[_0x5b51('0x4c')]===_0x5b51('0x4d')){var _0x453945=_0x49707e[_0x5b51('0x27')]({'plain':!![]});var _0x3b0290=_0x5b51('0x4e');return db[_0x5b51('0x4f')][_0x5b51('0x48')]({'where':{'name':_0x3b0290,'userProfileId':_0x49457b['userProfileId']},'raw':!![]})[_0x5b51('0x25')](function(_0x22f0e4){if(_0x22f0e4&&_0x22f0e4['autoAssociation']===0x0){return db['UserProfileResource'][_0x5b51('0x49')]({'name':_0x453945['name'],'resourceId':_0x453945['id'],'type':_0x22f0e4[_0x5b51('0x50')],'sectionId':_0x22f0e4['id']},{})['then'](function(){return _0x49707e;});}else{return _0x49707e;}})[_0x5b51('0x45')](function(_0x1cc2bb){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1cc2bb);throw _0x1cc2bb;});}return _0x49707e;})[_0x5b51('0x25')](respondWithResult(_0x25c960,0xc9))[_0x5b51('0x45')](handleError(_0x25c960,null));};exports[_0x5b51('0x51')]=function(_0x2bd04d,_0x4c5319){if(_0x2bd04d['body']['id']){delete _0x2bd04d[_0x5b51('0x4a')]['id'];}return db[_0x5b51('0x2f')][_0x5b51('0x48')]({'where':{'id':_0x2bd04d[_0x5b51('0x52')]['id']}})[_0x5b51('0x25')](handleEntityNotFound(_0x4c5319,null))[_0x5b51('0x25')](saveUpdates(_0x2bd04d['body'],null))[_0x5b51('0x25')](respondWithResult(_0x4c5319,null))[_0x5b51('0x45')](handleError(_0x4c5319,null));};exports[_0x5b51('0x26')]=function(_0x3ae769,_0x29effe){return db[_0x5b51('0x2f')][_0x5b51('0x48')]({'where':{'id':_0x3ae769[_0x5b51('0x52')]['id']}})['then'](handleEntityNotFound(_0x29effe,null))[_0x5b51('0x25')](removeEntity(_0x29effe,null))[_0x5b51('0x45')](handleError(_0x29effe,null));};exports['run']=function(_0x403cdc,_0x5bad97,_0x1f46c6){var _0x25d7db=require(_0x5b51('0x53'));return db[_0x5b51('0x2f')]['find']({'where':{'id':_0x403cdc[_0x5b51('0x52')]['id']},'raw':!![]})[_0x5b51('0x25')](handleEntityNotFound(_0x5bad97,null))[_0x5b51('0x25')](function(){_0x25d7db['run'](_0x403cdc[_0x5b51('0x52')]['id']);})[_0x5b51('0x25')](respondWithStatusCode(_0x5bad97,null))[_0x5b51('0x45')](handleError(_0x5bad97,null));}; \ No newline at end of file +var _0xec06=['UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','run','../../config/schedule','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','limit','set','json','apply','reject','save','update','then','destroy','get','Scheduler','UserProfileResource','error','map','rawAttributes','type','model','name','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','filter','options','Schedule','count','findAll','catch','show','includeAll','include','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role'];(function(_0x4639d7,_0x2e3b56){var _0x369329=function(_0x469c37){while(--_0x469c37){_0x4639d7['push'](_0x4639d7['shift']());}};_0x369329(++_0x2e3b56);}(_0xec06,0x1b1));var _0x6ec0=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xec06[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0x6ec0('0x0'));var rimraf=require(_0x6ec0('0x1'));var zipdir=require(_0x6ec0('0x2'));var jsonpatch=require(_0x6ec0('0x3'));var rp=require(_0x6ec0('0x4'));var moment=require(_0x6ec0('0x5'));var BPromise=require(_0x6ec0('0x6'));var Mustache=require(_0x6ec0('0x7'));var util=require(_0x6ec0('0x8'));var path=require(_0x6ec0('0x9'));var sox=require('sox');var csv=require(_0x6ec0('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6ec0('0xb'));var squel=require(_0x6ec0('0xc'));var crypto=require(_0x6ec0('0xd'));var jsforce=require(_0x6ec0('0xe'));var deskjs=require(_0x6ec0('0xf'));var toCsv=require('to-csv');var querystring=require(_0x6ec0('0x10'));var Papa=require(_0x6ec0('0x11'));var Redis=require(_0x6ec0('0x12'));var authService=require(_0x6ec0('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x6ec0('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6ec0('0x15'))(_0x6ec0('0x16'));var utils=require(_0x6ec0('0x17'));var config=require(_0x6ec0('0x18'));var licenseUtil=require(_0x6ec0('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x11f0e4,_0x5a29ec){_0x5a29ec=_0x5a29ec||0xcc;return function(_0x84a971){if(_0x84a971){return _0x11f0e4[_0x6ec0('0x1a')](_0x5a29ec);}return _0x11f0e4[_0x6ec0('0x1b')](_0x5a29ec)[_0x6ec0('0x1c')]();};}function respondWithResult(_0x26e45e,_0x4cce9f){_0x4cce9f=_0x4cce9f||0xc8;return function(_0x29dbdd){if(_0x29dbdd){return _0x26e45e[_0x6ec0('0x1b')](_0x4cce9f)['json'](_0x29dbdd);}};}function respondWithFilteredResult(_0x3230a3,_0x293e8a){return function(_0x558c17){if(_0x558c17){var _0x4a56a6=typeof _0x293e8a[_0x6ec0('0x1d')]===_0x6ec0('0x1e')&&typeof _0x293e8a[_0x6ec0('0x1f')]===_0x6ec0('0x1e');var _0x133e9d=_0x558c17['count'];var _0x245a3a=_0x4a56a6?0x0:_0x293e8a['offset'];var _0x3e9686=_0x4a56a6?_0x558c17['count']:_0x293e8a[_0x6ec0('0x1d')]+_0x293e8a[_0x6ec0('0x1f')];var _0x16c71d;if(_0x3e9686>=_0x133e9d){_0x3e9686=_0x133e9d;_0x16c71d=0xc8;}else{_0x16c71d=0xce;}_0x3230a3[_0x6ec0('0x1b')](_0x16c71d);return _0x3230a3[_0x6ec0('0x20')]('Content-Range',_0x245a3a+'-'+_0x3e9686+'/'+_0x133e9d)[_0x6ec0('0x21')](_0x558c17);}return null;};}function patchUpdates(_0x5baf44){return function(_0x365d92){try{jsonpatch[_0x6ec0('0x22')](_0x365d92,_0x5baf44,!![]);}catch(_0x3b1fbd){return BPromise[_0x6ec0('0x23')](_0x3b1fbd);}return _0x365d92[_0x6ec0('0x24')]();};}function saveUpdates(_0x4c1621,_0x41891c){return function(_0x344cb2){if(_0x344cb2){return _0x344cb2[_0x6ec0('0x25')](_0x4c1621)[_0x6ec0('0x26')](function(_0x56da7a){return _0x56da7a;});}return null;};}function removeEntity(_0x45ae09,_0x3f51b9){return function(_0x110972){if(_0x110972){return _0x110972[_0x6ec0('0x27')]()[_0x6ec0('0x26')](function(){var _0x334171=_0x110972[_0x6ec0('0x28')]({'plain':!![]});var _0x25aa57=_0x6ec0('0x29');return db[_0x6ec0('0x2a')][_0x6ec0('0x27')]({'where':{'type':_0x25aa57,'resourceId':_0x334171['id']}})['then'](function(){return _0x110972;});})[_0x6ec0('0x26')](function(){_0x45ae09[_0x6ec0('0x1b')](0xcc)[_0x6ec0('0x1c')]();});}};}function handleEntityNotFound(_0x481ef5,_0x4376fb){return function(_0x113dd7){if(!_0x113dd7){_0x481ef5[_0x6ec0('0x1a')](0x194);}return _0x113dd7;};}function handleError(_0x72bc2f,_0x55289f){_0x55289f=_0x55289f||0x1f4;return function(_0x24aba6){logger[_0x6ec0('0x2b')](_0x24aba6['stack']);if(_0x24aba6['name']){delete _0x24aba6['name'];}_0x72bc2f[_0x6ec0('0x1b')](_0x55289f)['send'](_0x24aba6);};}exports['index']=function(_0x401769,_0x2b08ad){var _0x3e301e={},_0x4064dd={},_0x21b75d={'count':0x0,'rows':[]};var _0x58bf45=_[_0x6ec0('0x2c')](db['Schedule'][_0x6ec0('0x2d')],function(_0x590c33){return{'name':_0x590c33['fieldName'],'type':_0x590c33[_0x6ec0('0x2e')]['key']};});_0x4064dd[_0x6ec0('0x2f')]=_[_0x6ec0('0x2c')](_0x58bf45,_0x6ec0('0x30'));_0x4064dd['query']=_[_0x6ec0('0x31')](_0x401769[_0x6ec0('0x32')]);_0x4064dd[_0x6ec0('0x33')]=_[_0x6ec0('0x34')](_0x4064dd[_0x6ec0('0x2f')],_0x4064dd[_0x6ec0('0x32')]);_0x3e301e[_0x6ec0('0x35')]=_['intersection'](_0x4064dd[_0x6ec0('0x2f')],qs['fields'](_0x401769[_0x6ec0('0x32')][_0x6ec0('0x36')]));_0x3e301e[_0x6ec0('0x35')]=_0x3e301e[_0x6ec0('0x35')][_0x6ec0('0x37')]?_0x3e301e[_0x6ec0('0x35')]:_0x4064dd[_0x6ec0('0x2f')];if(!_0x401769[_0x6ec0('0x32')][_0x6ec0('0x38')]('nolimit')){_0x3e301e[_0x6ec0('0x1f')]=qs['limit'](_0x401769[_0x6ec0('0x32')][_0x6ec0('0x1f')]);_0x3e301e['offset']=qs[_0x6ec0('0x1d')](_0x401769[_0x6ec0('0x32')][_0x6ec0('0x1d')]);}_0x3e301e[_0x6ec0('0x39')]=qs['sort'](_0x401769[_0x6ec0('0x32')][_0x6ec0('0x3a')]);_0x3e301e[_0x6ec0('0x3b')]=qs[_0x6ec0('0x33')](_[_0x6ec0('0x3c')](_0x401769[_0x6ec0('0x32')],_0x4064dd[_0x6ec0('0x33')]),_0x58bf45);if(_0x401769[_0x6ec0('0x32')]['filter']){_0x3e301e[_0x6ec0('0x3b')]=_[_0x6ec0('0x3d')](_0x3e301e['where'],{'$or':_[_0x6ec0('0x2c')](_0x58bf45,function(_0x183dc2){if(_0x183dc2[_0x6ec0('0x2e')]!==_0x6ec0('0x3e')){var _0x1c897b={};_0x1c897b[_0x183dc2[_0x6ec0('0x30')]]={'$like':'%'+_0x401769[_0x6ec0('0x32')][_0x6ec0('0x3f')]+'%'};return _0x1c897b;}})});}_0x3e301e=_[_0x6ec0('0x3d')]({},_0x3e301e,_0x401769[_0x6ec0('0x40')]);var _0x5d86fc={'where':_0x3e301e[_0x6ec0('0x3b')]};return db[_0x6ec0('0x41')]['count'](_0x5d86fc)[_0x6ec0('0x26')](function(_0x42974b){_0x21b75d[_0x6ec0('0x42')]=_0x42974b;if(_0x401769[_0x6ec0('0x32')]['includeAll']){_0x3e301e['include']=[{'all':!![]}];}return db[_0x6ec0('0x41')][_0x6ec0('0x43')](_0x3e301e);})[_0x6ec0('0x26')](function(_0x23f260){_0x21b75d['rows']=_0x23f260;return _0x21b75d;})[_0x6ec0('0x26')](respondWithFilteredResult(_0x2b08ad,_0x3e301e))[_0x6ec0('0x44')](handleError(_0x2b08ad,null));};exports[_0x6ec0('0x45')]=function(_0x46ee87,_0x11c16f){var _0x30aa1a={'raw':![],'where':{'id':_0x46ee87['params']['id']}},_0x5c1fdc={};_0x5c1fdc[_0x6ec0('0x2f')]=_['keys'](db[_0x6ec0('0x41')][_0x6ec0('0x2d')]);_0x5c1fdc[_0x6ec0('0x32')]=_[_0x6ec0('0x31')](_0x46ee87[_0x6ec0('0x32')]);_0x5c1fdc[_0x6ec0('0x33')]=_['intersection'](_0x5c1fdc['model'],_0x5c1fdc[_0x6ec0('0x32')]);_0x30aa1a[_0x6ec0('0x35')]=_[_0x6ec0('0x34')](_0x5c1fdc[_0x6ec0('0x2f')],qs['fields'](_0x46ee87[_0x6ec0('0x32')][_0x6ec0('0x36')]));_0x30aa1a[_0x6ec0('0x35')]=_0x30aa1a[_0x6ec0('0x35')]['length']?_0x30aa1a[_0x6ec0('0x35')]:_0x5c1fdc[_0x6ec0('0x2f')];if(_0x46ee87[_0x6ec0('0x32')][_0x6ec0('0x46')]){_0x30aa1a[_0x6ec0('0x47')]=[{'all':!![]}];}_0x30aa1a=_['merge']({},_0x30aa1a,_0x46ee87[_0x6ec0('0x40')]);return db[_0x6ec0('0x41')][_0x6ec0('0x48')](_0x30aa1a)[_0x6ec0('0x26')](handleEntityNotFound(_0x11c16f,null))[_0x6ec0('0x26')](respondWithResult(_0x11c16f,null))['catch'](handleError(_0x11c16f,null));};exports[_0x6ec0('0x49')]=function(_0x113df4,_0x28c2d7){return db[_0x6ec0('0x41')]['create'](_0x113df4['body'],{})[_0x6ec0('0x26')](function(_0x2096cf){var _0x4e40db=_0x113df4[_0x6ec0('0x4a')][_0x6ec0('0x28')]({'plain':!![]});if(!_0x4e40db)throw new Error(_0x6ec0('0x4b'));if(_0x4e40db[_0x6ec0('0x4c')]===_0x6ec0('0x4a')){var _0x169972=_0x2096cf[_0x6ec0('0x28')]({'plain':!![]});var _0x2cab10=_0x6ec0('0x29');return db[_0x6ec0('0x4d')][_0x6ec0('0x48')]({'where':{'name':_0x2cab10,'userProfileId':_0x4e40db[_0x6ec0('0x4e')]},'raw':!![]})[_0x6ec0('0x26')](function(_0x2ece18){if(_0x2ece18&&_0x2ece18[_0x6ec0('0x4f')]===0x0){return db[_0x6ec0('0x2a')][_0x6ec0('0x49')]({'name':_0x169972[_0x6ec0('0x30')],'resourceId':_0x169972['id'],'type':_0x2ece18[_0x6ec0('0x30')],'sectionId':_0x2ece18['id']},{})['then'](function(){return _0x2096cf;});}else{return _0x2096cf;}})[_0x6ec0('0x44')](function(_0x32bf0b){logger['error'](_0x6ec0('0x50'),_0x32bf0b);throw _0x32bf0b;});}return _0x2096cf;})[_0x6ec0('0x26')](respondWithResult(_0x28c2d7,0xc9))[_0x6ec0('0x44')](handleError(_0x28c2d7,null));};exports[_0x6ec0('0x25')]=function(_0x15b614,_0x4f9a33){if(_0x15b614[_0x6ec0('0x51')]['id']){delete _0x15b614['body']['id'];}return db[_0x6ec0('0x41')][_0x6ec0('0x48')]({'where':{'id':_0x15b614['params']['id']}})[_0x6ec0('0x26')](handleEntityNotFound(_0x4f9a33,null))[_0x6ec0('0x26')](saveUpdates(_0x15b614['body'],null))[_0x6ec0('0x26')](respondWithResult(_0x4f9a33,null))[_0x6ec0('0x44')](handleError(_0x4f9a33,null));};exports['destroy']=function(_0x5d19b5,_0x272530){return db[_0x6ec0('0x41')][_0x6ec0('0x48')]({'where':{'id':_0x5d19b5[_0x6ec0('0x52')]['id']}})[_0x6ec0('0x26')](handleEntityNotFound(_0x272530,null))[_0x6ec0('0x26')](removeEntity(_0x272530,null))['catch'](handleError(_0x272530,null));};exports[_0x6ec0('0x53')]=function(_0x3f6df8,_0x2d9eed,_0x3413a6){var _0x443b3e=require(_0x6ec0('0x54'));return db[_0x6ec0('0x41')]['find']({'where':{'id':_0x3f6df8[_0x6ec0('0x52')]['id']},'raw':!![]})[_0x6ec0('0x26')](handleEntityNotFound(_0x2d9eed,null))[_0x6ec0('0x26')](function(){_0x443b3e[_0x6ec0('0x53')](_0x3f6df8[_0x6ec0('0x52')]['id']);})[_0x6ec0('0x26')](respondWithStatusCode(_0x2d9eed,null))['catch'](handleError(_0x2d9eed,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index 93aba22..3209af5 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 _0x66c9=['path','rimraf','../../config/environment','./schedule.attributes','exports','define','tools_schedules','lodash','util','../../config/logger','api','moment'];(function(_0x398481,_0x3de964){var _0x3a4d22=function(_0x359ad4){while(--_0x359ad4){_0x398481['push'](_0x398481['shift']());}};_0x3a4d22(++_0x3de964);}(_0x66c9,0x187));var _0x966c=function(_0x5acf24,_0x325870){_0x5acf24=_0x5acf24-0x0;var _0xd55a8c=_0x66c9[_0x5acf24];return _0xd55a8c;};'use strict';var _=require(_0x966c('0x0'));var util=require(_0x966c('0x1'));var logger=require(_0x966c('0x2'))(_0x966c('0x3'));var moment=require(_0x966c('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x966c('0x5'));var rimraf=require(_0x966c('0x6'));var config=require(_0x966c('0x7'));var attributes=require(_0x966c('0x8'));module[_0x966c('0x9')]=function(_0x79daf2,_0xfe0415){return _0x79daf2[_0x966c('0xa')]('Schedule',attributes,{'tableName':_0x966c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xedd9=['../../config/logger','api','bluebird','request-promise','path','rimraf','./schedule.attributes','tools_schedules','lodash','util'];(function(_0x286e63,_0x90bf8f){var _0x4535eb=function(_0x1d71b4){while(--_0x1d71b4){_0x286e63['push'](_0x286e63['shift']());}};_0x4535eb(++_0x90bf8f);}(_0xedd9,0x10c));var _0x9edd=function(_0x58e9c6,_0x5a0779){_0x58e9c6=_0x58e9c6-0x0;var _0x7bed7f=_0xedd9[_0x58e9c6];return _0x7bed7f;};'use strict';var _=require(_0x9edd('0x0'));var util=require(_0x9edd('0x1'));var logger=require(_0x9edd('0x2'))(_0x9edd('0x3'));var moment=require('moment');var BPromise=require(_0x9edd('0x4'));var rp=require(_0x9edd('0x5'));var fs=require('fs');var path=require(_0x9edd('0x6'));var rimraf=require(_0x9edd('0x7'));var config=require('../../config/environment');var attributes=require(_0x9edd('0x8'));module['exports']=function(_0x67e964,_0x28a32d){return _0x67e964['define']('Schedule',attributes,{'tableName':_0x9edd('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/schedule/schedule.rpc.js b/server/api/schedule/schedule.rpc.js index b2c0070..ea5bb8e 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 _0x963c=['catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug','Schedule,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','Schedule,\x20%s,\x20%s','result'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x963c,0x97));var _0xc963=function(_0x19906e,_0x1a2808){_0x19906e=_0x19906e-0x0;var _0x3f1aea=_0x963c[_0x19906e];return _0x3f1aea;};'use strict';var _=require('lodash');var util=require(_0xc963('0x0'));var moment=require(_0xc963('0x1'));var BPromise=require(_0xc963('0x2'));var rs=require(_0xc963('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc963('0x4'))['db'];var utils=require(_0xc963('0x5'));var logger=require(_0xc963('0x6'))(_0xc963('0x7'));var config=require(_0xc963('0x8'));var jayson=require(_0xc963('0x9'));var client=jayson[_0xc963('0xa')][_0xc963('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x422f3b,_0x5506c6,_0xb4084f){return new BPromise(function(_0x259e3e,_0x153bba){return client[_0xc963('0xc')](_0x422f3b,_0xb4084f)[_0xc963('0xd')](function(_0x3d7b0a){logger['info']('Schedule,\x20%s,\x20%s',_0x5506c6,_0xc963('0xe'));logger[_0xc963('0xf')](_0xc963('0x10'),_0x5506c6,'request\x20sent',JSON[_0xc963('0x11')](_0x3d7b0a));if(_0x3d7b0a[_0xc963('0x12')]){if(_0x3d7b0a[_0xc963('0x12')][_0xc963('0x13')]===0x1f4){logger[_0xc963('0x12')]('Schedule,\x20%s,\x20%s',_0x5506c6,_0x3d7b0a[_0xc963('0x12')][_0xc963('0x14')]);return _0x153bba(_0x3d7b0a['error']['message']);}logger[_0xc963('0x12')]('Schedule,\x20%s,\x20%s',_0x5506c6,_0x3d7b0a[_0xc963('0x12')][_0xc963('0x14')]);return _0x259e3e(_0x3d7b0a['error'][_0xc963('0x14')]);}else{logger[_0xc963('0x15')](_0xc963('0x16'),_0x5506c6,'request\x20sent');_0x259e3e(_0x3d7b0a[_0xc963('0x17')]['message']);}})[_0xc963('0x18')](function(_0x77e7a){logger['error']('Schedule,\x20%s,\x20%s',_0x5506c6,_0x77e7a);_0x153bba(_0x77e7a);});});} \ No newline at end of file +var _0xb1e6=['request\x20sent','debug','Schedule,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','Schedule,\x20%s,\x20%s'];(function(_0x485083,_0x3b371c){var _0x3414f3=function(_0x34ee07){while(--_0x34ee07){_0x485083['push'](_0x485083['shift']());}};_0x3414f3(++_0x3b371c);}(_0xb1e6,0x70));var _0x6b1e=function(_0x5de532,_0x2941c4){_0x5de532=_0x5de532-0x0;var _0x4e9192=_0xb1e6[_0x5de532];return _0x4e9192;};'use strict';var _=require(_0x6b1e('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x6b1e('0x1'));var fs=require('fs');var Redis=require(_0x6b1e('0x2'));var db=require(_0x6b1e('0x3'))['db'];var utils=require(_0x6b1e('0x4'));var logger=require(_0x6b1e('0x5'))(_0x6b1e('0x6'));var config=require('../../config/environment');var jayson=require(_0x6b1e('0x7'));var client=jayson[_0x6b1e('0x8')][_0x6b1e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x58b1ec,_0x51cc29,_0x49b523){return new BPromise(function(_0x38a659,_0xd282ef){return client[_0x6b1e('0xa')](_0x58b1ec,_0x49b523)[_0x6b1e('0xb')](function(_0x53b30c){logger[_0x6b1e('0xc')](_0x6b1e('0xd'),_0x51cc29,_0x6b1e('0xe'));logger[_0x6b1e('0xf')](_0x6b1e('0x10'),_0x51cc29,_0x6b1e('0xe'),JSON['stringify'](_0x53b30c));if(_0x53b30c['error']){if(_0x53b30c['error']['code']===0x1f4){logger[_0x6b1e('0x11')]('Schedule,\x20%s,\x20%s',_0x51cc29,_0x53b30c[_0x6b1e('0x11')][_0x6b1e('0x12')]);return _0xd282ef(_0x53b30c['error'][_0x6b1e('0x12')]);}logger[_0x6b1e('0x11')](_0x6b1e('0xd'),_0x51cc29,_0x53b30c[_0x6b1e('0x11')][_0x6b1e('0x12')]);return _0x38a659(_0x53b30c['error'][_0x6b1e('0x12')]);}else{logger['info'](_0x6b1e('0xd'),_0x51cc29,'request\x20sent');_0x38a659(_0x53b30c[_0x6b1e('0x13')][_0x6b1e('0x12')]);}})[_0x6b1e('0x14')](function(_0x120439){logger[_0x6b1e('0x11')](_0x6b1e('0xd'),_0x51cc29,_0x120439);_0xd282ef(_0x120439);});});} \ No newline at end of file diff --git a/server/api/screenRecording/index.js b/server/api/screenRecording/index.js index 390590b..6ea5c09 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 _0x776a=['/:id','show','/:id/download','download','post','create','destroy','exports','util','connect-timeout','Router','../../components/auth/service','./screenRecording.controller','get','isAuthenticated','index'];(function(_0x4839a2,_0x1f67eb){var _0x465147=function(_0x4eae2e){while(--_0x4eae2e){_0x4839a2['push'](_0x4839a2['shift']());}};_0x465147(++_0x1f67eb);}(_0x776a,0x1b8));var _0xa776=function(_0x5ab921,_0x32dff2){_0x5ab921=_0x5ab921-0x0;var _0x3da787=_0x776a[_0x5ab921];return _0x3da787;};'use strict';var multer=require('multer');var util=require(_0xa776('0x0'));var path=require('path');var timeout=require(_0xa776('0x1'));var express=require('express');var router=express[_0xa776('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xa776('0x3'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xa776('0x4'));router[_0xa776('0x5')]('/',auth[_0xa776('0x6')](),controller[_0xa776('0x7')]);router['get']('/describe',auth[_0xa776('0x6')](),controller['describe']);router['get'](_0xa776('0x8'),auth[_0xa776('0x6')](),controller[_0xa776('0x9')]);router[_0xa776('0x5')](_0xa776('0xa'),auth['isAuthenticated'](),controller[_0xa776('0xb')]);router[_0xa776('0xc')]('/',auth[_0xa776('0x6')](),controller[_0xa776('0xd')]);router['put'](_0xa776('0x8'),auth[_0xa776('0x6')](),controller['update']);router['delete']('/:id',auth[_0xa776('0x6')](),controller[_0xa776('0xe')]);module[_0xa776('0xf')]=router; \ No newline at end of file +var _0x9d9c=['isAuthenticated','get','describe','/:id/download','download','post','create','put','/:id','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./screenRecording.controller'];(function(_0x4a2bd6,_0xa1a75c){var _0x1ec54f=function(_0x569431){while(--_0x569431){_0x4a2bd6['push'](_0x4a2bd6['shift']());}};_0x1ec54f(++_0xa1a75c);}(_0x9d9c,0x17c));var _0xc9d9=function(_0x45b034,_0x3a57dd){_0x45b034=_0x45b034-0x0;var _0x509cb0=_0x9d9c[_0x45b034];return _0x509cb0;};'use strict';var multer=require(_0xc9d9('0x0'));var util=require(_0xc9d9('0x1'));var path=require(_0xc9d9('0x2'));var timeout=require(_0xc9d9('0x3'));var express=require(_0xc9d9('0x4'));var router=express[_0xc9d9('0x5')]();var fs_extra=require(_0xc9d9('0x6'));var auth=require(_0xc9d9('0x7'));var interaction=require(_0xc9d9('0x8'));var config=require(_0xc9d9('0x9'));var controller=require(_0xc9d9('0xa'));router['get']('/',auth[_0xc9d9('0xb')](),controller['index']);router[_0xc9d9('0xc')]('/describe',auth[_0xc9d9('0xb')](),controller[_0xc9d9('0xd')]);router[_0xc9d9('0xc')]('/:id',auth[_0xc9d9('0xb')](),controller['show']);router['get'](_0xc9d9('0xe'),auth['isAuthenticated'](),controller[_0xc9d9('0xf')]);router[_0xc9d9('0x10')]('/',auth[_0xc9d9('0xb')](),controller[_0xc9d9('0x11')]);router[_0xc9d9('0x12')](_0xc9d9('0x13'),auth[_0xc9d9('0xb')](),controller[_0xc9d9('0x14')]);router[_0xc9d9('0x15')](_0xc9d9('0x13'),auth[_0xc9d9('0xb')](),controller['destroy']);module[_0xc9d9('0x16')]=router; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.attributes.js b/server/api/screenRecording/screenRecording.attributes.js index d937b33..4436f70 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 _0x288a=['setDataValue','INTEGER','startedAt','subtract','duration','DATE','format','MM-DD-YYYY\x20HH:mm','toString','closedAt','createdAt','updatedAt','moment','path','../../config/environment','exports','value','getDataValue','STRING'];(function(_0x5f3aa6,_0x12f51a){var _0x2119b3=function(_0x38c561){while(--_0x38c561){_0x5f3aa6['push'](_0x5f3aa6['shift']());}};_0x2119b3(++_0x12f51a);}(_0x288a,0x188));var _0xa288=function(_0x5f124a,_0x34e5d2){_0x5f124a=_0x5f124a-0x0;var _0x3717c1=_0x288a[_0x5f124a];return _0x3717c1;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xa288('0x0'));var path=require(_0xa288('0x1'));var config=require(_0xa288('0x2'));module[_0xa288('0x3')]={'format':{'type':Sequelize['VIRTUAL'],'get':function(){return this['getDataValue'](_0xa288('0x4'))?path['extname'](this[_0xa288('0x5')](_0xa288('0x4'))):undefined;}},'interactionid':{'type':Sequelize[_0xa288('0x6')]},'channel':{'type':Sequelize['STRING']},'value':{'type':Sequelize[_0xa288('0x6')],'set':function(_0xaee90c){var _0x156720=_0xaee90c['replace'](/\\/g,'/');this[_0xa288('0x7')](_0xa288('0x4'),_0x156720);}},'rating':{'type':Sequelize[_0xa288('0x8')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0xa288('0x8')],'set':function(_0x1a0c06){this[_0xa288('0x7')](_0xa288('0x9'),moment()[_0xa288('0xa')](_0x1a0c06,'ms'));this['setDataValue']('closedAt',moment());this['setDataValue'](_0xa288('0xb'),_0x1a0c06);}},'startedAt':{'type':Sequelize[_0xa288('0xc')],'get':function(){return moment(this['getDataValue'](_0xa288('0x9')))[_0xa288('0xd')](_0xa288('0xe'))[_0xa288('0xf')]();}},'closedAt':{'type':Sequelize[_0xa288('0xc')],'get':function(){return moment(this[_0xa288('0x5')](_0xa288('0x10')))[_0xa288('0xd')](_0xa288('0xe'))[_0xa288('0xf')]();}},'createdAt':{'type':Sequelize[_0xa288('0xc')],'get':function(){return moment(this[_0xa288('0x5')](_0xa288('0x11')))[_0xa288('0xd')](_0xa288('0xe'))[_0xa288('0xf')]();}},'updatedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0xa288('0x5')](_0xa288('0x12')))[_0xa288('0xd')](_0xa288('0xe'))[_0xa288('0xf')]();}}}; \ No newline at end of file +var _0x1c52=['startedAt','subtract','setDataValue','DATE','getDataValue','format','toString','closedAt','MM-DD-YYYY\x20HH:mm','createdAt','sequelize','moment','path','../../config/environment','value','extname','STRING','replace','INTEGER'];(function(_0x227378,_0x2073f2){var _0x502efe=function(_0x4c6818){while(--_0x4c6818){_0x227378['push'](_0x227378['shift']());}};_0x502efe(++_0x2073f2);}(_0x1c52,0x7c));var _0x21c5=function(_0x2cca86,_0x59432f){_0x2cca86=_0x2cca86-0x0;var _0x9fce42=_0x1c52[_0x2cca86];return _0x9fce42;};'use strict';var Sequelize=require(_0x21c5('0x0'));var moment=require(_0x21c5('0x1'));var path=require(_0x21c5('0x2'));var config=require(_0x21c5('0x3'));module['exports']={'format':{'type':Sequelize['VIRTUAL'],'get':function(){return this['getDataValue'](_0x21c5('0x4'))?path[_0x21c5('0x5')](this['getDataValue'](_0x21c5('0x4'))):undefined;}},'interactionid':{'type':Sequelize[_0x21c5('0x6')]},'channel':{'type':Sequelize[_0x21c5('0x6')]},'value':{'type':Sequelize[_0x21c5('0x6')],'set':function(_0x5b12d5){var _0xed0195=_0x5b12d5[_0x21c5('0x7')](/\\/g,'/');this['setDataValue'](_0x21c5('0x4'),_0xed0195);}},'rating':{'type':Sequelize[_0x21c5('0x8')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0x21c5('0x8')],'set':function(_0x27389f){this['setDataValue'](_0x21c5('0x9'),moment()[_0x21c5('0xa')](_0x27389f,'ms'));this[_0x21c5('0xb')]('closedAt',moment());this[_0x21c5('0xb')]('duration',_0x27389f);}},'startedAt':{'type':Sequelize[_0x21c5('0xc')],'get':function(){return moment(this[_0x21c5('0xd')](_0x21c5('0x9')))[_0x21c5('0xe')]('MM-DD-YYYY\x20HH:mm')[_0x21c5('0xf')]();}},'closedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x21c5('0xd')](_0x21c5('0x10')))['format'](_0x21c5('0x11'))['toString']();}},'createdAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x21c5('0xd')](_0x21c5('0x12')))[_0x21c5('0xe')](_0x21c5('0x11'))[_0x21c5('0xf')]();}},'updatedAt':{'type':Sequelize[_0x21c5('0xc')],'get':function(){return moment(this[_0x21c5('0xd')]('updatedAt'))[_0x21c5('0xe')]('MM-DD-YYYY\x20HH:mm')['toString']();}}}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.controller.js b/server/api/screenRecording/screenRecording.controller.js index bbdadf1..c2c028e 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 _0x46ed=['intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','includeAll','findAll','rows','catch','show','keys','include','options','find','create','body','createdAt','closedAt','describe','download','../../components/encryptor','uniqueid','params','value','join','root','server/files/screen_recordings','%s.cypher','decryptFile','secrets','recording','existsSync','ScreenRecording\x20not\x20found','filename','unlink','message','Not\x20found','destroy','isNil','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','end','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','offset','limit','undefined','set','Content-Range','json','apply','reject','update','then','stack','name','send','index','map','ScreenRecording','rawAttributes','fieldName','type','key','model','format','query','filters'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x46ed,0x168));var _0xd46e=function(_0x5c2e3e,_0x26ecd3){_0x5c2e3e=_0x5c2e3e-0x0;var _0x53f64a=_0x46ed[_0x5c2e3e];return _0x53f64a;};'use strict';var emlformat=require(_0xd46e('0x0'));var rimraf=require(_0xd46e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd46e('0x2'));var rp=require(_0xd46e('0x3'));var moment=require(_0xd46e('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xd46e('0x5'));var util=require(_0xd46e('0x6'));var path=require('path');var sox=require(_0xd46e('0x7'));var csv=require(_0xd46e('0x8'));var ejs=require(_0xd46e('0x9'));var fs=require('fs');var fs_extra=require(_0xd46e('0xa'));var _=require(_0xd46e('0xb'));var squel=require(_0xd46e('0xc'));var crypto=require(_0xd46e('0xd'));var jsforce=require(_0xd46e('0xe'));var deskjs=require(_0xd46e('0xf'));var toCsv=require(_0xd46e('0x8'));var querystring=require(_0xd46e('0x10'));var Papa=require('papaparse');var Redis=require(_0xd46e('0x11'));var authService=require(_0xd46e('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xd46e('0x13'));var hardwareService=require(_0xd46e('0x14'));var logger=require(_0xd46e('0x15'))(_0xd46e('0x16'));var utils=require(_0xd46e('0x17'));var config=require(_0xd46e('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xd46e('0x19'))['db'];function respondWithStatusCode(_0x5bc1da,_0x48550b){_0x48550b=_0x48550b||0xcc;return function(_0xf3048c){if(_0xf3048c){return _0x5bc1da[_0xd46e('0x1a')](_0x48550b);}return _0x5bc1da['status'](_0x48550b)['end']();};}function respondWithResult(_0xacd799,_0x4688ae){_0x4688ae=_0x4688ae||0xc8;return function(_0x1e9aae){if(_0x1e9aae){return _0xacd799[_0xd46e('0x1b')](_0x4688ae)['json'](_0x1e9aae);}};}function respondWithFilteredResult(_0x3b6d25,_0x44a620){return function(_0x417402){if(_0x417402){var _0x3d72ce=typeof _0x44a620[_0xd46e('0x1c')]==='undefined'&&typeof _0x44a620[_0xd46e('0x1d')]===_0xd46e('0x1e');var _0x3583a5=_0x417402['count'];var _0x5ddd04=_0x3d72ce?0x0:_0x44a620[_0xd46e('0x1c')];var _0x1bd574=_0x3d72ce?_0x417402['count']:_0x44a620['offset']+_0x44a620[_0xd46e('0x1d')];var _0x2f2571;if(_0x1bd574>=_0x3583a5){_0x1bd574=_0x3583a5;_0x2f2571=0xc8;}else{_0x2f2571=0xce;}_0x3b6d25[_0xd46e('0x1b')](_0x2f2571);return _0x3b6d25[_0xd46e('0x1f')](_0xd46e('0x20'),_0x5ddd04+'-'+_0x1bd574+'/'+_0x3583a5)[_0xd46e('0x21')](_0x417402);}return null;};}function patchUpdates(_0x3b5fa4){return function(_0x327b7e){try{jsonpatch[_0xd46e('0x22')](_0x327b7e,_0x3b5fa4,!![]);}catch(_0x3c7e91){return BPromise[_0xd46e('0x23')](_0x3c7e91);}return _0x327b7e['save']();};}function saveUpdates(_0x259072,_0x1c83fa){return function(_0x79aa51){if(_0x79aa51){return _0x79aa51[_0xd46e('0x24')](_0x259072)[_0xd46e('0x25')](function(_0xc1af7f){return _0xc1af7f;});}return null;};}function removeEntity(_0x33c2e0,_0x8a1be){return function(_0x62dea5){if(_0x62dea5){return _0x62dea5['destroy']()[_0xd46e('0x25')](function(){_0x33c2e0['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x371054,_0x2a5271){return function(_0x21135f){if(!_0x21135f){_0x371054[_0xd46e('0x1a')](0x194);}return _0x21135f;};}function handleError(_0x247b9f,_0x180851){_0x180851=_0x180851||0x1f4;return function(_0x1740d1){logger['error'](_0x1740d1[_0xd46e('0x26')]);if(_0x1740d1[_0xd46e('0x27')]){delete _0x1740d1[_0xd46e('0x27')];}_0x247b9f[_0xd46e('0x1b')](_0x180851)[_0xd46e('0x28')](_0x1740d1);};}exports[_0xd46e('0x29')]=function(_0x58aeef,_0x465d54){var _0x3a1ced={},_0x2d1afe={},_0xa716ce={'count':0x0,'rows':[]};var _0x106edc=_[_0xd46e('0x2a')](db[_0xd46e('0x2b')][_0xd46e('0x2c')],function(_0x18f060){return{'name':_0x18f060[_0xd46e('0x2d')],'type':_0x18f060[_0xd46e('0x2e')][_0xd46e('0x2f')]};});_0x2d1afe[_0xd46e('0x30')]=_['differenceBy'](_[_0xd46e('0x2a')](_0x106edc,_0xd46e('0x27')),[_0xd46e('0x31')]);_0x2d1afe[_0xd46e('0x32')]=_['keys'](_0x58aeef[_0xd46e('0x32')]);_0x2d1afe[_0xd46e('0x33')]=_['intersection'](_0x2d1afe[_0xd46e('0x30')],_0x2d1afe[_0xd46e('0x32')]);_0x3a1ced['attributes']=_[_0xd46e('0x34')](_0x2d1afe[_0xd46e('0x30')],qs[_0xd46e('0x35')](_0x58aeef['query']['fields']));_0x3a1ced[_0xd46e('0x36')]=_0x3a1ced[_0xd46e('0x36')][_0xd46e('0x37')]?_0x3a1ced[_0xd46e('0x36')]:_0x2d1afe[_0xd46e('0x30')];if(!_0x58aeef[_0xd46e('0x32')][_0xd46e('0x38')](_0xd46e('0x39'))){_0x3a1ced['limit']=qs[_0xd46e('0x1d')](_0x58aeef[_0xd46e('0x32')][_0xd46e('0x1d')]);_0x3a1ced[_0xd46e('0x1c')]=qs[_0xd46e('0x1c')](_0x58aeef[_0xd46e('0x32')][_0xd46e('0x1c')]);}_0x3a1ced['order']=qs[_0xd46e('0x3a')](_0x58aeef[_0xd46e('0x32')]['sort']);_0x3a1ced[_0xd46e('0x3b')]=qs[_0xd46e('0x33')](_[_0xd46e('0x3c')](_0x58aeef[_0xd46e('0x32')],_0x2d1afe['filters']),_0x106edc);if(_0x58aeef[_0xd46e('0x32')][_0xd46e('0x3d')]){_0x3a1ced[_0xd46e('0x3b')]=_[_0xd46e('0x3e')](_0x3a1ced[_0xd46e('0x3b')],{'$or':_[_0xd46e('0x2a')](_0x106edc,function(_0x220c57){if(_0x220c57[_0xd46e('0x2e')]!=='VIRTUAL'){var _0x232e6f={};_0x232e6f[_0x220c57[_0xd46e('0x27')]]={'$like':'%'+_0x58aeef[_0xd46e('0x32')][_0xd46e('0x3d')]+'%'};return _0x232e6f;}})});}_0x3a1ced=_[_0xd46e('0x3e')]({},_0x3a1ced,_0x58aeef['options']);var _0x964c66={'where':_0x3a1ced['where']};return db['ScreenRecording']['count'](_0x964c66)['then'](function(_0x17c3d9){_0xa716ce['count']=_0x17c3d9;if(_0x58aeef[_0xd46e('0x32')][_0xd46e('0x3f')]){_0x3a1ced['include']=[{'all':!![]}];}return db[_0xd46e('0x2b')][_0xd46e('0x40')](_0x3a1ced);})[_0xd46e('0x25')](function(_0x31ba12){_0xa716ce[_0xd46e('0x41')]=_0x31ba12;return _0xa716ce;})[_0xd46e('0x25')](respondWithFilteredResult(_0x465d54,_0x3a1ced))[_0xd46e('0x42')](handleError(_0x465d54,null));};exports[_0xd46e('0x43')]=function(_0x3a98e4,_0xec367d){var _0x259e2={'raw':![],'where':{'id':_0x3a98e4['params']['id']}},_0x5ea048={};_0x5ea048['model']=_[_0xd46e('0x44')](db['ScreenRecording'][_0xd46e('0x2c')]);_0x5ea048[_0xd46e('0x32')]=_[_0xd46e('0x44')](_0x3a98e4[_0xd46e('0x32')]);_0x5ea048[_0xd46e('0x33')]=_[_0xd46e('0x34')](_0x5ea048[_0xd46e('0x30')],_0x5ea048[_0xd46e('0x32')]);_0x259e2['attributes']=_[_0xd46e('0x34')](_0x5ea048['model'],qs[_0xd46e('0x35')](_0x3a98e4[_0xd46e('0x32')][_0xd46e('0x35')]));_0x259e2[_0xd46e('0x36')]=_0x259e2[_0xd46e('0x36')]['length']?_0x259e2[_0xd46e('0x36')]:_0x5ea048[_0xd46e('0x30')];if(_0x3a98e4[_0xd46e('0x32')][_0xd46e('0x3f')]){_0x259e2[_0xd46e('0x45')]=[{'all':!![]}];}_0x259e2=_['merge']({},_0x259e2,_0x3a98e4[_0xd46e('0x46')]);return db[_0xd46e('0x2b')][_0xd46e('0x47')](_0x259e2)[_0xd46e('0x25')](handleEntityNotFound(_0xec367d,null))[_0xd46e('0x25')](respondWithResult(_0xec367d,null))['catch'](handleError(_0xec367d,null));};exports[_0xd46e('0x48')]=function(_0x3ea9e6,_0x45baf1){return db[_0xd46e('0x2b')][_0xd46e('0x48')](_0x3ea9e6[_0xd46e('0x49')],{})[_0xd46e('0x25')](respondWithResult(_0x45baf1,0xc9))[_0xd46e('0x42')](handleError(_0x45baf1,null));};exports['update']=function(_0xf9dab,_0x71a8dc){if(_0xf9dab[_0xd46e('0x49')]['id']){delete _0xf9dab[_0xd46e('0x49')]['id'];}delete _0xf9dab[_0xd46e('0x49')]['duration'];delete _0xf9dab['body'][_0xd46e('0x4a')];delete _0xf9dab[_0xd46e('0x49')][_0xd46e('0x4b')];delete _0xf9dab['body']['value'];return db[_0xd46e('0x2b')][_0xd46e('0x47')]({'where':{'id':_0xf9dab['params']['id']}})[_0xd46e('0x25')](handleEntityNotFound(_0x71a8dc,null))[_0xd46e('0x25')](saveUpdates(_0xf9dab[_0xd46e('0x49')],null))[_0xd46e('0x25')](respondWithResult(_0x71a8dc,null))[_0xd46e('0x42')](handleError(_0x71a8dc,null));};exports[_0xd46e('0x4c')]=function(_0x80ed51,_0x16ca0e){return db['ScreenRecording'][_0xd46e('0x4c')]()[_0xd46e('0x25')](respondWithResult(_0x16ca0e,null))[_0xd46e('0x42')](handleError(_0x16ca0e,null));};exports[_0xd46e('0x4d')]=function(_0x4ec295,_0x56dd9a,_0xced102){var _0x5a4a44=require(_0xd46e('0x4e'));var _0x2af20b=![];var _0x393cb9={};if(_0x4ec295[_0xd46e('0x32')][_0xd46e('0x2e')]&&_0x4ec295[_0xd46e('0x32')]['type']===_0xd46e('0x4f')){_0x393cb9[_0xd46e('0x4f')]=_0x4ec295[_0xd46e('0x50')]['id'];}else{_0x393cb9['id']=_0x4ec295['params']['id'];}return db[_0xd46e('0x2b')][_0xd46e('0x47')]({'where':_0x393cb9,'attributes':['id',_0xd46e('0x51')],'raw':!![]})[_0xd46e('0x25')](handleEntityNotFound(_0x56dd9a,null))[_0xd46e('0x25')](function(_0x2cc676){if(_0x2cc676){var _0x2760ef=path[_0xd46e('0x52')](config[_0xd46e('0x53')],_0xd46e('0x54'),_0x2cc676[_0xd46e('0x51')]);var _0x411b19=util[_0xd46e('0x31')](_0xd46e('0x55'),_0x2760ef);if(fs['existsSync'](_0x411b19)){_0x2af20b=!![];return _0x5a4a44[_0xd46e('0x56')](_0x411b19,_0x2760ef,config[_0xd46e('0x57')][_0xd46e('0x58')])[_0xd46e('0x25')](function(){return _0x2cc676;});}return _0x2cc676;}})['then'](function(_0x636f15){if(_0x636f15){var _0x36e18a=path[_0xd46e('0x52')](config[_0xd46e('0x53')],'server/files/screen_recordings',_0x636f15[_0xd46e('0x51')]);if(!fs[_0xd46e('0x59')](_0x36e18a)){throw new db['Sequelize']['ValidationError'](_0xd46e('0x5a'));}if(_0x636f15[_0xd46e('0x5b')]){return _0x56dd9a[_0xd46e('0x4d')](_0x36e18a,_0x636f15['filename']+path['extname'](_0x36e18a),function(){if(_0x2af20b){fs[_0xd46e('0x5c')](_0x36e18a);}});}else{return _0x56dd9a[_0xd46e('0x4d')](_0x36e18a,function(_0x1f310d){if(_0x2af20b){fs[_0xd46e('0x5c')](_0x36e18a);}});}}})[_0xd46e('0x42')](function(_0x2f9fcb){if(_0x2f9fcb[_0xd46e('0x5d')]===_0xd46e('0x5a')){_0x56dd9a[_0xd46e('0x1b')](0x194)[_0xd46e('0x28')](_0xd46e('0x5e'));}else{return handleError(_0x56dd9a,null);}});};exports[_0xd46e('0x5f')]=function(_0x272514,_0x329204){return db[_0xd46e('0x2b')][_0xd46e('0x47')]({'where':{'id':_0x272514['params']['id']}})[_0xd46e('0x25')](function(_0x1a3771){if(_[_0xd46e('0x60')](_0x1a3771)){throw new ReferenceError('Entity\x20not\x20found');}return _0x1a3771;})[_0xd46e('0x25')](function(_0x313c7e){var _0x4dec29=path[_0xd46e('0x52')](config[_0xd46e('0x53')],_0xd46e('0x54'),_0x313c7e['value']);logger[_0xd46e('0x61')](_0xd46e('0x62'),_0x4dec29);if(!_[_0xd46e('0x60')](_0x313c7e['value'])&&fs[_0xd46e('0x59')](_0x4dec29)){logger['info'](_0xd46e('0x63')+_0x4dec29+_0xd46e('0x64'));fs[_0xd46e('0x65')](_0x4dec29);}_0x4dec29=_0x4dec29+'.cypher';if(!_[_0xd46e('0x60')](_0x313c7e[_0xd46e('0x51')])&&fs[_0xd46e('0x59')](_0x4dec29)){logger[_0xd46e('0x61')](_0xd46e('0x63')+_0x4dec29+_0xd46e('0x64'));fs[_0xd46e('0x65')](_0x4dec29);}return _0x313c7e;})[_0xd46e('0x25')](function(_0x300ee9){if(!_0x300ee9)throw new InternalError();return _0x300ee9[_0xd46e('0x5f')]();})[_0xd46e('0x25')](function(){_0x329204[_0xd46e('0x1b')](0xcc)[_0xd46e('0x66')]();})[_0xd46e('0x42')](handleError(_0x329204,null));}; \ No newline at end of file +var _0x4c4e=['findAll','rows','catch','params','keys','find','create','body','duration','createdAt','closedAt','describe','download','../../components/encryptor','uniqueid','value','join','root','server/files/screen_recordings','%s.cypher','existsSync','secrets','ValidationError','ScreenRecording\x20not\x20found','filename','extname','unlink','message','send','Not\x20found','isNil','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','destroy','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','sendStatus','name','index','map','ScreenRecording','rawAttributes','type','key','model','differenceBy','format','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','options','includeAll','include'];(function(_0x16dbfd,_0x2f9431){var _0x382254=function(_0x19dade){while(--_0x19dade){_0x16dbfd['push'](_0x16dbfd['shift']());}};_0x382254(++_0x2f9431);}(_0x4c4e,0x152));var _0xe4c4=function(_0x367fa7,_0x2f52c8){_0x367fa7=_0x367fa7-0x0;var _0x387ccb=_0x4c4e[_0x367fa7];return _0x387ccb;};'use strict';var emlformat=require(_0xe4c4('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe4c4('0x1'));var jsonpatch=require(_0xe4c4('0x2'));var rp=require(_0xe4c4('0x3'));var moment=require('moment');var BPromise=require(_0xe4c4('0x4'));var Mustache=require(_0xe4c4('0x5'));var util=require(_0xe4c4('0x6'));var path=require('path');var sox=require(_0xe4c4('0x7'));var csv=require('to-csv');var ejs=require(_0xe4c4('0x8'));var fs=require('fs');var fs_extra=require(_0xe4c4('0x9'));var _=require(_0xe4c4('0xa'));var squel=require(_0xe4c4('0xb'));var crypto=require(_0xe4c4('0xc'));var jsforce=require(_0xe4c4('0xd'));var deskjs=require(_0xe4c4('0xe'));var toCsv=require(_0xe4c4('0xf'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xe4c4('0x10'));var authService=require(_0xe4c4('0x11'));var qs=require(_0xe4c4('0x12'));var as=require(_0xe4c4('0x13'));var hardwareService=require(_0xe4c4('0x14'));var logger=require(_0xe4c4('0x15'))('api');var utils=require(_0xe4c4('0x16'));var config=require(_0xe4c4('0x17'));var licenseUtil=require(_0xe4c4('0x18'));var db=require(_0xe4c4('0x19'))['db'];function respondWithStatusCode(_0x50bfab,_0x262083){_0x262083=_0x262083||0xcc;return function(_0x115802){if(_0x115802){return _0x50bfab['sendStatus'](_0x262083);}return _0x50bfab[_0xe4c4('0x1a')](_0x262083)[_0xe4c4('0x1b')]();};}function respondWithResult(_0x5aa89b,_0x42ce9e){_0x42ce9e=_0x42ce9e||0xc8;return function(_0x29766a){if(_0x29766a){return _0x5aa89b['status'](_0x42ce9e)[_0xe4c4('0x1c')](_0x29766a);}};}function respondWithFilteredResult(_0x465c9b,_0x26ea05){return function(_0x40a36e){if(_0x40a36e){var _0x19e59b=typeof _0x26ea05[_0xe4c4('0x1d')]===_0xe4c4('0x1e')&&typeof _0x26ea05[_0xe4c4('0x1f')]===_0xe4c4('0x1e');var _0x36b10c=_0x40a36e[_0xe4c4('0x20')];var _0x42242c=_0x19e59b?0x0:_0x26ea05[_0xe4c4('0x1d')];var _0x43a9ce=_0x19e59b?_0x40a36e[_0xe4c4('0x20')]:_0x26ea05['offset']+_0x26ea05[_0xe4c4('0x1f')];var _0x24f946;if(_0x43a9ce>=_0x36b10c){_0x43a9ce=_0x36b10c;_0x24f946=0xc8;}else{_0x24f946=0xce;}_0x465c9b[_0xe4c4('0x1a')](_0x24f946);return _0x465c9b[_0xe4c4('0x21')]('Content-Range',_0x42242c+'-'+_0x43a9ce+'/'+_0x36b10c)[_0xe4c4('0x1c')](_0x40a36e);}return null;};}function patchUpdates(_0x1cad5d){return function(_0x1727eb){try{jsonpatch[_0xe4c4('0x22')](_0x1727eb,_0x1cad5d,!![]);}catch(_0x2c5aea){return BPromise[_0xe4c4('0x23')](_0x2c5aea);}return _0x1727eb[_0xe4c4('0x24')]();};}function saveUpdates(_0x393c96,_0x21bbb1){return function(_0x1a7690){if(_0x1a7690){return _0x1a7690[_0xe4c4('0x25')](_0x393c96)[_0xe4c4('0x26')](function(_0x138ead){return _0x138ead;});}return null;};}function removeEntity(_0x1db719,_0x15873e){return function(_0x59498e){if(_0x59498e){return _0x59498e['destroy']()[_0xe4c4('0x26')](function(){_0x1db719['status'](0xcc)[_0xe4c4('0x1b')]();});}};}function handleEntityNotFound(_0x5374fd,_0x3adfcb){return function(_0x5efc4c){if(!_0x5efc4c){_0x5374fd[_0xe4c4('0x27')](0x194);}return _0x5efc4c;};}function handleError(_0x583393,_0xba53ef){_0xba53ef=_0xba53ef||0x1f4;return function(_0x4a0199){logger['error'](_0x4a0199['stack']);if(_0x4a0199['name']){delete _0x4a0199[_0xe4c4('0x28')];}_0x583393['status'](_0xba53ef)['send'](_0x4a0199);};}exports[_0xe4c4('0x29')]=function(_0x11deab,_0x4bb911){var _0x57ba43={},_0x7428ad={},_0x33de43={'count':0x0,'rows':[]};var _0x4aa6c1=_[_0xe4c4('0x2a')](db[_0xe4c4('0x2b')][_0xe4c4('0x2c')],function(_0x48060e){return{'name':_0x48060e['fieldName'],'type':_0x48060e[_0xe4c4('0x2d')][_0xe4c4('0x2e')]};});_0x7428ad[_0xe4c4('0x2f')]=_[_0xe4c4('0x30')](_['map'](_0x4aa6c1,'name'),[_0xe4c4('0x31')]);_0x7428ad[_0xe4c4('0x32')]=_['keys'](_0x11deab[_0xe4c4('0x32')]);_0x7428ad[_0xe4c4('0x33')]=_[_0xe4c4('0x34')](_0x7428ad['model'],_0x7428ad[_0xe4c4('0x32')]);_0x57ba43['attributes']=_[_0xe4c4('0x34')](_0x7428ad[_0xe4c4('0x2f')],qs[_0xe4c4('0x35')](_0x11deab[_0xe4c4('0x32')][_0xe4c4('0x35')]));_0x57ba43[_0xe4c4('0x36')]=_0x57ba43[_0xe4c4('0x36')][_0xe4c4('0x37')]?_0x57ba43[_0xe4c4('0x36')]:_0x7428ad[_0xe4c4('0x2f')];if(!_0x11deab[_0xe4c4('0x32')][_0xe4c4('0x38')]('nolimit')){_0x57ba43[_0xe4c4('0x1f')]=qs[_0xe4c4('0x1f')](_0x11deab[_0xe4c4('0x32')]['limit']);_0x57ba43[_0xe4c4('0x1d')]=qs[_0xe4c4('0x1d')](_0x11deab[_0xe4c4('0x32')]['offset']);}_0x57ba43[_0xe4c4('0x39')]=qs[_0xe4c4('0x3a')](_0x11deab[_0xe4c4('0x32')][_0xe4c4('0x3a')]);_0x57ba43[_0xe4c4('0x3b')]=qs[_0xe4c4('0x33')](_[_0xe4c4('0x3c')](_0x11deab[_0xe4c4('0x32')],_0x7428ad[_0xe4c4('0x33')]),_0x4aa6c1);if(_0x11deab[_0xe4c4('0x32')]['filter']){_0x57ba43[_0xe4c4('0x3b')]=_[_0xe4c4('0x3d')](_0x57ba43[_0xe4c4('0x3b')],{'$or':_[_0xe4c4('0x2a')](_0x4aa6c1,function(_0x4c5551){if(_0x4c5551[_0xe4c4('0x2d')]!==_0xe4c4('0x3e')){var _0x4e6bd9={};_0x4e6bd9[_0x4c5551[_0xe4c4('0x28')]]={'$like':'%'+_0x11deab[_0xe4c4('0x32')]['filter']+'%'};return _0x4e6bd9;}})});}_0x57ba43=_[_0xe4c4('0x3d')]({},_0x57ba43,_0x11deab[_0xe4c4('0x3f')]);var _0x127bcd={'where':_0x57ba43[_0xe4c4('0x3b')]};return db[_0xe4c4('0x2b')][_0xe4c4('0x20')](_0x127bcd)[_0xe4c4('0x26')](function(_0x43201e){_0x33de43[_0xe4c4('0x20')]=_0x43201e;if(_0x11deab[_0xe4c4('0x32')][_0xe4c4('0x40')]){_0x57ba43[_0xe4c4('0x41')]=[{'all':!![]}];}return db['ScreenRecording'][_0xe4c4('0x42')](_0x57ba43);})[_0xe4c4('0x26')](function(_0x2b306d){_0x33de43[_0xe4c4('0x43')]=_0x2b306d;return _0x33de43;})[_0xe4c4('0x26')](respondWithFilteredResult(_0x4bb911,_0x57ba43))[_0xe4c4('0x44')](handleError(_0x4bb911,null));};exports['show']=function(_0x312a49,_0x526bef){var _0xca07dc={'raw':![],'where':{'id':_0x312a49[_0xe4c4('0x45')]['id']}},_0x3c067a={};_0x3c067a[_0xe4c4('0x2f')]=_[_0xe4c4('0x46')](db['ScreenRecording']['rawAttributes']);_0x3c067a[_0xe4c4('0x32')]=_[_0xe4c4('0x46')](_0x312a49[_0xe4c4('0x32')]);_0x3c067a['filters']=_[_0xe4c4('0x34')](_0x3c067a[_0xe4c4('0x2f')],_0x3c067a[_0xe4c4('0x32')]);_0xca07dc[_0xe4c4('0x36')]=_['intersection'](_0x3c067a[_0xe4c4('0x2f')],qs[_0xe4c4('0x35')](_0x312a49[_0xe4c4('0x32')][_0xe4c4('0x35')]));_0xca07dc[_0xe4c4('0x36')]=_0xca07dc[_0xe4c4('0x36')][_0xe4c4('0x37')]?_0xca07dc[_0xe4c4('0x36')]:_0x3c067a[_0xe4c4('0x2f')];if(_0x312a49['query'][_0xe4c4('0x40')]){_0xca07dc['include']=[{'all':!![]}];}_0xca07dc=_[_0xe4c4('0x3d')]({},_0xca07dc,_0x312a49[_0xe4c4('0x3f')]);return db[_0xe4c4('0x2b')][_0xe4c4('0x47')](_0xca07dc)[_0xe4c4('0x26')](handleEntityNotFound(_0x526bef,null))[_0xe4c4('0x26')](respondWithResult(_0x526bef,null))[_0xe4c4('0x44')](handleError(_0x526bef,null));};exports[_0xe4c4('0x48')]=function(_0x36f8ad,_0x18fb82){return db[_0xe4c4('0x2b')][_0xe4c4('0x48')](_0x36f8ad[_0xe4c4('0x49')],{})[_0xe4c4('0x26')](respondWithResult(_0x18fb82,0xc9))['catch'](handleError(_0x18fb82,null));};exports['update']=function(_0xe0e351,_0x198961){if(_0xe0e351['body']['id']){delete _0xe0e351[_0xe4c4('0x49')]['id'];}delete _0xe0e351[_0xe4c4('0x49')][_0xe4c4('0x4a')];delete _0xe0e351[_0xe4c4('0x49')][_0xe4c4('0x4b')];delete _0xe0e351['body'][_0xe4c4('0x4c')];delete _0xe0e351[_0xe4c4('0x49')]['value'];return db[_0xe4c4('0x2b')][_0xe4c4('0x47')]({'where':{'id':_0xe0e351['params']['id']}})[_0xe4c4('0x26')](handleEntityNotFound(_0x198961,null))['then'](saveUpdates(_0xe0e351[_0xe4c4('0x49')],null))[_0xe4c4('0x26')](respondWithResult(_0x198961,null))[_0xe4c4('0x44')](handleError(_0x198961,null));};exports[_0xe4c4('0x4d')]=function(_0x12eaed,_0x525534){return db[_0xe4c4('0x2b')][_0xe4c4('0x4d')]()[_0xe4c4('0x26')](respondWithResult(_0x525534,null))[_0xe4c4('0x44')](handleError(_0x525534,null));};exports[_0xe4c4('0x4e')]=function(_0x32a50e,_0x3ddcbe,_0x3aa205){var _0x1a96ba=require(_0xe4c4('0x4f'));var _0x1fe354=![];var _0x1940e3={};if(_0x32a50e[_0xe4c4('0x32')][_0xe4c4('0x2d')]&&_0x32a50e[_0xe4c4('0x32')][_0xe4c4('0x2d')]==='uniqueid'){_0x1940e3[_0xe4c4('0x50')]=_0x32a50e[_0xe4c4('0x45')]['id'];}else{_0x1940e3['id']=_0x32a50e[_0xe4c4('0x45')]['id'];}return db['ScreenRecording'][_0xe4c4('0x47')]({'where':_0x1940e3,'attributes':['id',_0xe4c4('0x51')],'raw':!![]})[_0xe4c4('0x26')](handleEntityNotFound(_0x3ddcbe,null))['then'](function(_0x45f959){if(_0x45f959){var _0x485c50=path[_0xe4c4('0x52')](config[_0xe4c4('0x53')],_0xe4c4('0x54'),_0x45f959['value']);var _0x479361=util[_0xe4c4('0x31')](_0xe4c4('0x55'),_0x485c50);if(fs[_0xe4c4('0x56')](_0x479361)){_0x1fe354=!![];return _0x1a96ba['decryptFile'](_0x479361,_0x485c50,config[_0xe4c4('0x57')]['recording'])['then'](function(){return _0x45f959;});}return _0x45f959;}})['then'](function(_0x4e08ec){if(_0x4e08ec){var _0x1ca931=path[_0xe4c4('0x52')](config[_0xe4c4('0x53')],_0xe4c4('0x54'),_0x4e08ec[_0xe4c4('0x51')]);if(!fs[_0xe4c4('0x56')](_0x1ca931)){throw new db['Sequelize'][(_0xe4c4('0x58'))](_0xe4c4('0x59'));}if(_0x4e08ec[_0xe4c4('0x5a')]){return _0x3ddcbe[_0xe4c4('0x4e')](_0x1ca931,_0x4e08ec[_0xe4c4('0x5a')]+path[_0xe4c4('0x5b')](_0x1ca931),function(){if(_0x1fe354){fs['unlink'](_0x1ca931);}});}else{return _0x3ddcbe['download'](_0x1ca931,function(_0x27599b){if(_0x1fe354){fs[_0xe4c4('0x5c')](_0x1ca931);}});}}})[_0xe4c4('0x44')](function(_0x3c8e44){if(_0x3c8e44[_0xe4c4('0x5d')]===_0xe4c4('0x59')){_0x3ddcbe[_0xe4c4('0x1a')](0x194)[_0xe4c4('0x5e')](_0xe4c4('0x5f'));}else{return handleError(_0x3ddcbe,null);}});};exports['destroy']=function(_0x59f033,_0x5a4138){return db['ScreenRecording'][_0xe4c4('0x47')]({'where':{'id':_0x59f033[_0xe4c4('0x45')]['id']}})[_0xe4c4('0x26')](function(_0x58f2dd){if(_[_0xe4c4('0x60')](_0x58f2dd)){throw new ReferenceError('Entity\x20not\x20found');}return _0x58f2dd;})[_0xe4c4('0x26')](function(_0x56ead3){var _0x5d6c0a=path[_0xe4c4('0x52')](config[_0xe4c4('0x53')],_0xe4c4('0x54'),_0x56ead3['value']);logger['info']('cancellazione\x20fisica\x20documento\x20%s',_0x5d6c0a);if(!_[_0xe4c4('0x60')](_0x56ead3[_0xe4c4('0x51')])&&fs['existsSync'](_0x5d6c0a)){logger[_0xe4c4('0x61')](_0xe4c4('0x62')+_0x5d6c0a+_0xe4c4('0x63'));fs['unlinkSync'](_0x5d6c0a);}_0x5d6c0a=_0x5d6c0a+'.cypher';if(!_[_0xe4c4('0x60')](_0x56ead3[_0xe4c4('0x51')])&&fs[_0xe4c4('0x56')](_0x5d6c0a)){logger[_0xe4c4('0x61')](_0xe4c4('0x62')+_0x5d6c0a+_0xe4c4('0x63'));fs['unlinkSync'](_0x5d6c0a);}return _0x56ead3;})[_0xe4c4('0x26')](function(_0x1bddd5){if(!_0x1bddd5)throw new InternalError();return _0x1bddd5[_0xe4c4('0x64')]();})['then'](function(){_0x5a4138[_0xe4c4('0x1a')](0xcc)[_0xe4c4('0x1b')]();})[_0xe4c4('0x44')](handleError(_0x5a4138,null));}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.model.js b/server/api/screenRecording/screenRecording.model.js index 94c81fb..63bf66c 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 _0xca25=['../../config/logger','api','bluebird','path','./screenRecording.attributes','exports','define','ScreenRecording','screen_recordings','interactionid','lodash','util'];(function(_0x574c7d,_0x4d3487){var _0x1c5115=function(_0xc32010){while(--_0xc32010){_0x574c7d['push'](_0x574c7d['shift']());}};_0x1c5115(++_0x4d3487);}(_0xca25,0xca));var _0x5ca2=function(_0x2af053,_0x4f6d28){_0x2af053=_0x2af053-0x0;var _0x4b4001=_0xca25[_0x2af053];return _0x4b4001;};'use strict';var _=require(_0x5ca2('0x0'));var util=require(_0x5ca2('0x1'));var logger=require(_0x5ca2('0x2'))(_0x5ca2('0x3'));var moment=require('moment');var BPromise=require(_0x5ca2('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5ca2('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x5ca2('0x6'));module[_0x5ca2('0x7')]=function(_0x2ba9ac,_0x1931d2){return _0x2ba9ac[_0x5ca2('0x8')](_0x5ca2('0x9'),attributes,{'tableName':_0x5ca2('0xa'),'paranoid':![],'indexes':[{'name':'interactionid','fields':[_0x5ca2('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb8d1=['rimraf','./screenRecording.attributes','exports','screen_recordings','interactionid','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x1ce262,_0x2d930c){var _0x1a9c95=function(_0x18cea0){while(--_0x18cea0){_0x1ce262['push'](_0x1ce262['shift']());}};_0x1a9c95(++_0x2d930c);}(_0xb8d1,0x1d9));var _0x1b8d=function(_0x38c632,_0x14e8e6){_0x38c632=_0x38c632-0x0;var _0x12737e=_0xb8d1[_0x38c632];return _0x12737e;};'use strict';var _=require(_0x1b8d('0x0'));var util=require(_0x1b8d('0x1'));var logger=require(_0x1b8d('0x2'))(_0x1b8d('0x3'));var moment=require(_0x1b8d('0x4'));var BPromise=require(_0x1b8d('0x5'));var rp=require(_0x1b8d('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1b8d('0x7'));var config=require('../../config/environment');var attributes=require(_0x1b8d('0x8'));module[_0x1b8d('0x9')]=function(_0x215c21,_0x1c77a8){return _0x215c21['define']('ScreenRecording',attributes,{'tableName':_0x1b8d('0xa'),'paranoid':![],'indexes':[{'name':'interactionid','fields':[_0x1b8d('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.rpc.js b/server/api/screenRecording/screenRecording.rpc.js index 22500f3..143d625 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 _0x7881=['then','request\x20sent','debug','ScreenRecording,\x20%s,\x20%s,\x20%s','stringify','error','ScreenRecording,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','client','request'];(function(_0x281a28,_0x34542c){var _0x54f40c=function(_0x28bde9){while(--_0x28bde9){_0x281a28['push'](_0x281a28['shift']());}};_0x54f40c(++_0x34542c);}(_0x7881,0x136));var _0x1788=function(_0xa95ea6,_0x18d8fe){_0xa95ea6=_0xa95ea6-0x0;var _0x423a08=_0x7881[_0xa95ea6];return _0x423a08;};'use strict';var _=require('lodash');var util=require(_0x1788('0x0'));var moment=require(_0x1788('0x1'));var BPromise=require(_0x1788('0x2'));var rs=require(_0x1788('0x3'));var fs=require('fs');var Redis=require(_0x1788('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x1788('0x5'));var logger=require(_0x1788('0x6'))(_0x1788('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x1788('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x47252d,_0x2e10be,_0x237f61){return new BPromise(function(_0x452789,_0x53472e){return client[_0x1788('0x9')](_0x47252d,_0x237f61)[_0x1788('0xa')](function(_0x502591){logger['info']('ScreenRecording,\x20%s,\x20%s',_0x2e10be,_0x1788('0xb'));logger[_0x1788('0xc')](_0x1788('0xd'),_0x2e10be,_0x1788('0xb'),JSON[_0x1788('0xe')](_0x502591));if(_0x502591['error']){if(_0x502591[_0x1788('0xf')]['code']===0x1f4){logger[_0x1788('0xf')](_0x1788('0x10'),_0x2e10be,_0x502591[_0x1788('0xf')]['message']);return _0x53472e(_0x502591[_0x1788('0xf')][_0x1788('0x11')]);}logger['error']('ScreenRecording,\x20%s,\x20%s',_0x2e10be,_0x502591['error'][_0x1788('0x11')]);return _0x452789(_0x502591[_0x1788('0xf')][_0x1788('0x11')]);}else{logger['info'](_0x1788('0x10'),_0x2e10be,_0x1788('0xb'));_0x452789(_0x502591[_0x1788('0x12')][_0x1788('0x11')]);}})[_0x1788('0x13')](function(_0x29be56){logger[_0x1788('0xf')](_0x1788('0x10'),_0x2e10be,_0x29be56);_0x53472e(_0x29be56);});});} \ No newline at end of file +var _0x3cff=['ScreenRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','util','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','ScreenRecording,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x2aae4f,_0x1c80ea){var _0x5adc6f=function(_0x2287a1){while(--_0x2287a1){_0x2aae4f['push'](_0x2aae4f['shift']());}};_0x5adc6f(++_0x1c80ea);}(_0x3cff,0xb0));var _0xf3cf=function(_0x2a4095,_0x13f4f0){_0x2a4095=_0x2a4095-0x0;var _0x52eeab=_0x3cff[_0x2a4095];return _0x52eeab;};'use strict';var _=require(_0xf3cf('0x0'));var util=require(_0xf3cf('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf3cf('0x2'));var db=require(_0xf3cf('0x3'))['db'];var utils=require(_0xf3cf('0x4'));var logger=require('../../config/logger')(_0xf3cf('0x5'));var config=require(_0xf3cf('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xf3cf('0x7')][_0xf3cf('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x57d8f8,_0x48f128,_0x4e58c1){return new BPromise(function(_0x4a5a5a,_0x393400){return client[_0xf3cf('0x9')](_0x57d8f8,_0x4e58c1)[_0xf3cf('0xa')](function(_0x2dd0e2){logger['info'](_0xf3cf('0xb'),_0x48f128,_0xf3cf('0xc'));logger[_0xf3cf('0xd')](_0xf3cf('0xe'),_0x48f128,_0xf3cf('0xc'),JSON[_0xf3cf('0xf')](_0x2dd0e2));if(_0x2dd0e2[_0xf3cf('0x10')]){if(_0x2dd0e2[_0xf3cf('0x10')][_0xf3cf('0x11')]===0x1f4){logger[_0xf3cf('0x10')](_0xf3cf('0xb'),_0x48f128,_0x2dd0e2['error'][_0xf3cf('0x12')]);return _0x393400(_0x2dd0e2[_0xf3cf('0x10')][_0xf3cf('0x12')]);}logger['error']('ScreenRecording,\x20%s,\x20%s',_0x48f128,_0x2dd0e2[_0xf3cf('0x10')][_0xf3cf('0x12')]);return _0x4a5a5a(_0x2dd0e2[_0xf3cf('0x10')]['message']);}else{logger['info']('ScreenRecording,\x20%s,\x20%s',_0x48f128,_0xf3cf('0xc'));_0x4a5a5a(_0x2dd0e2['result'][_0xf3cf('0x12')]);}})['catch'](function(_0x36bd69){logger[_0xf3cf('0x10')](_0xf3cf('0xb'),_0x48f128,_0x36bd69);_0x393400(_0x36bd69);});});} \ No newline at end of file diff --git a/server/api/setting/index.js b/server/api/setting/index.js index 524f601..19c7c17 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 _0xc87a=['isAuthenticated','getDate','show','/:id/logo','getLogo','/:id/logo_login','getLogoLogin','/:id/gdpr','gdpr','getPreferred','/:id/favicon','getFavicon','diskStorage','server/files/images/logos/','format','%s%s','logo','extname','originalname','single','file','addLogo','root','post','addLogoLogin','/:id/preferred','addPreferred','join','favicon','addFavicon','/:id','update','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./setting.controller','get'];(function(_0x5f3905,_0x43a651){var _0x2923b1=function(_0x3c72d8){while(--_0x3c72d8){_0x5f3905['push'](_0x5f3905['shift']());}};_0x2923b1(++_0x43a651);}(_0xc87a,0xcd));var _0xac87=function(_0x28bf52,_0x565298){_0x28bf52=_0x28bf52-0x0;var _0x869587=_0xc87a[_0x28bf52];return _0x869587;};'use strict';var multer=require(_0xac87('0x0'));var util=require(_0xac87('0x1'));var path=require(_0xac87('0x2'));var timeout=require(_0xac87('0x3'));var express=require(_0xac87('0x4'));var router=express[_0xac87('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xac87('0x6'));var config=require(_0xac87('0x7'));var controller=require(_0xac87('0x8'));router[_0xac87('0x9')]('/',auth[_0xac87('0xa')](),controller['index']);router['get']('/now',controller[_0xac87('0xb')]);router['get']('/:id',controller[_0xac87('0xc')]);router['get'](_0xac87('0xd'),controller[_0xac87('0xe')]);router[_0xac87('0x9')](_0xac87('0xf'),controller[_0xac87('0x10')]);router[_0xac87('0x9')](_0xac87('0x11'),controller[_0xac87('0x12')]);router['get']('/:id/preferred',controller[_0xac87('0x13')]);router[_0xac87('0x9')](_0xac87('0x14'),controller[_0xac87('0x15')]);var upload=multer({'storage':multer[_0xac87('0x16')]({'destination':function(_0x1565e1,_0x2fada3,_0x5c8320){_0x5c8320(null,path['join'](config['root'],_0xac87('0x17')));},'filename':function(_0x153499,_0x4711ae,_0x3f2c1d){_0x3f2c1d(null,util[_0xac87('0x18')](_0xac87('0x19'),_0xac87('0x1a'),path[_0xac87('0x1b')](_0x4711ae[_0xac87('0x1c')])));}})});router['post']('/:id/logo',upload[_0xac87('0x1d')](_0xac87('0x1e')),controller[_0xac87('0x1f')]);var upload=multer({'storage':multer[_0xac87('0x16')]({'destination':function(_0x5c0cde,_0x389cc5,_0x3afaa9){_0x3afaa9(null,path['join'](config[_0xac87('0x20')],_0xac87('0x17')));},'filename':function(_0x501462,_0x15965b,_0x33998d){_0x33998d(null,util[_0xac87('0x18')](_0xac87('0x19'),'logologin',path[_0xac87('0x1b')](_0x15965b[_0xac87('0x1c')])));}})});router[_0xac87('0x21')](_0xac87('0xf'),upload['single'](_0xac87('0x1e')),controller[_0xac87('0x22')]);var upload=multer({'storage':multer[_0xac87('0x16')]({'destination':function(_0x5d0001,_0x4c7ea5,_0x56aed4){_0x56aed4(null,path['join'](config['root'],'server/files/images/logos/'));},'filename':function(_0x50e740,_0x2bf48c,_0x2e3f27){_0x2e3f27(null,util[_0xac87('0x18')](_0xac87('0x19'),'preferred',path[_0xac87('0x1b')](_0x2bf48c[_0xac87('0x1c')])));}})});router[_0xac87('0x21')](_0xac87('0x23'),upload[_0xac87('0x1d')]('file'),controller[_0xac87('0x24')]);var upload=multer({'storage':multer[_0xac87('0x16')]({'destination':function(_0x5f5d44,_0x33f7f3,_0x412ddc){_0x412ddc(null,path[_0xac87('0x25')](config[_0xac87('0x20')],_0xac87('0x17')));},'filename':function(_0x38ec65,_0x1806a8,_0x527625){_0x527625(null,util['format'](_0xac87('0x19'),_0xac87('0x26'),path[_0xac87('0x1b')](_0x1806a8[_0xac87('0x1c')])));}})});router[_0xac87('0x21')](_0xac87('0x14'),upload['single'](_0xac87('0x1e')),controller[_0xac87('0x27')]);router['put'](_0xac87('0x28'),auth[_0xac87('0xa')](),controller[_0xac87('0x29')]);module[_0xac87('0x2a')]=router; \ No newline at end of file +var _0x5f3e=['/:id/logo','getLogo','/:id/logo_login','getLogoLogin','/:id/gdpr','/:id/preferred','getPreferred','/:id/favicon','getFavicon','diskStorage','join','root','server/files/images/logos/','format','originalname','post','single','file','addLogo','%s%s','extname','addPreferred','favicon','addFavicon','put','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/now','getDate','/:id'];(function(_0x480bc8,_0x1fac40){var _0x28c245=function(_0x22a049){while(--_0x22a049){_0x480bc8['push'](_0x480bc8['shift']());}};_0x28c245(++_0x1fac40);}(_0x5f3e,0x1aa));var _0xe5f3=function(_0x3cf730,_0x1bc146){_0x3cf730=_0x3cf730-0x0;var _0x2079e9=_0x5f3e[_0x3cf730];return _0x2079e9;};'use strict';var multer=require(_0xe5f3('0x0'));var util=require('util');var path=require(_0xe5f3('0x1'));var timeout=require(_0xe5f3('0x2'));var express=require(_0xe5f3('0x3'));var router=express[_0xe5f3('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xe5f3('0x5'));var interaction=require(_0xe5f3('0x6'));var config=require(_0xe5f3('0x7'));var controller=require('./setting.controller');router[_0xe5f3('0x8')]('/',auth[_0xe5f3('0x9')](),controller[_0xe5f3('0xa')]);router['get'](_0xe5f3('0xb'),controller[_0xe5f3('0xc')]);router['get'](_0xe5f3('0xd'),controller['show']);router[_0xe5f3('0x8')](_0xe5f3('0xe'),controller[_0xe5f3('0xf')]);router[_0xe5f3('0x8')](_0xe5f3('0x10'),controller[_0xe5f3('0x11')]);router['get'](_0xe5f3('0x12'),controller['gdpr']);router[_0xe5f3('0x8')](_0xe5f3('0x13'),controller[_0xe5f3('0x14')]);router[_0xe5f3('0x8')](_0xe5f3('0x15'),controller[_0xe5f3('0x16')]);var upload=multer({'storage':multer[_0xe5f3('0x17')]({'destination':function(_0x41776e,_0x34f285,_0x5e0472){_0x5e0472(null,path[_0xe5f3('0x18')](config[_0xe5f3('0x19')],_0xe5f3('0x1a')));},'filename':function(_0x11d5df,_0x3dbedb,_0x5ec1d0){_0x5ec1d0(null,util[_0xe5f3('0x1b')]('%s%s','logo',path['extname'](_0x3dbedb[_0xe5f3('0x1c')])));}})});router[_0xe5f3('0x1d')](_0xe5f3('0xe'),upload[_0xe5f3('0x1e')](_0xe5f3('0x1f')),controller[_0xe5f3('0x20')]);var upload=multer({'storage':multer[_0xe5f3('0x17')]({'destination':function(_0x49f74d,_0x4ec5b6,_0xbdb5c6){_0xbdb5c6(null,path[_0xe5f3('0x18')](config[_0xe5f3('0x19')],_0xe5f3('0x1a')));},'filename':function(_0x1ceab6,_0x3aa49d,_0x2658f9){_0x2658f9(null,util[_0xe5f3('0x1b')](_0xe5f3('0x21'),'logologin',path[_0xe5f3('0x22')](_0x3aa49d[_0xe5f3('0x1c')])));}})});router[_0xe5f3('0x1d')]('/:id/logo_login',upload[_0xe5f3('0x1e')](_0xe5f3('0x1f')),controller['addLogoLogin']);var upload=multer({'storage':multer[_0xe5f3('0x17')]({'destination':function(_0x4c657a,_0x8af6de,_0x35f38f){_0x35f38f(null,path['join'](config['root'],_0xe5f3('0x1a')));},'filename':function(_0x4c4570,_0x288125,_0x29047c){_0x29047c(null,util[_0xe5f3('0x1b')](_0xe5f3('0x21'),'preferred',path[_0xe5f3('0x22')](_0x288125['originalname'])));}})});router[_0xe5f3('0x1d')]('/:id/preferred',upload[_0xe5f3('0x1e')](_0xe5f3('0x1f')),controller[_0xe5f3('0x23')]);var upload=multer({'storage':multer[_0xe5f3('0x17')]({'destination':function(_0x32b07a,_0x121311,_0x3b4e40){_0x3b4e40(null,path[_0xe5f3('0x18')](config[_0xe5f3('0x19')],_0xe5f3('0x1a')));},'filename':function(_0x496a3e,_0x4cc7a7,_0x5189fe){_0x5189fe(null,util[_0xe5f3('0x1b')](_0xe5f3('0x21'),_0xe5f3('0x24'),path[_0xe5f3('0x22')](_0x4cc7a7[_0xe5f3('0x1c')])));}})});router[_0xe5f3('0x1d')](_0xe5f3('0x15'),upload[_0xe5f3('0x1e')]('file'),controller[_0xe5f3('0x25')]);router[_0xe5f3('0x26')](_0xe5f3('0xd'),auth[_0xe5f3('0x9')](),controller['update']);module[_0xe5f3('0x27')]=router; \ No newline at end of file diff --git a/server/api/setting/setting.attributes.js b/server/api/setting/setting.attributes.js index 01918c7..6c3d24e 100644 --- a/server/api/setting/setting.attributes.js +++ b/server/api/setting/setting.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1261=['exports','INTEGER','min_internal','min_mailbox','STRING','/var/opt/motion2/server/files/sounds/converted','BOOLEAN','alternate','UNSIGNED'];(function(_0x4d4f74,_0x1c6228){var _0x1a234f=function(_0x38bbaf){while(--_0x38bbaf){_0x4d4f74['push'](_0x4d4f74['shift']());}};_0x1a234f(++_0x1c6228);}(_0x1261,0x144));var _0x1126=function(_0x11f598,_0x5a2990){_0x11f598=_0x11f598-0x0;var _0x2a37dc=_0x1261[_0x11f598];return _0x2a37dc;};'use strict';var Sequelize=require('sequelize');module[_0x1126('0x0')]={'min_internal':{'type':Sequelize[_0x1126('0x1')](0xb),'unique':_0x1126('0x2'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0x1126('0x1')](0xb),'unique':_0x1126('0x3'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0x1126('0x1')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x1126('0x4')],'defaultValue':_0x1126('0x5')},'logo':{'type':Sequelize[_0x1126('0x4')]},'defaultLogo':{'type':Sequelize[_0x1126('0x6')],'defaultValue':!![]},'loginLogo':{'type':Sequelize['STRING']},'defaultLoginLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x1126('0x4')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x1126('0x6')],'defaultValue':!![]},'securePassword':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0x1126('0x6')],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0x1126('0x4')]},'turnaddr':{'type':Sequelize[_0x1126('0x4')]},'turnusername':{'type':Sequelize[_0x1126('0x4')]},'turnpassword':{'type':Sequelize[_0x1126('0x4')]},'pageTitle':{'type':Sequelize['STRING']},'defaultPageTitle':{'type':Sequelize[_0x1126('0x6')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x1126('0x6')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x1126('0x1')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x1126('0x4')],'defaultValue':'https://www.xcally.com/bar/phonebar/autoupdater.xml'},'enableEmailPreview':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'split':{'type':Sequelize[_0x1126('0x6')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x1126('0x1')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x1126('0x1')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x1126('0x4')],'defaultValue':_0x1126('0x7')},'chatTimeout':{'type':Sequelize[_0x1126('0x1')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x1126('0x6')],'defaultValue':!![]},'preferred':{'type':Sequelize[_0x1126('0x4')]},'defaultPreferred':{'type':Sequelize[_0x1126('0x6')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x1126('0x6')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize['STRING']},'allowedLoginAttempts':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x1126('0x1')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x1126('0x4')]},'defaultFavicon':{'type':Sequelize[_0x1126('0x6')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize['INTEGER'],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0x1126('0x6')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize[_0x1126('0x1')]},'transcribeRegion':{'type':Sequelize[_0x1126('0x4')]},'sentiment':{'type':Sequelize[_0x1126('0x6')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x1126('0x1')]},'sentimentRegion':{'type':Sequelize[_0x1126('0x4')]},'language':{'type':Sequelize['STRING']},'bucket':{'type':Sequelize['STRING']},'googleSsoEnabled':{'type':Sequelize[_0x1126('0x6')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0x1126('0x6')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize['INTEGER'](0x2)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0x1126('0x1')](0x2)['UNSIGNED'],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0x1126('0x1')](0x2)[_0x1126('0x8')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0x1126('0x1')](0x2)['UNSIGNED'],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0x1126('0x6')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0x1126('0x1')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize[_0x1126('0x1')],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize[_0x1126('0x1')],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0x1126('0x6')],'defaultValue':![]}}; \ No newline at end of file +var _0x2ef3=['min_mailbox','STRING','/var/opt/motion2/server/files/sounds/converted','BOOLEAN','https://www.xcally.com/bar/phonebar/autoupdater.xml','UNSIGNED','sequelize','exports','INTEGER','min_internal'];(function(_0x2dac3c,_0x3a1b8f){var _0x3fbfdb=function(_0x15501b){while(--_0x15501b){_0x2dac3c['push'](_0x2dac3c['shift']());}};_0x3fbfdb(++_0x3a1b8f);}(_0x2ef3,0xba));var _0x32ef=function(_0x2e01c7,_0x3b6a6b){_0x2e01c7=_0x2e01c7-0x0;var _0x55be17=_0x2ef3[_0x2e01c7];return _0x55be17;};'use strict';var Sequelize=require(_0x32ef('0x0'));module[_0x32ef('0x1')]={'min_internal':{'type':Sequelize[_0x32ef('0x2')](0xb),'unique':_0x32ef('0x3'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0x32ef('0x2')](0xb),'unique':_0x32ef('0x4'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x32ef('0x5')],'defaultValue':_0x32ef('0x6')},'logo':{'type':Sequelize['STRING']},'defaultLogo':{'type':Sequelize[_0x32ef('0x7')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x32ef('0x5')]},'defaultLoginLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize['STRING']},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x32ef('0x7')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x32ef('0x7')],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0x32ef('0x7')],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0x32ef('0x5')]},'turnaddr':{'type':Sequelize[_0x32ef('0x5')]},'turnusername':{'type':Sequelize[_0x32ef('0x5')]},'turnpassword':{'type':Sequelize[_0x32ef('0x5')]},'pageTitle':{'type':Sequelize[_0x32ef('0x5')]},'defaultPageTitle':{'type':Sequelize[_0x32ef('0x7')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x32ef('0x7')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x32ef('0x5')],'defaultValue':_0x32ef('0x8')},'enableEmailPreview':{'type':Sequelize[_0x32ef('0x7')],'defaultValue':![]},'split':{'type':Sequelize[_0x32ef('0x7')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x32ef('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x32ef('0x5')],'defaultValue':'alternate'},'chatTimeout':{'type':Sequelize[_0x32ef('0x2')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x32ef('0x7')],'defaultValue':!![]},'preferred':{'type':Sequelize['STRING']},'defaultPreferred':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x32ef('0x7')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize['STRING']},'allowedLoginAttempts':{'type':Sequelize[_0x32ef('0x2')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x32ef('0x2')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x32ef('0x5')]},'defaultFavicon':{'type':Sequelize[_0x32ef('0x7')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize['INTEGER'],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize[_0x32ef('0x2')]},'transcribeRegion':{'type':Sequelize[_0x32ef('0x5')]},'sentiment':{'type':Sequelize[_0x32ef('0x7')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize['INTEGER']},'sentimentRegion':{'type':Sequelize[_0x32ef('0x5')]},'language':{'type':Sequelize[_0x32ef('0x5')]},'bucket':{'type':Sequelize[_0x32ef('0x5')]},'googleSsoEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0x32ef('0x7')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0x32ef('0x2')](0x2)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0x32ef('0x2')](0x2)[_0x32ef('0x9')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0x32ef('0x2')](0x2)[_0x32ef('0x9')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0x32ef('0x2')](0x2)[_0x32ef('0x9')],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0x32ef('0x2')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0x32ef('0x2')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize[_0x32ef('0x2')],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0x32ef('0x7')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/setting/setting.controller.js b/server/api/setting/setting.controller.js index fd2551e..ee730fa 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 _0x0f16=['server/files/images/logos','loginLogo','preferred','favicon','defaultLogo','defaultLoginLogo','defaultFavicon','existsSync','join','root','toLower','default_logo.svg','default','ValidationError','\x20not\x20found','defaultPreferred','default_loginLogo.svg','download','gdpr','addPreferred','getPreferred','getLicense','default_preferred.png','upperFirst','custom','Sequelize','getFavicon','default_favicon.ico','getDate','utcOffset','now','format','YYYY-MM-DD\x20HH:mm:ss:SSS','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','jayson/promise','client','http','request','info','Setting,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','Setting,\x20%s,\x20%s','status','end','json','undefined','limit','count','offset','set','Content-Range','reject','save','update','then','destroy','sendStatus','stack','name','send','index','map','Setting','rawAttributes','fieldName','key','query','keys','intersection','model','attributes','fields','length','nolimit','order','sort','where','pick','filters','filter','merge','include','findAll','catch','show','params','includeAll','find','body','addLogo','file','filename','logo','getLogo'];(function(_0x5777ed,_0x12ec36){var _0xffcfd1=function(_0x1218cc){while(--_0x1218cc){_0x5777ed['push'](_0x5777ed['shift']());}};_0xffcfd1(++_0x12ec36);}(_0x0f16,0x192));var _0x60f1=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x0f16[_0x4b369d];return _0x571a98;};'use strict';var emlformat=require(_0x60f1('0x0'));var rimraf=require(_0x60f1('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x60f1('0x2'));var rp=require(_0x60f1('0x3'));var moment=require(_0x60f1('0x4'));var BPromise=require(_0x60f1('0x5'));var Mustache=require(_0x60f1('0x6'));var util=require(_0x60f1('0x7'));var path=require('path');var sox=require(_0x60f1('0x8'));var csv=require(_0x60f1('0x9'));var ejs=require(_0x60f1('0xa'));var fs=require('fs');var fs_extra=require(_0x60f1('0xb'));var _=require(_0x60f1('0xc'));var squel=require(_0x60f1('0xd'));var crypto=require(_0x60f1('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x60f1('0xf'));var toCsv=require(_0x60f1('0x9'));var querystring=require(_0x60f1('0x10'));var Papa=require(_0x60f1('0x11'));var Redis=require(_0x60f1('0x12'));var authService=require(_0x60f1('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x60f1('0x14'));var hardwareService=require(_0x60f1('0x15'));var logger=require(_0x60f1('0x16'))('api');var utils=require(_0x60f1('0x17'));var config=require(_0x60f1('0x18'));var licenseUtil=require(_0x60f1('0x19'));var db=require('../../mysqldb')['db'];var jayson=require(_0x60f1('0x1a'));var client=jayson[_0x60f1('0x1b')][_0x60f1('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x1ddffe,_0x4a48ad,_0x4be0df,_0x16af08){return new BPromise(function(_0x5e7f90,_0x3df4b9){var _0x5bc7c7=_0x16af08||client;return _0x5bc7c7[_0x60f1('0x1d')](_0x1ddffe,_0x4be0df)['then'](function(_0x806026){logger[_0x60f1('0x1e')]('Setting,\x20%s,\x20%s',_0x4a48ad,'request\x20sent');logger['debug'](_0x60f1('0x1f'),_0x4a48ad,_0x60f1('0x20'),JSON[_0x60f1('0x21')](_0x806026));if(_0x806026[_0x60f1('0x22')]){if(_0x806026['error'][_0x60f1('0x23')]===0x1f4){logger[_0x60f1('0x22')]('Setting,\x20%s,\x20%s',_0x4a48ad,_0x806026['error'][_0x60f1('0x24')]);return _0x3df4b9(_0x806026[_0x60f1('0x22')][_0x60f1('0x24')]);}logger[_0x60f1('0x22')](_0x60f1('0x25'),_0x4a48ad,_0x806026[_0x60f1('0x22')][_0x60f1('0x24')]);return _0x5e7f90(_0x806026['error'][_0x60f1('0x24')]);}else{logger[_0x60f1('0x1e')](_0x60f1('0x25'),_0x4a48ad,_0x60f1('0x20'));_0x5e7f90(_0x806026['result'][_0x60f1('0x24')]);}})['catch'](function(_0x5993fc){logger[_0x60f1('0x22')](_0x60f1('0x25'),_0x4a48ad,_0x5993fc);_0x3df4b9(_0x5993fc);});});}function respondWithStatusCode(_0x333d77,_0x1c970a){_0x1c970a=_0x1c970a||0xcc;return function(_0x369f7b){if(_0x369f7b){return _0x333d77['sendStatus'](_0x1c970a);}return _0x333d77[_0x60f1('0x26')](_0x1c970a)[_0x60f1('0x27')]();};}function respondWithResult(_0x3c9942,_0x4a6b5d){_0x4a6b5d=_0x4a6b5d||0xc8;return function(_0x2df145){if(_0x2df145){return _0x3c9942[_0x60f1('0x26')](_0x4a6b5d)[_0x60f1('0x28')](_0x2df145);}};}function respondWithFilteredResult(_0x2eb607,_0x4ae84f){return function(_0x149b90){if(_0x149b90){var _0x4cab74=typeof _0x4ae84f['offset']===_0x60f1('0x29')&&typeof _0x4ae84f[_0x60f1('0x2a')]==='undefined';var _0x2d383f=_0x149b90[_0x60f1('0x2b')];var _0x51c21b=_0x4cab74?0x0:_0x4ae84f[_0x60f1('0x2c')];var _0x34d80a=_0x4cab74?_0x149b90[_0x60f1('0x2b')]:_0x4ae84f[_0x60f1('0x2c')]+_0x4ae84f[_0x60f1('0x2a')];var _0x2964d9;if(_0x34d80a>=_0x2d383f){_0x34d80a=_0x2d383f;_0x2964d9=0xc8;}else{_0x2964d9=0xce;}_0x2eb607['status'](_0x2964d9);return _0x2eb607[_0x60f1('0x2d')](_0x60f1('0x2e'),_0x51c21b+'-'+_0x34d80a+'/'+_0x2d383f)[_0x60f1('0x28')](_0x149b90);}return null;};}function patchUpdates(_0x24fba7){return function(_0x414478){try{jsonpatch['apply'](_0x414478,_0x24fba7,!![]);}catch(_0x436eab){return BPromise[_0x60f1('0x2f')](_0x436eab);}return _0x414478[_0x60f1('0x30')]();};}function saveUpdates(_0x91c993,_0xadf236){return function(_0x2374a2){if(_0x2374a2){return _0x2374a2[_0x60f1('0x31')](_0x91c993)[_0x60f1('0x32')](function(_0x52d8c6){return _0x52d8c6;});}return null;};}function removeEntity(_0x2d7ae7,_0x2d2b45){return function(_0x1e49f8){if(_0x1e49f8){return _0x1e49f8[_0x60f1('0x33')]()[_0x60f1('0x32')](function(){_0x2d7ae7[_0x60f1('0x26')](0xcc)['end']();});}};}function handleEntityNotFound(_0x507a9c,_0x198799){return function(_0xe9c9ea){if(!_0xe9c9ea){_0x507a9c[_0x60f1('0x34')](0x194);}return _0xe9c9ea;};}function handleError(_0xc7e409,_0x5342a7){_0x5342a7=_0x5342a7||0x1f4;return function(_0x1e641d){logger[_0x60f1('0x22')](_0x1e641d[_0x60f1('0x35')]);if(_0x1e641d['name']){delete _0x1e641d[_0x60f1('0x36')];}_0xc7e409[_0x60f1('0x26')](_0x5342a7)[_0x60f1('0x37')](_0x1e641d);};}exports[_0x60f1('0x38')]=function(_0xea7924,_0x58a90b){var _0x44b872={},_0x575b2c={},_0x4c895a={'count':0x0,'rows':[]};var _0x3ac269=_[_0x60f1('0x39')](db[_0x60f1('0x3a')][_0x60f1('0x3b')],function(_0x53acec){return{'name':_0x53acec[_0x60f1('0x3c')],'type':_0x53acec['type'][_0x60f1('0x3d')]};});_0x575b2c['model']=_[_0x60f1('0x39')](_0x3ac269,_0x60f1('0x36'));_0x575b2c[_0x60f1('0x3e')]=_[_0x60f1('0x3f')](_0xea7924[_0x60f1('0x3e')]);_0x575b2c['filters']=_[_0x60f1('0x40')](_0x575b2c[_0x60f1('0x41')],_0x575b2c[_0x60f1('0x3e')]);_0x44b872[_0x60f1('0x42')]=_[_0x60f1('0x40')](_0x575b2c[_0x60f1('0x41')],qs[_0x60f1('0x43')](_0xea7924[_0x60f1('0x3e')][_0x60f1('0x43')]));_0x44b872[_0x60f1('0x42')]=_0x44b872[_0x60f1('0x42')][_0x60f1('0x44')]?_0x44b872[_0x60f1('0x42')]:_0x575b2c[_0x60f1('0x41')];if(!_0xea7924[_0x60f1('0x3e')]['hasOwnProperty'](_0x60f1('0x45'))){_0x44b872[_0x60f1('0x2a')]=qs[_0x60f1('0x2a')](_0xea7924[_0x60f1('0x3e')][_0x60f1('0x2a')]);_0x44b872['offset']=qs[_0x60f1('0x2c')](_0xea7924['query']['offset']);}_0x44b872[_0x60f1('0x46')]=qs[_0x60f1('0x47')](_0xea7924[_0x60f1('0x3e')][_0x60f1('0x47')]);_0x44b872[_0x60f1('0x48')]=qs['filters'](_[_0x60f1('0x49')](_0xea7924['query'],_0x575b2c[_0x60f1('0x4a')]),_0x3ac269);if(_0xea7924[_0x60f1('0x3e')][_0x60f1('0x4b')]){_0x44b872[_0x60f1('0x48')]=_['merge'](_0x44b872[_0x60f1('0x48')],{'$or':_['map'](_0x3ac269,function(_0x5245ea){if(_0x5245ea['type']!=='VIRTUAL'){var _0x23fc4b={};_0x23fc4b[_0x5245ea['name']]={'$like':'%'+_0xea7924['query'][_0x60f1('0x4b')]+'%'};return _0x23fc4b;}})});}_0x44b872=_[_0x60f1('0x4c')]({},_0x44b872,_0xea7924['options']);var _0x18bb68={'where':_0x44b872[_0x60f1('0x48')]};return db['Setting'][_0x60f1('0x2b')](_0x18bb68)[_0x60f1('0x32')](function(_0xeb15f4){_0x4c895a[_0x60f1('0x2b')]=_0xeb15f4;if(_0xea7924['query']['includeAll']){_0x44b872[_0x60f1('0x4d')]=[{'all':!![]}];}return db[_0x60f1('0x3a')][_0x60f1('0x4e')](_0x44b872);})[_0x60f1('0x32')](function(_0x54c42b){_0x4c895a['rows']=_0x54c42b;return _0x4c895a;})[_0x60f1('0x32')](respondWithFilteredResult(_0x58a90b,_0x44b872))[_0x60f1('0x4f')](handleError(_0x58a90b,null));};exports[_0x60f1('0x50')]=function(_0x3b925c,_0xb477ce){var _0x2fe6de={'raw':![],'where':{'id':_0x3b925c[_0x60f1('0x51')]['id']}},_0x560d7a={};_0x560d7a[_0x60f1('0x41')]=_[_0x60f1('0x3f')](db[_0x60f1('0x3a')][_0x60f1('0x3b')]);_0x560d7a[_0x60f1('0x3e')]=_[_0x60f1('0x3f')](_0x3b925c[_0x60f1('0x3e')]);_0x560d7a['filters']=_[_0x60f1('0x40')](_0x560d7a[_0x60f1('0x41')],_0x560d7a[_0x60f1('0x3e')]);_0x2fe6de[_0x60f1('0x42')]=_[_0x60f1('0x40')](_0x560d7a['model'],qs['fields'](_0x3b925c['query'][_0x60f1('0x43')]));_0x2fe6de[_0x60f1('0x42')]=_0x2fe6de[_0x60f1('0x42')][_0x60f1('0x44')]?_0x2fe6de['attributes']:_0x560d7a[_0x60f1('0x41')];if(_0x3b925c[_0x60f1('0x3e')][_0x60f1('0x52')]){_0x2fe6de['include']=[{'all':!![]}];}_0x2fe6de=_['merge']({},_0x2fe6de,_0x3b925c['options']);return db[_0x60f1('0x3a')][_0x60f1('0x53')](_0x2fe6de)[_0x60f1('0x32')](handleEntityNotFound(_0xb477ce,null))[_0x60f1('0x32')](respondWithResult(_0xb477ce,null))[_0x60f1('0x4f')](handleError(_0xb477ce,null));};exports[_0x60f1('0x31')]=function(_0x554b2e,_0x5dcb55){if(_0x554b2e['body']['id']){delete _0x554b2e['body']['id'];}return db[_0x60f1('0x3a')][_0x60f1('0x53')]({'where':{'id':_0x554b2e[_0x60f1('0x51')]['id']}})[_0x60f1('0x32')](handleEntityNotFound(_0x5dcb55,null))[_0x60f1('0x32')](saveUpdates(_0x554b2e[_0x60f1('0x54')],null))[_0x60f1('0x32')](respondWithResult(_0x5dcb55,null))[_0x60f1('0x4f')](handleError(_0x5dcb55,null));};exports[_0x60f1('0x55')]=function(_0x4e6d15,_0x54eb62,_0x1a07fd){if(_0x4e6d15[_0x60f1('0x56')]&&_0x4e6d15['file'][_0x60f1('0x57')]){_0x4e6d15[_0x60f1('0x54')][_0x60f1('0x58')]=_0x4e6d15[_0x60f1('0x56')][_0x60f1('0x57')];}return db['Setting'][_0x60f1('0x53')]({'where':{'id':_0x4e6d15[_0x60f1('0x51')]['id']}})[_0x60f1('0x32')](handleEntityNotFound(_0x54eb62,null))[_0x60f1('0x32')](saveUpdates(_0x4e6d15[_0x60f1('0x54')],null))[_0x60f1('0x32')](respondWithResult(_0x54eb62,null))[_0x60f1('0x4f')](handleError(_0x54eb62,null));};exports['addLogoLogin']=function(_0x400678,_0x56bed2,_0x38c781){if(_0x400678['file']&&_0x400678[_0x60f1('0x56')][_0x60f1('0x57')]){_0x400678[_0x60f1('0x54')]['loginLogo']=_0x400678[_0x60f1('0x56')][_0x60f1('0x57')];}return db[_0x60f1('0x3a')]['find']({'where':{'id':_0x400678[_0x60f1('0x51')]['id']}})['then'](handleEntityNotFound(_0x56bed2,null))['then'](saveUpdates(_0x400678[_0x60f1('0x54')],null))[_0x60f1('0x32')](respondWithResult(_0x56bed2,null))[_0x60f1('0x4f')](handleError(_0x56bed2,null));};var utilLicense=require(_0x60f1('0x19'));exports[_0x60f1('0x59')]=function(_0x4aa2ba,_0x29c584,_0x21567d){var _0x337259=_0x60f1('0x5a');var _0x32c6c0={'custom':![]};return utilLicense['getLicense']()[_0x60f1('0x32')](function(_0x127e53){if(_0x127e53){_0x32c6c0=_0x127e53;}return db[_0x60f1('0x3a')][_0x60f1('0x53')]({'where':{'id':_0x4aa2ba[_0x60f1('0x51')]['id']},'attributes':[_0x60f1('0x58'),_0x60f1('0x5b'),_0x60f1('0x5c'),_0x60f1('0x5d'),_0x60f1('0x5e'),_0x60f1('0x5f'),'defaultPreferred',_0x60f1('0x60')],'raw':!![]});})['then'](handleEntityNotFound(_0x29c584,null))[_0x60f1('0x32')](function(_0x1a83d1){if(_0x1a83d1){var _0x2a2191=_0x1a83d1['logo']&&fs[_0x60f1('0x61')](path[_0x60f1('0x62')](config[_0x60f1('0x63')],_0x337259,_[_0x60f1('0x64')](_0x1a83d1[_0x60f1('0x58')])))?path[_0x60f1('0x62')](config[_0x60f1('0x63')],_0x337259,_['toLower'](_0x1a83d1[_0x60f1('0x58')])):path[_0x60f1('0x62')](config[_0x60f1('0x63')],_0x337259,_[_0x60f1('0x64')](_0x60f1('0x65')));var _0x4dd48d=_0x60f1('0x66')+_['upperFirst'](_0x60f1('0x58'));if(_0x1a83d1[_0x4dd48d]||!_0x32c6c0['custom']){_0x2a2191=path[_0x60f1('0x62')](config[_0x60f1('0x63')],_0x337259,_[_0x60f1('0x64')]('default_logo.svg'));}if(!fs[_0x60f1('0x61')](_0x2a2191)){throw new db['Sequelize'][(_0x60f1('0x67'))](_['upperFirst']('logo')+_0x60f1('0x68'));}return _0x29c584['download'](_0x2a2191);}})['catch'](handleError(_0x29c584,null));};var utilLicense=require(_0x60f1('0x19'));exports['getLogoLogin']=function(_0x31e895,_0x5d84b5,_0x2e324c){var _0xc93ccd='server/files/images/logos';var _0x244ade={'custom':![]};return utilLicense['getLicense']()[_0x60f1('0x32')](function(_0x1a55ee){if(_0x1a55ee){_0x244ade=_0x1a55ee;}return db['Setting'][_0x60f1('0x53')]({'where':{'id':_0x31e895[_0x60f1('0x51')]['id']},'attributes':[_0x60f1('0x58'),_0x60f1('0x5b'),_0x60f1('0x5c'),_0x60f1('0x5d'),_0x60f1('0x5e'),_0x60f1('0x5f'),_0x60f1('0x69'),_0x60f1('0x60')],'raw':!![]});})['then'](handleEntityNotFound(_0x5d84b5,null))[_0x60f1('0x32')](function(_0x14e40b){if(_0x14e40b){var _0x4b049f=_0x14e40b[_0x60f1('0x5b')]&&fs[_0x60f1('0x61')](path['join'](config[_0x60f1('0x63')],_0xc93ccd,_[_0x60f1('0x64')](_0x14e40b['loginLogo'])))?path[_0x60f1('0x62')](config[_0x60f1('0x63')],_0xc93ccd,_[_0x60f1('0x64')](_0x14e40b[_0x60f1('0x5b')])):path['join'](config[_0x60f1('0x63')],_0xc93ccd,_['toLower']('default_loginLogo.svg'));var _0x56cfe3=_0x60f1('0x66')+_['upperFirst']('loginLogo');if(_0x14e40b[_0x56cfe3]||!_0x244ade['custom']){_0x4b049f=path[_0x60f1('0x62')](config[_0x60f1('0x63')],_0xc93ccd,_[_0x60f1('0x64')](_0x60f1('0x6a')));}if(!fs[_0x60f1('0x61')](_0x4b049f)){throw new db['Sequelize'][(_0x60f1('0x67'))](_['upperFirst'](_0x60f1('0x5b'))+_0x60f1('0x68'));}return _0x5d84b5[_0x60f1('0x6b')](_0x4b049f);}})[_0x60f1('0x4f')](handleError(_0x5d84b5,null));};exports[_0x60f1('0x6c')]=function(_0x494695,_0x4c02f4){return db['Setting']['find']({'where':{'id':_0x494695[_0x60f1('0x51')]['id']},'attributes':['securePassword']})['then'](respondWithResult(_0x4c02f4,null))[_0x60f1('0x4f')](handleError(_0x4c02f4,null));};exports[_0x60f1('0x6d')]=function(_0x2b663d,_0x121e71,_0x15dfd4){if(_0x2b663d[_0x60f1('0x56')]&&_0x2b663d[_0x60f1('0x56')]['filename']){_0x2b663d['body']['preferred']=_0x2b663d[_0x60f1('0x56')][_0x60f1('0x57')];}return db[_0x60f1('0x3a')][_0x60f1('0x53')]({'where':{'id':_0x2b663d[_0x60f1('0x51')]['id']}})[_0x60f1('0x32')](handleEntityNotFound(_0x121e71,null))['then'](saveUpdates(_0x2b663d[_0x60f1('0x54')],null))[_0x60f1('0x32')](respondWithResult(_0x121e71,null))['catch'](handleError(_0x121e71,null));};var utilLicense=require(_0x60f1('0x19'));exports[_0x60f1('0x6e')]=function(_0x4f93aa,_0x170fe9,_0x2b9d40){var _0xdf9fe9=_0x60f1('0x5a');var _0x329b40={'custom':![]};return utilLicense[_0x60f1('0x6f')]()['then'](function(_0x52857c){if(_0x52857c){_0x329b40=_0x52857c;}return db[_0x60f1('0x3a')][_0x60f1('0x53')]({'where':{'id':_0x4f93aa[_0x60f1('0x51')]['id']},'attributes':[_0x60f1('0x58'),'loginLogo','preferred','favicon',_0x60f1('0x5e'),_0x60f1('0x5f'),_0x60f1('0x69'),_0x60f1('0x60')],'raw':!![]});})['then'](handleEntityNotFound(_0x170fe9,null))['then'](function(_0x2d1a59){if(_0x2d1a59){var _0xa628c1=_0x2d1a59['preferred']&&fs['existsSync'](path[_0x60f1('0x62')](config[_0x60f1('0x63')],_0xdf9fe9,_[_0x60f1('0x64')](_0x2d1a59[_0x60f1('0x5c')])))?path[_0x60f1('0x62')](config[_0x60f1('0x63')],_0xdf9fe9,_['toLower'](_0x2d1a59[_0x60f1('0x5c')])):path['join'](config[_0x60f1('0x63')],_0xdf9fe9,_['toLower'](_0x60f1('0x70')));var _0x520ffd=_0x60f1('0x66')+_[_0x60f1('0x71')](_0x60f1('0x5c'));if(_0x2d1a59[_0x520ffd]||!_0x329b40[_0x60f1('0x72')]||!_0x329b40['preferred']){_0xa628c1=path[_0x60f1('0x62')](config[_0x60f1('0x63')],_0xdf9fe9,_[_0x60f1('0x64')](_0x60f1('0x70')));}if(!fs[_0x60f1('0x61')](_0xa628c1)){throw new db[(_0x60f1('0x73'))][(_0x60f1('0x67'))](_[_0x60f1('0x71')](_0x60f1('0x5c'))+_0x60f1('0x68'));}return _0x170fe9['download'](_0xa628c1);}})[_0x60f1('0x4f')](handleError(_0x170fe9,null));};exports['addFavicon']=function(_0x26d013,_0x4fb8e3,_0x528561){if(_0x26d013[_0x60f1('0x56')]&&_0x26d013[_0x60f1('0x56')][_0x60f1('0x57')]){_0x26d013['body']['favicon']=_0x26d013['file']['filename'];}return db[_0x60f1('0x3a')][_0x60f1('0x53')]({'where':{'id':_0x26d013[_0x60f1('0x51')]['id']}})[_0x60f1('0x32')](handleEntityNotFound(_0x4fb8e3,null))[_0x60f1('0x32')](saveUpdates(_0x26d013['body'],null))[_0x60f1('0x32')](respondWithResult(_0x4fb8e3,null))[_0x60f1('0x4f')](handleError(_0x4fb8e3,null));};var utilLicense=require('../../config/license/util');exports[_0x60f1('0x74')]=function(_0x533e74,_0x7688b6,_0x3dd7ea){var _0x1e906b=_0x60f1('0x5a');var _0x30321b={'custom':![]};return utilLicense['getLicense']()['then'](function(_0xc2e3ce){if(_0xc2e3ce){_0x30321b=_0xc2e3ce;}return db[_0x60f1('0x3a')]['find']({'where':{'id':_0x533e74[_0x60f1('0x51')]['id']},'attributes':[_0x60f1('0x58'),'loginLogo',_0x60f1('0x5c'),'favicon',_0x60f1('0x5e'),_0x60f1('0x5f'),_0x60f1('0x69'),_0x60f1('0x60')],'raw':!![]});})[_0x60f1('0x32')](handleEntityNotFound(_0x7688b6,null))['then'](function(_0x35ac98){if(_0x35ac98){var _0x421464=_0x35ac98['favicon']&&fs[_0x60f1('0x61')](path[_0x60f1('0x62')](config[_0x60f1('0x63')],_0x1e906b,_['toLower'](_0x35ac98[_0x60f1('0x5d')])))?path[_0x60f1('0x62')](config[_0x60f1('0x63')],_0x1e906b,_['toLower'](_0x35ac98[_0x60f1('0x5d')])):path[_0x60f1('0x62')](config[_0x60f1('0x63')],_0x1e906b,_[_0x60f1('0x64')](_0x60f1('0x75')));var _0x5357d5=_0x60f1('0x66')+_[_0x60f1('0x71')](_0x60f1('0x5d'));if(_0x35ac98[_0x5357d5]||!_0x30321b[_0x60f1('0x72')]){_0x421464=path[_0x60f1('0x62')](config[_0x60f1('0x63')],_0x1e906b,_[_0x60f1('0x64')](_0x60f1('0x75')));}if(!fs['existsSync'](_0x421464)){throw new db[(_0x60f1('0x73'))]['ValidationError'](_[_0x60f1('0x71')](_0x60f1('0x5d'))+_0x60f1('0x68'));}return _0x7688b6[_0x60f1('0x6b')](_0x421464);}})['catch'](handleError(_0x7688b6,null));};exports[_0x60f1('0x76')]=function(_0x4ab40e,_0x36423a){var _0x36e83a={'offset':moment()[_0x60f1('0x77')]()};_0x36e83a[_0x60f1('0x78')]=moment()[_0x60f1('0x77')](_0x36e83a['offset'])[_0x60f1('0x79')](_0x60f1('0x7a'));return _0x36423a[_0x60f1('0x26')](0xc8)[_0x60f1('0x37')](_0x36e83a);}; \ No newline at end of file +var _0x520e=['ValidationError','upperFirst','\x20not\x20found','download','defaultLogo','defaultFavicon','gdpr','addPreferred','preferred','getPreferred','default_preferred.png','addFavicon','getFavicon','default_favicon.ico','getDate','utcOffset','now','format','YYYY-MM-DD\x20HH:mm:ss:SSS','send','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','request','then','info','Setting,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','destroy','stack','name','Setting','rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','options','find','catch','body','params','file','filename','logo','loginLogo','getLogo','server/files/images/logos','getLicense','favicon','defaultLoginLogo','defaultPreferred','join','root','toLower','default_logo.svg','default','custom','existsSync','Sequelize'];(function(_0x29411b,_0x29fe3d){var _0x14afde=function(_0x28c831){while(--_0x28c831){_0x29411b['push'](_0x29411b['shift']());}};_0x14afde(++_0x29fe3d);}(_0x520e,0x90));var _0xe520=function(_0x30bd66,_0x36a93d){_0x30bd66=_0x30bd66-0x0;var _0x74c9dd=_0x520e[_0x30bd66];return _0x74c9dd;};'use strict';var emlformat=require(_0xe520('0x0'));var rimraf=require(_0xe520('0x1'));var zipdir=require(_0xe520('0x2'));var jsonpatch=require(_0xe520('0x3'));var rp=require(_0xe520('0x4'));var moment=require(_0xe520('0x5'));var BPromise=require(_0xe520('0x6'));var Mustache=require('mustache');var util=require(_0xe520('0x7'));var path=require(_0xe520('0x8'));var sox=require('sox');var csv=require(_0xe520('0x9'));var ejs=require(_0xe520('0xa'));var fs=require('fs');var fs_extra=require(_0xe520('0xb'));var _=require(_0xe520('0xc'));var squel=require(_0xe520('0xd'));var crypto=require(_0xe520('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xe520('0xf'));var toCsv=require(_0xe520('0x9'));var querystring=require(_0xe520('0x10'));var Papa=require(_0xe520('0x11'));var Redis=require(_0xe520('0x12'));var authService=require(_0xe520('0x13'));var qs=require(_0xe520('0x14'));var as=require(_0xe520('0x15'));var hardwareService=require(_0xe520('0x16'));var logger=require(_0xe520('0x17'))(_0xe520('0x18'));var utils=require(_0xe520('0x19'));var config=require(_0xe520('0x1a'));var licenseUtil=require(_0xe520('0x1b'));var db=require(_0xe520('0x1c'))['db'];var jayson=require(_0xe520('0x1d'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1c0889,_0x4c1bc8,_0x43ca74,_0x24a5a0){return new BPromise(function(_0x51a02b,_0x2bf1f6){var _0xf21274=_0x24a5a0||client;return _0xf21274[_0xe520('0x1e')](_0x1c0889,_0x43ca74)[_0xe520('0x1f')](function(_0x37d265){logger[_0xe520('0x20')](_0xe520('0x21'),_0x4c1bc8,_0xe520('0x22'));logger[_0xe520('0x23')]('Setting,\x20%s,\x20%s,\x20%s',_0x4c1bc8,_0xe520('0x22'),JSON['stringify'](_0x37d265));if(_0x37d265[_0xe520('0x24')]){if(_0x37d265[_0xe520('0x24')][_0xe520('0x25')]===0x1f4){logger['error']('Setting,\x20%s,\x20%s',_0x4c1bc8,_0x37d265[_0xe520('0x24')]['message']);return _0x2bf1f6(_0x37d265[_0xe520('0x24')][_0xe520('0x26')]);}logger[_0xe520('0x24')](_0xe520('0x21'),_0x4c1bc8,_0x37d265['error'][_0xe520('0x26')]);return _0x51a02b(_0x37d265['error']['message']);}else{logger[_0xe520('0x20')](_0xe520('0x21'),_0x4c1bc8,'request\x20sent');_0x51a02b(_0x37d265[_0xe520('0x27')][_0xe520('0x26')]);}})['catch'](function(_0x5ef8bd){logger['error'](_0xe520('0x21'),_0x4c1bc8,_0x5ef8bd);_0x2bf1f6(_0x5ef8bd);});});}function respondWithStatusCode(_0x28f61c,_0x3b8ee7){_0x3b8ee7=_0x3b8ee7||0xcc;return function(_0x20f5f3){if(_0x20f5f3){return _0x28f61c[_0xe520('0x28')](_0x3b8ee7);}return _0x28f61c[_0xe520('0x29')](_0x3b8ee7)[_0xe520('0x2a')]();};}function respondWithResult(_0x27b6ce,_0x288f7e){_0x288f7e=_0x288f7e||0xc8;return function(_0x24faa1){if(_0x24faa1){return _0x27b6ce['status'](_0x288f7e)[_0xe520('0x2b')](_0x24faa1);}};}function respondWithFilteredResult(_0x51dd73,_0x3bdcc8){return function(_0xa491ce){if(_0xa491ce){var _0x48cdde=typeof _0x3bdcc8[_0xe520('0x2c')]===_0xe520('0x2d')&&typeof _0x3bdcc8[_0xe520('0x2e')]===_0xe520('0x2d');var _0x1c3cc2=_0xa491ce['count'];var _0x480514=_0x48cdde?0x0:_0x3bdcc8['offset'];var _0x37b0ec=_0x48cdde?_0xa491ce[_0xe520('0x2f')]:_0x3bdcc8['offset']+_0x3bdcc8[_0xe520('0x2e')];var _0x3b0aaa;if(_0x37b0ec>=_0x1c3cc2){_0x37b0ec=_0x1c3cc2;_0x3b0aaa=0xc8;}else{_0x3b0aaa=0xce;}_0x51dd73['status'](_0x3b0aaa);return _0x51dd73[_0xe520('0x30')](_0xe520('0x31'),_0x480514+'-'+_0x37b0ec+'/'+_0x1c3cc2)[_0xe520('0x2b')](_0xa491ce);}return null;};}function patchUpdates(_0x24de92){return function(_0x32418e){try{jsonpatch['apply'](_0x32418e,_0x24de92,!![]);}catch(_0x2031be){return BPromise[_0xe520('0x32')](_0x2031be);}return _0x32418e[_0xe520('0x33')]();};}function saveUpdates(_0x36319a,_0x3b13d0){return function(_0x2e5cbf){if(_0x2e5cbf){return _0x2e5cbf[_0xe520('0x34')](_0x36319a)['then'](function(_0x595554){return _0x595554;});}return null;};}function removeEntity(_0x36ea57,_0x1fcb4c){return function(_0x5a21b5){if(_0x5a21b5){return _0x5a21b5[_0xe520('0x35')]()[_0xe520('0x1f')](function(){_0x36ea57[_0xe520('0x29')](0xcc)[_0xe520('0x2a')]();});}};}function handleEntityNotFound(_0x3bcb06,_0x5127e9){return function(_0x5a39e8){if(!_0x5a39e8){_0x3bcb06['sendStatus'](0x194);}return _0x5a39e8;};}function handleError(_0x57ede5,_0x1aacce){_0x1aacce=_0x1aacce||0x1f4;return function(_0x3b86b7){logger[_0xe520('0x24')](_0x3b86b7[_0xe520('0x36')]);if(_0x3b86b7[_0xe520('0x37')]){delete _0x3b86b7[_0xe520('0x37')];}_0x57ede5['status'](_0x1aacce)['send'](_0x3b86b7);};}exports['index']=function(_0x108416,_0x473f48){var _0x1ea115={},_0x38af9a={},_0x27ddcb={'count':0x0,'rows':[]};var _0x2a87ee=_['map'](db[_0xe520('0x38')][_0xe520('0x39')],function(_0x179c36){return{'name':_0x179c36[_0xe520('0x3a')],'type':_0x179c36[_0xe520('0x3b')][_0xe520('0x3c')]};});_0x38af9a['model']=_[_0xe520('0x3d')](_0x2a87ee,_0xe520('0x37'));_0x38af9a[_0xe520('0x3e')]=_[_0xe520('0x3f')](_0x108416['query']);_0x38af9a[_0xe520('0x40')]=_[_0xe520('0x41')](_0x38af9a[_0xe520('0x42')],_0x38af9a['query']);_0x1ea115[_0xe520('0x43')]=_[_0xe520('0x41')](_0x38af9a['model'],qs[_0xe520('0x44')](_0x108416[_0xe520('0x3e')]['fields']));_0x1ea115[_0xe520('0x43')]=_0x1ea115['attributes'][_0xe520('0x45')]?_0x1ea115[_0xe520('0x43')]:_0x38af9a[_0xe520('0x42')];if(!_0x108416['query'][_0xe520('0x46')]('nolimit')){_0x1ea115[_0xe520('0x2e')]=qs['limit'](_0x108416['query'][_0xe520('0x2e')]);_0x1ea115['offset']=qs[_0xe520('0x2c')](_0x108416[_0xe520('0x3e')][_0xe520('0x2c')]);}_0x1ea115[_0xe520('0x47')]=qs[_0xe520('0x48')](_0x108416['query'][_0xe520('0x48')]);_0x1ea115[_0xe520('0x49')]=qs['filters'](_[_0xe520('0x4a')](_0x108416[_0xe520('0x3e')],_0x38af9a[_0xe520('0x40')]),_0x2a87ee);if(_0x108416['query'][_0xe520('0x4b')]){_0x1ea115[_0xe520('0x49')]=_[_0xe520('0x4c')](_0x1ea115['where'],{'$or':_[_0xe520('0x3d')](_0x2a87ee,function(_0x1746fb){if(_0x1746fb[_0xe520('0x3b')]!==_0xe520('0x4d')){var _0x7016f6={};_0x7016f6[_0x1746fb[_0xe520('0x37')]]={'$like':'%'+_0x108416['query'][_0xe520('0x4b')]+'%'};return _0x7016f6;}})});}_0x1ea115=_[_0xe520('0x4c')]({},_0x1ea115,_0x108416['options']);var _0x3ef218={'where':_0x1ea115[_0xe520('0x49')]};return db[_0xe520('0x38')][_0xe520('0x2f')](_0x3ef218)['then'](function(_0x1b62b5){_0x27ddcb[_0xe520('0x2f')]=_0x1b62b5;if(_0x108416['query'][_0xe520('0x4e')]){_0x1ea115[_0xe520('0x4f')]=[{'all':!![]}];}return db['Setting'][_0xe520('0x50')](_0x1ea115);})[_0xe520('0x1f')](function(_0x4e5b96){_0x27ddcb['rows']=_0x4e5b96;return _0x27ddcb;})[_0xe520('0x1f')](respondWithFilteredResult(_0x473f48,_0x1ea115))['catch'](handleError(_0x473f48,null));};exports['show']=function(_0x1cc96d,_0x33f921){var _0x243132={'raw':![],'where':{'id':_0x1cc96d['params']['id']}},_0x2cba3b={};_0x2cba3b[_0xe520('0x42')]=_[_0xe520('0x3f')](db[_0xe520('0x38')][_0xe520('0x39')]);_0x2cba3b[_0xe520('0x3e')]=_[_0xe520('0x3f')](_0x1cc96d[_0xe520('0x3e')]);_0x2cba3b[_0xe520('0x40')]=_[_0xe520('0x41')](_0x2cba3b['model'],_0x2cba3b['query']);_0x243132[_0xe520('0x43')]=_[_0xe520('0x41')](_0x2cba3b[_0xe520('0x42')],qs[_0xe520('0x44')](_0x1cc96d['query'][_0xe520('0x44')]));_0x243132[_0xe520('0x43')]=_0x243132[_0xe520('0x43')][_0xe520('0x45')]?_0x243132[_0xe520('0x43')]:_0x2cba3b['model'];if(_0x1cc96d['query'][_0xe520('0x4e')]){_0x243132['include']=[{'all':!![]}];}_0x243132=_[_0xe520('0x4c')]({},_0x243132,_0x1cc96d[_0xe520('0x51')]);return db['Setting'][_0xe520('0x52')](_0x243132)[_0xe520('0x1f')](handleEntityNotFound(_0x33f921,null))[_0xe520('0x1f')](respondWithResult(_0x33f921,null))[_0xe520('0x53')](handleError(_0x33f921,null));};exports[_0xe520('0x34')]=function(_0x5d9293,_0x261932){if(_0x5d9293['body']['id']){delete _0x5d9293[_0xe520('0x54')]['id'];}return db[_0xe520('0x38')]['find']({'where':{'id':_0x5d9293[_0xe520('0x55')]['id']}})[_0xe520('0x1f')](handleEntityNotFound(_0x261932,null))[_0xe520('0x1f')](saveUpdates(_0x5d9293[_0xe520('0x54')],null))[_0xe520('0x1f')](respondWithResult(_0x261932,null))[_0xe520('0x53')](handleError(_0x261932,null));};exports['addLogo']=function(_0x29a2d5,_0x56aee5,_0x1f4eb6){if(_0x29a2d5[_0xe520('0x56')]&&_0x29a2d5['file'][_0xe520('0x57')]){_0x29a2d5[_0xe520('0x54')][_0xe520('0x58')]=_0x29a2d5[_0xe520('0x56')][_0xe520('0x57')];}return db[_0xe520('0x38')][_0xe520('0x52')]({'where':{'id':_0x29a2d5[_0xe520('0x55')]['id']}})[_0xe520('0x1f')](handleEntityNotFound(_0x56aee5,null))[_0xe520('0x1f')](saveUpdates(_0x29a2d5[_0xe520('0x54')],null))[_0xe520('0x1f')](respondWithResult(_0x56aee5,null))[_0xe520('0x53')](handleError(_0x56aee5,null));};exports['addLogoLogin']=function(_0x3bce92,_0x380bac,_0xd07bc3){if(_0x3bce92['file']&&_0x3bce92['file']['filename']){_0x3bce92[_0xe520('0x54')][_0xe520('0x59')]=_0x3bce92[_0xe520('0x56')][_0xe520('0x57')];}return db[_0xe520('0x38')][_0xe520('0x52')]({'where':{'id':_0x3bce92[_0xe520('0x55')]['id']}})['then'](handleEntityNotFound(_0x380bac,null))[_0xe520('0x1f')](saveUpdates(_0x3bce92[_0xe520('0x54')],null))['then'](respondWithResult(_0x380bac,null))[_0xe520('0x53')](handleError(_0x380bac,null));};var utilLicense=require('../../config/license/util');exports[_0xe520('0x5a')]=function(_0x708b7e,_0x23d91d,_0x530a44){var _0x198bff=_0xe520('0x5b');var _0x11c772={'custom':![]};return utilLicense[_0xe520('0x5c')]()['then'](function(_0x111b00){if(_0x111b00){_0x11c772=_0x111b00;}return db[_0xe520('0x38')]['find']({'where':{'id':_0x708b7e[_0xe520('0x55')]['id']},'attributes':[_0xe520('0x58'),'loginLogo','preferred',_0xe520('0x5d'),'defaultLogo',_0xe520('0x5e'),_0xe520('0x5f'),'defaultFavicon'],'raw':!![]});})[_0xe520('0x1f')](handleEntityNotFound(_0x23d91d,null))[_0xe520('0x1f')](function(_0x2eaaef){if(_0x2eaaef){var _0x35582f=_0x2eaaef[_0xe520('0x58')]&&fs['existsSync'](path[_0xe520('0x60')](config[_0xe520('0x61')],_0x198bff,_[_0xe520('0x62')](_0x2eaaef['logo'])))?path[_0xe520('0x60')](config[_0xe520('0x61')],_0x198bff,_[_0xe520('0x62')](_0x2eaaef[_0xe520('0x58')])):path['join'](config[_0xe520('0x61')],_0x198bff,_[_0xe520('0x62')](_0xe520('0x63')));var _0x566d6b=_0xe520('0x64')+_['upperFirst'](_0xe520('0x58'));if(_0x2eaaef[_0x566d6b]||!_0x11c772[_0xe520('0x65')]){_0x35582f=path[_0xe520('0x60')](config[_0xe520('0x61')],_0x198bff,_[_0xe520('0x62')](_0xe520('0x63')));}if(!fs[_0xe520('0x66')](_0x35582f)){throw new db[(_0xe520('0x67'))][(_0xe520('0x68'))](_[_0xe520('0x69')](_0xe520('0x58'))+_0xe520('0x6a'));}return _0x23d91d[_0xe520('0x6b')](_0x35582f);}})[_0xe520('0x53')](handleError(_0x23d91d,null));};var utilLicense=require(_0xe520('0x1b'));exports['getLogoLogin']=function(_0x4f6d8e,_0x479836,_0x46f1be){var _0x8ffc43=_0xe520('0x5b');var _0x5403f4={'custom':![]};return utilLicense[_0xe520('0x5c')]()[_0xe520('0x1f')](function(_0x2d75d8){if(_0x2d75d8){_0x5403f4=_0x2d75d8;}return db[_0xe520('0x38')][_0xe520('0x52')]({'where':{'id':_0x4f6d8e[_0xe520('0x55')]['id']},'attributes':[_0xe520('0x58'),'loginLogo','preferred',_0xe520('0x5d'),_0xe520('0x6c'),_0xe520('0x5e'),_0xe520('0x5f'),_0xe520('0x6d')],'raw':!![]});})[_0xe520('0x1f')](handleEntityNotFound(_0x479836,null))['then'](function(_0x8b3e2){if(_0x8b3e2){var _0xa829f4=_0x8b3e2[_0xe520('0x59')]&&fs[_0xe520('0x66')](path[_0xe520('0x60')](config[_0xe520('0x61')],_0x8ffc43,_[_0xe520('0x62')](_0x8b3e2[_0xe520('0x59')])))?path[_0xe520('0x60')](config[_0xe520('0x61')],_0x8ffc43,_[_0xe520('0x62')](_0x8b3e2[_0xe520('0x59')])):path[_0xe520('0x60')](config[_0xe520('0x61')],_0x8ffc43,_[_0xe520('0x62')]('default_loginLogo.svg'));var _0x103618=_0xe520('0x64')+_[_0xe520('0x69')](_0xe520('0x59'));if(_0x8b3e2[_0x103618]||!_0x5403f4['custom']){_0xa829f4=path[_0xe520('0x60')](config[_0xe520('0x61')],_0x8ffc43,_[_0xe520('0x62')]('default_loginLogo.svg'));}if(!fs[_0xe520('0x66')](_0xa829f4)){throw new db['Sequelize'][(_0xe520('0x68'))](_['upperFirst'](_0xe520('0x59'))+_0xe520('0x6a'));}return _0x479836['download'](_0xa829f4);}})['catch'](handleError(_0x479836,null));};exports[_0xe520('0x6e')]=function(_0x58c7d7,_0x294ef6){return db[_0xe520('0x38')]['find']({'where':{'id':_0x58c7d7[_0xe520('0x55')]['id']},'attributes':['securePassword']})['then'](respondWithResult(_0x294ef6,null))[_0xe520('0x53')](handleError(_0x294ef6,null));};exports[_0xe520('0x6f')]=function(_0x4660f4,_0x2731c1,_0x24b657){if(_0x4660f4[_0xe520('0x56')]&&_0x4660f4[_0xe520('0x56')]['filename']){_0x4660f4[_0xe520('0x54')][_0xe520('0x70')]=_0x4660f4[_0xe520('0x56')]['filename'];}return db[_0xe520('0x38')][_0xe520('0x52')]({'where':{'id':_0x4660f4[_0xe520('0x55')]['id']}})[_0xe520('0x1f')](handleEntityNotFound(_0x2731c1,null))[_0xe520('0x1f')](saveUpdates(_0x4660f4[_0xe520('0x54')],null))['then'](respondWithResult(_0x2731c1,null))[_0xe520('0x53')](handleError(_0x2731c1,null));};var utilLicense=require(_0xe520('0x1b'));exports[_0xe520('0x71')]=function(_0x2bf177,_0xb3279b,_0x27d21c){var _0x3a53e1=_0xe520('0x5b');var _0xe2e6b2={'custom':![]};return utilLicense['getLicense']()[_0xe520('0x1f')](function(_0x441754){if(_0x441754){_0xe2e6b2=_0x441754;}return db['Setting'][_0xe520('0x52')]({'where':{'id':_0x2bf177['params']['id']},'attributes':['logo',_0xe520('0x59'),_0xe520('0x70'),_0xe520('0x5d'),_0xe520('0x6c'),_0xe520('0x5e'),_0xe520('0x5f'),_0xe520('0x6d')],'raw':!![]});})[_0xe520('0x1f')](handleEntityNotFound(_0xb3279b,null))[_0xe520('0x1f')](function(_0x46ef0e){if(_0x46ef0e){var _0x7f5cd4=_0x46ef0e[_0xe520('0x70')]&&fs[_0xe520('0x66')](path['join'](config['root'],_0x3a53e1,_['toLower'](_0x46ef0e['preferred'])))?path['join'](config[_0xe520('0x61')],_0x3a53e1,_[_0xe520('0x62')](_0x46ef0e['preferred'])):path[_0xe520('0x60')](config[_0xe520('0x61')],_0x3a53e1,_[_0xe520('0x62')](_0xe520('0x72')));var _0xa12696=_0xe520('0x64')+_[_0xe520('0x69')]('preferred');if(_0x46ef0e[_0xa12696]||!_0xe2e6b2[_0xe520('0x65')]||!_0xe2e6b2[_0xe520('0x70')]){_0x7f5cd4=path[_0xe520('0x60')](config[_0xe520('0x61')],_0x3a53e1,_[_0xe520('0x62')]('default_preferred.png'));}if(!fs[_0xe520('0x66')](_0x7f5cd4)){throw new db[(_0xe520('0x67'))][(_0xe520('0x68'))](_[_0xe520('0x69')](_0xe520('0x70'))+_0xe520('0x6a'));}return _0xb3279b['download'](_0x7f5cd4);}})['catch'](handleError(_0xb3279b,null));};exports[_0xe520('0x73')]=function(_0xb8c6d4,_0x111522,_0x40d7ba){if(_0xb8c6d4[_0xe520('0x56')]&&_0xb8c6d4[_0xe520('0x56')][_0xe520('0x57')]){_0xb8c6d4[_0xe520('0x54')][_0xe520('0x5d')]=_0xb8c6d4[_0xe520('0x56')]['filename'];}return db['Setting'][_0xe520('0x52')]({'where':{'id':_0xb8c6d4[_0xe520('0x55')]['id']}})[_0xe520('0x1f')](handleEntityNotFound(_0x111522,null))[_0xe520('0x1f')](saveUpdates(_0xb8c6d4[_0xe520('0x54')],null))['then'](respondWithResult(_0x111522,null))['catch'](handleError(_0x111522,null));};var utilLicense=require('../../config/license/util');exports[_0xe520('0x74')]=function(_0x3eee7d,_0x169ca9,_0x1201ab){var _0x2770a2=_0xe520('0x5b');var _0x45bea8={'custom':![]};return utilLicense[_0xe520('0x5c')]()[_0xe520('0x1f')](function(_0x356f5b){if(_0x356f5b){_0x45bea8=_0x356f5b;}return db[_0xe520('0x38')][_0xe520('0x52')]({'where':{'id':_0x3eee7d[_0xe520('0x55')]['id']},'attributes':[_0xe520('0x58'),_0xe520('0x59'),'preferred',_0xe520('0x5d'),'defaultLogo',_0xe520('0x5e'),'defaultPreferred',_0xe520('0x6d')],'raw':!![]});})[_0xe520('0x1f')](handleEntityNotFound(_0x169ca9,null))[_0xe520('0x1f')](function(_0x697a7c){if(_0x697a7c){var _0x3893f9=_0x697a7c[_0xe520('0x5d')]&&fs[_0xe520('0x66')](path[_0xe520('0x60')](config[_0xe520('0x61')],_0x2770a2,_[_0xe520('0x62')](_0x697a7c[_0xe520('0x5d')])))?path[_0xe520('0x60')](config[_0xe520('0x61')],_0x2770a2,_[_0xe520('0x62')](_0x697a7c[_0xe520('0x5d')])):path[_0xe520('0x60')](config['root'],_0x2770a2,_['toLower']('default_favicon.ico'));var _0x18ac33=_0xe520('0x64')+_[_0xe520('0x69')]('favicon');if(_0x697a7c[_0x18ac33]||!_0x45bea8[_0xe520('0x65')]){_0x3893f9=path['join'](config['root'],_0x2770a2,_[_0xe520('0x62')](_0xe520('0x75')));}if(!fs[_0xe520('0x66')](_0x3893f9)){throw new db['Sequelize'][(_0xe520('0x68'))](_['upperFirst']('favicon')+_0xe520('0x6a'));}return _0x169ca9[_0xe520('0x6b')](_0x3893f9);}})[_0xe520('0x53')](handleError(_0x169ca9,null));};exports[_0xe520('0x76')]=function(_0x1ffb68,_0x19d9c4){var _0x454f89={'offset':moment()[_0xe520('0x77')]()};_0x454f89[_0xe520('0x78')]=moment()[_0xe520('0x77')](_0x454f89['offset'])[_0xe520('0x79')](_0xe520('0x7a'));return _0x19d9c4['status'](0xc8)[_0xe520('0x7b')](_0x454f89);}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index f65fb35..c3e1101 100644 --- a/server/api/setting/setting.model.js +++ b/server/api/setting/setting.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x008c=['define','settings','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./setting.attributes','exports'];(function(_0x1ad659,_0x1ab26a){var _0x56d7e2=function(_0x3c3f02){while(--_0x3c3f02){_0x1ad659['push'](_0x1ad659['shift']());}};_0x56d7e2(++_0x1ab26a);}(_0x008c,0x188));var _0xc008=function(_0x211f66,_0x6d409f){_0x211f66=_0x211f66-0x0;var _0x324240=_0x008c[_0x211f66];return _0x324240;};'use strict';var _=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var logger=require(_0xc008('0x2'))(_0xc008('0x3'));var moment=require(_0xc008('0x4'));var BPromise=require('bluebird');var rp=require(_0xc008('0x5'));var fs=require('fs');var path=require(_0xc008('0x6'));var rimraf=require(_0xc008('0x7'));var config=require(_0xc008('0x8'));var attributes=require(_0xc008('0x9'));module[_0xc008('0xa')]=function(_0x13aa7,_0x39bb5e){return _0x13aa7[_0xc008('0xb')]('Setting',attributes,{'tableName':_0xc008('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3e74=['exports','Setting','settings','lodash','../../config/logger','api','moment','path','../../config/environment','./setting.attributes'];(function(_0x483e3a,_0x568361){var _0x43fca9=function(_0x273d7e){while(--_0x273d7e){_0x483e3a['push'](_0x483e3a['shift']());}};_0x43fca9(++_0x568361);}(_0x3e74,0x175));var _0x43e7=function(_0x9b6b87,_0x735747){_0x9b6b87=_0x9b6b87-0x0;var _0x151d54=_0x3e74[_0x9b6b87];return _0x151d54;};'use strict';var _=require(_0x43e7('0x0'));var util=require('util');var logger=require(_0x43e7('0x1'))(_0x43e7('0x2'));var moment=require(_0x43e7('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x43e7('0x4'));var rimraf=require('rimraf');var config=require(_0x43e7('0x5'));var attributes=require(_0x43e7('0x6'));module[_0x43e7('0x7')]=function(_0x1c503b,_0xc98b9c){return _0x1c503b['define'](_0x43e7('0x8'),attributes,{'tableName':_0x43e7('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/setting/setting.rpc.js b/server/api/setting/setting.rpc.js index 9bbf660..ba08a6a 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 _0x57d0=['http','request','then','info','Setting,\x20%s,\x20%s','request\x20sent','debug','error','code','message','ShowSetting','Setting','find','options','where','attributes','include','map','model','stringify','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x481ee8,_0x5aa574){var _0x5ad55f=function(_0x81c176){while(--_0x81c176){_0x481ee8['push'](_0x481ee8['shift']());}};_0x5ad55f(++_0x5aa574);}(_0x57d0,0x135));var _0x057d=function(_0x1e48d3,_0x5d8c43){_0x1e48d3=_0x1e48d3-0x0;var _0x2852b1=_0x57d0[_0x1e48d3];return _0x2852b1;};'use strict';var _=require(_0x057d('0x0'));var util=require(_0x057d('0x1'));var moment=require(_0x057d('0x2'));var BPromise=require(_0x057d('0x3'));var rs=require(_0x057d('0x4'));var fs=require('fs');var Redis=require(_0x057d('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x057d('0x6'));var logger=require(_0x057d('0x7'))(_0x057d('0x8'));var config=require(_0x057d('0x9'));var jayson=require(_0x057d('0xa'));var client=jayson['client'][_0x057d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x45f5f5,_0x37a4e6,_0x3ee1e3){return new BPromise(function(_0x1dae28,_0x410b80){return client[_0x057d('0xc')](_0x45f5f5,_0x3ee1e3)[_0x057d('0xd')](function(_0x3fd359){logger[_0x057d('0xe')](_0x057d('0xf'),_0x37a4e6,_0x057d('0x10'));logger[_0x057d('0x11')]('Setting,\x20%s,\x20%s,\x20%s',_0x37a4e6,_0x057d('0x10'),JSON['stringify'](_0x3fd359));if(_0x3fd359[_0x057d('0x12')]){if(_0x3fd359[_0x057d('0x12')][_0x057d('0x13')]===0x1f4){logger[_0x057d('0x12')](_0x057d('0xf'),_0x37a4e6,_0x3fd359[_0x057d('0x12')]['message']);return _0x410b80(_0x3fd359[_0x057d('0x12')][_0x057d('0x14')]);}logger[_0x057d('0x12')]('Setting,\x20%s,\x20%s',_0x37a4e6,_0x3fd359[_0x057d('0x12')][_0x057d('0x14')]);return _0x1dae28(_0x3fd359[_0x057d('0x12')][_0x057d('0x14')]);}else{logger['info'](_0x057d('0xf'),_0x37a4e6,_0x057d('0x10'));_0x1dae28(_0x3fd359['result'][_0x057d('0x14')]);}})['catch'](function(_0x43584f){logger[_0x057d('0x12')](_0x057d('0xf'),_0x37a4e6,_0x43584f);_0x410b80(_0x43584f);});});}exports[_0x057d('0x15')]=function(_0x11574a){var _0x507717=this;return new Promise(function(_0xd0e565,_0xf05982){return db[_0x057d('0x16')][_0x057d('0x17')]({'raw':_0x11574a['options']?_0x11574a[_0x057d('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x11574a[_0x057d('0x18')]?_0x11574a[_0x057d('0x18')][_0x057d('0x19')]||null:null,'attributes':_0x11574a['options']?_0x11574a['options'][_0x057d('0x1a')]||null:null,'include':_0x11574a[_0x057d('0x18')]?_0x11574a['options'][_0x057d('0x1b')]?_[_0x057d('0x1c')](_0x11574a[_0x057d('0x18')][_0x057d('0x1b')],function(_0x31e970){return{'model':db[_0x31e970[_0x057d('0x1d')]],'as':_0x31e970['as'],'attributes':_0x31e970['attributes'],'include':_0x31e970['include']?_[_0x057d('0x1c')](_0x31e970[_0x057d('0x1b')],function(_0x5e627f){return{'model':db[_0x5e627f['model']],'as':_0x5e627f['as'],'attributes':_0x5e627f[_0x057d('0x1a')],'include':_0x5e627f[_0x057d('0x1b')]?_[_0x057d('0x1c')](_0x5e627f[_0x057d('0x1b')],function(_0x2ddcfc){return{'model':db[_0x2ddcfc[_0x057d('0x1d')]],'as':_0x2ddcfc['as'],'attributes':_0x2ddcfc[_0x057d('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x057d('0xd')](function(_0xb67438){logger[_0x057d('0xe')](_0x057d('0x15'),_0x11574a);logger[_0x057d('0x11')]('ShowSetting',_0x11574a,JSON[_0x057d('0x1e')](_0xb67438));_0xd0e565(_0xb67438);})[_0x057d('0x1f')](function(_0x5a631b){logger['error'](_0x057d('0x15'),_0x5a631b['message'],_0x11574a);_0xf05982(_0x507717[_0x057d('0x12')](0x1f4,_0x5a631b[_0x057d('0x14')]));});});}; \ No newline at end of file +var _0xa930=['then','Setting,\x20%s,\x20%s','debug','Setting,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','ShowSetting','find','options','raw','attributes','include','model','map','catch','lodash','util','moment','bluebird','randomstring','../../config/logger','rpc','../../config/environment','client'];(function(_0x2c49a4,_0x50ac70){var _0x1c042f=function(_0x16d8d7){while(--_0x16d8d7){_0x2c49a4['push'](_0x2c49a4['shift']());}};_0x1c042f(++_0x50ac70);}(_0xa930,0x1ef));var _0x0a93=function(_0xc65e1f,_0x3ac3c5){_0xc65e1f=_0xc65e1f-0x0;var _0xbbee91=_0xa930[_0xc65e1f];return _0xbbee91;};'use strict';var _=require(_0x0a93('0x0'));var util=require(_0x0a93('0x1'));var moment=require(_0x0a93('0x2'));var BPromise=require(_0x0a93('0x3'));var rs=require(_0x0a93('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x0a93('0x5'))(_0x0a93('0x6'));var config=require(_0x0a93('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x0a93('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x45d992,_0x5b2e70,_0x31c339){return new BPromise(function(_0x226893,_0x389701){return client['request'](_0x45d992,_0x31c339)[_0x0a93('0x9')](function(_0x3dd01d){logger['info'](_0x0a93('0xa'),_0x5b2e70,'request\x20sent');logger[_0x0a93('0xb')](_0x0a93('0xc'),_0x5b2e70,_0x0a93('0xd'),JSON[_0x0a93('0xe')](_0x3dd01d));if(_0x3dd01d[_0x0a93('0xf')]){if(_0x3dd01d[_0x0a93('0xf')][_0x0a93('0x10')]===0x1f4){logger[_0x0a93('0xf')](_0x0a93('0xa'),_0x5b2e70,_0x3dd01d[_0x0a93('0xf')]['message']);return _0x389701(_0x3dd01d['error'][_0x0a93('0x11')]);}logger[_0x0a93('0xf')](_0x0a93('0xa'),_0x5b2e70,_0x3dd01d['error'][_0x0a93('0x11')]);return _0x226893(_0x3dd01d[_0x0a93('0xf')][_0x0a93('0x11')]);}else{logger[_0x0a93('0x12')](_0x0a93('0xa'),_0x5b2e70,_0x0a93('0xd'));_0x226893(_0x3dd01d['result']['message']);}})['catch'](function(_0x4f78e3){logger['error']('Setting,\x20%s,\x20%s',_0x5b2e70,_0x4f78e3);_0x389701(_0x4f78e3);});});}exports[_0x0a93('0x13')]=function(_0xdf37fe){var _0x13872e=this;return new Promise(function(_0x3fd276,_0x5bf970){return db['Setting'][_0x0a93('0x14')]({'raw':_0xdf37fe[_0x0a93('0x15')]?_0xdf37fe[_0x0a93('0x15')][_0x0a93('0x16')]===undefined?!![]:![]:!![],'where':_0xdf37fe[_0x0a93('0x15')]?_0xdf37fe['options']['where']||null:null,'attributes':_0xdf37fe[_0x0a93('0x15')]?_0xdf37fe['options'][_0x0a93('0x17')]||null:null,'include':_0xdf37fe['options']?_0xdf37fe[_0x0a93('0x15')]['include']?_['map'](_0xdf37fe['options'][_0x0a93('0x18')],function(_0x74d7e6){return{'model':db[_0x74d7e6[_0x0a93('0x19')]],'as':_0x74d7e6['as'],'attributes':_0x74d7e6[_0x0a93('0x17')],'include':_0x74d7e6[_0x0a93('0x18')]?_[_0x0a93('0x1a')](_0x74d7e6[_0x0a93('0x18')],function(_0x8e4539){return{'model':db[_0x8e4539['model']],'as':_0x8e4539['as'],'attributes':_0x8e4539[_0x0a93('0x17')],'include':_0x8e4539[_0x0a93('0x18')]?_[_0x0a93('0x1a')](_0x8e4539[_0x0a93('0x18')],function(_0x511ca1){return{'model':db[_0x511ca1[_0x0a93('0x19')]],'as':_0x511ca1['as'],'attributes':_0x511ca1[_0x0a93('0x17')]};}):[]};}):[]};}):[]:[]})[_0x0a93('0x9')](function(_0x1aa6c6){logger[_0x0a93('0x12')]('ShowSetting',_0xdf37fe);logger[_0x0a93('0xb')]('ShowSetting',_0xdf37fe,JSON[_0x0a93('0xe')](_0x1aa6c6));_0x3fd276(_0x1aa6c6);})[_0x0a93('0x1b')](function(_0x353765){logger[_0x0a93('0xf')]('ShowSetting',_0x353765[_0x0a93('0x11')],_0xdf37fe);_0x5bf970(_0x13872e[_0x0a93('0xf')](0x1f4,_0x353765[_0x0a93('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index b8fdc0d..801aeba 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(_0x25fe5f,_0x553196){var _0x50a435=function(_0x211634){while(--_0x211634){_0x25fe5f['push'](_0x25fe5f['shift']());}};_0x50a435(++_0x553196);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x255d5b,_0x4f6f35){_0x255d5b=_0x255d5b-0x0;var _0x3e141a=_0xc4aa[_0x255d5b];return _0x3e141a;};'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 _0x5fc3=['/:id','show','getDispositions','/:id/canned_answers','/:id/applications','getInteractions','/:id/status','statusGet','post','create','/:id/dispositions','addAnswer','/:id/notify','/:id/send','send','status','/:id/users','put','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./smsAccount.controller','get','isAuthenticated','describe'];(function(_0x36c0c6,_0x5b5e53){var _0x4d3e0a=function(_0x39731c){while(--_0x39731c){_0x36c0c6['push'](_0x36c0c6['shift']());}};_0x4d3e0a(++_0x5b5e53);}(_0x5fc3,0xa8));var _0x35fc=function(_0xcda377,_0x1e2678){_0xcda377=_0xcda377-0x0;var _0x1c024f=_0x5fc3[_0xcda377];return _0x1c024f;};'use strict';var multer=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var path=require('path');var timeout=require(_0x35fc('0x2'));var express=require(_0x35fc('0x3'));var router=express[_0x35fc('0x4')]();var fs_extra=require(_0x35fc('0x5'));var auth=require(_0x35fc('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x35fc('0x7'));var controller=require(_0x35fc('0x8'));router[_0x35fc('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x35fc('0x9')]('/describe',auth[_0x35fc('0xa')](),controller[_0x35fc('0xb')]);router[_0x35fc('0x9')](_0x35fc('0xc'),auth[_0x35fc('0xa')](),controller[_0x35fc('0xd')]);router[_0x35fc('0x9')]('/:id/dispositions',auth[_0x35fc('0xa')](),controller[_0x35fc('0xe')]);router['get'](_0x35fc('0xf'),auth[_0x35fc('0xa')](),controller['getAnswers']);router[_0x35fc('0x9')](_0x35fc('0x10'),auth['isAuthenticated'](),controller['getApplications']);router[_0x35fc('0x9')]('/:id/interactions',auth[_0x35fc('0xa')](),controller[_0x35fc('0x11')]);router[_0x35fc('0x9')](_0x35fc('0x12'),controller[_0x35fc('0x13')]);router['get']('/:id/users',auth['isAuthenticated'](),controller['getAgents']);router[_0x35fc('0x14')]('/',auth[_0x35fc('0xa')](),controller[_0x35fc('0x15')]);router[_0x35fc('0x14')](_0x35fc('0x16'),auth[_0x35fc('0xa')](),controller['addDisposition']);router[_0x35fc('0x14')](_0x35fc('0xf'),auth['isAuthenticated'](),controller[_0x35fc('0x17')]);router[_0x35fc('0x14')](_0x35fc('0x18'),controller['notify']);router[_0x35fc('0x14')](_0x35fc('0x10'),auth[_0x35fc('0xa')](),controller['addApplications']);router[_0x35fc('0x14')](_0x35fc('0x19'),auth[_0x35fc('0xa')](),controller[_0x35fc('0x1a')]);router[_0x35fc('0x14')](_0x35fc('0x12'),controller[_0x35fc('0x1b')]);router[_0x35fc('0x14')](_0x35fc('0x1c'),auth[_0x35fc('0xa')](),controller['addAgents']);router[_0x35fc('0x1d')](_0x35fc('0xc'),auth[_0x35fc('0xa')](),controller[_0x35fc('0x1e')]);router[_0x35fc('0x1f')]('/:id',auth[_0x35fc('0xa')](),controller[_0x35fc('0x20')]);router['delete'](_0x35fc('0x16'),auth[_0x35fc('0xa')](),controller[_0x35fc('0x21')]);router['delete'](_0x35fc('0xf'),auth['isAuthenticated'](),controller[_0x35fc('0x22')]);router[_0x35fc('0x1f')]('/:id/users',auth['isAuthenticated'](),controller[_0x35fc('0x23')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.attributes.js b/server/api/smsAccount/smsAccount.attributes.js index f4d26db..080d8a9 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 _0x55c4=['INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','setDataValue','mandatoryDisposition','sequelize','randomstring','exports','STRING','ENUM','twilio','skebby','connectel','bandwidth','csc','infobip','intelepeer','BOOLEAN','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}'];(function(_0x35f9d8,_0x4e2b64){var _0x15162c=function(_0x5cc2ea){while(--_0x5cc2ea){_0x35f9d8['push'](_0x35f9d8['shift']());}};_0x15162c(++_0x4e2b64);}(_0x55c4,0x180));var _0x455c=function(_0x15b522,_0x16a02b){_0x15b522=_0x15b522-0x0;var _0x22a0d3=_0x55c4[_0x15b522];return _0x22a0d3;};'use strict';var Sequelize=require(_0x455c('0x0'));var rs=require(_0x455c('0x1'));module[_0x455c('0x2')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![]},'key':{'type':Sequelize[_0x455c('0x3')],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs['generate']();}},'phone':{'type':Sequelize[_0x455c('0x3')]},'type':{'type':Sequelize[_0x455c('0x4')](_0x455c('0x5'),_0x455c('0x6'),_0x455c('0x7'),'clicksend','plivo','clickatell',_0x455c('0x8'),_0x455c('0x9'),_0x455c('0xa'),_0x455c('0xb'))},'accountSid':{'type':Sequelize[_0x455c('0x3')]},'authId':{'type':Sequelize[_0x455c('0x3')]},'authToken':{'type':Sequelize['STRING']},'smsMethod':{'type':Sequelize[_0x455c('0x4')]('SI','TI','GP')},'username':{'type':Sequelize[_0x455c('0x3')]},'password':{'type':Sequelize[_0x455c('0x3')]},'apiKey':{'type':Sequelize[_0x455c('0x3')]},'applicationId':{'type':Sequelize[_0x455c('0x3')]},'accountId':{'type':Sequelize[_0x455c('0x3')]},'senderString':{'type':Sequelize[_0x455c('0x3')]},'deliveryReport':{'type':Sequelize[_0x455c('0xc')],'defaultValue':![]},'description':{'type':Sequelize[_0x455c('0x3')]},'notificationTemplate':{'type':Sequelize[_0x455c('0xd')],'defaultValue':function(){return _0x455c('0xe');}},'notificationSound':{'type':Sequelize[_0x455c('0xc')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x455c('0xc')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x455c('0xc')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x455c('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x455c('0xc')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x455c('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0x455c('0x3')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x455c('0xf')],'comment':_0x455c('0x10')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x455c('0x11'),'set':function(_0xb2916e){if(!_0xb2916e)this['setDataValue'](_0x455c('0x12'),null);this[_0x455c('0x13')](_0x455c('0x14'),_0xb2916e);}}}; \ No newline at end of file +var _0x9ff4=['randomstring','exports','STRING','name','generate','twilio','skebby','clickatell','bandwidth','csc','infobip','ENUM','BOOLEAN','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition'];(function(_0x5abf93,_0x3fb6c9){var _0x5b2f78=function(_0x57f994){while(--_0x57f994){_0x5abf93['push'](_0x5abf93['shift']());}};_0x5b2f78(++_0x3fb6c9);}(_0x9ff4,0x69));var _0x49ff=function(_0x13eb2e,_0x47965c){_0x13eb2e=_0x13eb2e-0x0;var _0x112507=_0x9ff4[_0x13eb2e];return _0x112507;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x49ff('0x0'));module[_0x49ff('0x1')]={'name':{'type':Sequelize[_0x49ff('0x2')],'unique':_0x49ff('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0x49ff('0x2')],'allowNull':![]},'remote':{'type':Sequelize[_0x49ff('0x2')],'allowNull':![]},'token':{'type':Sequelize[_0x49ff('0x2')],'defaultValue':function(){return rs[_0x49ff('0x4')]();}},'phone':{'type':Sequelize[_0x49ff('0x2')]},'type':{'type':Sequelize['ENUM'](_0x49ff('0x5'),_0x49ff('0x6'),'connectel','clicksend','plivo',_0x49ff('0x7'),_0x49ff('0x8'),_0x49ff('0x9'),_0x49ff('0xa'),'intelepeer')},'accountSid':{'type':Sequelize['STRING']},'authId':{'type':Sequelize[_0x49ff('0x2')]},'authToken':{'type':Sequelize[_0x49ff('0x2')]},'smsMethod':{'type':Sequelize[_0x49ff('0xb')]('SI','TI','GP')},'username':{'type':Sequelize[_0x49ff('0x2')]},'password':{'type':Sequelize['STRING']},'apiKey':{'type':Sequelize[_0x49ff('0x2')]},'applicationId':{'type':Sequelize[_0x49ff('0x2')]},'accountId':{'type':Sequelize[_0x49ff('0x2')]},'senderString':{'type':Sequelize['STRING']},'deliveryReport':{'type':Sequelize[_0x49ff('0xc')],'defaultValue':![]},'description':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0x49ff('0xd')],'defaultValue':function(){return _0x49ff('0xe');}},'notificationSound':{'type':Sequelize[_0x49ff('0xc')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x49ff('0xc')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x49ff('0xc')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x49ff('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x49ff('0xc')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x49ff('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0x49ff('0x2')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x49ff('0xf')],'comment':_0x49ff('0x10')},'mandatoryDisposition':{'type':Sequelize[_0x49ff('0xc')],'defaultValue':![],'comment':_0x49ff('0x11'),'set':function(_0x441a29){if(!_0x441a29)this[_0x49ff('0x12')](_0x49ff('0x13'),null);this[_0x49ff('0x12')](_0x49ff('0x14'),_0x441a29);}}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index f77f325..2508b0e 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 _0x7e3d=['debug','SmsAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','SmsAccount,\x20%s,\x20%s','result','catch','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','get','SmsAccounts','UserProfileResource','destroy','sendStatus','stack','name','index','Pause','SmsAccount','rawAttributes','type','key','model','map','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','rows','params','mandatoryDispositionPause','fields','include','find','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addDisposition','SmsAccountId','Disposition','getDispositions','findOne','order','findAll','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','notify','sms','SmsApplication','Applications','applications','orderBy','priority','asc','account','CmContact','describe','Sequelize','difference','createdAt','updatedAt','CompanyId','twilio','from','Body','messageId','MessageSid','sender','text','connectel','clicksend','message_id','plivo','From','Text','MessageUUID','infobip','results','csc','originatingAddress','segmentedMessage','clickatell','replyMessageId','intelepeer','ValidationError','from\x20is\x20mandatory','isNil','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','ListId','Contacts','DESC','list','omit','contact','SmsInteraction','interaction','created','push','unmanaged','SmsMessage','AttachmentId','User','UserId','unshift','agent','waitForTheAssignedAgent','startRouting','receiveMessage','entity\x20found','Content-Type','text/xml','send','\x0a','addApplications','bulkCreate','findAndCountAll','getApplications','getInteractions','Contact','Owner','tag','to\x20is\x20mandatory','List','out','Messages','dataValues','inspect','skebby','skebby_dispatch_id','requestid','statusInt','status_code','groupName','DELIVERED','redif','error_code','RECEIVED_BY_RECIPIENT','bandwidth','message-delivered','DELIVRD','ACCEPTD','statusGet','received\x20delivery\x20report\x20from','state','message-id','spread','userSmsAccount:save','removeAgents','isArray','emit','userSmsAccount:remove','getAgents','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','register','jayson/promise','client','http','info'];(function(_0x481784,_0x5cb506){var _0x92d05e=function(_0x1296c8){while(--_0x1296c8){_0x481784['push'](_0x481784['shift']());}};_0x92d05e(++_0x5cb506);}(_0x7e3d,0xbf));var _0xd7e3=function(_0x53145d,_0x2d1e61){_0x53145d=_0x53145d-0x0;var _0x365739=_0x7e3d[_0x53145d];return _0x365739;};'use strict';var emlformat=require(_0xd7e3('0x0'));var rimraf=require(_0xd7e3('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd7e3('0x2'));var rp=require(_0xd7e3('0x3'));var moment=require(_0xd7e3('0x4'));var BPromise=require(_0xd7e3('0x5'));var Mustache=require('mustache');var util=require(_0xd7e3('0x6'));var path=require(_0xd7e3('0x7'));var sox=require(_0xd7e3('0x8'));var csv=require(_0xd7e3('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd7e3('0xa'));var squel=require(_0xd7e3('0xb'));var crypto=require(_0xd7e3('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xd7e3('0xd'));var toCsv=require(_0xd7e3('0x9'));var querystring=require(_0xd7e3('0xe'));var Papa=require(_0xd7e3('0xf'));var Redis=require('ioredis');var authService=require(_0xd7e3('0x10'));var qs=require(_0xd7e3('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xd7e3('0x12'));var utils=require('../../config/utils');var config=require(_0xd7e3('0x13'));var licenseUtil=require(_0xd7e3('0x14'));var db=require(_0xd7e3('0x15'))['db'];config[_0xd7e3('0x16')]=_[_0xd7e3('0x17')](config[_0xd7e3('0x16')],{'host':_0xd7e3('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd7e3('0x16')]));require('./smsAccount.socket')[_0xd7e3('0x19')](socket);var jayson=require(_0xd7e3('0x1a'));var client=jayson[_0xd7e3('0x1b')][_0xd7e3('0x1c')]({'port':0x232c});function respondWithRpcPromise(_0x271da1,_0x53fed6,_0x5e48fc,_0x3ffa51){return new BPromise(function(_0x15f114,_0x5a93c3){var _0x1b2d3a=_0x3ffa51||client;return _0x1b2d3a['request'](_0x271da1,_0x5e48fc)['then'](function(_0x585dad){logger[_0xd7e3('0x1d')]('SmsAccount,\x20%s,\x20%s',_0x53fed6,'request\x20sent');logger[_0xd7e3('0x1e')](_0xd7e3('0x1f'),_0x53fed6,_0xd7e3('0x20'),JSON[_0xd7e3('0x21')](_0x585dad));if(_0x585dad[_0xd7e3('0x22')]){if(_0x585dad[_0xd7e3('0x22')]['code']===0x1f4){logger[_0xd7e3('0x22')]('SmsAccount,\x20%s,\x20%s',_0x53fed6,_0x585dad[_0xd7e3('0x22')][_0xd7e3('0x23')]);return _0x5a93c3(_0x585dad[_0xd7e3('0x22')][_0xd7e3('0x23')]);}logger[_0xd7e3('0x22')](_0xd7e3('0x24'),_0x53fed6,_0x585dad[_0xd7e3('0x22')]['message']);return _0x15f114(_0x585dad['error'][_0xd7e3('0x23')]);}else{logger[_0xd7e3('0x1d')](_0xd7e3('0x24'),_0x53fed6,_0xd7e3('0x20'));_0x15f114(_0x585dad[_0xd7e3('0x25')][_0xd7e3('0x23')]);}})[_0xd7e3('0x26')](function(_0x3a3dba){logger[_0xd7e3('0x22')](_0xd7e3('0x24'),_0x53fed6,_0x3a3dba);_0x5a93c3(_0x3a3dba);});});}function respondWithStatusCode(_0x172816,_0x8db0ce){_0x8db0ce=_0x8db0ce||0xcc;return function(_0x18967e){if(_0x18967e){return _0x172816['sendStatus'](_0x8db0ce);}return _0x172816[_0xd7e3('0x27')](_0x8db0ce)[_0xd7e3('0x28')]();};}function respondWithResult(_0x32ec9d,_0x9ec4b6){_0x9ec4b6=_0x9ec4b6||0xc8;return function(_0x27fafb){if(_0x27fafb){return _0x32ec9d['status'](_0x9ec4b6)[_0xd7e3('0x29')](_0x27fafb);}};}function respondWithFilteredResult(_0x1e8941,_0x1b6b30){return function(_0x23472f){if(_0x23472f){var _0x1d2e78=typeof _0x1b6b30[_0xd7e3('0x2a')]===_0xd7e3('0x2b')&&typeof _0x1b6b30['limit']===_0xd7e3('0x2b');var _0x12c8a2=_0x23472f[_0xd7e3('0x2c')];var _0xf554b=_0x1d2e78?0x0:_0x1b6b30[_0xd7e3('0x2a')];var _0x368100=_0x1d2e78?_0x23472f[_0xd7e3('0x2c')]:_0x1b6b30['offset']+_0x1b6b30[_0xd7e3('0x2d')];var _0x41bcf4;if(_0x368100>=_0x12c8a2){_0x368100=_0x12c8a2;_0x41bcf4=0xc8;}else{_0x41bcf4=0xce;}_0x1e8941['status'](_0x41bcf4);return _0x1e8941[_0xd7e3('0x2e')](_0xd7e3('0x2f'),_0xf554b+'-'+_0x368100+'/'+_0x12c8a2)[_0xd7e3('0x29')](_0x23472f);}return null;};}function patchUpdates(_0x3af089){return function(_0x359a12){try{jsonpatch[_0xd7e3('0x30')](_0x359a12,_0x3af089,!![]);}catch(_0x599507){return BPromise[_0xd7e3('0x31')](_0x599507);}return _0x359a12[_0xd7e3('0x32')]();};}function saveUpdates(_0x4398fc,_0x32beea){return function(_0x5ef433){if(_0x5ef433){return _0x5ef433[_0xd7e3('0x33')](_0x4398fc)['then'](function(_0x4e2915){return _0x4e2915;});}return null;};}function removeEntity(_0x34adae,_0x4da968){return function(_0x23872a){if(_0x23872a){return _0x23872a['destroy']()[_0xd7e3('0x34')](function(){var _0x14149e=_0x23872a[_0xd7e3('0x35')]({'plain':!![]});var _0x43f56f=_0xd7e3('0x36');return db[_0xd7e3('0x37')][_0xd7e3('0x38')]({'where':{'type':_0x43f56f,'resourceId':_0x14149e['id']}})[_0xd7e3('0x34')](function(){return _0x23872a;});})[_0xd7e3('0x34')](function(){_0x34adae[_0xd7e3('0x27')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2e6332,_0x2b7f8a){return function(_0x2e5b71){if(!_0x2e5b71){_0x2e6332[_0xd7e3('0x39')](0x194);}return _0x2e5b71;};}function handleError(_0x59495b,_0x4c0634){_0x4c0634=_0x4c0634||0x1f4;return function(_0x211d9f){logger[_0xd7e3('0x22')](_0x211d9f[_0xd7e3('0x3a')]);if(_0x211d9f[_0xd7e3('0x3b')]){delete _0x211d9f['name'];}_0x59495b[_0xd7e3('0x27')](_0x4c0634)['send'](_0x211d9f);};}exports[_0xd7e3('0x3c')]=function(_0x37731a,_0x42827b){var _0x1c29d6={'include':[{'model':db[_0xd7e3('0x3d')],'as':'mandatoryDispositionPause'}]},_0x36ef46={},_0x425af7={'count':0x0,'rows':[]};var _0x667351=_['map'](db[_0xd7e3('0x3e')][_0xd7e3('0x3f')],function(_0x42ccd5){return{'name':_0x42ccd5['fieldName'],'type':_0x42ccd5[_0xd7e3('0x40')][_0xd7e3('0x41')]};});_0x36ef46[_0xd7e3('0x42')]=_[_0xd7e3('0x43')](_0x667351,_0xd7e3('0x3b'));_0x36ef46[_0xd7e3('0x44')]=_[_0xd7e3('0x45')](_0x37731a[_0xd7e3('0x44')]);_0x36ef46[_0xd7e3('0x46')]=_[_0xd7e3('0x47')](_0x36ef46[_0xd7e3('0x42')],_0x36ef46[_0xd7e3('0x44')]);_0x1c29d6[_0xd7e3('0x48')]=_[_0xd7e3('0x47')](_0x36ef46['model'],qs['fields'](_0x37731a[_0xd7e3('0x44')]['fields']));_0x1c29d6['attributes']=_0x1c29d6[_0xd7e3('0x48')][_0xd7e3('0x49')]?_0x1c29d6[_0xd7e3('0x48')]:_0x36ef46[_0xd7e3('0x42')];if(!_0x37731a[_0xd7e3('0x44')][_0xd7e3('0x4a')](_0xd7e3('0x4b'))){_0x1c29d6['limit']=qs[_0xd7e3('0x2d')](_0x37731a['query']['limit']);_0x1c29d6[_0xd7e3('0x2a')]=qs[_0xd7e3('0x2a')](_0x37731a[_0xd7e3('0x44')][_0xd7e3('0x2a')]);}_0x1c29d6['order']=qs['sort'](_0x37731a[_0xd7e3('0x44')][_0xd7e3('0x4c')]);_0x1c29d6[_0xd7e3('0x4d')]=qs['filters'](_[_0xd7e3('0x4e')](_0x37731a[_0xd7e3('0x44')],_0x36ef46['filters']),_0x667351);if(_0x37731a[_0xd7e3('0x44')][_0xd7e3('0x4f')]){_0x1c29d6[_0xd7e3('0x4d')]=_[_0xd7e3('0x50')](_0x1c29d6[_0xd7e3('0x4d')],{'$or':_[_0xd7e3('0x43')](_0x667351,function(_0x49bd9a){if(_0x49bd9a[_0xd7e3('0x40')]!==_0xd7e3('0x51')){var _0xbe061d={};_0xbe061d[_0x49bd9a[_0xd7e3('0x3b')]]={'$like':'%'+_0x37731a['query'][_0xd7e3('0x4f')]+'%'};return _0xbe061d;}})});}_0x1c29d6=_[_0xd7e3('0x50')]({},_0x1c29d6,_0x37731a[_0xd7e3('0x52')]);var _0x30c959={'where':_0x1c29d6[_0xd7e3('0x4d')]};return db[_0xd7e3('0x3e')][_0xd7e3('0x2c')](_0x30c959)[_0xd7e3('0x34')](function(_0x102cfb){_0x425af7['count']=_0x102cfb;if(_0x37731a[_0xd7e3('0x44')][_0xd7e3('0x53')]){_0x1c29d6['include']=[{'all':!![]}];}return db[_0xd7e3('0x3e')]['findAll'](_0x1c29d6);})[_0xd7e3('0x34')](function(_0x1b2049){_0x425af7[_0xd7e3('0x54')]=_0x1b2049;return _0x425af7;})[_0xd7e3('0x34')](respondWithFilteredResult(_0x42827b,_0x1c29d6))[_0xd7e3('0x26')](handleError(_0x42827b,null));};exports['show']=function(_0x5076c4,_0x197b6a){var _0x125a4d={'raw':![],'where':{'id':_0x5076c4[_0xd7e3('0x55')]['id']},'include':[{'model':db[_0xd7e3('0x3d')],'as':_0xd7e3('0x56')}]},_0x448d1e={};_0x448d1e[_0xd7e3('0x42')]=_[_0xd7e3('0x45')](db[_0xd7e3('0x3e')][_0xd7e3('0x3f')]);_0x448d1e[_0xd7e3('0x44')]=_[_0xd7e3('0x45')](_0x5076c4[_0xd7e3('0x44')]);_0x448d1e[_0xd7e3('0x46')]=_['intersection'](_0x448d1e[_0xd7e3('0x42')],_0x448d1e['query']);_0x125a4d['attributes']=_[_0xd7e3('0x47')](_0x448d1e['model'],qs[_0xd7e3('0x57')](_0x5076c4[_0xd7e3('0x44')][_0xd7e3('0x57')]));_0x125a4d[_0xd7e3('0x48')]=_0x125a4d[_0xd7e3('0x48')][_0xd7e3('0x49')]?_0x125a4d['attributes']:_0x448d1e[_0xd7e3('0x42')];if(_0x5076c4['query'][_0xd7e3('0x53')]){_0x125a4d[_0xd7e3('0x58')]=[{'all':!![]}];}_0x125a4d=_[_0xd7e3('0x50')]({},_0x125a4d,_0x5076c4['options']);return db[_0xd7e3('0x3e')][_0xd7e3('0x59')](_0x125a4d)[_0xd7e3('0x34')](handleEntityNotFound(_0x197b6a,null))[_0xd7e3('0x34')](respondWithResult(_0x197b6a,null))[_0xd7e3('0x26')](handleError(_0x197b6a,null));};exports[_0xd7e3('0x5a')]=function(_0x771f92,_0x548d39){return db[_0xd7e3('0x3e')][_0xd7e3('0x5a')](_0x771f92[_0xd7e3('0x5b')],{})[_0xd7e3('0x34')](function(_0x345653){var _0xec1ff=_0x771f92[_0xd7e3('0x5c')][_0xd7e3('0x35')]({'plain':!![]});if(!_0xec1ff)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xec1ff[_0xd7e3('0x5d')]===_0xd7e3('0x5c')){var _0x1fdecc=_0x345653[_0xd7e3('0x35')]({'plain':!![]});var _0x203eb7='SmsAccounts';return db[_0xd7e3('0x5e')][_0xd7e3('0x59')]({'where':{'name':_0x203eb7,'userProfileId':_0xec1ff[_0xd7e3('0x5f')]},'raw':!![]})[_0xd7e3('0x34')](function(_0x32e993){if(_0x32e993&&_0x32e993[_0xd7e3('0x60')]===0x0){return db[_0xd7e3('0x37')]['create']({'name':_0x1fdecc[_0xd7e3('0x3b')],'resourceId':_0x1fdecc['id'],'type':_0x32e993[_0xd7e3('0x3b')],'sectionId':_0x32e993['id']},{})[_0xd7e3('0x34')](function(){return _0x345653;});}else{return _0x345653;}})[_0xd7e3('0x26')](function(_0xab4f61){logger[_0xd7e3('0x22')](_0xd7e3('0x61'),_0xab4f61);throw _0xab4f61;});}return _0x345653;})[_0xd7e3('0x34')](respondWithResult(_0x548d39,0xc9))[_0xd7e3('0x26')](handleError(_0x548d39,null));};exports[_0xd7e3('0x33')]=function(_0x4fd993,_0x279b0c){if(_0x4fd993['body']['id']){delete _0x4fd993['body']['id'];}return db[_0xd7e3('0x3e')]['find']({'where':{'id':_0x4fd993[_0xd7e3('0x55')]['id']},'include':[{'model':db[_0xd7e3('0x3d')],'as':'mandatoryDispositionPause'}]})['then'](handleEntityNotFound(_0x279b0c,null))[_0xd7e3('0x34')](saveUpdates(_0x4fd993[_0xd7e3('0x5b')],null))[_0xd7e3('0x34')](respondWithResult(_0x279b0c,null))['catch'](handleError(_0x279b0c,null));};exports[_0xd7e3('0x38')]=function(_0x1d056f,_0x2db667){return db[_0xd7e3('0x3e')][_0xd7e3('0x59')]({'where':{'id':_0x1d056f['params']['id']}})['then'](handleEntityNotFound(_0x2db667,null))[_0xd7e3('0x34')](removeEntity(_0x2db667,null))[_0xd7e3('0x26')](handleError(_0x2db667,null));};exports['describe']=function(_0x17f3df,_0x124ea8){return db[_0xd7e3('0x3e')]['describe']()[_0xd7e3('0x34')](respondWithResult(_0x124ea8,null))[_0xd7e3('0x26')](handleError(_0x124ea8,null));};exports[_0xd7e3('0x62')]=function(_0x5d883b,_0x30ceab,_0x4abc44){if(_0x5d883b['body']['id']){delete _0x5d883b[_0xd7e3('0x5b')]['id'];}return db[_0xd7e3('0x3e')][_0xd7e3('0x59')]({'where':{'id':_0x5d883b[_0xd7e3('0x55')]['id']}})[_0xd7e3('0x34')](handleEntityNotFound(_0x30ceab,null))[_0xd7e3('0x34')](function(_0x20e367){if(_0x20e367){_0x5d883b[_0xd7e3('0x5b')][_0xd7e3('0x63')]=_0x20e367['id'];return db[_0xd7e3('0x64')]['create'](_0x5d883b['body']);}})[_0xd7e3('0x34')](respondWithResult(_0x30ceab,null))[_0xd7e3('0x26')](handleError(_0x30ceab,null));};exports[_0xd7e3('0x65')]=function(_0x46a04e,_0x4fb094,_0xdc42b3){var _0x239250={'raw':![],'where':{}};var _0x269217={};var _0x2fe743={'count':0x0,'rows':[]};return db[_0xd7e3('0x3e')][_0xd7e3('0x66')]({'where':{'id':_0x46a04e[_0xd7e3('0x55')]['id']}})[_0xd7e3('0x34')](handleEntityNotFound(_0x4fb094,null))['then'](function(_0x1ed9cd){if(_0x1ed9cd){_0x269217[_0xd7e3('0x42')]=_[_0xd7e3('0x45')](db['Disposition'][_0xd7e3('0x3f')]);_0x269217['query']=_['keys'](_0x46a04e[_0xd7e3('0x44')]);_0x269217[_0xd7e3('0x46')]=_[_0xd7e3('0x47')](_0x269217[_0xd7e3('0x42')],_0x269217[_0xd7e3('0x44')]);_0x239250[_0xd7e3('0x48')]=_['intersection'](_0x269217[_0xd7e3('0x42')],qs[_0xd7e3('0x57')](_0x46a04e[_0xd7e3('0x44')]['fields']));_0x239250['attributes']=_0x239250[_0xd7e3('0x48')]['length']?_0x239250[_0xd7e3('0x48')]:_0x269217[_0xd7e3('0x42')];if(!_0x46a04e[_0xd7e3('0x44')][_0xd7e3('0x4a')]('nolimit')){_0x239250['limit']=qs['limit'](_0x46a04e[_0xd7e3('0x44')][_0xd7e3('0x2d')]);_0x239250[_0xd7e3('0x2a')]=qs[_0xd7e3('0x2a')](_0x46a04e[_0xd7e3('0x44')][_0xd7e3('0x2a')]);}_0x239250[_0xd7e3('0x67')]=qs[_0xd7e3('0x4c')](_0x46a04e[_0xd7e3('0x44')][_0xd7e3('0x4c')]);_0x239250[_0xd7e3('0x4d')]=qs[_0xd7e3('0x46')](_[_0xd7e3('0x4e')](_0x46a04e[_0xd7e3('0x44')],_0x269217[_0xd7e3('0x46')]));_0x239250[_0xd7e3('0x4d')]['SmsAccountId']=_0x1ed9cd['id'];if(_0x46a04e[_0xd7e3('0x44')][_0xd7e3('0x4f')]){_0x239250[_0xd7e3('0x4d')]=_[_0xd7e3('0x50')](_0x239250[_0xd7e3('0x4d')],{'$or':_[_0xd7e3('0x43')](_0x239250[_0xd7e3('0x48')],function(_0x5b4045){var _0x2bda0b={};_0x2bda0b[_0x5b4045]={'$like':'%'+_0x46a04e[_0xd7e3('0x44')][_0xd7e3('0x4f')]+'%'};return _0x2bda0b;})});}_0x239250=_[_0xd7e3('0x50')]({},_0x239250,_0x46a04e[_0xd7e3('0x52')]);return db[_0xd7e3('0x64')][_0xd7e3('0x2c')]({'where':_0x239250[_0xd7e3('0x4d')]})[_0xd7e3('0x34')](function(_0x53935d){_0x2fe743[_0xd7e3('0x2c')]=_0x53935d;if(_0x46a04e[_0xd7e3('0x44')][_0xd7e3('0x53')]){_0x239250[_0xd7e3('0x58')]=[{'all':!![]}];}return db[_0xd7e3('0x64')][_0xd7e3('0x68')](_0x239250);})[_0xd7e3('0x34')](function(_0x271e81){_0x2fe743[_0xd7e3('0x54')]=_0x271e81;return _0x2fe743;});}})[_0xd7e3('0x34')](respondWithFilteredResult(_0x4fb094,_0x239250))['catch'](handleError(_0x4fb094,null));};exports['removeDispositions']=function(_0xbc44a2,_0x238b3a,_0x56fab2){return db[_0xd7e3('0x3e')][_0xd7e3('0x59')]({'where':{'id':_0xbc44a2[_0xd7e3('0x55')]['id']}})[_0xd7e3('0x34')](handleEntityNotFound(_0x238b3a,null))['then'](function(_0x8e65b9){if(_0x8e65b9){return _0x8e65b9[_0xd7e3('0x69')](_0xbc44a2[_0xd7e3('0x44')][_0xd7e3('0x6a')]);}})['then'](respondWithStatusCode(_0x238b3a,null))['catch'](handleError(_0x238b3a,null));};exports[_0xd7e3('0x6b')]=function(_0x491189,_0x48f195,_0x546f74){if(_0x491189['body']['id']){delete _0x491189[_0xd7e3('0x5b')]['id'];}return db[_0xd7e3('0x3e')]['find']({'where':{'id':_0x491189[_0xd7e3('0x55')]['id']}})[_0xd7e3('0x34')](handleEntityNotFound(_0x48f195,null))[_0xd7e3('0x34')](function(_0x23191d){if(_0x23191d){_0x491189['body']['SmsAccountId']=_0x23191d['id'];return db[_0xd7e3('0x6c')][_0xd7e3('0x5a')](_0x491189[_0xd7e3('0x5b')]);}})[_0xd7e3('0x34')](respondWithResult(_0x48f195,null))[_0xd7e3('0x26')](handleError(_0x48f195,null));};exports[_0xd7e3('0x6d')]=function(_0x5f3fb3,_0xd648d6,_0xe5880){var _0x195898={'raw':![],'where':{}};var _0x3a8095={};var _0x4a1c96={'count':0x0,'rows':[]};return db[_0xd7e3('0x3e')]['findOne']({'where':{'id':_0x5f3fb3[_0xd7e3('0x55')]['id']}})[_0xd7e3('0x34')](handleEntityNotFound(_0xd648d6,null))[_0xd7e3('0x34')](function(_0x1b049f){if(_0x1b049f){_0x3a8095[_0xd7e3('0x42')]=_['keys'](db[_0xd7e3('0x6c')][_0xd7e3('0x3f')]);_0x3a8095['query']=_[_0xd7e3('0x45')](_0x5f3fb3[_0xd7e3('0x44')]);_0x3a8095[_0xd7e3('0x46')]=_[_0xd7e3('0x47')](_0x3a8095['model'],_0x3a8095[_0xd7e3('0x44')]);_0x195898[_0xd7e3('0x48')]=_[_0xd7e3('0x47')](_0x3a8095[_0xd7e3('0x42')],qs[_0xd7e3('0x57')](_0x5f3fb3['query'][_0xd7e3('0x57')]));_0x195898[_0xd7e3('0x48')]=_0x195898[_0xd7e3('0x48')][_0xd7e3('0x49')]?_0x195898['attributes']:_0x3a8095[_0xd7e3('0x42')];if(!_0x5f3fb3[_0xd7e3('0x44')]['hasOwnProperty'](_0xd7e3('0x4b'))){_0x195898[_0xd7e3('0x2d')]=qs[_0xd7e3('0x2d')](_0x5f3fb3[_0xd7e3('0x44')][_0xd7e3('0x2d')]);_0x195898['offset']=qs[_0xd7e3('0x2a')](_0x5f3fb3[_0xd7e3('0x44')][_0xd7e3('0x2a')]);}_0x195898[_0xd7e3('0x67')]=qs[_0xd7e3('0x4c')](_0x5f3fb3['query'][_0xd7e3('0x4c')]);_0x195898[_0xd7e3('0x4d')]=qs['filters'](_[_0xd7e3('0x4e')](_0x5f3fb3[_0xd7e3('0x44')],_0x3a8095[_0xd7e3('0x46')]));_0x195898[_0xd7e3('0x4d')]['SmsAccountId']=_0x1b049f['id'];if(_0x5f3fb3['query']['filter']){_0x195898['where']=_[_0xd7e3('0x50')](_0x195898['where'],{'$or':_['map'](_0x195898['attributes'],function(_0x191b46){var _0x1bc18a={};_0x1bc18a[_0x191b46]={'$like':'%'+_0x5f3fb3[_0xd7e3('0x44')][_0xd7e3('0x4f')]+'%'};return _0x1bc18a;})});}_0x195898=_[_0xd7e3('0x50')]({},_0x195898,_0x5f3fb3[_0xd7e3('0x52')]);return db[_0xd7e3('0x6c')][_0xd7e3('0x2c')]({'where':_0x195898[_0xd7e3('0x4d')]})[_0xd7e3('0x34')](function(_0x5d7761){_0x4a1c96[_0xd7e3('0x2c')]=_0x5d7761;if(_0x5f3fb3[_0xd7e3('0x44')]['includeAll']){_0x195898['include']=[{'all':!![]}];}return db[_0xd7e3('0x6c')][_0xd7e3('0x68')](_0x195898);})[_0xd7e3('0x34')](function(_0x4086fb){_0x4a1c96[_0xd7e3('0x54')]=_0x4086fb;return _0x4a1c96;});}})[_0xd7e3('0x34')](respondWithFilteredResult(_0xd648d6,_0x195898))[_0xd7e3('0x26')](handleError(_0xd648d6,null));};exports[_0xd7e3('0x6e')]=function(_0x14b136,_0x3ff8c6,_0x1a77c9){return db[_0xd7e3('0x3e')]['find']({'where':{'id':_0x14b136[_0xd7e3('0x55')]['id']}})[_0xd7e3('0x34')](handleEntityNotFound(_0x3ff8c6,null))[_0xd7e3('0x34')](function(_0x4bc5c6){if(_0x4bc5c6){return _0x4bc5c6[_0xd7e3('0x6e')](_0x14b136[_0xd7e3('0x44')][_0xd7e3('0x6a')]);}})[_0xd7e3('0x34')](respondWithStatusCode(_0x3ff8c6,null))[_0xd7e3('0x26')](handleError(_0x3ff8c6,null));};exports[_0xd7e3('0x6f')]=function(_0x100076,_0x4213bf,_0x205bd6){var _0x177800={'channel':_0xd7e3('0x70')};var _0xb84b4b=[];var _0x39c2ad=[];var _0x59df84={};return db[_0xd7e3('0x3e')][_0xd7e3('0x59')]({'where':{'id':_0x100076[_0xd7e3('0x55')]['id']},'include':[{'model':db[_0xd7e3('0x71')],'as':_0xd7e3('0x72')}]})[_0xd7e3('0x34')](handleEntityNotFound(_0x4213bf,null))[_0xd7e3('0x34')](function(_0x56a5ed){_0x177800['account']=_0x56a5ed;_0x177800[_0xd7e3('0x73')]=_[_0xd7e3('0x74')](_0x56a5ed[_0xd7e3('0x72')],[_0xd7e3('0x75')],[_0xd7e3('0x76')]);if(_0x177800[_0xd7e3('0x77')]['Applications']){delete _0x177800[_0xd7e3('0x77')]['Applications'];}return db[_0xd7e3('0x78')][_0xd7e3('0x79')]();})[_0xd7e3('0x34')](function(_0x19a4bf){if(!_0x19a4bf){throw new db[(_0xd7e3('0x7a'))]['ValidationError']('no\x20available\x20attributes');}_0xb84b4b=_[_0xd7e3('0x7b')](_[_0xd7e3('0x45')](_0x19a4bf),[_0xd7e3('0x7c'),_0xd7e3('0x7d')]);_0x39c2ad=_[_0xd7e3('0x7b')](_[_0xd7e3('0x45')](_0x19a4bf),[_0xd7e3('0x7c'),_0xd7e3('0x7d'),_0xd7e3('0x7e'),'ListId']);_0x177800[_0xd7e3('0x5b')]={'mapKey':'mobile'};if(_0x177800['account'][_0xd7e3('0x40')]){switch(_0x177800[_0xd7e3('0x77')][_0xd7e3('0x40')]){case _0xd7e3('0x7f'):_0x177800['body'][_0xd7e3('0x80')]=_0x100076[_0xd7e3('0x5b')]['From'];_0x177800['body'][_0xd7e3('0x5b')]=_0x100076[_0xd7e3('0x5b')][_0xd7e3('0x81')];_0x177800['body'][_0xd7e3('0x82')]=_0x100076[_0xd7e3('0x5b')][_0xd7e3('0x83')];break;case'skebby':_0x177800[_0xd7e3('0x5b')]['from']='+'+_0x100076['body'][_0xd7e3('0x84')];_0x177800[_0xd7e3('0x5b')][_0xd7e3('0x5b')]=_0x100076[_0xd7e3('0x5b')][_0xd7e3('0x85')];break;case _0xd7e3('0x86'):_0x177800[_0xd7e3('0x5b')][_0xd7e3('0x80')]=_0x100076[_0xd7e3('0x5b')]['from'];_0x177800[_0xd7e3('0x5b')][_0xd7e3('0x5b')]=_0x100076['body']['message'];break;case _0xd7e3('0x87'):_0x177800[_0xd7e3('0x5b')]['from']=_0x100076[_0xd7e3('0x5b')]['from'];_0x177800[_0xd7e3('0x5b')][_0xd7e3('0x5b')]=_0x100076[_0xd7e3('0x5b')][_0xd7e3('0x5b')];_0x177800['body'][_0xd7e3('0x82')]=_0x100076['body'][_0xd7e3('0x88')];break;case _0xd7e3('0x89'):_0x177800[_0xd7e3('0x5b')][_0xd7e3('0x80')]=_0x100076[_0xd7e3('0x5b')][_0xd7e3('0x8a')];_0x177800[_0xd7e3('0x5b')][_0xd7e3('0x5b')]=_0x100076['body'][_0xd7e3('0x8b')];_0x177800[_0xd7e3('0x5b')]['messageId']=_0x100076['body'][_0xd7e3('0x8c')];break;case _0xd7e3('0x8d'):_0x177800['body']['from']='+'+_0x100076[_0xd7e3('0x5b')]['results'][0x0][_0xd7e3('0x80')];_0x177800[_0xd7e3('0x5b')]['body']=_0x100076[_0xd7e3('0x5b')][_0xd7e3('0x8e')][0x0][_0xd7e3('0x85')];_0x177800[_0xd7e3('0x5b')][_0xd7e3('0x82')]=_0x100076[_0xd7e3('0x5b')]['results'][0x0]['messageId'];break;case _0xd7e3('0x8f'):_0x177800[_0xd7e3('0x5b')]['from']=_0x100076[_0xd7e3('0x5b')][_0xd7e3('0x90')];_0x177800[_0xd7e3('0x5b')][_0xd7e3('0x5b')]=_0x100076[_0xd7e3('0x5b')][_0xd7e3('0x91')][_0xd7e3('0x23')];break;case _0xd7e3('0x92'):_0x177800['body']['from']=_0x100076[_0xd7e3('0x5b')]['fromNumber'];_0x177800[_0xd7e3('0x5b')]['body']=_0x100076[_0xd7e3('0x5b')][_0xd7e3('0x85')];_0x177800['body']['messageId']=_0x100076[_0xd7e3('0x5b')][_0xd7e3('0x93')];break;case'bandwidth':_0x177800[_0xd7e3('0x5b')][_0xd7e3('0x82')]=_0x100076[_0xd7e3('0x5b')][0x0]['message']['id'];_0x177800[_0xd7e3('0x5b')][_0xd7e3('0x80')]=_0x100076[_0xd7e3('0x5b')][0x0]['message']['from'];_0x177800['body'][_0xd7e3('0x5b')]=_0x100076[_0xd7e3('0x5b')][0x0][_0xd7e3('0x23')][_0xd7e3('0x85')];break;case _0xd7e3('0x94'):_0x177800[_0xd7e3('0x5b')]['from']=_0x100076[_0xd7e3('0x5b')]['from'];_0x177800[_0xd7e3('0x5b')]['body']=_0x100076['body'][_0xd7e3('0x23')];_0x177800['body'][_0xd7e3('0x82')]=_0x100076['body']['refid'];break;}}if(_0x177800['body']['id']){delete _0x177800[_0xd7e3('0x5b')]['id'];}if(_['isNil'](_0x177800[_0xd7e3('0x5b')][_0xd7e3('0x80')])){throw new db[(_0xd7e3('0x7a'))][(_0xd7e3('0x95'))](_0xd7e3('0x96'));}if(_[_0xd7e3('0x97')](_0x177800[_0xd7e3('0x5b')][_0xd7e3('0x5b')])||_0x177800[_0xd7e3('0x5b')]['body']===''){throw new db[(_0xd7e3('0x7a'))]['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x177800['body'][_0xd7e3('0x98')])){throw new db[(_0xd7e3('0x7a'))][(_0xd7e3('0x95'))](_0xd7e3('0x99')+_0x39c2ad);}if(!_[_0xd7e3('0x9a')](_0x39c2ad,_0x177800[_0xd7e3('0x5b')]['mapKey'])){throw new db[(_0xd7e3('0x7a'))][(_0xd7e3('0x95'))](_0xd7e3('0x9b')+_0x39c2ad);}_0x59df84[_0x177800['body'][_0xd7e3('0x98')]]=_0x177800['body']['from'];return db[_0xd7e3('0x9c')][_0xd7e3('0x59')]({'where':{'id':_0x177800[_0xd7e3('0x77')][_0xd7e3('0x9d')]},'include':[{'model':db[_0xd7e3('0x78')],'as':_0xd7e3('0x9e'),'where':_0x59df84,'limit':0x1,'order':[['updatedAt',_0xd7e3('0x9f')]]}]});})[_0xd7e3('0x34')](handleEntityNotFound(_0x4213bf,null))['then'](function(_0x33d170){if(_0x33d170){_0x177800[_0xd7e3('0xa0')]=_[_0xd7e3('0xa1')](_0x33d170,[_0xd7e3('0x9e')]);if(_0x33d170[_0xd7e3('0x9e')][_0xd7e3('0x49')]){return _0x33d170['Contacts'][0x0];}var _0x38f8ab=_[_0xd7e3('0x17')](_0x177800[_0xd7e3('0x5b')],{'firstName':_0x177800[_0xd7e3('0x5b')][_0xd7e3('0x80')],'ListId':_0x33d170['id']});_0x38f8ab[_0x177800['body'][_0xd7e3('0x98')]]=_0x177800[_0xd7e3('0x5b')][_0xd7e3('0x80')];return db[_0xd7e3('0x78')][_0xd7e3('0x5a')](_0x38f8ab,{'fields':_0xb84b4b,'raw':!![]});}})[_0xd7e3('0x34')](handleEntityNotFound(_0x4213bf,null))[_0xd7e3('0x34')](function(_0x181b8d){if(_0x181b8d){_0x177800[_0xd7e3('0xa2')]=_0x181b8d;var _0x20f163={'ContactId':_0x181b8d['id'],'phone':_0x177800[_0xd7e3('0x5b')][_0xd7e3('0x80')],'SmsAccountId':_0x100076[_0xd7e3('0x55')]['id']};var _0x14dd42={'ContactId':_0x181b8d['id'],'SmsAccountId':_0x100076[_0xd7e3('0x55')]['id'],'closed':![]};return db[_0xd7e3('0xa3')][_0xd7e3('0x59')]({'where':_0x14dd42})[_0xd7e3('0x34')](function(_0x11b490){if(_0x11b490){return[_0x11b490,![]];}return db[_0xd7e3('0xa3')][_0xd7e3('0x5a')](_0x20f163)[_0xd7e3('0x34')](function(_0x263294){return[_0x263294,!![]];});});}})['spread'](function(_0x486080,_0x4a340c){_0x177800[_0xd7e3('0xa4')]=_0x486080['get']({'plain':!![]});_0x177800[_0xd7e3('0xa4')][_0xd7e3('0xa5')]=![];if(_0x4a340c){if(_0x177800[_0xd7e3('0x77')]['autoclose']){_0x177800[_0xd7e3('0x73')][_0xd7e3('0xa6')]({'id':0x0,'priority':_0x177800[_0xd7e3('0x73')][_0xd7e3('0x49')]+0x1,'app':'close','appdata':_0xd7e3('0xa7'),'interval':'*,*,*,*'});}_0x177800[_0xd7e3('0xa4')][_0xd7e3('0xa5')]=!![];}return db[_0xd7e3('0xa8')][_0xd7e3('0x5a')]({'phone':_0x177800[_0xd7e3('0x5b')]['from'],'messageId':_0x177800[_0xd7e3('0x5b')][_0xd7e3('0x82')],'body':_0x177800[_0xd7e3('0x5b')][_0xd7e3('0x5b')],'SmsAccountId':_0x100076[_0xd7e3('0x55')]['id'],'SmsInteractionId':_0x486080['id'],'direction':'in','ContactId':_0x486080['ContactId'],'AttachmentId':_0x177800[_0xd7e3('0x5b')][_0xd7e3('0xa9')]});})[_0xd7e3('0x34')](function(_0x11e1bf){_0x177800['message']=_0x11e1bf;if(_0x177800['interaction']['UserId']){return db[_0xd7e3('0xaa')][_0xd7e3('0x59')]({'attributes':['id',_0xd7e3('0x3b')],'where':{'id':_0x177800[_0xd7e3('0xa4')][_0xd7e3('0xab')]}})[_0xd7e3('0x34')](function(_0x3fe11e){if(_0x3fe11e){_0x177800[_0xd7e3('0x73')][_0xd7e3('0xac')]({'id':0x0,'priority':0x0,'app':_0xd7e3('0xad'),'appdata':_0x3fe11e[_0xd7e3('0x3b')]+','+(_0x177800[_0xd7e3('0x77')][_0xd7e3('0xae')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise('Start',_0xd7e3('0xaf'),_0x177800);});}return respondWithRpcPromise('Start','startRouting',_0x177800);})['then'](function(_0x399aaa){if(_0x399aaa){var _0x1bc467=0xc8;var _0x537715=_0xd7e3('0xb0');logger[_0xd7e3('0x1d')](_0xd7e3('0x1f'),_0x537715,_0x1bc467,_0xd7e3('0xb1'));logger[_0xd7e3('0x1e')]('SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s',_0x537715,_0x1bc467,_0xd7e3('0xb1'),JSON[_0xd7e3('0x21')](_0x399aaa));if(_0x177800['account'][_0xd7e3('0x40')]==='twilio'){return _0x4213bf['status'](_0x1bc467)['set'](_0xd7e3('0xb2'),_0xd7e3('0xb3'))[_0xd7e3('0xb4')](_0xd7e3('0xb5'));}else{return _0x4213bf['status'](_0x1bc467)[_0xd7e3('0x29')](_0x399aaa);}}})[_0xd7e3('0x26')](handleError(_0x4213bf,null));};exports[_0xd7e3('0xb6')]=function(_0x63be0e,_0x498113,_0x8ae3cd){return db[_0xd7e3('0x3e')][_0xd7e3('0x66')]({'where':{'id':_0x63be0e[_0xd7e3('0x55')]['id']}})[_0xd7e3('0x34')](handleEntityNotFound(_0x498113,null))[_0xd7e3('0x34')](function(_0x23cdbb){if(_0x23cdbb){return db['sequelize']['transaction'](function(_0x15168f){return db['SmsApplication'][_0xd7e3('0x38')]({'where':{'SmsAccountId':_0x63be0e[_0xd7e3('0x55')]['id']},'transaction':_0x15168f})[_0xd7e3('0x34')](function(_0xfc9744){var _0x2ada0e=_[_0xd7e3('0x43')](_0x63be0e[_0xd7e3('0x5b')],function(_0x1890c7){_0x1890c7[_0xd7e3('0x63')]=_0x63be0e[_0xd7e3('0x55')]['id'];return _0x1890c7;});return db[_0xd7e3('0x71')][_0xd7e3('0xb7')](_0x2ada0e,{'transaction':_0x15168f});});})[_0xd7e3('0x34')](function(){return db['SmsApplication'][_0xd7e3('0xb8')]({'where':{'SmsAccountId':_0x63be0e['params']['id']},'order':'priority'});});}})[_0xd7e3('0x34')](respondWithResult(_0x498113,null))['catch'](handleError(_0x498113,null));};exports[_0xd7e3('0xb9')]=function(_0x57b65e,_0x5ca958,_0x5a8c88){var _0x16018a={};var _0x328916={};var _0x269b44;var _0x1dee7b;return db[_0xd7e3('0x3e')][_0xd7e3('0x66')]({'where':{'id':_0x57b65e[_0xd7e3('0x55')]['id']}})['then'](handleEntityNotFound(_0x5ca958,null))[_0xd7e3('0x34')](function(_0x1ebe66){if(_0x1ebe66){_0x269b44=_0x1ebe66;_0x328916[_0xd7e3('0x42')]=_[_0xd7e3('0x45')](db[_0xd7e3('0x71')]['rawAttributes']);_0x328916[_0xd7e3('0x44')]=_[_0xd7e3('0x45')](_0x57b65e[_0xd7e3('0x44')]);_0x328916[_0xd7e3('0x46')]=_[_0xd7e3('0x47')](_0x328916['model'],_0x328916[_0xd7e3('0x44')]);_0x16018a[_0xd7e3('0x48')]=_['intersection'](_0x328916[_0xd7e3('0x42')],qs[_0xd7e3('0x57')](_0x57b65e[_0xd7e3('0x44')][_0xd7e3('0x57')]));_0x16018a['attributes']=_0x16018a[_0xd7e3('0x48')][_0xd7e3('0x49')]?_0x16018a[_0xd7e3('0x48')]:_0x328916[_0xd7e3('0x42')];_0x16018a[_0xd7e3('0x67')]=qs['sort'](_0x57b65e[_0xd7e3('0x44')][_0xd7e3('0x4c')]);_0x16018a['where']=qs['filters'](_[_0xd7e3('0x4e')](_0x57b65e[_0xd7e3('0x44')],_0x328916['filters']));if(_0x57b65e['query'][_0xd7e3('0x4f')]){_0x16018a['where']=_[_0xd7e3('0x50')](_0x16018a['where'],{'$or':_[_0xd7e3('0x43')](_0x16018a[_0xd7e3('0x48')],function(_0x14b62a){var _0x2e5461={};_0x2e5461[_0x14b62a]={'$like':'%'+_0x57b65e[_0xd7e3('0x44')][_0xd7e3('0x4f')]+'%'};return _0x2e5461;})});}_0x16018a=_[_0xd7e3('0x50')]({},_0x16018a,_0x57b65e[_0xd7e3('0x52')]);return _0x269b44[_0xd7e3('0xb9')](_0x16018a);}})['then'](function(_0x3d3415){if(_0x3d3415){_0x1dee7b=_0x3d3415[_0xd7e3('0x49')];if(!_0x57b65e[_0xd7e3('0x44')]['hasOwnProperty'](_0xd7e3('0x4b'))){_0x16018a[_0xd7e3('0x2d')]=qs[_0xd7e3('0x2d')](_0x57b65e['query']['limit']);_0x16018a[_0xd7e3('0x2a')]=qs[_0xd7e3('0x2a')](_0x57b65e[_0xd7e3('0x44')][_0xd7e3('0x2a')]);}return _0x269b44['getApplications'](_0x16018a);}})[_0xd7e3('0x34')](function(_0x42a6ac){if(_0x42a6ac){return _0x42a6ac?{'count':_0x1dee7b,'rows':_0x42a6ac}:null;}})[_0xd7e3('0x34')](respondWithResult(_0x5ca958,null))['catch'](handleError(_0x5ca958,null));};exports[_0xd7e3('0xba')]=function(_0x11aa7c,_0x2a5b0e,_0x3d064d){var _0x26e150={'raw':![],'where':{}};var _0x1d752f={};var _0x372ac0={'count':0x0,'rows':[]};return db[_0xd7e3('0x3e')][_0xd7e3('0x66')]({'where':{'id':_0x11aa7c[_0xd7e3('0x55')]['id']}})['then'](handleEntityNotFound(_0x2a5b0e,null))[_0xd7e3('0x34')](function(_0x25ea35){if(_0x25ea35){_0x1d752f[_0xd7e3('0x42')]=_[_0xd7e3('0x45')](db[_0xd7e3('0xa3')][_0xd7e3('0x3f')]);_0x1d752f[_0xd7e3('0x44')]=_[_0xd7e3('0x45')](_0x11aa7c['query']);_0x1d752f[_0xd7e3('0x46')]=_[_0xd7e3('0x47')](_0x1d752f['model'],_0x1d752f['query']);_0x26e150['attributes']=_['intersection'](_0x1d752f[_0xd7e3('0x42')],qs[_0xd7e3('0x57')](_0x11aa7c[_0xd7e3('0x44')][_0xd7e3('0x57')]));_0x26e150[_0xd7e3('0x48')]=_0x26e150['attributes']['length']?_0x26e150[_0xd7e3('0x48')]:_0x1d752f[_0xd7e3('0x42')];if(!_0x11aa7c[_0xd7e3('0x44')]['hasOwnProperty'](_0xd7e3('0x4b'))){_0x26e150[_0xd7e3('0x2d')]=qs['limit'](_0x11aa7c[_0xd7e3('0x44')][_0xd7e3('0x2d')]);_0x26e150[_0xd7e3('0x2a')]=qs['offset'](_0x11aa7c[_0xd7e3('0x44')][_0xd7e3('0x2a')]);}_0x26e150[_0xd7e3('0x67')]=qs['sort'](_0x11aa7c[_0xd7e3('0x44')]['sort']);_0x26e150[_0xd7e3('0x4d')]=qs['filters'](_[_0xd7e3('0x4e')](_0x11aa7c[_0xd7e3('0x44')],_0x1d752f[_0xd7e3('0x46')]));_0x26e150[_0xd7e3('0x4d')][_0xd7e3('0x63')]=_0x25ea35['id'];if(_0x11aa7c['query'][_0xd7e3('0x4f')]){_0x26e150[_0xd7e3('0x4d')]=_[_0xd7e3('0x50')](_0x26e150[_0xd7e3('0x4d')],{'$or':_[_0xd7e3('0x43')](_0x26e150['attributes'],function(_0x4c3ac9){var _0x2ba877={};_0x2ba877[_0x4c3ac9]={'$like':'%'+_0x11aa7c[_0xd7e3('0x44')]['filter']+'%'};return _0x2ba877;})});}_0x26e150=_[_0xd7e3('0x50')]({},_0x26e150,_0x11aa7c[_0xd7e3('0x52')]);return db[_0xd7e3('0xa3')]['count']({'where':_0x26e150[_0xd7e3('0x4d')]})[_0xd7e3('0x34')](function(_0xa5fdbb){_0x372ac0[_0xd7e3('0x2c')]=_0xa5fdbb;if(_0x11aa7c[_0xd7e3('0x44')]['includeAll']){_0x26e150[_0xd7e3('0x58')]=[{'model':db[_0xd7e3('0x78')],'as':_0xd7e3('0xbb'),'required':![]},{'model':db['User'],'as':_0xd7e3('0xbc'),'attributes':[_0xd7e3('0x3b'),'fullname','internal'],'required':![]},{'model':db['Tag'],'as':'Tags','attributes':['id',_0xd7e3('0x3b'),'color'],'where':_0x11aa7c[_0xd7e3('0x44')][_0xd7e3('0xbd')]?{'id':_0x11aa7c['query'][_0xd7e3('0xbd')]}:undefined,'required':_0x11aa7c[_0xd7e3('0x44')]['tag']?!![]:![]}];}return db[_0xd7e3('0xa3')][_0xd7e3('0x68')](_0x26e150);})[_0xd7e3('0x34')](function(_0x55501c){_0x372ac0[_0xd7e3('0x54')]=_0x55501c;return _0x372ac0;});}})[_0xd7e3('0x34')](respondWithFilteredResult(_0x2a5b0e,_0x26e150))[_0xd7e3('0x26')](handleError(_0x2a5b0e,null));};exports[_0xd7e3('0xb4')]=function(_0x1cbfeb,_0x99553,_0x231676){var _0x356223,_0x580d8f,_0x30f3c5;if(_[_0xd7e3('0x97')](_0x1cbfeb[_0xd7e3('0x5b')][_0xd7e3('0x5b')])||_0x1cbfeb[_0xd7e3('0x5b')]['body']===''){throw new db[(_0xd7e3('0x7a'))][(_0xd7e3('0x95'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x1cbfeb[_0xd7e3('0x5b')]['to'])){throw new db[(_0xd7e3('0x7a'))][(_0xd7e3('0x95'))](_0xd7e3('0xbe'));}_0x356223=_0x1cbfeb[_0xd7e3('0x5b')]['to'];return db['SmsAccount'][_0xd7e3('0x59')]({'where':{'id':_0x1cbfeb[_0xd7e3('0x55')]['id']},'include':[{'model':db[_0xd7e3('0x9c')],'as':'List','include':[{'model':db[_0xd7e3('0x78')],'as':_0xd7e3('0x9e'),'where':{'mobile':_0x356223},'limit':0x1,'order':[['updatedAt',_0xd7e3('0x9f')]]}]}]})[_0xd7e3('0x34')](handleEntityNotFound(_0x99553,null))[_0xd7e3('0x34')](function(_0x412f26){if(_0x412f26&&_0x412f26[_0xd7e3('0xbf')]){_0x580d8f=_0x412f26[_0xd7e3('0x35')]({'plain':!![]});if(_0x580d8f['List']&&_0x580d8f[_0xd7e3('0xbf')][_0xd7e3('0x9e')][_0xd7e3('0x49')]){return _0x580d8f[_0xd7e3('0xbf')][_0xd7e3('0x9e')][0x0];}return db['CmContact'][_0xd7e3('0x5a')](_[_0xd7e3('0x17')](_0x1cbfeb[_0xd7e3('0x5b')],{'firstName':_0x356223,'mobile':_0x356223,'phone':_0x356223,'ListId':_0x580d8f['ListId']}));}})[_0xd7e3('0x34')](handleEntityNotFound(_0x99553,null))['then'](function(_0x369a39){if(_0x369a39){_0x30f3c5=_0x369a39;return db[_0xd7e3('0xa3')][_0xd7e3('0x59')]({'where':{'ContactId':_0x30f3c5['id'],'closed':![],'SmsAccountId':_0x580d8f['id']}})[_0xd7e3('0x34')](function(_0xa34809){if(_0xa34809){return[_0xa34809,![]];}return db['SmsInteraction'][_0xd7e3('0x5a')]({'UserId':_0x1cbfeb[_0xd7e3('0x5c')]['id'],'ContactId':_0x30f3c5['id'],'SmsAccountId':_0x580d8f['id'],'phone':_0x356223,'firstMsgDirection':_0xd7e3('0xc0'),'Messages':[_['merge'](_0x1cbfeb[_0xd7e3('0x5b')],{'read':![],'body':_0x1cbfeb['body']['body'],'phone':_0x356223,'SmsAccountId':_0x580d8f['id'],'UserId':_0x1cbfeb[_0xd7e3('0x5c')]['id'],'ContactId':_0x30f3c5['id']})]},{'include':[{'model':db['SmsMessage'],'as':_0xd7e3('0xc1')}]})[_0xd7e3('0x34')](function(_0x4fa0d9){return[_0x4fa0d9,!![]];});});}})['spread'](function(_0x1720e9,_0x34ca05){if(_0x34ca05){return _0x1720e9;}return db[_0xd7e3('0xa8')][_0xd7e3('0x5a')](_[_0xd7e3('0x50')](_0x1cbfeb[_0xd7e3('0x5b')],{'read':![],'body':_0x1cbfeb[_0xd7e3('0x5b')][_0xd7e3('0x5b')],'phone':_0x356223,'SmsAccountId':_0x580d8f['id'],'SmsInteractionId':_0x1720e9['id'],'UserId':_0x1cbfeb[_0xd7e3('0x5c')]['id'],'ContactId':_0x30f3c5['id']}))[_0xd7e3('0x34')](function(_0x28eedb){_0x1720e9[_0xd7e3('0xc2')][_0xd7e3('0xc1')]=[];_0x1720e9[_0xd7e3('0xc2')]['Messages']['push'](_0x28eedb[_0xd7e3('0xc2')]);return _0x1720e9;});})[_0xd7e3('0x34')](respondWithResult(_0x99553,null))[_0xd7e3('0x26')](handleError(_0x99553,null));};exports['status']=function(_0x5cae7c,_0x50ad72,_0x592341){if(_0x5cae7c[_0xd7e3('0x5b')]['id']){delete _0x5cae7c[_0xd7e3('0x5b')]['id'];}var _0x5bd1ef,_0x4418df,_0x10aa0b;return db[_0xd7e3('0x3e')][_0xd7e3('0x59')]({'where':{'id':_0x5cae7c['params']['id']}})[_0xd7e3('0x34')](handleEntityNotFound(_0x50ad72,null))[_0xd7e3('0x34')](function(_0x31a51d){if(_0x31a51d){_0x10aa0b=_0x31a51d;logger[_0xd7e3('0x1e')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xd7e3('0x27'),'received\x20delivery\x20report\x20from',_0x31a51d['type'],util[_0xd7e3('0xc3')](_0x5cae7c[_0xd7e3('0x5b')],{'showHidden':![],'depth':null}));switch(_0x31a51d[_0xd7e3('0x40')]){case _0xd7e3('0xc4'):if(_0x5cae7c[_0xd7e3('0x5b')][_0xd7e3('0xc5')]&&_0x5cae7c[_0xd7e3('0x5b')][_0xd7e3('0x27')]){_0x4418df=_0x5cae7c[_0xd7e3('0x5b')][_0xd7e3('0x27')];return db[_0xd7e3('0xa8')][_0xd7e3('0x59')]({'where':{'messageId':_0x5cae7c[_0xd7e3('0x5b')]['skebby_dispatch_id']}});}break;case'connectel':if(_0x5cae7c[_0xd7e3('0x5b')][_0xd7e3('0xc6')]&&_0x5cae7c[_0xd7e3('0x5b')][_0xd7e3('0xc7')]){_0x4418df=_0x5cae7c[_0xd7e3('0x5b')][_0xd7e3('0xc7')];return db['SmsMessage'][_0xd7e3('0x59')]({'where':{'messageId':_0x5cae7c[_0xd7e3('0x5b')][_0xd7e3('0xc6')]}});}break;case _0xd7e3('0x87'):if(_0x5cae7c[_0xd7e3('0x5b')][_0xd7e3('0x88')]&&_0x5cae7c[_0xd7e3('0x5b')][_0xd7e3('0xc8')]){_0x4418df=_0x5cae7c[_0xd7e3('0x5b')][_0xd7e3('0xc8')];return db['SmsMessage'][_0xd7e3('0x59')]({'where':{'messageId':_0x5cae7c[_0xd7e3('0x5b')][_0xd7e3('0x88')]}});}break;case _0xd7e3('0x8d'):var _0x5a4306=_0x5cae7c['body'][_0xd7e3('0x8e')][0x0];if(_0x5a4306['messageId']&&_0x5a4306[_0xd7e3('0x27')][_0xd7e3('0xc9')]===_0xd7e3('0xca')){_0x4418df=_0x5a4306[_0xd7e3('0x27')]['groupName'];return db[_0xd7e3('0xa8')][_0xd7e3('0x59')]({'where':{'messageId':_0x5a4306[_0xd7e3('0x82')]}});}break;case _0xd7e3('0x92'):if(_0x5cae7c['body'][_0xd7e3('0x82')]&&_0x5cae7c[_0xd7e3('0x5b')][_0xd7e3('0x27')]){_0x4418df=_0x5cae7c['body'][_0xd7e3('0x27')];return db['SmsMessage']['find']({'where':{'messageId':_0x5cae7c[_0xd7e3('0x5b')][_0xd7e3('0x82')]}});}break;case'bandwidth':if(_0x5cae7c[_0xd7e3('0x5b')][0x0]['message']['id']){_0x4418df=_0x5cae7c['body'][0x0]['type'];return db[_0xd7e3('0xa8')][_0xd7e3('0x59')]({'where':{'messageId':_0x5cae7c[_0xd7e3('0x5b')][0x0][_0xd7e3('0x23')]['id']}});}break;case _0xd7e3('0x94'):if(_0x5cae7c['body'][_0xd7e3('0xcb')]&&_0x5cae7c[_0xd7e3('0x5b')][_0xd7e3('0x27')]){_0x4418df=_0x5cae7c[_0xd7e3('0x5b')][_0xd7e3('0x27')];return db[_0xd7e3('0xa8')][_0xd7e3('0x59')]({'where':{'messageId':_0x5cae7c[_0xd7e3('0x5b')][_0xd7e3('0xcb')]}});}break;}}})['then'](handleEntityNotFound(_0x50ad72,null))['then'](function(_0x24b673){if(_0x24b673){_0x5bd1ef=_0x24b673;switch(_0x10aa0b[_0xd7e3('0x40')]){case'skebby':if(_0x4418df===_0xd7e3('0xca')){return _0x5bd1ef['update']({'read':!![]});}else{logger['error'](_0xd7e3('0x1f'),_0xd7e3('0x27'),_0xd7e3('0xc4'),util[_0xd7e3('0xc3')](_0x5cae7c[_0xd7e3('0x5b')],{'showHidden':![],'depth':null}));}break;case _0xd7e3('0x86'):if(_0x4418df==='1'){return _0x5bd1ef[_0xd7e3('0x33')]({'read':!![]});}else{logger[_0xd7e3('0x22')](_0xd7e3('0x1f'),_0xd7e3('0x27'),_0xd7e3('0xc4'),util[_0xd7e3('0xc3')](_0x5cae7c[_0xd7e3('0x5b')],{'showHidden':![],'depth':null}));}break;case _0xd7e3('0x87'):if(!_0x5cae7c['body'][_0xd7e3('0xcc')]&&_0x4418df>=0xc8&&_0x4418df<=0xce){return _0x5bd1ef['update']({'read':!![]});}else{logger['error'](_0xd7e3('0x1f'),_0xd7e3('0x27'),_0xd7e3('0x87'),util[_0xd7e3('0xc3')](_0x5cae7c[_0xd7e3('0x5b')],{'showHidden':![],'depth':null}));}break;case _0xd7e3('0x8d'):var _0x2ae58b=_0x5cae7c[_0xd7e3('0x5b')]['results'][0x0];if(_0x2ae58b[_0xd7e3('0x27')][_0xd7e3('0xc9')]===_0xd7e3('0xca')){return _0x5bd1ef[_0xd7e3('0x33')]({'read':!![]});}else{logger[_0xd7e3('0x22')](_0xd7e3('0x1f'),_0xd7e3('0x27'),'infobip',util[_0xd7e3('0xc3')](_0x5cae7c[_0xd7e3('0x5b')],{'showHidden':![],'depth':null}));}break;case _0xd7e3('0x92'):if(_0x4418df=='DELIVERED_TO_GATEWAY'||_0x4418df==_0xd7e3('0xcd')){return _0x5bd1ef[_0xd7e3('0x33')]({'read':!![]});}else{logger[_0xd7e3('0x22')](_0xd7e3('0x1f'),_0xd7e3('0x27'),_0xd7e3('0x92'),util[_0xd7e3('0xc3')](_0x5cae7c[_0xd7e3('0x5b')],{'showHidden':![],'depth':null}));}break;case _0xd7e3('0xce'):if(_0x4418df==_0xd7e3('0xcf')){return _0x5bd1ef['update']({'read':!![]});}else{logger[_0xd7e3('0x22')](_0xd7e3('0x1f'),'status',_0xd7e3('0xce'),util[_0xd7e3('0xc3')](_0x5cae7c[_0xd7e3('0x5b')],{'showHidden':![],'depth':null}));}break;case _0xd7e3('0x94'):if(_0x4418df===_0xd7e3('0xd0')||_0x4418df===_0xd7e3('0xd1')){return _0x5bd1ef[_0xd7e3('0x33')]({'read':!![]});}else{logger[_0xd7e3('0x22')](_0xd7e3('0x1f'),_0xd7e3('0x27'),_0xd7e3('0x94'),util[_0xd7e3('0xc3')](_0x5cae7c[_0xd7e3('0x5b')],{'showHidden':![],'depth':null}));}break;}return _0x5bd1ef;}})['then'](respondWithResult(_0x50ad72,null))[_0xd7e3('0x26')](handleError(_0x50ad72,null));};exports[_0xd7e3('0xd2')]=function(_0x253122,_0x20900a,_0x299a4c){var _0x58cf95,_0xf56ce1,_0x4b8b84;return db[_0xd7e3('0x3e')][_0xd7e3('0x59')]({'where':{'id':_0x253122[_0xd7e3('0x55')]['id']}})[_0xd7e3('0x34')](handleEntityNotFound(_0x20900a,null))[_0xd7e3('0x34')](function(_0x11a484){if(_0x11a484){_0x4b8b84=_0x11a484;logger[_0xd7e3('0x1e')](_0xd7e3('0x1f'),_0xd7e3('0x27'),_0xd7e3('0xd3'),_0x11a484[_0xd7e3('0x40')],util[_0xd7e3('0xc3')](_0x253122['query'],{'showHidden':![],'depth':null}));switch(_0x11a484[_0xd7e3('0x40')]){case'csc':if(_0x253122[_0xd7e3('0x44')]['message-id']&&_0x253122[_0xd7e3('0x44')]['state']){_0xf56ce1=_0x253122[_0xd7e3('0x44')][_0xd7e3('0xd4')];return db['SmsMessage'][_0xd7e3('0x59')]({'where':{'messageId':_0x253122[_0xd7e3('0x44')][_0xd7e3('0xd5')]}});}break;}}})[_0xd7e3('0x34')](handleEntityNotFound(_0x20900a,null))[_0xd7e3('0x34')](function(_0xb008f6){if(_0xb008f6){_0x58cf95=_0xb008f6;switch(_0x4b8b84[_0xd7e3('0x40')]){case'csc':if(_0xf56ce1==='2'||_0xf56ce1==='6'){return _0x58cf95['update']({'read':!![]});}else{logger[_0xd7e3('0x22')](_0xd7e3('0x1f'),_0xd7e3('0x27'),_0xd7e3('0x8f'),util['inspect'](_0x253122['query'],{'showHidden':![],'depth':null}));};break;}return _0x58cf95;}})['then'](respondWithResult(_0x20900a,null))[_0xd7e3('0x26')](handleError(_0x20900a,null));};exports['addAgents']=function(_0x5ac8ce,_0xe2f306,_0x59264b){return db[_0xd7e3('0x3e')][_0xd7e3('0x59')]({'where':{'id':_0x5ac8ce[_0xd7e3('0x55')]['id']}})[_0xd7e3('0x34')](handleEntityNotFound(_0xe2f306,null))[_0xd7e3('0x34')](function(_0x2ed409){if(_0x2ed409){return _0x2ed409['addAgents'](_0x5ac8ce[_0xd7e3('0x5b')][_0xd7e3('0x6a')],_[_0xd7e3('0xa1')](_0x5ac8ce[_0xd7e3('0x5b')],[_0xd7e3('0x6a'),'id'])||{})[_0xd7e3('0xd6')](function(_0x536d47){for(var _0x539d60=0x0;_0x539d60<_0x5ac8ce[_0xd7e3('0x5b')][_0xd7e3('0x6a')][_0xd7e3('0x49')];_0x539d60+=0x1){socket['emit'](_0xd7e3('0xd7'),{'UserId':Number(_0x5ac8ce[_0xd7e3('0x5b')][_0xd7e3('0x6a')][_0x539d60]),'SmsAccountId':Number(_0x5ac8ce[_0xd7e3('0x55')]['id'])});}return _0x536d47;});}})[_0xd7e3('0x34')](respondWithResult(_0xe2f306,null))['catch'](handleError(_0xe2f306,null));};exports[_0xd7e3('0xd8')]=function(_0x5a4031,_0x325d16,_0x2fdee5){return db[_0xd7e3('0x3e')]['find']({'where':{'id':_0x5a4031['params']['id']}})[_0xd7e3('0x34')](handleEntityNotFound(_0x325d16,null))[_0xd7e3('0x34')](function(_0x33fbe2){if(_0x33fbe2){return _0x33fbe2[_0xd7e3('0xd8')](_0x5a4031[_0xd7e3('0x44')]['ids'])[_0xd7e3('0x34')](function(){if(_[_0xd7e3('0xd9')](_0x5a4031[_0xd7e3('0x44')][_0xd7e3('0x6a')])){for(var _0x24a434=0x0;_0x24a434<_0x5a4031[_0xd7e3('0x44')]['ids'][_0xd7e3('0x49')];_0x24a434+=0x1){socket[_0xd7e3('0xda')](_0xd7e3('0xdb'),{'UserId':Number(_0x5a4031[_0xd7e3('0x44')][_0xd7e3('0x6a')][_0x24a434]),'SmsAccountId':Number(_0x5a4031[_0xd7e3('0x55')]['id'])});}}else{socket['emit'](_0xd7e3('0xdb'),{'UserId':Number(_0x5a4031['query']['ids']),'SmsAccountId':Number(_0x5a4031[_0xd7e3('0x55')]['id'])});}});}})[_0xd7e3('0x34')](respondWithStatusCode(_0x325d16,null))[_0xd7e3('0x26')](handleError(_0x325d16,null));};exports['getAgents']=function(_0x3a0e1e,_0x1f7238,_0x446f5e){var _0x1b937f={};var _0x2a0dc2={};var _0x4bf171;var _0x21bf90;return db[_0xd7e3('0x3e')][_0xd7e3('0x66')]({'where':{'id':_0x3a0e1e[_0xd7e3('0x55')]['id']}})['then'](handleEntityNotFound(_0x1f7238,null))[_0xd7e3('0x34')](function(_0x107cf9){if(_0x107cf9){_0x4bf171=_0x107cf9;_0x2a0dc2['model']=_[_0xd7e3('0x45')](db['User']['rawAttributes']);_0x2a0dc2['query']=_[_0xd7e3('0x45')](_0x3a0e1e['query']);_0x2a0dc2[_0xd7e3('0x46')]=_[_0xd7e3('0x47')](_0x2a0dc2[_0xd7e3('0x42')],_0x2a0dc2[_0xd7e3('0x44')]);_0x1b937f[_0xd7e3('0x48')]=_[_0xd7e3('0x47')](_0x2a0dc2[_0xd7e3('0x42')],qs[_0xd7e3('0x57')](_0x3a0e1e[_0xd7e3('0x44')][_0xd7e3('0x57')]));_0x1b937f['attributes']=_0x1b937f[_0xd7e3('0x48')][_0xd7e3('0x49')]?_0x1b937f[_0xd7e3('0x48')]:_0x2a0dc2[_0xd7e3('0x42')];_0x1b937f[_0xd7e3('0x67')]=qs[_0xd7e3('0x4c')](_0x3a0e1e[_0xd7e3('0x44')][_0xd7e3('0x4c')]);_0x1b937f['where']=qs[_0xd7e3('0x46')](_[_0xd7e3('0x4e')](_0x3a0e1e[_0xd7e3('0x44')],_0x2a0dc2[_0xd7e3('0x46')]));if(_0x3a0e1e['query']['filter']){_0x1b937f[_0xd7e3('0x4d')]=_['merge'](_0x1b937f[_0xd7e3('0x4d')],{'$or':_['map'](_0x1b937f[_0xd7e3('0x48')],function(_0x28521c){var _0x4fd541={};_0x4fd541[_0x28521c]={'$like':'%'+_0x3a0e1e['query']['filter']+'%'};return _0x4fd541;})});}_0x1b937f=_[_0xd7e3('0x50')]({},_0x1b937f,_0x3a0e1e[_0xd7e3('0x52')]);return _0x4bf171[_0xd7e3('0xdc')](_0x1b937f);}})[_0xd7e3('0x34')](function(_0x15a681){if(_0x15a681){_0x21bf90=_0x15a681['length'];if(!_0x3a0e1e[_0xd7e3('0x44')][_0xd7e3('0x4a')]('nolimit')){_0x1b937f['limit']=qs[_0xd7e3('0x2d')](_0x3a0e1e[_0xd7e3('0x44')]['limit']);_0x1b937f[_0xd7e3('0x2a')]=qs['offset'](_0x3a0e1e[_0xd7e3('0x44')]['offset']);}return _0x4bf171[_0xd7e3('0xdc')](_0x1b937f);}})['then'](function(_0x1c3d12){if(_0x1c3d12){return _0x1c3d12?{'count':_0x21bf90,'rows':_0x1c3d12}:null;}})[_0xd7e3('0x34')](respondWithResult(_0x1f7238,null))[_0xd7e3('0x26')](handleError(_0x1f7238,null));}; \ No newline at end of file +var _0x9484=['message_id','plivo','Text','MessageUUID','infobip','results','originatingAddress','segmentedMessage','fromNumber','bandwidth','intelepeer','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','list','contact','SmsInteraction','spread','interaction','created','autoclose','applications','close','unmanaged','SmsMessage','AttachmentId','UserId','unshift','agent','waitForTheAssignedAgent','*,*,*,*','Start','startRouting','receiveMessage','entity\x20found','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','Content-Type','text/xml','\x0a','findOne','sequelize','transaction','findAndCountAll','getApplications','nolimit','getInteractions','Contact','Owner','fullname','internal','Tag','Tags','color','tag','to\x20is\x20mandatory','List','out','dataValues','Messages','push','received\x20delivery\x20report\x20from','skebby','skebby_dispatch_id','requestid','statusInt','clicksend','status_code','DELIVERED','groupName','clickatell','redif','error_code','inspect','DELIVERED_TO_GATEWAY','message-delivered','DELIVRD','ACCEPTD','statusGet','message-id','csc','addAgents','emit','userSmsAccount:save','removeAgents','userSmsAccount:remove','getAgents','User','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','localhost','socket.io-emitter','redis','jayson/promise','client','http','request','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','end','offset','limit','undefined','count','set','json','apply','save','update','destroy','get','SmsAccounts','UserProfileResource','name','send','index','Pause','mandatoryDispositionPause','map','SmsAccount','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','order','sort','where','pick','type','VIRTUAL','filter','include','findAll','rows','show','params','includeAll','merge','find','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','create','describe','SmsAccountId','Disposition','getDispositions','hasOwnProperty','options','removeDispositions','addAnswer','CannedAnswer','removeAnswers','ids','notify','sms','SmsApplication','account','orderBy','Applications','priority','asc','CmContact','Sequelize','ValidationError','createdAt','difference','updatedAt','CompanyId','ListId','mobile','twilio','from','From','Body','messageId','MessageSid','sender','text','connectel'];(function(_0x1833cd,_0x4ffdd9){var _0x1956a2=function(_0x4a6016){while(--_0x4a6016){_0x1833cd['push'](_0x1833cd['shift']());}};_0x1956a2(++_0x4ffdd9);}(_0x9484,0x141));var _0x4948=function(_0x3b87f4,_0x112243){_0x3b87f4=_0x3b87f4-0x0;var _0x63d16e=_0x9484[_0x3b87f4];return _0x63d16e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4948('0x0'));var zipdir=require(_0x4948('0x1'));var jsonpatch=require(_0x4948('0x2'));var rp=require(_0x4948('0x3'));var moment=require(_0x4948('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x4948('0x5'));var util=require(_0x4948('0x6'));var path=require(_0x4948('0x7'));var sox=require('sox');var csv=require(_0x4948('0x8'));var ejs=require(_0x4948('0x9'));var fs=require('fs');var fs_extra=require(_0x4948('0xa'));var _=require(_0x4948('0xb'));var squel=require(_0x4948('0xc'));var crypto=require(_0x4948('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x4948('0xe'));var Papa=require(_0x4948('0xf'));var Redis=require(_0x4948('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x4948('0x11'));var as=require(_0x4948('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4948('0x13'))(_0x4948('0x14'));var utils=require(_0x4948('0x15'));var config=require(_0x4948('0x16'));var licenseUtil=require(_0x4948('0x17'));var db=require(_0x4948('0x18'))['db'];config['redis']=_[_0x4948('0x19')](config['redis'],{'host':_0x4948('0x1a'),'port':0x18eb});var socket=require(_0x4948('0x1b'))(new Redis(config[_0x4948('0x1c')]));require('./smsAccount.socket')['register'](socket);var jayson=require(_0x4948('0x1d'));var client=jayson[_0x4948('0x1e')][_0x4948('0x1f')]({'port':0x232c});function respondWithRpcPromise(_0x19690a,_0x38d861,_0x1d0b8e,_0xea576f){return new BPromise(function(_0x25336,_0x10424f){var _0xa8c4c=_0xea576f||client;return _0xa8c4c[_0x4948('0x20')](_0x19690a,_0x1d0b8e)[_0x4948('0x21')](function(_0x3a08fc){logger[_0x4948('0x22')](_0x4948('0x23'),_0x38d861,_0x4948('0x24'));logger[_0x4948('0x25')](_0x4948('0x26'),_0x38d861,_0x4948('0x24'),JSON[_0x4948('0x27')](_0x3a08fc));if(_0x3a08fc[_0x4948('0x28')]){if(_0x3a08fc['error'][_0x4948('0x29')]===0x1f4){logger[_0x4948('0x28')]('SmsAccount,\x20%s,\x20%s',_0x38d861,_0x3a08fc['error'][_0x4948('0x2a')]);return _0x10424f(_0x3a08fc['error']['message']);}logger['error'](_0x4948('0x23'),_0x38d861,_0x3a08fc[_0x4948('0x28')]['message']);return _0x25336(_0x3a08fc[_0x4948('0x28')]['message']);}else{logger['info'](_0x4948('0x23'),_0x38d861,_0x4948('0x24'));_0x25336(_0x3a08fc[_0x4948('0x2b')]['message']);}})[_0x4948('0x2c')](function(_0x967cb7){logger['error'](_0x4948('0x23'),_0x38d861,_0x967cb7);_0x10424f(_0x967cb7);});});}function respondWithStatusCode(_0x343499,_0x732681){_0x732681=_0x732681||0xcc;return function(_0xf1d45f){if(_0xf1d45f){return _0x343499['sendStatus'](_0x732681);}return _0x343499[_0x4948('0x2d')](_0x732681)[_0x4948('0x2e')]();};}function respondWithResult(_0x4ecb76,_0x646409){_0x646409=_0x646409||0xc8;return function(_0x32b2fa){if(_0x32b2fa){return _0x4ecb76[_0x4948('0x2d')](_0x646409)['json'](_0x32b2fa);}};}function respondWithFilteredResult(_0x3da4d4,_0x8962b4){return function(_0x34df8f){if(_0x34df8f){var _0x3c876e=typeof _0x8962b4[_0x4948('0x2f')]==='undefined'&&typeof _0x8962b4[_0x4948('0x30')]===_0x4948('0x31');var _0x57a0ea=_0x34df8f['count'];var _0x153a02=_0x3c876e?0x0:_0x8962b4['offset'];var _0x33708d=_0x3c876e?_0x34df8f[_0x4948('0x32')]:_0x8962b4['offset']+_0x8962b4['limit'];var _0x573db6;if(_0x33708d>=_0x57a0ea){_0x33708d=_0x57a0ea;_0x573db6=0xc8;}else{_0x573db6=0xce;}_0x3da4d4[_0x4948('0x2d')](_0x573db6);return _0x3da4d4[_0x4948('0x33')]('Content-Range',_0x153a02+'-'+_0x33708d+'/'+_0x57a0ea)[_0x4948('0x34')](_0x34df8f);}return null;};}function patchUpdates(_0x384d20){return function(_0x4af2de){try{jsonpatch[_0x4948('0x35')](_0x4af2de,_0x384d20,!![]);}catch(_0x1bc034){return BPromise['reject'](_0x1bc034);}return _0x4af2de[_0x4948('0x36')]();};}function saveUpdates(_0x4e0f48,_0x5e57e7){return function(_0x3784a0){if(_0x3784a0){return _0x3784a0[_0x4948('0x37')](_0x4e0f48)[_0x4948('0x21')](function(_0x2b1ec5){return _0x2b1ec5;});}return null;};}function removeEntity(_0x167619,_0x147180){return function(_0x17422){if(_0x17422){return _0x17422[_0x4948('0x38')]()['then'](function(){var _0x5bab67=_0x17422[_0x4948('0x39')]({'plain':!![]});var _0x5b11b2=_0x4948('0x3a');return db[_0x4948('0x3b')]['destroy']({'where':{'type':_0x5b11b2,'resourceId':_0x5bab67['id']}})[_0x4948('0x21')](function(){return _0x17422;});})[_0x4948('0x21')](function(){_0x167619['status'](0xcc)[_0x4948('0x2e')]();});}};}function handleEntityNotFound(_0x20910b,_0xf3731f){return function(_0x899bee){if(!_0x899bee){_0x20910b['sendStatus'](0x194);}return _0x899bee;};}function handleError(_0x10aea8,_0x4684d2){_0x4684d2=_0x4684d2||0x1f4;return function(_0x39747c){logger[_0x4948('0x28')](_0x39747c['stack']);if(_0x39747c[_0x4948('0x3c')]){delete _0x39747c[_0x4948('0x3c')];}_0x10aea8[_0x4948('0x2d')](_0x4684d2)[_0x4948('0x3d')](_0x39747c);};}exports[_0x4948('0x3e')]=function(_0x4962fa,_0x5ec097){var _0x35d4ab={'include':[{'model':db[_0x4948('0x3f')],'as':_0x4948('0x40')}]},_0x195705={},_0x4d4244={'count':0x0,'rows':[]};var _0x537185=_[_0x4948('0x41')](db[_0x4948('0x42')][_0x4948('0x43')],function(_0x5413d6){return{'name':_0x5413d6[_0x4948('0x44')],'type':_0x5413d6['type'][_0x4948('0x45')]};});_0x195705[_0x4948('0x46')]=_['map'](_0x537185,_0x4948('0x3c'));_0x195705[_0x4948('0x47')]=_[_0x4948('0x48')](_0x4962fa[_0x4948('0x47')]);_0x195705[_0x4948('0x49')]=_[_0x4948('0x4a')](_0x195705['model'],_0x195705[_0x4948('0x47')]);_0x35d4ab['attributes']=_[_0x4948('0x4a')](_0x195705['model'],qs[_0x4948('0x4b')](_0x4962fa[_0x4948('0x47')][_0x4948('0x4b')]));_0x35d4ab[_0x4948('0x4c')]=_0x35d4ab[_0x4948('0x4c')][_0x4948('0x4d')]?_0x35d4ab[_0x4948('0x4c')]:_0x195705[_0x4948('0x46')];if(!_0x4962fa['query']['hasOwnProperty']('nolimit')){_0x35d4ab[_0x4948('0x30')]=qs[_0x4948('0x30')](_0x4962fa[_0x4948('0x47')][_0x4948('0x30')]);_0x35d4ab[_0x4948('0x2f')]=qs[_0x4948('0x2f')](_0x4962fa['query'][_0x4948('0x2f')]);}_0x35d4ab[_0x4948('0x4e')]=qs[_0x4948('0x4f')](_0x4962fa[_0x4948('0x47')]['sort']);_0x35d4ab[_0x4948('0x50')]=qs['filters'](_[_0x4948('0x51')](_0x4962fa[_0x4948('0x47')],_0x195705[_0x4948('0x49')]),_0x537185);if(_0x4962fa[_0x4948('0x47')]['filter']){_0x35d4ab[_0x4948('0x50')]=_['merge'](_0x35d4ab[_0x4948('0x50')],{'$or':_['map'](_0x537185,function(_0x56f5bd){if(_0x56f5bd[_0x4948('0x52')]!==_0x4948('0x53')){var _0xeac911={};_0xeac911[_0x56f5bd[_0x4948('0x3c')]]={'$like':'%'+_0x4962fa[_0x4948('0x47')][_0x4948('0x54')]+'%'};return _0xeac911;}})});}_0x35d4ab=_['merge']({},_0x35d4ab,_0x4962fa['options']);var _0x43d718={'where':_0x35d4ab['where']};return db[_0x4948('0x42')][_0x4948('0x32')](_0x43d718)[_0x4948('0x21')](function(_0x14655c){_0x4d4244['count']=_0x14655c;if(_0x4962fa[_0x4948('0x47')]['includeAll']){_0x35d4ab[_0x4948('0x55')]=[{'all':!![]}];}return db[_0x4948('0x42')][_0x4948('0x56')](_0x35d4ab);})[_0x4948('0x21')](function(_0x5ba553){_0x4d4244[_0x4948('0x57')]=_0x5ba553;return _0x4d4244;})[_0x4948('0x21')](respondWithFilteredResult(_0x5ec097,_0x35d4ab))[_0x4948('0x2c')](handleError(_0x5ec097,null));};exports[_0x4948('0x58')]=function(_0xf7c266,_0x540b9a){var _0x58b67c={'raw':![],'where':{'id':_0xf7c266[_0x4948('0x59')]['id']},'include':[{'model':db[_0x4948('0x3f')],'as':_0x4948('0x40')}]},_0x22263c={};_0x22263c[_0x4948('0x46')]=_['keys'](db['SmsAccount'][_0x4948('0x43')]);_0x22263c['query']=_[_0x4948('0x48')](_0xf7c266[_0x4948('0x47')]);_0x22263c[_0x4948('0x49')]=_[_0x4948('0x4a')](_0x22263c[_0x4948('0x46')],_0x22263c['query']);_0x58b67c['attributes']=_[_0x4948('0x4a')](_0x22263c[_0x4948('0x46')],qs[_0x4948('0x4b')](_0xf7c266[_0x4948('0x47')]['fields']));_0x58b67c[_0x4948('0x4c')]=_0x58b67c[_0x4948('0x4c')]['length']?_0x58b67c['attributes']:_0x22263c[_0x4948('0x46')];if(_0xf7c266[_0x4948('0x47')][_0x4948('0x5a')]){_0x58b67c['include']=[{'all':!![]}];}_0x58b67c=_[_0x4948('0x5b')]({},_0x58b67c,_0xf7c266['options']);return db[_0x4948('0x42')][_0x4948('0x5c')](_0x58b67c)[_0x4948('0x21')](handleEntityNotFound(_0x540b9a,null))[_0x4948('0x21')](respondWithResult(_0x540b9a,null))[_0x4948('0x2c')](handleError(_0x540b9a,null));};exports['create']=function(_0x15dc47,_0x30779b){return db[_0x4948('0x42')]['create'](_0x15dc47[_0x4948('0x5d')],{})[_0x4948('0x21')](function(_0x12da52){var _0x214b88=_0x15dc47[_0x4948('0x5e')][_0x4948('0x39')]({'plain':!![]});if(!_0x214b88)throw new Error(_0x4948('0x5f'));if(_0x214b88[_0x4948('0x60')]===_0x4948('0x5e')){var _0x4f54d6=_0x12da52[_0x4948('0x39')]({'plain':!![]});var _0x50e3e6=_0x4948('0x3a');return db[_0x4948('0x61')][_0x4948('0x5c')]({'where':{'name':_0x50e3e6,'userProfileId':_0x214b88['userProfileId']},'raw':!![]})[_0x4948('0x21')](function(_0x1e23c2){if(_0x1e23c2&&_0x1e23c2[_0x4948('0x62')]===0x0){return db['UserProfileResource'][_0x4948('0x63')]({'name':_0x4f54d6[_0x4948('0x3c')],'resourceId':_0x4f54d6['id'],'type':_0x1e23c2[_0x4948('0x3c')],'sectionId':_0x1e23c2['id']},{})[_0x4948('0x21')](function(){return _0x12da52;});}else{return _0x12da52;}})['catch'](function(_0x9f6c4e){logger[_0x4948('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x9f6c4e);throw _0x9f6c4e;});}return _0x12da52;})[_0x4948('0x21')](respondWithResult(_0x30779b,0xc9))[_0x4948('0x2c')](handleError(_0x30779b,null));};exports[_0x4948('0x37')]=function(_0x563438,_0x32900e){if(_0x563438[_0x4948('0x5d')]['id']){delete _0x563438[_0x4948('0x5d')]['id'];}return db[_0x4948('0x42')][_0x4948('0x5c')]({'where':{'id':_0x563438[_0x4948('0x59')]['id']},'include':[{'model':db[_0x4948('0x3f')],'as':_0x4948('0x40')}]})[_0x4948('0x21')](handleEntityNotFound(_0x32900e,null))[_0x4948('0x21')](saveUpdates(_0x563438['body'],null))['then'](respondWithResult(_0x32900e,null))[_0x4948('0x2c')](handleError(_0x32900e,null));};exports[_0x4948('0x38')]=function(_0x531aca,_0x1be0da){return db['SmsAccount']['find']({'where':{'id':_0x531aca[_0x4948('0x59')]['id']}})[_0x4948('0x21')](handleEntityNotFound(_0x1be0da,null))[_0x4948('0x21')](removeEntity(_0x1be0da,null))['catch'](handleError(_0x1be0da,null));};exports[_0x4948('0x64')]=function(_0x56cbb2,_0x21fe7a){return db[_0x4948('0x42')]['describe']()['then'](respondWithResult(_0x21fe7a,null))[_0x4948('0x2c')](handleError(_0x21fe7a,null));};exports['addDisposition']=function(_0x26b789,_0x23f1ab,_0x25a7d1){if(_0x26b789[_0x4948('0x5d')]['id']){delete _0x26b789[_0x4948('0x5d')]['id'];}return db['SmsAccount'][_0x4948('0x5c')]({'where':{'id':_0x26b789['params']['id']}})[_0x4948('0x21')](handleEntityNotFound(_0x23f1ab,null))['then'](function(_0x20aa3a){if(_0x20aa3a){_0x26b789[_0x4948('0x5d')][_0x4948('0x65')]=_0x20aa3a['id'];return db[_0x4948('0x66')]['create'](_0x26b789[_0x4948('0x5d')]);}})[_0x4948('0x21')](respondWithResult(_0x23f1ab,null))[_0x4948('0x2c')](handleError(_0x23f1ab,null));};exports[_0x4948('0x67')]=function(_0x427f43,_0x27f677,_0x1b5d2a){var _0x54fdbd={'raw':![],'where':{}};var _0x3a207a={};var _0x6b492e={'count':0x0,'rows':[]};return db[_0x4948('0x42')]['findOne']({'where':{'id':_0x427f43[_0x4948('0x59')]['id']}})[_0x4948('0x21')](handleEntityNotFound(_0x27f677,null))[_0x4948('0x21')](function(_0x1ed27c){if(_0x1ed27c){_0x3a207a[_0x4948('0x46')]=_['keys'](db[_0x4948('0x66')][_0x4948('0x43')]);_0x3a207a[_0x4948('0x47')]=_[_0x4948('0x48')](_0x427f43['query']);_0x3a207a[_0x4948('0x49')]=_[_0x4948('0x4a')](_0x3a207a[_0x4948('0x46')],_0x3a207a['query']);_0x54fdbd[_0x4948('0x4c')]=_[_0x4948('0x4a')](_0x3a207a[_0x4948('0x46')],qs[_0x4948('0x4b')](_0x427f43['query']['fields']));_0x54fdbd['attributes']=_0x54fdbd[_0x4948('0x4c')][_0x4948('0x4d')]?_0x54fdbd[_0x4948('0x4c')]:_0x3a207a[_0x4948('0x46')];if(!_0x427f43[_0x4948('0x47')][_0x4948('0x68')]('nolimit')){_0x54fdbd[_0x4948('0x30')]=qs['limit'](_0x427f43[_0x4948('0x47')]['limit']);_0x54fdbd[_0x4948('0x2f')]=qs[_0x4948('0x2f')](_0x427f43[_0x4948('0x47')]['offset']);}_0x54fdbd[_0x4948('0x4e')]=qs['sort'](_0x427f43[_0x4948('0x47')][_0x4948('0x4f')]);_0x54fdbd[_0x4948('0x50')]=qs[_0x4948('0x49')](_[_0x4948('0x51')](_0x427f43[_0x4948('0x47')],_0x3a207a[_0x4948('0x49')]));_0x54fdbd[_0x4948('0x50')][_0x4948('0x65')]=_0x1ed27c['id'];if(_0x427f43['query'][_0x4948('0x54')]){_0x54fdbd[_0x4948('0x50')]=_[_0x4948('0x5b')](_0x54fdbd[_0x4948('0x50')],{'$or':_[_0x4948('0x41')](_0x54fdbd[_0x4948('0x4c')],function(_0x2d78e0){var _0x41bf8d={};_0x41bf8d[_0x2d78e0]={'$like':'%'+_0x427f43[_0x4948('0x47')][_0x4948('0x54')]+'%'};return _0x41bf8d;})});}_0x54fdbd=_[_0x4948('0x5b')]({},_0x54fdbd,_0x427f43[_0x4948('0x69')]);return db[_0x4948('0x66')][_0x4948('0x32')]({'where':_0x54fdbd[_0x4948('0x50')]})[_0x4948('0x21')](function(_0x1e17bc){_0x6b492e[_0x4948('0x32')]=_0x1e17bc;if(_0x427f43[_0x4948('0x47')]['includeAll']){_0x54fdbd[_0x4948('0x55')]=[{'all':!![]}];}return db[_0x4948('0x66')]['findAll'](_0x54fdbd);})[_0x4948('0x21')](function(_0x5b99f5){_0x6b492e[_0x4948('0x57')]=_0x5b99f5;return _0x6b492e;});}})['then'](respondWithFilteredResult(_0x27f677,_0x54fdbd))['catch'](handleError(_0x27f677,null));};exports[_0x4948('0x6a')]=function(_0x3e025f,_0x6b2abe,_0x1ef41c){return db['SmsAccount'][_0x4948('0x5c')]({'where':{'id':_0x3e025f['params']['id']}})[_0x4948('0x21')](handleEntityNotFound(_0x6b2abe,null))['then'](function(_0x40a7dd){if(_0x40a7dd){return _0x40a7dd['removeDispositions'](_0x3e025f[_0x4948('0x47')]['ids']);}})[_0x4948('0x21')](respondWithStatusCode(_0x6b2abe,null))[_0x4948('0x2c')](handleError(_0x6b2abe,null));};exports[_0x4948('0x6b')]=function(_0x2148bf,_0x2767e9,_0x3e2e33){if(_0x2148bf[_0x4948('0x5d')]['id']){delete _0x2148bf[_0x4948('0x5d')]['id'];}return db[_0x4948('0x42')]['find']({'where':{'id':_0x2148bf[_0x4948('0x59')]['id']}})[_0x4948('0x21')](handleEntityNotFound(_0x2767e9,null))[_0x4948('0x21')](function(_0x1257b8){if(_0x1257b8){_0x2148bf[_0x4948('0x5d')][_0x4948('0x65')]=_0x1257b8['id'];return db['CannedAnswer'][_0x4948('0x63')](_0x2148bf['body']);}})[_0x4948('0x21')](respondWithResult(_0x2767e9,null))[_0x4948('0x2c')](handleError(_0x2767e9,null));};exports['getAnswers']=function(_0x1fb998,_0x4e2b58,_0x144eaf){var _0x33aa37={'raw':![],'where':{}};var _0x329da5={};var _0x2ef75a={'count':0x0,'rows':[]};return db[_0x4948('0x42')]['findOne']({'where':{'id':_0x1fb998['params']['id']}})[_0x4948('0x21')](handleEntityNotFound(_0x4e2b58,null))[_0x4948('0x21')](function(_0x27345e){if(_0x27345e){_0x329da5[_0x4948('0x46')]=_['keys'](db[_0x4948('0x6c')]['rawAttributes']);_0x329da5['query']=_[_0x4948('0x48')](_0x1fb998['query']);_0x329da5[_0x4948('0x49')]=_[_0x4948('0x4a')](_0x329da5[_0x4948('0x46')],_0x329da5[_0x4948('0x47')]);_0x33aa37[_0x4948('0x4c')]=_['intersection'](_0x329da5[_0x4948('0x46')],qs['fields'](_0x1fb998['query'][_0x4948('0x4b')]));_0x33aa37[_0x4948('0x4c')]=_0x33aa37[_0x4948('0x4c')]['length']?_0x33aa37[_0x4948('0x4c')]:_0x329da5[_0x4948('0x46')];if(!_0x1fb998['query'][_0x4948('0x68')]('nolimit')){_0x33aa37['limit']=qs[_0x4948('0x30')](_0x1fb998[_0x4948('0x47')][_0x4948('0x30')]);_0x33aa37['offset']=qs[_0x4948('0x2f')](_0x1fb998[_0x4948('0x47')]['offset']);}_0x33aa37[_0x4948('0x4e')]=qs[_0x4948('0x4f')](_0x1fb998[_0x4948('0x47')][_0x4948('0x4f')]);_0x33aa37['where']=qs['filters'](_['pick'](_0x1fb998[_0x4948('0x47')],_0x329da5['filters']));_0x33aa37[_0x4948('0x50')][_0x4948('0x65')]=_0x27345e['id'];if(_0x1fb998['query'][_0x4948('0x54')]){_0x33aa37[_0x4948('0x50')]=_[_0x4948('0x5b')](_0x33aa37['where'],{'$or':_[_0x4948('0x41')](_0x33aa37[_0x4948('0x4c')],function(_0x57650b){var _0x5f0b4f={};_0x5f0b4f[_0x57650b]={'$like':'%'+_0x1fb998[_0x4948('0x47')][_0x4948('0x54')]+'%'};return _0x5f0b4f;})});}_0x33aa37=_[_0x4948('0x5b')]({},_0x33aa37,_0x1fb998[_0x4948('0x69')]);return db[_0x4948('0x6c')][_0x4948('0x32')]({'where':_0x33aa37[_0x4948('0x50')]})[_0x4948('0x21')](function(_0x18d371){_0x2ef75a[_0x4948('0x32')]=_0x18d371;if(_0x1fb998[_0x4948('0x47')][_0x4948('0x5a')]){_0x33aa37['include']=[{'all':!![]}];}return db[_0x4948('0x6c')][_0x4948('0x56')](_0x33aa37);})[_0x4948('0x21')](function(_0x1019d0){_0x2ef75a[_0x4948('0x57')]=_0x1019d0;return _0x2ef75a;});}})[_0x4948('0x21')](respondWithFilteredResult(_0x4e2b58,_0x33aa37))[_0x4948('0x2c')](handleError(_0x4e2b58,null));};exports[_0x4948('0x6d')]=function(_0x5bd38e,_0x470163,_0xd456a4){return db['SmsAccount'][_0x4948('0x5c')]({'where':{'id':_0x5bd38e['params']['id']}})[_0x4948('0x21')](handleEntityNotFound(_0x470163,null))[_0x4948('0x21')](function(_0x441af6){if(_0x441af6){return _0x441af6[_0x4948('0x6d')](_0x5bd38e[_0x4948('0x47')][_0x4948('0x6e')]);}})[_0x4948('0x21')](respondWithStatusCode(_0x470163,null))[_0x4948('0x2c')](handleError(_0x470163,null));};exports[_0x4948('0x6f')]=function(_0x19fca7,_0x11a505,_0x141096){var _0x426dc2={'channel':_0x4948('0x70')};var _0xa31d0f=[];var _0x1e63ef=[];var _0x107cf7={};return db[_0x4948('0x42')][_0x4948('0x5c')]({'where':{'id':_0x19fca7['params']['id']},'include':[{'model':db[_0x4948('0x71')],'as':'Applications'}]})[_0x4948('0x21')](handleEntityNotFound(_0x11a505,null))[_0x4948('0x21')](function(_0x2f8b19){_0x426dc2[_0x4948('0x72')]=_0x2f8b19;_0x426dc2['applications']=_[_0x4948('0x73')](_0x2f8b19[_0x4948('0x74')],[_0x4948('0x75')],[_0x4948('0x76')]);if(_0x426dc2[_0x4948('0x72')]['Applications']){delete _0x426dc2[_0x4948('0x72')][_0x4948('0x74')];}return db[_0x4948('0x77')][_0x4948('0x64')]();})['then'](function(_0x2ff57e){if(!_0x2ff57e){throw new db[(_0x4948('0x78'))][(_0x4948('0x79'))]('no\x20available\x20attributes');}_0xa31d0f=_['difference'](_[_0x4948('0x48')](_0x2ff57e),[_0x4948('0x7a'),'updatedAt']);_0x1e63ef=_[_0x4948('0x7b')](_[_0x4948('0x48')](_0x2ff57e),[_0x4948('0x7a'),_0x4948('0x7c'),_0x4948('0x7d'),_0x4948('0x7e')]);_0x426dc2[_0x4948('0x5d')]={'mapKey':_0x4948('0x7f')};if(_0x426dc2[_0x4948('0x72')][_0x4948('0x52')]){switch(_0x426dc2['account'][_0x4948('0x52')]){case _0x4948('0x80'):_0x426dc2['body'][_0x4948('0x81')]=_0x19fca7[_0x4948('0x5d')][_0x4948('0x82')];_0x426dc2[_0x4948('0x5d')][_0x4948('0x5d')]=_0x19fca7[_0x4948('0x5d')][_0x4948('0x83')];_0x426dc2['body'][_0x4948('0x84')]=_0x19fca7['body'][_0x4948('0x85')];break;case'skebby':_0x426dc2[_0x4948('0x5d')][_0x4948('0x81')]='+'+_0x19fca7[_0x4948('0x5d')][_0x4948('0x86')];_0x426dc2[_0x4948('0x5d')][_0x4948('0x5d')]=_0x19fca7[_0x4948('0x5d')][_0x4948('0x87')];break;case _0x4948('0x88'):_0x426dc2['body'][_0x4948('0x81')]=_0x19fca7['body'][_0x4948('0x81')];_0x426dc2[_0x4948('0x5d')][_0x4948('0x5d')]=_0x19fca7['body']['message'];break;case'clicksend':_0x426dc2[_0x4948('0x5d')]['from']=_0x19fca7[_0x4948('0x5d')]['from'];_0x426dc2['body'][_0x4948('0x5d')]=_0x19fca7[_0x4948('0x5d')][_0x4948('0x5d')];_0x426dc2[_0x4948('0x5d')][_0x4948('0x84')]=_0x19fca7[_0x4948('0x5d')][_0x4948('0x89')];break;case _0x4948('0x8a'):_0x426dc2[_0x4948('0x5d')][_0x4948('0x81')]=_0x19fca7['body'][_0x4948('0x82')];_0x426dc2[_0x4948('0x5d')][_0x4948('0x5d')]=_0x19fca7[_0x4948('0x5d')][_0x4948('0x8b')];_0x426dc2[_0x4948('0x5d')]['messageId']=_0x19fca7[_0x4948('0x5d')][_0x4948('0x8c')];break;case _0x4948('0x8d'):_0x426dc2[_0x4948('0x5d')][_0x4948('0x81')]='+'+_0x19fca7[_0x4948('0x5d')][_0x4948('0x8e')][0x0][_0x4948('0x81')];_0x426dc2['body']['body']=_0x19fca7[_0x4948('0x5d')][_0x4948('0x8e')][0x0]['text'];_0x426dc2[_0x4948('0x5d')]['messageId']=_0x19fca7[_0x4948('0x5d')]['results'][0x0][_0x4948('0x84')];break;case'csc':_0x426dc2[_0x4948('0x5d')][_0x4948('0x81')]=_0x19fca7['body'][_0x4948('0x8f')];_0x426dc2[_0x4948('0x5d')]['body']=_0x19fca7[_0x4948('0x5d')][_0x4948('0x90')][_0x4948('0x2a')];break;case'clickatell':_0x426dc2[_0x4948('0x5d')]['from']=_0x19fca7[_0x4948('0x5d')][_0x4948('0x91')];_0x426dc2['body']['body']=_0x19fca7[_0x4948('0x5d')][_0x4948('0x87')];_0x426dc2[_0x4948('0x5d')][_0x4948('0x84')]=_0x19fca7[_0x4948('0x5d')]['replyMessageId'];break;case _0x4948('0x92'):_0x426dc2['body'][_0x4948('0x84')]=_0x19fca7[_0x4948('0x5d')][0x0][_0x4948('0x2a')]['id'];_0x426dc2['body']['from']=_0x19fca7[_0x4948('0x5d')][0x0][_0x4948('0x2a')][_0x4948('0x81')];_0x426dc2['body'][_0x4948('0x5d')]=_0x19fca7['body'][0x0][_0x4948('0x2a')][_0x4948('0x87')];break;case _0x4948('0x93'):_0x426dc2[_0x4948('0x5d')][_0x4948('0x81')]=_0x19fca7['body']['from'];_0x426dc2[_0x4948('0x5d')]['body']=_0x19fca7[_0x4948('0x5d')][_0x4948('0x2a')];_0x426dc2['body']['messageId']=_0x19fca7['body']['refid'];break;}}if(_0x426dc2['body']['id']){delete _0x426dc2['body']['id'];}if(_[_0x4948('0x94')](_0x426dc2['body']['from'])){throw new db[(_0x4948('0x78'))]['ValidationError']('from\x20is\x20mandatory');}if(_[_0x4948('0x94')](_0x426dc2[_0x4948('0x5d')][_0x4948('0x5d')])||_0x426dc2[_0x4948('0x5d')][_0x4948('0x5d')]===''){throw new db[(_0x4948('0x78'))]['ValidationError'](_0x4948('0x95'));}if(_[_0x4948('0x94')](_0x426dc2[_0x4948('0x5d')]['mapKey'])){throw new db[(_0x4948('0x78'))][(_0x4948('0x79'))](_0x4948('0x96')+_0x1e63ef);}if(!_[_0x4948('0x97')](_0x1e63ef,_0x426dc2['body'][_0x4948('0x98')])){throw new db[(_0x4948('0x78'))][(_0x4948('0x79'))](_0x4948('0x99')+_0x1e63ef);}_0x107cf7[_0x426dc2[_0x4948('0x5d')][_0x4948('0x98')]]=_0x426dc2[_0x4948('0x5d')][_0x4948('0x81')];return db[_0x4948('0x9a')][_0x4948('0x5c')]({'where':{'id':_0x426dc2[_0x4948('0x72')][_0x4948('0x7e')]},'include':[{'model':db[_0x4948('0x77')],'as':_0x4948('0x9b'),'where':_0x107cf7,'limit':0x1,'order':[[_0x4948('0x7c'),'DESC']]}]});})[_0x4948('0x21')](handleEntityNotFound(_0x11a505,null))['then'](function(_0x2e2cfb){if(_0x2e2cfb){_0x426dc2[_0x4948('0x9c')]=_['omit'](_0x2e2cfb,[_0x4948('0x9b')]);if(_0x2e2cfb[_0x4948('0x9b')][_0x4948('0x4d')]){return _0x2e2cfb[_0x4948('0x9b')][0x0];}var _0x5a20fe=_['defaults'](_0x426dc2[_0x4948('0x5d')],{'firstName':_0x426dc2['body'][_0x4948('0x81')],'ListId':_0x2e2cfb['id']});_0x5a20fe[_0x426dc2[_0x4948('0x5d')]['mapKey']]=_0x426dc2[_0x4948('0x5d')][_0x4948('0x81')];return db[_0x4948('0x77')][_0x4948('0x63')](_0x5a20fe,{'fields':_0xa31d0f,'raw':!![]});}})['then'](handleEntityNotFound(_0x11a505,null))[_0x4948('0x21')](function(_0x3180a9){if(_0x3180a9){_0x426dc2[_0x4948('0x9d')]=_0x3180a9;var _0x58b1c8={'ContactId':_0x3180a9['id'],'phone':_0x426dc2[_0x4948('0x5d')]['from'],'SmsAccountId':_0x19fca7['params']['id']};var _0x5c4d13={'ContactId':_0x3180a9['id'],'SmsAccountId':_0x19fca7[_0x4948('0x59')]['id'],'closed':![]};return db[_0x4948('0x9e')]['find']({'where':_0x5c4d13})[_0x4948('0x21')](function(_0x584a11){if(_0x584a11){return[_0x584a11,![]];}return db[_0x4948('0x9e')][_0x4948('0x63')](_0x58b1c8)[_0x4948('0x21')](function(_0x319090){return[_0x319090,!![]];});});}})[_0x4948('0x9f')](function(_0x4b42fd,_0x5d9dab){_0x426dc2[_0x4948('0xa0')]=_0x4b42fd[_0x4948('0x39')]({'plain':!![]});_0x426dc2[_0x4948('0xa0')][_0x4948('0xa1')]=![];if(_0x5d9dab){if(_0x426dc2['account'][_0x4948('0xa2')]){_0x426dc2['applications']['push']({'id':0x0,'priority':_0x426dc2[_0x4948('0xa3')][_0x4948('0x4d')]+0x1,'app':_0x4948('0xa4'),'appdata':_0x4948('0xa5'),'interval':'*,*,*,*'});}_0x426dc2[_0x4948('0xa0')][_0x4948('0xa1')]=!![];}return db[_0x4948('0xa6')][_0x4948('0x63')]({'phone':_0x426dc2[_0x4948('0x5d')]['from'],'messageId':_0x426dc2[_0x4948('0x5d')][_0x4948('0x84')],'body':_0x426dc2[_0x4948('0x5d')][_0x4948('0x5d')],'SmsAccountId':_0x19fca7[_0x4948('0x59')]['id'],'SmsInteractionId':_0x4b42fd['id'],'direction':'in','ContactId':_0x4b42fd['ContactId'],'AttachmentId':_0x426dc2[_0x4948('0x5d')][_0x4948('0xa7')]});})[_0x4948('0x21')](function(_0x320286){_0x426dc2[_0x4948('0x2a')]=_0x320286;if(_0x426dc2[_0x4948('0xa0')][_0x4948('0xa8')]){return db['User']['find']({'attributes':['id',_0x4948('0x3c')],'where':{'id':_0x426dc2[_0x4948('0xa0')]['UserId']}})['then'](function(_0x47c76e){if(_0x47c76e){_0x426dc2[_0x4948('0xa3')][_0x4948('0xa9')]({'id':0x0,'priority':0x0,'app':_0x4948('0xaa'),'appdata':_0x47c76e[_0x4948('0x3c')]+','+(_0x426dc2['account'][_0x4948('0xab')]||0xa),'interval':_0x4948('0xac')});}return respondWithRpcPromise(_0x4948('0xad'),_0x4948('0xae'),_0x426dc2);});}return respondWithRpcPromise(_0x4948('0xad'),'startRouting',_0x426dc2);})[_0x4948('0x21')](function(_0x1dd462){if(_0x1dd462){var _0x3da1bf=0xc8;var _0x4a853b=_0x4948('0xaf');logger[_0x4948('0x22')](_0x4948('0x26'),_0x4a853b,_0x3da1bf,_0x4948('0xb0'));logger[_0x4948('0x25')](_0x4948('0xb1'),_0x4a853b,_0x3da1bf,_0x4948('0xb0'),JSON['stringify'](_0x1dd462));if(_0x426dc2[_0x4948('0x72')][_0x4948('0x52')]===_0x4948('0x80')){return _0x11a505[_0x4948('0x2d')](_0x3da1bf)[_0x4948('0x33')](_0x4948('0xb2'),_0x4948('0xb3'))[_0x4948('0x3d')](_0x4948('0xb4'));}else{return _0x11a505[_0x4948('0x2d')](_0x3da1bf)[_0x4948('0x34')](_0x1dd462);}}})[_0x4948('0x2c')](handleError(_0x11a505,null));};exports['addApplications']=function(_0x4d5cd4,_0x31e224,_0x1b3c84){return db[_0x4948('0x42')][_0x4948('0xb5')]({'where':{'id':_0x4d5cd4[_0x4948('0x59')]['id']}})[_0x4948('0x21')](handleEntityNotFound(_0x31e224,null))[_0x4948('0x21')](function(_0x45e209){if(_0x45e209){return db[_0x4948('0xb6')][_0x4948('0xb7')](function(_0x30cb8e){return db[_0x4948('0x71')][_0x4948('0x38')]({'where':{'SmsAccountId':_0x4d5cd4[_0x4948('0x59')]['id']},'transaction':_0x30cb8e})['then'](function(_0x2dff96){var _0xed184c=_[_0x4948('0x41')](_0x4d5cd4[_0x4948('0x5d')],function(_0x165539){_0x165539[_0x4948('0x65')]=_0x4d5cd4[_0x4948('0x59')]['id'];return _0x165539;});return db[_0x4948('0x71')]['bulkCreate'](_0xed184c,{'transaction':_0x30cb8e});});})['then'](function(){return db[_0x4948('0x71')][_0x4948('0xb8')]({'where':{'SmsAccountId':_0x4d5cd4[_0x4948('0x59')]['id']},'order':_0x4948('0x75')});});}})['then'](respondWithResult(_0x31e224,null))['catch'](handleError(_0x31e224,null));};exports[_0x4948('0xb9')]=function(_0x32c426,_0x3ba04e,_0x423a53){var _0x18155e={};var _0x2e2ed1={};var _0x132b6d;var _0xcbea1e;return db[_0x4948('0x42')][_0x4948('0xb5')]({'where':{'id':_0x32c426['params']['id']}})[_0x4948('0x21')](handleEntityNotFound(_0x3ba04e,null))[_0x4948('0x21')](function(_0x19ba64){if(_0x19ba64){_0x132b6d=_0x19ba64;_0x2e2ed1[_0x4948('0x46')]=_[_0x4948('0x48')](db[_0x4948('0x71')][_0x4948('0x43')]);_0x2e2ed1['query']=_['keys'](_0x32c426[_0x4948('0x47')]);_0x2e2ed1[_0x4948('0x49')]=_['intersection'](_0x2e2ed1[_0x4948('0x46')],_0x2e2ed1['query']);_0x18155e[_0x4948('0x4c')]=_[_0x4948('0x4a')](_0x2e2ed1[_0x4948('0x46')],qs['fields'](_0x32c426[_0x4948('0x47')][_0x4948('0x4b')]));_0x18155e[_0x4948('0x4c')]=_0x18155e['attributes'][_0x4948('0x4d')]?_0x18155e[_0x4948('0x4c')]:_0x2e2ed1[_0x4948('0x46')];_0x18155e[_0x4948('0x4e')]=qs['sort'](_0x32c426[_0x4948('0x47')][_0x4948('0x4f')]);_0x18155e[_0x4948('0x50')]=qs[_0x4948('0x49')](_[_0x4948('0x51')](_0x32c426['query'],_0x2e2ed1[_0x4948('0x49')]));if(_0x32c426[_0x4948('0x47')][_0x4948('0x54')]){_0x18155e['where']=_[_0x4948('0x5b')](_0x18155e[_0x4948('0x50')],{'$or':_[_0x4948('0x41')](_0x18155e['attributes'],function(_0x17fdaa){var _0x4a510b={};_0x4a510b[_0x17fdaa]={'$like':'%'+_0x32c426['query']['filter']+'%'};return _0x4a510b;})});}_0x18155e=_[_0x4948('0x5b')]({},_0x18155e,_0x32c426[_0x4948('0x69')]);return _0x132b6d[_0x4948('0xb9')](_0x18155e);}})[_0x4948('0x21')](function(_0x7b3b43){if(_0x7b3b43){_0xcbea1e=_0x7b3b43[_0x4948('0x4d')];if(!_0x32c426[_0x4948('0x47')]['hasOwnProperty'](_0x4948('0xba'))){_0x18155e[_0x4948('0x30')]=qs[_0x4948('0x30')](_0x32c426[_0x4948('0x47')][_0x4948('0x30')]);_0x18155e[_0x4948('0x2f')]=qs[_0x4948('0x2f')](_0x32c426[_0x4948('0x47')]['offset']);}return _0x132b6d[_0x4948('0xb9')](_0x18155e);}})[_0x4948('0x21')](function(_0x3dcda5){if(_0x3dcda5){return _0x3dcda5?{'count':_0xcbea1e,'rows':_0x3dcda5}:null;}})['then'](respondWithResult(_0x3ba04e,null))[_0x4948('0x2c')](handleError(_0x3ba04e,null));};exports[_0x4948('0xbb')]=function(_0x4e252b,_0x5b55a3,_0x2df950){var _0xa6d099={'raw':![],'where':{}};var _0x1d698e={};var _0x1588c7={'count':0x0,'rows':[]};return db[_0x4948('0x42')][_0x4948('0xb5')]({'where':{'id':_0x4e252b['params']['id']}})[_0x4948('0x21')](handleEntityNotFound(_0x5b55a3,null))[_0x4948('0x21')](function(_0xf6f736){if(_0xf6f736){_0x1d698e['model']=_[_0x4948('0x48')](db[_0x4948('0x9e')][_0x4948('0x43')]);_0x1d698e[_0x4948('0x47')]=_[_0x4948('0x48')](_0x4e252b['query']);_0x1d698e['filters']=_['intersection'](_0x1d698e['model'],_0x1d698e[_0x4948('0x47')]);_0xa6d099[_0x4948('0x4c')]=_[_0x4948('0x4a')](_0x1d698e[_0x4948('0x46')],qs[_0x4948('0x4b')](_0x4e252b[_0x4948('0x47')][_0x4948('0x4b')]));_0xa6d099[_0x4948('0x4c')]=_0xa6d099['attributes'][_0x4948('0x4d')]?_0xa6d099[_0x4948('0x4c')]:_0x1d698e[_0x4948('0x46')];if(!_0x4e252b[_0x4948('0x47')][_0x4948('0x68')](_0x4948('0xba'))){_0xa6d099[_0x4948('0x30')]=qs['limit'](_0x4e252b[_0x4948('0x47')]['limit']);_0xa6d099[_0x4948('0x2f')]=qs[_0x4948('0x2f')](_0x4e252b['query']['offset']);}_0xa6d099[_0x4948('0x4e')]=qs[_0x4948('0x4f')](_0x4e252b[_0x4948('0x47')][_0x4948('0x4f')]);_0xa6d099[_0x4948('0x50')]=qs[_0x4948('0x49')](_['pick'](_0x4e252b[_0x4948('0x47')],_0x1d698e['filters']));_0xa6d099[_0x4948('0x50')][_0x4948('0x65')]=_0xf6f736['id'];if(_0x4e252b[_0x4948('0x47')]['filter']){_0xa6d099[_0x4948('0x50')]=_[_0x4948('0x5b')](_0xa6d099['where'],{'$or':_[_0x4948('0x41')](_0xa6d099['attributes'],function(_0x13e5d4){var _0x35c2cf={};_0x35c2cf[_0x13e5d4]={'$like':'%'+_0x4e252b[_0x4948('0x47')]['filter']+'%'};return _0x35c2cf;})});}_0xa6d099=_[_0x4948('0x5b')]({},_0xa6d099,_0x4e252b['options']);return db[_0x4948('0x9e')]['count']({'where':_0xa6d099[_0x4948('0x50')]})[_0x4948('0x21')](function(_0x4602b9){_0x1588c7[_0x4948('0x32')]=_0x4602b9;if(_0x4e252b[_0x4948('0x47')][_0x4948('0x5a')]){_0xa6d099[_0x4948('0x55')]=[{'model':db[_0x4948('0x77')],'as':_0x4948('0xbc'),'required':![]},{'model':db['User'],'as':_0x4948('0xbd'),'attributes':['name',_0x4948('0xbe'),_0x4948('0xbf')],'required':![]},{'model':db[_0x4948('0xc0')],'as':_0x4948('0xc1'),'attributes':['id',_0x4948('0x3c'),_0x4948('0xc2')],'where':_0x4e252b[_0x4948('0x47')]['tag']?{'id':_0x4e252b[_0x4948('0x47')][_0x4948('0xc3')]}:undefined,'required':_0x4e252b[_0x4948('0x47')][_0x4948('0xc3')]?!![]:![]}];}return db['SmsInteraction']['findAll'](_0xa6d099);})[_0x4948('0x21')](function(_0xa49583){_0x1588c7[_0x4948('0x57')]=_0xa49583;return _0x1588c7;});}})[_0x4948('0x21')](respondWithFilteredResult(_0x5b55a3,_0xa6d099))[_0x4948('0x2c')](handleError(_0x5b55a3,null));};exports['send']=function(_0x2b2552,_0x3a9f66,_0x4b637e){var _0x33fbf1,_0x1fffb6,_0x5e5a2c;if(_[_0x4948('0x94')](_0x2b2552[_0x4948('0x5d')]['body'])||_0x2b2552[_0x4948('0x5d')][_0x4948('0x5d')]===''){throw new db['Sequelize']['ValidationError'](_0x4948('0x95'));}if(_[_0x4948('0x94')](_0x2b2552[_0x4948('0x5d')]['to'])){throw new db[(_0x4948('0x78'))][(_0x4948('0x79'))](_0x4948('0xc4'));}_0x33fbf1=_0x2b2552[_0x4948('0x5d')]['to'];return db[_0x4948('0x42')][_0x4948('0x5c')]({'where':{'id':_0x2b2552[_0x4948('0x59')]['id']},'include':[{'model':db[_0x4948('0x9a')],'as':_0x4948('0xc5'),'include':[{'model':db['CmContact'],'as':'Contacts','where':{'mobile':_0x33fbf1},'limit':0x1,'order':[[_0x4948('0x7c'),'DESC']]}]}]})['then'](handleEntityNotFound(_0x3a9f66,null))['then'](function(_0x54ea25){if(_0x54ea25&&_0x54ea25[_0x4948('0xc5')]){_0x1fffb6=_0x54ea25[_0x4948('0x39')]({'plain':!![]});if(_0x1fffb6['List']&&_0x1fffb6['List'][_0x4948('0x9b')][_0x4948('0x4d')]){return _0x1fffb6[_0x4948('0xc5')][_0x4948('0x9b')][0x0];}return db['CmContact']['create'](_[_0x4948('0x19')](_0x2b2552[_0x4948('0x5d')],{'firstName':_0x33fbf1,'mobile':_0x33fbf1,'phone':_0x33fbf1,'ListId':_0x1fffb6[_0x4948('0x7e')]}));}})[_0x4948('0x21')](handleEntityNotFound(_0x3a9f66,null))['then'](function(_0x5c021b){if(_0x5c021b){_0x5e5a2c=_0x5c021b;return db[_0x4948('0x9e')]['find']({'where':{'ContactId':_0x5e5a2c['id'],'closed':![],'SmsAccountId':_0x1fffb6['id']}})['then'](function(_0x4590fa){if(_0x4590fa){return[_0x4590fa,![]];}return db[_0x4948('0x9e')]['create']({'UserId':_0x2b2552[_0x4948('0x5e')]['id'],'ContactId':_0x5e5a2c['id'],'SmsAccountId':_0x1fffb6['id'],'phone':_0x33fbf1,'firstMsgDirection':_0x4948('0xc6'),'Messages':[_[_0x4948('0x5b')](_0x2b2552['body'],{'read':![],'body':_0x2b2552[_0x4948('0x5d')][_0x4948('0x5d')],'phone':_0x33fbf1,'SmsAccountId':_0x1fffb6['id'],'UserId':_0x2b2552[_0x4948('0x5e')]['id'],'ContactId':_0x5e5a2c['id']})]},{'include':[{'model':db[_0x4948('0xa6')],'as':'Messages'}]})[_0x4948('0x21')](function(_0x378522){return[_0x378522,!![]];});});}})['spread'](function(_0x1e0fcc,_0x2f12df){if(_0x2f12df){return _0x1e0fcc;}return db[_0x4948('0xa6')][_0x4948('0x63')](_['merge'](_0x2b2552[_0x4948('0x5d')],{'read':![],'body':_0x2b2552['body']['body'],'phone':_0x33fbf1,'SmsAccountId':_0x1fffb6['id'],'SmsInteractionId':_0x1e0fcc['id'],'UserId':_0x2b2552[_0x4948('0x5e')]['id'],'ContactId':_0x5e5a2c['id']}))['then'](function(_0x603469){_0x1e0fcc[_0x4948('0xc7')][_0x4948('0xc8')]=[];_0x1e0fcc['dataValues'][_0x4948('0xc8')][_0x4948('0xc9')](_0x603469[_0x4948('0xc7')]);return _0x1e0fcc;});})[_0x4948('0x21')](respondWithResult(_0x3a9f66,null))[_0x4948('0x2c')](handleError(_0x3a9f66,null));};exports[_0x4948('0x2d')]=function(_0x4cc86b,_0x47c3f5,_0x4b34b8){if(_0x4cc86b[_0x4948('0x5d')]['id']){delete _0x4cc86b[_0x4948('0x5d')]['id'];}var _0x5ba5dd,_0x69b10d,_0xc1c042;return db[_0x4948('0x42')][_0x4948('0x5c')]({'where':{'id':_0x4cc86b[_0x4948('0x59')]['id']}})[_0x4948('0x21')](handleEntityNotFound(_0x47c3f5,null))['then'](function(_0x3dca3){if(_0x3dca3){_0xc1c042=_0x3dca3;logger[_0x4948('0x25')](_0x4948('0x26'),'status',_0x4948('0xca'),_0x3dca3['type'],util['inspect'](_0x4cc86b[_0x4948('0x5d')],{'showHidden':![],'depth':null}));switch(_0x3dca3['type']){case _0x4948('0xcb'):if(_0x4cc86b[_0x4948('0x5d')][_0x4948('0xcc')]&&_0x4cc86b[_0x4948('0x5d')][_0x4948('0x2d')]){_0x69b10d=_0x4cc86b[_0x4948('0x5d')][_0x4948('0x2d')];return db[_0x4948('0xa6')][_0x4948('0x5c')]({'where':{'messageId':_0x4cc86b[_0x4948('0x5d')][_0x4948('0xcc')]}});}break;case _0x4948('0x88'):if(_0x4cc86b['body'][_0x4948('0xcd')]&&_0x4cc86b['body'][_0x4948('0xce')]){_0x69b10d=_0x4cc86b[_0x4948('0x5d')][_0x4948('0xce')];return db[_0x4948('0xa6')]['find']({'where':{'messageId':_0x4cc86b[_0x4948('0x5d')][_0x4948('0xcd')]}});}break;case _0x4948('0xcf'):if(_0x4cc86b[_0x4948('0x5d')][_0x4948('0x89')]&&_0x4cc86b[_0x4948('0x5d')]['status_code']){_0x69b10d=_0x4cc86b[_0x4948('0x5d')][_0x4948('0xd0')];return db[_0x4948('0xa6')][_0x4948('0x5c')]({'where':{'messageId':_0x4cc86b['body'][_0x4948('0x89')]}});}break;case _0x4948('0x8d'):var _0x452e9e=_0x4cc86b['body']['results'][0x0];if(_0x452e9e[_0x4948('0x84')]&&_0x452e9e[_0x4948('0x2d')]['groupName']===_0x4948('0xd1')){_0x69b10d=_0x452e9e[_0x4948('0x2d')][_0x4948('0xd2')];return db[_0x4948('0xa6')]['find']({'where':{'messageId':_0x452e9e['messageId']}});}break;case _0x4948('0xd3'):if(_0x4cc86b[_0x4948('0x5d')]['messageId']&&_0x4cc86b[_0x4948('0x5d')][_0x4948('0x2d')]){_0x69b10d=_0x4cc86b['body']['status'];return db['SmsMessage'][_0x4948('0x5c')]({'where':{'messageId':_0x4cc86b[_0x4948('0x5d')][_0x4948('0x84')]}});}break;case'bandwidth':if(_0x4cc86b[_0x4948('0x5d')][0x0][_0x4948('0x2a')]['id']){_0x69b10d=_0x4cc86b['body'][0x0][_0x4948('0x52')];return db[_0x4948('0xa6')][_0x4948('0x5c')]({'where':{'messageId':_0x4cc86b[_0x4948('0x5d')][0x0][_0x4948('0x2a')]['id']}});}break;case _0x4948('0x93'):if(_0x4cc86b['body'][_0x4948('0xd4')]&&_0x4cc86b['body'][_0x4948('0x2d')]){_0x69b10d=_0x4cc86b[_0x4948('0x5d')][_0x4948('0x2d')];return db['SmsMessage'][_0x4948('0x5c')]({'where':{'messageId':_0x4cc86b[_0x4948('0x5d')][_0x4948('0xd4')]}});}break;}}})[_0x4948('0x21')](handleEntityNotFound(_0x47c3f5,null))['then'](function(_0x2853a8){if(_0x2853a8){_0x5ba5dd=_0x2853a8;switch(_0xc1c042['type']){case _0x4948('0xcb'):if(_0x69b10d===_0x4948('0xd1')){return _0x5ba5dd['update']({'read':!![]});}else{logger[_0x4948('0x28')](_0x4948('0x26'),_0x4948('0x2d'),_0x4948('0xcb'),util['inspect'](_0x4cc86b['body'],{'showHidden':![],'depth':null}));}break;case'connectel':if(_0x69b10d==='1'){return _0x5ba5dd[_0x4948('0x37')]({'read':!![]});}else{logger[_0x4948('0x28')](_0x4948('0x26'),_0x4948('0x2d'),_0x4948('0xcb'),util['inspect'](_0x4cc86b['body'],{'showHidden':![],'depth':null}));}break;case _0x4948('0xcf'):if(!_0x4cc86b[_0x4948('0x5d')][_0x4948('0xd5')]&&_0x69b10d>=0xc8&&_0x69b10d<=0xce){return _0x5ba5dd[_0x4948('0x37')]({'read':!![]});}else{logger[_0x4948('0x28')](_0x4948('0x26'),_0x4948('0x2d'),_0x4948('0xcf'),util[_0x4948('0xd6')](_0x4cc86b[_0x4948('0x5d')],{'showHidden':![],'depth':null}));}break;case _0x4948('0x8d'):var _0x229690=_0x4cc86b[_0x4948('0x5d')][_0x4948('0x8e')][0x0];if(_0x229690[_0x4948('0x2d')][_0x4948('0xd2')]===_0x4948('0xd1')){return _0x5ba5dd[_0x4948('0x37')]({'read':!![]});}else{logger[_0x4948('0x28')](_0x4948('0x26'),_0x4948('0x2d'),_0x4948('0x8d'),util[_0x4948('0xd6')](_0x4cc86b[_0x4948('0x5d')],{'showHidden':![],'depth':null}));}break;case _0x4948('0xd3'):if(_0x69b10d==_0x4948('0xd7')||_0x69b10d=='RECEIVED_BY_RECIPIENT'){return _0x5ba5dd[_0x4948('0x37')]({'read':!![]});}else{logger['error'](_0x4948('0x26'),'status',_0x4948('0xd3'),util[_0x4948('0xd6')](_0x4cc86b[_0x4948('0x5d')],{'showHidden':![],'depth':null}));}break;case'bandwidth':if(_0x69b10d==_0x4948('0xd8')){return _0x5ba5dd[_0x4948('0x37')]({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x4948('0x2d'),_0x4948('0x92'),util[_0x4948('0xd6')](_0x4cc86b[_0x4948('0x5d')],{'showHidden':![],'depth':null}));}break;case _0x4948('0x93'):if(_0x69b10d===_0x4948('0xd9')||_0x69b10d===_0x4948('0xda')){return _0x5ba5dd[_0x4948('0x37')]({'read':!![]});}else{logger[_0x4948('0x28')](_0x4948('0x26'),_0x4948('0x2d'),'intelepeer',util[_0x4948('0xd6')](_0x4cc86b['body'],{'showHidden':![],'depth':null}));}break;}return _0x5ba5dd;}})['then'](respondWithResult(_0x47c3f5,null))['catch'](handleError(_0x47c3f5,null));};exports[_0x4948('0xdb')]=function(_0x2d15d6,_0x308df7,_0x3dd8e3){var _0x4cd486,_0x520f00,_0x1bedca;return db[_0x4948('0x42')][_0x4948('0x5c')]({'where':{'id':_0x2d15d6[_0x4948('0x59')]['id']}})['then'](handleEntityNotFound(_0x308df7,null))[_0x4948('0x21')](function(_0x4bd578){if(_0x4bd578){_0x1bedca=_0x4bd578;logger[_0x4948('0x25')](_0x4948('0x26'),_0x4948('0x2d'),_0x4948('0xca'),_0x4bd578['type'],util['inspect'](_0x2d15d6[_0x4948('0x47')],{'showHidden':![],'depth':null}));switch(_0x4bd578[_0x4948('0x52')]){case'csc':if(_0x2d15d6[_0x4948('0x47')][_0x4948('0xdc')]&&_0x2d15d6['query']['state']){_0x520f00=_0x2d15d6[_0x4948('0x47')]['state'];return db[_0x4948('0xa6')][_0x4948('0x5c')]({'where':{'messageId':_0x2d15d6[_0x4948('0x47')]['message-id']}});}break;}}})[_0x4948('0x21')](handleEntityNotFound(_0x308df7,null))[_0x4948('0x21')](function(_0x3aa595){if(_0x3aa595){_0x4cd486=_0x3aa595;switch(_0x1bedca['type']){case _0x4948('0xdd'):if(_0x520f00==='2'||_0x520f00==='6'){return _0x4cd486[_0x4948('0x37')]({'read':!![]});}else{logger[_0x4948('0x28')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x4948('0x2d'),_0x4948('0xdd'),util[_0x4948('0xd6')](_0x2d15d6[_0x4948('0x47')],{'showHidden':![],'depth':null}));};break;}return _0x4cd486;}})[_0x4948('0x21')](respondWithResult(_0x308df7,null))[_0x4948('0x2c')](handleError(_0x308df7,null));};exports[_0x4948('0xde')]=function(_0x1c2063,_0x525cb6,_0x482f10){return db[_0x4948('0x42')]['find']({'where':{'id':_0x1c2063['params']['id']}})[_0x4948('0x21')](handleEntityNotFound(_0x525cb6,null))['then'](function(_0x2881ca){if(_0x2881ca){return _0x2881ca[_0x4948('0xde')](_0x1c2063[_0x4948('0x5d')][_0x4948('0x6e')],_['omit'](_0x1c2063[_0x4948('0x5d')],['ids','id'])||{})[_0x4948('0x9f')](function(_0x1ea276){for(var _0x2439d3=0x0;_0x2439d3<_0x1c2063[_0x4948('0x5d')][_0x4948('0x6e')][_0x4948('0x4d')];_0x2439d3+=0x1){socket[_0x4948('0xdf')](_0x4948('0xe0'),{'UserId':Number(_0x1c2063[_0x4948('0x5d')][_0x4948('0x6e')][_0x2439d3]),'SmsAccountId':Number(_0x1c2063[_0x4948('0x59')]['id'])});}return _0x1ea276;});}})[_0x4948('0x21')](respondWithResult(_0x525cb6,null))[_0x4948('0x2c')](handleError(_0x525cb6,null));};exports[_0x4948('0xe1')]=function(_0xdc7a99,_0x2fdef0,_0x1a93ce){return db[_0x4948('0x42')][_0x4948('0x5c')]({'where':{'id':_0xdc7a99['params']['id']}})[_0x4948('0x21')](handleEntityNotFound(_0x2fdef0,null))[_0x4948('0x21')](function(_0x199e0f){if(_0x199e0f){return _0x199e0f[_0x4948('0xe1')](_0xdc7a99[_0x4948('0x47')]['ids'])[_0x4948('0x21')](function(){if(_['isArray'](_0xdc7a99[_0x4948('0x47')][_0x4948('0x6e')])){for(var _0x16625f=0x0;_0x16625f<_0xdc7a99['query']['ids'][_0x4948('0x4d')];_0x16625f+=0x1){socket['emit'](_0x4948('0xe2'),{'UserId':Number(_0xdc7a99[_0x4948('0x47')]['ids'][_0x16625f]),'SmsAccountId':Number(_0xdc7a99[_0x4948('0x59')]['id'])});}}else{socket['emit'](_0x4948('0xe2'),{'UserId':Number(_0xdc7a99[_0x4948('0x47')][_0x4948('0x6e')]),'SmsAccountId':Number(_0xdc7a99[_0x4948('0x59')]['id'])});}});}})[_0x4948('0x21')](respondWithStatusCode(_0x2fdef0,null))['catch'](handleError(_0x2fdef0,null));};exports[_0x4948('0xe3')]=function(_0x270bbd,_0x1d2df9,_0x34c910){var _0x7b7f7d={};var _0x40cfe5={};var _0x11f44a;var _0x2710d1;return db[_0x4948('0x42')][_0x4948('0xb5')]({'where':{'id':_0x270bbd[_0x4948('0x59')]['id']}})[_0x4948('0x21')](handleEntityNotFound(_0x1d2df9,null))[_0x4948('0x21')](function(_0x2c9b68){if(_0x2c9b68){_0x11f44a=_0x2c9b68;_0x40cfe5[_0x4948('0x46')]=_[_0x4948('0x48')](db[_0x4948('0xe4')]['rawAttributes']);_0x40cfe5[_0x4948('0x47')]=_['keys'](_0x270bbd[_0x4948('0x47')]);_0x40cfe5[_0x4948('0x49')]=_[_0x4948('0x4a')](_0x40cfe5['model'],_0x40cfe5['query']);_0x7b7f7d['attributes']=_['intersection'](_0x40cfe5[_0x4948('0x46')],qs['fields'](_0x270bbd[_0x4948('0x47')][_0x4948('0x4b')]));_0x7b7f7d[_0x4948('0x4c')]=_0x7b7f7d['attributes'][_0x4948('0x4d')]?_0x7b7f7d['attributes']:_0x40cfe5[_0x4948('0x46')];_0x7b7f7d[_0x4948('0x4e')]=qs['sort'](_0x270bbd['query'][_0x4948('0x4f')]);_0x7b7f7d[_0x4948('0x50')]=qs[_0x4948('0x49')](_[_0x4948('0x51')](_0x270bbd[_0x4948('0x47')],_0x40cfe5[_0x4948('0x49')]));if(_0x270bbd[_0x4948('0x47')]['filter']){_0x7b7f7d[_0x4948('0x50')]=_['merge'](_0x7b7f7d[_0x4948('0x50')],{'$or':_[_0x4948('0x41')](_0x7b7f7d[_0x4948('0x4c')],function(_0x3ed0b6){var _0xe5bf6a={};_0xe5bf6a[_0x3ed0b6]={'$like':'%'+_0x270bbd[_0x4948('0x47')][_0x4948('0x54')]+'%'};return _0xe5bf6a;})});}_0x7b7f7d=_[_0x4948('0x5b')]({},_0x7b7f7d,_0x270bbd[_0x4948('0x69')]);return _0x11f44a[_0x4948('0xe3')](_0x7b7f7d);}})[_0x4948('0x21')](function(_0x40d54e){if(_0x40d54e){_0x2710d1=_0x40d54e[_0x4948('0x4d')];if(!_0x270bbd[_0x4948('0x47')][_0x4948('0x68')](_0x4948('0xba'))){_0x7b7f7d[_0x4948('0x30')]=qs['limit'](_0x270bbd[_0x4948('0x47')][_0x4948('0x30')]);_0x7b7f7d[_0x4948('0x2f')]=qs['offset'](_0x270bbd[_0x4948('0x47')][_0x4948('0x2f')]);}return _0x11f44a[_0x4948('0xe3')](_0x7b7f7d);}})[_0x4948('0x21')](function(_0x4863af){if(_0x4863af){return _0x4863af?{'count':_0x2710d1,'rows':_0x4863af}:null;}})[_0x4948('0x21')](respondWithResult(_0x1d2df9,null))['catch'](handleError(_0x1d2df9,null));}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.events.js b/server/api/smsAccount/smsAccount.events.js index fa2039a..5ef8647 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 _0x0e92=['save','update','remove','emit','hook','../../mysqldb','setMaxListeners'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x0e92,0x194));var _0x20e9=function(_0x31c736,_0x1dd1ac){_0x31c736=_0x31c736-0x0;var _0x3e2e1b=_0x0e92[_0x31c736];return _0x3e2e1b;};'use strict';var EventEmitter=require('events');var SmsAccount=require(_0x20e9('0x0'))['db']['SmsAccount'];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x20e9('0x1')](0x0);var events={'afterCreate':_0x20e9('0x2'),'afterUpdate':_0x20e9('0x3'),'afterDestroy':_0x20e9('0x4')};function emitEvent(_0x49a52f){return function(_0x2c201f,_0x43b518,_0x4c9249){SmsAccountEvents['emit'](_0x49a52f+':'+_0x2c201f['id'],_0x2c201f);SmsAccountEvents[_0x20e9('0x5')](_0x49a52f,_0x2c201f);_0x4c9249(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsAccount[_0x20e9('0x6')](e,emitEvent(event));}}module['exports']=SmsAccountEvents; \ No newline at end of file +var _0x29e9=['../../mysqldb','setMaxListeners','save','update','remove','emit','exports','events'];(function(_0x23fdb9,_0x30002e){var _0x4144bf=function(_0x1deb8d){while(--_0x1deb8d){_0x23fdb9['push'](_0x23fdb9['shift']());}};_0x4144bf(++_0x30002e);}(_0x29e9,0xaf));var _0x929e=function(_0x564ac8,_0x2972f1){_0x564ac8=_0x564ac8-0x0;var _0x11d63e=_0x29e9[_0x564ac8];return _0x11d63e;};'use strict';var EventEmitter=require(_0x929e('0x0'));var SmsAccount=require(_0x929e('0x1'))['db']['SmsAccount'];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x929e('0x2')](0x0);var events={'afterCreate':_0x929e('0x3'),'afterUpdate':_0x929e('0x4'),'afterDestroy':_0x929e('0x5')};function emitEvent(_0x312d29){return function(_0x4d7efa,_0x93431a,_0x2596f0){SmsAccountEvents[_0x929e('0x6')](_0x312d29+':'+_0x4d7efa['id'],_0x4d7efa);SmsAccountEvents[_0x929e('0x6')](_0x312d29,_0x4d7efa);_0x2596f0(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsAccount['hook'](e,emitEvent(event));}}module[_0x929e('0x7')]=SmsAccountEvents; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.model.js b/server/api/smsAccount/smsAccount.model.js index 18fb615..fca7c81 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 _0x213d=['../../config/environment','./smsAccount.attributes','sms_accounts','lodash','util','../../config/logger','request-promise','path','rimraf'];(function(_0x5cc484,_0x32965f){var _0x5305ab=function(_0x173c10){while(--_0x173c10){_0x5cc484['push'](_0x5cc484['shift']());}};_0x5305ab(++_0x32965f);}(_0x213d,0x1bc));var _0xd213=function(_0x4709c0,_0x3396c7){_0x4709c0=_0x4709c0-0x0;var _0x13348b=_0x213d[_0x4709c0];return _0x13348b;};'use strict';var _=require(_0xd213('0x0'));var util=require(_0xd213('0x1'));var logger=require(_0xd213('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xd213('0x3'));var fs=require('fs');var path=require(_0xd213('0x4'));var rimraf=require(_0xd213('0x5'));var config=require(_0xd213('0x6'));var attributes=require(_0xd213('0x7'));module['exports']=function(_0x4ddf28,_0x44e619){return _0x4ddf28['define']('SmsAccount',attributes,{'tableName':_0xd213('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe59f=['exports','define','lodash','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./smsAccount.attributes'];(function(_0x158f75,_0x486108){var _0x201e02=function(_0x3a67da){while(--_0x3a67da){_0x158f75['push'](_0x158f75['shift']());}};_0x201e02(++_0x486108);}(_0xe59f,0x1a4));var _0xfe59=function(_0x747395,_0x5d4b37){_0x747395=_0x747395-0x0;var _0x2b5206=_0xe59f[_0x747395];return _0x2b5206;};'use strict';var _=require(_0xfe59('0x0'));var util=require(_0xfe59('0x1'));var logger=require(_0xfe59('0x2'))(_0xfe59('0x3'));var moment=require('moment');var BPromise=require(_0xfe59('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xfe59('0x5'));var rimraf=require(_0xfe59('0x6'));var config=require(_0xfe59('0x7'));var attributes=require(_0xfe59('0x8'));module[_0xfe59('0x9')]=function(_0x46f691,_0x40a438){return _0x46f691[_0xfe59('0xa')]('SmsAccount',attributes,{'tableName':'sms_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.rpc.js b/server/api/smsAccount/smsAccount.rpc.js index b1c36c2..01ede5c 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 _0x6589=['SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','ShowSmsAccount','find','options','raw','where','attributes','include','map','model','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','redis','defaults','socket.io-emitter','register','request','then','info'];(function(_0x1560bb,_0x1ee6ac){var _0x31ca87=function(_0x5aee4c){while(--_0x5aee4c){_0x1560bb['push'](_0x1560bb['shift']());}};_0x31ca87(++_0x1ee6ac);}(_0x6589,0xbc));var _0x9658=function(_0x2ba740,_0x62a305){_0x2ba740=_0x2ba740-0x0;var _0x358bda=_0x6589[_0x2ba740];return _0x358bda;};'use strict';var _=require('lodash');var util=require(_0x9658('0x0'));var moment=require('moment');var BPromise=require(_0x9658('0x1'));var rs=require(_0x9658('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9658('0x3'))['db'];var utils=require(_0x9658('0x4'));var logger=require(_0x9658('0x5'))('rpc');var config=require(_0x9658('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x9658('0x7')][_0x9658('0x8')]({'port':0x232a});config[_0x9658('0x9')]=_[_0x9658('0xa')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x9658('0xb'))(new Redis(config[_0x9658('0x9')]));require('./smsAccount.socket')[_0x9658('0xc')](socket);function respondWithRpcPromise(_0x44553b,_0xc62423,_0x317727){return new BPromise(function(_0x52e9d9,_0x1eff9e){return client[_0x9658('0xd')](_0x44553b,_0x317727)[_0x9658('0xe')](function(_0x3eacf3){logger[_0x9658('0xf')](_0x9658('0x10'),_0xc62423,_0x9658('0x11'));logger[_0x9658('0x12')](_0x9658('0x13'),_0xc62423,_0x9658('0x11'),JSON[_0x9658('0x14')](_0x3eacf3));if(_0x3eacf3['error']){if(_0x3eacf3['error']['code']===0x1f4){logger[_0x9658('0x15')](_0x9658('0x10'),_0xc62423,_0x3eacf3[_0x9658('0x15')]['message']);return _0x1eff9e(_0x3eacf3[_0x9658('0x15')]['message']);}logger[_0x9658('0x15')](_0x9658('0x10'),_0xc62423,_0x3eacf3[_0x9658('0x15')][_0x9658('0x16')]);return _0x52e9d9(_0x3eacf3[_0x9658('0x15')]['message']);}else{logger[_0x9658('0xf')](_0x9658('0x10'),_0xc62423,_0x9658('0x11'));_0x52e9d9(_0x3eacf3[_0x9658('0x17')]['message']);}})[_0x9658('0x18')](function(_0x1df080){logger['error']('SmsAccount,\x20%s,\x20%s',_0xc62423,_0x1df080);_0x1eff9e(_0x1df080);});});}exports[_0x9658('0x19')]=function(_0x56561a){var _0x3b88fc=this;return new Promise(function(_0x98ec3a,_0x33afdf){return db['SmsAccount'][_0x9658('0x1a')]({'raw':_0x56561a['options']?_0x56561a[_0x9658('0x1b')][_0x9658('0x1c')]===undefined?!![]:![]:!![],'where':_0x56561a[_0x9658('0x1b')]?_0x56561a['options'][_0x9658('0x1d')]||null:null,'attributes':_0x56561a[_0x9658('0x1b')]?_0x56561a['options'][_0x9658('0x1e')]||null:null,'include':_0x56561a[_0x9658('0x1b')]?_0x56561a[_0x9658('0x1b')][_0x9658('0x1f')]?_[_0x9658('0x20')](_0x56561a[_0x9658('0x1b')][_0x9658('0x1f')],function(_0x44ee16){return{'model':db[_0x44ee16[_0x9658('0x21')]],'as':_0x44ee16['as'],'attributes':_0x44ee16['attributes'],'include':_0x44ee16[_0x9658('0x1f')]?_[_0x9658('0x20')](_0x44ee16[_0x9658('0x1f')],function(_0x5c6e4b){return{'model':db[_0x5c6e4b['model']],'as':_0x5c6e4b['as'],'attributes':_0x5c6e4b[_0x9658('0x1e')],'include':_0x5c6e4b[_0x9658('0x1f')]?_[_0x9658('0x20')](_0x5c6e4b[_0x9658('0x1f')],function(_0xe2353d){return{'model':db[_0xe2353d[_0x9658('0x21')]],'as':_0xe2353d['as'],'attributes':_0xe2353d['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x440371){logger['info'](_0x9658('0x19'),_0x56561a);logger[_0x9658('0x12')](_0x9658('0x19'),_0x56561a,JSON[_0x9658('0x14')](_0x440371));_0x98ec3a(_0x440371);})[_0x9658('0x18')](function(_0xa3b613){logger[_0x9658('0x15')]('ShowSmsAccount',_0xa3b613[_0x9658('0x16')],_0x56561a);_0x33afdf(_0x3b88fc[_0x9658('0x15')](0x1f4,_0xa3b613['message']));});});}; \ No newline at end of file +var _0xa472=['redis','localhost','socket.io-emitter','./smsAccount.socket','request','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','SmsAccount','find','options','raw','where','attributes','include','map','model','ShowSmsAccount','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults'];(function(_0x542837,_0x1db83e){var _0x4503fb=function(_0x5bf73d){while(--_0x5bf73d){_0x542837['push'](_0x542837['shift']());}};_0x4503fb(++_0x1db83e);}(_0xa472,0x6a));var _0x2a47=function(_0x581a89,_0x8f087c){_0x581a89=_0x581a89-0x0;var _0xf5ee99=_0xa472[_0x581a89];return _0xf5ee99;};'use strict';var _=require(_0x2a47('0x0'));var util=require('util');var moment=require(_0x2a47('0x1'));var BPromise=require(_0x2a47('0x2'));var rs=require(_0x2a47('0x3'));var fs=require('fs');var Redis=require(_0x2a47('0x4'));var db=require(_0x2a47('0x5'))['db'];var utils=require(_0x2a47('0x6'));var logger=require(_0x2a47('0x7'))(_0x2a47('0x8'));var config=require(_0x2a47('0x9'));var jayson=require(_0x2a47('0xa'));var client=jayson[_0x2a47('0xb')][_0x2a47('0xc')]({'port':0x232a});config['redis']=_[_0x2a47('0xd')](config[_0x2a47('0xe')],{'host':_0x2a47('0xf'),'port':0x18eb});var socket=require(_0x2a47('0x10'))(new Redis(config[_0x2a47('0xe')]));require(_0x2a47('0x11'))['register'](socket);function respondWithRpcPromise(_0x3e33bd,_0x49367f,_0x58a27d){return new BPromise(function(_0x335b07,_0x4d7630){return client[_0x2a47('0x12')](_0x3e33bd,_0x58a27d)[_0x2a47('0x13')](function(_0x34c67f){logger[_0x2a47('0x14')](_0x2a47('0x15'),_0x49367f,_0x2a47('0x16'));logger[_0x2a47('0x17')](_0x2a47('0x18'),_0x49367f,_0x2a47('0x16'),JSON[_0x2a47('0x19')](_0x34c67f));if(_0x34c67f['error']){if(_0x34c67f[_0x2a47('0x1a')][_0x2a47('0x1b')]===0x1f4){logger['error']('SmsAccount,\x20%s,\x20%s',_0x49367f,_0x34c67f[_0x2a47('0x1a')]['message']);return _0x4d7630(_0x34c67f[_0x2a47('0x1a')][_0x2a47('0x1c')]);}logger[_0x2a47('0x1a')](_0x2a47('0x15'),_0x49367f,_0x34c67f['error'][_0x2a47('0x1c')]);return _0x335b07(_0x34c67f['error'][_0x2a47('0x1c')]);}else{logger[_0x2a47('0x14')](_0x2a47('0x15'),_0x49367f,_0x2a47('0x16'));_0x335b07(_0x34c67f['result']['message']);}})['catch'](function(_0x41c793){logger[_0x2a47('0x1a')](_0x2a47('0x15'),_0x49367f,_0x41c793);_0x4d7630(_0x41c793);});});}exports['ShowSmsAccount']=function(_0x4a494a){var _0x13b586=this;return new Promise(function(_0x1a64e6,_0x17a970){return db[_0x2a47('0x1d')][_0x2a47('0x1e')]({'raw':_0x4a494a[_0x2a47('0x1f')]?_0x4a494a[_0x2a47('0x1f')][_0x2a47('0x20')]===undefined?!![]:![]:!![],'where':_0x4a494a[_0x2a47('0x1f')]?_0x4a494a[_0x2a47('0x1f')][_0x2a47('0x21')]||null:null,'attributes':_0x4a494a[_0x2a47('0x1f')]?_0x4a494a[_0x2a47('0x1f')][_0x2a47('0x22')]||null:null,'include':_0x4a494a['options']?_0x4a494a[_0x2a47('0x1f')][_0x2a47('0x23')]?_['map'](_0x4a494a[_0x2a47('0x1f')][_0x2a47('0x23')],function(_0x3850ce){return{'model':db[_0x3850ce['model']],'as':_0x3850ce['as'],'attributes':_0x3850ce[_0x2a47('0x22')],'include':_0x3850ce[_0x2a47('0x23')]?_[_0x2a47('0x24')](_0x3850ce[_0x2a47('0x23')],function(_0x1d4058){return{'model':db[_0x1d4058[_0x2a47('0x25')]],'as':_0x1d4058['as'],'attributes':_0x1d4058[_0x2a47('0x22')],'include':_0x1d4058[_0x2a47('0x23')]?_[_0x2a47('0x24')](_0x1d4058[_0x2a47('0x23')],function(_0xcb4a74){return{'model':db[_0xcb4a74[_0x2a47('0x25')]],'as':_0xcb4a74['as'],'attributes':_0xcb4a74[_0x2a47('0x22')]};}):[]};}):[]};}):[]:[]})[_0x2a47('0x13')](function(_0x10d5cb){logger[_0x2a47('0x14')](_0x2a47('0x26'),_0x4a494a);logger[_0x2a47('0x17')](_0x2a47('0x26'),_0x4a494a,JSON[_0x2a47('0x19')](_0x10d5cb));_0x1a64e6(_0x10d5cb);})[_0x2a47('0x27')](function(_0x450811){logger['error'](_0x2a47('0x26'),_0x450811[_0x2a47('0x1c')],_0x4a494a);_0x17a970(_0x13b586[_0x2a47('0x1a')](0x1f4,_0x450811[_0x2a47('0x1c')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index 082bdea..626140b 100644 --- a/server/api/smsAccount/smsAccount.socket.js +++ b/server/api/smsAccount/smsAccount.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['register','length','smsAccount:','./smsAccount.events','save','remove','emit','removeListener'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1ddedd,_0x485606){_0x1ddedd=_0x1ddedd-0x0;var _0xa3e1ac=_0xa9e0[_0x1ddedd];return _0xa3e1ac;};'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(_0x38a7ac,_0x45514b){_0x38a7ac=_0x38a7ac-0x0;var _0x53061a=_0xa9e0[_0x38a7ac];return _0x53061a;};'use strict';var SmsAccountEvents=require(_0x0a9e('0x0'));var events=[_0x0a9e('0x1'),_0x0a9e('0x2'),'update'];function createListener(_0x550fbc,_0x18d5c9){return function(_0x4ce2f1){_0x18d5c9[_0x0a9e('0x3')](_0x550fbc,_0x4ce2f1);};}function removeListener(_0x432180,_0x2ab90b){return function(){SmsAccountEvents[_0x0a9e('0x4')](_0x432180,_0x2ab90b);};}exports[_0x0a9e('0x5')]=function(_0x57b080){for(var _0x219af0=0x0,_0x441e3a=events[_0x0a9e('0x6')];_0x219af0<_0x441e3a;_0x219af0++){var _0x5f41ea=events[_0x219af0];var _0x503809=createListener(_0x0a9e('0x7')+_0x5f41ea,_0x57b080);SmsAccountEvents['on'](_0x5f41ea,_0x503809);}}; \ No newline at end of file diff --git a/server/api/smsApplication/index.js b/server/api/smsApplication/index.js index 06ed048..106b4b6 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(_0x465b4b,_0x3dacbd){var _0xd4a11e=function(_0x3a9b0b){while(--_0x3a9b0b){_0x465b4b['push'](_0x465b4b['shift']());}};_0xd4a11e(++_0x3dacbd);}(_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 _0xedd9=['post','create','update','delete','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./smsApplication.controller','get','isAuthenticated','index','/:id','show'];(function(_0x5a7607,_0xc2687b){var _0x195ad1=function(_0x57dcf5){while(--_0x57dcf5){_0x5a7607['push'](_0x5a7607['shift']());}};_0x195ad1(++_0xc2687b);}(_0xedd9,0xfc));var _0x9edd=function(_0x20729b,_0xc75321){_0x20729b=_0x20729b-0x0;var _0x5ea823=_0xedd9[_0x20729b];return _0x5ea823;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');var controller=require(_0x9edd('0x8'));router[_0x9edd('0x9')]('/',auth[_0x9edd('0xa')](),controller[_0x9edd('0xb')]);router['get'](_0x9edd('0xc'),auth['isAuthenticated'](),controller[_0x9edd('0xd')]);router[_0x9edd('0xe')]('/',auth[_0x9edd('0xa')](),controller[_0x9edd('0xf')]);router['put'](_0x9edd('0xc'),auth['isAuthenticated'](),controller[_0x9edd('0x10')]);router[_0x9edd('0x11')]('/:id',auth[_0x9edd('0xa')](),controller[_0x9edd('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.attributes.js b/server/api/smsApplication/smsApplication.attributes.js index f54b678..eeba5cb 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 _0xe884=['TEXT','*,*,*,*','exports','INTEGER','STRING'];(function(_0xe9d288,_0x255786){var _0xc3caa4=function(_0x5163e9){while(--_0x5163e9){_0xe9d288['push'](_0xe9d288['shift']());}};_0xc3caa4(++_0x255786);}(_0xe884,0x11f));var _0x4e88=function(_0xecbdd,_0x45874a){_0xecbdd=_0xecbdd-0x0;var _0x37d399=_0xe884[_0xecbdd];return _0x37d399;};'use strict';var Sequelize=require('sequelize');module[_0x4e88('0x0')]={'priority':{'type':Sequelize[_0x4e88('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x4e88('0x2')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x4e88('0x3')]()},'description':{'type':Sequelize[_0x4e88('0x2')]},'interval':{'type':Sequelize[_0x4e88('0x2')],'defaultValue':_0x4e88('0x4')}}; \ No newline at end of file +var _0x3f92=['STRING','noop','TEXT','exports','INTEGER'];(function(_0x2cc0b3,_0x120bf1){var _0x1667ef=function(_0x3abcb4){while(--_0x3abcb4){_0x2cc0b3['push'](_0x2cc0b3['shift']());}};_0x1667ef(++_0x120bf1);}(_0x3f92,0x1bb));var _0x23f9=function(_0x100c9c,_0x2183f3){_0x100c9c=_0x100c9c-0x0;var _0x566727=_0x3f92[_0x100c9c];return _0x566727;};'use strict';var Sequelize=require('sequelize');module[_0x23f9('0x0')]={'priority':{'type':Sequelize[_0x23f9('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x23f9('0x2')],'allowNull':![],'defaultValue':_0x23f9('0x3')},'appdata':{'type':Sequelize[_0x23f9('0x4')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x23f9('0x2')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index 4bbe90e..3bafea8 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 _0xbd58=['json','apply','reject','update','then','destroy','error','name','send','index','SmsApplication','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','keys','length','includeAll','find','create','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','sendStatus','status','end','offset','limit','undefined','count','Content-Range'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbd58,0x74));var _0x8bd5=function(_0x55e5b9,_0x1be20e){_0x55e5b9=_0x55e5b9-0x0;var _0x58d1e7=_0xbd58[_0x55e5b9];return _0x58d1e7;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8bd5('0x0'));var zipdir=require(_0x8bd5('0x1'));var jsonpatch=require(_0x8bd5('0x2'));var rp=require(_0x8bd5('0x3'));var moment=require(_0x8bd5('0x4'));var BPromise=require(_0x8bd5('0x5'));var Mustache=require(_0x8bd5('0x6'));var util=require(_0x8bd5('0x7'));var path=require(_0x8bd5('0x8'));var sox=require('sox');var csv=require(_0x8bd5('0x9'));var ejs=require(_0x8bd5('0xa'));var fs=require('fs');var fs_extra=require(_0x8bd5('0xb'));var _=require(_0x8bd5('0xc'));var squel=require('squel');var crypto=require(_0x8bd5('0xd'));var jsforce=require(_0x8bd5('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x8bd5('0x9'));var querystring=require(_0x8bd5('0xf'));var Papa=require(_0x8bd5('0x10'));var Redis=require(_0x8bd5('0x11'));var authService=require(_0x8bd5('0x12'));var qs=require(_0x8bd5('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8bd5('0x14'));var logger=require(_0x8bd5('0x15'))('api');var utils=require('../../config/utils');var config=require(_0x8bd5('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x8bd5('0x17'))['db'];function respondWithStatusCode(_0x5f43c3,_0x5e7b2b){_0x5e7b2b=_0x5e7b2b||0xcc;return function(_0x2e32cb){if(_0x2e32cb){return _0x5f43c3[_0x8bd5('0x18')](_0x5e7b2b);}return _0x5f43c3[_0x8bd5('0x19')](_0x5e7b2b)[_0x8bd5('0x1a')]();};}function respondWithResult(_0x1be8c6,_0x1036b4){_0x1036b4=_0x1036b4||0xc8;return function(_0x43a4cf){if(_0x43a4cf){return _0x1be8c6[_0x8bd5('0x19')](_0x1036b4)['json'](_0x43a4cf);}};}function respondWithFilteredResult(_0x4c57d1,_0x51ddd6){return function(_0x1b35dd){if(_0x1b35dd){var _0x26e537=typeof _0x51ddd6[_0x8bd5('0x1b')]==='undefined'&&typeof _0x51ddd6[_0x8bd5('0x1c')]===_0x8bd5('0x1d');var _0x2925d8=_0x1b35dd['count'];var _0x152c7f=_0x26e537?0x0:_0x51ddd6[_0x8bd5('0x1b')];var _0x322fb4=_0x26e537?_0x1b35dd[_0x8bd5('0x1e')]:_0x51ddd6[_0x8bd5('0x1b')]+_0x51ddd6['limit'];var _0x5e9081;if(_0x322fb4>=_0x2925d8){_0x322fb4=_0x2925d8;_0x5e9081=0xc8;}else{_0x5e9081=0xce;}_0x4c57d1[_0x8bd5('0x19')](_0x5e9081);return _0x4c57d1['set'](_0x8bd5('0x1f'),_0x152c7f+'-'+_0x322fb4+'/'+_0x2925d8)[_0x8bd5('0x20')](_0x1b35dd);}return null;};}function patchUpdates(_0x3b53e7){return function(_0x2fb176){try{jsonpatch[_0x8bd5('0x21')](_0x2fb176,_0x3b53e7,!![]);}catch(_0x52eb96){return BPromise[_0x8bd5('0x22')](_0x52eb96);}return _0x2fb176['save']();};}function saveUpdates(_0x50736b,_0x2c99c2){return function(_0x2cca44){if(_0x2cca44){return _0x2cca44[_0x8bd5('0x23')](_0x50736b)[_0x8bd5('0x24')](function(_0x188597){return _0x188597;});}return null;};}function removeEntity(_0x3f435b,_0x4f1c56){return function(_0x146792){if(_0x146792){return _0x146792[_0x8bd5('0x25')]()[_0x8bd5('0x24')](function(){_0x3f435b[_0x8bd5('0x19')](0xcc)[_0x8bd5('0x1a')]();});}};}function handleEntityNotFound(_0x5683b5,_0xbed2ec){return function(_0x3920c4){if(!_0x3920c4){_0x5683b5[_0x8bd5('0x18')](0x194);}return _0x3920c4;};}function handleError(_0x3e2dd4,_0x2c9732){_0x2c9732=_0x2c9732||0x1f4;return function(_0x886257){logger[_0x8bd5('0x26')](_0x886257['stack']);if(_0x886257['name']){delete _0x886257[_0x8bd5('0x27')];}_0x3e2dd4[_0x8bd5('0x19')](_0x2c9732)[_0x8bd5('0x28')](_0x886257);};}exports[_0x8bd5('0x29')]=function(_0x4ba9bc,_0x4479c3){var _0x5088fd={},_0x4d79ca={},_0x73431b={'count':0x0,'rows':[]};var _0x30252d=_['map'](db[_0x8bd5('0x2a')][_0x8bd5('0x2b')],function(_0x25bea8){return{'name':_0x25bea8[_0x8bd5('0x2c')],'type':_0x25bea8[_0x8bd5('0x2d')][_0x8bd5('0x2e')]};});_0x4d79ca[_0x8bd5('0x2f')]=_[_0x8bd5('0x30')](_0x30252d,_0x8bd5('0x27'));_0x4d79ca[_0x8bd5('0x31')]=_['keys'](_0x4ba9bc['query']);_0x4d79ca[_0x8bd5('0x32')]=_[_0x8bd5('0x33')](_0x4d79ca['model'],_0x4d79ca[_0x8bd5('0x31')]);_0x5088fd[_0x8bd5('0x34')]=_[_0x8bd5('0x33')](_0x4d79ca[_0x8bd5('0x2f')],qs[_0x8bd5('0x35')](_0x4ba9bc['query'][_0x8bd5('0x35')]));_0x5088fd[_0x8bd5('0x34')]=_0x5088fd['attributes']['length']?_0x5088fd['attributes']:_0x4d79ca[_0x8bd5('0x2f')];if(!_0x4ba9bc[_0x8bd5('0x31')][_0x8bd5('0x36')]('nolimit')){_0x5088fd[_0x8bd5('0x1c')]=qs[_0x8bd5('0x1c')](_0x4ba9bc[_0x8bd5('0x31')][_0x8bd5('0x1c')]);_0x5088fd[_0x8bd5('0x1b')]=qs[_0x8bd5('0x1b')](_0x4ba9bc['query'][_0x8bd5('0x1b')]);}_0x5088fd[_0x8bd5('0x37')]=qs['sort'](_0x4ba9bc[_0x8bd5('0x31')][_0x8bd5('0x38')]);_0x5088fd[_0x8bd5('0x39')]=qs['filters'](_['pick'](_0x4ba9bc['query'],_0x4d79ca[_0x8bd5('0x32')]),_0x30252d);if(_0x4ba9bc['query'][_0x8bd5('0x3a')]){_0x5088fd[_0x8bd5('0x39')]=_[_0x8bd5('0x3b')](_0x5088fd[_0x8bd5('0x39')],{'$or':_[_0x8bd5('0x30')](_0x30252d,function(_0x3d728d){if(_0x3d728d['type']!==_0x8bd5('0x3c')){var _0x4a4745={};_0x4a4745[_0x3d728d['name']]={'$like':'%'+_0x4ba9bc[_0x8bd5('0x31')][_0x8bd5('0x3a')]+'%'};return _0x4a4745;}})});}_0x5088fd=_[_0x8bd5('0x3b')]({},_0x5088fd,_0x4ba9bc[_0x8bd5('0x3d')]);var _0x58407d={'where':_0x5088fd[_0x8bd5('0x39')]};return db[_0x8bd5('0x2a')][_0x8bd5('0x1e')](_0x58407d)[_0x8bd5('0x24')](function(_0x1ac24f){_0x73431b[_0x8bd5('0x1e')]=_0x1ac24f;if(_0x4ba9bc[_0x8bd5('0x31')]['includeAll']){_0x5088fd[_0x8bd5('0x3e')]=[{'all':!![]}];}return db[_0x8bd5('0x2a')][_0x8bd5('0x3f')](_0x5088fd);})['then'](function(_0x4ffe63){_0x73431b[_0x8bd5('0x40')]=_0x4ffe63;return _0x73431b;})[_0x8bd5('0x24')](respondWithFilteredResult(_0x4479c3,_0x5088fd))[_0x8bd5('0x41')](handleError(_0x4479c3,null));};exports[_0x8bd5('0x42')]=function(_0x319b93,_0x3591fa){var _0x41fa94={'raw':!![],'where':{'id':_0x319b93[_0x8bd5('0x43')]['id']}},_0x46a7b2={};_0x46a7b2[_0x8bd5('0x2f')]=_[_0x8bd5('0x44')](db['SmsApplication'][_0x8bd5('0x2b')]);_0x46a7b2[_0x8bd5('0x31')]=_[_0x8bd5('0x44')](_0x319b93[_0x8bd5('0x31')]);_0x46a7b2[_0x8bd5('0x32')]=_['intersection'](_0x46a7b2['model'],_0x46a7b2[_0x8bd5('0x31')]);_0x41fa94[_0x8bd5('0x34')]=_['intersection'](_0x46a7b2[_0x8bd5('0x2f')],qs['fields'](_0x319b93[_0x8bd5('0x31')][_0x8bd5('0x35')]));_0x41fa94[_0x8bd5('0x34')]=_0x41fa94[_0x8bd5('0x34')][_0x8bd5('0x45')]?_0x41fa94[_0x8bd5('0x34')]:_0x46a7b2[_0x8bd5('0x2f')];if(_0x319b93[_0x8bd5('0x31')][_0x8bd5('0x46')]){_0x41fa94[_0x8bd5('0x3e')]=[{'all':!![]}];}_0x41fa94=_['merge']({},_0x41fa94,_0x319b93[_0x8bd5('0x3d')]);return db['SmsApplication'][_0x8bd5('0x47')](_0x41fa94)[_0x8bd5('0x24')](handleEntityNotFound(_0x3591fa,null))[_0x8bd5('0x24')](respondWithResult(_0x3591fa,null))[_0x8bd5('0x41')](handleError(_0x3591fa,null));};exports['create']=function(_0x1c961f,_0x1e8b74){return db[_0x8bd5('0x2a')][_0x8bd5('0x48')](_0x1c961f[_0x8bd5('0x49')],{})[_0x8bd5('0x24')](respondWithResult(_0x1e8b74,0xc9))['catch'](handleError(_0x1e8b74,null));};exports[_0x8bd5('0x23')]=function(_0x48a764,_0x30ea81){if(_0x48a764[_0x8bd5('0x49')]['id']){delete _0x48a764[_0x8bd5('0x49')]['id'];}return db[_0x8bd5('0x2a')][_0x8bd5('0x47')]({'where':{'id':_0x48a764[_0x8bd5('0x43')]['id']}})[_0x8bd5('0x24')](handleEntityNotFound(_0x30ea81,null))['then'](saveUpdates(_0x48a764[_0x8bd5('0x49')],null))[_0x8bd5('0x24')](respondWithResult(_0x30ea81,null))[_0x8bd5('0x41')](handleError(_0x30ea81,null));};exports['destroy']=function(_0x278aa1,_0x12e793){return db[_0x8bd5('0x2a')][_0x8bd5('0x47')]({'where':{'id':_0x278aa1[_0x8bd5('0x43')]['id']}})[_0x8bd5('0x24')](handleEntityNotFound(_0x12e793,null))['then'](removeEntity(_0x12e793,null))[_0x8bd5('0x41')](handleError(_0x12e793,null));}; \ No newline at end of file +var _0x5096=['../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','save','update','then','destroy','stack','name','index','SmsApplication','rawAttributes','fieldName','type','map','query','keys','filters','intersection','attributes','model','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','include','rows','show','fields','includeAll','find','catch','create','body','params','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api'];(function(_0x4cb05a,_0x598bc8){var _0x196217=function(_0x13d609){while(--_0x13d609){_0x4cb05a['push'](_0x4cb05a['shift']());}};_0x196217(++_0x598bc8);}(_0x5096,0x1e6));var _0x6509=function(_0x441eab,_0x583ba5){_0x441eab=_0x441eab-0x0;var _0xe6ff41=_0x5096[_0x441eab];return _0xe6ff41;};'use strict';var emlformat=require(_0x6509('0x0'));var rimraf=require(_0x6509('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6509('0x2'));var rp=require(_0x6509('0x3'));var moment=require(_0x6509('0x4'));var BPromise=require(_0x6509('0x5'));var Mustache=require(_0x6509('0x6'));var util=require(_0x6509('0x7'));var path=require(_0x6509('0x8'));var sox=require(_0x6509('0x9'));var csv=require(_0x6509('0xa'));var ejs=require(_0x6509('0xb'));var fs=require('fs');var fs_extra=require(_0x6509('0xc'));var _=require(_0x6509('0xd'));var squel=require(_0x6509('0xe'));var crypto=require(_0x6509('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x6509('0x10'));var toCsv=require('to-csv');var querystring=require(_0x6509('0x11'));var Papa=require(_0x6509('0x12'));var Redis=require(_0x6509('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x6509('0x14'));var as=require(_0x6509('0x15'));var hardwareService=require(_0x6509('0x16'));var logger=require(_0x6509('0x17'))(_0x6509('0x18'));var utils=require(_0x6509('0x19'));var config=require(_0x6509('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0x6509('0x1b'))['db'];function respondWithStatusCode(_0x5642e3,_0xf9b61f){_0xf9b61f=_0xf9b61f||0xcc;return function(_0x4c36d7){if(_0x4c36d7){return _0x5642e3[_0x6509('0x1c')](_0xf9b61f);}return _0x5642e3[_0x6509('0x1d')](_0xf9b61f)['end']();};}function respondWithResult(_0x549974,_0x4f6030){_0x4f6030=_0x4f6030||0xc8;return function(_0x989d63){if(_0x989d63){return _0x549974['status'](_0x4f6030)[_0x6509('0x1e')](_0x989d63);}};}function respondWithFilteredResult(_0x456d92,_0x17db58){return function(_0x4e7a6a){if(_0x4e7a6a){var _0x3367a9=typeof _0x17db58['offset']===_0x6509('0x1f')&&typeof _0x17db58[_0x6509('0x20')]===_0x6509('0x1f');var _0x125288=_0x4e7a6a[_0x6509('0x21')];var _0x5cba54=_0x3367a9?0x0:_0x17db58[_0x6509('0x22')];var _0x13d185=_0x3367a9?_0x4e7a6a[_0x6509('0x21')]:_0x17db58[_0x6509('0x22')]+_0x17db58[_0x6509('0x20')];var _0x406936;if(_0x13d185>=_0x125288){_0x13d185=_0x125288;_0x406936=0xc8;}else{_0x406936=0xce;}_0x456d92[_0x6509('0x1d')](_0x406936);return _0x456d92['set']('Content-Range',_0x5cba54+'-'+_0x13d185+'/'+_0x125288)[_0x6509('0x1e')](_0x4e7a6a);}return null;};}function patchUpdates(_0x47f812){return function(_0x2a9863){try{jsonpatch['apply'](_0x2a9863,_0x47f812,!![]);}catch(_0x83e0){return BPromise['reject'](_0x83e0);}return _0x2a9863[_0x6509('0x23')]();};}function saveUpdates(_0x2a6eb1,_0x487e8a){return function(_0xe6c9c5){if(_0xe6c9c5){return _0xe6c9c5[_0x6509('0x24')](_0x2a6eb1)[_0x6509('0x25')](function(_0x572593){return _0x572593;});}return null;};}function removeEntity(_0xa232ac,_0x282a89){return function(_0x5473e5){if(_0x5473e5){return _0x5473e5[_0x6509('0x26')]()[_0x6509('0x25')](function(){_0xa232ac['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2eb767,_0x35ce42){return function(_0x671a72){if(!_0x671a72){_0x2eb767[_0x6509('0x1c')](0x194);}return _0x671a72;};}function handleError(_0x39ebcf,_0x52bd22){_0x52bd22=_0x52bd22||0x1f4;return function(_0x14787e){logger['error'](_0x14787e[_0x6509('0x27')]);if(_0x14787e[_0x6509('0x28')]){delete _0x14787e['name'];}_0x39ebcf['status'](_0x52bd22)['send'](_0x14787e);};}exports[_0x6509('0x29')]=function(_0x1a0ccc,_0x86e042){var _0x355834={},_0x3ec47b={},_0x568f31={'count':0x0,'rows':[]};var _0x3bbf5a=_['map'](db[_0x6509('0x2a')][_0x6509('0x2b')],function(_0x36ee7a){return{'name':_0x36ee7a[_0x6509('0x2c')],'type':_0x36ee7a[_0x6509('0x2d')]['key']};});_0x3ec47b['model']=_[_0x6509('0x2e')](_0x3bbf5a,_0x6509('0x28'));_0x3ec47b[_0x6509('0x2f')]=_[_0x6509('0x30')](_0x1a0ccc[_0x6509('0x2f')]);_0x3ec47b[_0x6509('0x31')]=_[_0x6509('0x32')](_0x3ec47b['model'],_0x3ec47b['query']);_0x355834[_0x6509('0x33')]=_[_0x6509('0x32')](_0x3ec47b[_0x6509('0x34')],qs['fields'](_0x1a0ccc[_0x6509('0x2f')]['fields']));_0x355834[_0x6509('0x33')]=_0x355834['attributes'][_0x6509('0x35')]?_0x355834[_0x6509('0x33')]:_0x3ec47b['model'];if(!_0x1a0ccc['query'][_0x6509('0x36')](_0x6509('0x37'))){_0x355834['limit']=qs[_0x6509('0x20')](_0x1a0ccc[_0x6509('0x2f')][_0x6509('0x20')]);_0x355834[_0x6509('0x22')]=qs[_0x6509('0x22')](_0x1a0ccc[_0x6509('0x2f')]['offset']);}_0x355834['order']=qs[_0x6509('0x38')](_0x1a0ccc['query'][_0x6509('0x38')]);_0x355834[_0x6509('0x39')]=qs[_0x6509('0x31')](_[_0x6509('0x3a')](_0x1a0ccc[_0x6509('0x2f')],_0x3ec47b[_0x6509('0x31')]),_0x3bbf5a);if(_0x1a0ccc[_0x6509('0x2f')][_0x6509('0x3b')]){_0x355834[_0x6509('0x39')]=_[_0x6509('0x3c')](_0x355834['where'],{'$or':_[_0x6509('0x2e')](_0x3bbf5a,function(_0x360f6f){if(_0x360f6f[_0x6509('0x2d')]!==_0x6509('0x3d')){var _0x9cb89={};_0x9cb89[_0x360f6f[_0x6509('0x28')]]={'$like':'%'+_0x1a0ccc['query']['filter']+'%'};return _0x9cb89;}})});}_0x355834=_['merge']({},_0x355834,_0x1a0ccc[_0x6509('0x3e')]);var _0x566886={'where':_0x355834['where']};return db[_0x6509('0x2a')][_0x6509('0x21')](_0x566886)[_0x6509('0x25')](function(_0x16b3b2){_0x568f31[_0x6509('0x21')]=_0x16b3b2;if(_0x1a0ccc[_0x6509('0x2f')]['includeAll']){_0x355834[_0x6509('0x3f')]=[{'all':!![]}];}return db['SmsApplication']['findAll'](_0x355834);})[_0x6509('0x25')](function(_0x38f4b3){_0x568f31[_0x6509('0x40')]=_0x38f4b3;return _0x568f31;})['then'](respondWithFilteredResult(_0x86e042,_0x355834))['catch'](handleError(_0x86e042,null));};exports[_0x6509('0x41')]=function(_0x448670,_0x35bcd9){var _0x3a9ecc={'raw':!![],'where':{'id':_0x448670['params']['id']}},_0x56e0b9={};_0x56e0b9['model']=_['keys'](db[_0x6509('0x2a')][_0x6509('0x2b')]);_0x56e0b9[_0x6509('0x2f')]=_[_0x6509('0x30')](_0x448670[_0x6509('0x2f')]);_0x56e0b9['filters']=_[_0x6509('0x32')](_0x56e0b9[_0x6509('0x34')],_0x56e0b9[_0x6509('0x2f')]);_0x3a9ecc[_0x6509('0x33')]=_[_0x6509('0x32')](_0x56e0b9[_0x6509('0x34')],qs[_0x6509('0x42')](_0x448670[_0x6509('0x2f')][_0x6509('0x42')]));_0x3a9ecc[_0x6509('0x33')]=_0x3a9ecc[_0x6509('0x33')][_0x6509('0x35')]?_0x3a9ecc[_0x6509('0x33')]:_0x56e0b9['model'];if(_0x448670[_0x6509('0x2f')][_0x6509('0x43')]){_0x3a9ecc[_0x6509('0x3f')]=[{'all':!![]}];}_0x3a9ecc=_[_0x6509('0x3c')]({},_0x3a9ecc,_0x448670[_0x6509('0x3e')]);return db[_0x6509('0x2a')][_0x6509('0x44')](_0x3a9ecc)[_0x6509('0x25')](handleEntityNotFound(_0x35bcd9,null))[_0x6509('0x25')](respondWithResult(_0x35bcd9,null))[_0x6509('0x45')](handleError(_0x35bcd9,null));};exports['create']=function(_0x4d798f,_0xe03972){return db[_0x6509('0x2a')][_0x6509('0x46')](_0x4d798f[_0x6509('0x47')],{})[_0x6509('0x25')](respondWithResult(_0xe03972,0xc9))[_0x6509('0x45')](handleError(_0xe03972,null));};exports[_0x6509('0x24')]=function(_0x62aee2,_0x528365){if(_0x62aee2[_0x6509('0x47')]['id']){delete _0x62aee2[_0x6509('0x47')]['id'];}return db[_0x6509('0x2a')][_0x6509('0x44')]({'where':{'id':_0x62aee2[_0x6509('0x48')]['id']}})[_0x6509('0x25')](handleEntityNotFound(_0x528365,null))[_0x6509('0x25')](saveUpdates(_0x62aee2['body'],null))[_0x6509('0x25')](respondWithResult(_0x528365,null))[_0x6509('0x45')](handleError(_0x528365,null));};exports['destroy']=function(_0x5d2ec3,_0xea4f0b){return db[_0x6509('0x2a')]['find']({'where':{'id':_0x5d2ec3[_0x6509('0x48')]['id']}})['then'](handleEntityNotFound(_0xea4f0b,null))[_0x6509('0x25')](removeEntity(_0xea4f0b,null))['catch'](handleError(_0xea4f0b,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index 4117ac9..45e11a9 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 _0x35fd=['utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','bluebird','path','../../config/environment','./smsApplication.attributes','exports','define','SmsApplication','sms_applications'];(function(_0x599aa2,_0x4c3fd4){var _0x3fdacd=function(_0x246684){while(--_0x246684){_0x599aa2['push'](_0x599aa2['shift']());}};_0x3fdacd(++_0x4c3fd4);}(_0x35fd,0x1d6));var _0xd35f=function(_0x11162f,_0x48880a){_0x11162f=_0x11162f-0x0;var _0x275e50=_0x35fd[_0x11162f];return _0x275e50;};'use strict';var _=require('lodash');var util=require(_0xd35f('0x0'));var logger=require(_0xd35f('0x1'))('api');var moment=require('moment');var BPromise=require(_0xd35f('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd35f('0x3'));var rimraf=require('rimraf');var config=require(_0xd35f('0x4'));var attributes=require(_0xd35f('0x5'));module[_0xd35f('0x6')]=function(_0x481cb0,_0x220144){return _0x481cb0[_0xd35f('0x7')](_0xd35f('0x8'),attributes,{'tableName':_0xd35f('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xd35f('0xa'),'collate':_0xd35f('0xb')});}; \ No newline at end of file +var _0xee24=['utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./smsApplication.attributes','exports','define','SmsApplication','sms_applications'];(function(_0x3c511b,_0x5b546f){var _0x52c6a4=function(_0x4859a0){while(--_0x4859a0){_0x3c511b['push'](_0x3c511b['shift']());}};_0x52c6a4(++_0x5b546f);}(_0xee24,0x1a6));var _0x4ee2=function(_0x56808f,_0x41c9c0){_0x56808f=_0x56808f-0x0;var _0x29b2d7=_0xee24[_0x56808f];return _0x29b2d7;};'use strict';var _=require('lodash');var util=require(_0x4ee2('0x0'));var logger=require(_0x4ee2('0x1'))('api');var moment=require(_0x4ee2('0x2'));var BPromise=require(_0x4ee2('0x3'));var rp=require(_0x4ee2('0x4'));var fs=require('fs');var path=require(_0x4ee2('0x5'));var rimraf=require('rimraf');var config=require(_0x4ee2('0x6'));var attributes=require(_0x4ee2('0x7'));module[_0x4ee2('0x8')]=function(_0x1993de,_0x5c778f){return _0x1993de[_0x4ee2('0x9')](_0x4ee2('0xa'),attributes,{'tableName':_0x4ee2('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x4ee2('0xc'),'collate':_0x4ee2('0xd')});}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.rpc.js b/server/api/smsApplication/smsApplication.rpc.js index 54f16b6..29f5ea0 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 _0x1e82=['SmsApplication,\x20%s,\x20%s','request\x20sent','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','client','http','request','info'];(function(_0x2090a3,_0x355528){var _0x2eed3b=function(_0x492973){while(--_0x492973){_0x2090a3['push'](_0x2090a3['shift']());}};_0x2eed3b(++_0x355528);}(_0x1e82,0x8b));var _0x21e8=function(_0x89f1ae,_0x15cc30){_0x89f1ae=_0x89f1ae-0x0;var _0xc85802=_0x1e82[_0x89f1ae];return _0xc85802;};'use strict';var _=require(_0x21e8('0x0'));var util=require(_0x21e8('0x1'));var moment=require(_0x21e8('0x2'));var BPromise=require(_0x21e8('0x3'));var rs=require(_0x21e8('0x4'));var fs=require('fs');var Redis=require(_0x21e8('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x21e8('0x6'));var logger=require(_0x21e8('0x7'))('rpc');var config=require(_0x21e8('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x21e8('0x9')][_0x21e8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x38c3d0,_0x22cbd4,_0x47b3b3){return new BPromise(function(_0x45e5c1,_0x3754c9){return client[_0x21e8('0xb')](_0x38c3d0,_0x47b3b3)['then'](function(_0x31b6c2){logger[_0x21e8('0xc')](_0x21e8('0xd'),_0x22cbd4,_0x21e8('0xe'));logger['debug']('SmsApplication,\x20%s,\x20%s,\x20%s',_0x22cbd4,_0x21e8('0xe'),JSON['stringify'](_0x31b6c2));if(_0x31b6c2[_0x21e8('0xf')]){if(_0x31b6c2[_0x21e8('0xf')]['code']===0x1f4){logger[_0x21e8('0xf')]('SmsApplication,\x20%s,\x20%s',_0x22cbd4,_0x31b6c2[_0x21e8('0xf')][_0x21e8('0x10')]);return _0x3754c9(_0x31b6c2[_0x21e8('0xf')]['message']);}logger[_0x21e8('0xf')]('SmsApplication,\x20%s,\x20%s',_0x22cbd4,_0x31b6c2[_0x21e8('0xf')][_0x21e8('0x10')]);return _0x45e5c1(_0x31b6c2[_0x21e8('0xf')]['message']);}else{logger['info'](_0x21e8('0xd'),_0x22cbd4,_0x21e8('0xe'));_0x45e5c1(_0x31b6c2[_0x21e8('0x11')][_0x21e8('0x10')]);}})[_0x21e8('0x12')](function(_0x13da4f){logger[_0x21e8('0xf')](_0x21e8('0xd'),_0x22cbd4,_0x13da4f);_0x3754c9(_0x13da4f);});});} \ No newline at end of file +var _0x7177=['stringify','error','code','message','result','lodash','moment','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','SmsApplication,\x20%s,\x20%s','debug','request\x20sent'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x7177,0x101));var _0x7717=function(_0x50ee83,_0x106751){_0x50ee83=_0x50ee83-0x0;var _0x3099ea=_0x7177[_0x50ee83];return _0x3099ea;};'use strict';var _=require(_0x7717('0x0'));var util=require('util');var moment=require(_0x7717('0x1'));var BPromise=require('bluebird');var rs=require(_0x7717('0x2'));var fs=require('fs');var Redis=require(_0x7717('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x7717('0x4'));var logger=require(_0x7717('0x5'))('rpc');var config=require(_0x7717('0x6'));var jayson=require(_0x7717('0x7'));var client=jayson[_0x7717('0x8')][_0x7717('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xe3d36b,_0x3db511,_0xaca6aa){return new BPromise(function(_0x2ded67,_0x29a980){return client[_0x7717('0xa')](_0xe3d36b,_0xaca6aa)[_0x7717('0xb')](function(_0x51d2a6){logger[_0x7717('0xc')](_0x7717('0xd'),_0x3db511,'request\x20sent');logger[_0x7717('0xe')]('SmsApplication,\x20%s,\x20%s,\x20%s',_0x3db511,_0x7717('0xf'),JSON[_0x7717('0x10')](_0x51d2a6));if(_0x51d2a6[_0x7717('0x11')]){if(_0x51d2a6[_0x7717('0x11')][_0x7717('0x12')]===0x1f4){logger['error'](_0x7717('0xd'),_0x3db511,_0x51d2a6[_0x7717('0x11')][_0x7717('0x13')]);return _0x29a980(_0x51d2a6[_0x7717('0x11')][_0x7717('0x13')]);}logger[_0x7717('0x11')](_0x7717('0xd'),_0x3db511,_0x51d2a6['error'][_0x7717('0x13')]);return _0x2ded67(_0x51d2a6[_0x7717('0x11')][_0x7717('0x13')]);}else{logger[_0x7717('0xc')](_0x7717('0xd'),_0x3db511,_0x7717('0xf'));_0x2ded67(_0x51d2a6[_0x7717('0x14')]['message']);}})['catch'](function(_0x4071ff){logger['error'](_0x7717('0xd'),_0x3db511,_0x4071ff);_0x29a980(_0x4071ff);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index 02cf3d2..5da755a 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 _0xb10b=['smsinteraction:addtags','addTags','put','update','delete','smsinteraction:destroy','destroy','/:id/tags','removeTags','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsInteraction.controller','get','index','isAuthenticated','describe','/:id','show','/:id/messages','/:id/download','post','create','addMessage','tracked','sms'];(function(_0x517d44,_0x18bf20){var _0x512736=function(_0x19a208){while(--_0x19a208){_0x517d44['push'](_0x517d44['shift']());}};_0x512736(++_0x18bf20);}(_0xb10b,0x12a));var _0xbb10=function(_0x48accc,_0x3142e9){_0x48accc=_0x48accc-0x0;var _0x460cc4=_0xb10b[_0x48accc];return _0x460cc4;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var fs_extra=require(_0xbb10('0x4'));var auth=require(_0xbb10('0x5'));var interaction=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var controller=require(_0xbb10('0x8'));router[_0xbb10('0x9')]('/',auth['isAuthenticated'](),controller[_0xbb10('0xa')]);router[_0xbb10('0x9')]('/describe',auth[_0xbb10('0xb')](),controller[_0xbb10('0xc')]);router[_0xbb10('0x9')](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0xe')]);router[_0xbb10('0x9')](_0xbb10('0xf'),auth['isAuthenticated'](),controller['getMessages']);router[_0xbb10('0x9')](_0xbb10('0x10'),auth[_0xbb10('0xb')](),controller['download']);router[_0xbb10('0x11')]('/',auth['isAuthenticated'](),controller[_0xbb10('0x12')]);router[_0xbb10('0x11')](_0xbb10('0xf'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x13')]);router[_0xbb10('0x11')]('/:id/tags',auth[_0xbb10('0xb')](),interaction[_0xbb10('0x14')](_0xbb10('0x15'),_0xbb10('0x16')),controller[_0xbb10('0x17')]);router[_0xbb10('0x18')](_0xbb10('0xd'),auth[_0xbb10('0xb')](),interaction[_0xbb10('0x14')](_0xbb10('0x15'),'smsinteraction:update'),controller[_0xbb10('0x19')]);router[_0xbb10('0x1a')](_0xbb10('0xd'),auth[_0xbb10('0xb')](),interaction[_0xbb10('0x14')](_0xbb10('0x15'),_0xbb10('0x1b')),controller[_0xbb10('0x1c')]);router[_0xbb10('0x1a')](_0xbb10('0x1d'),auth['isAuthenticated'](),controller[_0xbb10('0x1e')]);module[_0xbb10('0x1f')]=router; \ No newline at end of file +var _0x5c00=['smsinteraction:addtags','addTags','/:id','smsinteraction:update','update','delete','smsinteraction:destroy','destroy','removeTags','exports','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','show','/:id/messages','getMessages','post','create','addMessage','/:id/tags','tracked','sms'];(function(_0x278e3c,_0x1c9cfd){var _0x3e2d9b=function(_0x34d928){while(--_0x34d928){_0x278e3c['push'](_0x278e3c['shift']());}};_0x3e2d9b(++_0x1c9cfd);}(_0x5c00,0x17e));var _0x05c0=function(_0x591a90,_0x5525b0){_0x591a90=_0x591a90-0x0;var _0x551587=_0x5c00[_0x591a90];return _0x551587;};'use strict';var multer=require(_0x05c0('0x0'));var util=require(_0x05c0('0x1'));var path=require(_0x05c0('0x2'));var timeout=require('connect-timeout');var express=require(_0x05c0('0x3'));var router=express['Router']();var fs_extra=require(_0x05c0('0x4'));var auth=require(_0x05c0('0x5'));var interaction=require(_0x05c0('0x6'));var config=require(_0x05c0('0x7'));var controller=require('./smsInteraction.controller');router[_0x05c0('0x8')]('/',auth[_0x05c0('0x9')](),controller[_0x05c0('0xa')]);router[_0x05c0('0x8')]('/describe',auth[_0x05c0('0x9')](),controller[_0x05c0('0xb')]);router[_0x05c0('0x8')]('/:id',auth[_0x05c0('0x9')](),controller[_0x05c0('0xc')]);router[_0x05c0('0x8')](_0x05c0('0xd'),auth[_0x05c0('0x9')](),controller[_0x05c0('0xe')]);router['get']('/:id/download',auth[_0x05c0('0x9')](),controller['download']);router[_0x05c0('0xf')]('/',auth[_0x05c0('0x9')](),controller[_0x05c0('0x10')]);router['post'](_0x05c0('0xd'),auth['isAuthenticated'](),controller[_0x05c0('0x11')]);router[_0x05c0('0xf')](_0x05c0('0x12'),auth[_0x05c0('0x9')](),interaction[_0x05c0('0x13')](_0x05c0('0x14'),_0x05c0('0x15')),controller[_0x05c0('0x16')]);router['put'](_0x05c0('0x17'),auth[_0x05c0('0x9')](),interaction[_0x05c0('0x13')](_0x05c0('0x14'),_0x05c0('0x18')),controller[_0x05c0('0x19')]);router[_0x05c0('0x1a')](_0x05c0('0x17'),auth[_0x05c0('0x9')](),interaction['tracked'](_0x05c0('0x14'),_0x05c0('0x1b')),controller[_0x05c0('0x1c')]);router['delete'](_0x05c0('0x12'),auth[_0x05c0('0x9')](),controller[_0x05c0('0x1d')]);module[_0x05c0('0x1e')]=router; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.attributes.js b/server/api/smsInteraction/smsInteraction.attributes.js index 1a3ce02..c01712e 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 _0x1b20=['DATE','ENUM','out','BOOLEAN','moment','exports','STRING'];(function(_0x4c2581,_0x1b4589){var _0x148722=function(_0x259d62){while(--_0x259d62){_0x4c2581['push'](_0x4c2581['shift']());}};_0x148722(++_0x1b4589);}(_0x1b20,0x66));var _0x01b2=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x1b20[_0x2c91e9];return _0x13f0ff;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x01b2('0x0'));module[_0x01b2('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x01b2('0x2')]},'secondDisposition':{'type':Sequelize[_0x01b2('0x2')]},'thirdDisposition':{'type':Sequelize[_0x01b2('0x2')]},'note':{'type':Sequelize[_0x01b2('0x2')]},'phone':{'type':Sequelize[_0x01b2('0x2')]},'read1stAt':{'type':Sequelize[_0x01b2('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x01b2('0x4')]('in',_0x01b2('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x01b2('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x01b2('0x4')]('in',_0x01b2('0x5')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x01b2('0x6')],'defaultValue':![]}}; \ No newline at end of file +var _0x3079=['exports','BOOLEAN','DATE','STRING','ENUM','out','moment'];(function(_0x2b3c36,_0x2692e1){var _0x1c1840=function(_0x559719){while(--_0x559719){_0x2b3c36['push'](_0x2b3c36['shift']());}};_0x1c1840(++_0x2692e1);}(_0x3079,0x110));var _0x9307=function(_0x337b70,_0x34d970){_0x337b70=_0x337b70-0x0;var _0x2ef5c7=_0x3079[_0x337b70];return _0x2ef5c7;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x9307('0x0'));module[_0x9307('0x1')]={'closed':{'type':Sequelize[_0x9307('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x9307('0x3')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x9307('0x4')]},'thirdDisposition':{'type':Sequelize[_0x9307('0x4')]},'note':{'type':Sequelize['STRING']},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x9307('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x9307('0x5')]('in',_0x9307('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x9307('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x9307('0x5')]('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.controller.js b/server/api/smsInteraction/smsInteraction.controller.js index be3bd4c..3999d0d 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 _0x5bc9=['../../mysqldb','redis','defaults','localhost','./smsInteraction.socket','register','status','end','offset','undefined','count','limit','json','apply','save','update','then','destroy','sendStatus','error','stack','name','send','Users','fullname','TagIds','split','forEach','push','catch','map','SmsInteraction','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','select','field','color','tools_tags','u.id','ui.SmsInteractionId','from','user_has_sms_interactions','left_join','users','u.id\x20=\x20ui.UserId','sms_interactions','o.id\x20=\x20i.UserId','sms_accounts','sms_messages','me.SmsInteractionId\x20=\x20i.id','sms_interaction_has_tags','it.SmsInteractionId\x20=\x20i.id','search','conditions','find','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','body','some','compact','isEmpty','SmsAccountId','i.SmsAccountId\x20IN\x20?','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','t.id\x20IN\x20?','resolve','i.SmsAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getSmsAccounts','i.SmsAccountId\x20IS\x20NULL','sequelize','toString','keyBy','merge','a.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','c.phone','Contact.phone','c.mobile','Contact.mobile','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.SmsInteractionId\x20IN\x20?','groupBy','SmsInteractionId','all','rows','params','includeAll','include','options','create','describe','addMessage','SmsMessage','ids','omit','getMessages','hasOwnProperty','format','YYYY-MM-DD\x20HH:mm:ss','spread','findAll','emit','smsInteractionTags:save','removeTags','unix','root','server','files','tmp','join','CmContact','firstName','lastName','direction','SmsAccount','Owner','get','Sms','Account','closed','closedAt','disposition','Messages','out','System','secret','views','downloadInteraction.ejs','transcript-','createPdfFromHTML','download','unlinkSync','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','jsforce','desk.js','querystring','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util'];(function(_0x30fbfc,_0x9e031f){var _0x89907d=function(_0x5efc28){while(--_0x5efc28){_0x30fbfc['push'](_0x30fbfc['shift']());}};_0x89907d(++_0x9e031f);}(_0x5bc9,0x1ac));var _0x95bc=function(_0xbc9b8d,_0x220c12){_0xbc9b8d=_0xbc9b8d-0x0;var _0x4786e7=_0x5bc9[_0xbc9b8d];return _0x4786e7;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x95bc('0x0'));var zipdir=require(_0x95bc('0x1'));var jsonpatch=require(_0x95bc('0x2'));var rp=require(_0x95bc('0x3'));var moment=require(_0x95bc('0x4'));var BPromise=require(_0x95bc('0x5'));var Mustache=require('mustache');var util=require(_0x95bc('0x6'));var path=require(_0x95bc('0x7'));var sox=require(_0x95bc('0x8'));var csv=require(_0x95bc('0x9'));var ejs=require(_0x95bc('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x95bc('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x95bc('0xc'));var deskjs=require(_0x95bc('0xd'));var toCsv=require('to-csv');var querystring=require(_0x95bc('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x95bc('0xf'));var pdf=require(_0x95bc('0x10'));var hardwareService=require(_0x95bc('0x11'));var logger=require('../../config/logger')(_0x95bc('0x12'));var utils=require(_0x95bc('0x13'));var config=require(_0x95bc('0x14'));var licenseUtil=require(_0x95bc('0x15'));var db=require(_0x95bc('0x16'))['db'];config[_0x95bc('0x17')]=_[_0x95bc('0x18')](config[_0x95bc('0x17')],{'host':_0x95bc('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x95bc('0x17')]));require(_0x95bc('0x1a'))[_0x95bc('0x1b')](socket);function respondWithStatusCode(_0x2130af,_0x223cb9){_0x223cb9=_0x223cb9||0xcc;return function(_0x12b403){if(_0x12b403){return _0x2130af['sendStatus'](_0x223cb9);}return _0x2130af[_0x95bc('0x1c')](_0x223cb9)[_0x95bc('0x1d')]();};}function respondWithResult(_0x827fb9,_0x528f45){_0x528f45=_0x528f45||0xc8;return function(_0x36db43){if(_0x36db43){return _0x827fb9[_0x95bc('0x1c')](_0x528f45)['json'](_0x36db43);}};}function respondWithFilteredResult(_0x30f469,_0x698f9c){return function(_0x457a72){if(_0x457a72){var _0x226663=typeof _0x698f9c[_0x95bc('0x1e')]===_0x95bc('0x1f')&&typeof _0x698f9c['limit']===_0x95bc('0x1f');var _0x1dbf5a=_0x457a72[_0x95bc('0x20')];var _0x3e9648=_0x226663?0x0:_0x698f9c[_0x95bc('0x1e')];var _0x477af1=_0x226663?_0x457a72[_0x95bc('0x20')]:_0x698f9c[_0x95bc('0x1e')]+_0x698f9c[_0x95bc('0x21')];var _0x2e49c1;if(_0x477af1>=_0x1dbf5a){_0x477af1=_0x1dbf5a;_0x2e49c1=0xc8;}else{_0x2e49c1=0xce;}_0x30f469['status'](_0x2e49c1);return _0x30f469['set']('Content-Range',_0x3e9648+'-'+_0x477af1+'/'+_0x1dbf5a)[_0x95bc('0x22')](_0x457a72);}return null;};}function patchUpdates(_0x55abf4){return function(_0x308c89){try{jsonpatch[_0x95bc('0x23')](_0x308c89,_0x55abf4,!![]);}catch(_0x52571b){return BPromise['reject'](_0x52571b);}return _0x308c89[_0x95bc('0x24')]();};}function saveUpdates(_0x29a6f5,_0x425d11){return function(_0x2e31be){if(_0x2e31be){return _0x2e31be[_0x95bc('0x25')](_0x29a6f5)[_0x95bc('0x26')](function(_0x110cc5){return _0x110cc5;});}return null;};}function removeEntity(_0x16455c,_0x1fddbc){return function(_0x213c7f){if(_0x213c7f){return _0x213c7f[_0x95bc('0x27')]()[_0x95bc('0x26')](function(){_0x16455c[_0x95bc('0x1c')](0xcc)[_0x95bc('0x1d')]();});}};}function handleEntityNotFound(_0x5009fd,_0x4927e6){return function(_0x368536){if(!_0x368536){_0x5009fd[_0x95bc('0x28')](0x194);}return _0x368536;};}function handleError(_0x31a20e,_0xe7b9f){_0xe7b9f=_0xe7b9f||0x1f4;return function(_0x5e9779){logger[_0x95bc('0x29')](_0x5e9779[_0x95bc('0x2a')]);if(_0x5e9779[_0x95bc('0x2b')]){delete _0x5e9779['name'];}_0x31a20e[_0x95bc('0x1c')](_0xe7b9f)[_0x95bc('0x2c')](_0x5e9779);};}function getInteractionUsers(_0x4af91f,_0x33cc1){return new BPromise(function(_0x2fecb9,_0x18bd9d){try{if(_0x33cc1[_0x4af91f['id']]){_0x4af91f[_0x95bc('0x2d')]=_['map'](_0x33cc1[_0x4af91f['id']],function(_0x4be9e5){return{'id':_0x4be9e5['id'],'fullname':_0x4be9e5[_0x95bc('0x2e')]};});}}catch(_0x318137){_0x18bd9d(_0x318137);}_0x2fecb9(_0x4af91f);});}function getInteractionTags(_0x145669,_0x2928ec){return new BPromise(function(_0x174261,_0x156537){try{if(_0x145669[_0x95bc('0x2f')]){_0x145669['Tags']=[];_0x145669[_0x95bc('0x2f')][_0x95bc('0x30')](',')[_0x95bc('0x31')](function(_0x40d106){_0x145669['Tags'][_0x95bc('0x32')](_0x2928ec[_0x40d106]);});}delete _0x145669[_0x95bc('0x2f')];}catch(_0x33139f){_0x156537(_0x33139f);}_0x174261(_0x145669);});}function updateSmsInteraction(_0xf48363,_0x17e605,_0x1dc73e){return new BPromise(function(_0x3dcfa9,_0x42d9a9){return getInteractionUsers(_0xf48363,_0x1dc73e)[_0x95bc('0x26')](function(_0x45d73e){return getInteractionTags(_0x45d73e,_0x17e605);})[_0x95bc('0x26')](function(_0x41671f){_0x3dcfa9(_0x41671f);})[_0x95bc('0x33')](function(_0x276bcd){_0x42d9a9(_0x276bcd);});});}exports['index']=function(_0x14b063,_0x282d42){var _0x33af32={},_0x4bd7c4={},_0x343b3c={'count':0x0,'rows':[]};var _0x57eb72=_[_0x95bc('0x34')](db[_0x95bc('0x35')][_0x95bc('0x36')],function(_0x492c2d){return{'name':_0x492c2d[_0x95bc('0x37')],'type':_0x492c2d[_0x95bc('0x38')][_0x95bc('0x39')]};});_0x4bd7c4[_0x95bc('0x3a')]=_[_0x95bc('0x34')](_0x57eb72,_0x95bc('0x2b'));_0x4bd7c4[_0x95bc('0x3b')]=_[_0x95bc('0x3c')](_0x14b063['query']);_0x4bd7c4[_0x95bc('0x3d')]=_[_0x95bc('0x3e')](_0x4bd7c4[_0x95bc('0x3a')],_0x4bd7c4[_0x95bc('0x3b')]);_0x33af32[_0x95bc('0x3f')]=_[_0x95bc('0x3e')](_0x4bd7c4[_0x95bc('0x3a')],qs[_0x95bc('0x40')](_0x14b063[_0x95bc('0x3b')][_0x95bc('0x40')]));_0x33af32[_0x95bc('0x3f')]=_0x33af32[_0x95bc('0x3f')][_0x95bc('0x41')]?_0x33af32[_0x95bc('0x3f')]:_0x4bd7c4[_0x95bc('0x3a')];if(!_0x14b063['query']['hasOwnProperty'](_0x95bc('0x42'))){_0x33af32[_0x95bc('0x21')]=qs[_0x95bc('0x21')](_0x14b063[_0x95bc('0x3b')][_0x95bc('0x21')]);_0x33af32[_0x95bc('0x1e')]=qs['offset'](_0x14b063[_0x95bc('0x3b')][_0x95bc('0x1e')]);}_0x33af32[_0x95bc('0x43')]=qs[_0x95bc('0x44')](_0x14b063['query'][_0x95bc('0x44')]);_0x33af32[_0x95bc('0x45')]=qs[_0x95bc('0x3d')](_[_0x95bc('0x46')](_0x14b063[_0x95bc('0x3b')],_0x4bd7c4[_0x95bc('0x3d')]),_0x57eb72);var _0x75f848=[];var _0x367b6f=squel[_0x95bc('0x47')]()[_0x95bc('0x48')]('id')[_0x95bc('0x48')]('name')[_0x95bc('0x48')](_0x95bc('0x49'))['from'](_0x95bc('0x4a'));var _0x7c913b=squel[_0x95bc('0x47')]()['field'](_0x95bc('0x4b'))[_0x95bc('0x48')]('u.fullname')[_0x95bc('0x48')](_0x95bc('0x4c'))[_0x95bc('0x4d')](_0x95bc('0x4e'),'ui')[_0x95bc('0x4f')](_0x95bc('0x50'),'u',_0x95bc('0x51'));var _0x24fbca=squel[_0x95bc('0x47')]()[_0x95bc('0x4d')](_0x95bc('0x52'),'i')[_0x95bc('0x4f')]('cm_contacts','c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0x95bc('0x4f')]('users','o',_0x95bc('0x53'))[_0x95bc('0x4f')](_0x95bc('0x54'),'a','a.id\x20=\x20i.SmsAccountId')['left_join'](_0x95bc('0x55'),'me',_0x95bc('0x56'))[_0x95bc('0x4f')](_0x95bc('0x57'),'it',_0x95bc('0x58'))[_0x95bc('0x4f')]('tools_tags','t','t.id\x20=\x20it.TagId');var _0x234128=squel['expr']();var _0x59f54b=[];var _0x3b4b0e=squel['expr']();var _0x37fec2;if(_0x14b063[_0x95bc('0x3b')][_0x95bc('0x59')]){_0x37fec2=as['parseSearch'](_0x14b063[_0x95bc('0x3b')][_0x95bc('0x59')]);var _0x3d326e=_0x37fec2['sqlOperator'];for(var _0x5e2be5=0x0;_0x5e2be5<_0x37fec2[_0x95bc('0x5a')][_0x95bc('0x41')];_0x5e2be5++){var _0x4a2828=_0x37fec2[_0x95bc('0x5a')][_0x5e2be5];var _0x11b850='i';var _0x263ab2=_[_0x95bc('0x5b')](_0x57eb72,[_0x95bc('0x2b'),_0x4a2828[_0x95bc('0x48')]]);if(!_0x263ab2){switch(_0x4a2828[_0x95bc('0x48')]){case _0x95bc('0x5c'):if(_0x4a2828[_0x95bc('0x5d')]==0x1){_0x24fbca[_0x95bc('0x5e')]('`'+_0x4a2828[_0x95bc('0x48')]+_0x95bc('0x5f'));}else{_0x24fbca[_0x95bc('0x5e')]('`'+_0x4a2828[_0x95bc('0x48')]+_0x95bc('0x60'));}break;case _0x95bc('0x61'):if(_0x4a2828[_0x95bc('0x62')]===_0x95bc('0x63')){if(_0x4a2828[_0x95bc('0x5d')][_0x95bc('0x30')]('\x20')[_0x95bc('0x41')]>0x1){_0x234128[_0x3d326e](_0x95bc('0x64'),qs[_0x95bc('0x65')](_0x4a2828['value']),null);}else{var _0x253757='%'+_0x4a2828[_0x95bc('0x5d')]+'%';_0x234128[_0x3d326e](_0x95bc('0x66'),_0x253757,_0x253757,_0x253757);}}else{_0x263ab2=_[_0x95bc('0x5b')](_0x57eb72,[_0x95bc('0x2b'),_0x95bc('0x67')]);_0x4a2828[_0x95bc('0x48')]=_0x95bc('0x67');_0x377f94=as[_0x95bc('0x68')](_0x11b850,_0x263ab2['type'],_0x4a2828);_0x234128[_0x3d326e](_0x377f94[_0x95bc('0x69')],_0x377f94[_0x95bc('0x5d')][_0x95bc('0x6a')],_0x377f94[_0x95bc('0x5d')][_0x95bc('0x1d')]);}break;case _0x95bc('0x6b'):var _0xd1ac4a=_0x4a2828[_0x95bc('0x5d')][_0x95bc('0x30')](',')['map'](function(_0x5f0865){return Number(_0x5f0865);});_0xd1ac4a[_0x95bc('0x31')](function(_0x14c579){_0x3b4b0e['or'](_0x95bc('0x6c'),'%,'+_0x14c579+',%');});_0x59f54b=_[_0x95bc('0x6d')](_0x59f54b,_0xd1ac4a);break;case _0x95bc('0x6e'):if(_0x4a2828['operator']===_0x95bc('0x63')){_0x234128[_0x3d326e](_0x95bc('0x6f'),'%'+_0x4a2828['value']+'%',null);}else{_0x263ab2=_[_0x95bc('0x5b')](_0x57eb72,[_0x95bc('0x2b'),_0x95bc('0x70')]);_0x4a2828[_0x95bc('0x48')]=_0x95bc('0x70');_0x377f94=as[_0x95bc('0x68')](_0x11b850,_0x263ab2['type'],_0x4a2828);_0x234128[_0x3d326e](_0x377f94['text'],_0x377f94[_0x95bc('0x5d')][_0x95bc('0x6a')],_0x377f94[_0x95bc('0x5d')][_0x95bc('0x1d')]);}break;case _0x95bc('0x71'):_0x377f94=as[_0x95bc('0x68')]('me',null,_0x4a2828);_0x234128[_0x3d326e](_0x377f94['text'],_0x377f94[_0x95bc('0x5d')][_0x95bc('0x6a')],_0x377f94[_0x95bc('0x5d')][_0x95bc('0x1d')]);break;}}else{var _0x377f94=as['buildExpression'](_0x11b850,_0x263ab2[_0x95bc('0x38')],_0x4a2828);_0x234128[_0x3d326e](_0x377f94['text'],_0x377f94[_0x95bc('0x5d')][_0x95bc('0x6a')],_0x377f94['value'][_0x95bc('0x1d')]);}}}else{var _0x416183=_(_0x14b063[_0x95bc('0x3b')])[_0x95bc('0x3c')]()[_0x95bc('0x34')](function(_0x584aee){return _[_0x95bc('0x72')](_0x57eb72,['name',_0x584aee])?_0x584aee:undefined;})[_0x95bc('0x73')]()[_0x95bc('0x5d')]();if(!_[_0x95bc('0x74')](_0x416183)){_0x416183[_0x95bc('0x31')](function(_0x2c62c5){if(_0x2c62c5===_0x95bc('0x75')){_0x24fbca[_0x95bc('0x45')](_0x95bc('0x76'),[]['concat'](_0x14b063[_0x95bc('0x3b')][_0x2c62c5]));}else if(_0x2c62c5===_0x95bc('0x77')){var _0x58a7bc=JSON[_0x95bc('0x78')](_0x14b063['query'][_0x2c62c5])[_0x95bc('0x79')];var _0x330d9b=JSON['parse'](_0x14b063[_0x95bc('0x3b')][_0x2c62c5])[_0x95bc('0x7a')];_0x24fbca['where'](_0x95bc('0x7b'),_0x58a7bc,_0x330d9b);}else{if(_0x14b063[_0x95bc('0x3b')][_0x2c62c5]===_0x95bc('0x7c')){_0x24fbca[_0x95bc('0x45')]('i.'+_0x2c62c5+'\x20IS\x20NULL');}else{_0x24fbca[_0x95bc('0x45')]('i.'+_0x2c62c5+'\x20=\x20?',_0x14b063[_0x95bc('0x3b')][_0x2c62c5]);}}});}if(_0x14b063[_0x95bc('0x3b')][_0x95bc('0x7d')]){if(_0x14b063[_0x95bc('0x3b')]['read']==0x1){_0x24fbca[_0x95bc('0x5e')](_0x95bc('0x7e'));}else{_0x24fbca[_0x95bc('0x5e')](_0x95bc('0x7f'));}}if(_0x14b063['query'][_0x95bc('0x80')]){_0x59f54b=_[_0x95bc('0x81')](_0x14b063['query'][_0x95bc('0x80')])?_0x14b063[_0x95bc('0x3b')][_0x95bc('0x80')]:new Array(_0x14b063['query'][_0x95bc('0x80')]);_0x59f54b[_0x95bc('0x31')](function(_0x26325a){_0x3b4b0e['or'](_0x95bc('0x6c'),'%,'+_0x26325a+',%');});}if(_0x14b063['query'][_0x95bc('0x82')]){var _0x2e2435=_0x14b063[_0x95bc('0x3b')][_0x95bc('0x82')][_0x95bc('0x83')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0x95bc('0x84')](_0x2e2435)){_0x234128['or']('i.id\x20LIKE\x20?',_0x2e2435+'%')['or']('i.phone\x20LIKE\x20?',_0x2e2435+'%');}else{_0x234128['or'](_0x95bc('0x85'),qs[_0x95bc('0x65')](_0x2e2435))['or'](_0x95bc('0x86'),_0x2e2435+'%');}}}_0x24fbca[_0x95bc('0x45')](_0x234128);_0x24fbca[_0x95bc('0x87')](_0x95bc('0x88'));var _0x14ccbe={'type':db[_0x95bc('0x89')][_0x95bc('0x8a')][_0x95bc('0x8b')],'raw':!![]};var _0x4134f0=_0x24fbca[_0x95bc('0x8c')]();_0x4134f0[_0x95bc('0x48')](_0x95bc('0x88'));_0x4134f0[_0x95bc('0x48')](_0x95bc('0x8d'),_0x95bc('0x5c'));if(_0x33af32[_0x95bc('0x43')]){_0x33af32[_0x95bc('0x43')][_0x95bc('0x31')](function(_0x2b6368){var _0x441685=_0x2b6368[0x0]===_0x95bc('0x8e')?_0x2b6368[0x0]:'i.'+_0x2b6368[0x0];_0x24fbca[_0x95bc('0x43')](_0x441685,_0x2b6368[0x1]===_0x95bc('0x8f')?![]:!![]);});}if(!_['isEmpty'](_0x59f54b)){_0x24fbca[_0x95bc('0x5e')](_0x3b4b0e);_0x4134f0[_0x95bc('0x45')](_0x95bc('0x90'),_0x59f54b);}BPromise[_0x95bc('0x91')]()[_0x95bc('0x26')](function(){if(!_0x37fec2){if(_0x14b063['query'][_0x95bc('0x75')])return;_0x4134f0[_0x95bc('0x45')]('i.SmsAccountId\x20IS\x20NOT\x20NULL');_0x24fbca[_0x95bc('0x45')](_0x95bc('0x92'));return;}if(_0x14b063[_0x95bc('0x93')][_0x95bc('0x94')]!==_0x95bc('0x95'))return;return _0x14b063[_0x95bc('0x93')][_0x95bc('0x96')]({'attributes':['id'],'raw':!![]})[_0x95bc('0x26')](function(_0x172cfd){if(_['isEmpty'](_0x172cfd)){_0x4134f0[_0x95bc('0x45')](_0x95bc('0x97'));_0x24fbca[_0x95bc('0x45')](_0x95bc('0x97'));}else{_0x4134f0[_0x95bc('0x45')](_0x95bc('0x76'),_[_0x95bc('0x34')](_0x172cfd,'id'));_0x24fbca[_0x95bc('0x45')](_0x95bc('0x76'),_[_0x95bc('0x34')](_0x172cfd,'id'));}});})[_0x95bc('0x26')](function(){if(_0x14b063['user'][_0x95bc('0x94')]===_0x95bc('0x95')&&!_0x37fec2&&!_0x14b063[_0x95bc('0x3b')]['SmsAccountId'])return[];return db[_0x95bc('0x98')][_0x95bc('0x3b')](_0x4134f0[_0x95bc('0x99')](),_0x14ccbe);})[_0x95bc('0x26')](function(_0x5bdb44){_0x343b3c['count']=_0x5bdb44[_0x95bc('0x41')];if(_0x343b3c[_0x95bc('0x20')]===0x0)return[];return db[_0x95bc('0x98')][_0x95bc('0x3b')](_0x367b6f[_0x95bc('0x99')](),_0x14ccbe)['then'](function(_0x1753c9){_0x75f848=_[_0x95bc('0x9a')](_0x1753c9,'id');_0x14ccbe=_[_0x95bc('0x9b')](_0x14ccbe,{'model':db[_0x95bc('0x35')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x14b063[_0x95bc('0x3b')][_0x95bc('0x40')]){_0x33af32[_0x95bc('0x3f')][_0x95bc('0x31')](function(_0x2eea93){_0x24fbca[_0x95bc('0x48')]('i.'+_0x2eea93);});}else{_0x24fbca[_0x95bc('0x48')](_0x95bc('0x8d'),_0x95bc('0x5c'));_0x24fbca[_0x95bc('0x48')](_0x95bc('0x9c'),'Account.key');_0x24fbca[_0x95bc('0x48')](_0x95bc('0x9d'),_0x95bc('0x9e'));_0x24fbca['field'](_0x95bc('0x9f'),_0x95bc('0x8e'));_0x24fbca[_0x95bc('0x48')](_0x95bc('0xa0'));_0x24fbca['field'](_0x95bc('0xa1'),_0x95bc('0xa2'));_0x24fbca[_0x95bc('0x48')](_0x95bc('0xa3'),_0x95bc('0xa4'));_0x24fbca[_0x95bc('0x48')](_0x95bc('0xa5'),'Contact.email');_0x24fbca[_0x95bc('0x48')](_0x95bc('0xa6'),_0x95bc('0xa7'));_0x24fbca[_0x95bc('0x48')](_0x95bc('0xa8'),_0x95bc('0xa9'));_0x24fbca[_0x95bc('0x48')]('c.fax','Contact.fax');_0x24fbca[_0x95bc('0x48')]('o.fullname','Owner.fullname');_0x24fbca[_0x95bc('0x48')](_0x95bc('0xaa'),_0x95bc('0xab'));_0x24fbca[_0x95bc('0x48')](_0x95bc('0xac'),_0x95bc('0x2f'));}if(_0x33af32[_0x95bc('0x21')])_0x24fbca[_0x95bc('0x21')](_0x33af32[_0x95bc('0x21')]);if(_0x33af32[_0x95bc('0x1e')])_0x24fbca[_0x95bc('0x1e')](_0x33af32[_0x95bc('0x1e')]);return db[_0x95bc('0x98')][_0x95bc('0x3b')](_0x24fbca[_0x95bc('0x99')](),_0x14ccbe);})[_0x95bc('0x26')](function(_0x35c210){if(_0x35c210[_0x95bc('0x41')]>0x0)_0x7c913b[_0x95bc('0x45')](_0x95bc('0xad'),_[_0x95bc('0x34')](_0x35c210,'id'));return db[_0x95bc('0x98')]['query'](_0x7c913b['toString'](),_0x14ccbe)[_0x95bc('0x26')](function(_0x33d711){var _0x1b33ee=_[_0x95bc('0xae')](_0x33d711,_0x95bc('0xaf'));var _0x401718=[];_0x35c210[_0x95bc('0x31')](function(_0x2ee0ab){_0x401718[_0x95bc('0x32')](updateSmsInteraction(_0x2ee0ab,_0x75f848,_0x1b33ee));});return BPromise[_0x95bc('0xb0')](_0x401718);});});})[_0x95bc('0x26')](function(_0x57549e){_0x343b3c[_0x95bc('0xb1')]=_0x57549e;return _0x343b3c;})[_0x95bc('0x26')](respondWithFilteredResult(_0x282d42,_0x33af32))[_0x95bc('0x33')](handleError(_0x282d42,null));};exports['show']=function(_0x36843e,_0x2ed34e){var _0x30bd24={'raw':![],'where':{'id':_0x36843e[_0x95bc('0xb2')]['id']}},_0xe131a0={};_0xe131a0[_0x95bc('0x3a')]=_['keys'](db['SmsInteraction']['rawAttributes']);_0xe131a0[_0x95bc('0x3b')]=_[_0x95bc('0x3c')](_0x36843e[_0x95bc('0x3b')]);_0xe131a0['filters']=_[_0x95bc('0x3e')](_0xe131a0[_0x95bc('0x3a')],_0xe131a0[_0x95bc('0x3b')]);_0x30bd24['attributes']=_[_0x95bc('0x3e')](_0xe131a0[_0x95bc('0x3a')],qs['fields'](_0x36843e[_0x95bc('0x3b')][_0x95bc('0x40')]));_0x30bd24[_0x95bc('0x3f')]=_0x30bd24[_0x95bc('0x3f')]['length']?_0x30bd24[_0x95bc('0x3f')]:_0xe131a0['model'];if(_0x36843e[_0x95bc('0x3b')][_0x95bc('0xb3')]){_0x30bd24[_0x95bc('0xb4')]=[{'all':!![]}];}_0x30bd24=_['merge']({},_0x30bd24,_0x36843e[_0x95bc('0xb5')]);return db[_0x95bc('0x35')][_0x95bc('0x5b')](_0x30bd24)[_0x95bc('0x26')](handleEntityNotFound(_0x2ed34e,null))[_0x95bc('0x26')](respondWithResult(_0x2ed34e,null))[_0x95bc('0x33')](handleError(_0x2ed34e,null));};exports[_0x95bc('0xb6')]=function(_0x2de13e,_0x2872ab){return db[_0x95bc('0x35')][_0x95bc('0xb6')](_0x2de13e['body'],{})[_0x95bc('0x26')](respondWithResult(_0x2872ab,0xc9))['catch'](handleError(_0x2872ab,null));};exports['update']=function(_0x32364f,_0x7823dc){if(_0x32364f[_0x95bc('0x71')]['id']){delete _0x32364f[_0x95bc('0x71')]['id'];}return db[_0x95bc('0x35')][_0x95bc('0x5b')]({'where':{'id':_0x32364f['params']['id']}})['then'](handleEntityNotFound(_0x7823dc,null))[_0x95bc('0x26')](saveUpdates(_0x32364f[_0x95bc('0x71')],null))['then'](respondWithResult(_0x7823dc,null))[_0x95bc('0x33')](handleError(_0x7823dc,null));};exports[_0x95bc('0x27')]=function(_0x23818e,_0x5b3829){return db[_0x95bc('0x35')][_0x95bc('0x5b')]({'where':{'id':_0x23818e[_0x95bc('0xb2')]['id']}})[_0x95bc('0x26')](handleEntityNotFound(_0x5b3829,null))[_0x95bc('0x26')](removeEntity(_0x5b3829,null))['catch'](handleError(_0x5b3829,null));};exports[_0x95bc('0xb7')]=function(_0x5ef14a,_0x2756bf){return db[_0x95bc('0x35')]['describe']()[_0x95bc('0x26')](respondWithResult(_0x2756bf,null))[_0x95bc('0x33')](handleError(_0x2756bf,null));};exports[_0x95bc('0xb8')]=function(_0x39b17e,_0x29ad60,_0x5ed8c3){return db[_0x95bc('0xb9')][_0x95bc('0x5b')]({'where':{'id':_0x39b17e[_0x95bc('0xb2')]['id']}})[_0x95bc('0x26')](handleEntityNotFound(_0x29ad60,null))[_0x95bc('0x26')](function(_0x15f9a6){if(_0x15f9a6){return _0x15f9a6['addMessage'](_0x39b17e[_0x95bc('0x71')][_0x95bc('0xba')],_[_0x95bc('0xbb')](_0x39b17e[_0x95bc('0x71')],[_0x95bc('0xba'),'id'])||{});}})[_0x95bc('0x26')](respondWithResult(_0x29ad60,null))['catch'](handleError(_0x29ad60,null));};exports[_0x95bc('0xbc')]=function(_0x1ea394,_0x320ca0,_0x430d30){var _0x4ab6c3={'raw':![],'where':{}};var _0x23dcd7={};var _0x51483e={'count':0x0,'rows':[]};return db['SmsInteraction']['findOne']({'where':{'id':_0x1ea394['params']['id']}})[_0x95bc('0x26')](handleEntityNotFound(_0x320ca0,null))[_0x95bc('0x26')](function(_0x53990e){if(_0x53990e){_0x23dcd7['model']=_['keys'](db['SmsMessage']['rawAttributes']);_0x23dcd7[_0x95bc('0x3b')]=_[_0x95bc('0x3c')](_0x1ea394[_0x95bc('0x3b')]);_0x23dcd7[_0x95bc('0x3d')]=_[_0x95bc('0x3e')](_0x23dcd7[_0x95bc('0x3a')],_0x23dcd7[_0x95bc('0x3b')]);_0x4ab6c3['attributes']=_[_0x95bc('0x3e')](_0x23dcd7[_0x95bc('0x3a')],qs[_0x95bc('0x40')](_0x1ea394['query'][_0x95bc('0x40')]));_0x4ab6c3[_0x95bc('0x3f')]=_0x4ab6c3[_0x95bc('0x3f')][_0x95bc('0x41')]?_0x4ab6c3[_0x95bc('0x3f')]:_0x23dcd7[_0x95bc('0x3a')];if(!_0x1ea394['query'][_0x95bc('0xbd')]('nolimit')){_0x4ab6c3['limit']=qs[_0x95bc('0x21')](_0x1ea394[_0x95bc('0x3b')]['limit']);_0x4ab6c3[_0x95bc('0x1e')]=qs[_0x95bc('0x1e')](_0x1ea394[_0x95bc('0x3b')][_0x95bc('0x1e')]);}_0x4ab6c3[_0x95bc('0x43')]=qs[_0x95bc('0x44')](_0x1ea394[_0x95bc('0x3b')]['sort']);_0x4ab6c3[_0x95bc('0x45')]=qs['filters'](_[_0x95bc('0x46')](_0x1ea394[_0x95bc('0x3b')],_0x23dcd7[_0x95bc('0x3d')]));_0x4ab6c3['where'][_0x95bc('0xaf')]=_0x53990e['id'];if(_0x1ea394[_0x95bc('0x3b')][_0x95bc('0x82')]){_0x4ab6c3[_0x95bc('0x45')]=_['merge'](_0x4ab6c3['where'],{'$or':_[_0x95bc('0x34')](_0x4ab6c3[_0x95bc('0x3f')],function(_0x14f809){var _0x16cdf2={};_0x16cdf2[_0x14f809]={'$like':'%'+_0x1ea394['query'][_0x95bc('0x82')]+'%'};return _0x16cdf2;})});}if(_0x1ea394[_0x95bc('0x3b')]['$gte']){var _0x175e99=_0x1ea394[_0x95bc('0x3b')][_0x95bc('0x79')][_0x95bc('0x30')](',');var _0x5d525f={};_0x5d525f[_0x175e99[0x0]]={'$gte':moment(_0x175e99[0x1])[_0x95bc('0xbe')](_0x95bc('0xbf'))};_0x4ab6c3[_0x95bc('0x45')]=_[_0x95bc('0x9b')](_0x4ab6c3[_0x95bc('0x45')],_0x5d525f);}_0x4ab6c3=_[_0x95bc('0x9b')]({},_0x4ab6c3,_0x1ea394['options']);return db[_0x95bc('0xb9')][_0x95bc('0x20')]({'where':_0x4ab6c3[_0x95bc('0x45')]})[_0x95bc('0x26')](function(_0x569226){_0x51483e[_0x95bc('0x20')]=_0x569226;if(_0x1ea394[_0x95bc('0x3b')]['includeAll']){_0x4ab6c3['include']=[{'all':!![]}];}return db[_0x95bc('0xb9')]['findAll'](_0x4ab6c3);})['then'](function(_0x5357f0){_0x51483e['rows']=_0x5357f0;return _0x51483e;});}})[_0x95bc('0x26')](respondWithFilteredResult(_0x320ca0,_0x4ab6c3))[_0x95bc('0x33')](handleError(_0x320ca0,null));};exports['addTags']=function(_0x4a31fe,_0x2daf63,_0x5d101e){return db[_0x95bc('0x35')][_0x95bc('0x5b')]({'where':{'id':_0x4a31fe['params']['id']}})[_0x95bc('0x26')](handleEntityNotFound(_0x2daf63,null))[_0x95bc('0x26')](function(_0x3ce2bd){if(_0x3ce2bd){return _0x3ce2bd['setTags'](_0x4a31fe[_0x95bc('0x71')]['ids'],_[_0x95bc('0xbb')](_0x4a31fe['body'],['ids','id'])||{})[_0x95bc('0xc0')](function(){return db['Tag'][_0x95bc('0xc1')]({'attributes':['id',_0x95bc('0x2b'),'color'],'where':{'id':_0x4a31fe[_0x95bc('0x71')]['ids']}});})[_0x95bc('0x26')](function(_0x302490){socket[_0x95bc('0xc2')](_0x95bc('0xc3'),{'id':Number(_0x4a31fe[_0x95bc('0xb2')]['id']),'tags':_0x302490||[]});return{'id':Number(_0x4a31fe[_0x95bc('0xb2')]['id']),'tags':_0x302490||[]};});}})['then'](respondWithResult(_0x2daf63,null))[_0x95bc('0x33')](handleError(_0x2daf63,null));};exports[_0x95bc('0xc4')]=function(_0x8c0b5c,_0x4f81f1,_0x1dcd4e){return db[_0x95bc('0x35')][_0x95bc('0x5b')]({'where':{'id':_0x8c0b5c['params']['id']}})[_0x95bc('0x26')](handleEntityNotFound(_0x4f81f1,null))['then'](function(_0x28f86a){if(_0x28f86a){return _0x28f86a[_0x95bc('0xc4')](_0x8c0b5c['query'][_0x95bc('0xba')]);}})[_0x95bc('0x26')](respondWithStatusCode(_0x4f81f1,null))[_0x95bc('0x33')](handleError(_0x4f81f1,null));};exports['download']=function(_0x559dc7,_0x2a86ba){var _0x504859=moment()[_0x95bc('0xc5')]()['toString']();var _0x2ef1aa=path['join'](config[_0x95bc('0xc6')],_0x95bc('0xc7'),_0x95bc('0xc8'),_0x95bc('0xc9'));var _0x581070=path[_0x95bc('0xca')](config['root'],'server',_0x95bc('0xc8'),'attachments');var _0x5854b2=path[_0x95bc('0xca')](_0x2ef1aa,_0x504859);var _0x4692b0=util['format']('transcript-%d-%s.zip',_0x559dc7['params']['id'],_0x504859);var _0x14fcfc=path[_0x95bc('0xca')](_0x2ef1aa,_0x4692b0);var _0x18005b=[];_0x18005b[_0x95bc('0x32')]({'model':db[_0x95bc('0x6e')],'as':_0x95bc('0x6e'),'attributes':['id',_0x95bc('0x2e')],'raw':!![]});_0x18005b['push']({'model':db[_0x95bc('0xcb')],'as':_0x95bc('0x61'),'attributes':['id',_0x95bc('0xcc'),_0x95bc('0xcd')],'raw':!![]});var _0x5c0869=[{'model':db[_0x95bc('0xb9')],'as':'Messages','attributes':['id','body',_0x95bc('0x77'),_0x95bc('0xce'),'secret',_0x95bc('0x7d')],'include':_0x18005b}];_0x5c0869['push']({'model':db[_0x95bc('0xcf')],'as':'Account','attributes':['id',_0x95bc('0x2b')]});_0x5c0869[_0x95bc('0x32')]({'model':db['User'],'as':_0x95bc('0xd0'),'attributes':['id',_0x95bc('0x2e')]});return db[_0x95bc('0x35')][_0x95bc('0x5b')]({'where':{'id':_0x559dc7[_0x95bc('0xb2')]['id']},'include':_0x5c0869})[_0x95bc('0x26')](handleEntityNotFound(_0x2a86ba,null))['then'](function(_0x24dd26){if(_0x24dd26){var _0x1d9995=_0x24dd26[_0x95bc('0xd1')]({'plain':!![]});fs['mkdirSync'](_0x5854b2);var _0x1b12aa={'channel':_0x95bc('0xd2'),'account':_0x1d9995[_0x95bc('0xd3')][_0x95bc('0x2b')],'agent':_0x1d9995[_0x95bc('0xd0')]?_0x1d9995[_0x95bc('0xd0')]['fullname']:'N.A.','createdAt':moment(_0x1d9995['createdAt'])[_0x95bc('0xbe')](_0x95bc('0xbf'))[_0x95bc('0x99')](),'closedAt':_0x1d9995[_0x95bc('0xd4')]?moment(_0x1d9995[_0x95bc('0xd5')])['format'](_0x95bc('0xbf'))[_0x95bc('0x99')]():'','disposition':_0x1d9995[_0x95bc('0xd6')],'messages':_(_0x1d9995[_0x95bc('0xd7')])[_0x95bc('0x82')]({'secret':![]})['map'](function(_0x40f44e){return{'date':moment(_0x40f44e[_0x95bc('0x77')])['format'](_0x95bc('0xbf'))[_0x95bc('0x99')](),'sender':_0x40f44e['direction']===_0x95bc('0xd8')?_0x40f44e[_0x95bc('0x6e')]?_0x40f44e['User'][_0x95bc('0x2e')]:_0x95bc('0xd9'):_0x40f44e['Contact'][_0x95bc('0xcc')]+(_0x40f44e['Contact'][_0x95bc('0xcd')]?'\x20'+_0x40f44e['Contact'][_0x95bc('0xcd')]:''),'body':_0x40f44e[_0x95bc('0x71')],'direction':_0x40f44e[_0x95bc('0xce')]===_0x95bc('0xd8')?'A':'C','secret':_0x40f44e[_0x95bc('0xda')],'read':_0x40f44e[_0x95bc('0x7d')]};})[_0x95bc('0x5d')]()};return ejs['renderFile'](path[_0x95bc('0xca')](config[_0x95bc('0xc6')],_0x95bc('0xc7'),_0x95bc('0xdb'),_0x95bc('0xdc')),{'interaction':_0x1b12aa})[_0x95bc('0x26')](function(_0x318975){var _0x3a5790=path[_0x95bc('0xca')](_0x5854b2,_0x95bc('0xdd')+_0x1d9995['id']+'-'+_0x504859+'.pdf');var _0x39996e={'path':_0x3a5790,'channel':_0x95bc('0xd2'),'interactionId':_0x1d9995['id']};return pdf[_0x95bc('0xde')](_0x318975,_0x39996e);})[_0x95bc('0x26')](function(){return new BPromise(function(_0x175908,_0x2d42d3){zipdir(_0x5854b2,{'saveTo':_0x14fcfc},function(_0x172142,_0x5bab65){if(_0x172142)return _0x2d42d3(_0x172142);return _0x175908(_0x5bab65);});})['then'](function(){return new BPromise(function(_0xb1d732,_0x306927){rimraf(_0x5854b2,function(_0x2d5ea9){if(_0x2d5ea9)_0x306927(_0x2d5ea9);return _0xb1d732();});});})[_0x95bc('0x26')](function(){return _0x2a86ba[_0x95bc('0xdf')](_0x14fcfc,_0x4692b0,function(_0xc40499){if(_0xc40499){console['log']('err',_0xc40499);}else{fs[_0x95bc('0xe0')](_0x14fcfc);}});});});}else{return _0x2a86ba[_0x95bc('0x28')](0xc8);}})['catch'](handleError(_0x2a86ba,null));}; \ No newline at end of file +var _0x352e=['sort','pick','select','field','color','from','tools_tags','u.id','u.fullname','ui.SmsInteractionId','user_has_sms_interactions','left_join','u.id\x20=\x20ui.UserId','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','users','o.id\x20=\x20i.UserId','sms_accounts','a.id\x20=\x20i.SmsAccountId','sms_messages','me.SmsInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','parseSearch','search','sqlOperator','conditions','find','unreadMessages','value','having','`\x20>\x200','Contact','operator','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','start','Tag','union','$substring','UserId','body','some','compact','SmsAccountId','where','i.SmsAccountId\x20IN\x20?','createdAt','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','group','i.id','Sequelize','QueryTypes','SELECT','clone','order','contactName','DESC','isEmpty','t.id\x20IN\x20?','resolve','i.SmsAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getSmsAccounts','i.SmsAccountId\x20IS\x20NULL','toString','count','keyBy','merge','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','SmsInteractionId','all','rows','show','SmsInteraction','rawAttributes','includeAll','include','options','create','params','describe','SmsMessage','ids','omit','getMessages','findOne','$gte','format','YYYY-MM-DD\x20HH:mm:ss','findAll','addTags','setTags','spread','emit','smsInteractionTags:save','removeTags','unix','join','root','server','files','attachments','transcript-%d-%s.zip','User','CmContact','firstName','lastName','direction','read','SmsAccount','Account','Owner','fullname','get','mkdirSync','Sms','closed','closedAt','disposition','Messages','out','System','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','download','log','err','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsInteraction.socket','register','sendStatus','status','end','json','limit','undefined','offset','set','Content-Range','apply','save','update','then','error','stack','name','Users','TagIds','Tags','split','forEach','push','catch','index','map','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit'];(function(_0xa05c60,_0x4e1a83){var _0x512da3=function(_0x35b305){while(--_0x35b305){_0xa05c60['push'](_0xa05c60['shift']());}};_0x512da3(++_0x4e1a83);}(_0x352e,0x1a6));var _0xe352=function(_0x3f9ed6,_0x455440){_0x3f9ed6=_0x3f9ed6-0x0;var _0x23eb5e=_0x352e[_0x3f9ed6];return _0x23eb5e;};'use strict';var emlformat=require(_0xe352('0x0'));var rimraf=require(_0xe352('0x1'));var zipdir=require(_0xe352('0x2'));var jsonpatch=require(_0xe352('0x3'));var rp=require(_0xe352('0x4'));var moment=require(_0xe352('0x5'));var BPromise=require(_0xe352('0x6'));var Mustache=require(_0xe352('0x7'));var util=require('util');var path=require(_0xe352('0x8'));var sox=require(_0xe352('0x9'));var csv=require('to-csv');var ejs=require(_0xe352('0xa'));var fs=require('fs');var fs_extra=require(_0xe352('0xb'));var _=require(_0xe352('0xc'));var squel=require(_0xe352('0xd'));var crypto=require('crypto');var jsforce=require(_0xe352('0xe'));var deskjs=require(_0xe352('0xf'));var toCsv=require(_0xe352('0x10'));var querystring=require(_0xe352('0x11'));var Papa=require('papaparse');var Redis=require(_0xe352('0x12'));var authService=require(_0xe352('0x13'));var qs=require(_0xe352('0x14'));var as=require(_0xe352('0x15'));var pdf=require(_0xe352('0x16'));var hardwareService=require(_0xe352('0x17'));var logger=require('../../config/logger')('api');var utils=require(_0xe352('0x18'));var config=require(_0xe352('0x19'));var licenseUtil=require(_0xe352('0x1a'));var db=require(_0xe352('0x1b'))['db'];config[_0xe352('0x1c')]=_[_0xe352('0x1d')](config['redis'],{'host':_0xe352('0x1e'),'port':0x18eb});var socket=require(_0xe352('0x1f'))(new Redis(config['redis']));require(_0xe352('0x20'))[_0xe352('0x21')](socket);function respondWithStatusCode(_0x56afa0,_0x3d8c66){_0x3d8c66=_0x3d8c66||0xcc;return function(_0x2e8845){if(_0x2e8845){return _0x56afa0[_0xe352('0x22')](_0x3d8c66);}return _0x56afa0[_0xe352('0x23')](_0x3d8c66)[_0xe352('0x24')]();};}function respondWithResult(_0xa00062,_0x31e417){_0x31e417=_0x31e417||0xc8;return function(_0x1fede5){if(_0x1fede5){return _0xa00062['status'](_0x31e417)[_0xe352('0x25')](_0x1fede5);}};}function respondWithFilteredResult(_0x5c1967,_0x5b969a){return function(_0x413f08){if(_0x413f08){var _0x4472a9=typeof _0x5b969a['offset']==='undefined'&&typeof _0x5b969a[_0xe352('0x26')]===_0xe352('0x27');var _0x759b6=_0x413f08['count'];var _0x2687c4=_0x4472a9?0x0:_0x5b969a[_0xe352('0x28')];var _0xa70d53=_0x4472a9?_0x413f08['count']:_0x5b969a['offset']+_0x5b969a[_0xe352('0x26')];var _0x39961f;if(_0xa70d53>=_0x759b6){_0xa70d53=_0x759b6;_0x39961f=0xc8;}else{_0x39961f=0xce;}_0x5c1967[_0xe352('0x23')](_0x39961f);return _0x5c1967[_0xe352('0x29')](_0xe352('0x2a'),_0x2687c4+'-'+_0xa70d53+'/'+_0x759b6)['json'](_0x413f08);}return null;};}function patchUpdates(_0x295529){return function(_0x30e8f0){try{jsonpatch[_0xe352('0x2b')](_0x30e8f0,_0x295529,!![]);}catch(_0x3b23ce){return BPromise['reject'](_0x3b23ce);}return _0x30e8f0[_0xe352('0x2c')]();};}function saveUpdates(_0x53cf17,_0x3cc4f7){return function(_0x55ff39){if(_0x55ff39){return _0x55ff39[_0xe352('0x2d')](_0x53cf17)[_0xe352('0x2e')](function(_0x41e235){return _0x41e235;});}return null;};}function removeEntity(_0x1b1245,_0x319aca){return function(_0x2bc93f){if(_0x2bc93f){return _0x2bc93f['destroy']()['then'](function(){_0x1b1245['status'](0xcc)[_0xe352('0x24')]();});}};}function handleEntityNotFound(_0x55347e,_0x37f1cf){return function(_0x168327){if(!_0x168327){_0x55347e[_0xe352('0x22')](0x194);}return _0x168327;};}function handleError(_0x252eab,_0x30028b){_0x30028b=_0x30028b||0x1f4;return function(_0xd3c70a){logger[_0xe352('0x2f')](_0xd3c70a[_0xe352('0x30')]);if(_0xd3c70a[_0xe352('0x31')]){delete _0xd3c70a[_0xe352('0x31')];}_0x252eab[_0xe352('0x23')](_0x30028b)['send'](_0xd3c70a);};}function getInteractionUsers(_0x43d174,_0x4b48b5){return new BPromise(function(_0x584fb3,_0x3fc7ac){try{if(_0x4b48b5[_0x43d174['id']]){_0x43d174[_0xe352('0x32')]=_['map'](_0x4b48b5[_0x43d174['id']],function(_0x499d5b){return{'id':_0x499d5b['id'],'fullname':_0x499d5b['fullname']};});}}catch(_0x5d8533){_0x3fc7ac(_0x5d8533);}_0x584fb3(_0x43d174);});}function getInteractionTags(_0x125ae5,_0x144d2c){return new BPromise(function(_0x739f4a,_0x157576){try{if(_0x125ae5[_0xe352('0x33')]){_0x125ae5[_0xe352('0x34')]=[];_0x125ae5['TagIds'][_0xe352('0x35')](',')[_0xe352('0x36')](function(_0x343d5d){_0x125ae5[_0xe352('0x34')][_0xe352('0x37')](_0x144d2c[_0x343d5d]);});}delete _0x125ae5[_0xe352('0x33')];}catch(_0x507f50){_0x157576(_0x507f50);}_0x739f4a(_0x125ae5);});}function updateSmsInteraction(_0x2c2f04,_0x551f3e,_0x3445ee){return new BPromise(function(_0xd73099,_0x5538e7){return getInteractionUsers(_0x2c2f04,_0x3445ee)['then'](function(_0xf88f5b){return getInteractionTags(_0xf88f5b,_0x551f3e);})['then'](function(_0x13aef5){_0xd73099(_0x13aef5);})[_0xe352('0x38')](function(_0x29a280){_0x5538e7(_0x29a280);});});}exports[_0xe352('0x39')]=function(_0x3e74aa,_0xe5aa6d){var _0x5e56e0={},_0x3d173a={},_0x54b6da={'count':0x0,'rows':[]};var _0x27852d=_[_0xe352('0x3a')](db['SmsInteraction']['rawAttributes'],function(_0x842408){return{'name':_0x842408[_0xe352('0x3b')],'type':_0x842408[_0xe352('0x3c')][_0xe352('0x3d')]};});_0x3d173a[_0xe352('0x3e')]=_[_0xe352('0x3a')](_0x27852d,'name');_0x3d173a[_0xe352('0x3f')]=_[_0xe352('0x40')](_0x3e74aa[_0xe352('0x3f')]);_0x3d173a[_0xe352('0x41')]=_[_0xe352('0x42')](_0x3d173a[_0xe352('0x3e')],_0x3d173a[_0xe352('0x3f')]);_0x5e56e0[_0xe352('0x43')]=_[_0xe352('0x42')](_0x3d173a[_0xe352('0x3e')],qs[_0xe352('0x44')](_0x3e74aa[_0xe352('0x3f')]['fields']));_0x5e56e0[_0xe352('0x43')]=_0x5e56e0[_0xe352('0x43')][_0xe352('0x45')]?_0x5e56e0[_0xe352('0x43')]:_0x3d173a[_0xe352('0x3e')];if(!_0x3e74aa['query'][_0xe352('0x46')](_0xe352('0x47'))){_0x5e56e0[_0xe352('0x26')]=qs[_0xe352('0x26')](_0x3e74aa[_0xe352('0x3f')][_0xe352('0x26')]);_0x5e56e0['offset']=qs[_0xe352('0x28')](_0x3e74aa['query'][_0xe352('0x28')]);}_0x5e56e0['order']=qs[_0xe352('0x48')](_0x3e74aa[_0xe352('0x3f')][_0xe352('0x48')]);_0x5e56e0['where']=qs['filters'](_[_0xe352('0x49')](_0x3e74aa[_0xe352('0x3f')],_0x3d173a['filters']),_0x27852d);var _0xb4658c=[];var _0x252a22=squel[_0xe352('0x4a')]()[_0xe352('0x4b')]('id')[_0xe352('0x4b')]('name')['field'](_0xe352('0x4c'))[_0xe352('0x4d')](_0xe352('0x4e'));var _0x426b80=squel[_0xe352('0x4a')]()[_0xe352('0x4b')](_0xe352('0x4f'))[_0xe352('0x4b')](_0xe352('0x50'))['field'](_0xe352('0x51'))['from'](_0xe352('0x52'),'ui')[_0xe352('0x53')]('users','u',_0xe352('0x54'));var _0x105ec9=squel[_0xe352('0x4a')]()[_0xe352('0x4d')]('sms_interactions','i')[_0xe352('0x53')](_0xe352('0x55'),'c',_0xe352('0x56'))['left_join'](_0xe352('0x57'),'o',_0xe352('0x58'))[_0xe352('0x53')](_0xe352('0x59'),'a',_0xe352('0x5a'))[_0xe352('0x53')](_0xe352('0x5b'),'me',_0xe352('0x5c'))[_0xe352('0x53')]('sms_interaction_has_tags','it','it.SmsInteractionId\x20=\x20i.id')[_0xe352('0x53')](_0xe352('0x4e'),'t',_0xe352('0x5d'));var _0x1389ce=squel[_0xe352('0x5e')]();var _0xe7f8b9=[];var _0x42a452=squel[_0xe352('0x5e')]();var _0x4fbc22;if(_0x3e74aa[_0xe352('0x3f')]['search']){_0x4fbc22=as[_0xe352('0x5f')](_0x3e74aa[_0xe352('0x3f')][_0xe352('0x60')]);var _0x1443d9=_0x4fbc22[_0xe352('0x61')];for(var _0xe95c0b=0x0;_0xe95c0b<_0x4fbc22['conditions']['length'];_0xe95c0b++){var _0x3ef23e=_0x4fbc22[_0xe352('0x62')][_0xe95c0b];var _0x4d2380='i';var _0x4020a5=_[_0xe352('0x63')](_0x27852d,['name',_0x3ef23e[_0xe352('0x4b')]]);if(!_0x4020a5){switch(_0x3ef23e[_0xe352('0x4b')]){case _0xe352('0x64'):if(_0x3ef23e[_0xe352('0x65')]==0x1){_0x105ec9[_0xe352('0x66')]('`'+_0x3ef23e[_0xe352('0x4b')]+'`\x20=\x200');}else{_0x105ec9['having']('`'+_0x3ef23e[_0xe352('0x4b')]+_0xe352('0x67'));}break;case _0xe352('0x68'):if(_0x3ef23e[_0xe352('0x69')]==='$substring'){if(_0x3ef23e[_0xe352('0x65')][_0xe352('0x35')]('\x20')['length']>0x1){_0x1389ce[_0x1443d9](_0xe352('0x6a'),qs[_0xe352('0x6b')](_0x3ef23e['value']),null);}else{var _0xed7d57='%'+_0x3ef23e[_0xe352('0x65')]+'%';_0x1389ce[_0x1443d9](_0xe352('0x6c'),_0xed7d57,_0xed7d57,_0xed7d57);}}else{_0x4020a5=_[_0xe352('0x63')](_0x27852d,['name',_0xe352('0x6d')]);_0x3ef23e[_0xe352('0x4b')]=_0xe352('0x6d');_0x4e849e=as[_0xe352('0x6e')](_0x4d2380,_0x4020a5[_0xe352('0x3c')],_0x3ef23e);_0x1389ce[_0x1443d9](_0x4e849e[_0xe352('0x6f')],_0x4e849e[_0xe352('0x65')][_0xe352('0x70')],_0x4e849e['value'][_0xe352('0x24')]);}break;case _0xe352('0x71'):var _0x3d8be7=_0x3ef23e[_0xe352('0x65')][_0xe352('0x35')](',')[_0xe352('0x3a')](function(_0x3f3e36){return Number(_0x3f3e36);});_0x3d8be7[_0xe352('0x36')](function(_0x49f804){_0x42a452['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x49f804+',%');});_0xe7f8b9=_[_0xe352('0x72')](_0xe7f8b9,_0x3d8be7);break;case'User':if(_0x3ef23e['operator']===_0xe352('0x73')){_0x1389ce[_0x1443d9]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x3ef23e['value']+'%',null);}else{_0x4020a5=_[_0xe352('0x63')](_0x27852d,[_0xe352('0x31'),_0xe352('0x74')]);_0x3ef23e[_0xe352('0x4b')]=_0xe352('0x74');_0x4e849e=as[_0xe352('0x6e')](_0x4d2380,_0x4020a5[_0xe352('0x3c')],_0x3ef23e);_0x1389ce[_0x1443d9](_0x4e849e[_0xe352('0x6f')],_0x4e849e[_0xe352('0x65')][_0xe352('0x70')],_0x4e849e[_0xe352('0x65')][_0xe352('0x24')]);}break;case _0xe352('0x75'):_0x4e849e=as[_0xe352('0x6e')]('me',null,_0x3ef23e);_0x1389ce[_0x1443d9](_0x4e849e['text'],_0x4e849e[_0xe352('0x65')][_0xe352('0x70')],_0x4e849e[_0xe352('0x65')][_0xe352('0x24')]);break;}}else{var _0x4e849e=as[_0xe352('0x6e')](_0x4d2380,_0x4020a5['type'],_0x3ef23e);_0x1389ce[_0x1443d9](_0x4e849e['text'],_0x4e849e[_0xe352('0x65')][_0xe352('0x70')],_0x4e849e[_0xe352('0x65')][_0xe352('0x24')]);}}}else{var _0x1903bb=_(_0x3e74aa[_0xe352('0x3f')])[_0xe352('0x40')]()[_0xe352('0x3a')](function(_0x1fb7ef){return _[_0xe352('0x76')](_0x27852d,[_0xe352('0x31'),_0x1fb7ef])?_0x1fb7ef:undefined;})[_0xe352('0x77')]()[_0xe352('0x65')]();if(!_['isEmpty'](_0x1903bb)){_0x1903bb[_0xe352('0x36')](function(_0x2ebdf0){if(_0x2ebdf0===_0xe352('0x78')){_0x105ec9[_0xe352('0x79')](_0xe352('0x7a'),[]['concat'](_0x3e74aa[_0xe352('0x3f')][_0x2ebdf0]));}else if(_0x2ebdf0===_0xe352('0x7b')){var _0x2a03ea=JSON[_0xe352('0x7c')](_0x3e74aa['query'][_0x2ebdf0])['$gte'];var _0x3b1da9=JSON[_0xe352('0x7c')](_0x3e74aa[_0xe352('0x3f')][_0x2ebdf0])[_0xe352('0x7d')];_0x105ec9[_0xe352('0x79')](_0xe352('0x7e'),_0x2a03ea,_0x3b1da9);}else{if(_0x3e74aa[_0xe352('0x3f')][_0x2ebdf0]===_0xe352('0x7f')){_0x105ec9['where']('i.'+_0x2ebdf0+_0xe352('0x80'));}else{_0x105ec9[_0xe352('0x79')]('i.'+_0x2ebdf0+'\x20=\x20?',_0x3e74aa[_0xe352('0x3f')][_0x2ebdf0]);}}});}if(_0x3e74aa[_0xe352('0x3f')]['read']){if(_0x3e74aa['query']['read']==0x1){_0x105ec9[_0xe352('0x66')](_0xe352('0x81'));}else{_0x105ec9[_0xe352('0x66')](_0xe352('0x82'));}}if(_0x3e74aa[_0xe352('0x3f')][_0xe352('0x83')]){_0xe7f8b9=_[_0xe352('0x84')](_0x3e74aa[_0xe352('0x3f')]['tag'])?_0x3e74aa['query'][_0xe352('0x83')]:new Array(_0x3e74aa[_0xe352('0x3f')]['tag']);_0xe7f8b9[_0xe352('0x36')](function(_0xf22f08){_0x42a452['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0xf22f08+',%');});}if(_0x3e74aa['query'][_0xe352('0x85')]){var _0x490792=_0x3e74aa[_0xe352('0x3f')][_0xe352('0x85')][_0xe352('0x86')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0xe352('0x87')](_0x490792)){_0x1389ce['or'](_0xe352('0x88'),_0x490792+'%')['or'](_0xe352('0x89'),_0x490792+'%');}else{_0x1389ce['or'](_0xe352('0x8a'),qs['getFullTextValue'](_0x490792))['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x490792+'%');}}}_0x105ec9[_0xe352('0x79')](_0x1389ce);_0x105ec9[_0xe352('0x8b')](_0xe352('0x8c'));var _0x50596d={'type':db[_0xe352('0x8d')][_0xe352('0x8e')][_0xe352('0x8f')],'raw':!![]};var _0x5432a8=_0x105ec9[_0xe352('0x90')]();_0x5432a8[_0xe352('0x4b')](_0xe352('0x8c'));_0x5432a8[_0xe352('0x4b')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0xe352('0x64'));if(_0x5e56e0[_0xe352('0x91')]){_0x5e56e0[_0xe352('0x91')]['forEach'](function(_0x573be3){var _0x1cfabb=_0x573be3[0x0]===_0xe352('0x92')?_0x573be3[0x0]:'i.'+_0x573be3[0x0];_0x105ec9[_0xe352('0x91')](_0x1cfabb,_0x573be3[0x1]===_0xe352('0x93')?![]:!![]);});}if(!_[_0xe352('0x94')](_0xe7f8b9)){_0x105ec9['having'](_0x42a452);_0x5432a8['where'](_0xe352('0x95'),_0xe7f8b9);}BPromise[_0xe352('0x96')]()[_0xe352('0x2e')](function(){if(!_0x4fbc22){if(_0x3e74aa[_0xe352('0x3f')][_0xe352('0x78')])return;_0x5432a8['where'](_0xe352('0x97'));_0x105ec9['where'](_0xe352('0x97'));return;}if(_0x3e74aa[_0xe352('0x98')][_0xe352('0x99')]!==_0xe352('0x9a'))return;return _0x3e74aa[_0xe352('0x98')][_0xe352('0x9b')]({'attributes':['id'],'raw':!![]})[_0xe352('0x2e')](function(_0x3b6ae1){if(_[_0xe352('0x94')](_0x3b6ae1)){_0x5432a8[_0xe352('0x79')](_0xe352('0x9c'));_0x105ec9[_0xe352('0x79')]('i.SmsAccountId\x20IS\x20NULL');}else{_0x5432a8[_0xe352('0x79')](_0xe352('0x7a'),_['map'](_0x3b6ae1,'id'));_0x105ec9[_0xe352('0x79')]('i.SmsAccountId\x20IN\x20?',_[_0xe352('0x3a')](_0x3b6ae1,'id'));}});})[_0xe352('0x2e')](function(){if(_0x3e74aa[_0xe352('0x98')][_0xe352('0x99')]===_0xe352('0x9a')&&!_0x4fbc22&&!_0x3e74aa[_0xe352('0x3f')][_0xe352('0x78')])return[];return db['sequelize'][_0xe352('0x3f')](_0x5432a8[_0xe352('0x9d')](),_0x50596d);})[_0xe352('0x2e')](function(_0x24427d){_0x54b6da['count']=_0x24427d[_0xe352('0x45')];if(_0x54b6da[_0xe352('0x9e')]===0x0)return[];return db['sequelize'][_0xe352('0x3f')](_0x252a22[_0xe352('0x9d')](),_0x50596d)[_0xe352('0x2e')](function(_0x9883e3){_0xb4658c=_[_0xe352('0x9f')](_0x9883e3,'id');_0x50596d=_[_0xe352('0xa0')](_0x50596d,{'model':db['SmsInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x3e74aa[_0xe352('0x3f')][_0xe352('0x44')]){_0x5e56e0[_0xe352('0x43')][_0xe352('0x36')](function(_0x3096a1){_0x105ec9[_0xe352('0x4b')]('i.'+_0x3096a1);});}else{_0x105ec9[_0xe352('0x4b')](_0xe352('0xa1'),_0xe352('0x64'));_0x105ec9[_0xe352('0x4b')](_0xe352('0xa2'),_0xe352('0xa3'));_0x105ec9[_0xe352('0x4b')](_0xe352('0xa4'),_0xe352('0xa5'));_0x105ec9[_0xe352('0x4b')](_0xe352('0xa6'),'contactName');_0x105ec9[_0xe352('0x4b')](_0xe352('0xa7'));_0x105ec9['field'](_0xe352('0xa8'),_0xe352('0xa9'));_0x105ec9['field'](_0xe352('0xaa'),_0xe352('0xab'));_0x105ec9[_0xe352('0x4b')](_0xe352('0xac'),_0xe352('0xad'));_0x105ec9['field'](_0xe352('0xae'),_0xe352('0xaf'));_0x105ec9[_0xe352('0x4b')]('c.mobile',_0xe352('0xb0'));_0x105ec9['field'](_0xe352('0xb1'),_0xe352('0xb2'));_0x105ec9['field'](_0xe352('0xb3'),_0xe352('0xb4'));_0x105ec9[_0xe352('0x4b')](_0xe352('0xb5'),_0xe352('0xb6'));_0x105ec9[_0xe352('0x4b')](_0xe352('0xb7'),_0xe352('0x33'));}if(_0x5e56e0[_0xe352('0x26')])_0x105ec9[_0xe352('0x26')](_0x5e56e0['limit']);if(_0x5e56e0['offset'])_0x105ec9['offset'](_0x5e56e0[_0xe352('0x28')]);return db['sequelize'][_0xe352('0x3f')](_0x105ec9['toString'](),_0x50596d);})[_0xe352('0x2e')](function(_0x3387f3){if(_0x3387f3[_0xe352('0x45')]>0x0)_0x426b80[_0xe352('0x79')]('ui.SmsInteractionId\x20IN\x20?',_[_0xe352('0x3a')](_0x3387f3,'id'));return db['sequelize'][_0xe352('0x3f')](_0x426b80[_0xe352('0x9d')](),_0x50596d)['then'](function(_0x436df4){var _0x98b65e=_['groupBy'](_0x436df4,_0xe352('0xb8'));var _0x120e72=[];_0x3387f3['forEach'](function(_0xec5917){_0x120e72[_0xe352('0x37')](updateSmsInteraction(_0xec5917,_0xb4658c,_0x98b65e));});return BPromise[_0xe352('0xb9')](_0x120e72);});});})[_0xe352('0x2e')](function(_0x453517){_0x54b6da[_0xe352('0xba')]=_0x453517;return _0x54b6da;})['then'](respondWithFilteredResult(_0xe5aa6d,_0x5e56e0))[_0xe352('0x38')](handleError(_0xe5aa6d,null));};exports[_0xe352('0xbb')]=function(_0x494186,_0x12d9d0){var _0x3e6243={'raw':![],'where':{'id':_0x494186['params']['id']}},_0x306665={};_0x306665[_0xe352('0x3e')]=_[_0xe352('0x40')](db[_0xe352('0xbc')][_0xe352('0xbd')]);_0x306665['query']=_[_0xe352('0x40')](_0x494186[_0xe352('0x3f')]);_0x306665[_0xe352('0x41')]=_[_0xe352('0x42')](_0x306665[_0xe352('0x3e')],_0x306665[_0xe352('0x3f')]);_0x3e6243[_0xe352('0x43')]=_[_0xe352('0x42')](_0x306665[_0xe352('0x3e')],qs[_0xe352('0x44')](_0x494186[_0xe352('0x3f')][_0xe352('0x44')]));_0x3e6243[_0xe352('0x43')]=_0x3e6243['attributes']['length']?_0x3e6243[_0xe352('0x43')]:_0x306665[_0xe352('0x3e')];if(_0x494186[_0xe352('0x3f')][_0xe352('0xbe')]){_0x3e6243[_0xe352('0xbf')]=[{'all':!![]}];}_0x3e6243=_[_0xe352('0xa0')]({},_0x3e6243,_0x494186[_0xe352('0xc0')]);return db[_0xe352('0xbc')][_0xe352('0x63')](_0x3e6243)[_0xe352('0x2e')](handleEntityNotFound(_0x12d9d0,null))[_0xe352('0x2e')](respondWithResult(_0x12d9d0,null))[_0xe352('0x38')](handleError(_0x12d9d0,null));};exports[_0xe352('0xc1')]=function(_0x2c6ffc,_0x123a63){return db[_0xe352('0xbc')][_0xe352('0xc1')](_0x2c6ffc[_0xe352('0x75')],{})[_0xe352('0x2e')](respondWithResult(_0x123a63,0xc9))[_0xe352('0x38')](handleError(_0x123a63,null));};exports['update']=function(_0x38a3c8,_0x2cbcf3){if(_0x38a3c8[_0xe352('0x75')]['id']){delete _0x38a3c8[_0xe352('0x75')]['id'];}return db['SmsInteraction'][_0xe352('0x63')]({'where':{'id':_0x38a3c8[_0xe352('0xc2')]['id']}})[_0xe352('0x2e')](handleEntityNotFound(_0x2cbcf3,null))[_0xe352('0x2e')](saveUpdates(_0x38a3c8[_0xe352('0x75')],null))[_0xe352('0x2e')](respondWithResult(_0x2cbcf3,null))[_0xe352('0x38')](handleError(_0x2cbcf3,null));};exports['destroy']=function(_0x1bbc07,_0xb29dbc){return db[_0xe352('0xbc')]['find']({'where':{'id':_0x1bbc07[_0xe352('0xc2')]['id']}})[_0xe352('0x2e')](handleEntityNotFound(_0xb29dbc,null))[_0xe352('0x2e')](removeEntity(_0xb29dbc,null))['catch'](handleError(_0xb29dbc,null));};exports[_0xe352('0xc3')]=function(_0x68513d,_0x31647f){return db[_0xe352('0xbc')]['describe']()[_0xe352('0x2e')](respondWithResult(_0x31647f,null))['catch'](handleError(_0x31647f,null));};exports['addMessage']=function(_0x217fda,_0xde1b77,_0x5698f8){return db[_0xe352('0xc4')][_0xe352('0x63')]({'where':{'id':_0x217fda[_0xe352('0xc2')]['id']}})[_0xe352('0x2e')](handleEntityNotFound(_0xde1b77,null))[_0xe352('0x2e')](function(_0x37f580){if(_0x37f580){return _0x37f580['addMessage'](_0x217fda['body'][_0xe352('0xc5')],_[_0xe352('0xc6')](_0x217fda[_0xe352('0x75')],[_0xe352('0xc5'),'id'])||{});}})['then'](respondWithResult(_0xde1b77,null))[_0xe352('0x38')](handleError(_0xde1b77,null));};exports[_0xe352('0xc7')]=function(_0x41e282,_0x53e29d,_0x576336){var _0xd72038={'raw':![],'where':{}};var _0x4c092b={};var _0x5ca702={'count':0x0,'rows':[]};return db['SmsInteraction'][_0xe352('0xc8')]({'where':{'id':_0x41e282[_0xe352('0xc2')]['id']}})[_0xe352('0x2e')](handleEntityNotFound(_0x53e29d,null))[_0xe352('0x2e')](function(_0x587bc6){if(_0x587bc6){_0x4c092b['model']=_[_0xe352('0x40')](db[_0xe352('0xc4')][_0xe352('0xbd')]);_0x4c092b[_0xe352('0x3f')]=_['keys'](_0x41e282[_0xe352('0x3f')]);_0x4c092b[_0xe352('0x41')]=_['intersection'](_0x4c092b['model'],_0x4c092b['query']);_0xd72038[_0xe352('0x43')]=_['intersection'](_0x4c092b[_0xe352('0x3e')],qs[_0xe352('0x44')](_0x41e282[_0xe352('0x3f')][_0xe352('0x44')]));_0xd72038['attributes']=_0xd72038[_0xe352('0x43')][_0xe352('0x45')]?_0xd72038[_0xe352('0x43')]:_0x4c092b[_0xe352('0x3e')];if(!_0x41e282[_0xe352('0x3f')]['hasOwnProperty'](_0xe352('0x47'))){_0xd72038['limit']=qs[_0xe352('0x26')](_0x41e282[_0xe352('0x3f')][_0xe352('0x26')]);_0xd72038[_0xe352('0x28')]=qs[_0xe352('0x28')](_0x41e282[_0xe352('0x3f')][_0xe352('0x28')]);}_0xd72038['order']=qs[_0xe352('0x48')](_0x41e282[_0xe352('0x3f')]['sort']);_0xd72038[_0xe352('0x79')]=qs[_0xe352('0x41')](_['pick'](_0x41e282['query'],_0x4c092b[_0xe352('0x41')]));_0xd72038[_0xe352('0x79')][_0xe352('0xb8')]=_0x587bc6['id'];if(_0x41e282['query'][_0xe352('0x85')]){_0xd72038[_0xe352('0x79')]=_['merge'](_0xd72038[_0xe352('0x79')],{'$or':_[_0xe352('0x3a')](_0xd72038[_0xe352('0x43')],function(_0x122eb3){var _0x10f1f4={};_0x10f1f4[_0x122eb3]={'$like':'%'+_0x41e282[_0xe352('0x3f')][_0xe352('0x85')]+'%'};return _0x10f1f4;})});}if(_0x41e282['query'][_0xe352('0xc9')]){var _0x1ae830=_0x41e282[_0xe352('0x3f')][_0xe352('0xc9')][_0xe352('0x35')](',');var _0x45a1f2={};_0x45a1f2[_0x1ae830[0x0]]={'$gte':moment(_0x1ae830[0x1])[_0xe352('0xca')](_0xe352('0xcb'))};_0xd72038[_0xe352('0x79')]=_[_0xe352('0xa0')](_0xd72038[_0xe352('0x79')],_0x45a1f2);}_0xd72038=_[_0xe352('0xa0')]({},_0xd72038,_0x41e282['options']);return db[_0xe352('0xc4')][_0xe352('0x9e')]({'where':_0xd72038[_0xe352('0x79')]})[_0xe352('0x2e')](function(_0x4dd357){_0x5ca702[_0xe352('0x9e')]=_0x4dd357;if(_0x41e282['query']['includeAll']){_0xd72038[_0xe352('0xbf')]=[{'all':!![]}];}return db[_0xe352('0xc4')][_0xe352('0xcc')](_0xd72038);})['then'](function(_0x5afd1f){_0x5ca702[_0xe352('0xba')]=_0x5afd1f;return _0x5ca702;});}})[_0xe352('0x2e')](respondWithFilteredResult(_0x53e29d,_0xd72038))['catch'](handleError(_0x53e29d,null));};exports[_0xe352('0xcd')]=function(_0x2be0c8,_0x242318,_0x386272){return db[_0xe352('0xbc')][_0xe352('0x63')]({'where':{'id':_0x2be0c8[_0xe352('0xc2')]['id']}})[_0xe352('0x2e')](handleEntityNotFound(_0x242318,null))[_0xe352('0x2e')](function(_0x2957ba){if(_0x2957ba){return _0x2957ba[_0xe352('0xce')](_0x2be0c8['body'][_0xe352('0xc5')],_[_0xe352('0xc6')](_0x2be0c8[_0xe352('0x75')],['ids','id'])||{})[_0xe352('0xcf')](function(){return db[_0xe352('0x71')][_0xe352('0xcc')]({'attributes':['id',_0xe352('0x31'),'color'],'where':{'id':_0x2be0c8[_0xe352('0x75')][_0xe352('0xc5')]}});})[_0xe352('0x2e')](function(_0x35c401){socket[_0xe352('0xd0')](_0xe352('0xd1'),{'id':Number(_0x2be0c8['params']['id']),'tags':_0x35c401||[]});return{'id':Number(_0x2be0c8[_0xe352('0xc2')]['id']),'tags':_0x35c401||[]};});}})[_0xe352('0x2e')](respondWithResult(_0x242318,null))[_0xe352('0x38')](handleError(_0x242318,null));};exports[_0xe352('0xd2')]=function(_0x2e8663,_0x1e8edb,_0x1f3bef){return db['SmsInteraction'][_0xe352('0x63')]({'where':{'id':_0x2e8663[_0xe352('0xc2')]['id']}})[_0xe352('0x2e')](handleEntityNotFound(_0x1e8edb,null))[_0xe352('0x2e')](function(_0x25b6e2){if(_0x25b6e2){return _0x25b6e2['removeTags'](_0x2e8663['query'][_0xe352('0xc5')]);}})[_0xe352('0x2e')](respondWithStatusCode(_0x1e8edb,null))[_0xe352('0x38')](handleError(_0x1e8edb,null));};exports['download']=function(_0x448cb5,_0x503748){var _0x56f025=moment()[_0xe352('0xd3')]()['toString']();var _0x379959=path[_0xe352('0xd4')](config[_0xe352('0xd5')],_0xe352('0xd6'),'files','tmp');var _0x5cca6b=path[_0xe352('0xd4')](config[_0xe352('0xd5')],_0xe352('0xd6'),_0xe352('0xd7'),_0xe352('0xd8'));var _0x4aafed=path[_0xe352('0xd4')](_0x379959,_0x56f025);var _0x596de0=util[_0xe352('0xca')](_0xe352('0xd9'),_0x448cb5[_0xe352('0xc2')]['id'],_0x56f025);var _0x4cc879=path[_0xe352('0xd4')](_0x379959,_0x596de0);var _0x5ac868=[];_0x5ac868['push']({'model':db[_0xe352('0xda')],'as':_0xe352('0xda'),'attributes':['id','fullname'],'raw':!![]});_0x5ac868[_0xe352('0x37')]({'model':db[_0xe352('0xdb')],'as':_0xe352('0x68'),'attributes':['id',_0xe352('0xdc'),_0xe352('0xdd')],'raw':!![]});var _0x4e4b22=[{'model':db[_0xe352('0xc4')],'as':'Messages','attributes':['id','body',_0xe352('0x7b'),_0xe352('0xde'),'secret',_0xe352('0xdf')],'include':_0x5ac868}];_0x4e4b22['push']({'model':db[_0xe352('0xe0')],'as':_0xe352('0xe1'),'attributes':['id',_0xe352('0x31')]});_0x4e4b22[_0xe352('0x37')]({'model':db[_0xe352('0xda')],'as':_0xe352('0xe2'),'attributes':['id',_0xe352('0xe3')]});return db[_0xe352('0xbc')]['find']({'where':{'id':_0x448cb5[_0xe352('0xc2')]['id']},'include':_0x4e4b22})[_0xe352('0x2e')](handleEntityNotFound(_0x503748,null))[_0xe352('0x2e')](function(_0x2a2066){if(_0x2a2066){var _0x582935=_0x2a2066[_0xe352('0xe4')]({'plain':!![]});fs[_0xe352('0xe5')](_0x4aafed);var _0x490cb1={'channel':_0xe352('0xe6'),'account':_0x582935[_0xe352('0xe1')][_0xe352('0x31')],'agent':_0x582935[_0xe352('0xe2')]?_0x582935['Owner'][_0xe352('0xe3')]:'N.A.','createdAt':moment(_0x582935[_0xe352('0x7b')])[_0xe352('0xca')](_0xe352('0xcb'))[_0xe352('0x9d')](),'closedAt':_0x582935[_0xe352('0xe7')]?moment(_0x582935[_0xe352('0xe8')])[_0xe352('0xca')]('YYYY-MM-DD\x20HH:mm:ss')[_0xe352('0x9d')]():'','disposition':_0x582935[_0xe352('0xe9')],'messages':_(_0x582935[_0xe352('0xea')])['filter']({'secret':![]})[_0xe352('0x3a')](function(_0xcc5320){return{'date':moment(_0xcc5320['createdAt'])[_0xe352('0xca')]('YYYY-MM-DD\x20HH:mm:ss')[_0xe352('0x9d')](),'sender':_0xcc5320[_0xe352('0xde')]===_0xe352('0xeb')?_0xcc5320[_0xe352('0xda')]?_0xcc5320[_0xe352('0xda')]['fullname']:_0xe352('0xec'):_0xcc5320['Contact'][_0xe352('0xdc')]+(_0xcc5320[_0xe352('0x68')][_0xe352('0xdd')]?'\x20'+_0xcc5320[_0xe352('0x68')][_0xe352('0xdd')]:''),'body':_0xcc5320['body'],'direction':_0xcc5320[_0xe352('0xde')]===_0xe352('0xeb')?'A':'C','secret':_0xcc5320['secret'],'read':_0xcc5320[_0xe352('0xdf')]};})['value']()};return ejs[_0xe352('0xed')](path[_0xe352('0xd4')](config[_0xe352('0xd5')],_0xe352('0xd6'),_0xe352('0xee'),_0xe352('0xef')),{'interaction':_0x490cb1})[_0xe352('0x2e')](function(_0xa225b5){var _0x23a640=path[_0xe352('0xd4')](_0x4aafed,_0xe352('0xf0')+_0x582935['id']+'-'+_0x56f025+_0xe352('0xf1'));var _0x5055f9={'path':_0x23a640,'channel':_0xe352('0xe6'),'interactionId':_0x582935['id']};return pdf[_0xe352('0xf2')](_0xa225b5,_0x5055f9);})[_0xe352('0x2e')](function(){return new BPromise(function(_0x56680d,_0xd492e1){zipdir(_0x4aafed,{'saveTo':_0x4cc879},function(_0x17afb4,_0x31f733){if(_0x17afb4)return _0xd492e1(_0x17afb4);return _0x56680d(_0x31f733);});})[_0xe352('0x2e')](function(){return new BPromise(function(_0x272aee,_0x372425){rimraf(_0x4aafed,function(_0x357cdb){if(_0x357cdb)_0x372425(_0x357cdb);return _0x272aee();});});})[_0xe352('0x2e')](function(){return _0x503748[_0xe352('0xf3')](_0x4cc879,_0x596de0,function(_0x326cc5){if(_0x326cc5){console[_0xe352('0xf4')](_0xe352('0xf5'),_0x326cc5);}else{fs[_0xe352('0xf6')](_0x4cc879);}});});});}else{return _0x503748[_0xe352('0x22')](0xc8);}})[_0xe352('0x38')](handleError(_0x503748,null));}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index f61c683..8aec5bc 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 _0x4cf8=['unreadMessages','length','emit','catch','exports','events','../../mysqldb','SmsInteraction','SmsMessage','setMaxListeners','save','update','remove','then','setDataValue','Users','findAll'];(function(_0x37bbe3,_0x479ae1){var _0x2306f=function(_0x498111){while(--_0x498111){_0x37bbe3['push'](_0x37bbe3['shift']());}};_0x2306f(++_0x479ae1);}(_0x4cf8,0x1e1));var _0x84cf=function(_0x3662b4,_0x503b4d){_0x3662b4=_0x3662b4-0x0;var _0x50928c=_0x4cf8[_0x3662b4];return _0x50928c;};'use strict';var EventEmitter=require(_0x84cf('0x0'));var SmsInteraction=require(_0x84cf('0x1'))['db'][_0x84cf('0x2')];var SmsMessage=require(_0x84cf('0x1'))['db'][_0x84cf('0x3')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0x84cf('0x4')](0x0);var events={'afterCreate':_0x84cf('0x5'),'afterUpdate':_0x84cf('0x6'),'afterDestroy':_0x84cf('0x7')};function emitEvent(_0x2d38c0){return function(_0x5844d7,_0x2c613d,_0x50ade2){_0x5844d7['getUsers']({'attributes':['id'],'raw':!![]})[_0x84cf('0x8')](function(_0x56c5cc){_0x5844d7[_0x84cf('0x9')](_0x84cf('0xa'),_0x56c5cc['map'](function(_0x2e0b79){return{'id':_0x2e0b79['id']};}));return SmsMessage[_0x84cf('0xb')]({'where':{'SmsInteractionId':_0x5844d7['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0xfb5398){_0x5844d7[_0x84cf('0x9')](_0x84cf('0xc'),_0xfb5398[_0x84cf('0xd')]);SmsInteractionEvents['emit'](_0x2d38c0+':'+_0x5844d7['id'],_0x5844d7);SmsInteractionEvents[_0x84cf('0xe')](_0x2d38c0,_0x5844d7);_0x50ade2(null);})[_0x84cf('0xf')](_0x50ade2(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsInteraction['hook'](e,emitEvent(event));}}module[_0x84cf('0x10')]=SmsInteractionEvents; \ No newline at end of file +var _0xfb11=['setMaxListeners','update','getUsers','setDataValue','Users','map','findAll','then','unreadMessages','emit','catch','hook','exports','events','SmsInteraction','../../mysqldb'];(function(_0x5b4c44,_0x2e495e){var _0x58485a=function(_0x13299b){while(--_0x13299b){_0x5b4c44['push'](_0x5b4c44['shift']());}};_0x58485a(++_0x2e495e);}(_0xfb11,0x1ad));var _0x1fb1=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0xfb11[_0xae7c2f];return _0x5d7001;};'use strict';var EventEmitter=require(_0x1fb1('0x0'));var SmsInteraction=require('../../mysqldb')['db'][_0x1fb1('0x1')];var SmsMessage=require(_0x1fb1('0x2'))['db']['SmsMessage'];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0x1fb1('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x1fb1('0x4'),'afterDestroy':'remove'};function emitEvent(_0x190f74){return function(_0x2ae20f,_0x5af469,_0x25d44f){_0x2ae20f[_0x1fb1('0x5')]({'attributes':['id'],'raw':!![]})['then'](function(_0x1859da){_0x2ae20f[_0x1fb1('0x6')](_0x1fb1('0x7'),_0x1859da[_0x1fb1('0x8')](function(_0x161e1b){return{'id':_0x161e1b['id']};}));return SmsMessage[_0x1fb1('0x9')]({'where':{'SmsInteractionId':_0x2ae20f['id'],'direction':'in','read':![]},'raw':!![]});})[_0x1fb1('0xa')](function(_0x416625){_0x2ae20f[_0x1fb1('0x6')](_0x1fb1('0xb'),_0x416625['length']);SmsInteractionEvents[_0x1fb1('0xc')](_0x190f74+':'+_0x2ae20f['id'],_0x2ae20f);SmsInteractionEvents['emit'](_0x190f74,_0x2ae20f);_0x25d44f(null);})[_0x1fb1('0xd')](_0x25d44f(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsInteraction[_0x1fb1('0xe')](e,emitEvent(event));}}module[_0x1fb1('0xf')]=SmsInteractionEvents; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.model.js b/server/api/smsInteraction/smsInteraction.model.js index a95c6a1..b5efc16 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 _0xd2ee=['path','rimraf','exports','define','SmsInteraction','sms_interactions','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x14a5d9,_0x4c2ddf){var _0xff696e=function(_0x1f4b85){while(--_0x1f4b85){_0x14a5d9['push'](_0x14a5d9['shift']());}};_0xff696e(++_0x4c2ddf);}(_0xd2ee,0x1aa));var _0xed2e=function(_0x41f9f0,_0x4691b7){_0x41f9f0=_0x41f9f0-0x0;var _0xaf3571=_0xd2ee[_0x41f9f0];return _0xaf3571;};'use strict';var _=require(_0xed2e('0x0'));var util=require(_0xed2e('0x1'));var logger=require(_0xed2e('0x2'))(_0xed2e('0x3'));var moment=require('moment');var BPromise=require(_0xed2e('0x4'));var rp=require(_0xed2e('0x5'));var fs=require('fs');var path=require(_0xed2e('0x6'));var rimraf=require(_0xed2e('0x7'));var config=require('../../config/environment');var attributes=require('./smsInteraction.attributes');module[_0xed2e('0x8')]=function(_0x356dfa,_0x292a42){return _0x356dfa[_0xed2e('0x9')](_0xed2e('0xa'),attributes,{'tableName':_0xed2e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x5e1d5b,_0x14582e,_0x16721a){if(_0x5e1d5b['changed'](_0xed2e('0xc'))){_0x5e1d5b[_0xed2e('0xd')]=moment()[_0xed2e('0xe')](_0xed2e('0xf'));}_0x16721a(null,_0x5e1d5b);}}});}; \ No newline at end of file +var _0xcfd1=['api','bluebird','request-promise','path','rimraf','../../config/environment','sms_interactions','changed','closed','closedAt','format','lodash','util','../../config/logger'];(function(_0x24c553,_0x533f6f){var _0x2b3671=function(_0x554063){while(--_0x554063){_0x24c553['push'](_0x24c553['shift']());}};_0x2b3671(++_0x533f6f);}(_0xcfd1,0x123));var _0x1cfd=function(_0x2aa22e,_0x69ec01){_0x2aa22e=_0x2aa22e-0x0;var _0x12bc07=_0xcfd1[_0x2aa22e];return _0x12bc07;};'use strict';var _=require(_0x1cfd('0x0'));var util=require(_0x1cfd('0x1'));var logger=require(_0x1cfd('0x2'))(_0x1cfd('0x3'));var moment=require('moment');var BPromise=require(_0x1cfd('0x4'));var rp=require(_0x1cfd('0x5'));var fs=require('fs');var path=require(_0x1cfd('0x6'));var rimraf=require(_0x1cfd('0x7'));var config=require(_0x1cfd('0x8'));var attributes=require('./smsInteraction.attributes');module['exports']=function(_0x18faf9,_0xf3e22){return _0x18faf9['define']('SmsInteraction',attributes,{'tableName':_0x1cfd('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x399780,_0x55a826,_0x18eea0){if(_0x399780[_0x1cfd('0xa')](_0x1cfd('0xb'))){_0x399780[_0x1cfd('0xc')]=moment()[_0x1cfd('0xd')]('YYYY-MM-DD\x20HH:mm:ss');}_0x18eea0(null,_0x399780);}}});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index 6cd39a4..54d9f5f 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 _0xccbb=['SmsInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsInteraction,\x20%s,\x20%s','message','catch','UpdateSmsInteraction','SmsInteraction','update','body','raw','options','where','attributes','AddTagsToSmsInteraction','find','addTags','ids','omit','spread','AddTags','util','moment','bluebird','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','./smsInteraction.socket','register','request','then','info','request\x20sent'];(function(_0x3897d8,_0x429331){var _0x1d518b=function(_0x223137){while(--_0x223137){_0x3897d8['push'](_0x3897d8['shift']());}};_0x1d518b(++_0x429331);}(_0xccbb,0x1ce));var _0xbccb=function(_0x5f405e,_0x4c76e7){_0x5f405e=_0x5f405e-0x0;var _0x437fde=_0xccbb[_0x5f405e];return _0x437fde;};'use strict';var _=require('lodash');var util=require(_0xbccb('0x0'));var moment=require(_0xbccb('0x1'));var BPromise=require(_0xbccb('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbccb('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xbccb('0x4'));var logger=require('../../config/logger')(_0xbccb('0x5'));var config=require(_0xbccb('0x6'));var jayson=require(_0xbccb('0x7'));var client=jayson['client'][_0xbccb('0x8')]({'port':0x232a});config[_0xbccb('0x9')]=_['defaults'](config[_0xbccb('0x9')],{'host':_0xbccb('0xa'),'port':0x18eb});var socket=require(_0xbccb('0xb'))(new Redis(config[_0xbccb('0x9')]));require(_0xbccb('0xc'))[_0xbccb('0xd')](socket);function respondWithRpcPromise(_0x93538d,_0x244e0f,_0x5d3b60){return new BPromise(function(_0x1709dd,_0x59c41c){return client[_0xbccb('0xe')](_0x93538d,_0x5d3b60)[_0xbccb('0xf')](function(_0x239571){logger[_0xbccb('0x10')]('SmsInteraction,\x20%s,\x20%s',_0x244e0f,_0xbccb('0x11'));logger['debug'](_0xbccb('0x12'),_0x244e0f,_0xbccb('0x11'),JSON[_0xbccb('0x13')](_0x239571));if(_0x239571[_0xbccb('0x14')]){if(_0x239571['error'][_0xbccb('0x15')]===0x1f4){logger[_0xbccb('0x14')](_0xbccb('0x16'),_0x244e0f,_0x239571[_0xbccb('0x14')][_0xbccb('0x17')]);return _0x59c41c(_0x239571['error']['message']);}logger[_0xbccb('0x14')](_0xbccb('0x16'),_0x244e0f,_0x239571[_0xbccb('0x14')][_0xbccb('0x17')]);return _0x1709dd(_0x239571[_0xbccb('0x14')]['message']);}else{logger[_0xbccb('0x10')](_0xbccb('0x16'),_0x244e0f,_0xbccb('0x11'));_0x1709dd(_0x239571['result'][_0xbccb('0x17')]);}})[_0xbccb('0x18')](function(_0x452b8e){logger['error'](_0xbccb('0x16'),_0x244e0f,_0x452b8e);_0x59c41c(_0x452b8e);});});}exports[_0xbccb('0x19')]=function(_0xa8796a){var _0x5c6e86=this;return new Promise(function(_0x18e58c,_0x259855){return db[_0xbccb('0x1a')][_0xbccb('0x1b')](_0xa8796a[_0xbccb('0x1c')],{'raw':_0xa8796a['options']?_0xa8796a['options'][_0xbccb('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xa8796a[_0xbccb('0x1e')]?_0xa8796a[_0xbccb('0x1e')][_0xbccb('0x1f')]||null:null,'attributes':_0xa8796a[_0xbccb('0x1e')]?_0xa8796a[_0xbccb('0x1e')][_0xbccb('0x20')]||null:null,'limit':_0xa8796a[_0xbccb('0x1e')]?_0xa8796a[_0xbccb('0x1e')]['limit']||null:null})[_0xbccb('0xf')](function(_0x289869){logger[_0xbccb('0x10')]('UpdateSmsInteraction',_0xa8796a);logger['debug'](_0xbccb('0x19'),_0xa8796a,JSON[_0xbccb('0x13')](_0x289869));_0x18e58c(_0x289869);})[_0xbccb('0x18')](function(_0x368294){logger[_0xbccb('0x14')](_0xbccb('0x19'),_0x368294['message'],_0xa8796a);_0x259855(_0x5c6e86[_0xbccb('0x14')](0x1f4,_0x368294[_0xbccb('0x17')]));});});};exports[_0xbccb('0x21')]=function(_0x41cea3){return new Promise(function(_0x621cd4,_0x2151cc){return db[_0xbccb('0x1a')][_0xbccb('0x22')]({'where':_0x41cea3[_0xbccb('0x1e')]?_0x41cea3['options']['where']||null:null})[_0xbccb('0xf')](function(_0x4c95a1){if(_0x4c95a1){return _0x4c95a1[_0xbccb('0x23')](_0x41cea3[_0xbccb('0x1c')][_0xbccb('0x24')],_[_0xbccb('0x25')](_0x41cea3[_0xbccb('0x1c')],[_0xbccb('0x24'),'id'])||{});}})[_0xbccb('0x26')](function(_0xd7e6fa){logger['info'](_0xbccb('0x27'),_0x41cea3);logger['debug'](_0xbccb('0x27'),_0x41cea3,JSON['stringify'](_0xd7e6fa));_0x621cd4(_0xd7e6fa);})[_0xbccb('0x18')](function(_0x1cae5d){logger['error'](_0xbccb('0x27'),_0x1cae5d[_0xbccb('0x17')],_0x41cea3);_0x2151cc(_this[_0xbccb('0x14')](0x1f4,_0x1cae5d[_0xbccb('0x17')]));});});}; \ No newline at end of file +var _0x18b3=['then','info','SmsInteraction,\x20%s,\x20%s','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','UpdateSmsInteraction','SmsInteraction','update','body','options','where','attributes','limit','AddTagsToSmsInteraction','find','ids','omit','spread','AddTags','lodash','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','redis','defaults','localhost','socket.io-emitter','./smsInteraction.socket','register','request'];(function(_0x25cf75,_0x549314){var _0x26c9f0=function(_0x1465c6){while(--_0x1465c6){_0x25cf75['push'](_0x25cf75['shift']());}};_0x26c9f0(++_0x549314);}(_0x18b3,0x1dc));var _0x318b=function(_0x20e7b2,_0x49d52a){_0x20e7b2=_0x20e7b2-0x0;var _0x4fdda9=_0x18b3[_0x20e7b2];return _0x4fdda9;};'use strict';var _=require(_0x318b('0x0'));var util=require('util');var moment=require(_0x318b('0x1'));var BPromise=require(_0x318b('0x2'));var rs=require(_0x318b('0x3'));var fs=require('fs');var Redis=require(_0x318b('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x318b('0x5'))(_0x318b('0x6'));var config=require(_0x318b('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x318b('0x8')]['http']({'port':0x232a});config[_0x318b('0x9')]=_[_0x318b('0xa')](config[_0x318b('0x9')],{'host':_0x318b('0xb'),'port':0x18eb});var socket=require(_0x318b('0xc'))(new Redis(config[_0x318b('0x9')]));require(_0x318b('0xd'))[_0x318b('0xe')](socket);function respondWithRpcPromise(_0x48afc4,_0x5c1265,_0x5bb66a){return new BPromise(function(_0x401b30,_0x25e338){return client[_0x318b('0xf')](_0x48afc4,_0x5bb66a)[_0x318b('0x10')](function(_0xcea963){logger[_0x318b('0x11')](_0x318b('0x12'),_0x5c1265,'request\x20sent');logger[_0x318b('0x13')](_0x318b('0x14'),_0x5c1265,_0x318b('0x15'),JSON[_0x318b('0x16')](_0xcea963));if(_0xcea963[_0x318b('0x17')]){if(_0xcea963['error']['code']===0x1f4){logger[_0x318b('0x17')](_0x318b('0x12'),_0x5c1265,_0xcea963['error'][_0x318b('0x18')]);return _0x25e338(_0xcea963['error'][_0x318b('0x18')]);}logger['error'](_0x318b('0x12'),_0x5c1265,_0xcea963[_0x318b('0x17')][_0x318b('0x18')]);return _0x401b30(_0xcea963[_0x318b('0x17')][_0x318b('0x18')]);}else{logger[_0x318b('0x11')](_0x318b('0x12'),_0x5c1265,_0x318b('0x15'));_0x401b30(_0xcea963[_0x318b('0x19')][_0x318b('0x18')]);}})[_0x318b('0x1a')](function(_0x38a80f){logger[_0x318b('0x17')](_0x318b('0x12'),_0x5c1265,_0x38a80f);_0x25e338(_0x38a80f);});});}exports[_0x318b('0x1b')]=function(_0x36a910){var _0x588455=this;return new Promise(function(_0x57c1de,_0x5e6b76){return db[_0x318b('0x1c')][_0x318b('0x1d')](_0x36a910[_0x318b('0x1e')],{'raw':_0x36a910[_0x318b('0x1f')]?_0x36a910['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x36a910[_0x318b('0x1f')]?_0x36a910[_0x318b('0x1f')][_0x318b('0x20')]||null:null,'attributes':_0x36a910['options']?_0x36a910['options'][_0x318b('0x21')]||null:null,'limit':_0x36a910[_0x318b('0x1f')]?_0x36a910['options'][_0x318b('0x22')]||null:null})['then'](function(_0x519065){logger[_0x318b('0x11')](_0x318b('0x1b'),_0x36a910);logger[_0x318b('0x13')](_0x318b('0x1b'),_0x36a910,JSON['stringify'](_0x519065));_0x57c1de(_0x519065);})['catch'](function(_0x1cc5fc){logger['error']('UpdateSmsInteraction',_0x1cc5fc[_0x318b('0x18')],_0x36a910);_0x5e6b76(_0x588455[_0x318b('0x17')](0x1f4,_0x1cc5fc[_0x318b('0x18')]));});});};exports[_0x318b('0x23')]=function(_0x2636bd){return new Promise(function(_0x50473b,_0x52d383){return db[_0x318b('0x1c')][_0x318b('0x24')]({'where':_0x2636bd['options']?_0x2636bd[_0x318b('0x1f')]['where']||null:null})[_0x318b('0x10')](function(_0x1c4d6e){if(_0x1c4d6e){return _0x1c4d6e['addTags'](_0x2636bd[_0x318b('0x1e')][_0x318b('0x25')],_[_0x318b('0x26')](_0x2636bd[_0x318b('0x1e')],[_0x318b('0x25'),'id'])||{});}})[_0x318b('0x27')](function(_0x4ab26a){logger[_0x318b('0x11')]('AddTags',_0x2636bd);logger[_0x318b('0x13')](_0x318b('0x28'),_0x2636bd,JSON[_0x318b('0x16')](_0x4ab26a));_0x50473b(_0x4ab26a);})['catch'](function(_0x289697){logger[_0x318b('0x17')](_0x318b('0x28'),_0x289697[_0x318b('0x18')],_0x2636bd);_0x52d383(_this[_0x318b('0x17')](0x1f4,_0x289697[_0x318b('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index 20662c6..23111ad 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 _0xae1c=['save','update','emit','removeListener','register','length','smsInteraction:','./smsInteraction.events'];(function(_0x62a880,_0x76ef7){var _0x1fb0a9=function(_0x4dd6fe){while(--_0x4dd6fe){_0x62a880['push'](_0x62a880['shift']());}};_0x1fb0a9(++_0x76ef7);}(_0xae1c,0x19f));var _0xcae1=function(_0x22ef5d,_0x173f4e){_0x22ef5d=_0x22ef5d-0x0;var _0x3f46f6=_0xae1c[_0x22ef5d];return _0x3f46f6;};'use strict';var SmsInteractionEvents=require(_0xcae1('0x0'));var events=[_0xcae1('0x1'),'remove',_0xcae1('0x2')];function createListener(_0x2dc9bf,_0x49df20){return function(_0x279143){_0x49df20[_0xcae1('0x3')](_0x2dc9bf,_0x279143);};}function removeListener(_0x949a85,_0x119a0d){return function(){SmsInteractionEvents[_0xcae1('0x4')](_0x949a85,_0x119a0d);};}exports[_0xcae1('0x5')]=function(_0x165a36){for(var _0xb89e66=0x0,_0x424c0a=events[_0xcae1('0x6')];_0xb89e66<_0x424c0a;_0xb89e66++){var _0x378b90=events[_0xb89e66];var _0x4e05ac=createListener(_0xcae1('0x7')+_0x378b90,_0x165a36);SmsInteractionEvents['on'](_0x378b90,_0x4e05ac);}}; \ No newline at end of file +var _0xbcf0=['./smsInteraction.events','save','remove','update','emit','removeListener','register'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xbcf0,0xe7));var _0x0bcf=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0xbcf0[_0x31e29a];return _0x32d892;};'use strict';var SmsInteractionEvents=require(_0x0bcf('0x0'));var events=[_0x0bcf('0x1'),_0x0bcf('0x2'),_0x0bcf('0x3')];function createListener(_0xa2bdd9,_0x355e35){return function(_0x5ee637){_0x355e35[_0x0bcf('0x4')](_0xa2bdd9,_0x5ee637);};}function removeListener(_0x5b0897,_0x3ecb7c){return function(){SmsInteractionEvents[_0x0bcf('0x5')](_0x5b0897,_0x3ecb7c);};}exports[_0x0bcf('0x6')]=function(_0x3ae75f){for(var _0xda9b4c=0x0,_0x41e80b=events['length'];_0xda9b4c<_0x41e80b;_0xda9b4c++){var _0x155293=events[_0xda9b4c];var _0x2fcd98=createListener('smsInteraction:'+_0x155293,_0x3ae75f);SmsInteractionEvents['on'](_0x155293,_0x2fcd98);}}; \ No newline at end of file diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index 5c8ba8b..9e41388 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 _0x5fbb=['accept','/:id/reject','delete','destroy','exports','multer','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./smsMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','post','tracked','/:id/status','put','update'];(function(_0x4664db,_0x1de672){var _0x5615b4=function(_0x54fb5a){while(--_0x54fb5a){_0x4664db['push'](_0x4664db['shift']());}};_0x5615b4(++_0x1de672);}(_0x5fbb,0x1ba));var _0xb5fb=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x5fbb[_0x2c91e9];return _0x13f0ff;};'use strict';var multer=require(_0xb5fb('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xb5fb('0x1'));var router=express[_0xb5fb('0x2')]();var fs_extra=require(_0xb5fb('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xb5fb('0x4'));var config=require(_0xb5fb('0x5'));var controller=require(_0xb5fb('0x6'));router[_0xb5fb('0x7')]('/',auth[_0xb5fb('0x8')](),controller[_0xb5fb('0x9')]);router[_0xb5fb('0x7')](_0xb5fb('0xa'),auth[_0xb5fb('0x8')](),controller[_0xb5fb('0xb')]);router[_0xb5fb('0x7')](_0xb5fb('0xc'),auth[_0xb5fb('0x8')](),controller['show']);router[_0xb5fb('0xd')]('/',auth[_0xb5fb('0x8')](),interaction[_0xb5fb('0xe')]('sms','smsmessage:create'),controller['create']);router[_0xb5fb('0xd')](_0xb5fb('0xf'),controller['status']);router[_0xb5fb('0x10')](_0xb5fb('0xc'),auth[_0xb5fb('0x8')](),controller[_0xb5fb('0x11')]);router[_0xb5fb('0x10')]('/:id/accept',auth[_0xb5fb('0x8')](),controller[_0xb5fb('0x12')]);router[_0xb5fb('0x10')](_0xb5fb('0x13'),auth[_0xb5fb('0x8')](),controller['reject']);router[_0xb5fb('0x14')](_0xb5fb('0xc'),auth['isAuthenticated'](),controller[_0xb5fb('0x15')]);module[_0xb5fb('0x16')]=router; \ No newline at end of file +var _0x1abc=['/:id','show','post','tracked','smsmessage:create','create','/:id/status','status','put','/:id/accept','accept','delete','destroy','exports','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsMessage.controller','get','isAuthenticated','/describe','describe'];(function(_0x5106ee,_0x4a284b){var _0x469f0c=function(_0x3f7753){while(--_0x3f7753){_0x5106ee['push'](_0x5106ee['shift']());}};_0x469f0c(++_0x4a284b);}(_0x1abc,0x1ae));var _0xc1ab=function(_0x17913c,_0x5c687b){_0x17913c=_0x17913c-0x0;var _0x2c71af=_0x1abc[_0x17913c];return _0x2c71af;};'use strict';var multer=require(_0xc1ab('0x0'));var util=require(_0xc1ab('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xc1ab('0x2')]();var fs_extra=require(_0xc1ab('0x3'));var auth=require(_0xc1ab('0x4'));var interaction=require(_0xc1ab('0x5'));var config=require(_0xc1ab('0x6'));var controller=require(_0xc1ab('0x7'));router[_0xc1ab('0x8')]('/',auth[_0xc1ab('0x9')](),controller['index']);router[_0xc1ab('0x8')](_0xc1ab('0xa'),auth[_0xc1ab('0x9')](),controller[_0xc1ab('0xb')]);router[_0xc1ab('0x8')](_0xc1ab('0xc'),auth['isAuthenticated'](),controller[_0xc1ab('0xd')]);router[_0xc1ab('0xe')]('/',auth[_0xc1ab('0x9')](),interaction[_0xc1ab('0xf')]('sms',_0xc1ab('0x10')),controller[_0xc1ab('0x11')]);router[_0xc1ab('0xe')](_0xc1ab('0x12'),controller[_0xc1ab('0x13')]);router[_0xc1ab('0x14')](_0xc1ab('0xc'),auth[_0xc1ab('0x9')](),controller['update']);router[_0xc1ab('0x14')](_0xc1ab('0x15'),auth[_0xc1ab('0x9')](),controller[_0xc1ab('0x16')]);router[_0xc1ab('0x14')]('/:id/reject',auth[_0xc1ab('0x9')](),controller['reject']);router[_0xc1ab('0x17')](_0xc1ab('0xc'),auth['isAuthenticated'](),controller[_0xc1ab('0x18')]);module[_0xc1ab('0x19')]=router; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.attributes.js b/server/api/smsMessage/smsMessage.attributes.js index 58fdcdb..18ccc9c 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 _0xd981=['STRING','DATE','sequelize','medium','BOOLEAN','ENUM','out'];(function(_0x13b93e,_0x4ea3ed){var _0x3822ae=function(_0x54dc84){while(--_0x54dc84){_0x13b93e['push'](_0x13b93e['shift']());}};_0x3822ae(++_0x4ea3ed);}(_0xd981,0x1ad));var _0x1d98=function(_0x1fdc4f,_0x4b92ab){_0x1fdc4f=_0x1fdc4f-0x0;var _0x5ceaa2=_0xd981[_0x1fdc4f];return _0x5ceaa2;};'use strict';var Sequelize=require(_0x1d98('0x0'));module['exports']={'body':{'type':Sequelize['TEXT'](_0x1d98('0x1')),'allowNull':![]},'read':{'type':Sequelize[_0x1d98('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0x1d98('0x3')]('in',_0x1d98('0x4')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize[_0x1d98('0x5')]},'readAt':{'type':Sequelize[_0x1d98('0x6')]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'providerName':{'type':Sequelize[_0x1d98('0x5')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0xe927=['sequelize','TEXT','medium','BOOLEAN','ENUM','out','STRING','DATE'];(function(_0x22c5a9,_0x300517){var _0x4729a0=function(_0x3998a3){while(--_0x3998a3){_0x22c5a9['push'](_0x22c5a9['shift']());}};_0x4729a0(++_0x300517);}(_0xe927,0x88));var _0x7e92=function(_0x99c2dd,_0x1d32eb){_0x99c2dd=_0x99c2dd-0x0;var _0x173349=_0xe927[_0x99c2dd];return _0x173349;};'use strict';var Sequelize=require(_0x7e92('0x0'));module['exports']={'body':{'type':Sequelize[_0x7e92('0x1')](_0x7e92('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x7e92('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x7e92('0x4')]('in',_0x7e92('0x5')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0x7e92('0x6')](0xbe)},'phone':{'type':Sequelize[_0x7e92('0x6')]},'readAt':{'type':Sequelize[_0x7e92('0x7')]},'secret':{'type':Sequelize[_0x7e92('0x3')],'defaultValue':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.controller.js b/server/api/smsMessage/smsMessage.controller.js index aa8b488..385f69f 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 _0x40ac=['[SMSMESSAGE: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','SELECT','contact','User','fullname','manual','interface','channel','motionChannel','event','acceptmessage','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','sequelize','email','internal','SIP/%s','EventManager','rejectmessage','SmsAccount','SmsAccountId','inspect','twilio','MessageSid','messageId','MessageUUID','indexOf','delivered','plivio','results','groupName','DELIVERED','SmsAccount,\x20%s,\x20%s,\x20%s','infobip','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','squel','crypto','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsMessage.socket','register','client','http','SmsMessage,\x20%s,\x20%s','debug','SmsMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','sendStatus','status','offset','undefined','limit','count','set','json','apply','reject','update','then','destroy','end','stack','send','map','SmsMessage','rawAttributes','fieldName','type','key','model','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','includeAll','findAll','rows','show','params','include','options','find','create','catch','body','sms-interactions','accept','sms','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','SmsInteraction','SmsInteractionId','read1stAt','interaction','get'];(function(_0x1be55c,_0x353c4f){var _0x421594=function(_0x33da56){while(--_0x33da56){_0x1be55c['push'](_0x1be55c['shift']());}};_0x421594(++_0x353c4f);}(_0x40ac,0x1de));var _0xc40a=function(_0x4f8f3b,_0x43281b){_0x4f8f3b=_0x4f8f3b-0x0;var _0x4c250c=_0x40ac[_0x4f8f3b];return _0x4c250c;};'use strict';var emlformat=require(_0xc40a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc40a('0x1'));var jsonpatch=require(_0xc40a('0x2'));var rp=require(_0xc40a('0x3'));var moment=require(_0xc40a('0x4'));var BPromise=require(_0xc40a('0x5'));var Mustache=require(_0xc40a('0x6'));var util=require(_0xc40a('0x7'));var path=require('path');var sox=require(_0xc40a('0x8'));var csv=require(_0xc40a('0x9'));var ejs=require(_0xc40a('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xc40a('0xb'));var crypto=require(_0xc40a('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xc40a('0xd'));var toCsv=require(_0xc40a('0x9'));var querystring=require(_0xc40a('0xe'));var Papa=require(_0xc40a('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xc40a('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc40a('0x11'))('api');var utils=require('../../config/utils');var config=require(_0xc40a('0x12'));var licenseUtil=require(_0xc40a('0x13'));var db=require(_0xc40a('0x14'))['db'];config[_0xc40a('0x15')]=_[_0xc40a('0x16')](config[_0xc40a('0x15')],{'host':_0xc40a('0x17'),'port':0x18eb});var socket=require(_0xc40a('0x18'))(new Redis(config['redis']));require(_0xc40a('0x19'))[_0xc40a('0x1a')](socket);var jayson=require('jayson/promise');var client=jayson[_0xc40a('0x1b')]['http']({'port':0x232c});var client9002=jayson[_0xc40a('0x1b')][_0xc40a('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x1a8654,_0x3eeeb8,_0x15131d,_0x4bc038){return new BPromise(function(_0x3d1502,_0x272fef){var _0x158625=_0x4bc038||client;return _0x158625['request'](_0x1a8654,_0x15131d)['then'](function(_0x24e0d3){logger['info'](_0xc40a('0x1d'),_0x3eeeb8,'request\x20sent');logger[_0xc40a('0x1e')](_0xc40a('0x1f'),_0x3eeeb8,_0xc40a('0x20'),JSON[_0xc40a('0x21')](_0x24e0d3));if(_0x24e0d3['error']){if(_0x24e0d3[_0xc40a('0x22')][_0xc40a('0x23')]===0x1f4){logger['error'](_0xc40a('0x1d'),_0x3eeeb8,_0x24e0d3['error']['message']);return _0x272fef(_0x24e0d3[_0xc40a('0x22')][_0xc40a('0x24')]);}logger[_0xc40a('0x22')](_0xc40a('0x1d'),_0x3eeeb8,_0x24e0d3[_0xc40a('0x22')][_0xc40a('0x24')]);return _0x3d1502(_0x24e0d3[_0xc40a('0x22')]['message']);}else{logger[_0xc40a('0x25')]('SmsMessage,\x20%s,\x20%s',_0x3eeeb8,_0xc40a('0x20'));_0x3d1502(_0x24e0d3['result'][_0xc40a('0x24')]);}})['catch'](function(_0x1f37c5){logger['error'](_0xc40a('0x1d'),_0x3eeeb8,_0x1f37c5);_0x272fef(_0x1f37c5);});});}function respondWithStatusCode(_0x10a8a3,_0x27346e){_0x27346e=_0x27346e||0xcc;return function(_0x5c144e){if(_0x5c144e){return _0x10a8a3[_0xc40a('0x26')](_0x27346e);}return _0x10a8a3[_0xc40a('0x27')](_0x27346e)['end']();};}function respondWithResult(_0xdc19d7,_0x43fa1c){_0x43fa1c=_0x43fa1c||0xc8;return function(_0x518b06){if(_0x518b06){return _0xdc19d7['status'](_0x43fa1c)['json'](_0x518b06);}};}function respondWithFilteredResult(_0x14240f,_0x7fc56d){return function(_0x7769dd){if(_0x7769dd){var _0x2f3c49=typeof _0x7fc56d[_0xc40a('0x28')]===_0xc40a('0x29')&&typeof _0x7fc56d[_0xc40a('0x2a')]===_0xc40a('0x29');var _0x5c1c82=_0x7769dd[_0xc40a('0x2b')];var _0x38271e=_0x2f3c49?0x0:_0x7fc56d[_0xc40a('0x28')];var _0x44ba01=_0x2f3c49?_0x7769dd[_0xc40a('0x2b')]:_0x7fc56d[_0xc40a('0x28')]+_0x7fc56d[_0xc40a('0x2a')];var _0xdd83e9;if(_0x44ba01>=_0x5c1c82){_0x44ba01=_0x5c1c82;_0xdd83e9=0xc8;}else{_0xdd83e9=0xce;}_0x14240f[_0xc40a('0x27')](_0xdd83e9);return _0x14240f[_0xc40a('0x2c')]('Content-Range',_0x38271e+'-'+_0x44ba01+'/'+_0x5c1c82)[_0xc40a('0x2d')](_0x7769dd);}return null;};}function patchUpdates(_0xa69b88){return function(_0x13fa05){try{jsonpatch[_0xc40a('0x2e')](_0x13fa05,_0xa69b88,!![]);}catch(_0x14d948){return BPromise[_0xc40a('0x2f')](_0x14d948);}return _0x13fa05['save']();};}function saveUpdates(_0x54eff6,_0x1e3b7){return function(_0x1976ab){if(_0x1976ab){return _0x1976ab[_0xc40a('0x30')](_0x54eff6)[_0xc40a('0x31')](function(_0x231626){return _0x231626;});}return null;};}function removeEntity(_0x5769da,_0x1a954c){return function(_0x2da8c2){if(_0x2da8c2){return _0x2da8c2[_0xc40a('0x32')]()[_0xc40a('0x31')](function(){_0x5769da[_0xc40a('0x27')](0xcc)[_0xc40a('0x33')]();});}};}function handleEntityNotFound(_0xea99c4,_0x389237){return function(_0x4d2929){if(!_0x4d2929){_0xea99c4[_0xc40a('0x26')](0x194);}return _0x4d2929;};}function handleError(_0x450f57,_0x2bcfc0){_0x2bcfc0=_0x2bcfc0||0x1f4;return function(_0x3c3a7f){logger[_0xc40a('0x22')](_0x3c3a7f[_0xc40a('0x34')]);if(_0x3c3a7f['name']){delete _0x3c3a7f['name'];}_0x450f57[_0xc40a('0x27')](_0x2bcfc0)[_0xc40a('0x35')](_0x3c3a7f);};}exports['index']=function(_0x254030,_0x403349){var _0x339429={},_0x53d373={},_0x2e5a96={'count':0x0,'rows':[]};var _0x1eb68d=_[_0xc40a('0x36')](db[_0xc40a('0x37')][_0xc40a('0x38')],function(_0x5a6408){return{'name':_0x5a6408[_0xc40a('0x39')],'type':_0x5a6408[_0xc40a('0x3a')][_0xc40a('0x3b')]};});_0x53d373[_0xc40a('0x3c')]=_['map'](_0x1eb68d,_0xc40a('0x3d'));_0x53d373[_0xc40a('0x3e')]=_[_0xc40a('0x3f')](_0x254030[_0xc40a('0x3e')]);_0x53d373[_0xc40a('0x40')]=_[_0xc40a('0x41')](_0x53d373[_0xc40a('0x3c')],_0x53d373[_0xc40a('0x3e')]);_0x339429[_0xc40a('0x42')]=_['intersection'](_0x53d373[_0xc40a('0x3c')],qs['fields'](_0x254030[_0xc40a('0x3e')][_0xc40a('0x43')]));_0x339429['attributes']=_0x339429[_0xc40a('0x42')][_0xc40a('0x44')]?_0x339429[_0xc40a('0x42')]:_0x53d373[_0xc40a('0x3c')];if(!_0x254030['query'][_0xc40a('0x45')](_0xc40a('0x46'))){_0x339429[_0xc40a('0x2a')]=qs['limit'](_0x254030['query'][_0xc40a('0x2a')]);_0x339429[_0xc40a('0x28')]=qs[_0xc40a('0x28')](_0x254030[_0xc40a('0x3e')][_0xc40a('0x28')]);}_0x339429['order']=qs[_0xc40a('0x47')](_0x254030[_0xc40a('0x3e')][_0xc40a('0x47')]);_0x339429[_0xc40a('0x48')]=qs['filters'](_[_0xc40a('0x49')](_0x254030[_0xc40a('0x3e')],_0x53d373[_0xc40a('0x40')]),_0x1eb68d);if(_0x254030[_0xc40a('0x3e')][_0xc40a('0x4a')]){_0x339429['where']=_[_0xc40a('0x4b')](_0x339429[_0xc40a('0x48')],{'$or':_['map'](_0x1eb68d,function(_0x2780d9){if(_0x2780d9[_0xc40a('0x3a')]!=='VIRTUAL'){var _0x49eaf1={};_0x49eaf1[_0x2780d9[_0xc40a('0x3d')]]={'$like':'%'+_0x254030[_0xc40a('0x3e')]['filter']+'%'};return _0x49eaf1;}})});}_0x339429=_['merge']({},_0x339429,_0x254030['options']);var _0xdaa293={'where':_0x339429[_0xc40a('0x48')]};return db['SmsMessage'][_0xc40a('0x2b')](_0xdaa293)[_0xc40a('0x31')](function(_0x97085e){_0x2e5a96[_0xc40a('0x2b')]=_0x97085e;if(_0x254030[_0xc40a('0x3e')][_0xc40a('0x4c')]){_0x339429['include']=[{'all':!![]}];}return db[_0xc40a('0x37')][_0xc40a('0x4d')](_0x339429);})[_0xc40a('0x31')](function(_0x21e0e5){_0x2e5a96[_0xc40a('0x4e')]=_0x21e0e5;return _0x2e5a96;})[_0xc40a('0x31')](respondWithFilteredResult(_0x403349,_0x339429))['catch'](handleError(_0x403349,null));};exports[_0xc40a('0x4f')]=function(_0x357116,_0x100cfd){var _0x3fc897={'raw':!![],'where':{'id':_0x357116[_0xc40a('0x50')]['id']}},_0x507b56={};_0x507b56['model']=_['keys'](db[_0xc40a('0x37')]['rawAttributes']);_0x507b56['query']=_['keys'](_0x357116[_0xc40a('0x3e')]);_0x507b56[_0xc40a('0x40')]=_[_0xc40a('0x41')](_0x507b56[_0xc40a('0x3c')],_0x507b56[_0xc40a('0x3e')]);_0x3fc897[_0xc40a('0x42')]=_[_0xc40a('0x41')](_0x507b56['model'],qs[_0xc40a('0x43')](_0x357116[_0xc40a('0x3e')][_0xc40a('0x43')]));_0x3fc897[_0xc40a('0x42')]=_0x3fc897[_0xc40a('0x42')][_0xc40a('0x44')]?_0x3fc897[_0xc40a('0x42')]:_0x507b56[_0xc40a('0x3c')];if(_0x357116[_0xc40a('0x3e')][_0xc40a('0x4c')]){_0x3fc897[_0xc40a('0x51')]=[{'all':!![]}];}_0x3fc897=_['merge']({},_0x3fc897,_0x357116[_0xc40a('0x52')]);return db[_0xc40a('0x37')][_0xc40a('0x53')](_0x3fc897)[_0xc40a('0x31')](handleEntityNotFound(_0x100cfd,null))[_0xc40a('0x31')](respondWithResult(_0x100cfd,null))['catch'](handleError(_0x100cfd,null));};exports[_0xc40a('0x54')]=function(_0x35f5c6,_0xfcc4e1){return db[_0xc40a('0x37')]['create'](_0x35f5c6['body'],{})[_0xc40a('0x31')](respondWithResult(_0xfcc4e1,0xc9))[_0xc40a('0x55')](handleError(_0xfcc4e1,null));};exports[_0xc40a('0x30')]=function(_0x1c0b74,_0x51eb80){if(_0x1c0b74['body']['id']){delete _0x1c0b74[_0xc40a('0x56')]['id'];}return db[_0xc40a('0x37')][_0xc40a('0x53')]({'where':{'id':_0x1c0b74[_0xc40a('0x50')]['id']}})[_0xc40a('0x31')](handleEntityNotFound(_0x51eb80,null))[_0xc40a('0x31')](saveUpdates(_0x1c0b74[_0xc40a('0x56')],null))[_0xc40a('0x31')](respondWithResult(_0x51eb80,null))[_0xc40a('0x55')](handleError(_0x51eb80,null));};exports[_0xc40a('0x32')]=function(_0x1e9cab,_0x483e8f){return db[_0xc40a('0x37')][_0xc40a('0x53')]({'where':{'id':_0x1e9cab[_0xc40a('0x50')]['id']}})[_0xc40a('0x31')](handleEntityNotFound(_0x483e8f,null))['then'](removeEntity(_0x483e8f,null))[_0xc40a('0x55')](handleError(_0x483e8f,null));};exports['describe']=function(_0x23e4d1,_0x264457){return db[_0xc40a('0x37')]['describe']()[_0xc40a('0x31')](respondWithResult(_0x264457,null))['catch'](handleError(_0x264457,null));};var interaction_log=require(_0xc40a('0x11'))(_0xc40a('0x57'));exports[_0xc40a('0x58')]=function(_0x4fd98c,_0x4284e8,_0x401853){var _0x455ad0={'agent':{},'channel':_0xc40a('0x59')};if(_0x4fd98c[_0xc40a('0x56')]['id']){delete _0x4fd98c[_0xc40a('0x56')]['id'];}_0x4fd98c[_0xc40a('0x56')][_0xc40a('0x5a')]=!![];_0x4fd98c['body'][_0xc40a('0x5b')]=moment()[_0xc40a('0x5c')](_0xc40a('0x5d'));_0x4fd98c['body'][_0xc40a('0x5e')]=_0x4fd98c[_0xc40a('0x56')]['UserId']||_0x4fd98c[_0xc40a('0x5f')]['id'];_0x455ad0[_0xc40a('0x60')]['id']=_0x4fd98c[_0xc40a('0x56')][_0xc40a('0x5e')];return db[_0xc40a('0x37')]['find']({'where':{'id':_0x4fd98c[_0xc40a('0x50')]['id'],'UserId':null}})[_0xc40a('0x31')](handleEntityNotFound(_0x4284e8,null))['then'](saveUpdates(_0x4fd98c[_0xc40a('0x56')],null))[_0xc40a('0x31')](function(_0x9bd497){if(_0x9bd497){_0x455ad0[_0xc40a('0x24')]=_0x9bd497['get']({'plain':!![]});return db[_0xc40a('0x61')][_0xc40a('0x53')]({'where':{'id':_0x9bd497[_0xc40a('0x62')]}});}return null;})[_0xc40a('0x31')](handleEntityNotFound(_0x4284e8,null))['then'](function(_0x5391bf){if(_0x5391bf){return _0x5391bf[_0xc40a('0x30')]({'UserId':_0x4fd98c[_0xc40a('0x56')]['UserId'],'read1stAt':_['isNil'](_0x5391bf[_0xc40a('0x63')])?moment()[_0xc40a('0x5c')](_0xc40a('0x5d')):undefined});}return null;})[_0xc40a('0x31')](function(_0xedd96a){if(_0xedd96a){_0x455ad0[_0xc40a('0x64')]=_0xedd96a[_0xc40a('0x65')]({'plain':!![]});interaction_log[_0xc40a('0x25')](_0xc40a('0x66'),_0x4fd98c[_0xc40a('0x5f')]['id'],_0x4fd98c[_0xc40a('0x5f')][_0xc40a('0x3d')],_0x4fd98c[_0xc40a('0x5f')][_0xc40a('0x67')],_0x455ad0['interaction']['id'],_0x4fd98c[_0xc40a('0x56')]?JSON[_0xc40a('0x21')](_0x4fd98c[_0xc40a('0x56')]):_0xc40a('0x68'));return respondWithRpcPromise(_0xc40a('0x69'),_0xc40a('0x6a'),_0x455ad0);}return null;})['then'](function(_0x41d9be){var _0x20c8cd=_0xc40a('0x6b')+_0x41d9be[_0xc40a('0x24')][_0xc40a('0x6c')];return db['sequelize']['query'](_0x20c8cd,{'type':db[_0xc40a('0x6d')][_0xc40a('0x6e')][_0xc40a('0x6f')],'raw':!![]})[_0xc40a('0x31')](function(_0x3b81b2){return _0x3b81b2;});})[_0xc40a('0x31')](function(_0x509201){if(_0x509201){_0x455ad0[_0xc40a('0x24')][_0xc40a('0x70')]=_0x509201[0x0];if(!_0x4fd98c[_0xc40a('0x56')]['UserId'])return;return db[_0xc40a('0x71')]['find']({'where':{'id':_0x4fd98c[_0xc40a('0x56')][_0xc40a('0x5e')],'role':'agent'},'attributes':['id',_0xc40a('0x3d'),_0xc40a('0x72'),'email','internal'],'raw':!![]});}return null;})[_0xc40a('0x31')](function(_0x3ec268){if(!_0x3ec268)return null;_0x455ad0['message'][_0xc40a('0x60')]=_0x3ec268;return _0x455ad0;})[_0xc40a('0x31')](function(_0x91752f){if(_0x91752f){if(_0x4fd98c[_0xc40a('0x56')][_0xc40a('0x73')]){_0x455ad0[_0xc40a('0x24')][_0xc40a('0x74')]=util[_0xc40a('0x5c')]('SIP/%s',_0x4fd98c[_0xc40a('0x5f')][_0xc40a('0x3d')]);_0x455ad0[_0xc40a('0x24')][_0xc40a('0x75')]=_0x455ad0[_0xc40a('0x75')];_0x455ad0[_0xc40a('0x24')][_0xc40a('0x76')]=_0x455ad0[_0xc40a('0x75')];_0x455ad0['message'][_0xc40a('0x77')]='accept';return respondWithRpcPromise('EventManager','EventManager',{'event':_0xc40a('0x78'),'message':_0x455ad0[_0xc40a('0x24')]},client9002)[_0xc40a('0x31')](function(){return _0x455ad0;});}return _0x455ad0;}return null;})['then'](respondWithResult(_0x4284e8,null))['catch'](handleError(_0x4284e8,null));};var interaction_log=require(_0xc40a('0x11'))(_0xc40a('0x57'));exports[_0xc40a('0x2f')]=function(_0xd955a2,_0x818fcb,_0x17d974){var _0x4dd22e={'agent':{},'channel':_0xc40a('0x59')};if(_0xd955a2[_0xc40a('0x56')]['id']){delete _0xd955a2[_0xc40a('0x56')]['id'];}_0xd955a2[_0xc40a('0x56')][_0xc40a('0x5e')]=_0xd955a2[_0xc40a('0x56')][_0xc40a('0x5e')]||_0xd955a2['user']['id'];_0x4dd22e[_0xc40a('0x60')]['id']=_0xd955a2['body'][_0xc40a('0x5e')];return db['SmsMessage'][_0xc40a('0x53')]({'where':{'id':_0xd955a2[_0xc40a('0x50')]['id'],'UserId':null}})[_0xc40a('0x31')](handleEntityNotFound(_0x818fcb,null))[_0xc40a('0x31')](function(_0x5b85d3){if(_0x5b85d3){_0x4dd22e['message']=_0x5b85d3['get']({'plain':!![]});return db[_0xc40a('0x61')]['find']({'where':{'id':_0x5b85d3[_0xc40a('0x62')]}});}return null;})['then'](handleEntityNotFound(_0x818fcb,null))[_0xc40a('0x31')](function(_0x23c91b){if(_0x23c91b){_0x4dd22e[_0xc40a('0x64')]=_0x23c91b[_0xc40a('0x65')]({'plain':!![]});interaction_log[_0xc40a('0x25')](_0xc40a('0x79'),_0xd955a2['user']['id'],_0xd955a2[_0xc40a('0x5f')][_0xc40a('0x3d')],_0xd955a2[_0xc40a('0x5f')][_0xc40a('0x67')],_0x4dd22e['interaction']['id'],_0xd955a2[_0xc40a('0x56')]?JSON[_0xc40a('0x21')](_0xd955a2['body']):_0xc40a('0x68'));return respondWithRpcPromise(_0xc40a('0x7a'),_0xc40a('0x7b'),_0x4dd22e);}return null;})[_0xc40a('0x31')](function(_0x2b2ea5){var _0x2d4636=_0xc40a('0x6b')+_0x2b2ea5['message'][_0xc40a('0x6c')];return db[_0xc40a('0x7c')][_0xc40a('0x3e')](_0x2d4636,{'type':db[_0xc40a('0x6d')][_0xc40a('0x6e')][_0xc40a('0x6f')],'raw':!![]})['then'](function(_0x19e7f1){return _0x19e7f1;});})[_0xc40a('0x31')](function(_0x503065){if(_0x503065){_0x4dd22e['message'][_0xc40a('0x70')]=_0x503065[0x0];if(!_0xd955a2[_0xc40a('0x56')]['UserId'])return;return db[_0xc40a('0x71')][_0xc40a('0x53')]({'where':{'id':_0xd955a2[_0xc40a('0x56')][_0xc40a('0x5e')],'role':_0xc40a('0x60')},'attributes':['id',_0xc40a('0x3d'),_0xc40a('0x72'),_0xc40a('0x7d'),_0xc40a('0x7e')],'raw':!![]});}return null;})[_0xc40a('0x31')](function(_0x217373){if(!_0x217373)return null;_0x4dd22e[_0xc40a('0x24')][_0xc40a('0x60')]=_0x217373;return _0x4dd22e;})['then'](function(_0x5c503b){if(_0x5c503b){_0x5c503b[_0xc40a('0x24')][_0xc40a('0x74')]=util[_0xc40a('0x5c')](_0xc40a('0x7f'),_0xd955a2[_0xc40a('0x5f')][_0xc40a('0x3d')]);_0x5c503b[_0xc40a('0x24')][_0xc40a('0x75')]=_0x4dd22e[_0xc40a('0x75')];_0x5c503b[_0xc40a('0x24')][_0xc40a('0x76')]=_0x4dd22e[_0xc40a('0x75')];_0x5c503b['message'][_0xc40a('0x77')]=_0xc40a('0x2f');respondWithRpcPromise(_0xc40a('0x80'),_0xc40a('0x80'),{'event':_0xc40a('0x81'),'message':_0x5c503b[_0xc40a('0x24')]},client9002);return _0x4dd22e;}return null;})[_0xc40a('0x31')](respondWithResult(_0x818fcb,null))[_0xc40a('0x55')](handleError(_0x818fcb,null));};exports[_0xc40a('0x27')]=function(_0x464b68,_0x8a0759,_0x314ca5){if(_0x464b68[_0xc40a('0x56')]['id']){delete _0x464b68[_0xc40a('0x56')]['id'];}var _0x137df4;return db[_0xc40a('0x37')][_0xc40a('0x53')]({'where':{'id':_0x464b68[_0xc40a('0x50')]['id']}})['then'](handleEntityNotFound(_0x8a0759,null))[_0xc40a('0x31')](function(_0x4cf0b8){if(_0x4cf0b8){_0x137df4=_0x4cf0b8;return db[_0xc40a('0x82')][_0xc40a('0x53')]({'where':{'id':_0x4cf0b8[_0xc40a('0x83')]}});}})[_0xc40a('0x31')](handleEntityNotFound(_0x8a0759,null))[_0xc40a('0x31')](function(_0x1f28e1){if(_0x1f28e1){logger[_0xc40a('0x1e')](_0xc40a('0x1f'),'status','received\x20delivery\x20report\x20from',_0x1f28e1[_0xc40a('0x3a')],util[_0xc40a('0x84')](_0x464b68[_0xc40a('0x56')],{'showHidden':![],'depth':null}));switch(_0x1f28e1[_0xc40a('0x3a')]){case _0xc40a('0x85'):if(_0x464b68['body']['MessageSid']&&_0x464b68['body'][_0xc40a('0x86')]===_0x137df4[_0xc40a('0x87')]){return _0x137df4[_0xc40a('0x30')]({'read':!![]});}else{logger[_0xc40a('0x22')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xc40a('0x27'),'twilio',util['inspect'](_0x464b68['body'],{'showHidden':![],'depth':null}));}break;case'plivo':if(_0x464b68[_0xc40a('0x56')][_0xc40a('0x88')]&&_0x464b68[_0xc40a('0x56')]['MessageUUID']===_0x137df4[_0xc40a('0x87')]&&_[_0xc40a('0x89')](['sent',_0xc40a('0x8a')],_0x464b68['body']['Status'])>=0x0){return _0x137df4[_0xc40a('0x30')]({'read':!![]});}else{logger[_0xc40a('0x22')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xc40a('0x27'),_0xc40a('0x8b'),util['inspect'](_0x464b68['body'],{'showHidden':![],'depth':null}));}break;case'infobip':var _0x4046fa=_0x464b68[_0xc40a('0x56')][_0xc40a('0x8c')][0x0];if(_0x4046fa[_0xc40a('0x27')][_0xc40a('0x8d')]===_0xc40a('0x8e')){return _0x137df4[_0xc40a('0x30')]({'read':!![]});}else{logger[_0xc40a('0x22')](_0xc40a('0x8f'),_0xc40a('0x27'),_0xc40a('0x90'),util[_0xc40a('0x84')](_0x464b68['body'],{'showHidden':![],'depth':null}));}break;}return _0x137df4;}})['then'](respondWithResult(_0x8a0759,null))[_0xc40a('0x55')](handleError(_0x8a0759,null));}; \ No newline at end of file +var _0xab9c=['include','rows','show','params','length','merge','find','create','update','body','describe','sms-interactions','sms','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','SmsInteraction','SmsInteractionId','isNil','read1stAt','interaction','role','null','AcceptMessage','acceptMessage','ContactId','sequelize','contact','User','fullname','email','internal','manual','interface','channel','motionChannel','acceptmessage','reject','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','QueryTypes','SELECT','event','EventManager','rejectmessage','SmsAccount','SmsAccountId','SmsMessage,\x20%s,\x20%s,\x20%s','inspect','MessageSid','MessageUUID','messageId','indexOf','sent','delivered','SmsAccount,\x20%s,\x20%s,\x20%s','plivio','infobip','results','groupName','DELIVERED','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./smsMessage.socket','jayson/promise','client','http','request','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','set','Content-Range','save','destroy','name','send','map','SmsMessage','fieldName','model','keys','filters','intersection','fields','query','attributes','hasOwnProperty','limit','order','pick','filter','where','type','options','includeAll'];(function(_0x4410a1,_0xd641ad){var _0x3687a0=function(_0x5bd24f){while(--_0x5bd24f){_0x4410a1['push'](_0x4410a1['shift']());}};_0x3687a0(++_0xd641ad);}(_0xab9c,0xd0));var _0xcab9=function(_0x3c3111,_0x2c1d33){_0x3c3111=_0x3c3111-0x0;var _0x4bb36f=_0xab9c[_0x3c3111];return _0x4bb36f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xcab9('0x0'));var zipdir=require(_0xcab9('0x1'));var jsonpatch=require(_0xcab9('0x2'));var rp=require(_0xcab9('0x3'));var moment=require(_0xcab9('0x4'));var BPromise=require(_0xcab9('0x5'));var Mustache=require(_0xcab9('0x6'));var util=require(_0xcab9('0x7'));var path=require(_0xcab9('0x8'));var sox=require('sox');var csv=require(_0xcab9('0x9'));var ejs=require(_0xcab9('0xa'));var fs=require('fs');var fs_extra=require(_0xcab9('0xb'));var _=require('lodash');var squel=require(_0xcab9('0xc'));var crypto=require(_0xcab9('0xd'));var jsforce=require(_0xcab9('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xcab9('0x9'));var querystring=require(_0xcab9('0xf'));var Papa=require(_0xcab9('0x10'));var Redis=require(_0xcab9('0x11'));var authService=require(_0xcab9('0x12'));var qs=require(_0xcab9('0x13'));var as=require(_0xcab9('0x14'));var hardwareService=require(_0xcab9('0x15'));var logger=require(_0xcab9('0x16'))(_0xcab9('0x17'));var utils=require(_0xcab9('0x18'));var config=require(_0xcab9('0x19'));var licenseUtil=require(_0xcab9('0x1a'));var db=require(_0xcab9('0x1b'))['db'];config[_0xcab9('0x1c')]=_[_0xcab9('0x1d')](config[_0xcab9('0x1c')],{'host':'localhost','port':0x18eb});var socket=require(_0xcab9('0x1e'))(new Redis(config[_0xcab9('0x1c')]));require(_0xcab9('0x1f'))['register'](socket);var jayson=require(_0xcab9('0x20'));var client=jayson[_0xcab9('0x21')][_0xcab9('0x22')]({'port':0x232c});var client9002=jayson[_0xcab9('0x21')][_0xcab9('0x22')]({'port':0x232a});function respondWithRpcPromise(_0x4aa8db,_0x55f5fe,_0x13a650,_0x2b6625){return new BPromise(function(_0x75f08d,_0x187ac2){var _0x6aeb72=_0x2b6625||client;return _0x6aeb72[_0xcab9('0x23')](_0x4aa8db,_0x13a650)[_0xcab9('0x24')](function(_0x14bf60){logger[_0xcab9('0x25')](_0xcab9('0x26'),_0x55f5fe,_0xcab9('0x27'));logger[_0xcab9('0x28')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x55f5fe,'request\x20sent',JSON[_0xcab9('0x29')](_0x14bf60));if(_0x14bf60[_0xcab9('0x2a')]){if(_0x14bf60[_0xcab9('0x2a')][_0xcab9('0x2b')]===0x1f4){logger[_0xcab9('0x2a')](_0xcab9('0x26'),_0x55f5fe,_0x14bf60[_0xcab9('0x2a')][_0xcab9('0x2c')]);return _0x187ac2(_0x14bf60['error'][_0xcab9('0x2c')]);}logger[_0xcab9('0x2a')]('SmsMessage,\x20%s,\x20%s',_0x55f5fe,_0x14bf60[_0xcab9('0x2a')][_0xcab9('0x2c')]);return _0x75f08d(_0x14bf60[_0xcab9('0x2a')][_0xcab9('0x2c')]);}else{logger[_0xcab9('0x25')](_0xcab9('0x26'),_0x55f5fe,_0xcab9('0x27'));_0x75f08d(_0x14bf60[_0xcab9('0x2d')]['message']);}})[_0xcab9('0x2e')](function(_0x5e1969){logger[_0xcab9('0x2a')]('SmsMessage,\x20%s,\x20%s',_0x55f5fe,_0x5e1969);_0x187ac2(_0x5e1969);});});}function respondWithStatusCode(_0x3ac15a,_0x467f80){_0x467f80=_0x467f80||0xcc;return function(_0x33ee8a){if(_0x33ee8a){return _0x3ac15a[_0xcab9('0x2f')](_0x467f80);}return _0x3ac15a[_0xcab9('0x30')](_0x467f80)[_0xcab9('0x31')]();};}function respondWithResult(_0x50b72f,_0x1f0e27){_0x1f0e27=_0x1f0e27||0xc8;return function(_0x393e0a){if(_0x393e0a){return _0x50b72f[_0xcab9('0x30')](_0x1f0e27)[_0xcab9('0x32')](_0x393e0a);}};}function respondWithFilteredResult(_0x29ae30,_0x2e7d42){return function(_0x2eb703){if(_0x2eb703){var _0x23e31e=typeof _0x2e7d42[_0xcab9('0x33')]==='undefined'&&typeof _0x2e7d42['limit']===_0xcab9('0x34');var _0x5efc62=_0x2eb703['count'];var _0xd8003=_0x23e31e?0x0:_0x2e7d42[_0xcab9('0x33')];var _0x5b0c51=_0x23e31e?_0x2eb703['count']:_0x2e7d42[_0xcab9('0x33')]+_0x2e7d42['limit'];var _0xeb273e;if(_0x5b0c51>=_0x5efc62){_0x5b0c51=_0x5efc62;_0xeb273e=0xc8;}else{_0xeb273e=0xce;}_0x29ae30[_0xcab9('0x30')](_0xeb273e);return _0x29ae30[_0xcab9('0x35')](_0xcab9('0x36'),_0xd8003+'-'+_0x5b0c51+'/'+_0x5efc62)['json'](_0x2eb703);}return null;};}function patchUpdates(_0xd4fe1a){return function(_0x387ce9){try{jsonpatch['apply'](_0x387ce9,_0xd4fe1a,!![]);}catch(_0x52d377){return BPromise['reject'](_0x52d377);}return _0x387ce9[_0xcab9('0x37')]();};}function saveUpdates(_0x25d1bb,_0x4ed73d){return function(_0x21459){if(_0x21459){return _0x21459['update'](_0x25d1bb)['then'](function(_0x518593){return _0x518593;});}return null;};}function removeEntity(_0x29de90,_0x3bb4a6){return function(_0x461545){if(_0x461545){return _0x461545[_0xcab9('0x38')]()[_0xcab9('0x24')](function(){_0x29de90[_0xcab9('0x30')](0xcc)[_0xcab9('0x31')]();});}};}function handleEntityNotFound(_0x363832,_0x441aea){return function(_0x49795e){if(!_0x49795e){_0x363832[_0xcab9('0x2f')](0x194);}return _0x49795e;};}function handleError(_0x985017,_0x58fe14){_0x58fe14=_0x58fe14||0x1f4;return function(_0x5da3d5){logger[_0xcab9('0x2a')](_0x5da3d5['stack']);if(_0x5da3d5['name']){delete _0x5da3d5[_0xcab9('0x39')];}_0x985017[_0xcab9('0x30')](_0x58fe14)[_0xcab9('0x3a')](_0x5da3d5);};}exports['index']=function(_0x552c59,_0x2cd74d){var _0x4fe417={},_0x43fea2={},_0x3df0a3={'count':0x0,'rows':[]};var _0x142b4c=_[_0xcab9('0x3b')](db[_0xcab9('0x3c')]['rawAttributes'],function(_0x3cfe57){return{'name':_0x3cfe57[_0xcab9('0x3d')],'type':_0x3cfe57['type']['key']};});_0x43fea2[_0xcab9('0x3e')]=_[_0xcab9('0x3b')](_0x142b4c,_0xcab9('0x39'));_0x43fea2['query']=_[_0xcab9('0x3f')](_0x552c59['query']);_0x43fea2[_0xcab9('0x40')]=_[_0xcab9('0x41')](_0x43fea2[_0xcab9('0x3e')],_0x43fea2['query']);_0x4fe417['attributes']=_[_0xcab9('0x41')](_0x43fea2[_0xcab9('0x3e')],qs[_0xcab9('0x42')](_0x552c59[_0xcab9('0x43')]['fields']));_0x4fe417[_0xcab9('0x44')]=_0x4fe417[_0xcab9('0x44')]['length']?_0x4fe417[_0xcab9('0x44')]:_0x43fea2[_0xcab9('0x3e')];if(!_0x552c59['query'][_0xcab9('0x45')]('nolimit')){_0x4fe417[_0xcab9('0x46')]=qs['limit'](_0x552c59['query'][_0xcab9('0x46')]);_0x4fe417[_0xcab9('0x33')]=qs[_0xcab9('0x33')](_0x552c59[_0xcab9('0x43')]['offset']);}_0x4fe417[_0xcab9('0x47')]=qs['sort'](_0x552c59[_0xcab9('0x43')]['sort']);_0x4fe417['where']=qs[_0xcab9('0x40')](_[_0xcab9('0x48')](_0x552c59[_0xcab9('0x43')],_0x43fea2['filters']),_0x142b4c);if(_0x552c59[_0xcab9('0x43')][_0xcab9('0x49')]){_0x4fe417[_0xcab9('0x4a')]=_['merge'](_0x4fe417[_0xcab9('0x4a')],{'$or':_[_0xcab9('0x3b')](_0x142b4c,function(_0x4d89eb){if(_0x4d89eb[_0xcab9('0x4b')]!=='VIRTUAL'){var _0x458b1c={};_0x458b1c[_0x4d89eb[_0xcab9('0x39')]]={'$like':'%'+_0x552c59['query'][_0xcab9('0x49')]+'%'};return _0x458b1c;}})});}_0x4fe417=_['merge']({},_0x4fe417,_0x552c59[_0xcab9('0x4c')]);var _0x499130={'where':_0x4fe417[_0xcab9('0x4a')]};return db[_0xcab9('0x3c')]['count'](_0x499130)[_0xcab9('0x24')](function(_0x31095f){_0x3df0a3['count']=_0x31095f;if(_0x552c59[_0xcab9('0x43')][_0xcab9('0x4d')]){_0x4fe417[_0xcab9('0x4e')]=[{'all':!![]}];}return db['SmsMessage']['findAll'](_0x4fe417);})[_0xcab9('0x24')](function(_0x22b218){_0x3df0a3[_0xcab9('0x4f')]=_0x22b218;return _0x3df0a3;})['then'](respondWithFilteredResult(_0x2cd74d,_0x4fe417))['catch'](handleError(_0x2cd74d,null));};exports[_0xcab9('0x50')]=function(_0x116d9f,_0x520b0e){var _0x548f49={'raw':!![],'where':{'id':_0x116d9f[_0xcab9('0x51')]['id']}},_0x55ac39={};_0x55ac39[_0xcab9('0x3e')]=_[_0xcab9('0x3f')](db[_0xcab9('0x3c')]['rawAttributes']);_0x55ac39['query']=_[_0xcab9('0x3f')](_0x116d9f['query']);_0x55ac39[_0xcab9('0x40')]=_[_0xcab9('0x41')](_0x55ac39[_0xcab9('0x3e')],_0x55ac39[_0xcab9('0x43')]);_0x548f49[_0xcab9('0x44')]=_[_0xcab9('0x41')](_0x55ac39[_0xcab9('0x3e')],qs[_0xcab9('0x42')](_0x116d9f[_0xcab9('0x43')][_0xcab9('0x42')]));_0x548f49['attributes']=_0x548f49[_0xcab9('0x44')][_0xcab9('0x52')]?_0x548f49[_0xcab9('0x44')]:_0x55ac39[_0xcab9('0x3e')];if(_0x116d9f['query']['includeAll']){_0x548f49[_0xcab9('0x4e')]=[{'all':!![]}];}_0x548f49=_[_0xcab9('0x53')]({},_0x548f49,_0x116d9f[_0xcab9('0x4c')]);return db[_0xcab9('0x3c')][_0xcab9('0x54')](_0x548f49)[_0xcab9('0x24')](handleEntityNotFound(_0x520b0e,null))[_0xcab9('0x24')](respondWithResult(_0x520b0e,null))[_0xcab9('0x2e')](handleError(_0x520b0e,null));};exports[_0xcab9('0x55')]=function(_0x5282f4,_0x58280c){return db[_0xcab9('0x3c')][_0xcab9('0x55')](_0x5282f4['body'],{})['then'](respondWithResult(_0x58280c,0xc9))[_0xcab9('0x2e')](handleError(_0x58280c,null));};exports[_0xcab9('0x56')]=function(_0x2bee8e,_0x5a2ce0){if(_0x2bee8e[_0xcab9('0x57')]['id']){delete _0x2bee8e[_0xcab9('0x57')]['id'];}return db[_0xcab9('0x3c')][_0xcab9('0x54')]({'where':{'id':_0x2bee8e['params']['id']}})[_0xcab9('0x24')](handleEntityNotFound(_0x5a2ce0,null))['then'](saveUpdates(_0x2bee8e[_0xcab9('0x57')],null))[_0xcab9('0x24')](respondWithResult(_0x5a2ce0,null))['catch'](handleError(_0x5a2ce0,null));};exports[_0xcab9('0x38')]=function(_0x4cea1d,_0x374eb3){return db['SmsMessage'][_0xcab9('0x54')]({'where':{'id':_0x4cea1d[_0xcab9('0x51')]['id']}})[_0xcab9('0x24')](handleEntityNotFound(_0x374eb3,null))[_0xcab9('0x24')](removeEntity(_0x374eb3,null))['catch'](handleError(_0x374eb3,null));};exports[_0xcab9('0x58')]=function(_0x400642,_0xdcfade){return db[_0xcab9('0x3c')][_0xcab9('0x58')]()[_0xcab9('0x24')](respondWithResult(_0xdcfade,null))[_0xcab9('0x2e')](handleError(_0xdcfade,null));};var interaction_log=require(_0xcab9('0x16'))(_0xcab9('0x59'));exports['accept']=function(_0x4df123,_0x810f74,_0x26aedf){var _0x454fa4={'agent':{},'channel':_0xcab9('0x5a')};if(_0x4df123[_0xcab9('0x57')]['id']){delete _0x4df123[_0xcab9('0x57')]['id'];}_0x4df123[_0xcab9('0x57')][_0xcab9('0x5b')]=!![];_0x4df123[_0xcab9('0x57')][_0xcab9('0x5c')]=moment()[_0xcab9('0x5d')](_0xcab9('0x5e'));_0x4df123['body'][_0xcab9('0x5f')]=_0x4df123[_0xcab9('0x57')][_0xcab9('0x5f')]||_0x4df123[_0xcab9('0x60')]['id'];_0x454fa4[_0xcab9('0x61')]['id']=_0x4df123[_0xcab9('0x57')][_0xcab9('0x5f')];return db[_0xcab9('0x3c')][_0xcab9('0x54')]({'where':{'id':_0x4df123[_0xcab9('0x51')]['id'],'UserId':null}})[_0xcab9('0x24')](handleEntityNotFound(_0x810f74,null))[_0xcab9('0x24')](saveUpdates(_0x4df123[_0xcab9('0x57')],null))[_0xcab9('0x24')](function(_0x4822f8){if(_0x4822f8){_0x454fa4[_0xcab9('0x2c')]=_0x4822f8[_0xcab9('0x62')]({'plain':!![]});return db[_0xcab9('0x63')][_0xcab9('0x54')]({'where':{'id':_0x4822f8[_0xcab9('0x64')]}});}return null;})[_0xcab9('0x24')](handleEntityNotFound(_0x810f74,null))['then'](function(_0x436340){if(_0x436340){return _0x436340['update']({'UserId':_0x4df123['body'][_0xcab9('0x5f')],'read1stAt':_[_0xcab9('0x65')](_0x436340[_0xcab9('0x66')])?moment()[_0xcab9('0x5d')](_0xcab9('0x5e')):undefined});}return null;})[_0xcab9('0x24')](function(_0x15ff3e){if(_0x15ff3e){_0x454fa4[_0xcab9('0x67')]=_0x15ff3e[_0xcab9('0x62')]({'plain':!![]});interaction_log['info']('[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x4df123[_0xcab9('0x60')]['id'],_0x4df123[_0xcab9('0x60')][_0xcab9('0x39')],_0x4df123[_0xcab9('0x60')][_0xcab9('0x68')],_0x454fa4[_0xcab9('0x67')]['id'],_0x4df123['body']?JSON[_0xcab9('0x29')](_0x4df123[_0xcab9('0x57')]):_0xcab9('0x69'));return respondWithRpcPromise(_0xcab9('0x6a'),_0xcab9('0x6b'),_0x454fa4);}return null;})[_0xcab9('0x24')](function(_0x1517b7){var _0x2a6a47='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x1517b7['message'][_0xcab9('0x6c')];return db[_0xcab9('0x6d')][_0xcab9('0x43')](_0x2a6a47,{'type':db['Sequelize']['QueryTypes']['SELECT'],'raw':!![]})[_0xcab9('0x24')](function(_0x5137d7){return _0x5137d7;});})[_0xcab9('0x24')](function(_0x272f39){if(_0x272f39){_0x454fa4[_0xcab9('0x2c')][_0xcab9('0x6e')]=_0x272f39[0x0];if(!_0x4df123[_0xcab9('0x57')][_0xcab9('0x5f')])return;return db[_0xcab9('0x6f')][_0xcab9('0x54')]({'where':{'id':_0x4df123['body']['UserId'],'role':_0xcab9('0x61')},'attributes':['id',_0xcab9('0x39'),_0xcab9('0x70'),_0xcab9('0x71'),_0xcab9('0x72')],'raw':!![]});}return null;})[_0xcab9('0x24')](function(_0x1407fc){if(!_0x1407fc)return null;_0x454fa4[_0xcab9('0x2c')][_0xcab9('0x61')]=_0x1407fc;return _0x454fa4;})[_0xcab9('0x24')](function(_0x2681a9){if(_0x2681a9){if(_0x4df123[_0xcab9('0x57')][_0xcab9('0x73')]){_0x454fa4[_0xcab9('0x2c')][_0xcab9('0x74')]=util[_0xcab9('0x5d')]('SIP/%s',_0x4df123[_0xcab9('0x60')][_0xcab9('0x39')]);_0x454fa4['message'][_0xcab9('0x75')]=_0x454fa4['channel'];_0x454fa4['message'][_0xcab9('0x76')]=_0x454fa4[_0xcab9('0x75')];_0x454fa4['message']['event']='accept';return respondWithRpcPromise('EventManager','EventManager',{'event':_0xcab9('0x77'),'message':_0x454fa4[_0xcab9('0x2c')]},client9002)[_0xcab9('0x24')](function(){return _0x454fa4;});}return _0x454fa4;}return null;})[_0xcab9('0x24')](respondWithResult(_0x810f74,null))['catch'](handleError(_0x810f74,null));};var interaction_log=require(_0xcab9('0x16'))('sms-interactions');exports[_0xcab9('0x78')]=function(_0x58a2b1,_0x15426d,_0x49d87c){var _0x471b55={'agent':{},'channel':_0xcab9('0x5a')};if(_0x58a2b1[_0xcab9('0x57')]['id']){delete _0x58a2b1[_0xcab9('0x57')]['id'];}_0x58a2b1[_0xcab9('0x57')][_0xcab9('0x5f')]=_0x58a2b1[_0xcab9('0x57')][_0xcab9('0x5f')]||_0x58a2b1[_0xcab9('0x60')]['id'];_0x471b55['agent']['id']=_0x58a2b1[_0xcab9('0x57')][_0xcab9('0x5f')];return db[_0xcab9('0x3c')]['find']({'where':{'id':_0x58a2b1[_0xcab9('0x51')]['id'],'UserId':null}})[_0xcab9('0x24')](handleEntityNotFound(_0x15426d,null))[_0xcab9('0x24')](function(_0x504c17){if(_0x504c17){_0x471b55['message']=_0x504c17[_0xcab9('0x62')]({'plain':!![]});return db[_0xcab9('0x63')][_0xcab9('0x54')]({'where':{'id':_0x504c17['SmsInteractionId']}});}return null;})[_0xcab9('0x24')](handleEntityNotFound(_0x15426d,null))['then'](function(_0x4c84a9){if(_0x4c84a9){_0x471b55[_0xcab9('0x67')]=_0x4c84a9[_0xcab9('0x62')]({'plain':!![]});interaction_log[_0xcab9('0x25')](_0xcab9('0x79'),_0x58a2b1[_0xcab9('0x60')]['id'],_0x58a2b1['user'][_0xcab9('0x39')],_0x58a2b1[_0xcab9('0x60')]['role'],_0x471b55[_0xcab9('0x67')]['id'],_0x58a2b1['body']?JSON['stringify'](_0x58a2b1['body']):_0xcab9('0x69'));return respondWithRpcPromise('RejectMessage','rejectMessage',_0x471b55);}return null;})[_0xcab9('0x24')](function(_0x7c2d79){var _0x52aaf9='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x7c2d79['message'][_0xcab9('0x6c')];return db[_0xcab9('0x6d')][_0xcab9('0x43')](_0x52aaf9,{'type':db['Sequelize'][_0xcab9('0x7a')][_0xcab9('0x7b')],'raw':!![]})[_0xcab9('0x24')](function(_0x4696a0){return _0x4696a0;});})['then'](function(_0x34957d){if(_0x34957d){_0x471b55[_0xcab9('0x2c')][_0xcab9('0x6e')]=_0x34957d[0x0];if(!_0x58a2b1[_0xcab9('0x57')][_0xcab9('0x5f')])return;return db[_0xcab9('0x6f')]['find']({'where':{'id':_0x58a2b1[_0xcab9('0x57')][_0xcab9('0x5f')],'role':_0xcab9('0x61')},'attributes':['id',_0xcab9('0x39'),_0xcab9('0x70'),_0xcab9('0x71'),_0xcab9('0x72')],'raw':!![]});}return null;})[_0xcab9('0x24')](function(_0x2a080b){if(!_0x2a080b)return null;_0x471b55[_0xcab9('0x2c')][_0xcab9('0x61')]=_0x2a080b;return _0x471b55;})[_0xcab9('0x24')](function(_0x47ac27){if(_0x47ac27){_0x47ac27[_0xcab9('0x2c')][_0xcab9('0x74')]=util['format']('SIP/%s',_0x58a2b1['user']['name']);_0x47ac27['message']['channel']=_0x471b55[_0xcab9('0x75')];_0x47ac27[_0xcab9('0x2c')][_0xcab9('0x76')]=_0x471b55[_0xcab9('0x75')];_0x47ac27[_0xcab9('0x2c')][_0xcab9('0x7c')]=_0xcab9('0x78');respondWithRpcPromise('EventManager',_0xcab9('0x7d'),{'event':_0xcab9('0x7e'),'message':_0x47ac27['message']},client9002);return _0x471b55;}return null;})[_0xcab9('0x24')](respondWithResult(_0x15426d,null))[_0xcab9('0x2e')](handleError(_0x15426d,null));};exports[_0xcab9('0x30')]=function(_0x25b5bb,_0x4a2c6b,_0x1b4ff3){if(_0x25b5bb[_0xcab9('0x57')]['id']){delete _0x25b5bb[_0xcab9('0x57')]['id'];}var _0x12dfbb;return db[_0xcab9('0x3c')][_0xcab9('0x54')]({'where':{'id':_0x25b5bb[_0xcab9('0x51')]['id']}})[_0xcab9('0x24')](handleEntityNotFound(_0x4a2c6b,null))['then'](function(_0x432706){if(_0x432706){_0x12dfbb=_0x432706;return db[_0xcab9('0x7f')][_0xcab9('0x54')]({'where':{'id':_0x432706[_0xcab9('0x80')]}});}})[_0xcab9('0x24')](handleEntityNotFound(_0x4a2c6b,null))[_0xcab9('0x24')](function(_0x193570){if(_0x193570){logger['debug'](_0xcab9('0x81'),_0xcab9('0x30'),'received\x20delivery\x20report\x20from',_0x193570[_0xcab9('0x4b')],util[_0xcab9('0x82')](_0x25b5bb['body'],{'showHidden':![],'depth':null}));switch(_0x193570[_0xcab9('0x4b')]){case'twilio':if(_0x25b5bb['body']['MessageSid']&&_0x25b5bb[_0xcab9('0x57')][_0xcab9('0x83')]===_0x12dfbb['messageId']){return _0x12dfbb['update']({'read':!![]});}else{logger[_0xcab9('0x2a')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xcab9('0x30'),'twilio',util['inspect'](_0x25b5bb['body'],{'showHidden':![],'depth':null}));}break;case'plivo':if(_0x25b5bb[_0xcab9('0x57')][_0xcab9('0x84')]&&_0x25b5bb[_0xcab9('0x57')][_0xcab9('0x84')]===_0x12dfbb[_0xcab9('0x85')]&&_[_0xcab9('0x86')]([_0xcab9('0x87'),_0xcab9('0x88')],_0x25b5bb[_0xcab9('0x57')]['Status'])>=0x0){return _0x12dfbb[_0xcab9('0x56')]({'read':!![]});}else{logger[_0xcab9('0x2a')](_0xcab9('0x89'),_0xcab9('0x30'),_0xcab9('0x8a'),util[_0xcab9('0x82')](_0x25b5bb['body'],{'showHidden':![],'depth':null}));}break;case _0xcab9('0x8b'):var _0x4522f8=_0x25b5bb[_0xcab9('0x57')][_0xcab9('0x8c')][0x0];if(_0x4522f8[_0xcab9('0x30')][_0xcab9('0x8d')]===_0xcab9('0x8e')){return _0x12dfbb[_0xcab9('0x56')]({'read':!![]});}else{logger[_0xcab9('0x2a')](_0xcab9('0x89'),_0xcab9('0x30'),_0xcab9('0x8b'),util[_0xcab9('0x82')](_0x25b5bb[_0xcab9('0x57')],{'showHidden':![],'depth':null}));}break;}return _0x12dfbb;}})[_0xcab9('0x24')](respondWithResult(_0x4a2c6b,null))[_0xcab9('0x2e')](handleError(_0x4a2c6b,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index bd5050d..e87ad77 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 _0x9835=['exports','events','../../mysqldb','setMaxListeners','save','remove','emit','hasOwnProperty','hook'];(function(_0x295c11,_0x54b9e0){var _0xe56efc=function(_0x56d07d){while(--_0x56d07d){_0x295c11['push'](_0x295c11['shift']());}};_0xe56efc(++_0x54b9e0);}(_0x9835,0x184));var _0x5983=function(_0x5686a2,_0x318532){_0x5686a2=_0x5686a2-0x0;var _0x536c58=_0x9835[_0x5686a2];return _0x536c58;};'use strict';var EventEmitter=require(_0x5983('0x0'));var SmsMessage=require(_0x5983('0x1'))['db']['SmsMessage'];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0x5983('0x2')](0x0);var events={'afterCreate':_0x5983('0x3'),'afterUpdate':'update','afterDestroy':_0x5983('0x4')};function emitEvent(_0x2af005){return function(_0x7d10af,_0x2dbcdc,_0x41be1c){SmsMessageEvents[_0x5983('0x5')](_0x2af005+':'+_0x7d10af['id'],_0x7d10af);SmsMessageEvents[_0x5983('0x5')](_0x2af005,_0x7d10af);_0x41be1c(null);};}for(var e in events){if(events[_0x5983('0x6')](e)){var event=events[e];SmsMessage[_0x5983('0x7')](e,emitEvent(event));}}module[_0x5983('0x8')]=SmsMessageEvents; \ No newline at end of file +var _0x4b1b=['remove','emit','hasOwnProperty','hook','exports','events','SmsMessage','setMaxListeners'];(function(_0x3ff085,_0x27c92e){var _0x2b68c3=function(_0x37811e){while(--_0x37811e){_0x3ff085['push'](_0x3ff085['shift']());}};_0x2b68c3(++_0x27c92e);}(_0x4b1b,0x1c5));var _0xb4b1=function(_0x319fd6,_0x3c5f29){_0x319fd6=_0x319fd6-0x0;var _0x83b5ca=_0x4b1b[_0x319fd6];return _0x83b5ca;};'use strict';var EventEmitter=require(_0xb4b1('0x0'));var SmsMessage=require('../../mysqldb')['db'][_0xb4b1('0x1')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0xb4b1('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xb4b1('0x3')};function emitEvent(_0x56c7a5){return function(_0x4b2af2,_0x1652db,_0x21643c){SmsMessageEvents['emit'](_0x56c7a5+':'+_0x4b2af2['id'],_0x4b2af2);SmsMessageEvents[_0xb4b1('0x4')](_0x56c7a5,_0x4b2af2);_0x21643c(null);};}for(var e in events){if(events[_0xb4b1('0x5')](e)){var event=events[e];SmsMessage[_0xb4b1('0x6')](e,emitEvent(event));}}module[_0xb4b1('0x7')]=SmsMessageEvents; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.model.js b/server/api/smsMessage/smsMessage.model.js index c55a40f..325ef58 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 _0xe739=['https://platform.clickatell.com/messages','uuid','UTF-8','apiMessageId','bandwidth','https://messaging.bandwidth.com/api/v2/users/','accountId','/messages','applicationId','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','code','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','refid','status','intelepeer','Token\x20not\x20received','finally','lodash','../../config/logger','api','moment','rimraf','../../config/environment','./smsMessage.attributes','exports','define','SmsMessage','messageId','fti_sms_messages','body','FULLTEXT','direction','toLowerCase','out','secret','isNil','UserId','findOne','SmsInteractionId','then','update','createdAt','catch','SmsAccount','type','twilio','accountSid','authToken','phone','messages','remote','token','sid','afterCreate','error','SmsMessage,\x20%s,\x20%s,\x20%s','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','https://api.skebby.it/API/v1.0/REST/','username','password','smsMethod','sender','login?username=','&password=','split','sms','POST','session_key','total_sent','internal_order_id','deliveryReport','read','inspect','https://smsapi.connectel.se/api/v2/send/','requestid','connectel','clicksend','senderString','format','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','base64','http_code','data','queued_count','head','message_id','clickSend','Missing\x20parameters:\x20username,\x20password','plivo','authId','/api/sms/messages/','/status?token=','%s:%s','https://api.plivo.com/v1/Account/%s/Message/','toString','message_uuid','infobip','baseUrl','/auth/1/session','application/json','IBSSO\x20','Missing\x20parameters:\x20base_url','apiKey','login','text','timestamp','keys','sort','length','md5','digest','hex','signature=','GET','/external/get/send.php?','csc','clickatell'];(function(_0x32c707,_0x297d01){var _0x2b03f7=function(_0x39b7fb){while(--_0x39b7fb){_0x32c707['push'](_0x32c707['shift']());}};_0x2b03f7(++_0x297d01);}(_0xe739,0x105));var _0x9e73=function(_0x22a258,_0x42d12c){_0x22a258=_0x22a258-0x0;var _0x5d058a=_0xe739[_0x22a258];return _0x5d058a;};'use strict';var _=require(_0x9e73('0x0'));var util=require('util');var logger=require(_0x9e73('0x1'))(_0x9e73('0x2'));var moment=require(_0x9e73('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x9e73('0x4'));var config=require(_0x9e73('0x5'));var attributes=require(_0x9e73('0x6'));module[_0x9e73('0x7')]=function(_0x4cb2ed,_0x3db8fa){return _0x4cb2ed[_0x9e73('0x8')](_0x9e73('0x9'),attributes,{'tableName':'sms_messages','paranoid':![],'indexes':[{'name':_0x9e73('0xa'),'fields':[_0x9e73('0xa')]},{'name':_0x9e73('0xb'),'fields':[_0x9e73('0xc')],'type':_0x9e73('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x2edd7b,_0x52393d,_0x33ce2d){var _0x5f06cb=_0x4cb2ed['models'];var _0x145c76=_0x2edd7b['get']({'plain':!![]});if(_0x145c76[_0x9e73('0xe')][_0x9e73('0xf')]()==='in'||_0x145c76[_0x9e73('0xe')]['toLowerCase']()===_0x9e73('0x10')&&!_0x145c76[_0x9e73('0x11')]&&!_[_0x9e73('0x12')](_0x145c76[_0x9e73('0x13')])){_0x5f06cb['SmsInteraction'][_0x9e73('0x14')]({'where':{'id':_0x145c76[_0x9e73('0x15')]}})[_0x9e73('0x16')](function(_0x5be2fa){if(_0x5be2fa){_0x5be2fa[_0x9e73('0x17')]({'lastMsgAt':_0x145c76[_0x9e73('0x18')],'lastMsgDirection':_0x145c76['direction'][_0x9e73('0xf')]()});}})[_0x9e73('0x19')](function(_0x21bd3a){console['error'](_0x21bd3a);});}if(_0x145c76[_0x9e73('0xe')]==='out'&&!_0x145c76[_0x9e73('0x11')]){var _0x58bbaa;_0x5f06cb[_0x9e73('0x1a')]['find']({'where':{'id':_0x145c76['SmsAccountId']},'raw':!![]})[_0x9e73('0x16')](function(_0x3944fc){_0x58bbaa=_0x3944fc;if(_0x58bbaa&&_0x58bbaa[_0x9e73('0x1b')]){switch(_0x58bbaa[_0x9e73('0x1b')]){case _0x9e73('0x1c'):var _0x398a0d=require(_0x9e73('0x1c'));if(_0x58bbaa[_0x9e73('0x1d')]&&_0x58bbaa[_0x9e73('0x1e')]&&_0x58bbaa[_0x9e73('0x1f')]){var _0x4a5cd1=new _0x398a0d(_0x58bbaa[_0x9e73('0x1d')],_0x58bbaa['authToken']);_0x4a5cd1[_0x9e73('0x20')]['create']({'body':_0x145c76[_0x9e73('0xc')],'to':_0x145c76['phone'],'from':_0x58bbaa[_0x9e73('0x1f')],'statusCallback':_0x58bbaa[_0x9e73('0x21')]+'/api/sms/messages/'+_0x145c76['id']+'/status?token='+_0x58bbaa[_0x9e73('0x22')]})[_0x9e73('0x16')](function(_0x256ea1){if(_0x256ea1[_0x9e73('0x23')]){return _0x2edd7b[_0x9e73('0x17')]({'messageId':_0x256ea1['sid']});}})[_0x9e73('0x19')](function(_0x3a845c){logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x9e73('0x24'),'twilio',util['inspect'](_0x3a845c,{'showHidden':![],'depth':null}));});}else{logger[_0x9e73('0x25')](_0x9e73('0x26'),_0x9e73('0x24'),'twilio',_0x9e73('0x27'));}break;case _0x9e73('0x28'):var _0x4e77bb=_0x9e73('0x29');if(_0x58bbaa[_0x9e73('0x2a')]&&_0x58bbaa[_0x9e73('0x2b')]){var _0x397bd6={'recipient':[_0x145c76[_0x9e73('0x1f')]],'message':_0x145c76['body'],'message_type':_0x58bbaa[_0x9e73('0x2c')]};if(_0x58bbaa['smsMethod']&&_0x58bbaa[_0x9e73('0x2c')]!=='SI'){_0x397bd6[_0x9e73('0x2d')]=_0x58bbaa[_0x9e73('0x1f')];}var _0x1b4b9e={'url':_0x4e77bb+_0x9e73('0x2e')+_0x58bbaa['username']+_0x9e73('0x2f')+_0x58bbaa[_0x9e73('0x2b')],'method':'GET'};rp(_0x1b4b9e)['then'](function(_0x296b93){var _0x38593a=_0x296b93[_0x9e73('0x30')](';');var _0x25d6b9={'user_key':_0x38593a[0x0],'session_key':_0x38593a[0x1]};_0x1b4b9e={'url':_0x4e77bb+_0x9e73('0x31'),'method':_0x9e73('0x32'),'headers':{'user_key':_0x25d6b9['user_key'],'Session_key':_0x25d6b9[_0x9e73('0x33')]},'json':!![],'body':_0x397bd6};return rp(_0x1b4b9e);})[_0x9e73('0x16')](function(_0x1a52ca){if(_0x1a52ca[_0x9e73('0x34')]>=0x1){var _0x3c7936={'messageId':_0x1a52ca[_0x9e73('0x35')]};if(_0x58bbaa[_0x9e73('0x2c')]!=='GP'||!_0x58bbaa[_0x9e73('0x36')]){_0x3c7936[_0x9e73('0x37')]=!![];}return _0x2edd7b[_0x9e73('0x17')](_0x3c7936);}else{return logger['error'](_0x9e73('0x26'),_0x9e73('0x24'),_0x9e73('0x28'),util[_0x9e73('0x38')](_0x1a52ca,{'showHidden':![],'depth':null}));}})['catch'](function(_0x3d2608){return logger[_0x9e73('0x25')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x9e73('0x28'),util[_0x9e73('0x38')](_0x3d2608,{'showHidden':![],'depth':null}));});}else{logger[_0x9e73('0x25')](_0x9e73('0x26'),_0x9e73('0x24'),_0x9e73('0x28'),'Missing\x20parameters:\x20username,\x20password');}break;case'connectel':if(_0x58bbaa['authToken']){var _0x2ea753={'recipient':_0x145c76[_0x9e73('0x1f')],'message':_0x145c76[_0x9e73('0xc')],'sender':_0x58bbaa['senderString']||_0x58bbaa['phone'],'authorization':_0x58bbaa['authToken']};var _0x52393d={'method':_0x9e73('0x32'),'uri':_0x9e73('0x39'),'body':_0x2ea753,'json':!![]};rp(_0x52393d)[_0x9e73('0x16')](function(_0x541171){var _0x1992c3={'messageId':_0x541171[_0x9e73('0x3a')]};if(!_0x58bbaa[_0x9e73('0x36')]){_0x1992c3[_0x9e73('0x37')]=!![];}return _0x2edd7b[_0x9e73('0x17')](_0x1992c3);})[_0x9e73('0x19')](function(_0x15444b){logger[_0x9e73('0x25')](_0x9e73('0x26'),_0x9e73('0x24'),'connectel',util['inspect'](_0x15444b,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x9e73('0x24'),_0x9e73('0x3b'),'Missing\x20parameters:\x20authToken');}break;case _0x9e73('0x3c'):if(_0x58bbaa[_0x9e73('0x2a')]&&_0x58bbaa['password']){var _0x2ea753={'messages':[{'source':'xCALLY\x20Motion','to':_0x145c76['phone'],'body':_0x145c76['body'],'from':_0x58bbaa[_0x9e73('0x3d')]||_0x58bbaa[_0x9e73('0x1f')]}]};var _0x18f5e4=util[_0x9e73('0x3e')]('%s:%s',_0x58bbaa['username'],_0x58bbaa[_0x9e73('0x2b')]);var _0x52393d={'method':_0x9e73('0x32'),'uri':_0x9e73('0x3f'),'body':_0x2ea753,'headers':{'Authorization':util[_0x9e73('0x3e')](_0x9e73('0x40'),new Buffer(_0x18f5e4)['toString'](_0x9e73('0x41')))},'json':!![]};rp(_0x52393d)[_0x9e73('0x16')](function(_0x5dcca7){if(_0x5dcca7[_0x9e73('0x42')]>=0xc8&&_0x5dcca7[_0x9e73('0x42')]<=0xce){if(_0x5dcca7['data']&&_0x5dcca7[_0x9e73('0x43')][_0x9e73('0x44')]>0x0){var _0x4ea68c=_[_0x9e73('0x45')](_0x5dcca7[_0x9e73('0x43')][_0x9e73('0x20')]);var _0x343391={'messageId':_0x4ea68c[_0x9e73('0x46')]};if(!_0x58bbaa[_0x9e73('0x36')]){_0x343391[_0x9e73('0x37')]=!![];}return _0x2edd7b[_0x9e73('0x17')](_0x343391);}else{logger[_0x9e73('0x25')](_0x9e73('0x26'),_0x9e73('0x24'),_0x9e73('0x47'),util[_0x9e73('0x38')](_0x5dcca7,{'showHidden':![],'depth':null}));}}else{logger[_0x9e73('0x25')](_0x9e73('0x26'),_0x9e73('0x24'),'clickSend',util[_0x9e73('0x38')](_0x5dcca7,{'showHidden':![],'depth':null}));}})['catch'](function(_0x4e8c96){logger[_0x9e73('0x25')](_0x9e73('0x26'),'afterCreate','clickSend',util[_0x9e73('0x38')](_0x4e8c96,{'showHidden':![],'depth':null}));});}else{logger[_0x9e73('0x25')](_0x9e73('0x26'),_0x9e73('0x24'),_0x9e73('0x47'),_0x9e73('0x48'));}break;case _0x9e73('0x49'):if(_0x58bbaa[_0x9e73('0x4a')]&&_0x58bbaa[_0x9e73('0x1e')]){var _0x2ea753={'dst':_0x145c76[_0x9e73('0x1f')],'text':_0x145c76[_0x9e73('0xc')],'src':_0x58bbaa[_0x9e73('0x3d')]||_0x58bbaa[_0x9e73('0x1f')],'url':_0x58bbaa['remote']+_0x9e73('0x4b')+_0x145c76['id']+_0x9e73('0x4c')+_0x58bbaa[_0x9e73('0x22')]};var _0x18f5e4=util[_0x9e73('0x3e')](_0x9e73('0x4d'),_0x58bbaa[_0x9e73('0x4a')],_0x58bbaa[_0x9e73('0x1e')]);var _0x52393d={'method':'POST','uri':util['format'](_0x9e73('0x4e'),_0x58bbaa['authId']),'body':_0x2ea753,'headers':{'Authorization':util[_0x9e73('0x3e')]('Basic\x20%s',new Buffer(_0x18f5e4)[_0x9e73('0x4f')]('base64'))},'json':!![]};rp(_0x52393d)[_0x9e73('0x16')](function(_0x184f79){var _0x23e23d={'messageId':_0x184f79[_0x9e73('0x50')][0x0]};return _0x2edd7b[_0x9e73('0x17')](_0x23e23d);})[_0x9e73('0x19')](function(_0x1269d5){logger['error'](_0x9e73('0x26'),'afterCreate',_0x9e73('0x49'),util[_0x9e73('0x38')](_0x1269d5,{'showHidden':![],'depth':null}));});}else{logger[_0x9e73('0x25')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x9e73('0x24'),_0x9e73('0x49'),'Missing\x20parameters:\x20authId,\x20authToken');}break;case _0x9e73('0x51'):if(_0x58bbaa[_0x9e73('0x2a')]&&_0x58bbaa[_0x9e73('0x2b')]){if(_0x58bbaa[_0x9e73('0x52')]){var _0x3b1b14={'method':'POST','uri':_0x58bbaa[_0x9e73('0x52')]+_0x9e73('0x53'),'body':{'username':_0x58bbaa['username'],'password':_0x58bbaa[_0x9e73('0x2b')]},'json':!![]};return rp(_0x3b1b14)[_0x9e73('0x16')](function(_0x188b14){var _0x4f622a={'method':_0x9e73('0x32'),'uri':_0x58bbaa[_0x9e73('0x52')]+'/sms/2/text/advanced','body':{'messages':[{'from':_0x58bbaa[_0x9e73('0x1f')],'destinations':[{'to':_0x145c76[_0x9e73('0x1f')]}],'text':_0x145c76[_0x9e73('0xc')],'notifyUrl':_0x58bbaa[_0x9e73('0x21')]+_0x9e73('0x4b')+_0x145c76['id']+_0x9e73('0x4c')+_0x58bbaa[_0x9e73('0x22')],'notifyContentType':_0x9e73('0x54'),'callbackData':_0x58bbaa[_0x9e73('0x1f')]+';'+_0x145c76[_0x9e73('0xc')]}]},'headers':{'Authorization':_0x9e73('0x55')+_0x188b14[_0x9e73('0x22')]},'json':!![]};return rp(_0x4f622a)['then'](function(_0x16d781){if(_0x16d781[_0x9e73('0x20')]){var _0x3474d1={'messageId':_0x16d781['messages'][0x0]['messageId']};if(!_0x58bbaa[_0x9e73('0x36')]){_0x3474d1[_0x9e73('0x37')]=!![];}return _0x2edd7b[_0x9e73('0x17')](_0x3474d1);}else{return logger[_0x9e73('0x25')](_0x9e73('0x26'),_0x9e73('0x24'),_0x9e73('0x51'),util[_0x9e73('0x38')](_0x16d781,{'showHidden':![],'depth':null}));}});})[_0x9e73('0x19')](function(_0x17bf77){return logger[_0x9e73('0x25')](_0x9e73('0x26'),'afterCreate',_0x9e73('0x51'),util[_0x9e73('0x38')](_0x17bf77,{'showHidden':![],'depth':null}));});}else{logger[_0x9e73('0x25')](_0x9e73('0x26'),_0x9e73('0x24'),_0x9e73('0x51'),_0x9e73('0x56'));}}else{logger[_0x9e73('0x25')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x9e73('0x51'),'Missing\x20parameters:\x20username,\x20password');}break;case'csc':var _0x286f5e=require('crypto');if(_0x58bbaa[_0x9e73('0x57')]){var _0x40e34e={};_0x40e34e[_0x9e73('0x58')]=_0x58bbaa[_0x9e73('0x2a')];_0x40e34e[_0x9e73('0x1f')]=_0x145c76['phone'];_0x40e34e['sender']=_0x58bbaa[_0x9e73('0x1f')];_0x40e34e[_0x9e73('0x59')]=_0x145c76[_0x9e73('0xc')];_0x40e34e[_0x9e73('0x5a')]=+new Date();var _0xf3fad3='';var _0x2eed31='';var _0x2be436=Object[_0x9e73('0x5b')](_0x40e34e);_0x2be436[_0x9e73('0x5c')]();for(var _0xc0c76f=0x0;_0xc0c76f<_0x2be436[_0x9e73('0x5d')];_0xc0c76f++){if(_0xf3fad3!=''){_0xf3fad3+='&';}_0xf3fad3+=_0x2be436[_0xc0c76f]+'='+encodeURIComponent(_0x40e34e[_0x2be436[_0xc0c76f]]);_0x2eed31+=_0x40e34e[_0x2be436[_0xc0c76f]];}_0x2eed31+=_0x58bbaa[_0x9e73('0x57')];_0x2eed31=_0x286f5e['createHash'](_0x9e73('0x5e'))[_0x9e73('0x17')](_0x2eed31)[_0x9e73('0x5f')](_0x9e73('0x60'));if(_0xf3fad3!==''){_0xf3fad3+='&';}_0xf3fad3+=_0x9e73('0x61')+_0x2eed31;var _0x1b4b9e={'method':_0x9e73('0x62'),'uri':_0x58bbaa[_0x9e73('0x52')]+_0x9e73('0x63')+_0xf3fad3,'json':!![]};return rp(_0x1b4b9e)[_0x9e73('0x16')](function(_0x192625){var _0xdef4ea=Object[_0x9e73('0x5b')](_0x192625);if(_0x192625[_0xdef4ea[0x0]][_0x9e73('0x25')]&&parseInt(_0x192625[_0xdef4ea[0x0]][_0x9e73('0x25')])===0x0){var _0x11d3f1={'messageId':_0x192625[_0xdef4ea[0x0]]['id_sms']};if(!_0x58bbaa[_0x9e73('0x36')]){_0x11d3f1[_0x9e73('0x37')]=!![];}return _0x2edd7b[_0x9e73('0x17')](_0x11d3f1);}else{return logger[_0x9e73('0x25')](_0x9e73('0x26'),'afterCreate',_0x9e73('0x64'),util['inspect'](_0x192625[_0x9e73('0x25')],{'showHidden':![],'depth':null}));}})['catch'](function(_0x5299d0){return logger[_0x9e73('0x25')](_0x9e73('0x26'),'afterCreate',_0x9e73('0x64'),util[_0x9e73('0x38')](_0x5299d0,{'showHidden':![],'depth':null}));});}else{logger[_0x9e73('0x25')](_0x9e73('0x26'),_0x9e73('0x24'),_0x9e73('0x64'),'Missing\x20parameters:\x20apiKey');}break;case _0x9e73('0x65'):if(_0x58bbaa[_0x9e73('0x57')]){var _0x5d0dd7={'method':_0x9e73('0x32'),'uri':_0x9e73('0x66'),'headers':{'Authorization':_0x58bbaa[_0x9e73('0x57')]},'body':{'content':_0x145c76[_0x9e73('0xc')],'to':[_0x145c76['phone']],'from':_0x58bbaa['phone'],'binary':![],'clientMessageId':_0x9e73('0x67'),'charset':_0x9e73('0x68')},'json':!![]};rp(_0x5d0dd7)['then'](function(_0x587c43){if(!_0x587c43[_0x9e73('0x25')]){var _0x310fcb={'messageId':_0x587c43[_0x9e73('0x20')][0x0][_0x9e73('0x69')]};if(!_0x58bbaa[_0x9e73('0x36')]){_0x310fcb[_0x9e73('0x37')]=!![];}return _0x2edd7b[_0x9e73('0x17')](_0x310fcb);}else{return logger[_0x9e73('0x25')](_0x9e73('0x26'),_0x9e73('0x24'),_0x9e73('0x65'),util['inspect'](_0x587c43[_0x9e73('0x25')],{'showHidden':![],'depth':null}));}})[_0x9e73('0x19')](function(_0x446b5a){return logger[_0x9e73('0x25')](_0x9e73('0x26'),'afterCreate','clickatell',util['inspect'](_0x446b5a,{'showHidden':![],'depth':null}));});}else{logger[_0x9e73('0x25')](_0x9e73('0x26'),'afterCreate',_0x9e73('0x65'),'Missing\x20parameters:\x20apiKey');}break;case _0x9e73('0x6a'):if(_0x58bbaa['username']&&_0x58bbaa['password']){var _0x18f5e4=util['format']('%s:%s',_0x58bbaa['username'],_0x58bbaa[_0x9e73('0x2b')]);var _0x52393d={'method':_0x9e73('0x32'),'uri':_0x9e73('0x6b')+_0x58bbaa[_0x9e73('0x6c')]+_0x9e73('0x6d'),'body':{'to':[_0x145c76[_0x9e73('0x1f')]],'text':_0x145c76[_0x9e73('0xc')],'from':_0x58bbaa[_0x9e73('0x1f')],'applicationId':_0x58bbaa[_0x9e73('0x6e')]},'headers':{'Authorization':util[_0x9e73('0x3e')](_0x9e73('0x40'),new Buffer(_0x18f5e4)[_0x9e73('0x4f')]('base64'))},'json':!![]};rp(_0x52393d)[_0x9e73('0x16')](function(_0x4da984){if(_0x4da984['id']){var _0x3e7d62={'messageId':_0x4da984['id']};return _0x2edd7b[_0x9e73('0x17')](_0x3e7d62);}else{logger[_0x9e73('0x25')](_0x9e73('0x26'),_0x9e73('0x24'),_0x9e73('0x6a'),util[_0x9e73('0x38')](_0x4da984,{'showHidden':![],'depth':null}));}})[_0x9e73('0x19')](function(_0x1d306b){logger[_0x9e73('0x25')](_0x9e73('0x26'),_0x9e73('0x24'),_0x9e73('0x6a'),util[_0x9e73('0x38')](_0x1d306b,{'showHidden':![],'depth':null}));});}else{logger[_0x9e73('0x25')](_0x9e73('0x26'),'afterCreate',_0x9e73('0x6a'),_0x9e73('0x48'));}break;case'intelepeer':if(_0x58bbaa[_0x9e73('0x57')]){var _0x441845={};var _0x1b4b9e={'method':'POST','uri':_0x9e73('0x6f'),'headers':{'Authorization':_0x9e73('0x70')+_0x58bbaa[_0x9e73('0x57')],'Content-Type':_0x9e73('0x54')},'body':{'from':_0x58bbaa[_0x9e73('0x1f')],'to':_0x145c76[_0x9e73('0x1f')],'text':_0x145c76['body']},'json':!![]};return rp(_0x1b4b9e)[_0x9e73('0x16')](function(_0x21b34e){if(_0x21b34e[_0x9e73('0x71')]==0xca){_0x441845[_0x9e73('0x72')]=_0x21b34e;var _0x3c8915={'method':_0x9e73('0x32'),'uri':_0x9e73('0x73'),'headers':{'Authorization':_0x9e73('0x70')+_0x58bbaa['apiKey'],'Content-Type':'application/json'},'body':{'refid':_0x441845['message'][_0x9e73('0x74')]},'json':!![]};return rp(_0x3c8915)[_0x9e73('0x16')](function(_0x3043e4){_0x441845[_0x9e73('0x75')]=_0x3043e4;var _0x5d5afc={'messageId':_0x441845['message'][_0x9e73('0x74')],'read':!![]};return _0x2edd7b[_0x9e73('0x17')](_0x5d5afc);});}else{return logger[_0x9e73('0x25')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x9e73('0x24'),_0x9e73('0x76'),util[_0x9e73('0x38')](_0x21b34e,{'showHidden':![],'depth':null}));}})[_0x9e73('0x19')](function(_0x5afc9d){return logger['error'](_0x9e73('0x26'),_0x9e73('0x24'),'intelepeer',util['inspect'](_0x5afc9d,{'showHidden':![],'depth':null}));});}else{return logger[_0x9e73('0x25')](_0x9e73('0x26'),'afterCreate',_0x9e73('0x76'),_0x9e73('0x77'));}break;}}})[_0x9e73('0x78')](function(){_0x33ce2d();});}else{_0x33ce2d();}}},'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x8db0=['isNil','UserId','SmsInteraction','findOne','update','createdAt','find','SmsAccountId','then','type','twilio','accountSid','authToken','phone','messages','create','body','/status?token=','token','sid','catch','afterCreate','error','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','https://api.skebby.it/API/v1.0/REST/','username','smsMethod','login?username=','password','GET','split','sms','POST','session_key','deliveryReport','read','SmsMessage,\x20%s,\x20%s,\x20%s','inspect','Missing\x20parameters:\x20username,\x20password','senderString','https://smsapi.connectel.se/api/v2/send/','connectel','clicksend','xCALLY\x20Motion','format','%s:%s','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','toString','base64','http_code','data','queued_count','head','message_id','clickSend','plivo','authId','https://api.plivo.com/v1/Account/%s/Message/','message_uuid','Missing\x20parameters:\x20authId,\x20authToken','baseUrl','/auth/1/session','remote','/api/sms/messages/','IBSSO\x20','infobip','csc','crypto','apiKey','login','sender','text','timestamp','keys','sort','length','createHash','md5','digest','hex','/external/get/send.php?','id_sms','Missing\x20parameters:\x20apiKey','clickatell','https://platform.clickatell.com/messages','uuid','UTF-8','apiMessageId','bandwidth','/messages','applicationId','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','application/json','code','message','status','finally','utf8mb4','lodash','util','api','moment','bluebird','path','exports','SmsMessage','sms_messages','messageId','fti_sms_messages','models','get','direction','toLowerCase','out','secret'];(function(_0x54d4fe,_0x55e869){var _0x1ab5bb=function(_0x5b1af2){while(--_0x5b1af2){_0x54d4fe['push'](_0x54d4fe['shift']());}};_0x1ab5bb(++_0x55e869);}(_0x8db0,0x65));var _0x08db=function(_0x11e05d,_0x3a4491){_0x11e05d=_0x11e05d-0x0;var _0x335588=_0x8db0[_0x11e05d];return _0x335588;};'use strict';var _=require(_0x08db('0x0'));var util=require(_0x08db('0x1'));var logger=require('../../config/logger')(_0x08db('0x2'));var moment=require(_0x08db('0x3'));var BPromise=require(_0x08db('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x08db('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./smsMessage.attributes');module[_0x08db('0x6')]=function(_0x55af6b,_0x14b0e6){return _0x55af6b['define'](_0x08db('0x7'),attributes,{'tableName':_0x08db('0x8'),'paranoid':![],'indexes':[{'name':_0x08db('0x9'),'fields':[_0x08db('0x9')]},{'name':_0x08db('0xa'),'fields':['body'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x182b0c,_0x2fe457,_0x1242af){var _0x2d623c=_0x55af6b[_0x08db('0xb')];var _0x16ad14=_0x182b0c[_0x08db('0xc')]({'plain':!![]});if(_0x16ad14[_0x08db('0xd')][_0x08db('0xe')]()==='in'||_0x16ad14[_0x08db('0xd')][_0x08db('0xe')]()===_0x08db('0xf')&&!_0x16ad14[_0x08db('0x10')]&&!_[_0x08db('0x11')](_0x16ad14[_0x08db('0x12')])){_0x2d623c[_0x08db('0x13')][_0x08db('0x14')]({'where':{'id':_0x16ad14['SmsInteractionId']}})['then'](function(_0x541875){if(_0x541875){_0x541875[_0x08db('0x15')]({'lastMsgAt':_0x16ad14[_0x08db('0x16')],'lastMsgDirection':_0x16ad14[_0x08db('0xd')][_0x08db('0xe')]()});}})['catch'](function(_0x13345a){console['error'](_0x13345a);});}if(_0x16ad14[_0x08db('0xd')]==='out'&&!_0x16ad14[_0x08db('0x10')]){var _0x1b9169;_0x2d623c['SmsAccount'][_0x08db('0x17')]({'where':{'id':_0x16ad14[_0x08db('0x18')]},'raw':!![]})[_0x08db('0x19')](function(_0x4c9830){_0x1b9169=_0x4c9830;if(_0x1b9169&&_0x1b9169[_0x08db('0x1a')]){switch(_0x1b9169[_0x08db('0x1a')]){case _0x08db('0x1b'):var _0x27dc5c=require(_0x08db('0x1b'));if(_0x1b9169[_0x08db('0x1c')]&&_0x1b9169[_0x08db('0x1d')]&&_0x1b9169[_0x08db('0x1e')]){var _0x46e555=new _0x27dc5c(_0x1b9169[_0x08db('0x1c')],_0x1b9169['authToken']);_0x46e555[_0x08db('0x1f')][_0x08db('0x20')]({'body':_0x16ad14[_0x08db('0x21')],'to':_0x16ad14[_0x08db('0x1e')],'from':_0x1b9169['phone'],'statusCallback':_0x1b9169['remote']+'/api/sms/messages/'+_0x16ad14['id']+_0x08db('0x22')+_0x1b9169[_0x08db('0x23')]})['then'](function(_0x49b072){if(_0x49b072['sid']){return _0x182b0c['update']({'messageId':_0x49b072[_0x08db('0x24')]});}})[_0x08db('0x25')](function(_0xa44dce){logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x08db('0x26'),'twilio',util['inspect'](_0xa44dce,{'showHidden':![],'depth':null}));});}else{logger[_0x08db('0x27')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x08db('0x26'),_0x08db('0x1b'),_0x08db('0x28'));}break;case _0x08db('0x29'):var _0x18911f=_0x08db('0x2a');if(_0x1b9169[_0x08db('0x2b')]&&_0x1b9169['password']){var _0x40e0d2={'recipient':[_0x16ad14[_0x08db('0x1e')]],'message':_0x16ad14[_0x08db('0x21')],'message_type':_0x1b9169[_0x08db('0x2c')]};if(_0x1b9169[_0x08db('0x2c')]&&_0x1b9169[_0x08db('0x2c')]!=='SI'){_0x40e0d2['sender']=_0x1b9169['phone'];}var _0x5de081={'url':_0x18911f+_0x08db('0x2d')+_0x1b9169['username']+'&password='+_0x1b9169[_0x08db('0x2e')],'method':_0x08db('0x2f')};rp(_0x5de081)[_0x08db('0x19')](function(_0xe09027){var _0x39c8b2=_0xe09027[_0x08db('0x30')](';');var _0x4b2c69={'user_key':_0x39c8b2[0x0],'session_key':_0x39c8b2[0x1]};_0x5de081={'url':_0x18911f+_0x08db('0x31'),'method':_0x08db('0x32'),'headers':{'user_key':_0x4b2c69['user_key'],'Session_key':_0x4b2c69[_0x08db('0x33')]},'json':!![],'body':_0x40e0d2};return rp(_0x5de081);})[_0x08db('0x19')](function(_0x2b95bf){if(_0x2b95bf['total_sent']>=0x1){var _0x2ef037={'messageId':_0x2b95bf['internal_order_id']};if(_0x1b9169[_0x08db('0x2c')]!=='GP'||!_0x1b9169[_0x08db('0x34')]){_0x2ef037[_0x08db('0x35')]=!![];}return _0x182b0c[_0x08db('0x15')](_0x2ef037);}else{return logger[_0x08db('0x27')](_0x08db('0x36'),_0x08db('0x26'),_0x08db('0x29'),util[_0x08db('0x37')](_0x2b95bf,{'showHidden':![],'depth':null}));}})[_0x08db('0x25')](function(_0x593021){return logger['error'](_0x08db('0x36'),_0x08db('0x26'),_0x08db('0x29'),util[_0x08db('0x37')](_0x593021,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x08db('0x26'),'skebby',_0x08db('0x38'));}break;case'connectel':if(_0x1b9169[_0x08db('0x1d')]){var _0x1feaf6={'recipient':_0x16ad14[_0x08db('0x1e')],'message':_0x16ad14['body'],'sender':_0x1b9169[_0x08db('0x39')]||_0x1b9169[_0x08db('0x1e')],'authorization':_0x1b9169[_0x08db('0x1d')]};var _0x2fe457={'method':_0x08db('0x32'),'uri':_0x08db('0x3a'),'body':_0x1feaf6,'json':!![]};rp(_0x2fe457)[_0x08db('0x19')](function(_0x59f077){var _0x713418={'messageId':_0x59f077['requestid']};if(!_0x1b9169[_0x08db('0x34')]){_0x713418['read']=!![];}return _0x182b0c[_0x08db('0x15')](_0x713418);})[_0x08db('0x25')](function(_0x2d7c97){logger[_0x08db('0x27')](_0x08db('0x36'),_0x08db('0x26'),_0x08db('0x3b'),util[_0x08db('0x37')](_0x2d7c97,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x08db('0x36'),'afterCreate',_0x08db('0x3b'),'Missing\x20parameters:\x20authToken');}break;case _0x08db('0x3c'):if(_0x1b9169[_0x08db('0x2b')]&&_0x1b9169[_0x08db('0x2e')]){var _0x1feaf6={'messages':[{'source':_0x08db('0x3d'),'to':_0x16ad14[_0x08db('0x1e')],'body':_0x16ad14[_0x08db('0x21')],'from':_0x1b9169[_0x08db('0x39')]||_0x1b9169[_0x08db('0x1e')]}]};var _0x59638f=util[_0x08db('0x3e')](_0x08db('0x3f'),_0x1b9169[_0x08db('0x2b')],_0x1b9169['password']);var _0x2fe457={'method':_0x08db('0x32'),'uri':_0x08db('0x40'),'body':_0x1feaf6,'headers':{'Authorization':util[_0x08db('0x3e')](_0x08db('0x41'),new Buffer(_0x59638f)[_0x08db('0x42')](_0x08db('0x43')))},'json':!![]};rp(_0x2fe457)[_0x08db('0x19')](function(_0x88926d){if(_0x88926d[_0x08db('0x44')]>=0xc8&&_0x88926d['http_code']<=0xce){if(_0x88926d[_0x08db('0x45')]&&_0x88926d[_0x08db('0x45')][_0x08db('0x46')]>0x0){var _0x3c11a1=_[_0x08db('0x47')](_0x88926d[_0x08db('0x45')][_0x08db('0x1f')]);var _0x500552={'messageId':_0x3c11a1[_0x08db('0x48')]};if(!_0x1b9169[_0x08db('0x34')]){_0x500552[_0x08db('0x35')]=!![];}return _0x182b0c[_0x08db('0x15')](_0x500552);}else{logger[_0x08db('0x27')](_0x08db('0x36'),_0x08db('0x26'),_0x08db('0x49'),util['inspect'](_0x88926d,{'showHidden':![],'depth':null}));}}else{logger[_0x08db('0x27')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x08db('0x26'),'clickSend',util[_0x08db('0x37')](_0x88926d,{'showHidden':![],'depth':null}));}})[_0x08db('0x25')](function(_0x5d6c27){logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x08db('0x26'),_0x08db('0x49'),util[_0x08db('0x37')](_0x5d6c27,{'showHidden':![],'depth':null}));});}else{logger[_0x08db('0x27')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x08db('0x26'),_0x08db('0x49'),_0x08db('0x38'));}break;case _0x08db('0x4a'):if(_0x1b9169['authId']&&_0x1b9169['authToken']){var _0x1feaf6={'dst':_0x16ad14[_0x08db('0x1e')],'text':_0x16ad14[_0x08db('0x21')],'src':_0x1b9169['senderString']||_0x1b9169['phone'],'url':_0x1b9169['remote']+'/api/sms/messages/'+_0x16ad14['id']+_0x08db('0x22')+_0x1b9169[_0x08db('0x23')]};var _0x59638f=util['format'](_0x08db('0x3f'),_0x1b9169[_0x08db('0x4b')],_0x1b9169['authToken']);var _0x2fe457={'method':_0x08db('0x32'),'uri':util[_0x08db('0x3e')](_0x08db('0x4c'),_0x1b9169['authId']),'body':_0x1feaf6,'headers':{'Authorization':util[_0x08db('0x3e')](_0x08db('0x41'),new Buffer(_0x59638f)[_0x08db('0x42')](_0x08db('0x43')))},'json':!![]};rp(_0x2fe457)['then'](function(_0x44e663){var _0x529183={'messageId':_0x44e663[_0x08db('0x4d')][0x0]};return _0x182b0c[_0x08db('0x15')](_0x529183);})['catch'](function(_0x257175){logger[_0x08db('0x27')](_0x08db('0x36'),_0x08db('0x26'),'plivo',util[_0x08db('0x37')](_0x257175,{'showHidden':![],'depth':null}));});}else{logger[_0x08db('0x27')](_0x08db('0x36'),'afterCreate',_0x08db('0x4a'),_0x08db('0x4e'));}break;case'infobip':if(_0x1b9169[_0x08db('0x2b')]&&_0x1b9169[_0x08db('0x2e')]){if(_0x1b9169[_0x08db('0x4f')]){var _0x497ed5={'method':'POST','uri':_0x1b9169[_0x08db('0x4f')]+_0x08db('0x50'),'body':{'username':_0x1b9169[_0x08db('0x2b')],'password':_0x1b9169[_0x08db('0x2e')]},'json':!![]};return rp(_0x497ed5)['then'](function(_0x55e05a){var _0x4deca1={'method':_0x08db('0x32'),'uri':_0x1b9169['baseUrl']+'/sms/2/text/advanced','body':{'messages':[{'from':_0x1b9169[_0x08db('0x1e')],'destinations':[{'to':_0x16ad14[_0x08db('0x1e')]}],'text':_0x16ad14[_0x08db('0x21')],'notifyUrl':_0x1b9169[_0x08db('0x51')]+_0x08db('0x52')+_0x16ad14['id']+'/status?token='+_0x1b9169[_0x08db('0x23')],'notifyContentType':'application/json','callbackData':_0x1b9169['phone']+';'+_0x16ad14[_0x08db('0x21')]}]},'headers':{'Authorization':_0x08db('0x53')+_0x55e05a['token']},'json':!![]};return rp(_0x4deca1)[_0x08db('0x19')](function(_0x272ada){if(_0x272ada[_0x08db('0x1f')]){var _0x5742f5={'messageId':_0x272ada[_0x08db('0x1f')][0x0][_0x08db('0x9')]};if(!_0x1b9169['deliveryReport']){_0x5742f5['read']=!![];}return _0x182b0c['update'](_0x5742f5);}else{return logger[_0x08db('0x27')](_0x08db('0x36'),'afterCreate',_0x08db('0x54'),util[_0x08db('0x37')](_0x272ada,{'showHidden':![],'depth':null}));}});})[_0x08db('0x25')](function(_0x4b773e){return logger[_0x08db('0x27')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x08db('0x26'),_0x08db('0x54'),util[_0x08db('0x37')](_0x4b773e,{'showHidden':![],'depth':null}));});}else{logger[_0x08db('0x27')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x08db('0x26'),_0x08db('0x54'),'Missing\x20parameters:\x20base_url');}}else{logger[_0x08db('0x27')](_0x08db('0x36'),_0x08db('0x26'),_0x08db('0x54'),'Missing\x20parameters:\x20username,\x20password');}break;case _0x08db('0x55'):var _0x4ace4e=require(_0x08db('0x56'));if(_0x1b9169[_0x08db('0x57')]){var _0x4c6614={};_0x4c6614[_0x08db('0x58')]=_0x1b9169[_0x08db('0x2b')];_0x4c6614['phone']=_0x16ad14[_0x08db('0x1e')];_0x4c6614[_0x08db('0x59')]=_0x1b9169['phone'];_0x4c6614[_0x08db('0x5a')]=_0x16ad14[_0x08db('0x21')];_0x4c6614[_0x08db('0x5b')]=+new Date();var _0x43c76c='';var _0x23a99b='';var _0x5b07b3=Object[_0x08db('0x5c')](_0x4c6614);_0x5b07b3[_0x08db('0x5d')]();for(var _0x13eb95=0x0;_0x13eb95<_0x5b07b3[_0x08db('0x5e')];_0x13eb95++){if(_0x43c76c!=''){_0x43c76c+='&';}_0x43c76c+=_0x5b07b3[_0x13eb95]+'='+encodeURIComponent(_0x4c6614[_0x5b07b3[_0x13eb95]]);_0x23a99b+=_0x4c6614[_0x5b07b3[_0x13eb95]];}_0x23a99b+=_0x1b9169['apiKey'];_0x23a99b=_0x4ace4e[_0x08db('0x5f')](_0x08db('0x60'))[_0x08db('0x15')](_0x23a99b)[_0x08db('0x61')](_0x08db('0x62'));if(_0x43c76c!==''){_0x43c76c+='&';}_0x43c76c+='signature='+_0x23a99b;var _0x5de081={'method':'GET','uri':_0x1b9169[_0x08db('0x4f')]+_0x08db('0x63')+_0x43c76c,'json':!![]};return rp(_0x5de081)[_0x08db('0x19')](function(_0x2463c1){var _0x18024=Object[_0x08db('0x5c')](_0x2463c1);if(_0x2463c1[_0x18024[0x0]][_0x08db('0x27')]&&parseInt(_0x2463c1[_0x18024[0x0]][_0x08db('0x27')])===0x0){var _0x2a1d51={'messageId':_0x2463c1[_0x18024[0x0]][_0x08db('0x64')]};if(!_0x1b9169['deliveryReport']){_0x2a1d51[_0x08db('0x35')]=!![];}return _0x182b0c[_0x08db('0x15')](_0x2a1d51);}else{return logger[_0x08db('0x27')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x08db('0x26'),'csc',util[_0x08db('0x37')](_0x2463c1[_0x08db('0x27')],{'showHidden':![],'depth':null}));}})[_0x08db('0x25')](function(_0xf979c4){return logger['error'](_0x08db('0x36'),_0x08db('0x26'),'csc',util[_0x08db('0x37')](_0xf979c4,{'showHidden':![],'depth':null}));});}else{logger[_0x08db('0x27')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x08db('0x26'),_0x08db('0x55'),_0x08db('0x65'));}break;case _0x08db('0x66'):if(_0x1b9169[_0x08db('0x57')]){var _0x553141={'method':_0x08db('0x32'),'uri':_0x08db('0x67'),'headers':{'Authorization':_0x1b9169['apiKey']},'body':{'content':_0x16ad14[_0x08db('0x21')],'to':[_0x16ad14[_0x08db('0x1e')]],'from':_0x1b9169[_0x08db('0x1e')],'binary':![],'clientMessageId':_0x08db('0x68'),'charset':_0x08db('0x69')},'json':!![]};rp(_0x553141)[_0x08db('0x19')](function(_0x38c7d9){if(!_0x38c7d9[_0x08db('0x27')]){var _0x19534d={'messageId':_0x38c7d9[_0x08db('0x1f')][0x0][_0x08db('0x6a')]};if(!_0x1b9169[_0x08db('0x34')]){_0x19534d['read']=!![];}return _0x182b0c[_0x08db('0x15')](_0x19534d);}else{return logger[_0x08db('0x27')](_0x08db('0x36'),_0x08db('0x26'),_0x08db('0x66'),util[_0x08db('0x37')](_0x38c7d9[_0x08db('0x27')],{'showHidden':![],'depth':null}));}})['catch'](function(_0x48df0f){return logger[_0x08db('0x27')](_0x08db('0x36'),_0x08db('0x26'),_0x08db('0x66'),util[_0x08db('0x37')](_0x48df0f,{'showHidden':![],'depth':null}));});}else{logger[_0x08db('0x27')](_0x08db('0x36'),_0x08db('0x26'),'clickatell',_0x08db('0x65'));}break;case _0x08db('0x6b'):if(_0x1b9169['username']&&_0x1b9169[_0x08db('0x2e')]){var _0x59638f=util[_0x08db('0x3e')](_0x08db('0x3f'),_0x1b9169[_0x08db('0x2b')],_0x1b9169[_0x08db('0x2e')]);var _0x2fe457={'method':_0x08db('0x32'),'uri':'https://messaging.bandwidth.com/api/v2/users/'+_0x1b9169['accountId']+_0x08db('0x6c'),'body':{'to':[_0x16ad14[_0x08db('0x1e')]],'text':_0x16ad14[_0x08db('0x21')],'from':_0x1b9169[_0x08db('0x1e')],'applicationId':_0x1b9169[_0x08db('0x6d')]},'headers':{'Authorization':util[_0x08db('0x3e')]('Basic\x20%s',new Buffer(_0x59638f)[_0x08db('0x42')]('base64'))},'json':!![]};rp(_0x2fe457)[_0x08db('0x19')](function(_0x5324ca){if(_0x5324ca['id']){var _0xc4f994={'messageId':_0x5324ca['id']};return _0x182b0c[_0x08db('0x15')](_0xc4f994);}else{logger[_0x08db('0x27')](_0x08db('0x36'),'afterCreate','bandwidth',util[_0x08db('0x37')](_0x5324ca,{'showHidden':![],'depth':null}));}})[_0x08db('0x25')](function(_0x712338){logger[_0x08db('0x27')](_0x08db('0x36'),_0x08db('0x26'),'bandwidth',util[_0x08db('0x37')](_0x712338,{'showHidden':![],'depth':null}));});}else{logger[_0x08db('0x27')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x08db('0x6b'),'Missing\x20parameters:\x20username,\x20password');}break;case _0x08db('0x6e'):if(_0x1b9169[_0x08db('0x57')]){var _0x49d4a1={};var _0x5de081={'method':_0x08db('0x32'),'uri':_0x08db('0x6f'),'headers':{'Authorization':'Bearer\x20'+_0x1b9169[_0x08db('0x57')],'Content-Type':_0x08db('0x70')},'body':{'from':_0x1b9169[_0x08db('0x1e')],'to':_0x16ad14[_0x08db('0x1e')],'text':_0x16ad14[_0x08db('0x21')]},'json':!![]};return rp(_0x5de081)[_0x08db('0x19')](function(_0x199974){if(_0x199974[_0x08db('0x71')]==0xca){_0x49d4a1[_0x08db('0x72')]=_0x199974;var _0x47f260={'method':_0x08db('0x32'),'uri':'https://api.intelepeer.com/_rest/v4/app/sms/mdr','headers':{'Authorization':'Bearer\x20'+_0x1b9169['apiKey'],'Content-Type':_0x08db('0x70')},'body':{'refid':_0x49d4a1[_0x08db('0x72')]['refid']},'json':!![]};return rp(_0x47f260)[_0x08db('0x19')](function(_0x16aaaa){_0x49d4a1[_0x08db('0x73')]=_0x16aaaa;var _0x512a12={'messageId':_0x49d4a1['message']['refid'],'read':!![]};return _0x182b0c[_0x08db('0x15')](_0x512a12);});}else{return logger[_0x08db('0x27')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x08db('0x26'),_0x08db('0x6e'),util[_0x08db('0x37')](_0x199974,{'showHidden':![],'depth':null}));}})[_0x08db('0x25')](function(_0xc68fa8){return logger[_0x08db('0x27')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x08db('0x26'),_0x08db('0x6e'),util[_0x08db('0x37')](_0xc68fa8,{'showHidden':![],'depth':null}));});}else{return logger[_0x08db('0x27')](_0x08db('0x36'),'afterCreate',_0x08db('0x6e'),'Token\x20not\x20received');}break;}}})[_0x08db('0x74')](function(){_0x1242af();});}else{_0x1242af();}}},'charset':_0x08db('0x75'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.rpc.js b/server/api/smsMessage/smsMessage.rpc.js index 0040be1..4d17101 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 _0x4fcd=['then','info','request\x20sent','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','SmsMessage,\x20%s,\x20%s','message','result','SmsMessage','create','body','options','debug','CreateSmsMessage','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment','http','redis','defaults','./smsMessage.socket','register','request'];(function(_0x1a0c51,_0x4c285b){var _0x5e4d19=function(_0x302698){while(--_0x302698){_0x1a0c51['push'](_0x1a0c51['shift']());}};_0x5e4d19(++_0x4c285b);}(_0x4fcd,0xf8));var _0xd4fc=function(_0x483bdc,_0x212aa9){_0x483bdc=_0x483bdc-0x0;var _0x35713f=_0x4fcd[_0x483bdc];return _0x35713f;};'use strict';var _=require(_0xd4fc('0x0'));var util=require('util');var moment=require(_0xd4fc('0x1'));var BPromise=require(_0xd4fc('0x2'));var rs=require(_0xd4fc('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd4fc('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xd4fc('0x5'))('rpc');var config=require(_0xd4fc('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0xd4fc('0x7')]({'port':0x232a});config[_0xd4fc('0x8')]=_[_0xd4fc('0x9')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd4fc('0x8')]));require(_0xd4fc('0xa'))[_0xd4fc('0xb')](socket);function respondWithRpcPromise(_0x2af013,_0x402f12,_0x18571d){return new BPromise(function(_0x48c747,_0x512605){return client[_0xd4fc('0xc')](_0x2af013,_0x18571d)[_0xd4fc('0xd')](function(_0x254329){logger[_0xd4fc('0xe')]('SmsMessage,\x20%s,\x20%s',_0x402f12,_0xd4fc('0xf'));logger['debug'](_0xd4fc('0x10'),_0x402f12,_0xd4fc('0xf'),JSON[_0xd4fc('0x11')](_0x254329));if(_0x254329[_0xd4fc('0x12')]){if(_0x254329['error']['code']===0x1f4){logger[_0xd4fc('0x12')](_0xd4fc('0x13'),_0x402f12,_0x254329['error']['message']);return _0x512605(_0x254329[_0xd4fc('0x12')][_0xd4fc('0x14')]);}logger['error'](_0xd4fc('0x13'),_0x402f12,_0x254329[_0xd4fc('0x12')]['message']);return _0x48c747(_0x254329[_0xd4fc('0x12')]['message']);}else{logger[_0xd4fc('0xe')]('SmsMessage,\x20%s,\x20%s',_0x402f12,_0xd4fc('0xf'));_0x48c747(_0x254329[_0xd4fc('0x15')][_0xd4fc('0x14')]);}})['catch'](function(_0x5b38c8){logger['error'](_0xd4fc('0x13'),_0x402f12,_0x5b38c8);_0x512605(_0x5b38c8);});});}exports['CreateSmsMessage']=function(_0x558694){var _0x42ecab=this;return new Promise(function(_0x5e1f66,_0x43cef8){return db[_0xd4fc('0x16')][_0xd4fc('0x17')](_0x558694[_0xd4fc('0x18')],{'raw':_0x558694[_0xd4fc('0x19')]?_0x558694[_0xd4fc('0x19')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x5e5d9f){logger[_0xd4fc('0xe')]('CreateSmsMessage',_0x558694);logger[_0xd4fc('0x1a')](_0xd4fc('0x1b'),_0x558694,JSON[_0xd4fc('0x11')](_0x5e5d9f));_0x5e1f66(_0x5e5d9f);})[_0xd4fc('0x1c')](function(_0x550ae1){logger[_0xd4fc('0x12')](_0xd4fc('0x1b'),_0x550ae1[_0xd4fc('0x14')],_0x558694);_0x43cef8(_0x42ecab['error'](0x1f4,_0x550ae1['message']));});});}; \ No newline at end of file +var _0x2a1a=['body','options','raw','then','stringify','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','redis','socket.io-emitter','register','request','info','SmsMessage,\x20%s,\x20%s','debug','SmsMessage,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','catch','CreateSmsMessage','SmsMessage','create'];(function(_0x24c246,_0x2d19d5){var _0x558612=function(_0x296597){while(--_0x296597){_0x24c246['push'](_0x24c246['shift']());}};_0x558612(++_0x2d19d5);}(_0x2a1a,0x179));var _0xa2a1=function(_0x2224bd,_0xd2e945){_0x2224bd=_0x2224bd-0x0;var _0x54f18f=_0x2a1a[_0x2224bd];return _0x54f18f;};'use strict';var _=require(_0xa2a1('0x0'));var util=require(_0xa2a1('0x1'));var moment=require('moment');var BPromise=require(_0xa2a1('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa2a1('0x3'));var db=require(_0xa2a1('0x4'))['db'];var utils=require(_0xa2a1('0x5'));var logger=require(_0xa2a1('0x6'))(_0xa2a1('0x7'));var config=require('../../config/environment');var jayson=require(_0xa2a1('0x8'));var client=jayson['client'][_0xa2a1('0x9')]({'port':0x232a});config[_0xa2a1('0xa')]=_['defaults'](config[_0xa2a1('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0xa2a1('0xb'))(new Redis(config[_0xa2a1('0xa')]));require('./smsMessage.socket')[_0xa2a1('0xc')](socket);function respondWithRpcPromise(_0xcd63b1,_0x183466,_0x277116){return new BPromise(function(_0x2968be,_0xbd13d1){return client[_0xa2a1('0xd')](_0xcd63b1,_0x277116)['then'](function(_0x7a3b23){logger[_0xa2a1('0xe')](_0xa2a1('0xf'),_0x183466,'request\x20sent');logger[_0xa2a1('0x10')](_0xa2a1('0x11'),_0x183466,_0xa2a1('0x12'),JSON['stringify'](_0x7a3b23));if(_0x7a3b23[_0xa2a1('0x13')]){if(_0x7a3b23[_0xa2a1('0x13')][_0xa2a1('0x14')]===0x1f4){logger[_0xa2a1('0x13')](_0xa2a1('0xf'),_0x183466,_0x7a3b23['error'][_0xa2a1('0x15')]);return _0xbd13d1(_0x7a3b23[_0xa2a1('0x13')][_0xa2a1('0x15')]);}logger[_0xa2a1('0x13')](_0xa2a1('0xf'),_0x183466,_0x7a3b23['error'][_0xa2a1('0x15')]);return _0x2968be(_0x7a3b23[_0xa2a1('0x13')]['message']);}else{logger[_0xa2a1('0xe')](_0xa2a1('0xf'),_0x183466,_0xa2a1('0x12'));_0x2968be(_0x7a3b23['result'][_0xa2a1('0x15')]);}})[_0xa2a1('0x16')](function(_0x4c458a){logger[_0xa2a1('0x13')](_0xa2a1('0xf'),_0x183466,_0x4c458a);_0xbd13d1(_0x4c458a);});});}exports[_0xa2a1('0x17')]=function(_0x214220){var _0x4d0652=this;return new Promise(function(_0x28b23a,_0x2345d9){return db[_0xa2a1('0x18')][_0xa2a1('0x19')](_0x214220[_0xa2a1('0x1a')],{'raw':_0x214220[_0xa2a1('0x1b')]?_0x214220[_0xa2a1('0x1b')][_0xa2a1('0x1c')]===undefined?!![]:![]:!![]})[_0xa2a1('0x1d')](function(_0x23b1a5){logger[_0xa2a1('0xe')]('CreateSmsMessage',_0x214220);logger['debug'](_0xa2a1('0x17'),_0x214220,JSON[_0xa2a1('0x1e')](_0x23b1a5));_0x28b23a(_0x23b1a5);})[_0xa2a1('0x16')](function(_0x261a9f){logger['error'](_0xa2a1('0x17'),_0x261a9f[_0xa2a1('0x15')],_0x214220);_0x2345d9(_0x4d0652[_0xa2a1('0x13')](0x1f4,_0x261a9f[_0xa2a1('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index 7a02441..45ccfac 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 _0x5e4d=['save','remove','update','emit','register','length','smsMessage:'];(function(_0x25efdf,_0x521462){var _0x22c495=function(_0x184469){while(--_0x184469){_0x25efdf['push'](_0x25efdf['shift']());}};_0x22c495(++_0x521462);}(_0x5e4d,0xe0));var _0xd5e4=function(_0x30d8a5,_0x1d70fa){_0x30d8a5=_0x30d8a5-0x0;var _0x1abe8e=_0x5e4d[_0x30d8a5];return _0x1abe8e;};'use strict';var SmsMessageEvents=require('./smsMessage.events');var events=[_0xd5e4('0x0'),_0xd5e4('0x1'),_0xd5e4('0x2')];function createListener(_0x1860af,_0x93e5d3){return function(_0x403e42){_0x93e5d3[_0xd5e4('0x3')](_0x1860af,_0x403e42);};}function removeListener(_0x10d7be,_0x1af977){return function(){SmsMessageEvents['removeListener'](_0x10d7be,_0x1af977);};}exports[_0xd5e4('0x4')]=function(_0x5895e2){for(var _0x133eda=0x0,_0x30c696=events[_0xd5e4('0x5')];_0x133eda<_0x30c696;_0x133eda++){var _0x52c2d8=events[_0x133eda];var _0x1ea360=createListener(_0xd5e4('0x6')+_0x52c2d8,_0x5895e2);SmsMessageEvents['on'](_0x52c2d8,_0x1ea360);}}; \ No newline at end of file +var _0xb47c=['removeListener','register','length','./smsMessage.events','save','remove','update'];(function(_0x4ee2f3,_0x275bca){var _0x1748cc=function(_0x54db9c){while(--_0x54db9c){_0x4ee2f3['push'](_0x4ee2f3['shift']());}};_0x1748cc(++_0x275bca);}(_0xb47c,0x16f));var _0xcb47=function(_0x25d4ab,_0x307164){_0x25d4ab=_0x25d4ab-0x0;var _0x3b31f3=_0xb47c[_0x25d4ab];return _0x3b31f3;};'use strict';var SmsMessageEvents=require(_0xcb47('0x0'));var events=[_0xcb47('0x1'),_0xcb47('0x2'),_0xcb47('0x3')];function createListener(_0x474e03,_0x1cf8c8){return function(_0x14cdb4){_0x1cf8c8['emit'](_0x474e03,_0x14cdb4);};}function removeListener(_0x34496c,_0x2211fa){return function(){SmsMessageEvents[_0xcb47('0x4')](_0x34496c,_0x2211fa);};}exports[_0xcb47('0x5')]=function(_0xe751b1){for(var _0x16dbaf=0x0,_0x5cc1e0=events[_0xcb47('0x6')];_0x16dbaf<_0x5cc1e0;_0x16dbaf++){var _0x4c673e=events[_0x16dbaf];var _0x2d4a4d=createListener('smsMessage:'+_0x4c673e,_0xe751b1);SmsMessageEvents['on'](_0x4c673e,_0x2d4a4d);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index 19819fb..493579c 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 _0xa3c7=['/describe','describe','show','/:id/members','getMembers','/:id/teams','/:id/users','addTeams','addAgents','/:id','delete','removeAgents','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index'];(function(_0x56a532,_0x30d89f){var _0x3ec29d=function(_0x10a1f){while(--_0x10a1f){_0x56a532['push'](_0x56a532['shift']());}};_0x3ec29d(++_0x30d89f);}(_0xa3c7,0x14f));var _0x7a3c=function(_0x2354f1,_0xabfc06){_0x2354f1=_0x2354f1-0x0;var _0x2274ca=_0xa3c7[_0x2354f1];return _0x2274ca;};'use strict';var multer=require(_0x7a3c('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x7a3c('0x1'));var express=require(_0x7a3c('0x2'));var router=express[_0x7a3c('0x3')]();var fs_extra=require(_0x7a3c('0x4'));var auth=require(_0x7a3c('0x5'));var interaction=require(_0x7a3c('0x6'));var config=require('../../config/environment');var controller=require('./smsQueue.controller');router[_0x7a3c('0x7')]('/',auth[_0x7a3c('0x8')](),controller[_0x7a3c('0x9')]);router['get'](_0x7a3c('0xa'),auth[_0x7a3c('0x8')](),controller[_0x7a3c('0xb')]);router['get']('/:id',auth[_0x7a3c('0x8')](),controller[_0x7a3c('0xc')]);router[_0x7a3c('0x7')](_0x7a3c('0xd'),auth[_0x7a3c('0x8')](),controller[_0x7a3c('0xe')]);router[_0x7a3c('0x7')](_0x7a3c('0xf'),auth[_0x7a3c('0x8')](),controller['getTeams']);router[_0x7a3c('0x7')](_0x7a3c('0x10'),auth[_0x7a3c('0x8')](),controller['getAgents']);router['post']('/',auth[_0x7a3c('0x8')](),controller['create']);router['post'](_0x7a3c('0xf'),auth[_0x7a3c('0x8')](),controller[_0x7a3c('0x11')]);router['post'](_0x7a3c('0x10'),auth[_0x7a3c('0x8')](),controller[_0x7a3c('0x12')]);router['put'](_0x7a3c('0x13'),auth[_0x7a3c('0x8')](),controller['update']);router[_0x7a3c('0x14')]('/:id',auth[_0x7a3c('0x8')](),controller['destroy']);router[_0x7a3c('0x14')](_0x7a3c('0xf'),auth[_0x7a3c('0x8')](),controller['removeTeams']);router['delete']('/:id/users',auth[_0x7a3c('0x8')](),controller[_0x7a3c('0x15')]);module[_0x7a3c('0x16')]=router; \ No newline at end of file +var _0xc747=['Router','fs-extra','../../components/interaction/service','../../config/environment','./smsQueue.controller','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/members','/:id/teams','/:id/users','getAgents','post','create','addTeams','addAgents','put','update','delete','destroy','removeTeams','exports','util','path','connect-timeout'];(function(_0x112b9a,_0x23c0b2){var _0xd17c7a=function(_0x4b6ac8){while(--_0x4b6ac8){_0x112b9a['push'](_0x112b9a['shift']());}};_0xd17c7a(++_0x23c0b2);}(_0xc747,0x71));var _0x7c74=function(_0x595e7b,_0x32000d){_0x595e7b=_0x595e7b-0x0;var _0x330302=_0xc747[_0x595e7b];return _0x330302;};'use strict';var multer=require('multer');var util=require(_0x7c74('0x0'));var path=require(_0x7c74('0x1'));var timeout=require(_0x7c74('0x2'));var express=require('express');var router=express[_0x7c74('0x3')]();var fs_extra=require(_0x7c74('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x7c74('0x5'));var config=require(_0x7c74('0x6'));var controller=require(_0x7c74('0x7'));router[_0x7c74('0x8')]('/',auth['isAuthenticated'](),controller[_0x7c74('0x9')]);router[_0x7c74('0x8')](_0x7c74('0xa'),auth[_0x7c74('0xb')](),controller[_0x7c74('0xc')]);router[_0x7c74('0x8')](_0x7c74('0xd'),auth[_0x7c74('0xb')](),controller[_0x7c74('0xe')]);router[_0x7c74('0x8')](_0x7c74('0xf'),auth['isAuthenticated'](),controller['getMembers']);router['get'](_0x7c74('0x10'),auth[_0x7c74('0xb')](),controller['getTeams']);router[_0x7c74('0x8')](_0x7c74('0x11'),auth[_0x7c74('0xb')](),controller[_0x7c74('0x12')]);router[_0x7c74('0x13')]('/',auth[_0x7c74('0xb')](),controller[_0x7c74('0x14')]);router[_0x7c74('0x13')](_0x7c74('0x10'),auth['isAuthenticated'](),controller[_0x7c74('0x15')]);router['post']('/:id/users',auth[_0x7c74('0xb')](),controller[_0x7c74('0x16')]);router[_0x7c74('0x17')]('/:id',auth[_0x7c74('0xb')](),controller[_0x7c74('0x18')]);router[_0x7c74('0x19')](_0x7c74('0xd'),auth[_0x7c74('0xb')](),controller[_0x7c74('0x1a')]);router[_0x7c74('0x19')](_0x7c74('0x10'),auth[_0x7c74('0xb')](),controller[_0x7c74('0x1b')]);router[_0x7c74('0x19')](_0x7c74('0x11'),auth[_0x7c74('0xb')](),controller['removeAgents']);module[_0x7c74('0x1c')]=router; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.attributes.js b/server/api/smsQueue/smsQueue.attributes.js index 79b1775..c7f5a0d 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 _0xb530=['exports','STRING','name','INTEGER','ENUM','rrmemory','beepall','roundrobin','sequelize'];(function(_0x44afa4,_0x5be27b){var _0xcad289=function(_0x206272){while(--_0x206272){_0x44afa4['push'](_0x44afa4['shift']());}};_0xcad289(++_0x5be27b);}(_0xb530,0x19d));var _0x0b53=function(_0x11e366,_0x12f876){_0x11e366=_0x11e366-0x0;var _0x1454e3=_0xb530[_0x11e366];return _0x1454e3;};'use strict';var Sequelize=require(_0x0b53('0x0'));module[_0x0b53('0x1')]={'name':{'type':Sequelize[_0x0b53('0x2')],'unique':_0x0b53('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x0b53('0x2')]},'timeout':{'type':Sequelize[_0x0b53('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x0b53('0x5')](_0x0b53('0x6'),_0x0b53('0x7'),_0x0b53('0x8'))}}; \ No newline at end of file +var _0x2fca=['exports','STRING','ENUM','beepall','sequelize'];(function(_0x5f2d31,_0x4a7572){var _0x39f6e8=function(_0x4f87e5){while(--_0x4f87e5){_0x5f2d31['push'](_0x5f2d31['shift']());}};_0x39f6e8(++_0x4a7572);}(_0x2fca,0x9f));var _0xa2fc=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x2fca[_0x2641f9];return _0x585741;};'use strict';var Sequelize=require(_0xa2fc('0x0'));module[_0xa2fc('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xa2fc('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xa2fc('0x3')]('rrmemory',_0xa2fc('0x4'),'roundrobin')}}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index 5bc2292..2561433 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 _0xd503=['to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsQueue.socket','register','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','SmsQueues','UserProfileResource','error','stack','name','send','map','SmsQueue','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','findAll','rows','show','fields','include','options','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','catch','update','body','params','describe','getMembers','findOne','UserSmsQueue','User','findAndCountAll','UserId','agent','smsPause','SIP','createdAt','updatedAt','getTeams','Team','addTeams','ids','Agents','online','voicePause','interface','flatMap','sequelize','transaction','each','findOrCreate','forEach','emit','select','tq.TeamId','from','team_has_sms_queues','join','ut.TeamId\x20=\x20tq.TeamId','SmsQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','includes','all','union','compact','removeTeams','isEmpty','removeAgents','userSmsQueue:remove','addAgents','omit','userSmsQueue:save','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','path','sox'];(function(_0x1e7f4d,_0x20acaa){var _0x5f0fd9=function(_0x4dbbf4){while(--_0x4dbbf4){_0x1e7f4d['push'](_0x1e7f4d['shift']());}};_0x5f0fd9(++_0x20acaa);}(_0xd503,0x116));var _0x3d50=function(_0x1049a3,_0x43b39a){_0x1049a3=_0x1049a3-0x0;var _0x14cf4f=_0xd503[_0x1049a3];return _0x14cf4f;};'use strict';var emlformat=require(_0x3d50('0x0'));var rimraf=require(_0x3d50('0x1'));var zipdir=require(_0x3d50('0x2'));var jsonpatch=require(_0x3d50('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x3d50('0x4'));var Mustache=require(_0x3d50('0x5'));var util=require('util');var path=require(_0x3d50('0x6'));var sox=require(_0x3d50('0x7'));var csv=require(_0x3d50('0x8'));var ejs=require(_0x3d50('0x9'));var fs=require('fs');var fs_extra=require(_0x3d50('0xa'));var _=require(_0x3d50('0xb'));var squel=require(_0x3d50('0xc'));var crypto=require(_0x3d50('0xd'));var jsforce=require(_0x3d50('0xe'));var deskjs=require(_0x3d50('0xf'));var toCsv=require(_0x3d50('0x8'));var querystring=require(_0x3d50('0x10'));var Papa=require('papaparse');var Redis=require(_0x3d50('0x11'));var authService=require(_0x3d50('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3d50('0x13'));var logger=require(_0x3d50('0x14'))(_0x3d50('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x3d50('0x16'))['db'];config[_0x3d50('0x17')]=_[_0x3d50('0x18')](config['redis'],{'host':_0x3d50('0x19'),'port':0x18eb});var socket=require(_0x3d50('0x1a'))(new Redis(config[_0x3d50('0x17')]));require(_0x3d50('0x1b'))[_0x3d50('0x1c')](socket);function respondWithStatusCode(_0x447900,_0x407509){_0x407509=_0x407509||0xcc;return function(_0x13e375){if(_0x13e375){return _0x447900[_0x3d50('0x1d')](_0x407509);}return _0x447900[_0x3d50('0x1e')](_0x407509)['end']();};}function respondWithResult(_0x2b1f5c,_0x5a6f73){_0x5a6f73=_0x5a6f73||0xc8;return function(_0x6592d9){if(_0x6592d9){return _0x2b1f5c['status'](_0x5a6f73)[_0x3d50('0x1f')](_0x6592d9);}};}function respondWithFilteredResult(_0xf77a60,_0x50c3e6){return function(_0x21b947){if(_0x21b947){var _0xff7f8c=typeof _0x50c3e6[_0x3d50('0x20')]===_0x3d50('0x21')&&typeof _0x50c3e6[_0x3d50('0x22')]===_0x3d50('0x21');var _0x18e111=_0x21b947[_0x3d50('0x23')];var _0x1e47df=_0xff7f8c?0x0:_0x50c3e6[_0x3d50('0x20')];var _0x1737dd=_0xff7f8c?_0x21b947[_0x3d50('0x23')]:_0x50c3e6[_0x3d50('0x20')]+_0x50c3e6[_0x3d50('0x22')];var _0x855113;if(_0x1737dd>=_0x18e111){_0x1737dd=_0x18e111;_0x855113=0xc8;}else{_0x855113=0xce;}_0xf77a60[_0x3d50('0x1e')](_0x855113);return _0xf77a60[_0x3d50('0x24')](_0x3d50('0x25'),_0x1e47df+'-'+_0x1737dd+'/'+_0x18e111)[_0x3d50('0x1f')](_0x21b947);}return null;};}function patchUpdates(_0x4fc400){return function(_0x4c6c0c){try{jsonpatch[_0x3d50('0x26')](_0x4c6c0c,_0x4fc400,!![]);}catch(_0x294e75){return BPromise[_0x3d50('0x27')](_0x294e75);}return _0x4c6c0c[_0x3d50('0x28')]();};}function saveUpdates(_0x568da7,_0x4fd0dc){return function(_0x2d0d51){if(_0x2d0d51){return _0x2d0d51['update'](_0x568da7)[_0x3d50('0x29')](function(_0xd282e8){return _0xd282e8;});}return null;};}function removeEntity(_0x590d44,_0x32e5f0){return function(_0x53de20){if(_0x53de20){return _0x53de20[_0x3d50('0x2a')]()[_0x3d50('0x29')](function(){var _0x4eb322=_0x53de20['get']({'plain':!![]});var _0x44d59e=_0x3d50('0x2b');return db[_0x3d50('0x2c')][_0x3d50('0x2a')]({'where':{'type':_0x44d59e,'resourceId':_0x4eb322['id']}})[_0x3d50('0x29')](function(){return _0x53de20;});})[_0x3d50('0x29')](function(){_0x590d44['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x43d463,_0x471aa2){return function(_0x361357){if(!_0x361357){_0x43d463[_0x3d50('0x1d')](0x194);}return _0x361357;};}function handleError(_0x1e0bd6,_0x3f60ea){_0x3f60ea=_0x3f60ea||0x1f4;return function(_0x33e7df){logger[_0x3d50('0x2d')](_0x33e7df[_0x3d50('0x2e')]);if(_0x33e7df['name']){delete _0x33e7df[_0x3d50('0x2f')];}_0x1e0bd6[_0x3d50('0x1e')](_0x3f60ea)[_0x3d50('0x30')](_0x33e7df);};}exports['index']=function(_0x4683f2,_0x26cebd){var _0x1b230d={},_0x6922dc={},_0x22dfb0={'count':0x0,'rows':[]};var _0x59ca50=_[_0x3d50('0x31')](db[_0x3d50('0x32')][_0x3d50('0x33')],function(_0x479c6c){return{'name':_0x479c6c['fieldName'],'type':_0x479c6c[_0x3d50('0x34')][_0x3d50('0x35')]};});_0x6922dc[_0x3d50('0x36')]=_['map'](_0x59ca50,_0x3d50('0x2f'));_0x6922dc[_0x3d50('0x37')]=_[_0x3d50('0x38')](_0x4683f2['query']);_0x6922dc[_0x3d50('0x39')]=_[_0x3d50('0x3a')](_0x6922dc[_0x3d50('0x36')],_0x6922dc['query']);_0x1b230d[_0x3d50('0x3b')]=_['intersection'](_0x6922dc[_0x3d50('0x36')],qs['fields'](_0x4683f2['query']['fields']));_0x1b230d[_0x3d50('0x3b')]=_0x1b230d[_0x3d50('0x3b')][_0x3d50('0x3c')]?_0x1b230d[_0x3d50('0x3b')]:_0x6922dc[_0x3d50('0x36')];if(!_0x4683f2[_0x3d50('0x37')][_0x3d50('0x3d')](_0x3d50('0x3e'))){_0x1b230d[_0x3d50('0x22')]=qs[_0x3d50('0x22')](_0x4683f2[_0x3d50('0x37')][_0x3d50('0x22')]);_0x1b230d['offset']=qs[_0x3d50('0x20')](_0x4683f2[_0x3d50('0x37')][_0x3d50('0x20')]);}_0x1b230d[_0x3d50('0x3f')]=qs[_0x3d50('0x40')](_0x4683f2[_0x3d50('0x37')]['sort']);_0x1b230d[_0x3d50('0x41')]=qs['filters'](_[_0x3d50('0x42')](_0x4683f2[_0x3d50('0x37')],_0x6922dc[_0x3d50('0x39')]),_0x59ca50);if(_0x4683f2[_0x3d50('0x37')][_0x3d50('0x43')]){_0x1b230d[_0x3d50('0x41')]=_[_0x3d50('0x44')](_0x1b230d[_0x3d50('0x41')],{'$or':_[_0x3d50('0x31')](_0x59ca50,function(_0x4ab123){if(_0x4ab123['type']!==_0x3d50('0x45')){var _0x2d4808={};_0x2d4808[_0x4ab123[_0x3d50('0x2f')]]={'$like':'%'+_0x4683f2[_0x3d50('0x37')][_0x3d50('0x43')]+'%'};return _0x2d4808;}})});}_0x1b230d=_[_0x3d50('0x44')]({},_0x1b230d,_0x4683f2['options']);var _0x13585e={'where':_0x1b230d['where']};return db[_0x3d50('0x32')]['count'](_0x13585e)[_0x3d50('0x29')](function(_0x41535d){_0x22dfb0[_0x3d50('0x23')]=_0x41535d;if(_0x4683f2[_0x3d50('0x37')][_0x3d50('0x46')]){_0x1b230d['include']=[{'all':!![]}];}return db[_0x3d50('0x32')][_0x3d50('0x47')](_0x1b230d);})['then'](function(_0x32358b){_0x22dfb0[_0x3d50('0x48')]=_0x32358b;return _0x22dfb0;})[_0x3d50('0x29')](respondWithFilteredResult(_0x26cebd,_0x1b230d))['catch'](handleError(_0x26cebd,null));};exports[_0x3d50('0x49')]=function(_0x4377bd,_0x519987){var _0x541859={'raw':!![],'where':{'id':_0x4377bd['params']['id']}},_0x23f349={};_0x23f349[_0x3d50('0x36')]=_[_0x3d50('0x38')](db[_0x3d50('0x32')]['rawAttributes']);_0x23f349[_0x3d50('0x37')]=_['keys'](_0x4377bd['query']);_0x23f349[_0x3d50('0x39')]=_[_0x3d50('0x3a')](_0x23f349[_0x3d50('0x36')],_0x23f349[_0x3d50('0x37')]);_0x541859[_0x3d50('0x3b')]=_['intersection'](_0x23f349['model'],qs[_0x3d50('0x4a')](_0x4377bd[_0x3d50('0x37')][_0x3d50('0x4a')]));_0x541859[_0x3d50('0x3b')]=_0x541859[_0x3d50('0x3b')][_0x3d50('0x3c')]?_0x541859[_0x3d50('0x3b')]:_0x23f349[_0x3d50('0x36')];if(_0x4377bd[_0x3d50('0x37')][_0x3d50('0x46')]){_0x541859[_0x3d50('0x4b')]=[{'all':!![]}];}_0x541859=_['merge']({},_0x541859,_0x4377bd[_0x3d50('0x4c')]);return db[_0x3d50('0x32')]['find'](_0x541859)[_0x3d50('0x29')](handleEntityNotFound(_0x519987,null))[_0x3d50('0x29')](respondWithResult(_0x519987,null))['catch'](handleError(_0x519987,null));};exports['create']=function(_0x47ef7b,_0x143527){return db['SmsQueue']['create'](_0x47ef7b['body'],{})[_0x3d50('0x29')](function(_0x5c38ed){var _0x59ec3d=_0x47ef7b[_0x3d50('0x4d')][_0x3d50('0x4e')]({'plain':!![]});if(!_0x59ec3d)throw new Error(_0x3d50('0x4f'));if(_0x59ec3d['role']==='user'){var _0x12ef7e=_0x5c38ed[_0x3d50('0x4e')]({'plain':!![]});var _0x43ee0a='SmsQueues';return db[_0x3d50('0x50')][_0x3d50('0x51')]({'where':{'name':_0x43ee0a,'userProfileId':_0x59ec3d[_0x3d50('0x52')]},'raw':!![]})[_0x3d50('0x29')](function(_0x36e4b6){if(_0x36e4b6&&_0x36e4b6[_0x3d50('0x53')]===0x0){return db[_0x3d50('0x2c')]['create']({'name':_0x12ef7e['name'],'resourceId':_0x12ef7e['id'],'type':_0x36e4b6[_0x3d50('0x2f')],'sectionId':_0x36e4b6['id']},{})[_0x3d50('0x29')](function(){return _0x5c38ed;});}else{return _0x5c38ed;}})['catch'](function(_0x375907){logger['error'](_0x3d50('0x54'),_0x375907);throw _0x375907;});}return _0x5c38ed;})[_0x3d50('0x29')](respondWithResult(_0x143527,0xc9))[_0x3d50('0x55')](handleError(_0x143527,null));};exports[_0x3d50('0x56')]=function(_0x1e75ec,_0x1e0e00){if(_0x1e75ec['body']['id']){delete _0x1e75ec[_0x3d50('0x57')]['id'];}return db[_0x3d50('0x32')][_0x3d50('0x51')]({'where':{'id':_0x1e75ec[_0x3d50('0x58')]['id']}})['then'](handleEntityNotFound(_0x1e0e00,null))['then'](saveUpdates(_0x1e75ec[_0x3d50('0x57')],null))['then'](respondWithResult(_0x1e0e00,null))[_0x3d50('0x55')](handleError(_0x1e0e00,null));};exports[_0x3d50('0x2a')]=function(_0x3e84eb,_0x103175){return db['SmsQueue']['find']({'where':{'id':_0x3e84eb[_0x3d50('0x58')]['id']}})[_0x3d50('0x29')](handleEntityNotFound(_0x103175,null))[_0x3d50('0x29')](removeEntity(_0x103175,null))[_0x3d50('0x55')](handleError(_0x103175,null));};exports[_0x3d50('0x59')]=function(_0x5e43d0,_0x40b829){return db['SmsQueue']['describe']()['then'](respondWithResult(_0x40b829,null))[_0x3d50('0x55')](handleError(_0x40b829,null));};exports[_0x3d50('0x5a')]=function(_0x31a510,_0x21be85,_0x15ff7e){var _0x116432={'raw':!![],'where':{}},_0x2d52a8={},_0x2ee1bd;return db['SmsQueue'][_0x3d50('0x5b')]({'where':{'id':_0x31a510[_0x3d50('0x58')]['id']}})[_0x3d50('0x29')](handleEntityNotFound(_0x21be85,null))[_0x3d50('0x29')](function(_0x1547d2){if(_0x1547d2){_0x2ee1bd=_0x1547d2[_0x3d50('0x4e')]({'plain':!![]});_0x2d52a8[_0x3d50('0x36')]=_[_0x3d50('0x38')](db[_0x3d50('0x5c')][_0x3d50('0x33')]);_0x2d52a8[_0x3d50('0x37')]=_[_0x3d50('0x38')](_0x31a510[_0x3d50('0x37')]);_0x2d52a8[_0x3d50('0x39')]=_['intersection'](_0x2d52a8['model'],_0x2d52a8[_0x3d50('0x37')]);_0x116432['attributes']=_[_0x3d50('0x3a')](_0x2d52a8['model'],qs['fields'](_0x31a510[_0x3d50('0x37')][_0x3d50('0x4a')]));_0x116432['attributes']=_0x116432[_0x3d50('0x3b')][_0x3d50('0x3c')]?_0x116432[_0x3d50('0x3b')]:_0x2d52a8[_0x3d50('0x36')];if(!_0x31a510['query'][_0x3d50('0x3d')](_0x3d50('0x3e'))){_0x116432[_0x3d50('0x22')]=qs[_0x3d50('0x22')](_0x31a510['query'][_0x3d50('0x22')]);_0x116432[_0x3d50('0x20')]=qs['offset'](_0x31a510[_0x3d50('0x37')][_0x3d50('0x20')]);}_0x116432[_0x3d50('0x3f')]=qs['sort'](_0x31a510[_0x3d50('0x37')][_0x3d50('0x40')]);_0x116432['where']=qs[_0x3d50('0x39')](_[_0x3d50('0x42')](_0x31a510[_0x3d50('0x37')],_0x2d52a8[_0x3d50('0x39')]));_0x116432[_0x3d50('0x41')]['SmsQueueId']=_0x1547d2['id'];if(_0x31a510[_0x3d50('0x37')][_0x3d50('0x43')]){_0x116432['where']=_['merge'](_0x116432[_0x3d50('0x41')],{'$or':_[_0x3d50('0x31')](_0x116432[_0x3d50('0x3b')],function(_0x535600){var _0xed578b={};_0xed578b[_0x535600]={'$like':'%'+_0x31a510[_0x3d50('0x37')]['filter']+'%'};return _0xed578b;})});}_0x116432=_[_0x3d50('0x44')]({},_0x116432,_0x31a510[_0x3d50('0x4c')]);return db['UserSmsQueue']['findAll'](_0x116432);}})[_0x3d50('0x29')](function(_0x2b72d2){if(_0x2b72d2){return db[_0x3d50('0x5d')][_0x3d50('0x5e')]({'where':{'id':_[_0x3d50('0x31')](_0x2b72d2,_0x3d50('0x5f')),'role':_0x3d50('0x60')},'attributes':['id',_0x3d50('0x2f'),_0x3d50('0x61'),'updatedAt','createdAt']});}})[_0x3d50('0x29')](function(_0x1c647e){if(_0x1c647e){return{'count':_0x1c647e[_0x3d50('0x23')],'rows':_[_0x3d50('0x31')](_0x1c647e[_0x3d50('0x48')],function(_0x7f540e){return{'membername':_0x7f540e['name'],'UserId':_0x7f540e['id'],'queue_name':_0x2ee1bd[_0x3d50('0x2f')],'SmsQueueId':_0x2ee1bd['id'],'interface':util['format']('%s/%s',_0x3d50('0x62'),_0x7f540e['name']),'penalty':0x0,'paused':_0x7f540e[_0x3d50('0x61')],'createdAt':_0x7f540e[_0x3d50('0x63')],'updatedAt':_0x7f540e[_0x3d50('0x64')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x3d50('0x29')](respondWithFilteredResult(_0x21be85,_0x116432))[_0x3d50('0x55')](handleError(_0x21be85,null));};exports[_0x3d50('0x65')]=function(_0x64bf55,_0x447ba1,_0x5844bd){var _0x20b989={};var _0x3d12bf={};var _0x29fae4;var _0x49ef06;return db[_0x3d50('0x32')][_0x3d50('0x5b')]({'where':{'id':_0x64bf55['params']['id']}})[_0x3d50('0x29')](handleEntityNotFound(_0x447ba1,null))['then'](function(_0x2d785f){if(_0x2d785f){_0x29fae4=_0x2d785f;_0x3d12bf[_0x3d50('0x36')]=_['keys'](db[_0x3d50('0x66')][_0x3d50('0x33')]);_0x3d12bf[_0x3d50('0x37')]=_[_0x3d50('0x38')](_0x64bf55[_0x3d50('0x37')]);_0x3d12bf[_0x3d50('0x39')]=_[_0x3d50('0x3a')](_0x3d12bf[_0x3d50('0x36')],_0x3d12bf['query']);_0x20b989[_0x3d50('0x3b')]=_[_0x3d50('0x3a')](_0x3d12bf[_0x3d50('0x36')],qs[_0x3d50('0x4a')](_0x64bf55[_0x3d50('0x37')][_0x3d50('0x4a')]));_0x20b989['attributes']=_0x20b989['attributes'][_0x3d50('0x3c')]?_0x20b989[_0x3d50('0x3b')]:_0x3d12bf['model'];_0x20b989['order']=qs[_0x3d50('0x40')](_0x64bf55[_0x3d50('0x37')][_0x3d50('0x40')]);_0x20b989[_0x3d50('0x41')]=qs['filters'](_[_0x3d50('0x42')](_0x64bf55[_0x3d50('0x37')],_0x3d12bf[_0x3d50('0x39')]));if(_0x64bf55['query'][_0x3d50('0x43')]){_0x20b989['where']=_[_0x3d50('0x44')](_0x20b989[_0x3d50('0x41')],{'$or':_[_0x3d50('0x31')](_0x20b989[_0x3d50('0x3b')],function(_0x1ec8be){var _0x4df920={};_0x4df920[_0x1ec8be]={'$like':'%'+_0x64bf55[_0x3d50('0x37')]['filter']+'%'};return _0x4df920;})});}_0x20b989=_[_0x3d50('0x44')]({},_0x20b989,_0x64bf55['options']);return _0x29fae4[_0x3d50('0x65')](_0x20b989);}})[_0x3d50('0x29')](function(_0x393361){if(_0x393361){_0x49ef06=_0x393361[_0x3d50('0x3c')];if(!_0x64bf55[_0x3d50('0x37')][_0x3d50('0x3d')]('nolimit')){_0x20b989['limit']=qs[_0x3d50('0x22')](_0x64bf55[_0x3d50('0x37')][_0x3d50('0x22')]);_0x20b989[_0x3d50('0x20')]=qs[_0x3d50('0x20')](_0x64bf55[_0x3d50('0x37')][_0x3d50('0x20')]);}return _0x29fae4[_0x3d50('0x65')](_0x20b989);}})[_0x3d50('0x29')](function(_0x44da27){if(_0x44da27){return _0x44da27?{'count':_0x49ef06,'rows':_0x44da27}:null;}})[_0x3d50('0x29')](respondWithResult(_0x447ba1,null))[_0x3d50('0x55')](handleError(_0x447ba1,null));};exports[_0x3d50('0x67')]=function(_0x3d1379,_0x2e5682,_0xc0d293){var _0x4634bd=_0x3d1379['body'][_0x3d50('0x68')];return db[_0x3d50('0x66')]['findAll']({'where':{'id':_0x4634bd},'attributes':['id'],'include':[{'model':db[_0x3d50('0x5d')],'as':_0x3d50('0x69'),'attributes':['id',_0x3d50('0x2f'),_0x3d50('0x6a'),_0x3d50('0x6b'),_0x3d50('0x6c')],'raw':!![]}]})['then'](function(_0x157a98){if(_0x157a98){var _0x532854=_[_0x3d50('0x6d')](_0x157a98,function(_0x5264b3){var _0x3ccf4a=_0x5264b3[_0x3d50('0x4e')]({'plain':!![]});return _0x3ccf4a[_0x3d50('0x69')];});return db['SmsQueue'][_0x3d50('0x51')]({'where':{'id':_0x3d1379[_0x3d50('0x58')]['id']}})[_0x3d50('0x29')](function(_0x2be24e){return db[_0x3d50('0x6e')][_0x3d50('0x6f')](function(_0x1f310d){return _0x2be24e[_0x3d50('0x67')](_0x4634bd,{'transaction':_0x1f310d})[_0x3d50('0x29')](function(){return BPromise[_0x3d50('0x70')](_0x532854,function(_0x53806b){return db[_0x3d50('0x5c')][_0x3d50('0x71')]({'where':{'UserId':_0x53806b['id'],'SmsQueueId':_0x3d1379[_0x3d50('0x58')]['id']},'transaction':_0x1f310d});});})['then'](function(){_0x532854[_0x3d50('0x72')](function(_0x5ef4dc){socket[_0x3d50('0x73')]('userSmsQueue:save',{'UserId':_0x5ef4dc['id'],'SmsQueueId':_0x2be24e['id']});});});});});}})[_0x3d50('0x29')](respondWithStatusCode(_0x2e5682,null))[_0x3d50('0x55')](handleError(_0x2e5682,null));};exports['removeTeams']=function(_0x256713,_0x412514,_0x51f004){return db[_0x3d50('0x66')][_0x3d50('0x47')]({'where':{'id':_0x256713[_0x3d50('0x37')][_0x3d50('0x68')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x3d50('0x69'),'attributes':['id'],'raw':!![]}]})[_0x3d50('0x29')](handleEntityNotFound(_0x412514,null))[_0x3d50('0x29')](function(_0x36ac38){var _0x58539f=_[_0x3d50('0x31')](_0x36ac38,'id');var _0x48d48c=[];var _0xf0d068=[];var _0x28cf12=squel[_0x3d50('0x74')]();_0x28cf12['field'](_0x3d50('0x75'))[_0x3d50('0x76')](_0x3d50('0x77'),'tq')[_0x3d50('0x78')]('user_has_teams','ut',_0x3d50('0x79'))[_0x3d50('0x41')](_0x3d50('0x7a'),_0x256713[_0x3d50('0x58')]['id']);for(var _0x3f5919=0x0;_0x3f5919<_0x36ac38['length'];_0x3f5919+=0x1){let _0x36f949=_0x36ac38[_0x3f5919];for(var _0x50ae50=0x0;_0x50ae50<_0x36f949[_0x3d50('0x69')][_0x3d50('0x3c')];_0x50ae50+=0x1){let _0x2d23b7=_0x36f949[_0x3d50('0x69')][_0x50ae50];var _0x5e96fe=_0x28cf12[_0x3d50('0x7b')]();_0x5e96fe[_0x3d50('0x41')](_0x3d50('0x7c'),_0x2d23b7['id']);_0xf0d068[_0x3d50('0x7d')](db['sequelize'][_0x3d50('0x37')](_0x5e96fe[_0x3d50('0x7e')](),{'type':db[_0x3d50('0x6e')][_0x3d50('0x7f')][_0x3d50('0x80')]})[_0x3d50('0x29')](function(_0x43fd13){if(_0x43fd13[_0x3d50('0x3c')]===0x1){return _0x2d23b7['id'];}else{var _0x8c5778=_[_0x3d50('0x81')](_[_0x3d50('0x31')](_0x43fd13,'TeamId'),function(_0x2ecef4){return _[_0x3d50('0x82')](_0x58539f,_0x2ecef4);});if(_0x8c5778){return _0x2d23b7['id'];}}}));}}return BPromise[_0x3d50('0x83')](_0xf0d068)[_0x3d50('0x29')](function(_0x5a0545){_0x48d48c=_(_0x48d48c)[_0x3d50('0x84')](_0x5a0545)[_0x3d50('0x85')]()['value']();return db[_0x3d50('0x32')][_0x3d50('0x51')]({'where':{'id':_0x256713[_0x3d50('0x58')]['id']}})[_0x3d50('0x29')](function(_0x6efbdb){return db[_0x3d50('0x6e')][_0x3d50('0x6f')](function(_0x2e48d5){return _0x6efbdb[_0x3d50('0x86')](_0x256713[_0x3d50('0x37')]['ids'],{'transaction':_0x2e48d5})['then'](function(){if(!_[_0x3d50('0x87')](_0x48d48c)){return _0x6efbdb[_0x3d50('0x88')](_0x48d48c,{'transaction':_0x2e48d5});}})[_0x3d50('0x29')](function(){_0x48d48c['forEach'](function(_0x42e073){socket[_0x3d50('0x73')](_0x3d50('0x89'),{'UserId':_0x42e073,'SmsQueueId':_0x6efbdb['id']});});});});});});})[_0x3d50('0x29')](respondWithStatusCode(_0x412514,null))[_0x3d50('0x55')](handleError(_0x412514,null));};exports[_0x3d50('0x8a')]=function(_0x112a38,_0x2c3d2c,_0x3938ad){return db[_0x3d50('0x32')][_0x3d50('0x51')]({'where':{'id':_0x112a38[_0x3d50('0x58')]['id']}})['then'](handleEntityNotFound(_0x2c3d2c,null))[_0x3d50('0x29')](function(_0x3d7e0b){if(_0x3d7e0b){return _0x3d7e0b[_0x3d50('0x8a')](_0x112a38['body']['ids'],_[_0x3d50('0x8b')](_0x112a38['body'],[_0x3d50('0x68'),'id'])||{})['spread'](function(_0x2569fe){for(var _0x2cf899=0x0;_0x2cf899<_0x112a38[_0x3d50('0x57')][_0x3d50('0x68')][_0x3d50('0x3c')];_0x2cf899+=0x1){socket[_0x3d50('0x73')](_0x3d50('0x8c'),{'UserId':Number(_0x112a38[_0x3d50('0x57')][_0x3d50('0x68')][_0x2cf899]),'SmsQueueId':Number(_0x112a38[_0x3d50('0x58')]['id'])});}return _0x2569fe;});}})['then'](respondWithResult(_0x2c3d2c,null))[_0x3d50('0x55')](handleError(_0x2c3d2c,null));};exports[_0x3d50('0x88')]=function(_0x4e6a1b,_0xce25dd,_0x1a74ba){return db[_0x3d50('0x32')][_0x3d50('0x51')]({'where':{'id':_0x4e6a1b[_0x3d50('0x58')]['id']}})[_0x3d50('0x29')](handleEntityNotFound(_0xce25dd,null))[_0x3d50('0x29')](function(_0x254617){if(_0x254617){return _0x254617[_0x3d50('0x88')](_0x4e6a1b[_0x3d50('0x37')][_0x3d50('0x68')])['then'](function(){if(_[_0x3d50('0x8d')](_0x4e6a1b[_0x3d50('0x37')][_0x3d50('0x68')])){for(var _0x56eea0=0x0;_0x56eea0<_0x4e6a1b[_0x3d50('0x37')][_0x3d50('0x68')][_0x3d50('0x3c')];_0x56eea0+=0x1){socket[_0x3d50('0x73')](_0x3d50('0x89'),{'UserId':Number(_0x4e6a1b[_0x3d50('0x37')]['ids'][_0x56eea0]),'SmsQueueId':Number(_0x4e6a1b['params']['id'])});}}else{socket[_0x3d50('0x73')](_0x3d50('0x89'),{'UserId':Number(_0x4e6a1b[_0x3d50('0x37')]['ids']),'SmsQueueId':Number(_0x4e6a1b[_0x3d50('0x58')]['id'])});}});}})[_0x3d50('0x29')](respondWithStatusCode(_0xce25dd,null))[_0x3d50('0x55')](handleError(_0xce25dd,null));};exports[_0x3d50('0x8e')]=function(_0x193b1d,_0x56110d,_0x1cb832){var _0x2fdec0={};var _0x368b8c={};var _0x3076b8;var _0x2e56af;return db[_0x3d50('0x32')][_0x3d50('0x5b')]({'where':{'id':_0x193b1d[_0x3d50('0x58')]['id']}})[_0x3d50('0x29')](handleEntityNotFound(_0x56110d,null))[_0x3d50('0x29')](function(_0x4f5b11){if(_0x4f5b11){_0x3076b8=_0x4f5b11;_0x368b8c[_0x3d50('0x36')]=_['keys'](db[_0x3d50('0x5d')]['rawAttributes']);_0x368b8c[_0x3d50('0x37')]=_['keys'](_0x193b1d[_0x3d50('0x37')]);_0x368b8c['filters']=_[_0x3d50('0x3a')](_0x368b8c['model'],_0x368b8c[_0x3d50('0x37')]);_0x2fdec0[_0x3d50('0x3b')]=_['intersection'](_0x368b8c['model'],qs[_0x3d50('0x4a')](_0x193b1d['query'][_0x3d50('0x4a')]));_0x2fdec0['attributes']=_0x2fdec0[_0x3d50('0x3b')][_0x3d50('0x3c')]?_0x2fdec0[_0x3d50('0x3b')]:_0x368b8c[_0x3d50('0x36')];_0x2fdec0[_0x3d50('0x3f')]=qs[_0x3d50('0x40')](_0x193b1d[_0x3d50('0x37')][_0x3d50('0x40')]);_0x2fdec0[_0x3d50('0x41')]=qs[_0x3d50('0x39')](_[_0x3d50('0x42')](_0x193b1d['query'],_0x368b8c[_0x3d50('0x39')]));if(_0x193b1d[_0x3d50('0x37')]['filter']){_0x2fdec0[_0x3d50('0x41')]=_[_0x3d50('0x44')](_0x2fdec0[_0x3d50('0x41')],{'$or':_['map'](_0x2fdec0[_0x3d50('0x3b')],function(_0x4d0ea6){var _0x52b99e={};_0x52b99e[_0x4d0ea6]={'$like':'%'+_0x193b1d['query'][_0x3d50('0x43')]+'%'};return _0x52b99e;})});}_0x2fdec0=_[_0x3d50('0x44')]({},_0x2fdec0,_0x193b1d[_0x3d50('0x4c')]);return _0x3076b8[_0x3d50('0x8e')](_0x2fdec0);}})[_0x3d50('0x29')](function(_0xa76442){if(_0xa76442){_0x2e56af=_0xa76442[_0x3d50('0x3c')];if(!_0x193b1d[_0x3d50('0x37')][_0x3d50('0x3d')](_0x3d50('0x3e'))){_0x2fdec0['limit']=qs['limit'](_0x193b1d[_0x3d50('0x37')][_0x3d50('0x22')]);_0x2fdec0['offset']=qs[_0x3d50('0x20')](_0x193b1d['query'][_0x3d50('0x20')]);}return _0x3076b8[_0x3d50('0x8e')](_0x2fdec0);}})['then'](function(_0x20bc39){if(_0x20bc39){return _0x20bc39?{'count':_0x2e56af,'rows':_0x20bc39}:null;}})[_0x3d50('0x29')](respondWithResult(_0x56110d,null))[_0x3d50('0x55')](handleError(_0x56110d,null));}; \ No newline at end of file +var _0xd664=['every','TeamId','includes','all','union','compact','value','isEmpty','removeAgents','userSmsQueue:remove','addAgents','omit','spread','getAgents','eml-format','rimraf','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','get','SmsQueues','UserProfileResource','destroy','stack','name','send','index','map','SmsQueue','rawAttributes','fieldName','type','key','model','keys','query','intersection','fields','attributes','length','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','catch','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','getMembers','findOne','UserSmsQueue','order','SmsQueueId','findAll','User','findAndCountAll','UserId','agent','smsPause','updatedAt','createdAt','rows','format','%s/%s','SIP','getTeams','Team','hasOwnProperty','addTeams','voicePause','interface','flatMap','Agents','transaction','each','findOrCreate','forEach','emit','userSmsQueue:save','ids','select','field','from','team_has_sms_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','SmsQueueId\x20=\x20?','clone','push','sequelize','toString','QueryTypes'];(function(_0xa1e3e3,_0x29fe0e){var _0xc980e9=function(_0x1f5adc){while(--_0x1f5adc){_0xa1e3e3['push'](_0xa1e3e3['shift']());}};_0xc980e9(++_0x29fe0e);}(_0xd664,0xa5));var _0x4d66=function(_0x288d36,_0x1b283c){_0x288d36=_0x288d36-0x0;var _0x35590e=_0xd664[_0x288d36];return _0x35590e;};'use strict';var emlformat=require(_0x4d66('0x0'));var rimraf=require(_0x4d66('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x4d66('0x2'));var BPromise=require(_0x4d66('0x3'));var Mustache=require('mustache');var util=require(_0x4d66('0x4'));var path=require(_0x4d66('0x5'));var sox=require(_0x4d66('0x6'));var csv=require(_0x4d66('0x7'));var ejs=require(_0x4d66('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4d66('0x9'));var squel=require(_0x4d66('0xa'));var crypto=require(_0x4d66('0xb'));var jsforce=require(_0x4d66('0xc'));var deskjs=require(_0x4d66('0xd'));var toCsv=require(_0x4d66('0x7'));var querystring=require(_0x4d66('0xe'));var Papa=require(_0x4d66('0xf'));var Redis=require(_0x4d66('0x10'));var authService=require(_0x4d66('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x4d66('0x12'));var hardwareService=require(_0x4d66('0x13'));var logger=require(_0x4d66('0x14'))(_0x4d66('0x15'));var utils=require(_0x4d66('0x16'));var config=require(_0x4d66('0x17'));var licenseUtil=require(_0x4d66('0x18'));var db=require(_0x4d66('0x19'))['db'];config[_0x4d66('0x1a')]=_[_0x4d66('0x1b')](config[_0x4d66('0x1a')],{'host':_0x4d66('0x1c'),'port':0x18eb});var socket=require(_0x4d66('0x1d'))(new Redis(config[_0x4d66('0x1a')]));require('./smsQueue.socket')[_0x4d66('0x1e')](socket);function respondWithStatusCode(_0x5e1de3,_0x175519){_0x175519=_0x175519||0xcc;return function(_0x3624db){if(_0x3624db){return _0x5e1de3[_0x4d66('0x1f')](_0x175519);}return _0x5e1de3['status'](_0x175519)[_0x4d66('0x20')]();};}function respondWithResult(_0x3d3cda,_0x54ec23){_0x54ec23=_0x54ec23||0xc8;return function(_0x4f0150){if(_0x4f0150){return _0x3d3cda[_0x4d66('0x21')](_0x54ec23)[_0x4d66('0x22')](_0x4f0150);}};}function respondWithFilteredResult(_0x2710f5,_0x57fbfb){return function(_0x2c621a){if(_0x2c621a){var _0x2e5fb3=typeof _0x57fbfb[_0x4d66('0x23')]===_0x4d66('0x24')&&typeof _0x57fbfb[_0x4d66('0x25')]===_0x4d66('0x24');var _0x1b2101=_0x2c621a[_0x4d66('0x26')];var _0x1c8fc1=_0x2e5fb3?0x0:_0x57fbfb['offset'];var _0x28f938=_0x2e5fb3?_0x2c621a[_0x4d66('0x26')]:_0x57fbfb[_0x4d66('0x23')]+_0x57fbfb[_0x4d66('0x25')];var _0x3d9f93;if(_0x28f938>=_0x1b2101){_0x28f938=_0x1b2101;_0x3d9f93=0xc8;}else{_0x3d9f93=0xce;}_0x2710f5['status'](_0x3d9f93);return _0x2710f5[_0x4d66('0x27')](_0x4d66('0x28'),_0x1c8fc1+'-'+_0x28f938+'/'+_0x1b2101)[_0x4d66('0x22')](_0x2c621a);}return null;};}function patchUpdates(_0x309e63){return function(_0x526933){try{jsonpatch[_0x4d66('0x29')](_0x526933,_0x309e63,!![]);}catch(_0x2a2fd6){return BPromise[_0x4d66('0x2a')](_0x2a2fd6);}return _0x526933[_0x4d66('0x2b')]();};}function saveUpdates(_0x4f01d3,_0x1dff79){return function(_0x149f7d){if(_0x149f7d){return _0x149f7d['update'](_0x4f01d3)['then'](function(_0x3266aa){return _0x3266aa;});}return null;};}function removeEntity(_0x5b7a31,_0x2a39ed){return function(_0x51760a){if(_0x51760a){return _0x51760a['destroy']()[_0x4d66('0x2c')](function(){var _0x5063ba=_0x51760a[_0x4d66('0x2d')]({'plain':!![]});var _0x55b74e=_0x4d66('0x2e');return db[_0x4d66('0x2f')][_0x4d66('0x30')]({'where':{'type':_0x55b74e,'resourceId':_0x5063ba['id']}})[_0x4d66('0x2c')](function(){return _0x51760a;});})['then'](function(){_0x5b7a31[_0x4d66('0x21')](0xcc)[_0x4d66('0x20')]();});}};}function handleEntityNotFound(_0x3e1626,_0x1043fa){return function(_0x37fde8){if(!_0x37fde8){_0x3e1626['sendStatus'](0x194);}return _0x37fde8;};}function handleError(_0x558afd,_0x4f0504){_0x4f0504=_0x4f0504||0x1f4;return function(_0x53348e){logger['error'](_0x53348e[_0x4d66('0x31')]);if(_0x53348e['name']){delete _0x53348e[_0x4d66('0x32')];}_0x558afd[_0x4d66('0x21')](_0x4f0504)[_0x4d66('0x33')](_0x53348e);};}exports[_0x4d66('0x34')]=function(_0x108add,_0x1456b9){var _0x5b9e45={},_0x39c2b6={},_0x126694={'count':0x0,'rows':[]};var _0x576416=_[_0x4d66('0x35')](db[_0x4d66('0x36')][_0x4d66('0x37')],function(_0x37dcd8){return{'name':_0x37dcd8[_0x4d66('0x38')],'type':_0x37dcd8[_0x4d66('0x39')][_0x4d66('0x3a')]};});_0x39c2b6[_0x4d66('0x3b')]=_[_0x4d66('0x35')](_0x576416,_0x4d66('0x32'));_0x39c2b6['query']=_[_0x4d66('0x3c')](_0x108add[_0x4d66('0x3d')]);_0x39c2b6['filters']=_[_0x4d66('0x3e')](_0x39c2b6['model'],_0x39c2b6['query']);_0x5b9e45['attributes']=_[_0x4d66('0x3e')](_0x39c2b6[_0x4d66('0x3b')],qs[_0x4d66('0x3f')](_0x108add[_0x4d66('0x3d')][_0x4d66('0x3f')]));_0x5b9e45[_0x4d66('0x40')]=_0x5b9e45[_0x4d66('0x40')][_0x4d66('0x41')]?_0x5b9e45[_0x4d66('0x40')]:_0x39c2b6['model'];if(!_0x108add['query']['hasOwnProperty'](_0x4d66('0x42'))){_0x5b9e45[_0x4d66('0x25')]=qs[_0x4d66('0x25')](_0x108add[_0x4d66('0x3d')]['limit']);_0x5b9e45['offset']=qs[_0x4d66('0x23')](_0x108add[_0x4d66('0x3d')][_0x4d66('0x23')]);}_0x5b9e45['order']=qs[_0x4d66('0x43')](_0x108add[_0x4d66('0x3d')][_0x4d66('0x43')]);_0x5b9e45[_0x4d66('0x44')]=qs[_0x4d66('0x45')](_[_0x4d66('0x46')](_0x108add[_0x4d66('0x3d')],_0x39c2b6[_0x4d66('0x45')]),_0x576416);if(_0x108add['query'][_0x4d66('0x47')]){_0x5b9e45['where']=_[_0x4d66('0x48')](_0x5b9e45[_0x4d66('0x44')],{'$or':_[_0x4d66('0x35')](_0x576416,function(_0x540d06){if(_0x540d06['type']!==_0x4d66('0x49')){var _0x57652a={};_0x57652a[_0x540d06[_0x4d66('0x32')]]={'$like':'%'+_0x108add['query'][_0x4d66('0x47')]+'%'};return _0x57652a;}})});}_0x5b9e45=_[_0x4d66('0x48')]({},_0x5b9e45,_0x108add[_0x4d66('0x4a')]);var _0x1c447e={'where':_0x5b9e45[_0x4d66('0x44')]};return db[_0x4d66('0x36')][_0x4d66('0x26')](_0x1c447e)['then'](function(_0x4bf45d){_0x126694[_0x4d66('0x26')]=_0x4bf45d;if(_0x108add[_0x4d66('0x3d')][_0x4d66('0x4b')]){_0x5b9e45[_0x4d66('0x4c')]=[{'all':!![]}];}return db[_0x4d66('0x36')]['findAll'](_0x5b9e45);})[_0x4d66('0x2c')](function(_0xfe3cd4){_0x126694['rows']=_0xfe3cd4;return _0x126694;})[_0x4d66('0x2c')](respondWithFilteredResult(_0x1456b9,_0x5b9e45))[_0x4d66('0x4d')](handleError(_0x1456b9,null));};exports['show']=function(_0x4858bc,_0x11924f){var _0xa45315={'raw':!![],'where':{'id':_0x4858bc[_0x4d66('0x4e')]['id']}},_0x36acec={};_0x36acec[_0x4d66('0x3b')]=_[_0x4d66('0x3c')](db[_0x4d66('0x36')][_0x4d66('0x37')]);_0x36acec[_0x4d66('0x3d')]=_['keys'](_0x4858bc[_0x4d66('0x3d')]);_0x36acec[_0x4d66('0x45')]=_[_0x4d66('0x3e')](_0x36acec['model'],_0x36acec[_0x4d66('0x3d')]);_0xa45315[_0x4d66('0x40')]=_['intersection'](_0x36acec[_0x4d66('0x3b')],qs[_0x4d66('0x3f')](_0x4858bc[_0x4d66('0x3d')][_0x4d66('0x3f')]));_0xa45315[_0x4d66('0x40')]=_0xa45315['attributes'][_0x4d66('0x41')]?_0xa45315[_0x4d66('0x40')]:_0x36acec[_0x4d66('0x3b')];if(_0x4858bc[_0x4d66('0x3d')]['includeAll']){_0xa45315[_0x4d66('0x4c')]=[{'all':!![]}];}_0xa45315=_[_0x4d66('0x48')]({},_0xa45315,_0x4858bc['options']);return db[_0x4d66('0x36')][_0x4d66('0x4f')](_0xa45315)[_0x4d66('0x2c')](handleEntityNotFound(_0x11924f,null))[_0x4d66('0x2c')](respondWithResult(_0x11924f,null))[_0x4d66('0x4d')](handleError(_0x11924f,null));};exports[_0x4d66('0x50')]=function(_0x51cc22,_0x4a7971){return db[_0x4d66('0x36')][_0x4d66('0x50')](_0x51cc22[_0x4d66('0x51')],{})['then'](function(_0x223ff0){var _0x24cdc1=_0x51cc22[_0x4d66('0x52')][_0x4d66('0x2d')]({'plain':!![]});if(!_0x24cdc1)throw new Error(_0x4d66('0x53'));if(_0x24cdc1[_0x4d66('0x54')]==='user'){var _0x387a0c=_0x223ff0[_0x4d66('0x2d')]({'plain':!![]});var _0x25c938=_0x4d66('0x2e');return db[_0x4d66('0x55')][_0x4d66('0x4f')]({'where':{'name':_0x25c938,'userProfileId':_0x24cdc1[_0x4d66('0x56')]},'raw':!![]})['then'](function(_0xe498b2){if(_0xe498b2&&_0xe498b2[_0x4d66('0x57')]===0x0){return db['UserProfileResource']['create']({'name':_0x387a0c[_0x4d66('0x32')],'resourceId':_0x387a0c['id'],'type':_0xe498b2[_0x4d66('0x32')],'sectionId':_0xe498b2['id']},{})[_0x4d66('0x2c')](function(){return _0x223ff0;});}else{return _0x223ff0;}})[_0x4d66('0x4d')](function(_0x4fee79){logger[_0x4d66('0x58')](_0x4d66('0x59'),_0x4fee79);throw _0x4fee79;});}return _0x223ff0;})[_0x4d66('0x2c')](respondWithResult(_0x4a7971,0xc9))['catch'](handleError(_0x4a7971,null));};exports[_0x4d66('0x5a')]=function(_0x4c673e,_0x13db1c){if(_0x4c673e[_0x4d66('0x51')]['id']){delete _0x4c673e[_0x4d66('0x51')]['id'];}return db[_0x4d66('0x36')][_0x4d66('0x4f')]({'where':{'id':_0x4c673e[_0x4d66('0x4e')]['id']}})[_0x4d66('0x2c')](handleEntityNotFound(_0x13db1c,null))[_0x4d66('0x2c')](saveUpdates(_0x4c673e[_0x4d66('0x51')],null))[_0x4d66('0x2c')](respondWithResult(_0x13db1c,null))[_0x4d66('0x4d')](handleError(_0x13db1c,null));};exports[_0x4d66('0x30')]=function(_0x151f94,_0x108f40){return db[_0x4d66('0x36')][_0x4d66('0x4f')]({'where':{'id':_0x151f94[_0x4d66('0x4e')]['id']}})[_0x4d66('0x2c')](handleEntityNotFound(_0x108f40,null))['then'](removeEntity(_0x108f40,null))['catch'](handleError(_0x108f40,null));};exports['describe']=function(_0x54bf85,_0xce5da2){return db[_0x4d66('0x36')][_0x4d66('0x5b')]()[_0x4d66('0x2c')](respondWithResult(_0xce5da2,null))[_0x4d66('0x4d')](handleError(_0xce5da2,null));};exports[_0x4d66('0x5c')]=function(_0x5b47c2,_0x17cce5,_0x2e6330){var _0xaea24f={'raw':!![],'where':{}},_0x23285d={},_0x4af3f4;return db[_0x4d66('0x36')][_0x4d66('0x5d')]({'where':{'id':_0x5b47c2[_0x4d66('0x4e')]['id']}})[_0x4d66('0x2c')](handleEntityNotFound(_0x17cce5,null))['then'](function(_0x4bdbb3){if(_0x4bdbb3){_0x4af3f4=_0x4bdbb3[_0x4d66('0x2d')]({'plain':!![]});_0x23285d['model']=_[_0x4d66('0x3c')](db[_0x4d66('0x5e')][_0x4d66('0x37')]);_0x23285d[_0x4d66('0x3d')]=_[_0x4d66('0x3c')](_0x5b47c2[_0x4d66('0x3d')]);_0x23285d[_0x4d66('0x45')]=_[_0x4d66('0x3e')](_0x23285d[_0x4d66('0x3b')],_0x23285d['query']);_0xaea24f[_0x4d66('0x40')]=_['intersection'](_0x23285d[_0x4d66('0x3b')],qs[_0x4d66('0x3f')](_0x5b47c2[_0x4d66('0x3d')][_0x4d66('0x3f')]));_0xaea24f[_0x4d66('0x40')]=_0xaea24f['attributes'][_0x4d66('0x41')]?_0xaea24f[_0x4d66('0x40')]:_0x23285d[_0x4d66('0x3b')];if(!_0x5b47c2[_0x4d66('0x3d')]['hasOwnProperty'](_0x4d66('0x42'))){_0xaea24f[_0x4d66('0x25')]=qs[_0x4d66('0x25')](_0x5b47c2['query'][_0x4d66('0x25')]);_0xaea24f[_0x4d66('0x23')]=qs[_0x4d66('0x23')](_0x5b47c2[_0x4d66('0x3d')][_0x4d66('0x23')]);}_0xaea24f[_0x4d66('0x5f')]=qs[_0x4d66('0x43')](_0x5b47c2[_0x4d66('0x3d')][_0x4d66('0x43')]);_0xaea24f['where']=qs[_0x4d66('0x45')](_[_0x4d66('0x46')](_0x5b47c2[_0x4d66('0x3d')],_0x23285d[_0x4d66('0x45')]));_0xaea24f[_0x4d66('0x44')][_0x4d66('0x60')]=_0x4bdbb3['id'];if(_0x5b47c2[_0x4d66('0x3d')][_0x4d66('0x47')]){_0xaea24f[_0x4d66('0x44')]=_[_0x4d66('0x48')](_0xaea24f['where'],{'$or':_[_0x4d66('0x35')](_0xaea24f[_0x4d66('0x40')],function(_0xcedf19){var _0x2ada4c={};_0x2ada4c[_0xcedf19]={'$like':'%'+_0x5b47c2[_0x4d66('0x3d')]['filter']+'%'};return _0x2ada4c;})});}_0xaea24f=_['merge']({},_0xaea24f,_0x5b47c2[_0x4d66('0x4a')]);return db['UserSmsQueue'][_0x4d66('0x61')](_0xaea24f);}})[_0x4d66('0x2c')](function(_0x1950b5){if(_0x1950b5){return db[_0x4d66('0x62')][_0x4d66('0x63')]({'where':{'id':_['map'](_0x1950b5,_0x4d66('0x64')),'role':_0x4d66('0x65')},'attributes':['id',_0x4d66('0x32'),_0x4d66('0x66'),_0x4d66('0x67'),_0x4d66('0x68')]});}})[_0x4d66('0x2c')](function(_0x4545fa){if(_0x4545fa){return{'count':_0x4545fa[_0x4d66('0x26')],'rows':_[_0x4d66('0x35')](_0x4545fa[_0x4d66('0x69')],function(_0x47ec1d){return{'membername':_0x47ec1d['name'],'UserId':_0x47ec1d['id'],'queue_name':_0x4af3f4[_0x4d66('0x32')],'SmsQueueId':_0x4af3f4['id'],'interface':util[_0x4d66('0x6a')](_0x4d66('0x6b'),_0x4d66('0x6c'),_0x47ec1d[_0x4d66('0x32')]),'penalty':0x0,'paused':_0x47ec1d[_0x4d66('0x66')],'createdAt':_0x47ec1d[_0x4d66('0x68')],'updatedAt':_0x47ec1d[_0x4d66('0x67')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x17cce5,_0xaea24f))[_0x4d66('0x4d')](handleError(_0x17cce5,null));};exports[_0x4d66('0x6d')]=function(_0x231fcb,_0x5dd4c7,_0x5e75b8){var _0x59acbb={};var _0xffc27={};var _0x368f7d;var _0x27bf46;return db[_0x4d66('0x36')]['findOne']({'where':{'id':_0x231fcb[_0x4d66('0x4e')]['id']}})['then'](handleEntityNotFound(_0x5dd4c7,null))['then'](function(_0x5134a5){if(_0x5134a5){_0x368f7d=_0x5134a5;_0xffc27[_0x4d66('0x3b')]=_[_0x4d66('0x3c')](db[_0x4d66('0x6e')][_0x4d66('0x37')]);_0xffc27[_0x4d66('0x3d')]=_[_0x4d66('0x3c')](_0x231fcb[_0x4d66('0x3d')]);_0xffc27[_0x4d66('0x45')]=_[_0x4d66('0x3e')](_0xffc27[_0x4d66('0x3b')],_0xffc27[_0x4d66('0x3d')]);_0x59acbb[_0x4d66('0x40')]=_['intersection'](_0xffc27['model'],qs[_0x4d66('0x3f')](_0x231fcb[_0x4d66('0x3d')][_0x4d66('0x3f')]));_0x59acbb[_0x4d66('0x40')]=_0x59acbb[_0x4d66('0x40')]['length']?_0x59acbb['attributes']:_0xffc27['model'];_0x59acbb[_0x4d66('0x5f')]=qs['sort'](_0x231fcb[_0x4d66('0x3d')][_0x4d66('0x43')]);_0x59acbb[_0x4d66('0x44')]=qs['filters'](_[_0x4d66('0x46')](_0x231fcb['query'],_0xffc27['filters']));if(_0x231fcb[_0x4d66('0x3d')][_0x4d66('0x47')]){_0x59acbb[_0x4d66('0x44')]=_[_0x4d66('0x48')](_0x59acbb[_0x4d66('0x44')],{'$or':_[_0x4d66('0x35')](_0x59acbb[_0x4d66('0x40')],function(_0x16d599){var _0x493200={};_0x493200[_0x16d599]={'$like':'%'+_0x231fcb[_0x4d66('0x3d')][_0x4d66('0x47')]+'%'};return _0x493200;})});}_0x59acbb=_['merge']({},_0x59acbb,_0x231fcb[_0x4d66('0x4a')]);return _0x368f7d['getTeams'](_0x59acbb);}})[_0x4d66('0x2c')](function(_0x3de064){if(_0x3de064){_0x27bf46=_0x3de064['length'];if(!_0x231fcb[_0x4d66('0x3d')][_0x4d66('0x6f')](_0x4d66('0x42'))){_0x59acbb['limit']=qs[_0x4d66('0x25')](_0x231fcb['query'][_0x4d66('0x25')]);_0x59acbb[_0x4d66('0x23')]=qs[_0x4d66('0x23')](_0x231fcb[_0x4d66('0x3d')][_0x4d66('0x23')]);}return _0x368f7d[_0x4d66('0x6d')](_0x59acbb);}})['then'](function(_0x3ea83a){if(_0x3ea83a){return _0x3ea83a?{'count':_0x27bf46,'rows':_0x3ea83a}:null;}})[_0x4d66('0x2c')](respondWithResult(_0x5dd4c7,null))['catch'](handleError(_0x5dd4c7,null));};exports[_0x4d66('0x70')]=function(_0x419694,_0x2935ff,_0x15cb85){var _0x68e79=_0x419694['body']['ids'];return db[_0x4d66('0x6e')][_0x4d66('0x61')]({'where':{'id':_0x68e79},'attributes':['id'],'include':[{'model':db[_0x4d66('0x62')],'as':'Agents','attributes':['id',_0x4d66('0x32'),'online',_0x4d66('0x71'),_0x4d66('0x72')],'raw':!![]}]})[_0x4d66('0x2c')](function(_0x203510){if(_0x203510){var _0x1b2235=_[_0x4d66('0x73')](_0x203510,function(_0x5d8d33){var _0x465882=_0x5d8d33[_0x4d66('0x2d')]({'plain':!![]});return _0x465882[_0x4d66('0x74')];});return db[_0x4d66('0x36')][_0x4d66('0x4f')]({'where':{'id':_0x419694[_0x4d66('0x4e')]['id']}})[_0x4d66('0x2c')](function(_0x403b8c){return db['sequelize'][_0x4d66('0x75')](function(_0x4950fd){return _0x403b8c[_0x4d66('0x70')](_0x68e79,{'transaction':_0x4950fd})[_0x4d66('0x2c')](function(){return BPromise[_0x4d66('0x76')](_0x1b2235,function(_0x3a6b84){return db[_0x4d66('0x5e')][_0x4d66('0x77')]({'where':{'UserId':_0x3a6b84['id'],'SmsQueueId':_0x419694[_0x4d66('0x4e')]['id']},'transaction':_0x4950fd});});})['then'](function(){_0x1b2235[_0x4d66('0x78')](function(_0x32b77b){socket[_0x4d66('0x79')](_0x4d66('0x7a'),{'UserId':_0x32b77b['id'],'SmsQueueId':_0x403b8c['id']});});});});});}})[_0x4d66('0x2c')](respondWithStatusCode(_0x2935ff,null))[_0x4d66('0x4d')](handleError(_0x2935ff,null));};exports['removeTeams']=function(_0x22256f,_0x37d26a,_0x486e60){return db[_0x4d66('0x6e')][_0x4d66('0x61')]({'where':{'id':_0x22256f[_0x4d66('0x3d')][_0x4d66('0x7b')]},'attributes':['id'],'include':[{'model':db[_0x4d66('0x62')],'as':_0x4d66('0x74'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x37d26a,null))['then'](function(_0x5f1290){var _0x31abd3=_['map'](_0x5f1290,'id');var _0x309016=[];var _0x389860=[];var _0x131e89=squel[_0x4d66('0x7c')]();_0x131e89[_0x4d66('0x7d')]('tq.TeamId')[_0x4d66('0x7e')](_0x4d66('0x7f'),'tq')[_0x4d66('0x80')](_0x4d66('0x81'),'ut',_0x4d66('0x82'))['where'](_0x4d66('0x83'),_0x22256f[_0x4d66('0x4e')]['id']);for(var _0x161492=0x0;_0x161492<_0x5f1290[_0x4d66('0x41')];_0x161492+=0x1){let _0x1ce448=_0x5f1290[_0x161492];for(var _0x2665fe=0x0;_0x2665fe<_0x1ce448[_0x4d66('0x74')][_0x4d66('0x41')];_0x2665fe+=0x1){let _0x53d095=_0x1ce448[_0x4d66('0x74')][_0x2665fe];var _0x59e9d1=_0x131e89[_0x4d66('0x84')]();_0x59e9d1['where']('ut.UserId\x20=\x20?',_0x53d095['id']);_0x389860[_0x4d66('0x85')](db[_0x4d66('0x86')][_0x4d66('0x3d')](_0x59e9d1[_0x4d66('0x87')](),{'type':db[_0x4d66('0x86')][_0x4d66('0x88')]['SELECT']})[_0x4d66('0x2c')](function(_0x58b82a){if(_0x58b82a[_0x4d66('0x41')]===0x1){return _0x53d095['id'];}else{var _0x141b86=_[_0x4d66('0x89')](_[_0x4d66('0x35')](_0x58b82a,_0x4d66('0x8a')),function(_0x32a0a8){return _[_0x4d66('0x8b')](_0x31abd3,_0x32a0a8);});if(_0x141b86){return _0x53d095['id'];}}}));}}return BPromise[_0x4d66('0x8c')](_0x389860)[_0x4d66('0x2c')](function(_0x22a6d2){_0x309016=_(_0x309016)[_0x4d66('0x8d')](_0x22a6d2)[_0x4d66('0x8e')]()[_0x4d66('0x8f')]();return db[_0x4d66('0x36')][_0x4d66('0x4f')]({'where':{'id':_0x22256f[_0x4d66('0x4e')]['id']}})[_0x4d66('0x2c')](function(_0x642eb7){return db[_0x4d66('0x86')]['transaction'](function(_0x595a33){return _0x642eb7['removeTeams'](_0x22256f[_0x4d66('0x3d')][_0x4d66('0x7b')],{'transaction':_0x595a33})[_0x4d66('0x2c')](function(){if(!_[_0x4d66('0x90')](_0x309016)){return _0x642eb7[_0x4d66('0x91')](_0x309016,{'transaction':_0x595a33});}})[_0x4d66('0x2c')](function(){_0x309016[_0x4d66('0x78')](function(_0x123404){socket[_0x4d66('0x79')](_0x4d66('0x92'),{'UserId':_0x123404,'SmsQueueId':_0x642eb7['id']});});});});});});})[_0x4d66('0x2c')](respondWithStatusCode(_0x37d26a,null))[_0x4d66('0x4d')](handleError(_0x37d26a,null));};exports[_0x4d66('0x93')]=function(_0x130b35,_0x5d5680,_0x55fc8c){return db[_0x4d66('0x36')]['find']({'where':{'id':_0x130b35[_0x4d66('0x4e')]['id']}})[_0x4d66('0x2c')](handleEntityNotFound(_0x5d5680,null))[_0x4d66('0x2c')](function(_0x347ce0){if(_0x347ce0){return _0x347ce0[_0x4d66('0x93')](_0x130b35[_0x4d66('0x51')][_0x4d66('0x7b')],_[_0x4d66('0x94')](_0x130b35[_0x4d66('0x51')],[_0x4d66('0x7b'),'id'])||{})[_0x4d66('0x95')](function(_0x451947){for(var _0xd9c505=0x0;_0xd9c505<_0x130b35[_0x4d66('0x51')][_0x4d66('0x7b')][_0x4d66('0x41')];_0xd9c505+=0x1){socket[_0x4d66('0x79')](_0x4d66('0x7a'),{'UserId':Number(_0x130b35[_0x4d66('0x51')][_0x4d66('0x7b')][_0xd9c505]),'SmsQueueId':Number(_0x130b35[_0x4d66('0x4e')]['id'])});}return _0x451947;});}})['then'](respondWithResult(_0x5d5680,null))[_0x4d66('0x4d')](handleError(_0x5d5680,null));};exports[_0x4d66('0x91')]=function(_0x9312b4,_0x45cf7c,_0x4ede29){return db[_0x4d66('0x36')][_0x4d66('0x4f')]({'where':{'id':_0x9312b4[_0x4d66('0x4e')]['id']}})[_0x4d66('0x2c')](handleEntityNotFound(_0x45cf7c,null))['then'](function(_0x20a918){if(_0x20a918){return _0x20a918[_0x4d66('0x91')](_0x9312b4['query'][_0x4d66('0x7b')])['then'](function(){if(_['isArray'](_0x9312b4[_0x4d66('0x3d')][_0x4d66('0x7b')])){for(var _0x556a08=0x0;_0x556a08<_0x9312b4[_0x4d66('0x3d')][_0x4d66('0x7b')]['length'];_0x556a08+=0x1){socket['emit'](_0x4d66('0x92'),{'UserId':Number(_0x9312b4[_0x4d66('0x3d')][_0x4d66('0x7b')][_0x556a08]),'SmsQueueId':Number(_0x9312b4[_0x4d66('0x4e')]['id'])});}}else{socket[_0x4d66('0x79')](_0x4d66('0x92'),{'UserId':Number(_0x9312b4[_0x4d66('0x3d')][_0x4d66('0x7b')]),'SmsQueueId':Number(_0x9312b4['params']['id'])});}});}})['then'](respondWithStatusCode(_0x45cf7c,null))[_0x4d66('0x4d')](handleError(_0x45cf7c,null));};exports[_0x4d66('0x96')]=function(_0x3d88fd,_0x11e71e,_0x1a850e){var _0x1d417d={};var _0x25b954={};var _0x3e98ab;var _0x21c8e3;return db['SmsQueue'][_0x4d66('0x5d')]({'where':{'id':_0x3d88fd['params']['id']}})[_0x4d66('0x2c')](handleEntityNotFound(_0x11e71e,null))['then'](function(_0x3c9b63){if(_0x3c9b63){_0x3e98ab=_0x3c9b63;_0x25b954[_0x4d66('0x3b')]=_[_0x4d66('0x3c')](db[_0x4d66('0x62')][_0x4d66('0x37')]);_0x25b954[_0x4d66('0x3d')]=_[_0x4d66('0x3c')](_0x3d88fd[_0x4d66('0x3d')]);_0x25b954[_0x4d66('0x45')]=_[_0x4d66('0x3e')](_0x25b954['model'],_0x25b954[_0x4d66('0x3d')]);_0x1d417d['attributes']=_[_0x4d66('0x3e')](_0x25b954['model'],qs[_0x4d66('0x3f')](_0x3d88fd[_0x4d66('0x3d')][_0x4d66('0x3f')]));_0x1d417d[_0x4d66('0x40')]=_0x1d417d['attributes'][_0x4d66('0x41')]?_0x1d417d[_0x4d66('0x40')]:_0x25b954[_0x4d66('0x3b')];_0x1d417d[_0x4d66('0x5f')]=qs[_0x4d66('0x43')](_0x3d88fd['query'][_0x4d66('0x43')]);_0x1d417d[_0x4d66('0x44')]=qs[_0x4d66('0x45')](_[_0x4d66('0x46')](_0x3d88fd[_0x4d66('0x3d')],_0x25b954['filters']));if(_0x3d88fd[_0x4d66('0x3d')][_0x4d66('0x47')]){_0x1d417d[_0x4d66('0x44')]=_[_0x4d66('0x48')](_0x1d417d['where'],{'$or':_['map'](_0x1d417d[_0x4d66('0x40')],function(_0x239656){var _0x4194f4={};_0x4194f4[_0x239656]={'$like':'%'+_0x3d88fd['query']['filter']+'%'};return _0x4194f4;})});}_0x1d417d=_[_0x4d66('0x48')]({},_0x1d417d,_0x3d88fd[_0x4d66('0x4a')]);return _0x3e98ab[_0x4d66('0x96')](_0x1d417d);}})[_0x4d66('0x2c')](function(_0x1947ce){if(_0x1947ce){_0x21c8e3=_0x1947ce[_0x4d66('0x41')];if(!_0x3d88fd['query'][_0x4d66('0x6f')](_0x4d66('0x42'))){_0x1d417d['limit']=qs[_0x4d66('0x25')](_0x3d88fd[_0x4d66('0x3d')]['limit']);_0x1d417d[_0x4d66('0x23')]=qs[_0x4d66('0x23')](_0x3d88fd[_0x4d66('0x3d')]['offset']);}return _0x3e98ab['getAgents'](_0x1d417d);}})[_0x4d66('0x2c')](function(_0x5a43e6){if(_0x5a43e6){return _0x5a43e6?{'count':_0x21c8e3,'rows':_0x5a43e6}:null;}})[_0x4d66('0x2c')](respondWithResult(_0x11e71e,null))['catch'](handleError(_0x11e71e,null));}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index 345615e..5ffed2b 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 _0x819b=['hasOwnProperty','hook','exports','../../mysqldb','SmsQueue','save','update','remove'];(function(_0x46d690,_0xe69d3d){var _0x98dd4f=function(_0xafad5d){while(--_0xafad5d){_0x46d690['push'](_0x46d690['shift']());}};_0x98dd4f(++_0xe69d3d);}(_0x819b,0x193));var _0xb819=function(_0x17314d,_0x9082f8){_0x17314d=_0x17314d-0x0;var _0x2d6750=_0x819b[_0x17314d];return _0x2d6750;};'use strict';var EventEmitter=require('events');var SmsQueue=require(_0xb819('0x0'))['db'][_0xb819('0x1')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xb819('0x2'),'afterUpdate':_0xb819('0x3'),'afterDestroy':_0xb819('0x4')};function emitEvent(_0x54cce1){return function(_0x415e21,_0x53dd37,_0x1a7476){SmsQueueEvents['emit'](_0x54cce1+':'+_0x415e21['id'],_0x415e21);SmsQueueEvents['emit'](_0x54cce1,_0x415e21);_0x1a7476(null);};}for(var e in events){if(events[_0xb819('0x5')](e)){var event=events[e];SmsQueue[_0xb819('0x6')](e,emitEvent(event));}}module[_0xb819('0x7')]=SmsQueueEvents; \ No newline at end of file +var _0x8aed=['save','update','remove','emit','hook','exports','events','SmsQueue','setMaxListeners'];(function(_0x255e5e,_0x485b66){var _0x237f14=function(_0x4154cf){while(--_0x4154cf){_0x255e5e['push'](_0x255e5e['shift']());}};_0x237f14(++_0x485b66);}(_0x8aed,0x1ec));var _0xd8ae=function(_0x5367be,_0x58105a){_0x5367be=_0x5367be-0x0;var _0xcc9296=_0x8aed[_0x5367be];return _0xcc9296;};'use strict';var EventEmitter=require(_0xd8ae('0x0'));var SmsQueue=require('../../mysqldb')['db'][_0xd8ae('0x1')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0xd8ae('0x2')](0x0);var events={'afterCreate':_0xd8ae('0x3'),'afterUpdate':_0xd8ae('0x4'),'afterDestroy':_0xd8ae('0x5')};function emitEvent(_0x560123){return function(_0x18abcd,_0x28f27b,_0x1bbcda){SmsQueueEvents[_0xd8ae('0x6')](_0x560123+':'+_0x18abcd['id'],_0x18abcd);SmsQueueEvents['emit'](_0x560123,_0x18abcd);_0x1bbcda(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsQueue[_0xd8ae('0x7')](e,emitEvent(event));}}module[_0xd8ae('0x8')]=SmsQueueEvents; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.model.js b/server/api/smsQueue/smsQueue.model.js index f46643e..02c5d5d 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 _0xcb21=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsQueue.attributes','exports','define','SmsQueue','sms_queues','lodash','util','../../config/logger'];(function(_0x10a0fa,_0x4c9f7b){var _0x17788a=function(_0x40f701){while(--_0x40f701){_0x10a0fa['push'](_0x10a0fa['shift']());}};_0x17788a(++_0x4c9f7b);}(_0xcb21,0x1b0));var _0x1cb2=function(_0x312fb6,_0x49b5aa){_0x312fb6=_0x312fb6-0x0;var _0x5536f1=_0xcb21[_0x312fb6];return _0x5536f1;};'use strict';var _=require(_0x1cb2('0x0'));var util=require(_0x1cb2('0x1'));var logger=require(_0x1cb2('0x2'))(_0x1cb2('0x3'));var moment=require(_0x1cb2('0x4'));var BPromise=require(_0x1cb2('0x5'));var rp=require(_0x1cb2('0x6'));var fs=require('fs');var path=require(_0x1cb2('0x7'));var rimraf=require(_0x1cb2('0x8'));var config=require(_0x1cb2('0x9'));var attributes=require(_0x1cb2('0xa'));module[_0x1cb2('0xb')]=function(_0x288361,_0x30aaf4){return _0x288361[_0x1cb2('0xc')](_0x1cb2('0xd'),attributes,{'tableName':_0x1cb2('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x81d2=['util','api','bluebird','request-promise','path','../../config/environment','./smsQueue.attributes','exports','SmsQueue','lodash'];(function(_0x19cdb3,_0x21848f){var _0x493c90=function(_0x203331){while(--_0x203331){_0x19cdb3['push'](_0x19cdb3['shift']());}};_0x493c90(++_0x21848f);}(_0x81d2,0x1e9));var _0x281d=function(_0x373898,_0x3c6df5){_0x373898=_0x373898-0x0;var _0x4bad81=_0x81d2[_0x373898];return _0x4bad81;};'use strict';var _=require(_0x281d('0x0'));var util=require(_0x281d('0x1'));var logger=require('../../config/logger')(_0x281d('0x2'));var moment=require('moment');var BPromise=require(_0x281d('0x3'));var rp=require(_0x281d('0x4'));var fs=require('fs');var path=require(_0x281d('0x5'));var rimraf=require('rimraf');var config=require(_0x281d('0x6'));var attributes=require(_0x281d('0x7'));module[_0x281d('0x8')]=function(_0x226569,_0x17e47f){return _0x226569['define'](_0x281d('0x9'),attributes,{'tableName':'sms_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.rpc.js b/server/api/smsQueue/smsQueue.rpc.js index 1e4d778..1e42ddd 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 _0xbce7=['jayson/promise','http','redis','defaults','socket.io-emitter','./smsQueue.socket','request','info','request\x20sent','debug','SmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','SmsQueue,\x20%s,\x20%s','message','result','catch','GetSmsQueue','SmsQueue','findAll','options','raw','limit','include','map','attributes','model','ShowSmsQueue','find','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x7be9c4,_0x415184){var _0x29bdf1=function(_0x2b92a3){while(--_0x2b92a3){_0x7be9c4['push'](_0x7be9c4['shift']());}};_0x29bdf1(++_0x415184);}(_0xbce7,0x155));var _0x7bce=function(_0x581a78,_0x4bb5c2){_0x581a78=_0x581a78-0x0;var _0x12d5d2=_0xbce7[_0x581a78];return _0x12d5d2;};'use strict';var _=require(_0x7bce('0x0'));var util=require(_0x7bce('0x1'));var moment=require('moment');var BPromise=require(_0x7bce('0x2'));var rs=require(_0x7bce('0x3'));var fs=require('fs');var Redis=require(_0x7bce('0x4'));var db=require(_0x7bce('0x5'))['db'];var utils=require(_0x7bce('0x6'));var logger=require(_0x7bce('0x7'))(_0x7bce('0x8'));var config=require(_0x7bce('0x9'));var jayson=require(_0x7bce('0xa'));var client=jayson['client'][_0x7bce('0xb')]({'port':0x232a});config[_0x7bce('0xc')]=_[_0x7bce('0xd')](config[_0x7bce('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x7bce('0xe'))(new Redis(config[_0x7bce('0xc')]));require(_0x7bce('0xf'))['register'](socket);function respondWithRpcPromise(_0x4cad13,_0x300940,_0x5985f3){return new BPromise(function(_0x21fe22,_0x5c8edb){return client[_0x7bce('0x10')](_0x4cad13,_0x5985f3)['then'](function(_0xdb9ce7){logger[_0x7bce('0x11')]('SmsQueue,\x20%s,\x20%s',_0x300940,_0x7bce('0x12'));logger[_0x7bce('0x13')](_0x7bce('0x14'),_0x300940,_0x7bce('0x12'),JSON[_0x7bce('0x15')](_0xdb9ce7));if(_0xdb9ce7[_0x7bce('0x16')]){if(_0xdb9ce7[_0x7bce('0x16')]['code']===0x1f4){logger[_0x7bce('0x16')](_0x7bce('0x17'),_0x300940,_0xdb9ce7['error']['message']);return _0x5c8edb(_0xdb9ce7[_0x7bce('0x16')][_0x7bce('0x18')]);}logger[_0x7bce('0x16')](_0x7bce('0x17'),_0x300940,_0xdb9ce7['error'][_0x7bce('0x18')]);return _0x21fe22(_0xdb9ce7[_0x7bce('0x16')][_0x7bce('0x18')]);}else{logger['info'](_0x7bce('0x17'),_0x300940,_0x7bce('0x12'));_0x21fe22(_0xdb9ce7[_0x7bce('0x19')][_0x7bce('0x18')]);}})[_0x7bce('0x1a')](function(_0x3ae1d0){logger[_0x7bce('0x16')](_0x7bce('0x17'),_0x300940,_0x3ae1d0);_0x5c8edb(_0x3ae1d0);});});}exports[_0x7bce('0x1b')]=function(_0x313233){var _0x3e59e0=this;return new Promise(function(_0x5cd415,_0x3348ff){return db[_0x7bce('0x1c')][_0x7bce('0x1d')]({'raw':_0x313233[_0x7bce('0x1e')]?_0x313233['options'][_0x7bce('0x1f')]===undefined?!![]:![]:!![],'where':_0x313233[_0x7bce('0x1e')]?_0x313233[_0x7bce('0x1e')]['where']||null:null,'attributes':_0x313233[_0x7bce('0x1e')]?_0x313233[_0x7bce('0x1e')]['attributes']||null:null,'limit':_0x313233[_0x7bce('0x1e')]?_0x313233[_0x7bce('0x1e')][_0x7bce('0x20')]||null:null,'include':_0x313233[_0x7bce('0x1e')]?_0x313233[_0x7bce('0x1e')][_0x7bce('0x21')]?_[_0x7bce('0x22')](_0x313233[_0x7bce('0x1e')][_0x7bce('0x21')],function(_0x4793c5){return{'model':db[_0x4793c5['model']],'as':_0x4793c5['as'],'attributes':_0x4793c5[_0x7bce('0x23')],'include':_0x4793c5[_0x7bce('0x21')]?_[_0x7bce('0x22')](_0x4793c5[_0x7bce('0x21')],function(_0x55be8a){return{'model':db[_0x55be8a[_0x7bce('0x24')]],'as':_0x55be8a['as'],'attributes':_0x55be8a['attributes'],'include':_0x55be8a[_0x7bce('0x21')]?_['map'](_0x55be8a[_0x7bce('0x21')],function(_0x4caa84){return{'model':db[_0x4caa84[_0x7bce('0x24')]],'as':_0x4caa84['as'],'attributes':_0x4caa84[_0x7bce('0x23')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3fc8f8){logger['info'](_0x7bce('0x1b'),_0x313233);logger[_0x7bce('0x13')]('GetSmsQueue',_0x313233,JSON[_0x7bce('0x15')](_0x3fc8f8));_0x5cd415(_0x3fc8f8);})[_0x7bce('0x1a')](function(_0x19d1b9){logger[_0x7bce('0x16')](_0x7bce('0x1b'),_0x19d1b9[_0x7bce('0x18')],_0x313233);_0x3348ff(_0x3e59e0[_0x7bce('0x16')](0x1f4,_0x19d1b9[_0x7bce('0x18')]));});});};exports[_0x7bce('0x25')]=function(_0x4115fc){var _0x5aac6d=this;return new Promise(function(_0x17b0b0,_0x564cd3){return db['SmsQueue'][_0x7bce('0x26')]({'raw':_0x4115fc['options']?_0x4115fc['options'][_0x7bce('0x1f')]===undefined?!![]:![]:!![],'where':_0x4115fc['options']?_0x4115fc[_0x7bce('0x1e')]['where']||null:null,'attributes':_0x4115fc['options']?_0x4115fc['options'][_0x7bce('0x23')]||null:null,'include':_0x4115fc[_0x7bce('0x1e')]?_0x4115fc['options'][_0x7bce('0x21')]?_[_0x7bce('0x22')](_0x4115fc['options'][_0x7bce('0x21')],function(_0x37722c){return{'model':db[_0x37722c[_0x7bce('0x24')]],'as':_0x37722c['as'],'attributes':_0x37722c[_0x7bce('0x23')],'include':_0x37722c[_0x7bce('0x21')]?_[_0x7bce('0x22')](_0x37722c[_0x7bce('0x21')],function(_0x3ec707){return{'model':db[_0x3ec707[_0x7bce('0x24')]],'as':_0x3ec707['as'],'attributes':_0x3ec707['attributes'],'include':_0x3ec707[_0x7bce('0x21')]?_[_0x7bce('0x22')](_0x3ec707[_0x7bce('0x21')],function(_0x3a64ea){return{'model':db[_0x3a64ea['model']],'as':_0x3a64ea['as'],'attributes':_0x3a64ea[_0x7bce('0x23')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x83792d){logger['info'](_0x7bce('0x25'),_0x4115fc);logger[_0x7bce('0x13')](_0x7bce('0x25'),_0x4115fc,JSON['stringify'](_0x83792d));_0x17b0b0(_0x83792d);})[_0x7bce('0x1a')](function(_0x31a424){logger[_0x7bce('0x16')]('ShowSmsQueue',_0x31a424['message'],_0x4115fc);_0x564cd3(_0x5aac6d[_0x7bce('0x16')](0x1f4,_0x31a424[_0x7bce('0x18')]));});});}; \ No newline at end of file +var _0xc537=['util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./smsQueue.socket','register','request','then','SmsQueue,\x20%s,\x20%s','request\x20sent','debug','SmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','GetSmsQueue','SmsQueue','findAll','raw','options','attributes','limit','include','model','map','find','where','ShowSmsQueue','lodash'];(function(_0x2e4e19,_0x493b50){var _0x9ba20b=function(_0x2f6456){while(--_0x2f6456){_0x2e4e19['push'](_0x2e4e19['shift']());}};_0x9ba20b(++_0x493b50);}(_0xc537,0xfb));var _0x7c53=function(_0xb73dfa,_0x58b466){_0xb73dfa=_0xb73dfa-0x0;var _0x50204a=_0xc537[_0xb73dfa];return _0x50204a;};'use strict';var _=require(_0x7c53('0x0'));var util=require(_0x7c53('0x1'));var moment=require(_0x7c53('0x2'));var BPromise=require(_0x7c53('0x3'));var rs=require(_0x7c53('0x4'));var fs=require('fs');var Redis=require(_0x7c53('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x7c53('0x6'));var logger=require('../../config/logger')(_0x7c53('0x7'));var config=require(_0x7c53('0x8'));var jayson=require(_0x7c53('0x9'));var client=jayson[_0x7c53('0xa')][_0x7c53('0xb')]({'port':0x232a});config[_0x7c53('0xc')]=_[_0x7c53('0xd')](config[_0x7c53('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x7c53('0xe'))(new Redis(config['redis']));require(_0x7c53('0xf'))[_0x7c53('0x10')](socket);function respondWithRpcPromise(_0x8c0a93,_0x3a6b8b,_0x575329){return new BPromise(function(_0x4c6a87,_0x5907ed){return client[_0x7c53('0x11')](_0x8c0a93,_0x575329)[_0x7c53('0x12')](function(_0x588ffe){logger['info'](_0x7c53('0x13'),_0x3a6b8b,_0x7c53('0x14'));logger[_0x7c53('0x15')](_0x7c53('0x16'),_0x3a6b8b,_0x7c53('0x14'),JSON[_0x7c53('0x17')](_0x588ffe));if(_0x588ffe[_0x7c53('0x18')]){if(_0x588ffe[_0x7c53('0x18')]['code']===0x1f4){logger[_0x7c53('0x18')](_0x7c53('0x13'),_0x3a6b8b,_0x588ffe['error'][_0x7c53('0x19')]);return _0x5907ed(_0x588ffe[_0x7c53('0x18')][_0x7c53('0x19')]);}logger[_0x7c53('0x18')]('SmsQueue,\x20%s,\x20%s',_0x3a6b8b,_0x588ffe['error']['message']);return _0x4c6a87(_0x588ffe[_0x7c53('0x18')][_0x7c53('0x19')]);}else{logger[_0x7c53('0x1a')](_0x7c53('0x13'),_0x3a6b8b,_0x7c53('0x14'));_0x4c6a87(_0x588ffe[_0x7c53('0x1b')][_0x7c53('0x19')]);}})[_0x7c53('0x1c')](function(_0x2ef4c6){logger[_0x7c53('0x18')]('SmsQueue,\x20%s,\x20%s',_0x3a6b8b,_0x2ef4c6);_0x5907ed(_0x2ef4c6);});});}exports[_0x7c53('0x1d')]=function(_0x2dd624){var _0x2d4808=this;return new Promise(function(_0x4824cb,_0x461a99){return db[_0x7c53('0x1e')][_0x7c53('0x1f')]({'raw':_0x2dd624['options']?_0x2dd624['options'][_0x7c53('0x20')]===undefined?!![]:![]:!![],'where':_0x2dd624[_0x7c53('0x21')]?_0x2dd624[_0x7c53('0x21')]['where']||null:null,'attributes':_0x2dd624[_0x7c53('0x21')]?_0x2dd624[_0x7c53('0x21')][_0x7c53('0x22')]||null:null,'limit':_0x2dd624[_0x7c53('0x21')]?_0x2dd624[_0x7c53('0x21')][_0x7c53('0x23')]||null:null,'include':_0x2dd624[_0x7c53('0x21')]?_0x2dd624[_0x7c53('0x21')][_0x7c53('0x24')]?_['map'](_0x2dd624[_0x7c53('0x21')]['include'],function(_0x2042c9){return{'model':db[_0x2042c9[_0x7c53('0x25')]],'as':_0x2042c9['as'],'attributes':_0x2042c9[_0x7c53('0x22')],'include':_0x2042c9[_0x7c53('0x24')]?_[_0x7c53('0x26')](_0x2042c9['include'],function(_0x1e1536){return{'model':db[_0x1e1536[_0x7c53('0x25')]],'as':_0x1e1536['as'],'attributes':_0x1e1536['attributes'],'include':_0x1e1536[_0x7c53('0x24')]?_[_0x7c53('0x26')](_0x1e1536[_0x7c53('0x24')],function(_0x47f7e3){return{'model':db[_0x47f7e3[_0x7c53('0x25')]],'as':_0x47f7e3['as'],'attributes':_0x47f7e3['attributes']};}):[]};}):[]};}):[]:[]})[_0x7c53('0x12')](function(_0x1c020a){logger['info']('GetSmsQueue',_0x2dd624);logger[_0x7c53('0x15')](_0x7c53('0x1d'),_0x2dd624,JSON[_0x7c53('0x17')](_0x1c020a));_0x4824cb(_0x1c020a);})['catch'](function(_0x4c52df){logger[_0x7c53('0x18')](_0x7c53('0x1d'),_0x4c52df[_0x7c53('0x19')],_0x2dd624);_0x461a99(_0x2d4808[_0x7c53('0x18')](0x1f4,_0x4c52df[_0x7c53('0x19')]));});});};exports['ShowSmsQueue']=function(_0x34b427){var _0x40af14=this;return new Promise(function(_0x42178e,_0x26d4d7){return db[_0x7c53('0x1e')][_0x7c53('0x27')]({'raw':_0x34b427['options']?_0x34b427[_0x7c53('0x21')]['raw']===undefined?!![]:![]:!![],'where':_0x34b427['options']?_0x34b427[_0x7c53('0x21')][_0x7c53('0x28')]||null:null,'attributes':_0x34b427[_0x7c53('0x21')]?_0x34b427[_0x7c53('0x21')][_0x7c53('0x22')]||null:null,'include':_0x34b427['options']?_0x34b427[_0x7c53('0x21')]['include']?_['map'](_0x34b427[_0x7c53('0x21')][_0x7c53('0x24')],function(_0x5e9152){return{'model':db[_0x5e9152[_0x7c53('0x25')]],'as':_0x5e9152['as'],'attributes':_0x5e9152[_0x7c53('0x22')],'include':_0x5e9152['include']?_[_0x7c53('0x26')](_0x5e9152[_0x7c53('0x24')],function(_0x370da1){return{'model':db[_0x370da1[_0x7c53('0x25')]],'as':_0x370da1['as'],'attributes':_0x370da1[_0x7c53('0x22')],'include':_0x370da1[_0x7c53('0x24')]?_[_0x7c53('0x26')](_0x370da1[_0x7c53('0x24')],function(_0x43805e){return{'model':db[_0x43805e[_0x7c53('0x25')]],'as':_0x43805e['as'],'attributes':_0x43805e[_0x7c53('0x22')]};}):[]};}):[]};}):[]:[]})[_0x7c53('0x12')](function(_0x4df905){logger[_0x7c53('0x1a')](_0x7c53('0x29'),_0x34b427);logger[_0x7c53('0x15')]('ShowSmsQueue',_0x34b427,JSON[_0x7c53('0x17')](_0x4df905));_0x42178e(_0x4df905);})['catch'](function(_0x972e5){logger[_0x7c53('0x18')](_0x7c53('0x29'),_0x972e5[_0x7c53('0x19')],_0x34b427);_0x26d4d7(_0x40af14[_0x7c53('0x18')](0x1f4,_0x972e5['message']));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index 8014cd6..825bd5d 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 _0x76d0=['remove','update','removeListener','register','length','smsQueue:','save'];(function(_0x1af66c,_0x11aab8){var _0x3f9f2a=function(_0x182462){while(--_0x182462){_0x1af66c['push'](_0x1af66c['shift']());}};_0x3f9f2a(++_0x11aab8);}(_0x76d0,0x180));var _0x076d=function(_0x257dd8,_0x3da718){_0x257dd8=_0x257dd8-0x0;var _0x12a027=_0x76d0[_0x257dd8];return _0x12a027;};'use strict';var SmsQueueEvents=require('./smsQueue.events');var events=[_0x076d('0x0'),_0x076d('0x1'),_0x076d('0x2')];function createListener(_0x515666,_0x2217a6){return function(_0x321e64){_0x2217a6['emit'](_0x515666,_0x321e64);};}function removeListener(_0x5da0e5,_0x2c43a0){return function(){SmsQueueEvents[_0x076d('0x3')](_0x5da0e5,_0x2c43a0);};}exports[_0x076d('0x4')]=function(_0x173a3e){for(var _0x5224b6=0x0,_0x3b0cc9=events[_0x076d('0x5')];_0x5224b6<_0x3b0cc9;_0x5224b6++){var _0x3afb1d=events[_0x5224b6];var _0x47a86c=createListener(_0x076d('0x6')+_0x3afb1d,_0x173a3e);SmsQueueEvents['on'](_0x3afb1d,_0x47a86c);}}; \ No newline at end of file +var _0xa3b0=['update','emit','removeListener','register','length','smsQueue:','./smsQueue.events','save','remove'];(function(_0x478c55,_0x4d8760){var _0x161eb2=function(_0x402d4e){while(--_0x402d4e){_0x478c55['push'](_0x478c55['shift']());}};_0x161eb2(++_0x4d8760);}(_0xa3b0,0x96));var _0x0a3b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa3b0[_0x3dd15e];return _0x231fd0;};'use strict';var SmsQueueEvents=require(_0x0a3b('0x0'));var events=[_0x0a3b('0x1'),_0x0a3b('0x2'),_0x0a3b('0x3')];function createListener(_0xbb40ae,_0x3b62f5){return function(_0x2ba61a){_0x3b62f5[_0x0a3b('0x4')](_0xbb40ae,_0x2ba61a);};}function removeListener(_0x871dd8,_0x116168){return function(){SmsQueueEvents[_0x0a3b('0x5')](_0x871dd8,_0x116168);};}exports[_0x0a3b('0x6')]=function(_0x185217){for(var _0x20739b=0x0,_0x31c8ca=events[_0x0a3b('0x7')];_0x20739b<_0x31c8ca;_0x20739b++){var _0x5adbb2=events[_0x20739b];var _0x5b08a8=createListener(_0x0a3b('0x8')+_0x5adbb2,_0x185217);SmsQueueEvents['on'](_0x5adbb2,_0x5b08a8);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index 4639b80..9a2199b 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 _0x3b1c=['../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service'];(function(_0x487bc6,_0x229b04){var _0x43507d=function(_0x11f0c9){while(--_0x11f0c9){_0x487bc6['push'](_0x487bc6['shift']());}};_0x43507d(++_0x229b04);}(_0x3b1c,0xe9));var _0xc3b1=function(_0xdaa8b2,_0x21cc0f){_0xdaa8b2=_0xdaa8b2-0x0;var _0x442804=_0x3b1c[_0xdaa8b2];return _0x442804;};'use strict';var multer=require(_0xc3b1('0x0'));var util=require(_0xc3b1('0x1'));var path=require(_0xc3b1('0x2'));var timeout=require(_0xc3b1('0x3'));var express=require('express');var router=express[_0xc3b1('0x4')]();var fs_extra=require(_0xc3b1('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xc3b1('0x6'));var config=require(_0xc3b1('0x7'));var controller=require('./smsQueueReport.controller');router[_0xc3b1('0x8')]('/',auth[_0xc3b1('0x9')](),controller[_0xc3b1('0xa')]);router['get'](_0xc3b1('0xb'),auth[_0xc3b1('0x9')](),controller[_0xc3b1('0xc')]);router[_0xc3b1('0x8')](_0xc3b1('0xd'),auth[_0xc3b1('0x9')](),controller[_0xc3b1('0xe')]);router[_0xc3b1('0xf')]('/',auth[_0xc3b1('0x9')](),controller[_0xc3b1('0x10')]);router[_0xc3b1('0x11')](_0xc3b1('0xd'),auth[_0xc3b1('0x9')](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xc3b1('0x12')]);module[_0xc3b1('0x13')]=router; \ No newline at end of file +var _0x6753=['post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','index','get','/describe','isAuthenticated','describe','/:id','show'];(function(_0xc7ea5b,_0x5c7070){var _0x2328f2=function(_0x45aed4){while(--_0x45aed4){_0xc7ea5b['push'](_0xc7ea5b['shift']());}};_0x2328f2(++_0x5c7070);}(_0x6753,0xa1));var _0x3675=function(_0x4942f7,_0x501153){_0x4942f7=_0x4942f7-0x0;var _0x208d96=_0x6753[_0x4942f7];return _0x208d96;};'use strict';var multer=require(_0x3675('0x0'));var util=require(_0x3675('0x1'));var path=require(_0x3675('0x2'));var timeout=require(_0x3675('0x3'));var express=require('express');var router=express[_0x3675('0x4')]();var fs_extra=require(_0x3675('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x3675('0x6'));var config=require(_0x3675('0x7'));var controller=require('./smsQueueReport.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x3675('0x8')]);router[_0x3675('0x9')](_0x3675('0xa'),auth[_0x3675('0xb')](),controller[_0x3675('0xc')]);router[_0x3675('0x9')](_0x3675('0xd'),auth[_0x3675('0xb')](),controller[_0x3675('0xe')]);router[_0x3675('0xf')]('/',auth[_0x3675('0xb')](),controller[_0x3675('0x10')]);router[_0x3675('0x11')](_0x3675('0xd'),auth['isAuthenticated'](),controller[_0x3675('0x12')]);router[_0x3675('0x13')]('/:id',auth[_0x3675('0xb')](),controller[_0x3675('0x14')]);module[_0x3675('0x15')]=router; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.attributes.js b/server/api/smsQueueReport/smsQueueReport.attributes.js index 25af900..024f0e2 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 _0x7fb0=['exports','STRING','DATE','moment','sequelize'];(function(_0x3bd486,_0x33c752){var _0x537dae=function(_0x5a7dc9){while(--_0x5a7dc9){_0x3bd486['push'](_0x3bd486['shift']());}};_0x537dae(++_0x33c752);}(_0x7fb0,0x99));var _0x07fb=function(_0x2ce542,_0x570ba3){_0x2ce542=_0x2ce542-0x0;var _0x29d7ec=_0x7fb0[_0x2ce542];return _0x29d7ec;};'use strict';var moment=require(_0x07fb('0x0'));var Sequelize=require(_0x07fb('0x1'));module[_0x07fb('0x2')]={'uniqueid':{'type':Sequelize[_0x07fb('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x07fb('0x3')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x07fb('0x4')]},'exitAt':{'type':Sequelize[_0x07fb('0x4')]},'reason':{'type':Sequelize[_0x07fb('0x3')]}}; \ No newline at end of file +var _0x4556=['exports','STRING','DATE','moment'];(function(_0x30fdf9,_0x89096d){var _0x3c43bb=function(_0x40a755){while(--_0x40a755){_0x30fdf9['push'](_0x30fdf9['shift']());}};_0x3c43bb(++_0x89096d);}(_0x4556,0x8f));var _0x6455=function(_0x115c30,_0x56b56d){_0x115c30=_0x115c30-0x0;var _0x4dacef=_0x4556[_0x115c30];return _0x4dacef;};'use strict';var moment=require(_0x6455('0x0'));var Sequelize=require('sequelize');module[_0x6455('0x1')]={'uniqueid':{'type':Sequelize[_0x6455('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x6455('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x6455('0x3')]},'reason':{'type':Sequelize[_0x6455('0x2')]}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.controller.js b/server/api/smsQueueReport/smsQueueReport.controller.js index 27cc884..d90c17f 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 _0x5fdb=['save','update','then','destroy','stack','name','send','index','SmsQueueReport','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','keys','find','create','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range'];(function(_0x530455,_0x41da2d){var _0x128a27=function(_0x3152af){while(--_0x3152af){_0x530455['push'](_0x530455['shift']());}};_0x128a27(++_0x41da2d);}(_0x5fdb,0xbe));var _0xb5fd=function(_0x2192cb,_0x4158b2){_0x2192cb=_0x2192cb-0x0;var _0x34de0e=_0x5fdb[_0x2192cb];return _0x34de0e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb5fd('0x0'));var zipdir=require(_0xb5fd('0x1'));var jsonpatch=require(_0xb5fd('0x2'));var rp=require(_0xb5fd('0x3'));var moment=require(_0xb5fd('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xb5fd('0x5'));var util=require(_0xb5fd('0x6'));var path=require(_0xb5fd('0x7'));var sox=require(_0xb5fd('0x8'));var csv=require('to-csv');var ejs=require(_0xb5fd('0x9'));var fs=require('fs');var fs_extra=require(_0xb5fd('0xa'));var _=require(_0xb5fd('0xb'));var squel=require(_0xb5fd('0xc'));var crypto=require(_0xb5fd('0xd'));var jsforce=require(_0xb5fd('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xb5fd('0xf'));var querystring=require('querystring');var Papa=require(_0xb5fd('0x10'));var Redis=require(_0xb5fd('0x11'));var authService=require(_0xb5fd('0x12'));var qs=require(_0xb5fd('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb5fd('0x14'));var logger=require('../../config/logger')(_0xb5fd('0x15'));var utils=require('../../config/utils');var config=require(_0xb5fd('0x16'));var licenseUtil=require(_0xb5fd('0x17'));var db=require(_0xb5fd('0x18'))['db'];function respondWithStatusCode(_0x207a12,_0x31ffb7){_0x31ffb7=_0x31ffb7||0xcc;return function(_0x423678){if(_0x423678){return _0x207a12[_0xb5fd('0x19')](_0x31ffb7);}return _0x207a12[_0xb5fd('0x1a')](_0x31ffb7)[_0xb5fd('0x1b')]();};}function respondWithResult(_0x33084d,_0x3d1c83){_0x3d1c83=_0x3d1c83||0xc8;return function(_0x156827){if(_0x156827){return _0x33084d[_0xb5fd('0x1a')](_0x3d1c83)[_0xb5fd('0x1c')](_0x156827);}};}function respondWithFilteredResult(_0x19f78c,_0x57d538){return function(_0x1c864b){if(_0x1c864b){var _0x14f82b=typeof _0x57d538[_0xb5fd('0x1d')]===_0xb5fd('0x1e')&&typeof _0x57d538[_0xb5fd('0x1f')]==='undefined';var _0x5dcb79=_0x1c864b[_0xb5fd('0x20')];var _0x24f287=_0x14f82b?0x0:_0x57d538['offset'];var _0x151874=_0x14f82b?_0x1c864b[_0xb5fd('0x20')]:_0x57d538['offset']+_0x57d538['limit'];var _0x25bca8;if(_0x151874>=_0x5dcb79){_0x151874=_0x5dcb79;_0x25bca8=0xc8;}else{_0x25bca8=0xce;}_0x19f78c[_0xb5fd('0x1a')](_0x25bca8);return _0x19f78c[_0xb5fd('0x21')](_0xb5fd('0x22'),_0x24f287+'-'+_0x151874+'/'+_0x5dcb79)[_0xb5fd('0x1c')](_0x1c864b);}return null;};}function patchUpdates(_0x47ce9c){return function(_0x5b2acb){try{jsonpatch['apply'](_0x5b2acb,_0x47ce9c,!![]);}catch(_0x1fb136){return BPromise['reject'](_0x1fb136);}return _0x5b2acb[_0xb5fd('0x23')]();};}function saveUpdates(_0x86f91f,_0x428b5c){return function(_0x79d0ec){if(_0x79d0ec){return _0x79d0ec[_0xb5fd('0x24')](_0x86f91f)[_0xb5fd('0x25')](function(_0x49a428){return _0x49a428;});}return null;};}function removeEntity(_0x5d47ab,_0x312130){return function(_0xec4d13){if(_0xec4d13){return _0xec4d13[_0xb5fd('0x26')]()['then'](function(){_0x5d47ab[_0xb5fd('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x45cbe6,_0x535415){return function(_0x5d9a94){if(!_0x5d9a94){_0x45cbe6[_0xb5fd('0x19')](0x194);}return _0x5d9a94;};}function handleError(_0x56bde2,_0x155164){_0x155164=_0x155164||0x1f4;return function(_0x408e10){logger['error'](_0x408e10[_0xb5fd('0x27')]);if(_0x408e10[_0xb5fd('0x28')]){delete _0x408e10[_0xb5fd('0x28')];}_0x56bde2[_0xb5fd('0x1a')](_0x155164)[_0xb5fd('0x29')](_0x408e10);};}exports[_0xb5fd('0x2a')]=function(_0x460110,_0x35193d){var _0xb2fdd7={},_0x1a2e36={},_0x4c473b={'count':0x0,'rows':[]};var _0x2fb9ab=_['map'](db[_0xb5fd('0x2b')][_0xb5fd('0x2c')],function(_0x22b705){return{'name':_0x22b705[_0xb5fd('0x2d')],'type':_0x22b705[_0xb5fd('0x2e')][_0xb5fd('0x2f')]};});_0x1a2e36[_0xb5fd('0x30')]=_['map'](_0x2fb9ab,'name');_0x1a2e36[_0xb5fd('0x31')]=_['keys'](_0x460110[_0xb5fd('0x31')]);_0x1a2e36[_0xb5fd('0x32')]=_[_0xb5fd('0x33')](_0x1a2e36['model'],_0x1a2e36[_0xb5fd('0x31')]);_0xb2fdd7[_0xb5fd('0x34')]=_[_0xb5fd('0x33')](_0x1a2e36[_0xb5fd('0x30')],qs['fields'](_0x460110[_0xb5fd('0x31')][_0xb5fd('0x35')]));_0xb2fdd7[_0xb5fd('0x34')]=_0xb2fdd7['attributes'][_0xb5fd('0x36')]?_0xb2fdd7[_0xb5fd('0x34')]:_0x1a2e36[_0xb5fd('0x30')];if(!_0x460110[_0xb5fd('0x31')][_0xb5fd('0x37')](_0xb5fd('0x38'))){_0xb2fdd7[_0xb5fd('0x1f')]=qs[_0xb5fd('0x1f')](_0x460110[_0xb5fd('0x31')][_0xb5fd('0x1f')]);_0xb2fdd7[_0xb5fd('0x1d')]=qs[_0xb5fd('0x1d')](_0x460110['query']['offset']);}_0xb2fdd7[_0xb5fd('0x39')]=qs[_0xb5fd('0x3a')](_0x460110[_0xb5fd('0x31')][_0xb5fd('0x3a')]);_0xb2fdd7[_0xb5fd('0x3b')]=qs['filters'](_[_0xb5fd('0x3c')](_0x460110[_0xb5fd('0x31')],_0x1a2e36[_0xb5fd('0x32')]),_0x2fb9ab);if(_0x460110[_0xb5fd('0x31')]['filter']){_0xb2fdd7[_0xb5fd('0x3b')]=_[_0xb5fd('0x3d')](_0xb2fdd7['where'],{'$or':_['map'](_0x2fb9ab,function(_0x50654e){if(_0x50654e[_0xb5fd('0x2e')]!==_0xb5fd('0x3e')){var _0x145f3e={};_0x145f3e[_0x50654e[_0xb5fd('0x28')]]={'$like':'%'+_0x460110[_0xb5fd('0x31')]['filter']+'%'};return _0x145f3e;}})});}_0xb2fdd7=_[_0xb5fd('0x3d')]({},_0xb2fdd7,_0x460110[_0xb5fd('0x3f')]);var _0x76ddde={'where':_0xb2fdd7[_0xb5fd('0x3b')]};return db[_0xb5fd('0x2b')]['count'](_0x76ddde)[_0xb5fd('0x25')](function(_0x9db8fc){_0x4c473b[_0xb5fd('0x20')]=_0x9db8fc;if(_0x460110['query'][_0xb5fd('0x40')]){_0xb2fdd7[_0xb5fd('0x41')]=[{'all':!![]}];}return db['SmsQueueReport']['findAll'](_0xb2fdd7);})[_0xb5fd('0x25')](function(_0x2bb88b){_0x4c473b[_0xb5fd('0x42')]=_0x2bb88b;return _0x4c473b;})[_0xb5fd('0x25')](respondWithFilteredResult(_0x35193d,_0xb2fdd7))[_0xb5fd('0x43')](handleError(_0x35193d,null));};exports[_0xb5fd('0x44')]=function(_0x265ceb,_0x549f8b){var _0x2f5579={'raw':!![],'where':{'id':_0x265ceb[_0xb5fd('0x45')]['id']}},_0x35f511={};_0x35f511[_0xb5fd('0x30')]=_['keys'](db[_0xb5fd('0x2b')][_0xb5fd('0x2c')]);_0x35f511[_0xb5fd('0x31')]=_[_0xb5fd('0x46')](_0x265ceb['query']);_0x35f511['filters']=_[_0xb5fd('0x33')](_0x35f511[_0xb5fd('0x30')],_0x35f511[_0xb5fd('0x31')]);_0x2f5579[_0xb5fd('0x34')]=_['intersection'](_0x35f511[_0xb5fd('0x30')],qs['fields'](_0x265ceb[_0xb5fd('0x31')][_0xb5fd('0x35')]));_0x2f5579[_0xb5fd('0x34')]=_0x2f5579[_0xb5fd('0x34')]['length']?_0x2f5579[_0xb5fd('0x34')]:_0x35f511[_0xb5fd('0x30')];if(_0x265ceb[_0xb5fd('0x31')][_0xb5fd('0x40')]){_0x2f5579['include']=[{'all':!![]}];}_0x2f5579=_[_0xb5fd('0x3d')]({},_0x2f5579,_0x265ceb['options']);return db[_0xb5fd('0x2b')][_0xb5fd('0x47')](_0x2f5579)[_0xb5fd('0x25')](handleEntityNotFound(_0x549f8b,null))[_0xb5fd('0x25')](respondWithResult(_0x549f8b,null))[_0xb5fd('0x43')](handleError(_0x549f8b,null));};exports['create']=function(_0x372f4b,_0x3c8826){return db['SmsQueueReport'][_0xb5fd('0x48')](_0x372f4b[_0xb5fd('0x49')],{})[_0xb5fd('0x25')](respondWithResult(_0x3c8826,0xc9))[_0xb5fd('0x43')](handleError(_0x3c8826,null));};exports[_0xb5fd('0x24')]=function(_0x342388,_0x1acae6){if(_0x342388[_0xb5fd('0x49')]['id']){delete _0x342388[_0xb5fd('0x49')]['id'];}return db[_0xb5fd('0x2b')][_0xb5fd('0x47')]({'where':{'id':_0x342388[_0xb5fd('0x45')]['id']}})['then'](handleEntityNotFound(_0x1acae6,null))['then'](saveUpdates(_0x342388['body'],null))[_0xb5fd('0x25')](respondWithResult(_0x1acae6,null))[_0xb5fd('0x43')](handleError(_0x1acae6,null));};exports['destroy']=function(_0x353d68,_0x1206dc){return db[_0xb5fd('0x2b')][_0xb5fd('0x47')]({'where':{'id':_0x353d68[_0xb5fd('0x45')]['id']}})[_0xb5fd('0x25')](handleEntityNotFound(_0x1206dc,null))[_0xb5fd('0x25')](removeEntity(_0x1206dc,null))['catch'](handleError(_0x1206dc,null));};exports[_0xb5fd('0x4a')]=function(_0x49a124,_0x1a9054){return db[_0xb5fd('0x2b')]['describe']()['then'](respondWithResult(_0x1a9054,null))[_0xb5fd('0x43')](handleError(_0x1a9054,null));}; \ No newline at end of file +var _0x36e5=['options','includeAll','include','findAll','catch','show','params','length','find','SmsQueueReport','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','save','update','then','destroy','stack','name','send','map','rawAttributes','fieldName','type','key','query','keys','intersection','model','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL'];(function(_0x82129b,_0x484ae9){var _0x2ae5dc=function(_0x299e34){while(--_0x299e34){_0x82129b['push'](_0x82129b['shift']());}};_0x2ae5dc(++_0x484ae9);}(_0x36e5,0x1e1));var _0x536e=function(_0x38a7ac,_0x45514b){_0x38a7ac=_0x38a7ac-0x0;var _0x53061a=_0x36e5[_0x38a7ac];return _0x53061a;};'use strict';var emlformat=require(_0x536e('0x0'));var rimraf=require(_0x536e('0x1'));var zipdir=require(_0x536e('0x2'));var jsonpatch=require(_0x536e('0x3'));var rp=require(_0x536e('0x4'));var moment=require(_0x536e('0x5'));var BPromise=require(_0x536e('0x6'));var Mustache=require(_0x536e('0x7'));var util=require(_0x536e('0x8'));var path=require('path');var sox=require(_0x536e('0x9'));var csv=require(_0x536e('0xa'));var ejs=require(_0x536e('0xb'));var fs=require('fs');var fs_extra=require(_0x536e('0xc'));var _=require(_0x536e('0xd'));var squel=require(_0x536e('0xe'));var crypto=require(_0x536e('0xf'));var jsforce=require(_0x536e('0x10'));var deskjs=require(_0x536e('0x11'));var toCsv=require('to-csv');var querystring=require(_0x536e('0x12'));var Papa=require(_0x536e('0x13'));var Redis=require(_0x536e('0x14'));var authService=require(_0x536e('0x15'));var qs=require('../../components/parsers/qs');var as=require(_0x536e('0x16'));var hardwareService=require(_0x536e('0x17'));var logger=require(_0x536e('0x18'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x536e('0x19'));var db=require(_0x536e('0x1a'))['db'];function respondWithStatusCode(_0x495b26,_0x1f8041){_0x1f8041=_0x1f8041||0xcc;return function(_0x1e9def){if(_0x1e9def){return _0x495b26[_0x536e('0x1b')](_0x1f8041);}return _0x495b26[_0x536e('0x1c')](_0x1f8041)[_0x536e('0x1d')]();};}function respondWithResult(_0x2d4bca,_0x1e3126){_0x1e3126=_0x1e3126||0xc8;return function(_0x3f2343){if(_0x3f2343){return _0x2d4bca[_0x536e('0x1c')](_0x1e3126)[_0x536e('0x1e')](_0x3f2343);}};}function respondWithFilteredResult(_0x187032,_0x47fe56){return function(_0x559361){if(_0x559361){var _0x5c946a=typeof _0x47fe56[_0x536e('0x1f')]===_0x536e('0x20')&&typeof _0x47fe56[_0x536e('0x21')]===_0x536e('0x20');var _0x295334=_0x559361[_0x536e('0x22')];var _0x383217=_0x5c946a?0x0:_0x47fe56[_0x536e('0x1f')];var _0x4bda16=_0x5c946a?_0x559361['count']:_0x47fe56[_0x536e('0x1f')]+_0x47fe56[_0x536e('0x21')];var _0x287eda;if(_0x4bda16>=_0x295334){_0x4bda16=_0x295334;_0x287eda=0xc8;}else{_0x287eda=0xce;}_0x187032[_0x536e('0x1c')](_0x287eda);return _0x187032[_0x536e('0x23')]('Content-Range',_0x383217+'-'+_0x4bda16+'/'+_0x295334)[_0x536e('0x1e')](_0x559361);}return null;};}function patchUpdates(_0x10583a){return function(_0x108681){try{jsonpatch[_0x536e('0x24')](_0x108681,_0x10583a,!![]);}catch(_0x2dc4d4){return BPromise['reject'](_0x2dc4d4);}return _0x108681[_0x536e('0x25')]();};}function saveUpdates(_0x4ad6d9,_0x193e00){return function(_0x3af18d){if(_0x3af18d){return _0x3af18d[_0x536e('0x26')](_0x4ad6d9)[_0x536e('0x27')](function(_0x42a033){return _0x42a033;});}return null;};}function removeEntity(_0x174ee8,_0x14245e){return function(_0x5a9c4e){if(_0x5a9c4e){return _0x5a9c4e[_0x536e('0x28')]()['then'](function(){_0x174ee8['status'](0xcc)[_0x536e('0x1d')]();});}};}function handleEntityNotFound(_0x58e6dd,_0x47d9cd){return function(_0x42bb19){if(!_0x42bb19){_0x58e6dd['sendStatus'](0x194);}return _0x42bb19;};}function handleError(_0x4b5e0d,_0x15b13b){_0x15b13b=_0x15b13b||0x1f4;return function(_0x32b1a0){logger['error'](_0x32b1a0[_0x536e('0x29')]);if(_0x32b1a0[_0x536e('0x2a')]){delete _0x32b1a0[_0x536e('0x2a')];}_0x4b5e0d[_0x536e('0x1c')](_0x15b13b)[_0x536e('0x2b')](_0x32b1a0);};}exports['index']=function(_0x306cb1,_0x557b1b){var _0x33c670={},_0x5b280b={},_0x38aded={'count':0x0,'rows':[]};var _0x46305c=_[_0x536e('0x2c')](db['SmsQueueReport'][_0x536e('0x2d')],function(_0x27f616){return{'name':_0x27f616[_0x536e('0x2e')],'type':_0x27f616[_0x536e('0x2f')][_0x536e('0x30')]};});_0x5b280b['model']=_[_0x536e('0x2c')](_0x46305c,_0x536e('0x2a'));_0x5b280b[_0x536e('0x31')]=_[_0x536e('0x32')](_0x306cb1[_0x536e('0x31')]);_0x5b280b['filters']=_[_0x536e('0x33')](_0x5b280b[_0x536e('0x34')],_0x5b280b['query']);_0x33c670['attributes']=_[_0x536e('0x33')](_0x5b280b[_0x536e('0x34')],qs[_0x536e('0x35')](_0x306cb1[_0x536e('0x31')]['fields']));_0x33c670[_0x536e('0x36')]=_0x33c670[_0x536e('0x36')]['length']?_0x33c670[_0x536e('0x36')]:_0x5b280b[_0x536e('0x34')];if(!_0x306cb1[_0x536e('0x31')][_0x536e('0x37')](_0x536e('0x38'))){_0x33c670[_0x536e('0x21')]=qs[_0x536e('0x21')](_0x306cb1[_0x536e('0x31')]['limit']);_0x33c670[_0x536e('0x1f')]=qs[_0x536e('0x1f')](_0x306cb1['query'][_0x536e('0x1f')]);}_0x33c670[_0x536e('0x39')]=qs[_0x536e('0x3a')](_0x306cb1['query']['sort']);_0x33c670[_0x536e('0x3b')]=qs[_0x536e('0x3c')](_[_0x536e('0x3d')](_0x306cb1[_0x536e('0x31')],_0x5b280b[_0x536e('0x3c')]),_0x46305c);if(_0x306cb1['query'][_0x536e('0x3e')]){_0x33c670[_0x536e('0x3b')]=_[_0x536e('0x3f')](_0x33c670[_0x536e('0x3b')],{'$or':_[_0x536e('0x2c')](_0x46305c,function(_0x34bdca){if(_0x34bdca[_0x536e('0x2f')]!==_0x536e('0x40')){var _0x1f02e5={};_0x1f02e5[_0x34bdca[_0x536e('0x2a')]]={'$like':'%'+_0x306cb1['query']['filter']+'%'};return _0x1f02e5;}})});}_0x33c670=_[_0x536e('0x3f')]({},_0x33c670,_0x306cb1[_0x536e('0x41')]);var _0xeace3d={'where':_0x33c670[_0x536e('0x3b')]};return db['SmsQueueReport'][_0x536e('0x22')](_0xeace3d)[_0x536e('0x27')](function(_0x547d72){_0x38aded['count']=_0x547d72;if(_0x306cb1[_0x536e('0x31')][_0x536e('0x42')]){_0x33c670[_0x536e('0x43')]=[{'all':!![]}];}return db['SmsQueueReport'][_0x536e('0x44')](_0x33c670);})[_0x536e('0x27')](function(_0x465aef){_0x38aded['rows']=_0x465aef;return _0x38aded;})['then'](respondWithFilteredResult(_0x557b1b,_0x33c670))[_0x536e('0x45')](handleError(_0x557b1b,null));};exports[_0x536e('0x46')]=function(_0x3474f9,_0x599970){var _0x5c057e={'raw':!![],'where':{'id':_0x3474f9[_0x536e('0x47')]['id']}},_0x5b88d4={};_0x5b88d4[_0x536e('0x34')]=_['keys'](db['SmsQueueReport']['rawAttributes']);_0x5b88d4['query']=_[_0x536e('0x32')](_0x3474f9[_0x536e('0x31')]);_0x5b88d4['filters']=_[_0x536e('0x33')](_0x5b88d4[_0x536e('0x34')],_0x5b88d4[_0x536e('0x31')]);_0x5c057e[_0x536e('0x36')]=_[_0x536e('0x33')](_0x5b88d4['model'],qs[_0x536e('0x35')](_0x3474f9['query'][_0x536e('0x35')]));_0x5c057e[_0x536e('0x36')]=_0x5c057e[_0x536e('0x36')][_0x536e('0x48')]?_0x5c057e[_0x536e('0x36')]:_0x5b88d4[_0x536e('0x34')];if(_0x3474f9[_0x536e('0x31')][_0x536e('0x42')]){_0x5c057e[_0x536e('0x43')]=[{'all':!![]}];}_0x5c057e=_[_0x536e('0x3f')]({},_0x5c057e,_0x3474f9[_0x536e('0x41')]);return db['SmsQueueReport'][_0x536e('0x49')](_0x5c057e)[_0x536e('0x27')](handleEntityNotFound(_0x599970,null))[_0x536e('0x27')](respondWithResult(_0x599970,null))['catch'](handleError(_0x599970,null));};exports['create']=function(_0x258b2b,_0xba625d){return db[_0x536e('0x4a')][_0x536e('0x4b')](_0x258b2b[_0x536e('0x4c')],{})[_0x536e('0x27')](respondWithResult(_0xba625d,0xc9))[_0x536e('0x45')](handleError(_0xba625d,null));};exports['update']=function(_0x334af3,_0x26e16b){if(_0x334af3['body']['id']){delete _0x334af3[_0x536e('0x4c')]['id'];}return db[_0x536e('0x4a')]['find']({'where':{'id':_0x334af3[_0x536e('0x47')]['id']}})[_0x536e('0x27')](handleEntityNotFound(_0x26e16b,null))['then'](saveUpdates(_0x334af3[_0x536e('0x4c')],null))['then'](respondWithResult(_0x26e16b,null))[_0x536e('0x45')](handleError(_0x26e16b,null));};exports[_0x536e('0x28')]=function(_0x4e1545,_0x3b1213){return db[_0x536e('0x4a')][_0x536e('0x49')]({'where':{'id':_0x4e1545['params']['id']}})[_0x536e('0x27')](handleEntityNotFound(_0x3b1213,null))[_0x536e('0x27')](removeEntity(_0x3b1213,null))['catch'](handleError(_0x3b1213,null));};exports[_0x536e('0x4d')]=function(_0x25263e,_0x11d1e4){return db[_0x536e('0x4a')]['describe']()[_0x536e('0x27')](respondWithResult(_0x11d1e4,null))[_0x536e('0x45')](handleError(_0x11d1e4,null));}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index f34ce12..486b05b 100644 --- a/server/api/smsQueueReport/smsQueueReport.model.js +++ b/server/api/smsQueueReport/smsQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbaf0=['define','SmsQueueReport','report_sms_queue','uniqueid','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./smsQueueReport.attributes','exports'];(function(_0x4ac8a8,_0x33b861){var _0xba97d2=function(_0x266a9a){while(--_0x266a9a){_0x4ac8a8['push'](_0x4ac8a8['shift']());}};_0xba97d2(++_0x33b861);}(_0xbaf0,0x12a));var _0x0baf=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xbaf0[_0x3947c9];return _0x2e7871;};'use strict';var _=require('lodash');var util=require(_0x0baf('0x0'));var logger=require(_0x0baf('0x1'))(_0x0baf('0x2'));var moment=require(_0x0baf('0x3'));var BPromise=require(_0x0baf('0x4'));var rp=require(_0x0baf('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var attributes=require(_0x0baf('0x8'));module[_0x0baf('0x9')]=function(_0xe4c3c4,_0x335e24){return _0xe4c3c4[_0x0baf('0xa')](_0x0baf('0xb'),attributes,{'tableName':_0x0baf('0xc'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x0baf('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa9e0=['define','SmsQueueReport','uniqueid','lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment','./smsQueueReport.attributes','exports'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xa9e0,0x123));var _0x0a9e=function(_0xc6be3a,_0x540e05){_0xc6be3a=_0xc6be3a-0x0;var _0x56a310=_0xa9e0[_0xc6be3a];return _0x56a310;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'report_sms_queue','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x0a9e('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.rpc.js b/server/api/smsQueueReport/smsQueueReport.rpc.js index e6a99b8..db8fb0a 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 _0x479a=['UpdateSmsQueueReport','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','SmsQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','CreateSmsQueueReport','SmsQueueReport','create','body','options','update','limit'];(function(_0x4c6f7e,_0xad2dfa){var _0x49ba40=function(_0x33645b){while(--_0x33645b){_0x4c6f7e['push'](_0x4c6f7e['shift']());}};_0x49ba40(++_0xad2dfa);}(_0x479a,0xbb));var _0xa479=function(_0x5d891e,_0x3e78c9){_0x5d891e=_0x5d891e-0x0;var _0x517e39=_0x479a[_0x5d891e];return _0x517e39;};'use strict';var _=require('lodash');var util=require(_0xa479('0x0'));var moment=require(_0xa479('0x1'));var BPromise=require(_0xa479('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa479('0x3'));var db=require(_0xa479('0x4'))['db'];var utils=require(_0xa479('0x5'));var logger=require(_0xa479('0x6'))(_0xa479('0x7'));var config=require('../../config/environment');var jayson=require(_0xa479('0x8'));var client=jayson[_0xa479('0x9')][_0xa479('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x61f3db,_0x333806,_0x359bec){return new BPromise(function(_0x38a9ed,_0x2f3c85){return client[_0xa479('0xb')](_0x61f3db,_0x359bec)[_0xa479('0xc')](function(_0x1525d4){logger[_0xa479('0xd')](_0xa479('0xe'),_0x333806,_0xa479('0xf'));logger[_0xa479('0x10')]('SmsQueueReport,\x20%s,\x20%s,\x20%s',_0x333806,'request\x20sent',JSON[_0xa479('0x11')](_0x1525d4));if(_0x1525d4[_0xa479('0x12')]){if(_0x1525d4[_0xa479('0x12')][_0xa479('0x13')]===0x1f4){logger['error']('SmsQueueReport,\x20%s,\x20%s',_0x333806,_0x1525d4[_0xa479('0x12')][_0xa479('0x14')]);return _0x2f3c85(_0x1525d4[_0xa479('0x12')][_0xa479('0x14')]);}logger['error'](_0xa479('0xe'),_0x333806,_0x1525d4[_0xa479('0x12')][_0xa479('0x14')]);return _0x38a9ed(_0x1525d4[_0xa479('0x12')][_0xa479('0x14')]);}else{logger[_0xa479('0xd')](_0xa479('0xe'),_0x333806,_0xa479('0xf'));_0x38a9ed(_0x1525d4[_0xa479('0x15')][_0xa479('0x14')]);}})[_0xa479('0x16')](function(_0x4302a0){logger[_0xa479('0x12')](_0xa479('0xe'),_0x333806,_0x4302a0);_0x2f3c85(_0x4302a0);});});}exports[_0xa479('0x17')]=function(_0x355693){var _0x3bb9f8=this;return new Promise(function(_0x220e72,_0x412895){return db[_0xa479('0x18')][_0xa479('0x19')](_0x355693[_0xa479('0x1a')],{'raw':_0x355693[_0xa479('0x1b')]?_0x355693[_0xa479('0x1b')]['raw']===undefined?!![]:![]:!![]})[_0xa479('0xc')](function(_0x394aa7){logger[_0xa479('0xd')](_0xa479('0x17'),_0x355693);logger[_0xa479('0x10')](_0xa479('0x17'),_0x355693,JSON[_0xa479('0x11')](_0x394aa7));_0x220e72(_0x394aa7);})[_0xa479('0x16')](function(_0x263b9c){logger['error']('CreateSmsQueueReport',_0x263b9c['message'],_0x355693);_0x412895(_0x3bb9f8[_0xa479('0x12')](0x1f4,_0x263b9c[_0xa479('0x14')]));});});};exports['UpdateSmsQueueReport']=function(_0x597c92){var _0x451dc0=this;return new Promise(function(_0x30e15c,_0x58a83b){return db[_0xa479('0x18')][_0xa479('0x1c')](_0x597c92[_0xa479('0x1a')],{'raw':_0x597c92['options']?_0x597c92[_0xa479('0x1b')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x597c92[_0xa479('0x1b')]?_0x597c92['options']['where']||null:null,'attributes':_0x597c92[_0xa479('0x1b')]?_0x597c92['options']['attributes']||null:null,'limit':_0x597c92[_0xa479('0x1b')]?_0x597c92[_0xa479('0x1b')][_0xa479('0x1d')]||null:null})[_0xa479('0xc')](function(_0x11f1cf){logger[_0xa479('0xd')](_0xa479('0x1e'),_0x597c92);logger[_0xa479('0x10')](_0xa479('0x1e'),_0x597c92,JSON[_0xa479('0x11')](_0x11f1cf));_0x30e15c(_0x11f1cf);})['catch'](function(_0x42e671){logger[_0xa479('0x12')](_0xa479('0x1e'),_0x42e671['message'],_0x597c92);_0x58a83b(_0x451dc0[_0xa479('0x12')](0x1f4,_0x42e671[_0xa479('0x14')]));});});}; \ No newline at end of file +var _0x1185=['UpdateSmsQueueReport','update','attributes','limit','util','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','request\x20sent','SmsQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsQueueReport,\x20%s,\x20%s','message','info','result','CreateSmsQueueReport','create','body','options','then','debug','catch'];(function(_0x4dbe5f,_0x209297){var _0x31ca72=function(_0x442dda){while(--_0x442dda){_0x4dbe5f['push'](_0x4dbe5f['shift']());}};_0x31ca72(++_0x209297);}(_0x1185,0x130));var _0x5118=function(_0x40febe,_0x1e6b1a){_0x40febe=_0x40febe-0x0;var _0x112ef2=_0x1185[_0x40febe];return _0x112ef2;};'use strict';var _=require('lodash');var util=require(_0x5118('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5118('0x1'));var db=require(_0x5118('0x2'))['db'];var utils=require(_0x5118('0x3'));var logger=require(_0x5118('0x4'))(_0x5118('0x5'));var config=require(_0x5118('0x6'));var jayson=require(_0x5118('0x7'));var client=jayson[_0x5118('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x244d81,_0x1f4fa8,_0x2b1ca2){return new BPromise(function(_0x2c65af,_0x15e120){return client[_0x5118('0x9')](_0x244d81,_0x2b1ca2)['then'](function(_0x10b992){logger['info']('SmsQueueReport,\x20%s,\x20%s',_0x1f4fa8,_0x5118('0xa'));logger['debug'](_0x5118('0xb'),_0x1f4fa8,'request\x20sent',JSON[_0x5118('0xc')](_0x10b992));if(_0x10b992[_0x5118('0xd')]){if(_0x10b992[_0x5118('0xd')][_0x5118('0xe')]===0x1f4){logger[_0x5118('0xd')](_0x5118('0xf'),_0x1f4fa8,_0x10b992[_0x5118('0xd')]['message']);return _0x15e120(_0x10b992[_0x5118('0xd')]['message']);}logger[_0x5118('0xd')](_0x5118('0xf'),_0x1f4fa8,_0x10b992[_0x5118('0xd')][_0x5118('0x10')]);return _0x2c65af(_0x10b992[_0x5118('0xd')][_0x5118('0x10')]);}else{logger[_0x5118('0x11')]('SmsQueueReport,\x20%s,\x20%s',_0x1f4fa8,_0x5118('0xa'));_0x2c65af(_0x10b992[_0x5118('0x12')][_0x5118('0x10')]);}})['catch'](function(_0x477d84){logger[_0x5118('0xd')](_0x5118('0xf'),_0x1f4fa8,_0x477d84);_0x15e120(_0x477d84);});});}exports[_0x5118('0x13')]=function(_0x761b03){var _0x356618=this;return new Promise(function(_0x1461c0,_0x59b0d9){return db['SmsQueueReport'][_0x5118('0x14')](_0x761b03[_0x5118('0x15')],{'raw':_0x761b03[_0x5118('0x16')]?_0x761b03[_0x5118('0x16')]['raw']===undefined?!![]:![]:!![]})[_0x5118('0x17')](function(_0x345858){logger['info'](_0x5118('0x13'),_0x761b03);logger[_0x5118('0x18')](_0x5118('0x13'),_0x761b03,JSON[_0x5118('0xc')](_0x345858));_0x1461c0(_0x345858);})[_0x5118('0x19')](function(_0x4f1782){logger[_0x5118('0xd')]('CreateSmsQueueReport',_0x4f1782[_0x5118('0x10')],_0x761b03);_0x59b0d9(_0x356618['error'](0x1f4,_0x4f1782[_0x5118('0x10')]));});});};exports[_0x5118('0x1a')]=function(_0x2c6cbf){var _0x58f90a=this;return new Promise(function(_0x4b80e,_0x5379ba){return db['SmsQueueReport'][_0x5118('0x1b')](_0x2c6cbf[_0x5118('0x15')],{'raw':_0x2c6cbf[_0x5118('0x16')]?_0x2c6cbf[_0x5118('0x16')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2c6cbf[_0x5118('0x16')]?_0x2c6cbf[_0x5118('0x16')]['where']||null:null,'attributes':_0x2c6cbf[_0x5118('0x16')]?_0x2c6cbf[_0x5118('0x16')][_0x5118('0x1c')]||null:null,'limit':_0x2c6cbf['options']?_0x2c6cbf[_0x5118('0x16')][_0x5118('0x1d')]||null:null})[_0x5118('0x17')](function(_0x59d26a){logger[_0x5118('0x11')](_0x5118('0x1a'),_0x2c6cbf);logger[_0x5118('0x18')](_0x5118('0x1a'),_0x2c6cbf,JSON[_0x5118('0xc')](_0x59d26a));_0x4b80e(_0x59d26a);})['catch'](function(_0x1ae1a4){logger[_0x5118('0xd')](_0x5118('0x1a'),_0x1ae1a4[_0x5118('0x10')],_0x2c6cbf);_0x5379ba(_0x58f90a[_0x5118('0xd')](0x1f4,_0x1ae1a4[_0x5118('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index 5bbbc96..77cb502 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 _0x5ad3=['isAuthenticated','index','describe','create','/:id','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsTransferReport.controller','get'];(function(_0x5af494,_0x2e29f0){var _0x4cceb4=function(_0x411f35){while(--_0x411f35){_0x5af494['push'](_0x5af494['shift']());}};_0x4cceb4(++_0x2e29f0);}(_0x5ad3,0x1e2));var _0x35ad=function(_0x317bf0,_0x277c03){_0x317bf0=_0x317bf0-0x0;var _0x225932=_0x5ad3[_0x317bf0];return _0x225932;};'use strict';var multer=require(_0x35ad('0x0'));var util=require(_0x35ad('0x1'));var path=require(_0x35ad('0x2'));var timeout=require(_0x35ad('0x3'));var express=require('express');var router=express[_0x35ad('0x4')]();var fs_extra=require(_0x35ad('0x5'));var auth=require(_0x35ad('0x6'));var interaction=require(_0x35ad('0x7'));var config=require(_0x35ad('0x8'));var controller=require(_0x35ad('0x9'));router[_0x35ad('0xa')]('/',auth[_0x35ad('0xb')](),controller[_0x35ad('0xc')]);router[_0x35ad('0xa')]('/describe',auth[_0x35ad('0xb')](),controller[_0x35ad('0xd')]);router[_0x35ad('0xa')]('/:id',auth[_0x35ad('0xb')](),controller['show']);router['post']('/',auth[_0x35ad('0xb')](),controller[_0x35ad('0xe')]);router['put'](_0x35ad('0xf'),auth[_0x35ad('0xb')](),controller['update']);router['delete'](_0x35ad('0xf'),auth[_0x35ad('0xb')](),controller['destroy']);module[_0x35ad('0x10')]=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(_0x50007c,_0x1cbf11){var _0x5c1ec7=function(_0x52d038){while(--_0x52d038){_0x50007c['push'](_0x50007c['shift']());}};_0x5c1ec7(++_0x1cbf11);}(_0xbd50,0x196));var _0x0bd5=function(_0x38825b,_0x205455){_0x38825b=_0x38825b-0x0;var _0x60dc6a=_0xbd50[_0x38825b];return _0x60dc6a;};'use strict';var multer=require(_0x0bd5('0x0'));var util=require(_0x0bd5('0x1'));var path=require(_0x0bd5('0x2'));var timeout=require('connect-timeout');var express=require(_0x0bd5('0x3'));var router=express[_0x0bd5('0x4')]();var fs_extra=require(_0x0bd5('0x5'));var auth=require(_0x0bd5('0x6'));var interaction=require(_0x0bd5('0x7'));var config=require('../../config/environment');var controller=require('./smsTransferReport.controller');router['get']('/',auth[_0x0bd5('0x8')](),controller[_0x0bd5('0x9')]);router[_0x0bd5('0xa')](_0x0bd5('0xb'),auth[_0x0bd5('0x8')](),controller['describe']);router['get'](_0x0bd5('0xc'),auth[_0x0bd5('0x8')](),controller[_0x0bd5('0xd')]);router['post']('/',auth[_0x0bd5('0x8')](),controller[_0x0bd5('0xe')]);router['put'](_0x0bd5('0xc'),auth[_0x0bd5('0x8')](),controller['update']);router[_0x0bd5('0xf')](_0x0bd5('0xc'),auth[_0x0bd5('0x8')](),controller['destroy']);module[_0x0bd5('0x10')]=router; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.attributes.js b/server/api/smsTransferReport/smsTransferReport.attributes.js index c2f198e..d79e7d5 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 _0x00bb=['moment','sequelize','exports','ENUM','agent','queue','DATE','NOW'];(function(_0x4be2d4,_0x16cc6d){var _0x4004e9=function(_0x19cfe0){while(--_0x19cfe0){_0x4be2d4['push'](_0x4be2d4['shift']());}};_0x4004e9(++_0x16cc6d);}(_0x00bb,0x1d8));var _0xb00b=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0x00bb[_0x2b10c6];return _0x3789d2;};'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 +var _0x34e8=['queue','DATE','NOW','moment','sequelize','exports','STRING','account','agent'];(function(_0x5f4d59,_0x554969){var _0x4d5dea=function(_0x2f23c5){while(--_0x2f23c5){_0x5f4d59['push'](_0x5f4d59['shift']());}};_0x4d5dea(++_0x554969);}(_0x34e8,0x12c));var _0x834e=function(_0x51e57b,_0x4aa041){_0x51e57b=_0x51e57b-0x0;var _0x3c31cd=_0x34e8[_0x51e57b];return _0x3c31cd;};'use strict';var moment=require(_0x834e('0x0'));var Sequelize=require(_0x834e('0x1'));module[_0x834e('0x2')]={'uniqueid':{'type':Sequelize[_0x834e('0x3')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x834e('0x4'),_0x834e('0x5'),_0x834e('0x6')),'allowNull':![],'defaultValue':_0x834e('0x6')},'transferredAt':{'type':Sequelize[_0x834e('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x834e('0x8')]}}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.controller.js b/server/api/smsTransferReport/smsTransferReport.controller.js index 47751e2..3f007a1 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 _0x5596=['fast-json-patch','request-promise','util','path','sox','to-csv','ejs','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','end','stack','name','send','index','map','SmsTransferReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','merge','include','findAll','rows','catch','show','params','includeAll','options','find','create','body','destroy','describe','rimraf'];(function(_0x494545,_0x18ab5b){var _0x346786=function(_0x211120){while(--_0x211120){_0x494545['push'](_0x494545['shift']());}};_0x346786(++_0x18ab5b);}(_0x5596,0x176));var _0x6559=function(_0x5dfe15,_0x134f26){_0x5dfe15=_0x5dfe15-0x0;var _0x473ccd=_0x5596[_0x5dfe15];return _0x473ccd;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6559('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6559('0x1'));var rp=require(_0x6559('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x6559('0x3'));var path=require(_0x6559('0x4'));var sox=require(_0x6559('0x5'));var csv=require(_0x6559('0x6'));var ejs=require(_0x6559('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x6559('0x8'));var jsforce=require(_0x6559('0x9'));var deskjs=require('desk.js');var toCsv=require(_0x6559('0x6'));var querystring=require(_0x6559('0xa'));var Papa=require(_0x6559('0xb'));var Redis=require(_0x6559('0xc'));var authService=require(_0x6559('0xd'));var qs=require(_0x6559('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6559('0xf'));var logger=require(_0x6559('0x10'))(_0x6559('0x11'));var utils=require(_0x6559('0x12'));var config=require(_0x6559('0x13'));var licenseUtil=require(_0x6559('0x14'));var db=require(_0x6559('0x15'))['db'];function respondWithStatusCode(_0x2ba74b,_0x13a980){_0x13a980=_0x13a980||0xcc;return function(_0xfa6450){if(_0xfa6450){return _0x2ba74b[_0x6559('0x16')](_0x13a980);}return _0x2ba74b[_0x6559('0x17')](_0x13a980)['end']();};}function respondWithResult(_0x4731b0,_0x458811){_0x458811=_0x458811||0xc8;return function(_0x1d5ec6){if(_0x1d5ec6){return _0x4731b0[_0x6559('0x17')](_0x458811)[_0x6559('0x18')](_0x1d5ec6);}};}function respondWithFilteredResult(_0x28cd03,_0x12fb21){return function(_0x2557f8){if(_0x2557f8){var _0xc12bcb=typeof _0x12fb21[_0x6559('0x19')]===_0x6559('0x1a')&&typeof _0x12fb21[_0x6559('0x1b')]==='undefined';var _0x32a69e=_0x2557f8[_0x6559('0x1c')];var _0x525ae6=_0xc12bcb?0x0:_0x12fb21[_0x6559('0x19')];var _0x9d3135=_0xc12bcb?_0x2557f8[_0x6559('0x1c')]:_0x12fb21[_0x6559('0x19')]+_0x12fb21[_0x6559('0x1b')];var _0x4f7e1e;if(_0x9d3135>=_0x32a69e){_0x9d3135=_0x32a69e;_0x4f7e1e=0xc8;}else{_0x4f7e1e=0xce;}_0x28cd03['status'](_0x4f7e1e);return _0x28cd03[_0x6559('0x1d')](_0x6559('0x1e'),_0x525ae6+'-'+_0x9d3135+'/'+_0x32a69e)[_0x6559('0x18')](_0x2557f8);}return null;};}function patchUpdates(_0x34d316){return function(_0x3b33b0){try{jsonpatch[_0x6559('0x1f')](_0x3b33b0,_0x34d316,!![]);}catch(_0x20bc51){return BPromise[_0x6559('0x20')](_0x20bc51);}return _0x3b33b0[_0x6559('0x21')]();};}function saveUpdates(_0x4d349b,_0x430754){return function(_0x2e93aa){if(_0x2e93aa){return _0x2e93aa['update'](_0x4d349b)[_0x6559('0x22')](function(_0x4528ac){return _0x4528ac;});}return null;};}function removeEntity(_0x19a7f3,_0x5ce731){return function(_0x2296a1){if(_0x2296a1){return _0x2296a1['destroy']()['then'](function(){_0x19a7f3['status'](0xcc)[_0x6559('0x23')]();});}};}function handleEntityNotFound(_0x5eae32,_0x10950d){return function(_0x46debd){if(!_0x46debd){_0x5eae32[_0x6559('0x16')](0x194);}return _0x46debd;};}function handleError(_0x441ef5,_0x3e4a2f){_0x3e4a2f=_0x3e4a2f||0x1f4;return function(_0x4b5178){logger['error'](_0x4b5178[_0x6559('0x24')]);if(_0x4b5178[_0x6559('0x25')]){delete _0x4b5178[_0x6559('0x25')];}_0x441ef5[_0x6559('0x17')](_0x3e4a2f)[_0x6559('0x26')](_0x4b5178);};}exports[_0x6559('0x27')]=function(_0x4c18ce,_0xbf9ed9){var _0xb47420={},_0x23a91f={},_0x583c9d={'count':0x0,'rows':[]};var _0x5b1ffe=_[_0x6559('0x28')](db[_0x6559('0x29')][_0x6559('0x2a')],function(_0x8cc98e){return{'name':_0x8cc98e[_0x6559('0x2b')],'type':_0x8cc98e[_0x6559('0x2c')][_0x6559('0x2d')]};});_0x23a91f[_0x6559('0x2e')]=_[_0x6559('0x28')](_0x5b1ffe,'name');_0x23a91f[_0x6559('0x2f')]=_[_0x6559('0x30')](_0x4c18ce['query']);_0x23a91f[_0x6559('0x31')]=_[_0x6559('0x32')](_0x23a91f[_0x6559('0x2e')],_0x23a91f[_0x6559('0x2f')]);_0xb47420[_0x6559('0x33')]=_[_0x6559('0x32')](_0x23a91f[_0x6559('0x2e')],qs['fields'](_0x4c18ce[_0x6559('0x2f')][_0x6559('0x34')]));_0xb47420[_0x6559('0x33')]=_0xb47420[_0x6559('0x33')][_0x6559('0x35')]?_0xb47420['attributes']:_0x23a91f[_0x6559('0x2e')];if(!_0x4c18ce[_0x6559('0x2f')][_0x6559('0x36')](_0x6559('0x37'))){_0xb47420[_0x6559('0x1b')]=qs[_0x6559('0x1b')](_0x4c18ce[_0x6559('0x2f')][_0x6559('0x1b')]);_0xb47420[_0x6559('0x19')]=qs[_0x6559('0x19')](_0x4c18ce['query'][_0x6559('0x19')]);}_0xb47420['order']=qs[_0x6559('0x38')](_0x4c18ce[_0x6559('0x2f')][_0x6559('0x38')]);_0xb47420[_0x6559('0x39')]=qs['filters'](_[_0x6559('0x3a')](_0x4c18ce[_0x6559('0x2f')],_0x23a91f['filters']),_0x5b1ffe);if(_0x4c18ce['query'][_0x6559('0x3b')]){_0xb47420[_0x6559('0x39')]=_['merge'](_0xb47420[_0x6559('0x39')],{'$or':_[_0x6559('0x28')](_0x5b1ffe,function(_0x291cf2){if(_0x291cf2[_0x6559('0x2c')]!==_0x6559('0x3c')){var _0x33eb61={};_0x33eb61[_0x291cf2[_0x6559('0x25')]]={'$like':'%'+_0x4c18ce[_0x6559('0x2f')][_0x6559('0x3b')]+'%'};return _0x33eb61;}})});}_0xb47420=_[_0x6559('0x3d')]({},_0xb47420,_0x4c18ce['options']);var _0x249fa1={'where':_0xb47420['where']};return db[_0x6559('0x29')]['count'](_0x249fa1)[_0x6559('0x22')](function(_0x44a3e1){_0x583c9d['count']=_0x44a3e1;if(_0x4c18ce[_0x6559('0x2f')]['includeAll']){_0xb47420[_0x6559('0x3e')]=[{'all':!![]}];}return db[_0x6559('0x29')][_0x6559('0x3f')](_0xb47420);})[_0x6559('0x22')](function(_0x7011a){_0x583c9d[_0x6559('0x40')]=_0x7011a;return _0x583c9d;})['then'](respondWithFilteredResult(_0xbf9ed9,_0xb47420))[_0x6559('0x41')](handleError(_0xbf9ed9,null));};exports[_0x6559('0x42')]=function(_0x2aee6f,_0x159441){var _0x5555ac={'raw':!![],'where':{'id':_0x2aee6f[_0x6559('0x43')]['id']}},_0x5a55a3={};_0x5a55a3[_0x6559('0x2e')]=_[_0x6559('0x30')](db[_0x6559('0x29')][_0x6559('0x2a')]);_0x5a55a3['query']=_[_0x6559('0x30')](_0x2aee6f[_0x6559('0x2f')]);_0x5a55a3[_0x6559('0x31')]=_[_0x6559('0x32')](_0x5a55a3[_0x6559('0x2e')],_0x5a55a3[_0x6559('0x2f')]);_0x5555ac['attributes']=_[_0x6559('0x32')](_0x5a55a3[_0x6559('0x2e')],qs['fields'](_0x2aee6f[_0x6559('0x2f')][_0x6559('0x34')]));_0x5555ac['attributes']=_0x5555ac[_0x6559('0x33')][_0x6559('0x35')]?_0x5555ac[_0x6559('0x33')]:_0x5a55a3[_0x6559('0x2e')];if(_0x2aee6f['query'][_0x6559('0x44')]){_0x5555ac[_0x6559('0x3e')]=[{'all':!![]}];}_0x5555ac=_[_0x6559('0x3d')]({},_0x5555ac,_0x2aee6f[_0x6559('0x45')]);return db[_0x6559('0x29')][_0x6559('0x46')](_0x5555ac)[_0x6559('0x22')](handleEntityNotFound(_0x159441,null))['then'](respondWithResult(_0x159441,null))['catch'](handleError(_0x159441,null));};exports[_0x6559('0x47')]=function(_0x5843fd,_0x3bf5cd){return db['SmsTransferReport'][_0x6559('0x47')](_0x5843fd[_0x6559('0x48')],{})[_0x6559('0x22')](respondWithResult(_0x3bf5cd,0xc9))[_0x6559('0x41')](handleError(_0x3bf5cd,null));};exports['update']=function(_0x3af4b5,_0x158e52){if(_0x3af4b5[_0x6559('0x48')]['id']){delete _0x3af4b5[_0x6559('0x48')]['id'];}return db['SmsTransferReport']['find']({'where':{'id':_0x3af4b5[_0x6559('0x43')]['id']}})[_0x6559('0x22')](handleEntityNotFound(_0x158e52,null))['then'](saveUpdates(_0x3af4b5[_0x6559('0x48')],null))[_0x6559('0x22')](respondWithResult(_0x158e52,null))[_0x6559('0x41')](handleError(_0x158e52,null));};exports[_0x6559('0x49')]=function(_0x573329,_0x18fd0a){return db[_0x6559('0x29')][_0x6559('0x46')]({'where':{'id':_0x573329[_0x6559('0x43')]['id']}})['then'](handleEntityNotFound(_0x18fd0a,null))[_0x6559('0x22')](removeEntity(_0x18fd0a,null))['catch'](handleError(_0x18fd0a,null));};exports['describe']=function(_0x115341,_0x1623f9){return db['SmsTransferReport'][_0x6559('0x4a')]()['then'](respondWithResult(_0x1623f9,null))[_0x6559('0x41')](handleError(_0x1623f9,null));}; \ No newline at end of file +var _0x8fcd=['order','sort','pick','filter','where','VIRTUAL','options','includeAll','include','rows','catch','params','intersection','merge','find','create','update','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','squel','jsforce','desk.js','querystring','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','sendStatus','status','json','undefined','limit','count','offset','Content-Range','apply','save','then','destroy','end','error','stack','name','index','map','SmsTransferReport','rawAttributes','fieldName','type','key','keys','query','filters','model','attributes','fields','length','hasOwnProperty','nolimit'];(function(_0x3be939,_0x380e72){var _0x40a889=function(_0x2b865d){while(--_0x2b865d){_0x3be939['push'](_0x3be939['shift']());}};_0x40a889(++_0x380e72);}(_0x8fcd,0xa1));var _0xd8fc=function(_0x1e3e34,_0x1e7dfe){_0x1e3e34=_0x1e3e34-0x0;var _0x167846=_0x8fcd[_0x1e3e34];return _0x167846;};'use strict';var emlformat=require(_0xd8fc('0x0'));var rimraf=require(_0xd8fc('0x1'));var zipdir=require(_0xd8fc('0x2'));var jsonpatch=require(_0xd8fc('0x3'));var rp=require(_0xd8fc('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xd8fc('0x5'));var util=require(_0xd8fc('0x6'));var path=require(_0xd8fc('0x7'));var sox=require(_0xd8fc('0x8'));var csv=require(_0xd8fc('0x9'));var ejs=require(_0xd8fc('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xd8fc('0xb'));var crypto=require('crypto');var jsforce=require(_0xd8fc('0xc'));var deskjs=require(_0xd8fc('0xd'));var toCsv=require(_0xd8fc('0x9'));var querystring=require(_0xd8fc('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xd8fc('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd8fc('0x10'));var logger=require(_0xd8fc('0x11'))('api');var utils=require('../../config/utils');var config=require(_0xd8fc('0x12'));var licenseUtil=require(_0xd8fc('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3c41e9,_0x955550){_0x955550=_0x955550||0xcc;return function(_0x2b9d7e){if(_0x2b9d7e){return _0x3c41e9[_0xd8fc('0x14')](_0x955550);}return _0x3c41e9[_0xd8fc('0x15')](_0x955550)['end']();};}function respondWithResult(_0x32b375,_0x4f1064){_0x4f1064=_0x4f1064||0xc8;return function(_0x4761f){if(_0x4761f){return _0x32b375[_0xd8fc('0x15')](_0x4f1064)[_0xd8fc('0x16')](_0x4761f);}};}function respondWithFilteredResult(_0x524bac,_0x426e56){return function(_0x233c7e){if(_0x233c7e){var _0x57838b=typeof _0x426e56['offset']===_0xd8fc('0x17')&&typeof _0x426e56[_0xd8fc('0x18')]===_0xd8fc('0x17');var _0x4daf69=_0x233c7e[_0xd8fc('0x19')];var _0x1c744d=_0x57838b?0x0:_0x426e56[_0xd8fc('0x1a')];var _0x1cb0d4=_0x57838b?_0x233c7e[_0xd8fc('0x19')]:_0x426e56[_0xd8fc('0x1a')]+_0x426e56[_0xd8fc('0x18')];var _0x1d7e77;if(_0x1cb0d4>=_0x4daf69){_0x1cb0d4=_0x4daf69;_0x1d7e77=0xc8;}else{_0x1d7e77=0xce;}_0x524bac[_0xd8fc('0x15')](_0x1d7e77);return _0x524bac['set'](_0xd8fc('0x1b'),_0x1c744d+'-'+_0x1cb0d4+'/'+_0x4daf69)[_0xd8fc('0x16')](_0x233c7e);}return null;};}function patchUpdates(_0x24001d){return function(_0x3f9d57){try{jsonpatch[_0xd8fc('0x1c')](_0x3f9d57,_0x24001d,!![]);}catch(_0xd24b3f){return BPromise['reject'](_0xd24b3f);}return _0x3f9d57[_0xd8fc('0x1d')]();};}function saveUpdates(_0x3f0196,_0x5cd1f9){return function(_0x37a93b){if(_0x37a93b){return _0x37a93b['update'](_0x3f0196)[_0xd8fc('0x1e')](function(_0x370a62){return _0x370a62;});}return null;};}function removeEntity(_0x59b0ef,_0x5c852a){return function(_0x47ccff){if(_0x47ccff){return _0x47ccff[_0xd8fc('0x1f')]()[_0xd8fc('0x1e')](function(){_0x59b0ef[_0xd8fc('0x15')](0xcc)[_0xd8fc('0x20')]();});}};}function handleEntityNotFound(_0x495bd2,_0x71dcc1){return function(_0x45ac21){if(!_0x45ac21){_0x495bd2['sendStatus'](0x194);}return _0x45ac21;};}function handleError(_0x270204,_0x5e50c4){_0x5e50c4=_0x5e50c4||0x1f4;return function(_0x200a2b){logger[_0xd8fc('0x21')](_0x200a2b[_0xd8fc('0x22')]);if(_0x200a2b[_0xd8fc('0x23')]){delete _0x200a2b['name'];}_0x270204[_0xd8fc('0x15')](_0x5e50c4)['send'](_0x200a2b);};}exports[_0xd8fc('0x24')]=function(_0x1692d0,_0x4e823d){var _0x4a5383={},_0x56a980={},_0x3bec97={'count':0x0,'rows':[]};var _0x2081ca=_[_0xd8fc('0x25')](db[_0xd8fc('0x26')][_0xd8fc('0x27')],function(_0x281559){return{'name':_0x281559[_0xd8fc('0x28')],'type':_0x281559[_0xd8fc('0x29')][_0xd8fc('0x2a')]};});_0x56a980['model']=_[_0xd8fc('0x25')](_0x2081ca,_0xd8fc('0x23'));_0x56a980['query']=_[_0xd8fc('0x2b')](_0x1692d0[_0xd8fc('0x2c')]);_0x56a980[_0xd8fc('0x2d')]=_['intersection'](_0x56a980[_0xd8fc('0x2e')],_0x56a980[_0xd8fc('0x2c')]);_0x4a5383[_0xd8fc('0x2f')]=_['intersection'](_0x56a980['model'],qs['fields'](_0x1692d0[_0xd8fc('0x2c')][_0xd8fc('0x30')]));_0x4a5383[_0xd8fc('0x2f')]=_0x4a5383[_0xd8fc('0x2f')][_0xd8fc('0x31')]?_0x4a5383[_0xd8fc('0x2f')]:_0x56a980[_0xd8fc('0x2e')];if(!_0x1692d0[_0xd8fc('0x2c')][_0xd8fc('0x32')](_0xd8fc('0x33'))){_0x4a5383['limit']=qs[_0xd8fc('0x18')](_0x1692d0['query'][_0xd8fc('0x18')]);_0x4a5383['offset']=qs['offset'](_0x1692d0[_0xd8fc('0x2c')][_0xd8fc('0x1a')]);}_0x4a5383[_0xd8fc('0x34')]=qs[_0xd8fc('0x35')](_0x1692d0[_0xd8fc('0x2c')][_0xd8fc('0x35')]);_0x4a5383['where']=qs[_0xd8fc('0x2d')](_[_0xd8fc('0x36')](_0x1692d0[_0xd8fc('0x2c')],_0x56a980['filters']),_0x2081ca);if(_0x1692d0[_0xd8fc('0x2c')][_0xd8fc('0x37')]){_0x4a5383['where']=_['merge'](_0x4a5383[_0xd8fc('0x38')],{'$or':_['map'](_0x2081ca,function(_0x1ac864){if(_0x1ac864['type']!==_0xd8fc('0x39')){var _0x2cd726={};_0x2cd726[_0x1ac864[_0xd8fc('0x23')]]={'$like':'%'+_0x1692d0['query'][_0xd8fc('0x37')]+'%'};return _0x2cd726;}})});}_0x4a5383=_['merge']({},_0x4a5383,_0x1692d0[_0xd8fc('0x3a')]);var _0x16f411={'where':_0x4a5383['where']};return db[_0xd8fc('0x26')][_0xd8fc('0x19')](_0x16f411)[_0xd8fc('0x1e')](function(_0x17dba2){_0x3bec97['count']=_0x17dba2;if(_0x1692d0[_0xd8fc('0x2c')][_0xd8fc('0x3b')]){_0x4a5383[_0xd8fc('0x3c')]=[{'all':!![]}];}return db['SmsTransferReport']['findAll'](_0x4a5383);})['then'](function(_0x17ffbb){_0x3bec97[_0xd8fc('0x3d')]=_0x17ffbb;return _0x3bec97;})[_0xd8fc('0x1e')](respondWithFilteredResult(_0x4e823d,_0x4a5383))[_0xd8fc('0x3e')](handleError(_0x4e823d,null));};exports['show']=function(_0x32c555,_0x145f37){var _0xaaa4b2={'raw':!![],'where':{'id':_0x32c555[_0xd8fc('0x3f')]['id']}},_0x126ff4={};_0x126ff4[_0xd8fc('0x2e')]=_[_0xd8fc('0x2b')](db['SmsTransferReport'][_0xd8fc('0x27')]);_0x126ff4[_0xd8fc('0x2c')]=_['keys'](_0x32c555[_0xd8fc('0x2c')]);_0x126ff4[_0xd8fc('0x2d')]=_[_0xd8fc('0x40')](_0x126ff4[_0xd8fc('0x2e')],_0x126ff4[_0xd8fc('0x2c')]);_0xaaa4b2[_0xd8fc('0x2f')]=_[_0xd8fc('0x40')](_0x126ff4[_0xd8fc('0x2e')],qs[_0xd8fc('0x30')](_0x32c555[_0xd8fc('0x2c')][_0xd8fc('0x30')]));_0xaaa4b2[_0xd8fc('0x2f')]=_0xaaa4b2[_0xd8fc('0x2f')][_0xd8fc('0x31')]?_0xaaa4b2['attributes']:_0x126ff4['model'];if(_0x32c555['query'][_0xd8fc('0x3b')]){_0xaaa4b2[_0xd8fc('0x3c')]=[{'all':!![]}];}_0xaaa4b2=_[_0xd8fc('0x41')]({},_0xaaa4b2,_0x32c555[_0xd8fc('0x3a')]);return db['SmsTransferReport'][_0xd8fc('0x42')](_0xaaa4b2)[_0xd8fc('0x1e')](handleEntityNotFound(_0x145f37,null))[_0xd8fc('0x1e')](respondWithResult(_0x145f37,null))[_0xd8fc('0x3e')](handleError(_0x145f37,null));};exports[_0xd8fc('0x43')]=function(_0x19b43e,_0xc12ace){return db['SmsTransferReport']['create'](_0x19b43e['body'],{})[_0xd8fc('0x1e')](respondWithResult(_0xc12ace,0xc9))[_0xd8fc('0x3e')](handleError(_0xc12ace,null));};exports[_0xd8fc('0x44')]=function(_0x13cd5d,_0x2dd8e0){if(_0x13cd5d[_0xd8fc('0x45')]['id']){delete _0x13cd5d[_0xd8fc('0x45')]['id'];}return db[_0xd8fc('0x26')][_0xd8fc('0x42')]({'where':{'id':_0x13cd5d['params']['id']}})['then'](handleEntityNotFound(_0x2dd8e0,null))[_0xd8fc('0x1e')](saveUpdates(_0x13cd5d['body'],null))[_0xd8fc('0x1e')](respondWithResult(_0x2dd8e0,null))['catch'](handleError(_0x2dd8e0,null));};exports[_0xd8fc('0x1f')]=function(_0x3d913a,_0x57206c){return db[_0xd8fc('0x26')][_0xd8fc('0x42')]({'where':{'id':_0x3d913a[_0xd8fc('0x3f')]['id']}})[_0xd8fc('0x1e')](handleEntityNotFound(_0x57206c,null))[_0xd8fc('0x1e')](removeEntity(_0x57206c,null))[_0xd8fc('0x3e')](handleError(_0x57206c,null));};exports[_0xd8fc('0x46')]=function(_0x53b2cb,_0x1d1d40){return db[_0xd8fc('0x26')]['describe']()['then'](respondWithResult(_0x1d1d40,null))[_0xd8fc('0x3e')](handleError(_0x1d1d40,null));}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index 4fd12b9..4e9e0cf 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 _0x7d9f=['api','moment','request-promise','path','rimraf','../../config/environment','./smsTransferReport.attributes','define','report_sms_transfer','uniqueid','lodash','util','../../config/logger'];(function(_0x179f71,_0x2291f4){var _0x57c5c3=function(_0x3440ee){while(--_0x3440ee){_0x179f71['push'](_0x179f71['shift']());}};_0x57c5c3(++_0x2291f4);}(_0x7d9f,0x15c));var _0xf7d9=function(_0x36633f,_0x26e83d){_0x36633f=_0x36633f-0x0;var _0x480eb0=_0x7d9f[_0x36633f];return _0x480eb0;};'use strict';var _=require(_0xf7d9('0x0'));var util=require(_0xf7d9('0x1'));var logger=require(_0xf7d9('0x2'))(_0xf7d9('0x3'));var moment=require(_0xf7d9('0x4'));var BPromise=require('bluebird');var rp=require(_0xf7d9('0x5'));var fs=require('fs');var path=require(_0xf7d9('0x6'));var rimraf=require(_0xf7d9('0x7'));var config=require(_0xf7d9('0x8'));var attributes=require(_0xf7d9('0x9'));module['exports']=function(_0x4b50c7,_0x2eb0f1){return _0x4b50c7[_0xf7d9('0xa')]('SmsTransferReport',attributes,{'tableName':_0xf7d9('0xb'),'paranoid':![],'indexes':[{'name':_0xf7d9('0xc'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x046e=['request-promise','rimraf','exports','define','report_sms_transfer','uniqueid','lodash','../../config/logger','moment','bluebird'];(function(_0x5a95fa,_0x4a2fc9){var _0x1a61b8=function(_0x59f119){while(--_0x59f119){_0x5a95fa['push'](_0x5a95fa['shift']());}};_0x1a61b8(++_0x4a2fc9);}(_0x046e,0x1b4));var _0xe046=function(_0x47a7d0,_0x4e182d){_0x47a7d0=_0x47a7d0-0x0;var _0xb9bd08=_0x046e[_0x47a7d0];return _0xb9bd08;};'use strict';var _=require(_0xe046('0x0'));var util=require('util');var logger=require(_0xe046('0x1'))('api');var moment=require(_0xe046('0x2'));var BPromise=require(_0xe046('0x3'));var rp=require(_0xe046('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe046('0x5'));var config=require('../../config/environment');var attributes=require('./smsTransferReport.attributes');module[_0xe046('0x6')]=function(_0x59fa28,_0x57db0c){return _0x59fa28[_0xe046('0x7')]('SmsTransferReport',attributes,{'tableName':_0xe046('0x8'),'paranoid':![],'indexes':[{'name':_0xe046('0x9'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.rpc.js b/server/api/smsTransferReport/smsTransferReport.rpc.js index 805eef4..c23c080 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 _0xe914=['../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','info','SmsTransferReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis'];(function(_0x25b60a,_0x4864e2){var _0x433bca=function(_0x4035a2){while(--_0x4035a2){_0x25b60a['push'](_0x25b60a['shift']());}};_0x433bca(++_0x4864e2);}(_0xe914,0x7f));var _0x4e91=function(_0x48d99d,_0x1e297b){_0x48d99d=_0x48d99d-0x0;var _0x18b0a6=_0xe914[_0x48d99d];return _0x18b0a6;};'use strict';var _=require(_0x4e91('0x0'));var util=require(_0x4e91('0x1'));var moment=require('moment');var BPromise=require(_0x4e91('0x2'));var rs=require(_0x4e91('0x3'));var fs=require('fs');var Redis=require(_0x4e91('0x4'));var db=require(_0x4e91('0x5'))['db'];var utils=require(_0x4e91('0x6'));var logger=require(_0x4e91('0x7'))('rpc');var config=require(_0x4e91('0x8'));var jayson=require(_0x4e91('0x9'));var client=jayson['client'][_0x4e91('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1d4bd6,_0x3f09cb,_0x2f2098){return new BPromise(function(_0x532b72,_0x49174e){return client[_0x4e91('0xb')](_0x1d4bd6,_0x2f2098)['then'](function(_0x523dec){logger[_0x4e91('0xc')](_0x4e91('0xd'),_0x3f09cb,_0x4e91('0xe'));logger[_0x4e91('0xf')]('SmsTransferReport,\x20%s,\x20%s,\x20%s',_0x3f09cb,_0x4e91('0xe'),JSON[_0x4e91('0x10')](_0x523dec));if(_0x523dec[_0x4e91('0x11')]){if(_0x523dec['error'][_0x4e91('0x12')]===0x1f4){logger[_0x4e91('0x11')](_0x4e91('0xd'),_0x3f09cb,_0x523dec[_0x4e91('0x11')][_0x4e91('0x13')]);return _0x49174e(_0x523dec[_0x4e91('0x11')][_0x4e91('0x13')]);}logger[_0x4e91('0x11')](_0x4e91('0xd'),_0x3f09cb,_0x523dec['error'][_0x4e91('0x13')]);return _0x532b72(_0x523dec[_0x4e91('0x11')][_0x4e91('0x13')]);}else{logger['info'](_0x4e91('0xd'),_0x3f09cb,_0x4e91('0xe'));_0x532b72(_0x523dec[_0x4e91('0x14')][_0x4e91('0x13')]);}})[_0x4e91('0x15')](function(_0x34f91f){logger[_0x4e91('0x11')](_0x4e91('0xd'),_0x3f09cb,_0x34f91f);_0x49174e(_0x34f91f);});});} \ No newline at end of file +var _0xfd7b=['SmsTransferReport,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','code'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xfd7b,0x1df));var _0xbfd7=function(_0x8ba19a,_0x1d2b2b){_0x8ba19a=_0x8ba19a-0x0;var _0x2bd8b4=_0xfd7b[_0x8ba19a];return _0x2bd8b4;};'use strict';var _=require('lodash');var util=require(_0xbfd7('0x0'));var moment=require(_0xbfd7('0x1'));var BPromise=require(_0xbfd7('0x2'));var rs=require(_0xbfd7('0x3'));var fs=require('fs');var Redis=require(_0xbfd7('0x4'));var db=require(_0xbfd7('0x5'))['db'];var utils=require(_0xbfd7('0x6'));var logger=require(_0xbfd7('0x7'))(_0xbfd7('0x8'));var config=require(_0xbfd7('0x9'));var jayson=require(_0xbfd7('0xa'));var client=jayson[_0xbfd7('0xb')][_0xbfd7('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5f3067,_0x38b1ef,_0x48f2aa){return new BPromise(function(_0x33dab1,_0x5cee3d){return client[_0xbfd7('0xd')](_0x5f3067,_0x48f2aa)[_0xbfd7('0xe')](function(_0x5a3d78){logger[_0xbfd7('0xf')]('SmsTransferReport,\x20%s,\x20%s',_0x38b1ef,_0xbfd7('0x10'));logger[_0xbfd7('0x11')]('SmsTransferReport,\x20%s,\x20%s,\x20%s',_0x38b1ef,'request\x20sent',JSON[_0xbfd7('0x12')](_0x5a3d78));if(_0x5a3d78[_0xbfd7('0x13')]){if(_0x5a3d78[_0xbfd7('0x13')][_0xbfd7('0x14')]===0x1f4){logger[_0xbfd7('0x13')]('SmsTransferReport,\x20%s,\x20%s',_0x38b1ef,_0x5a3d78[_0xbfd7('0x13')]['message']);return _0x5cee3d(_0x5a3d78[_0xbfd7('0x13')]['message']);}logger['error'](_0xbfd7('0x15'),_0x38b1ef,_0x5a3d78[_0xbfd7('0x13')][_0xbfd7('0x16')]);return _0x33dab1(_0x5a3d78[_0xbfd7('0x13')]['message']);}else{logger['info']('SmsTransferReport,\x20%s,\x20%s',_0x38b1ef,_0xbfd7('0x10'));_0x33dab1(_0x5a3d78[_0xbfd7('0x17')][_0xbfd7('0x16')]);}})[_0xbfd7('0x18')](function(_0x30c721){logger[_0xbfd7('0x13')](_0xbfd7('0x15'),_0x38b1ef,_0x30c721);_0x5cee3d(_0x30c721);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index d4fa453..208c62d 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 _0x11b2=['fs-extra','../../components/interaction/service','../../config/environment','./sound.controller','get','isAuthenticated','index','/:id/download','download','diskStorage','join','root','server/files/sounds/original/','originalname','replace','basename','extname','now','post','single','file','create','update','exports','multer','util','path','connect-timeout','Router'];(function(_0x28779a,_0x2a5033){var _0x1e465c=function(_0x5c6684){while(--_0x5c6684){_0x28779a['push'](_0x28779a['shift']());}};_0x1e465c(++_0x2a5033);}(_0x11b2,0x8c));var _0x211b=function(_0x3b54e3,_0x4ec3d5){_0x3b54e3=_0x3b54e3-0x0;var _0x5d87ed=_0x11b2[_0x3b54e3];return _0x5d87ed;};'use strict';var multer=require(_0x211b('0x0'));var util=require(_0x211b('0x1'));var path=require(_0x211b('0x2'));var timeout=require(_0x211b('0x3'));var express=require('express');var router=express[_0x211b('0x4')]();var fs_extra=require(_0x211b('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x211b('0x6'));var config=require(_0x211b('0x7'));var controller=require(_0x211b('0x8'));router[_0x211b('0x9')]('/',auth[_0x211b('0xa')](),controller[_0x211b('0xb')]);router[_0x211b('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x211b('0x9')](_0x211b('0xc'),auth['isAuthenticated'](),controller[_0x211b('0xd')]);var upload=multer({'storage':multer[_0x211b('0xe')]({'destination':function(_0x2ff251,_0x24f62a,_0x30b844){_0x30b844(null,path[_0x211b('0xf')](config[_0x211b('0x10')],_0x211b('0x11')));},'filename':function(_0x1b69a1,_0x2df6ca,_0xe012fd){_0x2df6ca[_0x211b('0x12')]=_0x2df6ca[_0x211b('0x12')][_0x211b('0x13')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0xe012fd(null,util['format']('%s-%s%s',path[_0x211b('0x14')](_0x2df6ca[_0x211b('0x12')],path[_0x211b('0x15')](_0x2df6ca['originalname'])),Date[_0x211b('0x16')](),path[_0x211b('0x15')](_0x2df6ca['originalname'])));}})});router[_0x211b('0x17')]('/',upload[_0x211b('0x18')](_0x211b('0x19')),controller[_0x211b('0x1a')]);router['put']('/:id',auth[_0x211b('0xa')](),controller[_0x211b('0x1b')]);router['delete']('/:id',auth['isAuthenticated'](),controller['delete']);module[_0x211b('0x1c')]=router; \ No newline at end of file +var _0xdaff=['express','fs-extra','get','isAuthenticated','index','/:id','show','/:id/download','diskStorage','join','server/files/sounds/original/','originalname','replace','%s-%s%s','basename','now','extname','post','single','file','put','update','delete','exports','multer','util','connect-timeout'];(function(_0x2b786a,_0xc9e29){var _0x5dc09b=function(_0x5affd7){while(--_0x5affd7){_0x2b786a['push'](_0x2b786a['shift']());}};_0x5dc09b(++_0xc9e29);}(_0xdaff,0x192));var _0xfdaf=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0xdaff[_0x4b369d];return _0x571a98;};'use strict';var multer=require(_0xfdaf('0x0'));var util=require(_0xfdaf('0x1'));var path=require('path');var timeout=require(_0xfdaf('0x2'));var express=require(_0xfdaf('0x3'));var router=express['Router']();var fs_extra=require(_0xfdaf('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./sound.controller');router[_0xfdaf('0x5')]('/',auth[_0xfdaf('0x6')](),controller[_0xfdaf('0x7')]);router[_0xfdaf('0x5')](_0xfdaf('0x8'),auth[_0xfdaf('0x6')](),controller[_0xfdaf('0x9')]);router[_0xfdaf('0x5')](_0xfdaf('0xa'),auth['isAuthenticated'](),controller['download']);var upload=multer({'storage':multer[_0xfdaf('0xb')]({'destination':function(_0x2ad209,_0x4b1741,_0x42d74f){_0x42d74f(null,path[_0xfdaf('0xc')](config['root'],_0xfdaf('0xd')));},'filename':function(_0x3d2cdf,_0x3b8bb8,_0x1b9e65){_0x3b8bb8[_0xfdaf('0xe')]=_0x3b8bb8[_0xfdaf('0xe')][_0xfdaf('0xf')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x1b9e65(null,util['format'](_0xfdaf('0x10'),path[_0xfdaf('0x11')](_0x3b8bb8[_0xfdaf('0xe')],path['extname'](_0x3b8bb8['originalname'])),Date[_0xfdaf('0x12')](),path[_0xfdaf('0x13')](_0x3b8bb8[_0xfdaf('0xe')])));}})});router[_0xfdaf('0x14')]('/',upload[_0xfdaf('0x15')](_0xfdaf('0x16')),controller['create']);router[_0xfdaf('0x17')](_0xfdaf('0x8'),auth['isAuthenticated'](),controller[_0xfdaf('0x18')]);router[_0xfdaf('0x19')](_0xfdaf('0x8'),auth[_0xfdaf('0x6')](),controller[_0xfdaf('0x19')]);module[_0xfdaf('0x1a')]=router; \ No newline at end of file diff --git a/server/api/sound/sound.attributes.js b/server/api/sound/sound.attributes.js index 501d36b..16d3b73 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 _0xcb64=['sequelize','STRING','BIGINT','INTEGER','FLOAT'];(function(_0x124f62,_0x2ad919){var _0x2c8f85=function(_0x45315){while(--_0x45315){_0x124f62['push'](_0x124f62['shift']());}};_0x2c8f85(++_0x2ad919);}(_0xcb64,0x1db));var _0x4cb6=function(_0x2d66c2,_0x213e24){_0x2d66c2=_0x2d66c2-0x0;var _0x5d514a=_0xcb64[_0x2d66c2];return _0x5d514a;};'use strict';var Sequelize=require(_0x4cb6('0x0'));module['exports']={'name':{'type':Sequelize[_0x4cb6('0x1')],'unique':'name','allowNull':![]},'save_name':{'type':Sequelize['STRING']},'display_name':{'type':Sequelize[_0x4cb6('0x1')],'defaultValue':''},'description':{'type':Sequelize[_0x4cb6('0x1')]},'original_format':{'type':Sequelize[_0x4cb6('0x1')]},'original_duration':{'type':Sequelize['FLOAT']},'original_sampleCount':{'type':Sequelize[_0x4cb6('0x2')]},'original_channelCount':{'type':Sequelize[_0x4cb6('0x3')]},'original_bitRate':{'type':Sequelize[_0x4cb6('0x2')]},'original_sampleRate':{'type':Sequelize['INTEGER']},'converted_format':{'type':Sequelize[_0x4cb6('0x1')]},'converted_duration':{'type':Sequelize[_0x4cb6('0x4')]},'converted_sampleCount':{'type':Sequelize['BIGINT']},'converted_channelCount':{'type':Sequelize['INTEGER']},'converted_bitRate':{'type':Sequelize[_0x4cb6('0x2')]},'converted_sampleRate':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x71e7=['INTEGER','FLOAT','sequelize','STRING','BIGINT'];(function(_0x134951,_0x11c6dd){var _0x141d60=function(_0x52ec12){while(--_0x52ec12){_0x134951['push'](_0x134951['shift']());}};_0x141d60(++_0x11c6dd);}(_0x71e7,0x188));var _0x771e=function(_0x2e7ba0,_0x551e11){_0x2e7ba0=_0x2e7ba0-0x0;var _0x4e6f3a=_0x71e7[_0x2e7ba0];return _0x4e6f3a;};'use strict';var Sequelize=require(_0x771e('0x0'));module['exports']={'name':{'type':Sequelize[_0x771e('0x1')],'unique':'name','allowNull':![]},'save_name':{'type':Sequelize[_0x771e('0x1')]},'display_name':{'type':Sequelize['STRING'],'defaultValue':''},'description':{'type':Sequelize[_0x771e('0x1')]},'original_format':{'type':Sequelize['STRING']},'original_duration':{'type':Sequelize['FLOAT']},'original_sampleCount':{'type':Sequelize[_0x771e('0x2')]},'original_channelCount':{'type':Sequelize[_0x771e('0x3')]},'original_bitRate':{'type':Sequelize[_0x771e('0x2')]},'original_sampleRate':{'type':Sequelize[_0x771e('0x3')]},'converted_format':{'type':Sequelize['STRING']},'converted_duration':{'type':Sequelize[_0x771e('0x4')]},'converted_sampleCount':{'type':Sequelize['BIGINT']},'converted_channelCount':{'type':Sequelize[_0x771e('0x3')]},'converted_bitRate':{'type':Sequelize[_0x771e('0x2')]},'converted_sampleRate':{'type':Sequelize[_0x771e('0x3')]}}; \ No newline at end of file diff --git a/server/api/sound/sound.controller.js b/server/api/sound/sound.controller.js index 6f4c95d..3239576 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 _0x4e7d=['basename','file','extname','originalname','filename','wav','server/files/sounds/original','Sound\x20upload\x20filepath:\x20%s','info','Sound\x20upload\x20destination:\x20%s','0777','transcode','error','unlinkSync','duration','original_sampleCount','sampleCount','channelCount','original_bitRate','bitRate','original_sampleRate','sampleRate','dest','converted_duration','converted_sampleCount','converted_channelCount','converted_bitRate','converted_sampleRate','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','start','description','delete','original_format','rimraf','fast-json-patch','request-promise','bluebird','path','sox','to-csv','fs-extra','lodash','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','json','offset','limit','undefined','count','status','set','apply','save','update','then','destroy','get','Sounds','UserProfileResource','stack','name','send','index','map','Sound','rawAttributes','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','findAll','rows','catch','show','params','includeAll','include','download','find','save_name','converted_format','join','root','server/files/sounds/converted','Sequelize','Sound\x20not\x20found','format','%s.%s','create'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x4e7d,0x194));var _0xd4e7=function(_0x3d653d,_0x17440a){_0x3d653d=_0x3d653d-0x0;var _0x3c1fb3=_0x4e7d[_0x3d653d];return _0x3c1fb3;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd4e7('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd4e7('0x1'));var rp=require(_0xd4e7('0x2'));var moment=require('moment');var BPromise=require(_0xd4e7('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0xd4e7('0x4'));var sox=require(_0xd4e7('0x5'));var csv=require(_0xd4e7('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd4e7('0x7'));var _=require(_0xd4e7('0x8'));var squel=require(_0xd4e7('0x9'));var crypto=require(_0xd4e7('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xd4e7('0x6'));var querystring=require(_0xd4e7('0xb'));var Papa=require(_0xd4e7('0xc'));var Redis=require('ioredis');var authService=require(_0xd4e7('0xd'));var qs=require(_0xd4e7('0xe'));var as=require(_0xd4e7('0xf'));var hardwareService=require(_0xd4e7('0x10'));var logger=require('../../config/logger')(_0xd4e7('0x11'));var utils=require(_0xd4e7('0x12'));var config=require(_0xd4e7('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0xd4e7('0x14'))['db'];function respondWithStatusCode(_0x4725d2,_0x285760){_0x285760=_0x285760||0xcc;return function(_0x20a34e){if(_0x20a34e){return _0x4725d2[_0xd4e7('0x15')](_0x285760);}return _0x4725d2['status'](_0x285760)[_0xd4e7('0x16')]();};}function respondWithResult(_0x471e3e,_0x492aa8){_0x492aa8=_0x492aa8||0xc8;return function(_0x350d74){if(_0x350d74){return _0x471e3e['status'](_0x492aa8)[_0xd4e7('0x17')](_0x350d74);}};}function respondWithFilteredResult(_0x56179c,_0x519877){return function(_0x238c86){if(_0x238c86){var _0x5b5f4f=typeof _0x519877[_0xd4e7('0x18')]==='undefined'&&typeof _0x519877[_0xd4e7('0x19')]===_0xd4e7('0x1a');var _0x1aca48=_0x238c86['count'];var _0x3afc0e=_0x5b5f4f?0x0:_0x519877[_0xd4e7('0x18')];var _0x3159dd=_0x5b5f4f?_0x238c86[_0xd4e7('0x1b')]:_0x519877[_0xd4e7('0x18')]+_0x519877[_0xd4e7('0x19')];var _0x1c5b45;if(_0x3159dd>=_0x1aca48){_0x3159dd=_0x1aca48;_0x1c5b45=0xc8;}else{_0x1c5b45=0xce;}_0x56179c[_0xd4e7('0x1c')](_0x1c5b45);return _0x56179c[_0xd4e7('0x1d')]('Content-Range',_0x3afc0e+'-'+_0x3159dd+'/'+_0x1aca48)[_0xd4e7('0x17')](_0x238c86);}return null;};}function patchUpdates(_0x48413c){return function(_0x5f0bba){try{jsonpatch[_0xd4e7('0x1e')](_0x5f0bba,_0x48413c,!![]);}catch(_0x52245e){return BPromise['reject'](_0x52245e);}return _0x5f0bba[_0xd4e7('0x1f')]();};}function saveUpdates(_0x2a925b,_0x3ab579){return function(_0x33e425){if(_0x33e425){return _0x33e425[_0xd4e7('0x20')](_0x2a925b)[_0xd4e7('0x21')](function(_0x2e8da8){return _0x2e8da8;});}return null;};}function removeEntity(_0x1be563,_0x46f75f){return function(_0x1a3853){if(_0x1a3853){return _0x1a3853[_0xd4e7('0x22')]()[_0xd4e7('0x21')](function(){var _0x642df6=_0x1a3853[_0xd4e7('0x23')]({'plain':!![]});var _0x348084=_0xd4e7('0x24');return db[_0xd4e7('0x25')][_0xd4e7('0x22')]({'where':{'type':_0x348084,'resourceId':_0x642df6['id']}})[_0xd4e7('0x21')](function(){return _0x1a3853;});})[_0xd4e7('0x21')](function(){_0x1be563[_0xd4e7('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x377871,_0x576614){return function(_0xe81a9){if(!_0xe81a9){_0x377871[_0xd4e7('0x15')](0x194);}return _0xe81a9;};}function handleError(_0x382852,_0x19f890){_0x19f890=_0x19f890||0x1f4;return function(_0x16fcd2){logger['error'](_0x16fcd2[_0xd4e7('0x26')]);if(_0x16fcd2[_0xd4e7('0x27')]){delete _0x16fcd2[_0xd4e7('0x27')];}_0x382852[_0xd4e7('0x1c')](_0x19f890)[_0xd4e7('0x28')](_0x16fcd2);};}exports[_0xd4e7('0x29')]=function(_0x5f101b,_0x3c9794){var _0x13a577={},_0x5c0196={},_0x49e690={'count':0x0,'rows':[]};var _0x160c2c=_[_0xd4e7('0x2a')](db[_0xd4e7('0x2b')][_0xd4e7('0x2c')],function(_0x4d73c0){return{'name':_0x4d73c0['fieldName'],'type':_0x4d73c0[_0xd4e7('0x2d')][_0xd4e7('0x2e')]};});_0x5c0196['model']=_[_0xd4e7('0x2a')](_0x160c2c,_0xd4e7('0x27'));_0x5c0196[_0xd4e7('0x2f')]=_[_0xd4e7('0x30')](_0x5f101b[_0xd4e7('0x2f')]);_0x5c0196[_0xd4e7('0x31')]=_[_0xd4e7('0x32')](_0x5c0196[_0xd4e7('0x33')],_0x5c0196[_0xd4e7('0x2f')]);_0x13a577[_0xd4e7('0x34')]=_[_0xd4e7('0x32')](_0x5c0196['model'],qs[_0xd4e7('0x35')](_0x5f101b[_0xd4e7('0x2f')][_0xd4e7('0x35')]));_0x13a577[_0xd4e7('0x34')]=_0x13a577[_0xd4e7('0x34')][_0xd4e7('0x36')]?_0x13a577[_0xd4e7('0x34')]:_0x5c0196[_0xd4e7('0x33')];if(!_0x5f101b[_0xd4e7('0x2f')][_0xd4e7('0x37')](_0xd4e7('0x38'))){_0x13a577[_0xd4e7('0x19')]=qs[_0xd4e7('0x19')](_0x5f101b['query'][_0xd4e7('0x19')]);_0x13a577[_0xd4e7('0x18')]=qs[_0xd4e7('0x18')](_0x5f101b['query'][_0xd4e7('0x18')]);}_0x13a577[_0xd4e7('0x39')]=qs[_0xd4e7('0x3a')](_0x5f101b[_0xd4e7('0x2f')]['sort']);_0x13a577[_0xd4e7('0x3b')]=qs[_0xd4e7('0x31')](_[_0xd4e7('0x3c')](_0x5f101b[_0xd4e7('0x2f')],_0x5c0196[_0xd4e7('0x31')]),_0x160c2c);if(_0x5f101b[_0xd4e7('0x2f')][_0xd4e7('0x3d')]){_0x13a577[_0xd4e7('0x3b')]=_[_0xd4e7('0x3e')](_0x13a577[_0xd4e7('0x3b')],{'$or':_['map'](_0x160c2c,function(_0x235f53){if(_0x235f53['type']!==_0xd4e7('0x3f')){var _0x52100c={};_0x52100c[_0x235f53[_0xd4e7('0x27')]]={'$like':'%'+_0x5f101b[_0xd4e7('0x2f')]['filter']+'%'};return _0x52100c;}})});}_0x13a577=_[_0xd4e7('0x3e')]({},_0x13a577,_0x5f101b[_0xd4e7('0x40')]);var _0x2320eb={'where':_0x13a577[_0xd4e7('0x3b')]};return db[_0xd4e7('0x2b')][_0xd4e7('0x1b')](_0x2320eb)[_0xd4e7('0x21')](function(_0x6b4199){_0x49e690[_0xd4e7('0x1b')]=_0x6b4199;if(_0x5f101b[_0xd4e7('0x2f')]['includeAll']){_0x13a577['include']=[{'all':!![]}];}return db[_0xd4e7('0x2b')][_0xd4e7('0x41')](_0x13a577);})[_0xd4e7('0x21')](function(_0x4cae86){_0x49e690[_0xd4e7('0x42')]=_0x4cae86;return _0x49e690;})[_0xd4e7('0x21')](respondWithFilteredResult(_0x3c9794,_0x13a577))[_0xd4e7('0x43')](handleError(_0x3c9794,null));};exports[_0xd4e7('0x44')]=function(_0x5e0ccd,_0x428d46){var _0x10d23e={'raw':!![],'where':{'id':_0x5e0ccd[_0xd4e7('0x45')]['id']}},_0x113087={};_0x113087['model']=_[_0xd4e7('0x30')](db['Sound'][_0xd4e7('0x2c')]);_0x113087['query']=_[_0xd4e7('0x30')](_0x5e0ccd[_0xd4e7('0x2f')]);_0x113087[_0xd4e7('0x31')]=_['intersection'](_0x113087[_0xd4e7('0x33')],_0x113087[_0xd4e7('0x2f')]);_0x10d23e[_0xd4e7('0x34')]=_[_0xd4e7('0x32')](_0x113087[_0xd4e7('0x33')],qs[_0xd4e7('0x35')](_0x5e0ccd['query'][_0xd4e7('0x35')]));_0x10d23e[_0xd4e7('0x34')]=_0x10d23e[_0xd4e7('0x34')][_0xd4e7('0x36')]?_0x10d23e[_0xd4e7('0x34')]:_0x113087[_0xd4e7('0x33')];if(_0x5e0ccd[_0xd4e7('0x2f')][_0xd4e7('0x46')]){_0x10d23e[_0xd4e7('0x47')]=[{'all':!![]}];}_0x10d23e=_[_0xd4e7('0x3e')]({},_0x10d23e,_0x5e0ccd['options']);return db[_0xd4e7('0x2b')]['find'](_0x10d23e)[_0xd4e7('0x21')](handleEntityNotFound(_0x428d46,null))[_0xd4e7('0x21')](respondWithResult(_0x428d46,null))[_0xd4e7('0x43')](handleError(_0x428d46,null));};exports[_0xd4e7('0x48')]=function(_0x275978,_0x16a44e,_0xb6f750){return db[_0xd4e7('0x2b')][_0xd4e7('0x49')]({'where':{'id':_0x275978[_0xd4e7('0x45')]['id']},'attributes':[_0xd4e7('0x27'),_0xd4e7('0x4a'),_0xd4e7('0x4b')],'raw':!![]})[_0xd4e7('0x21')](handleEntityNotFound(_0x16a44e,null))[_0xd4e7('0x21')](function(_0x4d843c){if(_0x4d843c){if(!fs['existsSync'](path[_0xd4e7('0x4c')](config[_0xd4e7('0x4d')],_0xd4e7('0x4e'),_0x4d843c[_0xd4e7('0x4a')]+'.'+_0x4d843c[_0xd4e7('0x4b')]))){throw new db[(_0xd4e7('0x4f'))]['ValidationError'](_0xd4e7('0x50'));}return _0x16a44e[_0xd4e7('0x48')](path['join'](config['root'],_0xd4e7('0x4e'),util['format']('%s.%s',_0x4d843c[_0xd4e7('0x4a')],_0x4d843c['converted_format'])),util[_0xd4e7('0x51')](_0xd4e7('0x52'),_0x4d843c[_0xd4e7('0x27')],_0x4d843c[_0xd4e7('0x4b')]));}return null;})[_0xd4e7('0x43')](handleError(_0x16a44e,null));};exports[_0xd4e7('0x53')]=function(_0x21709c,_0x32717f,_0x14ab42){var _0x5ca740={'name':path[_0xd4e7('0x54')](_0x21709c[_0xd4e7('0x55')]['originalname'],path[_0xd4e7('0x56')](_0x21709c[_0xd4e7('0x55')][_0xd4e7('0x57')])),'save_name':path['basename'](_0x21709c[_0xd4e7('0x55')][_0xd4e7('0x58')],path[_0xd4e7('0x56')](_0x21709c[_0xd4e7('0x55')]['filename'])),'original_format':path[_0xd4e7('0x56')](_0x21709c[_0xd4e7('0x55')][_0xd4e7('0x57')])['substring'](0x1),'converted_format':_0xd4e7('0x59')};var _0x30f0d7=path['join'](config[_0xd4e7('0x4d')],_0xd4e7('0x5a'),_0x21709c[_0xd4e7('0x55')][_0xd4e7('0x58')]);var _0x427296=path['join'](config[_0xd4e7('0x4d')],_0xd4e7('0x4e'),util[_0xd4e7('0x51')](_0xd4e7('0x52'),path[_0xd4e7('0x54')](_0x21709c[_0xd4e7('0x55')][_0xd4e7('0x58')],path[_0xd4e7('0x56')](_0x21709c[_0xd4e7('0x55')]['filename'])),_0x5ca740[_0xd4e7('0x4b')]));logger['info'](_0xd4e7('0x5b'),_0x30f0d7);logger[_0xd4e7('0x5c')](_0xd4e7('0x5d'),_0x427296);try{fs['chmodSync'](_0x30f0d7,parseInt(_0xd4e7('0x5e'),0x8));var _0x4161ea=sox[_0xd4e7('0x5f')](_0x30f0d7,_0x427296,{'sampleRate':0x1f40,'format':_0xd4e7('0x59'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x4161ea['on'](_0xd4e7('0x60'),function(_0x52e723){fs[_0xd4e7('0x61')](_0x30f0d7);_0x32717f['status'](0x1f4)[_0xd4e7('0x28')](_0x52e723);});_0x4161ea['on']('src',function(_0x3de756){_0x5ca740['original_duration']=isNaN(_0x3de756[_0xd4e7('0x62')])?null:_0x3de756[_0xd4e7('0x62')]*0x3e8;_0x5ca740[_0xd4e7('0x63')]=isNaN(_0x3de756['sampleCount'])?null:_0x3de756[_0xd4e7('0x64')];_0x5ca740['original_channelCount']=isNaN(_0x3de756[_0xd4e7('0x65')])?null:_0x3de756[_0xd4e7('0x65')];_0x5ca740[_0xd4e7('0x66')]=isNaN(_0x3de756[_0xd4e7('0x67')])?null:_0x3de756['bitRate'];_0x5ca740[_0xd4e7('0x68')]=isNaN(_0x3de756['sampleRate'])?null:_0x3de756[_0xd4e7('0x69')];});_0x4161ea['on'](_0xd4e7('0x6a'),function(_0x74c017){_0x5ca740[_0xd4e7('0x6b')]=isNaN(_0x74c017[_0xd4e7('0x62')])?null:_0x74c017[_0xd4e7('0x62')]*0x3e8;_0x5ca740[_0xd4e7('0x6c')]=isNaN(_0x74c017[_0xd4e7('0x64')])?null:_0x74c017[_0xd4e7('0x64')];_0x5ca740[_0xd4e7('0x6d')]=isNaN(_0x74c017[_0xd4e7('0x65')])?null:_0x74c017['channelCount'];_0x5ca740[_0xd4e7('0x6e')]=isNaN(_0x74c017['bitRate'])?null:_0x74c017[_0xd4e7('0x67')];_0x5ca740[_0xd4e7('0x6f')]=isNaN(_0x74c017[_0xd4e7('0x69')])?null:_0x74c017[_0xd4e7('0x69')];});_0x4161ea['on'](_0xd4e7('0x16'),function(){fs['chmodSync'](_0x427296,parseInt(_0xd4e7('0x5e'),0x8));return db[_0xd4e7('0x2b')]['create'](_0x5ca740)[_0xd4e7('0x21')](function(_0x503c8b){var _0x38f627={'role':_0x21709c[_0xd4e7('0x70')][_0xd4e7('0x71')],'userProfileId':_0x21709c[_0xd4e7('0x70')][_0xd4e7('0x72')]};if(!_0x38f627)throw new Error(_0xd4e7('0x73'));if(_0x38f627['role']==='user'){var _0x14537e=_0x503c8b[_0xd4e7('0x23')]({'plain':!![]});return db[_0xd4e7('0x74')][_0xd4e7('0x49')]({'where':{'name':_0xd4e7('0x24'),'userProfileId':_0x38f627['userProfileId']},'raw':!![]})['then'](function(_0x1c93cc){if(_0x1c93cc&&_0x1c93cc[_0xd4e7('0x75')]===0x0){return db[_0xd4e7('0x25')][_0xd4e7('0x53')]({'name':_0x14537e[_0xd4e7('0x27')],'resourceId':_0x14537e['id'],'type':_0x1c93cc['name'],'sectionId':_0x1c93cc['id']},{})[_0xd4e7('0x21')](function(){return _0x503c8b;});}else{return _0x503c8b;}})[_0xd4e7('0x43')](function(_0x18eec0){logger[_0xd4e7('0x60')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x18eec0);throw _0x18eec0;});}return _0x503c8b;})[_0xd4e7('0x21')](respondWithResult(_0x32717f,null))[_0xd4e7('0x43')](handleError(_0x32717f,null));});_0x4161ea[_0xd4e7('0x76')]();}catch(_0x24efd4){_0x32717f[_0xd4e7('0x1c')](0x1f4)[_0xd4e7('0x28')](_0x24efd4);}};exports[_0xd4e7('0x20')]=function(_0x44ceb2,_0x34dc5a,_0x2bd093){return db[_0xd4e7('0x2b')][_0xd4e7('0x49')]({'where':{'id':_0x44ceb2['params']['id']}})['then'](handleEntityNotFound(_0x34dc5a,null))['then'](saveUpdates(_[_0xd4e7('0x3c')](_0x44ceb2[_0xd4e7('0x70')],[_0xd4e7('0x27'),_0xd4e7('0x77')]),null))[_0xd4e7('0x21')](respondWithResult(_0x34dc5a,null))['catch'](handleError(_0x34dc5a,null));};exports[_0xd4e7('0x78')]=function(_0x4a1520,_0x27de74,_0x33bf9d){return db[_0xd4e7('0x2b')][_0xd4e7('0x49')]({'where':{'id':_0x4a1520['params']['id']}})[_0xd4e7('0x21')](function(_0x4257c7){if(_0x4257c7){return _0x4257c7[_0xd4e7('0x22')]();}})[_0xd4e7('0x21')](function(_0x56d073){var _0x20fb8=path[_0xd4e7('0x4c')](config[_0xd4e7('0x4d')],_0xd4e7('0x5a'),util[_0xd4e7('0x51')](_0xd4e7('0x52'),_0x56d073['save_name'],_0x56d073[_0xd4e7('0x79')]));var _0x1f92fb=path['join'](config[_0xd4e7('0x4d')],'server/files/sounds/converted',util[_0xd4e7('0x51')](_0xd4e7('0x52'),_0x56d073[_0xd4e7('0x4a')],_0x56d073[_0xd4e7('0x4b')]));fs[_0xd4e7('0x61')](_0x20fb8);fs[_0xd4e7('0x61')](_0x1f92fb);return _0x56d073;})[_0xd4e7('0x21')](function(_0xf761c2){if(_0xf761c2){return _0x27de74[_0xd4e7('0x1c')](0xcc)[_0xd4e7('0x16')]();}})[_0xd4e7('0x21')](handleEntityNotFound(_0x27de74,null))[_0xd4e7('0x43')](handleError(_0x27de74,null));}; \ No newline at end of file +var _0xb639=['fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','Sounds','UserProfileResource','name','send','Sound','rawAttributes','fieldName','type','map','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','pick','filter','merge','where','includeAll','include','findAll','catch','show','params','keys','options','find','converted_format','root','save_name','Sequelize','ValidationError','download','join','server/files/sounds/converted','format','%s.%s','create','basename','file','originalname','extname','wav','server/files/sounds/original','filename','Sound\x20upload\x20filepath:\x20%s','info','Sound\x20upload\x20destination:\x20%s','chmodSync','0777','transcode','error','unlinkSync','src','original_duration','duration','sampleCount','original_channelCount','channelCount','original_bitRate','bitRate','original_sampleRate','sampleRate','dest','converted_duration','converted_sampleCount','converted_bitRate','converted_sampleRate','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','get','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','description','delete','original_format','eml-format','rimraf','zip-dir'];(function(_0x1ccdf7,_0x215d5a){var _0x52a0ae=function(_0x40324a){while(--_0x40324a){_0x1ccdf7['push'](_0x1ccdf7['shift']());}};_0x52a0ae(++_0x215d5a);}(_0xb639,0x17a));var _0x9b63=function(_0x3accdb,_0x187888){_0x3accdb=_0x3accdb-0x0;var _0x4dab57=_0xb639[_0x3accdb];return _0x4dab57;};'use strict';var emlformat=require(_0x9b63('0x0'));var rimraf=require(_0x9b63('0x1'));var zipdir=require(_0x9b63('0x2'));var jsonpatch=require(_0x9b63('0x3'));var rp=require('request-promise');var moment=require(_0x9b63('0x4'));var BPromise=require(_0x9b63('0x5'));var Mustache=require(_0x9b63('0x6'));var util=require(_0x9b63('0x7'));var path=require(_0x9b63('0x8'));var sox=require('sox');var csv=require(_0x9b63('0x9'));var ejs=require(_0x9b63('0xa'));var fs=require('fs');var fs_extra=require(_0x9b63('0xb'));var _=require(_0x9b63('0xc'));var squel=require(_0x9b63('0xd'));var crypto=require(_0x9b63('0xe'));var jsforce=require(_0x9b63('0xf'));var deskjs=require(_0x9b63('0x10'));var toCsv=require('to-csv');var querystring=require(_0x9b63('0x11'));var Papa=require(_0x9b63('0x12'));var Redis=require(_0x9b63('0x13'));var authService=require(_0x9b63('0x14'));var qs=require(_0x9b63('0x15'));var as=require(_0x9b63('0x16'));var hardwareService=require(_0x9b63('0x17'));var logger=require(_0x9b63('0x18'))(_0x9b63('0x19'));var utils=require(_0x9b63('0x1a'));var config=require(_0x9b63('0x1b'));var licenseUtil=require('../../config/license/util');var db=require(_0x9b63('0x1c'))['db'];function respondWithStatusCode(_0x5a4a41,_0x2e9080){_0x2e9080=_0x2e9080||0xcc;return function(_0x483804){if(_0x483804){return _0x5a4a41[_0x9b63('0x1d')](_0x2e9080);}return _0x5a4a41[_0x9b63('0x1e')](_0x2e9080)[_0x9b63('0x1f')]();};}function respondWithResult(_0x3692d2,_0x1d399e){_0x1d399e=_0x1d399e||0xc8;return function(_0x75958c){if(_0x75958c){return _0x3692d2[_0x9b63('0x1e')](_0x1d399e)[_0x9b63('0x20')](_0x75958c);}};}function respondWithFilteredResult(_0x3a236d,_0x80c9b3){return function(_0x261287){if(_0x261287){var _0x6643cc=typeof _0x80c9b3[_0x9b63('0x21')]===_0x9b63('0x22')&&typeof _0x80c9b3[_0x9b63('0x23')]===_0x9b63('0x22');var _0x1f00b4=_0x261287[_0x9b63('0x24')];var _0x4aa835=_0x6643cc?0x0:_0x80c9b3[_0x9b63('0x21')];var _0x339235=_0x6643cc?_0x261287['count']:_0x80c9b3[_0x9b63('0x21')]+_0x80c9b3[_0x9b63('0x23')];var _0x3ccdef;if(_0x339235>=_0x1f00b4){_0x339235=_0x1f00b4;_0x3ccdef=0xc8;}else{_0x3ccdef=0xce;}_0x3a236d[_0x9b63('0x1e')](_0x3ccdef);return _0x3a236d[_0x9b63('0x25')]('Content-Range',_0x4aa835+'-'+_0x339235+'/'+_0x1f00b4)[_0x9b63('0x20')](_0x261287);}return null;};}function patchUpdates(_0x2a9d32){return function(_0x242479){try{jsonpatch[_0x9b63('0x26')](_0x242479,_0x2a9d32,!![]);}catch(_0x2bdc52){return BPromise[_0x9b63('0x27')](_0x2bdc52);}return _0x242479[_0x9b63('0x28')]();};}function saveUpdates(_0x1ef50e,_0x17c93b){return function(_0x13f49d){if(_0x13f49d){return _0x13f49d[_0x9b63('0x29')](_0x1ef50e)[_0x9b63('0x2a')](function(_0x5e7d76){return _0x5e7d76;});}return null;};}function removeEntity(_0x482f5e,_0x224f63){return function(_0x117574){if(_0x117574){return _0x117574[_0x9b63('0x2b')]()[_0x9b63('0x2a')](function(){var _0x54da2c=_0x117574['get']({'plain':!![]});var _0x34adb8=_0x9b63('0x2c');return db[_0x9b63('0x2d')][_0x9b63('0x2b')]({'where':{'type':_0x34adb8,'resourceId':_0x54da2c['id']}})[_0x9b63('0x2a')](function(){return _0x117574;});})[_0x9b63('0x2a')](function(){_0x482f5e['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3fcb9c,_0x45a3fc){return function(_0x2a6524){if(!_0x2a6524){_0x3fcb9c[_0x9b63('0x1d')](0x194);}return _0x2a6524;};}function handleError(_0x6bbc5a,_0x2e8e37){_0x2e8e37=_0x2e8e37||0x1f4;return function(_0x112f25){logger['error'](_0x112f25['stack']);if(_0x112f25['name']){delete _0x112f25[_0x9b63('0x2e')];}_0x6bbc5a[_0x9b63('0x1e')](_0x2e8e37)[_0x9b63('0x2f')](_0x112f25);};}exports['index']=function(_0x561816,_0xbd2532){var _0x57ce10={},_0x5c39e7={},_0x46d031={'count':0x0,'rows':[]};var _0x551089=_['map'](db[_0x9b63('0x30')][_0x9b63('0x31')],function(_0x3498a5){return{'name':_0x3498a5[_0x9b63('0x32')],'type':_0x3498a5[_0x9b63('0x33')]['key']};});_0x5c39e7['model']=_[_0x9b63('0x34')](_0x551089,_0x9b63('0x2e'));_0x5c39e7[_0x9b63('0x35')]=_['keys'](_0x561816['query']);_0x5c39e7[_0x9b63('0x36')]=_[_0x9b63('0x37')](_0x5c39e7[_0x9b63('0x38')],_0x5c39e7['query']);_0x57ce10[_0x9b63('0x39')]=_[_0x9b63('0x37')](_0x5c39e7[_0x9b63('0x38')],qs[_0x9b63('0x3a')](_0x561816[_0x9b63('0x35')]['fields']));_0x57ce10['attributes']=_0x57ce10[_0x9b63('0x39')][_0x9b63('0x3b')]?_0x57ce10[_0x9b63('0x39')]:_0x5c39e7[_0x9b63('0x38')];if(!_0x561816[_0x9b63('0x35')][_0x9b63('0x3c')](_0x9b63('0x3d'))){_0x57ce10[_0x9b63('0x23')]=qs[_0x9b63('0x23')](_0x561816[_0x9b63('0x35')][_0x9b63('0x23')]);_0x57ce10[_0x9b63('0x21')]=qs[_0x9b63('0x21')](_0x561816[_0x9b63('0x35')]['offset']);}_0x57ce10['order']=qs['sort'](_0x561816[_0x9b63('0x35')]['sort']);_0x57ce10['where']=qs[_0x9b63('0x36')](_[_0x9b63('0x3e')](_0x561816[_0x9b63('0x35')],_0x5c39e7[_0x9b63('0x36')]),_0x551089);if(_0x561816['query'][_0x9b63('0x3f')]){_0x57ce10['where']=_[_0x9b63('0x40')](_0x57ce10[_0x9b63('0x41')],{'$or':_[_0x9b63('0x34')](_0x551089,function(_0x1c1bc5){if(_0x1c1bc5['type']!=='VIRTUAL'){var _0x1ee941={};_0x1ee941[_0x1c1bc5[_0x9b63('0x2e')]]={'$like':'%'+_0x561816[_0x9b63('0x35')]['filter']+'%'};return _0x1ee941;}})});}_0x57ce10=_[_0x9b63('0x40')]({},_0x57ce10,_0x561816['options']);var _0x1ccb11={'where':_0x57ce10['where']};return db[_0x9b63('0x30')][_0x9b63('0x24')](_0x1ccb11)['then'](function(_0x418ecb){_0x46d031['count']=_0x418ecb;if(_0x561816[_0x9b63('0x35')][_0x9b63('0x42')]){_0x57ce10[_0x9b63('0x43')]=[{'all':!![]}];}return db[_0x9b63('0x30')][_0x9b63('0x44')](_0x57ce10);})[_0x9b63('0x2a')](function(_0x5170dd){_0x46d031['rows']=_0x5170dd;return _0x46d031;})['then'](respondWithFilteredResult(_0xbd2532,_0x57ce10))[_0x9b63('0x45')](handleError(_0xbd2532,null));};exports[_0x9b63('0x46')]=function(_0xd46d1b,_0x593d7d){var _0x302419={'raw':!![],'where':{'id':_0xd46d1b[_0x9b63('0x47')]['id']}},_0x3481e5={};_0x3481e5[_0x9b63('0x38')]=_[_0x9b63('0x48')](db['Sound']['rawAttributes']);_0x3481e5[_0x9b63('0x35')]=_[_0x9b63('0x48')](_0xd46d1b[_0x9b63('0x35')]);_0x3481e5[_0x9b63('0x36')]=_[_0x9b63('0x37')](_0x3481e5['model'],_0x3481e5[_0x9b63('0x35')]);_0x302419[_0x9b63('0x39')]=_[_0x9b63('0x37')](_0x3481e5['model'],qs['fields'](_0xd46d1b['query'][_0x9b63('0x3a')]));_0x302419['attributes']=_0x302419['attributes'][_0x9b63('0x3b')]?_0x302419['attributes']:_0x3481e5[_0x9b63('0x38')];if(_0xd46d1b[_0x9b63('0x35')]['includeAll']){_0x302419[_0x9b63('0x43')]=[{'all':!![]}];}_0x302419=_[_0x9b63('0x40')]({},_0x302419,_0xd46d1b[_0x9b63('0x49')]);return db[_0x9b63('0x30')]['find'](_0x302419)[_0x9b63('0x2a')](handleEntityNotFound(_0x593d7d,null))[_0x9b63('0x2a')](respondWithResult(_0x593d7d,null))[_0x9b63('0x45')](handleError(_0x593d7d,null));};exports['download']=function(_0x16cae0,_0x4025bb,_0x132a47){return db['Sound'][_0x9b63('0x4a')]({'where':{'id':_0x16cae0[_0x9b63('0x47')]['id']},'attributes':[_0x9b63('0x2e'),'save_name',_0x9b63('0x4b')],'raw':!![]})[_0x9b63('0x2a')](handleEntityNotFound(_0x4025bb,null))[_0x9b63('0x2a')](function(_0x3e1194){if(_0x3e1194){if(!fs['existsSync'](path['join'](config[_0x9b63('0x4c')],'server/files/sounds/converted',_0x3e1194[_0x9b63('0x4d')]+'.'+_0x3e1194[_0x9b63('0x4b')]))){throw new db[(_0x9b63('0x4e'))][(_0x9b63('0x4f'))]('Sound\x20not\x20found');}return _0x4025bb[_0x9b63('0x50')](path[_0x9b63('0x51')](config[_0x9b63('0x4c')],_0x9b63('0x52'),util[_0x9b63('0x53')](_0x9b63('0x54'),_0x3e1194[_0x9b63('0x4d')],_0x3e1194[_0x9b63('0x4b')])),util[_0x9b63('0x53')](_0x9b63('0x54'),_0x3e1194[_0x9b63('0x2e')],_0x3e1194['converted_format']));}return null;})[_0x9b63('0x45')](handleError(_0x4025bb,null));};exports[_0x9b63('0x55')]=function(_0x43982c,_0xe7ab8d,_0x5300a4){var _0x1e98c9={'name':path[_0x9b63('0x56')](_0x43982c[_0x9b63('0x57')][_0x9b63('0x58')],path['extname'](_0x43982c['file'][_0x9b63('0x58')])),'save_name':path[_0x9b63('0x56')](_0x43982c[_0x9b63('0x57')]['filename'],path[_0x9b63('0x59')](_0x43982c[_0x9b63('0x57')]['filename'])),'original_format':path[_0x9b63('0x59')](_0x43982c['file'][_0x9b63('0x58')])['substring'](0x1),'converted_format':_0x9b63('0x5a')};var _0x547250=path[_0x9b63('0x51')](config['root'],_0x9b63('0x5b'),_0x43982c[_0x9b63('0x57')]['filename']);var _0x25cf20=path[_0x9b63('0x51')](config[_0x9b63('0x4c')],'server/files/sounds/converted',util['format'](_0x9b63('0x54'),path['basename'](_0x43982c[_0x9b63('0x57')][_0x9b63('0x5c')],path['extname'](_0x43982c[_0x9b63('0x57')]['filename'])),_0x1e98c9[_0x9b63('0x4b')]));logger['info'](_0x9b63('0x5d'),_0x547250);logger[_0x9b63('0x5e')](_0x9b63('0x5f'),_0x25cf20);try{fs[_0x9b63('0x60')](_0x547250,parseInt(_0x9b63('0x61'),0x8));var _0x1f2896=sox[_0x9b63('0x62')](_0x547250,_0x25cf20,{'sampleRate':0x1f40,'format':_0x9b63('0x5a'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x1f2896['on'](_0x9b63('0x63'),function(_0x5ad897){fs[_0x9b63('0x64')](_0x547250);_0xe7ab8d['status'](0x1f4)[_0x9b63('0x2f')](_0x5ad897);});_0x1f2896['on'](_0x9b63('0x65'),function(_0x41b475){_0x1e98c9[_0x9b63('0x66')]=isNaN(_0x41b475[_0x9b63('0x67')])?null:_0x41b475[_0x9b63('0x67')]*0x3e8;_0x1e98c9['original_sampleCount']=isNaN(_0x41b475[_0x9b63('0x68')])?null:_0x41b475['sampleCount'];_0x1e98c9[_0x9b63('0x69')]=isNaN(_0x41b475[_0x9b63('0x6a')])?null:_0x41b475['channelCount'];_0x1e98c9[_0x9b63('0x6b')]=isNaN(_0x41b475['bitRate'])?null:_0x41b475[_0x9b63('0x6c')];_0x1e98c9[_0x9b63('0x6d')]=isNaN(_0x41b475[_0x9b63('0x6e')])?null:_0x41b475[_0x9b63('0x6e')];});_0x1f2896['on'](_0x9b63('0x6f'),function(_0x59bf14){_0x1e98c9[_0x9b63('0x70')]=isNaN(_0x59bf14[_0x9b63('0x67')])?null:_0x59bf14[_0x9b63('0x67')]*0x3e8;_0x1e98c9[_0x9b63('0x71')]=isNaN(_0x59bf14[_0x9b63('0x68')])?null:_0x59bf14['sampleCount'];_0x1e98c9['converted_channelCount']=isNaN(_0x59bf14['channelCount'])?null:_0x59bf14[_0x9b63('0x6a')];_0x1e98c9[_0x9b63('0x72')]=isNaN(_0x59bf14[_0x9b63('0x6c')])?null:_0x59bf14[_0x9b63('0x6c')];_0x1e98c9[_0x9b63('0x73')]=isNaN(_0x59bf14[_0x9b63('0x6e')])?null:_0x59bf14['sampleRate'];});_0x1f2896['on'](_0x9b63('0x1f'),function(){fs[_0x9b63('0x60')](_0x25cf20,parseInt('0777',0x8));return db[_0x9b63('0x30')][_0x9b63('0x55')](_0x1e98c9)[_0x9b63('0x2a')](function(_0x176293){var _0x506143={'role':_0x43982c[_0x9b63('0x74')]['role'],'userProfileId':_0x43982c[_0x9b63('0x74')]['userProfileId']};if(!_0x506143)throw new Error(_0x9b63('0x75'));if(_0x506143[_0x9b63('0x76')]===_0x9b63('0x77')){var _0x11ee7b=_0x176293[_0x9b63('0x78')]({'plain':!![]});return db[_0x9b63('0x79')][_0x9b63('0x4a')]({'where':{'name':_0x9b63('0x2c'),'userProfileId':_0x506143['userProfileId']},'raw':!![]})[_0x9b63('0x2a')](function(_0x25a016){if(_0x25a016&&_0x25a016[_0x9b63('0x7a')]===0x0){return db[_0x9b63('0x2d')][_0x9b63('0x55')]({'name':_0x11ee7b[_0x9b63('0x2e')],'resourceId':_0x11ee7b['id'],'type':_0x25a016['name'],'sectionId':_0x25a016['id']},{})[_0x9b63('0x2a')](function(){return _0x176293;});}else{return _0x176293;}})['catch'](function(_0x1cf5f2){logger[_0x9b63('0x63')](_0x9b63('0x7b'),_0x1cf5f2);throw _0x1cf5f2;});}return _0x176293;})['then'](respondWithResult(_0xe7ab8d,null))['catch'](handleError(_0xe7ab8d,null));});_0x1f2896['start']();}catch(_0x329f8b){_0xe7ab8d[_0x9b63('0x1e')](0x1f4)[_0x9b63('0x2f')](_0x329f8b);}};exports[_0x9b63('0x29')]=function(_0x4b136e,_0x380be1,_0x4d4c8a){return db['Sound'][_0x9b63('0x4a')]({'where':{'id':_0x4b136e[_0x9b63('0x47')]['id']}})[_0x9b63('0x2a')](handleEntityNotFound(_0x380be1,null))[_0x9b63('0x2a')](saveUpdates(_[_0x9b63('0x3e')](_0x4b136e[_0x9b63('0x74')],[_0x9b63('0x2e'),_0x9b63('0x7c')]),null))[_0x9b63('0x2a')](respondWithResult(_0x380be1,null))['catch'](handleError(_0x380be1,null));};exports[_0x9b63('0x7d')]=function(_0x15b913,_0x283abb,_0x1ccd0c){return db[_0x9b63('0x30')][_0x9b63('0x4a')]({'where':{'id':_0x15b913[_0x9b63('0x47')]['id']}})[_0x9b63('0x2a')](function(_0x24277f){if(_0x24277f){return _0x24277f[_0x9b63('0x2b')]();}})['then'](function(_0x41a85a){var _0x17451c=path[_0x9b63('0x51')](config[_0x9b63('0x4c')],_0x9b63('0x5b'),util[_0x9b63('0x53')](_0x9b63('0x54'),_0x41a85a['save_name'],_0x41a85a[_0x9b63('0x7e')]));var _0x3ed163=path[_0x9b63('0x51')](config['root'],_0x9b63('0x52'),util['format'](_0x9b63('0x54'),_0x41a85a[_0x9b63('0x4d')],_0x41a85a[_0x9b63('0x4b')]));fs['unlinkSync'](_0x17451c);fs[_0x9b63('0x64')](_0x3ed163);return _0x41a85a;})['then'](function(_0x1043cc){if(_0x1043cc){return _0x283abb[_0x9b63('0x1e')](0xcc)[_0x9b63('0x1f')]();}})[_0x9b63('0x2a')](handleEntityNotFound(_0x283abb,null))[_0x9b63('0x45')](handleError(_0x283abb,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index e732276..e74d63a 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 _0x1e50=['../../config/environment','./sound.attributes','define','Sound','tools_sounds','lodash','util','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x5d41a6,_0x2be904){var _0x3b7778=function(_0x50255e){while(--_0x50255e){_0x5d41a6['push'](_0x5d41a6['shift']());}};_0x3b7778(++_0x2be904);}(_0x1e50,0x1e6));var _0x01e5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1e50[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x01e5('0x0'));var util=require(_0x01e5('0x1'));var logger=require('../../config/logger')(_0x01e5('0x2'));var moment=require(_0x01e5('0x3'));var BPromise=require(_0x01e5('0x4'));var rp=require(_0x01e5('0x5'));var fs=require('fs');var path=require(_0x01e5('0x6'));var rimraf=require(_0x01e5('0x7'));var config=require(_0x01e5('0x8'));var attributes=require(_0x01e5('0x9'));module['exports']=function(_0x414cf6,_0x9039c3){return _0x414cf6[_0x01e5('0xa')](_0x01e5('0xb'),attributes,{'tableName':_0x01e5('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8558=['api','bluebird','request-promise','rimraf','../../config/environment','exports','Sound','tools_sounds','lodash','util','../../config/logger'];(function(_0x5f0f7a,_0x244c53){var _0x8742e7=function(_0x48ff6e){while(--_0x48ff6e){_0x5f0f7a['push'](_0x5f0f7a['shift']());}};_0x8742e7(++_0x244c53);}(_0x8558,0x110));var _0x8855=function(_0x46da05,_0x197480){_0x46da05=_0x46da05-0x0;var _0x2333f4=_0x8558[_0x46da05];return _0x2333f4;};'use strict';var _=require(_0x8855('0x0'));var util=require(_0x8855('0x1'));var logger=require(_0x8855('0x2'))(_0x8855('0x3'));var moment=require('moment');var BPromise=require(_0x8855('0x4'));var rp=require(_0x8855('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8855('0x6'));var config=require(_0x8855('0x7'));var attributes=require('./sound.attributes');module[_0x8855('0x8')]=function(_0x257f97,_0x249dac){return _0x257f97['define'](_0x8855('0x9'),attributes,{'tableName':_0x8855('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/sound/sound.rpc.js b/server/api/sound/sound.rpc.js index 7cb390c..7e7f615 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 _0xfb63=['map','model','attributes','include','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','client','http','request','then','info','Sound,\x20%s,\x20%s','request\x20sent','debug','Sound,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','ShowSound','Sound','options','raw','where'];(function(_0xf24102,_0x55775e){var _0x831a7c=function(_0x3a69cc){while(--_0x3a69cc){_0xf24102['push'](_0xf24102['shift']());}};_0x831a7c(++_0x55775e);}(_0xfb63,0xaa));var _0x3fb6=function(_0x49d6a9,_0x29ad9e){_0x49d6a9=_0x49d6a9-0x0;var _0x57356b=_0xfb63[_0x49d6a9];return _0x57356b;};'use strict';var _=require(_0x3fb6('0x0'));var util=require(_0x3fb6('0x1'));var moment=require(_0x3fb6('0x2'));var BPromise=require(_0x3fb6('0x3'));var rs=require(_0x3fb6('0x4'));var fs=require('fs');var Redis=require(_0x3fb6('0x5'));var db=require(_0x3fb6('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x3fb6('0x7'))('rpc');var config=require(_0x3fb6('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x3fb6('0x9')][_0x3fb6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x487006,_0x5adbf4,_0x14cacc){return new BPromise(function(_0x3068d9,_0x24458f){return client[_0x3fb6('0xb')](_0x487006,_0x14cacc)[_0x3fb6('0xc')](function(_0x59fb3b){logger[_0x3fb6('0xd')](_0x3fb6('0xe'),_0x5adbf4,_0x3fb6('0xf'));logger[_0x3fb6('0x10')](_0x3fb6('0x11'),_0x5adbf4,_0x3fb6('0xf'),JSON['stringify'](_0x59fb3b));if(_0x59fb3b[_0x3fb6('0x12')]){if(_0x59fb3b[_0x3fb6('0x12')][_0x3fb6('0x13')]===0x1f4){logger[_0x3fb6('0x12')](_0x3fb6('0xe'),_0x5adbf4,_0x59fb3b[_0x3fb6('0x12')][_0x3fb6('0x14')]);return _0x24458f(_0x59fb3b[_0x3fb6('0x12')]['message']);}logger[_0x3fb6('0x12')](_0x3fb6('0xe'),_0x5adbf4,_0x59fb3b[_0x3fb6('0x12')][_0x3fb6('0x14')]);return _0x3068d9(_0x59fb3b[_0x3fb6('0x12')]['message']);}else{logger[_0x3fb6('0xd')](_0x3fb6('0xe'),_0x5adbf4,_0x3fb6('0xf'));_0x3068d9(_0x59fb3b[_0x3fb6('0x15')][_0x3fb6('0x14')]);}})[_0x3fb6('0x16')](function(_0x36c472){logger[_0x3fb6('0x12')](_0x3fb6('0xe'),_0x5adbf4,_0x36c472);_0x24458f(_0x36c472);});});}exports[_0x3fb6('0x17')]=function(_0x241dd8){var _0x2cf94a=this;return new Promise(function(_0x38ad76,_0x29a264){return db[_0x3fb6('0x18')]['find']({'raw':_0x241dd8[_0x3fb6('0x19')]?_0x241dd8[_0x3fb6('0x19')][_0x3fb6('0x1a')]===undefined?!![]:![]:!![],'where':_0x241dd8[_0x3fb6('0x19')]?_0x241dd8['options'][_0x3fb6('0x1b')]||null:null,'attributes':_0x241dd8[_0x3fb6('0x19')]?_0x241dd8['options']['attributes']||null:null,'include':_0x241dd8[_0x3fb6('0x19')]?_0x241dd8[_0x3fb6('0x19')]['include']?_[_0x3fb6('0x1c')](_0x241dd8['options']['include'],function(_0x3458f2){return{'model':db[_0x3458f2[_0x3fb6('0x1d')]],'as':_0x3458f2['as'],'attributes':_0x3458f2[_0x3fb6('0x1e')],'include':_0x3458f2['include']?_[_0x3fb6('0x1c')](_0x3458f2[_0x3fb6('0x1f')],function(_0x40da1b){return{'model':db[_0x40da1b['model']],'as':_0x40da1b['as'],'attributes':_0x40da1b[_0x3fb6('0x1e')],'include':_0x40da1b[_0x3fb6('0x1f')]?_['map'](_0x40da1b['include'],function(_0x5dc374){return{'model':db[_0x5dc374[_0x3fb6('0x1d')]],'as':_0x5dc374['as'],'attributes':_0x5dc374[_0x3fb6('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x3fb6('0xc')](function(_0x238484){logger[_0x3fb6('0xd')]('ShowSound',_0x241dd8);logger[_0x3fb6('0x10')](_0x3fb6('0x17'),_0x241dd8,JSON[_0x3fb6('0x20')](_0x238484));_0x38ad76(_0x238484);})[_0x3fb6('0x16')](function(_0x1ef996){logger[_0x3fb6('0x12')](_0x3fb6('0x17'),_0x1ef996[_0x3fb6('0x14')],_0x241dd8);_0x29a264(_0x2cf94a[_0x3fb6('0x12')](0x1f4,_0x1ef996['message']));});});}; \ No newline at end of file +var _0xf223=['../../config/utils','rpc','jayson/promise','request','then','info','Sound,\x20%s,\x20%s','request\x20sent','debug','Sound,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ShowSound','Sound','options','attributes','include','map','model','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x52e68e,_0x309912){var _0x3211a4=function(_0x467c01){while(--_0x467c01){_0x52e68e['push'](_0x52e68e['shift']());}};_0x3211a4(++_0x309912);}(_0xf223,0x19d));var _0x3f22=function(_0x4446e3,_0x2ae79b){_0x4446e3=_0x4446e3-0x0;var _0x1e8ce6=_0xf223[_0x4446e3];return _0x1e8ce6;};'use strict';var _=require(_0x3f22('0x0'));var util=require(_0x3f22('0x1'));var moment=require(_0x3f22('0x2'));var BPromise=require(_0x3f22('0x3'));var rs=require(_0x3f22('0x4'));var fs=require('fs');var Redis=require(_0x3f22('0x5'));var db=require(_0x3f22('0x6'))['db'];var utils=require(_0x3f22('0x7'));var logger=require('../../config/logger')(_0x3f22('0x8'));var config=require('../../config/environment');var jayson=require(_0x3f22('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x562aea,_0x12b0e9,_0x36ad84){return new BPromise(function(_0x3f546e,_0x1a7481){return client[_0x3f22('0xa')](_0x562aea,_0x36ad84)[_0x3f22('0xb')](function(_0x4f8d7e){logger[_0x3f22('0xc')](_0x3f22('0xd'),_0x12b0e9,_0x3f22('0xe'));logger[_0x3f22('0xf')](_0x3f22('0x10'),_0x12b0e9,_0x3f22('0xe'),JSON[_0x3f22('0x11')](_0x4f8d7e));if(_0x4f8d7e[_0x3f22('0x12')]){if(_0x4f8d7e[_0x3f22('0x12')][_0x3f22('0x13')]===0x1f4){logger[_0x3f22('0x12')]('Sound,\x20%s,\x20%s',_0x12b0e9,_0x4f8d7e['error']['message']);return _0x1a7481(_0x4f8d7e[_0x3f22('0x12')][_0x3f22('0x14')]);}logger['error']('Sound,\x20%s,\x20%s',_0x12b0e9,_0x4f8d7e['error']['message']);return _0x3f546e(_0x4f8d7e[_0x3f22('0x12')]['message']);}else{logger[_0x3f22('0xc')](_0x3f22('0xd'),_0x12b0e9,_0x3f22('0xe'));_0x3f546e(_0x4f8d7e[_0x3f22('0x15')][_0x3f22('0x14')]);}})[_0x3f22('0x16')](function(_0x98b12e){logger[_0x3f22('0x12')](_0x3f22('0xd'),_0x12b0e9,_0x98b12e);_0x1a7481(_0x98b12e);});});}exports[_0x3f22('0x17')]=function(_0x218e7f){var _0x1f2f94=this;return new Promise(function(_0x5ec6fc,_0x5859a9){return db[_0x3f22('0x18')]['find']({'raw':_0x218e7f[_0x3f22('0x19')]?_0x218e7f['options']['raw']===undefined?!![]:![]:!![],'where':_0x218e7f[_0x3f22('0x19')]?_0x218e7f['options']['where']||null:null,'attributes':_0x218e7f[_0x3f22('0x19')]?_0x218e7f[_0x3f22('0x19')][_0x3f22('0x1a')]||null:null,'include':_0x218e7f[_0x3f22('0x19')]?_0x218e7f['options'][_0x3f22('0x1b')]?_[_0x3f22('0x1c')](_0x218e7f[_0x3f22('0x19')][_0x3f22('0x1b')],function(_0x1885dc){return{'model':db[_0x1885dc[_0x3f22('0x1d')]],'as':_0x1885dc['as'],'attributes':_0x1885dc[_0x3f22('0x1a')],'include':_0x1885dc[_0x3f22('0x1b')]?_[_0x3f22('0x1c')](_0x1885dc[_0x3f22('0x1b')],function(_0x4b3800){return{'model':db[_0x4b3800[_0x3f22('0x1d')]],'as':_0x4b3800['as'],'attributes':_0x4b3800[_0x3f22('0x1a')],'include':_0x4b3800[_0x3f22('0x1b')]?_['map'](_0x4b3800[_0x3f22('0x1b')],function(_0x469c26){return{'model':db[_0x469c26['model']],'as':_0x469c26['as'],'attributes':_0x469c26['attributes']};}):[]};}):[]};}):[]:[]})[_0x3f22('0xb')](function(_0x4dff83){logger[_0x3f22('0xc')](_0x3f22('0x17'),_0x218e7f);logger[_0x3f22('0xf')]('ShowSound',_0x218e7f,JSON[_0x3f22('0x11')](_0x4dff83));_0x5ec6fc(_0x4dff83);})['catch'](function(_0x2124a4){logger['error'](_0x3f22('0x17'),_0x2124a4[_0x3f22('0x14')],_0x218e7f);_0x5859a9(_0x1f2f94[_0x3f22('0x12')](0x1f4,_0x2124a4[_0x3f22('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index 35d2e24..d5353ca 100644 --- a/server/api/squareMessage/index.js +++ b/server/api/squareMessage/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xda2d=['isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../config/environment','./squareMessage.controller','get'];(function(_0x907c3d,_0x1e8850){var _0x16684c=function(_0x1ee01b){while(--_0x1ee01b){_0x907c3d['push'](_0x907c3d['shift']());}};_0x16684c(++_0x1e8850);}(_0xda2d,0x102));var _0xdda2=function(_0x7342b6,_0x241654){_0x7342b6=_0x7342b6-0x0;var _0x17b056=_0xda2d[_0x7342b6];return _0x17b056;};'use strict';var multer=require('multer');var util=require(_0xdda2('0x0'));var path=require(_0xdda2('0x1'));var timeout=require(_0xdda2('0x2'));var express=require(_0xdda2('0x3'));var router=express[_0xdda2('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xdda2('0x5'));var controller=require(_0xdda2('0x6'));router[_0xdda2('0x7')]('/',auth[_0xdda2('0x8')](),controller[_0xdda2('0x9')]);router[_0xdda2('0x7')](_0xdda2('0xa'),auth[_0xdda2('0x8')](),controller[_0xdda2('0xb')]);router[_0xdda2('0xc')]('/',auth['isAuthenticated'](),controller[_0xdda2('0xd')]);router[_0xdda2('0xe')]('/:id',auth[_0xdda2('0x8')](),controller[_0xdda2('0xf')]);router[_0xdda2('0x10')](_0xdda2('0xa'),auth[_0xdda2('0x8')](),controller[_0xdda2('0x11')]);module[_0xdda2('0x12')]=router; \ No newline at end of file +var _0x2032=['exports','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./squareMessage.controller','get','isAuthenticated','index','/:id','show','post','put','update','delete'];(function(_0x582c98,_0x53b3a0){var _0x593449=function(_0x39834c){while(--_0x39834c){_0x582c98['push'](_0x582c98['shift']());}};_0x593449(++_0x53b3a0);}(_0x2032,0xd9));var _0x2203=function(_0x5c4e27,_0x1e37a3){_0x5c4e27=_0x5c4e27-0x0;var _0x1479b3=_0x2032[_0x5c4e27];return _0x1479b3;};'use strict';var multer=require('multer');var util=require(_0x2203('0x0'));var path=require(_0x2203('0x1'));var timeout=require(_0x2203('0x2'));var express=require('express');var router=express[_0x2203('0x3')]();var fs_extra=require(_0x2203('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x2203('0x5'));var config=require(_0x2203('0x6'));var controller=require(_0x2203('0x7'));router[_0x2203('0x8')]('/',auth[_0x2203('0x9')](),controller[_0x2203('0xa')]);router[_0x2203('0x8')](_0x2203('0xb'),auth[_0x2203('0x9')](),controller[_0x2203('0xc')]);router[_0x2203('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0x2203('0xe')]('/:id',auth[_0x2203('0x9')](),controller[_0x2203('0xf')]);router[_0x2203('0x10')]('/:id',auth[_0x2203('0x9')](),controller['destroy']);module[_0x2203('0x11')]=router; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.attributes.js b/server/api/squareMessage/squareMessage.attributes.js index 203684e..b2401b5 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 _0xa660=['exports','STRING','medium','ENUM','out','TEXT','sequelize'];(function(_0x142009,_0x302ec6){var _0x43454b=function(_0x2b4a20){while(--_0x2b4a20){_0x142009['push'](_0x142009['shift']());}};_0x43454b(++_0x302ec6);}(_0xa660,0x1c6));var _0x0a66=function(_0x10d56e,_0x5b499d){_0x10d56e=_0x10d56e-0x0;var _0x1fbdde=_0xa660[_0x10d56e];return _0x1fbdde;};'use strict';var Sequelize=require(_0x0a66('0x0'));module[_0x0a66('0x1')]={'uniqueid':{'type':Sequelize[_0x0a66('0x2')]},'body':{'type':Sequelize['TEXT'](_0x0a66('0x3')),'allowNull':![]},'direction':{'type':Sequelize[_0x0a66('0x4')]('in',_0x0a66('0x5')),'defaultValue':'out','allowNull':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0x0a66('0x6')]}}; \ No newline at end of file +var _0x6266=['STRING','TEXT','medium','ENUM','out','sequelize','exports'];(function(_0x143e87,_0x23d17f){var _0x3f9620=function(_0x1a8594){while(--_0x1a8594){_0x143e87['push'](_0x143e87['shift']());}};_0x3f9620(++_0x23d17f);}(_0x6266,0x9f));var _0x6626=function(_0x22674f,_0x3f5a25){_0x22674f=_0x22674f-0x0;var _0x17532a=_0x6266[_0x22674f];return _0x17532a;};'use strict';var Sequelize=require(_0x6626('0x0'));module[_0x6626('0x1')]={'uniqueid':{'type':Sequelize[_0x6626('0x2')]},'body':{'type':Sequelize[_0x6626('0x3')](_0x6626('0x4')),'allowNull':![]},'direction':{'type':Sequelize[_0x6626('0x5')]('in',_0x6626('0x6')),'defaultValue':_0x6626('0x6'),'allowNull':![]},'providerName':{'type':Sequelize[_0x6626('0x2')]},'providerResponse':{'type':Sequelize[_0x6626('0x3')]}}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.controller.js b/server/api/squareMessage/squareMessage.controller.js index 65cce7f..cdf3c2d 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 _0xa400=['model','fields','attributes','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','then','includeAll','include','SquareMessage','findAll','rows','catch','show','params','intersection','find','create','body','eml-format','request-promise','moment','bluebird','mustache','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','destroy','stack','name','index','map','rawAttributes','fieldName','type','key','query','keys','filters'];(function(_0x725b8e,_0xc22b48){var _0x43ac45=function(_0x46bb4a){while(--_0x46bb4a){_0x725b8e['push'](_0x725b8e['shift']());}};_0x43ac45(++_0xc22b48);}(_0xa400,0x1cf));var _0x0a40=function(_0x98fb33,_0x3e1219){_0x98fb33=_0x98fb33-0x0;var _0x3f8a0e=_0xa400[_0x98fb33];return _0x3f8a0e;};'use strict';var emlformat=require(_0x0a40('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a40('0x1'));var moment=require(_0x0a40('0x2'));var BPromise=require(_0x0a40('0x3'));var Mustache=require(_0x0a40('0x4'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x0a40('0x5'));var ejs=require(_0x0a40('0x6'));var fs=require('fs');var fs_extra=require(_0x0a40('0x7'));var _=require(_0x0a40('0x8'));var squel=require(_0x0a40('0x9'));var crypto=require(_0x0a40('0xa'));var jsforce=require(_0x0a40('0xb'));var deskjs=require(_0x0a40('0xc'));var toCsv=require(_0x0a40('0x5'));var querystring=require(_0x0a40('0xd'));var Papa=require(_0x0a40('0xe'));var Redis=require('ioredis');var authService=require(_0x0a40('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x0a40('0x10'));var hardwareService=require(_0x0a40('0x11'));var logger=require(_0x0a40('0x12'))(_0x0a40('0x13'));var utils=require(_0x0a40('0x14'));var config=require(_0x0a40('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x0a40('0x16'))['db'];function respondWithStatusCode(_0x9bb5a,_0x20312f){_0x20312f=_0x20312f||0xcc;return function(_0x26386f){if(_0x26386f){return _0x9bb5a[_0x0a40('0x17')](_0x20312f);}return _0x9bb5a[_0x0a40('0x18')](_0x20312f)[_0x0a40('0x19')]();};}function respondWithResult(_0x261342,_0x50fcee){_0x50fcee=_0x50fcee||0xc8;return function(_0x4fb0c1){if(_0x4fb0c1){return _0x261342[_0x0a40('0x18')](_0x50fcee)[_0x0a40('0x1a')](_0x4fb0c1);}};}function respondWithFilteredResult(_0x10de6d,_0x229136){return function(_0x547dd7){if(_0x547dd7){var _0x256289=typeof _0x229136[_0x0a40('0x1b')]===_0x0a40('0x1c')&&typeof _0x229136[_0x0a40('0x1d')]==='undefined';var _0xe9e2e1=_0x547dd7[_0x0a40('0x1e')];var _0x5ada4e=_0x256289?0x0:_0x229136['offset'];var _0x95dbbc=_0x256289?_0x547dd7[_0x0a40('0x1e')]:_0x229136[_0x0a40('0x1b')]+_0x229136[_0x0a40('0x1d')];var _0xc2e5af;if(_0x95dbbc>=_0xe9e2e1){_0x95dbbc=_0xe9e2e1;_0xc2e5af=0xc8;}else{_0xc2e5af=0xce;}_0x10de6d[_0x0a40('0x18')](_0xc2e5af);return _0x10de6d[_0x0a40('0x1f')](_0x0a40('0x20'),_0x5ada4e+'-'+_0x95dbbc+'/'+_0xe9e2e1)[_0x0a40('0x1a')](_0x547dd7);}return null;};}function patchUpdates(_0x2b0927){return function(_0x2e7c1f){try{jsonpatch[_0x0a40('0x21')](_0x2e7c1f,_0x2b0927,!![]);}catch(_0x11704e){return BPromise[_0x0a40('0x22')](_0x11704e);}return _0x2e7c1f['save']();};}function saveUpdates(_0x7ff4a9,_0x10e3cf){return function(_0x487045){if(_0x487045){return _0x487045[_0x0a40('0x23')](_0x7ff4a9)['then'](function(_0x4a5def){return _0x4a5def;});}return null;};}function removeEntity(_0x3f7e8b,_0x278c52){return function(_0x5989cb){if(_0x5989cb){return _0x5989cb[_0x0a40('0x24')]()['then'](function(){_0x3f7e8b['status'](0xcc)[_0x0a40('0x19')]();});}};}function handleEntityNotFound(_0x4004d1,_0x2c4382){return function(_0x4cb959){if(!_0x4cb959){_0x4004d1[_0x0a40('0x17')](0x194);}return _0x4cb959;};}function handleError(_0x3b682e,_0x41c4d8){_0x41c4d8=_0x41c4d8||0x1f4;return function(_0x5dd9ec){logger['error'](_0x5dd9ec[_0x0a40('0x25')]);if(_0x5dd9ec['name']){delete _0x5dd9ec[_0x0a40('0x26')];}_0x3b682e[_0x0a40('0x18')](_0x41c4d8)['send'](_0x5dd9ec);};}exports[_0x0a40('0x27')]=function(_0x4b014c,_0x1c39a1){var _0x549872={},_0x949f00={},_0x3f38b7={'count':0x0,'rows':[]};var _0x3361c8=_[_0x0a40('0x28')](db['SquareMessage'][_0x0a40('0x29')],function(_0x2b2ea0){return{'name':_0x2b2ea0[_0x0a40('0x2a')],'type':_0x2b2ea0[_0x0a40('0x2b')][_0x0a40('0x2c')]};});_0x949f00['model']=_[_0x0a40('0x28')](_0x3361c8,_0x0a40('0x26'));_0x949f00[_0x0a40('0x2d')]=_[_0x0a40('0x2e')](_0x4b014c['query']);_0x949f00[_0x0a40('0x2f')]=_['intersection'](_0x949f00[_0x0a40('0x30')],_0x949f00[_0x0a40('0x2d')]);_0x549872['attributes']=_['intersection'](_0x949f00[_0x0a40('0x30')],qs[_0x0a40('0x31')](_0x4b014c['query'][_0x0a40('0x31')]));_0x549872['attributes']=_0x549872['attributes']['length']?_0x549872[_0x0a40('0x32')]:_0x949f00[_0x0a40('0x30')];if(!_0x4b014c[_0x0a40('0x2d')][_0x0a40('0x33')]('nolimit')){_0x549872[_0x0a40('0x1d')]=qs['limit'](_0x4b014c[_0x0a40('0x2d')][_0x0a40('0x1d')]);_0x549872['offset']=qs[_0x0a40('0x1b')](_0x4b014c[_0x0a40('0x2d')][_0x0a40('0x1b')]);}_0x549872[_0x0a40('0x34')]=qs[_0x0a40('0x35')](_0x4b014c[_0x0a40('0x2d')]['sort']);_0x549872[_0x0a40('0x36')]=qs[_0x0a40('0x2f')](_[_0x0a40('0x37')](_0x4b014c[_0x0a40('0x2d')],_0x949f00[_0x0a40('0x2f')]),_0x3361c8);if(_0x4b014c[_0x0a40('0x2d')][_0x0a40('0x38')]){_0x549872[_0x0a40('0x36')]=_[_0x0a40('0x39')](_0x549872[_0x0a40('0x36')],{'$or':_['map'](_0x3361c8,function(_0x5f45e6){if(_0x5f45e6[_0x0a40('0x2b')]!==_0x0a40('0x3a')){var _0x5671ad={};_0x5671ad[_0x5f45e6[_0x0a40('0x26')]]={'$like':'%'+_0x4b014c['query'][_0x0a40('0x38')]+'%'};return _0x5671ad;}})});}_0x549872=_[_0x0a40('0x39')]({},_0x549872,_0x4b014c[_0x0a40('0x3b')]);var _0x2e1367={'where':_0x549872[_0x0a40('0x36')]};return db['SquareMessage']['count'](_0x2e1367)[_0x0a40('0x3c')](function(_0x4dfda9){_0x3f38b7[_0x0a40('0x1e')]=_0x4dfda9;if(_0x4b014c[_0x0a40('0x2d')][_0x0a40('0x3d')]){_0x549872[_0x0a40('0x3e')]=[{'all':!![]}];}return db[_0x0a40('0x3f')][_0x0a40('0x40')](_0x549872);})[_0x0a40('0x3c')](function(_0x22dbf4){_0x3f38b7[_0x0a40('0x41')]=_0x22dbf4;return _0x3f38b7;})[_0x0a40('0x3c')](respondWithFilteredResult(_0x1c39a1,_0x549872))[_0x0a40('0x42')](handleError(_0x1c39a1,null));};exports[_0x0a40('0x43')]=function(_0x3ac9a1,_0x542cda){var _0x3ae73b={'raw':!![],'where':{'id':_0x3ac9a1[_0x0a40('0x44')]['id']}},_0xbdfadb={};_0xbdfadb[_0x0a40('0x30')]=_[_0x0a40('0x2e')](db['SquareMessage']['rawAttributes']);_0xbdfadb['query']=_['keys'](_0x3ac9a1['query']);_0xbdfadb[_0x0a40('0x2f')]=_[_0x0a40('0x45')](_0xbdfadb[_0x0a40('0x30')],_0xbdfadb['query']);_0x3ae73b[_0x0a40('0x32')]=_[_0x0a40('0x45')](_0xbdfadb[_0x0a40('0x30')],qs[_0x0a40('0x31')](_0x3ac9a1[_0x0a40('0x2d')][_0x0a40('0x31')]));_0x3ae73b[_0x0a40('0x32')]=_0x3ae73b[_0x0a40('0x32')]['length']?_0x3ae73b[_0x0a40('0x32')]:_0xbdfadb['model'];if(_0x3ac9a1[_0x0a40('0x2d')][_0x0a40('0x3d')]){_0x3ae73b[_0x0a40('0x3e')]=[{'all':!![]}];}_0x3ae73b=_[_0x0a40('0x39')]({},_0x3ae73b,_0x3ac9a1['options']);return db[_0x0a40('0x3f')][_0x0a40('0x46')](_0x3ae73b)['then'](handleEntityNotFound(_0x542cda,null))[_0x0a40('0x3c')](respondWithResult(_0x542cda,null))[_0x0a40('0x42')](handleError(_0x542cda,null));};exports[_0x0a40('0x47')]=function(_0x5e3378,_0x4c0116){return db[_0x0a40('0x3f')]['create'](_0x5e3378[_0x0a40('0x48')],{})[_0x0a40('0x3c')](respondWithResult(_0x4c0116,0xc9))[_0x0a40('0x42')](handleError(_0x4c0116,null));};exports[_0x0a40('0x23')]=function(_0x232b17,_0x28a3fe){if(_0x232b17[_0x0a40('0x48')]['id']){delete _0x232b17[_0x0a40('0x48')]['id'];}return db[_0x0a40('0x3f')][_0x0a40('0x46')]({'where':{'id':_0x232b17['params']['id']}})[_0x0a40('0x3c')](handleEntityNotFound(_0x28a3fe,null))['then'](saveUpdates(_0x232b17[_0x0a40('0x48')],null))['then'](respondWithResult(_0x28a3fe,null))[_0x0a40('0x42')](handleError(_0x28a3fe,null));};exports['destroy']=function(_0x4e7e54,_0x399412){return db[_0x0a40('0x3f')][_0x0a40('0x46')]({'where':{'id':_0x4e7e54[_0x0a40('0x44')]['id']}})['then'](handleEntityNotFound(_0x399412,null))[_0x0a40('0x3c')](removeEntity(_0x399412,null))[_0x0a40('0x42')](handleError(_0x399412,null));}; \ No newline at end of file +var _0xa3b9=['name','send','index','map','SquareMessage','fieldName','type','key','model','query','keys','intersection','attributes','fields','nolimit','sort','where','filters','pick','filter','VIRTUAL','merge','options','includeAll','include','rows','show','params','rawAttributes','length','find','catch','create','body','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','error','stack'];(function(_0x3b2e0a,_0x49a3f9){var _0x4a84bd=function(_0x3aa487){while(--_0x3aa487){_0x3b2e0a['push'](_0x3b2e0a['shift']());}};_0x4a84bd(++_0x49a3f9);}(_0xa3b9,0x6b));var _0x9a3b=function(_0x92b376,_0x5d5826){_0x92b376=_0x92b376-0x0;var _0x23b700=_0xa3b9[_0x92b376];return _0x23b700;};'use strict';var emlformat=require(_0x9a3b('0x0'));var rimraf=require(_0x9a3b('0x1'));var zipdir=require(_0x9a3b('0x2'));var jsonpatch=require(_0x9a3b('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x9a3b('0x4'));var Mustache=require(_0x9a3b('0x5'));var util=require(_0x9a3b('0x6'));var path=require(_0x9a3b('0x7'));var sox=require('sox');var csv=require(_0x9a3b('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9a3b('0x9'));var _=require(_0x9a3b('0xa'));var squel=require(_0x9a3b('0xb'));var crypto=require(_0x9a3b('0xc'));var jsforce=require(_0x9a3b('0xd'));var deskjs=require(_0x9a3b('0xe'));var toCsv=require(_0x9a3b('0x8'));var querystring=require(_0x9a3b('0xf'));var Papa=require(_0x9a3b('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x9a3b('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9a3b('0x12'));var logger=require('../../config/logger')(_0x9a3b('0x13'));var utils=require('../../config/utils');var config=require(_0x9a3b('0x14'));var licenseUtil=require(_0x9a3b('0x15'));var db=require(_0x9a3b('0x16'))['db'];function respondWithStatusCode(_0x1450ff,_0x42aa98){_0x42aa98=_0x42aa98||0xcc;return function(_0x4d2c82){if(_0x4d2c82){return _0x1450ff['sendStatus'](_0x42aa98);}return _0x1450ff[_0x9a3b('0x17')](_0x42aa98)[_0x9a3b('0x18')]();};}function respondWithResult(_0x375f69,_0x35387c){_0x35387c=_0x35387c||0xc8;return function(_0x3524cd){if(_0x3524cd){return _0x375f69[_0x9a3b('0x17')](_0x35387c)[_0x9a3b('0x19')](_0x3524cd);}};}function respondWithFilteredResult(_0x94de05,_0x114819){return function(_0x5ab393){if(_0x5ab393){var _0x21b399=typeof _0x114819[_0x9a3b('0x1a')]===_0x9a3b('0x1b')&&typeof _0x114819[_0x9a3b('0x1c')]===_0x9a3b('0x1b');var _0xaba387=_0x5ab393[_0x9a3b('0x1d')];var _0x27f393=_0x21b399?0x0:_0x114819[_0x9a3b('0x1a')];var _0x94426c=_0x21b399?_0x5ab393[_0x9a3b('0x1d')]:_0x114819[_0x9a3b('0x1a')]+_0x114819[_0x9a3b('0x1c')];var _0x5ace77;if(_0x94426c>=_0xaba387){_0x94426c=_0xaba387;_0x5ace77=0xc8;}else{_0x5ace77=0xce;}_0x94de05[_0x9a3b('0x17')](_0x5ace77);return _0x94de05['set'](_0x9a3b('0x1e'),_0x27f393+'-'+_0x94426c+'/'+_0xaba387)[_0x9a3b('0x19')](_0x5ab393);}return null;};}function patchUpdates(_0xdafdc8){return function(_0x3bf87e){try{jsonpatch[_0x9a3b('0x1f')](_0x3bf87e,_0xdafdc8,!![]);}catch(_0x25f749){return BPromise[_0x9a3b('0x20')](_0x25f749);}return _0x3bf87e[_0x9a3b('0x21')]();};}function saveUpdates(_0x3ef434,_0x2aa973){return function(_0x5c296b){if(_0x5c296b){return _0x5c296b[_0x9a3b('0x22')](_0x3ef434)[_0x9a3b('0x23')](function(_0x3d3352){return _0x3d3352;});}return null;};}function removeEntity(_0x2da536,_0x2ef869){return function(_0x4abf5f){if(_0x4abf5f){return _0x4abf5f[_0x9a3b('0x24')]()[_0x9a3b('0x23')](function(){_0x2da536[_0x9a3b('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0xdd0e19,_0x4c3492){return function(_0x24aadd){if(!_0x24aadd){_0xdd0e19['sendStatus'](0x194);}return _0x24aadd;};}function handleError(_0x57d3c5,_0x38830d){_0x38830d=_0x38830d||0x1f4;return function(_0x5ccb42){logger[_0x9a3b('0x25')](_0x5ccb42[_0x9a3b('0x26')]);if(_0x5ccb42[_0x9a3b('0x27')]){delete _0x5ccb42[_0x9a3b('0x27')];}_0x57d3c5[_0x9a3b('0x17')](_0x38830d)[_0x9a3b('0x28')](_0x5ccb42);};}exports[_0x9a3b('0x29')]=function(_0x168728,_0x20a458){var _0x3c2aa8={},_0x2b7ca1={},_0x5c70d5={'count':0x0,'rows':[]};var _0x1dc5e6=_[_0x9a3b('0x2a')](db[_0x9a3b('0x2b')]['rawAttributes'],function(_0x5b5f73){return{'name':_0x5b5f73[_0x9a3b('0x2c')],'type':_0x5b5f73[_0x9a3b('0x2d')][_0x9a3b('0x2e')]};});_0x2b7ca1[_0x9a3b('0x2f')]=_[_0x9a3b('0x2a')](_0x1dc5e6,_0x9a3b('0x27'));_0x2b7ca1[_0x9a3b('0x30')]=_[_0x9a3b('0x31')](_0x168728[_0x9a3b('0x30')]);_0x2b7ca1['filters']=_[_0x9a3b('0x32')](_0x2b7ca1[_0x9a3b('0x2f')],_0x2b7ca1[_0x9a3b('0x30')]);_0x3c2aa8[_0x9a3b('0x33')]=_[_0x9a3b('0x32')](_0x2b7ca1[_0x9a3b('0x2f')],qs[_0x9a3b('0x34')](_0x168728[_0x9a3b('0x30')][_0x9a3b('0x34')]));_0x3c2aa8[_0x9a3b('0x33')]=_0x3c2aa8[_0x9a3b('0x33')]['length']?_0x3c2aa8[_0x9a3b('0x33')]:_0x2b7ca1[_0x9a3b('0x2f')];if(!_0x168728[_0x9a3b('0x30')]['hasOwnProperty'](_0x9a3b('0x35'))){_0x3c2aa8[_0x9a3b('0x1c')]=qs['limit'](_0x168728['query'][_0x9a3b('0x1c')]);_0x3c2aa8[_0x9a3b('0x1a')]=qs[_0x9a3b('0x1a')](_0x168728['query'][_0x9a3b('0x1a')]);}_0x3c2aa8['order']=qs[_0x9a3b('0x36')](_0x168728['query'][_0x9a3b('0x36')]);_0x3c2aa8[_0x9a3b('0x37')]=qs[_0x9a3b('0x38')](_[_0x9a3b('0x39')](_0x168728[_0x9a3b('0x30')],_0x2b7ca1['filters']),_0x1dc5e6);if(_0x168728[_0x9a3b('0x30')][_0x9a3b('0x3a')]){_0x3c2aa8['where']=_['merge'](_0x3c2aa8[_0x9a3b('0x37')],{'$or':_[_0x9a3b('0x2a')](_0x1dc5e6,function(_0x5df585){if(_0x5df585[_0x9a3b('0x2d')]!==_0x9a3b('0x3b')){var _0x56f894={};_0x56f894[_0x5df585[_0x9a3b('0x27')]]={'$like':'%'+_0x168728[_0x9a3b('0x30')]['filter']+'%'};return _0x56f894;}})});}_0x3c2aa8=_[_0x9a3b('0x3c')]({},_0x3c2aa8,_0x168728[_0x9a3b('0x3d')]);var _0x55cf32={'where':_0x3c2aa8['where']};return db['SquareMessage'][_0x9a3b('0x1d')](_0x55cf32)[_0x9a3b('0x23')](function(_0x51370c){_0x5c70d5[_0x9a3b('0x1d')]=_0x51370c;if(_0x168728['query'][_0x9a3b('0x3e')]){_0x3c2aa8[_0x9a3b('0x3f')]=[{'all':!![]}];}return db[_0x9a3b('0x2b')]['findAll'](_0x3c2aa8);})[_0x9a3b('0x23')](function(_0x2f07f3){_0x5c70d5[_0x9a3b('0x40')]=_0x2f07f3;return _0x5c70d5;})[_0x9a3b('0x23')](respondWithFilteredResult(_0x20a458,_0x3c2aa8))['catch'](handleError(_0x20a458,null));};exports[_0x9a3b('0x41')]=function(_0x5b64fb,_0x37ba91){var _0x327d51={'raw':!![],'where':{'id':_0x5b64fb[_0x9a3b('0x42')]['id']}},_0x1443b4={};_0x1443b4[_0x9a3b('0x2f')]=_[_0x9a3b('0x31')](db[_0x9a3b('0x2b')][_0x9a3b('0x43')]);_0x1443b4[_0x9a3b('0x30')]=_[_0x9a3b('0x31')](_0x5b64fb[_0x9a3b('0x30')]);_0x1443b4[_0x9a3b('0x38')]=_[_0x9a3b('0x32')](_0x1443b4['model'],_0x1443b4[_0x9a3b('0x30')]);_0x327d51[_0x9a3b('0x33')]=_[_0x9a3b('0x32')](_0x1443b4[_0x9a3b('0x2f')],qs['fields'](_0x5b64fb[_0x9a3b('0x30')][_0x9a3b('0x34')]));_0x327d51[_0x9a3b('0x33')]=_0x327d51['attributes'][_0x9a3b('0x44')]?_0x327d51[_0x9a3b('0x33')]:_0x1443b4[_0x9a3b('0x2f')];if(_0x5b64fb['query'][_0x9a3b('0x3e')]){_0x327d51[_0x9a3b('0x3f')]=[{'all':!![]}];}_0x327d51=_[_0x9a3b('0x3c')]({},_0x327d51,_0x5b64fb[_0x9a3b('0x3d')]);return db[_0x9a3b('0x2b')][_0x9a3b('0x45')](_0x327d51)[_0x9a3b('0x23')](handleEntityNotFound(_0x37ba91,null))[_0x9a3b('0x23')](respondWithResult(_0x37ba91,null))[_0x9a3b('0x46')](handleError(_0x37ba91,null));};exports[_0x9a3b('0x47')]=function(_0x5e8ffb,_0x3703a1){return db[_0x9a3b('0x2b')]['create'](_0x5e8ffb['body'],{})[_0x9a3b('0x23')](respondWithResult(_0x3703a1,0xc9))[_0x9a3b('0x46')](handleError(_0x3703a1,null));};exports['update']=function(_0x5d7d89,_0xf47d60){if(_0x5d7d89[_0x9a3b('0x48')]['id']){delete _0x5d7d89[_0x9a3b('0x48')]['id'];}return db[_0x9a3b('0x2b')][_0x9a3b('0x45')]({'where':{'id':_0x5d7d89[_0x9a3b('0x42')]['id']}})[_0x9a3b('0x23')](handleEntityNotFound(_0xf47d60,null))[_0x9a3b('0x23')](saveUpdates(_0x5d7d89['body'],null))[_0x9a3b('0x23')](respondWithResult(_0xf47d60,null))['catch'](handleError(_0xf47d60,null));};exports[_0x9a3b('0x24')]=function(_0xff5fa9,_0x15a908){return db[_0x9a3b('0x2b')][_0x9a3b('0x45')]({'where':{'id':_0xff5fa9[_0x9a3b('0x42')]['id']}})['then'](handleEntityNotFound(_0x15a908,null))['then'](removeEntity(_0x15a908,null))[_0x9a3b('0x46')](handleError(_0x15a908,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index 74dddd4..f8f7f04 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 _0x6e45=['moment','request-promise','path','rimraf','../../config/environment','exports','define','SquareMessage','square_messages','lodash','util','../../config/logger','api'];(function(_0x527b46,_0x45722b){var _0x451e51=function(_0x293d81){while(--_0x293d81){_0x527b46['push'](_0x527b46['shift']());}};_0x451e51(++_0x45722b);}(_0x6e45,0x71));var _0x56e4=function(_0xb76fdd,_0x4cf90b){_0xb76fdd=_0xb76fdd-0x0;var _0x17b046=_0x6e45[_0xb76fdd];return _0x17b046;};'use strict';var _=require(_0x56e4('0x0'));var util=require(_0x56e4('0x1'));var logger=require(_0x56e4('0x2'))(_0x56e4('0x3'));var moment=require(_0x56e4('0x4'));var BPromise=require('bluebird');var rp=require(_0x56e4('0x5'));var fs=require('fs');var path=require(_0x56e4('0x6'));var rimraf=require(_0x56e4('0x7'));var config=require(_0x56e4('0x8'));var attributes=require('./squareMessage.attributes');module[_0x56e4('0x9')]=function(_0x5d5b03,_0x3851d6){return _0x5d5b03[_0x56e4('0xa')](_0x56e4('0xb'),attributes,{'tableName':_0x56e4('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4b8b=['square_messages','lodash','moment','bluebird','request-promise','./squareMessage.attributes','exports'];(function(_0x149a9b,_0x5bb275){var _0x2c2bf6=function(_0xfe0c14){while(--_0xfe0c14){_0x149a9b['push'](_0x149a9b['shift']());}};_0x2c2bf6(++_0x5bb275);}(_0x4b8b,0x14a));var _0xb4b8=function(_0x5ea51f,_0x1e3a5b){_0x5ea51f=_0x5ea51f-0x0;var _0x28f6ab=_0x4b8b[_0x5ea51f];return _0x28f6ab;};'use strict';var _=require(_0xb4b8('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xb4b8('0x1'));var BPromise=require(_0xb4b8('0x2'));var rp=require(_0xb4b8('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xb4b8('0x4'));module[_0xb4b8('0x5')]=function(_0x53a076,_0x5a4669){return _0x53a076['define']('SquareMessage',attributes,{'tableName':_0xb4b8('0x6'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.rpc.js b/server/api/squareMessage/squareMessage.rpc.js index 953d4df..700be63 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 _0xa4d5=['raw','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','SquareMessage,\x20%s,\x20%s','debug','SquareMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','CreateSquareMessage','SquareMessage','body','options'];(function(_0x223bdb,_0x5882e6){var _0xef8e68=function(_0x55ab83){while(--_0x55ab83){_0x223bdb['push'](_0x223bdb['shift']());}};_0xef8e68(++_0x5882e6);}(_0xa4d5,0x119));var _0x5a4d=function(_0x2439a9,_0x24e87f){_0x2439a9=_0x2439a9-0x0;var _0x591552=_0xa4d5[_0x2439a9];return _0x591552;};'use strict';var _=require(_0x5a4d('0x0'));var util=require('util');var moment=require(_0x5a4d('0x1'));var BPromise=require(_0x5a4d('0x2'));var rs=require(_0x5a4d('0x3'));var fs=require('fs');var Redis=require(_0x5a4d('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x5a4d('0x5'));var logger=require(_0x5a4d('0x6'))(_0x5a4d('0x7'));var config=require('../../config/environment');var jayson=require(_0x5a4d('0x8'));var client=jayson[_0x5a4d('0x9')][_0x5a4d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x395960,_0x27b000,_0x11bd0d){return new BPromise(function(_0x2878b5,_0x59a745){return client[_0x5a4d('0xb')](_0x395960,_0x11bd0d)[_0x5a4d('0xc')](function(_0x1562f1){logger[_0x5a4d('0xd')](_0x5a4d('0xe'),_0x27b000,'request\x20sent');logger[_0x5a4d('0xf')](_0x5a4d('0x10'),_0x27b000,_0x5a4d('0x11'),JSON[_0x5a4d('0x12')](_0x1562f1));if(_0x1562f1[_0x5a4d('0x13')]){if(_0x1562f1[_0x5a4d('0x13')][_0x5a4d('0x14')]===0x1f4){logger[_0x5a4d('0x13')](_0x5a4d('0xe'),_0x27b000,_0x1562f1[_0x5a4d('0x13')]['message']);return _0x59a745(_0x1562f1[_0x5a4d('0x13')][_0x5a4d('0x15')]);}logger[_0x5a4d('0x13')](_0x5a4d('0xe'),_0x27b000,_0x1562f1['error'][_0x5a4d('0x15')]);return _0x2878b5(_0x1562f1['error'][_0x5a4d('0x15')]);}else{logger[_0x5a4d('0xd')](_0x5a4d('0xe'),_0x27b000,_0x5a4d('0x11'));_0x2878b5(_0x1562f1['result']['message']);}})[_0x5a4d('0x16')](function(_0x19cb51){logger[_0x5a4d('0x13')]('SquareMessage,\x20%s,\x20%s',_0x27b000,_0x19cb51);_0x59a745(_0x19cb51);});});}exports[_0x5a4d('0x17')]=function(_0x1572c6){var _0x5c1acb=this;return new Promise(function(_0x1fde96,_0x5b3a32){return db[_0x5a4d('0x18')]['create'](_0x1572c6[_0x5a4d('0x19')],{'raw':_0x1572c6[_0x5a4d('0x1a')]?_0x1572c6['options'][_0x5a4d('0x1b')]===undefined?!![]:![]:!![]})[_0x5a4d('0xc')](function(_0x1649c3){logger[_0x5a4d('0xd')](_0x5a4d('0x17'),_0x1572c6);logger[_0x5a4d('0xf')](_0x5a4d('0x17'),_0x1572c6,JSON['stringify'](_0x1649c3));_0x1fde96(_0x1649c3);})[_0x5a4d('0x16')](function(_0x518b29){logger[_0x5a4d('0x13')](_0x5a4d('0x17'),_0x518b29[_0x5a4d('0x15')],_0x1572c6);_0x5b3a32(_0x5c1acb[_0x5a4d('0x13')](0x1f4,_0x518b29[_0x5a4d('0x15')]));});});}; \ No newline at end of file +var _0xb8e3=['client','http','request','then','info','request\x20sent','error','code','SquareMessage,\x20%s,\x20%s','message','result','catch','CreateSquareMessage','create','body','options','debug','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x5d2803,_0xf375bd){var _0xdcad2c=function(_0x3c3a98){while(--_0x3c3a98){_0x5d2803['push'](_0x5d2803['shift']());}};_0xdcad2c(++_0xf375bd);}(_0xb8e3,0x1d1));var _0x3b8e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb8e3[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x3b8e('0x0'));var util=require(_0x3b8e('0x1'));var moment=require(_0x3b8e('0x2'));var BPromise=require(_0x3b8e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3b8e('0x4'));var db=require(_0x3b8e('0x5'))['db'];var utils=require(_0x3b8e('0x6'));var logger=require(_0x3b8e('0x7'))(_0x3b8e('0x8'));var config=require(_0x3b8e('0x9'));var jayson=require(_0x3b8e('0xa'));var client=jayson[_0x3b8e('0xb')][_0x3b8e('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x16c5ce,_0x59b2e8,_0x2ce7d6){return new BPromise(function(_0x2f41ac,_0x6e5430){return client[_0x3b8e('0xd')](_0x16c5ce,_0x2ce7d6)[_0x3b8e('0xe')](function(_0x4a04ad){logger[_0x3b8e('0xf')]('SquareMessage,\x20%s,\x20%s',_0x59b2e8,_0x3b8e('0x10'));logger['debug']('SquareMessage,\x20%s,\x20%s,\x20%s',_0x59b2e8,_0x3b8e('0x10'),JSON['stringify'](_0x4a04ad));if(_0x4a04ad[_0x3b8e('0x11')]){if(_0x4a04ad[_0x3b8e('0x11')][_0x3b8e('0x12')]===0x1f4){logger[_0x3b8e('0x11')](_0x3b8e('0x13'),_0x59b2e8,_0x4a04ad['error'][_0x3b8e('0x14')]);return _0x6e5430(_0x4a04ad[_0x3b8e('0x11')][_0x3b8e('0x14')]);}logger[_0x3b8e('0x11')]('SquareMessage,\x20%s,\x20%s',_0x59b2e8,_0x4a04ad['error']['message']);return _0x2f41ac(_0x4a04ad[_0x3b8e('0x11')][_0x3b8e('0x14')]);}else{logger[_0x3b8e('0xf')](_0x3b8e('0x13'),_0x59b2e8,_0x3b8e('0x10'));_0x2f41ac(_0x4a04ad[_0x3b8e('0x15')][_0x3b8e('0x14')]);}})[_0x3b8e('0x16')](function(_0x3134a6){logger['error'](_0x3b8e('0x13'),_0x59b2e8,_0x3134a6);_0x6e5430(_0x3134a6);});});}exports[_0x3b8e('0x17')]=function(_0x2b7a58){var _0x2e1e6e=this;return new Promise(function(_0x32fe95,_0x2b5401){return db['SquareMessage'][_0x3b8e('0x18')](_0x2b7a58[_0x3b8e('0x19')],{'raw':_0x2b7a58[_0x3b8e('0x1a')]?_0x2b7a58[_0x3b8e('0x1a')]['raw']===undefined?!![]:![]:!![]})[_0x3b8e('0xe')](function(_0x42a7ad){logger['info'](_0x3b8e('0x17'),_0x2b7a58);logger[_0x3b8e('0x1b')](_0x3b8e('0x17'),_0x2b7a58,JSON['stringify'](_0x42a7ad));_0x32fe95(_0x42a7ad);})[_0x3b8e('0x16')](function(_0x4a356e){logger['error']('CreateSquareMessage',_0x4a356e[_0x3b8e('0x14')],_0x2b7a58);_0x2b5401(_0x2e1e6e['error'](0x1f4,_0x4a356e[_0x3b8e('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/squareOdbc/index.js b/server/api/squareOdbc/index.js index c89b6b6..e667e57 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 _0xcb0a=['isAuthenticated','index','/:id','show','15s','test','post','put','update','delete','exports','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0x37ed06,_0x3b43f0){var _0x30c5a5=function(_0x5a9a81){while(--_0x5a9a81){_0x37ed06['push'](_0x37ed06['shift']());}};_0x30c5a5(++_0x3b43f0);}(_0xcb0a,0x1c3));var _0xacb0=function(_0xefd519,_0xc62635){_0xefd519=_0xefd519-0x0;var _0x4bb882=_0xcb0a[_0xefd519];return _0x4bb882;};'use strict';var multer=require(_0xacb0('0x0'));var util=require(_0xacb0('0x1'));var path=require(_0xacb0('0x2'));var timeout=require('connect-timeout');var express=require(_0xacb0('0x3'));var router=express['Router']();var fs_extra=require(_0xacb0('0x4'));var auth=require(_0xacb0('0x5'));var interaction=require(_0xacb0('0x6'));var config=require(_0xacb0('0x7'));var controller=require('./squareOdbc.controller');router[_0xacb0('0x8')]('/',auth[_0xacb0('0x9')](),controller[_0xacb0('0xa')]);router[_0xacb0('0x8')](_0xacb0('0xb'),auth[_0xacb0('0x9')](),controller[_0xacb0('0xc')]);router[_0xacb0('0x8')]('/:id/test',auth[_0xacb0('0x9')](),timeout(_0xacb0('0xd')),controller[_0xacb0('0xe')]);router[_0xacb0('0xf')]('/',auth[_0xacb0('0x9')](),controller['create']);router[_0xacb0('0x10')](_0xacb0('0xb'),auth[_0xacb0('0x9')](),controller[_0xacb0('0x11')]);router[_0xacb0('0x12')](_0xacb0('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0xacb0('0x13')]=router; \ No newline at end of file +var _0xfde1=['./squareOdbc.controller','get','isAuthenticated','index','/:id','show','create','update','delete','exports','multer','util','path','connect-timeout','express','../../config/environment'];(function(_0xf62b7d,_0x385d7c){var _0x2252f2=function(_0x588b4a){while(--_0x588b4a){_0xf62b7d['push'](_0xf62b7d['shift']());}};_0x2252f2(++_0x385d7c);}(_0xfde1,0x11a));var _0x1fde=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xfde1[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x1fde('0x0'));var util=require(_0x1fde('0x1'));var path=require(_0x1fde('0x2'));var timeout=require(_0x1fde('0x3'));var express=require(_0x1fde('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x1fde('0x5'));var controller=require(_0x1fde('0x6'));router[_0x1fde('0x7')]('/',auth[_0x1fde('0x8')](),controller[_0x1fde('0x9')]);router['get'](_0x1fde('0xa'),auth[_0x1fde('0x8')](),controller[_0x1fde('0xb')]);router[_0x1fde('0x7')]('/:id/test',auth['isAuthenticated'](),timeout('15s'),controller['test']);router['post']('/',auth[_0x1fde('0x8')](),controller[_0x1fde('0xc')]);router['put'](_0x1fde('0xa'),auth[_0x1fde('0x8')](),controller[_0x1fde('0xd')]);router[_0x1fde('0xe')](_0x1fde('0xa'),auth[_0x1fde('0x8')](),controller['destroy']);module[_0x1fde('0xf')]=router; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.attributes.js b/server/api/squareOdbc/squareOdbc.attributes.js index 5af8299..43abece 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 _0x5c9a=['name','sequelize','exports','STRING'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x5c9a,0xb1));var _0xa5c9=function(_0x9edfd5,_0x286486){_0x9edfd5=_0x9edfd5-0x0;var _0x330738=_0x5c9a[_0x9edfd5];return _0x330738;};'use strict';var Sequelize=require(_0xa5c9('0x0'));module[_0xa5c9('0x1')]={'name':{'type':Sequelize[_0xa5c9('0x2')],'unique':_0xa5c9('0x3'),'allowNull':![]},'dsn':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xa5c9('0x2')]}}; \ No newline at end of file +var _0xebf1=['sequelize','exports','STRING','name'];(function(_0x2b0683,_0x5e49b0){var _0x381408=function(_0x3d22a7){while(--_0x3d22a7){_0x2b0683['push'](_0x2b0683['shift']());}};_0x381408(++_0x5e49b0);}(_0xebf1,0xc0));var _0x1ebf=function(_0x16a223,_0x31b6e8){_0x16a223=_0x16a223-0x0;var _0x5ded66=_0xebf1[_0x16a223];return _0x5ded66;};'use strict';var Sequelize=require(_0x1ebf('0x0'));module[_0x1ebf('0x1')]={'name':{'type':Sequelize[_0x1ebf('0x2')],'unique':_0x1ebf('0x3'),'allowNull':![]},'dsn':{'type':Sequelize[_0x1ebf('0x2')]},'description':{'type':Sequelize[_0x1ebf('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.controller.js b/server/api/squareOdbc/squareOdbc.controller.js index 85ea9db..b47996e 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 _0x68d3=['error','stack','name','send','index','SquareOdbc','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','sort','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','dsn','closeSync','eml-format','fast-json-patch','request-promise','moment','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../config/license/hardware','api','../../mysqldb','sendStatus','end','status','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','get','UserProfileResource'];(function(_0x558e53,_0x56ffc4){var _0x1fd3a2=function(_0x5c2d13){while(--_0x5c2d13){_0x558e53['push'](_0x558e53['shift']());}};_0x1fd3a2(++_0x56ffc4);}(_0x68d3,0x7a));var _0x368d=function(_0xfa4242,_0x304cf9){_0xfa4242=_0xfa4242-0x0;var _0x5cc36a=_0x68d3[_0xfa4242];return _0x5cc36a;};'use strict';var emlformat=require(_0x368d('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x368d('0x1'));var rp=require(_0x368d('0x2'));var moment=require(_0x368d('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x368d('0x4'));var sox=require(_0x368d('0x5'));var csv=require(_0x368d('0x6'));var ejs=require(_0x368d('0x7'));var fs=require('fs');var fs_extra=require(_0x368d('0x8'));var _=require(_0x368d('0x9'));var squel=require(_0x368d('0xa'));var crypto=require(_0x368d('0xb'));var jsforce=require(_0x368d('0xc'));var deskjs=require(_0x368d('0xd'));var toCsv=require(_0x368d('0x6'));var querystring=require('querystring');var Papa=require(_0x368d('0xe'));var Redis=require('ioredis');var authService=require(_0x368d('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x368d('0x10'));var logger=require('../../config/logger')(_0x368d('0x11'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x368d('0x12'))['db'];function respondWithStatusCode(_0x188558,_0x3042fe){_0x3042fe=_0x3042fe||0xcc;return function(_0x433967){if(_0x433967){return _0x188558[_0x368d('0x13')](_0x3042fe);}return _0x188558['status'](_0x3042fe)[_0x368d('0x14')]();};}function respondWithResult(_0x1d2cd2,_0x54b656){_0x54b656=_0x54b656||0xc8;return function(_0xb5c79){if(_0xb5c79){return _0x1d2cd2[_0x368d('0x15')](_0x54b656)['json'](_0xb5c79);}};}function respondWithFilteredResult(_0x2f9ea7,_0x4d51b){return function(_0x5f1f72){if(_0x5f1f72){var _0x12428f=typeof _0x4d51b[_0x368d('0x16')]==='undefined'&&typeof _0x4d51b[_0x368d('0x17')]===_0x368d('0x18');var _0x494f33=_0x5f1f72[_0x368d('0x19')];var _0xf3f4e5=_0x12428f?0x0:_0x4d51b[_0x368d('0x16')];var _0x19cf23=_0x12428f?_0x5f1f72[_0x368d('0x19')]:_0x4d51b[_0x368d('0x16')]+_0x4d51b[_0x368d('0x17')];var _0x3d07bb;if(_0x19cf23>=_0x494f33){_0x19cf23=_0x494f33;_0x3d07bb=0xc8;}else{_0x3d07bb=0xce;}_0x2f9ea7['status'](_0x3d07bb);return _0x2f9ea7[_0x368d('0x1a')](_0x368d('0x1b'),_0xf3f4e5+'-'+_0x19cf23+'/'+_0x494f33)['json'](_0x5f1f72);}return null;};}function patchUpdates(_0x1ced87){return function(_0x24c035){try{jsonpatch[_0x368d('0x1c')](_0x24c035,_0x1ced87,!![]);}catch(_0x236c16){return BPromise[_0x368d('0x1d')](_0x236c16);}return _0x24c035[_0x368d('0x1e')]();};}function saveUpdates(_0xeb661e,_0x20815d){return function(_0x936646){if(_0x936646){return _0x936646[_0x368d('0x1f')](_0xeb661e)[_0x368d('0x20')](function(_0xcbffaa){return _0xcbffaa;});}return null;};}function removeEntity(_0x4c9739,_0x4cdb3f){return function(_0xc61b5e){if(_0xc61b5e){return _0xc61b5e[_0x368d('0x21')]()[_0x368d('0x20')](function(){var _0x10c915=_0xc61b5e[_0x368d('0x22')]({'plain':!![]});var _0x24036d='ODBC';return db[_0x368d('0x23')][_0x368d('0x21')]({'where':{'type':_0x24036d,'resourceId':_0x10c915['id']}})[_0x368d('0x20')](function(){return _0xc61b5e;});})['then'](function(){_0x4c9739[_0x368d('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3bde5c,_0x4b2c52){return function(_0x58a033){if(!_0x58a033){_0x3bde5c[_0x368d('0x13')](0x194);}return _0x58a033;};}function handleError(_0x5ebf78,_0x53e484){_0x53e484=_0x53e484||0x1f4;return function(_0x28f5bc){logger[_0x368d('0x24')](_0x28f5bc[_0x368d('0x25')]);if(_0x28f5bc[_0x368d('0x26')]){delete _0x28f5bc[_0x368d('0x26')];}_0x5ebf78[_0x368d('0x15')](_0x53e484)[_0x368d('0x27')](_0x28f5bc);};}exports[_0x368d('0x28')]=function(_0x478fbf,_0x2ffcac){var _0x50a46c={},_0x1141d1={},_0x18c8a9={'count':0x0,'rows':[]};var _0x59e100=_['map'](db[_0x368d('0x29')][_0x368d('0x2a')],function(_0x12f03b){return{'name':_0x12f03b[_0x368d('0x2b')],'type':_0x12f03b[_0x368d('0x2c')][_0x368d('0x2d')]};});_0x1141d1[_0x368d('0x2e')]=_[_0x368d('0x2f')](_0x59e100,'name');_0x1141d1[_0x368d('0x30')]=_[_0x368d('0x31')](_0x478fbf[_0x368d('0x30')]);_0x1141d1[_0x368d('0x32')]=_[_0x368d('0x33')](_0x1141d1[_0x368d('0x2e')],_0x1141d1[_0x368d('0x30')]);_0x50a46c['attributes']=_['intersection'](_0x1141d1[_0x368d('0x2e')],qs['fields'](_0x478fbf[_0x368d('0x30')][_0x368d('0x34')]));_0x50a46c[_0x368d('0x35')]=_0x50a46c[_0x368d('0x35')][_0x368d('0x36')]?_0x50a46c[_0x368d('0x35')]:_0x1141d1[_0x368d('0x2e')];if(!_0x478fbf['query'][_0x368d('0x37')]('nolimit')){_0x50a46c[_0x368d('0x17')]=qs[_0x368d('0x17')](_0x478fbf[_0x368d('0x30')]['limit']);_0x50a46c['offset']=qs['offset'](_0x478fbf['query'][_0x368d('0x16')]);}_0x50a46c['order']=qs[_0x368d('0x38')](_0x478fbf[_0x368d('0x30')]['sort']);_0x50a46c['where']=qs[_0x368d('0x32')](_['pick'](_0x478fbf[_0x368d('0x30')],_0x1141d1[_0x368d('0x32')]),_0x59e100);if(_0x478fbf[_0x368d('0x30')][_0x368d('0x39')]){_0x50a46c[_0x368d('0x3a')]=_[_0x368d('0x3b')](_0x50a46c[_0x368d('0x3a')],{'$or':_[_0x368d('0x2f')](_0x59e100,function(_0x5562b7){if(_0x5562b7[_0x368d('0x2c')]!==_0x368d('0x3c')){var _0x218882={};_0x218882[_0x5562b7[_0x368d('0x26')]]={'$like':'%'+_0x478fbf[_0x368d('0x30')][_0x368d('0x39')]+'%'};return _0x218882;}})});}_0x50a46c=_[_0x368d('0x3b')]({},_0x50a46c,_0x478fbf[_0x368d('0x3d')]);var _0x3a595d={'where':_0x50a46c[_0x368d('0x3a')]};return db[_0x368d('0x29')][_0x368d('0x19')](_0x3a595d)[_0x368d('0x20')](function(_0x3d7ee0){_0x18c8a9[_0x368d('0x19')]=_0x3d7ee0;if(_0x478fbf['query'][_0x368d('0x3e')]){_0x50a46c[_0x368d('0x3f')]=[{'all':!![]}];}return db[_0x368d('0x29')][_0x368d('0x40')](_0x50a46c);})[_0x368d('0x20')](function(_0x461570){_0x18c8a9[_0x368d('0x41')]=_0x461570;return _0x18c8a9;})[_0x368d('0x20')](respondWithFilteredResult(_0x2ffcac,_0x50a46c))[_0x368d('0x42')](handleError(_0x2ffcac,null));};exports[_0x368d('0x43')]=function(_0x2b954f,_0x53c624){var _0x1ee844={'raw':!![],'where':{'id':_0x2b954f[_0x368d('0x44')]['id']}},_0xd8e4f1={};_0xd8e4f1[_0x368d('0x2e')]=_[_0x368d('0x31')](db[_0x368d('0x29')][_0x368d('0x2a')]);_0xd8e4f1[_0x368d('0x30')]=_['keys'](_0x2b954f['query']);_0xd8e4f1['filters']=_[_0x368d('0x33')](_0xd8e4f1[_0x368d('0x2e')],_0xd8e4f1[_0x368d('0x30')]);_0x1ee844[_0x368d('0x35')]=_[_0x368d('0x33')](_0xd8e4f1[_0x368d('0x2e')],qs[_0x368d('0x34')](_0x2b954f[_0x368d('0x30')]['fields']));_0x1ee844[_0x368d('0x35')]=_0x1ee844['attributes'][_0x368d('0x36')]?_0x1ee844[_0x368d('0x35')]:_0xd8e4f1[_0x368d('0x2e')];if(_0x2b954f[_0x368d('0x30')][_0x368d('0x3e')]){_0x1ee844[_0x368d('0x3f')]=[{'all':!![]}];}_0x1ee844=_['merge']({},_0x1ee844,_0x2b954f[_0x368d('0x3d')]);return db[_0x368d('0x29')][_0x368d('0x45')](_0x1ee844)[_0x368d('0x20')](handleEntityNotFound(_0x53c624,null))['then'](respondWithResult(_0x53c624,null))[_0x368d('0x42')](handleError(_0x53c624,null));};exports[_0x368d('0x46')]=function(_0x30b66f,_0x427ee9){return db['SquareOdbc'][_0x368d('0x46')](_0x30b66f['body'],{})[_0x368d('0x20')](function(_0x1947db){var _0xe92540=_0x30b66f[_0x368d('0x47')][_0x368d('0x22')]({'plain':!![]});if(!_0xe92540)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xe92540[_0x368d('0x48')]===_0x368d('0x47')){var _0x1f6a6a=_0x1947db[_0x368d('0x22')]({'plain':!![]});var _0x441ef9='ODBC';return db[_0x368d('0x49')][_0x368d('0x45')]({'where':{'name':_0x441ef9,'userProfileId':_0xe92540['userProfileId']},'raw':!![]})[_0x368d('0x20')](function(_0x38302a){if(_0x38302a&&_0x38302a[_0x368d('0x4a')]===0x0){return db[_0x368d('0x23')][_0x368d('0x46')]({'name':_0x1f6a6a[_0x368d('0x26')],'resourceId':_0x1f6a6a['id'],'type':_0x38302a[_0x368d('0x26')],'sectionId':_0x38302a['id']},{})['then'](function(){return _0x1947db;});}else{return _0x1947db;}})[_0x368d('0x42')](function(_0x461fc6){logger['error'](_0x368d('0x4b'),_0x461fc6);throw _0x461fc6;});}return _0x1947db;})['then'](respondWithResult(_0x427ee9,0xc9))['catch'](handleError(_0x427ee9,null));};exports[_0x368d('0x1f')]=function(_0x5b438f,_0x3b1d92){if(_0x5b438f[_0x368d('0x4c')]['id']){delete _0x5b438f[_0x368d('0x4c')]['id'];}return db[_0x368d('0x29')]['find']({'where':{'id':_0x5b438f[_0x368d('0x44')]['id']}})['then'](handleEntityNotFound(_0x3b1d92,null))[_0x368d('0x20')](saveUpdates(_0x5b438f[_0x368d('0x4c')],null))[_0x368d('0x20')](respondWithResult(_0x3b1d92,null))['catch'](handleError(_0x3b1d92,null));};exports['destroy']=function(_0xfc0578,_0x41a98f){return db[_0x368d('0x29')]['find']({'where':{'id':_0xfc0578['params']['id']}})[_0x368d('0x20')](handleEntityNotFound(_0x41a98f,null))[_0x368d('0x20')](removeEntity(_0x41a98f,null))[_0x368d('0x42')](handleError(_0x41a98f,null));};exports['test']=function(_0x393c02,_0xf41ce5,_0x4f39a4){var _0x4d24dc;return db[_0x368d('0x29')][_0x368d('0x45')]({'where':{'id':_0x393c02[_0x368d('0x44')]['id']},'attributes':['id','dsn']})[_0x368d('0x20')](handleEntityNotFound(_0xf41ce5,null))[_0x368d('0x20')](function(_0x31a378){if(_0x31a378){var _0x4b3f7c=require('odbc')();_0x4b3f7c['openSync'](_0x31a378[_0x368d('0x4d')]);_0x4b3f7c[_0x368d('0x4e')]();return _0x31a378;}})[_0x368d('0x20')](respondWithResult(_0xf41ce5,null))['catch'](handleError(_0xf41ce5,null));}; \ No newline at end of file +var _0xfe32=['closeSync','eml-format','zip-dir','request-promise','moment','bluebird','util','sox','ejs','lodash','squel','jsforce','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','update','destroy','then','get','ODBC','error','stack','name','send','map','SquareOdbc','rawAttributes','type','key','query','keys','filters','intersection','model','attributes','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','fields','length','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','test','dsn','odbc'];(function(_0x1aa3c9,_0x4801c2){var _0x2280c7=function(_0x58db4f){while(--_0x58db4f){_0x1aa3c9['push'](_0x1aa3c9['shift']());}};_0x2280c7(++_0x4801c2);}(_0xfe32,0xfa));var _0x2fe3=function(_0x5b8587,_0x3743e3){_0x5b8587=_0x5b8587-0x0;var _0x3248d3=_0xfe32[_0x5b8587];return _0x3248d3;};'use strict';var emlformat=require(_0x2fe3('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2fe3('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2fe3('0x2'));var moment=require(_0x2fe3('0x3'));var BPromise=require(_0x2fe3('0x4'));var Mustache=require('mustache');var util=require(_0x2fe3('0x5'));var path=require('path');var sox=require(_0x2fe3('0x6'));var csv=require('to-csv');var ejs=require(_0x2fe3('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2fe3('0x8'));var squel=require(_0x2fe3('0x9'));var crypto=require('crypto');var jsforce=require(_0x2fe3('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x2fe3('0xb'));var querystring=require(_0x2fe3('0xc'));var Papa=require(_0x2fe3('0xd'));var Redis=require(_0x2fe3('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x2fe3('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2fe3('0x10'));var logger=require(_0x2fe3('0x11'))(_0x2fe3('0x12'));var utils=require('../../config/utils');var config=require(_0x2fe3('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x2fe3('0x14'))['db'];function respondWithStatusCode(_0x5973c3,_0x1d6d96){_0x1d6d96=_0x1d6d96||0xcc;return function(_0x1a058b){if(_0x1a058b){return _0x5973c3[_0x2fe3('0x15')](_0x1d6d96);}return _0x5973c3[_0x2fe3('0x16')](_0x1d6d96)[_0x2fe3('0x17')]();};}function respondWithResult(_0x25e474,_0x5c315f){_0x5c315f=_0x5c315f||0xc8;return function(_0x22b132){if(_0x22b132){return _0x25e474[_0x2fe3('0x16')](_0x5c315f)[_0x2fe3('0x18')](_0x22b132);}};}function respondWithFilteredResult(_0x575150,_0x2758c0){return function(_0x407f10){if(_0x407f10){var _0x37b841=typeof _0x2758c0[_0x2fe3('0x19')]===_0x2fe3('0x1a')&&typeof _0x2758c0[_0x2fe3('0x1b')]===_0x2fe3('0x1a');var _0x50d990=_0x407f10[_0x2fe3('0x1c')];var _0x16c157=_0x37b841?0x0:_0x2758c0[_0x2fe3('0x19')];var _0x35e02d=_0x37b841?_0x407f10[_0x2fe3('0x1c')]:_0x2758c0[_0x2fe3('0x19')]+_0x2758c0[_0x2fe3('0x1b')];var _0x4784c0;if(_0x35e02d>=_0x50d990){_0x35e02d=_0x50d990;_0x4784c0=0xc8;}else{_0x4784c0=0xce;}_0x575150[_0x2fe3('0x16')](_0x4784c0);return _0x575150[_0x2fe3('0x1d')]('Content-Range',_0x16c157+'-'+_0x35e02d+'/'+_0x50d990)['json'](_0x407f10);}return null;};}function patchUpdates(_0x1b8562){return function(_0x5f2b7f){try{jsonpatch[_0x2fe3('0x1e')](_0x5f2b7f,_0x1b8562,!![]);}catch(_0xa9f188){return BPromise[_0x2fe3('0x1f')](_0xa9f188);}return _0x5f2b7f['save']();};}function saveUpdates(_0x531ab0,_0x558850){return function(_0x1e02b4){if(_0x1e02b4){return _0x1e02b4[_0x2fe3('0x20')](_0x531ab0)['then'](function(_0x62cf50){return _0x62cf50;});}return null;};}function removeEntity(_0x1e5102,_0x200aa0){return function(_0x5870b){if(_0x5870b){return _0x5870b[_0x2fe3('0x21')]()[_0x2fe3('0x22')](function(){var _0x1c832f=_0x5870b[_0x2fe3('0x23')]({'plain':!![]});var _0x32eefa=_0x2fe3('0x24');return db['UserProfileResource']['destroy']({'where':{'type':_0x32eefa,'resourceId':_0x1c832f['id']}})['then'](function(){return _0x5870b;});})['then'](function(){_0x1e5102[_0x2fe3('0x16')](0xcc)[_0x2fe3('0x17')]();});}};}function handleEntityNotFound(_0x3127c3,_0x50eb1b){return function(_0x5cd0bf){if(!_0x5cd0bf){_0x3127c3[_0x2fe3('0x15')](0x194);}return _0x5cd0bf;};}function handleError(_0x3808c5,_0x3adedc){_0x3adedc=_0x3adedc||0x1f4;return function(_0x15a5d4){logger[_0x2fe3('0x25')](_0x15a5d4[_0x2fe3('0x26')]);if(_0x15a5d4['name']){delete _0x15a5d4[_0x2fe3('0x27')];}_0x3808c5[_0x2fe3('0x16')](_0x3adedc)[_0x2fe3('0x28')](_0x15a5d4);};}exports['index']=function(_0x32eed9,_0x31e7d4){var _0x15ca11={},_0x4d48eb={},_0xec2278={'count':0x0,'rows':[]};var _0xb75c4c=_[_0x2fe3('0x29')](db[_0x2fe3('0x2a')][_0x2fe3('0x2b')],function(_0x19d9f2){return{'name':_0x19d9f2['fieldName'],'type':_0x19d9f2[_0x2fe3('0x2c')][_0x2fe3('0x2d')]};});_0x4d48eb['model']=_[_0x2fe3('0x29')](_0xb75c4c,_0x2fe3('0x27'));_0x4d48eb[_0x2fe3('0x2e')]=_[_0x2fe3('0x2f')](_0x32eed9[_0x2fe3('0x2e')]);_0x4d48eb[_0x2fe3('0x30')]=_[_0x2fe3('0x31')](_0x4d48eb[_0x2fe3('0x32')],_0x4d48eb[_0x2fe3('0x2e')]);_0x15ca11[_0x2fe3('0x33')]=_[_0x2fe3('0x31')](_0x4d48eb[_0x2fe3('0x32')],qs['fields'](_0x32eed9[_0x2fe3('0x2e')]['fields']));_0x15ca11[_0x2fe3('0x33')]=_0x15ca11[_0x2fe3('0x33')]['length']?_0x15ca11['attributes']:_0x4d48eb[_0x2fe3('0x32')];if(!_0x32eed9[_0x2fe3('0x2e')][_0x2fe3('0x34')](_0x2fe3('0x35'))){_0x15ca11[_0x2fe3('0x1b')]=qs[_0x2fe3('0x1b')](_0x32eed9['query'][_0x2fe3('0x1b')]);_0x15ca11[_0x2fe3('0x19')]=qs[_0x2fe3('0x19')](_0x32eed9[_0x2fe3('0x2e')][_0x2fe3('0x19')]);}_0x15ca11[_0x2fe3('0x36')]=qs[_0x2fe3('0x37')](_0x32eed9[_0x2fe3('0x2e')]['sort']);_0x15ca11[_0x2fe3('0x38')]=qs[_0x2fe3('0x30')](_['pick'](_0x32eed9[_0x2fe3('0x2e')],_0x4d48eb['filters']),_0xb75c4c);if(_0x32eed9['query']['filter']){_0x15ca11[_0x2fe3('0x38')]=_[_0x2fe3('0x39')](_0x15ca11['where'],{'$or':_['map'](_0xb75c4c,function(_0x119f1e){if(_0x119f1e[_0x2fe3('0x2c')]!==_0x2fe3('0x3a')){var _0x4b8167={};_0x4b8167[_0x119f1e[_0x2fe3('0x27')]]={'$like':'%'+_0x32eed9[_0x2fe3('0x2e')][_0x2fe3('0x3b')]+'%'};return _0x4b8167;}})});}_0x15ca11=_['merge']({},_0x15ca11,_0x32eed9[_0x2fe3('0x3c')]);var _0x51539f={'where':_0x15ca11['where']};return db[_0x2fe3('0x2a')][_0x2fe3('0x1c')](_0x51539f)['then'](function(_0x5dfc97){_0xec2278[_0x2fe3('0x1c')]=_0x5dfc97;if(_0x32eed9[_0x2fe3('0x2e')][_0x2fe3('0x3d')]){_0x15ca11[_0x2fe3('0x3e')]=[{'all':!![]}];}return db['SquareOdbc'][_0x2fe3('0x3f')](_0x15ca11);})[_0x2fe3('0x22')](function(_0x2dbe13){_0xec2278[_0x2fe3('0x40')]=_0x2dbe13;return _0xec2278;})[_0x2fe3('0x22')](respondWithFilteredResult(_0x31e7d4,_0x15ca11))[_0x2fe3('0x41')](handleError(_0x31e7d4,null));};exports[_0x2fe3('0x42')]=function(_0x354744,_0x367da0){var _0x348e24={'raw':!![],'where':{'id':_0x354744[_0x2fe3('0x43')]['id']}},_0x464600={};_0x464600[_0x2fe3('0x32')]=_[_0x2fe3('0x2f')](db['SquareOdbc'][_0x2fe3('0x2b')]);_0x464600['query']=_[_0x2fe3('0x2f')](_0x354744[_0x2fe3('0x2e')]);_0x464600[_0x2fe3('0x30')]=_[_0x2fe3('0x31')](_0x464600[_0x2fe3('0x32')],_0x464600[_0x2fe3('0x2e')]);_0x348e24[_0x2fe3('0x33')]=_[_0x2fe3('0x31')](_0x464600[_0x2fe3('0x32')],qs[_0x2fe3('0x44')](_0x354744[_0x2fe3('0x2e')][_0x2fe3('0x44')]));_0x348e24['attributes']=_0x348e24[_0x2fe3('0x33')][_0x2fe3('0x45')]?_0x348e24['attributes']:_0x464600[_0x2fe3('0x32')];if(_0x354744[_0x2fe3('0x2e')][_0x2fe3('0x3d')]){_0x348e24[_0x2fe3('0x3e')]=[{'all':!![]}];}_0x348e24=_['merge']({},_0x348e24,_0x354744[_0x2fe3('0x3c')]);return db[_0x2fe3('0x2a')][_0x2fe3('0x46')](_0x348e24)[_0x2fe3('0x22')](handleEntityNotFound(_0x367da0,null))[_0x2fe3('0x22')](respondWithResult(_0x367da0,null))[_0x2fe3('0x41')](handleError(_0x367da0,null));};exports[_0x2fe3('0x47')]=function(_0xe89a53,_0x1811ee){return db[_0x2fe3('0x2a')][_0x2fe3('0x47')](_0xe89a53[_0x2fe3('0x48')],{})[_0x2fe3('0x22')](function(_0x323bc2){var _0x3df475=_0xe89a53['user'][_0x2fe3('0x23')]({'plain':!![]});if(!_0x3df475)throw new Error(_0x2fe3('0x49'));if(_0x3df475['role']===_0x2fe3('0x4a')){var _0x5a5f30=_0x323bc2[_0x2fe3('0x23')]({'plain':!![]});var _0x4514b2=_0x2fe3('0x24');return db['UserProfileSection'][_0x2fe3('0x46')]({'where':{'name':_0x4514b2,'userProfileId':_0x3df475[_0x2fe3('0x4b')]},'raw':!![]})[_0x2fe3('0x22')](function(_0x1a4789){if(_0x1a4789&&_0x1a4789[_0x2fe3('0x4c')]===0x0){return db[_0x2fe3('0x4d')][_0x2fe3('0x47')]({'name':_0x5a5f30[_0x2fe3('0x27')],'resourceId':_0x5a5f30['id'],'type':_0x1a4789[_0x2fe3('0x27')],'sectionId':_0x1a4789['id']},{})['then'](function(){return _0x323bc2;});}else{return _0x323bc2;}})['catch'](function(_0x7bbfb1){logger['error'](_0x2fe3('0x4e'),_0x7bbfb1);throw _0x7bbfb1;});}return _0x323bc2;})[_0x2fe3('0x22')](respondWithResult(_0x1811ee,0xc9))['catch'](handleError(_0x1811ee,null));};exports[_0x2fe3('0x20')]=function(_0x34fb82,_0x2a939f){if(_0x34fb82[_0x2fe3('0x48')]['id']){delete _0x34fb82[_0x2fe3('0x48')]['id'];}return db['SquareOdbc'][_0x2fe3('0x46')]({'where':{'id':_0x34fb82[_0x2fe3('0x43')]['id']}})[_0x2fe3('0x22')](handleEntityNotFound(_0x2a939f,null))[_0x2fe3('0x22')](saveUpdates(_0x34fb82[_0x2fe3('0x48')],null))[_0x2fe3('0x22')](respondWithResult(_0x2a939f,null))[_0x2fe3('0x41')](handleError(_0x2a939f,null));};exports[_0x2fe3('0x21')]=function(_0x1d568e,_0x379cf3){return db[_0x2fe3('0x2a')][_0x2fe3('0x46')]({'where':{'id':_0x1d568e[_0x2fe3('0x43')]['id']}})[_0x2fe3('0x22')](handleEntityNotFound(_0x379cf3,null))['then'](removeEntity(_0x379cf3,null))['catch'](handleError(_0x379cf3,null));};exports[_0x2fe3('0x4f')]=function(_0x4d8038,_0x2fb98b,_0x53bdf0){var _0x591c8b;return db[_0x2fe3('0x2a')][_0x2fe3('0x46')]({'where':{'id':_0x4d8038[_0x2fe3('0x43')]['id']},'attributes':['id',_0x2fe3('0x50')]})[_0x2fe3('0x22')](handleEntityNotFound(_0x2fb98b,null))[_0x2fe3('0x22')](function(_0x2290c0){if(_0x2290c0){var _0x5063d5=require(_0x2fe3('0x51'))();_0x5063d5['openSync'](_0x2290c0[_0x2fe3('0x50')]);_0x5063d5[_0x2fe3('0x52')]();return _0x2290c0;}})[_0x2fe3('0x22')](respondWithResult(_0x2fb98b,null))['catch'](handleError(_0x2fb98b,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index c95857a..c28d878 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 _0x0515=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./squareOdbc.attributes','exports','SquareOdbc','lodash'];(function(_0x4b2cf4,_0x23cb34){var _0x26af21=function(_0x23e8d2){while(--_0x23e8d2){_0x4b2cf4['push'](_0x4b2cf4['shift']());}};_0x26af21(++_0x23cb34);}(_0x0515,0x16b));var _0x5051=function(_0x321d5e,_0x1ae4a9){_0x321d5e=_0x321d5e-0x0;var _0x3458cd=_0x0515[_0x321d5e];return _0x3458cd;};'use strict';var _=require(_0x5051('0x0'));var util=require(_0x5051('0x1'));var logger=require(_0x5051('0x2'))(_0x5051('0x3'));var moment=require(_0x5051('0x4'));var BPromise=require(_0x5051('0x5'));var rp=require(_0x5051('0x6'));var fs=require('fs');var path=require(_0x5051('0x7'));var rimraf=require(_0x5051('0x8'));var config=require(_0x5051('0x9'));var attributes=require(_0x5051('0xa'));module[_0x5051('0xb')]=function(_0x481d53,_0x3beff2){return _0x481d53['define'](_0x5051('0xc'),attributes,{'tableName':'square_odbc','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0558=['rimraf','../../config/environment','./squareOdbc.attributes','exports','define','square_odbc','util','../../config/logger','api','moment','bluebird','path'];(function(_0x5a6e9f,_0x45b335){var _0x3dd5c4=function(_0x5e37a7){while(--_0x5e37a7){_0x5a6e9f['push'](_0x5a6e9f['shift']());}};_0x3dd5c4(++_0x45b335);}(_0x0558,0xea));var _0x8055=function(_0x22f5ea,_0x3a6a30){_0x22f5ea=_0x22f5ea-0x0;var _0xe5955=_0x0558[_0x22f5ea];return _0xe5955;};'use strict';var _=require('lodash');var util=require(_0x8055('0x0'));var logger=require(_0x8055('0x1'))(_0x8055('0x2'));var moment=require(_0x8055('0x3'));var BPromise=require(_0x8055('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8055('0x5'));var rimraf=require(_0x8055('0x6'));var config=require(_0x8055('0x7'));var attributes=require(_0x8055('0x8'));module[_0x8055('0x9')]=function(_0x1f705c,_0x11223a){return _0x1f705c[_0x8055('0xa')]('SquareOdbc',attributes,{'tableName':_0x8055('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.rpc.js b/server/api/squareOdbc/squareOdbc.rpc.js index c5a3b70..df72a0b 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 _0x2534=['raw','where','attributes','include','map','model','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','SquareOdbc,\x20%s,\x20%s,\x20%s','error','code','SquareOdbc,\x20%s,\x20%s','message','result','ShowSquareOdbc','SquareOdbc','find','options'];(function(_0x569637,_0x169fc0){var _0x3a5b81=function(_0x400153){while(--_0x400153){_0x569637['push'](_0x569637['shift']());}};_0x3a5b81(++_0x169fc0);}(_0x2534,0xb6));var _0x4253=function(_0x2a0703,_0x25bbf0){_0x2a0703=_0x2a0703-0x0;var _0x13efe6=_0x2534[_0x2a0703];return _0x13efe6;};'use strict';var _=require(_0x4253('0x0'));var util=require(_0x4253('0x1'));var moment=require('moment');var BPromise=require(_0x4253('0x2'));var rs=require(_0x4253('0x3'));var fs=require('fs');var Redis=require(_0x4253('0x4'));var db=require(_0x4253('0x5'))['db'];var utils=require(_0x4253('0x6'));var logger=require(_0x4253('0x7'))(_0x4253('0x8'));var config=require(_0x4253('0x9'));var jayson=require(_0x4253('0xa'));var client=jayson[_0x4253('0xb')][_0x4253('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x19ab7e,_0x206ebc,_0x297917){return new BPromise(function(_0x5dad1b,_0x17b804){return client[_0x4253('0xd')](_0x19ab7e,_0x297917)[_0x4253('0xe')](function(_0x53a103){logger[_0x4253('0xf')]('SquareOdbc,\x20%s,\x20%s',_0x206ebc,_0x4253('0x10'));logger[_0x4253('0x11')](_0x4253('0x12'),_0x206ebc,'request\x20sent',JSON['stringify'](_0x53a103));if(_0x53a103[_0x4253('0x13')]){if(_0x53a103[_0x4253('0x13')][_0x4253('0x14')]===0x1f4){logger[_0x4253('0x13')](_0x4253('0x15'),_0x206ebc,_0x53a103[_0x4253('0x13')][_0x4253('0x16')]);return _0x17b804(_0x53a103[_0x4253('0x13')][_0x4253('0x16')]);}logger[_0x4253('0x13')](_0x4253('0x15'),_0x206ebc,_0x53a103[_0x4253('0x13')][_0x4253('0x16')]);return _0x5dad1b(_0x53a103[_0x4253('0x13')][_0x4253('0x16')]);}else{logger[_0x4253('0xf')](_0x4253('0x15'),_0x206ebc,_0x4253('0x10'));_0x5dad1b(_0x53a103[_0x4253('0x17')][_0x4253('0x16')]);}})['catch'](function(_0x212ede){logger[_0x4253('0x13')](_0x4253('0x15'),_0x206ebc,_0x212ede);_0x17b804(_0x212ede);});});}exports[_0x4253('0x18')]=function(_0x47dcb4){var _0x293071=this;return new Promise(function(_0x2b574c,_0xdc2136){return db[_0x4253('0x19')][_0x4253('0x1a')]({'raw':_0x47dcb4[_0x4253('0x1b')]?_0x47dcb4[_0x4253('0x1b')][_0x4253('0x1c')]===undefined?!![]:![]:!![],'where':_0x47dcb4[_0x4253('0x1b')]?_0x47dcb4[_0x4253('0x1b')][_0x4253('0x1d')]||null:null,'attributes':_0x47dcb4['options']?_0x47dcb4['options'][_0x4253('0x1e')]||null:null,'include':_0x47dcb4[_0x4253('0x1b')]?_0x47dcb4[_0x4253('0x1b')][_0x4253('0x1f')]?_['map'](_0x47dcb4[_0x4253('0x1b')][_0x4253('0x1f')],function(_0x427736){return{'model':db[_0x427736['model']],'as':_0x427736['as'],'attributes':_0x427736[_0x4253('0x1e')],'include':_0x427736[_0x4253('0x1f')]?_[_0x4253('0x20')](_0x427736[_0x4253('0x1f')],function(_0x4cf069){return{'model':db[_0x4cf069[_0x4253('0x21')]],'as':_0x4cf069['as'],'attributes':_0x4cf069['attributes'],'include':_0x4cf069[_0x4253('0x1f')]?_['map'](_0x4cf069['include'],function(_0x46d7c3){return{'model':db[_0x46d7c3['model']],'as':_0x46d7c3['as'],'attributes':_0x46d7c3[_0x4253('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x4253('0xe')](function(_0x5290c6){logger[_0x4253('0xf')](_0x4253('0x18'),_0x47dcb4);logger[_0x4253('0x11')]('ShowSquareOdbc',_0x47dcb4,JSON['stringify'](_0x5290c6));_0x2b574c(_0x5290c6);})[_0x4253('0x22')](function(_0x450ec0){logger[_0x4253('0x13')](_0x4253('0x18'),_0x450ec0[_0x4253('0x16')],_0x47dcb4);_0xdc2136(_0x293071[_0x4253('0x13')](0x1f4,_0x450ec0[_0x4253('0x16')]));});});}; \ No newline at end of file +var _0xe3f0=['../../config/utils','rpc','../../config/environment','jayson/promise','then','SquareOdbc,\x20%s,\x20%s','request\x20sent','debug','SquareOdbc,\x20%s,\x20%s,\x20%s','error','code','message','result','SquareOdbc','find','options','raw','where','include','map','attributes','model','ShowSquareOdbc','stringify','catch','lodash','util','moment','randomstring'];(function(_0xb6e43,_0x1568fc){var _0x47c40f=function(_0x107786){while(--_0x107786){_0xb6e43['push'](_0xb6e43['shift']());}};_0x47c40f(++_0x1568fc);}(_0xe3f0,0x158));var _0x0e3f=function(_0xdd2673,_0x360364){_0xdd2673=_0xdd2673-0x0;var _0x3f61eb=_0xe3f0[_0xdd2673];return _0x3f61eb;};'use strict';var _=require(_0x0e3f('0x0'));var util=require(_0x0e3f('0x1'));var moment=require(_0x0e3f('0x2'));var BPromise=require('bluebird');var rs=require(_0x0e3f('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x0e3f('0x4'));var logger=require('../../config/logger')(_0x0e3f('0x5'));var config=require(_0x0e3f('0x6'));var jayson=require(_0x0e3f('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0xedcf9,_0x3b284c,_0x48cd02){return new BPromise(function(_0x31a08f,_0x1f2753){return client['request'](_0xedcf9,_0x48cd02)[_0x0e3f('0x8')](function(_0x4cd8db){logger['info'](_0x0e3f('0x9'),_0x3b284c,_0x0e3f('0xa'));logger[_0x0e3f('0xb')](_0x0e3f('0xc'),_0x3b284c,_0x0e3f('0xa'),JSON['stringify'](_0x4cd8db));if(_0x4cd8db[_0x0e3f('0xd')]){if(_0x4cd8db[_0x0e3f('0xd')][_0x0e3f('0xe')]===0x1f4){logger[_0x0e3f('0xd')](_0x0e3f('0x9'),_0x3b284c,_0x4cd8db['error'][_0x0e3f('0xf')]);return _0x1f2753(_0x4cd8db[_0x0e3f('0xd')][_0x0e3f('0xf')]);}logger[_0x0e3f('0xd')]('SquareOdbc,\x20%s,\x20%s',_0x3b284c,_0x4cd8db[_0x0e3f('0xd')]['message']);return _0x31a08f(_0x4cd8db['error'][_0x0e3f('0xf')]);}else{logger['info'](_0x0e3f('0x9'),_0x3b284c,_0x0e3f('0xa'));_0x31a08f(_0x4cd8db[_0x0e3f('0x10')][_0x0e3f('0xf')]);}})['catch'](function(_0xd99e70){logger['error'](_0x0e3f('0x9'),_0x3b284c,_0xd99e70);_0x1f2753(_0xd99e70);});});}exports['ShowSquareOdbc']=function(_0x431f55){var _0x4be13f=this;return new Promise(function(_0x14f3f7,_0x58a378){return db[_0x0e3f('0x11')][_0x0e3f('0x12')]({'raw':_0x431f55[_0x0e3f('0x13')]?_0x431f55['options'][_0x0e3f('0x14')]===undefined?!![]:![]:!![],'where':_0x431f55[_0x0e3f('0x13')]?_0x431f55[_0x0e3f('0x13')][_0x0e3f('0x15')]||null:null,'attributes':_0x431f55['options']?_0x431f55[_0x0e3f('0x13')]['attributes']||null:null,'include':_0x431f55[_0x0e3f('0x13')]?_0x431f55[_0x0e3f('0x13')][_0x0e3f('0x16')]?_[_0x0e3f('0x17')](_0x431f55[_0x0e3f('0x13')][_0x0e3f('0x16')],function(_0x3578c2){return{'model':db[_0x3578c2['model']],'as':_0x3578c2['as'],'attributes':_0x3578c2[_0x0e3f('0x18')],'include':_0x3578c2[_0x0e3f('0x16')]?_[_0x0e3f('0x17')](_0x3578c2[_0x0e3f('0x16')],function(_0x365f0e){return{'model':db[_0x365f0e[_0x0e3f('0x19')]],'as':_0x365f0e['as'],'attributes':_0x365f0e[_0x0e3f('0x18')],'include':_0x365f0e['include']?_['map'](_0x365f0e[_0x0e3f('0x16')],function(_0x3e3f1e){return{'model':db[_0x3e3f1e[_0x0e3f('0x19')]],'as':_0x3e3f1e['as'],'attributes':_0x3e3f1e['attributes']};}):[]};}):[]};}):[]:[]})[_0x0e3f('0x8')](function(_0x27849e){logger['info'](_0x0e3f('0x1a'),_0x431f55);logger[_0x0e3f('0xb')]('ShowSquareOdbc',_0x431f55,JSON[_0x0e3f('0x1b')](_0x27849e));_0x14f3f7(_0x27849e);})[_0x0e3f('0x1c')](function(_0x493ec0){logger['error'](_0x0e3f('0x1a'),_0x493ec0[_0x0e3f('0xf')],_0x431f55);_0x58a378(_0x4be13f[_0x0e3f('0xd')](0x1f4,_0x493ec0[_0x0e3f('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/index.js b/server/api/squareProject/index.js index f55688a..6cec93d 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 _0x8109=['../../config/environment','./squareProject.controller','get','isAuthenticated','index','/:id','show','/:id/users','getUsers','create','post','update','delete','removeUsers','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x45d55e,_0x2fede3){var _0x29812a=function(_0x3c6830){while(--_0x3c6830){_0x45d55e['push'](_0x45d55e['shift']());}};_0x29812a(++_0x2fede3);}(_0x8109,0xa9));var _0x9810=function(_0x43feeb,_0x4e36ce){_0x43feeb=_0x43feeb-0x0;var _0x13c9b5=_0x8109[_0x43feeb];return _0x13c9b5;};'use strict';var multer=require(_0x9810('0x0'));var util=require('util');var path=require(_0x9810('0x1'));var timeout=require(_0x9810('0x2'));var express=require('express');var router=express[_0x9810('0x3')]();var fs_extra=require(_0x9810('0x4'));var auth=require(_0x9810('0x5'));var interaction=require(_0x9810('0x6'));var config=require(_0x9810('0x7'));var controller=require(_0x9810('0x8'));router[_0x9810('0x9')]('/',auth[_0x9810('0xa')](),controller[_0x9810('0xb')]);router[_0x9810('0x9')](_0x9810('0xc'),auth['isAuthenticated'](),controller[_0x9810('0xd')]);router[_0x9810('0x9')](_0x9810('0xe'),auth[_0x9810('0xa')](),controller[_0x9810('0xf')]);router['post']('/',auth[_0x9810('0xa')](),controller[_0x9810('0x10')]);router[_0x9810('0x11')]('/:id/users',auth[_0x9810('0xa')](),controller['addUsers']);router['put'](_0x9810('0xc'),auth[_0x9810('0xa')](),controller[_0x9810('0x12')]);router[_0x9810('0x13')](_0x9810('0xc'),auth[_0x9810('0xa')](),controller['destroy']);router[_0x9810('0x13')](_0x9810('0xe'),auth[_0x9810('0xa')](),controller[_0x9810('0x14')]);module[_0x9810('0x15')]=router; \ No newline at end of file +var _0x7f7e=['/:id/users','getUsers','post','create','put','delete','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id'];(function(_0x59b439,_0x14ae7b){var _0x521ea3=function(_0x5af627){while(--_0x5af627){_0x59b439['push'](_0x59b439['shift']());}};_0x521ea3(++_0x14ae7b);}(_0x7f7e,0xc6));var _0xe7f7=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0x7f7e[_0x4e676e];return _0x336a3c;};'use strict';var multer=require(_0xe7f7('0x0'));var util=require('util');var path=require(_0xe7f7('0x1'));var timeout=require(_0xe7f7('0x2'));var express=require(_0xe7f7('0x3'));var router=express['Router']();var fs_extra=require(_0xe7f7('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xe7f7('0x5'));var config=require(_0xe7f7('0x6'));var controller=require('./squareProject.controller');router['get']('/',auth[_0xe7f7('0x7')](),controller[_0xe7f7('0x8')]);router[_0xe7f7('0x9')](_0xe7f7('0xa'),auth[_0xe7f7('0x7')](),controller['show']);router[_0xe7f7('0x9')](_0xe7f7('0xb'),auth['isAuthenticated'](),controller[_0xe7f7('0xc')]);router[_0xe7f7('0xd')]('/',auth[_0xe7f7('0x7')](),controller[_0xe7f7('0xe')]);router[_0xe7f7('0xd')]('/:id/users',auth[_0xe7f7('0x7')](),controller['addUsers']);router[_0xe7f7('0xf')](_0xe7f7('0xa'),auth['isAuthenticated'](),controller['update']);router[_0xe7f7('0x10')]('/:id',auth['isAuthenticated'](),controller[_0xe7f7('0x11')]);router[_0xe7f7('0x10')](_0xe7f7('0xb'),auth[_0xe7f7('0x7')](),controller['removeUsers']);module[_0xe7f7('0x12')]=router; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.attributes.js b/server/api/squareProject/squareProject.attributes.js index 0d2dee4..e5c839d 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 _0xc3f3=['getDataValue','preproduction','toString','utf8','production','DATE','exports','STRING','name','TEXT','BLOB','long'];(function(_0x2b6a24,_0x312141){var _0x4a93dd=function(_0x54f1b9){while(--_0x54f1b9){_0x2b6a24['push'](_0x2b6a24['shift']());}};_0x4a93dd(++_0x312141);}(_0xc3f3,0xd2));var _0x3c3f=function(_0xd0acd0,_0x306b08){_0xd0acd0=_0xd0acd0-0x0;var _0x353a1c=_0xc3f3[_0xd0acd0];return _0x353a1c;};'use strict';var Sequelize=require('sequelize');module[_0x3c3f('0x0')]={'name':{'type':Sequelize[_0x3c3f('0x1')],'unique':_0x3c3f('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0x3c3f('0x1')]},'notes':{'type':Sequelize[_0x3c3f('0x3')]},'preproduction':{'type':Sequelize[_0x3c3f('0x4')](_0x3c3f('0x5')),'get':function(){if(this[_0x3c3f('0x6')](_0x3c3f('0x7'))){return this[_0x3c3f('0x6')](_0x3c3f('0x7'))[_0x3c3f('0x8')](_0x3c3f('0x9'));}}},'production':{'type':Sequelize[_0x3c3f('0x4')](_0x3c3f('0x5')),'get':function(){if(this[_0x3c3f('0x6')]('production')){return this[_0x3c3f('0x6')](_0x3c3f('0xa'))['toString'](_0x3c3f('0x9'));}}},'savedAt':{'type':Sequelize[_0x3c3f('0xb')]},'publishedAt':{'type':Sequelize[_0x3c3f('0xb')]}}; \ No newline at end of file +var _0x2c5e=['TEXT','BLOB','getDataValue','preproduction','toString','utf8','long','production','DATE','exports','STRING','name'];(function(_0x5ce43f,_0x168cef){var _0x111d45=function(_0x587309){while(--_0x587309){_0x5ce43f['push'](_0x5ce43f['shift']());}};_0x111d45(++_0x168cef);}(_0x2c5e,0x165));var _0xe2c5=function(_0x3f6c73,_0x3f815f){_0x3f6c73=_0x3f6c73-0x0;var _0x4ab118=_0x2c5e[_0x3f6c73];return _0x4ab118;};'use strict';var Sequelize=require('sequelize');module[_0xe2c5('0x0')]={'name':{'type':Sequelize[_0xe2c5('0x1')],'unique':_0xe2c5('0x2'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'notes':{'type':Sequelize[_0xe2c5('0x3')]},'preproduction':{'type':Sequelize[_0xe2c5('0x4')]('long'),'get':function(){if(this['getDataValue']('preproduction')){return this[_0xe2c5('0x5')](_0xe2c5('0x6'))[_0xe2c5('0x7')](_0xe2c5('0x8'));}}},'production':{'type':Sequelize[_0xe2c5('0x4')](_0xe2c5('0x9')),'get':function(){if(this[_0xe2c5('0x5')]('production')){return this['getDataValue'](_0xe2c5('0xa'))[_0xe2c5('0x7')](_0xe2c5('0x8'));}}},'savedAt':{'type':Sequelize['DATE']},'publishedAt':{'type':Sequelize[_0xe2c5('0xb')]}}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.controller.js b/server/api/squareProject/squareProject.controller.js index 47849be..b09f0f7 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 _0x54f4=['papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./squareProject.socket','register','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range','save','update','then','destroy','get','SquareProjects','UserProfileResource','error','stack','name','send','index','map','SquareProject','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','type','merge','options','includeAll','rows','catch','show','length','include','find','create','body','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','addUsers','ids','omit','removeUsers','isArray','emit','userSquareProject:remove','getUsers','User','order','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring'];(function(_0x4c3c94,_0xd18ede){var _0xa3a025=function(_0x10187d){while(--_0x10187d){_0x4c3c94['push'](_0x4c3c94['shift']());}};_0xa3a025(++_0xd18ede);}(_0x54f4,0x113));var _0x454f=function(_0x562f83,_0x433be8){_0x562f83=_0x562f83-0x0;var _0x7b9cfe=_0x54f4[_0x562f83];return _0x7b9cfe;};'use strict';var emlformat=require(_0x454f('0x0'));var rimraf=require(_0x454f('0x1'));var zipdir=require(_0x454f('0x2'));var jsonpatch=require(_0x454f('0x3'));var rp=require(_0x454f('0x4'));var moment=require(_0x454f('0x5'));var BPromise=require(_0x454f('0x6'));var Mustache=require(_0x454f('0x7'));var util=require('util');var path=require('path');var sox=require(_0x454f('0x8'));var csv=require(_0x454f('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x454f('0xa'));var _=require(_0x454f('0xb'));var squel=require(_0x454f('0xc'));var crypto=require(_0x454f('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x454f('0xe'));var toCsv=require(_0x454f('0x9'));var querystring=require(_0x454f('0xf'));var Papa=require(_0x454f('0x10'));var Redis=require(_0x454f('0x11'));var authService=require(_0x454f('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x454f('0x13'));var hardwareService=require(_0x454f('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x454f('0x15'));var config=require(_0x454f('0x16'));var licenseUtil=require(_0x454f('0x17'));var db=require(_0x454f('0x18'))['db'];config[_0x454f('0x19')]=_[_0x454f('0x1a')](config['redis'],{'host':_0x454f('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x454f('0x19')]));require(_0x454f('0x1c'))[_0x454f('0x1d')](socket);function respondWithStatusCode(_0x52734d,_0x188d63){_0x188d63=_0x188d63||0xcc;return function(_0x4420c3){if(_0x4420c3){return _0x52734d[_0x454f('0x1e')](_0x188d63);}return _0x52734d['status'](_0x188d63)[_0x454f('0x1f')]();};}function respondWithResult(_0x2053ac,_0x1c7f65){_0x1c7f65=_0x1c7f65||0xc8;return function(_0x484a51){if(_0x484a51){return _0x2053ac[_0x454f('0x20')](_0x1c7f65)[_0x454f('0x21')](_0x484a51);}};}function respondWithFilteredResult(_0x4512e3,_0x18daff){return function(_0x4d30a3){if(_0x4d30a3){var _0xca81fe=typeof _0x18daff[_0x454f('0x22')]===_0x454f('0x23')&&typeof _0x18daff[_0x454f('0x24')]===_0x454f('0x23');var _0x3622a6=_0x4d30a3[_0x454f('0x25')];var _0x2683d1=_0xca81fe?0x0:_0x18daff[_0x454f('0x22')];var _0x3a697c=_0xca81fe?_0x4d30a3['count']:_0x18daff[_0x454f('0x22')]+_0x18daff[_0x454f('0x24')];var _0xca00b4;if(_0x3a697c>=_0x3622a6){_0x3a697c=_0x3622a6;_0xca00b4=0xc8;}else{_0xca00b4=0xce;}_0x4512e3[_0x454f('0x20')](_0xca00b4);return _0x4512e3['set'](_0x454f('0x26'),_0x2683d1+'-'+_0x3a697c+'/'+_0x3622a6)['json'](_0x4d30a3);}return null;};}function patchUpdates(_0x1ad75c){return function(_0x5a08bf){try{jsonpatch['apply'](_0x5a08bf,_0x1ad75c,!![]);}catch(_0x3c8aee){return BPromise['reject'](_0x3c8aee);}return _0x5a08bf[_0x454f('0x27')]();};}function saveUpdates(_0x487f3c,_0x26b3c3){return function(_0x2dec85){if(_0x2dec85){return _0x2dec85[_0x454f('0x28')](_0x487f3c)[_0x454f('0x29')](function(_0x20f72a){return _0x20f72a;});}return null;};}function removeEntity(_0x21b754,_0x126223){return function(_0x147d2d){if(_0x147d2d){return _0x147d2d[_0x454f('0x2a')]()[_0x454f('0x29')](function(){var _0x3936b6=_0x147d2d[_0x454f('0x2b')]({'plain':!![]});var _0x54d481=_0x454f('0x2c');return db[_0x454f('0x2d')]['destroy']({'where':{'type':_0x54d481,'resourceId':_0x3936b6['id']}})[_0x454f('0x29')](function(){return _0x147d2d;});})[_0x454f('0x29')](function(){_0x21b754[_0x454f('0x20')](0xcc)[_0x454f('0x1f')]();});}};}function handleEntityNotFound(_0x250538,_0x46aff2){return function(_0x4037a0){if(!_0x4037a0){_0x250538[_0x454f('0x1e')](0x194);}return _0x4037a0;};}function handleError(_0x5953cf,_0x3d8ed1){_0x3d8ed1=_0x3d8ed1||0x1f4;return function(_0x44ad2c){logger[_0x454f('0x2e')](_0x44ad2c[_0x454f('0x2f')]);if(_0x44ad2c[_0x454f('0x30')]){delete _0x44ad2c[_0x454f('0x30')];}_0x5953cf[_0x454f('0x20')](_0x3d8ed1)[_0x454f('0x31')](_0x44ad2c);};}exports[_0x454f('0x32')]=function(_0x6b49bf,_0x431544){var _0xa8d8ce={},_0x4fc361={},_0x544f10={'count':0x0,'rows':[]};var _0x308f47=_[_0x454f('0x33')](db[_0x454f('0x34')][_0x454f('0x35')],function(_0x62e360){return{'name':_0x62e360['fieldName'],'type':_0x62e360['type'][_0x454f('0x36')]};});_0x4fc361[_0x454f('0x37')]=_['map'](_0x308f47,'name');_0x4fc361[_0x454f('0x38')]=_[_0x454f('0x39')](_0x6b49bf[_0x454f('0x38')]);_0x4fc361[_0x454f('0x3a')]=_[_0x454f('0x3b')](_0x4fc361[_0x454f('0x37')],_0x4fc361[_0x454f('0x38')]);_0xa8d8ce[_0x454f('0x3c')]=_[_0x454f('0x3b')](_0x4fc361[_0x454f('0x37')],qs['fields'](_0x6b49bf[_0x454f('0x38')][_0x454f('0x3d')]));_0xa8d8ce[_0x454f('0x3c')]=_0xa8d8ce[_0x454f('0x3c')]['length']?_0xa8d8ce[_0x454f('0x3c')]:_0x4fc361['model'];if(!_0x6b49bf[_0x454f('0x38')][_0x454f('0x3e')](_0x454f('0x3f'))){_0xa8d8ce['limit']=qs[_0x454f('0x24')](_0x6b49bf[_0x454f('0x38')]['limit']);_0xa8d8ce[_0x454f('0x22')]=qs[_0x454f('0x22')](_0x6b49bf[_0x454f('0x38')][_0x454f('0x22')]);}_0xa8d8ce['order']=qs[_0x454f('0x40')](_0x6b49bf[_0x454f('0x38')][_0x454f('0x40')]);_0xa8d8ce[_0x454f('0x41')]=qs[_0x454f('0x3a')](_[_0x454f('0x42')](_0x6b49bf[_0x454f('0x38')],_0x4fc361[_0x454f('0x3a')]),_0x308f47);if(_0x6b49bf['query'][_0x454f('0x43')]){_0xa8d8ce[_0x454f('0x41')]=_['merge'](_0xa8d8ce['where'],{'$or':_[_0x454f('0x33')](_0x308f47,function(_0x13a67e){if(_0x13a67e[_0x454f('0x44')]!=='VIRTUAL'){var _0x50faeb={};_0x50faeb[_0x13a67e[_0x454f('0x30')]]={'$like':'%'+_0x6b49bf[_0x454f('0x38')][_0x454f('0x43')]+'%'};return _0x50faeb;}})});}_0xa8d8ce=_[_0x454f('0x45')]({},_0xa8d8ce,_0x6b49bf[_0x454f('0x46')]);var _0x8cb191={'where':_0xa8d8ce[_0x454f('0x41')]};return db[_0x454f('0x34')][_0x454f('0x25')](_0x8cb191)[_0x454f('0x29')](function(_0x509c68){_0x544f10[_0x454f('0x25')]=_0x509c68;if(_0x6b49bf[_0x454f('0x38')][_0x454f('0x47')]){_0xa8d8ce['include']=[{'all':!![]}];}return db[_0x454f('0x34')]['findAll'](_0xa8d8ce);})[_0x454f('0x29')](function(_0x3a858c){_0x544f10[_0x454f('0x48')]=_0x3a858c;return _0x544f10;})[_0x454f('0x29')](respondWithFilteredResult(_0x431544,_0xa8d8ce))[_0x454f('0x49')](handleError(_0x431544,null));};exports[_0x454f('0x4a')]=function(_0x1b288e,_0xa1f2b8){var _0x3e9c59={'raw':![],'where':{'id':_0x1b288e['params']['id']}},_0x2e141b={};_0x2e141b['model']=_[_0x454f('0x39')](db[_0x454f('0x34')][_0x454f('0x35')]);_0x2e141b['query']=_[_0x454f('0x39')](_0x1b288e[_0x454f('0x38')]);_0x2e141b[_0x454f('0x3a')]=_[_0x454f('0x3b')](_0x2e141b[_0x454f('0x37')],_0x2e141b[_0x454f('0x38')]);_0x3e9c59[_0x454f('0x3c')]=_[_0x454f('0x3b')](_0x2e141b[_0x454f('0x37')],qs['fields'](_0x1b288e[_0x454f('0x38')][_0x454f('0x3d')]));_0x3e9c59['attributes']=_0x3e9c59[_0x454f('0x3c')][_0x454f('0x4b')]?_0x3e9c59[_0x454f('0x3c')]:_0x2e141b[_0x454f('0x37')];if(_0x1b288e['query'][_0x454f('0x47')]){_0x3e9c59[_0x454f('0x4c')]=[{'all':!![]}];}_0x3e9c59=_[_0x454f('0x45')]({},_0x3e9c59,_0x1b288e[_0x454f('0x46')]);return db[_0x454f('0x34')][_0x454f('0x4d')](_0x3e9c59)[_0x454f('0x29')](handleEntityNotFound(_0xa1f2b8,null))[_0x454f('0x29')](respondWithResult(_0xa1f2b8,null))[_0x454f('0x49')](handleError(_0xa1f2b8,null));};exports[_0x454f('0x4e')]=function(_0x524e4f,_0x31851d){return db[_0x454f('0x34')][_0x454f('0x4e')](_0x524e4f[_0x454f('0x4f')],{})[_0x454f('0x29')](function(_0x1ef6e4){var _0x5e40a0=_0x524e4f['user'][_0x454f('0x2b')]({'plain':!![]});if(!_0x5e40a0)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5e40a0[_0x454f('0x50')]===_0x454f('0x51')){var _0x19fae0=_0x1ef6e4[_0x454f('0x2b')]({'plain':!![]});var _0x8492fc=_0x454f('0x2c');return db[_0x454f('0x52')][_0x454f('0x4d')]({'where':{'name':_0x8492fc,'userProfileId':_0x5e40a0[_0x454f('0x53')]},'raw':!![]})[_0x454f('0x29')](function(_0x2ae638){if(_0x2ae638&&_0x2ae638[_0x454f('0x54')]===0x0){return db['UserProfileResource'][_0x454f('0x4e')]({'name':_0x19fae0['name'],'resourceId':_0x19fae0['id'],'type':_0x2ae638[_0x454f('0x30')],'sectionId':_0x2ae638['id']},{})[_0x454f('0x29')](function(){return _0x1ef6e4;});}else{return _0x1ef6e4;}})[_0x454f('0x49')](function(_0xfaacb6){logger['error'](_0x454f('0x55'),_0xfaacb6);throw _0xfaacb6;});}return _0x1ef6e4;})['then'](respondWithResult(_0x31851d,0xc9))[_0x454f('0x49')](handleError(_0x31851d,null));};exports[_0x454f('0x28')]=function(_0x59893a,_0x2d005f){if(_0x59893a[_0x454f('0x4f')]['id']){delete _0x59893a[_0x454f('0x4f')]['id'];}return db[_0x454f('0x34')]['find']({'where':{'id':_0x59893a[_0x454f('0x56')]['id']}})[_0x454f('0x29')](handleEntityNotFound(_0x2d005f,null))[_0x454f('0x29')](saveUpdates(_0x59893a[_0x454f('0x4f')],null))['then'](respondWithResult(_0x2d005f,null))['catch'](handleError(_0x2d005f,null));};exports['destroy']=function(_0x2767f6,_0x209b06){return db['SquareProject'][_0x454f('0x4d')]({'where':{'id':_0x2767f6[_0x454f('0x56')]['id']}})[_0x454f('0x29')](handleEntityNotFound(_0x209b06,null))['then'](removeEntity(_0x209b06,null))[_0x454f('0x49')](handleError(_0x209b06,null));};exports[_0x454f('0x57')]=function(_0x2f929e,_0x98fde0,_0x14f5b7){return db[_0x454f('0x34')][_0x454f('0x4d')]({'where':{'id':_0x2f929e[_0x454f('0x56')]['id']}})[_0x454f('0x29')](handleEntityNotFound(_0x98fde0,null))[_0x454f('0x29')](function(_0x32195f){if(_0x32195f){return _0x32195f[_0x454f('0x57')](_0x2f929e[_0x454f('0x4f')][_0x454f('0x58')],_[_0x454f('0x59')](_0x2f929e[_0x454f('0x4f')],[_0x454f('0x58'),'id'])||{});}})[_0x454f('0x29')](respondWithResult(_0x98fde0,null))[_0x454f('0x49')](handleError(_0x98fde0,null));};exports['removeUsers']=function(_0x1715dc,_0x5240fb,_0x428b53){return db[_0x454f('0x34')][_0x454f('0x4d')]({'where':{'id':_0x1715dc[_0x454f('0x56')]['id']}})[_0x454f('0x29')](handleEntityNotFound(_0x5240fb,null))[_0x454f('0x29')](function(_0x1a0717){if(_0x1a0717){return _0x1a0717[_0x454f('0x5a')](_0x1715dc[_0x454f('0x38')][_0x454f('0x58')])['then'](function(){if(_[_0x454f('0x5b')](_0x1715dc[_0x454f('0x38')][_0x454f('0x58')])){for(var _0x38cbbe=0x0;_0x38cbbe<_0x1715dc[_0x454f('0x38')]['ids'][_0x454f('0x4b')];_0x38cbbe+=0x1){socket[_0x454f('0x5c')](_0x454f('0x5d'),{'UserId':Number(_0x1715dc[_0x454f('0x38')][_0x454f('0x58')][_0x38cbbe]),'SquareProjectId':Number(_0x1715dc[_0x454f('0x56')]['id'])});}}else{socket[_0x454f('0x5c')]('userSquareProject:remove',{'UserId':Number(_0x1715dc[_0x454f('0x38')][_0x454f('0x58')]),'SquareProjectId':Number(_0x1715dc['params']['id'])});}});}})[_0x454f('0x29')](respondWithStatusCode(_0x5240fb,null))[_0x454f('0x49')](handleError(_0x5240fb,null));};exports[_0x454f('0x5e')]=function(_0x9a99de,_0x3855c5,_0x4b7ddb){var _0x20ca87={};var _0x1caf6f={};var _0x21d8e6;var _0x25335d;return db[_0x454f('0x34')]['findOne']({'where':{'id':_0x9a99de[_0x454f('0x56')]['id']}})[_0x454f('0x29')](handleEntityNotFound(_0x3855c5,null))[_0x454f('0x29')](function(_0xd8b49c){if(_0xd8b49c){_0x21d8e6=_0xd8b49c;_0x1caf6f['model']=_[_0x454f('0x39')](db[_0x454f('0x5f')]['rawAttributes']);_0x1caf6f[_0x454f('0x38')]=_[_0x454f('0x39')](_0x9a99de[_0x454f('0x38')]);_0x1caf6f[_0x454f('0x3a')]=_[_0x454f('0x3b')](_0x1caf6f[_0x454f('0x37')],_0x1caf6f[_0x454f('0x38')]);_0x20ca87[_0x454f('0x3c')]=_[_0x454f('0x3b')](_0x1caf6f[_0x454f('0x37')],qs[_0x454f('0x3d')](_0x9a99de['query']['fields']));_0x20ca87['attributes']=_0x20ca87[_0x454f('0x3c')][_0x454f('0x4b')]?_0x20ca87[_0x454f('0x3c')]:_0x1caf6f[_0x454f('0x37')];_0x20ca87[_0x454f('0x60')]=qs['sort'](_0x9a99de[_0x454f('0x38')][_0x454f('0x40')]);_0x20ca87[_0x454f('0x41')]=qs[_0x454f('0x3a')](_[_0x454f('0x42')](_0x9a99de[_0x454f('0x38')],_0x1caf6f[_0x454f('0x3a')]));if(_0x9a99de[_0x454f('0x38')]['filter']){_0x20ca87[_0x454f('0x41')]=_['merge'](_0x20ca87[_0x454f('0x41')],{'$or':_[_0x454f('0x33')](_0x20ca87['attributes'],function(_0x3b4f36){var _0xec3ed7={};_0xec3ed7[_0x3b4f36]={'$like':'%'+_0x9a99de[_0x454f('0x38')][_0x454f('0x43')]+'%'};return _0xec3ed7;})});}_0x20ca87=_[_0x454f('0x45')]({},_0x20ca87,_0x9a99de[_0x454f('0x46')]);return _0x21d8e6[_0x454f('0x5e')](_0x20ca87);}})[_0x454f('0x29')](function(_0x3e9e2f){if(_0x3e9e2f){_0x25335d=_0x3e9e2f[_0x454f('0x4b')];if(!_0x9a99de[_0x454f('0x38')][_0x454f('0x3e')](_0x454f('0x3f'))){_0x20ca87[_0x454f('0x24')]=qs['limit'](_0x9a99de[_0x454f('0x38')][_0x454f('0x24')]);_0x20ca87['offset']=qs[_0x454f('0x22')](_0x9a99de[_0x454f('0x38')][_0x454f('0x22')]);}return _0x21d8e6[_0x454f('0x5e')](_0x20ca87);}})['then'](function(_0x5b4640){if(_0x5b4640){return _0x5b4640?{'count':_0x25335d,'rows':_0x5b4640}:null;}})[_0x454f('0x29')](respondWithResult(_0x3855c5,null))['catch'](handleError(_0x3855c5,null));}; \ No newline at end of file +var _0xe18e=['update','then','destroy','SquareProjects','UserProfileResource','error','stack','name','send','index','SquareProject','rawAttributes','fieldName','type','key','model','map','query','filters','attributes','fields','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','keys','intersection','options','find','create','get','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','addUsers','ids','omit','removeUsers','isArray','length','emit','userSquareProject:remove','getUsers','findOne','User','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','ejs','lodash','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./squareProject.socket','register','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','apply','save'];(function(_0x422905,_0x3bce3a){var _0x33dc6c=function(_0x4852c9){while(--_0x4852c9){_0x422905['push'](_0x422905['shift']());}};_0x33dc6c(++_0x3bce3a);}(_0xe18e,0x1b7));var _0xee18=function(_0x538c3a,_0x4e8042){_0x538c3a=_0x538c3a-0x0;var _0x5570ce=_0xe18e[_0x538c3a];return _0x5570ce;};'use strict';var emlformat=require(_0xee18('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xee18('0x1'));var jsonpatch=require(_0xee18('0x2'));var rp=require(_0xee18('0x3'));var moment=require('moment');var BPromise=require(_0xee18('0x4'));var Mustache=require(_0xee18('0x5'));var util=require(_0xee18('0x6'));var path=require('path');var sox=require(_0xee18('0x7'));var csv=require('to-csv');var ejs=require(_0xee18('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xee18('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xee18('0xa'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xee18('0xb'));var Redis=require(_0xee18('0xc'));var authService=require(_0xee18('0xd'));var qs=require(_0xee18('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xee18('0xf'));var logger=require('../../config/logger')('api');var utils=require(_0xee18('0x10'));var config=require(_0xee18('0x11'));var licenseUtil=require(_0xee18('0x12'));var db=require(_0xee18('0x13'))['db'];config[_0xee18('0x14')]=_[_0xee18('0x15')](config[_0xee18('0x14')],{'host':'localhost','port':0x18eb});var socket=require(_0xee18('0x16'))(new Redis(config[_0xee18('0x14')]));require(_0xee18('0x17'))[_0xee18('0x18')](socket);function respondWithStatusCode(_0x5cbf96,_0x15fcdf){_0x15fcdf=_0x15fcdf||0xcc;return function(_0x4ad0f7){if(_0x4ad0f7){return _0x5cbf96[_0xee18('0x19')](_0x15fcdf);}return _0x5cbf96[_0xee18('0x1a')](_0x15fcdf)[_0xee18('0x1b')]();};}function respondWithResult(_0x5dd29f,_0x20e46b){_0x20e46b=_0x20e46b||0xc8;return function(_0x25ccb5){if(_0x25ccb5){return _0x5dd29f['status'](_0x20e46b)['json'](_0x25ccb5);}};}function respondWithFilteredResult(_0x2bed2a,_0x4a1135){return function(_0x40707f){if(_0x40707f){var _0x498c97=typeof _0x4a1135[_0xee18('0x1c')]===_0xee18('0x1d')&&typeof _0x4a1135[_0xee18('0x1e')]===_0xee18('0x1d');var _0x13055b=_0x40707f[_0xee18('0x1f')];var _0x5e7321=_0x498c97?0x0:_0x4a1135[_0xee18('0x1c')];var _0x2e92ff=_0x498c97?_0x40707f[_0xee18('0x1f')]:_0x4a1135['offset']+_0x4a1135['limit'];var _0x1a1940;if(_0x2e92ff>=_0x13055b){_0x2e92ff=_0x13055b;_0x1a1940=0xc8;}else{_0x1a1940=0xce;}_0x2bed2a[_0xee18('0x1a')](_0x1a1940);return _0x2bed2a[_0xee18('0x20')](_0xee18('0x21'),_0x5e7321+'-'+_0x2e92ff+'/'+_0x13055b)['json'](_0x40707f);}return null;};}function patchUpdates(_0x102e56){return function(_0x4ee7a2){try{jsonpatch[_0xee18('0x22')](_0x4ee7a2,_0x102e56,!![]);}catch(_0x3d55c2){return BPromise['reject'](_0x3d55c2);}return _0x4ee7a2[_0xee18('0x23')]();};}function saveUpdates(_0x2809b6,_0x225e8a){return function(_0x55a4b7){if(_0x55a4b7){return _0x55a4b7[_0xee18('0x24')](_0x2809b6)[_0xee18('0x25')](function(_0x510ca7){return _0x510ca7;});}return null;};}function removeEntity(_0x4e5432,_0x66e3b3){return function(_0x5f4144){if(_0x5f4144){return _0x5f4144[_0xee18('0x26')]()[_0xee18('0x25')](function(){var _0x12a1d9=_0x5f4144['get']({'plain':!![]});var _0x28b389=_0xee18('0x27');return db[_0xee18('0x28')][_0xee18('0x26')]({'where':{'type':_0x28b389,'resourceId':_0x12a1d9['id']}})['then'](function(){return _0x5f4144;});})[_0xee18('0x25')](function(){_0x4e5432['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x43d483,_0x49e495){return function(_0x126353){if(!_0x126353){_0x43d483[_0xee18('0x19')](0x194);}return _0x126353;};}function handleError(_0x565d54,_0x4a4bff){_0x4a4bff=_0x4a4bff||0x1f4;return function(_0x48639c){logger[_0xee18('0x29')](_0x48639c[_0xee18('0x2a')]);if(_0x48639c[_0xee18('0x2b')]){delete _0x48639c[_0xee18('0x2b')];}_0x565d54[_0xee18('0x1a')](_0x4a4bff)[_0xee18('0x2c')](_0x48639c);};}exports[_0xee18('0x2d')]=function(_0x3f1496,_0xe23f98){var _0x191b1f={},_0x1c8e25={},_0x30010d={'count':0x0,'rows':[]};var _0x4766a9=_['map'](db[_0xee18('0x2e')][_0xee18('0x2f')],function(_0x267905){return{'name':_0x267905[_0xee18('0x30')],'type':_0x267905[_0xee18('0x31')][_0xee18('0x32')]};});_0x1c8e25[_0xee18('0x33')]=_[_0xee18('0x34')](_0x4766a9,_0xee18('0x2b'));_0x1c8e25[_0xee18('0x35')]=_['keys'](_0x3f1496[_0xee18('0x35')]);_0x1c8e25[_0xee18('0x36')]=_['intersection'](_0x1c8e25['model'],_0x1c8e25[_0xee18('0x35')]);_0x191b1f[_0xee18('0x37')]=_['intersection'](_0x1c8e25[_0xee18('0x33')],qs[_0xee18('0x38')](_0x3f1496['query'][_0xee18('0x38')]));_0x191b1f[_0xee18('0x37')]=_0x191b1f['attributes']['length']?_0x191b1f[_0xee18('0x37')]:_0x1c8e25[_0xee18('0x33')];if(!_0x3f1496[_0xee18('0x35')]['hasOwnProperty'](_0xee18('0x39'))){_0x191b1f[_0xee18('0x1e')]=qs[_0xee18('0x1e')](_0x3f1496[_0xee18('0x35')][_0xee18('0x1e')]);_0x191b1f[_0xee18('0x1c')]=qs['offset'](_0x3f1496['query'][_0xee18('0x1c')]);}_0x191b1f[_0xee18('0x3a')]=qs[_0xee18('0x3b')](_0x3f1496[_0xee18('0x35')][_0xee18('0x3b')]);_0x191b1f[_0xee18('0x3c')]=qs[_0xee18('0x36')](_[_0xee18('0x3d')](_0x3f1496['query'],_0x1c8e25[_0xee18('0x36')]),_0x4766a9);if(_0x3f1496[_0xee18('0x35')][_0xee18('0x3e')]){_0x191b1f['where']=_[_0xee18('0x3f')](_0x191b1f[_0xee18('0x3c')],{'$or':_[_0xee18('0x34')](_0x4766a9,function(_0x41338e){if(_0x41338e['type']!==_0xee18('0x40')){var _0x2a519b={};_0x2a519b[_0x41338e[_0xee18('0x2b')]]={'$like':'%'+_0x3f1496[_0xee18('0x35')][_0xee18('0x3e')]+'%'};return _0x2a519b;}})});}_0x191b1f=_[_0xee18('0x3f')]({},_0x191b1f,_0x3f1496['options']);var _0x4a9abd={'where':_0x191b1f['where']};return db[_0xee18('0x2e')][_0xee18('0x1f')](_0x4a9abd)['then'](function(_0x46699f){_0x30010d[_0xee18('0x1f')]=_0x46699f;if(_0x3f1496[_0xee18('0x35')][_0xee18('0x41')]){_0x191b1f[_0xee18('0x42')]=[{'all':!![]}];}return db[_0xee18('0x2e')][_0xee18('0x43')](_0x191b1f);})[_0xee18('0x25')](function(_0x185295){_0x30010d[_0xee18('0x44')]=_0x185295;return _0x30010d;})['then'](respondWithFilteredResult(_0xe23f98,_0x191b1f))[_0xee18('0x45')](handleError(_0xe23f98,null));};exports[_0xee18('0x46')]=function(_0x102317,_0x3d71d2){var _0x5dd26e={'raw':![],'where':{'id':_0x102317[_0xee18('0x47')]['id']}},_0x210dbb={};_0x210dbb['model']=_[_0xee18('0x48')](db[_0xee18('0x2e')][_0xee18('0x2f')]);_0x210dbb[_0xee18('0x35')]=_[_0xee18('0x48')](_0x102317[_0xee18('0x35')]);_0x210dbb[_0xee18('0x36')]=_[_0xee18('0x49')](_0x210dbb[_0xee18('0x33')],_0x210dbb[_0xee18('0x35')]);_0x5dd26e['attributes']=_['intersection'](_0x210dbb[_0xee18('0x33')],qs['fields'](_0x102317[_0xee18('0x35')][_0xee18('0x38')]));_0x5dd26e[_0xee18('0x37')]=_0x5dd26e[_0xee18('0x37')]['length']?_0x5dd26e[_0xee18('0x37')]:_0x210dbb[_0xee18('0x33')];if(_0x102317[_0xee18('0x35')][_0xee18('0x41')]){_0x5dd26e[_0xee18('0x42')]=[{'all':!![]}];}_0x5dd26e=_[_0xee18('0x3f')]({},_0x5dd26e,_0x102317[_0xee18('0x4a')]);return db['SquareProject'][_0xee18('0x4b')](_0x5dd26e)[_0xee18('0x25')](handleEntityNotFound(_0x3d71d2,null))[_0xee18('0x25')](respondWithResult(_0x3d71d2,null))[_0xee18('0x45')](handleError(_0x3d71d2,null));};exports[_0xee18('0x4c')]=function(_0x481f4b,_0x40235e){return db['SquareProject']['create'](_0x481f4b['body'],{})['then'](function(_0x504094){var _0x3cedda=_0x481f4b['user'][_0xee18('0x4d')]({'plain':!![]});if(!_0x3cedda)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3cedda[_0xee18('0x4e')]==='user'){var _0x3c11ee=_0x504094['get']({'plain':!![]});var _0x1bea6e=_0xee18('0x27');return db[_0xee18('0x4f')][_0xee18('0x4b')]({'where':{'name':_0x1bea6e,'userProfileId':_0x3cedda[_0xee18('0x50')]},'raw':!![]})['then'](function(_0x5749dc){if(_0x5749dc&&_0x5749dc[_0xee18('0x51')]===0x0){return db[_0xee18('0x28')]['create']({'name':_0x3c11ee[_0xee18('0x2b')],'resourceId':_0x3c11ee['id'],'type':_0x5749dc[_0xee18('0x2b')],'sectionId':_0x5749dc['id']},{})[_0xee18('0x25')](function(){return _0x504094;});}else{return _0x504094;}})[_0xee18('0x45')](function(_0x1cb0da){logger['error'](_0xee18('0x52'),_0x1cb0da);throw _0x1cb0da;});}return _0x504094;})['then'](respondWithResult(_0x40235e,0xc9))['catch'](handleError(_0x40235e,null));};exports[_0xee18('0x24')]=function(_0x426c89,_0x3e8a75){if(_0x426c89['body']['id']){delete _0x426c89['body']['id'];}return db[_0xee18('0x2e')][_0xee18('0x4b')]({'where':{'id':_0x426c89[_0xee18('0x47')]['id']}})[_0xee18('0x25')](handleEntityNotFound(_0x3e8a75,null))[_0xee18('0x25')](saveUpdates(_0x426c89[_0xee18('0x53')],null))[_0xee18('0x25')](respondWithResult(_0x3e8a75,null))[_0xee18('0x45')](handleError(_0x3e8a75,null));};exports[_0xee18('0x26')]=function(_0x2ae85b,_0x19d11b){return db['SquareProject'][_0xee18('0x4b')]({'where':{'id':_0x2ae85b[_0xee18('0x47')]['id']}})['then'](handleEntityNotFound(_0x19d11b,null))['then'](removeEntity(_0x19d11b,null))[_0xee18('0x45')](handleError(_0x19d11b,null));};exports[_0xee18('0x54')]=function(_0x20d0c5,_0x3d2084,_0x132ab6){return db[_0xee18('0x2e')][_0xee18('0x4b')]({'where':{'id':_0x20d0c5[_0xee18('0x47')]['id']}})['then'](handleEntityNotFound(_0x3d2084,null))[_0xee18('0x25')](function(_0x57e0b0){if(_0x57e0b0){return _0x57e0b0[_0xee18('0x54')](_0x20d0c5[_0xee18('0x53')][_0xee18('0x55')],_[_0xee18('0x56')](_0x20d0c5[_0xee18('0x53')],['ids','id'])||{});}})['then'](respondWithResult(_0x3d2084,null))[_0xee18('0x45')](handleError(_0x3d2084,null));};exports['removeUsers']=function(_0x29af9b,_0x31db85,_0x37e35d){return db['SquareProject'][_0xee18('0x4b')]({'where':{'id':_0x29af9b[_0xee18('0x47')]['id']}})['then'](handleEntityNotFound(_0x31db85,null))['then'](function(_0x145a35){if(_0x145a35){return _0x145a35[_0xee18('0x57')](_0x29af9b[_0xee18('0x35')][_0xee18('0x55')])[_0xee18('0x25')](function(){if(_[_0xee18('0x58')](_0x29af9b[_0xee18('0x35')][_0xee18('0x55')])){for(var _0x30c909=0x0;_0x30c909<_0x29af9b['query'][_0xee18('0x55')][_0xee18('0x59')];_0x30c909+=0x1){socket[_0xee18('0x5a')](_0xee18('0x5b'),{'UserId':Number(_0x29af9b[_0xee18('0x35')][_0xee18('0x55')][_0x30c909]),'SquareProjectId':Number(_0x29af9b[_0xee18('0x47')]['id'])});}}else{socket['emit'](_0xee18('0x5b'),{'UserId':Number(_0x29af9b['query'][_0xee18('0x55')]),'SquareProjectId':Number(_0x29af9b[_0xee18('0x47')]['id'])});}});}})['then'](respondWithStatusCode(_0x31db85,null))['catch'](handleError(_0x31db85,null));};exports[_0xee18('0x5c')]=function(_0x331038,_0x4be92,_0x2315a0){var _0x163ae9={};var _0x59c61d={};var _0x310860;var _0x590024;return db[_0xee18('0x2e')][_0xee18('0x5d')]({'where':{'id':_0x331038['params']['id']}})[_0xee18('0x25')](handleEntityNotFound(_0x4be92,null))[_0xee18('0x25')](function(_0x155c28){if(_0x155c28){_0x310860=_0x155c28;_0x59c61d[_0xee18('0x33')]=_[_0xee18('0x48')](db[_0xee18('0x5e')][_0xee18('0x2f')]);_0x59c61d[_0xee18('0x35')]=_[_0xee18('0x48')](_0x331038[_0xee18('0x35')]);_0x59c61d[_0xee18('0x36')]=_[_0xee18('0x49')](_0x59c61d[_0xee18('0x33')],_0x59c61d['query']);_0x163ae9[_0xee18('0x37')]=_[_0xee18('0x49')](_0x59c61d[_0xee18('0x33')],qs['fields'](_0x331038[_0xee18('0x35')]['fields']));_0x163ae9['attributes']=_0x163ae9[_0xee18('0x37')][_0xee18('0x59')]?_0x163ae9['attributes']:_0x59c61d[_0xee18('0x33')];_0x163ae9['order']=qs[_0xee18('0x3b')](_0x331038[_0xee18('0x35')][_0xee18('0x3b')]);_0x163ae9[_0xee18('0x3c')]=qs['filters'](_['pick'](_0x331038['query'],_0x59c61d[_0xee18('0x36')]));if(_0x331038[_0xee18('0x35')]['filter']){_0x163ae9['where']=_[_0xee18('0x3f')](_0x163ae9[_0xee18('0x3c')],{'$or':_['map'](_0x163ae9[_0xee18('0x37')],function(_0x4b896d){var _0x3d30a3={};_0x3d30a3[_0x4b896d]={'$like':'%'+_0x331038[_0xee18('0x35')][_0xee18('0x3e')]+'%'};return _0x3d30a3;})});}_0x163ae9=_[_0xee18('0x3f')]({},_0x163ae9,_0x331038[_0xee18('0x4a')]);return _0x310860[_0xee18('0x5c')](_0x163ae9);}})[_0xee18('0x25')](function(_0x46a99f){if(_0x46a99f){_0x590024=_0x46a99f[_0xee18('0x59')];if(!_0x331038['query']['hasOwnProperty'](_0xee18('0x39'))){_0x163ae9[_0xee18('0x1e')]=qs['limit'](_0x331038[_0xee18('0x35')]['limit']);_0x163ae9[_0xee18('0x1c')]=qs['offset'](_0x331038[_0xee18('0x35')][_0xee18('0x1c')]);}return _0x310860[_0xee18('0x5c')](_0x163ae9);}})[_0xee18('0x25')](function(_0x5d7ebf){if(_0x5d7ebf){return _0x5d7ebf?{'count':_0x590024,'rows':_0x5d7ebf}:null;}})[_0xee18('0x25')](respondWithResult(_0x4be92,null))[_0xee18('0x45')](handleError(_0x4be92,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index 3a7f722..82f5f48 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 _0x431d=['setMaxListeners','save','update','emit','hasOwnProperty','hook','events'];(function(_0x1484b1,_0x55c74e){var _0x3c1025=function(_0x432892){while(--_0x432892){_0x1484b1['push'](_0x1484b1['shift']());}};_0x3c1025(++_0x55c74e);}(_0x431d,0x1c6));var _0xd431=function(_0x2ece52,_0x538ee5){_0x2ece52=_0x2ece52-0x0;var _0x585ea8=_0x431d[_0x2ece52];return _0x585ea8;};'use strict';var EventEmitter=require(_0xd431('0x0'));var SquareProject=require('../../mysqldb')['db']['SquareProject'];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0xd431('0x1')](0x0);var events={'afterCreate':_0xd431('0x2'),'afterUpdate':_0xd431('0x3'),'afterDestroy':'remove'};function emitEvent(_0x468512){return function(_0x399bdc,_0x4687d3,_0x5ed641){SquareProjectEvents[_0xd431('0x4')](_0x468512+':'+_0x399bdc['id'],_0x399bdc);SquareProjectEvents[_0xd431('0x4')](_0x468512,_0x399bdc);_0x5ed641(null);};}for(var e in events){if(events[_0xd431('0x5')](e)){var event=events[e];SquareProject[_0xd431('0x6')](e,emitEvent(event));}}module['exports']=SquareProjectEvents; \ No newline at end of file +var _0x0202=['exports','events','../../mysqldb','setMaxListeners','save','remove','emit','hasOwnProperty','hook'];(function(_0x308374,_0x550e85){var _0x1f71e0=function(_0x18377d){while(--_0x18377d){_0x308374['push'](_0x308374['shift']());}};_0x1f71e0(++_0x550e85);}(_0x0202,0x7f));var _0x2020=function(_0x50af98,_0x2faf82){_0x50af98=_0x50af98-0x0;var _0x1acfa1=_0x0202[_0x50af98];return _0x1acfa1;};'use strict';var EventEmitter=require(_0x2020('0x0'));var SquareProject=require(_0x2020('0x1'))['db']['SquareProject'];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0x2020('0x2')](0x0);var events={'afterCreate':_0x2020('0x3'),'afterUpdate':'update','afterDestroy':_0x2020('0x4')};function emitEvent(_0x4dd1cb){return function(_0x84a8ad,_0x2c74c6,_0x122862){SquareProjectEvents['emit'](_0x4dd1cb+':'+_0x84a8ad['id'],_0x84a8ad);SquareProjectEvents[_0x2020('0x5')](_0x4dd1cb,_0x84a8ad);_0x122862(null);};}for(var e in events){if(events[_0x2020('0x6')](e)){var event=events[e];SquareProject[_0x2020('0x7')](e,emitEvent(event));}}module[_0x2020('0x8')]=SquareProjectEvents; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.model.js b/server/api/squareProject/squareProject.model.js index 28ca564..574c500 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 _0x33cb=['path','rimraf','../../config/environment','./squareProject.attributes','exports','define','changed','preproduction','savedAt','format','YYYY-MM-DD\x20HH:mm:ss','production','publishedAt','lodash','util','../../config/logger','api','bluebird'];(function(_0x938c82,_0x43192a){var _0x5c04e5=function(_0x2aa54e){while(--_0x2aa54e){_0x938c82['push'](_0x938c82['shift']());}};_0x5c04e5(++_0x43192a);}(_0x33cb,0x8b));var _0xb33c=function(_0x31c87a,_0xb11b4){_0x31c87a=_0x31c87a-0x0;var _0x42f042=_0x33cb[_0x31c87a];return _0x42f042;};'use strict';var _=require(_0xb33c('0x0'));var util=require(_0xb33c('0x1'));var logger=require(_0xb33c('0x2'))(_0xb33c('0x3'));var moment=require('moment');var BPromise=require(_0xb33c('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb33c('0x5'));var rimraf=require(_0xb33c('0x6'));var config=require(_0xb33c('0x7'));var attributes=require(_0xb33c('0x8'));module[_0xb33c('0x9')]=function(_0xcb593f,_0x1367d2){return _0xcb593f[_0xb33c('0xa')]('SquareProject',attributes,{'tableName':'square_projects','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x21a858,_0x5be7b0,_0x32fa7){if(_0x21a858[_0xb33c('0xb')](_0xb33c('0xc'))){_0x21a858[_0xb33c('0xd')]=moment()[_0xb33c('0xe')](_0xb33c('0xf'));}if(_0x21a858['changed'](_0xb33c('0x10'))){_0x21a858[_0xb33c('0x11')]=moment()[_0xb33c('0xe')](_0xb33c('0xf'));}_0x32fa7(null,_0x21a858);}}});}; \ No newline at end of file +var _0x9a64=['YYYY-MM-DD\x20HH:mm:ss','publishedAt','format','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','exports','define','SquareProject','square_projects','changed','preproduction','savedAt'];(function(_0x306081,_0x293f4a){var _0x4b2509=function(_0xf04478){while(--_0xf04478){_0x306081['push'](_0x306081['shift']());}};_0x4b2509(++_0x293f4a);}(_0x9a64,0x10d));var _0x49a6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9a64[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x49a6('0x0'));var util=require(_0x49a6('0x1'));var logger=require(_0x49a6('0x2'))(_0x49a6('0x3'));var moment=require(_0x49a6('0x4'));var BPromise=require(_0x49a6('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x49a6('0x6'));var rimraf=require(_0x49a6('0x7'));var config=require(_0x49a6('0x8'));var attributes=require('./squareProject.attributes');module[_0x49a6('0x9')]=function(_0x470521,_0x455a4e){return _0x470521[_0x49a6('0xa')](_0x49a6('0xb'),attributes,{'tableName':_0x49a6('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0xf90c61,_0x443734,_0x4ee0be){if(_0xf90c61[_0x49a6('0xd')](_0x49a6('0xe'))){_0xf90c61[_0x49a6('0xf')]=moment()['format'](_0x49a6('0x10'));}if(_0xf90c61[_0x49a6('0xd')]('production')){_0xf90c61[_0x49a6('0x11')]=moment()[_0x49a6('0x12')](_0x49a6('0x10'));}_0x4ee0be(null,_0xf90c61);}}});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.rpc.js b/server/api/squareProject/squareProject.rpc.js index 105e0af..7976b63 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 _0xd6bb=['info','SquareProject,\x20%s,\x20%s','request\x20sent','debug','SquareProject,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ShowSquareProject','SquareProject','find','options','where','attributes','include','map','model','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','defaults','redis','socket.io-emitter','./squareProject.socket','register','request'];(function(_0x1c3e6a,_0x50907c){var _0x22b96b=function(_0xe89f7a){while(--_0xe89f7a){_0x1c3e6a['push'](_0x1c3e6a['shift']());}};_0x22b96b(++_0x50907c);}(_0xd6bb,0x1ab));var _0xbd6b=function(_0x1526e1,_0x5ed5a5){_0x1526e1=_0x1526e1-0x0;var _0x249a1e=_0xd6bb[_0x1526e1];return _0x249a1e;};'use strict';var _=require(_0xbd6b('0x0'));var util=require(_0xbd6b('0x1'));var moment=require(_0xbd6b('0x2'));var BPromise=require(_0xbd6b('0x3'));var rs=require(_0xbd6b('0x4'));var fs=require('fs');var Redis=require(_0xbd6b('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xbd6b('0x6'));var logger=require(_0xbd6b('0x7'))('rpc');var config=require(_0xbd6b('0x8'));var jayson=require(_0xbd6b('0x9'));var client=jayson['client'][_0xbd6b('0xa')]({'port':0x232a});config['redis']=_[_0xbd6b('0xb')](config[_0xbd6b('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xbd6b('0xd'))(new Redis(config[_0xbd6b('0xc')]));require(_0xbd6b('0xe'))[_0xbd6b('0xf')](socket);function respondWithRpcPromise(_0x49010d,_0x15e904,_0x4b2c7a){return new BPromise(function(_0x20ebe7,_0x535362){return client[_0xbd6b('0x10')](_0x49010d,_0x4b2c7a)['then'](function(_0x1800a2){logger[_0xbd6b('0x11')](_0xbd6b('0x12'),_0x15e904,_0xbd6b('0x13'));logger[_0xbd6b('0x14')](_0xbd6b('0x15'),_0x15e904,_0xbd6b('0x13'),JSON[_0xbd6b('0x16')](_0x1800a2));if(_0x1800a2[_0xbd6b('0x17')]){if(_0x1800a2[_0xbd6b('0x17')][_0xbd6b('0x18')]===0x1f4){logger[_0xbd6b('0x17')](_0xbd6b('0x12'),_0x15e904,_0x1800a2[_0xbd6b('0x17')]['message']);return _0x535362(_0x1800a2[_0xbd6b('0x17')]['message']);}logger['error'](_0xbd6b('0x12'),_0x15e904,_0x1800a2[_0xbd6b('0x17')][_0xbd6b('0x19')]);return _0x20ebe7(_0x1800a2[_0xbd6b('0x17')][_0xbd6b('0x19')]);}else{logger[_0xbd6b('0x11')](_0xbd6b('0x12'),_0x15e904,'request\x20sent');_0x20ebe7(_0x1800a2[_0xbd6b('0x1a')][_0xbd6b('0x19')]);}})[_0xbd6b('0x1b')](function(_0x10ce7f){logger[_0xbd6b('0x17')](_0xbd6b('0x12'),_0x15e904,_0x10ce7f);_0x535362(_0x10ce7f);});});}exports[_0xbd6b('0x1c')]=function(_0xbb2fae){var _0x4a00f6=this;return new Promise(function(_0x52e985,_0x1cf54e){return db[_0xbd6b('0x1d')][_0xbd6b('0x1e')]({'raw':_0xbb2fae[_0xbd6b('0x1f')]?_0xbb2fae[_0xbd6b('0x1f')]['raw']===undefined?!![]:![]:!![],'where':_0xbb2fae[_0xbd6b('0x1f')]?_0xbb2fae[_0xbd6b('0x1f')][_0xbd6b('0x20')]||null:null,'attributes':_0xbb2fae[_0xbd6b('0x1f')]?_0xbb2fae[_0xbd6b('0x1f')][_0xbd6b('0x21')]||null:null,'include':_0xbb2fae[_0xbd6b('0x1f')]?_0xbb2fae[_0xbd6b('0x1f')][_0xbd6b('0x22')]?_[_0xbd6b('0x23')](_0xbb2fae[_0xbd6b('0x1f')][_0xbd6b('0x22')],function(_0x28b05f){return{'model':db[_0x28b05f[_0xbd6b('0x24')]],'as':_0x28b05f['as'],'attributes':_0x28b05f[_0xbd6b('0x21')],'include':_0x28b05f[_0xbd6b('0x22')]?_[_0xbd6b('0x23')](_0x28b05f[_0xbd6b('0x22')],function(_0x3b5dab){return{'model':db[_0x3b5dab[_0xbd6b('0x24')]],'as':_0x3b5dab['as'],'attributes':_0x3b5dab[_0xbd6b('0x21')],'include':_0x3b5dab[_0xbd6b('0x22')]?_['map'](_0x3b5dab[_0xbd6b('0x22')],function(_0x77d4c5){return{'model':db[_0x77d4c5['model']],'as':_0x77d4c5['as'],'attributes':_0x77d4c5[_0xbd6b('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4d218b){logger[_0xbd6b('0x11')](_0xbd6b('0x1c'),_0xbb2fae);logger[_0xbd6b('0x14')](_0xbd6b('0x1c'),_0xbb2fae,JSON['stringify'](_0x4d218b));_0x52e985(_0x4d218b);})[_0xbd6b('0x1b')](function(_0x4b2975){logger['error'](_0xbd6b('0x1c'),_0x4b2975[_0xbd6b('0x19')],_0xbb2fae);_0x1cf54e(_0x4a00f6[_0xbd6b('0x17')](0x1f4,_0x4b2975[_0xbd6b('0x19')]));});});}; \ No newline at end of file +var _0x723f=['map','catch','lodash','moment','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./squareProject.socket','register','then','info','SquareProject,\x20%s,\x20%s','debug','SquareProject,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','ShowSquareProject','SquareProject','find','options','where','attributes','include','model'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x723f,0x1de));var _0xf723=function(_0x5d0606,_0x4bfe2e){_0x5d0606=_0x5d0606-0x0;var _0x513ee1=_0x723f[_0x5d0606];return _0x513ee1;};'use strict';var _=require(_0xf723('0x0'));var util=require('util');var moment=require(_0xf723('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf723('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0xf723('0x3'))('rpc');var config=require(_0xf723('0x4'));var jayson=require(_0xf723('0x5'));var client=jayson[_0xf723('0x6')][_0xf723('0x7')]({'port':0x232a});config[_0xf723('0x8')]=_[_0xf723('0x9')](config[_0xf723('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0xf723('0xa'))(new Redis(config[_0xf723('0x8')]));require(_0xf723('0xb'))[_0xf723('0xc')](socket);function respondWithRpcPromise(_0x43c0f1,_0x13a22d,_0x165d75){return new BPromise(function(_0x5cf234,_0x546c64){return client['request'](_0x43c0f1,_0x165d75)[_0xf723('0xd')](function(_0x57e749){logger[_0xf723('0xe')](_0xf723('0xf'),_0x13a22d,'request\x20sent');logger[_0xf723('0x10')](_0xf723('0x11'),_0x13a22d,'request\x20sent',JSON[_0xf723('0x12')](_0x57e749));if(_0x57e749[_0xf723('0x13')]){if(_0x57e749[_0xf723('0x13')][_0xf723('0x14')]===0x1f4){logger[_0xf723('0x13')](_0xf723('0xf'),_0x13a22d,_0x57e749[_0xf723('0x13')][_0xf723('0x15')]);return _0x546c64(_0x57e749[_0xf723('0x13')]['message']);}logger['error'](_0xf723('0xf'),_0x13a22d,_0x57e749[_0xf723('0x13')][_0xf723('0x15')]);return _0x5cf234(_0x57e749[_0xf723('0x13')]['message']);}else{logger[_0xf723('0xe')]('SquareProject,\x20%s,\x20%s',_0x13a22d,_0xf723('0x16'));_0x5cf234(_0x57e749[_0xf723('0x17')][_0xf723('0x15')]);}})['catch'](function(_0x4cd8b){logger[_0xf723('0x13')](_0xf723('0xf'),_0x13a22d,_0x4cd8b);_0x546c64(_0x4cd8b);});});}exports[_0xf723('0x18')]=function(_0x2ac15c){var _0x1910da=this;return new Promise(function(_0x17e287,_0x11eec9){return db[_0xf723('0x19')][_0xf723('0x1a')]({'raw':_0x2ac15c['options']?_0x2ac15c[_0xf723('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x2ac15c[_0xf723('0x1b')]?_0x2ac15c['options'][_0xf723('0x1c')]||null:null,'attributes':_0x2ac15c[_0xf723('0x1b')]?_0x2ac15c[_0xf723('0x1b')][_0xf723('0x1d')]||null:null,'include':_0x2ac15c[_0xf723('0x1b')]?_0x2ac15c[_0xf723('0x1b')]['include']?_['map'](_0x2ac15c[_0xf723('0x1b')][_0xf723('0x1e')],function(_0x24adc7){return{'model':db[_0x24adc7[_0xf723('0x1f')]],'as':_0x24adc7['as'],'attributes':_0x24adc7[_0xf723('0x1d')],'include':_0x24adc7[_0xf723('0x1e')]?_[_0xf723('0x20')](_0x24adc7['include'],function(_0x173bdc){return{'model':db[_0x173bdc['model']],'as':_0x173bdc['as'],'attributes':_0x173bdc['attributes'],'include':_0x173bdc['include']?_['map'](_0x173bdc[_0xf723('0x1e')],function(_0x147371){return{'model':db[_0x147371[_0xf723('0x1f')]],'as':_0x147371['as'],'attributes':_0x147371[_0xf723('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xf723('0xd')](function(_0x2b4fa1){logger[_0xf723('0xe')](_0xf723('0x18'),_0x2ac15c);logger[_0xf723('0x10')]('ShowSquareProject',_0x2ac15c,JSON[_0xf723('0x12')](_0x2b4fa1));_0x17e287(_0x2b4fa1);})[_0xf723('0x21')](function(_0x34c0ee){logger['error']('ShowSquareProject',_0x34c0ee[_0xf723('0x15')],_0x2ac15c);_0x11eec9(_0x1910da[_0xf723('0x13')](0x1f4,_0x34c0ee[_0xf723('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index 194e80b..f706318 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 _0xf683=['update','emit','removeListener','length','squareProject:','./squareProject.events','save','remove'];(function(_0x9deeee,_0x181346){var _0x18b1f6=function(_0x279f40){while(--_0x279f40){_0x9deeee['push'](_0x9deeee['shift']());}};_0x18b1f6(++_0x181346);}(_0xf683,0x13d));var _0x3f68=function(_0x4aeb8a,_0x40187d){_0x4aeb8a=_0x4aeb8a-0x0;var _0xbe493e=_0xf683[_0x4aeb8a];return _0xbe493e;};'use strict';var SquareProjectEvents=require(_0x3f68('0x0'));var events=[_0x3f68('0x1'),_0x3f68('0x2'),_0x3f68('0x3')];function createListener(_0x366d19,_0x15f60b){return function(_0xfbefbe){_0x15f60b[_0x3f68('0x4')](_0x366d19,_0xfbefbe);};}function removeListener(_0x1469e6,_0x961ec7){return function(){SquareProjectEvents[_0x3f68('0x5')](_0x1469e6,_0x961ec7);};}exports['register']=function(_0x48261b){for(var _0x324c51=0x0,_0x7f641e=events[_0x3f68('0x6')];_0x324c51<_0x7f641e;_0x324c51++){var _0x211b01=events[_0x324c51];var _0x32589b=createListener(_0x3f68('0x7')+_0x211b01,_0x48261b);SquareProjectEvents['on'](_0x211b01,_0x32589b);}}; \ No newline at end of file +var _0xd160=['./squareProject.events','remove','emit','removeListener'];(function(_0x1a8bbc,_0x17a086){var _0x212fc2=function(_0x55c718){while(--_0x55c718){_0x1a8bbc['push'](_0x1a8bbc['shift']());}};_0x212fc2(++_0x17a086);}(_0xd160,0x16c));var _0x0d16=function(_0x1a9204,_0x1c9e00){_0x1a9204=_0x1a9204-0x0;var _0x17ca68=_0xd160[_0x1a9204];return _0x17ca68;};'use strict';var SquareProjectEvents=require(_0x0d16('0x0'));var events=['save',_0x0d16('0x1'),'update'];function createListener(_0x476668,_0x1dd46f){return function(_0x76e688){_0x1dd46f[_0x0d16('0x2')](_0x476668,_0x76e688);};}function removeListener(_0xa5e2aa,_0x1d83d2){return function(){SquareProjectEvents[_0x0d16('0x3')](_0xa5e2aa,_0x1d83d2);};}exports['register']=function(_0x160865){for(var _0x219890=0x0,_0x5b1966=events['length'];_0x219890<_0x5b1966;_0x219890++){var _0x39675c=events[_0x219890];var _0x16e8f3=createListener('squareProject:'+_0x39675c,_0x160865);SquareProjectEvents['on'](_0x39675c,_0x16e8f3);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index 6934ea0..d2dbc62 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 _0x5fc3=['express','Router','fs-extra','../../components/auth/service','../../config/environment','./squareRecording.controller','get','isAuthenticated','show','/:id/download','download','post','create','put','update','/:id','multer','util','connect-timeout'];(function(_0xbeee5b,_0x1d641f){var _0x3c38b1=function(_0x2df02c){while(--_0x2df02c){_0xbeee5b['push'](_0xbeee5b['shift']());}};_0x3c38b1(++_0x1d641f);}(_0x5fc3,0xa8));var _0x35fc=function(_0x5756c6,_0x58290a){_0x5756c6=_0x5756c6-0x0;var _0x4b5806=_0x5fc3[_0x5756c6];return _0x4b5806;};'use strict';var multer=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var path=require('path');var timeout=require(_0x35fc('0x2'));var express=require(_0x35fc('0x3'));var router=express[_0x35fc('0x4')]();var fs_extra=require(_0x35fc('0x5'));var auth=require(_0x35fc('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x35fc('0x7'));var controller=require(_0x35fc('0x8'));router[_0x35fc('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x35fc('0x9')]('/:id',auth[_0x35fc('0xa')](),controller[_0x35fc('0xb')]);router[_0x35fc('0x9')](_0x35fc('0xc'),auth[_0x35fc('0xa')](),controller[_0x35fc('0xd')]);router[_0x35fc('0xe')]('/',auth['isAuthenticated'](),controller[_0x35fc('0xf')]);router[_0x35fc('0x10')]('/:id',auth[_0x35fc('0xa')](),controller[_0x35fc('0x11')]);router['delete'](_0x35fc('0x12'),auth[_0x35fc('0xa')](),controller['destroy']);module['exports']=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(_0x2261ce,_0x9ed8b6){var _0x524640=function(_0x3cbb90){while(--_0x3cbb90){_0x2261ce['push'](_0x2261ce['shift']());}};_0x524640(++_0x9ed8b6);}(_0x0295,0x1f0));var _0x5029=function(_0x3e69ae,_0x366e8d){_0x3e69ae=_0x3e69ae-0x0;var _0x3d7f42=_0x0295[_0x3e69ae];return _0x3d7f42;};'use strict';var multer=require(_0x5029('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x5029('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x5029('0x2'));var auth=require(_0x5029('0x3'));var interaction=require(_0x5029('0x4'));var config=require(_0x5029('0x5'));var controller=require(_0x5029('0x6'));router[_0x5029('0x7')]('/',auth[_0x5029('0x8')](),controller[_0x5029('0x9')]);router[_0x5029('0x7')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x5029('0x7')]('/:id/download',auth[_0x5029('0x8')](),controller['download']);router[_0x5029('0xa')]('/',auth['isAuthenticated'](),controller[_0x5029('0xb')]);router[_0x5029('0xc')](_0x5029('0xd'),auth['isAuthenticated'](),controller[_0x5029('0xe')]);router[_0x5029('0xf')](_0x5029('0xd'),auth['isAuthenticated'](),controller[_0x5029('0x10')]);module[_0x5029('0x11')]=router; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.attributes.js b/server/api/squareRecording/squareRecording.attributes.js index 3142f38..6c9b8cf 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(_0x436442,_0x97aa37){var _0x55a545=function(_0x4089d7){while(--_0x4089d7){_0x436442['push'](_0x436442['shift']());}};_0x55a545(++_0x97aa37);}(_0xae24,0x182));var _0x4ae2=function(_0xd7b73d,_0x204f8a){_0xd7b73d=_0xd7b73d-0x0;var _0x4154ec=_0xae24[_0xd7b73d];return _0x4154ec;};'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 _0x7dfd=['substring','lastIndexOf','sequelize','exports','STRING','VIRTUAL','savePath'];(function(_0x282ae8,_0x5826e4){var _0xf67a2d=function(_0x2995f6){while(--_0x2995f6){_0x282ae8['push'](_0x282ae8['shift']());}};_0xf67a2d(++_0x5826e4);}(_0x7dfd,0x1c2));var _0xd7df=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7dfd[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xd7df('0x0'));module[_0xd7df('0x1')]={'uniqueid':{'type':Sequelize[_0xd7df('0x2')]},'callerid':{'type':Sequelize[_0xd7df('0x2')]},'calleridname':{'type':Sequelize[_0xd7df('0x2')]},'context':{'type':Sequelize[_0xd7df('0x2')]},'extension':{'type':Sequelize[_0xd7df('0x2')]},'priority':{'type':Sequelize[_0xd7df('0x2')]},'accountcode':{'type':Sequelize[_0xd7df('0x2')]},'dnid':{'type':Sequelize[_0xd7df('0x2')]},'projectName':{'type':Sequelize[_0xd7df('0x2')]},'saveName':{'type':Sequelize[_0xd7df('0x2')]},'filename':{'type':Sequelize[_0xd7df('0x2')]},'savePath':{'type':Sequelize[_0xd7df('0x2')]},'format':{'type':Sequelize[_0xd7df('0x3')],'get':function(){var _0x16e50='';var _0x2c48a4=this['getDataValue'](_0xd7df('0x4'));if(_0x2c48a4){_0x16e50=_0x2c48a4[_0xd7df('0x5')](_0x2c48a4[_0xd7df('0x6')]('.'));}return _0x16e50;}}}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index a7bb2be..0a54481 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 _0xad9e=['model','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','SquareRecording','then','includeAll','findAll','rows','catch','show','params','keys','include','create','body','find','download','../../components/encryptor','uniqueid','savePath','filename','%s.cypher','existsSync','decryptFile','secrets','recording','Sequelize','ValidationError','SquareRecording\x20not\x20found','extname','unlink','message','Not\x20found','Entity\x20not\x20found','info','isNil','File:\x20\x22','unlinkSync','.cypher','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','status','error','name','send','map','rawAttributes','type','key','query','filters','intersection'];(function(_0x1d2ebe,_0x107899){var _0x150e1=function(_0xd50b08){while(--_0xd50b08){_0x1d2ebe['push'](_0x1d2ebe['shift']());}};_0x150e1(++_0x107899);}(_0xad9e,0x1ca));var _0xead9=function(_0x36b8ef,_0x4203cc){_0x36b8ef=_0x36b8ef-0x0;var _0x32a4a2=_0xad9e[_0x36b8ef];return _0x32a4a2;};'use strict';var emlformat=require(_0xead9('0x0'));var rimraf=require(_0xead9('0x1'));var zipdir=require(_0xead9('0x2'));var jsonpatch=require(_0xead9('0x3'));var rp=require('request-promise');var moment=require(_0xead9('0x4'));var BPromise=require(_0xead9('0x5'));var Mustache=require('mustache');var util=require(_0xead9('0x6'));var path=require(_0xead9('0x7'));var sox=require(_0xead9('0x8'));var csv=require(_0xead9('0x9'));var ejs=require(_0xead9('0xa'));var fs=require('fs');var fs_extra=require(_0xead9('0xb'));var _=require(_0xead9('0xc'));var squel=require(_0xead9('0xd'));var crypto=require(_0xead9('0xe'));var jsforce=require(_0xead9('0xf'));var deskjs=require(_0xead9('0x10'));var toCsv=require(_0xead9('0x9'));var querystring=require(_0xead9('0x11'));var Papa=require('papaparse');var Redis=require(_0xead9('0x12'));var authService=require(_0xead9('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xead9('0x14'));var hardwareService=require(_0xead9('0x15'));var logger=require(_0xead9('0x16'))(_0xead9('0x17'));var utils=require(_0xead9('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xead9('0x19'));var db=require(_0xead9('0x1a'))['db'];function respondWithStatusCode(_0x33f205,_0x453649){_0x453649=_0x453649||0xcc;return function(_0x171b36){if(_0x171b36){return _0x33f205[_0xead9('0x1b')](_0x453649);}return _0x33f205['status'](_0x453649)[_0xead9('0x1c')]();};}function respondWithResult(_0x953a53,_0x26adaf){_0x26adaf=_0x26adaf||0xc8;return function(_0x1e4223){if(_0x1e4223){return _0x953a53['status'](_0x26adaf)[_0xead9('0x1d')](_0x1e4223);}};}function respondWithFilteredResult(_0x386753,_0x5c85e4){return function(_0xce00a9){if(_0xce00a9){var _0x28eaeb=typeof _0x5c85e4[_0xead9('0x1e')]===_0xead9('0x1f')&&typeof _0x5c85e4[_0xead9('0x20')]==='undefined';var _0x9db142=_0xce00a9[_0xead9('0x21')];var _0x2532bb=_0x28eaeb?0x0:_0x5c85e4[_0xead9('0x1e')];var _0x14bbe2=_0x28eaeb?_0xce00a9[_0xead9('0x21')]:_0x5c85e4[_0xead9('0x1e')]+_0x5c85e4[_0xead9('0x20')];var _0x4eeaea;if(_0x14bbe2>=_0x9db142){_0x14bbe2=_0x9db142;_0x4eeaea=0xc8;}else{_0x4eeaea=0xce;}_0x386753['status'](_0x4eeaea);return _0x386753[_0xead9('0x22')](_0xead9('0x23'),_0x2532bb+'-'+_0x14bbe2+'/'+_0x9db142)[_0xead9('0x1d')](_0xce00a9);}return null;};}function patchUpdates(_0x238525){return function(_0x1ad2dd){try{jsonpatch[_0xead9('0x24')](_0x1ad2dd,_0x238525,!![]);}catch(_0x479256){return BPromise[_0xead9('0x25')](_0x479256);}return _0x1ad2dd[_0xead9('0x26')]();};}function saveUpdates(_0x53b651,_0xad5c84){return function(_0xf1062f){if(_0xf1062f){return _0xf1062f[_0xead9('0x27')](_0x53b651)['then'](function(_0x367041){return _0x367041;});}return null;};}function removeEntity(_0x20e398,_0x30486e){return function(_0x32587c){if(_0x32587c){return _0x32587c[_0xead9('0x28')]()['then'](function(){_0x20e398[_0xead9('0x29')](0xcc)[_0xead9('0x1c')]();});}};}function handleEntityNotFound(_0x43c53a,_0x219b09){return function(_0x5693a5){if(!_0x5693a5){_0x43c53a[_0xead9('0x1b')](0x194);}return _0x5693a5;};}function handleError(_0x269287,_0x4ab8bb){_0x4ab8bb=_0x4ab8bb||0x1f4;return function(_0x2c34de){logger[_0xead9('0x2a')](_0x2c34de['stack']);if(_0x2c34de[_0xead9('0x2b')]){delete _0x2c34de[_0xead9('0x2b')];}_0x269287[_0xead9('0x29')](_0x4ab8bb)[_0xead9('0x2c')](_0x2c34de);};}exports['index']=function(_0x599b22,_0x46c416){var _0x92dcd0={},_0x3c7f18={},_0x1c6ffd={'count':0x0,'rows':[]};var _0x2a3ebb=_[_0xead9('0x2d')](db['SquareRecording'][_0xead9('0x2e')],function(_0x2efd23){return{'name':_0x2efd23['fieldName'],'type':_0x2efd23[_0xead9('0x2f')][_0xead9('0x30')]};});_0x3c7f18['model']=_[_0xead9('0x2d')](_0x2a3ebb,_0xead9('0x2b'));_0x3c7f18['query']=_['keys'](_0x599b22[_0xead9('0x31')]);_0x3c7f18[_0xead9('0x32')]=_[_0xead9('0x33')](_0x3c7f18[_0xead9('0x34')],_0x3c7f18['query']);_0x92dcd0[_0xead9('0x35')]=_[_0xead9('0x33')](_0x3c7f18[_0xead9('0x34')],qs[_0xead9('0x36')](_0x599b22[_0xead9('0x31')][_0xead9('0x36')]));_0x92dcd0[_0xead9('0x35')]=_0x92dcd0[_0xead9('0x35')][_0xead9('0x37')]?_0x92dcd0[_0xead9('0x35')]:_0x3c7f18[_0xead9('0x34')];if(!_0x599b22['query']['hasOwnProperty'](_0xead9('0x38'))){_0x92dcd0['limit']=qs[_0xead9('0x20')](_0x599b22[_0xead9('0x31')][_0xead9('0x20')]);_0x92dcd0[_0xead9('0x1e')]=qs['offset'](_0x599b22[_0xead9('0x31')][_0xead9('0x1e')]);}_0x92dcd0[_0xead9('0x39')]=qs[_0xead9('0x3a')](_0x599b22[_0xead9('0x31')][_0xead9('0x3a')]);_0x92dcd0[_0xead9('0x3b')]=qs['filters'](_[_0xead9('0x3c')](_0x599b22['query'],_0x3c7f18[_0xead9('0x32')]),_0x2a3ebb);if(_0x599b22[_0xead9('0x31')][_0xead9('0x3d')]){_0x92dcd0[_0xead9('0x3b')]=_[_0xead9('0x3e')](_0x92dcd0[_0xead9('0x3b')],{'$or':_[_0xead9('0x2d')](_0x2a3ebb,function(_0x28bed6){if(_0x28bed6[_0xead9('0x2f')]!==_0xead9('0x3f')){var _0x3e46f3={};_0x3e46f3[_0x28bed6[_0xead9('0x2b')]]={'$like':'%'+_0x599b22[_0xead9('0x31')][_0xead9('0x3d')]+'%'};return _0x3e46f3;}})});}_0x92dcd0=_[_0xead9('0x3e')]({},_0x92dcd0,_0x599b22[_0xead9('0x40')]);var _0x187aaa={'where':_0x92dcd0[_0xead9('0x3b')]};return db[_0xead9('0x41')][_0xead9('0x21')](_0x187aaa)[_0xead9('0x42')](function(_0x36456d){_0x1c6ffd[_0xead9('0x21')]=_0x36456d;if(_0x599b22['query'][_0xead9('0x43')]){_0x92dcd0['include']=[{'all':!![]}];}return db[_0xead9('0x41')][_0xead9('0x44')](_0x92dcd0);})[_0xead9('0x42')](function(_0x59c510){_0x1c6ffd[_0xead9('0x45')]=_0x59c510;return _0x1c6ffd;})[_0xead9('0x42')](respondWithFilteredResult(_0x46c416,_0x92dcd0))[_0xead9('0x46')](handleError(_0x46c416,null));};exports[_0xead9('0x47')]=function(_0x29e435,_0x29b8e7){var _0x3b6f9a={'raw':!![],'where':{'id':_0x29e435[_0xead9('0x48')]['id']}},_0x36d385={};_0x36d385[_0xead9('0x34')]=_[_0xead9('0x49')](db[_0xead9('0x41')]['rawAttributes']);_0x36d385[_0xead9('0x31')]=_[_0xead9('0x49')](_0x29e435[_0xead9('0x31')]);_0x36d385[_0xead9('0x32')]=_[_0xead9('0x33')](_0x36d385[_0xead9('0x34')],_0x36d385[_0xead9('0x31')]);_0x3b6f9a['attributes']=_[_0xead9('0x33')](_0x36d385['model'],qs[_0xead9('0x36')](_0x29e435['query']['fields']));_0x3b6f9a[_0xead9('0x35')]=_0x3b6f9a[_0xead9('0x35')][_0xead9('0x37')]?_0x3b6f9a[_0xead9('0x35')]:_0x36d385['model'];if(_0x29e435['query']['includeAll']){_0x3b6f9a[_0xead9('0x4a')]=[{'all':!![]}];}_0x3b6f9a=_[_0xead9('0x3e')]({},_0x3b6f9a,_0x29e435[_0xead9('0x40')]);return db[_0xead9('0x41')]['find'](_0x3b6f9a)[_0xead9('0x42')](handleEntityNotFound(_0x29b8e7,null))[_0xead9('0x42')](respondWithResult(_0x29b8e7,null))['catch'](handleError(_0x29b8e7,null));};exports[_0xead9('0x4b')]=function(_0x22c52a,_0x27a642){return db[_0xead9('0x41')][_0xead9('0x4b')](_0x22c52a[_0xead9('0x4c')],{})['then'](respondWithResult(_0x27a642,0xc9))[_0xead9('0x46')](handleError(_0x27a642,null));};exports['update']=function(_0x50dbd4,_0x25ea68){if(_0x50dbd4['body']['id']){delete _0x50dbd4[_0xead9('0x4c')]['id'];}return db[_0xead9('0x41')][_0xead9('0x4d')]({'where':{'id':_0x50dbd4['params']['id']}})[_0xead9('0x42')](handleEntityNotFound(_0x25ea68,null))[_0xead9('0x42')](saveUpdates(_0x50dbd4[_0xead9('0x4c')],null))['then'](respondWithResult(_0x25ea68,null))[_0xead9('0x46')](handleError(_0x25ea68,null));};exports[_0xead9('0x4e')]=function(_0x4c7c97,_0x358814,_0x4bf0a0){var _0x14b649=require(_0xead9('0x4f'));var _0x2da958=![];var _0x4f1dd8={};if(_0x4c7c97[_0xead9('0x31')]['type']&&_0x4c7c97[_0xead9('0x31')][_0xead9('0x2f')]===_0xead9('0x50')){_0x4f1dd8[_0xead9('0x50')]=_0x4c7c97[_0xead9('0x48')]['id'];}else{_0x4f1dd8['id']=_0x4c7c97[_0xead9('0x48')]['id'];}return db[_0xead9('0x41')][_0xead9('0x4d')]({'where':_0x4f1dd8,'attributes':['id',_0xead9('0x51'),_0xead9('0x52')],'raw':!![]})[_0xead9('0x42')](handleEntityNotFound(_0x358814,null))[_0xead9('0x42')](function(_0x5e3282){if(_0x5e3282){var _0x1e21d2=_0x5e3282[_0xead9('0x51')];var _0x39cdfc=util['format'](_0xead9('0x53'),_0x1e21d2);if(fs[_0xead9('0x54')](_0x39cdfc)){_0x2da958=!![];return _0x14b649[_0xead9('0x55')](_0x39cdfc,_0x1e21d2,config[_0xead9('0x56')][_0xead9('0x57')])['then'](function(){return _0x5e3282;});}return _0x5e3282;}})[_0xead9('0x42')](function(_0x5660e1){if(_0x5660e1){var _0x191a35=_0x5660e1[_0xead9('0x51')];if(!fs['existsSync'](_0x191a35)){throw new db[(_0xead9('0x58'))][(_0xead9('0x59'))](_0xead9('0x5a'));}if(_0x5660e1[_0xead9('0x52')]){return _0x358814['download'](_0x191a35,_0x5660e1['filename']+path[_0xead9('0x5b')](_0x191a35),function(){if(_0x2da958){fs[_0xead9('0x5c')](_0x191a35);}});}else{return _0x358814['download'](_0x191a35,function(_0x259f57){if(_0x2da958){fs[_0xead9('0x5c')](_0x191a35);}});}}})[_0xead9('0x46')](function(_0x3db48c){if(_0x3db48c[_0xead9('0x5d')]===_0xead9('0x5a')){_0x358814['status'](0x194)['send'](_0xead9('0x5e'));}else{return handleError(_0x358814,null);}});};exports[_0xead9('0x28')]=function(_0x15566f,_0x4b0ebe){return db[_0xead9('0x41')][_0xead9('0x4d')]({'where':{'id':_0x15566f[_0xead9('0x48')]['id']}})[_0xead9('0x42')](function(_0x171ae4){if(_['isNil'](_0x171ae4)){throw new ReferenceError(_0xead9('0x5f'));}return _0x171ae4;})[_0xead9('0x42')](function(_0x1051a0){var _0x1cd08a=_0x1051a0[_0xead9('0x51')];logger[_0xead9('0x60')]('cancellazione\x20fisica\x20documento\x20%s',_0x1cd08a);if(!_[_0xead9('0x61')](_0x1051a0['savePath'])&&fs[_0xead9('0x54')](_0x1cd08a)){logger[_0xead9('0x60')](_0xead9('0x62')+_0x1cd08a+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0xead9('0x63')](_0x1cd08a);}_0x1cd08a=_0x1cd08a+_0xead9('0x64');if(!_[_0xead9('0x61')](_0x1051a0['savePath'])&&fs[_0xead9('0x54')](_0x1cd08a)){logger[_0xead9('0x60')](_0xead9('0x62')+_0x1cd08a+_0xead9('0x65'));fs[_0xead9('0x63')](_0x1cd08a);}return _0x1051a0;})[_0xead9('0x42')](function(_0x96d3fa){if(!_0x96d3fa)throw new InternalError();return _0x96d3fa[_0xead9('0x28')]();})[_0xead9('0x42')](function(){_0x4b0ebe[_0xead9('0x29')](0xcc)['end']();})['catch'](handleError(_0x4b0ebe,null));}; \ No newline at end of file +var _0x073a=['stack','name','index','map','SquareRecording','fieldName','type','key','model','query','keys','attributes','intersection','fields','length','nolimit','order','sort','where','pick','filters','filter','merge','includeAll','include','findAll','rows','catch','params','rawAttributes','options','find','create','body','download','../../components/encryptor','uniqueid','savePath','filename','format','existsSync','decryptFile','recording','Sequelize','ValidationError','SquareRecording\x20not\x20found','extname','unlink','send','Not\x20found','destroy','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','.cypher','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','save','update','then','error'];(function(_0x5b5af1,_0x1db01b){var _0x45ab7b=function(_0x1e353a){while(--_0x1e353a){_0x5b5af1['push'](_0x5b5af1['shift']());}};_0x45ab7b(++_0x1db01b);}(_0x073a,0x9d));var _0xa073=function(_0x18abe6,_0x2f15e2){_0x18abe6=_0x18abe6-0x0;var _0x19c0d0=_0x073a[_0x18abe6];return _0x19c0d0;};'use strict';var emlformat=require(_0xa073('0x0'));var rimraf=require(_0xa073('0x1'));var zipdir=require(_0xa073('0x2'));var jsonpatch=require(_0xa073('0x3'));var rp=require(_0xa073('0x4'));var moment=require(_0xa073('0x5'));var BPromise=require(_0xa073('0x6'));var Mustache=require(_0xa073('0x7'));var util=require('util');var path=require(_0xa073('0x8'));var sox=require(_0xa073('0x9'));var csv=require(_0xa073('0xa'));var ejs=require(_0xa073('0xb'));var fs=require('fs');var fs_extra=require(_0xa073('0xc'));var _=require(_0xa073('0xd'));var squel=require(_0xa073('0xe'));var crypto=require('crypto');var jsforce=require(_0xa073('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xa073('0xa'));var querystring=require('querystring');var Papa=require(_0xa073('0x10'));var Redis=require(_0xa073('0x11'));var authService=require(_0xa073('0x12'));var qs=require(_0xa073('0x13'));var as=require(_0xa073('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa073('0x15'))(_0xa073('0x16'));var utils=require(_0xa073('0x17'));var config=require(_0xa073('0x18'));var licenseUtil=require(_0xa073('0x19'));var db=require(_0xa073('0x1a'))['db'];function respondWithStatusCode(_0x2d5781,_0x4ef3a9){_0x4ef3a9=_0x4ef3a9||0xcc;return function(_0x4d3da4){if(_0x4d3da4){return _0x2d5781[_0xa073('0x1b')](_0x4ef3a9);}return _0x2d5781[_0xa073('0x1c')](_0x4ef3a9)[_0xa073('0x1d')]();};}function respondWithResult(_0x3b1758,_0x140e3a){_0x140e3a=_0x140e3a||0xc8;return function(_0x53234b){if(_0x53234b){return _0x3b1758[_0xa073('0x1c')](_0x140e3a)[_0xa073('0x1e')](_0x53234b);}};}function respondWithFilteredResult(_0x5a3ed5,_0x77fb37){return function(_0xc3f80d){if(_0xc3f80d){var _0x17e362=typeof _0x77fb37[_0xa073('0x1f')]===_0xa073('0x20')&&typeof _0x77fb37[_0xa073('0x21')]==='undefined';var _0x69656f=_0xc3f80d['count'];var _0x3d141d=_0x17e362?0x0:_0x77fb37[_0xa073('0x1f')];var _0x42910f=_0x17e362?_0xc3f80d[_0xa073('0x22')]:_0x77fb37[_0xa073('0x1f')]+_0x77fb37[_0xa073('0x21')];var _0x527f41;if(_0x42910f>=_0x69656f){_0x42910f=_0x69656f;_0x527f41=0xc8;}else{_0x527f41=0xce;}_0x5a3ed5['status'](_0x527f41);return _0x5a3ed5['set'](_0xa073('0x23'),_0x3d141d+'-'+_0x42910f+'/'+_0x69656f)[_0xa073('0x1e')](_0xc3f80d);}return null;};}function patchUpdates(_0x5d4e1e){return function(_0x21b2ec){try{jsonpatch[_0xa073('0x24')](_0x21b2ec,_0x5d4e1e,!![]);}catch(_0x46d536){return BPromise['reject'](_0x46d536);}return _0x21b2ec[_0xa073('0x25')]();};}function saveUpdates(_0x13d627,_0x26c3bb){return function(_0x2eea8c){if(_0x2eea8c){return _0x2eea8c[_0xa073('0x26')](_0x13d627)[_0xa073('0x27')](function(_0x534ba2){return _0x534ba2;});}return null;};}function removeEntity(_0x244855,_0x5bec8c){return function(_0x11bed0){if(_0x11bed0){return _0x11bed0['destroy']()[_0xa073('0x27')](function(){_0x244855['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4a4df6,_0x55b6c9){return function(_0x258e7e){if(!_0x258e7e){_0x4a4df6['sendStatus'](0x194);}return _0x258e7e;};}function handleError(_0x372e3c,_0x477a5b){_0x477a5b=_0x477a5b||0x1f4;return function(_0x3229dd){logger[_0xa073('0x28')](_0x3229dd[_0xa073('0x29')]);if(_0x3229dd['name']){delete _0x3229dd[_0xa073('0x2a')];}_0x372e3c[_0xa073('0x1c')](_0x477a5b)['send'](_0x3229dd);};}exports[_0xa073('0x2b')]=function(_0x2ae277,_0x5f3669){var _0x4689b6={},_0x5ab1dc={},_0x148a4c={'count':0x0,'rows':[]};var _0x123820=_[_0xa073('0x2c')](db[_0xa073('0x2d')]['rawAttributes'],function(_0x56e58a){return{'name':_0x56e58a[_0xa073('0x2e')],'type':_0x56e58a[_0xa073('0x2f')][_0xa073('0x30')]};});_0x5ab1dc[_0xa073('0x31')]=_[_0xa073('0x2c')](_0x123820,'name');_0x5ab1dc[_0xa073('0x32')]=_[_0xa073('0x33')](_0x2ae277[_0xa073('0x32')]);_0x5ab1dc['filters']=_['intersection'](_0x5ab1dc['model'],_0x5ab1dc[_0xa073('0x32')]);_0x4689b6[_0xa073('0x34')]=_[_0xa073('0x35')](_0x5ab1dc[_0xa073('0x31')],qs[_0xa073('0x36')](_0x2ae277[_0xa073('0x32')][_0xa073('0x36')]));_0x4689b6[_0xa073('0x34')]=_0x4689b6['attributes'][_0xa073('0x37')]?_0x4689b6[_0xa073('0x34')]:_0x5ab1dc[_0xa073('0x31')];if(!_0x2ae277[_0xa073('0x32')]['hasOwnProperty'](_0xa073('0x38'))){_0x4689b6[_0xa073('0x21')]=qs[_0xa073('0x21')](_0x2ae277[_0xa073('0x32')][_0xa073('0x21')]);_0x4689b6['offset']=qs[_0xa073('0x1f')](_0x2ae277[_0xa073('0x32')][_0xa073('0x1f')]);}_0x4689b6[_0xa073('0x39')]=qs[_0xa073('0x3a')](_0x2ae277[_0xa073('0x32')][_0xa073('0x3a')]);_0x4689b6[_0xa073('0x3b')]=qs['filters'](_[_0xa073('0x3c')](_0x2ae277[_0xa073('0x32')],_0x5ab1dc[_0xa073('0x3d')]),_0x123820);if(_0x2ae277[_0xa073('0x32')][_0xa073('0x3e')]){_0x4689b6[_0xa073('0x3b')]=_[_0xa073('0x3f')](_0x4689b6[_0xa073('0x3b')],{'$or':_['map'](_0x123820,function(_0x11c56a){if(_0x11c56a['type']!=='VIRTUAL'){var _0x135750={};_0x135750[_0x11c56a['name']]={'$like':'%'+_0x2ae277['query'][_0xa073('0x3e')]+'%'};return _0x135750;}})});}_0x4689b6=_[_0xa073('0x3f')]({},_0x4689b6,_0x2ae277['options']);var _0x6cabf9={'where':_0x4689b6[_0xa073('0x3b')]};return db['SquareRecording'][_0xa073('0x22')](_0x6cabf9)[_0xa073('0x27')](function(_0x5798db){_0x148a4c[_0xa073('0x22')]=_0x5798db;if(_0x2ae277[_0xa073('0x32')][_0xa073('0x40')]){_0x4689b6[_0xa073('0x41')]=[{'all':!![]}];}return db[_0xa073('0x2d')][_0xa073('0x42')](_0x4689b6);})[_0xa073('0x27')](function(_0x4a5f39){_0x148a4c[_0xa073('0x43')]=_0x4a5f39;return _0x148a4c;})[_0xa073('0x27')](respondWithFilteredResult(_0x5f3669,_0x4689b6))[_0xa073('0x44')](handleError(_0x5f3669,null));};exports['show']=function(_0x340c90,_0x52881a){var _0x591fbb={'raw':!![],'where':{'id':_0x340c90[_0xa073('0x45')]['id']}},_0x3bf288={};_0x3bf288[_0xa073('0x31')]=_[_0xa073('0x33')](db[_0xa073('0x2d')][_0xa073('0x46')]);_0x3bf288[_0xa073('0x32')]=_[_0xa073('0x33')](_0x340c90['query']);_0x3bf288[_0xa073('0x3d')]=_[_0xa073('0x35')](_0x3bf288[_0xa073('0x31')],_0x3bf288[_0xa073('0x32')]);_0x591fbb['attributes']=_[_0xa073('0x35')](_0x3bf288[_0xa073('0x31')],qs['fields'](_0x340c90[_0xa073('0x32')][_0xa073('0x36')]));_0x591fbb[_0xa073('0x34')]=_0x591fbb[_0xa073('0x34')][_0xa073('0x37')]?_0x591fbb[_0xa073('0x34')]:_0x3bf288[_0xa073('0x31')];if(_0x340c90[_0xa073('0x32')]['includeAll']){_0x591fbb[_0xa073('0x41')]=[{'all':!![]}];}_0x591fbb=_[_0xa073('0x3f')]({},_0x591fbb,_0x340c90[_0xa073('0x47')]);return db[_0xa073('0x2d')][_0xa073('0x48')](_0x591fbb)[_0xa073('0x27')](handleEntityNotFound(_0x52881a,null))[_0xa073('0x27')](respondWithResult(_0x52881a,null))[_0xa073('0x44')](handleError(_0x52881a,null));};exports['create']=function(_0x47e0ee,_0x4e1e0d){return db['SquareRecording'][_0xa073('0x49')](_0x47e0ee[_0xa073('0x4a')],{})['then'](respondWithResult(_0x4e1e0d,0xc9))[_0xa073('0x44')](handleError(_0x4e1e0d,null));};exports[_0xa073('0x26')]=function(_0x278b5c,_0x3deb91){if(_0x278b5c['body']['id']){delete _0x278b5c[_0xa073('0x4a')]['id'];}return db[_0xa073('0x2d')][_0xa073('0x48')]({'where':{'id':_0x278b5c[_0xa073('0x45')]['id']}})[_0xa073('0x27')](handleEntityNotFound(_0x3deb91,null))[_0xa073('0x27')](saveUpdates(_0x278b5c['body'],null))['then'](respondWithResult(_0x3deb91,null))[_0xa073('0x44')](handleError(_0x3deb91,null));};exports[_0xa073('0x4b')]=function(_0x57d95f,_0x5e93dc,_0x44a922){var _0x1ce919=require(_0xa073('0x4c'));var _0x4dc39c=![];var _0x41407b={};if(_0x57d95f[_0xa073('0x32')]['type']&&_0x57d95f[_0xa073('0x32')][_0xa073('0x2f')]===_0xa073('0x4d')){_0x41407b[_0xa073('0x4d')]=_0x57d95f['params']['id'];}else{_0x41407b['id']=_0x57d95f[_0xa073('0x45')]['id'];}return db[_0xa073('0x2d')][_0xa073('0x48')]({'where':_0x41407b,'attributes':['id',_0xa073('0x4e'),_0xa073('0x4f')],'raw':!![]})['then'](handleEntityNotFound(_0x5e93dc,null))['then'](function(_0x396774){if(_0x396774){var _0x39d8d3=_0x396774[_0xa073('0x4e')];var _0x250e5a=util[_0xa073('0x50')]('%s.cypher',_0x39d8d3);if(fs[_0xa073('0x51')](_0x250e5a)){_0x4dc39c=!![];return _0x1ce919[_0xa073('0x52')](_0x250e5a,_0x39d8d3,config['secrets'][_0xa073('0x53')])[_0xa073('0x27')](function(){return _0x396774;});}return _0x396774;}})[_0xa073('0x27')](function(_0x42b2d5){if(_0x42b2d5){var _0x3b2431=_0x42b2d5[_0xa073('0x4e')];if(!fs['existsSync'](_0x3b2431)){throw new db[(_0xa073('0x54'))][(_0xa073('0x55'))](_0xa073('0x56'));}if(_0x42b2d5[_0xa073('0x4f')]){return _0x5e93dc['download'](_0x3b2431,_0x42b2d5['filename']+path[_0xa073('0x57')](_0x3b2431),function(){if(_0x4dc39c){fs['unlink'](_0x3b2431);}});}else{return _0x5e93dc['download'](_0x3b2431,function(_0x2328a5){if(_0x4dc39c){fs[_0xa073('0x58')](_0x3b2431);}});}}})['catch'](function(_0x4a70b1){if(_0x4a70b1['message']===_0xa073('0x56')){_0x5e93dc[_0xa073('0x1c')](0x194)[_0xa073('0x59')](_0xa073('0x5a'));}else{return handleError(_0x5e93dc,null);}});};exports[_0xa073('0x5b')]=function(_0x595b88,_0x71864d){return db[_0xa073('0x2d')][_0xa073('0x48')]({'where':{'id':_0x595b88[_0xa073('0x45')]['id']}})[_0xa073('0x27')](function(_0x3edfa5){if(_[_0xa073('0x5c')](_0x3edfa5)){throw new ReferenceError(_0xa073('0x5d'));}return _0x3edfa5;})[_0xa073('0x27')](function(_0x4920cf){var _0x4786b4=_0x4920cf['savePath'];logger[_0xa073('0x5e')](_0xa073('0x5f'),_0x4786b4);if(!_[_0xa073('0x5c')](_0x4920cf[_0xa073('0x4e')])&&fs['existsSync'](_0x4786b4)){logger[_0xa073('0x5e')](_0xa073('0x60')+_0x4786b4+_0xa073('0x61'));fs['unlinkSync'](_0x4786b4);}_0x4786b4=_0x4786b4+_0xa073('0x62');if(!_['isNil'](_0x4920cf[_0xa073('0x4e')])&&fs['existsSync'](_0x4786b4)){logger['info'](_0xa073('0x60')+_0x4786b4+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs['unlinkSync'](_0x4786b4);}return _0x4920cf;})[_0xa073('0x27')](function(_0x12514a){if(!_0x12514a)throw new InternalError();return _0x12514a['destroy']();})['then'](function(){_0x71864d['status'](0xcc)[_0xa073('0x1d')]();})[_0xa073('0x44')](handleError(_0x71864d,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index e6c5bdc..e15fc47 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 _0xa24d=['request-promise','rimraf','../../config/environment','./squareRecording.attributes','exports','define','square_recordings','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x164114,_0x2e3e76){var _0x4d30d9=function(_0x5092a7){while(--_0x5092a7){_0x164114['push'](_0x164114['shift']());}};_0x4d30d9(++_0x2e3e76);}(_0xa24d,0x1c1));var _0xda24=function(_0x3add10,_0x457d16){_0x3add10=_0x3add10-0x0;var _0x2da348=_0xa24d[_0x3add10];return _0x2da348;};'use strict';var _=require(_0xda24('0x0'));var util=require(_0xda24('0x1'));var logger=require(_0xda24('0x2'))(_0xda24('0x3'));var moment=require(_0xda24('0x4'));var BPromise=require(_0xda24('0x5'));var rp=require(_0xda24('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xda24('0x7'));var config=require(_0xda24('0x8'));var attributes=require(_0xda24('0x9'));module[_0xda24('0xa')]=function(_0x561d74,_0x3557cb){return _0x561d74[_0xda24('0xb')]('SquareRecording',attributes,{'tableName':_0xda24('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1bb4=['request-promise','rimraf','./squareRecording.attributes','define','square_recordings','lodash','util','../../config/logger','api','moment'];(function(_0x32ba42,_0x483a94){var _0x2bb273=function(_0x1474e9){while(--_0x1474e9){_0x32ba42['push'](_0x32ba42['shift']());}};_0x2bb273(++_0x483a94);}(_0x1bb4,0x1c7));var _0x41bb=function(_0x2da597,_0x5a2ea6){_0x2da597=_0x2da597-0x0;var _0xecc61b=_0x1bb4[_0x2da597];return _0xecc61b;};'use strict';var _=require(_0x41bb('0x0'));var util=require(_0x41bb('0x1'));var logger=require(_0x41bb('0x2'))(_0x41bb('0x3'));var moment=require(_0x41bb('0x4'));var BPromise=require('bluebird');var rp=require(_0x41bb('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x41bb('0x6'));var config=require('../../config/environment');var attributes=require(_0x41bb('0x7'));module['exports']=function(_0x232b17,_0x3ab646){return _0x232b17[_0x41bb('0x8')]('SquareRecording',attributes,{'tableName':_0x41bb('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.rpc.js b/server/api/squareRecording/squareRecording.rpc.js index 7c44e2a..a75dbfa 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 _0x1d06=['raw','then','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','SquareRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','SquareRecording,\x20%s,\x20%s','message','result','CreateSquareRecording','SquareRecording','create','body','options'];(function(_0x35fc0f,_0x4494b7){var _0x403bce=function(_0x2d34ab){while(--_0x2d34ab){_0x35fc0f['push'](_0x35fc0f['shift']());}};_0x403bce(++_0x4494b7);}(_0x1d06,0x1e3));var _0x61d0=function(_0x17b6e3,_0x4522ed){_0x17b6e3=_0x17b6e3-0x0;var _0x3906f3=_0x1d06[_0x17b6e3];return _0x3906f3;};'use strict';var _=require(_0x61d0('0x0'));var util=require(_0x61d0('0x1'));var moment=require(_0x61d0('0x2'));var BPromise=require(_0x61d0('0x3'));var rs=require(_0x61d0('0x4'));var fs=require('fs');var Redis=require(_0x61d0('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x61d0('0x6'));var logger=require(_0x61d0('0x7'))(_0x61d0('0x8'));var config=require(_0x61d0('0x9'));var jayson=require(_0x61d0('0xa'));var client=jayson[_0x61d0('0xb')][_0x61d0('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x454e86,_0x15f46a,_0x52096b){return new BPromise(function(_0x5a681c,_0x1398af){return client[_0x61d0('0xd')](_0x454e86,_0x52096b)['then'](function(_0x968ed5){logger[_0x61d0('0xe')]('SquareRecording,\x20%s,\x20%s',_0x15f46a,_0x61d0('0xf'));logger[_0x61d0('0x10')](_0x61d0('0x11'),_0x15f46a,_0x61d0('0xf'),JSON[_0x61d0('0x12')](_0x968ed5));if(_0x968ed5[_0x61d0('0x13')]){if(_0x968ed5['error'][_0x61d0('0x14')]===0x1f4){logger['error'](_0x61d0('0x15'),_0x15f46a,_0x968ed5[_0x61d0('0x13')][_0x61d0('0x16')]);return _0x1398af(_0x968ed5[_0x61d0('0x13')][_0x61d0('0x16')]);}logger[_0x61d0('0x13')](_0x61d0('0x15'),_0x15f46a,_0x968ed5[_0x61d0('0x13')][_0x61d0('0x16')]);return _0x5a681c(_0x968ed5['error']['message']);}else{logger[_0x61d0('0xe')](_0x61d0('0x15'),_0x15f46a,_0x61d0('0xf'));_0x5a681c(_0x968ed5[_0x61d0('0x17')]['message']);}})['catch'](function(_0x2acd30){logger['error'](_0x61d0('0x15'),_0x15f46a,_0x2acd30);_0x1398af(_0x2acd30);});});}exports[_0x61d0('0x18')]=function(_0x278d5e){var _0x4ca821=this;return new Promise(function(_0x571797,_0x7581a2){return db[_0x61d0('0x19')][_0x61d0('0x1a')](_0x278d5e[_0x61d0('0x1b')],{'raw':_0x278d5e[_0x61d0('0x1c')]?_0x278d5e['options'][_0x61d0('0x1d')]===undefined?!![]:![]:!![]})[_0x61d0('0x1e')](function(_0x34faab){logger['info'](_0x61d0('0x18'),_0x278d5e);logger[_0x61d0('0x10')](_0x61d0('0x18'),_0x278d5e,JSON[_0x61d0('0x12')](_0x34faab));_0x571797(_0x34faab);})[_0x61d0('0x1f')](function(_0xdcc4bd){logger[_0x61d0('0x13')](_0x61d0('0x18'),_0xdcc4bd[_0x61d0('0x16')],_0x278d5e);_0x7581a2(_0x4ca821[_0x61d0('0x13')](0x1f4,_0xdcc4bd[_0x61d0('0x16')]));});});}; \ No newline at end of file +var _0xd2e3=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','SquareRecording,\x20%s,\x20%s','request\x20sent','debug','SquareRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','create','body','options','CreateSquareRecording','lodash','util','moment','randomstring'];(function(_0xfff28b,_0x204443){var _0x13c9f0=function(_0x4d9f58){while(--_0x4d9f58){_0xfff28b['push'](_0xfff28b['shift']());}};_0x13c9f0(++_0x204443);}(_0xd2e3,0x1ac));var _0x3d2e=function(_0x1c93f7,_0x1eaa23){_0x1c93f7=_0x1c93f7-0x0;var _0x4264ad=_0xd2e3[_0x1c93f7];return _0x4264ad;};'use strict';var _=require(_0x3d2e('0x0'));var util=require(_0x3d2e('0x1'));var moment=require(_0x3d2e('0x2'));var BPromise=require('bluebird');var rs=require(_0x3d2e('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3d2e('0x4'))['db'];var utils=require(_0x3d2e('0x5'));var logger=require(_0x3d2e('0x6'))(_0x3d2e('0x7'));var config=require(_0x3d2e('0x8'));var jayson=require(_0x3d2e('0x9'));var client=jayson[_0x3d2e('0xa')][_0x3d2e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4fd37b,_0x5a89a1,_0x10d3fe){return new BPromise(function(_0x26410d,_0x5e4da1){return client['request'](_0x4fd37b,_0x10d3fe)['then'](function(_0x126463){logger[_0x3d2e('0xc')](_0x3d2e('0xd'),_0x5a89a1,_0x3d2e('0xe'));logger[_0x3d2e('0xf')](_0x3d2e('0x10'),_0x5a89a1,'request\x20sent',JSON[_0x3d2e('0x11')](_0x126463));if(_0x126463[_0x3d2e('0x12')]){if(_0x126463[_0x3d2e('0x12')][_0x3d2e('0x13')]===0x1f4){logger[_0x3d2e('0x12')](_0x3d2e('0xd'),_0x5a89a1,_0x126463[_0x3d2e('0x12')][_0x3d2e('0x14')]);return _0x5e4da1(_0x126463[_0x3d2e('0x12')]['message']);}logger[_0x3d2e('0x12')](_0x3d2e('0xd'),_0x5a89a1,_0x126463[_0x3d2e('0x12')][_0x3d2e('0x14')]);return _0x26410d(_0x126463['error']['message']);}else{logger['info'](_0x3d2e('0xd'),_0x5a89a1,_0x3d2e('0xe'));_0x26410d(_0x126463[_0x3d2e('0x15')][_0x3d2e('0x14')]);}})[_0x3d2e('0x16')](function(_0x1ac98f){logger[_0x3d2e('0x12')]('SquareRecording,\x20%s,\x20%s',_0x5a89a1,_0x1ac98f);_0x5e4da1(_0x1ac98f);});});}exports['CreateSquareRecording']=function(_0x21ca35){var _0x41431b=this;return new Promise(function(_0x2f8700,_0x3532ab){return db['SquareRecording'][_0x3d2e('0x17')](_0x21ca35[_0x3d2e('0x18')],{'raw':_0x21ca35['options']?_0x21ca35[_0x3d2e('0x19')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x51eaf4){logger['info'](_0x3d2e('0x1a'),_0x21ca35);logger[_0x3d2e('0xf')](_0x3d2e('0x1a'),_0x21ca35,JSON['stringify'](_0x51eaf4));_0x2f8700(_0x51eaf4);})['catch'](function(_0x171042){logger['error'](_0x3d2e('0x1a'),_0x171042[_0x3d2e('0x14')],_0x21ca35);_0x3532ab(_0x41431b[_0x3d2e('0x12')](0x1f4,_0x171042[_0x3d2e('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index 28fd546..c78d873 100644 --- a/server/api/squareReport/index.js +++ b/server/api/squareReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['/describe','describe','/:id','show','post','create','put','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReport.controller','get','isAuthenticated','index'];(function(_0x40d013,_0x3206ea){var _0xd93aa9=function(_0x53aee6){while(--_0x53aee6){_0x40d013['push'](_0x40d013['shift']());}};_0xd93aa9(++_0x3206ea);}(_0xe706,0xa3));var _0x6e70=function(_0xa0ab99,_0x5496c1){_0xa0ab99=_0xa0ab99-0x0;var _0x3bf6b5=_0xe706[_0xa0ab99];return _0x3bf6b5;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var controller=require(_0x6e70('0x9'));router[_0x6e70('0xa')]('/',auth[_0x6e70('0xb')](),controller[_0x6e70('0xc')]);router[_0x6e70('0xa')](_0x6e70('0xd'),auth[_0x6e70('0xb')](),controller[_0x6e70('0xe')]);router[_0x6e70('0xa')](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x10')]);router[_0x6e70('0x11')]('/',auth[_0x6e70('0xb')](),controller[_0x6e70('0x12')]);router[_0x6e70('0x13')](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller['update']);router['delete'](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x14')]);module[_0x6e70('0x15')]=router; \ No newline at end of file +var _0xb10b=['../../components/interaction/service','../../config/environment','./squareReport.controller','get','index','isAuthenticated','describe','/:id','show','post','update','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x349eda,_0x3ef742){var _0x3144c4=function(_0x3c4770){while(--_0x3c4770){_0x349eda['push'](_0x349eda['shift']());}};_0x3144c4(++_0x3ef742);}(_0xb10b,0x12a));var _0xbb10=function(_0x1ca995,_0x458edc){_0x1ca995=_0x1ca995-0x0;var _0x6c1cbb=_0xb10b[_0x1ca995];return _0x6c1cbb;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var fs_extra=require(_0xbb10('0x4'));var auth=require(_0xbb10('0x5'));var interaction=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var controller=require(_0xbb10('0x8'));router[_0xbb10('0x9')]('/',auth['isAuthenticated'](),controller[_0xbb10('0xa')]);router[_0xbb10('0x9')]('/describe',auth[_0xbb10('0xb')](),controller[_0xbb10('0xc')]);router[_0xbb10('0x9')](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0xe')]);router[_0xbb10('0xf')]('/',auth[_0xbb10('0xb')](),controller['create']);router['put'](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x10')]);router['delete'](_0xbb10('0xd'),auth['isAuthenticated'](),controller[_0xbb10('0x11')]);module[_0xbb10('0x12')]=router; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.attributes.js b/server/api/squareReport/squareReport.attributes.js index 8719aa0..110dc24 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 _0x7618=['DATE','BOOLEAN','STRING'];(function(_0x5619e7,_0x5ce0a9){var _0x46c043=function(_0x22d8b4){while(--_0x22d8b4){_0x5619e7['push'](_0x5619e7['shift']());}};_0x46c043(++_0x5ce0a9);}(_0x7618,0x119));var _0x8761=function(_0x37ebec,_0x3e8fc1){_0x37ebec=_0x37ebec-0x0;var _0x3964d0=_0x7618[_0x37ebec];return _0x3964d0;};'use strict';var Sequelize=require('sequelize');module['exports']={'network':{'type':Sequelize['STRING']},'network_script':{'type':Sequelize[_0x8761('0x0')]},'request':{'type':Sequelize[_0x8761('0x0')]},'channel':{'type':Sequelize[_0x8761('0x0')]},'language':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x8761('0x0')]},'uniqueid':{'type':Sequelize['STRING']},'version':{'type':Sequelize[_0x8761('0x0')]},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x8761('0x0')]},'callingpres':{'type':Sequelize['STRING']},'callingani2':{'type':Sequelize[_0x8761('0x0')]},'callington':{'type':Sequelize[_0x8761('0x0')]},'callingtns':{'type':Sequelize[_0x8761('0x0')]},'dnid':{'type':Sequelize[_0x8761('0x0')]},'rdnis':{'type':Sequelize[_0x8761('0x0')]},'context':{'type':Sequelize[_0x8761('0x0')]},'extension':{'type':Sequelize[_0x8761('0x0')]},'priority':{'type':Sequelize[_0x8761('0x0')]},'enhanced':{'type':Sequelize[_0x8761('0x0')]},'accountcode':{'type':Sequelize['STRING']},'threadid':{'type':Sequelize['STRING']},'project_name':{'type':Sequelize[_0x8761('0x0')]},'joinAt':{'type':Sequelize[_0x8761('0x1')]},'leaveAt':{'type':Sequelize[_0x8761('0x1')]},'bot':{'type':Sequelize[_0x8761('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0xff8f=['sequelize','STRING','DATE','BOOLEAN'];(function(_0x4f2ab7,_0x4daac6){var _0x56b181=function(_0x532e2c){while(--_0x532e2c){_0x4f2ab7['push'](_0x4f2ab7['shift']());}};_0x56b181(++_0x4daac6);}(_0xff8f,0x1e0));var _0xfff8=function(_0x46058c,_0x2becc4){_0x46058c=_0x46058c-0x0;var _0x2d1e6d=_0xff8f[_0x46058c];return _0x2d1e6d;};'use strict';var Sequelize=require(_0xfff8('0x0'));module['exports']={'network':{'type':Sequelize[_0xfff8('0x1')]},'network_script':{'type':Sequelize[_0xfff8('0x1')]},'request':{'type':Sequelize[_0xfff8('0x1')]},'channel':{'type':Sequelize[_0xfff8('0x1')]},'language':{'type':Sequelize[_0xfff8('0x1')]},'type':{'type':Sequelize[_0xfff8('0x1')]},'uniqueid':{'type':Sequelize[_0xfff8('0x1')]},'version':{'type':Sequelize[_0xfff8('0x1')]},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xfff8('0x1')]},'callingpres':{'type':Sequelize[_0xfff8('0x1')]},'callingani2':{'type':Sequelize[_0xfff8('0x1')]},'callington':{'type':Sequelize[_0xfff8('0x1')]},'callingtns':{'type':Sequelize[_0xfff8('0x1')]},'dnid':{'type':Sequelize[_0xfff8('0x1')]},'rdnis':{'type':Sequelize[_0xfff8('0x1')]},'context':{'type':Sequelize[_0xfff8('0x1')]},'extension':{'type':Sequelize[_0xfff8('0x1')]},'priority':{'type':Sequelize[_0xfff8('0x1')]},'enhanced':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xfff8('0x1')]},'threadid':{'type':Sequelize[_0xfff8('0x1')]},'project_name':{'type':Sequelize[_0xfff8('0x1')]},'joinAt':{'type':Sequelize[_0xfff8('0x2')]},'leaveAt':{'type':Sequelize[_0xfff8('0x2')]},'bot':{'type':Sequelize[_0xfff8('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.controller.js b/server/api/squareReport/squareReport.controller.js index 8fbd555..7c3e6e8 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 _0x0ecd=['undefined','limit','count','offset','set','Content-Range','apply','reject','update','then','destroy','send','SquareReport','rawAttributes','fieldName','type','key','model','map','name','query','intersection','fields','attributes','sort','where','filters','filter','VIRTUAL','options','rows','catch','show','keys','length','includeAll','include','merge','find','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','ejs','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json'];(function(_0xd1d19a,_0x1933f0){var _0x52a79d=function(_0x5199e2){while(--_0x5199e2){_0xd1d19a['push'](_0xd1d19a['shift']());}};_0x52a79d(++_0x1933f0);}(_0x0ecd,0x14f));var _0xd0ec=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0ecd[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xd0ec('0x0'));var rimraf=require(_0xd0ec('0x1'));var zipdir=require(_0xd0ec('0x2'));var jsonpatch=require(_0xd0ec('0x3'));var rp=require(_0xd0ec('0x4'));var moment=require(_0xd0ec('0x5'));var BPromise=require(_0xd0ec('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0xd0ec('0x7'));var sox=require(_0xd0ec('0x8'));var csv=require('to-csv');var ejs=require(_0xd0ec('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xd0ec('0xa'));var crypto=require(_0xd0ec('0xb'));var jsforce=require(_0xd0ec('0xc'));var deskjs=require(_0xd0ec('0xd'));var toCsv=require(_0xd0ec('0xe'));var querystring=require(_0xd0ec('0xf'));var Papa=require(_0xd0ec('0x10'));var Redis=require(_0xd0ec('0x11'));var authService=require(_0xd0ec('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xd0ec('0x13'));var hardwareService=require(_0xd0ec('0x14'));var logger=require(_0xd0ec('0x15'))(_0xd0ec('0x16'));var utils=require('../../config/utils');var config=require(_0xd0ec('0x17'));var licenseUtil=require(_0xd0ec('0x18'));var db=require(_0xd0ec('0x19'))['db'];function respondWithStatusCode(_0x5ac7d0,_0x265df1){_0x265df1=_0x265df1||0xcc;return function(_0x857e3c){if(_0x857e3c){return _0x5ac7d0[_0xd0ec('0x1a')](_0x265df1);}return _0x5ac7d0[_0xd0ec('0x1b')](_0x265df1)[_0xd0ec('0x1c')]();};}function respondWithResult(_0x1fae5d,_0x26df94){_0x26df94=_0x26df94||0xc8;return function(_0x1b8590){if(_0x1b8590){return _0x1fae5d[_0xd0ec('0x1b')](_0x26df94)[_0xd0ec('0x1d')](_0x1b8590);}};}function respondWithFilteredResult(_0x46be7d,_0x360c31){return function(_0x2f9d7b){if(_0x2f9d7b){var _0x32e165=typeof _0x360c31['offset']===_0xd0ec('0x1e')&&typeof _0x360c31[_0xd0ec('0x1f')]===_0xd0ec('0x1e');var _0x513336=_0x2f9d7b[_0xd0ec('0x20')];var _0x4f53dd=_0x32e165?0x0:_0x360c31[_0xd0ec('0x21')];var _0x176ce1=_0x32e165?_0x2f9d7b[_0xd0ec('0x20')]:_0x360c31[_0xd0ec('0x21')]+_0x360c31[_0xd0ec('0x1f')];var _0x2c916d;if(_0x176ce1>=_0x513336){_0x176ce1=_0x513336;_0x2c916d=0xc8;}else{_0x2c916d=0xce;}_0x46be7d['status'](_0x2c916d);return _0x46be7d[_0xd0ec('0x22')](_0xd0ec('0x23'),_0x4f53dd+'-'+_0x176ce1+'/'+_0x513336)[_0xd0ec('0x1d')](_0x2f9d7b);}return null;};}function patchUpdates(_0x34bd23){return function(_0x1ae424){try{jsonpatch[_0xd0ec('0x24')](_0x1ae424,_0x34bd23,!![]);}catch(_0x3d9f67){return BPromise[_0xd0ec('0x25')](_0x3d9f67);}return _0x1ae424['save']();};}function saveUpdates(_0x249ac1,_0x50edd0){return function(_0x5a8d2c){if(_0x5a8d2c){return _0x5a8d2c[_0xd0ec('0x26')](_0x249ac1)[_0xd0ec('0x27')](function(_0xe5b3d3){return _0xe5b3d3;});}return null;};}function removeEntity(_0x4286b8,_0x145676){return function(_0x395667){if(_0x395667){return _0x395667[_0xd0ec('0x28')]()[_0xd0ec('0x27')](function(){_0x4286b8[_0xd0ec('0x1b')](0xcc)[_0xd0ec('0x1c')]();});}};}function handleEntityNotFound(_0x1ffb21,_0x5080b8){return function(_0x1b11a4){if(!_0x1b11a4){_0x1ffb21[_0xd0ec('0x1a')](0x194);}return _0x1b11a4;};}function handleError(_0x38e913,_0x567ceb){_0x567ceb=_0x567ceb||0x1f4;return function(_0x106c17){logger['error'](_0x106c17['stack']);if(_0x106c17['name']){delete _0x106c17['name'];}_0x38e913[_0xd0ec('0x1b')](_0x567ceb)[_0xd0ec('0x29')](_0x106c17);};}exports['index']=function(_0x550d1e,_0x16501a){var _0x2127b4={},_0x245d1c={},_0x5d7b0c={'count':0x0,'rows':[]};var _0x59a291=_['map'](db[_0xd0ec('0x2a')][_0xd0ec('0x2b')],function(_0x2c6cf1){return{'name':_0x2c6cf1[_0xd0ec('0x2c')],'type':_0x2c6cf1[_0xd0ec('0x2d')][_0xd0ec('0x2e')]};});_0x245d1c[_0xd0ec('0x2f')]=_[_0xd0ec('0x30')](_0x59a291,_0xd0ec('0x31'));_0x245d1c[_0xd0ec('0x32')]=_['keys'](_0x550d1e[_0xd0ec('0x32')]);_0x245d1c['filters']=_['intersection'](_0x245d1c[_0xd0ec('0x2f')],_0x245d1c[_0xd0ec('0x32')]);_0x2127b4['attributes']=_[_0xd0ec('0x33')](_0x245d1c[_0xd0ec('0x2f')],qs[_0xd0ec('0x34')](_0x550d1e[_0xd0ec('0x32')]['fields']));_0x2127b4['attributes']=_0x2127b4[_0xd0ec('0x35')]['length']?_0x2127b4['attributes']:_0x245d1c[_0xd0ec('0x2f')];if(!_0x550d1e['query']['hasOwnProperty']('nolimit')){_0x2127b4[_0xd0ec('0x1f')]=qs['limit'](_0x550d1e[_0xd0ec('0x32')][_0xd0ec('0x1f')]);_0x2127b4[_0xd0ec('0x21')]=qs['offset'](_0x550d1e[_0xd0ec('0x32')]['offset']);}_0x2127b4['order']=qs['sort'](_0x550d1e[_0xd0ec('0x32')][_0xd0ec('0x36')]);_0x2127b4[_0xd0ec('0x37')]=qs[_0xd0ec('0x38')](_['pick'](_0x550d1e[_0xd0ec('0x32')],_0x245d1c['filters']),_0x59a291);if(_0x550d1e[_0xd0ec('0x32')][_0xd0ec('0x39')]){_0x2127b4['where']=_['merge'](_0x2127b4[_0xd0ec('0x37')],{'$or':_['map'](_0x59a291,function(_0x2ae00c){if(_0x2ae00c[_0xd0ec('0x2d')]!==_0xd0ec('0x3a')){var _0x580585={};_0x580585[_0x2ae00c[_0xd0ec('0x31')]]={'$like':'%'+_0x550d1e[_0xd0ec('0x32')][_0xd0ec('0x39')]+'%'};return _0x580585;}})});}_0x2127b4=_['merge']({},_0x2127b4,_0x550d1e[_0xd0ec('0x3b')]);var _0x332046={'where':_0x2127b4[_0xd0ec('0x37')]};return db[_0xd0ec('0x2a')][_0xd0ec('0x20')](_0x332046)[_0xd0ec('0x27')](function(_0x7d7ca4){_0x5d7b0c['count']=_0x7d7ca4;if(_0x550d1e[_0xd0ec('0x32')]['includeAll']){_0x2127b4['include']=[{'all':!![]}];}return db[_0xd0ec('0x2a')]['findAll'](_0x2127b4);})[_0xd0ec('0x27')](function(_0x15d943){_0x5d7b0c[_0xd0ec('0x3c')]=_0x15d943;return _0x5d7b0c;})[_0xd0ec('0x27')](respondWithFilteredResult(_0x16501a,_0x2127b4))[_0xd0ec('0x3d')](handleError(_0x16501a,null));};exports[_0xd0ec('0x3e')]=function(_0x41c339,_0x422a52){var _0x6521b4={'raw':!![],'where':{'id':_0x41c339['params']['id']}},_0xaf6fde={};_0xaf6fde['model']=_['keys'](db[_0xd0ec('0x2a')][_0xd0ec('0x2b')]);_0xaf6fde[_0xd0ec('0x32')]=_[_0xd0ec('0x3f')](_0x41c339[_0xd0ec('0x32')]);_0xaf6fde[_0xd0ec('0x38')]=_[_0xd0ec('0x33')](_0xaf6fde['model'],_0xaf6fde[_0xd0ec('0x32')]);_0x6521b4[_0xd0ec('0x35')]=_[_0xd0ec('0x33')](_0xaf6fde[_0xd0ec('0x2f')],qs[_0xd0ec('0x34')](_0x41c339[_0xd0ec('0x32')][_0xd0ec('0x34')]));_0x6521b4[_0xd0ec('0x35')]=_0x6521b4[_0xd0ec('0x35')][_0xd0ec('0x40')]?_0x6521b4[_0xd0ec('0x35')]:_0xaf6fde['model'];if(_0x41c339[_0xd0ec('0x32')][_0xd0ec('0x41')]){_0x6521b4[_0xd0ec('0x42')]=[{'all':!![]}];}_0x6521b4=_[_0xd0ec('0x43')]({},_0x6521b4,_0x41c339[_0xd0ec('0x3b')]);return db[_0xd0ec('0x2a')][_0xd0ec('0x44')](_0x6521b4)[_0xd0ec('0x27')](handleEntityNotFound(_0x422a52,null))[_0xd0ec('0x27')](respondWithResult(_0x422a52,null))['catch'](handleError(_0x422a52,null));};exports[_0xd0ec('0x45')]=function(_0x1d1ce0,_0xeb28d0){return db['SquareReport']['create'](_0x1d1ce0[_0xd0ec('0x46')],{})[_0xd0ec('0x27')](respondWithResult(_0xeb28d0,0xc9))['catch'](handleError(_0xeb28d0,null));};exports[_0xd0ec('0x26')]=function(_0x12a95c,_0x51b89a){if(_0x12a95c[_0xd0ec('0x46')]['id']){delete _0x12a95c[_0xd0ec('0x46')]['id'];}return db['SquareReport']['find']({'where':{'id':_0x12a95c[_0xd0ec('0x47')]['id']}})[_0xd0ec('0x27')](handleEntityNotFound(_0x51b89a,null))[_0xd0ec('0x27')](saveUpdates(_0x12a95c[_0xd0ec('0x46')],null))[_0xd0ec('0x27')](respondWithResult(_0x51b89a,null))[_0xd0ec('0x3d')](handleError(_0x51b89a,null));};exports[_0xd0ec('0x28')]=function(_0x360dd8,_0x3ec304){return db[_0xd0ec('0x2a')][_0xd0ec('0x44')]({'where':{'id':_0x360dd8[_0xd0ec('0x47')]['id']}})['then'](handleEntityNotFound(_0x3ec304,null))[_0xd0ec('0x27')](removeEntity(_0x3ec304,null))['catch'](handleError(_0x3ec304,null));};exports[_0xd0ec('0x48')]=function(_0x2c50e1,_0x121778){return db['SquareReport'][_0xd0ec('0x48')]()[_0xd0ec('0x27')](respondWithResult(_0x121778,null))['catch'](handleError(_0x121778,null));}; \ No newline at end of file +var _0x118a=['find','create','body','describe','eml-format','rimraf','fast-json-patch','request-promise','bluebird','util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../config/license/util','end','status','json','offset','undefined','limit','count','Content-Range','save','update','then','destroy','stack','name','send','index','SquareReport','rawAttributes','fieldName','type','key','model','map','query','keys','intersection','fields','attributes','hasOwnProperty','order','sort','pick','filter','merge','VIRTUAL','options','where','include','findAll','rows','catch','show','params','filters','includeAll'];(function(_0x2de5cf,_0x4668fc){var _0x131b2b=function(_0x552987){while(--_0x552987){_0x2de5cf['push'](_0x2de5cf['shift']());}};_0x131b2b(++_0x4668fc);}(_0x118a,0x1a8));var _0xa118=function(_0x9c839,_0x3512b8){_0x9c839=_0x9c839-0x0;var _0x2586af=_0x118a[_0x9c839];return _0x2586af;};'use strict';var emlformat=require(_0xa118('0x0'));var rimraf=require(_0xa118('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa118('0x2'));var rp=require(_0xa118('0x3'));var moment=require('moment');var BPromise=require(_0xa118('0x4'));var Mustache=require('mustache');var util=require(_0xa118('0x5'));var path=require(_0xa118('0x6'));var sox=require('sox');var csv=require(_0xa118('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa118('0x8'));var _=require(_0xa118('0x9'));var squel=require(_0xa118('0xa'));var crypto=require(_0xa118('0xb'));var jsforce=require(_0xa118('0xc'));var deskjs=require(_0xa118('0xd'));var toCsv=require(_0xa118('0x7'));var querystring=require(_0xa118('0xe'));var Papa=require(_0xa118('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xa118('0x10'));var as=require(_0xa118('0x11'));var hardwareService=require(_0xa118('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xa118('0x13'));var licenseUtil=require(_0xa118('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x225390,_0x228b8a){_0x228b8a=_0x228b8a||0xcc;return function(_0x35a222){if(_0x35a222){return _0x225390['sendStatus'](_0x228b8a);}return _0x225390['status'](_0x228b8a)[_0xa118('0x15')]();};}function respondWithResult(_0xb655cc,_0x3d2cd2){_0x3d2cd2=_0x3d2cd2||0xc8;return function(_0x37334e){if(_0x37334e){return _0xb655cc[_0xa118('0x16')](_0x3d2cd2)[_0xa118('0x17')](_0x37334e);}};}function respondWithFilteredResult(_0x2d2fad,_0x580fa1){return function(_0x1dd0f1){if(_0x1dd0f1){var _0x12a7a9=typeof _0x580fa1[_0xa118('0x18')]===_0xa118('0x19')&&typeof _0x580fa1[_0xa118('0x1a')]==='undefined';var _0x13dc05=_0x1dd0f1[_0xa118('0x1b')];var _0x318de0=_0x12a7a9?0x0:_0x580fa1[_0xa118('0x18')];var _0x576994=_0x12a7a9?_0x1dd0f1[_0xa118('0x1b')]:_0x580fa1[_0xa118('0x18')]+_0x580fa1[_0xa118('0x1a')];var _0x4b0ba4;if(_0x576994>=_0x13dc05){_0x576994=_0x13dc05;_0x4b0ba4=0xc8;}else{_0x4b0ba4=0xce;}_0x2d2fad[_0xa118('0x16')](_0x4b0ba4);return _0x2d2fad['set'](_0xa118('0x1c'),_0x318de0+'-'+_0x576994+'/'+_0x13dc05)['json'](_0x1dd0f1);}return null;};}function patchUpdates(_0x44a8e7){return function(_0x276811){try{jsonpatch['apply'](_0x276811,_0x44a8e7,!![]);}catch(_0x266840){return BPromise['reject'](_0x266840);}return _0x276811[_0xa118('0x1d')]();};}function saveUpdates(_0x3ff23d,_0x2d9315){return function(_0x3918e7){if(_0x3918e7){return _0x3918e7[_0xa118('0x1e')](_0x3ff23d)[_0xa118('0x1f')](function(_0x297512){return _0x297512;});}return null;};}function removeEntity(_0x53e264,_0x416314){return function(_0x2fdc12){if(_0x2fdc12){return _0x2fdc12[_0xa118('0x20')]()[_0xa118('0x1f')](function(){_0x53e264[_0xa118('0x16')](0xcc)[_0xa118('0x15')]();});}};}function handleEntityNotFound(_0x1855f3,_0x7189c5){return function(_0x3881f1){if(!_0x3881f1){_0x1855f3['sendStatus'](0x194);}return _0x3881f1;};}function handleError(_0x4ebeb3,_0x1b3c86){_0x1b3c86=_0x1b3c86||0x1f4;return function(_0x1908e4){logger['error'](_0x1908e4[_0xa118('0x21')]);if(_0x1908e4['name']){delete _0x1908e4[_0xa118('0x22')];}_0x4ebeb3[_0xa118('0x16')](_0x1b3c86)[_0xa118('0x23')](_0x1908e4);};}exports[_0xa118('0x24')]=function(_0x3806e3,_0xc43ac2){var _0x4ae3b6={},_0x45095e={},_0x2da316={'count':0x0,'rows':[]};var _0xab5fe4=_['map'](db[_0xa118('0x25')][_0xa118('0x26')],function(_0x314c75){return{'name':_0x314c75[_0xa118('0x27')],'type':_0x314c75[_0xa118('0x28')][_0xa118('0x29')]};});_0x45095e[_0xa118('0x2a')]=_[_0xa118('0x2b')](_0xab5fe4,_0xa118('0x22'));_0x45095e[_0xa118('0x2c')]=_[_0xa118('0x2d')](_0x3806e3[_0xa118('0x2c')]);_0x45095e['filters']=_[_0xa118('0x2e')](_0x45095e['model'],_0x45095e['query']);_0x4ae3b6['attributes']=_[_0xa118('0x2e')](_0x45095e['model'],qs[_0xa118('0x2f')](_0x3806e3[_0xa118('0x2c')][_0xa118('0x2f')]));_0x4ae3b6[_0xa118('0x30')]=_0x4ae3b6['attributes']['length']?_0x4ae3b6[_0xa118('0x30')]:_0x45095e[_0xa118('0x2a')];if(!_0x3806e3['query'][_0xa118('0x31')]('nolimit')){_0x4ae3b6[_0xa118('0x1a')]=qs[_0xa118('0x1a')](_0x3806e3[_0xa118('0x2c')][_0xa118('0x1a')]);_0x4ae3b6[_0xa118('0x18')]=qs[_0xa118('0x18')](_0x3806e3[_0xa118('0x2c')][_0xa118('0x18')]);}_0x4ae3b6[_0xa118('0x32')]=qs['sort'](_0x3806e3[_0xa118('0x2c')][_0xa118('0x33')]);_0x4ae3b6['where']=qs['filters'](_[_0xa118('0x34')](_0x3806e3['query'],_0x45095e['filters']),_0xab5fe4);if(_0x3806e3[_0xa118('0x2c')][_0xa118('0x35')]){_0x4ae3b6['where']=_[_0xa118('0x36')](_0x4ae3b6['where'],{'$or':_['map'](_0xab5fe4,function(_0x2c6da5){if(_0x2c6da5[_0xa118('0x28')]!==_0xa118('0x37')){var _0x378cfb={};_0x378cfb[_0x2c6da5[_0xa118('0x22')]]={'$like':'%'+_0x3806e3[_0xa118('0x2c')][_0xa118('0x35')]+'%'};return _0x378cfb;}})});}_0x4ae3b6=_[_0xa118('0x36')]({},_0x4ae3b6,_0x3806e3[_0xa118('0x38')]);var _0x10fdfd={'where':_0x4ae3b6[_0xa118('0x39')]};return db[_0xa118('0x25')][_0xa118('0x1b')](_0x10fdfd)['then'](function(_0x4fa51a){_0x2da316['count']=_0x4fa51a;if(_0x3806e3[_0xa118('0x2c')]['includeAll']){_0x4ae3b6[_0xa118('0x3a')]=[{'all':!![]}];}return db['SquareReport'][_0xa118('0x3b')](_0x4ae3b6);})['then'](function(_0x246c1b){_0x2da316[_0xa118('0x3c')]=_0x246c1b;return _0x2da316;})[_0xa118('0x1f')](respondWithFilteredResult(_0xc43ac2,_0x4ae3b6))[_0xa118('0x3d')](handleError(_0xc43ac2,null));};exports[_0xa118('0x3e')]=function(_0x5b4785,_0x395cc4){var _0x39fe9d={'raw':!![],'where':{'id':_0x5b4785[_0xa118('0x3f')]['id']}},_0x3451f7={};_0x3451f7[_0xa118('0x2a')]=_['keys'](db[_0xa118('0x25')]['rawAttributes']);_0x3451f7[_0xa118('0x2c')]=_['keys'](_0x5b4785[_0xa118('0x2c')]);_0x3451f7[_0xa118('0x40')]=_['intersection'](_0x3451f7[_0xa118('0x2a')],_0x3451f7[_0xa118('0x2c')]);_0x39fe9d[_0xa118('0x30')]=_[_0xa118('0x2e')](_0x3451f7['model'],qs[_0xa118('0x2f')](_0x5b4785[_0xa118('0x2c')][_0xa118('0x2f')]));_0x39fe9d['attributes']=_0x39fe9d[_0xa118('0x30')]['length']?_0x39fe9d[_0xa118('0x30')]:_0x3451f7[_0xa118('0x2a')];if(_0x5b4785[_0xa118('0x2c')][_0xa118('0x41')]){_0x39fe9d['include']=[{'all':!![]}];}_0x39fe9d=_['merge']({},_0x39fe9d,_0x5b4785[_0xa118('0x38')]);return db[_0xa118('0x25')][_0xa118('0x42')](_0x39fe9d)[_0xa118('0x1f')](handleEntityNotFound(_0x395cc4,null))[_0xa118('0x1f')](respondWithResult(_0x395cc4,null))[_0xa118('0x3d')](handleError(_0x395cc4,null));};exports[_0xa118('0x43')]=function(_0x16d596,_0x28b525){return db[_0xa118('0x25')]['create'](_0x16d596[_0xa118('0x44')],{})[_0xa118('0x1f')](respondWithResult(_0x28b525,0xc9))[_0xa118('0x3d')](handleError(_0x28b525,null));};exports['update']=function(_0xabdb1b,_0x249c5e){if(_0xabdb1b[_0xa118('0x44')]['id']){delete _0xabdb1b['body']['id'];}return db[_0xa118('0x25')]['find']({'where':{'id':_0xabdb1b[_0xa118('0x3f')]['id']}})[_0xa118('0x1f')](handleEntityNotFound(_0x249c5e,null))[_0xa118('0x1f')](saveUpdates(_0xabdb1b['body'],null))[_0xa118('0x1f')](respondWithResult(_0x249c5e,null))['catch'](handleError(_0x249c5e,null));};exports[_0xa118('0x20')]=function(_0x57b3a6,_0x4ad9b3){return db[_0xa118('0x25')][_0xa118('0x42')]({'where':{'id':_0x57b3a6[_0xa118('0x3f')]['id']}})[_0xa118('0x1f')](handleEntityNotFound(_0x4ad9b3,null))[_0xa118('0x1f')](removeEntity(_0x4ad9b3,null))[_0xa118('0x3d')](handleError(_0x4ad9b3,null));};exports[_0xa118('0x45')]=function(_0x5d2ab0,_0x2afba1){return db[_0xa118('0x25')]['describe']()[_0xa118('0x1f')](respondWithResult(_0x2afba1,null))[_0xa118('0x3d')](handleError(_0x2afba1,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index a05da43..98898ee 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 _0xbb03=['define','SquareReport','report_square','uid_pname','uniqueid','project_name','leaveAt','../../config/logger','moment','bluebird','path','../../config/environment','./squareReport.attributes'];(function(_0x32b542,_0x4512fa){var _0x554d54=function(_0x35cdfc){while(--_0x35cdfc){_0x32b542['push'](_0x32b542['shift']());}};_0x554d54(++_0x4512fa);}(_0xbb03,0x19a));var _0x3bb0=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xbb03[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3bb0('0x0'))('api');var moment=require(_0x3bb0('0x1'));var BPromise=require(_0x3bb0('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3bb0('0x3'));var rimraf=require('rimraf');var config=require(_0x3bb0('0x4'));var attributes=require(_0x3bb0('0x5'));module['exports']=function(_0x3d16b7,_0x3f9810){return _0x3d16b7[_0x3bb0('0x6')](_0x3bb0('0x7'),attributes,{'tableName':_0x3bb0('0x8'),'paranoid':![],'indexes':[{'name':_0x3bb0('0x9'),'fields':[_0x3bb0('0xa'),_0x3bb0('0xb')]},{'name':_0x3bb0('0xc'),'fields':['leaveAt']}],'timestamps':!![]});}; \ No newline at end of file +var _0x91d4=['../../config/environment','./squareReport.attributes','exports','define','report_square','uid_pname','uniqueid','project_name','leaveAt','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf'];(function(_0x3bd792,_0x171a3e){var _0x405c0f=function(_0x3c2cae){while(--_0x3c2cae){_0x3bd792['push'](_0x3bd792['shift']());}};_0x405c0f(++_0x171a3e);}(_0x91d4,0x89));var _0x491d=function(_0x5a3f3a,_0x3ae10e){_0x5a3f3a=_0x5a3f3a-0x0;var _0x5a6216=_0x91d4[_0x5a3f3a];return _0x5a6216;};'use strict';var _=require(_0x491d('0x0'));var util=require(_0x491d('0x1'));var logger=require(_0x491d('0x2'))('api');var moment=require(_0x491d('0x3'));var BPromise=require(_0x491d('0x4'));var rp=require(_0x491d('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x491d('0x6'));var config=require(_0x491d('0x7'));var attributes=require(_0x491d('0x8'));module[_0x491d('0x9')]=function(_0xef7d3c,_0x36fc3e){return _0xef7d3c[_0x491d('0xa')]('SquareReport',attributes,{'tableName':_0x491d('0xb'),'paranoid':![],'indexes':[{'name':_0x491d('0xc'),'fields':[_0x491d('0xd'),_0x491d('0xe')]},{'name':_0x491d('0xf'),'fields':[_0x491d('0xf')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.rpc.js b/server/api/squareReport/squareReport.rpc.js index fa62d74..cd6d2de 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 _0xf183=['result','catch','SquareReport','create','body','options','raw','CreateSquareReport','debug','UpdateSquareReport','where','attributes','limit','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info','SquareReport,\x20%s,\x20%s','request\x20sent','SquareReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x5470d4,_0x51559e){var _0x190bad=function(_0x2d2bf1){while(--_0x2d2bf1){_0x5470d4['push'](_0x5470d4['shift']());}};_0x190bad(++_0x51559e);}(_0xf183,0x136));var _0x3f18=function(_0x744673,_0x3fa230){_0x744673=_0x744673-0x0;var _0x19b1fe=_0xf183[_0x744673];return _0x19b1fe;};'use strict';var _=require(_0x3f18('0x0'));var util=require(_0x3f18('0x1'));var moment=require('moment');var BPromise=require(_0x3f18('0x2'));var rs=require(_0x3f18('0x3'));var fs=require('fs');var Redis=require(_0x3f18('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x3f18('0x5'));var logger=require(_0x3f18('0x6'))('rpc');var config=require(_0x3f18('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x3f18('0x8')][_0x3f18('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4fa808,_0x3ca4fe,_0x26de8a){return new BPromise(function(_0x1fa3ce,_0x174881){return client[_0x3f18('0xa')](_0x4fa808,_0x26de8a)[_0x3f18('0xb')](function(_0x24e797){logger[_0x3f18('0xc')](_0x3f18('0xd'),_0x3ca4fe,_0x3f18('0xe'));logger['debug'](_0x3f18('0xf'),_0x3ca4fe,_0x3f18('0xe'),JSON[_0x3f18('0x10')](_0x24e797));if(_0x24e797[_0x3f18('0x11')]){if(_0x24e797[_0x3f18('0x11')][_0x3f18('0x12')]===0x1f4){logger[_0x3f18('0x11')](_0x3f18('0xd'),_0x3ca4fe,_0x24e797['error'][_0x3f18('0x13')]);return _0x174881(_0x24e797[_0x3f18('0x11')][_0x3f18('0x13')]);}logger[_0x3f18('0x11')](_0x3f18('0xd'),_0x3ca4fe,_0x24e797[_0x3f18('0x11')][_0x3f18('0x13')]);return _0x1fa3ce(_0x24e797[_0x3f18('0x11')][_0x3f18('0x13')]);}else{logger[_0x3f18('0xc')](_0x3f18('0xd'),_0x3ca4fe,_0x3f18('0xe'));_0x1fa3ce(_0x24e797[_0x3f18('0x14')][_0x3f18('0x13')]);}})[_0x3f18('0x15')](function(_0x3b14d0){logger[_0x3f18('0x11')](_0x3f18('0xd'),_0x3ca4fe,_0x3b14d0);_0x174881(_0x3b14d0);});});}exports['CreateSquareReport']=function(_0x179607){var _0x12c859=this;return new Promise(function(_0x3bba7e,_0x2b1b67){return db[_0x3f18('0x16')][_0x3f18('0x17')](_0x179607[_0x3f18('0x18')],{'raw':_0x179607['options']?_0x179607[_0x3f18('0x19')][_0x3f18('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x5999ab){logger[_0x3f18('0xc')](_0x3f18('0x1b'),_0x179607);logger[_0x3f18('0x1c')](_0x3f18('0x1b'),_0x179607,JSON['stringify'](_0x5999ab));_0x3bba7e(_0x5999ab);})[_0x3f18('0x15')](function(_0xbac0de){logger[_0x3f18('0x11')](_0x3f18('0x1b'),_0xbac0de[_0x3f18('0x13')],_0x179607);_0x2b1b67(_0x12c859[_0x3f18('0x11')](0x1f4,_0xbac0de['message']));});});};exports[_0x3f18('0x1d')]=function(_0x561ba0){var _0x4625da=this;return new Promise(function(_0x207355,_0x41d229){return db['SquareReport']['update'](_0x561ba0[_0x3f18('0x18')],{'raw':_0x561ba0['options']?_0x561ba0[_0x3f18('0x19')][_0x3f18('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x561ba0[_0x3f18('0x19')]?_0x561ba0[_0x3f18('0x19')][_0x3f18('0x1e')]||null:null,'attributes':_0x561ba0['options']?_0x561ba0[_0x3f18('0x19')][_0x3f18('0x1f')]||null:null,'limit':_0x561ba0[_0x3f18('0x19')]?_0x561ba0[_0x3f18('0x19')][_0x3f18('0x20')]||null:null})[_0x3f18('0xb')](function(_0x3ada94){logger[_0x3f18('0xc')]('UpdateSquareReport',_0x561ba0);logger[_0x3f18('0x1c')](_0x3f18('0x1d'),_0x561ba0,JSON[_0x3f18('0x10')](_0x3ada94));_0x207355(_0x3ada94);})[_0x3f18('0x15')](function(_0x16b64a){logger[_0x3f18('0x11')]('UpdateSquareReport',_0x16b64a['message'],_0x561ba0);_0x41d229(_0x4625da[_0x3f18('0x11')](0x1f4,_0x16b64a[_0x3f18('0x13')]));});});}; \ No newline at end of file +var _0xce77=['../../config/environment','jayson/promise','client','http','request','then','info','SquareReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','SquareReport,\x20%s,\x20%s','SquareReport','create','raw','CreateSquareReport','debug','catch','update','body','options','where','attributes','limit','UpdateSquareReport','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/logger'];(function(_0x30c7c5,_0x168208){var _0x29e24e=function(_0x427d3e){while(--_0x427d3e){_0x30c7c5['push'](_0x30c7c5['shift']());}};_0x29e24e(++_0x168208);}(_0xce77,0x13a));var _0x7ce7=function(_0xdff113,_0x789db6){_0xdff113=_0xdff113-0x0;var _0x502ea0=_0xce77[_0xdff113];return _0x502ea0;};'use strict';var _=require(_0x7ce7('0x0'));var util=require('util');var moment=require(_0x7ce7('0x1'));var BPromise=require('bluebird');var rs=require(_0x7ce7('0x2'));var fs=require('fs');var Redis=require(_0x7ce7('0x3'));var db=require(_0x7ce7('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x7ce7('0x5'))('rpc');var config=require(_0x7ce7('0x6'));var jayson=require(_0x7ce7('0x7'));var client=jayson[_0x7ce7('0x8')][_0x7ce7('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1dab87,_0x47e14c,_0x2f1131){return new BPromise(function(_0x5c5405,_0x44fda3){return client[_0x7ce7('0xa')](_0x1dab87,_0x2f1131)[_0x7ce7('0xb')](function(_0x5c7e3d){logger[_0x7ce7('0xc')]('SquareReport,\x20%s,\x20%s',_0x47e14c,'request\x20sent');logger['debug'](_0x7ce7('0xd'),_0x47e14c,_0x7ce7('0xe'),JSON[_0x7ce7('0xf')](_0x5c7e3d));if(_0x5c7e3d[_0x7ce7('0x10')]){if(_0x5c7e3d[_0x7ce7('0x10')]['code']===0x1f4){logger['error']('SquareReport,\x20%s,\x20%s',_0x47e14c,_0x5c7e3d[_0x7ce7('0x10')]['message']);return _0x44fda3(_0x5c7e3d[_0x7ce7('0x10')][_0x7ce7('0x11')]);}logger[_0x7ce7('0x10')]('SquareReport,\x20%s,\x20%s',_0x47e14c,_0x5c7e3d[_0x7ce7('0x10')][_0x7ce7('0x11')]);return _0x5c5405(_0x5c7e3d[_0x7ce7('0x10')]['message']);}else{logger[_0x7ce7('0xc')](_0x7ce7('0x12'),_0x47e14c,'request\x20sent');_0x5c5405(_0x5c7e3d['result'][_0x7ce7('0x11')]);}})['catch'](function(_0x3a0352){logger['error']('SquareReport,\x20%s,\x20%s',_0x47e14c,_0x3a0352);_0x44fda3(_0x3a0352);});});}exports['CreateSquareReport']=function(_0x2c60a6){var _0x40993e=this;return new Promise(function(_0x258b8a,_0x195a42){return db[_0x7ce7('0x13')][_0x7ce7('0x14')](_0x2c60a6['body'],{'raw':_0x2c60a6['options']?_0x2c60a6['options'][_0x7ce7('0x15')]===undefined?!![]:![]:!![]})[_0x7ce7('0xb')](function(_0x3c76f8){logger['info'](_0x7ce7('0x16'),_0x2c60a6);logger[_0x7ce7('0x17')](_0x7ce7('0x16'),_0x2c60a6,JSON[_0x7ce7('0xf')](_0x3c76f8));_0x258b8a(_0x3c76f8);})[_0x7ce7('0x18')](function(_0x3aa657){logger[_0x7ce7('0x10')](_0x7ce7('0x16'),_0x3aa657[_0x7ce7('0x11')],_0x2c60a6);_0x195a42(_0x40993e[_0x7ce7('0x10')](0x1f4,_0x3aa657[_0x7ce7('0x11')]));});});};exports['UpdateSquareReport']=function(_0x4f5827){var _0x4fc6bc=this;return new Promise(function(_0x57aea1,_0x57a1ae){return db[_0x7ce7('0x13')][_0x7ce7('0x19')](_0x4f5827[_0x7ce7('0x1a')],{'raw':_0x4f5827[_0x7ce7('0x1b')]?_0x4f5827[_0x7ce7('0x1b')][_0x7ce7('0x15')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4f5827[_0x7ce7('0x1b')]?_0x4f5827['options'][_0x7ce7('0x1c')]||null:null,'attributes':_0x4f5827[_0x7ce7('0x1b')]?_0x4f5827[_0x7ce7('0x1b')][_0x7ce7('0x1d')]||null:null,'limit':_0x4f5827[_0x7ce7('0x1b')]?_0x4f5827[_0x7ce7('0x1b')][_0x7ce7('0x1e')]||null:null})[_0x7ce7('0xb')](function(_0x1b73be){logger[_0x7ce7('0xc')](_0x7ce7('0x1f'),_0x4f5827);logger[_0x7ce7('0x17')](_0x7ce7('0x1f'),_0x4f5827,JSON['stringify'](_0x1b73be));_0x57aea1(_0x1b73be);})[_0x7ce7('0x18')](function(_0x22c584){logger[_0x7ce7('0x10')](_0x7ce7('0x1f'),_0x22c584['message'],_0x4f5827);_0x57a1ae(_0x4fc6bc[_0x7ce7('0x10')](0x1f4,_0x22c584['message']));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index 7255aa9..ed93789 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 _0x2253=['/:id','post','create','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./squareReportDetail.controller','get','isAuthenticated','/describe','describe'];(function(_0x110c3d,_0x12ee06){var _0x226d67=function(_0x1fb6e1){while(--_0x1fb6e1){_0x110c3d['push'](_0x110c3d['shift']());}};_0x226d67(++_0x12ee06);}(_0x2253,0xe3));var _0x3225=function(_0xeb1d,_0x480d74){_0xeb1d=_0xeb1d-0x0;var _0x58d14a=_0x2253[_0xeb1d];return _0x58d14a;};'use strict';var multer=require(_0x3225('0x0'));var util=require(_0x3225('0x1'));var path=require(_0x3225('0x2'));var timeout=require('connect-timeout');var express=require(_0x3225('0x3'));var router=express[_0x3225('0x4')]();var fs_extra=require(_0x3225('0x5'));var auth=require(_0x3225('0x6'));var interaction=require(_0x3225('0x7'));var config=require('../../config/environment');var controller=require(_0x3225('0x8'));router[_0x3225('0x9')]('/',auth[_0x3225('0xa')](),controller['index']);router[_0x3225('0x9')](_0x3225('0xb'),auth[_0x3225('0xa')](),controller[_0x3225('0xc')]);router[_0x3225('0x9')](_0x3225('0xd'),auth[_0x3225('0xa')](),controller['show']);router[_0x3225('0xe')]('/',auth[_0x3225('0xa')](),controller[_0x3225('0xf')]);router['put'](_0x3225('0xd'),auth[_0x3225('0xa')](),controller[_0x3225('0x10')]);router[_0x3225('0x11')](_0x3225('0xd'),auth[_0x3225('0xa')](),controller[_0x3225('0x12')]);module[_0x3225('0x13')]=router; \ No newline at end of file +var _0x0748=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReportDetail.controller','get','isAuthenticated','index','/describe','describe','/:id','post','create','put','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0748,0xf9));var _0x8074=function(_0x4fc9e6,_0xc51915){_0x4fc9e6=_0x4fc9e6-0x0;var _0x551d28=_0x0748[_0x4fc9e6];return _0x551d28;};'use strict';var multer=require(_0x8074('0x0'));var util=require(_0x8074('0x1'));var path=require(_0x8074('0x2'));var timeout=require(_0x8074('0x3'));var express=require(_0x8074('0x4'));var router=express[_0x8074('0x5')]();var fs_extra=require(_0x8074('0x6'));var auth=require(_0x8074('0x7'));var interaction=require(_0x8074('0x8'));var config=require(_0x8074('0x9'));var controller=require(_0x8074('0xa'));router[_0x8074('0xb')]('/',auth[_0x8074('0xc')](),controller[_0x8074('0xd')]);router[_0x8074('0xb')](_0x8074('0xe'),auth[_0x8074('0xc')](),controller[_0x8074('0xf')]);router[_0x8074('0xb')](_0x8074('0x10'),auth[_0x8074('0xc')](),controller['show']);router[_0x8074('0x11')]('/',auth[_0x8074('0xc')](),controller[_0x8074('0x12')]);router[_0x8074('0x13')](_0x8074('0x10'),auth[_0x8074('0xc')](),controller['update']);router[_0x8074('0x14')]('/:id',auth[_0x8074('0xc')](),controller[_0x8074('0x15')]);module[_0x8074('0x16')]=router; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.attributes.js b/server/api/squareReportDetail/squareReportDetail.attributes.js index 2be0952..469e50e 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 _0xb933=['STRING','TEXT','exports'];(function(_0x14e275,_0x29e255){var _0xa8b5a4=function(_0x2d66f2){while(--_0x2d66f2){_0x14e275['push'](_0x14e275['shift']());}};_0xa8b5a4(++_0x29e255);}(_0xb933,0x1d9));var _0x3b93=function(_0x139a3c,_0x4fc883){_0x139a3c=_0x139a3c-0x0;var _0x2b375b=_0xb933[_0x139a3c];return _0x2b375b;};'use strict';var Sequelize=require('sequelize');module[_0x3b93('0x0')]={'uniqueid':{'type':Sequelize[_0x3b93('0x1')]},'node':{'type':Sequelize[_0x3b93('0x1')]},'application':{'type':Sequelize[_0x3b93('0x1')]},'data':{'type':Sequelize[_0x3b93('0x2')]},'project_name':{'type':Sequelize[_0x3b93('0x1')]},'callerid':{'type':Sequelize[_0x3b93('0x1')]}}; \ No newline at end of file +var _0x8b86=['TEXT','sequelize','exports','STRING'];(function(_0x24ea5f,_0x14413d){var _0x4e549a=function(_0x364c69){while(--_0x364c69){_0x24ea5f['push'](_0x24ea5f['shift']());}};_0x4e549a(++_0x14413d);}(_0x8b86,0xcd));var _0x68b8=function(_0x276015,_0x57eb3d){_0x276015=_0x276015-0x0;var _0x385345=_0x8b86[_0x276015];return _0x385345;};'use strict';var Sequelize=require(_0x68b8('0x0'));module[_0x68b8('0x1')]={'uniqueid':{'type':Sequelize[_0x68b8('0x2')]},'node':{'type':Sequelize[_0x68b8('0x2')]},'application':{'type':Sequelize[_0x68b8('0x2')]},'data':{'type':Sequelize[_0x68b8('0x3')]},'project_name':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x68b8('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.controller.js b/server/api/squareReportDetail/squareReportDetail.controller.js index 135b873..a4a54d3 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 _0xa9e3=['../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','apply','save','then','destroy','error','name','send','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','SquareDetailsReport','body','update','describe','eml-format','rimraf','request-promise','moment','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils'];(function(_0x500419,_0x549162){var _0x241c1a=function(_0x3bea1a){while(--_0x3bea1a){_0x500419['push'](_0x500419['shift']());}};_0x241c1a(++_0x549162);}(_0xa9e3,0x16b));var _0x3a9e=function(_0x11281d,_0x2dea05){_0x11281d=_0x11281d-0x0;var _0x5aab06=_0xa9e3[_0x11281d];return _0x5aab06;};'use strict';var emlformat=require(_0x3a9e('0x0'));var rimraf=require(_0x3a9e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x3a9e('0x2'));var moment=require(_0x3a9e('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x3a9e('0x4'));var util=require('util');var path=require(_0x3a9e('0x5'));var sox=require(_0x3a9e('0x6'));var csv=require(_0x3a9e('0x7'));var ejs=require(_0x3a9e('0x8'));var fs=require('fs');var fs_extra=require(_0x3a9e('0x9'));var _=require(_0x3a9e('0xa'));var squel=require(_0x3a9e('0xb'));var crypto=require(_0x3a9e('0xc'));var jsforce=require(_0x3a9e('0xd'));var deskjs=require(_0x3a9e('0xe'));var toCsv=require(_0x3a9e('0x7'));var querystring=require(_0x3a9e('0xf'));var Papa=require(_0x3a9e('0x10'));var Redis=require(_0x3a9e('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x3a9e('0x12'));var hardwareService=require(_0x3a9e('0x13'));var logger=require(_0x3a9e('0x14'))('api');var utils=require(_0x3a9e('0x15'));var config=require(_0x3a9e('0x16'));var licenseUtil=require(_0x3a9e('0x17'));var db=require(_0x3a9e('0x18'))['db'];function respondWithStatusCode(_0x19dddb,_0x45ffea){_0x45ffea=_0x45ffea||0xcc;return function(_0x3844df){if(_0x3844df){return _0x19dddb[_0x3a9e('0x19')](_0x45ffea);}return _0x19dddb[_0x3a9e('0x1a')](_0x45ffea)[_0x3a9e('0x1b')]();};}function respondWithResult(_0x529fdf,_0xfe71cf){_0xfe71cf=_0xfe71cf||0xc8;return function(_0xe622a5){if(_0xe622a5){return _0x529fdf['status'](_0xfe71cf)[_0x3a9e('0x1c')](_0xe622a5);}};}function respondWithFilteredResult(_0x575ea9,_0x4067fb){return function(_0x79f97f){if(_0x79f97f){var _0x1cca9c=typeof _0x4067fb['offset']===_0x3a9e('0x1d')&&typeof _0x4067fb[_0x3a9e('0x1e')]===_0x3a9e('0x1d');var _0x1baed1=_0x79f97f[_0x3a9e('0x1f')];var _0x3f82a6=_0x1cca9c?0x0:_0x4067fb[_0x3a9e('0x20')];var _0x17db1c=_0x1cca9c?_0x79f97f[_0x3a9e('0x1f')]:_0x4067fb[_0x3a9e('0x20')]+_0x4067fb[_0x3a9e('0x1e')];var _0x459141;if(_0x17db1c>=_0x1baed1){_0x17db1c=_0x1baed1;_0x459141=0xc8;}else{_0x459141=0xce;}_0x575ea9[_0x3a9e('0x1a')](_0x459141);return _0x575ea9[_0x3a9e('0x21')]('Content-Range',_0x3f82a6+'-'+_0x17db1c+'/'+_0x1baed1)[_0x3a9e('0x1c')](_0x79f97f);}return null;};}function patchUpdates(_0xb4132a){return function(_0x2434fe){try{jsonpatch[_0x3a9e('0x22')](_0x2434fe,_0xb4132a,!![]);}catch(_0x205d35){return BPromise['reject'](_0x205d35);}return _0x2434fe[_0x3a9e('0x23')]();};}function saveUpdates(_0x40b91a,_0x50b4fe){return function(_0x2e09e1){if(_0x2e09e1){return _0x2e09e1['update'](_0x40b91a)[_0x3a9e('0x24')](function(_0x5350dc){return _0x5350dc;});}return null;};}function removeEntity(_0x2d72cb,_0x35ba50){return function(_0x2432be){if(_0x2432be){return _0x2432be[_0x3a9e('0x25')]()[_0x3a9e('0x24')](function(){_0x2d72cb[_0x3a9e('0x1a')](0xcc)[_0x3a9e('0x1b')]();});}};}function handleEntityNotFound(_0x45e9cc,_0x2bbcbf){return function(_0x5c4854){if(!_0x5c4854){_0x45e9cc[_0x3a9e('0x19')](0x194);}return _0x5c4854;};}function handleError(_0xf0c26e,_0x1a3cdd){_0x1a3cdd=_0x1a3cdd||0x1f4;return function(_0x27b5f3){logger[_0x3a9e('0x26')](_0x27b5f3['stack']);if(_0x27b5f3[_0x3a9e('0x27')]){delete _0x27b5f3[_0x3a9e('0x27')];}_0xf0c26e[_0x3a9e('0x1a')](_0x1a3cdd)[_0x3a9e('0x28')](_0x27b5f3);};}exports['index']=function(_0x48c16c,_0x1e23d2){var _0x1b3c82={},_0x2fb7dc={},_0x2827ca={'count':0x0,'rows':[]};var _0x4f83d5=_[_0x3a9e('0x29')](db['SquareDetailsReport'][_0x3a9e('0x2a')],function(_0x3adc61){return{'name':_0x3adc61[_0x3a9e('0x2b')],'type':_0x3adc61[_0x3a9e('0x2c')][_0x3a9e('0x2d')]};});_0x2fb7dc['model']=_[_0x3a9e('0x29')](_0x4f83d5,_0x3a9e('0x27'));_0x2fb7dc[_0x3a9e('0x2e')]=_[_0x3a9e('0x2f')](_0x48c16c['query']);_0x2fb7dc[_0x3a9e('0x30')]=_[_0x3a9e('0x31')](_0x2fb7dc[_0x3a9e('0x32')],_0x2fb7dc['query']);_0x1b3c82[_0x3a9e('0x33')]=_[_0x3a9e('0x31')](_0x2fb7dc[_0x3a9e('0x32')],qs[_0x3a9e('0x34')](_0x48c16c[_0x3a9e('0x2e')]['fields']));_0x1b3c82[_0x3a9e('0x33')]=_0x1b3c82[_0x3a9e('0x33')][_0x3a9e('0x35')]?_0x1b3c82[_0x3a9e('0x33')]:_0x2fb7dc[_0x3a9e('0x32')];if(!_0x48c16c[_0x3a9e('0x2e')][_0x3a9e('0x36')](_0x3a9e('0x37'))){_0x1b3c82[_0x3a9e('0x1e')]=qs['limit'](_0x48c16c[_0x3a9e('0x2e')][_0x3a9e('0x1e')]);_0x1b3c82['offset']=qs[_0x3a9e('0x20')](_0x48c16c[_0x3a9e('0x2e')][_0x3a9e('0x20')]);}_0x1b3c82[_0x3a9e('0x38')]=qs[_0x3a9e('0x39')](_0x48c16c['query'][_0x3a9e('0x39')]);_0x1b3c82[_0x3a9e('0x3a')]=qs[_0x3a9e('0x30')](_[_0x3a9e('0x3b')](_0x48c16c[_0x3a9e('0x2e')],_0x2fb7dc[_0x3a9e('0x30')]),_0x4f83d5);if(_0x48c16c['query'][_0x3a9e('0x3c')]){_0x1b3c82[_0x3a9e('0x3a')]=_[_0x3a9e('0x3d')](_0x1b3c82['where'],{'$or':_['map'](_0x4f83d5,function(_0x3980a7){if(_0x3980a7[_0x3a9e('0x2c')]!==_0x3a9e('0x3e')){var _0x3761b2={};_0x3761b2[_0x3980a7[_0x3a9e('0x27')]]={'$like':'%'+_0x48c16c[_0x3a9e('0x2e')][_0x3a9e('0x3c')]+'%'};return _0x3761b2;}})});}_0x1b3c82=_[_0x3a9e('0x3d')]({},_0x1b3c82,_0x48c16c[_0x3a9e('0x3f')]);var _0x357461={'where':_0x1b3c82[_0x3a9e('0x3a')]};return db['SquareDetailsReport']['count'](_0x357461)['then'](function(_0x240c1f){_0x2827ca['count']=_0x240c1f;if(_0x48c16c[_0x3a9e('0x2e')][_0x3a9e('0x40')]){_0x1b3c82[_0x3a9e('0x41')]=[{'all':!![]}];}return db['SquareDetailsReport'][_0x3a9e('0x42')](_0x1b3c82);})[_0x3a9e('0x24')](function(_0x587ff6){_0x2827ca[_0x3a9e('0x43')]=_0x587ff6;return _0x2827ca;})[_0x3a9e('0x24')](respondWithFilteredResult(_0x1e23d2,_0x1b3c82))[_0x3a9e('0x44')](handleError(_0x1e23d2,null));};exports[_0x3a9e('0x45')]=function(_0x15e3d6,_0x42218a){var _0x42fd20={'raw':!![],'where':{'id':_0x15e3d6[_0x3a9e('0x46')]['id']}},_0x40d125={};_0x40d125['model']=_['keys'](db['SquareDetailsReport'][_0x3a9e('0x2a')]);_0x40d125[_0x3a9e('0x2e')]=_[_0x3a9e('0x2f')](_0x15e3d6['query']);_0x40d125[_0x3a9e('0x30')]=_[_0x3a9e('0x31')](_0x40d125[_0x3a9e('0x32')],_0x40d125['query']);_0x42fd20[_0x3a9e('0x33')]=_[_0x3a9e('0x31')](_0x40d125['model'],qs['fields'](_0x15e3d6['query'][_0x3a9e('0x34')]));_0x42fd20[_0x3a9e('0x33')]=_0x42fd20['attributes'][_0x3a9e('0x35')]?_0x42fd20[_0x3a9e('0x33')]:_0x40d125[_0x3a9e('0x32')];if(_0x15e3d6[_0x3a9e('0x2e')][_0x3a9e('0x40')]){_0x42fd20[_0x3a9e('0x41')]=[{'all':!![]}];}_0x42fd20=_[_0x3a9e('0x3d')]({},_0x42fd20,_0x15e3d6[_0x3a9e('0x3f')]);return db['SquareDetailsReport'][_0x3a9e('0x47')](_0x42fd20)[_0x3a9e('0x24')](handleEntityNotFound(_0x42218a,null))['then'](respondWithResult(_0x42218a,null))[_0x3a9e('0x44')](handleError(_0x42218a,null));};exports[_0x3a9e('0x48')]=function(_0x5812ea,_0x1b89ea){return db[_0x3a9e('0x49')][_0x3a9e('0x48')](_0x5812ea[_0x3a9e('0x4a')],{})[_0x3a9e('0x24')](respondWithResult(_0x1b89ea,0xc9))['catch'](handleError(_0x1b89ea,null));};exports[_0x3a9e('0x4b')]=function(_0xb16d79,_0x211436){if(_0xb16d79[_0x3a9e('0x4a')]['id']){delete _0xb16d79['body']['id'];}return db[_0x3a9e('0x49')]['find']({'where':{'id':_0xb16d79[_0x3a9e('0x46')]['id']}})['then'](handleEntityNotFound(_0x211436,null))['then'](saveUpdates(_0xb16d79[_0x3a9e('0x4a')],null))[_0x3a9e('0x24')](respondWithResult(_0x211436,null))[_0x3a9e('0x44')](handleError(_0x211436,null));};exports[_0x3a9e('0x25')]=function(_0x27366b,_0x1e3448){return db[_0x3a9e('0x49')]['find']({'where':{'id':_0x27366b['params']['id']}})[_0x3a9e('0x24')](handleEntityNotFound(_0x1e3448,null))['then'](removeEntity(_0x1e3448,null))[_0x3a9e('0x44')](handleError(_0x1e3448,null));};exports[_0x3a9e('0x4c')]=function(_0x33fcaa,_0x2e569a){return db[_0x3a9e('0x49')]['describe']()[_0x3a9e('0x24')](respondWithResult(_0x2e569a,null))[_0x3a9e('0x44')](handleError(_0x2e569a,null));}; \ No newline at end of file +var _0x3c8b=['map','SquareDetailsReport','type','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','filter','include','rows','catch','params','keys','rawAttributes','options','find','create','body','describe','eml-format','zip-dir','moment','bluebird','mustache','util','path','to-csv','squel','crypto','desk.js','querystring','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','limit','count','set','Content-Range','reject','save','update','then','sendStatus','error','stack','name','index'];(function(_0x3ab129,_0x3cdadf){var _0xa3d799=function(_0x466818){while(--_0x466818){_0x3ab129['push'](_0x3ab129['shift']());}};_0xa3d799(++_0x3cdadf);}(_0x3c8b,0x9c));var _0xb3c8=function(_0x571a66,_0x1e0bc7){_0x571a66=_0x571a66-0x0;var _0x599936=_0x3c8b[_0x571a66];return _0x599936;};'use strict';var emlformat=require(_0xb3c8('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb3c8('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xb3c8('0x2'));var BPromise=require(_0xb3c8('0x3'));var Mustache=require(_0xb3c8('0x4'));var util=require(_0xb3c8('0x5'));var path=require(_0xb3c8('0x6'));var sox=require('sox');var csv=require(_0xb3c8('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xb3c8('0x8'));var crypto=require(_0xb3c8('0x9'));var jsforce=require('jsforce');var deskjs=require(_0xb3c8('0xa'));var toCsv=require(_0xb3c8('0x7'));var querystring=require(_0xb3c8('0xb'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xb3c8('0xc'));var hardwareService=require(_0xb3c8('0xd'));var logger=require(_0xb3c8('0xe'))(_0xb3c8('0xf'));var utils=require('../../config/utils');var config=require(_0xb3c8('0x10'));var licenseUtil=require(_0xb3c8('0x11'));var db=require(_0xb3c8('0x12'))['db'];function respondWithStatusCode(_0x59eeaf,_0x10e0d6){_0x10e0d6=_0x10e0d6||0xcc;return function(_0x3b61b3){if(_0x3b61b3){return _0x59eeaf['sendStatus'](_0x10e0d6);}return _0x59eeaf[_0xb3c8('0x13')](_0x10e0d6)[_0xb3c8('0x14')]();};}function respondWithResult(_0x3ebacd,_0x24e83f){_0x24e83f=_0x24e83f||0xc8;return function(_0x2ae974){if(_0x2ae974){return _0x3ebacd[_0xb3c8('0x13')](_0x24e83f)[_0xb3c8('0x15')](_0x2ae974);}};}function respondWithFilteredResult(_0xb2fb57,_0x25f08e){return function(_0x2e4440){if(_0x2e4440){var _0x46e5a8=typeof _0x25f08e[_0xb3c8('0x16')]==='undefined'&&typeof _0x25f08e[_0xb3c8('0x17')]==='undefined';var _0x274f8f=_0x2e4440[_0xb3c8('0x18')];var _0x4a909d=_0x46e5a8?0x0:_0x25f08e[_0xb3c8('0x16')];var _0x303d1b=_0x46e5a8?_0x2e4440[_0xb3c8('0x18')]:_0x25f08e[_0xb3c8('0x16')]+_0x25f08e['limit'];var _0x203834;if(_0x303d1b>=_0x274f8f){_0x303d1b=_0x274f8f;_0x203834=0xc8;}else{_0x203834=0xce;}_0xb2fb57[_0xb3c8('0x13')](_0x203834);return _0xb2fb57[_0xb3c8('0x19')](_0xb3c8('0x1a'),_0x4a909d+'-'+_0x303d1b+'/'+_0x274f8f)[_0xb3c8('0x15')](_0x2e4440);}return null;};}function patchUpdates(_0x4039a1){return function(_0x1a09f8){try{jsonpatch['apply'](_0x1a09f8,_0x4039a1,!![]);}catch(_0x34ec99){return BPromise[_0xb3c8('0x1b')](_0x34ec99);}return _0x1a09f8[_0xb3c8('0x1c')]();};}function saveUpdates(_0x3e4423,_0x4e76b7){return function(_0x3d748d){if(_0x3d748d){return _0x3d748d[_0xb3c8('0x1d')](_0x3e4423)[_0xb3c8('0x1e')](function(_0x4e4083){return _0x4e4083;});}return null;};}function removeEntity(_0x56ecbb,_0xc28dca){return function(_0x36b358){if(_0x36b358){return _0x36b358['destroy']()[_0xb3c8('0x1e')](function(){_0x56ecbb[_0xb3c8('0x13')](0xcc)[_0xb3c8('0x14')]();});}};}function handleEntityNotFound(_0x335991,_0x30587b){return function(_0x2ec2a9){if(!_0x2ec2a9){_0x335991[_0xb3c8('0x1f')](0x194);}return _0x2ec2a9;};}function handleError(_0x418452,_0x15a82a){_0x15a82a=_0x15a82a||0x1f4;return function(_0x45ad8f){logger[_0xb3c8('0x20')](_0x45ad8f[_0xb3c8('0x21')]);if(_0x45ad8f[_0xb3c8('0x22')]){delete _0x45ad8f['name'];}_0x418452[_0xb3c8('0x13')](_0x15a82a)['send'](_0x45ad8f);};}exports[_0xb3c8('0x23')]=function(_0x51ca32,_0x5bca44){var _0x156a08={},_0x283914={},_0x4ed175={'count':0x0,'rows':[]};var _0x4f910b=_[_0xb3c8('0x24')](db[_0xb3c8('0x25')]['rawAttributes'],function(_0x5dd92c){return{'name':_0x5dd92c['fieldName'],'type':_0x5dd92c[_0xb3c8('0x26')]['key']};});_0x283914[_0xb3c8('0x27')]=_[_0xb3c8('0x24')](_0x4f910b,_0xb3c8('0x22'));_0x283914['query']=_['keys'](_0x51ca32[_0xb3c8('0x28')]);_0x283914[_0xb3c8('0x29')]=_['intersection'](_0x283914['model'],_0x283914[_0xb3c8('0x28')]);_0x156a08[_0xb3c8('0x2a')]=_[_0xb3c8('0x2b')](_0x283914[_0xb3c8('0x27')],qs['fields'](_0x51ca32[_0xb3c8('0x28')][_0xb3c8('0x2c')]));_0x156a08['attributes']=_0x156a08[_0xb3c8('0x2a')][_0xb3c8('0x2d')]?_0x156a08['attributes']:_0x283914[_0xb3c8('0x27')];if(!_0x51ca32[_0xb3c8('0x28')][_0xb3c8('0x2e')](_0xb3c8('0x2f'))){_0x156a08[_0xb3c8('0x17')]=qs['limit'](_0x51ca32[_0xb3c8('0x28')][_0xb3c8('0x17')]);_0x156a08[_0xb3c8('0x16')]=qs[_0xb3c8('0x16')](_0x51ca32[_0xb3c8('0x28')][_0xb3c8('0x16')]);}_0x156a08['order']=qs[_0xb3c8('0x30')](_0x51ca32[_0xb3c8('0x28')]['sort']);_0x156a08[_0xb3c8('0x31')]=qs[_0xb3c8('0x29')](_[_0xb3c8('0x32')](_0x51ca32[_0xb3c8('0x28')],_0x283914[_0xb3c8('0x29')]),_0x4f910b);if(_0x51ca32[_0xb3c8('0x28')]['filter']){_0x156a08[_0xb3c8('0x31')]=_[_0xb3c8('0x33')](_0x156a08[_0xb3c8('0x31')],{'$or':_[_0xb3c8('0x24')](_0x4f910b,function(_0x3dea60){if(_0x3dea60[_0xb3c8('0x26')]!=='VIRTUAL'){var _0x1ec304={};_0x1ec304[_0x3dea60[_0xb3c8('0x22')]]={'$like':'%'+_0x51ca32[_0xb3c8('0x28')][_0xb3c8('0x34')]+'%'};return _0x1ec304;}})});}_0x156a08=_[_0xb3c8('0x33')]({},_0x156a08,_0x51ca32['options']);var _0x203021={'where':_0x156a08['where']};return db[_0xb3c8('0x25')][_0xb3c8('0x18')](_0x203021)[_0xb3c8('0x1e')](function(_0x4a2788){_0x4ed175[_0xb3c8('0x18')]=_0x4a2788;if(_0x51ca32[_0xb3c8('0x28')]['includeAll']){_0x156a08[_0xb3c8('0x35')]=[{'all':!![]}];}return db[_0xb3c8('0x25')]['findAll'](_0x156a08);})[_0xb3c8('0x1e')](function(_0x45e361){_0x4ed175[_0xb3c8('0x36')]=_0x45e361;return _0x4ed175;})['then'](respondWithFilteredResult(_0x5bca44,_0x156a08))[_0xb3c8('0x37')](handleError(_0x5bca44,null));};exports['show']=function(_0x1a4991,_0x2131a4){var _0x25ddfd={'raw':!![],'where':{'id':_0x1a4991[_0xb3c8('0x38')]['id']}},_0x10cb85={};_0x10cb85[_0xb3c8('0x27')]=_[_0xb3c8('0x39')](db['SquareDetailsReport'][_0xb3c8('0x3a')]);_0x10cb85['query']=_[_0xb3c8('0x39')](_0x1a4991[_0xb3c8('0x28')]);_0x10cb85[_0xb3c8('0x29')]=_[_0xb3c8('0x2b')](_0x10cb85[_0xb3c8('0x27')],_0x10cb85[_0xb3c8('0x28')]);_0x25ddfd[_0xb3c8('0x2a')]=_['intersection'](_0x10cb85[_0xb3c8('0x27')],qs[_0xb3c8('0x2c')](_0x1a4991[_0xb3c8('0x28')][_0xb3c8('0x2c')]));_0x25ddfd[_0xb3c8('0x2a')]=_0x25ddfd[_0xb3c8('0x2a')][_0xb3c8('0x2d')]?_0x25ddfd[_0xb3c8('0x2a')]:_0x10cb85[_0xb3c8('0x27')];if(_0x1a4991[_0xb3c8('0x28')]['includeAll']){_0x25ddfd[_0xb3c8('0x35')]=[{'all':!![]}];}_0x25ddfd=_[_0xb3c8('0x33')]({},_0x25ddfd,_0x1a4991[_0xb3c8('0x3b')]);return db[_0xb3c8('0x25')][_0xb3c8('0x3c')](_0x25ddfd)[_0xb3c8('0x1e')](handleEntityNotFound(_0x2131a4,null))[_0xb3c8('0x1e')](respondWithResult(_0x2131a4,null))[_0xb3c8('0x37')](handleError(_0x2131a4,null));};exports[_0xb3c8('0x3d')]=function(_0x145dd6,_0x20217d){return db[_0xb3c8('0x25')][_0xb3c8('0x3d')](_0x145dd6[_0xb3c8('0x3e')],{})[_0xb3c8('0x1e')](respondWithResult(_0x20217d,0xc9))[_0xb3c8('0x37')](handleError(_0x20217d,null));};exports[_0xb3c8('0x1d')]=function(_0x335724,_0xaa2ba3){if(_0x335724[_0xb3c8('0x3e')]['id']){delete _0x335724[_0xb3c8('0x3e')]['id'];}return db[_0xb3c8('0x25')][_0xb3c8('0x3c')]({'where':{'id':_0x335724[_0xb3c8('0x38')]['id']}})[_0xb3c8('0x1e')](handleEntityNotFound(_0xaa2ba3,null))[_0xb3c8('0x1e')](saveUpdates(_0x335724['body'],null))['then'](respondWithResult(_0xaa2ba3,null))['catch'](handleError(_0xaa2ba3,null));};exports['destroy']=function(_0x1c9f0f,_0x36eca9){return db[_0xb3c8('0x25')][_0xb3c8('0x3c')]({'where':{'id':_0x1c9f0f[_0xb3c8('0x38')]['id']}})[_0xb3c8('0x1e')](handleEntityNotFound(_0x36eca9,null))[_0xb3c8('0x1e')](removeEntity(_0x36eca9,null))[_0xb3c8('0x37')](handleError(_0x36eca9,null));};exports[_0xb3c8('0x3f')]=function(_0x1f29f9,_0x2d51e4){return db[_0xb3c8('0x25')][_0xb3c8('0x3f')]()['then'](respondWithResult(_0x2d51e4,null))['catch'](handleError(_0x2d51e4,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index 2024124..25b134d 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 _0x31b9=['request-promise','path','./squareReportDetail.attributes','exports','define','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x310d10,_0x3fe887){var _0x1fb8af=function(_0x42965b){while(--_0x42965b){_0x310d10['push'](_0x310d10['shift']());}};_0x1fb8af(++_0x3fe887);}(_0x31b9,0x1b2));var _0x931b=function(_0x503949,_0x5098d3){_0x503949=_0x503949-0x0;var _0xad5d6d=_0x31b9[_0x503949];return _0xad5d6d;};'use strict';var _=require(_0x931b('0x0'));var util=require(_0x931b('0x1'));var logger=require(_0x931b('0x2'))(_0x931b('0x3'));var moment=require(_0x931b('0x4'));var BPromise=require(_0x931b('0x5'));var rp=require(_0x931b('0x6'));var fs=require('fs');var path=require(_0x931b('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x931b('0x8'));module[_0x931b('0x9')]=function(_0x4a3cee,_0x48180f){return _0x4a3cee[_0x931b('0xa')]('SquareDetailsReport',attributes,{'tableName':'report_square_details','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x476c=['request-promise','path','rimraf','../../config/environment','./squareReportDetail.attributes','define','SquareDetailsReport'];(function(_0x56418e,_0x362812){var _0x5b160c=function(_0x5b44cb){while(--_0x5b44cb){_0x56418e['push'](_0x56418e['shift']());}};_0x5b160c(++_0x362812);}(_0x476c,0x111));var _0xc476=function(_0x3c8480,_0x32b679){_0x3c8480=_0x3c8480-0x0;var _0x4f4a52=_0x476c[_0x3c8480];return _0x4f4a52;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xc476('0x0'));var fs=require('fs');var path=require(_0xc476('0x1'));var rimraf=require(_0xc476('0x2'));var config=require(_0xc476('0x3'));var attributes=require(_0xc476('0x4'));module['exports']=function(_0x57ac0b,_0x2953e8){return _0x57ac0b[_0xc476('0x5')](_0xc476('0x6'),attributes,{'tableName':'report_square_details','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.rpc.js b/server/api/squareReportDetail/squareReportDetail.rpc.js index 0adda4e..0c39888 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 _0x9354=['info','SquareDetailsReport,\x20%s,\x20%s','request\x20sent','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','error','message','result','catch','CreateSquareDetailsReport','create','body','options','then','stringify','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x5d003e,_0x31afda){var _0xff3eba=function(_0x504d3e){while(--_0x504d3e){_0x5d003e['push'](_0x5d003e['shift']());}};_0xff3eba(++_0x31afda);}(_0x9354,0x96));var _0x4935=function(_0x1085db,_0x41e087){_0x1085db=_0x1085db-0x0;var _0x392a60=_0x9354[_0x1085db];return _0x392a60;};'use strict';var _=require('lodash');var util=require(_0x4935('0x0'));var moment=require(_0x4935('0x1'));var BPromise=require('bluebird');var rs=require(_0x4935('0x2'));var fs=require('fs');var Redis=require(_0x4935('0x3'));var db=require(_0x4935('0x4'))['db'];var utils=require(_0x4935('0x5'));var logger=require('../../config/logger')(_0x4935('0x6'));var config=require(_0x4935('0x7'));var jayson=require(_0x4935('0x8'));var client=jayson[_0x4935('0x9')][_0x4935('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2e47bd,_0x118d36,_0x2d735e){return new BPromise(function(_0x10793e,_0x4c9902){return client[_0x4935('0xb')](_0x2e47bd,_0x2d735e)['then'](function(_0x2aac9a){logger[_0x4935('0xc')](_0x4935('0xd'),_0x118d36,_0x4935('0xe'));logger[_0x4935('0xf')](_0x4935('0x10'),_0x118d36,'request\x20sent',JSON['stringify'](_0x2aac9a));if(_0x2aac9a[_0x4935('0x11')]){if(_0x2aac9a['error']['code']===0x1f4){logger[_0x4935('0x11')](_0x4935('0xd'),_0x118d36,_0x2aac9a[_0x4935('0x11')][_0x4935('0x12')]);return _0x4c9902(_0x2aac9a[_0x4935('0x11')][_0x4935('0x12')]);}logger[_0x4935('0x11')](_0x4935('0xd'),_0x118d36,_0x2aac9a[_0x4935('0x11')][_0x4935('0x12')]);return _0x10793e(_0x2aac9a[_0x4935('0x11')][_0x4935('0x12')]);}else{logger[_0x4935('0xc')](_0x4935('0xd'),_0x118d36,_0x4935('0xe'));_0x10793e(_0x2aac9a[_0x4935('0x13')]['message']);}})[_0x4935('0x14')](function(_0x46526a){logger[_0x4935('0x11')](_0x4935('0xd'),_0x118d36,_0x46526a);_0x4c9902(_0x46526a);});});}exports[_0x4935('0x15')]=function(_0x429ef3){var _0x4ebc63=this;return new Promise(function(_0xd70eff,_0x145277){return db['SquareDetailsReport'][_0x4935('0x16')](_0x429ef3[_0x4935('0x17')],{'raw':_0x429ef3[_0x4935('0x18')]?_0x429ef3['options']['raw']===undefined?!![]:![]:!![]})[_0x4935('0x19')](function(_0x6b849f){logger[_0x4935('0xc')](_0x4935('0x15'),_0x429ef3);logger[_0x4935('0xf')](_0x4935('0x15'),_0x429ef3,JSON[_0x4935('0x1a')](_0x6b849f));_0xd70eff(_0x6b849f);})[_0x4935('0x14')](function(_0x58b2f3){logger[_0x4935('0x11')](_0x4935('0x15'),_0x58b2f3[_0x4935('0x12')],_0x429ef3);_0x145277(_0x4ebc63[_0x4935('0x11')](0x1f4,_0x58b2f3[_0x4935('0x12')]));});});}; \ No newline at end of file +var _0x4e81=['stringify','error','code','SquareDetailsReport,\x20%s,\x20%s','message','catch','CreateSquareDetailsReport','SquareDetailsReport','create','body','options','raw','lodash','util','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','request\x20sent','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s'];(function(_0x1bc7ac,_0x1eed0e){var _0x5a35d7=function(_0x1496c6){while(--_0x1496c6){_0x1bc7ac['push'](_0x1bc7ac['shift']());}};_0x5a35d7(++_0x1eed0e);}(_0x4e81,0x1bc));var _0x14e8=function(_0x64aff8,_0x106082){_0x64aff8=_0x64aff8-0x0;var _0x5488a3=_0x4e81[_0x64aff8];return _0x5488a3;};'use strict';var _=require(_0x14e8('0x0'));var util=require(_0x14e8('0x1'));var moment=require(_0x14e8('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x14e8('0x3'))['db'];var utils=require(_0x14e8('0x4'));var logger=require(_0x14e8('0x5'))(_0x14e8('0x6'));var config=require(_0x14e8('0x7'));var jayson=require(_0x14e8('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3e73d2,_0x449fa3,_0x21f860){return new BPromise(function(_0x3c1b93,_0x11ec3b){return client[_0x14e8('0x9')](_0x3e73d2,_0x21f860)[_0x14e8('0xa')](function(_0x1d8402){logger[_0x14e8('0xb')]('SquareDetailsReport,\x20%s,\x20%s',_0x449fa3,_0x14e8('0xc'));logger[_0x14e8('0xd')](_0x14e8('0xe'),_0x449fa3,_0x14e8('0xc'),JSON[_0x14e8('0xf')](_0x1d8402));if(_0x1d8402[_0x14e8('0x10')]){if(_0x1d8402[_0x14e8('0x10')][_0x14e8('0x11')]===0x1f4){logger['error'](_0x14e8('0x12'),_0x449fa3,_0x1d8402['error'][_0x14e8('0x13')]);return _0x11ec3b(_0x1d8402[_0x14e8('0x10')][_0x14e8('0x13')]);}logger['error'](_0x14e8('0x12'),_0x449fa3,_0x1d8402['error'][_0x14e8('0x13')]);return _0x3c1b93(_0x1d8402['error'][_0x14e8('0x13')]);}else{logger[_0x14e8('0xb')](_0x14e8('0x12'),_0x449fa3,_0x14e8('0xc'));_0x3c1b93(_0x1d8402['result'][_0x14e8('0x13')]);}})[_0x14e8('0x14')](function(_0x30581){logger[_0x14e8('0x10')](_0x14e8('0x12'),_0x449fa3,_0x30581);_0x11ec3b(_0x30581);});});}exports[_0x14e8('0x15')]=function(_0x10dc8b){var _0x462259=this;return new Promise(function(_0x5a38c1,_0x328c5a){return db[_0x14e8('0x16')][_0x14e8('0x17')](_0x10dc8b[_0x14e8('0x18')],{'raw':_0x10dc8b[_0x14e8('0x19')]?_0x10dc8b['options'][_0x14e8('0x1a')]===undefined?!![]:![]:!![]})[_0x14e8('0xa')](function(_0x2abfec){logger['info'](_0x14e8('0x15'),_0x10dc8b);logger['debug'](_0x14e8('0x15'),_0x10dc8b,JSON[_0x14e8('0xf')](_0x2abfec));_0x5a38c1(_0x2abfec);})[_0x14e8('0x14')](function(_0x117b00){logger[_0x14e8('0x10')]('CreateSquareDetailsReport',_0x117b00[_0x14e8('0x13')],_0x10dc8b);_0x328c5a(_0x462259['error'](0x1f4,_0x117b00[_0x14e8('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index 5b33e75..6261aa9 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 _0x12d0=['/process/:pid/kill','killProcess','exports','express','Router','../../components/auth/service','get','isAuthenticated','index'];(function(_0x284dfe,_0x162b12){var _0x11b410=function(_0x4b68e2){while(--_0x4b68e2){_0x284dfe['push'](_0x284dfe['shift']());}};_0x11b410(++_0x162b12);}(_0x12d0,0x1b3));var _0x012d=function(_0x6eb99,_0x4a5eb3){_0x6eb99=_0x6eb99-0x0;var _0xa5cc8d=_0x12d0[_0x6eb99];return _0xa5cc8d;};'use strict';var express=require(_0x012d('0x0'));var router=express[_0x012d('0x1')]();var auth=require(_0x012d('0x2'));var controller=require('./system.controller');router[_0x012d('0x3')]('/',auth[_0x012d('0x4')](),controller[_0x012d('0x5')]);router['get'](_0x012d('0x6'),auth[_0x012d('0x4')](),controller[_0x012d('0x7')]);module[_0x012d('0x8')]=router; \ No newline at end of file +var _0xd112=['./system.controller','isAuthenticated','index','get','killProcess','Router','../../components/auth/service'];(function(_0x14477e,_0x44d4da){var _0x5d4a05=function(_0x5e0fa3){while(--_0x5e0fa3){_0x14477e['push'](_0x14477e['shift']());}};_0x5d4a05(++_0x44d4da);}(_0xd112,0x98));var _0x2d11=function(_0x241eb9,_0x5ccc3f){_0x241eb9=_0x241eb9-0x0;var _0x4f916b=_0xd112[_0x241eb9];return _0x4f916b;};'use strict';var express=require('express');var router=express[_0x2d11('0x0')]();var auth=require(_0x2d11('0x1'));var controller=require(_0x2d11('0x2'));router['get']('/',auth[_0x2d11('0x3')](),controller[_0x2d11('0x4')]);router[_0x2d11('0x5')]('/process/:pid/kill',auth[_0x2d11('0x3')](),controller[_0x2d11('0x6')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/system/system.controller.js b/server/api/system/system.controller.js index beeeba5..b2d8e1e 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 _0x0db1=['catch','killProcess','components/import/cm','format','pid','then','split','params','kill','SIGINT','systeminformation','child_process','exec','api','util','bluebird','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','status','send','json'];(function(_0x15c40c,_0x35944a){var _0x2a1131=function(_0x4dd6b5){while(--_0x4dd6b5){_0x15c40c['push'](_0x15c40c['shift']());}};_0x2a1131(++_0x35944a);}(_0x0db1,0x78));var _0x10db=function(_0x5a2370,_0x19084f){_0x5a2370=_0x5a2370-0x0;var _0x599b6b=_0x0db1[_0x5a2370];return _0x599b6b;};'use strict';var info=require(_0x10db('0x0'));var exec=require(_0x10db('0x1'))[_0x10db('0x2')];var logger=require('../../config/logger')(_0x10db('0x3'));var util=require(_0x10db('0x4'));var BPromise=require(_0x10db('0x5'));var _=require('lodash');function handleError(_0x4639c0,_0x3b6e1b,_0x48cce4){_0x3b6e1b=_0x3b6e1b||0x1f4;return function(_0xff6135){logger[_0x10db('0x6')](_0x10db('0x7'),_0x48cce4,_0x3b6e1b,util[_0x10db('0x8')](_0xff6135,{'showHidden':![],'depth':null}));delete _0xff6135['name'];_0x4639c0[_0x10db('0x9')](_0x3b6e1b)[_0x10db('0xa')](_0xff6135);};}exports['index']=function(_0x5c21cd,_0x5352d1){return info['getAllData']()['then'](function(_0xe4ee2e){return _0x5352d1[_0x10db('0x9')](0xc8)[_0x10db('0xb')](_0xe4ee2e);})[_0x10db('0xc')](function(_0x55bcea){return _0x5352d1[_0x10db('0x9')](0x1f4)[_0x10db('0xb')](_0x55bcea);});};exports[_0x10db('0xd')]=function(_0x4e2eb8,_0x27e44d){var _0x2fb989=[_0x10db('0xe')];return new BPromise(function(_0x3fe769,_0x23a599){return exec(util[_0x10db('0xf')]('ps\x20-p\x20%s\x20-ww\x20-o\x20args',_0x4e2eb8['params'][_0x10db('0x10')]),function(_0x3dff56,_0x523841,_0x4a180f){if(_0x3dff56){return _0x23a599(_0x3dff56);}return _0x3fe769(_0x523841);});})[_0x10db('0x11')](function(_0x2f3c13){var _0x345e93=![];var _0x48702b=_0x2f3c13[_0x10db('0x12')](/\n/);for(var _0xbcb130=0x0,_0x425bda=_0x2fb989['length'];_0xbcb130<_0x425bda,_0x345e93===![];_0xbcb130+=0x1){if(_0x2f3c13['indexOf'](_0x2fb989[_0xbcb130])>=0x0){_0x345e93=!![];}}if(!_0x345e93){throw new Error(util[_0x10db('0xf')]('Process\x20with\x20pid\x20%s\x20not\x20found!',_0x4e2eb8[_0x10db('0x13')][_0x10db('0x10')]));}process[_0x10db('0x14')](_0x4e2eb8[_0x10db('0x13')][_0x10db('0x10')],_0x10db('0x15'));return _0x27e44d[_0x10db('0x9')](0xc8)['json']({'message':util[_0x10db('0xf')]('Process\x20with\x20pid\x20%s\x20killed\x20correctly',_0x4e2eb8['params']['pid'])});})['catch'](handleError(_0x27e44d,null,_0x10db('0xd')));}; \ No newline at end of file +var _0xf59e=['kill','Process\x20with\x20pid\x20%s\x20killed\x20correctly','catch','systeminformation','child_process','exec','../../config/logger','api','lodash','inspect','index','getAllData','then','status','json','killProcess','components/import/cm','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','pid','split','indexOf','Process\x20with\x20pid\x20%s\x20not\x20found!'];(function(_0x4a747d,_0x3b747f){var _0x3a5b5c=function(_0x4b3e81){while(--_0x4b3e81){_0x4a747d['push'](_0x4a747d['shift']());}};_0x3a5b5c(++_0x3b747f);}(_0xf59e,0xf3));var _0xef59=function(_0x47078c,_0xe8242f){_0x47078c=_0x47078c-0x0;var _0x359335=_0xf59e[_0x47078c];return _0x359335;};'use strict';var info=require(_0xef59('0x0'));var exec=require(_0xef59('0x1'))[_0xef59('0x2')];var logger=require(_0xef59('0x3'))(_0xef59('0x4'));var util=require('util');var BPromise=require('bluebird');var _=require(_0xef59('0x5'));function handleError(_0x2a6252,_0x3307b0,_0x275664){_0x3307b0=_0x3307b0||0x1f4;return function(_0x3ea39d){logger['error']('<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s',_0x275664,_0x3307b0,util[_0xef59('0x6')](_0x3ea39d,{'showHidden':![],'depth':null}));delete _0x3ea39d['name'];_0x2a6252['status'](_0x3307b0)['send'](_0x3ea39d);};}exports[_0xef59('0x7')]=function(_0x4729b5,_0x2f1765){return info[_0xef59('0x8')]()[_0xef59('0x9')](function(_0x3722bf){return _0x2f1765[_0xef59('0xa')](0xc8)[_0xef59('0xb')](_0x3722bf);})['catch'](function(_0x97b6){return _0x2f1765[_0xef59('0xa')](0x1f4)[_0xef59('0xb')](_0x97b6);});};exports[_0xef59('0xc')]=function(_0x84594f,_0x496e6d){var _0x3337f3=[_0xef59('0xd')];return new BPromise(function(_0xffe173,_0x1824a7){return exec(util[_0xef59('0xe')](_0xef59('0xf'),_0x84594f[_0xef59('0x10')][_0xef59('0x11')]),function(_0x1422a2,_0x128d06,_0x18d1f){if(_0x1422a2){return _0x1824a7(_0x1422a2);}return _0xffe173(_0x128d06);});})[_0xef59('0x9')](function(_0x5af2dc){var _0x32adea=![];var _0x5438e5=_0x5af2dc[_0xef59('0x12')](/\n/);for(var _0x2b5ce3=0x0,_0x59d537=_0x3337f3['length'];_0x2b5ce3<_0x59d537,_0x32adea===![];_0x2b5ce3+=0x1){if(_0x5af2dc[_0xef59('0x13')](_0x3337f3[_0x2b5ce3])>=0x0){_0x32adea=!![];}}if(!_0x32adea){throw new Error(util[_0xef59('0xe')](_0xef59('0x14'),_0x84594f[_0xef59('0x10')][_0xef59('0x11')]));}process[_0xef59('0x15')](_0x84594f['params'][_0xef59('0x11')],'SIGINT');return _0x496e6d['status'](0xc8)['json']({'message':util[_0xef59('0xe')](_0xef59('0x16'),_0x84594f['params']['pid'])});})[_0xef59('0x17')](handleError(_0x496e6d,null,'killProcess'));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index f135a19..30bde9a 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 _0xf767=['Router','./tag.controller','get','/:id','show','post','create','put','isAuthenticated','update','delete','destroy','path','connect-timeout','express'];(function(_0x1f6d3c,_0x38851f){var _0x3cb09b=function(_0x3a7149){while(--_0x3a7149){_0x1f6d3c['push'](_0x1f6d3c['shift']());}};_0x3cb09b(++_0x38851f);}(_0xf767,0x183));var _0x7f76=function(_0x55f8b4,_0x43f30d){_0x55f8b4=_0x55f8b4-0x0;var _0x2475f9=_0xf767[_0x55f8b4];return _0x2475f9;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x7f76('0x0'));var timeout=require(_0x7f76('0x1'));var express=require(_0x7f76('0x2'));var router=express[_0x7f76('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(_0x7f76('0x4'));router[_0x7f76('0x5')]('/',auth['isAuthenticated'](),controller['index']);router[_0x7f76('0x5')](_0x7f76('0x6'),auth['isAuthenticated'](),controller[_0x7f76('0x7')]);router[_0x7f76('0x8')]('/',auth['isAuthenticated'](),controller[_0x7f76('0x9')]);router[_0x7f76('0xa')](_0x7f76('0x6'),auth[_0x7f76('0xb')](),controller[_0x7f76('0xc')]);router[_0x7f76('0xd')](_0x7f76('0x6'),auth[_0x7f76('0xb')](),controller[_0x7f76('0xe')]);module['exports']=router; \ No newline at end of file +var _0x72a0=['post','create','update','delete','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./tag.controller','isAuthenticated','get','/:id'];(function(_0x24537c,_0x3c4582){var _0x4e134a=function(_0xe945a1){while(--_0xe945a1){_0x24537c['push'](_0x24537c['shift']());}};_0x4e134a(++_0x3c4582);}(_0x72a0,0x194));var _0x072a=function(_0x537b91,_0x4e078a){_0x537b91=_0x537b91-0x0;var _0x42ec4f=_0x72a0[_0x537b91];return _0x42ec4f;};'use strict';var multer=require(_0x072a('0x0'));var util=require(_0x072a('0x1'));var path=require(_0x072a('0x2'));var timeout=require(_0x072a('0x3'));var express=require(_0x072a('0x4'));var router=express[_0x072a('0x5')]();var fs_extra=require(_0x072a('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x072a('0x7'));var config=require('../../config/environment');var controller=require(_0x072a('0x8'));router['get']('/',auth[_0x072a('0x9')](),controller['index']);router[_0x072a('0xa')](_0x072a('0xb'),auth[_0x072a('0x9')](),controller['show']);router[_0x072a('0xc')]('/',auth[_0x072a('0x9')](),controller[_0x072a('0xd')]);router['put'](_0x072a('0xb'),auth['isAuthenticated'](),controller[_0x072a('0xe')]);router[_0x072a('0xf')](_0x072a('0xb'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/tag/tag.attributes.js b/server/api/tag/tag.attributes.js index ff024f3..509a898 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 _0x3f8c=['name','#0091EA','STRING'];(function(_0x13c9d5,_0x2d2201){var _0x24d328=function(_0x532e33){while(--_0x532e33){_0x13c9d5['push'](_0x13c9d5['shift']());}};_0x24d328(++_0x2d2201);}(_0x3f8c,0x104));var _0xc3f8=function(_0x3fd454,_0x324f7b){_0x3fd454=_0x3fd454-0x0;var _0x1c21f5=_0x3f8c[_0x3fd454];return _0x1c21f5;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xc3f8('0x0')],'unique':_0xc3f8('0x1'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0xc3f8('0x0')],'defaultValue':_0xc3f8('0x2')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x4977=['name','sequelize','exports','STRING'];(function(_0x53ae6a,_0x5ac499){var _0x99445=function(_0x5be53c){while(--_0x5be53c){_0x53ae6a['push'](_0x53ae6a['shift']());}};_0x99445(++_0x5ac499);}(_0x4977,0x1cd));var _0x7497=function(_0x9aafca,_0x3af57c){_0x9aafca=_0x9aafca-0x0;var _0x556ea1=_0x4977[_0x9aafca];return _0x556ea1;};'use strict';var Sequelize=require(_0x7497('0x0'));module[_0x7497('0x1')]={'name':{'type':Sequelize[_0x7497('0x2')],'unique':_0x7497('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0x7497('0x2')],'defaultValue':'#0091EA'},'description':{'type':Sequelize[_0x7497('0x2')]}}; \ No newline at end of file diff --git a/server/api/tag/tag.controller.js b/server/api/tag/tag.controller.js index a3b5a64..5c4e575 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 _0xaf93=['sort','where','filters','filter','merge','map','options','includeAll','include','findAll','rows','catch','show','params','keys','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','eml-format','rimraf','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','set','apply','reject','then','get','Tags','UserProfileResource','destroy','end','sendStatus','stack','name','index','Tag','rawAttributes','type','key','model','query','intersection','attributes','fields','length','nolimit'];(function(_0x14f857,_0x52bde6){var _0x43d8df=function(_0x2fa821){while(--_0x2fa821){_0x14f857['push'](_0x14f857['shift']());}};_0x43d8df(++_0x52bde6);}(_0xaf93,0x151));var _0x3af9=function(_0x41ffe4,_0x3a04ae){_0x41ffe4=_0x41ffe4-0x0;var _0x1ba9f3=_0xaf93[_0x41ffe4];return _0x1ba9f3;};'use strict';var emlformat=require(_0x3af9('0x0'));var rimraf=require(_0x3af9('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x3af9('0x2'));var moment=require(_0x3af9('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x3af9('0x4'));var util=require(_0x3af9('0x5'));var path=require(_0x3af9('0x6'));var sox=require(_0x3af9('0x7'));var csv=require(_0x3af9('0x8'));var ejs=require(_0x3af9('0x9'));var fs=require('fs');var fs_extra=require(_0x3af9('0xa'));var _=require('lodash');var squel=require(_0x3af9('0xb'));var crypto=require('crypto');var jsforce=require(_0x3af9('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x3af9('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x3af9('0xe'));var qs=require(_0x3af9('0xf'));var as=require(_0x3af9('0x10'));var hardwareService=require(_0x3af9('0x11'));var logger=require('../../config/logger')(_0x3af9('0x12'));var utils=require(_0x3af9('0x13'));var config=require(_0x3af9('0x14'));var licenseUtil=require(_0x3af9('0x15'));var db=require(_0x3af9('0x16'))['db'];function respondWithStatusCode(_0xfa1410,_0x212f63){_0x212f63=_0x212f63||0xcc;return function(_0xa7b81f){if(_0xa7b81f){return _0xfa1410['sendStatus'](_0x212f63);}return _0xfa1410[_0x3af9('0x17')](_0x212f63)['end']();};}function respondWithResult(_0x152254,_0x222b6f){_0x222b6f=_0x222b6f||0xc8;return function(_0x1e4ebb){if(_0x1e4ebb){return _0x152254['status'](_0x222b6f)[_0x3af9('0x18')](_0x1e4ebb);}};}function respondWithFilteredResult(_0x1088fc,_0x37cb8b){return function(_0x4b2845){if(_0x4b2845){var _0x278e80=typeof _0x37cb8b[_0x3af9('0x19')]===_0x3af9('0x1a')&&typeof _0x37cb8b[_0x3af9('0x1b')]==='undefined';var _0x1d3410=_0x4b2845[_0x3af9('0x1c')];var _0x298135=_0x278e80?0x0:_0x37cb8b[_0x3af9('0x19')];var _0x314df2=_0x278e80?_0x4b2845['count']:_0x37cb8b[_0x3af9('0x19')]+_0x37cb8b[_0x3af9('0x1b')];var _0x1f9214;if(_0x314df2>=_0x1d3410){_0x314df2=_0x1d3410;_0x1f9214=0xc8;}else{_0x1f9214=0xce;}_0x1088fc[_0x3af9('0x17')](_0x1f9214);return _0x1088fc[_0x3af9('0x1d')]('Content-Range',_0x298135+'-'+_0x314df2+'/'+_0x1d3410)[_0x3af9('0x18')](_0x4b2845);}return null;};}function patchUpdates(_0x34eb91){return function(_0x449349){try{jsonpatch[_0x3af9('0x1e')](_0x449349,_0x34eb91,!![]);}catch(_0x3c1793){return BPromise[_0x3af9('0x1f')](_0x3c1793);}return _0x449349['save']();};}function saveUpdates(_0x4a88ea,_0x505e25){return function(_0x5e24e3){if(_0x5e24e3){return _0x5e24e3['update'](_0x4a88ea)[_0x3af9('0x20')](function(_0x5c1c8f){return _0x5c1c8f;});}return null;};}function removeEntity(_0x74c872,_0x307f9d){return function(_0x4b5a5c){if(_0x4b5a5c){return _0x4b5a5c['destroy']()['then'](function(){var _0x119e85=_0x4b5a5c[_0x3af9('0x21')]({'plain':!![]});var _0x22965b=_0x3af9('0x22');return db[_0x3af9('0x23')][_0x3af9('0x24')]({'where':{'type':_0x22965b,'resourceId':_0x119e85['id']}})[_0x3af9('0x20')](function(){return _0x4b5a5c;});})[_0x3af9('0x20')](function(){_0x74c872['status'](0xcc)[_0x3af9('0x25')]();});}};}function handleEntityNotFound(_0x574b71,_0x485754){return function(_0x177650){if(!_0x177650){_0x574b71[_0x3af9('0x26')](0x194);}return _0x177650;};}function handleError(_0x19643f,_0xf8840){_0xf8840=_0xf8840||0x1f4;return function(_0x374382){logger['error'](_0x374382[_0x3af9('0x27')]);if(_0x374382[_0x3af9('0x28')]){delete _0x374382[_0x3af9('0x28')];}_0x19643f['status'](_0xf8840)['send'](_0x374382);};}exports[_0x3af9('0x29')]=function(_0x1d022d,_0x8867c6){var _0x540969={},_0x4186d5={},_0x115673={'count':0x0,'rows':[]};var _0x1c923d=_['map'](db[_0x3af9('0x2a')][_0x3af9('0x2b')],function(_0x407572){return{'name':_0x407572['fieldName'],'type':_0x407572[_0x3af9('0x2c')][_0x3af9('0x2d')]};});_0x4186d5[_0x3af9('0x2e')]=_['map'](_0x1c923d,_0x3af9('0x28'));_0x4186d5[_0x3af9('0x2f')]=_['keys'](_0x1d022d[_0x3af9('0x2f')]);_0x4186d5['filters']=_[_0x3af9('0x30')](_0x4186d5['model'],_0x4186d5['query']);_0x540969[_0x3af9('0x31')]=_['intersection'](_0x4186d5[_0x3af9('0x2e')],qs[_0x3af9('0x32')](_0x1d022d[_0x3af9('0x2f')]['fields']));_0x540969['attributes']=_0x540969[_0x3af9('0x31')][_0x3af9('0x33')]?_0x540969['attributes']:_0x4186d5['model'];if(!_0x1d022d[_0x3af9('0x2f')]['hasOwnProperty'](_0x3af9('0x34'))){_0x540969[_0x3af9('0x1b')]=qs['limit'](_0x1d022d['query'][_0x3af9('0x1b')]);_0x540969[_0x3af9('0x19')]=qs[_0x3af9('0x19')](_0x1d022d[_0x3af9('0x2f')][_0x3af9('0x19')]);}_0x540969['order']=qs['sort'](_0x1d022d[_0x3af9('0x2f')][_0x3af9('0x35')]);_0x540969[_0x3af9('0x36')]=qs[_0x3af9('0x37')](_['pick'](_0x1d022d['query'],_0x4186d5[_0x3af9('0x37')]),_0x1c923d);if(_0x1d022d[_0x3af9('0x2f')][_0x3af9('0x38')]){_0x540969['where']=_[_0x3af9('0x39')](_0x540969[_0x3af9('0x36')],{'$or':_[_0x3af9('0x3a')](_0x1c923d,function(_0x576c86){if(_0x576c86[_0x3af9('0x2c')]!=='VIRTUAL'){var _0x1f3ac9={};_0x1f3ac9[_0x576c86[_0x3af9('0x28')]]={'$like':'%'+_0x1d022d[_0x3af9('0x2f')][_0x3af9('0x38')]+'%'};return _0x1f3ac9;}})});}_0x540969=_[_0x3af9('0x39')]({},_0x540969,_0x1d022d[_0x3af9('0x3b')]);var _0x43fd62={'where':_0x540969[_0x3af9('0x36')]};return db[_0x3af9('0x2a')][_0x3af9('0x1c')](_0x43fd62)[_0x3af9('0x20')](function(_0x4d7bd4){_0x115673[_0x3af9('0x1c')]=_0x4d7bd4;if(_0x1d022d[_0x3af9('0x2f')][_0x3af9('0x3c')]){_0x540969[_0x3af9('0x3d')]=[{'all':!![]}];}return db[_0x3af9('0x2a')][_0x3af9('0x3e')](_0x540969);})[_0x3af9('0x20')](function(_0x384a61){_0x115673[_0x3af9('0x3f')]=_0x384a61;return _0x115673;})[_0x3af9('0x20')](respondWithFilteredResult(_0x8867c6,_0x540969))[_0x3af9('0x40')](handleError(_0x8867c6,null));};exports[_0x3af9('0x41')]=function(_0x549274,_0x542580){var _0x461dd6={'raw':!![],'where':{'id':_0x549274[_0x3af9('0x42')]['id']}},_0x1daea4={};_0x1daea4[_0x3af9('0x2e')]=_[_0x3af9('0x43')](db[_0x3af9('0x2a')][_0x3af9('0x2b')]);_0x1daea4[_0x3af9('0x2f')]=_[_0x3af9('0x43')](_0x549274[_0x3af9('0x2f')]);_0x1daea4[_0x3af9('0x37')]=_[_0x3af9('0x30')](_0x1daea4[_0x3af9('0x2e')],_0x1daea4['query']);_0x461dd6[_0x3af9('0x31')]=_[_0x3af9('0x30')](_0x1daea4[_0x3af9('0x2e')],qs[_0x3af9('0x32')](_0x549274['query']['fields']));_0x461dd6[_0x3af9('0x31')]=_0x461dd6['attributes'][_0x3af9('0x33')]?_0x461dd6[_0x3af9('0x31')]:_0x1daea4[_0x3af9('0x2e')];if(_0x549274[_0x3af9('0x2f')]['includeAll']){_0x461dd6[_0x3af9('0x3d')]=[{'all':!![]}];}_0x461dd6=_[_0x3af9('0x39')]({},_0x461dd6,_0x549274[_0x3af9('0x3b')]);return db['Tag']['find'](_0x461dd6)[_0x3af9('0x20')](handleEntityNotFound(_0x542580,null))['then'](respondWithResult(_0x542580,null))['catch'](handleError(_0x542580,null));};exports['create']=function(_0x19bd47,_0x3bc784){return db[_0x3af9('0x2a')][_0x3af9('0x44')](_0x19bd47[_0x3af9('0x45')],{})[_0x3af9('0x20')](function(_0x442681){var _0x48377b=_0x19bd47[_0x3af9('0x46')][_0x3af9('0x21')]({'plain':!![]});if(!_0x48377b)throw new Error(_0x3af9('0x47'));if(_0x48377b[_0x3af9('0x48')]===_0x3af9('0x46')){var _0x1104d4=_0x442681['get']({'plain':!![]});var _0x1b4509=_0x3af9('0x22');return db[_0x3af9('0x49')][_0x3af9('0x4a')]({'where':{'name':_0x1b4509,'userProfileId':_0x48377b['userProfileId']},'raw':!![]})[_0x3af9('0x20')](function(_0x39d954){if(_0x39d954&&_0x39d954[_0x3af9('0x4b')]===0x0){return db[_0x3af9('0x23')]['create']({'name':_0x1104d4[_0x3af9('0x28')],'resourceId':_0x1104d4['id'],'type':_0x39d954[_0x3af9('0x28')],'sectionId':_0x39d954['id']},{})[_0x3af9('0x20')](function(){return _0x442681;});}else{return _0x442681;}})[_0x3af9('0x40')](function(_0x4c75b6){logger['error'](_0x3af9('0x4c'),_0x4c75b6);throw _0x4c75b6;});}return _0x442681;})[_0x3af9('0x20')](respondWithResult(_0x3bc784,0xc9))[_0x3af9('0x40')](handleError(_0x3bc784,null));};exports[_0x3af9('0x4d')]=function(_0x3f087a,_0x268820){if(_0x3f087a[_0x3af9('0x45')]['id']){delete _0x3f087a[_0x3af9('0x45')]['id'];}return db[_0x3af9('0x2a')][_0x3af9('0x4a')]({'where':{'id':_0x3f087a[_0x3af9('0x42')]['id']}})['then'](handleEntityNotFound(_0x268820,null))[_0x3af9('0x20')](saveUpdates(_0x3f087a[_0x3af9('0x45')],null))['then'](respondWithResult(_0x268820,null))['catch'](handleError(_0x268820,null));};exports[_0x3af9('0x24')]=function(_0x4b205f,_0x27f717){return db[_0x3af9('0x2a')]['find']({'where':{'id':_0x4b205f['params']['id']}})[_0x3af9('0x20')](handleEntityNotFound(_0x27f717,null))[_0x3af9('0x20')](removeEntity(_0x27f717,null))[_0x3af9('0x40')](handleError(_0x27f717,null));}; \ No newline at end of file +var _0x0f9f=['api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','then','destroy','get','Tags','UserProfileResource','error','stack','name','send','index','map','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','options','Tag','include','rows','catch','show','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','update','params','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x41e5dd,_0x3ed56f){var _0x3ba850=function(_0x15ecb7){while(--_0x15ecb7){_0x41e5dd['push'](_0x41e5dd['shift']());}};_0x3ba850(++_0x3ed56f);}(_0x0f9f,0x1cc));var _0xf0f9=function(_0x526c9a,_0x571d87){_0x526c9a=_0x526c9a-0x0;var _0x22f2eb=_0x0f9f[_0x526c9a];return _0x22f2eb;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf0f9('0x0'));var zipdir=require(_0xf0f9('0x1'));var jsonpatch=require(_0xf0f9('0x2'));var rp=require('request-promise');var moment=require(_0xf0f9('0x3'));var BPromise=require(_0xf0f9('0x4'));var Mustache=require(_0xf0f9('0x5'));var util=require(_0xf0f9('0x6'));var path=require(_0xf0f9('0x7'));var sox=require(_0xf0f9('0x8'));var csv=require(_0xf0f9('0x9'));var ejs=require(_0xf0f9('0xa'));var fs=require('fs');var fs_extra=require(_0xf0f9('0xb'));var _=require(_0xf0f9('0xc'));var squel=require('squel');var crypto=require(_0xf0f9('0xd'));var jsforce=require(_0xf0f9('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xf0f9('0x9'));var querystring=require(_0xf0f9('0xf'));var Papa=require(_0xf0f9('0x10'));var Redis=require('ioredis');var authService=require(_0xf0f9('0x11'));var qs=require(_0xf0f9('0x12'));var as=require(_0xf0f9('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xf0f9('0x14'));var utils=require(_0xf0f9('0x15'));var config=require(_0xf0f9('0x16'));var licenseUtil=require(_0xf0f9('0x17'));var db=require(_0xf0f9('0x18'))['db'];function respondWithStatusCode(_0x32d17f,_0x2360eb){_0x2360eb=_0x2360eb||0xcc;return function(_0x4f27c2){if(_0x4f27c2){return _0x32d17f[_0xf0f9('0x19')](_0x2360eb);}return _0x32d17f[_0xf0f9('0x1a')](_0x2360eb)[_0xf0f9('0x1b')]();};}function respondWithResult(_0x200514,_0x524169){_0x524169=_0x524169||0xc8;return function(_0x51d78a){if(_0x51d78a){return _0x200514[_0xf0f9('0x1a')](_0x524169)[_0xf0f9('0x1c')](_0x51d78a);}};}function respondWithFilteredResult(_0xa7d48c,_0x2e2955){return function(_0x2b05e3){if(_0x2b05e3){var _0x2f5bec=typeof _0x2e2955[_0xf0f9('0x1d')]===_0xf0f9('0x1e')&&typeof _0x2e2955[_0xf0f9('0x1f')]===_0xf0f9('0x1e');var _0x4d3534=_0x2b05e3['count'];var _0x350a48=_0x2f5bec?0x0:_0x2e2955[_0xf0f9('0x1d')];var _0x4c4e17=_0x2f5bec?_0x2b05e3[_0xf0f9('0x20')]:_0x2e2955['offset']+_0x2e2955['limit'];var _0x42c157;if(_0x4c4e17>=_0x4d3534){_0x4c4e17=_0x4d3534;_0x42c157=0xc8;}else{_0x42c157=0xce;}_0xa7d48c[_0xf0f9('0x1a')](_0x42c157);return _0xa7d48c[_0xf0f9('0x21')](_0xf0f9('0x22'),_0x350a48+'-'+_0x4c4e17+'/'+_0x4d3534)[_0xf0f9('0x1c')](_0x2b05e3);}return null;};}function patchUpdates(_0x4ed9ff){return function(_0x5ccbc9){try{jsonpatch['apply'](_0x5ccbc9,_0x4ed9ff,!![]);}catch(_0x102336){return BPromise[_0xf0f9('0x23')](_0x102336);}return _0x5ccbc9[_0xf0f9('0x24')]();};}function saveUpdates(_0x5d87a9,_0x4a8726){return function(_0x209cd4){if(_0x209cd4){return _0x209cd4['update'](_0x5d87a9)[_0xf0f9('0x25')](function(_0x414f87){return _0x414f87;});}return null;};}function removeEntity(_0x173c79,_0x570c68){return function(_0x33dfca){if(_0x33dfca){return _0x33dfca[_0xf0f9('0x26')]()[_0xf0f9('0x25')](function(){var _0x49a2dd=_0x33dfca[_0xf0f9('0x27')]({'plain':!![]});var _0x33f070=_0xf0f9('0x28');return db[_0xf0f9('0x29')][_0xf0f9('0x26')]({'where':{'type':_0x33f070,'resourceId':_0x49a2dd['id']}})[_0xf0f9('0x25')](function(){return _0x33dfca;});})['then'](function(){_0x173c79[_0xf0f9('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1288e0,_0x30e85c){return function(_0x519a46){if(!_0x519a46){_0x1288e0['sendStatus'](0x194);}return _0x519a46;};}function handleError(_0x119793,_0x50e7f6){_0x50e7f6=_0x50e7f6||0x1f4;return function(_0x2121b8){logger[_0xf0f9('0x2a')](_0x2121b8[_0xf0f9('0x2b')]);if(_0x2121b8[_0xf0f9('0x2c')]){delete _0x2121b8[_0xf0f9('0x2c')];}_0x119793[_0xf0f9('0x1a')](_0x50e7f6)[_0xf0f9('0x2d')](_0x2121b8);};}exports[_0xf0f9('0x2e')]=function(_0x37c093,_0x4e4e08){var _0x2e79f9={},_0x28da31={},_0x534083={'count':0x0,'rows':[]};var _0x48ef2a=_[_0xf0f9('0x2f')](db['Tag']['rawAttributes'],function(_0x14f3cb){return{'name':_0x14f3cb['fieldName'],'type':_0x14f3cb[_0xf0f9('0x30')][_0xf0f9('0x31')]};});_0x28da31['model']=_['map'](_0x48ef2a,_0xf0f9('0x2c'));_0x28da31[_0xf0f9('0x32')]=_[_0xf0f9('0x33')](_0x37c093[_0xf0f9('0x32')]);_0x28da31[_0xf0f9('0x34')]=_[_0xf0f9('0x35')](_0x28da31[_0xf0f9('0x36')],_0x28da31[_0xf0f9('0x32')]);_0x2e79f9[_0xf0f9('0x37')]=_[_0xf0f9('0x35')](_0x28da31[_0xf0f9('0x36')],qs[_0xf0f9('0x38')](_0x37c093[_0xf0f9('0x32')]['fields']));_0x2e79f9[_0xf0f9('0x37')]=_0x2e79f9['attributes'][_0xf0f9('0x39')]?_0x2e79f9[_0xf0f9('0x37')]:_0x28da31[_0xf0f9('0x36')];if(!_0x37c093[_0xf0f9('0x32')][_0xf0f9('0x3a')](_0xf0f9('0x3b'))){_0x2e79f9[_0xf0f9('0x1f')]=qs['limit'](_0x37c093['query'][_0xf0f9('0x1f')]);_0x2e79f9[_0xf0f9('0x1d')]=qs[_0xf0f9('0x1d')](_0x37c093[_0xf0f9('0x32')][_0xf0f9('0x1d')]);}_0x2e79f9['order']=qs[_0xf0f9('0x3c')](_0x37c093[_0xf0f9('0x32')][_0xf0f9('0x3c')]);_0x2e79f9[_0xf0f9('0x3d')]=qs[_0xf0f9('0x34')](_['pick'](_0x37c093[_0xf0f9('0x32')],_0x28da31[_0xf0f9('0x34')]),_0x48ef2a);if(_0x37c093[_0xf0f9('0x32')][_0xf0f9('0x3e')]){_0x2e79f9[_0xf0f9('0x3d')]=_[_0xf0f9('0x3f')](_0x2e79f9['where'],{'$or':_[_0xf0f9('0x2f')](_0x48ef2a,function(_0x1b84ef){if(_0x1b84ef[_0xf0f9('0x30')]!=='VIRTUAL'){var _0x3b52e3={};_0x3b52e3[_0x1b84ef[_0xf0f9('0x2c')]]={'$like':'%'+_0x37c093[_0xf0f9('0x32')][_0xf0f9('0x3e')]+'%'};return _0x3b52e3;}})});}_0x2e79f9=_[_0xf0f9('0x3f')]({},_0x2e79f9,_0x37c093[_0xf0f9('0x40')]);var _0x1e1805={'where':_0x2e79f9[_0xf0f9('0x3d')]};return db[_0xf0f9('0x41')][_0xf0f9('0x20')](_0x1e1805)[_0xf0f9('0x25')](function(_0x149870){_0x534083[_0xf0f9('0x20')]=_0x149870;if(_0x37c093['query']['includeAll']){_0x2e79f9[_0xf0f9('0x42')]=[{'all':!![]}];}return db['Tag']['findAll'](_0x2e79f9);})['then'](function(_0x2cb95d){_0x534083[_0xf0f9('0x43')]=_0x2cb95d;return _0x534083;})[_0xf0f9('0x25')](respondWithFilteredResult(_0x4e4e08,_0x2e79f9))[_0xf0f9('0x44')](handleError(_0x4e4e08,null));};exports[_0xf0f9('0x45')]=function(_0xfef8ad,_0xc0c34c){var _0x2e1556={'raw':!![],'where':{'id':_0xfef8ad['params']['id']}},_0x1a3a6b={};_0x1a3a6b[_0xf0f9('0x36')]=_[_0xf0f9('0x33')](db[_0xf0f9('0x41')]['rawAttributes']);_0x1a3a6b[_0xf0f9('0x32')]=_[_0xf0f9('0x33')](_0xfef8ad[_0xf0f9('0x32')]);_0x1a3a6b['filters']=_[_0xf0f9('0x35')](_0x1a3a6b[_0xf0f9('0x36')],_0x1a3a6b['query']);_0x2e1556[_0xf0f9('0x37')]=_[_0xf0f9('0x35')](_0x1a3a6b[_0xf0f9('0x36')],qs[_0xf0f9('0x38')](_0xfef8ad['query'][_0xf0f9('0x38')]));_0x2e1556[_0xf0f9('0x37')]=_0x2e1556[_0xf0f9('0x37')][_0xf0f9('0x39')]?_0x2e1556[_0xf0f9('0x37')]:_0x1a3a6b[_0xf0f9('0x36')];if(_0xfef8ad['query'][_0xf0f9('0x46')]){_0x2e1556['include']=[{'all':!![]}];}_0x2e1556=_[_0xf0f9('0x3f')]({},_0x2e1556,_0xfef8ad[_0xf0f9('0x40')]);return db[_0xf0f9('0x41')][_0xf0f9('0x47')](_0x2e1556)[_0xf0f9('0x25')](handleEntityNotFound(_0xc0c34c,null))[_0xf0f9('0x25')](respondWithResult(_0xc0c34c,null))[_0xf0f9('0x44')](handleError(_0xc0c34c,null));};exports[_0xf0f9('0x48')]=function(_0x1f47fa,_0x13bb13){return db[_0xf0f9('0x41')][_0xf0f9('0x48')](_0x1f47fa[_0xf0f9('0x49')],{})[_0xf0f9('0x25')](function(_0x45a165){var _0x3cb91a=_0x1f47fa[_0xf0f9('0x4a')][_0xf0f9('0x27')]({'plain':!![]});if(!_0x3cb91a)throw new Error(_0xf0f9('0x4b'));if(_0x3cb91a[_0xf0f9('0x4c')]===_0xf0f9('0x4a')){var _0x40711c=_0x45a165[_0xf0f9('0x27')]({'plain':!![]});var _0x37a928='Tags';return db['UserProfileSection'][_0xf0f9('0x47')]({'where':{'name':_0x37a928,'userProfileId':_0x3cb91a['userProfileId']},'raw':!![]})[_0xf0f9('0x25')](function(_0x2c364c){if(_0x2c364c&&_0x2c364c[_0xf0f9('0x4d')]===0x0){return db['UserProfileResource'][_0xf0f9('0x48')]({'name':_0x40711c['name'],'resourceId':_0x40711c['id'],'type':_0x2c364c[_0xf0f9('0x2c')],'sectionId':_0x2c364c['id']},{})[_0xf0f9('0x25')](function(){return _0x45a165;});}else{return _0x45a165;}})[_0xf0f9('0x44')](function(_0xfe9072){logger[_0xf0f9('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xfe9072);throw _0xfe9072;});}return _0x45a165;})[_0xf0f9('0x25')](respondWithResult(_0x13bb13,0xc9))['catch'](handleError(_0x13bb13,null));};exports[_0xf0f9('0x4e')]=function(_0x1b0186,_0xb3467e){if(_0x1b0186[_0xf0f9('0x49')]['id']){delete _0x1b0186[_0xf0f9('0x49')]['id'];}return db['Tag'][_0xf0f9('0x47')]({'where':{'id':_0x1b0186[_0xf0f9('0x4f')]['id']}})[_0xf0f9('0x25')](handleEntityNotFound(_0xb3467e,null))[_0xf0f9('0x25')](saveUpdates(_0x1b0186[_0xf0f9('0x49')],null))[_0xf0f9('0x25')](respondWithResult(_0xb3467e,null))[_0xf0f9('0x44')](handleError(_0xb3467e,null));};exports[_0xf0f9('0x26')]=function(_0x15f3b3,_0x406b45){return db[_0xf0f9('0x41')][_0xf0f9('0x47')]({'where':{'id':_0x15f3b3[_0xf0f9('0x4f')]['id']}})[_0xf0f9('0x25')](handleEntityNotFound(_0x406b45,null))['then'](removeEntity(_0x406b45,null))[_0xf0f9('0x44')](handleError(_0x406b45,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index d8b455a..48acd95 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 _0x22f6=['rimraf','../../config/environment','./tag.attributes','exports','Tag','tools_tags','lodash','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x4dc257,_0x479941){var _0x3dbfbe=function(_0x377994){while(--_0x377994){_0x4dc257['push'](_0x4dc257['shift']());}};_0x3dbfbe(++_0x479941);}(_0x22f6,0x10e));var _0x622f=function(_0x3de5e8,_0x323e91){_0x3de5e8=_0x3de5e8-0x0;var _0x5e7818=_0x22f6[_0x3de5e8];return _0x5e7818;};'use strict';var _=require(_0x622f('0x0'));var util=require('util');var logger=require(_0x622f('0x1'))('api');var moment=require(_0x622f('0x2'));var BPromise=require(_0x622f('0x3'));var rp=require(_0x622f('0x4'));var fs=require('fs');var path=require(_0x622f('0x5'));var rimraf=require(_0x622f('0x6'));var config=require(_0x622f('0x7'));var attributes=require(_0x622f('0x8'));module[_0x622f('0x9')]=function(_0x659c64,_0x342d96){return _0x659c64['define'](_0x622f('0xa'),attributes,{'tableName':_0x622f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb17f=['tools_tags','lodash','util','../../config/logger','moment','request-promise','rimraf','../../config/environment','./tag.attributes','exports','define'];(function(_0x551e63,_0x204390){var _0x2f477a=function(_0x476639){while(--_0x476639){_0x551e63['push'](_0x551e63['shift']());}};_0x2f477a(++_0x204390);}(_0xb17f,0x1ae));var _0xfb17=function(_0x1950ca,_0x3a9b6f){_0x1950ca=_0x1950ca-0x0;var _0x31d8a5=_0xb17f[_0x1950ca];return _0x31d8a5;};'use strict';var _=require(_0xfb17('0x0'));var util=require(_0xfb17('0x1'));var logger=require(_0xfb17('0x2'))('api');var moment=require(_0xfb17('0x3'));var BPromise=require('bluebird');var rp=require(_0xfb17('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xfb17('0x5'));var config=require(_0xfb17('0x6'));var attributes=require(_0xfb17('0x7'));module[_0xfb17('0x8')]=function(_0x19547d,_0x18fff9){return _0x19547d[_0xfb17('0x9')]('Tag',attributes,{'tableName':_0xfb17('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/tag/tag.rpc.js b/server/api/tag/tag.rpc.js index dfdba07..c18f609 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 _0x0a9a=['Tag,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then'];(function(_0x139eb2,_0x3d7e18){var _0x2a5657=function(_0x3f0a33){while(--_0x3f0a33){_0x139eb2['push'](_0x139eb2['shift']());}};_0x2a5657(++_0x3d7e18);}(_0x0a9a,0x183));var _0xa0a9=function(_0x4852c3,_0x78a681){_0x4852c3=_0x4852c3-0x0;var _0x4055ca=_0x0a9a[_0x4852c3];return _0x4055ca;};'use strict';var _=require('lodash');var util=require(_0xa0a9('0x0'));var moment=require('moment');var BPromise=require(_0xa0a9('0x1'));var rs=require(_0xa0a9('0x2'));var fs=require('fs');var Redis=require(_0xa0a9('0x3'));var db=require(_0xa0a9('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xa0a9('0x5'))(_0xa0a9('0x6'));var config=require('../../config/environment');var jayson=require(_0xa0a9('0x7'));var client=jayson[_0xa0a9('0x8')][_0xa0a9('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x31d689,_0x499a29,_0x2b2eb4){return new BPromise(function(_0x520f42,_0x10aa8a){return client[_0xa0a9('0xa')](_0x31d689,_0x2b2eb4)[_0xa0a9('0xb')](function(_0x2d6ac0){logger['info'](_0xa0a9('0xc'),_0x499a29,_0xa0a9('0xd'));logger['debug']('Tag,\x20%s,\x20%s,\x20%s',_0x499a29,_0xa0a9('0xd'),JSON[_0xa0a9('0xe')](_0x2d6ac0));if(_0x2d6ac0['error']){if(_0x2d6ac0[_0xa0a9('0xf')]['code']===0x1f4){logger[_0xa0a9('0xf')]('Tag,\x20%s,\x20%s',_0x499a29,_0x2d6ac0[_0xa0a9('0xf')][_0xa0a9('0x10')]);return _0x10aa8a(_0x2d6ac0[_0xa0a9('0xf')][_0xa0a9('0x10')]);}logger[_0xa0a9('0xf')]('Tag,\x20%s,\x20%s',_0x499a29,_0x2d6ac0[_0xa0a9('0xf')][_0xa0a9('0x10')]);return _0x520f42(_0x2d6ac0[_0xa0a9('0xf')][_0xa0a9('0x10')]);}else{logger[_0xa0a9('0x11')](_0xa0a9('0xc'),_0x499a29,'request\x20sent');_0x520f42(_0x2d6ac0[_0xa0a9('0x12')]['message']);}})['catch'](function(_0x347092){logger[_0xa0a9('0xf')](_0xa0a9('0xc'),_0x499a29,_0x347092);_0x10aa8a(_0x347092);});});} \ No newline at end of file +var _0xc6d8=['debug','Tag,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','moment','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','info','Tag,\x20%s,\x20%s','request\x20sent'];(function(_0x36710f,_0x3cfbb8){var _0x344f0d=function(_0x3a7abc){while(--_0x3a7abc){_0x36710f['push'](_0x36710f['shift']());}};_0x344f0d(++_0x3cfbb8);}(_0xc6d8,0xd7));var _0x8c6d=function(_0x2ff1f6,_0x1bc588){_0x2ff1f6=_0x2ff1f6-0x0;var _0xbae96d=_0xc6d8[_0x2ff1f6];return _0xbae96d;};'use strict';var _=require(_0x8c6d('0x0'));var util=require('util');var moment=require(_0x8c6d('0x1'));var BPromise=require('bluebird');var rs=require(_0x8c6d('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8c6d('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x8c6d('0x4'));var config=require(_0x8c6d('0x5'));var jayson=require(_0x8c6d('0x6'));var client=jayson[_0x8c6d('0x7')][_0x8c6d('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2dbb52,_0x98cae4,_0x5529f1){return new BPromise(function(_0x1496ba,_0x75c49f){return client[_0x8c6d('0x9')](_0x2dbb52,_0x5529f1)['then'](function(_0x3cecc1){logger[_0x8c6d('0xa')](_0x8c6d('0xb'),_0x98cae4,_0x8c6d('0xc'));logger[_0x8c6d('0xd')](_0x8c6d('0xe'),_0x98cae4,_0x8c6d('0xc'),JSON[_0x8c6d('0xf')](_0x3cecc1));if(_0x3cecc1['error']){if(_0x3cecc1[_0x8c6d('0x10')]['code']===0x1f4){logger['error'](_0x8c6d('0xb'),_0x98cae4,_0x3cecc1[_0x8c6d('0x10')][_0x8c6d('0x11')]);return _0x75c49f(_0x3cecc1[_0x8c6d('0x10')][_0x8c6d('0x11')]);}logger[_0x8c6d('0x10')](_0x8c6d('0xb'),_0x98cae4,_0x3cecc1[_0x8c6d('0x10')][_0x8c6d('0x11')]);return _0x1496ba(_0x3cecc1[_0x8c6d('0x10')]['message']);}else{logger[_0x8c6d('0xa')]('Tag,\x20%s,\x20%s',_0x98cae4,_0x8c6d('0xc'));_0x1496ba(_0x3cecc1['result'][_0x8c6d('0x11')]);}})[_0x8c6d('0x12')](function(_0x52ed7b){logger[_0x8c6d('0x10')](_0x8c6d('0xb'),_0x98cae4,_0x52ed7b);_0x75c49f(_0x52ed7b);});});} \ No newline at end of file diff --git a/server/api/team/index.js b/server/api/team/index.js index 59cb595..d44ea93 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(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0xa9e0[_0x2b10c6];return _0x3789d2;};'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(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xa9e0[_0x4cf98e];return _0x1623ac;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/queues',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/queues',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0xf')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x11')]);router['put'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router[_0x0a9e('0x13')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller['destroy']);router[_0x0a9e('0x13')]('/:id/queues',auth[_0x0a9e('0xd')](),controller['removeQueues']);router[_0x0a9e('0x13')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/team/team.attributes.js b/server/api/team/team.attributes.js index 628a0e2..1f556fd 100644 --- a/server/api/team/team.attributes.js +++ b/server/api/team/team.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb7e7=['STRING','sequelize'];(function(_0x2283dc,_0x2fcfc5){var _0x16db90=function(_0x376c35){while(--_0x376c35){_0x2283dc['push'](_0x2283dc['shift']());}};_0x16db90(++_0x2fcfc5);}(_0xb7e7,0x121));var _0x7b7e=function(_0x2f1762,_0xab43df){_0x2f1762=_0x2f1762-0x0;var _0x8ab21=_0xb7e7[_0x2f1762];return _0x8ab21;};'use strict';var Sequelize=require(_0x7b7e('0x0'));module['exports']={'name':{'type':Sequelize[_0x7b7e('0x1')],'allowNull':![],'unique':'name'},'description':{'type':Sequelize[_0x7b7e('0x1')]}}; \ No newline at end of file +var _0x2032=['name','exports','STRING'];(function(_0x4cdb9c,_0x41c9b6){var _0x2aea5d=function(_0x46bc04){while(--_0x46bc04){_0x4cdb9c['push'](_0x4cdb9c['shift']());}};_0x2aea5d(++_0x41c9b6);}(_0x2032,0xd9));var _0x2203=function(_0x550713,_0x1dfd47){_0x550713=_0x550713-0x0;var _0x4aaba9=_0x2032[_0x550713];return _0x4aaba9;};'use strict';var Sequelize=require('sequelize');module[_0x2203('0x0')]={'name':{'type':Sequelize[_0x2203('0x1')],'allowNull':![],'unique':_0x2203('0x2')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/team/team.controller.js b/server/api/team/team.controller.js index 8ea4fa4..1771032 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 _0xccf0=['add','ids','removeQueues','remove','addAgents','Voice','Chat','Sms','Fax','sequelize','transaction','through','QueueId','defaults','User','findOrCreate','emit','Queue:save','voicePause','isNil','interface','format','SIP/%s','TeamVoiceQueue','penalty','all','parse','TeamVoicePrefix','UserVoicePrefix','upsert','VoicePrefixId','spread','removeAgents','Openchannel','Whatsapp','Queue:remove','UserVoiceQueueRt','getAgents','hasOwnProperty','nolimit','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','sox','ejs','fs-extra','lodash','squel','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','redis','localhost','socket.io-emitter','./team.socket','register','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','save','update','then','get','destroy','error','name','send','map','Team','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','order','sort','where','pick','filter','merge','includeAll','include','findAll','catch','show','params','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','Teams','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getQueues','findOne','channel','isValidChannel','ValidationError','Unknown\x20channel','capitalize','Queue','length','toLowerCase','Queues','addQueues','Sequelize'];(function(_0x29face,_0x39ba80){var _0x4567b8=function(_0x3eeb25){while(--_0x3eeb25){_0x29face['push'](_0x29face['shift']());}};_0x4567b8(++_0x39ba80);}(_0xccf0,0xaf));var _0x0ccf=function(_0x807301,_0x3d8e34){_0x807301=_0x807301-0x0;var _0xe68321=_0xccf0[_0x807301];return _0xe68321;};'use strict';var emlformat=require(_0x0ccf('0x0'));var rimraf=require(_0x0ccf('0x1'));var zipdir=require(_0x0ccf('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0ccf('0x3'));var moment=require(_0x0ccf('0x4'));var BPromise=require(_0x0ccf('0x5'));var Mustache=require(_0x0ccf('0x6'));var util=require('util');var path=require('path');var sox=require(_0x0ccf('0x7'));var csv=require('to-csv');var ejs=require(_0x0ccf('0x8'));var fs=require('fs');var fs_extra=require(_0x0ccf('0x9'));var _=require(_0x0ccf('0xa'));var squel=require(_0x0ccf('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0ccf('0xc'));var toCsv=require(_0x0ccf('0xd'));var querystring=require(_0x0ccf('0xe'));var Papa=require(_0x0ccf('0xf'));var Redis=require(_0x0ccf('0x10'));var authService=require(_0x0ccf('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x0ccf('0x12'));var hardwareService=require(_0x0ccf('0x13'));var logger=require('../../config/logger')(_0x0ccf('0x14'));var utils=require(_0x0ccf('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x0ccf('0x16'))['db'];config[_0x0ccf('0x17')]=_['defaults'](config[_0x0ccf('0x17')],{'host':_0x0ccf('0x18'),'port':0x18eb});var socket=require(_0x0ccf('0x19'))(new Redis(config[_0x0ccf('0x17')]));require(_0x0ccf('0x1a'))[_0x0ccf('0x1b')](socket);function respondWithStatusCode(_0x5a0653,_0x1172a3){_0x1172a3=_0x1172a3||0xcc;return function(_0x2a5843){if(_0x2a5843){return _0x5a0653[_0x0ccf('0x1c')](_0x1172a3);}return _0x5a0653[_0x0ccf('0x1d')](_0x1172a3)[_0x0ccf('0x1e')]();};}function respondWithResult(_0x3ee938,_0xffe81a){_0xffe81a=_0xffe81a||0xc8;return function(_0x146e13){if(_0x146e13){return _0x3ee938['status'](_0xffe81a)[_0x0ccf('0x1f')](_0x146e13);}};}function respondWithFilteredResult(_0x45f35b,_0x37869d){return function(_0x2a1530){if(_0x2a1530){var _0x5f5dc8=typeof _0x37869d['offset']===_0x0ccf('0x20')&&typeof _0x37869d[_0x0ccf('0x21')]==='undefined';var _0x2abcee=_0x2a1530[_0x0ccf('0x22')];var _0xdb559c=_0x5f5dc8?0x0:_0x37869d[_0x0ccf('0x23')];var _0x33cf81=_0x5f5dc8?_0x2a1530[_0x0ccf('0x22')]:_0x37869d[_0x0ccf('0x23')]+_0x37869d[_0x0ccf('0x21')];var _0x260f3f;if(_0x33cf81>=_0x2abcee){_0x33cf81=_0x2abcee;_0x260f3f=0xc8;}else{_0x260f3f=0xce;}_0x45f35b['status'](_0x260f3f);return _0x45f35b[_0x0ccf('0x24')](_0x0ccf('0x25'),_0xdb559c+'-'+_0x33cf81+'/'+_0x2abcee)['json'](_0x2a1530);}return null;};}function patchUpdates(_0x1b929e){return function(_0x2ad807){try{jsonpatch['apply'](_0x2ad807,_0x1b929e,!![]);}catch(_0x42bb7b){return BPromise['reject'](_0x42bb7b);}return _0x2ad807[_0x0ccf('0x26')]();};}function saveUpdates(_0x16168c,_0x454c92){return function(_0x5aacdd){if(_0x5aacdd){return _0x5aacdd[_0x0ccf('0x27')](_0x16168c)['then'](function(_0x5c34b4){return _0x5c34b4;});}return null;};}function removeEntity(_0x2767fe,_0x15611e){return function(_0x5b788d){if(_0x5b788d){return _0x5b788d['destroy']()[_0x0ccf('0x28')](function(){var _0x90cfda=_0x5b788d[_0x0ccf('0x29')]({'plain':!![]});var _0x31d147='Teams';return db['UserProfileResource'][_0x0ccf('0x2a')]({'where':{'type':_0x31d147,'resourceId':_0x90cfda['id']}})[_0x0ccf('0x28')](function(){return _0x5b788d;});})['then'](function(){_0x2767fe[_0x0ccf('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4aadd1,_0x58fc22){return function(_0x21a166){if(!_0x21a166){_0x4aadd1[_0x0ccf('0x1c')](0x194);}return _0x21a166;};}function handleError(_0x265fa5,_0x521cdf){_0x521cdf=_0x521cdf||0x1f4;return function(_0x38e126){logger[_0x0ccf('0x2b')](_0x38e126['stack']);if(_0x38e126[_0x0ccf('0x2c')]){delete _0x38e126[_0x0ccf('0x2c')];}_0x265fa5[_0x0ccf('0x1d')](_0x521cdf)[_0x0ccf('0x2d')](_0x38e126);};}exports['index']=function(_0x4ee5b4,_0xdc2b3b){var _0xb140e2={},_0x381e5b={},_0x1055db={'count':0x0,'rows':[]};var _0x10726f=_[_0x0ccf('0x2e')](db[_0x0ccf('0x2f')][_0x0ccf('0x30')],function(_0x40f5b0){return{'name':_0x40f5b0[_0x0ccf('0x31')],'type':_0x40f5b0[_0x0ccf('0x32')][_0x0ccf('0x33')]};});_0x381e5b[_0x0ccf('0x34')]=_[_0x0ccf('0x2e')](_0x10726f,_0x0ccf('0x2c'));_0x381e5b['query']=_[_0x0ccf('0x35')](_0x4ee5b4[_0x0ccf('0x36')]);_0x381e5b[_0x0ccf('0x37')]=_[_0x0ccf('0x38')](_0x381e5b[_0x0ccf('0x34')],_0x381e5b['query']);_0xb140e2['attributes']=_['intersection'](_0x381e5b['model'],qs['fields'](_0x4ee5b4['query'][_0x0ccf('0x39')]));_0xb140e2[_0x0ccf('0x3a')]=_0xb140e2['attributes']['length']?_0xb140e2['attributes']:_0x381e5b[_0x0ccf('0x34')];if(!_0x4ee5b4[_0x0ccf('0x36')]['hasOwnProperty']('nolimit')){_0xb140e2[_0x0ccf('0x21')]=qs[_0x0ccf('0x21')](_0x4ee5b4[_0x0ccf('0x36')]['limit']);_0xb140e2[_0x0ccf('0x23')]=qs[_0x0ccf('0x23')](_0x4ee5b4[_0x0ccf('0x36')][_0x0ccf('0x23')]);}_0xb140e2[_0x0ccf('0x3b')]=qs[_0x0ccf('0x3c')](_0x4ee5b4[_0x0ccf('0x36')][_0x0ccf('0x3c')]);_0xb140e2[_0x0ccf('0x3d')]=qs[_0x0ccf('0x37')](_[_0x0ccf('0x3e')](_0x4ee5b4[_0x0ccf('0x36')],_0x381e5b[_0x0ccf('0x37')]),_0x10726f);if(_0x4ee5b4['query'][_0x0ccf('0x3f')]){_0xb140e2[_0x0ccf('0x3d')]=_[_0x0ccf('0x40')](_0xb140e2[_0x0ccf('0x3d')],{'$or':_[_0x0ccf('0x2e')](_0x10726f,function(_0x427324){if(_0x427324['type']!=='VIRTUAL'){var _0x585a47={};_0x585a47[_0x427324[_0x0ccf('0x2c')]]={'$like':'%'+_0x4ee5b4[_0x0ccf('0x36')]['filter']+'%'};return _0x585a47;}})});}_0xb140e2=_['merge']({},_0xb140e2,_0x4ee5b4['options']);var _0x2a02ea={'where':_0xb140e2[_0x0ccf('0x3d')]};return db[_0x0ccf('0x2f')][_0x0ccf('0x22')](_0x2a02ea)['then'](function(_0xe88fd7){_0x1055db[_0x0ccf('0x22')]=_0xe88fd7;if(_0x4ee5b4[_0x0ccf('0x36')][_0x0ccf('0x41')]){_0xb140e2[_0x0ccf('0x42')]=[{'all':!![]}];}return db['Team'][_0x0ccf('0x43')](_0xb140e2);})[_0x0ccf('0x28')](function(_0x2eedf2){_0x1055db['rows']=_0x2eedf2;return _0x1055db;})[_0x0ccf('0x28')](respondWithFilteredResult(_0xdc2b3b,_0xb140e2))[_0x0ccf('0x44')](handleError(_0xdc2b3b,null));};exports[_0x0ccf('0x45')]=function(_0x4d7ecc,_0x550c0e){var _0x3da2c4={'raw':![],'where':{'id':_0x4d7ecc[_0x0ccf('0x46')]['id']}},_0x4041ca={};_0x4041ca[_0x0ccf('0x34')]=_[_0x0ccf('0x35')](db[_0x0ccf('0x2f')]['rawAttributes']);_0x4041ca[_0x0ccf('0x36')]=_[_0x0ccf('0x35')](_0x4d7ecc[_0x0ccf('0x36')]);_0x4041ca[_0x0ccf('0x37')]=_[_0x0ccf('0x38')](_0x4041ca[_0x0ccf('0x34')],_0x4041ca['query']);_0x3da2c4[_0x0ccf('0x3a')]=_[_0x0ccf('0x38')](_0x4041ca[_0x0ccf('0x34')],qs[_0x0ccf('0x39')](_0x4d7ecc[_0x0ccf('0x36')][_0x0ccf('0x39')]));_0x3da2c4[_0x0ccf('0x3a')]=_0x3da2c4['attributes']['length']?_0x3da2c4[_0x0ccf('0x3a')]:_0x4041ca[_0x0ccf('0x34')];if(_0x4d7ecc[_0x0ccf('0x36')]['includeAll']){_0x3da2c4[_0x0ccf('0x42')]=[{'all':!![]}];}_0x3da2c4=_[_0x0ccf('0x40')]({},_0x3da2c4,_0x4d7ecc[_0x0ccf('0x47')]);return db[_0x0ccf('0x2f')][_0x0ccf('0x48')](_0x3da2c4)[_0x0ccf('0x28')](handleEntityNotFound(_0x550c0e,null))['then'](respondWithResult(_0x550c0e,null))['catch'](handleError(_0x550c0e,null));};exports[_0x0ccf('0x49')]=function(_0x1b472a,_0x4ca7ca){return db['Team'][_0x0ccf('0x49')](_0x1b472a[_0x0ccf('0x4a')],{})[_0x0ccf('0x28')](function(_0xd41cab){var _0xaf178=_0x1b472a['user'][_0x0ccf('0x29')]({'plain':!![]});if(!_0xaf178)throw new Error(_0x0ccf('0x4b'));if(_0xaf178['role']==='user'){var _0x5c63f1=_0xd41cab[_0x0ccf('0x29')]({'plain':!![]});var _0x5a7025=_0x0ccf('0x4c');return db[_0x0ccf('0x4d')]['find']({'where':{'name':_0x5a7025,'userProfileId':_0xaf178[_0x0ccf('0x4e')]},'raw':!![]})[_0x0ccf('0x28')](function(_0x3b14d7){if(_0x3b14d7&&_0x3b14d7[_0x0ccf('0x4f')]===0x0){return db[_0x0ccf('0x50')][_0x0ccf('0x49')]({'name':_0x5c63f1[_0x0ccf('0x2c')],'resourceId':_0x5c63f1['id'],'type':_0x3b14d7[_0x0ccf('0x2c')],'sectionId':_0x3b14d7['id']},{})[_0x0ccf('0x28')](function(){return _0xd41cab;});}else{return _0xd41cab;}})[_0x0ccf('0x44')](function(_0x30e04e){logger[_0x0ccf('0x2b')](_0x0ccf('0x51'),_0x30e04e);throw _0x30e04e;});}return _0xd41cab;})[_0x0ccf('0x28')](respondWithResult(_0x4ca7ca,0xc9))[_0x0ccf('0x44')](handleError(_0x4ca7ca,null));};exports[_0x0ccf('0x27')]=function(_0x59eb4e,_0x566b39){if(_0x59eb4e[_0x0ccf('0x4a')]['id']){delete _0x59eb4e[_0x0ccf('0x4a')]['id'];}return db[_0x0ccf('0x2f')]['find']({'where':{'id':_0x59eb4e['params']['id']}})['then'](handleEntityNotFound(_0x566b39,null))[_0x0ccf('0x28')](saveUpdates(_0x59eb4e[_0x0ccf('0x4a')],null))[_0x0ccf('0x28')](respondWithResult(_0x566b39,null))[_0x0ccf('0x44')](handleError(_0x566b39,null));};exports[_0x0ccf('0x2a')]=function(_0x502370,_0x25919a){return db[_0x0ccf('0x2f')]['find']({'where':{'id':_0x502370[_0x0ccf('0x46')]['id']}})[_0x0ccf('0x28')](handleEntityNotFound(_0x25919a,null))[_0x0ccf('0x28')](removeEntity(_0x25919a,null))[_0x0ccf('0x44')](handleError(_0x25919a,null));};exports[_0x0ccf('0x52')]=function(_0xef0541,_0x1fb4ed,_0x3ff6a6){return db[_0x0ccf('0x2f')][_0x0ccf('0x53')]({'where':{'id':_0xef0541['params']['id']}})['then'](handleEntityNotFound(_0x1fb4ed,null))[_0x0ccf('0x28')](function(_0x1f1ab9){if(!_0xef0541[_0x0ccf('0x36')][_0x0ccf('0x54')]||!utils[_0x0ccf('0x55')](_0xef0541['query'][_0x0ccf('0x54')])){throw new db['Sequelize'][(_0x0ccf('0x56'))](_0x0ccf('0x57'));}var _0x19bf2f={};var _0x5a264c={};_0x5a264c[_0x0ccf('0x34')]=_[_0x0ccf('0x35')](db[_[_0x0ccf('0x58')](_0xef0541[_0x0ccf('0x36')][_0x0ccf('0x54')]['toLowerCase']())+_0x0ccf('0x59')][_0x0ccf('0x30')]);_0x5a264c[_0x0ccf('0x36')]=_[_0x0ccf('0x35')](_0xef0541[_0x0ccf('0x36')]);_0x5a264c[_0x0ccf('0x37')]=_[_0x0ccf('0x38')](_0x5a264c[_0x0ccf('0x34')],_0x5a264c[_0x0ccf('0x36')]);_0x19bf2f[_0x0ccf('0x3a')]=_[_0x0ccf('0x38')](_0x5a264c['model'],qs[_0x0ccf('0x39')](_0xef0541[_0x0ccf('0x36')]['fields']));_0x19bf2f[_0x0ccf('0x3a')]=_0x19bf2f[_0x0ccf('0x3a')][_0x0ccf('0x5a')]?_0x19bf2f[_0x0ccf('0x3a')]:_0x5a264c[_0x0ccf('0x34')];_0x19bf2f[_0x0ccf('0x21')]=qs[_0x0ccf('0x21')](_0xef0541[_0x0ccf('0x36')]['limit']);_0x19bf2f[_0x0ccf('0x23')]=qs[_0x0ccf('0x23')](_0xef0541['query'][_0x0ccf('0x23')]);_0x19bf2f[_0x0ccf('0x3b')]=qs[_0x0ccf('0x3c')](_0xef0541['query'][_0x0ccf('0x3c')]);_0x19bf2f[_0x0ccf('0x3d')]=qs[_0x0ccf('0x37')](_['pick'](_0xef0541[_0x0ccf('0x36')],_0x5a264c[_0x0ccf('0x37')]));_0x19bf2f=_[_0x0ccf('0x40')]({},_0x19bf2f,_0xef0541['options']);return _0x1f1ab9['get'+_[_0x0ccf('0x58')](_0xef0541[_0x0ccf('0x36')]['channel'][_0x0ccf('0x5b')]())+_0x0ccf('0x5c')](_0x19bf2f);})[_0x0ccf('0x28')](respondWithResult(_0x1fb4ed,null))[_0x0ccf('0x44')](handleError(_0x1fb4ed,null));};exports[_0x0ccf('0x5d')]=function(_0xbf1814,_0x4dd6b8,_0x5df35d){return db[_0x0ccf('0x2f')][_0x0ccf('0x53')]({'where':{'id':_0xbf1814['params']['id']}})['then'](function(_0x53f515){if(_0x53f515){if(!_0xbf1814['body']['channel']||!utils[_0x0ccf('0x55')](_0xbf1814[_0x0ccf('0x4a')]['channel'])){throw new db[(_0x0ccf('0x5e'))][(_0x0ccf('0x56'))](_0x0ccf('0x57'));}return _0x53f515[_0x0ccf('0x5f')+_['capitalize'](_0xbf1814[_0x0ccf('0x4a')][_0x0ccf('0x54')][_0x0ccf('0x5b')]())+_0x0ccf('0x5c')](_0xbf1814[_0x0ccf('0x4a')][_0x0ccf('0x60')]);}return null;})[_0x0ccf('0x28')](handleEntityNotFound(_0x4dd6b8,null))[_0x0ccf('0x28')](respondWithStatusCode(_0x4dd6b8,null))['catch'](handleError(_0x4dd6b8,null));};exports[_0x0ccf('0x61')]=function(_0x28d7cc,_0x4f7eed,_0xdf9b8e){return db['Team'][_0x0ccf('0x53')]({'where':{'id':_0x28d7cc['params']['id']}})[_0x0ccf('0x28')](function(_0x3f9279){if(_0x3f9279){if(!_0x28d7cc[_0x0ccf('0x36')]['channel']||!utils[_0x0ccf('0x55')](_0x28d7cc[_0x0ccf('0x36')][_0x0ccf('0x54')])){throw new db['Sequelize'][(_0x0ccf('0x56'))](_0x0ccf('0x57'));}return _0x3f9279[_0x0ccf('0x62')+_[_0x0ccf('0x58')](_0x28d7cc[_0x0ccf('0x36')]['channel'][_0x0ccf('0x5b')]())+_0x0ccf('0x5c')](_0x28d7cc['query'][_0x0ccf('0x60')]);}return null;})[_0x0ccf('0x28')](handleEntityNotFound(_0x4f7eed,null))[_0x0ccf('0x28')](respondWithStatusCode(_0x4f7eed,null))['catch'](handleError(_0x4f7eed,null));};exports[_0x0ccf('0x63')]=function(_0x13e24b,_0x4acf1a){return db['Team']['find']({'where':{'id':_0x13e24b['params']['id']}})[_0x0ccf('0x28')](handleEntityNotFound(_0x4acf1a,null))[_0x0ccf('0x28')](function(_0x5d061e){if(_0x5d061e){var _0x34bd23=[_0x0ccf('0x64'),_0x0ccf('0x65'),'Mail',_0x0ccf('0x66'),_0x0ccf('0x67'),'Openchannel','Whatsapp'];return db[_0x0ccf('0x68')][_0x0ccf('0x69')](function(_0x15e08c){var _0x6054aa=_[_0x0ccf('0x2e')](_0x34bd23,function(_0x1a6f3f){var _0xe97d8b={'attributes':['id','name']};if(_0x1a6f3f===_0x0ccf('0x64')){_0xe97d8b[_0x0ccf('0x6a')]={'attributes':['penalty']};}return _0x5d061e[_0x0ccf('0x29')+_0x1a6f3f+_0x0ccf('0x5c')](_0xe97d8b)[_0x0ccf('0x28')](function(_0x1f9f49){var _0x566ba7=_[_0x0ccf('0x2e')](_0x1f9f49,function(_0x384b8f){var _0xa80f55=_[_0x0ccf('0x2e')](_0x13e24b[_0x0ccf('0x4a')][_0x0ccf('0x60')],function(_0xa9db47){var _0x3a3b4a={'where':{'UserId':_0xa9db47,[_0x1a6f3f+_0x0ccf('0x6b')]:_0x384b8f['id']},'transaction':_0x15e08c};if(_0x1a6f3f===_0x0ccf('0x64')){_0x3a3b4a[_0x0ccf('0x6c')]={'penalty':_0x384b8f['TeamVoiceQueue']['penalty']};}return db[_0x0ccf('0x6d')+_0x1a6f3f+_0x0ccf('0x59')][_0x0ccf('0x6e')](_0x3a3b4a)[_0x0ccf('0x28')](function(){socket[_0x0ccf('0x6f')]('user'+_0x1a6f3f+_0x0ccf('0x70'),{'UserId':_0xa9db47,[_0x1a6f3f+_0x0ccf('0x6b')]:_0x384b8f['id']});if(_0x1a6f3f!==_0x0ccf('0x64'))return;return db[_0x0ccf('0x6d')]['findAll']({'where':{'id':_0x13e24b[_0x0ccf('0x4a')][_0x0ccf('0x60')],'online':0x1},'attributes':['id',_0x0ccf('0x2c'),'online',_0x0ccf('0x71'),'interface'],'raw':!![]})[_0x0ccf('0x28')](function(_0x3fee85){var _0x13de1b=_[_0x0ccf('0x2e')](_0x3fee85,function(_0x2f6b9e){return db['UserVoiceQueueRt']['upsert']({'membername':_0x2f6b9e[_0x0ccf('0x2c')],'UserId':_0x2f6b9e['id'],'queue_name':_0x384b8f[_0x0ccf('0x2c')],'VoiceQueueId':_0x384b8f['id'],'interface':_[_0x0ccf('0x72')](_0x2f6b9e[_0x0ccf('0x73')])?util[_0x0ccf('0x74')](_0x0ccf('0x75'),_0x2f6b9e[_0x0ccf('0x2c')]):_0x2f6b9e[_0x0ccf('0x73')],'paused':_0x2f6b9e['voicePause']||![],'penalty':_0x384b8f[_0x0ccf('0x76')][_0x0ccf('0x77')]},{'transaction':_0x15e08c});});return Promise['all'](_0x13de1b);});});});return Promise['all'](_0xa80f55);});return Promise[_0x0ccf('0x78')](_0x566ba7);})[_0x0ccf('0x28')](function(){var _0x3ee1aa=JSON[_0x0ccf('0x79')]('['+_0x13e24b['body'][_0x0ccf('0x60')]+']');db[_0x0ccf('0x7a')][_0x0ccf('0x53')]({'where':{'teamId':_0x13e24b[_0x0ccf('0x46')]['id']}})[_0x0ccf('0x28')](function(_0x2f0487){if(_0x2f0487){for(var _0x8d3b8c=0x0;_0x8d3b8c<_0x3ee1aa[_0x0ccf('0x5a')];_0x8d3b8c++){var _0x24b7db=_0x3ee1aa[_0x8d3b8c];db[_0x0ccf('0x7b')][_0x0ccf('0x7c')]({'UserId':_0x24b7db,'VoicePrefixId':_0x2f0487[_0x0ccf('0x7d')]});}}});});});return Promise[_0x0ccf('0x78')](_0x6054aa)['then'](function(){return _0x5d061e[_0x0ccf('0x63')](_0x13e24b[_0x0ccf('0x4a')][_0x0ccf('0x60')],{'transaction':_0x15e08c})[_0x0ccf('0x7e')](function(_0x2ceec5){return _0x2ceec5;});});});}})[_0x0ccf('0x28')](respondWithResult(_0x4acf1a,null))[_0x0ccf('0x44')](handleError(_0x4acf1a,null));};exports[_0x0ccf('0x7f')]=function(_0x5a082b,_0x3a82e0){return db[_0x0ccf('0x2f')][_0x0ccf('0x48')]({'where':{'id':_0x5a082b[_0x0ccf('0x46')]['id']}})['then'](handleEntityNotFound(_0x3a82e0,null))['then'](function(_0x23e2d9){if(_0x23e2d9){var _0x48ce0a=['Voice',_0x0ccf('0x65'),'Mail',_0x0ccf('0x66'),_0x0ccf('0x67'),_0x0ccf('0x80'),_0x0ccf('0x81')];return db[_0x0ccf('0x68')]['transaction'](function(_0x372f22){var _0x1bb4fd=_[_0x0ccf('0x2e')](_0x48ce0a,function(_0x288092){var _0x8e6d30={'attributes':['id',_0x0ccf('0x2c')]};return _0x23e2d9[_0x0ccf('0x29')+_0x288092+_0x0ccf('0x5c')](_0x8e6d30)['then'](function(_0x567fc1){var _0x286724=_['map'](_0x567fc1,function(_0x109b1d){return _0x109b1d['removeAgents'](_0x5a082b[_0x0ccf('0x36')][_0x0ccf('0x60')],{'transaction':_0x372f22})[_0x0ccf('0x28')](function(){var _0x3f4190=JSON[_0x0ccf('0x79')]('['+_0x5a082b[_0x0ccf('0x36')]['ids']+']');var _0xdde415=_['map'](_0x3f4190,function(_0x3f01d5){socket[_0x0ccf('0x6f')]('user'+_0x288092+_0x0ccf('0x82'),{'UserId':Number(_0x3f01d5),[_0x288092+_0x0ccf('0x6b')]:_0x109b1d['id']});if(_0x288092!==_0x0ccf('0x64'))return;return db[_0x0ccf('0x83')]['destroy']({'where':{'VoiceQueueId':_0x109b1d['id'],'UserId':_0x3f01d5},'transaction':_0x372f22});});return Promise[_0x0ccf('0x78')](_0xdde415);});});return Promise[_0x0ccf('0x78')](_0x286724);});});return Promise['all'](_0x1bb4fd)[_0x0ccf('0x28')](function(){return _0x23e2d9['removeAgents'](_0x5a082b['query'][_0x0ccf('0x60')],{'transaction':_0x372f22});})['then'](function(){var _0x58a955=JSON['parse']('['+_0x5a082b['query']['ids']+']');db[_0x0ccf('0x7a')][_0x0ccf('0x53')]({'where':{'teamId':_0x5a082b[_0x0ccf('0x46')]['id']}})['then'](function(_0x587ce4){if(_0x587ce4){for(var _0xd8e4ac=0x0;_0xd8e4ac<_0x58a955[_0x0ccf('0x5a')];_0xd8e4ac++){var _0x9e32ce=_0x58a955[_0xd8e4ac];db[_0x0ccf('0x7b')]['destroy']({'where':{'UserId':_0x9e32ce,'VoicePrefixId':_0x587ce4['VoicePrefixId']}});}}});});});}})[_0x0ccf('0x28')](respondWithStatusCode(_0x3a82e0,null))['catch'](handleError(_0x3a82e0,null));};exports[_0x0ccf('0x84')]=function(_0x525a58,_0x514382,_0x2c79fd){var _0x209f02={};var _0x2241fb={};var _0x2be0a2;var _0xefe79f;return db['Team'][_0x0ccf('0x53')]({'where':{'id':_0x525a58[_0x0ccf('0x46')]['id']}})[_0x0ccf('0x28')](handleEntityNotFound(_0x514382,null))[_0x0ccf('0x28')](function(_0x361cf6){if(_0x361cf6){_0x2be0a2=_0x361cf6;_0x2241fb['model']=_[_0x0ccf('0x35')](db[_0x0ccf('0x6d')][_0x0ccf('0x30')]);_0x2241fb['query']=_[_0x0ccf('0x35')](_0x525a58[_0x0ccf('0x36')]);_0x2241fb['filters']=_['intersection'](_0x2241fb['model'],_0x2241fb[_0x0ccf('0x36')]);_0x209f02['attributes']=_[_0x0ccf('0x38')](_0x2241fb['model'],qs[_0x0ccf('0x39')](_0x525a58[_0x0ccf('0x36')][_0x0ccf('0x39')]));_0x209f02[_0x0ccf('0x3a')]=_0x209f02[_0x0ccf('0x3a')][_0x0ccf('0x5a')]?_0x209f02['attributes']:_0x2241fb[_0x0ccf('0x34')];_0x209f02[_0x0ccf('0x3b')]=qs[_0x0ccf('0x3c')](_0x525a58[_0x0ccf('0x36')]['sort']);_0x209f02[_0x0ccf('0x3d')]=qs['filters'](_[_0x0ccf('0x3e')](_0x525a58[_0x0ccf('0x36')],_0x2241fb[_0x0ccf('0x37')]));if(_0x525a58[_0x0ccf('0x36')][_0x0ccf('0x3f')]){_0x209f02[_0x0ccf('0x3d')]=_[_0x0ccf('0x40')](_0x209f02['where'],{'$or':_['map'](_0x209f02[_0x0ccf('0x3a')],function(_0x9618a0){var _0x2c6000={};_0x2c6000[_0x9618a0]={'$like':'%'+_0x525a58['query']['filter']+'%'};return _0x2c6000;})});}_0x209f02=_['merge']({},_0x209f02,_0x525a58[_0x0ccf('0x47')]);return _0x2be0a2[_0x0ccf('0x84')](_0x209f02);}})[_0x0ccf('0x28')](function(_0x1175d8){if(_0x1175d8){_0xefe79f=_0x1175d8[_0x0ccf('0x5a')];if(!_0x525a58[_0x0ccf('0x36')][_0x0ccf('0x85')](_0x0ccf('0x86'))){_0x209f02[_0x0ccf('0x21')]=qs['limit'](_0x525a58[_0x0ccf('0x36')]['limit']);_0x209f02[_0x0ccf('0x23')]=qs[_0x0ccf('0x23')](_0x525a58['query'][_0x0ccf('0x23')]);}return _0x2be0a2[_0x0ccf('0x84')](_0x209f02);}})[_0x0ccf('0x28')](function(_0x4c5396){if(_0x4c5396){return _0x4c5396?{'count':_0xefe79f,'rows':_0x4c5396}:null;}})['then'](respondWithResult(_0x514382,null))['catch'](handleError(_0x514382,null));}; \ No newline at end of file +var _0x9c44=['redis','socket.io-emitter','./team.socket','register','sendStatus','end','status','offset','undefined','limit','count','set','reject','save','then','destroy','UserProfileResource','error','stack','name','index','map','Team','rawAttributes','type','key','model','keys','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','findAll','catch','show','params','includeAll','include','options','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Teams','UserProfileSection','userProfileId','autoAssociation','update','channel','isValidChannel','Sequelize','ValidationError','capitalize','length','toLowerCase','Queues','addQueues','findOne','add','ids','removeQueues','Unknown\x20channel','remove','addAgents','isArray','Voice','Mail','Fax','Openchannel','Whatsapp','sequelize','transaction','through','penalty','User','findOrCreate','Queue:save','QueueId','online','interface','UserVoiceQueueRt','upsert','isNil','format','SIP/%s','voicePause','TeamVoiceQueue','all','TeamVoicePrefix','UserVoicePrefix','spread','removeAgents','Sms','emit','Queue:remove','VoicePrefixId','getAgents','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','defaults'];(function(_0x10bbae,_0x408367){var _0x1f21db=function(_0x5149b9){while(--_0x5149b9){_0x10bbae['push'](_0x10bbae['shift']());}};_0x1f21db(++_0x408367);}(_0x9c44,0x178));var _0x49c4=function(_0x2dea24,_0x2fc021){_0x2dea24=_0x2dea24-0x0;var _0x309d58=_0x9c44[_0x2dea24];return _0x309d58;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x49c4('0x0'));var jsonpatch=require(_0x49c4('0x1'));var rp=require(_0x49c4('0x2'));var moment=require(_0x49c4('0x3'));var BPromise=require(_0x49c4('0x4'));var Mustache=require(_0x49c4('0x5'));var util=require('util');var path=require('path');var sox=require(_0x49c4('0x6'));var csv=require('to-csv');var ejs=require(_0x49c4('0x7'));var fs=require('fs');var fs_extra=require(_0x49c4('0x8'));var _=require(_0x49c4('0x9'));var squel=require(_0x49c4('0xa'));var crypto=require(_0x49c4('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x49c4('0xc'));var toCsv=require(_0x49c4('0xd'));var querystring=require(_0x49c4('0xe'));var Papa=require(_0x49c4('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x49c4('0x10'));var as=require(_0x49c4('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x49c4('0x12'))(_0x49c4('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x49c4('0x14'));var db=require(_0x49c4('0x15'))['db'];config['redis']=_[_0x49c4('0x16')](config[_0x49c4('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0x49c4('0x18'))(new Redis(config[_0x49c4('0x17')]));require(_0x49c4('0x19'))[_0x49c4('0x1a')](socket);function respondWithStatusCode(_0x12777c,_0x18211c){_0x18211c=_0x18211c||0xcc;return function(_0x75ea8){if(_0x75ea8){return _0x12777c[_0x49c4('0x1b')](_0x18211c);}return _0x12777c['status'](_0x18211c)[_0x49c4('0x1c')]();};}function respondWithResult(_0x141003,_0x13a2db){_0x13a2db=_0x13a2db||0xc8;return function(_0x81e831){if(_0x81e831){return _0x141003[_0x49c4('0x1d')](_0x13a2db)['json'](_0x81e831);}};}function respondWithFilteredResult(_0x44e607,_0x2891f4){return function(_0x4c3253){if(_0x4c3253){var _0x512650=typeof _0x2891f4[_0x49c4('0x1e')]===_0x49c4('0x1f')&&typeof _0x2891f4[_0x49c4('0x20')]==='undefined';var _0x24856d=_0x4c3253['count'];var _0x2cbd50=_0x512650?0x0:_0x2891f4[_0x49c4('0x1e')];var _0xe31fcc=_0x512650?_0x4c3253[_0x49c4('0x21')]:_0x2891f4[_0x49c4('0x1e')]+_0x2891f4[_0x49c4('0x20')];var _0x280893;if(_0xe31fcc>=_0x24856d){_0xe31fcc=_0x24856d;_0x280893=0xc8;}else{_0x280893=0xce;}_0x44e607[_0x49c4('0x1d')](_0x280893);return _0x44e607[_0x49c4('0x22')]('Content-Range',_0x2cbd50+'-'+_0xe31fcc+'/'+_0x24856d)['json'](_0x4c3253);}return null;};}function patchUpdates(_0x57f502){return function(_0x1c99b1){try{jsonpatch['apply'](_0x1c99b1,_0x57f502,!![]);}catch(_0x592bb8){return BPromise[_0x49c4('0x23')](_0x592bb8);}return _0x1c99b1[_0x49c4('0x24')]();};}function saveUpdates(_0x26c640,_0xd335e4){return function(_0x4811c4){if(_0x4811c4){return _0x4811c4['update'](_0x26c640)[_0x49c4('0x25')](function(_0x9cb797){return _0x9cb797;});}return null;};}function removeEntity(_0x565423,_0x207358){return function(_0x43e014){if(_0x43e014){return _0x43e014[_0x49c4('0x26')]()[_0x49c4('0x25')](function(){var _0x531d92=_0x43e014['get']({'plain':!![]});var _0x449960='Teams';return db[_0x49c4('0x27')][_0x49c4('0x26')]({'where':{'type':_0x449960,'resourceId':_0x531d92['id']}})[_0x49c4('0x25')](function(){return _0x43e014;});})[_0x49c4('0x25')](function(){_0x565423['status'](0xcc)[_0x49c4('0x1c')]();});}};}function handleEntityNotFound(_0x2b2793,_0x46e04d){return function(_0x4f28a2){if(!_0x4f28a2){_0x2b2793[_0x49c4('0x1b')](0x194);}return _0x4f28a2;};}function handleError(_0x29f835,_0x26ba17){_0x26ba17=_0x26ba17||0x1f4;return function(_0x427b26){logger[_0x49c4('0x28')](_0x427b26[_0x49c4('0x29')]);if(_0x427b26[_0x49c4('0x2a')]){delete _0x427b26['name'];}_0x29f835['status'](_0x26ba17)['send'](_0x427b26);};}exports[_0x49c4('0x2b')]=function(_0x7ee704,_0x1eb035){var _0x27e467={},_0x28eb47={},_0x574fd3={'count':0x0,'rows':[]};var _0x38ad77=_[_0x49c4('0x2c')](db[_0x49c4('0x2d')][_0x49c4('0x2e')],function(_0x58e252){return{'name':_0x58e252['fieldName'],'type':_0x58e252[_0x49c4('0x2f')][_0x49c4('0x30')]};});_0x28eb47[_0x49c4('0x31')]=_[_0x49c4('0x2c')](_0x38ad77,_0x49c4('0x2a'));_0x28eb47['query']=_[_0x49c4('0x32')](_0x7ee704[_0x49c4('0x33')]);_0x28eb47[_0x49c4('0x34')]=_['intersection'](_0x28eb47['model'],_0x28eb47[_0x49c4('0x33')]);_0x27e467[_0x49c4('0x35')]=_[_0x49c4('0x36')](_0x28eb47[_0x49c4('0x31')],qs[_0x49c4('0x37')](_0x7ee704[_0x49c4('0x33')][_0x49c4('0x37')]));_0x27e467[_0x49c4('0x35')]=_0x27e467[_0x49c4('0x35')]['length']?_0x27e467[_0x49c4('0x35')]:_0x28eb47['model'];if(!_0x7ee704[_0x49c4('0x33')][_0x49c4('0x38')](_0x49c4('0x39'))){_0x27e467[_0x49c4('0x20')]=qs['limit'](_0x7ee704[_0x49c4('0x33')][_0x49c4('0x20')]);_0x27e467[_0x49c4('0x1e')]=qs['offset'](_0x7ee704[_0x49c4('0x33')][_0x49c4('0x1e')]);}_0x27e467[_0x49c4('0x3a')]=qs[_0x49c4('0x3b')](_0x7ee704[_0x49c4('0x33')][_0x49c4('0x3b')]);_0x27e467[_0x49c4('0x3c')]=qs[_0x49c4('0x34')](_[_0x49c4('0x3d')](_0x7ee704[_0x49c4('0x33')],_0x28eb47[_0x49c4('0x34')]),_0x38ad77);if(_0x7ee704['query'][_0x49c4('0x3e')]){_0x27e467[_0x49c4('0x3c')]=_[_0x49c4('0x3f')](_0x27e467[_0x49c4('0x3c')],{'$or':_[_0x49c4('0x2c')](_0x38ad77,function(_0x29dd5d){if(_0x29dd5d[_0x49c4('0x2f')]!==_0x49c4('0x40')){var _0x248c0a={};_0x248c0a[_0x29dd5d[_0x49c4('0x2a')]]={'$like':'%'+_0x7ee704[_0x49c4('0x33')][_0x49c4('0x3e')]+'%'};return _0x248c0a;}})});}_0x27e467=_[_0x49c4('0x3f')]({},_0x27e467,_0x7ee704['options']);var _0x212366={'where':_0x27e467['where']};return db[_0x49c4('0x2d')][_0x49c4('0x21')](_0x212366)[_0x49c4('0x25')](function(_0x1480da){_0x574fd3[_0x49c4('0x21')]=_0x1480da;if(_0x7ee704[_0x49c4('0x33')]['includeAll']){_0x27e467['include']=[{'all':!![]}];}return db[_0x49c4('0x2d')][_0x49c4('0x41')](_0x27e467);})[_0x49c4('0x25')](function(_0x117151){_0x574fd3['rows']=_0x117151;return _0x574fd3;})[_0x49c4('0x25')](respondWithFilteredResult(_0x1eb035,_0x27e467))[_0x49c4('0x42')](handleError(_0x1eb035,null));};exports[_0x49c4('0x43')]=function(_0x444270,_0x81a674){var _0x3bde49={'raw':![],'where':{'id':_0x444270[_0x49c4('0x44')]['id']}},_0x1a9593={};_0x1a9593[_0x49c4('0x31')]=_['keys'](db[_0x49c4('0x2d')]['rawAttributes']);_0x1a9593[_0x49c4('0x33')]=_[_0x49c4('0x32')](_0x444270[_0x49c4('0x33')]);_0x1a9593[_0x49c4('0x34')]=_[_0x49c4('0x36')](_0x1a9593['model'],_0x1a9593[_0x49c4('0x33')]);_0x3bde49[_0x49c4('0x35')]=_[_0x49c4('0x36')](_0x1a9593[_0x49c4('0x31')],qs[_0x49c4('0x37')](_0x444270[_0x49c4('0x33')][_0x49c4('0x37')]));_0x3bde49['attributes']=_0x3bde49[_0x49c4('0x35')]['length']?_0x3bde49[_0x49c4('0x35')]:_0x1a9593[_0x49c4('0x31')];if(_0x444270[_0x49c4('0x33')][_0x49c4('0x45')]){_0x3bde49[_0x49c4('0x46')]=[{'all':!![]}];}_0x3bde49=_[_0x49c4('0x3f')]({},_0x3bde49,_0x444270[_0x49c4('0x47')]);return db['Team'][_0x49c4('0x48')](_0x3bde49)[_0x49c4('0x25')](handleEntityNotFound(_0x81a674,null))['then'](respondWithResult(_0x81a674,null))[_0x49c4('0x42')](handleError(_0x81a674,null));};exports[_0x49c4('0x49')]=function(_0xfbe179,_0x242afc){return db['Team']['create'](_0xfbe179[_0x49c4('0x4a')],{})['then'](function(_0x4597c3){var _0x1f941f=_0xfbe179[_0x49c4('0x4b')][_0x49c4('0x4c')]({'plain':!![]});if(!_0x1f941f)throw new Error(_0x49c4('0x4d'));if(_0x1f941f[_0x49c4('0x4e')]===_0x49c4('0x4b')){var _0x563f0b=_0x4597c3[_0x49c4('0x4c')]({'plain':!![]});var _0x1550ce=_0x49c4('0x4f');return db[_0x49c4('0x50')][_0x49c4('0x48')]({'where':{'name':_0x1550ce,'userProfileId':_0x1f941f[_0x49c4('0x51')]},'raw':!![]})[_0x49c4('0x25')](function(_0x25d174){if(_0x25d174&&_0x25d174[_0x49c4('0x52')]===0x0){return db[_0x49c4('0x27')]['create']({'name':_0x563f0b['name'],'resourceId':_0x563f0b['id'],'type':_0x25d174[_0x49c4('0x2a')],'sectionId':_0x25d174['id']},{})[_0x49c4('0x25')](function(){return _0x4597c3;});}else{return _0x4597c3;}})['catch'](function(_0x59a8bc){logger[_0x49c4('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x59a8bc);throw _0x59a8bc;});}return _0x4597c3;})['then'](respondWithResult(_0x242afc,0xc9))[_0x49c4('0x42')](handleError(_0x242afc,null));};exports[_0x49c4('0x53')]=function(_0x4a0a93,_0x38c480){if(_0x4a0a93[_0x49c4('0x4a')]['id']){delete _0x4a0a93[_0x49c4('0x4a')]['id'];}return db[_0x49c4('0x2d')]['find']({'where':{'id':_0x4a0a93[_0x49c4('0x44')]['id']}})[_0x49c4('0x25')](handleEntityNotFound(_0x38c480,null))[_0x49c4('0x25')](saveUpdates(_0x4a0a93[_0x49c4('0x4a')],null))[_0x49c4('0x25')](respondWithResult(_0x38c480,null))[_0x49c4('0x42')](handleError(_0x38c480,null));};exports['destroy']=function(_0x5c7ddd,_0x1ef0c1){return db[_0x49c4('0x2d')][_0x49c4('0x48')]({'where':{'id':_0x5c7ddd[_0x49c4('0x44')]['id']}})[_0x49c4('0x25')](handleEntityNotFound(_0x1ef0c1,null))[_0x49c4('0x25')](removeEntity(_0x1ef0c1,null))[_0x49c4('0x42')](handleError(_0x1ef0c1,null));};exports['getQueues']=function(_0x45d715,_0x33c9a6,_0x4ba4eb){return db[_0x49c4('0x2d')]['findOne']({'where':{'id':_0x45d715[_0x49c4('0x44')]['id']}})[_0x49c4('0x25')](handleEntityNotFound(_0x33c9a6,null))[_0x49c4('0x25')](function(_0x2fe89a){if(!_0x45d715[_0x49c4('0x33')][_0x49c4('0x54')]||!utils[_0x49c4('0x55')](_0x45d715[_0x49c4('0x33')]['channel'])){throw new db[(_0x49c4('0x56'))][(_0x49c4('0x57'))]('Unknown\x20channel');}var _0x10dec7={};var _0x299e74={};_0x299e74['model']=_[_0x49c4('0x32')](db[_[_0x49c4('0x58')](_0x45d715['query']['channel']['toLowerCase']())+'Queue'][_0x49c4('0x2e')]);_0x299e74['query']=_[_0x49c4('0x32')](_0x45d715[_0x49c4('0x33')]);_0x299e74['filters']=_[_0x49c4('0x36')](_0x299e74[_0x49c4('0x31')],_0x299e74['query']);_0x10dec7[_0x49c4('0x35')]=_[_0x49c4('0x36')](_0x299e74[_0x49c4('0x31')],qs[_0x49c4('0x37')](_0x45d715['query'][_0x49c4('0x37')]));_0x10dec7[_0x49c4('0x35')]=_0x10dec7[_0x49c4('0x35')][_0x49c4('0x59')]?_0x10dec7['attributes']:_0x299e74[_0x49c4('0x31')];_0x10dec7['limit']=qs['limit'](_0x45d715['query']['limit']);_0x10dec7[_0x49c4('0x1e')]=qs[_0x49c4('0x1e')](_0x45d715[_0x49c4('0x33')][_0x49c4('0x1e')]);_0x10dec7['order']=qs['sort'](_0x45d715[_0x49c4('0x33')][_0x49c4('0x3b')]);_0x10dec7[_0x49c4('0x3c')]=qs[_0x49c4('0x34')](_[_0x49c4('0x3d')](_0x45d715[_0x49c4('0x33')],_0x299e74[_0x49c4('0x34')]));_0x10dec7=_[_0x49c4('0x3f')]({},_0x10dec7,_0x45d715['options']);return _0x2fe89a[_0x49c4('0x4c')+_['capitalize'](_0x45d715[_0x49c4('0x33')][_0x49c4('0x54')][_0x49c4('0x5a')]())+_0x49c4('0x5b')](_0x10dec7);})[_0x49c4('0x25')](respondWithResult(_0x33c9a6,null))[_0x49c4('0x42')](handleError(_0x33c9a6,null));};exports[_0x49c4('0x5c')]=function(_0x3feb0b,_0x13d951,_0x1743d0){return db[_0x49c4('0x2d')][_0x49c4('0x5d')]({'where':{'id':_0x3feb0b[_0x49c4('0x44')]['id']}})[_0x49c4('0x25')](function(_0x2d5f63){if(_0x2d5f63){if(!_0x3feb0b[_0x49c4('0x4a')][_0x49c4('0x54')]||!utils[_0x49c4('0x55')](_0x3feb0b['body']['channel'])){throw new db[(_0x49c4('0x56'))][(_0x49c4('0x57'))]('Unknown\x20channel');}return _0x2d5f63[_0x49c4('0x5e')+_[_0x49c4('0x58')](_0x3feb0b[_0x49c4('0x4a')][_0x49c4('0x54')]['toLowerCase']())+'Queues'](_0x3feb0b['body'][_0x49c4('0x5f')]);}return null;})[_0x49c4('0x25')](handleEntityNotFound(_0x13d951,null))[_0x49c4('0x25')](respondWithStatusCode(_0x13d951,null))[_0x49c4('0x42')](handleError(_0x13d951,null));};exports[_0x49c4('0x60')]=function(_0x146706,_0x191afb,_0x3692a4){return db[_0x49c4('0x2d')]['findOne']({'where':{'id':_0x146706[_0x49c4('0x44')]['id']}})[_0x49c4('0x25')](function(_0x342f8f){if(_0x342f8f){if(!_0x146706['query'][_0x49c4('0x54')]||!utils[_0x49c4('0x55')](_0x146706[_0x49c4('0x33')][_0x49c4('0x54')])){throw new db[(_0x49c4('0x56'))][(_0x49c4('0x57'))](_0x49c4('0x61'));}return _0x342f8f[_0x49c4('0x62')+_['capitalize'](_0x146706[_0x49c4('0x33')][_0x49c4('0x54')][_0x49c4('0x5a')]())+_0x49c4('0x5b')](_0x146706[_0x49c4('0x33')]['ids']);}return null;})['then'](handleEntityNotFound(_0x191afb,null))[_0x49c4('0x25')](respondWithStatusCode(_0x191afb,null))['catch'](handleError(_0x191afb,null));};exports[_0x49c4('0x63')]=function(_0x558880,_0x23516e){var _0x27b77d=_[_0x49c4('0x64')](_0x558880[_0x49c4('0x4a')]['ids'])?_0x558880[_0x49c4('0x4a')][_0x49c4('0x5f')]:[_0x558880[_0x49c4('0x4a')][_0x49c4('0x5f')]];var _0x100bc4=_0x558880[_0x49c4('0x44')]['id'];return db[_0x49c4('0x2d')][_0x49c4('0x48')]({'where':{'id':_0x100bc4}})[_0x49c4('0x25')](handleEntityNotFound(_0x23516e,null))[_0x49c4('0x25')](function(_0x5e7f45){if(_0x5e7f45){var _0x228189=[_0x49c4('0x65'),'Chat',_0x49c4('0x66'),'Sms',_0x49c4('0x67'),_0x49c4('0x68'),_0x49c4('0x69')];return db[_0x49c4('0x6a')][_0x49c4('0x6b')](function(_0x58b90c){var _0x16f618=_[_0x49c4('0x2c')](_0x228189,function(_0x596a9e){var _0x2b5136={'attributes':['id',_0x49c4('0x2a')]};if(_0x596a9e==='Voice'){_0x2b5136[_0x49c4('0x6c')]={'attributes':[_0x49c4('0x6d')]};}return _0x5e7f45['get'+_0x596a9e+_0x49c4('0x5b')](_0x2b5136)[_0x49c4('0x25')](function(_0x25989a){var _0x33dc39=_['map'](_0x25989a,function(_0x999ae2){var _0x7212ce=_['map'](_0x27b77d,function(_0x45df7c){var _0x5f0188={'where':{'UserId':_0x45df7c,[_0x596a9e+'QueueId']:_0x999ae2['id']},'transaction':_0x58b90c};if(_0x596a9e===_0x49c4('0x65')){_0x5f0188['defaults']={'penalty':_0x999ae2['TeamVoiceQueue'][_0x49c4('0x6d')]};}return db[_0x49c4('0x6e')+_0x596a9e+'Queue'][_0x49c4('0x6f')](_0x5f0188)['then'](function(){socket['emit']('user'+_0x596a9e+_0x49c4('0x70'),{'UserId':_0x45df7c,[_0x596a9e+_0x49c4('0x71')]:_0x999ae2['id']});if(_0x596a9e!==_0x49c4('0x65')){return;}return db[_0x49c4('0x6e')]['findAll']({'where':{'id':_0x27b77d,'online':0x1},'attributes':['id','name',_0x49c4('0x72'),'voicePause',_0x49c4('0x73')],'raw':!![]})['then'](function(_0x4e381c){var _0x10a048=_[_0x49c4('0x2c')](_0x4e381c,function(_0x1076be){return db[_0x49c4('0x74')][_0x49c4('0x75')]({'membername':_0x1076be[_0x49c4('0x2a')],'UserId':_0x1076be['id'],'queue_name':_0x999ae2['name'],'VoiceQueueId':_0x999ae2['id'],'interface':_[_0x49c4('0x76')](_0x1076be[_0x49c4('0x73')])?util[_0x49c4('0x77')](_0x49c4('0x78'),_0x1076be[_0x49c4('0x2a')]):_0x1076be['interface'],'paused':_0x1076be[_0x49c4('0x79')]||![],'penalty':_0x999ae2[_0x49c4('0x7a')][_0x49c4('0x6d')]},{'transaction':_0x58b90c});});return Promise['all'](_0x10a048);});});});return Promise['all'](_0x7212ce);});return Promise[_0x49c4('0x7b')](_0x33dc39);})[_0x49c4('0x25')](function(){return db[_0x49c4('0x7c')][_0x49c4('0x5d')]({'where':{'teamId':_0x100bc4}})[_0x49c4('0x25')](function(_0x4e1c71){if(_0x4e1c71){var _0x83b5f2=_[_0x49c4('0x2c')](_0x27b77d,function(_0x191974){db[_0x49c4('0x7d')]['upsert']({'UserId':_0x191974,'VoicePrefixId':_0x4e1c71['VoicePrefixId']});});return Promise[_0x49c4('0x7b')](_0x83b5f2);}});});});return Promise[_0x49c4('0x7b')](_0x16f618)[_0x49c4('0x25')](function(){return _0x5e7f45[_0x49c4('0x63')](_0x27b77d,{'transaction':_0x58b90c})[_0x49c4('0x7e')](function(_0x5413d8){return _0x5413d8;});});});}})[_0x49c4('0x25')](respondWithResult(_0x23516e,null))[_0x49c4('0x42')](handleError(_0x23516e,null));};exports[_0x49c4('0x7f')]=function(_0x1b0111,_0x2cddc1){var _0x8f37e5=_['isArray'](_0x1b0111[_0x49c4('0x33')][_0x49c4('0x5f')])?_0x1b0111[_0x49c4('0x33')][_0x49c4('0x5f')]:[_0x1b0111['query']['ids']];var _0xa96f53=_0x1b0111['params']['id'];return db[_0x49c4('0x2d')]['find']({'where':{'id':_0xa96f53}})[_0x49c4('0x25')](handleEntityNotFound(_0x2cddc1,null))[_0x49c4('0x25')](function(_0x25afc3){if(_0x25afc3){var _0x20bec7=['Voice','Chat',_0x49c4('0x66'),_0x49c4('0x80'),_0x49c4('0x67'),'Openchannel','Whatsapp'];return db[_0x49c4('0x6a')]['transaction'](function(_0x5c4742){var _0x1b9473=_['map'](_0x20bec7,function(_0x22668b){var _0x3cfa95={'attributes':['id','name']};return _0x25afc3[_0x49c4('0x4c')+_0x22668b+_0x49c4('0x5b')](_0x3cfa95)['then'](function(_0x5428a9){var _0xdb9820=_['map'](_0x5428a9,function(_0x43fe1c){return _0x43fe1c[_0x49c4('0x7f')](_0x8f37e5,{'transaction':_0x5c4742})[_0x49c4('0x25')](function(){var _0x352733=_[_0x49c4('0x2c')](_0x8f37e5,function(_0x4483fc){socket[_0x49c4('0x81')]('user'+_0x22668b+_0x49c4('0x82'),{'UserId':Number(_0x4483fc),[_0x22668b+_0x49c4('0x71')]:_0x43fe1c['id']});if(_0x22668b!==_0x49c4('0x65')){return;}return db[_0x49c4('0x74')][_0x49c4('0x26')]({'where':{'VoiceQueueId':_0x43fe1c['id'],'UserId':_0x4483fc},'transaction':_0x5c4742});});return Promise['all'](_0x352733);});});return Promise[_0x49c4('0x7b')](_0xdb9820);});});return Promise['all'](_0x1b9473)[_0x49c4('0x25')](function(){return _0x25afc3[_0x49c4('0x7f')](_0x8f37e5,{'transaction':_0x5c4742});})[_0x49c4('0x25')](function(){return db[_0x49c4('0x7c')]['findOne']({'where':{'teamId':_0xa96f53}})[_0x49c4('0x25')](function(_0x139696){if(_0x139696){var _0x312b02=_[_0x49c4('0x2c')](_0x8f37e5,function(_0x332173){db[_0x49c4('0x7d')]['destroy']({'where':{'UserId':_0x332173,'VoicePrefixId':_0x139696[_0x49c4('0x83')]}});});return Promise['all'](_0x312b02);}});});});}})[_0x49c4('0x25')](respondWithStatusCode(_0x2cddc1,null))[_0x49c4('0x42')](handleError(_0x2cddc1,null));};exports[_0x49c4('0x84')]=function(_0x2722fe,_0x5d864b,_0x46eaa1){var _0x17e7c6={};var _0x5829bc={};var _0x1e0b7d;var _0x3c321f;return db['Team']['findOne']({'where':{'id':_0x2722fe[_0x49c4('0x44')]['id']}})[_0x49c4('0x25')](handleEntityNotFound(_0x5d864b,null))[_0x49c4('0x25')](function(_0x1aa3a3){if(_0x1aa3a3){_0x1e0b7d=_0x1aa3a3;_0x5829bc[_0x49c4('0x31')]=_[_0x49c4('0x32')](db[_0x49c4('0x6e')][_0x49c4('0x2e')]);_0x5829bc[_0x49c4('0x33')]=_[_0x49c4('0x32')](_0x2722fe[_0x49c4('0x33')]);_0x5829bc['filters']=_['intersection'](_0x5829bc[_0x49c4('0x31')],_0x5829bc[_0x49c4('0x33')]);_0x17e7c6[_0x49c4('0x35')]=_['intersection'](_0x5829bc[_0x49c4('0x31')],qs[_0x49c4('0x37')](_0x2722fe['query'][_0x49c4('0x37')]));_0x17e7c6['attributes']=_0x17e7c6[_0x49c4('0x35')][_0x49c4('0x59')]?_0x17e7c6[_0x49c4('0x35')]:_0x5829bc[_0x49c4('0x31')];_0x17e7c6['order']=qs[_0x49c4('0x3b')](_0x2722fe[_0x49c4('0x33')][_0x49c4('0x3b')]);_0x17e7c6[_0x49c4('0x3c')]=qs[_0x49c4('0x34')](_['pick'](_0x2722fe['query'],_0x5829bc['filters']));if(_0x2722fe[_0x49c4('0x33')][_0x49c4('0x3e')]){_0x17e7c6[_0x49c4('0x3c')]=_[_0x49c4('0x3f')](_0x17e7c6[_0x49c4('0x3c')],{'$or':_['map'](_0x17e7c6[_0x49c4('0x35')],function(_0x41ef7c){var _0x265dc3={};_0x265dc3[_0x41ef7c]={'$like':'%'+_0x2722fe[_0x49c4('0x33')]['filter']+'%'};return _0x265dc3;})});}_0x17e7c6=_[_0x49c4('0x3f')]({},_0x17e7c6,_0x2722fe[_0x49c4('0x47')]);return _0x1e0b7d[_0x49c4('0x84')](_0x17e7c6);}})[_0x49c4('0x25')](function(_0x2fda4f){if(_0x2fda4f){_0x3c321f=_0x2fda4f['length'];if(!_0x2722fe[_0x49c4('0x33')][_0x49c4('0x38')](_0x49c4('0x39'))){_0x17e7c6['limit']=qs[_0x49c4('0x20')](_0x2722fe[_0x49c4('0x33')][_0x49c4('0x20')]);_0x17e7c6['offset']=qs[_0x49c4('0x1e')](_0x2722fe['query']['offset']);}return _0x1e0b7d[_0x49c4('0x84')](_0x17e7c6);}})[_0x49c4('0x25')](function(_0x4ef4aa){if(_0x4ef4aa){return _0x4ef4aa?{'count':_0x3c321f,'rows':_0x4ef4aa}:null;}})[_0x49c4('0x25')](respondWithResult(_0x5d864b,null))[_0x49c4('0x42')](handleError(_0x5d864b,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index 83d9ba5..172ce70 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 _0xb1d5=['emit','hasOwnProperty','../../mysqldb','Team','setMaxListeners','save','update'];(function(_0x3130b5,_0x23faf7){var _0xa6d8a3=function(_0x175be7){while(--_0x175be7){_0x3130b5['push'](_0x3130b5['shift']());}};_0xa6d8a3(++_0x23faf7);}(_0xb1d5,0x8e));var _0x5b1d=function(_0x1c8de9,_0x5b826b){_0x1c8de9=_0x1c8de9-0x0;var _0x284b59=_0xb1d5[_0x1c8de9];return _0x284b59;};'use strict';var EventEmitter=require('events');var Team=require(_0x5b1d('0x0'))['db'][_0x5b1d('0x1')];var TeamEvents=new EventEmitter();TeamEvents[_0x5b1d('0x2')](0x0);var events={'afterCreate':_0x5b1d('0x3'),'afterUpdate':_0x5b1d('0x4'),'afterDestroy':'remove'};function emitEvent(_0x3c77c9){return function(_0x4535b6,_0x10e522,_0x3af497){TeamEvents[_0x5b1d('0x5')](_0x3c77c9+':'+_0x4535b6['id'],_0x4535b6);TeamEvents['emit'](_0x3c77c9,_0x4535b6);_0x3af497(null);};}for(var e in events){if(events[_0x5b1d('0x6')](e)){var event=events[e];Team['hook'](e,emitEvent(event));}}module['exports']=TeamEvents; \ No newline at end of file +var _0x4e65=['save','update','remove','emit','hasOwnProperty','hook','exports','events','Team','setMaxListeners'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4e65,0x115));var _0x54e6=function(_0x425419,_0x59d24c){_0x425419=_0x425419-0x0;var _0x4eadab=_0x4e65[_0x425419];return _0x4eadab;};'use strict';var EventEmitter=require(_0x54e6('0x0'));var Team=require('../../mysqldb')['db'][_0x54e6('0x1')];var TeamEvents=new EventEmitter();TeamEvents[_0x54e6('0x2')](0x0);var events={'afterCreate':_0x54e6('0x3'),'afterUpdate':_0x54e6('0x4'),'afterDestroy':_0x54e6('0x5')};function emitEvent(_0x5415b3){return function(_0x3806c5,_0x2d1867,_0x4cf760){TeamEvents[_0x54e6('0x6')](_0x5415b3+':'+_0x3806c5['id'],_0x3806c5);TeamEvents[_0x54e6('0x6')](_0x5415b3,_0x3806c5);_0x4cf760(null);};}for(var e in events){if(events[_0x54e6('0x7')](e)){var event=events[e];Team[_0x54e6('0x8')](e,emitEvent(event));}}module[_0x54e6('0x9')]=TeamEvents; \ No newline at end of file diff --git a/server/api/team/team.model.js b/server/api/team/team.model.js index da667f0..8ced0e6 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 _0x8483=['../../config/logger','api','moment','request-promise','path','rimraf','exports','define','util'];(function(_0x3e9ce2,_0xf0d6cc){var _0x305a12=function(_0x34230b){while(--_0x34230b){_0x3e9ce2['push'](_0x3e9ce2['shift']());}};_0x305a12(++_0xf0d6cc);}(_0x8483,0x194));var _0x3848=function(_0x282c0b,_0x16c486){_0x282c0b=_0x282c0b-0x0;var _0x448aa5=_0x8483[_0x282c0b];return _0x448aa5;};'use strict';var _=require('lodash');var util=require(_0x3848('0x0'));var logger=require(_0x3848('0x1'))(_0x3848('0x2'));var moment=require(_0x3848('0x3'));var BPromise=require('bluebird');var rp=require(_0x3848('0x4'));var fs=require('fs');var path=require(_0x3848('0x5'));var rimraf=require(_0x3848('0x6'));var config=require('../../config/environment');var attributes=require('./team.attributes');module[_0x3848('0x7')]=function(_0x5cb5f9,_0xe5a873){return _0x5cb5f9[_0x3848('0x8')]('Team',attributes,{'tableName':'teams','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5f4c=['../../config/logger','bluebird','path','rimraf','../../config/environment','Team','teams','lodash','util'];(function(_0x216a28,_0x4f021e){var _0x4f4901=function(_0x285775){while(--_0x285775){_0x216a28['push'](_0x216a28['shift']());}};_0x4f4901(++_0x4f021e);}(_0x5f4c,0x6a));var _0xc5f4=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x5f4c[_0x6131cd];return _0x47e916;};'use strict';var _=require(_0xc5f4('0x0'));var util=require(_0xc5f4('0x1'));var logger=require(_0xc5f4('0x2'))('api');var moment=require('moment');var BPromise=require(_0xc5f4('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc5f4('0x4'));var rimraf=require(_0xc5f4('0x5'));var config=require(_0xc5f4('0x6'));var attributes=require('./team.attributes');module['exports']=function(_0x5e94c0,_0x4bc2b7){return _0x5e94c0['define'](_0xc5f4('0x7'),attributes,{'tableName':_0xc5f4('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/team/team.rpc.js b/server/api/team/team.rpc.js index 9dbeed0..c9e8fba 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 _0xe226=['lodash','util','moment','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./team.socket','register','then','info','Team,\x20%s,\x20%s','request\x20sent','debug','Team,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result'];(function(_0x2576d7,_0x167624){var _0x16a08c=function(_0x19de1e){while(--_0x19de1e){_0x2576d7['push'](_0x2576d7['shift']());}};_0x16a08c(++_0x167624);}(_0xe226,0x1cb));var _0x6e22=function(_0x1f54b7,_0x42b884){_0x1f54b7=_0x1f54b7-0x0;var _0x1c4b70=_0xe226[_0x1f54b7];return _0x1c4b70;};'use strict';var _=require(_0x6e22('0x0'));var util=require(_0x6e22('0x1'));var moment=require(_0x6e22('0x2'));var BPromise=require('bluebird');var rs=require(_0x6e22('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6e22('0x4'))['db'];var utils=require(_0x6e22('0x5'));var logger=require('../../config/logger')(_0x6e22('0x6'));var config=require('../../config/environment');var jayson=require(_0x6e22('0x7'));var client=jayson[_0x6e22('0x8')][_0x6e22('0x9')]({'port':0x232a});config[_0x6e22('0xa')]=_[_0x6e22('0xb')](config[_0x6e22('0xa')],{'host':_0x6e22('0xc'),'port':0x18eb});var socket=require(_0x6e22('0xd'))(new Redis(config[_0x6e22('0xa')]));require(_0x6e22('0xe'))[_0x6e22('0xf')](socket);function respondWithRpcPromise(_0x39d5ac,_0x5479d3,_0x3917b6){return new BPromise(function(_0x3f4a3a,_0x186c6f){return client['request'](_0x39d5ac,_0x3917b6)[_0x6e22('0x10')](function(_0x1a4562){logger[_0x6e22('0x11')](_0x6e22('0x12'),_0x5479d3,_0x6e22('0x13'));logger[_0x6e22('0x14')](_0x6e22('0x15'),_0x5479d3,'request\x20sent',JSON[_0x6e22('0x16')](_0x1a4562));if(_0x1a4562['error']){if(_0x1a4562['error'][_0x6e22('0x17')]===0x1f4){logger['error'](_0x6e22('0x12'),_0x5479d3,_0x1a4562[_0x6e22('0x18')][_0x6e22('0x19')]);return _0x186c6f(_0x1a4562[_0x6e22('0x18')][_0x6e22('0x19')]);}logger['error'](_0x6e22('0x12'),_0x5479d3,_0x1a4562[_0x6e22('0x18')]['message']);return _0x3f4a3a(_0x1a4562['error'][_0x6e22('0x19')]);}else{logger['info']('Team,\x20%s,\x20%s',_0x5479d3,_0x6e22('0x13'));_0x3f4a3a(_0x1a4562[_0x6e22('0x1a')][_0x6e22('0x19')]);}})['catch'](function(_0x525604){logger[_0x6e22('0x18')](_0x6e22('0x12'),_0x5479d3,_0x525604);_0x186c6f(_0x525604);});});} \ No newline at end of file +var _0x26bd=['client','http','redis','localhost','socket.io-emitter','./team.socket','request','then','info','Team,\x20%s,\x20%s','Team,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0x25d086,_0x1f468d){var _0x3e6718=function(_0x4a1bc2){while(--_0x4a1bc2){_0x25d086['push'](_0x25d086['shift']());}};_0x3e6718(++_0x1f468d);}(_0x26bd,0x9f));var _0xd26b=function(_0x57a0d1,_0x191119){_0x57a0d1=_0x57a0d1-0x0;var _0x90c2ac=_0x26bd[_0x57a0d1];return _0x90c2ac;};'use strict';var _=require(_0xd26b('0x0'));var util=require(_0xd26b('0x1'));var moment=require('moment');var BPromise=require(_0xd26b('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd26b('0x3'));var db=require(_0xd26b('0x4'))['db'];var utils=require(_0xd26b('0x5'));var logger=require('../../config/logger')(_0xd26b('0x6'));var config=require(_0xd26b('0x7'));var jayson=require(_0xd26b('0x8'));var client=jayson[_0xd26b('0x9')][_0xd26b('0xa')]({'port':0x232a});config[_0xd26b('0xb')]=_['defaults'](config[_0xd26b('0xb')],{'host':_0xd26b('0xc'),'port':0x18eb});var socket=require(_0xd26b('0xd'))(new Redis(config[_0xd26b('0xb')]));require(_0xd26b('0xe'))['register'](socket);function respondWithRpcPromise(_0x3c01b4,_0x5f0277,_0x6a4ec3){return new BPromise(function(_0x5d6e82,_0x465205){return client[_0xd26b('0xf')](_0x3c01b4,_0x6a4ec3)[_0xd26b('0x10')](function(_0x4925cf){logger[_0xd26b('0x11')](_0xd26b('0x12'),_0x5f0277,'request\x20sent');logger['debug'](_0xd26b('0x13'),_0x5f0277,_0xd26b('0x14'),JSON['stringify'](_0x4925cf));if(_0x4925cf['error']){if(_0x4925cf['error']['code']===0x1f4){logger[_0xd26b('0x15')](_0xd26b('0x12'),_0x5f0277,_0x4925cf[_0xd26b('0x15')]['message']);return _0x465205(_0x4925cf[_0xd26b('0x15')][_0xd26b('0x16')]);}logger[_0xd26b('0x15')](_0xd26b('0x12'),_0x5f0277,_0x4925cf[_0xd26b('0x15')][_0xd26b('0x16')]);return _0x5d6e82(_0x4925cf['error'][_0xd26b('0x16')]);}else{logger[_0xd26b('0x11')]('Team,\x20%s,\x20%s',_0x5f0277,_0xd26b('0x14'));_0x5d6e82(_0x4925cf[_0xd26b('0x17')][_0xd26b('0x16')]);}})['catch'](function(_0x2ceddb){logger['error'](_0xd26b('0x12'),_0x5f0277,_0x2ceddb);_0x465205(_0x2ceddb);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index 6ca35b6..547b587 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 _0x1752=['removeListener','register','length','save','remove','update'];(function(_0x4a8ad7,_0x616fae){var _0x291d6d=function(_0xe895b3){while(--_0xe895b3){_0x4a8ad7['push'](_0x4a8ad7['shift']());}};_0x291d6d(++_0x616fae);}(_0x1752,0xa5));var _0x2175=function(_0x4430d8,_0x93facb){_0x4430d8=_0x4430d8-0x0;var _0x2cf50f=_0x1752[_0x4430d8];return _0x2cf50f;};'use strict';var TeamEvents=require('./team.events');var events=[_0x2175('0x0'),_0x2175('0x1'),_0x2175('0x2')];function createListener(_0x1886b3,_0x1b2344){return function(_0xe2453c){_0x1b2344['emit'](_0x1886b3,_0xe2453c);};}function removeListener(_0x1ee277,_0x22c167){return function(){TeamEvents[_0x2175('0x3')](_0x1ee277,_0x22c167);};}exports[_0x2175('0x4')]=function(_0x222868){for(var _0x27ff0b=0x0,_0x19ca87=events[_0x2175('0x5')];_0x27ff0b<_0x19ca87;_0x27ff0b++){var _0x339e4d=events[_0x27ff0b];var _0x672ff1=createListener('team:'+_0x339e4d,_0x222868);TeamEvents['on'](_0x339e4d,_0x672ff1);}}; \ No newline at end of file +var _0xa87e=['save','remove','update','emit','register','length','team:'];(function(_0x4ba124,_0x27a966){var _0x1be63f=function(_0x364b29){while(--_0x364b29){_0x4ba124['push'](_0x4ba124['shift']());}};_0x1be63f(++_0x27a966);}(_0xa87e,0x173));var _0xea87=function(_0x57fde6,_0x1b5272){_0x57fde6=_0x57fde6-0x0;var _0x37e94d=_0xa87e[_0x57fde6];return _0x37e94d;};'use strict';var TeamEvents=require('./team.events');var events=[_0xea87('0x0'),_0xea87('0x1'),_0xea87('0x2')];function createListener(_0x4adb8c,_0x26b38e){return function(_0x1e58a3){_0x26b38e[_0xea87('0x3')](_0x4adb8c,_0x1e58a3);};}function removeListener(_0x712f90,_0x222160){return function(){TeamEvents['removeListener'](_0x712f90,_0x222160);};}exports[_0xea87('0x4')]=function(_0x13c12b){for(var _0x586100=0x0,_0x2f3c3a=events[_0xea87('0x5')];_0x586100<_0x2f3c3a;_0x586100++){var _0x36352b=events[_0x586100];var _0xd0dd3b=createListener(_0xea87('0x6')+_0x36352b,_0x13c12b);TeamEvents['on'](_0x36352b,_0xd0dd3b);}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/index.js b/server/api/teamVoicePrefix/index.js deleted file mode 100644 index a8404e5..0000000 --- a/server/api/teamVoicePrefix/index.js +++ /dev/null @@ -1,18 +0,0 @@ -// ************************************************************************* -// * * -// * xCALLY Motion - The Omnichannel Contact Center * -// * Copyright (c) Xenialab s.r.l. All Rights Reserved * -// * * -// ************************************************************************* -// * * -// * Email: info@xcally.com * -// * Website: https://www.xcally.com * -// * * -// ************************************************************************* -// * * -// * The SOFTWARE PRODUCT is protected by copyright laws and international * -// * copyright treaties, as well as other intellectual property laws and * -// * treaties. The SOFTWARE PRODUCT is licensed, not sold. * -// * * -// ************************************************************************* -var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x43f7d7,_0x3f7d79){var _0x12b17b=function(_0x13e16b){while(--_0x13e16b){_0x43f7d7['push'](_0x43f7d7['shift']());}};_0x12b17b(++_0x3f7d79);}(_0xe706,0xa3));var _0x6e70=function(_0x299027,_0x5d2e4f){_0x299027=_0x299027-0x0;var _0x1bc622=_0xe706[_0x299027];return _0x1bc622;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js b/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js index a076978..7d5ea50 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 _0xc5ba=['exports','INTEGER','sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc5ba,0xb9));var _0xac5b=function(_0x2b78e5,_0x3126f8){_0x2b78e5=_0x2b78e5-0x0;var _0xa8d52d=_0xc5ba[_0x2b78e5];return _0xa8d52d;};'use strict';var Sequelize=require(_0xac5b('0x0'));module[_0xac5b('0x1')]={'TeamId':{'type':Sequelize[_0xac5b('0x2')]},'VoicePrefixId':{'type':Sequelize[_0xac5b('0x2')]}}; \ No newline at end of file +var _0x2557=['sequelize','INTEGER'];(function(_0x180a87,_0x3c3463){var _0x281e81=function(_0x15cacd){while(--_0x15cacd){_0x180a87['push'](_0x180a87['shift']());}};_0x281e81(++_0x3c3463);}(_0x2557,0x11e));var _0x7255=function(_0x39d276,_0x4e889e){_0x39d276=_0x39d276-0x0;var _0x5caf46=_0x2557[_0x39d276];return _0x5caf46;};'use strict';var Sequelize=require(_0x7255('0x0'));module['exports']={'TeamId':{'type':Sequelize[_0x7255('0x1')]},'VoicePrefixId':{'type':Sequelize[_0x7255('0x1')]}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.model.js b/server/api/teamVoicePrefix/teamVoicePrefix.model.js index 8c209bb..e6a84e5 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 _0xd523=['exports','TeamVoicePrefix','team_has_voice_prefixes','lodash','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./teamVoicePrefix.attributes'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xd523,0x153));var _0x3d52=function(_0x25c51c,_0x3d424d){_0x25c51c=_0x25c51c-0x0;var _0x132bf4=_0xd523[_0x25c51c];return _0x132bf4;};'use strict';var _=require(_0x3d52('0x0'));var util=require(_0x3d52('0x1'));var logger=require(_0x3d52('0x2'))(_0x3d52('0x3'));var moment=require('moment');var BPromise=require(_0x3d52('0x4'));var rp=require(_0x3d52('0x5'));var fs=require('fs');var path=require(_0x3d52('0x6'));var rimraf=require('rimraf');var config=require(_0x3d52('0x7'));var attributes=require(_0x3d52('0x8'));module[_0x3d52('0x9')]=function(_0x46a0e9,_0x580f82){return _0x46a0e9['define'](_0x3d52('0xa'),attributes,{'tableName':_0x3d52('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9a86=['define','TeamVoicePrefix','team_has_voice_prefixes','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./teamVoicePrefix.attributes','exports'];(function(_0x2070da,_0x45e586){var _0x4f9fe1=function(_0x5b6f2a){while(--_0x5b6f2a){_0x2070da['push'](_0x2070da['shift']());}};_0x4f9fe1(++_0x45e586);}(_0x9a86,0x1ed));var _0x69a8=function(_0x36fbef,_0x4ffc84){_0x36fbef=_0x36fbef-0x0;var _0x45e270=_0x9a86[_0x36fbef];return _0x45e270;};'use strict';var _=require(_0x69a8('0x0'));var util=require(_0x69a8('0x1'));var logger=require('../../config/logger')(_0x69a8('0x2'));var moment=require(_0x69a8('0x3'));var BPromise=require(_0x69a8('0x4'));var rp=require(_0x69a8('0x5'));var fs=require('fs');var path=require(_0x69a8('0x6'));var rimraf=require(_0x69a8('0x7'));var config=require(_0x69a8('0x8'));var attributes=require(_0x69a8('0x9'));module[_0x69a8('0xa')]=function(_0x36c9ac,_0x3ed1d5){return _0x36c9ac[_0x69a8('0xb')](_0x69a8('0xc'),attributes,{'tableName':_0x69a8('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.rpc.js b/server/api/teamVoicePrefix/teamVoicePrefix.rpc.js deleted file mode 100644 index 4cef1e0..0000000 --- a/server/api/teamVoicePrefix/teamVoicePrefix.rpc.js +++ /dev/null @@ -1,18 +0,0 @@ -// ************************************************************************* -// * * -// * xCALLY Motion - The Omnichannel Contact Center * -// * Copyright (c) Xenialab s.r.l. All Rights Reserved * -// * * -// ************************************************************************* -// * * -// * Email: info@xcally.com * -// * Website: https://www.xcally.com * -// * * -// ************************************************************************* -// * * -// * The SOFTWARE PRODUCT is protected by copyright laws and international * -// * copyright treaties, as well as other intellectual property laws and * -// * treaties. The SOFTWARE PRODUCT is licensed, not sold. * -// * * -// ************************************************************************* -var _0x715b=['TeamVoicePrefix,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','request\x20sent','debug'];(function(_0x3aa1f0,_0x3ee7c9){var _0x520581=function(_0x34824){while(--_0x34824){_0x3aa1f0['push'](_0x3aa1f0['shift']());}};_0x520581(++_0x3ee7c9);}(_0x715b,0x139));var _0xb715=function(_0x3745de,_0x3bf837){_0x3745de=_0x3745de-0x0;var _0x3c55fb=_0x715b[_0x3745de];return _0x3c55fb;};'use strict';var _=require(_0xb715('0x0'));var util=require(_0xb715('0x1'));var moment=require(_0xb715('0x2'));var BPromise=require(_0xb715('0x3'));var rs=require(_0xb715('0x4'));var fs=require('fs');var Redis=require(_0xb715('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xb715('0x6'));var logger=require(_0xb715('0x7'))(_0xb715('0x8'));var config=require('../../config/environment');var jayson=require(_0xb715('0x9'));var client=jayson[_0xb715('0xa')][_0xb715('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3ab327,_0x2ce87b,_0x21dcf1){return new BPromise(function(_0x5e604a,_0x829f3f){return client[_0xb715('0xc')](_0x3ab327,_0x21dcf1)[_0xb715('0xd')](function(_0x1902c0){logger[_0xb715('0xe')]('TeamVoicePrefix,\x20%s,\x20%s',_0x2ce87b,_0xb715('0xf'));logger[_0xb715('0x10')](_0xb715('0x11'),_0x2ce87b,_0xb715('0xf'),JSON[_0xb715('0x12')](_0x1902c0));if(_0x1902c0[_0xb715('0x13')]){if(_0x1902c0[_0xb715('0x13')][_0xb715('0x14')]===0x1f4){logger[_0xb715('0x13')]('TeamVoicePrefix,\x20%s,\x20%s',_0x2ce87b,_0x1902c0[_0xb715('0x13')][_0xb715('0x15')]);return _0x829f3f(_0x1902c0[_0xb715('0x13')][_0xb715('0x15')]);}logger[_0xb715('0x13')]('TeamVoicePrefix,\x20%s,\x20%s',_0x2ce87b,_0x1902c0['error']['message']);return _0x5e604a(_0x1902c0[_0xb715('0x13')]['message']);}else{logger['info']('TeamVoicePrefix,\x20%s,\x20%s',_0x2ce87b,_0xb715('0xf'));_0x5e604a(_0x1902c0['result']['message']);}})['catch'](function(_0x173def){logger[_0xb715('0x13')]('TeamVoicePrefix,\x20%s,\x20%s',_0x2ce87b,_0x173def);_0x829f3f(_0x173def);});});} \ No newline at end of file diff --git a/server/api/teamVoiceQueue/index.js b/server/api/teamVoiceQueue/index.js index b6dc328..5eebeb0 100644 --- a/server/api/teamVoiceQueue/index.js +++ b/server/api/teamVoiceQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x19d867,_0x4ddeed){var _0x19eff8=function(_0x3e4613){while(--_0x3e4613){_0x19d867['push'](_0x19d867['shift']());}};_0x19eff8(++_0x4ddeed);}(_0xe706,0xa3));var _0x6e70=function(_0x33bb07,_0x5b1849){_0x33bb07=_0x33bb07-0x0;var _0x481c81=_0xe706[_0x33bb07];return _0x481c81;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file +var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x2979d3,_0x54ff61){var _0x2a9a36=function(_0x215f64){while(--_0x215f64){_0x2979d3['push'](_0x2979d3['shift']());}};_0x2a9a36(++_0x54ff61);}(_0x9c44,0x178));var _0x49c4=function(_0x45d55e,_0x2fede3){_0x45d55e=_0x45d55e-0x0;var _0x29812a=_0x9c44[_0x45d55e];return _0x29812a;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js b/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js index 60ab16f..1c2a55b 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 _0x6580=['exports','sequelize'];(function(_0x291b7e,_0x1d92d6){var _0x502780=function(_0x2f4acc){while(--_0x2f4acc){_0x291b7e['push'](_0x291b7e['shift']());}};_0x502780(++_0x1d92d6);}(_0x6580,0x75));var _0x0658=function(_0x51d2c4,_0x3cf68f){_0x51d2c4=_0x51d2c4-0x0;var _0x368e6f=_0x6580[_0x51d2c4];return _0x368e6f;};'use strict';var Sequelize=require(_0x0658('0x0'));module[_0x0658('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x8a90=['sequelize','exports','INTEGER'];(function(_0x313d6f,_0x122c8d){var _0x2059ac=function(_0x49c551){while(--_0x49c551){_0x313d6f['push'](_0x313d6f['shift']());}};_0x2059ac(++_0x122c8d);}(_0x8a90,0x138));var _0x08a9=function(_0x4349cd,_0xc9bf81){_0x4349cd=_0x4349cd-0x0;var _0x3df0ef=_0x8a90[_0x4349cd];return _0x3df0ef;};'use strict';var Sequelize=require(_0x08a9('0x0'));module[_0x08a9('0x1')]={'penalty':{'type':Sequelize[_0x08a9('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.model.js b/server/api/teamVoiceQueue/teamVoiceQueue.model.js index 5dbd45f..a328b10 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 _0x1501=['bluebird','request-promise','path','rimraf','./teamVoiceQueue.attributes','define','TeamVoiceQueue','team_has_voice_queues','util','../../config/logger','api'];(function(_0x270836,_0x350925){var _0x40d416=function(_0x1b796b){while(--_0x1b796b){_0x270836['push'](_0x270836['shift']());}};_0x40d416(++_0x350925);}(_0x1501,0x126));var _0x1150=function(_0x1c20a9,_0x1a7ab1){_0x1c20a9=_0x1c20a9-0x0;var _0x4bfa40=_0x1501[_0x1c20a9];return _0x4bfa40;};'use strict';var _=require('lodash');var util=require(_0x1150('0x0'));var logger=require(_0x1150('0x1'))(_0x1150('0x2'));var moment=require('moment');var BPromise=require(_0x1150('0x3'));var rp=require(_0x1150('0x4'));var fs=require('fs');var path=require(_0x1150('0x5'));var rimraf=require(_0x1150('0x6'));var config=require('../../config/environment');var attributes=require(_0x1150('0x7'));module['exports']=function(_0x63c724,_0x316a7d){return _0x63c724[_0x1150('0x8')](_0x1150('0x9'),attributes,{'tableName':_0x1150('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa049=['path','rimraf','../../config/environment','./teamVoiceQueue.attributes','exports','define','team_has_voice_queues','lodash','util','api','moment','bluebird','request-promise'];(function(_0x5f09c5,_0x2bfca0){var _0x426ad9=function(_0x18fe5f){while(--_0x18fe5f){_0x5f09c5['push'](_0x5f09c5['shift']());}};_0x426ad9(++_0x2bfca0);}(_0xa049,0x1db));var _0x9a04=function(_0xb68772,_0x5253ac){_0xb68772=_0xb68772-0x0;var _0x4189bb=_0xa049[_0xb68772];return _0x4189bb;};'use strict';var _=require(_0x9a04('0x0'));var util=require(_0x9a04('0x1'));var logger=require('../../config/logger')(_0x9a04('0x2'));var moment=require(_0x9a04('0x3'));var BPromise=require(_0x9a04('0x4'));var rp=require(_0x9a04('0x5'));var fs=require('fs');var path=require(_0x9a04('0x6'));var rimraf=require(_0x9a04('0x7'));var config=require(_0x9a04('0x8'));var attributes=require(_0x9a04('0x9'));module[_0x9a04('0xa')]=function(_0x570be2,_0x3cacca){return _0x570be2[_0x9a04('0xb')]('TeamVoiceQueue',attributes,{'tableName':_0x9a04('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.rpc.js b/server/api/teamVoiceQueue/teamVoiceQueue.rpc.js index 38965f9..25481e8 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 _0x6797=['request','then','info','TeamVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x20c9b2,_0x55d7b1){var _0x2c6030=function(_0x10845f){while(--_0x10845f){_0x20c9b2['push'](_0x20c9b2['shift']());}};_0x2c6030(++_0x55d7b1);}(_0x6797,0xda));var _0x7679=function(_0x1a0619,_0x3dc342){_0x1a0619=_0x1a0619-0x0;var _0xb5142e=_0x6797[_0x1a0619];return _0xb5142e;};'use strict';var _=require(_0x7679('0x0'));var util=require(_0x7679('0x1'));var moment=require(_0x7679('0x2'));var BPromise=require(_0x7679('0x3'));var rs=require(_0x7679('0x4'));var fs=require('fs');var Redis=require(_0x7679('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x7679('0x6'));var logger=require('../../config/logger')(_0x7679('0x7'));var config=require(_0x7679('0x8'));var jayson=require(_0x7679('0x9'));var client=jayson[_0x7679('0xa')][_0x7679('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x243fbb,_0x52fcaa,_0x1406b3){return new BPromise(function(_0x23e59a,_0x51be53){return client[_0x7679('0xc')](_0x243fbb,_0x1406b3)[_0x7679('0xd')](function(_0xf3f439){logger[_0x7679('0xe')](_0x7679('0xf'),_0x52fcaa,_0x7679('0x10'));logger[_0x7679('0x11')](_0x7679('0x12'),_0x52fcaa,_0x7679('0x10'),JSON['stringify'](_0xf3f439));if(_0xf3f439['error']){if(_0xf3f439[_0x7679('0x13')][_0x7679('0x14')]===0x1f4){logger[_0x7679('0x13')](_0x7679('0xf'),_0x52fcaa,_0xf3f439[_0x7679('0x13')]['message']);return _0x51be53(_0xf3f439[_0x7679('0x13')][_0x7679('0x15')]);}logger['error'](_0x7679('0xf'),_0x52fcaa,_0xf3f439[_0x7679('0x13')][_0x7679('0x15')]);return _0x23e59a(_0xf3f439[_0x7679('0x13')][_0x7679('0x15')]);}else{logger['info']('TeamVoiceQueue,\x20%s,\x20%s',_0x52fcaa,_0x7679('0x10'));_0x23e59a(_0xf3f439['result'][_0x7679('0x15')]);}})[_0x7679('0x16')](function(_0x473dfb){logger[_0x7679('0x13')](_0x7679('0xf'),_0x52fcaa,_0x473dfb);_0x51be53(_0x473dfb);});});} \ No newline at end of file +var _0x98d5=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','then','info','TeamVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash'];(function(_0x2a219a,_0x5ed797){var _0x471b5b=function(_0x5623fd){while(--_0x5623fd){_0x2a219a['push'](_0x2a219a['shift']());}};_0x471b5b(++_0x5ed797);}(_0x98d5,0xfb));var _0x598d=function(_0x39dd73,_0x5c0b2b){_0x39dd73=_0x39dd73-0x0;var _0x1a9540=_0x98d5[_0x39dd73];return _0x1a9540;};'use strict';var _=require(_0x598d('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x598d('0x1'));var rs=require(_0x598d('0x2'));var fs=require('fs');var Redis=require(_0x598d('0x3'));var db=require(_0x598d('0x4'))['db'];var utils=require(_0x598d('0x5'));var logger=require(_0x598d('0x6'))(_0x598d('0x7'));var config=require(_0x598d('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x598d('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x286d2a,_0x507285,_0x4de6f3){return new BPromise(function(_0x26d1cb,_0x2fa217){return client['request'](_0x286d2a,_0x4de6f3)[_0x598d('0xa')](function(_0x27653b){logger[_0x598d('0xb')](_0x598d('0xc'),_0x507285,_0x598d('0xd'));logger[_0x598d('0xe')]('TeamVoiceQueue,\x20%s,\x20%s,\x20%s',_0x507285,'request\x20sent',JSON[_0x598d('0xf')](_0x27653b));if(_0x27653b[_0x598d('0x10')]){if(_0x27653b[_0x598d('0x10')][_0x598d('0x11')]===0x1f4){logger[_0x598d('0x10')](_0x598d('0xc'),_0x507285,_0x27653b[_0x598d('0x10')][_0x598d('0x12')]);return _0x2fa217(_0x27653b[_0x598d('0x10')][_0x598d('0x12')]);}logger[_0x598d('0x10')](_0x598d('0xc'),_0x507285,_0x27653b['error'][_0x598d('0x12')]);return _0x26d1cb(_0x27653b['error'][_0x598d('0x12')]);}else{logger[_0x598d('0xb')](_0x598d('0xc'),_0x507285,_0x598d('0xd'));_0x26d1cb(_0x27653b[_0x598d('0x13')]['message']);}})[_0x598d('0x14')](function(_0x18cbd2){logger['error'](_0x598d('0xc'),_0x507285,_0x18cbd2);_0x2fa217(_0x18cbd2);});});} \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index 2e837a2..98d8d92 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 _0x0324=['get','isAuthenticated','index','/:id','create','update','delete','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./template.controller'];(function(_0x2aea9e,_0x1f587f){var _0x430b92=function(_0x416c37){while(--_0x416c37){_0x2aea9e['push'](_0x2aea9e['shift']());}};_0x430b92(++_0x1f587f);}(_0x0324,0x90));var _0x4032=function(_0xbd3b61,_0x28c7ad){_0xbd3b61=_0xbd3b61-0x0;var _0x3f61ac=_0x0324[_0xbd3b61];return _0x3f61ac;};'use strict';var multer=require('multer');var util=require(_0x4032('0x0'));var path=require(_0x4032('0x1'));var timeout=require(_0x4032('0x2'));var express=require(_0x4032('0x3'));var router=express[_0x4032('0x4')]();var fs_extra=require(_0x4032('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x4032('0x6'));var config=require(_0x4032('0x7'));var controller=require(_0x4032('0x8'));router[_0x4032('0x9')]('/',auth[_0x4032('0xa')](),controller[_0x4032('0xb')]);router['get'](_0x4032('0xc'),auth[_0x4032('0xa')](),controller['show']);router['post']('/',auth[_0x4032('0xa')](),controller[_0x4032('0xd')]);router['put'](_0x4032('0xc'),auth[_0x4032('0xa')](),controller[_0x4032('0xe')]);router[_0x4032('0xf')]('/:id',auth[_0x4032('0xa')](),controller[_0x4032('0x10')]);module['exports']=router; \ No newline at end of file +var _0xd7d1=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./template.controller','get','isAuthenticated','/:id','show','post','create','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x131fe7,_0x21fcdb){var _0x2eddf3=function(_0x1be350){while(--_0x1be350){_0x131fe7['push'](_0x131fe7['shift']());}};_0x2eddf3(++_0x21fcdb);}(_0xd7d1,0x1b3));var _0x1d7d=function(_0x2a28a9,_0x1e0365){_0x2a28a9=_0x2a28a9-0x0;var _0x5c43dd=_0xd7d1[_0x2a28a9];return _0x5c43dd;};'use strict';var multer=require(_0x1d7d('0x0'));var util=require(_0x1d7d('0x1'));var path=require(_0x1d7d('0x2'));var timeout=require(_0x1d7d('0x3'));var express=require(_0x1d7d('0x4'));var router=express[_0x1d7d('0x5')]();var fs_extra=require(_0x1d7d('0x6'));var auth=require(_0x1d7d('0x7'));var interaction=require(_0x1d7d('0x8'));var config=require(_0x1d7d('0x9'));var controller=require(_0x1d7d('0xa'));router[_0x1d7d('0xb')]('/',auth[_0x1d7d('0xc')](),controller['index']);router[_0x1d7d('0xb')](_0x1d7d('0xd'),auth[_0x1d7d('0xc')](),controller[_0x1d7d('0xe')]);router[_0x1d7d('0xf')]('/',auth[_0x1d7d('0xc')](),controller[_0x1d7d('0x10')]);router[_0x1d7d('0x11')](_0x1d7d('0xd'),auth[_0x1d7d('0xc')](),controller[_0x1d7d('0x12')]);router['delete'](_0x1d7d('0xd'),auth['isAuthenticated'](),controller[_0x1d7d('0x13')]);module[_0x1d7d('0x14')]=router; \ No newline at end of file diff --git a/server/api/template/template.attributes.js b/server/api/template/template.attributes.js index 17a1e20..72e22f6 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 _0x646b=['exports','TEXT','sequelize'];(function(_0x24e55d,_0x4281de){var _0x4a29c0=function(_0x4ea980){while(--_0x4ea980){_0x24e55d['push'](_0x24e55d['shift']());}};_0x4a29c0(++_0x4281de);}(_0x646b,0xf2));var _0xb646=function(_0x301064,_0x1985aa){_0x301064=_0x301064-0x0;var _0x5bc841=_0x646b[_0x301064];return _0x5bc841;};'use strict';var Sequelize=require(_0xb646('0x0'));module[_0xb646('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'html':{'type':Sequelize[_0xb646('0x2')]}}; \ No newline at end of file +var _0x4f2b=['sequelize','STRING'];(function(_0x2211ed,_0x1bca0b){var _0x4d78cc=function(_0x467b59){while(--_0x467b59){_0x2211ed['push'](_0x2211ed['shift']());}};_0x4d78cc(++_0x1bca0b);}(_0x4f2b,0x19e));var _0xb4f2=function(_0x289014,_0x2068b3){_0x289014=_0x289014-0x0;var _0x5ed9f4=_0x4f2b[_0x289014];return _0x5ed9f4;};'use strict';var Sequelize=require(_0xb4f2('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xb4f2('0x1')]},'html':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/template/template.controller.js b/server/api/template/template.controller.js index ed9305c..e02e445 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 _0xd71f=['Template','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','filter','merge','where','VIRTUAL','include','findAll','params','includeAll','find','catch','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','Templates','UserProfileResource','error','stack','name','send','map'];(function(_0x2a56ad,_0x2b94bf){var _0x425175=function(_0x342f20){while(--_0x342f20){_0x2a56ad['push'](_0x2a56ad['shift']());}};_0x425175(++_0x2b94bf);}(_0xd71f,0xc8));var _0xfd71=function(_0x53f2e2,_0x51a4cc){_0x53f2e2=_0x53f2e2-0x0;var _0x48882c=_0xd71f[_0x53f2e2];return _0x48882c;};'use strict';var emlformat=require(_0xfd71('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xfd71('0x1'));var jsonpatch=require(_0xfd71('0x2'));var rp=require(_0xfd71('0x3'));var moment=require(_0xfd71('0x4'));var BPromise=require(_0xfd71('0x5'));var Mustache=require(_0xfd71('0x6'));var util=require(_0xfd71('0x7'));var path=require(_0xfd71('0x8'));var sox=require(_0xfd71('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xfd71('0xa'));var squel=require(_0xfd71('0xb'));var crypto=require(_0xfd71('0xc'));var jsforce=require(_0xfd71('0xd'));var deskjs=require(_0xfd71('0xe'));var toCsv=require(_0xfd71('0xf'));var querystring=require(_0xfd71('0x10'));var Papa=require(_0xfd71('0x11'));var Redis=require(_0xfd71('0x12'));var authService=require(_0xfd71('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xfd71('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xfd71('0x15'))(_0xfd71('0x16'));var utils=require(_0xfd71('0x17'));var config=require(_0xfd71('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xfd71('0x19'))['db'];function respondWithStatusCode(_0x3230fc,_0x20c821){_0x20c821=_0x20c821||0xcc;return function(_0x497601){if(_0x497601){return _0x3230fc[_0xfd71('0x1a')](_0x20c821);}return _0x3230fc[_0xfd71('0x1b')](_0x20c821)[_0xfd71('0x1c')]();};}function respondWithResult(_0x35d937,_0x256b80){_0x256b80=_0x256b80||0xc8;return function(_0x13b7d7){if(_0x13b7d7){return _0x35d937[_0xfd71('0x1b')](_0x256b80)[_0xfd71('0x1d')](_0x13b7d7);}};}function respondWithFilteredResult(_0x4f6e94,_0x19b094){return function(_0x1d3ed0){if(_0x1d3ed0){var _0x14747e=typeof _0x19b094[_0xfd71('0x1e')]===_0xfd71('0x1f')&&typeof _0x19b094[_0xfd71('0x20')]===_0xfd71('0x1f');var _0x4464c3=_0x1d3ed0[_0xfd71('0x21')];var _0x48505f=_0x14747e?0x0:_0x19b094[_0xfd71('0x1e')];var _0x5e73b6=_0x14747e?_0x1d3ed0[_0xfd71('0x21')]:_0x19b094['offset']+_0x19b094[_0xfd71('0x20')];var _0x412b86;if(_0x5e73b6>=_0x4464c3){_0x5e73b6=_0x4464c3;_0x412b86=0xc8;}else{_0x412b86=0xce;}_0x4f6e94[_0xfd71('0x1b')](_0x412b86);return _0x4f6e94[_0xfd71('0x22')](_0xfd71('0x23'),_0x48505f+'-'+_0x5e73b6+'/'+_0x4464c3)[_0xfd71('0x1d')](_0x1d3ed0);}return null;};}function patchUpdates(_0x2796d1){return function(_0xe5a158){try{jsonpatch[_0xfd71('0x24')](_0xe5a158,_0x2796d1,!![]);}catch(_0x39a31a){return BPromise[_0xfd71('0x25')](_0x39a31a);}return _0xe5a158[_0xfd71('0x26')]();};}function saveUpdates(_0x3009a3,_0x5f5c48){return function(_0x53fcfe){if(_0x53fcfe){return _0x53fcfe[_0xfd71('0x27')](_0x3009a3)['then'](function(_0x4cc01c){return _0x4cc01c;});}return null;};}function removeEntity(_0x3421d7,_0x3d6107){return function(_0x44567c){if(_0x44567c){return _0x44567c[_0xfd71('0x28')]()[_0xfd71('0x29')](function(){var _0x4e0352=_0x44567c['get']({'plain':!![]});var _0x2136d0=_0xfd71('0x2a');return db[_0xfd71('0x2b')][_0xfd71('0x28')]({'where':{'type':_0x2136d0,'resourceId':_0x4e0352['id']}})[_0xfd71('0x29')](function(){return _0x44567c;});})['then'](function(){_0x3421d7[_0xfd71('0x1b')](0xcc)[_0xfd71('0x1c')]();});}};}function handleEntityNotFound(_0x39a7c0,_0x1b7807){return function(_0x362e84){if(!_0x362e84){_0x39a7c0[_0xfd71('0x1a')](0x194);}return _0x362e84;};}function handleError(_0x18422a,_0x25ec66){_0x25ec66=_0x25ec66||0x1f4;return function(_0x2a55b9){logger[_0xfd71('0x2c')](_0x2a55b9[_0xfd71('0x2d')]);if(_0x2a55b9[_0xfd71('0x2e')]){delete _0x2a55b9[_0xfd71('0x2e')];}_0x18422a[_0xfd71('0x1b')](_0x25ec66)[_0xfd71('0x2f')](_0x2a55b9);};}exports['index']=function(_0xafcb0d,_0x287d51){var _0x282ce3={},_0xb201c={},_0x4c0ec6={'count':0x0,'rows':[]};var _0x5c27fb=_[_0xfd71('0x30')](db[_0xfd71('0x31')][_0xfd71('0x32')],function(_0x525b1f){return{'name':_0x525b1f[_0xfd71('0x33')],'type':_0x525b1f[_0xfd71('0x34')][_0xfd71('0x35')]};});_0xb201c[_0xfd71('0x36')]=_[_0xfd71('0x30')](_0x5c27fb,'name');_0xb201c[_0xfd71('0x37')]=_[_0xfd71('0x38')](_0xafcb0d[_0xfd71('0x37')]);_0xb201c[_0xfd71('0x39')]=_[_0xfd71('0x3a')](_0xb201c[_0xfd71('0x36')],_0xb201c[_0xfd71('0x37')]);_0x282ce3['attributes']=_[_0xfd71('0x3a')](_0xb201c[_0xfd71('0x36')],qs[_0xfd71('0x3b')](_0xafcb0d[_0xfd71('0x37')][_0xfd71('0x3b')]));_0x282ce3['attributes']=_0x282ce3[_0xfd71('0x3c')][_0xfd71('0x3d')]?_0x282ce3[_0xfd71('0x3c')]:_0xb201c[_0xfd71('0x36')];if(!_0xafcb0d['query'][_0xfd71('0x3e')](_0xfd71('0x3f'))){_0x282ce3[_0xfd71('0x20')]=qs[_0xfd71('0x20')](_0xafcb0d[_0xfd71('0x37')]['limit']);_0x282ce3[_0xfd71('0x1e')]=qs[_0xfd71('0x1e')](_0xafcb0d['query'][_0xfd71('0x1e')]);}_0x282ce3['order']=qs['sort'](_0xafcb0d[_0xfd71('0x37')]['sort']);_0x282ce3['where']=qs[_0xfd71('0x39')](_['pick'](_0xafcb0d['query'],_0xb201c['filters']),_0x5c27fb);if(_0xafcb0d[_0xfd71('0x37')][_0xfd71('0x40')]){_0x282ce3['where']=_[_0xfd71('0x41')](_0x282ce3[_0xfd71('0x42')],{'$or':_['map'](_0x5c27fb,function(_0xd8a123){if(_0xd8a123['type']!==_0xfd71('0x43')){var _0x32f02d={};_0x32f02d[_0xd8a123['name']]={'$like':'%'+_0xafcb0d[_0xfd71('0x37')][_0xfd71('0x40')]+'%'};return _0x32f02d;}})});}_0x282ce3=_[_0xfd71('0x41')]({},_0x282ce3,_0xafcb0d['options']);var _0x29cbd8={'where':_0x282ce3[_0xfd71('0x42')]};return db[_0xfd71('0x31')][_0xfd71('0x21')](_0x29cbd8)['then'](function(_0x678ae4){_0x4c0ec6[_0xfd71('0x21')]=_0x678ae4;if(_0xafcb0d[_0xfd71('0x37')]['includeAll']){_0x282ce3[_0xfd71('0x44')]=[{'all':!![]}];}return db[_0xfd71('0x31')][_0xfd71('0x45')](_0x282ce3);})['then'](function(_0x213099){_0x4c0ec6['rows']=_0x213099;return _0x4c0ec6;})[_0xfd71('0x29')](respondWithFilteredResult(_0x287d51,_0x282ce3))['catch'](handleError(_0x287d51,null));};exports['show']=function(_0x24c0c5,_0xe35492){var _0x18b306={'raw':!![],'where':{'id':_0x24c0c5[_0xfd71('0x46')]['id']}},_0x5363fb={};_0x5363fb[_0xfd71('0x36')]=_[_0xfd71('0x38')](db['Template']['rawAttributes']);_0x5363fb['query']=_['keys'](_0x24c0c5[_0xfd71('0x37')]);_0x5363fb[_0xfd71('0x39')]=_[_0xfd71('0x3a')](_0x5363fb['model'],_0x5363fb[_0xfd71('0x37')]);_0x18b306[_0xfd71('0x3c')]=_[_0xfd71('0x3a')](_0x5363fb[_0xfd71('0x36')],qs['fields'](_0x24c0c5[_0xfd71('0x37')][_0xfd71('0x3b')]));_0x18b306['attributes']=_0x18b306[_0xfd71('0x3c')][_0xfd71('0x3d')]?_0x18b306['attributes']:_0x5363fb[_0xfd71('0x36')];if(_0x24c0c5[_0xfd71('0x37')][_0xfd71('0x47')]){_0x18b306['include']=[{'all':!![]}];}_0x18b306=_[_0xfd71('0x41')]({},_0x18b306,_0x24c0c5['options']);return db[_0xfd71('0x31')][_0xfd71('0x48')](_0x18b306)[_0xfd71('0x29')](handleEntityNotFound(_0xe35492,null))[_0xfd71('0x29')](respondWithResult(_0xe35492,null))[_0xfd71('0x49')](handleError(_0xe35492,null));};exports[_0xfd71('0x4a')]=function(_0x2ab4be,_0x3449a5){return db[_0xfd71('0x31')]['create'](_0x2ab4be[_0xfd71('0x4b')],{})[_0xfd71('0x29')](function(_0x327ba9){var _0x39a4ee=_0x2ab4be[_0xfd71('0x4c')][_0xfd71('0x4d')]({'plain':!![]});if(!_0x39a4ee)throw new Error(_0xfd71('0x4e'));if(_0x39a4ee['role']===_0xfd71('0x4c')){var _0x2b7f2a=_0x327ba9[_0xfd71('0x4d')]({'plain':!![]});var _0x5b5743=_0xfd71('0x2a');return db[_0xfd71('0x4f')][_0xfd71('0x48')]({'where':{'name':_0x5b5743,'userProfileId':_0x39a4ee[_0xfd71('0x50')]},'raw':!![]})[_0xfd71('0x29')](function(_0x21ab55){if(_0x21ab55&&_0x21ab55[_0xfd71('0x51')]===0x0){return db[_0xfd71('0x2b')]['create']({'name':_0x2b7f2a['name'],'resourceId':_0x2b7f2a['id'],'type':_0x21ab55[_0xfd71('0x2e')],'sectionId':_0x21ab55['id']},{})[_0xfd71('0x29')](function(){return _0x327ba9;});}else{return _0x327ba9;}})[_0xfd71('0x49')](function(_0x4a0bf7){logger[_0xfd71('0x2c')](_0xfd71('0x52'),_0x4a0bf7);throw _0x4a0bf7;});}return _0x327ba9;})[_0xfd71('0x29')](respondWithResult(_0x3449a5,0xc9))[_0xfd71('0x49')](handleError(_0x3449a5,null));};exports[_0xfd71('0x27')]=function(_0x8f4dd1,_0x8aa936){if(_0x8f4dd1[_0xfd71('0x4b')]['id']){delete _0x8f4dd1[_0xfd71('0x4b')]['id'];}return db[_0xfd71('0x31')][_0xfd71('0x48')]({'where':{'id':_0x8f4dd1[_0xfd71('0x46')]['id']}})['then'](handleEntityNotFound(_0x8aa936,null))['then'](saveUpdates(_0x8f4dd1[_0xfd71('0x4b')],null))[_0xfd71('0x29')](respondWithResult(_0x8aa936,null))[_0xfd71('0x49')](handleError(_0x8aa936,null));};exports[_0xfd71('0x28')]=function(_0x409d25,_0x1e47d3){return db[_0xfd71('0x31')][_0xfd71('0x48')]({'where':{'id':_0x409d25['params']['id']}})[_0xfd71('0x29')](handleEntityNotFound(_0x1e47d3,null))[_0xfd71('0x29')](removeEntity(_0x1e47d3,null))['catch'](handleError(_0x1e47d3,null));}; \ No newline at end of file +var _0xefc2=['../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','get','Templates','UserProfileResource','sendStatus','error','stack','name','send','index','Template','rawAttributes','fieldName','type','key','map','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','keys','include','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x1fcd5c,_0x14052d){var _0x28c845=function(_0x3416eb){while(--_0x3416eb){_0x1fcd5c['push'](_0x1fcd5c['shift']());}};_0x28c845(++_0x14052d);}(_0xefc2,0xa2));var _0x2efc=function(_0x5322fe,_0x3a7102){_0x5322fe=_0x5322fe-0x0;var _0x5d3dba=_0xefc2[_0x5322fe];return _0x5d3dba;};'use strict';var emlformat=require(_0x2efc('0x0'));var rimraf=require(_0x2efc('0x1'));var zipdir=require(_0x2efc('0x2'));var jsonpatch=require(_0x2efc('0x3'));var rp=require(_0x2efc('0x4'));var moment=require(_0x2efc('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x2efc('0x6'));var util=require(_0x2efc('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x2efc('0x8'));var ejs=require(_0x2efc('0x9'));var fs=require('fs');var fs_extra=require(_0x2efc('0xa'));var _=require(_0x2efc('0xb'));var squel=require(_0x2efc('0xc'));var crypto=require(_0x2efc('0xd'));var jsforce=require(_0x2efc('0xe'));var deskjs=require(_0x2efc('0xf'));var toCsv=require(_0x2efc('0x8'));var querystring=require(_0x2efc('0x10'));var Papa=require(_0x2efc('0x11'));var Redis=require(_0x2efc('0x12'));var authService=require(_0x2efc('0x13'));var qs=require(_0x2efc('0x14'));var as=require(_0x2efc('0x15'));var hardwareService=require(_0x2efc('0x16'));var logger=require(_0x2efc('0x17'))(_0x2efc('0x18'));var utils=require(_0x2efc('0x19'));var config=require(_0x2efc('0x1a'));var licenseUtil=require(_0x2efc('0x1b'));var db=require(_0x2efc('0x1c'))['db'];function respondWithStatusCode(_0x6bdf93,_0x132df7){_0x132df7=_0x132df7||0xcc;return function(_0x1191e0){if(_0x1191e0){return _0x6bdf93['sendStatus'](_0x132df7);}return _0x6bdf93[_0x2efc('0x1d')](_0x132df7)[_0x2efc('0x1e')]();};}function respondWithResult(_0xebbf4e,_0x3c572c){_0x3c572c=_0x3c572c||0xc8;return function(_0x586f59){if(_0x586f59){return _0xebbf4e[_0x2efc('0x1d')](_0x3c572c)['json'](_0x586f59);}};}function respondWithFilteredResult(_0x3c9def,_0x53de0a){return function(_0x140b50){if(_0x140b50){var _0x5a93cd=typeof _0x53de0a[_0x2efc('0x1f')]===_0x2efc('0x20')&&typeof _0x53de0a[_0x2efc('0x21')]===_0x2efc('0x20');var _0x3e7820=_0x140b50[_0x2efc('0x22')];var _0x4ca2dc=_0x5a93cd?0x0:_0x53de0a[_0x2efc('0x1f')];var _0xa359aa=_0x5a93cd?_0x140b50['count']:_0x53de0a['offset']+_0x53de0a['limit'];var _0xc2cd52;if(_0xa359aa>=_0x3e7820){_0xa359aa=_0x3e7820;_0xc2cd52=0xc8;}else{_0xc2cd52=0xce;}_0x3c9def[_0x2efc('0x1d')](_0xc2cd52);return _0x3c9def[_0x2efc('0x23')](_0x2efc('0x24'),_0x4ca2dc+'-'+_0xa359aa+'/'+_0x3e7820)['json'](_0x140b50);}return null;};}function patchUpdates(_0x5b26b8){return function(_0x8c76b){try{jsonpatch[_0x2efc('0x25')](_0x8c76b,_0x5b26b8,!![]);}catch(_0x294e6a){return BPromise['reject'](_0x294e6a);}return _0x8c76b[_0x2efc('0x26')]();};}function saveUpdates(_0x1509db,_0x1f770a){return function(_0x18a89b){if(_0x18a89b){return _0x18a89b[_0x2efc('0x27')](_0x1509db)[_0x2efc('0x28')](function(_0x5a6590){return _0x5a6590;});}return null;};}function removeEntity(_0x3ad13e,_0x17c8c6){return function(_0x457737){if(_0x457737){return _0x457737[_0x2efc('0x29')]()[_0x2efc('0x28')](function(){var _0x187dfe=_0x457737[_0x2efc('0x2a')]({'plain':!![]});var _0x49f6ec=_0x2efc('0x2b');return db[_0x2efc('0x2c')][_0x2efc('0x29')]({'where':{'type':_0x49f6ec,'resourceId':_0x187dfe['id']}})[_0x2efc('0x28')](function(){return _0x457737;});})[_0x2efc('0x28')](function(){_0x3ad13e['status'](0xcc)[_0x2efc('0x1e')]();});}};}function handleEntityNotFound(_0x54883a,_0x5ea36b){return function(_0x9134cd){if(!_0x9134cd){_0x54883a[_0x2efc('0x2d')](0x194);}return _0x9134cd;};}function handleError(_0x7cc206,_0x1ae972){_0x1ae972=_0x1ae972||0x1f4;return function(_0x3108a1){logger[_0x2efc('0x2e')](_0x3108a1[_0x2efc('0x2f')]);if(_0x3108a1['name']){delete _0x3108a1[_0x2efc('0x30')];}_0x7cc206['status'](_0x1ae972)[_0x2efc('0x31')](_0x3108a1);};}exports[_0x2efc('0x32')]=function(_0x77e212,_0x43a2ae){var _0x2eb947={},_0x472c3a={},_0x50a4ff={'count':0x0,'rows':[]};var _0x9e0702=_['map'](db[_0x2efc('0x33')][_0x2efc('0x34')],function(_0x36e49f){return{'name':_0x36e49f[_0x2efc('0x35')],'type':_0x36e49f[_0x2efc('0x36')][_0x2efc('0x37')]};});_0x472c3a['model']=_[_0x2efc('0x38')](_0x9e0702,_0x2efc('0x30'));_0x472c3a[_0x2efc('0x39')]=_['keys'](_0x77e212['query']);_0x472c3a[_0x2efc('0x3a')]=_['intersection'](_0x472c3a[_0x2efc('0x3b')],_0x472c3a[_0x2efc('0x39')]);_0x2eb947[_0x2efc('0x3c')]=_[_0x2efc('0x3d')](_0x472c3a['model'],qs['fields'](_0x77e212[_0x2efc('0x39')][_0x2efc('0x3e')]));_0x2eb947[_0x2efc('0x3c')]=_0x2eb947[_0x2efc('0x3c')][_0x2efc('0x3f')]?_0x2eb947[_0x2efc('0x3c')]:_0x472c3a[_0x2efc('0x3b')];if(!_0x77e212[_0x2efc('0x39')][_0x2efc('0x40')](_0x2efc('0x41'))){_0x2eb947[_0x2efc('0x21')]=qs[_0x2efc('0x21')](_0x77e212[_0x2efc('0x39')][_0x2efc('0x21')]);_0x2eb947['offset']=qs[_0x2efc('0x1f')](_0x77e212[_0x2efc('0x39')][_0x2efc('0x1f')]);}_0x2eb947[_0x2efc('0x42')]=qs[_0x2efc('0x43')](_0x77e212[_0x2efc('0x39')]['sort']);_0x2eb947[_0x2efc('0x44')]=qs[_0x2efc('0x3a')](_[_0x2efc('0x45')](_0x77e212[_0x2efc('0x39')],_0x472c3a[_0x2efc('0x3a')]),_0x9e0702);if(_0x77e212[_0x2efc('0x39')][_0x2efc('0x46')]){_0x2eb947[_0x2efc('0x44')]=_[_0x2efc('0x47')](_0x2eb947[_0x2efc('0x44')],{'$or':_[_0x2efc('0x38')](_0x9e0702,function(_0x3fa9a5){if(_0x3fa9a5['type']!==_0x2efc('0x48')){var _0x1aebf3={};_0x1aebf3[_0x3fa9a5[_0x2efc('0x30')]]={'$like':'%'+_0x77e212[_0x2efc('0x39')][_0x2efc('0x46')]+'%'};return _0x1aebf3;}})});}_0x2eb947=_[_0x2efc('0x47')]({},_0x2eb947,_0x77e212[_0x2efc('0x49')]);var _0x8539c3={'where':_0x2eb947[_0x2efc('0x44')]};return db[_0x2efc('0x33')][_0x2efc('0x22')](_0x8539c3)[_0x2efc('0x28')](function(_0x4cf9ad){_0x50a4ff[_0x2efc('0x22')]=_0x4cf9ad;if(_0x77e212[_0x2efc('0x39')][_0x2efc('0x4a')]){_0x2eb947['include']=[{'all':!![]}];}return db[_0x2efc('0x33')][_0x2efc('0x4b')](_0x2eb947);})[_0x2efc('0x28')](function(_0x546e67){_0x50a4ff[_0x2efc('0x4c')]=_0x546e67;return _0x50a4ff;})[_0x2efc('0x28')](respondWithFilteredResult(_0x43a2ae,_0x2eb947))[_0x2efc('0x4d')](handleError(_0x43a2ae,null));};exports[_0x2efc('0x4e')]=function(_0x333636,_0x17e77e){var _0x29ac2d={'raw':!![],'where':{'id':_0x333636['params']['id']}},_0x102851={};_0x102851[_0x2efc('0x3b')]=_[_0x2efc('0x4f')](db[_0x2efc('0x33')][_0x2efc('0x34')]);_0x102851[_0x2efc('0x39')]=_['keys'](_0x333636[_0x2efc('0x39')]);_0x102851[_0x2efc('0x3a')]=_[_0x2efc('0x3d')](_0x102851['model'],_0x102851['query']);_0x29ac2d[_0x2efc('0x3c')]=_['intersection'](_0x102851[_0x2efc('0x3b')],qs['fields'](_0x333636['query']['fields']));_0x29ac2d[_0x2efc('0x3c')]=_0x29ac2d['attributes'][_0x2efc('0x3f')]?_0x29ac2d[_0x2efc('0x3c')]:_0x102851['model'];if(_0x333636[_0x2efc('0x39')][_0x2efc('0x4a')]){_0x29ac2d[_0x2efc('0x50')]=[{'all':!![]}];}_0x29ac2d=_[_0x2efc('0x47')]({},_0x29ac2d,_0x333636[_0x2efc('0x49')]);return db['Template'][_0x2efc('0x51')](_0x29ac2d)['then'](handleEntityNotFound(_0x17e77e,null))[_0x2efc('0x28')](respondWithResult(_0x17e77e,null))[_0x2efc('0x4d')](handleError(_0x17e77e,null));};exports['create']=function(_0x4534bc,_0x262dd9){return db[_0x2efc('0x33')][_0x2efc('0x52')](_0x4534bc['body'],{})['then'](function(_0x10fda6){var _0x5bdfb3=_0x4534bc['user']['get']({'plain':!![]});if(!_0x5bdfb3)throw new Error(_0x2efc('0x53'));if(_0x5bdfb3[_0x2efc('0x54')]===_0x2efc('0x55')){var _0x548d7f=_0x10fda6[_0x2efc('0x2a')]({'plain':!![]});var _0x504a23=_0x2efc('0x2b');return db[_0x2efc('0x56')][_0x2efc('0x51')]({'where':{'name':_0x504a23,'userProfileId':_0x5bdfb3[_0x2efc('0x57')]},'raw':!![]})['then'](function(_0x3c0516){if(_0x3c0516&&_0x3c0516[_0x2efc('0x58')]===0x0){return db[_0x2efc('0x2c')][_0x2efc('0x52')]({'name':_0x548d7f[_0x2efc('0x30')],'resourceId':_0x548d7f['id'],'type':_0x3c0516[_0x2efc('0x30')],'sectionId':_0x3c0516['id']},{})[_0x2efc('0x28')](function(){return _0x10fda6;});}else{return _0x10fda6;}})['catch'](function(_0x2f91a2){logger[_0x2efc('0x2e')](_0x2efc('0x59'),_0x2f91a2);throw _0x2f91a2;});}return _0x10fda6;})[_0x2efc('0x28')](respondWithResult(_0x262dd9,0xc9))['catch'](handleError(_0x262dd9,null));};exports['update']=function(_0x1be273,_0x3477ae){if(_0x1be273[_0x2efc('0x5a')]['id']){delete _0x1be273['body']['id'];}return db[_0x2efc('0x33')]['find']({'where':{'id':_0x1be273['params']['id']}})[_0x2efc('0x28')](handleEntityNotFound(_0x3477ae,null))[_0x2efc('0x28')](saveUpdates(_0x1be273['body'],null))[_0x2efc('0x28')](respondWithResult(_0x3477ae,null))[_0x2efc('0x4d')](handleError(_0x3477ae,null));};exports[_0x2efc('0x29')]=function(_0x2d3fc5,_0x318567){return db[_0x2efc('0x33')][_0x2efc('0x51')]({'where':{'id':_0x2d3fc5[_0x2efc('0x5b')]['id']}})[_0x2efc('0x28')](handleEntityNotFound(_0x318567,null))[_0x2efc('0x28')](removeEntity(_0x318567,null))['catch'](handleError(_0x318567,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index 0916dc1..6d7775f 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 _0xab7f=['moment','bluebird','request-promise','path','rimraf','./template.attributes','define','Template','tools_templates','util','../../config/logger','api'];(function(_0x4178af,_0x388652){var _0x20f4b1=function(_0x504188){while(--_0x504188){_0x4178af['push'](_0x4178af['shift']());}};_0x20f4b1(++_0x388652);}(_0xab7f,0x159));var _0xfab7=function(_0xd9d52c,_0x49ca2e){_0xd9d52c=_0xd9d52c-0x0;var _0x510361=_0xab7f[_0xd9d52c];return _0x510361;};'use strict';var _=require('lodash');var util=require(_0xfab7('0x0'));var logger=require(_0xfab7('0x1'))(_0xfab7('0x2'));var moment=require(_0xfab7('0x3'));var BPromise=require(_0xfab7('0x4'));var rp=require(_0xfab7('0x5'));var fs=require('fs');var path=require(_0xfab7('0x6'));var rimraf=require(_0xfab7('0x7'));var config=require('../../config/environment');var attributes=require(_0xfab7('0x8'));module['exports']=function(_0x5175f0,_0x42fde4){return _0x5175f0[_0xfab7('0x9')](_0xfab7('0xa'),attributes,{'tableName':_0xfab7('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc397=['util','../../config/logger','api','request-promise','path','../../config/environment','./template.attributes','exports','define','Template','tools_templates','lodash'];(function(_0x27371f,_0x469ecb){var _0x464729=function(_0x2137d5){while(--_0x2137d5){_0x27371f['push'](_0x27371f['shift']());}};_0x464729(++_0x469ecb);}(_0xc397,0xcb));var _0x7c39=function(_0xd394d6,_0x4d599c){_0xd394d6=_0xd394d6-0x0;var _0x5a9b74=_0xc397[_0xd394d6];return _0x5a9b74;};'use strict';var _=require(_0x7c39('0x0'));var util=require(_0x7c39('0x1'));var logger=require(_0x7c39('0x2'))(_0x7c39('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x7c39('0x4'));var fs=require('fs');var path=require(_0x7c39('0x5'));var rimraf=require('rimraf');var config=require(_0x7c39('0x6'));var attributes=require(_0x7c39('0x7'));module[_0x7c39('0x8')]=function(_0x387b50,_0x2e5b6b){return _0x387b50[_0x7c39('0x9')](_0x7c39('0xa'),attributes,{'tableName':_0x7c39('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/template/template.rpc.js b/server/api/template/template.rpc.js index f6bf825..4410c35 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 _0x63db=['request\x20sent','debug','Template,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetTemplate','Template','findAll','options','raw','where','attributes','limit','include','model','map','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Template,\x20%s,\x20%s'];(function(_0x2945d3,_0x63b00f){var _0x10282b=function(_0x378bf7){while(--_0x378bf7){_0x2945d3['push'](_0x2945d3['shift']());}};_0x10282b(++_0x63b00f);}(_0x63db,0x117));var _0xb63d=function(_0x5e2c14,_0xd9609e){_0x5e2c14=_0x5e2c14-0x0;var _0x102ccd=_0x63db[_0x5e2c14];return _0x102ccd;};'use strict';var _=require('lodash');var util=require(_0xb63d('0x0'));var moment=require(_0xb63d('0x1'));var BPromise=require(_0xb63d('0x2'));var rs=require(_0xb63d('0x3'));var fs=require('fs');var Redis=require(_0xb63d('0x4'));var db=require(_0xb63d('0x5'))['db'];var utils=require(_0xb63d('0x6'));var logger=require(_0xb63d('0x7'))(_0xb63d('0x8'));var config=require(_0xb63d('0x9'));var jayson=require(_0xb63d('0xa'));var client=jayson[_0xb63d('0xb')][_0xb63d('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x198bd7,_0x3290a5,_0x195ee0){return new BPromise(function(_0x5cf650,_0x4062ff){return client[_0xb63d('0xd')](_0x198bd7,_0x195ee0)[_0xb63d('0xe')](function(_0x88f21){logger[_0xb63d('0xf')](_0xb63d('0x10'),_0x3290a5,_0xb63d('0x11'));logger[_0xb63d('0x12')](_0xb63d('0x13'),_0x3290a5,_0xb63d('0x11'),JSON[_0xb63d('0x14')](_0x88f21));if(_0x88f21[_0xb63d('0x15')]){if(_0x88f21[_0xb63d('0x15')][_0xb63d('0x16')]===0x1f4){logger['error']('Template,\x20%s,\x20%s',_0x3290a5,_0x88f21[_0xb63d('0x15')][_0xb63d('0x17')]);return _0x4062ff(_0x88f21['error'][_0xb63d('0x17')]);}logger[_0xb63d('0x15')]('Template,\x20%s,\x20%s',_0x3290a5,_0x88f21['error'][_0xb63d('0x17')]);return _0x5cf650(_0x88f21[_0xb63d('0x15')][_0xb63d('0x17')]);}else{logger[_0xb63d('0xf')](_0xb63d('0x10'),_0x3290a5,'request\x20sent');_0x5cf650(_0x88f21[_0xb63d('0x18')][_0xb63d('0x17')]);}})[_0xb63d('0x19')](function(_0x5904c8){logger[_0xb63d('0x15')](_0xb63d('0x10'),_0x3290a5,_0x5904c8);_0x4062ff(_0x5904c8);});});}exports[_0xb63d('0x1a')]=function(_0x5685f4){var _0x4b7efb=this;return new Promise(function(_0x22fdbf,_0x921c3){return db[_0xb63d('0x1b')][_0xb63d('0x1c')]({'raw':_0x5685f4[_0xb63d('0x1d')]?_0x5685f4[_0xb63d('0x1d')][_0xb63d('0x1e')]===undefined?!![]:![]:!![],'where':_0x5685f4[_0xb63d('0x1d')]?_0x5685f4[_0xb63d('0x1d')][_0xb63d('0x1f')]||null:null,'attributes':_0x5685f4[_0xb63d('0x1d')]?_0x5685f4[_0xb63d('0x1d')][_0xb63d('0x20')]||null:null,'limit':_0x5685f4[_0xb63d('0x1d')]?_0x5685f4[_0xb63d('0x1d')][_0xb63d('0x21')]||null:null,'include':_0x5685f4[_0xb63d('0x1d')]?_0x5685f4['options']['include']?_['map'](_0x5685f4['options'][_0xb63d('0x22')],function(_0x29f7e8){return{'model':db[_0x29f7e8[_0xb63d('0x23')]],'as':_0x29f7e8['as'],'attributes':_0x29f7e8['attributes'],'include':_0x29f7e8[_0xb63d('0x22')]?_[_0xb63d('0x24')](_0x29f7e8[_0xb63d('0x22')],function(_0x2180de){return{'model':db[_0x2180de['model']],'as':_0x2180de['as'],'attributes':_0x2180de[_0xb63d('0x20')],'include':_0x2180de[_0xb63d('0x22')]?_[_0xb63d('0x24')](_0x2180de[_0xb63d('0x22')],function(_0x3dcc71){return{'model':db[_0x3dcc71['model']],'as':_0x3dcc71['as'],'attributes':_0x3dcc71[_0xb63d('0x20')]};}):[]};}):[]};}):[]:[]})[_0xb63d('0xe')](function(_0x1eb2d2){logger[_0xb63d('0xf')](_0xb63d('0x1a'),_0x5685f4);logger[_0xb63d('0x12')](_0xb63d('0x1a'),_0x5685f4,JSON[_0xb63d('0x14')](_0x1eb2d2));_0x22fdbf(_0x1eb2d2);})[_0xb63d('0x19')](function(_0x49c939){logger[_0xb63d('0x15')](_0xb63d('0x1a'),_0x49c939[_0xb63d('0x17')],_0x5685f4);_0x921c3(_0x4b7efb[_0xb63d('0x15')](0x1f4,_0x49c939[_0xb63d('0x17')]));});});}; \ No newline at end of file +var _0x2b44=['request\x20sent','debug','stringify','error','Template,\x20%s,\x20%s','message','result','findAll','options','raw','attributes','include','model','map','GetTemplate','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','then','info'];(function(_0x5129d2,_0xfa2399){var _0x386fb8=function(_0x1201ad){while(--_0x1201ad){_0x5129d2['push'](_0x5129d2['shift']());}};_0x386fb8(++_0xfa2399);}(_0x2b44,0xb7));var _0x42b4=function(_0xc49fc3,_0x2167ef){_0xc49fc3=_0xc49fc3-0x0;var _0x5e724f=_0x2b44[_0xc49fc3];return _0x5e724f;};'use strict';var _=require(_0x42b4('0x0'));var util=require(_0x42b4('0x1'));var moment=require(_0x42b4('0x2'));var BPromise=require(_0x42b4('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x42b4('0x4'));var db=require(_0x42b4('0x5'))['db'];var utils=require(_0x42b4('0x6'));var logger=require(_0x42b4('0x7'))('rpc');var config=require(_0x42b4('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x42b4('0x9')][_0x42b4('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3be9a5,_0x42a740,_0x452f6a){return new BPromise(function(_0x4a9f4e,_0x433ae9){return client['request'](_0x3be9a5,_0x452f6a)[_0x42b4('0xb')](function(_0x253011){logger[_0x42b4('0xc')]('Template,\x20%s,\x20%s',_0x42a740,_0x42b4('0xd'));logger[_0x42b4('0xe')]('Template,\x20%s,\x20%s,\x20%s',_0x42a740,_0x42b4('0xd'),JSON[_0x42b4('0xf')](_0x253011));if(_0x253011[_0x42b4('0x10')]){if(_0x253011['error']['code']===0x1f4){logger['error'](_0x42b4('0x11'),_0x42a740,_0x253011[_0x42b4('0x10')]['message']);return _0x433ae9(_0x253011[_0x42b4('0x10')][_0x42b4('0x12')]);}logger[_0x42b4('0x10')](_0x42b4('0x11'),_0x42a740,_0x253011[_0x42b4('0x10')]['message']);return _0x4a9f4e(_0x253011[_0x42b4('0x10')][_0x42b4('0x12')]);}else{logger[_0x42b4('0xc')](_0x42b4('0x11'),_0x42a740,'request\x20sent');_0x4a9f4e(_0x253011[_0x42b4('0x13')][_0x42b4('0x12')]);}})['catch'](function(_0x20d9b1){logger['error']('Template,\x20%s,\x20%s',_0x42a740,_0x20d9b1);_0x433ae9(_0x20d9b1);});});}exports['GetTemplate']=function(_0x43472b){var _0x20ca75=this;return new Promise(function(_0x44390b,_0x57fca4){return db['Template'][_0x42b4('0x14')]({'raw':_0x43472b[_0x42b4('0x15')]?_0x43472b['options'][_0x42b4('0x16')]===undefined?!![]:![]:!![],'where':_0x43472b['options']?_0x43472b[_0x42b4('0x15')]['where']||null:null,'attributes':_0x43472b['options']?_0x43472b[_0x42b4('0x15')][_0x42b4('0x17')]||null:null,'limit':_0x43472b[_0x42b4('0x15')]?_0x43472b[_0x42b4('0x15')]['limit']||null:null,'include':_0x43472b[_0x42b4('0x15')]?_0x43472b[_0x42b4('0x15')][_0x42b4('0x18')]?_['map'](_0x43472b[_0x42b4('0x15')]['include'],function(_0x58a0ef){return{'model':db[_0x58a0ef[_0x42b4('0x19')]],'as':_0x58a0ef['as'],'attributes':_0x58a0ef[_0x42b4('0x17')],'include':_0x58a0ef[_0x42b4('0x18')]?_[_0x42b4('0x1a')](_0x58a0ef[_0x42b4('0x18')],function(_0x154385){return{'model':db[_0x154385[_0x42b4('0x19')]],'as':_0x154385['as'],'attributes':_0x154385[_0x42b4('0x17')],'include':_0x154385[_0x42b4('0x18')]?_[_0x42b4('0x1a')](_0x154385[_0x42b4('0x18')],function(_0x3bfd8e){return{'model':db[_0x3bfd8e['model']],'as':_0x3bfd8e['as'],'attributes':_0x3bfd8e[_0x42b4('0x17')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1ee14d){logger['info'](_0x42b4('0x1b'),_0x43472b);logger[_0x42b4('0xe')](_0x42b4('0x1b'),_0x43472b,JSON[_0x42b4('0xf')](_0x1ee14d));_0x44390b(_0x1ee14d);})['catch'](function(_0x16c0c5){logger[_0x42b4('0x10')](_0x42b4('0x1b'),_0x16c0c5[_0x42b4('0x12')],_0x43472b);_0x57fca4(_0x20ca75['error'](0x1f4,_0x16c0c5[_0x42b4('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index 127120f..8b64a85 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 _0x0b4b=['connect-timeout','Router','../../components/auth/service','../../config/environment','./trigger.controller','get','isAuthenticated','index','/:id','show','/:id/all_conditions','/:id/any_conditions','getAnyConditions','/:id/actions','getActions','create','post','addAllCondition','addAnyCondition','addAction','put','delete','destroy','exports','multer','path'];(function(_0x31391a,_0x2b46bf){var _0x27e546=function(_0x121f76){while(--_0x121f76){_0x31391a['push'](_0x31391a['shift']());}};_0x27e546(++_0x2b46bf);}(_0x0b4b,0x16a));var _0xb0b4=function(_0xef8146,_0x459c34){_0xef8146=_0xef8146-0x0;var _0x5a6cb0=_0x0b4b[_0xef8146];return _0x5a6cb0;};'use strict';var multer=require(_0xb0b4('0x0'));var util=require('util');var path=require(_0xb0b4('0x1'));var timeout=require(_0xb0b4('0x2'));var express=require('express');var router=express[_0xb0b4('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xb0b4('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xb0b4('0x5'));var controller=require(_0xb0b4('0x6'));router[_0xb0b4('0x7')]('/',auth[_0xb0b4('0x8')](),controller[_0xb0b4('0x9')]);router[_0xb0b4('0x7')](_0xb0b4('0xa'),auth[_0xb0b4('0x8')](),controller[_0xb0b4('0xb')]);router['get'](_0xb0b4('0xc'),auth[_0xb0b4('0x8')](),controller['getAllConditions']);router[_0xb0b4('0x7')](_0xb0b4('0xd'),auth[_0xb0b4('0x8')](),controller[_0xb0b4('0xe')]);router['get'](_0xb0b4('0xf'),auth[_0xb0b4('0x8')](),controller[_0xb0b4('0x10')]);router['post']('/',auth['isAuthenticated'](),controller[_0xb0b4('0x11')]);router[_0xb0b4('0x12')](_0xb0b4('0xc'),auth['isAuthenticated'](),controller[_0xb0b4('0x13')]);router[_0xb0b4('0x12')](_0xb0b4('0xd'),auth[_0xb0b4('0x8')](),controller[_0xb0b4('0x14')]);router[_0xb0b4('0x12')](_0xb0b4('0xf'),auth[_0xb0b4('0x8')](),controller[_0xb0b4('0x15')]);router[_0xb0b4('0x16')](_0xb0b4('0xa'),auth['isAuthenticated'](),controller['update']);router[_0xb0b4('0x17')]('/:id',auth[_0xb0b4('0x8')](),controller[_0xb0b4('0x18')]);module[_0xb0b4('0x19')]=router; \ No newline at end of file +var _0x2a65=['getAnyConditions','/:id/actions','getActions','create','addAllCondition','post','addAnyCondition','put','update','delete','exports','multer','path','Router','../../components/auth/service','../../components/interaction/service','./trigger.controller','get','isAuthenticated','index','/:id','show','/:id/all_conditions','/:id/any_conditions'];(function(_0xef199a,_0x499fee){var _0x105b9b=function(_0x28dd90){while(--_0x28dd90){_0xef199a['push'](_0xef199a['shift']());}};_0x105b9b(++_0x499fee);}(_0x2a65,0x1a3));var _0x52a6=function(_0x4f7987,_0x3af1f3){_0x4f7987=_0x4f7987-0x0;var _0x1becb2=_0x2a65[_0x4f7987];return _0x1becb2;};'use strict';var multer=require(_0x52a6('0x0'));var util=require('util');var path=require(_0x52a6('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x52a6('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x52a6('0x3'));var interaction=require(_0x52a6('0x4'));var config=require('../../config/environment');var controller=require(_0x52a6('0x5'));router[_0x52a6('0x6')]('/',auth[_0x52a6('0x7')](),controller[_0x52a6('0x8')]);router[_0x52a6('0x6')](_0x52a6('0x9'),auth[_0x52a6('0x7')](),controller[_0x52a6('0xa')]);router[_0x52a6('0x6')](_0x52a6('0xb'),auth[_0x52a6('0x7')](),controller['getAllConditions']);router[_0x52a6('0x6')](_0x52a6('0xc'),auth['isAuthenticated'](),controller[_0x52a6('0xd')]);router[_0x52a6('0x6')](_0x52a6('0xe'),auth[_0x52a6('0x7')](),controller[_0x52a6('0xf')]);router['post']('/',auth[_0x52a6('0x7')](),controller[_0x52a6('0x10')]);router['post'](_0x52a6('0xb'),auth[_0x52a6('0x7')](),controller[_0x52a6('0x11')]);router[_0x52a6('0x12')](_0x52a6('0xc'),auth[_0x52a6('0x7')](),controller[_0x52a6('0x13')]);router['post'](_0x52a6('0xe'),auth[_0x52a6('0x7')](),controller['addAction']);router[_0x52a6('0x14')](_0x52a6('0x9'),auth['isAuthenticated'](),controller[_0x52a6('0x15')]);router[_0x52a6('0x16')]('/:id',auth[_0x52a6('0x7')](),controller['destroy']);module[_0x52a6('0x17')]=router; \ No newline at end of file diff --git a/server/api/trigger/trigger.attributes.js b/server/api/trigger/trigger.attributes.js index e1a5e72..f2b9cc9 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 _0x6143=['sequelize','exports','STRING'];(function(_0x5cd6e3,_0x24eb7c){var _0x147b07=function(_0x49f585){while(--_0x49f585){_0x5cd6e3['push'](_0x5cd6e3['shift']());}};_0x147b07(++_0x24eb7c);}(_0x6143,0x117));var _0x3614=function(_0x1a9c56,_0x1fd1c4){_0x1a9c56=_0x1a9c56-0x0;var _0x53d7a4=_0x6143[_0x1a9c56];return _0x53d7a4;};'use strict';var Sequelize=require(_0x3614('0x0'));module[_0x3614('0x1')]={'name':{'type':Sequelize[_0x3614('0x2')]},'channel':{'type':Sequelize[_0x3614('0x2')]},'description':{'type':Sequelize[_0x3614('0x2')]},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x1265=['STRING','sequelize','exports'];(function(_0x27bccc,_0x136645){var _0x376859=function(_0x5c357b){while(--_0x5c357b){_0x27bccc['push'](_0x27bccc['shift']());}};_0x376859(++_0x136645);}(_0x1265,0x14e));var _0x5126=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x1265[_0x2dafbe];return _0x58a45a;};'use strict';var Sequelize=require(_0x5126('0x0'));module[_0x5126('0x1')]={'name':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x5126('0x2')]},'description':{'type':Sequelize[_0x5126('0x2')]},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/trigger/trigger.controller.js b/server/api/trigger/trigger.controller.js index 41b612d..addbaab 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 _0x4841=['params','keys','includeAll','find','create','body','user','role','Triggers','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addAllCondition','TriggerAllId','Condition','addAnyCondition','getAllConditions','findOne','getAnyConditions','addAction','TriggerId','Action','getActions','eml-format','rimraf','fast-json-patch','moment','bluebird','util','path','to-csv','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','status','end','json','undefined','limit','offset','count','set','Content-Range','apply','reject','update','then','destroy','get','UserProfileResource','sendStatus','stack','name','map','Trigger','rawAttributes','fieldName','type','key','query','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show'];(function(_0xcb8fc6,_0x36987f){var _0x520ed5=function(_0x40ee37){while(--_0x40ee37){_0xcb8fc6['push'](_0xcb8fc6['shift']());}};_0x520ed5(++_0x36987f);}(_0x4841,0x130));var _0x1484=function(_0x4ae9e4,_0x22cc14){_0x4ae9e4=_0x4ae9e4-0x0;var _0x410375=_0x4841[_0x4ae9e4];return _0x410375;};'use strict';var emlformat=require(_0x1484('0x0'));var rimraf=require(_0x1484('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1484('0x2'));var rp=require('request-promise');var moment=require(_0x1484('0x3'));var BPromise=require(_0x1484('0x4'));var Mustache=require('mustache');var util=require(_0x1484('0x5'));var path=require(_0x1484('0x6'));var sox=require('sox');var csv=require(_0x1484('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x1484('0x8'));var crypto=require(_0x1484('0x9'));var jsforce=require(_0x1484('0xa'));var deskjs=require(_0x1484('0xb'));var toCsv=require('to-csv');var querystring=require(_0x1484('0xc'));var Papa=require(_0x1484('0xd'));var Redis=require(_0x1484('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x1484('0xf'));var hardwareService=require(_0x1484('0x10'));var logger=require(_0x1484('0x11'))(_0x1484('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x1484('0x13'));var db=require(_0x1484('0x14'))['db'];function respondWithStatusCode(_0x603a93,_0xbc8325){_0xbc8325=_0xbc8325||0xcc;return function(_0x1643c1){if(_0x1643c1){return _0x603a93['sendStatus'](_0xbc8325);}return _0x603a93[_0x1484('0x15')](_0xbc8325)[_0x1484('0x16')]();};}function respondWithResult(_0x5d5f04,_0x8c7a55){_0x8c7a55=_0x8c7a55||0xc8;return function(_0x114797){if(_0x114797){return _0x5d5f04[_0x1484('0x15')](_0x8c7a55)[_0x1484('0x17')](_0x114797);}};}function respondWithFilteredResult(_0x39d646,_0x5e4ad8){return function(_0x437ce2){if(_0x437ce2){var _0x5da9c5=typeof _0x5e4ad8['offset']===_0x1484('0x18')&&typeof _0x5e4ad8[_0x1484('0x19')]===_0x1484('0x18');var _0x7f7672=_0x437ce2['count'];var _0x16f102=_0x5da9c5?0x0:_0x5e4ad8[_0x1484('0x1a')];var _0x192403=_0x5da9c5?_0x437ce2[_0x1484('0x1b')]:_0x5e4ad8[_0x1484('0x1a')]+_0x5e4ad8['limit'];var _0x28f050;if(_0x192403>=_0x7f7672){_0x192403=_0x7f7672;_0x28f050=0xc8;}else{_0x28f050=0xce;}_0x39d646[_0x1484('0x15')](_0x28f050);return _0x39d646[_0x1484('0x1c')](_0x1484('0x1d'),_0x16f102+'-'+_0x192403+'/'+_0x7f7672)[_0x1484('0x17')](_0x437ce2);}return null;};}function patchUpdates(_0x149cc1){return function(_0xa2ae7f){try{jsonpatch[_0x1484('0x1e')](_0xa2ae7f,_0x149cc1,!![]);}catch(_0x513830){return BPromise[_0x1484('0x1f')](_0x513830);}return _0xa2ae7f['save']();};}function saveUpdates(_0x2f077b,_0x5e0156){return function(_0x634c69){if(_0x634c69){return _0x634c69[_0x1484('0x20')](_0x2f077b)[_0x1484('0x21')](function(_0x54fe27){return _0x54fe27;});}return null;};}function removeEntity(_0x206437,_0x5be36b){return function(_0x24d550){if(_0x24d550){return _0x24d550[_0x1484('0x22')]()[_0x1484('0x21')](function(){var _0x22883d=_0x24d550[_0x1484('0x23')]({'plain':!![]});var _0x24d80d='Triggers';return db[_0x1484('0x24')][_0x1484('0x22')]({'where':{'type':_0x24d80d,'resourceId':_0x22883d['id']}})[_0x1484('0x21')](function(){return _0x24d550;});})[_0x1484('0x21')](function(){_0x206437[_0x1484('0x15')](0xcc)[_0x1484('0x16')]();});}};}function handleEntityNotFound(_0x2d3bbe,_0x2e37d6){return function(_0x341524){if(!_0x341524){_0x2d3bbe[_0x1484('0x25')](0x194);}return _0x341524;};}function handleError(_0xed6467,_0x3adde4){_0x3adde4=_0x3adde4||0x1f4;return function(_0x5bc377){logger['error'](_0x5bc377[_0x1484('0x26')]);if(_0x5bc377[_0x1484('0x27')]){delete _0x5bc377['name'];}_0xed6467[_0x1484('0x15')](_0x3adde4)['send'](_0x5bc377);};}exports['index']=function(_0x46d08f,_0x56796f){var _0x4bbf7d={},_0xc8ddcb={},_0x3fd508={'count':0x0,'rows':[]};var _0x3f9fd7=_[_0x1484('0x28')](db[_0x1484('0x29')][_0x1484('0x2a')],function(_0x41b28e){return{'name':_0x41b28e[_0x1484('0x2b')],'type':_0x41b28e[_0x1484('0x2c')][_0x1484('0x2d')]};});_0xc8ddcb['model']=_['map'](_0x3f9fd7,_0x1484('0x27'));_0xc8ddcb[_0x1484('0x2e')]=_['keys'](_0x46d08f['query']);_0xc8ddcb['filters']=_[_0x1484('0x2f')](_0xc8ddcb[_0x1484('0x30')],_0xc8ddcb[_0x1484('0x2e')]);_0x4bbf7d[_0x1484('0x31')]=_['intersection'](_0xc8ddcb[_0x1484('0x30')],qs[_0x1484('0x32')](_0x46d08f[_0x1484('0x2e')][_0x1484('0x32')]));_0x4bbf7d[_0x1484('0x31')]=_0x4bbf7d[_0x1484('0x31')][_0x1484('0x33')]?_0x4bbf7d[_0x1484('0x31')]:_0xc8ddcb[_0x1484('0x30')];if(!_0x46d08f[_0x1484('0x2e')][_0x1484('0x34')](_0x1484('0x35'))){_0x4bbf7d[_0x1484('0x19')]=qs[_0x1484('0x19')](_0x46d08f['query'][_0x1484('0x19')]);_0x4bbf7d[_0x1484('0x1a')]=qs[_0x1484('0x1a')](_0x46d08f['query'][_0x1484('0x1a')]);}_0x4bbf7d[_0x1484('0x36')]=qs[_0x1484('0x37')](_0x46d08f['query'][_0x1484('0x37')]);_0x4bbf7d[_0x1484('0x38')]=qs[_0x1484('0x39')](_[_0x1484('0x3a')](_0x46d08f[_0x1484('0x2e')],_0xc8ddcb[_0x1484('0x39')]),_0x3f9fd7);if(_0x46d08f[_0x1484('0x2e')][_0x1484('0x3b')]){_0x4bbf7d[_0x1484('0x38')]=_[_0x1484('0x3c')](_0x4bbf7d[_0x1484('0x38')],{'$or':_[_0x1484('0x28')](_0x3f9fd7,function(_0x5b7292){if(_0x5b7292[_0x1484('0x2c')]!==_0x1484('0x3d')){var _0x28e87a={};_0x28e87a[_0x5b7292[_0x1484('0x27')]]={'$like':'%'+_0x46d08f['query'][_0x1484('0x3b')]+'%'};return _0x28e87a;}})});}_0x4bbf7d=_[_0x1484('0x3c')]({},_0x4bbf7d,_0x46d08f[_0x1484('0x3e')]);var _0x37a421={'where':_0x4bbf7d[_0x1484('0x38')]};return db[_0x1484('0x29')][_0x1484('0x1b')](_0x37a421)[_0x1484('0x21')](function(_0x55dc01){_0x3fd508[_0x1484('0x1b')]=_0x55dc01;if(_0x46d08f['query']['includeAll']){_0x4bbf7d[_0x1484('0x3f')]=[{'all':!![]}];}return db[_0x1484('0x29')][_0x1484('0x40')](_0x4bbf7d);})[_0x1484('0x21')](function(_0x17ec2b){_0x3fd508[_0x1484('0x41')]=_0x17ec2b;return _0x3fd508;})['then'](respondWithFilteredResult(_0x56796f,_0x4bbf7d))[_0x1484('0x42')](handleError(_0x56796f,null));};exports[_0x1484('0x43')]=function(_0x5bad45,_0x5cffca){var _0x291a36={'raw':![],'where':{'id':_0x5bad45[_0x1484('0x44')]['id']}},_0xdbdeb4={};_0xdbdeb4[_0x1484('0x30')]=_[_0x1484('0x45')](db[_0x1484('0x29')]['rawAttributes']);_0xdbdeb4[_0x1484('0x2e')]=_[_0x1484('0x45')](_0x5bad45['query']);_0xdbdeb4['filters']=_['intersection'](_0xdbdeb4['model'],_0xdbdeb4[_0x1484('0x2e')]);_0x291a36[_0x1484('0x31')]=_[_0x1484('0x2f')](_0xdbdeb4[_0x1484('0x30')],qs[_0x1484('0x32')](_0x5bad45[_0x1484('0x2e')][_0x1484('0x32')]));_0x291a36[_0x1484('0x31')]=_0x291a36[_0x1484('0x31')][_0x1484('0x33')]?_0x291a36[_0x1484('0x31')]:_0xdbdeb4['model'];if(_0x5bad45['query'][_0x1484('0x46')]){_0x291a36[_0x1484('0x3f')]=[{'all':!![]}];}_0x291a36=_[_0x1484('0x3c')]({},_0x291a36,_0x5bad45[_0x1484('0x3e')]);return db[_0x1484('0x29')][_0x1484('0x47')](_0x291a36)[_0x1484('0x21')](handleEntityNotFound(_0x5cffca,null))[_0x1484('0x21')](respondWithResult(_0x5cffca,null))[_0x1484('0x42')](handleError(_0x5cffca,null));};exports[_0x1484('0x48')]=function(_0x374734,_0x340c3e){return db[_0x1484('0x29')][_0x1484('0x48')](_0x374734[_0x1484('0x49')],{})['then'](function(_0x4206c3){var _0x3205f1=_0x374734[_0x1484('0x4a')][_0x1484('0x23')]({'plain':!![]});if(!_0x3205f1)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3205f1[_0x1484('0x4b')]===_0x1484('0x4a')){var _0x547823=_0x4206c3[_0x1484('0x23')]({'plain':!![]});var _0x49b477=_0x1484('0x4c');return db[_0x1484('0x4d')][_0x1484('0x47')]({'where':{'name':_0x49b477,'userProfileId':_0x3205f1[_0x1484('0x4e')]},'raw':!![]})[_0x1484('0x21')](function(_0x291d0a){if(_0x291d0a&&_0x291d0a[_0x1484('0x4f')]===0x0){return db[_0x1484('0x24')][_0x1484('0x48')]({'name':_0x547823[_0x1484('0x27')],'resourceId':_0x547823['id'],'type':_0x291d0a['name'],'sectionId':_0x291d0a['id']},{})[_0x1484('0x21')](function(){return _0x4206c3;});}else{return _0x4206c3;}})[_0x1484('0x42')](function(_0x4a759e){logger[_0x1484('0x50')](_0x1484('0x51'),_0x4a759e);throw _0x4a759e;});}return _0x4206c3;})['then'](respondWithResult(_0x340c3e,0xc9))['catch'](handleError(_0x340c3e,null));};exports[_0x1484('0x20')]=function(_0x49f71c,_0x3dd22c){if(_0x49f71c[_0x1484('0x49')]['id']){delete _0x49f71c[_0x1484('0x49')]['id'];}return db[_0x1484('0x29')][_0x1484('0x47')]({'where':{'id':_0x49f71c[_0x1484('0x44')]['id']}})['then'](handleEntityNotFound(_0x3dd22c,null))['then'](saveUpdates(_0x49f71c[_0x1484('0x49')],null))['then'](respondWithResult(_0x3dd22c,null))[_0x1484('0x42')](handleError(_0x3dd22c,null));};exports['destroy']=function(_0x149c20,_0x343718){return db[_0x1484('0x29')]['find']({'where':{'id':_0x149c20['params']['id']}})[_0x1484('0x21')](handleEntityNotFound(_0x343718,null))[_0x1484('0x21')](removeEntity(_0x343718,null))[_0x1484('0x42')](handleError(_0x343718,null));};exports[_0x1484('0x52')]=function(_0xd10b06,_0x1e180b,_0x4436a8){if(_0xd10b06[_0x1484('0x49')]['id']){delete _0xd10b06[_0x1484('0x49')]['id'];}return db[_0x1484('0x29')]['find']({'where':{'id':_0xd10b06[_0x1484('0x44')]['id']}})['then'](handleEntityNotFound(_0x1e180b,null))[_0x1484('0x21')](function(_0x36d8ec){if(_0x36d8ec){_0xd10b06[_0x1484('0x49')][_0x1484('0x53')]=_0x36d8ec['id'];return db[_0x1484('0x54')][_0x1484('0x48')](_0xd10b06[_0x1484('0x49')]);}})[_0x1484('0x21')](respondWithResult(_0x1e180b,null))['catch'](handleError(_0x1e180b,null));};exports[_0x1484('0x55')]=function(_0x2accab,_0x5838ee,_0x27332f){if(_0x2accab['body']['id']){delete _0x2accab[_0x1484('0x49')]['id'];}return db['Trigger']['find']({'where':{'id':_0x2accab[_0x1484('0x44')]['id']}})[_0x1484('0x21')](handleEntityNotFound(_0x5838ee,null))['then'](function(_0x5af0c2){if(_0x5af0c2){_0x2accab[_0x1484('0x49')]['TriggerAnyId']=_0x5af0c2['id'];return db[_0x1484('0x54')][_0x1484('0x48')](_0x2accab[_0x1484('0x49')]);}})[_0x1484('0x21')](respondWithResult(_0x5838ee,null))[_0x1484('0x42')](handleError(_0x5838ee,null));};exports[_0x1484('0x56')]=function(_0x3504be,_0x5863e7,_0x54a593){var _0x4d61c1={};var _0x28558c={};var _0x57a099;var _0x4cb255;return db[_0x1484('0x29')][_0x1484('0x57')]({'where':{'id':_0x3504be['params']['id']}})[_0x1484('0x21')](handleEntityNotFound(_0x5863e7,null))[_0x1484('0x21')](function(_0x373afc){if(_0x373afc){_0x57a099=_0x373afc;_0x28558c[_0x1484('0x30')]=_[_0x1484('0x45')](db[_0x1484('0x54')]['rawAttributes']);_0x28558c['query']=_[_0x1484('0x45')](_0x3504be[_0x1484('0x2e')]);_0x28558c[_0x1484('0x39')]=_[_0x1484('0x2f')](_0x28558c[_0x1484('0x30')],_0x28558c[_0x1484('0x2e')]);_0x4d61c1[_0x1484('0x31')]=_['intersection'](_0x28558c[_0x1484('0x30')],qs[_0x1484('0x32')](_0x3504be[_0x1484('0x2e')][_0x1484('0x32')]));_0x4d61c1[_0x1484('0x31')]=_0x4d61c1['attributes']['length']?_0x4d61c1[_0x1484('0x31')]:_0x28558c[_0x1484('0x30')];_0x4d61c1[_0x1484('0x36')]=qs[_0x1484('0x37')](_0x3504be[_0x1484('0x2e')]['sort']);_0x4d61c1['where']=qs[_0x1484('0x39')](_[_0x1484('0x3a')](_0x3504be['query'],_0x28558c[_0x1484('0x39')]));if(_0x3504be[_0x1484('0x2e')][_0x1484('0x3b')]){_0x4d61c1['where']=_[_0x1484('0x3c')](_0x4d61c1['where'],{'$or':_[_0x1484('0x28')](_0x4d61c1[_0x1484('0x31')],function(_0x5efa44){var _0x7795d2={};_0x7795d2[_0x5efa44]={'$like':'%'+_0x3504be[_0x1484('0x2e')][_0x1484('0x3b')]+'%'};return _0x7795d2;})});}_0x4d61c1=_[_0x1484('0x3c')]({},_0x4d61c1,_0x3504be['options']);return _0x57a099[_0x1484('0x56')](_0x4d61c1);}})[_0x1484('0x21')](function(_0x5c8cd5){if(_0x5c8cd5){_0x4cb255=_0x5c8cd5[_0x1484('0x33')];if(!_0x3504be[_0x1484('0x2e')][_0x1484('0x34')](_0x1484('0x35'))){_0x4d61c1[_0x1484('0x19')]=qs[_0x1484('0x19')](_0x3504be[_0x1484('0x2e')]['limit']);_0x4d61c1[_0x1484('0x1a')]=qs[_0x1484('0x1a')](_0x3504be['query'][_0x1484('0x1a')]);}return _0x57a099['getAllConditions'](_0x4d61c1);}})['then'](function(_0x5769cf){if(_0x5769cf){return _0x5769cf?{'count':_0x4cb255,'rows':_0x5769cf}:null;}})[_0x1484('0x21')](respondWithResult(_0x5863e7,null))[_0x1484('0x42')](handleError(_0x5863e7,null));};exports[_0x1484('0x58')]=function(_0x55a10a,_0x595650,_0x45ce9e){var _0x1f4089={};var _0x13ece8={};var _0x2af2f8;var _0x25ad93;return db[_0x1484('0x29')][_0x1484('0x57')]({'where':{'id':_0x55a10a['params']['id']}})[_0x1484('0x21')](handleEntityNotFound(_0x595650,null))[_0x1484('0x21')](function(_0x5ae32f){if(_0x5ae32f){_0x2af2f8=_0x5ae32f;_0x13ece8[_0x1484('0x30')]=_[_0x1484('0x45')](db[_0x1484('0x54')][_0x1484('0x2a')]);_0x13ece8['query']=_[_0x1484('0x45')](_0x55a10a[_0x1484('0x2e')]);_0x13ece8[_0x1484('0x39')]=_[_0x1484('0x2f')](_0x13ece8[_0x1484('0x30')],_0x13ece8[_0x1484('0x2e')]);_0x1f4089[_0x1484('0x31')]=_['intersection'](_0x13ece8['model'],qs[_0x1484('0x32')](_0x55a10a[_0x1484('0x2e')][_0x1484('0x32')]));_0x1f4089[_0x1484('0x31')]=_0x1f4089['attributes'][_0x1484('0x33')]?_0x1f4089[_0x1484('0x31')]:_0x13ece8[_0x1484('0x30')];_0x1f4089[_0x1484('0x36')]=qs['sort'](_0x55a10a[_0x1484('0x2e')][_0x1484('0x37')]);_0x1f4089[_0x1484('0x38')]=qs[_0x1484('0x39')](_[_0x1484('0x3a')](_0x55a10a[_0x1484('0x2e')],_0x13ece8[_0x1484('0x39')]));if(_0x55a10a[_0x1484('0x2e')]['filter']){_0x1f4089[_0x1484('0x38')]=_[_0x1484('0x3c')](_0x1f4089[_0x1484('0x38')],{'$or':_['map'](_0x1f4089[_0x1484('0x31')],function(_0x254f7c){var _0x153c71={};_0x153c71[_0x254f7c]={'$like':'%'+_0x55a10a[_0x1484('0x2e')][_0x1484('0x3b')]+'%'};return _0x153c71;})});}_0x1f4089=_[_0x1484('0x3c')]({},_0x1f4089,_0x55a10a['options']);return _0x2af2f8['getAnyConditions'](_0x1f4089);}})[_0x1484('0x21')](function(_0x31efcd){if(_0x31efcd){_0x25ad93=_0x31efcd[_0x1484('0x33')];if(!_0x55a10a[_0x1484('0x2e')]['hasOwnProperty'](_0x1484('0x35'))){_0x1f4089[_0x1484('0x19')]=qs['limit'](_0x55a10a['query'][_0x1484('0x19')]);_0x1f4089[_0x1484('0x1a')]=qs[_0x1484('0x1a')](_0x55a10a[_0x1484('0x2e')][_0x1484('0x1a')]);}return _0x2af2f8[_0x1484('0x58')](_0x1f4089);}})[_0x1484('0x21')](function(_0x2cd8cf){if(_0x2cd8cf){return _0x2cd8cf?{'count':_0x25ad93,'rows':_0x2cd8cf}:null;}})[_0x1484('0x21')](respondWithResult(_0x595650,null))[_0x1484('0x42')](handleError(_0x595650,null));};exports[_0x1484('0x59')]=function(_0x2e4e81,_0x5f3472,_0x718ab2){if(_0x2e4e81['body']['id']){delete _0x2e4e81[_0x1484('0x49')]['id'];}return db[_0x1484('0x29')][_0x1484('0x47')]({'where':{'id':_0x2e4e81['params']['id']}})[_0x1484('0x21')](handleEntityNotFound(_0x5f3472,null))['then'](function(_0x5c2177){if(_0x5c2177){_0x2e4e81[_0x1484('0x49')][_0x1484('0x5a')]=_0x5c2177['id'];return db[_0x1484('0x5b')][_0x1484('0x48')](_0x2e4e81[_0x1484('0x49')]);}})[_0x1484('0x21')](respondWithResult(_0x5f3472,null))['catch'](handleError(_0x5f3472,null));};exports[_0x1484('0x5c')]=function(_0x52591c,_0x21a547,_0x49128f){var _0x38d639={};var _0x4356ea={};var _0x294c6d;var _0x283f5b;return db[_0x1484('0x29')]['findOne']({'where':{'id':_0x52591c['params']['id']}})[_0x1484('0x21')](handleEntityNotFound(_0x21a547,null))['then'](function(_0x4621a9){if(_0x4621a9){_0x294c6d=_0x4621a9;_0x4356ea[_0x1484('0x30')]=_[_0x1484('0x45')](db[_0x1484('0x5b')]['rawAttributes']);_0x4356ea[_0x1484('0x2e')]=_[_0x1484('0x45')](_0x52591c[_0x1484('0x2e')]);_0x4356ea[_0x1484('0x39')]=_[_0x1484('0x2f')](_0x4356ea[_0x1484('0x30')],_0x4356ea['query']);_0x38d639[_0x1484('0x31')]=_[_0x1484('0x2f')](_0x4356ea[_0x1484('0x30')],qs[_0x1484('0x32')](_0x52591c[_0x1484('0x2e')][_0x1484('0x32')]));_0x38d639[_0x1484('0x31')]=_0x38d639[_0x1484('0x31')][_0x1484('0x33')]?_0x38d639[_0x1484('0x31')]:_0x4356ea['model'];_0x38d639[_0x1484('0x36')]=qs['sort'](_0x52591c[_0x1484('0x2e')][_0x1484('0x37')]);_0x38d639['where']=qs[_0x1484('0x39')](_['pick'](_0x52591c['query'],_0x4356ea[_0x1484('0x39')]));if(_0x52591c['query']['filter']){_0x38d639[_0x1484('0x38')]=_[_0x1484('0x3c')](_0x38d639[_0x1484('0x38')],{'$or':_['map'](_0x38d639[_0x1484('0x31')],function(_0x1da3c5){var _0x77c69c={};_0x77c69c[_0x1da3c5]={'$like':'%'+_0x52591c[_0x1484('0x2e')][_0x1484('0x3b')]+'%'};return _0x77c69c;})});}_0x38d639=_[_0x1484('0x3c')]({},_0x38d639,_0x52591c[_0x1484('0x3e')]);return _0x294c6d['getActions'](_0x38d639);}})[_0x1484('0x21')](function(_0xaf616b){if(_0xaf616b){_0x283f5b=_0xaf616b[_0x1484('0x33')];if(!_0x52591c['query'][_0x1484('0x34')](_0x1484('0x35'))){_0x38d639[_0x1484('0x19')]=qs['limit'](_0x52591c[_0x1484('0x2e')]['limit']);_0x38d639[_0x1484('0x1a')]=qs[_0x1484('0x1a')](_0x52591c[_0x1484('0x2e')][_0x1484('0x1a')]);}return _0x294c6d[_0x1484('0x5c')](_0x38d639);}})['then'](function(_0x50ac96){if(_0x50ac96){return _0x50ac96?{'count':_0x283f5b,'rows':_0x50ac96}:null;}})[_0x1484('0x21')](respondWithResult(_0x21a547,null))[_0x1484('0x42')](handleError(_0x21a547,null));}; \ No newline at end of file +var _0x312b=['offset','undefined','count','Content-Range','apply','reject','save','update','then','destroy','get','UserProfileResource','sendStatus','name','send','map','Trigger','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filter','VIRTUAL','merge','options','includeAll','findAll','rows','rawAttributes','include','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Triggers','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','addAllCondition','TriggerAnyId','Condition','getAllConditions','findOne','getAnyConditions','pick','addAction','TriggerId','Action','getActions','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json'];(function(_0x5f41a0,_0x209539){var _0x3df2c2=function(_0x2ad6fe){while(--_0x2ad6fe){_0x5f41a0['push'](_0x5f41a0['shift']());}};_0x3df2c2(++_0x209539);}(_0x312b,0x1bb));var _0xb312=function(_0x350cf4,_0x7dd1a6){_0x350cf4=_0x350cf4-0x0;var _0x4bcef4=_0x312b[_0x350cf4];return _0x4bcef4;};'use strict';var emlformat=require(_0xb312('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb312('0x1'));var jsonpatch=require(_0xb312('0x2'));var rp=require(_0xb312('0x3'));var moment=require(_0xb312('0x4'));var BPromise=require(_0xb312('0x5'));var Mustache=require('mustache');var util=require(_0xb312('0x6'));var path=require(_0xb312('0x7'));var sox=require('sox');var csv=require(_0xb312('0x8'));var ejs=require(_0xb312('0x9'));var fs=require('fs');var fs_extra=require(_0xb312('0xa'));var _=require(_0xb312('0xb'));var squel=require(_0xb312('0xc'));var crypto=require(_0xb312('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xb312('0xe'));var toCsv=require(_0xb312('0x8'));var querystring=require(_0xb312('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xb312('0x10'));var qs=require(_0xb312('0x11'));var as=require(_0xb312('0x12'));var hardwareService=require(_0xb312('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0xb312('0x14'));var config=require(_0xb312('0x15'));var licenseUtil=require(_0xb312('0x16'));var db=require(_0xb312('0x17'))['db'];function respondWithStatusCode(_0x2567e4,_0x3d1985){_0x3d1985=_0x3d1985||0xcc;return function(_0x138db2){if(_0x138db2){return _0x2567e4['sendStatus'](_0x3d1985);}return _0x2567e4[_0xb312('0x18')](_0x3d1985)[_0xb312('0x19')]();};}function respondWithResult(_0x31a8a2,_0x1210dc){_0x1210dc=_0x1210dc||0xc8;return function(_0x885652){if(_0x885652){return _0x31a8a2[_0xb312('0x18')](_0x1210dc)[_0xb312('0x1a')](_0x885652);}};}function respondWithFilteredResult(_0x514ff7,_0x52f5a9){return function(_0x59d5ac){if(_0x59d5ac){var _0x46c770=typeof _0x52f5a9[_0xb312('0x1b')]==='undefined'&&typeof _0x52f5a9['limit']===_0xb312('0x1c');var _0x4d7735=_0x59d5ac['count'];var _0x20c0b4=_0x46c770?0x0:_0x52f5a9[_0xb312('0x1b')];var _0x26b75e=_0x46c770?_0x59d5ac[_0xb312('0x1d')]:_0x52f5a9[_0xb312('0x1b')]+_0x52f5a9['limit'];var _0x337da3;if(_0x26b75e>=_0x4d7735){_0x26b75e=_0x4d7735;_0x337da3=0xc8;}else{_0x337da3=0xce;}_0x514ff7[_0xb312('0x18')](_0x337da3);return _0x514ff7['set'](_0xb312('0x1e'),_0x20c0b4+'-'+_0x26b75e+'/'+_0x4d7735)[_0xb312('0x1a')](_0x59d5ac);}return null;};}function patchUpdates(_0x154b86){return function(_0xe0255){try{jsonpatch[_0xb312('0x1f')](_0xe0255,_0x154b86,!![]);}catch(_0x4e1350){return BPromise[_0xb312('0x20')](_0x4e1350);}return _0xe0255[_0xb312('0x21')]();};}function saveUpdates(_0x294c45,_0x409b31){return function(_0x3a2b6f){if(_0x3a2b6f){return _0x3a2b6f[_0xb312('0x22')](_0x294c45)[_0xb312('0x23')](function(_0x2bc757){return _0x2bc757;});}return null;};}function removeEntity(_0x46ac12,_0x51d2ce){return function(_0xdba628){if(_0xdba628){return _0xdba628[_0xb312('0x24')]()['then'](function(){var _0x48a07f=_0xdba628[_0xb312('0x25')]({'plain':!![]});var _0x4a3446='Triggers';return db[_0xb312('0x26')][_0xb312('0x24')]({'where':{'type':_0x4a3446,'resourceId':_0x48a07f['id']}})[_0xb312('0x23')](function(){return _0xdba628;});})[_0xb312('0x23')](function(){_0x46ac12[_0xb312('0x18')](0xcc)[_0xb312('0x19')]();});}};}function handleEntityNotFound(_0x4288a9,_0x1a2f38){return function(_0x22ed1a){if(!_0x22ed1a){_0x4288a9[_0xb312('0x27')](0x194);}return _0x22ed1a;};}function handleError(_0x226ba5,_0x23d2ab){_0x23d2ab=_0x23d2ab||0x1f4;return function(_0x27fee0){logger['error'](_0x27fee0['stack']);if(_0x27fee0[_0xb312('0x28')]){delete _0x27fee0[_0xb312('0x28')];}_0x226ba5[_0xb312('0x18')](_0x23d2ab)[_0xb312('0x29')](_0x27fee0);};}exports['index']=function(_0x206ea2,_0x2804f4){var _0x501fb4={},_0x5e1949={},_0x5a9ca0={'count':0x0,'rows':[]};var _0x4fbeda=_[_0xb312('0x2a')](db[_0xb312('0x2b')]['rawAttributes'],function(_0xcb920a){return{'name':_0xcb920a[_0xb312('0x2c')],'type':_0xcb920a[_0xb312('0x2d')][_0xb312('0x2e')]};});_0x5e1949[_0xb312('0x2f')]=_[_0xb312('0x2a')](_0x4fbeda,_0xb312('0x28'));_0x5e1949[_0xb312('0x30')]=_[_0xb312('0x31')](_0x206ea2[_0xb312('0x30')]);_0x5e1949[_0xb312('0x32')]=_[_0xb312('0x33')](_0x5e1949[_0xb312('0x2f')],_0x5e1949[_0xb312('0x30')]);_0x501fb4[_0xb312('0x34')]=_['intersection'](_0x5e1949[_0xb312('0x2f')],qs[_0xb312('0x35')](_0x206ea2[_0xb312('0x30')][_0xb312('0x35')]));_0x501fb4[_0xb312('0x34')]=_0x501fb4[_0xb312('0x34')][_0xb312('0x36')]?_0x501fb4['attributes']:_0x5e1949[_0xb312('0x2f')];if(!_0x206ea2['query'][_0xb312('0x37')](_0xb312('0x38'))){_0x501fb4['limit']=qs[_0xb312('0x39')](_0x206ea2[_0xb312('0x30')]['limit']);_0x501fb4[_0xb312('0x1b')]=qs[_0xb312('0x1b')](_0x206ea2[_0xb312('0x30')][_0xb312('0x1b')]);}_0x501fb4[_0xb312('0x3a')]=qs['sort'](_0x206ea2[_0xb312('0x30')][_0xb312('0x3b')]);_0x501fb4[_0xb312('0x3c')]=qs[_0xb312('0x32')](_['pick'](_0x206ea2['query'],_0x5e1949[_0xb312('0x32')]),_0x4fbeda);if(_0x206ea2['query'][_0xb312('0x3d')]){_0x501fb4[_0xb312('0x3c')]=_['merge'](_0x501fb4['where'],{'$or':_[_0xb312('0x2a')](_0x4fbeda,function(_0x4f3c86){if(_0x4f3c86[_0xb312('0x2d')]!==_0xb312('0x3e')){var _0x4f1012={};_0x4f1012[_0x4f3c86[_0xb312('0x28')]]={'$like':'%'+_0x206ea2[_0xb312('0x30')][_0xb312('0x3d')]+'%'};return _0x4f1012;}})});}_0x501fb4=_[_0xb312('0x3f')]({},_0x501fb4,_0x206ea2[_0xb312('0x40')]);var _0xe3df40={'where':_0x501fb4[_0xb312('0x3c')]};return db[_0xb312('0x2b')][_0xb312('0x1d')](_0xe3df40)['then'](function(_0x3e0f89){_0x5a9ca0[_0xb312('0x1d')]=_0x3e0f89;if(_0x206ea2[_0xb312('0x30')][_0xb312('0x41')]){_0x501fb4['include']=[{'all':!![]}];}return db[_0xb312('0x2b')][_0xb312('0x42')](_0x501fb4);})[_0xb312('0x23')](function(_0x598be4){_0x5a9ca0[_0xb312('0x43')]=_0x598be4;return _0x5a9ca0;})[_0xb312('0x23')](respondWithFilteredResult(_0x2804f4,_0x501fb4))['catch'](handleError(_0x2804f4,null));};exports['show']=function(_0x48fa6b,_0x25de86){var _0xb406a7={'raw':![],'where':{'id':_0x48fa6b['params']['id']}},_0x484d06={};_0x484d06[_0xb312('0x2f')]=_[_0xb312('0x31')](db['Trigger'][_0xb312('0x44')]);_0x484d06['query']=_[_0xb312('0x31')](_0x48fa6b['query']);_0x484d06[_0xb312('0x32')]=_[_0xb312('0x33')](_0x484d06[_0xb312('0x2f')],_0x484d06[_0xb312('0x30')]);_0xb406a7['attributes']=_[_0xb312('0x33')](_0x484d06[_0xb312('0x2f')],qs[_0xb312('0x35')](_0x48fa6b['query'][_0xb312('0x35')]));_0xb406a7['attributes']=_0xb406a7['attributes']['length']?_0xb406a7['attributes']:_0x484d06[_0xb312('0x2f')];if(_0x48fa6b[_0xb312('0x30')][_0xb312('0x41')]){_0xb406a7[_0xb312('0x45')]=[{'all':!![]}];}_0xb406a7=_[_0xb312('0x3f')]({},_0xb406a7,_0x48fa6b[_0xb312('0x40')]);return db[_0xb312('0x2b')][_0xb312('0x46')](_0xb406a7)[_0xb312('0x23')](handleEntityNotFound(_0x25de86,null))[_0xb312('0x23')](respondWithResult(_0x25de86,null))[_0xb312('0x47')](handleError(_0x25de86,null));};exports[_0xb312('0x48')]=function(_0x226f7b,_0xbe8035){return db[_0xb312('0x2b')]['create'](_0x226f7b[_0xb312('0x49')],{})[_0xb312('0x23')](function(_0x25969b){var _0x32a05b=_0x226f7b[_0xb312('0x4a')]['get']({'plain':!![]});if(!_0x32a05b)throw new Error(_0xb312('0x4b'));if(_0x32a05b[_0xb312('0x4c')]===_0xb312('0x4a')){var _0xec574b=_0x25969b[_0xb312('0x25')]({'plain':!![]});var _0x35f04b=_0xb312('0x4d');return db[_0xb312('0x4e')][_0xb312('0x46')]({'where':{'name':_0x35f04b,'userProfileId':_0x32a05b['userProfileId']},'raw':!![]})[_0xb312('0x23')](function(_0x3bd6b0){if(_0x3bd6b0&&_0x3bd6b0[_0xb312('0x4f')]===0x0){return db[_0xb312('0x26')]['create']({'name':_0xec574b[_0xb312('0x28')],'resourceId':_0xec574b['id'],'type':_0x3bd6b0[_0xb312('0x28')],'sectionId':_0x3bd6b0['id']},{})['then'](function(){return _0x25969b;});}else{return _0x25969b;}})[_0xb312('0x47')](function(_0x418be5){logger[_0xb312('0x50')](_0xb312('0x51'),_0x418be5);throw _0x418be5;});}return _0x25969b;})[_0xb312('0x23')](respondWithResult(_0xbe8035,0xc9))[_0xb312('0x47')](handleError(_0xbe8035,null));};exports['update']=function(_0x38f960,_0x496641){if(_0x38f960[_0xb312('0x49')]['id']){delete _0x38f960['body']['id'];}return db['Trigger'][_0xb312('0x46')]({'where':{'id':_0x38f960['params']['id']}})[_0xb312('0x23')](handleEntityNotFound(_0x496641,null))[_0xb312('0x23')](saveUpdates(_0x38f960[_0xb312('0x49')],null))['then'](respondWithResult(_0x496641,null))['catch'](handleError(_0x496641,null));};exports[_0xb312('0x24')]=function(_0x1fae6a,_0x370582){return db[_0xb312('0x2b')][_0xb312('0x46')]({'where':{'id':_0x1fae6a[_0xb312('0x52')]['id']}})[_0xb312('0x23')](handleEntityNotFound(_0x370582,null))['then'](removeEntity(_0x370582,null))[_0xb312('0x47')](handleError(_0x370582,null));};exports[_0xb312('0x53')]=function(_0x3f8b28,_0x1772e1,_0x3dc2f1){if(_0x3f8b28['body']['id']){delete _0x3f8b28[_0xb312('0x49')]['id'];}return db[_0xb312('0x2b')][_0xb312('0x46')]({'where':{'id':_0x3f8b28['params']['id']}})[_0xb312('0x23')](handleEntityNotFound(_0x1772e1,null))[_0xb312('0x23')](function(_0x53c049){if(_0x53c049){_0x3f8b28[_0xb312('0x49')]['TriggerAllId']=_0x53c049['id'];return db['Condition']['create'](_0x3f8b28[_0xb312('0x49')]);}})['then'](respondWithResult(_0x1772e1,null))[_0xb312('0x47')](handleError(_0x1772e1,null));};exports['addAnyCondition']=function(_0x31e8f4,_0x53ce1a,_0x500cc5){if(_0x31e8f4[_0xb312('0x49')]['id']){delete _0x31e8f4[_0xb312('0x49')]['id'];}return db[_0xb312('0x2b')][_0xb312('0x46')]({'where':{'id':_0x31e8f4[_0xb312('0x52')]['id']}})[_0xb312('0x23')](handleEntityNotFound(_0x53ce1a,null))[_0xb312('0x23')](function(_0x1cc88d){if(_0x1cc88d){_0x31e8f4[_0xb312('0x49')][_0xb312('0x54')]=_0x1cc88d['id'];return db[_0xb312('0x55')]['create'](_0x31e8f4[_0xb312('0x49')]);}})[_0xb312('0x23')](respondWithResult(_0x53ce1a,null))[_0xb312('0x47')](handleError(_0x53ce1a,null));};exports[_0xb312('0x56')]=function(_0x18ef57,_0x106abd,_0x221740){var _0x57d342={};var _0x3cee0e={};var _0x58ece2;var _0x15a392;return db[_0xb312('0x2b')][_0xb312('0x57')]({'where':{'id':_0x18ef57['params']['id']}})[_0xb312('0x23')](handleEntityNotFound(_0x106abd,null))[_0xb312('0x23')](function(_0x4fa39c){if(_0x4fa39c){_0x58ece2=_0x4fa39c;_0x3cee0e['model']=_[_0xb312('0x31')](db[_0xb312('0x55')][_0xb312('0x44')]);_0x3cee0e['query']=_['keys'](_0x18ef57['query']);_0x3cee0e['filters']=_[_0xb312('0x33')](_0x3cee0e[_0xb312('0x2f')],_0x3cee0e[_0xb312('0x30')]);_0x57d342[_0xb312('0x34')]=_['intersection'](_0x3cee0e[_0xb312('0x2f')],qs[_0xb312('0x35')](_0x18ef57[_0xb312('0x30')][_0xb312('0x35')]));_0x57d342[_0xb312('0x34')]=_0x57d342[_0xb312('0x34')][_0xb312('0x36')]?_0x57d342[_0xb312('0x34')]:_0x3cee0e[_0xb312('0x2f')];_0x57d342['order']=qs['sort'](_0x18ef57[_0xb312('0x30')][_0xb312('0x3b')]);_0x57d342[_0xb312('0x3c')]=qs['filters'](_['pick'](_0x18ef57[_0xb312('0x30')],_0x3cee0e['filters']));if(_0x18ef57[_0xb312('0x30')][_0xb312('0x3d')]){_0x57d342[_0xb312('0x3c')]=_[_0xb312('0x3f')](_0x57d342[_0xb312('0x3c')],{'$or':_[_0xb312('0x2a')](_0x57d342[_0xb312('0x34')],function(_0x4c67f5){var _0x25bad6={};_0x25bad6[_0x4c67f5]={'$like':'%'+_0x18ef57[_0xb312('0x30')][_0xb312('0x3d')]+'%'};return _0x25bad6;})});}_0x57d342=_[_0xb312('0x3f')]({},_0x57d342,_0x18ef57[_0xb312('0x40')]);return _0x58ece2[_0xb312('0x56')](_0x57d342);}})[_0xb312('0x23')](function(_0x4e6c66){if(_0x4e6c66){_0x15a392=_0x4e6c66[_0xb312('0x36')];if(!_0x18ef57[_0xb312('0x30')]['hasOwnProperty'](_0xb312('0x38'))){_0x57d342[_0xb312('0x39')]=qs['limit'](_0x18ef57[_0xb312('0x30')][_0xb312('0x39')]);_0x57d342['offset']=qs[_0xb312('0x1b')](_0x18ef57[_0xb312('0x30')][_0xb312('0x1b')]);}return _0x58ece2[_0xb312('0x56')](_0x57d342);}})[_0xb312('0x23')](function(_0x5695fb){if(_0x5695fb){return _0x5695fb?{'count':_0x15a392,'rows':_0x5695fb}:null;}})[_0xb312('0x23')](respondWithResult(_0x106abd,null))[_0xb312('0x47')](handleError(_0x106abd,null));};exports[_0xb312('0x58')]=function(_0x50cf28,_0x2d7095,_0x4e479f){var _0x116584={};var _0x258fad={};var _0x3e087b;var _0x80f19c;return db[_0xb312('0x2b')][_0xb312('0x57')]({'where':{'id':_0x50cf28[_0xb312('0x52')]['id']}})[_0xb312('0x23')](handleEntityNotFound(_0x2d7095,null))['then'](function(_0x591944){if(_0x591944){_0x3e087b=_0x591944;_0x258fad[_0xb312('0x2f')]=_[_0xb312('0x31')](db[_0xb312('0x55')][_0xb312('0x44')]);_0x258fad[_0xb312('0x30')]=_[_0xb312('0x31')](_0x50cf28[_0xb312('0x30')]);_0x258fad[_0xb312('0x32')]=_[_0xb312('0x33')](_0x258fad[_0xb312('0x2f')],_0x258fad[_0xb312('0x30')]);_0x116584['attributes']=_['intersection'](_0x258fad['model'],qs[_0xb312('0x35')](_0x50cf28[_0xb312('0x30')][_0xb312('0x35')]));_0x116584[_0xb312('0x34')]=_0x116584[_0xb312('0x34')][_0xb312('0x36')]?_0x116584['attributes']:_0x258fad['model'];_0x116584[_0xb312('0x3a')]=qs['sort'](_0x50cf28[_0xb312('0x30')][_0xb312('0x3b')]);_0x116584[_0xb312('0x3c')]=qs['filters'](_[_0xb312('0x59')](_0x50cf28[_0xb312('0x30')],_0x258fad[_0xb312('0x32')]));if(_0x50cf28[_0xb312('0x30')]['filter']){_0x116584[_0xb312('0x3c')]=_[_0xb312('0x3f')](_0x116584[_0xb312('0x3c')],{'$or':_[_0xb312('0x2a')](_0x116584[_0xb312('0x34')],function(_0x4460d4){var _0x8ca996={};_0x8ca996[_0x4460d4]={'$like':'%'+_0x50cf28['query'][_0xb312('0x3d')]+'%'};return _0x8ca996;})});}_0x116584=_[_0xb312('0x3f')]({},_0x116584,_0x50cf28[_0xb312('0x40')]);return _0x3e087b[_0xb312('0x58')](_0x116584);}})['then'](function(_0x2c2be1){if(_0x2c2be1){_0x80f19c=_0x2c2be1[_0xb312('0x36')];if(!_0x50cf28['query'][_0xb312('0x37')]('nolimit')){_0x116584[_0xb312('0x39')]=qs[_0xb312('0x39')](_0x50cf28[_0xb312('0x30')][_0xb312('0x39')]);_0x116584[_0xb312('0x1b')]=qs[_0xb312('0x1b')](_0x50cf28[_0xb312('0x30')]['offset']);}return _0x3e087b[_0xb312('0x58')](_0x116584);}})[_0xb312('0x23')](function(_0x34beb7){if(_0x34beb7){return _0x34beb7?{'count':_0x80f19c,'rows':_0x34beb7}:null;}})[_0xb312('0x23')](respondWithResult(_0x2d7095,null))[_0xb312('0x47')](handleError(_0x2d7095,null));};exports[_0xb312('0x5a')]=function(_0x323bf4,_0x2eb235,_0x3887cb){if(_0x323bf4[_0xb312('0x49')]['id']){delete _0x323bf4['body']['id'];}return db['Trigger'][_0xb312('0x46')]({'where':{'id':_0x323bf4[_0xb312('0x52')]['id']}})[_0xb312('0x23')](handleEntityNotFound(_0x2eb235,null))[_0xb312('0x23')](function(_0x5ceed9){if(_0x5ceed9){_0x323bf4[_0xb312('0x49')][_0xb312('0x5b')]=_0x5ceed9['id'];return db[_0xb312('0x5c')][_0xb312('0x48')](_0x323bf4[_0xb312('0x49')]);}})['then'](respondWithResult(_0x2eb235,null))[_0xb312('0x47')](handleError(_0x2eb235,null));};exports[_0xb312('0x5d')]=function(_0x26e029,_0x3b34cd,_0x2811f9){var _0x3bf452={};var _0x322130={};var _0x545921;var _0x2023ac;return db[_0xb312('0x2b')][_0xb312('0x57')]({'where':{'id':_0x26e029[_0xb312('0x52')]['id']}})[_0xb312('0x23')](handleEntityNotFound(_0x3b34cd,null))[_0xb312('0x23')](function(_0x3872e5){if(_0x3872e5){_0x545921=_0x3872e5;_0x322130[_0xb312('0x2f')]=_[_0xb312('0x31')](db[_0xb312('0x5c')][_0xb312('0x44')]);_0x322130[_0xb312('0x30')]=_[_0xb312('0x31')](_0x26e029['query']);_0x322130[_0xb312('0x32')]=_[_0xb312('0x33')](_0x322130[_0xb312('0x2f')],_0x322130['query']);_0x3bf452[_0xb312('0x34')]=_[_0xb312('0x33')](_0x322130['model'],qs[_0xb312('0x35')](_0x26e029[_0xb312('0x30')][_0xb312('0x35')]));_0x3bf452[_0xb312('0x34')]=_0x3bf452[_0xb312('0x34')]['length']?_0x3bf452[_0xb312('0x34')]:_0x322130[_0xb312('0x2f')];_0x3bf452['order']=qs[_0xb312('0x3b')](_0x26e029[_0xb312('0x30')][_0xb312('0x3b')]);_0x3bf452['where']=qs['filters'](_[_0xb312('0x59')](_0x26e029[_0xb312('0x30')],_0x322130[_0xb312('0x32')]));if(_0x26e029['query']['filter']){_0x3bf452[_0xb312('0x3c')]=_[_0xb312('0x3f')](_0x3bf452[_0xb312('0x3c')],{'$or':_[_0xb312('0x2a')](_0x3bf452[_0xb312('0x34')],function(_0x1bbab5){var _0x1f81c8={};_0x1f81c8[_0x1bbab5]={'$like':'%'+_0x26e029[_0xb312('0x30')][_0xb312('0x3d')]+'%'};return _0x1f81c8;})});}_0x3bf452=_[_0xb312('0x3f')]({},_0x3bf452,_0x26e029[_0xb312('0x40')]);return _0x545921[_0xb312('0x5d')](_0x3bf452);}})[_0xb312('0x23')](function(_0x15425d){if(_0x15425d){_0x2023ac=_0x15425d['length'];if(!_0x26e029[_0xb312('0x30')][_0xb312('0x37')](_0xb312('0x38'))){_0x3bf452[_0xb312('0x39')]=qs[_0xb312('0x39')](_0x26e029['query'][_0xb312('0x39')]);_0x3bf452[_0xb312('0x1b')]=qs['offset'](_0x26e029[_0xb312('0x30')]['offset']);}return _0x545921['getActions'](_0x3bf452);}})[_0xb312('0x23')](function(_0x200b80){if(_0x200b80){return _0x200b80?{'count':_0x2023ac,'rows':_0x200b80}:null;}})[_0xb312('0x23')](respondWithResult(_0x3b34cd,null))['catch'](handleError(_0x3b34cd,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index a53b7de..df2d0d0 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 _0xc43c=['lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','./trigger.attributes','exports','define','Trigger','tools_triggers'];(function(_0x2e3d56,_0x4fb6ed){var _0x1815c1=function(_0x45a5fd){while(--_0x45a5fd){_0x2e3d56['push'](_0x2e3d56['shift']());}};_0x1815c1(++_0x4fb6ed);}(_0xc43c,0x152));var _0xcc43=function(_0x1551dc,_0x26be37){_0x1551dc=_0x1551dc-0x0;var _0x269377=_0xc43c[_0x1551dc];return _0x269377;};'use strict';var _=require(_0xcc43('0x0'));var util=require(_0xcc43('0x1'));var logger=require(_0xcc43('0x2'))(_0xcc43('0x3'));var moment=require(_0xcc43('0x4'));var BPromise=require(_0xcc43('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xcc43('0x6'));var rimraf=require(_0xcc43('0x7'));var config=require('../../config/environment');var attributes=require(_0xcc43('0x8'));module[_0xcc43('0x9')]=function(_0x217a5e,_0x17d1a2){return _0x217a5e[_0xcc43('0xa')](_0xcc43('0xb'),attributes,{'tableName':_0xcc43('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6e16=['exports','Trigger','tools_triggers','../../config/logger','moment','request-promise','path','../../config/environment'];(function(_0xcafa4b,_0x572040){var _0x4e3260=function(_0xfa5aba){while(--_0xfa5aba){_0xcafa4b['push'](_0xcafa4b['shift']());}};_0x4e3260(++_0x572040);}(_0x6e16,0x1d3));var _0x66e1=function(_0x4f0539,_0x356db0){_0x4f0539=_0x4f0539-0x0;var _0x1f45d9=_0x6e16[_0x4f0539];return _0x1f45d9;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x66e1('0x0'))('api');var moment=require(_0x66e1('0x1'));var BPromise=require('bluebird');var rp=require(_0x66e1('0x2'));var fs=require('fs');var path=require(_0x66e1('0x3'));var rimraf=require('rimraf');var config=require(_0x66e1('0x4'));var attributes=require('./trigger.attributes');module[_0x66e1('0x5')]=function(_0x204db8,_0x3f95fa){return _0x204db8['define'](_0x66e1('0x6'),attributes,{'tableName':_0x66e1('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/trigger/trigger.rpc.js b/server/api/trigger/trigger.rpc.js index 4100901..b219a5e 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 _0xa649=['request\x20sent','debug','Trigger,\x20%s,\x20%s,\x20%s','stringify','error','code','Trigger,\x20%s,\x20%s','message','result','catch','GetTrigger','Trigger','findAll','options','raw','where','limit','include','map','model','attributes','ShowTrigger','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info'];(function(_0x359cab,_0x15b12c){var _0x37b6de=function(_0x4a5948){while(--_0x4a5948){_0x359cab['push'](_0x359cab['shift']());}};_0x37b6de(++_0x15b12c);}(_0xa649,0x65));var _0x9a64=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0xa649[_0x8c43de];return _0xa6591b;};'use strict';var _=require(_0x9a64('0x0'));var util=require(_0x9a64('0x1'));var moment=require(_0x9a64('0x2'));var BPromise=require(_0x9a64('0x3'));var rs=require(_0x9a64('0x4'));var fs=require('fs');var Redis=require(_0x9a64('0x5'));var db=require(_0x9a64('0x6'))['db'];var utils=require(_0x9a64('0x7'));var logger=require(_0x9a64('0x8'))(_0x9a64('0x9'));var config=require(_0x9a64('0xa'));var jayson=require(_0x9a64('0xb'));var client=jayson['client'][_0x9a64('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1ba0de,_0x52e4bd,_0x276da5){return new BPromise(function(_0x19732c,_0x24459b){return client[_0x9a64('0xd')](_0x1ba0de,_0x276da5)[_0x9a64('0xe')](function(_0x4e8f89){logger[_0x9a64('0xf')]('Trigger,\x20%s,\x20%s',_0x52e4bd,_0x9a64('0x10'));logger[_0x9a64('0x11')](_0x9a64('0x12'),_0x52e4bd,'request\x20sent',JSON[_0x9a64('0x13')](_0x4e8f89));if(_0x4e8f89[_0x9a64('0x14')]){if(_0x4e8f89[_0x9a64('0x14')][_0x9a64('0x15')]===0x1f4){logger[_0x9a64('0x14')](_0x9a64('0x16'),_0x52e4bd,_0x4e8f89[_0x9a64('0x14')][_0x9a64('0x17')]);return _0x24459b(_0x4e8f89['error'][_0x9a64('0x17')]);}logger['error'](_0x9a64('0x16'),_0x52e4bd,_0x4e8f89[_0x9a64('0x14')][_0x9a64('0x17')]);return _0x19732c(_0x4e8f89['error'][_0x9a64('0x17')]);}else{logger['info'](_0x9a64('0x16'),_0x52e4bd,_0x9a64('0x10'));_0x19732c(_0x4e8f89[_0x9a64('0x18')][_0x9a64('0x17')]);}})[_0x9a64('0x19')](function(_0x1de23a){logger[_0x9a64('0x14')]('Trigger,\x20%s,\x20%s',_0x52e4bd,_0x1de23a);_0x24459b(_0x1de23a);});});}exports[_0x9a64('0x1a')]=function(_0x3ded79){var _0x3baa95=this;return new Promise(function(_0x5e644b,_0x1667a3){return db[_0x9a64('0x1b')][_0x9a64('0x1c')]({'raw':_0x3ded79['options']?_0x3ded79[_0x9a64('0x1d')][_0x9a64('0x1e')]===undefined?!![]:![]:!![],'where':_0x3ded79[_0x9a64('0x1d')]?_0x3ded79[_0x9a64('0x1d')][_0x9a64('0x1f')]||null:null,'attributes':_0x3ded79[_0x9a64('0x1d')]?_0x3ded79[_0x9a64('0x1d')]['attributes']||null:null,'limit':_0x3ded79['options']?_0x3ded79[_0x9a64('0x1d')][_0x9a64('0x20')]||null:null,'include':_0x3ded79['options']?_0x3ded79[_0x9a64('0x1d')][_0x9a64('0x21')]?_[_0x9a64('0x22')](_0x3ded79[_0x9a64('0x1d')][_0x9a64('0x21')],function(_0x97b8ec){return{'model':db[_0x97b8ec[_0x9a64('0x23')]],'as':_0x97b8ec['as'],'attributes':_0x97b8ec[_0x9a64('0x24')],'include':_0x97b8ec[_0x9a64('0x21')]?_[_0x9a64('0x22')](_0x97b8ec['include'],function(_0x611acd){return{'model':db[_0x611acd[_0x9a64('0x23')]],'as':_0x611acd['as'],'attributes':_0x611acd[_0x9a64('0x24')],'include':_0x611acd[_0x9a64('0x21')]?_[_0x9a64('0x22')](_0x611acd[_0x9a64('0x21')],function(_0x3e5fbd){return{'model':db[_0x3e5fbd[_0x9a64('0x23')]],'as':_0x3e5fbd['as'],'attributes':_0x3e5fbd[_0x9a64('0x24')]};}):[]};}):[]};}):[]:[]})[_0x9a64('0xe')](function(_0x38a7bb){logger[_0x9a64('0xf')](_0x9a64('0x1a'),_0x3ded79);logger['debug'](_0x9a64('0x1a'),_0x3ded79,JSON['stringify'](_0x38a7bb));_0x5e644b(_0x38a7bb);})['catch'](function(_0x5a6e9d){logger[_0x9a64('0x14')]('GetTrigger',_0x5a6e9d[_0x9a64('0x17')],_0x3ded79);_0x1667a3(_0x3baa95[_0x9a64('0x14')](0x1f4,_0x5a6e9d['message']));});});};exports[_0x9a64('0x25')]=function(_0x35e255){var _0x23abaf=this;return new Promise(function(_0x53ed51,_0x55af69){return db[_0x9a64('0x1b')][_0x9a64('0x26')]({'raw':_0x35e255[_0x9a64('0x1d')]?_0x35e255[_0x9a64('0x1d')][_0x9a64('0x1e')]===undefined?!![]:![]:!![],'where':_0x35e255[_0x9a64('0x1d')]?_0x35e255['options']['where']||null:null,'attributes':_0x35e255['options']?_0x35e255[_0x9a64('0x1d')]['attributes']||null:null,'include':_0x35e255[_0x9a64('0x1d')]?_0x35e255['options']['include']?_['map'](_0x35e255[_0x9a64('0x1d')][_0x9a64('0x21')],function(_0x1bbbd1){return{'model':db[_0x1bbbd1['model']],'as':_0x1bbbd1['as'],'attributes':_0x1bbbd1[_0x9a64('0x24')],'include':_0x1bbbd1['include']?_[_0x9a64('0x22')](_0x1bbbd1[_0x9a64('0x21')],function(_0x5b9c52){return{'model':db[_0x5b9c52[_0x9a64('0x23')]],'as':_0x5b9c52['as'],'attributes':_0x5b9c52[_0x9a64('0x24')],'include':_0x5b9c52[_0x9a64('0x21')]?_['map'](_0x5b9c52[_0x9a64('0x21')],function(_0x24dc5f){return{'model':db[_0x24dc5f[_0x9a64('0x23')]],'as':_0x24dc5f['as'],'attributes':_0x24dc5f[_0x9a64('0x24')]};}):[]};}):[]};}):[]:[]})[_0x9a64('0xe')](function(_0x24e583){logger[_0x9a64('0xf')](_0x9a64('0x25'),_0x35e255);logger[_0x9a64('0x11')](_0x9a64('0x25'),_0x35e255,JSON[_0x9a64('0x13')](_0x24e583));_0x53ed51(_0x24e583);})[_0x9a64('0x19')](function(_0x436cd6){logger['error'](_0x9a64('0x25'),_0x436cd6[_0x9a64('0x17')],_0x35e255);_0x55af69(_0x23abaf[_0x9a64('0x14')](0x1f4,_0x436cd6['message']));});});}; \ No newline at end of file +var _0x1cf5=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','request\x20sent','Trigger,\x20%s,\x20%s,\x20%s','code','Trigger,\x20%s,\x20%s','error','message','result','catch','GetTrigger','Trigger','options','raw','where','attributes','limit','include','map','model','debug','stringify','ShowTrigger','find','lodash','util','moment','bluebird','randomstring'];(function(_0x58d6f1,_0x1c3944){var _0x269bbe=function(_0x39a423){while(--_0x39a423){_0x58d6f1['push'](_0x58d6f1['shift']());}};_0x269bbe(++_0x1c3944);}(_0x1cf5,0xaf));var _0x51cf=function(_0x50d2a0,_0x13168b){_0x50d2a0=_0x50d2a0-0x0;var _0x11fe24=_0x1cf5[_0x50d2a0];return _0x11fe24;};'use strict';var _=require(_0x51cf('0x0'));var util=require(_0x51cf('0x1'));var moment=require(_0x51cf('0x2'));var BPromise=require(_0x51cf('0x3'));var rs=require(_0x51cf('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x51cf('0x5'))['db'];var utils=require(_0x51cf('0x6'));var logger=require(_0x51cf('0x7'))(_0x51cf('0x8'));var config=require(_0x51cf('0x9'));var jayson=require(_0x51cf('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0xb456c9,_0x20e16e,_0xfd7b35){return new BPromise(function(_0x3524dd,_0xb8a71a){return client[_0x51cf('0xb')](_0xb456c9,_0xfd7b35)[_0x51cf('0xc')](function(_0x18d52a){logger[_0x51cf('0xd')]('Trigger,\x20%s,\x20%s',_0x20e16e,_0x51cf('0xe'));logger['debug'](_0x51cf('0xf'),_0x20e16e,'request\x20sent',JSON['stringify'](_0x18d52a));if(_0x18d52a['error']){if(_0x18d52a['error'][_0x51cf('0x10')]===0x1f4){logger['error'](_0x51cf('0x11'),_0x20e16e,_0x18d52a[_0x51cf('0x12')]['message']);return _0xb8a71a(_0x18d52a[_0x51cf('0x12')][_0x51cf('0x13')]);}logger[_0x51cf('0x12')](_0x51cf('0x11'),_0x20e16e,_0x18d52a[_0x51cf('0x12')]['message']);return _0x3524dd(_0x18d52a[_0x51cf('0x12')]['message']);}else{logger[_0x51cf('0xd')](_0x51cf('0x11'),_0x20e16e,_0x51cf('0xe'));_0x3524dd(_0x18d52a[_0x51cf('0x14')][_0x51cf('0x13')]);}})[_0x51cf('0x15')](function(_0x30dfb4){logger[_0x51cf('0x12')](_0x51cf('0x11'),_0x20e16e,_0x30dfb4);_0xb8a71a(_0x30dfb4);});});}exports[_0x51cf('0x16')]=function(_0x38f59f){var _0x22dc71=this;return new Promise(function(_0x2eaf21,_0x585a01){return db[_0x51cf('0x17')]['findAll']({'raw':_0x38f59f[_0x51cf('0x18')]?_0x38f59f[_0x51cf('0x18')][_0x51cf('0x19')]===undefined?!![]:![]:!![],'where':_0x38f59f[_0x51cf('0x18')]?_0x38f59f[_0x51cf('0x18')][_0x51cf('0x1a')]||null:null,'attributes':_0x38f59f[_0x51cf('0x18')]?_0x38f59f[_0x51cf('0x18')][_0x51cf('0x1b')]||null:null,'limit':_0x38f59f['options']?_0x38f59f[_0x51cf('0x18')][_0x51cf('0x1c')]||null:null,'include':_0x38f59f[_0x51cf('0x18')]?_0x38f59f['options'][_0x51cf('0x1d')]?_['map'](_0x38f59f[_0x51cf('0x18')][_0x51cf('0x1d')],function(_0x21b32f){return{'model':db[_0x21b32f['model']],'as':_0x21b32f['as'],'attributes':_0x21b32f[_0x51cf('0x1b')],'include':_0x21b32f[_0x51cf('0x1d')]?_[_0x51cf('0x1e')](_0x21b32f[_0x51cf('0x1d')],function(_0x333a3a){return{'model':db[_0x333a3a[_0x51cf('0x1f')]],'as':_0x333a3a['as'],'attributes':_0x333a3a[_0x51cf('0x1b')],'include':_0x333a3a[_0x51cf('0x1d')]?_['map'](_0x333a3a[_0x51cf('0x1d')],function(_0x5b4970){return{'model':db[_0x5b4970['model']],'as':_0x5b4970['as'],'attributes':_0x5b4970[_0x51cf('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x51cf('0xc')](function(_0x4802c7){logger[_0x51cf('0xd')]('GetTrigger',_0x38f59f);logger[_0x51cf('0x20')]('GetTrigger',_0x38f59f,JSON[_0x51cf('0x21')](_0x4802c7));_0x2eaf21(_0x4802c7);})[_0x51cf('0x15')](function(_0x5b48a5){logger[_0x51cf('0x12')](_0x51cf('0x16'),_0x5b48a5['message'],_0x38f59f);_0x585a01(_0x22dc71[_0x51cf('0x12')](0x1f4,_0x5b48a5[_0x51cf('0x13')]));});});};exports[_0x51cf('0x22')]=function(_0x3018e1){var _0x646d91=this;return new Promise(function(_0x706c63,_0x4270f6){return db['Trigger'][_0x51cf('0x23')]({'raw':_0x3018e1[_0x51cf('0x18')]?_0x3018e1[_0x51cf('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x3018e1[_0x51cf('0x18')]?_0x3018e1[_0x51cf('0x18')][_0x51cf('0x1a')]||null:null,'attributes':_0x3018e1[_0x51cf('0x18')]?_0x3018e1['options']['attributes']||null:null,'include':_0x3018e1[_0x51cf('0x18')]?_0x3018e1[_0x51cf('0x18')][_0x51cf('0x1d')]?_[_0x51cf('0x1e')](_0x3018e1[_0x51cf('0x18')][_0x51cf('0x1d')],function(_0x2ea53d){return{'model':db[_0x2ea53d['model']],'as':_0x2ea53d['as'],'attributes':_0x2ea53d[_0x51cf('0x1b')],'include':_0x2ea53d['include']?_['map'](_0x2ea53d[_0x51cf('0x1d')],function(_0x4b7123){return{'model':db[_0x4b7123[_0x51cf('0x1f')]],'as':_0x4b7123['as'],'attributes':_0x4b7123[_0x51cf('0x1b')],'include':_0x4b7123[_0x51cf('0x1d')]?_[_0x51cf('0x1e')](_0x4b7123[_0x51cf('0x1d')],function(_0x1d3335){return{'model':db[_0x1d3335['model']],'as':_0x1d3335['as'],'attributes':_0x1d3335[_0x51cf('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x595b6a){logger[_0x51cf('0xd')](_0x51cf('0x22'),_0x3018e1);logger[_0x51cf('0x20')](_0x51cf('0x22'),_0x3018e1,JSON[_0x51cf('0x21')](_0x595b6a));_0x706c63(_0x595b6a);})[_0x51cf('0x15')](function(_0x3e7f1f){logger['error'](_0x51cf('0x22'),_0x3e7f1f['message'],_0x3018e1);_0x4270f6(_0x646d91[_0x51cf('0x12')](0x1f4,_0x3e7f1f['message']));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index e40261e..e3a01f3 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 _0x6f72=['update','destroy','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./trunk.controller','get','isAuthenticated','index','/:id','show','post','/:id/clone','clone','create','put'];(function(_0x45d55e,_0x2fede3){var _0x29812a=function(_0x3c6830){while(--_0x3c6830){_0x45d55e['push'](_0x45d55e['shift']());}};_0x29812a(++_0x2fede3);}(_0x6f72,0x136));var _0x26f7=function(_0x27d329,_0x339866){_0x27d329=_0x27d329-0x0;var _0x5579d7=_0x6f72[_0x27d329];return _0x5579d7;};'use strict';var multer=require(_0x26f7('0x0'));var util=require(_0x26f7('0x1'));var path=require('path');var timeout=require(_0x26f7('0x2'));var express=require(_0x26f7('0x3'));var router=express[_0x26f7('0x4')]();var fs_extra=require(_0x26f7('0x5'));var auth=require(_0x26f7('0x6'));var interaction=require(_0x26f7('0x7'));var config=require(_0x26f7('0x8'));var controller=require(_0x26f7('0x9'));router[_0x26f7('0xa')]('/',auth[_0x26f7('0xb')](),controller[_0x26f7('0xc')]);router['get'](_0x26f7('0xd'),auth['isAuthenticated'](),controller[_0x26f7('0xe')]);router[_0x26f7('0xf')](_0x26f7('0x10'),auth[_0x26f7('0xb')](),controller[_0x26f7('0x11')]);router[_0x26f7('0xf')]('/',auth[_0x26f7('0xb')](),controller[_0x26f7('0x12')]);router[_0x26f7('0x13')]('/:id',auth[_0x26f7('0xb')](),controller[_0x26f7('0x14')]);router['delete'](_0x26f7('0xd'),auth[_0x26f7('0xb')](),controller[_0x26f7('0x15')]);module['exports']=router; \ No newline at end of file +var _0x092e=['show','post','clone','create','put','update','destroy','exports','util','path','express','Router','../../components/auth/service','../../config/environment','./trunk.controller','get','isAuthenticated','/:id'];(function(_0x3c9def,_0x5384ea){var _0x591e39=function(_0x38a6ba){while(--_0x38a6ba){_0x3c9def['push'](_0x3c9def['shift']());}};_0x591e39(++_0x5384ea);}(_0x092e,0xf2));var _0xe092=function(_0x34849c,_0x48c9f4){_0x34849c=_0x34849c-0x0;var _0x39162c=_0x092e[_0x34849c];return _0x39162c;};'use strict';var multer=require('multer');var util=require(_0xe092('0x0'));var path=require(_0xe092('0x1'));var timeout=require('connect-timeout');var express=require(_0xe092('0x2'));var router=express[_0xe092('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xe092('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xe092('0x5'));var controller=require(_0xe092('0x6'));router[_0xe092('0x7')]('/',auth[_0xe092('0x8')](),controller['index']);router['get'](_0xe092('0x9'),auth['isAuthenticated'](),controller[_0xe092('0xa')]);router[_0xe092('0xb')]('/:id/clone',auth[_0xe092('0x8')](),controller[_0xe092('0xc')]);router['post']('/',auth[_0xe092('0x8')](),controller[_0xe092('0xd')]);router[_0xe092('0xe')]('/:id',auth[_0xe092('0x8')](),controller[_0xe092('0xf')]);router['delete'](_0xe092('0x9'),auth[_0xe092('0x8')](),controller[_0xe092('0x10')]);module[_0xe092('0x11')]=router; \ No newline at end of file diff --git a/server/api/trunk/trunk.attributes.js b/server/api/trunk/trunk.attributes.js index 73f2782..0070382 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 _0x8c88=['refuse','uac','uas','pai','fingerprint','active','passive','actpass','update,nonat','BOOLEAN','sequelize','STRING','name','ENUM','friend','peer','from-voip-provider','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','join','getDataValue','transport','split','rfc2833','shortinfo','inband','auto','yes','nonat','update','outgoing','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','port,invite','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','INTEGER','\x22\x22\x20<>','accept'];(function(_0x269d02,_0x291474){var _0x5e0bac=function(_0x1822ec){while(--_0x1822ec){_0x269d02['push'](_0x269d02['shift']());}};_0x5e0bac(++_0x291474);}(_0x8c88,0xa3));var _0x88c8=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0x8c88[_0x13d07a];return _0x5ee0ee;};'use strict';var Sequelize=require(_0x88c8('0x0'));module['exports']={'name':{'type':Sequelize[_0x88c8('0x1')],'allowNull':![],'unique':_0x88c8('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x88c8('0x3')](_0x88c8('0x4'),'user',_0x88c8('0x5')),'allowNull':![],'defaultValue':_0x88c8('0x4')},'context':{'type':Sequelize[_0x88c8('0x1')],'allowNull':![],'defaultValue':_0x88c8('0x6')},'callingpres':{'type':Sequelize[_0x88c8('0x3')](_0x88c8('0x7'),_0x88c8('0x8'),_0x88c8('0x9'),_0x88c8('0xa'),_0x88c8('0xb'),_0x88c8('0xc'),_0x88c8('0xd'),_0x88c8('0xe'))},'deny':{'type':Sequelize[_0x88c8('0x1')]},'permit':{'type':Sequelize[_0x88c8('0x1')]},'secret':{'type':Sequelize[_0x88c8('0x1')]},'md5secret':{'type':Sequelize[_0x88c8('0x1')]},'remotesecret':{'type':Sequelize[_0x88c8('0x1')]},'transport':{'type':Sequelize['STRING'],'defaultValue':_0x88c8('0xf'),'set':function(_0x49cf49){this['setDataValue']('transport',_0x49cf49?_0x49cf49[_0x88c8('0x10')](','):null);},'get':function(){return this[_0x88c8('0x11')](_0x88c8('0x12'))?this[_0x88c8('0x11')](_0x88c8('0x12'))[_0x88c8('0x13')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'},'dtmfmode':{'type':Sequelize[_0x88c8('0x3')](_0x88c8('0x14'),'info',_0x88c8('0x15'),_0x88c8('0x16'),_0x88c8('0x17')),'defaultValue':_0x88c8('0x14')},'directmedia':{'type':Sequelize[_0x88c8('0x3')](_0x88c8('0x18'),'no',_0x88c8('0x19'),_0x88c8('0x1a'),_0x88c8('0x1b')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x88c8('0x3')]('yes','no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING']},'directmediadeny':{'type':Sequelize[_0x88c8('0x1')]},'nat':{'type':Sequelize[_0x88c8('0x1')],'defaultValue':_0x88c8('0x1c'),'set':function(_0xa0186f){this[_0x88c8('0x1d')]('nat',_0xa0186f?_0xa0186f['join'](','):null);},'get':function(){return this['getDataValue'](_0x88c8('0x1e'))?this['getDataValue'](_0x88c8('0x1e'))[_0x88c8('0x13')](','):null;},'comment':_0x88c8('0x1f')},'callgroup':{'type':Sequelize[_0x88c8('0x1')]},'namedcallgroup':{'type':Sequelize['STRING']},'pickupgroup':{'type':Sequelize[_0x88c8('0x1')]},'namedpickupgroup':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x88c8('0x1')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x88c8('0x1')],'allowNull':!![]},'disallow':{'type':Sequelize[_0x88c8('0x1')],'defaultValue':_0x88c8('0x20')},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x88c8('0x21'),'set':function(_0x431e1f){this[_0x88c8('0x1d')](_0x88c8('0x22'),_0x431e1f?_0x431e1f['join'](';'):_0x88c8('0x21'));},'get':function(){return this[_0x88c8('0x11')](_0x88c8('0x22'))?this[_0x88c8('0x11')](_0x88c8('0x22'))[_0x88c8('0x13')](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]'},'autoframing':{'type':Sequelize[_0x88c8('0x3')](_0x88c8('0x18'),'no')},'insecure':{'type':Sequelize[_0x88c8('0x1')],'defaultValue':_0x88c8('0x23'),'set':function(_0x45e243){this[_0x88c8('0x1d')](_0x88c8('0x24'),_0x45e243?_0x45e243[_0x88c8('0x10')](','):null);},'get':function(){return this['getDataValue'](_0x88c8('0x24'))?this['getDataValue']('insecure')[_0x88c8('0x13')](','):null;},'comment':_0x88c8('0x25')},'trustrpid':{'type':Sequelize[_0x88c8('0x3')](_0x88c8('0x18'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x88c8('0x3')]('yes','no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x88c8('0x3')](_0x88c8('0x18'),'no','never')},'promiscredir':{'type':Sequelize[_0x88c8('0x3')](_0x88c8('0x18'),'no')},'useclientcode':{'type':Sequelize[_0x88c8('0x3')](_0x88c8('0x18'),'no')},'accountcode':{'type':Sequelize[_0x88c8('0x26')](0xb)},'setvar':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize['STRING'],'defaultValue':_0x88c8('0x27')},'amaflags':{'type':Sequelize[_0x88c8('0x1')]},'callcounter':{'type':Sequelize['ENUM'](_0x88c8('0x18'),'no'),'defaultValue':_0x88c8('0x18')},'busylevel':{'type':Sequelize[_0x88c8('0x26')](0xb)},'allowoverlap':{'type':Sequelize[_0x88c8('0x3')](_0x88c8('0x18'),'no')},'allowsubscribe':{'type':Sequelize[_0x88c8('0x3')](_0x88c8('0x18'),'no')},'allowtransfer':{'type':Sequelize[_0x88c8('0x3')](_0x88c8('0x18'),'no')},'ignoresdpversion':{'type':Sequelize[_0x88c8('0x3')](_0x88c8('0x18'),'no')},'subscribecontext':{'type':Sequelize[_0x88c8('0x1')]},'template':{'type':Sequelize[_0x88c8('0x1')]},'videosupport':{'type':Sequelize[_0x88c8('0x3')](_0x88c8('0x18'),'no','always'),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x88c8('0x26')](0xb)},'rfc2833compensate':{'type':Sequelize[_0x88c8('0x3')]('yes','no')},'mailbox':{'type':Sequelize['STRING']},'session_timers':{'type':Sequelize[_0x88c8('0x3')](_0x88c8('0x28'),_0x88c8('0x29'),'originate')},'session_expires':{'type':Sequelize['INTEGER'](0xb)},'session_minse':{'type':Sequelize[_0x88c8('0x26')](0xb)},'session_refresher':{'type':Sequelize[_0x88c8('0x3')](_0x88c8('0x2a'),'uas'),'defaultValue':_0x88c8('0x2b')},'t38pt_usertpsource':{'type':Sequelize[_0x88c8('0x1')]},'regexten':{'type':Sequelize[_0x88c8('0x1')]},'fromdomain':{'type':Sequelize[_0x88c8('0x1')]},'fromuser':{'type':Sequelize[_0x88c8('0x1')]},'port':{'type':Sequelize[_0x88c8('0x26')](0x5)},'qualify':{'type':Sequelize[_0x88c8('0x3')]('yes','no'),'defaultValue':_0x88c8('0x18')},'keepalive':{'type':Sequelize['INTEGER'](0xb)},'defaultip':{'type':Sequelize[_0x88c8('0x1')]},'defaultuser':{'type':Sequelize['STRING']},'rtptimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpholdtimeout':{'type':Sequelize[_0x88c8('0x26')](0xb)},'rtpkeepalive':{'type':Sequelize[_0x88c8('0x26')](0xb)},'sendrpid':{'type':Sequelize[_0x88c8('0x3')]('yes','no',_0x88c8('0x2c')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x88c8('0x1')]},'callbackextension':{'type':Sequelize[_0x88c8('0x1')]},'timert1':{'type':Sequelize[_0x88c8('0x26')](0xb)},'timerb':{'type':Sequelize['INTEGER'](0xb)},'qualifyfreq':{'type':Sequelize[_0x88c8('0x26')](0xb)},'contactpermit':{'type':Sequelize[_0x88c8('0x1')]},'contactdeny':{'type':Sequelize['STRING']},'contactacl':{'type':Sequelize[_0x88c8('0x1')]},'unsolicited_mailbox':{'type':Sequelize[_0x88c8('0x1')]},'use_q850_reason':{'type':Sequelize[_0x88c8('0x1')]},'maxforwards':{'type':Sequelize[_0x88c8('0x26')](0xb)},'encryption':{'type':Sequelize[_0x88c8('0x3')](_0x88c8('0x18'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0x88c8('0x3')](_0x88c8('0x18'),'no')},'force_avp':{'type':Sequelize[_0x88c8('0x3')](_0x88c8('0x18'),'no')},'icesupport':{'type':Sequelize[_0x88c8('0x3')](_0x88c8('0x18'),'no')},'dtlsenable':{'type':Sequelize[_0x88c8('0x3')](_0x88c8('0x18'),'no')},'dtlsverify':{'type':Sequelize[_0x88c8('0x3')]('yes','no',_0x88c8('0x2d'),'certificate')},'dtlsrekey':{'type':Sequelize['INTEGER'](0xb)},'dtlscertfile':{'type':Sequelize['STRING']},'dtlsprivatekey':{'type':Sequelize[_0x88c8('0x1')]},'dtlscipher':{'type':Sequelize[_0x88c8('0x1')]},'dtlscafile':{'type':Sequelize['STRING']},'dtlscapath':{'type':Sequelize[_0x88c8('0x1')]},'dtlssetup':{'type':Sequelize['ENUM'](_0x88c8('0x2e'),_0x88c8('0x2f'),_0x88c8('0x30')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING']},'usereqphone':{'type':Sequelize[_0x88c8('0x3')](_0x88c8('0x18'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x88c8('0x1')]},'recordofffeature':{'type':Sequelize['STRING']},'call_limit':{'type':Sequelize[_0x88c8('0x26')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0x88c8('0x3')](_0x88c8('0x18'),'no')},'subscribemwi':{'type':Sequelize['ENUM'](_0x88c8('0x18'),'no')},'vmexten':{'type':Sequelize[_0x88c8('0x1')]},'mohinterpret':{'type':Sequelize[_0x88c8('0x1')]},'mohsuggest':{'type':Sequelize[_0x88c8('0x1')]},'parkinglot':{'type':Sequelize[_0x88c8('0x1')]},'description':{'type':Sequelize[_0x88c8('0x1')]},'host':{'type':Sequelize['STRING'],'defaultValue':'dynamic'},'canreinvite':{'type':Sequelize[_0x88c8('0x3')](_0x88c8('0x18'),'no',_0x88c8('0x19'),'update',_0x88c8('0x31')),'defaultValue':'no'},'registry':{'type':Sequelize['STRING']},'otherFields':{'type':Sequelize[_0x88c8('0x1')]},'active':{'type':Sequelize[_0x88c8('0x32')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0x88c8('0x1')],'defaultValue':'no'}}; \ No newline at end of file +var _0x0d36=['from-voip-provider','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','udp','setDataValue','transport','getDataValue','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','inband','auto','yes','update','force_rport,comedia','nat','join','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','ulaw;alaw;gsm','allow','port,invite','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','INTEGER','\x22\x22\x20<>','always','accept','originate','uac','uas','pai','fingerprint','certificate','passive','actpass','dynamic','update,nonat','BOOLEAN','sequelize','exports','STRING','ENUM','friend','user','peer'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x0d36,0x95));var _0x60d3=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x0d36[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0x60d3('0x0'));module[_0x60d3('0x1')]={'name':{'type':Sequelize[_0x60d3('0x2')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x60d3('0x3')](_0x60d3('0x4'),_0x60d3('0x5'),_0x60d3('0x6')),'allowNull':![],'defaultValue':_0x60d3('0x4')},'context':{'type':Sequelize[_0x60d3('0x2')],'allowNull':![],'defaultValue':_0x60d3('0x7')},'callingpres':{'type':Sequelize[_0x60d3('0x3')](_0x60d3('0x8'),_0x60d3('0x9'),'ALLOWED_FAILED_SCREEN',_0x60d3('0xa'),_0x60d3('0xb'),_0x60d3('0xc'),_0x60d3('0xd'),'PROHIB')},'deny':{'type':Sequelize[_0x60d3('0x2')]},'permit':{'type':Sequelize[_0x60d3('0x2')]},'secret':{'type':Sequelize['STRING']},'md5secret':{'type':Sequelize[_0x60d3('0x2')]},'remotesecret':{'type':Sequelize['STRING']},'transport':{'type':Sequelize[_0x60d3('0x2')],'defaultValue':_0x60d3('0xe'),'set':function(_0x387d78){this[_0x60d3('0xf')](_0x60d3('0x10'),_0x387d78?_0x387d78['join'](','):null);},'get':function(){return this['getDataValue'](_0x60d3('0x10'))?this[_0x60d3('0x11')]('transport')[_0x60d3('0x12')](','):null;},'comment':_0x60d3('0x13')},'dtmfmode':{'type':Sequelize[_0x60d3('0x3')](_0x60d3('0x14'),_0x60d3('0x15'),_0x60d3('0x16'),_0x60d3('0x17'),_0x60d3('0x18')),'defaultValue':_0x60d3('0x14')},'directmedia':{'type':Sequelize[_0x60d3('0x3')](_0x60d3('0x19'),'no','nonat',_0x60d3('0x1a'),'outgoing'),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x60d3('0x3')](_0x60d3('0x19'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x60d3('0x2')]},'directmediadeny':{'type':Sequelize[_0x60d3('0x2')]},'nat':{'type':Sequelize[_0x60d3('0x2')],'defaultValue':_0x60d3('0x1b'),'set':function(_0x323df1){this[_0x60d3('0xf')](_0x60d3('0x1c'),_0x323df1?_0x323df1[_0x60d3('0x1d')](','):null);},'get':function(){return this[_0x60d3('0x11')]('nat')?this[_0x60d3('0x11')]('nat')[_0x60d3('0x12')](','):null;},'comment':_0x60d3('0x1e')},'callgroup':{'type':Sequelize['STRING']},'namedcallgroup':{'type':Sequelize[_0x60d3('0x2')]},'pickupgroup':{'type':Sequelize[_0x60d3('0x2')]},'namedpickupgroup':{'type':Sequelize[_0x60d3('0x2')]},'language':{'type':Sequelize[_0x60d3('0x2')],'defaultValue':'en'},'tonezone':{'type':Sequelize['STRING'],'allowNull':!![]},'disallow':{'type':Sequelize['STRING'],'defaultValue':'all'},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x60d3('0x1f'),'set':function(_0x1388d0){this['setDataValue']('allow',_0x1388d0?_0x1388d0['join'](';'):_0x60d3('0x1f'));},'get':function(){return this[_0x60d3('0x11')](_0x60d3('0x20'))?this[_0x60d3('0x11')](_0x60d3('0x20'))['split'](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]'},'autoframing':{'type':Sequelize[_0x60d3('0x3')](_0x60d3('0x19'),'no')},'insecure':{'type':Sequelize[_0x60d3('0x2')],'defaultValue':_0x60d3('0x21'),'set':function(_0x1da877){this[_0x60d3('0xf')](_0x60d3('0x22'),_0x1da877?_0x1da877['join'](','):null);},'get':function(){return this[_0x60d3('0x11')](_0x60d3('0x22'))?this[_0x60d3('0x11')](_0x60d3('0x22'))[_0x60d3('0x12')](','):null;},'comment':_0x60d3('0x23')},'trustrpid':{'type':Sequelize[_0x60d3('0x3')]('yes','no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x60d3('0x3')](_0x60d3('0x19'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x60d3('0x3')](_0x60d3('0x19'),'no',_0x60d3('0x24'))},'promiscredir':{'type':Sequelize['ENUM'](_0x60d3('0x19'),'no')},'useclientcode':{'type':Sequelize[_0x60d3('0x3')](_0x60d3('0x19'),'no')},'accountcode':{'type':Sequelize[_0x60d3('0x25')](0xb)},'setvar':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x60d3('0x2')],'defaultValue':_0x60d3('0x26')},'amaflags':{'type':Sequelize[_0x60d3('0x2')]},'callcounter':{'type':Sequelize[_0x60d3('0x3')](_0x60d3('0x19'),'no'),'defaultValue':_0x60d3('0x19')},'busylevel':{'type':Sequelize[_0x60d3('0x25')](0xb)},'allowoverlap':{'type':Sequelize['ENUM'](_0x60d3('0x19'),'no')},'allowsubscribe':{'type':Sequelize[_0x60d3('0x3')](_0x60d3('0x19'),'no')},'allowtransfer':{'type':Sequelize[_0x60d3('0x3')](_0x60d3('0x19'),'no')},'ignoresdpversion':{'type':Sequelize[_0x60d3('0x3')]('yes','no')},'subscribecontext':{'type':Sequelize[_0x60d3('0x2')]},'template':{'type':Sequelize[_0x60d3('0x2')]},'videosupport':{'type':Sequelize[_0x60d3('0x3')](_0x60d3('0x19'),'no',_0x60d3('0x27')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x60d3('0x25')](0xb)},'rfc2833compensate':{'type':Sequelize[_0x60d3('0x3')](_0x60d3('0x19'),'no')},'mailbox':{'type':Sequelize[_0x60d3('0x2')]},'session_timers':{'type':Sequelize[_0x60d3('0x3')](_0x60d3('0x28'),'refuse',_0x60d3('0x29'))},'session_expires':{'type':Sequelize[_0x60d3('0x25')](0xb)},'session_minse':{'type':Sequelize[_0x60d3('0x25')](0xb)},'session_refresher':{'type':Sequelize[_0x60d3('0x3')](_0x60d3('0x2a'),_0x60d3('0x2b')),'defaultValue':_0x60d3('0x2b')},'t38pt_usertpsource':{'type':Sequelize[_0x60d3('0x2')]},'regexten':{'type':Sequelize[_0x60d3('0x2')]},'fromdomain':{'type':Sequelize['STRING']},'fromuser':{'type':Sequelize[_0x60d3('0x2')]},'port':{'type':Sequelize[_0x60d3('0x25')](0x5)},'qualify':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':_0x60d3('0x19')},'keepalive':{'type':Sequelize[_0x60d3('0x25')](0xb)},'defaultip':{'type':Sequelize['STRING']},'defaultuser':{'type':Sequelize['STRING']},'rtptimeout':{'type':Sequelize[_0x60d3('0x25')](0xb)},'rtpholdtimeout':{'type':Sequelize[_0x60d3('0x25')](0xb)},'rtpkeepalive':{'type':Sequelize[_0x60d3('0x25')](0xb)},'sendrpid':{'type':Sequelize[_0x60d3('0x3')](_0x60d3('0x19'),'no',_0x60d3('0x2c')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x60d3('0x2')]},'callbackextension':{'type':Sequelize[_0x60d3('0x2')]},'timert1':{'type':Sequelize[_0x60d3('0x25')](0xb)},'timerb':{'type':Sequelize['INTEGER'](0xb)},'qualifyfreq':{'type':Sequelize[_0x60d3('0x25')](0xb)},'contactpermit':{'type':Sequelize[_0x60d3('0x2')]},'contactdeny':{'type':Sequelize[_0x60d3('0x2')]},'contactacl':{'type':Sequelize[_0x60d3('0x2')]},'unsolicited_mailbox':{'type':Sequelize[_0x60d3('0x2')]},'use_q850_reason':{'type':Sequelize['STRING']},'maxforwards':{'type':Sequelize['INTEGER'](0xb)},'encryption':{'type':Sequelize[_0x60d3('0x3')]('yes','no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0x60d3('0x3')](_0x60d3('0x19'),'no')},'force_avp':{'type':Sequelize[_0x60d3('0x3')](_0x60d3('0x19'),'no')},'icesupport':{'type':Sequelize['ENUM'](_0x60d3('0x19'),'no')},'dtlsenable':{'type':Sequelize[_0x60d3('0x3')](_0x60d3('0x19'),'no')},'dtlsverify':{'type':Sequelize[_0x60d3('0x3')](_0x60d3('0x19'),'no',_0x60d3('0x2d'),_0x60d3('0x2e'))},'dtlsrekey':{'type':Sequelize['INTEGER'](0xb)},'dtlscertfile':{'type':Sequelize[_0x60d3('0x2')]},'dtlsprivatekey':{'type':Sequelize['STRING']},'dtlscipher':{'type':Sequelize[_0x60d3('0x2')]},'dtlscafile':{'type':Sequelize[_0x60d3('0x2')]},'dtlscapath':{'type':Sequelize[_0x60d3('0x2')]},'dtlssetup':{'type':Sequelize[_0x60d3('0x3')]('active',_0x60d3('0x2f'),_0x60d3('0x30')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x60d3('0x2')]},'usereqphone':{'type':Sequelize[_0x60d3('0x3')](_0x60d3('0x19'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x60d3('0x2')]},'recordofffeature':{'type':Sequelize[_0x60d3('0x2')]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0x60d3('0x3')](_0x60d3('0x19'),'no')},'subscribemwi':{'type':Sequelize[_0x60d3('0x3')](_0x60d3('0x19'),'no')},'vmexten':{'type':Sequelize[_0x60d3('0x2')]},'mohinterpret':{'type':Sequelize['STRING']},'mohsuggest':{'type':Sequelize[_0x60d3('0x2')]},'parkinglot':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x60d3('0x2')]},'host':{'type':Sequelize['STRING'],'defaultValue':_0x60d3('0x31')},'canreinvite':{'type':Sequelize[_0x60d3('0x3')](_0x60d3('0x19'),'no','nonat',_0x60d3('0x1a'),_0x60d3('0x32')),'defaultValue':'no'},'registry':{'type':Sequelize[_0x60d3('0x2')]},'otherFields':{'type':Sequelize[_0x60d3('0x2')]},'active':{'type':Sequelize[_0x60d3('0x33')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0x60d3('0x2')],'defaultValue':'no'}}; \ No newline at end of file diff --git a/server/api/trunk/trunk.controller.js b/server/api/trunk/trunk.controller.js index 050cd51..5a2b21a 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 _0x98a8=['../../mysqldb','jayson/promise','client','request','Trunk,\x20%s,\x20%s','debug','request\x20sent','error','code','message','info','catch','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','update','then','destroy','get','Trunks','UserProfileResource','stack','name','map','fieldName','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','Trunk','include','show','params','keys','rawAttributes','includeAll','clone','find','createdAt','updatedAt','body','omit','create','user','role','UserProfileSection','userProfileId','autoAssociation','findAll','readFileSync','root','server/files/templates/trunk.ejs','join','server/files/templates/registry.ejs','utf8','render','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','registry','/etc/asterisk/sip_xcally_registers.conf','Reload','chan_sip.so','Unable\x20to\x20retrieve\x20the\x20current\x20user','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment'];(function(_0x52fc67,_0x42c5cf){var _0x46044a=function(_0x1c3439){while(--_0x1c3439){_0x52fc67['push'](_0x52fc67['shift']());}};_0x46044a(++_0x42c5cf);}(_0x98a8,0x12c));var _0x898a=function(_0x4f7753,_0x2ac8e1){_0x4f7753=_0x4f7753-0x0;var _0x2346cf=_0x98a8[_0x4f7753];return _0x2346cf;};'use strict';var emlformat=require(_0x898a('0x0'));var rimraf=require(_0x898a('0x1'));var zipdir=require(_0x898a('0x2'));var jsonpatch=require(_0x898a('0x3'));var rp=require(_0x898a('0x4'));var moment=require(_0x898a('0x5'));var BPromise=require(_0x898a('0x6'));var Mustache=require('mustache');var util=require(_0x898a('0x7'));var path=require(_0x898a('0x8'));var sox=require(_0x898a('0x9'));var csv=require(_0x898a('0xa'));var ejs=require(_0x898a('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x898a('0xc'));var squel=require('squel');var crypto=require(_0x898a('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x898a('0xe'));var toCsv=require(_0x898a('0xa'));var querystring=require(_0x898a('0xf'));var Papa=require(_0x898a('0x10'));var Redis=require(_0x898a('0x11'));var authService=require(_0x898a('0x12'));var qs=require(_0x898a('0x13'));var as=require(_0x898a('0x14'));var hardwareService=require(_0x898a('0x15'));var logger=require('../../config/logger')(_0x898a('0x16'));var utils=require('../../config/utils');var config=require(_0x898a('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x898a('0x18'))['db'];var jayson=require(_0x898a('0x19'));var client=jayson[_0x898a('0x1a')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5bfded,_0x5b5c9c,_0x373d53,_0x1f5be4){return new BPromise(function(_0xb24335,_0x116fbe){var _0x1873e9=_0x1f5be4||client;return _0x1873e9[_0x898a('0x1b')](_0x5bfded,_0x373d53)['then'](function(_0x47033c){logger['info'](_0x898a('0x1c'),_0x5b5c9c,'request\x20sent');logger[_0x898a('0x1d')]('Trunk,\x20%s,\x20%s,\x20%s',_0x5b5c9c,_0x898a('0x1e'),JSON['stringify'](_0x47033c));if(_0x47033c[_0x898a('0x1f')]){if(_0x47033c[_0x898a('0x1f')][_0x898a('0x20')]===0x1f4){logger['error'](_0x898a('0x1c'),_0x5b5c9c,_0x47033c['error']['message']);return _0x116fbe(_0x47033c[_0x898a('0x1f')][_0x898a('0x21')]);}logger['error']('Trunk,\x20%s,\x20%s',_0x5b5c9c,_0x47033c[_0x898a('0x1f')][_0x898a('0x21')]);return _0xb24335(_0x47033c[_0x898a('0x1f')][_0x898a('0x21')]);}else{logger[_0x898a('0x22')](_0x898a('0x1c'),_0x5b5c9c,_0x898a('0x1e'));_0xb24335(_0x47033c['result'][_0x898a('0x21')]);}})[_0x898a('0x23')](function(_0x11cae2){logger[_0x898a('0x1f')](_0x898a('0x1c'),_0x5b5c9c,_0x11cae2);_0x116fbe(_0x11cae2);});});}function respondWithStatusCode(_0x310bfa,_0x4e254d){_0x4e254d=_0x4e254d||0xcc;return function(_0x274cdf){if(_0x274cdf){return _0x310bfa[_0x898a('0x24')](_0x4e254d);}return _0x310bfa[_0x898a('0x25')](_0x4e254d)[_0x898a('0x26')]();};}function respondWithResult(_0x3901ab,_0x1426e3){_0x1426e3=_0x1426e3||0xc8;return function(_0x5b7719){if(_0x5b7719){return _0x3901ab[_0x898a('0x25')](_0x1426e3)['json'](_0x5b7719);}};}function respondWithFilteredResult(_0x513c6b,_0x53ddb2){return function(_0x3678be){if(_0x3678be){var _0x1f4d86=typeof _0x53ddb2[_0x898a('0x27')]===_0x898a('0x28')&&typeof _0x53ddb2[_0x898a('0x29')]===_0x898a('0x28');var _0x398e98=_0x3678be[_0x898a('0x2a')];var _0xd31922=_0x1f4d86?0x0:_0x53ddb2['offset'];var _0x4b3e68=_0x1f4d86?_0x3678be['count']:_0x53ddb2[_0x898a('0x27')]+_0x53ddb2[_0x898a('0x29')];var _0x3b7704;if(_0x4b3e68>=_0x398e98){_0x4b3e68=_0x398e98;_0x3b7704=0xc8;}else{_0x3b7704=0xce;}_0x513c6b[_0x898a('0x25')](_0x3b7704);return _0x513c6b[_0x898a('0x2b')](_0x898a('0x2c'),_0xd31922+'-'+_0x4b3e68+'/'+_0x398e98)[_0x898a('0x2d')](_0x3678be);}return null;};}function patchUpdates(_0xf74645){return function(_0x18773a){try{jsonpatch[_0x898a('0x2e')](_0x18773a,_0xf74645,!![]);}catch(_0x44c5d2){return BPromise[_0x898a('0x2f')](_0x44c5d2);}return _0x18773a['save']();};}function saveUpdates(_0x7a1eb5,_0x17a5f3){return function(_0x26eead){if(_0x26eead){return _0x26eead[_0x898a('0x30')](_0x7a1eb5)[_0x898a('0x31')](function(_0x47af5b){return _0x47af5b;});}return null;};}function removeEntity(_0x48cefb,_0x20a3fe){return function(_0x1e2fd4){if(_0x1e2fd4){return _0x1e2fd4[_0x898a('0x32')]()['then'](function(){var _0x105477=_0x1e2fd4[_0x898a('0x33')]({'plain':!![]});var _0x5eafc7=_0x898a('0x34');return db[_0x898a('0x35')][_0x898a('0x32')]({'where':{'type':_0x5eafc7,'resourceId':_0x105477['id']}})[_0x898a('0x31')](function(){return _0x1e2fd4;});})[_0x898a('0x31')](function(){_0x48cefb['status'](0xcc)[_0x898a('0x26')]();});}};}function handleEntityNotFound(_0x5baf5b,_0x573eb3){return function(_0x14e2dc){if(!_0x14e2dc){_0x5baf5b['sendStatus'](0x194);}return _0x14e2dc;};}function handleError(_0x3c9588,_0x4b3aac){_0x4b3aac=_0x4b3aac||0x1f4;return function(_0x37cb11){logger['error'](_0x37cb11[_0x898a('0x36')]);if(_0x37cb11[_0x898a('0x37')]){delete _0x37cb11[_0x898a('0x37')];}_0x3c9588['status'](_0x4b3aac)['send'](_0x37cb11);};}exports['index']=function(_0x1575d2,_0x429c32){var _0x5a228f={},_0xdd019d={},_0x3d3463={'count':0x0,'rows':[]};var _0xe84f7e=_[_0x898a('0x38')](db['Trunk']['rawAttributes'],function(_0x3aed01){return{'name':_0x3aed01[_0x898a('0x39')],'type':_0x3aed01['type']['key']};});_0xdd019d[_0x898a('0x3a')]=_[_0x898a('0x38')](_0xe84f7e,_0x898a('0x37'));_0xdd019d[_0x898a('0x3b')]=_['keys'](_0x1575d2[_0x898a('0x3b')]);_0xdd019d[_0x898a('0x3c')]=_['intersection'](_0xdd019d['model'],_0xdd019d['query']);_0x5a228f[_0x898a('0x3d')]=_[_0x898a('0x3e')](_0xdd019d[_0x898a('0x3a')],qs[_0x898a('0x3f')](_0x1575d2[_0x898a('0x3b')][_0x898a('0x3f')]));_0x5a228f[_0x898a('0x3d')]=_0x5a228f[_0x898a('0x3d')][_0x898a('0x40')]?_0x5a228f[_0x898a('0x3d')]:_0xdd019d[_0x898a('0x3a')];if(!_0x1575d2[_0x898a('0x3b')][_0x898a('0x41')](_0x898a('0x42'))){_0x5a228f[_0x898a('0x29')]=qs['limit'](_0x1575d2[_0x898a('0x3b')][_0x898a('0x29')]);_0x5a228f[_0x898a('0x27')]=qs['offset'](_0x1575d2[_0x898a('0x3b')][_0x898a('0x27')]);}_0x5a228f[_0x898a('0x43')]=qs[_0x898a('0x44')](_0x1575d2[_0x898a('0x3b')][_0x898a('0x44')]);_0x5a228f[_0x898a('0x45')]=qs[_0x898a('0x3c')](_['pick'](_0x1575d2[_0x898a('0x3b')],_0xdd019d[_0x898a('0x3c')]),_0xe84f7e);if(_0x1575d2[_0x898a('0x3b')][_0x898a('0x46')]){_0x5a228f['where']=_[_0x898a('0x47')](_0x5a228f[_0x898a('0x45')],{'$or':_['map'](_0xe84f7e,function(_0x241677){if(_0x241677['type']!==_0x898a('0x48')){var _0x5137c4={};_0x5137c4[_0x241677['name']]={'$like':'%'+_0x1575d2[_0x898a('0x3b')]['filter']+'%'};return _0x5137c4;}})});}_0x5a228f=_[_0x898a('0x47')]({},_0x5a228f,_0x1575d2[_0x898a('0x49')]);var _0x4d6ac0={'where':_0x5a228f[_0x898a('0x45')]};return db[_0x898a('0x4a')]['count'](_0x4d6ac0)[_0x898a('0x31')](function(_0x199437){_0x3d3463[_0x898a('0x2a')]=_0x199437;if(_0x1575d2[_0x898a('0x3b')]['includeAll']){_0x5a228f[_0x898a('0x4b')]=[{'all':!![]}];}return db[_0x898a('0x4a')]['findAll'](_0x5a228f);})[_0x898a('0x31')](function(_0x1d8c16){_0x3d3463['rows']=_0x1d8c16;return _0x3d3463;})[_0x898a('0x31')](respondWithFilteredResult(_0x429c32,_0x5a228f))['catch'](handleError(_0x429c32,null));};exports[_0x898a('0x4c')]=function(_0x41f291,_0x32ccb9){var _0x50f9e3={'raw':![],'where':{'id':_0x41f291[_0x898a('0x4d')]['id']}},_0x2f6cb3={};_0x2f6cb3[_0x898a('0x3a')]=_[_0x898a('0x4e')](db['Trunk'][_0x898a('0x4f')]);_0x2f6cb3['query']=_[_0x898a('0x4e')](_0x41f291[_0x898a('0x3b')]);_0x2f6cb3[_0x898a('0x3c')]=_['intersection'](_0x2f6cb3[_0x898a('0x3a')],_0x2f6cb3[_0x898a('0x3b')]);_0x50f9e3[_0x898a('0x3d')]=_['intersection'](_0x2f6cb3['model'],qs[_0x898a('0x3f')](_0x41f291[_0x898a('0x3b')][_0x898a('0x3f')]));_0x50f9e3[_0x898a('0x3d')]=_0x50f9e3[_0x898a('0x3d')][_0x898a('0x40')]?_0x50f9e3[_0x898a('0x3d')]:_0x2f6cb3[_0x898a('0x3a')];if(_0x41f291[_0x898a('0x3b')][_0x898a('0x50')]){_0x50f9e3[_0x898a('0x4b')]=[{'all':!![]}];}_0x50f9e3=_['merge']({},_0x50f9e3,_0x41f291[_0x898a('0x49')]);return db[_0x898a('0x4a')]['find'](_0x50f9e3)[_0x898a('0x31')](handleEntityNotFound(_0x32ccb9,null))['then'](respondWithResult(_0x32ccb9,null))['catch'](handleError(_0x32ccb9,null));};exports[_0x898a('0x51')]=function(_0x124f9b,_0x209529){var _0x5bfd61={'where':{'id':_0x124f9b[_0x898a('0x4d')]['id']}},_0x556fd8={};_0x556fd8[_0x898a('0x3a')]=_['keys'](db[_0x898a('0x4a')][_0x898a('0x4f')]);_0x5bfd61['attributes']=_[_0x898a('0x3e')](_0x556fd8[_0x898a('0x3a')],qs[_0x898a('0x3f')](_0x124f9b['query'][_0x898a('0x3f')]));_0x5bfd61[_0x898a('0x3d')]=_0x5bfd61[_0x898a('0x3d')][_0x898a('0x40')]?_0x5bfd61[_0x898a('0x3d')]:_0x556fd8[_0x898a('0x3a')];if(_0x124f9b['query'][_0x898a('0x50')]){_0x5bfd61['include']=[{'all':!![]}];}_0x5bfd61=_[_0x898a('0x47')]({},_0x5bfd61,_0x124f9b[_0x898a('0x49')]);return db[_0x898a('0x4a')][_0x898a('0x52')](_0x5bfd61)[_0x898a('0x31')](handleEntityNotFound(_0x209529,null))[_0x898a('0x31')](function(_0x2486a5){if(_0x2486a5){var _0x75ff57=_0x2486a5[_0x898a('0x33')]({'plain':!![]});_0x75ff57=qs['omit'](_0x75ff57,['id',_0x898a('0x53'),_0x898a('0x54')]);_0x124f9b[_0x898a('0x55')]=_[_0x898a('0x56')](_0x124f9b[_0x898a('0x55')],['id',_0x898a('0x53'),_0x898a('0x54')]);return db[_0x898a('0x4a')][_0x898a('0x57')](_[_0x898a('0x47')](_0x75ff57,_0x124f9b[_0x898a('0x55')]),{'include':_0x124f9b[_0x898a('0x3b')][_0x898a('0x50')]?[{'all':!![]}]:undefined})[_0x898a('0x31')](function(_0x22f9ba){var _0x5f42ae=_0x124f9b[_0x898a('0x58')][_0x898a('0x33')]({'plain':!![]});if(!_0x5f42ae)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5f42ae[_0x898a('0x59')]===_0x898a('0x58')){var _0x5f0944=_0x22f9ba[_0x898a('0x33')]({'plain':!![]});var _0x1daecd=_0x898a('0x34');return db[_0x898a('0x5a')]['find']({'where':{'name':_0x1daecd,'userProfileId':_0x5f42ae[_0x898a('0x5b')]},'raw':!![]})[_0x898a('0x31')](function(_0x137935){if(_0x137935&&_0x137935[_0x898a('0x5c')]===0x0){return db['UserProfileResource'][_0x898a('0x57')]({'name':_0x5f0944[_0x898a('0x37')],'resourceId':_0x5f0944['id'],'type':_0x137935['name'],'sectionId':_0x137935['id']},{})[_0x898a('0x31')](function(){return _0x22f9ba;});}else{return _0x22f9ba;}})[_0x898a('0x23')](function(_0x5b7019){logger[_0x898a('0x1f')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5b7019);throw _0x5b7019;});}return _0x22f9ba;});}})[_0x898a('0x31')](respondWithResult(_0x209529,0xc9))['catch'](handleError(_0x209529,null));};exports['create']=function(_0x5ed35e,_0xfdd6d8,_0x473f5c){var _0x3909c5;return db[_0x898a('0x4a')]['create'](_0x5ed35e['body'],{'raw':!![]})[_0x898a('0x31')](function(_0x232be0){_0x3909c5=_0x232be0;return db[_0x898a('0x4a')][_0x898a('0x5d')]({'raw':!![]});})[_0x898a('0x31')](function(_0x41cf94){var _0x30051d=fs[_0x898a('0x5e')](path['join'](config[_0x898a('0x5f')],_0x898a('0x60')),'utf8');var _0x42fda8=fs[_0x898a('0x5e')](path[_0x898a('0x61')](config[_0x898a('0x5f')],_0x898a('0x62')),_0x898a('0x63'));var _0x3bcc3d=ejs[_0x898a('0x64')](_0x30051d,{'trunks':_0x41cf94||[]});fs[_0x898a('0x65')](_0x898a('0x66'),_0x3bcc3d);if(_0x3909c5[_0x898a('0x67')]){var _0x307849=ejs[_0x898a('0x64')](_0x42fda8,{'trunks':_0x41cf94||[]});fs['writeFileSync'](_0x898a('0x68'),_0x307849);}})['then'](function(){return respondWithRpcPromise(_0x898a('0x69'),_0x898a('0x57'),{'module':_0x898a('0x6a')});})['then'](function(){var _0x31102d=_0x5ed35e[_0x898a('0x58')][_0x898a('0x33')]({'plain':!![]});if(!_0x31102d)throw new Error(_0x898a('0x6b'));if(_0x31102d[_0x898a('0x59')]==='user'){var _0x4b9487=_0x3909c5[_0x898a('0x33')]({'plain':!![]});return db[_0x898a('0x5a')][_0x898a('0x52')]({'where':{'name':_0x898a('0x34'),'userProfileId':_0x31102d['userProfileId']},'raw':!![]})[_0x898a('0x31')](function(_0x3d3451){if(_0x3d3451&&_0x3d3451[_0x898a('0x5c')]===0x0){return db[_0x898a('0x35')][_0x898a('0x57')]({'name':_0x4b9487[_0x898a('0x37')],'resourceId':_0x4b9487['id'],'type':_0x3d3451[_0x898a('0x37')],'sectionId':_0x3d3451['id']},{})[_0x898a('0x31')](function(){return _0x3909c5;});}else{return _0x3909c5;}})['catch'](function(_0x32a207){logger[_0x898a('0x1f')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x32a207);throw _0x32a207;});}return _0x3909c5;})[_0x898a('0x31')](respondWithResult(_0xfdd6d8,0xc9))['catch'](handleError(_0xfdd6d8,null));};exports[_0x898a('0x30')]=function(_0x4b2575,_0x2471d8,_0x387f2c){var _0x3b07dc;return db[_0x898a('0x4a')][_0x898a('0x52')]({'where':{'id':_0x4b2575[_0x898a('0x4d')]['id']}})[_0x898a('0x31')](handleEntityNotFound(_0x2471d8,null))[_0x898a('0x31')](saveUpdates(_0x4b2575[_0x898a('0x55')],null))['then'](function(_0x3fe54b){if(_0x3fe54b){_0x3b07dc=_0x3fe54b;return db[_0x898a('0x4a')][_0x898a('0x5d')]({'raw':!![]});}})[_0x898a('0x31')](function(_0x290972){if(_0x290972){var _0x1d594b=fs[_0x898a('0x5e')](path[_0x898a('0x61')](config[_0x898a('0x5f')],_0x898a('0x60')),'utf8');var _0x4fad03=fs[_0x898a('0x5e')](path[_0x898a('0x61')](config['root'],'server/files/templates/registry.ejs'),_0x898a('0x63'));var _0x4a79a4=ejs[_0x898a('0x64')](_0x1d594b,{'trunks':_0x290972||[]});fs[_0x898a('0x65')]('/etc/asterisk/sip_xcally_trunks.conf',_0x4a79a4);var _0x3f6815=ejs[_0x898a('0x64')](_0x4fad03,{'trunks':_0x290972||[]});fs[_0x898a('0x65')](_0x898a('0x68'),_0x3f6815);return respondWithRpcPromise(_0x898a('0x69'),_0x898a('0x30'),{'module':_0x898a('0x6a')});}return null;})['then'](function(_0x3237e8){if(_0x3237e8){return _0x3b07dc;}})[_0x898a('0x31')](respondWithResult(_0x2471d8,null))[_0x898a('0x23')](handleError(_0x2471d8,null));};exports['destroy']=function(_0x27560f,_0x61247c,_0x5c6247){var _0x39e917;return db['Trunk']['find']({'where':{'id':_0x27560f['params']['id']}})[_0x898a('0x31')](handleEntityNotFound(_0x61247c,null))[_0x898a('0x31')](removeEntity(_0x61247c,null))[_0x898a('0x31')](function(){return db[_0x898a('0x4a')][_0x898a('0x5d')]({'raw':!![]});})[_0x898a('0x31')](function(_0x12e54b){var _0x50dd52=fs[_0x898a('0x5e')](path['join'](config[_0x898a('0x5f')],_0x898a('0x60')),'utf8');var _0x24670c=fs[_0x898a('0x5e')](path[_0x898a('0x61')](config[_0x898a('0x5f')],_0x898a('0x62')),'utf8');var _0x5847cb=ejs['render'](_0x50dd52,{'trunks':_0x12e54b});var _0x3b8fb5=ejs[_0x898a('0x64')](_0x24670c,{'trunks':_0x12e54b});fs[_0x898a('0x65')]('/etc/asterisk/sip_xcally_trunks.conf',_0x5847cb);fs[_0x898a('0x65')]('/etc/asterisk/sip_xcally_registers.conf',_0x3b8fb5);return respondWithRpcPromise('Reload',_0x898a('0x32'),{'module':_0x898a('0x6a')});})[_0x898a('0x23')](handleError(_0x61247c,null));}; \ No newline at end of file +var _0x9a19=['query','keys','filters','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','show','include','find','clone','params','omit','updatedAt','body','createdAt','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','join','server/files/templates/trunk.ejs','utf8','root','server/files/templates/registry.ejs','/etc/asterisk/sip_xcally_trunks.conf','registry','render','/etc/asterisk/sip_xcally_registers.conf','chan_sip.so','role','autoAssociation','findAll','readFileSync','writeFileSync','Reload','update','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','then','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','destroy','get','Trunks','UserProfileResource','stack','name','index','map','Trunk','rawAttributes','fieldName','type'];(function(_0x36c230,_0x1c7cfd){var _0x321e0e=function(_0xf13413){while(--_0xf13413){_0x36c230['push'](_0x36c230['shift']());}};_0x321e0e(++_0x1c7cfd);}(_0x9a19,0x114));var _0x99a1=function(_0x4eafed,_0x26e2bc){_0x4eafed=_0x4eafed-0x0;var _0x159c85=_0x9a19[_0x4eafed];return _0x159c85;};'use strict';var emlformat=require(_0x99a1('0x0'));var rimraf=require(_0x99a1('0x1'));var zipdir=require(_0x99a1('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x99a1('0x3'));var moment=require(_0x99a1('0x4'));var BPromise=require(_0x99a1('0x5'));var Mustache=require(_0x99a1('0x6'));var util=require(_0x99a1('0x7'));var path=require(_0x99a1('0x8'));var sox=require(_0x99a1('0x9'));var csv=require(_0x99a1('0xa'));var ejs=require(_0x99a1('0xb'));var fs=require('fs');var fs_extra=require(_0x99a1('0xc'));var _=require(_0x99a1('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x99a1('0xe'));var toCsv=require(_0x99a1('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x99a1('0xf'));var authService=require(_0x99a1('0x10'));var qs=require(_0x99a1('0x11'));var as=require(_0x99a1('0x12'));var hardwareService=require(_0x99a1('0x13'));var logger=require('../../config/logger')(_0x99a1('0x14'));var utils=require(_0x99a1('0x15'));var config=require(_0x99a1('0x16'));var licenseUtil=require(_0x99a1('0x17'));var db=require(_0x99a1('0x18'))['db'];var jayson=require(_0x99a1('0x19'));var client=jayson[_0x99a1('0x1a')][_0x99a1('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0xf713b9,_0x40c19c,_0x3a865c,_0x47815e){return new BPromise(function(_0xe1a1f,_0x3c9ef4){var _0x39ee55=_0x47815e||client;return _0x39ee55['request'](_0xf713b9,_0x3a865c)[_0x99a1('0x1c')](function(_0x3e45d4){logger[_0x99a1('0x1d')](_0x99a1('0x1e'),_0x40c19c,_0x99a1('0x1f'));logger[_0x99a1('0x20')](_0x99a1('0x21'),_0x40c19c,'request\x20sent',JSON['stringify'](_0x3e45d4));if(_0x3e45d4[_0x99a1('0x22')]){if(_0x3e45d4[_0x99a1('0x22')][_0x99a1('0x23')]===0x1f4){logger[_0x99a1('0x22')](_0x99a1('0x1e'),_0x40c19c,_0x3e45d4[_0x99a1('0x22')][_0x99a1('0x24')]);return _0x3c9ef4(_0x3e45d4[_0x99a1('0x22')][_0x99a1('0x24')]);}logger[_0x99a1('0x22')](_0x99a1('0x1e'),_0x40c19c,_0x3e45d4['error'][_0x99a1('0x24')]);return _0xe1a1f(_0x3e45d4[_0x99a1('0x22')]['message']);}else{logger[_0x99a1('0x1d')]('Trunk,\x20%s,\x20%s',_0x40c19c,_0x99a1('0x1f'));_0xe1a1f(_0x3e45d4[_0x99a1('0x25')][_0x99a1('0x24')]);}})[_0x99a1('0x26')](function(_0x5a88c6){logger[_0x99a1('0x22')](_0x99a1('0x1e'),_0x40c19c,_0x5a88c6);_0x3c9ef4(_0x5a88c6);});});}function respondWithStatusCode(_0x483c17,_0x44df2d){_0x44df2d=_0x44df2d||0xcc;return function(_0x5b5dfa){if(_0x5b5dfa){return _0x483c17[_0x99a1('0x27')](_0x44df2d);}return _0x483c17[_0x99a1('0x28')](_0x44df2d)[_0x99a1('0x29')]();};}function respondWithResult(_0xdaa27d,_0x3c813){_0x3c813=_0x3c813||0xc8;return function(_0x491341){if(_0x491341){return _0xdaa27d['status'](_0x3c813)[_0x99a1('0x2a')](_0x491341);}};}function respondWithFilteredResult(_0x5dabd9,_0x5dc733){return function(_0xafea84){if(_0xafea84){var _0x440879=typeof _0x5dc733[_0x99a1('0x2b')]===_0x99a1('0x2c')&&typeof _0x5dc733[_0x99a1('0x2d')]===_0x99a1('0x2c');var _0x183037=_0xafea84['count'];var _0xf41b0d=_0x440879?0x0:_0x5dc733['offset'];var _0x255197=_0x440879?_0xafea84[_0x99a1('0x2e')]:_0x5dc733[_0x99a1('0x2b')]+_0x5dc733['limit'];var _0x371edf;if(_0x255197>=_0x183037){_0x255197=_0x183037;_0x371edf=0xc8;}else{_0x371edf=0xce;}_0x5dabd9[_0x99a1('0x28')](_0x371edf);return _0x5dabd9['set'](_0x99a1('0x2f'),_0xf41b0d+'-'+_0x255197+'/'+_0x183037)[_0x99a1('0x2a')](_0xafea84);}return null;};}function patchUpdates(_0x36aa34){return function(_0x303d1e){try{jsonpatch[_0x99a1('0x30')](_0x303d1e,_0x36aa34,!![]);}catch(_0x969f6e){return BPromise[_0x99a1('0x31')](_0x969f6e);}return _0x303d1e[_0x99a1('0x32')]();};}function saveUpdates(_0x52da8d,_0x4960e4){return function(_0x3fa342){if(_0x3fa342){return _0x3fa342['update'](_0x52da8d)[_0x99a1('0x1c')](function(_0x400581){return _0x400581;});}return null;};}function removeEntity(_0x5b1a79,_0xa5972b){return function(_0x3503d5){if(_0x3503d5){return _0x3503d5[_0x99a1('0x33')]()[_0x99a1('0x1c')](function(){var _0x13f4db=_0x3503d5[_0x99a1('0x34')]({'plain':!![]});var _0x3081cd=_0x99a1('0x35');return db[_0x99a1('0x36')][_0x99a1('0x33')]({'where':{'type':_0x3081cd,'resourceId':_0x13f4db['id']}})[_0x99a1('0x1c')](function(){return _0x3503d5;});})[_0x99a1('0x1c')](function(){_0x5b1a79[_0x99a1('0x28')](0xcc)[_0x99a1('0x29')]();});}};}function handleEntityNotFound(_0x55005e,_0x53fed5){return function(_0x46e3f2){if(!_0x46e3f2){_0x55005e[_0x99a1('0x27')](0x194);}return _0x46e3f2;};}function handleError(_0x416a36,_0x4131e0){_0x4131e0=_0x4131e0||0x1f4;return function(_0x2690bd){logger[_0x99a1('0x22')](_0x2690bd[_0x99a1('0x37')]);if(_0x2690bd['name']){delete _0x2690bd[_0x99a1('0x38')];}_0x416a36[_0x99a1('0x28')](_0x4131e0)['send'](_0x2690bd);};}exports[_0x99a1('0x39')]=function(_0x2d328c,_0x391afa){var _0x3cd1a0={},_0x430cbc={},_0x399fd4={'count':0x0,'rows':[]};var _0x30e8a9=_[_0x99a1('0x3a')](db[_0x99a1('0x3b')][_0x99a1('0x3c')],function(_0x1da3e7){return{'name':_0x1da3e7[_0x99a1('0x3d')],'type':_0x1da3e7[_0x99a1('0x3e')]['key']};});_0x430cbc['model']=_['map'](_0x30e8a9,_0x99a1('0x38'));_0x430cbc[_0x99a1('0x3f')]=_[_0x99a1('0x40')](_0x2d328c[_0x99a1('0x3f')]);_0x430cbc[_0x99a1('0x41')]=_['intersection'](_0x430cbc[_0x99a1('0x42')],_0x430cbc[_0x99a1('0x3f')]);_0x3cd1a0[_0x99a1('0x43')]=_['intersection'](_0x430cbc['model'],qs[_0x99a1('0x44')](_0x2d328c[_0x99a1('0x3f')][_0x99a1('0x44')]));_0x3cd1a0['attributes']=_0x3cd1a0[_0x99a1('0x43')][_0x99a1('0x45')]?_0x3cd1a0[_0x99a1('0x43')]:_0x430cbc[_0x99a1('0x42')];if(!_0x2d328c[_0x99a1('0x3f')][_0x99a1('0x46')](_0x99a1('0x47'))){_0x3cd1a0[_0x99a1('0x2d')]=qs[_0x99a1('0x2d')](_0x2d328c[_0x99a1('0x3f')]['limit']);_0x3cd1a0[_0x99a1('0x2b')]=qs[_0x99a1('0x2b')](_0x2d328c[_0x99a1('0x3f')]['offset']);}_0x3cd1a0[_0x99a1('0x48')]=qs['sort'](_0x2d328c[_0x99a1('0x3f')][_0x99a1('0x49')]);_0x3cd1a0[_0x99a1('0x4a')]=qs[_0x99a1('0x41')](_[_0x99a1('0x4b')](_0x2d328c[_0x99a1('0x3f')],_0x430cbc['filters']),_0x30e8a9);if(_0x2d328c[_0x99a1('0x3f')]['filter']){_0x3cd1a0[_0x99a1('0x4a')]=_[_0x99a1('0x4c')](_0x3cd1a0[_0x99a1('0x4a')],{'$or':_[_0x99a1('0x3a')](_0x30e8a9,function(_0x3a0b44){if(_0x3a0b44[_0x99a1('0x3e')]!==_0x99a1('0x4d')){var _0x3861b6={};_0x3861b6[_0x3a0b44[_0x99a1('0x38')]]={'$like':'%'+_0x2d328c[_0x99a1('0x3f')][_0x99a1('0x4e')]+'%'};return _0x3861b6;}})});}_0x3cd1a0=_['merge']({},_0x3cd1a0,_0x2d328c[_0x99a1('0x4f')]);var _0x330e3b={'where':_0x3cd1a0['where']};return db[_0x99a1('0x3b')][_0x99a1('0x2e')](_0x330e3b)[_0x99a1('0x1c')](function(_0x2e377b){_0x399fd4[_0x99a1('0x2e')]=_0x2e377b;if(_0x2d328c[_0x99a1('0x3f')][_0x99a1('0x50')]){_0x3cd1a0['include']=[{'all':!![]}];}return db[_0x99a1('0x3b')]['findAll'](_0x3cd1a0);})[_0x99a1('0x1c')](function(_0x269798){_0x399fd4['rows']=_0x269798;return _0x399fd4;})['then'](respondWithFilteredResult(_0x391afa,_0x3cd1a0))[_0x99a1('0x26')](handleError(_0x391afa,null));};exports[_0x99a1('0x51')]=function(_0x462c15,_0x4519fb){var _0xee2b1b={'raw':![],'where':{'id':_0x462c15['params']['id']}},_0x597836={};_0x597836['model']=_[_0x99a1('0x40')](db[_0x99a1('0x3b')][_0x99a1('0x3c')]);_0x597836[_0x99a1('0x3f')]=_[_0x99a1('0x40')](_0x462c15[_0x99a1('0x3f')]);_0x597836[_0x99a1('0x41')]=_['intersection'](_0x597836[_0x99a1('0x42')],_0x597836[_0x99a1('0x3f')]);_0xee2b1b[_0x99a1('0x43')]=_['intersection'](_0x597836[_0x99a1('0x42')],qs['fields'](_0x462c15['query'][_0x99a1('0x44')]));_0xee2b1b[_0x99a1('0x43')]=_0xee2b1b[_0x99a1('0x43')][_0x99a1('0x45')]?_0xee2b1b[_0x99a1('0x43')]:_0x597836[_0x99a1('0x42')];if(_0x462c15[_0x99a1('0x3f')][_0x99a1('0x50')]){_0xee2b1b[_0x99a1('0x52')]=[{'all':!![]}];}_0xee2b1b=_['merge']({},_0xee2b1b,_0x462c15[_0x99a1('0x4f')]);return db['Trunk'][_0x99a1('0x53')](_0xee2b1b)[_0x99a1('0x1c')](handleEntityNotFound(_0x4519fb,null))['then'](respondWithResult(_0x4519fb,null))[_0x99a1('0x26')](handleError(_0x4519fb,null));};exports[_0x99a1('0x54')]=function(_0x469e10,_0x2b2d63){var _0x2800d5={'where':{'id':_0x469e10[_0x99a1('0x55')]['id']}},_0x1bff78={};_0x1bff78[_0x99a1('0x42')]=_[_0x99a1('0x40')](db[_0x99a1('0x3b')][_0x99a1('0x3c')]);_0x2800d5[_0x99a1('0x43')]=_['intersection'](_0x1bff78['model'],qs[_0x99a1('0x44')](_0x469e10[_0x99a1('0x3f')][_0x99a1('0x44')]));_0x2800d5[_0x99a1('0x43')]=_0x2800d5[_0x99a1('0x43')]['length']?_0x2800d5[_0x99a1('0x43')]:_0x1bff78[_0x99a1('0x42')];if(_0x469e10['query'][_0x99a1('0x50')]){_0x2800d5[_0x99a1('0x52')]=[{'all':!![]}];}_0x2800d5=_[_0x99a1('0x4c')]({},_0x2800d5,_0x469e10[_0x99a1('0x4f')]);return db[_0x99a1('0x3b')]['find'](_0x2800d5)[_0x99a1('0x1c')](handleEntityNotFound(_0x2b2d63,null))[_0x99a1('0x1c')](function(_0x1bb1cb){if(_0x1bb1cb){var _0x22811f=_0x1bb1cb[_0x99a1('0x34')]({'plain':!![]});_0x22811f=qs[_0x99a1('0x56')](_0x22811f,['id','createdAt',_0x99a1('0x57')]);_0x469e10[_0x99a1('0x58')]=_['omit'](_0x469e10[_0x99a1('0x58')],['id',_0x99a1('0x59'),_0x99a1('0x57')]);return db[_0x99a1('0x3b')][_0x99a1('0x5a')](_['merge'](_0x22811f,_0x469e10[_0x99a1('0x58')]),{'include':_0x469e10['query']['includeAll']?[{'all':!![]}]:undefined})['then'](function(_0x38ce3c){var _0x3f7c16=_0x469e10['user']['get']({'plain':!![]});if(!_0x3f7c16)throw new Error(_0x99a1('0x5b'));if(_0x3f7c16['role']===_0x99a1('0x5c')){var _0x263db3=_0x38ce3c[_0x99a1('0x34')]({'plain':!![]});var _0x180c1e='Trunks';return db[_0x99a1('0x5d')][_0x99a1('0x53')]({'where':{'name':_0x180c1e,'userProfileId':_0x3f7c16[_0x99a1('0x5e')]},'raw':!![]})['then'](function(_0x3a62c6){if(_0x3a62c6&&_0x3a62c6['autoAssociation']===0x0){return db[_0x99a1('0x36')][_0x99a1('0x5a')]({'name':_0x263db3[_0x99a1('0x38')],'resourceId':_0x263db3['id'],'type':_0x3a62c6[_0x99a1('0x38')],'sectionId':_0x3a62c6['id']},{})[_0x99a1('0x1c')](function(){return _0x38ce3c;});}else{return _0x38ce3c;}})['catch'](function(_0x4d37f8){logger['error'](_0x99a1('0x5f'),_0x4d37f8);throw _0x4d37f8;});}return _0x38ce3c;});}})[_0x99a1('0x1c')](respondWithResult(_0x2b2d63,0xc9))['catch'](handleError(_0x2b2d63,null));};exports['create']=function(_0x1fe7af,_0x2f5587,_0x401c8f){var _0x509d4f;return db['Trunk'][_0x99a1('0x5a')](_0x1fe7af['body'],{'raw':!![]})[_0x99a1('0x1c')](function(_0x129690){_0x509d4f=_0x129690;return db[_0x99a1('0x3b')]['findAll']({'raw':!![]});})[_0x99a1('0x1c')](function(_0x28c7d8){var _0x4ac99e=fs['readFileSync'](path[_0x99a1('0x60')](config['root'],_0x99a1('0x61')),_0x99a1('0x62'));var _0x30a0a5=fs['readFileSync'](path[_0x99a1('0x60')](config[_0x99a1('0x63')],_0x99a1('0x64')),_0x99a1('0x62'));var _0x3d0ff6=ejs['render'](_0x4ac99e,{'trunks':_0x28c7d8||[]});fs['writeFileSync'](_0x99a1('0x65'),_0x3d0ff6);if(_0x509d4f[_0x99a1('0x66')]){var _0x1750d5=ejs[_0x99a1('0x67')](_0x30a0a5,{'trunks':_0x28c7d8||[]});fs['writeFileSync'](_0x99a1('0x68'),_0x1750d5);}})['then'](function(){return respondWithRpcPromise('Reload',_0x99a1('0x5a'),{'module':_0x99a1('0x69')});})[_0x99a1('0x1c')](function(){var _0x525969=_0x1fe7af[_0x99a1('0x5c')][_0x99a1('0x34')]({'plain':!![]});if(!_0x525969)throw new Error(_0x99a1('0x5b'));if(_0x525969[_0x99a1('0x6a')]===_0x99a1('0x5c')){var _0x4ae313=_0x509d4f[_0x99a1('0x34')]({'plain':!![]});return db[_0x99a1('0x5d')][_0x99a1('0x53')]({'where':{'name':_0x99a1('0x35'),'userProfileId':_0x525969[_0x99a1('0x5e')]},'raw':!![]})[_0x99a1('0x1c')](function(_0x5e42be){if(_0x5e42be&&_0x5e42be[_0x99a1('0x6b')]===0x0){return db[_0x99a1('0x36')][_0x99a1('0x5a')]({'name':_0x4ae313[_0x99a1('0x38')],'resourceId':_0x4ae313['id'],'type':_0x5e42be[_0x99a1('0x38')],'sectionId':_0x5e42be['id']},{})['then'](function(){return _0x509d4f;});}else{return _0x509d4f;}})[_0x99a1('0x26')](function(_0x68c944){logger[_0x99a1('0x22')](_0x99a1('0x5f'),_0x68c944);throw _0x68c944;});}return _0x509d4f;})[_0x99a1('0x1c')](respondWithResult(_0x2f5587,0xc9))[_0x99a1('0x26')](handleError(_0x2f5587,null));};exports['update']=function(_0xaa953e,_0x33d96b,_0x4a5617){var _0x56716a;return db[_0x99a1('0x3b')][_0x99a1('0x53')]({'where':{'id':_0xaa953e['params']['id']}})[_0x99a1('0x1c')](handleEntityNotFound(_0x33d96b,null))[_0x99a1('0x1c')](saveUpdates(_0xaa953e[_0x99a1('0x58')],null))[_0x99a1('0x1c')](function(_0x43156f){if(_0x43156f){_0x56716a=_0x43156f;return db[_0x99a1('0x3b')][_0x99a1('0x6c')]({'raw':!![]});}})[_0x99a1('0x1c')](function(_0x4260d7){if(_0x4260d7){var _0x3e099c=fs[_0x99a1('0x6d')](path[_0x99a1('0x60')](config[_0x99a1('0x63')],'server/files/templates/trunk.ejs'),_0x99a1('0x62'));var _0x5a9a7d=fs['readFileSync'](path[_0x99a1('0x60')](config[_0x99a1('0x63')],_0x99a1('0x64')),_0x99a1('0x62'));var _0xbbbe26=ejs[_0x99a1('0x67')](_0x3e099c,{'trunks':_0x4260d7||[]});fs[_0x99a1('0x6e')](_0x99a1('0x65'),_0xbbbe26);var _0x361ce6=ejs['render'](_0x5a9a7d,{'trunks':_0x4260d7||[]});fs[_0x99a1('0x6e')](_0x99a1('0x68'),_0x361ce6);return respondWithRpcPromise(_0x99a1('0x6f'),_0x99a1('0x70'),{'module':_0x99a1('0x69')});}return null;})[_0x99a1('0x1c')](function(_0x6dab29){if(_0x6dab29){return _0x56716a;}})[_0x99a1('0x1c')](respondWithResult(_0x33d96b,null))['catch'](handleError(_0x33d96b,null));};exports['destroy']=function(_0x51c289,_0x2dd29b,_0x353f25){var _0x53cdb3;return db[_0x99a1('0x3b')][_0x99a1('0x53')]({'where':{'id':_0x51c289[_0x99a1('0x55')]['id']}})[_0x99a1('0x1c')](handleEntityNotFound(_0x2dd29b,null))['then'](removeEntity(_0x2dd29b,null))[_0x99a1('0x1c')](function(){return db[_0x99a1('0x3b')][_0x99a1('0x6c')]({'raw':!![]});})[_0x99a1('0x1c')](function(_0x4e9fe9){var _0x24aa05=fs['readFileSync'](path['join'](config['root'],_0x99a1('0x61')),'utf8');var _0xb7744c=fs[_0x99a1('0x6d')](path[_0x99a1('0x60')](config[_0x99a1('0x63')],_0x99a1('0x64')),_0x99a1('0x62'));var _0x444e43=ejs['render'](_0x24aa05,{'trunks':_0x4e9fe9});var _0x4fcd65=ejs[_0x99a1('0x67')](_0xb7744c,{'trunks':_0x4e9fe9});fs[_0x99a1('0x6e')](_0x99a1('0x65'),_0x444e43);fs['writeFileSync'](_0x99a1('0x68'),_0x4fcd65);return respondWithRpcPromise(_0x99a1('0x6f'),_0x99a1('0x33'),{'module':'chan_sip.so'});})[_0x99a1('0x26')](handleError(_0x2dd29b,null));}; \ No newline at end of file diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index cd61514..899853e 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 _0x6ea1=['./trunk.attributes','exports','Trunk','tools_trunks','lodash','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment'];(function(_0x31302c,_0x5d81a3){var _0x549890=function(_0x90e221){while(--_0x90e221){_0x31302c['push'](_0x31302c['shift']());}};_0x549890(++_0x5d81a3);}(_0x6ea1,0x100));var _0x16ea=function(_0x3fa620,_0x150e24){_0x3fa620=_0x3fa620-0x0;var _0x393e58=_0x6ea1[_0x3fa620];return _0x393e58;};'use strict';var _=require(_0x16ea('0x0'));var util=require(_0x16ea('0x1'));var logger=require(_0x16ea('0x2'))(_0x16ea('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x16ea('0x4'));var fs=require('fs');var path=require(_0x16ea('0x5'));var rimraf=require(_0x16ea('0x6'));var config=require(_0x16ea('0x7'));var attributes=require(_0x16ea('0x8'));module[_0x16ea('0x9')]=function(_0x3ee485,_0x597a8b){return _0x3ee485['define'](_0x16ea('0xa'),attributes,{'tableName':_0x16ea('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf225=['rimraf','./trunk.attributes','define','Trunk','util','../../config/logger','api'];(function(_0x4753b7,_0x2660d1){var _0x3e6fa9=function(_0x4877c1){while(--_0x4877c1){_0x4753b7['push'](_0x4753b7['shift']());}};_0x3e6fa9(++_0x2660d1);}(_0xf225,0x6d));var _0x5f22=function(_0x48d9fb,_0x1f8af9){_0x48d9fb=_0x48d9fb-0x0;var _0x3a39fe=_0xf225[_0x48d9fb];return _0x3a39fe;};'use strict';var _=require('lodash');var util=require(_0x5f22('0x0'));var logger=require(_0x5f22('0x1'))(_0x5f22('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x5f22('0x3'));var config=require('../../config/environment');var attributes=require(_0x5f22('0x4'));module['exports']=function(_0x43a02e,_0x51c3be){return _0x43a02e[_0x5f22('0x5')](_0x5f22('0x6'),attributes,{'tableName':'tools_trunks','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/trunk/trunk.rpc.js b/server/api/trunk/trunk.rpc.js index dd3a41e..3012d91 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 _0x59a0=['raw','where','limit','include','map','model','attributes','ShowTrunk','Trunk','find','debug','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','stringify','error','code','message','Trunk,\x20%s,\x20%s','result','catch','GetTrunk','findAll','options'];(function(_0x21c424,_0x4083ab){var _0x9b6900=function(_0x48d3e2){while(--_0x48d3e2){_0x21c424['push'](_0x21c424['shift']());}};_0x9b6900(++_0x4083ab);}(_0x59a0,0xbf));var _0x059a=function(_0x5bbc59,_0x77aa05){_0x5bbc59=_0x5bbc59-0x0;var _0x27a027=_0x59a0[_0x5bbc59];return _0x27a027;};'use strict';var _=require(_0x059a('0x0'));var util=require('util');var moment=require(_0x059a('0x1'));var BPromise=require(_0x059a('0x2'));var rs=require(_0x059a('0x3'));var fs=require('fs');var Redis=require(_0x059a('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x059a('0x5'));var logger=require(_0x059a('0x6'))(_0x059a('0x7'));var config=require(_0x059a('0x8'));var jayson=require(_0x059a('0x9'));var client=jayson[_0x059a('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1966c2,_0x36104a,_0x17536a){return new BPromise(function(_0x1f9af7,_0x6edeba){return client[_0x059a('0xb')](_0x1966c2,_0x17536a)[_0x059a('0xc')](function(_0x494899){logger[_0x059a('0xd')]('Trunk,\x20%s,\x20%s',_0x36104a,'request\x20sent');logger['debug']('Trunk,\x20%s,\x20%s,\x20%s',_0x36104a,_0x059a('0xe'),JSON[_0x059a('0xf')](_0x494899));if(_0x494899[_0x059a('0x10')]){if(_0x494899[_0x059a('0x10')][_0x059a('0x11')]===0x1f4){logger[_0x059a('0x10')]('Trunk,\x20%s,\x20%s',_0x36104a,_0x494899['error'][_0x059a('0x12')]);return _0x6edeba(_0x494899['error']['message']);}logger[_0x059a('0x10')](_0x059a('0x13'),_0x36104a,_0x494899[_0x059a('0x10')][_0x059a('0x12')]);return _0x1f9af7(_0x494899[_0x059a('0x10')][_0x059a('0x12')]);}else{logger[_0x059a('0xd')](_0x059a('0x13'),_0x36104a,_0x059a('0xe'));_0x1f9af7(_0x494899[_0x059a('0x14')][_0x059a('0x12')]);}})[_0x059a('0x15')](function(_0x482135){logger[_0x059a('0x10')](_0x059a('0x13'),_0x36104a,_0x482135);_0x6edeba(_0x482135);});});}exports[_0x059a('0x16')]=function(_0xab3023){var _0x11f0bb=this;return new Promise(function(_0x3cdcc7,_0x49634d){return db['Trunk'][_0x059a('0x17')]({'raw':_0xab3023['options']?_0xab3023[_0x059a('0x18')][_0x059a('0x19')]===undefined?!![]:![]:!![],'where':_0xab3023[_0x059a('0x18')]?_0xab3023['options'][_0x059a('0x1a')]||null:null,'attributes':_0xab3023['options']?_0xab3023[_0x059a('0x18')]['attributes']||null:null,'limit':_0xab3023[_0x059a('0x18')]?_0xab3023['options'][_0x059a('0x1b')]||null:null,'include':_0xab3023[_0x059a('0x18')]?_0xab3023['options'][_0x059a('0x1c')]?_[_0x059a('0x1d')](_0xab3023['options'][_0x059a('0x1c')],function(_0x4f23a3){return{'model':db[_0x4f23a3[_0x059a('0x1e')]],'as':_0x4f23a3['as'],'attributes':_0x4f23a3[_0x059a('0x1f')],'include':_0x4f23a3['include']?_[_0x059a('0x1d')](_0x4f23a3[_0x059a('0x1c')],function(_0xea7ac4){return{'model':db[_0xea7ac4['model']],'as':_0xea7ac4['as'],'attributes':_0xea7ac4[_0x059a('0x1f')],'include':_0xea7ac4['include']?_['map'](_0xea7ac4[_0x059a('0x1c')],function(_0x3711f4){return{'model':db[_0x3711f4[_0x059a('0x1e')]],'as':_0x3711f4['as'],'attributes':_0x3711f4[_0x059a('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x059a('0xc')](function(_0x34455f){logger[_0x059a('0xd')](_0x059a('0x16'),_0xab3023);logger['debug'](_0x059a('0x16'),_0xab3023,JSON[_0x059a('0xf')](_0x34455f));_0x3cdcc7(_0x34455f);})[_0x059a('0x15')](function(_0x1d179b){logger[_0x059a('0x10')]('GetTrunk',_0x1d179b[_0x059a('0x12')],_0xab3023);_0x49634d(_0x11f0bb[_0x059a('0x10')](0x1f4,_0x1d179b[_0x059a('0x12')]));});});};exports[_0x059a('0x20')]=function(_0x3cadfd){var _0x33b612=this;return new Promise(function(_0x5b50d7,_0x59db67){return db[_0x059a('0x21')][_0x059a('0x22')]({'raw':_0x3cadfd[_0x059a('0x18')]?_0x3cadfd[_0x059a('0x18')][_0x059a('0x19')]===undefined?!![]:![]:!![],'where':_0x3cadfd[_0x059a('0x18')]?_0x3cadfd['options'][_0x059a('0x1a')]||null:null,'attributes':_0x3cadfd[_0x059a('0x18')]?_0x3cadfd[_0x059a('0x18')][_0x059a('0x1f')]||null:null,'include':_0x3cadfd[_0x059a('0x18')]?_0x3cadfd[_0x059a('0x18')][_0x059a('0x1c')]?_['map'](_0x3cadfd[_0x059a('0x18')][_0x059a('0x1c')],function(_0x122b4a){return{'model':db[_0x122b4a[_0x059a('0x1e')]],'as':_0x122b4a['as'],'attributes':_0x122b4a[_0x059a('0x1f')],'include':_0x122b4a[_0x059a('0x1c')]?_[_0x059a('0x1d')](_0x122b4a[_0x059a('0x1c')],function(_0x2162ca){return{'model':db[_0x2162ca[_0x059a('0x1e')]],'as':_0x2162ca['as'],'attributes':_0x2162ca[_0x059a('0x1f')],'include':_0x2162ca[_0x059a('0x1c')]?_[_0x059a('0x1d')](_0x2162ca[_0x059a('0x1c')],function(_0x362d88){return{'model':db[_0x362d88[_0x059a('0x1e')]],'as':_0x362d88['as'],'attributes':_0x362d88[_0x059a('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x555c03){logger[_0x059a('0xd')](_0x059a('0x20'),_0x3cadfd);logger[_0x059a('0x23')](_0x059a('0x20'),_0x3cadfd,JSON[_0x059a('0xf')](_0x555c03));_0x5b50d7(_0x555c03);})[_0x059a('0x15')](function(_0x3f67d8){logger[_0x059a('0x10')](_0x059a('0x20'),_0x3f67d8['message'],_0x3cadfd);_0x59db67(_0x33b612[_0x059a('0x10')](0x1f4,_0x3f67d8[_0x059a('0x12')]));});});}; \ No newline at end of file +var _0x6991=['../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','Trunk,\x20%s,\x20%s','message','result','catch','GetTrunk','Trunk','findAll','options','raw','where','attributes','limit','map','include','model','ShowTrunk','find','lodash','moment','ioredis','rpc'];(function(_0x1a6a02,_0x1c090f){var _0x3b19f5=function(_0x4b8d69){while(--_0x4b8d69){_0x1a6a02['push'](_0x1a6a02['shift']());}};_0x3b19f5(++_0x1c090f);}(_0x6991,0x1ca));var _0x1699=function(_0x387777,_0x356171){_0x387777=_0x387777-0x0;var _0x3f84c0=_0x6991[_0x387777];return _0x3f84c0;};'use strict';var _=require(_0x1699('0x0'));var util=require('util');var moment=require(_0x1699('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1699('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x1699('0x3'));var config=require(_0x1699('0x4'));var jayson=require(_0x1699('0x5'));var client=jayson[_0x1699('0x6')][_0x1699('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x53225c,_0x401b57,_0x59478c){return new BPromise(function(_0x341973,_0x182ed2){return client[_0x1699('0x8')](_0x53225c,_0x59478c)[_0x1699('0x9')](function(_0x469545){logger[_0x1699('0xa')]('Trunk,\x20%s,\x20%s',_0x401b57,_0x1699('0xb'));logger[_0x1699('0xc')](_0x1699('0xd'),_0x401b57,_0x1699('0xb'),JSON[_0x1699('0xe')](_0x469545));if(_0x469545[_0x1699('0xf')]){if(_0x469545[_0x1699('0xf')]['code']===0x1f4){logger[_0x1699('0xf')](_0x1699('0x10'),_0x401b57,_0x469545['error'][_0x1699('0x11')]);return _0x182ed2(_0x469545[_0x1699('0xf')][_0x1699('0x11')]);}logger['error'](_0x1699('0x10'),_0x401b57,_0x469545[_0x1699('0xf')][_0x1699('0x11')]);return _0x341973(_0x469545[_0x1699('0xf')][_0x1699('0x11')]);}else{logger[_0x1699('0xa')]('Trunk,\x20%s,\x20%s',_0x401b57,_0x1699('0xb'));_0x341973(_0x469545[_0x1699('0x12')][_0x1699('0x11')]);}})[_0x1699('0x13')](function(_0x5edb98){logger['error'](_0x1699('0x10'),_0x401b57,_0x5edb98);_0x182ed2(_0x5edb98);});});}exports[_0x1699('0x14')]=function(_0x4e8507){var _0x5c52fb=this;return new Promise(function(_0x190938,_0x11a224){return db[_0x1699('0x15')][_0x1699('0x16')]({'raw':_0x4e8507[_0x1699('0x17')]?_0x4e8507[_0x1699('0x17')][_0x1699('0x18')]===undefined?!![]:![]:!![],'where':_0x4e8507[_0x1699('0x17')]?_0x4e8507[_0x1699('0x17')][_0x1699('0x19')]||null:null,'attributes':_0x4e8507[_0x1699('0x17')]?_0x4e8507[_0x1699('0x17')][_0x1699('0x1a')]||null:null,'limit':_0x4e8507[_0x1699('0x17')]?_0x4e8507['options'][_0x1699('0x1b')]||null:null,'include':_0x4e8507[_0x1699('0x17')]?_0x4e8507[_0x1699('0x17')]['include']?_[_0x1699('0x1c')](_0x4e8507['options'][_0x1699('0x1d')],function(_0x59e1fb){return{'model':db[_0x59e1fb['model']],'as':_0x59e1fb['as'],'attributes':_0x59e1fb['attributes'],'include':_0x59e1fb[_0x1699('0x1d')]?_[_0x1699('0x1c')](_0x59e1fb['include'],function(_0x4da622){return{'model':db[_0x4da622[_0x1699('0x1e')]],'as':_0x4da622['as'],'attributes':_0x4da622[_0x1699('0x1a')],'include':_0x4da622[_0x1699('0x1d')]?_[_0x1699('0x1c')](_0x4da622[_0x1699('0x1d')],function(_0x427ae6){return{'model':db[_0x427ae6[_0x1699('0x1e')]],'as':_0x427ae6['as'],'attributes':_0x427ae6[_0x1699('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x1699('0x9')](function(_0x4bd7f7){logger[_0x1699('0xa')](_0x1699('0x14'),_0x4e8507);logger[_0x1699('0xc')]('GetTrunk',_0x4e8507,JSON[_0x1699('0xe')](_0x4bd7f7));_0x190938(_0x4bd7f7);})['catch'](function(_0x3ad5e1){logger['error'](_0x1699('0x14'),_0x3ad5e1[_0x1699('0x11')],_0x4e8507);_0x11a224(_0x5c52fb[_0x1699('0xf')](0x1f4,_0x3ad5e1['message']));});});};exports[_0x1699('0x1f')]=function(_0x5a1ef0){var _0x28660c=this;return new Promise(function(_0x4b84c4,_0xfd4592){return db['Trunk'][_0x1699('0x20')]({'raw':_0x5a1ef0[_0x1699('0x17')]?_0x5a1ef0[_0x1699('0x17')][_0x1699('0x18')]===undefined?!![]:![]:!![],'where':_0x5a1ef0['options']?_0x5a1ef0[_0x1699('0x17')][_0x1699('0x19')]||null:null,'attributes':_0x5a1ef0[_0x1699('0x17')]?_0x5a1ef0[_0x1699('0x17')]['attributes']||null:null,'include':_0x5a1ef0[_0x1699('0x17')]?_0x5a1ef0[_0x1699('0x17')]['include']?_['map'](_0x5a1ef0[_0x1699('0x17')]['include'],function(_0x66fc1b){return{'model':db[_0x66fc1b[_0x1699('0x1e')]],'as':_0x66fc1b['as'],'attributes':_0x66fc1b[_0x1699('0x1a')],'include':_0x66fc1b['include']?_[_0x1699('0x1c')](_0x66fc1b[_0x1699('0x1d')],function(_0x1057e2){return{'model':db[_0x1057e2[_0x1699('0x1e')]],'as':_0x1057e2['as'],'attributes':_0x1057e2[_0x1699('0x1a')],'include':_0x1057e2[_0x1699('0x1d')]?_[_0x1699('0x1c')](_0x1057e2[_0x1699('0x1d')],function(_0x22c6f7){return{'model':db[_0x22c6f7[_0x1699('0x1e')]],'as':_0x22c6f7['as'],'attributes':_0x22c6f7['attributes']};}):[]};}):[]};}):[]:[]})[_0x1699('0x9')](function(_0x28d78f){logger['info'](_0x1699('0x1f'),_0x5a1ef0);logger[_0x1699('0xc')](_0x1699('0x1f'),_0x5a1ef0,JSON[_0x1699('0xe')](_0x28d78f));_0x4b84c4(_0x28d78f);})[_0x1699('0x13')](function(_0x4f8f0d){logger[_0x1699('0xf')](_0x1699('0x1f'),_0x4f8f0d['message'],_0x5a1ef0);_0xfd4592(_0x28660c[_0x1699('0xf')](0x1f4,_0x4f8f0d[_0x1699('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/user/index.js b/server/api/user/index.js index 7e38204..66e32e4 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 _0x58c1=['addWhatsappInteractions','addMailAccounts','addOpenchannelAccounts','/:id/sms_accounts','addChatWebsites','addWhatsappAccounts','addSquareProjects','/:id/api_key','createApiKey','put','/:id','update','delete','removeQueues','destroy','/:id/chat_interactions','removeMailInteractions','removeFaxInteractions','removeSmsInteractions','removeOpenchannelInteractions','removeFaxAccounts','removeMailAccounts','removeOpenchannelAccounts','removeChatWebsites','removeWhatsappAccounts','removeSquareProjects','removeApiKey','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./user.controller','isAuthenticated','index','get','/describe','describe','/whoami','whoami','getPresence','show','/:id/avatar','getAvatar','/:id/open_tabs','/:id/queues','/:id/queues_rt','getVoiceQueuesRt','/:id/groups','getGroups','getRecordings','/:id/screen_recordings','/:id/chat/interactions','getChatInteractions','/:id/openchannel/interactions','getOpenchannelInteractions','/:id/fax/interactions','getFaxInteractions','/:id/whatsapp/interactions','getWhatsappInteractions','/:id/teams','getTeams','/:id/lists','getLists','/:id/agents','getAgents','/:id/prefixes','/:id/fax_accounts','getFaxAccounts','/:id/mail_accounts','getMailAccounts','/:id/openchannel_accounts','/:id/chat_websites','getChatWebsites','/:id/whatsapp_accounts','getWhatsappAccounts','/:id/square_projects','/:id/scheduled_calls','getScheduledCalls','getApiKey','post','/:id/contacts','addContacts','/create_many','bulkCreate','addQueues','diskStorage','join','root','server/files/images/','format','now','originalname','single','file','addAvatar','/:id/login','login','logout','/:id/pause','/:id/unpause','unpause','/:id/mail_interactions','addMailInteractions','/:id/fax_interactions','addFaxInteractions','/:id/sms_interactions','addSmsInteractions','/:id/openchannel_interactions','addOpenchannelInteractions','/:id/whatsapp_interactions'];(function(_0x1d317e,_0x3ed004){var _0x1f9dda=function(_0x1f79f8){while(--_0x1f79f8){_0x1d317e['push'](_0x1d317e['shift']());}};_0x1f9dda(++_0x3ed004);}(_0x58c1,0x102));var _0x158c=function(_0x2d5632,_0x4c3187){_0x2d5632=_0x2d5632-0x0;var _0x21ad99=_0x58c1[_0x2d5632];return _0x21ad99;};'use strict';var multer=require(_0x158c('0x0'));var util=require(_0x158c('0x1'));var path=require(_0x158c('0x2'));var timeout=require(_0x158c('0x3'));var express=require('express');var router=express[_0x158c('0x4')]();var fs_extra=require(_0x158c('0x5'));var auth=require(_0x158c('0x6'));var interaction=require(_0x158c('0x7'));var config=require('../../config/environment');var controller=require(_0x158c('0x8'));router['get']('/',auth[_0x158c('0x9')](),controller[_0x158c('0xa')]);router[_0x158c('0xb')](_0x158c('0xc'),auth[_0x158c('0x9')](),controller[_0x158c('0xd')]);router[_0x158c('0xb')](_0x158c('0xe'),auth[_0x158c('0x9')](),controller[_0x158c('0xf')]);router[_0x158c('0xb')]('/presence',auth[_0x158c('0x9')](),controller[_0x158c('0x10')]);router[_0x158c('0xb')]('/:id',auth[_0x158c('0x9')](),controller[_0x158c('0x11')]);router[_0x158c('0xb')](_0x158c('0x12'),controller[_0x158c('0x13')]);router['get'](_0x158c('0x14'),auth[_0x158c('0x9')](),controller['getOpenTabs']);router[_0x158c('0xb')]('/:id/contacts',auth[_0x158c('0x9')](),controller['getContacts']);router[_0x158c('0xb')](_0x158c('0x15'),auth[_0x158c('0x9')](),controller['getQueues']);router[_0x158c('0xb')](_0x158c('0x16'),auth[_0x158c('0x9')](),controller[_0x158c('0x17')]);router['get'](_0x158c('0x18'),auth[_0x158c('0x9')](),controller[_0x158c('0x19')]);router[_0x158c('0xb')]('/:id/recordings',auth['isAuthenticated'](),controller[_0x158c('0x1a')]);router[_0x158c('0xb')](_0x158c('0x1b'),auth[_0x158c('0x9')](),controller['getScreenRecordings']);router['get'](_0x158c('0x1c'),auth[_0x158c('0x9')](),controller[_0x158c('0x1d')]);router[_0x158c('0xb')](_0x158c('0x1e'),auth[_0x158c('0x9')](),controller[_0x158c('0x1f')]);router[_0x158c('0xb')]('/:id/mail/interactions',auth[_0x158c('0x9')](),controller['getMailInteractions']);router[_0x158c('0xb')]('/:id/sms/interactions',auth[_0x158c('0x9')](),controller['getSmsInteractions']);router[_0x158c('0xb')](_0x158c('0x20'),auth['isAuthenticated'](),controller[_0x158c('0x21')]);router[_0x158c('0xb')](_0x158c('0x22'),auth['isAuthenticated'](),controller[_0x158c('0x23')]);router[_0x158c('0xb')](_0x158c('0x24'),auth[_0x158c('0x9')](),controller[_0x158c('0x25')]);router[_0x158c('0xb')](_0x158c('0x26'),auth[_0x158c('0x9')](),controller[_0x158c('0x27')]);router[_0x158c('0xb')](_0x158c('0x28'),auth['isAuthenticated'](),controller[_0x158c('0x29')]);router[_0x158c('0xb')](_0x158c('0x2a'),auth[_0x158c('0x9')](),controller['getVoicePrefixes']);router[_0x158c('0xb')](_0x158c('0x2b'),auth['isAuthenticated'](),controller[_0x158c('0x2c')]);router[_0x158c('0xb')](_0x158c('0x2d'),auth['isAuthenticated'](),controller[_0x158c('0x2e')]);router[_0x158c('0xb')](_0x158c('0x2f'),auth[_0x158c('0x9')](),controller['getOpenchannelAccounts']);router[_0x158c('0xb')]('/:id/sms_accounts',auth[_0x158c('0x9')](),controller['getSmsAccounts']);router[_0x158c('0xb')](_0x158c('0x30'),auth[_0x158c('0x9')](),controller[_0x158c('0x31')]);router['get'](_0x158c('0x32'),auth['isAuthenticated'](),controller[_0x158c('0x33')]);router[_0x158c('0xb')](_0x158c('0x34'),auth[_0x158c('0x9')](),controller['getSquareProjects']);router['get'](_0x158c('0x35'),auth['isAuthenticated'](),controller[_0x158c('0x36')]);router[_0x158c('0xb')]('/:id/api_key',auth[_0x158c('0x9')](),controller[_0x158c('0x37')]);router[_0x158c('0x38')](_0x158c('0x39'),auth[_0x158c('0x9')](),controller[_0x158c('0x3a')]);router[_0x158c('0x38')]('/',auth[_0x158c('0x9')](),controller['create']);router[_0x158c('0x38')](_0x158c('0x3b'),auth[_0x158c('0x9')](),controller[_0x158c('0x3c')]);router['post']('/:id/queues',auth[_0x158c('0x9')](),controller[_0x158c('0x3d')]);var upload=multer({'storage':multer[_0x158c('0x3e')]({'destination':function(_0x1a5b31,_0xed0890,_0x5d36fa){_0x5d36fa(null,path[_0x158c('0x3f')](config[_0x158c('0x40')],_0x158c('0x41')));},'filename':function(_0x56797e,_0x8bdb80,_0x5a7ee3){_0x5a7ee3(null,util[_0x158c('0x42')]('%s-%s',Date[_0x158c('0x43')](),_0x8bdb80[_0x158c('0x44')]));}})});router[_0x158c('0x38')](_0x158c('0x12'),upload[_0x158c('0x45')](_0x158c('0x46')),controller[_0x158c('0x47')]);router[_0x158c('0x38')](_0x158c('0x48'),auth[_0x158c('0x9')](),controller[_0x158c('0x49')]);router[_0x158c('0x38')]('/:id/logout',auth[_0x158c('0x9')](),controller[_0x158c('0x4a')]);router[_0x158c('0x38')](_0x158c('0x4b'),auth[_0x158c('0x9')](),controller['pause']);router['post'](_0x158c('0x4c'),auth['isAuthenticated'](),controller[_0x158c('0x4d')]);router[_0x158c('0x38')](_0x158c('0x24'),auth['isAuthenticated'](),controller['addTeams']);router[_0x158c('0x38')]('/:id/chat_interactions',auth[_0x158c('0x9')](),controller['addChatInteractions']);router[_0x158c('0x38')](_0x158c('0x4e'),auth['isAuthenticated'](),controller[_0x158c('0x4f')]);router[_0x158c('0x38')](_0x158c('0x50'),auth[_0x158c('0x9')](),controller[_0x158c('0x51')]);router[_0x158c('0x38')](_0x158c('0x52'),auth['isAuthenticated'](),controller[_0x158c('0x53')]);router[_0x158c('0x38')](_0x158c('0x54'),auth[_0x158c('0x9')](),controller[_0x158c('0x55')]);router[_0x158c('0x38')](_0x158c('0x56'),auth[_0x158c('0x9')](),controller[_0x158c('0x57')]);router['post'](_0x158c('0x2b'),auth[_0x158c('0x9')](),controller['addFaxAccounts']);router[_0x158c('0x38')](_0x158c('0x2d'),auth[_0x158c('0x9')](),controller[_0x158c('0x58')]);router[_0x158c('0x38')](_0x158c('0x2f'),auth[_0x158c('0x9')](),controller[_0x158c('0x59')]);router[_0x158c('0x38')](_0x158c('0x5a'),auth[_0x158c('0x9')](),controller['addSmsAccounts']);router[_0x158c('0x38')](_0x158c('0x30'),auth[_0x158c('0x9')](),controller[_0x158c('0x5b')]);router[_0x158c('0x38')]('/:id/whatsapp_accounts',auth[_0x158c('0x9')](),controller[_0x158c('0x5c')]);router[_0x158c('0x38')]('/:id/square_projects',auth[_0x158c('0x9')](),controller[_0x158c('0x5d')]);router[_0x158c('0x38')](_0x158c('0x5e'),auth['isAuthenticated'](),controller[_0x158c('0x5f')]);router[_0x158c('0x60')](_0x158c('0x61'),auth[_0x158c('0x9')](),controller[_0x158c('0x62')]);router[_0x158c('0x60')]('/:id/password',auth[_0x158c('0x9')](),controller['changePassword']);router[_0x158c('0x63')]('/:id/queues',auth[_0x158c('0x9')](),controller[_0x158c('0x64')]);router[_0x158c('0x63')]('/:id/teams',auth[_0x158c('0x9')](),controller['removeTeams']);router[_0x158c('0x63')](_0x158c('0x61'),auth[_0x158c('0x9')](),controller[_0x158c('0x65')]);router['delete'](_0x158c('0x66'),auth['isAuthenticated'](),controller['removeChatInteractions']);router[_0x158c('0x63')](_0x158c('0x4e'),auth[_0x158c('0x9')](),controller[_0x158c('0x67')]);router[_0x158c('0x63')](_0x158c('0x50'),auth['isAuthenticated'](),controller[_0x158c('0x68')]);router[_0x158c('0x63')](_0x158c('0x52'),auth[_0x158c('0x9')](),controller[_0x158c('0x69')]);router['delete']('/:id/openchannel_interactions',auth['isAuthenticated'](),controller[_0x158c('0x6a')]);router[_0x158c('0x63')](_0x158c('0x56'),auth[_0x158c('0x9')](),controller['removeWhatsappInteractions']);router[_0x158c('0x63')](_0x158c('0x2b'),auth[_0x158c('0x9')](),controller[_0x158c('0x6b')]);router['delete'](_0x158c('0x2d'),auth['isAuthenticated'](),controller[_0x158c('0x6c')]);router['delete'](_0x158c('0x2f'),auth[_0x158c('0x9')](),controller[_0x158c('0x6d')]);router['delete']('/:id/sms_accounts',auth[_0x158c('0x9')](),controller['removeSmsAccounts']);router['delete'](_0x158c('0x30'),auth[_0x158c('0x9')](),controller[_0x158c('0x6e')]);router[_0x158c('0x63')](_0x158c('0x32'),auth['isAuthenticated'](),controller[_0x158c('0x6f')]);router['delete']('/:id/square_projects',auth[_0x158c('0x9')](),controller[_0x158c('0x70')]);router[_0x158c('0x63')]('/:id/api_key',auth['isAuthenticated'](),controller[_0x158c('0x71')]);module[_0x158c('0x72')]=router; \ No newline at end of file +var _0x4b80=['/:id/groups','getGroups','/:id/recordings','getRecordings','/:id/screen_recordings','getChatInteractions','/:id/openchannel/interactions','getOpenchannelInteractions','/:id/mail/interactions','getMailInteractions','/:id/sms/interactions','/:id/fax/interactions','getFaxInteractions','/:id/lists','getLists','/:id/agents','/:id/prefixes','getFaxAccounts','/:id/mail_accounts','getOpenchannelAccounts','/:id/sms_accounts','getSmsAccounts','/:id/chat_websites','getChatWebsites','getWhatsappAccounts','/:id/scheduled_calls','getScheduledCalls','/:id/api_key','getApiKey','post','addContacts','create','/create_many','bulkCreate','diskStorage','join','root','server/files/images/','format','%s-%s','now','originalname','single','file','/:id/login','login','/:id/logout','pause','unpause','addTeams','/:id/chat_interactions','/:id/mail_interactions','addMailInteractions','/:id/fax_interactions','/:id/sms_interactions','addSmsInteractions','/:id/openchannel_interactions','addOpenchannelInteractions','/:id/whatsapp_interactions','addWhatsappInteractions','/:id/fax_accounts','addFaxAccounts','addMailAccounts','/:id/openchannel_accounts','addOpenchannelAccounts','addChatWebsites','/:id/whatsapp_accounts','addWhatsappAccounts','addSquareProjects','createApiKey','put','/:id','/:id/password','changePassword','delete','removeQueues','/:id/teams','destroy','removeMailInteractions','removeFaxInteractions','removeSmsInteractions','removeOpenchannelInteractions','removeWhatsappInteractions','removeFaxAccounts','removeSmsAccounts','removeChatWebsites','/:id/square_projects','removeSquareProjects','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./user.controller','isAuthenticated','index','get','/describe','whoami','/presence','getPresence','show','/:id/avatar','getAvatar','/:id/open_tabs','/:id/contacts','getContacts','/:id/queues','getQueues'];(function(_0x32c51c,_0x5b47a0){var _0x1a105e=function(_0x2c5ad7){while(--_0x2c5ad7){_0x32c51c['push'](_0x32c51c['shift']());}};_0x1a105e(++_0x5b47a0);}(_0x4b80,0x136));var _0x04b8=function(_0x4f5582,_0x1cb46d){_0x4f5582=_0x4f5582-0x0;var _0x13d279=_0x4b80[_0x4f5582];return _0x13d279;};'use strict';var multer=require(_0x04b8('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x04b8('0x1'));var express=require(_0x04b8('0x2'));var router=express[_0x04b8('0x3')]();var fs_extra=require(_0x04b8('0x4'));var auth=require(_0x04b8('0x5'));var interaction=require(_0x04b8('0x6'));var config=require('../../config/environment');var controller=require(_0x04b8('0x7'));router['get']('/',auth[_0x04b8('0x8')](),controller[_0x04b8('0x9')]);router[_0x04b8('0xa')](_0x04b8('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0x04b8('0xa')]('/whoami',auth[_0x04b8('0x8')](),controller[_0x04b8('0xc')]);router[_0x04b8('0xa')](_0x04b8('0xd'),auth[_0x04b8('0x8')](),controller[_0x04b8('0xe')]);router[_0x04b8('0xa')]('/:id',auth[_0x04b8('0x8')](),controller[_0x04b8('0xf')]);router[_0x04b8('0xa')](_0x04b8('0x10'),controller[_0x04b8('0x11')]);router[_0x04b8('0xa')](_0x04b8('0x12'),auth[_0x04b8('0x8')](),controller['getOpenTabs']);router[_0x04b8('0xa')](_0x04b8('0x13'),auth[_0x04b8('0x8')](),controller[_0x04b8('0x14')]);router[_0x04b8('0xa')](_0x04b8('0x15'),auth[_0x04b8('0x8')](),controller[_0x04b8('0x16')]);router['get']('/:id/queues_rt',auth[_0x04b8('0x8')](),controller['getVoiceQueuesRt']);router['get'](_0x04b8('0x17'),auth['isAuthenticated'](),controller[_0x04b8('0x18')]);router['get'](_0x04b8('0x19'),auth['isAuthenticated'](),controller[_0x04b8('0x1a')]);router[_0x04b8('0xa')](_0x04b8('0x1b'),auth[_0x04b8('0x8')](),controller['getScreenRecordings']);router[_0x04b8('0xa')]('/:id/chat/interactions',auth[_0x04b8('0x8')](),controller[_0x04b8('0x1c')]);router[_0x04b8('0xa')](_0x04b8('0x1d'),auth[_0x04b8('0x8')](),controller[_0x04b8('0x1e')]);router[_0x04b8('0xa')](_0x04b8('0x1f'),auth[_0x04b8('0x8')](),controller[_0x04b8('0x20')]);router[_0x04b8('0xa')](_0x04b8('0x21'),auth['isAuthenticated'](),controller['getSmsInteractions']);router[_0x04b8('0xa')](_0x04b8('0x22'),auth[_0x04b8('0x8')](),controller[_0x04b8('0x23')]);router[_0x04b8('0xa')]('/:id/whatsapp/interactions',auth[_0x04b8('0x8')](),controller['getWhatsappInteractions']);router[_0x04b8('0xa')]('/:id/teams',auth[_0x04b8('0x8')](),controller['getTeams']);router[_0x04b8('0xa')](_0x04b8('0x24'),auth[_0x04b8('0x8')](),controller[_0x04b8('0x25')]);router[_0x04b8('0xa')](_0x04b8('0x26'),auth[_0x04b8('0x8')](),controller['getAgents']);router[_0x04b8('0xa')](_0x04b8('0x27'),auth[_0x04b8('0x8')](),controller['getVoicePrefixes']);router[_0x04b8('0xa')]('/:id/fax_accounts',auth[_0x04b8('0x8')](),controller[_0x04b8('0x28')]);router[_0x04b8('0xa')](_0x04b8('0x29'),auth[_0x04b8('0x8')](),controller['getMailAccounts']);router[_0x04b8('0xa')]('/:id/openchannel_accounts',auth[_0x04b8('0x8')](),controller[_0x04b8('0x2a')]);router[_0x04b8('0xa')](_0x04b8('0x2b'),auth['isAuthenticated'](),controller[_0x04b8('0x2c')]);router['get'](_0x04b8('0x2d'),auth[_0x04b8('0x8')](),controller[_0x04b8('0x2e')]);router['get']('/:id/whatsapp_accounts',auth[_0x04b8('0x8')](),controller[_0x04b8('0x2f')]);router[_0x04b8('0xa')]('/:id/square_projects',auth[_0x04b8('0x8')](),controller['getSquareProjects']);router[_0x04b8('0xa')](_0x04b8('0x30'),auth[_0x04b8('0x8')](),controller[_0x04b8('0x31')]);router['get'](_0x04b8('0x32'),auth['isAuthenticated'](),controller[_0x04b8('0x33')]);router[_0x04b8('0x34')](_0x04b8('0x13'),auth[_0x04b8('0x8')](),controller[_0x04b8('0x35')]);router['post']('/',auth[_0x04b8('0x8')](),controller[_0x04b8('0x36')]);router[_0x04b8('0x34')](_0x04b8('0x37'),auth['isAuthenticated'](),controller[_0x04b8('0x38')]);router[_0x04b8('0x34')](_0x04b8('0x15'),auth['isAuthenticated'](),controller['addQueues']);var upload=multer({'storage':multer[_0x04b8('0x39')]({'destination':function(_0x8369a8,_0x2de7e3,_0x47174c){_0x47174c(null,path[_0x04b8('0x3a')](config[_0x04b8('0x3b')],_0x04b8('0x3c')));},'filename':function(_0x7f3331,_0x40ff7f,_0x1fb4e3){_0x1fb4e3(null,util[_0x04b8('0x3d')](_0x04b8('0x3e'),Date[_0x04b8('0x3f')](),_0x40ff7f[_0x04b8('0x40')]));}})});router[_0x04b8('0x34')](_0x04b8('0x10'),upload[_0x04b8('0x41')](_0x04b8('0x42')),controller['addAvatar']);router[_0x04b8('0x34')](_0x04b8('0x43'),auth[_0x04b8('0x8')](),controller[_0x04b8('0x44')]);router[_0x04b8('0x34')](_0x04b8('0x45'),auth[_0x04b8('0x8')](),controller['logout']);router['post']('/:id/pause',auth[_0x04b8('0x8')](),controller[_0x04b8('0x46')]);router[_0x04b8('0x34')]('/:id/unpause',auth[_0x04b8('0x8')](),controller[_0x04b8('0x47')]);router[_0x04b8('0x34')]('/:id/teams',auth[_0x04b8('0x8')](),controller[_0x04b8('0x48')]);router[_0x04b8('0x34')](_0x04b8('0x49'),auth[_0x04b8('0x8')](),controller['addChatInteractions']);router[_0x04b8('0x34')](_0x04b8('0x4a'),auth[_0x04b8('0x8')](),controller[_0x04b8('0x4b')]);router[_0x04b8('0x34')](_0x04b8('0x4c'),auth[_0x04b8('0x8')](),controller['addFaxInteractions']);router[_0x04b8('0x34')](_0x04b8('0x4d'),auth[_0x04b8('0x8')](),controller[_0x04b8('0x4e')]);router[_0x04b8('0x34')](_0x04b8('0x4f'),auth[_0x04b8('0x8')](),controller[_0x04b8('0x50')]);router['post'](_0x04b8('0x51'),auth[_0x04b8('0x8')](),controller[_0x04b8('0x52')]);router[_0x04b8('0x34')](_0x04b8('0x53'),auth[_0x04b8('0x8')](),controller[_0x04b8('0x54')]);router['post']('/:id/mail_accounts',auth[_0x04b8('0x8')](),controller[_0x04b8('0x55')]);router['post'](_0x04b8('0x56'),auth[_0x04b8('0x8')](),controller[_0x04b8('0x57')]);router['post'](_0x04b8('0x2b'),auth[_0x04b8('0x8')](),controller['addSmsAccounts']);router[_0x04b8('0x34')](_0x04b8('0x2d'),auth[_0x04b8('0x8')](),controller[_0x04b8('0x58')]);router['post'](_0x04b8('0x59'),auth[_0x04b8('0x8')](),controller[_0x04b8('0x5a')]);router['post']('/:id/square_projects',auth[_0x04b8('0x8')](),controller[_0x04b8('0x5b')]);router[_0x04b8('0x34')](_0x04b8('0x32'),auth[_0x04b8('0x8')](),controller[_0x04b8('0x5c')]);router[_0x04b8('0x5d')](_0x04b8('0x5e'),auth[_0x04b8('0x8')](),controller['update']);router[_0x04b8('0x5d')](_0x04b8('0x5f'),auth[_0x04b8('0x8')](),controller[_0x04b8('0x60')]);router[_0x04b8('0x61')](_0x04b8('0x15'),auth[_0x04b8('0x8')](),controller[_0x04b8('0x62')]);router['delete'](_0x04b8('0x63'),auth[_0x04b8('0x8')](),controller['removeTeams']);router[_0x04b8('0x61')](_0x04b8('0x5e'),auth[_0x04b8('0x8')](),controller[_0x04b8('0x64')]);router[_0x04b8('0x61')](_0x04b8('0x49'),auth[_0x04b8('0x8')](),controller['removeChatInteractions']);router['delete'](_0x04b8('0x4a'),auth[_0x04b8('0x8')](),controller[_0x04b8('0x65')]);router['delete']('/:id/fax_interactions',auth[_0x04b8('0x8')](),controller[_0x04b8('0x66')]);router[_0x04b8('0x61')](_0x04b8('0x4d'),auth['isAuthenticated'](),controller[_0x04b8('0x67')]);router[_0x04b8('0x61')](_0x04b8('0x4f'),auth['isAuthenticated'](),controller[_0x04b8('0x68')]);router[_0x04b8('0x61')](_0x04b8('0x51'),auth[_0x04b8('0x8')](),controller[_0x04b8('0x69')]);router[_0x04b8('0x61')](_0x04b8('0x53'),auth['isAuthenticated'](),controller[_0x04b8('0x6a')]);router[_0x04b8('0x61')](_0x04b8('0x29'),auth[_0x04b8('0x8')](),controller['removeMailAccounts']);router[_0x04b8('0x61')]('/:id/openchannel_accounts',auth[_0x04b8('0x8')](),controller['removeOpenchannelAccounts']);router['delete'](_0x04b8('0x2b'),auth[_0x04b8('0x8')](),controller[_0x04b8('0x6b')]);router[_0x04b8('0x61')]('/:id/chat_websites',auth[_0x04b8('0x8')](),controller[_0x04b8('0x6c')]);router[_0x04b8('0x61')]('/:id/whatsapp_accounts',auth['isAuthenticated'](),controller['removeWhatsappAccounts']);router[_0x04b8('0x61')](_0x04b8('0x6d'),auth[_0x04b8('0x8')](),controller[_0x04b8('0x6e')]);router['delete'](_0x04b8('0x32'),auth[_0x04b8('0x8')](),controller['removeApiKey']);module['exports']=router; \ No newline at end of file diff --git a/server/api/user/user.attributes.js b/server/api/user/user.attributes.js index fe96aa2..33e4a87 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 _0x5b20=['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','always','accept','refuse','originate','uac','uas','fingerprint','certificate','active','passive','actpass','update,nonat','TEXT','showWebBar','get','isArray','wss','udp','avpf','force_avp','icesupport','dtlsenable','dtlsverify','dtlsprivatekey','rtcp_mux','encryption','dtlssetup','dtlscertfile','/etc/pki/tls/private/motion.key','permissions','map','phoneBarEnableScreenRecordingByAgent','string','true','screenrecording','blocked','loginAttempts','UNSIGNED','sequelize','moment','util','lodash','exports','STRING','name','setDataValue','The\x20name\x20of\x20the\x20user','fullname','callerid','format','\x22%s\x22\x20<%s>','getDataValue','internal','email','toLowerCase','ENUM','user','agent','telephone','local','INTEGER','BOOLEAN','DATE','DEFAULT\x20PAUSE','peer','friend','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_FAILED_SCREEN','transport','join','split','rfc2833','inband','auto','yes','nonat','update','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all'];(function(_0x57eb0f,_0x4a5cfc){var _0xc5518d=function(_0xe6d150){while(--_0xe6d150){_0x57eb0f['push'](_0x57eb0f['shift']());}};_0xc5518d(++_0x4a5cfc);}(_0x5b20,0x86));var _0x05b2=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x5b20[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x05b2('0x0'));var moment=require(_0x05b2('0x1'));var util=require(_0x05b2('0x2'));var _=require(_0x05b2('0x3'));module[_0x05b2('0x4')]={'name':{'type':Sequelize[_0x05b2('0x5')],'allowNull':![],'unique':_0x05b2('0x6'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x7d6d53){this[_0x05b2('0x7')](_0x05b2('0x6'),_0x7d6d53);this[_0x05b2('0x7')]('defaultuser',_0x7d6d53);},'comment':_0x05b2('0x8')},'fullname':{'type':Sequelize[_0x05b2('0x5')],'allowNull':![],'set':function(_0x541855){this[_0x05b2('0x7')](_0x05b2('0x9'),_0x541855);this[_0x05b2('0x7')](_0x05b2('0xa'),util[_0x05b2('0xb')](_0x05b2('0xc'),_0x541855,this[_0x05b2('0xd')](_0x05b2('0xe'))));}},'alias':{'type':Sequelize[_0x05b2('0x5')]},'email':{'type':Sequelize[_0x05b2('0x5')],'allowNull':![],'unique':_0x05b2('0xf'),'validate':{'isEmail':!![]},'set':function(_0x2f2e4a){if(_0x2f2e4a){this[_0x05b2('0x7')](_0x05b2('0xf'),_0x2f2e4a[_0x05b2('0x10')]());}}},'role':{'type':Sequelize[_0x05b2('0x11')]('admin',_0x05b2('0x12'),_0x05b2('0x13'),_0x05b2('0x14')),'allowNull':![]},'password':{'type':Sequelize[_0x05b2('0x5')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize['STRING'],'defaultValue':_0x05b2('0x15')},'internal':{'type':Sequelize[_0x05b2('0x16')](0xb),'allowNull':![],'unique':_0x05b2('0xe'),'set':function(_0x5a12d4){this['setDataValue'](_0x05b2('0xe'),_0x5a12d4);this[_0x05b2('0x7')]('accountcode',_0x5a12d4);this['setDataValue'](_0x05b2('0xa'),util[_0x05b2('0xb')](_0x05b2('0xc'),this[_0x05b2('0xd')](_0x05b2('0x9')),_0x5a12d4));}},'salt':{'type':Sequelize[_0x05b2('0x5')]},'phone':{'type':Sequelize[_0x05b2('0x5')]},'mobile':{'type':Sequelize[_0x05b2('0x5')]},'address':{'type':Sequelize[_0x05b2('0x5')]},'zipcode':{'type':Sequelize[_0x05b2('0x5')]},'userpic':{'type':Sequelize[_0x05b2('0x5')]},'city':{'type':Sequelize[_0x05b2('0x5')]},'country':{'type':Sequelize[_0x05b2('0x5')]},'online':{'type':Sequelize[_0x05b2('0x17')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x05b2('0x18')]},'voicePause':{'type':Sequelize[_0x05b2('0x17')],'defaultValue':![]},'chatPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x05b2('0x17')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x05b2('0x17')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0x05b2('0x17')],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0x05b2('0x17')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x05b2('0x17')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x05b2('0x5')],'defaultValue':_0x05b2('0x19')},'lastPauseAt':{'type':Sequelize['DATE']},'chatCapacity':{'type':Sequelize[_0x05b2('0x16')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0x05b2('0x16')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x05b2('0x16')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x05b2('0x16')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0x05b2('0x17')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x05b2('0x17')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0x05b2('0x16')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x05b2('0x16')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x05b2('0x17')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x05b2('0x16')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x05b2('0x17')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chanspy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'host':{'type':Sequelize[_0x05b2('0x5')],'allowNull':!![],'defaultValue':'dynamic'},'ipaddr':{'type':Sequelize['STRING'],'allowNull':!![]},'port':{'type':Sequelize[_0x05b2('0x16')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0x05b2('0x16')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x05b2('0x5')],'allowNull':!![]},'regserver':{'type':Sequelize[_0x05b2('0x5')],'allowNull':!![]},'useragent':{'type':Sequelize[_0x05b2('0x5')],'allowNull':!![]},'lastms':{'type':Sequelize[_0x05b2('0x16')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x05b2('0x11')]('friend',_0x05b2('0x12'),_0x05b2('0x1a')),'allowNull':!![],'defaultValue':_0x05b2('0x1b')},'context':{'type':Sequelize[_0x05b2('0x5')],'allowNull':!![],'defaultValue':'from-sip'},'callingpres':{'type':Sequelize[_0x05b2('0x11')]('ALLOWED_NOT_SCREENED',_0x05b2('0x1c'),_0x05b2('0x1d'),_0x05b2('0x1e'),_0x05b2('0x1f'),'PROHIB_PASSED_SCREEN',_0x05b2('0x20'),'PROHIB'),'allowNull':!![]},'deny':{'type':Sequelize[_0x05b2('0x5')],'allowNull':!![]},'permit':{'type':Sequelize['STRING'],'allowNull':!![]},'secret':{'type':Sequelize[_0x05b2('0x5')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x05b2('0x5')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x05b2('0x5')],'allowNull':!![]},'transport':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':'udp','set':function(_0x1be4b3){this[_0x05b2('0x7')](_0x05b2('0x21'),_0x1be4b3?_0x1be4b3[_0x05b2('0x22')](','):null);},'get':function(){return this['getDataValue'](_0x05b2('0x21'))?this['getDataValue'](_0x05b2('0x21'))[_0x05b2('0x23')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'},'dtmfmode':{'type':Sequelize[_0x05b2('0x11')](_0x05b2('0x24'),'info','shortinfo',_0x05b2('0x25'),_0x05b2('0x26')),'allowNull':!![],'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize[_0x05b2('0x11')](_0x05b2('0x27'),'no',_0x05b2('0x28'),_0x05b2('0x29'),'outgoing'),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x05b2('0x5')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x05b2('0x5')],'allowNull':!![]},'nat':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x05b2('0x2a'),'set':function(_0x30b774){this[_0x05b2('0x7')](_0x05b2('0x2b'),_0x30b774?_0x30b774[_0x05b2('0x22')](','):null);},'get':function(){return this[_0x05b2('0xd')](_0x05b2('0x2b'))?this['getDataValue'](_0x05b2('0x2b'))[_0x05b2('0x23')](','):null;},'comment':_0x05b2('0x2c')},'callgroup':{'type':Sequelize[_0x05b2('0x5')]},'namedcallgroup':{'type':Sequelize['STRING']},'pickupgroup':{'type':Sequelize[_0x05b2('0x5')]},'namedpickupgroup':{'type':Sequelize[_0x05b2('0x5')]},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize['STRING']},'disallow':{'type':Sequelize[_0x05b2('0x5')],'allowNull':![],'defaultValue':_0x05b2('0x2d')},'allow':{'type':Sequelize[_0x05b2('0x5')],'allowNull':![],'defaultValue':_0x05b2('0x2e'),'set':function(_0xbf443){this[_0x05b2('0x7')](_0x05b2('0x2f'),_0xbf443?_0xbf443[_0x05b2('0x22')](';'):'ulaw;alaw;gsm');},'get':function(){return this['getDataValue'](_0x05b2('0x2f'))?this[_0x05b2('0xd')]('allow')[_0x05b2('0x23')](';'):null;},'comment':_0x05b2('0x30')},'autoframing':{'type':Sequelize[_0x05b2('0x11')](_0x05b2('0x27'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x05b2('0x5')],'allowNull':!![],'set':function(_0x44476a){this[_0x05b2('0x7')]('insecure',_0x44476a?_0x44476a[_0x05b2('0x22')](','):null);},'get':function(){return this['getDataValue'](_0x05b2('0x31'))?this[_0x05b2('0xd')]('insecure')[_0x05b2('0x23')](','):null;},'comment':_0x05b2('0x32')},'trustrpid':{'type':Sequelize['ENUM'](_0x05b2('0x27'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x05b2('0x11')](_0x05b2('0x27'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x05b2('0x11')](_0x05b2('0x27'),'no',_0x05b2('0x33')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x05b2('0x11')](_0x05b2('0x27'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x05b2('0x16')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x05b2('0x5')],'allowNull':!![]},'callerid':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':'\x22\x22\x20<>'},'amaflags':{'type':Sequelize['STRING'],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x05b2('0x11')]('yes','no'),'allowNull':!![],'defaultValue':_0x05b2('0x27')},'busylevel':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x05b2('0x11')](_0x05b2('0x27'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0x05b2('0x11')](_0x05b2('0x27'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x05b2('0x11')](_0x05b2('0x27'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x05b2('0x11')](_0x05b2('0x27'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x05b2('0x5')],'allowNull':!![]},'template':{'type':Sequelize['STRING'],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x05b2('0x11')](_0x05b2('0x27'),'no',_0x05b2('0x34')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x05b2('0x16')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x05b2('0x11')]('yes','no'),'allowNull':!![]},'mailbox':{'type':Sequelize['STRING'],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x05b2('0x11')](_0x05b2('0x35'),_0x05b2('0x36'),_0x05b2('0x37')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x05b2('0x16')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x05b2('0x16')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize['ENUM'](_0x05b2('0x38'),_0x05b2('0x39')),'allowNull':!![],'defaultValue':_0x05b2('0x39')},'t38pt_usertpsource':{'type':Sequelize[_0x05b2('0x5')],'allowNull':!![]},'regexten':{'type':Sequelize[_0x05b2('0x5')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x05b2('0x5')],'allowNull':!![]},'fromuser':{'type':Sequelize['STRING'],'allowNull':!![]},'qualify':{'type':Sequelize[_0x05b2('0x11')](_0x05b2('0x27'),'no'),'allowNull':!![],'defaultValue':_0x05b2('0x27')},'keepalive':{'type':Sequelize[_0x05b2('0x16')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x05b2('0x5')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x05b2('0x5')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0x05b2('0x16')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0x05b2('0x16')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x05b2('0x16')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize['ENUM'](_0x05b2('0x27'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x05b2('0x5')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x05b2('0x5')],'allowNull':!![]},'timert1':{'type':Sequelize[_0x05b2('0x16')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x05b2('0x16')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x05b2('0x16')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x05b2('0x5')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0x05b2('0x5')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0x05b2('0x5')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize['STRING'],'allowNull':!![]},'use_q850_reason':{'type':Sequelize['STRING'],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x05b2('0x16')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0x05b2('0x11')](_0x05b2('0x27'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0x05b2('0x11')](_0x05b2('0x27'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x05b2('0x11')](_0x05b2('0x27'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize['ENUM'](_0x05b2('0x27'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0x05b2('0x11')](_0x05b2('0x27'),'no',_0x05b2('0x3a'),_0x05b2('0x3b')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x05b2('0x16')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x05b2('0x5')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x05b2('0x5')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x05b2('0x5')],'allowNull':!![]},'dtlscafile':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0x05b2('0x5')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x05b2('0x11')](_0x05b2('0x3c'),_0x05b2('0x3d'),_0x05b2('0x3e')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x05b2('0x5')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0x05b2('0x11')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x05b2('0x5')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0x05b2('0x5')],'allowNull':!![]},'call_limit':{'type':Sequelize[_0x05b2('0x16')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize['ENUM'](_0x05b2('0x27'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x05b2('0x5')],'allowNull':!![]},'mohinterpret':{'type':Sequelize['STRING'],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x05b2('0x5')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x05b2('0x5')],'allowNull':!![]},'canreinvite':{'type':Sequelize['ENUM'](_0x05b2('0x27'),'no',_0x05b2('0x28'),'update',_0x05b2('0x3f')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x05b2('0x5')]},'resetPasswordExpires':{'type':Sequelize['DATE']},'passwordResetAt':{'type':Sequelize[_0x05b2('0x18')],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0x05b2('0x40')]},'showWebBar':{'type':Sequelize[_0x05b2('0x16')],'defaultValue':0x0,'set':function(_0x1209c9){this['setDataValue'](_0x05b2('0x41'),_0x1209c9);var _0x1e035c=this[_0x05b2('0x42')]({'plain':!![]});switch(_0x1209c9){case 0x0:case 0x1:var _0x1b7a70=_0x1e035c[_0x05b2('0x21')]?_[_0x05b2('0x43')](_0x1e035c[_0x05b2('0x21')])?_0x1e035c['transport'][_0x05b2('0x22')]():_0x1e035c[_0x05b2('0x21')]:'udp';if(_0x1b7a70===_0x05b2('0x44')){_0x1b7a70=_0x05b2('0x45');}this[_0x05b2('0x7')](_0x05b2('0x21'),_0x1b7a70);this['setDataValue']('encryption','no');this[_0x05b2('0x7')](_0x05b2('0x46'),null);this[_0x05b2('0x7')](_0x05b2('0x47'),null);this[_0x05b2('0x7')](_0x05b2('0x48'),null);this['setDataValue'](_0x05b2('0x49'),null);this['setDataValue'](_0x05b2('0x4a'),null);this[_0x05b2('0x7')]('dtlssetup',null);this[_0x05b2('0x7')]('dtlscertfile',null);this[_0x05b2('0x7')](_0x05b2('0x4b'),null);this['setDataValue'](_0x05b2('0x4c'),'no');break;case 0x2:this['setDataValue']('transport',_0x05b2('0x44'));this[_0x05b2('0x7')](_0x05b2('0x4d'),'yes');this[_0x05b2('0x7')](_0x05b2('0x46'),_0x05b2('0x27'));this[_0x05b2('0x7')]('force_avp',_0x05b2('0x27'));this[_0x05b2('0x7')]('icesupport',_0x05b2('0x27'));this[_0x05b2('0x7')](_0x05b2('0x49'),_0x05b2('0x27'));this[_0x05b2('0x7')]('dtlsverify','no');this[_0x05b2('0x7')](_0x05b2('0x4e'),'actpass');this['setDataValue'](_0x05b2('0x4f'),_0x1e035c[_0x05b2('0x4f')]||'/etc/pki/tls/certs/motion.crt');this[_0x05b2('0x7')]('dtlsprivatekey',_0x1e035c['dtlsprivatekey']||_0x05b2('0x50'));this['setDataValue'](_0x05b2('0x4c'),_0x05b2('0x27'));break;default:}}},'permissions':{'type':Sequelize[_0x05b2('0x40')],'set':function(_0x434137){this[_0x05b2('0x7')]('permissions',_0x434137?_0x434137[_0x05b2('0x22')](','):[]);},'get':function(){return this[_0x05b2('0xd')](_0x05b2('0x51'))?_[_0x05b2('0x52')](this[_0x05b2('0xd')](_0x05b2('0x51'))[_0x05b2('0x23')](','),function(_0x66b401){return parseInt(_0x66b401,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize['STRING']},'phoneBarNoReplyNumber':{'type':Sequelize[_0x05b2('0x5')]},'phoneBarBusyNumber':{'type':Sequelize['STRING']},'phoneBarUnconditional':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x05b2('0x17')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0x05b2('0x17')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x05b2('0x17')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x05b2('0x5')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0x05b2('0x16')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x05b2('0x17')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0x05b2('0x5')]},'phoneBarEnableJaws':{'type':Sequelize[_0x05b2('0x17')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x05b2('0x17')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x05b2('0xd')](_0x05b2('0x53'))?this[_0x05b2('0xd')](_0x05b2('0x53')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x05b2('0x17')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0x05b2('0x17')],'defaultValue':![]},'interface':{'type':Sequelize[_0x05b2('0x5')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x05b2('0x17')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x05b2('0x5')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x05b2('0x5')],'allowNull':!![]},'screenrecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0x38a8f9){if(typeof _0x38a8f9===_0x05b2('0x54')){var _0x3c6f7c=_0x38a8f9==='1'?!![]:_0x38a8f9==='0'?![]:_0x38a8f9===_0x05b2('0x55')?!![]:_0x38a8f9==='false'?![]:![];this[_0x05b2('0x7')](_0x05b2('0x56'),_0x3c6f7c);}else{this[_0x05b2('0x7')](_0x05b2('0x56'),_0x38a8f9);}}},'blocked':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0x40da35){this[_0x05b2('0x7')](_0x05b2('0x57'),_0x40da35);if(_0x40da35===!![]){this[_0x05b2('0x7')]('blockedAt',moment());this[_0x05b2('0x7')](_0x05b2('0x58'),0x0);}else{this[_0x05b2('0x7')]('blockedAt',null);}}},'blockedAt':{'type':Sequelize[_0x05b2('0x18')],'defaultValue':null},'loginAttempts':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'disabled':{'type':Sequelize[_0x05b2('0x17')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0x05b2('0x17')],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0x05b2('0x16')](0x5)[_0x05b2('0x59')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0x05b2('0x17')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x05b2('0x17')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x05b2('0x17')],'defaultValue':!![]}}; \ No newline at end of file +var _0xd0c9=['DEFAULT\x20PAUSE','INTEGER','peer','friend','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','transport','join','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','info','inband','nonat','update','yes','force_rport,comedia','nat','split','all','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','\x22\x22\x20<>','refuse','originate','uac','uas','fingerprint','certificate','active','actpass','update,nonat','TEXT','get','isArray','udp','wss','encryption','avpf','force_avp','dtlsverify','dtlssetup','dtlsprivatekey','icesupport','dtlsenable','dtlscertfile','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','rtcp_mux','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','string','true','false','blocked','blockedAt','loginAttempts','sequelize','moment','STRING','name','The\x20name\x20of\x20the\x20user','setDataValue','fullname','callerid','format','getDataValue','email','toLowerCase','ENUM','user','telephone','local','accountcode','\x22%s\x22\x20<%s>','DATE','BOOLEAN'];(function(_0x3186aa,_0x34c21e){var _0x2d8c36=function(_0x239e99){while(--_0x239e99){_0x3186aa['push'](_0x3186aa['shift']());}};_0x2d8c36(++_0x34c21e);}(_0xd0c9,0xe2));var _0x9d0c=function(_0x35da42,_0x5c2610){_0x35da42=_0x35da42-0x0;var _0x370035=_0xd0c9[_0x35da42];return _0x370035;};'use strict';var Sequelize=require(_0x9d0c('0x0'));var moment=require(_0x9d0c('0x1'));var util=require('util');var _=require('lodash');module['exports']={'name':{'type':Sequelize[_0x9d0c('0x2')],'allowNull':![],'unique':_0x9d0c('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x36524f){this['setDataValue'](_0x9d0c('0x3'),_0x36524f);this['setDataValue']('defaultuser',_0x36524f);},'comment':_0x9d0c('0x4')},'fullname':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0x3eec5f){this[_0x9d0c('0x5')](_0x9d0c('0x6'),_0x3eec5f);this[_0x9d0c('0x5')](_0x9d0c('0x7'),util[_0x9d0c('0x8')]('\x22%s\x22\x20<%s>',_0x3eec5f,this[_0x9d0c('0x9')]('internal')));}},'alias':{'type':Sequelize[_0x9d0c('0x2')]},'email':{'type':Sequelize[_0x9d0c('0x2')],'allowNull':![],'unique':_0x9d0c('0xa'),'validate':{'isEmail':!![]},'set':function(_0x53f49a){if(_0x53f49a){this[_0x9d0c('0x5')](_0x9d0c('0xa'),_0x53f49a[_0x9d0c('0xb')]());}}},'role':{'type':Sequelize[_0x9d0c('0xc')]('admin',_0x9d0c('0xd'),'agent',_0x9d0c('0xe')),'allowNull':![]},'password':{'type':Sequelize[_0x9d0c('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0x9d0c('0x2')],'defaultValue':_0x9d0c('0xf')},'internal':{'type':Sequelize['INTEGER'](0xb),'allowNull':![],'unique':'internal','set':function(_0x52ff64){this[_0x9d0c('0x5')]('internal',_0x52ff64);this[_0x9d0c('0x5')](_0x9d0c('0x10'),_0x52ff64);this[_0x9d0c('0x5')](_0x9d0c('0x7'),util[_0x9d0c('0x8')](_0x9d0c('0x11'),this[_0x9d0c('0x9')](_0x9d0c('0x6')),_0x52ff64));}},'salt':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x9d0c('0x2')]},'mobile':{'type':Sequelize[_0x9d0c('0x2')]},'address':{'type':Sequelize['STRING']},'zipcode':{'type':Sequelize[_0x9d0c('0x2')]},'userpic':{'type':Sequelize[_0x9d0c('0x2')]},'city':{'type':Sequelize[_0x9d0c('0x2')]},'country':{'type':Sequelize['STRING']},'online':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x9d0c('0x12')]},'voicePause':{'type':Sequelize[_0x9d0c('0x13')],'defaultValue':![]},'chatPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x9d0c('0x13')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x9d0c('0x13')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0x9d0c('0x13')],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0x9d0c('0x13')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x9d0c('0x13')],'defaultValue':![]},'pauseType':{'type':Sequelize['STRING'],'defaultValue':_0x9d0c('0x14')},'lastPauseAt':{'type':Sequelize['DATE']},'chatCapacity':{'type':Sequelize[_0x9d0c('0x15')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0x9d0c('0x15')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x9d0c('0x15')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x9d0c('0x15')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x9d0c('0x15')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x9d0c('0x13')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0x9d0c('0x15')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x9d0c('0x13')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x9d0c('0x15')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x9d0c('0x13')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x9d0c('0x13')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x9d0c('0x13')],'defaultValue':![]},'description':{'type':Sequelize[_0x9d0c('0x2')],'allowNull':!![]},'host':{'type':Sequelize[_0x9d0c('0x2')],'allowNull':!![],'defaultValue':'dynamic'},'ipaddr':{'type':Sequelize[_0x9d0c('0x2')],'allowNull':!![]},'port':{'type':Sequelize[_0x9d0c('0x15')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0x9d0c('0x15')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize['STRING'],'allowNull':!![]},'regserver':{'type':Sequelize[_0x9d0c('0x2')],'allowNull':!![]},'useragent':{'type':Sequelize[_0x9d0c('0x2')],'allowNull':!![]},'lastms':{'type':Sequelize[_0x9d0c('0x15')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x9d0c('0xc')]('friend',_0x9d0c('0xd'),_0x9d0c('0x16')),'allowNull':!![],'defaultValue':_0x9d0c('0x17')},'context':{'type':Sequelize[_0x9d0c('0x2')],'allowNull':!![],'defaultValue':'from-sip'},'callingpres':{'type':Sequelize['ENUM']('ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN',_0x9d0c('0x18'),_0x9d0c('0x19'),_0x9d0c('0x1a'),_0x9d0c('0x1b'),'PROHIB_FAILED_SCREEN','PROHIB'),'allowNull':!![]},'deny':{'type':Sequelize[_0x9d0c('0x2')],'allowNull':!![]},'permit':{'type':Sequelize[_0x9d0c('0x2')],'allowNull':!![]},'secret':{'type':Sequelize[_0x9d0c('0x2')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x9d0c('0x2')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x9d0c('0x2')],'allowNull':!![]},'transport':{'type':Sequelize[_0x9d0c('0x2')],'allowNull':!![],'defaultValue':'udp','set':function(_0x2fcf87){this[_0x9d0c('0x5')](_0x9d0c('0x1c'),_0x2fcf87?_0x2fcf87[_0x9d0c('0x1d')](','):null);},'get':function(){return this[_0x9d0c('0x9')](_0x9d0c('0x1c'))?this['getDataValue']('transport')['split'](','):null;},'comment':_0x9d0c('0x1e')},'dtmfmode':{'type':Sequelize[_0x9d0c('0xc')]('rfc2833',_0x9d0c('0x1f'),'shortinfo',_0x9d0c('0x20'),'auto'),'allowNull':!![],'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize[_0x9d0c('0xc')]('yes','no',_0x9d0c('0x21'),_0x9d0c('0x22'),'outgoing'),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x9d0c('0xc')](_0x9d0c('0x23'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x9d0c('0x2')],'allowNull':!![]},'directmediadeny':{'type':Sequelize['STRING'],'allowNull':!![]},'nat':{'type':Sequelize[_0x9d0c('0x2')],'allowNull':!![],'defaultValue':_0x9d0c('0x24'),'set':function(_0x1c1de6){this[_0x9d0c('0x5')](_0x9d0c('0x25'),_0x1c1de6?_0x1c1de6[_0x9d0c('0x1d')](','):null);},'get':function(){return this[_0x9d0c('0x9')](_0x9d0c('0x25'))?this['getDataValue'](_0x9d0c('0x25'))[_0x9d0c('0x26')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize[_0x9d0c('0x2')]},'namedcallgroup':{'type':Sequelize[_0x9d0c('0x2')]},'pickupgroup':{'type':Sequelize[_0x9d0c('0x2')]},'namedpickupgroup':{'type':Sequelize[_0x9d0c('0x2')]},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x9d0c('0x2')]},'disallow':{'type':Sequelize[_0x9d0c('0x2')],'allowNull':![],'defaultValue':_0x9d0c('0x27')},'allow':{'type':Sequelize[_0x9d0c('0x2')],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x528517){this[_0x9d0c('0x5')](_0x9d0c('0x28'),_0x528517?_0x528517[_0x9d0c('0x1d')](';'):'ulaw;alaw;gsm');},'get':function(){return this[_0x9d0c('0x9')](_0x9d0c('0x28'))?this[_0x9d0c('0x9')]('allow')['split'](';'):null;},'comment':_0x9d0c('0x29')},'autoframing':{'type':Sequelize[_0x9d0c('0xc')](_0x9d0c('0x23'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x9d0c('0x2')],'allowNull':!![],'set':function(_0x15c93){this[_0x9d0c('0x5')](_0x9d0c('0x2a'),_0x15c93?_0x15c93[_0x9d0c('0x1d')](','):null);},'get':function(){return this[_0x9d0c('0x9')](_0x9d0c('0x2a'))?this[_0x9d0c('0x9')](_0x9d0c('0x2a'))[_0x9d0c('0x26')](','):null;},'comment':_0x9d0c('0x2b')},'trustrpid':{'type':Sequelize[_0x9d0c('0xc')](_0x9d0c('0x23'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x9d0c('0xc')](_0x9d0c('0x23'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize['ENUM'](_0x9d0c('0x23'),'no',_0x9d0c('0x2c')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x9d0c('0xc')](_0x9d0c('0x23'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x9d0c('0xc')](_0x9d0c('0x23'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x9d0c('0x2')],'allowNull':!![]},'callerid':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x9d0c('0x2d')},'amaflags':{'type':Sequelize[_0x9d0c('0x2')],'allowNull':!![]},'callcounter':{'type':Sequelize['ENUM'](_0x9d0c('0x23'),'no'),'allowNull':!![],'defaultValue':_0x9d0c('0x23')},'busylevel':{'type':Sequelize[_0x9d0c('0x15')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x9d0c('0xc')](_0x9d0c('0x23'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0x9d0c('0xc')](_0x9d0c('0x23'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x9d0c('0xc')](_0x9d0c('0x23'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x9d0c('0xc')](_0x9d0c('0x23'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x9d0c('0x2')],'allowNull':!![]},'template':{'type':Sequelize[_0x9d0c('0x2')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x9d0c('0xc')](_0x9d0c('0x23'),'no','always'),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x9d0c('0xc')](_0x9d0c('0x23'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x9d0c('0x2')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x9d0c('0xc')]('accept',_0x9d0c('0x2e'),_0x9d0c('0x2f')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x9d0c('0x15')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x9d0c('0x15')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize['ENUM'](_0x9d0c('0x30'),_0x9d0c('0x31')),'allowNull':!![],'defaultValue':_0x9d0c('0x31')},'t38pt_usertpsource':{'type':Sequelize[_0x9d0c('0x2')],'allowNull':!![]},'regexten':{'type':Sequelize[_0x9d0c('0x2')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x9d0c('0x2')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x9d0c('0x2')],'allowNull':!![]},'qualify':{'type':Sequelize[_0x9d0c('0xc')](_0x9d0c('0x23'),'no'),'allowNull':!![],'defaultValue':_0x9d0c('0x23')},'keepalive':{'type':Sequelize[_0x9d0c('0x15')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x9d0c('0x2')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x9d0c('0x2')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0x9d0c('0x15')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x9d0c('0x2')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x9d0c('0x2')],'allowNull':!![]},'timert1':{'type':Sequelize[_0x9d0c('0x15')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x9d0c('0x2')],'allowNull':!![]},'contactdeny':{'type':Sequelize['STRING'],'allowNull':!![]},'contactacl':{'type':Sequelize[_0x9d0c('0x2')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x9d0c('0x2')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0x9d0c('0x2')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x9d0c('0x15')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize['ENUM'](_0x9d0c('0x23'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0x9d0c('0xc')]('yes','no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x9d0c('0xc')](_0x9d0c('0x23'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0x9d0c('0xc')]('yes','no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0x9d0c('0xc')]('yes','no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0x9d0c('0xc')](_0x9d0c('0x23'),'no',_0x9d0c('0x32'),_0x9d0c('0x33')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x9d0c('0x15')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x9d0c('0x2')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x9d0c('0x2')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x9d0c('0x2')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x9d0c('0x2')],'allowNull':!![]},'dtlscapath':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x9d0c('0xc')](_0x9d0c('0x34'),'passive',_0x9d0c('0x35')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING'],'allowNull':!![]},'usereqphone':{'type':Sequelize['ENUM'](_0x9d0c('0x23'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING'],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0x9d0c('0x2')],'allowNull':!![]},'call_limit':{'type':Sequelize[_0x9d0c('0x15')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0x9d0c('0xc')]('yes','no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x9d0c('0xc')](_0x9d0c('0x23'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x9d0c('0x2')],'allowNull':!![]},'mohinterpret':{'type':Sequelize['STRING'],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x9d0c('0x2')],'allowNull':!![]},'parkinglot':{'type':Sequelize['STRING'],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0x9d0c('0xc')]('yes','no',_0x9d0c('0x21'),'update',_0x9d0c('0x36')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x9d0c('0x13')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x9d0c('0x2')]},'resetPasswordExpires':{'type':Sequelize[_0x9d0c('0x12')]},'passwordResetAt':{'type':Sequelize[_0x9d0c('0x12')],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0x9d0c('0x37')]},'showWebBar':{'type':Sequelize['INTEGER'],'defaultValue':0x0,'set':function(_0x4fbce7){this[_0x9d0c('0x5')]('showWebBar',_0x4fbce7);var _0x1987b2=this[_0x9d0c('0x38')]({'plain':!![]});switch(_0x4fbce7){case 0x0:case 0x1:var _0x44a54b=_0x1987b2['transport']?_[_0x9d0c('0x39')](_0x1987b2[_0x9d0c('0x1c')])?_0x1987b2['transport'][_0x9d0c('0x1d')]():_0x1987b2[_0x9d0c('0x1c')]:_0x9d0c('0x3a');if(_0x44a54b===_0x9d0c('0x3b')){_0x44a54b='udp';}this[_0x9d0c('0x5')](_0x9d0c('0x1c'),_0x44a54b);this[_0x9d0c('0x5')](_0x9d0c('0x3c'),'no');this['setDataValue'](_0x9d0c('0x3d'),null);this[_0x9d0c('0x5')](_0x9d0c('0x3e'),null);this[_0x9d0c('0x5')]('icesupport',null);this[_0x9d0c('0x5')]('dtlsenable',null);this[_0x9d0c('0x5')](_0x9d0c('0x3f'),null);this[_0x9d0c('0x5')](_0x9d0c('0x40'),null);this[_0x9d0c('0x5')]('dtlscertfile',null);this[_0x9d0c('0x5')](_0x9d0c('0x41'),null);this[_0x9d0c('0x5')]('rtcp_mux','no');break;case 0x2:this['setDataValue'](_0x9d0c('0x1c'),_0x9d0c('0x3b'));this[_0x9d0c('0x5')](_0x9d0c('0x3c'),_0x9d0c('0x23'));this[_0x9d0c('0x5')](_0x9d0c('0x3d'),_0x9d0c('0x23'));this[_0x9d0c('0x5')](_0x9d0c('0x3e'),_0x9d0c('0x23'));this['setDataValue'](_0x9d0c('0x42'),_0x9d0c('0x23'));this[_0x9d0c('0x5')](_0x9d0c('0x43'),_0x9d0c('0x23'));this[_0x9d0c('0x5')](_0x9d0c('0x3f'),'no');this[_0x9d0c('0x5')](_0x9d0c('0x40'),_0x9d0c('0x35'));this[_0x9d0c('0x5')]('dtlscertfile',_0x1987b2[_0x9d0c('0x44')]||_0x9d0c('0x45'));this['setDataValue'](_0x9d0c('0x41'),_0x1987b2[_0x9d0c('0x41')]||_0x9d0c('0x46'));this[_0x9d0c('0x5')](_0x9d0c('0x47'),'yes');break;default:}}},'permissions':{'type':Sequelize['TEXT'],'set':function(_0x35a767){this[_0x9d0c('0x5')]('permissions',_0x35a767?_0x35a767['join'](','):[]);},'get':function(){return this[_0x9d0c('0x9')](_0x9d0c('0x48'))?_[_0x9d0c('0x49')](this['getDataValue'](_0x9d0c('0x48'))[_0x9d0c('0x26')](','),function(_0x36d48b){return parseInt(_0x36d48b,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x9d0c('0x2')]},'phoneBarNoReplyNumber':{'type':Sequelize['STRING']},'phoneBarBusyNumber':{'type':Sequelize['STRING']},'phoneBarUnconditional':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x9d0c('0x13')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0x9d0c('0x13')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x9d0c('0x13')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0x9d0c('0x13')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x9d0c('0x13')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0x9d0c('0x15')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize['STRING'],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0x9d0c('0x15')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x9d0c('0xc')]('yes','no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x9d0c('0x13')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize['STRING']},'phoneBarEnableJaws':{'type':Sequelize[_0x9d0c('0x13')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x9d0c('0x13')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0x9d0c('0x4a')],'get':function(){return this['getDataValue'](_0x9d0c('0x4b'))?this[_0x9d0c('0x9')](_0x9d0c('0x4b')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x9d0c('0x13')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x9d0c('0x13')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0x9d0c('0x13')],'defaultValue':![]},'interface':{'type':Sequelize[_0x9d0c('0x2')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x9d0c('0x13')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x9d0c('0x2')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x9d0c('0x2')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0x9d0c('0x13')],'defaultValue':![],'set':function(_0x5fa2cb){if(typeof _0x5fa2cb===_0x9d0c('0x4c')){var _0x549dcf=_0x5fa2cb==='1'?!![]:_0x5fa2cb==='0'?![]:_0x5fa2cb===_0x9d0c('0x4d')?!![]:_0x5fa2cb===_0x9d0c('0x4e')?![]:![];this['setDataValue']('screenrecording',_0x549dcf);}else{this[_0x9d0c('0x5')]('screenrecording',_0x5fa2cb);}}},'blocked':{'type':Sequelize[_0x9d0c('0x13')],'defaultValue':![],'set':function(_0x4fc9fc){this['setDataValue'](_0x9d0c('0x4f'),_0x4fc9fc);if(_0x4fc9fc===!![]){this[_0x9d0c('0x5')](_0x9d0c('0x50'),moment());this['setDataValue'](_0x9d0c('0x51'),0x0);}else{this[_0x9d0c('0x5')]('blockedAt',null);}}},'blockedAt':{'type':Sequelize[_0x9d0c('0x12')],'defaultValue':null},'loginAttempts':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'disabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'settingsEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'wssPort':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0x9d0c('0x13')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x9d0c('0x13')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/user/user.controller.js b/server/api/user/user.controller.js index 4ce0663..5a3c55f 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 _0xda20=['addSquareProjects','removeSquareProjects','getScheduledCalls','CmHopper','$and','$or','$gt','$gte','$lt','$lte','$ne','$eq','$between','$notIn','$like','$notLike','$iLike','$notILike','$contains','$contained','firstName','lastName','Contact','dialActive','VoiceQueue','token','No\x20API\x20access\x20key\x20found!','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','createApiKey','generateApiKey','nonce','removeApiKey','apiKeyNonce','apiKeyIat','API\x20key\x20not\x20available','whoami','Unable\x20to\x20retrieve\x20the\x20current\x20user','getPresence','queues','teams','inbound','lower','col','toString','asc','substring','uniqBy','orderBy','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','result','offline','unknown','unavailable','ringing','voiceStatus','busy','slice','charAt','select','field','InteractionId','ui.createdAt','user_has_','_interactions','ui.UserId\x20=\x20?','OpenTabs','moment','util','squel','ioredis','../../components/auth/service','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','socket.io-emitter','redis','./user.socket','register','defaults','localhost','client','http','request','then','User,\x20%s,\x20%s','request\x20sent','error','message','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','update','destroy','get','role','admin','Agents','agent','filter','ignore','map','value','find','name','UserProfileResource','send','index','rawAttributes','fieldName','type','key','password','where','User','query','includeAll','include','includes','attributes','findAll','rows','length','push','sms','dataValues','fax','mail','openchannel','all','catch','show','params','model','differenceBy','keys','salt','filters','fields','merge','openTabs','true','whatsapp','body','describe','addContacts','ids','omit','findById','securePassword','validatePasswordPattern','max','internal','min_internal','isNil','sequelize','select\x20(select\x20IFNULL(max(internal)+1,1)\x20from\x20users\x20where\x20internal\x20<\x20md.internal)\x20as\x20\x27from\x27,\x20md.internal\x20-\x201\x20as\x20\x27to\x27\x20from\x20users\x20md\x20where\x20md.internal\x20!=\x201\x20and\x20not\x20exists\x20(select\x201\x20from\x20users\x20md2\x20where\x20md2.internal\x20=\x20md.internal\x20-\x201)','QueryTypes','SELECT','from','voicemail','mailbox','VoiceMail','fullname','email','permissions','101','102','103','104','105','107','108','109','100','111','114','115','user','Unauthorized','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator','checkUserLimits','settingsEnabled','userProfileId','create','UserProfileSection','Telephones','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','bulkCreate','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user','some','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator','each','telephone','isEmpty','oldPassword','newPassword','ValidationError','authenticate','Sequelize','Wrong\x20credentials','New\x20password\x20must\x20be\x20different\x20from\x20old\x20password','Invalid\x20body\x20format.\x20Use\x20newPassword','Setting','findOne','enforcePasswordHistory','passwordHistoryLimit','previousPasswords','validatePasswordHistory','updatePasswordsHistory','addQueues','channel','online','loginInPause','voicePause','isValidChannel','Unknown\x20channel','add','toLowerCase','Queues','penalty','spread','capitalize','QueueId','emit','Queue:save','voice','interface','format','SIP/%s','UserVoiceQueueRt','removeQueues','remove','isArray','Queue:remove','addAvatar','filename','getAvatar','join','root','userpic','download','server/files/images/','ChatOpenTabs','createdAt','FaxOpenTabs','FAX','OpenchannelOpenTabs','OPENCHANNEL','MailOpenTabs','SmsOpenTabs','SMS','WHATSAPP','CmContact','intersection','sort','pick','options','getContacts','hasOwnProperty','CmList','List','Tag','color','tag','getQueues','order','Queue','nolimit','getVoiceQueuesRt','getGroups','ChatGroup','getRecordings','UserId','VoiceRecording','getScreenRecordings','ScreenRecording','getChatInteractions','ChatInteraction','getOpenchannelInteractions','OpenchannelInteraction','getMailInteractions','MailInteraction','getSmsInteractions','SmsInteraction','FaxInteraction','getFaxInteractions','getWhatsappInteractions','WhatsappInteraction','login','phone','mobile','LOCAL/%s@from-sip/n','intrf','user:forcelogout','x-forwarded-for','connection','remoteAddress','socket','getVoiceQueues','UserVoiceQueue.penalty','upsert','MemberReport','YYYY-MM-DD\x20HH:mm:ss','getChannels','forEach','LOGIN','device','LOGININPAUSE','concat','isMiddleware','resolve','logout','pause','PAUSE','updateAttributes','DEFAULT\x20PAUSE','unpause','mailPause','chatPause','faxPause','openchannelPause','smsPause','whatsapppause','pauseType','lastPauseAt','QueuePause','chat','%s%s','Pause','manual','getTeams','Team','addTeams','getChatQueues','setDataValue','getMailQueues','getSmsQueues','Sms','getWhatsappQueues','Whatsapp','getFaxQueues','getOpenchannelQueues','flatten','transaction','addAgent','getDataValue','Voice','TeamVoicePrefix','removeTeams','Chat','UserVoicePrefix','VoicePrefixId','getLists','getAgents','You\x20can\x27t\x20delete\x20yourself','addChatInteractions','removeChatInteractions','user_has_chat_interactions:remove','removeMailInteractions','addFaxInteractions','user_has_fax_interactions:save','removeFaxInteractions','user_has_fax_interactions:remove','user_has_sms_interactions:save','removeSmsInteractions','user_has_sms_interactions:remove','addOpenchannelInteractions','user_has_openchannel_interactions:save','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','addWhatsappInteractions','user_has_whatsapp_interactions:save','removeWhatsappInteractions','getVoicePrefixes','VoicePrefix','getFaxAccounts','FaxAccount','addFaxAccounts','removeFaxAccounts','MailAccount','getMailAccounts','addMailAccounts','removeMailAccounts','getOpenchannelAccounts','OpenchannelAccount','addOpenchannelAccounts','removeOpenchannelAccounts','getSmsAccounts','addSmsAccounts','removeSmsAccounts','getChatWebsites','addChatWebsites','removeChatWebsites','getWhatsappAccounts','addWhatsappAccounts','removeWhatsappAccounts','getSquareProjects'];(function(_0x3238a7,_0x51ff1b){var _0x504fd3=function(_0x49c24b){while(--_0x49c24b){_0x3238a7['push'](_0x3238a7['shift']());}};_0x504fd3(++_0x51ff1b);}(_0xda20,0x1d9));var _0x0da2=function(_0xc90fa1,_0x2f71bb){_0xc90fa1=_0xc90fa1-0x0;var _0x1820a3=_0xda20[_0xc90fa1];return _0x1820a3;};'use strict';var moment=require(_0x0da2('0x0'));var BPromise=require('bluebird');var util=require(_0x0da2('0x1'));var path=require('path');var fs=require('fs');var _=require('lodash');var squel=require(_0x0da2('0x2'));var jayson=require('jayson/promise');var Redis=require(_0x0da2('0x3'));var authService=require(_0x0da2('0x4'));var qs=require('../../components/parsers/qs');var logger=require(_0x0da2('0x5'))(_0x0da2('0x6'));var utils=require('../../config/utils');var config=require(_0x0da2('0x7'));var licenseUtil=require(_0x0da2('0x8'));var db=require(_0x0da2('0x9'))['db'];var socket=require(_0x0da2('0xa'))(new Redis(config[_0x0da2('0xb')]));require(_0x0da2('0xc'))[_0x0da2('0xd')](socket);config[_0x0da2('0xb')]=_[_0x0da2('0xe')](config['redis'],{'host':_0x0da2('0xf'),'port':0x18eb});var client=jayson[_0x0da2('0x10')][_0x0da2('0x11')]({'port':0x232a});var values;function respondWithRpcPromise(_0x13fe84,_0x586247,_0x487261,_0x286402){return new BPromise(function(_0x9a8656,_0x8d21d1){var _0x3e50d5=_0x286402||client;return _0x3e50d5[_0x0da2('0x12')](_0x13fe84,_0x487261)[_0x0da2('0x13')](function(_0x34013e){logger['info'](_0x0da2('0x14'),_0x586247,'request\x20sent');logger['debug']('User,\x20%s,\x20%s,\x20%s',_0x586247,_0x0da2('0x15'),JSON['stringify'](_0x34013e));if(_0x34013e[_0x0da2('0x16')]){if(_0x34013e[_0x0da2('0x16')]['code']===0x1f4){logger[_0x0da2('0x16')](_0x0da2('0x14'),_0x586247,_0x34013e['error'][_0x0da2('0x17')]);return _0x8d21d1(_0x34013e[_0x0da2('0x16')][_0x0da2('0x17')]);}logger['error'](_0x0da2('0x14'),_0x586247,_0x34013e[_0x0da2('0x16')]['message']);return _0x9a8656(_0x34013e['error'][_0x0da2('0x17')]);}else{logger['info'](_0x0da2('0x14'),_0x586247,'request\x20sent');_0x9a8656(_0x34013e['result']['message']);}})['catch'](function(_0x109645){logger[_0x0da2('0x16')](_0x0da2('0x14'),_0x586247,_0x109645);_0x8d21d1(_0x109645);});});}function respondWithStatusCode(_0x5db845,_0x5304af){_0x5304af=_0x5304af||0xcc;return function(_0x52367c){if(_0x52367c){return _0x5db845[_0x0da2('0x18')](_0x5304af);}return _0x5db845[_0x0da2('0x19')](_0x5304af)[_0x0da2('0x1a')]();};}function respondWithResult(_0x3d7e96,_0x262630){_0x262630=_0x262630||0xc8;return function(_0x51786b){if(_0x51786b){return _0x3d7e96[_0x0da2('0x19')](_0x262630)[_0x0da2('0x1b')](_0x51786b);}};}function respondWithFilteredResult(_0x1c3ab0,_0x3c3dbc){return function(_0x336c76){if(_0x336c76){var _0x333835=typeof _0x3c3dbc[_0x0da2('0x1c')]===_0x0da2('0x1d')&&typeof _0x3c3dbc[_0x0da2('0x1e')]==='undefined';var _0x43966a=_0x336c76['count'];var _0x40fc6a=_0x333835?0x0:_0x3c3dbc[_0x0da2('0x1c')];var _0x2aa651=_0x333835?_0x336c76[_0x0da2('0x1f')]:_0x3c3dbc['offset']+_0x3c3dbc[_0x0da2('0x1e')];var _0x2a931d;if(_0x2aa651>=_0x43966a){_0x2aa651=_0x43966a;_0x2a931d=0xc8;}else{_0x2a931d=0xce;}_0x1c3ab0[_0x0da2('0x19')](_0x2a931d);return _0x1c3ab0[_0x0da2('0x20')](_0x0da2('0x21'),_0x40fc6a+'-'+_0x2aa651+'/'+_0x43966a)['json'](_0x336c76);}return null;};}function saveUpdates(_0x1b657d){return function(_0x538970){if(_0x538970){return _0x538970[_0x0da2('0x22')](_0x1b657d)[_0x0da2('0x13')](function(_0x19058e){return _0x19058e;});}return null;};}function removeEntity(_0x3a2625){return function(_0x1d17ad){if(_0x1d17ad){return _0x1d17ad[_0x0da2('0x23')]()[_0x0da2('0x13')](function(){var _0x3c5460=_0x1d17ad[_0x0da2('0x24')]({'plain':!![]});if(_0x3c5460[_0x0da2('0x25')]===_0x0da2('0x26'))return;var _0x5e1596=[{'name':'Users','value':'user','ignore':!![]},{'name':_0x0da2('0x27'),'value':_0x0da2('0x28'),'ignore':![]},{'name':'Telephones','value':'telephone','ignore':![]}];var _0x1c4ea4=_(_0x5e1596)[_0x0da2('0x29')](_0x0da2('0x2a'))[_0x0da2('0x2b')]('value')[_0x0da2('0x2c')]();if(_['includes'](_0x1c4ea4,_0x3c5460[_0x0da2('0x25')])){return;}var _0x5fccd=_[_0x0da2('0x2d')](_0x5e1596,[_0x0da2('0x2c'),_0x3c5460[_0x0da2('0x25')]])[_0x0da2('0x2e')];return db[_0x0da2('0x2f')]['destroy']({'where':{'type':_0x5fccd,'resourceId':_0x3c5460['id']}})[_0x0da2('0x13')](function(){return _0x1d17ad;});})[_0x0da2('0x13')](function(){_0x3a2625[_0x0da2('0x19')](0xcc)[_0x0da2('0x1a')]();});}};}function handleEntityNotFound(_0x2cfddc){return function(_0x1b3c60){if(!_0x1b3c60){_0x2cfddc['sendStatus'](0x194);}return _0x1b3c60;};}function handleError(_0x408b21,_0x390cb9){_0x390cb9=_0x390cb9||0x1f4;return function(_0x314ea2){logger[_0x0da2('0x16')](_0x314ea2['stack']);if(_0x314ea2['name']){delete _0x314ea2[_0x0da2('0x2e')];}_0x408b21[_0x0da2('0x19')](_0x390cb9)[_0x0da2('0x30')](_0x314ea2);};}exports[_0x0da2('0x31')]=function(_0x2eee02,_0x124dbc){var _0xe4bf41={},_0x306704={'count':0x0,'rows':[]};var _0x267333=_(db['User'][_0x0da2('0x32')])[_0x0da2('0x2b')](function(_0x3b7959){return{'name':_0x3b7959[_0x0da2('0x33')],'type':_0x3b7959[_0x0da2('0x34')][_0x0da2('0x35')]};})[_0x0da2('0x29')](function(_0x25817c){return!_['includes']([_0x0da2('0x36'),'salt'],_0x25817c['name']);})[_0x0da2('0x2c')]();_0xe4bf41=qs['getOptions'](_0x267333,_0x2eee02);var _0xfe1cd3={'where':_0xe4bf41[_0x0da2('0x37')]};return db[_0x0da2('0x38')][_0x0da2('0x1f')](_0xfe1cd3)['then'](function(_0x249735){_0x306704[_0x0da2('0x1f')]=_0x249735;if(_0x2eee02[_0x0da2('0x39')][_0x0da2('0x3a')]){_0xe4bf41[_0x0da2('0x3b')]=[{'all':!![]}];}if(!_[_0x0da2('0x3c')](_0xe4bf41[_0x0da2('0x3d')],'id')){_0xe4bf41[_0x0da2('0x3d')]['push']('id');}return db['User'][_0x0da2('0x3e')](_0xe4bf41);})['then'](function(_0x325732){_0x306704['rows']=_0x325732;if(_0x2eee02[_0x0da2('0x39')]['openTabs']==='true'){var _0x5693ca=[];for(var _0xa9ef0=0x0;_0xa9ef0<_0x306704[_0x0da2('0x3f')][_0x0da2('0x40')];_0xa9ef0++){_0x5693ca[_0x0da2('0x41')](get_open_tabs('chat',_0x306704[_0x0da2('0x3f')][_0xa9ef0]['dataValues']));_0x5693ca[_0x0da2('0x41')](get_open_tabs(_0x0da2('0x42'),_0x306704['rows'][_0xa9ef0][_0x0da2('0x43')]));_0x5693ca[_0x0da2('0x41')](get_open_tabs(_0x0da2('0x44'),_0x306704[_0x0da2('0x3f')][_0xa9ef0]['dataValues']));_0x5693ca[_0x0da2('0x41')](get_open_tabs(_0x0da2('0x45'),_0x306704['rows'][_0xa9ef0][_0x0da2('0x43')]));_0x5693ca[_0x0da2('0x41')](get_open_tabs(_0x0da2('0x46'),_0x306704[_0x0da2('0x3f')][_0xa9ef0]['dataValues']));_0x5693ca[_0x0da2('0x41')](get_open_tabs('whatsapp',_0x306704[_0x0da2('0x3f')][_0xa9ef0][_0x0da2('0x43')]));}return BPromise[_0x0da2('0x47')](_0x5693ca)[_0x0da2('0x13')](function(_0x2e36c6){return _0x306704;});}else{return _0x306704;}})['then'](respondWithFilteredResult(_0x124dbc,_0xe4bf41))[_0x0da2('0x48')](handleError(_0x124dbc,null));};exports[_0x0da2('0x49')]=function(_0x13236c,_0x464fed){var _0x47c2f5={'raw':![],'where':{'id':_0x13236c[_0x0da2('0x4a')]['id']}},_0x1d7bef={};_0x1d7bef[_0x0da2('0x4b')]=_[_0x0da2('0x4c')](_[_0x0da2('0x4d')](db['User'][_0x0da2('0x32')]),[_0x0da2('0x36'),_0x0da2('0x4e')]);_0x1d7bef[_0x0da2('0x39')]=_[_0x0da2('0x4d')](_0x13236c[_0x0da2('0x39')]);_0x1d7bef[_0x0da2('0x4f')]=_['intersection'](_0x1d7bef[_0x0da2('0x4b')],_0x1d7bef['query']);_0x47c2f5['attributes']=_['intersection'](_0x1d7bef[_0x0da2('0x4b')],qs[_0x0da2('0x50')](_0x13236c[_0x0da2('0x39')][_0x0da2('0x50')]));_0x47c2f5['attributes']=_0x47c2f5[_0x0da2('0x3d')]['length']?_0x47c2f5['attributes']:_0x1d7bef['model'];if(_0x13236c[_0x0da2('0x39')][_0x0da2('0x3a')]){_0x47c2f5[_0x0da2('0x3b')]=[{'all':!![]}];}_0x47c2f5=_[_0x0da2('0x51')]({},_0x47c2f5,_0x13236c['options']);if(!_[_0x0da2('0x3c')](_0x47c2f5[_0x0da2('0x3d')],'id')){_0x47c2f5[_0x0da2('0x3d')][_0x0da2('0x41')]('id');}return db[_0x0da2('0x38')][_0x0da2('0x2d')](_0x47c2f5)[_0x0da2('0x13')](handleEntityNotFound(_0x464fed,null))['then'](function(_0x328cb7){var _0x1fa268=[];values=_0x328cb7;if(_0x13236c[_0x0da2('0x39')][_0x0da2('0x52')]===_0x0da2('0x53')){_0x1fa268['push'](get_open_tabs('chat',_0x328cb7[_0x0da2('0x43')]));_0x1fa268[_0x0da2('0x41')](get_open_tabs('sms',_0x328cb7['dataValues']));_0x1fa268[_0x0da2('0x41')](get_open_tabs(_0x0da2('0x46'),_0x328cb7[_0x0da2('0x43')]));_0x1fa268[_0x0da2('0x41')](get_open_tabs(_0x0da2('0x54'),_0x328cb7[_0x0da2('0x43')]));_0x1fa268[_0x0da2('0x41')](get_open_tabs(_0x0da2('0x44'),_0x328cb7[_0x0da2('0x43')]));_0x1fa268[_0x0da2('0x41')](get_open_tabs(_0x0da2('0x45'),_0x328cb7[_0x0da2('0x43')]));return BPromise[_0x0da2('0x47')](_0x1fa268);}else{return values;}})[_0x0da2('0x13')](function(_0x489e36){return values;})[_0x0da2('0x13')](respondWithResult(_0x464fed,null))['catch'](handleError(_0x464fed,null));};exports['update']=function(_0x3a2295,_0x2b7eb1){if(_0x3a2295[_0x0da2('0x55')]['id']){delete _0x3a2295[_0x0da2('0x55')]['id'];}delete _0x3a2295[_0x0da2('0x55')][_0x0da2('0x25')];return db[_0x0da2('0x38')]['find']({'where':{'id':_0x3a2295['params']['id']}})[_0x0da2('0x13')](handleEntityNotFound(_0x2b7eb1,null))['then'](saveUpdates(_0x3a2295['body'],null))[_0x0da2('0x13')](respondWithResult(_0x2b7eb1,null))[_0x0da2('0x48')](handleError(_0x2b7eb1,null));};exports[_0x0da2('0x56')]=function(_0xed6587,_0x32d92f){return db[_0x0da2('0x38')]['describe']()[_0x0da2('0x13')](respondWithResult(_0x32d92f,null))[_0x0da2('0x48')](handleError(_0x32d92f,null));};exports[_0x0da2('0x57')]=function(_0x2a035c,_0x4d2cf9){return db[_0x0da2('0x38')][_0x0da2('0x2d')]({'where':{'id':_0x2a035c['params']['id']}})[_0x0da2('0x13')](handleEntityNotFound(_0x4d2cf9,null))['then'](function(_0x19db59){if(_0x19db59){return _0x19db59[_0x0da2('0x57')](_0x2a035c[_0x0da2('0x55')][_0x0da2('0x58')],_[_0x0da2('0x59')](_0x2a035c[_0x0da2('0x55')],['ids','id'])||{});}})['then'](respondWithResult(_0x4d2cf9,null))['catch'](handleError(_0x4d2cf9,null));};function validateUser(_0x187d03){return new BPromise(function(_0x3313b2,_0x1f8dd1){if(_0x187d03['internal'])return _0x3313b2(_0x187d03);return db['Setting'][_0x0da2('0x5a')](0x1)['then'](function(_0x3e4681){if(_0x3e4681[_0x0da2('0x5b')])authService[_0x0da2('0x5c')](_0x187d03[_0x0da2('0x36')]);db[_0x0da2('0x38')][_0x0da2('0x5d')](_0x0da2('0x5e'))[_0x0da2('0x13')](function(_0x5c3944){if(_['isNil'](_0x5c3944)){_0x187d03['internal']=_0x3e4681[_0x0da2('0x5f')]||0x1;return;}if(_[_0x0da2('0x60')](_0x3e4681[_0x0da2('0x5f')])||_0x3e4681[_0x0da2('0x5f')]===_0x5c3944){_0x187d03[_0x0da2('0x5e')]=_0x5c3944+0x1;return;}if(_0x3e4681[_0x0da2('0x5f')]>_0x5c3944){_0x187d03[_0x0da2('0x5e')]=_0x3e4681[_0x0da2('0x5f')];return;}return db[_0x0da2('0x61')][_0x0da2('0x39')](_0x0da2('0x62'),{'type':db[_0x0da2('0x61')][_0x0da2('0x63')][_0x0da2('0x64')]})[_0x0da2('0x13')](function(_0x486b2a){if(_0x486b2a&&_0x486b2a[_0x0da2('0x40')]){for(var _0x20e796=0x0,_0x52ee70=_0x486b2a[_0x0da2('0x40')];_0x20e796<_0x52ee70&&_[_0x0da2('0x60')](_0x187d03[_0x0da2('0x5e')]);_0x20e796++){if(_0x3e4681[_0x0da2('0x5f')]<=_0x486b2a[_0x20e796]['from']){_0x187d03['internal']=_0x486b2a[_0x20e796][_0x0da2('0x65')];}else if(_0x3e4681[_0x0da2('0x5f')]>_0x486b2a[_0x20e796][_0x0da2('0x65')]&&_0x3e4681[_0x0da2('0x5f')]<=_0x486b2a[_0x20e796]['to']){_0x187d03[_0x0da2('0x5e')]=_0x3e4681[_0x0da2('0x5f')];}}}if(_[_0x0da2('0x60')](_0x187d03['internal'])){_0x187d03[_0x0da2('0x5e')]=_0x5c3944+0x1;}return _0x3313b2(_0x187d03);});});})[_0x0da2('0x48')](function(_0x1806df){_0x1f8dd1(_0x1806df);});});}function updateUser(_0x12e6ae){return new BPromise(function(_0x19cfd0,_0x588e05){try{if(_0x12e6ae[_0x0da2('0x66')]){_0x12e6ae[_0x0da2('0x67')]=_0x12e6ae['internal'];_0x12e6ae[_0x0da2('0x68')]={'mailbox':_0x12e6ae[_0x0da2('0x5e')],'password':_0x12e6ae[_0x0da2('0x36')],'fullname':_0x12e6ae[_0x0da2('0x69')],'email':_0x12e6ae[_0x0da2('0x6a')]};}if(_0x12e6ae[_0x0da2('0x25')]===_0x0da2('0x28')){if(!_0x12e6ae[_0x0da2('0x6b')])_0x12e6ae[_0x0da2('0x6b')]=[_0x0da2('0x6c'),_0x0da2('0x6d'),_0x0da2('0x6e'),'113','110',_0x0da2('0x6f'),_0x0da2('0x70'),'106',_0x0da2('0x71'),_0x0da2('0x72'),_0x0da2('0x73'),_0x0da2('0x74'),_0x0da2('0x75'),_0x0da2('0x76'),_0x0da2('0x77')];}_0x19cfd0(_0x12e6ae);}catch(_0x3cc453){_0x588e05(_0x3cc453);}});}exports['create']=function(_0x26d05c,_0x381402){if(_0x26d05c[_0x0da2('0x78')][_0x0da2('0x25')]===_0x0da2('0x28'))throw new Error(_0x0da2('0x79'));if(_0x26d05c[_0x0da2('0x55')][_0x0da2('0x25')]===_0x0da2('0x78')&&_0x26d05c['user']['role']!==_0x0da2('0x26')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user');}if(_0x26d05c['body'][_0x0da2('0x25')]===_0x0da2('0x26')&&_0x26d05c[_0x0da2('0x78')][_0x0da2('0x25')]!==_0x0da2('0x26')){throw new Error(_0x0da2('0x7a'));}return licenseUtil[_0x0da2('0x7b')]([_0x26d05c[_0x0da2('0x55')]])[_0x0da2('0x13')](function(){return validateUser(_0x26d05c['body']);})[_0x0da2('0x13')](function(_0x466258){return updateUser(_0x466258)[_0x0da2('0x13')](function(_0x47fedb){if(_0x47fedb[_0x0da2('0x25')]===_0x0da2('0x26')){_0x47fedb[_0x0da2('0x7c')]=_0x26d05c[_0x0da2('0x78')][_0x0da2('0x7c')];delete _0x47fedb[_0x0da2('0x7d')];}return _0x47fedb;});})[_0x0da2('0x13')](function(_0x41c1fb){return db[_0x0da2('0x38')][_0x0da2('0x7e')](_0x41c1fb,{'include':[{'model':db[_0x0da2('0x68')],'as':'VoiceMail'}]});})[_0x0da2('0x13')](function(_0x295aac){if(_0x26d05c['body'][_0x0da2('0x25')]==='user')return _0x295aac;if(_0x26d05c[_0x0da2('0x78')][_0x0da2('0x25')]!==_0x0da2('0x78'))return _0x295aac;return db[_0x0da2('0x7f')][_0x0da2('0x2d')]({'where':{'name':_0x295aac[_0x0da2('0x25')]===_0x0da2('0x28')?'Agents':_0x0da2('0x80'),'userProfileId':_0x26d05c[_0x0da2('0x78')]['userProfileId']},'raw':!![]})[_0x0da2('0x13')](function(_0x36432f){if(!_0x36432f||_0x36432f[_0x0da2('0x81')]!=0x0)return _0x295aac;return db['UserProfileResource'][_0x0da2('0x7e')]({'name':_0x295aac[_0x0da2('0x2e')],'resourceId':_0x295aac['id'],'type':_0x36432f[_0x0da2('0x2e')],'sectionId':_0x36432f['id']},{})['then'](function(){return _0x295aac;});})[_0x0da2('0x48')](function(_0xdf4b71){logger[_0x0da2('0x16')](_0x0da2('0x82'),_0xdf4b71);throw _0xdf4b71;});})[_0x0da2('0x13')](respondWithResult(_0x381402,0xc9))[_0x0da2('0x48')](handleError(_0x381402,null));};exports[_0x0da2('0x83')]=function(_0x90eee8,_0xc2d651){var _0x35ffcd=_0x90eee8[_0x0da2('0x55')];var _0x70da18=[];if(_0x90eee8[_0x0da2('0x78')][_0x0da2('0x25')]===_0x0da2('0x28'))throw new Error(_0x0da2('0x79'));if(_['some'](_0x35ffcd,[_0x0da2('0x25'),_0x0da2('0x78')])&&_0x90eee8[_0x0da2('0x78')][_0x0da2('0x25')]!==_0x0da2('0x26')){throw new Error(_0x0da2('0x84'));}if(_[_0x0da2('0x85')](_0x35ffcd,[_0x0da2('0x25'),_0x0da2('0x26')])&&_0x90eee8['user'][_0x0da2('0x25')]!==_0x0da2('0x26')){throw new Error(_0x0da2('0x86'));}return licenseUtil[_0x0da2('0x7b')](_0x35ffcd)['then'](function(){return validateUser(_0x35ffcd[0x0]);})['then'](function(){for(var _0x2dd621=0x1;_0x2dd621<_0x35ffcd[_0x0da2('0x40')];_0x2dd621++){var _0x3b3d66=_0x35ffcd[_0x2dd621-0x1][_0x0da2('0x5e')];if(!_0x35ffcd[_0x2dd621]['internal'])_0x35ffcd[_0x2dd621][_0x0da2('0x5e')]=_0x3b3d66+0x1;_0x70da18[_0x0da2('0x41')](validateUser(_0x35ffcd[_0x2dd621]));}return BPromise[_0x0da2('0x47')](_0x70da18);})[_0x0da2('0x13')](function(){_0x70da18=[];for(var _0x45ac81=0x0;_0x45ac81<_0x35ffcd['length'];_0x45ac81++){_0x70da18[_0x0da2('0x41')](updateUser(_0x35ffcd[_0x45ac81]));}return BPromise['all'](_0x70da18);})[_0x0da2('0x13')](function(){return BPromise[_0x0da2('0x87')](_0x35ffcd,function(_0x48f397){return db[_0x0da2('0x38')]['create'](_0x48f397,{'include':[{'model':db['VoiceMail'],'as':_0x0da2('0x68')}]})[_0x0da2('0x13')](function(_0x9000eb){_0x48f397['id']=_0x9000eb['id'];return _0x48f397;});});})['then'](function(_0x3ace5f){if(_0x90eee8[_0x0da2('0x55')]['role']===_0x0da2('0x78'))return _0x3ace5f;if(_0x90eee8[_0x0da2('0x78')][_0x0da2('0x25')]!==_0x0da2('0x78'))return _0x3ace5f;var _0x45bafd=_[_0x0da2('0x85')](_0x3ace5f,function(_0x51dff0){return _0x51dff0[_0x0da2('0x25')]===_0x0da2('0x28')||_0x51dff0[_0x0da2('0x25')]===_0x0da2('0x88');});if(!_0x45bafd)return _0x3ace5f;return db['UserProfileSection'][_0x0da2('0x3e')]({'where':{'name':{'$or':['Agents','Telephones']},'userProfileId':_0x90eee8['user'][_0x0da2('0x7d')]},'raw':!![]})[_0x0da2('0x13')](function(_0x25ead7){if(_[_0x0da2('0x89')](_0x25ead7)||!_[_0x0da2('0x85')](_0x25ead7,['autoAssociation',0x0]))return _0x3ace5f;_0x70da18=[];var _0x156d5d=_(_0x25ead7)[_0x0da2('0x2b')](function(_0x5801b8){if(_0x5801b8[_0x0da2('0x81')]===0x1)return;return _0x5801b8[_0x0da2('0x2e')]===_0x0da2('0x27')?_0x0da2('0x28'):_0x0da2('0x88');})['compact']()[_0x0da2('0x2c')]();for(var _0x5a3a3e=0x0;_0x5a3a3e<_0x3ace5f[_0x0da2('0x40')];_0x5a3a3e++){if(!_[_0x0da2('0x3c')](_0x156d5d,_0x3ace5f[_0x5a3a3e][_0x0da2('0x25')]))return;var _0x4c03b7=_0x3ace5f[_0x5a3a3e]['role']===_0x0da2('0x28')?'Agents':_0x0da2('0x80');_0x70da18[_0x0da2('0x41')](db['UserProfileResource']['create']({'name':_0x3ace5f[_0x5a3a3e][_0x0da2('0x2e')],'resourceId':_0x3ace5f[_0x5a3a3e]['id'],'type':_0x4c03b7,'sectionId':_[_0x0da2('0x2d')](_0x25ead7,[_0x0da2('0x2e'),_0x4c03b7])['id']},{}));}return BPromise[_0x0da2('0x47')](_0x70da18);});})[_0x0da2('0x13')](respondWithResult(_0xc2d651,0xc9))[_0x0da2('0x48')](handleError(_0xc2d651,null));};exports['changePassword']=function(_0x11151f,_0xf1b6eb){if(_0x11151f[_0x0da2('0x55')]['id']){delete _0x11151f[_0x0da2('0x55')]['id'];}return db[_0x0da2('0x38')][_0x0da2('0x2d')]({'where':{'id':_0x11151f[_0x0da2('0x4a')]['id']}})[_0x0da2('0x13')](function(_0xabb845){if(!_0xabb845)return null;if(_0xabb845['id']===_0x11151f['user']['id']){if(!_0x11151f[_0x0da2('0x55')][_0x0da2('0x8a')]||!_0x11151f[_0x0da2('0x55')][_0x0da2('0x8b')]){throw new db['Sequelize'][(_0x0da2('0x8c'))]('Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword');}if(!_0xabb845[_0x0da2('0x8d')](_0x11151f['body'][_0x0da2('0x8a')])){throw new db[(_0x0da2('0x8e'))][(_0x0da2('0x8c'))](_0x0da2('0x8f'));}if(_0x11151f[_0x0da2('0x55')][_0x0da2('0x8a')]===_0x11151f[_0x0da2('0x55')][_0x0da2('0x8b')]){throw new db[(_0x0da2('0x8e'))][(_0x0da2('0x8c'))](_0x0da2('0x90'));}}else if(_0x11151f[_0x0da2('0x78')][_0x0da2('0x25')]===_0x0da2('0x26')){if(!_0x11151f['body']['newPassword']){throw new db[(_0x0da2('0x8e'))][(_0x0da2('0x8c'))](_0x0da2('0x91'));}}else if(_0x11151f[_0x0da2('0x78')][_0x0da2('0x25')]===_0x0da2('0x78')){if(!_0x11151f['body'][_0x0da2('0x8b')]){throw new db[(_0x0da2('0x8e'))][(_0x0da2('0x8c'))](_0x0da2('0x91'));}if(_0xabb845[_0x0da2('0x25')]!=='agent'){throw new db['Sequelize'][(_0x0da2('0x8c'))](_0x0da2('0x79'));}}else{throw new db['Sequelize'][(_0x0da2('0x8c'))](_0x0da2('0x79'));}return _0xabb845;})[_0x0da2('0x13')](handleEntityNotFound(_0xf1b6eb,null))[_0x0da2('0x13')](function(_0x332b10){return db[_0x0da2('0x92')][_0x0da2('0x93')]({'attributes':['id',_0x0da2('0x5b'),_0x0da2('0x94'),_0x0da2('0x95')]})[_0x0da2('0x13')](function(_0x48f667){if(_0x48f667[_0x0da2('0x5b')])authService[_0x0da2('0x5c')](_0x11151f[_0x0da2('0x55')][_0x0da2('0x8b')]);if(!_0x48f667[_0x0da2('0x94')]||!_0x332b10[_0x0da2('0x96')])return _0x332b10;authService[_0x0da2('0x97')](_0x11151f[_0x0da2('0x55')][_0x0da2('0x8b')],_0x332b10[_0x0da2('0x96')],_0x48f667[_0x0da2('0x95')]);return _0x332b10;})['then'](saveUpdates({'password':_0x11151f[_0x0da2('0x55')]['newPassword'],'passwordResetAt':_0x11151f[_0x0da2('0x78')]['id']==_0x11151f[_0x0da2('0x4a')]['id']?moment():null,'previousPasswords':authService[_0x0da2('0x98')](_0x11151f['body'][_0x0da2('0x8b')],_0x332b10[_0x0da2('0x96')])},null));})['then'](respondWithResult(_0xf1b6eb,null))['catch'](handleError(_0xf1b6eb,null));};exports[_0x0da2('0x99')]=function(_0x17c0bd,_0x308738){var _0x26d7b3=_0x17c0bd[_0x0da2('0x55')][_0x0da2('0x9a')];return db[_0x0da2('0x38')]['find']({'where':{'id':_0x17c0bd['params']['id']},'attributes':['id',_0x0da2('0x2e'),'role',_0x0da2('0x9b'),_0x0da2('0x9c'),_0x0da2('0x9d'),'interface']})['then'](handleEntityNotFound(_0x308738,null))[_0x0da2('0x13')](function(_0x79b8df){if(_0x79b8df){if(!utils[_0x0da2('0x9e')](_0x26d7b3)){throw new db['Sequelize'][(_0x0da2('0x8c'))](_0x0da2('0x9f'));}return _0x79b8df[_0x0da2('0xa0')+_['capitalize'](_0x26d7b3[_0x0da2('0xa1')]())+_0x0da2('0xa2')](_0x17c0bd[_0x0da2('0x55')]['ids'],{'penalty':_0x17c0bd[_0x0da2('0x55')][_0x0da2('0xa3')]||0x0})[_0x0da2('0xa4')](function(_0x4c1616){for(var _0x167495=0x0;_0x167495<_0x17c0bd[_0x0da2('0x55')]['ids'][_0x0da2('0x40')];_0x167495+=0x1){var _0x62a53b={'UserId':Number(_0x17c0bd[_0x0da2('0x4a')]['id'])};_0x62a53b[_[_0x0da2('0xa5')](_0x26d7b3[_0x0da2('0xa1')]())+_0x0da2('0xa6')]=Number(_0x17c0bd['body'][_0x0da2('0x58')][_0x167495]);socket[_0x0da2('0xa7')]('user'+_['capitalize'](_0x26d7b3[_0x0da2('0xa1')]())+_0x0da2('0xa8'),_0x62a53b);}return _0x4c1616;})['then'](function(){if(_0x26d7b3===_0x0da2('0xa9')){return db['VoiceQueue'][_0x0da2('0x3e')]({'where':{'id':_0x17c0bd[_0x0da2('0x55')]['ids']||[]},'raw':!![],'attributes':['id','name']});}})[_0x0da2('0x13')](function(_0x11d0ca){var _0x261c47=_0x79b8df[_0x0da2('0x24')]({'plain':!![]});var _0x1f1509=[];if(_0x26d7b3===_0x0da2('0xa9')&&_0x261c47[_0x0da2('0x25')]===_0x0da2('0x28')&&_0x261c47['online']){for(var _0x18a167=0x0;_0x18a167<_0x11d0ca['length'];_0x18a167+=0x1){_0x1f1509[_0x0da2('0x41')]({'membername':_0x261c47[_0x0da2('0x2e')],'UserId':_0x261c47['id'],'queue_name':_0x11d0ca[_0x18a167][_0x0da2('0x2e')],'VoiceQueueId':_0x11d0ca[_0x18a167]['id'],'interface':_['isNil'](_0x261c47[_0x0da2('0xaa')])?util[_0x0da2('0xab')](_0x0da2('0xac'),_0x261c47['name']):_0x261c47[_0x0da2('0xaa')],'paused':_0x261c47[_0x0da2('0x9d')]||![],'penalty':_0x17c0bd['body'][_0x0da2('0xa3')]||0x0});}return BPromise['each'](_0x1f1509,function(_0x1ab9c2){return db[_0x0da2('0xad')]['upsert'](_0x1ab9c2);});}return _0x79b8df;});}})['then'](respondWithStatusCode(_0x308738,null))['catch'](handleError(_0x308738,null));};exports[_0x0da2('0xae')]=function(_0x2b4e26,_0x1cee2f){var _0x343329;return db[_0x0da2('0x38')][_0x0da2('0x2d')]({'where':{'id':_0x2b4e26[_0x0da2('0x4a')]['id']},'attributes':['id',_0x0da2('0x2e'),'role']})[_0x0da2('0x13')](handleEntityNotFound(_0x1cee2f,null))['then'](function(_0xbd16c5){if(_0xbd16c5){_0x343329=_0xbd16c5;if(!_0x2b4e26[_0x0da2('0x39')][_0x0da2('0x9a')]||!utils[_0x0da2('0x9e')](_0x2b4e26[_0x0da2('0x39')][_0x0da2('0x9a')])){throw new db['Sequelize'][(_0x0da2('0x8c'))](_0x0da2('0x9f'));}return _0xbd16c5[_0x0da2('0xaf')+_['capitalize'](_0x2b4e26[_0x0da2('0x39')][_0x0da2('0x9a')]['toLowerCase']())+_0x0da2('0xa2')](_0x2b4e26[_0x0da2('0x39')][_0x0da2('0x58')]);}})['then'](function(_0x5069f1){if(_[_0x0da2('0xb0')](_0x2b4e26[_0x0da2('0x39')][_0x0da2('0x58')])){for(var _0xb49063=0x0;_0xb49063<_0x2b4e26[_0x0da2('0x39')][_0x0da2('0x58')][_0x0da2('0x40')];_0xb49063+=0x1){var _0x26bd5d={'UserId':Number(_0x2b4e26[_0x0da2('0x4a')]['id'])};_0x26bd5d[_[_0x0da2('0xa5')](_0x2b4e26[_0x0da2('0x39')]['channel'][_0x0da2('0xa1')]())+'QueueId']=Number(_0x2b4e26[_0x0da2('0x39')]['ids'][_0xb49063]);socket[_0x0da2('0xa7')]('user'+_['capitalize'](_0x2b4e26[_0x0da2('0x39')][_0x0da2('0x9a')][_0x0da2('0xa1')]())+_0x0da2('0xb1'),_0x26bd5d);}}else{var _0x26bd5d={'UserId':Number(_0x2b4e26[_0x0da2('0x4a')]['id'])};_0x26bd5d[_['capitalize'](_0x2b4e26['query'][_0x0da2('0x9a')]['toLowerCase']())+_0x0da2('0xa6')]=Number(_0x2b4e26['query']['ids']);socket[_0x0da2('0xa7')](_0x0da2('0x78')+_[_0x0da2('0xa5')](_0x2b4e26[_0x0da2('0x39')][_0x0da2('0x9a')][_0x0da2('0xa1')]())+'Queue:remove',_0x26bd5d);}return _0x5069f1;})['then'](function(){if(_0x2b4e26[_0x0da2('0x39')][_0x0da2('0x9a')]===_0x0da2('0xa9')){return db[_0x0da2('0xad')][_0x0da2('0x23')]({'where':{'UserId':_0x2b4e26['params']['id'],'VoiceQueueId':_0x2b4e26['query'][_0x0da2('0x58')]},'individualHooks':!![]})['then'](function(){return _0x343329;});}return _0x343329;})[_0x0da2('0x13')](respondWithStatusCode(_0x1cee2f,null))[_0x0da2('0x48')](handleError(_0x1cee2f,null));};exports[_0x0da2('0xb2')]=function(_0x24e4ca,_0x10eef2){_0x24e4ca[_0x0da2('0x55')]['userpic']=_0x24e4ca['file'][_0x0da2('0xb3')];return db[_0x0da2('0x38')]['find']({'where':{'id':_0x24e4ca[_0x0da2('0x4a')]['id']}})['then'](handleEntityNotFound(_0x10eef2,null))[_0x0da2('0x13')](saveUpdates(_0x24e4ca[_0x0da2('0x55')],null))['then'](respondWithResult(_0x10eef2,null))['catch'](handleError(_0x10eef2,null));};exports[_0x0da2('0xb4')]=function(_0xa6a1bb,_0x3f791e){var _0x4804a5=path[_0x0da2('0xb5')](config[_0x0da2('0xb6')],'server/files/images/logos/default_profile.png');return db[_0x0da2('0x38')][_0x0da2('0x2d')]({'where':{'id':_0xa6a1bb['params']['id']},'attributes':['id',_0x0da2('0xb7')],'raw':!![]})['then'](handleEntityNotFound(_0x3f791e,null))['then'](function(_0x34c9cf){if(_0x34c9cf){if(_['isNil'](_0x34c9cf[_0x0da2('0xb7')])){return _0x3f791e[_0x0da2('0xb8')](_0x4804a5);}else{if(!fs['existsSync'](path[_0x0da2('0xb5')](config[_0x0da2('0xb6')],'server/files/images/',_0x34c9cf[_0x0da2('0xb7')]))){return _0x3f791e[_0x0da2('0xb8')](_0x4804a5);}return _0x3f791e[_0x0da2('0xb8')](path[_0x0da2('0xb5')](config[_0x0da2('0xb6')],_0x0da2('0xb9'),_0x34c9cf['userpic']));}}})[_0x0da2('0x48')](handleError(_0x3f791e,null));};exports['getOpenTabs']=function(_0x4e4758,_0x27c5d8){return db[_0x0da2('0x38')][_0x0da2('0x2d')]({'where':{'id':_0x4e4758[_0x0da2('0x4a')]['id']},'attributes':['id']})['then'](handleEntityNotFound(_0x27c5d8,null))[_0x0da2('0x13')](function(_0x48c116){var _0x4f6c20=[];values=_0x48c116[_0x0da2('0x43')];_0x4f6c20['push'](get_open_tabs('chat',_0x48c116[_0x0da2('0x43')]));_0x4f6c20[_0x0da2('0x41')](get_open_tabs(_0x0da2('0x42'),_0x48c116[_0x0da2('0x43')]));_0x4f6c20[_0x0da2('0x41')](get_open_tabs(_0x0da2('0x46'),_0x48c116[_0x0da2('0x43')]));_0x4f6c20[_0x0da2('0x41')](get_open_tabs(_0x0da2('0x54'),_0x48c116[_0x0da2('0x43')]));_0x4f6c20[_0x0da2('0x41')](get_open_tabs(_0x0da2('0x44'),_0x48c116['dataValues']));_0x4f6c20[_0x0da2('0x41')](get_open_tabs(_0x0da2('0x45'),_0x48c116[_0x0da2('0x43')]));return BPromise[_0x0da2('0x47')](_0x4f6c20);})[_0x0da2('0x13')](function(_0x3e1cdd){var _0x1eba2b=[];if(_0x3e1cdd){for(var _0x397a46=0x0;_0x397a46=_0x861cfa){_0x2997c7=_0x861cfa;_0x2fceb0=0xc8;}else{_0x2fceb0=0xce;}_0x18fa11[_0x0537('0x24')](_0x2fceb0);return _0x18fa11['set'](_0x0537('0x25'),_0x1af181+'-'+_0x2997c7+'/'+_0x861cfa)['json'](_0x9920ac);}return null;};}function saveUpdates(_0x2a5787){return function(_0x4b2a3f){if(_0x4b2a3f){return _0x4b2a3f[_0x0537('0x26')](_0x2a5787)[_0x0537('0x14')](function(_0x9b3a32){return _0x9b3a32;});}return null;};}function removeEntity(_0xd2141e){return function(_0x77e9c0){if(_0x77e9c0){return _0x77e9c0['destroy']()[_0x0537('0x14')](function(){var _0x575024=_0x77e9c0[_0x0537('0x27')]({'plain':!![]});if(_0x575024[_0x0537('0x28')]===_0x0537('0x29'))return;var _0x5674bb=[{'name':'Users','value':'user','ignore':!![]},{'name':_0x0537('0x2a'),'value':_0x0537('0x2b'),'ignore':![]},{'name':_0x0537('0x2c'),'value':_0x0537('0x2d'),'ignore':![]}];var _0x16ad0d=_(_0x5674bb)[_0x0537('0x2e')](_0x0537('0x2f'))[_0x0537('0x30')]('value')[_0x0537('0x31')]();if(_[_0x0537('0x32')](_0x16ad0d,_0x575024[_0x0537('0x28')])){return;}var _0x325fb3=_['find'](_0x5674bb,[_0x0537('0x31'),_0x575024[_0x0537('0x28')]])['name'];return db[_0x0537('0x33')][_0x0537('0x34')]({'where':{'type':_0x325fb3,'resourceId':_0x575024['id']}})[_0x0537('0x14')](function(){return _0x77e9c0;});})['then'](function(){_0xd2141e[_0x0537('0x24')](0xcc)[_0x0537('0x1e')]();});}};}function handleEntityNotFound(_0x11865a){return function(_0x48a411){if(!_0x48a411){_0x11865a[_0x0537('0x35')](0x194);}return _0x48a411;};}function handleError(_0x2f43de,_0x3d5641){_0x3d5641=_0x3d5641||0x1f4;return function(_0x1127ce){logger[_0x0537('0x1a')](_0x1127ce[_0x0537('0x36')]);if(_0x1127ce['name']){delete _0x1127ce[_0x0537('0x37')];}_0x2f43de[_0x0537('0x24')](_0x3d5641)[_0x0537('0x38')](_0x1127ce);};}exports[_0x0537('0x39')]=function(_0x2ef53c,_0x869b66){var _0x524a3b={},_0x2b0f6d={'count':0x0,'rows':[]};var _0x23cc7a=_(db[_0x0537('0x3a')]['rawAttributes'])[_0x0537('0x30')](function(_0x11bd91){return{'name':_0x11bd91[_0x0537('0x3b')],'type':_0x11bd91[_0x0537('0x3c')]['key']};})[_0x0537('0x2e')](function(_0x5019ad){return!_[_0x0537('0x32')]([_0x0537('0x3d'),'salt'],_0x5019ad[_0x0537('0x37')]);})[_0x0537('0x31')]();_0x524a3b=qs[_0x0537('0x3e')](_0x23cc7a,_0x2ef53c);var _0x5ebe3a={'where':_0x524a3b['where']};return db[_0x0537('0x3a')][_0x0537('0x22')](_0x5ebe3a)[_0x0537('0x14')](function(_0x314bab){_0x2b0f6d[_0x0537('0x22')]=_0x314bab;if(_0x2ef53c['query'][_0x0537('0x3f')]){_0x524a3b[_0x0537('0x40')]=[{'all':!![]}];}if(!_[_0x0537('0x32')](_0x524a3b[_0x0537('0x41')],'id')){_0x524a3b[_0x0537('0x41')][_0x0537('0x42')]('id');}return db[_0x0537('0x3a')][_0x0537('0x43')](_0x524a3b);})[_0x0537('0x14')](function(_0x592590){_0x2b0f6d[_0x0537('0x44')]=_0x592590;if(_0x2ef53c['query'][_0x0537('0x45')]===_0x0537('0x46')){var _0x37f956=[];for(var _0x456ddf=0x0;_0x456ddf<_0x2b0f6d[_0x0537('0x44')][_0x0537('0x47')];_0x456ddf++){_0x37f956['push'](get_open_tabs(_0x0537('0x48'),_0x2b0f6d[_0x0537('0x44')][_0x456ddf][_0x0537('0x49')]));_0x37f956[_0x0537('0x42')](get_open_tabs(_0x0537('0x4a'),_0x2b0f6d[_0x0537('0x44')][_0x456ddf][_0x0537('0x49')]));_0x37f956['push'](get_open_tabs('fax',_0x2b0f6d['rows'][_0x456ddf]['dataValues']));_0x37f956[_0x0537('0x42')](get_open_tabs(_0x0537('0x4b'),_0x2b0f6d[_0x0537('0x44')][_0x456ddf]['dataValues']));_0x37f956[_0x0537('0x42')](get_open_tabs(_0x0537('0x4c'),_0x2b0f6d['rows'][_0x456ddf][_0x0537('0x49')]));_0x37f956[_0x0537('0x42')](get_open_tabs(_0x0537('0x4d'),_0x2b0f6d[_0x0537('0x44')][_0x456ddf][_0x0537('0x49')]));}return BPromise['all'](_0x37f956)[_0x0537('0x14')](function(_0x2b5045){return _0x2b0f6d;});}else{return _0x2b0f6d;}})[_0x0537('0x14')](respondWithFilteredResult(_0x869b66,_0x524a3b))['catch'](handleError(_0x869b66,null));};exports[_0x0537('0x4e')]=function(_0x1e7374,_0x36d387){var _0x154505={'raw':![],'where':{'id':_0x1e7374[_0x0537('0x4f')]['id']}},_0x282fa3={};_0x282fa3[_0x0537('0x50')]=_['differenceBy'](_['keys'](db[_0x0537('0x3a')]['rawAttributes']),['password',_0x0537('0x51')]);_0x282fa3[_0x0537('0x52')]=_['keys'](_0x1e7374[_0x0537('0x52')]);_0x282fa3[_0x0537('0x53')]=_[_0x0537('0x54')](_0x282fa3['model'],_0x282fa3[_0x0537('0x52')]);_0x154505[_0x0537('0x41')]=_[_0x0537('0x54')](_0x282fa3[_0x0537('0x50')],qs[_0x0537('0x55')](_0x1e7374['query'][_0x0537('0x55')]));_0x154505['attributes']=_0x154505[_0x0537('0x41')]['length']?_0x154505[_0x0537('0x41')]:_0x282fa3['model'];if(_0x1e7374['query'][_0x0537('0x3f')]){_0x154505['include']=[{'all':!![]}];}_0x154505=_[_0x0537('0x56')]({},_0x154505,_0x1e7374[_0x0537('0x57')]);if(!_[_0x0537('0x32')](_0x154505['attributes'],'id')){_0x154505[_0x0537('0x41')][_0x0537('0x42')]('id');}return db[_0x0537('0x3a')][_0x0537('0x58')](_0x154505)[_0x0537('0x14')](handleEntityNotFound(_0x36d387,null))[_0x0537('0x14')](function(_0x5ef932){var _0x426101=[];values=_0x5ef932;if(_0x1e7374['query'][_0x0537('0x45')]===_0x0537('0x46')){_0x426101[_0x0537('0x42')](get_open_tabs(_0x0537('0x48'),_0x5ef932[_0x0537('0x49')]));_0x426101[_0x0537('0x42')](get_open_tabs(_0x0537('0x4a'),_0x5ef932[_0x0537('0x49')]));_0x426101[_0x0537('0x42')](get_open_tabs('openchannel',_0x5ef932[_0x0537('0x49')]));_0x426101[_0x0537('0x42')](get_open_tabs(_0x0537('0x4d'),_0x5ef932[_0x0537('0x49')]));_0x426101[_0x0537('0x42')](get_open_tabs(_0x0537('0x59'),_0x5ef932[_0x0537('0x49')]));_0x426101[_0x0537('0x42')](get_open_tabs(_0x0537('0x4b'),_0x5ef932[_0x0537('0x49')]));return BPromise['all'](_0x426101);}else{return values;}})[_0x0537('0x14')](function(_0x19821d){return values;})[_0x0537('0x14')](respondWithResult(_0x36d387,null))[_0x0537('0x5a')](handleError(_0x36d387,null));};exports[_0x0537('0x26')]=function(_0x28a425,_0x262062){if(_0x28a425[_0x0537('0x5b')]['id']){delete _0x28a425[_0x0537('0x5b')]['id'];}delete _0x28a425[_0x0537('0x5b')][_0x0537('0x28')];return db[_0x0537('0x3a')][_0x0537('0x58')]({'where':{'id':_0x28a425['params']['id']}})[_0x0537('0x14')](handleEntityNotFound(_0x262062,null))['then'](saveUpdates(_0x28a425[_0x0537('0x5b')],null))['then'](respondWithResult(_0x262062,null))[_0x0537('0x5a')](handleError(_0x262062,null));};exports[_0x0537('0x5c')]=function(_0x69965d,_0x290b39){return db['User'][_0x0537('0x5c')]()['then'](respondWithResult(_0x290b39,null))['catch'](handleError(_0x290b39,null));};exports['addContacts']=function(_0x1378c0,_0x5d005e){return db[_0x0537('0x3a')][_0x0537('0x58')]({'where':{'id':_0x1378c0[_0x0537('0x4f')]['id']}})[_0x0537('0x14')](handleEntityNotFound(_0x5d005e,null))[_0x0537('0x14')](function(_0x4e94ba){if(_0x4e94ba){return _0x4e94ba[_0x0537('0x5d')](_0x1378c0[_0x0537('0x5b')][_0x0537('0x5e')],_['omit'](_0x1378c0[_0x0537('0x5b')],[_0x0537('0x5e'),'id'])||{});}})[_0x0537('0x14')](respondWithResult(_0x5d005e,null))[_0x0537('0x5a')](handleError(_0x5d005e,null));};function validateUser(_0x297d81){return new BPromise(function(_0x5aadef,_0x4b2e8a){if(_0x297d81[_0x0537('0x5f')])return _0x5aadef(_0x297d81);return db[_0x0537('0x60')][_0x0537('0x61')](0x1)[_0x0537('0x14')](function(_0x7ae504){if(_0x7ae504[_0x0537('0x62')])authService[_0x0537('0x63')](_0x297d81[_0x0537('0x3d')]);db[_0x0537('0x3a')]['max']('internal')[_0x0537('0x14')](function(_0x3a2d73){if(_[_0x0537('0x64')](_0x3a2d73)){_0x297d81[_0x0537('0x5f')]=_0x7ae504['min_internal']||0x1;return;}if(_[_0x0537('0x64')](_0x7ae504[_0x0537('0x65')])||_0x7ae504['min_internal']===_0x3a2d73){_0x297d81['internal']=_0x3a2d73+0x1;return;}if(_0x7ae504[_0x0537('0x65')]>_0x3a2d73){_0x297d81[_0x0537('0x5f')]=_0x7ae504['min_internal'];return;}return db[_0x0537('0x66')][_0x0537('0x52')](_0x0537('0x67'),{'type':db[_0x0537('0x66')][_0x0537('0x68')]['SELECT']})[_0x0537('0x14')](function(_0x3ce99d){if(_0x3ce99d&&_0x3ce99d[_0x0537('0x47')]){for(var _0x5efe24=0x0,_0x125e9e=_0x3ce99d[_0x0537('0x47')];_0x5efe24<_0x125e9e&&_['isNil'](_0x297d81['internal']);_0x5efe24++){if(_0x7ae504[_0x0537('0x65')]<=_0x3ce99d[_0x5efe24][_0x0537('0x69')]){_0x297d81['internal']=_0x3ce99d[_0x5efe24][_0x0537('0x69')];}else if(_0x7ae504['min_internal']>_0x3ce99d[_0x5efe24][_0x0537('0x69')]&&_0x7ae504[_0x0537('0x65')]<=_0x3ce99d[_0x5efe24]['to']){_0x297d81[_0x0537('0x5f')]=_0x7ae504['min_internal'];}}}if(_[_0x0537('0x64')](_0x297d81[_0x0537('0x5f')])){_0x297d81[_0x0537('0x5f')]=_0x3a2d73+0x1;}return _0x5aadef(_0x297d81);});});})[_0x0537('0x5a')](function(_0x20c1b9){_0x4b2e8a(_0x20c1b9);});});}function updateUser(_0x5a3d68){return new BPromise(function(_0x111c43,_0x4566d8){try{if(_0x5a3d68[_0x0537('0x6a')]){_0x5a3d68[_0x0537('0x6b')]=_0x5a3d68[_0x0537('0x5f')];_0x5a3d68[_0x0537('0x6c')]={'mailbox':_0x5a3d68['internal'],'password':_0x5a3d68['password'],'fullname':_0x5a3d68[_0x0537('0x6d')],'email':_0x5a3d68[_0x0537('0x6e')]};}if(_0x5a3d68[_0x0537('0x28')]===_0x0537('0x2b')){if(!_0x5a3d68[_0x0537('0x6f')])_0x5a3d68[_0x0537('0x6f')]=[_0x0537('0x70'),'102',_0x0537('0x71'),'113',_0x0537('0x72'),_0x0537('0x73'),_0x0537('0x74'),_0x0537('0x75'),_0x0537('0x76'),'108',_0x0537('0x77'),'100',_0x0537('0x78'),_0x0537('0x79'),_0x0537('0x7a')];}_0x111c43(_0x5a3d68);}catch(_0x106012){_0x4566d8(_0x106012);}});}exports['create']=function(_0x278911,_0x47434d){if(_0x278911[_0x0537('0x7b')]['role']===_0x0537('0x2b'))throw new Error('Unauthorized');if(_0x278911[_0x0537('0x5b')][_0x0537('0x28')]===_0x0537('0x7b')&&_0x278911[_0x0537('0x7b')]['role']!==_0x0537('0x29')){throw new Error(_0x0537('0x7c'));}if(_0x278911[_0x0537('0x5b')][_0x0537('0x28')]===_0x0537('0x29')&&_0x278911[_0x0537('0x7b')][_0x0537('0x28')]!==_0x0537('0x29')){throw new Error(_0x0537('0x7d'));}return licenseUtil[_0x0537('0x7e')]([_0x278911['body']])['then'](function(){return validateUser(_0x278911['body']);})['then'](function(_0x294daa){return updateUser(_0x294daa)[_0x0537('0x14')](function(_0x12de21){if(_0x12de21[_0x0537('0x28')]===_0x0537('0x29')){_0x12de21['settingsEnabled']=_0x278911[_0x0537('0x7b')][_0x0537('0x7f')];delete _0x12de21[_0x0537('0x80')];}return _0x12de21;});})['then'](function(_0x25fdac){return db['User'][_0x0537('0x81')](_0x25fdac,{'include':[{'model':db['VoiceMail'],'as':_0x0537('0x6c')}]});})['then'](function(_0x48f4c9){if(_0x278911[_0x0537('0x5b')][_0x0537('0x28')]===_0x0537('0x7b'))return _0x48f4c9;if(_0x278911['user'][_0x0537('0x28')]!==_0x0537('0x7b'))return _0x48f4c9;return db['UserProfileSection']['find']({'where':{'name':_0x48f4c9[_0x0537('0x28')]==='agent'?_0x0537('0x2a'):_0x0537('0x2c'),'userProfileId':_0x278911[_0x0537('0x7b')][_0x0537('0x80')]},'raw':!![]})[_0x0537('0x14')](function(_0x37e5bc){if(!_0x37e5bc||_0x37e5bc['autoAssociation']!=0x0)return _0x48f4c9;return db[_0x0537('0x33')][_0x0537('0x81')]({'name':_0x48f4c9[_0x0537('0x37')],'resourceId':_0x48f4c9['id'],'type':_0x37e5bc[_0x0537('0x37')],'sectionId':_0x37e5bc['id']},{})[_0x0537('0x14')](function(){return _0x48f4c9;});})[_0x0537('0x5a')](function(_0x4edd41){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4edd41);throw _0x4edd41;});})['then'](respondWithResult(_0x47434d,0xc9))[_0x0537('0x5a')](handleError(_0x47434d,null));};exports['bulkCreate']=function(_0x1f97f6,_0x3a3616){var _0x368d0e=_0x1f97f6[_0x0537('0x5b')];var _0x228657=[];if(_0x1f97f6['user']['role']===_0x0537('0x2b'))throw new Error('Unauthorized');if(_[_0x0537('0x82')](_0x368d0e,['role',_0x0537('0x7b')])&&_0x1f97f6[_0x0537('0x7b')][_0x0537('0x28')]!=='admin'){throw new Error(_0x0537('0x7c'));}if(_['some'](_0x368d0e,[_0x0537('0x28'),'admin'])&&_0x1f97f6[_0x0537('0x7b')][_0x0537('0x28')]!==_0x0537('0x29')){throw new Error(_0x0537('0x83'));}return licenseUtil['checkUserLimits'](_0x368d0e)['then'](function(){return validateUser(_0x368d0e[0x0]);})['then'](function(){for(var _0x13e140=0x1;_0x13e140<_0x368d0e[_0x0537('0x47')];_0x13e140++){var _0x9f6e58=_0x368d0e[_0x13e140-0x1]['internal'];if(!_0x368d0e[_0x13e140][_0x0537('0x5f')])_0x368d0e[_0x13e140][_0x0537('0x5f')]=_0x9f6e58+0x1;_0x228657[_0x0537('0x42')](validateUser(_0x368d0e[_0x13e140]));}return BPromise['all'](_0x228657);})[_0x0537('0x14')](function(){_0x228657=[];for(var _0x563c2a=0x0;_0x563c2a<_0x368d0e[_0x0537('0x47')];_0x563c2a++){_0x228657[_0x0537('0x42')](updateUser(_0x368d0e[_0x563c2a]));}return BPromise[_0x0537('0x84')](_0x228657);})[_0x0537('0x14')](function(){return BPromise[_0x0537('0x85')](_0x368d0e,function(_0x1621e3){return db[_0x0537('0x3a')][_0x0537('0x81')](_0x1621e3,{'include':[{'model':db['VoiceMail'],'as':_0x0537('0x6c')}]})['then'](function(_0x10e383){_0x1621e3['id']=_0x10e383['id'];return _0x1621e3;});});})[_0x0537('0x14')](function(_0x42c4de){if(_0x1f97f6[_0x0537('0x5b')][_0x0537('0x28')]==='user')return _0x42c4de;if(_0x1f97f6[_0x0537('0x7b')]['role']!==_0x0537('0x7b'))return _0x42c4de;var _0xc67ba0=_['some'](_0x42c4de,function(_0x37ff90){return _0x37ff90[_0x0537('0x28')]===_0x0537('0x2b')||_0x37ff90[_0x0537('0x28')]===_0x0537('0x2d');});if(!_0xc67ba0)return _0x42c4de;return db[_0x0537('0x86')][_0x0537('0x43')]({'where':{'name':{'$or':[_0x0537('0x2a'),'Telephones']},'userProfileId':_0x1f97f6[_0x0537('0x7b')][_0x0537('0x80')]},'raw':!![]})[_0x0537('0x14')](function(_0xe47adc){if(_[_0x0537('0x87')](_0xe47adc)||!_[_0x0537('0x82')](_0xe47adc,[_0x0537('0x88'),0x0]))return _0x42c4de;_0x228657=[];var _0x533489=_(_0xe47adc)[_0x0537('0x30')](function(_0x2f91d8){if(_0x2f91d8['autoAssociation']===0x1)return;return _0x2f91d8['name']===_0x0537('0x2a')?_0x0537('0x2b'):_0x0537('0x2d');})[_0x0537('0x89')]()[_0x0537('0x31')]();for(var _0x3e34f8=0x0;_0x3e34f8<_0x42c4de[_0x0537('0x47')];_0x3e34f8++){if(!_[_0x0537('0x32')](_0x533489,_0x42c4de[_0x3e34f8][_0x0537('0x28')]))return;var _0x5ebdb7=_0x42c4de[_0x3e34f8][_0x0537('0x28')]===_0x0537('0x2b')?_0x0537('0x2a'):_0x0537('0x2c');_0x228657[_0x0537('0x42')](db[_0x0537('0x33')][_0x0537('0x81')]({'name':_0x42c4de[_0x3e34f8][_0x0537('0x37')],'resourceId':_0x42c4de[_0x3e34f8]['id'],'type':_0x5ebdb7,'sectionId':_['find'](_0xe47adc,['name',_0x5ebdb7])['id']},{}));}return BPromise['all'](_0x228657);});})[_0x0537('0x14')](respondWithResult(_0x3a3616,0xc9))[_0x0537('0x5a')](handleError(_0x3a3616,null));};exports[_0x0537('0x8a')]=function(_0x5b4d77,_0x554c5b){if(_0x5b4d77[_0x0537('0x5b')]['id']){delete _0x5b4d77[_0x0537('0x5b')]['id'];}return db[_0x0537('0x3a')]['find']({'where':{'id':_0x5b4d77[_0x0537('0x4f')]['id']}})[_0x0537('0x14')](function(_0x2df277){if(!_0x2df277)return null;if(_0x2df277['id']===_0x5b4d77[_0x0537('0x7b')]['id']){if(!_0x5b4d77[_0x0537('0x5b')][_0x0537('0x8b')]||!_0x5b4d77[_0x0537('0x5b')]['newPassword']){throw new db[(_0x0537('0x8c'))]['ValidationError']('Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword');}if(!_0x2df277['authenticate'](_0x5b4d77['body'][_0x0537('0x8b')])){throw new db[(_0x0537('0x8c'))][(_0x0537('0x8d'))](_0x0537('0x8e'));}if(_0x5b4d77[_0x0537('0x5b')][_0x0537('0x8b')]===_0x5b4d77[_0x0537('0x5b')]['newPassword']){throw new db['Sequelize'][(_0x0537('0x8d'))]('New\x20password\x20must\x20be\x20different\x20from\x20old\x20password');}}else if(_0x5b4d77['user'][_0x0537('0x28')]==='admin'){if(!_0x5b4d77['body']['newPassword']){throw new db[(_0x0537('0x8c'))]['ValidationError'](_0x0537('0x8f'));}}else if(_0x5b4d77[_0x0537('0x7b')][_0x0537('0x28')]===_0x0537('0x7b')){if(!_0x5b4d77[_0x0537('0x5b')]['newPassword']){throw new db[(_0x0537('0x8c'))]['ValidationError'](_0x0537('0x8f'));}if(_0x2df277[_0x0537('0x28')]!=='agent'){throw new db['Sequelize']['ValidationError'](_0x0537('0x90'));}}else{throw new db[(_0x0537('0x8c'))]['ValidationError'](_0x0537('0x90'));}return _0x2df277;})[_0x0537('0x14')](handleEntityNotFound(_0x554c5b,null))[_0x0537('0x14')](function(_0x28d8a6){return db['Setting'][_0x0537('0x91')]({'attributes':['id',_0x0537('0x62'),_0x0537('0x92'),_0x0537('0x93')]})[_0x0537('0x14')](function(_0xfd3d92){if(_0xfd3d92[_0x0537('0x62')])authService[_0x0537('0x63')](_0x5b4d77[_0x0537('0x5b')]['newPassword']);if(!_0xfd3d92['enforcePasswordHistory']||!_0x28d8a6['previousPasswords'])return _0x28d8a6;authService['validatePasswordHistory'](_0x5b4d77[_0x0537('0x5b')][_0x0537('0x94')],_0x28d8a6[_0x0537('0x95')],_0xfd3d92[_0x0537('0x93')]);return _0x28d8a6;})[_0x0537('0x14')](saveUpdates({'password':_0x5b4d77[_0x0537('0x5b')][_0x0537('0x94')],'passwordResetAt':_0x5b4d77['user']['id']==_0x5b4d77['params']['id']?moment():null,'previousPasswords':authService[_0x0537('0x96')](_0x5b4d77[_0x0537('0x5b')][_0x0537('0x94')],_0x28d8a6[_0x0537('0x95')])},null));})[_0x0537('0x14')](respondWithResult(_0x554c5b,null))[_0x0537('0x5a')](handleError(_0x554c5b,null));};exports[_0x0537('0x97')]=function(_0x182dd9,_0x4f5387){var _0x2a4225=_0x182dd9[_0x0537('0x5b')][_0x0537('0x98')];return db[_0x0537('0x3a')]['find']({'where':{'id':_0x182dd9['params']['id']},'attributes':['id','name','role',_0x0537('0x99'),_0x0537('0x9a'),_0x0537('0x9b'),_0x0537('0x9c')]})[_0x0537('0x14')](handleEntityNotFound(_0x4f5387,null))[_0x0537('0x14')](function(_0x4392ed){if(_0x4392ed){if(!utils['isValidChannel'](_0x2a4225)){throw new db[(_0x0537('0x8c'))][(_0x0537('0x8d'))]('Unknown\x20channel');}return _0x4392ed[_0x0537('0x9d')+_[_0x0537('0x9e')](_0x2a4225[_0x0537('0x9f')]())+_0x0537('0xa0')](_0x182dd9[_0x0537('0x5b')]['ids'],{'penalty':_0x182dd9[_0x0537('0x5b')][_0x0537('0xa1')]||0x0})[_0x0537('0xa2')](function(_0x1a343b){for(var _0x27367d=0x0;_0x27367d<_0x182dd9[_0x0537('0x5b')]['ids'][_0x0537('0x47')];_0x27367d+=0x1){var _0x1b1ff3={'UserId':Number(_0x182dd9[_0x0537('0x4f')]['id'])};_0x1b1ff3[_[_0x0537('0x9e')](_0x2a4225['toLowerCase']())+'QueueId']=Number(_0x182dd9[_0x0537('0x5b')]['ids'][_0x27367d]);socket[_0x0537('0xa3')](_0x0537('0x7b')+_['capitalize'](_0x2a4225[_0x0537('0x9f')]())+_0x0537('0xa4'),_0x1b1ff3);}return _0x1a343b;})[_0x0537('0x14')](function(){if(_0x2a4225===_0x0537('0xa5')){return db['VoiceQueue'][_0x0537('0x43')]({'where':{'id':_0x182dd9['body'][_0x0537('0x5e')]||[]},'raw':!![],'attributes':['id',_0x0537('0x37')]});}})[_0x0537('0x14')](function(_0x280131){var _0x1fd205=_0x4392ed[_0x0537('0x27')]({'plain':!![]});var _0x5ed91a=[];if(_0x2a4225===_0x0537('0xa5')&&_0x1fd205['role']===_0x0537('0x2b')&&_0x1fd205[_0x0537('0x99')]){for(var _0x2f7d31=0x0;_0x2f7d31<_0x280131['length'];_0x2f7d31+=0x1){_0x5ed91a[_0x0537('0x42')]({'membername':_0x1fd205[_0x0537('0x37')],'UserId':_0x1fd205['id'],'queue_name':_0x280131[_0x2f7d31][_0x0537('0x37')],'VoiceQueueId':_0x280131[_0x2f7d31]['id'],'interface':_[_0x0537('0x64')](_0x1fd205[_0x0537('0x9c')])?util['format'](_0x0537('0xa6'),_0x1fd205['name']):_0x1fd205[_0x0537('0x9c')],'paused':_0x1fd205[_0x0537('0x9b')]||![],'penalty':_0x182dd9['body'][_0x0537('0xa1')]||0x0});}return BPromise[_0x0537('0x85')](_0x5ed91a,function(_0x424000){return db[_0x0537('0xa7')][_0x0537('0xa8')](_0x424000);});}return _0x4392ed;});}})[_0x0537('0x14')](respondWithStatusCode(_0x4f5387,null))['catch'](handleError(_0x4f5387,null));};exports[_0x0537('0xa9')]=function(_0x47a3a2,_0x3906b){var _0x558640;return db['User'][_0x0537('0x58')]({'where':{'id':_0x47a3a2[_0x0537('0x4f')]['id']},'attributes':['id','name','role']})[_0x0537('0x14')](handleEntityNotFound(_0x3906b,null))[_0x0537('0x14')](function(_0x43f561){if(_0x43f561){_0x558640=_0x43f561;if(!_0x47a3a2[_0x0537('0x52')][_0x0537('0x98')]||!utils[_0x0537('0xaa')](_0x47a3a2[_0x0537('0x52')][_0x0537('0x98')])){throw new db[(_0x0537('0x8c'))][(_0x0537('0x8d'))]('Unknown\x20channel');}return _0x43f561['remove'+_['capitalize'](_0x47a3a2['query'][_0x0537('0x98')][_0x0537('0x9f')]())+'Queues'](_0x47a3a2[_0x0537('0x52')][_0x0537('0x5e')]);}})[_0x0537('0x14')](function(_0xed88ed){if(_[_0x0537('0xab')](_0x47a3a2['query'][_0x0537('0x5e')])){for(var _0x2e01d5=0x0;_0x2e01d5<_0x47a3a2[_0x0537('0x52')][_0x0537('0x5e')][_0x0537('0x47')];_0x2e01d5+=0x1){var _0x5d389e={'UserId':Number(_0x47a3a2[_0x0537('0x4f')]['id'])};_0x5d389e[_[_0x0537('0x9e')](_0x47a3a2[_0x0537('0x52')]['channel'][_0x0537('0x9f')]())+_0x0537('0xac')]=Number(_0x47a3a2[_0x0537('0x52')]['ids'][_0x2e01d5]);socket[_0x0537('0xa3')](_0x0537('0x7b')+_['capitalize'](_0x47a3a2[_0x0537('0x52')]['channel'][_0x0537('0x9f')]())+'Queue:remove',_0x5d389e);}}else{var _0x5d389e={'UserId':Number(_0x47a3a2[_0x0537('0x4f')]['id'])};_0x5d389e[_[_0x0537('0x9e')](_0x47a3a2['query'][_0x0537('0x98')]['toLowerCase']())+_0x0537('0xac')]=Number(_0x47a3a2[_0x0537('0x52')][_0x0537('0x5e')]);socket[_0x0537('0xa3')](_0x0537('0x7b')+_[_0x0537('0x9e')](_0x47a3a2[_0x0537('0x52')][_0x0537('0x98')][_0x0537('0x9f')]())+_0x0537('0xad'),_0x5d389e);}return _0xed88ed;})[_0x0537('0x14')](function(){if(_0x47a3a2[_0x0537('0x52')][_0x0537('0x98')]===_0x0537('0xa5')){return db['UserVoiceQueueRt']['destroy']({'where':{'UserId':_0x47a3a2[_0x0537('0x4f')]['id'],'VoiceQueueId':_0x47a3a2[_0x0537('0x52')][_0x0537('0x5e')]},'individualHooks':!![]})['then'](function(){return _0x558640;});}return _0x558640;})['then'](respondWithStatusCode(_0x3906b,null))['catch'](handleError(_0x3906b,null));};exports[_0x0537('0xae')]=function(_0x22cf90,_0x33d8d2){_0x22cf90[_0x0537('0x5b')][_0x0537('0xaf')]=_0x22cf90[_0x0537('0xb0')]['filename'];return db[_0x0537('0x3a')][_0x0537('0x58')]({'where':{'id':_0x22cf90['params']['id']}})[_0x0537('0x14')](handleEntityNotFound(_0x33d8d2,null))[_0x0537('0x14')](saveUpdates(_0x22cf90[_0x0537('0x5b')],null))[_0x0537('0x14')](respondWithResult(_0x33d8d2,null))['catch'](handleError(_0x33d8d2,null));};exports[_0x0537('0xb1')]=function(_0x3317de,_0x3752ff){var _0x10e556=path[_0x0537('0xb2')](config['root'],_0x0537('0xb3'));return db[_0x0537('0x3a')][_0x0537('0x58')]({'where':{'id':_0x3317de[_0x0537('0x4f')]['id']},'attributes':['id',_0x0537('0xaf')],'raw':!![]})[_0x0537('0x14')](handleEntityNotFound(_0x3752ff,null))[_0x0537('0x14')](function(_0x21aaaf){if(_0x21aaaf){if(_[_0x0537('0x64')](_0x21aaaf[_0x0537('0xaf')])){return _0x3752ff[_0x0537('0xb4')](_0x10e556);}else{if(!fs['existsSync'](path['join'](config['root'],_0x0537('0xb5'),_0x21aaaf['userpic']))){return _0x3752ff[_0x0537('0xb4')](_0x10e556);}return _0x3752ff['download'](path[_0x0537('0xb2')](config[_0x0537('0xb6')],'server/files/images/',_0x21aaaf['userpic']));}}})[_0x0537('0x5a')](handleError(_0x3752ff,null));};exports[_0x0537('0xb7')]=function(_0x2176ef,_0x4cc2fc){return db[_0x0537('0x3a')]['find']({'where':{'id':_0x2176ef[_0x0537('0x4f')]['id']},'attributes':['id']})[_0x0537('0x14')](handleEntityNotFound(_0x4cc2fc,null))[_0x0537('0x14')](function(_0x44b2f8){var _0x42b8f9=[];values=_0x44b2f8[_0x0537('0x49')];_0x42b8f9[_0x0537('0x42')](get_open_tabs(_0x0537('0x48'),_0x44b2f8[_0x0537('0x49')]));_0x42b8f9[_0x0537('0x42')](get_open_tabs('sms',_0x44b2f8[_0x0537('0x49')]));_0x42b8f9['push'](get_open_tabs(_0x0537('0x4c'),_0x44b2f8[_0x0537('0x49')]));_0x42b8f9[_0x0537('0x42')](get_open_tabs(_0x0537('0x4d'),_0x44b2f8['dataValues']));_0x42b8f9[_0x0537('0x42')](get_open_tabs(_0x0537('0x59'),_0x44b2f8[_0x0537('0x49')]));_0x42b8f9[_0x0537('0x42')](get_open_tabs('mail',_0x44b2f8[_0x0537('0x49')]));return BPromise[_0x0537('0x84')](_0x42b8f9);})[_0x0537('0x14')](function(_0x2c1d26){var _0x5677a6=[];if(_0x2c1d26){for(var _0x3c7bbd=0x0;_0x3c7bbd=_0x2d66f4['agents']){throw new Error('Maximum\x20login\x20has\x20been\x20reached');}})[_0x7dac('0x10')](function(){if(_0x1f8b9f){return db[_0x7dac('0x2b')][_0x7dac('0x4b')]({'where':{'membername':_0x1f8b9f[_0x7dac('0x28')]},'individualHooks':!![]});}})['then'](function(){if(_0x1f8b9f){return _0x1f8b9f[_0x7dac('0x52')]({'raw':!![]});}})['then'](function(_0x28040c){if(_0x1f8b9f){if(_0x28040c){var _0x3966df=[];_0x3b0e24=_0x28040c;if(_0x3b0e24[_0x7dac('0x2e')]){for(var _0x53b0d0=0x0;_0x53b0d0<_0x3b0e24[_0x7dac('0x2e')];_0x53b0d0++){_0x3966df['push'](db['UserVoiceQueueRt']['upsert']({'membername':_0x1f8b9f[_0x7dac('0x28')],'UserId':_0x1f8b9f['id'],'queue_name':_0x3b0e24[_0x53b0d0][_0x7dac('0x28')],'VoiceQueueId':_0x3b0e24[_0x53b0d0]['id'],'interface':_0x5aa0ac,'paused':_0x1f8b9f[_0x7dac('0x53')]||![],'penalty':_0x3b0e24[_0x53b0d0][_0x7dac('0x54')]||0x0}));}return BPromise['all'](_0x3966df);}}}})['then'](function(){if(_0x1f8b9f){return db['MemberReport'][_0x7dac('0x1b')]({'where':{'membername':_0x1f8b9f['name'],'exitAt':null}});}})[_0x7dac('0x10')](function(_0xdcafc0){if(_0x1f8b9f){if(_0xdcafc0&&_0xdcafc0[_0x7dac('0x2e')]){var _0x2ff1b0=[];_0xdcafc0[_0x7dac('0x33')](function(_0x1ab606){_0x2ff1b0[_0x7dac('0x34')](_0x1ab606[_0x7dac('0x2c')]({'exitAt':moment()[_0x7dac('0x2f')](_0x7dac('0x30'))}));});return BPromise[_0x7dac('0x49')](_0x2ff1b0);}}})[_0x7dac('0x10')](function(_0x2729a1){if(_0x1f8b9f){var _0x4df5a3=[];var _0x262d80=[];var _0x1dea58=utils[_0x7dac('0x32')]();var _0x447375={'membername':_0x1f8b9f[_0x7dac('0x28')],'interface':_0x5aa0ac,'enterAt':moment()[_0x7dac('0x2f')]('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x1f8b9f['role'],'internal':_0x1f8b9f[_0x7dac('0x2a')]};_0x1dea58[_0x7dac('0x33')](function(_0x6734ff){_0x4df5a3[_0x7dac('0x34')](_['merge']({'channel':_0x6734ff,'type':_0x7dac('0x55'),'data1':_0x7dac('0x56'),'data2':_0x5aa0ac},_0x447375));if(_0x1f8b9f[_0x7dac('0x53')]){_0x262d80[_0x7dac('0x34')](_[_0x7dac('0x57')]({'channel':_0x6734ff,'type':_0x7dac('0x37'),'data1':_0x7dac('0x58')},_0x447375));}});return db[_0x7dac('0x2d')][_0x7dac('0x59')](_0x4df5a3['concat'](_0x262d80),{'individualHooks':!![]});}})[_0x7dac('0x10')](function(){if(_0x1f8b9f){return _0x1f8b9f[_0x7dac('0x2c')]({'online':!![],'lastLoginAt':moment()['format'](_0x7dac('0x30')),'voicePause':_0x1f8b9f[_0x7dac('0x53')]||![],'mailPause':_0x1f8b9f[_0x7dac('0x53')]||![],'chatPause':_0x1f8b9f[_0x7dac('0x53')]||![],'faxPause':_0x1f8b9f[_0x7dac('0x53')]||![],'smsPause':_0x1f8b9f[_0x7dac('0x53')]||![],'openchannelPause':_0x1f8b9f[_0x7dac('0x53')]||![],'pauseType':_0x1f8b9f[_0x7dac('0x53')]?'LOGININPAUSE':null,'lastPauseAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'interface':_0x5aa0ac});}})[_0x7dac('0x10')](function(_0x1db769){_0x34faae(_0x1db769);})['catch'](function(_0x537048){_0x5a5727(_0x4fd174[_0x7dac('0x17')](0x1f4,_0x537048['message']));});});}; \ No newline at end of file +var _0xd678=['fax','openchannel','whatsapp','system','%s%s','Pause','UserVoiceQueueRt','all','LogoutUser','destroy','push','LoginUser','mobile','phone','loginInPause','agents','getVoiceQueues','upsert','merge','LOGIN','callysquare','LOGININPAUSE','concat','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./user.socket','then','info','request\x20sent','User,\x20%s,\x20%s,\x20%s','stringify','error','code','User,\x20%s,\x20%s','message','catch','GetUser','findAll','options','raw','limit','include','map','attributes','model','debug','ShowUser','User','find','PauseUser','where','role','internal','interface','update','MemberReport','name','PAUSE','length','format','YYYY-MM-DD\x20HH:mm:ss','forEach','isNil','SIP/%s','body','type','uniqueid','bulkCreate','DEFAULT\x20PAUSE','UnpauseUser','findOne','channel','isValidChannel','Unknown\x20channel','voice','chat'];(function(_0x35f7f5,_0x4e2ee1){var _0x5567a4=function(_0x3e5df0){while(--_0x3e5df0){_0x35f7f5['push'](_0x35f7f5['shift']());}};_0x5567a4(++_0x4e2ee1);}(_0xd678,0x11f));var _0x8d67=function(_0x152678,_0x11e0ac){_0x152678=_0x152678-0x0;var _0x311a9=_0xd678[_0x152678];return _0x311a9;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x8d67('0x0'));var BPromise=require('bluebird');var rs=require(_0x8d67('0x1'));var fs=require('fs');var Redis=require(_0x8d67('0x2'));var db=require(_0x8d67('0x3'))['db'];var utils=require(_0x8d67('0x4'));var logger=require(_0x8d67('0x5'))(_0x8d67('0x6'));var config=require(_0x8d67('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x8d67('0x8')][_0x8d67('0x9')]({'port':0x232a});config[_0x8d67('0xa')]=_[_0x8d67('0xb')](config['redis'],{'host':_0x8d67('0xc'),'port':0x18eb});var socket=require(_0x8d67('0xd'))(new Redis(config[_0x8d67('0xa')]));require(_0x8d67('0xe'))['register'](socket);function respondWithRpcPromise(_0x141f1f,_0x2230ff,_0x3c9c34){return new BPromise(function(_0x5a8b0d,_0x5a3537){return client['request'](_0x141f1f,_0x3c9c34)[_0x8d67('0xf')](function(_0x43a4e8){logger[_0x8d67('0x10')]('User,\x20%s,\x20%s',_0x2230ff,_0x8d67('0x11'));logger['debug'](_0x8d67('0x12'),_0x2230ff,_0x8d67('0x11'),JSON[_0x8d67('0x13')](_0x43a4e8));if(_0x43a4e8[_0x8d67('0x14')]){if(_0x43a4e8['error'][_0x8d67('0x15')]===0x1f4){logger['error'](_0x8d67('0x16'),_0x2230ff,_0x43a4e8['error'][_0x8d67('0x17')]);return _0x5a3537(_0x43a4e8['error'][_0x8d67('0x17')]);}logger['error'](_0x8d67('0x16'),_0x2230ff,_0x43a4e8[_0x8d67('0x14')][_0x8d67('0x17')]);return _0x5a8b0d(_0x43a4e8['error']['message']);}else{logger[_0x8d67('0x10')](_0x8d67('0x16'),_0x2230ff,'request\x20sent');_0x5a8b0d(_0x43a4e8['result'][_0x8d67('0x17')]);}})[_0x8d67('0x18')](function(_0x5c3b60){logger['error'](_0x8d67('0x16'),_0x2230ff,_0x5c3b60);_0x5a3537(_0x5c3b60);});});}exports[_0x8d67('0x19')]=function(_0x5c73e7){var _0xa70624=this;return new Promise(function(_0x1509eb,_0x2affda){return db['User'][_0x8d67('0x1a')]({'raw':_0x5c73e7[_0x8d67('0x1b')]?_0x5c73e7['options'][_0x8d67('0x1c')]===undefined?!![]:![]:!![],'where':_0x5c73e7[_0x8d67('0x1b')]?_0x5c73e7['options']['where']||null:null,'attributes':_0x5c73e7['options']?_0x5c73e7[_0x8d67('0x1b')]['attributes']||null:null,'limit':_0x5c73e7[_0x8d67('0x1b')]?_0x5c73e7['options'][_0x8d67('0x1d')]||null:null,'include':_0x5c73e7['options']?_0x5c73e7[_0x8d67('0x1b')][_0x8d67('0x1e')]?_[_0x8d67('0x1f')](_0x5c73e7[_0x8d67('0x1b')]['include'],function(_0x39292d){return{'model':db[_0x39292d['model']],'as':_0x39292d['as'],'attributes':_0x39292d[_0x8d67('0x20')],'include':_0x39292d[_0x8d67('0x1e')]?_['map'](_0x39292d[_0x8d67('0x1e')],function(_0xaebece){return{'model':db[_0xaebece[_0x8d67('0x21')]],'as':_0xaebece['as'],'attributes':_0xaebece[_0x8d67('0x20')],'include':_0xaebece[_0x8d67('0x1e')]?_['map'](_0xaebece[_0x8d67('0x1e')],function(_0x129b00){return{'model':db[_0x129b00[_0x8d67('0x21')]],'as':_0x129b00['as'],'attributes':_0x129b00['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x1391b2){logger[_0x8d67('0x10')](_0x8d67('0x19'),_0x5c73e7);logger[_0x8d67('0x22')]('GetUser',_0x5c73e7,JSON[_0x8d67('0x13')](_0x1391b2));_0x1509eb(_0x1391b2);})[_0x8d67('0x18')](function(_0x5e2deb){logger[_0x8d67('0x14')]('GetUser',_0x5e2deb[_0x8d67('0x17')],_0x5c73e7);_0x2affda(_0xa70624[_0x8d67('0x14')](0x1f4,_0x5e2deb[_0x8d67('0x17')]));});});};exports[_0x8d67('0x23')]=function(_0x4fb8b1){var _0x5463c2=this;return new Promise(function(_0x5e8589,_0xb8ea95){return db[_0x8d67('0x24')][_0x8d67('0x25')]({'raw':_0x4fb8b1[_0x8d67('0x1b')]?_0x4fb8b1['options'][_0x8d67('0x1c')]===undefined?!![]:![]:!![],'where':_0x4fb8b1[_0x8d67('0x1b')]?_0x4fb8b1[_0x8d67('0x1b')]['where']||null:null,'attributes':_0x4fb8b1['options']?_0x4fb8b1[_0x8d67('0x1b')][_0x8d67('0x20')]||null:null,'include':_0x4fb8b1['options']?_0x4fb8b1[_0x8d67('0x1b')][_0x8d67('0x1e')]?_[_0x8d67('0x1f')](_0x4fb8b1[_0x8d67('0x1b')][_0x8d67('0x1e')],function(_0x595444){return{'model':db[_0x595444[_0x8d67('0x21')]],'as':_0x595444['as'],'attributes':_0x595444[_0x8d67('0x20')],'include':_0x595444[_0x8d67('0x1e')]?_[_0x8d67('0x1f')](_0x595444['include'],function(_0xd4b9d9){return{'model':db[_0xd4b9d9[_0x8d67('0x21')]],'as':_0xd4b9d9['as'],'attributes':_0xd4b9d9[_0x8d67('0x20')],'include':_0xd4b9d9[_0x8d67('0x1e')]?_[_0x8d67('0x1f')](_0xd4b9d9[_0x8d67('0x1e')],function(_0xd2538){return{'model':db[_0xd2538['model']],'as':_0xd2538['as'],'attributes':_0xd2538[_0x8d67('0x20')]};}):[]};}):[]};}):[]:[]})[_0x8d67('0xf')](function(_0x394786){logger['info'](_0x8d67('0x23'),_0x4fb8b1);logger[_0x8d67('0x22')](_0x8d67('0x23'),_0x4fb8b1,JSON[_0x8d67('0x13')](_0x394786));_0x5e8589(_0x394786);})[_0x8d67('0x18')](function(_0x5acc34){logger[_0x8d67('0x14')](_0x8d67('0x23'),_0x5acc34['message'],_0x4fb8b1);_0xb8ea95(_0x5463c2[_0x8d67('0x14')](0x1f4,_0x5acc34[_0x8d67('0x17')]));});});};exports[_0x8d67('0x26')]=function(_0x34752a){var _0x1582a6=this;return new Promise(function(_0xc186af,_0x177303){var _0x3e8508;return db[_0x8d67('0x24')][_0x8d67('0x25')]({'where':_0x34752a[_0x8d67('0x1b')][_0x8d67('0x27')]||{},'attributes':['id','name',_0x8d67('0x28'),_0x8d67('0x29'),_0x8d67('0x2a')]})[_0x8d67('0xf')](function(_0x1b0f6e){if(_0x1b0f6e){_0x3e8508=_0x1b0f6e;return db['UserVoiceQueueRt'][_0x8d67('0x2b')]({'paused':0x1},{'where':{'UserId':_0x3e8508['id']},'individualHooks':!![]});}})['then'](function(){if(_0x3e8508){return db[_0x8d67('0x2c')][_0x8d67('0x1a')]({'where':{'membername':_0x3e8508[_0x8d67('0x2d')],'type':_0x8d67('0x2e'),'exitAt':null}});}})[_0x8d67('0xf')](function(_0x30556){if(_0x3e8508){if(_0x30556&&_0x30556[_0x8d67('0x2f')]){var _0x2ef78f=moment()[_0x8d67('0x30')](_0x8d67('0x31'));for(var _0x13fe26=0x0,_0x59b2f6=_0x30556[_0x8d67('0x2f')];_0x13fe26<_0x59b2f6;_0x13fe26++){_0x30556[_0x13fe26]['updateAttributes']({'exitAt':_0x2ef78f});}}}})['then'](function(){if(_0x3e8508){var _0x41494f=[];var _0x30b774=utils['getChannels']();_0x30b774[_0x8d67('0x32')](function(_0x6d1894){_0x41494f['push']({'channel':_0x6d1894,'membername':_0x3e8508[_0x8d67('0x2d')],'interface':_[_0x8d67('0x33')](_0x3e8508['interface'])?util[_0x8d67('0x30')](_0x8d67('0x34'),_0x3e8508[_0x8d67('0x2d')]):_0x3e8508[_0x8d67('0x2a')],'type':_0x8d67('0x2e'),'enterAt':moment()['format'](_0x8d67('0x31')),'data1':_0x34752a[_0x8d67('0x35')][_0x8d67('0x36')]||'DEFAULT\x20PAUSE','role':_0x3e8508[_0x8d67('0x28')],'internal':_0x3e8508[_0x8d67('0x29')],'uniqueid':_0x34752a['body'][_0x8d67('0x37')]||null});});return db[_0x8d67('0x2c')][_0x8d67('0x38')](_0x41494f,{'individualHooks':!![]});}})[_0x8d67('0xf')](function(){if(_0x3e8508){return _0x3e8508['update']({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'whatsappPause':!![],'pauseType':_0x34752a[_0x8d67('0x35')][_0x8d67('0x36')]||_0x8d67('0x39'),'lastPauseAt':moment()['format'](_0x8d67('0x31'))});}})['then'](function(_0x5c84bf){_0xc186af(_0x5c84bf);})[_0x8d67('0x18')](function(_0x31a55d){_0x177303(_0x1582a6[_0x8d67('0x14')](0x1f4,_0x31a55d[_0x8d67('0x17')]));});});};exports[_0x8d67('0x3a')]=function(_0x48d892){var _0x5db64f=this;return new Promise(function(_0x544cad,_0x1e2740){var _0x59412a;return db[_0x8d67('0x24')][_0x8d67('0x3b')]({'where':_0x48d892[_0x8d67('0x1b')][_0x8d67('0x27')]||{},'attributes':['id',_0x8d67('0x2d')]})['then'](function(_0x5ac1ea){if(_0x5ac1ea){_0x59412a=_0x5ac1ea;if(_0x48d892[_0x8d67('0x35')][_0x8d67('0x3c')]&&!utils[_0x8d67('0x3d')](_0x48d892[_0x8d67('0x35')][_0x8d67('0x3c')])){throw new Error(_0x8d67('0x3e'));}switch(_0x48d892[_0x8d67('0x35')]['channel']){case _0x8d67('0x3f'):return db['UserVoiceQueueRt'][_0x8d67('0x2b')]({'paused':0x0},{'where':{'UserId':_0x59412a['id']}})[_0x8d67('0xf')](function(){return db['MemberReport'][_0x8d67('0x25')]({'where':{'channel':_0x48d892[_0x8d67('0x35')][_0x8d67('0x3c')],'membername':_0x59412a[_0x8d67('0x2d')],'type':_0x8d67('0x2e'),'exitAt':null}});})[_0x8d67('0xf')](function(_0x507ae6){if(_0x507ae6){return _0x507ae6[_0x8d67('0x2b')]({'exitAt':moment()[_0x8d67('0x30')](_0x8d67('0x31')),'data2':'system'},{'individualHooks':!![]});}return null;})[_0x8d67('0xf')](function(){return _0x59412a[_0x8d67('0x2b')]({'voicePause':![]});});case'mail':case _0x8d67('0x40'):case _0x8d67('0x41'):case'sms':case _0x8d67('0x42'):case _0x8d67('0x43'):return db[_0x8d67('0x2c')][_0x8d67('0x25')]({'where':{'channel':_0x48d892[_0x8d67('0x35')][_0x8d67('0x3c')],'membername':_0x59412a[_0x8d67('0x2d')],'type':_0x8d67('0x2e'),'exitAt':null}})[_0x8d67('0xf')](function(_0x3d06b0){return _0x3d06b0[_0x8d67('0x2b')]({'exitAt':moment()[_0x8d67('0x30')](_0x8d67('0x31')),'data2':_0x8d67('0x44')},{'individualHooks':!![]});})[_0x8d67('0xf')](function(){var _0x599166={};_['set'](_0x599166,util[_0x8d67('0x30')](_0x8d67('0x45'),_0x48d892['body'][_0x8d67('0x3c')],_0x8d67('0x46')),![]);return _0x59412a[_0x8d67('0x2b')](_0x599166);});default:return db[_0x8d67('0x47')]['update']({'paused':0x0},{'where':{'UserId':_0x59412a['id']}})[_0x8d67('0xf')](function(){return db[_0x8d67('0x2c')][_0x8d67('0x1a')]({'where':{'membername':_0x59412a[_0x8d67('0x2d')],'type':_0x8d67('0x2e'),'exitAt':null}});})[_0x8d67('0xf')](function(_0x493a57){var _0x4f8a1d=[];_0x493a57[_0x8d67('0x32')](function(_0x426cba){_0x4f8a1d['push'](_0x426cba['update']({'exitAt':moment()[_0x8d67('0x30')](_0x8d67('0x31')),'data2':'system'}));});return BPromise[_0x8d67('0x48')](_0x4f8a1d);})['then'](function(){return _0x59412a[_0x8d67('0x2b')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![]});});}}})['then'](function(_0x46c955){_0x544cad(_0x46c955);})[_0x8d67('0x18')](function(_0x52e478){_0x1e2740(_0x5db64f['error'](0x1f4,_0x52e478[_0x8d67('0x17')]));});});};exports[_0x8d67('0x49')]=function(_0x4f4858){var _0x2f298a=this;return new Promise(function(_0x535008,_0x1118c5){var _0x16c9da;return db[_0x8d67('0x24')][_0x8d67('0x3b')]({'where':_0x4f4858[_0x8d67('0x1b')]['where']||{},'attributes':['id',_0x8d67('0x2d')]})[_0x8d67('0xf')](function(_0x5164d0){if(_0x5164d0){_0x16c9da=_0x5164d0;return db[_0x8d67('0x47')][_0x8d67('0x4a')]({'where':{'membername':_0x16c9da[_0x8d67('0x2d')]},'individualHooks':!![]});}})[_0x8d67('0xf')](function(){if(_0x16c9da){return db[_0x8d67('0x2c')][_0x8d67('0x1a')]({'where':{'membername':_0x16c9da['name'],'exitAt':null}});}})['then'](function(_0x2d61a9){if(_0x16c9da){if(_0x2d61a9&&_0x2d61a9[_0x8d67('0x2f')]){var _0x5a2bdb=[];_0x2d61a9[_0x8d67('0x32')](function(_0x47e5fc){_0x5a2bdb[_0x8d67('0x4b')](_0x47e5fc[_0x8d67('0x2b')]({'exitAt':moment()['format'](_0x8d67('0x31'))}));});return BPromise['all'](_0x5a2bdb);}}})[_0x8d67('0xf')](function(){if(_0x16c9da){return _0x16c9da[_0x8d67('0x2b')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})[_0x8d67('0xf')](function(_0x48985a){_0x535008(_0x48985a);})[_0x8d67('0x18')](function(_0x465584){_0x1118c5(_0x2f298a[_0x8d67('0x14')](0x1f4,_0x465584[_0x8d67('0x17')]));});});};exports[_0x8d67('0x4c')]=function(_0x47892f){var _0x2ee55b=this;return new Promise(function(_0x140b6c,_0x52ff28){var _0x3ec2c8;var _0x1bc053;var _0x2d5bba;var _0x423120;return db[_0x8d67('0x24')][_0x8d67('0x3b')]({'where':_0x47892f[_0x8d67('0x1b')][_0x8d67('0x27')]||{},'attributes':['id',_0x8d67('0x2d'),_0x8d67('0x28'),_0x8d67('0x4d'),_0x8d67('0x4e'),'internal',_0x8d67('0x4f'),'interface']})[_0x8d67('0xf')](function(_0x53c9e8){if(_0x53c9e8){_0x3ec2c8=_0x53c9e8;_0x423120=_0x47892f[_0x8d67('0x35')]['interface']?_0x47892f['body'][_0x8d67('0x2a')]:util['format']('SIP/%s',_0x3ec2c8[_0x8d67('0x2d')]);return db[_0x8d67('0x24')]['count']({'where':{'role':'agent','online':!![],'id':{'$ne':_0x3ec2c8['id']}}});}})[_0x8d67('0xf')](function(_0x44fc75){if(_0x44fc75){_0x2d5bba=_0x44fc75;return require('../../config/license/util')['getLicense']();}})[_0x8d67('0xf')](function(_0x3656b5){if(_0x3656b5&&_0x3656b5[_0x8d67('0x50')]&&_0x2d5bba>=_0x3656b5[_0x8d67('0x50')]){throw new Error('Maximum\x20login\x20has\x20been\x20reached');}})[_0x8d67('0xf')](function(){if(_0x3ec2c8){return db[_0x8d67('0x47')]['destroy']({'where':{'membername':_0x3ec2c8['name']},'individualHooks':!![]});}})['then'](function(){if(_0x3ec2c8){return _0x3ec2c8[_0x8d67('0x51')]({'raw':!![]});}})['then'](function(_0x3315f9){if(_0x3ec2c8){if(_0x3315f9){var _0x3da177=[];_0x1bc053=_0x3315f9;if(_0x1bc053[_0x8d67('0x2f')]){for(var _0x4e2b52=0x0;_0x4e2b52<_0x1bc053[_0x8d67('0x2f')];_0x4e2b52++){_0x3da177[_0x8d67('0x4b')](db[_0x8d67('0x47')][_0x8d67('0x52')]({'membername':_0x3ec2c8[_0x8d67('0x2d')],'UserId':_0x3ec2c8['id'],'queue_name':_0x1bc053[_0x4e2b52]['name'],'VoiceQueueId':_0x1bc053[_0x4e2b52]['id'],'interface':_0x423120,'paused':_0x3ec2c8['loginInPause']||![],'penalty':_0x1bc053[_0x4e2b52]['UserVoiceQueue.penalty']||0x0}));}return BPromise[_0x8d67('0x48')](_0x3da177);}}}})[_0x8d67('0xf')](function(){if(_0x3ec2c8){return db[_0x8d67('0x2c')][_0x8d67('0x1a')]({'where':{'membername':_0x3ec2c8[_0x8d67('0x2d')],'exitAt':null}});}})[_0x8d67('0xf')](function(_0x268068){if(_0x3ec2c8){if(_0x268068&&_0x268068[_0x8d67('0x2f')]){var _0x176c76=[];_0x268068['forEach'](function(_0x4085e6){_0x176c76[_0x8d67('0x4b')](_0x4085e6[_0x8d67('0x2b')]({'exitAt':moment()[_0x8d67('0x30')](_0x8d67('0x31'))}));});return BPromise[_0x8d67('0x48')](_0x176c76);}}})[_0x8d67('0xf')](function(_0x29399d){if(_0x3ec2c8){var _0x293941=[];var _0x149b78=[];var _0x253849=utils['getChannels']();var _0x28eb6b={'membername':_0x3ec2c8['name'],'interface':_0x423120,'enterAt':moment()[_0x8d67('0x30')](_0x8d67('0x31')),'role':_0x3ec2c8[_0x8d67('0x28')],'internal':_0x3ec2c8[_0x8d67('0x29')]};_0x253849[_0x8d67('0x32')](function(_0x55edcd){_0x293941[_0x8d67('0x4b')](_[_0x8d67('0x53')]({'channel':_0x55edcd,'type':_0x8d67('0x54'),'data1':_0x8d67('0x55'),'data2':_0x423120},_0x28eb6b));if(_0x3ec2c8[_0x8d67('0x4f')]){_0x149b78[_0x8d67('0x4b')](_[_0x8d67('0x53')]({'channel':_0x55edcd,'type':_0x8d67('0x2e'),'data1':_0x8d67('0x56')},_0x28eb6b));}});return db[_0x8d67('0x2c')][_0x8d67('0x38')](_0x293941[_0x8d67('0x57')](_0x149b78),{'individualHooks':!![]});}})[_0x8d67('0xf')](function(){if(_0x3ec2c8){return _0x3ec2c8[_0x8d67('0x2b')]({'online':!![],'lastLoginAt':moment()[_0x8d67('0x30')]('YYYY-MM-DD\x20HH:mm:ss'),'voicePause':_0x3ec2c8[_0x8d67('0x4f')]||![],'mailPause':_0x3ec2c8[_0x8d67('0x4f')]||![],'chatPause':_0x3ec2c8[_0x8d67('0x4f')]||![],'faxPause':_0x3ec2c8[_0x8d67('0x4f')]||![],'smsPause':_0x3ec2c8[_0x8d67('0x4f')]||![],'openchannelPause':_0x3ec2c8['loginInPause']||![],'pauseType':_0x3ec2c8[_0x8d67('0x4f')]?'LOGININPAUSE':null,'lastPauseAt':moment()[_0x8d67('0x30')](_0x8d67('0x31')),'interface':_0x423120});}})[_0x8d67('0xf')](function(_0x419d51){_0x140b6c(_0x419d51);})[_0x8d67('0x18')](function(_0x2f48a1){_0x52ff28(_0x2ee55b[_0x8d67('0x14')](0x1f4,_0x2f48a1[_0x8d67('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index 3f050ab..9ec5781 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 _0x731c=['removeListener','length','user:','./user.events','save','remove','emit'];(function(_0x266618,_0x18f637){var _0x54dbf5=function(_0x1f7985){while(--_0x1f7985){_0x266618['push'](_0x266618['shift']());}};_0x54dbf5(++_0x18f637);}(_0x731c,0xa4));var _0xc731=function(_0x34f3a5,_0x4ff5c9){_0x34f3a5=_0x34f3a5-0x0;var _0x29af8e=_0x731c[_0x34f3a5];return _0x29af8e;};'use strict';var UserEvents=require(_0xc731('0x0'));var events=[_0xc731('0x1'),_0xc731('0x2'),'update'];function createListener(_0x2a3025,_0x3393a3){return function(_0x4bd918){_0x3393a3[_0xc731('0x3')](_0x2a3025,_0x4bd918);};}function removeListener(_0x20d365,_0x455dd1){return function(){UserEvents[_0xc731('0x4')](_0x20d365,_0x455dd1);};}exports['register']=function(_0x87536a){for(var _0xad0c45=0x0,_0x3884c4=events[_0xc731('0x5')];_0xad0c45<_0x3884c4;_0xad0c45++){var _0xa0a098=events[_0xad0c45];var _0xe4771=createListener(_0xc731('0x6')+_0xa0a098,_0x87536a);UserEvents['on'](_0xa0a098,_0xe4771);}}; \ No newline at end of file +var _0x0b3c=['update','removeListener','length','./user.events','remove'];(function(_0x2bcdb8,_0xd776f7){var _0x13c6af=function(_0x17c426){while(--_0x17c426){_0x2bcdb8['push'](_0x2bcdb8['shift']());}};_0x13c6af(++_0xd776f7);}(_0x0b3c,0x1c0));var _0xc0b3=function(_0x2778c6,_0x567ee9){_0x2778c6=_0x2778c6-0x0;var _0x30d7eb=_0x0b3c[_0x2778c6];return _0x30d7eb;};'use strict';var UserEvents=require(_0xc0b3('0x0'));var events=['save',_0xc0b3('0x1'),_0xc0b3('0x2')];function createListener(_0x34664b,_0x499406){return function(_0xea49c4){_0x499406['emit'](_0x34664b,_0xea49c4);};}function removeListener(_0x12e425,_0x29c568){return function(){UserEvents[_0xc0b3('0x3')](_0x12e425,_0x29c568);};}exports['register']=function(_0x50c578){for(var _0x3ba802=0x0,_0xd85cbf=events[_0xc0b3('0x4')];_0x3ba802<_0xd85cbf;_0x3ba802++){var _0x20e165=events[_0x3ba802];var _0x379376=createListener('user:'+_0x20e165,_0x50c578);UserEvents['on'](_0x20e165,_0x379376);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index 80c17ae..c35cbf5 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 _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x4048dd,_0x534f21){var _0x41ff9d=function(_0x45dc90){while(--_0x45dc90){_0x4048dd['push'](_0x4048dd['shift']());}};_0x41ff9d(++_0x534f21);}(_0xe706,0xa3));var _0x6e70=function(_0x355adc,_0xac51ab){_0x355adc=_0x355adc-0x0;var _0x4df04f=_0xe706[_0x355adc];return _0x4df04f;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file +var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x4add40,_0xab109e){var _0x5a0f30=function(_0x5d2748){while(--_0x5d2748){_0x4add40['push'](_0x4add40['shift']());}};_0x5a0f30(++_0xab109e);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x35fabd,_0x825452){_0x35fabd=_0x35fabd-0x0;var _0x61a8ee=_0xcb91[_0x35fabd];return _0x61a8ee;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.attributes.js b/server/api/userChatQueue/userChatQueue.attributes.js index 5bc2a65..ce209e7 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 _0x4fe0=['INTEGER','exports'];(function(_0x38bc15,_0x46e4d9){var _0x54682a=function(_0x5419eb){while(--_0x5419eb){_0x38bc15['push'](_0x38bc15['shift']());}};_0x54682a(++_0x46e4d9);}(_0x4fe0,0x195));var _0x04fe=function(_0x1ef1fe,_0x30d723){_0x1ef1fe=_0x1ef1fe-0x0;var _0x53f529=_0x4fe0[_0x1ef1fe];return _0x53f529;};'use strict';var Sequelize=require('sequelize');module[_0x04fe('0x0')]={'penalty':{'type':Sequelize[_0x04fe('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x720e=['sequelize','exports','INTEGER'];(function(_0x329a33,_0x585897){var _0x2bef80=function(_0x213b94){while(--_0x213b94){_0x329a33['push'](_0x329a33['shift']());}};_0x2bef80(++_0x585897);}(_0x720e,0x1b3));var _0xe720=function(_0x1e6b59,_0x5eca5d){_0x1e6b59=_0x1e6b59-0x0;var _0x40d7c5=_0x720e[_0x1e6b59];return _0x40d7c5;};'use strict';var Sequelize=require(_0xe720('0x0'));module[_0xe720('0x1')]={'penalty':{'type':Sequelize[_0xe720('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.model.js b/server/api/userChatQueue/userChatQueue.model.js index 32c18b5..4456b4c 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 _0x75e1=['lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','UserChatQueue','user_has_chat_queues'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x75e1,0x12b));var _0x175e=function(_0x4cc1c1,_0x3ad908){_0x4cc1c1=_0x4cc1c1-0x0;var _0x483778=_0x75e1[_0x4cc1c1];return _0x483778;};'use strict';var _=require(_0x175e('0x0'));var util=require(_0x175e('0x1'));var logger=require(_0x175e('0x2'))(_0x175e('0x3'));var moment=require('moment');var BPromise=require(_0x175e('0x4'));var rp=require(_0x175e('0x5'));var fs=require('fs');var path=require(_0x175e('0x6'));var rimraf=require(_0x175e('0x7'));var config=require(_0x175e('0x8'));var attributes=require('./userChatQueue.attributes');module[_0x175e('0x9')]=function(_0x12193c,_0xa7625){return _0x12193c[_0x175e('0xa')](_0x175e('0xb'),attributes,{'tableName':_0x175e('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcb00=['define','UserChatQueue','user_has_chat_queues','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x38fa44,_0x500680){var _0x5514b6=function(_0x5ea397){while(--_0x5ea397){_0x38fa44['push'](_0x38fa44['shift']());}};_0x5514b6(++_0x500680);}(_0xcb00,0xb3));var _0x0cb0=function(_0x21549c,_0x6d64d1){_0x21549c=_0x21549c-0x0;var _0x426cbd=_0xcb00[_0x21549c];return _0x426cbd;};'use strict';var _=require('lodash');var util=require(_0x0cb0('0x0'));var logger=require(_0x0cb0('0x1'))(_0x0cb0('0x2'));var moment=require(_0x0cb0('0x3'));var BPromise=require(_0x0cb0('0x4'));var rp=require(_0x0cb0('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0cb0('0x6'));var config=require(_0x0cb0('0x7'));var attributes=require('./userChatQueue.attributes');module['exports']=function(_0x4b33fe,_0x31546e){return _0x4b33fe[_0x0cb0('0x8')](_0x0cb0('0x9'),attributes,{'tableName':_0x0cb0('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.rpc.js b/server/api/userChatQueue/userChatQueue.rpc.js index 1e7aa2e..a249172 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 _0xfe27=['catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','UserChatQueue,\x20%s,\x20%s','message'];(function(_0x26631e,_0x205f46){var _0x2bbdbc=function(_0x6f4b26){while(--_0x6f4b26){_0x26631e['push'](_0x26631e['shift']());}};_0x2bbdbc(++_0x205f46);}(_0xfe27,0xfe));var _0x7fe2=function(_0x28d434,_0x2d2610){_0x28d434=_0x28d434-0x0;var _0x1109c6=_0xfe27[_0x28d434];return _0x1109c6;};'use strict';var _=require(_0x7fe2('0x0'));var util=require(_0x7fe2('0x1'));var moment=require(_0x7fe2('0x2'));var BPromise=require(_0x7fe2('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7fe2('0x4'))['db'];var utils=require(_0x7fe2('0x5'));var logger=require(_0x7fe2('0x6'))(_0x7fe2('0x7'));var config=require(_0x7fe2('0x8'));var jayson=require(_0x7fe2('0x9'));var client=jayson[_0x7fe2('0xa')][_0x7fe2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x46a5e4,_0x1f8bb7,_0x268fce){return new BPromise(function(_0x2ce415,_0x3a5ecf){return client[_0x7fe2('0xc')](_0x46a5e4,_0x268fce)[_0x7fe2('0xd')](function(_0x304119){logger[_0x7fe2('0xe')]('UserChatQueue,\x20%s,\x20%s',_0x1f8bb7,_0x7fe2('0xf'));logger[_0x7fe2('0x10')](_0x7fe2('0x11'),_0x1f8bb7,_0x7fe2('0xf'),JSON[_0x7fe2('0x12')](_0x304119));if(_0x304119['error']){if(_0x304119[_0x7fe2('0x13')]['code']===0x1f4){logger[_0x7fe2('0x13')](_0x7fe2('0x14'),_0x1f8bb7,_0x304119[_0x7fe2('0x13')][_0x7fe2('0x15')]);return _0x3a5ecf(_0x304119[_0x7fe2('0x13')][_0x7fe2('0x15')]);}logger[_0x7fe2('0x13')](_0x7fe2('0x14'),_0x1f8bb7,_0x304119[_0x7fe2('0x13')]['message']);return _0x2ce415(_0x304119['error'][_0x7fe2('0x15')]);}else{logger[_0x7fe2('0xe')]('UserChatQueue,\x20%s,\x20%s',_0x1f8bb7,_0x7fe2('0xf'));_0x2ce415(_0x304119['result'][_0x7fe2('0x15')]);}})[_0x7fe2('0x16')](function(_0x5aedc1){logger[_0x7fe2('0x13')]('UserChatQueue,\x20%s,\x20%s',_0x1f8bb7,_0x5aedc1);_0x3a5ecf(_0x5aedc1);});});} \ No newline at end of file +var _0xf505=['util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','UserChatQueue,\x20%s,\x20%s','request\x20sent','error','code','message','catch'];(function(_0x26996c,_0x4169e2){var _0x44d95a=function(_0x215531){while(--_0x215531){_0x26996c['push'](_0x26996c['shift']());}};_0x44d95a(++_0x4169e2);}(_0xf505,0x1f4));var _0x5f50=function(_0x2c96f6,_0x877207){_0x2c96f6=_0x2c96f6-0x0;var _0x6d4808=_0xf505[_0x2c96f6];return _0x6d4808;};'use strict';var _=require('lodash');var util=require(_0x5f50('0x0'));var moment=require(_0x5f50('0x1'));var BPromise=require(_0x5f50('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5f50('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5f50('0x4'));var logger=require(_0x5f50('0x5'))(_0x5f50('0x6'));var config=require(_0x5f50('0x7'));var jayson=require(_0x5f50('0x8'));var client=jayson[_0x5f50('0x9')][_0x5f50('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x48e4a4,_0x1b8bd0,_0xc9ee5e){return new BPromise(function(_0x1caa96,_0x13a7ec){return client[_0x5f50('0xb')](_0x48e4a4,_0xc9ee5e)[_0x5f50('0xc')](function(_0x537c3c){logger[_0x5f50('0xd')](_0x5f50('0xe'),_0x1b8bd0,_0x5f50('0xf'));logger['debug']('UserChatQueue,\x20%s,\x20%s,\x20%s',_0x1b8bd0,_0x5f50('0xf'),JSON['stringify'](_0x537c3c));if(_0x537c3c[_0x5f50('0x10')]){if(_0x537c3c['error'][_0x5f50('0x11')]===0x1f4){logger[_0x5f50('0x10')](_0x5f50('0xe'),_0x1b8bd0,_0x537c3c[_0x5f50('0x10')][_0x5f50('0x12')]);return _0x13a7ec(_0x537c3c[_0x5f50('0x10')][_0x5f50('0x12')]);}logger[_0x5f50('0x10')]('UserChatQueue,\x20%s,\x20%s',_0x1b8bd0,_0x537c3c[_0x5f50('0x10')][_0x5f50('0x12')]);return _0x1caa96(_0x537c3c[_0x5f50('0x10')][_0x5f50('0x12')]);}else{logger[_0x5f50('0xd')](_0x5f50('0xe'),_0x1b8bd0,_0x5f50('0xf'));_0x1caa96(_0x537c3c['result']['message']);}})[_0x5f50('0x13')](function(_0x52bcfd){logger[_0x5f50('0x10')]('UserChatQueue,\x20%s,\x20%s',_0x1b8bd0,_0x52bcfd);_0x13a7ec(_0x52bcfd);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index b19b6dc..5e2b802 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(_0x25c43c,_0x3a3aa3){var _0x28e108=function(_0x425bfe){while(--_0x425bfe){_0x25c43c['push'](_0x25c43c['shift']());}};_0x28e108(++_0x3a3aa3);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0xa9e0[_0x5c351c];return _0x26f3b3;};'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 _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0xb984a7,_0x564ef9){var _0x247044=function(_0x4142c7){while(--_0x4142c7){_0xb984a7['push'](_0xb984a7['shift']());}};_0x247044(++_0x564ef9);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0xa9e0[_0x47b58b];return _0x46bebe;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.attributes.js b/server/api/userFaxQueue/userFaxQueue.attributes.js index 5666fdb..745a9c4 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 _0x8ab8=['INTEGER','STRING','sequelize','exports'];(function(_0xa2d364,_0x1f90a6){var _0x3851c4=function(_0xf58f39){while(--_0xf58f39){_0xa2d364['push'](_0xa2d364['shift']());}};_0x3851c4(++_0x1f90a6);}(_0x8ab8,0x9a));var _0x88ab=function(_0x2f539d,_0x4b0bb1){_0x2f539d=_0x2f539d-0x0;var _0x2a7b83=_0x8ab8[_0x2f539d];return _0x2a7b83;};'use strict';var Sequelize=require(_0x88ab('0x0'));module[_0x88ab('0x1')]={'penalty':{'type':Sequelize[_0x88ab('0x2')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x88ab('0x2')],'defaultValue':0x0},'queue':{'type':Sequelize[_0x88ab('0x3')]}}; \ No newline at end of file +var _0x54ec=['STRING','exports','INTEGER'];(function(_0x480bc8,_0x1fac40){var _0x28c245=function(_0x22a049){while(--_0x22a049){_0x480bc8['push'](_0x480bc8['shift']());}};_0x28c245(++_0x1fac40);}(_0x54ec,0x112));var _0xc54e=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x54ec[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require('sequelize');module[_0xc54e('0x0')]={'penalty':{'type':Sequelize[_0xc54e('0x1')],'defaultValue':0x0},'assigned':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'queue':{'type':Sequelize[_0xc54e('0x2')]}}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.model.js b/server/api/userFaxQueue/userFaxQueue.model.js index 3a23dc9..712740b 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 _0x2bf1=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./userFaxQueue.attributes','define','UserFaxQueue','user_has_fax_queues','lodash'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x2bf1,0xb3));var _0x12bf=function(_0x134c2e,_0x3573c4){_0x134c2e=_0x134c2e-0x0;var _0x2825db=_0x2bf1[_0x134c2e];return _0x2825db;};'use strict';var _=require(_0x12bf('0x0'));var util=require('util');var logger=require(_0x12bf('0x1'))(_0x12bf('0x2'));var moment=require(_0x12bf('0x3'));var BPromise=require(_0x12bf('0x4'));var rp=require(_0x12bf('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x12bf('0x6'));var config=require(_0x12bf('0x7'));var attributes=require(_0x12bf('0x8'));module['exports']=function(_0x19a8bd,_0x361849){return _0x19a8bd[_0x12bf('0x9')](_0x12bf('0xa'),attributes,{'tableName':_0x12bf('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2b18=['user_has_fax_queues','lodash','util','../../config/logger','api','moment','request-promise','path','../../config/environment','./userFaxQueue.attributes','exports','UserFaxQueue'];(function(_0x43d11d,_0xccff91){var _0x38cd08=function(_0x131ae2){while(--_0x131ae2){_0x43d11d['push'](_0x43d11d['shift']());}};_0x38cd08(++_0xccff91);}(_0x2b18,0xc1));var _0x82b1=function(_0x48b470,_0x4874a1){_0x48b470=_0x48b470-0x0;var _0x57be46=_0x2b18[_0x48b470];return _0x57be46;};'use strict';var _=require(_0x82b1('0x0'));var util=require(_0x82b1('0x1'));var logger=require(_0x82b1('0x2'))(_0x82b1('0x3'));var moment=require(_0x82b1('0x4'));var BPromise=require('bluebird');var rp=require(_0x82b1('0x5'));var fs=require('fs');var path=require(_0x82b1('0x6'));var rimraf=require('rimraf');var config=require(_0x82b1('0x7'));var attributes=require(_0x82b1('0x8'));module[_0x82b1('0x9')]=function(_0xaecb9e,_0x4ddefc){return _0xaecb9e['define'](_0x82b1('0xa'),attributes,{'tableName':_0x82b1('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.rpc.js b/server/api/userFaxQueue/userFaxQueue.rpc.js index e975e34..c8f504f 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 _0x53ed=['request','then','info','UserFaxQueue,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x54a6ce,_0x215937){var _0x3ccc0e=function(_0x151f69){while(--_0x151f69){_0x54a6ce['push'](_0x54a6ce['shift']());}};_0x3ccc0e(++_0x215937);}(_0x53ed,0x199));var _0xd53e=function(_0x1cd5ee,_0x5741b3){_0x1cd5ee=_0x1cd5ee-0x0;var _0x4fce8f=_0x53ed[_0x1cd5ee];return _0x4fce8f;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xd53e('0x0'));var BPromise=require(_0xd53e('0x1'));var rs=require(_0xd53e('0x2'));var fs=require('fs');var Redis=require(_0xd53e('0x3'));var db=require(_0xd53e('0x4'))['db'];var utils=require(_0xd53e('0x5'));var logger=require('../../config/logger')(_0xd53e('0x6'));var config=require(_0xd53e('0x7'));var jayson=require(_0xd53e('0x8'));var client=jayson[_0xd53e('0x9')][_0xd53e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1e546b,_0x248bce,_0x556548){return new BPromise(function(_0x487993,_0x1b167a){return client[_0xd53e('0xb')](_0x1e546b,_0x556548)[_0xd53e('0xc')](function(_0x34d53c){logger[_0xd53e('0xd')](_0xd53e('0xe'),_0x248bce,_0xd53e('0xf'));logger['debug']('UserFaxQueue,\x20%s,\x20%s,\x20%s',_0x248bce,_0xd53e('0xf'),JSON[_0xd53e('0x10')](_0x34d53c));if(_0x34d53c[_0xd53e('0x11')]){if(_0x34d53c[_0xd53e('0x11')][_0xd53e('0x12')]===0x1f4){logger[_0xd53e('0x11')](_0xd53e('0xe'),_0x248bce,_0x34d53c['error'][_0xd53e('0x13')]);return _0x1b167a(_0x34d53c[_0xd53e('0x11')][_0xd53e('0x13')]);}logger[_0xd53e('0x11')](_0xd53e('0xe'),_0x248bce,_0x34d53c[_0xd53e('0x11')][_0xd53e('0x13')]);return _0x487993(_0x34d53c[_0xd53e('0x11')][_0xd53e('0x13')]);}else{logger[_0xd53e('0xd')](_0xd53e('0xe'),_0x248bce,_0xd53e('0xf'));_0x487993(_0x34d53c['result']['message']);}})[_0xd53e('0x14')](function(_0x47c404){logger[_0xd53e('0x11')]('UserFaxQueue,\x20%s,\x20%s',_0x248bce,_0x47c404);_0x1b167a(_0x47c404);});});} \ No newline at end of file +var _0x2966=['../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info','UserFaxQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','lodash','util','moment','randomstring','ioredis'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x2966,0x1db));var _0x6296=function(_0x40952f,_0x4ff827){_0x40952f=_0x40952f-0x0;var _0x770f4f=_0x2966[_0x40952f];return _0x770f4f;};'use strict';var _=require(_0x6296('0x0'));var util=require(_0x6296('0x1'));var moment=require(_0x6296('0x2'));var BPromise=require('bluebird');var rs=require(_0x6296('0x3'));var fs=require('fs');var Redis=require(_0x6296('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x6296('0x5'));var logger=require(_0x6296('0x6'))('rpc');var config=require(_0x6296('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x6296('0x8')][_0x6296('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2109dd,_0x7910f6,_0x27cc99){return new BPromise(function(_0x4246fc,_0x132567){return client[_0x6296('0xa')](_0x2109dd,_0x27cc99)[_0x6296('0xb')](function(_0xbe15aa){logger[_0x6296('0xc')](_0x6296('0xd'),_0x7910f6,_0x6296('0xe'));logger[_0x6296('0xf')]('UserFaxQueue,\x20%s,\x20%s,\x20%s',_0x7910f6,_0x6296('0xe'),JSON[_0x6296('0x10')](_0xbe15aa));if(_0xbe15aa[_0x6296('0x11')]){if(_0xbe15aa[_0x6296('0x11')]['code']===0x1f4){logger[_0x6296('0x11')](_0x6296('0xd'),_0x7910f6,_0xbe15aa['error'][_0x6296('0x12')]);return _0x132567(_0xbe15aa[_0x6296('0x11')][_0x6296('0x12')]);}logger[_0x6296('0x11')](_0x6296('0xd'),_0x7910f6,_0xbe15aa[_0x6296('0x11')]['message']);return _0x4246fc(_0xbe15aa[_0x6296('0x11')][_0x6296('0x12')]);}else{logger[_0x6296('0xc')]('UserFaxQueue,\x20%s,\x20%s',_0x7910f6,_0x6296('0xe'));_0x4246fc(_0xbe15aa[_0x6296('0x13')]['message']);}})['catch'](function(_0x31c0cc){logger[_0x6296('0x11')](_0x6296('0xd'),_0x7910f6,_0x31c0cc);_0x132567(_0x31c0cc);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index 38359a3..85e32c5 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 _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x37b04d,_0x761b4f){var _0x1af4a5=function(_0x1f2d60){while(--_0x1f2d60){_0x37b04d['push'](_0x37b04d['shift']());}};_0x1af4a5(++_0x761b4f);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x5f1391,_0x19c132){_0x5f1391=_0x5f1391-0x0;var _0x50ebe3=_0xcb91[_0x5f1391];return _0x50ebe3;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file +var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x56086d,_0x6f2de1){var _0x12b065=function(_0x5d347c){while(--_0x5d347c){_0x56086d['push'](_0x56086d['shift']());}};_0x12b065(++_0x6f2de1);}(_0x70e0,0x17b));var _0x070e=function(_0x1f65ee,_0x1792a0){_0x1f65ee=_0x1f65ee-0x0;var _0x381fd8=_0x70e0[_0x1f65ee];return _0x381fd8;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.attributes.js b/server/api/userMailQueue/userMailQueue.attributes.js index e6afe03..80a4f25 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 _0xb589=['INTEGER','exports'];(function(_0x520d66,_0x22897e){var _0x53ff25=function(_0x524e9b){while(--_0x524e9b){_0x520d66['push'](_0x520d66['shift']());}};_0x53ff25(++_0x22897e);}(_0xb589,0x143));var _0x9b58=function(_0x405778,_0xa4dd3b){_0x405778=_0x405778-0x0;var _0x341735=_0xb589[_0x405778];return _0x341735;};'use strict';var Sequelize=require('sequelize');module[_0x9b58('0x0')]={'penalty':{'type':Sequelize[_0x9b58('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x9ee6=['exports','INTEGER','sequelize'];(function(_0xdda08e,_0x346e9f){var _0x769379=function(_0x57e049){while(--_0x57e049){_0xdda08e['push'](_0xdda08e['shift']());}};_0x769379(++_0x346e9f);}(_0x9ee6,0x125));var _0x69ee=function(_0x56e4e7,_0x1db098){_0x56e4e7=_0x56e4e7-0x0;var _0x383618=_0x9ee6[_0x56e4e7];return _0x383618;};'use strict';var Sequelize=require(_0x69ee('0x0'));module[_0x69ee('0x1')]={'penalty':{'type':Sequelize[_0x69ee('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.model.js b/server/api/userMailQueue/userMailQueue.model.js index 077e817..6ba76a9 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 _0xf731=['./userMailQueue.attributes','exports','define','UserMailQueue','api','moment','bluebird','path','../../config/environment'];(function(_0x422725,_0x3bd4a2){var _0x1de746=function(_0x55faee){while(--_0x55faee){_0x422725['push'](_0x422725['shift']());}};_0x1de746(++_0x3bd4a2);}(_0xf731,0xc1));var _0x1f73=function(_0x1a8a86,_0x5d89ac){_0x1a8a86=_0x1a8a86-0x0;var _0x254a94=_0xf731[_0x1a8a86];return _0x254a94;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x1f73('0x0'));var moment=require(_0x1f73('0x1'));var BPromise=require(_0x1f73('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1f73('0x3'));var rimraf=require('rimraf');var config=require(_0x1f73('0x4'));var attributes=require(_0x1f73('0x5'));module[_0x1f73('0x6')]=function(_0x3d5562,_0x5bf1da){return _0x3d5562[_0x1f73('0x7')](_0x1f73('0x8'),attributes,{'tableName':'user_has_mail_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc99e=['user_has_mail_queues','util','api','moment','request-promise','rimraf','../../config/environment','./userMailQueue.attributes','exports','define','UserMailQueue'];(function(_0x50a0c2,_0x4befab){var _0x5ebadd=function(_0x3a3342){while(--_0x3a3342){_0x50a0c2['push'](_0x50a0c2['shift']());}};_0x5ebadd(++_0x4befab);}(_0xc99e,0x1cf));var _0xec99=function(_0x2ea124,_0x3b6fd3){_0x2ea124=_0x2ea124-0x0;var _0x39a3aa=_0xc99e[_0x2ea124];return _0x39a3aa;};'use strict';var _=require('lodash');var util=require(_0xec99('0x0'));var logger=require('../../config/logger')(_0xec99('0x1'));var moment=require(_0xec99('0x2'));var BPromise=require('bluebird');var rp=require(_0xec99('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xec99('0x4'));var config=require(_0xec99('0x5'));var attributes=require(_0xec99('0x6'));module[_0xec99('0x7')]=function(_0x46cd08,_0x1b6f6b){return _0x46cd08[_0xec99('0x8')](_0xec99('0x9'),attributes,{'tableName':_0xec99('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.rpc.js b/server/api/userMailQueue/userMailQueue.rpc.js index 5abc8ab..9e28869 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 _0x008c=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','UserMailQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','UserMailQueue,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x008c,0x188));var _0xc008=function(_0x187ee1,_0x3fd1e6){_0x187ee1=_0x187ee1-0x0;var _0x388160=_0x008c[_0x187ee1];return _0x388160;};'use strict';var _=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var moment=require(_0xc008('0x2'));var BPromise=require(_0xc008('0x3'));var rs=require(_0xc008('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc008('0x5'))['db'];var utils=require(_0xc008('0x6'));var logger=require(_0xc008('0x7'))(_0xc008('0x8'));var config=require(_0xc008('0x9'));var jayson=require(_0xc008('0xa'));var client=jayson[_0xc008('0xb')][_0xc008('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x9c8cb2,_0x4af530,_0x428fa9){return new BPromise(function(_0x5aa09b,_0x30be38){return client['request'](_0x9c8cb2,_0x428fa9)['then'](function(_0x27830d){logger[_0xc008('0xd')]('UserMailQueue,\x20%s,\x20%s',_0x4af530,'request\x20sent');logger['debug'](_0xc008('0xe'),_0x4af530,_0xc008('0xf'),JSON['stringify'](_0x27830d));if(_0x27830d[_0xc008('0x10')]){if(_0x27830d[_0xc008('0x10')][_0xc008('0x11')]===0x1f4){logger[_0xc008('0x10')](_0xc008('0x12'),_0x4af530,_0x27830d[_0xc008('0x10')][_0xc008('0x13')]);return _0x30be38(_0x27830d['error']['message']);}logger[_0xc008('0x10')]('UserMailQueue,\x20%s,\x20%s',_0x4af530,_0x27830d[_0xc008('0x10')][_0xc008('0x13')]);return _0x5aa09b(_0x27830d[_0xc008('0x10')][_0xc008('0x13')]);}else{logger[_0xc008('0xd')]('UserMailQueue,\x20%s,\x20%s',_0x4af530,'request\x20sent');_0x5aa09b(_0x27830d['result'][_0xc008('0x13')]);}})[_0xc008('0x14')](function(_0x3cafe3){logger[_0xc008('0x10')]('UserMailQueue,\x20%s,\x20%s',_0x4af530,_0x3cafe3);_0x30be38(_0x3cafe3);});});} \ No newline at end of file +var _0x6aa7=['result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','client','request','then','info','UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x542123,_0x5b9f55){var _0x107e2c=function(_0x10dea1){while(--_0x10dea1){_0x542123['push'](_0x542123['shift']());}};_0x107e2c(++_0x5b9f55);}(_0x6aa7,0x178));var _0x76aa=function(_0x5371eb,_0xcda256){_0x5371eb=_0x5371eb-0x0;var _0x5be3cf=_0x6aa7[_0x5371eb];return _0x5be3cf;};'use strict';var _=require(_0x76aa('0x0'));var util=require('util');var moment=require(_0x76aa('0x1'));var BPromise=require(_0x76aa('0x2'));var rs=require(_0x76aa('0x3'));var fs=require('fs');var Redis=require(_0x76aa('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x76aa('0x5'));var logger=require(_0x76aa('0x6'))(_0x76aa('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x76aa('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x32dee5,_0x36d12b,_0xa9b695){return new BPromise(function(_0x56d6bc,_0x3dae33){return client[_0x76aa('0x9')](_0x32dee5,_0xa9b695)[_0x76aa('0xa')](function(_0x557d69){logger[_0x76aa('0xb')](_0x76aa('0xc'),_0x36d12b,_0x76aa('0xd'));logger[_0x76aa('0xe')](_0x76aa('0xf'),_0x36d12b,_0x76aa('0xd'),JSON[_0x76aa('0x10')](_0x557d69));if(_0x557d69[_0x76aa('0x11')]){if(_0x557d69[_0x76aa('0x11')][_0x76aa('0x12')]===0x1f4){logger['error'](_0x76aa('0xc'),_0x36d12b,_0x557d69['error'][_0x76aa('0x13')]);return _0x3dae33(_0x557d69[_0x76aa('0x11')][_0x76aa('0x13')]);}logger[_0x76aa('0x11')](_0x76aa('0xc'),_0x36d12b,_0x557d69['error']['message']);return _0x56d6bc(_0x557d69[_0x76aa('0x11')]['message']);}else{logger[_0x76aa('0xb')](_0x76aa('0xc'),_0x36d12b,'request\x20sent');_0x56d6bc(_0x557d69[_0x76aa('0x14')]['message']);}})[_0x76aa('0x15')](function(_0x5181d2){logger[_0x76aa('0x11')](_0x76aa('0xc'),_0x36d12b,_0x5181d2);_0x3dae33(_0x5181d2);});});} \ No newline at end of file diff --git a/server/api/userNotification/index.js b/server/api/userNotification/index.js index a8885f2..206f627 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 _0xfda6=['post','isAuthenticated','exports','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userNotification.controller'];(function(_0x593e8a,_0x33f440){var _0x47cd1c=function(_0x522cff){while(--_0x522cff){_0x593e8a['push'](_0x593e8a['shift']());}};_0x47cd1c(++_0x33f440);}(_0xfda6,0x121));var _0x6fda=function(_0x3266c1,_0x38ffbf){_0x3266c1=_0x3266c1-0x0;var _0x10e827=_0xfda6[_0x3266c1];return _0x10e827;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x6fda('0x0'));var timeout=require('connect-timeout');var express=require(_0x6fda('0x1'));var router=express[_0x6fda('0x2')]();var fs_extra=require(_0x6fda('0x3'));var auth=require(_0x6fda('0x4'));var interaction=require(_0x6fda('0x5'));var config=require(_0x6fda('0x6'));var controller=require(_0x6fda('0x7'));router[_0x6fda('0x8')]('/',auth[_0x6fda('0x9')](),controller['sendUserNotification']);module[_0x6fda('0xa')]=router; \ No newline at end of file +var _0xea90=['Router','fs-extra','../../components/auth/service','../../config/environment','./userNotification.controller','post','isAuthenticated','sendUserNotification','path','connect-timeout','express'];(function(_0x292f51,_0x45d132){var _0x28e857=function(_0x2465b5){while(--_0x2465b5){_0x292f51['push'](_0x292f51['shift']());}};_0x28e857(++_0x45d132);}(_0xea90,0xe4));var _0x0ea9=function(_0x243511,_0x22e384){_0x243511=_0x243511-0x0;var _0x5d11a9=_0xea90[_0x243511];return _0x5d11a9;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x0ea9('0x0'));var timeout=require(_0x0ea9('0x1'));var express=require(_0x0ea9('0x2'));var router=express[_0x0ea9('0x3')]();var fs_extra=require(_0x0ea9('0x4'));var auth=require(_0x0ea9('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x0ea9('0x6'));var controller=require(_0x0ea9('0x7'));router[_0x0ea9('0x8')]('/',auth[_0x0ea9('0x9')](),controller[_0x0ea9('0xa')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.attributes.js b/server/api/userNotification/userNotification.attributes.js index 90d1ea4..0c86962 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 _0xc3d7=['TEXT','BOOLEAN','sequelize','exports'];(function(_0x1c99f7,_0x14134f){var _0x443613=function(_0x129e02){while(--_0x129e02){_0x1c99f7['push'](_0x1c99f7['shift']());}};_0x443613(++_0x14134f);}(_0xc3d7,0x122));var _0x7c3d=function(_0x20462b,_0x314408){_0x20462b=_0x20462b-0x0;var _0x783773=_0xc3d7[_0x20462b];return _0x783773;};'use strict';var Sequelize=require(_0x7c3d('0x0'));module[_0x7c3d('0x1')]={'body':{'type':Sequelize['TEXT']},'senderName':{'type':Sequelize['STRING']},'recipientsId':{'type':Sequelize[_0x7c3d('0x2')]},'recipientsDescription':{'type':Sequelize['STRING']},'beep':{'type':Sequelize[_0x7c3d('0x3')]}}; \ No newline at end of file +var _0x13d0=['TEXT','STRING','sequelize'];(function(_0x2de8b2,_0x2347b2){var _0x225509=function(_0x32ce04){while(--_0x32ce04){_0x2de8b2['push'](_0x2de8b2['shift']());}};_0x225509(++_0x2347b2);}(_0x13d0,0x197));var _0x013d=function(_0x5e7990,_0x20fcbe){_0x5e7990=_0x5e7990-0x0;var _0x5d5b2e=_0x13d0[_0x5e7990];return _0x5d5b2e;};'use strict';var Sequelize=require(_0x013d('0x0'));module['exports']={'body':{'type':Sequelize[_0x013d('0x1')]},'senderName':{'type':Sequelize['STRING']},'recipientsId':{'type':Sequelize[_0x013d('0x1')]},'recipientsDescription':{'type':Sequelize[_0x013d('0x2')]},'beep':{'type':Sequelize['BOOLEAN']}}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.controller.js b/server/api/userNotification/userNotification.controller.js index 08b2202..83fb84a 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 _0xa96a=['papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','socket.io-emitter','./userNotification.socket','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','sendUserNotification','hasOwnProperty','body','TemplateId','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','view','Sequelize','Missing\x20\x27recipients\x27\x20parameter','recipients','Invalid\x20\x27recipients\x27\x20object','chatqueue','faxqueue','openchannelqueue','voicequeue','team','user','some','model','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','fullname','recipientsDescription','beep','SenderId','recipientsId','sortBy','sequelize','transaction','UserNotification','create','forEach','emit','text','Template','findOne','html','Invalid\x20\x27TemplateId\x27\x20parameter','render','catch','User','union','ids','queue','replace','all','flatten','getAgents','map','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring'];(function(_0x1b8ffe,_0x819fb){var _0x3a1c1b=function(_0x3b1dfa){while(--_0x3b1dfa){_0x1b8ffe['push'](_0x1b8ffe['shift']());}};_0x3a1c1b(++_0x819fb);}(_0xa96a,0x188));var _0xaa96=function(_0x475cd1,_0x427791){_0x475cd1=_0x475cd1-0x0;var _0x475ffb=_0xa96a[_0x475cd1];return _0x475ffb;};'use strict';var emlformat=require(_0xaa96('0x0'));var rimraf=require(_0xaa96('0x1'));var zipdir=require(_0xaa96('0x2'));var jsonpatch=require(_0xaa96('0x3'));var rp=require(_0xaa96('0x4'));var moment=require(_0xaa96('0x5'));var BPromise=require(_0xaa96('0x6'));var Mustache=require(_0xaa96('0x7'));var util=require(_0xaa96('0x8'));var path=require(_0xaa96('0x9'));var sox=require(_0xaa96('0xa'));var csv=require(_0xaa96('0xb'));var ejs=require(_0xaa96('0xc'));var fs=require('fs');var fs_extra=require(_0xaa96('0xd'));var _=require(_0xaa96('0xe'));var squel=require(_0xaa96('0xf'));var crypto=require(_0xaa96('0x10'));var jsforce=require(_0xaa96('0x11'));var deskjs=require(_0xaa96('0x12'));var toCsv=require(_0xaa96('0xb'));var querystring=require(_0xaa96('0x13'));var Papa=require(_0xaa96('0x14'));var Redis=require(_0xaa96('0x15'));var authService=require(_0xaa96('0x16'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xaa96('0x17'));var logger=require(_0xaa96('0x18'))(_0xaa96('0x19'));var utils=require(_0xaa96('0x1a'));var config=require(_0xaa96('0x1b'));var licenseUtil=require(_0xaa96('0x1c'));var db=require(_0xaa96('0x1d'))['db'];config['redis']=_[_0xaa96('0x1e')](config[_0xaa96('0x1f')],{'host':'localhost','port':0x18eb});var socket=require(_0xaa96('0x20'))(new Redis(config[_0xaa96('0x1f')]));require(_0xaa96('0x21'))['register'](socket);function respondWithStatusCode(_0xb66540,_0x3bc748){_0x3bc748=_0x3bc748||0xcc;return function(_0x243481){if(_0x243481){return _0xb66540[_0xaa96('0x22')](_0x3bc748);}return _0xb66540[_0xaa96('0x23')](_0x3bc748)[_0xaa96('0x24')]();};}function respondWithResult(_0x3b1e80,_0x2a383b){_0x2a383b=_0x2a383b||0xc8;return function(_0x4f4e5d){if(_0x4f4e5d){return _0x3b1e80['status'](_0x2a383b)[_0xaa96('0x25')](_0x4f4e5d);}};}function respondWithFilteredResult(_0x2554b7,_0x21cea8){return function(_0x3c9111){if(_0x3c9111){var _0x201845=typeof _0x21cea8[_0xaa96('0x26')]===_0xaa96('0x27')&&typeof _0x21cea8[_0xaa96('0x28')]===_0xaa96('0x27');var _0xf9e247=_0x3c9111['count'];var _0x5b744c=_0x201845?0x0:_0x21cea8[_0xaa96('0x26')];var _0x49c46c=_0x201845?_0x3c9111[_0xaa96('0x29')]:_0x21cea8[_0xaa96('0x26')]+_0x21cea8['limit'];var _0x4b706a;if(_0x49c46c>=_0xf9e247){_0x49c46c=_0xf9e247;_0x4b706a=0xc8;}else{_0x4b706a=0xce;}_0x2554b7[_0xaa96('0x23')](_0x4b706a);return _0x2554b7['set'](_0xaa96('0x2a'),_0x5b744c+'-'+_0x49c46c+'/'+_0xf9e247)[_0xaa96('0x25')](_0x3c9111);}return null;};}function patchUpdates(_0x1f7845){return function(_0x4f25db){try{jsonpatch[_0xaa96('0x2b')](_0x4f25db,_0x1f7845,!![]);}catch(_0x57fe0f){return BPromise[_0xaa96('0x2c')](_0x57fe0f);}return _0x4f25db[_0xaa96('0x2d')]();};}function saveUpdates(_0x225d2b,_0x4ad272){return function(_0x4976a0){if(_0x4976a0){return _0x4976a0[_0xaa96('0x2e')](_0x225d2b)[_0xaa96('0x2f')](function(_0x14f0fd){return _0x14f0fd;});}return null;};}function removeEntity(_0x13452c,_0x122c7d){return function(_0x24d03d){if(_0x24d03d){return _0x24d03d[_0xaa96('0x30')]()[_0xaa96('0x2f')](function(){_0x13452c[_0xaa96('0x23')](0xcc)[_0xaa96('0x24')]();});}};}function handleEntityNotFound(_0x42dfc9,_0x51497a){return function(_0x251cdb){if(!_0x251cdb){_0x42dfc9['sendStatus'](0x194);}return _0x251cdb;};}function handleError(_0x57c77c,_0x117390){_0x117390=_0x117390||0x1f4;return function(_0x14518a){logger[_0xaa96('0x31')](_0x14518a[_0xaa96('0x32')]);if(_0x14518a[_0xaa96('0x33')]){delete _0x14518a[_0xaa96('0x33')];}_0x57c77c[_0xaa96('0x23')](_0x117390)[_0xaa96('0x34')](_0x14518a);};}exports[_0xaa96('0x35')]=function(_0x1ced43,_0x5b0916,_0x3bd229){if(!_0x1ced43['body'][_0xaa96('0x36')]('text')&&!_0x1ced43[_0xaa96('0x37')][_0xaa96('0x36')](_0xaa96('0x38'))){throw new db['Sequelize'][(_0xaa96('0x39'))](_0xaa96('0x3a'));}else{if(_0x1ced43[_0xaa96('0x37')][_0xaa96('0x36')](_0xaa96('0x38'))&&!_0x1ced43[_0xaa96('0x37')][_0xaa96('0x36')](_0xaa96('0x3b'))){throw new db[(_0xaa96('0x3c'))][(_0xaa96('0x39'))]('Missing\x20\x27view\x27\x20parameter');}if(!_0x1ced43['body']['hasOwnProperty']('recipients')){throw new db[(_0xaa96('0x3c'))][(_0xaa96('0x39'))](_0xaa96('0x3d'));}else{try{var _0x52ae1a=JSON['parse'](_0x1ced43[_0xaa96('0x37')][_0xaa96('0x3e')]);}catch(_0x251b9d){logger[_0xaa96('0x31')](_0x251b9d);throw new db[(_0xaa96('0x3c'))][(_0xaa96('0x39'))](_0xaa96('0x3f'));}var _0x1964d2=[_0xaa96('0x40'),_0xaa96('0x41'),'mailqueue',_0xaa96('0x42'),'smsqueue',_0xaa96('0x43'),'whatsappqueue',_0xaa96('0x44'),_0xaa96('0x45')];if(_[_0xaa96('0x46')](_0x52ae1a,function(_0x54faf3){return!_['includes'](_0x1964d2,_0x54faf3[_0xaa96('0x47')][_0xaa96('0x48')]());})){throw new db['Sequelize'][(_0xaa96('0x39'))](_0xaa96('0x49'));}}}var _0x1e7f6f={};_0x1e7f6f[_0xaa96('0x4a')]=_0x1ced43[_0xaa96('0x37')][_0xaa96('0x36')](_0xaa96('0x4a'))?_0x1ced43[_0xaa96('0x37')][_0xaa96('0x4a')]:_0x1ced43[_0xaa96('0x45')][_0xaa96('0x4b')];_0x1e7f6f[_0xaa96('0x4c')]=_['isEmpty'](_0x1ced43['body'][_0xaa96('0x4c')])?null:_0x1ced43['body'][_0xaa96('0x4c')];_0x1e7f6f[_0xaa96('0x4d')]=_0x1ced43[_0xaa96('0x37')][_0xaa96('0x4d')]||![];_0x1e7f6f[_0xaa96('0x4e')]=_0x1ced43[_0xaa96('0x45')]['id'];return getContent(_0x1ced43[_0xaa96('0x37')])['then'](function(_0x83062a){_0x1e7f6f[_0xaa96('0x37')]=_0x83062a;return getRecipients(_0x52ae1a);})['then'](function(_0x379bbe){_0x1e7f6f[_0xaa96('0x4f')]=_[_0xaa96('0x50')](_0x379bbe)['join'](',');return db[_0xaa96('0x51')][_0xaa96('0x52')](function(_0x45e7b5){return db[_0xaa96('0x53')][_0xaa96('0x54')](_0x1e7f6f,{'raw':!![],'transaction':_0x45e7b5})['then'](function(_0x211c31){var _0x265836={'sender':_0x1e7f6f[_0xaa96('0x4a')],'description':_0x1e7f6f[_0xaa96('0x4c')],'content':_0x1e7f6f[_0xaa96('0x37')],'beep':_0x1e7f6f[_0xaa96('0x4d')]};_0x379bbe[_0xaa96('0x55')](function(_0x4467af){_0x265836['recipient']=_0x4467af;socket[_0xaa96('0x56')]('userNotification:send',_0x265836);});return _0x211c31;});});})['then'](respondWithResult(_0x5b0916,0xc9))['catch'](handleError(_0x5b0916,null));};function getContent(_0x38e43d){return new BPromise(function(_0x46eb6f,_0x832f37){if(_0x38e43d[_0xaa96('0x57')]){_0x46eb6f(_0x38e43d[_0xaa96('0x57')]);return;}return db[_0xaa96('0x58')][_0xaa96('0x59')]({'attributes':[_0xaa96('0x5a')],'where':{'id':_0x38e43d[_0xaa96('0x38')]},'raw':!![]})['then'](function(_0x6cdea3){if(!_0x6cdea3)throw new db[(_0xaa96('0x3c'))][(_0xaa96('0x39'))](_0xaa96('0x5b'));var _0x3e2905=Mustache[_0xaa96('0x5c')](_0x6cdea3[_0xaa96('0x5a')],_0x38e43d['view']);_0x46eb6f(_0x3e2905);})[_0xaa96('0x5d')](function(_0x2fddfb){_0x832f37(_0x2fddfb);});});}function getRecipients(_0x3b5010){return new BPromise(function(_0x34f14c,_0x457c52){var _0x280492=[];var _0x1b596e=[];_0x3b5010[_0xaa96('0x55')](function(_0x4dd9dd){var _0x1f4b4d=_['startCase'](_0x4dd9dd[_0xaa96('0x47')][_0xaa96('0x48')]());if(_0x1f4b4d===_0xaa96('0x5e')){_0x280492=_[_0xaa96('0x5f')](_0x280492,_0x4dd9dd[_0xaa96('0x60')]);}else{if(_['includes'](_0x1f4b4d,_0xaa96('0x61')))_0x1f4b4d=_0x1f4b4d[_0xaa96('0x62')]('queue','Queue');_0x4dd9dd[_0xaa96('0x60')][_0xaa96('0x55')](function(_0x47d57b){_0x1b596e['push'](getAgents(_0x1f4b4d,_0x47d57b));});}});return BPromise[_0xaa96('0x63')](_0x1b596e)[_0xaa96('0x2f')](function(_0x4d1585){_0x280492=_['union'](_0x280492,_[_0xaa96('0x64')](_0x4d1585));_0x34f14c(_0x280492);})['catch'](function(_0x4ef06e){_0x457c52(_0x4ef06e);});});}function getAgents(_0x3c8635,_0x4a4f98){return new BPromise(function(_0x4a48cc,_0x1d9761){return db[_0x3c8635][_0xaa96('0x59')]({'where':{'id':_0x4a4f98}})[_0xaa96('0x2f')](function(_0x4cf50){return _0x4cf50[_0xaa96('0x65')]({'attributes':['id'],'raw':!![]})['then'](function(_0x26e75d){var _0x583c6b=_[_0xaa96('0x66')](_0x26e75d,'id');_0x4a48cc(_0x583c6b);});})[_0xaa96('0x5d')](function(_0x3e4a0c){_0x1d9761(_0x3e4a0c);});});} \ No newline at end of file +var _0xc6c5=['findOne','html','Invalid\x20\x27TemplateId\x27\x20parameter','render','startCase','toLowerCase','User','union','replace','queue','Queue','ids','push','all','flatten','map','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','crypto','jsforce','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./userNotification.socket','register','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','then','destroy','error','stack','name','sendUserNotification','body','hasOwnProperty','text','TemplateId','Sequelize','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','view','Missing\x20\x27recipients\x27\x20parameter','parse','recipients','Invalid\x20\x27recipients\x27\x20object','faxqueue','mailqueue','openchannelqueue','smsqueue','voicequeue','whatsappqueue','team','user','some','includes','model','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','fullname','recipientsDescription','beep','SenderId','recipientsId','sortBy','join','sequelize','transaction','UserNotification','create','forEach','emit','userNotification:send','catch'];(function(_0x1e7030,_0x5c77b4){var _0x3250b4=function(_0x564c92){while(--_0x564c92){_0x1e7030['push'](_0x1e7030['shift']());}};_0x3250b4(++_0x5c77b4);}(_0xc6c5,0x148));var _0x5c6c=function(_0x4b0338,_0x300c7c){_0x4b0338=_0x4b0338-0x0;var _0x945c9b=_0xc6c5[_0x4b0338];return _0x945c9b;};'use strict';var emlformat=require(_0x5c6c('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x5c6c('0x1'));var rp=require(_0x5c6c('0x2'));var moment=require(_0x5c6c('0x3'));var BPromise=require(_0x5c6c('0x4'));var Mustache=require(_0x5c6c('0x5'));var util=require(_0x5c6c('0x6'));var path=require(_0x5c6c('0x7'));var sox=require(_0x5c6c('0x8'));var csv=require('to-csv');var ejs=require(_0x5c6c('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5c6c('0xa'));var squel=require('squel');var crypto=require(_0x5c6c('0xb'));var jsforce=require(_0x5c6c('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x5c6c('0xd'));var querystring=require('querystring');var Papa=require(_0x5c6c('0xe'));var Redis=require(_0x5c6c('0xf'));var authService=require(_0x5c6c('0x10'));var qs=require(_0x5c6c('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5c6c('0x12'));var logger=require(_0x5c6c('0x13'))(_0x5c6c('0x14'));var utils=require(_0x5c6c('0x15'));var config=require(_0x5c6c('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x5c6c('0x17'))['db'];config['redis']=_[_0x5c6c('0x18')](config[_0x5c6c('0x19')],{'host':_0x5c6c('0x1a'),'port':0x18eb});var socket=require(_0x5c6c('0x1b'))(new Redis(config[_0x5c6c('0x19')]));require(_0x5c6c('0x1c'))[_0x5c6c('0x1d')](socket);function respondWithStatusCode(_0x37b5b0,_0x2a40d8){_0x2a40d8=_0x2a40d8||0xcc;return function(_0x46ec62){if(_0x46ec62){return _0x37b5b0[_0x5c6c('0x1e')](_0x2a40d8);}return _0x37b5b0[_0x5c6c('0x1f')](_0x2a40d8)[_0x5c6c('0x20')]();};}function respondWithResult(_0x43871f,_0x1a5f02){_0x1a5f02=_0x1a5f02||0xc8;return function(_0x587179){if(_0x587179){return _0x43871f[_0x5c6c('0x1f')](_0x1a5f02)['json'](_0x587179);}};}function respondWithFilteredResult(_0x21c8dc,_0x4671ba){return function(_0x1e8ee8){if(_0x1e8ee8){var _0x4eb790=typeof _0x4671ba[_0x5c6c('0x21')]===_0x5c6c('0x22')&&typeof _0x4671ba[_0x5c6c('0x23')]===_0x5c6c('0x22');var _0x2d35bc=_0x1e8ee8[_0x5c6c('0x24')];var _0xb61e54=_0x4eb790?0x0:_0x4671ba[_0x5c6c('0x21')];var _0x35bc5a=_0x4eb790?_0x1e8ee8[_0x5c6c('0x24')]:_0x4671ba[_0x5c6c('0x21')]+_0x4671ba[_0x5c6c('0x23')];var _0x5c2aeb;if(_0x35bc5a>=_0x2d35bc){_0x35bc5a=_0x2d35bc;_0x5c2aeb=0xc8;}else{_0x5c2aeb=0xce;}_0x21c8dc[_0x5c6c('0x1f')](_0x5c2aeb);return _0x21c8dc[_0x5c6c('0x25')](_0x5c6c('0x26'),_0xb61e54+'-'+_0x35bc5a+'/'+_0x2d35bc)[_0x5c6c('0x27')](_0x1e8ee8);}return null;};}function patchUpdates(_0x40372d){return function(_0x4e7f8c){try{jsonpatch[_0x5c6c('0x28')](_0x4e7f8c,_0x40372d,!![]);}catch(_0x511a3d){return BPromise[_0x5c6c('0x29')](_0x511a3d);}return _0x4e7f8c['save']();};}function saveUpdates(_0x12e2e0,_0x3f1184){return function(_0x2e7da5){if(_0x2e7da5){return _0x2e7da5['update'](_0x12e2e0)[_0x5c6c('0x2a')](function(_0x5be9ad){return _0x5be9ad;});}return null;};}function removeEntity(_0x23343a,_0x14a2f4){return function(_0x5f5707){if(_0x5f5707){return _0x5f5707[_0x5c6c('0x2b')]()[_0x5c6c('0x2a')](function(){_0x23343a[_0x5c6c('0x1f')](0xcc)[_0x5c6c('0x20')]();});}};}function handleEntityNotFound(_0x5d05d6,_0x4f1e89){return function(_0x57d4f8){if(!_0x57d4f8){_0x5d05d6[_0x5c6c('0x1e')](0x194);}return _0x57d4f8;};}function handleError(_0x1e881b,_0x589ff4){_0x589ff4=_0x589ff4||0x1f4;return function(_0xf609d5){logger[_0x5c6c('0x2c')](_0xf609d5[_0x5c6c('0x2d')]);if(_0xf609d5[_0x5c6c('0x2e')]){delete _0xf609d5[_0x5c6c('0x2e')];}_0x1e881b[_0x5c6c('0x1f')](_0x589ff4)['send'](_0xf609d5);};}exports[_0x5c6c('0x2f')]=function(_0x27dca8,_0x21c7ab,_0x1c45fd){if(!_0x27dca8[_0x5c6c('0x30')][_0x5c6c('0x31')](_0x5c6c('0x32'))&&!_0x27dca8[_0x5c6c('0x30')]['hasOwnProperty'](_0x5c6c('0x33'))){throw new db[(_0x5c6c('0x34'))][(_0x5c6c('0x35'))](_0x5c6c('0x36'));}else{if(_0x27dca8['body'][_0x5c6c('0x31')](_0x5c6c('0x33'))&&!_0x27dca8['body'][_0x5c6c('0x31')](_0x5c6c('0x37'))){throw new db[(_0x5c6c('0x34'))][(_0x5c6c('0x35'))]('Missing\x20\x27view\x27\x20parameter');}if(!_0x27dca8[_0x5c6c('0x30')][_0x5c6c('0x31')]('recipients')){throw new db[(_0x5c6c('0x34'))]['ValidationError'](_0x5c6c('0x38'));}else{try{var _0xdf883c=JSON[_0x5c6c('0x39')](_0x27dca8[_0x5c6c('0x30')][_0x5c6c('0x3a')]);}catch(_0x464f6a){logger[_0x5c6c('0x2c')](_0x464f6a);throw new db[(_0x5c6c('0x34'))][(_0x5c6c('0x35'))](_0x5c6c('0x3b'));}var _0x3208ce=['chatqueue',_0x5c6c('0x3c'),_0x5c6c('0x3d'),_0x5c6c('0x3e'),_0x5c6c('0x3f'),_0x5c6c('0x40'),_0x5c6c('0x41'),_0x5c6c('0x42'),_0x5c6c('0x43')];if(_[_0x5c6c('0x44')](_0xdf883c,function(_0x2f8d7e){return!_[_0x5c6c('0x45')](_0x3208ce,_0x2f8d7e[_0x5c6c('0x46')]['toLowerCase']());})){throw new db[(_0x5c6c('0x34'))][(_0x5c6c('0x35'))](_0x5c6c('0x47'));}}}var _0x5ee3d0={};_0x5ee3d0[_0x5c6c('0x48')]=_0x27dca8[_0x5c6c('0x30')][_0x5c6c('0x31')]('senderName')?_0x27dca8['body'][_0x5c6c('0x48')]:_0x27dca8[_0x5c6c('0x43')][_0x5c6c('0x49')];_0x5ee3d0['recipientsDescription']=_['isEmpty'](_0x27dca8[_0x5c6c('0x30')][_0x5c6c('0x4a')])?null:_0x27dca8[_0x5c6c('0x30')][_0x5c6c('0x4a')];_0x5ee3d0[_0x5c6c('0x4b')]=_0x27dca8['body'][_0x5c6c('0x4b')]||![];_0x5ee3d0[_0x5c6c('0x4c')]=_0x27dca8[_0x5c6c('0x43')]['id'];return getContent(_0x27dca8[_0x5c6c('0x30')])[_0x5c6c('0x2a')](function(_0xcc7bb6){_0x5ee3d0[_0x5c6c('0x30')]=_0xcc7bb6;return getRecipients(_0xdf883c);})[_0x5c6c('0x2a')](function(_0x5bf06d){_0x5ee3d0[_0x5c6c('0x4d')]=_[_0x5c6c('0x4e')](_0x5bf06d)[_0x5c6c('0x4f')](',');return db[_0x5c6c('0x50')][_0x5c6c('0x51')](function(_0xbb6d1f){return db[_0x5c6c('0x52')][_0x5c6c('0x53')](_0x5ee3d0,{'raw':!![],'transaction':_0xbb6d1f})[_0x5c6c('0x2a')](function(_0x1af38d){var _0x2adfbc={'sender':_0x5ee3d0[_0x5c6c('0x48')],'description':_0x5ee3d0[_0x5c6c('0x4a')],'content':_0x5ee3d0[_0x5c6c('0x30')],'beep':_0x5ee3d0[_0x5c6c('0x4b')]};_0x5bf06d[_0x5c6c('0x54')](function(_0x469659){_0x2adfbc['recipient']=_0x469659;socket[_0x5c6c('0x55')](_0x5c6c('0x56'),_0x2adfbc);});return _0x1af38d;});});})[_0x5c6c('0x2a')](respondWithResult(_0x21c7ab,0xc9))[_0x5c6c('0x57')](handleError(_0x21c7ab,null));};function getContent(_0x1a152b){return new BPromise(function(_0x4ebe89,_0x2459ba){if(_0x1a152b[_0x5c6c('0x32')]){_0x4ebe89(_0x1a152b[_0x5c6c('0x32')]);return;}return db['Template'][_0x5c6c('0x58')]({'attributes':[_0x5c6c('0x59')],'where':{'id':_0x1a152b[_0x5c6c('0x33')]},'raw':!![]})[_0x5c6c('0x2a')](function(_0x5d7506){if(!_0x5d7506)throw new db[(_0x5c6c('0x34'))][(_0x5c6c('0x35'))](_0x5c6c('0x5a'));var _0x36c4e8=Mustache[_0x5c6c('0x5b')](_0x5d7506['html'],_0x1a152b['view']);_0x4ebe89(_0x36c4e8);})[_0x5c6c('0x57')](function(_0x215c2d){_0x2459ba(_0x215c2d);});});}function getRecipients(_0x2f8905){return new BPromise(function(_0x330096,_0x4e3c0e){var _0x2befe5=[];var _0x12c50e=[];_0x2f8905[_0x5c6c('0x54')](function(_0x131ffa){var _0x452b6f=_[_0x5c6c('0x5c')](_0x131ffa['model'][_0x5c6c('0x5d')]());if(_0x452b6f===_0x5c6c('0x5e')){_0x2befe5=_[_0x5c6c('0x5f')](_0x2befe5,_0x131ffa['ids']);}else{if(_['includes'](_0x452b6f,'queue'))_0x452b6f=_0x452b6f[_0x5c6c('0x60')](_0x5c6c('0x61'),_0x5c6c('0x62'));_0x131ffa[_0x5c6c('0x63')][_0x5c6c('0x54')](function(_0x51597b){_0x12c50e[_0x5c6c('0x64')](getAgents(_0x452b6f,_0x51597b));});}});return BPromise[_0x5c6c('0x65')](_0x12c50e)[_0x5c6c('0x2a')](function(_0x4d6d15){_0x2befe5=_['union'](_0x2befe5,_[_0x5c6c('0x66')](_0x4d6d15));_0x330096(_0x2befe5);})[_0x5c6c('0x57')](function(_0x3d259a){_0x4e3c0e(_0x3d259a);});});}function getAgents(_0x55486f,_0x10225a){return new BPromise(function(_0x300a05,_0x5abbed){return db[_0x55486f]['findOne']({'where':{'id':_0x10225a}})[_0x5c6c('0x2a')](function(_0x3d637d){return _0x3d637d['getAgents']({'attributes':['id'],'raw':!![]})[_0x5c6c('0x2a')](function(_0x157b0d){var _0x8d1502=_[_0x5c6c('0x67')](_0x157b0d,'id');_0x300a05(_0x8d1502);});})['catch'](function(_0x266800){_0x5abbed(_0x266800);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.events.js b/server/api/userNotification/userNotification.events.js index ac7d5d6..f8bc917 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 _0x7bd0=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','UserNotification','setMaxListeners'];(function(_0x204a47,_0x1cd473){var _0x314a06=function(_0x4b1fab){while(--_0x4b1fab){_0x204a47['push'](_0x204a47['shift']());}};_0x314a06(++_0x1cd473);}(_0x7bd0,0x71));var _0x07bd=function(_0x37c8ef,_0x334449){_0x37c8ef=_0x37c8ef-0x0;var _0x5eaee9=_0x7bd0[_0x37c8ef];return _0x5eaee9;};'use strict';var EventEmitter=require(_0x07bd('0x0'));var UserNotification=require(_0x07bd('0x1'))['db'][_0x07bd('0x2')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0x07bd('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x07bd('0x4')};function emitEvent(_0x47b039){return function(_0x149860,_0x168387,_0x5d26f2){UserNotificationEvents[_0x07bd('0x5')](_0x47b039+':'+_0x149860['id'],_0x149860);UserNotificationEvents['emit'](_0x47b039,_0x149860);_0x5d26f2(null);};}for(var e in events){if(events[_0x07bd('0x6')](e)){var event=events[e];UserNotification[_0x07bd('0x7')](e,emitEvent(event));}}module[_0x07bd('0x8')]=UserNotificationEvents; \ No newline at end of file +var _0xa2a5=['UserNotification','setMaxListeners','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x810e4d,_0x909ef4){var _0x13f01c=function(_0x12fd89){while(--_0x12fd89){_0x810e4d['push'](_0x810e4d['shift']());}};_0x13f01c(++_0x909ef4);}(_0xa2a5,0x187));var _0x5a2a=function(_0x2e9471,_0x35fead){_0x2e9471=_0x2e9471-0x0;var _0x3dfe28=_0xa2a5[_0x2e9471];return _0x3dfe28;};'use strict';var EventEmitter=require(_0x5a2a('0x0'));var UserNotification=require('../../mysqldb')['db'][_0x5a2a('0x1')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0x5a2a('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x5a2a('0x3')};function emitEvent(_0xff4dc8){return function(_0x5f24f9,_0x1d29b5,_0x5e69d6){UserNotificationEvents['emit'](_0xff4dc8+':'+_0x5f24f9['id'],_0x5f24f9);UserNotificationEvents[_0x5a2a('0x4')](_0xff4dc8,_0x5f24f9);_0x5e69d6(null);};}for(var e in events){if(events[_0x5a2a('0x5')](e)){var event=events[e];UserNotification[_0x5a2a('0x6')](e,emitEvent(event));}}module[_0x5a2a('0x7')]=UserNotificationEvents; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.model.js b/server/api/userNotification/userNotification.model.js index 36d64a7..aaca6aa 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 _0xff0c=['lodash','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./userNotification.attributes','exports','define','UserNotification','userNotifications','utf8mb4','utf8mb4_unicode_ci'];(function(_0x485196,_0xd584d8){var _0x1ee3c2=function(_0x5b7e7f){while(--_0x5b7e7f){_0x485196['push'](_0x485196['shift']());}};_0x1ee3c2(++_0xd584d8);}(_0xff0c,0x142));var _0xcff0=function(_0x9e0cb3,_0x9cd497){_0x9e0cb3=_0x9e0cb3-0x0;var _0x5926b7=_0xff0c[_0x9e0cb3];return _0x5926b7;};'use strict';var _=require(_0xcff0('0x0'));var util=require('util');var logger=require(_0xcff0('0x1'))('api');var moment=require(_0xcff0('0x2'));var BPromise=require('bluebird');var rp=require(_0xcff0('0x3'));var fs=require('fs');var path=require(_0xcff0('0x4'));var rimraf=require(_0xcff0('0x5'));var config=require(_0xcff0('0x6'));var attributes=require(_0xcff0('0x7'));module[_0xcff0('0x8')]=function(_0x2abae3,_0x14d92e){return _0x2abae3[_0xcff0('0x9')](_0xcff0('0xa'),attributes,{'tableName':_0xcff0('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xcff0('0xc'),'collate':_0xcff0('0xd')});}; \ No newline at end of file +var _0xca07=['util','../../config/logger','api','moment','path','rimraf','./userNotification.attributes','exports','define','UserNotification'];(function(_0x2235bf,_0x3a06a7){var _0x4c3a64=function(_0x3b3bb6){while(--_0x3b3bb6){_0x2235bf['push'](_0x2235bf['shift']());}};_0x4c3a64(++_0x3a06a7);}(_0xca07,0x17c));var _0x7ca0=function(_0xb54f15,_0x4e7d71){_0xb54f15=_0xb54f15-0x0;var _0x34f533=_0xca07[_0xb54f15];return _0x34f533;};'use strict';var _=require('lodash');var util=require(_0x7ca0('0x0'));var logger=require(_0x7ca0('0x1'))(_0x7ca0('0x2'));var moment=require(_0x7ca0('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x7ca0('0x4'));var rimraf=require(_0x7ca0('0x5'));var config=require('../../config/environment');var attributes=require(_0x7ca0('0x6'));module[_0x7ca0('0x7')]=function(_0x1e6bb0,_0x2d148d){return _0x1e6bb0[_0x7ca0('0x8')](_0x7ca0('0x9'),attributes,{'tableName':'userNotifications','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.rpc.js b/server/api/userNotification/userNotification.rpc.js index 11acc10..436ebe8 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 _0xde14=['request','info','UserNotification,\x20%s,\x20%s','request\x20sent','debug','UserNotification,\x20%s,\x20%s,\x20%s','code','error','message','catch','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','client','http','localhost','socket.io-emitter','redis','./userNotification.socket','register'];(function(_0x37e845,_0x219f9f){var _0x59e55b=function(_0x5dc6c8){while(--_0x5dc6c8){_0x37e845['push'](_0x37e845['shift']());}};_0x59e55b(++_0x219f9f);}(_0xde14,0x11e));var _0x4de1=function(_0x35e5d1,_0x26ca68){_0x35e5d1=_0x35e5d1-0x0;var _0x5eca29=_0xde14[_0x35e5d1];return _0x5eca29;};'use strict';var _=require('lodash');var util=require(_0x4de1('0x0'));var moment=require(_0x4de1('0x1'));var BPromise=require(_0x4de1('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4de1('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x4de1('0x4'));var logger=require(_0x4de1('0x5'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x4de1('0x6')][_0x4de1('0x7')]({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':_0x4de1('0x8'),'port':0x18eb});var socket=require(_0x4de1('0x9'))(new Redis(config[_0x4de1('0xa')]));require(_0x4de1('0xb'))[_0x4de1('0xc')](socket);function respondWithRpcPromise(_0x262724,_0x29234b,_0x5c015b){return new BPromise(function(_0x9404a9,_0x3fb07e){return client[_0x4de1('0xd')](_0x262724,_0x5c015b)['then'](function(_0x31ae73){logger[_0x4de1('0xe')](_0x4de1('0xf'),_0x29234b,_0x4de1('0x10'));logger[_0x4de1('0x11')](_0x4de1('0x12'),_0x29234b,_0x4de1('0x10'),JSON['stringify'](_0x31ae73));if(_0x31ae73['error']){if(_0x31ae73['error'][_0x4de1('0x13')]===0x1f4){logger[_0x4de1('0x14')](_0x4de1('0xf'),_0x29234b,_0x31ae73[_0x4de1('0x14')][_0x4de1('0x15')]);return _0x3fb07e(_0x31ae73['error']['message']);}logger[_0x4de1('0x14')](_0x4de1('0xf'),_0x29234b,_0x31ae73['error']['message']);return _0x9404a9(_0x31ae73['error']['message']);}else{logger[_0x4de1('0xe')](_0x4de1('0xf'),_0x29234b,'request\x20sent');_0x9404a9(_0x31ae73['result'][_0x4de1('0x15')]);}})[_0x4de1('0x16')](function(_0x1f783f){logger['error']('UserNotification,\x20%s,\x20%s',_0x29234b,_0x1f783f);_0x3fb07e(_0x1f783f);});});} \ No newline at end of file +var _0x43bf=['request','then','UserNotification,\x20%s,\x20%s','request\x20sent','debug','UserNotification,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','lodash','util','moment','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','defaults','socket.io-emitter','./userNotification.socket'];(function(_0x21f1d2,_0x3b71f4){var _0x1da9b3=function(_0x4304e0){while(--_0x4304e0){_0x21f1d2['push'](_0x21f1d2['shift']());}};_0x1da9b3(++_0x3b71f4);}(_0x43bf,0x15c));var _0xf43b=function(_0x378cc5,_0x540418){_0x378cc5=_0x378cc5-0x0;var _0xb76485=_0x43bf[_0x378cc5];return _0xb76485;};'use strict';var _=require(_0xf43b('0x0'));var util=require(_0xf43b('0x1'));var moment=require(_0xf43b('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf43b('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xf43b('0x4'))(_0xf43b('0x5'));var config=require(_0xf43b('0x6'));var jayson=require(_0xf43b('0x7'));var client=jayson['client'][_0xf43b('0x8')]({'port':0x232a});config['redis']=_[_0xf43b('0x9')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xf43b('0xa'))(new Redis(config['redis']));require(_0xf43b('0xb'))['register'](socket);function respondWithRpcPromise(_0x513000,_0x4cefa9,_0x2420b9){return new BPromise(function(_0x31163a,_0x581ad7){return client[_0xf43b('0xc')](_0x513000,_0x2420b9)[_0xf43b('0xd')](function(_0x1b48de){logger['info'](_0xf43b('0xe'),_0x4cefa9,_0xf43b('0xf'));logger[_0xf43b('0x10')](_0xf43b('0x11'),_0x4cefa9,_0xf43b('0xf'),JSON['stringify'](_0x1b48de));if(_0x1b48de[_0xf43b('0x12')]){if(_0x1b48de[_0xf43b('0x12')][_0xf43b('0x13')]===0x1f4){logger[_0xf43b('0x12')](_0xf43b('0xe'),_0x4cefa9,_0x1b48de[_0xf43b('0x12')][_0xf43b('0x14')]);return _0x581ad7(_0x1b48de[_0xf43b('0x12')][_0xf43b('0x14')]);}logger[_0xf43b('0x12')](_0xf43b('0xe'),_0x4cefa9,_0x1b48de[_0xf43b('0x12')][_0xf43b('0x14')]);return _0x31163a(_0x1b48de[_0xf43b('0x12')]['message']);}else{logger[_0xf43b('0x15')](_0xf43b('0xe'),_0x4cefa9,_0xf43b('0xf'));_0x31163a(_0x1b48de[_0xf43b('0x16')]['message']);}})[_0xf43b('0x17')](function(_0x58f1ba){logger[_0xf43b('0x12')]('UserNotification,\x20%s,\x20%s',_0x4cefa9,_0x58f1ba);_0x581ad7(_0x58f1ba);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.socket.js b/server/api/userNotification/userNotification.socket.js index 472945b..675877b 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 _0x3538=['emit','register','length','./userNotification.events','save','remove','update'];(function(_0x5179a5,_0x419746){var _0x15c8ce=function(_0x1b13c4){while(--_0x1b13c4){_0x5179a5['push'](_0x5179a5['shift']());}};_0x15c8ce(++_0x419746);}(_0x3538,0x88));var _0x8353=function(_0x12f9c4,_0x3fc12c){_0x12f9c4=_0x12f9c4-0x0;var _0x3c0b16=_0x3538[_0x12f9c4];return _0x3c0b16;};'use strict';var UserNotificationEvents=require(_0x8353('0x0'));var events=[_0x8353('0x1'),_0x8353('0x2'),_0x8353('0x3')];function createListener(_0x59b0c1,_0x4f8ce6){return function(_0x2c8b8a){_0x4f8ce6[_0x8353('0x4')](_0x59b0c1,_0x2c8b8a);};}function removeListener(_0x38014f,_0x4ad0a9){return function(){UserNotificationEvents['removeListener'](_0x38014f,_0x4ad0a9);};}exports[_0x8353('0x5')]=function(_0x5765e7){for(var _0xfb1ce1=0x0,_0x27fb29=events[_0x8353('0x6')];_0xfb1ce1<_0x27fb29;_0xfb1ce1++){var _0x43f0ff=events[_0xfb1ce1];var _0x4af4a6=createListener('userNotification:'+_0x43f0ff,_0x5765e7);UserNotificationEvents['on'](_0x43f0ff,_0x4af4a6);}}; \ No newline at end of file +var _0x0b2f=['emit','removeListener','length','userNotification:','save','update'];(function(_0x57ece0,_0x46f04b){var _0x33dabd=function(_0x5f45cc){while(--_0x5f45cc){_0x57ece0['push'](_0x57ece0['shift']());}};_0x33dabd(++_0x46f04b);}(_0x0b2f,0x14e));var _0xf0b2=function(_0x5f3df0,_0x314710){_0x5f3df0=_0x5f3df0-0x0;var _0xb8325c=_0x0b2f[_0x5f3df0];return _0xb8325c;};'use strict';var UserNotificationEvents=require('./userNotification.events');var events=[_0xf0b2('0x0'),'remove',_0xf0b2('0x1')];function createListener(_0x112bd8,_0x224359){return function(_0x5b90e7){_0x224359[_0xf0b2('0x2')](_0x112bd8,_0x5b90e7);};}function removeListener(_0x231e3a,_0x5125c1){return function(){UserNotificationEvents[_0xf0b2('0x3')](_0x231e3a,_0x5125c1);};}exports['register']=function(_0x223292){for(var _0xe14824=0x0,_0x5c521b=events[_0xf0b2('0x4')];_0xe14824<_0x5c521b;_0xe14824++){var _0x2e5473=events[_0xe14824];var _0x4ea0f3=createListener(_0xf0b2('0x5')+_0x2e5473,_0x223292);UserNotificationEvents['on'](_0x2e5473,_0x4ea0f3);}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index 25c96dc..bb6ffed 100644 --- a/server/api/userOpenchannelQueue/index.js +++ b/server/api/userOpenchannelQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x371cb7,_0x46566d){var _0xb50075=function(_0xc5ce29){while(--_0xc5ce29){_0x371cb7['push'](_0x371cb7['shift']());}};_0xb50075(++_0x46566d);}(_0xe706,0xa3));var _0x6e70=function(_0x136e11,_0x29bd0b){_0x136e11=_0x136e11-0x0;var _0x36d346=_0xe706[_0x136e11];return _0x36d346;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file +var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x12afa7,_0x5c379e){var _0x4e0e20=function(_0x116742){while(--_0x116742){_0x12afa7['push'](_0x12afa7['shift']());}};_0x4e0e20(++_0x5c379e);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x101e7b,_0x4ef05b){_0x101e7b=_0x101e7b-0x0;var _0x4995c0=_0xcb91[_0x101e7b];return _0x4995c0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js index 0b7a5e2..43840b8 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 _0xfab5=['INTEGER','exports'];(function(_0x34e4ab,_0x193e14){var _0x5a2466=function(_0xf5d9fb){while(--_0xf5d9fb){_0x34e4ab['push'](_0x34e4ab['shift']());}};_0x5a2466(++_0x193e14);}(_0xfab5,0x199));var _0x5fab=function(_0x462bdc,_0x1556d2){_0x462bdc=_0x462bdc-0x0;var _0x5815e5=_0xfab5[_0x462bdc];return _0x5815e5;};'use strict';var Sequelize=require('sequelize');module[_0x5fab('0x0')]={'penalty':{'type':Sequelize[_0x5fab('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x1775=['INTEGER'];(function(_0x43241b,_0x3ef8bd){var _0x3fb920=function(_0x2a1ef7){while(--_0x2a1ef7){_0x43241b['push'](_0x43241b['shift']());}};_0x3fb920(++_0x3ef8bd);}(_0x1775,0x16d));var _0x5177=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x1775[_0x502c7d];return _0x30b7ed;};'use strict';var Sequelize=require('sequelize');module['exports']={'penalty':{'type':Sequelize[_0x5177('0x0')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js index 731fa8a..8383349 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 _0x16c4=['request-promise','path','rimraf','./userOpenchannelQueue.attributes','exports','UserOpenchannelQueue','user_has_openchannel_queues','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x3d4876,_0x366386){var _0x58ca9d=function(_0x5bd045){while(--_0x5bd045){_0x3d4876['push'](_0x3d4876['shift']());}};_0x58ca9d(++_0x366386);}(_0x16c4,0xd7));var _0x416c=function(_0x37a7c6,_0x3a84b6){_0x37a7c6=_0x37a7c6-0x0;var _0x539905=_0x16c4[_0x37a7c6];return _0x539905;};'use strict';var _=require(_0x416c('0x0'));var util=require(_0x416c('0x1'));var logger=require(_0x416c('0x2'))(_0x416c('0x3'));var moment=require(_0x416c('0x4'));var BPromise=require(_0x416c('0x5'));var rp=require(_0x416c('0x6'));var fs=require('fs');var path=require(_0x416c('0x7'));var rimraf=require(_0x416c('0x8'));var config=require('../../config/environment');var attributes=require(_0x416c('0x9'));module[_0x416c('0xa')]=function(_0x29ec57,_0x30fb8f){return _0x29ec57['define'](_0x416c('0xb'),attributes,{'tableName':_0x416c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb0da=['./userOpenchannelQueue.attributes','exports','define','UserOpenchannelQueue','user_has_openchannel_queues','lodash','util','api','moment','rimraf'];(function(_0xa1e3e3,_0x29fe0e){var _0xc980e9=function(_0x1f5adc){while(--_0x1f5adc){_0xa1e3e3['push'](_0xa1e3e3['shift']());}};_0xc980e9(++_0x29fe0e);}(_0xb0da,0xff));var _0xab0d=function(_0x3baaf7,_0xe76964){_0x3baaf7=_0x3baaf7-0x0;var _0x3a4b57=_0xb0da[_0x3baaf7];return _0x3a4b57;};'use strict';var _=require(_0xab0d('0x0'));var util=require(_0xab0d('0x1'));var logger=require('../../config/logger')(_0xab0d('0x2'));var moment=require(_0xab0d('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xab0d('0x4'));var config=require('../../config/environment');var attributes=require(_0xab0d('0x5'));module[_0xab0d('0x6')]=function(_0xa1780,_0x278559){return _0xa1780[_0xab0d('0x7')](_0xab0d('0x8'),attributes,{'tableName':_0xab0d('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.rpc.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.rpc.js index 766877f..fe00d58 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 _0x02e1=['../../mysqldb','rpc','../../config/environment','client','http','request','then','info','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x57db49,_0x288094){var _0xd0636f=function(_0x227787){while(--_0x227787){_0x57db49['push'](_0x57db49['shift']());}};_0xd0636f(++_0x288094);}(_0x02e1,0x72));var _0x102e=function(_0x34157,_0x5e44ac){_0x34157=_0x34157-0x0;var _0x569681=_0x02e1[_0x34157];return _0x569681;};'use strict';var _=require(_0x102e('0x0'));var util=require(_0x102e('0x1'));var moment=require(_0x102e('0x2'));var BPromise=require(_0x102e('0x3'));var rs=require(_0x102e('0x4'));var fs=require('fs');var Redis=require(_0x102e('0x5'));var db=require(_0x102e('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x102e('0x7'));var config=require(_0x102e('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x102e('0x9')][_0x102e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x336d27,_0x456c61,_0x380482){return new BPromise(function(_0x210671,_0x2a99aa){return client[_0x102e('0xb')](_0x336d27,_0x380482)[_0x102e('0xc')](function(_0x5cbe9e){logger[_0x102e('0xd')](_0x102e('0xe'),_0x456c61,_0x102e('0xf'));logger[_0x102e('0x10')](_0x102e('0x11'),_0x456c61,_0x102e('0xf'),JSON[_0x102e('0x12')](_0x5cbe9e));if(_0x5cbe9e['error']){if(_0x5cbe9e[_0x102e('0x13')][_0x102e('0x14')]===0x1f4){logger[_0x102e('0x13')](_0x102e('0xe'),_0x456c61,_0x5cbe9e[_0x102e('0x13')][_0x102e('0x15')]);return _0x2a99aa(_0x5cbe9e[_0x102e('0x13')][_0x102e('0x15')]);}logger['error'](_0x102e('0xe'),_0x456c61,_0x5cbe9e['error'][_0x102e('0x15')]);return _0x210671(_0x5cbe9e['error'][_0x102e('0x15')]);}else{logger[_0x102e('0xd')](_0x102e('0xe'),_0x456c61,'request\x20sent');_0x210671(_0x5cbe9e[_0x102e('0x16')][_0x102e('0x15')]);}})[_0x102e('0x17')](function(_0x17e91b){logger['error'](_0x102e('0xe'),_0x456c61,_0x17e91b);_0x2a99aa(_0x17e91b);});});} \ No newline at end of file +var _0xcbb2=['UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','UserOpenchannelQueue,\x20%s,\x20%s','message','info','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request'];(function(_0x47bcee,_0x5c0311){var _0x4b88a8=function(_0x170762){while(--_0x170762){_0x47bcee['push'](_0x47bcee['shift']());}};_0x4b88a8(++_0x5c0311);}(_0xcbb2,0x111));var _0x2cbb=function(_0xc94958,_0x4293ec){_0xc94958=_0xc94958-0x0;var _0x30ef65=_0xcbb2[_0xc94958];return _0x30ef65;};'use strict';var _=require(_0x2cbb('0x0'));var util=require(_0x2cbb('0x1'));var moment=require(_0x2cbb('0x2'));var BPromise=require(_0x2cbb('0x3'));var rs=require(_0x2cbb('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2cbb('0x5'))['db'];var utils=require(_0x2cbb('0x6'));var logger=require(_0x2cbb('0x7'))('rpc');var config=require(_0x2cbb('0x8'));var jayson=require(_0x2cbb('0x9'));var client=jayson[_0x2cbb('0xa')][_0x2cbb('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x510e8d,_0x2f760a,_0x4ae14d){return new BPromise(function(_0x168246,_0x575207){return client[_0x2cbb('0xc')](_0x510e8d,_0x4ae14d)['then'](function(_0x14bf98){logger['info']('UserOpenchannelQueue,\x20%s,\x20%s',_0x2f760a,'request\x20sent');logger['debug'](_0x2cbb('0xd'),_0x2f760a,_0x2cbb('0xe'),JSON[_0x2cbb('0xf')](_0x14bf98));if(_0x14bf98[_0x2cbb('0x10')]){if(_0x14bf98[_0x2cbb('0x10')]['code']===0x1f4){logger[_0x2cbb('0x10')](_0x2cbb('0x11'),_0x2f760a,_0x14bf98[_0x2cbb('0x10')]['message']);return _0x575207(_0x14bf98[_0x2cbb('0x10')][_0x2cbb('0x12')]);}logger[_0x2cbb('0x10')](_0x2cbb('0x11'),_0x2f760a,_0x14bf98[_0x2cbb('0x10')][_0x2cbb('0x12')]);return _0x168246(_0x14bf98['error']['message']);}else{logger[_0x2cbb('0x13')](_0x2cbb('0x11'),_0x2f760a,_0x2cbb('0xe'));_0x168246(_0x14bf98[_0x2cbb('0x14')][_0x2cbb('0x12')]);}})[_0x2cbb('0x15')](function(_0x27b966){logger[_0x2cbb('0x10')](_0x2cbb('0x11'),_0x2f760a,_0x27b966);_0x575207(_0x27b966);});});} \ No newline at end of file diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index d6fc3b0..7994644 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 _0x63f6=['/:id','show','/:id/sections','getSections','/:id/resources','getResources','post','create','addResources','put','delete','destroy','removeSections','removeResources','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./userProfile.controller','get','isAuthenticated','index','/describe','describe'];(function(_0x3fbc9e,_0x517bc2){var _0x4fe0a0=function(_0x474454){while(--_0x474454){_0x3fbc9e['push'](_0x3fbc9e['shift']());}};_0x4fe0a0(++_0x517bc2);}(_0x63f6,0xf7));var _0x663f=function(_0x5326df,_0x4babd6){_0x5326df=_0x5326df-0x0;var _0x6a86fd=_0x63f6[_0x5326df];return _0x6a86fd;};'use strict';var multer=require('multer');var util=require(_0x663f('0x0'));var path=require(_0x663f('0x1'));var timeout=require(_0x663f('0x2'));var express=require(_0x663f('0x3'));var router=express[_0x663f('0x4')]();var fs_extra=require(_0x663f('0x5'));var auth=require(_0x663f('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x663f('0x7'));var controller=require(_0x663f('0x8'));router[_0x663f('0x9')]('/',auth[_0x663f('0xa')](),controller[_0x663f('0xb')]);router[_0x663f('0x9')](_0x663f('0xc'),auth['isAuthenticated'](),controller[_0x663f('0xd')]);router[_0x663f('0x9')](_0x663f('0xe'),auth[_0x663f('0xa')](),controller[_0x663f('0xf')]);router[_0x663f('0x9')](_0x663f('0x10'),auth[_0x663f('0xa')](),controller[_0x663f('0x11')]);router['get'](_0x663f('0x12'),auth[_0x663f('0xa')](),controller[_0x663f('0x13')]);router[_0x663f('0x14')]('/',auth[_0x663f('0xa')](),controller[_0x663f('0x15')]);router[_0x663f('0x14')]('/:id/clone',auth['isAuthenticated'](),controller['clone']);router[_0x663f('0x14')](_0x663f('0x10'),auth['isAuthenticated'](),controller['addSections']);router[_0x663f('0x14')](_0x663f('0x12'),auth[_0x663f('0xa')](),controller[_0x663f('0x16')]);router[_0x663f('0x17')](_0x663f('0xe'),auth[_0x663f('0xa')](),controller['update']);router[_0x663f('0x18')](_0x663f('0xe'),auth[_0x663f('0xa')](),controller[_0x663f('0x19')]);router['delete'](_0x663f('0x10'),auth[_0x663f('0xa')](),controller[_0x663f('0x1a')]);router[_0x663f('0x18')]('/:id/resources',auth[_0x663f('0xa')](),controller[_0x663f('0x1b')]);module[_0x663f('0x1c')]=router; \ No newline at end of file +var _0x607b=['../../components/interaction/service','../../config/environment','isAuthenticated','/describe','get','/:id','show','/:id/sections','getSections','/:id/resources','post','create','/:id/clone','addSections','addResources','put','update','delete','destroy','removeSections','removeResources','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x35ffaf,_0x213ac6){var _0x2d4003=function(_0x40358b){while(--_0x40358b){_0x35ffaf['push'](_0x35ffaf['shift']());}};_0x2d4003(++_0x213ac6);}(_0x607b,0x18f));var _0xb607=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x607b[_0x501510];return _0x1e6ee5;};'use strict';var multer=require(_0xb607('0x0'));var util=require('util');var path=require(_0xb607('0x1'));var timeout=require(_0xb607('0x2'));var express=require(_0xb607('0x3'));var router=express[_0xb607('0x4')]();var fs_extra=require(_0xb607('0x5'));var auth=require(_0xb607('0x6'));var interaction=require(_0xb607('0x7'));var config=require(_0xb607('0x8'));var controller=require('./userProfile.controller');router['get']('/',auth[_0xb607('0x9')](),controller['index']);router['get'](_0xb607('0xa'),auth[_0xb607('0x9')](),controller['describe']);router[_0xb607('0xb')](_0xb607('0xc'),auth[_0xb607('0x9')](),controller[_0xb607('0xd')]);router['get'](_0xb607('0xe'),auth[_0xb607('0x9')](),controller[_0xb607('0xf')]);router['get'](_0xb607('0x10'),auth[_0xb607('0x9')](),controller['getResources']);router[_0xb607('0x11')]('/',auth['isAuthenticated'](),controller[_0xb607('0x12')]);router['post'](_0xb607('0x13'),auth[_0xb607('0x9')](),controller['clone']);router[_0xb607('0x11')](_0xb607('0xe'),auth[_0xb607('0x9')](),controller[_0xb607('0x14')]);router[_0xb607('0x11')](_0xb607('0x10'),auth[_0xb607('0x9')](),controller[_0xb607('0x15')]);router[_0xb607('0x16')](_0xb607('0xc'),auth[_0xb607('0x9')](),controller[_0xb607('0x17')]);router[_0xb607('0x18')](_0xb607('0xc'),auth[_0xb607('0x9')](),controller[_0xb607('0x19')]);router[_0xb607('0x18')](_0xb607('0xe'),auth[_0xb607('0x9')](),controller[_0xb607('0x1a')]);router[_0xb607('0x18')]('/:id/resources',auth[_0xb607('0x9')](),controller[_0xb607('0x1b')]);module[_0xb607('0x1c')]=router; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.attributes.js b/server/api/userProfile/userProfile.attributes.js index 69a11fd..0e42e87 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 _0xca79=['STRING','setDataValue','crudPermissions','getDataValue','BOOLEAN','sequelize'];(function(_0x2235bf,_0x3a06a7){var _0x4c3a64=function(_0x3b3bb6){while(--_0x3b3bb6){_0x2235bf['push'](_0x2235bf['shift']());}};_0x4c3a64(++_0x3a06a7);}(_0xca79,0x149));var _0x9ca7=function(_0x526173,_0x30044a){_0x526173=_0x526173-0x0;var _0x500264=_0xca79[_0x526173];return _0x500264;};'use strict';var Sequelize=require(_0x9ca7('0x0'));module['exports']={'name':{'type':Sequelize[_0x9ca7('0x1')],'allowNull':![],'unique':'name'},'crudPermissions':{'type':Sequelize[_0x9ca7('0x1')],'set':function(_0x51400a){this[_0x9ca7('0x2')](_0x9ca7('0x3'),_0x51400a?_0x51400a['join'](''):[]);},'get':function(){return this[_0x9ca7('0x4')](_0x9ca7('0x3'))?this[_0x9ca7('0x4')](_0x9ca7('0x3'))['split'](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0x9ca7('0x1')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0x9ca7('0x5')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0x9ca7('0x5')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0x9ca7('0x5')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0x9ca7('0x5')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x9ca7('0x5')],'defaultValue':!![]}}; \ No newline at end of file +var _0xca80=['split','BOOLEAN','sequelize','exports','STRING','setDataValue','crudPermissions','join','getDataValue'];(function(_0x52566d,_0x495d0b){var _0x1f01c0=function(_0x512638){while(--_0x512638){_0x52566d['push'](_0x52566d['shift']());}};_0x1f01c0(++_0x495d0b);}(_0xca80,0x119));var _0x0ca8=function(_0x542c2f,_0x1234b3){_0x542c2f=_0x542c2f-0x0;var _0x5b0e61=_0xca80[_0x542c2f];return _0x5b0e61;};'use strict';var Sequelize=require(_0x0ca8('0x0'));module[_0x0ca8('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name'},'crudPermissions':{'type':Sequelize[_0x0ca8('0x2')],'set':function(_0x29cbf9){this[_0x0ca8('0x3')](_0x0ca8('0x4'),_0x29cbf9?_0x29cbf9[_0x0ca8('0x5')](''):[]);},'get':function(){return this[_0x0ca8('0x6')](_0x0ca8('0x4'))?this['getDataValue'](_0x0ca8('0x4'))[_0x0ca8('0x7')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0x0ca8('0x2')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0x0ca8('0x8')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0x0ca8('0x8')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0x0ca8('0x8')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x0ca8('0x8')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x0ca8('0x8')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.controller.js b/server/api/userProfile/userProfile.controller.js index c4f3674..3273317 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 _0xdef9=['each','autoAssociation','UserProfileResource','sectionId','userProfileId','Resources','UserProfileSection','update','describe','push','removeSections','ids','getSections','enabled','includes','subsections','findOne','Dashboard','forEach','Plugin','resourceId','addResources','bulkCreate','removeResources','getResources','section','Missing\x20section\x20parameter','hasOwnProperty','No\x20User\x20Profile\x20found\x20for\x20id\x20','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','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','redis','defaults','localhost','./userProfile.socket','register','end','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','then','destroy','error','name','index','map','UserProfile','type','key','model','keys','query','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','filter','merge','includeAll','include','findAll','rows','catch','show','params','rawAttributes','options','find','create','clone','get','omit','createdAt','updatedAt','crudPermissions','body','sequelize','transaction'];(function(_0x1c029b,_0x1e288c){var _0x44a1a3=function(_0x55c12c){while(--_0x55c12c){_0x1c029b['push'](_0x1c029b['shift']());}};_0x44a1a3(++_0x1e288c);}(_0xdef9,0x1ed));var _0x9def=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0xdef9[_0x110c3d];return _0x226d67;};'use strict';var emlformat=require(_0x9def('0x0'));var rimraf=require(_0x9def('0x1'));var zipdir=require(_0x9def('0x2'));var jsonpatch=require(_0x9def('0x3'));var rp=require(_0x9def('0x4'));var moment=require(_0x9def('0x5'));var BPromise=require(_0x9def('0x6'));var Mustache=require(_0x9def('0x7'));var util=require(_0x9def('0x8'));var path=require(_0x9def('0x9'));var sox=require(_0x9def('0xa'));var csv=require(_0x9def('0xb'));var ejs=require(_0x9def('0xc'));var fs=require('fs');var fs_extra=require(_0x9def('0xd'));var _=require(_0x9def('0xe'));var squel=require(_0x9def('0xf'));var crypto=require(_0x9def('0x10'));var jsforce=require(_0x9def('0x11'));var deskjs=require(_0x9def('0x12'));var toCsv=require('to-csv');var querystring=require(_0x9def('0x13'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x9def('0x14'));var qs=require(_0x9def('0x15'));var as=require(_0x9def('0x16'));var hardwareService=require(_0x9def('0x17'));var logger=require('../../config/logger')(_0x9def('0x18'));var utils=require(_0x9def('0x19'));var config=require(_0x9def('0x1a'));var licenseUtil=require(_0x9def('0x1b'));var db=require('../../mysqldb')['db'];config[_0x9def('0x1c')]=_[_0x9def('0x1d')](config['redis'],{'host':_0x9def('0x1e'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x9def('0x1f'))[_0x9def('0x20')](socket);function respondWithStatusCode(_0x4649dd,_0x4d5f6b){_0x4d5f6b=_0x4d5f6b||0xcc;return function(_0x2f8f21){if(_0x2f8f21){return _0x4649dd['sendStatus'](_0x4d5f6b);}return _0x4649dd['status'](_0x4d5f6b)[_0x9def('0x21')]();};}function respondWithResult(_0x29dce4,_0x1e8da8){_0x1e8da8=_0x1e8da8||0xc8;return function(_0x40e44f){if(_0x40e44f){return _0x29dce4[_0x9def('0x22')](_0x1e8da8)[_0x9def('0x23')](_0x40e44f);}};}function respondWithFilteredResult(_0x162e7e,_0x39687f){return function(_0x2d3f63){if(_0x2d3f63){var _0x160711=typeof _0x39687f[_0x9def('0x24')]===_0x9def('0x25')&&typeof _0x39687f[_0x9def('0x26')]==='undefined';var _0x47150a=_0x2d3f63[_0x9def('0x27')];var _0x5b9828=_0x160711?0x0:_0x39687f[_0x9def('0x24')];var _0x4ddd1b=_0x160711?_0x2d3f63[_0x9def('0x27')]:_0x39687f['offset']+_0x39687f[_0x9def('0x26')];var _0x354f14;if(_0x4ddd1b>=_0x47150a){_0x4ddd1b=_0x47150a;_0x354f14=0xc8;}else{_0x354f14=0xce;}_0x162e7e['status'](_0x354f14);return _0x162e7e[_0x9def('0x28')](_0x9def('0x29'),_0x5b9828+'-'+_0x4ddd1b+'/'+_0x47150a)[_0x9def('0x23')](_0x2d3f63);}return null;};}function patchUpdates(_0x5a99ab){return function(_0x30274c){try{jsonpatch['apply'](_0x30274c,_0x5a99ab,!![]);}catch(_0x4366de){return BPromise[_0x9def('0x2a')](_0x4366de);}return _0x30274c[_0x9def('0x2b')]();};}function saveUpdates(_0x2e61e8,_0x494e88){return function(_0x1ee823){if(_0x1ee823){return _0x1ee823['update'](_0x2e61e8)[_0x9def('0x2c')](function(_0x19b4ea){return _0x19b4ea;});}return null;};}function removeEntity(_0x5f2846,_0x273779){return function(_0x21b4ee){if(_0x21b4ee){return _0x21b4ee[_0x9def('0x2d')]()['then'](function(){_0x5f2846['status'](0xcc)[_0x9def('0x21')]();});}};}function handleEntityNotFound(_0x2bfc62,_0x2dc7e5){return function(_0x45ebb1){if(!_0x45ebb1){_0x2bfc62['sendStatus'](0x194);}return _0x45ebb1;};}function handleError(_0x459428,_0xda3a7f){_0xda3a7f=_0xda3a7f||0x1f4;return function(_0x1aa212){logger[_0x9def('0x2e')](_0x1aa212['stack']);if(_0x1aa212['name']){delete _0x1aa212[_0x9def('0x2f')];}_0x459428[_0x9def('0x22')](_0xda3a7f)['send'](_0x1aa212);};}exports[_0x9def('0x30')]=function(_0x14f546,_0x4ba5f8){var _0x34818a={},_0x3c88fc={},_0x23daf3={'count':0x0,'rows':[]};var _0x22a7d3=_[_0x9def('0x31')](db[_0x9def('0x32')]['rawAttributes'],function(_0x34c554){return{'name':_0x34c554['fieldName'],'type':_0x34c554[_0x9def('0x33')][_0x9def('0x34')]};});_0x3c88fc[_0x9def('0x35')]=_[_0x9def('0x31')](_0x22a7d3,_0x9def('0x2f'));_0x3c88fc['query']=_[_0x9def('0x36')](_0x14f546[_0x9def('0x37')]);_0x3c88fc[_0x9def('0x38')]=_[_0x9def('0x39')](_0x3c88fc['model'],_0x3c88fc[_0x9def('0x37')]);_0x34818a[_0x9def('0x3a')]=_[_0x9def('0x39')](_0x3c88fc[_0x9def('0x35')],qs[_0x9def('0x3b')](_0x14f546[_0x9def('0x37')][_0x9def('0x3b')]));_0x34818a[_0x9def('0x3a')]=_0x34818a[_0x9def('0x3a')][_0x9def('0x3c')]?_0x34818a[_0x9def('0x3a')]:_0x3c88fc[_0x9def('0x35')];if(!_0x14f546[_0x9def('0x37')]['hasOwnProperty'](_0x9def('0x3d'))){_0x34818a[_0x9def('0x26')]=qs[_0x9def('0x26')](_0x14f546[_0x9def('0x37')][_0x9def('0x26')]);_0x34818a[_0x9def('0x24')]=qs['offset'](_0x14f546[_0x9def('0x37')][_0x9def('0x24')]);}_0x34818a['order']=qs['sort'](_0x14f546['query'][_0x9def('0x3e')]);_0x34818a[_0x9def('0x3f')]=qs[_0x9def('0x38')](_[_0x9def('0x40')](_0x14f546[_0x9def('0x37')],_0x3c88fc[_0x9def('0x38')]),_0x22a7d3);if(_0x14f546['query'][_0x9def('0x41')]){_0x34818a['where']=_[_0x9def('0x42')](_0x34818a[_0x9def('0x3f')],{'$or':_[_0x9def('0x31')](_0x22a7d3,function(_0x34b6f5){if(_0x34b6f5[_0x9def('0x33')]!=='VIRTUAL'){var _0x5e761b={};_0x5e761b[_0x34b6f5['name']]={'$like':'%'+_0x14f546['query']['filter']+'%'};return _0x5e761b;}})});}_0x34818a=_[_0x9def('0x42')]({},_0x34818a,_0x14f546['options']);var _0x25a51f={'where':_0x34818a[_0x9def('0x3f')]};return db[_0x9def('0x32')][_0x9def('0x27')](_0x25a51f)[_0x9def('0x2c')](function(_0x321843){_0x23daf3[_0x9def('0x27')]=_0x321843;if(_0x14f546[_0x9def('0x37')][_0x9def('0x43')]){_0x34818a[_0x9def('0x44')]=[{'all':!![]}];}return db[_0x9def('0x32')][_0x9def('0x45')](_0x34818a);})[_0x9def('0x2c')](function(_0x44ced8){_0x23daf3[_0x9def('0x46')]=_0x44ced8;return _0x23daf3;})[_0x9def('0x2c')](respondWithFilteredResult(_0x4ba5f8,_0x34818a))[_0x9def('0x47')](handleError(_0x4ba5f8,null));};exports[_0x9def('0x48')]=function(_0x2f7d51,_0x1923e5){var _0x6553aa={'raw':![],'where':{'id':_0x2f7d51[_0x9def('0x49')]['id']}},_0x169960={};_0x169960[_0x9def('0x35')]=_[_0x9def('0x36')](db['UserProfile'][_0x9def('0x4a')]);_0x169960[_0x9def('0x37')]=_[_0x9def('0x36')](_0x2f7d51[_0x9def('0x37')]);_0x169960[_0x9def('0x38')]=_[_0x9def('0x39')](_0x169960[_0x9def('0x35')],_0x169960[_0x9def('0x37')]);_0x6553aa[_0x9def('0x3a')]=_['intersection'](_0x169960[_0x9def('0x35')],qs[_0x9def('0x3b')](_0x2f7d51[_0x9def('0x37')][_0x9def('0x3b')]));_0x6553aa['attributes']=_0x6553aa['attributes'][_0x9def('0x3c')]?_0x6553aa[_0x9def('0x3a')]:_0x169960['model'];if(_0x2f7d51[_0x9def('0x37')][_0x9def('0x43')]){_0x6553aa['include']=[{'all':!![]}];}_0x6553aa=_['merge']({},_0x6553aa,_0x2f7d51[_0x9def('0x4b')]);return db[_0x9def('0x32')][_0x9def('0x4c')](_0x6553aa)[_0x9def('0x2c')](handleEntityNotFound(_0x1923e5,null))[_0x9def('0x2c')](respondWithResult(_0x1923e5,null))[_0x9def('0x47')](handleError(_0x1923e5,null));};exports[_0x9def('0x4d')]=function(_0x34cbfe,_0x283525){return db[_0x9def('0x32')][_0x9def('0x4d')](_0x34cbfe['body'],{})[_0x9def('0x2c')](respondWithResult(_0x283525,0xc9))[_0x9def('0x47')](handleError(_0x283525,null));};exports[_0x9def('0x4e')]=function(_0x539eba,_0x570797){var _0x3f8609={'where':{'id':_0x539eba[_0x9def('0x49')]['id']}},_0x191c05={};_0x191c05[_0x9def('0x35')]=_['keys'](db['UserProfile'][_0x9def('0x4a')]);_0x3f8609[_0x9def('0x3a')]=_[_0x9def('0x39')](_0x191c05[_0x9def('0x35')],qs['fields'](_0x539eba[_0x9def('0x37')][_0x9def('0x3b')]));_0x3f8609[_0x9def('0x3a')]=_0x3f8609[_0x9def('0x3a')][_0x9def('0x3c')]?_0x3f8609[_0x9def('0x3a')]:_0x191c05['model'];if(_0x539eba[_0x9def('0x37')][_0x9def('0x43')]){_0x3f8609[_0x9def('0x44')]=[{'all':!![]}];}_0x3f8609=_['merge']({},_0x3f8609,_0x539eba[_0x9def('0x4b')]);return db['UserProfile'][_0x9def('0x4c')](_0x3f8609)['then'](handleEntityNotFound(_0x570797,null))[_0x9def('0x2c')](function(_0x6f9e8b){if(_0x6f9e8b){var _0x388f52=_0x6f9e8b[_0x9def('0x4f')]({'plain':!![]});_0x388f52=qs[_0x9def('0x50')](_0x388f52,['id',_0x9def('0x51'),_0x9def('0x52'),_0x9def('0x53')]);_0x539eba[_0x9def('0x54')]=_[_0x9def('0x50')](_0x539eba['body'],['id',_0x9def('0x51'),_0x9def('0x52')]);return db[_0x9def('0x55')][_0x9def('0x56')](function(_0x2658c3){return db[_0x9def('0x32')][_0x9def('0x4d')](_['merge'](_0x388f52,_0x539eba[_0x9def('0x54')]),{'include':_0x539eba[_0x9def('0x37')][_0x9def('0x43')]?[{'all':!![]}]:undefined,'transaction':_0x2658c3})[_0x9def('0x2c')](function(_0xf8f6e6){var _0x272432=_0xf8f6e6[_0x9def('0x4f')]({'plain':!![]});return db['UserProfileSection'][_0x9def('0x45')]({'where':{'userProfileId':_0x539eba['params']['id']},'raw':!![]})[_0x9def('0x2c')](function(_0x3fc837){if(_0x3fc837){return BPromise[_0x9def('0x57')](_0x3fc837,function(_0xa976da){return new BPromise(function(_0x59ae3e,_0x2fe050){if(_0xa976da['autoAssociation']===null||_0xa976da[_0x9def('0x58')]===0x1)_0x59ae3e(null);return db[_0x9def('0x59')]['findAll']({'where':{'sectionId':_0xa976da['id']},'raw':!![]})[_0x9def('0x2c')](function(_0x4f9f24){var _0x261ade=_[_0x9def('0x31')](_0x4f9f24,function(_0x1f2bcd){return qs[_0x9def('0x50')](_0x1f2bcd,['id',_0x9def('0x51'),'updatedAt',_0x9def('0x5a')]);});_0x59ae3e(_0x261ade);})[_0x9def('0x47')](function(_0x3cb8ee){_0x2fe050(_0x3cb8ee);});})[_0x9def('0x2c')](function(_0x102f66){var _0x2463c4=qs[_0x9def('0x50')](_0xa976da,['id',_0x9def('0x51'),_0x9def('0x52')]);_0x2463c4[_0x9def('0x5b')]=_0x272432['id'];if(_0x102f66)_0x2463c4[_0x9def('0x5c')]=_0x102f66;return _0x2463c4;})[_0x9def('0x2c')](function(_0x222e90){return db[_0x9def('0x5d')][_0x9def('0x4d')](_0x222e90,{'include':[{'model':db[_0x9def('0x59')],'as':'Resources'}],'raw':!![],'transaction':_0x2658c3});});})[_0x9def('0x2c')](function(){return _0x272432;});}});});});}})[_0x9def('0x2c')](respondWithResult(_0x570797,0xc9))[_0x9def('0x47')](handleError(_0x570797,null));};exports[_0x9def('0x5e')]=function(_0x1dcb7d,_0x1fa3e1){if(_0x1dcb7d[_0x9def('0x54')]['id']){delete _0x1dcb7d[_0x9def('0x54')]['id'];}return db[_0x9def('0x32')][_0x9def('0x4c')]({'where':{'id':_0x1dcb7d[_0x9def('0x49')]['id']}})[_0x9def('0x2c')](handleEntityNotFound(_0x1fa3e1,null))[_0x9def('0x2c')](saveUpdates(_0x1dcb7d[_0x9def('0x54')],null))[_0x9def('0x2c')](respondWithResult(_0x1fa3e1,null))[_0x9def('0x47')](handleError(_0x1fa3e1,null));};exports[_0x9def('0x2d')]=function(_0x29370d,_0x56ab4a){return db[_0x9def('0x32')][_0x9def('0x4c')]({'where':{'id':_0x29370d[_0x9def('0x49')]['id']}})[_0x9def('0x2c')](handleEntityNotFound(_0x56ab4a,null))[_0x9def('0x2c')](removeEntity(_0x56ab4a,null))[_0x9def('0x47')](handleError(_0x56ab4a,null));};exports['describe']=function(_0x4cc439,_0x4f5e17){return db['UserProfile'][_0x9def('0x5f')]()[_0x9def('0x2c')](respondWithResult(_0x4f5e17,null))[_0x9def('0x47')](handleError(_0x4f5e17,null));};exports['addSections']=function(_0x12ea1d,_0x1c3750){var _0x5efa12=_0x12ea1d[_0x9def('0x54')];return db[_0x9def('0x32')]['find']({'where':{'id':_0x12ea1d['params']['id']}})['then'](handleEntityNotFound(_0x1c3750,null))[_0x9def('0x2c')](function(_0x417b02){if(_0x417b02){return db[_0x9def('0x55')][_0x9def('0x56')](function(_0x1ff349){return db['UserProfileSection']['destroy']({'where':{'userProfileId':_0x12ea1d[_0x9def('0x49')]['id'],'sectionId':_[_0x9def('0x31')](_0x5efa12,function(_0x1f939f){return _0x1f939f[_0x9def('0x5a')];})},'transaction':_0x1ff349})[_0x9def('0x2c')](function(){var _0x428bf0=_[_0x9def('0x31')](_0x5efa12,function(_0x5bebf3){_0x5bebf3[_0x9def('0x5b')]=_0x12ea1d['params']['id'];return _0x5bebf3;});var _0x187dca=[];return BPromise['each'](_0x428bf0,function(_0x5e95d5){return db[_0x9def('0x5d')][_0x9def('0x4d')](_0x5e95d5,{'include':[{'model':db[_0x9def('0x59')],'as':_0x9def('0x5c')}],'raw':!![],'transaction':_0x1ff349})[_0x9def('0x2c')](function(_0x6853f2){_0x187dca[_0x9def('0x60')](_0x6853f2[_0x9def('0x4f')]({'plain':!![]}));});})[_0x9def('0x2c')](function(){return _0x187dca;});});});}})['then'](function(_0x44f02d){return _0x44f02d;})['then'](respondWithResult(_0x1c3750,null))[_0x9def('0x47')](handleError(_0x1c3750,null));};exports[_0x9def('0x61')]=function(_0x4632a4,_0x4d7259){var _0x4a3421;return db[_0x9def('0x32')]['find']({'where':{'id':_0x4632a4[_0x9def('0x49')]['id']},'attributes':['id',_0x9def('0x2f')]})['then'](handleEntityNotFound(_0x4d7259,null))[_0x9def('0x2c')](function(_0x185147){if(_0x185147){_0x4a3421=_0x185147;return db[_0x9def('0x5d')][_0x9def('0x2d')]({'where':{'userProfileId':_0x4632a4[_0x9def('0x49')]['id'],'sectionId':_0x4632a4[_0x9def('0x37')][_0x9def('0x62')]}});}})[_0x9def('0x2c')](function(){return _0x4a3421;})['then'](respondWithStatusCode(_0x4d7259,null))[_0x9def('0x47')](handleError(_0x4d7259,null));};exports[_0x9def('0x63')]=function(_0x116bd0,_0x18612f){var _0x2be68a=[];var _0x5107d7=[];return db[_0x9def('0x5d')]['findAll']({'where':{'userProfileId':_0x116bd0['params']['id']},'raw':!![]})['then'](function(_0x42be46){_0x2be68a=_[_0x9def('0x41')](_0x42be46,function(_0x49e1b1){return _0x49e1b1[_0x9def('0x64')]===0x1||_[_0x9def('0x65')]([0x3eb,0x709],_0x49e1b1[_0x9def('0x5a')]);});if(!_['isEmpty'](_0x2be68a)){return _[_0x9def('0x31')](_0x2be68a,function(_0x18f98d){return _0x18f98d[_0x9def('0x5a')];});}else{return;}})[_0x9def('0x2c')](function(_0x984e4e){if(_0x984e4e)_0x5107d7=_0x984e4e;if(_[_0x9def('0x65')](_0x5107d7,0x64)){var _0x2666f3=_[_0x9def('0x4c')](_0x2be68a,{'sectionId':0x64});return hasDefaultDashboard(_0x2666f3)[_0x9def('0x2c')](function(_0x28428b){return _[_0x9def('0x31')](_0x2be68a,function(_0x40e368){if(_0x40e368['sectionId']===0x64){_0x40e368[_0x9def('0x66')]=_0x28428b;}return _0x40e368;});});}else{return;}})[_0x9def('0x2c')](function(_0xd9a3ae){if(_0xd9a3ae)_0x2be68a=_0xd9a3ae;if(_[_0x9def('0x65')](_0x5107d7,0x3eb)){var _0x2831bc=_[_0x9def('0x4c')](_0x2be68a,{'sectionId':0x3eb});return getCustomDashboards(_0x2831bc)[_0x9def('0x2c')](function(_0x5a979){return _[_0x9def('0x31')](_0x2be68a,function(_0x4ff782){if(_0x2831bc['enabled']){if(_0x4ff782[_0x9def('0x5a')]===0x3eb){_0x4ff782[_0x9def('0x66')]=_0x5a979;}}else{if(_0x4ff782[_0x9def('0x5a')]===0x64){_0x4ff782[_0x9def('0x66')]=_0x5a979;}}return _0x4ff782;});});}else{return;}})[_0x9def('0x2c')](function(_0x32acb0){if(_0x32acb0)_0x2be68a=_0x32acb0;if(_['includes'](_0x5107d7,0x709)){var _0x926ad2=_['find'](_0x2be68a,{'sectionId':0x709});return getPlugins(_0x926ad2)[_0x9def('0x2c')](function(_0x55e326){if(_0x926ad2[_0x9def('0x64')]){return _['map'](_0x2be68a,function(_0x4eb177){if(_0x4eb177[_0x9def('0x5a')]===0x709){_0x4eb177['subsections']=_0x55e326;}return _0x4eb177;});}else{var _0x42ee10={'sectionId':0x76c,'enabled':0x1,'subsections':_0x55e326};var _0xdfe388=_[_0x9def('0x31')](_0x2be68a);_0xdfe388[_0x9def('0x60')](_0x42ee10);return _0xdfe388;}});}else{return;}})[_0x9def('0x2c')](function(_0x486aaf){if(_0x486aaf)_0x2be68a=_0x486aaf;return _[_0x9def('0x41')](_0x2be68a,[_0x9def('0x64'),0x1]);})[_0x9def('0x2c')](respondWithResult(_0x18612f,null))[_0x9def('0x47')](handleError(_0x18612f,null));};function hasDefaultDashboard(_0x4ba0bb){var _0x28efa2=[0x65];return new BPromise(function(_0xc653b3,_0x5a1ce6){try{if(_0x4ba0bb[_0x9def('0x58')]){_0xc653b3(_0x28efa2);}else{return db[_0x9def('0x59')][_0x9def('0x67')]({'where':{'sectionId':_0x4ba0bb['id']},'raw':!![]})[_0x9def('0x2c')](function(_0x4d6fc1){_0x4d6fc1?_0xc653b3(_0x28efa2):_0xc653b3();});}}catch(_0x477c5d){_0x5a1ce6(_0x477c5d);}});}function getCustomDashboards(_0x420337){var _0x4d7188=[];return new BPromise(function(_0x26d41b,_0x35df9f){try{if(_0x420337['autoAssociation']){return db[_0x9def('0x68')]['findAll']({'raw':!![]})[_0x9def('0x2c')](function(_0x528b55){_0x528b55['forEach'](function(_0x2274bf){_0x4d7188['push'](_0x2274bf['id']+0x1869f);});_0x26d41b(_0x4d7188);});}else{return db[_0x9def('0x59')][_0x9def('0x45')]({'where':{'sectionId':_0x420337['id']},'raw':!![]})[_0x9def('0x2c')](function(_0x470e32){_0x470e32[_0x9def('0x69')](function(_0x4df52b){_0x4d7188[_0x9def('0x60')](_0x4df52b['resourceId']+0x1869f);});_0x26d41b(_0x4d7188);});}}catch(_0xd097a4){_0x35df9f(_0xd097a4);}});}function getPlugins(_0x399cb8){var _0x4952c5=[];return new BPromise(function(_0x240e43,_0x235ba6){try{if(_0x399cb8[_0x9def('0x58')]){return db[_0x9def('0x6a')][_0x9def('0x45')]({'raw':!![]})[_0x9def('0x2c')](function(_0x2d7302){_0x2d7302[_0x9def('0x69')](function(_0xd0d043){_0x4952c5[_0x9def('0x60')](_0xd0d043['id']+0x15b38);});_0x240e43(_0x4952c5);});}else{return db['UserProfileResource'][_0x9def('0x45')]({'where':{'sectionId':_0x399cb8['id']},'raw':!![]})['then'](function(_0x491df9){_0x491df9[_0x9def('0x69')](function(_0x551743){_0x4952c5[_0x9def('0x60')](_0x551743[_0x9def('0x6b')]+0x15b38);});_0x240e43(_0x4952c5);});}}catch(_0x191617){_0x235ba6(_0x191617);}});}exports[_0x9def('0x6c')]=function(_0x187b14,_0x38b44d){return db['UserProfile'][_0x9def('0x4c')]({'where':{'id':_0x187b14['params']['id']}})[_0x9def('0x2c')](handleEntityNotFound(_0x38b44d,null))[_0x9def('0x2c')](function(_0x3e5ffe){if(_0x3e5ffe){return db['sequelize']['transaction'](function(_0x13983f){return db['UserProfileSection'][_0x9def('0x45')]({'where':{'userProfileId':_0x187b14[_0x9def('0x49')]['id']},'attributes':['id'],'raw':!![]})[_0x9def('0x2c')](function(_0x4e2555){if(_0x4e2555){return db[_0x9def('0x5d')][_0x9def('0x2d')]({'where':{'userProfileId':_0x187b14['params']['id'],'id':_[_0x9def('0x31')](_0x4e2555,function(_0x36c832){return _0x36c832['id'];})},'transaction':_0x13983f});}})[_0x9def('0x2c')](function(_0x40a6ed){var _0x1edb5f=_['map'](_0x187b14[_0x9def('0x54')],function(_0x33a23c){_0x33a23c[_0x9def('0x5b')]=_0x187b14[_0x9def('0x49')]['id'];return _0x33a23c;});return db[_0x9def('0x5d')][_0x9def('0x6d')](_0x1edb5f,{'raw':!![],'transaction':_0x13983f});})[_0x9def('0x2c')](function(_0x10ec58){var _0x235705=_['filter'](_[_0x9def('0x31')](_0x10ec58,function(_0x362990){return _0x362990['get']({'plain':!![]});}),{'includeAll':![]});if(_0x235705){return db[_0x9def('0x5d')]['findAll']({'where':{'userProfileId':_0x187b14[_0x9def('0x49')]['id'],'sectionId':_[_0x9def('0x31')](_0x235705,function(_0x575980){return _0x575980[_0x9def('0x5a')];})},'attributes':['id',_0x9def('0x5a')],'raw':!![]})[_0x9def('0x2c')](function(_0x175234){var _0x4fe9c8=_[_0x9def('0x31')](_0x187b14[_0x9def('0x54')],function(_0x231911){_0x231911[_0x9def('0x5b')]=_0x187b14[_0x9def('0x49')]['id'];return _0x231911;});return db['UserProfileResource'][_0x9def('0x6d')](_0x4fe9c8,{'raw':!![],'transaction':_0x13983f});});}})[_0x9def('0x47')](handleError(_0x38b44d,null));});}})[_0x9def('0x2c')](function(_0x182bcf){var _0x4ed546=_[_0x9def('0x31')](_0x182bcf,function(_0x26debe){return _0x26debe[_0x9def('0x4f')]({'plain':!![]});});})['then'](respondWithResult(_0x38b44d,null))[_0x9def('0x47')](handleError(_0x38b44d,null));};exports[_0x9def('0x6e')]=function(_0x10c250,_0x12fa2a,_0xb55da8){return db[_0x9def('0x32')]['find']({'where':{'id':_0x10c250[_0x9def('0x49')]['id']}})[_0x9def('0x2c')](handleEntityNotFound(_0x12fa2a,null))[_0x9def('0x2c')](function(_0x3ef147){if(_0x3ef147){return _0x3ef147[_0x9def('0x6e')](_0x10c250[_0x9def('0x37')][_0x9def('0x62')]);}})[_0x9def('0x2c')](respondWithStatusCode(_0x12fa2a,null))[_0x9def('0x47')](handleError(_0x12fa2a,null));};exports[_0x9def('0x6f')]=function(_0x397446,_0x590e97){var _0x34cff8={};if(!_0x397446[_0x9def('0x37')][_0x9def('0x70')])throw new Error(_0x9def('0x71'));if(!_0x397446[_0x9def('0x37')][_0x9def('0x72')]('nolimit')){_0x34cff8[_0x9def('0x26')]=qs[_0x9def('0x26')](_0x397446['query'][_0x9def('0x26')]);_0x34cff8[_0x9def('0x24')]=qs[_0x9def('0x24')](_0x397446[_0x9def('0x37')][_0x9def('0x24')]);}return db['UserProfile'][_0x9def('0x4c')]({'where':{'id':_0x397446['params']['id']}})[_0x9def('0x2c')](function(_0x33e32f){if(!_0x33e32f)throw new Error(_0x9def('0x73')+_0x397446[_0x9def('0x49')]['id']);return db[_0x9def('0x32')][_0x9def('0x6f')](_0x397446);})[_0x9def('0x2c')](respondWithFilteredResult(_0x590e97,_0x34cff8))[_0x9def('0x47')](handleError(_0x590e97,null));}; \ No newline at end of file +var _0x1a85=['model','map','query','keys','filters','attributes','fields','nolimit','sort','pick','filter','where','merge','options','includeAll','include','findAll','catch','show','params','intersection','length','find','create','clone','get','omit','crudPermissions','body','createdAt','sequelize','transaction','autoAssociation','UserProfileResource','updatedAt','sectionId','userProfileId','Resources','describe','addSections','UserProfileSection','push','ids','getSections','enabled','includes','subsections','findOne','Dashboard','forEach','resourceId','Plugin','addResources','bulkCreate','section','hasOwnProperty','No\x20User\x20Profile\x20found\x20for\x20id\x20','getResources','zip-dir','fast-json-patch','request-promise','mustache','util','path','to-csv','fs-extra','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./userProfile.socket','register','status','end','json','offset','undefined','limit','count','Content-Range','update','then','destroy','sendStatus','error','stack','name','index','UserProfile','rawAttributes','type'];(function(_0xb1814b,_0xc565e2){var _0x340bb1=function(_0x243235){while(--_0x243235){_0xb1814b['push'](_0xb1814b['shift']());}};_0x340bb1(++_0xc565e2);}(_0x1a85,0x178));var _0x51a8=function(_0x11ee99,_0xa743ed){_0x11ee99=_0x11ee99-0x0;var _0x469072=_0x1a85[_0x11ee99];return _0x469072;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x51a8('0x0'));var jsonpatch=require(_0x51a8('0x1'));var rp=require(_0x51a8('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x51a8('0x3'));var util=require(_0x51a8('0x4'));var path=require(_0x51a8('0x5'));var sox=require('sox');var csv=require(_0x51a8('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x51a8('0x7'));var _=require('lodash');var squel=require(_0x51a8('0x8'));var crypto=require(_0x51a8('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x51a8('0xa'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x51a8('0xb'));var Redis=require(_0x51a8('0xc'));var authService=require(_0x51a8('0xd'));var qs=require(_0x51a8('0xe'));var as=require(_0x51a8('0xf'));var hardwareService=require(_0x51a8('0x10'));var logger=require(_0x51a8('0x11'))(_0x51a8('0x12'));var utils=require(_0x51a8('0x13'));var config=require(_0x51a8('0x14'));var licenseUtil=require(_0x51a8('0x15'));var db=require(_0x51a8('0x16'))['db'];config[_0x51a8('0x17')]=_[_0x51a8('0x18')](config[_0x51a8('0x17')],{'host':_0x51a8('0x19'),'port':0x18eb});var socket=require(_0x51a8('0x1a'))(new Redis(config['redis']));require(_0x51a8('0x1b'))[_0x51a8('0x1c')](socket);function respondWithStatusCode(_0xaec066,_0x50d992){_0x50d992=_0x50d992||0xcc;return function(_0xf4eb6e){if(_0xf4eb6e){return _0xaec066['sendStatus'](_0x50d992);}return _0xaec066[_0x51a8('0x1d')](_0x50d992)[_0x51a8('0x1e')]();};}function respondWithResult(_0x39cd45,_0x2b0521){_0x2b0521=_0x2b0521||0xc8;return function(_0x3fbd02){if(_0x3fbd02){return _0x39cd45[_0x51a8('0x1d')](_0x2b0521)[_0x51a8('0x1f')](_0x3fbd02);}};}function respondWithFilteredResult(_0x516abc,_0x1c2f25){return function(_0x45a433){if(_0x45a433){var _0xd52230=typeof _0x1c2f25[_0x51a8('0x20')]===_0x51a8('0x21')&&typeof _0x1c2f25[_0x51a8('0x22')]==='undefined';var _0x1df8c2=_0x45a433[_0x51a8('0x23')];var _0x2217ce=_0xd52230?0x0:_0x1c2f25[_0x51a8('0x20')];var _0x2a4c4c=_0xd52230?_0x45a433[_0x51a8('0x23')]:_0x1c2f25[_0x51a8('0x20')]+_0x1c2f25[_0x51a8('0x22')];var _0x5ac1c0;if(_0x2a4c4c>=_0x1df8c2){_0x2a4c4c=_0x1df8c2;_0x5ac1c0=0xc8;}else{_0x5ac1c0=0xce;}_0x516abc[_0x51a8('0x1d')](_0x5ac1c0);return _0x516abc['set'](_0x51a8('0x24'),_0x2217ce+'-'+_0x2a4c4c+'/'+_0x1df8c2)[_0x51a8('0x1f')](_0x45a433);}return null;};}function patchUpdates(_0x8bda40){return function(_0x3759d6){try{jsonpatch['apply'](_0x3759d6,_0x8bda40,!![]);}catch(_0xae3588){return BPromise['reject'](_0xae3588);}return _0x3759d6['save']();};}function saveUpdates(_0x23d26a,_0x52e503){return function(_0x384d25){if(_0x384d25){return _0x384d25[_0x51a8('0x25')](_0x23d26a)[_0x51a8('0x26')](function(_0x18e2f3){return _0x18e2f3;});}return null;};}function removeEntity(_0x157554,_0x2f2f05){return function(_0x291ed6){if(_0x291ed6){return _0x291ed6[_0x51a8('0x27')]()['then'](function(){_0x157554[_0x51a8('0x1d')](0xcc)[_0x51a8('0x1e')]();});}};}function handleEntityNotFound(_0xca5746,_0x3da187){return function(_0x1c150d){if(!_0x1c150d){_0xca5746[_0x51a8('0x28')](0x194);}return _0x1c150d;};}function handleError(_0x1a886f,_0x2742f5){_0x2742f5=_0x2742f5||0x1f4;return function(_0xec08ae){logger[_0x51a8('0x29')](_0xec08ae[_0x51a8('0x2a')]);if(_0xec08ae[_0x51a8('0x2b')]){delete _0xec08ae['name'];}_0x1a886f[_0x51a8('0x1d')](_0x2742f5)['send'](_0xec08ae);};}exports[_0x51a8('0x2c')]=function(_0x3bc19a,_0x143f46){var _0x41df56={},_0x2136b4={},_0x4ea271={'count':0x0,'rows':[]};var _0x10c19b=_['map'](db[_0x51a8('0x2d')][_0x51a8('0x2e')],function(_0x253a59){return{'name':_0x253a59['fieldName'],'type':_0x253a59[_0x51a8('0x2f')]['key']};});_0x2136b4[_0x51a8('0x30')]=_[_0x51a8('0x31')](_0x10c19b,_0x51a8('0x2b'));_0x2136b4[_0x51a8('0x32')]=_[_0x51a8('0x33')](_0x3bc19a['query']);_0x2136b4[_0x51a8('0x34')]=_['intersection'](_0x2136b4[_0x51a8('0x30')],_0x2136b4[_0x51a8('0x32')]);_0x41df56[_0x51a8('0x35')]=_['intersection'](_0x2136b4[_0x51a8('0x30')],qs[_0x51a8('0x36')](_0x3bc19a[_0x51a8('0x32')][_0x51a8('0x36')]));_0x41df56[_0x51a8('0x35')]=_0x41df56['attributes']['length']?_0x41df56['attributes']:_0x2136b4[_0x51a8('0x30')];if(!_0x3bc19a[_0x51a8('0x32')]['hasOwnProperty'](_0x51a8('0x37'))){_0x41df56['limit']=qs[_0x51a8('0x22')](_0x3bc19a[_0x51a8('0x32')][_0x51a8('0x22')]);_0x41df56[_0x51a8('0x20')]=qs[_0x51a8('0x20')](_0x3bc19a[_0x51a8('0x32')]['offset']);}_0x41df56['order']=qs[_0x51a8('0x38')](_0x3bc19a['query']['sort']);_0x41df56['where']=qs[_0x51a8('0x34')](_[_0x51a8('0x39')](_0x3bc19a[_0x51a8('0x32')],_0x2136b4['filters']),_0x10c19b);if(_0x3bc19a[_0x51a8('0x32')][_0x51a8('0x3a')]){_0x41df56[_0x51a8('0x3b')]=_[_0x51a8('0x3c')](_0x41df56['where'],{'$or':_[_0x51a8('0x31')](_0x10c19b,function(_0xe6a86a){if(_0xe6a86a[_0x51a8('0x2f')]!=='VIRTUAL'){var _0xb96200={};_0xb96200[_0xe6a86a['name']]={'$like':'%'+_0x3bc19a[_0x51a8('0x32')][_0x51a8('0x3a')]+'%'};return _0xb96200;}})});}_0x41df56=_[_0x51a8('0x3c')]({},_0x41df56,_0x3bc19a[_0x51a8('0x3d')]);var _0x5c44a9={'where':_0x41df56[_0x51a8('0x3b')]};return db[_0x51a8('0x2d')][_0x51a8('0x23')](_0x5c44a9)[_0x51a8('0x26')](function(_0xa33fc){_0x4ea271[_0x51a8('0x23')]=_0xa33fc;if(_0x3bc19a[_0x51a8('0x32')][_0x51a8('0x3e')]){_0x41df56[_0x51a8('0x3f')]=[{'all':!![]}];}return db['UserProfile'][_0x51a8('0x40')](_0x41df56);})[_0x51a8('0x26')](function(_0x4c7c67){_0x4ea271['rows']=_0x4c7c67;return _0x4ea271;})[_0x51a8('0x26')](respondWithFilteredResult(_0x143f46,_0x41df56))[_0x51a8('0x41')](handleError(_0x143f46,null));};exports[_0x51a8('0x42')]=function(_0x27b8e5,_0x311574){var _0x157a51={'raw':![],'where':{'id':_0x27b8e5[_0x51a8('0x43')]['id']}},_0x28f5b3={};_0x28f5b3[_0x51a8('0x30')]=_[_0x51a8('0x33')](db['UserProfile'][_0x51a8('0x2e')]);_0x28f5b3[_0x51a8('0x32')]=_[_0x51a8('0x33')](_0x27b8e5[_0x51a8('0x32')]);_0x28f5b3[_0x51a8('0x34')]=_[_0x51a8('0x44')](_0x28f5b3['model'],_0x28f5b3[_0x51a8('0x32')]);_0x157a51['attributes']=_[_0x51a8('0x44')](_0x28f5b3[_0x51a8('0x30')],qs[_0x51a8('0x36')](_0x27b8e5[_0x51a8('0x32')][_0x51a8('0x36')]));_0x157a51['attributes']=_0x157a51['attributes'][_0x51a8('0x45')]?_0x157a51[_0x51a8('0x35')]:_0x28f5b3[_0x51a8('0x30')];if(_0x27b8e5[_0x51a8('0x32')][_0x51a8('0x3e')]){_0x157a51['include']=[{'all':!![]}];}_0x157a51=_['merge']({},_0x157a51,_0x27b8e5[_0x51a8('0x3d')]);return db[_0x51a8('0x2d')][_0x51a8('0x46')](_0x157a51)[_0x51a8('0x26')](handleEntityNotFound(_0x311574,null))[_0x51a8('0x26')](respondWithResult(_0x311574,null))[_0x51a8('0x41')](handleError(_0x311574,null));};exports[_0x51a8('0x47')]=function(_0x1103a3,_0x301578){return db['UserProfile']['create'](_0x1103a3['body'],{})[_0x51a8('0x26')](respondWithResult(_0x301578,0xc9))[_0x51a8('0x41')](handleError(_0x301578,null));};exports[_0x51a8('0x48')]=function(_0x5259f3,_0x3bd492){var _0x3d6cd7={'where':{'id':_0x5259f3[_0x51a8('0x43')]['id']}},_0x5ab31a={};_0x5ab31a['model']=_['keys'](db[_0x51a8('0x2d')][_0x51a8('0x2e')]);_0x3d6cd7[_0x51a8('0x35')]=_['intersection'](_0x5ab31a['model'],qs[_0x51a8('0x36')](_0x5259f3['query'][_0x51a8('0x36')]));_0x3d6cd7[_0x51a8('0x35')]=_0x3d6cd7[_0x51a8('0x35')][_0x51a8('0x45')]?_0x3d6cd7[_0x51a8('0x35')]:_0x5ab31a[_0x51a8('0x30')];if(_0x5259f3[_0x51a8('0x32')][_0x51a8('0x3e')]){_0x3d6cd7[_0x51a8('0x3f')]=[{'all':!![]}];}_0x3d6cd7=_['merge']({},_0x3d6cd7,_0x5259f3[_0x51a8('0x3d')]);return db[_0x51a8('0x2d')][_0x51a8('0x46')](_0x3d6cd7)[_0x51a8('0x26')](handleEntityNotFound(_0x3bd492,null))['then'](function(_0x13b7ba){if(_0x13b7ba){var _0x5208d8=_0x13b7ba[_0x51a8('0x49')]({'plain':!![]});_0x5208d8=qs[_0x51a8('0x4a')](_0x5208d8,['id','createdAt','updatedAt',_0x51a8('0x4b')]);_0x5259f3[_0x51a8('0x4c')]=_[_0x51a8('0x4a')](_0x5259f3[_0x51a8('0x4c')],['id',_0x51a8('0x4d'),'updatedAt']);return db[_0x51a8('0x4e')][_0x51a8('0x4f')](function(_0x7a9dc){return db[_0x51a8('0x2d')][_0x51a8('0x47')](_['merge'](_0x5208d8,_0x5259f3[_0x51a8('0x4c')]),{'include':_0x5259f3[_0x51a8('0x32')][_0x51a8('0x3e')]?[{'all':!![]}]:undefined,'transaction':_0x7a9dc})[_0x51a8('0x26')](function(_0x62966a){var _0x352af8=_0x62966a['get']({'plain':!![]});return db['UserProfileSection']['findAll']({'where':{'userProfileId':_0x5259f3['params']['id']},'raw':!![]})[_0x51a8('0x26')](function(_0x1df9cc){if(_0x1df9cc){return BPromise['each'](_0x1df9cc,function(_0x7ac0ae){return new BPromise(function(_0x56d3d7,_0x41cc00){if(_0x7ac0ae['autoAssociation']===null||_0x7ac0ae[_0x51a8('0x50')]===0x1)_0x56d3d7(null);return db[_0x51a8('0x51')]['findAll']({'where':{'sectionId':_0x7ac0ae['id']},'raw':!![]})['then'](function(_0x5eb540){var _0x44d67a=_[_0x51a8('0x31')](_0x5eb540,function(_0x283c8f){return qs[_0x51a8('0x4a')](_0x283c8f,['id',_0x51a8('0x4d'),_0x51a8('0x52'),_0x51a8('0x53')]);});_0x56d3d7(_0x44d67a);})[_0x51a8('0x41')](function(_0x494e11){_0x41cc00(_0x494e11);});})[_0x51a8('0x26')](function(_0x31efcb){var _0x4a0489=qs[_0x51a8('0x4a')](_0x7ac0ae,['id',_0x51a8('0x4d'),_0x51a8('0x52')]);_0x4a0489[_0x51a8('0x54')]=_0x352af8['id'];if(_0x31efcb)_0x4a0489[_0x51a8('0x55')]=_0x31efcb;return _0x4a0489;})[_0x51a8('0x26')](function(_0x4f6d5f){return db['UserProfileSection'][_0x51a8('0x47')](_0x4f6d5f,{'include':[{'model':db['UserProfileResource'],'as':'Resources'}],'raw':!![],'transaction':_0x7a9dc});});})['then'](function(){return _0x352af8;});}});});});}})['then'](respondWithResult(_0x3bd492,0xc9))['catch'](handleError(_0x3bd492,null));};exports[_0x51a8('0x25')]=function(_0x529b2f,_0x1477af){if(_0x529b2f[_0x51a8('0x4c')]['id']){delete _0x529b2f[_0x51a8('0x4c')]['id'];}return db[_0x51a8('0x2d')][_0x51a8('0x46')]({'where':{'id':_0x529b2f[_0x51a8('0x43')]['id']}})[_0x51a8('0x26')](handleEntityNotFound(_0x1477af,null))[_0x51a8('0x26')](saveUpdates(_0x529b2f[_0x51a8('0x4c')],null))[_0x51a8('0x26')](respondWithResult(_0x1477af,null))['catch'](handleError(_0x1477af,null));};exports[_0x51a8('0x27')]=function(_0x220886,_0x31ee59){return db['UserProfile']['find']({'where':{'id':_0x220886['params']['id']}})[_0x51a8('0x26')](handleEntityNotFound(_0x31ee59,null))[_0x51a8('0x26')](removeEntity(_0x31ee59,null))[_0x51a8('0x41')](handleError(_0x31ee59,null));};exports[_0x51a8('0x56')]=function(_0x2efb36,_0x1462b4){return db[_0x51a8('0x2d')][_0x51a8('0x56')]()[_0x51a8('0x26')](respondWithResult(_0x1462b4,null))[_0x51a8('0x41')](handleError(_0x1462b4,null));};exports[_0x51a8('0x57')]=function(_0x3ba418,_0x934ea9){var _0x531995=_0x3ba418[_0x51a8('0x4c')];return db[_0x51a8('0x2d')]['find']({'where':{'id':_0x3ba418[_0x51a8('0x43')]['id']}})['then'](handleEntityNotFound(_0x934ea9,null))['then'](function(_0x59c80f){if(_0x59c80f){return db[_0x51a8('0x4e')][_0x51a8('0x4f')](function(_0xb480ec){return db[_0x51a8('0x58')][_0x51a8('0x27')]({'where':{'userProfileId':_0x3ba418[_0x51a8('0x43')]['id'],'sectionId':_[_0x51a8('0x31')](_0x531995,function(_0x5a37c1){return _0x5a37c1['sectionId'];})},'transaction':_0xb480ec})['then'](function(){var _0x44e496=_[_0x51a8('0x31')](_0x531995,function(_0x238074){_0x238074[_0x51a8('0x54')]=_0x3ba418[_0x51a8('0x43')]['id'];return _0x238074;});var _0x4fe3d6=[];return BPromise['each'](_0x44e496,function(_0x254ab5){return db['UserProfileSection'][_0x51a8('0x47')](_0x254ab5,{'include':[{'model':db[_0x51a8('0x51')],'as':_0x51a8('0x55')}],'raw':!![],'transaction':_0xb480ec})[_0x51a8('0x26')](function(_0x149a40){_0x4fe3d6[_0x51a8('0x59')](_0x149a40[_0x51a8('0x49')]({'plain':!![]}));});})[_0x51a8('0x26')](function(){return _0x4fe3d6;});});});}})[_0x51a8('0x26')](function(_0x39fcef){return _0x39fcef;})[_0x51a8('0x26')](respondWithResult(_0x934ea9,null))['catch'](handleError(_0x934ea9,null));};exports['removeSections']=function(_0x21912f,_0xf0c644){var _0x156b0c;return db[_0x51a8('0x2d')]['find']({'where':{'id':_0x21912f[_0x51a8('0x43')]['id']},'attributes':['id','name']})[_0x51a8('0x26')](handleEntityNotFound(_0xf0c644,null))[_0x51a8('0x26')](function(_0xbee86f){if(_0xbee86f){_0x156b0c=_0xbee86f;return db[_0x51a8('0x58')][_0x51a8('0x27')]({'where':{'userProfileId':_0x21912f[_0x51a8('0x43')]['id'],'sectionId':_0x21912f[_0x51a8('0x32')][_0x51a8('0x5a')]}});}})[_0x51a8('0x26')](function(){return _0x156b0c;})['then'](respondWithStatusCode(_0xf0c644,null))[_0x51a8('0x41')](handleError(_0xf0c644,null));};exports[_0x51a8('0x5b')]=function(_0x3e80db,_0x353e90){var _0x4ef0af=[];var _0x529062=[];return db[_0x51a8('0x58')]['findAll']({'where':{'userProfileId':_0x3e80db['params']['id']},'raw':!![]})['then'](function(_0xeb5d67){_0x4ef0af=_['filter'](_0xeb5d67,function(_0x5c7aca){return _0x5c7aca[_0x51a8('0x5c')]===0x1||_[_0x51a8('0x5d')]([0x3eb,0x709],_0x5c7aca[_0x51a8('0x53')]);});if(!_['isEmpty'](_0x4ef0af)){return _[_0x51a8('0x31')](_0x4ef0af,function(_0x252e99){return _0x252e99[_0x51a8('0x53')];});}else{return;}})['then'](function(_0x3ac9c8){if(_0x3ac9c8)_0x529062=_0x3ac9c8;if(_[_0x51a8('0x5d')](_0x529062,0x64)){var _0x24838b=_[_0x51a8('0x46')](_0x4ef0af,{'sectionId':0x64});return hasDefaultDashboard(_0x24838b)[_0x51a8('0x26')](function(_0x30dd7b){return _[_0x51a8('0x31')](_0x4ef0af,function(_0x245f5b){if(_0x245f5b[_0x51a8('0x53')]===0x64){_0x245f5b['subsections']=_0x30dd7b;}return _0x245f5b;});});}else{return;}})[_0x51a8('0x26')](function(_0x3be132){if(_0x3be132)_0x4ef0af=_0x3be132;if(_['includes'](_0x529062,0x3eb)){var _0x26e220=_[_0x51a8('0x46')](_0x4ef0af,{'sectionId':0x3eb});return getCustomDashboards(_0x26e220)['then'](function(_0x44f4b3){return _[_0x51a8('0x31')](_0x4ef0af,function(_0x3fbdf1){if(_0x26e220[_0x51a8('0x5c')]){if(_0x3fbdf1[_0x51a8('0x53')]===0x3eb){_0x3fbdf1['subsections']=_0x44f4b3;}}else{if(_0x3fbdf1[_0x51a8('0x53')]===0x64){_0x3fbdf1[_0x51a8('0x5e')]=_0x44f4b3;}}return _0x3fbdf1;});});}else{return;}})[_0x51a8('0x26')](function(_0x1d587e){if(_0x1d587e)_0x4ef0af=_0x1d587e;if(_['includes'](_0x529062,0x709)){var _0x3db2b8=_[_0x51a8('0x46')](_0x4ef0af,{'sectionId':0x709});return getPlugins(_0x3db2b8)[_0x51a8('0x26')](function(_0x37f253){if(_0x3db2b8[_0x51a8('0x5c')]){return _[_0x51a8('0x31')](_0x4ef0af,function(_0xf718e){if(_0xf718e[_0x51a8('0x53')]===0x709){_0xf718e['subsections']=_0x37f253;}return _0xf718e;});}else{var _0x1d7794={'sectionId':0x76c,'enabled':0x1,'subsections':_0x37f253};var _0x2f6d5e=_['map'](_0x4ef0af);_0x2f6d5e[_0x51a8('0x59')](_0x1d7794);return _0x2f6d5e;}});}else{return;}})[_0x51a8('0x26')](function(_0x58475b){if(_0x58475b)_0x4ef0af=_0x58475b;return _[_0x51a8('0x3a')](_0x4ef0af,['enabled',0x1]);})['then'](respondWithResult(_0x353e90,null))[_0x51a8('0x41')](handleError(_0x353e90,null));};function hasDefaultDashboard(_0xf2325b){var _0x41e0b9=[0x65];return new BPromise(function(_0x4cc06e,_0x585d4e){try{if(_0xf2325b[_0x51a8('0x50')]){_0x4cc06e(_0x41e0b9);}else{return db['UserProfileResource'][_0x51a8('0x5f')]({'where':{'sectionId':_0xf2325b['id']},'raw':!![]})[_0x51a8('0x26')](function(_0x46a32c){_0x46a32c?_0x4cc06e(_0x41e0b9):_0x4cc06e();});}}catch(_0x3b737b){_0x585d4e(_0x3b737b);}});}function getCustomDashboards(_0x34a645){var _0x28acb8=[];return new BPromise(function(_0xa9e5d0,_0x3004a4){try{if(_0x34a645[_0x51a8('0x50')]){return db[_0x51a8('0x60')][_0x51a8('0x40')]({'raw':!![]})[_0x51a8('0x26')](function(_0x1b7381){_0x1b7381[_0x51a8('0x61')](function(_0x4547bd){_0x28acb8['push'](_0x4547bd['id']+0x1869f);});_0xa9e5d0(_0x28acb8);});}else{return db['UserProfileResource'][_0x51a8('0x40')]({'where':{'sectionId':_0x34a645['id']},'raw':!![]})['then'](function(_0x4ea753){_0x4ea753['forEach'](function(_0x3dd98c){_0x28acb8[_0x51a8('0x59')](_0x3dd98c[_0x51a8('0x62')]+0x1869f);});_0xa9e5d0(_0x28acb8);});}}catch(_0x125a28){_0x3004a4(_0x125a28);}});}function getPlugins(_0x4d5f37){var _0x975b8=[];return new BPromise(function(_0x343fec,_0x4fd9ed){try{if(_0x4d5f37[_0x51a8('0x50')]){return db[_0x51a8('0x63')]['findAll']({'raw':!![]})['then'](function(_0x11e388){_0x11e388[_0x51a8('0x61')](function(_0x8587b9){_0x975b8[_0x51a8('0x59')](_0x8587b9['id']+0x15b38);});_0x343fec(_0x975b8);});}else{return db[_0x51a8('0x51')][_0x51a8('0x40')]({'where':{'sectionId':_0x4d5f37['id']},'raw':!![]})['then'](function(_0x13dab3){_0x13dab3[_0x51a8('0x61')](function(_0x181f8b){_0x975b8['push'](_0x181f8b[_0x51a8('0x62')]+0x15b38);});_0x343fec(_0x975b8);});}}catch(_0x3f4649){_0x4fd9ed(_0x3f4649);}});}exports[_0x51a8('0x64')]=function(_0x58a83c,_0x149fa4){return db[_0x51a8('0x2d')]['find']({'where':{'id':_0x58a83c[_0x51a8('0x43')]['id']}})['then'](handleEntityNotFound(_0x149fa4,null))[_0x51a8('0x26')](function(_0x2d4c2b){if(_0x2d4c2b){return db[_0x51a8('0x4e')][_0x51a8('0x4f')](function(_0x41621c){return db[_0x51a8('0x58')][_0x51a8('0x40')]({'where':{'userProfileId':_0x58a83c[_0x51a8('0x43')]['id']},'attributes':['id'],'raw':!![]})['then'](function(_0xde80dc){if(_0xde80dc){return db[_0x51a8('0x58')][_0x51a8('0x27')]({'where':{'userProfileId':_0x58a83c[_0x51a8('0x43')]['id'],'id':_[_0x51a8('0x31')](_0xde80dc,function(_0x5d7a2c){return _0x5d7a2c['id'];})},'transaction':_0x41621c});}})['then'](function(_0xcc722a){var _0x1bf0c9=_[_0x51a8('0x31')](_0x58a83c[_0x51a8('0x4c')],function(_0x342ccf){_0x342ccf['userProfileId']=_0x58a83c[_0x51a8('0x43')]['id'];return _0x342ccf;});return db['UserProfileSection'][_0x51a8('0x65')](_0x1bf0c9,{'raw':!![],'transaction':_0x41621c});})[_0x51a8('0x26')](function(_0x4d03c7){var _0x522cf3=_['filter'](_[_0x51a8('0x31')](_0x4d03c7,function(_0x3cf33c){return _0x3cf33c[_0x51a8('0x49')]({'plain':!![]});}),{'includeAll':![]});if(_0x522cf3){return db[_0x51a8('0x58')][_0x51a8('0x40')]({'where':{'userProfileId':_0x58a83c['params']['id'],'sectionId':_[_0x51a8('0x31')](_0x522cf3,function(_0x123d72){return _0x123d72['sectionId'];})},'attributes':['id',_0x51a8('0x53')],'raw':!![]})[_0x51a8('0x26')](function(_0x54e006){var _0x49b0d2=_[_0x51a8('0x31')](_0x58a83c[_0x51a8('0x4c')],function(_0x268856){_0x268856['userProfileId']=_0x58a83c[_0x51a8('0x43')]['id'];return _0x268856;});return db[_0x51a8('0x51')][_0x51a8('0x65')](_0x49b0d2,{'raw':!![],'transaction':_0x41621c});});}})[_0x51a8('0x41')](handleError(_0x149fa4,null));});}})[_0x51a8('0x26')](function(_0x21f861){var _0x30bf44=_['map'](_0x21f861,function(_0x206fe1){return _0x206fe1[_0x51a8('0x49')]({'plain':!![]});});})[_0x51a8('0x26')](respondWithResult(_0x149fa4,null))[_0x51a8('0x41')](handleError(_0x149fa4,null));};exports['removeResources']=function(_0x49e83c,_0x3d0bd3,_0x21aa81){return db['UserProfile']['find']({'where':{'id':_0x49e83c['params']['id']}})[_0x51a8('0x26')](handleEntityNotFound(_0x3d0bd3,null))['then'](function(_0x47c025){if(_0x47c025){return _0x47c025['removeResources'](_0x49e83c[_0x51a8('0x32')]['ids']);}})[_0x51a8('0x26')](respondWithStatusCode(_0x3d0bd3,null))[_0x51a8('0x41')](handleError(_0x3d0bd3,null));};exports['getResources']=function(_0x5ab3c0,_0x1e2ef4){var _0x5ab6b2={};if(!_0x5ab3c0[_0x51a8('0x32')][_0x51a8('0x66')])throw new Error('Missing\x20section\x20parameter');if(!_0x5ab3c0[_0x51a8('0x32')][_0x51a8('0x67')]('nolimit')){_0x5ab6b2[_0x51a8('0x22')]=qs[_0x51a8('0x22')](_0x5ab3c0[_0x51a8('0x32')]['limit']);_0x5ab6b2[_0x51a8('0x20')]=qs[_0x51a8('0x20')](_0x5ab3c0[_0x51a8('0x32')]['offset']);}return db['UserProfile'][_0x51a8('0x46')]({'where':{'id':_0x5ab3c0[_0x51a8('0x43')]['id']}})[_0x51a8('0x26')](function(_0xabdbd0){if(!_0xabdbd0)throw new Error(_0x51a8('0x68')+_0x5ab3c0[_0x51a8('0x43')]['id']);return db[_0x51a8('0x2d')][_0x51a8('0x69')](_0x5ab3c0);})[_0x51a8('0x26')](respondWithFilteredResult(_0x1e2ef4,_0x5ab6b2))[_0x51a8('0x41')](handleError(_0x1e2ef4,null));}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index 7e9d1ea..5708b3c 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 _0x2da6=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','UserProfile','setMaxListeners','save','update','remove'];(function(_0x432fca,_0xb0b1b5){var _0x3adba4=function(_0x5e3ae4){while(--_0x5e3ae4){_0x432fca['push'](_0x432fca['shift']());}};_0x3adba4(++_0xb0b1b5);}(_0x2da6,0x1dd));var _0x62da=function(_0x165822,_0x4d83f9){_0x165822=_0x165822-0x0;var _0x29600f=_0x2da6[_0x165822];return _0x29600f;};'use strict';var EventEmitter=require(_0x62da('0x0'));var UserProfile=require(_0x62da('0x1'))['db'][_0x62da('0x2')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x62da('0x3')](0x0);var events={'afterCreate':_0x62da('0x4'),'afterUpdate':_0x62da('0x5'),'afterDestroy':_0x62da('0x6')};function emitEvent(_0x3552dc){return function(_0x4c079d,_0x4a8428,_0xe28204){UserProfileEvents[_0x62da('0x7')](_0x3552dc+':'+_0x4c079d['id'],_0x4c079d);UserProfileEvents[_0x62da('0x7')](_0x3552dc,_0x4c079d);_0xe28204(null);};}for(var e in events){if(events[_0x62da('0x8')](e)){var event=events[e];UserProfile[_0x62da('0x9')](e,emitEvent(event));}}module[_0x62da('0xa')]=UserProfileEvents; \ No newline at end of file +var _0xc61d=['exports','events','../../mysqldb','UserProfile','setMaxListeners','save','update','emit','hasOwnProperty','hook'];(function(_0x1e3ef6,_0x4e095b){var _0x15ddd6=function(_0x10e1eb){while(--_0x10e1eb){_0x1e3ef6['push'](_0x1e3ef6['shift']());}};_0x15ddd6(++_0x4e095b);}(_0xc61d,0xfb));var _0xdc61=function(_0x2ba146,_0x3dc146){_0x2ba146=_0x2ba146-0x0;var _0x1dfc89=_0xc61d[_0x2ba146];return _0x1dfc89;};'use strict';var EventEmitter=require(_0xdc61('0x0'));var UserProfile=require(_0xdc61('0x1'))['db'][_0xdc61('0x2')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0xdc61('0x3')](0x0);var events={'afterCreate':_0xdc61('0x4'),'afterUpdate':_0xdc61('0x5'),'afterDestroy':'remove'};function emitEvent(_0x2125a2){return function(_0x237baa,_0x4ebd75,_0x2b94dd){UserProfileEvents[_0xdc61('0x6')](_0x2125a2+':'+_0x237baa['id'],_0x237baa);UserProfileEvents[_0xdc61('0x6')](_0x2125a2,_0x237baa);_0x2b94dd(null);};}for(var e in events){if(events[_0xdc61('0x7')](e)){var event=events[e];UserProfile[_0xdc61('0x8')](e,emitEvent(event));}}module[_0xdc61('0x9')]=UserProfileEvents; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.model.js b/server/api/userProfile/userProfile.model.js index 46cfb6c..4980dc8 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 _0x741c=['length','find','all','ignore','autoAssociation','push','keys','intersection','fields','attributes','nolimit','limit','offset','order','sort','pick','filters','merge','key','foreignKey','forEach','options','includeAll','include','reportType','default','DefaultReports','custom','CustomReports','count','rows','CmContact','color','ThroughTags','tag','openTabs','true','chat','sms','dataValues','fax','mail','openchannel','whatsapp','lodash','./userProfile.attributes','../../components/parsers/qs','squel','exports','filter','field','value','findAll','catch','model','associatedResources','name','then','map','AnalyticExtractedReport','resourceId','toLowerCase','squareprojects','childModel','SquareOdbc','squarerecordings','SquareRecording','parentSections','projectName','projects','JscriptyProject','contacts','Lists','lists','CmList','companies','CmCompany','globalcustomfields','CmCustomField','chatwebsites','faxqueues','FaxQueue','FaxAccount','inboundroutes','outboundroutes','VoiceExtension','contexts','VoiceContext','voicemails','voicerecordings','VoiceRecording','Agents','User','role','Telephones','membername','telephone','VoiceQueues','queue','VoiceQueue','type','QueueCampaigns','outbound','musiconholds','chanspies','VoiceChanSpy','voiceprefixes','VoicePrefix','Campaign','mailqueues','mailaccounts','MailAccount','mailsubstatuses','MailSubstatus','openchannelqueues','OpenchannelQueue','openchannelaccounts','OpenchannelAccount','smsqueues','SmsQueue','smsaccounts','whatsappqueues','WhatsappQueue','WhatsappAccount','Team','queuecampaigns','users','telephones','admin','user','zendeskaccounts','ZendeskAccount','salesforceaccounts','freshdeskaccounts','FreshdeskAccount','sugarcrmaccounts','SugarcrmAccount','DeskAccount','zohoaccounts','ZohoAccount','vtigeraccounts','cannedanswers','CannedAnswer','dispositions','Disposition','customdashboards','intervals','Interval','pauses','Pause','scheduler','Schedule','tags','Tag','templates','Template','trunks','Trunk','variables','extractedreports','Reports','reportId','metrics','AnalyticMetric','toUpperCase','slice','SELECT','select','ui.','ui.createdAt','from','_interactions','where','ui.UserId\x20=\x20?','sequelize','query','UserProfile','user_profiles','section','mergeResources','isEmpty'];(function(_0x5444d2,_0x467674){var _0x327f96=function(_0x5507e5){while(--_0x5507e5){_0x5444d2['push'](_0x5444d2['shift']());}};_0x327f96(++_0x467674);}(_0x741c,0x196));var _0xc741=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x741c[_0x4a9fb1];return _0x348672;};'use strict';var _=require(_0xc741('0x0'));var attributes=require(_0xc741('0x1'));var qs=require(_0xc741('0x2'));var squel=require(_0xc741('0x3'));module[_0xc741('0x4')]=function(_0x31de60){var _0x5c8d3b=_0x31de60['models'];function _0x4089bf(_0x4ccc27,_0xc80e99){return new Promise(function(_0x1935b4,_0x3708ae){if(!_0xc80e99)return _0x1935b4(null);var _0x133bc4=_0xc80e99[_0xc741('0x5')]?{[_0xc80e99[_0xc741('0x5')][_0xc741('0x6')]]:_0xc80e99['filter'][_0xc741('0x7')]}:undefined;return _0x5c8d3b[_0x4ccc27][_0xc741('0x8')]({'where':_0x133bc4,'raw':!![]})['then'](function(_0xc6555){_0xc80e99['associatedResources']=_['map'](_0xc6555,'id');_0x1935b4(_0xc80e99);})[_0xc741('0x9')](function(_0x264cb9){_0x3708ae(_0x264cb9);});});}function _0x40639b(_0x47501c,_0xa1abb1){return new Promise(function(_0x29920b,_0x312684){var _0x506b51=_0x47501c['filter']?{[_0x47501c['filter'][_0xc741('0x6')]]:_0x47501c[_0xc741('0x5')][_0xc741('0x7')]}:undefined;return _0x5c8d3b[_0x47501c[_0xc741('0xa')]][_0xc741('0x8')]({'where':_0x506b51,'raw':!![]})['then'](function(_0xde1da){_0xa1abb1[_0xc741('0xb')]=_['map'](_0xde1da,function(_0xc0383){return _0xc0383[_0xc741('0xc')];});_0x29920b(_0xa1abb1);})[_0xc741('0x9')](function(_0x450179){_0x312684(_0x450179);});});}function _0x21514e(_0x5bbe86,_0x4dcf16,_0x341f54){if(!_0x4dcf16)return Promise['resolve'](null);return new Promise(function(_0x1c4f3a,_0x3903c6){return _0x5c8d3b['UserProfileResource']['findAll']({'where':{'sectionId':_0x4dcf16['id']},'raw':!![]})[_0xc741('0xd')](function(_0x477cc2){if(_0x5bbe86[_0xc741('0x6')]&&_0x5bbe86['field']!=='id'){_0x4dcf16[_0xc741('0xb')]=_[_0xc741('0xe')](_0x477cc2,function(_0x475348){return _0x475348[_0x5bbe86[_0xc741('0x6')]];});}else{if(_0x341f54===_0xc741('0xf')){_0x4dcf16[_0xc741('0xb')]=_[_0xc741('0xe')](_0x477cc2,function(_0x30b7ea){return{'id':_0x30b7ea[_0xc741('0x10')],'type':_0x30b7ea['type']};});}else{_0x4dcf16[_0xc741('0xb')]=_['map'](_0x477cc2,function(_0x212c67){return _0x212c67['resourceId'];});}}_0x1c4f3a(_0x4dcf16);})[_0xc741('0x9')](function(_0x3c3497){_0x3903c6(_0x3c3497);});});}function _0x38e752(_0x5ca96f,_0x71c786){var _0x5a89bd={'parentSections':[]};switch(_0x5ca96f[_0xc741('0x11')]()){case _0xc741('0x12'):_0x5a89bd[_0xc741('0x13')]='SquareProject';break;case'odbc':_0x5a89bd['childModel']=_0xc741('0x14');break;case _0xc741('0x15'):_0x5a89bd[_0xc741('0x13')]=_0xc741('0x16');_0x5a89bd[_0xc741('0x17')]=[{'name':'SquareProjects','field':'name','foreignKey':_0xc741('0x18')}];break;case _0xc741('0x19'):_0x5a89bd[_0xc741('0x13')]=_0xc741('0x1a');break;case _0xc741('0x1b'):_0x5a89bd[_0xc741('0x13')]='CmContact';_0x5a89bd[_0xc741('0x17')]=[{'name':_0xc741('0x1c'),'field':'id','foreignKey':'ListId'}];break;case _0xc741('0x1d'):_0x5a89bd[_0xc741('0x13')]=_0xc741('0x1e');break;case _0xc741('0x1f'):_0x5a89bd[_0xc741('0x13')]=_0xc741('0x20');break;case _0xc741('0x21'):_0x5a89bd[_0xc741('0x13')]=_0xc741('0x22');break;case'chatqueues':_0x5a89bd[_0xc741('0x13')]='ChatQueue';break;case _0xc741('0x23'):_0x5a89bd['childModel']='ChatWebsite';break;case _0xc741('0x24'):_0x5a89bd[_0xc741('0x13')]=_0xc741('0x25');break;case'faxaccounts':_0x5a89bd[_0xc741('0x13')]=_0xc741('0x26');break;case _0xc741('0x27'):case'internalroutes':case _0xc741('0x28'):_0x5a89bd[_0xc741('0x13')]=_0xc741('0x29');break;case _0xc741('0x2a'):_0x5a89bd[_0xc741('0x13')]=_0xc741('0x2b');break;case _0xc741('0x2c'):_0x5a89bd['childModel']='VoiceMail';break;case _0xc741('0x2d'):_0x5a89bd[_0xc741('0x13')]=_0xc741('0x2e');_0x5a89bd[_0xc741('0x17')]=[{'name':_0xc741('0x2f'),'field':_0xc741('0xc'),'foreignKey':'membername','model':_0xc741('0x30'),'filter':{'field':_0xc741('0x31'),'value':['agent']}},{'name':_0xc741('0x32'),'field':_0xc741('0xc'),'foreignKey':_0xc741('0x33'),'model':'User','filter':{'field':_0xc741('0x31'),'value':[_0xc741('0x34')]}},{'name':_0xc741('0x35'),'field':_0xc741('0xc'),'foreignKey':_0xc741('0x36'),'model':_0xc741('0x37'),'filter':{'field':_0xc741('0x38'),'value':['inbound']}},{'name':_0xc741('0x39'),'field':_0xc741('0xc'),'foreignKey':_0xc741('0x36'),'model':_0xc741('0x37'),'filter':{'field':_0xc741('0x38'),'value':[_0xc741('0x3a')]}}];break;case _0xc741('0x3b'):_0x5a89bd[_0xc741('0x13')]='VoiceMusicOnHold';break;case _0xc741('0x3c'):_0x5a89bd[_0xc741('0x13')]=_0xc741('0x3d');break;case _0xc741('0x3e'):_0x5a89bd['childModel']=_0xc741('0x3f');break;case'ivrcampaigns':_0x5a89bd[_0xc741('0x13')]=_0xc741('0x40');break;case _0xc741('0x41'):_0x5a89bd['childModel']='MailQueue';break;case _0xc741('0x42'):_0x5a89bd[_0xc741('0x13')]=_0xc741('0x43');break;case _0xc741('0x44'):_0x5a89bd[_0xc741('0x13')]=_0xc741('0x45');break;case _0xc741('0x46'):_0x5a89bd[_0xc741('0x13')]=_0xc741('0x47');break;case _0xc741('0x48'):_0x5a89bd[_0xc741('0x13')]=_0xc741('0x49');break;case _0xc741('0x4a'):_0x5a89bd[_0xc741('0x13')]=_0xc741('0x4b');break;case _0xc741('0x4c'):_0x5a89bd[_0xc741('0x13')]='SmsAccount';break;case _0xc741('0x4d'):_0x5a89bd['childModel']=_0xc741('0x4e');break;case'whatsappaccounts':_0x5a89bd[_0xc741('0x13')]=_0xc741('0x4f');break;case'teams':_0x5a89bd[_0xc741('0x13')]=_0xc741('0x50');break;case'voicequeues':case _0xc741('0x51'):_0x5a89bd[_0xc741('0x13')]=_0xc741('0x37');if(_0x71c786){_0x5a89bd[_0xc741('0x17')]=[{'name':_0xc741('0x35')},{'name':_0xc741('0x39')}];}break;case _0xc741('0x52'):case'agents':case _0xc741('0x53'):_0x5a89bd['childModel']='User';if(_0x71c786){_0x5a89bd[_0xc741('0x17')]=[{'name':'Users','filter':{'field':_0xc741('0x31'),'value':[_0xc741('0x54'),_0xc741('0x55')]},'ignore':!![]},{'name':_0xc741('0x2f')},{'name':_0xc741('0x32')}];}break;case _0xc741('0x56'):_0x5a89bd[_0xc741('0x13')]=_0xc741('0x57');break;case _0xc741('0x58'):_0x5a89bd['childModel']='SalesforceAccount';break;case _0xc741('0x59'):_0x5a89bd[_0xc741('0x13')]=_0xc741('0x5a');break;case _0xc741('0x5b'):_0x5a89bd['childModel']=_0xc741('0x5c');break;case'deskaccounts':_0x5a89bd[_0xc741('0x13')]=_0xc741('0x5d');break;case _0xc741('0x5e'):_0x5a89bd[_0xc741('0x13')]=_0xc741('0x5f');break;case _0xc741('0x60'):_0x5a89bd[_0xc741('0x13')]=_0xc741('0x30');break;case _0xc741('0x61'):_0x5a89bd[_0xc741('0x13')]=_0xc741('0x62');break;case _0xc741('0x63'):_0x5a89bd['childModel']=_0xc741('0x64');break;case _0xc741('0x65'):_0x5a89bd[_0xc741('0x13')]='Dashboard';break;case _0xc741('0x66'):_0x5a89bd[_0xc741('0x13')]=_0xc741('0x67');break;case _0xc741('0x68'):_0x5a89bd['childModel']=_0xc741('0x69');break;case _0xc741('0x6a'):_0x5a89bd[_0xc741('0x13')]=_0xc741('0x6b');break;case'sounds':_0x5a89bd[_0xc741('0x13')]='Sound';break;case _0xc741('0x6c'):_0x5a89bd[_0xc741('0x13')]=_0xc741('0x6d');break;case _0xc741('0x6e'):_0x5a89bd[_0xc741('0x13')]=_0xc741('0x6f');break;case'triggers':_0x5a89bd[_0xc741('0x13')]='Trigger';break;case _0xc741('0x70'):_0x5a89bd[_0xc741('0x13')]=_0xc741('0x71');break;case _0xc741('0x72'):_0x5a89bd[_0xc741('0x13')]='Variable';break;case'plugins':_0x5a89bd[_0xc741('0x13')]='Plugin';break;case _0xc741('0x73'):_0x5a89bd[_0xc741('0x13')]=_0xc741('0xf');_0x5a89bd[_0xc741('0x17')]=[{'name':_0xc741('0x74'),'field':'id','foreignKey':_0xc741('0x75')}];break;case _0xc741('0x76'):_0x5a89bd[_0xc741('0x13')]=_0xc741('0x77');break;}return _0x5a89bd;}function _0x335eb6(_0xc1c742,_0x1e31bb){var _0x4f386b=_0xc1c742['charAt'](0x0)[_0xc741('0x78')]()+_0xc1c742[_0xc741('0x79')](0x1);var _0xe0b6d8={'type':_0x5c8d3b['Sequelize']['QueryTypes'][_0xc741('0x7a')],'raw':!![]};return new Promise(function(_0x5a4f5b,_0x394be8){var _0x3523a2=squel[_0xc741('0x7b')]()[_0xc741('0x6')](_0xc741('0x7c')+_0x4f386b+'InteractionId','id')['field'](_0xc741('0x7d'))[_0xc741('0x7e')]('user_has_'+_0xc1c742+_0xc741('0x7f'),'ui')[_0xc741('0x80')](_0xc741('0x81'),_0x1e31bb['id']);return _0x5c8d3b[_0xc741('0x82')][_0xc741('0x83')](_0x3523a2['toString'](),_0xe0b6d8)['then'](function(_0x2802a7){_0x1e31bb[_0x4f386b+'OpenTabs']=_0x2802a7;_0x5a4f5b(_0x2802a7);})[_0xc741('0x9')](function(_0x43471d){_0x394be8(_0x43471d);});});}return _0x31de60['define'](_0xc741('0x84'),attributes,{'tableName':_0xc741('0x85'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0xf47dfd){var _0x1aecb3={'raw':![],'where':{}};var _0x1c5c67={};var _0x9027d1={'count':0x0,'rows':[]};var _0xd0575b=_0xf47dfd['query'][_0xc741('0x86')];var _0x28390d=_0xf47dfd['query'][_0xc741('0x87')]||![];var _0x2d9a96=_0x38e752(_0xd0575b,_0x28390d);if(!_0x2d9a96[_0xc741('0x13')])throw new Error('Invalid\x20section\x20\x27'+_0xd0575b+'\x27');var _0xe0f852=[{'name':_0xd0575b}];if(!_[_0xc741('0x88')](_0x2d9a96['parentSections']))_0xe0f852=_0x2d9a96[_0xc741('0x17')];var _0x3768ef=[];for(var _0xfa0e86=0x0;_0xfa0e86<_0xe0f852[_0xc741('0x89')];_0xfa0e86++){_0x3768ef['push'](_0x5c8d3b['UserProfileSection'][_0xc741('0x8a')]({'where':{'userProfileId':_0xf47dfd['params']['id'],'name':_0xe0f852[_0xfa0e86][_0xc741('0xc')]},'raw':!![]}));}return Promise[_0xc741('0x8b')](_0x3768ef)[_0xc741('0xd')](function(_0x1d0401){var _0x438997=_[_0xc741('0x5')](_0x1d0401,function(_0x5eab1a){return _0x5eab1a?_0x5eab1a:undefined;});var _0x40cfe0=_['filter'](_0xe0f852,[_0xc741('0x8c'),!![]]);var _0x1931e2=_[_0xc741('0x88')](_0x438997)&&_[_0xc741('0x88')](_0x40cfe0)?null:_['union'](_0x40cfe0,_0x438997);if(!_0x1931e2)return null;var _0x31c533=[];for(var _0x19b48a=0x0;_0x19b48a<_0x1931e2[_0xc741('0x89')];_0x19b48a++){var _0x164525=_[_0xc741('0x8a')](_0xe0f852,function(_0x240865){return _0x1931e2[_0x19b48a]?_0x240865[_0xc741('0xc')]===_0x1931e2[_0x19b48a][_0xc741('0xc')]:null;});if(_0x164525){if(_0x1931e2[_0x19b48a][_0xc741('0x8c')]){_0x31c533['push'](_0x4089bf(_0x2d9a96['childModel'],_0x1931e2[_0x19b48a]));}else{if(!_0x1931e2[_0x19b48a][_0xc741('0x8d')]){_0x31c533[_0xc741('0x8e')](_0x21514e(_0x164525,_0x1931e2[_0x19b48a],_0x2d9a96[_0xc741('0x13')]));}else{if(_0x164525[_0xc741('0xa')]){_0x31c533['push'](_0x40639b(_0x164525,_0x1931e2[_0x19b48a]));}}}}}return Promise[_0xc741('0x8b')](_0x31c533);})[_0xc741('0xd')](function(_0x22982b){var _0x3f3b84=_0x22982b;var _0x31c314=null;if(_0x3f3b84){_0x31c314=_0x3f3b84[_0xc741('0x89')]===0x1?_0x3f3b84[0x0]:null;}if(!_0x31c314&&!_0x3f3b84)return _0x9027d1;var _0x2cb099=_0x5c8d3b[_0x2d9a96[_0xc741('0x13')]]['rawAttributes'];_0x1c5c67[_0xc741('0xa')]=_['keys'](_0x2cb099);_0x1c5c67['query']=_[_0xc741('0x8f')](_0xf47dfd[_0xc741('0x83')]);_0x1c5c67['filters']=_[_0xc741('0x90')](_0x1c5c67[_0xc741('0xa')],_0x1c5c67['query']);_0x1aecb3['attributes']=_[_0xc741('0x90')](_0x1c5c67[_0xc741('0xa')],qs['fields'](_0xf47dfd[_0xc741('0x83')][_0xc741('0x91')]));_0x1aecb3[_0xc741('0x92')]=_0x1aecb3[_0xc741('0x92')][_0xc741('0x89')]?_0x1aecb3[_0xc741('0x92')]:_0x1c5c67[_0xc741('0xa')];if(!_0xf47dfd[_0xc741('0x83')]['hasOwnProperty'](_0xc741('0x93'))){_0x1aecb3[_0xc741('0x94')]=qs[_0xc741('0x94')](_0xf47dfd[_0xc741('0x83')]['limit']);_0x1aecb3[_0xc741('0x95')]=qs[_0xc741('0x95')](_0xf47dfd['query'][_0xc741('0x95')]);}_0x1aecb3[_0xc741('0x96')]=qs[_0xc741('0x97')](_0xf47dfd[_0xc741('0x83')]['sort']);_0x1aecb3['where']=qs['filters'](_[_0xc741('0x98')](_0xf47dfd[_0xc741('0x83')],_0x1c5c67[_0xc741('0x99')]));if(_0xf47dfd[_0xc741('0x83')]['filter']){_0x1aecb3[_0xc741('0x80')]=_[_0xc741('0x9a')](_0x1aecb3['where'],{'$or':_['map'](_0x2cb099,function(_0x110cac){if(_0x110cac[_0xc741('0x38')][_0xc741('0x9b')]!=='VIRTUAL'){var _0x3922e1={};_0x3922e1[_0x110cac[_0xc741('0x6')]]={'$like':'%'+_0xf47dfd[_0xc741('0x83')]['filter']+'%'};return _0x3922e1;}})});}var _0x4a3c3a=[];var _0x58b414=null;var _0x2e7cfa={};if(_0x31c314){_0x58b414=_[_0xc741('0x8a')](_0xe0f852,['name',_0x31c314['name']]);if(_0x58b414[_0xc741('0x6')]){_0x2e7cfa={};if(_0x2d9a96[_0xc741('0x13')]==='AnalyticExtractedReport'){_0x2e7cfa[_0x58b414[_0xc741('0x9c')]]=_['map'](_0x31c314['associatedResources'],'id');}else{_0x2e7cfa[_0x58b414['foreignKey']]=_0x31c314[_0xc741('0xb')];}_0x4a3c3a[_0xc741('0x8e')](_0x2e7cfa);}else{_0x1aecb3[_0xc741('0x80')]['id']=_0x31c314[_0xc741('0xb')];}}else{for(var _0x59822a=0x0;_0x59822a<_0x3f3b84[_0xc741('0x89')];_0x59822a++){_0x58b414=_['find'](_0xe0f852,[_0xc741('0xc'),_0x3f3b84[_0x59822a]['name']]);if(_0x58b414['field']){_0x2e7cfa={};_0x2e7cfa[_0x58b414[_0xc741('0x9c')]]=_0x3f3b84[_0x59822a][_0xc741('0xb')];_0x4a3c3a['push'](_0x2e7cfa);}else{if(!_0x1aecb3[_0xc741('0x80')]['id'])_0x1aecb3[_0xc741('0x80')]['id']=[];_0x3f3b84[_0x59822a][_0xc741('0xb')][_0xc741('0x9d')](function(_0x3103bd){_0x1aecb3[_0xc741('0x80')]['id']['push'](_0x3103bd);});}}}if(!_[_0xc741('0x88')](_0x4a3c3a)){_0x1aecb3[_0xc741('0x80')]=_[_0xc741('0x9a')](_0x1aecb3[_0xc741('0x80')],{'$and':{'$or':_0x4a3c3a}});}_0x1aecb3=_[_0xc741('0x9a')]({},_0x1aecb3,_0xf47dfd[_0xc741('0x9e')]);if(_0x31c314&&!_0x31c314[_0xc741('0x8d')]&&_0x2d9a96[_0xc741('0x13')]===_0xc741('0xf')){if(_0xf47dfd[_0xc741('0x83')][_0xc741('0x9f')]){_0x1aecb3[_0xc741('0xa0')]=[{'all':!![]}];}return _0x5c8d3b[_0x2d9a96['childModel']]['findAll'](_0x1aecb3)['then'](function(_0x4c78dc){var _0x1a693a=[];_0x4c78dc[_0xc741('0x9d')](function(_0xb83d6e){var _0x2e1962;switch(_0xb83d6e[_0xc741('0xa1')]){case _0xc741('0xa2'):_0x2e1962=_[_0xc741('0x8a')](_0x31c314[_0xc741('0xb')],function(_0x252e16){return _0x252e16['id']===_0xb83d6e[_0xc741('0x75')]&&_0x252e16[_0xc741('0x38')]===_0xc741('0xa3');});break;case _0xc741('0xa4'):_0x2e1962=_['find'](_0x31c314[_0xc741('0xb')],function(_0x211cee){return _0x211cee['id']===_0xb83d6e[_0xc741('0x75')]&&_0x211cee[_0xc741('0x38')]===_0xc741('0xa5');});break;}if(_0x2e1962)_0x1a693a[_0xc741('0x8e')](_0xb83d6e);});_0x9027d1[_0xc741('0xa6')]=_0x1a693a[_0xc741('0x89')];_0x9027d1[_0xc741('0xa7')]=_0x1a693a;return _0x9027d1;});}else{return _0x5c8d3b[_0x2d9a96[_0xc741('0x13')]][_0xc741('0xa6')]({'where':_0x1aecb3[_0xc741('0x80')]})['then'](function(_0x3d755c){_0x9027d1[_0xc741('0xa6')]=_0x3d755c;if(_0xf47dfd[_0xc741('0x83')]['includeAll']){if(_0x2d9a96[_0xc741('0x13')]===_0xc741('0xa8')){_0x1aecb3['include']=[{'model':_0x5c8d3b[_0xc741('0x6d')],'as':'Tags','attributes':['id',_0xc741('0xc'),_0xc741('0xa9')],'required':_0xf47dfd[_0xc741('0x83')]['tag']?!![]:![]},{'model':_0x5c8d3b[_0xc741('0x6d')],'as':_0xc741('0xaa'),'attributes':['id','name','color'],'through':_0xf47dfd[_0xc741('0x83')][_0xc741('0xab')]?{'attributes':[],'where':{'TagId':_0xf47dfd[_0xc741('0x83')][_0xc741('0xab')]||undefined}}:{},'required':_0xf47dfd['query'][_0xc741('0xab')]?!![]:![]}];}else{_0x1aecb3[_0xc741('0xa0')]=[{'all':!![]}];}}return _0x5c8d3b[_0x2d9a96[_0xc741('0x13')]][_0xc741('0x8')](_0x1aecb3);})[_0xc741('0xd')](function(_0x4045cc){_0x9027d1[_0xc741('0xa7')]=_0x4045cc;if(_0xd0575b==='Agents'&&_0xf47dfd[_0xc741('0x83')][_0xc741('0xac')]===_0xc741('0xad')){var _0x62d071=[];for(var _0x193414=0x0;_0x193414<_0x9027d1[_0xc741('0xa7')]['length'];_0x193414++){_0x62d071[_0xc741('0x8e')](_0x335eb6(_0xc741('0xae'),_0x9027d1['rows'][_0x193414]['dataValues']));_0x62d071[_0xc741('0x8e')](_0x335eb6(_0xc741('0xaf'),_0x9027d1['rows'][_0x193414][_0xc741('0xb0')]));_0x62d071[_0xc741('0x8e')](_0x335eb6(_0xc741('0xb1'),_0x9027d1[_0xc741('0xa7')][_0x193414][_0xc741('0xb0')]));_0x62d071[_0xc741('0x8e')](_0x335eb6(_0xc741('0xb2'),_0x9027d1[_0xc741('0xa7')][_0x193414][_0xc741('0xb0')]));_0x62d071[_0xc741('0x8e')](_0x335eb6(_0xc741('0xb3'),_0x9027d1['rows'][_0x193414]['dataValues']));_0x62d071[_0xc741('0x8e')](_0x335eb6(_0xc741('0xb4'),_0x9027d1[_0xc741('0xa7')][_0x193414]['dataValues']));}return Promise[_0xc741('0x8b')](_0x62d071)['then'](function(){return _0x9027d1;});}return _0x9027d1;});}});}}});}; \ No newline at end of file +var _0xf494=['SELECT','select','ui.','InteractionId','from','user_has_','_interactions','where','sequelize','query','OpenTabs','define','UserProfile','user_profiles','section','mergeResources','Invalid\x20section\x20\x27','isEmpty','length','push','find','params','all','ignore','union','autoAssociation','rawAttributes','keys','intersection','attributes','fields','hasOwnProperty','limit','offset','order','pick','filters','key','foreignKey','merge','options','includeAll','forEach','reportType','default','reportId','DefaultReports','custom','CustomReports','count','include','Tag','Tags','color','tag','ThroughTags','rows','true','chat','dataValues','fax','mail','openchannel','whatsapp','lodash','./userProfile.attributes','../../components/parsers/qs','exports','models','filter','value','findAll','then','associatedResources','map','catch','model','name','UserProfileResource','field','AnalyticExtractedReport','resourceId','childModel','SquareProject','SquareOdbc','squarerecordings','SquareRecording','parentSections','SquareProjects','projectName','projects','contacts','CmContact','Lists','ListId','lists','companies','CmCompany','CmCustomField','chatqueues','ChatQueue','chatwebsites','ChatWebsite','faxqueues','FaxQueue','faxaccounts','FaxAccount','inboundroutes','internalroutes','outboundroutes','VoiceExtension','VoiceContext','voicemails','VoiceMail','voicerecordings','VoiceRecording','Agents','membername','User','agent','Telephones','role','telephone','VoiceQueues','queue','VoiceQueue','type','inbound','QueueCampaigns','outbound','musiconholds','VoiceMusicOnHold','chanspies','VoiceChanSpy','voiceprefixes','VoicePrefix','mailqueues','MailQueue','mailaccounts','MailAccount','mailsubstatuses','MailSubstatus','OpenchannelQueue','openchannelaccounts','smsqueues','smsaccounts','SmsAccount','WhatsappQueue','teams','Team','queuecampaigns','users','agents','telephones','Users','admin','zendeskaccounts','salesforceaccounts','SalesforceAccount','freshdeskaccounts','FreshdeskAccount','sugarcrmaccounts','SugarcrmAccount','deskaccounts','DeskAccount','zohoaccounts','ZohoAccount','vtigeraccounts','cannedanswers','CannedAnswer','dispositions','Disposition','customdashboards','Dashboard','Interval','pauses','scheduler','sounds','Sound','tags','templates','triggers','trunks','Trunk','Variable','plugins','Plugin','extractedreports','Reports','metrics','AnalyticMetric','charAt','toUpperCase','Sequelize','QueryTypes'];(function(_0x563122,_0x4a4e0b){var _0x4002cb=function(_0x3f0216){while(--_0x3f0216){_0x563122['push'](_0x563122['shift']());}};_0x4002cb(++_0x4a4e0b);}(_0xf494,0x1c6));var _0x4f49=function(_0x63407c,_0x2a8a08){_0x63407c=_0x63407c-0x0;var _0x2339a6=_0xf494[_0x63407c];return _0x2339a6;};'use strict';var _=require(_0x4f49('0x0'));var attributes=require(_0x4f49('0x1'));var qs=require(_0x4f49('0x2'));var squel=require('squel');module[_0x4f49('0x3')]=function(_0x1d54cc){var _0x423b25=_0x1d54cc[_0x4f49('0x4')];function _0x20c0d7(_0x2a15fb,_0x3267c1){return new Promise(function(_0x790e8b,_0xc5e778){if(!_0x3267c1)return _0x790e8b(null);var _0x413530=_0x3267c1[_0x4f49('0x5')]?{[_0x3267c1['filter']['field']]:_0x3267c1[_0x4f49('0x5')][_0x4f49('0x6')]}:undefined;return _0x423b25[_0x2a15fb][_0x4f49('0x7')]({'where':_0x413530,'raw':!![]})[_0x4f49('0x8')](function(_0x185174){_0x3267c1[_0x4f49('0x9')]=_[_0x4f49('0xa')](_0x185174,'id');_0x790e8b(_0x3267c1);})[_0x4f49('0xb')](function(_0x53ee74){_0xc5e778(_0x53ee74);});});}function _0x3e464f(_0x411759,_0x5bcfe5){return new Promise(function(_0x15e7a1,_0x5bbc75){var _0x496293=_0x411759[_0x4f49('0x5')]?{[_0x411759[_0x4f49('0x5')]['field']]:_0x411759[_0x4f49('0x5')][_0x4f49('0x6')]}:undefined;return _0x423b25[_0x411759[_0x4f49('0xc')]][_0x4f49('0x7')]({'where':_0x496293,'raw':!![]})[_0x4f49('0x8')](function(_0x2f0131){_0x5bcfe5[_0x4f49('0x9')]=_['map'](_0x2f0131,function(_0x515ace){return _0x515ace[_0x4f49('0xd')];});_0x15e7a1(_0x5bcfe5);})[_0x4f49('0xb')](function(_0x5878f4){_0x5bbc75(_0x5878f4);});});}function _0x5bdfaf(_0x2f0a0d,_0x2ecaaa,_0x74886e){if(!_0x2ecaaa)return Promise['resolve'](null);return new Promise(function(_0x1dccfd,_0x399be7){return _0x423b25[_0x4f49('0xe')]['findAll']({'where':{'sectionId':_0x2ecaaa['id']},'raw':!![]})['then'](function(_0x560592){if(_0x2f0a0d['field']&&_0x2f0a0d[_0x4f49('0xf')]!=='id'){_0x2ecaaa[_0x4f49('0x9')]=_[_0x4f49('0xa')](_0x560592,function(_0x407042){return _0x407042[_0x2f0a0d['field']];});}else{if(_0x74886e===_0x4f49('0x10')){_0x2ecaaa[_0x4f49('0x9')]=_[_0x4f49('0xa')](_0x560592,function(_0xaab5e7){return{'id':_0xaab5e7[_0x4f49('0x11')],'type':_0xaab5e7['type']};});}else{_0x2ecaaa[_0x4f49('0x9')]=_[_0x4f49('0xa')](_0x560592,function(_0x3ae590){return _0x3ae590['resourceId'];});}}_0x1dccfd(_0x2ecaaa);})[_0x4f49('0xb')](function(_0x1d70a7){_0x399be7(_0x1d70a7);});});}function _0x32ca7b(_0x43c458,_0x9d30aa){var _0x36187b={'parentSections':[]};switch(_0x43c458['toLowerCase']()){case'squareprojects':_0x36187b[_0x4f49('0x12')]=_0x4f49('0x13');break;case'odbc':_0x36187b[_0x4f49('0x12')]=_0x4f49('0x14');break;case _0x4f49('0x15'):_0x36187b['childModel']=_0x4f49('0x16');_0x36187b[_0x4f49('0x17')]=[{'name':_0x4f49('0x18'),'field':_0x4f49('0xd'),'foreignKey':_0x4f49('0x19')}];break;case _0x4f49('0x1a'):_0x36187b['childModel']='JscriptyProject';break;case _0x4f49('0x1b'):_0x36187b[_0x4f49('0x12')]=_0x4f49('0x1c');_0x36187b['parentSections']=[{'name':_0x4f49('0x1d'),'field':'id','foreignKey':_0x4f49('0x1e')}];break;case _0x4f49('0x1f'):_0x36187b['childModel']='CmList';break;case _0x4f49('0x20'):_0x36187b[_0x4f49('0x12')]=_0x4f49('0x21');break;case'globalcustomfields':_0x36187b[_0x4f49('0x12')]=_0x4f49('0x22');break;case _0x4f49('0x23'):_0x36187b[_0x4f49('0x12')]=_0x4f49('0x24');break;case _0x4f49('0x25'):_0x36187b[_0x4f49('0x12')]=_0x4f49('0x26');break;case _0x4f49('0x27'):_0x36187b[_0x4f49('0x12')]=_0x4f49('0x28');break;case _0x4f49('0x29'):_0x36187b[_0x4f49('0x12')]=_0x4f49('0x2a');break;case _0x4f49('0x2b'):case _0x4f49('0x2c'):case _0x4f49('0x2d'):_0x36187b[_0x4f49('0x12')]=_0x4f49('0x2e');break;case'contexts':_0x36187b[_0x4f49('0x12')]=_0x4f49('0x2f');break;case _0x4f49('0x30'):_0x36187b[_0x4f49('0x12')]=_0x4f49('0x31');break;case _0x4f49('0x32'):_0x36187b[_0x4f49('0x12')]=_0x4f49('0x33');_0x36187b[_0x4f49('0x17')]=[{'name':_0x4f49('0x34'),'field':_0x4f49('0xd'),'foreignKey':_0x4f49('0x35'),'model':_0x4f49('0x36'),'filter':{'field':'role','value':[_0x4f49('0x37')]}},{'name':_0x4f49('0x38'),'field':_0x4f49('0xd'),'foreignKey':_0x4f49('0x35'),'model':_0x4f49('0x36'),'filter':{'field':_0x4f49('0x39'),'value':[_0x4f49('0x3a')]}},{'name':_0x4f49('0x3b'),'field':_0x4f49('0xd'),'foreignKey':_0x4f49('0x3c'),'model':_0x4f49('0x3d'),'filter':{'field':_0x4f49('0x3e'),'value':[_0x4f49('0x3f')]}},{'name':_0x4f49('0x40'),'field':'name','foreignKey':_0x4f49('0x3c'),'model':_0x4f49('0x3d'),'filter':{'field':'type','value':[_0x4f49('0x41')]}}];break;case _0x4f49('0x42'):_0x36187b['childModel']=_0x4f49('0x43');break;case _0x4f49('0x44'):_0x36187b[_0x4f49('0x12')]=_0x4f49('0x45');break;case _0x4f49('0x46'):_0x36187b[_0x4f49('0x12')]=_0x4f49('0x47');break;case'ivrcampaigns':_0x36187b['childModel']='Campaign';break;case _0x4f49('0x48'):_0x36187b[_0x4f49('0x12')]=_0x4f49('0x49');break;case _0x4f49('0x4a'):_0x36187b[_0x4f49('0x12')]=_0x4f49('0x4b');break;case _0x4f49('0x4c'):_0x36187b[_0x4f49('0x12')]=_0x4f49('0x4d');break;case'openchannelqueues':_0x36187b['childModel']=_0x4f49('0x4e');break;case _0x4f49('0x4f'):_0x36187b[_0x4f49('0x12')]='OpenchannelAccount';break;case _0x4f49('0x50'):_0x36187b['childModel']='SmsQueue';break;case _0x4f49('0x51'):_0x36187b[_0x4f49('0x12')]=_0x4f49('0x52');break;case'whatsappqueues':_0x36187b[_0x4f49('0x12')]=_0x4f49('0x53');break;case'whatsappaccounts':_0x36187b[_0x4f49('0x12')]='WhatsappAccount';break;case _0x4f49('0x54'):_0x36187b[_0x4f49('0x12')]=_0x4f49('0x55');break;case'voicequeues':case _0x4f49('0x56'):_0x36187b[_0x4f49('0x12')]=_0x4f49('0x3d');if(_0x9d30aa){_0x36187b[_0x4f49('0x17')]=[{'name':_0x4f49('0x3b')},{'name':_0x4f49('0x40')}];}break;case _0x4f49('0x57'):case _0x4f49('0x58'):case _0x4f49('0x59'):_0x36187b[_0x4f49('0x12')]='User';if(_0x9d30aa){_0x36187b[_0x4f49('0x17')]=[{'name':_0x4f49('0x5a'),'filter':{'field':'role','value':[_0x4f49('0x5b'),'user']},'ignore':!![]},{'name':_0x4f49('0x34')},{'name':_0x4f49('0x38')}];}break;case _0x4f49('0x5c'):_0x36187b[_0x4f49('0x12')]='ZendeskAccount';break;case _0x4f49('0x5d'):_0x36187b[_0x4f49('0x12')]=_0x4f49('0x5e');break;case _0x4f49('0x5f'):_0x36187b[_0x4f49('0x12')]=_0x4f49('0x60');break;case _0x4f49('0x61'):_0x36187b[_0x4f49('0x12')]=_0x4f49('0x62');break;case _0x4f49('0x63'):_0x36187b[_0x4f49('0x12')]=_0x4f49('0x64');break;case _0x4f49('0x65'):_0x36187b[_0x4f49('0x12')]=_0x4f49('0x66');break;case _0x4f49('0x67'):_0x36187b['childModel']='User';break;case _0x4f49('0x68'):_0x36187b[_0x4f49('0x12')]=_0x4f49('0x69');break;case _0x4f49('0x6a'):_0x36187b[_0x4f49('0x12')]=_0x4f49('0x6b');break;case _0x4f49('0x6c'):_0x36187b['childModel']=_0x4f49('0x6d');break;case'intervals':_0x36187b[_0x4f49('0x12')]=_0x4f49('0x6e');break;case _0x4f49('0x6f'):_0x36187b[_0x4f49('0x12')]='Pause';break;case _0x4f49('0x70'):_0x36187b['childModel']='Schedule';break;case _0x4f49('0x71'):_0x36187b[_0x4f49('0x12')]=_0x4f49('0x72');break;case _0x4f49('0x73'):_0x36187b['childModel']='Tag';break;case _0x4f49('0x74'):_0x36187b[_0x4f49('0x12')]='Template';break;case _0x4f49('0x75'):_0x36187b['childModel']='Trigger';break;case _0x4f49('0x76'):_0x36187b['childModel']=_0x4f49('0x77');break;case'variables':_0x36187b[_0x4f49('0x12')]=_0x4f49('0x78');break;case _0x4f49('0x79'):_0x36187b[_0x4f49('0x12')]=_0x4f49('0x7a');break;case _0x4f49('0x7b'):_0x36187b[_0x4f49('0x12')]=_0x4f49('0x10');_0x36187b['parentSections']=[{'name':_0x4f49('0x7c'),'field':'id','foreignKey':'reportId'}];break;case _0x4f49('0x7d'):_0x36187b[_0x4f49('0x12')]=_0x4f49('0x7e');break;}return _0x36187b;}function _0x467f12(_0x1981e0,_0xb7538c){var _0x553981=_0x1981e0[_0x4f49('0x7f')](0x0)[_0x4f49('0x80')]()+_0x1981e0['slice'](0x1);var _0x5d2b3c={'type':_0x423b25[_0x4f49('0x81')][_0x4f49('0x82')][_0x4f49('0x83')],'raw':!![]};return new Promise(function(_0x2409f1,_0x19a788){var _0x4af08d=squel[_0x4f49('0x84')]()['field'](_0x4f49('0x85')+_0x553981+_0x4f49('0x86'),'id')[_0x4f49('0xf')]('ui.createdAt')[_0x4f49('0x87')](_0x4f49('0x88')+_0x1981e0+_0x4f49('0x89'),'ui')[_0x4f49('0x8a')]('ui.UserId\x20=\x20?',_0xb7538c['id']);return _0x423b25[_0x4f49('0x8b')][_0x4f49('0x8c')](_0x4af08d['toString'](),_0x5d2b3c)[_0x4f49('0x8')](function(_0x17b15){_0xb7538c[_0x553981+_0x4f49('0x8d')]=_0x17b15;_0x2409f1(_0x17b15);})[_0x4f49('0xb')](function(_0x28ea73){_0x19a788(_0x28ea73);});});}return _0x1d54cc[_0x4f49('0x8e')](_0x4f49('0x8f'),attributes,{'tableName':_0x4f49('0x90'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x519721){var _0x468821={'raw':![],'where':{}};var _0x3566f2={};var _0x1e91a5={'count':0x0,'rows':[]};var _0x192b5a=_0x519721[_0x4f49('0x8c')][_0x4f49('0x91')];var _0x335875=_0x519721['query'][_0x4f49('0x92')]||![];var _0x50d1ad=_0x32ca7b(_0x192b5a,_0x335875);if(!_0x50d1ad[_0x4f49('0x12')])throw new Error(_0x4f49('0x93')+_0x192b5a+'\x27');var _0x4714c7=[{'name':_0x192b5a}];if(!_[_0x4f49('0x94')](_0x50d1ad[_0x4f49('0x17')]))_0x4714c7=_0x50d1ad[_0x4f49('0x17')];var _0x61a565=[];for(var _0x297698=0x0;_0x297698<_0x4714c7[_0x4f49('0x95')];_0x297698++){_0x61a565[_0x4f49('0x96')](_0x423b25['UserProfileSection'][_0x4f49('0x97')]({'where':{'userProfileId':_0x519721[_0x4f49('0x98')]['id'],'name':_0x4714c7[_0x297698][_0x4f49('0xd')]},'raw':!![]}));}return Promise[_0x4f49('0x99')](_0x61a565)['then'](function(_0x54c67b){var _0x28e8ae=_['filter'](_0x54c67b,function(_0x30defd){return _0x30defd?_0x30defd:undefined;});var _0x287705=_[_0x4f49('0x5')](_0x4714c7,[_0x4f49('0x9a'),!![]]);var _0x224c8d=_[_0x4f49('0x94')](_0x28e8ae)&&_[_0x4f49('0x94')](_0x287705)?null:_[_0x4f49('0x9b')](_0x287705,_0x28e8ae);if(!_0x224c8d)return null;var _0x3823f0=[];for(var _0x3e9b47=0x0;_0x3e9b47<_0x224c8d[_0x4f49('0x95')];_0x3e9b47++){var _0x1ba97e=_[_0x4f49('0x97')](_0x4714c7,function(_0xd53de8){return _0x224c8d[_0x3e9b47]?_0xd53de8[_0x4f49('0xd')]===_0x224c8d[_0x3e9b47][_0x4f49('0xd')]:null;});if(_0x1ba97e){if(_0x224c8d[_0x3e9b47][_0x4f49('0x9a')]){_0x3823f0[_0x4f49('0x96')](_0x20c0d7(_0x50d1ad[_0x4f49('0x12')],_0x224c8d[_0x3e9b47]));}else{if(!_0x224c8d[_0x3e9b47][_0x4f49('0x9c')]){_0x3823f0[_0x4f49('0x96')](_0x5bdfaf(_0x1ba97e,_0x224c8d[_0x3e9b47],_0x50d1ad[_0x4f49('0x12')]));}else{if(_0x1ba97e[_0x4f49('0xc')]){_0x3823f0[_0x4f49('0x96')](_0x3e464f(_0x1ba97e,_0x224c8d[_0x3e9b47]));}}}}}return Promise[_0x4f49('0x99')](_0x3823f0);})['then'](function(_0x3e9460){var _0x4ff0c1=_0x3e9460;var _0x31df7f=null;if(_0x4ff0c1){_0x31df7f=_0x4ff0c1[_0x4f49('0x95')]===0x1?_0x4ff0c1[0x0]:null;}if(!_0x31df7f&&!_0x4ff0c1)return _0x1e91a5;var _0x38fe50=_0x423b25[_0x50d1ad[_0x4f49('0x12')]][_0x4f49('0x9d')];_0x3566f2[_0x4f49('0xc')]=_[_0x4f49('0x9e')](_0x38fe50);_0x3566f2[_0x4f49('0x8c')]=_[_0x4f49('0x9e')](_0x519721['query']);_0x3566f2['filters']=_[_0x4f49('0x9f')](_0x3566f2['model'],_0x3566f2[_0x4f49('0x8c')]);_0x468821[_0x4f49('0xa0')]=_[_0x4f49('0x9f')](_0x3566f2[_0x4f49('0xc')],qs[_0x4f49('0xa1')](_0x519721['query']['fields']));_0x468821[_0x4f49('0xa0')]=_0x468821[_0x4f49('0xa0')]['length']?_0x468821[_0x4f49('0xa0')]:_0x3566f2[_0x4f49('0xc')];if(!_0x519721['query'][_0x4f49('0xa2')]('nolimit')){_0x468821[_0x4f49('0xa3')]=qs[_0x4f49('0xa3')](_0x519721['query'][_0x4f49('0xa3')]);_0x468821[_0x4f49('0xa4')]=qs[_0x4f49('0xa4')](_0x519721[_0x4f49('0x8c')][_0x4f49('0xa4')]);}_0x468821[_0x4f49('0xa5')]=qs['sort'](_0x519721[_0x4f49('0x8c')]['sort']);_0x468821[_0x4f49('0x8a')]=qs['filters'](_[_0x4f49('0xa6')](_0x519721['query'],_0x3566f2[_0x4f49('0xa7')]));if(_0x519721[_0x4f49('0x8c')][_0x4f49('0x5')]){_0x468821[_0x4f49('0x8a')]=_['merge'](_0x468821[_0x4f49('0x8a')],{'$or':_['map'](_0x38fe50,function(_0x5ddfe4){if(_0x5ddfe4['type'][_0x4f49('0xa8')]!=='VIRTUAL'){var _0x4938a6={};_0x4938a6[_0x5ddfe4[_0x4f49('0xf')]]={'$like':'%'+_0x519721[_0x4f49('0x8c')][_0x4f49('0x5')]+'%'};return _0x4938a6;}})});}var _0x4c0e7a=[];var _0x289810=null;var _0x431c15={};if(_0x31df7f){_0x289810=_['find'](_0x4714c7,['name',_0x31df7f['name']]);if(_0x289810[_0x4f49('0xf')]){_0x431c15={};if(_0x50d1ad[_0x4f49('0x12')]===_0x4f49('0x10')){_0x431c15[_0x289810[_0x4f49('0xa9')]]=_[_0x4f49('0xa')](_0x31df7f['associatedResources'],'id');}else{_0x431c15[_0x289810[_0x4f49('0xa9')]]=_0x31df7f[_0x4f49('0x9')];}_0x4c0e7a[_0x4f49('0x96')](_0x431c15);}else{_0x468821['where']['id']=_0x31df7f[_0x4f49('0x9')];}}else{for(var _0x34843a=0x0;_0x34843a<_0x4ff0c1[_0x4f49('0x95')];_0x34843a++){_0x289810=_[_0x4f49('0x97')](_0x4714c7,['name',_0x4ff0c1[_0x34843a][_0x4f49('0xd')]]);if(_0x289810[_0x4f49('0xf')]){_0x431c15={};_0x431c15[_0x289810[_0x4f49('0xa9')]]=_0x4ff0c1[_0x34843a][_0x4f49('0x9')];_0x4c0e7a[_0x4f49('0x96')](_0x431c15);}else{if(!_0x468821['where']['id'])_0x468821[_0x4f49('0x8a')]['id']=[];_0x4ff0c1[_0x34843a][_0x4f49('0x9')]['forEach'](function(_0x3eebc0){_0x468821['where']['id'][_0x4f49('0x96')](_0x3eebc0);});}}}if(!_['isEmpty'](_0x4c0e7a)){_0x468821[_0x4f49('0x8a')]=_[_0x4f49('0xaa')](_0x468821[_0x4f49('0x8a')],{'$and':{'$or':_0x4c0e7a}});}_0x468821=_[_0x4f49('0xaa')]({},_0x468821,_0x519721[_0x4f49('0xab')]);if(_0x31df7f&&!_0x31df7f['autoAssociation']&&_0x50d1ad[_0x4f49('0x12')]===_0x4f49('0x10')){if(_0x519721[_0x4f49('0x8c')][_0x4f49('0xac')]){_0x468821['include']=[{'all':!![]}];}return _0x423b25[_0x50d1ad[_0x4f49('0x12')]]['findAll'](_0x468821)[_0x4f49('0x8')](function(_0x59a5e9){var _0x3066ee=[];_0x59a5e9[_0x4f49('0xad')](function(_0x288f75){var _0x34fca3;switch(_0x288f75[_0x4f49('0xae')]){case _0x4f49('0xaf'):_0x34fca3=_[_0x4f49('0x97')](_0x31df7f[_0x4f49('0x9')],function(_0x3a26ff){return _0x3a26ff['id']===_0x288f75[_0x4f49('0xb0')]&&_0x3a26ff['type']===_0x4f49('0xb1');});break;case _0x4f49('0xb2'):_0x34fca3=_[_0x4f49('0x97')](_0x31df7f[_0x4f49('0x9')],function(_0x302861){return _0x302861['id']===_0x288f75[_0x4f49('0xb0')]&&_0x302861['type']===_0x4f49('0xb3');});break;}if(_0x34fca3)_0x3066ee[_0x4f49('0x96')](_0x288f75);});_0x1e91a5[_0x4f49('0xb4')]=_0x3066ee[_0x4f49('0x95')];_0x1e91a5['rows']=_0x3066ee;return _0x1e91a5;});}else{return _0x423b25[_0x50d1ad[_0x4f49('0x12')]]['count']({'where':_0x468821[_0x4f49('0x8a')]})[_0x4f49('0x8')](function(_0x5c5d2){_0x1e91a5[_0x4f49('0xb4')]=_0x5c5d2;if(_0x519721['query'][_0x4f49('0xac')]){if(_0x50d1ad[_0x4f49('0x12')]===_0x4f49('0x1c')){_0x468821[_0x4f49('0xb5')]=[{'model':_0x423b25[_0x4f49('0xb6')],'as':_0x4f49('0xb7'),'attributes':['id',_0x4f49('0xd'),_0x4f49('0xb8')],'required':_0x519721[_0x4f49('0x8c')][_0x4f49('0xb9')]?!![]:![]},{'model':_0x423b25[_0x4f49('0xb6')],'as':_0x4f49('0xba'),'attributes':['id',_0x4f49('0xd'),_0x4f49('0xb8')],'through':_0x519721[_0x4f49('0x8c')][_0x4f49('0xb9')]?{'attributes':[],'where':{'TagId':_0x519721[_0x4f49('0x8c')][_0x4f49('0xb9')]||undefined}}:{},'required':_0x519721['query'][_0x4f49('0xb9')]?!![]:![]}];}else{_0x468821[_0x4f49('0xb5')]=[{'all':!![]}];}}return _0x423b25[_0x50d1ad[_0x4f49('0x12')]][_0x4f49('0x7')](_0x468821);})['then'](function(_0x225e63){_0x1e91a5[_0x4f49('0xbb')]=_0x225e63;if(_0x192b5a==='Agents'&&_0x519721[_0x4f49('0x8c')]['openTabs']===_0x4f49('0xbc')){var _0x3bc245=[];for(var _0x1b6e82=0x0;_0x1b6e82<_0x1e91a5[_0x4f49('0xbb')][_0x4f49('0x95')];_0x1b6e82++){_0x3bc245[_0x4f49('0x96')](_0x467f12(_0x4f49('0xbd'),_0x1e91a5[_0x4f49('0xbb')][_0x1b6e82][_0x4f49('0xbe')]));_0x3bc245[_0x4f49('0x96')](_0x467f12('sms',_0x1e91a5['rows'][_0x1b6e82][_0x4f49('0xbe')]));_0x3bc245['push'](_0x467f12(_0x4f49('0xbf'),_0x1e91a5[_0x4f49('0xbb')][_0x1b6e82]['dataValues']));_0x3bc245['push'](_0x467f12(_0x4f49('0xc0'),_0x1e91a5['rows'][_0x1b6e82][_0x4f49('0xbe')]));_0x3bc245[_0x4f49('0x96')](_0x467f12(_0x4f49('0xc1'),_0x1e91a5['rows'][_0x1b6e82][_0x4f49('0xbe')]));_0x3bc245['push'](_0x467f12(_0x4f49('0xc2'),_0x1e91a5[_0x4f49('0xbb')][_0x1b6e82][_0x4f49('0xbe')]));}return Promise['all'](_0x3bc245)[_0x4f49('0x8')](function(){return _0x1e91a5;});}return _0x1e91a5;});}});}}});}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.rpc.js b/server/api/userProfile/userProfile.rpc.js index 455b558..82cba3f 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 _0x5d0a=['randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','request\x20sent','stringify','error','UserProfile,\x20%s,\x20%s','message','result','lodash','moment'];(function(_0x597d30,_0x3faeff){var _0x3e0c69=function(_0x1f0b74){while(--_0x1f0b74){_0x597d30['push'](_0x597d30['shift']());}};_0x3e0c69(++_0x3faeff);}(_0x5d0a,0x175));var _0xa5d0=function(_0x558ad6,_0x258bf7){_0x558ad6=_0x558ad6-0x0;var _0x24b541=_0x5d0a[_0x558ad6];return _0x24b541;};'use strict';var _=require(_0xa5d0('0x0'));var util=require('util');var moment=require(_0xa5d0('0x1'));var BPromise=require('bluebird');var rs=require(_0xa5d0('0x2'));var fs=require('fs');var Redis=require(_0xa5d0('0x3'));var db=require(_0xa5d0('0x4'))['db'];var utils=require(_0xa5d0('0x5'));var logger=require('../../config/logger')(_0xa5d0('0x6'));var config=require(_0xa5d0('0x7'));var jayson=require(_0xa5d0('0x8'));var client=jayson[_0xa5d0('0x9')][_0xa5d0('0xa')]({'port':0x232a});config[_0xa5d0('0xb')]=_[_0xa5d0('0xc')](config[_0xa5d0('0xb')],{'host':_0xa5d0('0xd'),'port':0x18eb});var socket=require(_0xa5d0('0xe'))(new Redis(config[_0xa5d0('0xb')]));require('./userProfile.socket')[_0xa5d0('0xf')](socket);function respondWithRpcPromise(_0x29a3c1,_0x1f4235,_0x23e569){return new BPromise(function(_0x14fea2,_0x23f06a){return client[_0xa5d0('0x10')](_0x29a3c1,_0x23e569)[_0xa5d0('0x11')](function(_0xc847c9){logger[_0xa5d0('0x12')]('UserProfile,\x20%s,\x20%s',_0x1f4235,_0xa5d0('0x13'));logger['debug']('UserProfile,\x20%s,\x20%s,\x20%s',_0x1f4235,_0xa5d0('0x13'),JSON[_0xa5d0('0x14')](_0xc847c9));if(_0xc847c9[_0xa5d0('0x15')]){if(_0xc847c9[_0xa5d0('0x15')]['code']===0x1f4){logger['error'](_0xa5d0('0x16'),_0x1f4235,_0xc847c9[_0xa5d0('0x15')][_0xa5d0('0x17')]);return _0x23f06a(_0xc847c9[_0xa5d0('0x15')][_0xa5d0('0x17')]);}logger[_0xa5d0('0x15')](_0xa5d0('0x16'),_0x1f4235,_0xc847c9['error'][_0xa5d0('0x17')]);return _0x14fea2(_0xc847c9['error'][_0xa5d0('0x17')]);}else{logger[_0xa5d0('0x12')]('UserProfile,\x20%s,\x20%s',_0x1f4235,'request\x20sent');_0x14fea2(_0xc847c9[_0xa5d0('0x18')][_0xa5d0('0x17')]);}})['catch'](function(_0x39beba){logger[_0xa5d0('0x15')](_0xa5d0('0x16'),_0x1f4235,_0x39beba);_0x23f06a(_0x39beba);});});} \ No newline at end of file +var _0x61f1=['stringify','error','message','util','bluebird','randomstring','ioredis','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./userProfile.socket','register','request','info','UserProfile,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x18a436,_0x1dbe06){var _0x5c2cf8=function(_0x4712d1){while(--_0x4712d1){_0x18a436['push'](_0x18a436['shift']());}};_0x5c2cf8(++_0x1dbe06);}(_0x61f1,0x18a));var _0x161f=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x61f1[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var util=require(_0x161f('0x0'));var moment=require('moment');var BPromise=require(_0x161f('0x1'));var rs=require(_0x161f('0x2'));var fs=require('fs');var Redis=require(_0x161f('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x161f('0x4'))(_0x161f('0x5'));var config=require('../../config/environment');var jayson=require(_0x161f('0x6'));var client=jayson[_0x161f('0x7')][_0x161f('0x8')]({'port':0x232a});config[_0x161f('0x9')]=_[_0x161f('0xa')](config['redis'],{'host':_0x161f('0xb'),'port':0x18eb});var socket=require(_0x161f('0xc'))(new Redis(config[_0x161f('0x9')]));require(_0x161f('0xd'))[_0x161f('0xe')](socket);function respondWithRpcPromise(_0x224e14,_0xc5cce4,_0x374180){return new BPromise(function(_0x325f71,_0x27b914){return client[_0x161f('0xf')](_0x224e14,_0x374180)['then'](function(_0x43957b){logger[_0x161f('0x10')](_0x161f('0x11'),_0xc5cce4,_0x161f('0x12'));logger[_0x161f('0x13')]('UserProfile,\x20%s,\x20%s,\x20%s',_0xc5cce4,_0x161f('0x12'),JSON[_0x161f('0x14')](_0x43957b));if(_0x43957b[_0x161f('0x15')]){if(_0x43957b[_0x161f('0x15')]['code']===0x1f4){logger[_0x161f('0x15')](_0x161f('0x11'),_0xc5cce4,_0x43957b[_0x161f('0x15')][_0x161f('0x16')]);return _0x27b914(_0x43957b[_0x161f('0x15')][_0x161f('0x16')]);}logger['error']('UserProfile,\x20%s,\x20%s',_0xc5cce4,_0x43957b[_0x161f('0x15')][_0x161f('0x16')]);return _0x325f71(_0x43957b[_0x161f('0x15')]['message']);}else{logger[_0x161f('0x10')](_0x161f('0x11'),_0xc5cce4,_0x161f('0x12'));_0x325f71(_0x43957b['result'][_0x161f('0x16')]);}})['catch'](function(_0x1eb321){logger[_0x161f('0x15')](_0x161f('0x11'),_0xc5cce4,_0x1eb321);_0x27b914(_0x1eb321);});});} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index b84f9b6..5cae58c 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 _0x217e=['register','length','userProfile:','./userProfile.events','remove','update'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x217e,0x1e3));var _0xe217=function(_0x2227dd,_0x48ca1a){_0x2227dd=_0x2227dd-0x0;var _0x111a47=_0x217e[_0x2227dd];return _0x111a47;};'use strict';var UserProfileEvents=require(_0xe217('0x0'));var events=['save',_0xe217('0x1'),_0xe217('0x2')];function createListener(_0x46710a,_0x28281f){return function(_0x36d92b){_0x28281f['emit'](_0x46710a,_0x36d92b);};}function removeListener(_0x41222c,_0x228f7d){return function(){UserProfileEvents['removeListener'](_0x41222c,_0x228f7d);};}exports[_0xe217('0x3')]=function(_0x1b0f7f){for(var _0x476906=0x0,_0x1d6776=events[_0xe217('0x4')];_0x476906<_0x1d6776;_0x476906++){var _0xfc4f56=events[_0x476906];var _0x3399b5=createListener(_0xe217('0x5')+_0xfc4f56,_0x1b0f7f);UserProfileEvents['on'](_0xfc4f56,_0x3399b5);}}; \ No newline at end of file +var _0xb61e=['emit','register','userProfile:','./userProfile.events','save','update'];(function(_0x18ec44,_0x5a358f){var _0x150428=function(_0x2f0e90){while(--_0x2f0e90){_0x18ec44['push'](_0x18ec44['shift']());}};_0x150428(++_0x5a358f);}(_0xb61e,0x1e9));var _0xeb61=function(_0x146484,_0x27a7f0){_0x146484=_0x146484-0x0;var _0x4c7aa3=_0xb61e[_0x146484];return _0x4c7aa3;};'use strict';var UserProfileEvents=require(_0xeb61('0x0'));var events=[_0xeb61('0x1'),'remove',_0xeb61('0x2')];function createListener(_0x21e2c5,_0x1369a1){return function(_0x1f8f17){_0x1369a1[_0xeb61('0x3')](_0x21e2c5,_0x1f8f17);};}function removeListener(_0x29dab6,_0x2ff628){return function(){UserProfileEvents['removeListener'](_0x29dab6,_0x2ff628);};}exports[_0xeb61('0x4')]=function(_0x4ff1ab){for(var _0x11ecf1=0x0,_0xf3ab76=events['length'];_0x11ecf1<_0xf3ab76;_0x11ecf1++){var _0xb54e9b=events[_0x11ecf1];var _0x56c30f=createListener(_0xeb61('0x5')+_0xb54e9b,_0x4ff1ab);UserProfileEvents['on'](_0xb54e9b,_0x56c30f);}}; \ No newline at end of file diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index 2adb044..2577583 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 _0xa880=['/describe','isAuthenticated','describe','/:id','show','post','create','destroy','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./userProfileResource.controller','get','index'];(function(_0x7cb4c,_0x5eeecd){var _0x13ecfd=function(_0x1086c8){while(--_0x1086c8){_0x7cb4c['push'](_0x7cb4c['shift']());}};_0x13ecfd(++_0x5eeecd);}(_0xa880,0x1ee));var _0x0a88=function(_0x223729,_0x470bb5){_0x223729=_0x223729-0x0;var _0x2119b6=_0xa880[_0x223729];return _0x2119b6;};'use strict';var multer=require(_0x0a88('0x0'));var util=require('util');var path=require(_0x0a88('0x1'));var timeout=require(_0x0a88('0x2'));var express=require(_0x0a88('0x3'));var router=express[_0x0a88('0x4')]();var fs_extra=require(_0x0a88('0x5'));var auth=require(_0x0a88('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x0a88('0x7'));router[_0x0a88('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a88('0x9')]);router['get'](_0x0a88('0xa'),auth[_0x0a88('0xb')](),controller[_0x0a88('0xc')]);router[_0x0a88('0x8')](_0x0a88('0xd'),auth['isAuthenticated'](),controller[_0x0a88('0xe')]);router[_0x0a88('0xf')]('/',auth[_0x0a88('0xb')](),controller[_0x0a88('0x10')]);router['put'](_0x0a88('0xd'),auth[_0x0a88('0xb')](),controller['update']);router['delete']('/:id',auth[_0x0a88('0xb')](),controller[_0x0a88('0x11')]);module['exports']=router; \ No newline at end of file +var _0x69f4=['util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./userProfileResource.controller','get','isAuthenticated','index','/describe','describe','/:id','post','create','put','exports','multer'];(function(_0x4d8536,_0x2acb73){var _0x496b14=function(_0x79d06f){while(--_0x79d06f){_0x4d8536['push'](_0x4d8536['shift']());}};_0x496b14(++_0x2acb73);}(_0x69f4,0xbd));var _0x469f=function(_0x3c8499,_0x1e052e){_0x3c8499=_0x3c8499-0x0;var _0x51d346=_0x69f4[_0x3c8499];return _0x51d346;};'use strict';var multer=require(_0x469f('0x0'));var util=require(_0x469f('0x1'));var path=require(_0x469f('0x2'));var timeout=require(_0x469f('0x3'));var express=require(_0x469f('0x4'));var router=express['Router']();var fs_extra=require(_0x469f('0x5'));var auth=require(_0x469f('0x6'));var interaction=require(_0x469f('0x7'));var config=require('../../config/environment');var controller=require(_0x469f('0x8'));router[_0x469f('0x9')]('/',auth[_0x469f('0xa')](),controller[_0x469f('0xb')]);router['get'](_0x469f('0xc'),auth[_0x469f('0xa')](),controller[_0x469f('0xd')]);router['get'](_0x469f('0xe'),auth[_0x469f('0xa')](),controller['show']);router[_0x469f('0xf')]('/',auth['isAuthenticated'](),controller[_0x469f('0x10')]);router[_0x469f('0x11')](_0x469f('0xe'),auth[_0x469f('0xa')](),controller['update']);router['delete'](_0x469f('0xe'),auth['isAuthenticated'](),controller['destroy']);module[_0x469f('0x12')]=router; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.attributes.js b/server/api/userProfileResource/userProfileResource.attributes.js index 0f27203..1bd79fb 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 _0x8705=['STRING','INTEGER','sequelize','exports'];(function(_0xf55e73,_0x3fecc5){var _0x116b99=function(_0x314e0c){while(--_0x314e0c){_0xf55e73['push'](_0xf55e73['shift']());}};_0x116b99(++_0x3fecc5);}(_0x8705,0x82));var _0x5870=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x8705[_0x167cc1];return _0x10bc4b;};'use strict';var Sequelize=require(_0x5870('0x0'));module[_0x5870('0x1')]={'name':{'type':Sequelize[_0x5870('0x2')],'allowNull':![]},'resourceId':{'type':Sequelize[_0x5870('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x5870('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x038e=['STRING','INTEGER','sequelize','exports'];(function(_0x98d42a,_0x1face8){var _0x3d5b55=function(_0x14809c){while(--_0x14809c){_0x98d42a['push'](_0x98d42a['shift']());}};_0x3d5b55(++_0x1face8);}(_0x038e,0x102));var _0xe038=function(_0x14ba89,_0x3a7e5c){_0x14ba89=_0x14ba89-0x0;var _0x5ace4=_0x038e[_0x14ba89];return _0x5ace4;};'use strict';var Sequelize=require(_0xe038('0x0'));module[_0xe038('0x1')]={'name':{'type':Sequelize[_0xe038('0x2')],'allowNull':![]},'resourceId':{'type':Sequelize[_0xe038('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xe038('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.controller.js b/server/api/userProfileResource/userProfileResource.controller.js index 4ee5bdd..c510faa 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 _0x71ab=['filters','model','attributes','intersection','fields','length','hasOwnProperty','sort','where','pick','filter','merge','options','includeAll','include','UserProfileResource','findAll','rows','catch','show','params','rawAttributes','find','create','body','describe','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','reject','update','then','destroy','error','stack','name','send','index','map','type','key','query','keys'];(function(_0x594f02,_0x3e6145){var _0x1c32dc=function(_0x5237d4){while(--_0x5237d4){_0x594f02['push'](_0x594f02['shift']());}};_0x1c32dc(++_0x3e6145);}(_0x71ab,0x64));var _0xb71a=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x71ab[_0x465028];return _0xb783d4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb71a('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb71a('0x1'));var rp=require('request-promise');var moment=require(_0xb71a('0x2'));var BPromise=require(_0xb71a('0x3'));var Mustache=require(_0xb71a('0x4'));var util=require(_0xb71a('0x5'));var path=require(_0xb71a('0x6'));var sox=require(_0xb71a('0x7'));var csv=require(_0xb71a('0x8'));var ejs=require(_0xb71a('0x9'));var fs=require('fs');var fs_extra=require(_0xb71a('0xa'));var _=require(_0xb71a('0xb'));var squel=require(_0xb71a('0xc'));var crypto=require(_0xb71a('0xd'));var jsforce=require(_0xb71a('0xe'));var deskjs=require(_0xb71a('0xf'));var toCsv=require(_0xb71a('0x8'));var querystring=require(_0xb71a('0x10'));var Papa=require(_0xb71a('0x11'));var Redis=require(_0xb71a('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xb71a('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb71a('0x14'));var logger=require(_0xb71a('0x15'))(_0xb71a('0x16'));var utils=require('../../config/utils');var config=require(_0xb71a('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xb71a('0x18'))['db'];function respondWithStatusCode(_0x50030d,_0x50b43b){_0x50b43b=_0x50b43b||0xcc;return function(_0x3346a5){if(_0x3346a5){return _0x50030d[_0xb71a('0x19')](_0x50b43b);}return _0x50030d[_0xb71a('0x1a')](_0x50b43b)[_0xb71a('0x1b')]();};}function respondWithResult(_0x483d77,_0x47ee48){_0x47ee48=_0x47ee48||0xc8;return function(_0x5364e3){if(_0x5364e3){return _0x483d77[_0xb71a('0x1a')](_0x47ee48)[_0xb71a('0x1c')](_0x5364e3);}};}function respondWithFilteredResult(_0x15252a,_0x42fc55){return function(_0x3cd0f0){if(_0x3cd0f0){var _0x1e9363=typeof _0x42fc55[_0xb71a('0x1d')]===_0xb71a('0x1e')&&typeof _0x42fc55[_0xb71a('0x1f')]==='undefined';var _0x1ca65e=_0x3cd0f0[_0xb71a('0x20')];var _0x374c8c=_0x1e9363?0x0:_0x42fc55[_0xb71a('0x1d')];var _0x2bdb61=_0x1e9363?_0x3cd0f0[_0xb71a('0x20')]:_0x42fc55[_0xb71a('0x1d')]+_0x42fc55[_0xb71a('0x1f')];var _0x20bdfe;if(_0x2bdb61>=_0x1ca65e){_0x2bdb61=_0x1ca65e;_0x20bdfe=0xc8;}else{_0x20bdfe=0xce;}_0x15252a[_0xb71a('0x1a')](_0x20bdfe);return _0x15252a[_0xb71a('0x21')]('Content-Range',_0x374c8c+'-'+_0x2bdb61+'/'+_0x1ca65e)['json'](_0x3cd0f0);}return null;};}function patchUpdates(_0x1358f2){return function(_0x578fe4){try{jsonpatch['apply'](_0x578fe4,_0x1358f2,!![]);}catch(_0x4d8871){return BPromise[_0xb71a('0x22')](_0x4d8871);}return _0x578fe4['save']();};}function saveUpdates(_0x76d6dc,_0x4227c7){return function(_0x3ac77b){if(_0x3ac77b){return _0x3ac77b[_0xb71a('0x23')](_0x76d6dc)[_0xb71a('0x24')](function(_0x14b2a1){return _0x14b2a1;});}return null;};}function removeEntity(_0x2f4fac,_0x14aac7){return function(_0x5f3f19){if(_0x5f3f19){return _0x5f3f19[_0xb71a('0x25')]()[_0xb71a('0x24')](function(){_0x2f4fac[_0xb71a('0x1a')](0xcc)[_0xb71a('0x1b')]();});}};}function handleEntityNotFound(_0x3401f7,_0x1a010d){return function(_0x20ed75){if(!_0x20ed75){_0x3401f7[_0xb71a('0x19')](0x194);}return _0x20ed75;};}function handleError(_0x31085b,_0x2a847a){_0x2a847a=_0x2a847a||0x1f4;return function(_0x45b849){logger[_0xb71a('0x26')](_0x45b849[_0xb71a('0x27')]);if(_0x45b849['name']){delete _0x45b849[_0xb71a('0x28')];}_0x31085b[_0xb71a('0x1a')](_0x2a847a)[_0xb71a('0x29')](_0x45b849);};}exports[_0xb71a('0x2a')]=function(_0x2fbd73,_0x38178c){var _0x44826e={},_0x25364c={},_0x42c086={'count':0x0,'rows':[]};var _0x421fcf=_[_0xb71a('0x2b')](db['UserProfileResource']['rawAttributes'],function(_0x3112d3){return{'name':_0x3112d3['fieldName'],'type':_0x3112d3[_0xb71a('0x2c')][_0xb71a('0x2d')]};});_0x25364c['model']=_[_0xb71a('0x2b')](_0x421fcf,_0xb71a('0x28'));_0x25364c[_0xb71a('0x2e')]=_[_0xb71a('0x2f')](_0x2fbd73[_0xb71a('0x2e')]);_0x25364c[_0xb71a('0x30')]=_['intersection'](_0x25364c[_0xb71a('0x31')],_0x25364c[_0xb71a('0x2e')]);_0x44826e[_0xb71a('0x32')]=_[_0xb71a('0x33')](_0x25364c['model'],qs[_0xb71a('0x34')](_0x2fbd73[_0xb71a('0x2e')][_0xb71a('0x34')]));_0x44826e[_0xb71a('0x32')]=_0x44826e[_0xb71a('0x32')][_0xb71a('0x35')]?_0x44826e[_0xb71a('0x32')]:_0x25364c[_0xb71a('0x31')];if(!_0x2fbd73[_0xb71a('0x2e')][_0xb71a('0x36')]('nolimit')){_0x44826e['limit']=qs[_0xb71a('0x1f')](_0x2fbd73[_0xb71a('0x2e')][_0xb71a('0x1f')]);_0x44826e[_0xb71a('0x1d')]=qs[_0xb71a('0x1d')](_0x2fbd73[_0xb71a('0x2e')][_0xb71a('0x1d')]);}_0x44826e['order']=qs[_0xb71a('0x37')](_0x2fbd73['query'][_0xb71a('0x37')]);_0x44826e[_0xb71a('0x38')]=qs[_0xb71a('0x30')](_[_0xb71a('0x39')](_0x2fbd73['query'],_0x25364c[_0xb71a('0x30')]),_0x421fcf);if(_0x2fbd73[_0xb71a('0x2e')][_0xb71a('0x3a')]){_0x44826e[_0xb71a('0x38')]=_[_0xb71a('0x3b')](_0x44826e[_0xb71a('0x38')],{'$or':_[_0xb71a('0x2b')](_0x421fcf,function(_0x2756b9){if(_0x2756b9[_0xb71a('0x2c')]!=='VIRTUAL'){var _0x24a3af={};_0x24a3af[_0x2756b9['name']]={'$like':'%'+_0x2fbd73[_0xb71a('0x2e')][_0xb71a('0x3a')]+'%'};return _0x24a3af;}})});}_0x44826e=_[_0xb71a('0x3b')]({},_0x44826e,_0x2fbd73[_0xb71a('0x3c')]);var _0xce7b8a={'where':_0x44826e[_0xb71a('0x38')]};return db['UserProfileResource']['count'](_0xce7b8a)['then'](function(_0x35fea9){_0x42c086['count']=_0x35fea9;if(_0x2fbd73[_0xb71a('0x2e')][_0xb71a('0x3d')]){_0x44826e[_0xb71a('0x3e')]=[{'all':!![]}];}return db[_0xb71a('0x3f')][_0xb71a('0x40')](_0x44826e);})[_0xb71a('0x24')](function(_0x59530a){_0x42c086[_0xb71a('0x41')]=_0x59530a;return _0x42c086;})[_0xb71a('0x24')](respondWithFilteredResult(_0x38178c,_0x44826e))[_0xb71a('0x42')](handleError(_0x38178c,null));};exports[_0xb71a('0x43')]=function(_0x7d305,_0x2f08d2){var _0x55cbca={'raw':![],'where':{'id':_0x7d305[_0xb71a('0x44')]['id']}},_0x2afff3={};_0x2afff3[_0xb71a('0x31')]=_[_0xb71a('0x2f')](db[_0xb71a('0x3f')][_0xb71a('0x45')]);_0x2afff3[_0xb71a('0x2e')]=_['keys'](_0x7d305['query']);_0x2afff3[_0xb71a('0x30')]=_[_0xb71a('0x33')](_0x2afff3[_0xb71a('0x31')],_0x2afff3[_0xb71a('0x2e')]);_0x55cbca['attributes']=_[_0xb71a('0x33')](_0x2afff3['model'],qs[_0xb71a('0x34')](_0x7d305[_0xb71a('0x2e')]['fields']));_0x55cbca[_0xb71a('0x32')]=_0x55cbca[_0xb71a('0x32')][_0xb71a('0x35')]?_0x55cbca[_0xb71a('0x32')]:_0x2afff3['model'];if(_0x7d305[_0xb71a('0x2e')][_0xb71a('0x3d')]){_0x55cbca[_0xb71a('0x3e')]=[{'all':!![]}];}_0x55cbca=_['merge']({},_0x55cbca,_0x7d305[_0xb71a('0x3c')]);return db[_0xb71a('0x3f')][_0xb71a('0x46')](_0x55cbca)['then'](handleEntityNotFound(_0x2f08d2,null))[_0xb71a('0x24')](respondWithResult(_0x2f08d2,null))[_0xb71a('0x42')](handleError(_0x2f08d2,null));};exports[_0xb71a('0x47')]=function(_0x1f29b7,_0x365bed){return db['UserProfileResource'][_0xb71a('0x47')](_0x1f29b7[_0xb71a('0x48')],{})[_0xb71a('0x24')](respondWithResult(_0x365bed,0xc9))[_0xb71a('0x42')](handleError(_0x365bed,null));};exports['update']=function(_0x48fbde,_0x23b4c0){if(_0x48fbde[_0xb71a('0x48')]['id']){delete _0x48fbde[_0xb71a('0x48')]['id'];}return db[_0xb71a('0x3f')][_0xb71a('0x46')]({'where':{'id':_0x48fbde[_0xb71a('0x44')]['id']}})[_0xb71a('0x24')](handleEntityNotFound(_0x23b4c0,null))[_0xb71a('0x24')](saveUpdates(_0x48fbde[_0xb71a('0x48')],null))[_0xb71a('0x24')](respondWithResult(_0x23b4c0,null))['catch'](handleError(_0x23b4c0,null));};exports[_0xb71a('0x25')]=function(_0x2ce711,_0x500196){return db[_0xb71a('0x3f')]['find']({'where':{'id':_0x2ce711[_0xb71a('0x44')]['id']}})[_0xb71a('0x24')](handleEntityNotFound(_0x500196,null))[_0xb71a('0x24')](removeEntity(_0x500196,null))[_0xb71a('0x42')](handleError(_0x500196,null));};exports[_0xb71a('0x49')]=function(_0x4b26d2,_0x1ea17b){return db['UserProfileResource'][_0xb71a('0x49')]()[_0xb71a('0x24')](respondWithResult(_0x1ea17b,null))['catch'](handleError(_0x1ea17b,null));}; \ No newline at end of file +var _0x2542=['json','offset','limit','undefined','count','set','Content-Range','apply','update','then','error','stack','name','index','map','UserProfileResource','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','end','status'];(function(_0x2b2410,_0xb7b3){var _0x2598f7=function(_0x46e7bf){while(--_0x46e7bf){_0x2b2410['push'](_0x2b2410['shift']());}};_0x2598f7(++_0xb7b3);}(_0x2542,0x169));var _0x2254=function(_0x31732b,_0x4c6eab){_0x31732b=_0x31732b-0x0;var _0x1500e2=_0x2542[_0x31732b];return _0x1500e2;};'use strict';var emlformat=require(_0x2254('0x0'));var rimraf=require(_0x2254('0x1'));var zipdir=require(_0x2254('0x2'));var jsonpatch=require(_0x2254('0x3'));var rp=require('request-promise');var moment=require(_0x2254('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x2254('0x5'));var util=require(_0x2254('0x6'));var path=require(_0x2254('0x7'));var sox=require(_0x2254('0x8'));var csv=require(_0x2254('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2254('0xa'));var _=require(_0x2254('0xb'));var squel=require(_0x2254('0xc'));var crypto=require(_0x2254('0xd'));var jsforce=require(_0x2254('0xe'));var deskjs=require(_0x2254('0xf'));var toCsv=require(_0x2254('0x9'));var querystring=require(_0x2254('0x10'));var Papa=require(_0x2254('0x11'));var Redis=require(_0x2254('0x12'));var authService=require(_0x2254('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x2254('0x14'));var hardwareService=require(_0x2254('0x15'));var logger=require(_0x2254('0x16'))(_0x2254('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x2254('0x18'));var db=require(_0x2254('0x19'))['db'];function respondWithStatusCode(_0x116b70,_0xdcb670){_0xdcb670=_0xdcb670||0xcc;return function(_0x3c326b){if(_0x3c326b){return _0x116b70[_0x2254('0x1a')](_0xdcb670);}return _0x116b70['status'](_0xdcb670)[_0x2254('0x1b')]();};}function respondWithResult(_0x7c7ab0,_0x504749){_0x504749=_0x504749||0xc8;return function(_0x2f4de){if(_0x2f4de){return _0x7c7ab0[_0x2254('0x1c')](_0x504749)[_0x2254('0x1d')](_0x2f4de);}};}function respondWithFilteredResult(_0x145272,_0x26285a){return function(_0xbc5548){if(_0xbc5548){var _0x50f137=typeof _0x26285a[_0x2254('0x1e')]==='undefined'&&typeof _0x26285a[_0x2254('0x1f')]===_0x2254('0x20');var _0x170ffa=_0xbc5548[_0x2254('0x21')];var _0x1ae11e=_0x50f137?0x0:_0x26285a[_0x2254('0x1e')];var _0x497724=_0x50f137?_0xbc5548['count']:_0x26285a['offset']+_0x26285a[_0x2254('0x1f')];var _0x3a79f8;if(_0x497724>=_0x170ffa){_0x497724=_0x170ffa;_0x3a79f8=0xc8;}else{_0x3a79f8=0xce;}_0x145272[_0x2254('0x1c')](_0x3a79f8);return _0x145272[_0x2254('0x22')](_0x2254('0x23'),_0x1ae11e+'-'+_0x497724+'/'+_0x170ffa)[_0x2254('0x1d')](_0xbc5548);}return null;};}function patchUpdates(_0x487f72){return function(_0x28381e){try{jsonpatch[_0x2254('0x24')](_0x28381e,_0x487f72,!![]);}catch(_0x906cde){return BPromise['reject'](_0x906cde);}return _0x28381e['save']();};}function saveUpdates(_0x5bd982,_0x1e8a98){return function(_0x559af4){if(_0x559af4){return _0x559af4[_0x2254('0x25')](_0x5bd982)['then'](function(_0x5713e4){return _0x5713e4;});}return null;};}function removeEntity(_0x4d8faf,_0x540020){return function(_0x5e5edb){if(_0x5e5edb){return _0x5e5edb['destroy']()[_0x2254('0x26')](function(){_0x4d8faf[_0x2254('0x1c')](0xcc)[_0x2254('0x1b')]();});}};}function handleEntityNotFound(_0x265467,_0x13522d){return function(_0x1349c9){if(!_0x1349c9){_0x265467['sendStatus'](0x194);}return _0x1349c9;};}function handleError(_0x4a8274,_0x1ada42){_0x1ada42=_0x1ada42||0x1f4;return function(_0x4f6877){logger[_0x2254('0x27')](_0x4f6877[_0x2254('0x28')]);if(_0x4f6877[_0x2254('0x29')]){delete _0x4f6877[_0x2254('0x29')];}_0x4a8274[_0x2254('0x1c')](_0x1ada42)['send'](_0x4f6877);};}exports[_0x2254('0x2a')]=function(_0x2a789b,_0x21285d){var _0x37af8b={},_0x13366a={},_0x377c41={'count':0x0,'rows':[]};var _0x3214a7=_[_0x2254('0x2b')](db[_0x2254('0x2c')][_0x2254('0x2d')],function(_0x21c641){return{'name':_0x21c641[_0x2254('0x2e')],'type':_0x21c641[_0x2254('0x2f')][_0x2254('0x30')]};});_0x13366a[_0x2254('0x31')]=_[_0x2254('0x2b')](_0x3214a7,_0x2254('0x29'));_0x13366a[_0x2254('0x32')]=_[_0x2254('0x33')](_0x2a789b['query']);_0x13366a[_0x2254('0x34')]=_[_0x2254('0x35')](_0x13366a[_0x2254('0x31')],_0x13366a[_0x2254('0x32')]);_0x37af8b[_0x2254('0x36')]=_[_0x2254('0x35')](_0x13366a[_0x2254('0x31')],qs[_0x2254('0x37')](_0x2a789b[_0x2254('0x32')]['fields']));_0x37af8b[_0x2254('0x36')]=_0x37af8b[_0x2254('0x36')]['length']?_0x37af8b[_0x2254('0x36')]:_0x13366a[_0x2254('0x31')];if(!_0x2a789b[_0x2254('0x32')][_0x2254('0x38')]('nolimit')){_0x37af8b['limit']=qs[_0x2254('0x1f')](_0x2a789b['query'][_0x2254('0x1f')]);_0x37af8b[_0x2254('0x1e')]=qs[_0x2254('0x1e')](_0x2a789b[_0x2254('0x32')][_0x2254('0x1e')]);}_0x37af8b[_0x2254('0x39')]=qs[_0x2254('0x3a')](_0x2a789b['query'][_0x2254('0x3a')]);_0x37af8b[_0x2254('0x3b')]=qs[_0x2254('0x34')](_[_0x2254('0x3c')](_0x2a789b[_0x2254('0x32')],_0x13366a[_0x2254('0x34')]),_0x3214a7);if(_0x2a789b[_0x2254('0x32')][_0x2254('0x3d')]){_0x37af8b[_0x2254('0x3b')]=_[_0x2254('0x3e')](_0x37af8b['where'],{'$or':_[_0x2254('0x2b')](_0x3214a7,function(_0xde3e4a){if(_0xde3e4a[_0x2254('0x2f')]!==_0x2254('0x3f')){var _0x4c7cc3={};_0x4c7cc3[_0xde3e4a[_0x2254('0x29')]]={'$like':'%'+_0x2a789b[_0x2254('0x32')][_0x2254('0x3d')]+'%'};return _0x4c7cc3;}})});}_0x37af8b=_[_0x2254('0x3e')]({},_0x37af8b,_0x2a789b[_0x2254('0x40')]);var _0x2602db={'where':_0x37af8b[_0x2254('0x3b')]};return db[_0x2254('0x2c')]['count'](_0x2602db)[_0x2254('0x26')](function(_0x5c15d7){_0x377c41[_0x2254('0x21')]=_0x5c15d7;if(_0x2a789b[_0x2254('0x32')][_0x2254('0x41')]){_0x37af8b[_0x2254('0x42')]=[{'all':!![]}];}return db[_0x2254('0x2c')][_0x2254('0x43')](_0x37af8b);})[_0x2254('0x26')](function(_0x568ec9){_0x377c41[_0x2254('0x44')]=_0x568ec9;return _0x377c41;})[_0x2254('0x26')](respondWithFilteredResult(_0x21285d,_0x37af8b))[_0x2254('0x45')](handleError(_0x21285d,null));};exports[_0x2254('0x46')]=function(_0x40d4da,_0x57cda2){var _0x22bb98={'raw':![],'where':{'id':_0x40d4da[_0x2254('0x47')]['id']}},_0x1dec43={};_0x1dec43[_0x2254('0x31')]=_[_0x2254('0x33')](db['UserProfileResource'][_0x2254('0x2d')]);_0x1dec43['query']=_[_0x2254('0x33')](_0x40d4da[_0x2254('0x32')]);_0x1dec43[_0x2254('0x34')]=_[_0x2254('0x35')](_0x1dec43[_0x2254('0x31')],_0x1dec43[_0x2254('0x32')]);_0x22bb98[_0x2254('0x36')]=_[_0x2254('0x35')](_0x1dec43[_0x2254('0x31')],qs[_0x2254('0x37')](_0x40d4da[_0x2254('0x32')][_0x2254('0x37')]));_0x22bb98[_0x2254('0x36')]=_0x22bb98['attributes'][_0x2254('0x48')]?_0x22bb98[_0x2254('0x36')]:_0x1dec43[_0x2254('0x31')];if(_0x40d4da['query'][_0x2254('0x41')]){_0x22bb98[_0x2254('0x42')]=[{'all':!![]}];}_0x22bb98=_[_0x2254('0x3e')]({},_0x22bb98,_0x40d4da[_0x2254('0x40')]);return db[_0x2254('0x2c')][_0x2254('0x49')](_0x22bb98)[_0x2254('0x26')](handleEntityNotFound(_0x57cda2,null))[_0x2254('0x26')](respondWithResult(_0x57cda2,null))[_0x2254('0x45')](handleError(_0x57cda2,null));};exports['create']=function(_0x239ba0,_0x405eb2){return db[_0x2254('0x2c')][_0x2254('0x4a')](_0x239ba0[_0x2254('0x4b')],{})[_0x2254('0x26')](respondWithResult(_0x405eb2,0xc9))[_0x2254('0x45')](handleError(_0x405eb2,null));};exports[_0x2254('0x25')]=function(_0x3ac691,_0xa103ea){if(_0x3ac691['body']['id']){delete _0x3ac691[_0x2254('0x4b')]['id'];}return db[_0x2254('0x2c')]['find']({'where':{'id':_0x3ac691[_0x2254('0x47')]['id']}})[_0x2254('0x26')](handleEntityNotFound(_0xa103ea,null))[_0x2254('0x26')](saveUpdates(_0x3ac691[_0x2254('0x4b')],null))['then'](respondWithResult(_0xa103ea,null))[_0x2254('0x45')](handleError(_0xa103ea,null));};exports[_0x2254('0x4c')]=function(_0x4d2c96,_0x26d01a){return db[_0x2254('0x2c')][_0x2254('0x49')]({'where':{'id':_0x4d2c96[_0x2254('0x47')]['id']}})['then'](handleEntityNotFound(_0x26d01a,null))[_0x2254('0x26')](removeEntity(_0x26d01a,null))[_0x2254('0x45')](handleError(_0x26d01a,null));};exports[_0x2254('0x4d')]=function(_0x4ba6ef,_0x4cc18a){return db[_0x2254('0x2c')][_0x2254('0x4d')]()['then'](respondWithResult(_0x4cc18a,null))[_0x2254('0x45')](handleError(_0x4cc18a,null));}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.model.js b/server/api/userProfileResource/userProfileResource.model.js index 1862015..dc38c28 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 _0x9dd3=['exports','define','UserProfileResource','user_profile_has_resources','compositeIndex','resourceId','sectionId','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./userProfileResource.attributes'];(function(_0x471be7,_0x43c97c){var _0x3de9fc=function(_0x29f3d0){while(--_0x29f3d0){_0x471be7['push'](_0x471be7['shift']());}};_0x3de9fc(++_0x43c97c);}(_0x9dd3,0x187));var _0x39dd=function(_0x4f3b05,_0x32fb04){_0x4f3b05=_0x4f3b05-0x0;var _0x198d53=_0x9dd3[_0x4f3b05];return _0x198d53;};'use strict';var _=require('lodash');var util=require(_0x39dd('0x0'));var logger=require(_0x39dd('0x1'))(_0x39dd('0x2'));var moment=require('moment');var BPromise=require(_0x39dd('0x3'));var rp=require(_0x39dd('0x4'));var fs=require('fs');var path=require(_0x39dd('0x5'));var rimraf=require(_0x39dd('0x6'));var config=require(_0x39dd('0x7'));var attributes=require(_0x39dd('0x8'));module[_0x39dd('0x9')]=function(_0x31137c,_0x473e42){return _0x31137c[_0x39dd('0xa')](_0x39dd('0xb'),attributes,{'tableName':_0x39dd('0xc'),'paranoid':![],'indexes':[{'name':_0x39dd('0xd'),'fields':[_0x39dd('0xe'),_0x39dd('0xf')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7ce4=['request-promise','path','rimraf','../../config/environment','./userProfileResource.attributes','exports','define','UserProfileResource','user_profile_has_resources','compositeIndex','sectionId','util','../../config/logger','bluebird'];(function(_0x4aea3a,_0x3839f9){var _0x5a349e=function(_0x4d77c6){while(--_0x4d77c6){_0x4aea3a['push'](_0x4aea3a['shift']());}};_0x5a349e(++_0x3839f9);}(_0x7ce4,0x131));var _0x47ce=function(_0xc43ada,_0x2225fa){_0xc43ada=_0xc43ada-0x0;var _0x442948=_0x7ce4[_0xc43ada];return _0x442948;};'use strict';var _=require('lodash');var util=require(_0x47ce('0x0'));var logger=require(_0x47ce('0x1'))('api');var moment=require('moment');var BPromise=require(_0x47ce('0x2'));var rp=require(_0x47ce('0x3'));var fs=require('fs');var path=require(_0x47ce('0x4'));var rimraf=require(_0x47ce('0x5'));var config=require(_0x47ce('0x6'));var attributes=require(_0x47ce('0x7'));module[_0x47ce('0x8')]=function(_0x53336b,_0x18f60a){return _0x53336b[_0x47ce('0x9')](_0x47ce('0xa'),attributes,{'tableName':_0x47ce('0xb'),'paranoid':![],'indexes':[{'name':_0x47ce('0xc'),'fields':['resourceId',_0x47ce('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.rpc.js b/server/api/userProfileResource/userProfileResource.rpc.js index ef8b921..36eb14a 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 _0xeef8=['error','message','info','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','UserProfileResource,\x20%s,\x20%s','request\x20sent','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x3e59ba,_0x3cb09a){var _0x4ad043=function(_0x3e145d){while(--_0x3e145d){_0x3e59ba['push'](_0x3e59ba['shift']());}};_0x4ad043(++_0x3cb09a);}(_0xeef8,0x1a3));var _0x8eef=function(_0x2912f9,_0x3bdd4a){_0x2912f9=_0x2912f9-0x0;var _0x4a200f=_0xeef8[_0x2912f9];return _0x4a200f;};'use strict';var _=require('lodash');var util=require(_0x8eef('0x0'));var moment=require(_0x8eef('0x1'));var BPromise=require(_0x8eef('0x2'));var rs=require(_0x8eef('0x3'));var fs=require('fs');var Redis=require(_0x8eef('0x4'));var db=require(_0x8eef('0x5'))['db'];var utils=require(_0x8eef('0x6'));var logger=require(_0x8eef('0x7'))('rpc');var config=require(_0x8eef('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x8eef('0x9')][_0x8eef('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59c340,_0x22ead6,_0xf36a63){return new BPromise(function(_0x3147db,_0x5125d){return client[_0x8eef('0xb')](_0x59c340,_0xf36a63)[_0x8eef('0xc')](function(_0x15745f){logger['info'](_0x8eef('0xd'),_0x22ead6,_0x8eef('0xe'));logger[_0x8eef('0xf')](_0x8eef('0x10'),_0x22ead6,_0x8eef('0xe'),JSON[_0x8eef('0x11')](_0x15745f));if(_0x15745f['error']){if(_0x15745f[_0x8eef('0x12')]['code']===0x1f4){logger[_0x8eef('0x12')](_0x8eef('0xd'),_0x22ead6,_0x15745f[_0x8eef('0x12')]['message']);return _0x5125d(_0x15745f[_0x8eef('0x12')][_0x8eef('0x13')]);}logger[_0x8eef('0x12')](_0x8eef('0xd'),_0x22ead6,_0x15745f[_0x8eef('0x12')][_0x8eef('0x13')]);return _0x3147db(_0x15745f[_0x8eef('0x12')][_0x8eef('0x13')]);}else{logger[_0x8eef('0x14')](_0x8eef('0xd'),_0x22ead6,_0x8eef('0xe'));_0x3147db(_0x15745f[_0x8eef('0x15')]['message']);}})[_0x8eef('0x16')](function(_0xa8d162){logger['error'](_0x8eef('0xd'),_0x22ead6,_0xa8d162);_0x5125d(_0xa8d162);});});} \ No newline at end of file +var _0x77aa=['bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','code','UserProfileResource,\x20%s,\x20%s','message','result','catch','lodash','util','moment'];(function(_0x2b3b54,_0x4e1f61){var _0x2ace43=function(_0x1d423e){while(--_0x1d423e){_0x2b3b54['push'](_0x2b3b54['shift']());}};_0x2ace43(++_0x4e1f61);}(_0x77aa,0x1dd));var _0xa77a=function(_0x18090a,_0x36e65b){_0x18090a=_0x18090a-0x0;var _0x1e593f=_0x77aa[_0x18090a];return _0x1e593f;};'use strict';var _=require(_0xa77a('0x0'));var util=require(_0xa77a('0x1'));var moment=require(_0xa77a('0x2'));var BPromise=require(_0xa77a('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa77a('0x4'));var db=require(_0xa77a('0x5'))['db'];var utils=require(_0xa77a('0x6'));var logger=require('../../config/logger')(_0xa77a('0x7'));var config=require(_0xa77a('0x8'));var jayson=require(_0xa77a('0x9'));var client=jayson[_0xa77a('0xa')][_0xa77a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x34e884,_0x54fe4a,_0x58ea91){return new BPromise(function(_0x3ff338,_0x3b7652){return client[_0xa77a('0xc')](_0x34e884,_0x58ea91)[_0xa77a('0xd')](function(_0x2fd576){logger[_0xa77a('0xe')]('UserProfileResource,\x20%s,\x20%s',_0x54fe4a,_0xa77a('0xf'));logger[_0xa77a('0x10')]('UserProfileResource,\x20%s,\x20%s,\x20%s',_0x54fe4a,'request\x20sent',JSON[_0xa77a('0x11')](_0x2fd576));if(_0x2fd576['error']){if(_0x2fd576[_0xa77a('0x12')][_0xa77a('0x13')]===0x1f4){logger[_0xa77a('0x12')](_0xa77a('0x14'),_0x54fe4a,_0x2fd576[_0xa77a('0x12')][_0xa77a('0x15')]);return _0x3b7652(_0x2fd576[_0xa77a('0x12')][_0xa77a('0x15')]);}logger[_0xa77a('0x12')]('UserProfileResource,\x20%s,\x20%s',_0x54fe4a,_0x2fd576[_0xa77a('0x12')][_0xa77a('0x15')]);return _0x3ff338(_0x2fd576[_0xa77a('0x12')]['message']);}else{logger[_0xa77a('0xe')](_0xa77a('0x14'),_0x54fe4a,_0xa77a('0xf'));_0x3ff338(_0x2fd576[_0xa77a('0x16')]['message']);}})[_0xa77a('0x17')](function(_0x4bb4a6){logger['error'](_0xa77a('0x14'),_0x54fe4a,_0x4bb4a6);_0x3b7652(_0x4bb4a6);});});} \ No newline at end of file diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index b5270f1..d593592 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 _0xb6e5=['destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./userProfileSection.controller','get','index','/describe','isAuthenticated','describe','/:id','put','update','delete'];(function(_0x304708,_0x243f40){var _0x5ea96e=function(_0xdbbdaf){while(--_0xdbbdaf){_0x304708['push'](_0x304708['shift']());}};_0x5ea96e(++_0x243f40);}(_0xb6e5,0x7a));var _0x5b6e=function(_0x1a75d6,_0x34c802){_0x1a75d6=_0x1a75d6-0x0;var _0x3e7e95=_0xb6e5[_0x1a75d6];return _0x3e7e95;};'use strict';var multer=require('multer');var util=require(_0x5b6e('0x0'));var path=require(_0x5b6e('0x1'));var timeout=require(_0x5b6e('0x2'));var express=require(_0x5b6e('0x3'));var router=express[_0x5b6e('0x4')]();var fs_extra=require(_0x5b6e('0x5'));var auth=require(_0x5b6e('0x6'));var interaction=require(_0x5b6e('0x7'));var config=require('../../config/environment');var controller=require(_0x5b6e('0x8'));router[_0x5b6e('0x9')]('/',auth['isAuthenticated'](),controller[_0x5b6e('0xa')]);router['get'](_0x5b6e('0xb'),auth[_0x5b6e('0xc')](),controller[_0x5b6e('0xd')]);router[_0x5b6e('0x9')](_0x5b6e('0xe'),auth[_0x5b6e('0xc')](),controller['show']);router['post']('/',auth[_0x5b6e('0xc')](),controller['create']);router[_0x5b6e('0xf')]('/:id',auth[_0x5b6e('0xc')](),controller[_0x5b6e('0x10')]);router[_0x5b6e('0x11')](_0x5b6e('0xe'),auth['isAuthenticated'](),controller[_0x5b6e('0x12')]);module[_0x5b6e('0x13')]=router; \ No newline at end of file +var _0x35cb=['../../components/auth/service','../../components/interaction/service','./userProfileSection.controller','get','isAuthenticated','index','/describe','/:id','show','create','put','update','delete','destroy','exports','multer','connect-timeout','express','fs-extra'];(function(_0x2bf4c4,_0x262fcb){var _0x2ae0c1=function(_0x2286f5){while(--_0x2286f5){_0x2bf4c4['push'](_0x2bf4c4['shift']());}};_0x2ae0c1(++_0x262fcb);}(_0x35cb,0xf3));var _0xb35c=function(_0x531c7c,_0x2e02ad){_0x531c7c=_0x531c7c-0x0;var _0xe9125=_0x35cb[_0x531c7c];return _0xe9125;};'use strict';var multer=require(_0xb35c('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xb35c('0x1'));var express=require(_0xb35c('0x2'));var router=express['Router']();var fs_extra=require(_0xb35c('0x3'));var auth=require(_0xb35c('0x4'));var interaction=require(_0xb35c('0x5'));var config=require('../../config/environment');var controller=require(_0xb35c('0x6'));router[_0xb35c('0x7')]('/',auth[_0xb35c('0x8')](),controller[_0xb35c('0x9')]);router[_0xb35c('0x7')](_0xb35c('0xa'),auth[_0xb35c('0x8')](),controller['describe']);router[_0xb35c('0x7')](_0xb35c('0xb'),auth[_0xb35c('0x8')](),controller[_0xb35c('0xc')]);router['post']('/',auth[_0xb35c('0x8')](),controller[_0xb35c('0xd')]);router[_0xb35c('0xe')]('/:id',auth[_0xb35c('0x8')](),controller[_0xb35c('0xf')]);router[_0xb35c('0x10')]('/:id',auth[_0xb35c('0x8')](),controller[_0xb35c('0x11')]);module[_0xb35c('0x12')]=router; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.attributes.js b/server/api/userProfileSection/userProfileSection.attributes.js index 55dbf80..bfcc688 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 _0x4024=['crudPermissions','split','sequelize','exports','STRING','INTEGER','BOOLEAN','setDataValue','getDataValue'];(function(_0x25cca1,_0x38e476){var _0x48b27a=function(_0x13aca2){while(--_0x13aca2){_0x25cca1['push'](_0x25cca1['shift']());}};_0x48b27a(++_0x38e476);}(_0x4024,0x89));var _0x4402=function(_0x3689fd,_0x47e501){_0x3689fd=_0x3689fd-0x0;var _0x507da5=_0x4024[_0x3689fd];return _0x507da5;};'use strict';var Sequelize=require(_0x4402('0x0'));module[_0x4402('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'category':{'type':Sequelize[_0x4402('0x2')],'allowNull':![]},'sectionId':{'type':Sequelize[_0x4402('0x3')],'allowNull':![]},'enabled':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0x4402('0x4')],'defaultValue':null},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0x950c82){this[_0x4402('0x5')]('crudPermissions',_0x950c82?_0x950c82['join'](''):[]);},'get':function(){return this[_0x4402('0x6')](_0x4402('0x7'))?this[_0x4402('0x6')]('crudPermissions')[_0x4402('0x8')](''):[];}}}; \ No newline at end of file +var _0xe820=['sequelize','STRING','BOOLEAN','setDataValue','join','getDataValue','crudPermissions'];(function(_0x15ef6b,_0x1ca233){var _0x561e29=function(_0x3ca073){while(--_0x3ca073){_0x15ef6b['push'](_0x15ef6b['shift']());}};_0x561e29(++_0x1ca233);}(_0xe820,0xd2));var _0x0e82=function(_0x392e1a,_0x1a2d38){_0x392e1a=_0x392e1a-0x0;var _0x3d70cb=_0xe820[_0x392e1a];return _0x3d70cb;};'use strict';var Sequelize=require(_0x0e82('0x0'));module['exports']={'name':{'type':Sequelize[_0x0e82('0x1')],'allowNull':![]},'category':{'type':Sequelize['STRING'],'allowNull':![]},'sectionId':{'type':Sequelize['INTEGER'],'allowNull':![]},'enabled':{'type':Sequelize[_0x0e82('0x2')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0x0e82('0x2')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0x0e82('0x1')],'set':function(_0x59b28d){this[_0x0e82('0x3')]('crudPermissions',_0x59b28d?_0x59b28d[_0x0e82('0x4')](''):[]);},'get':function(){return this[_0x0e82('0x5')](_0x0e82('0x6'))?this[_0x0e82('0x5')](_0x0e82('0x6'))['split'](''):[];}}}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.controller.js b/server/api/userProfileSection/userProfileSection.controller.js index 8c7371c..ae6564c 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 _0x77cb=['name','send','index','map','UserProfileSection','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','options','include','findAll','rows','catch','show','keys','includeAll','find','create','body','update','params','describe','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','offset','limit','undefined','count','Content-Range','apply','reject','save','then','destroy','sendStatus','error'];(function(_0x5a776b,_0x46f785){var _0xbbef59=function(_0x38313e){while(--_0x38313e){_0x5a776b['push'](_0x5a776b['shift']());}};_0xbbef59(++_0x46f785);}(_0x77cb,0x19b));var _0xb77c=function(_0x5c1f3b,_0x29ee0d){_0x5c1f3b=_0x5c1f3b-0x0;var _0xc5c830=_0x77cb[_0x5c1f3b];return _0xc5c830;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb77c('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb77c('0x1'));var rp=require(_0xb77c('0x2'));var moment=require(_0xb77c('0x3'));var BPromise=require(_0xb77c('0x4'));var Mustache=require(_0xb77c('0x5'));var util=require(_0xb77c('0x6'));var path=require(_0xb77c('0x7'));var sox=require(_0xb77c('0x8'));var csv=require('to-csv');var ejs=require(_0xb77c('0x9'));var fs=require('fs');var fs_extra=require(_0xb77c('0xa'));var _=require(_0xb77c('0xb'));var squel=require('squel');var crypto=require(_0xb77c('0xc'));var jsforce=require(_0xb77c('0xd'));var deskjs=require(_0xb77c('0xe'));var toCsv=require(_0xb77c('0xf'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xb77c('0x10'));var authService=require(_0xb77c('0x11'));var qs=require(_0xb77c('0x12'));var as=require(_0xb77c('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb77c('0x14'))('api');var utils=require(_0xb77c('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xb77c('0x16'));var db=require(_0xb77c('0x17'))['db'];function respondWithStatusCode(_0x434723,_0x450ce9){_0x450ce9=_0x450ce9||0xcc;return function(_0x77d611){if(_0x77d611){return _0x434723['sendStatus'](_0x450ce9);}return _0x434723[_0xb77c('0x18')](_0x450ce9)[_0xb77c('0x19')]();};}function respondWithResult(_0x1f944c,_0x3b8002){_0x3b8002=_0x3b8002||0xc8;return function(_0x36bfd3){if(_0x36bfd3){return _0x1f944c[_0xb77c('0x18')](_0x3b8002)[_0xb77c('0x1a')](_0x36bfd3);}};}function respondWithFilteredResult(_0x17e99d,_0x35e563){return function(_0x21aeb6){if(_0x21aeb6){var _0x234d2d=typeof _0x35e563[_0xb77c('0x1b')]==='undefined'&&typeof _0x35e563[_0xb77c('0x1c')]===_0xb77c('0x1d');var _0x7653bb=_0x21aeb6[_0xb77c('0x1e')];var _0x479ba6=_0x234d2d?0x0:_0x35e563[_0xb77c('0x1b')];var _0x57be08=_0x234d2d?_0x21aeb6[_0xb77c('0x1e')]:_0x35e563[_0xb77c('0x1b')]+_0x35e563['limit'];var _0x57f280;if(_0x57be08>=_0x7653bb){_0x57be08=_0x7653bb;_0x57f280=0xc8;}else{_0x57f280=0xce;}_0x17e99d[_0xb77c('0x18')](_0x57f280);return _0x17e99d['set'](_0xb77c('0x1f'),_0x479ba6+'-'+_0x57be08+'/'+_0x7653bb)[_0xb77c('0x1a')](_0x21aeb6);}return null;};}function patchUpdates(_0x2322a2){return function(_0x3d6417){try{jsonpatch[_0xb77c('0x20')](_0x3d6417,_0x2322a2,!![]);}catch(_0x366bc4){return BPromise[_0xb77c('0x21')](_0x366bc4);}return _0x3d6417[_0xb77c('0x22')]();};}function saveUpdates(_0x11c39d,_0x16cb19){return function(_0x603d1c){if(_0x603d1c){return _0x603d1c['update'](_0x11c39d)[_0xb77c('0x23')](function(_0x30428f){return _0x30428f;});}return null;};}function removeEntity(_0xaba966,_0x1fd55f){return function(_0x582336){if(_0x582336){return _0x582336[_0xb77c('0x24')]()[_0xb77c('0x23')](function(){_0xaba966['status'](0xcc)[_0xb77c('0x19')]();});}};}function handleEntityNotFound(_0x423c40,_0xcdcd71){return function(_0x2169c2){if(!_0x2169c2){_0x423c40[_0xb77c('0x25')](0x194);}return _0x2169c2;};}function handleError(_0x4d1ade,_0x49db3d){_0x49db3d=_0x49db3d||0x1f4;return function(_0x3c816a){logger[_0xb77c('0x26')](_0x3c816a['stack']);if(_0x3c816a[_0xb77c('0x27')]){delete _0x3c816a['name'];}_0x4d1ade[_0xb77c('0x18')](_0x49db3d)[_0xb77c('0x28')](_0x3c816a);};}exports[_0xb77c('0x29')]=function(_0x43b2ad,_0x2c2ac1){var _0x332c4d={},_0x1c7015={},_0x2bdff4={'count':0x0,'rows':[]};var _0x138dfc=_[_0xb77c('0x2a')](db[_0xb77c('0x2b')][_0xb77c('0x2c')],function(_0x261639){return{'name':_0x261639[_0xb77c('0x2d')],'type':_0x261639[_0xb77c('0x2e')][_0xb77c('0x2f')]};});_0x1c7015[_0xb77c('0x30')]=_[_0xb77c('0x2a')](_0x138dfc,_0xb77c('0x27'));_0x1c7015[_0xb77c('0x31')]=_['keys'](_0x43b2ad[_0xb77c('0x31')]);_0x1c7015['filters']=_[_0xb77c('0x32')](_0x1c7015['model'],_0x1c7015[_0xb77c('0x31')]);_0x332c4d[_0xb77c('0x33')]=_['intersection'](_0x1c7015[_0xb77c('0x30')],qs['fields'](_0x43b2ad['query'][_0xb77c('0x34')]));_0x332c4d[_0xb77c('0x33')]=_0x332c4d[_0xb77c('0x33')]['length']?_0x332c4d[_0xb77c('0x33')]:_0x1c7015[_0xb77c('0x30')];if(!_0x43b2ad['query'][_0xb77c('0x35')](_0xb77c('0x36'))){_0x332c4d['limit']=qs[_0xb77c('0x1c')](_0x43b2ad[_0xb77c('0x31')][_0xb77c('0x1c')]);_0x332c4d['offset']=qs[_0xb77c('0x1b')](_0x43b2ad[_0xb77c('0x31')][_0xb77c('0x1b')]);}_0x332c4d['order']=qs[_0xb77c('0x37')](_0x43b2ad[_0xb77c('0x31')][_0xb77c('0x37')]);_0x332c4d[_0xb77c('0x38')]=qs[_0xb77c('0x39')](_[_0xb77c('0x3a')](_0x43b2ad['query'],_0x1c7015[_0xb77c('0x39')]),_0x138dfc);if(_0x43b2ad[_0xb77c('0x31')][_0xb77c('0x3b')]){_0x332c4d['where']=_[_0xb77c('0x3c')](_0x332c4d[_0xb77c('0x38')],{'$or':_['map'](_0x138dfc,function(_0x280d84){if(_0x280d84[_0xb77c('0x2e')]!=='VIRTUAL'){var _0x31db26={};_0x31db26[_0x280d84['name']]={'$like':'%'+_0x43b2ad[_0xb77c('0x31')]['filter']+'%'};return _0x31db26;}})});}_0x332c4d=_[_0xb77c('0x3c')]({},_0x332c4d,_0x43b2ad[_0xb77c('0x3d')]);var _0x34e3a2={'where':_0x332c4d[_0xb77c('0x38')]};return db[_0xb77c('0x2b')]['count'](_0x34e3a2)[_0xb77c('0x23')](function(_0x33cc69){_0x2bdff4['count']=_0x33cc69;if(_0x43b2ad['query']['includeAll']){_0x332c4d[_0xb77c('0x3e')]=[{'all':!![]}];}return db[_0xb77c('0x2b')][_0xb77c('0x3f')](_0x332c4d);})[_0xb77c('0x23')](function(_0x4757dd){_0x2bdff4[_0xb77c('0x40')]=_0x4757dd;return _0x2bdff4;})['then'](respondWithFilteredResult(_0x2c2ac1,_0x332c4d))[_0xb77c('0x41')](handleError(_0x2c2ac1,null));};exports[_0xb77c('0x42')]=function(_0x19f565,_0x3b4498){var _0x4a02a1={'raw':![],'where':{'id':_0x19f565['params']['id']}},_0x2ae8f8={};_0x2ae8f8[_0xb77c('0x30')]=_[_0xb77c('0x43')](db['UserProfileSection']['rawAttributes']);_0x2ae8f8[_0xb77c('0x31')]=_[_0xb77c('0x43')](_0x19f565[_0xb77c('0x31')]);_0x2ae8f8['filters']=_[_0xb77c('0x32')](_0x2ae8f8[_0xb77c('0x30')],_0x2ae8f8[_0xb77c('0x31')]);_0x4a02a1[_0xb77c('0x33')]=_[_0xb77c('0x32')](_0x2ae8f8['model'],qs['fields'](_0x19f565[_0xb77c('0x31')][_0xb77c('0x34')]));_0x4a02a1[_0xb77c('0x33')]=_0x4a02a1[_0xb77c('0x33')]['length']?_0x4a02a1[_0xb77c('0x33')]:_0x2ae8f8[_0xb77c('0x30')];if(_0x19f565[_0xb77c('0x31')][_0xb77c('0x44')]){_0x4a02a1['include']=[{'all':!![]}];}_0x4a02a1=_[_0xb77c('0x3c')]({},_0x4a02a1,_0x19f565[_0xb77c('0x3d')]);return db[_0xb77c('0x2b')][_0xb77c('0x45')](_0x4a02a1)[_0xb77c('0x23')](handleEntityNotFound(_0x3b4498,null))['then'](respondWithResult(_0x3b4498,null))[_0xb77c('0x41')](handleError(_0x3b4498,null));};exports[_0xb77c('0x46')]=function(_0x32f568,_0x2a59d1){return db[_0xb77c('0x2b')]['create'](_0x32f568[_0xb77c('0x47')],{})[_0xb77c('0x23')](respondWithResult(_0x2a59d1,0xc9))[_0xb77c('0x41')](handleError(_0x2a59d1,null));};exports[_0xb77c('0x48')]=function(_0x530c0d,_0x159947){if(_0x530c0d[_0xb77c('0x47')]['id']){delete _0x530c0d[_0xb77c('0x47')]['id'];}return db[_0xb77c('0x2b')][_0xb77c('0x45')]({'where':{'id':_0x530c0d['params']['id']}})[_0xb77c('0x23')](handleEntityNotFound(_0x159947,null))[_0xb77c('0x23')](saveUpdates(_0x530c0d[_0xb77c('0x47')],null))[_0xb77c('0x23')](respondWithResult(_0x159947,null))[_0xb77c('0x41')](handleError(_0x159947,null));};exports[_0xb77c('0x24')]=function(_0x14445b,_0x3726d2){return db['UserProfileSection'][_0xb77c('0x45')]({'where':{'id':_0x14445b[_0xb77c('0x49')]['id']}})[_0xb77c('0x23')](handleEntityNotFound(_0x3726d2,null))[_0xb77c('0x23')](removeEntity(_0x3726d2,null))[_0xb77c('0x41')](handleError(_0x3726d2,null));};exports[_0xb77c('0x4a')]=function(_0x4d532d,_0x4ac3b0){return db[_0xb77c('0x2b')]['describe']()[_0xb77c('0x23')](respondWithResult(_0x4ac3b0,null))[_0xb77c('0x41')](handleError(_0x4ac3b0,null));}; \ No newline at end of file +var _0xb2b4=['eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','save','update','then','destroy','error','stack','send','index','map','UserProfileSection','type','key','model','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','VIRTUAL','include','findAll','rows','catch','params','rawAttributes','merge','options','find','create','body','describe'];(function(_0x450bf9,_0x1895de){var _0x268350=function(_0xebafa7){while(--_0xebafa7){_0x450bf9['push'](_0x450bf9['shift']());}};_0x268350(++_0x1895de);}(_0xb2b4,0x92));var _0x4b2b=function(_0x30faec,_0x18940b){_0x30faec=_0x30faec-0x0;var _0x29484f=_0xb2b4[_0x30faec];return _0x29484f;};'use strict';var emlformat=require(_0x4b2b('0x0'));var rimraf=require(_0x4b2b('0x1'));var zipdir=require(_0x4b2b('0x2'));var jsonpatch=require(_0x4b2b('0x3'));var rp=require(_0x4b2b('0x4'));var moment=require(_0x4b2b('0x5'));var BPromise=require(_0x4b2b('0x6'));var Mustache=require(_0x4b2b('0x7'));var util=require(_0x4b2b('0x8'));var path=require(_0x4b2b('0x9'));var sox=require('sox');var csv=require(_0x4b2b('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4b2b('0xb'));var _=require(_0x4b2b('0xc'));var squel=require('squel');var crypto=require(_0x4b2b('0xd'));var jsforce=require(_0x4b2b('0xe'));var deskjs=require(_0x4b2b('0xf'));var toCsv=require('to-csv');var querystring=require(_0x4b2b('0x10'));var Papa=require('papaparse');var Redis=require(_0x4b2b('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x4b2b('0x12'));var as=require(_0x4b2b('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4b2b('0x14'))(_0x4b2b('0x15'));var utils=require('../../config/utils');var config=require(_0x4b2b('0x16'));var licenseUtil=require(_0x4b2b('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x57c711,_0x1b09c2){_0x1b09c2=_0x1b09c2||0xcc;return function(_0x34b561){if(_0x34b561){return _0x57c711[_0x4b2b('0x18')](_0x1b09c2);}return _0x57c711[_0x4b2b('0x19')](_0x1b09c2)[_0x4b2b('0x1a')]();};}function respondWithResult(_0x272379,_0x6d03a2){_0x6d03a2=_0x6d03a2||0xc8;return function(_0x2aa35b){if(_0x2aa35b){return _0x272379[_0x4b2b('0x19')](_0x6d03a2)[_0x4b2b('0x1b')](_0x2aa35b);}};}function respondWithFilteredResult(_0x8eb4a4,_0x581d5d){return function(_0x273711){if(_0x273711){var _0x18267d=typeof _0x581d5d[_0x4b2b('0x1c')]===_0x4b2b('0x1d')&&typeof _0x581d5d[_0x4b2b('0x1e')]===_0x4b2b('0x1d');var _0x1f5d6f=_0x273711[_0x4b2b('0x1f')];var _0x3965a8=_0x18267d?0x0:_0x581d5d[_0x4b2b('0x1c')];var _0x310d8c=_0x18267d?_0x273711[_0x4b2b('0x1f')]:_0x581d5d['offset']+_0x581d5d[_0x4b2b('0x1e')];var _0x4756ec;if(_0x310d8c>=_0x1f5d6f){_0x310d8c=_0x1f5d6f;_0x4756ec=0xc8;}else{_0x4756ec=0xce;}_0x8eb4a4['status'](_0x4756ec);return _0x8eb4a4[_0x4b2b('0x20')]('Content-Range',_0x3965a8+'-'+_0x310d8c+'/'+_0x1f5d6f)[_0x4b2b('0x1b')](_0x273711);}return null;};}function patchUpdates(_0x3e8e79){return function(_0x1943b6){try{jsonpatch[_0x4b2b('0x21')](_0x1943b6,_0x3e8e79,!![]);}catch(_0x144f2b){return BPromise['reject'](_0x144f2b);}return _0x1943b6[_0x4b2b('0x22')]();};}function saveUpdates(_0x10f420,_0x5cd149){return function(_0x301c55){if(_0x301c55){return _0x301c55[_0x4b2b('0x23')](_0x10f420)[_0x4b2b('0x24')](function(_0x3e4e1c){return _0x3e4e1c;});}return null;};}function removeEntity(_0x47fdac,_0x197a1d){return function(_0x29b2c4){if(_0x29b2c4){return _0x29b2c4[_0x4b2b('0x25')]()[_0x4b2b('0x24')](function(){_0x47fdac[_0x4b2b('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x555b80,_0x11797d){return function(_0x2c3b20){if(!_0x2c3b20){_0x555b80[_0x4b2b('0x18')](0x194);}return _0x2c3b20;};}function handleError(_0x57ef85,_0x5717e1){_0x5717e1=_0x5717e1||0x1f4;return function(_0x108fc0){logger[_0x4b2b('0x26')](_0x108fc0[_0x4b2b('0x27')]);if(_0x108fc0['name']){delete _0x108fc0['name'];}_0x57ef85[_0x4b2b('0x19')](_0x5717e1)[_0x4b2b('0x28')](_0x108fc0);};}exports[_0x4b2b('0x29')]=function(_0x3490ad,_0x5ec2a2){var _0x512b43={},_0x37dba1={},_0x236da4={'count':0x0,'rows':[]};var _0x7b1e5b=_[_0x4b2b('0x2a')](db[_0x4b2b('0x2b')]['rawAttributes'],function(_0x363292){return{'name':_0x363292['fieldName'],'type':_0x363292[_0x4b2b('0x2c')][_0x4b2b('0x2d')]};});_0x37dba1[_0x4b2b('0x2e')]=_['map'](_0x7b1e5b,_0x4b2b('0x2f'));_0x37dba1[_0x4b2b('0x30')]=_[_0x4b2b('0x31')](_0x3490ad[_0x4b2b('0x30')]);_0x37dba1[_0x4b2b('0x32')]=_[_0x4b2b('0x33')](_0x37dba1[_0x4b2b('0x2e')],_0x37dba1['query']);_0x512b43[_0x4b2b('0x34')]=_[_0x4b2b('0x33')](_0x37dba1[_0x4b2b('0x2e')],qs[_0x4b2b('0x35')](_0x3490ad[_0x4b2b('0x30')][_0x4b2b('0x35')]));_0x512b43[_0x4b2b('0x34')]=_0x512b43[_0x4b2b('0x34')][_0x4b2b('0x36')]?_0x512b43['attributes']:_0x37dba1[_0x4b2b('0x2e')];if(!_0x3490ad[_0x4b2b('0x30')][_0x4b2b('0x37')]('nolimit')){_0x512b43[_0x4b2b('0x1e')]=qs[_0x4b2b('0x1e')](_0x3490ad[_0x4b2b('0x30')][_0x4b2b('0x1e')]);_0x512b43[_0x4b2b('0x1c')]=qs[_0x4b2b('0x1c')](_0x3490ad[_0x4b2b('0x30')][_0x4b2b('0x1c')]);}_0x512b43['order']=qs[_0x4b2b('0x38')](_0x3490ad[_0x4b2b('0x30')][_0x4b2b('0x38')]);_0x512b43[_0x4b2b('0x39')]=qs[_0x4b2b('0x32')](_[_0x4b2b('0x3a')](_0x3490ad[_0x4b2b('0x30')],_0x37dba1[_0x4b2b('0x32')]),_0x7b1e5b);if(_0x3490ad['query'][_0x4b2b('0x3b')]){_0x512b43[_0x4b2b('0x39')]=_['merge'](_0x512b43[_0x4b2b('0x39')],{'$or':_[_0x4b2b('0x2a')](_0x7b1e5b,function(_0x1a696a){if(_0x1a696a['type']!==_0x4b2b('0x3c')){var _0x408549={};_0x408549[_0x1a696a[_0x4b2b('0x2f')]]={'$like':'%'+_0x3490ad[_0x4b2b('0x30')][_0x4b2b('0x3b')]+'%'};return _0x408549;}})});}_0x512b43=_['merge']({},_0x512b43,_0x3490ad['options']);var _0x508ef9={'where':_0x512b43['where']};return db['UserProfileSection'][_0x4b2b('0x1f')](_0x508ef9)[_0x4b2b('0x24')](function(_0x40433f){_0x236da4[_0x4b2b('0x1f')]=_0x40433f;if(_0x3490ad[_0x4b2b('0x30')]['includeAll']){_0x512b43[_0x4b2b('0x3d')]=[{'all':!![]}];}return db[_0x4b2b('0x2b')][_0x4b2b('0x3e')](_0x512b43);})[_0x4b2b('0x24')](function(_0x261be2){_0x236da4[_0x4b2b('0x3f')]=_0x261be2;return _0x236da4;})[_0x4b2b('0x24')](respondWithFilteredResult(_0x5ec2a2,_0x512b43))[_0x4b2b('0x40')](handleError(_0x5ec2a2,null));};exports['show']=function(_0x585574,_0x413085){var _0x1b688c={'raw':![],'where':{'id':_0x585574[_0x4b2b('0x41')]['id']}},_0x4434b6={};_0x4434b6[_0x4b2b('0x2e')]=_[_0x4b2b('0x31')](db[_0x4b2b('0x2b')][_0x4b2b('0x42')]);_0x4434b6[_0x4b2b('0x30')]=_[_0x4b2b('0x31')](_0x585574[_0x4b2b('0x30')]);_0x4434b6[_0x4b2b('0x32')]=_['intersection'](_0x4434b6[_0x4b2b('0x2e')],_0x4434b6['query']);_0x1b688c[_0x4b2b('0x34')]=_[_0x4b2b('0x33')](_0x4434b6['model'],qs[_0x4b2b('0x35')](_0x585574[_0x4b2b('0x30')]['fields']));_0x1b688c[_0x4b2b('0x34')]=_0x1b688c[_0x4b2b('0x34')][_0x4b2b('0x36')]?_0x1b688c['attributes']:_0x4434b6[_0x4b2b('0x2e')];if(_0x585574[_0x4b2b('0x30')]['includeAll']){_0x1b688c['include']=[{'all':!![]}];}_0x1b688c=_[_0x4b2b('0x43')]({},_0x1b688c,_0x585574[_0x4b2b('0x44')]);return db[_0x4b2b('0x2b')][_0x4b2b('0x45')](_0x1b688c)[_0x4b2b('0x24')](handleEntityNotFound(_0x413085,null))[_0x4b2b('0x24')](respondWithResult(_0x413085,null))[_0x4b2b('0x40')](handleError(_0x413085,null));};exports[_0x4b2b('0x46')]=function(_0x1e9d1b,_0x22304d){return db[_0x4b2b('0x2b')]['create'](_0x1e9d1b[_0x4b2b('0x47')],{})[_0x4b2b('0x24')](respondWithResult(_0x22304d,0xc9))['catch'](handleError(_0x22304d,null));};exports[_0x4b2b('0x23')]=function(_0x4dfae3,_0x4dc669){if(_0x4dfae3['body']['id']){delete _0x4dfae3[_0x4b2b('0x47')]['id'];}return db[_0x4b2b('0x2b')][_0x4b2b('0x45')]({'where':{'id':_0x4dfae3[_0x4b2b('0x41')]['id']}})['then'](handleEntityNotFound(_0x4dc669,null))[_0x4b2b('0x24')](saveUpdates(_0x4dfae3[_0x4b2b('0x47')],null))[_0x4b2b('0x24')](respondWithResult(_0x4dc669,null))['catch'](handleError(_0x4dc669,null));};exports[_0x4b2b('0x25')]=function(_0x27d21a,_0x26e91a){return db['UserProfileSection']['find']({'where':{'id':_0x27d21a[_0x4b2b('0x41')]['id']}})[_0x4b2b('0x24')](handleEntityNotFound(_0x26e91a,null))[_0x4b2b('0x24')](removeEntity(_0x26e91a,null))[_0x4b2b('0x40')](handleError(_0x26e91a,null));};exports[_0x4b2b('0x48')]=function(_0x1e8803,_0x555614){return db['UserProfileSection'][_0x4b2b('0x48')]()[_0x4b2b('0x24')](respondWithResult(_0x555614,null))[_0x4b2b('0x40')](handleError(_0x555614,null));}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index 3476ec6..ef325df 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 _0x6463=['request-promise','rimraf','../../config/environment','./userProfileSection.attributes','user_profile_has_sections','compositeIndex','userProfileId','util','../../config/logger','api','moment'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x6463,0xb7));var _0x3646=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6463[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x3646('0x0'));var logger=require(_0x3646('0x1'))(_0x3646('0x2'));var moment=require(_0x3646('0x3'));var BPromise=require('bluebird');var rp=require(_0x3646('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3646('0x5'));var config=require(_0x3646('0x6'));var attributes=require(_0x3646('0x7'));module['exports']=function(_0x6a6798,_0x3de8e2){return _0x6a6798['define']('UserProfileSection',attributes,{'tableName':_0x3646('0x8'),'paranoid':![],'indexes':[{'name':_0x3646('0x9'),'fields':['sectionId',_0x3646('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x20cc=['moment','bluebird','path','rimraf','../../config/environment','./userProfileSection.attributes','exports','define','UserProfileSection','user_profile_has_sections','compositeIndex','userProfileId','lodash','util','../../config/logger','api'];(function(_0x70800b,_0x18c90c){var _0x8db856=function(_0xc60d3d){while(--_0xc60d3d){_0x70800b['push'](_0x70800b['shift']());}};_0x8db856(++_0x18c90c);}(_0x20cc,0x1ac));var _0xc20c=function(_0x32d457,_0x1a39c9){_0x32d457=_0x32d457-0x0;var _0x338386=_0x20cc[_0x32d457];return _0x338386;};'use strict';var _=require(_0xc20c('0x0'));var util=require(_0xc20c('0x1'));var logger=require(_0xc20c('0x2'))(_0xc20c('0x3'));var moment=require(_0xc20c('0x4'));var BPromise=require(_0xc20c('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc20c('0x6'));var rimraf=require(_0xc20c('0x7'));var config=require(_0xc20c('0x8'));var attributes=require(_0xc20c('0x9'));module[_0xc20c('0xa')]=function(_0x3344e0,_0x60bd42){return _0x3344e0[_0xc20c('0xb')](_0xc20c('0xc'),attributes,{'tableName':_0xc20c('0xd'),'paranoid':![],'indexes':[{'name':_0xc20c('0xe'),'fields':['sectionId',_0xc20c('0xf')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.rpc.js b/server/api/userProfileSection/userProfileSection.rpc.js index bc261cc..cf1fe70 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 _0x711a=['UserProfileSection,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','UserProfileSection,\x20%s,\x20%s','message','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','debug'];(function(_0x3503e8,_0xb9e08b){var _0xc5668=function(_0x477ba8){while(--_0x477ba8){_0x3503e8['push'](_0x3503e8['shift']());}};_0xc5668(++_0xb9e08b);}(_0x711a,0x14a));var _0xa711=function(_0x524e76,_0x38c12d){_0x524e76=_0x524e76-0x0;var _0x5826c6=_0x711a[_0x524e76];return _0x5826c6;};'use strict';var _=require(_0xa711('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xa711('0x1'));var rs=require(_0xa711('0x2'));var fs=require('fs');var Redis=require(_0xa711('0x3'));var db=require(_0xa711('0x4'))['db'];var utils=require(_0xa711('0x5'));var logger=require(_0xa711('0x6'))(_0xa711('0x7'));var config=require(_0xa711('0x8'));var jayson=require(_0xa711('0x9'));var client=jayson[_0xa711('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3a8ddc,_0x1232a3,_0x218614){return new BPromise(function(_0x29b84b,_0x318cca){return client[_0xa711('0xb')](_0x3a8ddc,_0x218614)[_0xa711('0xc')](function(_0x3fb0ef){logger[_0xa711('0xd')]('UserProfileSection,\x20%s,\x20%s',_0x1232a3,'request\x20sent');logger[_0xa711('0xe')](_0xa711('0xf'),_0x1232a3,_0xa711('0x10'),JSON[_0xa711('0x11')](_0x3fb0ef));if(_0x3fb0ef[_0xa711('0x12')]){if(_0x3fb0ef[_0xa711('0x12')][_0xa711('0x13')]===0x1f4){logger[_0xa711('0x12')](_0xa711('0x14'),_0x1232a3,_0x3fb0ef[_0xa711('0x12')][_0xa711('0x15')]);return _0x318cca(_0x3fb0ef[_0xa711('0x12')][_0xa711('0x15')]);}logger[_0xa711('0x12')](_0xa711('0x14'),_0x1232a3,_0x3fb0ef[_0xa711('0x12')][_0xa711('0x15')]);return _0x29b84b(_0x3fb0ef[_0xa711('0x12')]['message']);}else{logger[_0xa711('0xd')](_0xa711('0x14'),_0x1232a3,_0xa711('0x10'));_0x29b84b(_0x3fb0ef['result'][_0xa711('0x15')]);}})[_0xa711('0x16')](function(_0x168363){logger[_0xa711('0x12')](_0xa711('0x14'),_0x1232a3,_0x168363);_0x318cca(_0x168363);});});} \ No newline at end of file +var _0xbb41=['request\x20sent','UserProfileSection,\x20%s,\x20%s,\x20%s','stringify','code','error','UserProfileSection,\x20%s,\x20%s','message','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x4a4225,_0x3d9bf8){var _0x1a6109=function(_0x27946e){while(--_0x27946e){_0x4a4225['push'](_0x4a4225['shift']());}};_0x1a6109(++_0x3d9bf8);}(_0xbb41,0xf9));var _0x1bb4=function(_0x490dca,_0x5c745e){_0x490dca=_0x490dca-0x0;var _0x31ee2=_0xbb41[_0x490dca];return _0x31ee2;};'use strict';var _=require(_0x1bb4('0x0'));var util=require(_0x1bb4('0x1'));var moment=require(_0x1bb4('0x2'));var BPromise=require(_0x1bb4('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1bb4('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x1bb4('0x5'));var logger=require(_0x1bb4('0x6'))(_0x1bb4('0x7'));var config=require(_0x1bb4('0x8'));var jayson=require(_0x1bb4('0x9'));var client=jayson[_0x1bb4('0xa')][_0x1bb4('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5ab235,_0x5852ad,_0x2709c3){return new BPromise(function(_0x35a03c,_0x1350ae){return client[_0x1bb4('0xc')](_0x5ab235,_0x2709c3)[_0x1bb4('0xd')](function(_0x3f0468){logger[_0x1bb4('0xe')]('UserProfileSection,\x20%s,\x20%s',_0x5852ad,_0x1bb4('0xf'));logger['debug'](_0x1bb4('0x10'),_0x5852ad,_0x1bb4('0xf'),JSON[_0x1bb4('0x11')](_0x3f0468));if(_0x3f0468['error']){if(_0x3f0468['error'][_0x1bb4('0x12')]===0x1f4){logger[_0x1bb4('0x13')](_0x1bb4('0x14'),_0x5852ad,_0x3f0468[_0x1bb4('0x13')][_0x1bb4('0x15')]);return _0x1350ae(_0x3f0468[_0x1bb4('0x13')][_0x1bb4('0x15')]);}logger[_0x1bb4('0x13')](_0x1bb4('0x14'),_0x5852ad,_0x3f0468[_0x1bb4('0x13')][_0x1bb4('0x15')]);return _0x35a03c(_0x3f0468[_0x1bb4('0x13')]['message']);}else{logger[_0x1bb4('0xe')](_0x1bb4('0x14'),_0x5852ad,_0x1bb4('0xf'));_0x35a03c(_0x3f0468['result']['message']);}})['catch'](function(_0x25265e){logger[_0x1bb4('0x13')](_0x1bb4('0x14'),_0x5852ad,_0x25265e);_0x1350ae(_0x25265e);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index 05966cd..3a8e016 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 _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x336281,_0x50b7c1){var _0x4935f5=function(_0x341e50){while(--_0x341e50){_0x336281['push'](_0x336281['shift']());}};_0x4935f5(++_0x50b7c1);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x36d25e,_0x1a047d){_0x36d25e=_0x36d25e-0x0;var _0x4b95b8=_0xcb91[_0x36d25e];return _0x4b95b8;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file +var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x2e5ce0,_0x135679){var _0x2e2a78=function(_0x30775c){while(--_0x30775c){_0x2e5ce0['push'](_0x2e5ce0['shift']());}};_0x2e2a78(++_0x135679);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.attributes.js b/server/api/userSmsQueue/userSmsQueue.attributes.js index 3feb302..155550c 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 _0x1135=['INTEGER','sequelize'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x1135,0x119));var _0x5113=function(_0x468a5a,_0x366cb2){_0x468a5a=_0x468a5a-0x0;var _0x255887=_0x1135[_0x468a5a];return _0x255887;};'use strict';var Sequelize=require(_0x5113('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x5113('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xcad2=['exports','INTEGER'];(function(_0x1a205e,_0x3a8f61){var _0x3be50c=function(_0x33862a){while(--_0x33862a){_0x1a205e['push'](_0x1a205e['shift']());}};_0x3be50c(++_0x3a8f61);}(_0xcad2,0x120));var _0x2cad=function(_0x211cd7,_0x10bed4){_0x211cd7=_0x211cd7-0x0;var _0xf525a3=_0xcad2[_0x211cd7];return _0xf525a3;};'use strict';var Sequelize=require('sequelize');module[_0x2cad('0x0')]={'penalty':{'type':Sequelize[_0x2cad('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.model.js b/server/api/userSmsQueue/userSmsQueue.model.js index 1dc9a44..8622b49 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 _0x7a54=['../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./userSmsQueue.attributes','exports','UserSmsQueue','user_has_sms_queues','lodash','util'];(function(_0x5b682f,_0x3befac){var _0x47f01b=function(_0xe2c7be){while(--_0xe2c7be){_0x5b682f['push'](_0x5b682f['shift']());}};_0x47f01b(++_0x3befac);}(_0x7a54,0x106));var _0x47a5=function(_0xb66a16,_0x28ca86){_0xb66a16=_0xb66a16-0x0;var _0x5c8431=_0x7a54[_0xb66a16];return _0x5c8431;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf61e=['bluebird','request-promise','path','rimraf','../../config/environment','./userSmsQueue.attributes','exports','define','user_has_sms_queues','lodash','util','../../config/logger','api','moment'];(function(_0x39db27,_0xd5a898){var _0x45b4f7=function(_0x111b6b){while(--_0x111b6b){_0x39db27['push'](_0x39db27['shift']());}};_0x45b4f7(++_0xd5a898);}(_0xf61e,0x191));var _0xef61=function(_0x2e03e3,_0x20521c){_0x2e03e3=_0x2e03e3-0x0;var _0x29b58f=_0xf61e[_0x2e03e3];return _0x29b58f;};'use strict';var _=require(_0xef61('0x0'));var util=require(_0xef61('0x1'));var logger=require(_0xef61('0x2'))(_0xef61('0x3'));var moment=require(_0xef61('0x4'));var BPromise=require(_0xef61('0x5'));var rp=require(_0xef61('0x6'));var fs=require('fs');var path=require(_0xef61('0x7'));var rimraf=require(_0xef61('0x8'));var config=require(_0xef61('0x9'));var attributes=require(_0xef61('0xa'));module[_0xef61('0xb')]=function(_0x5b00b2,_0x9e17f4){return _0x5b00b2[_0xef61('0xc')]('UserSmsQueue',attributes,{'tableName':_0xef61('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.rpc.js b/server/api/userSmsQueue/userSmsQueue.rpc.js index 89ac60e..27d79ad 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 _0x2922=['../../config/utils','../../config/logger','rpc','http','request','then','info','UserSmsQueue,\x20%s,\x20%s','request\x20sent','debug','UserSmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','bluebird','ioredis','../../mysqldb'];(function(_0x3165a8,_0x2c3f5e){var _0x365307=function(_0x425009){while(--_0x425009){_0x3165a8['push'](_0x3165a8['shift']());}};_0x365307(++_0x2c3f5e);}(_0x2922,0x1b4));var _0x2292=function(_0x27c1f2,_0x3a3b9d){_0x27c1f2=_0x27c1f2-0x0;var _0x5ea234=_0x2922[_0x27c1f2];return _0x5ea234;};'use strict';var _=require(_0x2292('0x0'));var util=require(_0x2292('0x1'));var moment=require('moment');var BPromise=require(_0x2292('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2292('0x3'));var db=require(_0x2292('0x4'))['db'];var utils=require(_0x2292('0x5'));var logger=require(_0x2292('0x6'))(_0x2292('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x2292('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x31137b,_0x3f338a,_0x305be0){return new BPromise(function(_0x42c665,_0x959cd){return client[_0x2292('0x9')](_0x31137b,_0x305be0)[_0x2292('0xa')](function(_0x1b1268){logger[_0x2292('0xb')](_0x2292('0xc'),_0x3f338a,_0x2292('0xd'));logger[_0x2292('0xe')](_0x2292('0xf'),_0x3f338a,_0x2292('0xd'),JSON[_0x2292('0x10')](_0x1b1268));if(_0x1b1268[_0x2292('0x11')]){if(_0x1b1268[_0x2292('0x11')][_0x2292('0x12')]===0x1f4){logger[_0x2292('0x11')]('UserSmsQueue,\x20%s,\x20%s',_0x3f338a,_0x1b1268[_0x2292('0x11')][_0x2292('0x13')]);return _0x959cd(_0x1b1268[_0x2292('0x11')]['message']);}logger['error'](_0x2292('0xc'),_0x3f338a,_0x1b1268['error'][_0x2292('0x13')]);return _0x42c665(_0x1b1268[_0x2292('0x11')][_0x2292('0x13')]);}else{logger['info'](_0x2292('0xc'),_0x3f338a,_0x2292('0xd'));_0x42c665(_0x1b1268['result']['message']);}})[_0x2292('0x14')](function(_0x5b2d0c){logger['error'](_0x2292('0xc'),_0x3f338a,_0x5b2d0c);_0x959cd(_0x5b2d0c);});});} \ No newline at end of file +var _0xb0b2=['randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','http','then','UserSmsQueue,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','result','lodash','util','bluebird'];(function(_0x5c9dde,_0x2b01a7){var _0x5cd179=function(_0x4eb02f){while(--_0x4eb02f){_0x5c9dde['push'](_0x5c9dde['shift']());}};_0x5cd179(++_0x2b01a7);}(_0xb0b2,0x153));var _0x2b0b=function(_0x2dbe0a,_0x764655){_0x2dbe0a=_0x2dbe0a-0x0;var _0x1f2c04=_0xb0b2[_0x2dbe0a];return _0x1f2c04;};'use strict';var _=require(_0x2b0b('0x0'));var util=require(_0x2b0b('0x1'));var moment=require('moment');var BPromise=require(_0x2b0b('0x2'));var rs=require(_0x2b0b('0x3'));var fs=require('fs');var Redis=require(_0x2b0b('0x4'));var db=require(_0x2b0b('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x2b0b('0x6'));var config=require(_0x2b0b('0x7'));var jayson=require(_0x2b0b('0x8'));var client=jayson['client'][_0x2b0b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x396442,_0x14f7e5,_0x48131b){return new BPromise(function(_0x7cb8e4,_0x526517){return client['request'](_0x396442,_0x48131b)[_0x2b0b('0xa')](function(_0x30861a){logger['info'](_0x2b0b('0xb'),_0x14f7e5,_0x2b0b('0xc'));logger[_0x2b0b('0xd')]('UserSmsQueue,\x20%s,\x20%s,\x20%s',_0x14f7e5,_0x2b0b('0xc'),JSON['stringify'](_0x30861a));if(_0x30861a[_0x2b0b('0xe')]){if(_0x30861a[_0x2b0b('0xe')][_0x2b0b('0xf')]===0x1f4){logger[_0x2b0b('0xe')](_0x2b0b('0xb'),_0x14f7e5,_0x30861a[_0x2b0b('0xe')][_0x2b0b('0x10')]);return _0x526517(_0x30861a['error'][_0x2b0b('0x10')]);}logger[_0x2b0b('0xe')]('UserSmsQueue,\x20%s,\x20%s',_0x14f7e5,_0x30861a['error']['message']);return _0x7cb8e4(_0x30861a[_0x2b0b('0xe')][_0x2b0b('0x10')]);}else{logger[_0x2b0b('0x11')](_0x2b0b('0xb'),_0x14f7e5,_0x2b0b('0xc'));_0x7cb8e4(_0x30861a[_0x2b0b('0x12')]['message']);}})['catch'](function(_0xf2dfdf){logger[_0x2b0b('0xe')](_0x2b0b('0xb'),_0x14f7e5,_0xf2dfdf);_0x526517(_0xf2dfdf);});});} \ No newline at end of file diff --git a/server/api/userVoicePrefix/index.js b/server/api/userVoicePrefix/index.js deleted file mode 100644 index dff1488..0000000 --- a/server/api/userVoicePrefix/index.js +++ /dev/null @@ -1,18 +0,0 @@ -// ************************************************************************* -// * * -// * xCALLY Motion - The Omnichannel Contact Center * -// * Copyright (c) Xenialab s.r.l. All Rights Reserved * -// * * -// ************************************************************************* -// * * -// * Email: info@xcally.com * -// * Website: https://www.xcally.com * -// * * -// ************************************************************************* -// * * -// * The SOFTWARE PRODUCT is protected by copyright laws and international * -// * copyright treaties, as well as other intellectual property laws and * -// * treaties. The SOFTWARE PRODUCT is licensed, not sold. * -// * * -// ************************************************************************* -var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x4f83ea,_0x4b484e){var _0x3e41f6=function(_0x5cfcdc){while(--_0x5cfcdc){_0x4f83ea['push'](_0x4f83ea['shift']());}};_0x3e41f6(++_0x4b484e);}(_0x9c44,0x178));var _0x49c4=function(_0x550d12,_0x5384bd){_0x550d12=_0x550d12-0x0;var _0x12103d=_0x9c44[_0x550d12];return _0x12103d;};'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/userVoicePrefix/userVoicePrefix.attributes.js b/server/api/userVoicePrefix/userVoicePrefix.attributes.js index 24b60f9..78fa8c0 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 _0x4080=['exports','sequelize'];(function(_0x292fc9,_0x5d982b){var _0x57c52b=function(_0xf33773){while(--_0xf33773){_0x292fc9['push'](_0x292fc9['shift']());}};_0x57c52b(++_0x5d982b);}(_0x4080,0x1ad));var _0x0408=function(_0x350343,_0x256f69){_0x350343=_0x350343-0x0;var _0x9afc1c=_0x4080[_0x350343];return _0x9afc1c;};'use strict';var Sequelize=require(_0x0408('0x0'));module[_0x0408('0x1')]={'UserId':{'type':Sequelize['INTEGER']},'VoicePrefixId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x98c5=['exports','INTEGER','sequelize'];(function(_0x5eff93,_0x53e6c7){var _0xfb2f7a=function(_0x2c09a6){while(--_0x2c09a6){_0x5eff93['push'](_0x5eff93['shift']());}};_0xfb2f7a(++_0x53e6c7);}(_0x98c5,0x161));var _0x598c=function(_0x4914ba,_0x3a22ca){_0x4914ba=_0x4914ba-0x0;var _0x339e50=_0x98c5[_0x4914ba];return _0x339e50;};'use strict';var Sequelize=require(_0x598c('0x0'));module[_0x598c('0x1')]={'UserId':{'type':Sequelize[_0x598c('0x2')]},'VoicePrefixId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.model.js b/server/api/userVoicePrefix/userVoicePrefix.model.js index b76dd67..7a8b66b 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(_0x3e338c,_0x32fdcd){var _0x322a19=function(_0x2de733){while(--_0x2de733){_0x3e338c['push'](_0x3e338c['shift']());}};_0x322a19(++_0x32fdcd);}(_0xa9e0,0x123));var _0x0a9e=function(_0x139a3c,_0x4fc883){_0x139a3c=_0x139a3c-0x0;var _0x2b375b=_0xa9e0[_0x139a3c];return _0x2b375b;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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(_0x1f76d6,_0x5efa0f){var _0x210d68=function(_0xdbe390){while(--_0xdbe390){_0x1f76d6['push'](_0x1f76d6['shift']());}};_0x210d68(++_0x5efa0f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x387777,_0x356171){_0x387777=_0x387777-0x0;var _0x3f84c0=_0xa9e0[_0x387777];return _0x3f84c0;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'user_has_voice_prefixes','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.rpc.js b/server/api/userVoicePrefix/userVoicePrefix.rpc.js deleted file mode 100644 index b9af116..0000000 --- a/server/api/userVoicePrefix/userVoicePrefix.rpc.js +++ /dev/null @@ -1,18 +0,0 @@ -// ************************************************************************* -// * * -// * xCALLY Motion - The Omnichannel Contact Center * -// * Copyright (c) Xenialab s.r.l. All Rights Reserved * -// * * -// ************************************************************************* -// * * -// * Email: info@xcally.com * -// * Website: https://www.xcally.com * -// * * -// ************************************************************************* -// * * -// * The SOFTWARE PRODUCT is protected by copyright laws and international * -// * copyright treaties, as well as other intellectual property laws and * -// * treaties. The SOFTWARE PRODUCT is licensed, not sold. * -// * * -// ************************************************************************* -var _0xa73e=['../../config/environment','jayson/promise','http','request','then','info','UserVoicePrefix,\x20%s,\x20%s','request\x20sent','debug','UserVoicePrefix,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x16f537,_0x25e0c8){var _0x2b6951=function(_0x2c7eaf){while(--_0x2c7eaf){_0x16f537['push'](_0x16f537['shift']());}};_0x2b6951(++_0x25e0c8);}(_0xa73e,0xbf));var _0xea73=function(_0x62fcf1,_0x4e0b8c){_0x62fcf1=_0x62fcf1-0x0;var _0x3a6f1d=_0xa73e[_0x62fcf1];return _0x3a6f1d;};'use strict';var _=require('lodash');var util=require(_0xea73('0x0'));var moment=require(_0xea73('0x1'));var BPromise=require(_0xea73('0x2'));var rs=require(_0xea73('0x3'));var fs=require('fs');var Redis=require(_0xea73('0x4'));var db=require(_0xea73('0x5'))['db'];var utils=require(_0xea73('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xea73('0x7'));var jayson=require(_0xea73('0x8'));var client=jayson['client'][_0xea73('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2623b0,_0x4692b3,_0x1704f0){return new BPromise(function(_0x2402a4,_0xd085c9){return client[_0xea73('0xa')](_0x2623b0,_0x1704f0)[_0xea73('0xb')](function(_0x747901){logger[_0xea73('0xc')](_0xea73('0xd'),_0x4692b3,_0xea73('0xe'));logger[_0xea73('0xf')](_0xea73('0x10'),_0x4692b3,_0xea73('0xe'),JSON[_0xea73('0x11')](_0x747901));if(_0x747901[_0xea73('0x12')]){if(_0x747901[_0xea73('0x12')][_0xea73('0x13')]===0x1f4){logger['error'](_0xea73('0xd'),_0x4692b3,_0x747901[_0xea73('0x12')][_0xea73('0x14')]);return _0xd085c9(_0x747901['error'][_0xea73('0x14')]);}logger[_0xea73('0x12')](_0xea73('0xd'),_0x4692b3,_0x747901[_0xea73('0x12')]['message']);return _0x2402a4(_0x747901[_0xea73('0x12')][_0xea73('0x14')]);}else{logger[_0xea73('0xc')]('UserVoicePrefix,\x20%s,\x20%s',_0x4692b3,_0xea73('0xe'));_0x2402a4(_0x747901['result']['message']);}})[_0xea73('0x15')](function(_0xf1a9c7){logger['error']('UserVoicePrefix,\x20%s,\x20%s',_0x4692b3,_0xf1a9c7);_0xd085c9(_0xf1a9c7);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueue/index.js b/server/api/userVoiceQueue/index.js index 74af53f..a3a0e0e 100644 --- a/server/api/userVoiceQueue/index.js +++ b/server/api/userVoiceQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x160954,_0x894789){var _0xf6bef8=function(_0x33a33e){while(--_0x33a33e){_0x160954['push'](_0x160954['shift']());}};_0xf6bef8(++_0x894789);}(_0x70e0,0x17b));var _0x070e=function(_0x1362ff,_0xea0a19){_0x1362ff=_0x1362ff-0x0;var _0x51c736=_0x70e0[_0x1362ff];return _0x51c736;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file +var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x43c6ba,_0x1fd999){var _0x16de5e=function(_0x5494c6){while(--_0x5494c6){_0x43c6ba['push'](_0x43c6ba['shift']());}};_0x16de5e(++_0x1fd999);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x67f95e,_0x3ca797){_0x67f95e=_0x67f95e-0x0;var _0x538f5a=_0xcb91[_0x67f95e];return _0x538f5a;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.attributes.js b/server/api/userVoiceQueue/userVoiceQueue.attributes.js index 866e340..6fa552a 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 _0xe51f=['sequelize','exports','INTEGER'];(function(_0x2a21a,_0x4a0abd){var _0x320b31=function(_0x1dd8af){while(--_0x1dd8af){_0x2a21a['push'](_0x2a21a['shift']());}};_0x320b31(++_0x4a0abd);}(_0xe51f,0x19b));var _0xfe51=function(_0xd3d35a,_0x4c5967){_0xd3d35a=_0xd3d35a-0x0;var _0x29e6b7=_0xe51f[_0xd3d35a];return _0x29e6b7;};'use strict';var Sequelize=require(_0xfe51('0x0'));module[_0xfe51('0x1')]={'penalty':{'type':Sequelize[_0xfe51('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x3f20=['INTEGER','sequelize'];(function(_0x429c08,_0x37c7af){var _0x1606c8=function(_0x24ef5b){while(--_0x24ef5b){_0x429c08['push'](_0x429c08['shift']());}};_0x1606c8(++_0x37c7af);}(_0x3f20,0x137));var _0x03f2=function(_0x2ce06f,_0x59556d){_0x2ce06f=_0x2ce06f-0x0;var _0x378432=_0x3f20[_0x2ce06f];return _0x378432;};'use strict';var Sequelize=require(_0x03f2('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x03f2('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.model.js b/server/api/userVoiceQueue/userVoiceQueue.model.js index 11397e0..8504dac 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 _0x581d=['user_has_voice_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userVoiceQueue.attributes','UserVoiceQueue'];(function(_0x18ceb5,_0x1beb00){var _0x24381f=function(_0x28457a){while(--_0x28457a){_0x18ceb5['push'](_0x18ceb5['shift']());}};_0x24381f(++_0x1beb00);}(_0x581d,0x76));var _0xd581=function(_0x13b683,_0x3013aa){_0x13b683=_0x13b683-0x0;var _0x4044a0=_0x581d[_0x13b683];return _0x4044a0;};'use strict';var _=require(_0xd581('0x0'));var util=require(_0xd581('0x1'));var logger=require(_0xd581('0x2'))(_0xd581('0x3'));var moment=require(_0xd581('0x4'));var BPromise=require(_0xd581('0x5'));var rp=require(_0xd581('0x6'));var fs=require('fs');var path=require(_0xd581('0x7'));var rimraf=require(_0xd581('0x8'));var config=require(_0xd581('0x9'));var attributes=require(_0xd581('0xa'));module['exports']=function(_0xa6411b,_0x530d4d){return _0xa6411b['define'](_0xd581('0xb'),attributes,{'tableName':_0xd581('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xaaf0=['path','rimraf','../../config/environment','./userVoiceQueue.attributes','exports','UserVoiceQueue','user_has_voice_queues','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x309d93,_0x157662){var _0x2dd61d=function(_0x25ff34){while(--_0x25ff34){_0x309d93['push'](_0x309d93['shift']());}};_0x2dd61d(++_0x157662);}(_0xaaf0,0x166));var _0x0aaf=function(_0x20b53c,_0x43450c){_0x20b53c=_0x20b53c-0x0;var _0x54ebcb=_0xaaf0[_0x20b53c];return _0x54ebcb;};'use strict';var _=require(_0x0aaf('0x0'));var util=require(_0x0aaf('0x1'));var logger=require(_0x0aaf('0x2'))(_0x0aaf('0x3'));var moment=require('moment');var BPromise=require(_0x0aaf('0x4'));var rp=require(_0x0aaf('0x5'));var fs=require('fs');var path=require(_0x0aaf('0x6'));var rimraf=require(_0x0aaf('0x7'));var config=require(_0x0aaf('0x8'));var attributes=require(_0x0aaf('0x9'));module[_0x0aaf('0xa')]=function(_0x1aa932,_0x33a803){return _0x1aa932['define'](_0x0aaf('0xb'),attributes,{'tableName':_0x0aaf('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.rpc.js b/server/api/userVoiceQueue/userVoiceQueue.rpc.js index 8dc9ec8..6ef912e 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 _0xe727=['request\x20sent','debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','request','info','UserVoiceQueue,\x20%s,\x20%s'];(function(_0x2ca4fd,_0x1611cc){var _0x24d1cd=function(_0x22ed79){while(--_0x22ed79){_0x2ca4fd['push'](_0x2ca4fd['shift']());}};_0x24d1cd(++_0x1611cc);}(_0xe727,0xd9));var _0x7e72=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0xe727[_0x2d7f0e];return _0x110b07;};'use strict';var _=require(_0x7e72('0x0'));var util=require(_0x7e72('0x1'));var moment=require(_0x7e72('0x2'));var BPromise=require(_0x7e72('0x3'));var rs=require(_0x7e72('0x4'));var fs=require('fs');var Redis=require(_0x7e72('0x5'));var db=require(_0x7e72('0x6'))['db'];var utils=require(_0x7e72('0x7'));var logger=require(_0x7e72('0x8'))(_0x7e72('0x9'));var config=require(_0x7e72('0xa'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2d1e82,_0x4c8b3a,_0x197f55){return new BPromise(function(_0x40e829,_0x231be6){return client[_0x7e72('0xb')](_0x2d1e82,_0x197f55)['then'](function(_0x432aaa){logger[_0x7e72('0xc')](_0x7e72('0xd'),_0x4c8b3a,_0x7e72('0xe'));logger[_0x7e72('0xf')](_0x7e72('0x10'),_0x4c8b3a,_0x7e72('0xe'),JSON['stringify'](_0x432aaa));if(_0x432aaa[_0x7e72('0x11')]){if(_0x432aaa[_0x7e72('0x11')]['code']===0x1f4){logger['error'](_0x7e72('0xd'),_0x4c8b3a,_0x432aaa[_0x7e72('0x11')]['message']);return _0x231be6(_0x432aaa[_0x7e72('0x11')][_0x7e72('0x12')]);}logger[_0x7e72('0x11')](_0x7e72('0xd'),_0x4c8b3a,_0x432aaa[_0x7e72('0x11')][_0x7e72('0x12')]);return _0x40e829(_0x432aaa['error']['message']);}else{logger[_0x7e72('0xc')](_0x7e72('0xd'),_0x4c8b3a,'request\x20sent');_0x40e829(_0x432aaa[_0x7e72('0x13')][_0x7e72('0x12')]);}})[_0x7e72('0x14')](function(_0x23abc3){logger['error'](_0x7e72('0xd'),_0x4c8b3a,_0x23abc3);_0x231be6(_0x23abc3);});});} \ No newline at end of file +var _0xbb38=['moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','UserVoiceQueue,\x20%s,\x20%s','stringify','error','message','info','request\x20sent','result','util'];(function(_0x36c5b0,_0x5001da){var _0xf19333=function(_0x1e880a){while(--_0x1e880a){_0x36c5b0['push'](_0x36c5b0['shift']());}};_0xf19333(++_0x5001da);}(_0xbb38,0xe3));var _0x8bb3=function(_0x3a8b7c,_0x3e5db2){_0x3a8b7c=_0x3a8b7c-0x0;var _0x40eb80=_0xbb38[_0x3a8b7c];return _0x40eb80;};'use strict';var _=require('lodash');var util=require(_0x8bb3('0x0'));var moment=require(_0x8bb3('0x1'));var BPromise=require(_0x8bb3('0x2'));var rs=require(_0x8bb3('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8bb3('0x4'))['db'];var utils=require(_0x8bb3('0x5'));var logger=require('../../config/logger')(_0x8bb3('0x6'));var config=require('../../config/environment');var jayson=require(_0x8bb3('0x7'));var client=jayson[_0x8bb3('0x8')][_0x8bb3('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2d6b87,_0x4526bf,_0x202ddb){return new BPromise(function(_0x366e9d,_0x1ac797){return client[_0x8bb3('0xa')](_0x2d6b87,_0x202ddb)[_0x8bb3('0xb')](function(_0x161582){logger['info'](_0x8bb3('0xc'),_0x4526bf,'request\x20sent');logger['debug']('UserVoiceQueue,\x20%s,\x20%s,\x20%s',_0x4526bf,'request\x20sent',JSON[_0x8bb3('0xd')](_0x161582));if(_0x161582[_0x8bb3('0xe')]){if(_0x161582[_0x8bb3('0xe')]['code']===0x1f4){logger['error'](_0x8bb3('0xc'),_0x4526bf,_0x161582[_0x8bb3('0xe')][_0x8bb3('0xf')]);return _0x1ac797(_0x161582[_0x8bb3('0xe')][_0x8bb3('0xf')]);}logger['error'](_0x8bb3('0xc'),_0x4526bf,_0x161582[_0x8bb3('0xe')]['message']);return _0x366e9d(_0x161582['error']['message']);}else{logger[_0x8bb3('0x10')](_0x8bb3('0xc'),_0x4526bf,_0x8bb3('0x11'));_0x366e9d(_0x161582[_0x8bb3('0x12')][_0x8bb3('0xf')]);}})['catch'](function(_0x58be0a){logger[_0x8bb3('0xe')]('UserVoiceQueue,\x20%s,\x20%s',_0x4526bf,_0x58be0a);_0x1ac797(_0x58be0a);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index fe9a800..19d6255 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 _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x16481b,_0x3f3ba7){var _0x420bcd=function(_0x397e4d){while(--_0x397e4d){_0x16481b['push'](_0x16481b['shift']());}};_0x420bcd(++_0x3f3ba7);}(_0x70e0,0x17b));var _0x070e=function(_0x2438c3,_0x14c94c){_0x2438c3=_0x2438c3-0x0;var _0x6a70da=_0x70e0[_0x2438c3];return _0x6a70da;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file +var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x3d91a1,_0x50fb94){var _0x2f781b=function(_0x432fec){while(--_0x432fec){_0x3d91a1['push'](_0x3d91a1['shift']());}};_0x2f781b(++_0x50fb94);}(_0xe706,0xa3));var _0x6e70=function(_0x13bcbb,_0x2eb915){_0x13bcbb=_0x13bcbb-0x0;var _0x457c81=_0xe706[_0x13bcbb];return _0x457c81;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js index 8e33619..c897206 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 _0x189b=['INTEGER','STRING','Required\x20by\x20Asterisk','queue_interface','sequelize'];(function(_0x8fb7a4,_0x607700){var _0x1fdca2=function(_0x300754){while(--_0x300754){_0x8fb7a4['push'](_0x8fb7a4['shift']());}};_0x1fdca2(++_0x607700);}(_0x189b,0x15d));var _0xb189=function(_0x26a901,_0x29dd83){_0x26a901=_0x26a901-0x0;var _0x305c2a=_0x189b[_0x26a901];return _0x305c2a;};'use strict';var Sequelize=require(_0xb189('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xb189('0x1')],'primaryKey':!![],'autoIncrement':!![],'comment':'Required\x20by\x20Asterisk'},'membername':{'type':Sequelize[_0xb189('0x2')],'allowNull':![],'comment':_0xb189('0x3')},'UserId':{'type':Sequelize[_0xb189('0x1')],'allowNull':![]},'queue_name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xb189('0x4'),'comment':_0xb189('0x3')},'VoiceQueueId':{'type':Sequelize['INTEGER'],'allowNull':![]},'interface':{'type':Sequelize[_0xb189('0x2')],'allowNull':![],'unique':_0xb189('0x4'),'comment':_0xb189('0x3')},'penalty':{'type':Sequelize[_0xb189('0x1')](0xb),'defaultValue':0x0,'comment':'Required\x20by\x20Asterisk'},'paused':{'type':Sequelize[_0xb189('0x1')](0xb),'defaultValue':0x0,'comment':_0xb189('0x3')}}; \ No newline at end of file +var _0x4701=['INTEGER','Required\x20by\x20Asterisk','STRING','queue_interface','exports'];(function(_0x45943a,_0x594756){var _0x96f728=function(_0x3de100){while(--_0x3de100){_0x45943a['push'](_0x45943a['shift']());}};_0x96f728(++_0x594756);}(_0x4701,0x1da));var _0x1470=function(_0x51ceae,_0x27bde8){_0x51ceae=_0x51ceae-0x0;var _0x28de08=_0x4701[_0x51ceae];return _0x28de08;};'use strict';var Sequelize=require('sequelize');module[_0x1470('0x0')]={'uniqueid':{'type':Sequelize[_0x1470('0x1')],'primaryKey':!![],'autoIncrement':!![],'comment':_0x1470('0x2')},'membername':{'type':Sequelize[_0x1470('0x3')],'allowNull':![],'comment':_0x1470('0x2')},'UserId':{'type':Sequelize[_0x1470('0x1')],'allowNull':![]},'queue_name':{'type':Sequelize[_0x1470('0x3')],'allowNull':![],'unique':_0x1470('0x4'),'comment':_0x1470('0x2')},'VoiceQueueId':{'type':Sequelize['INTEGER'],'allowNull':![]},'interface':{'type':Sequelize[_0x1470('0x3')],'allowNull':![],'unique':_0x1470('0x4'),'comment':_0x1470('0x2')},'penalty':{'type':Sequelize[_0x1470('0x1')](0xb),'defaultValue':0x0,'comment':_0x1470('0x2')},'paused':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'comment':_0x1470('0x2')}}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js index b8601d3..b92dd61 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 _0xb67c=['exports','UserVoiceQueueRt','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x40ba7b,_0x4aa904){var _0x56fcef=function(_0x59b2c6){while(--_0x59b2c6){_0x40ba7b['push'](_0x40ba7b['shift']());}};_0x56fcef(++_0x4aa904);}(_0xb67c,0x149));var _0xcb67=function(_0x3dd822,_0x3b9fed){_0x3dd822=_0x3dd822-0x0;var _0x4f58d0=_0xb67c[_0x3dd822];return _0x4f58d0;};'use strict';var EventEmitter=require('events');var UserVoiceQueueRt=require('../../mysqldb')['db'][_0xcb67('0x0')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xcb67('0x1'),'afterUpdate':_0xcb67('0x2'),'afterDestroy':_0xcb67('0x3')};function emitEvent(_0x2b056e){return function(_0xe9b7b0,_0x27ca95,_0x577097){UserVoiceQueueRtEvents['emit'](_0x2b056e+':'+_0xe9b7b0['id'],_0xe9b7b0);UserVoiceQueueRtEvents[_0xcb67('0x4')](_0x2b056e,_0xe9b7b0);_0x577097(null);};}for(var e in events){if(events[_0xcb67('0x5')](e)){var event=events[e];UserVoiceQueueRt[_0xcb67('0x6')](e,emitEvent(event));}}module[_0xcb67('0x7')]=UserVoiceQueueRtEvents; \ No newline at end of file +var _0xa3b2=['update','remove','emit','hasOwnProperty','hook','events','../../mysqldb','UserVoiceQueueRt','setMaxListeners','save'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa3b2,0x13b));var _0x2a3b=function(_0x47f7ec,_0x369f9d){_0x47f7ec=_0x47f7ec-0x0;var _0x415101=_0xa3b2[_0x47f7ec];return _0x415101;};'use strict';var EventEmitter=require(_0x2a3b('0x0'));var UserVoiceQueueRt=require(_0x2a3b('0x1'))['db'][_0x2a3b('0x2')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0x2a3b('0x3')](0x0);var events={'afterCreate':_0x2a3b('0x4'),'afterUpdate':_0x2a3b('0x5'),'afterDestroy':_0x2a3b('0x6')};function emitEvent(_0x58a406){return function(_0x4690e1,_0x1fcb6b,_0x5347c0){UserVoiceQueueRtEvents[_0x2a3b('0x7')](_0x58a406+':'+_0x4690e1['id'],_0x4690e1);UserVoiceQueueRtEvents[_0x2a3b('0x7')](_0x58a406,_0x4690e1);_0x5347c0(null);};}for(var e in events){if(events[_0x2a3b('0x8')](e)){var event=events[e];UserVoiceQueueRt[_0x2a3b('0x9')](e,emitEvent(event));}}module['exports']=UserVoiceQueueRtEvents; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js index 525f3f8..54e6af8 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 _0x2cc6=['util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./userVoiceQueueRt.attributes','exports','define','user_has_voice_queues_rt','lodash'];(function(_0xdef91c,_0x28dbab){var _0x225a4e=function(_0xea90cd){while(--_0xea90cd){_0xdef91c['push'](_0xdef91c['shift']());}};_0x225a4e(++_0x28dbab);}(_0x2cc6,0xb5));var _0x62cc=function(_0x4cfc35,_0xb52690){_0x4cfc35=_0x4cfc35-0x0;var _0x43a384=_0x2cc6[_0x4cfc35];return _0x43a384;};'use strict';var _=require(_0x62cc('0x0'));var util=require(_0x62cc('0x1'));var logger=require(_0x62cc('0x2'))(_0x62cc('0x3'));var moment=require(_0x62cc('0x4'));var BPromise=require(_0x62cc('0x5'));var rp=require(_0x62cc('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x62cc('0x7'));var config=require(_0x62cc('0x8'));var attributes=require(_0x62cc('0x9'));module[_0x62cc('0xa')]=function(_0x9940be,_0x519963){return _0x9940be[_0x62cc('0xb')]('UserVoiceQueueRt',attributes,{'tableName':_0x62cc('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xff86=['rimraf','../../config/environment','exports','define','UserVoiceQueueRt','lodash','util','../../config/logger','moment','path'];(function(_0x2a4172,_0x5bd9f1){var _0x24e48d=function(_0x241747){while(--_0x241747){_0x2a4172['push'](_0x2a4172['shift']());}};_0x24e48d(++_0x5bd9f1);}(_0xff86,0x9b));var _0x6ff8=function(_0x5d5d33,_0x2a434b){_0x5d5d33=_0x5d5d33-0x0;var _0x25becf=_0xff86[_0x5d5d33];return _0x25becf;};'use strict';var _=require(_0x6ff8('0x0'));var util=require(_0x6ff8('0x1'));var logger=require(_0x6ff8('0x2'))('api');var moment=require(_0x6ff8('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x6ff8('0x4'));var rimraf=require(_0x6ff8('0x5'));var config=require(_0x6ff8('0x6'));var attributes=require('./userVoiceQueueRt.attributes');module[_0x6ff8('0x7')]=function(_0x324e41,_0x56a103){return _0x324e41[_0x6ff8('0x8')](_0x6ff8('0x9'),attributes,{'tableName':'user_has_voice_queues_rt','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.rpc.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.rpc.js index 8ebb7e1..a44de47 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 _0x7b88=['./userVoiceQueueRt.socket','register','then','info','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetVoiceQueueRtPauses','options','raw','where','sequelize','COUNT','`paused`\x20=\x201,\x201,\x20null','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter'];(function(_0x4ba5d0,_0x4c08e3){var _0x22c193=function(_0x3536ba){while(--_0x3536ba){_0x4ba5d0['push'](_0x4ba5d0['shift']());}};_0x22c193(++_0x4c08e3);}(_0x7b88,0x7a));var _0x87b8=function(_0x1da527,_0x2dc953){_0x1da527=_0x1da527-0x0;var _0x40fc7c=_0x7b88[_0x1da527];return _0x40fc7c;};'use strict';var _=require(_0x87b8('0x0'));var util=require(_0x87b8('0x1'));var moment=require(_0x87b8('0x2'));var BPromise=require(_0x87b8('0x3'));var rs=require(_0x87b8('0x4'));var fs=require('fs');var Redis=require(_0x87b8('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x87b8('0x6'))('rpc');var config=require(_0x87b8('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x87b8('0x8')][_0x87b8('0x9')]({'port':0x232a});config[_0x87b8('0xa')]=_[_0x87b8('0xb')](config[_0x87b8('0xa')],{'host':_0x87b8('0xc'),'port':0x18eb});var socket=require(_0x87b8('0xd'))(new Redis(config['redis']));require(_0x87b8('0xe'))[_0x87b8('0xf')](socket);function respondWithRpcPromise(_0xd72258,_0x210152,_0x49a3a3){return new BPromise(function(_0x57b411,_0x479e89){return client['request'](_0xd72258,_0x49a3a3)[_0x87b8('0x10')](function(_0x108704){logger[_0x87b8('0x11')](_0x87b8('0x12'),_0x210152,_0x87b8('0x13'));logger[_0x87b8('0x14')](_0x87b8('0x15'),_0x210152,'request\x20sent',JSON[_0x87b8('0x16')](_0x108704));if(_0x108704['error']){if(_0x108704[_0x87b8('0x17')]['code']===0x1f4){logger[_0x87b8('0x17')](_0x87b8('0x12'),_0x210152,_0x108704[_0x87b8('0x17')][_0x87b8('0x18')]);return _0x479e89(_0x108704[_0x87b8('0x17')][_0x87b8('0x18')]);}logger[_0x87b8('0x17')](_0x87b8('0x12'),_0x210152,_0x108704['error']['message']);return _0x57b411(_0x108704['error'][_0x87b8('0x18')]);}else{logger['info'](_0x87b8('0x12'),_0x210152,_0x87b8('0x13'));_0x57b411(_0x108704[_0x87b8('0x19')]['message']);}})[_0x87b8('0x1a')](function(_0x2a3054){logger[_0x87b8('0x17')](_0x87b8('0x12'),_0x210152,_0x2a3054);_0x479e89(_0x2a3054);});});}exports[_0x87b8('0x1b')]=function(_0x154744){var _0x970ff4=this;return new Promise(function(_0x3a9452,_0x43ff6f){return db['UserVoiceQueueRt']['findAll']({'raw':_0x154744['options']?_0x154744[_0x87b8('0x1c')][_0x87b8('0x1d')]===undefined?!![]:![]:!![],'where':_0x154744[_0x87b8('0x1c')]?_0x154744[_0x87b8('0x1c')][_0x87b8('0x1e')]||null:null,'attributes':[[db[_0x87b8('0x1f')]['fn'](_0x87b8('0x20'),db[_0x87b8('0x1f')]['fn']('IF',db[_0x87b8('0x1f')]['literal'](_0x87b8('0x21')))),'outboundQueuePauses']]})[_0x87b8('0x10')](function(_0x3c606e){logger[_0x87b8('0x11')](_0x87b8('0x1b'),_0x154744);logger[_0x87b8('0x14')]('GetVoiceQueueRtPauses',_0x154744,JSON[_0x87b8('0x16')](_0x3c606e));_0x3a9452(_0x3c606e);})[_0x87b8('0x1a')](function(_0x2cb534){logger['error'](_0x87b8('0x1b'),_0x2cb534[_0x87b8('0x18')],_0x154744);_0x43ff6f(_0x970ff4[_0x87b8('0x17')](0x1f4,_0x2cb534[_0x87b8('0x18')]));});});}; \ No newline at end of file +var _0x452f=['UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','UserVoiceQueueRt','findAll','options','raw','where','sequelize','COUNT','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','util','bluebird','randomstring','../../config/utils','../../config/environment','jayson/promise','client','http','redis','localhost','register','then','info'];(function(_0x1f9f37,_0x18776e){var _0x21c080=function(_0x4acb93){while(--_0x4acb93){_0x1f9f37['push'](_0x1f9f37['shift']());}};_0x21c080(++_0x18776e);}(_0x452f,0xad));var _0xf452=function(_0xb65e77,_0x238c3d){_0xb65e77=_0xb65e77-0x0;var _0x38134b=_0x452f[_0xb65e77];return _0x38134b;};'use strict';var _=require('lodash');var util=require(_0xf452('0x0'));var moment=require('moment');var BPromise=require(_0xf452('0x1'));var rs=require(_0xf452('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xf452('0x3'));var logger=require('../../config/logger')('rpc');var config=require(_0xf452('0x4'));var jayson=require(_0xf452('0x5'));var client=jayson[_0xf452('0x6')][_0xf452('0x7')]({'port':0x232a});config[_0xf452('0x8')]=_['defaults'](config[_0xf452('0x8')],{'host':_0xf452('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf452('0x8')]));require('./userVoiceQueueRt.socket')[_0xf452('0xa')](socket);function respondWithRpcPromise(_0x4a4b54,_0x3539ca,_0x52de42){return new BPromise(function(_0x4a5405,_0x5c0fb6){return client['request'](_0x4a4b54,_0x52de42)[_0xf452('0xb')](function(_0xd0839f){logger[_0xf452('0xc')](_0xf452('0xd'),_0x3539ca,_0xf452('0xe'));logger[_0xf452('0xf')](_0xf452('0x10'),_0x3539ca,_0xf452('0xe'),JSON[_0xf452('0x11')](_0xd0839f));if(_0xd0839f['error']){if(_0xd0839f[_0xf452('0x12')][_0xf452('0x13')]===0x1f4){logger[_0xf452('0x12')](_0xf452('0xd'),_0x3539ca,_0xd0839f['error'][_0xf452('0x14')]);return _0x5c0fb6(_0xd0839f[_0xf452('0x12')][_0xf452('0x14')]);}logger[_0xf452('0x12')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x3539ca,_0xd0839f[_0xf452('0x12')][_0xf452('0x14')]);return _0x4a5405(_0xd0839f['error'][_0xf452('0x14')]);}else{logger['info']('UserVoiceQueueRt,\x20%s,\x20%s',_0x3539ca,'request\x20sent');_0x4a5405(_0xd0839f[_0xf452('0x15')]['message']);}})['catch'](function(_0x3a11fd){logger[_0xf452('0x12')](_0xf452('0xd'),_0x3539ca,_0x3a11fd);_0x5c0fb6(_0x3a11fd);});});}exports['GetVoiceQueueRtPauses']=function(_0x3758ba){var _0xd26f3c=this;return new Promise(function(_0x24f277,_0xd532e){return db[_0xf452('0x16')][_0xf452('0x17')]({'raw':_0x3758ba[_0xf452('0x18')]?_0x3758ba[_0xf452('0x18')][_0xf452('0x19')]===undefined?!![]:![]:!![],'where':_0x3758ba[_0xf452('0x18')]?_0x3758ba[_0xf452('0x18')][_0xf452('0x1a')]||null:null,'attributes':[[db[_0xf452('0x1b')]['fn'](_0xf452('0x1c'),db[_0xf452('0x1b')]['fn']('IF',db[_0xf452('0x1b')]['literal'](_0xf452('0x1d')))),_0xf452('0x1e')]]})['then'](function(_0x54ad87){logger[_0xf452('0xc')]('GetVoiceQueueRtPauses',_0x3758ba);logger[_0xf452('0xf')]('GetVoiceQueueRtPauses',_0x3758ba,JSON[_0xf452('0x11')](_0x54ad87));_0x24f277(_0x54ad87);})['catch'](function(_0x17149d){logger[_0xf452('0x12')]('GetVoiceQueueRtPauses',_0x17149d[_0xf452('0x14')],_0x3758ba);_0xd532e(_0xd26f3c[_0xf452('0x12')](0x1f4,_0x17149d[_0xf452('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index 350db4d..35cabdd 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 _0x9829=['remove','update','emit','removeListener','register','length','userVoiceQueueRt:','./userVoiceQueueRt.events','save'];(function(_0x50c710,_0x504134){var _0x2d5f79=function(_0x73e66c){while(--_0x73e66c){_0x50c710['push'](_0x50c710['shift']());}};_0x2d5f79(++_0x504134);}(_0x9829,0xc4));var _0x9982=function(_0x308213,_0x224541){_0x308213=_0x308213-0x0;var _0x2e1619=_0x9829[_0x308213];return _0x2e1619;};'use strict';var UserVoiceQueueRtEvents=require(_0x9982('0x0'));var events=[_0x9982('0x1'),_0x9982('0x2'),_0x9982('0x3')];function createListener(_0x338564,_0x4c01a9){return function(_0x399b6c){_0x4c01a9[_0x9982('0x4')](_0x338564,_0x399b6c);};}function removeListener(_0x2f782a,_0x4bee19){return function(){UserVoiceQueueRtEvents[_0x9982('0x5')](_0x2f782a,_0x4bee19);};}exports[_0x9982('0x6')]=function(_0x58f8fe){for(var _0x500dfd=0x0,_0x340d62=events[_0x9982('0x7')];_0x500dfd<_0x340d62;_0x500dfd++){var _0x5d0824=events[_0x500dfd];var _0x25f30a=createListener(_0x9982('0x8')+_0x5d0824,_0x58f8fe);UserVoiceQueueRtEvents['on'](_0x5d0824,_0x25f30a);}}; \ No newline at end of file +var _0x8ce1=['removeListener','register','./userVoiceQueueRt.events','save','remove','update'];(function(_0x1c580c,_0x1d673a){var _0x3108d9=function(_0x53a595){while(--_0x53a595){_0x1c580c['push'](_0x1c580c['shift']());}};_0x3108d9(++_0x1d673a);}(_0x8ce1,0x152));var _0x18ce=function(_0x40a5b6,_0x26186e){_0x40a5b6=_0x40a5b6-0x0;var _0x351a8e=_0x8ce1[_0x40a5b6];return _0x351a8e;};'use strict';var UserVoiceQueueRtEvents=require(_0x18ce('0x0'));var events=[_0x18ce('0x1'),_0x18ce('0x2'),_0x18ce('0x3')];function createListener(_0x2bb843,_0x2a3465){return function(_0x2617a2){_0x2a3465['emit'](_0x2bb843,_0x2617a2);};}function removeListener(_0x194532,_0xcffe1d){return function(){UserVoiceQueueRtEvents[_0x18ce('0x4')](_0x194532,_0xcffe1d);};}exports[_0x18ce('0x5')]=function(_0x532604){for(var _0x17d12a=0x0,_0x2008ca=events['length'];_0x17d12a<_0x2008ca;_0x17d12a++){var _0x3481fe=events[_0x17d12a];var _0x3e7646=createListener('userVoiceQueueRt:'+_0x3481fe,_0x532604);UserVoiceQueueRtEvents['on'](_0x3481fe,_0x3e7646);}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/index.js b/server/api/userWhatsappQueue/index.js index 1b44d73..421b893 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 _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x2d1ee7,_0x3f22f0){var _0x1a40fb=function(_0xcceeb8){while(--_0xcceeb8){_0x2d1ee7['push'](_0x2d1ee7['shift']());}};_0x1a40fb(++_0x3f22f0);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x16cb03,_0x43ea58){_0x16cb03=_0x16cb03-0x0;var _0x10944e=_0xcb91[_0x16cb03];return _0x10944e;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file +var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x34ba5c,_0xda4615){var _0x1555f9=function(_0x3b7c7b){while(--_0x3b7c7b){_0x34ba5c['push'](_0x34ba5c['shift']());}};_0x1555f9(++_0xda4615);}(_0xe706,0xa3));var _0x6e70=function(_0x3c5d9b,_0x16f3f1){_0x3c5d9b=_0x3c5d9b-0x0;var _0x557a6e=_0xe706[_0x3c5d9b];return _0x557a6e;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js b/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js index 6d32187..3494c36 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 _0xb2c0=['sequelize','INTEGER'];(function(_0x39f648,_0x1e9ff3){var _0x53546a=function(_0x23fab6){while(--_0x23fab6){_0x39f648['push'](_0x39f648['shift']());}};_0x53546a(++_0x1e9ff3);}(_0xb2c0,0x110));var _0x0b2c=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xb2c0[_0x2dafbe];return _0x58a45a;};'use strict';var Sequelize=require(_0x0b2c('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x0b2c('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x7947=['sequelize','INTEGER'];(function(_0x174ef5,_0x256e8e){var _0x1cc379=function(_0x3eafcf){while(--_0x3eafcf){_0x174ef5['push'](_0x174ef5['shift']());}};_0x1cc379(++_0x256e8e);}(_0x7947,0x192));var _0x7794=function(_0x2f7d3d,_0x1c9cde){_0x2f7d3d=_0x2f7d3d-0x0;var _0xf081c1=_0x7947[_0x2f7d3d];return _0xf081c1;};'use strict';var Sequelize=require(_0x7794('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x7794('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.model.js b/server/api/userWhatsappQueue/userWhatsappQueue.model.js index 9ecc7ff..1a0b768 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 _0x3c45=['path','rimraf','../../config/environment','exports','define','UserWhatsappQueue','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x496f2c,_0x333179){var _0x242388=function(_0x13f0a4){while(--_0x13f0a4){_0x496f2c['push'](_0x496f2c['shift']());}};_0x242388(++_0x333179);}(_0x3c45,0x1c0));var _0x53c4=function(_0x454f02,_0x32ce79){_0x454f02=_0x454f02-0x0;var _0x3369f7=_0x3c45[_0x454f02];return _0x3369f7;};'use strict';var _=require(_0x53c4('0x0'));var util=require(_0x53c4('0x1'));var logger=require(_0x53c4('0x2'))(_0x53c4('0x3'));var moment=require(_0x53c4('0x4'));var BPromise=require(_0x53c4('0x5'));var rp=require(_0x53c4('0x6'));var fs=require('fs');var path=require(_0x53c4('0x7'));var rimraf=require(_0x53c4('0x8'));var config=require(_0x53c4('0x9'));var attributes=require('./userWhatsappQueue.attributes');module[_0x53c4('0xa')]=function(_0x29c1e7,_0x471c92){return _0x29c1e7[_0x53c4('0xb')](_0x53c4('0xc'),attributes,{'tableName':'user_has_whatsapp_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7c8b=['rimraf','../../config/environment','exports','define','user_has_whatsapp_queues','util','api','moment','request-promise','path'];(function(_0x382ea1,_0x357c29){var _0x66a02c=function(_0xeaf41b){while(--_0xeaf41b){_0x382ea1['push'](_0x382ea1['shift']());}};_0x66a02c(++_0x357c29);}(_0x7c8b,0x18b));var _0xb7c8=function(_0x5c05ec,_0xdcc74e){_0x5c05ec=_0x5c05ec-0x0;var _0x255e40=_0x7c8b[_0x5c05ec];return _0x255e40;};'use strict';var _=require('lodash');var util=require(_0xb7c8('0x0'));var logger=require('../../config/logger')(_0xb7c8('0x1'));var moment=require(_0xb7c8('0x2'));var BPromise=require('bluebird');var rp=require(_0xb7c8('0x3'));var fs=require('fs');var path=require(_0xb7c8('0x4'));var rimraf=require(_0xb7c8('0x5'));var config=require(_0xb7c8('0x6'));var attributes=require('./userWhatsappQueue.attributes');module[_0xb7c8('0x7')]=function(_0x2f013b,_0x5430d3){return _0x2f013b[_0xb7c8('0x8')]('UserWhatsappQueue',attributes,{'tableName':_0xb7c8('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.rpc.js b/server/api/userWhatsappQueue/userWhatsappQueue.rpc.js index a35a800..217ce14 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 _0x23af=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util'];(function(_0x290aa5,_0x201fcc){var _0x425aec=function(_0x10f589){while(--_0x10f589){_0x290aa5['push'](_0x290aa5['shift']());}};_0x425aec(++_0x201fcc);}(_0x23af,0x136));var _0xf23a=function(_0x1e1d5c,_0x2ffacd){_0x1e1d5c=_0x1e1d5c-0x0;var _0x2a3ce9=_0x23af[_0x1e1d5c];return _0x2a3ce9;};'use strict';var _=require(_0xf23a('0x0'));var util=require(_0xf23a('0x1'));var moment=require('moment');var BPromise=require(_0xf23a('0x2'));var rs=require(_0xf23a('0x3'));var fs=require('fs');var Redis=require(_0xf23a('0x4'));var db=require(_0xf23a('0x5'))['db'];var utils=require(_0xf23a('0x6'));var logger=require(_0xf23a('0x7'))(_0xf23a('0x8'));var config=require(_0xf23a('0x9'));var jayson=require(_0xf23a('0xa'));var client=jayson[_0xf23a('0xb')][_0xf23a('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5e1965,_0x3b9980,_0x3a9a59){return new BPromise(function(_0x5c2e37,_0x6e8d14){return client[_0xf23a('0xd')](_0x5e1965,_0x3a9a59)['then'](function(_0x46ff1e){logger[_0xf23a('0xe')](_0xf23a('0xf'),_0x3b9980,_0xf23a('0x10'));logger['debug'](_0xf23a('0x11'),_0x3b9980,_0xf23a('0x10'),JSON[_0xf23a('0x12')](_0x46ff1e));if(_0x46ff1e[_0xf23a('0x13')]){if(_0x46ff1e[_0xf23a('0x13')][_0xf23a('0x14')]===0x1f4){logger['error'](_0xf23a('0xf'),_0x3b9980,_0x46ff1e[_0xf23a('0x13')][_0xf23a('0x15')]);return _0x6e8d14(_0x46ff1e['error'][_0xf23a('0x15')]);}logger['error'](_0xf23a('0xf'),_0x3b9980,_0x46ff1e['error'][_0xf23a('0x15')]);return _0x5c2e37(_0x46ff1e[_0xf23a('0x13')][_0xf23a('0x15')]);}else{logger[_0xf23a('0xe')](_0xf23a('0xf'),_0x3b9980,_0xf23a('0x10'));_0x5c2e37(_0x46ff1e[_0xf23a('0x16')]['message']);}})[_0xf23a('0x17')](function(_0x45ba22){logger[_0xf23a('0x13')](_0xf23a('0xf'),_0x3b9980,_0x45ba22);_0x6e8d14(_0x45ba22);});});} \ No newline at end of file +var _0x6ea1=['lodash','util','randomstring','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','info','UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x4dcc15,_0x4ed63){var _0x3952d3=function(_0x53c673){while(--_0x53c673){_0x4dcc15['push'](_0x4dcc15['shift']());}};_0x3952d3(++_0x4ed63);}(_0x6ea1,0x13b));var _0x16ea=function(_0x3dff3f,_0x35fb0e){_0x3dff3f=_0x3dff3f-0x0;var _0x5172e7=_0x6ea1[_0x3dff3f];return _0x5172e7;};'use strict';var _=require(_0x16ea('0x0'));var util=require(_0x16ea('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x16ea('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x16ea('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x16ea('0x4'))(_0x16ea('0x5'));var config=require('../../config/environment');var jayson=require(_0x16ea('0x6'));var client=jayson[_0x16ea('0x7')][_0x16ea('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x400735,_0x13c655,_0x4ad61c){return new BPromise(function(_0x172195,_0x2c2a2c){return client[_0x16ea('0x9')](_0x400735,_0x4ad61c)['then'](function(_0x21eb8c){logger[_0x16ea('0xa')](_0x16ea('0xb'),_0x13c655,_0x16ea('0xc'));logger[_0x16ea('0xd')](_0x16ea('0xe'),_0x13c655,'request\x20sent',JSON[_0x16ea('0xf')](_0x21eb8c));if(_0x21eb8c[_0x16ea('0x10')]){if(_0x21eb8c['error'][_0x16ea('0x11')]===0x1f4){logger[_0x16ea('0x10')](_0x16ea('0xb'),_0x13c655,_0x21eb8c[_0x16ea('0x10')]['message']);return _0x2c2a2c(_0x21eb8c[_0x16ea('0x10')][_0x16ea('0x12')]);}logger['error'](_0x16ea('0xb'),_0x13c655,_0x21eb8c['error']['message']);return _0x172195(_0x21eb8c[_0x16ea('0x10')][_0x16ea('0x12')]);}else{logger['info'](_0x16ea('0xb'),_0x13c655,_0x16ea('0xc'));_0x172195(_0x21eb8c[_0x16ea('0x13')]['message']);}})[_0x16ea('0x14')](function(_0x46da9f){logger['error'](_0x16ea('0xb'),_0x13c655,_0x46da9f);_0x2c2a2c(_0x46da9f);});});} \ No newline at end of file diff --git a/server/api/variable/index.js b/server/api/variable/index.js index 8df7dc6..350efde 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 _0xdb4b=['connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./variable.controller','get','isAuthenticated','index','show','post','create','/:id','update','delete','exports','util'];(function(_0x34023d,_0x25ecce){var _0x3669d0=function(_0x3f081b){while(--_0x3f081b){_0x34023d['push'](_0x34023d['shift']());}};_0x3669d0(++_0x25ecce);}(_0xdb4b,0xd7));var _0xbdb4=function(_0x30fc1f,_0x56890f){_0x30fc1f=_0x30fc1f-0x0;var _0x5b25ff=_0xdb4b[_0x30fc1f];return _0x5b25ff;};'use strict';var multer=require('multer');var util=require(_0xbdb4('0x0'));var path=require('path');var timeout=require(_0xbdb4('0x1'));var express=require(_0xbdb4('0x2'));var router=express[_0xbdb4('0x3')]();var fs_extra=require(_0xbdb4('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xbdb4('0x5'));var config=require(_0xbdb4('0x6'));var controller=require(_0xbdb4('0x7'));router[_0xbdb4('0x8')]('/',auth[_0xbdb4('0x9')](),controller[_0xbdb4('0xa')]);router[_0xbdb4('0x8')]('/:id',auth['isAuthenticated'](),controller[_0xbdb4('0xb')]);router[_0xbdb4('0xc')]('/',auth[_0xbdb4('0x9')](),controller[_0xbdb4('0xd')]);router['put'](_0xbdb4('0xe'),auth['isAuthenticated'](),controller[_0xbdb4('0xf')]);router[_0xbdb4('0x10')](_0xbdb4('0xe'),auth['isAuthenticated'](),controller['destroy']);module[_0xbdb4('0x11')]=router; \ No newline at end of file +var _0xf3be=['exports','multer','util','path','connect-timeout','Router','./variable.controller','get','index','/:id','isAuthenticated','show','post','put','update','delete'];(function(_0x2b380d,_0x33fb20){var _0x51298f=function(_0x4dc87b){while(--_0x4dc87b){_0x2b380d['push'](_0x2b380d['shift']());}};_0x51298f(++_0x33fb20);}(_0xf3be,0x1e1));var _0xef3b=function(_0x45f6fa,_0x236037){_0x45f6fa=_0x45f6fa-0x0;var _0x194c54=_0xf3be[_0x45f6fa];return _0x194c54;};'use strict';var multer=require(_0xef3b('0x0'));var util=require(_0xef3b('0x1'));var path=require(_0xef3b('0x2'));var timeout=require(_0xef3b('0x3'));var express=require('express');var router=express[_0xef3b('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xef3b('0x5'));router[_0xef3b('0x6')]('/',auth['isAuthenticated'](),controller[_0xef3b('0x7')]);router[_0xef3b('0x6')](_0xef3b('0x8'),auth[_0xef3b('0x9')](),controller[_0xef3b('0xa')]);router[_0xef3b('0xb')]('/',auth['isAuthenticated'](),controller['create']);router[_0xef3b('0xc')]('/:id',auth[_0xef3b('0x9')](),controller[_0xef3b('0xd')]);router[_0xef3b('0xe')]('/:id',auth[_0xef3b('0x9')](),controller['destroy']);module[_0xef3b('0xf')]=router; \ No newline at end of file diff --git a/server/api/variable/variable.attributes.js b/server/api/variable/variable.attributes.js index f6cafac..903e9e7 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 _0x6c42=['exports','name'];(function(_0x225fe2,_0x148d32){var _0x16079b=function(_0x2dd30d){while(--_0x2dd30d){_0x225fe2['push'](_0x225fe2['shift']());}};_0x16079b(++_0x148d32);}(_0x6c42,0xd0));var _0x26c4=function(_0x2678d6,_0x4e2001){_0x2678d6=_0x2678d6-0x0;var _0x475503=_0x6c42[_0x2678d6];return _0x475503;};'use strict';var Sequelize=require('sequelize');module[_0x26c4('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0x26c4('0x1'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x9787=['STRING','name','sequelize','exports'];(function(_0x32a656,_0x4a4490){var _0x4380c3=function(_0x51adc8){while(--_0x51adc8){_0x32a656['push'](_0x32a656['shift']());}};_0x4380c3(++_0x4a4490);}(_0x9787,0x122));var _0x7978=function(_0x36d203,_0x3653f3){_0x36d203=_0x36d203-0x0;var _0x2f9e62=_0x9787[_0x36d203];return _0x2f9e62;};'use strict';var Sequelize=require(_0x7978('0x0'));module[_0x7978('0x1')]={'name':{'type':Sequelize[_0x7978('0x2')],'unique':_0x7978('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/variable/variable.controller.js b/server/api/variable/variable.controller.js index 3abb6f7..79b0ba5 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 _0xaf8a=['query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','sort','filter','where','map','VIRTUAL','merge','options','include','catch','show','params','length','includeAll','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','Variables','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','then','destroy','get','UserProfileResource','error','name','send','index','Variable','rawAttributes','type','key','model','keys'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xaf8a,0x160));var _0xaaf8=function(_0x37644a,_0x2b336a){_0x37644a=_0x37644a-0x0;var _0x523024=_0xaf8a[_0x37644a];return _0x523024;};'use strict';var emlformat=require(_0xaaf8('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xaaf8('0x1'));var rp=require(_0xaaf8('0x2'));var moment=require(_0xaaf8('0x3'));var BPromise=require(_0xaaf8('0x4'));var Mustache=require(_0xaaf8('0x5'));var util=require('util');var path=require('path');var sox=require(_0xaaf8('0x6'));var csv=require('to-csv');var ejs=require(_0xaaf8('0x7'));var fs=require('fs');var fs_extra=require(_0xaaf8('0x8'));var _=require(_0xaaf8('0x9'));var squel=require(_0xaaf8('0xa'));var crypto=require(_0xaaf8('0xb'));var jsforce=require(_0xaaf8('0xc'));var deskjs=require(_0xaaf8('0xd'));var toCsv=require(_0xaaf8('0xe'));var querystring=require(_0xaaf8('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xaaf8('0x10'));var qs=require(_0xaaf8('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xaaf8('0x12'));var logger=require(_0xaaf8('0x13'))(_0xaaf8('0x14'));var utils=require('../../config/utils');var config=require(_0xaaf8('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3d828d,_0x3f37d3){_0x3f37d3=_0x3f37d3||0xcc;return function(_0x1a39d2){if(_0x1a39d2){return _0x3d828d[_0xaaf8('0x16')](_0x3f37d3);}return _0x3d828d[_0xaaf8('0x17')](_0x3f37d3)[_0xaaf8('0x18')]();};}function respondWithResult(_0x212ae7,_0x4a3f7f){_0x4a3f7f=_0x4a3f7f||0xc8;return function(_0x329250){if(_0x329250){return _0x212ae7[_0xaaf8('0x17')](_0x4a3f7f)[_0xaaf8('0x19')](_0x329250);}};}function respondWithFilteredResult(_0x5d5720,_0x167900){return function(_0x136f14){if(_0x136f14){var _0x62d33b=typeof _0x167900[_0xaaf8('0x1a')]===_0xaaf8('0x1b')&&typeof _0x167900[_0xaaf8('0x1c')]===_0xaaf8('0x1b');var _0x184bc8=_0x136f14[_0xaaf8('0x1d')];var _0x40ebf5=_0x62d33b?0x0:_0x167900['offset'];var _0x559a31=_0x62d33b?_0x136f14[_0xaaf8('0x1d')]:_0x167900[_0xaaf8('0x1a')]+_0x167900[_0xaaf8('0x1c')];var _0x3420f1;if(_0x559a31>=_0x184bc8){_0x559a31=_0x184bc8;_0x3420f1=0xc8;}else{_0x3420f1=0xce;}_0x5d5720[_0xaaf8('0x17')](_0x3420f1);return _0x5d5720[_0xaaf8('0x1e')](_0xaaf8('0x1f'),_0x40ebf5+'-'+_0x559a31+'/'+_0x184bc8)['json'](_0x136f14);}return null;};}function patchUpdates(_0x3e9fec){return function(_0xe7c146){try{jsonpatch[_0xaaf8('0x20')](_0xe7c146,_0x3e9fec,!![]);}catch(_0x31f59c){return BPromise['reject'](_0x31f59c);}return _0xe7c146[_0xaaf8('0x21')]();};}function saveUpdates(_0x2f6780,_0xba6d91){return function(_0x48c662){if(_0x48c662){return _0x48c662['update'](_0x2f6780)[_0xaaf8('0x22')](function(_0x5dc78b){return _0x5dc78b;});}return null;};}function removeEntity(_0x1f9be5,_0x4a1925){return function(_0x507334){if(_0x507334){return _0x507334[_0xaaf8('0x23')]()[_0xaaf8('0x22')](function(){var _0x514c9f=_0x507334[_0xaaf8('0x24')]({'plain':!![]});var _0x5720d2='Variables';return db[_0xaaf8('0x25')][_0xaaf8('0x23')]({'where':{'type':_0x5720d2,'resourceId':_0x514c9f['id']}})[_0xaaf8('0x22')](function(){return _0x507334;});})[_0xaaf8('0x22')](function(){_0x1f9be5[_0xaaf8('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1a7e3b,_0x4fa60e){return function(_0x485eef){if(!_0x485eef){_0x1a7e3b[_0xaaf8('0x16')](0x194);}return _0x485eef;};}function handleError(_0x5cfddf,_0x24a8df){_0x24a8df=_0x24a8df||0x1f4;return function(_0x238f10){logger[_0xaaf8('0x26')](_0x238f10['stack']);if(_0x238f10[_0xaaf8('0x27')]){delete _0x238f10[_0xaaf8('0x27')];}_0x5cfddf['status'](_0x24a8df)[_0xaaf8('0x28')](_0x238f10);};}exports[_0xaaf8('0x29')]=function(_0x39330c,_0x4691f4){var _0x5399e3={},_0x136c37={},_0x157080={'count':0x0,'rows':[]};var _0x164886=_['map'](db[_0xaaf8('0x2a')][_0xaaf8('0x2b')],function(_0x2e56f3){return{'name':_0x2e56f3['fieldName'],'type':_0x2e56f3[_0xaaf8('0x2c')][_0xaaf8('0x2d')]};});_0x136c37[_0xaaf8('0x2e')]=_['map'](_0x164886,'name');_0x136c37['query']=_[_0xaaf8('0x2f')](_0x39330c[_0xaaf8('0x30')]);_0x136c37[_0xaaf8('0x31')]=_['intersection'](_0x136c37[_0xaaf8('0x2e')],_0x136c37['query']);_0x5399e3[_0xaaf8('0x32')]=_[_0xaaf8('0x33')](_0x136c37['model'],qs['fields'](_0x39330c[_0xaaf8('0x30')][_0xaaf8('0x34')]));_0x5399e3['attributes']=_0x5399e3[_0xaaf8('0x32')]['length']?_0x5399e3[_0xaaf8('0x32')]:_0x136c37[_0xaaf8('0x2e')];if(!_0x39330c[_0xaaf8('0x30')][_0xaaf8('0x35')](_0xaaf8('0x36'))){_0x5399e3[_0xaaf8('0x1c')]=qs['limit'](_0x39330c[_0xaaf8('0x30')][_0xaaf8('0x1c')]);_0x5399e3[_0xaaf8('0x1a')]=qs[_0xaaf8('0x1a')](_0x39330c[_0xaaf8('0x30')]['offset']);}_0x5399e3['order']=qs[_0xaaf8('0x37')](_0x39330c[_0xaaf8('0x30')][_0xaaf8('0x37')]);_0x5399e3['where']=qs['filters'](_['pick'](_0x39330c[_0xaaf8('0x30')],_0x136c37[_0xaaf8('0x31')]),_0x164886);if(_0x39330c[_0xaaf8('0x30')][_0xaaf8('0x38')]){_0x5399e3[_0xaaf8('0x39')]=_['merge'](_0x5399e3['where'],{'$or':_[_0xaaf8('0x3a')](_0x164886,function(_0x3d1a7c){if(_0x3d1a7c[_0xaaf8('0x2c')]!==_0xaaf8('0x3b')){var _0x544c14={};_0x544c14[_0x3d1a7c[_0xaaf8('0x27')]]={'$like':'%'+_0x39330c[_0xaaf8('0x30')][_0xaaf8('0x38')]+'%'};return _0x544c14;}})});}_0x5399e3=_[_0xaaf8('0x3c')]({},_0x5399e3,_0x39330c[_0xaaf8('0x3d')]);var _0xcf3e6d={'where':_0x5399e3['where']};return db[_0xaaf8('0x2a')]['count'](_0xcf3e6d)[_0xaaf8('0x22')](function(_0x2101c5){_0x157080[_0xaaf8('0x1d')]=_0x2101c5;if(_0x39330c[_0xaaf8('0x30')]['includeAll']){_0x5399e3[_0xaaf8('0x3e')]=[{'all':!![]}];}return db['Variable']['findAll'](_0x5399e3);})[_0xaaf8('0x22')](function(_0xfaa19e){_0x157080['rows']=_0xfaa19e;return _0x157080;})[_0xaaf8('0x22')](respondWithFilteredResult(_0x4691f4,_0x5399e3))[_0xaaf8('0x3f')](handleError(_0x4691f4,null));};exports[_0xaaf8('0x40')]=function(_0x2d6591,_0x48b644){var _0x5d2000={'raw':!![],'where':{'id':_0x2d6591[_0xaaf8('0x41')]['id']}},_0x4e2bbc={};_0x4e2bbc[_0xaaf8('0x2e')]=_[_0xaaf8('0x2f')](db[_0xaaf8('0x2a')][_0xaaf8('0x2b')]);_0x4e2bbc[_0xaaf8('0x30')]=_[_0xaaf8('0x2f')](_0x2d6591[_0xaaf8('0x30')]);_0x4e2bbc[_0xaaf8('0x31')]=_[_0xaaf8('0x33')](_0x4e2bbc[_0xaaf8('0x2e')],_0x4e2bbc['query']);_0x5d2000['attributes']=_['intersection'](_0x4e2bbc[_0xaaf8('0x2e')],qs['fields'](_0x2d6591[_0xaaf8('0x30')][_0xaaf8('0x34')]));_0x5d2000['attributes']=_0x5d2000[_0xaaf8('0x32')][_0xaaf8('0x42')]?_0x5d2000['attributes']:_0x4e2bbc['model'];if(_0x2d6591[_0xaaf8('0x30')][_0xaaf8('0x43')]){_0x5d2000[_0xaaf8('0x3e')]=[{'all':!![]}];}_0x5d2000=_[_0xaaf8('0x3c')]({},_0x5d2000,_0x2d6591[_0xaaf8('0x3d')]);return db[_0xaaf8('0x2a')][_0xaaf8('0x44')](_0x5d2000)[_0xaaf8('0x22')](handleEntityNotFound(_0x48b644,null))[_0xaaf8('0x22')](respondWithResult(_0x48b644,null))[_0xaaf8('0x3f')](handleError(_0x48b644,null));};exports[_0xaaf8('0x45')]=function(_0x15a366,_0xfee18e){return db[_0xaaf8('0x2a')]['create'](_0x15a366['body'],{})[_0xaaf8('0x22')](function(_0x32bd10){var _0x26ff15=_0x15a366['user'][_0xaaf8('0x24')]({'plain':!![]});if(!_0x26ff15)throw new Error(_0xaaf8('0x46'));if(_0x26ff15[_0xaaf8('0x47')]===_0xaaf8('0x48')){var _0x5a597d=_0x32bd10[_0xaaf8('0x24')]({'plain':!![]});var _0x284d37=_0xaaf8('0x49');return db[_0xaaf8('0x4a')][_0xaaf8('0x44')]({'where':{'name':_0x284d37,'userProfileId':_0x26ff15[_0xaaf8('0x4b')]},'raw':!![]})[_0xaaf8('0x22')](function(_0x37dbe8){if(_0x37dbe8&&_0x37dbe8[_0xaaf8('0x4c')]===0x0){return db[_0xaaf8('0x25')][_0xaaf8('0x45')]({'name':_0x5a597d[_0xaaf8('0x27')],'resourceId':_0x5a597d['id'],'type':_0x37dbe8[_0xaaf8('0x27')],'sectionId':_0x37dbe8['id']},{})['then'](function(){return _0x32bd10;});}else{return _0x32bd10;}})[_0xaaf8('0x3f')](function(_0x201983){logger[_0xaaf8('0x26')](_0xaaf8('0x4d'),_0x201983);throw _0x201983;});}return _0x32bd10;})['then'](respondWithResult(_0xfee18e,0xc9))[_0xaaf8('0x3f')](handleError(_0xfee18e,null));};exports[_0xaaf8('0x4e')]=function(_0x5ae851,_0x46b896){if(_0x5ae851['body']['id']){delete _0x5ae851['body']['id'];}return db['Variable'][_0xaaf8('0x44')]({'where':{'id':_0x5ae851[_0xaaf8('0x41')]['id']}})[_0xaaf8('0x22')](handleEntityNotFound(_0x46b896,null))[_0xaaf8('0x22')](saveUpdates(_0x5ae851[_0xaaf8('0x4f')],null))[_0xaaf8('0x22')](respondWithResult(_0x46b896,null))[_0xaaf8('0x3f')](handleError(_0x46b896,null));};exports[_0xaaf8('0x23')]=function(_0x359a59,_0x141eaa){return db['Variable']['find']({'where':{'id':_0x359a59[_0xaaf8('0x41')]['id']}})[_0xaaf8('0x22')](handleEntityNotFound(_0x141eaa,null))[_0xaaf8('0x22')](removeEntity(_0x141eaa,null))['catch'](handleError(_0x141eaa,null));}; \ No newline at end of file +var _0xb1cb=['../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','json','apply','save','destroy','then','Variables','error','stack','name','send','index','map','Variable','rawAttributes','fieldName','model','query','keys','filters','attributes','intersection','fields','length','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','options','include','findAll','catch','show','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','lodash','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware'];(function(_0x303be1,_0x11dcfc){var _0x3e0191=function(_0x2a2b1a){while(--_0x2a2b1a){_0x303be1['push'](_0x303be1['shift']());}};_0x3e0191(++_0x11dcfc);}(_0xb1cb,0x1d2));var _0xbb1c=function(_0x334841,_0x2bbc4c){_0x334841=_0x334841-0x0;var _0x5beb4b=_0xb1cb[_0x334841];return _0x5beb4b;};'use strict';var emlformat=require(_0xbb1c('0x0'));var rimraf=require(_0xbb1c('0x1'));var zipdir=require(_0xbb1c('0x2'));var jsonpatch=require(_0xbb1c('0x3'));var rp=require('request-promise');var moment=require(_0xbb1c('0x4'));var BPromise=require(_0xbb1c('0x5'));var Mustache=require(_0xbb1c('0x6'));var util=require(_0xbb1c('0x7'));var path=require(_0xbb1c('0x8'));var sox=require(_0xbb1c('0x9'));var csv=require('to-csv');var ejs=require(_0xbb1c('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xbb1c('0xb'));var squel=require('squel');var crypto=require(_0xbb1c('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xbb1c('0xd'));var toCsv=require(_0xbb1c('0xe'));var querystring=require(_0xbb1c('0xf'));var Papa=require(_0xbb1c('0x10'));var Redis=require(_0xbb1c('0x11'));var authService=require(_0xbb1c('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbb1c('0x13'));var logger=require(_0xbb1c('0x14'))(_0xbb1c('0x15'));var utils=require(_0xbb1c('0x16'));var config=require(_0xbb1c('0x17'));var licenseUtil=require(_0xbb1c('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xaeced5,_0x494d0b){_0x494d0b=_0x494d0b||0xcc;return function(_0x48f6b4){if(_0x48f6b4){return _0xaeced5[_0xbb1c('0x19')](_0x494d0b);}return _0xaeced5[_0xbb1c('0x1a')](_0x494d0b)[_0xbb1c('0x1b')]();};}function respondWithResult(_0x4788e1,_0x132b25){_0x132b25=_0x132b25||0xc8;return function(_0xd52bba){if(_0xd52bba){return _0x4788e1[_0xbb1c('0x1a')](_0x132b25)['json'](_0xd52bba);}};}function respondWithFilteredResult(_0x57dd24,_0x5eed98){return function(_0x23a243){if(_0x23a243){var _0x550063=typeof _0x5eed98[_0xbb1c('0x1c')]==='undefined'&&typeof _0x5eed98[_0xbb1c('0x1d')]===_0xbb1c('0x1e');var _0x5ed5a2=_0x23a243['count'];var _0x5086c6=_0x550063?0x0:_0x5eed98[_0xbb1c('0x1c')];var _0x31db8e=_0x550063?_0x23a243[_0xbb1c('0x1f')]:_0x5eed98[_0xbb1c('0x1c')]+_0x5eed98[_0xbb1c('0x1d')];var _0x582089;if(_0x31db8e>=_0x5ed5a2){_0x31db8e=_0x5ed5a2;_0x582089=0xc8;}else{_0x582089=0xce;}_0x57dd24['status'](_0x582089);return _0x57dd24[_0xbb1c('0x20')](_0xbb1c('0x21'),_0x5086c6+'-'+_0x31db8e+'/'+_0x5ed5a2)[_0xbb1c('0x22')](_0x23a243);}return null;};}function patchUpdates(_0x52a639){return function(_0x2c20ff){try{jsonpatch[_0xbb1c('0x23')](_0x2c20ff,_0x52a639,!![]);}catch(_0x1133bb){return BPromise['reject'](_0x1133bb);}return _0x2c20ff[_0xbb1c('0x24')]();};}function saveUpdates(_0x508f18,_0x51dabb){return function(_0x2a5e95){if(_0x2a5e95){return _0x2a5e95['update'](_0x508f18)['then'](function(_0x501c16){return _0x501c16;});}return null;};}function removeEntity(_0x1d62dc,_0x4b58ed){return function(_0x122242){if(_0x122242){return _0x122242[_0xbb1c('0x25')]()[_0xbb1c('0x26')](function(){var _0x30157a=_0x122242['get']({'plain':!![]});var _0x25fa8d=_0xbb1c('0x27');return db['UserProfileResource']['destroy']({'where':{'type':_0x25fa8d,'resourceId':_0x30157a['id']}})[_0xbb1c('0x26')](function(){return _0x122242;});})['then'](function(){_0x1d62dc[_0xbb1c('0x1a')](0xcc)[_0xbb1c('0x1b')]();});}};}function handleEntityNotFound(_0x288d97,_0xd19467){return function(_0x28a5e2){if(!_0x28a5e2){_0x288d97[_0xbb1c('0x19')](0x194);}return _0x28a5e2;};}function handleError(_0x501651,_0x2f66ae){_0x2f66ae=_0x2f66ae||0x1f4;return function(_0xa00ac){logger[_0xbb1c('0x28')](_0xa00ac[_0xbb1c('0x29')]);if(_0xa00ac[_0xbb1c('0x2a')]){delete _0xa00ac[_0xbb1c('0x2a')];}_0x501651[_0xbb1c('0x1a')](_0x2f66ae)[_0xbb1c('0x2b')](_0xa00ac);};}exports[_0xbb1c('0x2c')]=function(_0x30db49,_0x57086a){var _0x32888d={},_0xd39cc2={},_0x4e4849={'count':0x0,'rows':[]};var _0x4d3746=_[_0xbb1c('0x2d')](db[_0xbb1c('0x2e')][_0xbb1c('0x2f')],function(_0x3784ff){return{'name':_0x3784ff[_0xbb1c('0x30')],'type':_0x3784ff['type']['key']};});_0xd39cc2[_0xbb1c('0x31')]=_[_0xbb1c('0x2d')](_0x4d3746,_0xbb1c('0x2a'));_0xd39cc2[_0xbb1c('0x32')]=_[_0xbb1c('0x33')](_0x30db49[_0xbb1c('0x32')]);_0xd39cc2[_0xbb1c('0x34')]=_['intersection'](_0xd39cc2['model'],_0xd39cc2[_0xbb1c('0x32')]);_0x32888d[_0xbb1c('0x35')]=_[_0xbb1c('0x36')](_0xd39cc2[_0xbb1c('0x31')],qs[_0xbb1c('0x37')](_0x30db49['query'][_0xbb1c('0x37')]));_0x32888d['attributes']=_0x32888d[_0xbb1c('0x35')][_0xbb1c('0x38')]?_0x32888d[_0xbb1c('0x35')]:_0xd39cc2[_0xbb1c('0x31')];if(!_0x30db49[_0xbb1c('0x32')]['hasOwnProperty'](_0xbb1c('0x39'))){_0x32888d['limit']=qs[_0xbb1c('0x1d')](_0x30db49[_0xbb1c('0x32')]['limit']);_0x32888d[_0xbb1c('0x1c')]=qs[_0xbb1c('0x1c')](_0x30db49['query']['offset']);}_0x32888d[_0xbb1c('0x3a')]=qs[_0xbb1c('0x3b')](_0x30db49[_0xbb1c('0x32')]['sort']);_0x32888d['where']=qs['filters'](_[_0xbb1c('0x3c')](_0x30db49['query'],_0xd39cc2[_0xbb1c('0x34')]),_0x4d3746);if(_0x30db49['query'][_0xbb1c('0x3d')]){_0x32888d[_0xbb1c('0x3e')]=_['merge'](_0x32888d[_0xbb1c('0x3e')],{'$or':_['map'](_0x4d3746,function(_0x504bef){if(_0x504bef['type']!==_0xbb1c('0x3f')){var _0x1edfd2={};_0x1edfd2[_0x504bef[_0xbb1c('0x2a')]]={'$like':'%'+_0x30db49[_0xbb1c('0x32')][_0xbb1c('0x3d')]+'%'};return _0x1edfd2;}})});}_0x32888d=_[_0xbb1c('0x40')]({},_0x32888d,_0x30db49[_0xbb1c('0x41')]);var _0x35d53a={'where':_0x32888d[_0xbb1c('0x3e')]};return db[_0xbb1c('0x2e')][_0xbb1c('0x1f')](_0x35d53a)['then'](function(_0x16b096){_0x4e4849[_0xbb1c('0x1f')]=_0x16b096;if(_0x30db49[_0xbb1c('0x32')]['includeAll']){_0x32888d[_0xbb1c('0x42')]=[{'all':!![]}];}return db[_0xbb1c('0x2e')][_0xbb1c('0x43')](_0x32888d);})['then'](function(_0x255e92){_0x4e4849['rows']=_0x255e92;return _0x4e4849;})[_0xbb1c('0x26')](respondWithFilteredResult(_0x57086a,_0x32888d))[_0xbb1c('0x44')](handleError(_0x57086a,null));};exports[_0xbb1c('0x45')]=function(_0x19fb65,_0x1230fe){var _0x4246ac={'raw':!![],'where':{'id':_0x19fb65['params']['id']}},_0x5e439b={};_0x5e439b[_0xbb1c('0x31')]=_[_0xbb1c('0x33')](db[_0xbb1c('0x2e')][_0xbb1c('0x2f')]);_0x5e439b[_0xbb1c('0x32')]=_[_0xbb1c('0x33')](_0x19fb65[_0xbb1c('0x32')]);_0x5e439b[_0xbb1c('0x34')]=_[_0xbb1c('0x36')](_0x5e439b['model'],_0x5e439b[_0xbb1c('0x32')]);_0x4246ac[_0xbb1c('0x35')]=_[_0xbb1c('0x36')](_0x5e439b[_0xbb1c('0x31')],qs['fields'](_0x19fb65[_0xbb1c('0x32')][_0xbb1c('0x37')]));_0x4246ac[_0xbb1c('0x35')]=_0x4246ac['attributes'][_0xbb1c('0x38')]?_0x4246ac['attributes']:_0x5e439b[_0xbb1c('0x31')];if(_0x19fb65['query']['includeAll']){_0x4246ac['include']=[{'all':!![]}];}_0x4246ac=_[_0xbb1c('0x40')]({},_0x4246ac,_0x19fb65[_0xbb1c('0x41')]);return db[_0xbb1c('0x2e')][_0xbb1c('0x46')](_0x4246ac)[_0xbb1c('0x26')](handleEntityNotFound(_0x1230fe,null))[_0xbb1c('0x26')](respondWithResult(_0x1230fe,null))[_0xbb1c('0x44')](handleError(_0x1230fe,null));};exports[_0xbb1c('0x47')]=function(_0x84dfc4,_0x5f083c){return db['Variable'][_0xbb1c('0x47')](_0x84dfc4[_0xbb1c('0x48')],{})[_0xbb1c('0x26')](function(_0x5eda7e){var _0x3ef76c=_0x84dfc4[_0xbb1c('0x49')][_0xbb1c('0x4a')]({'plain':!![]});if(!_0x3ef76c)throw new Error(_0xbb1c('0x4b'));if(_0x3ef76c[_0xbb1c('0x4c')]===_0xbb1c('0x49')){var _0x3b5588=_0x5eda7e[_0xbb1c('0x4a')]({'plain':!![]});var _0x1a47bf=_0xbb1c('0x27');return db['UserProfileSection'][_0xbb1c('0x46')]({'where':{'name':_0x1a47bf,'userProfileId':_0x3ef76c[_0xbb1c('0x4d')]},'raw':!![]})[_0xbb1c('0x26')](function(_0x53447b){if(_0x53447b&&_0x53447b[_0xbb1c('0x4e')]===0x0){return db[_0xbb1c('0x4f')][_0xbb1c('0x47')]({'name':_0x3b5588[_0xbb1c('0x2a')],'resourceId':_0x3b5588['id'],'type':_0x53447b[_0xbb1c('0x2a')],'sectionId':_0x53447b['id']},{})[_0xbb1c('0x26')](function(){return _0x5eda7e;});}else{return _0x5eda7e;}})['catch'](function(_0x22ab5b){logger['error'](_0xbb1c('0x50'),_0x22ab5b);throw _0x22ab5b;});}return _0x5eda7e;})[_0xbb1c('0x26')](respondWithResult(_0x5f083c,0xc9))['catch'](handleError(_0x5f083c,null));};exports['update']=function(_0x38507c,_0x4b02ed){if(_0x38507c[_0xbb1c('0x48')]['id']){delete _0x38507c['body']['id'];}return db[_0xbb1c('0x2e')][_0xbb1c('0x46')]({'where':{'id':_0x38507c['params']['id']}})[_0xbb1c('0x26')](handleEntityNotFound(_0x4b02ed,null))[_0xbb1c('0x26')](saveUpdates(_0x38507c[_0xbb1c('0x48')],null))[_0xbb1c('0x26')](respondWithResult(_0x4b02ed,null))[_0xbb1c('0x44')](handleError(_0x4b02ed,null));};exports[_0xbb1c('0x25')]=function(_0x4579a4,_0x194edf){return db[_0xbb1c('0x2e')][_0xbb1c('0x46')]({'where':{'id':_0x4579a4['params']['id']}})['then'](handleEntityNotFound(_0x194edf,null))['then'](removeEntity(_0x194edf,null))[_0xbb1c('0x44')](handleError(_0x194edf,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index 787dd62..3e45d7b 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 _0x1d8c=['util','api','moment','bluebird','rimraf','./variable.attributes','define','Variable','tools_variables','lodash'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1d8c,0x12b));var _0xc1d8=function(_0x55d0bd,_0x5dc78a){_0x55d0bd=_0x55d0bd-0x0;var _0x2d5d28=_0x1d8c[_0x55d0bd];return _0x2d5d28;};'use strict';var _=require(_0xc1d8('0x0'));var util=require(_0xc1d8('0x1'));var logger=require('../../config/logger')(_0xc1d8('0x2'));var moment=require(_0xc1d8('0x3'));var BPromise=require(_0xc1d8('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xc1d8('0x5'));var config=require('../../config/environment');var attributes=require(_0xc1d8('0x6'));module['exports']=function(_0x15b22a,_0x454dec){return _0x15b22a[_0xc1d8('0x7')](_0xc1d8('0x8'),attributes,{'tableName':_0xc1d8('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9d00=['api','moment','bluebird','../../config/environment','./variable.attributes','exports','Variable','tools_variables','lodash'];(function(_0x1f4da0,_0x33a12d){var _0x578a16=function(_0xe2c242){while(--_0xe2c242){_0x1f4da0['push'](_0x1f4da0['shift']());}};_0x578a16(++_0x33a12d);}(_0x9d00,0x1ca));var _0x09d0=function(_0x46bd50,_0x180902){_0x46bd50=_0x46bd50-0x0;var _0x3c28ea=_0x9d00[_0x46bd50];return _0x3c28ea;};'use strict';var _=require(_0x09d0('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x09d0('0x1'));var moment=require(_0x09d0('0x2'));var BPromise=require(_0x09d0('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x09d0('0x4'));var attributes=require(_0x09d0('0x5'));module[_0x09d0('0x6')]=function(_0x1e2c99,_0x56d260){return _0x1e2c99['define'](_0x09d0('0x7'),attributes,{'tableName':_0x09d0('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/variable/variable.rpc.js b/server/api/variable/variable.rpc.js index 9337fd1..c781e2c 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 _0xf494=['where','attributes','include','map','model','debug','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Variable,\x20%s,\x20%s','request\x20sent','Variable,\x20%s,\x20%s,\x20%s','error','message','catch','ShowVariable','find','options','raw'];(function(_0x4fdf4b,_0x937091){var _0x257469=function(_0x21678e){while(--_0x21678e){_0x4fdf4b['push'](_0x4fdf4b['shift']());}};_0x257469(++_0x937091);}(_0xf494,0x1c6));var _0x4f49=function(_0x5d1026,_0x8c8732){_0x5d1026=_0x5d1026-0x0;var _0xe2bef3=_0xf494[_0x5d1026];return _0xe2bef3;};'use strict';var _=require(_0x4f49('0x0'));var util=require(_0x4f49('0x1'));var moment=require(_0x4f49('0x2'));var BPromise=require('bluebird');var rs=require(_0x4f49('0x3'));var fs=require('fs');var Redis=require(_0x4f49('0x4'));var db=require(_0x4f49('0x5'))['db'];var utils=require(_0x4f49('0x6'));var logger=require(_0x4f49('0x7'))(_0x4f49('0x8'));var config=require(_0x4f49('0x9'));var jayson=require(_0x4f49('0xa'));var client=jayson[_0x4f49('0xb')][_0x4f49('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x42b0e8,_0x5eb186,_0x58e9a0){return new BPromise(function(_0x169c95,_0x327bd5){return client[_0x4f49('0xd')](_0x42b0e8,_0x58e9a0)[_0x4f49('0xe')](function(_0x185174){logger[_0x4f49('0xf')](_0x4f49('0x10'),_0x5eb186,_0x4f49('0x11'));logger['debug'](_0x4f49('0x12'),_0x5eb186,_0x4f49('0x11'),JSON['stringify'](_0x185174));if(_0x185174[_0x4f49('0x13')]){if(_0x185174['error']['code']===0x1f4){logger[_0x4f49('0x13')](_0x4f49('0x10'),_0x5eb186,_0x185174['error'][_0x4f49('0x14')]);return _0x327bd5(_0x185174[_0x4f49('0x13')][_0x4f49('0x14')]);}logger[_0x4f49('0x13')](_0x4f49('0x10'),_0x5eb186,_0x185174[_0x4f49('0x13')][_0x4f49('0x14')]);return _0x169c95(_0x185174['error'][_0x4f49('0x14')]);}else{logger[_0x4f49('0xf')](_0x4f49('0x10'),_0x5eb186,'request\x20sent');_0x169c95(_0x185174['result'][_0x4f49('0x14')]);}})[_0x4f49('0x15')](function(_0x74886e){logger['error'](_0x4f49('0x10'),_0x5eb186,_0x74886e);_0x327bd5(_0x74886e);});});}exports[_0x4f49('0x16')]=function(_0x4e85df){var _0x49cdaf=this;return new Promise(function(_0x5bb23b,_0x560592){return db['Variable'][_0x4f49('0x17')]({'raw':_0x4e85df[_0x4f49('0x18')]?_0x4e85df[_0x4f49('0x18')][_0x4f49('0x19')]===undefined?!![]:![]:!![],'where':_0x4e85df['options']?_0x4e85df[_0x4f49('0x18')][_0x4f49('0x1a')]||null:null,'attributes':_0x4e85df[_0x4f49('0x18')]?_0x4e85df[_0x4f49('0x18')][_0x4f49('0x1b')]||null:null,'include':_0x4e85df['options']?_0x4e85df[_0x4f49('0x18')][_0x4f49('0x1c')]?_[_0x4f49('0x1d')](_0x4e85df['options'][_0x4f49('0x1c')],function(_0x1d70a7){return{'model':db[_0x1d70a7[_0x4f49('0x1e')]],'as':_0x1d70a7['as'],'attributes':_0x1d70a7[_0x4f49('0x1b')],'include':_0x1d70a7[_0x4f49('0x1c')]?_[_0x4f49('0x1d')](_0x1d70a7['include'],function(_0x4e9041){return{'model':db[_0x4e9041[_0x4f49('0x1e')]],'as':_0x4e9041['as'],'attributes':_0x4e9041[_0x4f49('0x1b')],'include':_0x4e9041['include']?_[_0x4f49('0x1d')](_0x4e9041[_0x4f49('0x1c')],function(_0x35f8e0){return{'model':db[_0x35f8e0['model']],'as':_0x35f8e0['as'],'attributes':_0x35f8e0[_0x4f49('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x4f49('0xe')](function(_0x298785){logger[_0x4f49('0xf')](_0x4f49('0x16'),_0x4e85df);logger[_0x4f49('0x1f')]('ShowVariable',_0x4e85df,JSON['stringify'](_0x298785));_0x5bb23b(_0x298785);})[_0x4f49('0x15')](function(_0x2c00ee){logger[_0x4f49('0x13')]('ShowVariable',_0x2c00ee[_0x4f49('0x14')],_0x4e85df);_0x560592(_0x49cdaf[_0x4f49('0x13')](0x1f4,_0x2c00ee[_0x4f49('0x14')]));});});}; \ No newline at end of file +var _0x326f=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','info','Variable,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','ShowVariable','Variable','raw','options','include','model','attributes','map','then','stringify','lodash'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0x326f,0xd1));var _0xf326=function(_0x81bb80,_0x515709){_0x81bb80=_0x81bb80-0x0;var _0x2ac870=_0x326f[_0x81bb80];return _0x2ac870;};'use strict';var _=require(_0xf326('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xf326('0x1'));var rs=require(_0xf326('0x2'));var fs=require('fs');var Redis=require(_0xf326('0x3'));var db=require(_0xf326('0x4'))['db'];var utils=require(_0xf326('0x5'));var logger=require(_0xf326('0x6'))(_0xf326('0x7'));var config=require(_0xf326('0x8'));var jayson=require(_0xf326('0x9'));var client=jayson[_0xf326('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3c254d,_0x3851eb,_0x165f95){return new BPromise(function(_0x1e7b8a,_0x515bfa){return client['request'](_0x3c254d,_0x165f95)['then'](function(_0x3bacf2){logger[_0xf326('0xb')](_0xf326('0xc'),_0x3851eb,_0xf326('0xd'));logger[_0xf326('0xe')]('Variable,\x20%s,\x20%s,\x20%s',_0x3851eb,_0xf326('0xd'),JSON['stringify'](_0x3bacf2));if(_0x3bacf2[_0xf326('0xf')]){if(_0x3bacf2['error'][_0xf326('0x10')]===0x1f4){logger['error'](_0xf326('0xc'),_0x3851eb,_0x3bacf2[_0xf326('0xf')]['message']);return _0x515bfa(_0x3bacf2[_0xf326('0xf')][_0xf326('0x11')]);}logger[_0xf326('0xf')](_0xf326('0xc'),_0x3851eb,_0x3bacf2['error'][_0xf326('0x11')]);return _0x1e7b8a(_0x3bacf2['error']['message']);}else{logger[_0xf326('0xb')](_0xf326('0xc'),_0x3851eb,_0xf326('0xd'));_0x1e7b8a(_0x3bacf2[_0xf326('0x12')][_0xf326('0x11')]);}})[_0xf326('0x13')](function(_0x34128e){logger[_0xf326('0xf')]('Variable,\x20%s,\x20%s',_0x3851eb,_0x34128e);_0x515bfa(_0x34128e);});});}exports[_0xf326('0x14')]=function(_0x453100){var _0x18bee3=this;return new Promise(function(_0x31ffb9,_0xcef2b5){return db[_0xf326('0x15')]['find']({'raw':_0x453100['options']?_0x453100['options'][_0xf326('0x16')]===undefined?!![]:![]:!![],'where':_0x453100[_0xf326('0x17')]?_0x453100['options']['where']||null:null,'attributes':_0x453100[_0xf326('0x17')]?_0x453100['options']['attributes']||null:null,'include':_0x453100[_0xf326('0x17')]?_0x453100[_0xf326('0x17')]['include']?_['map'](_0x453100[_0xf326('0x17')][_0xf326('0x18')],function(_0x5f21a2){return{'model':db[_0x5f21a2[_0xf326('0x19')]],'as':_0x5f21a2['as'],'attributes':_0x5f21a2[_0xf326('0x1a')],'include':_0x5f21a2[_0xf326('0x18')]?_[_0xf326('0x1b')](_0x5f21a2[_0xf326('0x18')],function(_0x2049ec){return{'model':db[_0x2049ec['model']],'as':_0x2049ec['as'],'attributes':_0x2049ec['attributes'],'include':_0x2049ec['include']?_[_0xf326('0x1b')](_0x2049ec[_0xf326('0x18')],function(_0x2cd45a){return{'model':db[_0x2cd45a[_0xf326('0x19')]],'as':_0x2cd45a['as'],'attributes':_0x2cd45a[_0xf326('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xf326('0x1c')](function(_0x5217d4){logger[_0xf326('0xb')](_0xf326('0x14'),_0x453100);logger[_0xf326('0xe')]('ShowVariable',_0x453100,JSON[_0xf326('0x1d')](_0x5217d4));_0x31ffb9(_0x5217d4);})['catch'](function(_0x4a9abf){logger[_0xf326('0xf')](_0xf326('0x14'),_0x4a9abf[_0xf326('0x11')],_0x453100);_0xcef2b5(_0x18bee3['error'](0x1f4,_0x4a9abf[_0xf326('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/version/index.js b/server/api/version/index.js index bfd4cba..6f2ce56 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 _0xe83d=['get','isAuthenticated','fetch','/reset','canUpdate','reset','restart','/migrations','migrations','express','Router','../../components/auth/service','./version.controller'];(function(_0x15313d,_0x8dfc7){var _0x5dd736=function(_0x50a0a0){while(--_0x50a0a0){_0x15313d['push'](_0x15313d['shift']());}};_0x5dd736(++_0x8dfc7);}(_0xe83d,0x168));var _0xde83=function(_0x4b4aa4,_0x43d1e2){_0x4b4aa4=_0x4b4aa4-0x0;var _0x3c6a71=_0xe83d[_0x4b4aa4];return _0x3c6a71;};'use strict';var express=require(_0xde83('0x0'));var router=express[_0xde83('0x1')]();var auth=require(_0xde83('0x2'));var controller=require(_0xde83('0x3'));router[_0xde83('0x4')]('/',controller['index']);router[_0xde83('0x4')]('/fetch',auth[_0xde83('0x5')](),auth['canUpdate'](),controller[_0xde83('0x6')]);router[_0xde83('0x4')](_0xde83('0x7'),auth[_0xde83('0x5')](),auth[_0xde83('0x8')](),controller[_0xde83('0x9')]);router[_0xde83('0x4')]('/pull',auth[_0xde83('0x5')](),auth[_0xde83('0x8')](),controller['pull']);router[_0xde83('0x4')]('/restart',auth[_0xde83('0x5')](),controller[_0xde83('0xa')]);router[_0xde83('0x4')](_0xde83('0xb'),controller[_0xde83('0xc')]);module['exports']=router; \ No newline at end of file +var _0x7a0a=['express','Router','../../components/auth/service','./version.controller','get','index','isAuthenticated','canUpdate','reset','/pull','pull','/restart','restart','/migrations','migrations','exports'];(function(_0xbd08b4,_0x4790ed){var _0x314f1e=function(_0x161589){while(--_0x161589){_0xbd08b4['push'](_0xbd08b4['shift']());}};_0x314f1e(++_0x4790ed);}(_0x7a0a,0x100));var _0xa7a0=function(_0x5df5b7,_0x4ff315){_0x5df5b7=_0x5df5b7-0x0;var _0x1adb5f=_0x7a0a[_0x5df5b7];return _0x1adb5f;};'use strict';var express=require(_0xa7a0('0x0'));var router=express[_0xa7a0('0x1')]();var auth=require(_0xa7a0('0x2'));var controller=require(_0xa7a0('0x3'));router[_0xa7a0('0x4')]('/',controller[_0xa7a0('0x5')]);router[_0xa7a0('0x4')]('/fetch',auth[_0xa7a0('0x6')](),auth[_0xa7a0('0x7')](),controller['fetch']);router[_0xa7a0('0x4')]('/reset',auth[_0xa7a0('0x6')](),auth[_0xa7a0('0x7')](),controller[_0xa7a0('0x8')]);router[_0xa7a0('0x4')](_0xa7a0('0x9'),auth['isAuthenticated'](),auth['canUpdate'](),controller[_0xa7a0('0xa')]);router['get'](_0xa7a0('0xb'),auth[_0xa7a0('0x6')](),controller[_0xa7a0('0xc')]);router['get'](_0xa7a0('0xd'),controller[_0xa7a0('0xe')]);module[_0xa7a0('0xf')]=router; \ No newline at end of file diff --git a/server/api/version/version.controller.js b/server/api/version/version.controller.js index b3dd0f1..1cc16e6 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 _0x82dd=['npm\x20install\x20--production','restart','then','pm2\x20restart\x20motion\x20%s','catch','migrations','root','server','replace','length','sort','sequelize','Migration','getQueryInterface','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','join','map','.js','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','UniqueConstraintError','Database\x20already\x20up-to-date','umzug','path','lodash','pkginfo','version','exec','../../mysqldb','../../config/environment','update','simple-git','query','latest','tags','exports','2.0.0','status','origin','error','json','info','git\x20fetch\x20origin\x20master','reset','--hard','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','pull'];(function(_0x38073a,_0x22b89e){var _0x36784c=function(_0x323803){while(--_0x323803){_0x38073a['push'](_0x38073a['shift']());}};_0x36784c(++_0x22b89e);}(_0x82dd,0x1c6));var _0xd82d=function(_0x4804d7,_0x56ef10){_0x4804d7=_0x4804d7-0x0;var _0x532259=_0x82dd[_0x4804d7];return _0x532259;};'use strict';var Umzug=require(_0xd82d('0x0'));var path=require(_0xd82d('0x1'));var fs=require('fs');var _=require(_0xd82d('0x2'));var pkginfo=require(_0xd82d('0x3'))(module,_0xd82d('0x4'));var compareVersions=require('compare-versions');var exec=require('child_process')[_0xd82d('0x5')];var db=require(_0xd82d('0x6'))['db'];var config=require(_0xd82d('0x7'));var pm2=require('../../config/pm2');var logger=require('../../config/logger')(_0xd82d('0x8'));var git=require(_0xd82d('0x9'))(config['root']);exports['index']=function(_0x4ed46b,_0x292c2e){var _0x1b640d={'current':module['exports']['version'],'phonebar':0x2};if(_0x4ed46b[_0xd82d('0xa')]&&_0x4ed46b[_0xd82d('0xa')][_0xd82d('0xb')]){return git['fetch']()[_0xd82d('0xc')](function(_0x1c76b2,_0x1bd6ee){_0x1b640d[_0xd82d('0xb')]=(_0x1c76b2?module[_0xd82d('0xd')][_0xd82d('0x4')]:_0x1bd6ee[_0xd82d('0xb')])||_0xd82d('0xe');return _0x292c2e[_0xd82d('0xf')](0xc8)['json'](_0x1b640d);});}else{return _0x292c2e[_0xd82d('0xf')](0xc8)['json'](_0x1b640d);}};exports['fetch']=function(_0x553ec8,_0x4f13bb){return git['fetch']([_0xd82d('0x10'),'master'],function(_0x2c9387){if(_0x2c9387){logger[_0xd82d('0x11')](_0x2c9387);return _0x4f13bb[_0xd82d('0xf')](0x1f4)[_0xd82d('0x12')](_0x2c9387);}logger[_0xd82d('0x13')]('git\x20fetch');return _0x4f13bb['status'](0xc8)[_0xd82d('0x12')]({'output':_0xd82d('0x14')});});};exports['reset']=function(_0x334262,_0x5f0b4e){return git[_0xd82d('0x15')]([_0xd82d('0x16'),'FETCH_HEAD'],function(_0x56d012){if(_0x56d012){logger['error'](_0x56d012);return _0x5f0b4e[_0xd82d('0xf')](0x1f4)[_0xd82d('0x12')](_0x56d012);}logger[_0xd82d('0x13')](_0xd82d('0x17'));return _0x5f0b4e['status'](0xc8)[_0xd82d('0x12')]({'output':_0xd82d('0x18')});});};exports[_0xd82d('0x19')]=function(_0x35869f,_0x3da773){exec(_0xd82d('0x1a'),function(_0x5a5603,_0x3bec41,_0x35dff6){logger[_0xd82d('0x13')](_0x3bec41);logger[_0xd82d('0x13')](_0x35dff6);if(_0x5a5603){logger[_0xd82d('0x11')](_0x5a5603);return _0x3da773[_0xd82d('0xf')](0x1f4)['json'](_0x5a5603);}return _0x3da773[_0xd82d('0xf')](0xc8)[_0xd82d('0x12')]({'output':_0x3bec41});});};exports[_0xd82d('0x1b')]=function(_0x16b41f,_0x2ecc15){return pm2[_0xd82d('0x1b')]('motion2')[_0xd82d('0x1c')](function(_0x431b68){logger[_0xd82d('0x13')](_0xd82d('0x1d'),_0x431b68);return _0x2ecc15[_0xd82d('0xf')](0xc8)['json']({'output':'Your\x20system\x20has\x20been\x20restart\x20successfully'});})[_0xd82d('0x1e')](function(_0x2de12d){logger[_0xd82d('0x11')](_0x2de12d);return _0x2ecc15['status'](0x1f4)['json'](_0x2de12d);});};exports[_0xd82d('0x1f')]=function(_0x1a3959,_0xef8fb7){var _0x6df423=fs['readdirSync'](path['join'](config[_0xd82d('0x20')],_0xd82d('0x21'),_0xd82d('0x1f')));var _0x2625af=[];for(var _0x49a141=0x0;_0x49a141<_0x6df423['length'];_0x49a141++){var _0x198525=_0x6df423[_0x49a141][_0xd82d('0x22')]('.js','');if(compareVersions(module[_0xd82d('0xd')][_0xd82d('0x4')],_0x198525)===-0x1){_0x2625af['push'](_0x198525);}}if(_0x2625af[_0xd82d('0x23')]){var _0x51c461=_0x2625af[_0xd82d('0x24')](compareVersions);var _0x4f0fa7=new Umzug({'storage':_0xd82d('0x25'),'storageOptions':{'model':db[_0xd82d('0x26')],'modelName':_0xd82d('0x26'),'columnName':'version'},'migrations':{'params':[db[_0xd82d('0x25')][_0xd82d('0x27')](),db[_0xd82d('0x25')]['constructor'],function(){throw new Error(_0xd82d('0x28'));}],'path':path[_0xd82d('0x29')](config[_0xd82d('0x20')],_0xd82d('0x21'),_0xd82d('0x1f')),'pattern':/\.js$/}});_0x4f0fa7['up']({'migrations':_[_0xd82d('0x2a')](_0x51c461,function(_0x2c716a){return _0x2c716a+_0xd82d('0x2b');})})['then'](function(){return _0xef8fb7[_0xd82d('0xf')](0xc8)[_0xd82d('0x12')]({'output':_0xd82d('0x2c')+module[_0xd82d('0xd')][_0xd82d('0x4')]+_0xd82d('0x2d')+_['last'](_0x51c461),'migrations':_[_0xd82d('0x29')](_0x51c461)});})['catch'](function(_0x3592cd){if(_0x3592cd instanceof db[_0xd82d('0x25')][_0xd82d('0x2e')]){return _0xef8fb7['status'](0xc8)[_0xd82d('0x12')]({'output':_0xd82d('0x2f')});}else{return _0xef8fb7[_0xd82d('0xf')](0x1f4)[_0xd82d('0x12')](_0x3592cd);}});}else{return _0xef8fb7[_0xd82d('0xf')](0xc8)['json']({'output':'Database\x20already\x20up-to-date'});}}; \ No newline at end of file +var _0xae49=['.js','push','sequelize','Migration','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','map','then','\x20to\x20','join','UniqueConstraintError','Database\x20already\x20up-to-date','version','child_process','../../mysqldb','simple-git','root','exports','query','latest','fetch','tags','2.0.0','status','json','master','error','info','git\x20fetch','git\x20fetch\x20origin\x20master','reset','--hard','FETCH_HEAD','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','pull','npm\x20install\x20--production','restart','motion2','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','migrations','readdirSync','server','length','replace'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0xae49,0x1a9));var _0x9ae4=function(_0x24bd67,_0x254d81){_0x24bd67=_0x24bd67-0x0;var _0x11db23=_0xae49[_0x24bd67];return _0x11db23;};'use strict';var Umzug=require('umzug');var path=require('path');var fs=require('fs');var _=require('lodash');var pkginfo=require('pkginfo')(module,_0x9ae4('0x0'));var compareVersions=require('compare-versions');var exec=require(_0x9ae4('0x1'))['exec'];var db=require(_0x9ae4('0x2'))['db'];var config=require('../../config/environment');var pm2=require('../../config/pm2');var logger=require('../../config/logger')('update');var git=require(_0x9ae4('0x3'))(config[_0x9ae4('0x4')]);exports['index']=function(_0x5f2aee,_0x31cc9b){var _0x173fcf={'current':module[_0x9ae4('0x5')][_0x9ae4('0x0')],'phonebar':0x2};if(_0x5f2aee[_0x9ae4('0x6')]&&_0x5f2aee[_0x9ae4('0x6')][_0x9ae4('0x7')]){return git[_0x9ae4('0x8')]()[_0x9ae4('0x9')](function(_0x41faa1,_0x1fb5c7){_0x173fcf[_0x9ae4('0x7')]=(_0x41faa1?module[_0x9ae4('0x5')]['version']:_0x1fb5c7[_0x9ae4('0x7')])||_0x9ae4('0xa');return _0x31cc9b[_0x9ae4('0xb')](0xc8)['json'](_0x173fcf);});}else{return _0x31cc9b[_0x9ae4('0xb')](0xc8)[_0x9ae4('0xc')](_0x173fcf);}};exports[_0x9ae4('0x8')]=function(_0x2b23b9,_0xf5441e){return git[_0x9ae4('0x8')](['origin',_0x9ae4('0xd')],function(_0x221a62){if(_0x221a62){logger[_0x9ae4('0xe')](_0x221a62);return _0xf5441e[_0x9ae4('0xb')](0x1f4)[_0x9ae4('0xc')](_0x221a62);}logger[_0x9ae4('0xf')](_0x9ae4('0x10'));return _0xf5441e[_0x9ae4('0xb')](0xc8)[_0x9ae4('0xc')]({'output':_0x9ae4('0x11')});});};exports[_0x9ae4('0x12')]=function(_0x191fb7,_0x42fbb7){return git[_0x9ae4('0x12')]([_0x9ae4('0x13'),_0x9ae4('0x14')],function(_0x5bdada){if(_0x5bdada){logger[_0x9ae4('0xe')](_0x5bdada);return _0x42fbb7['status'](0x1f4)[_0x9ae4('0xc')](_0x5bdada);}logger[_0x9ae4('0xf')](_0x9ae4('0x15'));return _0x42fbb7['status'](0xc8)[_0x9ae4('0xc')]({'output':_0x9ae4('0x16')});});};exports[_0x9ae4('0x17')]=function(_0x18bc88,_0x594540){exec(_0x9ae4('0x18'),function(_0x9f1cf7,_0x18a1e5,_0x18b790){logger['info'](_0x18a1e5);logger[_0x9ae4('0xf')](_0x18b790);if(_0x9f1cf7){logger[_0x9ae4('0xe')](_0x9f1cf7);return _0x594540[_0x9ae4('0xb')](0x1f4)[_0x9ae4('0xc')](_0x9f1cf7);}return _0x594540['status'](0xc8)[_0x9ae4('0xc')]({'output':_0x18a1e5});});};exports[_0x9ae4('0x19')]=function(_0x23421a,_0x4f80cb){return pm2['restart'](_0x9ae4('0x1a'))['then'](function(_0x262b57){logger[_0x9ae4('0xf')](_0x9ae4('0x1b'),_0x262b57);return _0x4f80cb[_0x9ae4('0xb')](0xc8)['json']({'output':_0x9ae4('0x1c')});})[_0x9ae4('0x1d')](function(_0x458431){logger['error'](_0x458431);return _0x4f80cb['status'](0x1f4)['json'](_0x458431);});};exports[_0x9ae4('0x1e')]=function(_0x610c5a,_0x553210){var _0x16b646=fs[_0x9ae4('0x1f')](path['join'](config[_0x9ae4('0x4')],_0x9ae4('0x20'),'migrations'));var _0x2b1f25=[];for(var _0x50c5b0=0x0;_0x50c5b0<_0x16b646[_0x9ae4('0x21')];_0x50c5b0++){var _0x38806a=_0x16b646[_0x50c5b0][_0x9ae4('0x22')](_0x9ae4('0x23'),'');if(compareVersions(module[_0x9ae4('0x5')][_0x9ae4('0x0')],_0x38806a)===-0x1){_0x2b1f25[_0x9ae4('0x24')](_0x38806a);}}if(_0x2b1f25['length']){var _0xd66691=_0x2b1f25['sort'](compareVersions);var _0x1b4352=new Umzug({'storage':_0x9ae4('0x25'),'storageOptions':{'model':db[_0x9ae4('0x26')],'modelName':_0x9ae4('0x26'),'columnName':_0x9ae4('0x0')},'migrations':{'params':[db[_0x9ae4('0x25')]['getQueryInterface'](),db[_0x9ae4('0x25')]['constructor'],function(){throw new Error(_0x9ae4('0x27'));}],'path':path['join'](config[_0x9ae4('0x4')],_0x9ae4('0x20'),'migrations'),'pattern':/\.js$/}});_0x1b4352['up']({'migrations':_[_0x9ae4('0x28')](_0xd66691,function(_0x302538){return _0x302538+_0x9ae4('0x23');})})[_0x9ae4('0x29')](function(){return _0x553210[_0x9ae4('0xb')](0xc8)[_0x9ae4('0xc')]({'output':'Database\x20migrated\x20successfully\x20from\x20version\x20'+module[_0x9ae4('0x5')][_0x9ae4('0x0')]+_0x9ae4('0x2a')+_['last'](_0xd66691),'migrations':_[_0x9ae4('0x2b')](_0xd66691)});})[_0x9ae4('0x1d')](function(_0x1c984f){if(_0x1c984f instanceof db['sequelize'][_0x9ae4('0x2c')]){return _0x553210[_0x9ae4('0xb')](0xc8)[_0x9ae4('0xc')]({'output':'Database\x20already\x20up-to-date'});}else{return _0x553210[_0x9ae4('0xb')](0x1f4)[_0x9ae4('0xc')](_0x1c984f);}});}else{return _0x553210[_0x9ae4('0xb')](0xc8)[_0x9ae4('0xc')]({'output':_0x9ae4('0x2d')});}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/index.js b/server/api/voiceAgentReport/index.js index 4bac9e0..9c2af4a 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 _0x84fd=['/describe','describe','/:id','show','post','put','update','delete','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceAgentReport.controller','get','isAuthenticated','index'];(function(_0x155ff1,_0x554d55){var _0x13912d=function(_0x3b0838){while(--_0x3b0838){_0x155ff1['push'](_0x155ff1['shift']());}};_0x13912d(++_0x554d55);}(_0x84fd,0x170));var _0xd84f=function(_0x5a3c94,_0x3e1834){_0x5a3c94=_0x5a3c94-0x0;var _0x3fbec3=_0x84fd[_0x5a3c94];return _0x3fbec3;};'use strict';var multer=require(_0xd84f('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xd84f('0x1'));var express=require(_0xd84f('0x2'));var router=express[_0xd84f('0x3')]();var fs_extra=require(_0xd84f('0x4'));var auth=require(_0xd84f('0x5'));var interaction=require(_0xd84f('0x6'));var config=require(_0xd84f('0x7'));var controller=require(_0xd84f('0x8'));router[_0xd84f('0x9')]('/',auth[_0xd84f('0xa')](),controller[_0xd84f('0xb')]);router[_0xd84f('0x9')](_0xd84f('0xc'),auth['isAuthenticated'](),controller[_0xd84f('0xd')]);router[_0xd84f('0x9')](_0xd84f('0xe'),auth[_0xd84f('0xa')](),controller[_0xd84f('0xf')]);router[_0xd84f('0x10')]('/',auth[_0xd84f('0xa')](),controller['create']);router[_0xd84f('0x11')](_0xd84f('0xe'),auth[_0xd84f('0xa')](),controller[_0xd84f('0x12')]);router[_0xd84f('0x13')]('/:id',auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x35dd=['./voiceAgentReport.controller','get','isAuthenticated','/describe','show','post','create','put','update','delete','/:id','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment'];(function(_0x5a1cc9,_0x28f54d){var _0x471761=function(_0xda51c0){while(--_0xda51c0){_0x5a1cc9['push'](_0x5a1cc9['shift']());}};_0x471761(++_0x28f54d);}(_0x35dd,0x8b));var _0xd35d=function(_0x488ce0,_0x33808d){_0x488ce0=_0x488ce0-0x0;var _0xa30a46=_0x35dd[_0x488ce0];return _0xa30a46;};'use strict';var multer=require(_0xd35d('0x0'));var util=require(_0xd35d('0x1'));var path=require(_0xd35d('0x2'));var timeout=require(_0xd35d('0x3'));var express=require('express');var router=express[_0xd35d('0x4')]();var fs_extra=require(_0xd35d('0x5'));var auth=require(_0xd35d('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xd35d('0x7'));var controller=require(_0xd35d('0x8'));router[_0xd35d('0x9')]('/',auth[_0xd35d('0xa')](),controller['index']);router[_0xd35d('0x9')](_0xd35d('0xb'),auth['isAuthenticated'](),controller['describe']);router['get']('/:id',auth[_0xd35d('0xa')](),controller[_0xd35d('0xc')]);router[_0xd35d('0xd')]('/',auth[_0xd35d('0xa')](),controller[_0xd35d('0xe')]);router[_0xd35d('0xf')]('/:id',auth['isAuthenticated'](),controller[_0xd35d('0x10')]);router[_0xd35d('0x11')](_0xd35d('0x12'),auth[_0xd35d('0xa')](),controller[_0xd35d('0x13')]);module[_0xd35d('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.attributes.js b/server/api/voiceAgentReport/voiceAgentReport.attributes.js index b5e266c..cf2d0cd 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 _0xbcff=['FORWARD,\x20BLIND,\x20ATTENDED','sequelize','exports','STRING','DATE','BOOLEAN','INTEGER'];(function(_0x307060,_0x26dc3d){var _0x3a2587=function(_0x283dde){while(--_0x283dde){_0x307060['push'](_0x307060['shift']());}};_0x3a2587(++_0x26dc3d);}(_0xbcff,0x12e));var _0xfbcf=function(_0x3962f2,_0x5a7154){_0x3962f2=_0x3962f2-0x0;var _0x4d7dab=_0xbcff[_0x3962f2];return _0x4d7dab;};'use strict';var Sequelize=require(_0xfbcf('0x0'));module[_0xfbcf('0x1')]={'type':{'type':Sequelize[_0xfbcf('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xfbcf('0x2')]},'calleridname':{'type':Sequelize[_0xfbcf('0x2')]},'queue':{'type':Sequelize[_0xfbcf('0x2')]},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0xfbcf('0x2')]},'agentcalledAt':{'type':Sequelize[_0xfbcf('0x3')]},'agentconnectAt':{'type':Sequelize[_0xfbcf('0x3')]},'agentcompleteAt':{'type':Sequelize['DATE']},'agentringnoanswerAt':{'type':Sequelize[_0xfbcf('0x3')]},'agentdumpAt':{'type':Sequelize[_0xfbcf('0x3')]},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize[_0xfbcf('0x4')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0xfbcf('0x4')],'defaultValue':![]},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'talktime':{'type':Sequelize[_0xfbcf('0x5')]},'agentacw':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xfbcf('0x5')]},'reason':{'type':Sequelize[_0xfbcf('0x2')]},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0xfbcf('0x5')]},'channelstatedesc':{'type':Sequelize[_0xfbcf('0x2')]},'connectedlinenum':{'type':Sequelize[_0xfbcf('0x2')]},'connectedlinename':{'type':Sequelize[_0xfbcf('0x2')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xfbcf('0x2')]},'context':{'type':Sequelize[_0xfbcf('0x2')]},'exten':{'type':Sequelize[_0xfbcf('0x2')]},'priority':{'type':Sequelize[_0xfbcf('0x2')]},'destchannel':{'type':Sequelize[_0xfbcf('0x2')]},'destchannelstate':{'type':Sequelize[_0xfbcf('0x5')]},'destchannelstatedesc':{'type':Sequelize[_0xfbcf('0x2')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize[_0xfbcf('0x2')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize[_0xfbcf('0x2')]},'destlanguage':{'type':Sequelize[_0xfbcf('0x2')]},'destaccountcode':{'type':Sequelize[_0xfbcf('0x2')]},'destcontext':{'type':Sequelize[_0xfbcf('0x2')]},'destexten':{'type':Sequelize[_0xfbcf('0x2')]},'destpriority':{'type':Sequelize[_0xfbcf('0x2')]},'destuniqueid':{'type':Sequelize[_0xfbcf('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0xfbcf('0x2')]},'answeredelsewheremembername':{'type':Sequelize[_0xfbcf('0x2')]},'transfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xfbcf('0x2')],'comment':_0xfbcf('0x6')},'transferexten':{'type':Sequelize[_0xfbcf('0x2')]},'transferuniqueid':{'type':Sequelize[_0xfbcf('0x2')]},'agententerreason':{'type':Sequelize[_0xfbcf('0x5')],'defaultValue':0x0}}; \ No newline at end of file +var _0x578c=['FORWARD,\x20BLIND,\x20ATTENDED','sequelize','exports','STRING','DATE','INTEGER','BOOLEAN'];(function(_0x5e2800,_0x99396a){var _0xb72b6c=function(_0x27d165){while(--_0x27d165){_0x5e2800['push'](_0x5e2800['shift']());}};_0xb72b6c(++_0x99396a);}(_0x578c,0x158));var _0xc578=function(_0x5c2f1a,_0x42fca0){_0x5c2f1a=_0x5c2f1a-0x0;var _0x1e277e=_0x578c[_0x5c2f1a];return _0x1e277e;};'use strict';var Sequelize=require(_0xc578('0x0'));module[_0xc578('0x1')]={'type':{'type':Sequelize[_0xc578('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xc578('0x2')]},'calleridname':{'type':Sequelize[_0xc578('0x2')]},'queue':{'type':Sequelize[_0xc578('0x2')]},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0xc578('0x2')]},'agentcalledAt':{'type':Sequelize[_0xc578('0x3')]},'agentconnectAt':{'type':Sequelize[_0xc578('0x3')]},'agentcompleteAt':{'type':Sequelize[_0xc578('0x3')]},'agentringnoanswerAt':{'type':Sequelize[_0xc578('0x3')]},'agentdumpAt':{'type':Sequelize[_0xc578('0x3')]},'holdtime':{'type':Sequelize[_0xc578('0x4')]},'agentcomplete':{'type':Sequelize[_0xc578('0x5')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0xc578('0x5')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0xc578('0x5')],'defaultValue':![]},'talktime':{'type':Sequelize[_0xc578('0x4')]},'agentacw':{'type':Sequelize[_0xc578('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xc578('0x4')]},'reason':{'type':Sequelize[_0xc578('0x2')]},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0xc578('0x4')]},'channelstatedesc':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0xc578('0x2')]},'connectedlinename':{'type':Sequelize[_0xc578('0x2')]},'language':{'type':Sequelize[_0xc578('0x2')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0xc578('0x2')]},'exten':{'type':Sequelize[_0xc578('0x2')]},'priority':{'type':Sequelize[_0xc578('0x2')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0xc578('0x4')]},'destchannelstatedesc':{'type':Sequelize[_0xc578('0x2')]},'destcalleridnum':{'type':Sequelize[_0xc578('0x2')]},'destcalleridname':{'type':Sequelize[_0xc578('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0xc578('0x2')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0xc578('0x2')]},'destaccountcode':{'type':Sequelize[_0xc578('0x2')]},'destcontext':{'type':Sequelize[_0xc578('0x2')]},'destexten':{'type':Sequelize[_0xc578('0x2')]},'destpriority':{'type':Sequelize[_0xc578('0x2')]},'destuniqueid':{'type':Sequelize[_0xc578('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0xc578('0x2')]},'answeredelsewheremembername':{'type':Sequelize[_0xc578('0x2')]},'transfer':{'type':Sequelize[_0xc578('0x5')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xc578('0x2')],'comment':_0xc578('0x6')},'transferexten':{'type':Sequelize[_0xc578('0x2')]},'transferuniqueid':{'type':Sequelize[_0xc578('0x2')]},'agententerreason':{'type':Sequelize[_0xc578('0x4')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.controller.js b/server/api/voiceAgentReport/voiceAgentReport.controller.js index 062b569..22cf22d 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(_0x19b3f9,_0xade753){var _0x18c3f6=function(_0x21439f){while(--_0x21439f){_0x19b3f9['push'](_0x19b3f9['shift']());}};_0x18c3f6(++_0xade753);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2763f2,_0x416af8){_0x2763f2=_0x2763f2-0x0;var _0x3ef471=_0xa9e0[_0x2763f2];return _0x3ef471;};'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(_0x9c2427,_0x17c865){var _0x51984f=function(_0x177af6){while(--_0x177af6){_0x9c2427['push'](_0x9c2427['shift']());}};_0x51984f(++_0x17c865);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3b5250,_0x7a0b2c){_0x3b5250=_0x3b5250-0x0;var _0xc844a1=_0xa9e0[_0x3b5250];return _0xc844a1;};'use strict';var emlformat=require(_0x0a9e('0x0'));var rimraf=require(_0x0a9e('0x1'));var zipdir=require(_0x0a9e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0a9e('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x0a9e('0x4'));var util=require(_0x0a9e('0x5'));var path=require(_0x0a9e('0x6'));var sox=require(_0x0a9e('0x7'));var csv=require(_0x0a9e('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0a9e('0x9'));var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];function respondWithStatusCode(_0xd5b662,_0x26d672){_0x26d672=_0x26d672||0xcc;return function(_0x32d742){if(_0x32d742){return _0xd5b662[_0x0a9e('0x15')](_0x26d672);}return _0xd5b662['status'](_0x26d672)[_0x0a9e('0x16')]();};}function respondWithResult(_0x239b12,_0x2b4227){_0x2b4227=_0x2b4227||0xc8;return function(_0x281129){if(_0x281129){return _0x239b12[_0x0a9e('0x17')](_0x2b4227)[_0x0a9e('0x18')](_0x281129);}};}function respondWithFilteredResult(_0x52a03d,_0x22dccb){return function(_0x5d0880){if(_0x5d0880){var _0x1985b6=typeof _0x22dccb['offset']===_0x0a9e('0x19')&&typeof _0x22dccb[_0x0a9e('0x1a')]==='undefined';var _0x225616=_0x5d0880['count'];var _0x459eb1=_0x1985b6?0x0:_0x22dccb[_0x0a9e('0x1b')];var _0x106033=_0x1985b6?_0x5d0880[_0x0a9e('0x1c')]:_0x22dccb[_0x0a9e('0x1b')]+_0x22dccb[_0x0a9e('0x1a')];var _0x530eb7;if(_0x106033>=_0x225616){_0x106033=_0x225616;_0x530eb7=0xc8;}else{_0x530eb7=0xce;}_0x52a03d[_0x0a9e('0x17')](_0x530eb7);return _0x52a03d[_0x0a9e('0x1d')](_0x0a9e('0x1e'),_0x459eb1+'-'+_0x106033+'/'+_0x225616)[_0x0a9e('0x18')](_0x5d0880);}return null;};}function patchUpdates(_0x105080){return function(_0x4bb1e3){try{jsonpatch[_0x0a9e('0x1f')](_0x4bb1e3,_0x105080,!![]);}catch(_0x155cce){return BPromise['reject'](_0x155cce);}return _0x4bb1e3[_0x0a9e('0x20')]();};}function saveUpdates(_0x5a09ef,_0x588269){return function(_0x3a02e1){if(_0x3a02e1){return _0x3a02e1[_0x0a9e('0x21')](_0x5a09ef)[_0x0a9e('0x22')](function(_0x30bae6){return _0x30bae6;});}return null;};}function removeEntity(_0x4abc77,_0xfb6e48){return function(_0x2fb0e4){if(_0x2fb0e4){return _0x2fb0e4[_0x0a9e('0x23')]()[_0x0a9e('0x22')](function(){_0x4abc77[_0x0a9e('0x17')](0xcc)[_0x0a9e('0x16')]();});}};}function handleEntityNotFound(_0x16b1ca,_0x5ea472){return function(_0x59181e){if(!_0x59181e){_0x16b1ca[_0x0a9e('0x15')](0x194);}return _0x59181e;};}function handleError(_0x3a8e58,_0x40c424){_0x40c424=_0x40c424||0x1f4;return function(_0x33161b){logger['error'](_0x33161b[_0x0a9e('0x24')]);if(_0x33161b['name']){delete _0x33161b[_0x0a9e('0x25')];}_0x3a8e58['status'](_0x40c424)[_0x0a9e('0x26')](_0x33161b);};}exports[_0x0a9e('0x27')]=function(_0x25fba9,_0x14433c){var _0x140511={},_0x1538a4={},_0x11c3b6={'count':0x0,'rows':[]};var _0x14de77=_['map'](db[_0x0a9e('0x28')][_0x0a9e('0x29')],function(_0x2b1f27){return{'name':_0x2b1f27[_0x0a9e('0x2a')],'type':_0x2b1f27['type'][_0x0a9e('0x2b')]};});_0x1538a4[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x14de77,_0x0a9e('0x25'));_0x1538a4[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x25fba9[_0x0a9e('0x2e')]);_0x1538a4[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0x1538a4['model'],_0x1538a4[_0x0a9e('0x2e')]);_0x140511['attributes']=_[_0x0a9e('0x31')](_0x1538a4[_0x0a9e('0x2c')],qs[_0x0a9e('0x32')](_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x32')]));_0x140511['attributes']=_0x140511[_0x0a9e('0x33')][_0x0a9e('0x34')]?_0x140511[_0x0a9e('0x33')]:_0x1538a4[_0x0a9e('0x2c')];if(!_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x35')](_0x0a9e('0x36'))){_0x140511[_0x0a9e('0x1a')]=qs['limit'](_0x25fba9[_0x0a9e('0x2e')]['limit']);_0x140511[_0x0a9e('0x1b')]=qs[_0x0a9e('0x1b')](_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x1b')]);}_0x140511['order']=qs[_0x0a9e('0x37')](_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x37')]);_0x140511[_0x0a9e('0x38')]=qs['filters'](_['pick'](_0x25fba9[_0x0a9e('0x2e')],_0x1538a4['filters']),_0x14de77);if(_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x39')]){_0x140511[_0x0a9e('0x38')]=_[_0x0a9e('0x3a')](_0x140511['where'],{'$or':_[_0x0a9e('0x2d')](_0x14de77,function(_0x3bfce8){if(_0x3bfce8[_0x0a9e('0x3b')]!=='VIRTUAL'){var _0x1dbf74={};_0x1dbf74[_0x3bfce8[_0x0a9e('0x25')]]={'$like':'%'+_0x25fba9[_0x0a9e('0x2e')]['filter']+'%'};return _0x1dbf74;}})});}_0x140511=_['merge']({},_0x140511,_0x25fba9[_0x0a9e('0x3c')]);var _0x40d766={'where':_0x140511['where']};return db[_0x0a9e('0x28')][_0x0a9e('0x1c')](_0x40d766)[_0x0a9e('0x22')](function(_0x148f55){_0x11c3b6['count']=_0x148f55;if(_0x25fba9['query'][_0x0a9e('0x3d')]){_0x140511[_0x0a9e('0x3e')]=[{'all':!![]}];}return db['VoiceAgentReport'][_0x0a9e('0x3f')](_0x140511);})[_0x0a9e('0x22')](function(_0x1459bb){_0x11c3b6['rows']=_0x1459bb;return _0x11c3b6;})[_0x0a9e('0x22')](respondWithFilteredResult(_0x14433c,_0x140511))[_0x0a9e('0x40')](handleError(_0x14433c,null));};exports[_0x0a9e('0x41')]=function(_0x43dd5b,_0x13cb1f){var _0xeaa5e5={'raw':![],'where':{'id':_0x43dd5b[_0x0a9e('0x42')]['id']}},_0x2881b3={};_0x2881b3[_0x0a9e('0x2c')]=_[_0x0a9e('0x2f')](db[_0x0a9e('0x28')][_0x0a9e('0x29')]);_0x2881b3[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x43dd5b[_0x0a9e('0x2e')]);_0x2881b3['filters']=_['intersection'](_0x2881b3[_0x0a9e('0x2c')],_0x2881b3[_0x0a9e('0x2e')]);_0xeaa5e5[_0x0a9e('0x33')]=_[_0x0a9e('0x31')](_0x2881b3[_0x0a9e('0x2c')],qs[_0x0a9e('0x32')](_0x43dd5b[_0x0a9e('0x2e')][_0x0a9e('0x32')]));_0xeaa5e5[_0x0a9e('0x33')]=_0xeaa5e5[_0x0a9e('0x33')][_0x0a9e('0x34')]?_0xeaa5e5[_0x0a9e('0x33')]:_0x2881b3['model'];if(_0x43dd5b[_0x0a9e('0x2e')][_0x0a9e('0x3d')]){_0xeaa5e5[_0x0a9e('0x3e')]=[{'all':!![]}];}_0xeaa5e5=_[_0x0a9e('0x3a')]({},_0xeaa5e5,_0x43dd5b[_0x0a9e('0x3c')]);return db[_0x0a9e('0x28')][_0x0a9e('0x43')](_0xeaa5e5)[_0x0a9e('0x22')](handleEntityNotFound(_0x13cb1f,null))['then'](respondWithResult(_0x13cb1f,null))[_0x0a9e('0x40')](handleError(_0x13cb1f,null));};exports['create']=function(_0x473dc8,_0x476688){return db[_0x0a9e('0x28')]['create'](_0x473dc8[_0x0a9e('0x44')],{})[_0x0a9e('0x22')](respondWithResult(_0x476688,0xc9))[_0x0a9e('0x40')](handleError(_0x476688,null));};exports[_0x0a9e('0x21')]=function(_0x45c845,_0x37be73){if(_0x45c845[_0x0a9e('0x44')]['id']){delete _0x45c845['body']['id'];}return db[_0x0a9e('0x28')][_0x0a9e('0x43')]({'where':{'id':_0x45c845[_0x0a9e('0x42')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x37be73,null))[_0x0a9e('0x22')](saveUpdates(_0x45c845[_0x0a9e('0x44')],null))[_0x0a9e('0x22')](respondWithResult(_0x37be73,null))[_0x0a9e('0x40')](handleError(_0x37be73,null));};exports[_0x0a9e('0x23')]=function(_0x58a5c2,_0xe401a){return db[_0x0a9e('0x28')]['find']({'where':{'id':_0x58a5c2['params']['id']}})['then'](handleEntityNotFound(_0xe401a,null))[_0x0a9e('0x22')](removeEntity(_0xe401a,null))[_0x0a9e('0x40')](handleError(_0xe401a,null));};exports[_0x0a9e('0x45')]=function(_0x11545a,_0x61bb17){return db[_0x0a9e('0x28')][_0x0a9e('0x45')]()[_0x0a9e('0x22')](respondWithResult(_0x61bb17,null))['catch'](handleError(_0x61bb17,null));}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.model.js b/server/api/voiceAgentReport/voiceAgentReport.model.js index 7de88ff..673898f 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 _0x64f5=['path','../../config/environment','./voiceAgentReport.attributes','exports','VoiceAgentReport','report_agent','uniqueid','destuniqueid','lodash','moment','request-promise'];(function(_0x35b2a1,_0x4cdca8){var _0x6023da=function(_0x10cd9f){while(--_0x10cd9f){_0x35b2a1['push'](_0x35b2a1['shift']());}};_0x6023da(++_0x4cdca8);}(_0x64f5,0x17e));var _0x564f=function(_0x1986b4,_0x4cc601){_0x1986b4=_0x1986b4-0x0;var _0x2f7d5d=_0x64f5[_0x1986b4];return _0x2f7d5d;};'use strict';var _=require(_0x564f('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x564f('0x1'));var BPromise=require('bluebird');var rp=require(_0x564f('0x2'));var fs=require('fs');var path=require(_0x564f('0x3'));var rimraf=require('rimraf');var config=require(_0x564f('0x4'));var attributes=require(_0x564f('0x5'));module[_0x564f('0x6')]=function(_0x72b009,_0x4bbedf){return _0x72b009['define'](_0x564f('0x7'),attributes,{'tableName':_0x564f('0x8'),'paranoid':![],'indexes':[{'fields':[_0x564f('0x9'),_0x564f('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9a14=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','define','VoiceAgentReport','report_agent','destuniqueid'];(function(_0x21c2f9,_0x2f2bb6){var _0x149fac=function(_0xdb4bf5){while(--_0xdb4bf5){_0x21c2f9['push'](_0x21c2f9['shift']());}};_0x149fac(++_0x2f2bb6);}(_0x9a14,0xa8));var _0x49a1=function(_0x5ccc15,_0x328351){_0x5ccc15=_0x5ccc15-0x0;var _0x2ab60c=_0x9a14[_0x5ccc15];return _0x2ab60c;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x49a1('0x0'))(_0x49a1('0x1'));var moment=require(_0x49a1('0x2'));var BPromise=require(_0x49a1('0x3'));var rp=require(_0x49a1('0x4'));var fs=require('fs');var path=require(_0x49a1('0x5'));var rimraf=require(_0x49a1('0x6'));var config=require(_0x49a1('0x7'));var attributes=require('./voiceAgentReport.attributes');module['exports']=function(_0x479018,_0x5283aa){return _0x479018[_0x49a1('0x8')](_0x49a1('0x9'),attributes,{'tableName':_0x49a1('0xa'),'paranoid':![],'indexes':[{'fields':['uniqueid',_0x49a1('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.rpc.js b/server/api/voiceAgentReport/voiceAgentReport.rpc.js index 2f06272..b80740d 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 _0xf216=['VoiceAgentReport','catch','UpdateVoiceAgentReport','body','options','raw','where','attributes','limit','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','CreateVoiceAgentReport'];(function(_0x4583a4,_0xe2503f){var _0x133aec=function(_0x32638f){while(--_0x32638f){_0x4583a4['push'](_0x4583a4['shift']());}};_0x133aec(++_0xe2503f);}(_0xf216,0x1e5));var _0x6f21=function(_0x117f4c,_0x36a9b1){_0x117f4c=_0x117f4c-0x0;var _0x2b24e9=_0xf216[_0x117f4c];return _0x2b24e9;};'use strict';var _=require(_0x6f21('0x0'));var util=require(_0x6f21('0x1'));var moment=require(_0x6f21('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6f21('0x3'));var db=require(_0x6f21('0x4'))['db'];var utils=require(_0x6f21('0x5'));var logger=require(_0x6f21('0x6'))(_0x6f21('0x7'));var config=require(_0x6f21('0x8'));var jayson=require(_0x6f21('0x9'));var client=jayson[_0x6f21('0xa')][_0x6f21('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3f271b,_0x42a44d,_0x324ccb){return new BPromise(function(_0x3891a1,_0x1e8959){return client[_0x6f21('0xc')](_0x3f271b,_0x324ccb)[_0x6f21('0xd')](function(_0x321a97){logger['info'](_0x6f21('0xe'),_0x42a44d,_0x6f21('0xf'));logger[_0x6f21('0x10')](_0x6f21('0x11'),_0x42a44d,'request\x20sent',JSON[_0x6f21('0x12')](_0x321a97));if(_0x321a97[_0x6f21('0x13')]){if(_0x321a97[_0x6f21('0x13')][_0x6f21('0x14')]===0x1f4){logger[_0x6f21('0x13')]('VoiceAgentReport,\x20%s,\x20%s',_0x42a44d,_0x321a97[_0x6f21('0x13')]['message']);return _0x1e8959(_0x321a97[_0x6f21('0x13')][_0x6f21('0x15')]);}logger[_0x6f21('0x13')](_0x6f21('0xe'),_0x42a44d,_0x321a97[_0x6f21('0x13')]['message']);return _0x3891a1(_0x321a97[_0x6f21('0x13')][_0x6f21('0x15')]);}else{logger[_0x6f21('0x16')](_0x6f21('0xe'),_0x42a44d,_0x6f21('0xf'));_0x3891a1(_0x321a97[_0x6f21('0x17')][_0x6f21('0x15')]);}})['catch'](function(_0x1f2b61){logger['error'](_0x6f21('0xe'),_0x42a44d,_0x1f2b61);_0x1e8959(_0x1f2b61);});});}exports[_0x6f21('0x18')]=function(_0x4b687b){var _0x37ec3a=this;return new Promise(function(_0x1af6b0,_0x35bcfb){return db[_0x6f21('0x19')]['create'](_0x4b687b['body'],{'raw':_0x4b687b['options']?_0x4b687b['options']['raw']===undefined?!![]:![]:!![]})[_0x6f21('0xd')](function(_0x1343ad){logger[_0x6f21('0x16')]('CreateVoiceAgentReport',_0x4b687b);logger[_0x6f21('0x10')](_0x6f21('0x18'),_0x4b687b,JSON[_0x6f21('0x12')](_0x1343ad));_0x1af6b0(_0x1343ad);})[_0x6f21('0x1a')](function(_0x17fa2e){logger[_0x6f21('0x13')](_0x6f21('0x18'),_0x17fa2e[_0x6f21('0x15')],_0x4b687b);_0x35bcfb(_0x37ec3a[_0x6f21('0x13')](0x1f4,_0x17fa2e[_0x6f21('0x15')]));});});};exports[_0x6f21('0x1b')]=function(_0x25aaf7){var _0x283cd9=this;return new Promise(function(_0x272a23,_0x4e50b9){return db[_0x6f21('0x19')]['update'](_0x25aaf7[_0x6f21('0x1c')],{'raw':_0x25aaf7['options']?_0x25aaf7[_0x6f21('0x1d')][_0x6f21('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x25aaf7[_0x6f21('0x1d')]?_0x25aaf7['options'][_0x6f21('0x1f')]||null:null,'attributes':_0x25aaf7[_0x6f21('0x1d')]?_0x25aaf7['options'][_0x6f21('0x20')]||null:null,'limit':_0x25aaf7[_0x6f21('0x1d')]?_0x25aaf7['options'][_0x6f21('0x21')]||null:null})[_0x6f21('0xd')](function(_0x5c0c17){logger[_0x6f21('0x16')](_0x6f21('0x1b'),_0x25aaf7);logger['debug'](_0x6f21('0x1b'),_0x25aaf7,JSON[_0x6f21('0x12')](_0x5c0c17));_0x272a23(_0x5c0c17);})[_0x6f21('0x1a')](function(_0x8d482d){logger['error'](_0x6f21('0x1b'),_0x8d482d[_0x6f21('0x15')],_0x25aaf7);_0x4e50b9(_0x283cd9[_0x6f21('0x13')](0x1f4,_0x8d482d[_0x6f21('0x15')]));});});}; \ No newline at end of file +var _0x0f06=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','VoiceAgentReport','body','options','CreateVoiceAgentReport','UpdateVoiceAgentReport','update','raw','where','attributes','debug','util','bluebird','randomstring','../../mysqldb'];(function(_0x4d8666,_0x2ff19d){var _0x37175b=function(_0x1b8de6){while(--_0x1b8de6){_0x4d8666['push'](_0x4d8666['shift']());}};_0x37175b(++_0x2ff19d);}(_0x0f06,0x151));var _0x60f0=function(_0x134cab,_0xdcaa87){_0x134cab=_0x134cab-0x0;var _0xe5a8ab=_0x0f06[_0x134cab];return _0xe5a8ab;};'use strict';var _=require('lodash');var util=require(_0x60f0('0x0'));var moment=require('moment');var BPromise=require(_0x60f0('0x1'));var rs=require(_0x60f0('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x60f0('0x3'))['db'];var utils=require(_0x60f0('0x4'));var logger=require(_0x60f0('0x5'))('rpc');var config=require(_0x60f0('0x6'));var jayson=require(_0x60f0('0x7'));var client=jayson[_0x60f0('0x8')][_0x60f0('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x308838,_0x58fc44,_0x435868){return new BPromise(function(_0xd39fbf,_0x40da70){return client[_0x60f0('0xa')](_0x308838,_0x435868)[_0x60f0('0xb')](function(_0x426ba8){logger[_0x60f0('0xc')](_0x60f0('0xd'),_0x58fc44,_0x60f0('0xe'));logger['debug']('VoiceAgentReport,\x20%s,\x20%s,\x20%s',_0x58fc44,'request\x20sent',JSON[_0x60f0('0xf')](_0x426ba8));if(_0x426ba8[_0x60f0('0x10')]){if(_0x426ba8[_0x60f0('0x10')][_0x60f0('0x11')]===0x1f4){logger[_0x60f0('0x10')](_0x60f0('0xd'),_0x58fc44,_0x426ba8[_0x60f0('0x10')][_0x60f0('0x12')]);return _0x40da70(_0x426ba8['error'][_0x60f0('0x12')]);}logger[_0x60f0('0x10')](_0x60f0('0xd'),_0x58fc44,_0x426ba8[_0x60f0('0x10')]['message']);return _0xd39fbf(_0x426ba8[_0x60f0('0x10')][_0x60f0('0x12')]);}else{logger['info'](_0x60f0('0xd'),_0x58fc44,_0x60f0('0xe'));_0xd39fbf(_0x426ba8[_0x60f0('0x13')][_0x60f0('0x12')]);}})[_0x60f0('0x14')](function(_0x9510e5){logger[_0x60f0('0x10')](_0x60f0('0xd'),_0x58fc44,_0x9510e5);_0x40da70(_0x9510e5);});});}exports['CreateVoiceAgentReport']=function(_0x497b67){var _0x5016f0=this;return new Promise(function(_0x52e3f7,_0x58208e){return db[_0x60f0('0x15')]['create'](_0x497b67[_0x60f0('0x16')],{'raw':_0x497b67['options']?_0x497b67[_0x60f0('0x17')]['raw']===undefined?!![]:![]:!![]})[_0x60f0('0xb')](function(_0x2b202c){logger['info']('CreateVoiceAgentReport',_0x497b67);logger['debug'](_0x60f0('0x18'),_0x497b67,JSON[_0x60f0('0xf')](_0x2b202c));_0x52e3f7(_0x2b202c);})[_0x60f0('0x14')](function(_0x463f55){logger[_0x60f0('0x10')](_0x60f0('0x18'),_0x463f55[_0x60f0('0x12')],_0x497b67);_0x58208e(_0x5016f0[_0x60f0('0x10')](0x1f4,_0x463f55['message']));});});};exports[_0x60f0('0x19')]=function(_0x534ebc){var _0x41ff5a=this;return new Promise(function(_0x5ced7e,_0x54f7ce){return db['VoiceAgentReport'][_0x60f0('0x1a')](_0x534ebc[_0x60f0('0x16')],{'raw':_0x534ebc[_0x60f0('0x17')]?_0x534ebc['options'][_0x60f0('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x534ebc[_0x60f0('0x17')]?_0x534ebc[_0x60f0('0x17')][_0x60f0('0x1c')]||null:null,'attributes':_0x534ebc[_0x60f0('0x17')]?_0x534ebc[_0x60f0('0x17')][_0x60f0('0x1d')]||null:null,'limit':_0x534ebc['options']?_0x534ebc[_0x60f0('0x17')]['limit']||null:null})[_0x60f0('0xb')](function(_0x14a462){logger['info'](_0x60f0('0x19'),_0x534ebc);logger[_0x60f0('0x1e')]('UpdateVoiceAgentReport',_0x534ebc,JSON[_0x60f0('0xf')](_0x14a462));_0x5ced7e(_0x14a462);})[_0x60f0('0x14')](function(_0x306abc){logger[_0x60f0('0x10')](_0x60f0('0x19'),_0x306abc[_0x60f0('0x12')],_0x534ebc);_0x54f7ce(_0x41ff5a[_0x60f0('0x10')](0x1f4,_0x306abc['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index 1034785..f9bd886 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 _0x950a=['/:id','isAuthenticated','show','post','update','delete','destroy','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceCallReport.controller','get','index','describe'];(function(_0x1cc408,_0x4b007b){var _0x31eead=function(_0xacf0b4){while(--_0xacf0b4){_0x1cc408['push'](_0x1cc408['shift']());}};_0x31eead(++_0x4b007b);}(_0x950a,0x111));var _0xa950=function(_0x159037,_0x3ca10a){_0x159037=_0x159037-0x0;var _0x135522=_0x950a[_0x159037];return _0x135522;};'use strict';var multer=require(_0xa950('0x0'));var util=require(_0xa950('0x1'));var path=require(_0xa950('0x2'));var timeout=require(_0xa950('0x3'));var express=require('express');var router=express[_0xa950('0x4')]();var fs_extra=require(_0xa950('0x5'));var auth=require(_0xa950('0x6'));var interaction=require(_0xa950('0x7'));var config=require('../../config/environment');var controller=require(_0xa950('0x8'));router[_0xa950('0x9')]('/',auth['isAuthenticated'](),controller[_0xa950('0xa')]);router[_0xa950('0x9')]('/describe',auth['isAuthenticated'](),controller[_0xa950('0xb')]);router[_0xa950('0x9')](_0xa950('0xc'),auth[_0xa950('0xd')](),controller[_0xa950('0xe')]);router[_0xa950('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0xa950('0xc'),auth['isAuthenticated'](),controller[_0xa950('0x10')]);router[_0xa950('0x11')](_0xa950('0xc'),auth['isAuthenticated'](),controller[_0xa950('0x12')]);module['exports']=router; \ No newline at end of file +var _0xe015=['../../components/interaction/service','../../config/environment','./voiceCallReport.controller','isAuthenticated','index','describe','get','/:id','show','put','update','multer','util','path','Router','../../components/auth/service'];(function(_0x31e1fd,_0x39d852){var _0xf22b36=function(_0x2d3bb8){while(--_0x2d3bb8){_0x31e1fd['push'](_0x31e1fd['shift']());}};_0xf22b36(++_0x39d852);}(_0xe015,0x13b));var _0x5e01=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0xe015[_0x21a9d9];return _0x46adce;};'use strict';var multer=require(_0x5e01('0x0'));var util=require(_0x5e01('0x1'));var path=require(_0x5e01('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x5e01('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x5e01('0x4'));var interaction=require(_0x5e01('0x5'));var config=require(_0x5e01('0x6'));var controller=require(_0x5e01('0x7'));router['get']('/',auth[_0x5e01('0x8')](),controller[_0x5e01('0x9')]);router['get']('/describe',auth[_0x5e01('0x8')](),controller[_0x5e01('0xa')]);router[_0x5e01('0xb')](_0x5e01('0xc'),auth[_0x5e01('0x8')](),controller[_0x5e01('0xd')]);router['post']('/',auth[_0x5e01('0x8')](),controller['create']);router[_0x5e01('0xe')]('/:id',auth[_0x5e01('0x8')](),controller[_0x5e01('0xf')]);router['delete'](_0x5e01('0xc'),auth[_0x5e01('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.attributes.js b/server/api/voiceCallReport/voiceCallReport.attributes.js index dd27167..0d88999 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 _0xa6f9=['DATE','INTEGER','exports','STRING','ENUM','internal','dialer','TEXT'];(function(_0x7e35f4,_0x51d1d2){var _0x1fe7c8=function(_0x3bd6e5){while(--_0x3bd6e5){_0x7e35f4['push'](_0x7e35f4['shift']());}};_0x1fe7c8(++_0x51d1d2);}(_0xa6f9,0x11a));var _0x9a6f=function(_0x216200,_0x4575e6){_0x216200=_0x216200-0x0;var _0x57002d=_0xa6f9[_0x216200];return _0x57002d;};'use strict';var Sequelize=require('sequelize');module[_0x9a6f('0x0')]={'uniqueid':{'type':Sequelize[_0x9a6f('0x1')]},'type':{'type':Sequelize[_0x9a6f('0x2')]('inbound',_0x9a6f('0x3'),'outbound','inbound-fax','outbound-fax',_0x9a6f('0x4'))},'tag':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize['STRING']},'source':{'type':Sequelize[_0x9a6f('0x1')]},'destination':{'type':Sequelize[_0x9a6f('0x1')]},'destinationcontext':{'type':Sequelize[_0x9a6f('0x1')]},'callerid':{'type':Sequelize[_0x9a6f('0x1')]},'channel':{'type':Sequelize[_0x9a6f('0x1')]},'destinationchannel':{'type':Sequelize[_0x9a6f('0x1')]},'lastapplication':{'type':Sequelize[_0x9a6f('0x1')]},'lastdata':{'type':Sequelize[_0x9a6f('0x5')]},'starttime':{'type':Sequelize['DATE']},'systemanswertime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0x9a6f('0x6')]},'endtime':{'type':Sequelize[_0x9a6f('0x6')]},'duration':{'type':Sequelize[_0x9a6f('0x7')]},'billableseconds':{'type':Sequelize['INTEGER']},'mohtime':{'type':Sequelize[_0x9a6f('0x7')],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x9a6f('0x1')]},'amaflags':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize[_0x9a6f('0x1')]},'userDisposition':{'type':Sequelize[_0x9a6f('0x1')]},'userSecondDisposition':{'type':Sequelize['STRING']},'userThirdDisposition':{'type':Sequelize[_0x9a6f('0x1')]},'note':{'type':Sequelize[_0x9a6f('0x1')]},'prefix':{'type':Sequelize[_0x9a6f('0x1')]},'routeid':{'type':Sequelize[_0x9a6f('0x7')]},'sipcallid':{'type':Sequelize[_0x9a6f('0x1')]}}; \ No newline at end of file +var _0x9aea=['STRING','internal','outbound-fax','dialer','DATE','INTEGER','sequelize','exports'];(function(_0x83d08e,_0x228942){var _0x404d4f=function(_0x161ce){while(--_0x161ce){_0x83d08e['push'](_0x83d08e['shift']());}};_0x404d4f(++_0x228942);}(_0x9aea,0x196));var _0xa9ae=function(_0x15e500,_0x1c91e2){_0x15e500=_0x15e500-0x0;var _0x35a112=_0x9aea[_0x15e500];return _0x35a112;};'use strict';var Sequelize=require(_0xa9ae('0x0'));module[_0xa9ae('0x1')]={'uniqueid':{'type':Sequelize[_0xa9ae('0x2')]},'type':{'type':Sequelize['ENUM']('inbound',_0xa9ae('0x3'),'outbound','inbound-fax',_0xa9ae('0x4'),_0xa9ae('0x5'))},'tag':{'type':Sequelize[_0xa9ae('0x2')]},'accountcode':{'type':Sequelize['STRING']},'source':{'type':Sequelize[_0xa9ae('0x2')]},'destination':{'type':Sequelize[_0xa9ae('0x2')]},'destinationcontext':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0xa9ae('0x2')]},'channel':{'type':Sequelize[_0xa9ae('0x2')]},'destinationchannel':{'type':Sequelize['STRING']},'lastapplication':{'type':Sequelize[_0xa9ae('0x2')]},'lastdata':{'type':Sequelize['TEXT']},'starttime':{'type':Sequelize[_0xa9ae('0x6')]},'systemanswertime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0xa9ae('0x6')]},'endtime':{'type':Sequelize[_0xa9ae('0x6')]},'duration':{'type':Sequelize[_0xa9ae('0x7')]},'billableseconds':{'type':Sequelize[_0xa9ae('0x7')]},'mohtime':{'type':Sequelize[_0xa9ae('0x7')],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xa9ae('0x2')]},'amaflags':{'type':Sequelize[_0xa9ae('0x2')]},'userfield':{'type':Sequelize[_0xa9ae('0x2')]},'userDisposition':{'type':Sequelize[_0xa9ae('0x2')]},'userSecondDisposition':{'type':Sequelize[_0xa9ae('0x2')]},'userThirdDisposition':{'type':Sequelize[_0xa9ae('0x2')]},'note':{'type':Sequelize[_0xa9ae('0x2')]},'prefix':{'type':Sequelize[_0xa9ae('0x2')]},'routeid':{'type':Sequelize[_0xa9ae('0x7')]},'sipcallid':{'type':Sequelize[_0xa9ae('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.controller.js b/server/api/voiceCallReport/voiceCallReport.controller.js index de1da25..4e7ad24 100644 --- a/server/api/voiceCallReport/voiceCallReport.controller.js +++ b/server/api/voiceCallReport/voiceCallReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f66=['../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','apply','reject','save','destroy','then','error','name','send','index','map','VoiceCallReport','rawAttributes','fieldName','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filter','merge','type','VIRTUAL','includeAll','include','fullname','alias','User','rows','catch','show','params','find','create','body','describe','uniqueid','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x5f66,0x1a0));var _0x65f6=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x5f66[_0x4cf98e];return _0x1623ac;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x65f6('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x65f6('0x1'));var rp=require(_0x65f6('0x2'));var moment=require(_0x65f6('0x3'));var BPromise=require(_0x65f6('0x4'));var Mustache=require(_0x65f6('0x5'));var util=require('util');var path=require(_0x65f6('0x6'));var sox=require('sox');var csv=require(_0x65f6('0x7'));var ejs=require(_0x65f6('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x65f6('0x9'));var crypto=require(_0x65f6('0xa'));var jsforce=require(_0x65f6('0xb'));var deskjs=require(_0x65f6('0xc'));var toCsv=require(_0x65f6('0x7'));var querystring=require(_0x65f6('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x65f6('0xe'));var qs=require(_0x65f6('0xf'));var as=require(_0x65f6('0x10'));var hardwareService=require(_0x65f6('0x11'));var logger=require('../../config/logger')(_0x65f6('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x65f6('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x419819,_0x4862a5){_0x4862a5=_0x4862a5||0xcc;return function(_0x2f964a){if(_0x2f964a){return _0x419819[_0x65f6('0x14')](_0x4862a5);}return _0x419819[_0x65f6('0x15')](_0x4862a5)[_0x65f6('0x16')]();};}function respondWithResult(_0x369f96,_0x1d29fd){_0x1d29fd=_0x1d29fd||0xc8;return function(_0x44144b){if(_0x44144b){return _0x369f96[_0x65f6('0x15')](_0x1d29fd)[_0x65f6('0x17')](_0x44144b);}};}function respondWithFilteredResult(_0x3440af,_0x59154e){return function(_0x19b9ff){if(_0x19b9ff){var _0x49a913=typeof _0x59154e['offset']===_0x65f6('0x18')&&typeof _0x59154e[_0x65f6('0x19')]===_0x65f6('0x18');var _0x1c955c=_0x19b9ff[_0x65f6('0x1a')];var _0x1f974c=_0x49a913?0x0:_0x59154e[_0x65f6('0x1b')];var _0x18380e=_0x49a913?_0x19b9ff['count']:_0x59154e['offset']+_0x59154e[_0x65f6('0x19')];var _0x5b4055;if(_0x18380e>=_0x1c955c){_0x18380e=_0x1c955c;_0x5b4055=0xc8;}else{_0x5b4055=0xce;}_0x3440af['status'](_0x5b4055);return _0x3440af['set'](_0x65f6('0x1c'),_0x1f974c+'-'+_0x18380e+'/'+_0x1c955c)[_0x65f6('0x17')](_0x19b9ff);}return null;};}function patchUpdates(_0x5114a4){return function(_0x39e19f){try{jsonpatch[_0x65f6('0x1d')](_0x39e19f,_0x5114a4,!![]);}catch(_0xbee6a4){return BPromise[_0x65f6('0x1e')](_0xbee6a4);}return _0x39e19f[_0x65f6('0x1f')]();};}function saveUpdates(_0xc139c2,_0x581374){return function(_0x197a49){if(_0x197a49){return _0x197a49['update'](_0xc139c2)['then'](function(_0x212247){return _0x212247;});}return null;};}function removeEntity(_0xd173f4,_0x524e42){return function(_0x1eeaaa){if(_0x1eeaaa){return _0x1eeaaa[_0x65f6('0x20')]()[_0x65f6('0x21')](function(){_0xd173f4[_0x65f6('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x9d7bb0,_0x59ea32){return function(_0x20a161){if(!_0x20a161){_0x9d7bb0['sendStatus'](0x194);}return _0x20a161;};}function handleError(_0x5cb131,_0x4fde2f){_0x4fde2f=_0x4fde2f||0x1f4;return function(_0x29abdb){logger[_0x65f6('0x22')](_0x29abdb['stack']);if(_0x29abdb[_0x65f6('0x23')]){delete _0x29abdb[_0x65f6('0x23')];}_0x5cb131['status'](_0x4fde2f)[_0x65f6('0x24')](_0x29abdb);};}exports[_0x65f6('0x25')]=function(_0x28d0df,_0x559330){var _0x4ac04b={},_0x488d36={},_0x266cfe={'count':0x0,'rows':[]};var _0x3c032f=_[_0x65f6('0x26')](db[_0x65f6('0x27')][_0x65f6('0x28')],function(_0x14a387){return{'name':_0x14a387[_0x65f6('0x29')],'type':_0x14a387['type']['key']};});_0x488d36[_0x65f6('0x2a')]=_[_0x65f6('0x26')](_0x3c032f,'name');_0x488d36['query']=_[_0x65f6('0x2b')](_0x28d0df[_0x65f6('0x2c')]);_0x488d36[_0x65f6('0x2d')]=_[_0x65f6('0x2e')](_0x488d36[_0x65f6('0x2a')],_0x488d36[_0x65f6('0x2c')]);_0x4ac04b['attributes']=_[_0x65f6('0x2e')](_0x488d36[_0x65f6('0x2a')],qs[_0x65f6('0x2f')](_0x28d0df['query'][_0x65f6('0x2f')]));_0x4ac04b[_0x65f6('0x30')]=_0x4ac04b[_0x65f6('0x30')][_0x65f6('0x31')]?_0x4ac04b[_0x65f6('0x30')]:_0x488d36[_0x65f6('0x2a')];if(!_0x28d0df['query'][_0x65f6('0x32')](_0x65f6('0x33'))){_0x4ac04b['limit']=qs[_0x65f6('0x19')](_0x28d0df['query'][_0x65f6('0x19')]);_0x4ac04b['offset']=qs[_0x65f6('0x1b')](_0x28d0df[_0x65f6('0x2c')]['offset']);}_0x4ac04b[_0x65f6('0x34')]=qs[_0x65f6('0x35')](_0x28d0df[_0x65f6('0x2c')]['sort']);_0x4ac04b['where']=qs[_0x65f6('0x2d')](_['pick'](_0x28d0df[_0x65f6('0x2c')],_0x488d36['filters']),_0x3c032f);if(_0x28d0df[_0x65f6('0x2c')][_0x65f6('0x36')]){_0x4ac04b['where']=_[_0x65f6('0x37')](_0x4ac04b['where'],{'$or':_['map'](_0x3c032f,function(_0x71b16b){if(_0x71b16b[_0x65f6('0x38')]!==_0x65f6('0x39')){var _0x313be5={};_0x313be5[_0x71b16b[_0x65f6('0x23')]]={'$like':'%'+_0x28d0df[_0x65f6('0x2c')][_0x65f6('0x36')]+'%'};return _0x313be5;}})});}_0x4ac04b=_[_0x65f6('0x37')]({},_0x4ac04b,_0x28d0df['options']);var _0x3aa254={'where':_0x4ac04b['where']};return db[_0x65f6('0x27')][_0x65f6('0x1a')](_0x3aa254)[_0x65f6('0x21')](function(_0x2ea7f7){_0x266cfe['count']=_0x2ea7f7;if(_0x28d0df[_0x65f6('0x2c')][_0x65f6('0x3a')]){_0x4ac04b[_0x65f6('0x3b')]=[{'attributes':['id',_0x65f6('0x23'),_0x65f6('0x3c'),_0x65f6('0x3d')],'model':db[_0x65f6('0x3e')],'as':_0x65f6('0x3e')}];}return db[_0x65f6('0x27')]['findAll'](_0x4ac04b);})[_0x65f6('0x21')](function(_0x400ed2){_0x266cfe[_0x65f6('0x3f')]=_0x400ed2;return _0x266cfe;})[_0x65f6('0x21')](respondWithFilteredResult(_0x559330,_0x4ac04b))[_0x65f6('0x40')](handleError(_0x559330,null));};exports[_0x65f6('0x41')]=function(_0xe0b72d,_0x2e91e8){var _0x461393={'raw':!![],'where':{'id':_0xe0b72d[_0x65f6('0x42')]['id']}},_0x2abbed={};_0x2abbed[_0x65f6('0x2a')]=_[_0x65f6('0x2b')](db[_0x65f6('0x27')][_0x65f6('0x28')]);_0x2abbed[_0x65f6('0x2c')]=_['keys'](_0xe0b72d[_0x65f6('0x2c')]);_0x2abbed[_0x65f6('0x2d')]=_[_0x65f6('0x2e')](_0x2abbed[_0x65f6('0x2a')],_0x2abbed['query']);_0x461393[_0x65f6('0x30')]=_[_0x65f6('0x2e')](_0x2abbed[_0x65f6('0x2a')],qs['fields'](_0xe0b72d[_0x65f6('0x2c')][_0x65f6('0x2f')]));_0x461393[_0x65f6('0x30')]=_0x461393[_0x65f6('0x30')]['length']?_0x461393[_0x65f6('0x30')]:_0x2abbed['model'];if(_0xe0b72d[_0x65f6('0x2c')][_0x65f6('0x3a')]){_0x461393['include']=[{'all':!![]}];}_0x461393=_[_0x65f6('0x37')]({},_0x461393,_0xe0b72d['options']);return db[_0x65f6('0x27')][_0x65f6('0x43')](_0x461393)[_0x65f6('0x21')](handleEntityNotFound(_0x2e91e8,null))[_0x65f6('0x21')](respondWithResult(_0x2e91e8,null))[_0x65f6('0x40')](handleError(_0x2e91e8,null));};exports[_0x65f6('0x44')]=function(_0x4d30c5,_0x51bf6c){return db[_0x65f6('0x27')][_0x65f6('0x44')](_0x4d30c5[_0x65f6('0x45')],{})[_0x65f6('0x21')](respondWithResult(_0x51bf6c,0xc9))[_0x65f6('0x40')](handleError(_0x51bf6c,null));};exports[_0x65f6('0x20')]=function(_0x149c28,_0x41690c){return db[_0x65f6('0x27')]['find']({'where':{'id':_0x149c28[_0x65f6('0x42')]['id']}})[_0x65f6('0x21')](handleEntityNotFound(_0x41690c,null))[_0x65f6('0x21')](removeEntity(_0x41690c,null))['catch'](handleError(_0x41690c,null));};exports[_0x65f6('0x46')]=function(_0x42d453,_0x49ba5a){return db[_0x65f6('0x27')][_0x65f6('0x46')]()['then'](respondWithResult(_0x49ba5a,null))[_0x65f6('0x40')](handleError(_0x49ba5a,null));};exports['update']=function(_0x247be3,_0x3b241f){if(_0x247be3[_0x65f6('0x45')]['uniqueid']){delete _0x247be3[_0x65f6('0x45')][_0x65f6('0x47')];}return db['VoiceCallReport'][_0x65f6('0x43')]({'where':{'uniqueid':_0x247be3[_0x65f6('0x42')]['id'],'UserId':{'$or':[null,_0x247be3['user']['id']]}}})[_0x65f6('0x21')](handleEntityNotFound(_0x3b241f,null))[_0x65f6('0x21')](saveUpdates(_0x247be3[_0x65f6('0x45')],null))[_0x65f6('0x21')](respondWithResult(_0x3b241f,null))[_0x65f6('0x40')](handleError(_0x3b241f,null));}; \ No newline at end of file +var _0x0b0e=['bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','undefined','offset','limit','set','json','apply','reject','save','then','destroy','error','stack','name','index','map','VoiceCallReport','rawAttributes','fieldName','type','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','filter','merge','where','VIRTUAL','options','count','includeAll','fullname','alias','User','findAll','rows','params','find','create','body','catch','describe','update','uniqueid','user','eml-format','zip-dir','request-promise','moment'];(function(_0x71449c,_0x3961db){var _0xfe8116=function(_0xc8b977){while(--_0xc8b977){_0x71449c['push'](_0x71449c['shift']());}};_0xfe8116(++_0x3961db);}(_0x0b0e,0x187));var _0xe0b0=function(_0x4d093a,_0x15d59c){_0x4d093a=_0x4d093a-0x0;var _0x5d7227=_0x0b0e[_0x4d093a];return _0x5d7227;};'use strict';var emlformat=require(_0xe0b0('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe0b0('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe0b0('0x2'));var moment=require(_0xe0b0('0x3'));var BPromise=require(_0xe0b0('0x4'));var Mustache=require(_0xe0b0('0x5'));var util=require(_0xe0b0('0x6'));var path=require(_0xe0b0('0x7'));var sox=require(_0xe0b0('0x8'));var csv=require(_0xe0b0('0x9'));var ejs=require(_0xe0b0('0xa'));var fs=require('fs');var fs_extra=require(_0xe0b0('0xb'));var _=require(_0xe0b0('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xe0b0('0xd'));var deskjs=require(_0xe0b0('0xe'));var toCsv=require(_0xe0b0('0x9'));var querystring=require(_0xe0b0('0xf'));var Papa=require('papaparse');var Redis=require(_0xe0b0('0x10'));var authService=require(_0xe0b0('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xe0b0('0x12'));var hardwareService=require(_0xe0b0('0x13'));var logger=require('../../config/logger')(_0xe0b0('0x14'));var utils=require(_0xe0b0('0x15'));var config=require(_0xe0b0('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xe0b0('0x17'))['db'];function respondWithStatusCode(_0x1c358a,_0x3cc19a){_0x3cc19a=_0x3cc19a||0xcc;return function(_0x45f914){if(_0x45f914){return _0x1c358a[_0xe0b0('0x18')](_0x3cc19a);}return _0x1c358a['status'](_0x3cc19a)[_0xe0b0('0x19')]();};}function respondWithResult(_0x154de6,_0x743318){_0x743318=_0x743318||0xc8;return function(_0x24babd){if(_0x24babd){return _0x154de6[_0xe0b0('0x1a')](_0x743318)['json'](_0x24babd);}};}function respondWithFilteredResult(_0x41a7e2,_0x5adb01){return function(_0x35cb40){if(_0x35cb40){var _0xadee6e=typeof _0x5adb01['offset']===_0xe0b0('0x1b')&&typeof _0x5adb01['limit']===_0xe0b0('0x1b');var _0x100204=_0x35cb40['count'];var _0x54a3eb=_0xadee6e?0x0:_0x5adb01[_0xe0b0('0x1c')];var _0x50a441=_0xadee6e?_0x35cb40['count']:_0x5adb01['offset']+_0x5adb01[_0xe0b0('0x1d')];var _0x50fa4a;if(_0x50a441>=_0x100204){_0x50a441=_0x100204;_0x50fa4a=0xc8;}else{_0x50fa4a=0xce;}_0x41a7e2['status'](_0x50fa4a);return _0x41a7e2[_0xe0b0('0x1e')]('Content-Range',_0x54a3eb+'-'+_0x50a441+'/'+_0x100204)[_0xe0b0('0x1f')](_0x35cb40);}return null;};}function patchUpdates(_0x5dba2f){return function(_0x2c84cc){try{jsonpatch[_0xe0b0('0x20')](_0x2c84cc,_0x5dba2f,!![]);}catch(_0x3e10b3){return BPromise[_0xe0b0('0x21')](_0x3e10b3);}return _0x2c84cc[_0xe0b0('0x22')]();};}function saveUpdates(_0x58b804,_0x4cae54){return function(_0x2fa820){if(_0x2fa820){return _0x2fa820['update'](_0x58b804)[_0xe0b0('0x23')](function(_0x31b5f8){return _0x31b5f8;});}return null;};}function removeEntity(_0x513e63,_0x170ad8){return function(_0x503883){if(_0x503883){return _0x503883[_0xe0b0('0x24')]()['then'](function(){_0x513e63[_0xe0b0('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3e5c88,_0x4de537){return function(_0x4700cc){if(!_0x4700cc){_0x3e5c88['sendStatus'](0x194);}return _0x4700cc;};}function handleError(_0x3c221d,_0x5c5317){_0x5c5317=_0x5c5317||0x1f4;return function(_0x362aba){logger[_0xe0b0('0x25')](_0x362aba[_0xe0b0('0x26')]);if(_0x362aba[_0xe0b0('0x27')]){delete _0x362aba[_0xe0b0('0x27')];}_0x3c221d[_0xe0b0('0x1a')](_0x5c5317)['send'](_0x362aba);};}exports[_0xe0b0('0x28')]=function(_0x1b8aa8,_0x5b7a64){var _0x15e13b={},_0x419b1f={},_0x36d137={'count':0x0,'rows':[]};var _0x1d5759=_[_0xe0b0('0x29')](db[_0xe0b0('0x2a')][_0xe0b0('0x2b')],function(_0x4fb3b7){return{'name':_0x4fb3b7[_0xe0b0('0x2c')],'type':_0x4fb3b7[_0xe0b0('0x2d')]['key']};});_0x419b1f['model']=_[_0xe0b0('0x29')](_0x1d5759,_0xe0b0('0x27'));_0x419b1f[_0xe0b0('0x2e')]=_[_0xe0b0('0x2f')](_0x1b8aa8[_0xe0b0('0x2e')]);_0x419b1f['filters']=_[_0xe0b0('0x30')](_0x419b1f[_0xe0b0('0x31')],_0x419b1f[_0xe0b0('0x2e')]);_0x15e13b[_0xe0b0('0x32')]=_[_0xe0b0('0x30')](_0x419b1f['model'],qs[_0xe0b0('0x33')](_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x33')]));_0x15e13b[_0xe0b0('0x32')]=_0x15e13b[_0xe0b0('0x32')][_0xe0b0('0x34')]?_0x15e13b[_0xe0b0('0x32')]:_0x419b1f[_0xe0b0('0x31')];if(!_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x35')](_0xe0b0('0x36'))){_0x15e13b[_0xe0b0('0x1d')]=qs[_0xe0b0('0x1d')](_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x1d')]);_0x15e13b['offset']=qs[_0xe0b0('0x1c')](_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x1c')]);}_0x15e13b[_0xe0b0('0x37')]=qs[_0xe0b0('0x38')](_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x38')]);_0x15e13b['where']=qs['filters'](_['pick'](_0x1b8aa8['query'],_0x419b1f[_0xe0b0('0x39')]),_0x1d5759);if(_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x3a')]){_0x15e13b['where']=_[_0xe0b0('0x3b')](_0x15e13b[_0xe0b0('0x3c')],{'$or':_[_0xe0b0('0x29')](_0x1d5759,function(_0x297c64){if(_0x297c64['type']!==_0xe0b0('0x3d')){var _0xfbb61d={};_0xfbb61d[_0x297c64[_0xe0b0('0x27')]]={'$like':'%'+_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x3a')]+'%'};return _0xfbb61d;}})});}_0x15e13b=_[_0xe0b0('0x3b')]({},_0x15e13b,_0x1b8aa8[_0xe0b0('0x3e')]);var _0x115a69={'where':_0x15e13b[_0xe0b0('0x3c')]};return db['VoiceCallReport'][_0xe0b0('0x3f')](_0x115a69)['then'](function(_0x34178d){_0x36d137[_0xe0b0('0x3f')]=_0x34178d;if(_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x40')]){_0x15e13b['include']=[{'attributes':['id',_0xe0b0('0x27'),_0xe0b0('0x41'),_0xe0b0('0x42')],'model':db[_0xe0b0('0x43')],'as':_0xe0b0('0x43')}];}return db[_0xe0b0('0x2a')][_0xe0b0('0x44')](_0x15e13b);})[_0xe0b0('0x23')](function(_0x52ffe4){_0x36d137[_0xe0b0('0x45')]=_0x52ffe4;return _0x36d137;})[_0xe0b0('0x23')](respondWithFilteredResult(_0x5b7a64,_0x15e13b))['catch'](handleError(_0x5b7a64,null));};exports['show']=function(_0x327fb4,_0x247f8d){var _0x56e7df={'raw':!![],'where':{'id':_0x327fb4[_0xe0b0('0x46')]['id']}},_0x18a59d={};_0x18a59d[_0xe0b0('0x31')]=_[_0xe0b0('0x2f')](db[_0xe0b0('0x2a')]['rawAttributes']);_0x18a59d['query']=_['keys'](_0x327fb4[_0xe0b0('0x2e')]);_0x18a59d[_0xe0b0('0x39')]=_['intersection'](_0x18a59d[_0xe0b0('0x31')],_0x18a59d[_0xe0b0('0x2e')]);_0x56e7df[_0xe0b0('0x32')]=_[_0xe0b0('0x30')](_0x18a59d[_0xe0b0('0x31')],qs['fields'](_0x327fb4['query'][_0xe0b0('0x33')]));_0x56e7df[_0xe0b0('0x32')]=_0x56e7df[_0xe0b0('0x32')][_0xe0b0('0x34')]?_0x56e7df[_0xe0b0('0x32')]:_0x18a59d['model'];if(_0x327fb4[_0xe0b0('0x2e')][_0xe0b0('0x40')]){_0x56e7df['include']=[{'all':!![]}];}_0x56e7df=_['merge']({},_0x56e7df,_0x327fb4['options']);return db[_0xe0b0('0x2a')][_0xe0b0('0x47')](_0x56e7df)[_0xe0b0('0x23')](handleEntityNotFound(_0x247f8d,null))[_0xe0b0('0x23')](respondWithResult(_0x247f8d,null))['catch'](handleError(_0x247f8d,null));};exports[_0xe0b0('0x48')]=function(_0x87d8f3,_0x483f12){return db['VoiceCallReport'][_0xe0b0('0x48')](_0x87d8f3[_0xe0b0('0x49')],{})['then'](respondWithResult(_0x483f12,0xc9))[_0xe0b0('0x4a')](handleError(_0x483f12,null));};exports[_0xe0b0('0x24')]=function(_0x504284,_0x5cb2b6){return db[_0xe0b0('0x2a')]['find']({'where':{'id':_0x504284[_0xe0b0('0x46')]['id']}})[_0xe0b0('0x23')](handleEntityNotFound(_0x5cb2b6,null))[_0xe0b0('0x23')](removeEntity(_0x5cb2b6,null))[_0xe0b0('0x4a')](handleError(_0x5cb2b6,null));};exports[_0xe0b0('0x4b')]=function(_0xf9e694,_0x5f5486){return db['VoiceCallReport'][_0xe0b0('0x4b')]()['then'](respondWithResult(_0x5f5486,null))['catch'](handleError(_0x5f5486,null));};exports[_0xe0b0('0x4c')]=function(_0x222174,_0x54cf7b){if(_0x222174['body'][_0xe0b0('0x4d')]){delete _0x222174[_0xe0b0('0x49')][_0xe0b0('0x4d')];}return db[_0xe0b0('0x2a')][_0xe0b0('0x47')]({'where':{'uniqueid':_0x222174[_0xe0b0('0x46')]['id'],'UserId':{'$or':[null,_0x222174[_0xe0b0('0x4e')]['id']]}}})['then'](handleEntityNotFound(_0x54cf7b,null))[_0xe0b0('0x23')](saveUpdates(_0x222174['body'],null))[_0xe0b0('0x23')](respondWithResult(_0x54cf7b,null))['catch'](handleError(_0x54cf7b,null));}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.model.js b/server/api/voiceCallReport/voiceCallReport.model.js index 514771c..8548c04 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 _0xe0d6=['define','VoiceCallReport','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x138240,_0x4becbf){var _0x5f4388=function(_0x32d18e){while(--_0x32d18e){_0x138240['push'](_0x138240['shift']());}};_0x5f4388(++_0x4becbf);}(_0xe0d6,0x18f));var _0x6e0d=function(_0x5a87cf,_0x4aee0c){_0x5a87cf=_0x5a87cf-0x0;var _0x593645=_0xe0d6[_0x5a87cf];return _0x593645;};'use strict';var _=require(_0x6e0d('0x0'));var util=require(_0x6e0d('0x1'));var logger=require(_0x6e0d('0x2'))(_0x6e0d('0x3'));var moment=require(_0x6e0d('0x4'));var BPromise=require(_0x6e0d('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6e0d('0x6'));var rimraf=require(_0x6e0d('0x7'));var config=require(_0x6e0d('0x8'));var attributes=require('./voiceCallReport.attributes');module['exports']=function(_0x29cb7c,_0x8eb52b){return _0x29cb7c[_0x6e0d('0x9')](_0x6e0d('0xa'),attributes,{'tableName':'report_call','paranoid':![],'indexes':[{'fields':[_0x6e0d('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xcffe=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','define','VoiceCallReport','report_call','uniqueid','lodash','util','../../config/logger'];(function(_0x5b0bfe,_0x17e1b0){var _0x1a5815=function(_0x4b8b59){while(--_0x4b8b59){_0x5b0bfe['push'](_0x5b0bfe['shift']());}};_0x1a5815(++_0x17e1b0);}(_0xcffe,0x1a1));var _0xecff=function(_0x2135a8,_0x2d5706){_0x2135a8=_0x2135a8-0x0;var _0x3dd593=_0xcffe[_0x2135a8];return _0x3dd593;};'use strict';var _=require(_0xecff('0x0'));var util=require(_0xecff('0x1'));var logger=require(_0xecff('0x2'))(_0xecff('0x3'));var moment=require(_0xecff('0x4'));var BPromise=require(_0xecff('0x5'));var rp=require(_0xecff('0x6'));var fs=require('fs');var path=require(_0xecff('0x7'));var rimraf=require(_0xecff('0x8'));var config=require(_0xecff('0x9'));var attributes=require('./voiceCallReport.attributes');module['exports']=function(_0x3020d9,_0x25572c){return _0x3020d9[_0xecff('0xa')](_0xecff('0xb'),attributes,{'tableName':_0xecff('0xc'),'paranoid':![],'indexes':[{'fields':[_0xecff('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.rpc.js b/server/api/voiceCallReport/voiceCallReport.rpc.js index 5453037..998f07e 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 _0x459d=['client','http','request','then','request\x20sent','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceCallReport,\x20%s,\x20%s','message','info','result','GetVoiceCallReport','findAll','options','raw','where','limit','include','attributes','model','map','VoiceCallReport','create','body','CreateVoiceCallReport','catch','UpdateVoiceCallReport','update','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment'];(function(_0x4279fe,_0x1b41c7){var _0xdc6438=function(_0x4299c5){while(--_0x4299c5){_0x4279fe['push'](_0x4279fe['shift']());}};_0xdc6438(++_0x1b41c7);}(_0x459d,0x157));var _0xd459=function(_0x4c072f,_0x268523){_0x4c072f=_0x4c072f-0x0;var _0x187628=_0x459d[_0x4c072f];return _0x187628;};'use strict';var _=require(_0xd459('0x0'));var util=require(_0xd459('0x1'));var moment=require('moment');var BPromise=require(_0xd459('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd459('0x3'));var db=require(_0xd459('0x4'))['db'];var utils=require(_0xd459('0x5'));var logger=require(_0xd459('0x6'))('rpc');var config=require(_0xd459('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xd459('0x8')][_0xd459('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x438bd0,_0x4d861b,_0x3e188d){return new BPromise(function(_0x571535,_0x5a7a3c){return client[_0xd459('0xa')](_0x438bd0,_0x3e188d)[_0xd459('0xb')](function(_0x19b642){logger['info']('VoiceCallReport,\x20%s,\x20%s',_0x4d861b,_0xd459('0xc'));logger[_0xd459('0xd')](_0xd459('0xe'),_0x4d861b,_0xd459('0xc'),JSON[_0xd459('0xf')](_0x19b642));if(_0x19b642[_0xd459('0x10')]){if(_0x19b642[_0xd459('0x10')][_0xd459('0x11')]===0x1f4){logger[_0xd459('0x10')](_0xd459('0x12'),_0x4d861b,_0x19b642[_0xd459('0x10')]['message']);return _0x5a7a3c(_0x19b642[_0xd459('0x10')][_0xd459('0x13')]);}logger[_0xd459('0x10')]('VoiceCallReport,\x20%s,\x20%s',_0x4d861b,_0x19b642[_0xd459('0x10')][_0xd459('0x13')]);return _0x571535(_0x19b642[_0xd459('0x10')][_0xd459('0x13')]);}else{logger[_0xd459('0x14')](_0xd459('0x12'),_0x4d861b,'request\x20sent');_0x571535(_0x19b642[_0xd459('0x15')][_0xd459('0x13')]);}})['catch'](function(_0x53b477){logger[_0xd459('0x10')](_0xd459('0x12'),_0x4d861b,_0x53b477);_0x5a7a3c(_0x53b477);});});}exports[_0xd459('0x16')]=function(_0x13df04){var _0x409640=this;return new Promise(function(_0x1a7a0a,_0x103e12){return db['VoiceCallReport'][_0xd459('0x17')]({'raw':_0x13df04['options']?_0x13df04[_0xd459('0x18')][_0xd459('0x19')]===undefined?!![]:![]:!![],'where':_0x13df04[_0xd459('0x18')]?_0x13df04[_0xd459('0x18')][_0xd459('0x1a')]||null:null,'attributes':_0x13df04[_0xd459('0x18')]?_0x13df04[_0xd459('0x18')]['attributes']||null:null,'limit':_0x13df04[_0xd459('0x18')]?_0x13df04['options'][_0xd459('0x1b')]||null:null,'include':_0x13df04[_0xd459('0x18')]?_0x13df04[_0xd459('0x18')]['include']?_['map'](_0x13df04[_0xd459('0x18')][_0xd459('0x1c')],function(_0x13a056){return{'model':db[_0x13a056['model']],'as':_0x13a056['as'],'attributes':_0x13a056[_0xd459('0x1d')],'include':_0x13a056['include']?_['map'](_0x13a056[_0xd459('0x1c')],function(_0x4cfa6a){return{'model':db[_0x4cfa6a[_0xd459('0x1e')]],'as':_0x4cfa6a['as'],'attributes':_0x4cfa6a[_0xd459('0x1d')],'include':_0x4cfa6a[_0xd459('0x1c')]?_[_0xd459('0x1f')](_0x4cfa6a[_0xd459('0x1c')],function(_0x464b45){return{'model':db[_0x464b45[_0xd459('0x1e')]],'as':_0x464b45['as'],'attributes':_0x464b45[_0xd459('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xd459('0xb')](function(_0x4d89ae){logger['info']('GetVoiceCallReport',_0x13df04);logger[_0xd459('0xd')]('GetVoiceCallReport',_0x13df04,JSON[_0xd459('0xf')](_0x4d89ae));_0x1a7a0a(_0x4d89ae);})['catch'](function(_0x5e92c5){logger[_0xd459('0x10')](_0xd459('0x16'),_0x5e92c5[_0xd459('0x13')],_0x13df04);_0x103e12(_0x409640[_0xd459('0x10')](0x1f4,_0x5e92c5[_0xd459('0x13')]));});});};exports['CreateVoiceCallReport']=function(_0x567715){var _0x34a88b=this;return new Promise(function(_0x2f6ece,_0x177e79){return db[_0xd459('0x20')][_0xd459('0x21')](_0x567715[_0xd459('0x22')],{'raw':_0x567715[_0xd459('0x18')]?_0x567715[_0xd459('0x18')][_0xd459('0x19')]===undefined?!![]:![]:!![]})[_0xd459('0xb')](function(_0x2b8ad0){logger[_0xd459('0x14')](_0xd459('0x23'),_0x567715);logger[_0xd459('0xd')](_0xd459('0x23'),_0x567715,JSON[_0xd459('0xf')](_0x2b8ad0));_0x2f6ece(_0x2b8ad0);})[_0xd459('0x24')](function(_0x1a1d0e){logger[_0xd459('0x10')](_0xd459('0x23'),_0x1a1d0e[_0xd459('0x13')],_0x567715);_0x177e79(_0x34a88b[_0xd459('0x10')](0x1f4,_0x1a1d0e[_0xd459('0x13')]));});});};exports[_0xd459('0x25')]=function(_0x5ad861){var _0x3f533a=this;return new Promise(function(_0xb6fff3,_0x390615){return db[_0xd459('0x20')][_0xd459('0x26')](_0x5ad861[_0xd459('0x22')],{'raw':_0x5ad861[_0xd459('0x18')]?_0x5ad861[_0xd459('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5ad861[_0xd459('0x18')]?_0x5ad861[_0xd459('0x18')][_0xd459('0x1a')]||null:null,'attributes':_0x5ad861[_0xd459('0x18')]?_0x5ad861[_0xd459('0x18')][_0xd459('0x1d')]||null:null,'limit':_0x5ad861[_0xd459('0x18')]?_0x5ad861[_0xd459('0x18')][_0xd459('0x1b')]||null:null})[_0xd459('0xb')](function(_0x5dc957){logger[_0xd459('0x14')](_0xd459('0x25'),_0x5ad861);logger[_0xd459('0xd')](_0xd459('0x25'),_0x5ad861,JSON[_0xd459('0xf')](_0x5dc957));_0xb6fff3(_0x5dc957);})[_0xd459('0x24')](function(_0x3376a9){logger['error'](_0xd459('0x25'),_0x3376a9['message'],_0x5ad861);_0x390615(_0x3f533a[_0xd459('0x10')](0x1f4,_0x3376a9['message']));});});}; \ No newline at end of file +var _0xce19=['update','raw','where','UpdateVoiceCallReport','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceCallReport,\x20%s,\x20%s','message','request\x20sent','result','GetVoiceCallReport','findAll','options','attributes','limit','include','map','model','catch','CreateVoiceCallReport','VoiceCallReport','create','body'];(function(_0x4acf2a,_0x59368e){var _0x4d1af3=function(_0x4360a9){while(--_0x4360a9){_0x4acf2a['push'](_0x4acf2a['shift']());}};_0x4d1af3(++_0x59368e);}(_0xce19,0x73));var _0x9ce1=function(_0x235b1e,_0x55754a){_0x235b1e=_0x235b1e-0x0;var _0x46553d=_0xce19[_0x235b1e];return _0x46553d;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x9ce1('0x0'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9ce1('0x1'));var db=require(_0x9ce1('0x2'))['db'];var utils=require(_0x9ce1('0x3'));var logger=require(_0x9ce1('0x4'))('rpc');var config=require(_0x9ce1('0x5'));var jayson=require(_0x9ce1('0x6'));var client=jayson[_0x9ce1('0x7')][_0x9ce1('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x40c5ab,_0x3f02e7,_0x2f4d37){return new BPromise(function(_0x48d39d,_0x537a35){return client['request'](_0x40c5ab,_0x2f4d37)[_0x9ce1('0x9')](function(_0x492d37){logger[_0x9ce1('0xa')]('VoiceCallReport,\x20%s,\x20%s',_0x3f02e7,'request\x20sent');logger[_0x9ce1('0xb')](_0x9ce1('0xc'),_0x3f02e7,'request\x20sent',JSON[_0x9ce1('0xd')](_0x492d37));if(_0x492d37[_0x9ce1('0xe')]){if(_0x492d37[_0x9ce1('0xe')][_0x9ce1('0xf')]===0x1f4){logger[_0x9ce1('0xe')](_0x9ce1('0x10'),_0x3f02e7,_0x492d37['error'][_0x9ce1('0x11')]);return _0x537a35(_0x492d37[_0x9ce1('0xe')][_0x9ce1('0x11')]);}logger[_0x9ce1('0xe')](_0x9ce1('0x10'),_0x3f02e7,_0x492d37[_0x9ce1('0xe')][_0x9ce1('0x11')]);return _0x48d39d(_0x492d37[_0x9ce1('0xe')][_0x9ce1('0x11')]);}else{logger[_0x9ce1('0xa')](_0x9ce1('0x10'),_0x3f02e7,_0x9ce1('0x12'));_0x48d39d(_0x492d37[_0x9ce1('0x13')][_0x9ce1('0x11')]);}})['catch'](function(_0x3a1a76){logger[_0x9ce1('0xe')](_0x9ce1('0x10'),_0x3f02e7,_0x3a1a76);_0x537a35(_0x3a1a76);});});}exports[_0x9ce1('0x14')]=function(_0x166507){var _0x50cf85=this;return new Promise(function(_0x249fa4,_0x5ce6e5){return db['VoiceCallReport'][_0x9ce1('0x15')]({'raw':_0x166507[_0x9ce1('0x16')]?_0x166507['options']['raw']===undefined?!![]:![]:!![],'where':_0x166507['options']?_0x166507[_0x9ce1('0x16')]['where']||null:null,'attributes':_0x166507[_0x9ce1('0x16')]?_0x166507[_0x9ce1('0x16')][_0x9ce1('0x17')]||null:null,'limit':_0x166507[_0x9ce1('0x16')]?_0x166507['options'][_0x9ce1('0x18')]||null:null,'include':_0x166507[_0x9ce1('0x16')]?_0x166507[_0x9ce1('0x16')][_0x9ce1('0x19')]?_[_0x9ce1('0x1a')](_0x166507[_0x9ce1('0x16')][_0x9ce1('0x19')],function(_0x273fa0){return{'model':db[_0x273fa0['model']],'as':_0x273fa0['as'],'attributes':_0x273fa0['attributes'],'include':_0x273fa0[_0x9ce1('0x19')]?_[_0x9ce1('0x1a')](_0x273fa0[_0x9ce1('0x19')],function(_0x108f6e){return{'model':db[_0x108f6e[_0x9ce1('0x1b')]],'as':_0x108f6e['as'],'attributes':_0x108f6e['attributes'],'include':_0x108f6e[_0x9ce1('0x19')]?_[_0x9ce1('0x1a')](_0x108f6e['include'],function(_0x1e5c96){return{'model':db[_0x1e5c96[_0x9ce1('0x1b')]],'as':_0x1e5c96['as'],'attributes':_0x1e5c96[_0x9ce1('0x17')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x213f94){logger[_0x9ce1('0xa')](_0x9ce1('0x14'),_0x166507);logger[_0x9ce1('0xb')](_0x9ce1('0x14'),_0x166507,JSON[_0x9ce1('0xd')](_0x213f94));_0x249fa4(_0x213f94);})[_0x9ce1('0x1c')](function(_0x34fa40){logger[_0x9ce1('0xe')](_0x9ce1('0x14'),_0x34fa40[_0x9ce1('0x11')],_0x166507);_0x5ce6e5(_0x50cf85[_0x9ce1('0xe')](0x1f4,_0x34fa40[_0x9ce1('0x11')]));});});};exports[_0x9ce1('0x1d')]=function(_0x4b6850){var _0xf8e5eb=this;return new Promise(function(_0x32aaa6,_0x38669f){return db[_0x9ce1('0x1e')][_0x9ce1('0x1f')](_0x4b6850[_0x9ce1('0x20')],{'raw':_0x4b6850[_0x9ce1('0x16')]?_0x4b6850[_0x9ce1('0x16')]['raw']===undefined?!![]:![]:!![]})[_0x9ce1('0x9')](function(_0x3b9147){logger[_0x9ce1('0xa')](_0x9ce1('0x1d'),_0x4b6850);logger['debug'](_0x9ce1('0x1d'),_0x4b6850,JSON[_0x9ce1('0xd')](_0x3b9147));_0x32aaa6(_0x3b9147);})[_0x9ce1('0x1c')](function(_0x3abc21){logger[_0x9ce1('0xe')](_0x9ce1('0x1d'),_0x3abc21[_0x9ce1('0x11')],_0x4b6850);_0x38669f(_0xf8e5eb[_0x9ce1('0xe')](0x1f4,_0x3abc21[_0x9ce1('0x11')]));});});};exports['UpdateVoiceCallReport']=function(_0x1099b5){var _0x10f3d7=this;return new Promise(function(_0x33a182,_0x3dd577){return db[_0x9ce1('0x1e')][_0x9ce1('0x21')](_0x1099b5[_0x9ce1('0x20')],{'raw':_0x1099b5[_0x9ce1('0x16')]?_0x1099b5[_0x9ce1('0x16')][_0x9ce1('0x22')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1099b5['options']?_0x1099b5[_0x9ce1('0x16')][_0x9ce1('0x23')]||null:null,'attributes':_0x1099b5[_0x9ce1('0x16')]?_0x1099b5['options'][_0x9ce1('0x17')]||null:null,'limit':_0x1099b5['options']?_0x1099b5[_0x9ce1('0x16')][_0x9ce1('0x18')]||null:null})['then'](function(_0x5e2c41){logger[_0x9ce1('0xa')](_0x9ce1('0x24'),_0x1099b5);logger[_0x9ce1('0xb')](_0x9ce1('0x24'),_0x1099b5,JSON[_0x9ce1('0xd')](_0x5e2c41));_0x33a182(_0x5e2c41);})['catch'](function(_0x5683d6){logger[_0x9ce1('0xe')]('UpdateVoiceCallReport',_0x5683d6[_0x9ce1('0x11')],_0x1099b5);_0x3dd577(_0x10f3d7[_0x9ce1('0xe')](0x1f4,_0x5683d6[_0x9ce1('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index eac8274..38a2fe6 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 _0x1808=['show','update','delete','destroy','exports','multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceChanSpy.controller','get','index','/:id','isAuthenticated'];(function(_0x473463,_0x21da73){var _0x42f406=function(_0x34a5be){while(--_0x34a5be){_0x473463['push'](_0x473463['shift']());}};_0x42f406(++_0x21da73);}(_0x1808,0xe2));var _0x8180=function(_0x518b8f,_0x476de4){_0x518b8f=_0x518b8f-0x0;var _0x51cece=_0x1808[_0x518b8f];return _0x51cece;};'use strict';var multer=require(_0x8180('0x0'));var util=require(_0x8180('0x1'));var path=require('path');var timeout=require(_0x8180('0x2'));var express=require(_0x8180('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x8180('0x4'));var interaction=require(_0x8180('0x5'));var config=require(_0x8180('0x6'));var controller=require(_0x8180('0x7'));router[_0x8180('0x8')]('/',auth['isAuthenticated'](),controller[_0x8180('0x9')]);router[_0x8180('0x8')](_0x8180('0xa'),auth[_0x8180('0xb')](),controller[_0x8180('0xc')]);router['post']('/',auth[_0x8180('0xb')](),controller['create']);router['put'](_0x8180('0xa'),auth[_0x8180('0xb')](),controller[_0x8180('0xd')]);router[_0x8180('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x8180('0xf')]);module[_0x8180('0x10')]=router; \ No newline at end of file +var _0x5685=['../../config/environment','./voiceChanSpy.controller','isAuthenticated','get','/:id','show','create','put','update','delete','destroy','exports','multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x62f2d6,_0xa6c069){var _0xc2f41b=function(_0x4ac9ab){while(--_0x4ac9ab){_0x62f2d6['push'](_0x62f2d6['shift']());}};_0xc2f41b(++_0xa6c069);}(_0x5685,0x13e));var _0x5568=function(_0x2aad77,_0x4338df){_0x2aad77=_0x2aad77-0x0;var _0x4cd514=_0x5685[_0x2aad77];return _0x4cd514;};'use strict';var multer=require(_0x5568('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x5568('0x1'));var express=require(_0x5568('0x2'));var router=express[_0x5568('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x5568('0x4'));var interaction=require(_0x5568('0x5'));var config=require(_0x5568('0x6'));var controller=require(_0x5568('0x7'));router['get']('/',auth[_0x5568('0x8')](),controller['index']);router[_0x5568('0x9')](_0x5568('0xa'),auth[_0x5568('0x8')](),controller[_0x5568('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0x5568('0xc')]);router[_0x5568('0xd')](_0x5568('0xa'),auth[_0x5568('0x8')](),controller[_0x5568('0xe')]);router[_0x5568('0xf')](_0x5568('0xa'),auth['isAuthenticated'](),controller[_0x5568('0x10')]);module[_0x5568('0x11')]=router; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.attributes.js b/server/api/voiceChanSpy/voiceChanSpy.attributes.js index 6bfc609..8910fd8 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 _0x95dc=['options','join','getDataValue','split','sequelize','exports','STRING','name','setDataValue'];(function(_0x87b0ff,_0x314389){var _0x3bc0b2=function(_0x41682b){while(--_0x41682b){_0x87b0ff['push'](_0x87b0ff['shift']());}};_0x3bc0b2(++_0x314389);}(_0x95dc,0x136));var _0xc95d=function(_0x47890e,_0x3e3b2b){_0x47890e=_0x47890e-0x0;var _0x5843f9=_0x95dc[_0x47890e];return _0x5843f9;};'use strict';var Sequelize=require(_0xc95d('0x0'));module[_0xc95d('0x1')]={'name':{'type':Sequelize[_0xc95d('0x2')]},'prefix':{'type':Sequelize['STRING'],'unique':_0xc95d('0x3'),'allowNull':![]},'options':{'type':Sequelize[_0xc95d('0x2')],'set':function(_0x5b7a29){this[_0xc95d('0x4')](_0xc95d('0x5'),_0x5b7a29?_0x5b7a29[_0xc95d('0x6')](''):[]);},'get':function(){return this[_0xc95d('0x7')]('options')?this[_0xc95d('0x7')](_0xc95d('0x5'))[_0xc95d('0x8')](''):[];}},'auth':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'password':{'type':Sequelize['STRING']},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0xc95d('0x2')]},'description':{'type':Sequelize[_0xc95d('0x2')]}}; \ No newline at end of file +var _0x587b=['name','STRING','options','join','getDataValue','split','BOOLEAN'];(function(_0x83bb0c,_0x7c953b){var _0x29f4e4=function(_0x2ed6a2){while(--_0x2ed6a2){_0x83bb0c['push'](_0x83bb0c['shift']());}};_0x29f4e4(++_0x7c953b);}(_0x587b,0xcb));var _0xb587=function(_0x5b169a,_0x1196a9){_0x5b169a=_0x5b169a-0x0;var _0x447ec1=_0x587b[_0x5b169a];return _0x447ec1;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING']},'prefix':{'type':Sequelize['STRING'],'unique':_0xb587('0x0'),'allowNull':![]},'options':{'type':Sequelize[_0xb587('0x1')],'set':function(_0x448e32){this['setDataValue'](_0xb587('0x2'),_0x448e32?_0x448e32[_0xb587('0x3')](''):[]);},'get':function(){return this['getDataValue'](_0xb587('0x2'))?this[_0xb587('0x4')](_0xb587('0x2'))[_0xb587('0x5')](''):[];}},'auth':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'password':{'type':Sequelize['STRING']},'record':{'type':Sequelize[_0xb587('0x6')],'defaultValue':![]},'recordingFormat':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xb587('0x1')]}}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.controller.js b/server/api/voiceChanSpy/voiceChanSpy.controller.js index b9a7e9f..5ac927d 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 _0x9a62=['index','VoiceChanSpy','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','map','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','params','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf','zip-dir','request-promise','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','status','end','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','get','ChanSpies','UserProfileResource','destroy','sendStatus','error','stack','name'];(function(_0x356770,_0x5abe91){var _0xff2a1c=function(_0x1120dc){while(--_0x1120dc){_0x356770['push'](_0x356770['shift']());}};_0xff2a1c(++_0x5abe91);}(_0x9a62,0x1bc));var _0x29a6=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x9a62[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x29a6('0x0'));var zipdir=require(_0x29a6('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x29a6('0x2'));var moment=require(_0x29a6('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x29a6('0x4'));var path=require(_0x29a6('0x5'));var sox=require(_0x29a6('0x6'));var csv=require(_0x29a6('0x7'));var ejs=require(_0x29a6('0x8'));var fs=require('fs');var fs_extra=require(_0x29a6('0x9'));var _=require(_0x29a6('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x29a6('0xb'));var deskjs=require(_0x29a6('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x29a6('0xd'));var Redis=require(_0x29a6('0xe'));var authService=require(_0x29a6('0xf'));var qs=require(_0x29a6('0x10'));var as=require(_0x29a6('0x11'));var hardwareService=require(_0x29a6('0x12'));var logger=require(_0x29a6('0x13'))('api');var utils=require(_0x29a6('0x14'));var config=require(_0x29a6('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4e918f,_0x1d78fa){_0x1d78fa=_0x1d78fa||0xcc;return function(_0x7acc03){if(_0x7acc03){return _0x4e918f['sendStatus'](_0x1d78fa);}return _0x4e918f[_0x29a6('0x16')](_0x1d78fa)[_0x29a6('0x17')]();};}function respondWithResult(_0x535e3a,_0x50c663){_0x50c663=_0x50c663||0xc8;return function(_0x36d6fd){if(_0x36d6fd){return _0x535e3a[_0x29a6('0x16')](_0x50c663)['json'](_0x36d6fd);}};}function respondWithFilteredResult(_0x389255,_0x22378a){return function(_0x307dd9){if(_0x307dd9){var _0x4fef5c=typeof _0x22378a[_0x29a6('0x18')]===_0x29a6('0x19')&&typeof _0x22378a[_0x29a6('0x1a')]===_0x29a6('0x19');var _0x2ccb06=_0x307dd9[_0x29a6('0x1b')];var _0xa3d845=_0x4fef5c?0x0:_0x22378a[_0x29a6('0x18')];var _0x4c8cbc=_0x4fef5c?_0x307dd9[_0x29a6('0x1b')]:_0x22378a['offset']+_0x22378a[_0x29a6('0x1a')];var _0x35bc3b;if(_0x4c8cbc>=_0x2ccb06){_0x4c8cbc=_0x2ccb06;_0x35bc3b=0xc8;}else{_0x35bc3b=0xce;}_0x389255[_0x29a6('0x16')](_0x35bc3b);return _0x389255['set'](_0x29a6('0x1c'),_0xa3d845+'-'+_0x4c8cbc+'/'+_0x2ccb06)['json'](_0x307dd9);}return null;};}function patchUpdates(_0x4da844){return function(_0x5a8d55){try{jsonpatch[_0x29a6('0x1d')](_0x5a8d55,_0x4da844,!![]);}catch(_0x319573){return BPromise[_0x29a6('0x1e')](_0x319573);}return _0x5a8d55[_0x29a6('0x1f')]();};}function saveUpdates(_0x36c103,_0x552bc7){return function(_0x13341e){if(_0x13341e){return _0x13341e[_0x29a6('0x20')](_0x36c103)[_0x29a6('0x21')](function(_0x3ed7de){return _0x3ed7de;});}return null;};}function removeEntity(_0x46fcc7,_0x2dc6c0){return function(_0xedfa4){if(_0xedfa4){return _0xedfa4['destroy']()[_0x29a6('0x21')](function(){var _0xfdd465=_0xedfa4[_0x29a6('0x22')]({'plain':!![]});var _0x2280f7=_0x29a6('0x23');return db[_0x29a6('0x24')][_0x29a6('0x25')]({'where':{'type':_0x2280f7,'resourceId':_0xfdd465['id']}})['then'](function(){return _0xedfa4;});})['then'](function(){_0x46fcc7[_0x29a6('0x16')](0xcc)[_0x29a6('0x17')]();});}};}function handleEntityNotFound(_0x291dff,_0x6f9041){return function(_0x237f3e){if(!_0x237f3e){_0x291dff[_0x29a6('0x26')](0x194);}return _0x237f3e;};}function handleError(_0x596a0b,_0x570517){_0x570517=_0x570517||0x1f4;return function(_0x31c2e4){logger[_0x29a6('0x27')](_0x31c2e4[_0x29a6('0x28')]);if(_0x31c2e4[_0x29a6('0x29')]){delete _0x31c2e4[_0x29a6('0x29')];}_0x596a0b['status'](_0x570517)['send'](_0x31c2e4);};}exports[_0x29a6('0x2a')]=function(_0x1bdf5f,_0x1d5cf2){var _0x4250f4={},_0x3b6394={},_0x3a58e0={'count':0x0,'rows':[]};var _0x4b5019=_['map'](db[_0x29a6('0x2b')][_0x29a6('0x2c')],function(_0x388ff3){return{'name':_0x388ff3[_0x29a6('0x2d')],'type':_0x388ff3[_0x29a6('0x2e')][_0x29a6('0x2f')]};});_0x3b6394[_0x29a6('0x30')]=_['map'](_0x4b5019,_0x29a6('0x29'));_0x3b6394[_0x29a6('0x31')]=_[_0x29a6('0x32')](_0x1bdf5f[_0x29a6('0x31')]);_0x3b6394[_0x29a6('0x33')]=_[_0x29a6('0x34')](_0x3b6394[_0x29a6('0x30')],_0x3b6394[_0x29a6('0x31')]);_0x4250f4[_0x29a6('0x35')]=_['intersection'](_0x3b6394[_0x29a6('0x30')],qs[_0x29a6('0x36')](_0x1bdf5f[_0x29a6('0x31')][_0x29a6('0x36')]));_0x4250f4[_0x29a6('0x35')]=_0x4250f4[_0x29a6('0x35')][_0x29a6('0x37')]?_0x4250f4['attributes']:_0x3b6394['model'];if(!_0x1bdf5f['query'][_0x29a6('0x38')](_0x29a6('0x39'))){_0x4250f4[_0x29a6('0x1a')]=qs[_0x29a6('0x1a')](_0x1bdf5f[_0x29a6('0x31')][_0x29a6('0x1a')]);_0x4250f4['offset']=qs[_0x29a6('0x18')](_0x1bdf5f[_0x29a6('0x31')]['offset']);}_0x4250f4[_0x29a6('0x3a')]=qs[_0x29a6('0x3b')](_0x1bdf5f['query'][_0x29a6('0x3b')]);_0x4250f4[_0x29a6('0x3c')]=qs[_0x29a6('0x33')](_['pick'](_0x1bdf5f[_0x29a6('0x31')],_0x3b6394[_0x29a6('0x33')]),_0x4b5019);if(_0x1bdf5f[_0x29a6('0x31')]['filter']){_0x4250f4['where']=_[_0x29a6('0x3d')](_0x4250f4['where'],{'$or':_[_0x29a6('0x3e')](_0x4b5019,function(_0x82be9f){if(_0x82be9f['type']!==_0x29a6('0x3f')){var _0x417bb5={};_0x417bb5[_0x82be9f[_0x29a6('0x29')]]={'$like':'%'+_0x1bdf5f[_0x29a6('0x31')][_0x29a6('0x40')]+'%'};return _0x417bb5;}})});}_0x4250f4=_[_0x29a6('0x3d')]({},_0x4250f4,_0x1bdf5f[_0x29a6('0x41')]);var _0x3621a3={'where':_0x4250f4[_0x29a6('0x3c')]};return db[_0x29a6('0x2b')][_0x29a6('0x1b')](_0x3621a3)[_0x29a6('0x21')](function(_0x44351d){_0x3a58e0['count']=_0x44351d;if(_0x1bdf5f[_0x29a6('0x31')][_0x29a6('0x42')]){_0x4250f4[_0x29a6('0x43')]=[{'all':!![]}];}return db['VoiceChanSpy'][_0x29a6('0x44')](_0x4250f4);})['then'](function(_0x46dc89){_0x3a58e0[_0x29a6('0x45')]=_0x46dc89;return _0x3a58e0;})[_0x29a6('0x21')](respondWithFilteredResult(_0x1d5cf2,_0x4250f4))[_0x29a6('0x46')](handleError(_0x1d5cf2,null));};exports['show']=function(_0x100be4,_0x4556f7){var _0x245c32={'raw':![],'where':{'id':_0x100be4[_0x29a6('0x47')]['id']}},_0x4a4bf0={};_0x4a4bf0[_0x29a6('0x30')]=_['keys'](db[_0x29a6('0x2b')][_0x29a6('0x2c')]);_0x4a4bf0[_0x29a6('0x31')]=_[_0x29a6('0x32')](_0x100be4[_0x29a6('0x31')]);_0x4a4bf0[_0x29a6('0x33')]=_[_0x29a6('0x34')](_0x4a4bf0[_0x29a6('0x30')],_0x4a4bf0[_0x29a6('0x31')]);_0x245c32[_0x29a6('0x35')]=_[_0x29a6('0x34')](_0x4a4bf0[_0x29a6('0x30')],qs[_0x29a6('0x36')](_0x100be4[_0x29a6('0x31')][_0x29a6('0x36')]));_0x245c32[_0x29a6('0x35')]=_0x245c32['attributes']['length']?_0x245c32['attributes']:_0x4a4bf0[_0x29a6('0x30')];if(_0x100be4['query'][_0x29a6('0x42')]){_0x245c32['include']=[{'all':!![]}];}_0x245c32=_['merge']({},_0x245c32,_0x100be4[_0x29a6('0x41')]);return db['VoiceChanSpy'][_0x29a6('0x48')](_0x245c32)[_0x29a6('0x21')](handleEntityNotFound(_0x4556f7,null))['then'](respondWithResult(_0x4556f7,null))[_0x29a6('0x46')](handleError(_0x4556f7,null));};exports[_0x29a6('0x49')]=function(_0x2c7556,_0x477085){return db[_0x29a6('0x2b')][_0x29a6('0x49')](_0x2c7556[_0x29a6('0x4a')],{})[_0x29a6('0x21')](function(_0x918a8b){var _0x3e631b=_0x2c7556['user'][_0x29a6('0x22')]({'plain':!![]});if(!_0x3e631b)throw new Error(_0x29a6('0x4b'));if(_0x3e631b[_0x29a6('0x4c')]===_0x29a6('0x4d')){var _0x5671db=_0x918a8b[_0x29a6('0x22')]({'plain':!![]});var _0x36ce7e='ChanSpies';return db['UserProfileSection']['find']({'where':{'name':_0x36ce7e,'userProfileId':_0x3e631b[_0x29a6('0x4e')]},'raw':!![]})[_0x29a6('0x21')](function(_0x6e2ab5){if(_0x6e2ab5&&_0x6e2ab5[_0x29a6('0x4f')]===0x0){return db['UserProfileResource'][_0x29a6('0x49')]({'name':_0x5671db[_0x29a6('0x29')],'resourceId':_0x5671db['id'],'type':_0x6e2ab5['name'],'sectionId':_0x6e2ab5['id']},{})[_0x29a6('0x21')](function(){return _0x918a8b;});}else{return _0x918a8b;}})[_0x29a6('0x46')](function(_0x40f52b){logger[_0x29a6('0x27')](_0x29a6('0x50'),_0x40f52b);throw _0x40f52b;});}return _0x918a8b;})[_0x29a6('0x21')](respondWithResult(_0x477085,0xc9))['catch'](handleError(_0x477085,null));};exports[_0x29a6('0x20')]=function(_0x371313,_0x4ab03f){if(_0x371313[_0x29a6('0x4a')]['id']){delete _0x371313['body']['id'];}return db[_0x29a6('0x2b')]['find']({'where':{'id':_0x371313[_0x29a6('0x47')]['id']}})[_0x29a6('0x21')](handleEntityNotFound(_0x4ab03f,null))[_0x29a6('0x21')](saveUpdates(_0x371313[_0x29a6('0x4a')],null))['then'](respondWithResult(_0x4ab03f,null))[_0x29a6('0x46')](handleError(_0x4ab03f,null));};exports[_0x29a6('0x25')]=function(_0x2d244f,_0x49a9a9){return db['VoiceChanSpy']['find']({'where':{'id':_0x2d244f['params']['id']}})['then'](handleEntityNotFound(_0x49a9a9,null))[_0x29a6('0x21')](removeEntity(_0x49a9a9,null))[_0x29a6('0x46')](handleError(_0x49a9a9,null));}; \ No newline at end of file +var _0xc524=['where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','create','user','role','ChanSpies','UserProfileSection','find','userProfileId','autoAssociation','update','body','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','end','json','offset','undefined','limit','count','status','set','Content-Range','apply','reject','save','destroy','then','get','UserProfileResource','sendStatus','error','stack','name','send','index','map','VoiceChanSpy','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort'];(function(_0x333fed,_0x3d2122){var _0x12cac2=function(_0x41d9af){while(--_0x41d9af){_0x333fed['push'](_0x333fed['shift']());}};_0x12cac2(++_0x3d2122);}(_0xc524,0x1bf));var _0x4c52=function(_0x13ac3a,_0x4ec50a){_0x13ac3a=_0x13ac3a-0x0;var _0x17112c=_0xc524[_0x13ac3a];return _0x17112c;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x4c52('0x0'));var jsonpatch=require(_0x4c52('0x1'));var rp=require(_0x4c52('0x2'));var moment=require(_0x4c52('0x3'));var BPromise=require(_0x4c52('0x4'));var Mustache=require(_0x4c52('0x5'));var util=require(_0x4c52('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x4c52('0x7'));var ejs=require(_0x4c52('0x8'));var fs=require('fs');var fs_extra=require(_0x4c52('0x9'));var _=require(_0x4c52('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x4c52('0xb'));var deskjs=require(_0x4c52('0xc'));var toCsv=require('to-csv');var querystring=require(_0x4c52('0xd'));var Papa=require(_0x4c52('0xe'));var Redis=require('ioredis');var authService=require(_0x4c52('0xf'));var qs=require(_0x4c52('0x10'));var as=require(_0x4c52('0x11'));var hardwareService=require(_0x4c52('0x12'));var logger=require(_0x4c52('0x13'))(_0x4c52('0x14'));var utils=require(_0x4c52('0x15'));var config=require(_0x4c52('0x16'));var licenseUtil=require(_0x4c52('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1500e8,_0x1d7a2b){_0x1d7a2b=_0x1d7a2b||0xcc;return function(_0xe46163){if(_0xe46163){return _0x1500e8['sendStatus'](_0x1d7a2b);}return _0x1500e8['status'](_0x1d7a2b)[_0x4c52('0x18')]();};}function respondWithResult(_0x507e89,_0x45d822){_0x45d822=_0x45d822||0xc8;return function(_0x2c8e3b){if(_0x2c8e3b){return _0x507e89['status'](_0x45d822)[_0x4c52('0x19')](_0x2c8e3b);}};}function respondWithFilteredResult(_0x18bc58,_0x1286ec){return function(_0x206fc1){if(_0x206fc1){var _0x1b8481=typeof _0x1286ec[_0x4c52('0x1a')]===_0x4c52('0x1b')&&typeof _0x1286ec[_0x4c52('0x1c')]===_0x4c52('0x1b');var _0x43b8c8=_0x206fc1[_0x4c52('0x1d')];var _0x1f036c=_0x1b8481?0x0:_0x1286ec[_0x4c52('0x1a')];var _0x2a498c=_0x1b8481?_0x206fc1[_0x4c52('0x1d')]:_0x1286ec[_0x4c52('0x1a')]+_0x1286ec['limit'];var _0x39fd74;if(_0x2a498c>=_0x43b8c8){_0x2a498c=_0x43b8c8;_0x39fd74=0xc8;}else{_0x39fd74=0xce;}_0x18bc58[_0x4c52('0x1e')](_0x39fd74);return _0x18bc58[_0x4c52('0x1f')](_0x4c52('0x20'),_0x1f036c+'-'+_0x2a498c+'/'+_0x43b8c8)[_0x4c52('0x19')](_0x206fc1);}return null;};}function patchUpdates(_0x10cb0a){return function(_0x161ce4){try{jsonpatch[_0x4c52('0x21')](_0x161ce4,_0x10cb0a,!![]);}catch(_0x3a054e){return BPromise[_0x4c52('0x22')](_0x3a054e);}return _0x161ce4[_0x4c52('0x23')]();};}function saveUpdates(_0x38a0ff,_0x3f3a8c){return function(_0x3b311d){if(_0x3b311d){return _0x3b311d['update'](_0x38a0ff)['then'](function(_0x142db8){return _0x142db8;});}return null;};}function removeEntity(_0x3c6dba,_0x13cf34){return function(_0x5e3f3){if(_0x5e3f3){return _0x5e3f3[_0x4c52('0x24')]()[_0x4c52('0x25')](function(){var _0x4e357f=_0x5e3f3[_0x4c52('0x26')]({'plain':!![]});var _0x19e4b9='ChanSpies';return db[_0x4c52('0x27')][_0x4c52('0x24')]({'where':{'type':_0x19e4b9,'resourceId':_0x4e357f['id']}})['then'](function(){return _0x5e3f3;});})[_0x4c52('0x25')](function(){_0x3c6dba[_0x4c52('0x1e')](0xcc)[_0x4c52('0x18')]();});}};}function handleEntityNotFound(_0x598c36,_0x1fb238){return function(_0x3500aa){if(!_0x3500aa){_0x598c36[_0x4c52('0x28')](0x194);}return _0x3500aa;};}function handleError(_0x24169e,_0x4fce7b){_0x4fce7b=_0x4fce7b||0x1f4;return function(_0x3df22d){logger[_0x4c52('0x29')](_0x3df22d[_0x4c52('0x2a')]);if(_0x3df22d[_0x4c52('0x2b')]){delete _0x3df22d[_0x4c52('0x2b')];}_0x24169e['status'](_0x4fce7b)[_0x4c52('0x2c')](_0x3df22d);};}exports[_0x4c52('0x2d')]=function(_0x8be0ac,_0x51ee64){var _0x10a3a4={},_0x20545c={},_0xfe63cf={'count':0x0,'rows':[]};var _0x21ce44=_[_0x4c52('0x2e')](db[_0x4c52('0x2f')][_0x4c52('0x30')],function(_0x4fc8cc){return{'name':_0x4fc8cc['fieldName'],'type':_0x4fc8cc[_0x4c52('0x31')][_0x4c52('0x32')]};});_0x20545c[_0x4c52('0x33')]=_[_0x4c52('0x2e')](_0x21ce44,_0x4c52('0x2b'));_0x20545c[_0x4c52('0x34')]=_[_0x4c52('0x35')](_0x8be0ac[_0x4c52('0x34')]);_0x20545c[_0x4c52('0x36')]=_[_0x4c52('0x37')](_0x20545c[_0x4c52('0x33')],_0x20545c['query']);_0x10a3a4[_0x4c52('0x38')]=_[_0x4c52('0x37')](_0x20545c[_0x4c52('0x33')],qs[_0x4c52('0x39')](_0x8be0ac[_0x4c52('0x34')][_0x4c52('0x39')]));_0x10a3a4['attributes']=_0x10a3a4['attributes'][_0x4c52('0x3a')]?_0x10a3a4[_0x4c52('0x38')]:_0x20545c[_0x4c52('0x33')];if(!_0x8be0ac[_0x4c52('0x34')][_0x4c52('0x3b')](_0x4c52('0x3c'))){_0x10a3a4['limit']=qs['limit'](_0x8be0ac[_0x4c52('0x34')][_0x4c52('0x1c')]);_0x10a3a4['offset']=qs['offset'](_0x8be0ac[_0x4c52('0x34')][_0x4c52('0x1a')]);}_0x10a3a4[_0x4c52('0x3d')]=qs[_0x4c52('0x3e')](_0x8be0ac[_0x4c52('0x34')]['sort']);_0x10a3a4[_0x4c52('0x3f')]=qs[_0x4c52('0x36')](_[_0x4c52('0x40')](_0x8be0ac[_0x4c52('0x34')],_0x20545c['filters']),_0x21ce44);if(_0x8be0ac['query'][_0x4c52('0x41')]){_0x10a3a4['where']=_[_0x4c52('0x42')](_0x10a3a4[_0x4c52('0x3f')],{'$or':_[_0x4c52('0x2e')](_0x21ce44,function(_0x4c840e){if(_0x4c840e[_0x4c52('0x31')]!==_0x4c52('0x43')){var _0xddcf7c={};_0xddcf7c[_0x4c840e[_0x4c52('0x2b')]]={'$like':'%'+_0x8be0ac[_0x4c52('0x34')]['filter']+'%'};return _0xddcf7c;}})});}_0x10a3a4=_['merge']({},_0x10a3a4,_0x8be0ac[_0x4c52('0x44')]);var _0x5c2934={'where':_0x10a3a4[_0x4c52('0x3f')]};return db[_0x4c52('0x2f')][_0x4c52('0x1d')](_0x5c2934)[_0x4c52('0x25')](function(_0x5152d9){_0xfe63cf[_0x4c52('0x1d')]=_0x5152d9;if(_0x8be0ac[_0x4c52('0x34')][_0x4c52('0x45')]){_0x10a3a4[_0x4c52('0x46')]=[{'all':!![]}];}return db['VoiceChanSpy']['findAll'](_0x10a3a4);})[_0x4c52('0x25')](function(_0x2d4e96){_0xfe63cf[_0x4c52('0x47')]=_0x2d4e96;return _0xfe63cf;})[_0x4c52('0x25')](respondWithFilteredResult(_0x51ee64,_0x10a3a4))[_0x4c52('0x48')](handleError(_0x51ee64,null));};exports[_0x4c52('0x49')]=function(_0x15ca49,_0x3d8d61){var _0x36101a={'raw':![],'where':{'id':_0x15ca49[_0x4c52('0x4a')]['id']}},_0x19fb9d={};_0x19fb9d[_0x4c52('0x33')]=_['keys'](db[_0x4c52('0x2f')]['rawAttributes']);_0x19fb9d['query']=_[_0x4c52('0x35')](_0x15ca49['query']);_0x19fb9d[_0x4c52('0x36')]=_[_0x4c52('0x37')](_0x19fb9d[_0x4c52('0x33')],_0x19fb9d['query']);_0x36101a[_0x4c52('0x38')]=_[_0x4c52('0x37')](_0x19fb9d['model'],qs['fields'](_0x15ca49[_0x4c52('0x34')][_0x4c52('0x39')]));_0x36101a[_0x4c52('0x38')]=_0x36101a[_0x4c52('0x38')]['length']?_0x36101a['attributes']:_0x19fb9d[_0x4c52('0x33')];if(_0x15ca49[_0x4c52('0x34')][_0x4c52('0x45')]){_0x36101a[_0x4c52('0x46')]=[{'all':!![]}];}_0x36101a=_[_0x4c52('0x42')]({},_0x36101a,_0x15ca49[_0x4c52('0x44')]);return db[_0x4c52('0x2f')]['find'](_0x36101a)[_0x4c52('0x25')](handleEntityNotFound(_0x3d8d61,null))[_0x4c52('0x25')](respondWithResult(_0x3d8d61,null))[_0x4c52('0x48')](handleError(_0x3d8d61,null));};exports['create']=function(_0x450875,_0x3dfffe){return db[_0x4c52('0x2f')][_0x4c52('0x4b')](_0x450875['body'],{})[_0x4c52('0x25')](function(_0x40c8de){var _0x4d1b77=_0x450875[_0x4c52('0x4c')][_0x4c52('0x26')]({'plain':!![]});if(!_0x4d1b77)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4d1b77[_0x4c52('0x4d')]===_0x4c52('0x4c')){var _0x409f92=_0x40c8de[_0x4c52('0x26')]({'plain':!![]});var _0x519f4=_0x4c52('0x4e');return db[_0x4c52('0x4f')][_0x4c52('0x50')]({'where':{'name':_0x519f4,'userProfileId':_0x4d1b77[_0x4c52('0x51')]},'raw':!![]})[_0x4c52('0x25')](function(_0x563113){if(_0x563113&&_0x563113[_0x4c52('0x52')]===0x0){return db[_0x4c52('0x27')][_0x4c52('0x4b')]({'name':_0x409f92[_0x4c52('0x2b')],'resourceId':_0x409f92['id'],'type':_0x563113['name'],'sectionId':_0x563113['id']},{})['then'](function(){return _0x40c8de;});}else{return _0x40c8de;}})[_0x4c52('0x48')](function(_0x561685){logger[_0x4c52('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x561685);throw _0x561685;});}return _0x40c8de;})[_0x4c52('0x25')](respondWithResult(_0x3dfffe,0xc9))[_0x4c52('0x48')](handleError(_0x3dfffe,null));};exports[_0x4c52('0x53')]=function(_0x14bfce,_0x912744){if(_0x14bfce['body']['id']){delete _0x14bfce[_0x4c52('0x54')]['id'];}return db['VoiceChanSpy']['find']({'where':{'id':_0x14bfce[_0x4c52('0x4a')]['id']}})[_0x4c52('0x25')](handleEntityNotFound(_0x912744,null))[_0x4c52('0x25')](saveUpdates(_0x14bfce['body'],null))['then'](respondWithResult(_0x912744,null))[_0x4c52('0x48')](handleError(_0x912744,null));};exports[_0x4c52('0x24')]=function(_0x52bac3,_0x4b8a37){return db[_0x4c52('0x2f')][_0x4c52('0x50')]({'where':{'id':_0x52bac3['params']['id']}})[_0x4c52('0x25')](handleEntityNotFound(_0x4b8a37,null))[_0x4c52('0x25')](removeEntity(_0x4b8a37,null))[_0x4c52('0x48')](handleError(_0x4b8a37,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index bec19eb..aa14df0 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 _0x4ae4=['prefix','system','chanspy','record','push','MixMonitor','${UNIQUEID}.%s,a','recordingFormat','auth','merge','Authenticate','password','ChanSpy','SIP/%s,%s','options','join','StopMixMonitor','length','concat','internal','name','User','findAll','agent','then','catch','models','define','voice_chanspy','VoiceExtension','bulkCreate','destroy','lodash','bluebird','./voiceChanSpy.attributes','format','%s%s'];(function(_0x1ebc52,_0x2bcd09){var _0x2bef05=function(_0x3d3e6b){while(--_0x3d3e6b){_0x1ebc52['push'](_0x1ebc52['shift']());}};_0x2bef05(++_0x2bcd09);}(_0x4ae4,0x8f));var _0x44ae=function(_0x4fc3d7,_0x13777d){_0x4fc3d7=_0x4fc3d7-0x0;var _0x4ece22=_0x4ae4[_0x4fc3d7];return _0x4ece22;};'use strict';var _=require(_0x44ae('0x0'));var util=require('util');var BPromise=require(_0x44ae('0x1'));var attributes=require(_0x44ae('0x2'));var getUserApplications=function(_0x2fd909,_0x49468c,_0x242deb){var _0x502969=0x1;var _0x1a509c=[];var _0x32e4b6={'context':_0x49468c['context']||'from-sip','exten':util[_0x44ae('0x3')](_0x44ae('0x4'),_0x2fd909[_0x44ae('0x5')],_0x242deb),'type':_0x44ae('0x6'),'isApp':![],'ChanSpyId':_0x2fd909['id'],'UserId':_0x49468c['id']};_0x1a509c['push'](_['merge']({'app':'Set','appdata':util[_0x44ae('0x3')]('CDR(type)=%s',_0x44ae('0x7')),'priority':_0x502969++},_0x32e4b6));if(_0x2fd909[_0x44ae('0x8')]){_0x1a509c[_0x44ae('0x9')](_['merge']({'app':_0x44ae('0xa'),'appdata':util[_0x44ae('0x3')](_0x44ae('0xb'),_0x2fd909[_0x44ae('0xc')]),'priority':_0x502969++},_0x32e4b6));}if(_0x2fd909[_0x44ae('0xd')]){_0x1a509c[_0x44ae('0x9')](_[_0x44ae('0xe')]({'app':_0x44ae('0xf'),'appdata':_0x2fd909[_0x44ae('0x10')],'priority':_0x502969++},_0x32e4b6));}_0x1a509c[_0x44ae('0x9')](_[_0x44ae('0xe')]({'app':_0x44ae('0x11'),'appdata':util[_0x44ae('0x3')](_0x44ae('0x12'),_0x49468c['name'],_0x2fd909[_0x44ae('0x13')]?_0x2fd909[_0x44ae('0x13')][_0x44ae('0x14')](''):''),'priority':_0x502969++},_0x32e4b6));if(_0x2fd909[_0x44ae('0x8')]){_0x1a509c['push'](_['merge']({'app':_0x44ae('0x15'),'priority':_0x502969++},_0x32e4b6));}return _0x1a509c;};var getChanSpyApplications=function(_0xcfbe83,_0x527c4b){var _0x51f037=[];for(var _0x38d545=0x0,_0x4ba343=0x1;_0x38d545<_0x527c4b[_0x44ae('0x16')];_0x38d545++,_0x4ba343=0x1){_0x51f037=_0x51f037[_0x44ae('0x17')](getUserApplications(_0xcfbe83,_0x527c4b[_0x38d545],_0x527c4b[_0x38d545][_0x44ae('0x18')]));if(_0x527c4b[_0x38d545][_0x44ae('0x18')]!=_0x527c4b[_0x38d545][_0x44ae('0x19')]){_0x51f037=_0x51f037[_0x44ae('0x17')](getUserApplications(_0xcfbe83,_0x527c4b[_0x38d545],_0x527c4b[_0x38d545][_0x44ae('0x19')]));}}return _0x51f037;};var getChanSpyPromise=function(_0x142699,_0x4022ef){return new BPromise(function(_0x154d07,_0xf95a33){return _0x142699[_0x44ae('0x1a')][_0x44ae('0x1b')]({'attributes':['id','name','internal'],'where':{'role':_0x44ae('0x1c'),'chanspy':!![]},'raw':!![]})[_0x44ae('0x1d')](function(_0x390934){if(_0x390934){return _0x154d07(getChanSpyApplications(_0x4022ef,_0x390934));}return _0x154d07([]);})[_0x44ae('0x1e')](function(_0x3d3446){_0xf95a33(_0x3d3446);});});};module['exports']=function(_0x599c6b,_0x19037d){var _0x2152fb=_0x599c6b[_0x44ae('0x1f')];return _0x599c6b[_0x44ae('0x20')]('VoiceChanSpy',attributes,{'tableName':_0x44ae('0x21'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x11d8da,_0x22846f,_0x4f12bd){return getChanSpyPromise(_0x2152fb,_0x11d8da)[_0x44ae('0x1d')](function(_0x35844c){if(_0x35844c&&_0x35844c[_0x44ae('0x16')]){return _0x2152fb[_0x44ae('0x22')][_0x44ae('0x23')](_0x35844c);}})[_0x44ae('0x1d')](function(){_0x4f12bd();})[_0x44ae('0x1e')](function(_0x5189d3){_0x4f12bd(_0x5189d3);});},'afterUpdate':function(_0x4e8322,_0x53cacd,_0x1e6fc9){return _0x2152fb[_0x44ae('0x22')][_0x44ae('0x24')]({'where':{'ChanSpyId':_0x4e8322['id']}})[_0x44ae('0x1d')](function(){return getChanSpyPromise(_0x2152fb,_0x4e8322);})[_0x44ae('0x1d')](function(_0x34c97e){if(_0x34c97e&&_0x34c97e[_0x44ae('0x16')]){return _0x2152fb[_0x44ae('0x22')][_0x44ae('0x23')](_0x34c97e);}})[_0x44ae('0x1d')](function(){_0x1e6fc9();})[_0x44ae('0x1e')](function(_0x280458){_0x1e6fc9(_0x280458);});},'afterDestroy':function(_0x2d8261,_0xc9cc1a,_0x11946f){return _0x2152fb[_0x44ae('0x22')][_0x44ae('0x24')]({'where':{'ChanSpyId':_0x2d8261['id']}})['then'](function(){_0x11946f();})[_0x44ae('0x1e')](function(_0x47805e){_0x11946f(_0x47805e);});}}});}; \ No newline at end of file +var _0xdcad=['context','from-sip','%s%s','system','push','Set','format','chanspy','record','merge','${UNIQUEID}.%s,a','recordingFormat','Authenticate','password','ChanSpy','SIP/%s,%s','options','join','StopMixMonitor','length','concat','internal','name','User','findAll','agent','then','catch','models','define','VoiceChanSpy','voice_chanspy','VoiceExtension','bulkCreate','destroy','lodash','util','bluebird','./voiceChanSpy.attributes'];(function(_0x1daaa9,_0x220393){var _0x1dd221=function(_0x492c61){while(--_0x492c61){_0x1daaa9['push'](_0x1daaa9['shift']());}};_0x1dd221(++_0x220393);}(_0xdcad,0x98));var _0xddca=function(_0xbcb286,_0x2fd5de){_0xbcb286=_0xbcb286-0x0;var _0x356c53=_0xdcad[_0xbcb286];return _0x356c53;};'use strict';var _=require(_0xddca('0x0'));var util=require(_0xddca('0x1'));var BPromise=require(_0xddca('0x2'));var attributes=require(_0xddca('0x3'));var getUserApplications=function(_0x3788f5,_0x4608d3,_0x3d9b8f){var _0x23fb9e=0x1;var _0x45dd75=[];var _0x440afe={'context':_0x4608d3[_0xddca('0x4')]||_0xddca('0x5'),'exten':util['format'](_0xddca('0x6'),_0x3788f5['prefix'],_0x3d9b8f),'type':_0xddca('0x7'),'isApp':![],'ChanSpyId':_0x3788f5['id'],'UserId':_0x4608d3['id']};_0x45dd75[_0xddca('0x8')](_['merge']({'app':_0xddca('0x9'),'appdata':util[_0xddca('0xa')]('CDR(type)=%s',_0xddca('0xb')),'priority':_0x23fb9e++},_0x440afe));if(_0x3788f5[_0xddca('0xc')]){_0x45dd75[_0xddca('0x8')](_[_0xddca('0xd')]({'app':'MixMonitor','appdata':util[_0xddca('0xa')](_0xddca('0xe'),_0x3788f5[_0xddca('0xf')]),'priority':_0x23fb9e++},_0x440afe));}if(_0x3788f5['auth']){_0x45dd75[_0xddca('0x8')](_[_0xddca('0xd')]({'app':_0xddca('0x10'),'appdata':_0x3788f5[_0xddca('0x11')],'priority':_0x23fb9e++},_0x440afe));}_0x45dd75[_0xddca('0x8')](_[_0xddca('0xd')]({'app':_0xddca('0x12'),'appdata':util[_0xddca('0xa')](_0xddca('0x13'),_0x4608d3['name'],_0x3788f5[_0xddca('0x14')]?_0x3788f5[_0xddca('0x14')][_0xddca('0x15')](''):''),'priority':_0x23fb9e++},_0x440afe));if(_0x3788f5[_0xddca('0xc')]){_0x45dd75[_0xddca('0x8')](_[_0xddca('0xd')]({'app':_0xddca('0x16'),'priority':_0x23fb9e++},_0x440afe));}return _0x45dd75;};var getChanSpyApplications=function(_0x15f38e,_0x1a56cb){var _0x568964=[];for(var _0x5a7560=0x0,_0x365a7c=0x1;_0x5a7560<_0x1a56cb[_0xddca('0x17')];_0x5a7560++,_0x365a7c=0x1){_0x568964=_0x568964[_0xddca('0x18')](getUserApplications(_0x15f38e,_0x1a56cb[_0x5a7560],_0x1a56cb[_0x5a7560][_0xddca('0x19')]));if(_0x1a56cb[_0x5a7560][_0xddca('0x19')]!=_0x1a56cb[_0x5a7560][_0xddca('0x1a')]){_0x568964=_0x568964[_0xddca('0x18')](getUserApplications(_0x15f38e,_0x1a56cb[_0x5a7560],_0x1a56cb[_0x5a7560][_0xddca('0x1a')]));}}return _0x568964;};var getChanSpyPromise=function(_0x3d8f73,_0x2628a0){return new BPromise(function(_0x2f3822,_0x397d1e){return _0x3d8f73[_0xddca('0x1b')][_0xddca('0x1c')]({'attributes':['id',_0xddca('0x1a'),_0xddca('0x19')],'where':{'role':_0xddca('0x1d'),'chanspy':!![]},'raw':!![]})[_0xddca('0x1e')](function(_0x13b9b9){if(_0x13b9b9){return _0x2f3822(getChanSpyApplications(_0x2628a0,_0x13b9b9));}return _0x2f3822([]);})[_0xddca('0x1f')](function(_0xe7e38a){_0x397d1e(_0xe7e38a);});});};module['exports']=function(_0x599069,_0xd80796){var _0x13db90=_0x599069[_0xddca('0x20')];return _0x599069[_0xddca('0x21')](_0xddca('0x22'),attributes,{'tableName':_0xddca('0x23'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x67f75a,_0x291732,_0x4ce5da){return getChanSpyPromise(_0x13db90,_0x67f75a)[_0xddca('0x1e')](function(_0x57c998){if(_0x57c998&&_0x57c998[_0xddca('0x17')]){return _0x13db90[_0xddca('0x24')][_0xddca('0x25')](_0x57c998);}})[_0xddca('0x1e')](function(){_0x4ce5da();})[_0xddca('0x1f')](function(_0x19d4dc){_0x4ce5da(_0x19d4dc);});},'afterUpdate':function(_0x4ae704,_0x1910b9,_0x5d0d70){return _0x13db90[_0xddca('0x24')]['destroy']({'where':{'ChanSpyId':_0x4ae704['id']}})[_0xddca('0x1e')](function(){return getChanSpyPromise(_0x13db90,_0x4ae704);})[_0xddca('0x1e')](function(_0x13bbf7){if(_0x13bbf7&&_0x13bbf7[_0xddca('0x17')]){return _0x13db90[_0xddca('0x24')][_0xddca('0x25')](_0x13bbf7);}})['then'](function(){_0x5d0d70();})[_0xddca('0x1f')](function(_0x1e89bf){_0x5d0d70(_0x1e89bf);});},'afterDestroy':function(_0x41c42c,_0x513510,_0x2dcbdb){return _0x13db90[_0xddca('0x24')][_0xddca('0x26')]({'where':{'ChanSpyId':_0x41c42c['id']}})['then'](function(){_0x2dcbdb();})[_0xddca('0x1f')](function(_0x3a1f01){_0x2dcbdb(_0x3a1f01);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index c283a84..75b29c9 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 _0x44a3=['http','request','then','info','request\x20sent','debug','error','code','message','VoiceChanSpy,\x20%s,\x20%s','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client'];(function(_0x2830e2,_0x534445){var _0x2c31da=function(_0x3b6ba4){while(--_0x3b6ba4){_0x2830e2['push'](_0x2830e2['shift']());}};_0x2c31da(++_0x534445);}(_0x44a3,0x1a9));var _0x344a=function(_0x23b3e0,_0x802d57){_0x23b3e0=_0x23b3e0-0x0;var _0x122558=_0x44a3[_0x23b3e0];return _0x122558;};'use strict';var _=require(_0x344a('0x0'));var util=require(_0x344a('0x1'));var moment=require(_0x344a('0x2'));var BPromise=require(_0x344a('0x3'));var rs=require(_0x344a('0x4'));var fs=require('fs');var Redis=require(_0x344a('0x5'));var db=require(_0x344a('0x6'))['db'];var utils=require(_0x344a('0x7'));var logger=require('../../config/logger')(_0x344a('0x8'));var config=require(_0x344a('0x9'));var jayson=require(_0x344a('0xa'));var client=jayson[_0x344a('0xb')][_0x344a('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x504bd1,_0x553d97,_0x55ddca){return new BPromise(function(_0x484661,_0x475dab){return client[_0x344a('0xd')](_0x504bd1,_0x55ddca)[_0x344a('0xe')](function(_0x233ca1){logger[_0x344a('0xf')]('VoiceChanSpy,\x20%s,\x20%s',_0x553d97,_0x344a('0x10'));logger[_0x344a('0x11')]('VoiceChanSpy,\x20%s,\x20%s,\x20%s',_0x553d97,_0x344a('0x10'),JSON['stringify'](_0x233ca1));if(_0x233ca1[_0x344a('0x12')]){if(_0x233ca1['error'][_0x344a('0x13')]===0x1f4){logger[_0x344a('0x12')]('VoiceChanSpy,\x20%s,\x20%s',_0x553d97,_0x233ca1['error'][_0x344a('0x14')]);return _0x475dab(_0x233ca1[_0x344a('0x12')][_0x344a('0x14')]);}logger[_0x344a('0x12')](_0x344a('0x15'),_0x553d97,_0x233ca1[_0x344a('0x12')]['message']);return _0x484661(_0x233ca1[_0x344a('0x12')][_0x344a('0x14')]);}else{logger[_0x344a('0xf')](_0x344a('0x15'),_0x553d97,'request\x20sent');_0x484661(_0x233ca1['result'][_0x344a('0x14')]);}})[_0x344a('0x16')](function(_0x36227e){logger[_0x344a('0x12')]('VoiceChanSpy,\x20%s,\x20%s',_0x553d97,_0x36227e);_0x475dab(_0x36227e);});});} \ No newline at end of file +var _0x705f=['result','catch','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','VoiceChanSpy,\x20%s,\x20%s','request\x20sent','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','stringify','error','message','info'];(function(_0x104b1f,_0x1454f5){var _0x1c2ec6=function(_0x4a21ed){while(--_0x4a21ed){_0x104b1f['push'](_0x104b1f['shift']());}};_0x1c2ec6(++_0x1454f5);}(_0x705f,0x75));var _0xf705=function(_0x519380,_0x7f196){_0x519380=_0x519380-0x0;var _0x60ba2c=_0x705f[_0x519380];return _0x60ba2c;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xf705('0x0'));var BPromise=require('bluebird');var rs=require(_0xf705('0x1'));var fs=require('fs');var Redis=require(_0xf705('0x2'));var db=require(_0xf705('0x3'))['db'];var utils=require(_0xf705('0x4'));var logger=require(_0xf705('0x5'))(_0xf705('0x6'));var config=require(_0xf705('0x7'));var jayson=require(_0xf705('0x8'));var client=jayson[_0xf705('0x9')][_0xf705('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x32c99d,_0x48eb92,_0x51fda8){return new BPromise(function(_0xc244e3,_0x58cae9){return client[_0xf705('0xb')](_0x32c99d,_0x51fda8)[_0xf705('0xc')](function(_0x4f3226){logger['info'](_0xf705('0xd'),_0x48eb92,_0xf705('0xe'));logger[_0xf705('0xf')](_0xf705('0x10'),_0x48eb92,_0xf705('0xe'),JSON[_0xf705('0x11')](_0x4f3226));if(_0x4f3226[_0xf705('0x12')]){if(_0x4f3226[_0xf705('0x12')]['code']===0x1f4){logger[_0xf705('0x12')](_0xf705('0xd'),_0x48eb92,_0x4f3226[_0xf705('0x12')][_0xf705('0x13')]);return _0x58cae9(_0x4f3226[_0xf705('0x12')]['message']);}logger['error'](_0xf705('0xd'),_0x48eb92,_0x4f3226[_0xf705('0x12')][_0xf705('0x13')]);return _0xc244e3(_0x4f3226[_0xf705('0x12')]['message']);}else{logger[_0xf705('0x14')](_0xf705('0xd'),_0x48eb92,_0xf705('0xe'));_0xc244e3(_0x4f3226[_0xf705('0x15')]['message']);}})[_0xf705('0x16')](function(_0x479b31){logger[_0xf705('0x12')](_0xf705('0xd'),_0x48eb92,_0x479b31);_0x58cae9(_0x479b31);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index 75f5d00..b6ec44d 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 _0xdda7=['util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','show','create','put','/:id','update','delete','destroy','exports'];(function(_0x4413a1,_0x55a868){var _0x184cf3=function(_0x52db9b){while(--_0x52db9b){_0x4413a1['push'](_0x4413a1['shift']());}};_0x184cf3(++_0x55a868);}(_0xdda7,0xcc));var _0x7dda=function(_0x3b7016,_0x381698){_0x3b7016=_0x3b7016-0x0;var _0x1c72b5=_0xdda7[_0x3b7016];return _0x1c72b5;};'use strict';var multer=require('multer');var util=require(_0x7dda('0x0'));var path=require('path');var timeout=require(_0x7dda('0x1'));var express=require(_0x7dda('0x2'));var router=express[_0x7dda('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x7dda('0x4'));var interaction=require(_0x7dda('0x5'));var config=require(_0x7dda('0x6'));var controller=require('./voiceContext.controller');router[_0x7dda('0x7')]('/',auth[_0x7dda('0x8')](),controller['index']);router[_0x7dda('0x7')]('/:id',auth[_0x7dda('0x8')](),controller[_0x7dda('0x9')]);router['post']('/',auth[_0x7dda('0x8')](),controller[_0x7dda('0xa')]);router[_0x7dda('0xb')](_0x7dda('0xc'),auth['isAuthenticated'](),controller[_0x7dda('0xd')]);router[_0x7dda('0xe')](_0x7dda('0xc'),auth['isAuthenticated'](),controller[_0x7dda('0xf')]);module[_0x7dda('0x10')]=router; \ No newline at end of file +var _0xd0bd=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceContext.controller','get','isAuthenticated','index','post','create','put','delete','/:id','destroy','exports','multer','path','connect-timeout'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0xd0bd,0x1eb));var _0xdd0b=function(_0x2bf141,_0x31eac7){_0x2bf141=_0x2bf141-0x0;var _0x48277b=_0xd0bd[_0x2bf141];return _0x48277b;};'use strict';var multer=require(_0xdd0b('0x0'));var util=require('util');var path=require(_0xdd0b('0x1'));var timeout=require(_0xdd0b('0x2'));var express=require(_0xdd0b('0x3'));var router=express[_0xdd0b('0x4')]();var fs_extra=require(_0xdd0b('0x5'));var auth=require(_0xdd0b('0x6'));var interaction=require(_0xdd0b('0x7'));var config=require('../../config/environment');var controller=require(_0xdd0b('0x8'));router[_0xdd0b('0x9')]('/',auth[_0xdd0b('0xa')](),controller[_0xdd0b('0xb')]);router['get']('/:id',auth[_0xdd0b('0xa')](),controller['show']);router[_0xdd0b('0xc')]('/',auth[_0xdd0b('0xa')](),controller[_0xdd0b('0xd')]);router[_0xdd0b('0xe')]('/:id',auth[_0xdd0b('0xa')](),controller['update']);router[_0xdd0b('0xf')](_0xdd0b('0x10'),auth[_0xdd0b('0xa')](),controller[_0xdd0b('0x11')]);module[_0xdd0b('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.attributes.js b/server/api/voiceContext/voiceContext.attributes.js index a82caf4..277712a 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 _0xe4c7=['sequelize','STRING','name','BOOLEAN'];(function(_0xc8db78,_0x58b5a7){var _0x3483f3=function(_0x2089ee){while(--_0x2089ee){_0xc8db78['push'](_0xc8db78['shift']());}};_0x3483f3(++_0x58b5a7);}(_0xe4c7,0xf8));var _0x7e4c=function(_0x21afde,_0x4454ce){_0x21afde=_0x21afde-0x0;var _0x33cde=_0xe4c7[_0x21afde];return _0x33cde;};'use strict';var Sequelize=require(_0x7e4c('0x0'));module['exports']={'name':{'type':Sequelize[_0x7e4c('0x1')],'unique':_0x7e4c('0x2')},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0x7e4c('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0x72cd=['exports','STRING','name','BOOLEAN','sequelize'];(function(_0x3cf5a3,_0x5a4492){var _0x39ba2d=function(_0x3ed989){while(--_0x3ed989){_0x3cf5a3['push'](_0x3cf5a3['shift']());}};_0x39ba2d(++_0x5a4492);}(_0x72cd,0x19e));var _0xd72c=function(_0x1e5745,_0x5309db){_0x1e5745=_0x1e5745-0x0;var _0x3053a7=_0x72cd[_0x1e5745];return _0x3053a7;};'use strict';var Sequelize=require(_0xd72c('0x0'));module[_0xd72c('0x1')]={'name':{'type':Sequelize[_0xd72c('0x2')],'unique':_0xd72c('0x3')},'description':{'type':Sequelize[_0xd72c('0x2')],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0xd72c('0x4')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.controller.js b/server/api/voiceContext/voiceContext.controller.js index f1e901a..96912d6 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 _0xa7fb=['Reload','chan_sip.so','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','server/files/templates/context.ejs','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','end','json','undefined','count','offset','limit','Content-Range','apply','reject','save','update','get','Contexts','UserProfileResource','destroy','stack','name','send','map','VoiceContext','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','order','sort','filters','pick','where','VIRTUAL','filter','options','includeAll','include','rows','params','length','merge','find','create','body','findAll','readFileSync','join','root','utf8','render','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf'];(function(_0x2bc05f,_0x2df7ce){var _0x49950a=function(_0x4fb3a1){while(--_0x4fb3a1){_0x2bc05f['push'](_0x2bc05f['shift']());}};_0x49950a(++_0x2df7ce);}(_0xa7fb,0x1b5));var _0xba7f=function(_0x4323d4,_0x1c38df){_0x4323d4=_0x4323d4-0x0;var _0x1c3864=_0xa7fb[_0x4323d4];return _0x1c3864;};'use strict';var emlformat=require(_0xba7f('0x0'));var rimraf=require(_0xba7f('0x1'));var zipdir=require(_0xba7f('0x2'));var jsonpatch=require(_0xba7f('0x3'));var rp=require(_0xba7f('0x4'));var moment=require('moment');var BPromise=require(_0xba7f('0x5'));var Mustache=require(_0xba7f('0x6'));var util=require(_0xba7f('0x7'));var path=require('path');var sox=require(_0xba7f('0x8'));var csv=require('to-csv');var ejs=require(_0xba7f('0x9'));var fs=require('fs');var fs_extra=require(_0xba7f('0xa'));var _=require(_0xba7f('0xb'));var squel=require(_0xba7f('0xc'));var crypto=require(_0xba7f('0xd'));var jsforce=require(_0xba7f('0xe'));var deskjs=require(_0xba7f('0xf'));var toCsv=require('to-csv');var querystring=require(_0xba7f('0x10'));var Papa=require(_0xba7f('0x11'));var Redis=require(_0xba7f('0x12'));var authService=require(_0xba7f('0x13'));var qs=require(_0xba7f('0x14'));var as=require(_0xba7f('0x15'));var hardwareService=require(_0xba7f('0x16'));var logger=require('../../config/logger')('api');var utils=require(_0xba7f('0x17'));var config=require(_0xba7f('0x18'));var licenseUtil=require(_0xba7f('0x19'));var db=require(_0xba7f('0x1a'))['db'];var jayson=require(_0xba7f('0x1b'));var client=jayson[_0xba7f('0x1c')][_0xba7f('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x14b1d5,_0x169c02,_0x73aba4,_0x4aad55){return new BPromise(function(_0x3f6435,_0x2b7137){var _0x16083b=_0x4aad55||client;return _0x16083b[_0xba7f('0x1e')](_0x14b1d5,_0x73aba4)[_0xba7f('0x1f')](function(_0x3c4f66){logger[_0xba7f('0x20')](_0xba7f('0x21'),_0x169c02,_0xba7f('0x22'));logger['debug']('VoiceContext,\x20%s,\x20%s,\x20%s',_0x169c02,_0xba7f('0x22'),JSON[_0xba7f('0x23')](_0x3c4f66));if(_0x3c4f66[_0xba7f('0x24')]){if(_0x3c4f66[_0xba7f('0x24')][_0xba7f('0x25')]===0x1f4){logger['error'](_0xba7f('0x21'),_0x169c02,_0x3c4f66['error'][_0xba7f('0x26')]);return _0x2b7137(_0x3c4f66[_0xba7f('0x24')][_0xba7f('0x26')]);}logger[_0xba7f('0x24')](_0xba7f('0x21'),_0x169c02,_0x3c4f66[_0xba7f('0x24')][_0xba7f('0x26')]);return _0x3f6435(_0x3c4f66[_0xba7f('0x24')][_0xba7f('0x26')]);}else{logger['info'](_0xba7f('0x21'),_0x169c02,_0xba7f('0x22'));_0x3f6435(_0x3c4f66[_0xba7f('0x27')][_0xba7f('0x26')]);}})[_0xba7f('0x28')](function(_0x2ddaa0){logger[_0xba7f('0x24')]('VoiceContext,\x20%s,\x20%s',_0x169c02,_0x2ddaa0);_0x2b7137(_0x2ddaa0);});});}function respondWithStatusCode(_0x44deb1,_0x4115b0){_0x4115b0=_0x4115b0||0xcc;return function(_0x1b5fd0){if(_0x1b5fd0){return _0x44deb1[_0xba7f('0x29')](_0x4115b0);}return _0x44deb1[_0xba7f('0x2a')](_0x4115b0)[_0xba7f('0x2b')]();};}function respondWithResult(_0x267348,_0x208ff4){_0x208ff4=_0x208ff4||0xc8;return function(_0x58ebba){if(_0x58ebba){return _0x267348['status'](_0x208ff4)[_0xba7f('0x2c')](_0x58ebba);}};}function respondWithFilteredResult(_0x1b91e4,_0xf0ba08){return function(_0x17d716){if(_0x17d716){var _0x10a0b3=typeof _0xf0ba08['offset']==='undefined'&&typeof _0xf0ba08['limit']===_0xba7f('0x2d');var _0x2dfe15=_0x17d716[_0xba7f('0x2e')];var _0x38b8cc=_0x10a0b3?0x0:_0xf0ba08['offset'];var _0x199096=_0x10a0b3?_0x17d716[_0xba7f('0x2e')]:_0xf0ba08[_0xba7f('0x2f')]+_0xf0ba08[_0xba7f('0x30')];var _0x15006f;if(_0x199096>=_0x2dfe15){_0x199096=_0x2dfe15;_0x15006f=0xc8;}else{_0x15006f=0xce;}_0x1b91e4[_0xba7f('0x2a')](_0x15006f);return _0x1b91e4['set'](_0xba7f('0x31'),_0x38b8cc+'-'+_0x199096+'/'+_0x2dfe15)[_0xba7f('0x2c')](_0x17d716);}return null;};}function patchUpdates(_0x357cc5){return function(_0x39b6d5){try{jsonpatch[_0xba7f('0x32')](_0x39b6d5,_0x357cc5,!![]);}catch(_0x3fa89c){return BPromise[_0xba7f('0x33')](_0x3fa89c);}return _0x39b6d5[_0xba7f('0x34')]();};}function saveUpdates(_0x209983,_0x3dd10c){return function(_0x5c6079){if(_0x5c6079){return _0x5c6079[_0xba7f('0x35')](_0x209983)['then'](function(_0x3db04e){return _0x3db04e;});}return null;};}function removeEntity(_0x59c527,_0x45f136){return function(_0x4cd0bd){if(_0x4cd0bd){return _0x4cd0bd['destroy']()['then'](function(){var _0x3699c9=_0x4cd0bd[_0xba7f('0x36')]({'plain':!![]});var _0x2096d2=_0xba7f('0x37');return db[_0xba7f('0x38')][_0xba7f('0x39')]({'where':{'type':_0x2096d2,'resourceId':_0x3699c9['id']}})[_0xba7f('0x1f')](function(){return _0x4cd0bd;});})[_0xba7f('0x1f')](function(){_0x59c527[_0xba7f('0x2a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x29bb96,_0x18b1c1){return function(_0x4f807a){if(!_0x4f807a){_0x29bb96[_0xba7f('0x29')](0x194);}return _0x4f807a;};}function handleError(_0x1869dd,_0x570d39){_0x570d39=_0x570d39||0x1f4;return function(_0x195008){logger['error'](_0x195008[_0xba7f('0x3a')]);if(_0x195008[_0xba7f('0x3b')]){delete _0x195008[_0xba7f('0x3b')];}_0x1869dd['status'](_0x570d39)[_0xba7f('0x3c')](_0x195008);};}exports['index']=function(_0x2730ff,_0x2550dc){var _0x59012a={},_0x1f91e7={},_0x4947cb={'count':0x0,'rows':[]};var _0x151f97=_[_0xba7f('0x3d')](db[_0xba7f('0x3e')][_0xba7f('0x3f')],function(_0x54966b){return{'name':_0x54966b[_0xba7f('0x40')],'type':_0x54966b[_0xba7f('0x41')][_0xba7f('0x42')]};});_0x1f91e7[_0xba7f('0x43')]=_['map'](_0x151f97,_0xba7f('0x3b'));_0x1f91e7[_0xba7f('0x44')]=_[_0xba7f('0x45')](_0x2730ff[_0xba7f('0x44')]);_0x1f91e7['filters']=_['intersection'](_0x1f91e7['model'],_0x1f91e7[_0xba7f('0x44')]);_0x59012a['attributes']=_[_0xba7f('0x46')](_0x1f91e7[_0xba7f('0x43')],qs[_0xba7f('0x47')](_0x2730ff[_0xba7f('0x44')][_0xba7f('0x47')]));_0x59012a[_0xba7f('0x48')]=_0x59012a[_0xba7f('0x48')]['length']?_0x59012a['attributes']:_0x1f91e7[_0xba7f('0x43')];if(!_0x2730ff[_0xba7f('0x44')]['hasOwnProperty']('nolimit')){_0x59012a[_0xba7f('0x30')]=qs['limit'](_0x2730ff[_0xba7f('0x44')][_0xba7f('0x30')]);_0x59012a[_0xba7f('0x2f')]=qs[_0xba7f('0x2f')](_0x2730ff[_0xba7f('0x44')][_0xba7f('0x2f')]);}_0x59012a[_0xba7f('0x49')]=qs[_0xba7f('0x4a')](_0x2730ff['query']['sort']);_0x59012a['where']=qs[_0xba7f('0x4b')](_[_0xba7f('0x4c')](_0x2730ff[_0xba7f('0x44')],_0x1f91e7[_0xba7f('0x4b')]),_0x151f97);if(_0x2730ff[_0xba7f('0x44')]['filter']){_0x59012a[_0xba7f('0x4d')]=_['merge'](_0x59012a['where'],{'$or':_[_0xba7f('0x3d')](_0x151f97,function(_0x36af16){if(_0x36af16['type']!==_0xba7f('0x4e')){var _0x77daa9={};_0x77daa9[_0x36af16[_0xba7f('0x3b')]]={'$like':'%'+_0x2730ff[_0xba7f('0x44')][_0xba7f('0x4f')]+'%'};return _0x77daa9;}})});}_0x59012a=_['merge']({},_0x59012a,_0x2730ff[_0xba7f('0x50')]);var _0x571950={'where':_0x59012a['where']};return db[_0xba7f('0x3e')][_0xba7f('0x2e')](_0x571950)[_0xba7f('0x1f')](function(_0x5e0aa7){_0x4947cb[_0xba7f('0x2e')]=_0x5e0aa7;if(_0x2730ff[_0xba7f('0x44')][_0xba7f('0x51')]){_0x59012a[_0xba7f('0x52')]=[{'all':!![]}];}return db[_0xba7f('0x3e')]['findAll'](_0x59012a);})[_0xba7f('0x1f')](function(_0xfdc18c){_0x4947cb[_0xba7f('0x53')]=_0xfdc18c;return _0x4947cb;})['then'](respondWithFilteredResult(_0x2550dc,_0x59012a))[_0xba7f('0x28')](handleError(_0x2550dc,null));};exports['show']=function(_0x5eb810,_0x56f6ba){var _0x2a70e9={'raw':![],'where':{'id':_0x5eb810[_0xba7f('0x54')]['id']}},_0x5bbefd={};_0x5bbefd[_0xba7f('0x43')]=_[_0xba7f('0x45')](db[_0xba7f('0x3e')][_0xba7f('0x3f')]);_0x5bbefd[_0xba7f('0x44')]=_[_0xba7f('0x45')](_0x5eb810[_0xba7f('0x44')]);_0x5bbefd[_0xba7f('0x4b')]=_[_0xba7f('0x46')](_0x5bbefd[_0xba7f('0x43')],_0x5bbefd[_0xba7f('0x44')]);_0x2a70e9['attributes']=_[_0xba7f('0x46')](_0x5bbefd[_0xba7f('0x43')],qs[_0xba7f('0x47')](_0x5eb810[_0xba7f('0x44')][_0xba7f('0x47')]));_0x2a70e9[_0xba7f('0x48')]=_0x2a70e9[_0xba7f('0x48')][_0xba7f('0x55')]?_0x2a70e9[_0xba7f('0x48')]:_0x5bbefd['model'];if(_0x5eb810[_0xba7f('0x44')][_0xba7f('0x51')]){_0x2a70e9[_0xba7f('0x52')]=[{'all':!![]}];}_0x2a70e9=_[_0xba7f('0x56')]({},_0x2a70e9,_0x5eb810['options']);return db[_0xba7f('0x3e')][_0xba7f('0x57')](_0x2a70e9)['then'](handleEntityNotFound(_0x56f6ba,null))['then'](respondWithResult(_0x56f6ba,null))[_0xba7f('0x28')](handleError(_0x56f6ba,null));};exports[_0xba7f('0x58')]=function(_0x2e9e91,_0xd08c86,_0x144624){var _0x2e9c95;return db['VoiceContext'][_0xba7f('0x58')](_0x2e9e91[_0xba7f('0x59')],{'raw':!![]})[_0xba7f('0x1f')](function(_0xdf15f2){_0x2e9c95=_0xdf15f2;return db['VoiceContext'][_0xba7f('0x5a')]({'raw':!![]});})['then'](function(_0x1f591c){var _0x4b053c=fs[_0xba7f('0x5b')](path[_0xba7f('0x5c')](config[_0xba7f('0x5d')],'server/files/templates/context.ejs'),_0xba7f('0x5e'));var _0x11df43=ejs[_0xba7f('0x5f')](_0x4b053c,{'contexts':_0x1f591c||[]});fs[_0xba7f('0x60')](_0xba7f('0x61'),_0x11df43);})[_0xba7f('0x1f')](function(){return respondWithRpcPromise(_0xba7f('0x62'),_0xba7f('0x58'),{'module':_0xba7f('0x63')});})[_0xba7f('0x1f')](function(){var _0x85ab1=_0x2e9e91[_0xba7f('0x64')][_0xba7f('0x36')]({'plain':!![]});if(!_0x85ab1)throw new Error(_0xba7f('0x65'));if(_0x85ab1[_0xba7f('0x66')]===_0xba7f('0x64')){var _0x5dc674=_0x2e9c95[_0xba7f('0x36')]({'plain':!![]});return db[_0xba7f('0x67')][_0xba7f('0x57')]({'where':{'name':'Contexts','userProfileId':_0x85ab1[_0xba7f('0x68')]},'raw':!![]})[_0xba7f('0x1f')](function(_0x32936a){if(_0x32936a&&_0x32936a[_0xba7f('0x69')]===0x0){return db[_0xba7f('0x38')][_0xba7f('0x58')]({'name':_0x5dc674[_0xba7f('0x3b')],'resourceId':_0x5dc674['id'],'type':_0x32936a[_0xba7f('0x3b')],'sectionId':_0x32936a['id']},{})[_0xba7f('0x1f')](function(){return _0x2e9c95;});}else{return _0x2e9c95;}})[_0xba7f('0x28')](function(_0x57afe7){logger[_0xba7f('0x24')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x57afe7);throw _0x57afe7;});}return _0x2e9c95;})[_0xba7f('0x1f')](respondWithResult(_0xd08c86,0xc9))[_0xba7f('0x28')](handleError(_0xd08c86,null));};exports[_0xba7f('0x35')]=function(_0x799886,_0x1a4aae,_0x2323f3){var _0x532db9;return db[_0xba7f('0x3e')][_0xba7f('0x57')]({'where':{'id':_0x799886[_0xba7f('0x54')]['id']}})[_0xba7f('0x1f')](handleEntityNotFound(_0x1a4aae,null))[_0xba7f('0x1f')](saveUpdates(_0x799886[_0xba7f('0x59')],null))['then'](function(_0x15ebb9){if(_0x15ebb9){_0x532db9=_0x15ebb9;return db['VoiceContext']['findAll']({'raw':!![]});}})[_0xba7f('0x1f')](function(_0x96c997){var _0x2a1a81=fs['readFileSync'](path[_0xba7f('0x5c')](config[_0xba7f('0x5d')],_0xba7f('0x6a')),_0xba7f('0x5e'));var _0x34e69b=ejs['render'](_0x2a1a81,{'contexts':_0x96c997||[]});fs[_0xba7f('0x60')](_0xba7f('0x61'),_0x34e69b);})[_0xba7f('0x1f')](function(){return respondWithRpcPromise('Reload',_0xba7f('0x35'),{'module':_0xba7f('0x63')});})['then'](function(){return _0x532db9;})[_0xba7f('0x1f')](respondWithResult(_0x1a4aae,null))[_0xba7f('0x28')](handleError(_0x1a4aae,null));};exports[_0xba7f('0x39')]=function(_0x19235f,_0x1defe4,_0x1771bc){var _0xb289ec;return db[_0xba7f('0x3e')][_0xba7f('0x57')]({'where':{'id':_0x19235f[_0xba7f('0x54')]['id']}})[_0xba7f('0x1f')](handleEntityNotFound(_0x1defe4,null))[_0xba7f('0x1f')](removeEntity(_0x1defe4,null))[_0xba7f('0x1f')](function(){return db[_0xba7f('0x3e')][_0xba7f('0x5a')]({'raw':!![]});})['then'](function(_0x773011){var _0x5d9f02=fs[_0xba7f('0x5b')](path['join'](config[_0xba7f('0x5d')],_0xba7f('0x6a')),'utf8');var _0x1c8ae0=ejs[_0xba7f('0x5f')](_0x5d9f02,{'contexts':_0x773011});fs[_0xba7f('0x60')](_0xba7f('0x61'),_0x1c8ae0);return respondWithRpcPromise(_0xba7f('0x62'),_0xba7f('0x39'),{'module':_0xba7f('0x63')});})[_0xba7f('0x28')](handleError(_0x1defe4,null));}; \ No newline at end of file +var _0x4712=['offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','destroy','get','Contexts','UserProfileResource','stack','name','send','map','VoiceContext','rawAttributes','fieldName','type','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','params','find','create','body','readFileSync','join','server/files/templates/context.ejs','utf8','render','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','Reload','chan_sip.so','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','root','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','jayson/promise','client','http','request','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','end','status','json'];(function(_0x33ccaf,_0x192235){var _0x30abf6=function(_0x2dff32){while(--_0x2dff32){_0x33ccaf['push'](_0x33ccaf['shift']());}};_0x30abf6(++_0x192235);}(_0x4712,0x183));var _0x2471=function(_0x1f3267,_0x414fbd){_0x1f3267=_0x1f3267-0x0;var _0x2cc7d5=_0x4712[_0x1f3267];return _0x2cc7d5;};'use strict';var emlformat=require(_0x2471('0x0'));var rimraf=require(_0x2471('0x1'));var zipdir=require(_0x2471('0x2'));var jsonpatch=require(_0x2471('0x3'));var rp=require(_0x2471('0x4'));var moment=require(_0x2471('0x5'));var BPromise=require(_0x2471('0x6'));var Mustache=require(_0x2471('0x7'));var util=require(_0x2471('0x8'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x2471('0x9'));var fs=require('fs');var fs_extra=require(_0x2471('0xa'));var _=require('lodash');var squel=require(_0x2471('0xb'));var crypto=require(_0x2471('0xc'));var jsforce=require(_0x2471('0xd'));var deskjs=require(_0x2471('0xe'));var toCsv=require(_0x2471('0xf'));var querystring=require(_0x2471('0x10'));var Papa=require(_0x2471('0x11'));var Redis=require(_0x2471('0x12'));var authService=require(_0x2471('0x13'));var qs=require(_0x2471('0x14'));var as=require(_0x2471('0x15'));var hardwareService=require(_0x2471('0x16'));var logger=require(_0x2471('0x17'))('api');var utils=require(_0x2471('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x2471('0x19'));var db=require('../../mysqldb')['db'];var jayson=require(_0x2471('0x1a'));var client=jayson[_0x2471('0x1b')][_0x2471('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x3f64a0,_0x1b8329,_0x233982,_0x4fbf90){return new BPromise(function(_0x15bdbf,_0x16e4a8){var _0x125289=_0x4fbf90||client;return _0x125289[_0x2471('0x1d')](_0x3f64a0,_0x233982)[_0x2471('0x1e')](function(_0x31727a){logger[_0x2471('0x1f')](_0x2471('0x20'),_0x1b8329,_0x2471('0x21'));logger['debug'](_0x2471('0x22'),_0x1b8329,'request\x20sent',JSON[_0x2471('0x23')](_0x31727a));if(_0x31727a[_0x2471('0x24')]){if(_0x31727a[_0x2471('0x24')][_0x2471('0x25')]===0x1f4){logger[_0x2471('0x24')](_0x2471('0x20'),_0x1b8329,_0x31727a['error'][_0x2471('0x26')]);return _0x16e4a8(_0x31727a[_0x2471('0x24')]['message']);}logger[_0x2471('0x24')](_0x2471('0x20'),_0x1b8329,_0x31727a[_0x2471('0x24')][_0x2471('0x26')]);return _0x15bdbf(_0x31727a[_0x2471('0x24')]['message']);}else{logger[_0x2471('0x1f')](_0x2471('0x20'),_0x1b8329,'request\x20sent');_0x15bdbf(_0x31727a[_0x2471('0x27')]['message']);}})[_0x2471('0x28')](function(_0xdd3a13){logger[_0x2471('0x24')]('VoiceContext,\x20%s,\x20%s',_0x1b8329,_0xdd3a13);_0x16e4a8(_0xdd3a13);});});}function respondWithStatusCode(_0x4d3f0e,_0x52f86a){_0x52f86a=_0x52f86a||0xcc;return function(_0x3872ab){if(_0x3872ab){return _0x4d3f0e[_0x2471('0x29')](_0x52f86a);}return _0x4d3f0e['status'](_0x52f86a)[_0x2471('0x2a')]();};}function respondWithResult(_0x25bb37,_0x21b912){_0x21b912=_0x21b912||0xc8;return function(_0x5f03b9){if(_0x5f03b9){return _0x25bb37[_0x2471('0x2b')](_0x21b912)[_0x2471('0x2c')](_0x5f03b9);}};}function respondWithFilteredResult(_0x432d64,_0x15bfa3){return function(_0x1cac15){if(_0x1cac15){var _0x3521de=typeof _0x15bfa3[_0x2471('0x2d')]==='undefined'&&typeof _0x15bfa3[_0x2471('0x2e')]===_0x2471('0x2f');var _0xf45b0e=_0x1cac15[_0x2471('0x30')];var _0x3cd6dc=_0x3521de?0x0:_0x15bfa3['offset'];var _0x19e059=_0x3521de?_0x1cac15[_0x2471('0x30')]:_0x15bfa3[_0x2471('0x2d')]+_0x15bfa3['limit'];var _0x59aa7f;if(_0x19e059>=_0xf45b0e){_0x19e059=_0xf45b0e;_0x59aa7f=0xc8;}else{_0x59aa7f=0xce;}_0x432d64[_0x2471('0x2b')](_0x59aa7f);return _0x432d64[_0x2471('0x31')](_0x2471('0x32'),_0x3cd6dc+'-'+_0x19e059+'/'+_0xf45b0e)[_0x2471('0x2c')](_0x1cac15);}return null;};}function patchUpdates(_0x3ad26c){return function(_0x476182){try{jsonpatch[_0x2471('0x33')](_0x476182,_0x3ad26c,!![]);}catch(_0x1012f2){return BPromise[_0x2471('0x34')](_0x1012f2);}return _0x476182[_0x2471('0x35')]();};}function saveUpdates(_0x2373ae,_0x536448){return function(_0x15a715){if(_0x15a715){return _0x15a715[_0x2471('0x36')](_0x2373ae)[_0x2471('0x1e')](function(_0x17506a){return _0x17506a;});}return null;};}function removeEntity(_0x23a6fe,_0x1dbdb3){return function(_0x1bec9b){if(_0x1bec9b){return _0x1bec9b[_0x2471('0x37')]()['then'](function(){var _0x3f31a0=_0x1bec9b[_0x2471('0x38')]({'plain':!![]});var _0x399acf=_0x2471('0x39');return db[_0x2471('0x3a')][_0x2471('0x37')]({'where':{'type':_0x399acf,'resourceId':_0x3f31a0['id']}})[_0x2471('0x1e')](function(){return _0x1bec9b;});})[_0x2471('0x1e')](function(){_0x23a6fe[_0x2471('0x2b')](0xcc)[_0x2471('0x2a')]();});}};}function handleEntityNotFound(_0x5a1f07,_0x357912){return function(_0x12796f){if(!_0x12796f){_0x5a1f07[_0x2471('0x29')](0x194);}return _0x12796f;};}function handleError(_0x41bd5b,_0x4c3349){_0x4c3349=_0x4c3349||0x1f4;return function(_0x1ae27a){logger[_0x2471('0x24')](_0x1ae27a[_0x2471('0x3b')]);if(_0x1ae27a[_0x2471('0x3c')]){delete _0x1ae27a[_0x2471('0x3c')];}_0x41bd5b[_0x2471('0x2b')](_0x4c3349)[_0x2471('0x3d')](_0x1ae27a);};}exports['index']=function(_0x4c108d,_0x3a4ba6){var _0x595dc7={},_0x213dad={},_0x31c2e4={'count':0x0,'rows':[]};var _0x1e6a26=_[_0x2471('0x3e')](db[_0x2471('0x3f')][_0x2471('0x40')],function(_0x1d243e){return{'name':_0x1d243e[_0x2471('0x41')],'type':_0x1d243e[_0x2471('0x42')][_0x2471('0x43')]};});_0x213dad[_0x2471('0x44')]=_['map'](_0x1e6a26,_0x2471('0x3c'));_0x213dad['query']=_[_0x2471('0x45')](_0x4c108d[_0x2471('0x46')]);_0x213dad['filters']=_[_0x2471('0x47')](_0x213dad[_0x2471('0x44')],_0x213dad[_0x2471('0x46')]);_0x595dc7[_0x2471('0x48')]=_[_0x2471('0x47')](_0x213dad[_0x2471('0x44')],qs['fields'](_0x4c108d[_0x2471('0x46')][_0x2471('0x49')]));_0x595dc7[_0x2471('0x48')]=_0x595dc7[_0x2471('0x48')][_0x2471('0x4a')]?_0x595dc7[_0x2471('0x48')]:_0x213dad[_0x2471('0x44')];if(!_0x4c108d['query'][_0x2471('0x4b')](_0x2471('0x4c'))){_0x595dc7[_0x2471('0x2e')]=qs[_0x2471('0x2e')](_0x4c108d['query'][_0x2471('0x2e')]);_0x595dc7[_0x2471('0x2d')]=qs[_0x2471('0x2d')](_0x4c108d[_0x2471('0x46')][_0x2471('0x2d')]);}_0x595dc7['order']=qs['sort'](_0x4c108d[_0x2471('0x46')][_0x2471('0x4d')]);_0x595dc7[_0x2471('0x4e')]=qs[_0x2471('0x4f')](_[_0x2471('0x50')](_0x4c108d[_0x2471('0x46')],_0x213dad['filters']),_0x1e6a26);if(_0x4c108d[_0x2471('0x46')][_0x2471('0x51')]){_0x595dc7[_0x2471('0x4e')]=_['merge'](_0x595dc7['where'],{'$or':_[_0x2471('0x3e')](_0x1e6a26,function(_0x545b8d){if(_0x545b8d[_0x2471('0x42')]!==_0x2471('0x52')){var _0x33890b={};_0x33890b[_0x545b8d[_0x2471('0x3c')]]={'$like':'%'+_0x4c108d[_0x2471('0x46')][_0x2471('0x51')]+'%'};return _0x33890b;}})});}_0x595dc7=_[_0x2471('0x53')]({},_0x595dc7,_0x4c108d[_0x2471('0x54')]);var _0x23d599={'where':_0x595dc7['where']};return db[_0x2471('0x3f')][_0x2471('0x30')](_0x23d599)[_0x2471('0x1e')](function(_0x16cb68){_0x31c2e4[_0x2471('0x30')]=_0x16cb68;if(_0x4c108d['query'][_0x2471('0x55')]){_0x595dc7[_0x2471('0x56')]=[{'all':!![]}];}return db[_0x2471('0x3f')][_0x2471('0x57')](_0x595dc7);})['then'](function(_0x457f43){_0x31c2e4[_0x2471('0x58')]=_0x457f43;return _0x31c2e4;})[_0x2471('0x1e')](respondWithFilteredResult(_0x3a4ba6,_0x595dc7))[_0x2471('0x28')](handleError(_0x3a4ba6,null));};exports['show']=function(_0x4e9c3d,_0x5b81ec){var _0x4b483f={'raw':![],'where':{'id':_0x4e9c3d[_0x2471('0x59')]['id']}},_0x34055d={};_0x34055d[_0x2471('0x44')]=_[_0x2471('0x45')](db[_0x2471('0x3f')]['rawAttributes']);_0x34055d[_0x2471('0x46')]=_[_0x2471('0x45')](_0x4e9c3d[_0x2471('0x46')]);_0x34055d['filters']=_[_0x2471('0x47')](_0x34055d[_0x2471('0x44')],_0x34055d['query']);_0x4b483f['attributes']=_[_0x2471('0x47')](_0x34055d[_0x2471('0x44')],qs[_0x2471('0x49')](_0x4e9c3d[_0x2471('0x46')]['fields']));_0x4b483f['attributes']=_0x4b483f['attributes']['length']?_0x4b483f['attributes']:_0x34055d[_0x2471('0x44')];if(_0x4e9c3d[_0x2471('0x46')][_0x2471('0x55')]){_0x4b483f[_0x2471('0x56')]=[{'all':!![]}];}_0x4b483f=_[_0x2471('0x53')]({},_0x4b483f,_0x4e9c3d[_0x2471('0x54')]);return db[_0x2471('0x3f')][_0x2471('0x5a')](_0x4b483f)[_0x2471('0x1e')](handleEntityNotFound(_0x5b81ec,null))[_0x2471('0x1e')](respondWithResult(_0x5b81ec,null))[_0x2471('0x28')](handleError(_0x5b81ec,null));};exports[_0x2471('0x5b')]=function(_0x31da08,_0x441cf9,_0x366ab1){var _0x429301;return db[_0x2471('0x3f')]['create'](_0x31da08[_0x2471('0x5c')],{'raw':!![]})[_0x2471('0x1e')](function(_0x2e4cbf){_0x429301=_0x2e4cbf;return db['VoiceContext'][_0x2471('0x57')]({'raw':!![]});})['then'](function(_0x48614c){var _0x5af882=fs[_0x2471('0x5d')](path[_0x2471('0x5e')](config['root'],_0x2471('0x5f')),_0x2471('0x60'));var _0x2124d8=ejs[_0x2471('0x61')](_0x5af882,{'contexts':_0x48614c||[]});fs[_0x2471('0x62')](_0x2471('0x63'),_0x2124d8);})[_0x2471('0x1e')](function(){return respondWithRpcPromise(_0x2471('0x64'),_0x2471('0x5b'),{'module':_0x2471('0x65')});})['then'](function(){var _0x392428=_0x31da08[_0x2471('0x66')][_0x2471('0x38')]({'plain':!![]});if(!_0x392428)throw new Error(_0x2471('0x67'));if(_0x392428['role']===_0x2471('0x66')){var _0x56252d=_0x429301[_0x2471('0x38')]({'plain':!![]});return db[_0x2471('0x68')][_0x2471('0x5a')]({'where':{'name':_0x2471('0x39'),'userProfileId':_0x392428[_0x2471('0x69')]},'raw':!![]})[_0x2471('0x1e')](function(_0x226e20){if(_0x226e20&&_0x226e20['autoAssociation']===0x0){return db[_0x2471('0x3a')][_0x2471('0x5b')]({'name':_0x56252d[_0x2471('0x3c')],'resourceId':_0x56252d['id'],'type':_0x226e20[_0x2471('0x3c')],'sectionId':_0x226e20['id']},{})['then'](function(){return _0x429301;});}else{return _0x429301;}})['catch'](function(_0x4b7c5c){logger['error'](_0x2471('0x6a'),_0x4b7c5c);throw _0x4b7c5c;});}return _0x429301;})['then'](respondWithResult(_0x441cf9,0xc9))[_0x2471('0x28')](handleError(_0x441cf9,null));};exports['update']=function(_0x4818aa,_0x520723,_0x281945){var _0x476147;return db[_0x2471('0x3f')][_0x2471('0x5a')]({'where':{'id':_0x4818aa[_0x2471('0x59')]['id']}})[_0x2471('0x1e')](handleEntityNotFound(_0x520723,null))[_0x2471('0x1e')](saveUpdates(_0x4818aa[_0x2471('0x5c')],null))[_0x2471('0x1e')](function(_0xbc133a){if(_0xbc133a){_0x476147=_0xbc133a;return db[_0x2471('0x3f')][_0x2471('0x57')]({'raw':!![]});}})[_0x2471('0x1e')](function(_0x5e698d){var _0x1fc787=fs[_0x2471('0x5d')](path[_0x2471('0x5e')](config[_0x2471('0x6b')],_0x2471('0x5f')),_0x2471('0x60'));var _0x347eb9=ejs[_0x2471('0x61')](_0x1fc787,{'contexts':_0x5e698d||[]});fs[_0x2471('0x62')](_0x2471('0x63'),_0x347eb9);})[_0x2471('0x1e')](function(){return respondWithRpcPromise(_0x2471('0x64'),_0x2471('0x36'),{'module':_0x2471('0x65')});})[_0x2471('0x1e')](function(){return _0x476147;})['then'](respondWithResult(_0x520723,null))[_0x2471('0x28')](handleError(_0x520723,null));};exports[_0x2471('0x37')]=function(_0x38e05d,_0xf28be4,_0x4ebccd){var _0x1463fb;return db[_0x2471('0x3f')][_0x2471('0x5a')]({'where':{'id':_0x38e05d['params']['id']}})['then'](handleEntityNotFound(_0xf28be4,null))[_0x2471('0x1e')](removeEntity(_0xf28be4,null))['then'](function(){return db[_0x2471('0x3f')][_0x2471('0x57')]({'raw':!![]});})[_0x2471('0x1e')](function(_0x455059){var _0x25b532=fs['readFileSync'](path[_0x2471('0x5e')](config[_0x2471('0x6b')],'server/files/templates/context.ejs'),_0x2471('0x60'));var _0x6be612=ejs['render'](_0x25b532,{'contexts':_0x455059});fs[_0x2471('0x62')](_0x2471('0x63'),_0x6be612);return respondWithRpcPromise(_0x2471('0x64'),_0x2471('0x37'),{'module':'chan_sip.so'});})[_0x2471('0x28')](handleError(_0xf28be4,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index a5c768a..fe82ace 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 _0x9679=['voice_contexts','lodash','util','../../config/logger','moment','request-promise','rimraf','../../config/environment','./voiceContext.attributes','define','VoiceContext'];(function(_0x37115b,_0x1d0f0b){var _0xee794a=function(_0x3c9903){while(--_0x3c9903){_0x37115b['push'](_0x37115b['shift']());}};_0xee794a(++_0x1d0f0b);}(_0x9679,0x11f));var _0x9967=function(_0x39d513,_0x3b587f){_0x39d513=_0x39d513-0x0;var _0x2e5db9=_0x9679[_0x39d513];return _0x2e5db9;};'use strict';var _=require(_0x9967('0x0'));var util=require(_0x9967('0x1'));var logger=require(_0x9967('0x2'))('api');var moment=require(_0x9967('0x3'));var BPromise=require('bluebird');var rp=require(_0x9967('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9967('0x5'));var config=require(_0x9967('0x6'));var attributes=require(_0x9967('0x7'));module['exports']=function(_0x105c43,_0xb8b9a7){return _0x105c43[_0x9967('0x8')](_0x9967('0x9'),attributes,{'tableName':_0x9967('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xac85=['util','../../config/logger','api','moment','request-promise','path','rimraf','voice_contexts'];(function(_0x468be0,_0x50b945){var _0x3c71ec=function(_0x40ad7c){while(--_0x40ad7c){_0x468be0['push'](_0x468be0['shift']());}};_0x3c71ec(++_0x50b945);}(_0xac85,0x1e0));var _0x5ac8=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0xac85[_0x4b369d];return _0x571a98;};'use strict';var _=require('lodash');var util=require(_0x5ac8('0x0'));var logger=require(_0x5ac8('0x1'))(_0x5ac8('0x2'));var moment=require(_0x5ac8('0x3'));var BPromise=require('bluebird');var rp=require(_0x5ac8('0x4'));var fs=require('fs');var path=require(_0x5ac8('0x5'));var rimraf=require(_0x5ac8('0x6'));var config=require('../../config/environment');var attributes=require('./voiceContext.attributes');module['exports']=function(_0x3f2ff2,_0x304bc1){return _0x3f2ff2['define']('VoiceContext',attributes,{'tableName':_0x5ac8('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.rpc.js b/server/api/voiceContext/voiceContext.rpc.js index d65972a..259bb85 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 _0xafcb=['VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','VoiceContext,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xafcb,0xb6));var _0xbafc=function(_0x4e36c4,_0xad83ca){_0x4e36c4=_0x4e36c4-0x0;var _0x2d4280=_0xafcb[_0x4e36c4];return _0x2d4280;};'use strict';var _=require(_0xbafc('0x0'));var util=require(_0xbafc('0x1'));var moment=require(_0xbafc('0x2'));var BPromise=require(_0xbafc('0x3'));var rs=require(_0xbafc('0x4'));var fs=require('fs');var Redis=require(_0xbafc('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xbafc('0x6'));var logger=require(_0xbafc('0x7'))(_0xbafc('0x8'));var config=require(_0xbafc('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xbafc('0xa')][_0xbafc('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x645129,_0xe5e508,_0x498a11){return new BPromise(function(_0xa8c557,_0x1a86f5){return client[_0xbafc('0xc')](_0x645129,_0x498a11)['then'](function(_0x47ecdf){logger['info'](_0xbafc('0xd'),_0xe5e508,_0xbafc('0xe'));logger[_0xbafc('0xf')](_0xbafc('0x10'),_0xe5e508,_0xbafc('0xe'),JSON[_0xbafc('0x11')](_0x47ecdf));if(_0x47ecdf[_0xbafc('0x12')]){if(_0x47ecdf['error'][_0xbafc('0x13')]===0x1f4){logger[_0xbafc('0x12')](_0xbafc('0xd'),_0xe5e508,_0x47ecdf[_0xbafc('0x12')][_0xbafc('0x14')]);return _0x1a86f5(_0x47ecdf['error'][_0xbafc('0x14')]);}logger['error'](_0xbafc('0xd'),_0xe5e508,_0x47ecdf['error']['message']);return _0xa8c557(_0x47ecdf['error'][_0xbafc('0x14')]);}else{logger[_0xbafc('0x15')]('VoiceContext,\x20%s,\x20%s',_0xe5e508,_0xbafc('0xe'));_0xa8c557(_0x47ecdf['result'][_0xbafc('0x14')]);}})['catch'](function(_0x3d1307){logger['error'](_0xbafc('0xd'),_0xe5e508,_0x3d1307);_0x1a86f5(_0x3d1307);});});} \ No newline at end of file +var _0xae2b=['http','request','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','error','code','message','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client'];(function(_0x278e3c,_0x1c9cfd){var _0x3e2d9b=function(_0x34d928){while(--_0x34d928){_0x278e3c['push'](_0x278e3c['shift']());}};_0x3e2d9b(++_0x1c9cfd);}(_0xae2b,0xb3));var _0xbae2=function(_0x42714b,_0x3a5c87){_0x42714b=_0x42714b-0x0;var _0x56767e=_0xae2b[_0x42714b];return _0x56767e;};'use strict';var _=require(_0xbae2('0x0'));var util=require(_0xbae2('0x1'));var moment=require('moment');var BPromise=require(_0xbae2('0x2'));var rs=require(_0xbae2('0x3'));var fs=require('fs');var Redis=require(_0xbae2('0x4'));var db=require(_0xbae2('0x5'))['db'];var utils=require(_0xbae2('0x6'));var logger=require(_0xbae2('0x7'))('rpc');var config=require(_0xbae2('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xbae2('0x9')][_0xbae2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x18bc03,_0x4c0180,_0x4788c4){return new BPromise(function(_0x57f2ca,_0x54d696){return client[_0xbae2('0xb')](_0x18bc03,_0x4788c4)[_0xbae2('0xc')](function(_0x15c84a){logger[_0xbae2('0xd')](_0xbae2('0xe'),_0x4c0180,_0xbae2('0xf'));logger[_0xbae2('0x10')]('VoiceContext,\x20%s,\x20%s,\x20%s',_0x4c0180,'request\x20sent',JSON['stringify'](_0x15c84a));if(_0x15c84a[_0xbae2('0x11')]){if(_0x15c84a['error'][_0xbae2('0x12')]===0x1f4){logger[_0xbae2('0x11')](_0xbae2('0xe'),_0x4c0180,_0x15c84a['error'][_0xbae2('0x13')]);return _0x54d696(_0x15c84a[_0xbae2('0x11')]['message']);}logger[_0xbae2('0x11')](_0xbae2('0xe'),_0x4c0180,_0x15c84a[_0xbae2('0x11')][_0xbae2('0x13')]);return _0x57f2ca(_0x15c84a[_0xbae2('0x11')][_0xbae2('0x13')]);}else{logger[_0xbae2('0xd')]('VoiceContext,\x20%s,\x20%s',_0x4c0180,_0xbae2('0xf'));_0x57f2ca(_0x15c84a['result'][_0xbae2('0x13')]);}})[_0xbae2('0x14')](function(_0x4fdcb3){logger[_0xbae2('0x11')](_0xbae2('0xe'),_0x4c0180,_0x4fdcb3);_0x54d696(_0x4fdcb3);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index 4552092..91debeb 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 _0xcf62=['describe','/:id','show','post','create','put','update','destroy','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceDialReport.controller','isAuthenticated','get','/describe'];(function(_0x13e741,_0x5d3c24){var _0x3f8bb3=function(_0x4440a0){while(--_0x4440a0){_0x13e741['push'](_0x13e741['shift']());}};_0x3f8bb3(++_0x5d3c24);}(_0xcf62,0x71));var _0x2cf6=function(_0x68c979,_0x431cff){_0x68c979=_0x68c979-0x0;var _0x4f0001=_0xcf62[_0x68c979];return _0x4f0001;};'use strict';var multer=require(_0x2cf6('0x0'));var util=require(_0x2cf6('0x1'));var path=require('path');var timeout=require(_0x2cf6('0x2'));var express=require(_0x2cf6('0x3'));var router=express[_0x2cf6('0x4')]();var fs_extra=require(_0x2cf6('0x5'));var auth=require(_0x2cf6('0x6'));var interaction=require(_0x2cf6('0x7'));var config=require(_0x2cf6('0x8'));var controller=require(_0x2cf6('0x9'));router['get']('/',auth[_0x2cf6('0xa')](),controller['index']);router[_0x2cf6('0xb')](_0x2cf6('0xc'),auth[_0x2cf6('0xa')](),controller[_0x2cf6('0xd')]);router['get'](_0x2cf6('0xe'),auth[_0x2cf6('0xa')](),controller[_0x2cf6('0xf')]);router[_0x2cf6('0x10')]('/',auth[_0x2cf6('0xa')](),controller[_0x2cf6('0x11')]);router[_0x2cf6('0x12')](_0x2cf6('0xe'),auth[_0x2cf6('0xa')](),controller[_0x2cf6('0x13')]);router['delete'](_0x2cf6('0xe'),auth[_0x2cf6('0xa')](),controller[_0x2cf6('0x14')]);module['exports']=router; \ No newline at end of file +var _0xd235=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceDialReport.controller','get','isAuthenticated','describe','put','/:id','update','delete','destroy','exports','multer','util','path','Router'];(function(_0x5cc9ba,_0xfbf79e){var _0x430a5a=function(_0x5c7575){while(--_0x5c7575){_0x5cc9ba['push'](_0x5cc9ba['shift']());}};_0x430a5a(++_0xfbf79e);}(_0xd235,0x11c));var _0x5d23=function(_0x193d7a,_0x11ac1c){_0x193d7a=_0x193d7a-0x0;var _0x283da8=_0xd235[_0x193d7a];return _0x283da8;};'use strict';var multer=require(_0x5d23('0x0'));var util=require(_0x5d23('0x1'));var path=require(_0x5d23('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x5d23('0x3')]();var fs_extra=require(_0x5d23('0x4'));var auth=require(_0x5d23('0x5'));var interaction=require(_0x5d23('0x6'));var config=require(_0x5d23('0x7'));var controller=require(_0x5d23('0x8'));router[_0x5d23('0x9')]('/',auth[_0x5d23('0xa')](),controller['index']);router['get']('/describe',auth[_0x5d23('0xa')](),controller[_0x5d23('0xb')]);router[_0x5d23('0x9')]('/:id',auth[_0x5d23('0xa')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x5d23('0xc')](_0x5d23('0xd'),auth[_0x5d23('0xa')](),controller[_0x5d23('0xe')]);router[_0x5d23('0xf')](_0x5d23('0xd'),auth[_0x5d23('0xa')](),controller[_0x5d23('0x10')]);module[_0x5d23('0x11')]=router; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.attributes.js b/server/api/voiceDialReport/voiceDialReport.attributes.js index 6c9b119..f85ac41 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 _0x6aa7=['called,connect,complete','sequelize','STRING','INTEGER','DATE'];(function(_0x44fec9,_0x4dff90){var _0x11394f=function(_0x1723df){while(--_0x1723df){_0x44fec9['push'](_0x44fec9['shift']());}};_0x11394f(++_0x4dff90);}(_0x6aa7,0x178));var _0x76aa=function(_0x4fde0d,_0x157f1f){_0x4fde0d=_0x4fde0d-0x0;var _0x494d52=_0x6aa7[_0x4fde0d];return _0x494d52;};'use strict';var Sequelize=require(_0x76aa('0x0'));module['exports']={'privilege':{'type':Sequelize[_0x76aa('0x1')]},'channel':{'type':Sequelize[_0x76aa('0x1')]},'channelstate':{'type':Sequelize[_0x76aa('0x2')]},'channelstatedesc':{'type':Sequelize[_0x76aa('0x1')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x76aa('0x1')]},'connectedlinenum':{'type':Sequelize[_0x76aa('0x1')]},'connectedlinename':{'type':Sequelize[_0x76aa('0x1')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x76aa('0x1')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x76aa('0x2')]},'uniqueid':{'type':Sequelize[_0x76aa('0x1')]},'linkedid':{'type':Sequelize[_0x76aa('0x1')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0x76aa('0x2')]},'destchannelstatedesc':{'type':Sequelize[_0x76aa('0x1')]},'destcalleridnum':{'type':Sequelize[_0x76aa('0x1')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0x76aa('0x1')]},'destconnectedlinename':{'type':Sequelize[_0x76aa('0x1')]},'destlanguage':{'type':Sequelize[_0x76aa('0x1')]},'destaccountcode':{'type':Sequelize[_0x76aa('0x1')]},'destcontext':{'type':Sequelize[_0x76aa('0x1')]},'destexten':{'type':Sequelize[_0x76aa('0x1')]},'destpriority':{'type':Sequelize[_0x76aa('0x2')]},'destuniqueid':{'type':Sequelize[_0x76aa('0x1')]},'destlinkedid':{'type':Sequelize[_0x76aa('0x1')]},'dialstring':{'type':Sequelize[_0x76aa('0x1')]},'dialstatus':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0x76aa('0x3')]},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x76aa('0x3')]},'lastevent':{'type':Sequelize[_0x76aa('0x1')],'comment':_0x76aa('0x4')},'routeId':{'type':Sequelize[_0x76aa('0x2')]},'duration':{'type':Sequelize[_0x76aa('0x2')]},'holdtime':{'type':Sequelize['INTEGER']},'billableseconds':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x24ca=['STRING','INTEGER','DATE','called,connect,complete','sequelize'];(function(_0x2f9b61,_0x36a531){var _0x1e9c0a=function(_0xd5d459){while(--_0xd5d459){_0x2f9b61['push'](_0x2f9b61['shift']());}};_0x1e9c0a(++_0x36a531);}(_0x24ca,0x1bc));var _0xa24c=function(_0x51beba,_0x202d19){_0x51beba=_0x51beba-0x0;var _0x167ee0=_0x24ca[_0x51beba];return _0x167ee0;};'use strict';var Sequelize=require(_0xa24c('0x0'));module['exports']={'privilege':{'type':Sequelize[_0xa24c('0x1')]},'channel':{'type':Sequelize[_0xa24c('0x1')]},'channelstate':{'type':Sequelize[_0xa24c('0x2')]},'channelstatedesc':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xa24c('0x1')]},'calleridname':{'type':Sequelize[_0xa24c('0x1')]},'connectedlinenum':{'type':Sequelize[_0xa24c('0x1')]},'connectedlinename':{'type':Sequelize[_0xa24c('0x1')]},'language':{'type':Sequelize[_0xa24c('0x1')]},'accountcode':{'type':Sequelize[_0xa24c('0x1')]},'context':{'type':Sequelize[_0xa24c('0x1')]},'exten':{'type':Sequelize[_0xa24c('0x1')]},'priority':{'type':Sequelize[_0xa24c('0x2')]},'uniqueid':{'type':Sequelize[_0xa24c('0x1')]},'linkedid':{'type':Sequelize[_0xa24c('0x1')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0xa24c('0x2')]},'destchannelstatedesc':{'type':Sequelize[_0xa24c('0x1')]},'destcalleridnum':{'type':Sequelize[_0xa24c('0x1')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0xa24c('0x1')]},'destconnectedlinename':{'type':Sequelize[_0xa24c('0x1')]},'destlanguage':{'type':Sequelize[_0xa24c('0x1')]},'destaccountcode':{'type':Sequelize[_0xa24c('0x1')]},'destcontext':{'type':Sequelize[_0xa24c('0x1')]},'destexten':{'type':Sequelize[_0xa24c('0x1')]},'destpriority':{'type':Sequelize[_0xa24c('0x2')]},'destuniqueid':{'type':Sequelize[_0xa24c('0x1')]},'destlinkedid':{'type':Sequelize[_0xa24c('0x1')]},'dialstring':{'type':Sequelize['STRING']},'dialstatus':{'type':Sequelize[_0xa24c('0x1')]},'starttime':{'type':Sequelize[_0xa24c('0x3')]},'answertime':{'type':Sequelize[_0xa24c('0x3')]},'endtime':{'type':Sequelize[_0xa24c('0x3')]},'lastevent':{'type':Sequelize['STRING'],'comment':_0xa24c('0x4')},'routeId':{'type':Sequelize[_0xa24c('0x2')]},'duration':{'type':Sequelize[_0xa24c('0x2')]},'holdtime':{'type':Sequelize[_0xa24c('0x2')]},'billableseconds':{'type':Sequelize[_0xa24c('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.controller.js b/server/api/voiceDialReport/voiceDialReport.controller.js index 834d41c..d14702a 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 _0x6d9e=['keys','intersection','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','apply','save','update','then','destroy','error','stack','name','send','map','VoiceDialReport','fieldName','type','model','query','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params'];(function(_0x42b893,_0x4b1508){var _0x4bb1e7=function(_0x150c63){while(--_0x150c63){_0x42b893['push'](_0x42b893['shift']());}};_0x4bb1e7(++_0x4b1508);}(_0x6d9e,0x136));var _0xe6d9=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x6d9e[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require(_0xe6d9('0x0'));var rimraf=require(_0xe6d9('0x1'));var zipdir=require(_0xe6d9('0x2'));var jsonpatch=require(_0xe6d9('0x3'));var rp=require('request-promise');var moment=require(_0xe6d9('0x4'));var BPromise=require(_0xe6d9('0x5'));var Mustache=require(_0xe6d9('0x6'));var util=require(_0xe6d9('0x7'));var path=require(_0xe6d9('0x8'));var sox=require('sox');var csv=require(_0xe6d9('0x9'));var ejs=require(_0xe6d9('0xa'));var fs=require('fs');var fs_extra=require(_0xe6d9('0xb'));var _=require(_0xe6d9('0xc'));var squel=require(_0xe6d9('0xd'));var crypto=require(_0xe6d9('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xe6d9('0xf'));var toCsv=require(_0xe6d9('0x9'));var querystring=require(_0xe6d9('0x10'));var Papa=require(_0xe6d9('0x11'));var Redis=require('ioredis');var authService=require(_0xe6d9('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xe6d9('0x13'));var hardwareService=require(_0xe6d9('0x14'));var logger=require(_0xe6d9('0x15'))(_0xe6d9('0x16'));var utils=require(_0xe6d9('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xe6d9('0x18'));var db=require(_0xe6d9('0x19'))['db'];function respondWithStatusCode(_0xc84d34,_0x1baac7){_0x1baac7=_0x1baac7||0xcc;return function(_0x2c5819){if(_0x2c5819){return _0xc84d34[_0xe6d9('0x1a')](_0x1baac7);}return _0xc84d34['status'](_0x1baac7)[_0xe6d9('0x1b')]();};}function respondWithResult(_0x2aa33d,_0x1e84ac){_0x1e84ac=_0x1e84ac||0xc8;return function(_0x216a58){if(_0x216a58){return _0x2aa33d[_0xe6d9('0x1c')](_0x1e84ac)[_0xe6d9('0x1d')](_0x216a58);}};}function respondWithFilteredResult(_0x1ef2a5,_0x25f205){return function(_0x378649){if(_0x378649){var _0x3e9690=typeof _0x25f205[_0xe6d9('0x1e')]===_0xe6d9('0x1f')&&typeof _0x25f205[_0xe6d9('0x20')]===_0xe6d9('0x1f');var _0x39eece=_0x378649['count'];var _0x2d4127=_0x3e9690?0x0:_0x25f205[_0xe6d9('0x1e')];var _0x1886a3=_0x3e9690?_0x378649[_0xe6d9('0x21')]:_0x25f205['offset']+_0x25f205['limit'];var _0x25a282;if(_0x1886a3>=_0x39eece){_0x1886a3=_0x39eece;_0x25a282=0xc8;}else{_0x25a282=0xce;}_0x1ef2a5[_0xe6d9('0x1c')](_0x25a282);return _0x1ef2a5[_0xe6d9('0x22')]('Content-Range',_0x2d4127+'-'+_0x1886a3+'/'+_0x39eece)[_0xe6d9('0x1d')](_0x378649);}return null;};}function patchUpdates(_0x3fed41){return function(_0x5f2645){try{jsonpatch[_0xe6d9('0x23')](_0x5f2645,_0x3fed41,!![]);}catch(_0x1cc5ae){return BPromise['reject'](_0x1cc5ae);}return _0x5f2645[_0xe6d9('0x24')]();};}function saveUpdates(_0x56194c,_0x4fd3e4){return function(_0x496919){if(_0x496919){return _0x496919[_0xe6d9('0x25')](_0x56194c)[_0xe6d9('0x26')](function(_0x433ec1){return _0x433ec1;});}return null;};}function removeEntity(_0xf1698d,_0xf361fb){return function(_0x19915c){if(_0x19915c){return _0x19915c[_0xe6d9('0x27')]()[_0xe6d9('0x26')](function(){_0xf1698d['status'](0xcc)[_0xe6d9('0x1b')]();});}};}function handleEntityNotFound(_0x522bdf,_0x25d5c0){return function(_0x4d874d){if(!_0x4d874d){_0x522bdf['sendStatus'](0x194);}return _0x4d874d;};}function handleError(_0x53109d,_0x42aa48){_0x42aa48=_0x42aa48||0x1f4;return function(_0x9d9fab){logger[_0xe6d9('0x28')](_0x9d9fab[_0xe6d9('0x29')]);if(_0x9d9fab['name']){delete _0x9d9fab[_0xe6d9('0x2a')];}_0x53109d[_0xe6d9('0x1c')](_0x42aa48)[_0xe6d9('0x2b')](_0x9d9fab);};}exports['index']=function(_0x5f35f,_0x326c7f){var _0x572434={},_0x340b0d={},_0x5b5170={'count':0x0,'rows':[]};var _0x14bc2d=_[_0xe6d9('0x2c')](db[_0xe6d9('0x2d')]['rawAttributes'],function(_0x1de914){return{'name':_0x1de914[_0xe6d9('0x2e')],'type':_0x1de914[_0xe6d9('0x2f')]['key']};});_0x340b0d[_0xe6d9('0x30')]=_[_0xe6d9('0x2c')](_0x14bc2d,_0xe6d9('0x2a'));_0x340b0d[_0xe6d9('0x31')]=_['keys'](_0x5f35f[_0xe6d9('0x31')]);_0x340b0d[_0xe6d9('0x32')]=_['intersection'](_0x340b0d[_0xe6d9('0x30')],_0x340b0d['query']);_0x572434[_0xe6d9('0x33')]=_['intersection'](_0x340b0d[_0xe6d9('0x30')],qs[_0xe6d9('0x34')](_0x5f35f[_0xe6d9('0x31')][_0xe6d9('0x34')]));_0x572434[_0xe6d9('0x33')]=_0x572434[_0xe6d9('0x33')][_0xe6d9('0x35')]?_0x572434['attributes']:_0x340b0d[_0xe6d9('0x30')];if(!_0x5f35f[_0xe6d9('0x31')][_0xe6d9('0x36')](_0xe6d9('0x37'))){_0x572434[_0xe6d9('0x20')]=qs['limit'](_0x5f35f[_0xe6d9('0x31')][_0xe6d9('0x20')]);_0x572434[_0xe6d9('0x1e')]=qs[_0xe6d9('0x1e')](_0x5f35f[_0xe6d9('0x31')][_0xe6d9('0x1e')]);}_0x572434[_0xe6d9('0x38')]=qs[_0xe6d9('0x39')](_0x5f35f[_0xe6d9('0x31')][_0xe6d9('0x39')]);_0x572434[_0xe6d9('0x3a')]=qs[_0xe6d9('0x32')](_[_0xe6d9('0x3b')](_0x5f35f['query'],_0x340b0d[_0xe6d9('0x32')]),_0x14bc2d);if(_0x5f35f[_0xe6d9('0x31')][_0xe6d9('0x3c')]){_0x572434['where']=_[_0xe6d9('0x3d')](_0x572434[_0xe6d9('0x3a')],{'$or':_[_0xe6d9('0x2c')](_0x14bc2d,function(_0x213e4d){if(_0x213e4d[_0xe6d9('0x2f')]!==_0xe6d9('0x3e')){var _0x199af3={};_0x199af3[_0x213e4d[_0xe6d9('0x2a')]]={'$like':'%'+_0x5f35f[_0xe6d9('0x31')][_0xe6d9('0x3c')]+'%'};return _0x199af3;}})});}_0x572434=_['merge']({},_0x572434,_0x5f35f[_0xe6d9('0x3f')]);var _0x50c7f8={'where':_0x572434[_0xe6d9('0x3a')]};return db[_0xe6d9('0x2d')][_0xe6d9('0x21')](_0x50c7f8)[_0xe6d9('0x26')](function(_0xaed623){_0x5b5170[_0xe6d9('0x21')]=_0xaed623;if(_0x5f35f[_0xe6d9('0x31')][_0xe6d9('0x40')]){_0x572434[_0xe6d9('0x41')]=[{'all':!![]}];}return db[_0xe6d9('0x2d')][_0xe6d9('0x42')](_0x572434);})['then'](function(_0x27dd45){_0x5b5170[_0xe6d9('0x43')]=_0x27dd45;return _0x5b5170;})['then'](respondWithFilteredResult(_0x326c7f,_0x572434))[_0xe6d9('0x44')](handleError(_0x326c7f,null));};exports['show']=function(_0x2eeb45,_0x167b02){var _0x393426={'raw':!![],'where':{'id':_0x2eeb45[_0xe6d9('0x45')]['id']}},_0x1b9469={};_0x1b9469[_0xe6d9('0x30')]=_[_0xe6d9('0x46')](db[_0xe6d9('0x2d')]['rawAttributes']);_0x1b9469[_0xe6d9('0x31')]=_[_0xe6d9('0x46')](_0x2eeb45[_0xe6d9('0x31')]);_0x1b9469[_0xe6d9('0x32')]=_[_0xe6d9('0x47')](_0x1b9469[_0xe6d9('0x30')],_0x1b9469[_0xe6d9('0x31')]);_0x393426[_0xe6d9('0x33')]=_[_0xe6d9('0x47')](_0x1b9469[_0xe6d9('0x30')],qs['fields'](_0x2eeb45['query'][_0xe6d9('0x34')]));_0x393426['attributes']=_0x393426['attributes'][_0xe6d9('0x35')]?_0x393426['attributes']:_0x1b9469[_0xe6d9('0x30')];if(_0x2eeb45['query'][_0xe6d9('0x40')]){_0x393426[_0xe6d9('0x41')]=[{'all':!![]}];}_0x393426=_['merge']({},_0x393426,_0x2eeb45[_0xe6d9('0x3f')]);return db[_0xe6d9('0x2d')][_0xe6d9('0x48')](_0x393426)['then'](handleEntityNotFound(_0x167b02,null))[_0xe6d9('0x26')](respondWithResult(_0x167b02,null))['catch'](handleError(_0x167b02,null));};exports['create']=function(_0x2d9fde,_0x246616){return db['VoiceDialReport'][_0xe6d9('0x49')](_0x2d9fde[_0xe6d9('0x4a')],{})[_0xe6d9('0x26')](respondWithResult(_0x246616,0xc9))[_0xe6d9('0x44')](handleError(_0x246616,null));};exports[_0xe6d9('0x25')]=function(_0x263dd8,_0x1d1996){if(_0x263dd8[_0xe6d9('0x4a')]['id']){delete _0x263dd8['body']['id'];}return db['VoiceDialReport'][_0xe6d9('0x48')]({'where':{'id':_0x263dd8[_0xe6d9('0x45')]['id']}})[_0xe6d9('0x26')](handleEntityNotFound(_0x1d1996,null))[_0xe6d9('0x26')](saveUpdates(_0x263dd8[_0xe6d9('0x4a')],null))[_0xe6d9('0x26')](respondWithResult(_0x1d1996,null))[_0xe6d9('0x44')](handleError(_0x1d1996,null));};exports[_0xe6d9('0x27')]=function(_0x245459,_0x5c7259){return db[_0xe6d9('0x2d')]['find']({'where':{'id':_0x245459[_0xe6d9('0x45')]['id']}})['then'](handleEntityNotFound(_0x5c7259,null))[_0xe6d9('0x26')](removeEntity(_0x5c7259,null))['catch'](handleError(_0x5c7259,null));};exports['describe']=function(_0x255478,_0x51b4b6){return db[_0xe6d9('0x2d')][_0xe6d9('0x4b')]()[_0xe6d9('0x26')](respondWithResult(_0x51b4b6,null))[_0xe6d9('0x44')](handleError(_0x51b4b6,null));}; \ No newline at end of file +var _0xddee=['attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','map','VIRTUAL','VoiceDialReport','includeAll','include','catch','show','params','rawAttributes','find','body','eml-format','rimraf','fast-json-patch','request-promise','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','update','then','destroy','stack','name','send','index','fieldName','type','query','keys','filters','intersection','model'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xddee,0x139));var _0xedde=function(_0x1fdb40,_0x51351c){_0x1fdb40=_0x1fdb40-0x0;var _0x281f93=_0xddee[_0x1fdb40];return _0x281f93;};'use strict';var emlformat=require(_0xedde('0x0'));var rimraf=require(_0xedde('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xedde('0x2'));var rp=require(_0xedde('0x3'));var moment=require('moment');var BPromise=require(_0xedde('0x4'));var Mustache=require('mustache');var util=require(_0xedde('0x5'));var path=require(_0xedde('0x6'));var sox=require('sox');var csv=require(_0xedde('0x7'));var ejs=require(_0xedde('0x8'));var fs=require('fs');var fs_extra=require(_0xedde('0x9'));var _=require(_0xedde('0xa'));var squel=require(_0xedde('0xb'));var crypto=require(_0xedde('0xc'));var jsforce=require(_0xedde('0xd'));var deskjs=require(_0xedde('0xe'));var toCsv=require(_0xedde('0x7'));var querystring=require(_0xedde('0xf'));var Papa=require(_0xedde('0x10'));var Redis=require(_0xedde('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xedde('0x12'));var as=require(_0xedde('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xedde('0x14'))(_0xedde('0x15'));var utils=require(_0xedde('0x16'));var config=require(_0xedde('0x17'));var licenseUtil=require(_0xedde('0x18'));var db=require(_0xedde('0x19'))['db'];function respondWithStatusCode(_0x2f0e81,_0x2ff47c){_0x2ff47c=_0x2ff47c||0xcc;return function(_0xf0a1f){if(_0xf0a1f){return _0x2f0e81[_0xedde('0x1a')](_0x2ff47c);}return _0x2f0e81[_0xedde('0x1b')](_0x2ff47c)[_0xedde('0x1c')]();};}function respondWithResult(_0xd631f6,_0x3d7f12){_0x3d7f12=_0x3d7f12||0xc8;return function(_0x8649c0){if(_0x8649c0){return _0xd631f6[_0xedde('0x1b')](_0x3d7f12)[_0xedde('0x1d')](_0x8649c0);}};}function respondWithFilteredResult(_0x63fb62,_0x24d95c){return function(_0xf164ed){if(_0xf164ed){var _0x366348=typeof _0x24d95c['offset']===_0xedde('0x1e')&&typeof _0x24d95c[_0xedde('0x1f')]===_0xedde('0x1e');var _0x5f54c9=_0xf164ed[_0xedde('0x20')];var _0x2651a6=_0x366348?0x0:_0x24d95c[_0xedde('0x21')];var _0x2cc897=_0x366348?_0xf164ed[_0xedde('0x20')]:_0x24d95c[_0xedde('0x21')]+_0x24d95c['limit'];var _0x437d0c;if(_0x2cc897>=_0x5f54c9){_0x2cc897=_0x5f54c9;_0x437d0c=0xc8;}else{_0x437d0c=0xce;}_0x63fb62[_0xedde('0x1b')](_0x437d0c);return _0x63fb62[_0xedde('0x22')](_0xedde('0x23'),_0x2651a6+'-'+_0x2cc897+'/'+_0x5f54c9)[_0xedde('0x1d')](_0xf164ed);}return null;};}function patchUpdates(_0x5c2668){return function(_0x485bbd){try{jsonpatch[_0xedde('0x24')](_0x485bbd,_0x5c2668,!![]);}catch(_0x3ac45){return BPromise[_0xedde('0x25')](_0x3ac45);}return _0x485bbd['save']();};}function saveUpdates(_0x26c544,_0x26ec3e){return function(_0x2eed87){if(_0x2eed87){return _0x2eed87[_0xedde('0x26')](_0x26c544)[_0xedde('0x27')](function(_0x70699f){return _0x70699f;});}return null;};}function removeEntity(_0x25f105,_0x2bac46){return function(_0x19b5e3){if(_0x19b5e3){return _0x19b5e3[_0xedde('0x28')]()[_0xedde('0x27')](function(){_0x25f105[_0xedde('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x14669f,_0x3e9afe){return function(_0x2f3c21){if(!_0x2f3c21){_0x14669f[_0xedde('0x1a')](0x194);}return _0x2f3c21;};}function handleError(_0x8b2da,_0x24d4e6){_0x24d4e6=_0x24d4e6||0x1f4;return function(_0x9f6d03){logger['error'](_0x9f6d03[_0xedde('0x29')]);if(_0x9f6d03['name']){delete _0x9f6d03[_0xedde('0x2a')];}_0x8b2da[_0xedde('0x1b')](_0x24d4e6)[_0xedde('0x2b')](_0x9f6d03);};}exports[_0xedde('0x2c')]=function(_0x30afeb,_0x348548){var _0x377b13={},_0x440257={},_0x3a63f6={'count':0x0,'rows':[]};var _0x47a366=_['map'](db['VoiceDialReport']['rawAttributes'],function(_0x1264dd){return{'name':_0x1264dd[_0xedde('0x2d')],'type':_0x1264dd[_0xedde('0x2e')]['key']};});_0x440257['model']=_['map'](_0x47a366,_0xedde('0x2a'));_0x440257[_0xedde('0x2f')]=_[_0xedde('0x30')](_0x30afeb['query']);_0x440257[_0xedde('0x31')]=_[_0xedde('0x32')](_0x440257[_0xedde('0x33')],_0x440257[_0xedde('0x2f')]);_0x377b13[_0xedde('0x34')]=_[_0xedde('0x32')](_0x440257[_0xedde('0x33')],qs[_0xedde('0x35')](_0x30afeb[_0xedde('0x2f')][_0xedde('0x35')]));_0x377b13[_0xedde('0x34')]=_0x377b13[_0xedde('0x34')][_0xedde('0x36')]?_0x377b13['attributes']:_0x440257[_0xedde('0x33')];if(!_0x30afeb['query'][_0xedde('0x37')](_0xedde('0x38'))){_0x377b13['limit']=qs[_0xedde('0x1f')](_0x30afeb[_0xedde('0x2f')]['limit']);_0x377b13[_0xedde('0x21')]=qs[_0xedde('0x21')](_0x30afeb[_0xedde('0x2f')]['offset']);}_0x377b13[_0xedde('0x39')]=qs[_0xedde('0x3a')](_0x30afeb[_0xedde('0x2f')][_0xedde('0x3a')]);_0x377b13[_0xedde('0x3b')]=qs[_0xedde('0x31')](_[_0xedde('0x3c')](_0x30afeb[_0xedde('0x2f')],_0x440257[_0xedde('0x31')]),_0x47a366);if(_0x30afeb[_0xedde('0x2f')]['filter']){_0x377b13['where']=_[_0xedde('0x3d')](_0x377b13[_0xedde('0x3b')],{'$or':_[_0xedde('0x3e')](_0x47a366,function(_0x1e5c4a){if(_0x1e5c4a[_0xedde('0x2e')]!==_0xedde('0x3f')){var _0x1b2b9e={};_0x1b2b9e[_0x1e5c4a['name']]={'$like':'%'+_0x30afeb[_0xedde('0x2f')]['filter']+'%'};return _0x1b2b9e;}})});}_0x377b13=_[_0xedde('0x3d')]({},_0x377b13,_0x30afeb['options']);var _0x1664f1={'where':_0x377b13[_0xedde('0x3b')]};return db[_0xedde('0x40')]['count'](_0x1664f1)[_0xedde('0x27')](function(_0x442cb5){_0x3a63f6[_0xedde('0x20')]=_0x442cb5;if(_0x30afeb[_0xedde('0x2f')][_0xedde('0x41')]){_0x377b13[_0xedde('0x42')]=[{'all':!![]}];}return db['VoiceDialReport']['findAll'](_0x377b13);})[_0xedde('0x27')](function(_0xdadaa9){_0x3a63f6['rows']=_0xdadaa9;return _0x3a63f6;})[_0xedde('0x27')](respondWithFilteredResult(_0x348548,_0x377b13))[_0xedde('0x43')](handleError(_0x348548,null));};exports[_0xedde('0x44')]=function(_0x2a63a0,_0x13d33d){var _0x433c48={'raw':!![],'where':{'id':_0x2a63a0[_0xedde('0x45')]['id']}},_0x334ea2={};_0x334ea2['model']=_[_0xedde('0x30')](db[_0xedde('0x40')][_0xedde('0x46')]);_0x334ea2['query']=_[_0xedde('0x30')](_0x2a63a0[_0xedde('0x2f')]);_0x334ea2['filters']=_[_0xedde('0x32')](_0x334ea2[_0xedde('0x33')],_0x334ea2[_0xedde('0x2f')]);_0x433c48[_0xedde('0x34')]=_['intersection'](_0x334ea2[_0xedde('0x33')],qs['fields'](_0x2a63a0[_0xedde('0x2f')][_0xedde('0x35')]));_0x433c48[_0xedde('0x34')]=_0x433c48[_0xedde('0x34')][_0xedde('0x36')]?_0x433c48[_0xedde('0x34')]:_0x334ea2['model'];if(_0x2a63a0[_0xedde('0x2f')][_0xedde('0x41')]){_0x433c48['include']=[{'all':!![]}];}_0x433c48=_['merge']({},_0x433c48,_0x2a63a0['options']);return db['VoiceDialReport'][_0xedde('0x47')](_0x433c48)[_0xedde('0x27')](handleEntityNotFound(_0x13d33d,null))['then'](respondWithResult(_0x13d33d,null))['catch'](handleError(_0x13d33d,null));};exports['create']=function(_0x3181d6,_0x366545){return db[_0xedde('0x40')]['create'](_0x3181d6['body'],{})['then'](respondWithResult(_0x366545,0xc9))[_0xedde('0x43')](handleError(_0x366545,null));};exports['update']=function(_0xfbb66a,_0x2bebe2){if(_0xfbb66a[_0xedde('0x48')]['id']){delete _0xfbb66a[_0xedde('0x48')]['id'];}return db['VoiceDialReport']['find']({'where':{'id':_0xfbb66a[_0xedde('0x45')]['id']}})[_0xedde('0x27')](handleEntityNotFound(_0x2bebe2,null))[_0xedde('0x27')](saveUpdates(_0xfbb66a[_0xedde('0x48')],null))[_0xedde('0x27')](respondWithResult(_0x2bebe2,null))[_0xedde('0x43')](handleError(_0x2bebe2,null));};exports[_0xedde('0x28')]=function(_0x208f23,_0x51cccd){return db[_0xedde('0x40')]['find']({'where':{'id':_0x208f23[_0xedde('0x45')]['id']}})[_0xedde('0x27')](handleEntityNotFound(_0x51cccd,null))[_0xedde('0x27')](removeEntity(_0x51cccd,null))['catch'](handleError(_0x51cccd,null));};exports['describe']=function(_0x218240,_0xfb1a45){return db[_0xedde('0x40')]['describe']()['then'](respondWithResult(_0xfb1a45,null))[_0xedde('0x43')](handleError(_0xfb1a45,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index 881a183..45fa871 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 _0x6484=['uniqueid','util','../../config/logger','api','moment','request-promise','path','../../config/environment','./voiceDialReport.attributes','exports','define','VoiceDialReport','report_dial'];(function(_0x3485f8,_0x1b66cf){var _0x1fbba7=function(_0x135b73){while(--_0x135b73){_0x3485f8['push'](_0x3485f8['shift']());}};_0x1fbba7(++_0x1b66cf);}(_0x6484,0x1bb));var _0x4648=function(_0x1d9b2f,_0x302212){_0x1d9b2f=_0x1d9b2f-0x0;var _0xaca565=_0x6484[_0x1d9b2f];return _0xaca565;};'use strict';var _=require('lodash');var util=require(_0x4648('0x0'));var logger=require(_0x4648('0x1'))(_0x4648('0x2'));var moment=require(_0x4648('0x3'));var BPromise=require('bluebird');var rp=require(_0x4648('0x4'));var fs=require('fs');var path=require(_0x4648('0x5'));var rimraf=require('rimraf');var config=require(_0x4648('0x6'));var attributes=require(_0x4648('0x7'));module[_0x4648('0x8')]=function(_0x59a611,_0x85581e){return _0x59a611[_0x4648('0x9')](_0x4648('0xa'),attributes,{'tableName':_0x4648('0xb'),'paranoid':![],'indexes':[{'fields':[_0x4648('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9b75=['VoiceDialReport','report_dial','uniqueid','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./voiceDialReport.attributes','define'];(function(_0x4b6830,_0x2bf6fb){var _0x239e4a=function(_0x364735){while(--_0x364735){_0x4b6830['push'](_0x4b6830['shift']());}};_0x239e4a(++_0x2bf6fb);}(_0x9b75,0x1b5));var _0x59b7=function(_0x55d4eb,_0x5bfeeb){_0x55d4eb=_0x55d4eb-0x0;var _0x1d68a7=_0x9b75[_0x55d4eb];return _0x1d68a7;};'use strict';var _=require(_0x59b7('0x0'));var util=require(_0x59b7('0x1'));var logger=require(_0x59b7('0x2'))(_0x59b7('0x3'));var moment=require(_0x59b7('0x4'));var BPromise=require('bluebird');var rp=require(_0x59b7('0x5'));var fs=require('fs');var path=require(_0x59b7('0x6'));var rimraf=require(_0x59b7('0x7'));var config=require(_0x59b7('0x8'));var attributes=require(_0x59b7('0x9'));module['exports']=function(_0xc0eef7,_0x3b14ca){return _0xc0eef7[_0x59b7('0xa')](_0x59b7('0xb'),attributes,{'tableName':_0x59b7('0xc'),'paranoid':![],'indexes':[{'fields':[_0x59b7('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.rpc.js b/server/api/voiceDialReport/voiceDialReport.rpc.js index b3c6288..432d454 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 _0x1cbf=['catch','CreateVoiceDialReport','create','body','options','raw','debug','stringify','UpdateVoiceDialReport','VoiceDialReport','where','attributes','limit','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','then','info','request\x20sent','VoiceDialReport,\x20%s,\x20%s,\x20%s','error','VoiceDialReport,\x20%s,\x20%s','message'];(function(_0x5e9060,_0x46d2a2){var _0x5ba7cb=function(_0xe82280){while(--_0xe82280){_0x5e9060['push'](_0x5e9060['shift']());}};_0x5ba7cb(++_0x46d2a2);}(_0x1cbf,0xd8));var _0xf1cb=function(_0x5d3ba2,_0x45b47b){_0x5d3ba2=_0x5d3ba2-0x0;var _0x790c6d=_0x1cbf[_0x5d3ba2];return _0x790c6d;};'use strict';var _=require(_0xf1cb('0x0'));var util=require(_0xf1cb('0x1'));var moment=require(_0xf1cb('0x2'));var BPromise=require(_0xf1cb('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf1cb('0x4'));var db=require(_0xf1cb('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xf1cb('0x6'))('rpc');var config=require(_0xf1cb('0x7'));var jayson=require(_0xf1cb('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3675dc,_0x3cf191,_0xb18d19){return new BPromise(function(_0x62da2c,_0x5ad073){return client['request'](_0x3675dc,_0xb18d19)[_0xf1cb('0x9')](function(_0x1b92e0){logger[_0xf1cb('0xa')]('VoiceDialReport,\x20%s,\x20%s',_0x3cf191,_0xf1cb('0xb'));logger['debug'](_0xf1cb('0xc'),_0x3cf191,_0xf1cb('0xb'),JSON['stringify'](_0x1b92e0));if(_0x1b92e0[_0xf1cb('0xd')]){if(_0x1b92e0['error']['code']===0x1f4){logger[_0xf1cb('0xd')](_0xf1cb('0xe'),_0x3cf191,_0x1b92e0['error']['message']);return _0x5ad073(_0x1b92e0[_0xf1cb('0xd')]['message']);}logger[_0xf1cb('0xd')](_0xf1cb('0xe'),_0x3cf191,_0x1b92e0[_0xf1cb('0xd')][_0xf1cb('0xf')]);return _0x62da2c(_0x1b92e0[_0xf1cb('0xd')][_0xf1cb('0xf')]);}else{logger[_0xf1cb('0xa')](_0xf1cb('0xe'),_0x3cf191,_0xf1cb('0xb'));_0x62da2c(_0x1b92e0['result'][_0xf1cb('0xf')]);}})[_0xf1cb('0x10')](function(_0x2a764a){logger[_0xf1cb('0xd')]('VoiceDialReport,\x20%s,\x20%s',_0x3cf191,_0x2a764a);_0x5ad073(_0x2a764a);});});}exports[_0xf1cb('0x11')]=function(_0x4ee159){var _0x231fe8=this;return new Promise(function(_0x55e568,_0x820e4f){return db['VoiceDialReport'][_0xf1cb('0x12')](_0x4ee159[_0xf1cb('0x13')],{'raw':_0x4ee159[_0xf1cb('0x14')]?_0x4ee159[_0xf1cb('0x14')][_0xf1cb('0x15')]===undefined?!![]:![]:!![]})[_0xf1cb('0x9')](function(_0x4c33fe){logger[_0xf1cb('0xa')](_0xf1cb('0x11'),_0x4ee159);logger[_0xf1cb('0x16')](_0xf1cb('0x11'),_0x4ee159,JSON[_0xf1cb('0x17')](_0x4c33fe));_0x55e568(_0x4c33fe);})['catch'](function(_0x5efaba){logger['error'](_0xf1cb('0x11'),_0x5efaba[_0xf1cb('0xf')],_0x4ee159);_0x820e4f(_0x231fe8['error'](0x1f4,_0x5efaba[_0xf1cb('0xf')]));});});};exports[_0xf1cb('0x18')]=function(_0x126ab8){var _0x2aab7c=this;return new Promise(function(_0x20b09b,_0x69e44c){return db[_0xf1cb('0x19')]['update'](_0x126ab8[_0xf1cb('0x13')],{'raw':_0x126ab8[_0xf1cb('0x14')]?_0x126ab8[_0xf1cb('0x14')][_0xf1cb('0x15')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x126ab8[_0xf1cb('0x14')]?_0x126ab8['options'][_0xf1cb('0x1a')]||null:null,'attributes':_0x126ab8[_0xf1cb('0x14')]?_0x126ab8[_0xf1cb('0x14')][_0xf1cb('0x1b')]||null:null,'limit':_0x126ab8['options']?_0x126ab8[_0xf1cb('0x14')][_0xf1cb('0x1c')]||null:null})[_0xf1cb('0x9')](function(_0x236238){logger[_0xf1cb('0xa')](_0xf1cb('0x18'),_0x126ab8);logger[_0xf1cb('0x16')]('UpdateVoiceDialReport',_0x126ab8,JSON[_0xf1cb('0x17')](_0x236238));_0x20b09b(_0x236238);})[_0xf1cb('0x10')](function(_0x1e640d){logger[_0xf1cb('0xd')](_0xf1cb('0x18'),_0x1e640d[_0xf1cb('0xf')],_0x126ab8);_0x69e44c(_0x2aab7c[_0xf1cb('0xd')](0x1f4,_0x1e640d[_0xf1cb('0xf')]));});});}; \ No newline at end of file +var _0xd7aa=['UpdateVoiceDialReport','update','attributes','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','jayson/promise','client','http','request','then','info','VoiceDialReport,\x20%s,\x20%s','request\x20sent','VoiceDialReport,\x20%s,\x20%s,\x20%s','stringify','code','error','message','catch','VoiceDialReport','body','options','raw','CreateVoiceDialReport','debug'];(function(_0x2b10c6,_0x185590){var _0x3789d2=function(_0x272987){while(--_0x272987){_0x2b10c6['push'](_0x2b10c6['shift']());}};_0x3789d2(++_0x185590);}(_0xd7aa,0x108));var _0xad7a=function(_0x23be51,_0xc02a1b){_0x23be51=_0x23be51-0x0;var _0x47a26d=_0xd7aa[_0x23be51];return _0x47a26d;};'use strict';var _=require(_0xad7a('0x0'));var util=require('util');var moment=require(_0xad7a('0x1'));var BPromise=require('bluebird');var rs=require(_0xad7a('0x2'));var fs=require('fs');var Redis=require(_0xad7a('0x3'));var db=require(_0xad7a('0x4'))['db'];var utils=require(_0xad7a('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xad7a('0x6'));var client=jayson[_0xad7a('0x7')][_0xad7a('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x52a4d9,_0x3d1d8d,_0xa487a0){return new BPromise(function(_0x2a8568,_0x4c8f44){return client[_0xad7a('0x9')](_0x52a4d9,_0xa487a0)[_0xad7a('0xa')](function(_0x2be6ee){logger[_0xad7a('0xb')](_0xad7a('0xc'),_0x3d1d8d,_0xad7a('0xd'));logger['debug'](_0xad7a('0xe'),_0x3d1d8d,'request\x20sent',JSON[_0xad7a('0xf')](_0x2be6ee));if(_0x2be6ee['error']){if(_0x2be6ee['error'][_0xad7a('0x10')]===0x1f4){logger[_0xad7a('0x11')](_0xad7a('0xc'),_0x3d1d8d,_0x2be6ee[_0xad7a('0x11')][_0xad7a('0x12')]);return _0x4c8f44(_0x2be6ee['error']['message']);}logger[_0xad7a('0x11')](_0xad7a('0xc'),_0x3d1d8d,_0x2be6ee[_0xad7a('0x11')][_0xad7a('0x12')]);return _0x2a8568(_0x2be6ee[_0xad7a('0x11')][_0xad7a('0x12')]);}else{logger[_0xad7a('0xb')](_0xad7a('0xc'),_0x3d1d8d,_0xad7a('0xd'));_0x2a8568(_0x2be6ee['result'][_0xad7a('0x12')]);}})[_0xad7a('0x13')](function(_0x1892d9){logger['error'](_0xad7a('0xc'),_0x3d1d8d,_0x1892d9);_0x4c8f44(_0x1892d9);});});}exports['CreateVoiceDialReport']=function(_0x4ee0f7){var _0x477fc6=this;return new Promise(function(_0x32efd8,_0x3e3944){return db[_0xad7a('0x14')]['create'](_0x4ee0f7[_0xad7a('0x15')],{'raw':_0x4ee0f7[_0xad7a('0x16')]?_0x4ee0f7['options'][_0xad7a('0x17')]===undefined?!![]:![]:!![]})[_0xad7a('0xa')](function(_0x468452){logger[_0xad7a('0xb')](_0xad7a('0x18'),_0x4ee0f7);logger[_0xad7a('0x19')](_0xad7a('0x18'),_0x4ee0f7,JSON[_0xad7a('0xf')](_0x468452));_0x32efd8(_0x468452);})[_0xad7a('0x13')](function(_0x1d04ff){logger['error'](_0xad7a('0x18'),_0x1d04ff[_0xad7a('0x12')],_0x4ee0f7);_0x3e3944(_0x477fc6[_0xad7a('0x11')](0x1f4,_0x1d04ff['message']));});});};exports[_0xad7a('0x1a')]=function(_0xbeda8c){var _0x41a9fd=this;return new Promise(function(_0x3a2c57,_0x1c8deb){return db[_0xad7a('0x14')][_0xad7a('0x1b')](_0xbeda8c[_0xad7a('0x15')],{'raw':_0xbeda8c[_0xad7a('0x16')]?_0xbeda8c['options'][_0xad7a('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xbeda8c[_0xad7a('0x16')]?_0xbeda8c[_0xad7a('0x16')]['where']||null:null,'attributes':_0xbeda8c[_0xad7a('0x16')]?_0xbeda8c[_0xad7a('0x16')][_0xad7a('0x1c')]||null:null,'limit':_0xbeda8c['options']?_0xbeda8c[_0xad7a('0x16')]['limit']||null:null})['then'](function(_0x42834e){logger[_0xad7a('0xb')](_0xad7a('0x1a'),_0xbeda8c);logger[_0xad7a('0x19')](_0xad7a('0x1a'),_0xbeda8c,JSON[_0xad7a('0xf')](_0x42834e));_0x3a2c57(_0x42834e);})[_0xad7a('0x13')](function(_0x4d294c){logger[_0xad7a('0x11')]('UpdateVoiceDialReport',_0x4d294c[_0xad7a('0x12')],_0xbeda8c);_0x1c8deb(_0x41a9fd[_0xad7a('0x11')](0x1f4,_0x4d294c[_0xad7a('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index f839b0f..27bdf86 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 _0x26e0=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceExtension.controller','get','index','/:id','isAuthenticated','post','create','/:id/applications','put','delete','destroy','exports'];(function(_0x7729b1,_0x468322){var _0x349504=function(_0x401cee){while(--_0x401cee){_0x7729b1['push'](_0x7729b1['shift']());}};_0x349504(++_0x468322);}(_0x26e0,0x165));var _0x026e=function(_0x1762b4,_0x33d836){_0x1762b4=_0x1762b4-0x0;var _0x29beda=_0x26e0[_0x1762b4];return _0x29beda;};'use strict';var multer=require('multer');var util=require(_0x026e('0x0'));var path=require(_0x026e('0x1'));var timeout=require(_0x026e('0x2'));var express=require(_0x026e('0x3'));var router=express[_0x026e('0x4')]();var fs_extra=require(_0x026e('0x5'));var auth=require(_0x026e('0x6'));var interaction=require(_0x026e('0x7'));var config=require(_0x026e('0x8'));var controller=require(_0x026e('0x9'));router[_0x026e('0xa')]('/',auth['isAuthenticated'](),controller[_0x026e('0xb')]);router['get'](_0x026e('0xc'),auth[_0x026e('0xd')](),controller['show']);router[_0x026e('0xe')]('/',auth[_0x026e('0xd')](),controller[_0x026e('0xf')]);router[_0x026e('0xe')](_0x026e('0x10'),auth[_0x026e('0xd')](),controller['addApplications']);router[_0x026e('0x11')](_0x026e('0xc'),auth[_0x026e('0xd')](),controller['update']);router[_0x026e('0x12')](_0x026e('0xc'),auth[_0x026e('0xd')](),controller[_0x026e('0x13')]);module[_0x026e('0x14')]=router; \ No newline at end of file +var _0xd191=['get','/:id','post','create','/:id/applications','addApplications','put','update','delete','destroy','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceExtension.controller','isAuthenticated'];(function(_0x18afca,_0x4219d9){var _0x11603f=function(_0x21d5d1){while(--_0x21d5d1){_0x18afca['push'](_0x18afca['shift']());}};_0x11603f(++_0x4219d9);}(_0xd191,0x185));var _0x1d19=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd191[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0x1d19('0x0'));var path=require('path');var timeout=require(_0x1d19('0x1'));var express=require(_0x1d19('0x2'));var router=express[_0x1d19('0x3')]();var fs_extra=require(_0x1d19('0x4'));var auth=require(_0x1d19('0x5'));var interaction=require(_0x1d19('0x6'));var config=require(_0x1d19('0x7'));var controller=require(_0x1d19('0x8'));router['get']('/',auth[_0x1d19('0x9')](),controller['index']);router[_0x1d19('0xa')](_0x1d19('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x1d19('0xc')]('/',auth['isAuthenticated'](),controller[_0x1d19('0xd')]);router['post'](_0x1d19('0xe'),auth['isAuthenticated'](),controller[_0x1d19('0xf')]);router[_0x1d19('0x10')](_0x1d19('0xb'),auth[_0x1d19('0x9')](),controller[_0x1d19('0x11')]);router[_0x1d19('0x12')](_0x1d19('0xb'),auth['isAuthenticated'](),controller[_0x1d19('0x13')]);module[_0x1d19('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.attributes.js b/server/api/voiceExtension/voiceExtension.attributes.js index 87f5558..9946e95 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 _0x93a7=['inbound-fax','outbound-fax','system','any','*,*,*,*','INTEGER','BOOLEAN','wav','VIRTUAL','exten','sequelize','exports','STRING','compositeIndex','NoOp','ENUM','inbound','outbound','internal'];(function(_0xdd0313,_0x251c2b){var _0x2bd7e8=function(_0x340f1f){while(--_0x340f1f){_0xdd0313['push'](_0xdd0313['shift']());}};_0x2bd7e8(++_0x251c2b);}(_0x93a7,0x160));var _0x793a=function(_0x3968e9,_0x354905){_0x3968e9=_0x3968e9-0x0;var _0x45b100=_0x93a7[_0x3968e9];return _0x45b100;};'use strict';var Sequelize=require(_0x793a('0x0'));module[_0x793a('0x1')]={'context':{'type':Sequelize[_0x793a('0x2')],'allowNull':![],'unique':_0x793a('0x3'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0x793a('0x2')],'allowNull':![],'unique':_0x793a('0x3')},'priority':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'1','unique':_0x793a('0x3')},'tag':{'type':Sequelize[_0x793a('0x2')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0x793a('0x2')],'allowNull':![],'defaultValue':_0x793a('0x4')},'appdata':{'type':Sequelize[_0x793a('0x2')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0x793a('0x5')](_0x793a('0x6'),_0x793a('0x7'),_0x793a('0x8'),_0x793a('0x9'),_0x793a('0xa'),_0x793a('0xb'),_0x793a('0xc')),'allowNull':![]},'description':{'type':Sequelize[_0x793a('0x2')]},'interval':{'type':Sequelize[_0x793a('0x2')],'allowNull':![],'defaultValue':_0x793a('0xd')},'IntervalId':{'type':Sequelize[_0x793a('0xe')]},'isApp':{'type':Sequelize[_0x793a('0xf')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0x793a('0x2')],'defaultValue':null},'callerID':{'type':Sequelize[_0x793a('0x2')],'allowNull':!![]},'record':{'type':Sequelize[_0x793a('0xf')],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0x793a('0xe')]},'recordingFormat':{'type':Sequelize[_0x793a('0x2')],'defaultValue':_0x793a('0x10')},'answer':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'name':{'type':Sequelize[_0x793a('0x11')],'get':function(_0x32b643){return this['getDataValue'](_0x793a('0x12'));}},'alias':{'type':Sequelize[_0x793a('0x2')],'allowNull':!![]}}; \ No newline at end of file +var _0xa4a6=['internal','inbound-fax','outbound-fax','system','any','*,*,*,*','INTEGER','BOOLEAN','wav','VIRTUAL','getDataValue','sequelize','STRING','compositeIndex','NoOp','inbound'];(function(_0x10291b,_0x518773){var _0x1d5fbe=function(_0x24df58){while(--_0x24df58){_0x10291b['push'](_0x10291b['shift']());}};_0x1d5fbe(++_0x518773);}(_0xa4a6,0x17b));var _0x6a4a=function(_0x468076,_0x2d7b4e){_0x468076=_0x468076-0x0;var _0x24d8d8=_0xa4a6[_0x468076];return _0x24d8d8;};'use strict';var Sequelize=require(_0x6a4a('0x0'));module['exports']={'context':{'type':Sequelize[_0x6a4a('0x1')],'allowNull':![],'unique':_0x6a4a('0x2'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize['STRING'],'allowNull':![],'unique':'compositeIndex'},'priority':{'type':Sequelize[_0x6a4a('0x1')],'allowNull':![],'defaultValue':'1','unique':'compositeIndex'},'tag':{'type':Sequelize[_0x6a4a('0x1')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x6a4a('0x3')},'appdata':{'type':Sequelize[_0x6a4a('0x1')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize['ENUM'](_0x6a4a('0x4'),'outbound',_0x6a4a('0x5'),_0x6a4a('0x6'),_0x6a4a('0x7'),_0x6a4a('0x8'),_0x6a4a('0x9')),'allowNull':![]},'description':{'type':Sequelize[_0x6a4a('0x1')]},'interval':{'type':Sequelize[_0x6a4a('0x1')],'allowNull':![],'defaultValue':_0x6a4a('0xa')},'IntervalId':{'type':Sequelize[_0x6a4a('0xb')]},'isApp':{'type':Sequelize[_0x6a4a('0xc')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0x6a4a('0x1')],'defaultValue':null},'callerID':{'type':Sequelize['STRING'],'allowNull':!![]},'record':{'type':Sequelize[_0x6a4a('0xc')],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0x6a4a('0xb')]},'recordingFormat':{'type':Sequelize[_0x6a4a('0x1')],'defaultValue':_0x6a4a('0xd')},'answer':{'type':Sequelize[_0x6a4a('0xc')],'defaultValue':!![]},'name':{'type':Sequelize[_0x6a4a('0xe')],'get':function(_0x56adee){return this[_0x6a4a('0xf')]('exten');}},'alias':{'type':Sequelize[_0x6a4a('0x1')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.controller.js b/server/api/voiceExtension/voiceExtension.controller.js index 37327c0..a37f31a 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 _0x30cd=['desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','./voiceExtension.socket','sendStatus','status','json','offset','undefined','limit','set','apply','save','update','then','destroy','get','InboundRoutes','OutboundRoutes','outbound','InternalRoutes','internal','map','value','find','name','UserProfileResource','end','error','stack','send','index','VoiceExtension','rawAttributes','fieldName','type','key','query','keys','filters','model','intersection','fields','attributes','length','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','catch','show','params','startsWith','body','exten','concat','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','inbound','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','description','mandatoryDisposition','alias','addApplications','findOne','transaction','VoiceExtensionId','rewriteDial','toLowerCase','true','createRouting','bulkCreate','findAndCountAll','cast(priority\x20as\x20unsigned)','eml-format','rimraf','fast-json-patch','request-promise','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce'];(function(_0x14727e,_0x3e26bc){var _0x379f7b=function(_0x243b53){while(--_0x243b53){_0x14727e['push'](_0x14727e['shift']());}};_0x379f7b(++_0x3e26bc);}(_0x30cd,0x1a7));var _0xd30c=function(_0x749d4a,_0x57fc65){_0x749d4a=_0x749d4a-0x0;var _0x48453=_0x30cd[_0x749d4a];return _0x48453;};'use strict';var emlformat=require(_0xd30c('0x0'));var rimraf=require(_0xd30c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd30c('0x2'));var rp=require(_0xd30c('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xd30c('0x4'));var path=require(_0xd30c('0x5'));var sox=require(_0xd30c('0x6'));var csv=require(_0xd30c('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd30c('0x8'));var _=require(_0xd30c('0x9'));var squel=require(_0xd30c('0xa'));var crypto=require(_0xd30c('0xb'));var jsforce=require(_0xd30c('0xc'));var deskjs=require(_0xd30c('0xd'));var toCsv=require('to-csv');var querystring=require(_0xd30c('0xe'));var Papa=require(_0xd30c('0xf'));var Redis=require(_0xd30c('0x10'));var authService=require(_0xd30c('0x11'));var qs=require(_0xd30c('0x12'));var as=require(_0xd30c('0x13'));var hardwareService=require(_0xd30c('0x14'));var logger=require(_0xd30c('0x15'))('api');var utils=require(_0xd30c('0x16'));var config=require(_0xd30c('0x17'));var licenseUtil=require(_0xd30c('0x18'));var db=require(_0xd30c('0x19'))['db'];config[_0xd30c('0x1a')]=_['defaults'](config[_0xd30c('0x1a')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xd30c('0x1b'))['register'](socket);function respondWithStatusCode(_0x36ce13,_0x576b8d){_0x576b8d=_0x576b8d||0xcc;return function(_0x4473f8){if(_0x4473f8){return _0x36ce13[_0xd30c('0x1c')](_0x576b8d);}return _0x36ce13[_0xd30c('0x1d')](_0x576b8d)['end']();};}function respondWithResult(_0x17c825,_0x297eaf){_0x297eaf=_0x297eaf||0xc8;return function(_0x328522){if(_0x328522){return _0x17c825['status'](_0x297eaf)[_0xd30c('0x1e')](_0x328522);}};}function respondWithFilteredResult(_0x3d00db,_0x2b2c61){return function(_0x16c1a6){if(_0x16c1a6){var _0x1dcb41=typeof _0x2b2c61[_0xd30c('0x1f')]===_0xd30c('0x20')&&typeof _0x2b2c61['limit']===_0xd30c('0x20');var _0x36d69c=_0x16c1a6['count'];var _0x143c17=_0x1dcb41?0x0:_0x2b2c61[_0xd30c('0x1f')];var _0x2e5128=_0x1dcb41?_0x16c1a6['count']:_0x2b2c61[_0xd30c('0x1f')]+_0x2b2c61[_0xd30c('0x21')];var _0x3b7ea1;if(_0x2e5128>=_0x36d69c){_0x2e5128=_0x36d69c;_0x3b7ea1=0xc8;}else{_0x3b7ea1=0xce;}_0x3d00db[_0xd30c('0x1d')](_0x3b7ea1);return _0x3d00db[_0xd30c('0x22')]('Content-Range',_0x143c17+'-'+_0x2e5128+'/'+_0x36d69c)['json'](_0x16c1a6);}return null;};}function patchUpdates(_0x1d6c95){return function(_0x19f0c8){try{jsonpatch[_0xd30c('0x23')](_0x19f0c8,_0x1d6c95,!![]);}catch(_0x1725e6){return BPromise['reject'](_0x1725e6);}return _0x19f0c8[_0xd30c('0x24')]();};}function saveUpdates(_0x5ad428,_0xcab2a0){return function(_0x166238){if(_0x166238){return _0x166238[_0xd30c('0x25')](_0x5ad428)[_0xd30c('0x26')](function(_0x3bfacb){return _0x3bfacb;});}return null;};}function removeEntity(_0x4ddc14,_0x1fffcb){return function(_0x514497){if(_0x514497){return _0x514497[_0xd30c('0x27')]()[_0xd30c('0x26')](function(){var _0x534b59=_0x514497[_0xd30c('0x28')]({'plain':!![]});var _0x4b45ed=[{'name':_0xd30c('0x29'),'value':'inbound','ignore':![]},{'name':_0xd30c('0x2a'),'value':_0xd30c('0x2b'),'ignore':![]},{'name':_0xd30c('0x2c'),'value':_0xd30c('0x2d'),'ignore':![]}];var _0x112049=_(_0x4b45ed)['filter']('ignore')[_0xd30c('0x2e')](_0xd30c('0x2f'))[_0xd30c('0x2f')]();if(_['includes'](_0x112049,_0x534b59['type'])){return;}var _0x5baf13=_[_0xd30c('0x30')](_0x4b45ed,[_0xd30c('0x2f'),_0x534b59['type']])[_0xd30c('0x31')];return db[_0xd30c('0x32')]['destroy']({'where':{'type':_0x5baf13,'resourceId':_0x534b59['id']}})[_0xd30c('0x26')](function(){return _0x514497;});})['then'](function(){_0x4ddc14[_0xd30c('0x1d')](0xcc)[_0xd30c('0x33')]();});}};}function handleEntityNotFound(_0x145862,_0x192b9c){return function(_0x5c5352){if(!_0x5c5352){_0x145862[_0xd30c('0x1c')](0x194);}return _0x5c5352;};}function handleError(_0x5daced,_0x5b8958){_0x5b8958=_0x5b8958||0x1f4;return function(_0x17fe90){logger[_0xd30c('0x34')](_0x17fe90[_0xd30c('0x35')]);if(_0x17fe90[_0xd30c('0x31')]){delete _0x17fe90['name'];}_0x5daced[_0xd30c('0x1d')](_0x5b8958)[_0xd30c('0x36')](_0x17fe90);};}exports[_0xd30c('0x37')]=function(_0x4beb6c,_0x50d15a){var _0xbe7849={},_0x2c230c={},_0x1e7b03={'count':0x0,'rows':[]};var _0x5f3943=_['map'](db[_0xd30c('0x38')][_0xd30c('0x39')],function(_0x5b8759){return{'name':_0x5b8759[_0xd30c('0x3a')],'type':_0x5b8759[_0xd30c('0x3b')][_0xd30c('0x3c')]};});_0x2c230c['model']=_[_0xd30c('0x2e')](_0x5f3943,_0xd30c('0x31'));_0x2c230c[_0xd30c('0x3d')]=_[_0xd30c('0x3e')](_0x4beb6c[_0xd30c('0x3d')]);_0x2c230c[_0xd30c('0x3f')]=_['intersection'](_0x2c230c[_0xd30c('0x40')],_0x2c230c[_0xd30c('0x3d')]);_0xbe7849['attributes']=_[_0xd30c('0x41')](_0x2c230c['model'],qs[_0xd30c('0x42')](_0x4beb6c[_0xd30c('0x3d')][_0xd30c('0x42')]));_0xbe7849[_0xd30c('0x43')]=_0xbe7849['attributes'][_0xd30c('0x44')]?_0xbe7849['attributes']:_0x2c230c[_0xd30c('0x40')];if(!_0x4beb6c['query']['hasOwnProperty']('nolimit')){_0xbe7849['limit']=qs['limit'](_0x4beb6c['query'][_0xd30c('0x21')]);_0xbe7849[_0xd30c('0x1f')]=qs['offset'](_0x4beb6c[_0xd30c('0x3d')][_0xd30c('0x1f')]);}_0xbe7849['order']=qs[_0xd30c('0x45')](_0x4beb6c[_0xd30c('0x3d')][_0xd30c('0x45')]);_0xbe7849[_0xd30c('0x46')]=qs[_0xd30c('0x3f')](_[_0xd30c('0x47')](_0x4beb6c['query'],_0x2c230c[_0xd30c('0x3f')]),_0x5f3943);if(_0x4beb6c[_0xd30c('0x3d')][_0xd30c('0x48')]){_0xbe7849[_0xd30c('0x46')]=_[_0xd30c('0x49')](_0xbe7849[_0xd30c('0x46')],{'$or':_[_0xd30c('0x2e')](_0x5f3943,function(_0x91d907){if(_0x91d907[_0xd30c('0x3b')]!==_0xd30c('0x4a')){var _0x258870={};_0x258870[_0x91d907['name']]={'$like':'%'+_0x4beb6c[_0xd30c('0x3d')][_0xd30c('0x48')]+'%'};return _0x258870;}})});}_0xbe7849=_[_0xd30c('0x49')]({},_0xbe7849,_0x4beb6c[_0xd30c('0x4b')]);var _0x1ce019={'where':_0xbe7849['where']};return db[_0xd30c('0x38')][_0xd30c('0x4c')](_0x1ce019)[_0xd30c('0x26')](function(_0x3bef2e){_0x1e7b03[_0xd30c('0x4c')]=_0x3bef2e;if(_0x4beb6c[_0xd30c('0x3d')][_0xd30c('0x4d')]){_0xbe7849[_0xd30c('0x4e')]=[{'all':!![]}];}return db['VoiceExtension'][_0xd30c('0x4f')](_0xbe7849);})[_0xd30c('0x26')](function(_0x392f0b){_0x1e7b03['rows']=_0x392f0b;return _0x1e7b03;})['then'](respondWithFilteredResult(_0x50d15a,_0xbe7849))[_0xd30c('0x50')](handleError(_0x50d15a,null));};exports[_0xd30c('0x51')]=function(_0x40e146,_0x50d5e2){var _0x5e57af={'raw':![],'where':{'id':_0x40e146[_0xd30c('0x52')]['id']}},_0x4fc2f9={};_0x4fc2f9['model']=_['keys'](db[_0xd30c('0x38')][_0xd30c('0x39')]);_0x4fc2f9['query']=_[_0xd30c('0x3e')](_0x40e146[_0xd30c('0x3d')]);_0x4fc2f9[_0xd30c('0x3f')]=_[_0xd30c('0x41')](_0x4fc2f9[_0xd30c('0x40')],_0x4fc2f9[_0xd30c('0x3d')]);_0x5e57af[_0xd30c('0x43')]=_[_0xd30c('0x41')](_0x4fc2f9[_0xd30c('0x40')],qs[_0xd30c('0x42')](_0x40e146[_0xd30c('0x3d')][_0xd30c('0x42')]));_0x5e57af[_0xd30c('0x43')]=_0x5e57af[_0xd30c('0x43')][_0xd30c('0x44')]?_0x5e57af[_0xd30c('0x43')]:_0x4fc2f9[_0xd30c('0x40')];if(_0x40e146[_0xd30c('0x3d')][_0xd30c('0x4d')]){_0x5e57af[_0xd30c('0x4e')]=[{'all':!![]}];}_0x5e57af=_[_0xd30c('0x49')]({},_0x5e57af,_0x40e146['options']);return db[_0xd30c('0x38')][_0xd30c('0x30')](_0x5e57af)['then'](handleEntityNotFound(_0x50d5e2,null))[_0xd30c('0x26')](respondWithResult(_0x50d5e2,null))[_0xd30c('0x50')](handleError(_0x50d5e2,null));};exports[_0xd30c('0x27')]=function(_0x43b3f1,_0x12567a){return db['VoiceExtension'][_0xd30c('0x30')]({'where':{'id':_0x43b3f1[_0xd30c('0x52')]['id']}})[_0xd30c('0x26')](handleEntityNotFound(_0x12567a,null))['then'](removeEntity(_0x12567a,null))[_0xd30c('0x50')](handleError(_0x12567a,null));};exports['create']=function(_0x364a96,_0x32745c){if(_0x364a96['body'][_0xd30c('0x3b')]===_0xd30c('0x2b')&&!_[_0xd30c('0x53')](_0x364a96[_0xd30c('0x54')][_0xd30c('0x55')],'_')){_0x364a96[_0xd30c('0x54')][_0xd30c('0x55')]='_'[_0xd30c('0x56')](_0x364a96[_0xd30c('0x54')][_0xd30c('0x55')]);}return db[_0xd30c('0x38')][_0xd30c('0x57')](_0x364a96[_0xd30c('0x54')],{'raw':![]})[_0xd30c('0x26')](function(_0x235559){var _0x260854=_0x364a96['user'][_0xd30c('0x28')]({'plain':!![]});if(!_0x260854)throw new Error(_0xd30c('0x58'));if(_0x260854[_0xd30c('0x59')]==='user'){var _0x125f0d=_0x235559[_0xd30c('0x28')]({'plain':!![]});var _0x178f96=[{'name':_0xd30c('0x29'),'value':_0xd30c('0x5a')},{'name':'OutboundRoutes','value':'outbound'},{'name':_0xd30c('0x2c'),'value':_0xd30c('0x2d')}];var _0x1ee01d=_['find'](_0x178f96,[_0xd30c('0x2f'),_0x125f0d[_0xd30c('0x3b')]])[_0xd30c('0x31')];return db['UserProfileSection'][_0xd30c('0x30')]({'where':{'name':_0x1ee01d,'userProfileId':_0x260854[_0xd30c('0x5b')]},'raw':!![]})[_0xd30c('0x26')](function(_0x1334f3){if(_0x1334f3&&_0x1334f3[_0xd30c('0x5c')]===0x0){return db[_0xd30c('0x32')]['create']({'name':_0x125f0d[_0xd30c('0x31')],'resourceId':_0x125f0d['id'],'type':_0x1334f3[_0xd30c('0x31')],'sectionId':_0x1334f3['id']},{})[_0xd30c('0x26')](function(){return _0x235559;});}else{return _0x235559;}})['catch'](function(_0x149b59){logger[_0xd30c('0x34')](_0xd30c('0x5d'),_0x149b59);throw _0x149b59;});}return _0x235559;})[_0xd30c('0x26')](respondWithResult(_0x32745c,0xc9))[_0xd30c('0x50')](handleError(_0x32745c,null));};exports[_0xd30c('0x25')]=function(_0x18afcf,_0x5906d0){if(_0x18afcf[_0xd30c('0x54')]['id']){delete _0x18afcf['body']['id'];}return db[_0xd30c('0x38')][_0xd30c('0x30')]({'where':{'id':_0x18afcf[_0xd30c('0x52')]['id']}})[_0xd30c('0x26')](handleEntityNotFound(_0x5906d0,null))[_0xd30c('0x26')](function(_0x598724){if(_0x598724){return db['VoiceExtension']['update'](_['pick'](_0x18afcf[_0xd30c('0x54')],['exten',_0xd30c('0x5e'),_0xd30c('0x5f'),'recordingFormat','cutdigits',_0xd30c('0x60'),_0xd30c('0x61')]),{'where':{'context':_0x598724[_0xd30c('0x5e')],'exten':_0x598724['exten']},'individualHooks':!![]})[_0xd30c('0x26')](function(_0x19d08f){return _0x19d08f;});}return null;})['then'](respondWithStatusCode(_0x5906d0,null))[_0xd30c('0x50')](handleError(_0x5906d0,null));};exports[_0xd30c('0x62')]=function(_0x370c49,_0x5a3d60){return db['VoiceExtension'][_0xd30c('0x63')]({'where':{'id':_0x370c49['params']['id']}})[_0xd30c('0x26')](function(_0x28ca15){if(_0x28ca15){return db['sequelize'][_0xd30c('0x64')](function(_0x482542){return db[_0xd30c('0x38')][_0xd30c('0x27')]({'where':{'VoiceExtensionId':_0x370c49['params']['id']},'transaction':_0x482542})[_0xd30c('0x26')](function(){var _0x28fd9a=_[_0xd30c('0x2e')](_0x370c49['body'],function(_0x332989){_0x332989[_0xd30c('0x65')]=_0x370c49[_0xd30c('0x52')]['id'];_0x332989['isApp']=!![];return _0x332989;});var _0x19eea4=_0x370c49[_0xd30c('0x3d')][_0xd30c('0x66')]&&_0x370c49[_0xd30c('0x3d')][_0xd30c('0x66')][_0xd30c('0x67')]()===_0xd30c('0x68')?!![]:![];return _0x28ca15[_0xd30c('0x69')](_0x28fd9a,_0x19eea4);})[_0xd30c('0x26')](function(_0x283ba9){return db[_0xd30c('0x38')][_0xd30c('0x6a')](_0x283ba9,{'transaction':_0x482542});});})['then'](function(){return db['VoiceExtension'][_0xd30c('0x6b')]({'where':{'isApp':!![],'VoiceExtensionId':_0x370c49[_0xd30c('0x52')]['id']},'order':_0xd30c('0x6c')});});}})[_0xd30c('0x26')](respondWithResult(_0x5a3d60,null))[_0xd30c('0x50')](handleError(_0x5a3d60,null));}; \ No newline at end of file +var _0xb406=['createRouting','findAndCountAll','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','register','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','get','InboundRoutes','inbound','OutboundRoutes','outbound','InternalRoutes','internal','filter','ignore','map','value','includes','type','find','name','UserProfileResource','destroy','then','sendStatus','error','stack','send','index','VoiceExtension','fieldName','key','model','keys','query','filters','intersection','attributes','fields','length','order','sort','where','pick','VIRTUAL','includeAll','findAll','rows','show','params','rawAttributes','include','merge','create','body','startsWith','exten','concat','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','description','mandatoryDisposition','context','addApplications','findOne','transaction','VoiceExtensionId','isApp','rewriteDial','toLowerCase','true'];(function(_0x18d2c,_0x376749){var _0x52c197=function(_0x23127c){while(--_0x23127c){_0x18d2c['push'](_0x18d2c['shift']());}};_0x52c197(++_0x376749);}(_0xb406,0x1c6));var _0x6b40=function(_0x4bbaf4,_0x41ffa9){_0x4bbaf4=_0x4bbaf4-0x0;var _0x19d486=_0xb406[_0x4bbaf4];return _0x19d486;};'use strict';var emlformat=require(_0x6b40('0x0'));var rimraf=require(_0x6b40('0x1'));var zipdir=require(_0x6b40('0x2'));var jsonpatch=require(_0x6b40('0x3'));var rp=require('request-promise');var moment=require(_0x6b40('0x4'));var BPromise=require(_0x6b40('0x5'));var Mustache=require(_0x6b40('0x6'));var util=require(_0x6b40('0x7'));var path=require('path');var sox=require(_0x6b40('0x8'));var csv=require(_0x6b40('0x9'));var ejs=require(_0x6b40('0xa'));var fs=require('fs');var fs_extra=require(_0x6b40('0xb'));var _=require(_0x6b40('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x6b40('0xd'));var deskjs=require(_0x6b40('0xe'));var toCsv=require(_0x6b40('0x9'));var querystring=require(_0x6b40('0xf'));var Papa=require(_0x6b40('0x10'));var Redis=require(_0x6b40('0x11'));var authService=require(_0x6b40('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6b40('0x13'));var logger=require(_0x6b40('0x14'))(_0x6b40('0x15'));var utils=require(_0x6b40('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x6b40('0x17'));var db=require(_0x6b40('0x18'))['db'];config[_0x6b40('0x19')]=_[_0x6b40('0x1a')](config[_0x6b40('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0x6b40('0x1b'))(new Redis(config[_0x6b40('0x19')]));require('./voiceExtension.socket')[_0x6b40('0x1c')](socket);function respondWithStatusCode(_0xa479af,_0x397a54){_0x397a54=_0x397a54||0xcc;return function(_0x7960f9){if(_0x7960f9){return _0xa479af['sendStatus'](_0x397a54);}return _0xa479af[_0x6b40('0x1d')](_0x397a54)[_0x6b40('0x1e')]();};}function respondWithResult(_0x3bc373,_0x1cc4f2){_0x1cc4f2=_0x1cc4f2||0xc8;return function(_0x2448f9){if(_0x2448f9){return _0x3bc373[_0x6b40('0x1d')](_0x1cc4f2)[_0x6b40('0x1f')](_0x2448f9);}};}function respondWithFilteredResult(_0x29c4bd,_0x142880){return function(_0x39dccf){if(_0x39dccf){var _0x2c26a4=typeof _0x142880[_0x6b40('0x20')]===_0x6b40('0x21')&&typeof _0x142880[_0x6b40('0x22')]===_0x6b40('0x21');var _0x334864=_0x39dccf['count'];var _0xd7054b=_0x2c26a4?0x0:_0x142880['offset'];var _0xc4d84=_0x2c26a4?_0x39dccf[_0x6b40('0x23')]:_0x142880[_0x6b40('0x20')]+_0x142880[_0x6b40('0x22')];var _0x373cd2;if(_0xc4d84>=_0x334864){_0xc4d84=_0x334864;_0x373cd2=0xc8;}else{_0x373cd2=0xce;}_0x29c4bd[_0x6b40('0x1d')](_0x373cd2);return _0x29c4bd[_0x6b40('0x24')](_0x6b40('0x25'),_0xd7054b+'-'+_0xc4d84+'/'+_0x334864)[_0x6b40('0x1f')](_0x39dccf);}return null;};}function patchUpdates(_0x1fd717){return function(_0x49cd48){try{jsonpatch[_0x6b40('0x26')](_0x49cd48,_0x1fd717,!![]);}catch(_0x3d9130){return BPromise['reject'](_0x3d9130);}return _0x49cd48[_0x6b40('0x27')]();};}function saveUpdates(_0x30de2b,_0x47d586){return function(_0x1b8c84){if(_0x1b8c84){return _0x1b8c84[_0x6b40('0x28')](_0x30de2b)['then'](function(_0x1e21cb){return _0x1e21cb;});}return null;};}function removeEntity(_0x4eced0,_0x23ced0){return function(_0x3d5f1a){if(_0x3d5f1a){return _0x3d5f1a['destroy']()['then'](function(){var _0x2ec08a=_0x3d5f1a[_0x6b40('0x29')]({'plain':!![]});var _0x32fd09=[{'name':_0x6b40('0x2a'),'value':_0x6b40('0x2b'),'ignore':![]},{'name':_0x6b40('0x2c'),'value':_0x6b40('0x2d'),'ignore':![]},{'name':_0x6b40('0x2e'),'value':_0x6b40('0x2f'),'ignore':![]}];var _0x2f1474=_(_0x32fd09)[_0x6b40('0x30')](_0x6b40('0x31'))[_0x6b40('0x32')]('value')[_0x6b40('0x33')]();if(_[_0x6b40('0x34')](_0x2f1474,_0x2ec08a[_0x6b40('0x35')])){return;}var _0x943ee9=_[_0x6b40('0x36')](_0x32fd09,[_0x6b40('0x33'),_0x2ec08a[_0x6b40('0x35')]])[_0x6b40('0x37')];return db[_0x6b40('0x38')][_0x6b40('0x39')]({'where':{'type':_0x943ee9,'resourceId':_0x2ec08a['id']}})['then'](function(){return _0x3d5f1a;});})[_0x6b40('0x3a')](function(){_0x4eced0[_0x6b40('0x1d')](0xcc)[_0x6b40('0x1e')]();});}};}function handleEntityNotFound(_0x5c9621,_0x5bb2f5){return function(_0x4fca98){if(!_0x4fca98){_0x5c9621[_0x6b40('0x3b')](0x194);}return _0x4fca98;};}function handleError(_0x3e22a3,_0x3d5aa5){_0x3d5aa5=_0x3d5aa5||0x1f4;return function(_0x4bb98c){logger[_0x6b40('0x3c')](_0x4bb98c[_0x6b40('0x3d')]);if(_0x4bb98c['name']){delete _0x4bb98c[_0x6b40('0x37')];}_0x3e22a3[_0x6b40('0x1d')](_0x3d5aa5)[_0x6b40('0x3e')](_0x4bb98c);};}exports[_0x6b40('0x3f')]=function(_0x5d38fd,_0x453e5c){var _0x3cf70a={},_0x396055={},_0xfb2727={'count':0x0,'rows':[]};var _0x56f7e=_['map'](db[_0x6b40('0x40')]['rawAttributes'],function(_0xdfb773){return{'name':_0xdfb773[_0x6b40('0x41')],'type':_0xdfb773['type'][_0x6b40('0x42')]};});_0x396055[_0x6b40('0x43')]=_[_0x6b40('0x32')](_0x56f7e,_0x6b40('0x37'));_0x396055['query']=_[_0x6b40('0x44')](_0x5d38fd[_0x6b40('0x45')]);_0x396055[_0x6b40('0x46')]=_[_0x6b40('0x47')](_0x396055['model'],_0x396055[_0x6b40('0x45')]);_0x3cf70a[_0x6b40('0x48')]=_[_0x6b40('0x47')](_0x396055[_0x6b40('0x43')],qs[_0x6b40('0x49')](_0x5d38fd[_0x6b40('0x45')][_0x6b40('0x49')]));_0x3cf70a['attributes']=_0x3cf70a[_0x6b40('0x48')][_0x6b40('0x4a')]?_0x3cf70a[_0x6b40('0x48')]:_0x396055[_0x6b40('0x43')];if(!_0x5d38fd[_0x6b40('0x45')]['hasOwnProperty']('nolimit')){_0x3cf70a['limit']=qs['limit'](_0x5d38fd[_0x6b40('0x45')][_0x6b40('0x22')]);_0x3cf70a[_0x6b40('0x20')]=qs[_0x6b40('0x20')](_0x5d38fd[_0x6b40('0x45')][_0x6b40('0x20')]);}_0x3cf70a[_0x6b40('0x4b')]=qs[_0x6b40('0x4c')](_0x5d38fd[_0x6b40('0x45')][_0x6b40('0x4c')]);_0x3cf70a[_0x6b40('0x4d')]=qs[_0x6b40('0x46')](_[_0x6b40('0x4e')](_0x5d38fd[_0x6b40('0x45')],_0x396055[_0x6b40('0x46')]),_0x56f7e);if(_0x5d38fd['query']['filter']){_0x3cf70a[_0x6b40('0x4d')]=_['merge'](_0x3cf70a[_0x6b40('0x4d')],{'$or':_[_0x6b40('0x32')](_0x56f7e,function(_0x478a48){if(_0x478a48[_0x6b40('0x35')]!==_0x6b40('0x4f')){var _0x1a6314={};_0x1a6314[_0x478a48[_0x6b40('0x37')]]={'$like':'%'+_0x5d38fd[_0x6b40('0x45')][_0x6b40('0x30')]+'%'};return _0x1a6314;}})});}_0x3cf70a=_['merge']({},_0x3cf70a,_0x5d38fd['options']);var _0x3ac8df={'where':_0x3cf70a[_0x6b40('0x4d')]};return db[_0x6b40('0x40')][_0x6b40('0x23')](_0x3ac8df)['then'](function(_0x3b9a43){_0xfb2727[_0x6b40('0x23')]=_0x3b9a43;if(_0x5d38fd['query'][_0x6b40('0x50')]){_0x3cf70a['include']=[{'all':!![]}];}return db[_0x6b40('0x40')][_0x6b40('0x51')](_0x3cf70a);})[_0x6b40('0x3a')](function(_0x5229c6){_0xfb2727[_0x6b40('0x52')]=_0x5229c6;return _0xfb2727;})[_0x6b40('0x3a')](respondWithFilteredResult(_0x453e5c,_0x3cf70a))['catch'](handleError(_0x453e5c,null));};exports[_0x6b40('0x53')]=function(_0x4b69f3,_0x42f366){var _0x1e838b={'raw':![],'where':{'id':_0x4b69f3[_0x6b40('0x54')]['id']}},_0x3390d6={};_0x3390d6[_0x6b40('0x43')]=_[_0x6b40('0x44')](db['VoiceExtension'][_0x6b40('0x55')]);_0x3390d6['query']=_[_0x6b40('0x44')](_0x4b69f3[_0x6b40('0x45')]);_0x3390d6[_0x6b40('0x46')]=_[_0x6b40('0x47')](_0x3390d6[_0x6b40('0x43')],_0x3390d6[_0x6b40('0x45')]);_0x1e838b[_0x6b40('0x48')]=_[_0x6b40('0x47')](_0x3390d6['model'],qs[_0x6b40('0x49')](_0x4b69f3['query']['fields']));_0x1e838b['attributes']=_0x1e838b[_0x6b40('0x48')][_0x6b40('0x4a')]?_0x1e838b[_0x6b40('0x48')]:_0x3390d6[_0x6b40('0x43')];if(_0x4b69f3[_0x6b40('0x45')][_0x6b40('0x50')]){_0x1e838b[_0x6b40('0x56')]=[{'all':!![]}];}_0x1e838b=_[_0x6b40('0x57')]({},_0x1e838b,_0x4b69f3['options']);return db['VoiceExtension']['find'](_0x1e838b)['then'](handleEntityNotFound(_0x42f366,null))[_0x6b40('0x3a')](respondWithResult(_0x42f366,null))['catch'](handleError(_0x42f366,null));};exports['destroy']=function(_0x4bc536,_0x458aa3){return db[_0x6b40('0x40')][_0x6b40('0x36')]({'where':{'id':_0x4bc536['params']['id']}})[_0x6b40('0x3a')](handleEntityNotFound(_0x458aa3,null))[_0x6b40('0x3a')](removeEntity(_0x458aa3,null))['catch'](handleError(_0x458aa3,null));};exports[_0x6b40('0x58')]=function(_0x277c89,_0x234df5){if(_0x277c89[_0x6b40('0x59')][_0x6b40('0x35')]==='outbound'&&!_[_0x6b40('0x5a')](_0x277c89[_0x6b40('0x59')][_0x6b40('0x5b')],'_')){_0x277c89[_0x6b40('0x59')][_0x6b40('0x5b')]='_'[_0x6b40('0x5c')](_0x277c89['body'][_0x6b40('0x5b')]);}return db[_0x6b40('0x40')][_0x6b40('0x58')](_0x277c89[_0x6b40('0x59')],{'raw':![]})[_0x6b40('0x3a')](function(_0x4d9afc){var _0x5ce4d8=_0x277c89['user'][_0x6b40('0x29')]({'plain':!![]});if(!_0x5ce4d8)throw new Error(_0x6b40('0x5d'));if(_0x5ce4d8['role']===_0x6b40('0x5e')){var _0x222633=_0x4d9afc[_0x6b40('0x29')]({'plain':!![]});var _0x39ec48=[{'name':_0x6b40('0x2a'),'value':_0x6b40('0x2b')},{'name':_0x6b40('0x2c'),'value':'outbound'},{'name':'InternalRoutes','value':'internal'}];var _0x3cce08=_[_0x6b40('0x36')](_0x39ec48,[_0x6b40('0x33'),_0x222633[_0x6b40('0x35')]])[_0x6b40('0x37')];return db[_0x6b40('0x5f')]['find']({'where':{'name':_0x3cce08,'userProfileId':_0x5ce4d8[_0x6b40('0x60')]},'raw':!![]})[_0x6b40('0x3a')](function(_0x1dc273){if(_0x1dc273&&_0x1dc273[_0x6b40('0x61')]===0x0){return db[_0x6b40('0x38')][_0x6b40('0x58')]({'name':_0x222633[_0x6b40('0x37')],'resourceId':_0x222633['id'],'type':_0x1dc273[_0x6b40('0x37')],'sectionId':_0x1dc273['id']},{})[_0x6b40('0x3a')](function(){return _0x4d9afc;});}else{return _0x4d9afc;}})[_0x6b40('0x62')](function(_0x3d4d58){logger['error'](_0x6b40('0x63'),_0x3d4d58);throw _0x3d4d58;});}return _0x4d9afc;})['then'](respondWithResult(_0x234df5,0xc9))[_0x6b40('0x62')](handleError(_0x234df5,null));};exports[_0x6b40('0x28')]=function(_0x2a7373,_0x1f7450){if(_0x2a7373[_0x6b40('0x59')]['id']){delete _0x2a7373['body']['id'];}return db[_0x6b40('0x40')][_0x6b40('0x36')]({'where':{'id':_0x2a7373[_0x6b40('0x54')]['id']}})[_0x6b40('0x3a')](handleEntityNotFound(_0x1f7450,null))['then'](function(_0x4f7a0d){if(_0x4f7a0d){return db[_0x6b40('0x40')][_0x6b40('0x28')](_[_0x6b40('0x4e')](_0x2a7373[_0x6b40('0x59')],[_0x6b40('0x5b'),'context',_0x6b40('0x64'),'recordingFormat','cutdigits',_0x6b40('0x65'),'alias']),{'where':{'context':_0x4f7a0d[_0x6b40('0x66')],'exten':_0x4f7a0d['exten']},'individualHooks':!![]})[_0x6b40('0x3a')](function(_0x355c2f){return _0x355c2f;});}return null;})['then'](respondWithStatusCode(_0x1f7450,null))[_0x6b40('0x62')](handleError(_0x1f7450,null));};exports[_0x6b40('0x67')]=function(_0x3c4402,_0x3441a6){return db[_0x6b40('0x40')][_0x6b40('0x68')]({'where':{'id':_0x3c4402[_0x6b40('0x54')]['id']}})[_0x6b40('0x3a')](function(_0x4b0905){if(_0x4b0905){return db['sequelize'][_0x6b40('0x69')](function(_0x43291f){return db['VoiceExtension'][_0x6b40('0x39')]({'where':{'VoiceExtensionId':_0x3c4402[_0x6b40('0x54')]['id']},'transaction':_0x43291f})[_0x6b40('0x3a')](function(){var _0x2493b4=_[_0x6b40('0x32')](_0x3c4402['body'],function(_0x34bcf6){_0x34bcf6[_0x6b40('0x6a')]=_0x3c4402[_0x6b40('0x54')]['id'];_0x34bcf6[_0x6b40('0x6b')]=!![];return _0x34bcf6;});var _0x1d810a=_0x3c4402[_0x6b40('0x45')]['rewriteDial']&&_0x3c4402[_0x6b40('0x45')][_0x6b40('0x6c')][_0x6b40('0x6d')]()===_0x6b40('0x6e')?!![]:![];return _0x4b0905[_0x6b40('0x6f')](_0x2493b4,_0x1d810a);})[_0x6b40('0x3a')](function(_0x12af7f){return db[_0x6b40('0x40')]['bulkCreate'](_0x12af7f,{'transaction':_0x43291f});});})[_0x6b40('0x3a')](function(){return db['VoiceExtension'][_0x6b40('0x70')]({'where':{'isApp':!![],'VoiceExtensionId':_0x3c4402[_0x6b40('0x54')]['id']},'order':'cast(priority\x20as\x20unsigned)'});});}})[_0x6b40('0x3a')](respondWithResult(_0x3441a6,null))[_0x6b40('0x62')](handleError(_0x3441a6,null));}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index f261786..b17c722 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 _0x8cc8=['VoiceExtension','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x146feb,_0x3159f0){var _0x5edb7e=function(_0x4ff67c){while(--_0x4ff67c){_0x146feb['push'](_0x146feb['shift']());}};_0x5edb7e(++_0x3159f0);}(_0x8cc8,0x1f3));var _0x88cc=function(_0x159dfe,_0x170d6a){_0x159dfe=_0x159dfe-0x0;var _0x56bc05=_0x8cc8[_0x159dfe];return _0x56bc05;};'use strict';var EventEmitter=require(_0x88cc('0x0'));var VoiceExtension=require('../../mysqldb')['db'][_0x88cc('0x1')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0x88cc('0x2')](0x0);var events={'afterCreate':_0x88cc('0x3'),'afterUpdate':_0x88cc('0x4'),'afterDestroy':_0x88cc('0x5')};function emitEvent(_0x2ed084){return function(_0x264b6f,_0x33d2d5,_0x356312){VoiceExtensionEvents[_0x88cc('0x6')](_0x2ed084+':'+_0x264b6f['id'],_0x264b6f);VoiceExtensionEvents[_0x88cc('0x6')](_0x2ed084,_0x264b6f);_0x356312(null);};}for(var e in events){if(events[_0x88cc('0x7')](e)){var event=events[e];VoiceExtension[_0x88cc('0x8')](e,emitEvent(event));}}module[_0x88cc('0x9')]=VoiceExtensionEvents; \ No newline at end of file +var _0xf86a=['update','remove','emit','hasOwnProperty','../../mysqldb','setMaxListeners','save'];(function(_0x48d1fc,_0x2a465d){var _0x2bdfb8=function(_0x33781c){while(--_0x33781c){_0x48d1fc['push'](_0x48d1fc['shift']());}};_0x2bdfb8(++_0x2a465d);}(_0xf86a,0x1d9));var _0xaf86=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xf86a[_0x19e35c];return _0x3e1fe8;};'use strict';var EventEmitter=require('events');var VoiceExtension=require(_0xaf86('0x0'))['db']['VoiceExtension'];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0xaf86('0x1')](0x0);var events={'afterCreate':_0xaf86('0x2'),'afterUpdate':_0xaf86('0x3'),'afterDestroy':_0xaf86('0x4')};function emitEvent(_0x4fd46b){return function(_0x29768b,_0xaf7a9c,_0x44e5dd){VoiceExtensionEvents[_0xaf86('0x5')](_0x4fd46b+':'+_0x29768b['id'],_0x29768b);VoiceExtensionEvents[_0xaf86('0x5')](_0x4fd46b,_0x29768b);_0x44e5dd(null);};}for(var e in events){if(events[_0xaf86('0x6')](e)){var event=events[e];VoiceExtension['hook'](e,emitEvent(event));}}module['exports']=VoiceExtensionEvents; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.model.js b/server/api/voiceExtension/voiceExtension.model.js index ffb423a..9fa3b1c 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 _0x256c=['ExecIf','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','callerID','Set(CALLERID(all)=','NoOp(No\x20number\x20available)','answer','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','appdata','priority','concat','last','catch','VoiceExtension','voice_extensions','models','type','CDR(type)=','exten','Set','NoOp','alias','CDR(routeAlias)=','No\x20alias\x20set','context','inbound','CDR(routeid)=','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','outbound','CDR(type)=outbound','cutdigits','${EXTEN}','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','hasOwnProperty','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','trunk','timeout','split','length','name','phone','param','prefix','${EXTEN:','SIP','join','options','indexOf','U(xcally-mixmonitor-context)','isEmpty','findAll','then','interval','*,*,*,*','IntervalId','map','filter','toLowerCase','tag','push','CDR(tag)=','intervals'];(function(_0xf04c6d,_0xe98786){var _0x4a804e=function(_0x431a0a){while(--_0x431a0a){_0xf04c6d['push'](_0xf04c6d['shift']());}};_0x4a804e(++_0xe98786);}(_0x256c,0x1a9));var _0xc256=function(_0x333539,_0x26a377){_0x333539=_0x333539-0x0;var _0x1b6b3a=_0x256c[_0x333539];return _0x1b6b3a;};'use strict';var util=require('util');var _=require('lodash');var attributes=require('./voiceExtension.attributes');module['exports']=function(_0x35f122){var _0x124b50=_0x35f122[_0xc256('0x0')];function _0x2fda71(_0x138928){var _0x3360cd=0x2;var _0x17abda=[{'type':_0x138928[_0xc256('0x1')],'app':'Set','appdata':_0xc256('0x2')+_0x138928[_0xc256('0x1')],'context':_0x138928['context'],'exten':_0x138928[_0xc256('0x3')],'priority':_0x3360cd++,'VoiceExtensionId':_0x138928['id']},{'type':_0x138928[_0xc256('0x1')],'app':_0x138928['alias']?_0xc256('0x4'):_0xc256('0x5'),'appdata':_0x138928[_0xc256('0x6')]?_0xc256('0x7')+_0x138928['alias']:_0xc256('0x8'),'context':_0x138928[_0xc256('0x9')],'exten':_0x138928['exten'],'priority':_0x3360cd++,'VoiceExtensionId':_0x138928['id']}];if(_0x138928[_0xc256('0x1')]===_0xc256('0xa')){_0x17abda['push']({'type':_0xc256('0xa'),'app':'Set','appdata':_0xc256('0xb')+_0x138928['id'],'context':_0x138928[_0xc256('0x9')],'exten':_0x138928['exten'],'priority':_0x3360cd++,'VoiceExtensionId':_0x138928['id']});}_0x17abda['push']({'type':_0x138928[_0xc256('0x1')],'app':_0xc256('0x4'),'appdata':_0xc256('0xc'),'context':_0x138928[_0xc256('0x9')],'exten':_0x138928['exten'],'priority':_0x3360cd++,'VoiceExtensionId':_0x138928['id']},{'type':_0x138928[_0xc256('0x1')],'app':_0xc256('0x4'),'appdata':_0xc256('0xd'),'context':_0x138928[_0xc256('0x9')],'exten':_0x138928[_0xc256('0x3')],'priority':_0x3360cd++,'VoiceExtensionId':_0x138928['id']},{'type':_0x138928[_0xc256('0x1')],'app':_0xc256('0x4'),'appdata':_0xc256('0xe'),'context':_0x138928[_0xc256('0x9')],'exten':_0x138928['exten'],'priority':_0x3360cd++,'VoiceExtensionId':_0x138928['id']});return _0x17abda;}function _0x53bff9(_0x445dc5){var _0x43989e=0x2;var _0x575ad7=[{'type':_0xc256('0xf'),'app':_0xc256('0x4'),'appdata':_0xc256('0x10'),'context':_0x445dc5[_0xc256('0x9')],'exten':_0x445dc5[_0xc256('0x3')],'priority':_0x43989e++,'VoiceExtensionId':_0x445dc5['id']},{'type':_0xc256('0xf'),'app':_0x445dc5['alias']?_0xc256('0x4'):_0xc256('0x5'),'appdata':_0x445dc5[_0xc256('0x6')]?_0xc256('0x7')+_0x445dc5[_0xc256('0x6')]:'No\x20alias\x20set','context':_0x445dc5['context'],'exten':_0x445dc5[_0xc256('0x3')],'priority':_0x43989e++,'VoiceExtensionId':_0x445dc5['id']},{'type':_0xc256('0xf'),'app':_0xc256('0x4'),'appdata':'CDR(destination)='+(_0x445dc5[_0xc256('0x11')]?'${EXTEN:'+_0x445dc5[_0xc256('0x11')]+'}':_0xc256('0x12')),'context':_0x445dc5[_0xc256('0x9')],'exten':_0x445dc5[_0xc256('0x3')],'priority':_0x43989e++,'VoiceExtensionId':_0x445dc5['id']},{'type':_0xc256('0xf'),'app':_0xc256('0x4'),'appdata':_0xc256('0xb')+_0x445dc5['id'],'context':_0x445dc5['context'],'exten':_0x445dc5[_0xc256('0x3')],'priority':_0x43989e++,'VoiceExtensionId':_0x445dc5['id']},{'type':_0xc256('0xf'),'app':'ExecIf','appdata':_0xc256('0x13')+(_0x43989e+0x2)+'):Goto('+(_0x43989e+0x1)+')','context':_0x445dc5['context'],'exten':_0x445dc5['exten'],'priority':_0x43989e++,'VoiceExtensionId':_0x445dc5['id']},{'type':'outbound','app':_0xc256('0x4'),'appdata':_0x445dc5['cutdigits']?_0xc256('0x14')+_0x445dc5[_0xc256('0x11')]+'}':_0xc256('0x15'),'context':_0x445dc5[_0xc256('0x9')],'exten':_0x445dc5[_0xc256('0x3')],'priority':_0x43989e++,'VoiceExtensionId':_0x445dc5['id']},{'type':'outbound','app':_0xc256('0x4'),'appdata':_0xc256('0xc'),'context':_0x445dc5[_0xc256('0x9')],'exten':_0x445dc5['exten'],'priority':_0x43989e++,'VoiceExtensionId':_0x445dc5['id']},{'type':_0xc256('0xf'),'app':'Set','appdata':_0xc256('0xd'),'context':_0x445dc5[_0xc256('0x9')],'exten':_0x445dc5[_0xc256('0x3')],'priority':_0x43989e++,'VoiceExtensionId':_0x445dc5['id']},{'type':'outbound','app':_0xc256('0x4'),'appdata':'MONITOR_OPTIONS=ab','context':_0x445dc5[_0xc256('0x9')],'exten':_0x445dc5[_0xc256('0x3')],'priority':_0x43989e++,'VoiceExtensionId':_0x445dc5['id']},{'type':'outbound','app':_0xc256('0x4'),'appdata':'outboundrouteid='+_0x445dc5['id'],'context':_0x445dc5[_0xc256('0x9')],'exten':_0x445dc5[_0xc256('0x3')],'priority':_0x43989e++,'VoiceExtensionId':_0x445dc5['id']}];if(_0x445dc5[_0xc256('0x16')]('recordingFormat')&&_0x445dc5[_0xc256('0x17')]!==_0xc256('0x18')){_0x575ad7['push']({'type':_0xc256('0xf'),'app':_0xc256('0x4'),'appdata':_0xc256('0x19'),'context':_0x445dc5[_0xc256('0x9')],'exten':_0x445dc5[_0xc256('0x3')],'priority':_0x43989e++,'VoiceExtensionId':_0x445dc5['id']},{'type':_0xc256('0xf'),'app':_0xc256('0x4'),'appdata':_0xc256('0x1a')+_0x445dc5['recordingFormat']||_0xc256('0x1b'),'context':_0x445dc5[_0xc256('0x9')],'exten':_0x445dc5[_0xc256('0x3')],'priority':_0x43989e++,'VoiceExtensionId':_0x445dc5['id']});}return _0x575ad7;}function _0x2d6eb8(_0x574f3b){var _0x26a760=[{'name':_0xc256('0x1c'),'param':0x0},{'name':_0xc256('0x1d'),'param':0x1},{'name':'options','param':0x2},{'name':'url','param':0x3}];var _0x6eafaa={};var _0x407251=_0x574f3b[_0xc256('0x1e')](',');var _0x8240a4=[];for(var _0x293412=0x0;_0x293412<_0x26a760[_0xc256('0x1f')];_0x293412++){switch(_0x26a760[_0x293412][_0xc256('0x20')]){case _0xc256('0x1c'):_0x6eafaa['trunk']=_0x407251[_0x26a760[_0x293412]['param']][_0xc256('0x1e')]('/')[0x1];_0x6eafaa[_0xc256('0x21')]=_0x407251[_0x26a760[_0x293412][_0xc256('0x22')]][_0xc256('0x1e')]('/')[0x2];_0x6eafaa[_0xc256('0x23')]=_0x6eafaa[_0xc256('0x21')]?_0x6eafaa[_0xc256('0x21')]['split']('$')[0x0]:undefined;_0x6eafaa[_0xc256('0x21')]=route['cutdigits']?(_0x6eafaa[_0xc256('0x23')]||'')+_0xc256('0x24')+route['cutdigits']+'}':(_0x6eafaa[_0xc256('0x23')]||'')+_0xc256('0x12');_0x8240a4[_0x26a760[_0x293412][_0xc256('0x22')]]=[_0xc256('0x25'),_0x6eafaa[_0xc256('0x1c')],_0x6eafaa[_0xc256('0x21')]][_0xc256('0x26')]('/');break;case'options':_0x6eafaa[_0xc256('0x27')]=_0x407251[_0x26a760[_0x293412][_0xc256('0x22')]];if(route[_0xc256('0x17')]!==_0xc256('0x18')){if(_0x6eafaa[_0xc256('0x27')][_0xc256('0x28')]('U(xcally-mixmonitor-context)')<0x0){_0x6eafaa[_0xc256('0x27')]+='U(xcally-mixmonitor-context)';}}else{_0x6eafaa[_0xc256('0x27')]=_0x6eafaa[_0xc256('0x27')]['replace'](_0xc256('0x29'),'');}_0x8240a4[_0x26a760[_0x293412][_0xc256('0x22')]]=_0x6eafaa[_0xc256('0x27')];break;default:_0x8240a4[_0x26a760[_0x293412][_0xc256('0x22')]]=_0x407251[_0x26a760[_0x293412][_0xc256('0x22')]];}}return _0x8240a4['join'](',');}function _0xac2390(_0x249b05,_0xb0a168,_0x9b0dd6,_0x28cf6a){return new Promise(function(_0x31f97d,_0x37b226){var _0x218436=[];if(_[_0xc256('0x2a')](_0xb0a168))return _0x31f97d(_0x218436);_0x124b50['Interval'][_0xc256('0x2b')]({'attributes':['id','interval','IntervalId'],'raw':!![]})[_0xc256('0x2c')](function(_0x69109b){for(var _0x438c8b=0x0,_0x372022=0x0;_0x438c8b<_0xb0a168[_0xc256('0x1f')];_0x438c8b++,_0x372022=0x0){var _0x3a5d31=_0xb0a168[_0x438c8b];var _0x3253f9=[];var _0x5a5bc2=[];if(_0x3a5d31[_0xc256('0x2d')]!==_0xc256('0x2e')){_0x3a5d31['intervals']=[_0x3a5d31[_0xc256('0x2d')]];}else{_0x3a5d31['intervals']=_0x3a5d31[_0xc256('0x2f')]?_[_0xc256('0x30')](_[_0xc256('0x31')](_0x69109b,{'IntervalId':_0x3a5d31[_0xc256('0x2f')]}),_0xc256('0x2d')):[];}_0x3a5d31[_0xc256('0x9')]=_0x249b05[_0xc256('0x9')];_0x3a5d31[_0xc256('0x3')]=_0x249b05['exten'];if(_0x3a5d31[_0xc256('0x1')])_0x3a5d31[_0xc256('0x1')]=_0x3a5d31[_0xc256('0x1')][_0xc256('0x32')]();if(_0x249b05[_0xc256('0x1')]===_0xc256('0xf')){if(_0x3a5d31[_0xc256('0x16')]('tag')&&_0x3a5d31[_0xc256('0x33')]&&_0x3a5d31[_0xc256('0x33')]!=='--'){_0x3253f9[_0xc256('0x34')]({'type':_0x3a5d31[_0xc256('0x1')][_0xc256('0x32')](),'app':_0xc256('0x4'),'appdata':_0xc256('0x35')+_0x3a5d31[_0xc256('0x33')],'context':_0x249b05[_0xc256('0x9')],'exten':_0x249b05[_0xc256('0x3')],'priority':_0x3a5d31[_0xc256('0x36')]['length']+_0x9b0dd6+_0x372022++,'VoiceExtensionId':_0x249b05['id']});}_0x3253f9['push']({'type':_0x3a5d31[_0xc256('0x1')][_0xc256('0x32')](),'app':_0xc256('0x37'),'appdata':_0xc256('0x38')+(_0x3a5d31[_0xc256('0x39')]?_0xc256('0x3a')+_0x3a5d31[_0xc256('0x39')]+')':_0xc256('0x3b')),'context':_0x249b05['context'],'exten':_0x249b05['exten'],'priority':_0x3a5d31[_0xc256('0x36')]['length']+_0x9b0dd6+_0x372022++,'VoiceExtensionId':_0x249b05['id']});}else{if(_0x3a5d31['hasOwnProperty'](_0xc256('0x3c'))){if(['queue',_0xc256('0x3d')][_0xc256('0x3e')](_0x3a5d31[_0xc256('0x3f')]['toLowerCase']())&&_0x3a5d31[_0xc256('0x40')]!==_0xc256('0x41')){if(_0x3a5d31[_0xc256('0x3c')]){_0x3253f9[_0xc256('0x34')]({'type':_0x3a5d31[_0xc256('0x1')][_0xc256('0x32')](),'app':_0xc256('0x37'),'appdata':_0xc256('0x42'),'context':_0x249b05[_0xc256('0x9')],'exten':_0x249b05[_0xc256('0x3')],'priority':_0x3a5d31['intervals'][_0xc256('0x1f')]+_0x9b0dd6+_0x372022++,'VoiceExtensionId':_0x249b05['id']});_0x3253f9[_0xc256('0x34')]({'type':_0x3a5d31[_0xc256('0x1')][_0xc256('0x32')](),'app':_0xc256('0x4'),'appdata':_0xc256('0x43'),'context':_0x249b05[_0xc256('0x9')],'exten':_0x249b05[_0xc256('0x3')],'priority':_0x3a5d31[_0xc256('0x36')]['length']+_0x9b0dd6+_0x372022++,'VoiceExtensionId':_0x249b05['id']});}else{_0x3253f9[_0xc256('0x34')]({'type':_0x3a5d31[_0xc256('0x1')][_0xc256('0x32')](),'app':_0xc256('0x37'),'appdata':_0xc256('0x44'),'context':_0x249b05[_0xc256('0x9')],'exten':_0x249b05[_0xc256('0x3')],'priority':_0x3a5d31[_0xc256('0x36')][_0xc256('0x1f')]+_0x9b0dd6+_0x372022++,'VoiceExtensionId':_0x249b05['id']});_0x3253f9[_0xc256('0x34')]({'type':_0x3a5d31[_0xc256('0x1')][_0xc256('0x32')](),'app':_0xc256('0x4'),'appdata':_0xc256('0x45'),'context':_0x249b05[_0xc256('0x9')],'exten':_0x249b05[_0xc256('0x3')],'priority':_0x3a5d31[_0xc256('0x36')][_0xc256('0x1f')]+_0x9b0dd6+_0x372022++,'VoiceExtensionId':_0x249b05['id']});}}}}for(var _0x687a5e=0x0;_0x687a5e<_0x3a5d31[_0xc256('0x36')]['length'];_0x687a5e++){var _0xc1933=_0x9b0dd6+_0x3a5d31[_0xc256('0x36')]['length'];var _0x7435f0=_0x687a5e===_0x3a5d31[_0xc256('0x36')][_0xc256('0x1f')]-0x1?_0x9b0dd6+_0x3253f9[_0xc256('0x1f')]+_0x5a5bc2[_0xc256('0x1f')]+0x2:_0x9b0dd6+_0x687a5e+0x1;_0x3253f9[_0xc256('0x46')](_0x687a5e,0x0,{'type':_0x249b05['type'],'app':'GotoIfTime','appdata':_0x3a5d31[_0xc256('0x36')][_0x687a5e]+'?'+_0x249b05['context']+',${EXTEN},'+_0xc1933+':'+_0x249b05[_0xc256('0x9')]+_0xc256('0x47')+_0x7435f0,'exten':_0x249b05['exten'],'context':_0x249b05['context'],'priority':_0x9b0dd6+_0x687a5e,'VoiceExtensionId':_0x249b05['id']});}if(_0x28cf6a&&_0x3a5d31[_0xc256('0x40')]===_0xc256('0x48'))_0x3a5d31['appdata']=_0x2d6eb8(_0x3a5d31[_0xc256('0x49')]);_0x3a5d31[_0xc256('0x4a')]=_0x3253f9[_0xc256('0x1f')]?_['last'](_0x3253f9)[_0xc256('0x4a')]+0x1:_0x9b0dd6;_0x218436=_[_0xc256('0x4b')](_0x218436,_0x3253f9,[_0x3a5d31],_0x5a5bc2);_0x9b0dd6=_[_0xc256('0x4c')](_0x218436)[_0xc256('0x4a')]+0x1;}return _0x31f97d(_0x218436);})[_0xc256('0x4d')](function(_0x4115ae){_0x37b226(_0x4115ae);});});}return _0x35f122['define'](_0xc256('0x4e'),attributes,{'tableName':_0xc256('0x4f'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x29e72b,_0x2df90f){var _0x25cdc0=this;var _0x35d49a=_0x25cdc0[_0xc256('0x1')]==='outbound'?_0x53bff9(_0x25cdc0):_0x2fda71(_0x25cdc0);return _0xac2390(_0x25cdc0,_0x29e72b,_[_0xc256('0x4c')](_0x35d49a)[_0xc256('0x4a')]+0x1,_0x2df90f)['then'](function(_0x271598){var _0x4e920f=_['concat'](_0x35d49a,_0x271598);_0x4e920f['push']({'type':_0x25cdc0[_0xc256('0x1')],'app':'Hangup','exten':_0x25cdc0['exten'],'context':_0x25cdc0[_0xc256('0x9')],'priority':_[_0xc256('0x4c')](_0x4e920f)[_0xc256('0x4a')]+0x1,'VoiceExtensionId':_0x25cdc0['id']});return _0x4e920f;});}}});}; \ No newline at end of file +var _0x2bd8=['map','toLowerCase','tag','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','callerID','answer','queue','playback','includes','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice',',${EXTEN},','appType','outboundDial','appdata','priority','last','concat','VoiceExtension','voice_extensions','Hangup','util','models','Set','type','context','exten','alias','NoOp','CDR(routeAlias)=','inbound','push','CDR(routeid)=','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','outbound','CDR(type)=outbound','CDR(destination)=','cutdigits','${EXTEN:','${EXTEN}','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','outboundrouteid=','hasOwnProperty','recordingFormat','none','wav','trunk','timeout','options','url','length','name','param','phone','prefix','split','SIP','join','indexOf','U(xcally-mixmonitor-context)','Interval','findAll','interval','then','intervals','IntervalId'];(function(_0x255ac0,_0x3f6645){var _0x437bf1=function(_0x5baff0){while(--_0x5baff0){_0x255ac0['push'](_0x255ac0['shift']());}};_0x437bf1(++_0x3f6645);}(_0x2bd8,0xaa));var _0x82bd=function(_0x14c7cb,_0xa665e5){_0x14c7cb=_0x14c7cb-0x0;var _0x37157d=_0x2bd8[_0x14c7cb];return _0x37157d;};'use strict';var util=require(_0x82bd('0x0'));var _=require('lodash');var attributes=require('./voiceExtension.attributes');module['exports']=function(_0x4eea99){var _0x1ad50f=_0x4eea99[_0x82bd('0x1')];function _0x2614f2(_0x3415ea){var _0x151c20=0x2;var _0x3b25d2=[{'type':_0x3415ea['type'],'app':_0x82bd('0x2'),'appdata':'CDR(type)='+_0x3415ea[_0x82bd('0x3')],'context':_0x3415ea[_0x82bd('0x4')],'exten':_0x3415ea[_0x82bd('0x5')],'priority':_0x151c20++,'VoiceExtensionId':_0x3415ea['id']},{'type':_0x3415ea[_0x82bd('0x3')],'app':_0x3415ea[_0x82bd('0x6')]?_0x82bd('0x2'):_0x82bd('0x7'),'appdata':_0x3415ea[_0x82bd('0x6')]?_0x82bd('0x8')+_0x3415ea[_0x82bd('0x6')]:'No\x20alias\x20set','context':_0x3415ea[_0x82bd('0x4')],'exten':_0x3415ea['exten'],'priority':_0x151c20++,'VoiceExtensionId':_0x3415ea['id']}];if(_0x3415ea[_0x82bd('0x3')]===_0x82bd('0x9')){_0x3b25d2[_0x82bd('0xa')]({'type':_0x82bd('0x9'),'app':_0x82bd('0x2'),'appdata':_0x82bd('0xb')+_0x3415ea['id'],'context':_0x3415ea[_0x82bd('0x4')],'exten':_0x3415ea[_0x82bd('0x5')],'priority':_0x151c20++,'VoiceExtensionId':_0x3415ea['id']});}_0x3b25d2[_0x82bd('0xa')]({'type':_0x3415ea[_0x82bd('0x3')],'app':'Set','appdata':_0x82bd('0xc'),'context':_0x3415ea[_0x82bd('0x4')],'exten':_0x3415ea[_0x82bd('0x5')],'priority':_0x151c20++,'VoiceExtensionId':_0x3415ea['id']},{'type':_0x3415ea[_0x82bd('0x3')],'app':_0x82bd('0x2'),'appdata':_0x82bd('0xd'),'context':_0x3415ea['context'],'exten':_0x3415ea[_0x82bd('0x5')],'priority':_0x151c20++,'VoiceExtensionId':_0x3415ea['id']},{'type':_0x3415ea[_0x82bd('0x3')],'app':'Set','appdata':_0x82bd('0xe'),'context':_0x3415ea[_0x82bd('0x4')],'exten':_0x3415ea[_0x82bd('0x5')],'priority':_0x151c20++,'VoiceExtensionId':_0x3415ea['id']});return _0x3b25d2;}function _0x4c93a6(_0x41c83c){var _0x21b31d=0x2;var _0x8584e7=[{'type':_0x82bd('0xf'),'app':_0x82bd('0x2'),'appdata':_0x82bd('0x10'),'context':_0x41c83c[_0x82bd('0x4')],'exten':_0x41c83c[_0x82bd('0x5')],'priority':_0x21b31d++,'VoiceExtensionId':_0x41c83c['id']},{'type':_0x82bd('0xf'),'app':_0x41c83c[_0x82bd('0x6')]?_0x82bd('0x2'):'NoOp','appdata':_0x41c83c[_0x82bd('0x6')]?_0x82bd('0x8')+_0x41c83c['alias']:'No\x20alias\x20set','context':_0x41c83c['context'],'exten':_0x41c83c[_0x82bd('0x5')],'priority':_0x21b31d++,'VoiceExtensionId':_0x41c83c['id']},{'type':_0x82bd('0xf'),'app':'Set','appdata':_0x82bd('0x11')+(_0x41c83c[_0x82bd('0x12')]?_0x82bd('0x13')+_0x41c83c[_0x82bd('0x12')]+'}':_0x82bd('0x14')),'context':_0x41c83c[_0x82bd('0x4')],'exten':_0x41c83c['exten'],'priority':_0x21b31d++,'VoiceExtensionId':_0x41c83c['id']},{'type':'outbound','app':_0x82bd('0x2'),'appdata':_0x82bd('0xb')+_0x41c83c['id'],'context':_0x41c83c[_0x82bd('0x4')],'exten':_0x41c83c[_0x82bd('0x5')],'priority':_0x21b31d++,'VoiceExtensionId':_0x41c83c['id']},{'type':_0x82bd('0xf'),'app':_0x82bd('0x15'),'appdata':_0x82bd('0x16')+(_0x21b31d+0x2)+_0x82bd('0x17')+(_0x21b31d+0x1)+')','context':_0x41c83c['context'],'exten':_0x41c83c[_0x82bd('0x5')],'priority':_0x21b31d++,'VoiceExtensionId':_0x41c83c['id']},{'type':_0x82bd('0xf'),'app':'Set','appdata':_0x41c83c['cutdigits']?'CDR(prefix)=${EXTEN:0:'+_0x41c83c[_0x82bd('0x12')]+'}':'CDR(prefix)=noprefix','context':_0x41c83c[_0x82bd('0x4')],'exten':_0x41c83c[_0x82bd('0x5')],'priority':_0x21b31d++,'VoiceExtensionId':_0x41c83c['id']},{'type':'outbound','app':_0x82bd('0x2'),'appdata':_0x82bd('0xc'),'context':_0x41c83c[_0x82bd('0x4')],'exten':_0x41c83c[_0x82bd('0x5')],'priority':_0x21b31d++,'VoiceExtensionId':_0x41c83c['id']},{'type':'outbound','app':_0x82bd('0x2'),'appdata':_0x82bd('0xd'),'context':_0x41c83c[_0x82bd('0x4')],'exten':_0x41c83c[_0x82bd('0x5')],'priority':_0x21b31d++,'VoiceExtensionId':_0x41c83c['id']},{'type':_0x82bd('0xf'),'app':_0x82bd('0x2'),'appdata':_0x82bd('0xe'),'context':_0x41c83c[_0x82bd('0x4')],'exten':_0x41c83c['exten'],'priority':_0x21b31d++,'VoiceExtensionId':_0x41c83c['id']},{'type':_0x82bd('0xf'),'app':_0x82bd('0x2'),'appdata':_0x82bd('0x18')+_0x41c83c['id'],'context':_0x41c83c['context'],'exten':_0x41c83c[_0x82bd('0x5')],'priority':_0x21b31d++,'VoiceExtensionId':_0x41c83c['id']}];if(_0x41c83c[_0x82bd('0x19')](_0x82bd('0x1a'))&&_0x41c83c[_0x82bd('0x1a')]!==_0x82bd('0x1b')){_0x8584e7['push']({'type':_0x82bd('0xf'),'app':_0x82bd('0x2'),'appdata':'_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','context':_0x41c83c['context'],'exten':_0x41c83c['exten'],'priority':_0x21b31d++,'VoiceExtensionId':_0x41c83c['id']},{'type':_0x82bd('0xf'),'app':'Set','appdata':'_XCALLY_MIXMONITOR_FORMAT='+_0x41c83c[_0x82bd('0x1a')]||_0x82bd('0x1c'),'context':_0x41c83c['context'],'exten':_0x41c83c[_0x82bd('0x5')],'priority':_0x21b31d++,'VoiceExtensionId':_0x41c83c['id']});}return _0x8584e7;}function _0x1b4a5d(_0x1fffbf){var _0x378752=[{'name':_0x82bd('0x1d'),'param':0x0},{'name':_0x82bd('0x1e'),'param':0x1},{'name':_0x82bd('0x1f'),'param':0x2},{'name':_0x82bd('0x20'),'param':0x3}];var _0x20419d={};var _0x4283e1=_0x1fffbf['split'](',');var _0x3eaabd=[];for(var _0x4c7bbc=0x0;_0x4c7bbc<_0x378752[_0x82bd('0x21')];_0x4c7bbc++){switch(_0x378752[_0x4c7bbc][_0x82bd('0x22')]){case'trunk':_0x20419d[_0x82bd('0x1d')]=_0x4283e1[_0x378752[_0x4c7bbc][_0x82bd('0x23')]]['split']('/')[0x1];_0x20419d[_0x82bd('0x24')]=_0x4283e1[_0x378752[_0x4c7bbc]['param']]['split']('/')[0x2];_0x20419d[_0x82bd('0x25')]=_0x20419d[_0x82bd('0x24')]?_0x20419d[_0x82bd('0x24')][_0x82bd('0x26')]('$')[0x0]:undefined;_0x20419d[_0x82bd('0x24')]=route[_0x82bd('0x12')]?(_0x20419d[_0x82bd('0x25')]||'')+'${EXTEN:'+route[_0x82bd('0x12')]+'}':(_0x20419d[_0x82bd('0x25')]||'')+_0x82bd('0x14');_0x3eaabd[_0x378752[_0x4c7bbc][_0x82bd('0x23')]]=[_0x82bd('0x27'),_0x20419d['trunk'],_0x20419d['phone']][_0x82bd('0x28')]('/');break;case _0x82bd('0x1f'):_0x20419d[_0x82bd('0x1f')]=_0x4283e1[_0x378752[_0x4c7bbc]['param']];if(route['recordingFormat']!==_0x82bd('0x1b')){if(_0x20419d[_0x82bd('0x1f')][_0x82bd('0x29')](_0x82bd('0x2a'))<0x0){_0x20419d[_0x82bd('0x1f')]+='U(xcally-mixmonitor-context)';}}else{_0x20419d[_0x82bd('0x1f')]=_0x20419d['options']['replace']('U(xcally-mixmonitor-context)','');}_0x3eaabd[_0x378752[_0x4c7bbc][_0x82bd('0x23')]]=_0x20419d[_0x82bd('0x1f')];break;default:_0x3eaabd[_0x378752[_0x4c7bbc][_0x82bd('0x23')]]=_0x4283e1[_0x378752[_0x4c7bbc][_0x82bd('0x23')]];}}return _0x3eaabd[_0x82bd('0x28')](',');}function _0x297c33(_0x58d0be,_0x5bed60,_0x64b279,_0x10af4c){return new Promise(function(_0x5bc3bc,_0x223f9e){var _0x1c13a9=[];if(_['isEmpty'](_0x5bed60))return _0x5bc3bc(_0x1c13a9);_0x1ad50f[_0x82bd('0x2b')][_0x82bd('0x2c')]({'attributes':['id',_0x82bd('0x2d'),'IntervalId'],'raw':!![]})[_0x82bd('0x2e')](function(_0x298f16){for(var _0x909262=0x0,_0x291b95=0x0;_0x909262<_0x5bed60[_0x82bd('0x21')];_0x909262++,_0x291b95=0x0){var _0x590de7=_0x5bed60[_0x909262];var _0x38f0d6=[];var _0x561cae=[];if(_0x590de7[_0x82bd('0x2d')]!=='*,*,*,*'){_0x590de7['intervals']=[_0x590de7['interval']];}else{_0x590de7[_0x82bd('0x2f')]=_0x590de7[_0x82bd('0x30')]?_[_0x82bd('0x31')](_['filter'](_0x298f16,{'IntervalId':_0x590de7[_0x82bd('0x30')]}),'interval'):[];}_0x590de7[_0x82bd('0x4')]=_0x58d0be[_0x82bd('0x4')];_0x590de7['exten']=_0x58d0be[_0x82bd('0x5')];if(_0x590de7[_0x82bd('0x3')])_0x590de7[_0x82bd('0x3')]=_0x590de7[_0x82bd('0x3')][_0x82bd('0x32')]();if(_0x58d0be[_0x82bd('0x3')]===_0x82bd('0xf')){if(_0x590de7[_0x82bd('0x19')](_0x82bd('0x33'))&&_0x590de7[_0x82bd('0x33')]&&_0x590de7[_0x82bd('0x33')]!=='--'){_0x38f0d6[_0x82bd('0xa')]({'type':_0x590de7['type'][_0x82bd('0x32')](),'app':'Set','appdata':'CDR(tag)='+_0x590de7[_0x82bd('0x33')],'context':_0x58d0be['context'],'exten':_0x58d0be[_0x82bd('0x5')],'priority':_0x590de7[_0x82bd('0x2f')][_0x82bd('0x21')]+_0x64b279+_0x291b95++,'VoiceExtensionId':_0x58d0be['id']});}_0x38f0d6['push']({'type':_0x590de7[_0x82bd('0x3')][_0x82bd('0x32')](),'app':_0x82bd('0x15'),'appdata':_0x82bd('0x34')+(_0x590de7[_0x82bd('0x35')]?'Set(CALLERID(all)='+_0x590de7[_0x82bd('0x35')]+')':'NoOp(No\x20number\x20available)'),'context':_0x58d0be[_0x82bd('0x4')],'exten':_0x58d0be[_0x82bd('0x5')],'priority':_0x590de7[_0x82bd('0x2f')][_0x82bd('0x21')]+_0x64b279+_0x291b95++,'VoiceExtensionId':_0x58d0be['id']});}else{if(_0x590de7['hasOwnProperty'](_0x82bd('0x36'))){if([_0x82bd('0x37'),_0x82bd('0x38')][_0x82bd('0x39')](_0x590de7['app'][_0x82bd('0x32')]())&&_0x590de7['appType']!==_0x82bd('0x3a')){if(_0x590de7[_0x82bd('0x36')]){_0x38f0d6[_0x82bd('0xa')]({'type':_0x590de7['type'][_0x82bd('0x32')](),'app':_0x82bd('0x15'),'appdata':_0x82bd('0x3b'),'context':_0x58d0be['context'],'exten':_0x58d0be[_0x82bd('0x5')],'priority':_0x590de7['intervals'][_0x82bd('0x21')]+_0x64b279+_0x291b95++,'VoiceExtensionId':_0x58d0be['id']});_0x38f0d6[_0x82bd('0xa')]({'type':_0x590de7['type'][_0x82bd('0x32')](),'app':_0x82bd('0x2'),'appdata':'XCALLY-MOTION-ANSWER=1','context':_0x58d0be['context'],'exten':_0x58d0be[_0x82bd('0x5')],'priority':_0x590de7[_0x82bd('0x2f')]['length']+_0x64b279+_0x291b95++,'VoiceExtensionId':_0x58d0be['id']});}else{_0x38f0d6['push']({'type':_0x590de7['type'][_0x82bd('0x32')](),'app':_0x82bd('0x15'),'appdata':_0x82bd('0x3c'),'context':_0x58d0be[_0x82bd('0x4')],'exten':_0x58d0be[_0x82bd('0x5')],'priority':_0x590de7['intervals'][_0x82bd('0x21')]+_0x64b279+_0x291b95++,'VoiceExtensionId':_0x58d0be['id']});_0x38f0d6['push']({'type':_0x590de7[_0x82bd('0x3')][_0x82bd('0x32')](),'app':_0x82bd('0x2'),'appdata':_0x82bd('0x3d'),'context':_0x58d0be[_0x82bd('0x4')],'exten':_0x58d0be[_0x82bd('0x5')],'priority':_0x590de7[_0x82bd('0x2f')][_0x82bd('0x21')]+_0x64b279+_0x291b95++,'VoiceExtensionId':_0x58d0be['id']});}}}}for(var _0x512eb2=0x0;_0x512eb2<_0x590de7[_0x82bd('0x2f')][_0x82bd('0x21')];_0x512eb2++){var _0xdf917f=_0x64b279+_0x590de7[_0x82bd('0x2f')][_0x82bd('0x21')];var _0x244d03=_0x512eb2===_0x590de7[_0x82bd('0x2f')]['length']-0x1?_0x64b279+_0x38f0d6[_0x82bd('0x21')]+_0x561cae[_0x82bd('0x21')]+0x2:_0x64b279+_0x512eb2+0x1;_0x38f0d6[_0x82bd('0x3e')](_0x512eb2,0x0,{'type':_0x58d0be['type'],'app':'GotoIfTime','appdata':_0x590de7[_0x82bd('0x2f')][_0x512eb2]+'?'+_0x58d0be[_0x82bd('0x4')]+_0x82bd('0x3f')+_0xdf917f+':'+_0x58d0be['context']+_0x82bd('0x3f')+_0x244d03,'exten':_0x58d0be['exten'],'context':_0x58d0be[_0x82bd('0x4')],'priority':_0x64b279+_0x512eb2,'VoiceExtensionId':_0x58d0be['id']});}if(_0x10af4c&&_0x590de7[_0x82bd('0x40')]===_0x82bd('0x41'))_0x590de7[_0x82bd('0x42')]=_0x1b4a5d(_0x590de7[_0x82bd('0x42')]);_0x590de7[_0x82bd('0x43')]=_0x38f0d6[_0x82bd('0x21')]?_[_0x82bd('0x44')](_0x38f0d6)[_0x82bd('0x43')]+0x1:_0x64b279;_0x1c13a9=_[_0x82bd('0x45')](_0x1c13a9,_0x38f0d6,[_0x590de7],_0x561cae);_0x64b279=_[_0x82bd('0x44')](_0x1c13a9)[_0x82bd('0x43')]+0x1;}return _0x5bc3bc(_0x1c13a9);})['catch'](function(_0x129219){_0x223f9e(_0x129219);});});}return _0x4eea99['define'](_0x82bd('0x46'),attributes,{'tableName':_0x82bd('0x47'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x416229,_0x7ea2a8){var _0x4cc134=this;var _0x3686d6=_0x4cc134[_0x82bd('0x3')]===_0x82bd('0xf')?_0x4c93a6(_0x4cc134):_0x2614f2(_0x4cc134);return _0x297c33(_0x4cc134,_0x416229,_[_0x82bd('0x44')](_0x3686d6)[_0x82bd('0x43')]+0x1,_0x7ea2a8)['then'](function(_0x562c64){var _0x1dbdd5=_['concat'](_0x3686d6,_0x562c64);_0x1dbdd5[_0x82bd('0xa')]({'type':_0x4cc134[_0x82bd('0x3')],'app':_0x82bd('0x48'),'exten':_0x4cc134[_0x82bd('0x5')],'context':_0x4cc134['context'],'priority':_[_0x82bd('0x44')](_0x1dbdd5)[_0x82bd('0x43')]+0x1,'VoiceExtensionId':_0x4cc134['id']});return _0x1dbdd5;});}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.rpc.js b/server/api/voiceExtension/voiceExtension.rpc.js index 595f0d5..0d68bdc 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 _0x0eb2=['include','map','model','info','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','client','http','redis','localhost','socket.io-emitter','./voiceExtension.socket','register','request','then','VoiceExtension,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','GetVoiceExtension','findAll','options','where','attributes','limit'];(function(_0x50007c,_0x1cbf11){var _0x5c1ec7=function(_0x52d038){while(--_0x52d038){_0x50007c['push'](_0x50007c['shift']());}};_0x5c1ec7(++_0x1cbf11);}(_0x0eb2,0x11c));var _0x20eb=function(_0x12b850,_0x38a78d){_0x12b850=_0x12b850-0x0;var _0x244c49=_0x0eb2[_0x12b850];return _0x244c49;};'use strict';var _=require(_0x20eb('0x0'));var util=require('util');var moment=require(_0x20eb('0x1'));var BPromise=require(_0x20eb('0x2'));var rs=require(_0x20eb('0x3'));var fs=require('fs');var Redis=require(_0x20eb('0x4'));var db=require(_0x20eb('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x20eb('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x20eb('0x7')][_0x20eb('0x8')]({'port':0x232a});config[_0x20eb('0x9')]=_['defaults'](config[_0x20eb('0x9')],{'host':_0x20eb('0xa'),'port':0x18eb});var socket=require(_0x20eb('0xb'))(new Redis(config[_0x20eb('0x9')]));require(_0x20eb('0xc'))[_0x20eb('0xd')](socket);function respondWithRpcPromise(_0x2c704d,_0x178e1a,_0x354645){return new BPromise(function(_0x3e6330,_0x198a58){return client[_0x20eb('0xe')](_0x2c704d,_0x354645)[_0x20eb('0xf')](function(_0x304536){logger['info'](_0x20eb('0x10'),_0x178e1a,'request\x20sent');logger[_0x20eb('0x11')]('VoiceExtension,\x20%s,\x20%s,\x20%s',_0x178e1a,_0x20eb('0x12'),JSON[_0x20eb('0x13')](_0x304536));if(_0x304536[_0x20eb('0x14')]){if(_0x304536[_0x20eb('0x14')][_0x20eb('0x15')]===0x1f4){logger[_0x20eb('0x14')](_0x20eb('0x10'),_0x178e1a,_0x304536[_0x20eb('0x14')][_0x20eb('0x16')]);return _0x198a58(_0x304536[_0x20eb('0x14')][_0x20eb('0x16')]);}logger[_0x20eb('0x14')](_0x20eb('0x10'),_0x178e1a,_0x304536[_0x20eb('0x14')][_0x20eb('0x16')]);return _0x3e6330(_0x304536['error'][_0x20eb('0x16')]);}else{logger['info'](_0x20eb('0x10'),_0x178e1a,_0x20eb('0x12'));_0x3e6330(_0x304536[_0x20eb('0x17')][_0x20eb('0x16')]);}})[_0x20eb('0x18')](function(_0x934bbc){logger[_0x20eb('0x14')]('VoiceExtension,\x20%s,\x20%s',_0x178e1a,_0x934bbc);_0x198a58(_0x934bbc);});});}exports[_0x20eb('0x19')]=function(_0x3c16f2){var _0x50c857=this;return new Promise(function(_0x3763b8,_0x3eb2be){return db['VoiceExtension'][_0x20eb('0x1a')]({'raw':_0x3c16f2[_0x20eb('0x1b')]?_0x3c16f2[_0x20eb('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x3c16f2[_0x20eb('0x1b')]?_0x3c16f2[_0x20eb('0x1b')][_0x20eb('0x1c')]||null:null,'attributes':_0x3c16f2['options']?_0x3c16f2[_0x20eb('0x1b')][_0x20eb('0x1d')]||null:null,'limit':_0x3c16f2[_0x20eb('0x1b')]?_0x3c16f2['options'][_0x20eb('0x1e')]||null:null,'include':_0x3c16f2['options']?_0x3c16f2[_0x20eb('0x1b')][_0x20eb('0x1f')]?_[_0x20eb('0x20')](_0x3c16f2[_0x20eb('0x1b')][_0x20eb('0x1f')],function(_0x391739){return{'model':db[_0x391739[_0x20eb('0x21')]],'as':_0x391739['as'],'attributes':_0x391739[_0x20eb('0x1d')],'include':_0x391739[_0x20eb('0x1f')]?_['map'](_0x391739[_0x20eb('0x1f')],function(_0x33a365){return{'model':db[_0x33a365[_0x20eb('0x21')]],'as':_0x33a365['as'],'attributes':_0x33a365['attributes'],'include':_0x33a365['include']?_['map'](_0x33a365['include'],function(_0x42455f){return{'model':db[_0x42455f[_0x20eb('0x21')]],'as':_0x42455f['as'],'attributes':_0x42455f['attributes']};}):[]};}):[]};}):[]:[]})[_0x20eb('0xf')](function(_0x50b08d){logger[_0x20eb('0x22')]('GetVoiceExtension',_0x3c16f2);logger['debug'](_0x20eb('0x19'),_0x3c16f2,JSON[_0x20eb('0x13')](_0x50b08d));_0x3763b8(_0x50b08d);})['catch'](function(_0x5abe40){logger[_0x20eb('0x14')](_0x20eb('0x19'),_0x5abe40['message'],_0x3c16f2);_0x3eb2be(_0x50c857[_0x20eb('0x14')](0x1f4,_0x5abe40[_0x20eb('0x16')]));});});}; \ No newline at end of file +var _0xe599=['info','request\x20sent','debug','stringify','error','VoiceExtension,\x20%s,\x20%s','message','catch','GetVoiceExtension','options','raw','where','limit','include','model','attributes','map','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','defaults','redis','socket.io-emitter','./voiceExtension.socket','register','request','then'];(function(_0x37e27b,_0x350b60){var _0x27ccb6=function(_0x50dbeb){while(--_0x50dbeb){_0x37e27b['push'](_0x37e27b['shift']());}};_0x27ccb6(++_0x350b60);}(_0xe599,0x1e5));var _0x9e59=function(_0x4f9087,_0x4a4184){_0x4f9087=_0x4f9087-0x0;var _0x4cbdcd=_0xe599[_0x4f9087];return _0x4cbdcd;};'use strict';var _=require(_0x9e59('0x0'));var util=require(_0x9e59('0x1'));var moment=require(_0x9e59('0x2'));var BPromise=require(_0x9e59('0x3'));var rs=require(_0x9e59('0x4'));var fs=require('fs');var Redis=require(_0x9e59('0x5'));var db=require(_0x9e59('0x6'))['db'];var utils=require(_0x9e59('0x7'));var logger=require(_0x9e59('0x8'))('rpc');var config=require(_0x9e59('0x9'));var jayson=require(_0x9e59('0xa'));var client=jayson['client'][_0x9e59('0xb')]({'port':0x232a});config['redis']=_[_0x9e59('0xc')](config[_0x9e59('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0x9e59('0xe'))(new Redis(config[_0x9e59('0xd')]));require(_0x9e59('0xf'))[_0x9e59('0x10')](socket);function respondWithRpcPromise(_0x64d093,_0x14a5d7,_0x578fdc){return new BPromise(function(_0x312bc6,_0x5ba142){return client[_0x9e59('0x11')](_0x64d093,_0x578fdc)[_0x9e59('0x12')](function(_0x21c404){logger[_0x9e59('0x13')]('VoiceExtension,\x20%s,\x20%s',_0x14a5d7,_0x9e59('0x14'));logger[_0x9e59('0x15')]('VoiceExtension,\x20%s,\x20%s,\x20%s',_0x14a5d7,_0x9e59('0x14'),JSON[_0x9e59('0x16')](_0x21c404));if(_0x21c404[_0x9e59('0x17')]){if(_0x21c404[_0x9e59('0x17')]['code']===0x1f4){logger[_0x9e59('0x17')](_0x9e59('0x18'),_0x14a5d7,_0x21c404[_0x9e59('0x17')][_0x9e59('0x19')]);return _0x5ba142(_0x21c404[_0x9e59('0x17')][_0x9e59('0x19')]);}logger[_0x9e59('0x17')](_0x9e59('0x18'),_0x14a5d7,_0x21c404['error'][_0x9e59('0x19')]);return _0x312bc6(_0x21c404['error']['message']);}else{logger['info'](_0x9e59('0x18'),_0x14a5d7,_0x9e59('0x14'));_0x312bc6(_0x21c404['result'][_0x9e59('0x19')]);}})[_0x9e59('0x1a')](function(_0x40f315){logger[_0x9e59('0x17')](_0x9e59('0x18'),_0x14a5d7,_0x40f315);_0x5ba142(_0x40f315);});});}exports[_0x9e59('0x1b')]=function(_0x3162f9){var _0x48fa20=this;return new Promise(function(_0x1ba8f9,_0x52022d){return db['VoiceExtension']['findAll']({'raw':_0x3162f9[_0x9e59('0x1c')]?_0x3162f9[_0x9e59('0x1c')][_0x9e59('0x1d')]===undefined?!![]:![]:!![],'where':_0x3162f9['options']?_0x3162f9[_0x9e59('0x1c')][_0x9e59('0x1e')]||null:null,'attributes':_0x3162f9['options']?_0x3162f9['options']['attributes']||null:null,'limit':_0x3162f9[_0x9e59('0x1c')]?_0x3162f9[_0x9e59('0x1c')][_0x9e59('0x1f')]||null:null,'include':_0x3162f9[_0x9e59('0x1c')]?_0x3162f9[_0x9e59('0x1c')]['include']?_['map'](_0x3162f9['options'][_0x9e59('0x20')],function(_0x147b15){return{'model':db[_0x147b15[_0x9e59('0x21')]],'as':_0x147b15['as'],'attributes':_0x147b15[_0x9e59('0x22')],'include':_0x147b15[_0x9e59('0x20')]?_[_0x9e59('0x23')](_0x147b15['include'],function(_0x5d4be1){return{'model':db[_0x5d4be1[_0x9e59('0x21')]],'as':_0x5d4be1['as'],'attributes':_0x5d4be1[_0x9e59('0x22')],'include':_0x5d4be1[_0x9e59('0x20')]?_[_0x9e59('0x23')](_0x5d4be1[_0x9e59('0x20')],function(_0x17f4f5){return{'model':db[_0x17f4f5[_0x9e59('0x21')]],'as':_0x17f4f5['as'],'attributes':_0x17f4f5[_0x9e59('0x22')]};}):[]};}):[]};}):[]:[]})[_0x9e59('0x12')](function(_0x3d002f){logger[_0x9e59('0x13')](_0x9e59('0x1b'),_0x3162f9);logger[_0x9e59('0x15')]('GetVoiceExtension',_0x3162f9,JSON[_0x9e59('0x16')](_0x3d002f));_0x1ba8f9(_0x3d002f);})[_0x9e59('0x1a')](function(_0xced2df){logger[_0x9e59('0x17')](_0x9e59('0x1b'),_0xced2df[_0x9e59('0x19')],_0x3162f9);_0x52022d(_0x48fa20[_0x9e59('0x17')](0x1f4,_0xced2df[_0x9e59('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index 2552bd7..f2950b2 100644 --- a/server/api/voiceExtension/voiceExtension.socket.js +++ b/server/api/voiceExtension/voiceExtension.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xabce=['voiceExtension:','./voiceExtension.events','save','remove','update','emit'];(function(_0x1bf872,_0x207772){var _0x3db5f7=function(_0x429897){while(--_0x429897){_0x1bf872['push'](_0x1bf872['shift']());}};_0x3db5f7(++_0x207772);}(_0xabce,0x103));var _0xeabc=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0xabce[_0x47b58b];return _0x46bebe;};'use strict';var VoiceExtensionEvents=require(_0xeabc('0x0'));var events=[_0xeabc('0x1'),_0xeabc('0x2'),_0xeabc('0x3')];function createListener(_0x49dbcc,_0x5bd1a4){return function(_0x5ebc95){_0x5bd1a4[_0xeabc('0x4')](_0x49dbcc,_0x5ebc95);};}function removeListener(_0x1d9f37,_0x1a88a7){return function(){VoiceExtensionEvents['removeListener'](_0x1d9f37,_0x1a88a7);};}exports['register']=function(_0x1b07a8){for(var _0x52a4d7=0x0,_0x229ba4=events['length'];_0x52a4d7<_0x229ba4;_0x52a4d7++){var _0x3bdc29=events[_0x52a4d7];var _0x9417af=createListener(_0xeabc('0x5')+_0x3bdc29,_0x1b07a8);VoiceExtensionEvents['on'](_0x3bdc29,_0x9417af);}}; \ No newline at end of file +var _0xabce=['voiceExtension:','./voiceExtension.events','save','remove','update','emit'];(function(_0x19431f,_0x5762fe){var _0x1a514c=function(_0x1cfab1){while(--_0x1cfab1){_0x19431f['push'](_0x19431f['shift']());}};_0x1a514c(++_0x5762fe);}(_0xabce,0x103));var _0xeabc=function(_0x3de8a4,_0x289a5c){_0x3de8a4=_0x3de8a4-0x0;var _0x4635cf=_0xabce[_0x3de8a4];return _0x4635cf;};'use strict';var VoiceExtensionEvents=require(_0xeabc('0x0'));var events=[_0xeabc('0x1'),_0xeabc('0x2'),_0xeabc('0x3')];function createListener(_0x49dbcc,_0x5bd1a4){return function(_0x5ebc95){_0x5bd1a4[_0xeabc('0x4')](_0x49dbcc,_0x5ebc95);};}function removeListener(_0x1d9f37,_0x1a88a7){return function(){VoiceExtensionEvents['removeListener'](_0x1d9f37,_0x1a88a7);};}exports['register']=function(_0x1b07a8){for(var _0x52a4d7=0x0,_0x229ba4=events['length'];_0x52a4d7<_0x229ba4;_0x52a4d7++){var _0x3bdc29=events[_0x52a4d7];var _0x9417af=createListener(_0xeabc('0x5')+_0x3bdc29,_0x1b07a8);VoiceExtensionEvents['on'](_0x3bdc29,_0x9417af);}}; \ No newline at end of file diff --git a/server/api/voiceMail/index.js b/server/api/voiceMail/index.js index 5548215..d6333ac 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 _0xf2e3=['/:id','show','/:id/messages','getMessages','post','create','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMail.controller','isAuthenticated','index','get'];(function(_0x309076,_0x764a60){var _0x9b2aea=function(_0x2e7af5){while(--_0x2e7af5){_0x309076['push'](_0x309076['shift']());}};_0x9b2aea(++_0x764a60);}(_0xf2e3,0x9b));var _0x3f2e=function(_0x1589dd,_0x2b9d22){_0x1589dd=_0x1589dd-0x0;var _0x1bddd1=_0xf2e3[_0x1589dd];return _0x1bddd1;};'use strict';var multer=require(_0x3f2e('0x0'));var util=require('util');var path=require(_0x3f2e('0x1'));var timeout=require(_0x3f2e('0x2'));var express=require(_0x3f2e('0x3'));var router=express[_0x3f2e('0x4')]();var fs_extra=require(_0x3f2e('0x5'));var auth=require(_0x3f2e('0x6'));var interaction=require(_0x3f2e('0x7'));var config=require(_0x3f2e('0x8'));var controller=require(_0x3f2e('0x9'));router['get']('/',auth[_0x3f2e('0xa')](),controller[_0x3f2e('0xb')]);router[_0x3f2e('0xc')](_0x3f2e('0xd'),auth[_0x3f2e('0xa')](),controller[_0x3f2e('0xe')]);router[_0x3f2e('0xc')](_0x3f2e('0xf'),auth[_0x3f2e('0xa')](),controller[_0x3f2e('0x10')]);router[_0x3f2e('0x11')]('/',auth[_0x3f2e('0xa')](),controller[_0x3f2e('0x12')]);router[_0x3f2e('0x13')](_0x3f2e('0xd'),auth[_0x3f2e('0xa')](),controller[_0x3f2e('0x14')]);router[_0x3f2e('0x15')](_0x3f2e('0xd'),auth['isAuthenticated'](),controller[_0x3f2e('0x16')]);module[_0x3f2e('0x17')]=router; \ No newline at end of file +var _0x2d72=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMail.controller','get','isAuthenticated','index','/:id','/:id/messages','getMessages','create','put','update','exports'];(function(_0x4afac5,_0x1ab4ed){var _0x2404b3=function(_0x5c700b){while(--_0x5c700b){_0x4afac5['push'](_0x4afac5['shift']());}};_0x2404b3(++_0x1ab4ed);}(_0x2d72,0xa8));var _0x22d7=function(_0x26c847,_0x4bd445){_0x26c847=_0x26c847-0x0;var _0x4ab9c2=_0x2d72[_0x26c847];return _0x4ab9c2;};'use strict';var multer=require(_0x22d7('0x0'));var util=require(_0x22d7('0x1'));var path=require(_0x22d7('0x2'));var timeout=require(_0x22d7('0x3'));var express=require(_0x22d7('0x4'));var router=express[_0x22d7('0x5')]();var fs_extra=require(_0x22d7('0x6'));var auth=require(_0x22d7('0x7'));var interaction=require(_0x22d7('0x8'));var config=require(_0x22d7('0x9'));var controller=require(_0x22d7('0xa'));router[_0x22d7('0xb')]('/',auth[_0x22d7('0xc')](),controller[_0x22d7('0xd')]);router['get'](_0x22d7('0xe'),auth[_0x22d7('0xc')](),controller['show']);router[_0x22d7('0xb')](_0x22d7('0xf'),auth[_0x22d7('0xc')](),controller[_0x22d7('0x10')]);router['post']('/',auth['isAuthenticated'](),controller[_0x22d7('0x11')]);router[_0x22d7('0x12')](_0x22d7('0xe'),auth[_0x22d7('0xc')](),controller[_0x22d7('0x13')]);router['delete']('/:id',auth[_0x22d7('0xc')](),controller['destroy']);module[_0x22d7('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.attributes.js b/server/api/voiceMail/voiceMail.attributes.js index 18b3165..f34d859 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 _0x42ef=['mailbox','sequelize','STRING','from-voicemail','email','trim','central','ENUM','yes','TIMESTAMP','INTEGER','VIRTUAL','getDataValue','\x20-\x20'];(function(_0xdce7a2,_0x249e5c){var _0x7e43c3=function(_0x2ef34c){while(--_0x2ef34c){_0xdce7a2['push'](_0xdce7a2['shift']());}};_0x7e43c3(++_0x249e5c);}(_0x42ef,0x119));var _0xf42e=function(_0x33671a,_0x55aee8){_0x33671a=_0x33671a-0x0;var _0x46708e=_0x42ef[_0x33671a];return _0x46708e;};'use strict';var Sequelize=require(_0xf42e('0x0'));module['exports']={'customer_id':{'type':Sequelize[_0xf42e('0x1')]},'context':{'type':Sequelize['STRING'],'defaultValue':_0xf42e('0x2'),'unique':'contest_mailbox'},'mailbox':{'type':Sequelize[_0xf42e('0x1')],'defaultValue':'','allowNull':![],'unique':'contest_mailbox'},'password':{'type':Sequelize[_0xf42e('0x1')]},'fullname':{'type':Sequelize[_0xf42e('0x1')]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]},'set':function(_0x2f55a3){this['setDataValue'](_0xf42e('0x3'),typeof _0x2f55a3==='string'&&_0x2f55a3[_0xf42e('0x4')]()?_0x2f55a3['trim']():null);}},'pager':{'type':Sequelize[_0xf42e('0x1')]},'tz':{'type':Sequelize[_0xf42e('0x1')],'defaultValue':_0xf42e('0x5')},'attach':{'type':Sequelize[_0xf42e('0x6')](_0xf42e('0x7'),'no'),'defaultValue':_0xf42e('0x7'),'allowNull':![]},'saycid':{'type':Sequelize[_0xf42e('0x6')]('yes','no'),'defaultValue':_0xf42e('0x7'),'allowNull':![]},'dialout':{'type':Sequelize[_0xf42e('0x1')]},'callback':{'type':Sequelize['STRING']},'review':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize['ENUM'](_0xf42e('0x7'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0xf42e('0x6')](_0xf42e('0x7'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0xf42e('0x6')](_0xf42e('0x7'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':'TINYINT(4)','defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0xf42e('0x6')](_0xf42e('0x7'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0xf42e('0x6')](_0xf42e('0x7'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0xf42e('0x6')](_0xf42e('0x7'),'no'),'defaultValue':_0xf42e('0x7'),'allowNull':![]},'forcename':{'type':Sequelize[_0xf42e('0x6')](_0xf42e('0x7'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize['ENUM'](_0xf42e('0x7'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0xf42e('0x6')](_0xf42e('0x7'),'no'),'defaultValue':_0xf42e('0x7'),'allowNull':![]},'stamp':{'type':_0xf42e('0x8')},'emailsubject':{'type':Sequelize[_0xf42e('0x1')]},'emailbody':{'type':Sequelize[_0xf42e('0x1')]},'maxsecs':{'type':Sequelize[_0xf42e('0x9')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0xf42e('0xa')],'get':function(){return this[_0xf42e('0xb')]('fullname')+_0xf42e('0xc')+this['getDataValue'](_0xf42e('0xd'));}}}; \ No newline at end of file +var _0x0692=['trim','ENUM','yes','TINYINT(4)','TIMESTAMP','VIRTUAL','getDataValue','fullname','mailbox','sequelize','STRING','contest_mailbox','setDataValue','email','string'];(function(_0x1d8174,_0x3c39be){var _0x33fb92=function(_0xd174db){while(--_0xd174db){_0x1d8174['push'](_0x1d8174['shift']());}};_0x33fb92(++_0x3c39be);}(_0x0692,0x1da));var _0x2069=function(_0x1ddaf9,_0x67e0ba){_0x1ddaf9=_0x1ddaf9-0x0;var _0x202f68=_0x0692[_0x1ddaf9];return _0x202f68;};'use strict';var Sequelize=require(_0x2069('0x0'));module['exports']={'customer_id':{'type':Sequelize[_0x2069('0x1')]},'context':{'type':Sequelize[_0x2069('0x1')],'defaultValue':'from-voicemail','unique':'contest_mailbox'},'mailbox':{'type':Sequelize['STRING'],'defaultValue':'','allowNull':![],'unique':_0x2069('0x2')},'password':{'type':Sequelize['STRING']},'fullname':{'type':Sequelize[_0x2069('0x1')]},'email':{'type':Sequelize[_0x2069('0x1')],'validate':{'isEmail':!![]},'set':function(_0x3e6106){this[_0x2069('0x3')](_0x2069('0x4'),typeof _0x3e6106===_0x2069('0x5')&&_0x3e6106[_0x2069('0x6')]()?_0x3e6106[_0x2069('0x6')]():null);}},'pager':{'type':Sequelize[_0x2069('0x1')]},'tz':{'type':Sequelize[_0x2069('0x1')],'defaultValue':'central'},'attach':{'type':Sequelize[_0x2069('0x7')](_0x2069('0x8'),'no'),'defaultValue':_0x2069('0x8'),'allowNull':![]},'saycid':{'type':Sequelize['ENUM'](_0x2069('0x8'),'no'),'defaultValue':_0x2069('0x8'),'allowNull':![]},'dialout':{'type':Sequelize[_0x2069('0x1')]},'callback':{'type':Sequelize['STRING']},'review':{'type':Sequelize[_0x2069('0x7')]('yes','no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize['ENUM'](_0x2069('0x8'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0x2069('0x7')]('yes','no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0x2069('0x7')](_0x2069('0x8'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0x2069('0x9'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x2069('0x7')](_0x2069('0x8'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0x2069('0x7')]('yes','no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x2069('0x7')](_0x2069('0x8'),'no'),'defaultValue':_0x2069('0x8'),'allowNull':![]},'forcename':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0x2069('0x7')](_0x2069('0x8'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x2069('0x7')]('yes','no'),'defaultValue':'yes','allowNull':![]},'stamp':{'type':_0x2069('0xa')},'emailsubject':{'type':Sequelize[_0x2069('0x1')]},'emailbody':{'type':Sequelize[_0x2069('0x1')]},'maxsecs':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x2069('0xb')],'get':function(){return this[_0x2069('0xc')](_0x2069('0xd'))+'\x20-\x20'+this[_0x2069('0xc')](_0x2069('0xe'));}}}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index 4ca8062..78199f2 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 _0xc788=['role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','getMessages','findOne','VoiceMailMessage','mailbox','findAndCountAll','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','get','Voicemails','error','stack','name','index','map','VoiceMail','rawAttributes','fieldName','type','key','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','offset','order','sort','pick','filter','where','merge','VIRTUAL','includeAll','findAll','rows','catch','show','params','include','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user'];(function(_0x170a9b,_0x31dc11){var _0x1ca94c=function(_0x5a6130){while(--_0x5a6130){_0x170a9b['push'](_0x170a9b['shift']());}};_0x1ca94c(++_0x31dc11);}(_0xc788,0xc4));var _0x8c78=function(_0x69c0c2,_0x2af0bf){_0x69c0c2=_0x69c0c2-0x0;var _0x3422f6=_0xc788[_0x69c0c2];return _0x3422f6;};'use strict';var emlformat=require(_0x8c78('0x0'));var rimraf=require(_0x8c78('0x1'));var zipdir=require(_0x8c78('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x8c78('0x3'));var BPromise=require(_0x8c78('0x4'));var Mustache=require(_0x8c78('0x5'));var util=require(_0x8c78('0x6'));var path=require(_0x8c78('0x7'));var sox=require('sox');var csv=require(_0x8c78('0x8'));var ejs=require(_0x8c78('0x9'));var fs=require('fs');var fs_extra=require(_0x8c78('0xa'));var _=require(_0x8c78('0xb'));var squel=require(_0x8c78('0xc'));var crypto=require('crypto');var jsforce=require(_0x8c78('0xd'));var deskjs=require(_0x8c78('0xe'));var toCsv=require(_0x8c78('0x8'));var querystring=require(_0x8c78('0xf'));var Papa=require(_0x8c78('0x10'));var Redis=require(_0x8c78('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x8c78('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8c78('0x13'));var logger=require(_0x8c78('0x14'))('api');var utils=require(_0x8c78('0x15'));var config=require(_0x8c78('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x8c78('0x17'))['db'];function respondWithStatusCode(_0x4b2eca,_0x56a802){_0x56a802=_0x56a802||0xcc;return function(_0x349dfa){if(_0x349dfa){return _0x4b2eca[_0x8c78('0x18')](_0x56a802);}return _0x4b2eca[_0x8c78('0x19')](_0x56a802)[_0x8c78('0x1a')]();};}function respondWithResult(_0x2eedff,_0x3d1306){_0x3d1306=_0x3d1306||0xc8;return function(_0xe5f8ae){if(_0xe5f8ae){return _0x2eedff[_0x8c78('0x19')](_0x3d1306)[_0x8c78('0x1b')](_0xe5f8ae);}};}function respondWithFilteredResult(_0x1157d0,_0x4ff4b0){return function(_0x1fa78e){if(_0x1fa78e){var _0x293cfe=typeof _0x4ff4b0['offset']===_0x8c78('0x1c')&&typeof _0x4ff4b0[_0x8c78('0x1d')]===_0x8c78('0x1c');var _0x23824e=_0x1fa78e[_0x8c78('0x1e')];var _0x461eff=_0x293cfe?0x0:_0x4ff4b0['offset'];var _0x4f7bf9=_0x293cfe?_0x1fa78e[_0x8c78('0x1e')]:_0x4ff4b0['offset']+_0x4ff4b0['limit'];var _0xece4f0;if(_0x4f7bf9>=_0x23824e){_0x4f7bf9=_0x23824e;_0xece4f0=0xc8;}else{_0xece4f0=0xce;}_0x1157d0['status'](_0xece4f0);return _0x1157d0[_0x8c78('0x1f')](_0x8c78('0x20'),_0x461eff+'-'+_0x4f7bf9+'/'+_0x23824e)['json'](_0x1fa78e);}return null;};}function patchUpdates(_0x6c9a12){return function(_0x5b111b){try{jsonpatch[_0x8c78('0x21')](_0x5b111b,_0x6c9a12,!![]);}catch(_0x3af73c){return BPromise['reject'](_0x3af73c);}return _0x5b111b[_0x8c78('0x22')]();};}function saveUpdates(_0x188cc3,_0x499603){return function(_0x2bc595){if(_0x2bc595){return _0x2bc595[_0x8c78('0x23')](_0x188cc3)[_0x8c78('0x24')](function(_0x9581c6){return _0x9581c6;});}return null;};}function removeEntity(_0x215940,_0x20f483){return function(_0xbfdf6f){if(_0xbfdf6f){return _0xbfdf6f[_0x8c78('0x25')]()[_0x8c78('0x24')](function(){var _0x4a7d20=_0xbfdf6f[_0x8c78('0x26')]({'plain':!![]});var _0x458763=_0x8c78('0x27');return db['UserProfileResource'][_0x8c78('0x25')]({'where':{'type':_0x458763,'resourceId':_0x4a7d20['id']}})['then'](function(){return _0xbfdf6f;});})[_0x8c78('0x24')](function(){_0x215940[_0x8c78('0x19')](0xcc)[_0x8c78('0x1a')]();});}};}function handleEntityNotFound(_0x496c51,_0x583a74){return function(_0x2568d5){if(!_0x2568d5){_0x496c51['sendStatus'](0x194);}return _0x2568d5;};}function handleError(_0x20b128,_0x4376da){_0x4376da=_0x4376da||0x1f4;return function(_0x394c1d){logger[_0x8c78('0x28')](_0x394c1d[_0x8c78('0x29')]);if(_0x394c1d[_0x8c78('0x2a')]){delete _0x394c1d['name'];}_0x20b128[_0x8c78('0x19')](_0x4376da)['send'](_0x394c1d);};}exports[_0x8c78('0x2b')]=function(_0x17f4c8,_0xb69c52){var _0x4e764f={},_0x1f1a0c={},_0x3816d2={'count':0x0,'rows':[]};var _0x4f0005=_[_0x8c78('0x2c')](db[_0x8c78('0x2d')][_0x8c78('0x2e')],function(_0x487a4c){return{'name':_0x487a4c[_0x8c78('0x2f')],'type':_0x487a4c[_0x8c78('0x30')][_0x8c78('0x31')]};});_0x1f1a0c['model']=_[_0x8c78('0x2c')](_0x4f0005,_0x8c78('0x2a'));_0x1f1a0c['query']=_[_0x8c78('0x32')](_0x17f4c8[_0x8c78('0x33')]);_0x1f1a0c[_0x8c78('0x34')]=_[_0x8c78('0x35')](_0x1f1a0c[_0x8c78('0x36')],_0x1f1a0c[_0x8c78('0x33')]);_0x4e764f[_0x8c78('0x37')]=_[_0x8c78('0x35')](_0x1f1a0c[_0x8c78('0x36')],qs[_0x8c78('0x38')](_0x17f4c8['query'][_0x8c78('0x38')]));_0x4e764f[_0x8c78('0x37')]=_0x4e764f[_0x8c78('0x37')][_0x8c78('0x39')]?_0x4e764f[_0x8c78('0x37')]:_0x1f1a0c['model'];if(!_0x17f4c8[_0x8c78('0x33')][_0x8c78('0x3a')](_0x8c78('0x3b'))){_0x4e764f['limit']=qs[_0x8c78('0x1d')](_0x17f4c8[_0x8c78('0x33')]['limit']);_0x4e764f[_0x8c78('0x3c')]=qs['offset'](_0x17f4c8[_0x8c78('0x33')][_0x8c78('0x3c')]);}_0x4e764f[_0x8c78('0x3d')]=qs[_0x8c78('0x3e')](_0x17f4c8['query'][_0x8c78('0x3e')]);_0x4e764f['where']=qs[_0x8c78('0x34')](_[_0x8c78('0x3f')](_0x17f4c8[_0x8c78('0x33')],_0x1f1a0c['filters']),_0x4f0005);if(_0x17f4c8['query'][_0x8c78('0x40')]){_0x4e764f[_0x8c78('0x41')]=_[_0x8c78('0x42')](_0x4e764f[_0x8c78('0x41')],{'$or':_[_0x8c78('0x2c')](_0x4f0005,function(_0x484931){if(_0x484931[_0x8c78('0x30')]!==_0x8c78('0x43')){var _0x1f0a2b={};_0x1f0a2b[_0x484931[_0x8c78('0x2a')]]={'$like':'%'+_0x17f4c8[_0x8c78('0x33')][_0x8c78('0x40')]+'%'};return _0x1f0a2b;}})});}_0x4e764f=_[_0x8c78('0x42')]({},_0x4e764f,_0x17f4c8['options']);var _0x3995f4={'where':_0x4e764f[_0x8c78('0x41')]};return db['VoiceMail']['count'](_0x3995f4)[_0x8c78('0x24')](function(_0x1612d5){_0x3816d2['count']=_0x1612d5;if(_0x17f4c8[_0x8c78('0x33')][_0x8c78('0x44')]){_0x4e764f['include']=[{'all':!![]}];}return db[_0x8c78('0x2d')][_0x8c78('0x45')](_0x4e764f);})['then'](function(_0x10d521){_0x3816d2[_0x8c78('0x46')]=_0x10d521;return _0x3816d2;})[_0x8c78('0x24')](respondWithFilteredResult(_0xb69c52,_0x4e764f))[_0x8c78('0x47')](handleError(_0xb69c52,null));};exports[_0x8c78('0x48')]=function(_0x4e4880,_0x545d90){var _0x2841c2={'raw':!![],'where':{'id':_0x4e4880[_0x8c78('0x49')]['id']}},_0x2f6a6b={};_0x2f6a6b[_0x8c78('0x36')]=_[_0x8c78('0x32')](db[_0x8c78('0x2d')][_0x8c78('0x2e')]);_0x2f6a6b[_0x8c78('0x33')]=_[_0x8c78('0x32')](_0x4e4880[_0x8c78('0x33')]);_0x2f6a6b[_0x8c78('0x34')]=_['intersection'](_0x2f6a6b[_0x8c78('0x36')],_0x2f6a6b[_0x8c78('0x33')]);_0x2841c2[_0x8c78('0x37')]=_[_0x8c78('0x35')](_0x2f6a6b[_0x8c78('0x36')],qs['fields'](_0x4e4880[_0x8c78('0x33')][_0x8c78('0x38')]));_0x2841c2[_0x8c78('0x37')]=_0x2841c2[_0x8c78('0x37')][_0x8c78('0x39')]?_0x2841c2['attributes']:_0x2f6a6b[_0x8c78('0x36')];if(_0x4e4880['query']['includeAll']){_0x2841c2[_0x8c78('0x4a')]=[{'all':!![]}];}_0x2841c2=_[_0x8c78('0x42')]({},_0x2841c2,_0x4e4880[_0x8c78('0x4b')]);return db['VoiceMail'][_0x8c78('0x4c')](_0x2841c2)[_0x8c78('0x24')](handleEntityNotFound(_0x545d90,null))[_0x8c78('0x24')](respondWithResult(_0x545d90,null))[_0x8c78('0x47')](handleError(_0x545d90,null));};exports[_0x8c78('0x4d')]=function(_0x38083e,_0x26103c){return db[_0x8c78('0x2d')][_0x8c78('0x4d')](_0x38083e['body'],{})[_0x8c78('0x24')](function(_0x1fcf97){var _0xba0de6=_0x38083e[_0x8c78('0x4e')]['get']({'plain':!![]});if(!_0xba0de6)throw new Error(_0x8c78('0x4f'));if(_0xba0de6[_0x8c78('0x50')]===_0x8c78('0x4e')){var _0x431125=_0x1fcf97['get']({'plain':!![]});var _0x336b95=_0x8c78('0x27');return db[_0x8c78('0x51')]['find']({'where':{'name':_0x336b95,'userProfileId':_0xba0de6[_0x8c78('0x52')]},'raw':!![]})['then'](function(_0xae80d){if(_0xae80d&&_0xae80d[_0x8c78('0x53')]===0x0){return db[_0x8c78('0x54')][_0x8c78('0x4d')]({'name':_0x431125[_0x8c78('0x2a')],'resourceId':_0x431125['id'],'type':_0xae80d[_0x8c78('0x2a')],'sectionId':_0xae80d['id']},{})[_0x8c78('0x24')](function(){return _0x1fcf97;});}else{return _0x1fcf97;}})[_0x8c78('0x47')](function(_0x19d807){logger[_0x8c78('0x28')](_0x8c78('0x55'),_0x19d807);throw _0x19d807;});}return _0x1fcf97;})[_0x8c78('0x24')](respondWithResult(_0x26103c,0xc9))[_0x8c78('0x47')](handleError(_0x26103c,null));};exports[_0x8c78('0x23')]=function(_0x54b40d,_0x22fe6c){if(_0x54b40d[_0x8c78('0x56')]['id']){delete _0x54b40d[_0x8c78('0x56')]['id'];}return db[_0x8c78('0x2d')]['find']({'where':{'id':_0x54b40d[_0x8c78('0x49')]['id']}})[_0x8c78('0x24')](handleEntityNotFound(_0x22fe6c,null))[_0x8c78('0x24')](saveUpdates(_0x54b40d[_0x8c78('0x56')],null))[_0x8c78('0x24')](respondWithResult(_0x22fe6c,null))[_0x8c78('0x47')](handleError(_0x22fe6c,null));};exports['destroy']=function(_0x1e616c,_0x42a34e){return db['VoiceMail'][_0x8c78('0x4c')]({'where':{'id':_0x1e616c['params']['id']}})[_0x8c78('0x24')](handleEntityNotFound(_0x42a34e,null))[_0x8c78('0x24')](removeEntity(_0x42a34e,null))[_0x8c78('0x47')](handleError(_0x42a34e,null));};exports[_0x8c78('0x57')]=function(_0x3ff236,_0x35cf85,_0x416a05){return db['VoiceMail'][_0x8c78('0x58')]({'where':{'id':_0x3ff236[_0x8c78('0x49')]['id']}})['then'](handleEntityNotFound(_0x35cf85,null))[_0x8c78('0x24')](function(_0x3529aa){var _0x577361;var _0x425994={},_0x2307d1={};_0x2307d1[_0x8c78('0x36')]=_[_0x8c78('0x32')](db[_0x8c78('0x59')][_0x8c78('0x2e')]);_0x2307d1[_0x8c78('0x33')]=_[_0x8c78('0x32')](_0x3ff236[_0x8c78('0x33')]);_0x2307d1[_0x8c78('0x34')]=_[_0x8c78('0x35')](_0x2307d1[_0x8c78('0x36')],_0x2307d1[_0x8c78('0x33')]);_0x425994[_0x8c78('0x37')]=_['intersection'](_0x2307d1[_0x8c78('0x36')],qs['fields'](_0x3ff236[_0x8c78('0x33')]['fields']));_0x425994['attributes']=_0x425994['attributes'][_0x8c78('0x39')]?_0x425994['attributes']:_0x2307d1['model'];if(!_0x3ff236['query'][_0x8c78('0x3a')](_0x8c78('0x3b'))){_0x425994[_0x8c78('0x1d')]=qs[_0x8c78('0x1d')](_0x3ff236['query'][_0x8c78('0x1d')]);_0x425994[_0x8c78('0x3c')]=qs[_0x8c78('0x3c')](_0x3ff236[_0x8c78('0x33')][_0x8c78('0x3c')]);}_0x425994[_0x8c78('0x3d')]=qs[_0x8c78('0x3e')](_0x3ff236[_0x8c78('0x33')][_0x8c78('0x3e')]);_0x425994[_0x8c78('0x41')]=qs[_0x8c78('0x34')](_[_0x8c78('0x3f')](_0x3ff236[_0x8c78('0x33')],_0x2307d1[_0x8c78('0x34')]));if(_0x3ff236['query'][_0x8c78('0x40')]){_0x425994['where']=_[_0x8c78('0x42')](_0x425994[_0x8c78('0x41')],{'$or':_[_0x8c78('0x2c')](_0x425994['attributes'],function(_0x97df9c){var _0x3e2961={};_0x3e2961[_0x97df9c]={'$like':'%'+_0x3ff236[_0x8c78('0x33')]['filter']+'%'};return _0x3e2961;})});}_0x425994[_0x8c78('0x41')]=_[_0x8c78('0x42')](_0x425994['where'],{'mailboxuser':_0x3529aa[_0x8c78('0x5a')]});_0x425994=_[_0x8c78('0x42')]({},_0x425994,_0x3ff236[_0x8c78('0x4b')]);return db['VoiceMailMessage'][_0x8c78('0x5b')](_0x425994)[_0x8c78('0x24')](respondWithFilteredResult(_0x35cf85,_0x425994));})[_0x8c78('0x47')](handleError(_0x35cf85,null));}; \ No newline at end of file +var _0xd8b0=['find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','findOne','VoiceMailMessage','rawAttributes','nolimit','order','eml-format','rimraf','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','save','update','then','destroy','Voicemails','error','name','index','VoiceMail','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','limit','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','catch','show','params','options'];(function(_0x40a93b,_0x1fa962){var _0x514a07=function(_0x1ce1f2){while(--_0x1ce1f2){_0x40a93b['push'](_0x40a93b['shift']());}};_0x514a07(++_0x1fa962);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0x0d8b('0x0'));var rimraf=require(_0x0d8b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0d8b('0x2'));var BPromise=require(_0x0d8b('0x3'));var Mustache=require(_0x0d8b('0x4'));var util=require(_0x0d8b('0x5'));var path=require(_0x0d8b('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x0d8b('0x7'));var fs=require('fs');var fs_extra=require(_0x0d8b('0x8'));var _=require(_0x0d8b('0x9'));var squel=require('squel');var crypto=require(_0x0d8b('0xa'));var jsforce=require(_0x0d8b('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x0d8b('0xc'));var querystring=require(_0x0d8b('0xd'));var Papa=require(_0x0d8b('0xe'));var Redis=require(_0x0d8b('0xf'));var authService=require(_0x0d8b('0x10'));var qs=require(_0x0d8b('0x11'));var as=require(_0x0d8b('0x12'));var hardwareService=require(_0x0d8b('0x13'));var logger=require('../../config/logger')(_0x0d8b('0x14'));var utils=require('../../config/utils');var config=require(_0x0d8b('0x15'));var licenseUtil=require(_0x0d8b('0x16'));var db=require(_0x0d8b('0x17'))['db'];function respondWithStatusCode(_0x92cdd8,_0x35a07b){_0x35a07b=_0x35a07b||0xcc;return function(_0x32bb1a){if(_0x32bb1a){return _0x92cdd8[_0x0d8b('0x18')](_0x35a07b);}return _0x92cdd8[_0x0d8b('0x19')](_0x35a07b)[_0x0d8b('0x1a')]();};}function respondWithResult(_0x2ce75e,_0x5ad086){_0x5ad086=_0x5ad086||0xc8;return function(_0xe65334){if(_0xe65334){return _0x2ce75e[_0x0d8b('0x19')](_0x5ad086)[_0x0d8b('0x1b')](_0xe65334);}};}function respondWithFilteredResult(_0x4f6f21,_0x23eb7b){return function(_0xa86349){if(_0xa86349){var _0x17f7df=typeof _0x23eb7b[_0x0d8b('0x1c')]===_0x0d8b('0x1d')&&typeof _0x23eb7b['limit']===_0x0d8b('0x1d');var _0x4586c2=_0xa86349[_0x0d8b('0x1e')];var _0x5fecbd=_0x17f7df?0x0:_0x23eb7b[_0x0d8b('0x1c')];var _0x18dd2d=_0x17f7df?_0xa86349[_0x0d8b('0x1e')]:_0x23eb7b[_0x0d8b('0x1c')]+_0x23eb7b['limit'];var _0x27512e;if(_0x18dd2d>=_0x4586c2){_0x18dd2d=_0x4586c2;_0x27512e=0xc8;}else{_0x27512e=0xce;}_0x4f6f21[_0x0d8b('0x19')](_0x27512e);return _0x4f6f21[_0x0d8b('0x1f')](_0x0d8b('0x20'),_0x5fecbd+'-'+_0x18dd2d+'/'+_0x4586c2)[_0x0d8b('0x1b')](_0xa86349);}return null;};}function patchUpdates(_0x5b709c){return function(_0x393beb){try{jsonpatch[_0x0d8b('0x21')](_0x393beb,_0x5b709c,!![]);}catch(_0x50ec1e){return BPromise['reject'](_0x50ec1e);}return _0x393beb[_0x0d8b('0x22')]();};}function saveUpdates(_0x54a9a7,_0x56c729){return function(_0x5527d8){if(_0x5527d8){return _0x5527d8[_0x0d8b('0x23')](_0x54a9a7)[_0x0d8b('0x24')](function(_0x214778){return _0x214778;});}return null;};}function removeEntity(_0x38efc8,_0x221071){return function(_0x2c64e2){if(_0x2c64e2){return _0x2c64e2[_0x0d8b('0x25')]()[_0x0d8b('0x24')](function(){var _0x27b695=_0x2c64e2['get']({'plain':!![]});var _0xe8bbee=_0x0d8b('0x26');return db['UserProfileResource'][_0x0d8b('0x25')]({'where':{'type':_0xe8bbee,'resourceId':_0x27b695['id']}})['then'](function(){return _0x2c64e2;});})[_0x0d8b('0x24')](function(){_0x38efc8[_0x0d8b('0x19')](0xcc)[_0x0d8b('0x1a')]();});}};}function handleEntityNotFound(_0x4fe6f9,_0x59a905){return function(_0x28f639){if(!_0x28f639){_0x4fe6f9[_0x0d8b('0x18')](0x194);}return _0x28f639;};}function handleError(_0x4c05ee,_0xcbc4ac){_0xcbc4ac=_0xcbc4ac||0x1f4;return function(_0x59aa83){logger[_0x0d8b('0x27')](_0x59aa83['stack']);if(_0x59aa83[_0x0d8b('0x28')]){delete _0x59aa83['name'];}_0x4c05ee[_0x0d8b('0x19')](_0xcbc4ac)['send'](_0x59aa83);};}exports[_0x0d8b('0x29')]=function(_0x544735,_0x3c8887){var _0x106e4c={},_0x2c058d={},_0x56120a={'count':0x0,'rows':[]};var _0x4c80a2=_['map'](db[_0x0d8b('0x2a')]['rawAttributes'],function(_0x3cdf3c){return{'name':_0x3cdf3c['fieldName'],'type':_0x3cdf3c['type'][_0x0d8b('0x2b')]};});_0x2c058d[_0x0d8b('0x2c')]=_[_0x0d8b('0x2d')](_0x4c80a2,_0x0d8b('0x28'));_0x2c058d[_0x0d8b('0x2e')]=_[_0x0d8b('0x2f')](_0x544735[_0x0d8b('0x2e')]);_0x2c058d[_0x0d8b('0x30')]=_['intersection'](_0x2c058d[_0x0d8b('0x2c')],_0x2c058d[_0x0d8b('0x2e')]);_0x106e4c['attributes']=_[_0x0d8b('0x31')](_0x2c058d[_0x0d8b('0x2c')],qs[_0x0d8b('0x32')](_0x544735['query'][_0x0d8b('0x32')]));_0x106e4c[_0x0d8b('0x33')]=_0x106e4c[_0x0d8b('0x33')][_0x0d8b('0x34')]?_0x106e4c[_0x0d8b('0x33')]:_0x2c058d['model'];if(!_0x544735[_0x0d8b('0x2e')][_0x0d8b('0x35')]('nolimit')){_0x106e4c[_0x0d8b('0x36')]=qs[_0x0d8b('0x36')](_0x544735[_0x0d8b('0x2e')][_0x0d8b('0x36')]);_0x106e4c[_0x0d8b('0x1c')]=qs['offset'](_0x544735['query'][_0x0d8b('0x1c')]);}_0x106e4c['order']=qs['sort'](_0x544735[_0x0d8b('0x2e')][_0x0d8b('0x37')]);_0x106e4c[_0x0d8b('0x38')]=qs[_0x0d8b('0x30')](_[_0x0d8b('0x39')](_0x544735[_0x0d8b('0x2e')],_0x2c058d['filters']),_0x4c80a2);if(_0x544735[_0x0d8b('0x2e')][_0x0d8b('0x3a')]){_0x106e4c[_0x0d8b('0x38')]=_[_0x0d8b('0x3b')](_0x106e4c[_0x0d8b('0x38')],{'$or':_[_0x0d8b('0x2d')](_0x4c80a2,function(_0xf1680e){if(_0xf1680e['type']!==_0x0d8b('0x3c')){var _0x34acb5={};_0x34acb5[_0xf1680e[_0x0d8b('0x28')]]={'$like':'%'+_0x544735[_0x0d8b('0x2e')]['filter']+'%'};return _0x34acb5;}})});}_0x106e4c=_[_0x0d8b('0x3b')]({},_0x106e4c,_0x544735['options']);var _0x37b26c={'where':_0x106e4c[_0x0d8b('0x38')]};return db[_0x0d8b('0x2a')][_0x0d8b('0x1e')](_0x37b26c)[_0x0d8b('0x24')](function(_0x3e632e){_0x56120a[_0x0d8b('0x1e')]=_0x3e632e;if(_0x544735[_0x0d8b('0x2e')][_0x0d8b('0x3d')]){_0x106e4c[_0x0d8b('0x3e')]=[{'all':!![]}];}return db['VoiceMail']['findAll'](_0x106e4c);})['then'](function(_0x4d0811){_0x56120a['rows']=_0x4d0811;return _0x56120a;})[_0x0d8b('0x24')](respondWithFilteredResult(_0x3c8887,_0x106e4c))[_0x0d8b('0x3f')](handleError(_0x3c8887,null));};exports[_0x0d8b('0x40')]=function(_0x5100cf,_0x4a76a3){var _0x1b216d={'raw':!![],'where':{'id':_0x5100cf[_0x0d8b('0x41')]['id']}},_0x192de1={};_0x192de1['model']=_[_0x0d8b('0x2f')](db[_0x0d8b('0x2a')]['rawAttributes']);_0x192de1['query']=_[_0x0d8b('0x2f')](_0x5100cf['query']);_0x192de1[_0x0d8b('0x30')]=_['intersection'](_0x192de1['model'],_0x192de1[_0x0d8b('0x2e')]);_0x1b216d[_0x0d8b('0x33')]=_['intersection'](_0x192de1['model'],qs['fields'](_0x5100cf['query'][_0x0d8b('0x32')]));_0x1b216d[_0x0d8b('0x33')]=_0x1b216d[_0x0d8b('0x33')]['length']?_0x1b216d[_0x0d8b('0x33')]:_0x192de1[_0x0d8b('0x2c')];if(_0x5100cf[_0x0d8b('0x2e')][_0x0d8b('0x3d')]){_0x1b216d[_0x0d8b('0x3e')]=[{'all':!![]}];}_0x1b216d=_[_0x0d8b('0x3b')]({},_0x1b216d,_0x5100cf[_0x0d8b('0x42')]);return db[_0x0d8b('0x2a')][_0x0d8b('0x43')](_0x1b216d)[_0x0d8b('0x24')](handleEntityNotFound(_0x4a76a3,null))[_0x0d8b('0x24')](respondWithResult(_0x4a76a3,null))[_0x0d8b('0x3f')](handleError(_0x4a76a3,null));};exports[_0x0d8b('0x44')]=function(_0x3e569b,_0x570af8){return db[_0x0d8b('0x2a')][_0x0d8b('0x44')](_0x3e569b[_0x0d8b('0x45')],{})[_0x0d8b('0x24')](function(_0x574b90){var _0x371fa0=_0x3e569b['user']['get']({'plain':!![]});if(!_0x371fa0)throw new Error(_0x0d8b('0x46'));if(_0x371fa0[_0x0d8b('0x47')]===_0x0d8b('0x48')){var _0x4396b5=_0x574b90['get']({'plain':!![]});var _0x131579=_0x0d8b('0x26');return db[_0x0d8b('0x49')][_0x0d8b('0x43')]({'where':{'name':_0x131579,'userProfileId':_0x371fa0[_0x0d8b('0x4a')]},'raw':!![]})['then'](function(_0x5c0824){if(_0x5c0824&&_0x5c0824['autoAssociation']===0x0){return db['UserProfileResource'][_0x0d8b('0x44')]({'name':_0x4396b5[_0x0d8b('0x28')],'resourceId':_0x4396b5['id'],'type':_0x5c0824['name'],'sectionId':_0x5c0824['id']},{})['then'](function(){return _0x574b90;});}else{return _0x574b90;}})[_0x0d8b('0x3f')](function(_0x3d3cb6){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3d3cb6);throw _0x3d3cb6;});}return _0x574b90;})[_0x0d8b('0x24')](respondWithResult(_0x570af8,0xc9))[_0x0d8b('0x3f')](handleError(_0x570af8,null));};exports[_0x0d8b('0x23')]=function(_0x346c0d,_0x2d5519){if(_0x346c0d['body']['id']){delete _0x346c0d[_0x0d8b('0x45')]['id'];}return db[_0x0d8b('0x2a')]['find']({'where':{'id':_0x346c0d['params']['id']}})[_0x0d8b('0x24')](handleEntityNotFound(_0x2d5519,null))[_0x0d8b('0x24')](saveUpdates(_0x346c0d['body'],null))['then'](respondWithResult(_0x2d5519,null))[_0x0d8b('0x3f')](handleError(_0x2d5519,null));};exports[_0x0d8b('0x25')]=function(_0x377027,_0xb58818){return db['VoiceMail'][_0x0d8b('0x43')]({'where':{'id':_0x377027['params']['id']}})['then'](handleEntityNotFound(_0xb58818,null))[_0x0d8b('0x24')](removeEntity(_0xb58818,null))[_0x0d8b('0x3f')](handleError(_0xb58818,null));};exports['getMessages']=function(_0x4a8f33,_0x44ed23,_0x3d7161){return db[_0x0d8b('0x2a')][_0x0d8b('0x4b')]({'where':{'id':_0x4a8f33[_0x0d8b('0x41')]['id']}})[_0x0d8b('0x24')](handleEntityNotFound(_0x44ed23,null))[_0x0d8b('0x24')](function(_0x3bead7){var _0x5418d8;var _0x24a859={},_0x37dc9f={};_0x37dc9f[_0x0d8b('0x2c')]=_[_0x0d8b('0x2f')](db[_0x0d8b('0x4c')][_0x0d8b('0x4d')]);_0x37dc9f[_0x0d8b('0x2e')]=_[_0x0d8b('0x2f')](_0x4a8f33[_0x0d8b('0x2e')]);_0x37dc9f['filters']=_[_0x0d8b('0x31')](_0x37dc9f[_0x0d8b('0x2c')],_0x37dc9f[_0x0d8b('0x2e')]);_0x24a859[_0x0d8b('0x33')]=_[_0x0d8b('0x31')](_0x37dc9f['model'],qs[_0x0d8b('0x32')](_0x4a8f33[_0x0d8b('0x2e')][_0x0d8b('0x32')]));_0x24a859[_0x0d8b('0x33')]=_0x24a859[_0x0d8b('0x33')]['length']?_0x24a859['attributes']:_0x37dc9f[_0x0d8b('0x2c')];if(!_0x4a8f33[_0x0d8b('0x2e')][_0x0d8b('0x35')](_0x0d8b('0x4e'))){_0x24a859['limit']=qs[_0x0d8b('0x36')](_0x4a8f33[_0x0d8b('0x2e')][_0x0d8b('0x36')]);_0x24a859['offset']=qs[_0x0d8b('0x1c')](_0x4a8f33['query'][_0x0d8b('0x1c')]);}_0x24a859[_0x0d8b('0x4f')]=qs[_0x0d8b('0x37')](_0x4a8f33[_0x0d8b('0x2e')][_0x0d8b('0x37')]);_0x24a859[_0x0d8b('0x38')]=qs['filters'](_[_0x0d8b('0x39')](_0x4a8f33['query'],_0x37dc9f[_0x0d8b('0x30')]));if(_0x4a8f33[_0x0d8b('0x2e')][_0x0d8b('0x3a')]){_0x24a859[_0x0d8b('0x38')]=_['merge'](_0x24a859[_0x0d8b('0x38')],{'$or':_[_0x0d8b('0x2d')](_0x24a859[_0x0d8b('0x33')],function(_0x2332fc){var _0x2ccdae={};_0x2ccdae[_0x2332fc]={'$like':'%'+_0x4a8f33[_0x0d8b('0x2e')][_0x0d8b('0x3a')]+'%'};return _0x2ccdae;})});}_0x24a859[_0x0d8b('0x38')]=_[_0x0d8b('0x3b')](_0x24a859[_0x0d8b('0x38')],{'mailboxuser':_0x3bead7['mailbox']});_0x24a859=_['merge']({},_0x24a859,_0x4a8f33[_0x0d8b('0x42')]);return db[_0x0d8b('0x4c')]['findAndCountAll'](_0x24a859)[_0x0d8b('0x24')](respondWithFilteredResult(_0x44ed23,_0x24a859));})['catch'](handleError(_0x44ed23,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index ae1d045..88b7b84 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 _0x62bd=['voice_voicemail','mailbox_context','context','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceMail.attributes','VoiceMail'];(function(_0x147d25,_0x716e38){var _0x48fa9d=function(_0x4d2f21){while(--_0x4d2f21){_0x147d25['push'](_0x147d25['shift']());}};_0x48fa9d(++_0x716e38);}(_0x62bd,0x9d));var _0xd62b=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x62bd[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xd62b('0x0'));var util=require('util');var logger=require(_0xd62b('0x1'))(_0xd62b('0x2'));var moment=require(_0xd62b('0x3'));var BPromise=require(_0xd62b('0x4'));var rp=require(_0xd62b('0x5'));var fs=require('fs');var path=require(_0xd62b('0x6'));var rimraf=require(_0xd62b('0x7'));var config=require(_0xd62b('0x8'));var attributes=require(_0xd62b('0x9'));module['exports']=function(_0x161c0a,_0x557bbd){return _0x161c0a['define'](_0xd62b('0xa'),attributes,{'tableName':_0xd62b('0xb'),'paranoid':![],'indexes':[{'name':_0xd62b('0xc'),'fields':['mailbox',_0xd62b('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x66bf=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceMail.attributes','exports','define','mailbox_context','mailbox','context','lodash','util','../../config/logger'];(function(_0x49b7dc,_0x357f74){var _0x1ab8a5=function(_0x154613){while(--_0x154613){_0x49b7dc['push'](_0x49b7dc['shift']());}};_0x1ab8a5(++_0x357f74);}(_0x66bf,0xad));var _0xf66b=function(_0x1cb825,_0x909dc6){_0x1cb825=_0x1cb825-0x0;var _0x596088=_0x66bf[_0x1cb825];return _0x596088;};'use strict';var _=require(_0xf66b('0x0'));var util=require(_0xf66b('0x1'));var logger=require(_0xf66b('0x2'))(_0xf66b('0x3'));var moment=require(_0xf66b('0x4'));var BPromise=require(_0xf66b('0x5'));var rp=require(_0xf66b('0x6'));var fs=require('fs');var path=require(_0xf66b('0x7'));var rimraf=require(_0xf66b('0x8'));var config=require(_0xf66b('0x9'));var attributes=require(_0xf66b('0xa'));module[_0xf66b('0xb')]=function(_0x47ffac,_0x37bd4a){return _0x47ffac[_0xf66b('0xc')]('VoiceMail',attributes,{'tableName':'voice_voicemail','paranoid':![],'indexes':[{'name':_0xf66b('0xd'),'fields':[_0xf66b('0xe'),_0xf66b('0xf')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.rpc.js b/server/api/voiceMail/voiceMail.rpc.js index d922573..f5dca52 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 _0x3176=['VoiceMail,\x20%s,\x20%s','message','info','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug','error','code'];(function(_0xf41ec4,_0xe488c1){var _0x5d6815=function(_0x30d90f){while(--_0x30d90f){_0xf41ec4['push'](_0xf41ec4['shift']());}};_0x5d6815(++_0xe488c1);}(_0x3176,0x1e8));var _0x6317=function(_0x2e9de5,_0x22c2cb){_0x2e9de5=_0x2e9de5-0x0;var _0x254b34=_0x3176[_0x2e9de5];return _0x254b34;};'use strict';var _=require(_0x6317('0x0'));var util=require('util');var moment=require(_0x6317('0x1'));var BPromise=require(_0x6317('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6317('0x3'));var db=require(_0x6317('0x4'))['db'];var utils=require(_0x6317('0x5'));var logger=require(_0x6317('0x6'))(_0x6317('0x7'));var config=require(_0x6317('0x8'));var jayson=require(_0x6317('0x9'));var client=jayson[_0x6317('0xa')][_0x6317('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x283e5f,_0xedcce1,_0x5347fd){return new BPromise(function(_0x29bf12,_0xd7c8a3){return client[_0x6317('0xc')](_0x283e5f,_0x5347fd)[_0x6317('0xd')](function(_0x5f1991){logger['info']('VoiceMail,\x20%s,\x20%s',_0xedcce1,_0x6317('0xe'));logger[_0x6317('0xf')]('VoiceMail,\x20%s,\x20%s,\x20%s',_0xedcce1,_0x6317('0xe'),JSON['stringify'](_0x5f1991));if(_0x5f1991[_0x6317('0x10')]){if(_0x5f1991[_0x6317('0x10')][_0x6317('0x11')]===0x1f4){logger['error'](_0x6317('0x12'),_0xedcce1,_0x5f1991[_0x6317('0x10')][_0x6317('0x13')]);return _0xd7c8a3(_0x5f1991[_0x6317('0x10')][_0x6317('0x13')]);}logger[_0x6317('0x10')](_0x6317('0x12'),_0xedcce1,_0x5f1991[_0x6317('0x10')]['message']);return _0x29bf12(_0x5f1991[_0x6317('0x10')][_0x6317('0x13')]);}else{logger[_0x6317('0x14')](_0x6317('0x12'),_0xedcce1,_0x6317('0xe'));_0x29bf12(_0x5f1991['result'][_0x6317('0x13')]);}})[_0x6317('0x15')](function(_0x19d01e){logger[_0x6317('0x10')](_0x6317('0x12'),_0xedcce1,_0x19d01e);_0xd7c8a3(_0x19d01e);});});} \ No newline at end of file +var _0x5ede=['lodash','util','moment','bluebird','ioredis','../../config/utils','rpc','jayson/promise','client','http','request','then','info','request\x20sent','debug','code','error','VoiceMail,\x20%s,\x20%s','message','result'];(function(_0x100a35,_0x3d1535){var _0x461ff=function(_0x47f48d){while(--_0x47f48d){_0x100a35['push'](_0x100a35['shift']());}};_0x461ff(++_0x3d1535);}(_0x5ede,0x1f4));var _0xe5ed=function(_0x10d075,_0x3dcc11){_0x10d075=_0x10d075-0x0;var _0x3d02a8=_0x5ede[_0x10d075];return _0x3d02a8;};'use strict';var _=require(_0xe5ed('0x0'));var util=require(_0xe5ed('0x1'));var moment=require(_0xe5ed('0x2'));var BPromise=require(_0xe5ed('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe5ed('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xe5ed('0x5'));var logger=require('../../config/logger')(_0xe5ed('0x6'));var config=require('../../config/environment');var jayson=require(_0xe5ed('0x7'));var client=jayson[_0xe5ed('0x8')][_0xe5ed('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x52080d,_0x5409a0,_0x4f66c8){return new BPromise(function(_0x3ed024,_0x5b88fd){return client[_0xe5ed('0xa')](_0x52080d,_0x4f66c8)[_0xe5ed('0xb')](function(_0xd02d3f){logger[_0xe5ed('0xc')]('VoiceMail,\x20%s,\x20%s',_0x5409a0,_0xe5ed('0xd'));logger[_0xe5ed('0xe')]('VoiceMail,\x20%s,\x20%s,\x20%s',_0x5409a0,_0xe5ed('0xd'),JSON['stringify'](_0xd02d3f));if(_0xd02d3f['error']){if(_0xd02d3f['error'][_0xe5ed('0xf')]===0x1f4){logger[_0xe5ed('0x10')](_0xe5ed('0x11'),_0x5409a0,_0xd02d3f[_0xe5ed('0x10')][_0xe5ed('0x12')]);return _0x5b88fd(_0xd02d3f[_0xe5ed('0x10')][_0xe5ed('0x12')]);}logger[_0xe5ed('0x10')]('VoiceMail,\x20%s,\x20%s',_0x5409a0,_0xd02d3f[_0xe5ed('0x10')][_0xe5ed('0x12')]);return _0x3ed024(_0xd02d3f[_0xe5ed('0x10')][_0xe5ed('0x12')]);}else{logger[_0xe5ed('0xc')]('VoiceMail,\x20%s,\x20%s',_0x5409a0,_0xe5ed('0xd'));_0x3ed024(_0xd02d3f[_0xe5ed('0x13')][_0xe5ed('0x12')]);}})['catch'](function(_0x5138fb){logger[_0xe5ed('0x10')]('VoiceMail,\x20%s,\x20%s',_0x5409a0,_0x5138fb);_0x5b88fd(_0x5138fb);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index 62072a0..4dd3b2f 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 _0x045c=['path','connect-timeout','express','fs-extra','../../components/auth/service','get','index','/:id','isAuthenticated','show','/:id/download','create','put','update','delete','destroy','exports','multer'];(function(_0x35a274,_0x98b399){var _0x40d905=function(_0x5c8455){while(--_0x5c8455){_0x35a274['push'](_0x35a274['shift']());}};_0x40d905(++_0x98b399);}(_0x045c,0x155));var _0xc045=function(_0x487b0c,_0x14ff74){_0x487b0c=_0x487b0c-0x0;var _0x1adbdc=_0x045c[_0x487b0c];return _0x1adbdc;};'use strict';var multer=require(_0xc045('0x0'));var util=require('util');var path=require(_0xc045('0x1'));var timeout=require(_0xc045('0x2'));var express=require(_0xc045('0x3'));var router=express['Router']();var fs_extra=require(_0xc045('0x4'));var auth=require(_0xc045('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./voiceMailMessage.controller');router[_0xc045('0x6')]('/',auth['isAuthenticated'](),controller[_0xc045('0x7')]);router[_0xc045('0x6')](_0xc045('0x8'),auth[_0xc045('0x9')](),controller[_0xc045('0xa')]);router['get'](_0xc045('0xb'),auth[_0xc045('0x9')](),controller['download']);router['post']('/',auth['isAuthenticated'](),controller[_0xc045('0xc')]);router[_0xc045('0xd')](_0xc045('0x8'),auth[_0xc045('0x9')](),controller[_0xc045('0xe')]);router[_0xc045('0xf')]('/:id',auth[_0xc045('0x9')](),controller[_0xc045('0x10')]);module[_0xc045('0x11')]=router; \ No newline at end of file +var _0x6902=['exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMailMessage.controller','get','isAuthenticated','index','/:id','show','/:id/download','download','post','put','delete','destroy'];(function(_0x1ebf9f,_0x25ffcb){var _0x117e9c=function(_0x36824c){while(--_0x36824c){_0x1ebf9f['push'](_0x1ebf9f['shift']());}};_0x117e9c(++_0x25ffcb);}(_0x6902,0xd3));var _0x2690=function(_0xe4bd87,_0xc7aeb3){_0xe4bd87=_0xe4bd87-0x0;var _0x4b6634=_0x6902[_0xe4bd87];return _0x4b6634;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x2690('0x0'));var timeout=require(_0x2690('0x1'));var express=require(_0x2690('0x2'));var router=express[_0x2690('0x3')]();var fs_extra=require(_0x2690('0x4'));var auth=require(_0x2690('0x5'));var interaction=require(_0x2690('0x6'));var config=require(_0x2690('0x7'));var controller=require(_0x2690('0x8'));router[_0x2690('0x9')]('/',auth[_0x2690('0xa')](),controller[_0x2690('0xb')]);router[_0x2690('0x9')](_0x2690('0xc'),auth[_0x2690('0xa')](),controller[_0x2690('0xd')]);router[_0x2690('0x9')](_0x2690('0xe'),auth['isAuthenticated'](),controller[_0x2690('0xf')]);router[_0x2690('0x10')]('/',auth['isAuthenticated'](),controller['create']);router[_0x2690('0x11')](_0x2690('0xc'),auth[_0x2690('0xa')](),controller['update']);router[_0x2690('0x12')](_0x2690('0xc'),auth[_0x2690('0xa')](),controller[_0x2690('0x13')]);module[_0x2690('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.attributes.js b/server/api/voiceMailMessage/voiceMailMessage.attributes.js index ac1c16d..8fb659c 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 _0x1b95=['BLOB','TIMESTAMP','literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','exports','VIRTUAL','INTEGER','STRING'];(function(_0x3a631c,_0x7d1a20){var _0x1efa91=function(_0x538773){while(--_0x538773){_0x3a631c['push'](_0x3a631c['shift']());}};_0x1efa91(++_0x7d1a20);}(_0x1b95,0x15c));var _0x51b9=function(_0x4e1d03,_0x786f3a){_0x4e1d03=_0x4e1d03-0x0;var _0x362d4b=_0x1b95[_0x4e1d03];return _0x362d4b;};'use strict';var Sequelize=require('sequelize');module[_0x51b9('0x0')]={'name':{'type':Sequelize[_0x51b9('0x1')],'get':function(_0xd5c1fd){return this['getDataValue']('id');}},'msgnum':{'type':Sequelize[_0x51b9('0x2')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0x51b9('0x3')],'defaultValue':''},'context':{'type':Sequelize['STRING'],'defaultValue':''},'macrocontext':{'type':Sequelize['STRING'],'defaultValue':''},'callerid':{'type':Sequelize[_0x51b9('0x3')],'defaultValue':''},'origtime':{'type':Sequelize[_0x51b9('0x3')],'defaultValue':''},'duration':{'type':Sequelize[_0x51b9('0x3')],'defaultValue':''},'mailboxuser':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxcontext':{'type':Sequelize['STRING'],'defaultValue':''},'recording':{'type':Sequelize[_0x51b9('0x4')]('long'),'defaultValue':null},'flag':{'type':Sequelize[_0x51b9('0x3')],'defaultValue':''},'msg_id':{'type':Sequelize[_0x51b9('0x3')],'defaultValue':''},'stamp':{'type':_0x51b9('0x5'),'defaultValue':Sequelize[_0x51b9('0x6')](_0x51b9('0x7'))}}; \ No newline at end of file +var _0x6543=['long','TIMESTAMP','literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','exports','VIRTUAL','INTEGER','STRING','BLOB'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6543,0x67));var _0x3654=function(_0x216c1a,_0x143016){_0x216c1a=_0x216c1a-0x0;var _0x4fe434=_0x6543[_0x216c1a];return _0x4fe434;};'use strict';var Sequelize=require('sequelize');module[_0x3654('0x0')]={'name':{'type':Sequelize[_0x3654('0x1')],'get':function(_0x3c26ee){return this['getDataValue']('id');}},'msgnum':{'type':Sequelize[_0x3654('0x2')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0x3654('0x3')],'defaultValue':''},'context':{'type':Sequelize['STRING'],'defaultValue':''},'macrocontext':{'type':Sequelize['STRING'],'defaultValue':''},'callerid':{'type':Sequelize[_0x3654('0x3')],'defaultValue':''},'origtime':{'type':Sequelize['STRING'],'defaultValue':''},'duration':{'type':Sequelize[_0x3654('0x3')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0x3654('0x3')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0x3654('0x3')],'defaultValue':''},'recording':{'type':Sequelize[_0x3654('0x4')](_0x3654('0x5')),'defaultValue':null},'flag':{'type':Sequelize[_0x3654('0x3')],'defaultValue':''},'msg_id':{'type':Sequelize[_0x3654('0x3')],'defaultValue':''},'stamp':{'type':_0x3654('0x6'),'defaultValue':Sequelize[_0x3654('0x7')](_0x3654('0x8'))}}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.controller.js b/server/api/voiceMailMessage/voiceMailMessage.controller.js index e2f70cf..f36da7e 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 _0x10af=['VoiceMailMessage','rawAttributes','fieldName','type','key','query','keys','intersection','attributes','model','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','fields','length','options','find','body','download','recording','msg_id','Sequelize','ValidationError','VoiceMailMessage\x20not\x20found','Content-Disposition','attachment;\x20filename=\x22','.wav\x22','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map'];(function(_0x2f5a22,_0x5e9f03){var _0x326b70=function(_0x1b7bf9){while(--_0x1b7bf9){_0x2f5a22['push'](_0x2f5a22['shift']());}};_0x326b70(++_0x5e9f03);}(_0x10af,0xdd));var _0xf10a=function(_0x2dadb9,_0x42cfe6){_0x2dadb9=_0x2dadb9-0x0;var _0x2f0097=_0x10af[_0x2dadb9];return _0x2f0097;};'use strict';var emlformat=require(_0xf10a('0x0'));var rimraf=require(_0xf10a('0x1'));var zipdir=require(_0xf10a('0x2'));var jsonpatch=require(_0xf10a('0x3'));var rp=require(_0xf10a('0x4'));var moment=require(_0xf10a('0x5'));var BPromise=require(_0xf10a('0x6'));var Mustache=require(_0xf10a('0x7'));var util=require(_0xf10a('0x8'));var path=require(_0xf10a('0x9'));var sox=require(_0xf10a('0xa'));var csv=require(_0xf10a('0xb'));var ejs=require(_0xf10a('0xc'));var fs=require('fs');var fs_extra=require(_0xf10a('0xd'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xf10a('0xe'));var jsforce=require(_0xf10a('0xf'));var deskjs=require(_0xf10a('0x10'));var toCsv=require(_0xf10a('0xb'));var querystring=require(_0xf10a('0x11'));var Papa=require(_0xf10a('0x12'));var Redis=require(_0xf10a('0x13'));var authService=require(_0xf10a('0x14'));var qs=require(_0xf10a('0x15'));var as=require(_0xf10a('0x16'));var hardwareService=require(_0xf10a('0x17'));var logger=require('../../config/logger')('api');var utils=require(_0xf10a('0x18'));var config=require(_0xf10a('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xf10a('0x1a'))['db'];function respondWithStatusCode(_0x5b9a19,_0x1e5853){_0x1e5853=_0x1e5853||0xcc;return function(_0x5bae6a){if(_0x5bae6a){return _0x5b9a19[_0xf10a('0x1b')](_0x1e5853);}return _0x5b9a19[_0xf10a('0x1c')](_0x1e5853)[_0xf10a('0x1d')]();};}function respondWithResult(_0x452bb3,_0x2ff4d7){_0x2ff4d7=_0x2ff4d7||0xc8;return function(_0x180a06){if(_0x180a06){return _0x452bb3['status'](_0x2ff4d7)[_0xf10a('0x1e')](_0x180a06);}};}function respondWithFilteredResult(_0x469329,_0x407bcf){return function(_0x59ddb7){if(_0x59ddb7){var _0x4e2e47=typeof _0x407bcf['offset']===_0xf10a('0x1f')&&typeof _0x407bcf[_0xf10a('0x20')]===_0xf10a('0x1f');var _0x5b997a=_0x59ddb7[_0xf10a('0x21')];var _0x1e3cd8=_0x4e2e47?0x0:_0x407bcf[_0xf10a('0x22')];var _0x2d9242=_0x4e2e47?_0x59ddb7[_0xf10a('0x21')]:_0x407bcf[_0xf10a('0x22')]+_0x407bcf['limit'];var _0x450e85;if(_0x2d9242>=_0x5b997a){_0x2d9242=_0x5b997a;_0x450e85=0xc8;}else{_0x450e85=0xce;}_0x469329['status'](_0x450e85);return _0x469329[_0xf10a('0x23')](_0xf10a('0x24'),_0x1e3cd8+'-'+_0x2d9242+'/'+_0x5b997a)[_0xf10a('0x1e')](_0x59ddb7);}return null;};}function patchUpdates(_0x319832){return function(_0x15fd02){try{jsonpatch[_0xf10a('0x25')](_0x15fd02,_0x319832,!![]);}catch(_0x5e9702){return BPromise[_0xf10a('0x26')](_0x5e9702);}return _0x15fd02[_0xf10a('0x27')]();};}function saveUpdates(_0x1279a8,_0x5d5fc3){return function(_0x15c0b2){if(_0x15c0b2){return _0x15c0b2[_0xf10a('0x28')](_0x1279a8)[_0xf10a('0x29')](function(_0x4c29ee){return _0x4c29ee;});}return null;};}function removeEntity(_0x335e32,_0x40bc52){return function(_0x39082a){if(_0x39082a){return _0x39082a[_0xf10a('0x2a')]()[_0xf10a('0x29')](function(){_0x335e32[_0xf10a('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1ad03b,_0x2dab73){return function(_0x5bed73){if(!_0x5bed73){_0x1ad03b[_0xf10a('0x1b')](0x194);}return _0x5bed73;};}function handleError(_0x42bd0e,_0x3f4b98){_0x3f4b98=_0x3f4b98||0x1f4;return function(_0x5b09b0){logger[_0xf10a('0x2b')](_0x5b09b0[_0xf10a('0x2c')]);if(_0x5b09b0[_0xf10a('0x2d')]){delete _0x5b09b0['name'];}_0x42bd0e[_0xf10a('0x1c')](_0x3f4b98)[_0xf10a('0x2e')](_0x5b09b0);};}exports[_0xf10a('0x2f')]=function(_0xfaad35,_0x4db3c4){var _0x2d5a59={},_0x3388a2={},_0x41abfc={'count':0x0,'rows':[]};var _0x1d692a=_[_0xf10a('0x30')](db[_0xf10a('0x31')][_0xf10a('0x32')],function(_0x2afd9e){return{'name':_0x2afd9e[_0xf10a('0x33')],'type':_0x2afd9e[_0xf10a('0x34')][_0xf10a('0x35')]};});_0x3388a2['model']=_['differenceBy'](_[_0xf10a('0x30')](_0x1d692a,_0xf10a('0x2d')),['name']);_0x3388a2[_0xf10a('0x36')]=_[_0xf10a('0x37')](_0xfaad35[_0xf10a('0x36')]);_0x3388a2['filters']=_[_0xf10a('0x38')](_0x3388a2['model'],_0x3388a2[_0xf10a('0x36')]);_0x2d5a59[_0xf10a('0x39')]=_[_0xf10a('0x38')](_0x3388a2[_0xf10a('0x3a')],qs['fields'](_0xfaad35[_0xf10a('0x36')]['fields']));_0x2d5a59[_0xf10a('0x39')]=_0x2d5a59[_0xf10a('0x39')]['length']?_0x2d5a59['attributes']:_0x3388a2['model'];if(!_0xfaad35[_0xf10a('0x36')][_0xf10a('0x3b')](_0xf10a('0x3c'))){_0x2d5a59[_0xf10a('0x20')]=qs[_0xf10a('0x20')](_0xfaad35[_0xf10a('0x36')][_0xf10a('0x20')]);_0x2d5a59[_0xf10a('0x22')]=qs[_0xf10a('0x22')](_0xfaad35[_0xf10a('0x36')][_0xf10a('0x22')]);}_0x2d5a59[_0xf10a('0x3d')]=qs[_0xf10a('0x3e')](_0xfaad35[_0xf10a('0x36')][_0xf10a('0x3e')]);_0x2d5a59[_0xf10a('0x3f')]=qs[_0xf10a('0x40')](_[_0xf10a('0x41')](_0xfaad35[_0xf10a('0x36')],_0x3388a2[_0xf10a('0x40')]),_0x1d692a);if(_0xfaad35['query'][_0xf10a('0x42')]){_0x2d5a59[_0xf10a('0x3f')]=_[_0xf10a('0x43')](_0x2d5a59[_0xf10a('0x3f')],{'$or':_[_0xf10a('0x30')](_0x1d692a,function(_0x2bc787){if(_0x2bc787[_0xf10a('0x34')]!==_0xf10a('0x44')){var _0x319cac={};_0x319cac[_0x2bc787['name']]={'$like':'%'+_0xfaad35['query'][_0xf10a('0x42')]+'%'};return _0x319cac;}})});}_0x2d5a59=_['merge']({},_0x2d5a59,_0xfaad35['options']);var _0xab8cf7={'where':_0x2d5a59[_0xf10a('0x3f')]};return db[_0xf10a('0x31')]['count'](_0xab8cf7)[_0xf10a('0x29')](function(_0x45ae20){_0x41abfc[_0xf10a('0x21')]=_0x45ae20;if(_0xfaad35[_0xf10a('0x36')][_0xf10a('0x45')]){_0x2d5a59[_0xf10a('0x46')]=[{'all':!![]}];}return db['VoiceMailMessage'][_0xf10a('0x47')](_0x2d5a59);})[_0xf10a('0x29')](function(_0x2ae119){_0x41abfc[_0xf10a('0x48')]=_0x2ae119;return _0x41abfc;})[_0xf10a('0x29')](respondWithFilteredResult(_0x4db3c4,_0x2d5a59))[_0xf10a('0x49')](handleError(_0x4db3c4,null));};exports[_0xf10a('0x4a')]=function(_0x32cd8d,_0x44ae35){var _0x4a325c={'raw':!![],'where':{'id':_0x32cd8d[_0xf10a('0x4b')]['id']}},_0x57cc9a={};_0x57cc9a['model']=_[_0xf10a('0x37')](db[_0xf10a('0x31')][_0xf10a('0x32')]);_0x57cc9a[_0xf10a('0x36')]=_[_0xf10a('0x37')](_0x32cd8d[_0xf10a('0x36')]);_0x57cc9a[_0xf10a('0x40')]=_[_0xf10a('0x38')](_0x57cc9a[_0xf10a('0x3a')],_0x57cc9a[_0xf10a('0x36')]);_0x4a325c[_0xf10a('0x39')]=_[_0xf10a('0x38')](_0x57cc9a['model'],qs[_0xf10a('0x4c')](_0x32cd8d[_0xf10a('0x36')]['fields']));_0x4a325c[_0xf10a('0x39')]=_0x4a325c[_0xf10a('0x39')][_0xf10a('0x4d')]?_0x4a325c[_0xf10a('0x39')]:_0x57cc9a[_0xf10a('0x3a')];if(_0x32cd8d[_0xf10a('0x36')]['includeAll']){_0x4a325c['include']=[{'all':!![]}];}_0x4a325c=_[_0xf10a('0x43')]({},_0x4a325c,_0x32cd8d[_0xf10a('0x4e')]);return db['VoiceMailMessage'][_0xf10a('0x4f')](_0x4a325c)[_0xf10a('0x29')](handleEntityNotFound(_0x44ae35,null))[_0xf10a('0x29')](respondWithResult(_0x44ae35,null))[_0xf10a('0x49')](handleError(_0x44ae35,null));};exports['create']=function(_0x467bbf,_0x57484e){return db['VoiceMailMessage']['create'](_0x467bbf[_0xf10a('0x50')],{})[_0xf10a('0x29')](respondWithResult(_0x57484e,0xc9))[_0xf10a('0x49')](handleError(_0x57484e,null));};exports['update']=function(_0x5c643c,_0x5127f9){if(_0x5c643c[_0xf10a('0x50')]['id']){delete _0x5c643c[_0xf10a('0x50')]['id'];}return db[_0xf10a('0x31')][_0xf10a('0x4f')]({'where':{'id':_0x5c643c['params']['id']}})['then'](handleEntityNotFound(_0x5127f9,null))[_0xf10a('0x29')](saveUpdates(_0x5c643c['body'],null))['then'](respondWithResult(_0x5127f9,null))['catch'](handleError(_0x5127f9,null));};exports[_0xf10a('0x2a')]=function(_0x4e2323,_0x1c0b88){return db['VoiceMailMessage'][_0xf10a('0x4f')]({'where':{'id':_0x4e2323[_0xf10a('0x4b')]['id']}})[_0xf10a('0x29')](handleEntityNotFound(_0x1c0b88,null))[_0xf10a('0x29')](removeEntity(_0x1c0b88,null))[_0xf10a('0x49')](handleError(_0x1c0b88,null));};exports[_0xf10a('0x51')]=function(_0x573091,_0x311c81,_0x569fe2){return db[_0xf10a('0x31')]['find']({'where':{'id':_0x573091[_0xf10a('0x4b')]['id']},'attributes':['id',_0xf10a('0x52'),_0xf10a('0x53')]})[_0xf10a('0x29')](handleEntityNotFound(_0x311c81,null))[_0xf10a('0x29')](function(_0x61334a){if(_0x61334a){if(!_0x61334a[_0xf10a('0x52')]){throw new db[(_0xf10a('0x54'))][(_0xf10a('0x55'))](_0xf10a('0x56'));}var _0x52b4ec={'Content-Type':'audio/wav','Content-Disposition':'attachment'};if(_0x61334a['msg_id']){_0x52b4ec[_0xf10a('0x57')]=_0xf10a('0x58')+_0x61334a['msg_id']+_0xf10a('0x59');}_0x311c81['set'](_0x52b4ec);return _0x311c81[_0xf10a('0x2e')](new Buffer(_0x61334a[_0xf10a('0x52')]));}})['catch'](handleError(_0x311c81,null));}; \ No newline at end of file +var _0x375a=['audio/wav','attachment','attachment;\x20filename=\x22','.wav\x22','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','index','map','VoiceMailMessage','rawAttributes','fieldName','model','keys','filters','query','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','includeAll','rows','show','params','find','catch','create','body','destroy','download','msg_id','recording','ValidationError','VoiceMailMessage\x20not\x20found'];(function(_0x4e428f,_0x2f2bb6){var _0x42bf97=function(_0x133510){while(--_0x133510){_0x4e428f['push'](_0x4e428f['shift']());}};_0x42bf97(++_0x2f2bb6);}(_0x375a,0xfa));var _0xa375=function(_0x193609,_0x1a2a6f){_0x193609=_0x193609-0x0;var _0x33278c=_0x375a[_0x193609];return _0x33278c;};'use strict';var emlformat=require(_0xa375('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa375('0x1'));var jsonpatch=require(_0xa375('0x2'));var rp=require(_0xa375('0x3'));var moment=require(_0xa375('0x4'));var BPromise=require(_0xa375('0x5'));var Mustache=require(_0xa375('0x6'));var util=require(_0xa375('0x7'));var path=require('path');var sox=require(_0xa375('0x8'));var csv=require(_0xa375('0x9'));var ejs=require(_0xa375('0xa'));var fs=require('fs');var fs_extra=require(_0xa375('0xb'));var _=require('lodash');var squel=require(_0xa375('0xc'));var crypto=require(_0xa375('0xd'));var jsforce=require(_0xa375('0xe'));var deskjs=require(_0xa375('0xf'));var toCsv=require(_0xa375('0x9'));var querystring=require(_0xa375('0x10'));var Papa=require(_0xa375('0x11'));var Redis=require('ioredis');var authService=require(_0xa375('0x12'));var qs=require(_0xa375('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xa375('0x14'))(_0xa375('0x15'));var utils=require(_0xa375('0x16'));var config=require(_0xa375('0x17'));var licenseUtil=require(_0xa375('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1cb634,_0x1a2a78){_0x1a2a78=_0x1a2a78||0xcc;return function(_0x2e7f2b){if(_0x2e7f2b){return _0x1cb634[_0xa375('0x19')](_0x1a2a78);}return _0x1cb634[_0xa375('0x1a')](_0x1a2a78)[_0xa375('0x1b')]();};}function respondWithResult(_0x4484ce,_0x32b91e){_0x32b91e=_0x32b91e||0xc8;return function(_0x172c4b){if(_0x172c4b){return _0x4484ce[_0xa375('0x1a')](_0x32b91e)[_0xa375('0x1c')](_0x172c4b);}};}function respondWithFilteredResult(_0x15d3fc,_0x5b578c){return function(_0x4979e7){if(_0x4979e7){var _0x3f4521=typeof _0x5b578c[_0xa375('0x1d')]===_0xa375('0x1e')&&typeof _0x5b578c[_0xa375('0x1f')]==='undefined';var _0x343af9=_0x4979e7[_0xa375('0x20')];var _0x34de7f=_0x3f4521?0x0:_0x5b578c['offset'];var _0x2c59a7=_0x3f4521?_0x4979e7['count']:_0x5b578c['offset']+_0x5b578c['limit'];var _0x4169f6;if(_0x2c59a7>=_0x343af9){_0x2c59a7=_0x343af9;_0x4169f6=0xc8;}else{_0x4169f6=0xce;}_0x15d3fc[_0xa375('0x1a')](_0x4169f6);return _0x15d3fc[_0xa375('0x21')](_0xa375('0x22'),_0x34de7f+'-'+_0x2c59a7+'/'+_0x343af9)[_0xa375('0x1c')](_0x4979e7);}return null;};}function patchUpdates(_0x5e002d){return function(_0x41262d){try{jsonpatch[_0xa375('0x23')](_0x41262d,_0x5e002d,!![]);}catch(_0x2e9796){return BPromise[_0xa375('0x24')](_0x2e9796);}return _0x41262d[_0xa375('0x25')]();};}function saveUpdates(_0xe844b3,_0x59ae10){return function(_0x4fe578){if(_0x4fe578){return _0x4fe578[_0xa375('0x26')](_0xe844b3)[_0xa375('0x27')](function(_0x48ad42){return _0x48ad42;});}return null;};}function removeEntity(_0x5bb376,_0x3c9e6b){return function(_0x45470c){if(_0x45470c){return _0x45470c['destroy']()[_0xa375('0x27')](function(){_0x5bb376['status'](0xcc)[_0xa375('0x1b')]();});}};}function handleEntityNotFound(_0x4b2c16,_0x205abf){return function(_0x334439){if(!_0x334439){_0x4b2c16[_0xa375('0x19')](0x194);}return _0x334439;};}function handleError(_0x45c85e,_0x31d22e){_0x31d22e=_0x31d22e||0x1f4;return function(_0x3f1c4b){logger[_0xa375('0x28')](_0x3f1c4b[_0xa375('0x29')]);if(_0x3f1c4b[_0xa375('0x2a')]){delete _0x3f1c4b['name'];}_0x45c85e['status'](_0x31d22e)[_0xa375('0x2b')](_0x3f1c4b);};}exports[_0xa375('0x2c')]=function(_0x3cb1f4,_0x58c53d){var _0x39ee62={},_0x1697a7={},_0x3e74fb={'count':0x0,'rows':[]};var _0x333827=_[_0xa375('0x2d')](db[_0xa375('0x2e')][_0xa375('0x2f')],function(_0x2b7a62){return{'name':_0x2b7a62[_0xa375('0x30')],'type':_0x2b7a62['type']['key']};});_0x1697a7[_0xa375('0x31')]=_['differenceBy'](_['map'](_0x333827,'name'),['name']);_0x1697a7['query']=_[_0xa375('0x32')](_0x3cb1f4['query']);_0x1697a7[_0xa375('0x33')]=_['intersection'](_0x1697a7[_0xa375('0x31')],_0x1697a7[_0xa375('0x34')]);_0x39ee62[_0xa375('0x35')]=_[_0xa375('0x36')](_0x1697a7[_0xa375('0x31')],qs[_0xa375('0x37')](_0x3cb1f4[_0xa375('0x34')][_0xa375('0x37')]));_0x39ee62[_0xa375('0x35')]=_0x39ee62[_0xa375('0x35')][_0xa375('0x38')]?_0x39ee62[_0xa375('0x35')]:_0x1697a7[_0xa375('0x31')];if(!_0x3cb1f4[_0xa375('0x34')][_0xa375('0x39')]('nolimit')){_0x39ee62['limit']=qs[_0xa375('0x1f')](_0x3cb1f4[_0xa375('0x34')][_0xa375('0x1f')]);_0x39ee62[_0xa375('0x1d')]=qs[_0xa375('0x1d')](_0x3cb1f4[_0xa375('0x34')][_0xa375('0x1d')]);}_0x39ee62[_0xa375('0x3a')]=qs[_0xa375('0x3b')](_0x3cb1f4[_0xa375('0x34')]['sort']);_0x39ee62[_0xa375('0x3c')]=qs[_0xa375('0x33')](_[_0xa375('0x3d')](_0x3cb1f4[_0xa375('0x34')],_0x1697a7['filters']),_0x333827);if(_0x3cb1f4[_0xa375('0x34')][_0xa375('0x3e')]){_0x39ee62[_0xa375('0x3c')]=_[_0xa375('0x3f')](_0x39ee62[_0xa375('0x3c')],{'$or':_[_0xa375('0x2d')](_0x333827,function(_0x2b899d){if(_0x2b899d['type']!=='VIRTUAL'){var _0x5f251a={};_0x5f251a[_0x2b899d[_0xa375('0x2a')]]={'$like':'%'+_0x3cb1f4[_0xa375('0x34')]['filter']+'%'};return _0x5f251a;}})});}_0x39ee62=_[_0xa375('0x3f')]({},_0x39ee62,_0x3cb1f4['options']);var _0x1db146={'where':_0x39ee62['where']};return db[_0xa375('0x2e')][_0xa375('0x20')](_0x1db146)[_0xa375('0x27')](function(_0x4cea86){_0x3e74fb['count']=_0x4cea86;if(_0x3cb1f4['query'][_0xa375('0x40')]){_0x39ee62['include']=[{'all':!![]}];}return db[_0xa375('0x2e')]['findAll'](_0x39ee62);})[_0xa375('0x27')](function(_0x4c436d){_0x3e74fb[_0xa375('0x41')]=_0x4c436d;return _0x3e74fb;})[_0xa375('0x27')](respondWithFilteredResult(_0x58c53d,_0x39ee62))['catch'](handleError(_0x58c53d,null));};exports[_0xa375('0x42')]=function(_0x5f3e02,_0x2783a7){var _0x3e71c4={'raw':!![],'where':{'id':_0x5f3e02[_0xa375('0x43')]['id']}},_0x4132d5={};_0x4132d5['model']=_['keys'](db[_0xa375('0x2e')][_0xa375('0x2f')]);_0x4132d5[_0xa375('0x34')]=_[_0xa375('0x32')](_0x5f3e02['query']);_0x4132d5['filters']=_[_0xa375('0x36')](_0x4132d5['model'],_0x4132d5[_0xa375('0x34')]);_0x3e71c4['attributes']=_['intersection'](_0x4132d5[_0xa375('0x31')],qs[_0xa375('0x37')](_0x5f3e02[_0xa375('0x34')][_0xa375('0x37')]));_0x3e71c4[_0xa375('0x35')]=_0x3e71c4[_0xa375('0x35')]['length']?_0x3e71c4['attributes']:_0x4132d5[_0xa375('0x31')];if(_0x5f3e02[_0xa375('0x34')][_0xa375('0x40')]){_0x3e71c4['include']=[{'all':!![]}];}_0x3e71c4=_['merge']({},_0x3e71c4,_0x5f3e02['options']);return db[_0xa375('0x2e')][_0xa375('0x44')](_0x3e71c4)[_0xa375('0x27')](handleEntityNotFound(_0x2783a7,null))[_0xa375('0x27')](respondWithResult(_0x2783a7,null))[_0xa375('0x45')](handleError(_0x2783a7,null));};exports[_0xa375('0x46')]=function(_0x1d9fb3,_0x391102){return db['VoiceMailMessage'][_0xa375('0x46')](_0x1d9fb3[_0xa375('0x47')],{})[_0xa375('0x27')](respondWithResult(_0x391102,0xc9))[_0xa375('0x45')](handleError(_0x391102,null));};exports[_0xa375('0x26')]=function(_0x4026fe,_0x461e89){if(_0x4026fe[_0xa375('0x47')]['id']){delete _0x4026fe[_0xa375('0x47')]['id'];}return db['VoiceMailMessage'][_0xa375('0x44')]({'where':{'id':_0x4026fe[_0xa375('0x43')]['id']}})[_0xa375('0x27')](handleEntityNotFound(_0x461e89,null))[_0xa375('0x27')](saveUpdates(_0x4026fe[_0xa375('0x47')],null))[_0xa375('0x27')](respondWithResult(_0x461e89,null))['catch'](handleError(_0x461e89,null));};exports[_0xa375('0x48')]=function(_0x5f178d,_0x1ffb88){return db[_0xa375('0x2e')][_0xa375('0x44')]({'where':{'id':_0x5f178d[_0xa375('0x43')]['id']}})[_0xa375('0x27')](handleEntityNotFound(_0x1ffb88,null))['then'](removeEntity(_0x1ffb88,null))[_0xa375('0x45')](handleError(_0x1ffb88,null));};exports[_0xa375('0x49')]=function(_0x283b63,_0x30aa7c,_0x3a10e0){return db[_0xa375('0x2e')][_0xa375('0x44')]({'where':{'id':_0x283b63[_0xa375('0x43')]['id']},'attributes':['id','recording',_0xa375('0x4a')]})[_0xa375('0x27')](handleEntityNotFound(_0x30aa7c,null))[_0xa375('0x27')](function(_0x82ad9e){if(_0x82ad9e){if(!_0x82ad9e[_0xa375('0x4b')]){throw new db['Sequelize'][(_0xa375('0x4c'))](_0xa375('0x4d'));}var _0x3d94a6={'Content-Type':_0xa375('0x4e'),'Content-Disposition':_0xa375('0x4f')};if(_0x82ad9e[_0xa375('0x4a')]){_0x3d94a6['Content-Disposition']=_0xa375('0x50')+_0x82ad9e['msg_id']+_0xa375('0x51');}_0x30aa7c[_0xa375('0x21')](_0x3d94a6);return _0x30aa7c[_0xa375('0x2b')](new Buffer(_0x82ad9e['recording']));}})['catch'](handleError(_0x30aa7c,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index 291dc03..65e481b 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 _0x3b1e=['voice_voicemail_messages','dir','../../config/logger','bluebird','request-promise','exports','define'];(function(_0x2b6d59,_0x595871){var _0x1e6a3c=function(_0x35e498){while(--_0x35e498){_0x2b6d59['push'](_0x2b6d59['shift']());}};_0x1e6a3c(++_0x595871);}(_0x3b1e,0x79));var _0xe3b1=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x3b1e[_0xfae23b];return _0x200640;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xe3b1('0x0'))('api');var moment=require('moment');var BPromise=require(_0xe3b1('0x1'));var rp=require(_0xe3b1('0x2'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./voiceMailMessage.attributes');module[_0xe3b1('0x3')]=function(_0x15e3da,_0x4bacc7){return _0x15e3da[_0xe3b1('0x4')]('VoiceMailMessage',attributes,{'tableName':_0xe3b1('0x5'),'paranoid':![],'indexes':[{'name':_0xe3b1('0x6'),'fields':['dir']}],'timestamps':![]});}; \ No newline at end of file +var _0x5a9f=['../../config/logger','api','path','rimraf','exports','define','VoiceMailMessage','voice_voicemail_messages','dir','lodash','util'];(function(_0x301921,_0x10029f){var _0xd82511=function(_0x4f852b){while(--_0x4f852b){_0x301921['push'](_0x301921['shift']());}};_0xd82511(++_0x10029f);}(_0x5a9f,0x1d7));var _0xf5a9=function(_0x59b599,_0x31b773){_0x59b599=_0x59b599-0x0;var _0x45ee08=_0x5a9f[_0x59b599];return _0x45ee08;};'use strict';var _=require(_0xf5a9('0x0'));var util=require(_0xf5a9('0x1'));var logger=require(_0xf5a9('0x2'))(_0xf5a9('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xf5a9('0x4'));var rimraf=require(_0xf5a9('0x5'));var config=require('../../config/environment');var attributes=require('./voiceMailMessage.attributes');module[_0xf5a9('0x6')]=function(_0x5eec7d,_0x2f3bc7){return _0x5eec7d[_0xf5a9('0x7')](_0xf5a9('0x8'),attributes,{'tableName':_0xf5a9('0x9'),'paranoid':![],'indexes':[{'name':_0xf5a9('0xa'),'fields':['dir']}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.rpc.js b/server/api/voiceMailMessage/voiceMailMessage.rpc.js index 6493d60..791a6e6 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 _0x9c9a=['request','then','info','VoiceMailMessage,\x20%s,\x20%s','debug','VoiceMailMessage,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http'];(function(_0x386394,_0x543996){var _0x4f8d51=function(_0x4b7ae4){while(--_0x4b7ae4){_0x386394['push'](_0x386394['shift']());}};_0x4f8d51(++_0x543996);}(_0x9c9a,0xa2));var _0xa9c9=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9c9a[_0x1facfa];return _0x9ec701;};'use strict';var _=require(_0xa9c9('0x0'));var util=require(_0xa9c9('0x1'));var moment=require(_0xa9c9('0x2'));var BPromise=require(_0xa9c9('0x3'));var rs=require(_0xa9c9('0x4'));var fs=require('fs');var Redis=require(_0xa9c9('0x5'));var db=require(_0xa9c9('0x6'))['db'];var utils=require(_0xa9c9('0x7'));var logger=require(_0xa9c9('0x8'))(_0xa9c9('0x9'));var config=require(_0xa9c9('0xa'));var jayson=require('jayson/promise');var client=jayson[_0xa9c9('0xb')][_0xa9c9('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4733d8,_0x216276,_0x29ece2){return new BPromise(function(_0x567f96,_0x1724b9){return client[_0xa9c9('0xd')](_0x4733d8,_0x29ece2)[_0xa9c9('0xe')](function(_0x1852b4){logger[_0xa9c9('0xf')](_0xa9c9('0x10'),_0x216276,'request\x20sent');logger[_0xa9c9('0x11')](_0xa9c9('0x12'),_0x216276,_0xa9c9('0x13'),JSON['stringify'](_0x1852b4));if(_0x1852b4[_0xa9c9('0x14')]){if(_0x1852b4['error'][_0xa9c9('0x15')]===0x1f4){logger[_0xa9c9('0x14')]('VoiceMailMessage,\x20%s,\x20%s',_0x216276,_0x1852b4['error']['message']);return _0x1724b9(_0x1852b4[_0xa9c9('0x14')]['message']);}logger[_0xa9c9('0x14')]('VoiceMailMessage,\x20%s,\x20%s',_0x216276,_0x1852b4[_0xa9c9('0x14')][_0xa9c9('0x16')]);return _0x567f96(_0x1852b4[_0xa9c9('0x14')]['message']);}else{logger['info'](_0xa9c9('0x10'),_0x216276,'request\x20sent');_0x567f96(_0x1852b4[_0xa9c9('0x17')]['message']);}})[_0xa9c9('0x18')](function(_0x28e35d){logger[_0xa9c9('0x14')](_0xa9c9('0x10'),_0x216276,_0x28e35d);_0x1724b9(_0x28e35d);});});} \ No newline at end of file +var _0x7f18=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','VoiceMailMessage,\x20%s,\x20%s','request\x20sent','debug','VoiceMailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird'];(function(_0x209941,_0x5c9988){var _0x1e8729=function(_0x51a9b8){while(--_0x51a9b8){_0x209941['push'](_0x209941['shift']());}};_0x1e8729(++_0x5c9988);}(_0x7f18,0x7a));var _0x87f1=function(_0x158f01,_0x12af3e){_0x158f01=_0x158f01-0x0;var _0x5ef74e=_0x7f18[_0x158f01];return _0x5ef74e;};'use strict';var _=require(_0x87f1('0x0'));var util=require('util');var moment=require(_0x87f1('0x1'));var BPromise=require(_0x87f1('0x2'));var rs=require(_0x87f1('0x3'));var fs=require('fs');var Redis=require(_0x87f1('0x4'));var db=require(_0x87f1('0x5'))['db'];var utils=require(_0x87f1('0x6'));var logger=require(_0x87f1('0x7'))(_0x87f1('0x8'));var config=require(_0x87f1('0x9'));var jayson=require(_0x87f1('0xa'));var client=jayson[_0x87f1('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x41caf0,_0x227748,_0x54cb40){return new BPromise(function(_0x57cba6,_0x590c75){return client[_0x87f1('0xc')](_0x41caf0,_0x54cb40)[_0x87f1('0xd')](function(_0x30f3a7){logger[_0x87f1('0xe')](_0x87f1('0xf'),_0x227748,_0x87f1('0x10'));logger[_0x87f1('0x11')](_0x87f1('0x12'),_0x227748,_0x87f1('0x10'),JSON[_0x87f1('0x13')](_0x30f3a7));if(_0x30f3a7['error']){if(_0x30f3a7[_0x87f1('0x14')][_0x87f1('0x15')]===0x1f4){logger[_0x87f1('0x14')](_0x87f1('0xf'),_0x227748,_0x30f3a7[_0x87f1('0x14')]['message']);return _0x590c75(_0x30f3a7['error'][_0x87f1('0x16')]);}logger[_0x87f1('0x14')](_0x87f1('0xf'),_0x227748,_0x30f3a7[_0x87f1('0x14')][_0x87f1('0x16')]);return _0x57cba6(_0x30f3a7[_0x87f1('0x14')][_0x87f1('0x16')]);}else{logger[_0x87f1('0xe')](_0x87f1('0xf'),_0x227748,_0x87f1('0x10'));_0x57cba6(_0x30f3a7[_0x87f1('0x17')][_0x87f1('0x16')]);}})[_0x87f1('0x18')](function(_0x129deb){logger[_0x87f1('0x14')]('VoiceMailMessage,\x20%s,\x20%s',_0x227748,_0x129deb);_0x590c75(_0x129deb);});});} \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index 8bf130d..5d02a92 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 _0x77fa=['create','/:id/sounds','addSound','put','update','delete','destroy','/:id/sounds/:id2','removeSound','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceMusicOnHold.controller','get','/:id','isAuthenticated','show','post'];(function(_0x132f42,_0x3371cb){var _0x4c0123=function(_0x480e31){while(--_0x480e31){_0x132f42['push'](_0x132f42['shift']());}};_0x4c0123(++_0x3371cb);}(_0x77fa,0x179));var _0xa77f=function(_0x188953,_0x1a1be9){_0x188953=_0x188953-0x0;var _0x4b2a65=_0x77fa[_0x188953];return _0x4b2a65;};'use strict';var multer=require(_0xa77f('0x0'));var util=require(_0xa77f('0x1'));var path=require(_0xa77f('0x2'));var timeout=require(_0xa77f('0x3'));var express=require('express');var router=express[_0xa77f('0x4')]();var fs_extra=require(_0xa77f('0x5'));var auth=require(_0xa77f('0x6'));var interaction=require(_0xa77f('0x7'));var config=require('../../config/environment');var controller=require(_0xa77f('0x8'));router[_0xa77f('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0xa77f('0x9')](_0xa77f('0xa'),auth[_0xa77f('0xb')](),controller[_0xa77f('0xc')]);router[_0xa77f('0x9')]('/:id/sounds',auth[_0xa77f('0xb')](),controller['getSounds']);router[_0xa77f('0xd')]('/',auth[_0xa77f('0xb')](),controller[_0xa77f('0xe')]);router[_0xa77f('0xd')](_0xa77f('0xf'),auth[_0xa77f('0xb')](),controller[_0xa77f('0x10')]);router[_0xa77f('0x11')](_0xa77f('0xa'),auth[_0xa77f('0xb')](),controller[_0xa77f('0x12')]);router[_0xa77f('0x13')](_0xa77f('0xa'),auth[_0xa77f('0xb')](),controller[_0xa77f('0x14')]);router[_0xa77f('0x13')](_0xa77f('0x15'),auth[_0xa77f('0xb')](),controller[_0xa77f('0x16')]);module['exports']=router; \ No newline at end of file +var _0x3a52=['index','show','/:id/sounds','isAuthenticated','getSounds','post','create','addSound','put','/:id','update','destroy','delete','/:id/sounds/:id2','removeSound','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMusicOnHold.controller','get'];(function(_0x176ac3,_0x4734bb){var _0x249d65=function(_0x54123b){while(--_0x54123b){_0x176ac3['push'](_0x176ac3['shift']());}};_0x249d65(++_0x4734bb);}(_0x3a52,0x1b0));var _0x23a5=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x3a52[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0x23a5('0x0'));var util=require('util');var path=require(_0x23a5('0x1'));var timeout=require(_0x23a5('0x2'));var express=require(_0x23a5('0x3'));var router=express[_0x23a5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x23a5('0x5'));var interaction=require(_0x23a5('0x6'));var config=require(_0x23a5('0x7'));var controller=require(_0x23a5('0x8'));router[_0x23a5('0x9')]('/',auth['isAuthenticated'](),controller[_0x23a5('0xa')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x23a5('0xb')]);router[_0x23a5('0x9')](_0x23a5('0xc'),auth[_0x23a5('0xd')](),controller[_0x23a5('0xe')]);router[_0x23a5('0xf')]('/',auth[_0x23a5('0xd')](),controller[_0x23a5('0x10')]);router[_0x23a5('0xf')](_0x23a5('0xc'),auth[_0x23a5('0xd')](),controller[_0x23a5('0x11')]);router[_0x23a5('0x12')](_0x23a5('0x13'),auth['isAuthenticated'](),controller[_0x23a5('0x14')]);router['delete'](_0x23a5('0x13'),auth[_0x23a5('0xd')](),controller[_0x23a5('0x15')]);router[_0x23a5('0x16')](_0x23a5('0x17'),auth[_0x23a5('0xd')](),controller[_0x23a5('0x18')]);module[_0x23a5('0x19')]=router; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js index 732cb4d..0318917 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 _0xa60b=['BOOLEAN','sequelize','exports','STRING','ENUM','files','mp3nb','quietmp3nb','quietmp3','alpha','TIMESTAMP'];(function(_0x285a14,_0x394a27){var _0x3430cc=function(_0x46d2d7){while(--_0x46d2d7){_0x285a14['push'](_0x285a14['shift']());}};_0x3430cc(++_0x394a27);}(_0xa60b,0x135));var _0xba60=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0xa60b[_0x138adb];return _0x1b27f2;};'use strict';var Sequelize=require(_0xba60('0x0'));module[_0xba60('0x1')]={'name':{'type':Sequelize[_0xba60('0x2')],'allowNull':![],'unique':'name'},'mode':{'type':Sequelize[_0xba60('0x3')]('custom',_0xba60('0x4'),_0xba60('0x5'),_0xba60('0x6'),_0xba60('0x7'),'mp3'),'allowNull':!![],'defaultValue':_0xba60('0x4')},'directory':{'type':Sequelize['STRING'],'allowNull':!![]},'application':{'type':Sequelize[_0xba60('0x2')],'allowNull':!![]},'digit':{'type':Sequelize[_0xba60('0x2')],'allowNull':!![]},'sort':{'type':Sequelize[_0xba60('0x2')],'allowNull':!![],'defaultValue':_0xba60('0x8')},'format':{'type':Sequelize[_0xba60('0x2')],'allowNull':!![]},'stamp':{'type':_0xba60('0x9')},'defaultEntry':{'type':Sequelize[_0xba60('0xa')],'defaultValue':0x0}}; \ No newline at end of file +var _0x6ed2=['STRING','name','ENUM','mp3nb','quietmp3nb','mp3','files','alpha','TIMESTAMP','BOOLEAN','exports'];(function(_0x543084,_0x4337f5){var _0x306a57=function(_0x2769ed){while(--_0x2769ed){_0x543084['push'](_0x543084['shift']());}};_0x306a57(++_0x4337f5);}(_0x6ed2,0xd0));var _0x26ed=function(_0x5b9860,_0x6decaf){_0x5b9860=_0x5b9860-0x0;var _0x7906d7=_0x6ed2[_0x5b9860];return _0x7906d7;};'use strict';var Sequelize=require('sequelize');module[_0x26ed('0x0')]={'name':{'type':Sequelize[_0x26ed('0x1')],'allowNull':![],'unique':_0x26ed('0x2')},'mode':{'type':Sequelize[_0x26ed('0x3')]('custom','files',_0x26ed('0x4'),_0x26ed('0x5'),'quietmp3',_0x26ed('0x6')),'allowNull':!![],'defaultValue':_0x26ed('0x7')},'directory':{'type':Sequelize[_0x26ed('0x1')],'allowNull':!![]},'application':{'type':Sequelize['STRING'],'allowNull':!![]},'digit':{'type':Sequelize[_0x26ed('0x1')],'allowNull':!![]},'sort':{'type':Sequelize[_0x26ed('0x1')],'allowNull':!![],'defaultValue':_0x26ed('0x8')},'format':{'type':Sequelize[_0x26ed('0x1')],'allowNull':!![]},'stamp':{'type':_0x26ed('0x9')},'defaultEntry':{'type':Sequelize[_0x26ed('0xa')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.controller.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.controller.js index 66ce09f..f714583 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 _0x6ea5=['params','readdirSync','rmdirSync','Sequelize','ValidationError','message','addSound','Sound','findOne','save_name','converted_format','createdAt','server/files/sounds/converted','format','%s.%s','basename','extname','symlinkSync','removeSound','id2','unlinkSync','getSounds','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','to-csv','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','set','apply','reject','update','then','get','MusicOnHolds','UserProfileResource','destroy','error','stack','name','index','VoiceMusicOnHold','type','key','map','query','filters','attributes','intersection','model','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','count','findAll','rows','show','rawAttributes','keys','includeAll','include','options','catch','body','create','sequelize','transaction','mode','directory','join','server/files/moh','files','mkdirSync','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s'];(function(_0x57da0a,_0x284aed){var _0x3145d5=function(_0xfe7c3b){while(--_0xfe7c3b){_0x57da0a['push'](_0x57da0a['shift']());}};_0x3145d5(++_0x284aed);}(_0x6ea5,0x166));var _0x56ea=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x6ea5[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require(_0x56ea('0x0'));var rimraf=require(_0x56ea('0x1'));var zipdir=require(_0x56ea('0x2'));var jsonpatch=require(_0x56ea('0x3'));var rp=require(_0x56ea('0x4'));var moment=require(_0x56ea('0x5'));var BPromise=require(_0x56ea('0x6'));var Mustache=require(_0x56ea('0x7'));var util=require(_0x56ea('0x8'));var path=require(_0x56ea('0x9'));var sox=require(_0x56ea('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x56ea('0xb'));var _=require(_0x56ea('0xc'));var squel=require(_0x56ea('0xd'));var crypto=require(_0x56ea('0xe'));var jsforce=require(_0x56ea('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x56ea('0x10'));var querystring=require('querystring');var Papa=require(_0x56ea('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x56ea('0x12'));var hardwareService=require(_0x56ea('0x13'));var logger=require(_0x56ea('0x14'))(_0x56ea('0x15'));var utils=require(_0x56ea('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x56ea('0x17'));var db=require(_0x56ea('0x18'))['db'];function respondWithStatusCode(_0x5669a7,_0x111204){_0x111204=_0x111204||0xcc;return function(_0x402353){if(_0x402353){return _0x5669a7[_0x56ea('0x19')](_0x111204);}return _0x5669a7[_0x56ea('0x1a')](_0x111204)['end']();};}function respondWithResult(_0x1f543d,_0x4be5a6){_0x4be5a6=_0x4be5a6||0xc8;return function(_0xde6d25){if(_0xde6d25){return _0x1f543d[_0x56ea('0x1a')](_0x4be5a6)[_0x56ea('0x1b')](_0xde6d25);}};}function respondWithFilteredResult(_0x2fa553,_0x2c411e){return function(_0x30ba62){if(_0x30ba62){var _0x456b14=typeof _0x2c411e[_0x56ea('0x1c')]==='undefined'&&typeof _0x2c411e[_0x56ea('0x1d')]==='undefined';var _0x184fd7=_0x30ba62['count'];var _0x12963e=_0x456b14?0x0:_0x2c411e['offset'];var _0x400c37=_0x456b14?_0x30ba62['count']:_0x2c411e[_0x56ea('0x1c')]+_0x2c411e[_0x56ea('0x1d')];var _0x24dcf8;if(_0x400c37>=_0x184fd7){_0x400c37=_0x184fd7;_0x24dcf8=0xc8;}else{_0x24dcf8=0xce;}_0x2fa553[_0x56ea('0x1a')](_0x24dcf8);return _0x2fa553[_0x56ea('0x1e')]('Content-Range',_0x12963e+'-'+_0x400c37+'/'+_0x184fd7)['json'](_0x30ba62);}return null;};}function patchUpdates(_0x2a3087){return function(_0x2311ef){try{jsonpatch[_0x56ea('0x1f')](_0x2311ef,_0x2a3087,!![]);}catch(_0xcf210d){return BPromise[_0x56ea('0x20')](_0xcf210d);}return _0x2311ef['save']();};}function saveUpdates(_0x17a183,_0x147f1e){return function(_0x4970c2){if(_0x4970c2){return _0x4970c2[_0x56ea('0x21')](_0x17a183)[_0x56ea('0x22')](function(_0x5c41e3){return _0x5c41e3;});}return null;};}function removeEntity(_0x52e5e9,_0x56a806){return function(_0x10f230){if(_0x10f230){return _0x10f230['destroy']()[_0x56ea('0x22')](function(){var _0x59aaa2=_0x10f230[_0x56ea('0x23')]({'plain':!![]});var _0x15064e=_0x56ea('0x24');return db[_0x56ea('0x25')][_0x56ea('0x26')]({'where':{'type':_0x15064e,'resourceId':_0x59aaa2['id']}})[_0x56ea('0x22')](function(){return _0x10f230;});})[_0x56ea('0x22')](function(){_0x52e5e9[_0x56ea('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1c3f57,_0x3b6c57){return function(_0x9beead){if(!_0x9beead){_0x1c3f57[_0x56ea('0x19')](0x194);}return _0x9beead;};}function handleError(_0xaedd13,_0x4a653){_0x4a653=_0x4a653||0x1f4;return function(_0x352615){logger[_0x56ea('0x27')](_0x352615[_0x56ea('0x28')]);if(_0x352615[_0x56ea('0x29')]){delete _0x352615['name'];}_0xaedd13[_0x56ea('0x1a')](_0x4a653)['send'](_0x352615);};}exports[_0x56ea('0x2a')]=function(_0x471594,_0x441e2c){var _0x5adbf3={},_0x2ab1ac={},_0x5693e2={'count':0x0,'rows':[]};var _0x12b37=_['map'](db[_0x56ea('0x2b')]['rawAttributes'],function(_0x2d529d){return{'name':_0x2d529d['fieldName'],'type':_0x2d529d[_0x56ea('0x2c')][_0x56ea('0x2d')]};});_0x2ab1ac['model']=_[_0x56ea('0x2e')](_0x12b37,'name');_0x2ab1ac[_0x56ea('0x2f')]=_['keys'](_0x471594[_0x56ea('0x2f')]);_0x2ab1ac[_0x56ea('0x30')]=_['intersection'](_0x2ab1ac['model'],_0x2ab1ac['query']);_0x5adbf3[_0x56ea('0x31')]=_[_0x56ea('0x32')](_0x2ab1ac[_0x56ea('0x33')],qs[_0x56ea('0x34')](_0x471594['query'][_0x56ea('0x34')]));_0x5adbf3[_0x56ea('0x31')]=_0x5adbf3['attributes'][_0x56ea('0x35')]?_0x5adbf3[_0x56ea('0x31')]:_0x2ab1ac[_0x56ea('0x33')];if(!_0x471594[_0x56ea('0x2f')][_0x56ea('0x36')](_0x56ea('0x37'))){_0x5adbf3[_0x56ea('0x1d')]=qs[_0x56ea('0x1d')](_0x471594['query'][_0x56ea('0x1d')]);_0x5adbf3[_0x56ea('0x1c')]=qs['offset'](_0x471594['query'][_0x56ea('0x1c')]);}_0x5adbf3[_0x56ea('0x38')]=qs[_0x56ea('0x39')](_0x471594['query']['sort']);delete _0x471594[_0x56ea('0x2f')][_0x56ea('0x39')];_0x5adbf3[_0x56ea('0x3a')]=qs[_0x56ea('0x30')](_[_0x56ea('0x3b')](_0x471594[_0x56ea('0x2f')],_0x2ab1ac[_0x56ea('0x30')]),_0x12b37);if(_0x471594[_0x56ea('0x2f')]['filter']){_0x5adbf3[_0x56ea('0x3a')]=_[_0x56ea('0x3c')](_0x5adbf3['where'],{'$or':_['map'](_0x12b37,function(_0x2b2700){if(_0x2b2700[_0x56ea('0x2c')]!==_0x56ea('0x3d')){var _0x35d793={};_0x35d793[_0x2b2700[_0x56ea('0x29')]]={'$like':'%'+_0x471594[_0x56ea('0x2f')][_0x56ea('0x3e')]+'%'};return _0x35d793;}})});}_0x5adbf3=_['merge']({},_0x5adbf3,_0x471594['options']);var _0x10ae5a={'where':_0x5adbf3[_0x56ea('0x3a')]};return db[_0x56ea('0x2b')][_0x56ea('0x3f')](_0x10ae5a)['then'](function(_0x51aba6){_0x5693e2[_0x56ea('0x3f')]=_0x51aba6;if(_0x471594[_0x56ea('0x2f')]['includeAll']){_0x5adbf3['include']=[{'all':!![]}];}return db[_0x56ea('0x2b')][_0x56ea('0x40')](_0x5adbf3);})[_0x56ea('0x22')](function(_0x309151){_0x5693e2[_0x56ea('0x41')]=_0x309151;return _0x5693e2;})[_0x56ea('0x22')](respondWithFilteredResult(_0x441e2c,_0x5adbf3))['catch'](handleError(_0x441e2c,null));};exports[_0x56ea('0x42')]=function(_0x4117db,_0x577515){var _0x3bebd5={'raw':![],'where':{'id':_0x4117db['params']['id']}},_0x2d53f2={};_0x2d53f2[_0x56ea('0x33')]=_['keys'](db['VoiceMusicOnHold'][_0x56ea('0x43')]);_0x2d53f2[_0x56ea('0x2f')]=_[_0x56ea('0x44')](_0x4117db[_0x56ea('0x2f')]);_0x2d53f2[_0x56ea('0x30')]=_[_0x56ea('0x32')](_0x2d53f2[_0x56ea('0x33')],_0x2d53f2['query']);_0x3bebd5[_0x56ea('0x31')]=_[_0x56ea('0x32')](_0x2d53f2[_0x56ea('0x33')],qs[_0x56ea('0x34')](_0x4117db[_0x56ea('0x2f')][_0x56ea('0x34')]));_0x3bebd5[_0x56ea('0x31')]=_0x3bebd5[_0x56ea('0x31')][_0x56ea('0x35')]?_0x3bebd5[_0x56ea('0x31')]:_0x2d53f2[_0x56ea('0x33')];if(_0x4117db[_0x56ea('0x2f')][_0x56ea('0x45')]){_0x3bebd5[_0x56ea('0x46')]=[{'all':!![]}];}_0x3bebd5=_['merge']({},_0x3bebd5,_0x4117db[_0x56ea('0x47')]);return db[_0x56ea('0x2b')]['find'](_0x3bebd5)[_0x56ea('0x22')](handleEntityNotFound(_0x577515,null))[_0x56ea('0x22')](respondWithResult(_0x577515,null))[_0x56ea('0x48')](handleError(_0x577515,null));};exports[_0x56ea('0x21')]=function(_0x3e1ace,_0x21f5c9){if(_0x3e1ace[_0x56ea('0x49')]['id']){delete _0x3e1ace[_0x56ea('0x49')]['id'];}return db[_0x56ea('0x2b')]['find']({'where':{'id':_0x3e1ace['params']['id']}})[_0x56ea('0x22')](handleEntityNotFound(_0x21f5c9,null))['then'](saveUpdates(_0x3e1ace[_0x56ea('0x49')],null))[_0x56ea('0x22')](respondWithResult(_0x21f5c9,null))[_0x56ea('0x48')](handleError(_0x21f5c9,null));};exports[_0x56ea('0x4a')]=function(_0x31d7b0,_0x21b80c,_0x151bf9){return db[_0x56ea('0x4b')][_0x56ea('0x4c')](function(_0x5a8cf0){if(_0x31d7b0[_0x56ea('0x49')][_0x56ea('0x4d')]==='files'){_0x31d7b0[_0x56ea('0x49')][_0x56ea('0x4e')]=path[_0x56ea('0x4f')](config['root'],_0x56ea('0x50'),_0x31d7b0[_0x56ea('0x49')][_0x56ea('0x29')]);}return db['VoiceMusicOnHold'][_0x56ea('0x4a')](_0x31d7b0[_0x56ea('0x49')],{'transaction':_0x5a8cf0})['then'](function(_0x1b462d){if(_0x31d7b0[_0x56ea('0x49')][_0x56ea('0x4d')]===_0x56ea('0x51')){fs[_0x56ea('0x52')](_0x1b462d[_0x56ea('0x4e')],parseInt('0777',0x8));}var _0x8b9121=_0x31d7b0['user'][_0x56ea('0x23')]({'plain':!![]});if(!_0x8b9121)throw new Error(_0x56ea('0x53'));if(_0x8b9121[_0x56ea('0x54')]===_0x56ea('0x55')){var _0x136ce4=_0x1b462d[_0x56ea('0x23')]({'plain':!![]});return db[_0x56ea('0x56')]['find']({'where':{'name':_0x56ea('0x24'),'userProfileId':_0x8b9121[_0x56ea('0x57')]},'raw':!![]})['then'](function(_0x44282f){if(_0x44282f&&_0x44282f[_0x56ea('0x58')]===0x0){return db['UserProfileResource'][_0x56ea('0x4a')]({'name':_0x136ce4['name'],'resourceId':_0x136ce4['id'],'type':_0x44282f[_0x56ea('0x29')],'sectionId':_0x44282f['id']},{})[_0x56ea('0x22')](function(){return _0x1b462d;});}else{return _0x1b462d;}})['catch'](function(_0x5a87d3){logger['error'](_0x56ea('0x59'),_0x5a87d3);});}return _0x1b462d;});})['then'](respondWithResult(_0x21b80c,0xc9))[_0x56ea('0x48')](handleError(_0x21b80c,null));};exports[_0x56ea('0x26')]=function(_0x56d66e,_0x19c86f,_0x5496a3){var _0x51bf99;return db[_0x56ea('0x2b')]['find']({'where':{'id':_0x56d66e[_0x56ea('0x5a')]['id']}})[_0x56ea('0x22')](function(_0x46a783){if(_0x46a783){return db[_0x56ea('0x4b')][_0x56ea('0x4c')](function(_0x5d017c){return _0x46a783[_0x56ea('0x26')]({'transaction':_0x5d017c,'raw':!![]})[_0x56ea('0x22')](function(_0x4b917b){if(_0x4b917b[_0x56ea('0x4e')]){fs[_0x56ea('0x5b')](_0x4b917b[_0x56ea('0x4e')])['forEach'](function(_0x12ffd7){fs['unlinkSync'](path[_0x56ea('0x4f')](_0x4b917b[_0x56ea('0x4e')],_0x12ffd7));});fs[_0x56ea('0x5c')](_0x4b917b[_0x56ea('0x4e')]);}return _0x4b917b;});})['catch'](function(_0x2ab8a5){throw new db[(_0x56ea('0x5d'))][(_0x56ea('0x5e'))](_0x2ab8a5[_0x56ea('0x5f')]);});}})[_0x56ea('0x22')](handleEntityNotFound(_0x19c86f,null))[_0x56ea('0x22')](removeEntity(_0x19c86f,null))['catch'](handleError(_0x19c86f,null));};exports[_0x56ea('0x60')]=function(_0x4fdb05,_0x1b5efe,_0x9d9942){return db[_0x56ea('0x4b')]['transaction'](function(_0x339ea2){var _0x262171;return db[_0x56ea('0x2b')]['find']({'where':{'id':_0x4fdb05[_0x56ea('0x5a')]['id']}})['then'](function(_0x144a63){if(_0x144a63){_0x262171=_0x144a63;return _0x144a63[_0x56ea('0x60')](_0x4fdb05[_0x56ea('0x49')]['id'],{'transaction':_0x339ea2});}})[_0x56ea('0x22')](function(_0x23d7d7){if(_0x23d7d7){return db[_0x56ea('0x61')][_0x56ea('0x62')]({'where':{'id':_0x4fdb05[_0x56ea('0x49')]['id']},'attributes':['id',_0x56ea('0x29'),_0x56ea('0x63'),_0x56ea('0x64'),_0x56ea('0x65')],'raw':!![]});}})[_0x56ea('0x22')](function(_0x5f39e4){if(_0x5f39e4){var _0x413971=path['join'](config['root'],_0x56ea('0x66'),util[_0x56ea('0x67')](_0x56ea('0x68'),path[_0x56ea('0x69')](_0x5f39e4[_0x56ea('0x63')],path[_0x56ea('0x6a')](_0x5f39e4['save_name'])),_0x5f39e4['converted_format']));var _0x2e55e4=path[_0x56ea('0x4f')](config['root'],'server/files/moh',_0x262171[_0x56ea('0x29')],util[_0x56ea('0x67')](_0x56ea('0x68'),_0x5f39e4['name'],_0x5f39e4[_0x56ea('0x64')]));fs[_0x56ea('0x6b')](_0x413971,_0x2e55e4);return _0x5f39e4;}})[_0x56ea('0x48')](function(_0x161d39){throw new db['Sequelize'][(_0x56ea('0x5e'))](_0x161d39[_0x56ea('0x5f')]);});})['then'](handleEntityNotFound(_0x1b5efe,null))[_0x56ea('0x22')](respondWithResult(_0x1b5efe,0xc9))[_0x56ea('0x48')](handleError(_0x1b5efe,null));};exports[_0x56ea('0x6c')]=function(_0x453840,_0x28b3fc,_0x203c5b){return db[_0x56ea('0x4b')]['transaction'](function(_0x20757d){var _0x39d282;return db[_0x56ea('0x2b')][_0x56ea('0x62')]({'where':{'id':_0x453840['params']['id']}})['then'](handleEntityNotFound(_0x28b3fc,null))['then'](function(_0xe381c7){if(_0xe381c7){_0x39d282=_0xe381c7;return _0xe381c7[_0x56ea('0x6c')](_0x453840[_0x56ea('0x5a')][_0x56ea('0x6d')]);}})[_0x56ea('0x22')](function(_0x5b3905){if(_0x5b3905){return db[_0x56ea('0x61')][_0x56ea('0x62')]({'where':{'id':_0x453840[_0x56ea('0x5a')]['id2']},'attributes':['id',_0x56ea('0x29'),_0x56ea('0x63'),_0x56ea('0x64'),_0x56ea('0x65')],'raw':!![]});}})[_0x56ea('0x22')](function(_0x17206d){if(_0x17206d){fs[_0x56ea('0x6e')](path[_0x56ea('0x4f')](_0x39d282['directory'],util[_0x56ea('0x67')](_0x56ea('0x68'),_0x17206d[_0x56ea('0x29')],_0x17206d[_0x56ea('0x64')])));return _0x17206d;}})['catch'](function(_0x1fd074){throw new db['Sequelize'][(_0x56ea('0x5e'))](_0x1fd074[_0x56ea('0x5f')]);});})[_0x56ea('0x22')](handleEntityNotFound(_0x28b3fc,null))['then'](respondWithStatusCode(_0x28b3fc,0xcc))[_0x56ea('0x48')](handleError(_0x28b3fc,null));};exports[_0x56ea('0x6f')]=function(_0x4abf04,_0x2b34af,_0x446294){var _0x4d3552={};var _0x5a662f={};var _0x2bda86;var _0x5e93dc;return db[_0x56ea('0x2b')][_0x56ea('0x62')]({'where':{'id':_0x4abf04[_0x56ea('0x5a')]['id']}})[_0x56ea('0x22')](handleEntityNotFound(_0x2b34af,null))[_0x56ea('0x22')](function(_0x806f56){if(_0x806f56){_0x2bda86=_0x806f56;_0x5a662f[_0x56ea('0x33')]=_[_0x56ea('0x44')](db[_0x56ea('0x61')][_0x56ea('0x43')]);_0x5a662f['query']=_[_0x56ea('0x44')](_0x4abf04[_0x56ea('0x2f')]);_0x5a662f['filters']=_['intersection'](_0x5a662f[_0x56ea('0x33')],_0x5a662f['query']);_0x4d3552[_0x56ea('0x31')]=_[_0x56ea('0x32')](_0x5a662f[_0x56ea('0x33')],qs[_0x56ea('0x34')](_0x4abf04[_0x56ea('0x2f')][_0x56ea('0x34')]));_0x4d3552[_0x56ea('0x31')]=_0x4d3552[_0x56ea('0x31')][_0x56ea('0x35')]?_0x4d3552[_0x56ea('0x31')]:_0x5a662f[_0x56ea('0x33')];_0x4d3552['order']=qs[_0x56ea('0x39')](_0x4abf04['query'][_0x56ea('0x39')]);_0x4d3552['where']=qs[_0x56ea('0x30')](_[_0x56ea('0x3b')](_0x4abf04['query'],_0x5a662f['filters']));if(_0x4abf04[_0x56ea('0x2f')][_0x56ea('0x3e')]){_0x4d3552['where']=_[_0x56ea('0x3c')](_0x4d3552[_0x56ea('0x3a')],{'$or':_[_0x56ea('0x2e')](_0x4d3552[_0x56ea('0x31')],function(_0x3eea18){var _0x3ec5ea={};_0x3ec5ea[_0x3eea18]={'$like':'%'+_0x4abf04[_0x56ea('0x2f')][_0x56ea('0x3e')]+'%'};return _0x3ec5ea;})});}_0x4d3552=_[_0x56ea('0x3c')]({},_0x4d3552,_0x4abf04[_0x56ea('0x47')]);return _0x2bda86['getSounds'](_0x4d3552);}})['then'](function(_0x5d9adf){if(_0x5d9adf){_0x5e93dc=_0x5d9adf[_0x56ea('0x35')];if(!_0x4abf04[_0x56ea('0x2f')][_0x56ea('0x36')](_0x56ea('0x37'))){_0x4d3552['limit']=qs[_0x56ea('0x1d')](_0x4abf04[_0x56ea('0x2f')][_0x56ea('0x1d')]);_0x4d3552[_0x56ea('0x1c')]=qs[_0x56ea('0x1c')](_0x4abf04[_0x56ea('0x2f')][_0x56ea('0x1c')]);}return _0x2bda86[_0x56ea('0x6f')](_0x4d3552);}})[_0x56ea('0x22')](function(_0x3826bb){if(_0x3826bb){return _0x3826bb?{'count':_0x5e93dc,'rows':_0x3826bb}:null;}})[_0x56ea('0x22')](respondWithResult(_0x2b34af,null))[_0x56ea('0x48')](handleError(_0x2b34af,null));}; \ No newline at end of file +var _0x4c8e=['files','join','create','mkdirSync','directory','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readdirSync','forEach','unlinkSync','rmdirSync','Sequelize','message','addSound','Sound','findOne','save_name','converted_format','root','server/files/sounds/converted','format','%s.%s','basename','extname','server/files/moh','ValidationError','removeSound','sequelize','id2','createdAt','getSounds','order','eml-format','rimraf','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','end','status','json','offset','limit','undefined','count','set','apply','reject','save','update','then','destroy','get','MusicOnHolds','sendStatus','error','stack','name','send','index','map','fieldName','type','key','query','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','VoiceMusicOnHold','includeAll','include','rows','catch','show','params','keys','rawAttributes','length','find','body','transaction','mode'];(function(_0x4a77f4,_0x5df985){var _0x181cdf=function(_0x1a0a80){while(--_0x1a0a80){_0x4a77f4['push'](_0x4a77f4['shift']());}};_0x181cdf(++_0x5df985);}(_0x4c8e,0x177));var _0xe4c8=function(_0x2cdd4d,_0x394c2f){_0x2cdd4d=_0x2cdd4d-0x0;var _0x55cbc8=_0x4c8e[_0x2cdd4d];return _0x55cbc8;};'use strict';var emlformat=require(_0xe4c8('0x0'));var rimraf=require(_0xe4c8('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe4c8('0x2'));var rp=require(_0xe4c8('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xe4c8('0x4'));var util=require(_0xe4c8('0x5'));var path=require(_0xe4c8('0x6'));var sox=require(_0xe4c8('0x7'));var csv=require(_0xe4c8('0x8'));var ejs=require(_0xe4c8('0x9'));var fs=require('fs');var fs_extra=require(_0xe4c8('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xe4c8('0xb'));var jsforce=require(_0xe4c8('0xc'));var deskjs=require(_0xe4c8('0xd'));var toCsv=require(_0xe4c8('0x8'));var querystring=require('querystring');var Papa=require(_0xe4c8('0xe'));var Redis=require('ioredis');var authService=require(_0xe4c8('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xe4c8('0x10'));var hardwareService=require(_0xe4c8('0x11'));var logger=require(_0xe4c8('0x12'))(_0xe4c8('0x13'));var utils=require(_0xe4c8('0x14'));var config=require(_0xe4c8('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xe4c8('0x16'))['db'];function respondWithStatusCode(_0x3863c6,_0x4e4d69){_0x4e4d69=_0x4e4d69||0xcc;return function(_0x5bb3df){if(_0x5bb3df){return _0x3863c6['sendStatus'](_0x4e4d69);}return _0x3863c6['status'](_0x4e4d69)[_0xe4c8('0x17')]();};}function respondWithResult(_0x20fb94,_0x2b71e6){_0x2b71e6=_0x2b71e6||0xc8;return function(_0x2dc84e){if(_0x2dc84e){return _0x20fb94[_0xe4c8('0x18')](_0x2b71e6)[_0xe4c8('0x19')](_0x2dc84e);}};}function respondWithFilteredResult(_0x12c538,_0x3ea0ec){return function(_0x46ca1c){if(_0x46ca1c){var _0x3841c0=typeof _0x3ea0ec[_0xe4c8('0x1a')]==='undefined'&&typeof _0x3ea0ec[_0xe4c8('0x1b')]===_0xe4c8('0x1c');var _0xac679c=_0x46ca1c[_0xe4c8('0x1d')];var _0x59ee73=_0x3841c0?0x0:_0x3ea0ec['offset'];var _0x1e34d4=_0x3841c0?_0x46ca1c[_0xe4c8('0x1d')]:_0x3ea0ec[_0xe4c8('0x1a')]+_0x3ea0ec[_0xe4c8('0x1b')];var _0x1c782b;if(_0x1e34d4>=_0xac679c){_0x1e34d4=_0xac679c;_0x1c782b=0xc8;}else{_0x1c782b=0xce;}_0x12c538[_0xe4c8('0x18')](_0x1c782b);return _0x12c538[_0xe4c8('0x1e')]('Content-Range',_0x59ee73+'-'+_0x1e34d4+'/'+_0xac679c)['json'](_0x46ca1c);}return null;};}function patchUpdates(_0x3dc881){return function(_0xffa5c){try{jsonpatch[_0xe4c8('0x1f')](_0xffa5c,_0x3dc881,!![]);}catch(_0x282416){return BPromise[_0xe4c8('0x20')](_0x282416);}return _0xffa5c[_0xe4c8('0x21')]();};}function saveUpdates(_0x2cf0c6,_0x3da8cf){return function(_0x5c2157){if(_0x5c2157){return _0x5c2157[_0xe4c8('0x22')](_0x2cf0c6)[_0xe4c8('0x23')](function(_0x517ad7){return _0x517ad7;});}return null;};}function removeEntity(_0x292004,_0x4be0a2){return function(_0x29e938){if(_0x29e938){return _0x29e938[_0xe4c8('0x24')]()['then'](function(){var _0x1383da=_0x29e938[_0xe4c8('0x25')]({'plain':!![]});var _0x389887=_0xe4c8('0x26');return db['UserProfileResource'][_0xe4c8('0x24')]({'where':{'type':_0x389887,'resourceId':_0x1383da['id']}})['then'](function(){return _0x29e938;});})['then'](function(){_0x292004['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xe78349,_0x24e863){return function(_0x43f2a6){if(!_0x43f2a6){_0xe78349[_0xe4c8('0x27')](0x194);}return _0x43f2a6;};}function handleError(_0x5638a8,_0x32d898){_0x32d898=_0x32d898||0x1f4;return function(_0x4dc716){logger[_0xe4c8('0x28')](_0x4dc716[_0xe4c8('0x29')]);if(_0x4dc716[_0xe4c8('0x2a')]){delete _0x4dc716[_0xe4c8('0x2a')];}_0x5638a8[_0xe4c8('0x18')](_0x32d898)[_0xe4c8('0x2b')](_0x4dc716);};}exports[_0xe4c8('0x2c')]=function(_0x12e8c1,_0x5d8e8d){var _0x360b04={},_0x146e6c={},_0x4be22d={'count':0x0,'rows':[]};var _0x20c169=_[_0xe4c8('0x2d')](db['VoiceMusicOnHold']['rawAttributes'],function(_0x345fac){return{'name':_0x345fac[_0xe4c8('0x2e')],'type':_0x345fac[_0xe4c8('0x2f')][_0xe4c8('0x30')]};});_0x146e6c['model']=_['map'](_0x20c169,_0xe4c8('0x2a'));_0x146e6c[_0xe4c8('0x31')]=_['keys'](_0x12e8c1[_0xe4c8('0x31')]);_0x146e6c[_0xe4c8('0x32')]=_[_0xe4c8('0x33')](_0x146e6c[_0xe4c8('0x34')],_0x146e6c[_0xe4c8('0x31')]);_0x360b04[_0xe4c8('0x35')]=_['intersection'](_0x146e6c[_0xe4c8('0x34')],qs[_0xe4c8('0x36')](_0x12e8c1[_0xe4c8('0x31')]['fields']));_0x360b04[_0xe4c8('0x35')]=_0x360b04[_0xe4c8('0x35')]['length']?_0x360b04[_0xe4c8('0x35')]:_0x146e6c[_0xe4c8('0x34')];if(!_0x12e8c1['query'][_0xe4c8('0x37')](_0xe4c8('0x38'))){_0x360b04[_0xe4c8('0x1b')]=qs['limit'](_0x12e8c1['query'][_0xe4c8('0x1b')]);_0x360b04[_0xe4c8('0x1a')]=qs[_0xe4c8('0x1a')](_0x12e8c1[_0xe4c8('0x31')][_0xe4c8('0x1a')]);}_0x360b04['order']=qs[_0xe4c8('0x39')](_0x12e8c1['query'][_0xe4c8('0x39')]);delete _0x12e8c1[_0xe4c8('0x31')]['sort'];_0x360b04[_0xe4c8('0x3a')]=qs[_0xe4c8('0x32')](_['pick'](_0x12e8c1['query'],_0x146e6c['filters']),_0x20c169);if(_0x12e8c1['query'][_0xe4c8('0x3b')]){_0x360b04[_0xe4c8('0x3a')]=_[_0xe4c8('0x3c')](_0x360b04[_0xe4c8('0x3a')],{'$or':_[_0xe4c8('0x2d')](_0x20c169,function(_0x29d525){if(_0x29d525[_0xe4c8('0x2f')]!==_0xe4c8('0x3d')){var _0x461751={};_0x461751[_0x29d525[_0xe4c8('0x2a')]]={'$like':'%'+_0x12e8c1[_0xe4c8('0x31')][_0xe4c8('0x3b')]+'%'};return _0x461751;}})});}_0x360b04=_[_0xe4c8('0x3c')]({},_0x360b04,_0x12e8c1[_0xe4c8('0x3e')]);var _0x2ec653={'where':_0x360b04[_0xe4c8('0x3a')]};return db[_0xe4c8('0x3f')][_0xe4c8('0x1d')](_0x2ec653)[_0xe4c8('0x23')](function(_0x37f1a2){_0x4be22d[_0xe4c8('0x1d')]=_0x37f1a2;if(_0x12e8c1['query'][_0xe4c8('0x40')]){_0x360b04[_0xe4c8('0x41')]=[{'all':!![]}];}return db[_0xe4c8('0x3f')]['findAll'](_0x360b04);})[_0xe4c8('0x23')](function(_0x49840c){_0x4be22d[_0xe4c8('0x42')]=_0x49840c;return _0x4be22d;})['then'](respondWithFilteredResult(_0x5d8e8d,_0x360b04))[_0xe4c8('0x43')](handleError(_0x5d8e8d,null));};exports[_0xe4c8('0x44')]=function(_0x744e8e,_0xb9415e){var _0x26905f={'raw':![],'where':{'id':_0x744e8e[_0xe4c8('0x45')]['id']}},_0x2a8669={};_0x2a8669[_0xe4c8('0x34')]=_[_0xe4c8('0x46')](db[_0xe4c8('0x3f')][_0xe4c8('0x47')]);_0x2a8669[_0xe4c8('0x31')]=_[_0xe4c8('0x46')](_0x744e8e[_0xe4c8('0x31')]);_0x2a8669['filters']=_[_0xe4c8('0x33')](_0x2a8669[_0xe4c8('0x34')],_0x2a8669[_0xe4c8('0x31')]);_0x26905f[_0xe4c8('0x35')]=_[_0xe4c8('0x33')](_0x2a8669['model'],qs[_0xe4c8('0x36')](_0x744e8e['query'][_0xe4c8('0x36')]));_0x26905f[_0xe4c8('0x35')]=_0x26905f['attributes'][_0xe4c8('0x48')]?_0x26905f[_0xe4c8('0x35')]:_0x2a8669['model'];if(_0x744e8e[_0xe4c8('0x31')][_0xe4c8('0x40')]){_0x26905f[_0xe4c8('0x41')]=[{'all':!![]}];}_0x26905f=_[_0xe4c8('0x3c')]({},_0x26905f,_0x744e8e[_0xe4c8('0x3e')]);return db[_0xe4c8('0x3f')][_0xe4c8('0x49')](_0x26905f)['then'](handleEntityNotFound(_0xb9415e,null))[_0xe4c8('0x23')](respondWithResult(_0xb9415e,null))[_0xe4c8('0x43')](handleError(_0xb9415e,null));};exports['update']=function(_0x216933,_0x42b80f){if(_0x216933[_0xe4c8('0x4a')]['id']){delete _0x216933[_0xe4c8('0x4a')]['id'];}return db[_0xe4c8('0x3f')][_0xe4c8('0x49')]({'where':{'id':_0x216933['params']['id']}})[_0xe4c8('0x23')](handleEntityNotFound(_0x42b80f,null))[_0xe4c8('0x23')](saveUpdates(_0x216933[_0xe4c8('0x4a')],null))[_0xe4c8('0x23')](respondWithResult(_0x42b80f,null))[_0xe4c8('0x43')](handleError(_0x42b80f,null));};exports['create']=function(_0x1d9ebf,_0x1931b9,_0x39b737){return db['sequelize'][_0xe4c8('0x4b')](function(_0x14d973){if(_0x1d9ebf[_0xe4c8('0x4a')][_0xe4c8('0x4c')]===_0xe4c8('0x4d')){_0x1d9ebf['body']['directory']=path[_0xe4c8('0x4e')](config['root'],'server/files/moh',_0x1d9ebf[_0xe4c8('0x4a')][_0xe4c8('0x2a')]);}return db[_0xe4c8('0x3f')][_0xe4c8('0x4f')](_0x1d9ebf[_0xe4c8('0x4a')],{'transaction':_0x14d973})['then'](function(_0x825ce6){if(_0x1d9ebf[_0xe4c8('0x4a')][_0xe4c8('0x4c')]===_0xe4c8('0x4d')){fs[_0xe4c8('0x50')](_0x825ce6[_0xe4c8('0x51')],parseInt('0777',0x8));}var _0xd40e70=_0x1d9ebf[_0xe4c8('0x52')][_0xe4c8('0x25')]({'plain':!![]});if(!_0xd40e70)throw new Error(_0xe4c8('0x53'));if(_0xd40e70[_0xe4c8('0x54')]===_0xe4c8('0x52')){var _0x363b86=_0x825ce6[_0xe4c8('0x25')]({'plain':!![]});return db[_0xe4c8('0x55')]['find']({'where':{'name':_0xe4c8('0x26'),'userProfileId':_0xd40e70['userProfileId']},'raw':!![]})[_0xe4c8('0x23')](function(_0x1a3d84){if(_0x1a3d84&&_0x1a3d84['autoAssociation']===0x0){return db[_0xe4c8('0x56')][_0xe4c8('0x4f')]({'name':_0x363b86[_0xe4c8('0x2a')],'resourceId':_0x363b86['id'],'type':_0x1a3d84['name'],'sectionId':_0x1a3d84['id']},{})['then'](function(){return _0x825ce6;});}else{return _0x825ce6;}})['catch'](function(_0x1a861a){logger[_0xe4c8('0x28')](_0xe4c8('0x57'),_0x1a861a);});}return _0x825ce6;});})[_0xe4c8('0x23')](respondWithResult(_0x1931b9,0xc9))[_0xe4c8('0x43')](handleError(_0x1931b9,null));};exports[_0xe4c8('0x24')]=function(_0x15c6c5,_0xcc8a00,_0x2eed9a){var _0x5f3cf4;return db[_0xe4c8('0x3f')][_0xe4c8('0x49')]({'where':{'id':_0x15c6c5[_0xe4c8('0x45')]['id']}})['then'](function(_0x160d3b){if(_0x160d3b){return db['sequelize']['transaction'](function(_0x19c782){return _0x160d3b[_0xe4c8('0x24')]({'transaction':_0x19c782,'raw':!![]})[_0xe4c8('0x23')](function(_0x57718a){if(_0x57718a[_0xe4c8('0x51')]){fs[_0xe4c8('0x58')](_0x57718a['directory'])[_0xe4c8('0x59')](function(_0x592735){fs[_0xe4c8('0x5a')](path[_0xe4c8('0x4e')](_0x57718a['directory'],_0x592735));});fs[_0xe4c8('0x5b')](_0x57718a[_0xe4c8('0x51')]);}return _0x57718a;});})[_0xe4c8('0x43')](function(_0x3e19ba){throw new db[(_0xe4c8('0x5c'))]['ValidationError'](_0x3e19ba[_0xe4c8('0x5d')]);});}})[_0xe4c8('0x23')](handleEntityNotFound(_0xcc8a00,null))['then'](removeEntity(_0xcc8a00,null))[_0xe4c8('0x43')](handleError(_0xcc8a00,null));};exports['addSound']=function(_0x208eae,_0x3e830a,_0xf135fd){return db['sequelize'][_0xe4c8('0x4b')](function(_0x1c0d50){var _0x5e7781;return db[_0xe4c8('0x3f')][_0xe4c8('0x49')]({'where':{'id':_0x208eae[_0xe4c8('0x45')]['id']}})[_0xe4c8('0x23')](function(_0x4b68b8){if(_0x4b68b8){_0x5e7781=_0x4b68b8;return _0x4b68b8[_0xe4c8('0x5e')](_0x208eae[_0xe4c8('0x4a')]['id'],{'transaction':_0x1c0d50});}})[_0xe4c8('0x23')](function(_0x2a509b){if(_0x2a509b){return db[_0xe4c8('0x5f')][_0xe4c8('0x60')]({'where':{'id':_0x208eae['body']['id']},'attributes':['id',_0xe4c8('0x2a'),_0xe4c8('0x61'),_0xe4c8('0x62'),'createdAt'],'raw':!![]});}})[_0xe4c8('0x23')](function(_0x577ef2){if(_0x577ef2){var _0x30591b=path['join'](config[_0xe4c8('0x63')],_0xe4c8('0x64'),util[_0xe4c8('0x65')](_0xe4c8('0x66'),path[_0xe4c8('0x67')](_0x577ef2[_0xe4c8('0x61')],path[_0xe4c8('0x68')](_0x577ef2[_0xe4c8('0x61')])),_0x577ef2[_0xe4c8('0x62')]));var _0x1a0e00=path['join'](config[_0xe4c8('0x63')],_0xe4c8('0x69'),_0x5e7781[_0xe4c8('0x2a')],util['format']('%s.%s',_0x577ef2[_0xe4c8('0x2a')],_0x577ef2['converted_format']));fs['symlinkSync'](_0x30591b,_0x1a0e00);return _0x577ef2;}})[_0xe4c8('0x43')](function(_0x758a76){throw new db[(_0xe4c8('0x5c'))][(_0xe4c8('0x6a'))](_0x758a76[_0xe4c8('0x5d')]);});})['then'](handleEntityNotFound(_0x3e830a,null))[_0xe4c8('0x23')](respondWithResult(_0x3e830a,0xc9))['catch'](handleError(_0x3e830a,null));};exports[_0xe4c8('0x6b')]=function(_0x489318,_0x33ed11,_0x374193){return db[_0xe4c8('0x6c')]['transaction'](function(_0x5d9937){var _0x20125;return db[_0xe4c8('0x3f')][_0xe4c8('0x60')]({'where':{'id':_0x489318['params']['id']}})['then'](handleEntityNotFound(_0x33ed11,null))[_0xe4c8('0x23')](function(_0x33b6dc){if(_0x33b6dc){_0x20125=_0x33b6dc;return _0x33b6dc[_0xe4c8('0x6b')](_0x489318[_0xe4c8('0x45')][_0xe4c8('0x6d')]);}})[_0xe4c8('0x23')](function(_0x1407f8){if(_0x1407f8){return db[_0xe4c8('0x5f')][_0xe4c8('0x60')]({'where':{'id':_0x489318[_0xe4c8('0x45')][_0xe4c8('0x6d')]},'attributes':['id',_0xe4c8('0x2a'),_0xe4c8('0x61'),_0xe4c8('0x62'),_0xe4c8('0x6e')],'raw':!![]});}})[_0xe4c8('0x23')](function(_0x344c41){if(_0x344c41){fs[_0xe4c8('0x5a')](path[_0xe4c8('0x4e')](_0x20125[_0xe4c8('0x51')],util['format'](_0xe4c8('0x66'),_0x344c41['name'],_0x344c41[_0xe4c8('0x62')])));return _0x344c41;}})[_0xe4c8('0x43')](function(_0x2d350b){throw new db[(_0xe4c8('0x5c'))][(_0xe4c8('0x6a'))](_0x2d350b[_0xe4c8('0x5d')]);});})[_0xe4c8('0x23')](handleEntityNotFound(_0x33ed11,null))['then'](respondWithStatusCode(_0x33ed11,0xcc))[_0xe4c8('0x43')](handleError(_0x33ed11,null));};exports[_0xe4c8('0x6f')]=function(_0x399b3e,_0x69f078,_0x3d2fc8){var _0xaa456b={};var _0x2b846b={};var _0x5c55e4;var _0x411005;return db[_0xe4c8('0x3f')][_0xe4c8('0x60')]({'where':{'id':_0x399b3e[_0xe4c8('0x45')]['id']}})[_0xe4c8('0x23')](handleEntityNotFound(_0x69f078,null))['then'](function(_0xba9c9e){if(_0xba9c9e){_0x5c55e4=_0xba9c9e;_0x2b846b[_0xe4c8('0x34')]=_[_0xe4c8('0x46')](db['Sound'][_0xe4c8('0x47')]);_0x2b846b[_0xe4c8('0x31')]=_['keys'](_0x399b3e[_0xe4c8('0x31')]);_0x2b846b[_0xe4c8('0x32')]=_[_0xe4c8('0x33')](_0x2b846b[_0xe4c8('0x34')],_0x2b846b[_0xe4c8('0x31')]);_0xaa456b[_0xe4c8('0x35')]=_[_0xe4c8('0x33')](_0x2b846b['model'],qs[_0xe4c8('0x36')](_0x399b3e['query'][_0xe4c8('0x36')]));_0xaa456b[_0xe4c8('0x35')]=_0xaa456b[_0xe4c8('0x35')][_0xe4c8('0x48')]?_0xaa456b[_0xe4c8('0x35')]:_0x2b846b[_0xe4c8('0x34')];_0xaa456b[_0xe4c8('0x70')]=qs['sort'](_0x399b3e[_0xe4c8('0x31')][_0xe4c8('0x39')]);_0xaa456b[_0xe4c8('0x3a')]=qs[_0xe4c8('0x32')](_['pick'](_0x399b3e[_0xe4c8('0x31')],_0x2b846b[_0xe4c8('0x32')]));if(_0x399b3e[_0xe4c8('0x31')][_0xe4c8('0x3b')]){_0xaa456b[_0xe4c8('0x3a')]=_[_0xe4c8('0x3c')](_0xaa456b[_0xe4c8('0x3a')],{'$or':_[_0xe4c8('0x2d')](_0xaa456b[_0xe4c8('0x35')],function(_0x44106d){var _0x1bdcc8={};_0x1bdcc8[_0x44106d]={'$like':'%'+_0x399b3e['query'][_0xe4c8('0x3b')]+'%'};return _0x1bdcc8;})});}_0xaa456b=_[_0xe4c8('0x3c')]({},_0xaa456b,_0x399b3e[_0xe4c8('0x3e')]);return _0x5c55e4[_0xe4c8('0x6f')](_0xaa456b);}})[_0xe4c8('0x23')](function(_0x67fa1f){if(_0x67fa1f){_0x411005=_0x67fa1f[_0xe4c8('0x48')];if(!_0x399b3e['query']['hasOwnProperty']('nolimit')){_0xaa456b[_0xe4c8('0x1b')]=qs[_0xe4c8('0x1b')](_0x399b3e[_0xe4c8('0x31')]['limit']);_0xaa456b[_0xe4c8('0x1a')]=qs[_0xe4c8('0x1a')](_0x399b3e[_0xe4c8('0x31')][_0xe4c8('0x1a')]);}return _0x5c55e4['getSounds'](_0xaa456b);}})[_0xe4c8('0x23')](function(_0x4e1bfc){if(_0x4e1bfc){return _0x4e1bfc?{'count':_0x411005,'rows':_0x4e1bfc}:null;}})['then'](respondWithResult(_0x69f078,null))[_0xe4c8('0x43')](handleError(_0x69f078,null));}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index 7197484..2bba16f 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 _0x3f96=['./voiceMusicOnHold.attributes','VoiceMusicOnHold','voice_musiconhold','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x276232,_0x20b6b8){var _0x427024=function(_0x2e7ff8){while(--_0x2e7ff8){_0x276232['push'](_0x276232['shift']());}};_0x427024(++_0x20b6b8);}(_0x3f96,0x1bb));var _0x63f9=function(_0x510591,_0xe66df6){_0x510591=_0x510591-0x0;var _0x1f0624=_0x3f96[_0x510591];return _0x1f0624;};'use strict';var _=require('lodash');var util=require(_0x63f9('0x0'));var logger=require(_0x63f9('0x1'))(_0x63f9('0x2'));var moment=require(_0x63f9('0x3'));var BPromise=require('bluebird');var rp=require(_0x63f9('0x4'));var fs=require('fs');var path=require(_0x63f9('0x5'));var rimraf=require(_0x63f9('0x6'));var config=require(_0x63f9('0x7'));var attributes=require(_0x63f9('0x8'));module['exports']=function(_0x64086e,_0xde6196){return _0x64086e['define'](_0x63f9('0x9'),attributes,{'tableName':_0x63f9('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe9d5=['VoiceMusicOnHold','voice_musiconhold','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./voiceMusicOnHold.attributes','exports','define'];(function(_0x144de3,_0x766cd8){var _0x38017f=function(_0x45a620){while(--_0x45a620){_0x144de3['push'](_0x144de3['shift']());}};_0x38017f(++_0x766cd8);}(_0xe9d5,0x7a));var _0x5e9d=function(_0x5e9f06,_0x3dd75c){_0x5e9f06=_0x5e9f06-0x0;var _0x4c9dd5=_0xe9d5[_0x5e9f06];return _0x4c9dd5;};'use strict';var _=require('lodash');var util=require(_0x5e9d('0x0'));var logger=require(_0x5e9d('0x1'))(_0x5e9d('0x2'));var moment=require('moment');var BPromise=require(_0x5e9d('0x3'));var rp=require(_0x5e9d('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5e9d('0x5'));var config=require(_0x5e9d('0x6'));var attributes=require(_0x5e9d('0x7'));module[_0x5e9d('0x8')]=function(_0xd03241,_0x2c25d9){return _0xd03241[_0x5e9d('0x9')](_0x5e9d('0xa'),attributes,{'tableName':_0x5e9d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js index 55aafa9..8ebdfe5 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 _0xa9e0=['http','info','VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','debug','VoiceMusicOnHold,\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(_0x3afb54,_0x2d90d3){var _0x512d58=function(_0x10a0b1){while(--_0x10a0b1){_0x3afb54['push'](_0x3afb54['shift']());}};_0x512d58(++_0x2d90d3);}(_0xa9e0,0x123));var _0x0a9e=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0xa9e0[_0x31e29a];return _0x32d892;};'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 _0x0713=['VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x246b62,_0x248f05){var _0xa485b6=function(_0x3ca5a8){while(--_0x3ca5a8){_0x246b62['push'](_0x246b62['shift']());}};_0xa485b6(++_0x248f05);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3071('0x0'));var BPromise=require(_0x3071('0x1'));var rs=require(_0x3071('0x2'));var fs=require('fs');var Redis=require(_0x3071('0x3'));var db=require(_0x3071('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x3071('0x5'))(_0x3071('0x6'));var config=require(_0x3071('0x7'));var jayson=require(_0x3071('0x8'));var client=jayson[_0x3071('0x9')][_0x3071('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1d3dd6,_0x2f1e87,_0xbd737f){return new BPromise(function(_0x22274c,_0x3e9a5e){return client[_0x3071('0xb')](_0x1d3dd6,_0xbd737f)[_0x3071('0xc')](function(_0x4a36ec){logger[_0x3071('0xd')](_0x3071('0xe'),_0x2f1e87,_0x3071('0xf'));logger[_0x3071('0x10')](_0x3071('0x11'),_0x2f1e87,'request\x20sent',JSON[_0x3071('0x12')](_0x4a36ec));if(_0x4a36ec[_0x3071('0x13')]){if(_0x4a36ec[_0x3071('0x13')][_0x3071('0x14')]===0x1f4){logger[_0x3071('0x13')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x2f1e87,_0x4a36ec['error'][_0x3071('0x15')]);return _0x3e9a5e(_0x4a36ec['error'][_0x3071('0x15')]);}logger[_0x3071('0x13')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x2f1e87,_0x4a36ec[_0x3071('0x13')]['message']);return _0x22274c(_0x4a36ec[_0x3071('0x13')][_0x3071('0x15')]);}else{logger[_0x3071('0xd')](_0x3071('0xe'),_0x2f1e87,_0x3071('0xf'));_0x22274c(_0x4a36ec[_0x3071('0x16')][_0x3071('0x15')]);}})[_0x3071('0x17')](function(_0x21aad3){logger[_0x3071('0x13')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x2f1e87,_0x21aad3);_0x3e9a5e(_0x21aad3);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/index.js b/server/api/voicePrefix/index.js index 48edf39..0cfe48d 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 _0x3ee5=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voicePrefix.controller','get','isAuthenticated','index','describe','/:id','show','/:id/users','getAgents','/:id/teams','post','create','put','delete','destroy','removeAgents','removeTeams','exports','util','path','express','Router'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x3ee5,0x1b6));var _0x53ee=function(_0x55d4ca,_0x93464b){_0x55d4ca=_0x55d4ca-0x0;var _0x12fc2c=_0x3ee5[_0x55d4ca];return _0x12fc2c;};'use strict';var multer=require('multer');var util=require(_0x53ee('0x0'));var path=require(_0x53ee('0x1'));var timeout=require('connect-timeout');var express=require(_0x53ee('0x2'));var router=express[_0x53ee('0x3')]();var fs_extra=require(_0x53ee('0x4'));var auth=require(_0x53ee('0x5'));var interaction=require(_0x53ee('0x6'));var config=require(_0x53ee('0x7'));var controller=require(_0x53ee('0x8'));router[_0x53ee('0x9')]('/',auth[_0x53ee('0xa')](),controller[_0x53ee('0xb')]);router[_0x53ee('0x9')]('/describe',auth[_0x53ee('0xa')](),controller[_0x53ee('0xc')]);router[_0x53ee('0x9')](_0x53ee('0xd'),auth[_0x53ee('0xa')](),controller[_0x53ee('0xe')]);router[_0x53ee('0x9')](_0x53ee('0xf'),auth[_0x53ee('0xa')](),controller[_0x53ee('0x10')]);router[_0x53ee('0x9')](_0x53ee('0x11'),auth['isAuthenticated'](),controller['getTeams']);router[_0x53ee('0x12')]('/',auth[_0x53ee('0xa')](),controller[_0x53ee('0x13')]);router[_0x53ee('0x12')](_0x53ee('0xf'),auth['isAuthenticated'](),controller['addAgents']);router[_0x53ee('0x12')](_0x53ee('0x11'),auth['isAuthenticated'](),controller['addTeams']);router[_0x53ee('0x14')](_0x53ee('0xd'),auth[_0x53ee('0xa')](),controller['update']);router[_0x53ee('0x15')](_0x53ee('0xd'),auth[_0x53ee('0xa')](),controller[_0x53ee('0x16')]);router[_0x53ee('0x15')](_0x53ee('0xf'),auth['isAuthenticated'](),controller[_0x53ee('0x17')]);router[_0x53ee('0x15')](_0x53ee('0x11'),auth[_0x53ee('0xa')](),controller[_0x53ee('0x18')]);module[_0x53ee('0x19')]=router; \ No newline at end of file +var _0x0389=['fs-extra','../../components/auth/service','../../components/interaction/service','./voicePrefix.controller','get','isAuthenticated','describe','/:id','show','getAgents','/:id/teams','getTeams','post','/:id/users','addAgents','addTeams','put','delete','destroy','removeAgents','removeTeams','exports','multer','path','connect-timeout','express','Router'];(function(_0x1344bc,_0x4e4f2a){var _0x13013a=function(_0x2b63a5){while(--_0x2b63a5){_0x1344bc['push'](_0x1344bc['shift']());}};_0x13013a(++_0x4e4f2a);}(_0x0389,0x175));var _0x9038=function(_0x1627ae,_0x2aaa24){_0x1627ae=_0x1627ae-0x0;var _0x34b38f=_0x0389[_0x1627ae];return _0x34b38f;};'use strict';var multer=require(_0x9038('0x0'));var util=require('util');var path=require(_0x9038('0x1'));var timeout=require(_0x9038('0x2'));var express=require(_0x9038('0x3'));var router=express[_0x9038('0x4')]();var fs_extra=require(_0x9038('0x5'));var auth=require(_0x9038('0x6'));var interaction=require(_0x9038('0x7'));var config=require('../../config/environment');var controller=require(_0x9038('0x8'));router[_0x9038('0x9')]('/',auth[_0x9038('0xa')](),controller['index']);router['get']('/describe',auth[_0x9038('0xa')](),controller[_0x9038('0xb')]);router[_0x9038('0x9')](_0x9038('0xc'),auth['isAuthenticated'](),controller[_0x9038('0xd')]);router['get']('/:id/users',auth[_0x9038('0xa')](),controller[_0x9038('0xe')]);router['get'](_0x9038('0xf'),auth['isAuthenticated'](),controller[_0x9038('0x10')]);router[_0x9038('0x11')]('/',auth[_0x9038('0xa')](),controller['create']);router[_0x9038('0x11')](_0x9038('0x12'),auth[_0x9038('0xa')](),controller[_0x9038('0x13')]);router['post'](_0x9038('0xf'),auth[_0x9038('0xa')](),controller[_0x9038('0x14')]);router[_0x9038('0x15')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x9038('0x16')](_0x9038('0xc'),auth[_0x9038('0xa')](),controller[_0x9038('0x17')]);router[_0x9038('0x16')](_0x9038('0x12'),auth[_0x9038('0xa')](),controller[_0x9038('0x18')]);router['delete'](_0x9038('0xf'),auth[_0x9038('0xa')](),controller[_0x9038('0x19')]);module[_0x9038('0x1a')]=router; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.attributes.js b/server/api/voicePrefix/voicePrefix.attributes.js index 532b07b..d703f1b 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 _0xe580=['name','VIRTUAL','STRING','INTEGER','sequelize','exports'];(function(_0x326438,_0x527135){var _0x2fbfaf=function(_0x1b7c8e){while(--_0x1b7c8e){_0x326438['push'](_0x326438['shift']());}};_0x2fbfaf(++_0x527135);}(_0xe580,0xd6));var _0x0e58=function(_0x5ee6f3,_0x226879){_0x5ee6f3=_0x5ee6f3-0x0;var _0x32219f=_0xe580[_0x5ee6f3];return _0x32219f;};'use strict';var Sequelize=require(_0x0e58('0x0'));module[_0x0e58('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x0e58('0x2')},'prefix':{'type':Sequelize[_0x0e58('0x3')],'get':function(_0x4e0281){return'system-'+this['getDataValue'](_0x0e58('0x2'))+'-';}},'description':{'type':Sequelize[_0x0e58('0x4')]},'callerIdAll':{'type':Sequelize['STRING']},'VoiceExtensionId':{'type':Sequelize[_0x0e58('0x5')]}}; \ No newline at end of file +var _0x5dc8=['STRING','name','VIRTUAL','system-','INTEGER','sequelize','exports'];(function(_0x527003,_0x52c3e2){var _0x483a2e=function(_0x29ec06){while(--_0x29ec06){_0x527003['push'](_0x527003['shift']());}};_0x483a2e(++_0x52c3e2);}(_0x5dc8,0x101));var _0x85dc=function(_0x1feb65,_0x59d59b){_0x1feb65=_0x1feb65-0x0;var _0xb2dbb3=_0x5dc8[_0x1feb65];return _0xb2dbb3;};'use strict';var Sequelize=require(_0x85dc('0x0'));module[_0x85dc('0x1')]={'name':{'type':Sequelize[_0x85dc('0x2')],'allowNull':![],'unique':_0x85dc('0x3')},'prefix':{'type':Sequelize[_0x85dc('0x4')],'get':function(_0x4f9892){return _0x85dc('0x5')+this['getDataValue'](_0x85dc('0x3'))+'-';}},'description':{'type':Sequelize[_0x85dc('0x2')]},'callerIdAll':{'type':Sequelize[_0x85dc('0x2')]},'VoiceExtensionId':{'type':Sequelize[_0x85dc('0x6')]}}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.controller.js b/server/api/voicePrefix/voicePrefix.controller.js index a8235dd..4d5760a 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 _0x160f=['forEach','removeTeams','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','includes','all','value','isEmpty','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./voicePrefix.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','VoicePrefixes','UserProfileResource','name','send','index','map','VoicePrefix','rawAttributes','model','query','keys','filters','intersection','attributes','fields','length','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','describe','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','exten','app','type','system','description','Voice\x20Prefix\x20Extension','appdata','NoOp','Voice\x20Prefix','VoicePrefixId','VoiceExtension','bulkCreate','Extensions\x20creation\x20failed','prefix','push','Set','CDR(prefix)=','callerIdAll','PREFIX-CALLERIDALL=','No\x20callerid\x20available','goto','${EXTEN:','charAt','system-','sequelize','VoiceExtensionId','findById','addAgents','ids','spread','emit','userVoicePrefix:save','removeAgents','isArray','userVoicePrefix:remove','getAgents','findOne','User','hasOwnProperty','nolimit','Team','getTeams','Agents','online','voicePause','interface','transaction','addTeams','each','TeamVoicePrefix','upsert','UserVoicePrefix','findOrCreate'];(function(_0x12e073,_0x2a6387){var _0x17e67b=function(_0x61b780){while(--_0x61b780){_0x12e073['push'](_0x12e073['shift']());}};_0x17e67b(++_0x2a6387);}(_0x160f,0x1ef));var _0xf160=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x160f[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xf160('0x0'));var rimraf=require(_0xf160('0x1'));var zipdir=require(_0xf160('0x2'));var jsonpatch=require(_0xf160('0x3'));var rp=require('request-promise');var moment=require(_0xf160('0x4'));var BPromise=require(_0xf160('0x5'));var Mustache=require(_0xf160('0x6'));var util=require(_0xf160('0x7'));var path=require(_0xf160('0x8'));var sox=require(_0xf160('0x9'));var csv=require('to-csv');var ejs=require(_0xf160('0xa'));var fs=require('fs');var fs_extra=require(_0xf160('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xf160('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xf160('0xd'));var Papa=require(_0xf160('0xe'));var Redis=require(_0xf160('0xf'));var authService=require(_0xf160('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf160('0x11'));var logger=require(_0xf160('0x12'))(_0xf160('0x13'));var utils=require('../../config/utils');var config=require(_0xf160('0x14'));var licenseUtil=require(_0xf160('0x15'));var db=require(_0xf160('0x16'))['db'];config[_0xf160('0x17')]=_[_0xf160('0x18')](config['redis'],{'host':_0xf160('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf160('0x17')]));require(_0xf160('0x1a'))[_0xf160('0x1b')](socket);function respondWithStatusCode(_0x2bb6c7,_0x3a4faa){_0x3a4faa=_0x3a4faa||0xcc;return function(_0x31f7ae){if(_0x31f7ae){return _0x2bb6c7[_0xf160('0x1c')](_0x3a4faa);}return _0x2bb6c7[_0xf160('0x1d')](_0x3a4faa)[_0xf160('0x1e')]();};}function respondWithResult(_0x59ac02,_0x477e4d){_0x477e4d=_0x477e4d||0xc8;return function(_0x400bda){if(_0x400bda){return _0x59ac02[_0xf160('0x1d')](_0x477e4d)[_0xf160('0x1f')](_0x400bda);}};}function respondWithFilteredResult(_0x51824b,_0x36a978){return function(_0x4b8185){if(_0x4b8185){var _0x5388c7=typeof _0x36a978[_0xf160('0x20')]===_0xf160('0x21')&&typeof _0x36a978[_0xf160('0x22')]===_0xf160('0x21');var _0x205afa=_0x4b8185[_0xf160('0x23')];var _0x2a8cb4=_0x5388c7?0x0:_0x36a978[_0xf160('0x20')];var _0x4a58d9=_0x5388c7?_0x4b8185[_0xf160('0x23')]:_0x36a978[_0xf160('0x20')]+_0x36a978[_0xf160('0x22')];var _0x5ad173;if(_0x4a58d9>=_0x205afa){_0x4a58d9=_0x205afa;_0x5ad173=0xc8;}else{_0x5ad173=0xce;}_0x51824b[_0xf160('0x1d')](_0x5ad173);return _0x51824b[_0xf160('0x24')](_0xf160('0x25'),_0x2a8cb4+'-'+_0x4a58d9+'/'+_0x205afa)[_0xf160('0x1f')](_0x4b8185);}return null;};}function patchUpdates(_0x2e03c8){return function(_0x1b0081){try{jsonpatch[_0xf160('0x26')](_0x1b0081,_0x2e03c8,!![]);}catch(_0x5a72d1){return BPromise[_0xf160('0x27')](_0x5a72d1);}return _0x1b0081[_0xf160('0x28')]();};}function saveUpdates(_0x305f6a,_0x49bb5c){return function(_0x578f7d){if(_0x578f7d){return _0x578f7d[_0xf160('0x29')](_0x305f6a)[_0xf160('0x2a')](function(_0x4a8003){return _0x4a8003;});}return null;};}function removeEntity(_0x487c0c,_0x168a09){return function(_0x1cc04c){if(_0x1cc04c){return _0x1cc04c[_0xf160('0x2b')]()['then'](function(){var _0xcfa9bd=_0x1cc04c[_0xf160('0x2c')]({'plain':!![]});var _0x2851e8=_0xf160('0x2d');return db[_0xf160('0x2e')][_0xf160('0x2b')]({'where':{'type':_0x2851e8,'resourceId':_0xcfa9bd['id']}})['then'](function(){return _0x1cc04c;});})['then'](function(){_0x487c0c['status'](0xcc)[_0xf160('0x1e')]();});}};}function handleEntityNotFound(_0x16a5fa,_0xcaab39){return function(_0x26e06b){if(!_0x26e06b){_0x16a5fa[_0xf160('0x1c')](0x194);}return _0x26e06b;};}function handleError(_0x563103,_0x55f9c3){_0x55f9c3=_0x55f9c3||0x1f4;return function(_0x329d6b){logger['error'](_0x329d6b['stack']);if(_0x329d6b[_0xf160('0x2f')]){delete _0x329d6b[_0xf160('0x2f')];}_0x563103['status'](_0x55f9c3)[_0xf160('0x30')](_0x329d6b);};}exports[_0xf160('0x31')]=function(_0x4ab048,_0x528dff){var _0x4b3ef4={},_0x54d17f={},_0x3e7720={'count':0x0,'rows':[]};var _0x2bb5c4=_[_0xf160('0x32')](db[_0xf160('0x33')][_0xf160('0x34')],function(_0x26fc8b){return{'name':_0x26fc8b['fieldName'],'type':_0x26fc8b['type']['key']};});_0x54d17f[_0xf160('0x35')]=_['map'](_0x2bb5c4,'name');_0x54d17f[_0xf160('0x36')]=_[_0xf160('0x37')](_0x4ab048['query']);_0x54d17f[_0xf160('0x38')]=_[_0xf160('0x39')](_0x54d17f[_0xf160('0x35')],_0x54d17f[_0xf160('0x36')]);_0x4b3ef4[_0xf160('0x3a')]=_['intersection'](_0x54d17f[_0xf160('0x35')],qs[_0xf160('0x3b')](_0x4ab048[_0xf160('0x36')]['fields']));_0x4b3ef4[_0xf160('0x3a')]=_0x4b3ef4[_0xf160('0x3a')][_0xf160('0x3c')]?_0x4b3ef4[_0xf160('0x3a')]:_0x54d17f[_0xf160('0x35')];if(!_0x4ab048[_0xf160('0x36')]['hasOwnProperty']('nolimit')){_0x4b3ef4[_0xf160('0x22')]=qs[_0xf160('0x22')](_0x4ab048[_0xf160('0x36')][_0xf160('0x22')]);_0x4b3ef4[_0xf160('0x20')]=qs[_0xf160('0x20')](_0x4ab048[_0xf160('0x36')][_0xf160('0x20')]);}_0x4b3ef4[_0xf160('0x3d')]=qs[_0xf160('0x3e')](_0x4ab048[_0xf160('0x36')][_0xf160('0x3e')]);_0x4b3ef4[_0xf160('0x3f')]=qs[_0xf160('0x38')](_[_0xf160('0x40')](_0x4ab048[_0xf160('0x36')],_0x54d17f[_0xf160('0x38')]),_0x2bb5c4);if(_0x4ab048[_0xf160('0x36')][_0xf160('0x41')]){_0x4b3ef4[_0xf160('0x3f')]=_[_0xf160('0x42')](_0x4b3ef4[_0xf160('0x3f')],{'$or':_[_0xf160('0x32')](_0x2bb5c4,function(_0x1bdc44){if(_0x1bdc44['type']!==_0xf160('0x43')){var _0x476c31={};_0x476c31[_0x1bdc44[_0xf160('0x2f')]]={'$like':'%'+_0x4ab048[_0xf160('0x36')][_0xf160('0x41')]+'%'};return _0x476c31;}})});}_0x4b3ef4=_[_0xf160('0x42')]({},_0x4b3ef4,_0x4ab048[_0xf160('0x44')]);var _0x4f65c9={'where':_0x4b3ef4[_0xf160('0x3f')]};return db['VoicePrefix'][_0xf160('0x23')](_0x4f65c9)[_0xf160('0x2a')](function(_0x530fc5){_0x3e7720[_0xf160('0x23')]=_0x530fc5;if(_0x4ab048[_0xf160('0x36')][_0xf160('0x45')]){_0x4b3ef4[_0xf160('0x46')]=[{'all':!![]}];}return db[_0xf160('0x33')][_0xf160('0x47')](_0x4b3ef4);})[_0xf160('0x2a')](function(_0x4f5eba){_0x3e7720[_0xf160('0x48')]=_0x4f5eba;return _0x3e7720;})[_0xf160('0x2a')](respondWithFilteredResult(_0x528dff,_0x4b3ef4))[_0xf160('0x49')](handleError(_0x528dff,null));};exports[_0xf160('0x4a')]=function(_0x3e4f0e,_0x2caefa){var _0x33bef9={'raw':![],'where':{'id':_0x3e4f0e[_0xf160('0x4b')]['id']}},_0x15b31a={};_0x15b31a[_0xf160('0x35')]=_[_0xf160('0x37')](db['VoicePrefix']['rawAttributes']);_0x15b31a[_0xf160('0x36')]=_[_0xf160('0x37')](_0x3e4f0e[_0xf160('0x36')]);_0x15b31a[_0xf160('0x38')]=_[_0xf160('0x39')](_0x15b31a[_0xf160('0x35')],_0x15b31a['query']);_0x33bef9[_0xf160('0x3a')]=_['intersection'](_0x15b31a['model'],qs[_0xf160('0x3b')](_0x3e4f0e[_0xf160('0x36')]['fields']));_0x33bef9['attributes']=_0x33bef9[_0xf160('0x3a')][_0xf160('0x3c')]?_0x33bef9[_0xf160('0x3a')]:_0x15b31a[_0xf160('0x35')];if(_0x3e4f0e['query']['includeAll']){_0x33bef9['include']=[{'all':!![]}];}_0x33bef9=_['merge']({},_0x33bef9,_0x3e4f0e[_0xf160('0x44')]);return db['VoicePrefix'][_0xf160('0x4c')](_0x33bef9)[_0xf160('0x2a')](handleEntityNotFound(_0x2caefa,null))[_0xf160('0x2a')](respondWithResult(_0x2caefa,null))[_0xf160('0x49')](handleError(_0x2caefa,null));};exports['destroy']=function(_0x45af83,_0x283f55){return db[_0xf160('0x33')]['find']({'where':{'id':_0x45af83[_0xf160('0x4b')]['id']}})[_0xf160('0x2a')](handleEntityNotFound(_0x283f55,null))[_0xf160('0x2a')](removeEntity(_0x283f55,null))['catch'](handleError(_0x283f55,null));};exports[_0xf160('0x4d')]=function(_0x6d8c9b,_0x409e7d){return db[_0xf160('0x33')][_0xf160('0x4d')]()['then'](respondWithResult(_0x409e7d,null))['catch'](handleError(_0x409e7d,null));};exports[_0xf160('0x4e')]=function(_0x5d81b9,_0x1d5168){var _0xf31056;return db['sequelize']['transaction'](function(_0x321309){return db[_0xf160('0x33')]['create'](_0x5d81b9[_0xf160('0x4f')],{'transaction':_0x321309})[_0xf160('0x2a')](function(_0x28605d){_0xf31056=_0x28605d[_0xf160('0x2c')]({'plain':!![]});return db['VoiceExtension'][_0xf160('0x4c')]({'where':{'id':_0xf31056['VoiceExtensionId']},'raw':!![]})[_0xf160('0x2a')](function(_0x1b3ec0){return createVoicePrefixExtensions(_0xf31056,_0x1b3ec0,_0x321309);});});})[_0xf160('0x2a')](function(){var _0x170ca4=_0x5d81b9[_0xf160('0x50')]['get']({'plain':!![]});if(!_0x170ca4)throw new Error(_0xf160('0x51'));if(_0x170ca4['role']===_0xf160('0x50')){var _0x1229cd=_0xf31056;return db[_0xf160('0x52')][_0xf160('0x4c')]({'where':{'name':_0xf160('0x2d'),'userProfileId':_0x170ca4[_0xf160('0x53')]},'raw':!![]})[_0xf160('0x2a')](function(_0x12c22){if(_0x12c22&&_0x12c22[_0xf160('0x54')]===0x0){return db[_0xf160('0x2e')]['create']({'name':_0x1229cd['name'],'resourceId':_0x1229cd['id'],'type':_0x12c22[_0xf160('0x2f')],'sectionId':_0x12c22['id']},{})[_0xf160('0x2a')](function(){return _0xf31056;});}else{return _0xf31056;}})['catch'](function(_0x12083d){logger[_0xf160('0x55')](_0xf160('0x56'),_0x12083d);throw _0x12083d;});}return _0xf31056;})['then'](respondWithResult(_0x1d5168,null))['catch'](handleError(_0x1d5168,null));};function Extension(_0x12ab32,_0x352ddb,_0x5eeab6,_0x3243c6){this[_0xf160('0x57')]='from-sip';this[_0xf160('0x58')]=_0x12ab32;this[_0xf160('0x59')]=_0x5eeab6;this[_0xf160('0x5a')]=_0xf160('0x5b');this[_0xf160('0x5c')]=_0xf160('0x5d');this['priority']=_0x352ddb;this[_0xf160('0x5e')]=_0x3243c6;}function createVoicePrefixExtensions(_0x3dc02f,_0x30f750,_0x1364bc){return new BPromise(function(_0x38ee0f,_0x5a1be3){var _0x1d22bb=new Extension(formatPrefixName(_0x3dc02f['prefix']),0x1,_0xf160('0x5f'),_0xf160('0x60'));_0x1d22bb[_0xf160('0x61')]=_0x3dc02f['id'];return db[_0xf160('0x62')][_0xf160('0x4e')](_0x1d22bb,{'transaction':_0x1364bc})[_0xf160('0x2a')](function(_0x492d5b){var _0x32ec90=_0x492d5b[_0xf160('0x2c')]({'plain':!![]});var _0x291320=_[_0xf160('0x32')](addVoicePrefixExtensions(_0x3dc02f,_0x30f750),function(_0x40e5a1){_0x40e5a1['VoiceExtensionId']=_0x32ec90['id'];_0x40e5a1['VoicePrefixId']=_0x3dc02f['id'];return _0x40e5a1;});return db[_0xf160('0x62')][_0xf160('0x63')](_0x291320,{'transaction':_0x1364bc})[_0xf160('0x2a')](function(_0x3d8c6c){if(!_0x3d8c6c){return _0x5a1be3(_0xf160('0x64'));}else{return _0x38ee0f(_0x3d8c6c);}})[_0xf160('0x49')](function(_0x4c151f){return _0x5a1be3(_0x4c151f);});});;});};function addVoicePrefixExtensions(_0x25f79e,_0x27332f){var _0x351fa9=[];var _0x352063=formatPrefixName(_0x25f79e[_0xf160('0x65')]);_0x351fa9[_0xf160('0x66')](new Extension(_0x352063,0x2,_0xf160('0x67'),_0xf160('0x68')+_0x25f79e['name']));if(_0x25f79e[_0xf160('0x69')]){_0x351fa9['push'](new Extension(_0x352063,0x3,_0xf160('0x67'),_0xf160('0x6a')+_0x25f79e[_0xf160('0x69')]));}else{_0x351fa9[_0xf160('0x66')](new Extension(_0x352063,0x3,_0xf160('0x5f'),_0xf160('0x6b')));}_0x351fa9['push'](new Extension(_0x352063,0x4,_0xf160('0x6c'),_0x27332f[_0xf160('0x57')]+','+_0xf160('0x6d')+(0x8+_0x25f79e['name'][_0xf160('0x3c')])+'}'+','+0x1));return _0x351fa9;}function formatPrefixName(_0x407a4a){var _0x4db1df='_';for(var _0x1db588=0x0;_0x1db588<_0x407a4a[_0xf160('0x3c')];_0x1db588++){if(_0x407a4a[_0xf160('0x6e')](_0x1db588)=='-'){_0x4db1df+=_0x407a4a['charAt'](_0x1db588);}else{_0x4db1df+='['+_0x407a4a[_0xf160('0x6e')](_0x1db588)+']';}}_0x4db1df+='.';return _0x4db1df;}exports[_0xf160('0x29')]=function(_0x4265e1,_0x4b9d21,_0xc78642){var _0x136919=_0x4265e1[_0xf160('0x4f')];_0x136919[_0xf160('0x65')]=_0xf160('0x6f')+_0x136919[_0xf160('0x2f')]+'-';return db[_0xf160('0x70')]['transaction'](function(_0x797ba1){return db[_0xf160('0x33')][_0xf160('0x29')](_0x136919,{'where':{'id':_0x136919['id']},'transaction':_0x797ba1})['then'](function(){return db[_0xf160('0x62')][_0xf160('0x2b')]({'where':{'VoicePrefixId':_0x136919['id']},'transaction':_0x797ba1})[_0xf160('0x2a')](function(){return db[_0xf160('0x62')][_0xf160('0x4c')]({'where':{'id':_0x136919[_0xf160('0x71')]},'raw':!![]})[_0xf160('0x2a')](function(_0x59b63c){return createVoicePrefixExtensions(_0x136919,_0x59b63c,_0x797ba1);});});});})['then'](function(){return db[_0xf160('0x33')][_0xf160('0x72')](_0x136919['id']);})[_0xf160('0x2a')](respondWithResult(_0x4b9d21,null))[_0xf160('0x49')](handleError(_0x4b9d21,null));};exports[_0xf160('0x73')]=function(_0x722f3a,_0x2f434c,_0x484b18){return db[_0xf160('0x33')][_0xf160('0x4c')]({'where':{'id':_0x722f3a['params']['id']}})['then'](handleEntityNotFound(_0x2f434c,null))[_0xf160('0x2a')](function(_0x14d69d){if(_0x14d69d){return _0x14d69d['addAgents'](_0x722f3a[_0xf160('0x4f')][_0xf160('0x74')],_['omit'](_0x722f3a[_0xf160('0x4f')],['ids','id'])||{})[_0xf160('0x75')](function(_0x355226){for(var _0x74028e=0x0;_0x74028e<_0x722f3a[_0xf160('0x4f')]['ids'][_0xf160('0x3c')];_0x74028e+=0x1){socket[_0xf160('0x76')](_0xf160('0x77'),{'UserId':Number(_0x722f3a[_0xf160('0x4f')][_0xf160('0x74')][_0x74028e]),'VoicePrefixId':Number(_0x722f3a['params']['id'])});}return _0x355226;});}})[_0xf160('0x2a')](respondWithResult(_0x2f434c,null))[_0xf160('0x49')](handleError(_0x2f434c,null));};exports[_0xf160('0x78')]=function(_0x5275b4,_0x2396f6,_0x1165f5){return db[_0xf160('0x33')][_0xf160('0x4c')]({'where':{'id':_0x5275b4[_0xf160('0x4b')]['id']}})[_0xf160('0x2a')](handleEntityNotFound(_0x2396f6,null))[_0xf160('0x2a')](function(_0x543534){if(_0x543534){return _0x543534[_0xf160('0x78')](_0x5275b4[_0xf160('0x36')][_0xf160('0x74')])[_0xf160('0x2a')](function(){if(_[_0xf160('0x79')](_0x5275b4['query'][_0xf160('0x74')])){for(var _0x3526cd=0x0;_0x3526cd<_0x5275b4[_0xf160('0x36')][_0xf160('0x74')][_0xf160('0x3c')];_0x3526cd+=0x1){socket[_0xf160('0x76')](_0xf160('0x7a'),{'UserId':Number(_0x5275b4[_0xf160('0x36')][_0xf160('0x74')][_0x3526cd]),'VoicePrefixId':Number(_0x5275b4[_0xf160('0x4b')]['id'])});}}else{socket[_0xf160('0x76')]('userVoicePrefix:remove',{'UserId':Number(_0x5275b4[_0xf160('0x36')]['ids']),'VoicePrefixId':Number(_0x5275b4[_0xf160('0x4b')]['id'])});}});}})[_0xf160('0x2a')](respondWithStatusCode(_0x2396f6,null))[_0xf160('0x49')](handleError(_0x2396f6,null));};exports[_0xf160('0x7b')]=function(_0x6ff6b1,_0x59281e,_0x3f873a){var _0x38426d={};var _0x2a992a={};var _0x185268;var _0x5927c9;return db['VoicePrefix'][_0xf160('0x7c')]({'where':{'id':_0x6ff6b1['params']['id']}})[_0xf160('0x2a')](handleEntityNotFound(_0x59281e,null))['then'](function(_0x21b93a){if(_0x21b93a){_0x185268=_0x21b93a;_0x2a992a['model']=_['keys'](db[_0xf160('0x7d')][_0xf160('0x34')]);_0x2a992a[_0xf160('0x36')]=_[_0xf160('0x37')](_0x6ff6b1[_0xf160('0x36')]);_0x2a992a[_0xf160('0x38')]=_[_0xf160('0x39')](_0x2a992a[_0xf160('0x35')],_0x2a992a[_0xf160('0x36')]);_0x38426d['attributes']=_['intersection'](_0x2a992a[_0xf160('0x35')],qs[_0xf160('0x3b')](_0x6ff6b1[_0xf160('0x36')][_0xf160('0x3b')]));_0x38426d[_0xf160('0x3a')]=_0x38426d['attributes'][_0xf160('0x3c')]?_0x38426d[_0xf160('0x3a')]:_0x2a992a[_0xf160('0x35')];_0x38426d[_0xf160('0x3d')]=qs['sort'](_0x6ff6b1['query']['sort']);_0x38426d[_0xf160('0x3f')]=qs['filters'](_[_0xf160('0x40')](_0x6ff6b1['query'],_0x2a992a[_0xf160('0x38')]));if(_0x6ff6b1[_0xf160('0x36')]['filter']){_0x38426d[_0xf160('0x3f')]=_[_0xf160('0x42')](_0x38426d[_0xf160('0x3f')],{'$or':_[_0xf160('0x32')](_0x38426d[_0xf160('0x3a')],function(_0x39ec7e){var _0x2558b8={};_0x2558b8[_0x39ec7e]={'$like':'%'+_0x6ff6b1['query']['filter']+'%'};return _0x2558b8;})});}_0x38426d=_[_0xf160('0x42')]({},_0x38426d,_0x6ff6b1[_0xf160('0x44')]);return _0x185268[_0xf160('0x7b')](_0x38426d);}})['then'](function(_0x5316c5){if(_0x5316c5){_0x5927c9=_0x5316c5[_0xf160('0x3c')];if(!_0x6ff6b1[_0xf160('0x36')][_0xf160('0x7e')](_0xf160('0x7f'))){_0x38426d[_0xf160('0x22')]=qs[_0xf160('0x22')](_0x6ff6b1[_0xf160('0x36')][_0xf160('0x22')]);_0x38426d[_0xf160('0x20')]=qs[_0xf160('0x20')](_0x6ff6b1['query'][_0xf160('0x20')]);}return _0x185268[_0xf160('0x7b')](_0x38426d);}})[_0xf160('0x2a')](function(_0x3ee8d8){if(_0x3ee8d8){return _0x3ee8d8?{'count':_0x5927c9,'rows':_0x3ee8d8}:null;}})[_0xf160('0x2a')](respondWithResult(_0x59281e,null))[_0xf160('0x49')](handleError(_0x59281e,null));};exports['getTeams']=function(_0x336560,_0x120282,_0x2b6e56){var _0x362718={};var _0xcf5dee={};var _0x2a8af4;var _0x224dcc;return db[_0xf160('0x33')]['findOne']({'where':{'id':_0x336560['params']['id']}})[_0xf160('0x2a')](handleEntityNotFound(_0x120282,null))[_0xf160('0x2a')](function(_0x55865d){if(_0x55865d){_0x2a8af4=_0x55865d;_0xcf5dee[_0xf160('0x35')]=_[_0xf160('0x37')](db[_0xf160('0x80')][_0xf160('0x34')]);_0xcf5dee[_0xf160('0x36')]=_[_0xf160('0x37')](_0x336560[_0xf160('0x36')]);_0xcf5dee[_0xf160('0x38')]=_[_0xf160('0x39')](_0xcf5dee[_0xf160('0x35')],_0xcf5dee['query']);_0x362718[_0xf160('0x3a')]=_[_0xf160('0x39')](_0xcf5dee[_0xf160('0x35')],qs[_0xf160('0x3b')](_0x336560[_0xf160('0x36')]['fields']));_0x362718[_0xf160('0x3a')]=_0x362718[_0xf160('0x3a')][_0xf160('0x3c')]?_0x362718[_0xf160('0x3a')]:_0xcf5dee['model'];_0x362718[_0xf160('0x3d')]=qs[_0xf160('0x3e')](_0x336560['query']['sort']);_0x362718['where']=qs['filters'](_['pick'](_0x336560[_0xf160('0x36')],_0xcf5dee[_0xf160('0x38')]));if(_0x336560['query']['filter']){_0x362718[_0xf160('0x3f')]=_[_0xf160('0x42')](_0x362718['where'],{'$or':_[_0xf160('0x32')](_0x362718['attributes'],function(_0x32fb34){var _0x3b1d1a={};_0x3b1d1a[_0x32fb34]={'$like':'%'+_0x336560[_0xf160('0x36')]['filter']+'%'};return _0x3b1d1a;})});}_0x362718=_[_0xf160('0x42')]({},_0x362718,_0x336560['options']);return _0x2a8af4[_0xf160('0x81')](_0x362718);}})['then'](function(_0x308dd9){if(_0x308dd9){_0x224dcc=_0x308dd9['length'];if(!_0x336560[_0xf160('0x36')]['hasOwnProperty'](_0xf160('0x7f'))){_0x362718[_0xf160('0x22')]=qs['limit'](_0x336560[_0xf160('0x36')][_0xf160('0x22')]);_0x362718['offset']=qs[_0xf160('0x20')](_0x336560[_0xf160('0x36')][_0xf160('0x20')]);}return _0x2a8af4[_0xf160('0x81')](_0x362718);}})['then'](function(_0x5cdecf){if(_0x5cdecf){return _0x5cdecf?{'count':_0x224dcc,'rows':_0x5cdecf}:null;}})[_0xf160('0x2a')](respondWithResult(_0x120282,null))[_0xf160('0x49')](handleError(_0x120282,null));};exports['addTeams']=function(_0x28b2cb,_0x24e3b5,_0x5c0dc8){var _0x182ed8=_0x28b2cb['body'][_0xf160('0x74')];var _0x2eada8;return db[_0xf160('0x80')]['findAll']({'where':{'id':_0x182ed8},'attributes':['id'],'include':[{'model':db[_0xf160('0x7d')],'as':_0xf160('0x82'),'attributes':['id',_0xf160('0x2f'),_0xf160('0x83'),_0xf160('0x84'),_0xf160('0x85')],'raw':!![]}]})[_0xf160('0x2a')](function(_0x2dbb52){if(_0x2dbb52){_0x2eada8=_0x2dbb52;var _0x5b29e0=_['flatMap'](_0x2dbb52,function(_0x2ae1dc){var _0x50912b=_0x2ae1dc['get']({'plain':!![]});return _0x50912b[_0xf160('0x82')];});return db['VoicePrefix'][_0xf160('0x4c')]({'where':{'id':_0x28b2cb[_0xf160('0x4b')]['id']}})[_0xf160('0x2a')](function(_0x26aa72){return db[_0xf160('0x70')][_0xf160('0x86')](function(_0x1bef1a){return _0x26aa72[_0xf160('0x87')](_0x182ed8,{'transaction':_0x1bef1a})[_0xf160('0x2a')](function(){return BPromise[_0xf160('0x88')](_0x2eada8,function(_0x154789){return db[_0xf160('0x89')][_0xf160('0x8a')]({'TeamId':_0x154789['id'],'VoicePrefixId':_0x28b2cb['params']['id']},{'transaction':_0x1bef1a});});})[_0xf160('0x2a')](function(){return BPromise[_0xf160('0x88')](_0x5b29e0,function(_0x3e46d1){return db[_0xf160('0x8b')][_0xf160('0x8c')]({'where':{'UserId':_0x3e46d1['id'],'VoicePrefixId':_0x28b2cb[_0xf160('0x4b')]['id']},'transaction':_0x1bef1a});});})[_0xf160('0x2a')](function(){_0x5b29e0[_0xf160('0x8d')](function(_0x3e9116){socket[_0xf160('0x76')](_0xf160('0x77'),{'UserId':_0x3e9116['id'],'VoicePrefixId':_0x26aa72['id']});});});});});}})[_0xf160('0x2a')](respondWithStatusCode(_0x24e3b5,null))[_0xf160('0x49')](handleError(_0x24e3b5,null));};exports[_0xf160('0x8e')]=function(_0x481f96,_0x4186f7,_0x37579a){return db[_0xf160('0x80')][_0xf160('0x47')]({'where':{'id':_0x481f96[_0xf160('0x36')][_0xf160('0x74')]},'attributes':['id'],'include':[{'model':db[_0xf160('0x7d')],'as':_0xf160('0x82'),'attributes':['id'],'raw':!![]}]})[_0xf160('0x2a')](handleEntityNotFound(_0x4186f7,null))[_0xf160('0x2a')](function(_0x36c1c5){var _0x4753d6=_[_0xf160('0x32')](_0x36c1c5,'id');var _0x2c486d=[];var _0x26332b=[];var _0x539056=squel['select']();_0x539056['field'](_0xf160('0x8f'))[_0xf160('0x90')](_0xf160('0x91'),'tq')[_0xf160('0x92')](_0xf160('0x93'),'ut',_0xf160('0x94'))['where'](_0xf160('0x95'),_0x481f96[_0xf160('0x4b')]['id']);for(var _0x1d308e=0x0;_0x1d308e<_0x36c1c5[_0xf160('0x3c')];_0x1d308e+=0x1){let _0x5bc8a3=_0x36c1c5[_0x1d308e];for(var _0x19dc59=0x0;_0x19dc59<_0x5bc8a3[_0xf160('0x82')][_0xf160('0x3c')];_0x19dc59+=0x1){let _0x35de2b=_0x5bc8a3[_0xf160('0x82')][_0x19dc59];var _0x446548=_0x539056[_0xf160('0x96')]();_0x446548[_0xf160('0x3f')](_0xf160('0x97'),_0x35de2b['id']);_0x26332b[_0xf160('0x66')](db[_0xf160('0x70')][_0xf160('0x36')](_0x446548[_0xf160('0x98')](),{'type':db[_0xf160('0x70')][_0xf160('0x99')][_0xf160('0x9a')]})[_0xf160('0x2a')](function(_0x258ad9){if(_0x258ad9['length']===0x1){return _0x35de2b['id'];}else{var _0x27d3ef=_['every'](_['map'](_0x258ad9,'TeamId'),function(_0x191d89){return _[_0xf160('0x9b')](_0x4753d6,_0x191d89);});if(_0x27d3ef){return _0x35de2b['id'];}}}));}}return BPromise[_0xf160('0x9c')](_0x26332b)[_0xf160('0x2a')](function(_0x2391f9){_0x2c486d=_(_0x2c486d)['union'](_0x2391f9)['compact']()[_0xf160('0x9d')]();return db[_0xf160('0x33')]['find']({'where':{'id':_0x481f96[_0xf160('0x4b')]['id']}})[_0xf160('0x2a')](function(_0x3d9b9b){return db[_0xf160('0x70')][_0xf160('0x86')](function(_0x563e5d){return _0x3d9b9b[_0xf160('0x8e')](_0x481f96['query'][_0xf160('0x74')],{'transaction':_0x563e5d})[_0xf160('0x2a')](function(){if(!_[_0xf160('0x9e')](_0x2c486d)){return _0x3d9b9b['removeAgents'](_0x2c486d,{'transaction':_0x563e5d});}})[_0xf160('0x2a')](function(){_0x2c486d[_0xf160('0x8d')](function(_0xfb5d28){socket[_0xf160('0x76')](_0xf160('0x7a'),{'UserId':_0xfb5d28,'VoicePrefixId':_0x3d9b9b['id']});});});});});});})[_0xf160('0x2a')](respondWithStatusCode(_0x4186f7,null))[_0xf160('0x49')](handleError(_0x4186f7,null));}; \ No newline at end of file +var _0xdd4f=['lodash','squel','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./voicePrefix.socket','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','then','get','VoicePrefixes','UserProfileResource','destroy','error','stack','name','send','map','VoicePrefix','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','describe','create','transaction','body','VoiceExtension','find','VoiceExtensionId','user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','exten','app','description','Voice\x20Prefix\x20Extension','priority','appdata','prefix','NoOp','Voice\x20Prefix','VoicePrefixId','bulkCreate','Extensions\x20creation\x20failed','Set','CDR(prefix)=','callerIdAll','push','PREFIX-CALLERIDALL=','No\x20callerid\x20available','charAt','update','system-','sequelize','findById','addAgents','spread','ids','emit','userVoicePrefix:save','removeAgents','isArray','getAgents','findOne','rawAttributes','order','getTeams','Team','nolimit','findAll','User','Agents','online','voicePause','interface','flatMap','each','TeamVoicePrefix','upsert','UserVoicePrefix','findOrCreate','forEach','select','field','tq.TeamId','from','team_has_voice_prefixes','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','every','TeamId','includes','union','compact','removeTeams','userVoicePrefix:remove','eml-format','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra'];(function(_0x15cb7c,_0x549287){var _0xa0674d=function(_0x4ac069){while(--_0x4ac069){_0x15cb7c['push'](_0x15cb7c['shift']());}};_0xa0674d(++_0x549287);}(_0xdd4f,0x1ce));var _0xfdd4=function(_0x52f1ad,_0x4451ed){_0x52f1ad=_0x52f1ad-0x0;var _0x2ebbe1=_0xdd4f[_0x52f1ad];return _0x2ebbe1;};'use strict';var emlformat=require(_0xfdd4('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xfdd4('0x1'));var moment=require(_0xfdd4('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xfdd4('0x3'));var util=require(_0xfdd4('0x4'));var path=require(_0xfdd4('0x5'));var sox=require('sox');var csv=require(_0xfdd4('0x6'));var ejs=require(_0xfdd4('0x7'));var fs=require('fs');var fs_extra=require(_0xfdd4('0x8'));var _=require(_0xfdd4('0x9'));var squel=require(_0xfdd4('0xa'));var crypto=require('crypto');var jsforce=require(_0xfdd4('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xfdd4('0x6'));var querystring=require(_0xfdd4('0xc'));var Papa=require(_0xfdd4('0xd'));var Redis=require('ioredis');var authService=require(_0xfdd4('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xfdd4('0xf'));var hardwareService=require(_0xfdd4('0x10'));var logger=require(_0xfdd4('0x11'))(_0xfdd4('0x12'));var utils=require(_0xfdd4('0x13'));var config=require(_0xfdd4('0x14'));var licenseUtil=require(_0xfdd4('0x15'));var db=require(_0xfdd4('0x16'))['db'];config[_0xfdd4('0x17')]=_[_0xfdd4('0x18')](config[_0xfdd4('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0xfdd4('0x19'))(new Redis(config[_0xfdd4('0x17')]));require(_0xfdd4('0x1a'))['register'](socket);function respondWithStatusCode(_0x1b7da1,_0x4aaeee){_0x4aaeee=_0x4aaeee||0xcc;return function(_0x467824){if(_0x467824){return _0x1b7da1[_0xfdd4('0x1b')](_0x4aaeee);}return _0x1b7da1[_0xfdd4('0x1c')](_0x4aaeee)[_0xfdd4('0x1d')]();};}function respondWithResult(_0x37b05f,_0x52cf2c){_0x52cf2c=_0x52cf2c||0xc8;return function(_0x47ed1d){if(_0x47ed1d){return _0x37b05f['status'](_0x52cf2c)[_0xfdd4('0x1e')](_0x47ed1d);}};}function respondWithFilteredResult(_0x216c7e,_0x2eb174){return function(_0x2ccc88){if(_0x2ccc88){var _0x32b5f7=typeof _0x2eb174[_0xfdd4('0x1f')]===_0xfdd4('0x20')&&typeof _0x2eb174[_0xfdd4('0x21')]===_0xfdd4('0x20');var _0x52ce34=_0x2ccc88[_0xfdd4('0x22')];var _0x3e8eac=_0x32b5f7?0x0:_0x2eb174[_0xfdd4('0x1f')];var _0x36e611=_0x32b5f7?_0x2ccc88[_0xfdd4('0x22')]:_0x2eb174[_0xfdd4('0x1f')]+_0x2eb174[_0xfdd4('0x21')];var _0x34dfa8;if(_0x36e611>=_0x52ce34){_0x36e611=_0x52ce34;_0x34dfa8=0xc8;}else{_0x34dfa8=0xce;}_0x216c7e['status'](_0x34dfa8);return _0x216c7e[_0xfdd4('0x23')](_0xfdd4('0x24'),_0x3e8eac+'-'+_0x36e611+'/'+_0x52ce34)[_0xfdd4('0x1e')](_0x2ccc88);}return null;};}function patchUpdates(_0x16e81b){return function(_0xb7856d){try{jsonpatch[_0xfdd4('0x25')](_0xb7856d,_0x16e81b,!![]);}catch(_0x451767){return BPromise[_0xfdd4('0x26')](_0x451767);}return _0xb7856d['save']();};}function saveUpdates(_0x1e14da,_0x1112e8){return function(_0x4397a3){if(_0x4397a3){return _0x4397a3['update'](_0x1e14da)[_0xfdd4('0x27')](function(_0x39b712){return _0x39b712;});}return null;};}function removeEntity(_0xf9c346,_0x2f8268){return function(_0x1ade42){if(_0x1ade42){return _0x1ade42['destroy']()[_0xfdd4('0x27')](function(){var _0x2c88ad=_0x1ade42[_0xfdd4('0x28')]({'plain':!![]});var _0x31e053=_0xfdd4('0x29');return db[_0xfdd4('0x2a')][_0xfdd4('0x2b')]({'where':{'type':_0x31e053,'resourceId':_0x2c88ad['id']}})[_0xfdd4('0x27')](function(){return _0x1ade42;});})['then'](function(){_0xf9c346[_0xfdd4('0x1c')](0xcc)[_0xfdd4('0x1d')]();});}};}function handleEntityNotFound(_0x385a68,_0xef012e){return function(_0x2207ae){if(!_0x2207ae){_0x385a68['sendStatus'](0x194);}return _0x2207ae;};}function handleError(_0xd127b1,_0x3372d2){_0x3372d2=_0x3372d2||0x1f4;return function(_0xbf38b4){logger[_0xfdd4('0x2c')](_0xbf38b4[_0xfdd4('0x2d')]);if(_0xbf38b4['name']){delete _0xbf38b4[_0xfdd4('0x2e')];}_0xd127b1[_0xfdd4('0x1c')](_0x3372d2)[_0xfdd4('0x2f')](_0xbf38b4);};}exports['index']=function(_0x3fd07a,_0x502776){var _0x2a65c8={},_0x2b22f9={},_0x4aa4f2={'count':0x0,'rows':[]};var _0x50b748=_[_0xfdd4('0x30')](db[_0xfdd4('0x31')]['rawAttributes'],function(_0x557d7b){return{'name':_0x557d7b[_0xfdd4('0x32')],'type':_0x557d7b[_0xfdd4('0x33')][_0xfdd4('0x34')]};});_0x2b22f9[_0xfdd4('0x35')]=_[_0xfdd4('0x30')](_0x50b748,_0xfdd4('0x2e'));_0x2b22f9[_0xfdd4('0x36')]=_[_0xfdd4('0x37')](_0x3fd07a[_0xfdd4('0x36')]);_0x2b22f9[_0xfdd4('0x38')]=_[_0xfdd4('0x39')](_0x2b22f9[_0xfdd4('0x35')],_0x2b22f9[_0xfdd4('0x36')]);_0x2a65c8[_0xfdd4('0x3a')]=_[_0xfdd4('0x39')](_0x2b22f9[_0xfdd4('0x35')],qs[_0xfdd4('0x3b')](_0x3fd07a[_0xfdd4('0x36')][_0xfdd4('0x3b')]));_0x2a65c8[_0xfdd4('0x3a')]=_0x2a65c8[_0xfdd4('0x3a')][_0xfdd4('0x3c')]?_0x2a65c8[_0xfdd4('0x3a')]:_0x2b22f9[_0xfdd4('0x35')];if(!_0x3fd07a[_0xfdd4('0x36')][_0xfdd4('0x3d')]('nolimit')){_0x2a65c8[_0xfdd4('0x21')]=qs[_0xfdd4('0x21')](_0x3fd07a[_0xfdd4('0x36')][_0xfdd4('0x21')]);_0x2a65c8[_0xfdd4('0x1f')]=qs[_0xfdd4('0x1f')](_0x3fd07a['query'][_0xfdd4('0x1f')]);}_0x2a65c8['order']=qs[_0xfdd4('0x3e')](_0x3fd07a[_0xfdd4('0x36')][_0xfdd4('0x3e')]);_0x2a65c8[_0xfdd4('0x3f')]=qs['filters'](_[_0xfdd4('0x40')](_0x3fd07a[_0xfdd4('0x36')],_0x2b22f9[_0xfdd4('0x38')]),_0x50b748);if(_0x3fd07a[_0xfdd4('0x36')][_0xfdd4('0x41')]){_0x2a65c8[_0xfdd4('0x3f')]=_[_0xfdd4('0x42')](_0x2a65c8[_0xfdd4('0x3f')],{'$or':_[_0xfdd4('0x30')](_0x50b748,function(_0x83673d){if(_0x83673d['type']!==_0xfdd4('0x43')){var _0x2196f={};_0x2196f[_0x83673d[_0xfdd4('0x2e')]]={'$like':'%'+_0x3fd07a[_0xfdd4('0x36')]['filter']+'%'};return _0x2196f;}})});}_0x2a65c8=_[_0xfdd4('0x42')]({},_0x2a65c8,_0x3fd07a[_0xfdd4('0x44')]);var _0x30524f={'where':_0x2a65c8[_0xfdd4('0x3f')]};return db[_0xfdd4('0x31')]['count'](_0x30524f)[_0xfdd4('0x27')](function(_0x23af2a){_0x4aa4f2[_0xfdd4('0x22')]=_0x23af2a;if(_0x3fd07a[_0xfdd4('0x36')][_0xfdd4('0x45')]){_0x2a65c8[_0xfdd4('0x46')]=[{'all':!![]}];}return db[_0xfdd4('0x31')]['findAll'](_0x2a65c8);})[_0xfdd4('0x27')](function(_0x586713){_0x4aa4f2[_0xfdd4('0x47')]=_0x586713;return _0x4aa4f2;})[_0xfdd4('0x27')](respondWithFilteredResult(_0x502776,_0x2a65c8))[_0xfdd4('0x48')](handleError(_0x502776,null));};exports[_0xfdd4('0x49')]=function(_0x5367aa,_0x419578){var _0x11e90a={'raw':![],'where':{'id':_0x5367aa[_0xfdd4('0x4a')]['id']}},_0x4d1dfe={};_0x4d1dfe[_0xfdd4('0x35')]=_['keys'](db[_0xfdd4('0x31')]['rawAttributes']);_0x4d1dfe['query']=_['keys'](_0x5367aa[_0xfdd4('0x36')]);_0x4d1dfe[_0xfdd4('0x38')]=_[_0xfdd4('0x39')](_0x4d1dfe['model'],_0x4d1dfe[_0xfdd4('0x36')]);_0x11e90a[_0xfdd4('0x3a')]=_['intersection'](_0x4d1dfe[_0xfdd4('0x35')],qs[_0xfdd4('0x3b')](_0x5367aa[_0xfdd4('0x36')][_0xfdd4('0x3b')]));_0x11e90a[_0xfdd4('0x3a')]=_0x11e90a[_0xfdd4('0x3a')][_0xfdd4('0x3c')]?_0x11e90a[_0xfdd4('0x3a')]:_0x4d1dfe[_0xfdd4('0x35')];if(_0x5367aa[_0xfdd4('0x36')][_0xfdd4('0x45')]){_0x11e90a[_0xfdd4('0x46')]=[{'all':!![]}];}_0x11e90a=_[_0xfdd4('0x42')]({},_0x11e90a,_0x5367aa[_0xfdd4('0x44')]);return db['VoicePrefix']['find'](_0x11e90a)[_0xfdd4('0x27')](handleEntityNotFound(_0x419578,null))[_0xfdd4('0x27')](respondWithResult(_0x419578,null))[_0xfdd4('0x48')](handleError(_0x419578,null));};exports[_0xfdd4('0x2b')]=function(_0x507bf5,_0x3c6828){return db[_0xfdd4('0x31')]['find']({'where':{'id':_0x507bf5['params']['id']}})['then'](handleEntityNotFound(_0x3c6828,null))['then'](removeEntity(_0x3c6828,null))['catch'](handleError(_0x3c6828,null));};exports[_0xfdd4('0x4b')]=function(_0x88e9ef,_0x3a4202){return db[_0xfdd4('0x31')][_0xfdd4('0x4b')]()[_0xfdd4('0x27')](respondWithResult(_0x3a4202,null))['catch'](handleError(_0x3a4202,null));};exports[_0xfdd4('0x4c')]=function(_0x1f521a,_0x1dd417){var _0x2355b5;return db['sequelize'][_0xfdd4('0x4d')](function(_0x8aa0ea){return db['VoicePrefix'][_0xfdd4('0x4c')](_0x1f521a[_0xfdd4('0x4e')],{'transaction':_0x8aa0ea})['then'](function(_0x5467d1){_0x2355b5=_0x5467d1[_0xfdd4('0x28')]({'plain':!![]});return db[_0xfdd4('0x4f')][_0xfdd4('0x50')]({'where':{'id':_0x2355b5[_0xfdd4('0x51')]},'raw':!![]})[_0xfdd4('0x27')](function(_0x1b9979){return createVoicePrefixExtensions(_0x2355b5,_0x1b9979,_0x8aa0ea);});});})[_0xfdd4('0x27')](function(){var _0x3de4fd=_0x1f521a['user'][_0xfdd4('0x28')]({'plain':!![]});if(!_0x3de4fd)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3de4fd['role']===_0xfdd4('0x52')){var _0x1d9a8d=_0x2355b5;return db['UserProfileSection']['find']({'where':{'name':'VoicePrefixes','userProfileId':_0x3de4fd[_0xfdd4('0x53')]},'raw':!![]})[_0xfdd4('0x27')](function(_0x4dc113){if(_0x4dc113&&_0x4dc113[_0xfdd4('0x54')]===0x0){return db[_0xfdd4('0x2a')][_0xfdd4('0x4c')]({'name':_0x1d9a8d[_0xfdd4('0x2e')],'resourceId':_0x1d9a8d['id'],'type':_0x4dc113[_0xfdd4('0x2e')],'sectionId':_0x4dc113['id']},{})['then'](function(){return _0x2355b5;});}else{return _0x2355b5;}})['catch'](function(_0x483942){logger['error'](_0xfdd4('0x55'),_0x483942);throw _0x483942;});}return _0x2355b5;})[_0xfdd4('0x27')](respondWithResult(_0x1dd417,null))['catch'](handleError(_0x1dd417,null));};function Extension(_0x1eee3d,_0x2abe50,_0x4d4304,_0x45dcc8){this[_0xfdd4('0x56')]='from-sip';this[_0xfdd4('0x57')]=_0x1eee3d;this[_0xfdd4('0x58')]=_0x4d4304;this[_0xfdd4('0x33')]='system';this[_0xfdd4('0x59')]=_0xfdd4('0x5a');this[_0xfdd4('0x5b')]=_0x2abe50;this[_0xfdd4('0x5c')]=_0x45dcc8;}function createVoicePrefixExtensions(_0x5c7be,_0x562417,_0x2cc3e2){return new BPromise(function(_0x2ee4b6,_0x3be4d5){var _0x202124=new Extension(formatPrefixName(_0x5c7be[_0xfdd4('0x5d')]),0x1,_0xfdd4('0x5e'),_0xfdd4('0x5f'));_0x202124[_0xfdd4('0x60')]=_0x5c7be['id'];return db[_0xfdd4('0x4f')]['create'](_0x202124,{'transaction':_0x2cc3e2})[_0xfdd4('0x27')](function(_0x2799b2){var _0x4483e1=_0x2799b2[_0xfdd4('0x28')]({'plain':!![]});var _0x3096fa=_['map'](addVoicePrefixExtensions(_0x5c7be,_0x562417),function(_0x46e7eb){_0x46e7eb[_0xfdd4('0x51')]=_0x4483e1['id'];_0x46e7eb[_0xfdd4('0x60')]=_0x5c7be['id'];return _0x46e7eb;});return db[_0xfdd4('0x4f')][_0xfdd4('0x61')](_0x3096fa,{'transaction':_0x2cc3e2})[_0xfdd4('0x27')](function(_0x180ad9){if(!_0x180ad9){return _0x3be4d5(_0xfdd4('0x62'));}else{return _0x2ee4b6(_0x180ad9);}})[_0xfdd4('0x48')](function(_0x2a0dd8){return _0x3be4d5(_0x2a0dd8);});});;});};function addVoicePrefixExtensions(_0x2fff30,_0x2792c4){var _0x1205b8=[];var _0x527068=formatPrefixName(_0x2fff30[_0xfdd4('0x5d')]);_0x1205b8['push'](new Extension(_0x527068,0x2,_0xfdd4('0x63'),_0xfdd4('0x64')+_0x2fff30[_0xfdd4('0x2e')]));if(_0x2fff30[_0xfdd4('0x65')]){_0x1205b8[_0xfdd4('0x66')](new Extension(_0x527068,0x3,_0xfdd4('0x63'),_0xfdd4('0x67')+_0x2fff30[_0xfdd4('0x65')]));}else{_0x1205b8[_0xfdd4('0x66')](new Extension(_0x527068,0x3,_0xfdd4('0x5e'),_0xfdd4('0x68')));}_0x1205b8[_0xfdd4('0x66')](new Extension(_0x527068,0x4,'goto',_0x2792c4['context']+','+'${EXTEN:'+(0x8+_0x2fff30[_0xfdd4('0x2e')][_0xfdd4('0x3c')])+'}'+','+0x1));return _0x1205b8;}function formatPrefixName(_0x4bb18b){var _0x3a367c='_';for(var _0x3f027b=0x0;_0x3f027b<_0x4bb18b[_0xfdd4('0x3c')];_0x3f027b++){if(_0x4bb18b[_0xfdd4('0x69')](_0x3f027b)=='-'){_0x3a367c+=_0x4bb18b[_0xfdd4('0x69')](_0x3f027b);}else{_0x3a367c+='['+_0x4bb18b['charAt'](_0x3f027b)+']';}}_0x3a367c+='.';return _0x3a367c;}exports[_0xfdd4('0x6a')]=function(_0x297432,_0x3958cd,_0x523085){var _0x366f1c=_0x297432['body'];_0x366f1c[_0xfdd4('0x5d')]=_0xfdd4('0x6b')+_0x366f1c[_0xfdd4('0x2e')]+'-';return db[_0xfdd4('0x6c')]['transaction'](function(_0x2351b6){return db[_0xfdd4('0x31')]['update'](_0x366f1c,{'where':{'id':_0x366f1c['id']},'transaction':_0x2351b6})[_0xfdd4('0x27')](function(){return db[_0xfdd4('0x4f')][_0xfdd4('0x2b')]({'where':{'VoicePrefixId':_0x366f1c['id']},'transaction':_0x2351b6})['then'](function(){return db[_0xfdd4('0x4f')][_0xfdd4('0x50')]({'where':{'id':_0x366f1c[_0xfdd4('0x51')]},'raw':!![]})['then'](function(_0x3f4337){return createVoicePrefixExtensions(_0x366f1c,_0x3f4337,_0x2351b6);});});});})[_0xfdd4('0x27')](function(){return db[_0xfdd4('0x31')][_0xfdd4('0x6d')](_0x366f1c['id']);})[_0xfdd4('0x27')](respondWithResult(_0x3958cd,null))[_0xfdd4('0x48')](handleError(_0x3958cd,null));};exports[_0xfdd4('0x6e')]=function(_0x539d3b,_0x147d54,_0x36b615){return db[_0xfdd4('0x31')][_0xfdd4('0x50')]({'where':{'id':_0x539d3b[_0xfdd4('0x4a')]['id']}})[_0xfdd4('0x27')](handleEntityNotFound(_0x147d54,null))[_0xfdd4('0x27')](function(_0x4987d6){if(_0x4987d6){return _0x4987d6['addAgents'](_0x539d3b[_0xfdd4('0x4e')]['ids'],_['omit'](_0x539d3b[_0xfdd4('0x4e')],['ids','id'])||{})[_0xfdd4('0x6f')](function(_0x51711a){for(var _0x4576ce=0x0;_0x4576ce<_0x539d3b[_0xfdd4('0x4e')][_0xfdd4('0x70')][_0xfdd4('0x3c')];_0x4576ce+=0x1){socket[_0xfdd4('0x71')](_0xfdd4('0x72'),{'UserId':Number(_0x539d3b[_0xfdd4('0x4e')]['ids'][_0x4576ce]),'VoicePrefixId':Number(_0x539d3b['params']['id'])});}return _0x51711a;});}})[_0xfdd4('0x27')](respondWithResult(_0x147d54,null))['catch'](handleError(_0x147d54,null));};exports[_0xfdd4('0x73')]=function(_0x1a82ee,_0x3b205f,_0x1d57f8){return db[_0xfdd4('0x31')][_0xfdd4('0x50')]({'where':{'id':_0x1a82ee[_0xfdd4('0x4a')]['id']}})['then'](handleEntityNotFound(_0x3b205f,null))['then'](function(_0x37a342){if(_0x37a342){return _0x37a342[_0xfdd4('0x73')](_0x1a82ee[_0xfdd4('0x36')][_0xfdd4('0x70')])[_0xfdd4('0x27')](function(){if(_[_0xfdd4('0x74')](_0x1a82ee[_0xfdd4('0x36')][_0xfdd4('0x70')])){for(var _0xf78c69=0x0;_0xf78c69<_0x1a82ee[_0xfdd4('0x36')][_0xfdd4('0x70')][_0xfdd4('0x3c')];_0xf78c69+=0x1){socket[_0xfdd4('0x71')]('userVoicePrefix:remove',{'UserId':Number(_0x1a82ee['query'][_0xfdd4('0x70')][_0xf78c69]),'VoicePrefixId':Number(_0x1a82ee[_0xfdd4('0x4a')]['id'])});}}else{socket['emit']('userVoicePrefix:remove',{'UserId':Number(_0x1a82ee[_0xfdd4('0x36')][_0xfdd4('0x70')]),'VoicePrefixId':Number(_0x1a82ee['params']['id'])});}});}})[_0xfdd4('0x27')](respondWithStatusCode(_0x3b205f,null))[_0xfdd4('0x48')](handleError(_0x3b205f,null));};exports[_0xfdd4('0x75')]=function(_0x11db43,_0x5ec62b,_0x25c078){var _0x5d356c={};var _0x3924c7={};var _0x2f65d7;var _0x4783b9;return db[_0xfdd4('0x31')][_0xfdd4('0x76')]({'where':{'id':_0x11db43[_0xfdd4('0x4a')]['id']}})[_0xfdd4('0x27')](handleEntityNotFound(_0x5ec62b,null))[_0xfdd4('0x27')](function(_0x575bc2){if(_0x575bc2){_0x2f65d7=_0x575bc2;_0x3924c7['model']=_[_0xfdd4('0x37')](db['User'][_0xfdd4('0x77')]);_0x3924c7[_0xfdd4('0x36')]=_[_0xfdd4('0x37')](_0x11db43[_0xfdd4('0x36')]);_0x3924c7[_0xfdd4('0x38')]=_['intersection'](_0x3924c7['model'],_0x3924c7[_0xfdd4('0x36')]);_0x5d356c['attributes']=_[_0xfdd4('0x39')](_0x3924c7['model'],qs[_0xfdd4('0x3b')](_0x11db43[_0xfdd4('0x36')][_0xfdd4('0x3b')]));_0x5d356c[_0xfdd4('0x3a')]=_0x5d356c[_0xfdd4('0x3a')][_0xfdd4('0x3c')]?_0x5d356c[_0xfdd4('0x3a')]:_0x3924c7[_0xfdd4('0x35')];_0x5d356c[_0xfdd4('0x78')]=qs[_0xfdd4('0x3e')](_0x11db43[_0xfdd4('0x36')]['sort']);_0x5d356c[_0xfdd4('0x3f')]=qs[_0xfdd4('0x38')](_[_0xfdd4('0x40')](_0x11db43[_0xfdd4('0x36')],_0x3924c7[_0xfdd4('0x38')]));if(_0x11db43[_0xfdd4('0x36')][_0xfdd4('0x41')]){_0x5d356c[_0xfdd4('0x3f')]=_[_0xfdd4('0x42')](_0x5d356c['where'],{'$or':_['map'](_0x5d356c[_0xfdd4('0x3a')],function(_0x244d6d){var _0x30bd32={};_0x30bd32[_0x244d6d]={'$like':'%'+_0x11db43['query'][_0xfdd4('0x41')]+'%'};return _0x30bd32;})});}_0x5d356c=_[_0xfdd4('0x42')]({},_0x5d356c,_0x11db43[_0xfdd4('0x44')]);return _0x2f65d7[_0xfdd4('0x75')](_0x5d356c);}})['then'](function(_0x5868e6){if(_0x5868e6){_0x4783b9=_0x5868e6[_0xfdd4('0x3c')];if(!_0x11db43[_0xfdd4('0x36')][_0xfdd4('0x3d')]('nolimit')){_0x5d356c[_0xfdd4('0x21')]=qs[_0xfdd4('0x21')](_0x11db43[_0xfdd4('0x36')][_0xfdd4('0x21')]);_0x5d356c[_0xfdd4('0x1f')]=qs[_0xfdd4('0x1f')](_0x11db43['query']['offset']);}return _0x2f65d7[_0xfdd4('0x75')](_0x5d356c);}})[_0xfdd4('0x27')](function(_0x6a1410){if(_0x6a1410){return _0x6a1410?{'count':_0x4783b9,'rows':_0x6a1410}:null;}})[_0xfdd4('0x27')](respondWithResult(_0x5ec62b,null))[_0xfdd4('0x48')](handleError(_0x5ec62b,null));};exports[_0xfdd4('0x79')]=function(_0x46edc9,_0x2a4366,_0x5d1a3f){var _0x218d83={};var _0x547c4c={};var _0x464eb0;var _0x1871d6;return db['VoicePrefix'][_0xfdd4('0x76')]({'where':{'id':_0x46edc9[_0xfdd4('0x4a')]['id']}})[_0xfdd4('0x27')](handleEntityNotFound(_0x2a4366,null))[_0xfdd4('0x27')](function(_0x3cd7ae){if(_0x3cd7ae){_0x464eb0=_0x3cd7ae;_0x547c4c[_0xfdd4('0x35')]=_[_0xfdd4('0x37')](db[_0xfdd4('0x7a')][_0xfdd4('0x77')]);_0x547c4c['query']=_[_0xfdd4('0x37')](_0x46edc9['query']);_0x547c4c[_0xfdd4('0x38')]=_['intersection'](_0x547c4c['model'],_0x547c4c[_0xfdd4('0x36')]);_0x218d83[_0xfdd4('0x3a')]=_[_0xfdd4('0x39')](_0x547c4c[_0xfdd4('0x35')],qs[_0xfdd4('0x3b')](_0x46edc9['query'][_0xfdd4('0x3b')]));_0x218d83[_0xfdd4('0x3a')]=_0x218d83[_0xfdd4('0x3a')][_0xfdd4('0x3c')]?_0x218d83[_0xfdd4('0x3a')]:_0x547c4c[_0xfdd4('0x35')];_0x218d83['order']=qs[_0xfdd4('0x3e')](_0x46edc9[_0xfdd4('0x36')]['sort']);_0x218d83['where']=qs[_0xfdd4('0x38')](_[_0xfdd4('0x40')](_0x46edc9[_0xfdd4('0x36')],_0x547c4c['filters']));if(_0x46edc9['query'][_0xfdd4('0x41')]){_0x218d83[_0xfdd4('0x3f')]=_[_0xfdd4('0x42')](_0x218d83['where'],{'$or':_['map'](_0x218d83[_0xfdd4('0x3a')],function(_0xd6eb47){var _0x1927ed={};_0x1927ed[_0xd6eb47]={'$like':'%'+_0x46edc9['query'][_0xfdd4('0x41')]+'%'};return _0x1927ed;})});}_0x218d83=_['merge']({},_0x218d83,_0x46edc9[_0xfdd4('0x44')]);return _0x464eb0[_0xfdd4('0x79')](_0x218d83);}})[_0xfdd4('0x27')](function(_0x4e1dbc){if(_0x4e1dbc){_0x1871d6=_0x4e1dbc[_0xfdd4('0x3c')];if(!_0x46edc9[_0xfdd4('0x36')][_0xfdd4('0x3d')](_0xfdd4('0x7b'))){_0x218d83[_0xfdd4('0x21')]=qs['limit'](_0x46edc9[_0xfdd4('0x36')][_0xfdd4('0x21')]);_0x218d83[_0xfdd4('0x1f')]=qs['offset'](_0x46edc9[_0xfdd4('0x36')][_0xfdd4('0x1f')]);}return _0x464eb0[_0xfdd4('0x79')](_0x218d83);}})[_0xfdd4('0x27')](function(_0x56e5d3){if(_0x56e5d3){return _0x56e5d3?{'count':_0x1871d6,'rows':_0x56e5d3}:null;}})[_0xfdd4('0x27')](respondWithResult(_0x2a4366,null))['catch'](handleError(_0x2a4366,null));};exports['addTeams']=function(_0x528004,_0x206a59,_0x545475){var _0x5e5362=_0x528004['body'][_0xfdd4('0x70')];var _0x728e25;return db[_0xfdd4('0x7a')][_0xfdd4('0x7c')]({'where':{'id':_0x5e5362},'attributes':['id'],'include':[{'model':db[_0xfdd4('0x7d')],'as':_0xfdd4('0x7e'),'attributes':['id',_0xfdd4('0x2e'),_0xfdd4('0x7f'),_0xfdd4('0x80'),_0xfdd4('0x81')],'raw':!![]}]})[_0xfdd4('0x27')](function(_0x2911ca){if(_0x2911ca){_0x728e25=_0x2911ca;var _0x31303f=_[_0xfdd4('0x82')](_0x2911ca,function(_0x46b927){var _0x450c67=_0x46b927[_0xfdd4('0x28')]({'plain':!![]});return _0x450c67[_0xfdd4('0x7e')];});return db[_0xfdd4('0x31')][_0xfdd4('0x50')]({'where':{'id':_0x528004[_0xfdd4('0x4a')]['id']}})[_0xfdd4('0x27')](function(_0x189baf){return db[_0xfdd4('0x6c')][_0xfdd4('0x4d')](function(_0x22f93b){return _0x189baf['addTeams'](_0x5e5362,{'transaction':_0x22f93b})[_0xfdd4('0x27')](function(){return BPromise[_0xfdd4('0x83')](_0x728e25,function(_0xaef5e2){return db[_0xfdd4('0x84')][_0xfdd4('0x85')]({'TeamId':_0xaef5e2['id'],'VoicePrefixId':_0x528004['params']['id']},{'transaction':_0x22f93b});});})[_0xfdd4('0x27')](function(){return BPromise[_0xfdd4('0x83')](_0x31303f,function(_0x19b679){return db[_0xfdd4('0x86')][_0xfdd4('0x87')]({'where':{'UserId':_0x19b679['id'],'VoicePrefixId':_0x528004[_0xfdd4('0x4a')]['id']},'transaction':_0x22f93b});});})['then'](function(){_0x31303f[_0xfdd4('0x88')](function(_0x1a9e62){socket[_0xfdd4('0x71')](_0xfdd4('0x72'),{'UserId':_0x1a9e62['id'],'VoicePrefixId':_0x189baf['id']});});});});});}})[_0xfdd4('0x27')](respondWithStatusCode(_0x206a59,null))[_0xfdd4('0x48')](handleError(_0x206a59,null));};exports['removeTeams']=function(_0x2a6a0d,_0x3d82d1,_0x17d272){return db['Team'][_0xfdd4('0x7c')]({'where':{'id':_0x2a6a0d[_0xfdd4('0x36')]['ids']},'attributes':['id'],'include':[{'model':db['User'],'as':_0xfdd4('0x7e'),'attributes':['id'],'raw':!![]}]})[_0xfdd4('0x27')](handleEntityNotFound(_0x3d82d1,null))[_0xfdd4('0x27')](function(_0xd07645){var _0x5a3249=_[_0xfdd4('0x30')](_0xd07645,'id');var _0x5b22b1=[];var _0xc9955e=[];var _0x42204a=squel[_0xfdd4('0x89')]();_0x42204a[_0xfdd4('0x8a')](_0xfdd4('0x8b'))[_0xfdd4('0x8c')](_0xfdd4('0x8d'),'tq')[_0xfdd4('0x8e')](_0xfdd4('0x8f'),'ut',_0xfdd4('0x90'))[_0xfdd4('0x3f')]('VoicePrefixId\x20=\x20?',_0x2a6a0d[_0xfdd4('0x4a')]['id']);for(var _0x42a3dc=0x0;_0x42a3dc<_0xd07645[_0xfdd4('0x3c')];_0x42a3dc+=0x1){let _0x26316c=_0xd07645[_0x42a3dc];for(var _0x1e7bbb=0x0;_0x1e7bbb<_0x26316c[_0xfdd4('0x7e')]['length'];_0x1e7bbb+=0x1){let _0xfd0c1=_0x26316c[_0xfdd4('0x7e')][_0x1e7bbb];var _0x2ae92=_0x42204a[_0xfdd4('0x91')]();_0x2ae92['where'](_0xfdd4('0x92'),_0xfd0c1['id']);_0xc9955e[_0xfdd4('0x66')](db['sequelize'][_0xfdd4('0x36')](_0x2ae92[_0xfdd4('0x93')](),{'type':db[_0xfdd4('0x6c')][_0xfdd4('0x94')][_0xfdd4('0x95')]})[_0xfdd4('0x27')](function(_0x191ab6){if(_0x191ab6[_0xfdd4('0x3c')]===0x1){return _0xfd0c1['id'];}else{var _0x1d460f=_[_0xfdd4('0x96')](_[_0xfdd4('0x30')](_0x191ab6,_0xfdd4('0x97')),function(_0x25c508){return _[_0xfdd4('0x98')](_0x5a3249,_0x25c508);});if(_0x1d460f){return _0xfd0c1['id'];}}}));}}return BPromise['all'](_0xc9955e)[_0xfdd4('0x27')](function(_0x349fc6){_0x5b22b1=_(_0x5b22b1)[_0xfdd4('0x99')](_0x349fc6)[_0xfdd4('0x9a')]()['value']();return db[_0xfdd4('0x31')][_0xfdd4('0x50')]({'where':{'id':_0x2a6a0d['params']['id']}})[_0xfdd4('0x27')](function(_0x401681){return db[_0xfdd4('0x6c')][_0xfdd4('0x4d')](function(_0x5a7c85){return _0x401681[_0xfdd4('0x9b')](_0x2a6a0d['query'][_0xfdd4('0x70')],{'transaction':_0x5a7c85})[_0xfdd4('0x27')](function(){if(!_['isEmpty'](_0x5b22b1)){return _0x401681[_0xfdd4('0x73')](_0x5b22b1,{'transaction':_0x5a7c85});}})['then'](function(){_0x5b22b1['forEach'](function(_0x10a396){socket[_0xfdd4('0x71')](_0xfdd4('0x9c'),{'UserId':_0x10a396,'VoicePrefixId':_0x401681['id']});});});});});});})[_0xfdd4('0x27')](respondWithStatusCode(_0x3d82d1,null))['catch'](handleError(_0x3d82d1,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index cee93b6..a0629c8 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 _0x1f24=['setMaxListeners','save','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x1c7037,_0x262e8f){var _0x38f047=function(_0x20071d){while(--_0x20071d){_0x1c7037['push'](_0x1c7037['shift']());}};_0x38f047(++_0x262e8f);}(_0x1f24,0x12f));var _0x41f2=function(_0x311d01,_0x38df90){_0x311d01=_0x311d01-0x0;var _0x25aa0e=_0x1f24[_0x311d01];return _0x25aa0e;};'use strict';var EventEmitter=require(_0x41f2('0x0'));var VoicePrefix=require('../../mysqldb')['db']['VoicePrefix'];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0x41f2('0x1')](0x0);var events={'afterCreate':_0x41f2('0x2'),'afterUpdate':'update','afterDestroy':_0x41f2('0x3')};function emitEvent(_0x5f54b2){return function(_0x2589f0,_0x4bde4a,_0x332055){VoicePrefixEvents[_0x41f2('0x4')](_0x5f54b2+':'+_0x2589f0['id'],_0x2589f0);VoicePrefixEvents[_0x41f2('0x4')](_0x5f54b2,_0x2589f0);_0x332055(null);};}for(var e in events){if(events[_0x41f2('0x5')](e)){var event=events[e];VoicePrefix[_0x41f2('0x6')](e,emitEvent(event));}}module[_0x41f2('0x7')]=VoicePrefixEvents; \ No newline at end of file +var _0xfee3=['exports','events','../../mysqldb','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x2547d9,_0x549d18){var _0x467c83=function(_0x1ac313){while(--_0x1ac313){_0x2547d9['push'](_0x2547d9['shift']());}};_0x467c83(++_0x549d18);}(_0xfee3,0x157));var _0x3fee=function(_0x382c73,_0x199cab){_0x382c73=_0x382c73-0x0;var _0x1dd0bf=_0xfee3[_0x382c73];return _0x1dd0bf;};'use strict';var EventEmitter=require(_0x3fee('0x0'));var VoicePrefix=require(_0x3fee('0x1'))['db']['VoicePrefix'];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0x3fee('0x2')](0x0);var events={'afterCreate':_0x3fee('0x3'),'afterUpdate':_0x3fee('0x4'),'afterDestroy':_0x3fee('0x5')};function emitEvent(_0x357959){return function(_0x516c9c,_0x373270,_0x575043){VoicePrefixEvents[_0x3fee('0x6')](_0x357959+':'+_0x516c9c['id'],_0x516c9c);VoicePrefixEvents[_0x3fee('0x6')](_0x357959,_0x516c9c);_0x575043(null);};}for(var e in events){if(events[_0x3fee('0x7')](e)){var event=events[e];VoicePrefix['hook'](e,emitEvent(event));}}module[_0x3fee('0x8')]=VoicePrefixEvents; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.model.js b/server/api/voicePrefix/voicePrefix.model.js index 1215d3d..6e0ff6f 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 _0xfead=['./voicePrefix.attributes','define','VoicePrefix','voice_prefixes','lodash','api','bluebird','request-promise','../../config/environment'];(function(_0x2c7a6f,_0xdae14e){var _0x2df660=function(_0x1a3ca3){while(--_0x1a3ca3){_0x2c7a6f['push'](_0x2c7a6f['shift']());}};_0x2df660(++_0xdae14e);}(_0xfead,0x12d));var _0xdfea=function(_0x590794,_0x4e29b5){_0x590794=_0x590794-0x0;var _0x657a79=_0xfead[_0x590794];return _0x657a79;};'use strict';var _=require(_0xdfea('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xdfea('0x1'));var moment=require('moment');var BPromise=require(_0xdfea('0x2'));var rp=require(_0xdfea('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xdfea('0x4'));var attributes=require(_0xdfea('0x5'));module['exports']=function(_0x3080b8,_0x5dc4a1){return _0x3080b8[_0xdfea('0x6')](_0xdfea('0x7'),attributes,{'tableName':_0xdfea('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x03bc=['lodash','util','../../config/logger','moment','bluebird','request-promise','../../config/environment','./voicePrefix.attributes','exports','define','voice_prefixes'];(function(_0x394036,_0x16a1cc){var _0x338f5c=function(_0x44d6d1){while(--_0x44d6d1){_0x394036['push'](_0x394036['shift']());}};_0x338f5c(++_0x16a1cc);}(_0x03bc,0x108));var _0xc03b=function(_0x3aea7c,_0x507688){_0x3aea7c=_0x3aea7c-0x0;var _0x8b31cc=_0x03bc[_0x3aea7c];return _0x8b31cc;};'use strict';var _=require(_0xc03b('0x0'));var util=require(_0xc03b('0x1'));var logger=require(_0xc03b('0x2'))('api');var moment=require(_0xc03b('0x3'));var BPromise=require(_0xc03b('0x4'));var rp=require(_0xc03b('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xc03b('0x6'));var attributes=require(_0xc03b('0x7'));module[_0xc03b('0x8')]=function(_0x126a3b,_0xb7f467){return _0x126a3b[_0xc03b('0x9')]('VoicePrefix',attributes,{'tableName':_0xc03b('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.rpc.js b/server/api/voicePrefix/voicePrefix.rpc.js index 3a1d682..bc6c516 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 _0x7b84=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./voicePrefix.socket','register','request','then','VoicePrefix,\x20%s,\x20%s','request\x20sent','VoicePrefix,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','ioredis','../../mysqldb'];(function(_0x525d35,_0xe67489){var _0x4813d2=function(_0x4a6dc8){while(--_0x4a6dc8){_0x525d35['push'](_0x525d35['shift']());}};_0x4813d2(++_0xe67489);}(_0x7b84,0x167));var _0x47b8=function(_0x4d94ec,_0x1904ef){_0x4d94ec=_0x4d94ec-0x0;var _0x4078bc=_0x7b84[_0x4d94ec];return _0x4078bc;};'use strict';var _=require(_0x47b8('0x0'));var util=require(_0x47b8('0x1'));var moment=require(_0x47b8('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x47b8('0x3'));var db=require(_0x47b8('0x4'))['db'];var utils=require(_0x47b8('0x5'));var logger=require(_0x47b8('0x6'))(_0x47b8('0x7'));var config=require(_0x47b8('0x8'));var jayson=require(_0x47b8('0x9'));var client=jayson[_0x47b8('0xa')][_0x47b8('0xb')]({'port':0x232a});config[_0x47b8('0xc')]=_[_0x47b8('0xd')](config[_0x47b8('0xc')],{'host':_0x47b8('0xe'),'port':0x18eb});var socket=require(_0x47b8('0xf'))(new Redis(config[_0x47b8('0xc')]));require(_0x47b8('0x10'))[_0x47b8('0x11')](socket);function respondWithRpcPromise(_0x3ddbfd,_0xb3f2b8,_0x520569){return new BPromise(function(_0x5450f6,_0x245bf5){return client[_0x47b8('0x12')](_0x3ddbfd,_0x520569)[_0x47b8('0x13')](function(_0x320fdf){logger['info'](_0x47b8('0x14'),_0xb3f2b8,_0x47b8('0x15'));logger['debug'](_0x47b8('0x16'),_0xb3f2b8,_0x47b8('0x15'),JSON[_0x47b8('0x17')](_0x320fdf));if(_0x320fdf[_0x47b8('0x18')]){if(_0x320fdf[_0x47b8('0x18')]['code']===0x1f4){logger['error'](_0x47b8('0x14'),_0xb3f2b8,_0x320fdf['error'][_0x47b8('0x19')]);return _0x245bf5(_0x320fdf[_0x47b8('0x18')][_0x47b8('0x19')]);}logger[_0x47b8('0x18')](_0x47b8('0x14'),_0xb3f2b8,_0x320fdf[_0x47b8('0x18')][_0x47b8('0x19')]);return _0x5450f6(_0x320fdf[_0x47b8('0x18')][_0x47b8('0x19')]);}else{logger['info'](_0x47b8('0x14'),_0xb3f2b8,_0x47b8('0x15'));_0x5450f6(_0x320fdf[_0x47b8('0x1a')][_0x47b8('0x19')]);}})[_0x47b8('0x1b')](function(_0x593f36){logger[_0x47b8('0x18')]('VoicePrefix,\x20%s,\x20%s',_0xb3f2b8,_0x593f36);_0x245bf5(_0x593f36);});});} \ No newline at end of file +var _0x4d49=['then','info','VoicePrefix,\x20%s,\x20%s','request\x20sent','debug','error','message','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./voicePrefix.socket','register'];(function(_0x5bd303,_0x387d15){var _0xe3b303=function(_0x3cd6f8){while(--_0x3cd6f8){_0x5bd303['push'](_0x5bd303['shift']());}};_0xe3b303(++_0x387d15);}(_0x4d49,0x141));var _0x94d4=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x4d49[_0x501510];return _0x1e6ee5;};'use strict';var _=require('lodash');var util=require(_0x94d4('0x0'));var moment=require('moment');var BPromise=require(_0x94d4('0x1'));var rs=require(_0x94d4('0x2'));var fs=require('fs');var Redis=require(_0x94d4('0x3'));var db=require(_0x94d4('0x4'))['db'];var utils=require(_0x94d4('0x5'));var logger=require(_0x94d4('0x6'))(_0x94d4('0x7'));var config=require(_0x94d4('0x8'));var jayson=require(_0x94d4('0x9'));var client=jayson['client'][_0x94d4('0xa')]({'port':0x232a});config[_0x94d4('0xb')]=_[_0x94d4('0xc')](config[_0x94d4('0xb')],{'host':_0x94d4('0xd'),'port':0x18eb});var socket=require(_0x94d4('0xe'))(new Redis(config['redis']));require(_0x94d4('0xf'))[_0x94d4('0x10')](socket);function respondWithRpcPromise(_0x562265,_0x23ef86,_0x283f63){return new BPromise(function(_0xd7820d,_0x2720dd){return client['request'](_0x562265,_0x283f63)[_0x94d4('0x11')](function(_0xe7f878){logger[_0x94d4('0x12')](_0x94d4('0x13'),_0x23ef86,_0x94d4('0x14'));logger[_0x94d4('0x15')]('VoicePrefix,\x20%s,\x20%s,\x20%s',_0x23ef86,'request\x20sent',JSON['stringify'](_0xe7f878));if(_0xe7f878[_0x94d4('0x16')]){if(_0xe7f878[_0x94d4('0x16')]['code']===0x1f4){logger[_0x94d4('0x16')](_0x94d4('0x13'),_0x23ef86,_0xe7f878['error'][_0x94d4('0x17')]);return _0x2720dd(_0xe7f878['error'][_0x94d4('0x17')]);}logger['error']('VoicePrefix,\x20%s,\x20%s',_0x23ef86,_0xe7f878['error'][_0x94d4('0x17')]);return _0xd7820d(_0xe7f878[_0x94d4('0x16')][_0x94d4('0x17')]);}else{logger['info']('VoicePrefix,\x20%s,\x20%s',_0x23ef86,'request\x20sent');_0xd7820d(_0xe7f878[_0x94d4('0x18')][_0x94d4('0x17')]);}})[_0x94d4('0x19')](function(_0x47b760){logger[_0x94d4('0x16')](_0x94d4('0x13'),_0x23ef86,_0x47b760);_0x2720dd(_0x47b760);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index e2c86dd..4e6adc4 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 _0x85b5=['voicePrefix:','./voicePrefix.events','save','update','removeListener','register'];(function(_0x4b6830,_0x2bf6fb){var _0x239e4a=function(_0x364735){while(--_0x364735){_0x4b6830['push'](_0x4b6830['shift']());}};_0x239e4a(++_0x2bf6fb);}(_0x85b5,0x7f));var _0x585b=function(_0x4eb805,_0x3e5d37){_0x4eb805=_0x4eb805-0x0;var _0x57658b=_0x85b5[_0x4eb805];return _0x57658b;};'use strict';var VoicePrefixEvents=require(_0x585b('0x0'));var events=[_0x585b('0x1'),'remove',_0x585b('0x2')];function createListener(_0x4a79cf,_0x18ab39){return function(_0x5a7ff0){_0x18ab39['emit'](_0x4a79cf,_0x5a7ff0);};}function removeListener(_0x331fe8,_0x4f37a9){return function(){VoicePrefixEvents[_0x585b('0x3')](_0x331fe8,_0x4f37a9);};}exports[_0x585b('0x4')]=function(_0x9ccfca){for(var _0x5b9e48=0x0,_0x1605b5=events['length'];_0x5b9e48<_0x1605b5;_0x5b9e48++){var _0x432e2d=events[_0x5b9e48];var _0x2f8895=createListener(_0x585b('0x5')+_0x432e2d,_0x9ccfca);VoicePrefixEvents['on'](_0x432e2d,_0x2f8895);}}; \ No newline at end of file +var _0xb49a=['save','remove','update','emit','removeListener','register','length','voicePrefix:','./voicePrefix.events'];(function(_0x5fb7a4,_0x127dc7){var _0x1c468c=function(_0x1a61ee){while(--_0x1a61ee){_0x5fb7a4['push'](_0x5fb7a4['shift']());}};_0x1c468c(++_0x127dc7);}(_0xb49a,0xfb));var _0xab49=function(_0x406d39,_0xd3c8f1){_0x406d39=_0x406d39-0x0;var _0x2eb792=_0xb49a[_0x406d39];return _0x2eb792;};'use strict';var VoicePrefixEvents=require(_0xab49('0x0'));var events=[_0xab49('0x1'),_0xab49('0x2'),_0xab49('0x3')];function createListener(_0x8db649,_0x55d01b){return function(_0x4387a5){_0x55d01b[_0xab49('0x4')](_0x8db649,_0x4387a5);};}function removeListener(_0x5554fe,_0x543eb0){return function(){VoicePrefixEvents[_0xab49('0x5')](_0x5554fe,_0x543eb0);};}exports[_0xab49('0x6')]=function(_0x1cae1d){for(var _0x3703cb=0x0,_0x57ea72=events[_0xab49('0x7')];_0x3703cb<_0x57ea72;_0x3703cb++){var _0xd86a5=events[_0x3703cb];var _0x4d4d00=createListener(_0xab49('0x8')+_0xd86a5,_0x1cae1d);VoicePrefixEvents['on'](_0xd86a5,_0x4d4d00);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index 8702279..c622f79 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 _0xd2ca=['/:id/lists','getLists','/:id/blacklists','getBlackLists','post','create','/:id/clone','/:id/teams','addTeams','addAgents','addLists','put','delete','destroy','removeTeams','removeBlackLists','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueue.controller','get','isAuthenticated','index','/:id','show','/:id/hoppers','getHoppers','getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/hopper_black','/:id/users','getAgents','/:id/members','getMembers'];(function(_0x32f7d7,_0x54231b){var _0x133d09=function(_0x41a7ab){while(--_0x41a7ab){_0x32f7d7['push'](_0x32f7d7['shift']());}};_0x133d09(++_0x54231b);}(_0xd2ca,0x1b4));var _0xad2c=function(_0x3dc670,_0x341d60){_0x3dc670=_0x3dc670-0x0;var _0x245003=_0xd2ca[_0x3dc670];return _0x245003;};'use strict';var multer=require(_0xad2c('0x0'));var util=require(_0xad2c('0x1'));var path=require(_0xad2c('0x2'));var timeout=require(_0xad2c('0x3'));var express=require(_0xad2c('0x4'));var router=express[_0xad2c('0x5')]();var fs_extra=require(_0xad2c('0x6'));var auth=require(_0xad2c('0x7'));var interaction=require(_0xad2c('0x8'));var config=require(_0xad2c('0x9'));var controller=require(_0xad2c('0xa'));router[_0xad2c('0xb')]('/',auth[_0xad2c('0xc')](),controller[_0xad2c('0xd')]);router[_0xad2c('0xb')](_0xad2c('0xe'),auth['isAuthenticated'](),controller[_0xad2c('0xf')]);router[_0xad2c('0xb')](_0xad2c('0x10'),auth['isAuthenticated'](),controller[_0xad2c('0x11')]);router[_0xad2c('0xb')]('/:id/hopper_histories',auth[_0xad2c('0xc')](),controller[_0xad2c('0x12')]);router[_0xad2c('0xb')](_0xad2c('0x13'),auth['isAuthenticated'](),controller[_0xad2c('0x14')]);router[_0xad2c('0xb')](_0xad2c('0x15'),auth['isAuthenticated'](),controller['getHopperBlacks']);router[_0xad2c('0xb')]('/:id/teams',auth[_0xad2c('0xc')](),controller['getTeams']);router[_0xad2c('0xb')](_0xad2c('0x16'),auth['isAuthenticated'](),controller[_0xad2c('0x17')]);router[_0xad2c('0xb')](_0xad2c('0x18'),auth[_0xad2c('0xc')](),controller[_0xad2c('0x19')]);router[_0xad2c('0xb')](_0xad2c('0x1a'),auth[_0xad2c('0xc')](),controller[_0xad2c('0x1b')]);router[_0xad2c('0xb')](_0xad2c('0x1c'),auth[_0xad2c('0xc')](),controller[_0xad2c('0x1d')]);router[_0xad2c('0x1e')]('/',auth[_0xad2c('0xc')](),controller[_0xad2c('0x1f')]);router['post'](_0xad2c('0x20'),auth[_0xad2c('0xc')](),controller['clone']);router['post'](_0xad2c('0x21'),auth['isAuthenticated'](),controller[_0xad2c('0x22')]);router['post'](_0xad2c('0x16'),auth[_0xad2c('0xc')](),controller[_0xad2c('0x23')]);router[_0xad2c('0x1e')](_0xad2c('0x1a'),auth[_0xad2c('0xc')](),controller[_0xad2c('0x24')]);router[_0xad2c('0x1e')]('/:id/blacklists',auth['isAuthenticated'](),controller['addBlackLists']);router[_0xad2c('0x25')](_0xad2c('0xe'),auth['isAuthenticated'](),controller['update']);router[_0xad2c('0x26')](_0xad2c('0xe'),auth[_0xad2c('0xc')](),controller[_0xad2c('0x27')]);router['delete'](_0xad2c('0x21'),auth[_0xad2c('0xc')](),controller[_0xad2c('0x28')]);router[_0xad2c('0x26')](_0xad2c('0x16'),auth['isAuthenticated'](),controller['removeAgents']);router['delete'](_0xad2c('0x1a'),auth['isAuthenticated'](),controller['removeLists']);router[_0xad2c('0x26')](_0xad2c('0x1c'),auth[_0xad2c('0xc')](),controller[_0xad2c('0x29')]);module['exports']=router; \ No newline at end of file +var _0xce32=['getHoppers','/:id/hopper_histories','getHopperFinals','/:id/hopper_black','getHopperBlacks','/:id/teams','getTeams','/:id/users','getAgents','/:id/members','getMembers','/:id/lists','getLists','post','create','/:id/clone','clone','addAgents','addLists','/:id/blacklists','addBlackLists','put','update','destroy','removeTeams','delete','removeAgents','removeLists','removeBlackLists','exports','multer','path','connect-timeout','../../components/auth/service','get','isAuthenticated','index','/:id','show','/:id/hoppers'];(function(_0x3a8ce2,_0x552ad5){var _0x2e5a45=function(_0x5de5ed){while(--_0x5de5ed){_0x3a8ce2['push'](_0x3a8ce2['shift']());}};_0x2e5a45(++_0x552ad5);}(_0xce32,0x96));var _0x2ce3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xce32[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x2ce3('0x0'));var util=require('util');var path=require(_0x2ce3('0x1'));var timeout=require(_0x2ce3('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x2ce3('0x3'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./voiceQueue.controller');router[_0x2ce3('0x4')]('/',auth[_0x2ce3('0x5')](),controller[_0x2ce3('0x6')]);router['get'](_0x2ce3('0x7'),auth[_0x2ce3('0x5')](),controller[_0x2ce3('0x8')]);router['get'](_0x2ce3('0x9'),auth[_0x2ce3('0x5')](),controller[_0x2ce3('0xa')]);router['get'](_0x2ce3('0xb'),auth[_0x2ce3('0x5')](),controller['getHopperHistories']);router['get']('/:id/hopper_finals',auth[_0x2ce3('0x5')](),controller[_0x2ce3('0xc')]);router[_0x2ce3('0x4')](_0x2ce3('0xd'),auth[_0x2ce3('0x5')](),controller[_0x2ce3('0xe')]);router[_0x2ce3('0x4')](_0x2ce3('0xf'),auth[_0x2ce3('0x5')](),controller[_0x2ce3('0x10')]);router[_0x2ce3('0x4')](_0x2ce3('0x11'),auth['isAuthenticated'](),controller[_0x2ce3('0x12')]);router['get'](_0x2ce3('0x13'),auth[_0x2ce3('0x5')](),controller[_0x2ce3('0x14')]);router[_0x2ce3('0x4')](_0x2ce3('0x15'),auth[_0x2ce3('0x5')](),controller[_0x2ce3('0x16')]);router[_0x2ce3('0x4')]('/:id/blacklists',auth['isAuthenticated'](),controller['getBlackLists']);router[_0x2ce3('0x17')]('/',auth[_0x2ce3('0x5')](),controller[_0x2ce3('0x18')]);router[_0x2ce3('0x17')](_0x2ce3('0x19'),auth[_0x2ce3('0x5')](),controller[_0x2ce3('0x1a')]);router[_0x2ce3('0x17')]('/:id/teams',auth[_0x2ce3('0x5')](),controller['addTeams']);router[_0x2ce3('0x17')](_0x2ce3('0x11'),auth[_0x2ce3('0x5')](),controller[_0x2ce3('0x1b')]);router[_0x2ce3('0x17')](_0x2ce3('0x15'),auth[_0x2ce3('0x5')](),controller[_0x2ce3('0x1c')]);router[_0x2ce3('0x17')](_0x2ce3('0x1d'),auth[_0x2ce3('0x5')](),controller[_0x2ce3('0x1e')]);router[_0x2ce3('0x1f')]('/:id',auth[_0x2ce3('0x5')](),controller[_0x2ce3('0x20')]);router['delete'](_0x2ce3('0x7'),auth[_0x2ce3('0x5')](),controller[_0x2ce3('0x21')]);router['delete'](_0x2ce3('0xf'),auth[_0x2ce3('0x5')](),controller[_0x2ce3('0x22')]);router[_0x2ce3('0x23')](_0x2ce3('0x11'),auth[_0x2ce3('0x5')](),controller[_0x2ce3('0x24')]);router[_0x2ce3('0x23')](_0x2ce3('0x15'),auth[_0x2ce3('0x5')](),controller[_0x2ce3('0x25')]);router[_0x2ce3('0x23')]('/:id/blacklists',auth[_0x2ce3('0x5')](),controller[_0x2ce3('0x26')]);module[_0x2ce3('0x27')]=router; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.attributes.js b/server/api/voiceQueue/voiceQueue.attributes.js index 50c6430..a9fc6cc 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 _0xcdc2=['#RecallMe\x20Timeout\x20(min:1)','Active/Disactive\x20Recall\x20In\x20Queue','DESC','ASC','Cut\x20Digit\x20(min:1,\x20max:15)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\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)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','sequelize','STRING','ENUM','outbound','inbound','ringall','fewestcalls','random','linear','wrandom','rrordered','setDataValue','strategy','rrmemory','getDataValue','type','dialMethod','booked','roundrobin','progressive','predictive','INTEGER','yes','all','once','periodic_announce','joinempty','split','leavewhenempty','join','BOOLEAN','wrapuptime','preview','power','Dial\x20Method.','UNSIGNED','Max\x209999\x20channels,\x200\x20means\x20unlimited.','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','FLOAT','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','agentBusyFactor','dropRate','Only\x20for\x20predictive\x20method.','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','tTxX','Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','never','onlyIfOpen','always','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Maximum\x20Word\x20Length'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0xcdc2,0xae));var _0x2cdc=function(_0x527016,_0x5a00e9){_0x527016=_0x527016-0x0;var _0x45fb66=_0xcdc2[_0x527016];return _0x45fb66;};'use strict';var Sequelize=require(_0x2cdc('0x0'));module['exports']={'name':{'type':Sequelize[_0x2cdc('0x1')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x2cdc('0x2')]('inbound',_0x2cdc('0x3')),'allowNull':![],'defaultValue':_0x2cdc('0x4')},'musiconhold':{'type':Sequelize[_0x2cdc('0x1')],'defaultValue':'default'},'announce':{'type':Sequelize[_0x2cdc('0x1')],'defaultValue':''},'strategy':{'type':Sequelize[_0x2cdc('0x2')]('rr',_0x2cdc('0x5'),'leastrecent',_0x2cdc('0x6'),_0x2cdc('0x7'),'rrmemory',_0x2cdc('0x8'),_0x2cdc('0x9'),_0x2cdc('0xa')),'allowNull':![],'defaultValue':'ringall','set':function(_0x46de33){this[_0x2cdc('0xb')](_0x2cdc('0xc'),_0x46de33?_0x46de33:_0x2cdc('0xd'));},'get':function(){var _0x42dbd7=this[_0x2cdc('0xe')](_0x2cdc('0xf'));var _0x1ff8d9=this[_0x2cdc('0xe')](_0x2cdc('0x10'));var _0x396ee0=this[_0x2cdc('0xe')]('strategy');if(_0x42dbd7===_0x2cdc('0x4')){return _0x396ee0;}if(_0x1ff8d9===_0x2cdc('0x11')&&_0x396ee0===_0x2cdc('0xd')||_0x1ff8d9===_0x2cdc('0x11')&&_0x396ee0===_0x2cdc('0x12')){return _0x396ee0;}if(_0x1ff8d9===_0x2cdc('0x13')||_0x1ff8d9===_0x2cdc('0x14')||_0x1ff8d9==='power'){return _0x396ee0;}return null;}},'servicelevel':{'type':Sequelize[_0x2cdc('0x15')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0x2cdc('0x1')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize['INTEGER'](0xb)},'timeout':{'type':Sequelize[_0x2cdc('0x15')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0x2cdc('0x15')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0x2cdc('0x1')]},'weight':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0x2cdc('0x15')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0x2cdc('0x2')](_0x2cdc('0x16'),'no'),'defaultValue':_0x2cdc('0x16')},'autopause':{'type':Sequelize[_0x2cdc('0x2')](_0x2cdc('0x16'),'no',_0x2cdc('0x17')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize['INTEGER'](0xb)},'autopausebusy':{'type':Sequelize[_0x2cdc('0x2')]('yes','no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0x2cdc('0x2')](_0x2cdc('0x16'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0x2cdc('0x2')](_0x2cdc('0x16'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0x2cdc('0x2')](_0x2cdc('0x16'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0x2cdc('0x2')](_0x2cdc('0x16'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0x2cdc('0x1')],'allowNull':!![]},'membergosub':{'type':Sequelize[_0x2cdc('0x1')],'allowNull':!![]},'announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0x2cdc('0x15')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0x2cdc('0x15')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0x2cdc('0x2')]('yes','no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'yes'},'announce_holdtime':{'type':Sequelize[_0x2cdc('0x2')]('yes','no',_0x2cdc('0x18')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0x2cdc('0x1')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0x2cdc('0x2')](_0x2cdc('0x16'),'no')},'announce_position_limit':{'type':Sequelize['INTEGER'](0xb)},'announce_round_seconds':{'type':Sequelize[_0x2cdc('0x2')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0x2cdc('0x1')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0x2cdc('0x1')]},'queue_youarenext':{'type':Sequelize['STRING'],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0x2cdc('0x1')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize['STRING'],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0x2cdc('0x1')],'defaultValue':null},'queue_minute':{'type':Sequelize[_0x2cdc('0x1')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0x2cdc('0x1')],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0x2cdc('0x1')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0x2cdc('0x1')],'defaultValue':null},'queue_reporthold':{'type':Sequelize['STRING']},'queue_quantity1':{'type':Sequelize[_0x2cdc('0x1')]},'queue_quantity2':{'type':Sequelize['STRING']},'queue_periodic_announce':{'type':Sequelize[_0x2cdc('0x1')]},'queue_less_than':{'type':Sequelize[_0x2cdc('0x1')]},'periodic_announce':{'type':Sequelize['TEXT'],'set':function(_0x3c99c3){this[_0x2cdc('0xb')](_0x2cdc('0x19'),_0x3c99c3?_0x3c99c3['join'](','):[]);},'get':function(){return this['getDataValue'](_0x2cdc('0x19'))?this[_0x2cdc('0xe')](_0x2cdc('0x19'))['split'](','):[];}},'joinempty':{'type':Sequelize['STRING'],'defaultValue':_0x2cdc('0x16'),'set':function(_0x6f4066){this[_0x2cdc('0xb')](_0x2cdc('0x1a'),_0x6f4066?_0x6f4066['join'](','):undefined);},'get':function(){return this[_0x2cdc('0xe')](_0x2cdc('0x1a'))?this['getDataValue'](_0x2cdc('0x1a'))[_0x2cdc('0x1b')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0x2cdc('0x1')],'defaultValue':'no','set':function(_0x1bb9a3){this[_0x2cdc('0xb')](_0x2cdc('0x1c'),_0x1bb9a3?_0x1bb9a3[_0x2cdc('0x1d')](','):undefined);},'get':function(){return this[_0x2cdc('0xe')](_0x2cdc('0x1c'))?this[_0x2cdc('0xe')](_0x2cdc('0x1c'))[_0x2cdc('0x1b')](','):undefined;}},'reportholdtime':{'type':Sequelize['ENUM'](_0x2cdc('0x16'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize['ENUM'](_0x2cdc('0x16'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0x2cdc('0x15')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0x2cdc('0x2')](_0x2cdc('0x16'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'acw':{'type':Sequelize[_0x2cdc('0x1e')],'defaultValue':0x0,'set':function(_0x425257){this['setDataValue']('acw',_0x425257);if(_0x425257){if(this[_0x2cdc('0xe')](_0x2cdc('0x1f'))<0x2){this[_0x2cdc('0xb')](_0x2cdc('0x1f'),0x2);}}}},'acwTimeout':{'type':Sequelize[_0x2cdc('0x15')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':'Active/Disactive\x20Campaign'},'dialMethod':{'type':Sequelize[_0x2cdc('0x2')](_0x2cdc('0x20'),_0x2cdc('0x13'),_0x2cdc('0x21'),_0x2cdc('0x14'),'booked'),'defaultValue':'progressive','comment':_0x2cdc('0x22')},'dialLimitChannel':{'type':Sequelize[_0x2cdc('0x15')](0x4)[_0x2cdc('0x23')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x2cdc('0x24')},'dialLimitQueue':{'type':Sequelize[_0x2cdc('0x15')](0x4)[_0x2cdc('0x23')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x2cdc('0x25')},'dialPowerLevel':{'type':Sequelize[_0x2cdc('0x26')](0x2)[_0x2cdc('0x23')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0x2cdc('0x27')},'dialPredictiveOptimization':{'type':Sequelize[_0x2cdc('0x2')](_0x2cdc('0x28'),_0x2cdc('0x29')),'defaultValue':_0x2cdc('0x29'),'comment':_0x2cdc('0x2a')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0x2cdc('0x26')](0x2)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0x2cdc('0x2b')},'dialPredictiveInterval':{'type':Sequelize[_0x2cdc('0x15')](0x3)[_0x2cdc('0x23')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':'Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)'},'dialOriginateCallerIdName':{'type':Sequelize[_0x2cdc('0x1')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x2cdc('0x1')]},'dialOriginateTimeout':{'type':Sequelize[_0x2cdc('0x15')](0x3)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x2cdc('0x2c')},'dialQueueOptions':{'type':Sequelize['STRING'],'defaultValue':_0x2cdc('0x2d'),'comment':'https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue'},'dialQueueTimeout':{'type':Sequelize[_0x2cdc('0x15')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x2cdc('0x2e')},'dialQueueProject':{'type':Sequelize[_0x2cdc('0x1')],'comment':_0x2cdc('0x2f')},'dialCongestionMaxRetry':{'type':Sequelize[_0x2cdc('0x15')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x2cdc('0x30')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x2cdc('0x15')](0x5)[_0x2cdc('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x2cdc('0x31')},'dialBusyMaxRetry':{'type':Sequelize[_0x2cdc('0x15')](0x3)[_0x2cdc('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x2cdc('0x32')},'dialBusyRetryFrequency':{'type':Sequelize[_0x2cdc('0x15')](0x5)[_0x2cdc('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x2cdc('0x15')](0x3)[_0x2cdc('0x23')],'defaultValue':0x3,'comment':'#NoAnswer\x20Retry\x20(min:1,\x20max:999)'},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x2cdc('0x15')](0x5)[_0x2cdc('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialGlobalMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x2cdc('0x23')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x2cdc('0x33')},'dialTimezone':{'type':Sequelize[_0x2cdc('0x1')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x2cdc('0x1')],'defaultValue':_0x2cdc('0x34')},'dialPrefix':{'type':Sequelize[_0x2cdc('0x1')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0x2cdc('0x2')]('always',_0x2cdc('0x35'),_0x2cdc('0x36')),'defaultValue':_0x2cdc('0x37')},'dialAMDActive':{'type':Sequelize[_0x2cdc('0x1e')],'defaultValue':0x0,'comment':_0x2cdc('0x38')},'dialAMDInitialSilence':{'type':Sequelize[_0x2cdc('0x15')](0x9)[_0x2cdc('0x23')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x2cdc('0x39')},'dialAMDGreeting':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x2cdc('0x3a')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x2cdc('0x15')](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':'#AMD\x20After\x20Greeting\x20Silence'},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x2cdc('0x15')](0x9)[_0x2cdc('0x23')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x2cdc('0x3b')},'dialAMDMinWordLength':{'type':Sequelize['INTEGER'](0x9)[_0x2cdc('0x23')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x2cdc('0x3c')},'dialAMDBetweenWordsSilence':{'type':Sequelize['INTEGER'](0x9)[_0x2cdc('0x23')],'defaultValue':0x32,'validate':{'min':0x0},'comment':'#AMD\x20Between\x20Words\x20Silence'},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x2cdc('0x15')](0x9)[_0x2cdc('0x23')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x2cdc('0x3d')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x2cdc('0x15')](0x5)[_0x2cdc('0x23')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':'#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)'},'dialAMDMaximumWordLength':{'type':Sequelize['INTEGER'](0x9)[_0x2cdc('0x23')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x2cdc('0x3e')},'dialRecallMeTimeout':{'type':Sequelize['INTEGER'](0x5)[_0x2cdc('0x23')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0x2cdc('0x3f')},'dialRecallInQueue':{'type':Sequelize[_0x2cdc('0x1e')],'defaultValue':0x0,'comment':_0x2cdc('0x40')},'dialOrderByScheduledAt':{'type':Sequelize['ENUM'](_0x2cdc('0x41'),_0x2cdc('0x42')),'defaultValue':_0x2cdc('0x41')},'dialQueueProject2':{'type':Sequelize[_0x2cdc('0x1')],'comment':_0x2cdc('0x2f')},'dialAgiAfterHangupClient':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0x2cdc('0x1e')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x2cdc('0x15')](0x3)[_0x2cdc('0x23')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Random\x20Last\x20Digit\x20(min:1,\x20max:15)'},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)[_0x2cdc('0x23')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x2cdc('0x43')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x2cdc('0x15')](0x3)[_0x2cdc('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x2cdc('0x15')](0x5)[_0x2cdc('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x2cdc('0x44')},'dialDropMaxRetry':{'type':Sequelize[_0x2cdc('0x15')](0x3)[_0x2cdc('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Drop\x20Retry\x20(min:1,\x20max:999)'},'dialDropRetryFrequency':{'type':Sequelize[_0x2cdc('0x15')](0x5)[_0x2cdc('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x2cdc('0x45')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x2cdc('0x15')](0x3)[_0x2cdc('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x2cdc('0x46')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x2cdc('0x15')](0x5)[_0x2cdc('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x2cdc('0x47')},'dialMachineMaxRetry':{'type':Sequelize[_0x2cdc('0x15')](0x3)[_0x2cdc('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x2cdc('0x48')},'dialMachineRetryFrequency':{'type':Sequelize[_0x2cdc('0x15')](0x5)[_0x2cdc('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x2cdc('0x49')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x2cdc('0x15')](0x3)[_0x2cdc('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x2cdc('0x4a')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x2cdc('0x15')](0x5)[_0x2cdc('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x2cdc('0x4b')},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'comment':_0x2cdc('0x4c')},'mandatoryDisposition':{'type':Sequelize[_0x2cdc('0x1e')],'defaultValue':![],'comment':_0x2cdc('0x4d'),'set':function(_0x56eb18){if(!_0x56eb18)this[_0x2cdc('0xb')](_0x2cdc('0x4e'),null);this['setDataValue']('mandatoryDisposition',_0x56eb18);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize['INTEGER'](0x3)[_0x2cdc('0x23')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0x2cdc('0x15')](0x3)[_0x2cdc('0x23')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}}}; \ No newline at end of file +var _0xf6da=['#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','name','ENUM','inbound','outbound','default','ringall','leastrecent','fewestcalls','random','rrmemory','linear','wrandom','strategy','getDataValue','type','dialMethod','booked','roundrobin','predictive','power','INTEGER','yes','once','TEXT','setDataValue','periodic_announce','split','join','joinempty','leavewhenempty','BOOLEAN','acw','wrapuptime','progressive','Dial\x20Method.','UNSIGNED','Max\x209999\x20channels,\x200\x20means\x20unlimited.','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','FLOAT','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','agentBusyFactor','dropRate','Only\x20for\x20predictive\x20method.','Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)','tTxX','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue','Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Congestion\x20Retry\x20(min:1,\x20max:999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','never','onlyIfOpen','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','#RecallMe\x20Timeout\x20(min:1)','Active/Disactive\x20Recall\x20In\x20Queue','DESC','Cut\x20Digit\x20(min:1,\x20max:15)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'];(function(_0x350343,_0x256f69){var _0x9afc1c=function(_0x47ab32){while(--_0x47ab32){_0x350343['push'](_0x350343['shift']());}};_0x9afc1c(++_0x256f69);}(_0xf6da,0x19f));var _0xaf6d=function(_0x2847fa,_0x142aa1){_0x2847fa=_0x2847fa-0x0;var _0x2df459=_0xf6da[_0x2847fa];return _0x2df459;};'use strict';var Sequelize=require(_0xaf6d('0x0'));module[_0xaf6d('0x1')]={'name':{'type':Sequelize[_0xaf6d('0x2')],'allowNull':![],'unique':_0xaf6d('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xaf6d('0x4')](_0xaf6d('0x5'),_0xaf6d('0x6')),'allowNull':![],'defaultValue':_0xaf6d('0x5')},'musiconhold':{'type':Sequelize[_0xaf6d('0x2')],'defaultValue':_0xaf6d('0x7')},'announce':{'type':Sequelize['STRING'],'defaultValue':''},'strategy':{'type':Sequelize[_0xaf6d('0x4')]('rr',_0xaf6d('0x8'),_0xaf6d('0x9'),_0xaf6d('0xa'),_0xaf6d('0xb'),_0xaf6d('0xc'),_0xaf6d('0xd'),_0xaf6d('0xe'),'rrordered'),'allowNull':![],'defaultValue':_0xaf6d('0x8'),'set':function(_0x5b4926){this['setDataValue'](_0xaf6d('0xf'),_0x5b4926?_0x5b4926:_0xaf6d('0xc'));},'get':function(){var _0x40541c=this[_0xaf6d('0x10')](_0xaf6d('0x11'));var _0x35f73b=this['getDataValue'](_0xaf6d('0x12'));var _0x28e257=this[_0xaf6d('0x10')](_0xaf6d('0xf'));if(_0x40541c===_0xaf6d('0x5')){return _0x28e257;}if(_0x35f73b==='booked'&&_0x28e257===_0xaf6d('0xc')||_0x35f73b===_0xaf6d('0x13')&&_0x28e257===_0xaf6d('0x14')){return _0x28e257;}if(_0x35f73b==='progressive'||_0x35f73b===_0xaf6d('0x15')||_0x35f73b===_0xaf6d('0x16')){return _0x28e257;}return null;}},'servicelevel':{'type':Sequelize[_0xaf6d('0x17')](0xb),'defaultValue':0x0},'context':{'type':Sequelize['STRING'],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0xaf6d('0x17')](0xb)},'timeout':{'type':Sequelize[_0xaf6d('0x17')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0xaf6d('0x17')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0xaf6d('0x2')]},'weight':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0xaf6d('0x17')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0xaf6d('0x4')](_0xaf6d('0x18'),'no'),'defaultValue':_0xaf6d('0x18')},'autopause':{'type':Sequelize['ENUM'](_0xaf6d('0x18'),'no','all'),'defaultValue':'no'},'autopausedelay':{'type':Sequelize['INTEGER'](0xb)},'autopausebusy':{'type':Sequelize[_0xaf6d('0x4')](_0xaf6d('0x18'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize['ENUM'](_0xaf6d('0x18'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0xaf6d('0x4')](_0xaf6d('0x18'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0xaf6d('0x4')](_0xaf6d('0x18'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0xaf6d('0x4')](_0xaf6d('0x18'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize['STRING'],'allowNull':!![]},'membergosub':{'type':Sequelize[_0xaf6d('0x2')],'allowNull':!![]},'announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0xaf6d('0x17')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize['ENUM'](_0xaf6d('0x18'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0xaf6d('0x4')](_0xaf6d('0x18'),'no'),'defaultValue':_0xaf6d('0x18')},'announce_holdtime':{'type':Sequelize[_0xaf6d('0x4')](_0xaf6d('0x18'),'no',_0xaf6d('0x19')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0xaf6d('0x2')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0xaf6d('0x4')]('yes','no')},'announce_position_limit':{'type':Sequelize['INTEGER'](0xb)},'announce_round_seconds':{'type':Sequelize['ENUM']('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0xaf6d('0x2')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0xaf6d('0x2')]},'queue_youarenext':{'type':Sequelize[_0xaf6d('0x2')],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0xaf6d('0x2')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0xaf6d('0x2')],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0xaf6d('0x2')],'defaultValue':null},'queue_minute':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize['STRING'],'defaultValue':null},'queue_seconds':{'type':Sequelize['STRING'],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0xaf6d('0x2')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0xaf6d('0x2')]},'queue_quantity1':{'type':Sequelize[_0xaf6d('0x2')]},'queue_quantity2':{'type':Sequelize[_0xaf6d('0x2')]},'queue_periodic_announce':{'type':Sequelize[_0xaf6d('0x2')]},'queue_less_than':{'type':Sequelize[_0xaf6d('0x2')]},'periodic_announce':{'type':Sequelize[_0xaf6d('0x1a')],'set':function(_0x4af95b){this[_0xaf6d('0x1b')](_0xaf6d('0x1c'),_0x4af95b?_0x4af95b['join'](','):[]);},'get':function(){return this[_0xaf6d('0x10')](_0xaf6d('0x1c'))?this[_0xaf6d('0x10')](_0xaf6d('0x1c'))[_0xaf6d('0x1d')](','):[];}},'joinempty':{'type':Sequelize[_0xaf6d('0x2')],'defaultValue':_0xaf6d('0x18'),'set':function(_0x40368f){this[_0xaf6d('0x1b')]('joinempty',_0x40368f?_0x40368f[_0xaf6d('0x1e')](','):undefined);},'get':function(){return this[_0xaf6d('0x10')](_0xaf6d('0x1f'))?this[_0xaf6d('0x10')](_0xaf6d('0x1f'))[_0xaf6d('0x1d')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0xaf6d('0x2')],'defaultValue':'no','set':function(_0x275e9b){this['setDataValue'](_0xaf6d('0x20'),_0x275e9b?_0x275e9b[_0xaf6d('0x1e')](','):undefined);},'get':function(){return this[_0xaf6d('0x10')](_0xaf6d('0x20'))?this[_0xaf6d('0x10')](_0xaf6d('0x20'))[_0xaf6d('0x1d')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0xaf6d('0x4')]('yes','no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0xaf6d('0x4')](_0xaf6d('0x18'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0xaf6d('0x17')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0xaf6d('0x4')](_0xaf6d('0x18'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0xaf6d('0x2')]},'description':{'type':Sequelize[_0xaf6d('0x2')]},'acw':{'type':Sequelize[_0xaf6d('0x21')],'defaultValue':0x0,'set':function(_0x38a15f){this[_0xaf6d('0x1b')](_0xaf6d('0x22'),_0x38a15f);if(_0x38a15f){if(this[_0xaf6d('0x10')](_0xaf6d('0x23'))<0x2){this[_0xaf6d('0x1b')](_0xaf6d('0x23'),0x2);}}}},'acwTimeout':{'type':Sequelize[_0xaf6d('0x17')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':'Active/Disactive\x20Campaign'},'dialMethod':{'type':Sequelize[_0xaf6d('0x4')]('preview','progressive',_0xaf6d('0x16'),_0xaf6d('0x15'),_0xaf6d('0x13')),'defaultValue':_0xaf6d('0x24'),'comment':_0xaf6d('0x25')},'dialLimitChannel':{'type':Sequelize[_0xaf6d('0x17')](0x4)[_0xaf6d('0x26')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0xaf6d('0x27')},'dialLimitQueue':{'type':Sequelize['INTEGER'](0x4)[_0xaf6d('0x26')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0xaf6d('0x28')},'dialPowerLevel':{'type':Sequelize[_0xaf6d('0x29')](0x2)['UNSIGNED'],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0xaf6d('0x2a')},'dialPredictiveOptimization':{'type':Sequelize[_0xaf6d('0x4')](_0xaf6d('0x2b'),_0xaf6d('0x2c')),'defaultValue':_0xaf6d('0x2c'),'comment':_0xaf6d('0x2d')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0xaf6d('0x29')](0x2)[_0xaf6d('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':'Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)'},'dialPredictiveInterval':{'type':Sequelize['INTEGER'](0x3)[_0xaf6d('0x26')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0xaf6d('0x2e')},'dialOriginateCallerIdName':{'type':Sequelize['STRING']},'dialOriginateCallerIdNumber':{'type':Sequelize['STRING']},'dialOriginateTimeout':{'type':Sequelize[_0xaf6d('0x17')](0x3)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':'Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialQueueOptions':{'type':Sequelize[_0xaf6d('0x2')],'defaultValue':_0xaf6d('0x2f'),'comment':_0xaf6d('0x30')},'dialQueueTimeout':{'type':Sequelize['INTEGER'](0x3)[_0xaf6d('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xaf6d('0x31')},'dialQueueProject':{'type':Sequelize['STRING'],'comment':'AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)'},'dialCongestionMaxRetry':{'type':Sequelize[_0xaf6d('0x17')](0x3)[_0xaf6d('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xaf6d('0x32')},'dialCongestionRetryFrequency':{'type':Sequelize[_0xaf6d('0x17')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialBusyMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xaf6d('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xaf6d('0x33')},'dialBusyRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xaf6d('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xaf6d('0x34')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xaf6d('0x17')](0x3)[_0xaf6d('0x26')],'defaultValue':0x3,'comment':_0xaf6d('0x35')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xaf6d('0x17')](0x5)[_0xaf6d('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xaf6d('0x36')},'dialGlobalMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xaf6d('0x26')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0xaf6d('0x37')},'dialTimezone':{'type':Sequelize['STRING'],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0xaf6d('0x2')],'defaultValue':_0xaf6d('0x38')},'dialPrefix':{'type':Sequelize[_0xaf6d('0x2')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0xaf6d('0x4')](_0xaf6d('0x39'),_0xaf6d('0x3a'),_0xaf6d('0x3b')),'defaultValue':_0xaf6d('0x39')},'dialAMDActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize['INTEGER'](0x9)[_0xaf6d('0x26')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xaf6d('0x3c')},'dialAMDGreeting':{'type':Sequelize[_0xaf6d('0x17')](0x9)[_0xaf6d('0x26')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xaf6d('0x3d')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0xaf6d('0x17')](0x9)[_0xaf6d('0x26')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0xaf6d('0x3e')},'dialAMDTotalAnalysisTime':{'type':Sequelize['INTEGER'](0x9)[_0xaf6d('0x26')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xaf6d('0x3f')},'dialAMDMinWordLength':{'type':Sequelize[_0xaf6d('0x17')](0x9)[_0xaf6d('0x26')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xaf6d('0x40')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xaf6d('0x17')](0x9)[_0xaf6d('0x26')],'defaultValue':0x32,'validate':{'min':0x0},'comment':'#AMD\x20Between\x20Words\x20Silence'},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0xaf6d('0x17')](0x9)[_0xaf6d('0x26')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0xaf6d('0x41')},'dialAMDSilenceThreshold':{'type':Sequelize[_0xaf6d('0x17')](0x5)[_0xaf6d('0x26')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xaf6d('0x42')},'dialAMDMaximumWordLength':{'type':Sequelize['INTEGER'](0x9)[_0xaf6d('0x26')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xaf6d('0x43')},'dialRecallMeTimeout':{'type':Sequelize[_0xaf6d('0x17')](0x5)['UNSIGNED'],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0xaf6d('0x44')},'dialRecallInQueue':{'type':Sequelize[_0xaf6d('0x21')],'defaultValue':0x0,'comment':_0xaf6d('0x45')},'dialOrderByScheduledAt':{'type':Sequelize[_0xaf6d('0x4')]('DESC','ASC'),'defaultValue':_0xaf6d('0x46')},'dialQueueProject2':{'type':Sequelize[_0xaf6d('0x2')],'comment':'AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)'},'dialAgiAfterHangupClient':{'type':Sequelize[_0xaf6d('0x21')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0xaf6d('0x21')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0xaf6d('0x17')](0x3)[_0xaf6d('0x26')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Random\x20Last\x20Digit\x20(min:1,\x20max:15)'},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xaf6d('0x47')},'dialNoSuchNumberMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0xaf6d('0x17')](0x5)[_0xaf6d('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xaf6d('0x48')},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xaf6d('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Drop\x20Retry\x20(min:1,\x20max:999)'},'dialDropRetryFrequency':{'type':Sequelize[_0xaf6d('0x17')](0x5)[_0xaf6d('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xaf6d('0x49')},'dialAbandonedMaxRetry':{'type':Sequelize[_0xaf6d('0x17')](0x3)[_0xaf6d('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xaf6d('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xaf6d('0x4a')},'dialMachineMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xaf6d('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xaf6d('0x4b')},'dialMachineRetryFrequency':{'type':Sequelize[_0xaf6d('0x17')](0x5)[_0xaf6d('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xaf6d('0x4c')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0xaf6d('0x17')](0x3)[_0xaf6d('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xaf6d('0x4d')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0xaf6d('0x17')](0x5)[_0xaf6d('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xaf6d('0x4e')},'mandatoryDispositionPauseId':{'type':Sequelize[_0xaf6d('0x17')],'allowNull':!![],'comment':_0xaf6d('0x4f')},'mandatoryDisposition':{'type':Sequelize[_0xaf6d('0x21')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0xa1b96f){if(!_0xa1b96f)this[_0xaf6d('0x1b')](_0xaf6d('0x50'),null);this['setDataValue'](_0xaf6d('0x51'),_0xa1b96f);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0xaf6d('0x17')](0x3)[_0xaf6d('0x26')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0xaf6d('0x17')](0x3)[_0xaf6d('0x26')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}}}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.controller.js b/server/api/voiceQueue/voiceQueue.controller.js index 1f58af9..1de799b 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 _0x614e=['undefined','limit','count','set','apply','reject','save','update','then','destroy','get','VoiceQueues','QueueCampaigns','filter','ignore','map','value','includes','type','find','name','UserProfileResource','stack','send','index','rawAttributes','fieldName','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','VoiceQueue','includeAll','findAll','rows','show','include','options','catch','create','body','user','role','inbound','outbound','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','params','omit','createdAt','updatedAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','getHoppers','findOne','VoiceQueueId','CmHopper','getHopperHistories','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','Team','getTeams','teams','User','Agents','online','voicePause','interface','flatMap','forEach','penalty','sequelize','transaction','addTeams','each','TeamVoiceQueue','upsert','isNil','SIP/%s','emit','userVoiceQueue:save','removeTeams','field','tq.TeamId','team_has_voice_queues','user_has_teams','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','all','union','compact','ids','isEmpty','removeAgents','UserVoiceQueueRt','userVoiceQueue:remove','addAgents','spread','format','isArray','getAgents','getMembers','getLists','addLists','dialCheckDuplicateType','insert','into','cm_hopper','fromQuery','scheduledAt','ContactId','ListId','select','phone','NOW()','from','cm_contacts','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','COALESCE(phone,\x27\x27)','onlyIfOpen','deletedAt\x20IS\x20NULL','CmListId','removeLists','getBlackLists','CmList','addBlackLists','cm_hopper_black','removeBlackLists','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','json','offset'];(function(_0x412c5f,_0x58e200){var _0x3e8ef1=function(_0x556dbf){while(--_0x556dbf){_0x412c5f['push'](_0x412c5f['shift']());}};_0x3e8ef1(++_0x58e200);}(_0x614e,0x159));var _0xe614=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x614e[_0x397e5f];return _0x5302b8;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xe614('0x0'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xe614('0x1'));var BPromise=require(_0xe614('0x2'));var Mustache=require(_0xe614('0x3'));var util=require(_0xe614('0x4'));var path=require(_0xe614('0x5'));var sox=require(_0xe614('0x6'));var csv=require(_0xe614('0x7'));var ejs=require(_0xe614('0x8'));var fs=require('fs');var fs_extra=require(_0xe614('0x9'));var _=require(_0xe614('0xa'));var squel=require(_0xe614('0xb'));var crypto=require('crypto');var jsforce=require(_0xe614('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xe614('0x7'));var querystring=require('querystring');var Papa=require(_0xe614('0xd'));var Redis=require('ioredis');var authService=require(_0xe614('0xe'));var qs=require(_0xe614('0xf'));var as=require(_0xe614('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe614('0x11'))(_0xe614('0x12'));var utils=require(_0xe614('0x13'));var config=require(_0xe614('0x14'));var licenseUtil=require(_0xe614('0x15'));var db=require(_0xe614('0x16'))['db'];config[_0xe614('0x17')]=_[_0xe614('0x18')](config[_0xe614('0x17')],{'host':_0xe614('0x19'),'port':0x18eb});var socket=require(_0xe614('0x1a'))(new Redis(config[_0xe614('0x17')]));require('./voiceQueue.socket')[_0xe614('0x1b')](socket);function respondWithStatusCode(_0x5c0a7d,_0x356a46){_0x356a46=_0x356a46||0xcc;return function(_0x195224){if(_0x195224){return _0x5c0a7d[_0xe614('0x1c')](_0x356a46);}return _0x5c0a7d[_0xe614('0x1d')](_0x356a46)[_0xe614('0x1e')]();};}function respondWithResult(_0x188398,_0x2593ae){_0x2593ae=_0x2593ae||0xc8;return function(_0x3f1072){if(_0x3f1072){return _0x188398[_0xe614('0x1d')](_0x2593ae)[_0xe614('0x1f')](_0x3f1072);}};}function respondWithFilteredResult(_0x23c4bb,_0xde7767){return function(_0x881b0e){if(_0x881b0e){var _0x521767=typeof _0xde7767[_0xe614('0x20')]===_0xe614('0x21')&&typeof _0xde7767[_0xe614('0x22')]===_0xe614('0x21');var _0x56086f=_0x881b0e[_0xe614('0x23')];var _0x54bba3=_0x521767?0x0:_0xde7767[_0xe614('0x20')];var _0x28e505=_0x521767?_0x881b0e[_0xe614('0x23')]:_0xde7767[_0xe614('0x20')]+_0xde7767[_0xe614('0x22')];var _0x5016ec;if(_0x28e505>=_0x56086f){_0x28e505=_0x56086f;_0x5016ec=0xc8;}else{_0x5016ec=0xce;}_0x23c4bb[_0xe614('0x1d')](_0x5016ec);return _0x23c4bb[_0xe614('0x24')]('Content-Range',_0x54bba3+'-'+_0x28e505+'/'+_0x56086f)['json'](_0x881b0e);}return null;};}function patchUpdates(_0x5940c2){return function(_0x2da0a9){try{jsonpatch[_0xe614('0x25')](_0x2da0a9,_0x5940c2,!![]);}catch(_0x1d99fe){return BPromise[_0xe614('0x26')](_0x1d99fe);}return _0x2da0a9[_0xe614('0x27')]();};}function saveUpdates(_0x39fa2f,_0x2ad3bd){return function(_0x4bcb32){if(_0x4bcb32){return _0x4bcb32[_0xe614('0x28')](_0x39fa2f)[_0xe614('0x29')](function(_0x3383e2){return _0x3383e2;});}return null;};}function removeEntity(_0x1164a2,_0x423915){return function(_0x7432f3){if(_0x7432f3){return _0x7432f3[_0xe614('0x2a')]()[_0xe614('0x29')](function(){var _0x4325fe=_0x7432f3[_0xe614('0x2b')]({'plain':!![]});var _0x16538c=[{'name':_0xe614('0x2c'),'value':'inbound','ignore':![]},{'name':_0xe614('0x2d'),'value':'outbound','ignore':![]}];var _0x30d1be=_(_0x16538c)[_0xe614('0x2e')](_0xe614('0x2f'))[_0xe614('0x30')](_0xe614('0x31'))['value']();if(_[_0xe614('0x32')](_0x30d1be,_0x4325fe[_0xe614('0x33')])){return;}var _0x2ce4c5=_[_0xe614('0x34')](_0x16538c,[_0xe614('0x31'),_0x4325fe[_0xe614('0x33')]])[_0xe614('0x35')];return db[_0xe614('0x36')][_0xe614('0x2a')]({'where':{'type':_0x2ce4c5,'resourceId':_0x4325fe['id']}})[_0xe614('0x29')](function(){return _0x7432f3;});})['then'](function(){_0x1164a2[_0xe614('0x1d')](0xcc)[_0xe614('0x1e')]();});}};}function handleEntityNotFound(_0x3971cb,_0x488847){return function(_0x4b1efa){if(!_0x4b1efa){_0x3971cb[_0xe614('0x1c')](0x194);}return _0x4b1efa;};}function handleError(_0x254dcf,_0x8ea656){_0x8ea656=_0x8ea656||0x1f4;return function(_0x577916){logger['error'](_0x577916[_0xe614('0x37')]);if(_0x577916['name']){delete _0x577916[_0xe614('0x35')];}_0x254dcf[_0xe614('0x1d')](_0x8ea656)[_0xe614('0x38')](_0x577916);};}exports[_0xe614('0x39')]=function(_0x55451e,_0x3c4fa9){var _0xdebff9={},_0x33fa8c={},_0x2c6cda={'count':0x0,'rows':[]};var _0x4a1416=_[_0xe614('0x30')](db['VoiceQueue'][_0xe614('0x3a')],function(_0x583dd8){return{'name':_0x583dd8[_0xe614('0x3b')],'type':_0x583dd8['type'][_0xe614('0x3c')]};});_0x33fa8c['model']=_[_0xe614('0x30')](_0x4a1416,_0xe614('0x35'));_0x33fa8c[_0xe614('0x3d')]=_[_0xe614('0x3e')](_0x55451e[_0xe614('0x3d')]);_0x33fa8c['filters']=_[_0xe614('0x3f')](_0x33fa8c[_0xe614('0x40')],_0x33fa8c[_0xe614('0x3d')]);_0xdebff9[_0xe614('0x41')]=_['intersection'](_0x33fa8c['model'],qs['fields'](_0x55451e[_0xe614('0x3d')][_0xe614('0x42')]));_0xdebff9[_0xe614('0x41')]=_0xdebff9[_0xe614('0x41')][_0xe614('0x43')]?_0xdebff9['attributes']:_0x33fa8c[_0xe614('0x40')];if(!_0x55451e['query'][_0xe614('0x44')](_0xe614('0x45'))){_0xdebff9[_0xe614('0x22')]=qs[_0xe614('0x22')](_0x55451e[_0xe614('0x3d')][_0xe614('0x22')]);_0xdebff9[_0xe614('0x20')]=qs[_0xe614('0x20')](_0x55451e[_0xe614('0x3d')][_0xe614('0x20')]);}_0xdebff9[_0xe614('0x46')]=qs[_0xe614('0x47')](_0x55451e[_0xe614('0x3d')][_0xe614('0x47')]);_0xdebff9[_0xe614('0x48')]=qs[_0xe614('0x49')](_[_0xe614('0x4a')](_0x55451e['query'],_0x33fa8c[_0xe614('0x49')]),_0x4a1416);if(_0x55451e['query']['filter']){_0xdebff9['where']=_[_0xe614('0x4b')](_0xdebff9[_0xe614('0x48')],{'$or':_[_0xe614('0x30')](_0x4a1416,function(_0x47e857){if(_0x47e857[_0xe614('0x33')]!==_0xe614('0x4c')){var _0x28fd94={};_0x28fd94[_0x47e857[_0xe614('0x35')]]={'$like':'%'+_0x55451e[_0xe614('0x3d')]['filter']+'%'};return _0x28fd94;}})});}_0xdebff9=_[_0xe614('0x4b')]({},_0xdebff9,_0x55451e['options']);var _0x2c490d={'where':_0xdebff9[_0xe614('0x48')]};return db[_0xe614('0x4d')][_0xe614('0x23')](_0x2c490d)[_0xe614('0x29')](function(_0x130d94){_0x2c6cda[_0xe614('0x23')]=_0x130d94;if(_0x55451e['query'][_0xe614('0x4e')]){_0xdebff9['include']=[{'all':!![]}];}return db['VoiceQueue'][_0xe614('0x4f')](_0xdebff9);})['then'](function(_0x1c0e22){_0x2c6cda[_0xe614('0x50')]=_0x1c0e22;return _0x2c6cda;})[_0xe614('0x29')](respondWithFilteredResult(_0x3c4fa9,_0xdebff9))['catch'](handleError(_0x3c4fa9,null));};exports[_0xe614('0x51')]=function(_0x4b580d,_0x203879){var _0x332c0b={'raw':![],'where':{'id':_0x4b580d['params']['id']}},_0x1cb830={};_0x1cb830[_0xe614('0x40')]=_[_0xe614('0x3e')](db[_0xe614('0x4d')]['rawAttributes']);_0x1cb830[_0xe614('0x3d')]=_[_0xe614('0x3e')](_0x4b580d['query']);_0x1cb830[_0xe614('0x49')]=_[_0xe614('0x3f')](_0x1cb830['model'],_0x1cb830[_0xe614('0x3d')]);_0x332c0b[_0xe614('0x41')]=_['intersection'](_0x1cb830[_0xe614('0x40')],qs[_0xe614('0x42')](_0x4b580d[_0xe614('0x3d')][_0xe614('0x42')]));_0x332c0b[_0xe614('0x41')]=_0x332c0b['attributes'][_0xe614('0x43')]?_0x332c0b[_0xe614('0x41')]:_0x1cb830[_0xe614('0x40')];if(_0x4b580d['query'][_0xe614('0x4e')]){_0x332c0b[_0xe614('0x52')]=[{'all':!![]}];}_0x332c0b=_[_0xe614('0x4b')]({},_0x332c0b,_0x4b580d[_0xe614('0x53')]);return db[_0xe614('0x4d')][_0xe614('0x34')](_0x332c0b)['then'](handleEntityNotFound(_0x203879,null))[_0xe614('0x29')](respondWithResult(_0x203879,null))[_0xe614('0x54')](handleError(_0x203879,null));};exports[_0xe614('0x55')]=function(_0x4c9d6b,_0x15cd4b){return db[_0xe614('0x4d')][_0xe614('0x55')](_0x4c9d6b[_0xe614('0x56')],{})['then'](function(_0x5a4776){var _0x581b44=_0x4c9d6b[_0xe614('0x57')]['get']({'plain':!![]});if(!_0x581b44)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x581b44[_0xe614('0x58')]===_0xe614('0x57')){var _0x2c5f8b=_0x5a4776[_0xe614('0x2b')]({'plain':!![]});var _0xb66b0a=[{'name':_0xe614('0x2c'),'value':_0xe614('0x59')},{'name':_0xe614('0x2d'),'value':_0xe614('0x5a')}];var _0x97470=_['find'](_0xb66b0a,[_0xe614('0x31'),_0x2c5f8b['type']])[_0xe614('0x35')];return db[_0xe614('0x5b')]['find']({'where':{'name':_0x97470,'userProfileId':_0x581b44['userProfileId']},'raw':!![]})[_0xe614('0x29')](function(_0x1f6c1d){if(_0x1f6c1d&&_0x1f6c1d[_0xe614('0x5c')]===0x0){return db[_0xe614('0x36')][_0xe614('0x55')]({'name':_0x2c5f8b[_0xe614('0x35')],'resourceId':_0x2c5f8b['id'],'type':_0x1f6c1d[_0xe614('0x35')],'sectionId':_0x1f6c1d['id']},{})[_0xe614('0x29')](function(){return _0x5a4776;});}else{return _0x5a4776;}})[_0xe614('0x54')](function(_0x1a6d90){logger[_0xe614('0x5d')](_0xe614('0x5e'),_0x1a6d90);throw _0x1a6d90;});}return _0x5a4776;})[_0xe614('0x29')](respondWithResult(_0x15cd4b,0xc9))[_0xe614('0x54')](handleError(_0x15cd4b,null));};exports[_0xe614('0x5f')]=function(_0x7794fd,_0x3a8eb3){var _0x4efd33={'where':{'id':_0x7794fd[_0xe614('0x60')]['id']}},_0x4b1370={};_0x4b1370['model']=_['keys'](db[_0xe614('0x4d')][_0xe614('0x3a')]);_0x4efd33['attributes']=_['intersection'](_0x4b1370['model'],qs[_0xe614('0x42')](_0x7794fd[_0xe614('0x3d')][_0xe614('0x42')]));_0x4efd33[_0xe614('0x41')]=_0x4efd33[_0xe614('0x41')][_0xe614('0x43')]?_0x4efd33[_0xe614('0x41')]:_0x4b1370[_0xe614('0x40')];if(_0x7794fd[_0xe614('0x3d')][_0xe614('0x4e')]){_0x4efd33[_0xe614('0x52')]=[{'all':!![]}];}_0x4efd33=_[_0xe614('0x4b')]({},_0x4efd33,_0x7794fd['options']);return db[_0xe614('0x4d')][_0xe614('0x34')](_0x4efd33)['then'](handleEntityNotFound(_0x3a8eb3,null))[_0xe614('0x29')](function(_0x575f32){if(_0x575f32){var _0x32fffd=_0x575f32[_0xe614('0x2b')]({'plain':!![]});_0x32fffd=qs[_0xe614('0x61')](_0x32fffd,['id',_0xe614('0x62'),_0xe614('0x63')]);_0x7794fd[_0xe614('0x56')]=_[_0xe614('0x61')](_0x7794fd[_0xe614('0x56')],['id',_0xe614('0x62'),_0xe614('0x63')]);return db[_0xe614('0x4d')]['create'](_[_0xe614('0x4b')](_0x32fffd,_0x7794fd[_0xe614('0x56')]),{'include':_0x7794fd[_0xe614('0x3d')][_0xe614('0x4e')]?[{'all':!![]}]:undefined})[_0xe614('0x29')](function(_0x3e2472){var _0x4ce8c5=_0x7794fd[_0xe614('0x57')][_0xe614('0x2b')]({'plain':!![]});if(!_0x4ce8c5)throw new Error(_0xe614('0x64'));if(_0x4ce8c5[_0xe614('0x58')]===_0xe614('0x57')){var _0x3c0e4a=_0x3e2472[_0xe614('0x2b')]({'plain':!![]});var _0x35ed20=[{'name':_0xe614('0x2c'),'value':'inbound'},{'name':_0xe614('0x2d'),'value':_0xe614('0x5a')}];var _0x9a5b4d=_[_0xe614('0x34')](_0x35ed20,[_0xe614('0x31'),_0x3c0e4a['type']])[_0xe614('0x35')];return db['UserProfileSection'][_0xe614('0x34')]({'where':{'name':_0x9a5b4d,'userProfileId':_0x4ce8c5[_0xe614('0x65')]},'raw':!![]})[_0xe614('0x29')](function(_0x524cc4){if(_0x524cc4&&_0x524cc4['autoAssociation']===0x0){return db[_0xe614('0x36')][_0xe614('0x55')]({'name':_0x3c0e4a[_0xe614('0x35')],'resourceId':_0x3c0e4a['id'],'type':_0x524cc4[_0xe614('0x35')],'sectionId':_0x524cc4['id']},{})[_0xe614('0x29')](function(){return _0x3e2472;});}else{return _0x3e2472;}})['catch'](function(_0x43726c){logger[_0xe614('0x5d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x43726c);throw _0x43726c;});}return _0x3e2472;});}})['then'](respondWithResult(_0x3a8eb3,0xc9))['catch'](handleError(_0x3a8eb3,null));};exports[_0xe614('0x28')]=function(_0x2fea00,_0x2316e9){if(_0x2fea00[_0xe614('0x56')]['id']){delete _0x2fea00[_0xe614('0x56')]['id'];}return db[_0xe614('0x4d')][_0xe614('0x34')]({'where':{'id':_0x2fea00[_0xe614('0x60')]['id']}})['then'](handleEntityNotFound(_0x2316e9,null))[_0xe614('0x29')](saveUpdates(_0x2fea00[_0xe614('0x56')],null))[_0xe614('0x29')](respondWithResult(_0x2316e9,null))[_0xe614('0x54')](handleError(_0x2316e9,null));};exports['destroy']=function(_0x116795,_0x2912a0){return db[_0xe614('0x4d')][_0xe614('0x34')]({'where':{'id':_0x116795[_0xe614('0x60')]['id']}})[_0xe614('0x29')](handleEntityNotFound(_0x2912a0,null))[_0xe614('0x29')](removeEntity(_0x2912a0,null))[_0xe614('0x54')](handleError(_0x2912a0,null));};exports[_0xe614('0x66')]=function(_0x40c0e0,_0x16478a,_0x4273d0){var _0x5e9c6e={'raw':![],'where':{}};var _0x448f63={};var _0x32546f={'count':0x0,'rows':[]};return db['VoiceQueue'][_0xe614('0x67')]({'where':{'id':_0x40c0e0[_0xe614('0x60')]['id']}})['then'](handleEntityNotFound(_0x16478a,null))[_0xe614('0x29')](function(_0x246fa7){if(_0x246fa7){_0x448f63[_0xe614('0x40')]=_['keys'](db['CmHopper'][_0xe614('0x3a')]);_0x448f63[_0xe614('0x3d')]=_[_0xe614('0x3e')](_0x40c0e0[_0xe614('0x3d')]);_0x448f63[_0xe614('0x49')]=_[_0xe614('0x3f')](_0x448f63['model'],_0x448f63[_0xe614('0x3d')]);_0x5e9c6e[_0xe614('0x41')]=_['intersection'](_0x448f63['model'],qs[_0xe614('0x42')](_0x40c0e0[_0xe614('0x3d')][_0xe614('0x42')]));_0x5e9c6e[_0xe614('0x41')]=_0x5e9c6e[_0xe614('0x41')]['length']?_0x5e9c6e[_0xe614('0x41')]:_0x448f63[_0xe614('0x40')];if(!_0x40c0e0['query'][_0xe614('0x44')](_0xe614('0x45'))){_0x5e9c6e[_0xe614('0x22')]=qs[_0xe614('0x22')](_0x40c0e0[_0xe614('0x3d')][_0xe614('0x22')]);_0x5e9c6e[_0xe614('0x20')]=qs[_0xe614('0x20')](_0x40c0e0[_0xe614('0x3d')][_0xe614('0x20')]);}_0x5e9c6e[_0xe614('0x46')]=qs['sort'](_0x40c0e0[_0xe614('0x3d')][_0xe614('0x47')]);_0x5e9c6e[_0xe614('0x48')]=qs[_0xe614('0x49')](_[_0xe614('0x4a')](_0x40c0e0[_0xe614('0x3d')],_0x448f63['filters']));_0x5e9c6e[_0xe614('0x48')][_0xe614('0x68')]=_0x246fa7['id'];if(_0x40c0e0[_0xe614('0x3d')]['filter']){_0x5e9c6e[_0xe614('0x48')]=_['merge'](_0x5e9c6e['where'],{'$or':_[_0xe614('0x30')](_0x5e9c6e[_0xe614('0x41')],function(_0x64a43d){var _0x40742a={};_0x40742a[_0x64a43d]={'$like':'%'+_0x40c0e0[_0xe614('0x3d')][_0xe614('0x2e')]+'%'};return _0x40742a;})});}_0x5e9c6e=_['merge']({},_0x5e9c6e,_0x40c0e0[_0xe614('0x53')]);return db[_0xe614('0x69')][_0xe614('0x23')]({'where':_0x5e9c6e[_0xe614('0x48')]})[_0xe614('0x29')](function(_0x5ba661){_0x32546f[_0xe614('0x23')]=_0x5ba661;if(_0x40c0e0[_0xe614('0x3d')][_0xe614('0x4e')]){_0x5e9c6e['include']=[{'all':!![]}];}return db['CmHopper'][_0xe614('0x4f')](_0x5e9c6e);})['then'](function(_0x212644){_0x32546f[_0xe614('0x50')]=_0x212644;return _0x32546f;});}})[_0xe614('0x29')](respondWithFilteredResult(_0x16478a,_0x5e9c6e))[_0xe614('0x54')](handleError(_0x16478a,null));};exports[_0xe614('0x6a')]=function(_0x45e078,_0x37a57b,_0x5235b9){var _0x14e570={'raw':!![],'where':{}};var _0x37610d={};var _0x5f0bae={'count':0x0,'rows':[]};return db[_0xe614('0x4d')][_0xe614('0x67')]({'where':{'id':_0x45e078[_0xe614('0x60')]['id']}})[_0xe614('0x29')](handleEntityNotFound(_0x37a57b,null))[_0xe614('0x29')](function(_0x342e13){if(_0x342e13){_0x37610d['model']=_['keys'](db[_0xe614('0x6b')]['rawAttributes']);_0x37610d[_0xe614('0x3d')]=_[_0xe614('0x3e')](_0x45e078[_0xe614('0x3d')]);_0x37610d[_0xe614('0x49')]=_[_0xe614('0x3f')](_0x37610d[_0xe614('0x40')],_0x37610d[_0xe614('0x3d')]);_0x14e570[_0xe614('0x41')]=_[_0xe614('0x3f')](_0x37610d[_0xe614('0x40')],qs['fields'](_0x45e078['query'][_0xe614('0x42')]));_0x14e570[_0xe614('0x41')]=_0x14e570[_0xe614('0x41')][_0xe614('0x43')]?_0x14e570[_0xe614('0x41')]:_0x37610d[_0xe614('0x40')];if(!_0x45e078[_0xe614('0x3d')][_0xe614('0x44')]('nolimit')){_0x14e570['limit']=qs[_0xe614('0x22')](_0x45e078['query']['limit']);_0x14e570[_0xe614('0x20')]=qs[_0xe614('0x20')](_0x45e078[_0xe614('0x3d')][_0xe614('0x20')]);}_0x14e570[_0xe614('0x46')]=qs[_0xe614('0x47')](_0x45e078[_0xe614('0x3d')][_0xe614('0x47')]);_0x14e570[_0xe614('0x48')]=qs[_0xe614('0x49')](_['pick'](_0x45e078[_0xe614('0x3d')],_0x37610d[_0xe614('0x49')]));_0x14e570[_0xe614('0x48')][_0xe614('0x68')]=_0x342e13['id'];if(_0x45e078['query'][_0xe614('0x2e')]){_0x14e570['where']=_[_0xe614('0x4b')](_0x14e570[_0xe614('0x48')],{'$or':_['map'](_0x14e570['attributes'],function(_0xd12790){var _0x2c9e14={};_0x2c9e14[_0xd12790]={'$like':'%'+_0x45e078['query']['filter']+'%'};return _0x2c9e14;})});}_0x14e570=_['merge']({},_0x14e570,_0x45e078[_0xe614('0x53')]);return db[_0xe614('0x6b')][_0xe614('0x23')]({'where':_0x14e570[_0xe614('0x48')]})[_0xe614('0x29')](function(_0x30a984){_0x5f0bae['count']=_0x30a984;if(_0x45e078['query'][_0xe614('0x4e')]){_0x14e570[_0xe614('0x52')]=[{'all':!![]}];}return db[_0xe614('0x6b')]['findAll'](_0x14e570);})[_0xe614('0x29')](function(_0x2b9203){_0x5f0bae['rows']=_0x2b9203;return _0x5f0bae;});}})[_0xe614('0x29')](respondWithFilteredResult(_0x37a57b,_0x14e570))[_0xe614('0x54')](handleError(_0x37a57b,null));};exports[_0xe614('0x6c')]=function(_0x1ca92c,_0x5c2a0d,_0x42ad8b){var _0x1b6054={'raw':!![],'where':{}};var _0x20ba8c={};var _0x1f0bd7={'count':0x0,'rows':[]};return db[_0xe614('0x4d')][_0xe614('0x67')]({'where':{'id':_0x1ca92c[_0xe614('0x60')]['id']}})[_0xe614('0x29')](handleEntityNotFound(_0x5c2a0d,null))['then'](function(_0x30de15){if(_0x30de15){_0x20ba8c[_0xe614('0x40')]=_['keys'](db[_0xe614('0x6d')][_0xe614('0x3a')]);_0x20ba8c['query']=_['keys'](_0x1ca92c['query']);_0x20ba8c[_0xe614('0x49')]=_['intersection'](_0x20ba8c['model'],_0x20ba8c[_0xe614('0x3d')]);_0x1b6054[_0xe614('0x41')]=_[_0xe614('0x3f')](_0x20ba8c[_0xe614('0x40')],qs[_0xe614('0x42')](_0x1ca92c[_0xe614('0x3d')][_0xe614('0x42')]));_0x1b6054['attributes']=_0x1b6054[_0xe614('0x41')]['length']?_0x1b6054[_0xe614('0x41')]:_0x20ba8c[_0xe614('0x40')];if(!_0x1ca92c[_0xe614('0x3d')][_0xe614('0x44')](_0xe614('0x45'))){_0x1b6054['limit']=qs['limit'](_0x1ca92c[_0xe614('0x3d')][_0xe614('0x22')]);_0x1b6054[_0xe614('0x20')]=qs[_0xe614('0x20')](_0x1ca92c[_0xe614('0x3d')][_0xe614('0x20')]);}_0x1b6054[_0xe614('0x46')]=qs['sort'](_0x1ca92c['query'][_0xe614('0x47')]);_0x1b6054[_0xe614('0x48')]=qs[_0xe614('0x49')](_['pick'](_0x1ca92c['query'],_0x20ba8c[_0xe614('0x49')]));_0x1b6054[_0xe614('0x48')]['VoiceQueueId']=_0x30de15['id'];if(_0x1ca92c[_0xe614('0x3d')][_0xe614('0x2e')]){_0x1b6054['where']=_[_0xe614('0x4b')](_0x1b6054[_0xe614('0x48')],{'$or':_['map'](_0x1b6054['attributes'],function(_0x5e3863){var _0x150d6b={};_0x150d6b[_0x5e3863]={'$like':'%'+_0x1ca92c[_0xe614('0x3d')]['filter']+'%'};return _0x150d6b;})});}_0x1b6054=_[_0xe614('0x4b')]({},_0x1b6054,_0x1ca92c[_0xe614('0x53')]);return db[_0xe614('0x6d')]['count']({'where':_0x1b6054[_0xe614('0x48')]})['then'](function(_0xaa30b9){_0x1f0bd7[_0xe614('0x23')]=_0xaa30b9;if(_0x1ca92c[_0xe614('0x3d')][_0xe614('0x4e')]){_0x1b6054[_0xe614('0x52')]=[{'all':!![]}];}return db['CmHopperFinal'][_0xe614('0x4f')](_0x1b6054);})['then'](function(_0x1c2278){_0x1f0bd7[_0xe614('0x50')]=_0x1c2278;return _0x1f0bd7;});}})[_0xe614('0x29')](respondWithFilteredResult(_0x5c2a0d,_0x1b6054))[_0xe614('0x54')](handleError(_0x5c2a0d,null));};exports[_0xe614('0x6e')]=function(_0xbaa716,_0x4239c6,_0x27319e){var _0x4b5f73={'raw':!![],'where':{}};var _0x32b2de={};var _0x14e955={'count':0x0,'rows':[]};return db['VoiceQueue'][_0xe614('0x67')]({'where':{'id':_0xbaa716[_0xe614('0x60')]['id']}})[_0xe614('0x29')](handleEntityNotFound(_0x4239c6,null))[_0xe614('0x29')](function(_0x53ada6){if(_0x53ada6){_0x32b2de[_0xe614('0x40')]=_[_0xe614('0x3e')](db['CmHopperBlack'][_0xe614('0x3a')]);_0x32b2de[_0xe614('0x3d')]=_[_0xe614('0x3e')](_0xbaa716['query']);_0x32b2de[_0xe614('0x49')]=_[_0xe614('0x3f')](_0x32b2de['model'],_0x32b2de['query']);_0x4b5f73[_0xe614('0x41')]=_[_0xe614('0x3f')](_0x32b2de[_0xe614('0x40')],qs['fields'](_0xbaa716[_0xe614('0x3d')][_0xe614('0x42')]));_0x4b5f73[_0xe614('0x41')]=_0x4b5f73[_0xe614('0x41')][_0xe614('0x43')]?_0x4b5f73[_0xe614('0x41')]:_0x32b2de['model'];if(!_0xbaa716['query'][_0xe614('0x44')]('nolimit')){_0x4b5f73[_0xe614('0x22')]=qs[_0xe614('0x22')](_0xbaa716[_0xe614('0x3d')][_0xe614('0x22')]);_0x4b5f73['offset']=qs[_0xe614('0x20')](_0xbaa716[_0xe614('0x3d')][_0xe614('0x20')]);}_0x4b5f73['order']=qs[_0xe614('0x47')](_0xbaa716[_0xe614('0x3d')][_0xe614('0x47')]);_0x4b5f73['where']=qs[_0xe614('0x49')](_[_0xe614('0x4a')](_0xbaa716[_0xe614('0x3d')],_0x32b2de[_0xe614('0x49')]));_0x4b5f73['where'][_0xe614('0x68')]=_0x53ada6['id'];if(_0xbaa716[_0xe614('0x3d')]['filter']){_0x4b5f73[_0xe614('0x48')]=_['merge'](_0x4b5f73['where'],{'$or':_[_0xe614('0x30')](_0x4b5f73['attributes'],function(_0x4185de){var _0x525e8e={};_0x525e8e[_0x4185de]={'$like':'%'+_0xbaa716[_0xe614('0x3d')][_0xe614('0x2e')]+'%'};return _0x525e8e;})});}_0x4b5f73=_[_0xe614('0x4b')]({},_0x4b5f73,_0xbaa716['options']);return db[_0xe614('0x6f')][_0xe614('0x23')]({'where':_0x4b5f73[_0xe614('0x48')]})['then'](function(_0x32a5cc){_0x14e955[_0xe614('0x23')]=_0x32a5cc;if(_0xbaa716['query'][_0xe614('0x4e')]){_0x4b5f73[_0xe614('0x52')]=[{'all':!![]}];}return db[_0xe614('0x6f')][_0xe614('0x4f')](_0x4b5f73);})[_0xe614('0x29')](function(_0x19ff6f){_0x14e955[_0xe614('0x50')]=_0x19ff6f;return _0x14e955;});}})[_0xe614('0x29')](respondWithFilteredResult(_0x4239c6,_0x4b5f73))[_0xe614('0x54')](handleError(_0x4239c6,null));};exports['getTeams']=function(_0x562889,_0x533d91,_0x2c9f5f){var _0x22a7f2={};var _0x3a50ed={};var _0xc91a4a;var _0x50d639;return db['VoiceQueue'][_0xe614('0x67')]({'where':{'id':_0x562889['params']['id']}})['then'](handleEntityNotFound(_0x533d91,null))['then'](function(_0x5f7f25){if(_0x5f7f25){_0xc91a4a=_0x5f7f25;_0x3a50ed[_0xe614('0x40')]=_[_0xe614('0x3e')](db[_0xe614('0x70')][_0xe614('0x3a')]);_0x3a50ed[_0xe614('0x3d')]=_[_0xe614('0x3e')](_0x562889[_0xe614('0x3d')]);_0x3a50ed['filters']=_[_0xe614('0x3f')](_0x3a50ed['model'],_0x3a50ed['query']);_0x22a7f2['attributes']=_[_0xe614('0x3f')](_0x3a50ed[_0xe614('0x40')],qs[_0xe614('0x42')](_0x562889[_0xe614('0x3d')][_0xe614('0x42')]));_0x22a7f2[_0xe614('0x41')]=_0x22a7f2['attributes'][_0xe614('0x43')]?_0x22a7f2[_0xe614('0x41')]:_0x3a50ed['model'];_0x22a7f2[_0xe614('0x46')]=qs[_0xe614('0x47')](_0x562889['query'][_0xe614('0x47')]);_0x22a7f2[_0xe614('0x48')]=qs[_0xe614('0x49')](_['pick'](_0x562889[_0xe614('0x3d')],_0x3a50ed[_0xe614('0x49')]));if(_0x562889[_0xe614('0x3d')][_0xe614('0x2e')]){_0x22a7f2[_0xe614('0x48')]=_[_0xe614('0x4b')](_0x22a7f2[_0xe614('0x48')],{'$or':_['map'](_0x22a7f2[_0xe614('0x41')],function(_0x601acd){var _0x446556={};_0x446556[_0x601acd]={'$like':'%'+_0x562889['query']['filter']+'%'};return _0x446556;})});}_0x22a7f2=_[_0xe614('0x4b')]({},_0x22a7f2,_0x562889[_0xe614('0x53')]);return _0xc91a4a[_0xe614('0x71')](_0x22a7f2);}})[_0xe614('0x29')](function(_0x49756){if(_0x49756){_0x50d639=_0x49756[_0xe614('0x43')];if(!_0x562889['query'][_0xe614('0x44')](_0xe614('0x45'))){_0x22a7f2[_0xe614('0x22')]=qs['limit'](_0x562889[_0xe614('0x3d')][_0xe614('0x22')]);_0x22a7f2[_0xe614('0x20')]=qs['offset'](_0x562889['query'][_0xe614('0x20')]);}return _0xc91a4a['getTeams'](_0x22a7f2);}})[_0xe614('0x29')](function(_0x52554b){if(_0x52554b){return _0x52554b?{'count':_0x50d639,'rows':_0x52554b}:null;}})[_0xe614('0x29')](respondWithResult(_0x533d91,null))[_0xe614('0x54')](handleError(_0x533d91,null));};exports['addTeams']=function(_0x5c0e26,_0x5c8ccf,_0x2950a5){var _0x447398=_0x5c0e26[_0xe614('0x56')][_0xe614('0x72')];var _0x59b917=_[_0xe614('0x30')](_0x447398,'id');return db[_0xe614('0x70')][_0xe614('0x4f')]({'where':{'id':_0x59b917},'attributes':['id'],'include':[{'model':db[_0xe614('0x73')],'as':_0xe614('0x74'),'attributes':['id',_0xe614('0x35'),_0xe614('0x75'),_0xe614('0x76'),_0xe614('0x77')],'raw':!![]}]})[_0xe614('0x29')](function(_0x1b19df){if(_0x1b19df){var _0x1506cc=_[_0xe614('0x78')](_0x1b19df,function(_0x936a4b){var _0x1d49d4=_0x936a4b[_0xe614('0x2b')]({'plain':!![]});_0x1d49d4[_0xe614('0x74')][_0xe614('0x79')](function(_0x20a03f){_0x20a03f[_0xe614('0x7a')]=_[_0xe614('0x34')](_0x447398,{'id':_0x1d49d4['id']})['penalty'];});return _0x1d49d4[_0xe614('0x74')];});return db[_0xe614('0x4d')][_0xe614('0x34')]({'where':{'id':_0x5c0e26[_0xe614('0x60')]['id']}})[_0xe614('0x29')](function(_0xc5eaef){return db[_0xe614('0x7b')][_0xe614('0x7c')](function(_0x533f86){return _0xc5eaef[_0xe614('0x7d')](_0x59b917,{'transaction':_0x533f86})['then'](function(){return BPromise[_0xe614('0x7e')](_0x447398,function(_0x4b347d){return db[_0xe614('0x7f')][_0xe614('0x80')]({'TeamId':_0x4b347d['id'],'VoiceQueueId':_0x5c0e26[_0xe614('0x60')]['id'],'penalty':_0x4b347d[_0xe614('0x7a')]},{'transaction':_0x533f86});});})[_0xe614('0x29')](function(){return BPromise[_0xe614('0x7e')](_0x1506cc,function(_0x2e0f2a){return db['UserVoiceQueue']['findOrCreate']({'where':{'UserId':_0x2e0f2a['id'],'VoiceQueueId':_0x5c0e26[_0xe614('0x60')]['id']},'defaults':{'penalty':_0x2e0f2a[_0xe614('0x7a')]},'transaction':_0x533f86});});})[_0xe614('0x29')](function(){return BPromise[_0xe614('0x7e')](_[_0xe614('0x2e')](_0x1506cc,{'online':!![]}),function(_0x4023b1){return db['UserVoiceQueueRt']['upsert']({'membername':_0x4023b1['name'],'UserId':_0x4023b1['id'],'queue_name':_0xc5eaef[_0xe614('0x35')],'VoiceQueueId':_0xc5eaef['id'],'interface':_[_0xe614('0x81')](_0x4023b1['interface'])?util['format'](_0xe614('0x82'),_0x4023b1[_0xe614('0x35')]):_0x4023b1[_0xe614('0x77')],'paused':_0x4023b1['voicePause']||![],'penalty':_0x4023b1['penalty']},{'transaction':_0x533f86});});})['then'](function(){_0x1506cc['forEach'](function(_0x32774d){socket[_0xe614('0x83')](_0xe614('0x84'),{'UserId':_0x32774d['id'],'VoiceQueueId':_0xc5eaef['id']});});});});});}})[_0xe614('0x29')](respondWithStatusCode(_0x5c8ccf,null))['catch'](handleError(_0x5c8ccf,null));};exports[_0xe614('0x85')]=function(_0x3de484,_0x41bd3a,_0x54fb86){return db[_0xe614('0x70')][_0xe614('0x4f')]({'where':{'id':_0x3de484[_0xe614('0x3d')]['ids']},'attributes':['id'],'include':[{'model':db['User'],'as':_0xe614('0x74'),'attributes':['id'],'raw':!![]}]})[_0xe614('0x29')](handleEntityNotFound(_0x41bd3a,null))[_0xe614('0x29')](function(_0x16d129){var _0x985362=_[_0xe614('0x30')](_0x16d129,'id');var _0x2ae2e8=[];var _0x1c342a=[];var _0x55a576=squel['select']();_0x55a576[_0xe614('0x86')](_0xe614('0x87'))['from'](_0xe614('0x88'),'tq')['join'](_0xe614('0x89'),'ut','ut.TeamId\x20=\x20tq.TeamId')['where'](_0xe614('0x8a'),_0x3de484['params']['id']);for(var _0x437f4c=0x0;_0x437f4c<_0x16d129[_0xe614('0x43')];_0x437f4c+=0x1){let _0x5f264b=_0x16d129[_0x437f4c];for(var _0x581438=0x0;_0x581438<_0x5f264b['Agents'][_0xe614('0x43')];_0x581438+=0x1){let _0x54a5f2=_0x5f264b[_0xe614('0x74')][_0x581438];var _0x5b5a03=_0x55a576['clone']();_0x5b5a03[_0xe614('0x48')](_0xe614('0x8b'),_0x54a5f2['id']);_0x1c342a[_0xe614('0x8c')](db[_0xe614('0x7b')][_0xe614('0x3d')](_0x5b5a03[_0xe614('0x8d')](),{'type':db[_0xe614('0x7b')][_0xe614('0x8e')][_0xe614('0x8f')]})[_0xe614('0x29')](function(_0x34d88e){if(_0x34d88e['length']===0x1){return _0x54a5f2['id'];}else{var _0x24852c=_[_0xe614('0x90')](_[_0xe614('0x30')](_0x34d88e,'TeamId'),function(_0x2fc579){return _[_0xe614('0x32')](_0x985362,_0x2fc579);});if(_0x24852c){return _0x54a5f2['id'];}}}));}}return BPromise[_0xe614('0x91')](_0x1c342a)[_0xe614('0x29')](function(_0x244726){_0x2ae2e8=_(_0x2ae2e8)[_0xe614('0x92')](_0x244726)[_0xe614('0x93')]()['value']();return db[_0xe614('0x4d')][_0xe614('0x34')]({'where':{'id':_0x3de484[_0xe614('0x60')]['id']}})['then'](function(_0x4b5657){return db['sequelize']['transaction'](function(_0x1bf7dd){return _0x4b5657[_0xe614('0x85')](_0x3de484[_0xe614('0x3d')][_0xe614('0x94')],{'transaction':_0x1bf7dd})[_0xe614('0x29')](function(){if(!_[_0xe614('0x95')](_0x2ae2e8)){return _0x4b5657[_0xe614('0x96')](_0x2ae2e8,{'transaction':_0x1bf7dd})[_0xe614('0x29')](function(){return db[_0xe614('0x97')][_0xe614('0x2a')]({'where':{'VoiceQueueId':_0x3de484['params']['id'],'UserId':_0x2ae2e8},'transaction':_0x1bf7dd});});}})[_0xe614('0x29')](function(){_0x2ae2e8['forEach'](function(_0x15e551){socket['emit'](_0xe614('0x98'),{'UserId':_0x15e551,'VoiceQueueId':_0x4b5657['id']});});});});});});})[_0xe614('0x29')](respondWithStatusCode(_0x41bd3a,null))['catch'](handleError(_0x41bd3a,null));};exports[_0xe614('0x99')]=function(_0x34a25a,_0x56b20b,_0x346b3d){var _0x39e3a1,_0x1cd6d0;return db['VoiceQueue'][_0xe614('0x34')]({'where':{'id':_0x34a25a[_0xe614('0x60')]['id']}})['then'](handleEntityNotFound(_0x56b20b,null))[_0xe614('0x29')](function(_0x1b840a){if(_0x1b840a){_0x1cd6d0=_0x1b840a;return _0x1b840a['addAgents'](_0x34a25a[_0xe614('0x56')][_0xe614('0x94')],_[_0xe614('0x61')](_0x34a25a[_0xe614('0x56')],[_0xe614('0x94'),'id'])||{})[_0xe614('0x9a')](function(_0x3cd83f){for(var _0x4c7ff3=0x0;_0x4c7ff3<_0x34a25a[_0xe614('0x56')]['ids'][_0xe614('0x43')];_0x4c7ff3+=0x1){socket[_0xe614('0x83')](_0xe614('0x84'),{'UserId':Number(_0x34a25a[_0xe614('0x56')][_0xe614('0x94')][_0x4c7ff3]),'VoiceQueueId':Number(_0x34a25a[_0xe614('0x60')]['id'])});}return _0x3cd83f;});}})['then'](function(_0xf3f99f){_0x39e3a1=_0xf3f99f||[];if(_0x1cd6d0){return db['User'][_0xe614('0x4f')]({'where':{'id':_0x34a25a[_0xe614('0x56')][_0xe614('0x94')]},'attributes':['id',_0xe614('0x35'),_0xe614('0x75'),_0xe614('0x76'),_0xe614('0x77')],'raw':!![]});}})[_0xe614('0x29')](function(_0x2c575d){if(!_[_0xe614('0x95')](_0x2c575d)){var _0x34ccb0=[];for(var _0x4d999a=0x0;_0x4d999a<_0x2c575d[_0xe614('0x43')];_0x4d999a++){if(_0x2c575d[_0x4d999a][_0xe614('0x75')]){_0x34ccb0['push'](db[_0xe614('0x97')][_0xe614('0x80')]({'membername':_0x2c575d[_0x4d999a][_0xe614('0x35')],'UserId':_0x2c575d[_0x4d999a]['id'],'queue_name':_0x1cd6d0[_0xe614('0x35')],'VoiceQueueId':_0x1cd6d0['id'],'interface':_[_0xe614('0x81')](_0x2c575d[_0x4d999a][_0xe614('0x77')])?util[_0xe614('0x9b')](_0xe614('0x82'),_0x2c575d[_0x4d999a]['name']):_0x2c575d[_0x4d999a]['interface'],'paused':_0x2c575d[_0x4d999a][_0xe614('0x76')]||![],'penalty':_0x34a25a[_0xe614('0x56')][_0xe614('0x7a')]||0x0}));}}return BPromise[_0xe614('0x91')](_0x34ccb0);}})[_0xe614('0x29')](function(){return _0x39e3a1;})[_0xe614('0x29')](respondWithResult(_0x56b20b,null))[_0xe614('0x54')](handleError(_0x56b20b,null));};exports[_0xe614('0x96')]=function(_0x2b3b58,_0x86219b,_0x4b8c5d){return db[_0xe614('0x4d')][_0xe614('0x34')]({'where':{'id':_0x2b3b58[_0xe614('0x60')]['id']}})[_0xe614('0x29')](handleEntityNotFound(_0x86219b,null))[_0xe614('0x29')](function(_0x34d12c){if(_0x34d12c){return _0x34d12c['removeAgents'](_0x2b3b58[_0xe614('0x3d')][_0xe614('0x94')])['then'](function(){if(_[_0xe614('0x9c')](_0x2b3b58[_0xe614('0x3d')][_0xe614('0x94')])){for(var _0x4b5e40=0x0;_0x4b5e40<_0x2b3b58[_0xe614('0x3d')][_0xe614('0x94')]['length'];_0x4b5e40+=0x1){socket['emit'](_0xe614('0x98'),{'UserId':Number(_0x2b3b58[_0xe614('0x3d')]['ids'][_0x4b5e40]),'VoiceQueueId':Number(_0x2b3b58[_0xe614('0x60')]['id'])});}}else{socket['emit']('userVoiceQueue:remove',{'UserId':Number(_0x2b3b58[_0xe614('0x3d')][_0xe614('0x94')]),'VoiceQueueId':Number(_0x2b3b58[_0xe614('0x60')]['id'])});}});}})[_0xe614('0x29')](function(_0x4542d8){return db[_0xe614('0x97')][_0xe614('0x2a')]({'where':{'VoiceQueueId':_0x2b3b58[_0xe614('0x60')]['id'],'UserId':_0x2b3b58['query'][_0xe614('0x94')]}})[_0xe614('0x29')](function(){return _0x4542d8;});})[_0xe614('0x29')](respondWithStatusCode(_0x86219b,null))[_0xe614('0x54')](handleError(_0x86219b,null));};exports[_0xe614('0x9d')]=function(_0x3055f5,_0x5c9986,_0x30da1d){var _0x5d1880={};var _0x40b660={};var _0x22608b;var _0x4b202b;return db['VoiceQueue'][_0xe614('0x67')]({'where':{'id':_0x3055f5['params']['id']}})['then'](handleEntityNotFound(_0x5c9986,null))[_0xe614('0x29')](function(_0x59af1b){if(_0x59af1b){_0x22608b=_0x59af1b;_0x40b660[_0xe614('0x40')]=_[_0xe614('0x3e')](db['User']['rawAttributes']);_0x40b660[_0xe614('0x3d')]=_['keys'](_0x3055f5[_0xe614('0x3d')]);_0x40b660[_0xe614('0x49')]=_[_0xe614('0x3f')](_0x40b660['model'],_0x40b660[_0xe614('0x3d')]);_0x5d1880[_0xe614('0x41')]=_['intersection'](_0x40b660[_0xe614('0x40')],qs[_0xe614('0x42')](_0x3055f5[_0xe614('0x3d')][_0xe614('0x42')]));_0x5d1880[_0xe614('0x41')]=_0x5d1880[_0xe614('0x41')]['length']?_0x5d1880[_0xe614('0x41')]:_0x40b660[_0xe614('0x40')];_0x5d1880[_0xe614('0x46')]=qs[_0xe614('0x47')](_0x3055f5[_0xe614('0x3d')][_0xe614('0x47')]);_0x5d1880[_0xe614('0x48')]=qs[_0xe614('0x49')](_[_0xe614('0x4a')](_0x3055f5['query'],_0x40b660[_0xe614('0x49')]));if(_0x3055f5['query'][_0xe614('0x2e')]){_0x5d1880[_0xe614('0x48')]=_[_0xe614('0x4b')](_0x5d1880[_0xe614('0x48')],{'$or':_[_0xe614('0x30')](_0x5d1880[_0xe614('0x41')],function(_0x387166){var _0x323f1e={};_0x323f1e[_0x387166]={'$like':'%'+_0x3055f5[_0xe614('0x3d')][_0xe614('0x2e')]+'%'};return _0x323f1e;})});}_0x5d1880=_[_0xe614('0x4b')]({},_0x5d1880,_0x3055f5[_0xe614('0x53')]);return _0x22608b[_0xe614('0x9d')](_0x5d1880);}})[_0xe614('0x29')](function(_0x26e4ca){if(_0x26e4ca){_0x4b202b=_0x26e4ca[_0xe614('0x43')];if(!_0x3055f5[_0xe614('0x3d')][_0xe614('0x44')](_0xe614('0x45'))){_0x5d1880[_0xe614('0x22')]=qs['limit'](_0x3055f5[_0xe614('0x3d')][_0xe614('0x22')]);_0x5d1880[_0xe614('0x20')]=qs['offset'](_0x3055f5['query'][_0xe614('0x20')]);}return _0x22608b[_0xe614('0x9d')](_0x5d1880);}})[_0xe614('0x29')](function(_0x3337f6){if(_0x3337f6){return _0x3337f6?{'count':_0x4b202b,'rows':_0x3337f6}:null;}})['then'](respondWithResult(_0x5c9986,null))['catch'](handleError(_0x5c9986,null));};exports['getMembers']=function(_0x33da6c,_0x5e3d6e,_0x4fd7a4){var _0x5da689={};var _0x575c4c={};var _0x560ff0;var _0x344570;return db[_0xe614('0x4d')][_0xe614('0x67')]({'where':{'id':_0x33da6c[_0xe614('0x60')]['id']}})[_0xe614('0x29')](handleEntityNotFound(_0x5e3d6e,null))['then'](function(_0xa232f7){if(_0xa232f7){_0x560ff0=_0xa232f7;_0x575c4c[_0xe614('0x40')]=_[_0xe614('0x3e')](db[_0xe614('0x97')]['rawAttributes']);_0x575c4c[_0xe614('0x3d')]=_['keys'](_0x33da6c[_0xe614('0x3d')]);_0x575c4c[_0xe614('0x49')]=_[_0xe614('0x3f')](_0x575c4c[_0xe614('0x40')],_0x575c4c[_0xe614('0x3d')]);_0x5da689[_0xe614('0x41')]=_[_0xe614('0x3f')](_0x575c4c[_0xe614('0x40')],qs[_0xe614('0x42')](_0x33da6c[_0xe614('0x3d')][_0xe614('0x42')]));_0x5da689['attributes']=_0x5da689[_0xe614('0x41')][_0xe614('0x43')]?_0x5da689[_0xe614('0x41')]:_0x575c4c[_0xe614('0x40')];_0x5da689[_0xe614('0x46')]=qs[_0xe614('0x47')](_0x33da6c[_0xe614('0x3d')]['sort']);_0x5da689['where']=qs['filters'](_[_0xe614('0x4a')](_0x33da6c['query'],_0x575c4c[_0xe614('0x49')]));if(_0x33da6c[_0xe614('0x3d')][_0xe614('0x2e')]){_0x5da689[_0xe614('0x48')]=_[_0xe614('0x4b')](_0x5da689[_0xe614('0x48')],{'$or':_[_0xe614('0x30')](_0x5da689[_0xe614('0x41')],function(_0x64436c){var _0x1676ae={};_0x1676ae[_0x64436c]={'$like':'%'+_0x33da6c[_0xe614('0x3d')]['filter']+'%'};return _0x1676ae;})});}_0x5da689=_['merge']({},_0x5da689,_0x33da6c[_0xe614('0x53')]);return _0x560ff0[_0xe614('0x9e')](_0x5da689);}})[_0xe614('0x29')](function(_0x2df8f3){if(_0x2df8f3){_0x344570=_0x2df8f3[_0xe614('0x43')];if(!_0x33da6c[_0xe614('0x3d')][_0xe614('0x44')]('nolimit')){_0x5da689[_0xe614('0x22')]=qs[_0xe614('0x22')](_0x33da6c['query'][_0xe614('0x22')]);_0x5da689[_0xe614('0x20')]=qs['offset'](_0x33da6c[_0xe614('0x3d')][_0xe614('0x20')]);}return _0x560ff0[_0xe614('0x9e')](_0x5da689);}})[_0xe614('0x29')](function(_0x22c6ce){return _0x22c6ce?{'count':_0x344570,'rows':_0x22c6ce}:null;})['then'](respondWithResult(_0x5e3d6e,null))['catch'](handleError(_0x5e3d6e,null));};exports[_0xe614('0x9f')]=function(_0x2846f6,_0x108197,_0x4381ac){var _0x1a5efc={};var _0x5e5c9c={};var _0x413c00;var _0x32122a;return db[_0xe614('0x4d')][_0xe614('0x67')]({'where':{'id':_0x2846f6[_0xe614('0x60')]['id']}})[_0xe614('0x29')](handleEntityNotFound(_0x108197,null))[_0xe614('0x29')](function(_0x1a19fb){if(_0x1a19fb){_0x413c00=_0x1a19fb;_0x5e5c9c['model']=_[_0xe614('0x3e')](db['CmList'][_0xe614('0x3a')]);_0x5e5c9c[_0xe614('0x3d')]=_[_0xe614('0x3e')](_0x2846f6[_0xe614('0x3d')]);_0x5e5c9c[_0xe614('0x49')]=_[_0xe614('0x3f')](_0x5e5c9c[_0xe614('0x40')],_0x5e5c9c[_0xe614('0x3d')]);_0x1a5efc['attributes']=_[_0xe614('0x3f')](_0x5e5c9c['model'],qs['fields'](_0x2846f6[_0xe614('0x3d')]['fields']));_0x1a5efc[_0xe614('0x41')]=_0x1a5efc[_0xe614('0x41')]['length']?_0x1a5efc['attributes']:_0x5e5c9c[_0xe614('0x40')];_0x1a5efc[_0xe614('0x46')]=qs['sort'](_0x2846f6[_0xe614('0x3d')][_0xe614('0x47')]);_0x1a5efc[_0xe614('0x48')]=qs[_0xe614('0x49')](_[_0xe614('0x4a')](_0x2846f6['query'],_0x5e5c9c[_0xe614('0x49')]));if(_0x2846f6[_0xe614('0x3d')]['filter']){_0x1a5efc[_0xe614('0x48')]=_[_0xe614('0x4b')](_0x1a5efc[_0xe614('0x48')],{'$or':_[_0xe614('0x30')](_0x1a5efc['attributes'],function(_0x28dab5){var _0x4f99f4={};_0x4f99f4[_0x28dab5]={'$like':'%'+_0x2846f6[_0xe614('0x3d')][_0xe614('0x2e')]+'%'};return _0x4f99f4;})});}_0x1a5efc=_['merge']({},_0x1a5efc,_0x2846f6[_0xe614('0x53')]);return _0x413c00[_0xe614('0x9f')](_0x1a5efc);}})[_0xe614('0x29')](function(_0x2db88c){if(_0x2db88c){_0x32122a=_0x2db88c[_0xe614('0x43')];if(!_0x2846f6['query']['hasOwnProperty'](_0xe614('0x45'))){_0x1a5efc['limit']=qs[_0xe614('0x22')](_0x2846f6[_0xe614('0x3d')][_0xe614('0x22')]);_0x1a5efc[_0xe614('0x20')]=qs[_0xe614('0x20')](_0x2846f6[_0xe614('0x3d')][_0xe614('0x20')]);}return _0x413c00[_0xe614('0x9f')](_0x1a5efc);}})[_0xe614('0x29')](function(_0x33c6b8){if(_0x33c6b8){return _0x33c6b8?{'count':_0x32122a,'rows':_0x33c6b8}:null;}})[_0xe614('0x29')](respondWithResult(_0x108197,null))[_0xe614('0x54')](handleError(_0x108197,null));};exports[_0xe614('0xa0')]=function(_0x2bf436,_0x14d239,_0x57921e){var _0x35aa31,_0x36d6a5;return db[_0xe614('0x4d')]['find']({'where':{'id':_0x2bf436['params']['id']}})[_0xe614('0x29')](handleEntityNotFound(_0x14d239,null))['then'](function(_0x5b8440){if(_0x5b8440){_0x36d6a5=_0x5b8440;return _0x5b8440[_0xe614('0xa0')](_0x2bf436[_0xe614('0x56')][_0xe614('0x94')],_[_0xe614('0x61')](_0x2bf436[_0xe614('0x56')],['ids','id'])||{});}return null;})['spread'](function(_0x5e1995){var _0x4d694f;_0x35aa31=_0x5e1995||[];var _0x1a92a5=[];if(_0x5e1995){for(var _0x5e1702=0x0;_0x5e1702<_0x5e1995[_0xe614('0x43')];_0x5e1702+=0x1){var _0x546a51=_0x5e1995[_0x5e1702][_0xe614('0x2b')]({'plain':!![]});_0x36d6a5[_0xe614('0xa1')]=_0x2bf436['body'][_0xe614('0xa1')]?_0x2bf436['body'][_0xe614('0xa1')]:_0x36d6a5['dialCheckDuplicateType'];switch(_0x36d6a5[_0xe614('0xa1')]){case'always':_0x4d694f=squel[_0xe614('0xa2')]()[_0xe614('0xa3')](_0xe614('0xa4'))[_0xe614('0xa5')](['phone',_0xe614('0xa6'),_0xe614('0xa7'),_0xe614('0xa8'),_0xe614('0x68'),_0xe614('0x62'),'updatedAt'],squel[_0xe614('0xa9')]()[_0xe614('0x86')](_0xe614('0xaa'),_0xe614('0xaa'))[_0xe614('0x86')]('NOW()',_0xe614('0xa6'))[_0xe614('0x86')]('id','ContactId')[_0xe614('0x86')](_0x546a51['CmListId'][_0xe614('0x8d')](),_0xe614('0xa8'))[_0xe614('0x86')](_0x2bf436[_0xe614('0x60')]['id'][_0xe614('0x8d')](),'VoiceQueueId')['field']('NOW()','createdAt')['field'](_0xe614('0xab'),_0xe614('0x63'))[_0xe614('0xac')](_0xe614('0xad'))[_0xe614('0x48')]('deletedAt\x20IS\x20NULL')[_0xe614('0x48')](_0xe614('0xae'),_0x546a51['CmListId']['toString']())['where'](_0xe614('0xaf'))['where'](_0xe614('0xb0'),squel[_0xe614('0xa9')]()[_0xe614('0x86')](_0xe614('0xb1'))[_0xe614('0xac')](_0xe614('0xb2'))['where'](_0xe614('0x8a'),_0x2bf436[_0xe614('0x60')]['id'][_0xe614('0x8d')]()))['where'](_0xe614('0xb0'),squel[_0xe614('0xa9')]()['field'](_0xe614('0xb3'))[_0xe614('0xac')](_0xe614('0xa4'))['where'](_0xe614('0x8a'),_0x2bf436[_0xe614('0x60')]['id'][_0xe614('0x8d')]())))[_0xe614('0x8d')]();break;case _0xe614('0xb4'):_0x4d694f=squel['insert']()[_0xe614('0xa3')](_0xe614('0xa4'))['fromQuery'](['phone',_0xe614('0xa6'),_0xe614('0xa7'),'ListId','VoiceQueueId','createdAt',_0xe614('0x63')],squel[_0xe614('0xa9')]()[_0xe614('0x86')](_0xe614('0xaa'),_0xe614('0xaa'))[_0xe614('0x86')](_0xe614('0xab'),_0xe614('0xa6'))[_0xe614('0x86')]('id','ContactId')[_0xe614('0x86')](_0x546a51['CmListId'][_0xe614('0x8d')](),_0xe614('0xa8'))[_0xe614('0x86')](_0x2bf436[_0xe614('0x60')]['id'][_0xe614('0x8d')](),_0xe614('0x68'))[_0xe614('0x86')]('NOW()',_0xe614('0x62'))[_0xe614('0x86')](_0xe614('0xab'),_0xe614('0x63'))[_0xe614('0xac')](_0xe614('0xad'))[_0xe614('0x48')](_0xe614('0xb5'))[_0xe614('0x48')](_0xe614('0xae'),_0x546a51[_0xe614('0xb6')]['toString']())[_0xe614('0x48')](_0xe614('0xaf'))[_0xe614('0x48')]('phone\x20NOT\x20IN\x20(?)',squel['select']()[_0xe614('0x86')](_0xe614('0xb3'))['from']('cm_hopper')[_0xe614('0x48')](_0xe614('0x8a'),_0x2bf436['params']['id']['toString']())))['toString']();break;default:_0x4d694f=squel[_0xe614('0xa2')]()[_0xe614('0xa3')](_0xe614('0xa4'))['fromQuery']([_0xe614('0xaa'),_0xe614('0xa6'),'ContactId',_0xe614('0xa8'),'VoiceQueueId',_0xe614('0x62'),'updatedAt'],squel[_0xe614('0xa9')]()[_0xe614('0x86')](_0xe614('0xaa'),'phone')[_0xe614('0x86')]('NOW()',_0xe614('0xa6'))[_0xe614('0x86')]('id',_0xe614('0xa7'))['field'](_0x546a51['CmListId'][_0xe614('0x8d')](),_0xe614('0xa8'))[_0xe614('0x86')](_0x2bf436[_0xe614('0x60')]['id'][_0xe614('0x8d')](),_0xe614('0x68'))[_0xe614('0x86')](_0xe614('0xab'),'createdAt')[_0xe614('0x86')](_0xe614('0xab'),_0xe614('0x63'))['from']('cm_contacts')[_0xe614('0x48')](_0xe614('0xb5'))[_0xe614('0x48')](_0xe614('0xae'),_0x546a51[_0xe614('0xb6')][_0xe614('0x8d')]())[_0xe614('0x48')](_0xe614('0xaf')))[_0xe614('0x8d')]();}_0x1a92a5[_0xe614('0x8c')](db[_0xe614('0x7b')]['query'](_0x4d694f));}return BPromise[_0xe614('0x91')](_0x1a92a5);}})[_0xe614('0x29')](function(){return _0x35aa31;})[_0xe614('0x29')](respondWithResult(_0x14d239,null))[_0xe614('0x54')](handleError(_0x14d239,null));};exports[_0xe614('0xb7')]=function(_0x31b22b,_0x4a7143,_0x3514d3){return db[_0xe614('0x4d')][_0xe614('0x34')]({'where':{'id':_0x31b22b['params']['id']}})['then'](handleEntityNotFound(_0x4a7143,null))[_0xe614('0x29')](function(_0x4d983b){if(_0x4d983b){return _0x4d983b[_0xe614('0xb7')](_0x31b22b['query'][_0xe614('0x94')]);}})[_0xe614('0x29')](function(_0x50fa31){if(_0x50fa31){return db[_0xe614('0x69')][_0xe614('0x2a')]({'where':{'ListId':_0x31b22b[_0xe614('0x3d')][_0xe614('0x94')],'VoiceQueueId':_0x31b22b[_0xe614('0x60')]['id']}})[_0xe614('0x29')](function(){return _0x50fa31;});}})[_0xe614('0x29')](respondWithStatusCode(_0x4a7143,null))[_0xe614('0x54')](handleError(_0x4a7143,null));};exports[_0xe614('0xb8')]=function(_0x1230e6,_0x485c7a,_0x3d8e6b){var _0x5ee142={};var _0x488d63={};var _0x9b7f5c;var _0x5b1a99;return db[_0xe614('0x4d')][_0xe614('0x67')]({'where':{'id':_0x1230e6[_0xe614('0x60')]['id']}})['then'](handleEntityNotFound(_0x485c7a,null))[_0xe614('0x29')](function(_0x1d7857){if(_0x1d7857){_0x9b7f5c=_0x1d7857;_0x488d63[_0xe614('0x40')]=_[_0xe614('0x3e')](db[_0xe614('0xb9')][_0xe614('0x3a')]);_0x488d63[_0xe614('0x3d')]=_['keys'](_0x1230e6[_0xe614('0x3d')]);_0x488d63[_0xe614('0x49')]=_[_0xe614('0x3f')](_0x488d63['model'],_0x488d63['query']);_0x5ee142['attributes']=_[_0xe614('0x3f')](_0x488d63['model'],qs['fields'](_0x1230e6[_0xe614('0x3d')]['fields']));_0x5ee142[_0xe614('0x41')]=_0x5ee142[_0xe614('0x41')][_0xe614('0x43')]?_0x5ee142[_0xe614('0x41')]:_0x488d63[_0xe614('0x40')];_0x5ee142[_0xe614('0x46')]=qs[_0xe614('0x47')](_0x1230e6[_0xe614('0x3d')][_0xe614('0x47')]);_0x5ee142[_0xe614('0x48')]=qs[_0xe614('0x49')](_[_0xe614('0x4a')](_0x1230e6[_0xe614('0x3d')],_0x488d63[_0xe614('0x49')]));if(_0x1230e6[_0xe614('0x3d')][_0xe614('0x2e')]){_0x5ee142[_0xe614('0x48')]=_[_0xe614('0x4b')](_0x5ee142[_0xe614('0x48')],{'$or':_['map'](_0x5ee142['attributes'],function(_0x302dec){var _0x14592c={};_0x14592c[_0x302dec]={'$like':'%'+_0x1230e6[_0xe614('0x3d')][_0xe614('0x2e')]+'%'};return _0x14592c;})});}_0x5ee142=_['merge']({},_0x5ee142,_0x1230e6[_0xe614('0x53')]);return _0x9b7f5c[_0xe614('0xb8')](_0x5ee142);}})[_0xe614('0x29')](function(_0x5a78cc){if(_0x5a78cc){_0x5b1a99=_0x5a78cc['length'];if(!_0x1230e6[_0xe614('0x3d')]['hasOwnProperty']('nolimit')){_0x5ee142['limit']=qs[_0xe614('0x22')](_0x1230e6['query'][_0xe614('0x22')]);_0x5ee142[_0xe614('0x20')]=qs[_0xe614('0x20')](_0x1230e6[_0xe614('0x3d')]['offset']);}return _0x9b7f5c[_0xe614('0xb8')](_0x5ee142);}})[_0xe614('0x29')](function(_0x2dce9d){if(_0x2dce9d){return _0x2dce9d?{'count':_0x5b1a99,'rows':_0x2dce9d}:null;}})['then'](respondWithResult(_0x485c7a,null))[_0xe614('0x54')](handleError(_0x485c7a,null));};exports[_0xe614('0xba')]=function(_0x2c9847,_0x22bea1,_0x43e119){var _0x1cc38f,_0x6dfcdb;return db[_0xe614('0x4d')][_0xe614('0x34')]({'where':{'id':_0x2c9847[_0xe614('0x60')]['id']}})[_0xe614('0x29')](handleEntityNotFound(_0x22bea1,null))[_0xe614('0x29')](function(_0x2255c4){if(_0x2255c4){_0x6dfcdb=_0x2255c4;return _0x2255c4['addBlackLists'](_0x2c9847[_0xe614('0x56')]['ids'],_['omit'](_0x2c9847[_0xe614('0x56')],['ids','id'])||{});}return null;})[_0xe614('0x9a')](function(_0x3268fd){var _0x4efb56;_0x1cc38f=_0x3268fd||[];var _0x3a4473=[];if(_0x3268fd){for(var _0x4fcf93=0x0;_0x4fcf93<_0x3268fd[_0xe614('0x43')];_0x4fcf93+=0x1){var _0x2bb962=_0x3268fd[_0x4fcf93][_0xe614('0x2b')]({'plain':!![]});_0x4efb56=squel[_0xe614('0xa2')]()['into'](_0xe614('0xbb'))[_0xe614('0xa5')]([_0xe614('0xaa'),'ContactId','ListId','VoiceQueueId',_0xe614('0x62'),_0xe614('0x63')],squel[_0xe614('0xa9')]()[_0xe614('0x86')]('phone','phone')[_0xe614('0x86')]('id',_0xe614('0xa7'))['field'](_0x2bb962[_0xe614('0xb6')][_0xe614('0x8d')](),_0xe614('0xa8'))[_0xe614('0x86')](_0x2c9847[_0xe614('0x60')]['id'][_0xe614('0x8d')](),_0xe614('0x68'))[_0xe614('0x86')](_0xe614('0xab'),_0xe614('0x62'))[_0xe614('0x86')](_0xe614('0xab'),_0xe614('0x63'))[_0xe614('0xac')](_0xe614('0xad'))[_0xe614('0x48')](_0xe614('0xb5'))['where'](_0xe614('0xae'),_0x2bb962[_0xe614('0xb6')][_0xe614('0x8d')]())[_0xe614('0x48')]('phone\x20IS\x20NOT\x20NULL'))[_0xe614('0x8d')]();_0x3a4473[_0xe614('0x8c')](db['sequelize'][_0xe614('0x3d')](_0x4efb56));}return BPromise[_0xe614('0x91')](_0x3a4473);}})[_0xe614('0x29')](function(){return _0x1cc38f;})['then'](respondWithResult(_0x22bea1,null))[_0xe614('0x54')](handleError(_0x22bea1,null));};exports[_0xe614('0xbc')]=function(_0x56d333,_0x2dd9b8,_0x4e76b7){return db['VoiceQueue'][_0xe614('0x34')]({'where':{'id':_0x56d333[_0xe614('0x60')]['id']}})[_0xe614('0x29')](handleEntityNotFound(_0x2dd9b8,null))[_0xe614('0x29')](function(_0x47277d){if(_0x47277d){return _0x47277d[_0xe614('0xbc')](_0x56d333[_0xe614('0x3d')][_0xe614('0x94')]);}})[_0xe614('0x29')](function(_0x15af2c){if(_0x15af2c){return db[_0xe614('0x6f')]['destroy']({'where':{'ListId':_0x56d333[_0xe614('0x3d')][_0xe614('0x94')],'VoiceQueueId':_0x56d333['params']['id']}})[_0xe614('0x29')](function(){return _0x15af2c;});}})[_0xe614('0x29')](respondWithStatusCode(_0x2dd9b8,null))[_0xe614('0x54')](handleError(_0x2dd9b8,null));}; \ No newline at end of file +var _0x542c=['forEach','spread','userVoiceQueue:save','format','isArray','userVoiceQueue:remove','getAgents','getMembers','CmList','getLists','addLists','dialCheckDuplicateType','always','fromQuery','phone','scheduledAt','select','ContactId','CmListId','ListId','NOW()','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','COALESCE(phone,\x27\x27)','onlyIfOpen','insert','into','cm_contacts','phone\x20NOT\x20IN\x20(?)','cm_hopper','phone\x20IS\x20NOT\x20NULL','removeLists','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','get','VoiceQueues','inbound','QueueCampaigns','outbound','filter','ignore','map','value','includes','type','find','UserProfileResource','error','stack','name','send','index','VoiceQueue','fieldName','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','merge','VIRTUAL','includeAll','rows','show','rawAttributes','include','options','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','params','omit','createdAt','updatedAt','CmHopper','pick','VoiceQueueId','findAll','getHopperHistories','CmHopperHistory','nolimit','getHopperFinals','CmHopperFinal','getHopperBlacks','findOne','CmHopperBlack','getTeams','Team','addTeams','teams','online','voicePause','interface','flatMap','Agents','penalty','sequelize','transaction','each','TeamVoiceQueue','upsert','UserVoiceQueue','UserVoiceQueueRt','isNil','SIP/%s','emit','removeTeams','ids','User','field','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','all','isEmpty','removeAgents'];(function(_0x5709ea,_0x5c0089){var _0x1998b4=function(_0x3bab6b){while(--_0x3bab6b){_0x5709ea['push'](_0x5709ea['shift']());}};_0x1998b4(++_0x5c0089);}(_0x542c,0x1a6));var _0xc542=function(_0x10a4ef,_0xffbe2d){_0x10a4ef=_0x10a4ef-0x0;var _0x39e5be=_0x542c[_0x10a4ef];return _0x39e5be;};'use strict';var emlformat=require(_0xc542('0x0'));var rimraf=require(_0xc542('0x1'));var zipdir=require(_0xc542('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc542('0x3'));var moment=require(_0xc542('0x4'));var BPromise=require(_0xc542('0x5'));var Mustache=require('mustache');var util=require(_0xc542('0x6'));var path=require('path');var sox=require(_0xc542('0x7'));var csv=require(_0xc542('0x8'));var ejs=require(_0xc542('0x9'));var fs=require('fs');var fs_extra=require(_0xc542('0xa'));var _=require(_0xc542('0xb'));var squel=require(_0xc542('0xc'));var crypto=require(_0xc542('0xd'));var jsforce=require(_0xc542('0xe'));var deskjs=require(_0xc542('0xf'));var toCsv=require('to-csv');var querystring=require(_0xc542('0x10'));var Papa=require(_0xc542('0x11'));var Redis=require(_0xc542('0x12'));var authService=require(_0xc542('0x13'));var qs=require(_0xc542('0x14'));var as=require(_0xc542('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc542('0x16'))(_0xc542('0x17'));var utils=require('../../config/utils');var config=require(_0xc542('0x18'));var licenseUtil=require(_0xc542('0x19'));var db=require(_0xc542('0x1a'))['db'];config[_0xc542('0x1b')]=_[_0xc542('0x1c')](config['redis'],{'host':_0xc542('0x1d'),'port':0x18eb});var socket=require(_0xc542('0x1e'))(new Redis(config[_0xc542('0x1b')]));require('./voiceQueue.socket')['register'](socket);function respondWithStatusCode(_0x48d59e,_0xc4830c){_0xc4830c=_0xc4830c||0xcc;return function(_0x2c92ec){if(_0x2c92ec){return _0x48d59e[_0xc542('0x1f')](_0xc4830c);}return _0x48d59e[_0xc542('0x20')](_0xc4830c)[_0xc542('0x21')]();};}function respondWithResult(_0x4ee1b1,_0x4a31ec){_0x4a31ec=_0x4a31ec||0xc8;return function(_0x21572f){if(_0x21572f){return _0x4ee1b1['status'](_0x4a31ec)[_0xc542('0x22')](_0x21572f);}};}function respondWithFilteredResult(_0x4f4602,_0x50c117){return function(_0x21db5c){if(_0x21db5c){var _0x52af81=typeof _0x50c117[_0xc542('0x23')]==='undefined'&&typeof _0x50c117[_0xc542('0x24')]===_0xc542('0x25');var _0x45f1c4=_0x21db5c['count'];var _0x5ae2c5=_0x52af81?0x0:_0x50c117[_0xc542('0x23')];var _0x4831fa=_0x52af81?_0x21db5c[_0xc542('0x26')]:_0x50c117['offset']+_0x50c117[_0xc542('0x24')];var _0x2b99c4;if(_0x4831fa>=_0x45f1c4){_0x4831fa=_0x45f1c4;_0x2b99c4=0xc8;}else{_0x2b99c4=0xce;}_0x4f4602[_0xc542('0x20')](_0x2b99c4);return _0x4f4602[_0xc542('0x27')](_0xc542('0x28'),_0x5ae2c5+'-'+_0x4831fa+'/'+_0x45f1c4)[_0xc542('0x22')](_0x21db5c);}return null;};}function patchUpdates(_0x329e65){return function(_0x1c3e67){try{jsonpatch[_0xc542('0x29')](_0x1c3e67,_0x329e65,!![]);}catch(_0x5f1164){return BPromise[_0xc542('0x2a')](_0x5f1164);}return _0x1c3e67[_0xc542('0x2b')]();};}function saveUpdates(_0x46ee33,_0x1d669a){return function(_0x2acbd0){if(_0x2acbd0){return _0x2acbd0[_0xc542('0x2c')](_0x46ee33)[_0xc542('0x2d')](function(_0x5e402d){return _0x5e402d;});}return null;};}function removeEntity(_0x564150,_0xcfe7a8){return function(_0x1d0198){if(_0x1d0198){return _0x1d0198[_0xc542('0x2e')]()['then'](function(){var _0x103ad7=_0x1d0198[_0xc542('0x2f')]({'plain':!![]});var _0x45511b=[{'name':_0xc542('0x30'),'value':_0xc542('0x31'),'ignore':![]},{'name':_0xc542('0x32'),'value':_0xc542('0x33'),'ignore':![]}];var _0x38f3c9=_(_0x45511b)[_0xc542('0x34')](_0xc542('0x35'))[_0xc542('0x36')](_0xc542('0x37'))['value']();if(_[_0xc542('0x38')](_0x38f3c9,_0x103ad7[_0xc542('0x39')])){return;}var _0x4d984e=_[_0xc542('0x3a')](_0x45511b,[_0xc542('0x37'),_0x103ad7[_0xc542('0x39')]])['name'];return db[_0xc542('0x3b')]['destroy']({'where':{'type':_0x4d984e,'resourceId':_0x103ad7['id']}})['then'](function(){return _0x1d0198;});})[_0xc542('0x2d')](function(){_0x564150[_0xc542('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x59cf44,_0x2923b0){return function(_0x20e43a){if(!_0x20e43a){_0x59cf44[_0xc542('0x1f')](0x194);}return _0x20e43a;};}function handleError(_0x47b792,_0x3ad62c){_0x3ad62c=_0x3ad62c||0x1f4;return function(_0x226d38){logger[_0xc542('0x3c')](_0x226d38[_0xc542('0x3d')]);if(_0x226d38[_0xc542('0x3e')]){delete _0x226d38[_0xc542('0x3e')];}_0x47b792[_0xc542('0x20')](_0x3ad62c)[_0xc542('0x3f')](_0x226d38);};}exports[_0xc542('0x40')]=function(_0x2a5b72,_0x474aca){var _0x2e5739={},_0x220ab6={},_0x3d4a57={'count':0x0,'rows':[]};var _0x58e797=_[_0xc542('0x36')](db[_0xc542('0x41')]['rawAttributes'],function(_0x2b512f){return{'name':_0x2b512f[_0xc542('0x42')],'type':_0x2b512f['type'][_0xc542('0x43')]};});_0x220ab6[_0xc542('0x44')]=_[_0xc542('0x36')](_0x58e797,_0xc542('0x3e'));_0x220ab6[_0xc542('0x45')]=_[_0xc542('0x46')](_0x2a5b72['query']);_0x220ab6['filters']=_[_0xc542('0x47')](_0x220ab6[_0xc542('0x44')],_0x220ab6[_0xc542('0x45')]);_0x2e5739[_0xc542('0x48')]=_[_0xc542('0x47')](_0x220ab6[_0xc542('0x44')],qs['fields'](_0x2a5b72[_0xc542('0x45')][_0xc542('0x49')]));_0x2e5739[_0xc542('0x48')]=_0x2e5739[_0xc542('0x48')][_0xc542('0x4a')]?_0x2e5739[_0xc542('0x48')]:_0x220ab6[_0xc542('0x44')];if(!_0x2a5b72[_0xc542('0x45')][_0xc542('0x4b')]('nolimit')){_0x2e5739['limit']=qs['limit'](_0x2a5b72[_0xc542('0x45')][_0xc542('0x24')]);_0x2e5739[_0xc542('0x23')]=qs[_0xc542('0x23')](_0x2a5b72[_0xc542('0x45')][_0xc542('0x23')]);}_0x2e5739[_0xc542('0x4c')]=qs[_0xc542('0x4d')](_0x2a5b72[_0xc542('0x45')][_0xc542('0x4d')]);_0x2e5739[_0xc542('0x4e')]=qs[_0xc542('0x4f')](_['pick'](_0x2a5b72[_0xc542('0x45')],_0x220ab6[_0xc542('0x4f')]),_0x58e797);if(_0x2a5b72['query'][_0xc542('0x34')]){_0x2e5739['where']=_[_0xc542('0x50')](_0x2e5739[_0xc542('0x4e')],{'$or':_['map'](_0x58e797,function(_0x523b90){if(_0x523b90['type']!==_0xc542('0x51')){var _0x1be4df={};_0x1be4df[_0x523b90[_0xc542('0x3e')]]={'$like':'%'+_0x2a5b72[_0xc542('0x45')][_0xc542('0x34')]+'%'};return _0x1be4df;}})});}_0x2e5739=_['merge']({},_0x2e5739,_0x2a5b72['options']);var _0x1c7824={'where':_0x2e5739[_0xc542('0x4e')]};return db[_0xc542('0x41')][_0xc542('0x26')](_0x1c7824)[_0xc542('0x2d')](function(_0x496462){_0x3d4a57[_0xc542('0x26')]=_0x496462;if(_0x2a5b72['query'][_0xc542('0x52')]){_0x2e5739['include']=[{'all':!![]}];}return db[_0xc542('0x41')]['findAll'](_0x2e5739);})[_0xc542('0x2d')](function(_0x4c2bfa){_0x3d4a57[_0xc542('0x53')]=_0x4c2bfa;return _0x3d4a57;})[_0xc542('0x2d')](respondWithFilteredResult(_0x474aca,_0x2e5739))['catch'](handleError(_0x474aca,null));};exports[_0xc542('0x54')]=function(_0x4ad1e,_0x5738c0){var _0x51fdfa={'raw':![],'where':{'id':_0x4ad1e['params']['id']}},_0x223486={};_0x223486[_0xc542('0x44')]=_[_0xc542('0x46')](db[_0xc542('0x41')][_0xc542('0x55')]);_0x223486[_0xc542('0x45')]=_[_0xc542('0x46')](_0x4ad1e['query']);_0x223486[_0xc542('0x4f')]=_[_0xc542('0x47')](_0x223486[_0xc542('0x44')],_0x223486['query']);_0x51fdfa['attributes']=_[_0xc542('0x47')](_0x223486[_0xc542('0x44')],qs[_0xc542('0x49')](_0x4ad1e[_0xc542('0x45')][_0xc542('0x49')]));_0x51fdfa[_0xc542('0x48')]=_0x51fdfa[_0xc542('0x48')][_0xc542('0x4a')]?_0x51fdfa['attributes']:_0x223486[_0xc542('0x44')];if(_0x4ad1e['query'][_0xc542('0x52')]){_0x51fdfa[_0xc542('0x56')]=[{'all':!![]}];}_0x51fdfa=_[_0xc542('0x50')]({},_0x51fdfa,_0x4ad1e[_0xc542('0x57')]);return db['VoiceQueue'][_0xc542('0x3a')](_0x51fdfa)['then'](handleEntityNotFound(_0x5738c0,null))[_0xc542('0x2d')](respondWithResult(_0x5738c0,null))[_0xc542('0x58')](handleError(_0x5738c0,null));};exports[_0xc542('0x59')]=function(_0x2e6ba6,_0x2a287f){return db[_0xc542('0x41')][_0xc542('0x59')](_0x2e6ba6[_0xc542('0x5a')],{})[_0xc542('0x2d')](function(_0x5f33bb){var _0x5350fb=_0x2e6ba6[_0xc542('0x5b')][_0xc542('0x2f')]({'plain':!![]});if(!_0x5350fb)throw new Error(_0xc542('0x5c'));if(_0x5350fb[_0xc542('0x5d')]===_0xc542('0x5b')){var _0x1d47f0=_0x5f33bb['get']({'plain':!![]});var _0x22703a=[{'name':_0xc542('0x30'),'value':_0xc542('0x31')},{'name':'QueueCampaigns','value':_0xc542('0x33')}];var _0x1b2b4b=_[_0xc542('0x3a')](_0x22703a,[_0xc542('0x37'),_0x1d47f0['type']])[_0xc542('0x3e')];return db[_0xc542('0x5e')]['find']({'where':{'name':_0x1b2b4b,'userProfileId':_0x5350fb[_0xc542('0x5f')]},'raw':!![]})['then'](function(_0x45219f){if(_0x45219f&&_0x45219f[_0xc542('0x60')]===0x0){return db['UserProfileResource']['create']({'name':_0x1d47f0[_0xc542('0x3e')],'resourceId':_0x1d47f0['id'],'type':_0x45219f[_0xc542('0x3e')],'sectionId':_0x45219f['id']},{})[_0xc542('0x2d')](function(){return _0x5f33bb;});}else{return _0x5f33bb;}})[_0xc542('0x58')](function(_0x46aa7a){logger[_0xc542('0x3c')](_0xc542('0x61'),_0x46aa7a);throw _0x46aa7a;});}return _0x5f33bb;})[_0xc542('0x2d')](respondWithResult(_0x2a287f,0xc9))['catch'](handleError(_0x2a287f,null));};exports[_0xc542('0x62')]=function(_0x10ee8c,_0x1b35d7){var _0x4cd31b={'where':{'id':_0x10ee8c[_0xc542('0x63')]['id']}},_0x58b0ac={};_0x58b0ac[_0xc542('0x44')]=_[_0xc542('0x46')](db['VoiceQueue']['rawAttributes']);_0x4cd31b[_0xc542('0x48')]=_[_0xc542('0x47')](_0x58b0ac[_0xc542('0x44')],qs[_0xc542('0x49')](_0x10ee8c[_0xc542('0x45')][_0xc542('0x49')]));_0x4cd31b[_0xc542('0x48')]=_0x4cd31b[_0xc542('0x48')][_0xc542('0x4a')]?_0x4cd31b[_0xc542('0x48')]:_0x58b0ac[_0xc542('0x44')];if(_0x10ee8c[_0xc542('0x45')][_0xc542('0x52')]){_0x4cd31b[_0xc542('0x56')]=[{'all':!![]}];}_0x4cd31b=_[_0xc542('0x50')]({},_0x4cd31b,_0x10ee8c[_0xc542('0x57')]);return db[_0xc542('0x41')][_0xc542('0x3a')](_0x4cd31b)[_0xc542('0x2d')](handleEntityNotFound(_0x1b35d7,null))[_0xc542('0x2d')](function(_0x5a7dab){if(_0x5a7dab){var _0x3a2b4e=_0x5a7dab[_0xc542('0x2f')]({'plain':!![]});_0x3a2b4e=qs[_0xc542('0x64')](_0x3a2b4e,['id',_0xc542('0x65'),_0xc542('0x66')]);_0x10ee8c[_0xc542('0x5a')]=_['omit'](_0x10ee8c[_0xc542('0x5a')],['id',_0xc542('0x65'),_0xc542('0x66')]);return db['VoiceQueue']['create'](_[_0xc542('0x50')](_0x3a2b4e,_0x10ee8c['body']),{'include':_0x10ee8c[_0xc542('0x45')][_0xc542('0x52')]?[{'all':!![]}]:undefined})[_0xc542('0x2d')](function(_0x3568b0){var _0x3de765=_0x10ee8c[_0xc542('0x5b')][_0xc542('0x2f')]({'plain':!![]});if(!_0x3de765)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3de765[_0xc542('0x5d')]===_0xc542('0x5b')){var _0x1bd951=_0x3568b0[_0xc542('0x2f')]({'plain':!![]});var _0x467b43=[{'name':_0xc542('0x30'),'value':_0xc542('0x31')},{'name':_0xc542('0x32'),'value':_0xc542('0x33')}];var _0x5544c9=_[_0xc542('0x3a')](_0x467b43,[_0xc542('0x37'),_0x1bd951[_0xc542('0x39')]])['name'];return db[_0xc542('0x5e')][_0xc542('0x3a')]({'where':{'name':_0x5544c9,'userProfileId':_0x3de765['userProfileId']},'raw':!![]})['then'](function(_0x40d46b){if(_0x40d46b&&_0x40d46b[_0xc542('0x60')]===0x0){return db['UserProfileResource'][_0xc542('0x59')]({'name':_0x1bd951['name'],'resourceId':_0x1bd951['id'],'type':_0x40d46b[_0xc542('0x3e')],'sectionId':_0x40d46b['id']},{})['then'](function(){return _0x3568b0;});}else{return _0x3568b0;}})[_0xc542('0x58')](function(_0xb2eec2){logger['error'](_0xc542('0x61'),_0xb2eec2);throw _0xb2eec2;});}return _0x3568b0;});}})['then'](respondWithResult(_0x1b35d7,0xc9))['catch'](handleError(_0x1b35d7,null));};exports['update']=function(_0x372e6c,_0x2b1fc8){if(_0x372e6c[_0xc542('0x5a')]['id']){delete _0x372e6c[_0xc542('0x5a')]['id'];}return db[_0xc542('0x41')][_0xc542('0x3a')]({'where':{'id':_0x372e6c[_0xc542('0x63')]['id']}})[_0xc542('0x2d')](handleEntityNotFound(_0x2b1fc8,null))[_0xc542('0x2d')](saveUpdates(_0x372e6c[_0xc542('0x5a')],null))[_0xc542('0x2d')](respondWithResult(_0x2b1fc8,null))['catch'](handleError(_0x2b1fc8,null));};exports['destroy']=function(_0x48122b,_0x1521fe){return db[_0xc542('0x41')][_0xc542('0x3a')]({'where':{'id':_0x48122b[_0xc542('0x63')]['id']}})['then'](handleEntityNotFound(_0x1521fe,null))['then'](removeEntity(_0x1521fe,null))[_0xc542('0x58')](handleError(_0x1521fe,null));};exports['getHoppers']=function(_0x44395b,_0x2eb713,_0xaf150b){var _0x496905={'raw':![],'where':{}};var _0x470474={};var _0x1c0f03={'count':0x0,'rows':[]};return db[_0xc542('0x41')]['findOne']({'where':{'id':_0x44395b[_0xc542('0x63')]['id']}})[_0xc542('0x2d')](handleEntityNotFound(_0x2eb713,null))['then'](function(_0x3edf8a){if(_0x3edf8a){_0x470474[_0xc542('0x44')]=_[_0xc542('0x46')](db[_0xc542('0x67')][_0xc542('0x55')]);_0x470474['query']=_[_0xc542('0x46')](_0x44395b[_0xc542('0x45')]);_0x470474[_0xc542('0x4f')]=_[_0xc542('0x47')](_0x470474[_0xc542('0x44')],_0x470474['query']);_0x496905[_0xc542('0x48')]=_['intersection'](_0x470474['model'],qs[_0xc542('0x49')](_0x44395b[_0xc542('0x45')]['fields']));_0x496905[_0xc542('0x48')]=_0x496905['attributes']['length']?_0x496905['attributes']:_0x470474[_0xc542('0x44')];if(!_0x44395b[_0xc542('0x45')][_0xc542('0x4b')]('nolimit')){_0x496905[_0xc542('0x24')]=qs[_0xc542('0x24')](_0x44395b[_0xc542('0x45')][_0xc542('0x24')]);_0x496905[_0xc542('0x23')]=qs[_0xc542('0x23')](_0x44395b[_0xc542('0x45')][_0xc542('0x23')]);}_0x496905['order']=qs['sort'](_0x44395b[_0xc542('0x45')][_0xc542('0x4d')]);_0x496905[_0xc542('0x4e')]=qs['filters'](_[_0xc542('0x68')](_0x44395b[_0xc542('0x45')],_0x470474[_0xc542('0x4f')]));_0x496905[_0xc542('0x4e')][_0xc542('0x69')]=_0x3edf8a['id'];if(_0x44395b[_0xc542('0x45')][_0xc542('0x34')]){_0x496905[_0xc542('0x4e')]=_['merge'](_0x496905[_0xc542('0x4e')],{'$or':_[_0xc542('0x36')](_0x496905[_0xc542('0x48')],function(_0x29863d){var _0x4d543d={};_0x4d543d[_0x29863d]={'$like':'%'+_0x44395b[_0xc542('0x45')]['filter']+'%'};return _0x4d543d;})});}_0x496905=_[_0xc542('0x50')]({},_0x496905,_0x44395b['options']);return db['CmHopper'][_0xc542('0x26')]({'where':_0x496905[_0xc542('0x4e')]})[_0xc542('0x2d')](function(_0x4c8a48){_0x1c0f03['count']=_0x4c8a48;if(_0x44395b[_0xc542('0x45')][_0xc542('0x52')]){_0x496905[_0xc542('0x56')]=[{'all':!![]}];}return db[_0xc542('0x67')][_0xc542('0x6a')](_0x496905);})[_0xc542('0x2d')](function(_0x22b991){_0x1c0f03[_0xc542('0x53')]=_0x22b991;return _0x1c0f03;});}})[_0xc542('0x2d')](respondWithFilteredResult(_0x2eb713,_0x496905))[_0xc542('0x58')](handleError(_0x2eb713,null));};exports[_0xc542('0x6b')]=function(_0x467e40,_0x5526cd,_0x43640d){var _0x381232={'raw':!![],'where':{}};var _0xca6e93={};var _0xaa17ba={'count':0x0,'rows':[]};return db[_0xc542('0x41')]['findOne']({'where':{'id':_0x467e40['params']['id']}})['then'](handleEntityNotFound(_0x5526cd,null))['then'](function(_0x180997){if(_0x180997){_0xca6e93[_0xc542('0x44')]=_[_0xc542('0x46')](db[_0xc542('0x6c')][_0xc542('0x55')]);_0xca6e93[_0xc542('0x45')]=_[_0xc542('0x46')](_0x467e40[_0xc542('0x45')]);_0xca6e93[_0xc542('0x4f')]=_[_0xc542('0x47')](_0xca6e93[_0xc542('0x44')],_0xca6e93[_0xc542('0x45')]);_0x381232[_0xc542('0x48')]=_[_0xc542('0x47')](_0xca6e93['model'],qs[_0xc542('0x49')](_0x467e40[_0xc542('0x45')][_0xc542('0x49')]));_0x381232[_0xc542('0x48')]=_0x381232[_0xc542('0x48')][_0xc542('0x4a')]?_0x381232['attributes']:_0xca6e93[_0xc542('0x44')];if(!_0x467e40[_0xc542('0x45')]['hasOwnProperty'](_0xc542('0x6d'))){_0x381232[_0xc542('0x24')]=qs[_0xc542('0x24')](_0x467e40[_0xc542('0x45')]['limit']);_0x381232[_0xc542('0x23')]=qs[_0xc542('0x23')](_0x467e40[_0xc542('0x45')][_0xc542('0x23')]);}_0x381232[_0xc542('0x4c')]=qs[_0xc542('0x4d')](_0x467e40[_0xc542('0x45')][_0xc542('0x4d')]);_0x381232['where']=qs[_0xc542('0x4f')](_[_0xc542('0x68')](_0x467e40[_0xc542('0x45')],_0xca6e93[_0xc542('0x4f')]));_0x381232['where'][_0xc542('0x69')]=_0x180997['id'];if(_0x467e40[_0xc542('0x45')][_0xc542('0x34')]){_0x381232['where']=_[_0xc542('0x50')](_0x381232[_0xc542('0x4e')],{'$or':_['map'](_0x381232[_0xc542('0x48')],function(_0x172190){var _0xbaced8={};_0xbaced8[_0x172190]={'$like':'%'+_0x467e40[_0xc542('0x45')]['filter']+'%'};return _0xbaced8;})});}_0x381232=_[_0xc542('0x50')]({},_0x381232,_0x467e40[_0xc542('0x57')]);return db[_0xc542('0x6c')]['count']({'where':_0x381232[_0xc542('0x4e')]})[_0xc542('0x2d')](function(_0x41c146){_0xaa17ba[_0xc542('0x26')]=_0x41c146;if(_0x467e40['query']['includeAll']){_0x381232[_0xc542('0x56')]=[{'all':!![]}];}return db['CmHopperHistory'][_0xc542('0x6a')](_0x381232);})['then'](function(_0x519e2a){_0xaa17ba[_0xc542('0x53')]=_0x519e2a;return _0xaa17ba;});}})['then'](respondWithFilteredResult(_0x5526cd,_0x381232))[_0xc542('0x58')](handleError(_0x5526cd,null));};exports[_0xc542('0x6e')]=function(_0xafd0cf,_0x350e13,_0x2a8e6c){var _0x3fe00f={'raw':!![],'where':{}};var _0x32267e={};var _0x333fcf={'count':0x0,'rows':[]};return db['VoiceQueue']['findOne']({'where':{'id':_0xafd0cf['params']['id']}})[_0xc542('0x2d')](handleEntityNotFound(_0x350e13,null))[_0xc542('0x2d')](function(_0x16cf1a){if(_0x16cf1a){_0x32267e[_0xc542('0x44')]=_['keys'](db[_0xc542('0x6f')][_0xc542('0x55')]);_0x32267e[_0xc542('0x45')]=_[_0xc542('0x46')](_0xafd0cf[_0xc542('0x45')]);_0x32267e[_0xc542('0x4f')]=_['intersection'](_0x32267e[_0xc542('0x44')],_0x32267e[_0xc542('0x45')]);_0x3fe00f[_0xc542('0x48')]=_['intersection'](_0x32267e[_0xc542('0x44')],qs[_0xc542('0x49')](_0xafd0cf[_0xc542('0x45')][_0xc542('0x49')]));_0x3fe00f[_0xc542('0x48')]=_0x3fe00f['attributes']['length']?_0x3fe00f['attributes']:_0x32267e[_0xc542('0x44')];if(!_0xafd0cf[_0xc542('0x45')]['hasOwnProperty'](_0xc542('0x6d'))){_0x3fe00f[_0xc542('0x24')]=qs[_0xc542('0x24')](_0xafd0cf[_0xc542('0x45')]['limit']);_0x3fe00f[_0xc542('0x23')]=qs[_0xc542('0x23')](_0xafd0cf[_0xc542('0x45')][_0xc542('0x23')]);}_0x3fe00f[_0xc542('0x4c')]=qs[_0xc542('0x4d')](_0xafd0cf['query'][_0xc542('0x4d')]);_0x3fe00f[_0xc542('0x4e')]=qs[_0xc542('0x4f')](_[_0xc542('0x68')](_0xafd0cf['query'],_0x32267e['filters']));_0x3fe00f[_0xc542('0x4e')][_0xc542('0x69')]=_0x16cf1a['id'];if(_0xafd0cf[_0xc542('0x45')][_0xc542('0x34')]){_0x3fe00f[_0xc542('0x4e')]=_[_0xc542('0x50')](_0x3fe00f[_0xc542('0x4e')],{'$or':_[_0xc542('0x36')](_0x3fe00f['attributes'],function(_0x23d1da){var _0x3fe545={};_0x3fe545[_0x23d1da]={'$like':'%'+_0xafd0cf[_0xc542('0x45')][_0xc542('0x34')]+'%'};return _0x3fe545;})});}_0x3fe00f=_[_0xc542('0x50')]({},_0x3fe00f,_0xafd0cf[_0xc542('0x57')]);return db['CmHopperFinal'][_0xc542('0x26')]({'where':_0x3fe00f[_0xc542('0x4e')]})[_0xc542('0x2d')](function(_0x4748fa){_0x333fcf['count']=_0x4748fa;if(_0xafd0cf[_0xc542('0x45')][_0xc542('0x52')]){_0x3fe00f['include']=[{'all':!![]}];}return db['CmHopperFinal'][_0xc542('0x6a')](_0x3fe00f);})['then'](function(_0x2a4c7f){_0x333fcf['rows']=_0x2a4c7f;return _0x333fcf;});}})['then'](respondWithFilteredResult(_0x350e13,_0x3fe00f))[_0xc542('0x58')](handleError(_0x350e13,null));};exports[_0xc542('0x70')]=function(_0x59dc97,_0x5e66b2,_0x54d245){var _0x1e0cfe={'raw':!![],'where':{}};var _0x36423a={};var _0x1961e3={'count':0x0,'rows':[]};return db['VoiceQueue'][_0xc542('0x71')]({'where':{'id':_0x59dc97['params']['id']}})[_0xc542('0x2d')](handleEntityNotFound(_0x5e66b2,null))[_0xc542('0x2d')](function(_0x5d62c9){if(_0x5d62c9){_0x36423a['model']=_[_0xc542('0x46')](db[_0xc542('0x72')]['rawAttributes']);_0x36423a[_0xc542('0x45')]=_[_0xc542('0x46')](_0x59dc97[_0xc542('0x45')]);_0x36423a[_0xc542('0x4f')]=_[_0xc542('0x47')](_0x36423a[_0xc542('0x44')],_0x36423a[_0xc542('0x45')]);_0x1e0cfe[_0xc542('0x48')]=_[_0xc542('0x47')](_0x36423a[_0xc542('0x44')],qs[_0xc542('0x49')](_0x59dc97[_0xc542('0x45')][_0xc542('0x49')]));_0x1e0cfe['attributes']=_0x1e0cfe[_0xc542('0x48')][_0xc542('0x4a')]?_0x1e0cfe['attributes']:_0x36423a[_0xc542('0x44')];if(!_0x59dc97[_0xc542('0x45')]['hasOwnProperty'](_0xc542('0x6d'))){_0x1e0cfe['limit']=qs['limit'](_0x59dc97[_0xc542('0x45')][_0xc542('0x24')]);_0x1e0cfe[_0xc542('0x23')]=qs[_0xc542('0x23')](_0x59dc97[_0xc542('0x45')]['offset']);}_0x1e0cfe[_0xc542('0x4c')]=qs[_0xc542('0x4d')](_0x59dc97[_0xc542('0x45')]['sort']);_0x1e0cfe[_0xc542('0x4e')]=qs[_0xc542('0x4f')](_['pick'](_0x59dc97[_0xc542('0x45')],_0x36423a[_0xc542('0x4f')]));_0x1e0cfe[_0xc542('0x4e')][_0xc542('0x69')]=_0x5d62c9['id'];if(_0x59dc97[_0xc542('0x45')]['filter']){_0x1e0cfe[_0xc542('0x4e')]=_[_0xc542('0x50')](_0x1e0cfe[_0xc542('0x4e')],{'$or':_['map'](_0x1e0cfe[_0xc542('0x48')],function(_0x1e1b06){var _0x178266={};_0x178266[_0x1e1b06]={'$like':'%'+_0x59dc97[_0xc542('0x45')][_0xc542('0x34')]+'%'};return _0x178266;})});}_0x1e0cfe=_[_0xc542('0x50')]({},_0x1e0cfe,_0x59dc97[_0xc542('0x57')]);return db[_0xc542('0x72')][_0xc542('0x26')]({'where':_0x1e0cfe[_0xc542('0x4e')]})[_0xc542('0x2d')](function(_0x1be124){_0x1961e3[_0xc542('0x26')]=_0x1be124;if(_0x59dc97[_0xc542('0x45')]['includeAll']){_0x1e0cfe[_0xc542('0x56')]=[{'all':!![]}];}return db[_0xc542('0x72')][_0xc542('0x6a')](_0x1e0cfe);})[_0xc542('0x2d')](function(_0x2ff5fd){_0x1961e3[_0xc542('0x53')]=_0x2ff5fd;return _0x1961e3;});}})['then'](respondWithFilteredResult(_0x5e66b2,_0x1e0cfe))[_0xc542('0x58')](handleError(_0x5e66b2,null));};exports[_0xc542('0x73')]=function(_0x47989b,_0x4a62c8,_0x315265){var _0xb9adf={};var _0x2efcb3={};var _0x38b7df;var _0x76dffe;return db[_0xc542('0x41')][_0xc542('0x71')]({'where':{'id':_0x47989b[_0xc542('0x63')]['id']}})[_0xc542('0x2d')](handleEntityNotFound(_0x4a62c8,null))[_0xc542('0x2d')](function(_0x5a7a27){if(_0x5a7a27){_0x38b7df=_0x5a7a27;_0x2efcb3[_0xc542('0x44')]=_[_0xc542('0x46')](db[_0xc542('0x74')][_0xc542('0x55')]);_0x2efcb3[_0xc542('0x45')]=_[_0xc542('0x46')](_0x47989b[_0xc542('0x45')]);_0x2efcb3[_0xc542('0x4f')]=_[_0xc542('0x47')](_0x2efcb3['model'],_0x2efcb3[_0xc542('0x45')]);_0xb9adf['attributes']=_[_0xc542('0x47')](_0x2efcb3[_0xc542('0x44')],qs[_0xc542('0x49')](_0x47989b[_0xc542('0x45')][_0xc542('0x49')]));_0xb9adf[_0xc542('0x48')]=_0xb9adf[_0xc542('0x48')][_0xc542('0x4a')]?_0xb9adf[_0xc542('0x48')]:_0x2efcb3['model'];_0xb9adf[_0xc542('0x4c')]=qs[_0xc542('0x4d')](_0x47989b[_0xc542('0x45')][_0xc542('0x4d')]);_0xb9adf[_0xc542('0x4e')]=qs[_0xc542('0x4f')](_[_0xc542('0x68')](_0x47989b['query'],_0x2efcb3[_0xc542('0x4f')]));if(_0x47989b[_0xc542('0x45')]['filter']){_0xb9adf[_0xc542('0x4e')]=_[_0xc542('0x50')](_0xb9adf['where'],{'$or':_[_0xc542('0x36')](_0xb9adf[_0xc542('0x48')],function(_0x144112){var _0x2b58a8={};_0x2b58a8[_0x144112]={'$like':'%'+_0x47989b[_0xc542('0x45')]['filter']+'%'};return _0x2b58a8;})});}_0xb9adf=_[_0xc542('0x50')]({},_0xb9adf,_0x47989b[_0xc542('0x57')]);return _0x38b7df[_0xc542('0x73')](_0xb9adf);}})[_0xc542('0x2d')](function(_0x3771cc){if(_0x3771cc){_0x76dffe=_0x3771cc[_0xc542('0x4a')];if(!_0x47989b[_0xc542('0x45')][_0xc542('0x4b')](_0xc542('0x6d'))){_0xb9adf[_0xc542('0x24')]=qs[_0xc542('0x24')](_0x47989b[_0xc542('0x45')]['limit']);_0xb9adf['offset']=qs[_0xc542('0x23')](_0x47989b['query']['offset']);}return _0x38b7df['getTeams'](_0xb9adf);}})[_0xc542('0x2d')](function(_0x35c8c0){if(_0x35c8c0){return _0x35c8c0?{'count':_0x76dffe,'rows':_0x35c8c0}:null;}})[_0xc542('0x2d')](respondWithResult(_0x4a62c8,null))['catch'](handleError(_0x4a62c8,null));};exports[_0xc542('0x75')]=function(_0x2eed0b,_0x527b38,_0x5365e5){var _0x5652ea=_0x2eed0b[_0xc542('0x5a')][_0xc542('0x76')];var _0x1741f0=_[_0xc542('0x36')](_0x5652ea,'id');return db[_0xc542('0x74')][_0xc542('0x6a')]({'where':{'id':_0x1741f0},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id','name',_0xc542('0x77'),_0xc542('0x78'),_0xc542('0x79')],'raw':!![]}]})[_0xc542('0x2d')](function(_0x2f39d8){if(_0x2f39d8){var _0x1a5cb9=_[_0xc542('0x7a')](_0x2f39d8,function(_0x1d4148){var _0x9ba5b7=_0x1d4148['get']({'plain':!![]});_0x9ba5b7[_0xc542('0x7b')]['forEach'](function(_0x4ae47a){_0x4ae47a[_0xc542('0x7c')]=_[_0xc542('0x3a')](_0x5652ea,{'id':_0x9ba5b7['id']})[_0xc542('0x7c')];});return _0x9ba5b7['Agents'];});return db[_0xc542('0x41')][_0xc542('0x3a')]({'where':{'id':_0x2eed0b[_0xc542('0x63')]['id']}})[_0xc542('0x2d')](function(_0x1cf5aa){return db[_0xc542('0x7d')][_0xc542('0x7e')](function(_0x55cd6b){return _0x1cf5aa['addTeams'](_0x1741f0,{'transaction':_0x55cd6b})[_0xc542('0x2d')](function(){return BPromise[_0xc542('0x7f')](_0x5652ea,function(_0x7584dd){return db[_0xc542('0x80')][_0xc542('0x81')]({'TeamId':_0x7584dd['id'],'VoiceQueueId':_0x2eed0b[_0xc542('0x63')]['id'],'penalty':_0x7584dd[_0xc542('0x7c')]},{'transaction':_0x55cd6b});});})[_0xc542('0x2d')](function(){return BPromise[_0xc542('0x7f')](_0x1a5cb9,function(_0x15d605){return db[_0xc542('0x82')]['findOrCreate']({'where':{'UserId':_0x15d605['id'],'VoiceQueueId':_0x2eed0b[_0xc542('0x63')]['id']},'defaults':{'penalty':_0x15d605[_0xc542('0x7c')]},'transaction':_0x55cd6b});});})['then'](function(){return BPromise[_0xc542('0x7f')](_[_0xc542('0x34')](_0x1a5cb9,{'online':!![]}),function(_0x31528b){return db[_0xc542('0x83')][_0xc542('0x81')]({'membername':_0x31528b['name'],'UserId':_0x31528b['id'],'queue_name':_0x1cf5aa['name'],'VoiceQueueId':_0x1cf5aa['id'],'interface':_[_0xc542('0x84')](_0x31528b[_0xc542('0x79')])?util['format'](_0xc542('0x85'),_0x31528b['name']):_0x31528b[_0xc542('0x79')],'paused':_0x31528b[_0xc542('0x78')]||![],'penalty':_0x31528b['penalty']},{'transaction':_0x55cd6b});});})[_0xc542('0x2d')](function(){_0x1a5cb9['forEach'](function(_0x22189a){socket[_0xc542('0x86')]('userVoiceQueue:save',{'UserId':_0x22189a['id'],'VoiceQueueId':_0x1cf5aa['id']});});});});});}})[_0xc542('0x2d')](respondWithStatusCode(_0x527b38,null))[_0xc542('0x58')](handleError(_0x527b38,null));};exports[_0xc542('0x87')]=function(_0x209bce,_0x4499cf,_0x474ab9){return db[_0xc542('0x74')]['findAll']({'where':{'id':_0x209bce[_0xc542('0x45')][_0xc542('0x88')]},'attributes':['id'],'include':[{'model':db[_0xc542('0x89')],'as':_0xc542('0x7b'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x4499cf,null))[_0xc542('0x2d')](function(_0x8728ad){var _0x37d7fb=_[_0xc542('0x36')](_0x8728ad,'id');var _0x51a5e9=[];var _0x2eca59=[];var _0x2daefd=squel['select']();_0x2daefd[_0xc542('0x8a')]('tq.TeamId')[_0xc542('0x8b')]('team_has_voice_queues','tq')[_0xc542('0x8c')](_0xc542('0x8d'),'ut',_0xc542('0x8e'))[_0xc542('0x4e')](_0xc542('0x8f'),_0x209bce[_0xc542('0x63')]['id']);for(var _0x27dc95=0x0;_0x27dc95<_0x8728ad[_0xc542('0x4a')];_0x27dc95+=0x1){let _0x1c666c=_0x8728ad[_0x27dc95];for(var _0xa9dd60=0x0;_0xa9dd60<_0x1c666c['Agents'][_0xc542('0x4a')];_0xa9dd60+=0x1){let _0x4e1b33=_0x1c666c[_0xc542('0x7b')][_0xa9dd60];var _0x370359=_0x2daefd['clone']();_0x370359[_0xc542('0x4e')](_0xc542('0x90'),_0x4e1b33['id']);_0x2eca59[_0xc542('0x91')](db[_0xc542('0x7d')]['query'](_0x370359[_0xc542('0x92')](),{'type':db[_0xc542('0x7d')][_0xc542('0x93')][_0xc542('0x94')]})['then'](function(_0x2c558e){if(_0x2c558e[_0xc542('0x4a')]===0x1){return _0x4e1b33['id'];}else{var _0x150fd2=_[_0xc542('0x95')](_[_0xc542('0x36')](_0x2c558e,_0xc542('0x96')),function(_0xc664c8){return _[_0xc542('0x38')](_0x37d7fb,_0xc664c8);});if(_0x150fd2){return _0x4e1b33['id'];}}}));}}return BPromise[_0xc542('0x97')](_0x2eca59)[_0xc542('0x2d')](function(_0x3b4a81){_0x51a5e9=_(_0x51a5e9)['union'](_0x3b4a81)['compact']()[_0xc542('0x37')]();return db[_0xc542('0x41')][_0xc542('0x3a')]({'where':{'id':_0x209bce[_0xc542('0x63')]['id']}})[_0xc542('0x2d')](function(_0x984dd7){return db[_0xc542('0x7d')][_0xc542('0x7e')](function(_0x59f393){return _0x984dd7[_0xc542('0x87')](_0x209bce[_0xc542('0x45')][_0xc542('0x88')],{'transaction':_0x59f393})[_0xc542('0x2d')](function(){if(!_[_0xc542('0x98')](_0x51a5e9)){return _0x984dd7[_0xc542('0x99')](_0x51a5e9,{'transaction':_0x59f393})['then'](function(){return db[_0xc542('0x83')][_0xc542('0x2e')]({'where':{'VoiceQueueId':_0x209bce[_0xc542('0x63')]['id'],'UserId':_0x51a5e9},'transaction':_0x59f393});});}})[_0xc542('0x2d')](function(){_0x51a5e9[_0xc542('0x9a')](function(_0x17a612){socket[_0xc542('0x86')]('userVoiceQueue:remove',{'UserId':_0x17a612,'VoiceQueueId':_0x984dd7['id']});});});});});});})['then'](respondWithStatusCode(_0x4499cf,null))['catch'](handleError(_0x4499cf,null));};exports['addAgents']=function(_0x46af0e,_0x9da845,_0x233db6){var _0x1fed3d,_0x440952;return db[_0xc542('0x41')]['find']({'where':{'id':_0x46af0e['params']['id']}})[_0xc542('0x2d')](handleEntityNotFound(_0x9da845,null))[_0xc542('0x2d')](function(_0x246087){if(_0x246087){_0x440952=_0x246087;return _0x246087['addAgents'](_0x46af0e[_0xc542('0x5a')][_0xc542('0x88')],_[_0xc542('0x64')](_0x46af0e[_0xc542('0x5a')],[_0xc542('0x88'),'id'])||{})[_0xc542('0x9b')](function(_0x1ce20e){for(var _0x1b51b6=0x0;_0x1b51b6<_0x46af0e['body'][_0xc542('0x88')][_0xc542('0x4a')];_0x1b51b6+=0x1){socket[_0xc542('0x86')](_0xc542('0x9c'),{'UserId':Number(_0x46af0e['body']['ids'][_0x1b51b6]),'VoiceQueueId':Number(_0x46af0e[_0xc542('0x63')]['id'])});}return _0x1ce20e;});}})['then'](function(_0x5d7c4d){_0x1fed3d=_0x5d7c4d||[];if(_0x440952){return db[_0xc542('0x89')]['findAll']({'where':{'id':_0x46af0e[_0xc542('0x5a')][_0xc542('0x88')]},'attributes':['id',_0xc542('0x3e'),'online',_0xc542('0x78'),_0xc542('0x79')],'raw':!![]});}})[_0xc542('0x2d')](function(_0x4b78c4){if(!_[_0xc542('0x98')](_0x4b78c4)){var _0x297dcd=[];for(var _0x2e9981=0x0;_0x2e9981<_0x4b78c4['length'];_0x2e9981++){if(_0x4b78c4[_0x2e9981][_0xc542('0x77')]){_0x297dcd[_0xc542('0x91')](db['UserVoiceQueueRt']['upsert']({'membername':_0x4b78c4[_0x2e9981][_0xc542('0x3e')],'UserId':_0x4b78c4[_0x2e9981]['id'],'queue_name':_0x440952[_0xc542('0x3e')],'VoiceQueueId':_0x440952['id'],'interface':_[_0xc542('0x84')](_0x4b78c4[_0x2e9981][_0xc542('0x79')])?util[_0xc542('0x9d')](_0xc542('0x85'),_0x4b78c4[_0x2e9981][_0xc542('0x3e')]):_0x4b78c4[_0x2e9981][_0xc542('0x79')],'paused':_0x4b78c4[_0x2e9981][_0xc542('0x78')]||![],'penalty':_0x46af0e['body'][_0xc542('0x7c')]||0x0}));}}return BPromise[_0xc542('0x97')](_0x297dcd);}})[_0xc542('0x2d')](function(){return _0x1fed3d;})[_0xc542('0x2d')](respondWithResult(_0x9da845,null))[_0xc542('0x58')](handleError(_0x9da845,null));};exports[_0xc542('0x99')]=function(_0x4593eb,_0x18e91e,_0x228159){return db[_0xc542('0x41')][_0xc542('0x3a')]({'where':{'id':_0x4593eb[_0xc542('0x63')]['id']}})[_0xc542('0x2d')](handleEntityNotFound(_0x18e91e,null))[_0xc542('0x2d')](function(_0x4cc636){if(_0x4cc636){return _0x4cc636[_0xc542('0x99')](_0x4593eb[_0xc542('0x45')][_0xc542('0x88')])[_0xc542('0x2d')](function(){if(_[_0xc542('0x9e')](_0x4593eb[_0xc542('0x45')][_0xc542('0x88')])){for(var _0x3a8b2b=0x0;_0x3a8b2b<_0x4593eb[_0xc542('0x45')][_0xc542('0x88')]['length'];_0x3a8b2b+=0x1){socket[_0xc542('0x86')](_0xc542('0x9f'),{'UserId':Number(_0x4593eb[_0xc542('0x45')][_0xc542('0x88')][_0x3a8b2b]),'VoiceQueueId':Number(_0x4593eb[_0xc542('0x63')]['id'])});}}else{socket[_0xc542('0x86')](_0xc542('0x9f'),{'UserId':Number(_0x4593eb[_0xc542('0x45')]['ids']),'VoiceQueueId':Number(_0x4593eb[_0xc542('0x63')]['id'])});}});}})[_0xc542('0x2d')](function(_0x2834f1){return db[_0xc542('0x83')][_0xc542('0x2e')]({'where':{'VoiceQueueId':_0x4593eb['params']['id'],'UserId':_0x4593eb['query'][_0xc542('0x88')]}})[_0xc542('0x2d')](function(){return _0x2834f1;});})['then'](respondWithStatusCode(_0x18e91e,null))[_0xc542('0x58')](handleError(_0x18e91e,null));};exports[_0xc542('0xa0')]=function(_0x2fd9d5,_0x3bf352,_0x11a082){var _0x294d08={};var _0x4e9ebc={};var _0x3086e0;var _0xaab869;return db[_0xc542('0x41')][_0xc542('0x71')]({'where':{'id':_0x2fd9d5[_0xc542('0x63')]['id']}})['then'](handleEntityNotFound(_0x3bf352,null))[_0xc542('0x2d')](function(_0x52bc98){if(_0x52bc98){_0x3086e0=_0x52bc98;_0x4e9ebc[_0xc542('0x44')]=_[_0xc542('0x46')](db['User'][_0xc542('0x55')]);_0x4e9ebc['query']=_[_0xc542('0x46')](_0x2fd9d5[_0xc542('0x45')]);_0x4e9ebc[_0xc542('0x4f')]=_['intersection'](_0x4e9ebc[_0xc542('0x44')],_0x4e9ebc[_0xc542('0x45')]);_0x294d08[_0xc542('0x48')]=_['intersection'](_0x4e9ebc[_0xc542('0x44')],qs[_0xc542('0x49')](_0x2fd9d5[_0xc542('0x45')]['fields']));_0x294d08[_0xc542('0x48')]=_0x294d08[_0xc542('0x48')][_0xc542('0x4a')]?_0x294d08['attributes']:_0x4e9ebc[_0xc542('0x44')];_0x294d08[_0xc542('0x4c')]=qs[_0xc542('0x4d')](_0x2fd9d5[_0xc542('0x45')][_0xc542('0x4d')]);_0x294d08[_0xc542('0x4e')]=qs[_0xc542('0x4f')](_[_0xc542('0x68')](_0x2fd9d5['query'],_0x4e9ebc[_0xc542('0x4f')]));if(_0x2fd9d5['query']['filter']){_0x294d08[_0xc542('0x4e')]=_[_0xc542('0x50')](_0x294d08[_0xc542('0x4e')],{'$or':_[_0xc542('0x36')](_0x294d08['attributes'],function(_0x109310){var _0x694e26={};_0x694e26[_0x109310]={'$like':'%'+_0x2fd9d5[_0xc542('0x45')]['filter']+'%'};return _0x694e26;})});}_0x294d08=_[_0xc542('0x50')]({},_0x294d08,_0x2fd9d5[_0xc542('0x57')]);return _0x3086e0[_0xc542('0xa0')](_0x294d08);}})[_0xc542('0x2d')](function(_0x122ba0){if(_0x122ba0){_0xaab869=_0x122ba0[_0xc542('0x4a')];if(!_0x2fd9d5['query'][_0xc542('0x4b')]('nolimit')){_0x294d08[_0xc542('0x24')]=qs[_0xc542('0x24')](_0x2fd9d5[_0xc542('0x45')][_0xc542('0x24')]);_0x294d08[_0xc542('0x23')]=qs[_0xc542('0x23')](_0x2fd9d5[_0xc542('0x45')][_0xc542('0x23')]);}return _0x3086e0[_0xc542('0xa0')](_0x294d08);}})['then'](function(_0x19b610){if(_0x19b610){return _0x19b610?{'count':_0xaab869,'rows':_0x19b610}:null;}})['then'](respondWithResult(_0x3bf352,null))[_0xc542('0x58')](handleError(_0x3bf352,null));};exports[_0xc542('0xa1')]=function(_0x24ece2,_0x3966bf,_0x595c6e){var _0x4e09c2={};var _0x426eb3={};var _0x11bc22;var _0x473e2c;return db[_0xc542('0x41')]['findOne']({'where':{'id':_0x24ece2[_0xc542('0x63')]['id']}})[_0xc542('0x2d')](handleEntityNotFound(_0x3966bf,null))['then'](function(_0x11c971){if(_0x11c971){_0x11bc22=_0x11c971;_0x426eb3[_0xc542('0x44')]=_['keys'](db[_0xc542('0x83')]['rawAttributes']);_0x426eb3[_0xc542('0x45')]=_['keys'](_0x24ece2[_0xc542('0x45')]);_0x426eb3[_0xc542('0x4f')]=_[_0xc542('0x47')](_0x426eb3[_0xc542('0x44')],_0x426eb3[_0xc542('0x45')]);_0x4e09c2[_0xc542('0x48')]=_[_0xc542('0x47')](_0x426eb3['model'],qs['fields'](_0x24ece2[_0xc542('0x45')][_0xc542('0x49')]));_0x4e09c2[_0xc542('0x48')]=_0x4e09c2[_0xc542('0x48')][_0xc542('0x4a')]?_0x4e09c2[_0xc542('0x48')]:_0x426eb3['model'];_0x4e09c2[_0xc542('0x4c')]=qs[_0xc542('0x4d')](_0x24ece2[_0xc542('0x45')][_0xc542('0x4d')]);_0x4e09c2['where']=qs[_0xc542('0x4f')](_[_0xc542('0x68')](_0x24ece2[_0xc542('0x45')],_0x426eb3['filters']));if(_0x24ece2['query']['filter']){_0x4e09c2[_0xc542('0x4e')]=_[_0xc542('0x50')](_0x4e09c2[_0xc542('0x4e')],{'$or':_[_0xc542('0x36')](_0x4e09c2[_0xc542('0x48')],function(_0x2492e1){var _0x4fee82={};_0x4fee82[_0x2492e1]={'$like':'%'+_0x24ece2[_0xc542('0x45')][_0xc542('0x34')]+'%'};return _0x4fee82;})});}_0x4e09c2=_[_0xc542('0x50')]({},_0x4e09c2,_0x24ece2[_0xc542('0x57')]);return _0x11bc22[_0xc542('0xa1')](_0x4e09c2);}})[_0xc542('0x2d')](function(_0x121899){if(_0x121899){_0x473e2c=_0x121899[_0xc542('0x4a')];if(!_0x24ece2[_0xc542('0x45')][_0xc542('0x4b')](_0xc542('0x6d'))){_0x4e09c2['limit']=qs['limit'](_0x24ece2[_0xc542('0x45')][_0xc542('0x24')]);_0x4e09c2['offset']=qs[_0xc542('0x23')](_0x24ece2[_0xc542('0x45')]['offset']);}return _0x11bc22[_0xc542('0xa1')](_0x4e09c2);}})[_0xc542('0x2d')](function(_0xf7cfca){return _0xf7cfca?{'count':_0x473e2c,'rows':_0xf7cfca}:null;})[_0xc542('0x2d')](respondWithResult(_0x3966bf,null))[_0xc542('0x58')](handleError(_0x3966bf,null));};exports['getLists']=function(_0x10b07c,_0x3faf06,_0xc850f1){var _0x17f04b={};var _0x180af7={};var _0x48fbe2;var _0x295025;return db[_0xc542('0x41')]['findOne']({'where':{'id':_0x10b07c[_0xc542('0x63')]['id']}})[_0xc542('0x2d')](handleEntityNotFound(_0x3faf06,null))[_0xc542('0x2d')](function(_0x5b3d7b){if(_0x5b3d7b){_0x48fbe2=_0x5b3d7b;_0x180af7[_0xc542('0x44')]=_[_0xc542('0x46')](db[_0xc542('0xa2')][_0xc542('0x55')]);_0x180af7[_0xc542('0x45')]=_[_0xc542('0x46')](_0x10b07c[_0xc542('0x45')]);_0x180af7[_0xc542('0x4f')]=_[_0xc542('0x47')](_0x180af7['model'],_0x180af7[_0xc542('0x45')]);_0x17f04b[_0xc542('0x48')]=_[_0xc542('0x47')](_0x180af7[_0xc542('0x44')],qs[_0xc542('0x49')](_0x10b07c[_0xc542('0x45')]['fields']));_0x17f04b[_0xc542('0x48')]=_0x17f04b[_0xc542('0x48')]['length']?_0x17f04b[_0xc542('0x48')]:_0x180af7[_0xc542('0x44')];_0x17f04b[_0xc542('0x4c')]=qs[_0xc542('0x4d')](_0x10b07c[_0xc542('0x45')][_0xc542('0x4d')]);_0x17f04b['where']=qs['filters'](_[_0xc542('0x68')](_0x10b07c[_0xc542('0x45')],_0x180af7[_0xc542('0x4f')]));if(_0x10b07c['query'][_0xc542('0x34')]){_0x17f04b[_0xc542('0x4e')]=_[_0xc542('0x50')](_0x17f04b[_0xc542('0x4e')],{'$or':_[_0xc542('0x36')](_0x17f04b[_0xc542('0x48')],function(_0x82e0b2){var _0x5ca1b2={};_0x5ca1b2[_0x82e0b2]={'$like':'%'+_0x10b07c[_0xc542('0x45')]['filter']+'%'};return _0x5ca1b2;})});}_0x17f04b=_[_0xc542('0x50')]({},_0x17f04b,_0x10b07c['options']);return _0x48fbe2[_0xc542('0xa3')](_0x17f04b);}})[_0xc542('0x2d')](function(_0x129d74){if(_0x129d74){_0x295025=_0x129d74[_0xc542('0x4a')];if(!_0x10b07c['query'][_0xc542('0x4b')](_0xc542('0x6d'))){_0x17f04b[_0xc542('0x24')]=qs[_0xc542('0x24')](_0x10b07c['query'][_0xc542('0x24')]);_0x17f04b[_0xc542('0x23')]=qs[_0xc542('0x23')](_0x10b07c[_0xc542('0x45')][_0xc542('0x23')]);}return _0x48fbe2[_0xc542('0xa3')](_0x17f04b);}})[_0xc542('0x2d')](function(_0xc04cad){if(_0xc04cad){return _0xc04cad?{'count':_0x295025,'rows':_0xc04cad}:null;}})[_0xc542('0x2d')](respondWithResult(_0x3faf06,null))[_0xc542('0x58')](handleError(_0x3faf06,null));};exports['addLists']=function(_0x541e1c,_0x13e478,_0x383122){var _0x337f1c,_0xbb9fe8;return db[_0xc542('0x41')]['find']({'where':{'id':_0x541e1c[_0xc542('0x63')]['id']}})[_0xc542('0x2d')](handleEntityNotFound(_0x13e478,null))[_0xc542('0x2d')](function(_0x4dc852){if(_0x4dc852){_0xbb9fe8=_0x4dc852;return _0x4dc852[_0xc542('0xa4')](_0x541e1c[_0xc542('0x5a')][_0xc542('0x88')],_[_0xc542('0x64')](_0x541e1c[_0xc542('0x5a')],[_0xc542('0x88'),'id'])||{});}return null;})[_0xc542('0x9b')](function(_0x2bae15){var _0xcc006c;_0x337f1c=_0x2bae15||[];var _0x436d54=[];if(_0x2bae15){for(var _0x2cf566=0x0;_0x2cf566<_0x2bae15['length'];_0x2cf566+=0x1){var _0x3f1e16=_0x2bae15[_0x2cf566][_0xc542('0x2f')]({'plain':!![]});_0xbb9fe8[_0xc542('0xa5')]=_0x541e1c[_0xc542('0x5a')][_0xc542('0xa5')]?_0x541e1c[_0xc542('0x5a')][_0xc542('0xa5')]:_0xbb9fe8[_0xc542('0xa5')];switch(_0xbb9fe8[_0xc542('0xa5')]){case _0xc542('0xa6'):_0xcc006c=squel['insert']()['into']('cm_hopper')[_0xc542('0xa7')]([_0xc542('0xa8'),_0xc542('0xa9'),'ContactId','ListId',_0xc542('0x69'),'createdAt',_0xc542('0x66')],squel[_0xc542('0xaa')]()[_0xc542('0x8a')](_0xc542('0xa8'),'phone')[_0xc542('0x8a')]('NOW()',_0xc542('0xa9'))[_0xc542('0x8a')]('id',_0xc542('0xab'))[_0xc542('0x8a')](_0x3f1e16[_0xc542('0xac')][_0xc542('0x92')](),_0xc542('0xad'))[_0xc542('0x8a')](_0x541e1c[_0xc542('0x63')]['id'][_0xc542('0x92')](),'VoiceQueueId')[_0xc542('0x8a')](_0xc542('0xae'),_0xc542('0x65'))[_0xc542('0x8a')](_0xc542('0xae'),_0xc542('0x66'))[_0xc542('0x8b')]('cm_contacts')[_0xc542('0x4e')](_0xc542('0xaf'))[_0xc542('0x4e')](_0xc542('0xb0'),_0x3f1e16[_0xc542('0xac')][_0xc542('0x92')]())[_0xc542('0x4e')]('phone\x20IS\x20NOT\x20NULL')[_0xc542('0x4e')]('phone\x20NOT\x20IN\x20(?)',squel[_0xc542('0xaa')]()[_0xc542('0x8a')](_0xc542('0xb1'))[_0xc542('0x8b')](_0xc542('0xb2'))[_0xc542('0x4e')](_0xc542('0x8f'),_0x541e1c['params']['id'][_0xc542('0x92')]()))[_0xc542('0x4e')]('phone\x20NOT\x20IN\x20(?)',squel[_0xc542('0xaa')]()[_0xc542('0x8a')](_0xc542('0xb3'))[_0xc542('0x8b')]('cm_hopper')[_0xc542('0x4e')](_0xc542('0x8f'),_0x541e1c['params']['id'][_0xc542('0x92')]())))[_0xc542('0x92')]();break;case _0xc542('0xb4'):_0xcc006c=squel[_0xc542('0xb5')]()[_0xc542('0xb6')]('cm_hopper')[_0xc542('0xa7')]([_0xc542('0xa8'),_0xc542('0xa9'),_0xc542('0xab'),_0xc542('0xad'),_0xc542('0x69'),'createdAt',_0xc542('0x66')],squel[_0xc542('0xaa')]()[_0xc542('0x8a')](_0xc542('0xa8'),_0xc542('0xa8'))['field'](_0xc542('0xae'),_0xc542('0xa9'))[_0xc542('0x8a')]('id','ContactId')[_0xc542('0x8a')](_0x3f1e16[_0xc542('0xac')][_0xc542('0x92')](),_0xc542('0xad'))[_0xc542('0x8a')](_0x541e1c['params']['id'][_0xc542('0x92')](),_0xc542('0x69'))[_0xc542('0x8a')]('NOW()',_0xc542('0x65'))[_0xc542('0x8a')]('NOW()',_0xc542('0x66'))[_0xc542('0x8b')](_0xc542('0xb7'))[_0xc542('0x4e')](_0xc542('0xaf'))[_0xc542('0x4e')](_0xc542('0xb0'),_0x3f1e16[_0xc542('0xac')][_0xc542('0x92')]())[_0xc542('0x4e')]('phone\x20IS\x20NOT\x20NULL')[_0xc542('0x4e')](_0xc542('0xb8'),squel[_0xc542('0xaa')]()[_0xc542('0x8a')](_0xc542('0xb3'))[_0xc542('0x8b')]('cm_hopper')['where'](_0xc542('0x8f'),_0x541e1c[_0xc542('0x63')]['id']['toString']())))[_0xc542('0x92')]();break;default:_0xcc006c=squel[_0xc542('0xb5')]()['into'](_0xc542('0xb9'))[_0xc542('0xa7')]([_0xc542('0xa8'),_0xc542('0xa9'),_0xc542('0xab'),_0xc542('0xad'),_0xc542('0x69'),_0xc542('0x65'),_0xc542('0x66')],squel['select']()[_0xc542('0x8a')](_0xc542('0xa8'),_0xc542('0xa8'))[_0xc542('0x8a')](_0xc542('0xae'),_0xc542('0xa9'))['field']('id',_0xc542('0xab'))[_0xc542('0x8a')](_0x3f1e16[_0xc542('0xac')][_0xc542('0x92')](),'ListId')[_0xc542('0x8a')](_0x541e1c[_0xc542('0x63')]['id'][_0xc542('0x92')](),_0xc542('0x69'))['field'](_0xc542('0xae'),_0xc542('0x65'))[_0xc542('0x8a')](_0xc542('0xae'),_0xc542('0x66'))[_0xc542('0x8b')](_0xc542('0xb7'))[_0xc542('0x4e')](_0xc542('0xaf'))['where'](_0xc542('0xb0'),_0x3f1e16[_0xc542('0xac')][_0xc542('0x92')]())[_0xc542('0x4e')](_0xc542('0xba')))[_0xc542('0x92')]();}_0x436d54[_0xc542('0x91')](db[_0xc542('0x7d')][_0xc542('0x45')](_0xcc006c));}return BPromise['all'](_0x436d54);}})[_0xc542('0x2d')](function(){return _0x337f1c;})[_0xc542('0x2d')](respondWithResult(_0x13e478,null))['catch'](handleError(_0x13e478,null));};exports[_0xc542('0xbb')]=function(_0x55269f,_0x45f1a1,_0x246fb6){return db[_0xc542('0x41')][_0xc542('0x3a')]({'where':{'id':_0x55269f[_0xc542('0x63')]['id']}})['then'](handleEntityNotFound(_0x45f1a1,null))[_0xc542('0x2d')](function(_0x52682d){if(_0x52682d){return _0x52682d[_0xc542('0xbb')](_0x55269f[_0xc542('0x45')][_0xc542('0x88')]);}})[_0xc542('0x2d')](function(_0xb5e734){if(_0xb5e734){return db[_0xc542('0x67')]['destroy']({'where':{'ListId':_0x55269f[_0xc542('0x45')][_0xc542('0x88')],'VoiceQueueId':_0x55269f['params']['id']}})[_0xc542('0x2d')](function(){return _0xb5e734;});}})[_0xc542('0x2d')](respondWithStatusCode(_0x45f1a1,null))[_0xc542('0x58')](handleError(_0x45f1a1,null));};exports[_0xc542('0xbc')]=function(_0x2ce094,_0x180c57,_0x3d75a0){var _0x579143={};var _0x13ffa3={};var _0x3e9176;var _0x3b0fd8;return db[_0xc542('0x41')][_0xc542('0x71')]({'where':{'id':_0x2ce094[_0xc542('0x63')]['id']}})['then'](handleEntityNotFound(_0x180c57,null))[_0xc542('0x2d')](function(_0x573e5c){if(_0x573e5c){_0x3e9176=_0x573e5c;_0x13ffa3['model']=_['keys'](db[_0xc542('0xa2')][_0xc542('0x55')]);_0x13ffa3[_0xc542('0x45')]=_[_0xc542('0x46')](_0x2ce094[_0xc542('0x45')]);_0x13ffa3[_0xc542('0x4f')]=_[_0xc542('0x47')](_0x13ffa3['model'],_0x13ffa3[_0xc542('0x45')]);_0x579143[_0xc542('0x48')]=_[_0xc542('0x47')](_0x13ffa3[_0xc542('0x44')],qs['fields'](_0x2ce094[_0xc542('0x45')][_0xc542('0x49')]));_0x579143[_0xc542('0x48')]=_0x579143[_0xc542('0x48')][_0xc542('0x4a')]?_0x579143[_0xc542('0x48')]:_0x13ffa3[_0xc542('0x44')];_0x579143[_0xc542('0x4c')]=qs['sort'](_0x2ce094['query']['sort']);_0x579143['where']=qs[_0xc542('0x4f')](_['pick'](_0x2ce094[_0xc542('0x45')],_0x13ffa3[_0xc542('0x4f')]));if(_0x2ce094[_0xc542('0x45')][_0xc542('0x34')]){_0x579143[_0xc542('0x4e')]=_[_0xc542('0x50')](_0x579143['where'],{'$or':_[_0xc542('0x36')](_0x579143[_0xc542('0x48')],function(_0x3f5fa9){var _0x1cecea={};_0x1cecea[_0x3f5fa9]={'$like':'%'+_0x2ce094['query'][_0xc542('0x34')]+'%'};return _0x1cecea;})});}_0x579143=_['merge']({},_0x579143,_0x2ce094[_0xc542('0x57')]);return _0x3e9176[_0xc542('0xbc')](_0x579143);}})[_0xc542('0x2d')](function(_0x3c38e4){if(_0x3c38e4){_0x3b0fd8=_0x3c38e4[_0xc542('0x4a')];if(!_0x2ce094['query']['hasOwnProperty']('nolimit')){_0x579143[_0xc542('0x24')]=qs[_0xc542('0x24')](_0x2ce094[_0xc542('0x45')][_0xc542('0x24')]);_0x579143[_0xc542('0x23')]=qs['offset'](_0x2ce094[_0xc542('0x45')][_0xc542('0x23')]);}return _0x3e9176[_0xc542('0xbc')](_0x579143);}})[_0xc542('0x2d')](function(_0xa92c3b){if(_0xa92c3b){return _0xa92c3b?{'count':_0x3b0fd8,'rows':_0xa92c3b}:null;}})[_0xc542('0x2d')](respondWithResult(_0x180c57,null))[_0xc542('0x58')](handleError(_0x180c57,null));};exports[_0xc542('0xbd')]=function(_0x2bc9e8,_0x31d82b,_0x4db1ee){var _0xede2d2,_0x1d1aa6;return db['VoiceQueue'][_0xc542('0x3a')]({'where':{'id':_0x2bc9e8[_0xc542('0x63')]['id']}})[_0xc542('0x2d')](handleEntityNotFound(_0x31d82b,null))[_0xc542('0x2d')](function(_0x366eb6){if(_0x366eb6){_0x1d1aa6=_0x366eb6;return _0x366eb6['addBlackLists'](_0x2bc9e8[_0xc542('0x5a')][_0xc542('0x88')],_[_0xc542('0x64')](_0x2bc9e8[_0xc542('0x5a')],[_0xc542('0x88'),'id'])||{});}return null;})[_0xc542('0x9b')](function(_0x2e1a81){var _0x46fb57;_0xede2d2=_0x2e1a81||[];var _0x551227=[];if(_0x2e1a81){for(var _0x27f9bd=0x0;_0x27f9bd<_0x2e1a81[_0xc542('0x4a')];_0x27f9bd+=0x1){var _0x30456f=_0x2e1a81[_0x27f9bd][_0xc542('0x2f')]({'plain':!![]});_0x46fb57=squel[_0xc542('0xb5')]()[_0xc542('0xb6')](_0xc542('0xbe'))['fromQuery']([_0xc542('0xa8'),'ContactId',_0xc542('0xad'),_0xc542('0x69'),_0xc542('0x65'),_0xc542('0x66')],squel[_0xc542('0xaa')]()[_0xc542('0x8a')]('phone',_0xc542('0xa8'))[_0xc542('0x8a')]('id',_0xc542('0xab'))['field'](_0x30456f['CmListId']['toString'](),_0xc542('0xad'))[_0xc542('0x8a')](_0x2bc9e8['params']['id']['toString'](),_0xc542('0x69'))[_0xc542('0x8a')](_0xc542('0xae'),_0xc542('0x65'))['field'](_0xc542('0xae'),_0xc542('0x66'))[_0xc542('0x8b')]('cm_contacts')[_0xc542('0x4e')](_0xc542('0xaf'))[_0xc542('0x4e')]('ListId\x20=\x20?',_0x30456f[_0xc542('0xac')][_0xc542('0x92')]())[_0xc542('0x4e')]('phone\x20IS\x20NOT\x20NULL'))[_0xc542('0x92')]();_0x551227['push'](db[_0xc542('0x7d')][_0xc542('0x45')](_0x46fb57));}return BPromise['all'](_0x551227);}})['then'](function(){return _0xede2d2;})[_0xc542('0x2d')](respondWithResult(_0x31d82b,null))['catch'](handleError(_0x31d82b,null));};exports[_0xc542('0xbf')]=function(_0xa66cad,_0x2f8438,_0x30ca2e){return db[_0xc542('0x41')]['find']({'where':{'id':_0xa66cad[_0xc542('0x63')]['id']}})[_0xc542('0x2d')](handleEntityNotFound(_0x2f8438,null))[_0xc542('0x2d')](function(_0x5e0ccf){if(_0x5e0ccf){return _0x5e0ccf[_0xc542('0xbf')](_0xa66cad[_0xc542('0x45')][_0xc542('0x88')]);}})[_0xc542('0x2d')](function(_0x200d9b){if(_0x200d9b){return db[_0xc542('0x72')][_0xc542('0x2e')]({'where':{'ListId':_0xa66cad['query'][_0xc542('0x88')],'VoiceQueueId':_0xa66cad[_0xc542('0x63')]['id']}})['then'](function(){return _0x200d9b;});}})[_0xc542('0x2d')](respondWithStatusCode(_0x2f8438,null))[_0xc542('0x58')](handleError(_0x2f8438,null));}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index 25c9e61..5a4a7f7 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 _0x65ea=['save','update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb'];(function(_0x108d5f,_0x33f82d){var _0x456ea3=function(_0x228200){while(--_0x228200){_0x108d5f['push'](_0x108d5f['shift']());}};_0x456ea3(++_0x33f82d);}(_0x65ea,0x1b7));var _0xa65e=function(_0x596ebe,_0x53fd6a){_0x596ebe=_0x596ebe-0x0;var _0x4cb7e0=_0x65ea[_0x596ebe];return _0x4cb7e0;};'use strict';var EventEmitter=require('events');var VoiceQueue=require(_0xa65e('0x0'))['db']['VoiceQueue'];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xa65e('0x1'),'afterUpdate':_0xa65e('0x2'),'afterDestroy':_0xa65e('0x3')};function emitEvent(_0x1aaa30){return function(_0x3aeb59,_0x4c5d5b,_0x594efc){VoiceQueueEvents['emit'](_0x1aaa30+':'+_0x3aeb59['id'],_0x3aeb59);VoiceQueueEvents[_0xa65e('0x4')](_0x1aaa30,_0x3aeb59);_0x594efc(null);};}for(var e in events){if(events[_0xa65e('0x5')](e)){var event=events[e];VoiceQueue[_0xa65e('0x6')](e,emitEvent(event));}}module[_0xa65e('0x7')]=VoiceQueueEvents; \ No newline at end of file +var _0xd36a=['remove','emit','hasOwnProperty','exports','events','../../mysqldb','VoiceQueue','update'];(function(_0x2afd92,_0x16fa67){var _0x5ac456=function(_0x2182ed){while(--_0x2182ed){_0x2afd92['push'](_0x2afd92['shift']());}};_0x5ac456(++_0x16fa67);}(_0xd36a,0x124));var _0xad36=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xd36a[_0x14add3];return _0x4a174f;};'use strict';var EventEmitter=require(_0xad36('0x0'));var VoiceQueue=require(_0xad36('0x1'))['db'][_0xad36('0x2')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xad36('0x3'),'afterDestroy':_0xad36('0x4')};function emitEvent(_0x207393){return function(_0x464d47,_0x41789a,_0x396560){VoiceQueueEvents[_0xad36('0x5')](_0x207393+':'+_0x464d47['id'],_0x464d47);VoiceQueueEvents[_0xad36('0x5')](_0x207393,_0x464d47);_0x396560(null);};}for(var e in events){if(events[_0xad36('0x6')](e)){var event=events[e];VoiceQueue['hook'](e,emitEvent(event));}}module[_0xad36('0x7')]=VoiceQueueEvents; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.model.js b/server/api/voiceQueue/voiceQueue.model.js index 0b64075..0d205a7 100644 --- a/server/api/voiceQueue/voiceQueue.model.js +++ b/server/api/voiceQueue/voiceQueue.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x008c=['define','voice_queues','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./voiceQueue.attributes','exports'];(function(_0xd2f4f5,_0x341930){var _0x41fc10=function(_0x496824){while(--_0x496824){_0xd2f4f5['push'](_0xd2f4f5['shift']());}};_0x41fc10(++_0x341930);}(_0x008c,0x188));var _0xc008=function(_0x149c1f,_0x7b4dc6){_0x149c1f=_0x149c1f-0x0;var _0x309eeb=_0x008c[_0x149c1f];return _0x309eeb;};'use strict';var _=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var logger=require(_0xc008('0x2'))(_0xc008('0x3'));var moment=require(_0xc008('0x4'));var BPromise=require('bluebird');var rp=require(_0xc008('0x5'));var fs=require('fs');var path=require(_0xc008('0x6'));var rimraf=require(_0xc008('0x7'));var config=require(_0xc008('0x8'));var attributes=require(_0xc008('0x9'));module[_0xc008('0xa')]=function(_0x13aa7,_0x39bb5e){return _0x13aa7[_0xc008('0xb')]('VoiceQueue',attributes,{'tableName':_0xc008('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x55ca=['./voiceQueue.attributes','exports','define','voice_queues','lodash','util','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x21aec3,_0x5c97e9){var _0x288bbc=function(_0x2283fe){while(--_0x2283fe){_0x21aec3['push'](_0x21aec3['shift']());}};_0x288bbc(++_0x5c97e9);}(_0x55ca,0x126));var _0xa55c=function(_0x5a2db8,_0x409f2a){_0x5a2db8=_0x5a2db8-0x0;var _0x28b4f8=_0x55ca[_0x5a2db8];return _0x28b4f8;};'use strict';var _=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xa55c('0x2'));var rp=require(_0xa55c('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa55c('0x4'));var config=require(_0xa55c('0x5'));var attributes=require(_0xa55c('0x6'));module[_0xa55c('0x7')]=function(_0x3c97c8,_0x279caa){return _0x3c97c8[_0xa55c('0x8')]('VoiceQueue',attributes,{'tableName':_0xa55c('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.rpc.js b/server/api/voiceQueue/voiceQueue.rpc.js index 69c4862..424dc0c 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 _0x130d=['client','http','redis','defaults','localhost','socket.io-emitter','./voiceQueue.socket','info','VoiceQueue,\x20%s,\x20%s','request\x20sent','debug','VoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetVoiceQueue','VoiceQueue','findAll','options','where','include','map','attributes','model','then','ShowVoiceQueue','raw','util','moment','bluebird','randomstring','../../config/logger','jayson/promise'];(function(_0xd576a0,_0x36cc02){var _0x3ff77c=function(_0x149512){while(--_0x149512){_0xd576a0['push'](_0xd576a0['shift']());}};_0x3ff77c(++_0x36cc02);}(_0x130d,0x1aa));var _0xd130=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x130d[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0xd130('0x0'));var moment=require(_0xd130('0x1'));var BPromise=require(_0xd130('0x2'));var rs=require(_0xd130('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xd130('0x4'))('rpc');var config=require('../../config/environment');var jayson=require(_0xd130('0x5'));var client=jayson[_0xd130('0x6')][_0xd130('0x7')]({'port':0x232a});config[_0xd130('0x8')]=_[_0xd130('0x9')](config[_0xd130('0x8')],{'host':_0xd130('0xa'),'port':0x18eb});var socket=require(_0xd130('0xb'))(new Redis(config[_0xd130('0x8')]));require(_0xd130('0xc'))['register'](socket);function respondWithRpcPromise(_0x5abf1e,_0x5ee249,_0x5d504d){return new BPromise(function(_0x35706a,_0x16e123){return client['request'](_0x5abf1e,_0x5d504d)['then'](function(_0x15ec25){logger[_0xd130('0xd')](_0xd130('0xe'),_0x5ee249,_0xd130('0xf'));logger[_0xd130('0x10')](_0xd130('0x11'),_0x5ee249,_0xd130('0xf'),JSON[_0xd130('0x12')](_0x15ec25));if(_0x15ec25[_0xd130('0x13')]){if(_0x15ec25[_0xd130('0x13')][_0xd130('0x14')]===0x1f4){logger[_0xd130('0x13')](_0xd130('0xe'),_0x5ee249,_0x15ec25[_0xd130('0x13')]['message']);return _0x16e123(_0x15ec25[_0xd130('0x13')][_0xd130('0x15')]);}logger[_0xd130('0x13')](_0xd130('0xe'),_0x5ee249,_0x15ec25[_0xd130('0x13')]['message']);return _0x35706a(_0x15ec25[_0xd130('0x13')]['message']);}else{logger['info'](_0xd130('0xe'),_0x5ee249,_0xd130('0xf'));_0x35706a(_0x15ec25[_0xd130('0x16')][_0xd130('0x15')]);}})[_0xd130('0x17')](function(_0xc79441){logger['error']('VoiceQueue,\x20%s,\x20%s',_0x5ee249,_0xc79441);_0x16e123(_0xc79441);});});}exports[_0xd130('0x18')]=function(_0x7d3bd7){var _0x500b45=this;return new Promise(function(_0x27a0cb,_0x53b9d3){return db[_0xd130('0x19')][_0xd130('0x1a')]({'raw':_0x7d3bd7['options']?_0x7d3bd7[_0xd130('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x7d3bd7[_0xd130('0x1b')]?_0x7d3bd7[_0xd130('0x1b')][_0xd130('0x1c')]||null:null,'attributes':_0x7d3bd7[_0xd130('0x1b')]?_0x7d3bd7[_0xd130('0x1b')]['attributes']||null:null,'limit':_0x7d3bd7['options']?_0x7d3bd7[_0xd130('0x1b')]['limit']||null:null,'include':_0x7d3bd7[_0xd130('0x1b')]?_0x7d3bd7[_0xd130('0x1b')][_0xd130('0x1d')]?_[_0xd130('0x1e')](_0x7d3bd7[_0xd130('0x1b')]['include'],function(_0x68fe73){return{'model':db[_0x68fe73['model']],'as':_0x68fe73['as'],'attributes':_0x68fe73[_0xd130('0x1f')],'include':_0x68fe73[_0xd130('0x1d')]?_[_0xd130('0x1e')](_0x68fe73[_0xd130('0x1d')],function(_0x5ebd7d){return{'model':db[_0x5ebd7d[_0xd130('0x20')]],'as':_0x5ebd7d['as'],'attributes':_0x5ebd7d[_0xd130('0x1f')],'include':_0x5ebd7d['include']?_['map'](_0x5ebd7d[_0xd130('0x1d')],function(_0x3a3c85){return{'model':db[_0x3a3c85[_0xd130('0x20')]],'as':_0x3a3c85['as'],'attributes':_0x3a3c85[_0xd130('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xd130('0x21')](function(_0x41fb99){logger[_0xd130('0xd')](_0xd130('0x18'),_0x7d3bd7);logger[_0xd130('0x10')](_0xd130('0x18'),_0x7d3bd7,JSON['stringify'](_0x41fb99));_0x27a0cb(_0x41fb99);})['catch'](function(_0x56fc7a){logger[_0xd130('0x13')](_0xd130('0x18'),_0x56fc7a['message'],_0x7d3bd7);_0x53b9d3(_0x500b45[_0xd130('0x13')](0x1f4,_0x56fc7a['message']));});});};exports[_0xd130('0x22')]=function(_0x244508){var _0x599c23=this;return new Promise(function(_0x26acbb,_0x41789c){return db[_0xd130('0x19')]['find']({'raw':_0x244508[_0xd130('0x1b')]?_0x244508[_0xd130('0x1b')][_0xd130('0x23')]===undefined?!![]:![]:!![],'where':_0x244508[_0xd130('0x1b')]?_0x244508[_0xd130('0x1b')][_0xd130('0x1c')]||null:null,'attributes':_0x244508[_0xd130('0x1b')]?_0x244508[_0xd130('0x1b')][_0xd130('0x1f')]||null:null,'include':_0x244508[_0xd130('0x1b')]?_0x244508[_0xd130('0x1b')]['include']?_[_0xd130('0x1e')](_0x244508[_0xd130('0x1b')][_0xd130('0x1d')],function(_0x1cb49c){return{'model':db[_0x1cb49c[_0xd130('0x20')]],'as':_0x1cb49c['as'],'attributes':_0x1cb49c[_0xd130('0x1f')],'include':_0x1cb49c[_0xd130('0x1d')]?_[_0xd130('0x1e')](_0x1cb49c[_0xd130('0x1d')],function(_0x3b2205){return{'model':db[_0x3b2205[_0xd130('0x20')]],'as':_0x3b2205['as'],'attributes':_0x3b2205[_0xd130('0x1f')],'include':_0x3b2205['include']?_[_0xd130('0x1e')](_0x3b2205[_0xd130('0x1d')],function(_0x241073){return{'model':db[_0x241073[_0xd130('0x20')]],'as':_0x241073['as'],'attributes':_0x241073[_0xd130('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xd130('0x21')](function(_0xdefd56){logger[_0xd130('0xd')](_0xd130('0x22'),_0x244508);logger[_0xd130('0x10')](_0xd130('0x22'),_0x244508,JSON[_0xd130('0x12')](_0xdefd56));_0x26acbb(_0xdefd56);})[_0xd130('0x17')](function(_0xb9b0c9){logger[_0xd130('0x13')](_0xd130('0x22'),_0xb9b0c9[_0xd130('0x15')],_0x244508);_0x41789c(_0x599c23[_0xd130('0x13')](0x1f4,_0xb9b0c9[_0xd130('0x15')]));});});}; \ No newline at end of file +var _0xdddd=['lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','defaults','localhost','socket.io-emitter','redis','./voiceQueue.socket','request','info','VoiceQueue,\x20%s,\x20%s','request\x20sent','debug','VoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetVoiceQueue','VoiceQueue','findAll','options','raw','where','limit','include','map','model','attributes','ShowVoiceQueue','then'];(function(_0xaf025d,_0x586d7a){var _0x1c77cb=function(_0x560b3a){while(--_0x560b3a){_0xaf025d['push'](_0xaf025d['shift']());}};_0x1c77cb(++_0x586d7a);}(_0xdddd,0x17a));var _0xdddd=function(_0x5416db,_0x55683a){_0x5416db=_0x5416db-0x0;var _0x243e35=_0xdddd[_0x5416db];return _0x243e35;};'use strict';var _=require(_0xdddd('0x0'));var util=require(_0xdddd('0x1'));var moment=require(_0xdddd('0x2'));var BPromise=require(_0xdddd('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xdddd('0x4'));var db=require(_0xdddd('0x5'))['db'];var utils=require(_0xdddd('0x6'));var logger=require(_0xdddd('0x7'))(_0xdddd('0x8'));var config=require(_0xdddd('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xdddd('0xa')][_0xdddd('0xb')]({'port':0x232a});config['redis']=_[_0xdddd('0xc')](config['redis'],{'host':_0xdddd('0xd'),'port':0x18eb});var socket=require(_0xdddd('0xe'))(new Redis(config[_0xdddd('0xf')]));require(_0xdddd('0x10'))['register'](socket);function respondWithRpcPromise(_0x29bacb,_0x17eaa6,_0x483466){return new BPromise(function(_0x17f5c4,_0x37e92f){return client[_0xdddd('0x11')](_0x29bacb,_0x483466)['then'](function(_0x41113d){logger[_0xdddd('0x12')](_0xdddd('0x13'),_0x17eaa6,_0xdddd('0x14'));logger[_0xdddd('0x15')](_0xdddd('0x16'),_0x17eaa6,_0xdddd('0x14'),JSON[_0xdddd('0x17')](_0x41113d));if(_0x41113d['error']){if(_0x41113d[_0xdddd('0x18')][_0xdddd('0x19')]===0x1f4){logger[_0xdddd('0x18')]('VoiceQueue,\x20%s,\x20%s',_0x17eaa6,_0x41113d['error'][_0xdddd('0x1a')]);return _0x37e92f(_0x41113d['error'][_0xdddd('0x1a')]);}logger[_0xdddd('0x18')]('VoiceQueue,\x20%s,\x20%s',_0x17eaa6,_0x41113d['error']['message']);return _0x17f5c4(_0x41113d[_0xdddd('0x18')][_0xdddd('0x1a')]);}else{logger[_0xdddd('0x12')]('VoiceQueue,\x20%s,\x20%s',_0x17eaa6,_0xdddd('0x14'));_0x17f5c4(_0x41113d[_0xdddd('0x1b')][_0xdddd('0x1a')]);}})[_0xdddd('0x1c')](function(_0x5023d5){logger['error']('VoiceQueue,\x20%s,\x20%s',_0x17eaa6,_0x5023d5);_0x37e92f(_0x5023d5);});});}exports[_0xdddd('0x1d')]=function(_0x2e981c){var _0x31506e=this;return new Promise(function(_0x1445a8,_0x4b67f0){return db[_0xdddd('0x1e')][_0xdddd('0x1f')]({'raw':_0x2e981c[_0xdddd('0x20')]?_0x2e981c[_0xdddd('0x20')][_0xdddd('0x21')]===undefined?!![]:![]:!![],'where':_0x2e981c[_0xdddd('0x20')]?_0x2e981c[_0xdddd('0x20')][_0xdddd('0x22')]||null:null,'attributes':_0x2e981c[_0xdddd('0x20')]?_0x2e981c[_0xdddd('0x20')]['attributes']||null:null,'limit':_0x2e981c['options']?_0x2e981c[_0xdddd('0x20')][_0xdddd('0x23')]||null:null,'include':_0x2e981c['options']?_0x2e981c[_0xdddd('0x20')][_0xdddd('0x24')]?_[_0xdddd('0x25')](_0x2e981c['options'][_0xdddd('0x24')],function(_0x4d052f){return{'model':db[_0x4d052f[_0xdddd('0x26')]],'as':_0x4d052f['as'],'attributes':_0x4d052f[_0xdddd('0x27')],'include':_0x4d052f['include']?_[_0xdddd('0x25')](_0x4d052f[_0xdddd('0x24')],function(_0x1cf2f2){return{'model':db[_0x1cf2f2['model']],'as':_0x1cf2f2['as'],'attributes':_0x1cf2f2[_0xdddd('0x27')],'include':_0x1cf2f2['include']?_[_0xdddd('0x25')](_0x1cf2f2[_0xdddd('0x24')],function(_0x59cf74){return{'model':db[_0x59cf74[_0xdddd('0x26')]],'as':_0x59cf74['as'],'attributes':_0x59cf74[_0xdddd('0x27')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xd9685f){logger[_0xdddd('0x12')](_0xdddd('0x1d'),_0x2e981c);logger[_0xdddd('0x15')](_0xdddd('0x1d'),_0x2e981c,JSON['stringify'](_0xd9685f));_0x1445a8(_0xd9685f);})[_0xdddd('0x1c')](function(_0x1d0904){logger[_0xdddd('0x18')](_0xdddd('0x1d'),_0x1d0904['message'],_0x2e981c);_0x4b67f0(_0x31506e[_0xdddd('0x18')](0x1f4,_0x1d0904[_0xdddd('0x1a')]));});});};exports[_0xdddd('0x28')]=function(_0x5388e8){var _0x47d056=this;return new Promise(function(_0x2b73f3,_0x3be253){return db[_0xdddd('0x1e')]['find']({'raw':_0x5388e8[_0xdddd('0x20')]?_0x5388e8['options'][_0xdddd('0x21')]===undefined?!![]:![]:!![],'where':_0x5388e8[_0xdddd('0x20')]?_0x5388e8['options'][_0xdddd('0x22')]||null:null,'attributes':_0x5388e8[_0xdddd('0x20')]?_0x5388e8['options']['attributes']||null:null,'include':_0x5388e8['options']?_0x5388e8[_0xdddd('0x20')]['include']?_['map'](_0x5388e8[_0xdddd('0x20')][_0xdddd('0x24')],function(_0x3d5a84){return{'model':db[_0x3d5a84[_0xdddd('0x26')]],'as':_0x3d5a84['as'],'attributes':_0x3d5a84[_0xdddd('0x27')],'include':_0x3d5a84[_0xdddd('0x24')]?_[_0xdddd('0x25')](_0x3d5a84['include'],function(_0x418958){return{'model':db[_0x418958['model']],'as':_0x418958['as'],'attributes':_0x418958[_0xdddd('0x27')],'include':_0x418958['include']?_[_0xdddd('0x25')](_0x418958[_0xdddd('0x24')],function(_0x491b93){return{'model':db[_0x491b93[_0xdddd('0x26')]],'as':_0x491b93['as'],'attributes':_0x491b93[_0xdddd('0x27')]};}):[]};}):[]};}):[]:[]})[_0xdddd('0x29')](function(_0x4b031f){logger[_0xdddd('0x12')](_0xdddd('0x28'),_0x5388e8);logger[_0xdddd('0x15')](_0xdddd('0x28'),_0x5388e8,JSON[_0xdddd('0x17')](_0x4b031f));_0x2b73f3(_0x4b031f);})[_0xdddd('0x1c')](function(_0x462c20){logger[_0xdddd('0x18')](_0xdddd('0x28'),_0x462c20[_0xdddd('0x1a')],_0x5388e8);_0x3be253(_0x47d056['error'](0x1f4,_0x462c20[_0xdddd('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index 21ccad6..04897ea 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 _0x637a=['length','voiceQueue:','./voiceQueue.events','save','remove','update','emit','register'];(function(_0x39f3b9,_0xce6411){var _0x1f141f=function(_0x9c15aa){while(--_0x9c15aa){_0x39f3b9['push'](_0x39f3b9['shift']());}};_0x1f141f(++_0xce6411);}(_0x637a,0xfa));var _0xa637=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x637a[_0x501510];return _0x1e6ee5;};'use strict';var VoiceQueueEvents=require(_0xa637('0x0'));var events=[_0xa637('0x1'),_0xa637('0x2'),_0xa637('0x3')];function createListener(_0x57673a,_0x4f3515){return function(_0x258472){_0x4f3515[_0xa637('0x4')](_0x57673a,_0x258472);};}function removeListener(_0xbd7eb0,_0x50939e){return function(){VoiceQueueEvents['removeListener'](_0xbd7eb0,_0x50939e);};}exports[_0xa637('0x5')]=function(_0xa8e087){for(var _0x35519d=0x0,_0x8d03ff=events[_0xa637('0x6')];_0x35519d<_0x8d03ff;_0x35519d++){var _0x1af670=events[_0x35519d];var _0x55c57a=createListener(_0xa637('0x7')+_0x1af670,_0xa8e087);VoiceQueueEvents['on'](_0x1af670,_0x55c57a);}}; \ No newline at end of file +var _0x29c8=['removeListener','register','length','voiceQueue:','./voiceQueue.events','save','update','emit'];(function(_0x7c8cb6,_0x2ea888){var _0xc86e95=function(_0x17d4ce){while(--_0x17d4ce){_0x7c8cb6['push'](_0x7c8cb6['shift']());}};_0xc86e95(++_0x2ea888);}(_0x29c8,0x84));var _0x829c=function(_0x2953b5,_0x304a99){_0x2953b5=_0x2953b5-0x0;var _0x3f622c=_0x29c8[_0x2953b5];return _0x3f622c;};'use strict';var VoiceQueueEvents=require(_0x829c('0x0'));var events=[_0x829c('0x1'),'remove',_0x829c('0x2')];function createListener(_0x61ce34,_0x5a804f){return function(_0x94988c){_0x5a804f[_0x829c('0x3')](_0x61ce34,_0x94988c);};}function removeListener(_0x19908f,_0x23c112){return function(){VoiceQueueEvents[_0x829c('0x4')](_0x19908f,_0x23c112);};}exports[_0x829c('0x5')]=function(_0x437d02){for(var _0x38c93d=0x0,_0x4c9455=events[_0x829c('0x6')];_0x38c93d<_0x4c9455;_0x38c93d++){var _0x2cebe1=events[_0x38c93d];var _0x5c2b73=createListener(_0x829c('0x7')+_0x2cebe1,_0x437d02);VoiceQueueEvents['on'](_0x2cebe1,_0x5c2b73);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index acf774c..99fd8ec 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 _0xec87=['/index','show','post','create','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueueReport.controller','index','get','isAuthenticated','describe'];(function(_0x3404b2,_0x1a0c3f){var _0x340e31=function(_0x2cca4f){while(--_0x2cca4f){_0x3404b2['push'](_0x3404b2['shift']());}};_0x340e31(++_0x1a0c3f);}(_0xec87,0xc1));var _0x7ec8=function(_0x367336,_0x18c229){_0x367336=_0x367336-0x0;var _0x3423a7=_0xec87[_0x367336];return _0x3423a7;};'use strict';var multer=require(_0x7ec8('0x0'));var util=require(_0x7ec8('0x1'));var path=require(_0x7ec8('0x2'));var timeout=require(_0x7ec8('0x3'));var express=require(_0x7ec8('0x4'));var router=express['Router']();var fs_extra=require(_0x7ec8('0x5'));var auth=require(_0x7ec8('0x6'));var interaction=require(_0x7ec8('0x7'));var config=require(_0x7ec8('0x8'));var controller=require(_0x7ec8('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x7ec8('0xa')]);router[_0x7ec8('0xb')]('/describe',auth[_0x7ec8('0xc')](),controller[_0x7ec8('0xd')]);router[_0x7ec8('0xb')](_0x7ec8('0xe'),auth[_0x7ec8('0xc')](),controller['getVoiceQueuesReport']);router['get']('/:id',auth[_0x7ec8('0xc')](),controller[_0x7ec8('0xf')]);router[_0x7ec8('0x10')]('/',auth[_0x7ec8('0xc')](),controller[_0x7ec8('0x11')]);router['put'](_0x7ec8('0x12'),auth[_0x7ec8('0xc')](),controller[_0x7ec8('0x13')]);router[_0x7ec8('0x14')](_0x7ec8('0x12'),auth[_0x7ec8('0xc')](),controller[_0x7ec8('0x15')]);module[_0x7ec8('0x16')]=router; \ No newline at end of file +var _0xa6d5=['/describe','describe','/index','getVoiceQueuesReport','post','create','update','/:id','destroy','exports','util','path','Router','fs-extra','../../components/interaction/service','./voiceQueueReport.controller','get','isAuthenticated','index'];(function(_0x19053c,_0x16cc1f){var _0x177c4c=function(_0xb9f21f){while(--_0xb9f21f){_0x19053c['push'](_0x19053c['shift']());}};_0x177c4c(++_0x16cc1f);}(_0xa6d5,0x1ac));var _0x5a6d=function(_0x5ed233,_0xb69f5e){_0x5ed233=_0x5ed233-0x0;var _0x486f78=_0xa6d5[_0x5ed233];return _0x486f78;};'use strict';var multer=require('multer');var util=require(_0x5a6d('0x0'));var path=require(_0x5a6d('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x5a6d('0x2')]();var fs_extra=require(_0x5a6d('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x5a6d('0x4'));var config=require('../../config/environment');var controller=require(_0x5a6d('0x5'));router[_0x5a6d('0x6')]('/',auth[_0x5a6d('0x7')](),controller[_0x5a6d('0x8')]);router[_0x5a6d('0x6')](_0x5a6d('0x9'),auth[_0x5a6d('0x7')](),controller[_0x5a6d('0xa')]);router['get'](_0x5a6d('0xb'),auth['isAuthenticated'](),controller[_0x5a6d('0xc')]);router['get']('/:id',auth[_0x5a6d('0x7')](),controller['show']);router[_0x5a6d('0xd')]('/',auth[_0x5a6d('0x7')](),controller[_0x5a6d('0xe')]);router['put']('/:id',auth[_0x5a6d('0x7')](),controller[_0x5a6d('0xf')]);router['delete'](_0x5a6d('0x10'),auth[_0x5a6d('0x7')](),controller[_0x5a6d('0x11')]);module[_0x5a6d('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.attributes.js b/server/api/voiceQueueReport/voiceQueueReport.attributes.js index 4db9b27..253445b 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 _0xdfd7=['BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','sequelize','exports','STRING','DATE','getDataValue','YYYY-MM-DD\x20HH:mm:ss','seconds','setDataValue','queuecallerleaveAt','INTEGER'];(function(_0x458ed6,_0x504646){var _0xa5dfd9=function(_0x504e7b){while(--_0x504e7b){_0x458ed6['push'](_0x458ed6['shift']());}};_0xa5dfd9(++_0x504646);}(_0xdfd7,0x1a6));var _0x7dfd=function(_0x1b4c1e,_0x562c41){_0x1b4c1e=_0x1b4c1e-0x0;var _0x548433=_0xdfd7[_0x1b4c1e];return _0x548433;};'use strict';var Sequelize=require(_0x7dfd('0x0'));var moment=require('moment');module[_0x7dfd('0x1')]={'type':{'type':Sequelize[_0x7dfd('0x2')]},'uniqueid':{'type':Sequelize[_0x7dfd('0x2')]},'calleridnum':{'type':Sequelize[_0x7dfd('0x2')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x7dfd('0x2')]},'queuecallerjoinAt':{'type':Sequelize[_0x7dfd('0x3')]},'queuecallerleaveAt':{'type':Sequelize[_0x7dfd('0x3')],'set':function(_0xc9495f){var _0xc1863f=moment(_0xc9495f);var _0x5863c3=moment(this[_0x7dfd('0x4')]('queuecallerjoinAt'))['format'](_0x7dfd('0x5'));var _0x414129=_0xc1863f['diff'](_0x5863c3,_0x7dfd('0x6'));this[_0x7dfd('0x7')](_0x7dfd('0x8'),_0xc9495f);this[_0x7dfd('0x7')]('holdtime',_0x414129||null);}},'position':{'type':Sequelize[_0x7dfd('0x9')]},'count':{'type':Sequelize['INTEGER']},'queuecallerabandon':{'type':Sequelize[_0x7dfd('0xa')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize['DATE']},'queuecallercomplete':{'type':Sequelize[_0x7dfd('0xa')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize['DATE']},'queuecallerexit':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize['DATE']},'queuecallerexitreason':{'type':Sequelize[_0x7dfd('0x2')],'comment':_0x7dfd('0xb')},'originalposition':{'type':Sequelize['INTEGER']},'channel':{'type':Sequelize[_0x7dfd('0x2')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0x7dfd('0x2')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x7dfd('0x2')]},'priority':{'type':Sequelize[_0x7dfd('0x2')]},'holdtime':{'type':Sequelize[_0x7dfd('0x9')]},'mohtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x7dfd('0xa')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x7dfd('0x2')]},'transfer':{'type':Sequelize[_0x7dfd('0xa')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x7dfd('0x2')],'comment':'FORWARD,\x20BLIND,\x20ATTENDED'},'transferexten':{'type':Sequelize[_0x7dfd('0x2')]},'transferuniqueid':{'type':Sequelize[_0x7dfd('0x2')]},'disposition':{'type':Sequelize[_0x7dfd('0x2')]},'secondDisposition':{'type':Sequelize[_0x7dfd('0x2')]},'thirdDisposition':{'type':Sequelize['STRING']},'queuecallerenterreason':{'type':Sequelize[_0x7dfd('0x9')],'defaultValue':0x0}}; \ No newline at end of file +var _0x6733=['DATE','getDataValue','format','YYYY-MM-DD\x20HH:mm:ss','seconds','setDataValue','queuecallerleaveAt','INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','moment','exports','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6733,0x176));var _0x3673=function(_0x321e41,_0x471c01){_0x321e41=_0x321e41-0x0;var _0x2f5c46=_0x6733[_0x321e41];return _0x2f5c46;};'use strict';var Sequelize=require(_0x3673('0x0'));var moment=require(_0x3673('0x1'));module[_0x3673('0x2')]={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x3673('0x3')]},'calleridnum':{'type':Sequelize[_0x3673('0x3')]},'calleridname':{'type':Sequelize[_0x3673('0x3')]},'queue':{'type':Sequelize[_0x3673('0x3')]},'queuecallerjoinAt':{'type':Sequelize[_0x3673('0x4')]},'queuecallerleaveAt':{'type':Sequelize[_0x3673('0x4')],'set':function(_0xe0a46a){var _0x4f5705=moment(_0xe0a46a);var _0x11e9b8=moment(this[_0x3673('0x5')]('queuecallerjoinAt'))[_0x3673('0x6')](_0x3673('0x7'));var _0x3c10dc=_0x4f5705['diff'](_0x11e9b8,_0x3673('0x8'));this[_0x3673('0x9')](_0x3673('0xa'),_0xe0a46a);this['setDataValue']('holdtime',_0x3c10dc||null);}},'position':{'type':Sequelize[_0x3673('0xb')]},'count':{'type':Sequelize[_0x3673('0xb')]},'queuecallerabandon':{'type':Sequelize[_0x3673('0xc')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize['DATE']},'queuecallercomplete':{'type':Sequelize[_0x3673('0xc')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x3673('0x4')]},'queuecallerexit':{'type':Sequelize[_0x3673('0xc')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x3673('0x4')]},'queuecallerexitreason':{'type':Sequelize[_0x3673('0x3')],'comment':'COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT'},'originalposition':{'type':Sequelize[_0x3673('0xb')]},'channel':{'type':Sequelize[_0x3673('0x3')]},'connectedlinenum':{'type':Sequelize[_0x3673('0x3')]},'connectedlinename':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x3673('0x3')]},'context':{'type':Sequelize[_0x3673('0x3')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x3673('0x3')]},'holdtime':{'type':Sequelize[_0x3673('0xb')]},'mohtime':{'type':Sequelize[_0x3673('0xb')],'defaultValue':0x0},'assigned':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize['STRING']},'transfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transfertype':{'type':Sequelize['STRING'],'comment':_0x3673('0xd')},'transferexten':{'type':Sequelize[_0x3673('0x3')]},'transferuniqueid':{'type':Sequelize[_0x3673('0x3')]},'disposition':{'type':Sequelize[_0x3673('0x3')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x3673('0x3')]},'queuecallerenterreason':{'type':Sequelize[_0x3673('0xb')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.controller.js b/server/api/voiceQueueReport/voiceQueueReport.controller.js index 188dcae..3ea278c 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 _0xa8fb=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','end','error','stack','name','send','index','VoiceQueueReport','rawAttributes','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','map','merge','options','include','findAll','catch','params','keys','find','create','body','describe','getVoiceQueuesReport','pick','includeAll','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis'];(function(_0x1ba3f0,_0x3b220d){var _0x53064d=function(_0x4ac6e3){while(--_0x4ac6e3){_0x1ba3f0['push'](_0x1ba3f0['shift']());}};_0x53064d(++_0x3b220d);}(_0xa8fb,0x137));var _0xba8f=function(_0x4ae6ef,_0xc2af80){_0x4ae6ef=_0x4ae6ef-0x0;var _0x3cbb4e=_0xa8fb[_0x4ae6ef];return _0x3cbb4e;};'use strict';var emlformat=require(_0xba8f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xba8f('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xba8f('0x2'));var moment=require(_0xba8f('0x3'));var BPromise=require(_0xba8f('0x4'));var Mustache=require(_0xba8f('0x5'));var util=require(_0xba8f('0x6'));var path=require(_0xba8f('0x7'));var sox=require('sox');var csv=require(_0xba8f('0x8'));var ejs=require(_0xba8f('0x9'));var fs=require('fs');var fs_extra=require(_0xba8f('0xa'));var _=require(_0xba8f('0xb'));var squel=require('squel');var crypto=require(_0xba8f('0xc'));var jsforce=require(_0xba8f('0xd'));var deskjs=require(_0xba8f('0xe'));var toCsv=require(_0xba8f('0x8'));var querystring=require('querystring');var Papa=require(_0xba8f('0xf'));var Redis=require(_0xba8f('0x10'));var authService=require(_0xba8f('0x11'));var qs=require(_0xba8f('0x12'));var as=require(_0xba8f('0x13'));var hardwareService=require(_0xba8f('0x14'));var logger=require(_0xba8f('0x15'))(_0xba8f('0x16'));var utils=require('../../config/utils');var config=require(_0xba8f('0x17'));var licenseUtil=require(_0xba8f('0x18'));var db=require('../../mysqldb')['db'];config[_0xba8f('0x19')]=_[_0xba8f('0x1a')](config[_0xba8f('0x19')],{'host':_0xba8f('0x1b'),'port':0x18eb});var socket=require(_0xba8f('0x1c'))(new Redis(config[_0xba8f('0x19')]));require('./voiceQueueReport.socket')[_0xba8f('0x1d')](socket);function respondWithStatusCode(_0x521a2c,_0x833913){_0x833913=_0x833913||0xcc;return function(_0x2de7e4){if(_0x2de7e4){return _0x521a2c[_0xba8f('0x1e')](_0x833913);}return _0x521a2c[_0xba8f('0x1f')](_0x833913)['end']();};}function respondWithResult(_0x561441,_0x5c1365){_0x5c1365=_0x5c1365||0xc8;return function(_0x2336a8){if(_0x2336a8){return _0x561441['status'](_0x5c1365)[_0xba8f('0x20')](_0x2336a8);}};}function respondWithFilteredResult(_0x5ac177,_0x5d7797){return function(_0x4c09ae){if(_0x4c09ae){var _0xfbf17b=typeof _0x5d7797[_0xba8f('0x21')]===_0xba8f('0x22')&&typeof _0x5d7797[_0xba8f('0x23')]===_0xba8f('0x22');var _0x2d2d19=_0x4c09ae['count'];var _0x57df68=_0xfbf17b?0x0:_0x5d7797[_0xba8f('0x21')];var _0x2cd58c=_0xfbf17b?_0x4c09ae[_0xba8f('0x24')]:_0x5d7797[_0xba8f('0x21')]+_0x5d7797['limit'];var _0x3a6e9b;if(_0x2cd58c>=_0x2d2d19){_0x2cd58c=_0x2d2d19;_0x3a6e9b=0xc8;}else{_0x3a6e9b=0xce;}_0x5ac177['status'](_0x3a6e9b);return _0x5ac177[_0xba8f('0x25')](_0xba8f('0x26'),_0x57df68+'-'+_0x2cd58c+'/'+_0x2d2d19)['json'](_0x4c09ae);}return null;};}function patchUpdates(_0x1ac5ba){return function(_0x50fe77){try{jsonpatch[_0xba8f('0x27')](_0x50fe77,_0x1ac5ba,!![]);}catch(_0x32153a){return BPromise[_0xba8f('0x28')](_0x32153a);}return _0x50fe77[_0xba8f('0x29')]();};}function saveUpdates(_0x845490,_0x52c7f4){return function(_0x20bf8c){if(_0x20bf8c){return _0x20bf8c[_0xba8f('0x2a')](_0x845490)['then'](function(_0x41c5ee){return _0x41c5ee;});}return null;};}function removeEntity(_0x36c92b,_0x48ca08){return function(_0x3b0c43){if(_0x3b0c43){return _0x3b0c43[_0xba8f('0x2b')]()[_0xba8f('0x2c')](function(){_0x36c92b[_0xba8f('0x1f')](0xcc)[_0xba8f('0x2d')]();});}};}function handleEntityNotFound(_0xd55003,_0x47e199){return function(_0x5c29b0){if(!_0x5c29b0){_0xd55003[_0xba8f('0x1e')](0x194);}return _0x5c29b0;};}function handleError(_0x18d457,_0x3a3005){_0x3a3005=_0x3a3005||0x1f4;return function(_0x32a7db){logger[_0xba8f('0x2e')](_0x32a7db[_0xba8f('0x2f')]);if(_0x32a7db['name']){delete _0x32a7db[_0xba8f('0x30')];}_0x18d457[_0xba8f('0x1f')](_0x3a3005)[_0xba8f('0x31')](_0x32a7db);};}exports[_0xba8f('0x32')]=function(_0x5390b9,_0x54a5a1){var _0x3c67ea={},_0xdb07c0={},_0x108648={'count':0x0,'rows':[]};var _0x21f33b=_['map'](db[_0xba8f('0x33')][_0xba8f('0x34')],function(_0x427267){return{'name':_0x427267['fieldName'],'type':_0x427267[_0xba8f('0x35')]['key']};});_0xdb07c0[_0xba8f('0x36')]=_['map'](_0x21f33b,'name');_0xdb07c0[_0xba8f('0x37')]=_['keys'](_0x5390b9[_0xba8f('0x37')]);_0xdb07c0[_0xba8f('0x38')]=_[_0xba8f('0x39')](_0xdb07c0['model'],_0xdb07c0['query']);_0x3c67ea[_0xba8f('0x3a')]=_[_0xba8f('0x39')](_0xdb07c0[_0xba8f('0x36')],qs['fields'](_0x5390b9[_0xba8f('0x37')][_0xba8f('0x3b')]));_0x3c67ea[_0xba8f('0x3a')]=_0x3c67ea[_0xba8f('0x3a')][_0xba8f('0x3c')]?_0x3c67ea[_0xba8f('0x3a')]:_0xdb07c0[_0xba8f('0x36')];if(!_0x5390b9[_0xba8f('0x37')][_0xba8f('0x3d')](_0xba8f('0x3e'))){_0x3c67ea[_0xba8f('0x23')]=qs['limit'](_0x5390b9[_0xba8f('0x37')][_0xba8f('0x23')]);_0x3c67ea[_0xba8f('0x21')]=qs[_0xba8f('0x21')](_0x5390b9[_0xba8f('0x37')]['offset']);}_0x3c67ea[_0xba8f('0x3f')]=qs[_0xba8f('0x40')](_0x5390b9[_0xba8f('0x37')]['sort']);_0x3c67ea['where']=qs[_0xba8f('0x38')](_['pick'](_0x5390b9['query'],_0xdb07c0[_0xba8f('0x38')]),_0x21f33b);if(_0x5390b9[_0xba8f('0x37')][_0xba8f('0x41')]){_0x3c67ea['where']=_['merge'](_0x3c67ea[_0xba8f('0x42')],{'$or':_[_0xba8f('0x43')](_0x21f33b,function(_0x3cddfe){if(_0x3cddfe[_0xba8f('0x35')]!=='VIRTUAL'){var _0x3ae652={};_0x3ae652[_0x3cddfe[_0xba8f('0x30')]]={'$like':'%'+_0x5390b9[_0xba8f('0x37')][_0xba8f('0x41')]+'%'};return _0x3ae652;}})});}_0x3c67ea=_[_0xba8f('0x44')]({},_0x3c67ea,_0x5390b9[_0xba8f('0x45')]);var _0x286c7a={'where':_0x3c67ea[_0xba8f('0x42')]};return db[_0xba8f('0x33')]['count'](_0x286c7a)['then'](function(_0x4e7fbb){_0x108648[_0xba8f('0x24')]=_0x4e7fbb;if(_0x5390b9['query']['includeAll']){_0x3c67ea[_0xba8f('0x46')]=[{'all':!![]}];}return db[_0xba8f('0x33')][_0xba8f('0x47')](_0x3c67ea);})['then'](function(_0x19ae83){_0x108648['rows']=_0x19ae83;return _0x108648;})[_0xba8f('0x2c')](respondWithFilteredResult(_0x54a5a1,_0x3c67ea))[_0xba8f('0x48')](handleError(_0x54a5a1,null));};exports['show']=function(_0x307bf0,_0x36f9a9){var _0x393f45={'raw':![],'where':{'id':_0x307bf0[_0xba8f('0x49')]['id']}},_0x30bfe6={};_0x30bfe6['model']=_[_0xba8f('0x4a')](db[_0xba8f('0x33')]['rawAttributes']);_0x30bfe6['query']=_['keys'](_0x307bf0[_0xba8f('0x37')]);_0x30bfe6[_0xba8f('0x38')]=_['intersection'](_0x30bfe6['model'],_0x30bfe6[_0xba8f('0x37')]);_0x393f45[_0xba8f('0x3a')]=_[_0xba8f('0x39')](_0x30bfe6[_0xba8f('0x36')],qs['fields'](_0x307bf0[_0xba8f('0x37')]['fields']));_0x393f45[_0xba8f('0x3a')]=_0x393f45[_0xba8f('0x3a')]['length']?_0x393f45[_0xba8f('0x3a')]:_0x30bfe6[_0xba8f('0x36')];if(_0x307bf0[_0xba8f('0x37')]['includeAll']){_0x393f45[_0xba8f('0x46')]=[{'all':!![]}];}_0x393f45=_['merge']({},_0x393f45,_0x307bf0[_0xba8f('0x45')]);return db['VoiceQueueReport'][_0xba8f('0x4b')](_0x393f45)['then'](handleEntityNotFound(_0x36f9a9,null))[_0xba8f('0x2c')](respondWithResult(_0x36f9a9,null))['catch'](handleError(_0x36f9a9,null));};exports[_0xba8f('0x4c')]=function(_0x5e5135,_0x36b846){return db[_0xba8f('0x33')][_0xba8f('0x4c')](_0x5e5135[_0xba8f('0x4d')],{})[_0xba8f('0x2c')](respondWithResult(_0x36b846,0xc9))[_0xba8f('0x48')](handleError(_0x36b846,null));};exports[_0xba8f('0x2a')]=function(_0x306272,_0x568e9f){if(_0x306272['body']['id']){delete _0x306272['body']['id'];}return db[_0xba8f('0x33')][_0xba8f('0x4b')]({'where':{'id':_0x306272['params']['id']}})[_0xba8f('0x2c')](handleEntityNotFound(_0x568e9f,null))[_0xba8f('0x2c')](saveUpdates(_0x306272[_0xba8f('0x4d')],null))[_0xba8f('0x2c')](respondWithResult(_0x568e9f,null))[_0xba8f('0x48')](handleError(_0x568e9f,null));};exports[_0xba8f('0x2b')]=function(_0x47854f,_0x29c3a7){return db[_0xba8f('0x33')][_0xba8f('0x4b')]({'where':{'id':_0x47854f[_0xba8f('0x49')]['id']}})[_0xba8f('0x2c')](handleEntityNotFound(_0x29c3a7,null))[_0xba8f('0x2c')](removeEntity(_0x29c3a7,null))['catch'](handleError(_0x29c3a7,null));};exports[_0xba8f('0x4e')]=function(_0x2df437,_0x40ae03){return db[_0xba8f('0x33')][_0xba8f('0x4e')]()[_0xba8f('0x2c')](respondWithResult(_0x40ae03,null))['catch'](handleError(_0x40ae03,null));};exports[_0xba8f('0x4f')]=function(_0x432391,_0x3d9d51){var _0xe5fdcb={},_0x18cc18={},_0x20011a={'count':0x0,'rows':[]};_0x18cc18[_0xba8f('0x36')]=_['keys'](db['VoiceQueueReport'][_0xba8f('0x34')]);_0x18cc18[_0xba8f('0x37')]=_[_0xba8f('0x4a')](_0x432391[_0xba8f('0x37')]);_0x18cc18['filters']=_[_0xba8f('0x39')](_0x18cc18['model'],_0x18cc18[_0xba8f('0x37')]);_0xe5fdcb['attributes']=_[_0xba8f('0x39')](_0x18cc18[_0xba8f('0x36')],qs['fields'](_0x432391[_0xba8f('0x37')]['fields']));_0xe5fdcb[_0xba8f('0x3a')]=_0xe5fdcb[_0xba8f('0x3a')][_0xba8f('0x3c')]?_0xe5fdcb['attributes']:_0x18cc18[_0xba8f('0x36')];if(!_0x432391[_0xba8f('0x37')][_0xba8f('0x3d')]('nolimit')){_0xe5fdcb[_0xba8f('0x23')]=qs[_0xba8f('0x23')](_0x432391[_0xba8f('0x37')][_0xba8f('0x23')]);_0xe5fdcb[_0xba8f('0x21')]=qs[_0xba8f('0x21')](_0x432391['query'][_0xba8f('0x21')]);}_0xe5fdcb[_0xba8f('0x3f')]=qs[_0xba8f('0x40')](_0x432391[_0xba8f('0x37')][_0xba8f('0x40')]);_0xe5fdcb['where']=qs[_0xba8f('0x38')](_[_0xba8f('0x50')](_0x432391[_0xba8f('0x37')],_0x18cc18['filters']));if(_0x432391[_0xba8f('0x37')]['filter']){_0xe5fdcb['where']=_[_0xba8f('0x44')](_0xe5fdcb[_0xba8f('0x42')],{'$or':_[_0xba8f('0x43')](_0xe5fdcb[_0xba8f('0x3a')],function(_0x5bcec5){var _0xe98f59={};_0xe98f59[_0x5bcec5]={'$like':'%'+_0x432391['query']['filter']+'%'};return _0xe98f59;})});}_0xe5fdcb=_['merge']({},_0xe5fdcb,_0x432391[_0xba8f('0x45')]);var _0x1dc800={'where':_0xe5fdcb[_0xba8f('0x42')]};return db[_0xba8f('0x33')][_0xba8f('0x24')](_0x1dc800)[_0xba8f('0x2c')](function(_0x581441){_0x20011a[_0xba8f('0x24')]=_0x581441;if(_0x432391[_0xba8f('0x37')][_0xba8f('0x51')]){_0xe5fdcb[_0xba8f('0x46')]=[{'all':!![]}];}return db[_0xba8f('0x33')][_0xba8f('0x47')](_0xe5fdcb);})[_0xba8f('0x2c')](function(_0x1baa14){_0x20011a['rows']=_0x1baa14;return _0x20011a;})['then'](respondWithFilteredResult(_0x3d9d51,_0xe5fdcb,_0xba8f('0x4f')))['catch'](handleError(_0x3d9d51,null,_0xba8f('0x4f')));}; \ No newline at end of file +var _0x3000=['bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voiceQueueReport.socket','register','status','end','json','offset','undefined','limit','count','set','apply','save','update','then','destroy','stack','send','index','map','VoiceQueueReport','rawAttributes','fieldName','type','key','model','name','filters','query','attributes','intersection','fields','length','order','sort','where','filter','merge','options','includeAll','include','findAll','rows','catch','params','keys','find','create','body','describe','getVoiceQueuesReport','hasOwnProperty','nolimit','rimraf','zip-dir','request-promise'];(function(_0xbbf0e8,_0x325bb6){var _0x3287b5=function(_0x3b1c0c){while(--_0x3b1c0c){_0xbbf0e8['push'](_0xbbf0e8['shift']());}};_0x3287b5(++_0x325bb6);}(_0x3000,0xa1));var _0x0300=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x3000[_0x2641f9];return _0x585741;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0300('0x0'));var zipdir=require(_0x0300('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0300('0x2'));var moment=require('moment');var BPromise=require(_0x0300('0x3'));var Mustache=require(_0x0300('0x4'));var util=require(_0x0300('0x5'));var path=require(_0x0300('0x6'));var sox=require(_0x0300('0x7'));var csv=require(_0x0300('0x8'));var ejs=require(_0x0300('0x9'));var fs=require('fs');var fs_extra=require(_0x0300('0xa'));var _=require(_0x0300('0xb'));var squel=require(_0x0300('0xc'));var crypto=require(_0x0300('0xd'));var jsforce=require(_0x0300('0xe'));var deskjs=require(_0x0300('0xf'));var toCsv=require(_0x0300('0x8'));var querystring=require(_0x0300('0x10'));var Papa=require(_0x0300('0x11'));var Redis=require(_0x0300('0x12'));var authService=require(_0x0300('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x0300('0x14'));var hardwareService=require(_0x0300('0x15'));var logger=require(_0x0300('0x16'))('api');var utils=require('../../config/utils');var config=require(_0x0300('0x17'));var licenseUtil=require(_0x0300('0x18'));var db=require(_0x0300('0x19'))['db'];config[_0x0300('0x1a')]=_[_0x0300('0x1b')](config[_0x0300('0x1a')],{'host':_0x0300('0x1c'),'port':0x18eb});var socket=require(_0x0300('0x1d'))(new Redis(config[_0x0300('0x1a')]));require(_0x0300('0x1e'))[_0x0300('0x1f')](socket);function respondWithStatusCode(_0x5a2a75,_0x23352a){_0x23352a=_0x23352a||0xcc;return function(_0x259db6){if(_0x259db6){return _0x5a2a75['sendStatus'](_0x23352a);}return _0x5a2a75[_0x0300('0x20')](_0x23352a)[_0x0300('0x21')]();};}function respondWithResult(_0x1f1d8f,_0x14714c){_0x14714c=_0x14714c||0xc8;return function(_0x3b69b4){if(_0x3b69b4){return _0x1f1d8f[_0x0300('0x20')](_0x14714c)[_0x0300('0x22')](_0x3b69b4);}};}function respondWithFilteredResult(_0x2cfc2e,_0x54b0e3){return function(_0x50545f){if(_0x50545f){var _0x8d5624=typeof _0x54b0e3[_0x0300('0x23')]===_0x0300('0x24')&&typeof _0x54b0e3[_0x0300('0x25')]==='undefined';var _0x20bc6b=_0x50545f[_0x0300('0x26')];var _0x4c9f0d=_0x8d5624?0x0:_0x54b0e3['offset'];var _0x483fb5=_0x8d5624?_0x50545f[_0x0300('0x26')]:_0x54b0e3[_0x0300('0x23')]+_0x54b0e3[_0x0300('0x25')];var _0x23771d;if(_0x483fb5>=_0x20bc6b){_0x483fb5=_0x20bc6b;_0x23771d=0xc8;}else{_0x23771d=0xce;}_0x2cfc2e[_0x0300('0x20')](_0x23771d);return _0x2cfc2e[_0x0300('0x27')]('Content-Range',_0x4c9f0d+'-'+_0x483fb5+'/'+_0x20bc6b)[_0x0300('0x22')](_0x50545f);}return null;};}function patchUpdates(_0x284fc3){return function(_0x44ce9c){try{jsonpatch[_0x0300('0x28')](_0x44ce9c,_0x284fc3,!![]);}catch(_0x58c401){return BPromise['reject'](_0x58c401);}return _0x44ce9c[_0x0300('0x29')]();};}function saveUpdates(_0x37e54d,_0x2bb8d3){return function(_0x3f446a){if(_0x3f446a){return _0x3f446a[_0x0300('0x2a')](_0x37e54d)[_0x0300('0x2b')](function(_0x1f85d0){return _0x1f85d0;});}return null;};}function removeEntity(_0x112d83,_0x3d5016){return function(_0x8fc214){if(_0x8fc214){return _0x8fc214[_0x0300('0x2c')]()[_0x0300('0x2b')](function(){_0x112d83[_0x0300('0x20')](0xcc)[_0x0300('0x21')]();});}};}function handleEntityNotFound(_0x4f5a06,_0x297000){return function(_0x54362c){if(!_0x54362c){_0x4f5a06['sendStatus'](0x194);}return _0x54362c;};}function handleError(_0x19ec81,_0x22ffca){_0x22ffca=_0x22ffca||0x1f4;return function(_0xd2bda2){logger['error'](_0xd2bda2[_0x0300('0x2d')]);if(_0xd2bda2['name']){delete _0xd2bda2['name'];}_0x19ec81[_0x0300('0x20')](_0x22ffca)[_0x0300('0x2e')](_0xd2bda2);};}exports[_0x0300('0x2f')]=function(_0x5254b2,_0x353050){var _0x5583e9={},_0x52e552={},_0x3f892d={'count':0x0,'rows':[]};var _0xe71026=_[_0x0300('0x30')](db[_0x0300('0x31')][_0x0300('0x32')],function(_0x4a27a7){return{'name':_0x4a27a7[_0x0300('0x33')],'type':_0x4a27a7[_0x0300('0x34')][_0x0300('0x35')]};});_0x52e552[_0x0300('0x36')]=_[_0x0300('0x30')](_0xe71026,_0x0300('0x37'));_0x52e552['query']=_['keys'](_0x5254b2['query']);_0x52e552[_0x0300('0x38')]=_['intersection'](_0x52e552['model'],_0x52e552[_0x0300('0x39')]);_0x5583e9[_0x0300('0x3a')]=_[_0x0300('0x3b')](_0x52e552[_0x0300('0x36')],qs[_0x0300('0x3c')](_0x5254b2['query'][_0x0300('0x3c')]));_0x5583e9[_0x0300('0x3a')]=_0x5583e9[_0x0300('0x3a')][_0x0300('0x3d')]?_0x5583e9[_0x0300('0x3a')]:_0x52e552[_0x0300('0x36')];if(!_0x5254b2[_0x0300('0x39')]['hasOwnProperty']('nolimit')){_0x5583e9['limit']=qs[_0x0300('0x25')](_0x5254b2[_0x0300('0x39')][_0x0300('0x25')]);_0x5583e9[_0x0300('0x23')]=qs[_0x0300('0x23')](_0x5254b2[_0x0300('0x39')]['offset']);}_0x5583e9[_0x0300('0x3e')]=qs[_0x0300('0x3f')](_0x5254b2['query'][_0x0300('0x3f')]);_0x5583e9[_0x0300('0x40')]=qs[_0x0300('0x38')](_['pick'](_0x5254b2['query'],_0x52e552[_0x0300('0x38')]),_0xe71026);if(_0x5254b2[_0x0300('0x39')][_0x0300('0x41')]){_0x5583e9['where']=_['merge'](_0x5583e9[_0x0300('0x40')],{'$or':_[_0x0300('0x30')](_0xe71026,function(_0x499245){if(_0x499245[_0x0300('0x34')]!=='VIRTUAL'){var _0x5dea31={};_0x5dea31[_0x499245[_0x0300('0x37')]]={'$like':'%'+_0x5254b2[_0x0300('0x39')]['filter']+'%'};return _0x5dea31;}})});}_0x5583e9=_[_0x0300('0x42')]({},_0x5583e9,_0x5254b2[_0x0300('0x43')]);var _0x33f083={'where':_0x5583e9[_0x0300('0x40')]};return db[_0x0300('0x31')]['count'](_0x33f083)[_0x0300('0x2b')](function(_0x132da6){_0x3f892d[_0x0300('0x26')]=_0x132da6;if(_0x5254b2[_0x0300('0x39')][_0x0300('0x44')]){_0x5583e9[_0x0300('0x45')]=[{'all':!![]}];}return db[_0x0300('0x31')][_0x0300('0x46')](_0x5583e9);})[_0x0300('0x2b')](function(_0x52535c){_0x3f892d[_0x0300('0x47')]=_0x52535c;return _0x3f892d;})[_0x0300('0x2b')](respondWithFilteredResult(_0x353050,_0x5583e9))[_0x0300('0x48')](handleError(_0x353050,null));};exports['show']=function(_0x1cea6e,_0x14c4ca){var _0x4394eb={'raw':![],'where':{'id':_0x1cea6e[_0x0300('0x49')]['id']}},_0x188f2c={};_0x188f2c[_0x0300('0x36')]=_[_0x0300('0x4a')](db['VoiceQueueReport'][_0x0300('0x32')]);_0x188f2c[_0x0300('0x39')]=_[_0x0300('0x4a')](_0x1cea6e['query']);_0x188f2c[_0x0300('0x38')]=_[_0x0300('0x3b')](_0x188f2c[_0x0300('0x36')],_0x188f2c[_0x0300('0x39')]);_0x4394eb['attributes']=_['intersection'](_0x188f2c['model'],qs[_0x0300('0x3c')](_0x1cea6e[_0x0300('0x39')]['fields']));_0x4394eb[_0x0300('0x3a')]=_0x4394eb['attributes']['length']?_0x4394eb[_0x0300('0x3a')]:_0x188f2c['model'];if(_0x1cea6e['query']['includeAll']){_0x4394eb['include']=[{'all':!![]}];}_0x4394eb=_[_0x0300('0x42')]({},_0x4394eb,_0x1cea6e['options']);return db['VoiceQueueReport'][_0x0300('0x4b')](_0x4394eb)[_0x0300('0x2b')](handleEntityNotFound(_0x14c4ca,null))['then'](respondWithResult(_0x14c4ca,null))[_0x0300('0x48')](handleError(_0x14c4ca,null));};exports[_0x0300('0x4c')]=function(_0x3d20a6,_0x13aaf3){return db[_0x0300('0x31')][_0x0300('0x4c')](_0x3d20a6[_0x0300('0x4d')],{})[_0x0300('0x2b')](respondWithResult(_0x13aaf3,0xc9))[_0x0300('0x48')](handleError(_0x13aaf3,null));};exports[_0x0300('0x2a')]=function(_0x462331,_0x1c261c){if(_0x462331[_0x0300('0x4d')]['id']){delete _0x462331[_0x0300('0x4d')]['id'];}return db['VoiceQueueReport']['find']({'where':{'id':_0x462331[_0x0300('0x49')]['id']}})[_0x0300('0x2b')](handleEntityNotFound(_0x1c261c,null))[_0x0300('0x2b')](saveUpdates(_0x462331['body'],null))[_0x0300('0x2b')](respondWithResult(_0x1c261c,null))[_0x0300('0x48')](handleError(_0x1c261c,null));};exports['destroy']=function(_0x319c9e,_0x422a68){return db[_0x0300('0x31')][_0x0300('0x4b')]({'where':{'id':_0x319c9e[_0x0300('0x49')]['id']}})['then'](handleEntityNotFound(_0x422a68,null))[_0x0300('0x2b')](removeEntity(_0x422a68,null))['catch'](handleError(_0x422a68,null));};exports[_0x0300('0x4e')]=function(_0x434acf,_0x42f442){return db[_0x0300('0x31')][_0x0300('0x4e')]()['then'](respondWithResult(_0x42f442,null))[_0x0300('0x48')](handleError(_0x42f442,null));};exports[_0x0300('0x4f')]=function(_0x61e46d,_0x915a89){var _0x3ba652={},_0x4504dd={},_0x3c3391={'count':0x0,'rows':[]};_0x4504dd['model']=_[_0x0300('0x4a')](db[_0x0300('0x31')][_0x0300('0x32')]);_0x4504dd['query']=_[_0x0300('0x4a')](_0x61e46d[_0x0300('0x39')]);_0x4504dd[_0x0300('0x38')]=_[_0x0300('0x3b')](_0x4504dd['model'],_0x4504dd[_0x0300('0x39')]);_0x3ba652[_0x0300('0x3a')]=_[_0x0300('0x3b')](_0x4504dd[_0x0300('0x36')],qs[_0x0300('0x3c')](_0x61e46d[_0x0300('0x39')]['fields']));_0x3ba652['attributes']=_0x3ba652['attributes'][_0x0300('0x3d')]?_0x3ba652['attributes']:_0x4504dd['model'];if(!_0x61e46d['query'][_0x0300('0x50')](_0x0300('0x51'))){_0x3ba652[_0x0300('0x25')]=qs['limit'](_0x61e46d[_0x0300('0x39')]['limit']);_0x3ba652[_0x0300('0x23')]=qs[_0x0300('0x23')](_0x61e46d[_0x0300('0x39')][_0x0300('0x23')]);}_0x3ba652['order']=qs[_0x0300('0x3f')](_0x61e46d[_0x0300('0x39')]['sort']);_0x3ba652[_0x0300('0x40')]=qs[_0x0300('0x38')](_['pick'](_0x61e46d[_0x0300('0x39')],_0x4504dd[_0x0300('0x38')]));if(_0x61e46d[_0x0300('0x39')][_0x0300('0x41')]){_0x3ba652[_0x0300('0x40')]=_['merge'](_0x3ba652[_0x0300('0x40')],{'$or':_[_0x0300('0x30')](_0x3ba652[_0x0300('0x3a')],function(_0x1ead0c){var _0x4ab45f={};_0x4ab45f[_0x1ead0c]={'$like':'%'+_0x61e46d['query'][_0x0300('0x41')]+'%'};return _0x4ab45f;})});}_0x3ba652=_['merge']({},_0x3ba652,_0x61e46d[_0x0300('0x43')]);var _0x1fb9d2={'where':_0x3ba652[_0x0300('0x40')]};return db[_0x0300('0x31')][_0x0300('0x26')](_0x1fb9d2)[_0x0300('0x2b')](function(_0x1a3d23){_0x3c3391[_0x0300('0x26')]=_0x1a3d23;if(_0x61e46d['query']['includeAll']){_0x3ba652[_0x0300('0x45')]=[{'all':!![]}];}return db['VoiceQueueReport'][_0x0300('0x46')](_0x3ba652);})[_0x0300('0x2b')](function(_0xff3b76){_0x3c3391[_0x0300('0x47')]=_0xff3b76;return _0x3c3391;})['then'](respondWithFilteredResult(_0x915a89,_0x3ba652,_0x0300('0x4f')))[_0x0300('0x48')](handleError(_0x915a89,null,_0x0300('0x4f')));}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.events.js b/server/api/voiceQueueReport/voiceQueueReport.events.js index 131f97f..fa07270 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 _0xc641=['emit','hasOwnProperty','hook','exports','../../mysqldb','VoiceQueueReport','setMaxListeners','remove'];(function(_0x24d61f,_0x38cebb){var _0x29ae79=function(_0x5ae6b7){while(--_0x5ae6b7){_0x24d61f['push'](_0x24d61f['shift']());}};_0x29ae79(++_0x38cebb);}(_0xc641,0x164));var _0x1c64=function(_0x43cc3d,_0x395ac9){_0x43cc3d=_0x43cc3d-0x0;var _0x3377e0=_0xc641[_0x43cc3d];return _0x3377e0;};'use strict';var EventEmitter=require('events');var VoiceQueueReport=require(_0x1c64('0x0'))['db'][_0x1c64('0x1')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0x1c64('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x1c64('0x3')};function emitEvent(_0x2f31c8){return function(_0x3159fa,_0x371790,_0x4c45ac){VoiceQueueReportEvents[_0x1c64('0x4')](_0x2f31c8+':'+_0x3159fa['id'],_0x3159fa);VoiceQueueReportEvents[_0x1c64('0x4')](_0x2f31c8,_0x3159fa);_0x4c45ac(null);};}for(var e in events){if(events[_0x1c64('0x5')](e)){var event=events[e];VoiceQueueReport[_0x1c64('0x6')](e,emitEvent(event));}}module[_0x1c64('0x7')]=VoiceQueueReportEvents; \ No newline at end of file +var _0x73f6=['events','../../mysqldb','VoiceQueueReport','setMaxListeners','save','update','remove','emit','hook','exports'];(function(_0x1c3af2,_0x4578de){var _0xec93e=function(_0x37991a){while(--_0x37991a){_0x1c3af2['push'](_0x1c3af2['shift']());}};_0xec93e(++_0x4578de);}(_0x73f6,0x96));var _0x673f=function(_0x2064e5,_0x4f6fa2){_0x2064e5=_0x2064e5-0x0;var _0x21a233=_0x73f6[_0x2064e5];return _0x21a233;};'use strict';var EventEmitter=require(_0x673f('0x0'));var VoiceQueueReport=require(_0x673f('0x1'))['db'][_0x673f('0x2')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0x673f('0x3')](0x0);var events={'afterCreate':_0x673f('0x4'),'afterUpdate':_0x673f('0x5'),'afterDestroy':_0x673f('0x6')};function emitEvent(_0x2ced7d){return function(_0x4961ed,_0x2f768f,_0x34647f){VoiceQueueReportEvents[_0x673f('0x7')](_0x2ced7d+':'+_0x4961ed['id'],_0x4961ed);VoiceQueueReportEvents[_0x673f('0x7')](_0x2ced7d,_0x4961ed);_0x34647f(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueueReport[_0x673f('0x8')](e,emitEvent(event));}}module[_0x673f('0x9')]=VoiceQueueReportEvents; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.model.js b/server/api/voiceQueueReport/voiceQueueReport.model.js index 3dc39f3..2728729 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 _0x2570=['api','path','rimraf','../../config/environment','./voiceQueueReport.attributes','exports','VoiceQueueReport','report_queue','calleridnum','lodash','../../config/logger'];(function(_0x1b3d60,_0x51583b){var _0x4abc3d=function(_0x5c9acb){while(--_0x5c9acb){_0x1b3d60['push'](_0x1b3d60['shift']());}};_0x4abc3d(++_0x51583b);}(_0x2570,0x1d7));var _0x0257=function(_0x3ee244,_0x2e67db){_0x3ee244=_0x3ee244-0x0;var _0x2e75ee=_0x2570[_0x3ee244];return _0x2e75ee;};'use strict';var _=require(_0x0257('0x0'));var util=require('util');var logger=require(_0x0257('0x1'))(_0x0257('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x0257('0x3'));var rimraf=require(_0x0257('0x4'));var config=require(_0x0257('0x5'));var attributes=require(_0x0257('0x6'));module[_0x0257('0x7')]=function(_0x24ee04,_0x43b0ba){return _0x24ee04['define'](_0x0257('0x8'),attributes,{'tableName':_0x0257('0x9'),'paranoid':![],'indexes':[{'fields':['uniqueid']},{'fields':[_0x0257('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2046=['path','rimraf','../../config/environment','./voiceQueueReport.attributes','exports','define','VoiceQueueReport','report_queue','uniqueid','calleridnum','moment','bluebird','request-promise'];(function(_0x30d87a,_0xf3a07f){var _0x48f64b=function(_0x2078b7){while(--_0x2078b7){_0x30d87a['push'](_0x30d87a['shift']());}};_0x48f64b(++_0xf3a07f);}(_0x2046,0x1c4));var _0x6204=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x2046[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x6204('0x0'));var BPromise=require(_0x6204('0x1'));var rp=require(_0x6204('0x2'));var fs=require('fs');var path=require(_0x6204('0x3'));var rimraf=require(_0x6204('0x4'));var config=require(_0x6204('0x5'));var attributes=require(_0x6204('0x6'));module[_0x6204('0x7')]=function(_0x363766,_0x1c32a0){return _0x363766[_0x6204('0x8')](_0x6204('0x9'),attributes,{'tableName':_0x6204('0xa'),'paranoid':![],'indexes':[{'fields':[_0x6204('0xb')]},{'fields':[_0x6204('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.rpc.js b/server/api/voiceQueueReport/voiceQueueReport.rpc.js index fac9ad1..edab2a0 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 _0x3e03=['VoiceQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetVoiceQueueReport','findAll','options','raw','limit','include','model','attributes','map','CreateVoiceQueueReport','create','body','UpdateVoiceQueueReport','VoiceQueueReport','where','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','http','defaults','redis','localhost','socket.io-emitter','./voiceQueueReport.socket','request','then','info','VoiceQueueReport,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x5c3c0b,_0x4ee35e){var _0x52ecd2=function(_0x3cf575){while(--_0x3cf575){_0x5c3c0b['push'](_0x5c3c0b['shift']());}};_0x52ecd2(++_0x4ee35e);}(_0x3e03,0xb9));var _0x33e0=function(_0x55c3d9,_0x3bf75c){_0x55c3d9=_0x55c3d9-0x0;var _0x19fd97=_0x3e03[_0x55c3d9];return _0x19fd97;};'use strict';var _=require('lodash');var util=require(_0x33e0('0x0'));var moment=require(_0x33e0('0x1'));var BPromise=require(_0x33e0('0x2'));var rs=require(_0x33e0('0x3'));var fs=require('fs');var Redis=require(_0x33e0('0x4'));var db=require(_0x33e0('0x5'))['db'];var utils=require(_0x33e0('0x6'));var logger=require('../../config/logger')(_0x33e0('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x33e0('0x8')]({'port':0x232a});config['redis']=_[_0x33e0('0x9')](config[_0x33e0('0xa')],{'host':_0x33e0('0xb'),'port':0x18eb});var socket=require(_0x33e0('0xc'))(new Redis(config['redis']));require(_0x33e0('0xd'))['register'](socket);function respondWithRpcPromise(_0xcae63e,_0x45594d,_0x4ad64d){return new BPromise(function(_0x7f693e,_0x1c35e2){return client[_0x33e0('0xe')](_0xcae63e,_0x4ad64d)[_0x33e0('0xf')](function(_0x32a7aa){logger[_0x33e0('0x10')](_0x33e0('0x11'),_0x45594d,_0x33e0('0x12'));logger[_0x33e0('0x13')](_0x33e0('0x14'),_0x45594d,'request\x20sent',JSON[_0x33e0('0x15')](_0x32a7aa));if(_0x32a7aa['error']){if(_0x32a7aa['error']['code']===0x1f4){logger['error'](_0x33e0('0x11'),_0x45594d,_0x32a7aa[_0x33e0('0x16')]['message']);return _0x1c35e2(_0x32a7aa['error'][_0x33e0('0x17')]);}logger['error'](_0x33e0('0x11'),_0x45594d,_0x32a7aa['error'][_0x33e0('0x17')]);return _0x7f693e(_0x32a7aa[_0x33e0('0x16')][_0x33e0('0x17')]);}else{logger[_0x33e0('0x10')](_0x33e0('0x11'),_0x45594d,_0x33e0('0x12'));_0x7f693e(_0x32a7aa[_0x33e0('0x18')][_0x33e0('0x17')]);}})[_0x33e0('0x19')](function(_0x497250){logger[_0x33e0('0x16')]('VoiceQueueReport,\x20%s,\x20%s',_0x45594d,_0x497250);_0x1c35e2(_0x497250);});});}exports[_0x33e0('0x1a')]=function(_0x2a0675){var _0x44d498=this;return new Promise(function(_0x4c4987,_0x1c53e1){return db['VoiceQueueReport'][_0x33e0('0x1b')]({'raw':_0x2a0675[_0x33e0('0x1c')]?_0x2a0675[_0x33e0('0x1c')][_0x33e0('0x1d')]===undefined?!![]:![]:!![],'where':_0x2a0675[_0x33e0('0x1c')]?_0x2a0675['options']['where']||null:null,'attributes':_0x2a0675['options']?_0x2a0675[_0x33e0('0x1c')]['attributes']||null:null,'limit':_0x2a0675[_0x33e0('0x1c')]?_0x2a0675[_0x33e0('0x1c')][_0x33e0('0x1e')]||null:null,'include':_0x2a0675[_0x33e0('0x1c')]?_0x2a0675[_0x33e0('0x1c')][_0x33e0('0x1f')]?_['map'](_0x2a0675[_0x33e0('0x1c')]['include'],function(_0x352de9){return{'model':db[_0x352de9[_0x33e0('0x20')]],'as':_0x352de9['as'],'attributes':_0x352de9[_0x33e0('0x21')],'include':_0x352de9[_0x33e0('0x1f')]?_[_0x33e0('0x22')](_0x352de9['include'],function(_0x3ac0e6){return{'model':db[_0x3ac0e6['model']],'as':_0x3ac0e6['as'],'attributes':_0x3ac0e6[_0x33e0('0x21')],'include':_0x3ac0e6[_0x33e0('0x1f')]?_[_0x33e0('0x22')](_0x3ac0e6['include'],function(_0x5c36ab){return{'model':db[_0x5c36ab[_0x33e0('0x20')]],'as':_0x5c36ab['as'],'attributes':_0x5c36ab[_0x33e0('0x21')]};}):[]};}):[]};}):[]:[]})[_0x33e0('0xf')](function(_0x31e8e2){logger['info']('GetVoiceQueueReport',_0x2a0675);logger[_0x33e0('0x13')]('GetVoiceQueueReport',_0x2a0675,JSON[_0x33e0('0x15')](_0x31e8e2));_0x4c4987(_0x31e8e2);})[_0x33e0('0x19')](function(_0x1ec010){logger[_0x33e0('0x16')]('GetVoiceQueueReport',_0x1ec010['message'],_0x2a0675);_0x1c53e1(_0x44d498[_0x33e0('0x16')](0x1f4,_0x1ec010[_0x33e0('0x17')]));});});};exports[_0x33e0('0x23')]=function(_0x44f8c8){var _0x35f7c4=this;return new Promise(function(_0x5465b1,_0xd29a36){return db['VoiceQueueReport'][_0x33e0('0x24')](_0x44f8c8[_0x33e0('0x25')],{'raw':_0x44f8c8['options']?_0x44f8c8[_0x33e0('0x1c')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x5e3888){logger[_0x33e0('0x10')](_0x33e0('0x23'),_0x44f8c8);logger[_0x33e0('0x13')](_0x33e0('0x23'),_0x44f8c8,JSON[_0x33e0('0x15')](_0x5e3888));_0x5465b1(_0x5e3888);})['catch'](function(_0x1af5d1){logger[_0x33e0('0x16')](_0x33e0('0x23'),_0x1af5d1[_0x33e0('0x17')],_0x44f8c8);_0xd29a36(_0x35f7c4[_0x33e0('0x16')](0x1f4,_0x1af5d1['message']));});});};exports[_0x33e0('0x26')]=function(_0xc7d542){var _0x1b2880=this;return new Promise(function(_0x987e,_0x10e23f){return db[_0x33e0('0x27')]['update'](_0xc7d542['body'],{'raw':_0xc7d542['options']?_0xc7d542['options'][_0x33e0('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xc7d542['options']?_0xc7d542[_0x33e0('0x1c')][_0x33e0('0x28')]||null:null,'attributes':_0xc7d542[_0x33e0('0x1c')]?_0xc7d542[_0x33e0('0x1c')]['attributes']||null:null,'limit':_0xc7d542[_0x33e0('0x1c')]?_0xc7d542['options']['limit']||null:null})[_0x33e0('0xf')](function(_0xc96578){logger['info']('UpdateVoiceQueueReport',_0xc7d542);logger[_0x33e0('0x13')](_0x33e0('0x26'),_0xc7d542,JSON['stringify'](_0xc96578));_0x987e(_0xc96578);})[_0x33e0('0x19')](function(_0x39dd8){logger[_0x33e0('0x16')](_0x33e0('0x26'),_0x39dd8[_0x33e0('0x17')],_0xc7d542);_0x10e23f(_0x1b2880[_0x33e0('0x16')](0x1f4,_0x39dd8[_0x33e0('0x17')]));});});}; \ No newline at end of file +var _0x924f=['GetVoiceQueueReport','VoiceQueueReport','findAll','options','limit','include','map','model','attributes','then','info','CreateVoiceQueueReport','create','body','UpdateVoiceQueueReport','update','raw','where','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','register','request\x20sent','debug','stringify','error','message','VoiceQueueReport,\x20%s,\x20%s','result','catch'];(function(_0x4f83ca,_0x46f67a){var _0x1fbac3=function(_0x19e401){while(--_0x19e401){_0x4f83ca['push'](_0x4f83ca['shift']());}};_0x1fbac3(++_0x46f67a);}(_0x924f,0xba));var _0xf924=function(_0x508c10,_0x5a15f0){_0x508c10=_0x508c10-0x0;var _0x3108b5=_0x924f[_0x508c10];return _0x3108b5;};'use strict';var _=require(_0xf924('0x0'));var util=require(_0xf924('0x1'));var moment=require(_0xf924('0x2'));var BPromise=require(_0xf924('0x3'));var rs=require(_0xf924('0x4'));var fs=require('fs');var Redis=require(_0xf924('0x5'));var db=require(_0xf924('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xf924('0x7'));var config=require(_0xf924('0x8'));var jayson=require(_0xf924('0x9'));var client=jayson['client'][_0xf924('0xa')]({'port':0x232a});config[_0xf924('0xb')]=_[_0xf924('0xc')](config[_0xf924('0xb')],{'host':_0xf924('0xd'),'port':0x18eb});var socket=require(_0xf924('0xe'))(new Redis(config[_0xf924('0xb')]));require('./voiceQueueReport.socket')[_0xf924('0xf')](socket);function respondWithRpcPromise(_0x3db9f1,_0x54a358,_0x58c9a4){return new BPromise(function(_0x1c0fef,_0x25af13){return client['request'](_0x3db9f1,_0x58c9a4)['then'](function(_0x3c2e63){logger['info']('VoiceQueueReport,\x20%s,\x20%s',_0x54a358,_0xf924('0x10'));logger[_0xf924('0x11')]('VoiceQueueReport,\x20%s,\x20%s,\x20%s',_0x54a358,_0xf924('0x10'),JSON[_0xf924('0x12')](_0x3c2e63));if(_0x3c2e63['error']){if(_0x3c2e63[_0xf924('0x13')]['code']===0x1f4){logger['error']('VoiceQueueReport,\x20%s,\x20%s',_0x54a358,_0x3c2e63[_0xf924('0x13')]['message']);return _0x25af13(_0x3c2e63[_0xf924('0x13')][_0xf924('0x14')]);}logger[_0xf924('0x13')](_0xf924('0x15'),_0x54a358,_0x3c2e63['error'][_0xf924('0x14')]);return _0x1c0fef(_0x3c2e63[_0xf924('0x13')][_0xf924('0x14')]);}else{logger['info'](_0xf924('0x15'),_0x54a358,_0xf924('0x10'));_0x1c0fef(_0x3c2e63[_0xf924('0x16')][_0xf924('0x14')]);}})[_0xf924('0x17')](function(_0x3b0261){logger['error'](_0xf924('0x15'),_0x54a358,_0x3b0261);_0x25af13(_0x3b0261);});});}exports[_0xf924('0x18')]=function(_0x381b55){var _0x918282=this;return new Promise(function(_0x38f46c,_0x16e0cb){return db[_0xf924('0x19')][_0xf924('0x1a')]({'raw':_0x381b55[_0xf924('0x1b')]?_0x381b55[_0xf924('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x381b55[_0xf924('0x1b')]?_0x381b55[_0xf924('0x1b')]['where']||null:null,'attributes':_0x381b55[_0xf924('0x1b')]?_0x381b55[_0xf924('0x1b')]['attributes']||null:null,'limit':_0x381b55[_0xf924('0x1b')]?_0x381b55[_0xf924('0x1b')][_0xf924('0x1c')]||null:null,'include':_0x381b55[_0xf924('0x1b')]?_0x381b55[_0xf924('0x1b')][_0xf924('0x1d')]?_[_0xf924('0x1e')](_0x381b55['options'][_0xf924('0x1d')],function(_0x4171aa){return{'model':db[_0x4171aa[_0xf924('0x1f')]],'as':_0x4171aa['as'],'attributes':_0x4171aa[_0xf924('0x20')],'include':_0x4171aa[_0xf924('0x1d')]?_['map'](_0x4171aa[_0xf924('0x1d')],function(_0x172396){return{'model':db[_0x172396['model']],'as':_0x172396['as'],'attributes':_0x172396[_0xf924('0x20')],'include':_0x172396[_0xf924('0x1d')]?_[_0xf924('0x1e')](_0x172396[_0xf924('0x1d')],function(_0x5203af){return{'model':db[_0x5203af['model']],'as':_0x5203af['as'],'attributes':_0x5203af[_0xf924('0x20')]};}):[]};}):[]};}):[]:[]})[_0xf924('0x21')](function(_0x59a04f){logger[_0xf924('0x22')]('GetVoiceQueueReport',_0x381b55);logger['debug'](_0xf924('0x18'),_0x381b55,JSON[_0xf924('0x12')](_0x59a04f));_0x38f46c(_0x59a04f);})[_0xf924('0x17')](function(_0x195f31){logger[_0xf924('0x13')]('GetVoiceQueueReport',_0x195f31[_0xf924('0x14')],_0x381b55);_0x16e0cb(_0x918282[_0xf924('0x13')](0x1f4,_0x195f31['message']));});});};exports[_0xf924('0x23')]=function(_0x69132){var _0x15e557=this;return new Promise(function(_0x2f6c86,_0x365314){return db[_0xf924('0x19')][_0xf924('0x24')](_0x69132[_0xf924('0x25')],{'raw':_0x69132[_0xf924('0x1b')]?_0x69132['options']['raw']===undefined?!![]:![]:!![]})[_0xf924('0x21')](function(_0xa5d93){logger[_0xf924('0x22')](_0xf924('0x23'),_0x69132);logger['debug']('CreateVoiceQueueReport',_0x69132,JSON[_0xf924('0x12')](_0xa5d93));_0x2f6c86(_0xa5d93);})[_0xf924('0x17')](function(_0x33a3f9){logger[_0xf924('0x13')]('CreateVoiceQueueReport',_0x33a3f9[_0xf924('0x14')],_0x69132);_0x365314(_0x15e557['error'](0x1f4,_0x33a3f9[_0xf924('0x14')]));});});};exports[_0xf924('0x26')]=function(_0x3c1928){var _0x31b948=this;return new Promise(function(_0x123ac8,_0x3c223d){return db[_0xf924('0x19')][_0xf924('0x27')](_0x3c1928['body'],{'raw':_0x3c1928['options']?_0x3c1928[_0xf924('0x1b')][_0xf924('0x28')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3c1928['options']?_0x3c1928[_0xf924('0x1b')][_0xf924('0x29')]||null:null,'attributes':_0x3c1928[_0xf924('0x1b')]?_0x3c1928[_0xf924('0x1b')][_0xf924('0x20')]||null:null,'limit':_0x3c1928[_0xf924('0x1b')]?_0x3c1928[_0xf924('0x1b')][_0xf924('0x1c')]||null:null})[_0xf924('0x21')](function(_0x2b985b){logger[_0xf924('0x22')](_0xf924('0x26'),_0x3c1928);logger['debug'](_0xf924('0x26'),_0x3c1928,JSON[_0xf924('0x12')](_0x2b985b));_0x123ac8(_0x2b985b);})['catch'](function(_0x5f3f8e){logger[_0xf924('0x13')](_0xf924('0x26'),_0x5f3f8e['message'],_0x3c1928);_0x3c223d(_0x31b948[_0xf924('0x13')](0x1f4,_0x5f3f8e['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index 6dccf40..7fc3660 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 _0x9829=['remove','update','emit','removeListener','register','length','voiceQueueReport:','./voiceQueueReport.events','save'];(function(_0x1a9ca4,_0x5115db){var _0x19a2c2=function(_0x13a68f){while(--_0x13a68f){_0x1a9ca4['push'](_0x1a9ca4['shift']());}};_0x19a2c2(++_0x5115db);}(_0x9829,0xc4));var _0x9982=function(_0x13b02f,_0x462a53){_0x13b02f=_0x13b02f-0x0;var _0x12e9a6=_0x9829[_0x13b02f];return _0x12e9a6;};'use strict';var VoiceQueueReportEvents=require(_0x9982('0x0'));var events=[_0x9982('0x1'),_0x9982('0x2'),_0x9982('0x3')];function createListener(_0x338564,_0x4c01a9){return function(_0x399b6c){_0x4c01a9[_0x9982('0x4')](_0x338564,_0x399b6c);};}function removeListener(_0x2f782a,_0x4bee19){return function(){VoiceQueueReportEvents[_0x9982('0x5')](_0x2f782a,_0x4bee19);};}exports[_0x9982('0x6')]=function(_0x58f8fe){for(var _0x500dfd=0x0,_0x340d62=events[_0x9982('0x7')];_0x500dfd<_0x340d62;_0x500dfd++){var _0x5d0824=events[_0x500dfd];var _0x25f30a=createListener(_0x9982('0x8')+_0x5d0824,_0x58f8fe);VoiceQueueReportEvents['on'](_0x5d0824,_0x25f30a);}}; \ No newline at end of file +var _0xc534=['removeListener','register','length','save','remove'];(function(_0x29ceb8,_0x29d7dc){var _0x3aef62=function(_0x4aed26){while(--_0x4aed26){_0x29ceb8['push'](_0x29ceb8['shift']());}};_0x3aef62(++_0x29d7dc);}(_0xc534,0x1ca));var _0x4c53=function(_0xddfe05,_0x57b987){_0xddfe05=_0xddfe05-0x0;var _0x42b95e=_0xc534[_0xddfe05];return _0x42b95e;};'use strict';var VoiceQueueReportEvents=require('./voiceQueueReport.events');var events=[_0x4c53('0x0'),_0x4c53('0x1'),'update'];function createListener(_0x3426ed,_0x1fb9d7){return function(_0x1bb0cb){_0x1fb9d7['emit'](_0x3426ed,_0x1bb0cb);};}function removeListener(_0xd2f9d9,_0x50f2d0){return function(){VoiceQueueReportEvents[_0x4c53('0x2')](_0xd2f9d9,_0x50f2d0);};}exports[_0x4c53('0x3')]=function(_0x424af0){for(var _0x4432cd=0x0,_0x32d211=events[_0x4c53('0x4')];_0x4432cd<_0x32d211;_0x4432cd++){var _0x1ebbbf=events[_0x4432cd];var _0x46eccd=createListener('voiceQueueReport:'+_0x1ebbbf,_0x424af0);VoiceQueueReportEvents['on'](_0x1ebbbf,_0x46eccd);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index b068111..e7d1b4b 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 _0x53f9=['index','show','post','/:id','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueuesLog.controller','get','isAuthenticated'];(function(_0x1b8ab9,_0x3e0b87){var _0x2ce691=function(_0xdd48cb){while(--_0xdd48cb){_0x1b8ab9['push'](_0x1b8ab9['shift']());}};_0x2ce691(++_0x3e0b87);}(_0x53f9,0xf8));var _0x953f=function(_0x51904f,_0x439694){_0x51904f=_0x51904f-0x0;var _0x24dc27=_0x53f9[_0x51904f];return _0x24dc27;};'use strict';var multer=require(_0x953f('0x0'));var util=require('util');var path=require(_0x953f('0x1'));var timeout=require(_0x953f('0x2'));var express=require(_0x953f('0x3'));var router=express[_0x953f('0x4')]();var fs_extra=require(_0x953f('0x5'));var auth=require(_0x953f('0x6'));var interaction=require(_0x953f('0x7'));var config=require(_0x953f('0x8'));var controller=require(_0x953f('0x9'));router[_0x953f('0xa')]('/',auth[_0x953f('0xb')](),controller[_0x953f('0xc')]);router[_0x953f('0xa')]('/:id',auth[_0x953f('0xb')](),controller[_0x953f('0xd')]);router[_0x953f('0xe')]('/',auth[_0x953f('0xb')](),controller['create']);router['put'](_0x953f('0xf'),auth['isAuthenticated'](),controller[_0x953f('0x10')]);router[_0x953f('0x11')](_0x953f('0xf'),auth[_0x953f('0xb')](),controller[_0x953f('0x12')]);module[_0x953f('0x13')]=router; \ No newline at end of file +var _0x3e22=['get','/:id','isAuthenticated','post','create','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./voiceQueuesLog.controller'];(function(_0x5e9eb9,_0x5e5eaf){var _0x50fda9=function(_0x28c1b6){while(--_0x28c1b6){_0x5e9eb9['push'](_0x5e9eb9['shift']());}};_0x50fda9(++_0x5e5eaf);}(_0x3e22,0x104));var _0x23e2=function(_0x16c57f,_0xe51a89){_0x16c57f=_0x16c57f-0x0;var _0xa8a8f6=_0x3e22[_0x16c57f];return _0xa8a8f6;};'use strict';var multer=require(_0x23e2('0x0'));var util=require(_0x23e2('0x1'));var path=require(_0x23e2('0x2'));var timeout=require(_0x23e2('0x3'));var express=require(_0x23e2('0x4'));var router=express[_0x23e2('0x5')]();var fs_extra=require(_0x23e2('0x6'));var auth=require(_0x23e2('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x23e2('0x8'));var controller=require(_0x23e2('0x9'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x23e2('0xa')](_0x23e2('0xb'),auth[_0x23e2('0xc')](),controller['show']);router[_0x23e2('0xd')]('/',auth[_0x23e2('0xc')](),controller[_0x23e2('0xe')]);router['put'](_0x23e2('0xb'),auth[_0x23e2('0xc')](),controller[_0x23e2('0xf')]);router['delete'](_0x23e2('0xb'),auth[_0x23e2('0xc')](),controller[_0x23e2('0x10')]);module[_0x23e2('0x11')]=router; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js b/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js index c6c2816..627c354 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 _0xc2a0=['sequelize','moment','exports','STRING','DATE','format'];(function(_0x2de4e8,_0x3de149){var _0x261241=function(_0x33b3c4){while(--_0x33b3c4){_0x2de4e8['push'](_0x2de4e8['shift']());}};_0x261241(++_0x3de149);}(_0xc2a0,0x1aa));var _0x0c2a=function(_0x5a3db7,_0x2c1af0){_0x5a3db7=_0x5a3db7-0x0;var _0x52b418=_0xc2a0[_0x5a3db7];return _0x52b418;};'use strict';var Sequelize=require(_0x0c2a('0x0'));var moment=require(_0x0c2a('0x1'));module[_0x0c2a('0x2')]={'time':{'type':Sequelize[_0x0c2a('0x3')]},'callid':{'type':Sequelize[_0x0c2a('0x3')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0x0c2a('0x3')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0x0c2a('0x3')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0x0c2a('0x3')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0x0c2a('0x3')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0x0c2a('0x4')],'allowNull':![],'defaultValue':moment()[_0x0c2a('0x5')]('YYYY-MM-DD\x20HH:mm:ss')}}; \ No newline at end of file +var _0x5956=['DATE','format','YYYY-MM-DD\x20HH:mm:ss','sequelize','moment','exports','STRING'];(function(_0x6dd5c,_0x4bfc19){var _0x5a87fa=function(_0x3b068b){while(--_0x3b068b){_0x6dd5c['push'](_0x6dd5c['shift']());}};_0x5a87fa(++_0x4bfc19);}(_0x5956,0x65));var _0x6595=function(_0x122949,_0x3592b1){_0x122949=_0x122949-0x0;var _0x369d1f=_0x5956[_0x122949];return _0x369d1f;};'use strict';var Sequelize=require(_0x6595('0x0'));var moment=require(_0x6595('0x1'));module[_0x6595('0x2')]={'time':{'type':Sequelize[_0x6595('0x3')]},'callid':{'type':Sequelize[_0x6595('0x3')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0x6595('0x3')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0x6595('0x3')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0x6595('0x3')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0x6595('0x3')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0x6595('0x4')],'allowNull':![],'defaultValue':moment()[_0x6595('0x5')](_0x6595('0x6'))}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js index 3a6dab4..0643ddc 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 _0xd5ba=['VoiceQueuesLog','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','VIRTUAL','filter','merge','where','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','update','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','limit','set','reject','then','destroy','error','name','index'];(function(_0x433795,_0x253d09){var _0x27661e=function(_0x1c4870){while(--_0x1c4870){_0x433795['push'](_0x433795['shift']());}};_0x27661e(++_0x253d09);}(_0xd5ba,0xb2));var _0xad5b=function(_0x1762b4,_0x33d836){_0x1762b4=_0x1762b4-0x0;var _0x29beda=_0xd5ba[_0x1762b4];return _0x29beda;};'use strict';var emlformat=require(_0xad5b('0x0'));var rimraf=require(_0xad5b('0x1'));var zipdir=require(_0xad5b('0x2'));var jsonpatch=require(_0xad5b('0x3'));var rp=require(_0xad5b('0x4'));var moment=require(_0xad5b('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xad5b('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xad5b('0x7'));var ejs=require(_0xad5b('0x8'));var fs=require('fs');var fs_extra=require(_0xad5b('0x9'));var _=require(_0xad5b('0xa'));var squel=require('squel');var crypto=require(_0xad5b('0xb'));var jsforce=require(_0xad5b('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xad5b('0x7'));var querystring=require(_0xad5b('0xd'));var Papa=require(_0xad5b('0xe'));var Redis=require(_0xad5b('0xf'));var authService=require(_0xad5b('0x10'));var qs=require(_0xad5b('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xad5b('0x12'));var logger=require(_0xad5b('0x13'))(_0xad5b('0x14'));var utils=require('../../config/utils');var config=require(_0xad5b('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xad5b('0x16'))['db'];function respondWithStatusCode(_0x5d052a,_0x1b7d54){_0x1b7d54=_0x1b7d54||0xcc;return function(_0x449b6b){if(_0x449b6b){return _0x5d052a[_0xad5b('0x17')](_0x1b7d54);}return _0x5d052a['status'](_0x1b7d54)[_0xad5b('0x18')]();};}function respondWithResult(_0x2144af,_0x985a98){_0x985a98=_0x985a98||0xc8;return function(_0x5c8327){if(_0x5c8327){return _0x2144af[_0xad5b('0x19')](_0x985a98)[_0xad5b('0x1a')](_0x5c8327);}};}function respondWithFilteredResult(_0x1ff27b,_0x59d79d){return function(_0x438601){if(_0x438601){var _0x14bac6=typeof _0x59d79d[_0xad5b('0x1b')]===_0xad5b('0x1c')&&typeof _0x59d79d['limit']===_0xad5b('0x1c');var _0x1b4e84=_0x438601[_0xad5b('0x1d')];var _0x438cb8=_0x14bac6?0x0:_0x59d79d[_0xad5b('0x1b')];var _0xdf408e=_0x14bac6?_0x438601[_0xad5b('0x1d')]:_0x59d79d[_0xad5b('0x1b')]+_0x59d79d[_0xad5b('0x1e')];var _0x5805e8;if(_0xdf408e>=_0x1b4e84){_0xdf408e=_0x1b4e84;_0x5805e8=0xc8;}else{_0x5805e8=0xce;}_0x1ff27b[_0xad5b('0x19')](_0x5805e8);return _0x1ff27b[_0xad5b('0x1f')]('Content-Range',_0x438cb8+'-'+_0xdf408e+'/'+_0x1b4e84)[_0xad5b('0x1a')](_0x438601);}return null;};}function patchUpdates(_0x362997){return function(_0x25233a){try{jsonpatch['apply'](_0x25233a,_0x362997,!![]);}catch(_0x138ff2){return BPromise[_0xad5b('0x20')](_0x138ff2);}return _0x25233a['save']();};}function saveUpdates(_0x18d445,_0x9d5b6d){return function(_0x2627b8){if(_0x2627b8){return _0x2627b8['update'](_0x18d445)[_0xad5b('0x21')](function(_0x29c4d4){return _0x29c4d4;});}return null;};}function removeEntity(_0x36a27a,_0x443b9f){return function(_0x35cb88){if(_0x35cb88){return _0x35cb88[_0xad5b('0x22')]()[_0xad5b('0x21')](function(){_0x36a27a['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5a1073,_0xe9f74d){return function(_0x1b684d){if(!_0x1b684d){_0x5a1073['sendStatus'](0x194);}return _0x1b684d;};}function handleError(_0x31dc33,_0x2eb4f6){_0x2eb4f6=_0x2eb4f6||0x1f4;return function(_0x418676){logger[_0xad5b('0x23')](_0x418676['stack']);if(_0x418676[_0xad5b('0x24')]){delete _0x418676['name'];}_0x31dc33[_0xad5b('0x19')](_0x2eb4f6)['send'](_0x418676);};}exports[_0xad5b('0x25')]=function(_0x51aee4,_0x2818c9){var _0x134480={},_0x5bd1f6={},_0x2b1034={'count':0x0,'rows':[]};var _0x2e96c1=_['map'](db[_0xad5b('0x26')][_0xad5b('0x27')],function(_0x2a206e){return{'name':_0x2a206e[_0xad5b('0x28')],'type':_0x2a206e[_0xad5b('0x29')][_0xad5b('0x2a')]};});_0x5bd1f6[_0xad5b('0x2b')]=_[_0xad5b('0x2c')](_0x2e96c1,_0xad5b('0x24'));_0x5bd1f6[_0xad5b('0x2d')]=_[_0xad5b('0x2e')](_0x51aee4[_0xad5b('0x2d')]);_0x5bd1f6[_0xad5b('0x2f')]=_[_0xad5b('0x30')](_0x5bd1f6[_0xad5b('0x2b')],_0x5bd1f6[_0xad5b('0x2d')]);_0x134480[_0xad5b('0x31')]=_[_0xad5b('0x30')](_0x5bd1f6['model'],qs['fields'](_0x51aee4[_0xad5b('0x2d')][_0xad5b('0x32')]));_0x134480[_0xad5b('0x31')]=_0x134480[_0xad5b('0x31')][_0xad5b('0x33')]?_0x134480[_0xad5b('0x31')]:_0x5bd1f6[_0xad5b('0x2b')];if(!_0x51aee4[_0xad5b('0x2d')][_0xad5b('0x34')](_0xad5b('0x35'))){_0x134480[_0xad5b('0x1e')]=qs[_0xad5b('0x1e')](_0x51aee4[_0xad5b('0x2d')][_0xad5b('0x1e')]);_0x134480[_0xad5b('0x1b')]=qs['offset'](_0x51aee4[_0xad5b('0x2d')]['offset']);}_0x134480[_0xad5b('0x36')]=qs[_0xad5b('0x37')](_0x51aee4[_0xad5b('0x2d')][_0xad5b('0x37')]);_0x134480['where']=qs['filters'](_['pick'](_0x51aee4[_0xad5b('0x2d')],_0x5bd1f6[_0xad5b('0x2f')]),_0x2e96c1);if(_0x51aee4[_0xad5b('0x2d')]['filter']){_0x134480['where']=_['merge'](_0x134480['where'],{'$or':_[_0xad5b('0x2c')](_0x2e96c1,function(_0x4bc528){if(_0x4bc528[_0xad5b('0x29')]!==_0xad5b('0x38')){var _0x5ccb3e={};_0x5ccb3e[_0x4bc528[_0xad5b('0x24')]]={'$like':'%'+_0x51aee4[_0xad5b('0x2d')][_0xad5b('0x39')]+'%'};return _0x5ccb3e;}})});}_0x134480=_[_0xad5b('0x3a')]({},_0x134480,_0x51aee4['options']);var _0x5f4265={'where':_0x134480[_0xad5b('0x3b')]};return db[_0xad5b('0x26')]['count'](_0x5f4265)[_0xad5b('0x21')](function(_0x37f2f2){_0x2b1034[_0xad5b('0x1d')]=_0x37f2f2;if(_0x51aee4[_0xad5b('0x2d')][_0xad5b('0x3c')]){_0x134480[_0xad5b('0x3d')]=[{'all':!![]}];}return db['VoiceQueuesLog'][_0xad5b('0x3e')](_0x134480);})[_0xad5b('0x21')](function(_0x556a56){_0x2b1034[_0xad5b('0x3f')]=_0x556a56;return _0x2b1034;})[_0xad5b('0x21')](respondWithFilteredResult(_0x2818c9,_0x134480))[_0xad5b('0x40')](handleError(_0x2818c9,null));};exports[_0xad5b('0x41')]=function(_0x448e49,_0x47ed92){var _0x411608={'raw':!![],'where':{'id':_0x448e49[_0xad5b('0x42')]['id']}},_0x15f2f3={};_0x15f2f3['model']=_['keys'](db[_0xad5b('0x26')][_0xad5b('0x27')]);_0x15f2f3[_0xad5b('0x2d')]=_[_0xad5b('0x2e')](_0x448e49[_0xad5b('0x2d')]);_0x15f2f3['filters']=_['intersection'](_0x15f2f3[_0xad5b('0x2b')],_0x15f2f3[_0xad5b('0x2d')]);_0x411608[_0xad5b('0x31')]=_['intersection'](_0x15f2f3[_0xad5b('0x2b')],qs[_0xad5b('0x32')](_0x448e49[_0xad5b('0x2d')][_0xad5b('0x32')]));_0x411608[_0xad5b('0x31')]=_0x411608[_0xad5b('0x31')][_0xad5b('0x33')]?_0x411608[_0xad5b('0x31')]:_0x15f2f3[_0xad5b('0x2b')];if(_0x448e49[_0xad5b('0x2d')][_0xad5b('0x3c')]){_0x411608[_0xad5b('0x3d')]=[{'all':!![]}];}_0x411608=_[_0xad5b('0x3a')]({},_0x411608,_0x448e49[_0xad5b('0x43')]);return db['VoiceQueuesLog'][_0xad5b('0x44')](_0x411608)[_0xad5b('0x21')](handleEntityNotFound(_0x47ed92,null))[_0xad5b('0x21')](respondWithResult(_0x47ed92,null))[_0xad5b('0x40')](handleError(_0x47ed92,null));};exports['create']=function(_0x17ac67,_0x2e5a23){return db[_0xad5b('0x26')][_0xad5b('0x45')](_0x17ac67[_0xad5b('0x46')],{})[_0xad5b('0x21')](respondWithResult(_0x2e5a23,0xc9))[_0xad5b('0x40')](handleError(_0x2e5a23,null));};exports[_0xad5b('0x47')]=function(_0x87a73d,_0xc860a7){if(_0x87a73d[_0xad5b('0x46')]['id']){delete _0x87a73d['body']['id'];}return db[_0xad5b('0x26')]['find']({'where':{'id':_0x87a73d[_0xad5b('0x42')]['id']}})['then'](handleEntityNotFound(_0xc860a7,null))[_0xad5b('0x21')](saveUpdates(_0x87a73d['body'],null))['then'](respondWithResult(_0xc860a7,null))[_0xad5b('0x40')](handleError(_0xc860a7,null));};exports[_0xad5b('0x22')]=function(_0x3113b1,_0x387cd5){return db[_0xad5b('0x26')][_0xad5b('0x44')]({'where':{'id':_0x3113b1['params']['id']}})[_0xad5b('0x21')](handleEntityNotFound(_0x387cd5,null))[_0xad5b('0x21')](removeEntity(_0x387cd5,null))[_0xad5b('0x40')](handleError(_0x387cd5,null));}; \ No newline at end of file +var _0xa25a=['rows','catch','params','length','options','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','ejs','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','VoiceQueuesLog','rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','model','attributes','fields','nolimit','sort','where','pick','filter','VIRTUAL','merge','includeAll','include','findAll'];(function(_0x50bd62,_0x217adb){var _0x3384f3=function(_0x45813a){while(--_0x45813a){_0x50bd62['push'](_0x50bd62['shift']());}};_0x3384f3(++_0x217adb);}(_0xa25a,0x134));var _0xaa25=function(_0x4fe37e,_0xce833c){_0x4fe37e=_0x4fe37e-0x0;var _0x1991f7=_0xa25a[_0x4fe37e];return _0x1991f7;};'use strict';var emlformat=require(_0xaa25('0x0'));var rimraf=require(_0xaa25('0x1'));var zipdir=require(_0xaa25('0x2'));var jsonpatch=require(_0xaa25('0x3'));var rp=require(_0xaa25('0x4'));var moment=require('moment');var BPromise=require(_0xaa25('0x5'));var Mustache=require(_0xaa25('0x6'));var util=require(_0xaa25('0x7'));var path=require('path');var sox=require(_0xaa25('0x8'));var csv=require('to-csv');var ejs=require(_0xaa25('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0xaa25('0xa'));var jsforce=require(_0xaa25('0xb'));var deskjs=require(_0xaa25('0xc'));var toCsv=require(_0xaa25('0xd'));var querystring=require(_0xaa25('0xe'));var Papa=require(_0xaa25('0xf'));var Redis=require(_0xaa25('0x10'));var authService=require(_0xaa25('0x11'));var qs=require(_0xaa25('0x12'));var as=require(_0xaa25('0x13'));var hardwareService=require(_0xaa25('0x14'));var logger=require(_0xaa25('0x15'))(_0xaa25('0x16'));var utils=require(_0xaa25('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3a7a89,_0x13e123){_0x13e123=_0x13e123||0xcc;return function(_0x3cdc97){if(_0x3cdc97){return _0x3a7a89[_0xaa25('0x18')](_0x13e123);}return _0x3a7a89[_0xaa25('0x19')](_0x13e123)[_0xaa25('0x1a')]();};}function respondWithResult(_0x11a2ed,_0x1e5c50){_0x1e5c50=_0x1e5c50||0xc8;return function(_0x1ea8bd){if(_0x1ea8bd){return _0x11a2ed[_0xaa25('0x19')](_0x1e5c50)[_0xaa25('0x1b')](_0x1ea8bd);}};}function respondWithFilteredResult(_0x3fc614,_0x722bea){return function(_0x5ed725){if(_0x5ed725){var _0x2db988=typeof _0x722bea[_0xaa25('0x1c')]===_0xaa25('0x1d')&&typeof _0x722bea[_0xaa25('0x1e')]===_0xaa25('0x1d');var _0x2cf3cd=_0x5ed725['count'];var _0x57c78a=_0x2db988?0x0:_0x722bea[_0xaa25('0x1c')];var _0x152f5a=_0x2db988?_0x5ed725[_0xaa25('0x1f')]:_0x722bea['offset']+_0x722bea[_0xaa25('0x1e')];var _0x3383a7;if(_0x152f5a>=_0x2cf3cd){_0x152f5a=_0x2cf3cd;_0x3383a7=0xc8;}else{_0x3383a7=0xce;}_0x3fc614[_0xaa25('0x19')](_0x3383a7);return _0x3fc614['set'](_0xaa25('0x20'),_0x57c78a+'-'+_0x152f5a+'/'+_0x2cf3cd)[_0xaa25('0x1b')](_0x5ed725);}return null;};}function patchUpdates(_0x5ee48b){return function(_0x2a2f42){try{jsonpatch[_0xaa25('0x21')](_0x2a2f42,_0x5ee48b,!![]);}catch(_0x3d14fc){return BPromise[_0xaa25('0x22')](_0x3d14fc);}return _0x2a2f42[_0xaa25('0x23')]();};}function saveUpdates(_0x465669,_0x506e7a){return function(_0xd9b88c){if(_0xd9b88c){return _0xd9b88c[_0xaa25('0x24')](_0x465669)[_0xaa25('0x25')](function(_0x544c02){return _0x544c02;});}return null;};}function removeEntity(_0x5bdc85,_0x2ff71e){return function(_0x17956a){if(_0x17956a){return _0x17956a[_0xaa25('0x26')]()[_0xaa25('0x25')](function(){_0x5bdc85['status'](0xcc)[_0xaa25('0x1a')]();});}};}function handleEntityNotFound(_0x38dcb1,_0x360b5c){return function(_0x43ebbd){if(!_0x43ebbd){_0x38dcb1[_0xaa25('0x18')](0x194);}return _0x43ebbd;};}function handleError(_0x117d7e,_0x50ed5f){_0x50ed5f=_0x50ed5f||0x1f4;return function(_0x3f97ed){logger[_0xaa25('0x27')](_0x3f97ed[_0xaa25('0x28')]);if(_0x3f97ed[_0xaa25('0x29')]){delete _0x3f97ed['name'];}_0x117d7e[_0xaa25('0x19')](_0x50ed5f)[_0xaa25('0x2a')](_0x3f97ed);};}exports[_0xaa25('0x2b')]=function(_0x218333,_0x5ba4ff){var _0x150d43={},_0x1d9bdc={},_0x57eccf={'count':0x0,'rows':[]};var _0x152d43=_['map'](db[_0xaa25('0x2c')][_0xaa25('0x2d')],function(_0xd18d2c){return{'name':_0xd18d2c[_0xaa25('0x2e')],'type':_0xd18d2c[_0xaa25('0x2f')][_0xaa25('0x30')]};});_0x1d9bdc['model']=_[_0xaa25('0x31')](_0x152d43,'name');_0x1d9bdc[_0xaa25('0x32')]=_[_0xaa25('0x33')](_0x218333['query']);_0x1d9bdc[_0xaa25('0x34')]=_[_0xaa25('0x35')](_0x1d9bdc[_0xaa25('0x36')],_0x1d9bdc[_0xaa25('0x32')]);_0x150d43[_0xaa25('0x37')]=_['intersection'](_0x1d9bdc['model'],qs['fields'](_0x218333[_0xaa25('0x32')][_0xaa25('0x38')]));_0x150d43[_0xaa25('0x37')]=_0x150d43[_0xaa25('0x37')]['length']?_0x150d43[_0xaa25('0x37')]:_0x1d9bdc[_0xaa25('0x36')];if(!_0x218333[_0xaa25('0x32')]['hasOwnProperty'](_0xaa25('0x39'))){_0x150d43['limit']=qs[_0xaa25('0x1e')](_0x218333[_0xaa25('0x32')]['limit']);_0x150d43[_0xaa25('0x1c')]=qs[_0xaa25('0x1c')](_0x218333[_0xaa25('0x32')][_0xaa25('0x1c')]);}_0x150d43['order']=qs[_0xaa25('0x3a')](_0x218333['query'][_0xaa25('0x3a')]);_0x150d43[_0xaa25('0x3b')]=qs['filters'](_[_0xaa25('0x3c')](_0x218333['query'],_0x1d9bdc[_0xaa25('0x34')]),_0x152d43);if(_0x218333[_0xaa25('0x32')][_0xaa25('0x3d')]){_0x150d43[_0xaa25('0x3b')]=_['merge'](_0x150d43[_0xaa25('0x3b')],{'$or':_[_0xaa25('0x31')](_0x152d43,function(_0x741425){if(_0x741425[_0xaa25('0x2f')]!==_0xaa25('0x3e')){var _0x219f8c={};_0x219f8c[_0x741425[_0xaa25('0x29')]]={'$like':'%'+_0x218333[_0xaa25('0x32')][_0xaa25('0x3d')]+'%'};return _0x219f8c;}})});}_0x150d43=_[_0xaa25('0x3f')]({},_0x150d43,_0x218333['options']);var _0x12525c={'where':_0x150d43[_0xaa25('0x3b')]};return db['VoiceQueuesLog']['count'](_0x12525c)[_0xaa25('0x25')](function(_0x374ae7){_0x57eccf[_0xaa25('0x1f')]=_0x374ae7;if(_0x218333[_0xaa25('0x32')][_0xaa25('0x40')]){_0x150d43[_0xaa25('0x41')]=[{'all':!![]}];}return db[_0xaa25('0x2c')][_0xaa25('0x42')](_0x150d43);})[_0xaa25('0x25')](function(_0x58b5ef){_0x57eccf[_0xaa25('0x43')]=_0x58b5ef;return _0x57eccf;})[_0xaa25('0x25')](respondWithFilteredResult(_0x5ba4ff,_0x150d43))[_0xaa25('0x44')](handleError(_0x5ba4ff,null));};exports['show']=function(_0x4d0815,_0x383f57){var _0x4040b6={'raw':!![],'where':{'id':_0x4d0815[_0xaa25('0x45')]['id']}},_0x51c9ba={};_0x51c9ba['model']=_[_0xaa25('0x33')](db[_0xaa25('0x2c')]['rawAttributes']);_0x51c9ba[_0xaa25('0x32')]=_[_0xaa25('0x33')](_0x4d0815['query']);_0x51c9ba[_0xaa25('0x34')]=_[_0xaa25('0x35')](_0x51c9ba[_0xaa25('0x36')],_0x51c9ba[_0xaa25('0x32')]);_0x4040b6[_0xaa25('0x37')]=_[_0xaa25('0x35')](_0x51c9ba[_0xaa25('0x36')],qs['fields'](_0x4d0815[_0xaa25('0x32')][_0xaa25('0x38')]));_0x4040b6[_0xaa25('0x37')]=_0x4040b6['attributes'][_0xaa25('0x46')]?_0x4040b6[_0xaa25('0x37')]:_0x51c9ba[_0xaa25('0x36')];if(_0x4d0815[_0xaa25('0x32')]['includeAll']){_0x4040b6[_0xaa25('0x41')]=[{'all':!![]}];}_0x4040b6=_[_0xaa25('0x3f')]({},_0x4040b6,_0x4d0815[_0xaa25('0x47')]);return db[_0xaa25('0x2c')]['find'](_0x4040b6)[_0xaa25('0x25')](handleEntityNotFound(_0x383f57,null))[_0xaa25('0x25')](respondWithResult(_0x383f57,null))[_0xaa25('0x44')](handleError(_0x383f57,null));};exports['create']=function(_0x4503e0,_0x26d682){return db['VoiceQueuesLog'][_0xaa25('0x48')](_0x4503e0[_0xaa25('0x49')],{})[_0xaa25('0x25')](respondWithResult(_0x26d682,0xc9))['catch'](handleError(_0x26d682,null));};exports[_0xaa25('0x24')]=function(_0x3518fd,_0x4ab3c0){if(_0x3518fd[_0xaa25('0x49')]['id']){delete _0x3518fd[_0xaa25('0x49')]['id'];}return db[_0xaa25('0x2c')][_0xaa25('0x4a')]({'where':{'id':_0x3518fd[_0xaa25('0x45')]['id']}})['then'](handleEntityNotFound(_0x4ab3c0,null))['then'](saveUpdates(_0x3518fd[_0xaa25('0x49')],null))[_0xaa25('0x25')](respondWithResult(_0x4ab3c0,null))[_0xaa25('0x44')](handleError(_0x4ab3c0,null));};exports[_0xaa25('0x26')]=function(_0x52b8b4,_0x2a9954){return db[_0xaa25('0x2c')][_0xaa25('0x4a')]({'where':{'id':_0x52b8b4[_0xaa25('0x45')]['id']}})[_0xaa25('0x25')](handleEntityNotFound(_0x2a9954,null))[_0xaa25('0x25')](removeEntity(_0x2a9954,null))[_0xaa25('0x44')](handleError(_0x2a9954,null));}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index 3caf3d2..77d91db 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 _0xb01a=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceQueuesLog.attributes','define','voice_queues_log','event_dtm','event','dtm'];(function(_0x56b29a,_0x446611){var _0x26ba7d=function(_0x224cbe){while(--_0x224cbe){_0x56b29a['push'](_0x56b29a['shift']());}};_0x26ba7d(++_0x446611);}(_0xb01a,0xe0));var _0xab01=function(_0x2a744b,_0x393bbc){_0x2a744b=_0x2a744b-0x0;var _0x430a5e=_0xb01a[_0x2a744b];return _0x430a5e;};'use strict';var _=require(_0xab01('0x0'));var util=require(_0xab01('0x1'));var logger=require(_0xab01('0x2'))(_0xab01('0x3'));var moment=require(_0xab01('0x4'));var BPromise=require(_0xab01('0x5'));var rp=require(_0xab01('0x6'));var fs=require('fs');var path=require(_0xab01('0x7'));var rimraf=require(_0xab01('0x8'));var config=require(_0xab01('0x9'));var attributes=require(_0xab01('0xa'));module['exports']=function(_0x502e33,_0x4ff501){return _0x502e33[_0xab01('0xb')]('VoiceQueuesLog',attributes,{'tableName':_0xab01('0xc'),'paranoid':![],'indexes':[{'name':_0xab01('0xd'),'fields':[_0xab01('0xe'),_0xab01('0xf')]}],'timestamps':![]});}; \ No newline at end of file +var _0x3cbd=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceQueuesLog.attributes','exports','define','voice_queues_log','event_dtm','event','dtm','util','../../config/logger'];(function(_0x26a74d,_0x37ecfc){var _0xcbb1a3=function(_0x24b978){while(--_0x24b978){_0x26a74d['push'](_0x26a74d['shift']());}};_0xcbb1a3(++_0x37ecfc);}(_0x3cbd,0x1c0));var _0xd3cb=function(_0x4ac689,_0x16a8cd){_0x4ac689=_0x4ac689-0x0;var _0x2c5d83=_0x3cbd[_0x4ac689];return _0x2c5d83;};'use strict';var _=require('lodash');var util=require(_0xd3cb('0x0'));var logger=require(_0xd3cb('0x1'))('api');var moment=require(_0xd3cb('0x2'));var BPromise=require(_0xd3cb('0x3'));var rp=require(_0xd3cb('0x4'));var fs=require('fs');var path=require(_0xd3cb('0x5'));var rimraf=require(_0xd3cb('0x6'));var config=require(_0xd3cb('0x7'));var attributes=require(_0xd3cb('0x8'));module[_0xd3cb('0x9')]=function(_0x13f7ab,_0x3bfa20){return _0x13f7ab[_0xd3cb('0xa')]('VoiceQueuesLog',attributes,{'tableName':_0xd3cb('0xb'),'paranoid':![],'indexes':[{'name':_0xd3cb('0xc'),'fields':[_0xd3cb('0xd'),_0xd3cb('0xe')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js b/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js index 2d1d19b..ae807f6 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 _0x0d98=['request\x20sent','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','request','then','VoiceQueuesLog,\x20%s,\x20%s'];(function(_0x4a2b0b,_0xf81dc7){var _0x2db990=function(_0x2896d5){while(--_0x2896d5){_0x4a2b0b['push'](_0x4a2b0b['shift']());}};_0x2db990(++_0xf81dc7);}(_0x0d98,0x149));var _0x80d9=function(_0x3ee832,_0x4ac779){_0x3ee832=_0x3ee832-0x0;var _0x22f0e8=_0x0d98[_0x3ee832];return _0x22f0e8;};'use strict';var _=require(_0x80d9('0x0'));var util=require(_0x80d9('0x1'));var moment=require(_0x80d9('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x80d9('0x3'))['db'];var utils=require(_0x80d9('0x4'));var logger=require(_0x80d9('0x5'))(_0x80d9('0x6'));var config=require('../../config/environment');var jayson=require(_0x80d9('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5e5f6b,_0x45f2f1,_0xb8d05){return new BPromise(function(_0x5cc7b7,_0x4f3fe9){return client[_0x80d9('0x8')](_0x5e5f6b,_0xb8d05)[_0x80d9('0x9')](function(_0x4e874d){logger['info'](_0x80d9('0xa'),_0x45f2f1,_0x80d9('0xb'));logger['debug'](_0x80d9('0xc'),_0x45f2f1,_0x80d9('0xb'),JSON[_0x80d9('0xd')](_0x4e874d));if(_0x4e874d[_0x80d9('0xe')]){if(_0x4e874d[_0x80d9('0xe')][_0x80d9('0xf')]===0x1f4){logger['error'](_0x80d9('0xa'),_0x45f2f1,_0x4e874d[_0x80d9('0xe')]['message']);return _0x4f3fe9(_0x4e874d[_0x80d9('0xe')][_0x80d9('0x10')]);}logger[_0x80d9('0xe')]('VoiceQueuesLog,\x20%s,\x20%s',_0x45f2f1,_0x4e874d[_0x80d9('0xe')]['message']);return _0x5cc7b7(_0x4e874d[_0x80d9('0xe')][_0x80d9('0x10')]);}else{logger[_0x80d9('0x11')](_0x80d9('0xa'),_0x45f2f1,'request\x20sent');_0x5cc7b7(_0x4e874d[_0x80d9('0x12')][_0x80d9('0x10')]);}})[_0x80d9('0x13')](function(_0xa8c7e9){logger[_0x80d9('0xe')](_0x80d9('0xa'),_0x45f2f1,_0xa8c7e9);_0x4f3fe9(_0xa8c7e9);});});} \ No newline at end of file +var _0x4058=['request','then','info','request\x20sent','debug','stringify','VoiceQueuesLog,\x20%s,\x20%s','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','client','http'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4058,0x129));var _0x8405=function(_0x413894,_0x308c37){_0x413894=_0x413894-0x0;var _0x20e43d=_0x4058[_0x413894];return _0x20e43d;};'use strict';var _=require(_0x8405('0x0'));var util=require(_0x8405('0x1'));var moment=require(_0x8405('0x2'));var BPromise=require(_0x8405('0x3'));var rs=require(_0x8405('0x4'));var fs=require('fs');var Redis=require(_0x8405('0x5'));var db=require(_0x8405('0x6'))['db'];var utils=require(_0x8405('0x7'));var logger=require(_0x8405('0x8'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x8405('0x9')][_0x8405('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3d9bf6,_0x1322e5,_0x1cb061){return new BPromise(function(_0x479c97,_0x16d810){return client[_0x8405('0xb')](_0x3d9bf6,_0x1cb061)[_0x8405('0xc')](function(_0x53bd7c){logger[_0x8405('0xd')]('VoiceQueuesLog,\x20%s,\x20%s',_0x1322e5,_0x8405('0xe'));logger[_0x8405('0xf')]('VoiceQueuesLog,\x20%s,\x20%s,\x20%s',_0x1322e5,_0x8405('0xe'),JSON[_0x8405('0x10')](_0x53bd7c));if(_0x53bd7c['error']){if(_0x53bd7c['error']['code']===0x1f4){logger['error'](_0x8405('0x11'),_0x1322e5,_0x53bd7c['error']['message']);return _0x16d810(_0x53bd7c['error']['message']);}logger['error'](_0x8405('0x11'),_0x1322e5,_0x53bd7c[_0x8405('0x12')]['message']);return _0x479c97(_0x53bd7c[_0x8405('0x12')][_0x8405('0x13')]);}else{logger[_0x8405('0xd')](_0x8405('0x11'),_0x1322e5,'request\x20sent');_0x479c97(_0x53bd7c[_0x8405('0x14')][_0x8405('0x13')]);}})[_0x8405('0x15')](function(_0x30cef7){logger[_0x8405('0x12')](_0x8405('0x11'),_0x1322e5,_0x30cef7);_0x16d810(_0x30cef7);});});} \ No newline at end of file diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index 507840a..578bfad 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 _0x0d97=['../../config/environment','./voiceRecording.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/download','/:id/downloads','downloads','/:id/transcribe','downloadTranscribe','post','runTranscribe','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x44377b,_0x41e8c4){var _0x217201=function(_0x439424){while(--_0x439424){_0x44377b['push'](_0x44377b['shift']());}};_0x217201(++_0x41e8c4);}(_0x0d97,0x6c));var _0x70d9=function(_0x42993f,_0x46b735){_0x42993f=_0x42993f-0x0;var _0x3a2677=_0x0d97[_0x42993f];return _0x3a2677;};'use strict';var multer=require(_0x70d9('0x0'));var util=require('util');var path=require(_0x70d9('0x1'));var timeout=require(_0x70d9('0x2'));var express=require(_0x70d9('0x3'));var router=express[_0x70d9('0x4')]();var fs_extra=require(_0x70d9('0x5'));var auth=require(_0x70d9('0x6'));var interaction=require(_0x70d9('0x7'));var config=require(_0x70d9('0x8'));var controller=require(_0x70d9('0x9'));router[_0x70d9('0xa')]('/',auth[_0x70d9('0xb')](),controller[_0x70d9('0xc')]);router['get'](_0x70d9('0xd'),auth[_0x70d9('0xb')](),controller[_0x70d9('0xe')]);router['get'](_0x70d9('0xf'),auth['isAuthenticated'](),controller[_0x70d9('0x10')]);router['get'](_0x70d9('0x11'),auth[_0x70d9('0xb')](),controller['download']);router['get'](_0x70d9('0x12'),controller[_0x70d9('0x13')]);router[_0x70d9('0xa')](_0x70d9('0x14'),auth[_0x70d9('0xb')](),controller[_0x70d9('0x15')]);router[_0x70d9('0x16')]('/',auth[_0x70d9('0xb')](),controller['create']);router[_0x70d9('0x16')]('/:id/transcribe',auth[_0x70d9('0xb')](),controller[_0x70d9('0x17')]);router[_0x70d9('0x18')](_0x70d9('0xf'),auth[_0x70d9('0xb')](),controller[_0x70d9('0x19')]);router[_0x70d9('0x1a')](_0x70d9('0xf'),auth[_0x70d9('0xb')](),controller[_0x70d9('0x1b')]);module[_0x70d9('0x1c')]=router; \ No newline at end of file +var _0x3c05=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceRecording.controller','get','isAuthenticated','/describe','describe','/:id','show','download','/:id/downloads','downloads','/:id/transcribe','downloadTranscribe','create','post','runTranscribe','put','update','delete','destroy','exports','multer','path'];(function(_0x5884a7,_0x2cb4ba){var _0x355852=function(_0x2db756){while(--_0x2db756){_0x5884a7['push'](_0x5884a7['shift']());}};_0x355852(++_0x2cb4ba);}(_0x3c05,0xc9));var _0x53c0=function(_0x4c59e2,_0x2ee8dd){_0x4c59e2=_0x4c59e2-0x0;var _0x555b44=_0x3c05[_0x4c59e2];return _0x555b44;};'use strict';var multer=require(_0x53c0('0x0'));var util=require('util');var path=require(_0x53c0('0x1'));var timeout=require(_0x53c0('0x2'));var express=require(_0x53c0('0x3'));var router=express[_0x53c0('0x4')]();var fs_extra=require(_0x53c0('0x5'));var auth=require(_0x53c0('0x6'));var interaction=require(_0x53c0('0x7'));var config=require(_0x53c0('0x8'));var controller=require(_0x53c0('0x9'));router[_0x53c0('0xa')]('/',auth[_0x53c0('0xb')](),controller['index']);router['get'](_0x53c0('0xc'),auth[_0x53c0('0xb')](),controller[_0x53c0('0xd')]);router['get'](_0x53c0('0xe'),auth[_0x53c0('0xb')](),controller[_0x53c0('0xf')]);router[_0x53c0('0xa')]('/:id/download',auth['isAuthenticated'](),controller[_0x53c0('0x10')]);router[_0x53c0('0xa')](_0x53c0('0x11'),controller[_0x53c0('0x12')]);router['get'](_0x53c0('0x13'),auth[_0x53c0('0xb')](),controller[_0x53c0('0x14')]);router['post']('/',auth[_0x53c0('0xb')](),controller[_0x53c0('0x15')]);router[_0x53c0('0x16')](_0x53c0('0x13'),auth['isAuthenticated'](),controller[_0x53c0('0x17')]);router[_0x53c0('0x18')]('/:id',auth['isAuthenticated'](),controller[_0x53c0('0x19')]);router[_0x53c0('0x1a')](_0x53c0('0xe'),auth[_0x53c0('0xb')](),controller[_0x53c0('0x1b')]);module[_0x53c0('0x1c')]=router; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.attributes.js b/server/api/voiceRecording/voiceRecording.attributes.js index d5001a4..c99d3ea 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(_0x487b0c,_0x14ff74){var _0x1adbdc=function(_0x2e7b9d){while(--_0x2e7b9d){_0x487b0c['push'](_0x487b0c['shift']());}};_0x1adbdc(++_0x14ff74);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2763f2,_0x416af8){_0x2763f2=_0x2763f2-0x0;var _0x3ef471=_0xa9e0[_0x2763f2];return _0x3ef471;};'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(_0x525c7b,_0x488fcc){var _0x27b33e=function(_0x56d43b){while(--_0x56d43b){_0x525c7b['push'](_0x525c7b['shift']());}};_0x27b33e(++_0x488fcc);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf71120,_0x25b7f9){_0xf71120=_0xf71120-0x0;var _0xbe2fd3=_0xa9e0[_0xf71120];return _0xbe2fd3;};'use strict';var Sequelize=require(_0x0a9e('0x0'));var moment=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));module['exports']={'format':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x0a9e('0x3')]('value')?path[_0x0a9e('0x4')](this[_0x0a9e('0x3')](_0x0a9e('0x5'))):undefined;}},'uniqueid':{'type':Sequelize[_0x0a9e('0x6')]},'channel':{'type':Sequelize[_0x0a9e('0x6')],'set':function(_0x57b080){if(_0x57b080){this[_0x0a9e('0x7')](_0x0a9e('0x8'),_0x57b080);this[_0x0a9e('0x7')]('membername',_0x57b080['split'](/\/|-/)[0x1]);}}},'membername':{'type':Sequelize[_0x0a9e('0x6')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x0a9e('0x6')]},'connectedlinename':{'type':Sequelize[_0x0a9e('0x6')]},'accountcode':{'type':Sequelize[_0x0a9e('0x6')]},'context':{'type':Sequelize[_0x0a9e('0x6')]},'exten':{'type':Sequelize[_0x0a9e('0x6')]},'value':{'type':Sequelize[_0x0a9e('0x6')]},'type':{'type':Sequelize['STRING']},'rating':{'type':Sequelize['INTEGER'],'validate':{'max':0x5,'min':0x0}},'queue':{'type':Sequelize['STRING']},'userDisposition':{'type':Sequelize['STRING']},'userSecondDisposition':{'type':Sequelize[_0x0a9e('0x6')]},'userThirdDisposition':{'type':Sequelize[_0x0a9e('0x6')]},'location':{'type':Sequelize[_0x0a9e('0x9')]},'transcribeName':{'type':Sequelize[_0x0a9e('0x6')]},'transcribeStatus':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':_0x0a9e('0xa')},'fileUri':{'type':Sequelize['TEXT']},'fileText':{'type':Sequelize[_0x0a9e('0x9')]},'failureReason':{'type':Sequelize[_0x0a9e('0x9')]},'sentiment':{'type':Sequelize[_0x0a9e('0x6')]},'sPositive':{'type':Sequelize[_0x0a9e('0xb')]},'sNegative':{'type':Sequelize[_0x0a9e('0xb')]},'sNeutral':{'type':Sequelize[_0x0a9e('0xb')]},'sMixed':{'type':Sequelize['FLOAT']},'tempSentiment':{'type':Sequelize[_0x0a9e('0xc')],'defaultValue':![]},'createdAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x0a9e('0x3')]('createdAt'))[_0x0a9e('0xd')](_0x0a9e('0xe'))['toString']();}},'updatedAt':{'type':Sequelize[_0x0a9e('0xf')],'get':function(){return moment(this['getDataValue'](_0x0a9e('0x10')))[_0x0a9e('0xd')](_0x0a9e('0xe'))[_0x0a9e('0x11')]();}}}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.controller.js b/server/api/voiceRecording/voiceRecording.controller.js index b611c1c..b9bcf7f 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 _0x6c33=['[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','updateAttributes','writeFile','downloadTranscribe','fileText','root','/server/files/transcribes/transcribe_','.txt','Transcript\x20not\x20available','zip-dir','request-promise','moment','bluebird','mustache','to-csv','ejs','fs-extra','squel','desk.js','uuid/v4','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','sendStatus','error','stack','name','index','map','VoiceRecording','rawAttributes','fieldName','type','key','differenceBy','format','query','filters','intersection','model','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','create','body','find','uniqueid','value','%s.cypher','existsSync','recording','Sequelize','ValidationError','VoiceRecording\x20not\x20found','extname','unlink','send','Not\x20found','../../components/encryptor','sequelize','MD5','$and','push','decryptFile','secrets','filename','download','destroy','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','listBuckets','upload','TranscribeService','startTranscriptionJob','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','basename','readFileSync','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','bucket','Location','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','TranscriptionJobName','runTranscribe','findOne','Setting','transcribe','transcribeAccountId','transcribeRegion','language','Transcribe\x20not\x20configured','runSentiment','sentiment','sentimentAccountId','sentimentRegion','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','Cloud\x20Provider\x20not\x20available','data1','Cloud\x20Provider\x20not\x20configured','data2','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','transcribeStatus','NEW'];(function(_0x7709d5,_0x3a0bc4){var _0x36e23c=function(_0xaeb4e3){while(--_0xaeb4e3){_0x7709d5['push'](_0x7709d5['shift']());}};_0x36e23c(++_0x3a0bc4);}(_0x6c33,0x1cc));var _0x36c3=function(_0x46b057,_0x25aa56){_0x46b057=_0x46b057-0x0;var _0x25cf84=_0x6c33[_0x46b057];return _0x25cf84;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x36c3('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x36c3('0x1'));var moment=require(_0x36c3('0x2'));var BPromise=require(_0x36c3('0x3'));var Mustache=require(_0x36c3('0x4'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x36c3('0x5'));var ejs=require(_0x36c3('0x6'));var fs=require('fs');var fs_extra=require(_0x36c3('0x7'));var _=require('lodash');var squel=require(_0x36c3('0x8'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x36c3('0x9'));var toCsv=require(_0x36c3('0x5'));var querystring=require('querystring');var Papa=require('papaparse');var AWS=require('aws-sdk');var uuidv4=require(_0x36c3('0xa'));var Redis=require(_0x36c3('0xb'));var authService=require(_0x36c3('0xc'));var qs=require(_0x36c3('0xd'));var as=require(_0x36c3('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x36c3('0xf'));var utils=require(_0x36c3('0x10'));var config=require(_0x36c3('0x11'));var licenseUtil=require(_0x36c3('0x12'));var db=require(_0x36c3('0x13'))['db'];function respondWithStatusCode(_0x4589f8,_0x4243d3){_0x4243d3=_0x4243d3||0xcc;return function(_0x3d8574){if(_0x3d8574){return _0x4589f8['sendStatus'](_0x4243d3);}return _0x4589f8['status'](_0x4243d3)[_0x36c3('0x14')]();};}function respondWithResult(_0x34346d,_0x514315){_0x514315=_0x514315||0xc8;return function(_0xd0693c){if(_0xd0693c){return _0x34346d[_0x36c3('0x15')](_0x514315)['json'](_0xd0693c);}};}function respondWithFilteredResult(_0xd350e5,_0x4eb3c5){return function(_0x2a743d){if(_0x2a743d){var _0x1d62df=typeof _0x4eb3c5[_0x36c3('0x16')]===_0x36c3('0x17')&&typeof _0x4eb3c5[_0x36c3('0x18')]===_0x36c3('0x17');var _0x5d332c=_0x2a743d[_0x36c3('0x19')];var _0x366e8e=_0x1d62df?0x0:_0x4eb3c5[_0x36c3('0x16')];var _0x46eb47=_0x1d62df?_0x2a743d[_0x36c3('0x19')]:_0x4eb3c5[_0x36c3('0x16')]+_0x4eb3c5[_0x36c3('0x18')];var _0x322164;if(_0x46eb47>=_0x5d332c){_0x46eb47=_0x5d332c;_0x322164=0xc8;}else{_0x322164=0xce;}_0xd350e5[_0x36c3('0x15')](_0x322164);return _0xd350e5[_0x36c3('0x1a')](_0x36c3('0x1b'),_0x366e8e+'-'+_0x46eb47+'/'+_0x5d332c)[_0x36c3('0x1c')](_0x2a743d);}return null;};}function patchUpdates(_0xbc0cdb){return function(_0x3207cc){try{jsonpatch[_0x36c3('0x1d')](_0x3207cc,_0xbc0cdb,!![]);}catch(_0x441be8){return BPromise[_0x36c3('0x1e')](_0x441be8);}return _0x3207cc[_0x36c3('0x1f')]();};}function saveUpdates(_0x2e87cf,_0x3fdb63){return function(_0x2eb992){if(_0x2eb992){return _0x2eb992[_0x36c3('0x20')](_0x2e87cf)['then'](function(_0x18a71d){return _0x18a71d;});}return null;};}function removeEntity(_0x2658e0,_0x4d2b6a){return function(_0x539803){if(_0x539803){return _0x539803['destroy']()[_0x36c3('0x21')](function(){_0x2658e0[_0x36c3('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x295e9d,_0x43f039){return function(_0x4536d2){if(!_0x4536d2){_0x295e9d[_0x36c3('0x22')](0x194);}return _0x4536d2;};}function handleError(_0x1ea73a,_0x5cf7e9){_0x5cf7e9=_0x5cf7e9||0x1f4;return function(_0x134cb5){logger[_0x36c3('0x23')](_0x134cb5[_0x36c3('0x24')]);if(_0x134cb5[_0x36c3('0x25')]){delete _0x134cb5[_0x36c3('0x25')];}_0x1ea73a[_0x36c3('0x15')](_0x5cf7e9)['send'](_0x134cb5);};}exports[_0x36c3('0x26')]=function(_0xf85063,_0x597690){var _0x59b6a2={},_0x260ca4={},_0x13e149={'count':0x0,'rows':[]};var _0x325206=_[_0x36c3('0x27')](db[_0x36c3('0x28')][_0x36c3('0x29')],function(_0x1d4054){return{'name':_0x1d4054[_0x36c3('0x2a')],'type':_0x1d4054[_0x36c3('0x2b')][_0x36c3('0x2c')]};});_0x260ca4['model']=_[_0x36c3('0x2d')](_[_0x36c3('0x27')](_0x325206,_0x36c3('0x25')),[_0x36c3('0x2e')]);_0x260ca4[_0x36c3('0x2f')]=_['keys'](_0xf85063['query']);_0x260ca4[_0x36c3('0x30')]=_[_0x36c3('0x31')](_0x260ca4[_0x36c3('0x32')],_0x260ca4[_0x36c3('0x2f')]);_0x59b6a2['attributes']=_[_0x36c3('0x31')](_0x260ca4[_0x36c3('0x32')],qs['fields'](_0xf85063[_0x36c3('0x2f')][_0x36c3('0x33')]));_0x59b6a2[_0x36c3('0x34')]=_0x59b6a2['attributes'][_0x36c3('0x35')]?_0x59b6a2[_0x36c3('0x34')]:_0x260ca4[_0x36c3('0x32')];if(!_0xf85063[_0x36c3('0x2f')]['hasOwnProperty'](_0x36c3('0x36'))){_0x59b6a2[_0x36c3('0x18')]=qs[_0x36c3('0x18')](_0xf85063['query'][_0x36c3('0x18')]);_0x59b6a2[_0x36c3('0x16')]=qs[_0x36c3('0x16')](_0xf85063[_0x36c3('0x2f')]['offset']);}_0x59b6a2[_0x36c3('0x37')]=qs[_0x36c3('0x38')](_0xf85063['query'][_0x36c3('0x38')]);_0x59b6a2[_0x36c3('0x39')]=qs[_0x36c3('0x30')](_[_0x36c3('0x3a')](_0xf85063['query'],_0x260ca4[_0x36c3('0x30')]),_0x325206);if(_0xf85063[_0x36c3('0x2f')][_0x36c3('0x3b')]){_0x59b6a2[_0x36c3('0x39')]=_[_0x36c3('0x3c')](_0x59b6a2[_0x36c3('0x39')],{'$or':_[_0x36c3('0x27')](_0x325206,function(_0x46a0ed){if(_0x46a0ed['type']!==_0x36c3('0x3d')){var _0x135c32={};_0x135c32[_0x46a0ed[_0x36c3('0x25')]]={'$like':'%'+_0xf85063[_0x36c3('0x2f')]['filter']+'%'};return _0x135c32;}})});}_0x59b6a2=_['merge']({},_0x59b6a2,_0xf85063[_0x36c3('0x3e')]);var _0x1baf19={'where':_0x59b6a2[_0x36c3('0x39')]};return db[_0x36c3('0x28')][_0x36c3('0x19')](_0x1baf19)[_0x36c3('0x21')](function(_0x32758e){_0x13e149[_0x36c3('0x19')]=_0x32758e;if(_0xf85063[_0x36c3('0x2f')][_0x36c3('0x3f')]){_0x59b6a2[_0x36c3('0x40')]=[{'all':!![]}];}return db['VoiceRecording'][_0x36c3('0x41')](_0x59b6a2);})['then'](function(_0x4b6eee){_0x13e149[_0x36c3('0x42')]=_0x4b6eee;return _0x13e149;})[_0x36c3('0x21')](respondWithFilteredResult(_0x597690,_0x59b6a2))[_0x36c3('0x43')](handleError(_0x597690,null));};exports[_0x36c3('0x44')]=function(_0x52d51a,_0x1670fc){var _0x3bbf83={'raw':![],'where':{'id':_0x52d51a[_0x36c3('0x45')]['id']}},_0x548556={};_0x548556[_0x36c3('0x32')]=_[_0x36c3('0x46')](db['VoiceRecording']['rawAttributes']);_0x548556['query']=_['keys'](_0x52d51a[_0x36c3('0x2f')]);_0x548556[_0x36c3('0x30')]=_[_0x36c3('0x31')](_0x548556['model'],_0x548556[_0x36c3('0x2f')]);_0x3bbf83[_0x36c3('0x34')]=_[_0x36c3('0x31')](_0x548556[_0x36c3('0x32')],qs[_0x36c3('0x33')](_0x52d51a['query']['fields']));_0x3bbf83['attributes']=_0x3bbf83['attributes'][_0x36c3('0x35')]?_0x3bbf83['attributes']:_0x548556[_0x36c3('0x32')];if(_0x52d51a[_0x36c3('0x2f')]['includeAll']){_0x3bbf83[_0x36c3('0x40')]=[{'all':!![]}];}_0x3bbf83=_[_0x36c3('0x3c')]({},_0x3bbf83,_0x52d51a['options']);return db[_0x36c3('0x28')]['find'](_0x3bbf83)['then'](handleEntityNotFound(_0x1670fc,null))[_0x36c3('0x21')](respondWithResult(_0x1670fc,null))[_0x36c3('0x43')](handleError(_0x1670fc,null));};exports['create']=function(_0x27d412,_0x2e75ec){return db['VoiceRecording'][_0x36c3('0x47')](_0x27d412[_0x36c3('0x48')],{})[_0x36c3('0x21')](respondWithResult(_0x2e75ec,0xc9))[_0x36c3('0x43')](handleError(_0x2e75ec,null));};exports[_0x36c3('0x20')]=function(_0x3d6692,_0x142bcc){if(_0x3d6692[_0x36c3('0x48')]['id']){delete _0x3d6692[_0x36c3('0x48')]['id'];}return db[_0x36c3('0x28')][_0x36c3('0x49')]({'where':{'id':_0x3d6692[_0x36c3('0x45')]['id']}})[_0x36c3('0x21')](handleEntityNotFound(_0x142bcc,null))[_0x36c3('0x21')](saveUpdates(_0x3d6692[_0x36c3('0x48')],null))[_0x36c3('0x21')](respondWithResult(_0x142bcc,null))[_0x36c3('0x43')](handleError(_0x142bcc,null));};exports['describe']=function(_0x2e6b89,_0x23e418){return db[_0x36c3('0x28')]['describe']()['then'](respondWithResult(_0x23e418,null))[_0x36c3('0x43')](handleError(_0x23e418,null));};exports['download']=function(_0x1d8566,_0x22acad,_0x43f79b){var _0x10f76a=require('../../components/encryptor');var _0xea0315=![];var _0x41c7dd={};if(_0x1d8566[_0x36c3('0x2f')]['type']&&_0x1d8566[_0x36c3('0x2f')][_0x36c3('0x2b')]===_0x36c3('0x4a')){_0x41c7dd[_0x36c3('0x4a')]=_0x1d8566[_0x36c3('0x45')]['id'];}else{_0x41c7dd['id']=_0x1d8566[_0x36c3('0x45')]['id'];}return db['VoiceRecording'][_0x36c3('0x49')]({'where':_0x41c7dd,'attributes':['id',_0x36c3('0x4b')],'raw':!![]})[_0x36c3('0x21')](handleEntityNotFound(_0x22acad,null))[_0x36c3('0x21')](function(_0x7fb2ad){if(_0x7fb2ad){var _0x858299=_0x7fb2ad[_0x36c3('0x4b')];var _0x1c23bf=util[_0x36c3('0x2e')](_0x36c3('0x4c'),_0x858299);if(fs[_0x36c3('0x4d')](_0x1c23bf)){_0xea0315=!![];return _0x10f76a['decryptFile'](_0x1c23bf,_0x858299,config['secrets'][_0x36c3('0x4e')])['then'](function(){return _0x7fb2ad;});}return _0x7fb2ad;}})['then'](function(_0x4ecdd3){if(_0x4ecdd3){var _0x3c149b=_0x4ecdd3['value'];if(!fs['existsSync'](_0x3c149b)){throw new db[(_0x36c3('0x4f'))][(_0x36c3('0x50'))](_0x36c3('0x51'));}if(_0x4ecdd3['filename']){return _0x22acad['download'](_0x3c149b,_0x4ecdd3['filename']+path[_0x36c3('0x52')](_0x3c149b),function(){if(_0xea0315){fs[_0x36c3('0x53')](_0x3c149b);}});}else{return _0x22acad['download'](_0x3c149b,function(_0x59fb65){if(_0xea0315){fs['unlink'](_0x3c149b);}});}}})[_0x36c3('0x43')](function(_0x567b3e){if(_0x567b3e['message']===_0x36c3('0x51')){_0x22acad[_0x36c3('0x15')](0x194)[_0x36c3('0x54')](_0x36c3('0x55'));}else{return handleError(_0x22acad,null);}});};exports['downloads']=function(_0x2a05d0,_0x4f5b28,_0x54ddac){var _0x541ae6=require(_0x36c3('0x56'));var _0x434004=![];var _0x2e2f5d={'$and':[db[_0x36c3('0x57')][_0x36c3('0x39')](db[_0x36c3('0x57')]['fn'](_0x36c3('0x58'),db[_0x36c3('0x57')]['col'](_0x36c3('0x4a'))),_0x2a05d0[_0x36c3('0x2f')]['token'])]};if(_0x2a05d0['query'][_0x36c3('0x2b')]&&_0x2a05d0['query'][_0x36c3('0x2b')]==='uniqueid'){_0x2e2f5d[_0x36c3('0x59')][_0x36c3('0x5a')]({'uniqueid':_0x2a05d0[_0x36c3('0x45')]['id']});}else{_0x2e2f5d[_0x36c3('0x59')]['push']({'id':_0x2a05d0[_0x36c3('0x45')]['id']});}return db['VoiceRecording'][_0x36c3('0x49')]({'where':_0x2e2f5d,'attributes':['id',_0x36c3('0x4b')],'raw':!![]})[_0x36c3('0x21')](handleEntityNotFound(_0x4f5b28,null))[_0x36c3('0x21')](function(_0x23423c){if(_0x23423c){var _0x3b1c9c=util[_0x36c3('0x2e')](_0x36c3('0x4c'),_0x23423c['value']);if(fs[_0x36c3('0x4d')](_0x3b1c9c)){_0x434004=!![];return _0x541ae6[_0x36c3('0x5b')](_0x3b1c9c,_0x23423c['value'],config[_0x36c3('0x5c')][_0x36c3('0x4e')])[_0x36c3('0x21')](function(){return _0x23423c;});}return _0x23423c;}})['then'](function(_0x346726){if(_0x346726){if(!fs['existsSync'](_0x346726[_0x36c3('0x4b')])){throw new db[(_0x36c3('0x4f'))][(_0x36c3('0x50'))](_0x36c3('0x51'));}if(_0x346726[_0x36c3('0x5d')]){return _0x4f5b28[_0x36c3('0x5e')](_0x346726[_0x36c3('0x4b')],_0x346726[_0x36c3('0x5d')]+path[_0x36c3('0x52')](_0x346726[_0x36c3('0x4b')]),function(){if(_0x434004){fs['unlink'](_0x346726[_0x36c3('0x4b')]);}});}else{return _0x4f5b28[_0x36c3('0x5e')](_0x346726[_0x36c3('0x4b')],function(_0x2d3fd1){if(_0x434004){fs['unlink'](_0x346726[_0x36c3('0x4b')]);}});}}})[_0x36c3('0x43')](handleError(_0x4f5b28,null));};exports[_0x36c3('0x5f')]=function(_0x42de69,_0x1958d7){return db[_0x36c3('0x28')][_0x36c3('0x49')]({'where':{'id':_0x42de69[_0x36c3('0x45')]['id']}})[_0x36c3('0x21')](function(_0x3ebe17){if(_[_0x36c3('0x60')](_0x3ebe17)){throw new ReferenceError(_0x36c3('0x61'));}return _0x3ebe17;})['then'](function(_0x4f577e){var _0x19dc6f=_0x4f577e[_0x36c3('0x4b')];logger[_0x36c3('0x62')](_0x36c3('0x63'),_0x19dc6f);if(!_[_0x36c3('0x60')](_0x4f577e[_0x36c3('0x4b')])&&fs[_0x36c3('0x4d')](_0x19dc6f)){logger[_0x36c3('0x62')](_0x36c3('0x64')+_0x19dc6f+_0x36c3('0x65'));fs[_0x36c3('0x66')](_0x19dc6f);}_0x19dc6f=_0x19dc6f+_0x36c3('0x67');if(!_[_0x36c3('0x60')](_0x4f577e[_0x36c3('0x4b')])&&fs[_0x36c3('0x4d')](_0x19dc6f)){logger['info'](_0x36c3('0x64')+_0x19dc6f+_0x36c3('0x65'));fs[_0x36c3('0x66')](_0x19dc6f);}return _0x4f577e;})[_0x36c3('0x21')](function(_0x11d210){if(!_0x11d210)throw new InternalError();return _0x11d210[_0x36c3('0x5f')]();})[_0x36c3('0x21')](function(){_0x1958d7[_0x36c3('0x15')](0xcc)[_0x36c3('0x14')]();})[_0x36c3('0x43')](handleError(_0x1958d7,null));};function getBucketslist(_0xcda6b6,_0x1f3273,_0x2ddc3d){return new Promise(function(_0x43d1fe,_0x40f58c){var _0x3972bf=new AWS['S3']({'accessKeyId':_0x1f3273,'secretAccessKey':_0xcda6b6,'region':_0x2ddc3d});_0x3972bf[_0x36c3('0x68')]({},function(_0xeede0f,_0x7a4b51){if(_0xeede0f){return _0x40f58c(_0xeede0f);}else{return _0x43d1fe(_0x7a4b51);}});});}function createBucket(_0x19eef3,_0xa7f533,_0x7cda6b,_0x43b5b7){return new Promise(function(_0x379463,_0x3091b6){var _0x593365=new AWS['S3']({'accessKeyId':_0xa7f533,'secretAccessKey':_0x19eef3,'region':_0x7cda6b});_0x593365['createBucket']({'Bucket':_0x43b5b7},function(_0x83681d,_0xa1faa7){if(_0x83681d){return _0x3091b6(_0x83681d);}else{return _0x379463(_0xa1faa7);}});});}function uploadFile(_0x5e06dd,_0x29d935,_0x295889,_0x2cebd1,_0x1d0be1,_0x29c3be){return new Promise(function(_0x19e0ca,_0x296502){var _0x258628=new AWS['S3']({'accessKeyId':_0x29d935,'secretAccessKey':_0x5e06dd,'region':_0x295889});_0x258628[_0x36c3('0x69')]({'Bucket':_0x2cebd1,'Key':_0x1d0be1,'Body':_0x29c3be},function(_0x591299,_0x381216){if(_0x591299){return _0x296502(_0x591299);}else{return _0x19e0ca(_0x381216);}});});}function startTranscribe(_0x46c361,_0x3598e8,_0x831736,_0x4ef263,_0x4279ad,_0x5d23a4){return new Promise(function(_0x5d82da,_0x334bd0){var _0x1c610a=new AWS[(_0x36c3('0x6a'))]({'accessKeyId':_0x3598e8,'secretAccessKey':_0x46c361,'region':_0x831736});_0x1c610a[_0x36c3('0x6b')]({'TranscriptionJobName':_0x4ef263,'LanguageCode':_0x4279ad,'Media':{'MediaFileUri':_0x5d23a4}},function(_0x3dc05a,_0x53c3f7){if(_0x3dc05a){return _0x334bd0(_0x3dc05a);}else{return _0x5d82da(_0x53c3f7);}});});}function transcribe(_0x3028f6,_0x17a9fd,_0x6d86c3,_0x756d1,_0x148910,_0x105603,_0x1f910a){return new Promise(function(_0x592337,_0x3914a4){var _0x3ec940={};logger['info'](util[_0x36c3('0x2e')](_0x36c3('0x6c'),_0x3028f6,_0x148910));return uploadFile(_0x17a9fd,_0x6d86c3,_0x756d1,_0x148910,path[_0x36c3('0x6d')](_0x105603),fs[_0x36c3('0x6e')](_0x105603))[_0x36c3('0x21')](function(_0x5b5223){logger[_0x36c3('0x62')](util[_0x36c3('0x2e')](_0x36c3('0x6f'),_0x3028f6,_0x148910,_0x5b5223['Location']));_0x3ec940[_0x36c3('0x70')]=_0x5b5223['Bucket'];_0x3ec940['location']=_0x5b5223[_0x36c3('0x71')];logger[_0x36c3('0x62')](util['format']('[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request',_0x3028f6));return startTranscribe(_0x17a9fd,_0x6d86c3,_0x756d1,uuidv4(),_0x1f910a,_0x5b5223['Location']);})[_0x36c3('0x21')](function(_0xe6d416){logger[_0x36c3('0x62')](util[_0x36c3('0x2e')](_0x36c3('0x72'),_0x3028f6,_0xe6d416[_0x36c3('0x73')][_0x36c3('0x74')]));_0x3ec940['transcribeName']=_0xe6d416[_0x36c3('0x73')][_0x36c3('0x74')];_0x3ec940['transcribeStatus']=_0xe6d416[_0x36c3('0x73')]['TranscriptionJobStatus'];return _0x592337(_0x3ec940);})['catch'](function(_0x232a49){return _0x3914a4(_0x232a49);});});}exports[_0x36c3('0x75')]=function(_0x44dfc0,_0x36df38,_0xcafd95){var _0x4e77e6;var _0x18b1f6;var _0x2ec33a;var _0x5c172c=require(_0x36c3('0x56'));return db['VoiceRecording'][_0x36c3('0x76')]({'where':{'id':_0x44dfc0['params']['id']}})[_0x36c3('0x21')](function(_0x5ce834){if(_0x5ce834){var _0x41a40f=util['format'](_0x36c3('0x4c'),_0x5ce834[_0x36c3('0x4b')]);if(fs[_0x36c3('0x4d')](_0x41a40f)){cypher=!![];return _0x5c172c[_0x36c3('0x5b')](_0x41a40f,_0x5ce834[_0x36c3('0x4b')],config['secrets']['recording'])[_0x36c3('0x21')](function(){return _0x5ce834;});}return _0x5ce834;}})['then'](function(_0x1748f4){if(!_0x1748f4){throw new db[(_0x36c3('0x4f'))][(_0x36c3('0x50'))]('Voice\x20Recording\x20not\x20found');}_0x18b1f6=_0x1748f4;return db[_0x36c3('0x77')][_0x36c3('0x76')]({'where':{'id':0x1}});})[_0x36c3('0x21')](handleEntityNotFound(_0x36df38,null))['then'](function(_0x2f1fe0){if(_0x2f1fe0){_0x4e77e6=_0x2f1fe0;if(!_0x4e77e6[_0x36c3('0x78')]||!_0x4e77e6[_0x36c3('0x79')]||!_0x4e77e6[_0x36c3('0x7a')]||!_0x4e77e6[_0x36c3('0x7b')]||!_0x4e77e6['bucket']){throw new db['Sequelize'][(_0x36c3('0x50'))](_0x36c3('0x7c'));}if(_0x44dfc0['body'][_0x36c3('0x7d')]&&(!_0x4e77e6[_0x36c3('0x7e')]||!_0x4e77e6[_0x36c3('0x7f')]||!_0x4e77e6[_0x36c3('0x80')]||!_0x4e77e6[_0x36c3('0x7b')]||!_0x4e77e6['bucket'])){throw new db[(_0x36c3('0x4f'))][(_0x36c3('0x50'))](_0x36c3('0x81'));}return db[_0x36c3('0x82')][_0x36c3('0x76')]({'where':{'id':_0x4e77e6[_0x36c3('0x79')]}});}})['then'](function(_0x5167dd){if(!_0x5167dd){throw new db[(_0x36c3('0x4f'))][(_0x36c3('0x50'))](_0x36c3('0x83'));}if(!_0x5167dd[_0x36c3('0x84')]||!_0x5167dd['data2']){throw new db[(_0x36c3('0x4f'))][(_0x36c3('0x50'))](_0x36c3('0x85'));}_0x2ec33a=_0x5167dd;return getBucketslist(_0x2ec33a[_0x36c3('0x84')],_0x2ec33a[_0x36c3('0x86')],_0x4e77e6[_0x36c3('0x7a')]);})[_0x36c3('0x21')](function(_0x34e4d0){if(_0x34e4d0&&_0x34e4d0['Buckets']){var _0x244450=_[_0x36c3('0x49')](_0x34e4d0['Buckets'],function(_0x41beaf){return _0x41beaf[_0x36c3('0x87')]===_0x4e77e6['bucket'];});if(!_0x244450){logger[_0x36c3('0x62')](util[_0x36c3('0x2e')](_0x36c3('0x88'),_0x44dfc0[_0x36c3('0x45')]['id'],_0x4e77e6[_0x36c3('0x70')]));return createBucket(_0x2ec33a['data1'],_0x2ec33a[_0x36c3('0x86')],_0x4e77e6[_0x36c3('0x7a')],_0x4e77e6[_0x36c3('0x70')]);}logger[_0x36c3('0x62')](util[_0x36c3('0x2e')](_0x36c3('0x89'),_0x44dfc0['params']['id'],_0x4e77e6[_0x36c3('0x70')]));return;}})[_0x36c3('0x21')](function(_0x319ded){if(_0x18b1f6[_0x36c3('0x8a')]===_0x36c3('0x8b')){return transcribe(_0x44dfc0[_0x36c3('0x45')]['id'],_0x2ec33a[_0x36c3('0x84')],_0x2ec33a[_0x36c3('0x86')],_0x4e77e6[_0x36c3('0x7a')],_0x4e77e6['bucket'],_0x18b1f6[_0x36c3('0x4b')],_0x4e77e6['language']);}else{logger[_0x36c3('0x62')](util['format'](_0x36c3('0x8c'),_0x44dfc0['params']['id']));return{'transcribeStatus':_0x36c3('0x8d')};}})[_0x36c3('0x21')](function(_0x39cd95){if(_0x39cd95){_0x39cd95['tempSentiment']=_0x44dfc0[_0x36c3('0x48')]['runSentiment'];return _0x18b1f6[_0x36c3('0x8e')](_0x39cd95);}})[_0x36c3('0x21')](respondWithResult(_0x36df38,null))[_0x36c3('0x43')](handleError(_0x36df38,null));};function writeFile(_0x13ff47,_0x58edff){return new Promise(function(_0x58adc8,_0x2874cb){fs[_0x36c3('0x8f')](_0x58edff,_0x13ff47,function(_0x8f646e,_0x2f970c){if(_0x8f646e){return _0x2874cb(_0x8f646e);}else{return _0x58adc8(_0x2f970c);}});});}exports[_0x36c3('0x90')]=function(_0x140f6b,_0x5aa904,_0x40802f){return db[_0x36c3('0x28')][_0x36c3('0x76')]({'where':{'id':_0x140f6b[_0x36c3('0x45')]['id']}})[_0x36c3('0x21')](handleEntityNotFound(_0x5aa904))[_0x36c3('0x21')](function(_0x27c149){if(_0x27c149&&_0x27c149[_0x36c3('0x91')]){var _0x38d758=_0x27c149['fileText'];var _0x44201c=config[_0x36c3('0x92')]+_0x36c3('0x93')+_0x27c149['id']+_0x36c3('0x94');if(fs[_0x36c3('0x4d')](_0x44201c)){return _0x44201c;}return writeFile(_0x38d758,_0x44201c)[_0x36c3('0x21')](function(){return _0x44201c;});}else{throw new db[(_0x36c3('0x4f'))]['ValidationError'](_0x36c3('0x95'));}})[_0x36c3('0x21')](function(_0x22e67f){return _0x5aa904[_0x36c3('0x5e')](_0x22e67f);})[_0x36c3('0x43')](handleError(_0x5aa904));}; \ No newline at end of file +var _0xdc22=['decryptFile','recording','value','ValidationError','VoiceRecording\x20not\x20found','filename','extname','unlink','message','send','Not\x20found','downloads','sequelize','MD5','token','type','$and','push','Sequelize','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','listBuckets','createBucket','TranscribeService','startTranscriptionJob','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','basename','readFileSync','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','bucket','Bucket','location','Location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','TranscriptionJob','TranscriptionJobName','transcribeName','transcribeStatus','TranscriptionJobStatus','runTranscribe','findOne','secrets','transcribe','transcribeAccountId','language','Transcribe\x20not\x20configured','runSentiment','sentiment','sentimentAccountId','sentimentRegion','Sentiment\x20Analysis\x20not\x20configured','data1','Cloud\x20Provider\x20not\x20configured','data2','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','transcribeRegion','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','NEW','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','tempSentiment','updateAttributes','writeFile','downloadTranscribe','fileText','/server/files/transcribes/transcribe_','.txt','Transcript\x20not\x20available','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','ejs','lodash','crypto','jsforce','querystring','aws-sdk','uuid/v4','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','apply','reject','update','then','destroy','error','stack','name','index','map','VoiceRecording','rawAttributes','key','model','differenceBy','format','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','pick','merge','where','VIRTUAL','filter','options','include','findAll','rows','catch','show','params','keys','length','includeAll','find','body','describe','download','../../components/encryptor','uniqueid','%s.cypher','existsSync'];(function(_0x2924d3,_0x43216b){var _0x4be4e4=function(_0x57446b){while(--_0x57446b){_0x2924d3['push'](_0x2924d3['shift']());}};_0x4be4e4(++_0x43216b);}(_0xdc22,0x17d));var _0x2dc2=function(_0xe8e91,_0x401ca3){_0xe8e91=_0xe8e91-0x0;var _0x1258fe=_0xdc22[_0xe8e91];return _0x1258fe;};'use strict';var emlformat=require(_0x2dc2('0x0'));var rimraf=require(_0x2dc2('0x1'));var zipdir=require(_0x2dc2('0x2'));var jsonpatch=require(_0x2dc2('0x3'));var rp=require(_0x2dc2('0x4'));var moment=require(_0x2dc2('0x5'));var BPromise=require(_0x2dc2('0x6'));var Mustache=require(_0x2dc2('0x7'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x2dc2('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2dc2('0x9'));var squel=require('squel');var crypto=require(_0x2dc2('0xa'));var jsforce=require(_0x2dc2('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x2dc2('0xc'));var Papa=require('papaparse');var AWS=require(_0x2dc2('0xd'));var uuidv4=require(_0x2dc2('0xe'));var Redis=require(_0x2dc2('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x2dc2('0x10'));var hardwareService=require(_0x2dc2('0x11'));var logger=require(_0x2dc2('0x12'))('api');var utils=require(_0x2dc2('0x13'));var config=require(_0x2dc2('0x14'));var licenseUtil=require(_0x2dc2('0x15'));var db=require(_0x2dc2('0x16'))['db'];function respondWithStatusCode(_0x2e088c,_0x33b2b8){_0x33b2b8=_0x33b2b8||0xcc;return function(_0x155b40){if(_0x155b40){return _0x2e088c[_0x2dc2('0x17')](_0x33b2b8);}return _0x2e088c[_0x2dc2('0x18')](_0x33b2b8)[_0x2dc2('0x19')]();};}function respondWithResult(_0x3f3eda,_0xcad4de){_0xcad4de=_0xcad4de||0xc8;return function(_0x177dfb){if(_0x177dfb){return _0x3f3eda['status'](_0xcad4de)[_0x2dc2('0x1a')](_0x177dfb);}};}function respondWithFilteredResult(_0x4ca226,_0x4e3f17){return function(_0x2a063e){if(_0x2a063e){var _0x3f4ea7=typeof _0x4e3f17['offset']===_0x2dc2('0x1b')&&typeof _0x4e3f17[_0x2dc2('0x1c')]===_0x2dc2('0x1b');var _0x3ee852=_0x2a063e[_0x2dc2('0x1d')];var _0x475871=_0x3f4ea7?0x0:_0x4e3f17[_0x2dc2('0x1e')];var _0x4ef706=_0x3f4ea7?_0x2a063e['count']:_0x4e3f17[_0x2dc2('0x1e')]+_0x4e3f17[_0x2dc2('0x1c')];var _0x4a37b8;if(_0x4ef706>=_0x3ee852){_0x4ef706=_0x3ee852;_0x4a37b8=0xc8;}else{_0x4a37b8=0xce;}_0x4ca226[_0x2dc2('0x18')](_0x4a37b8);return _0x4ca226['set']('Content-Range',_0x475871+'-'+_0x4ef706+'/'+_0x3ee852)[_0x2dc2('0x1a')](_0x2a063e);}return null;};}function patchUpdates(_0x38483b){return function(_0xc2c748){try{jsonpatch[_0x2dc2('0x1f')](_0xc2c748,_0x38483b,!![]);}catch(_0x406a7e){return BPromise[_0x2dc2('0x20')](_0x406a7e);}return _0xc2c748['save']();};}function saveUpdates(_0x33ce09,_0x48b5a2){return function(_0x2aca20){if(_0x2aca20){return _0x2aca20[_0x2dc2('0x21')](_0x33ce09)[_0x2dc2('0x22')](function(_0x4d144e){return _0x4d144e;});}return null;};}function removeEntity(_0xd51504,_0xfe2c20){return function(_0x279abb){if(_0x279abb){return _0x279abb[_0x2dc2('0x23')]()[_0x2dc2('0x22')](function(){_0xd51504[_0x2dc2('0x18')](0xcc)[_0x2dc2('0x19')]();});}};}function handleEntityNotFound(_0x550692,_0x3d826e){return function(_0x2fd652){if(!_0x2fd652){_0x550692['sendStatus'](0x194);}return _0x2fd652;};}function handleError(_0x523fc8,_0x445018){_0x445018=_0x445018||0x1f4;return function(_0x8b55e1){logger[_0x2dc2('0x24')](_0x8b55e1[_0x2dc2('0x25')]);if(_0x8b55e1[_0x2dc2('0x26')]){delete _0x8b55e1[_0x2dc2('0x26')];}_0x523fc8[_0x2dc2('0x18')](_0x445018)['send'](_0x8b55e1);};}exports[_0x2dc2('0x27')]=function(_0x3479e4,_0x58c33b){var _0x55cb4c={},_0x2ceafe={},_0x1b8f05={'count':0x0,'rows':[]};var _0x22a983=_[_0x2dc2('0x28')](db[_0x2dc2('0x29')][_0x2dc2('0x2a')],function(_0x3b183c){return{'name':_0x3b183c['fieldName'],'type':_0x3b183c['type'][_0x2dc2('0x2b')]};});_0x2ceafe[_0x2dc2('0x2c')]=_[_0x2dc2('0x2d')](_[_0x2dc2('0x28')](_0x22a983,_0x2dc2('0x26')),[_0x2dc2('0x2e')]);_0x2ceafe[_0x2dc2('0x2f')]=_['keys'](_0x3479e4[_0x2dc2('0x2f')]);_0x2ceafe[_0x2dc2('0x30')]=_[_0x2dc2('0x31')](_0x2ceafe[_0x2dc2('0x2c')],_0x2ceafe['query']);_0x55cb4c['attributes']=_[_0x2dc2('0x31')](_0x2ceafe[_0x2dc2('0x2c')],qs[_0x2dc2('0x32')](_0x3479e4[_0x2dc2('0x2f')][_0x2dc2('0x32')]));_0x55cb4c['attributes']=_0x55cb4c[_0x2dc2('0x33')]['length']?_0x55cb4c[_0x2dc2('0x33')]:_0x2ceafe['model'];if(!_0x3479e4[_0x2dc2('0x2f')][_0x2dc2('0x34')](_0x2dc2('0x35'))){_0x55cb4c['limit']=qs['limit'](_0x3479e4[_0x2dc2('0x2f')][_0x2dc2('0x1c')]);_0x55cb4c[_0x2dc2('0x1e')]=qs['offset'](_0x3479e4[_0x2dc2('0x2f')][_0x2dc2('0x1e')]);}_0x55cb4c[_0x2dc2('0x36')]=qs['sort'](_0x3479e4[_0x2dc2('0x2f')]['sort']);_0x55cb4c['where']=qs[_0x2dc2('0x30')](_[_0x2dc2('0x37')](_0x3479e4[_0x2dc2('0x2f')],_0x2ceafe[_0x2dc2('0x30')]),_0x22a983);if(_0x3479e4['query']['filter']){_0x55cb4c['where']=_[_0x2dc2('0x38')](_0x55cb4c[_0x2dc2('0x39')],{'$or':_['map'](_0x22a983,function(_0x20342c){if(_0x20342c['type']!==_0x2dc2('0x3a')){var _0x4233e5={};_0x4233e5[_0x20342c[_0x2dc2('0x26')]]={'$like':'%'+_0x3479e4[_0x2dc2('0x2f')][_0x2dc2('0x3b')]+'%'};return _0x4233e5;}})});}_0x55cb4c=_['merge']({},_0x55cb4c,_0x3479e4[_0x2dc2('0x3c')]);var _0x55c0f2={'where':_0x55cb4c[_0x2dc2('0x39')]};return db[_0x2dc2('0x29')]['count'](_0x55c0f2)[_0x2dc2('0x22')](function(_0x44fd24){_0x1b8f05[_0x2dc2('0x1d')]=_0x44fd24;if(_0x3479e4['query']['includeAll']){_0x55cb4c[_0x2dc2('0x3d')]=[{'all':!![]}];}return db['VoiceRecording'][_0x2dc2('0x3e')](_0x55cb4c);})[_0x2dc2('0x22')](function(_0x466434){_0x1b8f05[_0x2dc2('0x3f')]=_0x466434;return _0x1b8f05;})[_0x2dc2('0x22')](respondWithFilteredResult(_0x58c33b,_0x55cb4c))[_0x2dc2('0x40')](handleError(_0x58c33b,null));};exports[_0x2dc2('0x41')]=function(_0x8d68b3,_0x2fbb09){var _0x558b24={'raw':![],'where':{'id':_0x8d68b3[_0x2dc2('0x42')]['id']}},_0x485d0d={};_0x485d0d['model']=_[_0x2dc2('0x43')](db[_0x2dc2('0x29')][_0x2dc2('0x2a')]);_0x485d0d[_0x2dc2('0x2f')]=_[_0x2dc2('0x43')](_0x8d68b3[_0x2dc2('0x2f')]);_0x485d0d[_0x2dc2('0x30')]=_[_0x2dc2('0x31')](_0x485d0d['model'],_0x485d0d['query']);_0x558b24['attributes']=_[_0x2dc2('0x31')](_0x485d0d[_0x2dc2('0x2c')],qs['fields'](_0x8d68b3['query'][_0x2dc2('0x32')]));_0x558b24['attributes']=_0x558b24['attributes'][_0x2dc2('0x44')]?_0x558b24['attributes']:_0x485d0d['model'];if(_0x8d68b3[_0x2dc2('0x2f')][_0x2dc2('0x45')]){_0x558b24[_0x2dc2('0x3d')]=[{'all':!![]}];}_0x558b24=_[_0x2dc2('0x38')]({},_0x558b24,_0x8d68b3['options']);return db[_0x2dc2('0x29')][_0x2dc2('0x46')](_0x558b24)[_0x2dc2('0x22')](handleEntityNotFound(_0x2fbb09,null))[_0x2dc2('0x22')](respondWithResult(_0x2fbb09,null))[_0x2dc2('0x40')](handleError(_0x2fbb09,null));};exports['create']=function(_0x282a85,_0x45aa65){return db[_0x2dc2('0x29')]['create'](_0x282a85[_0x2dc2('0x47')],{})[_0x2dc2('0x22')](respondWithResult(_0x45aa65,0xc9))[_0x2dc2('0x40')](handleError(_0x45aa65,null));};exports[_0x2dc2('0x21')]=function(_0x28c3a6,_0x26d28b){if(_0x28c3a6[_0x2dc2('0x47')]['id']){delete _0x28c3a6[_0x2dc2('0x47')]['id'];}return db[_0x2dc2('0x29')][_0x2dc2('0x46')]({'where':{'id':_0x28c3a6[_0x2dc2('0x42')]['id']}})[_0x2dc2('0x22')](handleEntityNotFound(_0x26d28b,null))[_0x2dc2('0x22')](saveUpdates(_0x28c3a6[_0x2dc2('0x47')],null))[_0x2dc2('0x22')](respondWithResult(_0x26d28b,null))['catch'](handleError(_0x26d28b,null));};exports[_0x2dc2('0x48')]=function(_0x5ce71d,_0x44412f){return db[_0x2dc2('0x29')][_0x2dc2('0x48')]()[_0x2dc2('0x22')](respondWithResult(_0x44412f,null))[_0x2dc2('0x40')](handleError(_0x44412f,null));};exports[_0x2dc2('0x49')]=function(_0x2a2653,_0x17cf98,_0x47e60c){var _0x40b770=require(_0x2dc2('0x4a'));var _0x5069f2=![];var _0x4d12f0={};if(_0x2a2653[_0x2dc2('0x2f')]['type']&&_0x2a2653[_0x2dc2('0x2f')]['type']===_0x2dc2('0x4b')){_0x4d12f0['uniqueid']=_0x2a2653['params']['id'];}else{_0x4d12f0['id']=_0x2a2653[_0x2dc2('0x42')]['id'];}return db[_0x2dc2('0x29')][_0x2dc2('0x46')]({'where':_0x4d12f0,'attributes':['id','value'],'raw':!![]})[_0x2dc2('0x22')](handleEntityNotFound(_0x17cf98,null))['then'](function(_0x304770){if(_0x304770){var _0x1c1755=_0x304770['value'];var _0xb14797=util['format'](_0x2dc2('0x4c'),_0x1c1755);if(fs[_0x2dc2('0x4d')](_0xb14797)){_0x5069f2=!![];return _0x40b770[_0x2dc2('0x4e')](_0xb14797,_0x1c1755,config['secrets'][_0x2dc2('0x4f')])[_0x2dc2('0x22')](function(){return _0x304770;});}return _0x304770;}})['then'](function(_0x2fa0ff){if(_0x2fa0ff){var _0x3634f7=_0x2fa0ff[_0x2dc2('0x50')];if(!fs[_0x2dc2('0x4d')](_0x3634f7)){throw new db['Sequelize'][(_0x2dc2('0x51'))](_0x2dc2('0x52'));}if(_0x2fa0ff[_0x2dc2('0x53')]){return _0x17cf98[_0x2dc2('0x49')](_0x3634f7,_0x2fa0ff[_0x2dc2('0x53')]+path[_0x2dc2('0x54')](_0x3634f7),function(){if(_0x5069f2){fs[_0x2dc2('0x55')](_0x3634f7);}});}else{return _0x17cf98[_0x2dc2('0x49')](_0x3634f7,function(_0x3a99c7){if(_0x5069f2){fs[_0x2dc2('0x55')](_0x3634f7);}});}}})[_0x2dc2('0x40')](function(_0x4f42e2){if(_0x4f42e2[_0x2dc2('0x56')]===_0x2dc2('0x52')){_0x17cf98[_0x2dc2('0x18')](0x194)[_0x2dc2('0x57')](_0x2dc2('0x58'));}else{return handleError(_0x17cf98,null);}});};exports[_0x2dc2('0x59')]=function(_0x346ec9,_0x1021ca,_0x3a6ab6){var _0x87d6d3=require(_0x2dc2('0x4a'));var _0x49f1e0=![];var _0x4edc93={'$and':[db[_0x2dc2('0x5a')][_0x2dc2('0x39')](db[_0x2dc2('0x5a')]['fn'](_0x2dc2('0x5b'),db['sequelize']['col'](_0x2dc2('0x4b'))),_0x346ec9[_0x2dc2('0x2f')][_0x2dc2('0x5c')])]};if(_0x346ec9[_0x2dc2('0x2f')][_0x2dc2('0x5d')]&&_0x346ec9[_0x2dc2('0x2f')][_0x2dc2('0x5d')]==='uniqueid'){_0x4edc93[_0x2dc2('0x5e')][_0x2dc2('0x5f')]({'uniqueid':_0x346ec9['params']['id']});}else{_0x4edc93['$and'][_0x2dc2('0x5f')]({'id':_0x346ec9[_0x2dc2('0x42')]['id']});}return db[_0x2dc2('0x29')]['find']({'where':_0x4edc93,'attributes':['id','value'],'raw':!![]})[_0x2dc2('0x22')](handleEntityNotFound(_0x1021ca,null))[_0x2dc2('0x22')](function(_0x2430f3){if(_0x2430f3){var _0x451dc6=util[_0x2dc2('0x2e')](_0x2dc2('0x4c'),_0x2430f3[_0x2dc2('0x50')]);if(fs[_0x2dc2('0x4d')](_0x451dc6)){_0x49f1e0=!![];return _0x87d6d3[_0x2dc2('0x4e')](_0x451dc6,_0x2430f3[_0x2dc2('0x50')],config['secrets']['recording'])[_0x2dc2('0x22')](function(){return _0x2430f3;});}return _0x2430f3;}})['then'](function(_0x1a4139){if(_0x1a4139){if(!fs[_0x2dc2('0x4d')](_0x1a4139[_0x2dc2('0x50')])){throw new db[(_0x2dc2('0x60'))]['ValidationError']('VoiceRecording\x20not\x20found');}if(_0x1a4139[_0x2dc2('0x53')]){return _0x1021ca[_0x2dc2('0x49')](_0x1a4139[_0x2dc2('0x50')],_0x1a4139[_0x2dc2('0x53')]+path['extname'](_0x1a4139[_0x2dc2('0x50')]),function(){if(_0x49f1e0){fs[_0x2dc2('0x55')](_0x1a4139[_0x2dc2('0x50')]);}});}else{return _0x1021ca[_0x2dc2('0x49')](_0x1a4139[_0x2dc2('0x50')],function(_0x5010d7){if(_0x49f1e0){fs['unlink'](_0x1a4139['value']);}});}}})[_0x2dc2('0x40')](handleError(_0x1021ca,null));};exports[_0x2dc2('0x23')]=function(_0x519b63,_0x70fbf8){return db[_0x2dc2('0x29')][_0x2dc2('0x46')]({'where':{'id':_0x519b63[_0x2dc2('0x42')]['id']}})[_0x2dc2('0x22')](function(_0x5bb27f){if(_[_0x2dc2('0x61')](_0x5bb27f)){throw new ReferenceError(_0x2dc2('0x62'));}return _0x5bb27f;})[_0x2dc2('0x22')](function(_0x25844e){var _0x165462=_0x25844e[_0x2dc2('0x50')];logger[_0x2dc2('0x63')](_0x2dc2('0x64'),_0x165462);if(!_[_0x2dc2('0x61')](_0x25844e[_0x2dc2('0x50')])&&fs[_0x2dc2('0x4d')](_0x165462)){logger[_0x2dc2('0x63')](_0x2dc2('0x65')+_0x165462+_0x2dc2('0x66'));fs[_0x2dc2('0x67')](_0x165462);}_0x165462=_0x165462+'.cypher';if(!_['isNil'](_0x25844e[_0x2dc2('0x50')])&&fs['existsSync'](_0x165462)){logger['info'](_0x2dc2('0x65')+_0x165462+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x2dc2('0x67')](_0x165462);}return _0x25844e;})['then'](function(_0x427ce8){if(!_0x427ce8)throw new InternalError();return _0x427ce8[_0x2dc2('0x23')]();})['then'](function(){_0x70fbf8[_0x2dc2('0x18')](0xcc)['end']();})[_0x2dc2('0x40')](handleError(_0x70fbf8,null));};function getBucketslist(_0xee8570,_0x4132b8,_0x116741){return new Promise(function(_0x5d1eeb,_0x4947ed){var _0x2fc11a=new AWS['S3']({'accessKeyId':_0x4132b8,'secretAccessKey':_0xee8570,'region':_0x116741});_0x2fc11a[_0x2dc2('0x68')]({},function(_0xf98be,_0x3d8796){if(_0xf98be){return _0x4947ed(_0xf98be);}else{return _0x5d1eeb(_0x3d8796);}});});}function createBucket(_0x1169a9,_0x426aeb,_0x2be341,_0x573fcf){return new Promise(function(_0x352661,_0x2c5383){var _0x191c29=new AWS['S3']({'accessKeyId':_0x426aeb,'secretAccessKey':_0x1169a9,'region':_0x2be341});_0x191c29[_0x2dc2('0x69')]({'Bucket':_0x573fcf},function(_0x108fff,_0x58e701){if(_0x108fff){return _0x2c5383(_0x108fff);}else{return _0x352661(_0x58e701);}});});}function uploadFile(_0x5aa654,_0x4f7647,_0x25aac1,_0x4e0dd6,_0x213cf4,_0x2b9dfa){return new Promise(function(_0x64fd59,_0x5984c0){var _0x5481ab=new AWS['S3']({'accessKeyId':_0x4f7647,'secretAccessKey':_0x5aa654,'region':_0x25aac1});_0x5481ab['upload']({'Bucket':_0x4e0dd6,'Key':_0x213cf4,'Body':_0x2b9dfa},function(_0x174732,_0x55d60f){if(_0x174732){return _0x5984c0(_0x174732);}else{return _0x64fd59(_0x55d60f);}});});}function startTranscribe(_0x4468d6,_0x1e8710,_0x506b0c,_0x90d29c,_0x59c125,_0x3403da){return new Promise(function(_0x17148c,_0x4b9091){var _0xb2e825=new AWS[(_0x2dc2('0x6a'))]({'accessKeyId':_0x1e8710,'secretAccessKey':_0x4468d6,'region':_0x506b0c});_0xb2e825[_0x2dc2('0x6b')]({'TranscriptionJobName':_0x90d29c,'LanguageCode':_0x59c125,'Media':{'MediaFileUri':_0x3403da}},function(_0x7666e1,_0xe3313f){if(_0x7666e1){return _0x4b9091(_0x7666e1);}else{return _0x17148c(_0xe3313f);}});});}function transcribe(_0x34aec0,_0x1e0ce6,_0x1d83a7,_0x513430,_0x25cb31,_0x19d9a4,_0x56a8da){return new Promise(function(_0x4fdc7a,_0x45f44a){var _0xdd414={};logger[_0x2dc2('0x63')](util[_0x2dc2('0x2e')](_0x2dc2('0x6c'),_0x34aec0,_0x25cb31));return uploadFile(_0x1e0ce6,_0x1d83a7,_0x513430,_0x25cb31,path[_0x2dc2('0x6d')](_0x19d9a4),fs[_0x2dc2('0x6e')](_0x19d9a4))[_0x2dc2('0x22')](function(_0x259d79){logger[_0x2dc2('0x63')](util[_0x2dc2('0x2e')](_0x2dc2('0x6f'),_0x34aec0,_0x25cb31,_0x259d79['Location']));_0xdd414[_0x2dc2('0x70')]=_0x259d79[_0x2dc2('0x71')];_0xdd414[_0x2dc2('0x72')]=_0x259d79[_0x2dc2('0x73')];logger[_0x2dc2('0x63')](util[_0x2dc2('0x2e')](_0x2dc2('0x74'),_0x34aec0));return startTranscribe(_0x1e0ce6,_0x1d83a7,_0x513430,uuidv4(),_0x56a8da,_0x259d79[_0x2dc2('0x73')]);})['then'](function(_0x5e214f){logger['info'](util['format']('[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created',_0x34aec0,_0x5e214f[_0x2dc2('0x75')][_0x2dc2('0x76')]));_0xdd414[_0x2dc2('0x77')]=_0x5e214f[_0x2dc2('0x75')][_0x2dc2('0x76')];_0xdd414[_0x2dc2('0x78')]=_0x5e214f['TranscriptionJob'][_0x2dc2('0x79')];return _0x4fdc7a(_0xdd414);})[_0x2dc2('0x40')](function(_0x15cfd3){return _0x45f44a(_0x15cfd3);});});}exports[_0x2dc2('0x7a')]=function(_0x38785e,_0x2d9d38,_0x1242c8){var _0x33561e;var _0x127ab0;var _0x1df31b;var _0x29074f=require('../../components/encryptor');return db[_0x2dc2('0x29')][_0x2dc2('0x7b')]({'where':{'id':_0x38785e[_0x2dc2('0x42')]['id']}})['then'](function(_0x11d2a6){if(_0x11d2a6){var _0x964784=util[_0x2dc2('0x2e')]('%s.cypher',_0x11d2a6[_0x2dc2('0x50')]);if(fs[_0x2dc2('0x4d')](_0x964784)){cypher=!![];return _0x29074f[_0x2dc2('0x4e')](_0x964784,_0x11d2a6[_0x2dc2('0x50')],config[_0x2dc2('0x7c')][_0x2dc2('0x4f')])['then'](function(){return _0x11d2a6;});}return _0x11d2a6;}})[_0x2dc2('0x22')](function(_0x23f1c5){if(!_0x23f1c5){throw new db[(_0x2dc2('0x60'))]['ValidationError']('Voice\x20Recording\x20not\x20found');}_0x127ab0=_0x23f1c5;return db['Setting'][_0x2dc2('0x7b')]({'where':{'id':0x1}});})[_0x2dc2('0x22')](handleEntityNotFound(_0x2d9d38,null))['then'](function(_0x315dcc){if(_0x315dcc){_0x33561e=_0x315dcc;if(!_0x33561e[_0x2dc2('0x7d')]||!_0x33561e[_0x2dc2('0x7e')]||!_0x33561e['transcribeRegion']||!_0x33561e[_0x2dc2('0x7f')]||!_0x33561e[_0x2dc2('0x70')]){throw new db[(_0x2dc2('0x60'))][(_0x2dc2('0x51'))](_0x2dc2('0x80'));}if(_0x38785e[_0x2dc2('0x47')][_0x2dc2('0x81')]&&(!_0x33561e[_0x2dc2('0x82')]||!_0x33561e[_0x2dc2('0x83')]||!_0x33561e[_0x2dc2('0x84')]||!_0x33561e[_0x2dc2('0x7f')]||!_0x33561e[_0x2dc2('0x70')])){throw new db[(_0x2dc2('0x60'))][(_0x2dc2('0x51'))](_0x2dc2('0x85'));}return db['CloudProvider'][_0x2dc2('0x7b')]({'where':{'id':_0x33561e[_0x2dc2('0x7e')]}});}})[_0x2dc2('0x22')](function(_0x1e91b4){if(!_0x1e91b4){throw new db['Sequelize']['ValidationError']('Cloud\x20Provider\x20not\x20available');}if(!_0x1e91b4[_0x2dc2('0x86')]||!_0x1e91b4['data2']){throw new db[(_0x2dc2('0x60'))][(_0x2dc2('0x51'))](_0x2dc2('0x87'));}_0x1df31b=_0x1e91b4;return getBucketslist(_0x1df31b[_0x2dc2('0x86')],_0x1df31b[_0x2dc2('0x88')],_0x33561e['transcribeRegion']);})['then'](function(_0x1b4377){if(_0x1b4377&&_0x1b4377[_0x2dc2('0x89')]){var _0xde2a6e=_['find'](_0x1b4377['Buckets'],function(_0x525341){return _0x525341[_0x2dc2('0x8a')]===_0x33561e[_0x2dc2('0x70')];});if(!_0xde2a6e){logger[_0x2dc2('0x63')](util[_0x2dc2('0x2e')](_0x2dc2('0x8b'),_0x38785e[_0x2dc2('0x42')]['id'],_0x33561e[_0x2dc2('0x70')]));return createBucket(_0x1df31b[_0x2dc2('0x86')],_0x1df31b[_0x2dc2('0x88')],_0x33561e[_0x2dc2('0x8c')],_0x33561e[_0x2dc2('0x70')]);}logger['info'](util[_0x2dc2('0x2e')](_0x2dc2('0x8d'),_0x38785e[_0x2dc2('0x42')]['id'],_0x33561e['bucket']));return;}})['then'](function(_0x3d5618){if(_0x127ab0[_0x2dc2('0x78')]===_0x2dc2('0x8e')){return transcribe(_0x38785e['params']['id'],_0x1df31b['data1'],_0x1df31b[_0x2dc2('0x88')],_0x33561e[_0x2dc2('0x8c')],_0x33561e[_0x2dc2('0x70')],_0x127ab0[_0x2dc2('0x50')],_0x33561e[_0x2dc2('0x7f')]);}else{logger[_0x2dc2('0x63')](util[_0x2dc2('0x2e')](_0x2dc2('0x8f'),_0x38785e[_0x2dc2('0x42')]['id']));return{'transcribeStatus':_0x2dc2('0x90')};}})['then'](function(_0x30f7a0){if(_0x30f7a0){_0x30f7a0[_0x2dc2('0x91')]=_0x38785e[_0x2dc2('0x47')][_0x2dc2('0x81')];return _0x127ab0[_0x2dc2('0x92')](_0x30f7a0);}})[_0x2dc2('0x22')](respondWithResult(_0x2d9d38,null))[_0x2dc2('0x40')](handleError(_0x2d9d38,null));};function writeFile(_0x814d3c,_0x123a5e){return new Promise(function(_0x5055fe,_0x4a92bf){fs[_0x2dc2('0x93')](_0x123a5e,_0x814d3c,function(_0x309881,_0x14a6ea){if(_0x309881){return _0x4a92bf(_0x309881);}else{return _0x5055fe(_0x14a6ea);}});});}exports[_0x2dc2('0x94')]=function(_0x28b3c6,_0x178922,_0x21d01b){return db[_0x2dc2('0x29')][_0x2dc2('0x7b')]({'where':{'id':_0x28b3c6[_0x2dc2('0x42')]['id']}})[_0x2dc2('0x22')](handleEntityNotFound(_0x178922))[_0x2dc2('0x22')](function(_0x2e4170){if(_0x2e4170&&_0x2e4170[_0x2dc2('0x95')]){var _0x2934b8=_0x2e4170[_0x2dc2('0x95')];var _0x265292=config['root']+_0x2dc2('0x96')+_0x2e4170['id']+_0x2dc2('0x97');if(fs[_0x2dc2('0x4d')](_0x265292)){return _0x265292;}return writeFile(_0x2934b8,_0x265292)[_0x2dc2('0x22')](function(){return _0x265292;});}else{throw new db[(_0x2dc2('0x60'))][(_0x2dc2('0x51'))](_0x2dc2('0x98'));}})[_0x2dc2('0x22')](function(_0x2baa69){return _0x178922['download'](_0x2baa69);})[_0x2dc2('0x40')](handleError(_0x178922));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index 0c102a6..b794682 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 _0x1534=['moment','bluebird','path','rimraf','./voiceRecording.attributes','exports','define','VoiceRecording','voice_recordings','uniqueid','lodash','util','../../config/logger'];(function(_0x211e15,_0x395d76){var _0x563752=function(_0x2dd7b5){while(--_0x2dd7b5){_0x211e15['push'](_0x211e15['shift']());}};_0x563752(++_0x395d76);}(_0x1534,0xda));var _0x4153=function(_0x499c0d,_0x3a36b7){_0x499c0d=_0x499c0d-0x0;var _0x19dfb4=_0x1534[_0x499c0d];return _0x19dfb4;};'use strict';var _=require(_0x4153('0x0'));var util=require(_0x4153('0x1'));var logger=require(_0x4153('0x2'))('api');var moment=require(_0x4153('0x3'));var BPromise=require(_0x4153('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4153('0x5'));var rimraf=require(_0x4153('0x6'));var config=require('../../config/environment');var attributes=require(_0x4153('0x7'));module[_0x4153('0x8')]=function(_0x2b7e54,_0x85a1cc){return _0x2b7e54[_0x4153('0x9')](_0x4153('0xa'),attributes,{'tableName':_0x4153('0xb'),'paranoid':![],'indexes':[{'name':_0x4153('0xc'),'fields':[_0x4153('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xfb05=['bluebird','request-promise','./voiceRecording.attributes','define','VoiceRecording','uniqueid','lodash','util','../../config/logger','api','moment'];(function(_0x592cd4,_0x333a29){var _0x10377b=function(_0x45a3a1){while(--_0x45a3a1){_0x592cd4['push'](_0x592cd4['shift']());}};_0x10377b(++_0x333a29);}(_0xfb05,0x1b3));var _0x5fb0=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0xfb05[_0x413feb];return _0x40ee88;};'use strict';var _=require(_0x5fb0('0x0'));var util=require(_0x5fb0('0x1'));var logger=require(_0x5fb0('0x2'))(_0x5fb0('0x3'));var moment=require(_0x5fb0('0x4'));var BPromise=require(_0x5fb0('0x5'));var rp=require(_0x5fb0('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x5fb0('0x7'));module['exports']=function(_0x51282a,_0x2dc7b6){return _0x51282a[_0x5fb0('0x8')](_0x5fb0('0x9'),attributes,{'tableName':'voice_recordings','paranoid':![],'indexes':[{'name':_0x5fb0('0xa'),'fields':[_0x5fb0('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.rpc.js b/server/api/voiceRecording/voiceRecording.rpc.js index e7ff59c..5955884 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 _0x8e3f=['where','attributes','limit','stringify','CreateVoiceRecording','../../components/encryptor','Setting','findOne','callRecordingEncryption','create','existsSync','value','format','%s.cypher','encryptFile','recording','CreateVoiceRecording\x20file\x20encrypted','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then','info','VoiceRecording,\x20%s,\x20%s','request\x20sent','debug','VoiceRecording,\x20%s,\x20%s,\x20%s','error','code','message','catch','UpdateVoiceRecording','VoiceRecording','body','options','raw'];(function(_0x45853d,_0x2317a1){var _0x8bbe39=function(_0x40a612){while(--_0x40a612){_0x45853d['push'](_0x45853d['shift']());}};_0x8bbe39(++_0x2317a1);}(_0x8e3f,0xc1));var _0xf8e3=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x8e3f[_0x59ee6f];return _0x4c0979;};'use strict';var _=require(_0xf8e3('0x0'));var util=require(_0xf8e3('0x1'));var moment=require(_0xf8e3('0x2'));var BPromise=require('bluebird');var rs=require(_0xf8e3('0x3'));var fs=require('fs');var Redis=require(_0xf8e3('0x4'));var db=require(_0xf8e3('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xf8e3('0x6'))(_0xf8e3('0x7'));var config=require('../../config/environment');var jayson=require(_0xf8e3('0x8'));var client=jayson[_0xf8e3('0x9')][_0xf8e3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1ee9f3,_0x4e9e57,_0x4504dd){return new BPromise(function(_0x2e39b7,_0x17f56c){return client[_0xf8e3('0xb')](_0x1ee9f3,_0x4504dd)[_0xf8e3('0xc')](function(_0x4055e2){logger[_0xf8e3('0xd')](_0xf8e3('0xe'),_0x4e9e57,_0xf8e3('0xf'));logger[_0xf8e3('0x10')](_0xf8e3('0x11'),_0x4e9e57,_0xf8e3('0xf'),JSON['stringify'](_0x4055e2));if(_0x4055e2[_0xf8e3('0x12')]){if(_0x4055e2[_0xf8e3('0x12')][_0xf8e3('0x13')]===0x1f4){logger['error'](_0xf8e3('0xe'),_0x4e9e57,_0x4055e2[_0xf8e3('0x12')][_0xf8e3('0x14')]);return _0x17f56c(_0x4055e2[_0xf8e3('0x12')]['message']);}logger[_0xf8e3('0x12')](_0xf8e3('0xe'),_0x4e9e57,_0x4055e2[_0xf8e3('0x12')]['message']);return _0x2e39b7(_0x4055e2[_0xf8e3('0x12')]['message']);}else{logger[_0xf8e3('0xd')](_0xf8e3('0xe'),_0x4e9e57,_0xf8e3('0xf'));_0x2e39b7(_0x4055e2['result']['message']);}})[_0xf8e3('0x15')](function(_0x385dde){logger[_0xf8e3('0x12')](_0xf8e3('0xe'),_0x4e9e57,_0x385dde);_0x17f56c(_0x385dde);});});}exports[_0xf8e3('0x16')]=function(_0x11d4cc){var _0x7a81c3=this;return new Promise(function(_0x2e27e3,_0x1337ae){return db[_0xf8e3('0x17')]['update'](_0x11d4cc[_0xf8e3('0x18')],{'raw':_0x11d4cc[_0xf8e3('0x19')]?_0x11d4cc[_0xf8e3('0x19')][_0xf8e3('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x11d4cc[_0xf8e3('0x19')]?_0x11d4cc[_0xf8e3('0x19')][_0xf8e3('0x1b')]||null:null,'attributes':_0x11d4cc[_0xf8e3('0x19')]?_0x11d4cc['options'][_0xf8e3('0x1c')]||null:null,'limit':_0x11d4cc[_0xf8e3('0x19')]?_0x11d4cc[_0xf8e3('0x19')][_0xf8e3('0x1d')]||null:null})['then'](function(_0x39df34){logger['info'](_0xf8e3('0x16'),_0x11d4cc);logger[_0xf8e3('0x10')](_0xf8e3('0x16'),_0x11d4cc,JSON[_0xf8e3('0x1e')](_0x39df34));_0x2e27e3(_0x39df34);})[_0xf8e3('0x15')](function(_0x3ac384){logger['error'](_0xf8e3('0x16'),_0x3ac384[_0xf8e3('0x14')],_0x11d4cc);_0x1337ae(_0x7a81c3[_0xf8e3('0x12')](0x1f4,_0x3ac384[_0xf8e3('0x14')]));});});};exports[_0xf8e3('0x1f')]=function(_0x3b41a1){var _0x2963ed=this;return new Promise(function(_0x157a2d,_0x56fa8e){var _0x356e0a=require(_0xf8e3('0x20'));var _0x12ebd2;return db[_0xf8e3('0x21')][_0xf8e3('0x22')]({'attributes':['id',_0xf8e3('0x23')],'where':{'id':0x1},'raw':!![]})[_0xf8e3('0xc')](function(_0xfaf15d){_0x12ebd2=_0xfaf15d;return db['VoiceRecording'][_0xf8e3('0x24')](_0x3b41a1[_0xf8e3('0x18')]);})[_0xf8e3('0xc')](function(_0x28b2f2){if(_0x12ebd2['callRecordingEncryption']&&fs[_0xf8e3('0x25')](_0x28b2f2[_0xf8e3('0x26')])){var _0x40f64d=util[_0xf8e3('0x27')](_0xf8e3('0x28'),_0x28b2f2[_0xf8e3('0x26')]);return _0x356e0a[_0xf8e3('0x29')](_0x28b2f2[_0xf8e3('0x26')],_0x40f64d,config['secrets'][_0xf8e3('0x2a')])[_0xf8e3('0xc')](function(){fs['unlink'](_0x28b2f2['value']);logger['info'](_0xf8e3('0x2b'));return _0x28b2f2;});}return _0x28b2f2;})['then'](function(_0x2559ea){logger[_0xf8e3('0xd')](_0xf8e3('0x1f'),_0x3b41a1);logger[_0xf8e3('0x10')]('CreateVoiceRecording',_0x3b41a1,JSON['stringify'](_0x2559ea));_0x157a2d(_0x2559ea);})[_0xf8e3('0x15')](function(_0x2f87d8){logger[_0xf8e3('0x12')](_0xf8e3('0x1f'),_0x2f87d8[_0xf8e3('0x14')],_0x3b41a1);_0x56fa8e(_0x2963ed[_0xf8e3('0x12')](0x1f4,_0x2f87d8['message']));});});}; \ No newline at end of file +var _0xa6b0=['create','value','%s.cypher','encryptFile','secrets','unlink','CreateVoiceRecording\x20file\x20encrypted','lodash','util','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','VoiceRecording,\x20%s,\x20%s','request\x20sent','debug','VoiceRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','update','body','options','raw','where','limit','then','UpdateVoiceRecording','CreateVoiceRecording','../../components/encryptor','callRecordingEncryption','VoiceRecording'];(function(_0x341a71,_0x361e5e){var _0x20ea70=function(_0xd0da0f){while(--_0xd0da0f){_0x341a71['push'](_0x341a71['shift']());}};_0x20ea70(++_0x361e5e);}(_0xa6b0,0xaf));var _0x0a6b=function(_0x327cef,_0x47597c){_0x327cef=_0x327cef-0x0;var _0x4916ac=_0xa6b0[_0x327cef];return _0x4916ac;};'use strict';var _=require(_0x0a6b('0x0'));var util=require(_0x0a6b('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x0a6b('0x2'));var fs=require('fs');var Redis=require(_0x0a6b('0x3'));var db=require(_0x0a6b('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x0a6b('0x5'))(_0x0a6b('0x6'));var config=require(_0x0a6b('0x7'));var jayson=require(_0x0a6b('0x8'));var client=jayson[_0x0a6b('0x9')][_0x0a6b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1b5fb5,_0xa908dd,_0x26f761){return new BPromise(function(_0x340a33,_0x8e89f){return client[_0x0a6b('0xb')](_0x1b5fb5,_0x26f761)['then'](function(_0x493948){logger[_0x0a6b('0xc')](_0x0a6b('0xd'),_0xa908dd,_0x0a6b('0xe'));logger[_0x0a6b('0xf')](_0x0a6b('0x10'),_0xa908dd,_0x0a6b('0xe'),JSON[_0x0a6b('0x11')](_0x493948));if(_0x493948[_0x0a6b('0x12')]){if(_0x493948[_0x0a6b('0x12')][_0x0a6b('0x13')]===0x1f4){logger[_0x0a6b('0x12')](_0x0a6b('0xd'),_0xa908dd,_0x493948[_0x0a6b('0x12')][_0x0a6b('0x14')]);return _0x8e89f(_0x493948['error']['message']);}logger[_0x0a6b('0x12')](_0x0a6b('0xd'),_0xa908dd,_0x493948[_0x0a6b('0x12')][_0x0a6b('0x14')]);return _0x340a33(_0x493948[_0x0a6b('0x12')][_0x0a6b('0x14')]);}else{logger[_0x0a6b('0xc')](_0x0a6b('0xd'),_0xa908dd,_0x0a6b('0xe'));_0x340a33(_0x493948[_0x0a6b('0x15')]['message']);}})[_0x0a6b('0x16')](function(_0x1538f4){logger['error'](_0x0a6b('0xd'),_0xa908dd,_0x1538f4);_0x8e89f(_0x1538f4);});});}exports['UpdateVoiceRecording']=function(_0xcb412){var _0x31f347=this;return new Promise(function(_0x2cb10b,_0x1ad45d){return db['VoiceRecording'][_0x0a6b('0x17')](_0xcb412[_0x0a6b('0x18')],{'raw':_0xcb412['options']?_0xcb412[_0x0a6b('0x19')][_0x0a6b('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xcb412[_0x0a6b('0x19')]?_0xcb412['options'][_0x0a6b('0x1b')]||null:null,'attributes':_0xcb412[_0x0a6b('0x19')]?_0xcb412[_0x0a6b('0x19')]['attributes']||null:null,'limit':_0xcb412[_0x0a6b('0x19')]?_0xcb412[_0x0a6b('0x19')][_0x0a6b('0x1c')]||null:null})[_0x0a6b('0x1d')](function(_0x122c19){logger['info'](_0x0a6b('0x1e'),_0xcb412);logger[_0x0a6b('0xf')](_0x0a6b('0x1e'),_0xcb412,JSON['stringify'](_0x122c19));_0x2cb10b(_0x122c19);})[_0x0a6b('0x16')](function(_0x2e58fd){logger[_0x0a6b('0x12')](_0x0a6b('0x1e'),_0x2e58fd[_0x0a6b('0x14')],_0xcb412);_0x1ad45d(_0x31f347['error'](0x1f4,_0x2e58fd[_0x0a6b('0x14')]));});});};exports[_0x0a6b('0x1f')]=function(_0x19a653){var _0x4ce9d4=this;return new Promise(function(_0x3a9092,_0x51e760){var _0xecbf0c=require(_0x0a6b('0x20'));var _0x45ae97;return db['Setting']['findOne']({'attributes':['id',_0x0a6b('0x21')],'where':{'id':0x1},'raw':!![]})[_0x0a6b('0x1d')](function(_0x1aecc7){_0x45ae97=_0x1aecc7;return db[_0x0a6b('0x22')][_0x0a6b('0x23')](_0x19a653[_0x0a6b('0x18')]);})['then'](function(_0xa7ab7c){if(_0x45ae97[_0x0a6b('0x21')]&&fs['existsSync'](_0xa7ab7c[_0x0a6b('0x24')])){var _0x554145=util['format'](_0x0a6b('0x25'),_0xa7ab7c[_0x0a6b('0x24')]);return _0xecbf0c[_0x0a6b('0x26')](_0xa7ab7c[_0x0a6b('0x24')],_0x554145,config[_0x0a6b('0x27')]['recording'])['then'](function(){fs[_0x0a6b('0x28')](_0xa7ab7c[_0x0a6b('0x24')]);logger[_0x0a6b('0xc')](_0x0a6b('0x29'));return _0xa7ab7c;});}return _0xa7ab7c;})['then'](function(_0xe2b82b){logger[_0x0a6b('0xc')]('CreateVoiceRecording',_0x19a653);logger['debug'](_0x0a6b('0x1f'),_0x19a653,JSON[_0x0a6b('0x11')](_0xe2b82b));_0x3a9092(_0xe2b82b);})['catch'](function(_0x3c3c23){logger[_0x0a6b('0x12')](_0x0a6b('0x1f'),_0x3c3c23[_0x0a6b('0x14')],_0x19a653);_0x51e760(_0x4ce9d4[_0x0a6b('0x12')](0x1f4,_0x3c3c23[_0x0a6b('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/index.js b/server/api/voiceTransferReport/index.js index 11ae264..b20469a 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 _0xf3a9=['delete','destroy','exports','multer','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update'];(function(_0x12c206,_0xfceab7){var _0x21bb14=function(_0x25b18f){while(--_0x25b18f){_0x12c206['push'](_0x12c206['shift']());}};_0x21bb14(++_0xfceab7);}(_0xf3a9,0x71));var _0x9f3a=function(_0x2d0850,_0x2a649a){_0x2d0850=_0x2d0850-0x0;var _0x3081e5=_0xf3a9[_0x2d0850];return _0x3081e5;};'use strict';var multer=require(_0x9f3a('0x0'));var util=require('util');var path=require(_0x9f3a('0x1'));var timeout=require(_0x9f3a('0x2'));var express=require('express');var router=express[_0x9f3a('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x9f3a('0x4'));var interaction=require(_0x9f3a('0x5'));var config=require(_0x9f3a('0x6'));var controller=require(_0x9f3a('0x7'));router[_0x9f3a('0x8')]('/',auth[_0x9f3a('0x9')](),controller[_0x9f3a('0xa')]);router[_0x9f3a('0x8')](_0x9f3a('0xb'),auth[_0x9f3a('0x9')](),controller[_0x9f3a('0xc')]);router['get'](_0x9f3a('0xd'),auth[_0x9f3a('0x9')](),controller[_0x9f3a('0xe')]);router[_0x9f3a('0xf')]('/',auth[_0x9f3a('0x9')](),controller[_0x9f3a('0x10')]);router[_0x9f3a('0x11')]('/:id',auth[_0x9f3a('0x9')](),controller[_0x9f3a('0x12')]);router[_0x9f3a('0x13')]('/:id',auth[_0x9f3a('0x9')](),controller[_0x9f3a('0x14')]);module[_0x9f3a('0x15')]=router; \ No newline at end of file +var _0x01b3=['/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./voiceTransferReport.controller','get','isAuthenticated','/describe','describe'];(function(_0x12644f,_0x230331){var _0x2f5651=function(_0x34995c){while(--_0x34995c){_0x12644f['push'](_0x12644f['shift']());}};_0x2f5651(++_0x230331);}(_0x01b3,0x17f));var _0x301b=function(_0x4b1e23,_0xcc0800){_0x4b1e23=_0x4b1e23-0x0;var _0x58b685=_0x01b3[_0x4b1e23];return _0x58b685;};'use strict';var multer=require(_0x301b('0x0'));var util=require(_0x301b('0x1'));var path=require(_0x301b('0x2'));var timeout=require(_0x301b('0x3'));var express=require(_0x301b('0x4'));var router=express[_0x301b('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x301b('0x6'));var config=require(_0x301b('0x7'));var controller=require(_0x301b('0x8'));router[_0x301b('0x9')]('/',auth[_0x301b('0xa')](),controller['index']);router[_0x301b('0x9')](_0x301b('0xb'),auth[_0x301b('0xa')](),controller[_0x301b('0xc')]);router[_0x301b('0x9')](_0x301b('0xd'),auth['isAuthenticated'](),controller[_0x301b('0xe')]);router[_0x301b('0xf')]('/',auth[_0x301b('0xa')](),controller[_0x301b('0x10')]);router[_0x301b('0x11')](_0x301b('0xd'),auth[_0x301b('0xa')](),controller[_0x301b('0x12')]);router[_0x301b('0x13')](_0x301b('0xd'),auth[_0x301b('0xa')](),controller[_0x301b('0x14')]);module[_0x301b('0x15')]=router; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.attributes.js b/server/api/voiceTransferReport/voiceTransferReport.attributes.js index 30db52c..cb37414 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 _0xf4cf=['Yes','sequelize','moment','exports','ENUM','blind','attended','STRING'];(function(_0xe43d15,_0x2d0b69){var _0x2172af=function(_0x271128){while(--_0x271128){_0xe43d15['push'](_0xe43d15['shift']());}};_0x2172af(++_0x2d0b69);}(_0xf4cf,0xf1));var _0xff4c=function(_0x422905,_0x3bce3a){_0x422905=_0x422905-0x0;var _0x33dc6c=_0xf4cf[_0x422905];return _0x33dc6c;};'use strict';var Sequelize=require(_0xff4c('0x0'));var moment=require(_0xff4c('0x1'));module[_0xff4c('0x2')]={'type':{'type':Sequelize[_0xff4c('0x3')](_0xff4c('0x4'),_0xff4c('0x5'))},'result':{'type':Sequelize[_0xff4c('0x6')]},'transfererchannel':{'type':Sequelize['STRING']},'transferercalleridnum':{'type':Sequelize['STRING']},'transferercalleridname':{'type':Sequelize['STRING']},'transfererconnectedlinenum':{'type':Sequelize[_0xff4c('0x6')]},'transfererconnectedlinename':{'type':Sequelize[_0xff4c('0x6')]},'transfereraccountcode':{'type':Sequelize['STRING']},'transferercontext':{'type':Sequelize[_0xff4c('0x6')]},'transfererexten':{'type':Sequelize[_0xff4c('0x6')]},'transfererlinkedid':{'type':Sequelize['STRING']},'transfereechannel':{'type':Sequelize[_0xff4c('0x6')]},'transfereecalleridnum':{'type':Sequelize['STRING']},'transfereecalleridname':{'type':Sequelize['STRING']},'transfereeconnectedlinenum':{'type':Sequelize[_0xff4c('0x6')]},'transfereeconnectedlinename':{'type':Sequelize[_0xff4c('0x6')]},'transfereeaccountcode':{'type':Sequelize[_0xff4c('0x6')]},'transfereecontext':{'type':Sequelize[_0xff4c('0x6')]},'transfereeexten':{'type':Sequelize['STRING']},'transfereelinkedid':{'type':Sequelize[_0xff4c('0x6')]},'isexternal':{'type':Sequelize[_0xff4c('0x3')](_0xff4c('0x7'),'No')},'context':{'type':Sequelize[_0xff4c('0x6')]},'extension':{'type':Sequelize[_0xff4c('0x6')]}}; \ No newline at end of file +var _0x5a5b=['exports','ENUM','blind','attended','STRING','moment'];(function(_0x235cb0,_0x248eb8){var _0x2b0b30=function(_0x1f8990){while(--_0x1f8990){_0x235cb0['push'](_0x235cb0['shift']());}};_0x2b0b30(++_0x248eb8);}(_0x5a5b,0x137));var _0xb5a5=function(_0x40e12c,_0x5e53e3){_0x40e12c=_0x40e12c-0x0;var _0x221ddc=_0x5a5b[_0x40e12c];return _0x221ddc;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xb5a5('0x0'));module[_0xb5a5('0x1')]={'type':{'type':Sequelize[_0xb5a5('0x2')](_0xb5a5('0x3'),_0xb5a5('0x4'))},'result':{'type':Sequelize[_0xb5a5('0x5')]},'transfererchannel':{'type':Sequelize['STRING']},'transferercalleridnum':{'type':Sequelize['STRING']},'transferercalleridname':{'type':Sequelize[_0xb5a5('0x5')]},'transfererconnectedlinenum':{'type':Sequelize[_0xb5a5('0x5')]},'transfererconnectedlinename':{'type':Sequelize[_0xb5a5('0x5')]},'transfereraccountcode':{'type':Sequelize[_0xb5a5('0x5')]},'transferercontext':{'type':Sequelize['STRING']},'transfererexten':{'type':Sequelize[_0xb5a5('0x5')]},'transfererlinkedid':{'type':Sequelize[_0xb5a5('0x5')]},'transfereechannel':{'type':Sequelize[_0xb5a5('0x5')]},'transfereecalleridnum':{'type':Sequelize[_0xb5a5('0x5')]},'transfereecalleridname':{'type':Sequelize[_0xb5a5('0x5')]},'transfereeconnectedlinenum':{'type':Sequelize[_0xb5a5('0x5')]},'transfereeconnectedlinename':{'type':Sequelize['STRING']},'transfereeaccountcode':{'type':Sequelize['STRING']},'transfereecontext':{'type':Sequelize[_0xb5a5('0x5')]},'transfereeexten':{'type':Sequelize[_0xb5a5('0x5')]},'transfereelinkedid':{'type':Sequelize[_0xb5a5('0x5')]},'isexternal':{'type':Sequelize[_0xb5a5('0x2')]('Yes','No')},'context':{'type':Sequelize[_0xb5a5('0x5')]},'extension':{'type':Sequelize[_0xb5a5('0x5')]}}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.controller.js b/server/api/voiceTransferReport/voiceTransferReport.controller.js index 5aa3a9a..816346b 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 _0x7364=['filter','merge','VIRTUAL','options','includeAll','include','VoiceTransferReport','findAll','rows','catch','show','params','find','create','body','update','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','then','destroy','error','name','send','index','rawAttributes','fieldName','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7364,0xfb));var _0x4736=function(_0x5427ac,_0x37c4a9){_0x5427ac=_0x5427ac-0x0;var _0x8c30f9=_0x7364[_0x5427ac];return _0x8c30f9;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4736('0x0'));var zipdir=require(_0x4736('0x1'));var jsonpatch=require(_0x4736('0x2'));var rp=require(_0x4736('0x3'));var moment=require(_0x4736('0x4'));var BPromise=require(_0x4736('0x5'));var Mustache=require(_0x4736('0x6'));var util=require('util');var path=require('path');var sox=require(_0x4736('0x7'));var csv=require(_0x4736('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4736('0x9'));var _=require(_0x4736('0xa'));var squel=require('squel');var crypto=require(_0x4736('0xb'));var jsforce=require(_0x4736('0xc'));var deskjs=require(_0x4736('0xd'));var toCsv=require('to-csv');var querystring=require(_0x4736('0xe'));var Papa=require(_0x4736('0xf'));var Redis=require(_0x4736('0x10'));var authService=require(_0x4736('0x11'));var qs=require(_0x4736('0x12'));var as=require(_0x4736('0x13'));var hardwareService=require(_0x4736('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x4736('0x15'));var config=require(_0x4736('0x16'));var licenseUtil=require(_0x4736('0x17'));var db=require(_0x4736('0x18'))['db'];function respondWithStatusCode(_0x49ec95,_0x2bd3b2){_0x2bd3b2=_0x2bd3b2||0xcc;return function(_0x10394d){if(_0x10394d){return _0x49ec95[_0x4736('0x19')](_0x2bd3b2);}return _0x49ec95[_0x4736('0x1a')](_0x2bd3b2)[_0x4736('0x1b')]();};}function respondWithResult(_0x5f3771,_0x32c2ad){_0x32c2ad=_0x32c2ad||0xc8;return function(_0x136135){if(_0x136135){return _0x5f3771[_0x4736('0x1a')](_0x32c2ad)['json'](_0x136135);}};}function respondWithFilteredResult(_0x35fab0,_0x353f38){return function(_0x36483a){if(_0x36483a){var _0x3bc984=typeof _0x353f38[_0x4736('0x1c')]===_0x4736('0x1d')&&typeof _0x353f38[_0x4736('0x1e')]==='undefined';var _0x3e50fa=_0x36483a[_0x4736('0x1f')];var _0x3d21c4=_0x3bc984?0x0:_0x353f38[_0x4736('0x1c')];var _0x56b92b=_0x3bc984?_0x36483a[_0x4736('0x1f')]:_0x353f38[_0x4736('0x1c')]+_0x353f38['limit'];var _0x28098e;if(_0x56b92b>=_0x3e50fa){_0x56b92b=_0x3e50fa;_0x28098e=0xc8;}else{_0x28098e=0xce;}_0x35fab0['status'](_0x28098e);return _0x35fab0[_0x4736('0x20')](_0x4736('0x21'),_0x3d21c4+'-'+_0x56b92b+'/'+_0x3e50fa)[_0x4736('0x22')](_0x36483a);}return null;};}function patchUpdates(_0x22bc12){return function(_0xb0cdec){try{jsonpatch[_0x4736('0x23')](_0xb0cdec,_0x22bc12,!![]);}catch(_0x2a9919){return BPromise[_0x4736('0x24')](_0x2a9919);}return _0xb0cdec[_0x4736('0x25')]();};}function saveUpdates(_0x218e07,_0x4359c1){return function(_0x1999e7){if(_0x1999e7){return _0x1999e7['update'](_0x218e07)[_0x4736('0x26')](function(_0x281ae1){return _0x281ae1;});}return null;};}function removeEntity(_0x464566,_0x4d11f1){return function(_0x1fd71b){if(_0x1fd71b){return _0x1fd71b[_0x4736('0x27')]()[_0x4736('0x26')](function(){_0x464566['status'](0xcc)[_0x4736('0x1b')]();});}};}function handleEntityNotFound(_0x523e18,_0x3efcb5){return function(_0x28bea5){if(!_0x28bea5){_0x523e18[_0x4736('0x19')](0x194);}return _0x28bea5;};}function handleError(_0x3b113b,_0x4d207d){_0x4d207d=_0x4d207d||0x1f4;return function(_0x30f7b0){logger[_0x4736('0x28')](_0x30f7b0['stack']);if(_0x30f7b0['name']){delete _0x30f7b0[_0x4736('0x29')];}_0x3b113b[_0x4736('0x1a')](_0x4d207d)[_0x4736('0x2a')](_0x30f7b0);};}exports[_0x4736('0x2b')]=function(_0x5b03ea,_0x30ce3b){var _0xa3e412={},_0x273c84={},_0x4c6c85={'count':0x0,'rows':[]};var _0x548deb=_['map'](db['VoiceTransferReport'][_0x4736('0x2c')],function(_0xf0e5c0){return{'name':_0xf0e5c0[_0x4736('0x2d')],'type':_0xf0e5c0['type']['key']};});_0x273c84[_0x4736('0x2e')]=_[_0x4736('0x2f')](_0x548deb,_0x4736('0x29'));_0x273c84[_0x4736('0x30')]=_[_0x4736('0x31')](_0x5b03ea[_0x4736('0x30')]);_0x273c84['filters']=_[_0x4736('0x32')](_0x273c84[_0x4736('0x2e')],_0x273c84[_0x4736('0x30')]);_0xa3e412[_0x4736('0x33')]=_['intersection'](_0x273c84[_0x4736('0x2e')],qs['fields'](_0x5b03ea[_0x4736('0x30')][_0x4736('0x34')]));_0xa3e412[_0x4736('0x33')]=_0xa3e412[_0x4736('0x33')][_0x4736('0x35')]?_0xa3e412[_0x4736('0x33')]:_0x273c84[_0x4736('0x2e')];if(!_0x5b03ea[_0x4736('0x30')][_0x4736('0x36')](_0x4736('0x37'))){_0xa3e412[_0x4736('0x1e')]=qs[_0x4736('0x1e')](_0x5b03ea[_0x4736('0x30')][_0x4736('0x1e')]);_0xa3e412[_0x4736('0x1c')]=qs['offset'](_0x5b03ea[_0x4736('0x30')][_0x4736('0x1c')]);}_0xa3e412[_0x4736('0x38')]=qs[_0x4736('0x39')](_0x5b03ea['query'][_0x4736('0x39')]);_0xa3e412[_0x4736('0x3a')]=qs[_0x4736('0x3b')](_[_0x4736('0x3c')](_0x5b03ea[_0x4736('0x30')],_0x273c84[_0x4736('0x3b')]),_0x548deb);if(_0x5b03ea[_0x4736('0x30')][_0x4736('0x3d')]){_0xa3e412[_0x4736('0x3a')]=_[_0x4736('0x3e')](_0xa3e412[_0x4736('0x3a')],{'$or':_[_0x4736('0x2f')](_0x548deb,function(_0x1f057c){if(_0x1f057c['type']!==_0x4736('0x3f')){var _0x2aa664={};_0x2aa664[_0x1f057c['name']]={'$like':'%'+_0x5b03ea['query'][_0x4736('0x3d')]+'%'};return _0x2aa664;}})});}_0xa3e412=_['merge']({},_0xa3e412,_0x5b03ea[_0x4736('0x40')]);var _0x9428e1={'where':_0xa3e412[_0x4736('0x3a')]};return db['VoiceTransferReport'][_0x4736('0x1f')](_0x9428e1)[_0x4736('0x26')](function(_0x2aa146){_0x4c6c85['count']=_0x2aa146;if(_0x5b03ea['query'][_0x4736('0x41')]){_0xa3e412[_0x4736('0x42')]=[{'all':!![]}];}return db[_0x4736('0x43')][_0x4736('0x44')](_0xa3e412);})[_0x4736('0x26')](function(_0x4c5af7){_0x4c6c85[_0x4736('0x45')]=_0x4c5af7;return _0x4c6c85;})[_0x4736('0x26')](respondWithFilteredResult(_0x30ce3b,_0xa3e412))[_0x4736('0x46')](handleError(_0x30ce3b,null));};exports[_0x4736('0x47')]=function(_0x1239d7,_0x467da6){var _0x1055eb={'raw':!![],'where':{'id':_0x1239d7[_0x4736('0x48')]['id']}},_0x5b2ffa={};_0x5b2ffa['model']=_[_0x4736('0x31')](db[_0x4736('0x43')][_0x4736('0x2c')]);_0x5b2ffa['query']=_['keys'](_0x1239d7[_0x4736('0x30')]);_0x5b2ffa[_0x4736('0x3b')]=_['intersection'](_0x5b2ffa['model'],_0x5b2ffa[_0x4736('0x30')]);_0x1055eb[_0x4736('0x33')]=_[_0x4736('0x32')](_0x5b2ffa[_0x4736('0x2e')],qs['fields'](_0x1239d7[_0x4736('0x30')]['fields']));_0x1055eb[_0x4736('0x33')]=_0x1055eb[_0x4736('0x33')]['length']?_0x1055eb[_0x4736('0x33')]:_0x5b2ffa[_0x4736('0x2e')];if(_0x1239d7['query']['includeAll']){_0x1055eb[_0x4736('0x42')]=[{'all':!![]}];}_0x1055eb=_[_0x4736('0x3e')]({},_0x1055eb,_0x1239d7[_0x4736('0x40')]);return db['VoiceTransferReport'][_0x4736('0x49')](_0x1055eb)[_0x4736('0x26')](handleEntityNotFound(_0x467da6,null))[_0x4736('0x26')](respondWithResult(_0x467da6,null))[_0x4736('0x46')](handleError(_0x467da6,null));};exports[_0x4736('0x4a')]=function(_0x5c453c,_0x36d7a4){return db[_0x4736('0x43')]['create'](_0x5c453c[_0x4736('0x4b')],{})['then'](respondWithResult(_0x36d7a4,0xc9))[_0x4736('0x46')](handleError(_0x36d7a4,null));};exports[_0x4736('0x4c')]=function(_0x266a18,_0x1f0017){if(_0x266a18['body']['id']){delete _0x266a18[_0x4736('0x4b')]['id'];}return db[_0x4736('0x43')][_0x4736('0x49')]({'where':{'id':_0x266a18[_0x4736('0x48')]['id']}})[_0x4736('0x26')](handleEntityNotFound(_0x1f0017,null))[_0x4736('0x26')](saveUpdates(_0x266a18['body'],null))[_0x4736('0x26')](respondWithResult(_0x1f0017,null))['catch'](handleError(_0x1f0017,null));};exports[_0x4736('0x27')]=function(_0x3f94bc,_0x4afa22){return db[_0x4736('0x43')]['find']({'where':{'id':_0x3f94bc[_0x4736('0x48')]['id']}})['then'](handleEntityNotFound(_0x4afa22,null))['then'](removeEntity(_0x4afa22,null))[_0x4736('0x46')](handleError(_0x4afa22,null));};exports[_0x4736('0x4d')]=function(_0x860529,_0x5820be){return db['VoiceTransferReport'][_0x4736('0x4d')]()[_0x4736('0x26')](respondWithResult(_0x5820be,null))['catch'](handleError(_0x5820be,null));}; \ No newline at end of file +var _0x40d0=['name','send','map','VoiceTransferReport','fieldName','type','key','query','keys','model','attributes','intersection','fields','hasOwnProperty','nolimit','order','where','filters','pick','filter','merge','VIRTUAL','includeAll','include','findAll','catch','show','params','rawAttributes','options','find','create','body','destroy','describe','eml-format','zip-dir','fast-json-patch','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','json','undefined','limit','count','offset','set','apply','reject','update','then','status','end','stack'];(function(_0x4d7530,_0xdee31){var _0x1afc9e=function(_0x2a0c56){while(--_0x2a0c56){_0x4d7530['push'](_0x4d7530['shift']());}};_0x1afc9e(++_0xdee31);}(_0x40d0,0x6c));var _0x040d=function(_0x28a8e4,_0x91294a){_0x28a8e4=_0x28a8e4-0x0;var _0x127409=_0x40d0[_0x28a8e4];return _0x127409;};'use strict';var emlformat=require(_0x040d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x040d('0x1'));var jsonpatch=require(_0x040d('0x2'));var rp=require('request-promise');var moment=require(_0x040d('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x040d('0x4'));var util=require(_0x040d('0x5'));var path=require(_0x040d('0x6'));var sox=require('sox');var csv=require(_0x040d('0x7'));var ejs=require(_0x040d('0x8'));var fs=require('fs');var fs_extra=require(_0x040d('0x9'));var _=require(_0x040d('0xa'));var squel=require(_0x040d('0xb'));var crypto=require(_0x040d('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x040d('0xd'));var toCsv=require(_0x040d('0x7'));var querystring=require(_0x040d('0xe'));var Papa=require(_0x040d('0xf'));var Redis=require(_0x040d('0x10'));var authService=require(_0x040d('0x11'));var qs=require(_0x040d('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x040d('0x13'));var logger=require(_0x040d('0x14'))(_0x040d('0x15'));var utils=require(_0x040d('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x040d('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xd8659e,_0x5028cd){_0x5028cd=_0x5028cd||0xcc;return function(_0x2af850){if(_0x2af850){return _0xd8659e[_0x040d('0x18')](_0x5028cd);}return _0xd8659e['status'](_0x5028cd)['end']();};}function respondWithResult(_0xb27637,_0x267cc7){_0x267cc7=_0x267cc7||0xc8;return function(_0x2b009d){if(_0x2b009d){return _0xb27637['status'](_0x267cc7)[_0x040d('0x19')](_0x2b009d);}};}function respondWithFilteredResult(_0x3916f1,_0x564b07){return function(_0x23d3a5){if(_0x23d3a5){var _0x56ab89=typeof _0x564b07['offset']===_0x040d('0x1a')&&typeof _0x564b07[_0x040d('0x1b')]===_0x040d('0x1a');var _0x512891=_0x23d3a5[_0x040d('0x1c')];var _0x1daa68=_0x56ab89?0x0:_0x564b07[_0x040d('0x1d')];var _0x164442=_0x56ab89?_0x23d3a5[_0x040d('0x1c')]:_0x564b07[_0x040d('0x1d')]+_0x564b07[_0x040d('0x1b')];var _0x4e5d29;if(_0x164442>=_0x512891){_0x164442=_0x512891;_0x4e5d29=0xc8;}else{_0x4e5d29=0xce;}_0x3916f1['status'](_0x4e5d29);return _0x3916f1[_0x040d('0x1e')]('Content-Range',_0x1daa68+'-'+_0x164442+'/'+_0x512891)[_0x040d('0x19')](_0x23d3a5);}return null;};}function patchUpdates(_0x274c4a){return function(_0x5531ea){try{jsonpatch[_0x040d('0x1f')](_0x5531ea,_0x274c4a,!![]);}catch(_0x306ad2){return BPromise[_0x040d('0x20')](_0x306ad2);}return _0x5531ea['save']();};}function saveUpdates(_0x225428,_0x486551){return function(_0x73eb50){if(_0x73eb50){return _0x73eb50[_0x040d('0x21')](_0x225428)[_0x040d('0x22')](function(_0x4c4115){return _0x4c4115;});}return null;};}function removeEntity(_0x2b6d80,_0x4dd627){return function(_0x13565f){if(_0x13565f){return _0x13565f['destroy']()[_0x040d('0x22')](function(){_0x2b6d80[_0x040d('0x23')](0xcc)[_0x040d('0x24')]();});}};}function handleEntityNotFound(_0x1effd8,_0x55fbf9){return function(_0x570435){if(!_0x570435){_0x1effd8[_0x040d('0x18')](0x194);}return _0x570435;};}function handleError(_0x336f1f,_0x62bf30){_0x62bf30=_0x62bf30||0x1f4;return function(_0x4d4dc0){logger['error'](_0x4d4dc0[_0x040d('0x25')]);if(_0x4d4dc0[_0x040d('0x26')]){delete _0x4d4dc0[_0x040d('0x26')];}_0x336f1f[_0x040d('0x23')](_0x62bf30)[_0x040d('0x27')](_0x4d4dc0);};}exports['index']=function(_0x5a4056,_0x2aa95e){var _0x425180={},_0x2c8284={},_0x15c8fc={'count':0x0,'rows':[]};var _0x26c45b=_[_0x040d('0x28')](db[_0x040d('0x29')]['rawAttributes'],function(_0x59c15a){return{'name':_0x59c15a[_0x040d('0x2a')],'type':_0x59c15a[_0x040d('0x2b')][_0x040d('0x2c')]};});_0x2c8284['model']=_[_0x040d('0x28')](_0x26c45b,_0x040d('0x26'));_0x2c8284[_0x040d('0x2d')]=_[_0x040d('0x2e')](_0x5a4056[_0x040d('0x2d')]);_0x2c8284['filters']=_['intersection'](_0x2c8284[_0x040d('0x2f')],_0x2c8284[_0x040d('0x2d')]);_0x425180[_0x040d('0x30')]=_[_0x040d('0x31')](_0x2c8284['model'],qs[_0x040d('0x32')](_0x5a4056['query'][_0x040d('0x32')]));_0x425180['attributes']=_0x425180['attributes']['length']?_0x425180[_0x040d('0x30')]:_0x2c8284[_0x040d('0x2f')];if(!_0x5a4056[_0x040d('0x2d')][_0x040d('0x33')](_0x040d('0x34'))){_0x425180[_0x040d('0x1b')]=qs['limit'](_0x5a4056[_0x040d('0x2d')][_0x040d('0x1b')]);_0x425180[_0x040d('0x1d')]=qs[_0x040d('0x1d')](_0x5a4056['query']['offset']);}_0x425180[_0x040d('0x35')]=qs['sort'](_0x5a4056[_0x040d('0x2d')]['sort']);_0x425180[_0x040d('0x36')]=qs[_0x040d('0x37')](_[_0x040d('0x38')](_0x5a4056['query'],_0x2c8284[_0x040d('0x37')]),_0x26c45b);if(_0x5a4056['query'][_0x040d('0x39')]){_0x425180['where']=_[_0x040d('0x3a')](_0x425180[_0x040d('0x36')],{'$or':_[_0x040d('0x28')](_0x26c45b,function(_0x322d94){if(_0x322d94[_0x040d('0x2b')]!==_0x040d('0x3b')){var _0x2e5946={};_0x2e5946[_0x322d94[_0x040d('0x26')]]={'$like':'%'+_0x5a4056[_0x040d('0x2d')][_0x040d('0x39')]+'%'};return _0x2e5946;}})});}_0x425180=_[_0x040d('0x3a')]({},_0x425180,_0x5a4056['options']);var _0xa70528={'where':_0x425180['where']};return db[_0x040d('0x29')][_0x040d('0x1c')](_0xa70528)[_0x040d('0x22')](function(_0x113ac9){_0x15c8fc['count']=_0x113ac9;if(_0x5a4056['query'][_0x040d('0x3c')]){_0x425180[_0x040d('0x3d')]=[{'all':!![]}];}return db[_0x040d('0x29')][_0x040d('0x3e')](_0x425180);})[_0x040d('0x22')](function(_0x51c00d){_0x15c8fc['rows']=_0x51c00d;return _0x15c8fc;})['then'](respondWithFilteredResult(_0x2aa95e,_0x425180))[_0x040d('0x3f')](handleError(_0x2aa95e,null));};exports[_0x040d('0x40')]=function(_0x4ed3ac,_0x8cf79d){var _0x2e531a={'raw':!![],'where':{'id':_0x4ed3ac[_0x040d('0x41')]['id']}},_0x228e24={};_0x228e24[_0x040d('0x2f')]=_[_0x040d('0x2e')](db[_0x040d('0x29')][_0x040d('0x42')]);_0x228e24[_0x040d('0x2d')]=_['keys'](_0x4ed3ac[_0x040d('0x2d')]);_0x228e24['filters']=_[_0x040d('0x31')](_0x228e24[_0x040d('0x2f')],_0x228e24[_0x040d('0x2d')]);_0x2e531a[_0x040d('0x30')]=_[_0x040d('0x31')](_0x228e24['model'],qs[_0x040d('0x32')](_0x4ed3ac[_0x040d('0x2d')]['fields']));_0x2e531a[_0x040d('0x30')]=_0x2e531a['attributes']['length']?_0x2e531a[_0x040d('0x30')]:_0x228e24['model'];if(_0x4ed3ac[_0x040d('0x2d')][_0x040d('0x3c')]){_0x2e531a[_0x040d('0x3d')]=[{'all':!![]}];}_0x2e531a=_[_0x040d('0x3a')]({},_0x2e531a,_0x4ed3ac[_0x040d('0x43')]);return db[_0x040d('0x29')][_0x040d('0x44')](_0x2e531a)[_0x040d('0x22')](handleEntityNotFound(_0x8cf79d,null))['then'](respondWithResult(_0x8cf79d,null))['catch'](handleError(_0x8cf79d,null));};exports[_0x040d('0x45')]=function(_0x7b794,_0x5e539d){return db[_0x040d('0x29')][_0x040d('0x45')](_0x7b794[_0x040d('0x46')],{})['then'](respondWithResult(_0x5e539d,0xc9))[_0x040d('0x3f')](handleError(_0x5e539d,null));};exports[_0x040d('0x21')]=function(_0x441d97,_0x2f9f2e){if(_0x441d97[_0x040d('0x46')]['id']){delete _0x441d97['body']['id'];}return db[_0x040d('0x29')]['find']({'where':{'id':_0x441d97[_0x040d('0x41')]['id']}})[_0x040d('0x22')](handleEntityNotFound(_0x2f9f2e,null))[_0x040d('0x22')](saveUpdates(_0x441d97[_0x040d('0x46')],null))[_0x040d('0x22')](respondWithResult(_0x2f9f2e,null))[_0x040d('0x3f')](handleError(_0x2f9f2e,null));};exports[_0x040d('0x47')]=function(_0x511b14,_0x4067b9){return db[_0x040d('0x29')][_0x040d('0x44')]({'where':{'id':_0x511b14['params']['id']}})[_0x040d('0x22')](handleEntityNotFound(_0x4067b9,null))['then'](removeEntity(_0x4067b9,null))[_0x040d('0x3f')](handleError(_0x4067b9,null));};exports[_0x040d('0x48')]=function(_0x3bf48e,_0x17ebcd){return db['VoiceTransferReport'][_0x040d('0x48')]()[_0x040d('0x22')](respondWithResult(_0x17ebcd,null))[_0x040d('0x3f')](handleError(_0x17ebcd,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index cac2f2f..f6220a6 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 _0xfc3f=['path','rimraf','../../config/environment','./voiceTransferReport.attributes','exports','define','VoiceTransferReport','util','../../config/logger','api','bluebird','request-promise'];(function(_0xae05de,_0x518819){var _0xb859db=function(_0x4817ec){while(--_0x4817ec){_0xae05de['push'](_0xae05de['shift']());}};_0xb859db(++_0x518819);}(_0xfc3f,0x127));var _0xffc3=function(_0x5447fd,_0x52a6b5){_0x5447fd=_0x5447fd-0x0;var _0x15b28a=_0xfc3f[_0x5447fd];return _0x15b28a;};'use strict';var _=require('lodash');var util=require(_0xffc3('0x0'));var logger=require(_0xffc3('0x1'))(_0xffc3('0x2'));var moment=require('moment');var BPromise=require(_0xffc3('0x3'));var rp=require(_0xffc3('0x4'));var fs=require('fs');var path=require(_0xffc3('0x5'));var rimraf=require(_0xffc3('0x6'));var config=require(_0xffc3('0x7'));var attributes=require(_0xffc3('0x8'));module[_0xffc3('0x9')]=function(_0x4539c2,_0x31882c){return _0x4539c2[_0xffc3('0xa')](_0xffc3('0xb'),attributes,{'tableName':'report_call_transfer','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x165d=['api','moment','request-promise','../../config/environment','./voiceTransferReport.attributes','exports','define','VoiceTransferReport','report_call_transfer','../../config/logger'];(function(_0x4d6280,_0x511e97){var _0xe26e4b=function(_0x1848b7){while(--_0x1848b7){_0x4d6280['push'](_0x4d6280['shift']());}};_0xe26e4b(++_0x511e97);}(_0x165d,0xc7));var _0xd165=function(_0x2857f3,_0x5f17c2){_0x2857f3=_0x2857f3-0x0;var _0x52a2a7=_0x165d[_0x2857f3];return _0x52a2a7;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xd165('0x0'))(_0xd165('0x1'));var moment=require(_0xd165('0x2'));var BPromise=require('bluebird');var rp=require(_0xd165('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xd165('0x4'));var attributes=require(_0xd165('0x5'));module[_0xd165('0x6')]=function(_0x2bb258,_0x5103ae){return _0x2bb258[_0xd165('0x7')](_0xd165('0x8'),attributes,{'tableName':_0xd165('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.rpc.js b/server/api/voiceTransferReport/voiceTransferReport.rpc.js index 765a037..a58ae3f 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 _0x46c7=['VoiceTransferReport','create','options','raw','then','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','info','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateVoiceTransferReport'];(function(_0x230ed,_0x425805){var _0x241186=function(_0x2c472c){while(--_0x2c472c){_0x230ed['push'](_0x230ed['shift']());}};_0x241186(++_0x425805);}(_0x46c7,0x13d));var _0x746c=function(_0x2adbeb,_0x5581be){_0x2adbeb=_0x2adbeb-0x0;var _0x5e18a6=_0x46c7[_0x2adbeb];return _0x5e18a6;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x746c('0x0'));var BPromise=require(_0x746c('0x1'));var rs=require(_0x746c('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x746c('0x3'))['db'];var utils=require(_0x746c('0x4'));var logger=require(_0x746c('0x5'))(_0x746c('0x6'));var config=require(_0x746c('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x746c('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1061d6,_0x3d9162,_0x49811a){return new BPromise(function(_0x1c2a70,_0x56ff3d){return client['request'](_0x1061d6,_0x49811a)['then'](function(_0x13e4e0){logger[_0x746c('0x9')](_0x746c('0xa'),_0x3d9162,_0x746c('0xb'));logger[_0x746c('0xc')](_0x746c('0xd'),_0x3d9162,_0x746c('0xb'),JSON[_0x746c('0xe')](_0x13e4e0));if(_0x13e4e0[_0x746c('0xf')]){if(_0x13e4e0[_0x746c('0xf')][_0x746c('0x10')]===0x1f4){logger[_0x746c('0xf')]('VoiceTransferReport,\x20%s,\x20%s',_0x3d9162,_0x13e4e0[_0x746c('0xf')][_0x746c('0x11')]);return _0x56ff3d(_0x13e4e0[_0x746c('0xf')][_0x746c('0x11')]);}logger[_0x746c('0xf')](_0x746c('0xa'),_0x3d9162,_0x13e4e0[_0x746c('0xf')][_0x746c('0x11')]);return _0x1c2a70(_0x13e4e0[_0x746c('0xf')]['message']);}else{logger[_0x746c('0x9')](_0x746c('0xa'),_0x3d9162,_0x746c('0xb'));_0x1c2a70(_0x13e4e0[_0x746c('0x12')][_0x746c('0x11')]);}})[_0x746c('0x13')](function(_0x572a52){logger[_0x746c('0xf')](_0x746c('0xa'),_0x3d9162,_0x572a52);_0x56ff3d(_0x572a52);});});}exports[_0x746c('0x14')]=function(_0x445867){var _0x20f6ed=this;return new Promise(function(_0x462550,_0x45c3c9){return db[_0x746c('0x15')][_0x746c('0x16')](_0x445867['body'],{'raw':_0x445867[_0x746c('0x17')]?_0x445867['options'][_0x746c('0x18')]===undefined?!![]:![]:!![]})[_0x746c('0x19')](function(_0x3214ac){logger[_0x746c('0x9')](_0x746c('0x14'),_0x445867);logger[_0x746c('0xc')](_0x746c('0x14'),_0x445867,JSON[_0x746c('0xe')](_0x3214ac));_0x462550(_0x3214ac);})[_0x746c('0x13')](function(_0x22c017){logger[_0x746c('0xf')](_0x746c('0x14'),_0x22c017[_0x746c('0x11')],_0x445867);_0x45c3c9(_0x20f6ed[_0x746c('0xf')](0x1f4,_0x22c017[_0x746c('0x11')]));});});}; \ No newline at end of file +var _0x50c3=['CreateVoiceTransferReport','VoiceTransferReport','create','body','raw','debug','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','VoiceTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x3a6b78,_0x2d62be){var _0x4943d4=function(_0x33ab64){while(--_0x33ab64){_0x3a6b78['push'](_0x3a6b78['shift']());}};_0x4943d4(++_0x2d62be);}(_0x50c3,0x19d));var _0x350c=function(_0x1668b4,_0x4055ec){_0x1668b4=_0x1668b4-0x0;var _0x3e2277=_0x50c3[_0x1668b4];return _0x3e2277;};'use strict';var _=require(_0x350c('0x0'));var util=require('util');var moment=require(_0x350c('0x1'));var BPromise=require(_0x350c('0x2'));var rs=require(_0x350c('0x3'));var fs=require('fs');var Redis=require(_0x350c('0x4'));var db=require(_0x350c('0x5'))['db'];var utils=require(_0x350c('0x6'));var logger=require(_0x350c('0x7'))('rpc');var config=require(_0x350c('0x8'));var jayson=require(_0x350c('0x9'));var client=jayson['client'][_0x350c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xbe514e,_0x4dbadb,_0x41c3ee){return new BPromise(function(_0x4fd1eb,_0x7a5d58){return client[_0x350c('0xb')](_0xbe514e,_0x41c3ee)[_0x350c('0xc')](function(_0x446c66){logger[_0x350c('0xd')](_0x350c('0xe'),_0x4dbadb,_0x350c('0xf'));logger['debug'](_0x350c('0x10'),_0x4dbadb,_0x350c('0xf'),JSON[_0x350c('0x11')](_0x446c66));if(_0x446c66[_0x350c('0x12')]){if(_0x446c66[_0x350c('0x12')][_0x350c('0x13')]===0x1f4){logger[_0x350c('0x12')]('VoiceTransferReport,\x20%s,\x20%s',_0x4dbadb,_0x446c66['error'][_0x350c('0x14')]);return _0x7a5d58(_0x446c66['error']['message']);}logger[_0x350c('0x12')]('VoiceTransferReport,\x20%s,\x20%s',_0x4dbadb,_0x446c66[_0x350c('0x12')]['message']);return _0x4fd1eb(_0x446c66['error']['message']);}else{logger[_0x350c('0xd')](_0x350c('0xe'),_0x4dbadb,'request\x20sent');_0x4fd1eb(_0x446c66[_0x350c('0x15')][_0x350c('0x14')]);}})['catch'](function(_0x36103d){logger[_0x350c('0x12')]('VoiceTransferReport,\x20%s,\x20%s',_0x4dbadb,_0x36103d);_0x7a5d58(_0x36103d);});});}exports[_0x350c('0x16')]=function(_0x1d7c9f){var _0x2fe860=this;return new Promise(function(_0xefa9ba,_0x234843){return db[_0x350c('0x17')][_0x350c('0x18')](_0x1d7c9f[_0x350c('0x19')],{'raw':_0x1d7c9f['options']?_0x1d7c9f['options'][_0x350c('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x252dbc){logger[_0x350c('0xd')]('CreateVoiceTransferReport',_0x1d7c9f);logger[_0x350c('0x1b')]('CreateVoiceTransferReport',_0x1d7c9f,JSON[_0x350c('0x11')](_0x252dbc));_0xefa9ba(_0x252dbc);})[_0x350c('0x1c')](function(_0x2f05ac){logger['error']('CreateVoiceTransferReport',_0x2f05ac[_0x350c('0x14')],_0x1d7c9f);_0x234843(_0x2fe860[_0x350c('0x12')](0x1f4,_0x2f05ac[_0x350c('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/webbar/index.js b/server/api/webbar/index.js index d2b13d5..b4e20ec 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 _0xc13f=['isAuthenticated','canUpdate','originate','post','/hangup','hangup','/answer','answer','/hold','/unhold','unhold','/calls','calls','/transfer','transfer','express','Router','../../components/auth/service','./webbar.controller'];(function(_0x18bfcc,_0x32f883){var _0x4e1798=function(_0x2c0b38){while(--_0x2c0b38){_0x18bfcc['push'](_0x18bfcc['shift']());}};_0x4e1798(++_0x32f883);}(_0xc13f,0x94));var _0xfc13=function(_0x3d556c,_0x47108b){_0x3d556c=_0x3d556c-0x0;var _0x12b0b1=_0xc13f[_0x3d556c];return _0x12b0b1;};'use strict';var express=require(_0xfc13('0x0'));var router=express[_0xfc13('0x1')]();var auth=require(_0xfc13('0x2'));var controller=require(_0xfc13('0x3'));router['post']('/originate',auth[_0xfc13('0x4')](),auth[_0xfc13('0x5')](),controller[_0xfc13('0x6')]);router[_0xfc13('0x7')](_0xfc13('0x8'),auth[_0xfc13('0x4')](),auth[_0xfc13('0x5')](),controller[_0xfc13('0x9')]);router[_0xfc13('0x7')](_0xfc13('0xa'),auth[_0xfc13('0x4')](),auth[_0xfc13('0x5')](),controller[_0xfc13('0xb')]);router[_0xfc13('0x7')](_0xfc13('0xc'),auth[_0xfc13('0x4')](),auth[_0xfc13('0x5')](),controller['hold']);router['post'](_0xfc13('0xd'),auth[_0xfc13('0x4')](),auth[_0xfc13('0x5')](),controller[_0xfc13('0xe')]);router[_0xfc13('0x7')](_0xfc13('0xf'),auth[_0xfc13('0x4')](),auth[_0xfc13('0x5')](),controller[_0xfc13('0x10')]);router['post'](_0xfc13('0x11'),auth['isAuthenticated'](),auth[_0xfc13('0x5')](),controller[_0xfc13('0x12')]);module['exports']=router; \ No newline at end of file +var _0x8864=['/hangup','hangup','/answer','isAuthenticated','answer','/hold','hold','/unhold','transfer','exports','express','Router','../../components/auth/service','./webbar.controller','post','/originate','canUpdate','originate'];(function(_0x31ced5,_0x5d5415){var _0x10d9e5=function(_0x2e51a5){while(--_0x2e51a5){_0x31ced5['push'](_0x31ced5['shift']());}};_0x10d9e5(++_0x5d5415);}(_0x8864,0x172));var _0x4886=function(_0x58ae8a,_0x3c619e){_0x58ae8a=_0x58ae8a-0x0;var _0x2f0b6b=_0x8864[_0x58ae8a];return _0x2f0b6b;};'use strict';var express=require(_0x4886('0x0'));var router=express[_0x4886('0x1')]();var auth=require(_0x4886('0x2'));var controller=require(_0x4886('0x3'));router[_0x4886('0x4')](_0x4886('0x5'),auth['isAuthenticated'](),auth[_0x4886('0x6')](),controller[_0x4886('0x7')]);router[_0x4886('0x4')](_0x4886('0x8'),auth['isAuthenticated'](),auth['canUpdate'](),controller[_0x4886('0x9')]);router[_0x4886('0x4')](_0x4886('0xa'),auth[_0x4886('0xb')](),auth['canUpdate'](),controller[_0x4886('0xc')]);router['post'](_0x4886('0xd'),auth[_0x4886('0xb')](),auth['canUpdate'](),controller[_0x4886('0xe')]);router['post'](_0x4886('0xf'),auth['isAuthenticated'](),auth[_0x4886('0x6')](),controller['unhold']);router[_0x4886('0x4')]('/calls',auth[_0x4886('0xb')](),auth[_0x4886('0x6')](),controller['calls']);router['post']('/transfer',auth['isAuthenticated'](),auth['canUpdate'](),controller[_0x4886('0x10')]);module[_0x4886('0x11')]=router; \ No newline at end of file diff --git a/server/api/webbar/webbar.controller.js b/server/api/webbar/webbar.controller.js index b41e9da..a1e7932 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 _0x70e0=['rows','conference','webbar:conference','conference\x20executed!','transfer','transfer\x20fired:','transferNumber','webbar:transfer','transfer\x20executed!','path','lodash','../../mysqldb','bluebird','jayson/promise','client','http','webbarapi','redis','socket.io-emitter','validate','number','userId\x20is\x20required','string','callNumber\x20is\x20required','sessionId\x20is\x20required','emit','log','handleError:','stack','name','status','send','NotFound','request','then','error','code','message','catch','User','findOne','agent','VoiceChannels','all','filter','UserId','sessionId','length','\x20not\x20found!','originate','body','userId','callNumber','callerId','info','entityFound:','user:%s','json','hangup\x20fired:','format','webbar:hangup','hangup\x20executed!','answer','answer\x20fired:','webbar:answer','hold','hold\x20fired:','webbar:hold','hold\x20executed!','unhold','unhold\x20fired:','webbar:unhold','unhold\x20executed!','calls\x20fired:'];(function(_0x33f274,_0x7ef4d8){var _0x4bcaab=function(_0x2c2168){while(--_0x2c2168){_0x33f274['push'](_0x33f274['shift']());}};_0x4bcaab(++_0x7ef4d8);}(_0x70e0,0x17b));var _0x070e=function(_0x3ef8a1,_0xab77f4){_0x3ef8a1=_0x3ef8a1-0x0;var _0x4a392e=_0x70e0[_0x3ef8a1];return _0x4a392e;};'use strict';var path=require(_0x070e('0x0'));var fs=require('fs');var _=require(_0x070e('0x1'));var db=require(_0x070e('0x2'))['db'];var config=require('../../config/environment');var util=require('util');var BPromise=require(_0x070e('0x3'));var jayson=require(_0x070e('0x4'));var amiClient=jayson[_0x070e('0x5')][_0x070e('0x6')]({'port':0x232a});var logger=require('../../config/logger')(_0x070e('0x7'));var Redis=require('ioredis');config[_0x070e('0x8')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x070e('0x9'))(new Redis(config[_0x070e('0x8')]));var Schema=require(_0x070e('0xa'));var originateValidation=new Schema({'userId':{'type':_0x070e('0xb'),'required':[!![],_0x070e('0xc')]},'callNumber':{'type':_0x070e('0xd'),'required':[!![],_0x070e('0xe')]},'callerId':{'type':'string'},'callbackUrl':{'type':'string'}});var hangupValidation=new Schema({'userId':{'type':_0x070e('0xb'),'required':[!![],_0x070e('0xc')]},'sessionId':{'type':_0x070e('0xd'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0x070e('0xb'),'required':[!![],_0x070e('0xc')]},'sessionId':{'type':_0x070e('0xd'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0x070e('0xb'),'required':[!![],_0x070e('0xc')]},'sessionId':{'type':_0x070e('0xd'),'required':[!![],_0x070e('0xf')]},'transferNumber':{'type':_0x070e('0xd'),'required':[!![],'transferNumber\x20is\x20required']}});var holdValidation=new Schema({'userId':{'type':'number','required':[!![],_0x070e('0xc')]},'sessionId':{'type':'string','required':![]}});var unholdValidation=new Schema({'userId':{'type':'number','required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x070e('0xd'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0x070e('0xb'),'required':[!![],'userId\x20is\x20required']}});var conferenceValidation=new Schema({'userId':{'type':'number','required':[!![],_0x070e('0xc')]}});function emit(_0xeae1a5,_0x180897,_0x19d9da){logger['info'](_0xeae1a5,_0x180897,JSON['stringify'](_0x19d9da));io['to'](_0xeae1a5)[_0x070e('0x10')](_0x180897,_0x19d9da);}function handleError(_0x2bd937){return function(_0x38f6e6){console[_0x070e('0x11')](_0x070e('0x12'),_0x38f6e6,_0x38f6e6 instanceof RangeError);logger['error'](_0x38f6e6[_0x070e('0x13')]);if(_0x38f6e6 instanceof RangeError){if(_0x38f6e6[_0x070e('0x14')]){delete _0x38f6e6[_0x070e('0x14')];}_0x2bd937[_0x070e('0x15')](0x194)[_0x070e('0x16')](_0x38f6e6);}else{if(_0x38f6e6['name']){delete _0x38f6e6['name'];}_0x2bd937['status'](0x1f4)[_0x070e('0x16')](_0x38f6e6);}};}function checkError(){return function(_0x3004f0){if(!_0x3004f0){throw new RangeError(_0x070e('0x17'));}return _0x3004f0;};}function respondWithRpcPromise(_0x4be0d7,_0x5b184){return new BPromise(function(_0x5dc5d2,_0xf8dd5d){var _0x3f6985=amiClient;return _0x3f6985[_0x070e('0x18')](_0x4be0d7,_0x5b184)[_0x070e('0x19')](function(_0x28a1c3){if(_0x28a1c3[_0x070e('0x1a')]){if(_0x28a1c3[_0x070e('0x1a')][_0x070e('0x1b')]===0x1f4){return _0xf8dd5d(_0x28a1c3['error'][_0x070e('0x1c')]);}return _0x5dc5d2(_0x28a1c3[_0x070e('0x1a')][_0x070e('0x1c')]);}else{_0x5dc5d2(_0x28a1c3['result']);}})[_0x070e('0x1d')](function(_0x5f3e9d){_0xf8dd5d(_0x5f3e9d);});});}function getAgent(_0x4a2dbd){return db[_0x070e('0x1e')][_0x070e('0x1f')]({'where':{'id':_0x4a2dbd,'role':_0x070e('0x20')}})[_0x070e('0x19')](checkError());}function getAgentCheckSession(_0x4763c6,_0x497f58){return new BPromise(function(_0x374c54,_0x219e48){var _0x1d72d6=respondWithRpcPromise(_0x070e('0x21'));var _0x43dd96=getAgent(_0x4763c6);Promise[_0x070e('0x22')]([_0x1d72d6,_0x43dd96])[_0x070e('0x19')](function(_0x26373b){var _0x5e8326=_0x26373b[0x0];var _0x282344=_0x26373b[0x1];var _0x351641=_[_0x070e('0x23')](_0x5e8326['rows'],function(_0x5c5f0d){return _0x5c5f0d[_0x070e('0x24')]==_0x282344['id']&&_0x5c5f0d[_0x070e('0x25')]==_0x497f58;});if(_0x351641[_0x070e('0x26')]==0x1){_0x374c54(_0x282344);}else{_0x219e48(new RangeError('sessionId\x20'+_0x497f58+_0x070e('0x27')));}});});}exports[_0x070e('0x28')]=function(_0x3a9425,_0x5f2bee){logger['info']('originate\x20fired:',_0x3a9425['body']);var _0x59c5b4=originateValidation[_0x070e('0xa')](_0x3a9425['body']);if(_0x59c5b4[_0x070e('0x26')]>0x0){return _0x5f2bee[_0x070e('0x15')](0x190)['json'](_0x59c5b4);}var _0x47a739=_0x3a9425[_0x070e('0x29')][_0x070e('0x2a')];var _0x55288a=_0x3a9425['body'][_0x070e('0x2b')];var _0x27dd1f=_0x3a9425[_0x070e('0x29')][_0x070e('0x2c')];var _0x18f0ad=_0x3a9425['body']['callbackUrl'];return getAgent(_0x47a739)[_0x070e('0x19')](function(_0x3011c4){logger[_0x070e('0x2d')](_0x070e('0x2e'),_0x3011c4[_0x070e('0x14')]);emit(util['format'](_0x070e('0x2f'),_0x3011c4[_0x070e('0x14')]),'webbar:originate',{'callNumber':_0x55288a,'callerId':_0x27dd1f,'callbackUrl':_0x18f0ad});return _0x5f2bee[_0x070e('0x15')](0xc8)[_0x070e('0x30')]({'error':![],'message':'originate\x20executed!'});})['catch'](handleError(_0x5f2bee));};exports['hangup']=function(_0x363bff,_0x3dfbf7){logger[_0x070e('0x2d')](_0x070e('0x31'),_0x363bff[_0x070e('0x29')]);var _0x5e3827=hangupValidation[_0x070e('0xa')](_0x363bff[_0x070e('0x29')]);if(_0x5e3827[_0x070e('0x26')]>0x0){return _0x3dfbf7['status'](0x190)[_0x070e('0x30')](_0x5e3827);}var _0x72cbc7=_0x363bff[_0x070e('0x29')]['userId'];var _0x13982f=_0x363bff[_0x070e('0x29')]['sessionId'];return getAgent(_0x72cbc7)[_0x070e('0x19')](function(_0x5d689b){logger[_0x070e('0x2d')](_0x070e('0x2e'),_0x5d689b[_0x070e('0x14')]);emit(util[_0x070e('0x32')](_0x070e('0x2f'),_0x5d689b['name']),_0x070e('0x33'),{'sessionId':_0x13982f});return _0x3dfbf7['status'](0xc8)['json']({'error':![],'message':_0x070e('0x34')});})[_0x070e('0x1d')](handleError(_0x3dfbf7));};exports[_0x070e('0x35')]=function(_0x4d52ff,_0x2ad56c){logger[_0x070e('0x2d')](_0x070e('0x36'),_0x4d52ff[_0x070e('0x29')]);var _0x4a4ee3=answerValidation[_0x070e('0xa')](_0x4d52ff['body']);if(_0x4a4ee3['length']>0x0){return _0x2ad56c['status'](0x190)[_0x070e('0x30')](_0x4a4ee3);}var _0x926533=_0x4d52ff[_0x070e('0x29')][_0x070e('0x2a')];var _0x34f23e=_0x4d52ff['body'][_0x070e('0x25')];return getAgent(_0x926533)['then'](function(_0x23dac5){logger[_0x070e('0x2d')](_0x070e('0x2e'),_0x23dac5['name']);emit(util['format'](_0x070e('0x2f'),_0x23dac5['name']),_0x070e('0x37'),{'sessionId':_0x34f23e});return _0x2ad56c[_0x070e('0x15')](0xc8)[_0x070e('0x30')]({'error':![],'message':'answer\x20executed!'});})[_0x070e('0x1d')](handleError(_0x2ad56c));};exports[_0x070e('0x38')]=function(_0x48d836,_0x589b97){logger[_0x070e('0x2d')](_0x070e('0x39'),_0x48d836[_0x070e('0x29')]);var _0x1fc7c4=holdValidation[_0x070e('0xa')](_0x48d836['body']);if(_0x1fc7c4[_0x070e('0x26')]>0x0){return _0x589b97[_0x070e('0x15')](0x190)[_0x070e('0x30')](_0x1fc7c4);}var _0x391dee=_0x48d836[_0x070e('0x29')][_0x070e('0x2a')];var _0x1f54d5=_0x48d836[_0x070e('0x29')][_0x070e('0x25')];return getAgent(_0x391dee)[_0x070e('0x19')](function(_0x210c4d){logger[_0x070e('0x2d')](_0x070e('0x2e'),_0x210c4d[_0x070e('0x14')]);emit(util[_0x070e('0x32')]('user:%s',_0x210c4d[_0x070e('0x14')]),_0x070e('0x3a'),{'sessionId':_0x1f54d5});return _0x589b97[_0x070e('0x15')](0xc8)[_0x070e('0x30')]({'error':![],'message':_0x070e('0x3b')});})[_0x070e('0x1d')](handleError(_0x589b97));};exports[_0x070e('0x3c')]=function(_0x35dbaf,_0x1c64d2){logger['info'](_0x070e('0x3d'),_0x35dbaf['body']);var _0x1acddb=unholdValidation[_0x070e('0xa')](_0x35dbaf['body']);if(_0x1acddb[_0x070e('0x26')]>0x0){return _0x1c64d2[_0x070e('0x15')](0x190)[_0x070e('0x30')](_0x1acddb);}var _0xa74805=_0x35dbaf[_0x070e('0x29')][_0x070e('0x2a')];var _0x83f21e=_0x35dbaf['body'][_0x070e('0x25')];return getAgent(_0xa74805)['then'](function(_0x516161){logger[_0x070e('0x2d')](_0x070e('0x2e'),_0x516161[_0x070e('0x14')]);emit(util[_0x070e('0x32')](_0x070e('0x2f'),_0x516161[_0x070e('0x14')]),_0x070e('0x3e'),{'sessionId':_0x83f21e});return _0x1c64d2[_0x070e('0x15')](0xc8)['json']({'error':![],'message':_0x070e('0x3f')});})['catch'](handleError(_0x1c64d2));};exports['calls']=function(_0x3a76e2,_0x20acc6){logger['info'](_0x070e('0x40'),_0x20acc6[_0x070e('0x29')]);var _0x210f4a=callsValidation[_0x070e('0xa')](_0x3a76e2[_0x070e('0x29')]);if(_0x210f4a[_0x070e('0x26')]>0x0){return _0x20acc6[_0x070e('0x15')](0x190)['json'](_0x210f4a);}var _0x5874cd=_0x3a76e2['body'][_0x070e('0x2a')];var _0x1948a5=respondWithRpcPromise(_0x070e('0x21'));var _0x2f8fcb=getAgent(_0x5874cd);return Promise['all']([_0x1948a5,_0x2f8fcb])[_0x070e('0x19')](function(_0x5d3c3a){var _0x212710=_0x5d3c3a[0x0];var _0x1cbb7e=_0x5d3c3a[0x1];var _0x476804=_[_0x070e('0x23')](_0x212710[_0x070e('0x41')],function(_0x15dbc4){return _0x15dbc4['UserId']==_0x1cbb7e['id'];});return _0x20acc6[_0x070e('0x15')](0xc8)[_0x070e('0x30')]({'count':_0x476804[_0x070e('0x26')],'rows':_0x476804});})['catch'](handleError(_0x20acc6));};exports[_0x070e('0x42')]=function(_0x1da803,_0x5cd534){logger[_0x070e('0x2d')]('conference\x20fired:',_0x1da803[_0x070e('0x29')]);var _0x569f92=conferenceValidation['validate'](_0x1da803['body']);if(_0x569f92[_0x070e('0x26')]>0x0){return _0x5cd534[_0x070e('0x15')](0x190)[_0x070e('0x30')](_0x569f92);}var _0x122198=_0x1da803[_0x070e('0x29')][_0x070e('0x2a')];return getAgent(_0x122198)['then'](function(_0x841c89){logger['info'](_0x070e('0x2e'),_0x841c89['name']);emit(util[_0x070e('0x32')](_0x070e('0x2f'),_0x841c89['name']),_0x070e('0x43'));return _0x5cd534['status'](0xc8)[_0x070e('0x30')]({'error':![],'message':_0x070e('0x44')});})[_0x070e('0x1d')](handleError(_0x5cd534));};exports[_0x070e('0x45')]=function(_0x764b06,_0x20c772){logger[_0x070e('0x2d')](_0x070e('0x46'),_0x764b06[_0x070e('0x29')]);var _0x3332d0=transferValidation[_0x070e('0xa')](_0x764b06[_0x070e('0x29')]);if(_0x3332d0[_0x070e('0x26')]>0x0){return _0x20c772[_0x070e('0x15')](0x190)['json'](_0x3332d0);}var _0x45bf20=_0x764b06[_0x070e('0x29')][_0x070e('0x2a')];var _0x93301a=_0x764b06['body'][_0x070e('0x25')];var _0x4e8e58=_0x764b06[_0x070e('0x29')][_0x070e('0x47')];return getAgent(_0x45bf20)[_0x070e('0x19')](function(_0x12a58f){logger['info'](_0x070e('0x2e'),_0x12a58f[_0x070e('0x14')]);emit(util[_0x070e('0x32')](_0x070e('0x2f'),_0x12a58f['name']),_0x070e('0x48'),{'sessionId':_0x93301a,'transferNumber':_0x4e8e58});return _0x20c772['status'](0xc8)[_0x070e('0x30')]({'error':![],'message':_0x070e('0x49')});})[_0x070e('0x1d')](handleError(_0x20c772));}; \ No newline at end of file +var _0x3eec=['webbar:hold','hold\x20executed!','unhold','unhold\x20fired:','unhold\x20executed!','calls','calls\x20fired:','conference','conference\x20fired:','webbar:conference','conference\x20executed!','transfer\x20fired:','transferNumber','webbar:transfer','transfer\x20executed!','path','lodash','../../mysqldb','../../config/environment','bluebird','jayson/promise','client','http','../../config/logger','webbarapi','redis','defaults','localhost','socket.io-emitter','validate','number','userId\x20is\x20required','string','stringify','emit','log','handleError:','error','stack','name','status','send','NotFound','request','then','code','message','result','catch','User','findOne','agent','VoiceChannels','all','filter','rows','UserId','length','sessionId\x20','\x20not\x20found!','info','originate\x20fired:','body','json','userId','callerId','callbackUrl','entityFound:','format','user:%s','webbar:originate','originate\x20executed!','hangup','sessionId','webbar:hangup','hangup\x20executed!','webbar:answer','answer\x20executed!','hold'];(function(_0x8ce9f0,_0x1deb4b){var _0x553b09=function(_0x1a372b){while(--_0x1a372b){_0x8ce9f0['push'](_0x8ce9f0['shift']());}};_0x553b09(++_0x1deb4b);}(_0x3eec,0x1e9));var _0xc3ee=function(_0x280a91,_0x581225){_0x280a91=_0x280a91-0x0;var _0x4e2193=_0x3eec[_0x280a91];return _0x4e2193;};'use strict';var path=require(_0xc3ee('0x0'));var fs=require('fs');var _=require(_0xc3ee('0x1'));var db=require(_0xc3ee('0x2'))['db'];var config=require(_0xc3ee('0x3'));var util=require('util');var BPromise=require(_0xc3ee('0x4'));var jayson=require(_0xc3ee('0x5'));var amiClient=jayson[_0xc3ee('0x6')][_0xc3ee('0x7')]({'port':0x232a});var logger=require(_0xc3ee('0x8'))(_0xc3ee('0x9'));var Redis=require('ioredis');config[_0xc3ee('0xa')]=_[_0xc3ee('0xb')](config[_0xc3ee('0xa')],{'host':_0xc3ee('0xc'),'port':0x18eb});var io=require(_0xc3ee('0xd'))(new Redis(config[_0xc3ee('0xa')]));var Schema=require(_0xc3ee('0xe'));var originateValidation=new Schema({'userId':{'type':_0xc3ee('0xf'),'required':[!![],_0xc3ee('0x10')]},'callNumber':{'type':_0xc3ee('0x11'),'required':[!![],'callNumber\x20is\x20required']},'callerId':{'type':'string'},'callbackUrl':{'type':_0xc3ee('0x11')}});var hangupValidation=new Schema({'userId':{'type':_0xc3ee('0xf'),'required':[!![],_0xc3ee('0x10')]},'sessionId':{'type':_0xc3ee('0x11'),'required':![]}});var answerValidation=new Schema({'userId':{'type':'number','required':[!![],_0xc3ee('0x10')]},'sessionId':{'type':'string','required':![]}});var transferValidation=new Schema({'userId':{'type':_0xc3ee('0xf'),'required':[!![],_0xc3ee('0x10')]},'sessionId':{'type':'string','required':[!![],'sessionId\x20is\x20required']},'transferNumber':{'type':_0xc3ee('0x11'),'required':[!![],'transferNumber\x20is\x20required']}});var holdValidation=new Schema({'userId':{'type':_0xc3ee('0xf'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0xc3ee('0x11'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':'number','required':[!![],_0xc3ee('0x10')]},'sessionId':{'type':_0xc3ee('0x11'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0xc3ee('0xf'),'required':[!![],_0xc3ee('0x10')]}});var conferenceValidation=new Schema({'userId':{'type':_0xc3ee('0xf'),'required':[!![],_0xc3ee('0x10')]}});function emit(_0x277e11,_0x4e1c51,_0xbd384b){logger['info'](_0x277e11,_0x4e1c51,JSON[_0xc3ee('0x12')](_0xbd384b));io['to'](_0x277e11)[_0xc3ee('0x13')](_0x4e1c51,_0xbd384b);}function handleError(_0x3fa981){return function(_0x219db0){console[_0xc3ee('0x14')](_0xc3ee('0x15'),_0x219db0,_0x219db0 instanceof RangeError);logger[_0xc3ee('0x16')](_0x219db0[_0xc3ee('0x17')]);if(_0x219db0 instanceof RangeError){if(_0x219db0[_0xc3ee('0x18')]){delete _0x219db0[_0xc3ee('0x18')];}_0x3fa981[_0xc3ee('0x19')](0x194)[_0xc3ee('0x1a')](_0x219db0);}else{if(_0x219db0[_0xc3ee('0x18')]){delete _0x219db0[_0xc3ee('0x18')];}_0x3fa981[_0xc3ee('0x19')](0x1f4)[_0xc3ee('0x1a')](_0x219db0);}};}function checkError(){return function(_0xcd8c18){if(!_0xcd8c18){throw new RangeError(_0xc3ee('0x1b'));}return _0xcd8c18;};}function respondWithRpcPromise(_0x327c45,_0x1c33a7){return new BPromise(function(_0x11778f,_0x493fea){var _0x4d672e=amiClient;return _0x4d672e[_0xc3ee('0x1c')](_0x327c45,_0x1c33a7)[_0xc3ee('0x1d')](function(_0x3b8f75){if(_0x3b8f75[_0xc3ee('0x16')]){if(_0x3b8f75[_0xc3ee('0x16')][_0xc3ee('0x1e')]===0x1f4){return _0x493fea(_0x3b8f75['error'][_0xc3ee('0x1f')]);}return _0x11778f(_0x3b8f75[_0xc3ee('0x16')][_0xc3ee('0x1f')]);}else{_0x11778f(_0x3b8f75[_0xc3ee('0x20')]);}})[_0xc3ee('0x21')](function(_0x525ae5){_0x493fea(_0x525ae5);});});}function getAgent(_0x4c53a5){return db[_0xc3ee('0x22')][_0xc3ee('0x23')]({'where':{'id':_0x4c53a5,'role':_0xc3ee('0x24')}})[_0xc3ee('0x1d')](checkError());}function getAgentCheckSession(_0x836fac,_0x4ecfec){return new BPromise(function(_0x56201a,_0x4e0bc0){var _0x1be005=respondWithRpcPromise(_0xc3ee('0x25'));var _0x44678b=getAgent(_0x836fac);Promise[_0xc3ee('0x26')]([_0x1be005,_0x44678b])[_0xc3ee('0x1d')](function(_0x50ffaa){var _0x13f30d=_0x50ffaa[0x0];var _0xfa3111=_0x50ffaa[0x1];var _0x243b6a=_[_0xc3ee('0x27')](_0x13f30d[_0xc3ee('0x28')],function(_0x8bbe1e){return _0x8bbe1e[_0xc3ee('0x29')]==_0xfa3111['id']&&_0x8bbe1e['sessionId']==_0x4ecfec;});if(_0x243b6a[_0xc3ee('0x2a')]==0x1){_0x56201a(_0xfa3111);}else{_0x4e0bc0(new RangeError(_0xc3ee('0x2b')+_0x4ecfec+_0xc3ee('0x2c')));}});});}exports['originate']=function(_0x69d43e,_0x240a16){logger[_0xc3ee('0x2d')](_0xc3ee('0x2e'),_0x69d43e[_0xc3ee('0x2f')]);var _0x46a8bd=originateValidation[_0xc3ee('0xe')](_0x69d43e['body']);if(_0x46a8bd[_0xc3ee('0x2a')]>0x0){return _0x240a16['status'](0x190)[_0xc3ee('0x30')](_0x46a8bd);}var _0x16a32f=_0x69d43e[_0xc3ee('0x2f')][_0xc3ee('0x31')];var _0x16d14b=_0x69d43e[_0xc3ee('0x2f')]['callNumber'];var _0x198653=_0x69d43e[_0xc3ee('0x2f')][_0xc3ee('0x32')];var _0x363ad0=_0x69d43e[_0xc3ee('0x2f')][_0xc3ee('0x33')];return getAgent(_0x16a32f)[_0xc3ee('0x1d')](function(_0x17d5df){logger[_0xc3ee('0x2d')](_0xc3ee('0x34'),_0x17d5df[_0xc3ee('0x18')]);emit(util[_0xc3ee('0x35')](_0xc3ee('0x36'),_0x17d5df[_0xc3ee('0x18')]),_0xc3ee('0x37'),{'callNumber':_0x16d14b,'callerId':_0x198653,'callbackUrl':_0x363ad0});return _0x240a16[_0xc3ee('0x19')](0xc8)[_0xc3ee('0x30')]({'error':![],'message':_0xc3ee('0x38')});})[_0xc3ee('0x21')](handleError(_0x240a16));};exports[_0xc3ee('0x39')]=function(_0x24f1c8,_0x5756a4){logger[_0xc3ee('0x2d')]('hangup\x20fired:',_0x24f1c8[_0xc3ee('0x2f')]);var _0x29419f=hangupValidation[_0xc3ee('0xe')](_0x24f1c8[_0xc3ee('0x2f')]);if(_0x29419f[_0xc3ee('0x2a')]>0x0){return _0x5756a4[_0xc3ee('0x19')](0x190)['json'](_0x29419f);}var _0x2a80aa=_0x24f1c8[_0xc3ee('0x2f')][_0xc3ee('0x31')];var _0x59224a=_0x24f1c8[_0xc3ee('0x2f')][_0xc3ee('0x3a')];return getAgent(_0x2a80aa)[_0xc3ee('0x1d')](function(_0x1fe17f){logger[_0xc3ee('0x2d')](_0xc3ee('0x34'),_0x1fe17f[_0xc3ee('0x18')]);emit(util[_0xc3ee('0x35')](_0xc3ee('0x36'),_0x1fe17f[_0xc3ee('0x18')]),_0xc3ee('0x3b'),{'sessionId':_0x59224a});return _0x5756a4['status'](0xc8)[_0xc3ee('0x30')]({'error':![],'message':_0xc3ee('0x3c')});})['catch'](handleError(_0x5756a4));};exports['answer']=function(_0x60ae59,_0x45cef7){logger[_0xc3ee('0x2d')]('answer\x20fired:',_0x60ae59[_0xc3ee('0x2f')]);var _0x92a306=answerValidation[_0xc3ee('0xe')](_0x60ae59[_0xc3ee('0x2f')]);if(_0x92a306[_0xc3ee('0x2a')]>0x0){return _0x45cef7[_0xc3ee('0x19')](0x190)[_0xc3ee('0x30')](_0x92a306);}var _0x724c4e=_0x60ae59[_0xc3ee('0x2f')][_0xc3ee('0x31')];var _0xf833d9=_0x60ae59[_0xc3ee('0x2f')][_0xc3ee('0x3a')];return getAgent(_0x724c4e)[_0xc3ee('0x1d')](function(_0x5b7675){logger[_0xc3ee('0x2d')]('entityFound:',_0x5b7675['name']);emit(util[_0xc3ee('0x35')](_0xc3ee('0x36'),_0x5b7675['name']),_0xc3ee('0x3d'),{'sessionId':_0xf833d9});return _0x45cef7[_0xc3ee('0x19')](0xc8)['json']({'error':![],'message':_0xc3ee('0x3e')});})['catch'](handleError(_0x45cef7));};exports[_0xc3ee('0x3f')]=function(_0x4be302,_0x28212e){logger[_0xc3ee('0x2d')]('hold\x20fired:',_0x4be302['body']);var _0x5e54ec=holdValidation[_0xc3ee('0xe')](_0x4be302[_0xc3ee('0x2f')]);if(_0x5e54ec[_0xc3ee('0x2a')]>0x0){return _0x28212e[_0xc3ee('0x19')](0x190)[_0xc3ee('0x30')](_0x5e54ec);}var _0x5b5f5c=_0x4be302['body'][_0xc3ee('0x31')];var _0x27e4fc=_0x4be302['body'][_0xc3ee('0x3a')];return getAgent(_0x5b5f5c)['then'](function(_0x60e36a){logger['info'](_0xc3ee('0x34'),_0x60e36a[_0xc3ee('0x18')]);emit(util[_0xc3ee('0x35')](_0xc3ee('0x36'),_0x60e36a[_0xc3ee('0x18')]),_0xc3ee('0x40'),{'sessionId':_0x27e4fc});return _0x28212e[_0xc3ee('0x19')](0xc8)['json']({'error':![],'message':_0xc3ee('0x41')});})[_0xc3ee('0x21')](handleError(_0x28212e));};exports[_0xc3ee('0x42')]=function(_0x237aa8,_0x47d12c){logger[_0xc3ee('0x2d')](_0xc3ee('0x43'),_0x237aa8[_0xc3ee('0x2f')]);var _0x3264c5=unholdValidation[_0xc3ee('0xe')](_0x237aa8[_0xc3ee('0x2f')]);if(_0x3264c5[_0xc3ee('0x2a')]>0x0){return _0x47d12c['status'](0x190)['json'](_0x3264c5);}var _0x5a0493=_0x237aa8['body'][_0xc3ee('0x31')];var _0x2f3e48=_0x237aa8[_0xc3ee('0x2f')][_0xc3ee('0x3a')];return getAgent(_0x5a0493)[_0xc3ee('0x1d')](function(_0x4d66cc){logger['info'](_0xc3ee('0x34'),_0x4d66cc['name']);emit(util[_0xc3ee('0x35')](_0xc3ee('0x36'),_0x4d66cc[_0xc3ee('0x18')]),'webbar:unhold',{'sessionId':_0x2f3e48});return _0x47d12c[_0xc3ee('0x19')](0xc8)[_0xc3ee('0x30')]({'error':![],'message':_0xc3ee('0x44')});})[_0xc3ee('0x21')](handleError(_0x47d12c));};exports[_0xc3ee('0x45')]=function(_0x343018,_0x44e8fe){logger[_0xc3ee('0x2d')](_0xc3ee('0x46'),_0x44e8fe['body']);var _0x3fdc8f=callsValidation[_0xc3ee('0xe')](_0x343018[_0xc3ee('0x2f')]);if(_0x3fdc8f[_0xc3ee('0x2a')]>0x0){return _0x44e8fe[_0xc3ee('0x19')](0x190)[_0xc3ee('0x30')](_0x3fdc8f);}var _0x33efe6=_0x343018[_0xc3ee('0x2f')][_0xc3ee('0x31')];var _0x18db2e=respondWithRpcPromise(_0xc3ee('0x25'));var _0x314db7=getAgent(_0x33efe6);return Promise[_0xc3ee('0x26')]([_0x18db2e,_0x314db7])['then'](function(_0x2109db){var _0x1f82f2=_0x2109db[0x0];var _0x4595ea=_0x2109db[0x1];var _0x2d417d=_[_0xc3ee('0x27')](_0x1f82f2[_0xc3ee('0x28')],function(_0x4e556e){return _0x4e556e[_0xc3ee('0x29')]==_0x4595ea['id'];});return _0x44e8fe[_0xc3ee('0x19')](0xc8)[_0xc3ee('0x30')]({'count':_0x2d417d[_0xc3ee('0x2a')],'rows':_0x2d417d});})[_0xc3ee('0x21')](handleError(_0x44e8fe));};exports[_0xc3ee('0x47')]=function(_0x199e7f,_0x28af11){logger[_0xc3ee('0x2d')](_0xc3ee('0x48'),_0x199e7f[_0xc3ee('0x2f')]);var _0x29e9f7=conferenceValidation[_0xc3ee('0xe')](_0x199e7f['body']);if(_0x29e9f7['length']>0x0){return _0x28af11['status'](0x190)[_0xc3ee('0x30')](_0x29e9f7);}var _0x5a17fb=_0x199e7f[_0xc3ee('0x2f')][_0xc3ee('0x31')];return getAgent(_0x5a17fb)[_0xc3ee('0x1d')](function(_0x5ca478){logger[_0xc3ee('0x2d')]('entityFound:',_0x5ca478['name']);emit(util[_0xc3ee('0x35')](_0xc3ee('0x36'),_0x5ca478[_0xc3ee('0x18')]),_0xc3ee('0x49'));return _0x28af11[_0xc3ee('0x19')](0xc8)[_0xc3ee('0x30')]({'error':![],'message':_0xc3ee('0x4a')});})[_0xc3ee('0x21')](handleError(_0x28af11));};exports['transfer']=function(_0x3cc785,_0x2e390){logger['info'](_0xc3ee('0x4b'),_0x3cc785[_0xc3ee('0x2f')]);var _0x473a46=transferValidation[_0xc3ee('0xe')](_0x3cc785[_0xc3ee('0x2f')]);if(_0x473a46[_0xc3ee('0x2a')]>0x0){return _0x2e390['status'](0x190)[_0xc3ee('0x30')](_0x473a46);}var _0x1ebab0=_0x3cc785[_0xc3ee('0x2f')][_0xc3ee('0x31')];var _0x1f1816=_0x3cc785[_0xc3ee('0x2f')]['sessionId'];var _0x1082b7=_0x3cc785['body'][_0xc3ee('0x4c')];return getAgent(_0x1ebab0)['then'](function(_0x3d8d2e){logger[_0xc3ee('0x2d')]('entityFound:',_0x3d8d2e['name']);emit(util[_0xc3ee('0x35')](_0xc3ee('0x36'),_0x3d8d2e['name']),_0xc3ee('0x4d'),{'sessionId':_0x1f1816,'transferNumber':_0x1082b7});return _0x2e390[_0xc3ee('0x19')](0xc8)[_0xc3ee('0x30')]({'error':![],'message':_0xc3ee('0x4e')});})[_0xc3ee('0x21')](handleError(_0x2e390));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/index.js b/server/api/whatsappAccount/index.js index 04fbcb1..ead5ad8 100644 --- a/server/api/whatsappAccount/index.js +++ b/server/api/whatsappAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd4a2=['../../components/auth/service','../../config/environment','./whatsappAccount.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','getDispositions','getAnswers','/:id/users','getAgents','/:id/applications','getApplications','post','addDisposition','/:id/canned_answers','addAnswer','addAgents','notify','/:id/send','send','put','update','delete','destroy','removeAnswers','removeAgents','multer','connect-timeout','Router'];(function(_0x57de67,_0x39e978){var _0x457854=function(_0x4c1a7f){while(--_0x4c1a7f){_0x57de67['push'](_0x57de67['shift']());}};_0x457854(++_0x39e978);}(_0xd4a2,0x173));var _0x2d4a=function(_0x14cabf,_0x2c7991){_0x14cabf=_0x14cabf-0x0;var _0x433f7d=_0xd4a2[_0x14cabf];return _0x433f7d;};'use strict';var multer=require(_0x2d4a('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x2d4a('0x1'));var express=require('express');var router=express[_0x2d4a('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x2d4a('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x2d4a('0x4'));var controller=require(_0x2d4a('0x5'));router[_0x2d4a('0x6')]('/',auth[_0x2d4a('0x7')](),controller[_0x2d4a('0x8')]);router['get'](_0x2d4a('0x9'),auth[_0x2d4a('0x7')](),controller[_0x2d4a('0xa')]);router[_0x2d4a('0x6')](_0x2d4a('0xb'),auth[_0x2d4a('0x7')](),controller[_0x2d4a('0xc')]);router[_0x2d4a('0x6')](_0x2d4a('0xd'),auth[_0x2d4a('0x7')](),controller[_0x2d4a('0xe')]);router[_0x2d4a('0x6')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x2d4a('0xf')]);router['get'](_0x2d4a('0x10'),auth[_0x2d4a('0x7')](),controller[_0x2d4a('0x11')]);router[_0x2d4a('0x6')](_0x2d4a('0x12'),auth[_0x2d4a('0x7')](),controller[_0x2d4a('0x13')]);router[_0x2d4a('0x14')]('/',auth['isAuthenticated'](),controller['create']);router[_0x2d4a('0x14')]('/:id/dispositions',auth[_0x2d4a('0x7')](),controller[_0x2d4a('0x15')]);router[_0x2d4a('0x14')](_0x2d4a('0x16'),auth['isAuthenticated'](),controller[_0x2d4a('0x17')]);router['post'](_0x2d4a('0x10'),auth['isAuthenticated'](),controller[_0x2d4a('0x18')]);router[_0x2d4a('0x14')](_0x2d4a('0x12'),auth[_0x2d4a('0x7')](),controller['addApplications']);router['post']('/:id/notify',controller[_0x2d4a('0x19')]);router[_0x2d4a('0x14')](_0x2d4a('0x1a'),auth[_0x2d4a('0x7')](),controller[_0x2d4a('0x1b')]);router[_0x2d4a('0x1c')]('/:id',auth['isAuthenticated'](),controller[_0x2d4a('0x1d')]);router[_0x2d4a('0x1e')](_0x2d4a('0xb'),auth[_0x2d4a('0x7')](),controller[_0x2d4a('0x1f')]);router[_0x2d4a('0x1e')](_0x2d4a('0xd'),auth[_0x2d4a('0x7')](),controller['removeDispositions']);router[_0x2d4a('0x1e')](_0x2d4a('0x16'),auth[_0x2d4a('0x7')](),controller[_0x2d4a('0x20')]);router[_0x2d4a('0x1e')](_0x2d4a('0x10'),auth[_0x2d4a('0x7')](),controller[_0x2d4a('0x21')]);module['exports']=router; \ No newline at end of file +var _0x5c3c=['../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappAccount.controller','get','isAuthenticated','index','describe','show','/:id/dispositions','/:id/canned_answers','/:id/users','getAgents','/:id/applications','getApplications','post','create','addDisposition','addAgents','addApplications','/:id/notify','notify','/:id/send','send','put','/:id','update','destroy','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','Router','fs-extra'];(function(_0x5eb788,_0x329361){var _0x3b8161=function(_0x5d0622){while(--_0x5d0622){_0x5eb788['push'](_0x5eb788['shift']());}};_0x3b8161(++_0x329361);}(_0x5c3c,0x132));var _0xc5c3=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0x5c3c[_0x4243a3];return _0x1b2a33;};'use strict';var multer=require(_0xc5c3('0x0'));var util=require(_0xc5c3('0x1'));var path=require(_0xc5c3('0x2'));var timeout=require(_0xc5c3('0x3'));var express=require('express');var router=express[_0xc5c3('0x4')]();var fs_extra=require(_0xc5c3('0x5'));var auth=require(_0xc5c3('0x6'));var interaction=require(_0xc5c3('0x7'));var config=require(_0xc5c3('0x8'));var controller=require(_0xc5c3('0x9'));router[_0xc5c3('0xa')]('/',auth[_0xc5c3('0xb')](),controller[_0xc5c3('0xc')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0xc5c3('0xd')]);router[_0xc5c3('0xa')]('/:id',auth[_0xc5c3('0xb')](),controller[_0xc5c3('0xe')]);router['get'](_0xc5c3('0xf'),auth[_0xc5c3('0xb')](),controller['getDispositions']);router[_0xc5c3('0xa')](_0xc5c3('0x10'),auth[_0xc5c3('0xb')](),controller['getAnswers']);router[_0xc5c3('0xa')](_0xc5c3('0x11'),auth['isAuthenticated'](),controller[_0xc5c3('0x12')]);router[_0xc5c3('0xa')](_0xc5c3('0x13'),auth['isAuthenticated'](),controller[_0xc5c3('0x14')]);router[_0xc5c3('0x15')]('/',auth[_0xc5c3('0xb')](),controller[_0xc5c3('0x16')]);router[_0xc5c3('0x15')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0xc5c3('0x17')]);router[_0xc5c3('0x15')](_0xc5c3('0x10'),auth[_0xc5c3('0xb')](),controller['addAnswer']);router['post'](_0xc5c3('0x11'),auth['isAuthenticated'](),controller[_0xc5c3('0x18')]);router[_0xc5c3('0x15')](_0xc5c3('0x13'),auth[_0xc5c3('0xb')](),controller[_0xc5c3('0x19')]);router['post'](_0xc5c3('0x1a'),controller[_0xc5c3('0x1b')]);router[_0xc5c3('0x15')](_0xc5c3('0x1c'),auth['isAuthenticated'](),controller[_0xc5c3('0x1d')]);router[_0xc5c3('0x1e')](_0xc5c3('0x1f'),auth[_0xc5c3('0xb')](),controller[_0xc5c3('0x20')]);router['delete'](_0xc5c3('0x1f'),auth[_0xc5c3('0xb')](),controller[_0xc5c3('0x21')]);router[_0xc5c3('0x22')](_0xc5c3('0xf'),auth[_0xc5c3('0xb')](),controller[_0xc5c3('0x23')]);router['delete']('/:id/canned_answers',auth[_0xc5c3('0xb')](),controller[_0xc5c3('0x24')]);router['delete']('/:id/users',auth[_0xc5c3('0xb')](),controller[_0xc5c3('0x25')]);module[_0xc5c3('0x26')]=router; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.attributes.js b/server/api/whatsappAccount/whatsappAccount.attributes.js index 2213e9e..bd60453 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 _0x5fa6=['Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','ENUM','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'];(function(_0x418ad2,_0xeae93b){var _0x4f4fe5=function(_0x424e28){while(--_0x424e28){_0x418ad2['push'](_0x418ad2['shift']());}};_0x4f4fe5(++_0xeae93b);}(_0x5fa6,0x1a4));var _0x65fa=function(_0x4c742f,_0x2bd40a){_0x4c742f=_0x4c742f-0x0;var _0x2913ae=_0x5fa6[_0x4c742f];return _0x2913ae;};'use strict';var Sequelize=require(_0x65fa('0x0'));var rs=require('randomstring');module[_0x65fa('0x1')]={'name':{'type':Sequelize[_0x65fa('0x2')],'unique':'name','allowNull':![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize[_0x65fa('0x2')],'defaultValue':function(){return rs['generate']();}},'phone':{'type':Sequelize[_0x65fa('0x2')]},'type':{'type':Sequelize[_0x65fa('0x3')]('twilio')},'accountSid':{'type':Sequelize[_0x65fa('0x2')]},'authToken':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0x65fa('0x4')],'defaultValue':function(){return _0x65fa('0x5');}},'notificationSound':{'type':Sequelize[_0x65fa('0x6')],'defaultValue':![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x65fa('0x6')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x65fa('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x65fa('0x6')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0x65fa('0x8')},'mandatoryDisposition':{'type':Sequelize[_0x65fa('0x6')],'defaultValue':![],'comment':_0x65fa('0x9'),'set':function(_0x27966c){if(!_0x27966c){this[_0x65fa('0xa')](_0x65fa('0xb'),null);}this[_0x65fa('0xa')](_0x65fa('0xc'),_0x27966c);}},'description':{'type':Sequelize[_0x65fa('0x2')]}}; \ No newline at end of file +var _0xf109=['STRING','generate','ENUM','twilio','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','sequelize','exports'];(function(_0xb85a55,_0x728046){var _0xeb24dd=function(_0x5efa0c){while(--_0x5efa0c){_0xb85a55['push'](_0xb85a55['shift']());}};_0xeb24dd(++_0x728046);}(_0xf109,0x143));var _0x9f10=function(_0x4ff09b,_0x53f67d){_0x4ff09b=_0x4ff09b-0x0;var _0x3f5c2e=_0xf109[_0x4ff09b];return _0x3f5c2e;};'use strict';var Sequelize=require(_0x9f10('0x0'));var rs=require('randomstring');module[_0x9f10('0x1')]={'name':{'type':Sequelize[_0x9f10('0x2')],'unique':'name','allowNull':![]},'key':{'type':Sequelize[_0x9f10('0x2')],'allowNull':![]},'remote':{'type':Sequelize[_0x9f10('0x2')],'allowNull':![]},'token':{'type':Sequelize[_0x9f10('0x2')],'defaultValue':function(){return rs[_0x9f10('0x3')]();}},'phone':{'type':Sequelize[_0x9f10('0x2')]},'type':{'type':Sequelize[_0x9f10('0x4')](_0x9f10('0x5'))},'accountSid':{'type':Sequelize[_0x9f10('0x2')]},'authToken':{'type':Sequelize[_0x9f10('0x2')]},'notificationTemplate':{'type':Sequelize[_0x9f10('0x6')],'defaultValue':function(){return _0x9f10('0x7');}},'notificationSound':{'type':Sequelize[_0x9f10('0x8')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0x9f10('0x8')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x9f10('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x9f10('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x9f10('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x9f10('0x9')],'comment':_0x9f10('0xa')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x9f10('0xb'),'set':function(_0x7a6668){if(!_0x7a6668){this['setDataValue']('mandatoryDispositionPauseId',null);}this[_0x9f10('0xc')]('mandatoryDisposition',_0x7a6668);}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.controller.js b/server/api/whatsappAccount/whatsappAccount.controller.js index 9335b5d..2d5ab42 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 _0xae35=['redis','defaults','localhost','socket.io-emitter','register','jayson/promise','http','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','get','WhatsappAccounts','UserProfileResource','stack','name','index','map','rawAttributes','key','query','keys','filters','intersection','model','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','WhatsappAccount','includeAll','findAll','rows','show','params','Pause','mandatoryDispositionPause','fields','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','Disposition','getDispositions','findOne','WhatsappAccountId','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','include','removeAnswers','addAgents','omit','spread','emit','userWhatsappAccount:save','removeAgents','userWhatsappAccount:remove','getAgents','User','addApplications','WhatsappApplication','bulkCreate','findAndCountAll','priority','getApplications','notify','whatsapp','account','orderBy','Applications','asc','CmContact','ValidationError','no\x20available\x20attributes','createdAt','difference','updatedAt','CompanyId','ListId','type','twilio','from','From','replace','whatsapp:','MessageSid','isNil','Sequelize','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','CmList','DESC','list','Contacts','contact','WhatsappInteraction','interaction','autoclose','push','close','unmanaged','*,*,*,*','WhatsappMessage','messageId','ContactId','AttachmentId','UserId','applications','unshift','agent','waitForTheAssignedAgent','startRouting','Start','receiveMessage','entity\x20found','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','Content-Type','text/xml','\x0a','send','to\x20is\x20mandatory','List','out','Messages','dataValues','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/license/util','../../mysqldb'];(function(_0x4e7d25,_0x58285f){var _0x526fe6=function(_0x4f0aec){while(--_0x4f0aec){_0x4e7d25['push'](_0x4e7d25['shift']());}};_0x526fe6(++_0x58285f);}(_0xae35,0xa7));var _0x5ae3=function(_0x4cff4f,_0xc60b75){_0x4cff4f=_0x4cff4f-0x0;var _0x4a392c=_0xae35[_0x4cff4f];return _0x4a392c;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x5ae3('0x0'));var jsonpatch=require(_0x5ae3('0x1'));var rp=require('request-promise');var moment=require(_0x5ae3('0x2'));var BPromise=require(_0x5ae3('0x3'));var Mustache=require(_0x5ae3('0x4'));var util=require(_0x5ae3('0x5'));var path=require(_0x5ae3('0x6'));var sox=require(_0x5ae3('0x7'));var csv=require(_0x5ae3('0x8'));var ejs=require(_0x5ae3('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5ae3('0xa'));var squel=require('squel');var crypto=require(_0x5ae3('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x5ae3('0x8'));var querystring=require(_0x5ae3('0xc'));var Papa=require(_0x5ae3('0xd'));var Redis=require(_0x5ae3('0xe'));var authService=require(_0x5ae3('0xf'));var qs=require(_0x5ae3('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5ae3('0x11'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x5ae3('0x12'));var db=require(_0x5ae3('0x13'))['db'];config[_0x5ae3('0x14')]=_[_0x5ae3('0x15')](config['redis'],{'host':_0x5ae3('0x16'),'port':0x18eb});var socket=require(_0x5ae3('0x17'))(new Redis(config['redis']));require('./whatsappAccount.socket')[_0x5ae3('0x18')](socket);var jayson=require(_0x5ae3('0x19'));var client=jayson['client'][_0x5ae3('0x1a')]({'port':0x232c});function respondWithRpcPromise(_0x15fd2c,_0x464859,_0x3ebbd0,_0x1cf609){return new BPromise(function(_0x800076,_0x4265be){var _0xb85a94=_0x1cf609||client;return _0xb85a94['request'](_0x15fd2c,_0x3ebbd0)['then'](function(_0x4cd283){logger[_0x5ae3('0x1b')](_0x5ae3('0x1c'),_0x464859,_0x5ae3('0x1d'));logger[_0x5ae3('0x1e')](_0x5ae3('0x1f'),_0x464859,_0x5ae3('0x1d'),JSON[_0x5ae3('0x20')](_0x4cd283));if(_0x4cd283[_0x5ae3('0x21')]){if(_0x4cd283[_0x5ae3('0x21')]['code']===0x1f4){logger[_0x5ae3('0x21')](_0x5ae3('0x1c'),_0x464859,_0x4cd283[_0x5ae3('0x21')][_0x5ae3('0x22')]);return _0x4265be(_0x4cd283[_0x5ae3('0x21')]['message']);}logger['error'](_0x5ae3('0x1c'),_0x464859,_0x4cd283['error'][_0x5ae3('0x22')]);return _0x800076(_0x4cd283[_0x5ae3('0x21')][_0x5ae3('0x22')]);}else{logger[_0x5ae3('0x1b')]('WhatsappAccount,\x20%s,\x20%s',_0x464859,'request\x20sent');_0x800076(_0x4cd283[_0x5ae3('0x23')][_0x5ae3('0x22')]);}})[_0x5ae3('0x24')](function(_0x1196d4){logger['error'](_0x5ae3('0x1c'),_0x464859,_0x1196d4);_0x4265be(_0x1196d4);});});}function respondWithStatusCode(_0x845c6,_0x59e4d6){_0x59e4d6=_0x59e4d6||0xcc;return function(_0x4b92c4){if(_0x4b92c4){return _0x845c6[_0x5ae3('0x25')](_0x59e4d6);}return _0x845c6[_0x5ae3('0x26')](_0x59e4d6)[_0x5ae3('0x27')]();};}function respondWithResult(_0x47584b,_0x41b0a1){_0x41b0a1=_0x41b0a1||0xc8;return function(_0x307fde){if(_0x307fde){return _0x47584b[_0x5ae3('0x26')](_0x41b0a1)[_0x5ae3('0x28')](_0x307fde);}};}function respondWithFilteredResult(_0x1b5916,_0x287041){return function(_0x193a7f){if(_0x193a7f){var _0xdfe7f8=typeof _0x287041[_0x5ae3('0x29')]===_0x5ae3('0x2a')&&typeof _0x287041['limit']===_0x5ae3('0x2a');var _0x84a44b=_0x193a7f[_0x5ae3('0x2b')];var _0x179fc0=_0xdfe7f8?0x0:_0x287041[_0x5ae3('0x29')];var _0x1817c8=_0xdfe7f8?_0x193a7f['count']:_0x287041[_0x5ae3('0x29')]+_0x287041[_0x5ae3('0x2c')];var _0x6eaff8;if(_0x1817c8>=_0x84a44b){_0x1817c8=_0x84a44b;_0x6eaff8=0xc8;}else{_0x6eaff8=0xce;}_0x1b5916[_0x5ae3('0x26')](_0x6eaff8);return _0x1b5916[_0x5ae3('0x2d')](_0x5ae3('0x2e'),_0x179fc0+'-'+_0x1817c8+'/'+_0x84a44b)[_0x5ae3('0x28')](_0x193a7f);}return null;};}function patchUpdates(_0x3de2ec){return function(_0x4e9b80){try{jsonpatch['apply'](_0x4e9b80,_0x3de2ec,!![]);}catch(_0xbd8ffa){return BPromise[_0x5ae3('0x2f')](_0xbd8ffa);}return _0x4e9b80[_0x5ae3('0x30')]();};}function saveUpdates(_0x10a1e5,_0x4ca1e3){return function(_0x428553){if(_0x428553){return _0x428553[_0x5ae3('0x31')](_0x10a1e5)[_0x5ae3('0x32')](function(_0x64b255){return _0x64b255;});}return null;};}function removeEntity(_0xc047c5,_0x69ea82){return function(_0x43ba52){if(_0x43ba52){return _0x43ba52[_0x5ae3('0x33')]()['then'](function(){var _0x360a19=_0x43ba52[_0x5ae3('0x34')]({'plain':!![]});var _0x3b69b5=_0x5ae3('0x35');return db[_0x5ae3('0x36')][_0x5ae3('0x33')]({'where':{'type':_0x3b69b5,'resourceId':_0x360a19['id']}})[_0x5ae3('0x32')](function(){return _0x43ba52;});})[_0x5ae3('0x32')](function(){_0xc047c5[_0x5ae3('0x26')](0xcc)['end']();});}};}function handleEntityNotFound(_0x18f38c,_0x47502a){return function(_0x396a1e){if(!_0x396a1e){_0x18f38c[_0x5ae3('0x25')](0x194);}return _0x396a1e;};}function handleError(_0x5cb827,_0xece9f5){_0xece9f5=_0xece9f5||0x1f4;return function(_0x2c7049){logger['error'](_0x2c7049[_0x5ae3('0x37')]);if(_0x2c7049[_0x5ae3('0x38')]){delete _0x2c7049[_0x5ae3('0x38')];}_0x5cb827[_0x5ae3('0x26')](_0xece9f5)['send'](_0x2c7049);};}exports[_0x5ae3('0x39')]=function(_0x5cc1ba,_0x2b3920){var _0x3c9ace={'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x4957a3={},_0x100258={'count':0x0,'rows':[]};var _0x365af2=_[_0x5ae3('0x3a')](db['WhatsappAccount'][_0x5ae3('0x3b')],function(_0x42441d){return{'name':_0x42441d['fieldName'],'type':_0x42441d['type'][_0x5ae3('0x3c')]};});_0x4957a3['model']=_[_0x5ae3('0x3a')](_0x365af2,_0x5ae3('0x38'));_0x4957a3[_0x5ae3('0x3d')]=_[_0x5ae3('0x3e')](_0x5cc1ba[_0x5ae3('0x3d')]);_0x4957a3[_0x5ae3('0x3f')]=_[_0x5ae3('0x40')](_0x4957a3[_0x5ae3('0x41')],_0x4957a3[_0x5ae3('0x3d')]);_0x3c9ace[_0x5ae3('0x42')]=_[_0x5ae3('0x40')](_0x4957a3[_0x5ae3('0x41')],qs['fields'](_0x5cc1ba[_0x5ae3('0x3d')]['fields']));_0x3c9ace[_0x5ae3('0x42')]=_0x3c9ace['attributes'][_0x5ae3('0x43')]?_0x3c9ace[_0x5ae3('0x42')]:_0x4957a3[_0x5ae3('0x41')];if(!_0x5cc1ba['query'][_0x5ae3('0x44')](_0x5ae3('0x45'))){_0x3c9ace[_0x5ae3('0x2c')]=qs[_0x5ae3('0x2c')](_0x5cc1ba[_0x5ae3('0x3d')][_0x5ae3('0x2c')]);_0x3c9ace[_0x5ae3('0x29')]=qs[_0x5ae3('0x29')](_0x5cc1ba['query'][_0x5ae3('0x29')]);}_0x3c9ace[_0x5ae3('0x46')]=qs[_0x5ae3('0x47')](_0x5cc1ba[_0x5ae3('0x3d')]['sort']);_0x3c9ace[_0x5ae3('0x48')]=qs[_0x5ae3('0x3f')](_[_0x5ae3('0x49')](_0x5cc1ba['query'],_0x4957a3[_0x5ae3('0x3f')]),_0x365af2);if(_0x5cc1ba['query'][_0x5ae3('0x4a')]){_0x3c9ace['where']=_[_0x5ae3('0x4b')](_0x3c9ace[_0x5ae3('0x48')],{'$or':_[_0x5ae3('0x3a')](_0x365af2,function(_0x528263){if(_0x528263['type']!==_0x5ae3('0x4c')){var _0x18ac1a={};_0x18ac1a[_0x528263[_0x5ae3('0x38')]]={'$like':'%'+_0x5cc1ba[_0x5ae3('0x3d')]['filter']+'%'};return _0x18ac1a;}})});}_0x3c9ace=_[_0x5ae3('0x4b')]({},_0x3c9ace,_0x5cc1ba[_0x5ae3('0x4d')]);var _0x16fb60={'where':_0x3c9ace['where']};return db[_0x5ae3('0x4e')][_0x5ae3('0x2b')](_0x16fb60)[_0x5ae3('0x32')](function(_0x300a34){_0x100258[_0x5ae3('0x2b')]=_0x300a34;if(_0x5cc1ba[_0x5ae3('0x3d')][_0x5ae3('0x4f')]){_0x3c9ace['include']=[{'all':!![]}];}return db[_0x5ae3('0x4e')][_0x5ae3('0x50')](_0x3c9ace);})[_0x5ae3('0x32')](function(_0x3f0df4){_0x100258[_0x5ae3('0x51')]=_0x3f0df4;return _0x100258;})[_0x5ae3('0x32')](respondWithFilteredResult(_0x2b3920,_0x3c9ace))[_0x5ae3('0x24')](handleError(_0x2b3920,null));};exports[_0x5ae3('0x52')]=function(_0xbd8e1d,_0x33edb8){var _0x4538b7={'raw':![],'where':{'id':_0xbd8e1d[_0x5ae3('0x53')]['id']},'include':[{'model':db[_0x5ae3('0x54')],'as':_0x5ae3('0x55')}]},_0xf079d={};_0xf079d[_0x5ae3('0x41')]=_[_0x5ae3('0x3e')](db['WhatsappAccount'][_0x5ae3('0x3b')]);_0xf079d[_0x5ae3('0x3d')]=_[_0x5ae3('0x3e')](_0xbd8e1d[_0x5ae3('0x3d')]);_0xf079d[_0x5ae3('0x3f')]=_['intersection'](_0xf079d[_0x5ae3('0x41')],_0xf079d['query']);_0x4538b7[_0x5ae3('0x42')]=_['intersection'](_0xf079d[_0x5ae3('0x41')],qs[_0x5ae3('0x56')](_0xbd8e1d['query'][_0x5ae3('0x56')]));_0x4538b7[_0x5ae3('0x42')]=_0x4538b7['attributes'][_0x5ae3('0x43')]?_0x4538b7[_0x5ae3('0x42')]:_0xf079d[_0x5ae3('0x41')];if(_0xbd8e1d[_0x5ae3('0x3d')][_0x5ae3('0x4f')]){_0x4538b7['include']=[{'all':!![]}];}_0x4538b7=_[_0x5ae3('0x4b')]({},_0x4538b7,_0xbd8e1d[_0x5ae3('0x4d')]);return db[_0x5ae3('0x4e')][_0x5ae3('0x57')](_0x4538b7)['then'](handleEntityNotFound(_0x33edb8,null))[_0x5ae3('0x32')](respondWithResult(_0x33edb8,null))[_0x5ae3('0x24')](handleError(_0x33edb8,null));};exports[_0x5ae3('0x58')]=function(_0x531868,_0x5d426f){return db[_0x5ae3('0x4e')]['create'](_0x531868[_0x5ae3('0x59')],{})[_0x5ae3('0x32')](function(_0x44f9c8){var _0x510c22=_0x531868[_0x5ae3('0x5a')]['get']({'plain':!![]});if(!_0x510c22)throw new Error(_0x5ae3('0x5b'));if(_0x510c22[_0x5ae3('0x5c')]===_0x5ae3('0x5a')){var _0x336ee3=_0x44f9c8['get']({'plain':!![]});var _0x410245=_0x5ae3('0x35');return db[_0x5ae3('0x5d')][_0x5ae3('0x57')]({'where':{'name':_0x410245,'userProfileId':_0x510c22[_0x5ae3('0x5e')]},'raw':!![]})['then'](function(_0x284444){if(_0x284444&&_0x284444[_0x5ae3('0x5f')]===0x0){return db[_0x5ae3('0x36')][_0x5ae3('0x58')]({'name':_0x336ee3[_0x5ae3('0x38')],'resourceId':_0x336ee3['id'],'type':_0x284444[_0x5ae3('0x38')],'sectionId':_0x284444['id']},{})['then'](function(){return _0x44f9c8;});}else{return _0x44f9c8;}})[_0x5ae3('0x24')](function(_0x49af23){logger[_0x5ae3('0x21')](_0x5ae3('0x60'),_0x49af23);throw _0x49af23;});}return _0x44f9c8;})[_0x5ae3('0x32')](respondWithResult(_0x5d426f,0xc9))[_0x5ae3('0x24')](handleError(_0x5d426f,null));};exports[_0x5ae3('0x31')]=function(_0x30c9aa,_0xf8866f){if(_0x30c9aa['body']['id']){delete _0x30c9aa[_0x5ae3('0x59')]['id'];}return db['WhatsappAccount'][_0x5ae3('0x57')]({'where':{'id':_0x30c9aa[_0x5ae3('0x53')]['id']},'include':[{'model':db['Pause'],'as':_0x5ae3('0x55')}]})[_0x5ae3('0x32')](handleEntityNotFound(_0xf8866f,null))['then'](saveUpdates(_0x30c9aa[_0x5ae3('0x59')],null))[_0x5ae3('0x32')](respondWithResult(_0xf8866f,null))[_0x5ae3('0x24')](handleError(_0xf8866f,null));};exports[_0x5ae3('0x33')]=function(_0x4af3ed,_0x3b0675){return db[_0x5ae3('0x4e')][_0x5ae3('0x57')]({'where':{'id':_0x4af3ed['params']['id']}})['then'](handleEntityNotFound(_0x3b0675,null))['then'](removeEntity(_0x3b0675,null))['catch'](handleError(_0x3b0675,null));};exports[_0x5ae3('0x61')]=function(_0x19a8e2,_0x2521f3){return db[_0x5ae3('0x4e')][_0x5ae3('0x61')]()['then'](respondWithResult(_0x2521f3,null))[_0x5ae3('0x24')](handleError(_0x2521f3,null));};exports[_0x5ae3('0x62')]=function(_0x1103b8,_0x38b250,_0x6ae10e){if(_0x1103b8['body']['id']){delete _0x1103b8['body']['id'];}return db[_0x5ae3('0x4e')][_0x5ae3('0x57')]({'where':{'id':_0x1103b8[_0x5ae3('0x53')]['id']}})[_0x5ae3('0x32')](handleEntityNotFound(_0x38b250,null))['then'](function(_0x145194){if(_0x145194){_0x1103b8[_0x5ae3('0x59')]['WhatsappAccountId']=_0x145194['id'];return db[_0x5ae3('0x63')][_0x5ae3('0x58')](_0x1103b8[_0x5ae3('0x59')]);}})[_0x5ae3('0x32')](respondWithResult(_0x38b250,null))['catch'](handleError(_0x38b250,null));};exports[_0x5ae3('0x64')]=function(_0x4d0557,_0x349dcc,_0x441c37){var _0x1a9550={'raw':![],'where':{}};var _0x161536={};var _0x57663d={'count':0x0,'rows':[]};return db[_0x5ae3('0x4e')][_0x5ae3('0x65')]({'where':{'id':_0x4d0557[_0x5ae3('0x53')]['id']}})[_0x5ae3('0x32')](handleEntityNotFound(_0x349dcc,null))[_0x5ae3('0x32')](function(_0x292fce){if(_0x292fce){_0x161536[_0x5ae3('0x41')]=_[_0x5ae3('0x3e')](db[_0x5ae3('0x63')][_0x5ae3('0x3b')]);_0x161536[_0x5ae3('0x3d')]=_[_0x5ae3('0x3e')](_0x4d0557[_0x5ae3('0x3d')]);_0x161536[_0x5ae3('0x3f')]=_['intersection'](_0x161536[_0x5ae3('0x41')],_0x161536['query']);_0x1a9550[_0x5ae3('0x42')]=_[_0x5ae3('0x40')](_0x161536[_0x5ae3('0x41')],qs[_0x5ae3('0x56')](_0x4d0557[_0x5ae3('0x3d')]['fields']));_0x1a9550[_0x5ae3('0x42')]=_0x1a9550[_0x5ae3('0x42')][_0x5ae3('0x43')]?_0x1a9550[_0x5ae3('0x42')]:_0x161536[_0x5ae3('0x41')];if(!_0x4d0557['query'][_0x5ae3('0x44')](_0x5ae3('0x45'))){_0x1a9550[_0x5ae3('0x2c')]=qs[_0x5ae3('0x2c')](_0x4d0557['query']['limit']);_0x1a9550['offset']=qs[_0x5ae3('0x29')](_0x4d0557['query'][_0x5ae3('0x29')]);}_0x1a9550['order']=qs[_0x5ae3('0x47')](_0x4d0557['query'][_0x5ae3('0x47')]);_0x1a9550[_0x5ae3('0x48')]=qs['filters'](_[_0x5ae3('0x49')](_0x4d0557[_0x5ae3('0x3d')],_0x161536[_0x5ae3('0x3f')]));_0x1a9550['where'][_0x5ae3('0x66')]=_0x292fce['id'];if(_0x4d0557['query']['filter']){_0x1a9550[_0x5ae3('0x48')]=_[_0x5ae3('0x4b')](_0x1a9550[_0x5ae3('0x48')],{'$or':_['map'](_0x1a9550['attributes'],function(_0x5e4892){var _0x3eede3={};_0x3eede3[_0x5e4892]={'$like':'%'+_0x4d0557[_0x5ae3('0x3d')][_0x5ae3('0x4a')]+'%'};return _0x3eede3;})});}_0x1a9550=_[_0x5ae3('0x4b')]({},_0x1a9550,_0x4d0557[_0x5ae3('0x4d')]);return db[_0x5ae3('0x63')]['count']({'where':_0x1a9550[_0x5ae3('0x48')]})['then'](function(_0xbc2a5a){_0x57663d[_0x5ae3('0x2b')]=_0xbc2a5a;if(_0x4d0557[_0x5ae3('0x3d')][_0x5ae3('0x4f')]){_0x1a9550['include']=[{'all':!![]}];}return db[_0x5ae3('0x63')][_0x5ae3('0x50')](_0x1a9550);})[_0x5ae3('0x32')](function(_0x280f65){_0x57663d[_0x5ae3('0x51')]=_0x280f65;return _0x57663d;});}})[_0x5ae3('0x32')](respondWithFilteredResult(_0x349dcc,_0x1a9550))[_0x5ae3('0x24')](handleError(_0x349dcc,null));};exports[_0x5ae3('0x67')]=function(_0x1631f1,_0x1903df,_0x2dba85){return db[_0x5ae3('0x4e')]['find']({'where':{'id':_0x1631f1['params']['id']}})['then'](handleEntityNotFound(_0x1903df,null))['then'](function(_0x38c792){if(_0x38c792){return _0x38c792[_0x5ae3('0x67')](_0x1631f1[_0x5ae3('0x3d')][_0x5ae3('0x68')]);}})[_0x5ae3('0x32')](respondWithStatusCode(_0x1903df,null))['catch'](handleError(_0x1903df,null));};exports[_0x5ae3('0x69')]=function(_0x2aeec4,_0x214d6b,_0x480ccc){if(_0x2aeec4['body']['id']){delete _0x2aeec4[_0x5ae3('0x59')]['id'];}return db['WhatsappAccount']['find']({'where':{'id':_0x2aeec4['params']['id']}})[_0x5ae3('0x32')](handleEntityNotFound(_0x214d6b,null))['then'](function(_0x2b88fd){if(_0x2b88fd){_0x2aeec4[_0x5ae3('0x59')]['WhatsappAccountId']=_0x2b88fd['id'];return db[_0x5ae3('0x6a')]['create'](_0x2aeec4[_0x5ae3('0x59')]);}})[_0x5ae3('0x32')](respondWithResult(_0x214d6b,null))[_0x5ae3('0x24')](handleError(_0x214d6b,null));};exports[_0x5ae3('0x6b')]=function(_0x4995e8,_0x11f9f6,_0x27a5a1){var _0x5038fa={'raw':![],'where':{}};var _0x345310={};var _0x4f9ec7={'count':0x0,'rows':[]};return db[_0x5ae3('0x4e')][_0x5ae3('0x65')]({'where':{'id':_0x4995e8[_0x5ae3('0x53')]['id']}})[_0x5ae3('0x32')](handleEntityNotFound(_0x11f9f6,null))[_0x5ae3('0x32')](function(_0x353d42){if(_0x353d42){_0x345310[_0x5ae3('0x41')]=_[_0x5ae3('0x3e')](db['CannedAnswer']['rawAttributes']);_0x345310['query']=_['keys'](_0x4995e8[_0x5ae3('0x3d')]);_0x345310['filters']=_['intersection'](_0x345310[_0x5ae3('0x41')],_0x345310[_0x5ae3('0x3d')]);_0x5038fa[_0x5ae3('0x42')]=_['intersection'](_0x345310[_0x5ae3('0x41')],qs[_0x5ae3('0x56')](_0x4995e8[_0x5ae3('0x3d')]['fields']));_0x5038fa[_0x5ae3('0x42')]=_0x5038fa[_0x5ae3('0x42')][_0x5ae3('0x43')]?_0x5038fa['attributes']:_0x345310[_0x5ae3('0x41')];if(!_0x4995e8['query'][_0x5ae3('0x44')](_0x5ae3('0x45'))){_0x5038fa[_0x5ae3('0x2c')]=qs[_0x5ae3('0x2c')](_0x4995e8[_0x5ae3('0x3d')][_0x5ae3('0x2c')]);_0x5038fa[_0x5ae3('0x29')]=qs[_0x5ae3('0x29')](_0x4995e8['query'][_0x5ae3('0x29')]);}_0x5038fa[_0x5ae3('0x46')]=qs[_0x5ae3('0x47')](_0x4995e8[_0x5ae3('0x3d')]['sort']);_0x5038fa[_0x5ae3('0x48')]=qs['filters'](_[_0x5ae3('0x49')](_0x4995e8[_0x5ae3('0x3d')],_0x345310[_0x5ae3('0x3f')]));_0x5038fa['where'][_0x5ae3('0x66')]=_0x353d42['id'];if(_0x4995e8[_0x5ae3('0x3d')][_0x5ae3('0x4a')]){_0x5038fa[_0x5ae3('0x48')]=_[_0x5ae3('0x4b')](_0x5038fa['where'],{'$or':_[_0x5ae3('0x3a')](_0x5038fa['attributes'],function(_0x3c89e5){var _0x40d962={};_0x40d962[_0x3c89e5]={'$like':'%'+_0x4995e8['query'][_0x5ae3('0x4a')]+'%'};return _0x40d962;})});}_0x5038fa=_[_0x5ae3('0x4b')]({},_0x5038fa,_0x4995e8[_0x5ae3('0x4d')]);return db['CannedAnswer'][_0x5ae3('0x2b')]({'where':_0x5038fa[_0x5ae3('0x48')]})[_0x5ae3('0x32')](function(_0x141204){_0x4f9ec7['count']=_0x141204;if(_0x4995e8[_0x5ae3('0x3d')]['includeAll']){_0x5038fa[_0x5ae3('0x6c')]=[{'all':!![]}];}return db[_0x5ae3('0x6a')][_0x5ae3('0x50')](_0x5038fa);})['then'](function(_0x25a096){_0x4f9ec7[_0x5ae3('0x51')]=_0x25a096;return _0x4f9ec7;});}})[_0x5ae3('0x32')](respondWithFilteredResult(_0x11f9f6,_0x5038fa))['catch'](handleError(_0x11f9f6,null));};exports['removeAnswers']=function(_0x475beb,_0x3d2df0,_0x3b3784){return db[_0x5ae3('0x4e')][_0x5ae3('0x57')]({'where':{'id':_0x475beb[_0x5ae3('0x53')]['id']}})[_0x5ae3('0x32')](handleEntityNotFound(_0x3d2df0,null))[_0x5ae3('0x32')](function(_0x31303d){if(_0x31303d){return _0x31303d[_0x5ae3('0x6d')](_0x475beb['query'][_0x5ae3('0x68')]);}})['then'](respondWithStatusCode(_0x3d2df0,null))[_0x5ae3('0x24')](handleError(_0x3d2df0,null));};exports[_0x5ae3('0x6e')]=function(_0x1d1b39,_0x37c37d,_0x4f0703){return db['WhatsappAccount'][_0x5ae3('0x57')]({'where':{'id':_0x1d1b39[_0x5ae3('0x53')]['id']}})[_0x5ae3('0x32')](handleEntityNotFound(_0x37c37d,null))['then'](function(_0x3083c9){if(_0x3083c9){return _0x3083c9['addAgents'](_0x1d1b39[_0x5ae3('0x59')][_0x5ae3('0x68')],_[_0x5ae3('0x6f')](_0x1d1b39[_0x5ae3('0x59')],[_0x5ae3('0x68'),'id'])||{})[_0x5ae3('0x70')](function(_0xc17081){for(var _0x530de8=0x0;_0x530de8<_0x1d1b39[_0x5ae3('0x59')][_0x5ae3('0x68')][_0x5ae3('0x43')];_0x530de8+=0x1){socket[_0x5ae3('0x71')](_0x5ae3('0x72'),{'UserId':Number(_0x1d1b39[_0x5ae3('0x59')][_0x5ae3('0x68')][_0x530de8]),'WhatsappAccountId':Number(_0x1d1b39['params']['id'])});}return _0xc17081;});}})[_0x5ae3('0x32')](respondWithResult(_0x37c37d,null))['catch'](handleError(_0x37c37d,null));};exports[_0x5ae3('0x73')]=function(_0x3e454b,_0x1fa77d,_0x34bf8b){return db[_0x5ae3('0x4e')][_0x5ae3('0x57')]({'where':{'id':_0x3e454b[_0x5ae3('0x53')]['id']}})[_0x5ae3('0x32')](handleEntityNotFound(_0x1fa77d,null))['then'](function(_0x46a7ad){if(_0x46a7ad){return _0x46a7ad[_0x5ae3('0x73')](_0x3e454b[_0x5ae3('0x3d')][_0x5ae3('0x68')])[_0x5ae3('0x32')](function(){if(_['isArray'](_0x3e454b['query'][_0x5ae3('0x68')])){for(var _0x95606=0x0;_0x95606<_0x3e454b[_0x5ae3('0x3d')]['ids'][_0x5ae3('0x43')];_0x95606+=0x1){socket[_0x5ae3('0x71')]('userWhatsappAccount:remove',{'UserId':Number(_0x3e454b[_0x5ae3('0x3d')][_0x5ae3('0x68')][_0x95606]),'WhatsappAccountId':Number(_0x3e454b['params']['id'])});}}else{socket['emit'](_0x5ae3('0x74'),{'UserId':Number(_0x3e454b[_0x5ae3('0x3d')][_0x5ae3('0x68')]),'WhatsappAccountId':Number(_0x3e454b[_0x5ae3('0x53')]['id'])});}});}})['then'](respondWithStatusCode(_0x1fa77d,null))[_0x5ae3('0x24')](handleError(_0x1fa77d,null));};exports[_0x5ae3('0x75')]=function(_0x31d4f6,_0x93bfd1,_0x23fe9){var _0x52f1c9={};var _0x588dda={};var _0x1379ce;var _0x5a3467;return db[_0x5ae3('0x4e')][_0x5ae3('0x65')]({'where':{'id':_0x31d4f6['params']['id']}})[_0x5ae3('0x32')](handleEntityNotFound(_0x93bfd1,null))[_0x5ae3('0x32')](function(_0x419b49){if(_0x419b49){_0x1379ce=_0x419b49;_0x588dda[_0x5ae3('0x41')]=_[_0x5ae3('0x3e')](db[_0x5ae3('0x76')]['rawAttributes']);_0x588dda[_0x5ae3('0x3d')]=_[_0x5ae3('0x3e')](_0x31d4f6[_0x5ae3('0x3d')]);_0x588dda[_0x5ae3('0x3f')]=_['intersection'](_0x588dda[_0x5ae3('0x41')],_0x588dda[_0x5ae3('0x3d')]);_0x52f1c9['attributes']=_[_0x5ae3('0x40')](_0x588dda[_0x5ae3('0x41')],qs[_0x5ae3('0x56')](_0x31d4f6[_0x5ae3('0x3d')][_0x5ae3('0x56')]));_0x52f1c9[_0x5ae3('0x42')]=_0x52f1c9['attributes'][_0x5ae3('0x43')]?_0x52f1c9[_0x5ae3('0x42')]:_0x588dda[_0x5ae3('0x41')];_0x52f1c9[_0x5ae3('0x46')]=qs['sort'](_0x31d4f6['query']['sort']);_0x52f1c9[_0x5ae3('0x48')]=qs['filters'](_[_0x5ae3('0x49')](_0x31d4f6['query'],_0x588dda[_0x5ae3('0x3f')]));if(_0x31d4f6[_0x5ae3('0x3d')][_0x5ae3('0x4a')]){_0x52f1c9[_0x5ae3('0x48')]=_['merge'](_0x52f1c9['where'],{'$or':_[_0x5ae3('0x3a')](_0x52f1c9[_0x5ae3('0x42')],function(_0x54c3f4){var _0xff11ef={};_0xff11ef[_0x54c3f4]={'$like':'%'+_0x31d4f6[_0x5ae3('0x3d')]['filter']+'%'};return _0xff11ef;})});}_0x52f1c9=_['merge']({},_0x52f1c9,_0x31d4f6[_0x5ae3('0x4d')]);return _0x1379ce[_0x5ae3('0x75')](_0x52f1c9);}})[_0x5ae3('0x32')](function(_0x112c8b){if(_0x112c8b){_0x5a3467=_0x112c8b[_0x5ae3('0x43')];if(!_0x31d4f6[_0x5ae3('0x3d')][_0x5ae3('0x44')](_0x5ae3('0x45'))){_0x52f1c9[_0x5ae3('0x2c')]=qs['limit'](_0x31d4f6['query'][_0x5ae3('0x2c')]);_0x52f1c9[_0x5ae3('0x29')]=qs[_0x5ae3('0x29')](_0x31d4f6[_0x5ae3('0x3d')]['offset']);}return _0x1379ce['getAgents'](_0x52f1c9);}})[_0x5ae3('0x32')](function(_0x4e0772){if(_0x4e0772){return _0x4e0772?{'count':_0x5a3467,'rows':_0x4e0772}:null;}})[_0x5ae3('0x32')](respondWithResult(_0x93bfd1,null))[_0x5ae3('0x24')](handleError(_0x93bfd1,null));};exports[_0x5ae3('0x77')]=function(_0x3d6d8d,_0x589f81,_0x26c8f4){return db[_0x5ae3('0x4e')][_0x5ae3('0x65')]({'where':{'id':_0x3d6d8d['params']['id']}})[_0x5ae3('0x32')](handleEntityNotFound(_0x589f81,null))[_0x5ae3('0x32')](function(_0x4f3605){if(_0x4f3605){return db['sequelize']['transaction'](function(_0x73b5e6){return db['WhatsappApplication']['destroy']({'where':{'WhatsappAccountId':_0x3d6d8d[_0x5ae3('0x53')]['id']},'transaction':_0x73b5e6})[_0x5ae3('0x32')](function(_0x31f6a6){var _0x3f4873=_[_0x5ae3('0x3a')](_0x3d6d8d[_0x5ae3('0x59')],function(_0x5128bc){_0x5128bc[_0x5ae3('0x66')]=_0x3d6d8d[_0x5ae3('0x53')]['id'];return _0x5128bc;});return db[_0x5ae3('0x78')][_0x5ae3('0x79')](_0x3f4873,{'transaction':_0x73b5e6});});})[_0x5ae3('0x32')](function(){return db[_0x5ae3('0x78')][_0x5ae3('0x7a')]({'where':{'WhatsappAccountId':_0x3d6d8d[_0x5ae3('0x53')]['id']},'order':_0x5ae3('0x7b')});});}})[_0x5ae3('0x32')](respondWithResult(_0x589f81,null))[_0x5ae3('0x24')](handleError(_0x589f81,null));};exports[_0x5ae3('0x7c')]=function(_0x170494,_0x399ffd,_0x21fbf7){var _0x456767={};var _0xd79545={};var _0x2ad78f;var _0x1fdbf5;return db[_0x5ae3('0x4e')][_0x5ae3('0x65')]({'where':{'id':_0x170494[_0x5ae3('0x53')]['id']}})[_0x5ae3('0x32')](handleEntityNotFound(_0x399ffd,null))[_0x5ae3('0x32')](function(_0x2e9dba){if(_0x2e9dba){_0x2ad78f=_0x2e9dba;_0xd79545[_0x5ae3('0x41')]=_[_0x5ae3('0x3e')](db[_0x5ae3('0x78')][_0x5ae3('0x3b')]);_0xd79545[_0x5ae3('0x3d')]=_[_0x5ae3('0x3e')](_0x170494[_0x5ae3('0x3d')]);_0xd79545['filters']=_[_0x5ae3('0x40')](_0xd79545['model'],_0xd79545[_0x5ae3('0x3d')]);_0x456767[_0x5ae3('0x42')]=_[_0x5ae3('0x40')](_0xd79545[_0x5ae3('0x41')],qs[_0x5ae3('0x56')](_0x170494[_0x5ae3('0x3d')][_0x5ae3('0x56')]));_0x456767['attributes']=_0x456767[_0x5ae3('0x42')][_0x5ae3('0x43')]?_0x456767[_0x5ae3('0x42')]:_0xd79545[_0x5ae3('0x41')];_0x456767[_0x5ae3('0x46')]=qs[_0x5ae3('0x47')](_0x170494[_0x5ae3('0x3d')][_0x5ae3('0x47')]);_0x456767[_0x5ae3('0x48')]=qs[_0x5ae3('0x3f')](_[_0x5ae3('0x49')](_0x170494[_0x5ae3('0x3d')],_0xd79545[_0x5ae3('0x3f')]));if(_0x170494[_0x5ae3('0x3d')]['filter']){_0x456767[_0x5ae3('0x48')]=_[_0x5ae3('0x4b')](_0x456767[_0x5ae3('0x48')],{'$or':_[_0x5ae3('0x3a')](_0x456767[_0x5ae3('0x42')],function(_0x1eff78){var _0x49160a={};_0x49160a[_0x1eff78]={'$like':'%'+_0x170494[_0x5ae3('0x3d')]['filter']+'%'};return _0x49160a;})});}_0x456767=_['merge']({},_0x456767,_0x170494[_0x5ae3('0x4d')]);return _0x2ad78f[_0x5ae3('0x7c')](_0x456767);}})['then'](function(_0x1c180a){if(_0x1c180a){_0x1fdbf5=_0x1c180a[_0x5ae3('0x43')];if(!_0x170494[_0x5ae3('0x3d')][_0x5ae3('0x44')]('nolimit')){_0x456767[_0x5ae3('0x2c')]=qs[_0x5ae3('0x2c')](_0x170494[_0x5ae3('0x3d')][_0x5ae3('0x2c')]);_0x456767['offset']=qs[_0x5ae3('0x29')](_0x170494[_0x5ae3('0x3d')][_0x5ae3('0x29')]);}return _0x2ad78f[_0x5ae3('0x7c')](_0x456767);}})[_0x5ae3('0x32')](function(_0x1c73c1){if(_0x1c73c1){return _0x1c73c1?{'count':_0x1fdbf5,'rows':_0x1c73c1}:null;}})[_0x5ae3('0x32')](respondWithResult(_0x399ffd,null))[_0x5ae3('0x24')](handleError(_0x399ffd,null));};exports[_0x5ae3('0x7d')]=function(_0x39ba3b,_0x27bdc4,_0x42da4f){var _0x46cfde={'channel':_0x5ae3('0x7e')};var _0x14f045=[];var _0x5e7d9f=[];var _0x39b314={};return db[_0x5ae3('0x4e')][_0x5ae3('0x57')]({'where':{'id':_0x39ba3b[_0x5ae3('0x53')]['id']},'include':[{'model':db['WhatsappApplication'],'as':'Applications'}]})[_0x5ae3('0x32')](handleEntityNotFound(_0x27bdc4,null))['then'](function(_0x43b779){_0x46cfde[_0x5ae3('0x7f')]=_0x43b779;_0x46cfde['applications']=_[_0x5ae3('0x80')](_0x43b779[_0x5ae3('0x81')],[_0x5ae3('0x7b')],[_0x5ae3('0x82')]);if(_0x46cfde[_0x5ae3('0x7f')][_0x5ae3('0x81')]){delete _0x46cfde[_0x5ae3('0x7f')][_0x5ae3('0x81')];}return db[_0x5ae3('0x83')][_0x5ae3('0x61')]();})[_0x5ae3('0x32')](function(_0x4f991a){if(!_0x4f991a){throw new db['Sequelize'][(_0x5ae3('0x84'))](_0x5ae3('0x85'));}_0x14f045=_['difference'](_[_0x5ae3('0x3e')](_0x4f991a),[_0x5ae3('0x86'),'updatedAt']);_0x5e7d9f=_[_0x5ae3('0x87')](_[_0x5ae3('0x3e')](_0x4f991a),[_0x5ae3('0x86'),_0x5ae3('0x88'),_0x5ae3('0x89'),_0x5ae3('0x8a')]);_0x46cfde[_0x5ae3('0x59')]={'mapKey':'mobile'};if(_0x46cfde['account'][_0x5ae3('0x8b')]&&_0x46cfde[_0x5ae3('0x7f')]['type']===_0x5ae3('0x8c')){_0x46cfde['body'][_0x5ae3('0x8d')]=_0x39ba3b[_0x5ae3('0x59')][_0x5ae3('0x8e')][_0x5ae3('0x8f')](_0x5ae3('0x90'),'');_0x46cfde[_0x5ae3('0x59')][_0x5ae3('0x59')]=_0x39ba3b['body']['Body'];_0x46cfde[_0x5ae3('0x59')]['messageId']=_0x39ba3b['body'][_0x5ae3('0x91')];}if(_0x46cfde['body']['id']){delete _0x46cfde[_0x5ae3('0x59')]['id'];}if(_[_0x5ae3('0x92')](_0x46cfde['body'][_0x5ae3('0x8d')])){throw new db[(_0x5ae3('0x93'))][(_0x5ae3('0x84'))]('from\x20is\x20mandatory');}if(_['isNil'](_0x46cfde[_0x5ae3('0x59')][_0x5ae3('0x59')])||_0x46cfde[_0x5ae3('0x59')][_0x5ae3('0x59')]===''){throw new db[(_0x5ae3('0x93'))][(_0x5ae3('0x84'))](_0x5ae3('0x94'));}if(_[_0x5ae3('0x92')](_0x46cfde[_0x5ae3('0x59')]['mapKey'])){throw new db['Sequelize']['ValidationError'](_0x5ae3('0x95')+_0x5e7d9f);}if(!_[_0x5ae3('0x96')](_0x5e7d9f,_0x46cfde[_0x5ae3('0x59')]['mapKey'])){throw new db[(_0x5ae3('0x93'))][(_0x5ae3('0x84'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x5e7d9f);}_0x39b314[_0x46cfde[_0x5ae3('0x59')][_0x5ae3('0x97')]]=_0x46cfde[_0x5ae3('0x59')]['from'];return db[_0x5ae3('0x98')][_0x5ae3('0x57')]({'where':{'id':_0x46cfde['account'][_0x5ae3('0x8a')]},'include':[{'model':db[_0x5ae3('0x83')],'as':'Contacts','where':_0x39b314,'limit':0x1,'order':[[_0x5ae3('0x88'),_0x5ae3('0x99')]]}]});})[_0x5ae3('0x32')](handleEntityNotFound(_0x27bdc4,null))[_0x5ae3('0x32')](function(_0x5203cf){if(_0x5203cf){_0x46cfde[_0x5ae3('0x9a')]=_[_0x5ae3('0x6f')](_0x5203cf,[_0x5ae3('0x9b')]);if(_0x5203cf[_0x5ae3('0x9b')]['length']){return _0x5203cf[_0x5ae3('0x9b')][0x0];}var _0x4d0486=_[_0x5ae3('0x15')](_0x46cfde[_0x5ae3('0x59')],{'firstName':_0x46cfde[_0x5ae3('0x59')]['from'],'ListId':_0x5203cf['id']});_0x4d0486[_0x46cfde[_0x5ae3('0x59')][_0x5ae3('0x97')]]=_0x46cfde[_0x5ae3('0x59')][_0x5ae3('0x8d')];return db['CmContact'][_0x5ae3('0x58')](_0x4d0486,{'fields':_0x14f045,'raw':!![]});}})['then'](handleEntityNotFound(_0x27bdc4,null))[_0x5ae3('0x32')](function(_0x3c873b){if(_0x3c873b){_0x46cfde[_0x5ae3('0x9c')]=_0x3c873b;var _0x12de67={'ContactId':_0x3c873b['id'],'phone':_0x46cfde['body'][_0x5ae3('0x8d')],'WhatsappAccountId':_0x39ba3b[_0x5ae3('0x53')]['id']};var _0x575804={'ContactId':_0x3c873b['id'],'WhatsappAccountId':_0x39ba3b[_0x5ae3('0x53')]['id'],'closed':![]};return db[_0x5ae3('0x9d')]['find']({'where':_0x575804})[_0x5ae3('0x32')](function(_0x3b9e2f){if(_0x3b9e2f){return[_0x3b9e2f,![]];}return db[_0x5ae3('0x9d')]['create'](_0x12de67)[_0x5ae3('0x32')](function(_0x296de1){return[_0x296de1,!![]];});});}})['spread'](function(_0x4136d3,_0x447273){_0x46cfde['interaction']=_0x4136d3[_0x5ae3('0x34')]({'plain':!![]});_0x46cfde[_0x5ae3('0x9e')]['created']=![];if(_0x447273){if(_0x46cfde[_0x5ae3('0x7f')][_0x5ae3('0x9f')]){_0x46cfde['applications'][_0x5ae3('0xa0')]({'id':0x0,'priority':_0x46cfde['applications']['length']+0x1,'app':_0x5ae3('0xa1'),'appdata':_0x5ae3('0xa2'),'interval':_0x5ae3('0xa3')});}_0x46cfde[_0x5ae3('0x9e')]['created']=!![];}return db[_0x5ae3('0xa4')]['create']({'phone':_0x46cfde[_0x5ae3('0x59')][_0x5ae3('0x8d')],'messageId':_0x46cfde[_0x5ae3('0x59')][_0x5ae3('0xa5')],'body':_0x46cfde[_0x5ae3('0x59')]['body'],'WhatsappAccountId':_0x39ba3b[_0x5ae3('0x53')]['id'],'WhatsappInteractionId':_0x4136d3['id'],'direction':'in','ContactId':_0x4136d3[_0x5ae3('0xa6')],'AttachmentId':_0x46cfde[_0x5ae3('0x59')][_0x5ae3('0xa7')]});})[_0x5ae3('0x32')](function(_0x505004){_0x46cfde[_0x5ae3('0x22')]=_0x505004;if(_0x46cfde[_0x5ae3('0x9e')][_0x5ae3('0xa8')]){return db[_0x5ae3('0x76')]['find']({'attributes':['id',_0x5ae3('0x38')],'where':{'id':_0x46cfde['interaction'][_0x5ae3('0xa8')]}})['then'](function(_0x366e44){if(_0x366e44){_0x46cfde[_0x5ae3('0xa9')][_0x5ae3('0xaa')]({'id':0x0,'priority':0x0,'app':_0x5ae3('0xab'),'appdata':_0x366e44[_0x5ae3('0x38')]+','+(_0x46cfde['account'][_0x5ae3('0xac')]||0xa),'interval':_0x5ae3('0xa3')});}return respondWithRpcPromise('Start',_0x5ae3('0xad'),_0x46cfde);});}return respondWithRpcPromise(_0x5ae3('0xae'),_0x5ae3('0xad'),_0x46cfde);})['then'](function(_0x526558){if(_0x526558){var _0x185027=0xc8;var _0x27291e=_0x5ae3('0xaf');logger['info']('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x27291e,_0x185027,_0x5ae3('0xb0'));logger[_0x5ae3('0x1e')](_0x5ae3('0xb1'),_0x27291e,_0x185027,_0x5ae3('0xb0'),JSON['stringify'](_0x526558));if(_0x46cfde[_0x5ae3('0x7f')]['type']===_0x5ae3('0x8c')){return _0x27bdc4[_0x5ae3('0x26')](_0x185027)[_0x5ae3('0x2d')](_0x5ae3('0xb2'),_0x5ae3('0xb3'))['send'](_0x5ae3('0xb4'));}else{return _0x27bdc4['status'](_0x185027)[_0x5ae3('0x28')](_0x526558);}}})[_0x5ae3('0x24')](handleError(_0x27bdc4,null));};exports[_0x5ae3('0xb5')]=function(_0x4a7be8,_0xe73bc8,_0x275d59){var _0x5afa8e,_0x345388,_0x39b6fd;if(_[_0x5ae3('0x92')](_0x4a7be8[_0x5ae3('0x59')][_0x5ae3('0x59')])||_0x4a7be8[_0x5ae3('0x59')][_0x5ae3('0x59')]===''){throw new db[(_0x5ae3('0x93'))]['ValidationError'](_0x5ae3('0x94'));}if(_[_0x5ae3('0x92')](_0x4a7be8[_0x5ae3('0x59')]['to'])){throw new db[(_0x5ae3('0x93'))]['ValidationError'](_0x5ae3('0xb6'));}_0x5afa8e=_0x4a7be8[_0x5ae3('0x59')]['to'];return db[_0x5ae3('0x4e')][_0x5ae3('0x57')]({'where':{'id':_0x4a7be8[_0x5ae3('0x53')]['id']},'include':[{'model':db[_0x5ae3('0x98')],'as':_0x5ae3('0xb7'),'include':[{'model':db[_0x5ae3('0x83')],'as':_0x5ae3('0x9b'),'where':{'mobile':_0x5afa8e},'limit':0x1,'order':[[_0x5ae3('0x88'),_0x5ae3('0x99')]]}]}]})[_0x5ae3('0x32')](handleEntityNotFound(_0xe73bc8,null))[_0x5ae3('0x32')](function(_0x21a9c9){if(_0x21a9c9&&_0x21a9c9[_0x5ae3('0xb7')]){_0x345388=_0x21a9c9[_0x5ae3('0x34')]({'plain':!![]});if(_0x345388['List']&&_0x345388[_0x5ae3('0xb7')][_0x5ae3('0x9b')][_0x5ae3('0x43')]){return _0x345388[_0x5ae3('0xb7')][_0x5ae3('0x9b')][0x0];}return db[_0x5ae3('0x83')][_0x5ae3('0x58')](_[_0x5ae3('0x15')](_0x4a7be8[_0x5ae3('0x59')],{'firstName':_0x5afa8e,'mobile':_0x5afa8e,'phone':_0x5afa8e,'ListId':_0x345388[_0x5ae3('0x8a')]}));}})[_0x5ae3('0x32')](handleEntityNotFound(_0xe73bc8,null))[_0x5ae3('0x32')](function(_0x468965){if(_0x468965){_0x39b6fd=_0x468965;return db['WhatsappInteraction'][_0x5ae3('0x57')]({'where':{'ContactId':_0x39b6fd['id'],'closed':![],'WhatsappAccountId':_0x345388['id']}})[_0x5ae3('0x32')](function(_0xd7e843){if(_0xd7e843){return[_0xd7e843,![]];}return db[_0x5ae3('0x9d')]['create']({'UserId':_0x4a7be8[_0x5ae3('0x5a')]['id'],'ContactId':_0x39b6fd['id'],'WhatsappAccountId':_0x345388['id'],'phone':_0x5afa8e,'firstMsgDirection':_0x5ae3('0xb8'),'Messages':[_['merge'](_0x4a7be8[_0x5ae3('0x59')],{'read':![],'body':_0x4a7be8[_0x5ae3('0x59')][_0x5ae3('0x59')],'phone':_0x5afa8e,'WhatsappAccountId':_0x345388['id'],'UserId':_0x4a7be8[_0x5ae3('0x5a')]['id'],'ContactId':_0x39b6fd['id']})]},{'include':[{'model':db[_0x5ae3('0xa4')],'as':_0x5ae3('0xb9')}]})['then'](function(_0x1cd609){return[_0x1cd609,!![]];});});}})[_0x5ae3('0x70')](function(_0x1d7921,_0x20ad46){if(_0x20ad46){return _0x1d7921;}return db[_0x5ae3('0xa4')][_0x5ae3('0x58')](_[_0x5ae3('0x4b')](_0x4a7be8[_0x5ae3('0x59')],{'read':![],'body':_0x4a7be8[_0x5ae3('0x59')][_0x5ae3('0x59')],'phone':_0x5afa8e,'WhatsappAccountId':_0x345388['id'],'WhatsappInteractionId':_0x1d7921['id'],'UserId':_0x4a7be8[_0x5ae3('0x5a')]['id'],'ContactId':_0x39b6fd['id']}))['then'](function(_0x5e2256){_0x1d7921[_0x5ae3('0xba')][_0x5ae3('0xb9')]=[];_0x1d7921[_0x5ae3('0xba')][_0x5ae3('0xb9')][_0x5ae3('0xa0')](_0x5e2256[_0x5ae3('0xba')]);return _0x1d7921;});})[_0x5ae3('0x32')](respondWithResult(_0xe73bc8,null))[_0x5ae3('0x24')](handleError(_0xe73bc8,null));}; \ No newline at end of file +var _0x4cd8=['findOne','pick','filter','findAll','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','nolimit','removeAnswers','spread','emit','userWhatsappAccount:save','removeAgents','isArray','userWhatsappAccount:remove','getAgents','addApplications','sequelize','transaction','WhatsappApplication','getApplications','notify','whatsapp','applications','Applications','priority','account','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','CompanyId','ListId','twilio','from','replace','messageId','MessageSid','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','CmList','Contacts','DESC','list','omit','contact','WhatsappInteraction','interaction','created','autoclose','close','*,*,*,*','WhatsappMessage','UserId','unshift','agent','waitForTheAssignedAgent','Start','startRouting','receiveMessage','entity\x20found','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','stringify','Content-Type','text/xml','\x0a','to\x20is\x20mandatory','List','updatedAt','out','Messages','dataValues','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./whatsappAccount.socket','client','http','request','WhatsappAccount,\x20%s,\x20%s','request\x20sent','WhatsappAccount,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','destroy','then','get','WhatsappAccounts','UserProfileResource','end','stack','name','send','index','Pause','mandatoryDispositionPause','map','rawAttributes','fieldName','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','filters','merge','type','options','includeAll','include','WhatsappAccount','rows','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','addDisposition','WhatsappAccountId','Disposition','getDispositions'];(function(_0x40dc7e,_0x322488){var _0x31f6d4=function(_0x2db5e2){while(--_0x2db5e2){_0x40dc7e['push'](_0x40dc7e['shift']());}};_0x31f6d4(++_0x322488);}(_0x4cd8,0x1c5));var _0x84cd=function(_0x2ce6d5,_0x333e0c){_0x2ce6d5=_0x2ce6d5-0x0;var _0x32d272=_0x4cd8[_0x2ce6d5];return _0x32d272;};'use strict';var emlformat=require(_0x84cd('0x0'));var rimraf=require(_0x84cd('0x1'));var zipdir=require(_0x84cd('0x2'));var jsonpatch=require(_0x84cd('0x3'));var rp=require(_0x84cd('0x4'));var moment=require(_0x84cd('0x5'));var BPromise=require(_0x84cd('0x6'));var Mustache=require('mustache');var util=require(_0x84cd('0x7'));var path=require(_0x84cd('0x8'));var sox=require(_0x84cd('0x9'));var csv=require(_0x84cd('0xa'));var ejs=require(_0x84cd('0xb'));var fs=require('fs');var fs_extra=require(_0x84cd('0xc'));var _=require('lodash');var squel=require(_0x84cd('0xd'));var crypto=require(_0x84cd('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x84cd('0xf'));var toCsv=require(_0x84cd('0xa'));var querystring=require(_0x84cd('0x10'));var Papa=require('papaparse');var Redis=require(_0x84cd('0x11'));var authService=require(_0x84cd('0x12'));var qs=require(_0x84cd('0x13'));var as=require(_0x84cd('0x14'));var hardwareService=require(_0x84cd('0x15'));var logger=require(_0x84cd('0x16'))(_0x84cd('0x17'));var utils=require('../../config/utils');var config=require(_0x84cd('0x18'));var licenseUtil=require(_0x84cd('0x19'));var db=require('../../mysqldb')['db'];config[_0x84cd('0x1a')]=_[_0x84cd('0x1b')](config[_0x84cd('0x1a')],{'host':_0x84cd('0x1c'),'port':0x18eb});var socket=require(_0x84cd('0x1d'))(new Redis(config[_0x84cd('0x1a')]));require(_0x84cd('0x1e'))['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0x84cd('0x1f')][_0x84cd('0x20')]({'port':0x232c});function respondWithRpcPromise(_0x17abb4,_0x426b30,_0x295291,_0x54f706){return new BPromise(function(_0x588f5f,_0x3d4f0a){var _0x4a7457=_0x54f706||client;return _0x4a7457[_0x84cd('0x21')](_0x17abb4,_0x295291)['then'](function(_0x33ad22){logger['info'](_0x84cd('0x22'),_0x426b30,_0x84cd('0x23'));logger['debug'](_0x84cd('0x24'),_0x426b30,_0x84cd('0x23'),JSON['stringify'](_0x33ad22));if(_0x33ad22[_0x84cd('0x25')]){if(_0x33ad22[_0x84cd('0x25')][_0x84cd('0x26')]===0x1f4){logger[_0x84cd('0x25')](_0x84cd('0x22'),_0x426b30,_0x33ad22[_0x84cd('0x25')][_0x84cd('0x27')]);return _0x3d4f0a(_0x33ad22['error']['message']);}logger['error'](_0x84cd('0x22'),_0x426b30,_0x33ad22[_0x84cd('0x25')][_0x84cd('0x27')]);return _0x588f5f(_0x33ad22[_0x84cd('0x25')][_0x84cd('0x27')]);}else{logger[_0x84cd('0x28')](_0x84cd('0x22'),_0x426b30,_0x84cd('0x23'));_0x588f5f(_0x33ad22[_0x84cd('0x29')][_0x84cd('0x27')]);}})[_0x84cd('0x2a')](function(_0x15bb40){logger[_0x84cd('0x25')](_0x84cd('0x22'),_0x426b30,_0x15bb40);_0x3d4f0a(_0x15bb40);});});}function respondWithStatusCode(_0x466c38,_0x100350){_0x100350=_0x100350||0xcc;return function(_0x39427e){if(_0x39427e){return _0x466c38[_0x84cd('0x2b')](_0x100350);}return _0x466c38['status'](_0x100350)['end']();};}function respondWithResult(_0xc31b1e,_0x2a6dac){_0x2a6dac=_0x2a6dac||0xc8;return function(_0x97c23e){if(_0x97c23e){return _0xc31b1e[_0x84cd('0x2c')](_0x2a6dac)[_0x84cd('0x2d')](_0x97c23e);}};}function respondWithFilteredResult(_0x6b2abe,_0x404bde){return function(_0x278a59){if(_0x278a59){var _0x49427e=typeof _0x404bde[_0x84cd('0x2e')]===_0x84cd('0x2f')&&typeof _0x404bde[_0x84cd('0x30')]===_0x84cd('0x2f');var _0x484de2=_0x278a59[_0x84cd('0x31')];var _0x264f58=_0x49427e?0x0:_0x404bde['offset'];var _0x364e47=_0x49427e?_0x278a59[_0x84cd('0x31')]:_0x404bde[_0x84cd('0x2e')]+_0x404bde[_0x84cd('0x30')];var _0x53c8db;if(_0x364e47>=_0x484de2){_0x364e47=_0x484de2;_0x53c8db=0xc8;}else{_0x53c8db=0xce;}_0x6b2abe['status'](_0x53c8db);return _0x6b2abe[_0x84cd('0x32')](_0x84cd('0x33'),_0x264f58+'-'+_0x364e47+'/'+_0x484de2)[_0x84cd('0x2d')](_0x278a59);}return null;};}function patchUpdates(_0x5d390f){return function(_0x3b1274){try{jsonpatch[_0x84cd('0x34')](_0x3b1274,_0x5d390f,!![]);}catch(_0x5f48e0){return BPromise['reject'](_0x5f48e0);}return _0x3b1274['save']();};}function saveUpdates(_0x78e5f8,_0x3a5abd){return function(_0x14b34b){if(_0x14b34b){return _0x14b34b['update'](_0x78e5f8)['then'](function(_0x598619){return _0x598619;});}return null;};}function removeEntity(_0x53ab14,_0x24ad9b){return function(_0x295a38){if(_0x295a38){return _0x295a38[_0x84cd('0x35')]()[_0x84cd('0x36')](function(){var _0x253fa8=_0x295a38[_0x84cd('0x37')]({'plain':!![]});var _0x52d261=_0x84cd('0x38');return db[_0x84cd('0x39')]['destroy']({'where':{'type':_0x52d261,'resourceId':_0x253fa8['id']}})['then'](function(){return _0x295a38;});})[_0x84cd('0x36')](function(){_0x53ab14[_0x84cd('0x2c')](0xcc)[_0x84cd('0x3a')]();});}};}function handleEntityNotFound(_0x2df764,_0x11dba3){return function(_0x234a71){if(!_0x234a71){_0x2df764[_0x84cd('0x2b')](0x194);}return _0x234a71;};}function handleError(_0x497176,_0x3bcb9b){_0x3bcb9b=_0x3bcb9b||0x1f4;return function(_0x4f69ed){logger[_0x84cd('0x25')](_0x4f69ed[_0x84cd('0x3b')]);if(_0x4f69ed['name']){delete _0x4f69ed[_0x84cd('0x3c')];}_0x497176[_0x84cd('0x2c')](_0x3bcb9b)[_0x84cd('0x3d')](_0x4f69ed);};}exports[_0x84cd('0x3e')]=function(_0x36be8c,_0xdd276b){var _0x35d978={'include':[{'model':db[_0x84cd('0x3f')],'as':_0x84cd('0x40')}]},_0x1ee44f={},_0x29e965={'count':0x0,'rows':[]};var _0x4ed9c8=_[_0x84cd('0x41')](db['WhatsappAccount'][_0x84cd('0x42')],function(_0x463ade){return{'name':_0x463ade[_0x84cd('0x43')],'type':_0x463ade['type'][_0x84cd('0x44')]};});_0x1ee44f[_0x84cd('0x45')]=_[_0x84cd('0x41')](_0x4ed9c8,_0x84cd('0x3c'));_0x1ee44f[_0x84cd('0x46')]=_[_0x84cd('0x47')](_0x36be8c[_0x84cd('0x46')]);_0x1ee44f['filters']=_['intersection'](_0x1ee44f[_0x84cd('0x45')],_0x1ee44f['query']);_0x35d978[_0x84cd('0x48')]=_[_0x84cd('0x49')](_0x1ee44f[_0x84cd('0x45')],qs[_0x84cd('0x4a')](_0x36be8c[_0x84cd('0x46')]['fields']));_0x35d978[_0x84cd('0x48')]=_0x35d978[_0x84cd('0x48')][_0x84cd('0x4b')]?_0x35d978[_0x84cd('0x48')]:_0x1ee44f[_0x84cd('0x45')];if(!_0x36be8c[_0x84cd('0x46')][_0x84cd('0x4c')]('nolimit')){_0x35d978[_0x84cd('0x30')]=qs[_0x84cd('0x30')](_0x36be8c['query'][_0x84cd('0x30')]);_0x35d978[_0x84cd('0x2e')]=qs[_0x84cd('0x2e')](_0x36be8c['query'][_0x84cd('0x2e')]);}_0x35d978[_0x84cd('0x4d')]=qs['sort'](_0x36be8c[_0x84cd('0x46')][_0x84cd('0x4e')]);_0x35d978[_0x84cd('0x4f')]=qs[_0x84cd('0x50')](_['pick'](_0x36be8c[_0x84cd('0x46')],_0x1ee44f[_0x84cd('0x50')]),_0x4ed9c8);if(_0x36be8c[_0x84cd('0x46')]['filter']){_0x35d978['where']=_[_0x84cd('0x51')](_0x35d978[_0x84cd('0x4f')],{'$or':_[_0x84cd('0x41')](_0x4ed9c8,function(_0x51c58e){if(_0x51c58e[_0x84cd('0x52')]!=='VIRTUAL'){var _0x3f740b={};_0x3f740b[_0x51c58e['name']]={'$like':'%'+_0x36be8c['query']['filter']+'%'};return _0x3f740b;}})});}_0x35d978=_[_0x84cd('0x51')]({},_0x35d978,_0x36be8c[_0x84cd('0x53')]);var _0x10d058={'where':_0x35d978[_0x84cd('0x4f')]};return db['WhatsappAccount']['count'](_0x10d058)[_0x84cd('0x36')](function(_0x239a6f){_0x29e965[_0x84cd('0x31')]=_0x239a6f;if(_0x36be8c[_0x84cd('0x46')][_0x84cd('0x54')]){_0x35d978[_0x84cd('0x55')]=[{'all':!![]}];}return db[_0x84cd('0x56')]['findAll'](_0x35d978);})[_0x84cd('0x36')](function(_0x3d6a61){_0x29e965[_0x84cd('0x57')]=_0x3d6a61;return _0x29e965;})[_0x84cd('0x36')](respondWithFilteredResult(_0xdd276b,_0x35d978))[_0x84cd('0x2a')](handleError(_0xdd276b,null));};exports['show']=function(_0x447540,_0x41b7d7){var _0x4f335d={'raw':![],'where':{'id':_0x447540[_0x84cd('0x58')]['id']},'include':[{'model':db[_0x84cd('0x3f')],'as':_0x84cd('0x40')}]},_0x56c0b0={};_0x56c0b0['model']=_[_0x84cd('0x47')](db[_0x84cd('0x56')][_0x84cd('0x42')]);_0x56c0b0[_0x84cd('0x46')]=_[_0x84cd('0x47')](_0x447540[_0x84cd('0x46')]);_0x56c0b0[_0x84cd('0x50')]=_[_0x84cd('0x49')](_0x56c0b0[_0x84cd('0x45')],_0x56c0b0[_0x84cd('0x46')]);_0x4f335d[_0x84cd('0x48')]=_[_0x84cd('0x49')](_0x56c0b0[_0x84cd('0x45')],qs[_0x84cd('0x4a')](_0x447540['query'][_0x84cd('0x4a')]));_0x4f335d[_0x84cd('0x48')]=_0x4f335d[_0x84cd('0x48')]['length']?_0x4f335d['attributes']:_0x56c0b0['model'];if(_0x447540[_0x84cd('0x46')][_0x84cd('0x54')]){_0x4f335d['include']=[{'all':!![]}];}_0x4f335d=_[_0x84cd('0x51')]({},_0x4f335d,_0x447540[_0x84cd('0x53')]);return db[_0x84cd('0x56')][_0x84cd('0x59')](_0x4f335d)['then'](handleEntityNotFound(_0x41b7d7,null))['then'](respondWithResult(_0x41b7d7,null))[_0x84cd('0x2a')](handleError(_0x41b7d7,null));};exports[_0x84cd('0x5a')]=function(_0x4ef4a0,_0x541338){return db['WhatsappAccount'][_0x84cd('0x5a')](_0x4ef4a0[_0x84cd('0x5b')],{})[_0x84cd('0x36')](function(_0x47edc7){var _0x3eab90=_0x4ef4a0[_0x84cd('0x5c')]['get']({'plain':!![]});if(!_0x3eab90)throw new Error(_0x84cd('0x5d'));if(_0x3eab90[_0x84cd('0x5e')]===_0x84cd('0x5c')){var _0x50bcff=_0x47edc7[_0x84cd('0x37')]({'plain':!![]});var _0xbb7fa3='WhatsappAccounts';return db[_0x84cd('0x5f')][_0x84cd('0x59')]({'where':{'name':_0xbb7fa3,'userProfileId':_0x3eab90[_0x84cd('0x60')]},'raw':!![]})['then'](function(_0x531f18){if(_0x531f18&&_0x531f18[_0x84cd('0x61')]===0x0){return db[_0x84cd('0x39')][_0x84cd('0x5a')]({'name':_0x50bcff[_0x84cd('0x3c')],'resourceId':_0x50bcff['id'],'type':_0x531f18[_0x84cd('0x3c')],'sectionId':_0x531f18['id']},{})[_0x84cd('0x36')](function(){return _0x47edc7;});}else{return _0x47edc7;}})[_0x84cd('0x2a')](function(_0x57a762){logger[_0x84cd('0x25')](_0x84cd('0x62'),_0x57a762);throw _0x57a762;});}return _0x47edc7;})[_0x84cd('0x36')](respondWithResult(_0x541338,0xc9))['catch'](handleError(_0x541338,null));};exports[_0x84cd('0x63')]=function(_0x48ef6e,_0x37d425){if(_0x48ef6e[_0x84cd('0x5b')]['id']){delete _0x48ef6e[_0x84cd('0x5b')]['id'];}return db[_0x84cd('0x56')]['find']({'where':{'id':_0x48ef6e[_0x84cd('0x58')]['id']},'include':[{'model':db[_0x84cd('0x3f')],'as':_0x84cd('0x40')}]})[_0x84cd('0x36')](handleEntityNotFound(_0x37d425,null))[_0x84cd('0x36')](saveUpdates(_0x48ef6e[_0x84cd('0x5b')],null))[_0x84cd('0x36')](respondWithResult(_0x37d425,null))['catch'](handleError(_0x37d425,null));};exports[_0x84cd('0x35')]=function(_0x48abc7,_0x43aed0){return db[_0x84cd('0x56')][_0x84cd('0x59')]({'where':{'id':_0x48abc7[_0x84cd('0x58')]['id']}})[_0x84cd('0x36')](handleEntityNotFound(_0x43aed0,null))[_0x84cd('0x36')](removeEntity(_0x43aed0,null))[_0x84cd('0x2a')](handleError(_0x43aed0,null));};exports[_0x84cd('0x64')]=function(_0x55d625,_0x3ee06e){return db[_0x84cd('0x56')][_0x84cd('0x64')]()[_0x84cd('0x36')](respondWithResult(_0x3ee06e,null))[_0x84cd('0x2a')](handleError(_0x3ee06e,null));};exports[_0x84cd('0x65')]=function(_0x52e4e3,_0x1616f8,_0x17f4d9){if(_0x52e4e3[_0x84cd('0x5b')]['id']){delete _0x52e4e3[_0x84cd('0x5b')]['id'];}return db[_0x84cd('0x56')][_0x84cd('0x59')]({'where':{'id':_0x52e4e3[_0x84cd('0x58')]['id']}})[_0x84cd('0x36')](handleEntityNotFound(_0x1616f8,null))[_0x84cd('0x36')](function(_0xb7e586){if(_0xb7e586){_0x52e4e3[_0x84cd('0x5b')][_0x84cd('0x66')]=_0xb7e586['id'];return db[_0x84cd('0x67')]['create'](_0x52e4e3[_0x84cd('0x5b')]);}})[_0x84cd('0x36')](respondWithResult(_0x1616f8,null))[_0x84cd('0x2a')](handleError(_0x1616f8,null));};exports[_0x84cd('0x68')]=function(_0x13dd9d,_0x54a16b,_0x53aaa7){var _0x1303bf={'raw':![],'where':{}};var _0x25dc0c={};var _0x2468ce={'count':0x0,'rows':[]};return db[_0x84cd('0x56')][_0x84cd('0x69')]({'where':{'id':_0x13dd9d[_0x84cd('0x58')]['id']}})[_0x84cd('0x36')](handleEntityNotFound(_0x54a16b,null))['then'](function(_0x4e0eef){if(_0x4e0eef){_0x25dc0c[_0x84cd('0x45')]=_[_0x84cd('0x47')](db['Disposition'][_0x84cd('0x42')]);_0x25dc0c['query']=_[_0x84cd('0x47')](_0x13dd9d['query']);_0x25dc0c['filters']=_['intersection'](_0x25dc0c[_0x84cd('0x45')],_0x25dc0c['query']);_0x1303bf['attributes']=_[_0x84cd('0x49')](_0x25dc0c[_0x84cd('0x45')],qs['fields'](_0x13dd9d['query'][_0x84cd('0x4a')]));_0x1303bf[_0x84cd('0x48')]=_0x1303bf[_0x84cd('0x48')][_0x84cd('0x4b')]?_0x1303bf[_0x84cd('0x48')]:_0x25dc0c[_0x84cd('0x45')];if(!_0x13dd9d[_0x84cd('0x46')][_0x84cd('0x4c')]('nolimit')){_0x1303bf['limit']=qs['limit'](_0x13dd9d['query']['limit']);_0x1303bf['offset']=qs[_0x84cd('0x2e')](_0x13dd9d[_0x84cd('0x46')][_0x84cd('0x2e')]);}_0x1303bf[_0x84cd('0x4d')]=qs[_0x84cd('0x4e')](_0x13dd9d['query']['sort']);_0x1303bf[_0x84cd('0x4f')]=qs[_0x84cd('0x50')](_[_0x84cd('0x6a')](_0x13dd9d[_0x84cd('0x46')],_0x25dc0c['filters']));_0x1303bf[_0x84cd('0x4f')][_0x84cd('0x66')]=_0x4e0eef['id'];if(_0x13dd9d[_0x84cd('0x46')][_0x84cd('0x6b')]){_0x1303bf['where']=_[_0x84cd('0x51')](_0x1303bf[_0x84cd('0x4f')],{'$or':_[_0x84cd('0x41')](_0x1303bf[_0x84cd('0x48')],function(_0x34ed9d){var _0x41628f={};_0x41628f[_0x34ed9d]={'$like':'%'+_0x13dd9d[_0x84cd('0x46')][_0x84cd('0x6b')]+'%'};return _0x41628f;})});}_0x1303bf=_[_0x84cd('0x51')]({},_0x1303bf,_0x13dd9d[_0x84cd('0x53')]);return db[_0x84cd('0x67')][_0x84cd('0x31')]({'where':_0x1303bf[_0x84cd('0x4f')]})[_0x84cd('0x36')](function(_0x4b745e){_0x2468ce['count']=_0x4b745e;if(_0x13dd9d['query'][_0x84cd('0x54')]){_0x1303bf[_0x84cd('0x55')]=[{'all':!![]}];}return db[_0x84cd('0x67')][_0x84cd('0x6c')](_0x1303bf);})[_0x84cd('0x36')](function(_0x2a237e){_0x2468ce['rows']=_0x2a237e;return _0x2468ce;});}})[_0x84cd('0x36')](respondWithFilteredResult(_0x54a16b,_0x1303bf))[_0x84cd('0x2a')](handleError(_0x54a16b,null));};exports[_0x84cd('0x6d')]=function(_0x3198bb,_0x20f669,_0x50e206){return db[_0x84cd('0x56')][_0x84cd('0x59')]({'where':{'id':_0x3198bb[_0x84cd('0x58')]['id']}})[_0x84cd('0x36')](handleEntityNotFound(_0x20f669,null))[_0x84cd('0x36')](function(_0x2ab77e){if(_0x2ab77e){return _0x2ab77e[_0x84cd('0x6d')](_0x3198bb[_0x84cd('0x46')][_0x84cd('0x6e')]);}})['then'](respondWithStatusCode(_0x20f669,null))['catch'](handleError(_0x20f669,null));};exports[_0x84cd('0x6f')]=function(_0x382b9e,_0x40b0d5,_0x30ed87){if(_0x382b9e[_0x84cd('0x5b')]['id']){delete _0x382b9e[_0x84cd('0x5b')]['id'];}return db[_0x84cd('0x56')][_0x84cd('0x59')]({'where':{'id':_0x382b9e[_0x84cd('0x58')]['id']}})[_0x84cd('0x36')](handleEntityNotFound(_0x40b0d5,null))[_0x84cd('0x36')](function(_0xc0afa9){if(_0xc0afa9){_0x382b9e[_0x84cd('0x5b')]['WhatsappAccountId']=_0xc0afa9['id'];return db[_0x84cd('0x70')][_0x84cd('0x5a')](_0x382b9e['body']);}})[_0x84cd('0x36')](respondWithResult(_0x40b0d5,null))[_0x84cd('0x2a')](handleError(_0x40b0d5,null));};exports[_0x84cd('0x71')]=function(_0x5bea05,_0x148b61,_0x104deb){var _0x7ad6c0={'raw':![],'where':{}};var _0x325af0={};var _0x2c8d19={'count':0x0,'rows':[]};return db[_0x84cd('0x56')][_0x84cd('0x69')]({'where':{'id':_0x5bea05[_0x84cd('0x58')]['id']}})[_0x84cd('0x36')](handleEntityNotFound(_0x148b61,null))[_0x84cd('0x36')](function(_0x37a692){if(_0x37a692){_0x325af0['model']=_[_0x84cd('0x47')](db[_0x84cd('0x70')][_0x84cd('0x42')]);_0x325af0['query']=_[_0x84cd('0x47')](_0x5bea05[_0x84cd('0x46')]);_0x325af0[_0x84cd('0x50')]=_[_0x84cd('0x49')](_0x325af0[_0x84cd('0x45')],_0x325af0[_0x84cd('0x46')]);_0x7ad6c0['attributes']=_[_0x84cd('0x49')](_0x325af0[_0x84cd('0x45')],qs['fields'](_0x5bea05[_0x84cd('0x46')]['fields']));_0x7ad6c0['attributes']=_0x7ad6c0['attributes'][_0x84cd('0x4b')]?_0x7ad6c0[_0x84cd('0x48')]:_0x325af0[_0x84cd('0x45')];if(!_0x5bea05[_0x84cd('0x46')][_0x84cd('0x4c')](_0x84cd('0x72'))){_0x7ad6c0[_0x84cd('0x30')]=qs['limit'](_0x5bea05[_0x84cd('0x46')][_0x84cd('0x30')]);_0x7ad6c0['offset']=qs['offset'](_0x5bea05[_0x84cd('0x46')][_0x84cd('0x2e')]);}_0x7ad6c0[_0x84cd('0x4d')]=qs[_0x84cd('0x4e')](_0x5bea05[_0x84cd('0x46')][_0x84cd('0x4e')]);_0x7ad6c0['where']=qs[_0x84cd('0x50')](_[_0x84cd('0x6a')](_0x5bea05[_0x84cd('0x46')],_0x325af0[_0x84cd('0x50')]));_0x7ad6c0[_0x84cd('0x4f')][_0x84cd('0x66')]=_0x37a692['id'];if(_0x5bea05['query'][_0x84cd('0x6b')]){_0x7ad6c0[_0x84cd('0x4f')]=_[_0x84cd('0x51')](_0x7ad6c0[_0x84cd('0x4f')],{'$or':_[_0x84cd('0x41')](_0x7ad6c0[_0x84cd('0x48')],function(_0x1990f8){var _0x3d8cae={};_0x3d8cae[_0x1990f8]={'$like':'%'+_0x5bea05['query'][_0x84cd('0x6b')]+'%'};return _0x3d8cae;})});}_0x7ad6c0=_[_0x84cd('0x51')]({},_0x7ad6c0,_0x5bea05['options']);return db[_0x84cd('0x70')][_0x84cd('0x31')]({'where':_0x7ad6c0[_0x84cd('0x4f')]})[_0x84cd('0x36')](function(_0x545677){_0x2c8d19[_0x84cd('0x31')]=_0x545677;if(_0x5bea05[_0x84cd('0x46')][_0x84cd('0x54')]){_0x7ad6c0[_0x84cd('0x55')]=[{'all':!![]}];}return db['CannedAnswer']['findAll'](_0x7ad6c0);})[_0x84cd('0x36')](function(_0x3d8e4d){_0x2c8d19[_0x84cd('0x57')]=_0x3d8e4d;return _0x2c8d19;});}})[_0x84cd('0x36')](respondWithFilteredResult(_0x148b61,_0x7ad6c0))[_0x84cd('0x2a')](handleError(_0x148b61,null));};exports['removeAnswers']=function(_0xccc3b0,_0x2d2009,_0x4355ad){return db[_0x84cd('0x56')][_0x84cd('0x59')]({'where':{'id':_0xccc3b0[_0x84cd('0x58')]['id']}})[_0x84cd('0x36')](handleEntityNotFound(_0x2d2009,null))[_0x84cd('0x36')](function(_0x2bba91){if(_0x2bba91){return _0x2bba91[_0x84cd('0x73')](_0xccc3b0['query'][_0x84cd('0x6e')]);}})[_0x84cd('0x36')](respondWithStatusCode(_0x2d2009,null))[_0x84cd('0x2a')](handleError(_0x2d2009,null));};exports['addAgents']=function(_0x5e8894,_0x3ae72a,_0x2eed39){return db[_0x84cd('0x56')][_0x84cd('0x59')]({'where':{'id':_0x5e8894[_0x84cd('0x58')]['id']}})['then'](handleEntityNotFound(_0x3ae72a,null))[_0x84cd('0x36')](function(_0x5a57e7){if(_0x5a57e7){return _0x5a57e7['addAgents'](_0x5e8894[_0x84cd('0x5b')]['ids'],_['omit'](_0x5e8894[_0x84cd('0x5b')],[_0x84cd('0x6e'),'id'])||{})[_0x84cd('0x74')](function(_0xcf7d9d){for(var _0x35e88e=0x0;_0x35e88e<_0x5e8894[_0x84cd('0x5b')][_0x84cd('0x6e')]['length'];_0x35e88e+=0x1){socket[_0x84cd('0x75')](_0x84cd('0x76'),{'UserId':Number(_0x5e8894[_0x84cd('0x5b')][_0x84cd('0x6e')][_0x35e88e]),'WhatsappAccountId':Number(_0x5e8894[_0x84cd('0x58')]['id'])});}return _0xcf7d9d;});}})[_0x84cd('0x36')](respondWithResult(_0x3ae72a,null))[_0x84cd('0x2a')](handleError(_0x3ae72a,null));};exports[_0x84cd('0x77')]=function(_0x1ba009,_0x2f5030,_0x4606ef){return db[_0x84cd('0x56')][_0x84cd('0x59')]({'where':{'id':_0x1ba009[_0x84cd('0x58')]['id']}})[_0x84cd('0x36')](handleEntityNotFound(_0x2f5030,null))[_0x84cd('0x36')](function(_0x39c701){if(_0x39c701){return _0x39c701['removeAgents'](_0x1ba009[_0x84cd('0x46')][_0x84cd('0x6e')])[_0x84cd('0x36')](function(){if(_[_0x84cd('0x78')](_0x1ba009[_0x84cd('0x46')][_0x84cd('0x6e')])){for(var _0x37dde6=0x0;_0x37dde6<_0x1ba009[_0x84cd('0x46')]['ids'][_0x84cd('0x4b')];_0x37dde6+=0x1){socket['emit'](_0x84cd('0x79'),{'UserId':Number(_0x1ba009[_0x84cd('0x46')][_0x84cd('0x6e')][_0x37dde6]),'WhatsappAccountId':Number(_0x1ba009[_0x84cd('0x58')]['id'])});}}else{socket[_0x84cd('0x75')](_0x84cd('0x79'),{'UserId':Number(_0x1ba009['query'][_0x84cd('0x6e')]),'WhatsappAccountId':Number(_0x1ba009[_0x84cd('0x58')]['id'])});}});}})[_0x84cd('0x36')](respondWithStatusCode(_0x2f5030,null))[_0x84cd('0x2a')](handleError(_0x2f5030,null));};exports[_0x84cd('0x7a')]=function(_0x32c952,_0x4c17de,_0x2ab93){var _0x4005ce={};var _0x3f5097={};var _0x775693;var _0x160b9a;return db[_0x84cd('0x56')][_0x84cd('0x69')]({'where':{'id':_0x32c952['params']['id']}})[_0x84cd('0x36')](handleEntityNotFound(_0x4c17de,null))[_0x84cd('0x36')](function(_0xaa59b){if(_0xaa59b){_0x775693=_0xaa59b;_0x3f5097[_0x84cd('0x45')]=_[_0x84cd('0x47')](db['User'][_0x84cd('0x42')]);_0x3f5097[_0x84cd('0x46')]=_[_0x84cd('0x47')](_0x32c952[_0x84cd('0x46')]);_0x3f5097[_0x84cd('0x50')]=_[_0x84cd('0x49')](_0x3f5097['model'],_0x3f5097[_0x84cd('0x46')]);_0x4005ce['attributes']=_[_0x84cd('0x49')](_0x3f5097[_0x84cd('0x45')],qs[_0x84cd('0x4a')](_0x32c952[_0x84cd('0x46')][_0x84cd('0x4a')]));_0x4005ce['attributes']=_0x4005ce[_0x84cd('0x48')][_0x84cd('0x4b')]?_0x4005ce[_0x84cd('0x48')]:_0x3f5097['model'];_0x4005ce[_0x84cd('0x4d')]=qs['sort'](_0x32c952['query'][_0x84cd('0x4e')]);_0x4005ce[_0x84cd('0x4f')]=qs[_0x84cd('0x50')](_['pick'](_0x32c952[_0x84cd('0x46')],_0x3f5097[_0x84cd('0x50')]));if(_0x32c952['query'][_0x84cd('0x6b')]){_0x4005ce['where']=_[_0x84cd('0x51')](_0x4005ce['where'],{'$or':_[_0x84cd('0x41')](_0x4005ce[_0x84cd('0x48')],function(_0x34776c){var _0x3f7f43={};_0x3f7f43[_0x34776c]={'$like':'%'+_0x32c952[_0x84cd('0x46')][_0x84cd('0x6b')]+'%'};return _0x3f7f43;})});}_0x4005ce=_[_0x84cd('0x51')]({},_0x4005ce,_0x32c952[_0x84cd('0x53')]);return _0x775693['getAgents'](_0x4005ce);}})['then'](function(_0x1cbd22){if(_0x1cbd22){_0x160b9a=_0x1cbd22['length'];if(!_0x32c952['query'][_0x84cd('0x4c')]('nolimit')){_0x4005ce['limit']=qs[_0x84cd('0x30')](_0x32c952[_0x84cd('0x46')][_0x84cd('0x30')]);_0x4005ce[_0x84cd('0x2e')]=qs[_0x84cd('0x2e')](_0x32c952[_0x84cd('0x46')][_0x84cd('0x2e')]);}return _0x775693[_0x84cd('0x7a')](_0x4005ce);}})[_0x84cd('0x36')](function(_0x329ba4){if(_0x329ba4){return _0x329ba4?{'count':_0x160b9a,'rows':_0x329ba4}:null;}})['then'](respondWithResult(_0x4c17de,null))[_0x84cd('0x2a')](handleError(_0x4c17de,null));};exports[_0x84cd('0x7b')]=function(_0x25187f,_0x1ac230,_0x11c81e){return db[_0x84cd('0x56')][_0x84cd('0x69')]({'where':{'id':_0x25187f['params']['id']}})[_0x84cd('0x36')](handleEntityNotFound(_0x1ac230,null))[_0x84cd('0x36')](function(_0x3950f6){if(_0x3950f6){return db[_0x84cd('0x7c')][_0x84cd('0x7d')](function(_0x556f37){return db[_0x84cd('0x7e')][_0x84cd('0x35')]({'where':{'WhatsappAccountId':_0x25187f['params']['id']},'transaction':_0x556f37})[_0x84cd('0x36')](function(_0x23433c){var _0x2060f5=_[_0x84cd('0x41')](_0x25187f[_0x84cd('0x5b')],function(_0x305137){_0x305137['WhatsappAccountId']=_0x25187f[_0x84cd('0x58')]['id'];return _0x305137;});return db[_0x84cd('0x7e')]['bulkCreate'](_0x2060f5,{'transaction':_0x556f37});});})['then'](function(){return db['WhatsappApplication']['findAndCountAll']({'where':{'WhatsappAccountId':_0x25187f['params']['id']},'order':'priority'});});}})['then'](respondWithResult(_0x1ac230,null))[_0x84cd('0x2a')](handleError(_0x1ac230,null));};exports[_0x84cd('0x7f')]=function(_0x563c3c,_0x42a8e8,_0x4a9fd0){var _0x129490={};var _0x4c5e0a={};var _0x4903a6;var _0x208b93;return db[_0x84cd('0x56')][_0x84cd('0x69')]({'where':{'id':_0x563c3c['params']['id']}})[_0x84cd('0x36')](handleEntityNotFound(_0x42a8e8,null))[_0x84cd('0x36')](function(_0x4366c5){if(_0x4366c5){_0x4903a6=_0x4366c5;_0x4c5e0a[_0x84cd('0x45')]=_['keys'](db[_0x84cd('0x7e')]['rawAttributes']);_0x4c5e0a[_0x84cd('0x46')]=_[_0x84cd('0x47')](_0x563c3c['query']);_0x4c5e0a[_0x84cd('0x50')]=_[_0x84cd('0x49')](_0x4c5e0a['model'],_0x4c5e0a['query']);_0x129490[_0x84cd('0x48')]=_[_0x84cd('0x49')](_0x4c5e0a[_0x84cd('0x45')],qs[_0x84cd('0x4a')](_0x563c3c['query'][_0x84cd('0x4a')]));_0x129490[_0x84cd('0x48')]=_0x129490[_0x84cd('0x48')][_0x84cd('0x4b')]?_0x129490[_0x84cd('0x48')]:_0x4c5e0a[_0x84cd('0x45')];_0x129490[_0x84cd('0x4d')]=qs[_0x84cd('0x4e')](_0x563c3c[_0x84cd('0x46')][_0x84cd('0x4e')]);_0x129490[_0x84cd('0x4f')]=qs[_0x84cd('0x50')](_[_0x84cd('0x6a')](_0x563c3c[_0x84cd('0x46')],_0x4c5e0a[_0x84cd('0x50')]));if(_0x563c3c[_0x84cd('0x46')][_0x84cd('0x6b')]){_0x129490[_0x84cd('0x4f')]=_[_0x84cd('0x51')](_0x129490[_0x84cd('0x4f')],{'$or':_[_0x84cd('0x41')](_0x129490['attributes'],function(_0x4a22b3){var _0x1547ba={};_0x1547ba[_0x4a22b3]={'$like':'%'+_0x563c3c[_0x84cd('0x46')]['filter']+'%'};return _0x1547ba;})});}_0x129490=_['merge']({},_0x129490,_0x563c3c[_0x84cd('0x53')]);return _0x4903a6[_0x84cd('0x7f')](_0x129490);}})['then'](function(_0x21b419){if(_0x21b419){_0x208b93=_0x21b419[_0x84cd('0x4b')];if(!_0x563c3c[_0x84cd('0x46')]['hasOwnProperty'](_0x84cd('0x72'))){_0x129490['limit']=qs['limit'](_0x563c3c[_0x84cd('0x46')][_0x84cd('0x30')]);_0x129490['offset']=qs[_0x84cd('0x2e')](_0x563c3c[_0x84cd('0x46')][_0x84cd('0x2e')]);}return _0x4903a6[_0x84cd('0x7f')](_0x129490);}})[_0x84cd('0x36')](function(_0x1f49e8){if(_0x1f49e8){return _0x1f49e8?{'count':_0x208b93,'rows':_0x1f49e8}:null;}})[_0x84cd('0x36')](respondWithResult(_0x42a8e8,null))['catch'](handleError(_0x42a8e8,null));};exports[_0x84cd('0x80')]=function(_0x290fa5,_0x370501,_0x5290b8){var _0x4f519e={'channel':_0x84cd('0x81')};var _0x429225=[];var _0x145a12=[];var _0x3e4ce0={};return db['WhatsappAccount'][_0x84cd('0x59')]({'where':{'id':_0x290fa5[_0x84cd('0x58')]['id']},'include':[{'model':db[_0x84cd('0x7e')],'as':'Applications'}]})['then'](handleEntityNotFound(_0x370501,null))['then'](function(_0x45f606){_0x4f519e['account']=_0x45f606;_0x4f519e[_0x84cd('0x82')]=_['orderBy'](_0x45f606[_0x84cd('0x83')],[_0x84cd('0x84')],['asc']);if(_0x4f519e[_0x84cd('0x85')][_0x84cd('0x83')]){delete _0x4f519e[_0x84cd('0x85')][_0x84cd('0x83')];}return db[_0x84cd('0x86')]['describe']();})['then'](function(_0x3edcc7){if(!_0x3edcc7){throw new db[(_0x84cd('0x87'))][(_0x84cd('0x88'))](_0x84cd('0x89'));}_0x429225=_[_0x84cd('0x8a')](_[_0x84cd('0x47')](_0x3edcc7),[_0x84cd('0x8b'),'updatedAt']);_0x145a12=_[_0x84cd('0x8a')](_[_0x84cd('0x47')](_0x3edcc7),['createdAt','updatedAt',_0x84cd('0x8c'),_0x84cd('0x8d')]);_0x4f519e['body']={'mapKey':'mobile'};if(_0x4f519e[_0x84cd('0x85')][_0x84cd('0x52')]&&_0x4f519e[_0x84cd('0x85')][_0x84cd('0x52')]===_0x84cd('0x8e')){_0x4f519e[_0x84cd('0x5b')][_0x84cd('0x8f')]=_0x290fa5[_0x84cd('0x5b')]['From'][_0x84cd('0x90')]('whatsapp:','');_0x4f519e['body'][_0x84cd('0x5b')]=_0x290fa5[_0x84cd('0x5b')]['Body'];_0x4f519e['body'][_0x84cd('0x91')]=_0x290fa5['body'][_0x84cd('0x92')];}if(_0x4f519e[_0x84cd('0x5b')]['id']){delete _0x4f519e[_0x84cd('0x5b')]['id'];}if(_[_0x84cd('0x93')](_0x4f519e[_0x84cd('0x5b')][_0x84cd('0x8f')])){throw new db[(_0x84cd('0x87'))][(_0x84cd('0x88'))](_0x84cd('0x94'));}if(_['isNil'](_0x4f519e[_0x84cd('0x5b')][_0x84cd('0x5b')])||_0x4f519e[_0x84cd('0x5b')][_0x84cd('0x5b')]===''){throw new db[(_0x84cd('0x87'))]['ValidationError'](_0x84cd('0x95'));}if(_[_0x84cd('0x93')](_0x4f519e[_0x84cd('0x5b')][_0x84cd('0x96')])){throw new db[(_0x84cd('0x87'))][(_0x84cd('0x88'))](_0x84cd('0x97')+_0x145a12);}if(!_[_0x84cd('0x98')](_0x145a12,_0x4f519e['body'][_0x84cd('0x96')])){throw new db[(_0x84cd('0x87'))][(_0x84cd('0x88'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x145a12);}_0x3e4ce0[_0x4f519e[_0x84cd('0x5b')][_0x84cd('0x96')]]=_0x4f519e[_0x84cd('0x5b')][_0x84cd('0x8f')];return db[_0x84cd('0x99')][_0x84cd('0x59')]({'where':{'id':_0x4f519e[_0x84cd('0x85')][_0x84cd('0x8d')]},'include':[{'model':db['CmContact'],'as':_0x84cd('0x9a'),'where':_0x3e4ce0,'limit':0x1,'order':[['updatedAt',_0x84cd('0x9b')]]}]});})['then'](handleEntityNotFound(_0x370501,null))[_0x84cd('0x36')](function(_0x19bba5){if(_0x19bba5){_0x4f519e[_0x84cd('0x9c')]=_[_0x84cd('0x9d')](_0x19bba5,[_0x84cd('0x9a')]);if(_0x19bba5[_0x84cd('0x9a')][_0x84cd('0x4b')]){return _0x19bba5['Contacts'][0x0];}var _0x370a5e=_['defaults'](_0x4f519e[_0x84cd('0x5b')],{'firstName':_0x4f519e[_0x84cd('0x5b')][_0x84cd('0x8f')],'ListId':_0x19bba5['id']});_0x370a5e[_0x4f519e['body'][_0x84cd('0x96')]]=_0x4f519e[_0x84cd('0x5b')][_0x84cd('0x8f')];return db['CmContact']['create'](_0x370a5e,{'fields':_0x429225,'raw':!![]});}})['then'](handleEntityNotFound(_0x370501,null))[_0x84cd('0x36')](function(_0x2b87c3){if(_0x2b87c3){_0x4f519e[_0x84cd('0x9e')]=_0x2b87c3;var _0x39be48={'ContactId':_0x2b87c3['id'],'phone':_0x4f519e['body'][_0x84cd('0x8f')],'WhatsappAccountId':_0x290fa5[_0x84cd('0x58')]['id']};var _0x46ae1b={'ContactId':_0x2b87c3['id'],'WhatsappAccountId':_0x290fa5[_0x84cd('0x58')]['id'],'closed':![]};return db[_0x84cd('0x9f')][_0x84cd('0x59')]({'where':_0x46ae1b})[_0x84cd('0x36')](function(_0x55e7c8){if(_0x55e7c8){return[_0x55e7c8,![]];}return db[_0x84cd('0x9f')][_0x84cd('0x5a')](_0x39be48)[_0x84cd('0x36')](function(_0x57638b){return[_0x57638b,!![]];});});}})['spread'](function(_0x4353b9,_0x4cee29){_0x4f519e['interaction']=_0x4353b9[_0x84cd('0x37')]({'plain':!![]});_0x4f519e[_0x84cd('0xa0')][_0x84cd('0xa1')]=![];if(_0x4cee29){if(_0x4f519e[_0x84cd('0x85')][_0x84cd('0xa2')]){_0x4f519e[_0x84cd('0x82')]['push']({'id':0x0,'priority':_0x4f519e[_0x84cd('0x82')][_0x84cd('0x4b')]+0x1,'app':_0x84cd('0xa3'),'appdata':'unmanaged','interval':_0x84cd('0xa4')});}_0x4f519e[_0x84cd('0xa0')][_0x84cd('0xa1')]=!![];}return db[_0x84cd('0xa5')][_0x84cd('0x5a')]({'phone':_0x4f519e[_0x84cd('0x5b')][_0x84cd('0x8f')],'messageId':_0x4f519e[_0x84cd('0x5b')][_0x84cd('0x91')],'body':_0x4f519e[_0x84cd('0x5b')]['body'],'WhatsappAccountId':_0x290fa5[_0x84cd('0x58')]['id'],'WhatsappInteractionId':_0x4353b9['id'],'direction':'in','ContactId':_0x4353b9['ContactId'],'AttachmentId':_0x4f519e[_0x84cd('0x5b')]['AttachmentId']});})[_0x84cd('0x36')](function(_0x33abbf){_0x4f519e[_0x84cd('0x27')]=_0x33abbf;if(_0x4f519e['interaction'][_0x84cd('0xa6')]){return db['User']['find']({'attributes':['id',_0x84cd('0x3c')],'where':{'id':_0x4f519e[_0x84cd('0xa0')][_0x84cd('0xa6')]}})[_0x84cd('0x36')](function(_0x16e2ab){if(_0x16e2ab){_0x4f519e[_0x84cd('0x82')][_0x84cd('0xa7')]({'id':0x0,'priority':0x0,'app':_0x84cd('0xa8'),'appdata':_0x16e2ab[_0x84cd('0x3c')]+','+(_0x4f519e[_0x84cd('0x85')][_0x84cd('0xa9')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x84cd('0xaa'),_0x84cd('0xab'),_0x4f519e);});}return respondWithRpcPromise(_0x84cd('0xaa'),_0x84cd('0xab'),_0x4f519e);})['then'](function(_0x6ec1a){if(_0x6ec1a){var _0x3b215a=0xc8;var _0x4842f5=_0x84cd('0xac');logger[_0x84cd('0x28')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x4842f5,_0x3b215a,_0x84cd('0xad'));logger[_0x84cd('0xae')](_0x84cd('0xaf'),_0x4842f5,_0x3b215a,_0x84cd('0xad'),JSON[_0x84cd('0xb0')](_0x6ec1a));if(_0x4f519e[_0x84cd('0x85')][_0x84cd('0x52')]===_0x84cd('0x8e')){return _0x370501[_0x84cd('0x2c')](_0x3b215a)[_0x84cd('0x32')](_0x84cd('0xb1'),_0x84cd('0xb2'))[_0x84cd('0x3d')](_0x84cd('0xb3'));}else{return _0x370501[_0x84cd('0x2c')](_0x3b215a)[_0x84cd('0x2d')](_0x6ec1a);}}})[_0x84cd('0x2a')](handleError(_0x370501,null));};exports[_0x84cd('0x3d')]=function(_0x7e3779,_0xec0ca3,_0x4b7676){var _0x308033,_0xbdb518,_0x163b6a;if(_['isNil'](_0x7e3779[_0x84cd('0x5b')][_0x84cd('0x5b')])||_0x7e3779[_0x84cd('0x5b')]['body']===''){throw new db['Sequelize'][(_0x84cd('0x88'))](_0x84cd('0x95'));}if(_[_0x84cd('0x93')](_0x7e3779['body']['to'])){throw new db[(_0x84cd('0x87'))]['ValidationError'](_0x84cd('0xb4'));}_0x308033=_0x7e3779[_0x84cd('0x5b')]['to'];return db[_0x84cd('0x56')][_0x84cd('0x59')]({'where':{'id':_0x7e3779[_0x84cd('0x58')]['id']},'include':[{'model':db[_0x84cd('0x99')],'as':_0x84cd('0xb5'),'include':[{'model':db[_0x84cd('0x86')],'as':'Contacts','where':{'mobile':_0x308033},'limit':0x1,'order':[[_0x84cd('0xb6'),'DESC']]}]}]})['then'](handleEntityNotFound(_0xec0ca3,null))['then'](function(_0x3e1e69){if(_0x3e1e69&&_0x3e1e69[_0x84cd('0xb5')]){_0xbdb518=_0x3e1e69['get']({'plain':!![]});if(_0xbdb518[_0x84cd('0xb5')]&&_0xbdb518[_0x84cd('0xb5')][_0x84cd('0x9a')][_0x84cd('0x4b')]){return _0xbdb518[_0x84cd('0xb5')]['Contacts'][0x0];}return db['CmContact']['create'](_['defaults'](_0x7e3779[_0x84cd('0x5b')],{'firstName':_0x308033,'mobile':_0x308033,'phone':_0x308033,'ListId':_0xbdb518[_0x84cd('0x8d')]}));}})[_0x84cd('0x36')](handleEntityNotFound(_0xec0ca3,null))[_0x84cd('0x36')](function(_0x16b7d2){if(_0x16b7d2){_0x163b6a=_0x16b7d2;return db[_0x84cd('0x9f')][_0x84cd('0x59')]({'where':{'ContactId':_0x163b6a['id'],'closed':![],'WhatsappAccountId':_0xbdb518['id']}})[_0x84cd('0x36')](function(_0x50c458){if(_0x50c458){return[_0x50c458,![]];}return db['WhatsappInteraction'][_0x84cd('0x5a')]({'UserId':_0x7e3779[_0x84cd('0x5c')]['id'],'ContactId':_0x163b6a['id'],'WhatsappAccountId':_0xbdb518['id'],'phone':_0x308033,'firstMsgDirection':_0x84cd('0xb7'),'Messages':[_['merge'](_0x7e3779['body'],{'read':![],'body':_0x7e3779[_0x84cd('0x5b')][_0x84cd('0x5b')],'phone':_0x308033,'WhatsappAccountId':_0xbdb518['id'],'UserId':_0x7e3779[_0x84cd('0x5c')]['id'],'ContactId':_0x163b6a['id']})]},{'include':[{'model':db[_0x84cd('0xa5')],'as':_0x84cd('0xb8')}]})[_0x84cd('0x36')](function(_0xb8aac2){return[_0xb8aac2,!![]];});});}})[_0x84cd('0x74')](function(_0x119763,_0x5e17bd){if(_0x5e17bd){return _0x119763;}return db['WhatsappMessage'][_0x84cd('0x5a')](_[_0x84cd('0x51')](_0x7e3779['body'],{'read':![],'body':_0x7e3779[_0x84cd('0x5b')][_0x84cd('0x5b')],'phone':_0x308033,'WhatsappAccountId':_0xbdb518['id'],'WhatsappInteractionId':_0x119763['id'],'UserId':_0x7e3779['user']['id'],'ContactId':_0x163b6a['id']}))[_0x84cd('0x36')](function(_0x1dd38e){_0x119763[_0x84cd('0xb9')]['Messages']=[];_0x119763['dataValues'][_0x84cd('0xb8')]['push'](_0x1dd38e[_0x84cd('0xb9')]);return _0x119763;});})['then'](respondWithResult(_0xec0ca3,null))[_0x84cd('0x2a')](handleError(_0xec0ca3,null));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.events.js b/server/api/whatsappAccount/whatsappAccount.events.js index 24fcf51..0ab587e 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 _0x25af=['../../mysqldb','WhatsappAccount','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x50745e,_0x4722a9){var _0x17886c=function(_0x49a8e9){while(--_0x49a8e9){_0x50745e['push'](_0x50745e['shift']());}};_0x17886c(++_0x4722a9);}(_0x25af,0x11d));var _0xf25a=function(_0x14c264,_0x43f982){_0x14c264=_0x14c264-0x0;var _0xe1519c=_0x25af[_0x14c264];return _0xe1519c;};'use strict';var EventEmitter=require(_0xf25a('0x0'));var WhatsappAccount=require(_0xf25a('0x1'))['db'][_0xf25a('0x2')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0xf25a('0x3')](0x0);var events={'afterCreate':_0xf25a('0x4'),'afterUpdate':_0xf25a('0x5'),'afterDestroy':_0xf25a('0x6')};function emitEvent(_0x5f055a){return function(_0x5cd475,_0x791411,_0x250ae9){WhatsappAccountEvents[_0xf25a('0x7')](_0x5f055a+':'+_0x5cd475['id'],_0x5cd475);WhatsappAccountEvents['emit'](_0x5f055a,_0x5cd475);_0x250ae9(null);};}for(var e in events){if(events[_0xf25a('0x8')](e)){var event=events[e];WhatsappAccount[_0xf25a('0x9')](e,emitEvent(event));}}module[_0xf25a('0xa')]=WhatsappAccountEvents; \ No newline at end of file +var _0xfe63=['exports','../../mysqldb','setMaxListeners','update','remove','emit','hasOwnProperty','hook'];(function(_0x1bd3ab,_0x352c42){var _0x37e394=function(_0x2f581d){while(--_0x2f581d){_0x1bd3ab['push'](_0x1bd3ab['shift']());}};_0x37e394(++_0x352c42);}(_0xfe63,0x181));var _0x3fe6=function(_0x7e2eb0,_0x17cd58){_0x7e2eb0=_0x7e2eb0-0x0;var _0xd92de4=_0xfe63[_0x7e2eb0];return _0xd92de4;};'use strict';var EventEmitter=require('events');var WhatsappAccount=require(_0x3fe6('0x0'))['db']['WhatsappAccount'];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0x3fe6('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0x3fe6('0x2'),'afterDestroy':_0x3fe6('0x3')};function emitEvent(_0x388bfd){return function(_0xfc4ef5,_0x17dfa2,_0x134b09){WhatsappAccountEvents[_0x3fe6('0x4')](_0x388bfd+':'+_0xfc4ef5['id'],_0xfc4ef5);WhatsappAccountEvents['emit'](_0x388bfd,_0xfc4ef5);_0x134b09(null);};}for(var e in events){if(events[_0x3fe6('0x5')](e)){var event=events[e];WhatsappAccount[_0x3fe6('0x6')](e,emitEvent(event));}}module[_0x3fe6('0x7')]=WhatsappAccountEvents; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.model.js b/server/api/whatsappAccount/whatsappAccount.model.js index 81c78ee..fa8badb 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 _0xc6af=['../../config/environment','./whatsappAccount.attributes','exports','WhatsappAccount','whatsapp_accounts','lodash','util','api','moment','bluebird','request-promise','rimraf'];(function(_0x39da4a,_0x936a2c){var _0x478f8f=function(_0x44dea9){while(--_0x44dea9){_0x39da4a['push'](_0x39da4a['shift']());}};_0x478f8f(++_0x936a2c);}(_0xc6af,0xe9));var _0xfc6a=function(_0x32234e,_0x2391c4){_0x32234e=_0x32234e-0x0;var _0x558436=_0xc6af[_0x32234e];return _0x558436;};'use strict';var _=require(_0xfc6a('0x0'));var util=require(_0xfc6a('0x1'));var logger=require('../../config/logger')(_0xfc6a('0x2'));var moment=require(_0xfc6a('0x3'));var BPromise=require(_0xfc6a('0x4'));var rp=require(_0xfc6a('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xfc6a('0x6'));var config=require(_0xfc6a('0x7'));var attributes=require(_0xfc6a('0x8'));module[_0xfc6a('0x9')]=function(_0xaa57d4,_0x470b05){return _0xaa57d4['define'](_0xfc6a('0xa'),attributes,{'tableName':_0xfc6a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7bdf=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappAccount.attributes','exports','whatsapp_accounts','lodash','util','../../config/logger'];(function(_0x168127,_0x59cea1){var _0x4c99ad=function(_0x4ab3f2){while(--_0x4ab3f2){_0x168127['push'](_0x168127['shift']());}};_0x4c99ad(++_0x59cea1);}(_0x7bdf,0xa6));var _0xf7bd=function(_0x160ffb,_0x253293){_0x160ffb=_0x160ffb-0x0;var _0x15b530=_0x7bdf[_0x160ffb];return _0x15b530;};'use strict';var _=require(_0xf7bd('0x0'));var util=require(_0xf7bd('0x1'));var logger=require(_0xf7bd('0x2'))(_0xf7bd('0x3'));var moment=require(_0xf7bd('0x4'));var BPromise=require(_0xf7bd('0x5'));var rp=require(_0xf7bd('0x6'));var fs=require('fs');var path=require(_0xf7bd('0x7'));var rimraf=require(_0xf7bd('0x8'));var config=require(_0xf7bd('0x9'));var attributes=require(_0xf7bd('0xa'));module[_0xf7bd('0xb')]=function(_0x144306,_0x5f47a5){return _0x144306['define']('WhatsappAccount',attributes,{'tableName':_0xf7bd('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.rpc.js b/server/api/whatsappAccount/whatsappAccount.rpc.js index 10fcb46..891983d 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 _0x0f2a=['options','where','attributes','include','map','model','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','redis','localhost','./whatsappAccount.socket','register','then','info','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','WhatsappAccount,\x20%s,\x20%s','message','result','catch','ShowWhatsappAccount','WhatsappAccount','find'];(function(_0x48fde6,_0x25872f){var _0x4f22a4=function(_0x5b7125){while(--_0x5b7125){_0x48fde6['push'](_0x48fde6['shift']());}};_0x4f22a4(++_0x25872f);}(_0x0f2a,0x12e));var _0xa0f2=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x0f2a[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0xa0f2('0x0'));var util=require(_0xa0f2('0x1'));var moment=require(_0xa0f2('0x2'));var BPromise=require(_0xa0f2('0x3'));var rs=require(_0xa0f2('0x4'));var fs=require('fs');var Redis=require(_0xa0f2('0x5'));var db=require(_0xa0f2('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xa0f2('0x7'))(_0xa0f2('0x8'));var config=require(_0xa0f2('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xa0f2('0xa')][_0xa0f2('0xb')]({'port':0x232a});config['redis']=_['defaults'](config[_0xa0f2('0xc')],{'host':_0xa0f2('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa0f2('0xc')]));require(_0xa0f2('0xe'))[_0xa0f2('0xf')](socket);function respondWithRpcPromise(_0x837566,_0x2234ba,_0x24032d){return new BPromise(function(_0x179249,_0x197935){return client['request'](_0x837566,_0x24032d)[_0xa0f2('0x10')](function(_0x144675){logger[_0xa0f2('0x11')]('WhatsappAccount,\x20%s,\x20%s',_0x2234ba,_0xa0f2('0x12'));logger[_0xa0f2('0x13')](_0xa0f2('0x14'),_0x2234ba,_0xa0f2('0x12'),JSON[_0xa0f2('0x15')](_0x144675));if(_0x144675[_0xa0f2('0x16')]){if(_0x144675['error'][_0xa0f2('0x17')]===0x1f4){logger[_0xa0f2('0x16')](_0xa0f2('0x18'),_0x2234ba,_0x144675[_0xa0f2('0x16')]['message']);return _0x197935(_0x144675[_0xa0f2('0x16')][_0xa0f2('0x19')]);}logger[_0xa0f2('0x16')](_0xa0f2('0x18'),_0x2234ba,_0x144675['error'][_0xa0f2('0x19')]);return _0x179249(_0x144675[_0xa0f2('0x16')]['message']);}else{logger[_0xa0f2('0x11')](_0xa0f2('0x18'),_0x2234ba,'request\x20sent');_0x179249(_0x144675[_0xa0f2('0x1a')][_0xa0f2('0x19')]);}})[_0xa0f2('0x1b')](function(_0x39e262){logger[_0xa0f2('0x16')](_0xa0f2('0x18'),_0x2234ba,_0x39e262);_0x197935(_0x39e262);});});}exports[_0xa0f2('0x1c')]=function(_0x1017fb){var _0x12badd=this;return new Promise(function(_0x4a62f5,_0x263802){return db[_0xa0f2('0x1d')][_0xa0f2('0x1e')]({'raw':_0x1017fb['options']?_0x1017fb[_0xa0f2('0x1f')]['raw']===undefined?!![]:![]:!![],'where':_0x1017fb[_0xa0f2('0x1f')]?_0x1017fb['options'][_0xa0f2('0x20')]||null:null,'attributes':_0x1017fb[_0xa0f2('0x1f')]?_0x1017fb[_0xa0f2('0x1f')][_0xa0f2('0x21')]||null:null,'include':_0x1017fb[_0xa0f2('0x1f')]?_0x1017fb['options'][_0xa0f2('0x22')]?_[_0xa0f2('0x23')](_0x1017fb[_0xa0f2('0x1f')][_0xa0f2('0x22')],function(_0x9cc128){return{'model':db[_0x9cc128[_0xa0f2('0x24')]],'as':_0x9cc128['as'],'attributes':_0x9cc128[_0xa0f2('0x21')],'include':_0x9cc128[_0xa0f2('0x22')]?_[_0xa0f2('0x23')](_0x9cc128['include'],function(_0x8faba9){return{'model':db[_0x8faba9[_0xa0f2('0x24')]],'as':_0x8faba9['as'],'attributes':_0x8faba9[_0xa0f2('0x21')],'include':_0x8faba9[_0xa0f2('0x22')]?_['map'](_0x8faba9[_0xa0f2('0x22')],function(_0x529cdb){return{'model':db[_0x529cdb[_0xa0f2('0x24')]],'as':_0x529cdb['as'],'attributes':_0x529cdb[_0xa0f2('0x21')]};}):[]};}):[]};}):[]:[]})[_0xa0f2('0x10')](function(_0x4b8005){logger['info'](_0xa0f2('0x1c'),_0x1017fb);logger[_0xa0f2('0x13')](_0xa0f2('0x1c'),_0x1017fb,JSON[_0xa0f2('0x15')](_0x4b8005));_0x4a62f5(_0x4b8005);})[_0xa0f2('0x1b')](function(_0xb2458d){logger[_0xa0f2('0x16')](_0xa0f2('0x1c'),_0xb2458d['message'],_0x1017fb);_0x263802(_0x12badd['error'](0x1f4,_0xb2458d[_0xa0f2('0x19')]));});});}; \ No newline at end of file +var _0x30ca=['catch','util','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','defaults','redis','socket.io-emitter','./whatsappAccount.socket','register','request','then','WhatsappAccount,\x20%s,\x20%s','request\x20sent','error','message','result','ShowWhatsappAccount','WhatsappAccount','options','where','attributes','include','map','model','info','debug','stringify'];(function(_0xb347b9,_0x3c4105){var _0x40091b=function(_0x48b57e){while(--_0x48b57e){_0xb347b9['push'](_0xb347b9['shift']());}};_0x40091b(++_0x3c4105);}(_0x30ca,0xda));var _0xa30c=function(_0x4eb00a,_0x264758){_0x4eb00a=_0x4eb00a-0x0;var _0x5570b3=_0x30ca[_0x4eb00a];return _0x5570b3;};'use strict';var _=require('lodash');var util=require(_0xa30c('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa30c('0x1'))['db'];var utils=require('../../config/utils');var logger=require(_0xa30c('0x2'))(_0xa30c('0x3'));var config=require(_0xa30c('0x4'));var jayson=require(_0xa30c('0x5'));var client=jayson[_0xa30c('0x6')]['http']({'port':0x232a});config['redis']=_[_0xa30c('0x7')](config[_0xa30c('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0xa30c('0x9'))(new Redis(config[_0xa30c('0x8')]));require(_0xa30c('0xa'))[_0xa30c('0xb')](socket);function respondWithRpcPromise(_0x4d1ffd,_0x2279ca,_0x224348){return new BPromise(function(_0x57e65e,_0x360964){return client[_0xa30c('0xc')](_0x4d1ffd,_0x224348)[_0xa30c('0xd')](function(_0x47b0fa){logger['info'](_0xa30c('0xe'),_0x2279ca,_0xa30c('0xf'));logger['debug']('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x2279ca,_0xa30c('0xf'),JSON['stringify'](_0x47b0fa));if(_0x47b0fa[_0xa30c('0x10')]){if(_0x47b0fa[_0xa30c('0x10')]['code']===0x1f4){logger[_0xa30c('0x10')](_0xa30c('0xe'),_0x2279ca,_0x47b0fa[_0xa30c('0x10')]['message']);return _0x360964(_0x47b0fa[_0xa30c('0x10')]['message']);}logger[_0xa30c('0x10')]('WhatsappAccount,\x20%s,\x20%s',_0x2279ca,_0x47b0fa[_0xa30c('0x10')]['message']);return _0x57e65e(_0x47b0fa['error'][_0xa30c('0x11')]);}else{logger['info'](_0xa30c('0xe'),_0x2279ca,_0xa30c('0xf'));_0x57e65e(_0x47b0fa[_0xa30c('0x12')][_0xa30c('0x11')]);}})['catch'](function(_0x4defff){logger[_0xa30c('0x10')]('WhatsappAccount,\x20%s,\x20%s',_0x2279ca,_0x4defff);_0x360964(_0x4defff);});});}exports[_0xa30c('0x13')]=function(_0x5aa885){var _0x1bd910=this;return new Promise(function(_0x25ef47,_0x11becc){return db[_0xa30c('0x14')]['find']({'raw':_0x5aa885[_0xa30c('0x15')]?_0x5aa885['options']['raw']===undefined?!![]:![]:!![],'where':_0x5aa885[_0xa30c('0x15')]?_0x5aa885[_0xa30c('0x15')][_0xa30c('0x16')]||null:null,'attributes':_0x5aa885['options']?_0x5aa885[_0xa30c('0x15')][_0xa30c('0x17')]||null:null,'include':_0x5aa885['options']?_0x5aa885['options'][_0xa30c('0x18')]?_[_0xa30c('0x19')](_0x5aa885[_0xa30c('0x15')]['include'],function(_0x3603a4){return{'model':db[_0x3603a4[_0xa30c('0x1a')]],'as':_0x3603a4['as'],'attributes':_0x3603a4['attributes'],'include':_0x3603a4[_0xa30c('0x18')]?_[_0xa30c('0x19')](_0x3603a4[_0xa30c('0x18')],function(_0xa428ed){return{'model':db[_0xa428ed[_0xa30c('0x1a')]],'as':_0xa428ed['as'],'attributes':_0xa428ed[_0xa30c('0x17')],'include':_0xa428ed[_0xa30c('0x18')]?_['map'](_0xa428ed[_0xa30c('0x18')],function(_0x1c4bdd){return{'model':db[_0x1c4bdd[_0xa30c('0x1a')]],'as':_0x1c4bdd['as'],'attributes':_0x1c4bdd['attributes']};}):[]};}):[]};}):[]:[]})[_0xa30c('0xd')](function(_0xd4c7b4){logger[_0xa30c('0x1b')](_0xa30c('0x13'),_0x5aa885);logger[_0xa30c('0x1c')](_0xa30c('0x13'),_0x5aa885,JSON[_0xa30c('0x1d')](_0xd4c7b4));_0x25ef47(_0xd4c7b4);})[_0xa30c('0x1e')](function(_0x2cbe9c){logger[_0xa30c('0x10')]('ShowWhatsappAccount',_0x2cbe9c[_0xa30c('0x11')],_0x5aa885);_0x11becc(_0x1bd910[_0xa30c('0x10')](0x1f4,_0x2cbe9c[_0xa30c('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.socket.js b/server/api/whatsappAccount/whatsappAccount.socket.js index 1b328be..34f0af6 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 _0x6cee=['register','length','./whatsappAccount.events','save','remove','update','emit','removeListener'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x6cee,0x1f2));var _0xe6ce=function(_0xf0bcac,_0x531755){_0xf0bcac=_0xf0bcac-0x0;var _0x4e4c65=_0x6cee[_0xf0bcac];return _0x4e4c65;};'use strict';var WhatsappAccountEvents=require(_0xe6ce('0x0'));var events=[_0xe6ce('0x1'),_0xe6ce('0x2'),_0xe6ce('0x3')];function createListener(_0xee05ec,_0x46c499){return function(_0xcf4610){_0x46c499[_0xe6ce('0x4')](_0xee05ec,_0xcf4610);};}function removeListener(_0x2491a8,_0x386ed3){return function(){WhatsappAccountEvents[_0xe6ce('0x5')](_0x2491a8,_0x386ed3);};}exports[_0xe6ce('0x6')]=function(_0xc76943){for(var _0x455fad=0x0,_0x2add3d=events[_0xe6ce('0x7')];_0x455fad<_0x2add3d;_0x455fad++){var _0x1b0776=events[_0x455fad];var _0x1681cd=createListener('whatsappAccount:'+_0x1b0776,_0xc76943);WhatsappAccountEvents['on'](_0x1b0776,_0x1681cd);}}; \ No newline at end of file +var _0xd685=['emit','removeListener','register','length','whatsappAccount:','./whatsappAccount.events','update'];(function(_0x3234fa,_0x328a0b){var _0x42da30=function(_0x223679){while(--_0x223679){_0x3234fa['push'](_0x3234fa['shift']());}};_0x42da30(++_0x328a0b);}(_0xd685,0x8a));var _0x5d68=function(_0x9901c4,_0x1e8dd9){_0x9901c4=_0x9901c4-0x0;var _0x49842c=_0xd685[_0x9901c4];return _0x49842c;};'use strict';var WhatsappAccountEvents=require(_0x5d68('0x0'));var events=['save','remove',_0x5d68('0x1')];function createListener(_0xe62bf,_0x33b411){return function(_0x5a9769){_0x33b411[_0x5d68('0x2')](_0xe62bf,_0x5a9769);};}function removeListener(_0x44ba09,_0x3f56c4){return function(){WhatsappAccountEvents[_0x5d68('0x3')](_0x44ba09,_0x3f56c4);};}exports[_0x5d68('0x4')]=function(_0xfa5321){for(var _0x38bcb6=0x0,_0x198bf2=events[_0x5d68('0x5')];_0x38bcb6<_0x198bf2;_0x38bcb6++){var _0x449bb4=events[_0x38bcb6];var _0x239b6b=createListener(_0x5d68('0x6')+_0x449bb4,_0xfa5321);WhatsappAccountEvents['on'](_0x449bb4,_0x239b6b);}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/index.js b/server/api/whatsappApplication/index.js index bf2214e..ea112c8 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 _0x2eb2=['util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','show','post','create','update','delete','destroy','multer'];(function(_0x2b56b2,_0x3d6de0){var _0x29145b=function(_0x357348){while(--_0x357348){_0x2b56b2['push'](_0x2b56b2['shift']());}};_0x29145b(++_0x3d6de0);}(_0x2eb2,0x131));var _0x22eb=function(_0x54d4a8,_0x585a59){_0x54d4a8=_0x54d4a8-0x0;var _0x3b321b=_0x2eb2[_0x54d4a8];return _0x3b321b;};'use strict';var multer=require(_0x22eb('0x0'));var util=require(_0x22eb('0x1'));var path=require('path');var timeout=require(_0x22eb('0x2'));var express=require(_0x22eb('0x3'));var router=express[_0x22eb('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x22eb('0x5'));var config=require(_0x22eb('0x6'));var controller=require('./whatsappApplication.controller');router['get']('/',auth[_0x22eb('0x7')](),controller[_0x22eb('0x8')]);router[_0x22eb('0x9')](_0x22eb('0xa'),auth['isAuthenticated'](),controller[_0x22eb('0xb')]);router[_0x22eb('0xc')]('/',auth[_0x22eb('0x7')](),controller[_0x22eb('0xd')]);router['put'](_0x22eb('0xa'),auth[_0x22eb('0x7')](),controller[_0x22eb('0xe')]);router[_0x22eb('0xf')](_0x22eb('0xa'),auth[_0x22eb('0x7')](),controller[_0x22eb('0x10')]);module['exports']=router; \ No newline at end of file +var _0x933e=['create','put','/:id','update','delete','destroy','exports','multer','util','path','express','../../components/interaction/service','../../config/environment','./whatsappApplication.controller','get','index','isAuthenticated','show'];(function(_0x24754d,_0x190517){var _0xe9fbd1=function(_0x21de33){while(--_0x21de33){_0x24754d['push'](_0x24754d['shift']());}};_0xe9fbd1(++_0x190517);}(_0x933e,0xdf));var _0xe933=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x933e[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0xe933('0x0'));var util=require(_0xe933('0x1'));var path=require(_0xe933('0x2'));var timeout=require('connect-timeout');var express=require(_0xe933('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xe933('0x4'));var config=require(_0xe933('0x5'));var controller=require(_0xe933('0x6'));router[_0xe933('0x7')]('/',auth['isAuthenticated'](),controller[_0xe933('0x8')]);router[_0xe933('0x7')]('/:id',auth[_0xe933('0x9')](),controller[_0xe933('0xa')]);router['post']('/',auth[_0xe933('0x9')](),controller[_0xe933('0xb')]);router[_0xe933('0xc')](_0xe933('0xd'),auth[_0xe933('0x9')](),controller[_0xe933('0xe')]);router[_0xe933('0xf')](_0xe933('0xd'),auth[_0xe933('0x9')](),controller[_0xe933('0x10')]);module[_0xe933('0x11')]=router; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.attributes.js b/server/api/whatsappApplication/whatsappApplication.attributes.js index 104a04a..ec504c4 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 _0xf413=['*,*,*,*','sequelize','exports','STRING','TEXT'];(function(_0x3e8896,_0x186c45){var _0x1dc4e1=function(_0x3af2c9){while(--_0x3af2c9){_0x3e8896['push'](_0x3e8896['shift']());}};_0x1dc4e1(++_0x186c45);}(_0xf413,0xfb));var _0x3f41=function(_0x43ad6b,_0x40d78a){_0x43ad6b=_0x43ad6b-0x0;var _0x1c39d8=_0xf413[_0x43ad6b];return _0x1c39d8;};'use strict';var Sequelize=require(_0x3f41('0x0'));module[_0x3f41('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x3f41('0x2')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x3f41('0x3')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x3f41('0x2')],'defaultValue':_0x3f41('0x4')}}; \ No newline at end of file +var _0x1ba2=['INTEGER','STRING','noop','sequelize','exports'];(function(_0x50c492,_0x5c1e67){var _0x3505a8=function(_0x2f7937){while(--_0x2f7937){_0x50c492['push'](_0x50c492['shift']());}};_0x3505a8(++_0x5c1e67);}(_0x1ba2,0x10c));var _0x21ba=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x1ba2[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0x21ba('0x0'));module[_0x21ba('0x1')]={'priority':{'type':Sequelize[_0x21ba('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x21ba('0x3')],'allowNull':![],'defaultValue':_0x21ba('0x4')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x21ba('0x3')]},'interval':{'type':Sequelize[_0x21ba('0x3')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.controller.js b/server/api/whatsappApplication/whatsappApplication.controller.js index e422ab5..646050b 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 _0xaa64=['type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','map','VIRTUAL','includeAll','findAll','rows','catch','show','params','keys','find','create','body','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','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','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','index','WhatsappApplication','rawAttributes'];(function(_0x237674,_0x2e8cf3){var _0x3f8880=function(_0x42089a){while(--_0x42089a){_0x237674['push'](_0x237674['shift']());}};_0x3f8880(++_0x2e8cf3);}(_0xaa64,0xf7));var _0x4aa6=function(_0x229f85,_0x57b6e6){_0x229f85=_0x229f85-0x0;var _0x425c85=_0xaa64[_0x229f85];return _0x425c85;};'use strict';var emlformat=require(_0x4aa6('0x0'));var rimraf=require(_0x4aa6('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4aa6('0x2'));var rp=require('request-promise');var moment=require(_0x4aa6('0x3'));var BPromise=require(_0x4aa6('0x4'));var Mustache=require(_0x4aa6('0x5'));var util=require('util');var path=require(_0x4aa6('0x6'));var sox=require(_0x4aa6('0x7'));var csv=require(_0x4aa6('0x8'));var ejs=require(_0x4aa6('0x9'));var fs=require('fs');var fs_extra=require(_0x4aa6('0xa'));var _=require(_0x4aa6('0xb'));var squel=require(_0x4aa6('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x4aa6('0xd'));var toCsv=require(_0x4aa6('0x8'));var querystring=require('querystring');var Papa=require(_0x4aa6('0xe'));var Redis=require('ioredis');var authService=require(_0x4aa6('0xf'));var qs=require(_0x4aa6('0x10'));var as=require(_0x4aa6('0x11'));var hardwareService=require(_0x4aa6('0x12'));var logger=require('../../config/logger')(_0x4aa6('0x13'));var utils=require(_0x4aa6('0x14'));var config=require(_0x4aa6('0x15'));var licenseUtil=require(_0x4aa6('0x16'));var db=require(_0x4aa6('0x17'))['db'];function respondWithStatusCode(_0xa8dd06,_0x32401e){_0x32401e=_0x32401e||0xcc;return function(_0x14a12a){if(_0x14a12a){return _0xa8dd06[_0x4aa6('0x18')](_0x32401e);}return _0xa8dd06[_0x4aa6('0x19')](_0x32401e)['end']();};}function respondWithResult(_0x413222,_0x5b0133){_0x5b0133=_0x5b0133||0xc8;return function(_0x561f5d){if(_0x561f5d){return _0x413222[_0x4aa6('0x19')](_0x5b0133)[_0x4aa6('0x1a')](_0x561f5d);}};}function respondWithFilteredResult(_0x326953,_0x11e4d7){return function(_0x375c09){if(_0x375c09){var _0x238f10=typeof _0x11e4d7[_0x4aa6('0x1b')]===_0x4aa6('0x1c')&&typeof _0x11e4d7['limit']===_0x4aa6('0x1c');var _0x5458ad=_0x375c09[_0x4aa6('0x1d')];var _0x5c6d3c=_0x238f10?0x0:_0x11e4d7['offset'];var _0x266707=_0x238f10?_0x375c09[_0x4aa6('0x1d')]:_0x11e4d7[_0x4aa6('0x1b')]+_0x11e4d7[_0x4aa6('0x1e')];var _0x2aa5d7;if(_0x266707>=_0x5458ad){_0x266707=_0x5458ad;_0x2aa5d7=0xc8;}else{_0x2aa5d7=0xce;}_0x326953[_0x4aa6('0x19')](_0x2aa5d7);return _0x326953[_0x4aa6('0x1f')](_0x4aa6('0x20'),_0x5c6d3c+'-'+_0x266707+'/'+_0x5458ad)[_0x4aa6('0x1a')](_0x375c09);}return null;};}function patchUpdates(_0x4c9159){return function(_0x313e73){try{jsonpatch[_0x4aa6('0x21')](_0x313e73,_0x4c9159,!![]);}catch(_0x9a1a7e){return BPromise[_0x4aa6('0x22')](_0x9a1a7e);}return _0x313e73[_0x4aa6('0x23')]();};}function saveUpdates(_0x1e121f,_0x594665){return function(_0xa0f5be){if(_0xa0f5be){return _0xa0f5be[_0x4aa6('0x24')](_0x1e121f)[_0x4aa6('0x25')](function(_0x3af19f){return _0x3af19f;});}return null;};}function removeEntity(_0xa18442,_0x44d151){return function(_0x568a5c){if(_0x568a5c){return _0x568a5c[_0x4aa6('0x26')]()[_0x4aa6('0x25')](function(){_0xa18442['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x347856,_0x109a7c){return function(_0x3efa6b){if(!_0x3efa6b){_0x347856[_0x4aa6('0x18')](0x194);}return _0x3efa6b;};}function handleError(_0x2001ce,_0x5e53a7){_0x5e53a7=_0x5e53a7||0x1f4;return function(_0x44c6cf){logger[_0x4aa6('0x27')](_0x44c6cf[_0x4aa6('0x28')]);if(_0x44c6cf[_0x4aa6('0x29')]){delete _0x44c6cf[_0x4aa6('0x29')];}_0x2001ce[_0x4aa6('0x19')](_0x5e53a7)['send'](_0x44c6cf);};}exports[_0x4aa6('0x2a')]=function(_0x41bdc8,_0x5bc756){var _0x149c9a={},_0x121b97={},_0x2b629e={'count':0x0,'rows':[]};var _0x1fe9cb=_['map'](db[_0x4aa6('0x2b')][_0x4aa6('0x2c')],function(_0x3646c8){return{'name':_0x3646c8['fieldName'],'type':_0x3646c8[_0x4aa6('0x2d')][_0x4aa6('0x2e')]};});_0x121b97[_0x4aa6('0x2f')]=_['map'](_0x1fe9cb,_0x4aa6('0x29'));_0x121b97[_0x4aa6('0x30')]=_['keys'](_0x41bdc8[_0x4aa6('0x30')]);_0x121b97[_0x4aa6('0x31')]=_[_0x4aa6('0x32')](_0x121b97[_0x4aa6('0x2f')],_0x121b97[_0x4aa6('0x30')]);_0x149c9a['attributes']=_['intersection'](_0x121b97[_0x4aa6('0x2f')],qs[_0x4aa6('0x33')](_0x41bdc8[_0x4aa6('0x30')]['fields']));_0x149c9a['attributes']=_0x149c9a[_0x4aa6('0x34')][_0x4aa6('0x35')]?_0x149c9a[_0x4aa6('0x34')]:_0x121b97[_0x4aa6('0x2f')];if(!_0x41bdc8[_0x4aa6('0x30')][_0x4aa6('0x36')](_0x4aa6('0x37'))){_0x149c9a[_0x4aa6('0x1e')]=qs['limit'](_0x41bdc8[_0x4aa6('0x30')][_0x4aa6('0x1e')]);_0x149c9a[_0x4aa6('0x1b')]=qs[_0x4aa6('0x1b')](_0x41bdc8[_0x4aa6('0x30')][_0x4aa6('0x1b')]);}_0x149c9a['order']=qs[_0x4aa6('0x38')](_0x41bdc8[_0x4aa6('0x30')]['sort']);_0x149c9a[_0x4aa6('0x39')]=qs[_0x4aa6('0x31')](_[_0x4aa6('0x3a')](_0x41bdc8[_0x4aa6('0x30')],_0x121b97['filters']),_0x1fe9cb);if(_0x41bdc8['query'][_0x4aa6('0x3b')]){_0x149c9a[_0x4aa6('0x39')]=_[_0x4aa6('0x3c')](_0x149c9a['where'],{'$or':_[_0x4aa6('0x3d')](_0x1fe9cb,function(_0x2ad949){if(_0x2ad949['type']!==_0x4aa6('0x3e')){var _0x394319={};_0x394319[_0x2ad949[_0x4aa6('0x29')]]={'$like':'%'+_0x41bdc8[_0x4aa6('0x30')][_0x4aa6('0x3b')]+'%'};return _0x394319;}})});}_0x149c9a=_[_0x4aa6('0x3c')]({},_0x149c9a,_0x41bdc8['options']);var _0x47daed={'where':_0x149c9a[_0x4aa6('0x39')]};return db[_0x4aa6('0x2b')][_0x4aa6('0x1d')](_0x47daed)[_0x4aa6('0x25')](function(_0x14fb78){_0x2b629e['count']=_0x14fb78;if(_0x41bdc8[_0x4aa6('0x30')][_0x4aa6('0x3f')]){_0x149c9a['include']=[{'all':!![]}];}return db[_0x4aa6('0x2b')][_0x4aa6('0x40')](_0x149c9a);})[_0x4aa6('0x25')](function(_0x47787d){_0x2b629e[_0x4aa6('0x41')]=_0x47787d;return _0x2b629e;})['then'](respondWithFilteredResult(_0x5bc756,_0x149c9a))[_0x4aa6('0x42')](handleError(_0x5bc756,null));};exports[_0x4aa6('0x43')]=function(_0x599921,_0x3fefa6){var _0xb9572a={'raw':!![],'where':{'id':_0x599921[_0x4aa6('0x44')]['id']}},_0x5968d9={};_0x5968d9[_0x4aa6('0x2f')]=_['keys'](db[_0x4aa6('0x2b')][_0x4aa6('0x2c')]);_0x5968d9[_0x4aa6('0x30')]=_[_0x4aa6('0x45')](_0x599921[_0x4aa6('0x30')]);_0x5968d9[_0x4aa6('0x31')]=_[_0x4aa6('0x32')](_0x5968d9['model'],_0x5968d9[_0x4aa6('0x30')]);_0xb9572a[_0x4aa6('0x34')]=_[_0x4aa6('0x32')](_0x5968d9[_0x4aa6('0x2f')],qs[_0x4aa6('0x33')](_0x599921[_0x4aa6('0x30')][_0x4aa6('0x33')]));_0xb9572a[_0x4aa6('0x34')]=_0xb9572a['attributes'][_0x4aa6('0x35')]?_0xb9572a['attributes']:_0x5968d9[_0x4aa6('0x2f')];if(_0x599921[_0x4aa6('0x30')][_0x4aa6('0x3f')]){_0xb9572a['include']=[{'all':!![]}];}_0xb9572a=_[_0x4aa6('0x3c')]({},_0xb9572a,_0x599921['options']);return db['WhatsappApplication'][_0x4aa6('0x46')](_0xb9572a)[_0x4aa6('0x25')](handleEntityNotFound(_0x3fefa6,null))['then'](respondWithResult(_0x3fefa6,null))[_0x4aa6('0x42')](handleError(_0x3fefa6,null));};exports[_0x4aa6('0x47')]=function(_0x5788ae,_0x10affb){return db['WhatsappApplication']['create'](_0x5788ae[_0x4aa6('0x48')],{})['then'](respondWithResult(_0x10affb,0xc9))[_0x4aa6('0x42')](handleError(_0x10affb,null));};exports[_0x4aa6('0x24')]=function(_0x2fd2b8,_0x5a844f){if(_0x2fd2b8[_0x4aa6('0x48')]['id']){delete _0x2fd2b8[_0x4aa6('0x48')]['id'];}return db[_0x4aa6('0x2b')]['find']({'where':{'id':_0x2fd2b8['params']['id']}})[_0x4aa6('0x25')](handleEntityNotFound(_0x5a844f,null))[_0x4aa6('0x25')](saveUpdates(_0x2fd2b8[_0x4aa6('0x48')],null))['then'](respondWithResult(_0x5a844f,null))[_0x4aa6('0x42')](handleError(_0x5a844f,null));};exports[_0x4aa6('0x26')]=function(_0x23b33f,_0x25b9cc){return db['WhatsappApplication']['find']({'where':{'id':_0x23b33f[_0x4aa6('0x44')]['id']}})[_0x4aa6('0x25')](handleEntityNotFound(_0x25b9cc,null))[_0x4aa6('0x25')](removeEntity(_0x25b9cc,null))[_0x4aa6('0x42')](handleError(_0x25b9cc,null));}; \ No newline at end of file +var _0x4f81=['offset','undefined','limit','count','set','save','destroy','then','error','stack','name','send','map','WhatsappApplication','rawAttributes','fieldName','key','keys','query','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','type','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','length','find','create','update','body','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json'];(function(_0x5f1997,_0x3a2035){var _0x797fca=function(_0x3554f1){while(--_0x3554f1){_0x5f1997['push'](_0x5f1997['shift']());}};_0x797fca(++_0x3a2035);}(_0x4f81,0x1e3));var _0x14f8=function(_0x442a03,_0x4b8b1c){_0x442a03=_0x442a03-0x0;var _0x3cc0d6=_0x4f81[_0x442a03];return _0x3cc0d6;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x14f8('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x14f8('0x1'));var moment=require(_0x14f8('0x2'));var BPromise=require(_0x14f8('0x3'));var Mustache=require(_0x14f8('0x4'));var util=require(_0x14f8('0x5'));var path=require(_0x14f8('0x6'));var sox=require(_0x14f8('0x7'));var csv=require('to-csv');var ejs=require(_0x14f8('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x14f8('0x9'));var squel=require(_0x14f8('0xa'));var crypto=require('crypto');var jsforce=require(_0x14f8('0xb'));var deskjs=require(_0x14f8('0xc'));var toCsv=require('to-csv');var querystring=require(_0x14f8('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x14f8('0xe'));var qs=require(_0x14f8('0xf'));var as=require(_0x14f8('0x10'));var hardwareService=require(_0x14f8('0x11'));var logger=require(_0x14f8('0x12'))(_0x14f8('0x13'));var utils=require(_0x14f8('0x14'));var config=require(_0x14f8('0x15'));var licenseUtil=require(_0x14f8('0x16'));var db=require(_0x14f8('0x17'))['db'];function respondWithStatusCode(_0x228505,_0x29d50a){_0x29d50a=_0x29d50a||0xcc;return function(_0x5f2843){if(_0x5f2843){return _0x228505[_0x14f8('0x18')](_0x29d50a);}return _0x228505[_0x14f8('0x19')](_0x29d50a)[_0x14f8('0x1a')]();};}function respondWithResult(_0x422cb7,_0x1eae95){_0x1eae95=_0x1eae95||0xc8;return function(_0x4b3c32){if(_0x4b3c32){return _0x422cb7[_0x14f8('0x19')](_0x1eae95)[_0x14f8('0x1b')](_0x4b3c32);}};}function respondWithFilteredResult(_0x4022a3,_0x1216e8){return function(_0x57e917){if(_0x57e917){var _0x3481a1=typeof _0x1216e8[_0x14f8('0x1c')]===_0x14f8('0x1d')&&typeof _0x1216e8[_0x14f8('0x1e')]===_0x14f8('0x1d');var _0x1dfcc2=_0x57e917[_0x14f8('0x1f')];var _0x4a1a90=_0x3481a1?0x0:_0x1216e8[_0x14f8('0x1c')];var _0x4495de=_0x3481a1?_0x57e917['count']:_0x1216e8['offset']+_0x1216e8['limit'];var _0x3e62a1;if(_0x4495de>=_0x1dfcc2){_0x4495de=_0x1dfcc2;_0x3e62a1=0xc8;}else{_0x3e62a1=0xce;}_0x4022a3[_0x14f8('0x19')](_0x3e62a1);return _0x4022a3[_0x14f8('0x20')]('Content-Range',_0x4a1a90+'-'+_0x4495de+'/'+_0x1dfcc2)[_0x14f8('0x1b')](_0x57e917);}return null;};}function patchUpdates(_0x30c2cd){return function(_0x13b283){try{jsonpatch['apply'](_0x13b283,_0x30c2cd,!![]);}catch(_0x3526e5){return BPromise['reject'](_0x3526e5);}return _0x13b283[_0x14f8('0x21')]();};}function saveUpdates(_0x14fa31,_0x4bfacd){return function(_0x575a23){if(_0x575a23){return _0x575a23['update'](_0x14fa31)['then'](function(_0x32ebe5){return _0x32ebe5;});}return null;};}function removeEntity(_0x12f47f,_0x15995a){return function(_0x12443d){if(_0x12443d){return _0x12443d[_0x14f8('0x22')]()[_0x14f8('0x23')](function(){_0x12f47f['status'](0xcc)[_0x14f8('0x1a')]();});}};}function handleEntityNotFound(_0x504ac4,_0x16360d){return function(_0x26e370){if(!_0x26e370){_0x504ac4[_0x14f8('0x18')](0x194);}return _0x26e370;};}function handleError(_0x52fe4d,_0x45f4e9){_0x45f4e9=_0x45f4e9||0x1f4;return function(_0x5540ac){logger[_0x14f8('0x24')](_0x5540ac[_0x14f8('0x25')]);if(_0x5540ac['name']){delete _0x5540ac[_0x14f8('0x26')];}_0x52fe4d[_0x14f8('0x19')](_0x45f4e9)[_0x14f8('0x27')](_0x5540ac);};}exports['index']=function(_0x408d99,_0x43bb3d){var _0x23aa31={},_0x58ba3b={},_0x3e1d02={'count':0x0,'rows':[]};var _0x2ae3ed=_[_0x14f8('0x28')](db[_0x14f8('0x29')][_0x14f8('0x2a')],function(_0x366292){return{'name':_0x366292[_0x14f8('0x2b')],'type':_0x366292['type'][_0x14f8('0x2c')]};});_0x58ba3b['model']=_['map'](_0x2ae3ed,_0x14f8('0x26'));_0x58ba3b['query']=_[_0x14f8('0x2d')](_0x408d99[_0x14f8('0x2e')]);_0x58ba3b[_0x14f8('0x2f')]=_[_0x14f8('0x30')](_0x58ba3b[_0x14f8('0x31')],_0x58ba3b['query']);_0x23aa31[_0x14f8('0x32')]=_[_0x14f8('0x30')](_0x58ba3b['model'],qs['fields'](_0x408d99[_0x14f8('0x2e')][_0x14f8('0x33')]));_0x23aa31['attributes']=_0x23aa31[_0x14f8('0x32')]['length']?_0x23aa31['attributes']:_0x58ba3b['model'];if(!_0x408d99[_0x14f8('0x2e')][_0x14f8('0x34')](_0x14f8('0x35'))){_0x23aa31['limit']=qs[_0x14f8('0x1e')](_0x408d99['query'][_0x14f8('0x1e')]);_0x23aa31[_0x14f8('0x1c')]=qs['offset'](_0x408d99[_0x14f8('0x2e')][_0x14f8('0x1c')]);}_0x23aa31['order']=qs[_0x14f8('0x36')](_0x408d99[_0x14f8('0x2e')][_0x14f8('0x36')]);_0x23aa31[_0x14f8('0x37')]=qs[_0x14f8('0x2f')](_[_0x14f8('0x38')](_0x408d99['query'],_0x58ba3b[_0x14f8('0x2f')]),_0x2ae3ed);if(_0x408d99['query']['filter']){_0x23aa31[_0x14f8('0x37')]=_['merge'](_0x23aa31['where'],{'$or':_[_0x14f8('0x28')](_0x2ae3ed,function(_0x107497){if(_0x107497[_0x14f8('0x39')]!=='VIRTUAL'){var _0x536da9={};_0x536da9[_0x107497['name']]={'$like':'%'+_0x408d99[_0x14f8('0x2e')][_0x14f8('0x3a')]+'%'};return _0x536da9;}})});}_0x23aa31=_[_0x14f8('0x3b')]({},_0x23aa31,_0x408d99[_0x14f8('0x3c')]);var _0xc941a9={'where':_0x23aa31[_0x14f8('0x37')]};return db[_0x14f8('0x29')][_0x14f8('0x1f')](_0xc941a9)[_0x14f8('0x23')](function(_0x5121d3){_0x3e1d02['count']=_0x5121d3;if(_0x408d99[_0x14f8('0x2e')][_0x14f8('0x3d')]){_0x23aa31[_0x14f8('0x3e')]=[{'all':!![]}];}return db[_0x14f8('0x29')][_0x14f8('0x3f')](_0x23aa31);})['then'](function(_0x101adc){_0x3e1d02[_0x14f8('0x40')]=_0x101adc;return _0x3e1d02;})[_0x14f8('0x23')](respondWithFilteredResult(_0x43bb3d,_0x23aa31))[_0x14f8('0x41')](handleError(_0x43bb3d,null));};exports[_0x14f8('0x42')]=function(_0x4b7a9e,_0x289c2e){var _0x96b1e8={'raw':!![],'where':{'id':_0x4b7a9e[_0x14f8('0x43')]['id']}},_0x59e472={};_0x59e472[_0x14f8('0x31')]=_['keys'](db[_0x14f8('0x29')][_0x14f8('0x2a')]);_0x59e472[_0x14f8('0x2e')]=_[_0x14f8('0x2d')](_0x4b7a9e['query']);_0x59e472[_0x14f8('0x2f')]=_['intersection'](_0x59e472[_0x14f8('0x31')],_0x59e472[_0x14f8('0x2e')]);_0x96b1e8[_0x14f8('0x32')]=_[_0x14f8('0x30')](_0x59e472[_0x14f8('0x31')],qs['fields'](_0x4b7a9e[_0x14f8('0x2e')][_0x14f8('0x33')]));_0x96b1e8[_0x14f8('0x32')]=_0x96b1e8[_0x14f8('0x32')][_0x14f8('0x44')]?_0x96b1e8[_0x14f8('0x32')]:_0x59e472[_0x14f8('0x31')];if(_0x4b7a9e[_0x14f8('0x2e')][_0x14f8('0x3d')]){_0x96b1e8[_0x14f8('0x3e')]=[{'all':!![]}];}_0x96b1e8=_[_0x14f8('0x3b')]({},_0x96b1e8,_0x4b7a9e[_0x14f8('0x3c')]);return db['WhatsappApplication'][_0x14f8('0x45')](_0x96b1e8)['then'](handleEntityNotFound(_0x289c2e,null))[_0x14f8('0x23')](respondWithResult(_0x289c2e,null))[_0x14f8('0x41')](handleError(_0x289c2e,null));};exports['create']=function(_0x232cad,_0x1d1fe7){return db[_0x14f8('0x29')][_0x14f8('0x46')](_0x232cad['body'],{})[_0x14f8('0x23')](respondWithResult(_0x1d1fe7,0xc9))['catch'](handleError(_0x1d1fe7,null));};exports[_0x14f8('0x47')]=function(_0x163ffd,_0x572da7){if(_0x163ffd['body']['id']){delete _0x163ffd[_0x14f8('0x48')]['id'];}return db[_0x14f8('0x29')][_0x14f8('0x45')]({'where':{'id':_0x163ffd[_0x14f8('0x43')]['id']}})[_0x14f8('0x23')](handleEntityNotFound(_0x572da7,null))[_0x14f8('0x23')](saveUpdates(_0x163ffd['body'],null))[_0x14f8('0x23')](respondWithResult(_0x572da7,null))[_0x14f8('0x41')](handleError(_0x572da7,null));};exports[_0x14f8('0x22')]=function(_0x54e6f2,_0x4963bb){return db[_0x14f8('0x29')][_0x14f8('0x45')]({'where':{'id':_0x54e6f2[_0x14f8('0x43')]['id']}})[_0x14f8('0x23')](handleEntityNotFound(_0x4963bb,null))[_0x14f8('0x23')](removeEntity(_0x4963bb,null))['catch'](handleError(_0x4963bb,null));}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.model.js b/server/api/whatsappApplication/whatsappApplication.model.js index e1089ec..5281908 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 _0xf23b=['request-promise','path','rimraf','./whatsappApplication.attributes','exports','define','utf8mb4','lodash','util','../../config/logger','api','moment'];(function(_0x4cf394,_0x382eb7){var _0x63692a=function(_0x4b7859){while(--_0x4b7859){_0x4cf394['push'](_0x4cf394['shift']());}};_0x63692a(++_0x382eb7);}(_0xf23b,0x133));var _0xbf23=function(_0x325d33,_0x56116e){_0x325d33=_0x325d33-0x0;var _0x4d32d7=_0xf23b[_0x325d33];return _0x4d32d7;};'use strict';var _=require(_0xbf23('0x0'));var util=require(_0xbf23('0x1'));var logger=require(_0xbf23('0x2'))(_0xbf23('0x3'));var moment=require(_0xbf23('0x4'));var BPromise=require('bluebird');var rp=require(_0xbf23('0x5'));var fs=require('fs');var path=require(_0xbf23('0x6'));var rimraf=require(_0xbf23('0x7'));var config=require('../../config/environment');var attributes=require(_0xbf23('0x8'));module[_0xbf23('0x9')]=function(_0xc5e7dd,_0x393a52){return _0xc5e7dd[_0xbf23('0xa')]('WhatsappApplication',attributes,{'tableName':'whatsapp_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xbf23('0xb'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xfcbd=['./whatsappApplication.attributes','exports','define','WhatsappApplication','whatsapp_applications','utf8mb4','utf8mb4_unicode_ci','lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x3a7634,_0x2db384){var _0x23bbe9=function(_0x226734){while(--_0x226734){_0x3a7634['push'](_0x3a7634['shift']());}};_0x23bbe9(++_0x2db384);}(_0xfcbd,0x160));var _0xdfcb=function(_0x40e617,_0x4674eb){_0x40e617=_0x40e617-0x0;var _0x4e39f2=_0xfcbd[_0x40e617];return _0x4e39f2;};'use strict';var _=require(_0xdfcb('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xdfcb('0x1'));var moment=require(_0xdfcb('0x2'));var BPromise=require(_0xdfcb('0x3'));var rp=require(_0xdfcb('0x4'));var fs=require('fs');var path=require(_0xdfcb('0x5'));var rimraf=require(_0xdfcb('0x6'));var config=require(_0xdfcb('0x7'));var attributes=require(_0xdfcb('0x8'));module[_0xdfcb('0x9')]=function(_0x4bdf76,_0x5615a6){return _0x4bdf76[_0xdfcb('0xa')](_0xdfcb('0xb'),attributes,{'tableName':_0xdfcb('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xdfcb('0xd'),'collate':_0xdfcb('0xe')});}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.rpc.js b/server/api/whatsappApplication/whatsappApplication.rpc.js index ffb092a..7195fcc 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 _0x99e9=['../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info','WhatsappApplication,\x20%s,\x20%s','request\x20sent','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring'];(function(_0x2d37b7,_0x3bf618){var _0x4dfbdb=function(_0x18fc40){while(--_0x18fc40){_0x2d37b7['push'](_0x2d37b7['shift']());}};_0x4dfbdb(++_0x3bf618);}(_0x99e9,0xb4));var _0x999e=function(_0xabbd2f,_0x44d05a){_0xabbd2f=_0xabbd2f-0x0;var _0x34a040=_0x99e9[_0xabbd2f];return _0x34a040;};'use strict';var _=require('lodash');var util=require(_0x999e('0x0'));var moment=require(_0x999e('0x1'));var BPromise=require(_0x999e('0x2'));var rs=require(_0x999e('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x999e('0x4'))['db'];var utils=require(_0x999e('0x5'));var logger=require(_0x999e('0x6'))('rpc');var config=require(_0x999e('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x999e('0x8')][_0x999e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x100330,_0x18f337,_0x5c1c17){return new BPromise(function(_0x46aeae,_0x38a692){return client[_0x999e('0xa')](_0x100330,_0x5c1c17)[_0x999e('0xb')](function(_0x2c38cf){logger[_0x999e('0xc')](_0x999e('0xd'),_0x18f337,_0x999e('0xe'));logger[_0x999e('0xf')](_0x999e('0x10'),_0x18f337,_0x999e('0xe'),JSON[_0x999e('0x11')](_0x2c38cf));if(_0x2c38cf[_0x999e('0x12')]){if(_0x2c38cf[_0x999e('0x12')][_0x999e('0x13')]===0x1f4){logger[_0x999e('0x12')](_0x999e('0xd'),_0x18f337,_0x2c38cf['error'][_0x999e('0x14')]);return _0x38a692(_0x2c38cf['error'][_0x999e('0x14')]);}logger[_0x999e('0x12')](_0x999e('0xd'),_0x18f337,_0x2c38cf['error'][_0x999e('0x14')]);return _0x46aeae(_0x2c38cf['error'][_0x999e('0x14')]);}else{logger['info']('WhatsappApplication,\x20%s,\x20%s',_0x18f337,_0x999e('0xe'));_0x46aeae(_0x2c38cf[_0x999e('0x15')][_0x999e('0x14')]);}})[_0x999e('0x16')](function(_0x1e9bff){logger[_0x999e('0x12')]('WhatsappApplication,\x20%s,\x20%s',_0x18f337,_0x1e9bff);_0x38a692(_0x1e9bff);});});} \ No newline at end of file +var _0xd6d6=['WhatsappApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','WhatsappApplication,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x1b06c6,_0x4c7075){var _0xa83a4b=function(_0x44b844){while(--_0x44b844){_0x1b06c6['push'](_0x1b06c6['shift']());}};_0xa83a4b(++_0x4c7075);}(_0xd6d6,0xbe));var _0x6d6d=function(_0x287436,_0x2147e7){_0x287436=_0x287436-0x0;var _0xc75f5b=_0xd6d6[_0x287436];return _0xc75f5b;};'use strict';var _=require(_0x6d6d('0x0'));var util=require(_0x6d6d('0x1'));var moment=require(_0x6d6d('0x2'));var BPromise=require(_0x6d6d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6d6d('0x4'));var db=require(_0x6d6d('0x5'))['db'];var utils=require(_0x6d6d('0x6'));var logger=require(_0x6d6d('0x7'))(_0x6d6d('0x8'));var config=require(_0x6d6d('0x9'));var jayson=require(_0x6d6d('0xa'));var client=jayson['client'][_0x6d6d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1bf731,_0x44f83d,_0x18f824){return new BPromise(function(_0xd49f57,_0x408f88){return client[_0x6d6d('0xc')](_0x1bf731,_0x18f824)['then'](function(_0x51dd38){logger[_0x6d6d('0xd')](_0x6d6d('0xe'),_0x44f83d,_0x6d6d('0xf'));logger[_0x6d6d('0x10')](_0x6d6d('0x11'),_0x44f83d,'request\x20sent',JSON[_0x6d6d('0x12')](_0x51dd38));if(_0x51dd38[_0x6d6d('0x13')]){if(_0x51dd38['error']['code']===0x1f4){logger[_0x6d6d('0x13')](_0x6d6d('0xe'),_0x44f83d,_0x51dd38[_0x6d6d('0x13')][_0x6d6d('0x14')]);return _0x408f88(_0x51dd38[_0x6d6d('0x13')][_0x6d6d('0x14')]);}logger[_0x6d6d('0x13')](_0x6d6d('0xe'),_0x44f83d,_0x51dd38['error'][_0x6d6d('0x14')]);return _0xd49f57(_0x51dd38[_0x6d6d('0x13')][_0x6d6d('0x14')]);}else{logger[_0x6d6d('0xd')](_0x6d6d('0xe'),_0x44f83d,'request\x20sent');_0xd49f57(_0x51dd38[_0x6d6d('0x15')]['message']);}})[_0x6d6d('0x16')](function(_0x2cbc86){logger[_0x6d6d('0x13')]('WhatsappApplication,\x20%s,\x20%s',_0x44f83d,_0x2cbc86);_0x408f88(_0x2cbc86);});});} \ No newline at end of file diff --git a/server/api/whatsappInteraction/index.js b/server/api/whatsappInteraction/index.js index 2f0d557..d91a5ea 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 _0xdf98=['create','post','addMessage','/:id/tags','whatsapp','whatsappinteraction:addtags','addTags','/:id','tracked','whatsappinteraction:update','update','delete','destroy','removeTags','exports','multer','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id/messages','getMessages','/:id/download','download'];(function(_0x28b498,_0x4c514f){var _0x8fd1bb=function(_0x1b9887){while(--_0x1b9887){_0x28b498['push'](_0x28b498['shift']());}};_0x8fd1bb(++_0x4c514f);}(_0xdf98,0xcf));var _0x8df9=function(_0x2da71d,_0x34f66b){_0x2da71d=_0x2da71d-0x0;var _0x16c334=_0xdf98[_0x2da71d];return _0x16c334;};'use strict';var multer=require(_0x8df9('0x0'));var util=require('util');var path=require(_0x8df9('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x8df9('0x2')]();var fs_extra=require(_0x8df9('0x3'));var auth=require(_0x8df9('0x4'));var interaction=require(_0x8df9('0x5'));var config=require(_0x8df9('0x6'));var controller=require(_0x8df9('0x7'));router[_0x8df9('0x8')]('/',auth[_0x8df9('0x9')](),controller[_0x8df9('0xa')]);router['get'](_0x8df9('0xb'),auth[_0x8df9('0x9')](),controller[_0x8df9('0xc')]);router['get']('/:id',auth[_0x8df9('0x9')](),controller['show']);router[_0x8df9('0x8')](_0x8df9('0xd'),auth[_0x8df9('0x9')](),controller[_0x8df9('0xe')]);router[_0x8df9('0x8')](_0x8df9('0xf'),auth[_0x8df9('0x9')](),controller[_0x8df9('0x10')]);router['post']('/',auth[_0x8df9('0x9')](),controller[_0x8df9('0x11')]);router[_0x8df9('0x12')]('/:id/messages',auth[_0x8df9('0x9')](),controller[_0x8df9('0x13')]);router[_0x8df9('0x12')](_0x8df9('0x14'),auth['isAuthenticated'](),interaction['tracked'](_0x8df9('0x15'),_0x8df9('0x16')),controller[_0x8df9('0x17')]);router['put'](_0x8df9('0x18'),auth['isAuthenticated'](),interaction[_0x8df9('0x19')]('whatsapp',_0x8df9('0x1a')),controller[_0x8df9('0x1b')]);router[_0x8df9('0x1c')](_0x8df9('0x18'),auth[_0x8df9('0x9')](),interaction[_0x8df9('0x19')]('whatsapp','whatsappinteraction:destroy'),controller[_0x8df9('0x1d')]);router['delete']('/:id/tags',auth[_0x8df9('0x9')](),controller[_0x8df9('0x1e')]);module[_0x8df9('0x1f')]=router; \ No newline at end of file +var _0xfc46=['../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','show','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','/:id/tags','whatsappinteraction:addtags','addTags','put','/:id','tracked','whatsapp','whatsappinteraction:update','update','whatsappinteraction:destroy','destroy','removeTags','multer','path','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x3e064d,_0x28af4e){var _0x15da2b=function(_0x547d29){while(--_0x547d29){_0x3e064d['push'](_0x3e064d['shift']());}};_0x15da2b(++_0x28af4e);}(_0xfc46,0x9a));var _0x6fc4=function(_0x2e3dfc,_0x454d6c){_0x2e3dfc=_0x2e3dfc-0x0;var _0x4b1245=_0xfc46[_0x2e3dfc];return _0x4b1245;};'use strict';var multer=require(_0x6fc4('0x0'));var util=require('util');var path=require(_0x6fc4('0x1'));var timeout=require(_0x6fc4('0x2'));var express=require(_0x6fc4('0x3'));var router=express['Router']();var fs_extra=require(_0x6fc4('0x4'));var auth=require(_0x6fc4('0x5'));var interaction=require(_0x6fc4('0x6'));var config=require(_0x6fc4('0x7'));var controller=require('./whatsappInteraction.controller');router[_0x6fc4('0x8')]('/',auth[_0x6fc4('0x9')](),controller[_0x6fc4('0xa')]);router[_0x6fc4('0x8')](_0x6fc4('0xb'),auth[_0x6fc4('0x9')](),controller['describe']);router[_0x6fc4('0x8')]('/:id',auth[_0x6fc4('0x9')](),controller[_0x6fc4('0xc')]);router['get'](_0x6fc4('0xd'),auth[_0x6fc4('0x9')](),controller[_0x6fc4('0xe')]);router[_0x6fc4('0x8')](_0x6fc4('0xf'),auth[_0x6fc4('0x9')](),controller[_0x6fc4('0x10')]);router[_0x6fc4('0x11')]('/',auth[_0x6fc4('0x9')](),controller[_0x6fc4('0x12')]);router[_0x6fc4('0x11')](_0x6fc4('0xd'),auth[_0x6fc4('0x9')](),controller[_0x6fc4('0x13')]);router[_0x6fc4('0x11')](_0x6fc4('0x14'),auth[_0x6fc4('0x9')](),interaction['tracked']('whatsapp',_0x6fc4('0x15')),controller[_0x6fc4('0x16')]);router[_0x6fc4('0x17')](_0x6fc4('0x18'),auth[_0x6fc4('0x9')](),interaction[_0x6fc4('0x19')](_0x6fc4('0x1a'),_0x6fc4('0x1b')),controller[_0x6fc4('0x1c')]);router['delete'](_0x6fc4('0x18'),auth[_0x6fc4('0x9')](),interaction['tracked']('whatsapp',_0x6fc4('0x1d')),controller[_0x6fc4('0x1e')]);router['delete'](_0x6fc4('0x14'),auth[_0x6fc4('0x9')](),controller[_0x6fc4('0x1f')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.attributes.js b/server/api/whatsappInteraction/whatsappInteraction.attributes.js index 97ec830..1e8e922 100644 --- a/server/api/whatsappInteraction/whatsappInteraction.attributes.js +++ b/server/api/whatsappInteraction/whatsappInteraction.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xed1f=['STRING','ENUM','out','BOOLEAN','sequelize','moment','DATE'];(function(_0x5ab232,_0x570056){var _0x457b86=function(_0x189f6b){while(--_0x189f6b){_0x5ab232['push'](_0x5ab232['shift']());}};_0x457b86(++_0x570056);}(_0xed1f,0x170));var _0xfed1=function(_0x38537f,_0x252124){_0x38537f=_0x38537f-0x0;var _0x141e23=_0xed1f[_0x38537f];return _0x141e23;};'use strict';var Sequelize=require(_0xfed1('0x0'));var moment=require(_0xfed1('0x1'));module['exports']={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xfed1('0x2')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0xfed1('0x3')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xfed1('0x3')]},'phone':{'type':Sequelize[_0xfed1('0x3')]},'read1stAt':{'type':Sequelize[_0xfed1('0x2')]},'firstMsgDirection':{'type':Sequelize[_0xfed1('0x4')]('in',_0xfed1('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xfed1('0x2')]},'lastMsgDirection':{'type':Sequelize[_0xfed1('0x4')]('in',_0xfed1('0x5')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xfed1('0x6')],'defaultValue':![]}}; \ No newline at end of file +var _0xed1f=['STRING','ENUM','out','BOOLEAN','sequelize','moment','DATE'];(function(_0x4e8401,_0x51b328){var _0x17269f=function(_0x35ac65){while(--_0x35ac65){_0x4e8401['push'](_0x4e8401['shift']());}};_0x17269f(++_0x51b328);}(_0xed1f,0x170));var _0xfed1=function(_0x3fba9f,_0x3b7b9b){_0x3fba9f=_0x3fba9f-0x0;var _0x192cf1=_0xed1f[_0x3fba9f];return _0x192cf1;};'use strict';var Sequelize=require(_0xfed1('0x0'));var moment=require(_0xfed1('0x1'));module['exports']={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xfed1('0x2')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0xfed1('0x3')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xfed1('0x3')]},'phone':{'type':Sequelize[_0xfed1('0x3')]},'read1stAt':{'type':Sequelize[_0xfed1('0x2')]},'firstMsgDirection':{'type':Sequelize[_0xfed1('0x4')]('in',_0xfed1('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xfed1('0x2')]},'lastMsgDirection':{'type':Sequelize[_0xfed1('0x4')]('in',_0xfed1('0x5')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xfed1('0x6')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.controller.js b/server/api/whatsappInteraction/whatsappInteraction.controller.js index 87a1004..621e182 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 _0x86dd=['removeTags','download','unix','server','tmp','transcript-%d-%s.zip','join','fullname','CmContact','firstName','lastName','Attachment','Messages','direction','secret','Account','Owner','get','Whatsapp','N.A.','createdAt','closed','disposition','createReadStream','pipe','createWriteStream','basename','out','System','renderFile','root','transcript-','.pdf','createPdfFromHTML','log','err','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','socket.io-emitter','./whatsappInteraction.socket','register','status','end','json','undefined','limit','count','offset','set','apply','reject','save','update','destroy','error','name','send','Users','map','Tags','split','forEach','TagIds','then','catch','index','WhatsappInteraction','rawAttributes','type','model','keys','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','select','field','color','tools_tags','u.fullname','ui.WhatsappInteractionId','from','user_has_whatsapp_interactions','left_join','users','u.id\x20=\x20ui.UserId','whatsapp_interactions','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','whatsapp_accounts','a.id\x20=\x20i.WhatsappAccountId','me.WhatsappInteractionId\x20=\x20i.id','whatsapp_interaction_has_tags','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','body','some','compact','concat','parse','$gte','$lte','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','i.phone\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','i.id','Sequelize','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','t.id\x20IN\x20?','resolve','WhatsappAccountId','i.WhatsappAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getWhatsappAccounts','i.WhatsappAccountId\x20IS\x20NULL','i.WhatsappAccountId\x20IN\x20?','toString','sequelize','keyBy','merge','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','Contact.firstName','c.lastName','c.email','Contact.email','c.phone','Contact.mobile','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.WhatsappInteractionId\x20IN\x20?','groupBy','WhatsappInteractionId','push','all','show','params','include','create','describe','addMessage','WhatsappMessage','omit','getMessages','format','YYYY-MM-DD\x20HH:mm:ss','options','includeAll','setTags','ids','findAll','emit','whatsappInteractionTags:save'];(function(_0x4306f7,_0x57cd08){var _0x54188a=function(_0xad612a){while(--_0xad612a){_0x4306f7['push'](_0x4306f7['shift']());}};_0x54188a(++_0x57cd08);}(_0x86dd,0x1ee));var _0xd86d=function(_0x34691b,_0x1b9707){_0x34691b=_0x34691b-0x0;var _0x3e8032=_0x86dd[_0x34691b];return _0x3e8032;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd86d('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd86d('0x1'));var rp=require(_0xd86d('0x2'));var moment=require(_0xd86d('0x3'));var BPromise=require(_0xd86d('0x4'));var Mustache=require(_0xd86d('0x5'));var util=require(_0xd86d('0x6'));var path=require(_0xd86d('0x7'));var sox=require(_0xd86d('0x8'));var csv=require(_0xd86d('0x9'));var ejs=require(_0xd86d('0xa'));var fs=require('fs');var fs_extra=require(_0xd86d('0xb'));var _=require(_0xd86d('0xc'));var squel=require('squel');var crypto=require(_0xd86d('0xd'));var jsforce=require(_0xd86d('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xd86d('0x9'));var querystring=require(_0xd86d('0xf'));var Papa=require(_0xd86d('0x10'));var Redis=require(_0xd86d('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xd86d('0x12'));var as=require(_0xd86d('0x13'));var pdf=require(_0xd86d('0x14'));var hardwareService=require(_0xd86d('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0xd86d('0x16'));var config=require(_0xd86d('0x17'));var licenseUtil=require(_0xd86d('0x18'));var db=require(_0xd86d('0x19'))['db'];config[_0xd86d('0x1a')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xd86d('0x1b'))(new Redis(config[_0xd86d('0x1a')]));require(_0xd86d('0x1c'))[_0xd86d('0x1d')](socket);function respondWithStatusCode(_0x4457b0,_0x397931){_0x397931=_0x397931||0xcc;return function(_0x3aa815){if(_0x3aa815){return _0x4457b0['sendStatus'](_0x397931);}return _0x4457b0[_0xd86d('0x1e')](_0x397931)[_0xd86d('0x1f')]();};}function respondWithResult(_0x38dc37,_0x413fb8){_0x413fb8=_0x413fb8||0xc8;return function(_0x34ee10){if(_0x34ee10){return _0x38dc37[_0xd86d('0x1e')](_0x413fb8)[_0xd86d('0x20')](_0x34ee10);}};}function respondWithFilteredResult(_0x418270,_0x3086a5){return function(_0x21efda){if(_0x21efda){var _0x5aabdb=typeof _0x3086a5['offset']===_0xd86d('0x21')&&typeof _0x3086a5[_0xd86d('0x22')]===_0xd86d('0x21');var _0x573556=_0x21efda[_0xd86d('0x23')];var _0x19e4de=_0x5aabdb?0x0:_0x3086a5[_0xd86d('0x24')];var _0x5a632c=_0x5aabdb?_0x21efda[_0xd86d('0x23')]:_0x3086a5[_0xd86d('0x24')]+_0x3086a5['limit'];var _0x384bb3;if(_0x5a632c>=_0x573556){_0x5a632c=_0x573556;_0x384bb3=0xc8;}else{_0x384bb3=0xce;}_0x418270[_0xd86d('0x1e')](_0x384bb3);return _0x418270[_0xd86d('0x25')]('Content-Range',_0x19e4de+'-'+_0x5a632c+'/'+_0x573556)[_0xd86d('0x20')](_0x21efda);}return null;};}function patchUpdates(_0x30c0f1){return function(_0xdc92c1){try{jsonpatch[_0xd86d('0x26')](_0xdc92c1,_0x30c0f1,!![]);}catch(_0x49845b){return BPromise[_0xd86d('0x27')](_0x49845b);}return _0xdc92c1[_0xd86d('0x28')]();};}function saveUpdates(_0x5e1ea3,_0x59f60e){return function(_0x5497e5){if(_0x5497e5){return _0x5497e5[_0xd86d('0x29')](_0x5e1ea3)['then'](function(_0x158dcb){return _0x158dcb;});}return null;};}function removeEntity(_0x4b42ca,_0x48c7cc){return function(_0x327a2e){if(_0x327a2e){return _0x327a2e[_0xd86d('0x2a')]()['then'](function(){_0x4b42ca[_0xd86d('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x38e4b3,_0x4b99f7){return function(_0x593007){if(!_0x593007){_0x38e4b3['sendStatus'](0x194);}return _0x593007;};}function handleError(_0x5eacd9,_0x345bb7){_0x345bb7=_0x345bb7||0x1f4;return function(_0x5daa94){logger[_0xd86d('0x2b')](_0x5daa94['stack']);if(_0x5daa94[_0xd86d('0x2c')]){delete _0x5daa94[_0xd86d('0x2c')];}_0x5eacd9[_0xd86d('0x1e')](_0x345bb7)[_0xd86d('0x2d')](_0x5daa94);};}function getInteractionUsers(_0x5e02a9,_0x2be14e){return new BPromise(function(_0x260219,_0x3f6d72){try{if(_0x2be14e[_0x5e02a9['id']]){_0x5e02a9[_0xd86d('0x2e')]=_[_0xd86d('0x2f')](_0x2be14e[_0x5e02a9['id']],function(_0x15cbe0){return{'id':_0x15cbe0['id'],'fullname':_0x15cbe0['fullname']};});}}catch(_0x222d22){_0x3f6d72(_0x222d22);}_0x260219(_0x5e02a9);});}function getInteractionTags(_0x2dafd7,_0x19bd35){return new BPromise(function(_0x331e3a,_0x5ac42d){try{if(_0x2dafd7['TagIds']){_0x2dafd7[_0xd86d('0x30')]=[];_0x2dafd7['TagIds'][_0xd86d('0x31')](',')[_0xd86d('0x32')](function(_0x2db3c8){_0x2dafd7[_0xd86d('0x30')]['push'](_0x19bd35[_0x2db3c8]);});}delete _0x2dafd7[_0xd86d('0x33')];}catch(_0x11e5b8){_0x5ac42d(_0x11e5b8);}_0x331e3a(_0x2dafd7);});}function updateWhatsappInteraction(_0x506a2e,_0x23e985,_0x2efe2e){return new BPromise(function(_0x3cd8f7,_0x5eb8f3){return getInteractionUsers(_0x506a2e,_0x2efe2e)[_0xd86d('0x34')](function(_0x535c3a){return getInteractionTags(_0x535c3a,_0x23e985);})[_0xd86d('0x34')](function(_0x5e77ad){_0x3cd8f7(_0x5e77ad);})[_0xd86d('0x35')](function(_0x1bd874){_0x5eb8f3(_0x1bd874);});});}exports[_0xd86d('0x36')]=function(_0x581f1c,_0x1325dc){var _0x4cd9d4={},_0x4000b8={},_0x479ac8={'count':0x0,'rows':[]};var _0x20a77f=_[_0xd86d('0x2f')](db[_0xd86d('0x37')][_0xd86d('0x38')],function(_0x8ff892){return{'name':_0x8ff892['fieldName'],'type':_0x8ff892[_0xd86d('0x39')]['key']};});_0x4000b8[_0xd86d('0x3a')]=_['map'](_0x20a77f,_0xd86d('0x2c'));_0x4000b8['query']=_[_0xd86d('0x3b')](_0x581f1c['query']);_0x4000b8['filters']=_[_0xd86d('0x3c')](_0x4000b8[_0xd86d('0x3a')],_0x4000b8[_0xd86d('0x3d')]);_0x4cd9d4[_0xd86d('0x3e')]=_['intersection'](_0x4000b8['model'],qs[_0xd86d('0x3f')](_0x581f1c[_0xd86d('0x3d')][_0xd86d('0x3f')]));_0x4cd9d4[_0xd86d('0x3e')]=_0x4cd9d4['attributes'][_0xd86d('0x40')]?_0x4cd9d4[_0xd86d('0x3e')]:_0x4000b8[_0xd86d('0x3a')];if(!_0x581f1c[_0xd86d('0x3d')][_0xd86d('0x41')](_0xd86d('0x42'))){_0x4cd9d4[_0xd86d('0x22')]=qs[_0xd86d('0x22')](_0x581f1c['query'][_0xd86d('0x22')]);_0x4cd9d4['offset']=qs[_0xd86d('0x24')](_0x581f1c[_0xd86d('0x3d')][_0xd86d('0x24')]);}_0x4cd9d4[_0xd86d('0x43')]=qs['sort'](_0x581f1c[_0xd86d('0x3d')][_0xd86d('0x44')]);_0x4cd9d4[_0xd86d('0x45')]=qs[_0xd86d('0x46')](_[_0xd86d('0x47')](_0x581f1c[_0xd86d('0x3d')],_0x4000b8[_0xd86d('0x46')]),_0x20a77f);var _0x50515b=[];var _0x873f9d=squel[_0xd86d('0x48')]()[_0xd86d('0x49')]('id')[_0xd86d('0x49')](_0xd86d('0x2c'))[_0xd86d('0x49')](_0xd86d('0x4a'))['from'](_0xd86d('0x4b'));var _0x29183f=squel['select']()['field']('u.id')[_0xd86d('0x49')](_0xd86d('0x4c'))['field'](_0xd86d('0x4d'))[_0xd86d('0x4e')](_0xd86d('0x4f'),'ui')[_0xd86d('0x50')](_0xd86d('0x51'),'u',_0xd86d('0x52'));var _0x263cf4=squel['select']()['from'](_0xd86d('0x53'),'i')[_0xd86d('0x50')]('cm_contacts','c',_0xd86d('0x54'))[_0xd86d('0x50')](_0xd86d('0x51'),'o',_0xd86d('0x55'))['left_join'](_0xd86d('0x56'),'a',_0xd86d('0x57'))[_0xd86d('0x50')]('whatsapp_messages','me',_0xd86d('0x58'))[_0xd86d('0x50')](_0xd86d('0x59'),'it','it.WhatsappInteractionId\x20=\x20i.id')[_0xd86d('0x50')](_0xd86d('0x4b'),'t',_0xd86d('0x5a'));var _0x53ca96=squel[_0xd86d('0x5b')]();var _0xf007cc=[];var _0x537df3=squel[_0xd86d('0x5b')]();var _0x387cdd;if(_0x581f1c[_0xd86d('0x3d')][_0xd86d('0x5c')]){_0x387cdd=as[_0xd86d('0x5d')](_0x581f1c['query']['search']);var _0x33963a=_0x387cdd[_0xd86d('0x5e')];for(var _0x1e6b4a=0x0;_0x1e6b4a<_0x387cdd[_0xd86d('0x5f')][_0xd86d('0x40')];_0x1e6b4a++){var _0x3f5d98=_0x387cdd[_0xd86d('0x5f')][_0x1e6b4a];var _0x55a7c5='i';var _0x477b3e=_[_0xd86d('0x60')](_0x20a77f,[_0xd86d('0x2c'),_0x3f5d98['field']]);if(!_0x477b3e){switch(_0x3f5d98[_0xd86d('0x49')]){case _0xd86d('0x61'):if(_0x3f5d98[_0xd86d('0x62')]==0x1){_0x263cf4[_0xd86d('0x63')]('`'+_0x3f5d98[_0xd86d('0x49')]+_0xd86d('0x64'));}else{_0x263cf4[_0xd86d('0x63')]('`'+_0x3f5d98['field']+_0xd86d('0x65'));}break;case _0xd86d('0x66'):if(_0x3f5d98[_0xd86d('0x67')]===_0xd86d('0x68')){if(_0x3f5d98['value']['split']('\x20')[_0xd86d('0x40')]>0x1){_0x53ca96[_0x33963a](_0xd86d('0x69'),qs[_0xd86d('0x6a')](_0x3f5d98[_0xd86d('0x62')]),null);}else{var _0x1184bf='%'+_0x3f5d98[_0xd86d('0x62')]+'%';_0x53ca96[_0x33963a](_0xd86d('0x6b'),_0x1184bf,_0x1184bf,_0x1184bf);}}else{_0x477b3e=_[_0xd86d('0x60')](_0x20a77f,[_0xd86d('0x2c'),_0xd86d('0x6c')]);_0x3f5d98[_0xd86d('0x49')]=_0xd86d('0x6c');_0x5cce59=as[_0xd86d('0x6d')](_0x55a7c5,_0x477b3e[_0xd86d('0x39')],_0x3f5d98);_0x53ca96[_0x33963a](_0x5cce59[_0xd86d('0x6e')],_0x5cce59[_0xd86d('0x62')][_0xd86d('0x6f')],_0x5cce59['value'][_0xd86d('0x1f')]);}break;case _0xd86d('0x70'):var _0x3f2d10=_0x3f5d98[_0xd86d('0x62')][_0xd86d('0x31')](',')[_0xd86d('0x2f')](function(_0x389b50){return Number(_0x389b50);});_0x3f2d10[_0xd86d('0x32')](function(_0x4018be){_0x537df3['or'](_0xd86d('0x71'),'%,'+_0x4018be+',%');});_0xf007cc=_['union'](_0xf007cc,_0x3f2d10);break;case _0xd86d('0x72'):if(_0x3f5d98[_0xd86d('0x67')]===_0xd86d('0x68')){_0x53ca96[_0x33963a](_0xd86d('0x73'),'%'+_0x3f5d98[_0xd86d('0x62')]+'%',null);}else{_0x477b3e=_['find'](_0x20a77f,[_0xd86d('0x2c'),_0xd86d('0x74')]);_0x3f5d98['field']=_0xd86d('0x74');_0x5cce59=as['buildExpression'](_0x55a7c5,_0x477b3e['type'],_0x3f5d98);_0x53ca96[_0x33963a](_0x5cce59['text'],_0x5cce59[_0xd86d('0x62')][_0xd86d('0x6f')],_0x5cce59['value'][_0xd86d('0x1f')]);}break;case _0xd86d('0x75'):_0x5cce59=as[_0xd86d('0x6d')]('me',null,_0x3f5d98);_0x53ca96[_0x33963a](_0x5cce59[_0xd86d('0x6e')],_0x5cce59[_0xd86d('0x62')]['start'],_0x5cce59[_0xd86d('0x62')][_0xd86d('0x1f')]);break;}}else{var _0x5cce59=as[_0xd86d('0x6d')](_0x55a7c5,_0x477b3e['type'],_0x3f5d98);_0x53ca96[_0x33963a](_0x5cce59[_0xd86d('0x6e')],_0x5cce59[_0xd86d('0x62')]['start'],_0x5cce59[_0xd86d('0x62')][_0xd86d('0x1f')]);}}}else{var _0xc29719=_(_0x581f1c[_0xd86d('0x3d')])[_0xd86d('0x3b')]()[_0xd86d('0x2f')](function(_0xd14708){return _[_0xd86d('0x76')](_0x20a77f,[_0xd86d('0x2c'),_0xd14708])?_0xd14708:undefined;})[_0xd86d('0x77')]()['value']();if(!_['isEmpty'](_0xc29719)){_0xc29719[_0xd86d('0x32')](function(_0x6a1cd5){if(_0x6a1cd5==='WhatsappAccountId'){_0x263cf4[_0xd86d('0x45')]('i.WhatsappAccountId\x20IN\x20?',[][_0xd86d('0x78')](_0x581f1c[_0xd86d('0x3d')][_0x6a1cd5]));}else if(_0x6a1cd5==='createdAt'){var _0x138af7=JSON[_0xd86d('0x79')](_0x581f1c['query'][_0x6a1cd5])[_0xd86d('0x7a')];var _0x29e8f0=JSON['parse'](_0x581f1c[_0xd86d('0x3d')][_0x6a1cd5])[_0xd86d('0x7b')];_0x263cf4[_0xd86d('0x45')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x138af7,_0x29e8f0);}else{if(_0x581f1c[_0xd86d('0x3d')][_0x6a1cd5]===_0xd86d('0x7c')){_0x263cf4[_0xd86d('0x45')]('i.'+_0x6a1cd5+_0xd86d('0x7d'));}else{_0x263cf4['where']('i.'+_0x6a1cd5+_0xd86d('0x7e'),_0x581f1c['query'][_0x6a1cd5]);}}});}if(_0x581f1c['query']['read']){if(_0x581f1c[_0xd86d('0x3d')][_0xd86d('0x7f')]==0x1){_0x263cf4['having']('`unreadMessages`\x20=\x200');}else{_0x263cf4['having'](_0xd86d('0x80'));}}if(_0x581f1c[_0xd86d('0x3d')][_0xd86d('0x81')]){_0xf007cc=_[_0xd86d('0x82')](_0x581f1c['query'][_0xd86d('0x81')])?_0x581f1c[_0xd86d('0x3d')][_0xd86d('0x81')]:new Array(_0x581f1c[_0xd86d('0x3d')][_0xd86d('0x81')]);_0xf007cc[_0xd86d('0x32')](function(_0x2b50cd){_0x537df3['or'](_0xd86d('0x71'),'%,'+_0x2b50cd+',%');});}if(_0x581f1c[_0xd86d('0x3d')][_0xd86d('0x83')]){var _0x3a449a=_0x581f1c[_0xd86d('0x3d')][_0xd86d('0x83')][_0xd86d('0x84')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0xd86d('0x85')](_0x3a449a)){_0x53ca96['or']('i.id\x20LIKE\x20?',_0x3a449a+'%')['or'](_0xd86d('0x86'),_0x3a449a+'%');}else{_0x53ca96['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xd86d('0x6a')](_0x3a449a))['or'](_0xd86d('0x87'),_0x3a449a+'%');}}}_0x263cf4['where'](_0x53ca96);_0x263cf4['group'](_0xd86d('0x88'));var _0x2eb4fa={'type':db[_0xd86d('0x89')]['QueryTypes']['SELECT'],'raw':!![]};var _0x32ad46=_0x263cf4['clone']();_0x32ad46[_0xd86d('0x49')](_0xd86d('0x88'));_0x32ad46[_0xd86d('0x49')](_0xd86d('0x8a'),'unreadMessages');if(_0x4cd9d4[_0xd86d('0x43')]){_0x4cd9d4[_0xd86d('0x43')]['forEach'](function(_0x24426f){var _0x533de2=_0x24426f[0x0]===_0xd86d('0x8b')?_0x24426f[0x0]:'i.'+_0x24426f[0x0];_0x263cf4[_0xd86d('0x43')](_0x533de2,_0x24426f[0x1]===_0xd86d('0x8c')?![]:!![]);});}if(!_['isEmpty'](_0xf007cc)){_0x263cf4['having'](_0x537df3);_0x32ad46[_0xd86d('0x45')](_0xd86d('0x8d'),_0xf007cc);}BPromise[_0xd86d('0x8e')]()[_0xd86d('0x34')](function(){if(!_0x387cdd){if(_0x581f1c['query'][_0xd86d('0x8f')])return;_0x32ad46[_0xd86d('0x45')]('i.WhatsappAccountId\x20IS\x20NOT\x20NULL');_0x263cf4[_0xd86d('0x45')](_0xd86d('0x90'));return;}if(_0x581f1c[_0xd86d('0x91')][_0xd86d('0x92')]!==_0xd86d('0x93'))return;return _0x581f1c[_0xd86d('0x91')][_0xd86d('0x94')]({'attributes':['id'],'raw':!![]})[_0xd86d('0x34')](function(_0x4e1771){if(_['isEmpty'](_0x4e1771)){_0x32ad46[_0xd86d('0x45')](_0xd86d('0x95'));_0x263cf4['where'](_0xd86d('0x95'));}else{_0x32ad46['where'](_0xd86d('0x96'),_[_0xd86d('0x2f')](_0x4e1771,'id'));_0x263cf4[_0xd86d('0x45')]('i.WhatsappAccountId\x20IN\x20?',_[_0xd86d('0x2f')](_0x4e1771,'id'));}});})['then'](function(){if(_0x581f1c['user']['role']==='agent'&&!_0x387cdd&&!_0x581f1c[_0xd86d('0x3d')][_0xd86d('0x8f')])return[];return db['sequelize'][_0xd86d('0x3d')](_0x32ad46[_0xd86d('0x97')](),_0x2eb4fa);})[_0xd86d('0x34')](function(_0x3fdfc5){_0x479ac8['count']=_0x3fdfc5[_0xd86d('0x40')];if(_0x479ac8[_0xd86d('0x23')]===0x0)return[];return db[_0xd86d('0x98')][_0xd86d('0x3d')](_0x873f9d[_0xd86d('0x97')](),_0x2eb4fa)[_0xd86d('0x34')](function(_0x1f4286){_0x50515b=_[_0xd86d('0x99')](_0x1f4286,'id');_0x2eb4fa=_[_0xd86d('0x9a')](_0x2eb4fa,{'model':db[_0xd86d('0x37')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x581f1c[_0xd86d('0x3d')][_0xd86d('0x3f')]){_0x4cd9d4[_0xd86d('0x3e')][_0xd86d('0x32')](function(_0xc706dd){_0x263cf4['field']('i.'+_0xc706dd);});}else{_0x263cf4['field'](_0xd86d('0x8a'),'unreadMessages');_0x263cf4[_0xd86d('0x49')](_0xd86d('0x9b'),_0xd86d('0x9c'));_0x263cf4['field'](_0xd86d('0x9d'),_0xd86d('0x9e'));_0x263cf4['field'](_0xd86d('0x9f'),_0xd86d('0x8b'));_0x263cf4['field'](_0xd86d('0xa0'));_0x263cf4[_0xd86d('0x49')]('c.firstName',_0xd86d('0xa1'));_0x263cf4[_0xd86d('0x49')](_0xd86d('0xa2'),'Contact.lastName');_0x263cf4[_0xd86d('0x49')](_0xd86d('0xa3'),_0xd86d('0xa4'));_0x263cf4[_0xd86d('0x49')](_0xd86d('0xa5'),'Contact.phone');_0x263cf4[_0xd86d('0x49')]('c.mobile',_0xd86d('0xa6'));_0x263cf4[_0xd86d('0x49')]('c.fax','Contact.fax');_0x263cf4['field']('o.fullname','Owner.fullname');_0x263cf4[_0xd86d('0x49')](_0xd86d('0xa7'),_0xd86d('0xa8'));_0x263cf4[_0xd86d('0x49')](_0xd86d('0xa9'),_0xd86d('0x33'));}if(_0x4cd9d4[_0xd86d('0x22')])_0x263cf4[_0xd86d('0x22')](_0x4cd9d4[_0xd86d('0x22')]);if(_0x4cd9d4['offset'])_0x263cf4[_0xd86d('0x24')](_0x4cd9d4[_0xd86d('0x24')]);return db[_0xd86d('0x98')]['query'](_0x263cf4[_0xd86d('0x97')](),_0x2eb4fa);})['then'](function(_0x5ba520){if(_0x5ba520['length']>0x0)_0x29183f['where'](_0xd86d('0xaa'),_[_0xd86d('0x2f')](_0x5ba520,'id'));return db['sequelize'][_0xd86d('0x3d')](_0x29183f[_0xd86d('0x97')](),_0x2eb4fa)['then'](function(_0x173c3d){var _0x3585a1=_[_0xd86d('0xab')](_0x173c3d,_0xd86d('0xac'));var _0xeeeedd=[];_0x5ba520['forEach'](function(_0x34469a){_0xeeeedd[_0xd86d('0xad')](updateWhatsappInteraction(_0x34469a,_0x50515b,_0x3585a1));});return BPromise[_0xd86d('0xae')](_0xeeeedd);});});})[_0xd86d('0x34')](function(_0x3d2eda){_0x479ac8['rows']=_0x3d2eda;return _0x479ac8;})[_0xd86d('0x34')](respondWithFilteredResult(_0x1325dc,_0x4cd9d4))['catch'](handleError(_0x1325dc,null));};exports[_0xd86d('0xaf')]=function(_0x3b66f1,_0x404564){var _0x4e8229={'raw':![],'where':{'id':_0x3b66f1[_0xd86d('0xb0')]['id']}},_0x250244={};_0x250244[_0xd86d('0x3a')]=_[_0xd86d('0x3b')](db[_0xd86d('0x37')]['rawAttributes']);_0x250244[_0xd86d('0x3d')]=_[_0xd86d('0x3b')](_0x3b66f1[_0xd86d('0x3d')]);_0x250244[_0xd86d('0x46')]=_[_0xd86d('0x3c')](_0x250244[_0xd86d('0x3a')],_0x250244[_0xd86d('0x3d')]);_0x4e8229[_0xd86d('0x3e')]=_[_0xd86d('0x3c')](_0x250244[_0xd86d('0x3a')],qs[_0xd86d('0x3f')](_0x3b66f1[_0xd86d('0x3d')]['fields']));_0x4e8229['attributes']=_0x4e8229[_0xd86d('0x3e')]['length']?_0x4e8229[_0xd86d('0x3e')]:_0x250244[_0xd86d('0x3a')];if(_0x3b66f1[_0xd86d('0x3d')]['includeAll']){_0x4e8229[_0xd86d('0xb1')]=[{'all':!![]}];}_0x4e8229=_['merge']({},_0x4e8229,_0x3b66f1['options']);return db[_0xd86d('0x37')]['find'](_0x4e8229)[_0xd86d('0x34')](handleEntityNotFound(_0x404564,null))[_0xd86d('0x34')](respondWithResult(_0x404564,null))[_0xd86d('0x35')](handleError(_0x404564,null));};exports[_0xd86d('0xb2')]=function(_0x3d48d0,_0x1ba996){return db[_0xd86d('0x37')][_0xd86d('0xb2')](_0x3d48d0[_0xd86d('0x75')],{})['then'](respondWithResult(_0x1ba996,0xc9))[_0xd86d('0x35')](handleError(_0x1ba996,null));};exports[_0xd86d('0x29')]=function(_0x59c321,_0x486335){if(_0x59c321[_0xd86d('0x75')]['id']){delete _0x59c321[_0xd86d('0x75')]['id'];}return db[_0xd86d('0x37')]['find']({'where':{'id':_0x59c321[_0xd86d('0xb0')]['id']}})['then'](handleEntityNotFound(_0x486335,null))[_0xd86d('0x34')](saveUpdates(_0x59c321[_0xd86d('0x75')],null))['then'](respondWithResult(_0x486335,null))[_0xd86d('0x35')](handleError(_0x486335,null));};exports['destroy']=function(_0xdd0a71,_0x4f5a90){return db[_0xd86d('0x37')][_0xd86d('0x60')]({'where':{'id':_0xdd0a71[_0xd86d('0xb0')]['id']}})[_0xd86d('0x34')](handleEntityNotFound(_0x4f5a90,null))[_0xd86d('0x34')](removeEntity(_0x4f5a90,null))[_0xd86d('0x35')](handleError(_0x4f5a90,null));};exports[_0xd86d('0xb3')]=function(_0xfff635,_0x532756){return db['WhatsappInteraction'][_0xd86d('0xb3')]()['then'](respondWithResult(_0x532756,null))[_0xd86d('0x35')](handleError(_0x532756,null));};exports[_0xd86d('0xb4')]=function(_0x114bb1,_0x205d01,_0x377653){return db[_0xd86d('0xb5')][_0xd86d('0x60')]({'where':{'id':_0x114bb1[_0xd86d('0xb0')]['id']}})[_0xd86d('0x34')](handleEntityNotFound(_0x205d01,null))[_0xd86d('0x34')](function(_0x1b0532){if(_0x1b0532){return _0x1b0532[_0xd86d('0xb4')](_0x114bb1[_0xd86d('0x75')]['ids'],_[_0xd86d('0xb6')](_0x114bb1['body'],['ids','id'])||{});}})[_0xd86d('0x34')](respondWithResult(_0x205d01,null))[_0xd86d('0x35')](handleError(_0x205d01,null));};exports[_0xd86d('0xb7')]=function(_0x317f9a,_0x2be092,_0x58ad81){var _0x2deaaf={'raw':![],'where':{}};var _0x58f65c={};var _0x3a5869={'count':0x0,'rows':[]};return db[_0xd86d('0x37')]['findOne']({'where':{'id':_0x317f9a[_0xd86d('0xb0')]['id']}})[_0xd86d('0x34')](handleEntityNotFound(_0x2be092,null))['then'](function(_0x3a1616){if(_0x3a1616){_0x58f65c[_0xd86d('0x3a')]=_[_0xd86d('0x3b')](db[_0xd86d('0xb5')][_0xd86d('0x38')]);_0x58f65c['query']=_['keys'](_0x317f9a['query']);_0x58f65c['filters']=_[_0xd86d('0x3c')](_0x58f65c[_0xd86d('0x3a')],_0x58f65c[_0xd86d('0x3d')]);_0x2deaaf[_0xd86d('0x3e')]=_['intersection'](_0x58f65c[_0xd86d('0x3a')],qs[_0xd86d('0x3f')](_0x317f9a[_0xd86d('0x3d')]['fields']));_0x2deaaf[_0xd86d('0x3e')]=_0x2deaaf['attributes'][_0xd86d('0x40')]?_0x2deaaf['attributes']:_0x58f65c[_0xd86d('0x3a')];if(!_0x317f9a['query'][_0xd86d('0x41')]('nolimit')){_0x2deaaf[_0xd86d('0x22')]=qs[_0xd86d('0x22')](_0x317f9a[_0xd86d('0x3d')][_0xd86d('0x22')]);_0x2deaaf[_0xd86d('0x24')]=qs['offset'](_0x317f9a[_0xd86d('0x3d')][_0xd86d('0x24')]);}_0x2deaaf[_0xd86d('0x43')]=qs[_0xd86d('0x44')](_0x317f9a['query'][_0xd86d('0x44')]);_0x2deaaf['where']=qs['filters'](_['pick'](_0x317f9a[_0xd86d('0x3d')],_0x58f65c[_0xd86d('0x46')]));_0x2deaaf[_0xd86d('0x45')][_0xd86d('0xac')]=_0x3a1616['id'];if(_0x317f9a['query'][_0xd86d('0x83')]){_0x2deaaf[_0xd86d('0x45')]=_['merge'](_0x2deaaf['where'],{'$or':_[_0xd86d('0x2f')](_0x2deaaf['attributes'],function(_0x32ad1a){var _0x4abe69={};_0x4abe69[_0x32ad1a]={'$like':'%'+_0x317f9a[_0xd86d('0x3d')][_0xd86d('0x83')]+'%'};return _0x4abe69;})});}if(_0x317f9a['query'][_0xd86d('0x7a')]){var _0x1b0b86=_0x317f9a[_0xd86d('0x3d')]['$gte'][_0xd86d('0x31')](',');var _0x55bccd={};_0x55bccd[_0x1b0b86[0x0]]={'$gte':moment(_0x1b0b86[0x1])[_0xd86d('0xb8')](_0xd86d('0xb9'))};_0x2deaaf[_0xd86d('0x45')]=_[_0xd86d('0x9a')](_0x2deaaf[_0xd86d('0x45')],_0x55bccd);}_0x2deaaf=_['merge']({},_0x2deaaf,_0x317f9a[_0xd86d('0xba')]);return db[_0xd86d('0xb5')][_0xd86d('0x23')]({'where':_0x2deaaf[_0xd86d('0x45')]})['then'](function(_0xe0e96c){_0x3a5869[_0xd86d('0x23')]=_0xe0e96c;if(_0x317f9a[_0xd86d('0x3d')][_0xd86d('0xbb')]){_0x2deaaf[_0xd86d('0xb1')]=[{'all':!![]}];}return db[_0xd86d('0xb5')]['findAll'](_0x2deaaf);})[_0xd86d('0x34')](function(_0x3bbcfd){_0x3a5869['rows']=_0x3bbcfd;return _0x3a5869;});}})['then'](respondWithFilteredResult(_0x2be092,_0x2deaaf))['catch'](handleError(_0x2be092,null));};exports['addTags']=function(_0x5d1025,_0x44c5eb,_0x36e8b7){return db[_0xd86d('0x37')][_0xd86d('0x60')]({'where':{'id':_0x5d1025[_0xd86d('0xb0')]['id']}})['then'](handleEntityNotFound(_0x44c5eb,null))[_0xd86d('0x34')](function(_0x582b6d){if(_0x582b6d){return _0x582b6d[_0xd86d('0xbc')](_0x5d1025[_0xd86d('0x75')][_0xd86d('0xbd')],_[_0xd86d('0xb6')](_0x5d1025['body'],[_0xd86d('0xbd'),'id'])||{})['spread'](function(){return db[_0xd86d('0x70')][_0xd86d('0xbe')]({'attributes':['id',_0xd86d('0x2c'),_0xd86d('0x4a')],'where':{'id':_0x5d1025[_0xd86d('0x75')][_0xd86d('0xbd')]}});})[_0xd86d('0x34')](function(_0x109b9a){socket[_0xd86d('0xbf')](_0xd86d('0xc0'),{'id':Number(_0x5d1025[_0xd86d('0xb0')]['id']),'tags':_0x109b9a||[]});return{'id':Number(_0x5d1025[_0xd86d('0xb0')]['id']),'tags':_0x109b9a||[]};});}})[_0xd86d('0x34')](respondWithResult(_0x44c5eb,null))['catch'](handleError(_0x44c5eb,null));};exports['removeTags']=function(_0x3bf82f,_0x3e34a3,_0x315458){return db[_0xd86d('0x37')]['find']({'where':{'id':_0x3bf82f[_0xd86d('0xb0')]['id']}})[_0xd86d('0x34')](handleEntityNotFound(_0x3e34a3,null))['then'](function(_0x30767a){if(_0x30767a){return _0x30767a[_0xd86d('0xc1')](_0x3bf82f[_0xd86d('0x3d')]['ids']);}})[_0xd86d('0x34')](respondWithStatusCode(_0x3e34a3,null))['catch'](handleError(_0x3e34a3,null));};exports[_0xd86d('0xc2')]=function(_0xafd8f0,_0x4977b8){var _0x5f51c6=moment()[_0xd86d('0xc3')]()[_0xd86d('0x97')]();var _0x23196e=path['join'](config['root'],_0xd86d('0xc4'),'files',_0xd86d('0xc5'));var _0x961bf7=path['join'](config['root'],_0xd86d('0xc4'),'files','attachments');var _0x4fb58d=path['join'](_0x23196e,_0x5f51c6);var _0x1c3c0c=util[_0xd86d('0xb8')](_0xd86d('0xc6'),_0xafd8f0[_0xd86d('0xb0')]['id'],_0x5f51c6);var _0x5bc9a8=path[_0xd86d('0xc7')](_0x23196e,_0x1c3c0c);var _0x6d3e17=[];_0x6d3e17['push']({'model':db[_0xd86d('0x72')],'as':_0xd86d('0x72'),'attributes':['id',_0xd86d('0xc8')],'raw':!![]});_0x6d3e17[_0xd86d('0xad')]({'model':db[_0xd86d('0xc9')],'as':_0xd86d('0x66'),'attributes':['id',_0xd86d('0xca'),_0xd86d('0xcb')],'raw':!![]});if(_0xafd8f0[_0xd86d('0x3d')]['attachments']){_0x6d3e17[_0xd86d('0xad')]({'model':db[_0xd86d('0xcc')],'as':_0xd86d('0xcc'),'raw':!![]});}var _0x497793=[{'model':db[_0xd86d('0xb5')],'as':_0xd86d('0xcd'),'attributes':['id',_0xd86d('0x75'),'createdAt',_0xd86d('0xce'),_0xd86d('0xcf'),_0xd86d('0x7f')],'include':_0x6d3e17}];_0x497793['push']({'model':db['WhatsappAccount'],'as':_0xd86d('0xd0'),'attributes':['id','name']});_0x497793['push']({'model':db[_0xd86d('0x72')],'as':_0xd86d('0xd1'),'attributes':['id',_0xd86d('0xc8')]});return db['WhatsappInteraction'][_0xd86d('0x60')]({'where':{'id':_0xafd8f0[_0xd86d('0xb0')]['id']},'include':_0x497793})[_0xd86d('0x34')](handleEntityNotFound(_0x4977b8,null))[_0xd86d('0x34')](function(_0x5b4840){if(_0x5b4840){var _0x1c7886=_0x5b4840[_0xd86d('0xd2')]({'plain':!![]});fs['mkdirSync'](_0x4fb58d);var _0x170b44={'channel':_0xd86d('0xd3'),'account':_0x1c7886[_0xd86d('0xd0')][_0xd86d('0x2c')],'agent':_0x1c7886['Owner']?_0x1c7886[_0xd86d('0xd1')]['fullname']:_0xd86d('0xd4'),'createdAt':moment(_0x1c7886[_0xd86d('0xd5')])[_0xd86d('0xb8')](_0xd86d('0xb9'))[_0xd86d('0x97')](),'closedAt':_0x1c7886[_0xd86d('0xd6')]?moment(_0x1c7886['closedAt'])[_0xd86d('0xb8')](_0xd86d('0xb9'))[_0xd86d('0x97')]():'','disposition':_0x1c7886[_0xd86d('0xd7')],'messages':_(_0x1c7886[_0xd86d('0xcd')])['filter']({'secret':![]})[_0xd86d('0x2f')](function(_0x3980e1){if(_0x3980e1[_0xd86d('0xcc')]){var _0x4631e7=path[_0xd86d('0xc7')](_0x961bf7,_0x3980e1[_0xd86d('0xcc')]['basename']);if(fs['existsSync'](_0x4631e7)){fs[_0xd86d('0xd8')](_0x4631e7)[_0xd86d('0xd9')](fs[_0xd86d('0xda')](path[_0xd86d('0xc7')](_0x4fb58d,_0x3980e1[_0xd86d('0xcc')][_0xd86d('0xdb')])));}}return{'date':moment(_0x3980e1['createdAt'])[_0xd86d('0xb8')](_0xd86d('0xb9'))['toString'](),'sender':_0x3980e1['direction']===_0xd86d('0xdc')?_0x3980e1[_0xd86d('0x72')]?_0x3980e1[_0xd86d('0x72')][_0xd86d('0xc8')]:_0xd86d('0xdd'):_0x3980e1[_0xd86d('0x66')][_0xd86d('0xca')]+(_0x3980e1[_0xd86d('0x66')][_0xd86d('0xcb')]?'\x20'+_0x3980e1[_0xd86d('0x66')][_0xd86d('0xcb')]:''),'body':_0x3980e1['Attachment']?_0x3980e1['Attachment'][_0xd86d('0xdb')]:_0x3980e1['body'],'direction':_0x3980e1[_0xd86d('0xce')]==='out'?'A':'C','secret':_0x3980e1[_0xd86d('0xcf')],'read':_0x3980e1[_0xd86d('0x7f')],'attachment':_0x3980e1[_0xd86d('0xcc')]};})[_0xd86d('0x62')]()};return ejs[_0xd86d('0xde')](path[_0xd86d('0xc7')](config[_0xd86d('0xdf')],'server','views','downloadInteraction.ejs'),{'interaction':_0x170b44})[_0xd86d('0x34')](function(_0x199d67){var _0x50994b=path['join'](_0x4fb58d,_0xd86d('0xe0')+_0x1c7886['id']+'-'+_0x5f51c6+_0xd86d('0xe1'));var _0x440879={'path':_0x50994b,'channel':_0xd86d('0xd3'),'interactionId':_0x1c7886['id']};return pdf[_0xd86d('0xe2')](_0x199d67,_0x440879);})[_0xd86d('0x34')](function(){return new BPromise(function(_0x3c764d,_0x1ec0e5){zipdir(_0x4fb58d,{'saveTo':_0x5bc9a8},function(_0xcc07b4,_0x3f113c){if(_0xcc07b4)return _0x1ec0e5(_0xcc07b4);return _0x3c764d(_0x3f113c);});})[_0xd86d('0x34')](function(){return new BPromise(function(_0x849db8,_0xc7001a){rimraf(_0x4fb58d,function(_0x53edb3){if(_0x53edb3)_0xc7001a(_0x53edb3);return _0x849db8();});});})[_0xd86d('0x34')](function(){return _0x4977b8[_0xd86d('0xc2')](_0x5bc9a8,_0x1c3c0c,function(_0x18577a){if(_0x18577a){console[_0xd86d('0xe3')](_0xd86d('0xe4'),_0x18577a);}else{fs['unlinkSync'](_0x5bc9a8);}});});});}else{return _0x4977b8['sendStatus'](0xc8);}})[_0xd86d('0x35')](handleError(_0x4977b8,null));}; \ No newline at end of file +var _0x9009=['eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../components/export/pdf','api','../../config/utils','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./whatsappInteraction.socket','register','sendStatus','status','end','offset','limit','count','Content-Range','json','apply','reject','save','destroy','error','stack','send','Users','fullname','TagIds','Tags','split','forEach','push','then','catch','index','WhatsappInteraction','rawAttributes','fieldName','type','key','map','name','query','keys','filters','model','intersection','fields','attributes','length','nolimit','order','sort','where','pick','select','field','color','from','u.id','u.fullname','user_has_whatsapp_interactions','users','u.id\x20=\x20ui.UserId','left_join','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','a.id\x20=\x20i.WhatsappAccountId','me.WhatsappInteractionId\x20=\x20i.id','it.WhatsappInteractionId\x20=\x20i.id','tools_tags','t.id\x20=\x20it.TagId','expr','search','sqlOperator','conditions','unreadMessages','value','`\x20=\x200','having','`\x20>\x200','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','find','ContactId','buildExpression','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','body','some','isEmpty','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','i.id','Sequelize','QueryTypes','contactName','DESC','t.id\x20IN\x20?','resolve','WhatsappAccountId','i.WhatsappAccountId\x20IS\x20NOT\x20NULL','agent','getWhatsappAccounts','user','role','sequelize','toString','keyBy','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.firstName','c.lastName','c.email','Contact.email','c.phone','Contact.mobile','c.fax','Contact.fax','o.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.WhatsappInteractionId\x20IN\x20?','groupBy','WhatsappInteractionId','rows','show','params','includeAll','include','merge','options','create','describe','addMessage','WhatsappMessage','ids','findOne','hasOwnProperty','format','YYYY-MM-DD\x20HH:mm:ss','findAll','addTags','omit','spread','emit','whatsappInteractionTags:save','removeTags','download','unix','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','User','CmContact','firstName','lastName','Attachment','Messages','direction','secret','WhatsappAccount','Account','Whatsapp','Owner','closed','closedAt','disposition','basename','existsSync','createReadStream','pipe','createWriteStream','out','System','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','log'];(function(_0x1127d5,_0xb2967){var _0x2269b5=function(_0x4304a2){while(--_0x4304a2){_0x1127d5['push'](_0x1127d5['shift']());}};_0x2269b5(++_0xb2967);}(_0x9009,0x1d4));var _0x9900=function(_0x54effc,_0x58f6e4){_0x54effc=_0x54effc-0x0;var _0xf045b2=_0x9009[_0x54effc];return _0xf045b2;};'use strict';var emlformat=require(_0x9900('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9900('0x1'));var jsonpatch=require(_0x9900('0x2'));var rp=require('request-promise');var moment=require(_0x9900('0x3'));var BPromise=require(_0x9900('0x4'));var Mustache=require(_0x9900('0x5'));var util=require(_0x9900('0x6'));var path=require('path');var sox=require(_0x9900('0x7'));var csv=require(_0x9900('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9900('0x9'));var squel=require(_0x9900('0xa'));var crypto=require('crypto');var jsforce=require(_0x9900('0xb'));var deskjs=require(_0x9900('0xc'));var toCsv=require(_0x9900('0x8'));var querystring=require(_0x9900('0xd'));var Papa=require('papaparse');var Redis=require(_0x9900('0xe'));var authService=require(_0x9900('0xf'));var qs=require(_0x9900('0x10'));var as=require(_0x9900('0x11'));var pdf=require(_0x9900('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x9900('0x13'));var utils=require(_0x9900('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x9900('0x15'))['db'];config['redis']=_[_0x9900('0x16')](config[_0x9900('0x17')],{'host':_0x9900('0x18'),'port':0x18eb});var socket=require(_0x9900('0x19'))(new Redis(config[_0x9900('0x17')]));require(_0x9900('0x1a'))[_0x9900('0x1b')](socket);function respondWithStatusCode(_0x7cab33,_0x126c36){_0x126c36=_0x126c36||0xcc;return function(_0x209b4d){if(_0x209b4d){return _0x7cab33[_0x9900('0x1c')](_0x126c36);}return _0x7cab33[_0x9900('0x1d')](_0x126c36)[_0x9900('0x1e')]();};}function respondWithResult(_0x3517b0,_0x356284){_0x356284=_0x356284||0xc8;return function(_0x1bacf3){if(_0x1bacf3){return _0x3517b0[_0x9900('0x1d')](_0x356284)['json'](_0x1bacf3);}};}function respondWithFilteredResult(_0x51839f,_0x1017a5){return function(_0x22352b){if(_0x22352b){var _0x1bd7a3=typeof _0x1017a5[_0x9900('0x1f')]==='undefined'&&typeof _0x1017a5[_0x9900('0x20')]==='undefined';var _0x5496ca=_0x22352b[_0x9900('0x21')];var _0x4e1b84=_0x1bd7a3?0x0:_0x1017a5[_0x9900('0x1f')];var _0x596eff=_0x1bd7a3?_0x22352b['count']:_0x1017a5[_0x9900('0x1f')]+_0x1017a5[_0x9900('0x20')];var _0x380b07;if(_0x596eff>=_0x5496ca){_0x596eff=_0x5496ca;_0x380b07=0xc8;}else{_0x380b07=0xce;}_0x51839f[_0x9900('0x1d')](_0x380b07);return _0x51839f['set'](_0x9900('0x22'),_0x4e1b84+'-'+_0x596eff+'/'+_0x5496ca)[_0x9900('0x23')](_0x22352b);}return null;};}function patchUpdates(_0x23e9f1){return function(_0x888599){try{jsonpatch[_0x9900('0x24')](_0x888599,_0x23e9f1,!![]);}catch(_0x5368bf){return BPromise[_0x9900('0x25')](_0x5368bf);}return _0x888599[_0x9900('0x26')]();};}function saveUpdates(_0x49131a,_0x3bfb16){return function(_0x337b6a){if(_0x337b6a){return _0x337b6a['update'](_0x49131a)['then'](function(_0x43ed24){return _0x43ed24;});}return null;};}function removeEntity(_0x2ac147,_0x5dbcce){return function(_0x285d51){if(_0x285d51){return _0x285d51[_0x9900('0x27')]()['then'](function(){_0x2ac147[_0x9900('0x1d')](0xcc)[_0x9900('0x1e')]();});}};}function handleEntityNotFound(_0x23b696,_0x13bad6){return function(_0xaa7daa){if(!_0xaa7daa){_0x23b696['sendStatus'](0x194);}return _0xaa7daa;};}function handleError(_0x40fa92,_0x44d775){_0x44d775=_0x44d775||0x1f4;return function(_0x10fbae){logger[_0x9900('0x28')](_0x10fbae[_0x9900('0x29')]);if(_0x10fbae['name']){delete _0x10fbae['name'];}_0x40fa92['status'](_0x44d775)[_0x9900('0x2a')](_0x10fbae);};}function getInteractionUsers(_0x3e9a9a,_0x4ef405){return new BPromise(function(_0x392593,_0x6fb5ab){try{if(_0x4ef405[_0x3e9a9a['id']]){_0x3e9a9a[_0x9900('0x2b')]=_['map'](_0x4ef405[_0x3e9a9a['id']],function(_0x4aa0f8){return{'id':_0x4aa0f8['id'],'fullname':_0x4aa0f8[_0x9900('0x2c')]};});}}catch(_0x354303){_0x6fb5ab(_0x354303);}_0x392593(_0x3e9a9a);});}function getInteractionTags(_0xd2ae52,_0x3d7b26){return new BPromise(function(_0x4a4a02,_0x4dc0e9){try{if(_0xd2ae52[_0x9900('0x2d')]){_0xd2ae52[_0x9900('0x2e')]=[];_0xd2ae52[_0x9900('0x2d')][_0x9900('0x2f')](',')[_0x9900('0x30')](function(_0x135fb5){_0xd2ae52[_0x9900('0x2e')][_0x9900('0x31')](_0x3d7b26[_0x135fb5]);});}delete _0xd2ae52[_0x9900('0x2d')];}catch(_0x3b93d0){_0x4dc0e9(_0x3b93d0);}_0x4a4a02(_0xd2ae52);});}function updateWhatsappInteraction(_0x3ff7e5,_0x29130c,_0x412e21){return new BPromise(function(_0x505877,_0x512cdd){return getInteractionUsers(_0x3ff7e5,_0x412e21)[_0x9900('0x32')](function(_0x570a4a){return getInteractionTags(_0x570a4a,_0x29130c);})[_0x9900('0x32')](function(_0x528bcc){_0x505877(_0x528bcc);})[_0x9900('0x33')](function(_0x13adbd){_0x512cdd(_0x13adbd);});});}exports[_0x9900('0x34')]=function(_0x13bb59,_0x3e6e21){var _0x3ed846={},_0x2ab542={},_0x581e0b={'count':0x0,'rows':[]};var _0x5bfb20=_['map'](db[_0x9900('0x35')][_0x9900('0x36')],function(_0x506ebe){return{'name':_0x506ebe[_0x9900('0x37')],'type':_0x506ebe[_0x9900('0x38')][_0x9900('0x39')]};});_0x2ab542['model']=_[_0x9900('0x3a')](_0x5bfb20,_0x9900('0x3b'));_0x2ab542[_0x9900('0x3c')]=_[_0x9900('0x3d')](_0x13bb59[_0x9900('0x3c')]);_0x2ab542[_0x9900('0x3e')]=_['intersection'](_0x2ab542[_0x9900('0x3f')],_0x2ab542[_0x9900('0x3c')]);_0x3ed846['attributes']=_[_0x9900('0x40')](_0x2ab542['model'],qs[_0x9900('0x41')](_0x13bb59[_0x9900('0x3c')]['fields']));_0x3ed846[_0x9900('0x42')]=_0x3ed846[_0x9900('0x42')][_0x9900('0x43')]?_0x3ed846[_0x9900('0x42')]:_0x2ab542[_0x9900('0x3f')];if(!_0x13bb59['query']['hasOwnProperty'](_0x9900('0x44'))){_0x3ed846['limit']=qs['limit'](_0x13bb59['query']['limit']);_0x3ed846['offset']=qs[_0x9900('0x1f')](_0x13bb59[_0x9900('0x3c')][_0x9900('0x1f')]);}_0x3ed846[_0x9900('0x45')]=qs[_0x9900('0x46')](_0x13bb59[_0x9900('0x3c')][_0x9900('0x46')]);_0x3ed846[_0x9900('0x47')]=qs['filters'](_[_0x9900('0x48')](_0x13bb59[_0x9900('0x3c')],_0x2ab542['filters']),_0x5bfb20);var _0x5d593c=[];var _0x1a5940=squel[_0x9900('0x49')]()[_0x9900('0x4a')]('id')[_0x9900('0x4a')](_0x9900('0x3b'))[_0x9900('0x4a')](_0x9900('0x4b'))[_0x9900('0x4c')]('tools_tags');var _0x322dce=squel[_0x9900('0x49')]()['field'](_0x9900('0x4d'))[_0x9900('0x4a')](_0x9900('0x4e'))[_0x9900('0x4a')]('ui.WhatsappInteractionId')[_0x9900('0x4c')](_0x9900('0x4f'),'ui')['left_join'](_0x9900('0x50'),'u',_0x9900('0x51'));var _0x120b92=squel['select']()[_0x9900('0x4c')]('whatsapp_interactions','i')[_0x9900('0x52')]('cm_contacts','c',_0x9900('0x53'))[_0x9900('0x52')](_0x9900('0x50'),'o','o.id\x20=\x20i.UserId')[_0x9900('0x52')]('whatsapp_accounts','a',_0x9900('0x54'))[_0x9900('0x52')]('whatsapp_messages','me',_0x9900('0x55'))[_0x9900('0x52')]('whatsapp_interaction_has_tags','it',_0x9900('0x56'))[_0x9900('0x52')](_0x9900('0x57'),'t',_0x9900('0x58'));var _0x3d26e3=squel['expr']();var _0x5d8460=[];var _0x1d7332=squel[_0x9900('0x59')]();var _0x2aa081;if(_0x13bb59[_0x9900('0x3c')][_0x9900('0x5a')]){_0x2aa081=as['parseSearch'](_0x13bb59[_0x9900('0x3c')][_0x9900('0x5a')]);var _0x4296ea=_0x2aa081[_0x9900('0x5b')];for(var _0x2f7f74=0x0;_0x2f7f74<_0x2aa081[_0x9900('0x5c')][_0x9900('0x43')];_0x2f7f74++){var _0x50d064=_0x2aa081[_0x9900('0x5c')][_0x2f7f74];var _0x5f056c='i';var _0x5b1b13=_['find'](_0x5bfb20,[_0x9900('0x3b'),_0x50d064['field']]);if(!_0x5b1b13){switch(_0x50d064[_0x9900('0x4a')]){case _0x9900('0x5d'):if(_0x50d064[_0x9900('0x5e')]==0x1){_0x120b92['having']('`'+_0x50d064['field']+_0x9900('0x5f'));}else{_0x120b92[_0x9900('0x60')]('`'+_0x50d064[_0x9900('0x4a')]+_0x9900('0x61'));}break;case _0x9900('0x62'):if(_0x50d064[_0x9900('0x63')]===_0x9900('0x64')){if(_0x50d064[_0x9900('0x5e')][_0x9900('0x2f')]('\x20')[_0x9900('0x43')]>0x1){_0x3d26e3[_0x4296ea](_0x9900('0x65'),qs[_0x9900('0x66')](_0x50d064[_0x9900('0x5e')]),null);}else{var _0x5a97fe='%'+_0x50d064[_0x9900('0x5e')]+'%';_0x3d26e3[_0x4296ea]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x5a97fe,_0x5a97fe,_0x5a97fe);}}else{_0x5b1b13=_[_0x9900('0x67')](_0x5bfb20,[_0x9900('0x3b'),_0x9900('0x68')]);_0x50d064['field']=_0x9900('0x68');_0x5300ff=as[_0x9900('0x69')](_0x5f056c,_0x5b1b13[_0x9900('0x38')],_0x50d064);_0x3d26e3[_0x4296ea](_0x5300ff[_0x9900('0x6a')],_0x5300ff[_0x9900('0x5e')][_0x9900('0x6b')],_0x5300ff[_0x9900('0x5e')][_0x9900('0x1e')]);}break;case _0x9900('0x6c'):var _0x286a65=_0x50d064['value'][_0x9900('0x2f')](',')['map'](function(_0x2238d3){return Number(_0x2238d3);});_0x286a65[_0x9900('0x30')](function(_0x41b96c){_0x1d7332['or'](_0x9900('0x6d'),'%,'+_0x41b96c+',%');});_0x5d8460=_[_0x9900('0x6e')](_0x5d8460,_0x286a65);break;case'User':if(_0x50d064[_0x9900('0x63')]==='$substring'){_0x3d26e3[_0x4296ea](_0x9900('0x6f'),'%'+_0x50d064[_0x9900('0x5e')]+'%',null);}else{_0x5b1b13=_[_0x9900('0x67')](_0x5bfb20,[_0x9900('0x3b'),_0x9900('0x70')]);_0x50d064['field']=_0x9900('0x70');_0x5300ff=as[_0x9900('0x69')](_0x5f056c,_0x5b1b13[_0x9900('0x38')],_0x50d064);_0x3d26e3[_0x4296ea](_0x5300ff['text'],_0x5300ff[_0x9900('0x5e')][_0x9900('0x6b')],_0x5300ff[_0x9900('0x5e')][_0x9900('0x1e')]);}break;case _0x9900('0x71'):_0x5300ff=as[_0x9900('0x69')]('me',null,_0x50d064);_0x3d26e3[_0x4296ea](_0x5300ff[_0x9900('0x6a')],_0x5300ff[_0x9900('0x5e')][_0x9900('0x6b')],_0x5300ff['value'][_0x9900('0x1e')]);break;}}else{var _0x5300ff=as[_0x9900('0x69')](_0x5f056c,_0x5b1b13[_0x9900('0x38')],_0x50d064);_0x3d26e3[_0x4296ea](_0x5300ff[_0x9900('0x6a')],_0x5300ff[_0x9900('0x5e')]['start'],_0x5300ff['value'][_0x9900('0x1e')]);}}}else{var _0x570ec9=_(_0x13bb59[_0x9900('0x3c')])['keys']()[_0x9900('0x3a')](function(_0x89f14a){return _[_0x9900('0x72')](_0x5bfb20,[_0x9900('0x3b'),_0x89f14a])?_0x89f14a:undefined;})['compact']()[_0x9900('0x5e')]();if(!_[_0x9900('0x73')](_0x570ec9)){_0x570ec9['forEach'](function(_0x44353a){if(_0x44353a==='WhatsappAccountId'){_0x120b92[_0x9900('0x47')]('i.WhatsappAccountId\x20IN\x20?',[][_0x9900('0x74')](_0x13bb59['query'][_0x44353a]));}else if(_0x44353a===_0x9900('0x75')){var _0x1014bf=JSON[_0x9900('0x76')](_0x13bb59['query'][_0x44353a])[_0x9900('0x77')];var _0x269cfa=JSON[_0x9900('0x76')](_0x13bb59[_0x9900('0x3c')][_0x44353a])[_0x9900('0x78')];_0x120b92[_0x9900('0x47')](_0x9900('0x79'),_0x1014bf,_0x269cfa);}else{if(_0x13bb59[_0x9900('0x3c')][_0x44353a]===_0x9900('0x7a')){_0x120b92[_0x9900('0x47')]('i.'+_0x44353a+_0x9900('0x7b'));}else{_0x120b92[_0x9900('0x47')]('i.'+_0x44353a+'\x20=\x20?',_0x13bb59[_0x9900('0x3c')][_0x44353a]);}}});}if(_0x13bb59[_0x9900('0x3c')][_0x9900('0x7c')]){if(_0x13bb59[_0x9900('0x3c')][_0x9900('0x7c')]==0x1){_0x120b92[_0x9900('0x60')](_0x9900('0x7d'));}else{_0x120b92['having'](_0x9900('0x7e'));}}if(_0x13bb59['query'][_0x9900('0x7f')]){_0x5d8460=_[_0x9900('0x80')](_0x13bb59[_0x9900('0x3c')]['tag'])?_0x13bb59[_0x9900('0x3c')][_0x9900('0x7f')]:new Array(_0x13bb59[_0x9900('0x3c')][_0x9900('0x7f')]);_0x5d8460[_0x9900('0x30')](function(_0x19839a){_0x1d7332['or'](_0x9900('0x6d'),'%,'+_0x19839a+',%');});}if(_0x13bb59[_0x9900('0x3c')][_0x9900('0x81')]){var _0x34c14a=_0x13bb59[_0x9900('0x3c')][_0x9900('0x81')][_0x9900('0x82')]('\x5c','\x5c\x5c')[_0x9900('0x82')](/'/g,'\x27\x27');if(qs[_0x9900('0x83')](_0x34c14a)){_0x3d26e3['or'](_0x9900('0x84'),_0x34c14a+'%')['or'](_0x9900('0x85'),_0x34c14a+'%');}else{_0x3d26e3['or'](_0x9900('0x86'),qs[_0x9900('0x66')](_0x34c14a))['or'](_0x9900('0x87'),_0x34c14a+'%');}}}_0x120b92['where'](_0x3d26e3);_0x120b92['group'](_0x9900('0x88'));var _0xb3994c={'type':db[_0x9900('0x89')][_0x9900('0x8a')]['SELECT'],'raw':!![]};var _0x184550=_0x120b92['clone']();_0x184550['field'](_0x9900('0x88'));_0x184550['field']('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x9900('0x5d'));if(_0x3ed846['order']){_0x3ed846[_0x9900('0x45')]['forEach'](function(_0x11350a){var _0x12d25c=_0x11350a[0x0]===_0x9900('0x8b')?_0x11350a[0x0]:'i.'+_0x11350a[0x0];_0x120b92[_0x9900('0x45')](_0x12d25c,_0x11350a[0x1]===_0x9900('0x8c')?![]:!![]);});}if(!_['isEmpty'](_0x5d8460)){_0x120b92[_0x9900('0x60')](_0x1d7332);_0x184550[_0x9900('0x47')](_0x9900('0x8d'),_0x5d8460);}BPromise[_0x9900('0x8e')]()[_0x9900('0x32')](function(){if(!_0x2aa081){if(_0x13bb59['query'][_0x9900('0x8f')])return;_0x184550[_0x9900('0x47')](_0x9900('0x90'));_0x120b92[_0x9900('0x47')](_0x9900('0x90'));return;}if(_0x13bb59['user']['role']!==_0x9900('0x91'))return;return _0x13bb59['user'][_0x9900('0x92')]({'attributes':['id'],'raw':!![]})['then'](function(_0x10d44e){if(_['isEmpty'](_0x10d44e)){_0x184550[_0x9900('0x47')]('i.WhatsappAccountId\x20IS\x20NULL');_0x120b92[_0x9900('0x47')]('i.WhatsappAccountId\x20IS\x20NULL');}else{_0x184550[_0x9900('0x47')]('i.WhatsappAccountId\x20IN\x20?',_['map'](_0x10d44e,'id'));_0x120b92['where']('i.WhatsappAccountId\x20IN\x20?',_[_0x9900('0x3a')](_0x10d44e,'id'));}});})['then'](function(){if(_0x13bb59[_0x9900('0x93')][_0x9900('0x94')]===_0x9900('0x91')&&!_0x2aa081&&!_0x13bb59[_0x9900('0x3c')][_0x9900('0x8f')])return[];return db[_0x9900('0x95')][_0x9900('0x3c')](_0x184550[_0x9900('0x96')](),_0xb3994c);})[_0x9900('0x32')](function(_0x313088){_0x581e0b[_0x9900('0x21')]=_0x313088[_0x9900('0x43')];if(_0x581e0b['count']===0x0)return[];return db[_0x9900('0x95')][_0x9900('0x3c')](_0x1a5940[_0x9900('0x96')](),_0xb3994c)[_0x9900('0x32')](function(_0x45e423){_0x5d593c=_[_0x9900('0x97')](_0x45e423,'id');_0xb3994c=_['merge'](_0xb3994c,{'model':db['WhatsappInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x13bb59[_0x9900('0x3c')][_0x9900('0x41')]){_0x3ed846[_0x9900('0x42')][_0x9900('0x30')](function(_0x585609){_0x120b92[_0x9900('0x4a')]('i.'+_0x585609);});}else{_0x120b92[_0x9900('0x4a')](_0x9900('0x98'),_0x9900('0x5d'));_0x120b92[_0x9900('0x4a')]('a.key',_0x9900('0x99'));_0x120b92[_0x9900('0x4a')](_0x9900('0x9a'),_0x9900('0x9b'));_0x120b92[_0x9900('0x4a')](_0x9900('0x9c'),_0x9900('0x8b'));_0x120b92[_0x9900('0x4a')](_0x9900('0x9d'));_0x120b92[_0x9900('0x4a')](_0x9900('0x9e'),_0x9900('0x9f'));_0x120b92[_0x9900('0x4a')](_0x9900('0xa0'),'Contact.lastName');_0x120b92[_0x9900('0x4a')](_0x9900('0xa1'),_0x9900('0xa2'));_0x120b92[_0x9900('0x4a')](_0x9900('0xa3'),'Contact.phone');_0x120b92[_0x9900('0x4a')]('c.mobile',_0x9900('0xa4'));_0x120b92['field'](_0x9900('0xa5'),_0x9900('0xa6'));_0x120b92[_0x9900('0x4a')](_0x9900('0xa7'),'Owner.fullname');_0x120b92['field'](_0x9900('0xa8'),_0x9900('0xa9'));_0x120b92[_0x9900('0x4a')](_0x9900('0xaa'),_0x9900('0x2d'));}if(_0x3ed846[_0x9900('0x20')])_0x120b92[_0x9900('0x20')](_0x3ed846[_0x9900('0x20')]);if(_0x3ed846[_0x9900('0x1f')])_0x120b92[_0x9900('0x1f')](_0x3ed846['offset']);return db['sequelize'][_0x9900('0x3c')](_0x120b92[_0x9900('0x96')](),_0xb3994c);})['then'](function(_0x1282d3){if(_0x1282d3[_0x9900('0x43')]>0x0)_0x322dce[_0x9900('0x47')](_0x9900('0xab'),_[_0x9900('0x3a')](_0x1282d3,'id'));return db['sequelize'][_0x9900('0x3c')](_0x322dce['toString'](),_0xb3994c)[_0x9900('0x32')](function(_0x2d0793){var _0x42c042=_[_0x9900('0xac')](_0x2d0793,_0x9900('0xad'));var _0x3e4ea4=[];_0x1282d3[_0x9900('0x30')](function(_0x4a236a){_0x3e4ea4[_0x9900('0x31')](updateWhatsappInteraction(_0x4a236a,_0x5d593c,_0x42c042));});return BPromise['all'](_0x3e4ea4);});});})[_0x9900('0x32')](function(_0x20734a){_0x581e0b[_0x9900('0xae')]=_0x20734a;return _0x581e0b;})[_0x9900('0x32')](respondWithFilteredResult(_0x3e6e21,_0x3ed846))[_0x9900('0x33')](handleError(_0x3e6e21,null));};exports[_0x9900('0xaf')]=function(_0x1d7f66,_0x48008c){var _0x92c33d={'raw':![],'where':{'id':_0x1d7f66[_0x9900('0xb0')]['id']}},_0x24910b={};_0x24910b[_0x9900('0x3f')]=_[_0x9900('0x3d')](db[_0x9900('0x35')]['rawAttributes']);_0x24910b[_0x9900('0x3c')]=_['keys'](_0x1d7f66['query']);_0x24910b[_0x9900('0x3e')]=_[_0x9900('0x40')](_0x24910b[_0x9900('0x3f')],_0x24910b[_0x9900('0x3c')]);_0x92c33d['attributes']=_[_0x9900('0x40')](_0x24910b[_0x9900('0x3f')],qs[_0x9900('0x41')](_0x1d7f66[_0x9900('0x3c')][_0x9900('0x41')]));_0x92c33d[_0x9900('0x42')]=_0x92c33d[_0x9900('0x42')][_0x9900('0x43')]?_0x92c33d[_0x9900('0x42')]:_0x24910b['model'];if(_0x1d7f66[_0x9900('0x3c')][_0x9900('0xb1')]){_0x92c33d[_0x9900('0xb2')]=[{'all':!![]}];}_0x92c33d=_[_0x9900('0xb3')]({},_0x92c33d,_0x1d7f66[_0x9900('0xb4')]);return db[_0x9900('0x35')][_0x9900('0x67')](_0x92c33d)[_0x9900('0x32')](handleEntityNotFound(_0x48008c,null))[_0x9900('0x32')](respondWithResult(_0x48008c,null))[_0x9900('0x33')](handleError(_0x48008c,null));};exports[_0x9900('0xb5')]=function(_0x43044f,_0x8b9c5e){return db[_0x9900('0x35')][_0x9900('0xb5')](_0x43044f[_0x9900('0x71')],{})[_0x9900('0x32')](respondWithResult(_0x8b9c5e,0xc9))[_0x9900('0x33')](handleError(_0x8b9c5e,null));};exports['update']=function(_0x492b76,_0x36614b){if(_0x492b76[_0x9900('0x71')]['id']){delete _0x492b76[_0x9900('0x71')]['id'];}return db[_0x9900('0x35')][_0x9900('0x67')]({'where':{'id':_0x492b76[_0x9900('0xb0')]['id']}})[_0x9900('0x32')](handleEntityNotFound(_0x36614b,null))[_0x9900('0x32')](saveUpdates(_0x492b76[_0x9900('0x71')],null))[_0x9900('0x32')](respondWithResult(_0x36614b,null))[_0x9900('0x33')](handleError(_0x36614b,null));};exports[_0x9900('0x27')]=function(_0x4f6b70,_0x3db63f){return db[_0x9900('0x35')][_0x9900('0x67')]({'where':{'id':_0x4f6b70[_0x9900('0xb0')]['id']}})[_0x9900('0x32')](handleEntityNotFound(_0x3db63f,null))[_0x9900('0x32')](removeEntity(_0x3db63f,null))[_0x9900('0x33')](handleError(_0x3db63f,null));};exports[_0x9900('0xb6')]=function(_0x3fab78,_0x414b56){return db['WhatsappInteraction']['describe']()['then'](respondWithResult(_0x414b56,null))[_0x9900('0x33')](handleError(_0x414b56,null));};exports[_0x9900('0xb7')]=function(_0x381158,_0x5e3f55,_0x338b5d){return db[_0x9900('0xb8')][_0x9900('0x67')]({'where':{'id':_0x381158[_0x9900('0xb0')]['id']}})['then'](handleEntityNotFound(_0x5e3f55,null))[_0x9900('0x32')](function(_0x25daa0){if(_0x25daa0){return _0x25daa0[_0x9900('0xb7')](_0x381158[_0x9900('0x71')][_0x9900('0xb9')],_['omit'](_0x381158[_0x9900('0x71')],[_0x9900('0xb9'),'id'])||{});}})[_0x9900('0x32')](respondWithResult(_0x5e3f55,null))['catch'](handleError(_0x5e3f55,null));};exports['getMessages']=function(_0x2b0c38,_0x482556,_0x3bf43c){var _0x29a925={'raw':![],'where':{}};var _0x18c77d={};var _0x40ca36={'count':0x0,'rows':[]};return db[_0x9900('0x35')][_0x9900('0xba')]({'where':{'id':_0x2b0c38['params']['id']}})[_0x9900('0x32')](handleEntityNotFound(_0x482556,null))['then'](function(_0x3c11be){if(_0x3c11be){_0x18c77d[_0x9900('0x3f')]=_[_0x9900('0x3d')](db[_0x9900('0xb8')][_0x9900('0x36')]);_0x18c77d[_0x9900('0x3c')]=_[_0x9900('0x3d')](_0x2b0c38[_0x9900('0x3c')]);_0x18c77d[_0x9900('0x3e')]=_[_0x9900('0x40')](_0x18c77d[_0x9900('0x3f')],_0x18c77d[_0x9900('0x3c')]);_0x29a925[_0x9900('0x42')]=_[_0x9900('0x40')](_0x18c77d[_0x9900('0x3f')],qs[_0x9900('0x41')](_0x2b0c38[_0x9900('0x3c')][_0x9900('0x41')]));_0x29a925[_0x9900('0x42')]=_0x29a925[_0x9900('0x42')][_0x9900('0x43')]?_0x29a925['attributes']:_0x18c77d[_0x9900('0x3f')];if(!_0x2b0c38[_0x9900('0x3c')][_0x9900('0xbb')](_0x9900('0x44'))){_0x29a925[_0x9900('0x20')]=qs[_0x9900('0x20')](_0x2b0c38['query'][_0x9900('0x20')]);_0x29a925[_0x9900('0x1f')]=qs[_0x9900('0x1f')](_0x2b0c38[_0x9900('0x3c')]['offset']);}_0x29a925[_0x9900('0x45')]=qs['sort'](_0x2b0c38[_0x9900('0x3c')][_0x9900('0x46')]);_0x29a925[_0x9900('0x47')]=qs[_0x9900('0x3e')](_[_0x9900('0x48')](_0x2b0c38['query'],_0x18c77d[_0x9900('0x3e')]));_0x29a925[_0x9900('0x47')][_0x9900('0xad')]=_0x3c11be['id'];if(_0x2b0c38[_0x9900('0x3c')][_0x9900('0x81')]){_0x29a925[_0x9900('0x47')]=_['merge'](_0x29a925[_0x9900('0x47')],{'$or':_[_0x9900('0x3a')](_0x29a925[_0x9900('0x42')],function(_0x5c7449){var _0x12e6b3={};_0x12e6b3[_0x5c7449]={'$like':'%'+_0x2b0c38[_0x9900('0x3c')][_0x9900('0x81')]+'%'};return _0x12e6b3;})});}if(_0x2b0c38[_0x9900('0x3c')]['$gte']){var _0xc77ced=_0x2b0c38['query'][_0x9900('0x77')][_0x9900('0x2f')](',');var _0x21a7af={};_0x21a7af[_0xc77ced[0x0]]={'$gte':moment(_0xc77ced[0x1])[_0x9900('0xbc')](_0x9900('0xbd'))};_0x29a925[_0x9900('0x47')]=_['merge'](_0x29a925['where'],_0x21a7af);}_0x29a925=_[_0x9900('0xb3')]({},_0x29a925,_0x2b0c38[_0x9900('0xb4')]);return db['WhatsappMessage'][_0x9900('0x21')]({'where':_0x29a925['where']})['then'](function(_0x3b833b){_0x40ca36[_0x9900('0x21')]=_0x3b833b;if(_0x2b0c38[_0x9900('0x3c')][_0x9900('0xb1')]){_0x29a925[_0x9900('0xb2')]=[{'all':!![]}];}return db[_0x9900('0xb8')][_0x9900('0xbe')](_0x29a925);})[_0x9900('0x32')](function(_0xd35726){_0x40ca36[_0x9900('0xae')]=_0xd35726;return _0x40ca36;});}})[_0x9900('0x32')](respondWithFilteredResult(_0x482556,_0x29a925))[_0x9900('0x33')](handleError(_0x482556,null));};exports[_0x9900('0xbf')]=function(_0x55879b,_0x26b721,_0x262bdb){return db['WhatsappInteraction']['find']({'where':{'id':_0x55879b[_0x9900('0xb0')]['id']}})[_0x9900('0x32')](handleEntityNotFound(_0x26b721,null))[_0x9900('0x32')](function(_0xf2ccf6){if(_0xf2ccf6){return _0xf2ccf6['setTags'](_0x55879b[_0x9900('0x71')][_0x9900('0xb9')],_[_0x9900('0xc0')](_0x55879b[_0x9900('0x71')],[_0x9900('0xb9'),'id'])||{})[_0x9900('0xc1')](function(){return db['Tag'][_0x9900('0xbe')]({'attributes':['id','name',_0x9900('0x4b')],'where':{'id':_0x55879b[_0x9900('0x71')][_0x9900('0xb9')]}});})[_0x9900('0x32')](function(_0x3a6d51){socket[_0x9900('0xc2')](_0x9900('0xc3'),{'id':Number(_0x55879b[_0x9900('0xb0')]['id']),'tags':_0x3a6d51||[]});return{'id':Number(_0x55879b[_0x9900('0xb0')]['id']),'tags':_0x3a6d51||[]};});}})['then'](respondWithResult(_0x26b721,null))[_0x9900('0x33')](handleError(_0x26b721,null));};exports[_0x9900('0xc4')]=function(_0x34136e,_0xcec90a,_0x19124d){return db['WhatsappInteraction'][_0x9900('0x67')]({'where':{'id':_0x34136e[_0x9900('0xb0')]['id']}})[_0x9900('0x32')](handleEntityNotFound(_0xcec90a,null))['then'](function(_0x2be593){if(_0x2be593){return _0x2be593[_0x9900('0xc4')](_0x34136e['query'][_0x9900('0xb9')]);}})['then'](respondWithStatusCode(_0xcec90a,null))['catch'](handleError(_0xcec90a,null));};exports[_0x9900('0xc5')]=function(_0x25354b,_0x551e13){var _0x4c9086=moment()[_0x9900('0xc6')]()['toString']();var _0x359571=path[_0x9900('0xc7')](config[_0x9900('0xc8')],_0x9900('0xc9'),_0x9900('0xca'),_0x9900('0xcb'));var _0x19848f=path[_0x9900('0xc7')](config['root'],_0x9900('0xc9'),_0x9900('0xca'),_0x9900('0xcc'));var _0x86768c=path[_0x9900('0xc7')](_0x359571,_0x4c9086);var _0x3bdbfe=util[_0x9900('0xbc')](_0x9900('0xcd'),_0x25354b[_0x9900('0xb0')]['id'],_0x4c9086);var _0x54a3fa=path[_0x9900('0xc7')](_0x359571,_0x3bdbfe);var _0x1a9c1c=[];_0x1a9c1c[_0x9900('0x31')]({'model':db[_0x9900('0xce')],'as':_0x9900('0xce'),'attributes':['id',_0x9900('0x2c')],'raw':!![]});_0x1a9c1c[_0x9900('0x31')]({'model':db[_0x9900('0xcf')],'as':_0x9900('0x62'),'attributes':['id',_0x9900('0xd0'),_0x9900('0xd1')],'raw':!![]});if(_0x25354b['query']['attachments']){_0x1a9c1c['push']({'model':db['Attachment'],'as':_0x9900('0xd2'),'raw':!![]});}var _0x1c7bbd=[{'model':db['WhatsappMessage'],'as':_0x9900('0xd3'),'attributes':['id',_0x9900('0x71'),_0x9900('0x75'),_0x9900('0xd4'),_0x9900('0xd5'),_0x9900('0x7c')],'include':_0x1a9c1c}];_0x1c7bbd[_0x9900('0x31')]({'model':db[_0x9900('0xd6')],'as':_0x9900('0xd7'),'attributes':['id',_0x9900('0x3b')]});_0x1c7bbd[_0x9900('0x31')]({'model':db['User'],'as':'Owner','attributes':['id',_0x9900('0x2c')]});return db[_0x9900('0x35')][_0x9900('0x67')]({'where':{'id':_0x25354b[_0x9900('0xb0')]['id']},'include':_0x1c7bbd})[_0x9900('0x32')](handleEntityNotFound(_0x551e13,null))['then'](function(_0x23751a){if(_0x23751a){var _0x230e47=_0x23751a['get']({'plain':!![]});fs['mkdirSync'](_0x86768c);var _0x4aad78={'channel':_0x9900('0xd8'),'account':_0x230e47[_0x9900('0xd7')][_0x9900('0x3b')],'agent':_0x230e47[_0x9900('0xd9')]?_0x230e47[_0x9900('0xd9')]['fullname']:'N.A.','createdAt':moment(_0x230e47[_0x9900('0x75')])[_0x9900('0xbc')](_0x9900('0xbd'))[_0x9900('0x96')](),'closedAt':_0x230e47[_0x9900('0xda')]?moment(_0x230e47[_0x9900('0xdb')])[_0x9900('0xbc')](_0x9900('0xbd'))[_0x9900('0x96')]():'','disposition':_0x230e47[_0x9900('0xdc')],'messages':_(_0x230e47[_0x9900('0xd3')])['filter']({'secret':![]})[_0x9900('0x3a')](function(_0x879eb9){if(_0x879eb9[_0x9900('0xd2')]){var _0x5a992b=path[_0x9900('0xc7')](_0x19848f,_0x879eb9[_0x9900('0xd2')][_0x9900('0xdd')]);if(fs[_0x9900('0xde')](_0x5a992b)){fs[_0x9900('0xdf')](_0x5a992b)[_0x9900('0xe0')](fs[_0x9900('0xe1')](path[_0x9900('0xc7')](_0x86768c,_0x879eb9[_0x9900('0xd2')]['basename'])));}}return{'date':moment(_0x879eb9['createdAt'])['format'](_0x9900('0xbd'))['toString'](),'sender':_0x879eb9[_0x9900('0xd4')]===_0x9900('0xe2')?_0x879eb9[_0x9900('0xce')]?_0x879eb9['User'][_0x9900('0x2c')]:_0x9900('0xe3'):_0x879eb9['Contact'][_0x9900('0xd0')]+(_0x879eb9[_0x9900('0x62')][_0x9900('0xd1')]?'\x20'+_0x879eb9[_0x9900('0x62')][_0x9900('0xd1')]:''),'body':_0x879eb9[_0x9900('0xd2')]?_0x879eb9[_0x9900('0xd2')]['basename']:_0x879eb9[_0x9900('0x71')],'direction':_0x879eb9['direction']==='out'?'A':'C','secret':_0x879eb9[_0x9900('0xd5')],'read':_0x879eb9['read'],'attachment':_0x879eb9[_0x9900('0xd2')]};})[_0x9900('0x5e')]()};return ejs['renderFile'](path[_0x9900('0xc7')](config[_0x9900('0xc8')],'server',_0x9900('0xe4'),_0x9900('0xe5')),{'interaction':_0x4aad78})[_0x9900('0x32')](function(_0x348b18){var _0x45ca6a=path[_0x9900('0xc7')](_0x86768c,_0x9900('0xe6')+_0x230e47['id']+'-'+_0x4c9086+_0x9900('0xe7'));var _0x44372a={'path':_0x45ca6a,'channel':_0x9900('0xd8'),'interactionId':_0x230e47['id']};return pdf[_0x9900('0xe8')](_0x348b18,_0x44372a);})['then'](function(){return new BPromise(function(_0x3ed36c,_0x37ade9){zipdir(_0x86768c,{'saveTo':_0x54a3fa},function(_0x1ab4ab,_0xc6b589){if(_0x1ab4ab)return _0x37ade9(_0x1ab4ab);return _0x3ed36c(_0xc6b589);});})[_0x9900('0x32')](function(){return new BPromise(function(_0x48bd56,_0x17bc7d){rimraf(_0x86768c,function(_0x184c25){if(_0x184c25)_0x17bc7d(_0x184c25);return _0x48bd56();});});})['then'](function(){return _0x551e13[_0x9900('0xc5')](_0x54a3fa,_0x3bdbfe,function(_0x5ac4dd){if(_0x5ac4dd){console[_0x9900('0xe9')]('err',_0x5ac4dd);}else{fs['unlinkSync'](_0x54a3fa);}});});});}else{return _0x551e13[_0x9900('0x1c')](0xc8);}})[_0x9900('0x33')](handleError(_0x551e13,null));}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.events.js b/server/api/whatsappInteraction/whatsappInteraction.events.js index 2010845..ef8bfcc 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 _0x12c9=['then','setDataValue','map','length','emit','catch','hasOwnProperty','hook','exports','events','WhatsappInteraction','WhatsappMessage','save','update','remove'];(function(_0x572839,_0x2ef05d){var _0x3a02c6=function(_0x13b8cb){while(--_0x13b8cb){_0x572839['push'](_0x572839['shift']());}};_0x3a02c6(++_0x2ef05d);}(_0x12c9,0x9f));var _0x912c=function(_0x247f32,_0x133b06){_0x247f32=_0x247f32-0x0;var _0x3b3182=_0x12c9[_0x247f32];return _0x3b3182;};'use strict';var EventEmitter=require(_0x912c('0x0'));var WhatsappInteraction=require('../../mysqldb')['db'][_0x912c('0x1')];var WhatsappMessage=require('../../mysqldb')['db'][_0x912c('0x2')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x912c('0x3'),'afterUpdate':_0x912c('0x4'),'afterDestroy':_0x912c('0x5')};function emitEvent(_0x2a35f5){return function(_0x2afc58,_0x10e658,_0x572179){_0x2afc58['getUsers']({'attributes':['id'],'raw':!![]})[_0x912c('0x6')](function(_0xf08f88){_0x2afc58[_0x912c('0x7')]('Users',_0xf08f88[_0x912c('0x8')](function(_0x5a6c03){return{'id':_0x5a6c03['id']};}));return WhatsappMessage['findAll']({'where':{'WhatsappInteractionId':_0x2afc58['id'],'direction':'in','read':![]},'raw':!![]});})[_0x912c('0x6')](function(_0x484f33){_0x2afc58['setDataValue']('unreadMessages',_0x484f33[_0x912c('0x9')]);WhatsappInteractionEvents['emit'](_0x2a35f5+':'+_0x2afc58['id'],_0x2afc58);WhatsappInteractionEvents[_0x912c('0xa')](_0x2a35f5,_0x2afc58);_0x572179(null);})[_0x912c('0xb')](_0x572179(null));};}for(var e in events){if(events[_0x912c('0xc')](e)){var event=events[e];WhatsappInteraction[_0x912c('0xd')](e,emitEvent(event));}}module[_0x912c('0xe')]=WhatsappInteractionEvents; \ No newline at end of file +var _0x50a8=['catch','hasOwnProperty','events','WhatsappMessage','save','update','remove','getUsers','then','Users','map','findAll','length','emit'];(function(_0x46707f,_0x15e65d){var _0x332441=function(_0x1a75a4){while(--_0x1a75a4){_0x46707f['push'](_0x46707f['shift']());}};_0x332441(++_0x15e65d);}(_0x50a8,0x198));var _0x850a=function(_0x4a05e7,_0x22f0df){_0x4a05e7=_0x4a05e7-0x0;var _0x126423=_0x50a8[_0x4a05e7];return _0x126423;};'use strict';var EventEmitter=require(_0x850a('0x0'));var WhatsappInteraction=require('../../mysqldb')['db']['WhatsappInteraction'];var WhatsappMessage=require('../../mysqldb')['db'][_0x850a('0x1')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x850a('0x2'),'afterUpdate':_0x850a('0x3'),'afterDestroy':_0x850a('0x4')};function emitEvent(_0x3df4c3){return function(_0x30ed80,_0x1dbed8,_0xb85c1a){_0x30ed80[_0x850a('0x5')]({'attributes':['id'],'raw':!![]})[_0x850a('0x6')](function(_0x543ef0){_0x30ed80['setDataValue'](_0x850a('0x7'),_0x543ef0[_0x850a('0x8')](function(_0xc357fe){return{'id':_0xc357fe['id']};}));return WhatsappMessage[_0x850a('0x9')]({'where':{'WhatsappInteractionId':_0x30ed80['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x3c6738){_0x30ed80['setDataValue']('unreadMessages',_0x3c6738[_0x850a('0xa')]);WhatsappInteractionEvents[_0x850a('0xb')](_0x3df4c3+':'+_0x30ed80['id'],_0x30ed80);WhatsappInteractionEvents[_0x850a('0xb')](_0x3df4c3,_0x30ed80);_0xb85c1a(null);})[_0x850a('0xc')](_0xb85c1a(null));};}for(var e in events){if(events[_0x850a('0xd')](e)){var event=events[e];WhatsappInteraction['hook'](e,emitEvent(event));}}module['exports']=WhatsappInteractionEvents; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.model.js b/server/api/whatsappInteraction/whatsappInteraction.model.js index d25ffd4..34d8689 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 _0x2c38=['exports','WhatsappInteraction','whatsapp_interactions','closed','closedAt','lodash','util','moment','bluebird','request-promise','rimraf','../../config/environment','./whatsappInteraction.attributes'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x2c38,0x109));var _0x82c3=function(_0x57eabc,_0x33c089){_0x57eabc=_0x57eabc-0x0;var _0x4c1ce4=_0x2c38[_0x57eabc];return _0x4c1ce4;};'use strict';var _=require(_0x82c3('0x0'));var util=require(_0x82c3('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x82c3('0x2'));var BPromise=require(_0x82c3('0x3'));var rp=require(_0x82c3('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x82c3('0x5'));var config=require(_0x82c3('0x6'));var attributes=require(_0x82c3('0x7'));module[_0x82c3('0x8')]=function(_0x72ba87,_0x1c760f){return _0x72ba87['define'](_0x82c3('0x9'),attributes,{'tableName':_0x82c3('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x371d87,_0x588b32,_0x46635b){if(_0x371d87['changed'](_0x82c3('0xb'))){_0x371d87[_0x82c3('0xc')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}_0x46635b(null,_0x371d87);}}});}; \ No newline at end of file +var _0x54ce=['rimraf','../../config/environment','./whatsappInteraction.attributes','exports','WhatsappInteraction','changed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','moment','request-promise','path'];(function(_0x321df4,_0x3efec5){var _0x50d06c=function(_0x3ac0f4){while(--_0x3ac0f4){_0x321df4['push'](_0x321df4['shift']());}};_0x50d06c(++_0x3efec5);}(_0x54ce,0x19e));var _0xe54c=function(_0x371843,_0x4eed0a){_0x371843=_0x371843-0x0;var _0x638885=_0x54ce[_0x371843];return _0x638885;};'use strict';var _=require(_0xe54c('0x0'));var util=require(_0xe54c('0x1'));var logger=require(_0xe54c('0x2'))('api');var moment=require(_0xe54c('0x3'));var BPromise=require('bluebird');var rp=require(_0xe54c('0x4'));var fs=require('fs');var path=require(_0xe54c('0x5'));var rimraf=require(_0xe54c('0x6'));var config=require(_0xe54c('0x7'));var attributes=require(_0xe54c('0x8'));module[_0xe54c('0x9')]=function(_0x3df063,_0xd81b81){return _0x3df063['define'](_0xe54c('0xa'),attributes,{'tableName':'whatsapp_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x57b99b,_0x266a0a,_0x27600f){if(_0x57b99b[_0xe54c('0xb')]('closed')){_0x57b99b[_0xe54c('0xc')]=moment()[_0xe54c('0xd')](_0xe54c('0xe'));}_0x27600f(null,_0x57b99b);}}});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.rpc.js b/server/api/whatsappInteraction/whatsappInteraction.rpc.js index e0f4ccf..26a7924 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 _0x929f=['message','result','WhatsappInteraction','options','raw','attributes','then','UpdateWhatsappInteraction','find','where','addTags','body','ids','spread','AddTags','debug','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','defaults','redis','localhost','socket.io-emitter','./whatsappInteraction.socket','register','request','info','request\x20sent','WhatsappInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','WhatsappInteraction,\x20%s,\x20%s'];(function(_0x263a74,_0xc31414){var _0x2aa86c=function(_0x382896){while(--_0x382896){_0x263a74['push'](_0x263a74['shift']());}};_0x2aa86c(++_0xc31414);}(_0x929f,0x130));var _0xf929=function(_0x24afdc,_0x6aa8c1){_0x24afdc=_0x24afdc-0x0;var _0x530701=_0x929f[_0x24afdc];return _0x530701;};'use strict';var _=require(_0xf929('0x0'));var util=require('util');var moment=require(_0xf929('0x1'));var BPromise=require('bluebird');var rs=require(_0xf929('0x2'));var fs=require('fs');var Redis=require(_0xf929('0x3'));var db=require(_0xf929('0x4'))['db'];var utils=require(_0xf929('0x5'));var logger=require(_0xf929('0x6'))('rpc');var config=require(_0xf929('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xf929('0x8')][_0xf929('0x9')]({'port':0x232a});config['redis']=_[_0xf929('0xa')](config[_0xf929('0xb')],{'host':_0xf929('0xc'),'port':0x18eb});var socket=require(_0xf929('0xd'))(new Redis(config['redis']));require(_0xf929('0xe'))[_0xf929('0xf')](socket);function respondWithRpcPromise(_0x3a2841,_0x1fc49b,_0x30d091){return new BPromise(function(_0x35af59,_0x83d6f5){return client[_0xf929('0x10')](_0x3a2841,_0x30d091)['then'](function(_0x9ed24e){logger[_0xf929('0x11')]('WhatsappInteraction,\x20%s,\x20%s',_0x1fc49b,_0xf929('0x12'));logger['debug'](_0xf929('0x13'),_0x1fc49b,_0xf929('0x12'),JSON[_0xf929('0x14')](_0x9ed24e));if(_0x9ed24e[_0xf929('0x15')]){if(_0x9ed24e[_0xf929('0x15')][_0xf929('0x16')]===0x1f4){logger['error'](_0xf929('0x17'),_0x1fc49b,_0x9ed24e[_0xf929('0x15')]['message']);return _0x83d6f5(_0x9ed24e['error'][_0xf929('0x18')]);}logger[_0xf929('0x15')]('WhatsappInteraction,\x20%s,\x20%s',_0x1fc49b,_0x9ed24e[_0xf929('0x15')]['message']);return _0x35af59(_0x9ed24e[_0xf929('0x15')]['message']);}else{logger[_0xf929('0x11')](_0xf929('0x17'),_0x1fc49b,'request\x20sent');_0x35af59(_0x9ed24e[_0xf929('0x19')][_0xf929('0x18')]);}})['catch'](function(_0x1db843){logger[_0xf929('0x15')](_0xf929('0x17'),_0x1fc49b,_0x1db843);_0x83d6f5(_0x1db843);});});}exports['UpdateWhatsappInteraction']=function(_0x19729a){var _0x383cad=this;return new Promise(function(_0x2c0fb1,_0x38e389){return db[_0xf929('0x1a')]['update'](_0x19729a['body'],{'raw':_0x19729a[_0xf929('0x1b')]?_0x19729a[_0xf929('0x1b')][_0xf929('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x19729a[_0xf929('0x1b')]?_0x19729a[_0xf929('0x1b')]['where']||null:null,'attributes':_0x19729a[_0xf929('0x1b')]?_0x19729a[_0xf929('0x1b')][_0xf929('0x1d')]||null:null,'limit':_0x19729a[_0xf929('0x1b')]?_0x19729a[_0xf929('0x1b')]['limit']||null:null})[_0xf929('0x1e')](function(_0x4e10f1){logger[_0xf929('0x11')](_0xf929('0x1f'),_0x19729a);logger['debug'](_0xf929('0x1f'),_0x19729a,JSON[_0xf929('0x14')](_0x4e10f1));_0x2c0fb1(_0x4e10f1);})['catch'](function(_0x45c4e0){logger[_0xf929('0x15')](_0xf929('0x1f'),_0x45c4e0[_0xf929('0x18')],_0x19729a);_0x38e389(_0x383cad['error'](0x1f4,_0x45c4e0['message']));});});};exports['AddTagsToWhatsappInteraction']=function(_0x430989){return new Promise(function(_0x150064,_0x18f7d5){return db['WhatsappInteraction'][_0xf929('0x20')]({'where':_0x430989[_0xf929('0x1b')]?_0x430989['options'][_0xf929('0x21')]||null:null})[_0xf929('0x1e')](function(_0x2dad5e){if(_0x2dad5e){return _0x2dad5e[_0xf929('0x22')](_0x430989[_0xf929('0x23')][_0xf929('0x24')],_['omit'](_0x430989['body'],[_0xf929('0x24'),'id'])||{});}})[_0xf929('0x25')](function(_0xab14cc){logger['info'](_0xf929('0x26'),_0x430989);logger[_0xf929('0x27')](_0xf929('0x26'),_0x430989,JSON['stringify'](_0xab14cc));_0x150064(_0xab14cc);})[_0xf929('0x28')](function(_0x18a19c){logger[_0xf929('0x15')]('AddTags',_0x18a19c[_0xf929('0x18')],_0x430989);_0x18f7d5(_this[_0xf929('0x15')](0x1f4,_0x18a19c[_0xf929('0x18')]));});});}; \ No newline at end of file +var _0x37a7=['update','body','raw','options','where','attributes','limit','catch','AddTagsToWhatsappInteraction','find','addTags','ids','omit','AddTags','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./whatsappInteraction.socket','register','request','then','info','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','UpdateWhatsappInteraction','WhatsappInteraction'];(function(_0x5a229c,_0x53feff){var _0x31bdd7=function(_0x235fa4){while(--_0x235fa4){_0x5a229c['push'](_0x5a229c['shift']());}};_0x31bdd7(++_0x53feff);}(_0x37a7,0xf4));var _0x737a=function(_0x1dd184,_0x1b5dfa){_0x1dd184=_0x1dd184-0x0;var _0x18f4eb=_0x37a7[_0x1dd184];return _0x18f4eb;};'use strict';var _=require('lodash');var util=require(_0x737a('0x0'));var moment=require(_0x737a('0x1'));var BPromise=require(_0x737a('0x2'));var rs=require(_0x737a('0x3'));var fs=require('fs');var Redis=require(_0x737a('0x4'));var db=require(_0x737a('0x5'))['db'];var utils=require(_0x737a('0x6'));var logger=require(_0x737a('0x7'))(_0x737a('0x8'));var config=require(_0x737a('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x737a('0xa')][_0x737a('0xb')]({'port':0x232a});config[_0x737a('0xc')]=_[_0x737a('0xd')](config[_0x737a('0xc')],{'host':_0x737a('0xe'),'port':0x18eb});var socket=require(_0x737a('0xf'))(new Redis(config[_0x737a('0xc')]));require(_0x737a('0x10'))[_0x737a('0x11')](socket);function respondWithRpcPromise(_0x4d429d,_0x4567d3,_0x29f9f1){return new BPromise(function(_0x3fc683,_0x37ddff){return client[_0x737a('0x12')](_0x4d429d,_0x29f9f1)[_0x737a('0x13')](function(_0x232df5){logger[_0x737a('0x14')](_0x737a('0x15'),_0x4567d3,_0x737a('0x16'));logger[_0x737a('0x17')](_0x737a('0x18'),_0x4567d3,_0x737a('0x16'),JSON[_0x737a('0x19')](_0x232df5));if(_0x232df5[_0x737a('0x1a')]){if(_0x232df5[_0x737a('0x1a')][_0x737a('0x1b')]===0x1f4){logger[_0x737a('0x1a')](_0x737a('0x15'),_0x4567d3,_0x232df5[_0x737a('0x1a')][_0x737a('0x1c')]);return _0x37ddff(_0x232df5['error'][_0x737a('0x1c')]);}logger[_0x737a('0x1a')](_0x737a('0x15'),_0x4567d3,_0x232df5[_0x737a('0x1a')]['message']);return _0x3fc683(_0x232df5[_0x737a('0x1a')][_0x737a('0x1c')]);}else{logger[_0x737a('0x14')](_0x737a('0x15'),_0x4567d3,_0x737a('0x16'));_0x3fc683(_0x232df5[_0x737a('0x1d')][_0x737a('0x1c')]);}})['catch'](function(_0x709f45){logger[_0x737a('0x1a')](_0x737a('0x15'),_0x4567d3,_0x709f45);_0x37ddff(_0x709f45);});});}exports[_0x737a('0x1e')]=function(_0x3257c1){var _0x42632f=this;return new Promise(function(_0x19760e,_0x4eb81b){return db[_0x737a('0x1f')][_0x737a('0x20')](_0x3257c1[_0x737a('0x21')],{'raw':_0x3257c1['options']?_0x3257c1['options'][_0x737a('0x22')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3257c1['options']?_0x3257c1[_0x737a('0x23')][_0x737a('0x24')]||null:null,'attributes':_0x3257c1[_0x737a('0x23')]?_0x3257c1[_0x737a('0x23')][_0x737a('0x25')]||null:null,'limit':_0x3257c1[_0x737a('0x23')]?_0x3257c1[_0x737a('0x23')][_0x737a('0x26')]||null:null})[_0x737a('0x13')](function(_0x2a6a5){logger[_0x737a('0x14')]('UpdateWhatsappInteraction',_0x3257c1);logger[_0x737a('0x17')](_0x737a('0x1e'),_0x3257c1,JSON['stringify'](_0x2a6a5));_0x19760e(_0x2a6a5);})[_0x737a('0x27')](function(_0x122e44){logger[_0x737a('0x1a')](_0x737a('0x1e'),_0x122e44[_0x737a('0x1c')],_0x3257c1);_0x4eb81b(_0x42632f[_0x737a('0x1a')](0x1f4,_0x122e44[_0x737a('0x1c')]));});});};exports[_0x737a('0x28')]=function(_0x11b7f1){return new Promise(function(_0x17e274,_0x2207ca){return db[_0x737a('0x1f')][_0x737a('0x29')]({'where':_0x11b7f1[_0x737a('0x23')]?_0x11b7f1['options'][_0x737a('0x24')]||null:null})[_0x737a('0x13')](function(_0x30e133){if(_0x30e133){return _0x30e133[_0x737a('0x2a')](_0x11b7f1[_0x737a('0x21')][_0x737a('0x2b')],_[_0x737a('0x2c')](_0x11b7f1[_0x737a('0x21')],[_0x737a('0x2b'),'id'])||{});}})['spread'](function(_0x3b393b){logger[_0x737a('0x14')](_0x737a('0x2d'),_0x11b7f1);logger[_0x737a('0x17')](_0x737a('0x2d'),_0x11b7f1,JSON[_0x737a('0x19')](_0x3b393b));_0x17e274(_0x3b393b);})[_0x737a('0x27')](function(_0x7da47c){logger[_0x737a('0x1a')](_0x737a('0x2d'),_0x7da47c['message'],_0x11b7f1);_0x2207ca(_this[_0x737a('0x1a')](0x1f4,_0x7da47c['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.socket.js b/server/api/whatsappInteraction/whatsappInteraction.socket.js index 01971fa..4a30ea1 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 _0x9591=['./whatsappInteraction.events','save','update','emit','removeListener','register','length','whatsappInteraction:'];(function(_0x3ab380,_0x382d01){var _0x8a0f9a=function(_0x3ade5f){while(--_0x3ade5f){_0x3ab380['push'](_0x3ab380['shift']());}};_0x8a0f9a(++_0x382d01);}(_0x9591,0xa8));var _0x1959=function(_0x373dcb,_0x11eab1){_0x373dcb=_0x373dcb-0x0;var _0x2ece70=_0x9591[_0x373dcb];return _0x2ece70;};'use strict';var WhatsappInteractionEvents=require(_0x1959('0x0'));var events=[_0x1959('0x1'),'remove',_0x1959('0x2')];function createListener(_0x3df685,_0x19ca84){return function(_0x388fb7){_0x19ca84[_0x1959('0x3')](_0x3df685,_0x388fb7);};}function removeListener(_0x1a80c2,_0x479de1){return function(){WhatsappInteractionEvents[_0x1959('0x4')](_0x1a80c2,_0x479de1);};}exports[_0x1959('0x5')]=function(_0x21e65a){for(var _0x3596cb=0x0,_0x54ba1f=events[_0x1959('0x6')];_0x3596cb<_0x54ba1f;_0x3596cb++){var _0x1c1162=events[_0x3596cb];var _0x244d93=createListener(_0x1959('0x7')+_0x1c1162,_0x21e65a);WhatsappInteractionEvents['on'](_0x1c1162,_0x244d93);}}; \ No newline at end of file +var _0x7063=['emit','removeListener','length','whatsappInteraction:','./whatsappInteraction.events','remove','update'];(function(_0x21b135,_0x2817c4){var _0x36aef1=function(_0xa5ecb4){while(--_0xa5ecb4){_0x21b135['push'](_0x21b135['shift']());}};_0x36aef1(++_0x2817c4);}(_0x7063,0x82));var _0x3706=function(_0x5622f6,_0x663ed0){_0x5622f6=_0x5622f6-0x0;var _0x2c3552=_0x7063[_0x5622f6];return _0x2c3552;};'use strict';var WhatsappInteractionEvents=require(_0x3706('0x0'));var events=['save',_0x3706('0x1'),_0x3706('0x2')];function createListener(_0x73124c,_0x435548){return function(_0x42815f){_0x435548[_0x3706('0x3')](_0x73124c,_0x42815f);};}function removeListener(_0x1f0202,_0x226ab2){return function(){WhatsappInteractionEvents[_0x3706('0x4')](_0x1f0202,_0x226ab2);};}exports['register']=function(_0x239d21){for(var _0x2e661e=0x0,_0x2a6065=events[_0x3706('0x5')];_0x2e661e<_0x2a6065;_0x2e661e++){var _0x27b765=events[_0x2e661e];var _0x2003ac=createListener(_0x3706('0x6')+_0x27b765,_0x239d21);WhatsappInteractionEvents['on'](_0x27b765,_0x2003ac);}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/index.js b/server/api/whatsappMessage/index.js index f631c74..28ad5f2 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 _0xd835=['fs-extra','../../components/interaction/service','../../config/environment','./whatsappMessage.controller','get','isAuthenticated','index','/describe','describe','show','post','tracked','whatsapp','whatsappmessage:create','create','/:id/status','status','put','/:id','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports','multer','util','path','connect-timeout','Router'];(function(_0x3c624d,_0x3b7597){var _0x4c5c3f=function(_0xf58afb){while(--_0xf58afb){_0x3c624d['push'](_0x3c624d['shift']());}};_0x4c5c3f(++_0x3b7597);}(_0xd835,0xf3));var _0x5d83=function(_0x296809,_0x1c9665){_0x296809=_0x296809-0x0;var _0x18c0d3=_0xd835[_0x296809];return _0x18c0d3;};'use strict';var multer=require(_0x5d83('0x0'));var util=require(_0x5d83('0x1'));var path=require(_0x5d83('0x2'));var timeout=require(_0x5d83('0x3'));var express=require('express');var router=express[_0x5d83('0x4')]();var fs_extra=require(_0x5d83('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x5d83('0x6'));var config=require(_0x5d83('0x7'));var controller=require(_0x5d83('0x8'));router[_0x5d83('0x9')]('/',auth[_0x5d83('0xa')](),controller[_0x5d83('0xb')]);router[_0x5d83('0x9')](_0x5d83('0xc'),auth[_0x5d83('0xa')](),controller[_0x5d83('0xd')]);router[_0x5d83('0x9')]('/:id',auth[_0x5d83('0xa')](),controller[_0x5d83('0xe')]);router[_0x5d83('0xf')]('/',auth[_0x5d83('0xa')](),interaction[_0x5d83('0x10')](_0x5d83('0x11'),_0x5d83('0x12')),controller[_0x5d83('0x13')]);router[_0x5d83('0xf')](_0x5d83('0x14'),controller[_0x5d83('0x15')]);router[_0x5d83('0x16')](_0x5d83('0x17'),auth[_0x5d83('0xa')](),controller['update']);router[_0x5d83('0x16')](_0x5d83('0x18'),auth[_0x5d83('0xa')](),controller[_0x5d83('0x19')]);router[_0x5d83('0x16')](_0x5d83('0x1a'),auth[_0x5d83('0xa')](),controller[_0x5d83('0x1b')]);router[_0x5d83('0x1c')](_0x5d83('0x17'),auth[_0x5d83('0xa')](),controller[_0x5d83('0x1d')]);module[_0x5d83('0x1e')]=router; \ No newline at end of file +var _0xea07=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','index','/describe','isAuthenticated','describe','/:id','show','tracked','whatsapp','whatsappmessage:create','status','put','update','/:id/accept','accept','reject','delete','exports','util','path','connect-timeout'];(function(_0x221500,_0x12e9dc){var _0x3743f4=function(_0x34053c){while(--_0x34053c){_0x221500['push'](_0x221500['shift']());}};_0x3743f4(++_0x12e9dc);}(_0xea07,0x7f));var _0x7ea0=function(_0x4d34b1,_0x1eeeae){_0x4d34b1=_0x4d34b1-0x0;var _0x29ac29=_0xea07[_0x4d34b1];return _0x29ac29;};'use strict';var multer=require('multer');var util=require(_0x7ea0('0x0'));var path=require(_0x7ea0('0x1'));var timeout=require(_0x7ea0('0x2'));var express=require(_0x7ea0('0x3'));var router=express[_0x7ea0('0x4')]();var fs_extra=require(_0x7ea0('0x5'));var auth=require(_0x7ea0('0x6'));var interaction=require(_0x7ea0('0x7'));var config=require('../../config/environment');var controller=require('./whatsappMessage.controller');router[_0x7ea0('0x8')]('/',auth['isAuthenticated'](),controller[_0x7ea0('0x9')]);router[_0x7ea0('0x8')](_0x7ea0('0xa'),auth[_0x7ea0('0xb')](),controller[_0x7ea0('0xc')]);router[_0x7ea0('0x8')](_0x7ea0('0xd'),auth[_0x7ea0('0xb')](),controller[_0x7ea0('0xe')]);router['post']('/',auth[_0x7ea0('0xb')](),interaction[_0x7ea0('0xf')](_0x7ea0('0x10'),_0x7ea0('0x11')),controller['create']);router['post']('/:id/status',controller[_0x7ea0('0x12')]);router[_0x7ea0('0x13')](_0x7ea0('0xd'),auth[_0x7ea0('0xb')](),controller[_0x7ea0('0x14')]);router[_0x7ea0('0x13')](_0x7ea0('0x15'),auth['isAuthenticated'](),controller[_0x7ea0('0x16')]);router[_0x7ea0('0x13')]('/:id/reject',auth['isAuthenticated'](),controller[_0x7ea0('0x17')]);router[_0x7ea0('0x18')](_0x7ea0('0xd'),auth['isAuthenticated'](),controller['destroy']);module[_0x7ea0('0x19')]=router; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.attributes.js b/server/api/whatsappMessage/whatsappMessage.attributes.js index 45334b5..696c5bb 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 _0x1f44=['BOOLEAN','STRING','sequelize','TEXT'];(function(_0x8bedec,_0x271809){var _0x24f1d8=function(_0x5e9031){while(--_0x5e9031){_0x8bedec['push'](_0x8bedec['shift']());}};_0x24f1d8(++_0x271809);}(_0x1f44,0x14a));var _0x41f4=function(_0x49ab21,_0x49afb4){_0x49ab21=_0x49ab21-0x0;var _0x4a5934=_0x1f44[_0x49ab21];return _0x4a5934;};'use strict';var Sequelize=require(_0x41f4('0x0'));module['exports']={'body':{'type':Sequelize[_0x41f4('0x1')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x41f4('0x2')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0x41f4('0x3')](0xbe)},'phone':{'type':Sequelize[_0x41f4('0x3')]},'readAt':{'type':Sequelize['DATE']},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0x41f4('0x1')]}}; \ No newline at end of file +var _0xa0c9=['BOOLEAN','ENUM','out','DATE','STRING','TEXT','sequelize','exports','medium'];(function(_0x3e0b8f,_0x1cddeb){var _0x22f742=function(_0xacb1bc){while(--_0xacb1bc){_0x3e0b8f['push'](_0x3e0b8f['shift']());}};_0x22f742(++_0x1cddeb);}(_0xa0c9,0xf0));var _0x9a0c=function(_0x5be09a,_0x525dc7){_0x5be09a=_0x5be09a-0x0;var _0x143708=_0xa0c9[_0x5be09a];return _0x143708;};'use strict';var Sequelize=require(_0x9a0c('0x0'));module[_0x9a0c('0x1')]={'body':{'type':Sequelize['TEXT'](_0x9a0c('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x9a0c('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x9a0c('0x4')]('in',_0x9a0c('0x5')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize[_0x9a0c('0x6')]},'secret':{'type':Sequelize[_0x9a0c('0x3')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x9a0c('0x7')]},'providerResponse':{'type':Sequelize[_0x9a0c('0x8')]}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.controller.js b/server/api/whatsappMessage/whatsappMessage.controller.js index 1a8fee8..32b537f 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 _0x8fe9=['destroy','stack','name','send','map','WhatsappMessage','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','keys','rawAttributes','create','body','find','describe','whatsapp-interactions','accept','read','readAt','format','UserId','user','agent','get','WhatsappInteraction','WhatsappInteractionId','isNil','read1stAt','YYYY-MM-DD\x20HH:mm:ss','interaction','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','internal','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','reject','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','fullname','email','rejectmessage','WhatsappAccount','WhatsappAccountId','WhatsppMessage,\x20%s,\x20%s,\x20%s','twilio','WhatsappAccount,\x20%s,\x20%s,\x20%s','inspect','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','./whatsappMessage.socket','register','client','http','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','end','status','offset','undefined','count','limit','json','apply','update'];(function(_0x399873,_0x44bb8b){var _0x1cf2e3=function(_0x261a5b){while(--_0x261a5b){_0x399873['push'](_0x399873['shift']());}};_0x1cf2e3(++_0x44bb8b);}(_0x8fe9,0x15d));var _0x98fe=function(_0x210603,_0x4adbac){_0x210603=_0x210603-0x0;var _0x1bcb7d=_0x8fe9[_0x210603];return _0x1bcb7d;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x98fe('0x0'));var jsonpatch=require(_0x98fe('0x1'));var rp=require(_0x98fe('0x2'));var moment=require('moment');var BPromise=require(_0x98fe('0x3'));var Mustache=require(_0x98fe('0x4'));var util=require(_0x98fe('0x5'));var path=require(_0x98fe('0x6'));var sox=require(_0x98fe('0x7'));var csv=require(_0x98fe('0x8'));var ejs=require(_0x98fe('0x9'));var fs=require('fs');var fs_extra=require(_0x98fe('0xa'));var _=require(_0x98fe('0xb'));var squel=require('squel');var crypto=require(_0x98fe('0xc'));var jsforce=require(_0x98fe('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x98fe('0x8'));var querystring=require(_0x98fe('0xe'));var Papa=require(_0x98fe('0xf'));var Redis=require(_0x98fe('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x98fe('0x11'));var as=require(_0x98fe('0x12'));var hardwareService=require(_0x98fe('0x13'));var logger=require(_0x98fe('0x14'))(_0x98fe('0x15'));var utils=require(_0x98fe('0x16'));var config=require(_0x98fe('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x98fe('0x18'))['db'];config[_0x98fe('0x19')]=_[_0x98fe('0x1a')](config[_0x98fe('0x19')],{'host':_0x98fe('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x98fe('0x19')]));require(_0x98fe('0x1c'))[_0x98fe('0x1d')](socket);var jayson=require('jayson/promise');var client=jayson[_0x98fe('0x1e')][_0x98fe('0x1f')]({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x26bfe1,_0x4f4ab7,_0x2b7eba,_0x365c0){return new BPromise(function(_0x3556e2,_0x434678){var _0x5118a3=_0x365c0||client;return _0x5118a3['request'](_0x26bfe1,_0x2b7eba)[_0x98fe('0x20')](function(_0x1a7a25){logger[_0x98fe('0x21')](_0x98fe('0x22'),_0x4f4ab7,_0x98fe('0x23'));logger[_0x98fe('0x24')](_0x98fe('0x25'),_0x4f4ab7,_0x98fe('0x23'),JSON[_0x98fe('0x26')](_0x1a7a25));if(_0x1a7a25['error']){if(_0x1a7a25[_0x98fe('0x27')]['code']===0x1f4){logger[_0x98fe('0x27')]('WhatsappMessage,\x20%s,\x20%s',_0x4f4ab7,_0x1a7a25[_0x98fe('0x27')][_0x98fe('0x28')]);return _0x434678(_0x1a7a25[_0x98fe('0x27')]['message']);}logger[_0x98fe('0x27')]('WhatsappMessage,\x20%s,\x20%s',_0x4f4ab7,_0x1a7a25[_0x98fe('0x27')][_0x98fe('0x28')]);return _0x3556e2(_0x1a7a25['error'][_0x98fe('0x28')]);}else{logger[_0x98fe('0x21')]('WhatsappMessage,\x20%s,\x20%s',_0x4f4ab7,'request\x20sent');_0x3556e2(_0x1a7a25[_0x98fe('0x29')][_0x98fe('0x28')]);}})[_0x98fe('0x2a')](function(_0x3a84d6){logger[_0x98fe('0x27')](_0x98fe('0x22'),_0x4f4ab7,_0x3a84d6);_0x434678(_0x3a84d6);});});}function respondWithStatusCode(_0x43d340,_0x51882a){_0x51882a=_0x51882a||0xcc;return function(_0x1f7f9c){if(_0x1f7f9c){return _0x43d340[_0x98fe('0x2b')](_0x51882a);}return _0x43d340['status'](_0x51882a)[_0x98fe('0x2c')]();};}function respondWithResult(_0x40b687,_0x4f0981){_0x4f0981=_0x4f0981||0xc8;return function(_0x5e07a9){if(_0x5e07a9){return _0x40b687[_0x98fe('0x2d')](_0x4f0981)['json'](_0x5e07a9);}};}function respondWithFilteredResult(_0xb071f9,_0x389b01){return function(_0x2c252d){if(_0x2c252d){var _0x42af7e=typeof _0x389b01[_0x98fe('0x2e')]==='undefined'&&typeof _0x389b01['limit']===_0x98fe('0x2f');var _0xc78130=_0x2c252d['count'];var _0x8ae17b=_0x42af7e?0x0:_0x389b01[_0x98fe('0x2e')];var _0x39bbbf=_0x42af7e?_0x2c252d[_0x98fe('0x30')]:_0x389b01['offset']+_0x389b01[_0x98fe('0x31')];var _0x3ed36a;if(_0x39bbbf>=_0xc78130){_0x39bbbf=_0xc78130;_0x3ed36a=0xc8;}else{_0x3ed36a=0xce;}_0xb071f9[_0x98fe('0x2d')](_0x3ed36a);return _0xb071f9['set']('Content-Range',_0x8ae17b+'-'+_0x39bbbf+'/'+_0xc78130)[_0x98fe('0x32')](_0x2c252d);}return null;};}function patchUpdates(_0x12a435){return function(_0x2ef844){try{jsonpatch[_0x98fe('0x33')](_0x2ef844,_0x12a435,!![]);}catch(_0x369fad){return BPromise['reject'](_0x369fad);}return _0x2ef844['save']();};}function saveUpdates(_0x39216f,_0x1571e3){return function(_0xadf821){if(_0xadf821){return _0xadf821[_0x98fe('0x34')](_0x39216f)[_0x98fe('0x20')](function(_0x19cbab){return _0x19cbab;});}return null;};}function removeEntity(_0x5c9731,_0x1235bc){return function(_0x117933){if(_0x117933){return _0x117933[_0x98fe('0x35')]()[_0x98fe('0x20')](function(){_0x5c9731[_0x98fe('0x2d')](0xcc)[_0x98fe('0x2c')]();});}};}function handleEntityNotFound(_0x126d4e,_0x1ab431){return function(_0x175f09){if(!_0x175f09){_0x126d4e['sendStatus'](0x194);}return _0x175f09;};}function handleError(_0x5e4a5c,_0x2c90b3){_0x2c90b3=_0x2c90b3||0x1f4;return function(_0x4d2005){logger[_0x98fe('0x27')](_0x4d2005[_0x98fe('0x36')]);if(_0x4d2005[_0x98fe('0x37')]){delete _0x4d2005['name'];}_0x5e4a5c[_0x98fe('0x2d')](_0x2c90b3)[_0x98fe('0x38')](_0x4d2005);};}exports['index']=function(_0x1b9bc0,_0x57ecf1){var _0x34c456={},_0x49031a={},_0x588494={'count':0x0,'rows':[]};var _0x1b939d=_[_0x98fe('0x39')](db[_0x98fe('0x3a')]['rawAttributes'],function(_0x178bb8){return{'name':_0x178bb8['fieldName'],'type':_0x178bb8[_0x98fe('0x3b')][_0x98fe('0x3c')]};});_0x49031a[_0x98fe('0x3d')]=_[_0x98fe('0x39')](_0x1b939d,_0x98fe('0x37'));_0x49031a['query']=_['keys'](_0x1b9bc0[_0x98fe('0x3e')]);_0x49031a[_0x98fe('0x3f')]=_[_0x98fe('0x40')](_0x49031a[_0x98fe('0x3d')],_0x49031a['query']);_0x34c456[_0x98fe('0x41')]=_[_0x98fe('0x40')](_0x49031a['model'],qs[_0x98fe('0x42')](_0x1b9bc0[_0x98fe('0x3e')][_0x98fe('0x42')]));_0x34c456[_0x98fe('0x41')]=_0x34c456[_0x98fe('0x41')][_0x98fe('0x43')]?_0x34c456[_0x98fe('0x41')]:_0x49031a[_0x98fe('0x3d')];if(!_0x1b9bc0['query'][_0x98fe('0x44')]('nolimit')){_0x34c456[_0x98fe('0x31')]=qs[_0x98fe('0x31')](_0x1b9bc0[_0x98fe('0x3e')][_0x98fe('0x31')]);_0x34c456[_0x98fe('0x2e')]=qs[_0x98fe('0x2e')](_0x1b9bc0[_0x98fe('0x3e')][_0x98fe('0x2e')]);}_0x34c456[_0x98fe('0x45')]=qs[_0x98fe('0x46')](_0x1b9bc0['query'][_0x98fe('0x46')]);_0x34c456[_0x98fe('0x47')]=qs[_0x98fe('0x3f')](_['pick'](_0x1b9bc0['query'],_0x49031a['filters']),_0x1b939d);if(_0x1b9bc0[_0x98fe('0x3e')][_0x98fe('0x48')]){_0x34c456['where']=_[_0x98fe('0x49')](_0x34c456[_0x98fe('0x47')],{'$or':_[_0x98fe('0x39')](_0x1b939d,function(_0x4a02c3){if(_0x4a02c3[_0x98fe('0x3b')]!==_0x98fe('0x4a')){var _0x458a26={};_0x458a26[_0x4a02c3[_0x98fe('0x37')]]={'$like':'%'+_0x1b9bc0[_0x98fe('0x3e')][_0x98fe('0x48')]+'%'};return _0x458a26;}})});}_0x34c456=_[_0x98fe('0x49')]({},_0x34c456,_0x1b9bc0[_0x98fe('0x4b')]);var _0x2bc845={'where':_0x34c456[_0x98fe('0x47')]};return db[_0x98fe('0x3a')]['count'](_0x2bc845)['then'](function(_0x1af13c){_0x588494[_0x98fe('0x30')]=_0x1af13c;if(_0x1b9bc0[_0x98fe('0x3e')][_0x98fe('0x4c')]){_0x34c456[_0x98fe('0x4d')]=[{'all':!![]}];}return db[_0x98fe('0x3a')][_0x98fe('0x4e')](_0x34c456);})[_0x98fe('0x20')](function(_0x45c598){_0x588494[_0x98fe('0x4f')]=_0x45c598;return _0x588494;})[_0x98fe('0x20')](respondWithFilteredResult(_0x57ecf1,_0x34c456))[_0x98fe('0x2a')](handleError(_0x57ecf1,null));};exports[_0x98fe('0x50')]=function(_0x37fe53,_0x696d60){var _0x18e4f3={'raw':!![],'where':{'id':_0x37fe53[_0x98fe('0x51')]['id']}},_0x5a26a9={};_0x5a26a9[_0x98fe('0x3d')]=_[_0x98fe('0x52')](db[_0x98fe('0x3a')][_0x98fe('0x53')]);_0x5a26a9['query']=_[_0x98fe('0x52')](_0x37fe53[_0x98fe('0x3e')]);_0x5a26a9['filters']=_[_0x98fe('0x40')](_0x5a26a9['model'],_0x5a26a9[_0x98fe('0x3e')]);_0x18e4f3[_0x98fe('0x41')]=_[_0x98fe('0x40')](_0x5a26a9[_0x98fe('0x3d')],qs[_0x98fe('0x42')](_0x37fe53[_0x98fe('0x3e')][_0x98fe('0x42')]));_0x18e4f3['attributes']=_0x18e4f3[_0x98fe('0x41')]['length']?_0x18e4f3[_0x98fe('0x41')]:_0x5a26a9[_0x98fe('0x3d')];if(_0x37fe53['query'][_0x98fe('0x4c')]){_0x18e4f3[_0x98fe('0x4d')]=[{'all':!![]}];}_0x18e4f3=_[_0x98fe('0x49')]({},_0x18e4f3,_0x37fe53['options']);return db[_0x98fe('0x3a')]['find'](_0x18e4f3)[_0x98fe('0x20')](handleEntityNotFound(_0x696d60,null))['then'](respondWithResult(_0x696d60,null))['catch'](handleError(_0x696d60,null));};exports[_0x98fe('0x54')]=function(_0x4e73ca,_0x26277b){return db[_0x98fe('0x3a')][_0x98fe('0x54')](_0x4e73ca[_0x98fe('0x55')],{})[_0x98fe('0x20')](respondWithResult(_0x26277b,0xc9))['catch'](handleError(_0x26277b,null));};exports[_0x98fe('0x34')]=function(_0x54c3c6,_0x3a9223){if(_0x54c3c6[_0x98fe('0x55')]['id']){delete _0x54c3c6[_0x98fe('0x55')]['id'];}return db[_0x98fe('0x3a')][_0x98fe('0x56')]({'where':{'id':_0x54c3c6['params']['id']}})['then'](handleEntityNotFound(_0x3a9223,null))[_0x98fe('0x20')](saveUpdates(_0x54c3c6['body'],null))[_0x98fe('0x20')](respondWithResult(_0x3a9223,null))['catch'](handleError(_0x3a9223,null));};exports[_0x98fe('0x35')]=function(_0xfaaaf1,_0x46ad01){return db['WhatsappMessage'][_0x98fe('0x56')]({'where':{'id':_0xfaaaf1[_0x98fe('0x51')]['id']}})['then'](handleEntityNotFound(_0x46ad01,null))['then'](removeEntity(_0x46ad01,null))[_0x98fe('0x2a')](handleError(_0x46ad01,null));};exports[_0x98fe('0x57')]=function(_0x367ba4,_0x25cfc6){return db['WhatsappMessage']['describe']()[_0x98fe('0x20')](respondWithResult(_0x25cfc6,null))[_0x98fe('0x2a')](handleError(_0x25cfc6,null));};var interaction_log=require(_0x98fe('0x14'))(_0x98fe('0x58'));exports[_0x98fe('0x59')]=function(_0x2484b3,_0x2edccd,_0x45121b){var _0x2eebb9={'agent':{},'channel':'whatsapp'};if(_0x2484b3[_0x98fe('0x55')]['id']){delete _0x2484b3[_0x98fe('0x55')]['id'];}_0x2484b3[_0x98fe('0x55')][_0x98fe('0x5a')]=!![];_0x2484b3[_0x98fe('0x55')][_0x98fe('0x5b')]=moment()[_0x98fe('0x5c')]('YYYY-MM-DD\x20HH:mm:ss');_0x2484b3[_0x98fe('0x55')][_0x98fe('0x5d')]=_0x2484b3[_0x98fe('0x55')][_0x98fe('0x5d')]||_0x2484b3[_0x98fe('0x5e')]['id'];_0x2eebb9[_0x98fe('0x5f')]['id']=_0x2484b3[_0x98fe('0x55')][_0x98fe('0x5d')];return db['WhatsappMessage']['find']({'where':{'id':_0x2484b3['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x2edccd,null))[_0x98fe('0x20')](saveUpdates(_0x2484b3[_0x98fe('0x55')],null))[_0x98fe('0x20')](function(_0x5e7d0e){if(_0x5e7d0e){_0x2eebb9[_0x98fe('0x28')]=_0x5e7d0e[_0x98fe('0x60')]({'plain':!![]});return db[_0x98fe('0x61')]['find']({'where':{'id':_0x5e7d0e[_0x98fe('0x62')]}});}return null;})[_0x98fe('0x20')](handleEntityNotFound(_0x2edccd,null))[_0x98fe('0x20')](function(_0x29099d){if(_0x29099d){return _0x29099d[_0x98fe('0x34')]({'UserId':_0x2484b3[_0x98fe('0x55')][_0x98fe('0x5d')],'read1stAt':_[_0x98fe('0x63')](_0x29099d[_0x98fe('0x64')])?moment()[_0x98fe('0x5c')](_0x98fe('0x65')):undefined});}return null;})[_0x98fe('0x20')](function(_0x2f506c){if(_0x2f506c){_0x2eebb9[_0x98fe('0x66')]=_0x2f506c[_0x98fe('0x60')]({'plain':!![]});interaction_log[_0x98fe('0x21')](_0x98fe('0x67'),_0x2484b3[_0x98fe('0x5e')]['id'],_0x2484b3[_0x98fe('0x5e')]['name'],_0x2484b3[_0x98fe('0x5e')][_0x98fe('0x68')],_0x2eebb9[_0x98fe('0x66')]['id'],_0x2484b3[_0x98fe('0x55')]?JSON[_0x98fe('0x26')](_0x2484b3[_0x98fe('0x55')]):'null');return respondWithRpcPromise('AcceptMessage','acceptMessage',_0x2eebb9);}return null;})[_0x98fe('0x20')](function(_0xe70a30){var _0x1adf23=_0x98fe('0x69')+_0xe70a30['message'][_0x98fe('0x6a')];return db[_0x98fe('0x6b')][_0x98fe('0x3e')](_0x1adf23,{'type':db[_0x98fe('0x6c')][_0x98fe('0x6d')][_0x98fe('0x6e')],'raw':!![]})[_0x98fe('0x20')](function(_0x3e4155){return _0x3e4155;});})[_0x98fe('0x20')](function(_0x258e5d){if(_0x258e5d){_0x2eebb9[_0x98fe('0x28')][_0x98fe('0x6f')]=_0x258e5d[0x0];if(!_0x2484b3[_0x98fe('0x55')]['UserId'])return;return db[_0x98fe('0x70')]['find']({'where':{'id':_0x2484b3[_0x98fe('0x55')][_0x98fe('0x5d')],'role':_0x98fe('0x5f')},'attributes':['id',_0x98fe('0x37'),'fullname','email',_0x98fe('0x71')],'raw':!![]});}return null;})[_0x98fe('0x20')](function(_0x473224){if(!_0x473224)return null;_0x2eebb9[_0x98fe('0x28')]['agent']=_0x473224;return _0x2eebb9;})[_0x98fe('0x20')](function(_0x586cff){if(_0x586cff){if(_0x2484b3[_0x98fe('0x55')][_0x98fe('0x72')]){_0x2eebb9[_0x98fe('0x28')][_0x98fe('0x73')]=util[_0x98fe('0x5c')](_0x98fe('0x74'),_0x2484b3['user'][_0x98fe('0x37')]);_0x2eebb9['message'][_0x98fe('0x75')]=_0x2eebb9['channel'];_0x2eebb9['message'][_0x98fe('0x76')]=_0x2eebb9[_0x98fe('0x75')];_0x2eebb9[_0x98fe('0x28')][_0x98fe('0x77')]=_0x98fe('0x59');return respondWithRpcPromise(_0x98fe('0x78'),_0x98fe('0x78'),{'event':_0x98fe('0x79'),'message':_0x2eebb9['message']},client9002)[_0x98fe('0x20')](function(){return _0x2eebb9;});}return _0x2eebb9;}return null;})[_0x98fe('0x20')](respondWithResult(_0x2edccd,null))[_0x98fe('0x2a')](handleError(_0x2edccd,null));};var interaction_log=require(_0x98fe('0x14'))(_0x98fe('0x58'));exports[_0x98fe('0x7a')]=function(_0x3b4c91,_0x3ff2ca,_0xd9382b){var _0xcd99e5={'agent':{},'channel':'whatsapp'};if(_0x3b4c91['body']['id']){delete _0x3b4c91[_0x98fe('0x55')]['id'];}_0x3b4c91[_0x98fe('0x55')][_0x98fe('0x5d')]=_0x3b4c91[_0x98fe('0x55')][_0x98fe('0x5d')]||_0x3b4c91[_0x98fe('0x5e')]['id'];_0xcd99e5['agent']['id']=_0x3b4c91[_0x98fe('0x55')]['UserId'];return db['WhatsappMessage'][_0x98fe('0x56')]({'where':{'id':_0x3b4c91[_0x98fe('0x51')]['id'],'UserId':null}})[_0x98fe('0x20')](handleEntityNotFound(_0x3ff2ca,null))['then'](function(_0x3b6dd4){if(_0x3b6dd4){_0xcd99e5[_0x98fe('0x28')]=_0x3b6dd4[_0x98fe('0x60')]({'plain':!![]});return db[_0x98fe('0x61')][_0x98fe('0x56')]({'where':{'id':_0x3b6dd4[_0x98fe('0x62')]}});}return null;})[_0x98fe('0x20')](handleEntityNotFound(_0x3ff2ca,null))[_0x98fe('0x20')](function(_0x330511){if(_0x330511){_0xcd99e5[_0x98fe('0x66')]=_0x330511['get']({'plain':!![]});interaction_log[_0x98fe('0x21')](_0x98fe('0x7b'),_0x3b4c91['user']['id'],_0x3b4c91[_0x98fe('0x5e')]['name'],_0x3b4c91[_0x98fe('0x5e')][_0x98fe('0x68')],_0xcd99e5['interaction']['id'],_0x3b4c91[_0x98fe('0x55')]?JSON[_0x98fe('0x26')](_0x3b4c91[_0x98fe('0x55')]):_0x98fe('0x7c'));return respondWithRpcPromise('RejectMessage','rejectMessage',_0xcd99e5);}return null;})[_0x98fe('0x20')](function(_0x4e2160){var _0x210fd0=_0x98fe('0x69')+_0x4e2160[_0x98fe('0x28')]['ContactId'];return db[_0x98fe('0x6b')][_0x98fe('0x3e')](_0x210fd0,{'type':db[_0x98fe('0x6c')][_0x98fe('0x6d')][_0x98fe('0x6e')],'raw':!![]})[_0x98fe('0x20')](function(_0x3f89e4){return _0x3f89e4;});})[_0x98fe('0x20')](function(_0x16d1bc){if(_0x16d1bc){_0xcd99e5[_0x98fe('0x28')][_0x98fe('0x6f')]=_0x16d1bc[0x0];if(!_0x3b4c91['body'][_0x98fe('0x5d')])return;return db[_0x98fe('0x70')][_0x98fe('0x56')]({'where':{'id':_0x3b4c91[_0x98fe('0x55')][_0x98fe('0x5d')],'role':_0x98fe('0x5f')},'attributes':['id',_0x98fe('0x37'),_0x98fe('0x7d'),_0x98fe('0x7e'),_0x98fe('0x71')],'raw':!![]});}return null;})[_0x98fe('0x20')](function(_0xa2fc31){if(!_0xa2fc31)return null;_0xcd99e5[_0x98fe('0x28')][_0x98fe('0x5f')]=_0xa2fc31;return _0xcd99e5;})[_0x98fe('0x20')](function(_0x17d1b2){if(_0x17d1b2){_0x17d1b2[_0x98fe('0x28')][_0x98fe('0x73')]=util[_0x98fe('0x5c')](_0x98fe('0x74'),_0x3b4c91['user']['name']);_0x17d1b2[_0x98fe('0x28')][_0x98fe('0x75')]=_0xcd99e5[_0x98fe('0x75')];_0x17d1b2[_0x98fe('0x28')][_0x98fe('0x76')]=_0xcd99e5[_0x98fe('0x75')];_0x17d1b2[_0x98fe('0x28')][_0x98fe('0x77')]=_0x98fe('0x7a');respondWithRpcPromise(_0x98fe('0x78'),_0x98fe('0x78'),{'event':_0x98fe('0x7f'),'message':_0x17d1b2['message']},client9002);return _0xcd99e5;}return null;})['then'](respondWithResult(_0x3ff2ca,null))[_0x98fe('0x2a')](handleError(_0x3ff2ca,null));};exports[_0x98fe('0x2d')]=function(_0x3e6782,_0x1e08f9,_0x5727c5){if(_0x3e6782[_0x98fe('0x55')]['id']){delete _0x3e6782[_0x98fe('0x55')]['id'];}var _0x14352f;return db['WhatsappMessage'][_0x98fe('0x56')]({'where':{'id':_0x3e6782[_0x98fe('0x51')]['id']}})[_0x98fe('0x20')](handleEntityNotFound(_0x1e08f9,null))[_0x98fe('0x20')](function(_0x182f6b){if(_0x182f6b){_0x14352f=_0x182f6b;return db[_0x98fe('0x80')][_0x98fe('0x56')]({'where':{'id':_0x182f6b[_0x98fe('0x81')]}});}})['then'](handleEntityNotFound(_0x1e08f9,null))['then'](function(_0xac7dd5){if(_0xac7dd5){logger['debug'](_0x98fe('0x82'),_0x98fe('0x2d'),'received\x20delivery\x20report\x20from',_0xac7dd5[_0x98fe('0x3b')],util['inspect'](_0x3e6782['body'],{'showHidden':![],'depth':null}));switch(_0xac7dd5['type']){case _0x98fe('0x83'):if(_0x3e6782[_0x98fe('0x55')]['MessageSid']&&_0x3e6782['body']['MessageSid']===_0x14352f['messageId']&&_0x3e6782[_0x98fe('0x55')]['MessageStatus']&&_0x3e6782[_0x98fe('0x55')]['MessageStatus']===_0x98fe('0x5a')){return _0x14352f[_0x98fe('0x34')]({'read':!![]});}else{logger[_0x98fe('0x27')](_0x98fe('0x84'),_0x98fe('0x2d'),_0x98fe('0x83'),util[_0x98fe('0x85')](_0x3e6782['body'],{'showHidden':![],'depth':null}));}break;}return _0x14352f;}})['then'](respondWithResult(_0x1e08f9,null))[_0x98fe('0x2a')](handleError(_0x1e08f9,null));}; \ No newline at end of file +var _0x0384=['WhatsappInteractionId','isNil','read1stAt','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','interaction','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','QueryTypes','SELECT','agent','fullname','email','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','Sequelize','contact','User','internal','WhatsappAccount','WhatsappAccountId','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','MessageSid','messageId','MessageStatus','twilio','inspect','eml-format','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','defaults','socket.io-emitter','redis','./whatsappMessage.socket','jayson/promise','client','http','request','info','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','WhatsappMessage,\x20%s,\x20%s','message','catch','sendStatus','end','json','offset','undefined','limit','count','status','set','Content-Range','reject','save','update','then','destroy','stack','name','index','map','fieldName','type','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','VIRTUAL','includeAll','include','WhatsappMessage','findAll','rows','show','rawAttributes','options','create','body','find','params','accept','whatsapp','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','get','WhatsappInteraction'];(function(_0x5d0f7c,_0x10d1ed){var _0x23feb5=function(_0x141101){while(--_0x141101){_0x5d0f7c['push'](_0x5d0f7c['shift']());}};_0x23feb5(++_0x10d1ed);}(_0x0384,0xb2));var _0x4038=function(_0x3d01cf,_0x3e24aa){_0x3d01cf=_0x3d01cf-0x0;var _0x2a192e=_0x0384[_0x3d01cf];return _0x2a192e;};'use strict';var emlformat=require(_0x4038('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x4038('0x1'));var rp=require(_0x4038('0x2'));var moment=require(_0x4038('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x4038('0x4'));var path=require(_0x4038('0x5'));var sox=require(_0x4038('0x6'));var csv=require(_0x4038('0x7'));var ejs=require(_0x4038('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4038('0x9'));var squel=require(_0x4038('0xa'));var crypto=require('crypto');var jsforce=require(_0x4038('0xb'));var deskjs=require(_0x4038('0xc'));var toCsv=require(_0x4038('0x7'));var querystring=require(_0x4038('0xd'));var Papa=require(_0x4038('0xe'));var Redis=require(_0x4038('0xf'));var authService=require(_0x4038('0x10'));var qs=require(_0x4038('0x11'));var as=require(_0x4038('0x12'));var hardwareService=require(_0x4038('0x13'));var logger=require(_0x4038('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x4038('0x15'));var licenseUtil=require(_0x4038('0x16'));var db=require(_0x4038('0x17'))['db'];config['redis']=_[_0x4038('0x18')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x4038('0x19'))(new Redis(config[_0x4038('0x1a')]));require(_0x4038('0x1b'))['register'](socket);var jayson=require(_0x4038('0x1c'));var client=jayson[_0x4038('0x1d')][_0x4038('0x1e')]({'port':0x232c});var client9002=jayson[_0x4038('0x1d')][_0x4038('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x4360cf,_0x11f9c2,_0x472117,_0x1ab68b){return new BPromise(function(_0xd17f5a,_0x29cf21){var _0x4b5a2b=_0x1ab68b||client;return _0x4b5a2b[_0x4038('0x1f')](_0x4360cf,_0x472117)['then'](function(_0x5a2f01){logger[_0x4038('0x20')]('WhatsappMessage,\x20%s,\x20%s',_0x11f9c2,_0x4038('0x21'));logger[_0x4038('0x22')](_0x4038('0x23'),_0x11f9c2,'request\x20sent',JSON[_0x4038('0x24')](_0x5a2f01));if(_0x5a2f01[_0x4038('0x25')]){if(_0x5a2f01[_0x4038('0x25')]['code']===0x1f4){logger[_0x4038('0x25')](_0x4038('0x26'),_0x11f9c2,_0x5a2f01['error']['message']);return _0x29cf21(_0x5a2f01[_0x4038('0x25')]['message']);}logger[_0x4038('0x25')](_0x4038('0x26'),_0x11f9c2,_0x5a2f01[_0x4038('0x25')][_0x4038('0x27')]);return _0xd17f5a(_0x5a2f01[_0x4038('0x25')][_0x4038('0x27')]);}else{logger[_0x4038('0x20')]('WhatsappMessage,\x20%s,\x20%s',_0x11f9c2,_0x4038('0x21'));_0xd17f5a(_0x5a2f01['result'][_0x4038('0x27')]);}})[_0x4038('0x28')](function(_0x1391d6){logger['error'](_0x4038('0x26'),_0x11f9c2,_0x1391d6);_0x29cf21(_0x1391d6);});});}function respondWithStatusCode(_0x248201,_0x12de77){_0x12de77=_0x12de77||0xcc;return function(_0x1308a6){if(_0x1308a6){return _0x248201[_0x4038('0x29')](_0x12de77);}return _0x248201['status'](_0x12de77)[_0x4038('0x2a')]();};}function respondWithResult(_0x459800,_0x22b70d){_0x22b70d=_0x22b70d||0xc8;return function(_0x13fa23){if(_0x13fa23){return _0x459800['status'](_0x22b70d)[_0x4038('0x2b')](_0x13fa23);}};}function respondWithFilteredResult(_0xbc00f4,_0x5e9c2a){return function(_0x13fa96){if(_0x13fa96){var _0x235876=typeof _0x5e9c2a[_0x4038('0x2c')]===_0x4038('0x2d')&&typeof _0x5e9c2a[_0x4038('0x2e')]===_0x4038('0x2d');var _0x2954e0=_0x13fa96[_0x4038('0x2f')];var _0x220f0f=_0x235876?0x0:_0x5e9c2a[_0x4038('0x2c')];var _0x59d07c=_0x235876?_0x13fa96[_0x4038('0x2f')]:_0x5e9c2a[_0x4038('0x2c')]+_0x5e9c2a[_0x4038('0x2e')];var _0x550f9f;if(_0x59d07c>=_0x2954e0){_0x59d07c=_0x2954e0;_0x550f9f=0xc8;}else{_0x550f9f=0xce;}_0xbc00f4[_0x4038('0x30')](_0x550f9f);return _0xbc00f4[_0x4038('0x31')](_0x4038('0x32'),_0x220f0f+'-'+_0x59d07c+'/'+_0x2954e0)[_0x4038('0x2b')](_0x13fa96);}return null;};}function patchUpdates(_0x2ea4cf){return function(_0x1a3bdb){try{jsonpatch['apply'](_0x1a3bdb,_0x2ea4cf,!![]);}catch(_0x38ff49){return BPromise[_0x4038('0x33')](_0x38ff49);}return _0x1a3bdb[_0x4038('0x34')]();};}function saveUpdates(_0x37f1e8,_0x4e4f22){return function(_0x388a73){if(_0x388a73){return _0x388a73[_0x4038('0x35')](_0x37f1e8)[_0x4038('0x36')](function(_0x571ec3){return _0x571ec3;});}return null;};}function removeEntity(_0x26e1bf,_0x2c9c30){return function(_0x37eb7e){if(_0x37eb7e){return _0x37eb7e[_0x4038('0x37')]()[_0x4038('0x36')](function(){_0x26e1bf[_0x4038('0x30')](0xcc)[_0x4038('0x2a')]();});}};}function handleEntityNotFound(_0x34d73e,_0x536457){return function(_0x1f2f3e){if(!_0x1f2f3e){_0x34d73e['sendStatus'](0x194);}return _0x1f2f3e;};}function handleError(_0x4ea470,_0x25b868){_0x25b868=_0x25b868||0x1f4;return function(_0x3af177){logger[_0x4038('0x25')](_0x3af177[_0x4038('0x38')]);if(_0x3af177[_0x4038('0x39')]){delete _0x3af177[_0x4038('0x39')];}_0x4ea470['status'](_0x25b868)['send'](_0x3af177);};}exports[_0x4038('0x3a')]=function(_0x3ccafa,_0x156db7){var _0x10b508={},_0x302095={},_0x12529a={'count':0x0,'rows':[]};var _0x334332=_[_0x4038('0x3b')](db['WhatsappMessage']['rawAttributes'],function(_0x18e8de){return{'name':_0x18e8de[_0x4038('0x3c')],'type':_0x18e8de[_0x4038('0x3d')][_0x4038('0x3e')]};});_0x302095[_0x4038('0x3f')]=_[_0x4038('0x3b')](_0x334332,'name');_0x302095[_0x4038('0x40')]=_[_0x4038('0x41')](_0x3ccafa[_0x4038('0x40')]);_0x302095['filters']=_['intersection'](_0x302095['model'],_0x302095['query']);_0x10b508[_0x4038('0x42')]=_[_0x4038('0x43')](_0x302095[_0x4038('0x3f')],qs[_0x4038('0x44')](_0x3ccafa[_0x4038('0x40')][_0x4038('0x44')]));_0x10b508[_0x4038('0x42')]=_0x10b508['attributes'][_0x4038('0x45')]?_0x10b508[_0x4038('0x42')]:_0x302095[_0x4038('0x3f')];if(!_0x3ccafa[_0x4038('0x40')][_0x4038('0x46')]('nolimit')){_0x10b508[_0x4038('0x2e')]=qs[_0x4038('0x2e')](_0x3ccafa[_0x4038('0x40')][_0x4038('0x2e')]);_0x10b508[_0x4038('0x2c')]=qs[_0x4038('0x2c')](_0x3ccafa[_0x4038('0x40')][_0x4038('0x2c')]);}_0x10b508[_0x4038('0x47')]=qs[_0x4038('0x48')](_0x3ccafa[_0x4038('0x40')][_0x4038('0x48')]);_0x10b508[_0x4038('0x49')]=qs[_0x4038('0x4a')](_[_0x4038('0x4b')](_0x3ccafa[_0x4038('0x40')],_0x302095['filters']),_0x334332);if(_0x3ccafa[_0x4038('0x40')][_0x4038('0x4c')]){_0x10b508[_0x4038('0x49')]=_[_0x4038('0x4d')](_0x10b508['where'],{'$or':_[_0x4038('0x3b')](_0x334332,function(_0x14c804){if(_0x14c804['type']!==_0x4038('0x4e')){var _0x115a84={};_0x115a84[_0x14c804[_0x4038('0x39')]]={'$like':'%'+_0x3ccafa[_0x4038('0x40')]['filter']+'%'};return _0x115a84;}})});}_0x10b508=_[_0x4038('0x4d')]({},_0x10b508,_0x3ccafa['options']);var _0xb6b50d={'where':_0x10b508[_0x4038('0x49')]};return db['WhatsappMessage'][_0x4038('0x2f')](_0xb6b50d)[_0x4038('0x36')](function(_0x45e947){_0x12529a['count']=_0x45e947;if(_0x3ccafa[_0x4038('0x40')][_0x4038('0x4f')]){_0x10b508[_0x4038('0x50')]=[{'all':!![]}];}return db[_0x4038('0x51')][_0x4038('0x52')](_0x10b508);})[_0x4038('0x36')](function(_0x4dc0f7){_0x12529a[_0x4038('0x53')]=_0x4dc0f7;return _0x12529a;})[_0x4038('0x36')](respondWithFilteredResult(_0x156db7,_0x10b508))['catch'](handleError(_0x156db7,null));};exports[_0x4038('0x54')]=function(_0xedf737,_0x14737b){var _0x47bfd7={'raw':!![],'where':{'id':_0xedf737['params']['id']}},_0x5dfa35={};_0x5dfa35[_0x4038('0x3f')]=_[_0x4038('0x41')](db[_0x4038('0x51')][_0x4038('0x55')]);_0x5dfa35[_0x4038('0x40')]=_[_0x4038('0x41')](_0xedf737['query']);_0x5dfa35['filters']=_['intersection'](_0x5dfa35[_0x4038('0x3f')],_0x5dfa35['query']);_0x47bfd7['attributes']=_[_0x4038('0x43')](_0x5dfa35[_0x4038('0x3f')],qs[_0x4038('0x44')](_0xedf737[_0x4038('0x40')][_0x4038('0x44')]));_0x47bfd7['attributes']=_0x47bfd7[_0x4038('0x42')][_0x4038('0x45')]?_0x47bfd7[_0x4038('0x42')]:_0x5dfa35['model'];if(_0xedf737[_0x4038('0x40')][_0x4038('0x4f')]){_0x47bfd7[_0x4038('0x50')]=[{'all':!![]}];}_0x47bfd7=_['merge']({},_0x47bfd7,_0xedf737[_0x4038('0x56')]);return db[_0x4038('0x51')]['find'](_0x47bfd7)['then'](handleEntityNotFound(_0x14737b,null))[_0x4038('0x36')](respondWithResult(_0x14737b,null))[_0x4038('0x28')](handleError(_0x14737b,null));};exports[_0x4038('0x57')]=function(_0x861ae0,_0x265cad){return db[_0x4038('0x51')][_0x4038('0x57')](_0x861ae0[_0x4038('0x58')],{})[_0x4038('0x36')](respondWithResult(_0x265cad,0xc9))['catch'](handleError(_0x265cad,null));};exports[_0x4038('0x35')]=function(_0xad143d,_0x52c99e){if(_0xad143d[_0x4038('0x58')]['id']){delete _0xad143d[_0x4038('0x58')]['id'];}return db[_0x4038('0x51')][_0x4038('0x59')]({'where':{'id':_0xad143d[_0x4038('0x5a')]['id']}})[_0x4038('0x36')](handleEntityNotFound(_0x52c99e,null))[_0x4038('0x36')](saveUpdates(_0xad143d[_0x4038('0x58')],null))[_0x4038('0x36')](respondWithResult(_0x52c99e,null))[_0x4038('0x28')](handleError(_0x52c99e,null));};exports[_0x4038('0x37')]=function(_0xfa1676,_0x4365ad){return db[_0x4038('0x51')]['find']({'where':{'id':_0xfa1676[_0x4038('0x5a')]['id']}})[_0x4038('0x36')](handleEntityNotFound(_0x4365ad,null))[_0x4038('0x36')](removeEntity(_0x4365ad,null))[_0x4038('0x28')](handleError(_0x4365ad,null));};exports['describe']=function(_0x31966e,_0x3512a2){return db[_0x4038('0x51')]['describe']()[_0x4038('0x36')](respondWithResult(_0x3512a2,null))[_0x4038('0x28')](handleError(_0x3512a2,null));};var interaction_log=require(_0x4038('0x14'))('whatsapp-interactions');exports[_0x4038('0x5b')]=function(_0x27e528,_0x1e4ddf,_0x4e2e3){var _0x35fa2d={'agent':{},'channel':_0x4038('0x5c')};if(_0x27e528[_0x4038('0x58')]['id']){delete _0x27e528['body']['id'];}_0x27e528['body'][_0x4038('0x5d')]=!![];_0x27e528[_0x4038('0x58')][_0x4038('0x5e')]=moment()[_0x4038('0x5f')](_0x4038('0x60'));_0x27e528[_0x4038('0x58')]['UserId']=_0x27e528[_0x4038('0x58')][_0x4038('0x61')]||_0x27e528['user']['id'];_0x35fa2d['agent']['id']=_0x27e528[_0x4038('0x58')][_0x4038('0x61')];return db[_0x4038('0x51')][_0x4038('0x59')]({'where':{'id':_0x27e528[_0x4038('0x5a')]['id'],'UserId':null}})[_0x4038('0x36')](handleEntityNotFound(_0x1e4ddf,null))[_0x4038('0x36')](saveUpdates(_0x27e528[_0x4038('0x58')],null))[_0x4038('0x36')](function(_0x301ccf){if(_0x301ccf){_0x35fa2d[_0x4038('0x27')]=_0x301ccf[_0x4038('0x62')]({'plain':!![]});return db[_0x4038('0x63')]['find']({'where':{'id':_0x301ccf[_0x4038('0x64')]}});}return null;})[_0x4038('0x36')](handleEntityNotFound(_0x1e4ddf,null))['then'](function(_0x5f506c){if(_0x5f506c){return _0x5f506c[_0x4038('0x35')]({'UserId':_0x27e528[_0x4038('0x58')][_0x4038('0x61')],'read1stAt':_[_0x4038('0x65')](_0x5f506c[_0x4038('0x66')])?moment()[_0x4038('0x5f')](_0x4038('0x60')):undefined});}return null;})[_0x4038('0x36')](function(_0x496132){if(_0x496132){_0x35fa2d['interaction']=_0x496132[_0x4038('0x62')]({'plain':!![]});interaction_log[_0x4038('0x20')](_0x4038('0x67'),_0x27e528[_0x4038('0x68')]['id'],_0x27e528['user']['name'],_0x27e528[_0x4038('0x68')][_0x4038('0x69')],_0x35fa2d[_0x4038('0x6a')]['id'],_0x27e528['body']?JSON[_0x4038('0x24')](_0x27e528[_0x4038('0x58')]):_0x4038('0x6b'));return respondWithRpcPromise(_0x4038('0x6c'),_0x4038('0x6d'),_0x35fa2d);}return null;})[_0x4038('0x36')](function(_0xe5f7e9){var _0x540d5e=_0x4038('0x6e')+_0xe5f7e9['message'][_0x4038('0x6f')];return db[_0x4038('0x70')][_0x4038('0x40')](_0x540d5e,{'type':db['Sequelize'][_0x4038('0x71')][_0x4038('0x72')],'raw':!![]})[_0x4038('0x36')](function(_0xd98ee6){return _0xd98ee6;});})[_0x4038('0x36')](function(_0x900194){if(_0x900194){_0x35fa2d[_0x4038('0x27')]['contact']=_0x900194[0x0];if(!_0x27e528['body'][_0x4038('0x61')])return;return db['User'][_0x4038('0x59')]({'where':{'id':_0x27e528[_0x4038('0x58')][_0x4038('0x61')],'role':_0x4038('0x73')},'attributes':['id',_0x4038('0x39'),_0x4038('0x74'),_0x4038('0x75'),'internal'],'raw':!![]});}return null;})[_0x4038('0x36')](function(_0x59792d){if(!_0x59792d)return null;_0x35fa2d[_0x4038('0x27')][_0x4038('0x73')]=_0x59792d;return _0x35fa2d;})[_0x4038('0x36')](function(_0x3f7fe8){if(_0x3f7fe8){if(_0x27e528[_0x4038('0x58')]['manual']){_0x35fa2d[_0x4038('0x27')][_0x4038('0x76')]=util[_0x4038('0x5f')](_0x4038('0x77'),_0x27e528['user'][_0x4038('0x39')]);_0x35fa2d[_0x4038('0x27')][_0x4038('0x78')]=_0x35fa2d[_0x4038('0x78')];_0x35fa2d[_0x4038('0x27')][_0x4038('0x79')]=_0x35fa2d[_0x4038('0x78')];_0x35fa2d['message'][_0x4038('0x7a')]=_0x4038('0x5b');return respondWithRpcPromise('EventManager',_0x4038('0x7b'),{'event':_0x4038('0x7c'),'message':_0x35fa2d[_0x4038('0x27')]},client9002)[_0x4038('0x36')](function(){return _0x35fa2d;});}return _0x35fa2d;}return null;})[_0x4038('0x36')](respondWithResult(_0x1e4ddf,null))[_0x4038('0x28')](handleError(_0x1e4ddf,null));};var interaction_log=require(_0x4038('0x14'))('whatsapp-interactions');exports['reject']=function(_0x118a91,_0x2e3bc3,_0x4be990){var _0x57f5e8={'agent':{},'channel':_0x4038('0x5c')};if(_0x118a91[_0x4038('0x58')]['id']){delete _0x118a91[_0x4038('0x58')]['id'];}_0x118a91[_0x4038('0x58')][_0x4038('0x61')]=_0x118a91[_0x4038('0x58')][_0x4038('0x61')]||_0x118a91[_0x4038('0x68')]['id'];_0x57f5e8[_0x4038('0x73')]['id']=_0x118a91[_0x4038('0x58')][_0x4038('0x61')];return db[_0x4038('0x51')][_0x4038('0x59')]({'where':{'id':_0x118a91[_0x4038('0x5a')]['id'],'UserId':null}})[_0x4038('0x36')](handleEntityNotFound(_0x2e3bc3,null))[_0x4038('0x36')](function(_0xd9fb85){if(_0xd9fb85){_0x57f5e8[_0x4038('0x27')]=_0xd9fb85[_0x4038('0x62')]({'plain':!![]});return db[_0x4038('0x63')][_0x4038('0x59')]({'where':{'id':_0xd9fb85[_0x4038('0x64')]}});}return null;})[_0x4038('0x36')](handleEntityNotFound(_0x2e3bc3,null))[_0x4038('0x36')](function(_0xbbb267){if(_0xbbb267){_0x57f5e8[_0x4038('0x6a')]=_0xbbb267[_0x4038('0x62')]({'plain':!![]});interaction_log[_0x4038('0x20')](_0x4038('0x7d'),_0x118a91[_0x4038('0x68')]['id'],_0x118a91[_0x4038('0x68')][_0x4038('0x39')],_0x118a91['user'][_0x4038('0x69')],_0x57f5e8[_0x4038('0x6a')]['id'],_0x118a91[_0x4038('0x58')]?JSON[_0x4038('0x24')](_0x118a91[_0x4038('0x58')]):_0x4038('0x6b'));return respondWithRpcPromise('RejectMessage','rejectMessage',_0x57f5e8);}return null;})[_0x4038('0x36')](function(_0x50b8f7){var _0x14942=_0x4038('0x6e')+_0x50b8f7['message'][_0x4038('0x6f')];return db[_0x4038('0x70')][_0x4038('0x40')](_0x14942,{'type':db[_0x4038('0x7e')]['QueryTypes']['SELECT'],'raw':!![]})[_0x4038('0x36')](function(_0x3bd3d9){return _0x3bd3d9;});})[_0x4038('0x36')](function(_0x220372){if(_0x220372){_0x57f5e8['message'][_0x4038('0x7f')]=_0x220372[0x0];if(!_0x118a91[_0x4038('0x58')]['UserId'])return;return db[_0x4038('0x80')]['find']({'where':{'id':_0x118a91[_0x4038('0x58')]['UserId'],'role':'agent'},'attributes':['id','name',_0x4038('0x74'),_0x4038('0x75'),_0x4038('0x81')],'raw':!![]});}return null;})[_0x4038('0x36')](function(_0x37fd3e){if(!_0x37fd3e)return null;_0x57f5e8[_0x4038('0x27')][_0x4038('0x73')]=_0x37fd3e;return _0x57f5e8;})[_0x4038('0x36')](function(_0x4cf4df){if(_0x4cf4df){_0x4cf4df['message'][_0x4038('0x76')]=util['format'](_0x4038('0x77'),_0x118a91[_0x4038('0x68')][_0x4038('0x39')]);_0x4cf4df['message'][_0x4038('0x78')]=_0x57f5e8[_0x4038('0x78')];_0x4cf4df['message'][_0x4038('0x79')]=_0x57f5e8[_0x4038('0x78')];_0x4cf4df[_0x4038('0x27')][_0x4038('0x7a')]=_0x4038('0x33');respondWithRpcPromise('EventManager',_0x4038('0x7b'),{'event':'rejectmessage','message':_0x4cf4df[_0x4038('0x27')]},client9002);return _0x57f5e8;}return null;})[_0x4038('0x36')](respondWithResult(_0x2e3bc3,null))[_0x4038('0x28')](handleError(_0x2e3bc3,null));};exports[_0x4038('0x30')]=function(_0x1fb581,_0x568df3,_0x4d63d7){if(_0x1fb581[_0x4038('0x58')]['id']){delete _0x1fb581[_0x4038('0x58')]['id'];}var _0x2aa655;return db[_0x4038('0x51')]['find']({'where':{'id':_0x1fb581[_0x4038('0x5a')]['id']}})[_0x4038('0x36')](handleEntityNotFound(_0x568df3,null))[_0x4038('0x36')](function(_0x46a2ce){if(_0x46a2ce){_0x2aa655=_0x46a2ce;return db[_0x4038('0x82')][_0x4038('0x59')]({'where':{'id':_0x46a2ce[_0x4038('0x83')]}});}})[_0x4038('0x36')](handleEntityNotFound(_0x568df3,null))[_0x4038('0x36')](function(_0x26d699){if(_0x26d699){logger[_0x4038('0x22')](_0x4038('0x84'),_0x4038('0x30'),_0x4038('0x85'),_0x26d699[_0x4038('0x3d')],util['inspect'](_0x1fb581['body'],{'showHidden':![],'depth':null}));switch(_0x26d699[_0x4038('0x3d')]){case'twilio':if(_0x1fb581['body'][_0x4038('0x86')]&&_0x1fb581[_0x4038('0x58')][_0x4038('0x86')]===_0x2aa655[_0x4038('0x87')]&&_0x1fb581[_0x4038('0x58')][_0x4038('0x88')]&&_0x1fb581['body']['MessageStatus']===_0x4038('0x5d')){return _0x2aa655[_0x4038('0x35')]({'read':!![]});}else{logger[_0x4038('0x25')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x4038('0x30'),_0x4038('0x89'),util[_0x4038('0x8a')](_0x1fb581[_0x4038('0x58')],{'showHidden':![],'depth':null}));}break;}return _0x2aa655;}})['then'](respondWithResult(_0x568df3,null))[_0x4038('0x28')](handleError(_0x568df3,null));}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.events.js b/server/api/whatsappMessage/whatsappMessage.events.js index d69b20d..d6d6417 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 _0xcecc=['update','remove','emit','hasOwnProperty','hook','exports','events','WhatsappMessage'];(function(_0x244797,_0x6a7e67){var _0x4a6258=function(_0x345a0b){while(--_0x345a0b){_0x244797['push'](_0x244797['shift']());}};_0x4a6258(++_0x6a7e67);}(_0xcecc,0x186));var _0xccec=function(_0x125704,_0x389e3d){_0x125704=_0x125704-0x0;var _0x49caa7=_0xcecc[_0x125704];return _0x49caa7;};'use strict';var EventEmitter=require(_0xccec('0x0'));var WhatsappMessage=require('../../mysqldb')['db'][_0xccec('0x1')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xccec('0x2'),'afterDestroy':_0xccec('0x3')};function emitEvent(_0x338b16){return function(_0xa10c6f,_0x4b1996,_0x4b0fb9){WhatsappMessageEvents[_0xccec('0x4')](_0x338b16+':'+_0xa10c6f['id'],_0xa10c6f);WhatsappMessageEvents['emit'](_0x338b16,_0xa10c6f);_0x4b0fb9(null);};}for(var e in events){if(events[_0xccec('0x5')](e)){var event=events[e];WhatsappMessage[_0xccec('0x6')](e,emitEvent(event));}}module[_0xccec('0x7')]=WhatsappMessageEvents; \ No newline at end of file +var _0x96cc=['remove','emit','hook','exports','events','WhatsappMessage','save','update'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x96cc,0x16c));var _0xc96c=function(_0x3911a0,_0x399077){_0x3911a0=_0x3911a0-0x0;var _0xf3dd14=_0x96cc[_0x3911a0];return _0xf3dd14;};'use strict';var EventEmitter=require(_0xc96c('0x0'));var WhatsappMessage=require('../../mysqldb')['db'][_0xc96c('0x1')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xc96c('0x2'),'afterUpdate':_0xc96c('0x3'),'afterDestroy':_0xc96c('0x4')};function emitEvent(_0x421701){return function(_0x71140d,_0x29b6f1,_0x377e6c){WhatsappMessageEvents[_0xc96c('0x5')](_0x421701+':'+_0x71140d['id'],_0x71140d);WhatsappMessageEvents[_0xc96c('0x5')](_0x421701,_0x71140d);_0x377e6c(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappMessage[_0xc96c('0x6')](e,emitEvent(event));}}module[_0xc96c('0x7')]=WhatsappMessageEvents; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.model.js b/server/api/whatsappMessage/whatsappMessage.model.js index 569e17b..5c75d4e 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 _0xc7a7=['models','direction','toLowerCase','out','secret','isNil','WhatsappInteraction','findOne','WhatsappInteractionId','then','createdAt','catch','error','WhatsappAccount','find','WhatsappAccountId','type','twilio','authToken','create','whatsapp:','phone','remote','/api/whatsapp/messages/','token','update','sid','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','finally','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./whatsappMessage.attributes','exports','define','whatsapp_messages','messageId','body','FULLTEXT'];(function(_0x1b3581,_0x93be01){var _0x40dac5=function(_0x47cc9b){while(--_0x47cc9b){_0x1b3581['push'](_0x1b3581['shift']());}};_0x40dac5(++_0x93be01);}(_0xc7a7,0x171));var _0x7c7a=function(_0x2acef0,_0x341553){_0x2acef0=_0x2acef0-0x0;var _0x2e7a8e=_0xc7a7[_0x2acef0];return _0x2e7a8e;};'use strict';var _=require(_0x7c7a('0x0'));var util=require(_0x7c7a('0x1'));var logger=require(_0x7c7a('0x2'))('api');var moment=require(_0x7c7a('0x3'));var BPromise=require(_0x7c7a('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7c7a('0x5'));var rimraf=require(_0x7c7a('0x6'));var config=require(_0x7c7a('0x7'));var attributes=require(_0x7c7a('0x8'));module[_0x7c7a('0x9')]=function(_0xc84abf,_0x346f96){return _0xc84abf[_0x7c7a('0xa')]('WhatsappMessage',attributes,{'tableName':_0x7c7a('0xb'),'paranoid':![],'indexes':[{'name':_0x7c7a('0xc'),'fields':[_0x7c7a('0xc')]},{'name':'fti_whatsapp_messages','fields':[_0x7c7a('0xd')],'type':_0x7c7a('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x112bf9,_0x1c93b6,_0x21a16b){var _0x402e94=_0xc84abf[_0x7c7a('0xf')];var _0x375ec0=_0x112bf9['get']({'plain':!![]});if(_0x375ec0[_0x7c7a('0x10')][_0x7c7a('0x11')]()==='in'||_0x375ec0[_0x7c7a('0x10')][_0x7c7a('0x11')]()===_0x7c7a('0x12')&&!_0x375ec0[_0x7c7a('0x13')]&&!_[_0x7c7a('0x14')](_0x375ec0['UserId'])){_0x402e94[_0x7c7a('0x15')][_0x7c7a('0x16')]({'where':{'id':_0x375ec0[_0x7c7a('0x17')]}})[_0x7c7a('0x18')](function(_0xd97646){if(_0xd97646){_0xd97646['update']({'lastMsgAt':_0x375ec0[_0x7c7a('0x19')],'lastMsgDirection':_0x375ec0['direction'][_0x7c7a('0x11')]()});}})[_0x7c7a('0x1a')](function(_0x7da88b){console[_0x7c7a('0x1b')](_0x7da88b);});}if(_0x375ec0[_0x7c7a('0x10')]===_0x7c7a('0x12')&&!_0x375ec0[_0x7c7a('0x13')]){var _0x20e32d;_0x402e94[_0x7c7a('0x1c')][_0x7c7a('0x1d')]({'where':{'id':_0x375ec0[_0x7c7a('0x1e')]},'raw':!![]})[_0x7c7a('0x18')](function(_0x482fb1){_0x20e32d=_0x482fb1;if(_0x20e32d&&_0x20e32d[_0x7c7a('0x1f')]){switch(_0x20e32d[_0x7c7a('0x1f')]){case _0x7c7a('0x20'):var _0x1c60ef=require('twilio');if(_0x20e32d['accountSid']&&_0x20e32d[_0x7c7a('0x21')]&&_0x20e32d['phone']){var _0x3a267a=new _0x1c60ef(_0x20e32d['accountSid'],_0x20e32d[_0x7c7a('0x21')]);_0x3a267a['messages'][_0x7c7a('0x22')]({'body':_0x375ec0[_0x7c7a('0xd')],'to':'whatsapp:'+_0x375ec0['phone'],'from':_0x7c7a('0x23')+_0x20e32d[_0x7c7a('0x24')],'statusCallback':_0x20e32d[_0x7c7a('0x25')]+_0x7c7a('0x26')+_0x375ec0['id']+'/status?token='+_0x20e32d[_0x7c7a('0x27')]})[_0x7c7a('0x18')](function(_0x568aec){if(_0x568aec['sid']){return _0x112bf9[_0x7c7a('0x28')]({'messageId':_0x568aec[_0x7c7a('0x29')]});}})[_0x7c7a('0x1a')](function(_0x43a847){logger[_0x7c7a('0x1b')](_0x7c7a('0x2a'),_0x7c7a('0x2b'),_0x7c7a('0x20'),util[_0x7c7a('0x2c')](_0x43a847,{'showHidden':![],'depth':null}));});}else{logger[_0x7c7a('0x1b')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x7c7a('0x2b'),'twilio',_0x7c7a('0x2d'));}break;}}})[_0x7c7a('0x2e')](function(){_0x21a16b();});}else{_0x21a16b();}}},'charset':'utf8mb4','collate':_0x7c7a('0x2f')});}; \ No newline at end of file +var _0xd5dd=['catch','error','WhatsappAccount','WhatsappAccountId','twilio','accountSid','authToken','messages','create','whatsapp:','phone','remote','/status?token=','token','sid','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','finally','utf8mb4','lodash','util','../../config/logger','api','path','../../config/environment','./whatsappMessage.attributes','exports','WhatsappMessage','whatsapp_messages','messageId','fti_whatsapp_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','UserId','WhatsappInteraction','findOne','WhatsappInteractionId','then','update','createdAt'];(function(_0x320b9e,_0x1f892f){var _0x5e4416=function(_0x160fcc){while(--_0x160fcc){_0x320b9e['push'](_0x320b9e['shift']());}};_0x5e4416(++_0x1f892f);}(_0xd5dd,0xd4));var _0xdd5d=function(_0x207816,_0x40b96b){_0x207816=_0x207816-0x0;var _0x158fa7=_0xd5dd[_0x207816];return _0x158fa7;};'use strict';var _=require(_0xdd5d('0x0'));var util=require(_0xdd5d('0x1'));var logger=require(_0xdd5d('0x2'))(_0xdd5d('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xdd5d('0x4'));var rimraf=require('rimraf');var config=require(_0xdd5d('0x5'));var attributes=require(_0xdd5d('0x6'));module[_0xdd5d('0x7')]=function(_0xdc772,_0x1eb977){return _0xdc772['define'](_0xdd5d('0x8'),attributes,{'tableName':_0xdd5d('0x9'),'paranoid':![],'indexes':[{'name':_0xdd5d('0xa'),'fields':['messageId']},{'name':_0xdd5d('0xb'),'fields':[_0xdd5d('0xc')],'type':_0xdd5d('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x57ddd2,_0x26bc27,_0xdb1709){var _0x26cb72=_0xdc772[_0xdd5d('0xe')];var _0x4c3af0=_0x57ddd2[_0xdd5d('0xf')]({'plain':!![]});if(_0x4c3af0[_0xdd5d('0x10')][_0xdd5d('0x11')]()==='in'||_0x4c3af0['direction'][_0xdd5d('0x11')]()===_0xdd5d('0x12')&&!_0x4c3af0[_0xdd5d('0x13')]&&!_[_0xdd5d('0x14')](_0x4c3af0[_0xdd5d('0x15')])){_0x26cb72[_0xdd5d('0x16')][_0xdd5d('0x17')]({'where':{'id':_0x4c3af0[_0xdd5d('0x18')]}})[_0xdd5d('0x19')](function(_0x5af584){if(_0x5af584){_0x5af584[_0xdd5d('0x1a')]({'lastMsgAt':_0x4c3af0[_0xdd5d('0x1b')],'lastMsgDirection':_0x4c3af0[_0xdd5d('0x10')]['toLowerCase']()});}})[_0xdd5d('0x1c')](function(_0x14e896){console[_0xdd5d('0x1d')](_0x14e896);});}if(_0x4c3af0[_0xdd5d('0x10')]===_0xdd5d('0x12')&&!_0x4c3af0[_0xdd5d('0x13')]){var _0x1a6be9;_0x26cb72[_0xdd5d('0x1e')]['find']({'where':{'id':_0x4c3af0[_0xdd5d('0x1f')]},'raw':!![]})[_0xdd5d('0x19')](function(_0x217916){_0x1a6be9=_0x217916;if(_0x1a6be9&&_0x1a6be9['type']){switch(_0x1a6be9['type']){case _0xdd5d('0x20'):var _0x57f94b=require(_0xdd5d('0x20'));if(_0x1a6be9[_0xdd5d('0x21')]&&_0x1a6be9[_0xdd5d('0x22')]&&_0x1a6be9['phone']){var _0x4caf9a=new _0x57f94b(_0x1a6be9[_0xdd5d('0x21')],_0x1a6be9[_0xdd5d('0x22')]);_0x4caf9a[_0xdd5d('0x23')][_0xdd5d('0x24')]({'body':_0x4c3af0[_0xdd5d('0xc')],'to':_0xdd5d('0x25')+_0x4c3af0['phone'],'from':_0xdd5d('0x25')+_0x1a6be9[_0xdd5d('0x26')],'statusCallback':_0x1a6be9[_0xdd5d('0x27')]+'/api/whatsapp/messages/'+_0x4c3af0['id']+_0xdd5d('0x28')+_0x1a6be9[_0xdd5d('0x29')]})['then'](function(_0x5f5594){if(_0x5f5594[_0xdd5d('0x2a')]){return _0x57ddd2[_0xdd5d('0x1a')]({'messageId':_0x5f5594[_0xdd5d('0x2a')]});}})['catch'](function(_0x16911f){logger[_0xdd5d('0x1d')](_0xdd5d('0x2b'),_0xdd5d('0x2c'),_0xdd5d('0x20'),util['inspect'](_0x16911f,{'showHidden':![],'depth':null}));});}else{logger[_0xdd5d('0x1d')](_0xdd5d('0x2b'),'afterCreate',_0xdd5d('0x20'),_0xdd5d('0x2d'));}break;}}})[_0xdd5d('0x2e')](function(){_0xdb1709();});}else{_0xdb1709();}}},'charset':_0xdd5d('0x2f'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.rpc.js b/server/api/whatsappMessage/whatsappMessage.rpc.js index 5d8b341..0f56e5d 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 _0xe1a8=['localhost','socket.io-emitter','./whatsappMessage.socket','register','request','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','CreateWhatsappMessage','WhatsappMessage','options','raw','debug','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults'];(function(_0x3a0cb2,_0x17bf0f){var _0x5ef05b=function(_0x35ee33){while(--_0x35ee33){_0x3a0cb2['push'](_0x3a0cb2['shift']());}};_0x5ef05b(++_0x17bf0f);}(_0xe1a8,0xe5));var _0x8e1a=function(_0x2e7b1b,_0x4b375e){_0x2e7b1b=_0x2e7b1b-0x0;var _0x167cf5=_0xe1a8[_0x2e7b1b];return _0x167cf5;};'use strict';var _=require('lodash');var util=require(_0x8e1a('0x0'));var moment=require(_0x8e1a('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8e1a('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x8e1a('0x3'));var logger=require(_0x8e1a('0x4'))(_0x8e1a('0x5'));var config=require(_0x8e1a('0x6'));var jayson=require(_0x8e1a('0x7'));var client=jayson['client'][_0x8e1a('0x8')]({'port':0x232a});config[_0x8e1a('0x9')]=_[_0x8e1a('0xa')](config[_0x8e1a('0x9')],{'host':_0x8e1a('0xb'),'port':0x18eb});var socket=require(_0x8e1a('0xc'))(new Redis(config[_0x8e1a('0x9')]));require(_0x8e1a('0xd'))[_0x8e1a('0xe')](socket);function respondWithRpcPromise(_0xff05dd,_0x10f4f0,_0x338e43){return new BPromise(function(_0x4bb02d,_0x314bfe){return client[_0x8e1a('0xf')](_0xff05dd,_0x338e43)[_0x8e1a('0x10')](function(_0x46641b){logger[_0x8e1a('0x11')](_0x8e1a('0x12'),_0x10f4f0,_0x8e1a('0x13'));logger['debug']('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x10f4f0,_0x8e1a('0x13'),JSON[_0x8e1a('0x14')](_0x46641b));if(_0x46641b['error']){if(_0x46641b[_0x8e1a('0x15')][_0x8e1a('0x16')]===0x1f4){logger[_0x8e1a('0x15')](_0x8e1a('0x12'),_0x10f4f0,_0x46641b[_0x8e1a('0x15')][_0x8e1a('0x17')]);return _0x314bfe(_0x46641b[_0x8e1a('0x15')][_0x8e1a('0x17')]);}logger['error'](_0x8e1a('0x12'),_0x10f4f0,_0x46641b['error'][_0x8e1a('0x17')]);return _0x4bb02d(_0x46641b['error']['message']);}else{logger[_0x8e1a('0x11')](_0x8e1a('0x12'),_0x10f4f0,_0x8e1a('0x13'));_0x4bb02d(_0x46641b[_0x8e1a('0x18')]['message']);}})['catch'](function(_0x9b58c5){logger[_0x8e1a('0x15')](_0x8e1a('0x12'),_0x10f4f0,_0x9b58c5);_0x314bfe(_0x9b58c5);});});}exports[_0x8e1a('0x19')]=function(_0xd414d7){var _0x3ade5b=this;return new Promise(function(_0x1b9d7a,_0x45faad){return db[_0x8e1a('0x1a')]['create'](_0xd414d7['body'],{'raw':_0xd414d7[_0x8e1a('0x1b')]?_0xd414d7[_0x8e1a('0x1b')][_0x8e1a('0x1c')]===undefined?!![]:![]:!![]})[_0x8e1a('0x10')](function(_0xe17a92){logger[_0x8e1a('0x11')](_0x8e1a('0x19'),_0xd414d7);logger[_0x8e1a('0x1d')](_0x8e1a('0x19'),_0xd414d7,JSON[_0x8e1a('0x14')](_0xe17a92));_0x1b9d7a(_0xe17a92);})['catch'](function(_0x268755){logger['error'](_0x8e1a('0x19'),_0x268755[_0x8e1a('0x17')],_0xd414d7);_0x45faad(_0x3ade5b[_0x8e1a('0x15')](0x1f4,_0x268755[_0x8e1a('0x17')]));});});}; \ No newline at end of file +var _0xdc2b=['create','body','options','raw','then','stringify','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','localhost','socket.io-emitter','./whatsappMessage.socket','register','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','CreateWhatsappMessage','WhatsappMessage'];(function(_0x10508d,_0x196fe8){var _0xee9d47=function(_0x4ac499){while(--_0x4ac499){_0x10508d['push'](_0x10508d['shift']());}};_0xee9d47(++_0x196fe8);}(_0xdc2b,0x1e6));var _0xbdc2=function(_0x1beef3,_0x57c4b8){_0x1beef3=_0x1beef3-0x0;var _0x5af964=_0xdc2b[_0x1beef3];return _0x5af964;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xbdc2('0x0'));var BPromise=require('bluebird');var rs=require(_0xbdc2('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbdc2('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0xbdc2('0x3'))(_0xbdc2('0x4'));var config=require(_0xbdc2('0x5'));var jayson=require(_0xbdc2('0x6'));var client=jayson[_0xbdc2('0x7')][_0xbdc2('0x8')]({'port':0x232a});config['redis']=_[_0xbdc2('0x9')](config['redis'],{'host':_0xbdc2('0xa'),'port':0x18eb});var socket=require(_0xbdc2('0xb'))(new Redis(config['redis']));require(_0xbdc2('0xc'))[_0xbdc2('0xd')](socket);function respondWithRpcPromise(_0x15c84a,_0x3d2a0d,_0x2efeb0){return new BPromise(function(_0x410913,_0x3410ea){return client['request'](_0x15c84a,_0x2efeb0)['then'](function(_0x41fe6f){logger[_0xbdc2('0xe')](_0xbdc2('0xf'),_0x3d2a0d,_0xbdc2('0x10'));logger[_0xbdc2('0x11')](_0xbdc2('0x12'),_0x3d2a0d,_0xbdc2('0x10'),JSON['stringify'](_0x41fe6f));if(_0x41fe6f['error']){if(_0x41fe6f[_0xbdc2('0x13')][_0xbdc2('0x14')]===0x1f4){logger['error'](_0xbdc2('0xf'),_0x3d2a0d,_0x41fe6f['error']['message']);return _0x3410ea(_0x41fe6f['error'][_0xbdc2('0x15')]);}logger[_0xbdc2('0x13')](_0xbdc2('0xf'),_0x3d2a0d,_0x41fe6f[_0xbdc2('0x13')][_0xbdc2('0x15')]);return _0x410913(_0x41fe6f[_0xbdc2('0x13')][_0xbdc2('0x15')]);}else{logger[_0xbdc2('0xe')](_0xbdc2('0xf'),_0x3d2a0d,_0xbdc2('0x10'));_0x410913(_0x41fe6f[_0xbdc2('0x16')][_0xbdc2('0x15')]);}})[_0xbdc2('0x17')](function(_0xaf93e9){logger[_0xbdc2('0x13')](_0xbdc2('0xf'),_0x3d2a0d,_0xaf93e9);_0x3410ea(_0xaf93e9);});});}exports[_0xbdc2('0x18')]=function(_0xb14796){var _0x3aff26=this;return new Promise(function(_0x59e28b,_0x6eaadb){return db[_0xbdc2('0x19')][_0xbdc2('0x1a')](_0xb14796[_0xbdc2('0x1b')],{'raw':_0xb14796[_0xbdc2('0x1c')]?_0xb14796[_0xbdc2('0x1c')][_0xbdc2('0x1d')]===undefined?!![]:![]:!![]})[_0xbdc2('0x1e')](function(_0x3bfd05){logger[_0xbdc2('0xe')]('CreateWhatsappMessage',_0xb14796);logger[_0xbdc2('0x11')](_0xbdc2('0x18'),_0xb14796,JSON[_0xbdc2('0x1f')](_0x3bfd05));_0x59e28b(_0x3bfd05);})[_0xbdc2('0x17')](function(_0x21a0bf){logger[_0xbdc2('0x13')](_0xbdc2('0x18'),_0x21a0bf['message'],_0xb14796);_0x6eaadb(_0x3aff26[_0xbdc2('0x13')](0x1f4,_0x21a0bf['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.socket.js b/server/api/whatsappMessage/whatsappMessage.socket.js index 396ea71..4674b9e 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 _0x9086=['whatsappMessage:','./whatsappMessage.events','save','remove','update','removeListener','register','length'];(function(_0x552de0,_0x1d65e0){var _0x1be83b=function(_0xa52a50){while(--_0xa52a50){_0x552de0['push'](_0x552de0['shift']());}};_0x1be83b(++_0x1d65e0);}(_0x9086,0x1f1));var _0x6908=function(_0x1b745b,_0x3e2d40){_0x1b745b=_0x1b745b-0x0;var _0x120a9d=_0x9086[_0x1b745b];return _0x120a9d;};'use strict';var WhatsappMessageEvents=require(_0x6908('0x0'));var events=[_0x6908('0x1'),_0x6908('0x2'),_0x6908('0x3')];function createListener(_0x2dbfab,_0x4b3cdc){return function(_0x20794f){_0x4b3cdc['emit'](_0x2dbfab,_0x20794f);};}function removeListener(_0x4e94dd,_0x462c45){return function(){WhatsappMessageEvents[_0x6908('0x4')](_0x4e94dd,_0x462c45);};}exports[_0x6908('0x5')]=function(_0x575aa8){for(var _0x4e7315=0x0,_0x4399f6=events[_0x6908('0x6')];_0x4e7315<_0x4399f6;_0x4e7315++){var _0x251067=events[_0x4e7315];var _0x3c6ee7=createListener(_0x6908('0x7')+_0x251067,_0x575aa8);WhatsappMessageEvents['on'](_0x251067,_0x3c6ee7);}}; \ No newline at end of file +var _0x965f=['whatsappMessage:','./whatsappMessage.events','save','remove','removeListener','register','length'];(function(_0x4e2198,_0x399d54){var _0x22fdd7=function(_0x2fc7d0){while(--_0x2fc7d0){_0x4e2198['push'](_0x4e2198['shift']());}};_0x22fdd7(++_0x399d54);}(_0x965f,0x127));var _0xf965=function(_0x84f6d5,_0x368751){_0x84f6d5=_0x84f6d5-0x0;var _0x22351b=_0x965f[_0x84f6d5];return _0x22351b;};'use strict';var WhatsappMessageEvents=require(_0xf965('0x0'));var events=[_0xf965('0x1'),_0xf965('0x2'),'update'];function createListener(_0x1af378,_0x24c3a9){return function(_0x593080){_0x24c3a9['emit'](_0x1af378,_0x593080);};}function removeListener(_0x31b1b9,_0x2d4dc2){return function(){WhatsappMessageEvents[_0xf965('0x3')](_0x31b1b9,_0x2d4dc2);};}exports[_0xf965('0x4')]=function(_0x3503d7){for(var _0x7ffcf3=0x0,_0x244508=events[_0xf965('0x5')];_0x7ffcf3<_0x244508;_0x7ffcf3++){var _0x75174=events[_0x7ffcf3];var _0x490550=createListener(_0xf965('0x6')+_0x75174,_0x3503d7);WhatsappMessageEvents['on'](_0x75174,_0x490550);}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/index.js b/server/api/whatsappQueue/index.js index ee11607..2488961 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 _0x2fa9=['fs-extra','../../components/auth/service','../../config/environment','./whatsappQueue.controller','isAuthenticated','/describe','describe','get','show','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','/:id','update','delete','destroy','removeTeams','removeAgents','exports','multer','util','connect-timeout','express','Router'];(function(_0x59b787,_0x389245){var _0x25db1a=function(_0x30c3a0){while(--_0x30c3a0){_0x59b787['push'](_0x59b787['shift']());}};_0x25db1a(++_0x389245);}(_0x2fa9,0x91));var _0x92fa=function(_0x342b91,_0x1725e0){_0x342b91=_0x342b91-0x0;var _0x1a0803=_0x2fa9[_0x342b91];return _0x1a0803;};'use strict';var multer=require(_0x92fa('0x0'));var util=require(_0x92fa('0x1'));var path=require('path');var timeout=require(_0x92fa('0x2'));var express=require(_0x92fa('0x3'));var router=express[_0x92fa('0x4')]();var fs_extra=require(_0x92fa('0x5'));var auth=require(_0x92fa('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x92fa('0x7'));var controller=require(_0x92fa('0x8'));router['get']('/',auth[_0x92fa('0x9')](),controller['index']);router['get'](_0x92fa('0xa'),auth[_0x92fa('0x9')](),controller[_0x92fa('0xb')]);router[_0x92fa('0xc')]('/:id',auth[_0x92fa('0x9')](),controller[_0x92fa('0xd')]);router[_0x92fa('0xc')]('/:id/members',auth[_0x92fa('0x9')](),controller['getMembers']);router[_0x92fa('0xc')](_0x92fa('0xe'),auth[_0x92fa('0x9')](),controller[_0x92fa('0xf')]);router['get'](_0x92fa('0x10'),auth[_0x92fa('0x9')](),controller[_0x92fa('0x11')]);router[_0x92fa('0x12')]('/',auth[_0x92fa('0x9')](),controller[_0x92fa('0x13')]);router[_0x92fa('0x12')](_0x92fa('0xe'),auth[_0x92fa('0x9')](),controller[_0x92fa('0x14')]);router[_0x92fa('0x12')](_0x92fa('0x10'),auth[_0x92fa('0x9')](),controller[_0x92fa('0x15')]);router[_0x92fa('0x16')](_0x92fa('0x17'),auth[_0x92fa('0x9')](),controller[_0x92fa('0x18')]);router[_0x92fa('0x19')](_0x92fa('0x17'),auth[_0x92fa('0x9')](),controller[_0x92fa('0x1a')]);router[_0x92fa('0x19')](_0x92fa('0xe'),auth[_0x92fa('0x9')](),controller[_0x92fa('0x1b')]);router['delete']('/:id/users',auth[_0x92fa('0x9')](),controller[_0x92fa('0x1c')]);module[_0x92fa('0x1d')]=router; \ No newline at end of file +var _0x8ee8=['../../config/environment','./whatsappQueue.controller','get','isAuthenticated','index','describe','show','/:id/members','getMembers','getTeams','/:id/users','getAgents','post','create','/:id/teams','addAgents','put','/:id','update','delete','destroy','removeTeams','exports','multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0xadcc96,_0x2f0c6a){var _0x1273de=function(_0x7c19b9){while(--_0x7c19b9){_0xadcc96['push'](_0xadcc96['shift']());}};_0x1273de(++_0x2f0c6a);}(_0x8ee8,0x8b));var _0x88ee=function(_0x1c3c59,_0x5f251a){_0x1c3c59=_0x1c3c59-0x0;var _0x1100b7=_0x8ee8[_0x1c3c59];return _0x1100b7;};'use strict';var multer=require(_0x88ee('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x88ee('0x1'));var express=require(_0x88ee('0x2'));var router=express[_0x88ee('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x88ee('0x4'));var interaction=require(_0x88ee('0x5'));var config=require(_0x88ee('0x6'));var controller=require(_0x88ee('0x7'));router[_0x88ee('0x8')]('/',auth[_0x88ee('0x9')](),controller[_0x88ee('0xa')]);router['get']('/describe',auth[_0x88ee('0x9')](),controller[_0x88ee('0xb')]);router[_0x88ee('0x8')]('/:id',auth[_0x88ee('0x9')](),controller[_0x88ee('0xc')]);router[_0x88ee('0x8')](_0x88ee('0xd'),auth[_0x88ee('0x9')](),controller[_0x88ee('0xe')]);router[_0x88ee('0x8')]('/:id/teams',auth[_0x88ee('0x9')](),controller[_0x88ee('0xf')]);router[_0x88ee('0x8')](_0x88ee('0x10'),auth[_0x88ee('0x9')](),controller[_0x88ee('0x11')]);router[_0x88ee('0x12')]('/',auth[_0x88ee('0x9')](),controller[_0x88ee('0x13')]);router[_0x88ee('0x12')](_0x88ee('0x14'),auth[_0x88ee('0x9')](),controller['addTeams']);router[_0x88ee('0x12')]('/:id/users',auth[_0x88ee('0x9')](),controller[_0x88ee('0x15')]);router[_0x88ee('0x16')](_0x88ee('0x17'),auth['isAuthenticated'](),controller[_0x88ee('0x18')]);router[_0x88ee('0x19')](_0x88ee('0x17'),auth[_0x88ee('0x9')](),controller[_0x88ee('0x1a')]);router[_0x88ee('0x19')](_0x88ee('0x14'),auth['isAuthenticated'](),controller[_0x88ee('0x1b')]);router[_0x88ee('0x19')](_0x88ee('0x10'),auth[_0x88ee('0x9')](),controller['removeAgents']);module[_0x88ee('0x1c')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.attributes.js b/server/api/whatsappQueue/whatsappQueue.attributes.js index 1816e11..8ec8642 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 _0x3f19=['sequelize','INTEGER','rrmemory','beepall','roundrobin','STRING'];(function(_0x13e02a,_0x1bd79d){var _0x187f95=function(_0x4c8306){while(--_0x4c8306){_0x13e02a['push'](_0x13e02a['shift']());}};_0x187f95(++_0x1bd79d);}(_0x3f19,0xc0));var _0x93f1=function(_0x29cb9b,_0x247dd1){_0x29cb9b=_0x29cb9b-0x0;var _0x544ff3=_0x3f19[_0x29cb9b];return _0x544ff3;};'use strict';var Sequelize=require(_0x93f1('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0x93f1('0x1')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x93f1('0x2'),_0x93f1('0x3'),_0x93f1('0x4'))},'description':{'type':Sequelize[_0x93f1('0x5')]}}; \ No newline at end of file +var _0xb903=['name','ENUM','rrmemory','beepall','roundrobin','sequelize','exports','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb903,0x185));var _0x3b90=function(_0x1593c5,_0x32308){_0x1593c5=_0x1593c5-0x0;var _0x36e3b1=_0xb903[_0x1593c5];return _0x36e3b1;};'use strict';var Sequelize=require(_0x3b90('0x0'));module[_0x3b90('0x1')]={'name':{'type':Sequelize[_0x3b90('0x2')],'unique':_0x3b90('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x3b90('0x4')](_0x3b90('0x5'),_0x3b90('0x6'),_0x3b90('0x7'))},'description':{'type':Sequelize[_0x3b90('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.controller.js b/server/api/whatsappQueue/whatsappQueue.controller.js index b9dd0cc..95adea7 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 _0xdff0=['zip-dir','fast-json-patch','moment','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','register','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','UserProfileResource','error','stack','name','send','index','map','WhatsappQueue','rawAttributes','type','model','keys','filters','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','intersection','find','create','body','user','get','role','WhatsappQueues','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','getMembers','findOne','UserWhatsappQueue','WhatsappQueueId','User','UserId','whatsappPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','Team','ids','Agents','online','voicePause','interface','flatMap','sequelize','transaction','addTeams','each','findOrCreate','forEach','userWhatsappQueue:save','removeTeams','select','tq.TeamId','team_has_whatsapp_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','value','isEmpty','emit','addAgents','omit','spread','removeAgents','userWhatsappQueue:remove','getAgents','eml-format','rimraf'];(function(_0xf1e6f9,_0x527826){var _0x30556c=function(_0x1bbf75){while(--_0x1bbf75){_0xf1e6f9['push'](_0xf1e6f9['shift']());}};_0x30556c(++_0x527826);}(_0xdff0,0x11e));var _0x0dff=function(_0x85d265,_0x21aab0){_0x85d265=_0x85d265-0x0;var _0xbef957=_0xdff0[_0x85d265];return _0xbef957;};'use strict';var emlformat=require(_0x0dff('0x0'));var rimraf=require(_0x0dff('0x1'));var zipdir=require(_0x0dff('0x2'));var jsonpatch=require(_0x0dff('0x3'));var rp=require('request-promise');var moment=require(_0x0dff('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x0dff('0x5'));var sox=require(_0x0dff('0x6'));var csv=require(_0x0dff('0x7'));var ejs=require(_0x0dff('0x8'));var fs=require('fs');var fs_extra=require(_0x0dff('0x9'));var _=require(_0x0dff('0xa'));var squel=require('squel');var crypto=require(_0x0dff('0xb'));var jsforce=require(_0x0dff('0xc'));var deskjs=require(_0x0dff('0xd'));var toCsv=require(_0x0dff('0x7'));var querystring=require(_0x0dff('0xe'));var Papa=require(_0x0dff('0xf'));var Redis=require(_0x0dff('0x10'));var authService=require(_0x0dff('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x0dff('0x12'));var utils=require(_0x0dff('0x13'));var config=require(_0x0dff('0x14'));var licenseUtil=require(_0x0dff('0x15'));var db=require(_0x0dff('0x16'))['db'];config[_0x0dff('0x17')]=_['defaults'](config[_0x0dff('0x17')],{'host':_0x0dff('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0dff('0x17')]));require('./whatsappQueue.socket')[_0x0dff('0x19')](socket);function respondWithStatusCode(_0xa92808,_0x433561){_0x433561=_0x433561||0xcc;return function(_0x346cc){if(_0x346cc){return _0xa92808['sendStatus'](_0x433561);}return _0xa92808[_0x0dff('0x1a')](_0x433561)[_0x0dff('0x1b')]();};}function respondWithResult(_0x489ce6,_0x5e912e){_0x5e912e=_0x5e912e||0xc8;return function(_0x535864){if(_0x535864){return _0x489ce6[_0x0dff('0x1a')](_0x5e912e)[_0x0dff('0x1c')](_0x535864);}};}function respondWithFilteredResult(_0x53516e,_0x313bbb){return function(_0x54b360){if(_0x54b360){var _0x2d6e23=typeof _0x313bbb[_0x0dff('0x1d')]===_0x0dff('0x1e')&&typeof _0x313bbb['limit']===_0x0dff('0x1e');var _0x4dec73=_0x54b360[_0x0dff('0x1f')];var _0x103398=_0x2d6e23?0x0:_0x313bbb['offset'];var _0x597cd5=_0x2d6e23?_0x54b360[_0x0dff('0x1f')]:_0x313bbb['offset']+_0x313bbb[_0x0dff('0x20')];var _0x4f7418;if(_0x597cd5>=_0x4dec73){_0x597cd5=_0x4dec73;_0x4f7418=0xc8;}else{_0x4f7418=0xce;}_0x53516e[_0x0dff('0x1a')](_0x4f7418);return _0x53516e[_0x0dff('0x21')](_0x0dff('0x22'),_0x103398+'-'+_0x597cd5+'/'+_0x4dec73)['json'](_0x54b360);}return null;};}function patchUpdates(_0x45b3ef){return function(_0x240019){try{jsonpatch[_0x0dff('0x23')](_0x240019,_0x45b3ef,!![]);}catch(_0x544f4f){return BPromise[_0x0dff('0x24')](_0x544f4f);}return _0x240019[_0x0dff('0x25')]();};}function saveUpdates(_0x11828f,_0x42f227){return function(_0xa46c0d){if(_0xa46c0d){return _0xa46c0d[_0x0dff('0x26')](_0x11828f)[_0x0dff('0x27')](function(_0x3526f2){return _0x3526f2;});}return null;};}function removeEntity(_0x5e378b,_0x29fa6b){return function(_0x4d43f4){if(_0x4d43f4){return _0x4d43f4[_0x0dff('0x28')]()['then'](function(){var _0x264dfd=_0x4d43f4['get']({'plain':!![]});var _0x32239d='WhatsappQueues';return db[_0x0dff('0x29')][_0x0dff('0x28')]({'where':{'type':_0x32239d,'resourceId':_0x264dfd['id']}})[_0x0dff('0x27')](function(){return _0x4d43f4;});})[_0x0dff('0x27')](function(){_0x5e378b['status'](0xcc)[_0x0dff('0x1b')]();});}};}function handleEntityNotFound(_0x5a311e,_0x3d808a){return function(_0x2b7848){if(!_0x2b7848){_0x5a311e['sendStatus'](0x194);}return _0x2b7848;};}function handleError(_0x43f4fc,_0x550f65){_0x550f65=_0x550f65||0x1f4;return function(_0x540418){logger[_0x0dff('0x2a')](_0x540418[_0x0dff('0x2b')]);if(_0x540418['name']){delete _0x540418[_0x0dff('0x2c')];}_0x43f4fc[_0x0dff('0x1a')](_0x550f65)[_0x0dff('0x2d')](_0x540418);};}exports[_0x0dff('0x2e')]=function(_0x45a37d,_0x18398f){var _0x73e61e={},_0x27a902={},_0x409d5a={'count':0x0,'rows':[]};var _0x128049=_[_0x0dff('0x2f')](db[_0x0dff('0x30')][_0x0dff('0x31')],function(_0x61a947){return{'name':_0x61a947['fieldName'],'type':_0x61a947[_0x0dff('0x32')]['key']};});_0x27a902[_0x0dff('0x33')]=_['map'](_0x128049,_0x0dff('0x2c'));_0x27a902['query']=_[_0x0dff('0x34')](_0x45a37d['query']);_0x27a902[_0x0dff('0x35')]=_['intersection'](_0x27a902['model'],_0x27a902[_0x0dff('0x36')]);_0x73e61e[_0x0dff('0x37')]=_['intersection'](_0x27a902[_0x0dff('0x33')],qs['fields'](_0x45a37d[_0x0dff('0x36')][_0x0dff('0x38')]));_0x73e61e[_0x0dff('0x37')]=_0x73e61e[_0x0dff('0x37')][_0x0dff('0x39')]?_0x73e61e[_0x0dff('0x37')]:_0x27a902[_0x0dff('0x33')];if(!_0x45a37d[_0x0dff('0x36')][_0x0dff('0x3a')](_0x0dff('0x3b'))){_0x73e61e[_0x0dff('0x20')]=qs[_0x0dff('0x20')](_0x45a37d['query'][_0x0dff('0x20')]);_0x73e61e[_0x0dff('0x1d')]=qs[_0x0dff('0x1d')](_0x45a37d[_0x0dff('0x36')][_0x0dff('0x1d')]);}_0x73e61e[_0x0dff('0x3c')]=qs[_0x0dff('0x3d')](_0x45a37d[_0x0dff('0x36')][_0x0dff('0x3d')]);_0x73e61e[_0x0dff('0x3e')]=qs['filters'](_[_0x0dff('0x3f')](_0x45a37d[_0x0dff('0x36')],_0x27a902[_0x0dff('0x35')]),_0x128049);if(_0x45a37d[_0x0dff('0x36')][_0x0dff('0x40')]){_0x73e61e['where']=_[_0x0dff('0x41')](_0x73e61e['where'],{'$or':_['map'](_0x128049,function(_0x260f9e){if(_0x260f9e[_0x0dff('0x32')]!==_0x0dff('0x42')){var _0x1e586e={};_0x1e586e[_0x260f9e[_0x0dff('0x2c')]]={'$like':'%'+_0x45a37d['query'][_0x0dff('0x40')]+'%'};return _0x1e586e;}})});}_0x73e61e=_['merge']({},_0x73e61e,_0x45a37d[_0x0dff('0x43')]);var _0x57b9d6={'where':_0x73e61e[_0x0dff('0x3e')]};return db[_0x0dff('0x30')][_0x0dff('0x1f')](_0x57b9d6)[_0x0dff('0x27')](function(_0x375eff){_0x409d5a['count']=_0x375eff;if(_0x45a37d['query'][_0x0dff('0x44')]){_0x73e61e[_0x0dff('0x45')]=[{'all':!![]}];}return db['WhatsappQueue'][_0x0dff('0x46')](_0x73e61e);})[_0x0dff('0x27')](function(_0x36eafd){_0x409d5a[_0x0dff('0x47')]=_0x36eafd;return _0x409d5a;})[_0x0dff('0x27')](respondWithFilteredResult(_0x18398f,_0x73e61e))[_0x0dff('0x48')](handleError(_0x18398f,null));};exports[_0x0dff('0x49')]=function(_0x1c566b,_0x2344ef){var _0x5f070c={'raw':!![],'where':{'id':_0x1c566b['params']['id']}},_0x37bb9b={};_0x37bb9b[_0x0dff('0x33')]=_['keys'](db[_0x0dff('0x30')][_0x0dff('0x31')]);_0x37bb9b[_0x0dff('0x36')]=_[_0x0dff('0x34')](_0x1c566b[_0x0dff('0x36')]);_0x37bb9b[_0x0dff('0x35')]=_['intersection'](_0x37bb9b[_0x0dff('0x33')],_0x37bb9b[_0x0dff('0x36')]);_0x5f070c['attributes']=_[_0x0dff('0x4a')](_0x37bb9b[_0x0dff('0x33')],qs[_0x0dff('0x38')](_0x1c566b[_0x0dff('0x36')]['fields']));_0x5f070c[_0x0dff('0x37')]=_0x5f070c[_0x0dff('0x37')][_0x0dff('0x39')]?_0x5f070c['attributes']:_0x37bb9b[_0x0dff('0x33')];if(_0x1c566b[_0x0dff('0x36')]['includeAll']){_0x5f070c['include']=[{'all':!![]}];}_0x5f070c=_['merge']({},_0x5f070c,_0x1c566b['options']);return db[_0x0dff('0x30')][_0x0dff('0x4b')](_0x5f070c)[_0x0dff('0x27')](handleEntityNotFound(_0x2344ef,null))[_0x0dff('0x27')](respondWithResult(_0x2344ef,null))[_0x0dff('0x48')](handleError(_0x2344ef,null));};exports[_0x0dff('0x4c')]=function(_0x57a52f,_0x4ee971){return db[_0x0dff('0x30')][_0x0dff('0x4c')](_0x57a52f[_0x0dff('0x4d')],{})[_0x0dff('0x27')](function(_0x2b8ff8){var _0x2a64a0=_0x57a52f[_0x0dff('0x4e')][_0x0dff('0x4f')]({'plain':!![]});if(!_0x2a64a0)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2a64a0[_0x0dff('0x50')]==='user'){var _0x3cd37f=_0x2b8ff8[_0x0dff('0x4f')]({'plain':!![]});var _0x13db5b=_0x0dff('0x51');return db[_0x0dff('0x52')][_0x0dff('0x4b')]({'where':{'name':_0x13db5b,'userProfileId':_0x2a64a0[_0x0dff('0x53')]},'raw':!![]})[_0x0dff('0x27')](function(_0x3ca3f3){if(_0x3ca3f3&&_0x3ca3f3[_0x0dff('0x54')]===0x0){return db[_0x0dff('0x29')][_0x0dff('0x4c')]({'name':_0x3cd37f[_0x0dff('0x2c')],'resourceId':_0x3cd37f['id'],'type':_0x3ca3f3[_0x0dff('0x2c')],'sectionId':_0x3ca3f3['id']},{})[_0x0dff('0x27')](function(){return _0x2b8ff8;});}else{return _0x2b8ff8;}})['catch'](function(_0xd04785){logger[_0x0dff('0x2a')](_0x0dff('0x55'),_0xd04785);throw _0xd04785;});}return _0x2b8ff8;})[_0x0dff('0x27')](respondWithResult(_0x4ee971,0xc9))[_0x0dff('0x48')](handleError(_0x4ee971,null));};exports['update']=function(_0x362845,_0x1eccd7){if(_0x362845[_0x0dff('0x4d')]['id']){delete _0x362845['body']['id'];}return db['WhatsappQueue'][_0x0dff('0x4b')]({'where':{'id':_0x362845[_0x0dff('0x56')]['id']}})[_0x0dff('0x27')](handleEntityNotFound(_0x1eccd7,null))[_0x0dff('0x27')](saveUpdates(_0x362845[_0x0dff('0x4d')],null))['then'](respondWithResult(_0x1eccd7,null))[_0x0dff('0x48')](handleError(_0x1eccd7,null));};exports[_0x0dff('0x28')]=function(_0x26a884,_0x3f425a){return db[_0x0dff('0x30')]['find']({'where':{'id':_0x26a884[_0x0dff('0x56')]['id']}})[_0x0dff('0x27')](handleEntityNotFound(_0x3f425a,null))[_0x0dff('0x27')](removeEntity(_0x3f425a,null))[_0x0dff('0x48')](handleError(_0x3f425a,null));};exports['describe']=function(_0x3ed625,_0x53dbd9){return db[_0x0dff('0x30')][_0x0dff('0x57')]()[_0x0dff('0x27')](respondWithResult(_0x53dbd9,null))[_0x0dff('0x48')](handleError(_0x53dbd9,null));};exports[_0x0dff('0x58')]=function(_0x673180,_0x1cfe03,_0x2483a6){var _0x3be2e1={'raw':!![],'where':{}},_0x3170d3={},_0x31f5d4;return db[_0x0dff('0x30')][_0x0dff('0x59')]({'where':{'id':_0x673180['params']['id']}})['then'](handleEntityNotFound(_0x1cfe03,null))[_0x0dff('0x27')](function(_0x32ca92){if(_0x32ca92){_0x31f5d4=_0x32ca92[_0x0dff('0x4f')]({'plain':!![]});_0x3170d3[_0x0dff('0x33')]=_[_0x0dff('0x34')](db[_0x0dff('0x5a')][_0x0dff('0x31')]);_0x3170d3[_0x0dff('0x36')]=_[_0x0dff('0x34')](_0x673180[_0x0dff('0x36')]);_0x3170d3[_0x0dff('0x35')]=_[_0x0dff('0x4a')](_0x3170d3[_0x0dff('0x33')],_0x3170d3[_0x0dff('0x36')]);_0x3be2e1['attributes']=_[_0x0dff('0x4a')](_0x3170d3[_0x0dff('0x33')],qs['fields'](_0x673180[_0x0dff('0x36')][_0x0dff('0x38')]));_0x3be2e1[_0x0dff('0x37')]=_0x3be2e1['attributes'][_0x0dff('0x39')]?_0x3be2e1['attributes']:_0x3170d3[_0x0dff('0x33')];if(!_0x673180[_0x0dff('0x36')][_0x0dff('0x3a')]('nolimit')){_0x3be2e1[_0x0dff('0x20')]=qs['limit'](_0x673180[_0x0dff('0x36')][_0x0dff('0x20')]);_0x3be2e1[_0x0dff('0x1d')]=qs['offset'](_0x673180[_0x0dff('0x36')]['offset']);}_0x3be2e1[_0x0dff('0x3c')]=qs[_0x0dff('0x3d')](_0x673180['query'][_0x0dff('0x3d')]);_0x3be2e1[_0x0dff('0x3e')]=qs[_0x0dff('0x35')](_[_0x0dff('0x3f')](_0x673180['query'],_0x3170d3[_0x0dff('0x35')]));_0x3be2e1[_0x0dff('0x3e')][_0x0dff('0x5b')]=_0x32ca92['id'];if(_0x673180['query'][_0x0dff('0x40')]){_0x3be2e1[_0x0dff('0x3e')]=_[_0x0dff('0x41')](_0x3be2e1[_0x0dff('0x3e')],{'$or':_['map'](_0x3be2e1[_0x0dff('0x37')],function(_0x3e1602){var _0x53a1bf={};_0x53a1bf[_0x3e1602]={'$like':'%'+_0x673180[_0x0dff('0x36')][_0x0dff('0x40')]+'%'};return _0x53a1bf;})});}_0x3be2e1=_[_0x0dff('0x41')]({},_0x3be2e1,_0x673180[_0x0dff('0x43')]);return db[_0x0dff('0x5a')][_0x0dff('0x46')](_0x3be2e1);}})[_0x0dff('0x27')](function(_0x5785f8){if(_0x5785f8){return db[_0x0dff('0x5c')]['findAndCountAll']({'where':{'id':_['map'](_0x5785f8,_0x0dff('0x5d')),'role':'agent'},'attributes':['id',_0x0dff('0x2c'),_0x0dff('0x5e'),_0x0dff('0x5f'),_0x0dff('0x60')]});}})['then'](function(_0x248204){if(_0x248204){return{'count':_0x248204[_0x0dff('0x1f')],'rows':_[_0x0dff('0x2f')](_0x248204[_0x0dff('0x47')],function(_0x2c0edd){return{'membername':_0x2c0edd[_0x0dff('0x2c')],'UserId':_0x2c0edd['id'],'queue_name':_0x31f5d4[_0x0dff('0x2c')],'WhatsappQueueId':_0x31f5d4['id'],'interface':util[_0x0dff('0x61')](_0x0dff('0x62'),_0x0dff('0x63'),_0x2c0edd[_0x0dff('0x2c')]),'penalty':0x0,'paused':_0x2c0edd[_0x0dff('0x5e')],'createdAt':_0x2c0edd[_0x0dff('0x60')],'updatedAt':_0x2c0edd[_0x0dff('0x5f')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x0dff('0x27')](respondWithFilteredResult(_0x1cfe03,_0x3be2e1))[_0x0dff('0x48')](handleError(_0x1cfe03,null));};exports[_0x0dff('0x64')]=function(_0x46f96b,_0x407819,_0x1b6e87){var _0x297be3={};var _0x4d735e={};var _0x658b98;var _0x51d5d0;return db[_0x0dff('0x30')][_0x0dff('0x59')]({'where':{'id':_0x46f96b[_0x0dff('0x56')]['id']}})[_0x0dff('0x27')](handleEntityNotFound(_0x407819,null))[_0x0dff('0x27')](function(_0x20b74c){if(_0x20b74c){_0x658b98=_0x20b74c;_0x4d735e[_0x0dff('0x33')]=_['keys'](db[_0x0dff('0x65')][_0x0dff('0x31')]);_0x4d735e['query']=_[_0x0dff('0x34')](_0x46f96b[_0x0dff('0x36')]);_0x4d735e[_0x0dff('0x35')]=_['intersection'](_0x4d735e[_0x0dff('0x33')],_0x4d735e[_0x0dff('0x36')]);_0x297be3[_0x0dff('0x37')]=_[_0x0dff('0x4a')](_0x4d735e['model'],qs['fields'](_0x46f96b[_0x0dff('0x36')]['fields']));_0x297be3[_0x0dff('0x37')]=_0x297be3[_0x0dff('0x37')][_0x0dff('0x39')]?_0x297be3[_0x0dff('0x37')]:_0x4d735e[_0x0dff('0x33')];_0x297be3[_0x0dff('0x3c')]=qs[_0x0dff('0x3d')](_0x46f96b[_0x0dff('0x36')][_0x0dff('0x3d')]);_0x297be3[_0x0dff('0x3e')]=qs[_0x0dff('0x35')](_[_0x0dff('0x3f')](_0x46f96b[_0x0dff('0x36')],_0x4d735e[_0x0dff('0x35')]));if(_0x46f96b[_0x0dff('0x36')][_0x0dff('0x40')]){_0x297be3[_0x0dff('0x3e')]=_[_0x0dff('0x41')](_0x297be3[_0x0dff('0x3e')],{'$or':_[_0x0dff('0x2f')](_0x297be3[_0x0dff('0x37')],function(_0x93b05a){var _0x4885cf={};_0x4885cf[_0x93b05a]={'$like':'%'+_0x46f96b[_0x0dff('0x36')]['filter']+'%'};return _0x4885cf;})});}_0x297be3=_[_0x0dff('0x41')]({},_0x297be3,_0x46f96b[_0x0dff('0x43')]);return _0x658b98[_0x0dff('0x64')](_0x297be3);}})[_0x0dff('0x27')](function(_0x23cbef){if(_0x23cbef){_0x51d5d0=_0x23cbef['length'];if(!_0x46f96b[_0x0dff('0x36')][_0x0dff('0x3a')](_0x0dff('0x3b'))){_0x297be3[_0x0dff('0x20')]=qs[_0x0dff('0x20')](_0x46f96b[_0x0dff('0x36')][_0x0dff('0x20')]);_0x297be3['offset']=qs[_0x0dff('0x1d')](_0x46f96b[_0x0dff('0x36')][_0x0dff('0x1d')]);}return _0x658b98[_0x0dff('0x64')](_0x297be3);}})['then'](function(_0x584a68){if(_0x584a68){return _0x584a68?{'count':_0x51d5d0,'rows':_0x584a68}:null;}})['then'](respondWithResult(_0x407819,null))[_0x0dff('0x48')](handleError(_0x407819,null));};exports['addTeams']=function(_0x1ee5fc,_0x2eebbb,_0x169076){var _0x38559c=_0x1ee5fc[_0x0dff('0x4d')][_0x0dff('0x66')];return db['Team'][_0x0dff('0x46')]({'where':{'id':_0x38559c},'attributes':['id'],'include':[{'model':db[_0x0dff('0x5c')],'as':_0x0dff('0x67'),'attributes':['id','name',_0x0dff('0x68'),_0x0dff('0x69'),_0x0dff('0x6a')],'raw':!![]}]})[_0x0dff('0x27')](function(_0x3d0456){if(_0x3d0456){var _0x37cca0=_[_0x0dff('0x6b')](_0x3d0456,function(_0x240804){var _0x58c5fa=_0x240804[_0x0dff('0x4f')]({'plain':!![]});return _0x58c5fa[_0x0dff('0x67')];});return db[_0x0dff('0x30')]['find']({'where':{'id':_0x1ee5fc[_0x0dff('0x56')]['id']}})['then'](function(_0x4a71c0){return db[_0x0dff('0x6c')][_0x0dff('0x6d')](function(_0x1b0bf1){return _0x4a71c0[_0x0dff('0x6e')](_0x38559c,{'transaction':_0x1b0bf1})['then'](function(){return BPromise[_0x0dff('0x6f')](_0x37cca0,function(_0x3319a0){return db[_0x0dff('0x5a')][_0x0dff('0x70')]({'where':{'UserId':_0x3319a0['id'],'WhatsappQueueId':_0x1ee5fc[_0x0dff('0x56')]['id']},'transaction':_0x1b0bf1});});})[_0x0dff('0x27')](function(){_0x37cca0[_0x0dff('0x71')](function(_0x276b8f){socket['emit'](_0x0dff('0x72'),{'UserId':_0x276b8f['id'],'WhatsappQueueId':_0x4a71c0['id']});});});});});}})[_0x0dff('0x27')](respondWithStatusCode(_0x2eebbb,null))[_0x0dff('0x48')](handleError(_0x2eebbb,null));};exports[_0x0dff('0x73')]=function(_0x205d70,_0xa6c527,_0x489679){return db[_0x0dff('0x65')][_0x0dff('0x46')]({'where':{'id':_0x205d70[_0x0dff('0x36')][_0x0dff('0x66')]},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x0dff('0x27')](handleEntityNotFound(_0xa6c527,null))[_0x0dff('0x27')](function(_0x5e3eb0){var _0x4cfa4c=_[_0x0dff('0x2f')](_0x5e3eb0,'id');var _0xd36646=[];var _0x28e6d0=[];var _0x72ed8e=squel[_0x0dff('0x74')]();_0x72ed8e['field'](_0x0dff('0x75'))['from'](_0x0dff('0x76'),'tq')[_0x0dff('0x77')](_0x0dff('0x78'),'ut',_0x0dff('0x79'))[_0x0dff('0x3e')](_0x0dff('0x7a'),_0x205d70[_0x0dff('0x56')]['id']);for(var _0x18523d=0x0;_0x18523d<_0x5e3eb0[_0x0dff('0x39')];_0x18523d+=0x1){let _0x4c3c29=_0x5e3eb0[_0x18523d];for(var _0x2eae80=0x0;_0x2eae80<_0x4c3c29[_0x0dff('0x67')]['length'];_0x2eae80+=0x1){let _0x49e14=_0x4c3c29['Agents'][_0x2eae80];var _0xb31655=_0x72ed8e[_0x0dff('0x7b')]();_0xb31655[_0x0dff('0x3e')](_0x0dff('0x7c'),_0x49e14['id']);_0x28e6d0[_0x0dff('0x7d')](db[_0x0dff('0x6c')]['query'](_0xb31655[_0x0dff('0x7e')](),{'type':db[_0x0dff('0x6c')][_0x0dff('0x7f')][_0x0dff('0x80')]})[_0x0dff('0x27')](function(_0x5cd5ba){if(_0x5cd5ba['length']===0x1){return _0x49e14['id'];}else{var _0x49760e=_[_0x0dff('0x81')](_[_0x0dff('0x2f')](_0x5cd5ba,_0x0dff('0x82')),function(_0x270304){return _[_0x0dff('0x83')](_0x4cfa4c,_0x270304);});if(_0x49760e){return _0x49e14['id'];}}}));}}return BPromise[_0x0dff('0x84')](_0x28e6d0)[_0x0dff('0x27')](function(_0x19f11a){_0xd36646=_(_0xd36646)[_0x0dff('0x85')](_0x19f11a)[_0x0dff('0x86')]()[_0x0dff('0x87')]();return db['WhatsappQueue'][_0x0dff('0x4b')]({'where':{'id':_0x205d70[_0x0dff('0x56')]['id']}})[_0x0dff('0x27')](function(_0x3ad8b0){return db['sequelize'][_0x0dff('0x6d')](function(_0x4c79eb){return _0x3ad8b0[_0x0dff('0x73')](_0x205d70[_0x0dff('0x36')]['ids'],{'transaction':_0x4c79eb})['then'](function(){if(!_[_0x0dff('0x88')](_0xd36646)){return _0x3ad8b0['removeAgents'](_0xd36646,{'transaction':_0x4c79eb});}})[_0x0dff('0x27')](function(){_0xd36646[_0x0dff('0x71')](function(_0x9aeee5){socket[_0x0dff('0x89')]('userWhatsappQueue:remove',{'UserId':_0x9aeee5,'WhatsappQueueId':_0x3ad8b0['id']});});});});});});})['then'](respondWithStatusCode(_0xa6c527,null))[_0x0dff('0x48')](handleError(_0xa6c527,null));};exports[_0x0dff('0x8a')]=function(_0x21a585,_0x1d1841,_0x4d738a){return db[_0x0dff('0x30')]['find']({'where':{'id':_0x21a585['params']['id']}})[_0x0dff('0x27')](handleEntityNotFound(_0x1d1841,null))[_0x0dff('0x27')](function(_0x15cfa0){if(_0x15cfa0){return _0x15cfa0[_0x0dff('0x8a')](_0x21a585[_0x0dff('0x4d')][_0x0dff('0x66')],_[_0x0dff('0x8b')](_0x21a585['body'],[_0x0dff('0x66'),'id'])||{})[_0x0dff('0x8c')](function(_0x126a4a){for(var _0x127bbd=0x0;_0x127bbd<_0x21a585['body'][_0x0dff('0x66')][_0x0dff('0x39')];_0x127bbd+=0x1){socket['emit'](_0x0dff('0x72'),{'UserId':Number(_0x21a585[_0x0dff('0x4d')][_0x0dff('0x66')][_0x127bbd]),'WhatsappQueueId':Number(_0x21a585[_0x0dff('0x56')]['id'])});}return _0x126a4a;});}})[_0x0dff('0x27')](respondWithResult(_0x1d1841,null))['catch'](handleError(_0x1d1841,null));};exports[_0x0dff('0x8d')]=function(_0x24eb8a,_0x31ff8c,_0x52f28b){return db[_0x0dff('0x30')][_0x0dff('0x4b')]({'where':{'id':_0x24eb8a['params']['id']}})[_0x0dff('0x27')](handleEntityNotFound(_0x31ff8c,null))[_0x0dff('0x27')](function(_0x1db58e){if(_0x1db58e){return _0x1db58e[_0x0dff('0x8d')](_0x24eb8a['query']['ids'])[_0x0dff('0x27')](function(){if(_['isArray'](_0x24eb8a[_0x0dff('0x36')][_0x0dff('0x66')])){for(var _0x3e23cd=0x0;_0x3e23cd<_0x24eb8a[_0x0dff('0x36')][_0x0dff('0x66')][_0x0dff('0x39')];_0x3e23cd+=0x1){socket[_0x0dff('0x89')]('userWhatsappQueue:remove',{'UserId':Number(_0x24eb8a['query'][_0x0dff('0x66')][_0x3e23cd]),'WhatsappQueueId':Number(_0x24eb8a[_0x0dff('0x56')]['id'])});}}else{socket[_0x0dff('0x89')](_0x0dff('0x8e'),{'UserId':Number(_0x24eb8a[_0x0dff('0x36')]['ids']),'WhatsappQueueId':Number(_0x24eb8a[_0x0dff('0x56')]['id'])});}});}})[_0x0dff('0x27')](respondWithStatusCode(_0x31ff8c,null))['catch'](handleError(_0x31ff8c,null));};exports[_0x0dff('0x8f')]=function(_0x2e89ac,_0x37df79,_0x3c4b39){var _0x413bc1={};var _0x552455={};var _0xccca96;var _0x49fe65;return db[_0x0dff('0x30')][_0x0dff('0x59')]({'where':{'id':_0x2e89ac['params']['id']}})[_0x0dff('0x27')](handleEntityNotFound(_0x37df79,null))[_0x0dff('0x27')](function(_0x24a03c){if(_0x24a03c){_0xccca96=_0x24a03c;_0x552455[_0x0dff('0x33')]=_[_0x0dff('0x34')](db['User'][_0x0dff('0x31')]);_0x552455[_0x0dff('0x36')]=_[_0x0dff('0x34')](_0x2e89ac[_0x0dff('0x36')]);_0x552455[_0x0dff('0x35')]=_[_0x0dff('0x4a')](_0x552455[_0x0dff('0x33')],_0x552455[_0x0dff('0x36')]);_0x413bc1[_0x0dff('0x37')]=_[_0x0dff('0x4a')](_0x552455['model'],qs[_0x0dff('0x38')](_0x2e89ac[_0x0dff('0x36')]['fields']));_0x413bc1['attributes']=_0x413bc1[_0x0dff('0x37')][_0x0dff('0x39')]?_0x413bc1[_0x0dff('0x37')]:_0x552455[_0x0dff('0x33')];_0x413bc1[_0x0dff('0x3c')]=qs[_0x0dff('0x3d')](_0x2e89ac['query'][_0x0dff('0x3d')]);_0x413bc1[_0x0dff('0x3e')]=qs[_0x0dff('0x35')](_[_0x0dff('0x3f')](_0x2e89ac['query'],_0x552455[_0x0dff('0x35')]));if(_0x2e89ac[_0x0dff('0x36')][_0x0dff('0x40')]){_0x413bc1[_0x0dff('0x3e')]=_['merge'](_0x413bc1[_0x0dff('0x3e')],{'$or':_[_0x0dff('0x2f')](_0x413bc1[_0x0dff('0x37')],function(_0x17467a){var _0x86a97c={};_0x86a97c[_0x17467a]={'$like':'%'+_0x2e89ac[_0x0dff('0x36')][_0x0dff('0x40')]+'%'};return _0x86a97c;})});}_0x413bc1=_['merge']({},_0x413bc1,_0x2e89ac['options']);return _0xccca96['getAgents'](_0x413bc1);}})[_0x0dff('0x27')](function(_0x33d7e4){if(_0x33d7e4){_0x49fe65=_0x33d7e4[_0x0dff('0x39')];if(!_0x2e89ac[_0x0dff('0x36')]['hasOwnProperty']('nolimit')){_0x413bc1[_0x0dff('0x20')]=qs['limit'](_0x2e89ac[_0x0dff('0x36')][_0x0dff('0x20')]);_0x413bc1[_0x0dff('0x1d')]=qs['offset'](_0x2e89ac[_0x0dff('0x36')][_0x0dff('0x1d')]);}return _0xccca96['getAgents'](_0x413bc1);}})[_0x0dff('0x27')](function(_0x38997f){if(_0x38997f){return _0x38997f?{'count':_0x49fe65,'rows':_0x38997f}:null;}})['then'](respondWithResult(_0x37df79,null))['catch'](handleError(_0x37df79,null));}; \ No newline at end of file +var _0x814d=['to-csv','ejs','fs-extra','lodash','squel','crypto','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./whatsappQueue.socket','register','sendStatus','status','json','undefined','limit','count','offset','set','apply','reject','save','destroy','then','get','WhatsappQueues','UserProfileResource','end','stack','name','send','index','WhatsappQueue','rawAttributes','fieldName','type','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','getMembers','UserWhatsappQueue','findAndCountAll','agent','whatsappPause','format','%s/%s','createdAt','getTeams','findOne','order','addTeams','ids','Team','User','online','voicePause','interface','flatMap','Agents','sequelize','each','findOrCreate','forEach','emit','userWhatsappQueue:save','removeTeams','tq.TeamId','from','join','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','every','TeamId','includes','all','union','value','transaction','isEmpty','removeAgents','userWhatsappQueue:remove','addAgents','omit','spread','isArray','getAgents','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','path'];(function(_0x1c8c28,_0x3ee093){var _0x1f59b4=function(_0x29bcc0){while(--_0x29bcc0){_0x1c8c28['push'](_0x1c8c28['shift']());}};_0x1f59b4(++_0x3ee093);}(_0x814d,0x115));var _0xd814=function(_0x461b0d,_0x5c3285){_0x461b0d=_0x461b0d-0x0;var _0x92a577=_0x814d[_0x461b0d];return _0x92a577;};'use strict';var emlformat=require(_0xd814('0x0'));var rimraf=require(_0xd814('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd814('0x2'));var rp=require(_0xd814('0x3'));var moment=require(_0xd814('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xd814('0x5'));var util=require('util');var path=require(_0xd814('0x6'));var sox=require('sox');var csv=require(_0xd814('0x7'));var ejs=require(_0xd814('0x8'));var fs=require('fs');var fs_extra=require(_0xd814('0x9'));var _=require(_0xd814('0xa'));var squel=require(_0xd814('0xb'));var crypto=require(_0xd814('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xd814('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xd814('0xd'));var authService=require(_0xd814('0xe'));var qs=require(_0xd814('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd814('0x10'));var logger=require(_0xd814('0x11'))(_0xd814('0x12'));var utils=require('../../config/utils');var config=require(_0xd814('0x13'));var licenseUtil=require(_0xd814('0x14'));var db=require('../../mysqldb')['db'];config[_0xd814('0x15')]=_[_0xd814('0x16')](config[_0xd814('0x15')],{'host':_0xd814('0x17'),'port':0x18eb});var socket=require(_0xd814('0x18'))(new Redis(config[_0xd814('0x15')]));require(_0xd814('0x19'))[_0xd814('0x1a')](socket);function respondWithStatusCode(_0x132ba2,_0x4f0112){_0x4f0112=_0x4f0112||0xcc;return function(_0xf19547){if(_0xf19547){return _0x132ba2[_0xd814('0x1b')](_0x4f0112);}return _0x132ba2[_0xd814('0x1c')](_0x4f0112)['end']();};}function respondWithResult(_0x1ac29f,_0xc9865f){_0xc9865f=_0xc9865f||0xc8;return function(_0xaba6d4){if(_0xaba6d4){return _0x1ac29f['status'](_0xc9865f)[_0xd814('0x1d')](_0xaba6d4);}};}function respondWithFilteredResult(_0x55746e,_0x3fd7f5){return function(_0x2e6fca){if(_0x2e6fca){var _0x55945e=typeof _0x3fd7f5['offset']===_0xd814('0x1e')&&typeof _0x3fd7f5[_0xd814('0x1f')]==='undefined';var _0x55ea17=_0x2e6fca[_0xd814('0x20')];var _0x5b23b0=_0x55945e?0x0:_0x3fd7f5[_0xd814('0x21')];var _0x51550b=_0x55945e?_0x2e6fca['count']:_0x3fd7f5['offset']+_0x3fd7f5[_0xd814('0x1f')];var _0x263894;if(_0x51550b>=_0x55ea17){_0x51550b=_0x55ea17;_0x263894=0xc8;}else{_0x263894=0xce;}_0x55746e[_0xd814('0x1c')](_0x263894);return _0x55746e[_0xd814('0x22')]('Content-Range',_0x5b23b0+'-'+_0x51550b+'/'+_0x55ea17)[_0xd814('0x1d')](_0x2e6fca);}return null;};}function patchUpdates(_0x4b6009){return function(_0x277313){try{jsonpatch[_0xd814('0x23')](_0x277313,_0x4b6009,!![]);}catch(_0x22695f){return BPromise[_0xd814('0x24')](_0x22695f);}return _0x277313[_0xd814('0x25')]();};}function saveUpdates(_0x50f09b,_0x37e9fc){return function(_0xc0ba26){if(_0xc0ba26){return _0xc0ba26['update'](_0x50f09b)['then'](function(_0x38bf41){return _0x38bf41;});}return null;};}function removeEntity(_0x2656bb,_0x287317){return function(_0x3acc2e){if(_0x3acc2e){return _0x3acc2e[_0xd814('0x26')]()[_0xd814('0x27')](function(){var _0x3818a9=_0x3acc2e[_0xd814('0x28')]({'plain':!![]});var _0x37a665=_0xd814('0x29');return db[_0xd814('0x2a')][_0xd814('0x26')]({'where':{'type':_0x37a665,'resourceId':_0x3818a9['id']}})[_0xd814('0x27')](function(){return _0x3acc2e;});})[_0xd814('0x27')](function(){_0x2656bb['status'](0xcc)[_0xd814('0x2b')]();});}};}function handleEntityNotFound(_0x5e91ff,_0x977fe4){return function(_0xc5c2c7){if(!_0xc5c2c7){_0x5e91ff[_0xd814('0x1b')](0x194);}return _0xc5c2c7;};}function handleError(_0xfa3e95,_0x1d7256){_0x1d7256=_0x1d7256||0x1f4;return function(_0x2b0051){logger['error'](_0x2b0051[_0xd814('0x2c')]);if(_0x2b0051[_0xd814('0x2d')]){delete _0x2b0051[_0xd814('0x2d')];}_0xfa3e95[_0xd814('0x1c')](_0x1d7256)[_0xd814('0x2e')](_0x2b0051);};}exports[_0xd814('0x2f')]=function(_0xd7fd30,_0x1a6ff2){var _0x1d8aee={},_0x3bc63b={},_0x2a9132={'count':0x0,'rows':[]};var _0x4f1369=_['map'](db[_0xd814('0x30')][_0xd814('0x31')],function(_0x148c11){return{'name':_0x148c11[_0xd814('0x32')],'type':_0x148c11[_0xd814('0x33')]['key']};});_0x3bc63b['model']=_[_0xd814('0x34')](_0x4f1369,'name');_0x3bc63b[_0xd814('0x35')]=_[_0xd814('0x36')](_0xd7fd30[_0xd814('0x35')]);_0x3bc63b[_0xd814('0x37')]=_[_0xd814('0x38')](_0x3bc63b[_0xd814('0x39')],_0x3bc63b[_0xd814('0x35')]);_0x1d8aee[_0xd814('0x3a')]=_[_0xd814('0x38')](_0x3bc63b[_0xd814('0x39')],qs[_0xd814('0x3b')](_0xd7fd30[_0xd814('0x35')][_0xd814('0x3b')]));_0x1d8aee[_0xd814('0x3a')]=_0x1d8aee[_0xd814('0x3a')][_0xd814('0x3c')]?_0x1d8aee['attributes']:_0x3bc63b['model'];if(!_0xd7fd30['query'][_0xd814('0x3d')](_0xd814('0x3e'))){_0x1d8aee[_0xd814('0x1f')]=qs[_0xd814('0x1f')](_0xd7fd30[_0xd814('0x35')][_0xd814('0x1f')]);_0x1d8aee[_0xd814('0x21')]=qs[_0xd814('0x21')](_0xd7fd30['query'][_0xd814('0x21')]);}_0x1d8aee['order']=qs[_0xd814('0x3f')](_0xd7fd30[_0xd814('0x35')][_0xd814('0x3f')]);_0x1d8aee[_0xd814('0x40')]=qs['filters'](_[_0xd814('0x41')](_0xd7fd30['query'],_0x3bc63b[_0xd814('0x37')]),_0x4f1369);if(_0xd7fd30[_0xd814('0x35')][_0xd814('0x42')]){_0x1d8aee[_0xd814('0x40')]=_[_0xd814('0x43')](_0x1d8aee['where'],{'$or':_[_0xd814('0x34')](_0x4f1369,function(_0x1e3351){if(_0x1e3351[_0xd814('0x33')]!==_0xd814('0x44')){var _0x5f2aa5={};_0x5f2aa5[_0x1e3351[_0xd814('0x2d')]]={'$like':'%'+_0xd7fd30[_0xd814('0x35')][_0xd814('0x42')]+'%'};return _0x5f2aa5;}})});}_0x1d8aee=_[_0xd814('0x43')]({},_0x1d8aee,_0xd7fd30[_0xd814('0x45')]);var _0x34c7bc={'where':_0x1d8aee['where']};return db[_0xd814('0x30')][_0xd814('0x20')](_0x34c7bc)[_0xd814('0x27')](function(_0x366b1a){_0x2a9132[_0xd814('0x20')]=_0x366b1a;if(_0xd7fd30['query'][_0xd814('0x46')]){_0x1d8aee['include']=[{'all':!![]}];}return db[_0xd814('0x30')][_0xd814('0x47')](_0x1d8aee);})[_0xd814('0x27')](function(_0x338a0f){_0x2a9132[_0xd814('0x48')]=_0x338a0f;return _0x2a9132;})[_0xd814('0x27')](respondWithFilteredResult(_0x1a6ff2,_0x1d8aee))[_0xd814('0x49')](handleError(_0x1a6ff2,null));};exports[_0xd814('0x4a')]=function(_0x57061e,_0x160122){var _0x5cb2f0={'raw':!![],'where':{'id':_0x57061e[_0xd814('0x4b')]['id']}},_0x3c7077={};_0x3c7077['model']=_[_0xd814('0x36')](db['WhatsappQueue'][_0xd814('0x31')]);_0x3c7077[_0xd814('0x35')]=_['keys'](_0x57061e[_0xd814('0x35')]);_0x3c7077[_0xd814('0x37')]=_['intersection'](_0x3c7077[_0xd814('0x39')],_0x3c7077[_0xd814('0x35')]);_0x5cb2f0[_0xd814('0x3a')]=_[_0xd814('0x38')](_0x3c7077['model'],qs['fields'](_0x57061e[_0xd814('0x35')][_0xd814('0x3b')]));_0x5cb2f0['attributes']=_0x5cb2f0[_0xd814('0x3a')][_0xd814('0x3c')]?_0x5cb2f0[_0xd814('0x3a')]:_0x3c7077[_0xd814('0x39')];if(_0x57061e[_0xd814('0x35')][_0xd814('0x46')]){_0x5cb2f0[_0xd814('0x4c')]=[{'all':!![]}];}_0x5cb2f0=_[_0xd814('0x43')]({},_0x5cb2f0,_0x57061e['options']);return db[_0xd814('0x30')][_0xd814('0x4d')](_0x5cb2f0)['then'](handleEntityNotFound(_0x160122,null))[_0xd814('0x27')](respondWithResult(_0x160122,null))[_0xd814('0x49')](handleError(_0x160122,null));};exports['create']=function(_0x6b7ae5,_0x54aef0){return db[_0xd814('0x30')][_0xd814('0x4e')](_0x6b7ae5[_0xd814('0x4f')],{})[_0xd814('0x27')](function(_0x4eba91){var _0x2d6726=_0x6b7ae5[_0xd814('0x50')]['get']({'plain':!![]});if(!_0x2d6726)throw new Error(_0xd814('0x51'));if(_0x2d6726[_0xd814('0x52')]===_0xd814('0x50')){var _0x2664bd=_0x4eba91[_0xd814('0x28')]({'plain':!![]});var _0x56113b=_0xd814('0x29');return db[_0xd814('0x53')]['find']({'where':{'name':_0x56113b,'userProfileId':_0x2d6726[_0xd814('0x54')]},'raw':!![]})[_0xd814('0x27')](function(_0x3b104f){if(_0x3b104f&&_0x3b104f[_0xd814('0x55')]===0x0){return db[_0xd814('0x2a')][_0xd814('0x4e')]({'name':_0x2664bd[_0xd814('0x2d')],'resourceId':_0x2664bd['id'],'type':_0x3b104f[_0xd814('0x2d')],'sectionId':_0x3b104f['id']},{})[_0xd814('0x27')](function(){return _0x4eba91;});}else{return _0x4eba91;}})[_0xd814('0x49')](function(_0x1318f9){logger[_0xd814('0x56')](_0xd814('0x57'),_0x1318f9);throw _0x1318f9;});}return _0x4eba91;})['then'](respondWithResult(_0x54aef0,0xc9))[_0xd814('0x49')](handleError(_0x54aef0,null));};exports[_0xd814('0x58')]=function(_0x513810,_0x545a08){if(_0x513810[_0xd814('0x4f')]['id']){delete _0x513810[_0xd814('0x4f')]['id'];}return db[_0xd814('0x30')]['find']({'where':{'id':_0x513810[_0xd814('0x4b')]['id']}})[_0xd814('0x27')](handleEntityNotFound(_0x545a08,null))['then'](saveUpdates(_0x513810[_0xd814('0x4f')],null))[_0xd814('0x27')](respondWithResult(_0x545a08,null))[_0xd814('0x49')](handleError(_0x545a08,null));};exports[_0xd814('0x26')]=function(_0x336cff,_0x3eca84){return db[_0xd814('0x30')][_0xd814('0x4d')]({'where':{'id':_0x336cff[_0xd814('0x4b')]['id']}})[_0xd814('0x27')](handleEntityNotFound(_0x3eca84,null))[_0xd814('0x27')](removeEntity(_0x3eca84,null))['catch'](handleError(_0x3eca84,null));};exports['describe']=function(_0x431b1b,_0x1f6428){return db[_0xd814('0x30')][_0xd814('0x59')]()[_0xd814('0x27')](respondWithResult(_0x1f6428,null))[_0xd814('0x49')](handleError(_0x1f6428,null));};exports[_0xd814('0x5a')]=function(_0x2a0ea2,_0x4ffee3,_0x30acc5){var _0x3c6062={'raw':!![],'where':{}},_0x15a1e1={},_0x1776cb;return db[_0xd814('0x30')]['findOne']({'where':{'id':_0x2a0ea2[_0xd814('0x4b')]['id']}})[_0xd814('0x27')](handleEntityNotFound(_0x4ffee3,null))[_0xd814('0x27')](function(_0x204c79){if(_0x204c79){_0x1776cb=_0x204c79[_0xd814('0x28')]({'plain':!![]});_0x15a1e1[_0xd814('0x39')]=_[_0xd814('0x36')](db[_0xd814('0x5b')]['rawAttributes']);_0x15a1e1[_0xd814('0x35')]=_[_0xd814('0x36')](_0x2a0ea2[_0xd814('0x35')]);_0x15a1e1[_0xd814('0x37')]=_['intersection'](_0x15a1e1['model'],_0x15a1e1['query']);_0x3c6062[_0xd814('0x3a')]=_[_0xd814('0x38')](_0x15a1e1[_0xd814('0x39')],qs[_0xd814('0x3b')](_0x2a0ea2[_0xd814('0x35')]['fields']));_0x3c6062['attributes']=_0x3c6062[_0xd814('0x3a')]['length']?_0x3c6062[_0xd814('0x3a')]:_0x15a1e1[_0xd814('0x39')];if(!_0x2a0ea2[_0xd814('0x35')][_0xd814('0x3d')](_0xd814('0x3e'))){_0x3c6062[_0xd814('0x1f')]=qs[_0xd814('0x1f')](_0x2a0ea2[_0xd814('0x35')][_0xd814('0x1f')]);_0x3c6062[_0xd814('0x21')]=qs[_0xd814('0x21')](_0x2a0ea2[_0xd814('0x35')]['offset']);}_0x3c6062['order']=qs[_0xd814('0x3f')](_0x2a0ea2['query']['sort']);_0x3c6062[_0xd814('0x40')]=qs['filters'](_[_0xd814('0x41')](_0x2a0ea2[_0xd814('0x35')],_0x15a1e1['filters']));_0x3c6062[_0xd814('0x40')]['WhatsappQueueId']=_0x204c79['id'];if(_0x2a0ea2[_0xd814('0x35')][_0xd814('0x42')]){_0x3c6062[_0xd814('0x40')]=_[_0xd814('0x43')](_0x3c6062[_0xd814('0x40')],{'$or':_[_0xd814('0x34')](_0x3c6062[_0xd814('0x3a')],function(_0x2e0934){var _0x4b50a={};_0x4b50a[_0x2e0934]={'$like':'%'+_0x2a0ea2[_0xd814('0x35')]['filter']+'%'};return _0x4b50a;})});}_0x3c6062=_[_0xd814('0x43')]({},_0x3c6062,_0x2a0ea2['options']);return db[_0xd814('0x5b')][_0xd814('0x47')](_0x3c6062);}})['then'](function(_0x1c0ba5){if(_0x1c0ba5){return db['User'][_0xd814('0x5c')]({'where':{'id':_[_0xd814('0x34')](_0x1c0ba5,'UserId'),'role':_0xd814('0x5d')},'attributes':['id','name',_0xd814('0x5e'),'updatedAt','createdAt']});}})[_0xd814('0x27')](function(_0x1508a1){if(_0x1508a1){return{'count':_0x1508a1[_0xd814('0x20')],'rows':_[_0xd814('0x34')](_0x1508a1[_0xd814('0x48')],function(_0x554edc){return{'membername':_0x554edc['name'],'UserId':_0x554edc['id'],'queue_name':_0x1776cb[_0xd814('0x2d')],'WhatsappQueueId':_0x1776cb['id'],'interface':util[_0xd814('0x5f')](_0xd814('0x60'),'SIP',_0x554edc[_0xd814('0x2d')]),'penalty':0x0,'paused':_0x554edc[_0xd814('0x5e')],'createdAt':_0x554edc[_0xd814('0x61')],'updatedAt':_0x554edc['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0xd814('0x27')](respondWithFilteredResult(_0x4ffee3,_0x3c6062))[_0xd814('0x49')](handleError(_0x4ffee3,null));};exports[_0xd814('0x62')]=function(_0x392045,_0x5f0df6,_0x1e1e44){var _0x4e350d={};var _0x364397={};var _0x4eb741;var _0xf13e0f;return db['WhatsappQueue'][_0xd814('0x63')]({'where':{'id':_0x392045[_0xd814('0x4b')]['id']}})[_0xd814('0x27')](handleEntityNotFound(_0x5f0df6,null))[_0xd814('0x27')](function(_0x1534f7){if(_0x1534f7){_0x4eb741=_0x1534f7;_0x364397[_0xd814('0x39')]=_[_0xd814('0x36')](db['Team'][_0xd814('0x31')]);_0x364397[_0xd814('0x35')]=_['keys'](_0x392045[_0xd814('0x35')]);_0x364397[_0xd814('0x37')]=_[_0xd814('0x38')](_0x364397[_0xd814('0x39')],_0x364397[_0xd814('0x35')]);_0x4e350d[_0xd814('0x3a')]=_[_0xd814('0x38')](_0x364397[_0xd814('0x39')],qs[_0xd814('0x3b')](_0x392045['query'][_0xd814('0x3b')]));_0x4e350d[_0xd814('0x3a')]=_0x4e350d[_0xd814('0x3a')][_0xd814('0x3c')]?_0x4e350d['attributes']:_0x364397[_0xd814('0x39')];_0x4e350d[_0xd814('0x64')]=qs[_0xd814('0x3f')](_0x392045['query'][_0xd814('0x3f')]);_0x4e350d[_0xd814('0x40')]=qs['filters'](_[_0xd814('0x41')](_0x392045[_0xd814('0x35')],_0x364397[_0xd814('0x37')]));if(_0x392045[_0xd814('0x35')][_0xd814('0x42')]){_0x4e350d[_0xd814('0x40')]=_[_0xd814('0x43')](_0x4e350d[_0xd814('0x40')],{'$or':_[_0xd814('0x34')](_0x4e350d[_0xd814('0x3a')],function(_0x5b8db8){var _0x5aed20={};_0x5aed20[_0x5b8db8]={'$like':'%'+_0x392045['query']['filter']+'%'};return _0x5aed20;})});}_0x4e350d=_[_0xd814('0x43')]({},_0x4e350d,_0x392045['options']);return _0x4eb741['getTeams'](_0x4e350d);}})['then'](function(_0x102a1e){if(_0x102a1e){_0xf13e0f=_0x102a1e[_0xd814('0x3c')];if(!_0x392045[_0xd814('0x35')][_0xd814('0x3d')](_0xd814('0x3e'))){_0x4e350d[_0xd814('0x1f')]=qs[_0xd814('0x1f')](_0x392045[_0xd814('0x35')]['limit']);_0x4e350d['offset']=qs['offset'](_0x392045[_0xd814('0x35')]['offset']);}return _0x4eb741[_0xd814('0x62')](_0x4e350d);}})['then'](function(_0x31fc86){if(_0x31fc86){return _0x31fc86?{'count':_0xf13e0f,'rows':_0x31fc86}:null;}})['then'](respondWithResult(_0x5f0df6,null))[_0xd814('0x49')](handleError(_0x5f0df6,null));};exports[_0xd814('0x65')]=function(_0x295188,_0xb65d3e,_0x571b48){var _0x494b75=_0x295188[_0xd814('0x4f')][_0xd814('0x66')];return db[_0xd814('0x67')][_0xd814('0x47')]({'where':{'id':_0x494b75},'attributes':['id'],'include':[{'model':db[_0xd814('0x68')],'as':'Agents','attributes':['id','name',_0xd814('0x69'),_0xd814('0x6a'),_0xd814('0x6b')],'raw':!![]}]})['then'](function(_0x491946){if(_0x491946){var _0x453dbb=_[_0xd814('0x6c')](_0x491946,function(_0x3a5d28){var _0x17d534=_0x3a5d28[_0xd814('0x28')]({'plain':!![]});return _0x17d534[_0xd814('0x6d')];});return db[_0xd814('0x30')][_0xd814('0x4d')]({'where':{'id':_0x295188[_0xd814('0x4b')]['id']}})['then'](function(_0x3dfa87){return db[_0xd814('0x6e')]['transaction'](function(_0x49f9da){return _0x3dfa87[_0xd814('0x65')](_0x494b75,{'transaction':_0x49f9da})['then'](function(){return BPromise[_0xd814('0x6f')](_0x453dbb,function(_0x1a55f0){return db['UserWhatsappQueue'][_0xd814('0x70')]({'where':{'UserId':_0x1a55f0['id'],'WhatsappQueueId':_0x295188[_0xd814('0x4b')]['id']},'transaction':_0x49f9da});});})[_0xd814('0x27')](function(){_0x453dbb[_0xd814('0x71')](function(_0x1e07c5){socket[_0xd814('0x72')](_0xd814('0x73'),{'UserId':_0x1e07c5['id'],'WhatsappQueueId':_0x3dfa87['id']});});});});});}})[_0xd814('0x27')](respondWithStatusCode(_0xb65d3e,null))[_0xd814('0x49')](handleError(_0xb65d3e,null));};exports[_0xd814('0x74')]=function(_0x1f4423,_0x26930a,_0x19cb14){return db[_0xd814('0x67')][_0xd814('0x47')]({'where':{'id':_0x1f4423[_0xd814('0x35')][_0xd814('0x66')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0xd814('0x6d'),'attributes':['id'],'raw':!![]}]})[_0xd814('0x27')](handleEntityNotFound(_0x26930a,null))[_0xd814('0x27')](function(_0x420fbd){var _0x39e658=_['map'](_0x420fbd,'id');var _0x229f66=[];var _0x555a36=[];var _0x40abde=squel['select']();_0x40abde['field'](_0xd814('0x75'))[_0xd814('0x76')]('team_has_whatsapp_queues','tq')[_0xd814('0x77')]('user_has_teams','ut',_0xd814('0x78'))['where'](_0xd814('0x79'),_0x1f4423[_0xd814('0x4b')]['id']);for(var _0x3df560=0x0;_0x3df560<_0x420fbd[_0xd814('0x3c')];_0x3df560+=0x1){let _0x558cf3=_0x420fbd[_0x3df560];for(var _0x229f6b=0x0;_0x229f6b<_0x558cf3[_0xd814('0x6d')][_0xd814('0x3c')];_0x229f6b+=0x1){let _0x359c2c=_0x558cf3[_0xd814('0x6d')][_0x229f6b];var _0x579477=_0x40abde[_0xd814('0x7a')]();_0x579477[_0xd814('0x40')](_0xd814('0x7b'),_0x359c2c['id']);_0x555a36[_0xd814('0x7c')](db['sequelize'][_0xd814('0x35')](_0x579477[_0xd814('0x7d')](),{'type':db[_0xd814('0x6e')][_0xd814('0x7e')]['SELECT']})[_0xd814('0x27')](function(_0x55d893){if(_0x55d893[_0xd814('0x3c')]===0x1){return _0x359c2c['id'];}else{var _0x1b6ed9=_[_0xd814('0x7f')](_[_0xd814('0x34')](_0x55d893,_0xd814('0x80')),function(_0x1ab8cc){return _[_0xd814('0x81')](_0x39e658,_0x1ab8cc);});if(_0x1b6ed9){return _0x359c2c['id'];}}}));}}return BPromise[_0xd814('0x82')](_0x555a36)['then'](function(_0x4c0ef1){_0x229f66=_(_0x229f66)[_0xd814('0x83')](_0x4c0ef1)['compact']()[_0xd814('0x84')]();return db[_0xd814('0x30')][_0xd814('0x4d')]({'where':{'id':_0x1f4423[_0xd814('0x4b')]['id']}})[_0xd814('0x27')](function(_0x54266e){return db[_0xd814('0x6e')][_0xd814('0x85')](function(_0x576af0){return _0x54266e[_0xd814('0x74')](_0x1f4423[_0xd814('0x35')][_0xd814('0x66')],{'transaction':_0x576af0})[_0xd814('0x27')](function(){if(!_[_0xd814('0x86')](_0x229f66)){return _0x54266e[_0xd814('0x87')](_0x229f66,{'transaction':_0x576af0});}})[_0xd814('0x27')](function(){_0x229f66[_0xd814('0x71')](function(_0x454f38){socket[_0xd814('0x72')](_0xd814('0x88'),{'UserId':_0x454f38,'WhatsappQueueId':_0x54266e['id']});});});});});});})[_0xd814('0x27')](respondWithStatusCode(_0x26930a,null))[_0xd814('0x49')](handleError(_0x26930a,null));};exports[_0xd814('0x89')]=function(_0xb2deda,_0xe2cb3a,_0x14cf12){return db[_0xd814('0x30')][_0xd814('0x4d')]({'where':{'id':_0xb2deda[_0xd814('0x4b')]['id']}})[_0xd814('0x27')](handleEntityNotFound(_0xe2cb3a,null))[_0xd814('0x27')](function(_0x587431){if(_0x587431){return _0x587431[_0xd814('0x89')](_0xb2deda['body'][_0xd814('0x66')],_[_0xd814('0x8a')](_0xb2deda[_0xd814('0x4f')],['ids','id'])||{})[_0xd814('0x8b')](function(_0x4dedb8){for(var _0x34ccb2=0x0;_0x34ccb2<_0xb2deda[_0xd814('0x4f')][_0xd814('0x66')][_0xd814('0x3c')];_0x34ccb2+=0x1){socket[_0xd814('0x72')](_0xd814('0x73'),{'UserId':Number(_0xb2deda[_0xd814('0x4f')]['ids'][_0x34ccb2]),'WhatsappQueueId':Number(_0xb2deda['params']['id'])});}return _0x4dedb8;});}})[_0xd814('0x27')](respondWithResult(_0xe2cb3a,null))[_0xd814('0x49')](handleError(_0xe2cb3a,null));};exports[_0xd814('0x87')]=function(_0x1290fc,_0x112415,_0x497e51){return db[_0xd814('0x30')]['find']({'where':{'id':_0x1290fc[_0xd814('0x4b')]['id']}})[_0xd814('0x27')](handleEntityNotFound(_0x112415,null))[_0xd814('0x27')](function(_0x363b2b){if(_0x363b2b){return _0x363b2b['removeAgents'](_0x1290fc[_0xd814('0x35')][_0xd814('0x66')])[_0xd814('0x27')](function(){if(_[_0xd814('0x8c')](_0x1290fc[_0xd814('0x35')][_0xd814('0x66')])){for(var _0x14c19f=0x0;_0x14c19f<_0x1290fc['query'][_0xd814('0x66')]['length'];_0x14c19f+=0x1){socket[_0xd814('0x72')]('userWhatsappQueue:remove',{'UserId':Number(_0x1290fc['query']['ids'][_0x14c19f]),'WhatsappQueueId':Number(_0x1290fc['params']['id'])});}}else{socket['emit'](_0xd814('0x88'),{'UserId':Number(_0x1290fc[_0xd814('0x35')][_0xd814('0x66')]),'WhatsappQueueId':Number(_0x1290fc[_0xd814('0x4b')]['id'])});}});}})[_0xd814('0x27')](respondWithStatusCode(_0x112415,null))['catch'](handleError(_0x112415,null));};exports[_0xd814('0x8d')]=function(_0xaf5dee,_0x3e4b4a,_0x42c8ae){var _0x157cbb={};var _0x1887d9={};var _0x221095;var _0x1411ca;return db['WhatsappQueue']['findOne']({'where':{'id':_0xaf5dee['params']['id']}})['then'](handleEntityNotFound(_0x3e4b4a,null))[_0xd814('0x27')](function(_0x5582ac){if(_0x5582ac){_0x221095=_0x5582ac;_0x1887d9[_0xd814('0x39')]=_[_0xd814('0x36')](db[_0xd814('0x68')][_0xd814('0x31')]);_0x1887d9['query']=_[_0xd814('0x36')](_0xaf5dee[_0xd814('0x35')]);_0x1887d9[_0xd814('0x37')]=_[_0xd814('0x38')](_0x1887d9[_0xd814('0x39')],_0x1887d9[_0xd814('0x35')]);_0x157cbb[_0xd814('0x3a')]=_[_0xd814('0x38')](_0x1887d9[_0xd814('0x39')],qs[_0xd814('0x3b')](_0xaf5dee['query'][_0xd814('0x3b')]));_0x157cbb[_0xd814('0x3a')]=_0x157cbb['attributes'][_0xd814('0x3c')]?_0x157cbb[_0xd814('0x3a')]:_0x1887d9[_0xd814('0x39')];_0x157cbb[_0xd814('0x64')]=qs[_0xd814('0x3f')](_0xaf5dee['query']['sort']);_0x157cbb[_0xd814('0x40')]=qs[_0xd814('0x37')](_[_0xd814('0x41')](_0xaf5dee[_0xd814('0x35')],_0x1887d9[_0xd814('0x37')]));if(_0xaf5dee['query'][_0xd814('0x42')]){_0x157cbb[_0xd814('0x40')]=_[_0xd814('0x43')](_0x157cbb[_0xd814('0x40')],{'$or':_[_0xd814('0x34')](_0x157cbb[_0xd814('0x3a')],function(_0x5ec8c2){var _0x4907fc={};_0x4907fc[_0x5ec8c2]={'$like':'%'+_0xaf5dee[_0xd814('0x35')]['filter']+'%'};return _0x4907fc;})});}_0x157cbb=_['merge']({},_0x157cbb,_0xaf5dee[_0xd814('0x45')]);return _0x221095[_0xd814('0x8d')](_0x157cbb);}})[_0xd814('0x27')](function(_0x46ce8c){if(_0x46ce8c){_0x1411ca=_0x46ce8c[_0xd814('0x3c')];if(!_0xaf5dee[_0xd814('0x35')][_0xd814('0x3d')](_0xd814('0x3e'))){_0x157cbb[_0xd814('0x1f')]=qs['limit'](_0xaf5dee[_0xd814('0x35')]['limit']);_0x157cbb[_0xd814('0x21')]=qs['offset'](_0xaf5dee[_0xd814('0x35')]['offset']);}return _0x221095[_0xd814('0x8d')](_0x157cbb);}})['then'](function(_0x22b2ab){if(_0x22b2ab){return _0x22b2ab?{'count':_0x1411ca,'rows':_0x22b2ab}:null;}})[_0xd814('0x27')](respondWithResult(_0x3e4b4a,null))[_0xd814('0x49')](handleError(_0x3e4b4a,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.events.js b/server/api/whatsappQueue/whatsappQueue.events.js index 83b5159..a4bc4e9 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 _0xf2bc=['emit','hasOwnProperty','hook','events','../../mysqldb','setMaxListeners','save'];(function(_0x51a321,_0x31df75){var _0x4b6b05=function(_0x1551a6){while(--_0x1551a6){_0x51a321['push'](_0x51a321['shift']());}};_0x4b6b05(++_0x31df75);}(_0xf2bc,0x122));var _0xcf2b=function(_0x546dbb,_0x1a6352){_0x546dbb=_0x546dbb-0x0;var _0x4f08d7=_0xf2bc[_0x546dbb];return _0x4f08d7;};'use strict';var EventEmitter=require(_0xcf2b('0x0'));var WhatsappQueue=require(_0xcf2b('0x1'))['db']['WhatsappQueue'];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0xcf2b('0x2')](0x0);var events={'afterCreate':_0xcf2b('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x4ddd6f){return function(_0x1f0374,_0xf61b6a,_0x5390c1){WhatsappQueueEvents[_0xcf2b('0x4')](_0x4ddd6f+':'+_0x1f0374['id'],_0x1f0374);WhatsappQueueEvents['emit'](_0x4ddd6f,_0x1f0374);_0x5390c1(null);};}for(var e in events){if(events[_0xcf2b('0x5')](e)){var event=events[e];WhatsappQueue[_0xcf2b('0x6')](e,emitEvent(event));}}module['exports']=WhatsappQueueEvents; \ No newline at end of file +var _0xb439=['hook','../../mysqldb','WhatsappQueue','setMaxListeners','save','update','emit','hasOwnProperty'];(function(_0x2539ba,_0x2a256d){var _0x1d8b0c=function(_0x45f378){while(--_0x45f378){_0x2539ba['push'](_0x2539ba['shift']());}};_0x1d8b0c(++_0x2a256d);}(_0xb439,0x1a9));var _0x9b43=function(_0x16b9ed,_0x56517a){_0x16b9ed=_0x16b9ed-0x0;var _0x66b1f8=_0xb439[_0x16b9ed];return _0x66b1f8;};'use strict';var EventEmitter=require('events');var WhatsappQueue=require(_0x9b43('0x0'))['db'][_0x9b43('0x1')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0x9b43('0x2')](0x0);var events={'afterCreate':_0x9b43('0x3'),'afterUpdate':_0x9b43('0x4'),'afterDestroy':'remove'};function emitEvent(_0x256e8d){return function(_0x2bdacf,_0x42fb1f,_0x1e8944){WhatsappQueueEvents[_0x9b43('0x5')](_0x256e8d+':'+_0x2bdacf['id'],_0x2bdacf);WhatsappQueueEvents[_0x9b43('0x5')](_0x256e8d,_0x2bdacf);_0x1e8944(null);};}for(var e in events){if(events[_0x9b43('0x6')](e)){var event=events[e];WhatsappQueue[_0x9b43('0x7')](e,emitEvent(event));}}module['exports']=WhatsappQueueEvents; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.model.js b/server/api/whatsappQueue/whatsappQueue.model.js index 6d52c12..6f58041 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 _0x436b=['define','WhatsappQueue','lodash','util','../../config/logger','api','bluebird','path','rimraf','./whatsappQueue.attributes','exports'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0x436b,0xd3));var _0xb436=function(_0x2a9f94,_0x4037f6){_0x2a9f94=_0x2a9f94-0x0;var _0x4c599f=_0x436b[_0x2a9f94];return _0x4c599f;};'use strict';var _=require(_0xb436('0x0'));var util=require(_0xb436('0x1'));var logger=require(_0xb436('0x2'))(_0xb436('0x3'));var moment=require('moment');var BPromise=require(_0xb436('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb436('0x5'));var rimraf=require(_0xb436('0x6'));var config=require('../../config/environment');var attributes=require(_0xb436('0x7'));module[_0xb436('0x8')]=function(_0x4c0d89,_0x2a2cac){return _0x4c0d89[_0xb436('0x9')](_0xb436('0xa'),attributes,{'tableName':'whatsapp_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1bf1=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappQueue.attributes','define','WhatsappQueue','whatsapp_queues','lodash','util','../../config/logger','api'];(function(_0x366f31,_0x4b79d5){var _0x1d5e19=function(_0x4ebbec){while(--_0x4ebbec){_0x366f31['push'](_0x366f31['shift']());}};_0x1d5e19(++_0x4b79d5);}(_0x1bf1,0x122));var _0x11bf=function(_0x2304ce,_0x5e2bb0){_0x2304ce=_0x2304ce-0x0;var _0x503964=_0x1bf1[_0x2304ce];return _0x503964;};'use strict';var _=require(_0x11bf('0x0'));var util=require(_0x11bf('0x1'));var logger=require(_0x11bf('0x2'))(_0x11bf('0x3'));var moment=require(_0x11bf('0x4'));var BPromise=require(_0x11bf('0x5'));var rp=require(_0x11bf('0x6'));var fs=require('fs');var path=require(_0x11bf('0x7'));var rimraf=require(_0x11bf('0x8'));var config=require(_0x11bf('0x9'));var attributes=require(_0x11bf('0xa'));module['exports']=function(_0xa2a468,_0x13da23){return _0xa2a468[_0x11bf('0xb')](_0x11bf('0xc'),attributes,{'tableName':_0x11bf('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.rpc.js b/server/api/whatsappQueue/whatsappQueue.rpc.js index cceede5..1f914af 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 _0xcf58=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','WhatsappQueue,\x20%s,\x20%s','debug','stringify','error','message','request\x20sent','WhatsappQueue','options','raw','where','attributes','limit','include','model','GetWhatsappQueue','catch','find','map','ShowWhatsappQueue','lodash','moment','bluebird','../../mysqldb'];(function(_0x832e80,_0x5c100b){var _0x4b43a3=function(_0x1ff2e2){while(--_0x1ff2e2){_0x832e80['push'](_0x832e80['shift']());}};_0x4b43a3(++_0x5c100b);}(_0xcf58,0xb5));var _0x8cf5=function(_0x3f23ee,_0x43328b){_0x3f23ee=_0x3f23ee-0x0;var _0x3cf580=_0xcf58[_0x3f23ee];return _0x3cf580;};'use strict';var _=require(_0x8cf5('0x0'));var util=require('util');var moment=require(_0x8cf5('0x1'));var BPromise=require(_0x8cf5('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8cf5('0x3'))['db'];var utils=require(_0x8cf5('0x4'));var logger=require(_0x8cf5('0x5'))(_0x8cf5('0x6'));var config=require(_0x8cf5('0x7'));var jayson=require(_0x8cf5('0x8'));var client=jayson['client'][_0x8cf5('0x9')]({'port':0x232a});config[_0x8cf5('0xa')]=_[_0x8cf5('0xb')](config[_0x8cf5('0xa')],{'host':_0x8cf5('0xc'),'port':0x18eb});var socket=require(_0x8cf5('0xd'))(new Redis(config['redis']));require('./whatsappQueue.socket')[_0x8cf5('0xe')](socket);function respondWithRpcPromise(_0x38597e,_0x1a4155,_0xeff929){return new BPromise(function(_0x14692c,_0x5a7ae5){return client[_0x8cf5('0xf')](_0x38597e,_0xeff929)[_0x8cf5('0x10')](function(_0x3a719e){logger[_0x8cf5('0x11')](_0x8cf5('0x12'),_0x1a4155,'request\x20sent');logger[_0x8cf5('0x13')]('WhatsappQueue,\x20%s,\x20%s,\x20%s',_0x1a4155,'request\x20sent',JSON[_0x8cf5('0x14')](_0x3a719e));if(_0x3a719e['error']){if(_0x3a719e[_0x8cf5('0x15')]['code']===0x1f4){logger['error']('WhatsappQueue,\x20%s,\x20%s',_0x1a4155,_0x3a719e[_0x8cf5('0x15')][_0x8cf5('0x16')]);return _0x5a7ae5(_0x3a719e['error'][_0x8cf5('0x16')]);}logger[_0x8cf5('0x15')](_0x8cf5('0x12'),_0x1a4155,_0x3a719e[_0x8cf5('0x15')][_0x8cf5('0x16')]);return _0x14692c(_0x3a719e[_0x8cf5('0x15')][_0x8cf5('0x16')]);}else{logger['info'](_0x8cf5('0x12'),_0x1a4155,_0x8cf5('0x17'));_0x14692c(_0x3a719e['result'][_0x8cf5('0x16')]);}})['catch'](function(_0x44c638){logger['error']('WhatsappQueue,\x20%s,\x20%s',_0x1a4155,_0x44c638);_0x5a7ae5(_0x44c638);});});}exports['GetWhatsappQueue']=function(_0x34fc98){var _0x717c5=this;return new Promise(function(_0x54004d,_0x18d996){return db[_0x8cf5('0x18')]['findAll']({'raw':_0x34fc98[_0x8cf5('0x19')]?_0x34fc98['options'][_0x8cf5('0x1a')]===undefined?!![]:![]:!![],'where':_0x34fc98[_0x8cf5('0x19')]?_0x34fc98[_0x8cf5('0x19')][_0x8cf5('0x1b')]||null:null,'attributes':_0x34fc98[_0x8cf5('0x19')]?_0x34fc98[_0x8cf5('0x19')][_0x8cf5('0x1c')]||null:null,'limit':_0x34fc98['options']?_0x34fc98['options'][_0x8cf5('0x1d')]||null:null,'include':_0x34fc98['options']?_0x34fc98[_0x8cf5('0x19')][_0x8cf5('0x1e')]?_['map'](_0x34fc98['options']['include'],function(_0x40b8a2){return{'model':db[_0x40b8a2[_0x8cf5('0x1f')]],'as':_0x40b8a2['as'],'attributes':_0x40b8a2['attributes'],'include':_0x40b8a2[_0x8cf5('0x1e')]?_['map'](_0x40b8a2[_0x8cf5('0x1e')],function(_0xab4add){return{'model':db[_0xab4add[_0x8cf5('0x1f')]],'as':_0xab4add['as'],'attributes':_0xab4add[_0x8cf5('0x1c')],'include':_0xab4add['include']?_['map'](_0xab4add[_0x8cf5('0x1e')],function(_0x5a5a18){return{'model':db[_0x5a5a18[_0x8cf5('0x1f')]],'as':_0x5a5a18['as'],'attributes':_0x5a5a18[_0x8cf5('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3536b6){logger[_0x8cf5('0x11')]('GetWhatsappQueue',_0x34fc98);logger[_0x8cf5('0x13')](_0x8cf5('0x20'),_0x34fc98,JSON[_0x8cf5('0x14')](_0x3536b6));_0x54004d(_0x3536b6);})[_0x8cf5('0x21')](function(_0x136be3){logger[_0x8cf5('0x15')](_0x8cf5('0x20'),_0x136be3['message'],_0x34fc98);_0x18d996(_0x717c5[_0x8cf5('0x15')](0x1f4,_0x136be3['message']));});});};exports['ShowWhatsappQueue']=function(_0x26c067){var _0xca0233=this;return new Promise(function(_0x2d4cdc,_0x4c1ddd){return db[_0x8cf5('0x18')][_0x8cf5('0x22')]({'raw':_0x26c067[_0x8cf5('0x19')]?_0x26c067[_0x8cf5('0x19')][_0x8cf5('0x1a')]===undefined?!![]:![]:!![],'where':_0x26c067[_0x8cf5('0x19')]?_0x26c067[_0x8cf5('0x19')][_0x8cf5('0x1b')]||null:null,'attributes':_0x26c067[_0x8cf5('0x19')]?_0x26c067[_0x8cf5('0x19')][_0x8cf5('0x1c')]||null:null,'include':_0x26c067[_0x8cf5('0x19')]?_0x26c067['options'][_0x8cf5('0x1e')]?_[_0x8cf5('0x23')](_0x26c067['options'][_0x8cf5('0x1e')],function(_0x27c170){return{'model':db[_0x27c170[_0x8cf5('0x1f')]],'as':_0x27c170['as'],'attributes':_0x27c170[_0x8cf5('0x1c')],'include':_0x27c170[_0x8cf5('0x1e')]?_[_0x8cf5('0x23')](_0x27c170[_0x8cf5('0x1e')],function(_0x3466e4){return{'model':db[_0x3466e4[_0x8cf5('0x1f')]],'as':_0x3466e4['as'],'attributes':_0x3466e4[_0x8cf5('0x1c')],'include':_0x3466e4[_0x8cf5('0x1e')]?_[_0x8cf5('0x23')](_0x3466e4['include'],function(_0x130d15){return{'model':db[_0x130d15[_0x8cf5('0x1f')]],'as':_0x130d15['as'],'attributes':_0x130d15['attributes']};}):[]};}):[]};}):[]:[]})[_0x8cf5('0x10')](function(_0x34269e){logger[_0x8cf5('0x11')](_0x8cf5('0x24'),_0x26c067);logger[_0x8cf5('0x13')]('ShowWhatsappQueue',_0x26c067,JSON[_0x8cf5('0x14')](_0x34269e));_0x2d4cdc(_0x34269e);})['catch'](function(_0x205f72){logger[_0x8cf5('0x15')](_0x8cf5('0x24'),_0x205f72['message'],_0x26c067);_0x4c1ddd(_0xca0233[_0x8cf5('0x15')](0x1f4,_0x205f72[_0x8cf5('0x16')]));});});}; \ No newline at end of file +var _0xd30b=['ShowWhatsappQueue','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','defaults','localhost','redis','./whatsappQueue.socket','register','then','info','debug','request\x20sent','stringify','error','code','message','WhatsappQueue,\x20%s,\x20%s','catch','GetWhatsappQueue','findAll','options','raw','attributes','map','include','model','where'];(function(_0x556927,_0x34b53f){var _0x5f1235=function(_0x4f4e44){while(--_0x4f4e44){_0x556927['push'](_0x556927['shift']());}};_0x5f1235(++_0x34b53f);}(_0xd30b,0xdf));var _0xbd30=function(_0x381589,_0x27a707){_0x381589=_0x381589-0x0;var _0x2a075d=_0xd30b[_0x381589];return _0x2a075d;};'use strict';var _=require(_0xbd30('0x0'));var util=require(_0xbd30('0x1'));var moment=require(_0xbd30('0x2'));var BPromise=require(_0xbd30('0x3'));var rs=require(_0xbd30('0x4'));var fs=require('fs');var Redis=require(_0xbd30('0x5'));var db=require(_0xbd30('0x6'))['db'];var utils=require(_0xbd30('0x7'));var logger=require('../../config/logger')(_0xbd30('0x8'));var config=require(_0xbd30('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xbd30('0xa')][_0xbd30('0xb')]({'port':0x232a});config['redis']=_[_0xbd30('0xc')](config['redis'],{'host':_0xbd30('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xbd30('0xe')]));require(_0xbd30('0xf'))[_0xbd30('0x10')](socket);function respondWithRpcPromise(_0x1099a4,_0xbb2ae9,_0x120def){return new BPromise(function(_0x2f9f68,_0x579299){return client['request'](_0x1099a4,_0x120def)[_0xbd30('0x11')](function(_0x557495){logger[_0xbd30('0x12')]('WhatsappQueue,\x20%s,\x20%s',_0xbb2ae9,'request\x20sent');logger[_0xbd30('0x13')]('WhatsappQueue,\x20%s,\x20%s,\x20%s',_0xbb2ae9,_0xbd30('0x14'),JSON[_0xbd30('0x15')](_0x557495));if(_0x557495[_0xbd30('0x16')]){if(_0x557495['error'][_0xbd30('0x17')]===0x1f4){logger[_0xbd30('0x16')]('WhatsappQueue,\x20%s,\x20%s',_0xbb2ae9,_0x557495[_0xbd30('0x16')][_0xbd30('0x18')]);return _0x579299(_0x557495[_0xbd30('0x16')][_0xbd30('0x18')]);}logger[_0xbd30('0x16')](_0xbd30('0x19'),_0xbb2ae9,_0x557495['error'][_0xbd30('0x18')]);return _0x2f9f68(_0x557495[_0xbd30('0x16')][_0xbd30('0x18')]);}else{logger[_0xbd30('0x12')](_0xbd30('0x19'),_0xbb2ae9,'request\x20sent');_0x2f9f68(_0x557495['result'][_0xbd30('0x18')]);}})[_0xbd30('0x1a')](function(_0x272e3a){logger['error'](_0xbd30('0x19'),_0xbb2ae9,_0x272e3a);_0x579299(_0x272e3a);});});}exports[_0xbd30('0x1b')]=function(_0x325d89){var _0x8cc2ab=this;return new Promise(function(_0xc8b663,_0x398677){return db['WhatsappQueue'][_0xbd30('0x1c')]({'raw':_0x325d89[_0xbd30('0x1d')]?_0x325d89[_0xbd30('0x1d')][_0xbd30('0x1e')]===undefined?!![]:![]:!![],'where':_0x325d89[_0xbd30('0x1d')]?_0x325d89[_0xbd30('0x1d')]['where']||null:null,'attributes':_0x325d89[_0xbd30('0x1d')]?_0x325d89[_0xbd30('0x1d')][_0xbd30('0x1f')]||null:null,'limit':_0x325d89[_0xbd30('0x1d')]?_0x325d89[_0xbd30('0x1d')]['limit']||null:null,'include':_0x325d89[_0xbd30('0x1d')]?_0x325d89['options']['include']?_[_0xbd30('0x20')](_0x325d89[_0xbd30('0x1d')][_0xbd30('0x21')],function(_0x1e7790){return{'model':db[_0x1e7790[_0xbd30('0x22')]],'as':_0x1e7790['as'],'attributes':_0x1e7790[_0xbd30('0x1f')],'include':_0x1e7790[_0xbd30('0x21')]?_[_0xbd30('0x20')](_0x1e7790[_0xbd30('0x21')],function(_0x8091b6){return{'model':db[_0x8091b6[_0xbd30('0x22')]],'as':_0x8091b6['as'],'attributes':_0x8091b6[_0xbd30('0x1f')],'include':_0x8091b6[_0xbd30('0x21')]?_[_0xbd30('0x20')](_0x8091b6[_0xbd30('0x21')],function(_0x35637d){return{'model':db[_0x35637d[_0xbd30('0x22')]],'as':_0x35637d['as'],'attributes':_0x35637d[_0xbd30('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x32fcdb){logger['info'](_0xbd30('0x1b'),_0x325d89);logger[_0xbd30('0x13')](_0xbd30('0x1b'),_0x325d89,JSON[_0xbd30('0x15')](_0x32fcdb));_0xc8b663(_0x32fcdb);})[_0xbd30('0x1a')](function(_0x49c1cc){logger['error'](_0xbd30('0x1b'),_0x49c1cc[_0xbd30('0x18')],_0x325d89);_0x398677(_0x8cc2ab[_0xbd30('0x16')](0x1f4,_0x49c1cc['message']));});});};exports['ShowWhatsappQueue']=function(_0x23d90c){var _0x3b03a8=this;return new Promise(function(_0x5acbda,_0x399166){return db['WhatsappQueue']['find']({'raw':_0x23d90c[_0xbd30('0x1d')]?_0x23d90c[_0xbd30('0x1d')][_0xbd30('0x1e')]===undefined?!![]:![]:!![],'where':_0x23d90c['options']?_0x23d90c['options'][_0xbd30('0x23')]||null:null,'attributes':_0x23d90c[_0xbd30('0x1d')]?_0x23d90c[_0xbd30('0x1d')]['attributes']||null:null,'include':_0x23d90c['options']?_0x23d90c['options']['include']?_['map'](_0x23d90c[_0xbd30('0x1d')][_0xbd30('0x21')],function(_0x3ed9ed){return{'model':db[_0x3ed9ed[_0xbd30('0x22')]],'as':_0x3ed9ed['as'],'attributes':_0x3ed9ed[_0xbd30('0x1f')],'include':_0x3ed9ed[_0xbd30('0x21')]?_['map'](_0x3ed9ed[_0xbd30('0x21')],function(_0x51566f){return{'model':db[_0x51566f['model']],'as':_0x51566f['as'],'attributes':_0x51566f[_0xbd30('0x1f')],'include':_0x51566f['include']?_[_0xbd30('0x20')](_0x51566f[_0xbd30('0x21')],function(_0x56ff54){return{'model':db[_0x56ff54[_0xbd30('0x22')]],'as':_0x56ff54['as'],'attributes':_0x56ff54[_0xbd30('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x41d847){logger[_0xbd30('0x12')](_0xbd30('0x24'),_0x23d90c);logger[_0xbd30('0x13')]('ShowWhatsappQueue',_0x23d90c,JSON[_0xbd30('0x15')](_0x41d847));_0x5acbda(_0x41d847);})[_0xbd30('0x1a')](function(_0x463b26){logger[_0xbd30('0x16')]('ShowWhatsappQueue',_0x463b26[_0xbd30('0x18')],_0x23d90c);_0x399166(_0x3b03a8[_0xbd30('0x16')](0x1f4,_0x463b26['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.socket.js b/server/api/whatsappQueue/whatsappQueue.socket.js index 7b8fcaa..6a0819e 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 _0x40f2=['emit','removeListener','register','length','whatsappQueue:','./whatsappQueue.events','save','remove','update'];(function(_0x2de020,_0x252df0){var _0x182b7c=function(_0xcbcdaa){while(--_0xcbcdaa){_0x2de020['push'](_0x2de020['shift']());}};_0x182b7c(++_0x252df0);}(_0x40f2,0x137));var _0x240f=function(_0x399c7a,_0x16eada){_0x399c7a=_0x399c7a-0x0;var _0x2975ba=_0x40f2[_0x399c7a];return _0x2975ba;};'use strict';var WhatsappQueueEvents=require(_0x240f('0x0'));var events=[_0x240f('0x1'),_0x240f('0x2'),_0x240f('0x3')];function createListener(_0x57e96d,_0x4a3ba8){return function(_0xd4219f){_0x4a3ba8[_0x240f('0x4')](_0x57e96d,_0xd4219f);};}function removeListener(_0x3b6933,_0x322ce3){return function(){WhatsappQueueEvents[_0x240f('0x5')](_0x3b6933,_0x322ce3);};}exports[_0x240f('0x6')]=function(_0x5819c7){for(var _0x40093c=0x0,_0x16a830=events[_0x240f('0x7')];_0x40093c<_0x16a830;_0x40093c++){var _0x1f5905=events[_0x40093c];var _0x47159b=createListener(_0x240f('0x8')+_0x1f5905,_0x5819c7);WhatsappQueueEvents['on'](_0x1f5905,_0x47159b);}}; \ No newline at end of file +var _0xa361=['removeListener','./whatsappQueue.events','save','remove','update','emit'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xa361,0x187));var _0x1a36=function(_0x18ca32,_0x136bd4){_0x18ca32=_0x18ca32-0x0;var _0x23761a=_0xa361[_0x18ca32];return _0x23761a;};'use strict';var WhatsappQueueEvents=require(_0x1a36('0x0'));var events=[_0x1a36('0x1'),_0x1a36('0x2'),_0x1a36('0x3')];function createListener(_0xe6dc9,_0x57df1d){return function(_0x22a3ca){_0x57df1d[_0x1a36('0x4')](_0xe6dc9,_0x22a3ca);};}function removeListener(_0x5b9c0c,_0x5dbffc){return function(){WhatsappQueueEvents[_0x1a36('0x5')](_0x5b9c0c,_0x5dbffc);};}exports['register']=function(_0x171f6b){for(var _0x3992e9=0x0,_0x453a19=events['length'];_0x3992e9<_0x453a19;_0x3992e9++){var _0x92694a=events[_0x3992e9];var _0x5b80ab=createListener('whatsappQueue:'+_0x92694a,_0x171f6b);WhatsappQueueEvents['on'](_0x92694a,_0x5b80ab);}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/index.js b/server/api/whatsappQueueReport/index.js index 90501a7..8bc9f0c 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 _0xe117=['describe','get','/:id','put','update','delete','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueueReport.controller','isAuthenticated','/describe'];(function(_0x5a6afe,_0x2ea084){var _0x3c7275=function(_0x35bcf2){while(--_0x35bcf2){_0x5a6afe['push'](_0x5a6afe['shift']());}};_0x3c7275(++_0x2ea084);}(_0xe117,0xc4));var _0x7e11=function(_0x2bddf4,_0x44c47b){_0x2bddf4=_0x2bddf4-0x0;var _0x20ca51=_0xe117[_0x2bddf4];return _0x20ca51;};'use strict';var multer=require(_0x7e11('0x0'));var util=require(_0x7e11('0x1'));var path=require(_0x7e11('0x2'));var timeout=require(_0x7e11('0x3'));var express=require(_0x7e11('0x4'));var router=express[_0x7e11('0x5')]();var fs_extra=require(_0x7e11('0x6'));var auth=require(_0x7e11('0x7'));var interaction=require(_0x7e11('0x8'));var config=require(_0x7e11('0x9'));var controller=require(_0x7e11('0xa'));router['get']('/',auth[_0x7e11('0xb')](),controller['index']);router['get'](_0x7e11('0xc'),auth['isAuthenticated'](),controller[_0x7e11('0xd')]);router[_0x7e11('0xe')](_0x7e11('0xf'),auth[_0x7e11('0xb')](),controller['show']);router['post']('/',auth[_0x7e11('0xb')](),controller['create']);router[_0x7e11('0x10')](_0x7e11('0xf'),auth[_0x7e11('0xb')](),controller[_0x7e11('0x11')]);router[_0x7e11('0x12')]('/:id',auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x62d0=['fs-extra','../../components/auth/service','isAuthenticated','index','get','describe','/:id','post','create','put','delete','destroy','exports','util','path','connect-timeout','Router'];(function(_0x4ea955,_0x1eda76){var _0x558561=function(_0x5b20f4){while(--_0x5b20f4){_0x4ea955['push'](_0x4ea955['shift']());}};_0x558561(++_0x1eda76);}(_0x62d0,0x95));var _0x062d=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x62d0[_0x57b54c];return _0x59cc19;};'use strict';var multer=require('multer');var util=require(_0x062d('0x0'));var path=require(_0x062d('0x1'));var timeout=require(_0x062d('0x2'));var express=require('express');var router=express[_0x062d('0x3')]();var fs_extra=require(_0x062d('0x4'));var auth=require(_0x062d('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./whatsappQueueReport.controller');router['get']('/',auth[_0x062d('0x6')](),controller[_0x062d('0x7')]);router[_0x062d('0x8')]('/describe',auth[_0x062d('0x6')](),controller[_0x062d('0x9')]);router[_0x062d('0x8')](_0x062d('0xa'),auth[_0x062d('0x6')](),controller['show']);router[_0x062d('0xb')]('/',auth['isAuthenticated'](),controller[_0x062d('0xc')]);router[_0x062d('0xd')](_0x062d('0xa'),auth['isAuthenticated'](),controller['update']);router[_0x062d('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x062d('0xf')]);module[_0x062d('0x10')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js index 57cacdd..c04b50d 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(_0xea07f0,_0x3f9b0e){var _0x379315=function(_0x531354){while(--_0x531354){_0xea07f0['push'](_0xea07f0['shift']());}};_0x379315(++_0x3f9b0e);}(_0x7a54,0x106));var _0x47a5=function(_0x3407d2,_0xed9df4){_0x3407d2=_0x3407d2-0x0;var _0x244294=_0x7a54[_0x3407d2];return _0x244294;};'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(_0x334d6d,_0x567864){var _0xb532a6=function(_0x199490){while(--_0x199490){_0x334d6d['push'](_0x334d6d['shift']());}};_0xb532a6(++_0x567864);}(_0x9957,0x93));var _0x7995=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9957[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'uniqueid':{'type':Sequelize[_0x7995('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x7995('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x7995('0x3')]},'acceptAt':{'type':Sequelize[_0x7995('0x3')]},'exitAt':{'type':Sequelize[_0x7995('0x3')]},'reason':{'type':Sequelize[_0x7995('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.controller.js b/server/api/whatsappQueueReport/whatsappQueueReport.controller.js index c2436f0..89985e2 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 _0xb62e=['length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','then','includeAll','findAll','show','find','catch','create','body','update','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','stack','name','send','index','map','WhatsappQueueReport','rawAttributes','type','key','model','query','keys','filters','attributes','fields'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xb62e,0x1de));var _0xeb62=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0xb62e[_0x3bf83f];return _0x22c4a9;};'use strict';var emlformat=require(_0xeb62('0x0'));var rimraf=require(_0xeb62('0x1'));var zipdir=require(_0xeb62('0x2'));var jsonpatch=require(_0xeb62('0x3'));var rp=require('request-promise');var moment=require(_0xeb62('0x4'));var BPromise=require(_0xeb62('0x5'));var Mustache=require(_0xeb62('0x6'));var util=require(_0xeb62('0x7'));var path=require(_0xeb62('0x8'));var sox=require(_0xeb62('0x9'));var csv=require('to-csv');var ejs=require(_0xeb62('0xa'));var fs=require('fs');var fs_extra=require(_0xeb62('0xb'));var _=require(_0xeb62('0xc'));var squel=require('squel');var crypto=require(_0xeb62('0xd'));var jsforce=require(_0xeb62('0xe'));var deskjs=require(_0xeb62('0xf'));var toCsv=require(_0xeb62('0x10'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xeb62('0x11'));var authService=require(_0xeb62('0x12'));var qs=require(_0xeb62('0x13'));var as=require(_0xeb62('0x14'));var hardwareService=require(_0xeb62('0x15'));var logger=require(_0xeb62('0x16'))(_0xeb62('0x17'));var utils=require(_0xeb62('0x18'));var config=require(_0xeb62('0x19'));var licenseUtil=require(_0xeb62('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x422daf,_0xcc11c4){_0xcc11c4=_0xcc11c4||0xcc;return function(_0x27671e){if(_0x27671e){return _0x422daf[_0xeb62('0x1b')](_0xcc11c4);}return _0x422daf['status'](_0xcc11c4)[_0xeb62('0x1c')]();};}function respondWithResult(_0x2fbad2,_0x23fb15){_0x23fb15=_0x23fb15||0xc8;return function(_0x4da178){if(_0x4da178){return _0x2fbad2[_0xeb62('0x1d')](_0x23fb15)[_0xeb62('0x1e')](_0x4da178);}};}function respondWithFilteredResult(_0x2fd4c7,_0x4ce9fa){return function(_0x1f6a1f){if(_0x1f6a1f){var _0x15b3e8=typeof _0x4ce9fa[_0xeb62('0x1f')]===_0xeb62('0x20')&&typeof _0x4ce9fa[_0xeb62('0x21')]===_0xeb62('0x20');var _0x1fb460=_0x1f6a1f[_0xeb62('0x22')];var _0x39b138=_0x15b3e8?0x0:_0x4ce9fa[_0xeb62('0x1f')];var _0x27efc8=_0x15b3e8?_0x1f6a1f[_0xeb62('0x22')]:_0x4ce9fa[_0xeb62('0x1f')]+_0x4ce9fa['limit'];var _0x38c5e4;if(_0x27efc8>=_0x1fb460){_0x27efc8=_0x1fb460;_0x38c5e4=0xc8;}else{_0x38c5e4=0xce;}_0x2fd4c7[_0xeb62('0x1d')](_0x38c5e4);return _0x2fd4c7[_0xeb62('0x23')](_0xeb62('0x24'),_0x39b138+'-'+_0x27efc8+'/'+_0x1fb460)[_0xeb62('0x1e')](_0x1f6a1f);}return null;};}function patchUpdates(_0x24cbf3){return function(_0x2ed96d){try{jsonpatch['apply'](_0x2ed96d,_0x24cbf3,!![]);}catch(_0x599d0b){return BPromise[_0xeb62('0x25')](_0x599d0b);}return _0x2ed96d[_0xeb62('0x26')]();};}function saveUpdates(_0x11ed9c,_0x13243f){return function(_0x122b15){if(_0x122b15){return _0x122b15['update'](_0x11ed9c)['then'](function(_0x4664ce){return _0x4664ce;});}return null;};}function removeEntity(_0x132861,_0x182781){return function(_0x395b70){if(_0x395b70){return _0x395b70['destroy']()['then'](function(){_0x132861[_0xeb62('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x448327,_0x4b0f46){return function(_0xfe3e16){if(!_0xfe3e16){_0x448327['sendStatus'](0x194);}return _0xfe3e16;};}function handleError(_0x3ac28c,_0x6bfbbc){_0x6bfbbc=_0x6bfbbc||0x1f4;return function(_0x46d1bb){logger['error'](_0x46d1bb[_0xeb62('0x27')]);if(_0x46d1bb[_0xeb62('0x28')]){delete _0x46d1bb[_0xeb62('0x28')];}_0x3ac28c[_0xeb62('0x1d')](_0x6bfbbc)[_0xeb62('0x29')](_0x46d1bb);};}exports[_0xeb62('0x2a')]=function(_0x511202,_0x192517){var _0x1616ee={},_0x57169a={},_0x157474={'count':0x0,'rows':[]};var _0x2b51b2=_[_0xeb62('0x2b')](db[_0xeb62('0x2c')][_0xeb62('0x2d')],function(_0x5195bf){return{'name':_0x5195bf['fieldName'],'type':_0x5195bf[_0xeb62('0x2e')][_0xeb62('0x2f')]};});_0x57169a[_0xeb62('0x30')]=_[_0xeb62('0x2b')](_0x2b51b2,_0xeb62('0x28'));_0x57169a[_0xeb62('0x31')]=_[_0xeb62('0x32')](_0x511202['query']);_0x57169a[_0xeb62('0x33')]=_['intersection'](_0x57169a['model'],_0x57169a[_0xeb62('0x31')]);_0x1616ee[_0xeb62('0x34')]=_['intersection'](_0x57169a[_0xeb62('0x30')],qs['fields'](_0x511202[_0xeb62('0x31')][_0xeb62('0x35')]));_0x1616ee['attributes']=_0x1616ee[_0xeb62('0x34')][_0xeb62('0x36')]?_0x1616ee['attributes']:_0x57169a[_0xeb62('0x30')];if(!_0x511202[_0xeb62('0x31')][_0xeb62('0x37')](_0xeb62('0x38'))){_0x1616ee['limit']=qs[_0xeb62('0x21')](_0x511202[_0xeb62('0x31')]['limit']);_0x1616ee['offset']=qs[_0xeb62('0x1f')](_0x511202[_0xeb62('0x31')]['offset']);}_0x1616ee[_0xeb62('0x39')]=qs[_0xeb62('0x3a')](_0x511202[_0xeb62('0x31')][_0xeb62('0x3a')]);_0x1616ee[_0xeb62('0x3b')]=qs[_0xeb62('0x33')](_[_0xeb62('0x3c')](_0x511202['query'],_0x57169a['filters']),_0x2b51b2);if(_0x511202[_0xeb62('0x31')][_0xeb62('0x3d')]){_0x1616ee[_0xeb62('0x3b')]=_[_0xeb62('0x3e')](_0x1616ee['where'],{'$or':_[_0xeb62('0x2b')](_0x2b51b2,function(_0x510c7d){if(_0x510c7d[_0xeb62('0x2e')]!==_0xeb62('0x3f')){var _0x2dac2f={};_0x2dac2f[_0x510c7d[_0xeb62('0x28')]]={'$like':'%'+_0x511202[_0xeb62('0x31')][_0xeb62('0x3d')]+'%'};return _0x2dac2f;}})});}_0x1616ee=_[_0xeb62('0x3e')]({},_0x1616ee,_0x511202[_0xeb62('0x40')]);var _0x5e8ef8={'where':_0x1616ee[_0xeb62('0x3b')]};return db[_0xeb62('0x2c')][_0xeb62('0x22')](_0x5e8ef8)[_0xeb62('0x41')](function(_0x5dd0e3){_0x157474['count']=_0x5dd0e3;if(_0x511202[_0xeb62('0x31')][_0xeb62('0x42')]){_0x1616ee['include']=[{'all':!![]}];}return db[_0xeb62('0x2c')][_0xeb62('0x43')](_0x1616ee);})['then'](function(_0x25e9f0){_0x157474['rows']=_0x25e9f0;return _0x157474;})[_0xeb62('0x41')](respondWithFilteredResult(_0x192517,_0x1616ee))['catch'](handleError(_0x192517,null));};exports[_0xeb62('0x44')]=function(_0x5dde1d,_0x2bf77f){var _0x609b2d={'raw':!![],'where':{'id':_0x5dde1d['params']['id']}},_0x317f50={};_0x317f50['model']=_[_0xeb62('0x32')](db[_0xeb62('0x2c')][_0xeb62('0x2d')]);_0x317f50[_0xeb62('0x31')]=_[_0xeb62('0x32')](_0x5dde1d['query']);_0x317f50[_0xeb62('0x33')]=_['intersection'](_0x317f50[_0xeb62('0x30')],_0x317f50['query']);_0x609b2d[_0xeb62('0x34')]=_['intersection'](_0x317f50[_0xeb62('0x30')],qs['fields'](_0x5dde1d[_0xeb62('0x31')][_0xeb62('0x35')]));_0x609b2d[_0xeb62('0x34')]=_0x609b2d[_0xeb62('0x34')][_0xeb62('0x36')]?_0x609b2d[_0xeb62('0x34')]:_0x317f50['model'];if(_0x5dde1d[_0xeb62('0x31')][_0xeb62('0x42')]){_0x609b2d['include']=[{'all':!![]}];}_0x609b2d=_['merge']({},_0x609b2d,_0x5dde1d['options']);return db['WhatsappQueueReport'][_0xeb62('0x45')](_0x609b2d)[_0xeb62('0x41')](handleEntityNotFound(_0x2bf77f,null))['then'](respondWithResult(_0x2bf77f,null))[_0xeb62('0x46')](handleError(_0x2bf77f,null));};exports[_0xeb62('0x47')]=function(_0x412e93,_0x16e262){return db[_0xeb62('0x2c')]['create'](_0x412e93[_0xeb62('0x48')],{})['then'](respondWithResult(_0x16e262,0xc9))[_0xeb62('0x46')](handleError(_0x16e262,null));};exports[_0xeb62('0x49')]=function(_0x7fb53f,_0x18c40d){if(_0x7fb53f[_0xeb62('0x48')]['id']){delete _0x7fb53f[_0xeb62('0x48')]['id'];}return db[_0xeb62('0x2c')][_0xeb62('0x45')]({'where':{'id':_0x7fb53f[_0xeb62('0x4a')]['id']}})[_0xeb62('0x41')](handleEntityNotFound(_0x18c40d,null))[_0xeb62('0x41')](saveUpdates(_0x7fb53f[_0xeb62('0x48')],null))['then'](respondWithResult(_0x18c40d,null))[_0xeb62('0x46')](handleError(_0x18c40d,null));};exports['destroy']=function(_0x4edd8c,_0x2dcb2d){return db[_0xeb62('0x2c')]['find']({'where':{'id':_0x4edd8c[_0xeb62('0x4a')]['id']}})[_0xeb62('0x41')](handleEntityNotFound(_0x2dcb2d,null))['then'](removeEntity(_0x2dcb2d,null))[_0xeb62('0x46')](handleError(_0x2dcb2d,null));};exports[_0xeb62('0x4b')]=function(_0x20b73b,_0x60617){return db[_0xeb62('0x2c')][_0xeb62('0x4b')]()[_0xeb62('0x41')](respondWithResult(_0x60617,null))[_0xeb62('0x46')](handleError(_0x60617,null));}; \ No newline at end of file +var _0x0565=['length','hasOwnProperty','nolimit','sort','where','pick','VIRTUAL','filter','merge','options','WhatsappQueueReport','includeAll','findAll','rows','catch','show','params','find','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/license/util','status','end','json','offset','limit','undefined','count','set','Content-Range','reject','then','destroy','sendStatus','error','stack','name','send','index','rawAttributes','type','key','model','map','query','keys','filters','intersection','fields','attributes'];(function(_0xf6c510,_0x38658f){var _0x18fa72=function(_0x22bb6b){while(--_0x22bb6b){_0xf6c510['push'](_0xf6c510['shift']());}};_0x18fa72(++_0x38658f);}(_0x0565,0xf2));var _0x5056=function(_0x47aa64,_0xfb8a07){_0x47aa64=_0x47aa64-0x0;var _0x549c7a=_0x0565[_0x47aa64];return _0x549c7a;};'use strict';var emlformat=require(_0x5056('0x0'));var rimraf=require(_0x5056('0x1'));var zipdir=require(_0x5056('0x2'));var jsonpatch=require(_0x5056('0x3'));var rp=require(_0x5056('0x4'));var moment=require(_0x5056('0x5'));var BPromise=require(_0x5056('0x6'));var Mustache=require(_0x5056('0x7'));var util=require(_0x5056('0x8'));var path=require(_0x5056('0x9'));var sox=require('sox');var csv=require(_0x5056('0xa'));var ejs=require(_0x5056('0xb'));var fs=require('fs');var fs_extra=require(_0x5056('0xc'));var _=require(_0x5056('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x5056('0xe'));var deskjs=require(_0x5056('0xf'));var toCsv=require(_0x5056('0xa'));var querystring=require(_0x5056('0x10'));var Papa=require(_0x5056('0x11'));var Redis=require(_0x5056('0x12'));var authService=require(_0x5056('0x13'));var qs=require(_0x5056('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5056('0x15'));var logger=require(_0x5056('0x16'))(_0x5056('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x5056('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x548bcf,_0x53e98a){_0x53e98a=_0x53e98a||0xcc;return function(_0x2d44fb){if(_0x2d44fb){return _0x548bcf['sendStatus'](_0x53e98a);}return _0x548bcf[_0x5056('0x19')](_0x53e98a)[_0x5056('0x1a')]();};}function respondWithResult(_0x7af76b,_0x543cee){_0x543cee=_0x543cee||0xc8;return function(_0x1e8b64){if(_0x1e8b64){return _0x7af76b[_0x5056('0x19')](_0x543cee)[_0x5056('0x1b')](_0x1e8b64);}};}function respondWithFilteredResult(_0x56c3ef,_0x21561d){return function(_0x6a044a){if(_0x6a044a){var _0x4ac332=typeof _0x21561d[_0x5056('0x1c')]==='undefined'&&typeof _0x21561d[_0x5056('0x1d')]===_0x5056('0x1e');var _0x1c0ee9=_0x6a044a[_0x5056('0x1f')];var _0x4056ce=_0x4ac332?0x0:_0x21561d['offset'];var _0x9ea88=_0x4ac332?_0x6a044a[_0x5056('0x1f')]:_0x21561d['offset']+_0x21561d['limit'];var _0x20776c;if(_0x9ea88>=_0x1c0ee9){_0x9ea88=_0x1c0ee9;_0x20776c=0xc8;}else{_0x20776c=0xce;}_0x56c3ef[_0x5056('0x19')](_0x20776c);return _0x56c3ef[_0x5056('0x20')](_0x5056('0x21'),_0x4056ce+'-'+_0x9ea88+'/'+_0x1c0ee9)[_0x5056('0x1b')](_0x6a044a);}return null;};}function patchUpdates(_0xf04e08){return function(_0x33035c){try{jsonpatch['apply'](_0x33035c,_0xf04e08,!![]);}catch(_0x13b363){return BPromise[_0x5056('0x22')](_0x13b363);}return _0x33035c['save']();};}function saveUpdates(_0x271efc,_0x1bccef){return function(_0x2564d0){if(_0x2564d0){return _0x2564d0['update'](_0x271efc)[_0x5056('0x23')](function(_0x26a3c2){return _0x26a3c2;});}return null;};}function removeEntity(_0x5afbfe,_0x4a64be){return function(_0x29e166){if(_0x29e166){return _0x29e166[_0x5056('0x24')]()[_0x5056('0x23')](function(){_0x5afbfe[_0x5056('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x267048,_0x25409f){return function(_0x5d1656){if(!_0x5d1656){_0x267048[_0x5056('0x25')](0x194);}return _0x5d1656;};}function handleError(_0x505ccf,_0x15f03f){_0x15f03f=_0x15f03f||0x1f4;return function(_0x39d539){logger[_0x5056('0x26')](_0x39d539[_0x5056('0x27')]);if(_0x39d539[_0x5056('0x28')]){delete _0x39d539['name'];}_0x505ccf[_0x5056('0x19')](_0x15f03f)[_0x5056('0x29')](_0x39d539);};}exports[_0x5056('0x2a')]=function(_0x2ac79a,_0x53e6db){var _0x24d33e={},_0x5b0270={},_0x70246c={'count':0x0,'rows':[]};var _0x49fe67=_['map'](db['WhatsappQueueReport'][_0x5056('0x2b')],function(_0x252f75){return{'name':_0x252f75['fieldName'],'type':_0x252f75[_0x5056('0x2c')][_0x5056('0x2d')]};});_0x5b0270[_0x5056('0x2e')]=_[_0x5056('0x2f')](_0x49fe67,_0x5056('0x28'));_0x5b0270[_0x5056('0x30')]=_[_0x5056('0x31')](_0x2ac79a[_0x5056('0x30')]);_0x5b0270[_0x5056('0x32')]=_[_0x5056('0x33')](_0x5b0270[_0x5056('0x2e')],_0x5b0270['query']);_0x24d33e['attributes']=_[_0x5056('0x33')](_0x5b0270[_0x5056('0x2e')],qs['fields'](_0x2ac79a[_0x5056('0x30')][_0x5056('0x34')]));_0x24d33e['attributes']=_0x24d33e[_0x5056('0x35')][_0x5056('0x36')]?_0x24d33e[_0x5056('0x35')]:_0x5b0270[_0x5056('0x2e')];if(!_0x2ac79a[_0x5056('0x30')][_0x5056('0x37')](_0x5056('0x38'))){_0x24d33e[_0x5056('0x1d')]=qs[_0x5056('0x1d')](_0x2ac79a[_0x5056('0x30')][_0x5056('0x1d')]);_0x24d33e[_0x5056('0x1c')]=qs[_0x5056('0x1c')](_0x2ac79a[_0x5056('0x30')][_0x5056('0x1c')]);}_0x24d33e['order']=qs[_0x5056('0x39')](_0x2ac79a['query'][_0x5056('0x39')]);_0x24d33e[_0x5056('0x3a')]=qs[_0x5056('0x32')](_[_0x5056('0x3b')](_0x2ac79a['query'],_0x5b0270[_0x5056('0x32')]),_0x49fe67);if(_0x2ac79a[_0x5056('0x30')]['filter']){_0x24d33e[_0x5056('0x3a')]=_['merge'](_0x24d33e[_0x5056('0x3a')],{'$or':_[_0x5056('0x2f')](_0x49fe67,function(_0x3d56cf){if(_0x3d56cf['type']!==_0x5056('0x3c')){var _0x16a940={};_0x16a940[_0x3d56cf[_0x5056('0x28')]]={'$like':'%'+_0x2ac79a[_0x5056('0x30')][_0x5056('0x3d')]+'%'};return _0x16a940;}})});}_0x24d33e=_[_0x5056('0x3e')]({},_0x24d33e,_0x2ac79a[_0x5056('0x3f')]);var _0x21aa75={'where':_0x24d33e[_0x5056('0x3a')]};return db[_0x5056('0x40')][_0x5056('0x1f')](_0x21aa75)[_0x5056('0x23')](function(_0xc1024a){_0x70246c[_0x5056('0x1f')]=_0xc1024a;if(_0x2ac79a[_0x5056('0x30')][_0x5056('0x41')]){_0x24d33e['include']=[{'all':!![]}];}return db['WhatsappQueueReport'][_0x5056('0x42')](_0x24d33e);})[_0x5056('0x23')](function(_0x6946b4){_0x70246c[_0x5056('0x43')]=_0x6946b4;return _0x70246c;})[_0x5056('0x23')](respondWithFilteredResult(_0x53e6db,_0x24d33e))[_0x5056('0x44')](handleError(_0x53e6db,null));};exports[_0x5056('0x45')]=function(_0x2bf472,_0x48ab5e){var _0x58f12f={'raw':!![],'where':{'id':_0x2bf472[_0x5056('0x46')]['id']}},_0x68a385={};_0x68a385[_0x5056('0x2e')]=_['keys'](db[_0x5056('0x40')]['rawAttributes']);_0x68a385[_0x5056('0x30')]=_[_0x5056('0x31')](_0x2bf472[_0x5056('0x30')]);_0x68a385[_0x5056('0x32')]=_[_0x5056('0x33')](_0x68a385[_0x5056('0x2e')],_0x68a385['query']);_0x58f12f[_0x5056('0x35')]=_[_0x5056('0x33')](_0x68a385[_0x5056('0x2e')],qs['fields'](_0x2bf472['query']['fields']));_0x58f12f['attributes']=_0x58f12f[_0x5056('0x35')][_0x5056('0x36')]?_0x58f12f[_0x5056('0x35')]:_0x68a385[_0x5056('0x2e')];if(_0x2bf472[_0x5056('0x30')]['includeAll']){_0x58f12f['include']=[{'all':!![]}];}_0x58f12f=_[_0x5056('0x3e')]({},_0x58f12f,_0x2bf472[_0x5056('0x3f')]);return db[_0x5056('0x40')][_0x5056('0x47')](_0x58f12f)[_0x5056('0x23')](handleEntityNotFound(_0x48ab5e,null))[_0x5056('0x23')](respondWithResult(_0x48ab5e,null))[_0x5056('0x44')](handleError(_0x48ab5e,null));};exports['create']=function(_0x52d6ea,_0x14e3f5){return db[_0x5056('0x40')]['create'](_0x52d6ea[_0x5056('0x48')],{})[_0x5056('0x23')](respondWithResult(_0x14e3f5,0xc9))['catch'](handleError(_0x14e3f5,null));};exports['update']=function(_0x83d8e4,_0x1ab1a9){if(_0x83d8e4['body']['id']){delete _0x83d8e4['body']['id'];}return db[_0x5056('0x40')][_0x5056('0x47')]({'where':{'id':_0x83d8e4['params']['id']}})['then'](handleEntityNotFound(_0x1ab1a9,null))[_0x5056('0x23')](saveUpdates(_0x83d8e4[_0x5056('0x48')],null))[_0x5056('0x23')](respondWithResult(_0x1ab1a9,null))[_0x5056('0x44')](handleError(_0x1ab1a9,null));};exports[_0x5056('0x24')]=function(_0xdf427c,_0x97f7d8){return db[_0x5056('0x40')][_0x5056('0x47')]({'where':{'id':_0xdf427c[_0x5056('0x46')]['id']}})[_0x5056('0x23')](handleEntityNotFound(_0x97f7d8,null))[_0x5056('0x23')](removeEntity(_0x97f7d8,null))[_0x5056('0x44')](handleError(_0x97f7d8,null));};exports[_0x5056('0x49')]=function(_0x34e86e,_0x4bf758){return db['WhatsappQueueReport'][_0x5056('0x49')]()[_0x5056('0x23')](respondWithResult(_0x4bf758,null))[_0x5056('0x44')](handleError(_0x4bf758,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.model.js b/server/api/whatsappQueueReport/whatsappQueueReport.model.js index 2cd6493..a4fa048 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 _0xc601=['rimraf','../../config/environment','./whatsappQueueReport.attributes','uniqueid','lodash','util','../../config/logger','bluebird','path'];(function(_0x4a53d,_0x58a95e){var _0x27410e=function(_0x38fc90){while(--_0x38fc90){_0x4a53d['push'](_0x4a53d['shift']());}};_0x27410e(++_0x58a95e);}(_0xc601,0xaf));var _0x1c60=function(_0x39266c,_0xd4d1d8){_0x39266c=_0x39266c-0x0;var _0x8f3ac9=_0xc601[_0x39266c];return _0x8f3ac9;};'use strict';var _=require(_0x1c60('0x0'));var util=require(_0x1c60('0x1'));var logger=require(_0x1c60('0x2'))('api');var moment=require('moment');var BPromise=require(_0x1c60('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1c60('0x4'));var rimraf=require(_0x1c60('0x5'));var config=require(_0x1c60('0x6'));var attributes=require(_0x1c60('0x7'));module['exports']=function(_0x75bd6c,_0x491501){return _0x75bd6c['define']('WhatsappQueueReport',attributes,{'tableName':'report_whatsapp_queue','paranoid':![],'indexes':[{'name':_0x1c60('0x8'),'fields':[_0x1c60('0x8')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc8b4=['bluebird','request-promise','rimraf','../../config/environment','./whatsappQueueReport.attributes','exports','WhatsappQueueReport','report_whatsapp_queue','uniqueid','util','../../config/logger','api'];(function(_0xa32d84,_0x3197da){var _0x41b869=function(_0x719fca){while(--_0x719fca){_0xa32d84['push'](_0xa32d84['shift']());}};_0x41b869(++_0x3197da);}(_0xc8b4,0x1c5));var _0x4c8b=function(_0x553e7b,_0x1f917b){_0x553e7b=_0x553e7b-0x0;var _0x1ce843=_0xc8b4[_0x553e7b];return _0x1ce843;};'use strict';var _=require('lodash');var util=require(_0x4c8b('0x0'));var logger=require(_0x4c8b('0x1'))(_0x4c8b('0x2'));var moment=require('moment');var BPromise=require(_0x4c8b('0x3'));var rp=require(_0x4c8b('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4c8b('0x5'));var config=require(_0x4c8b('0x6'));var attributes=require(_0x4c8b('0x7'));module[_0x4c8b('0x8')]=function(_0x458d65,_0xebafc8){return _0x458d65['define'](_0x4c8b('0x9'),attributes,{'tableName':_0x4c8b('0xa'),'paranoid':![],'indexes':[{'name':_0x4c8b('0xb'),'fields':[_0x4c8b('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js b/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js index 00b48a2..adb5e9c 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 _0xb25d=['WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','CreateWhatsappQueueReport','WhatsappQueueReport','create','body','options','UpdateWhatsappQueueReport','update','raw','where','attributes','limit','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info'];(function(_0x175f74,_0x31e6a4){var _0x4c1e80=function(_0x4a5a10){while(--_0x4a5a10){_0x175f74['push'](_0x175f74['shift']());}};_0x4c1e80(++_0x31e6a4);}(_0xb25d,0xc3));var _0xdb25=function(_0x294032,_0x4ed889){_0x294032=_0x294032-0x0;var _0x5e9616=_0xb25d[_0x294032];return _0x5e9616;};'use strict';var _=require('lodash');var util=require(_0xdb25('0x0'));var moment=require(_0xdb25('0x1'));var BPromise=require(_0xdb25('0x2'));var rs=require(_0xdb25('0x3'));var fs=require('fs');var Redis=require(_0xdb25('0x4'));var db=require(_0xdb25('0x5'))['db'];var utils=require(_0xdb25('0x6'));var logger=require(_0xdb25('0x7'))(_0xdb25('0x8'));var config=require(_0xdb25('0x9'));var jayson=require(_0xdb25('0xa'));var client=jayson[_0xdb25('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x52ae75,_0x1265c2,_0x3a28ee){return new BPromise(function(_0x11af23,_0x5317b1){return client[_0xdb25('0xc')](_0x52ae75,_0x3a28ee)[_0xdb25('0xd')](function(_0x15abb7){logger[_0xdb25('0xe')](_0xdb25('0xf'),_0x1265c2,_0xdb25('0x10'));logger[_0xdb25('0x11')](_0xdb25('0x12'),_0x1265c2,_0xdb25('0x10'),JSON[_0xdb25('0x13')](_0x15abb7));if(_0x15abb7[_0xdb25('0x14')]){if(_0x15abb7[_0xdb25('0x14')][_0xdb25('0x15')]===0x1f4){logger[_0xdb25('0x14')](_0xdb25('0xf'),_0x1265c2,_0x15abb7[_0xdb25('0x14')][_0xdb25('0x16')]);return _0x5317b1(_0x15abb7['error'][_0xdb25('0x16')]);}logger[_0xdb25('0x14')](_0xdb25('0xf'),_0x1265c2,_0x15abb7[_0xdb25('0x14')][_0xdb25('0x16')]);return _0x11af23(_0x15abb7[_0xdb25('0x14')][_0xdb25('0x16')]);}else{logger[_0xdb25('0xe')](_0xdb25('0xf'),_0x1265c2,_0xdb25('0x10'));_0x11af23(_0x15abb7['result'][_0xdb25('0x16')]);}})[_0xdb25('0x17')](function(_0x387b68){logger['error'](_0xdb25('0xf'),_0x1265c2,_0x387b68);_0x5317b1(_0x387b68);});});}exports[_0xdb25('0x18')]=function(_0x2dca73){var _0x3d8d25=this;return new Promise(function(_0x52b620,_0x33c3b0){return db[_0xdb25('0x19')][_0xdb25('0x1a')](_0x2dca73[_0xdb25('0x1b')],{'raw':_0x2dca73['options']?_0x2dca73[_0xdb25('0x1c')]['raw']===undefined?!![]:![]:!![]})[_0xdb25('0xd')](function(_0xf28bab){logger[_0xdb25('0xe')]('CreateWhatsappQueueReport',_0x2dca73);logger[_0xdb25('0x11')](_0xdb25('0x18'),_0x2dca73,JSON[_0xdb25('0x13')](_0xf28bab));_0x52b620(_0xf28bab);})[_0xdb25('0x17')](function(_0x3a74fc){logger[_0xdb25('0x14')](_0xdb25('0x18'),_0x3a74fc['message'],_0x2dca73);_0x33c3b0(_0x3d8d25[_0xdb25('0x14')](0x1f4,_0x3a74fc['message']));});});};exports[_0xdb25('0x1d')]=function(_0x392e15){var _0x46bf1c=this;return new Promise(function(_0x50a255,_0x1274fe){return db['WhatsappQueueReport'][_0xdb25('0x1e')](_0x392e15[_0xdb25('0x1b')],{'raw':_0x392e15['options']?_0x392e15[_0xdb25('0x1c')][_0xdb25('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x392e15[_0xdb25('0x1c')]?_0x392e15[_0xdb25('0x1c')][_0xdb25('0x20')]||null:null,'attributes':_0x392e15[_0xdb25('0x1c')]?_0x392e15[_0xdb25('0x1c')][_0xdb25('0x21')]||null:null,'limit':_0x392e15[_0xdb25('0x1c')]?_0x392e15[_0xdb25('0x1c')][_0xdb25('0x22')]||null:null})[_0xdb25('0xd')](function(_0x1ae1c8){logger[_0xdb25('0xe')]('UpdateWhatsappQueueReport',_0x392e15);logger[_0xdb25('0x11')]('UpdateWhatsappQueueReport',_0x392e15,JSON[_0xdb25('0x13')](_0x1ae1c8));_0x50a255(_0x1ae1c8);})[_0xdb25('0x17')](function(_0x5c93ab){logger[_0xdb25('0x14')]('UpdateWhatsappQueueReport',_0x5c93ab[_0xdb25('0x16')],_0x392e15);_0x1274fe(_0x46bf1c['error'](0x1f4,_0x5c93ab[_0xdb25('0x16')]));});});}; \ No newline at end of file +var _0x4153=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','CreateWhatsappQueueReport','WhatsappQueueReport','body','options','UpdateWhatsappQueueReport','update','raw','where','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x4153,0x8a));var _0x3415=function(_0x1acdbf,_0x15d050){_0x1acdbf=_0x1acdbf-0x0;var _0x4f92c0=_0x4153[_0x1acdbf];return _0x4f92c0;};'use strict';var _=require(_0x3415('0x0'));var util=require(_0x3415('0x1'));var moment=require(_0x3415('0x2'));var BPromise=require(_0x3415('0x3'));var rs=require(_0x3415('0x4'));var fs=require('fs');var Redis=require(_0x3415('0x5'));var db=require(_0x3415('0x6'))['db'];var utils=require(_0x3415('0x7'));var logger=require(_0x3415('0x8'))(_0x3415('0x9'));var config=require(_0x3415('0xa'));var jayson=require(_0x3415('0xb'));var client=jayson[_0x3415('0xc')][_0x3415('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x25b4c0,_0x5bd446,_0x3875c4){return new BPromise(function(_0x35339c,_0x3cadac){return client[_0x3415('0xe')](_0x25b4c0,_0x3875c4)[_0x3415('0xf')](function(_0x341bb8){logger[_0x3415('0x10')](_0x3415('0x11'),_0x5bd446,_0x3415('0x12'));logger[_0x3415('0x13')]('WhatsappQueueReport,\x20%s,\x20%s,\x20%s',_0x5bd446,_0x3415('0x12'),JSON[_0x3415('0x14')](_0x341bb8));if(_0x341bb8[_0x3415('0x15')]){if(_0x341bb8['error'][_0x3415('0x16')]===0x1f4){logger[_0x3415('0x15')](_0x3415('0x11'),_0x5bd446,_0x341bb8[_0x3415('0x15')][_0x3415('0x17')]);return _0x3cadac(_0x341bb8[_0x3415('0x15')]['message']);}logger[_0x3415('0x15')](_0x3415('0x11'),_0x5bd446,_0x341bb8[_0x3415('0x15')]['message']);return _0x35339c(_0x341bb8[_0x3415('0x15')][_0x3415('0x17')]);}else{logger[_0x3415('0x10')](_0x3415('0x11'),_0x5bd446,_0x3415('0x12'));_0x35339c(_0x341bb8[_0x3415('0x18')][_0x3415('0x17')]);}})[_0x3415('0x19')](function(_0x3d075e){logger[_0x3415('0x15')](_0x3415('0x11'),_0x5bd446,_0x3d075e);_0x3cadac(_0x3d075e);});});}exports[_0x3415('0x1a')]=function(_0x32efb6){var _0xca2a55=this;return new Promise(function(_0x3cf2c9,_0xbcde64){return db[_0x3415('0x1b')]['create'](_0x32efb6[_0x3415('0x1c')],{'raw':_0x32efb6[_0x3415('0x1d')]?_0x32efb6[_0x3415('0x1d')]['raw']===undefined?!![]:![]:!![]})[_0x3415('0xf')](function(_0x3b2424){logger[_0x3415('0x10')](_0x3415('0x1a'),_0x32efb6);logger[_0x3415('0x13')](_0x3415('0x1a'),_0x32efb6,JSON[_0x3415('0x14')](_0x3b2424));_0x3cf2c9(_0x3b2424);})[_0x3415('0x19')](function(_0x251963){logger[_0x3415('0x15')]('CreateWhatsappQueueReport',_0x251963[_0x3415('0x17')],_0x32efb6);_0xbcde64(_0xca2a55[_0x3415('0x15')](0x1f4,_0x251963['message']));});});};exports[_0x3415('0x1e')]=function(_0x541536){var _0x435420=this;return new Promise(function(_0x32aebf,_0xe70016){return db['WhatsappQueueReport'][_0x3415('0x1f')](_0x541536[_0x3415('0x1c')],{'raw':_0x541536[_0x3415('0x1d')]?_0x541536[_0x3415('0x1d')][_0x3415('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x541536[_0x3415('0x1d')]?_0x541536[_0x3415('0x1d')][_0x3415('0x21')]||null:null,'attributes':_0x541536['options']?_0x541536[_0x3415('0x1d')][_0x3415('0x22')]||null:null,'limit':_0x541536[_0x3415('0x1d')]?_0x541536[_0x3415('0x1d')][_0x3415('0x23')]||null:null})[_0x3415('0xf')](function(_0x3de128){logger[_0x3415('0x10')]('UpdateWhatsappQueueReport',_0x541536);logger[_0x3415('0x13')](_0x3415('0x1e'),_0x541536,JSON['stringify'](_0x3de128));_0x32aebf(_0x3de128);})[_0x3415('0x19')](function(_0x257a54){logger[_0x3415('0x15')](_0x3415('0x1e'),_0x257a54['message'],_0x541536);_0xe70016(_0x435420[_0x3415('0x15')](0x1f4,_0x257a54['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/index.js b/server/api/whatsappTransferReport/index.js index 164b1d7..072672a 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 _0x2034=['index','isAuthenticated','describe','/:id','show','put','update','delete','destroy','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappTransferReport.controller','get'];(function(_0x5d1647,_0x4b6210){var _0x55a58b=function(_0x110731){while(--_0x110731){_0x5d1647['push'](_0x5d1647['shift']());}};_0x55a58b(++_0x4b6210);}(_0x2034,0xbd));var _0x4203=function(_0x410e78,_0x308cc4){_0x410e78=_0x410e78-0x0;var _0x4e900e=_0x2034[_0x410e78];return _0x4e900e;};'use strict';var multer=require(_0x4203('0x0'));var util=require(_0x4203('0x1'));var path=require(_0x4203('0x2'));var timeout=require(_0x4203('0x3'));var express=require('express');var router=express[_0x4203('0x4')]();var fs_extra=require(_0x4203('0x5'));var auth=require(_0x4203('0x6'));var interaction=require(_0x4203('0x7'));var config=require(_0x4203('0x8'));var controller=require(_0x4203('0x9'));router[_0x4203('0xa')]('/',auth['isAuthenticated'](),controller[_0x4203('0xb')]);router['get']('/describe',auth[_0x4203('0xc')](),controller[_0x4203('0xd')]);router[_0x4203('0xa')](_0x4203('0xe'),auth[_0x4203('0xc')](),controller[_0x4203('0xf')]);router['post']('/',auth[_0x4203('0xc')](),controller['create']);router[_0x4203('0x10')](_0x4203('0xe'),auth[_0x4203('0xc')](),controller[_0x4203('0x11')]);router[_0x4203('0x12')](_0x4203('0xe'),auth['isAuthenticated'](),controller[_0x4203('0x13')]);module['exports']=router; \ No newline at end of file +var _0x3c0a=['update','delete','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappTransferReport.controller','get','isAuthenticated','index','describe','/:id','show','post','create'];(function(_0x238601,_0x166a6f){var _0x468b3d=function(_0x437760){while(--_0x437760){_0x238601['push'](_0x238601['shift']());}};_0x468b3d(++_0x166a6f);}(_0x3c0a,0x80));var _0xa3c0=function(_0x17c739,_0x4dab9d){_0x17c739=_0x17c739-0x0;var _0x4a0856=_0x3c0a[_0x17c739];return _0x4a0856;};'use strict';var multer=require('multer');var util=require(_0xa3c0('0x0'));var path=require('path');var timeout=require(_0xa3c0('0x1'));var express=require(_0xa3c0('0x2'));var router=express['Router']();var fs_extra=require(_0xa3c0('0x3'));var auth=require(_0xa3c0('0x4'));var interaction=require(_0xa3c0('0x5'));var config=require(_0xa3c0('0x6'));var controller=require(_0xa3c0('0x7'));router[_0xa3c0('0x8')]('/',auth[_0xa3c0('0x9')](),controller[_0xa3c0('0xa')]);router['get']('/describe',auth[_0xa3c0('0x9')](),controller[_0xa3c0('0xb')]);router[_0xa3c0('0x8')](_0xa3c0('0xc'),auth[_0xa3c0('0x9')](),controller[_0xa3c0('0xd')]);router[_0xa3c0('0xe')]('/',auth['isAuthenticated'](),controller[_0xa3c0('0xf')]);router['put'](_0xa3c0('0xc'),auth[_0xa3c0('0x9')](),controller[_0xa3c0('0x10')]);router[_0xa3c0('0x11')](_0xa3c0('0xc'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js b/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js index e37bba9..2947d3f 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 _0x4b17=['DATE','sequelize','STRING','account','agent'];(function(_0x4b8bf7,_0x3ecddb){var _0x2f0adf=function(_0x3cc7d4){while(--_0x3cc7d4){_0x4b8bf7['push'](_0x4b8bf7['shift']());}};_0x2f0adf(++_0x3ecddb);}(_0x4b17,0x10f));var _0x74b1=function(_0x3e5bc8,_0x457d89){_0x3e5bc8=_0x3e5bc8-0x0;var _0xfd84bc=_0x4b17[_0x3e5bc8];return _0xfd84bc;};'use strict';var Sequelize=require(_0x74b1('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x74b1('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x74b1('0x2'),_0x74b1('0x3'),'queue'),'allowNull':![]},'transferredAt':{'type':Sequelize[_0x74b1('0x4')]}}; \ No newline at end of file +var _0xb9e7=['STRING','ENUM','account','agent','queue','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb9e7,0x1df));var _0x7b9e=function(_0x4c2dfc,_0x4814c0){_0x4c2dfc=_0x4c2dfc-0x0;var _0xfd728d=_0xb9e7[_0x4c2dfc];return _0xfd728d;};'use strict';var Sequelize=require('sequelize');module[_0x7b9e('0x0')]={'uniqueid':{'type':Sequelize[_0x7b9e('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x7b9e('0x2')](_0x7b9e('0x3'),_0x7b9e('0x4'),_0x7b9e('0x5')),'allowNull':![]},'transferredAt':{'type':Sequelize['DATE']}}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.controller.js b/server/api/whatsappTransferReport/whatsappTransferReport.controller.js index d54651d..1857450 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 _0xfe4a=['send','index','map','WhatsappTransferReport','rawAttributes','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','create','body','update','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','apply','save','then','destroy','error','stack','name'];(function(_0x94ed7c,_0x592bd8){var _0x4a9ae3=function(_0x125057){while(--_0x125057){_0x94ed7c['push'](_0x94ed7c['shift']());}};_0x4a9ae3(++_0x592bd8);}(_0xfe4a,0x10b));var _0xafe4=function(_0x4b2436,_0x452299){_0x4b2436=_0x4b2436-0x0;var _0x4f5ab2=_0xfe4a[_0x4b2436];return _0x4f5ab2;};'use strict';var emlformat=require(_0xafe4('0x0'));var rimraf=require(_0xafe4('0x1'));var zipdir=require(_0xafe4('0x2'));var jsonpatch=require(_0xafe4('0x3'));var rp=require(_0xafe4('0x4'));var moment=require(_0xafe4('0x5'));var BPromise=require(_0xafe4('0x6'));var Mustache=require(_0xafe4('0x7'));var util=require('util');var path=require(_0xafe4('0x8'));var sox=require(_0xafe4('0x9'));var csv=require(_0xafe4('0xa'));var ejs=require(_0xafe4('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xafe4('0xc'));var squel=require(_0xafe4('0xd'));var crypto=require('crypto');var jsforce=require(_0xafe4('0xe'));var deskjs=require(_0xafe4('0xf'));var toCsv=require(_0xafe4('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xafe4('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xafe4('0x11'));var hardwareService=require(_0xafe4('0x12'));var logger=require(_0xafe4('0x13'))(_0xafe4('0x14'));var utils=require(_0xafe4('0x15'));var config=require(_0xafe4('0x16'));var licenseUtil=require(_0xafe4('0x17'));var db=require(_0xafe4('0x18'))['db'];function respondWithStatusCode(_0x5553c5,_0x1ed16b){_0x1ed16b=_0x1ed16b||0xcc;return function(_0x811f05){if(_0x811f05){return _0x5553c5[_0xafe4('0x19')](_0x1ed16b);}return _0x5553c5['status'](_0x1ed16b)['end']();};}function respondWithResult(_0xfcc728,_0x2a1068){_0x2a1068=_0x2a1068||0xc8;return function(_0x524004){if(_0x524004){return _0xfcc728[_0xafe4('0x1a')](_0x2a1068)[_0xafe4('0x1b')](_0x524004);}};}function respondWithFilteredResult(_0x309a9c,_0x254461){return function(_0x57ccea){if(_0x57ccea){var _0x452b6c=typeof _0x254461['offset']===_0xafe4('0x1c')&&typeof _0x254461[_0xafe4('0x1d')]===_0xafe4('0x1c');var _0x482cc7=_0x57ccea[_0xafe4('0x1e')];var _0x5b5aa3=_0x452b6c?0x0:_0x254461['offset'];var _0x12d9ab=_0x452b6c?_0x57ccea[_0xafe4('0x1e')]:_0x254461[_0xafe4('0x1f')]+_0x254461[_0xafe4('0x1d')];var _0x6d8b89;if(_0x12d9ab>=_0x482cc7){_0x12d9ab=_0x482cc7;_0x6d8b89=0xc8;}else{_0x6d8b89=0xce;}_0x309a9c[_0xafe4('0x1a')](_0x6d8b89);return _0x309a9c[_0xafe4('0x20')](_0xafe4('0x21'),_0x5b5aa3+'-'+_0x12d9ab+'/'+_0x482cc7)['json'](_0x57ccea);}return null;};}function patchUpdates(_0x300af5){return function(_0x512d04){try{jsonpatch[_0xafe4('0x22')](_0x512d04,_0x300af5,!![]);}catch(_0x39bb91){return BPromise['reject'](_0x39bb91);}return _0x512d04[_0xafe4('0x23')]();};}function saveUpdates(_0x531f80,_0xda7868){return function(_0x4a8f63){if(_0x4a8f63){return _0x4a8f63['update'](_0x531f80)[_0xafe4('0x24')](function(_0x130345){return _0x130345;});}return null;};}function removeEntity(_0x57628f,_0x3d65f7){return function(_0x4bc6f1){if(_0x4bc6f1){return _0x4bc6f1[_0xafe4('0x25')]()[_0xafe4('0x24')](function(){_0x57628f[_0xafe4('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0xa51208,_0x1af754){return function(_0xee0a4c){if(!_0xee0a4c){_0xa51208['sendStatus'](0x194);}return _0xee0a4c;};}function handleError(_0x22508d,_0x47ee7d){_0x47ee7d=_0x47ee7d||0x1f4;return function(_0x5b67d0){logger[_0xafe4('0x26')](_0x5b67d0[_0xafe4('0x27')]);if(_0x5b67d0[_0xafe4('0x28')]){delete _0x5b67d0[_0xafe4('0x28')];}_0x22508d[_0xafe4('0x1a')](_0x47ee7d)[_0xafe4('0x29')](_0x5b67d0);};}exports[_0xafe4('0x2a')]=function(_0x4c898b,_0x58c36c){var _0x1141e8={},_0x50b5d6={},_0x17ab12={'count':0x0,'rows':[]};var _0x1a4a91=_[_0xafe4('0x2b')](db[_0xafe4('0x2c')][_0xafe4('0x2d')],function(_0x1e9bfd){return{'name':_0x1e9bfd['fieldName'],'type':_0x1e9bfd['type'][_0xafe4('0x2e')]};});_0x50b5d6[_0xafe4('0x2f')]=_[_0xafe4('0x2b')](_0x1a4a91,_0xafe4('0x28'));_0x50b5d6[_0xafe4('0x30')]=_[_0xafe4('0x31')](_0x4c898b[_0xafe4('0x30')]);_0x50b5d6['filters']=_[_0xafe4('0x32')](_0x50b5d6[_0xafe4('0x2f')],_0x50b5d6[_0xafe4('0x30')]);_0x1141e8[_0xafe4('0x33')]=_['intersection'](_0x50b5d6['model'],qs[_0xafe4('0x34')](_0x4c898b[_0xafe4('0x30')][_0xafe4('0x34')]));_0x1141e8[_0xafe4('0x33')]=_0x1141e8[_0xafe4('0x33')]['length']?_0x1141e8[_0xafe4('0x33')]:_0x50b5d6[_0xafe4('0x2f')];if(!_0x4c898b[_0xafe4('0x30')][_0xafe4('0x35')](_0xafe4('0x36'))){_0x1141e8[_0xafe4('0x1d')]=qs[_0xafe4('0x1d')](_0x4c898b[_0xafe4('0x30')][_0xafe4('0x1d')]);_0x1141e8['offset']=qs[_0xafe4('0x1f')](_0x4c898b[_0xafe4('0x30')][_0xafe4('0x1f')]);}_0x1141e8[_0xafe4('0x37')]=qs[_0xafe4('0x38')](_0x4c898b[_0xafe4('0x30')][_0xafe4('0x38')]);_0x1141e8[_0xafe4('0x39')]=qs['filters'](_[_0xafe4('0x3a')](_0x4c898b[_0xafe4('0x30')],_0x50b5d6[_0xafe4('0x3b')]),_0x1a4a91);if(_0x4c898b[_0xafe4('0x30')][_0xafe4('0x3c')]){_0x1141e8[_0xafe4('0x39')]=_[_0xafe4('0x3d')](_0x1141e8[_0xafe4('0x39')],{'$or':_[_0xafe4('0x2b')](_0x1a4a91,function(_0x1a550d){if(_0x1a550d[_0xafe4('0x3e')]!==_0xafe4('0x3f')){var _0x7b64e2={};_0x7b64e2[_0x1a550d[_0xafe4('0x28')]]={'$like':'%'+_0x4c898b[_0xafe4('0x30')][_0xafe4('0x3c')]+'%'};return _0x7b64e2;}})});}_0x1141e8=_[_0xafe4('0x3d')]({},_0x1141e8,_0x4c898b[_0xafe4('0x40')]);var _0xe5eca9={'where':_0x1141e8['where']};return db[_0xafe4('0x2c')][_0xafe4('0x1e')](_0xe5eca9)[_0xafe4('0x24')](function(_0x1e1ce4){_0x17ab12[_0xafe4('0x1e')]=_0x1e1ce4;if(_0x4c898b[_0xafe4('0x30')][_0xafe4('0x41')]){_0x1141e8[_0xafe4('0x42')]=[{'all':!![]}];}return db[_0xafe4('0x2c')][_0xafe4('0x43')](_0x1141e8);})[_0xafe4('0x24')](function(_0x3540ad){_0x17ab12[_0xafe4('0x44')]=_0x3540ad;return _0x17ab12;})['then'](respondWithFilteredResult(_0x58c36c,_0x1141e8))[_0xafe4('0x45')](handleError(_0x58c36c,null));};exports[_0xafe4('0x46')]=function(_0x550da5,_0x481751){var _0x17cf78={'raw':!![],'where':{'id':_0x550da5[_0xafe4('0x47')]['id']}},_0x28b9b0={};_0x28b9b0['model']=_[_0xafe4('0x31')](db[_0xafe4('0x2c')][_0xafe4('0x2d')]);_0x28b9b0[_0xafe4('0x30')]=_[_0xafe4('0x31')](_0x550da5[_0xafe4('0x30')]);_0x28b9b0[_0xafe4('0x3b')]=_[_0xafe4('0x32')](_0x28b9b0[_0xafe4('0x2f')],_0x28b9b0[_0xafe4('0x30')]);_0x17cf78[_0xafe4('0x33')]=_[_0xafe4('0x32')](_0x28b9b0['model'],qs[_0xafe4('0x34')](_0x550da5[_0xafe4('0x30')][_0xafe4('0x34')]));_0x17cf78[_0xafe4('0x33')]=_0x17cf78[_0xafe4('0x33')]['length']?_0x17cf78['attributes']:_0x28b9b0[_0xafe4('0x2f')];if(_0x550da5[_0xafe4('0x30')][_0xafe4('0x41')]){_0x17cf78[_0xafe4('0x42')]=[{'all':!![]}];}_0x17cf78=_['merge']({},_0x17cf78,_0x550da5[_0xafe4('0x40')]);return db[_0xafe4('0x2c')]['find'](_0x17cf78)[_0xafe4('0x24')](handleEntityNotFound(_0x481751,null))[_0xafe4('0x24')](respondWithResult(_0x481751,null))[_0xafe4('0x45')](handleError(_0x481751,null));};exports[_0xafe4('0x48')]=function(_0x563f3f,_0x27c20b){return db['WhatsappTransferReport'][_0xafe4('0x48')](_0x563f3f[_0xafe4('0x49')],{})[_0xafe4('0x24')](respondWithResult(_0x27c20b,0xc9))[_0xafe4('0x45')](handleError(_0x27c20b,null));};exports[_0xafe4('0x4a')]=function(_0x551a79,_0x5527b6){if(_0x551a79['body']['id']){delete _0x551a79[_0xafe4('0x49')]['id'];}return db[_0xafe4('0x2c')][_0xafe4('0x4b')]({'where':{'id':_0x551a79[_0xafe4('0x47')]['id']}})[_0xafe4('0x24')](handleEntityNotFound(_0x5527b6,null))['then'](saveUpdates(_0x551a79[_0xafe4('0x49')],null))[_0xafe4('0x24')](respondWithResult(_0x5527b6,null))[_0xafe4('0x45')](handleError(_0x5527b6,null));};exports[_0xafe4('0x25')]=function(_0x2c7cf0,_0x2555ed){return db[_0xafe4('0x2c')][_0xafe4('0x4b')]({'where':{'id':_0x2c7cf0[_0xafe4('0x47')]['id']}})[_0xafe4('0x24')](handleEntityNotFound(_0x2555ed,null))[_0xafe4('0x24')](removeEntity(_0x2555ed,null))[_0xafe4('0x45')](handleError(_0x2555ed,null));};exports[_0xafe4('0x4c')]=function(_0x255b1e,_0x74ff38){return db[_0xafe4('0x2c')][_0xafe4('0x4c')]()[_0xafe4('0x24')](respondWithResult(_0x74ff38,null))[_0xafe4('0x45')](handleError(_0x74ff38,null));}; \ No newline at end of file +var _0xb09a=['rimraf','zip-dir','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','WhatsappTransferReport','rawAttributes','fieldName','type','key','map','query','model','intersection','fields','attributes','length','hasOwnProperty','limit','sort','where','pick','filters','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','keys','options','create','body','find','params','describe','eml-format'];(function(_0x50e001,_0x45aa55){var _0x3fe4a2=function(_0x42dd11){while(--_0x42dd11){_0x50e001['push'](_0x50e001['shift']());}};_0x3fe4a2(++_0x45aa55);}(_0xb09a,0xe6));var _0xab09=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xb09a[_0x4565bf];return _0x5610ba;};'use strict';var emlformat=require(_0xab09('0x0'));var rimraf=require(_0xab09('0x1'));var zipdir=require(_0xab09('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xab09('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xab09('0x4'));var util=require(_0xab09('0x5'));var path=require(_0xab09('0x6'));var sox=require(_0xab09('0x7'));var csv=require(_0xab09('0x8'));var ejs=require(_0xab09('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xab09('0xa'));var squel=require(_0xab09('0xb'));var crypto=require(_0xab09('0xc'));var jsforce=require(_0xab09('0xd'));var deskjs=require(_0xab09('0xe'));var toCsv=require(_0xab09('0x8'));var querystring=require(_0xab09('0xf'));var Papa=require('papaparse');var Redis=require(_0xab09('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xab09('0x11'));var hardwareService=require(_0xab09('0x12'));var logger=require(_0xab09('0x13'))(_0xab09('0x14'));var utils=require(_0xab09('0x15'));var config=require(_0xab09('0x16'));var licenseUtil=require(_0xab09('0x17'));var db=require(_0xab09('0x18'))['db'];function respondWithStatusCode(_0x57a6a2,_0x14a71b){_0x14a71b=_0x14a71b||0xcc;return function(_0x300d4e){if(_0x300d4e){return _0x57a6a2['sendStatus'](_0x14a71b);}return _0x57a6a2[_0xab09('0x19')](_0x14a71b)[_0xab09('0x1a')]();};}function respondWithResult(_0x33dcbb,_0x9e1fc2){_0x9e1fc2=_0x9e1fc2||0xc8;return function(_0x19d400){if(_0x19d400){return _0x33dcbb[_0xab09('0x19')](_0x9e1fc2)[_0xab09('0x1b')](_0x19d400);}};}function respondWithFilteredResult(_0x5820dc,_0x55e27e){return function(_0x4eb632){if(_0x4eb632){var _0x4d2b61=typeof _0x55e27e[_0xab09('0x1c')]==='undefined'&&typeof _0x55e27e['limit']===_0xab09('0x1d');var _0x2b3c87=_0x4eb632[_0xab09('0x1e')];var _0x40f4a6=_0x4d2b61?0x0:_0x55e27e[_0xab09('0x1c')];var _0x536783=_0x4d2b61?_0x4eb632[_0xab09('0x1e')]:_0x55e27e[_0xab09('0x1c')]+_0x55e27e['limit'];var _0xcf9854;if(_0x536783>=_0x2b3c87){_0x536783=_0x2b3c87;_0xcf9854=0xc8;}else{_0xcf9854=0xce;}_0x5820dc[_0xab09('0x19')](_0xcf9854);return _0x5820dc['set'](_0xab09('0x1f'),_0x40f4a6+'-'+_0x536783+'/'+_0x2b3c87)[_0xab09('0x1b')](_0x4eb632);}return null;};}function patchUpdates(_0x3948e7){return function(_0x34824a){try{jsonpatch[_0xab09('0x20')](_0x34824a,_0x3948e7,!![]);}catch(_0x3ff2ca){return BPromise[_0xab09('0x21')](_0x3ff2ca);}return _0x34824a[_0xab09('0x22')]();};}function saveUpdates(_0x1aa550,_0xb4ebf2){return function(_0x67fdad){if(_0x67fdad){return _0x67fdad[_0xab09('0x23')](_0x1aa550)[_0xab09('0x24')](function(_0x42fcfb){return _0x42fcfb;});}return null;};}function removeEntity(_0x2dd785,_0x301560){return function(_0x5b5aec){if(_0x5b5aec){return _0x5b5aec[_0xab09('0x25')]()[_0xab09('0x24')](function(){_0x2dd785['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x55937d,_0x114060){return function(_0xb674d0){if(!_0xb674d0){_0x55937d[_0xab09('0x26')](0x194);}return _0xb674d0;};}function handleError(_0x1743c3,_0xebb0cf){_0xebb0cf=_0xebb0cf||0x1f4;return function(_0x3bbd4a){logger[_0xab09('0x27')](_0x3bbd4a[_0xab09('0x28')]);if(_0x3bbd4a[_0xab09('0x29')]){delete _0x3bbd4a['name'];}_0x1743c3[_0xab09('0x19')](_0xebb0cf)[_0xab09('0x2a')](_0x3bbd4a);};}exports[_0xab09('0x2b')]=function(_0x1010ce,_0x1fe627){var _0x7829e0={},_0x21c371={},_0x262949={'count':0x0,'rows':[]};var _0x45da9c=_['map'](db[_0xab09('0x2c')][_0xab09('0x2d')],function(_0x419a6f){return{'name':_0x419a6f[_0xab09('0x2e')],'type':_0x419a6f[_0xab09('0x2f')][_0xab09('0x30')]};});_0x21c371['model']=_[_0xab09('0x31')](_0x45da9c,_0xab09('0x29'));_0x21c371[_0xab09('0x32')]=_['keys'](_0x1010ce[_0xab09('0x32')]);_0x21c371['filters']=_['intersection'](_0x21c371[_0xab09('0x33')],_0x21c371[_0xab09('0x32')]);_0x7829e0['attributes']=_[_0xab09('0x34')](_0x21c371['model'],qs[_0xab09('0x35')](_0x1010ce[_0xab09('0x32')][_0xab09('0x35')]));_0x7829e0[_0xab09('0x36')]=_0x7829e0[_0xab09('0x36')][_0xab09('0x37')]?_0x7829e0[_0xab09('0x36')]:_0x21c371['model'];if(!_0x1010ce[_0xab09('0x32')][_0xab09('0x38')]('nolimit')){_0x7829e0[_0xab09('0x39')]=qs['limit'](_0x1010ce[_0xab09('0x32')][_0xab09('0x39')]);_0x7829e0[_0xab09('0x1c')]=qs[_0xab09('0x1c')](_0x1010ce[_0xab09('0x32')][_0xab09('0x1c')]);}_0x7829e0['order']=qs[_0xab09('0x3a')](_0x1010ce[_0xab09('0x32')]['sort']);_0x7829e0[_0xab09('0x3b')]=qs['filters'](_[_0xab09('0x3c')](_0x1010ce[_0xab09('0x32')],_0x21c371[_0xab09('0x3d')]),_0x45da9c);if(_0x1010ce['query']['filter']){_0x7829e0[_0xab09('0x3b')]=_[_0xab09('0x3e')](_0x7829e0[_0xab09('0x3b')],{'$or':_[_0xab09('0x31')](_0x45da9c,function(_0x369f69){if(_0x369f69[_0xab09('0x2f')]!==_0xab09('0x3f')){var _0x506f96={};_0x506f96[_0x369f69['name']]={'$like':'%'+_0x1010ce[_0xab09('0x32')]['filter']+'%'};return _0x506f96;}})});}_0x7829e0=_['merge']({},_0x7829e0,_0x1010ce['options']);var _0x1856e2={'where':_0x7829e0[_0xab09('0x3b')]};return db[_0xab09('0x2c')][_0xab09('0x1e')](_0x1856e2)[_0xab09('0x24')](function(_0x2f8406){_0x262949[_0xab09('0x1e')]=_0x2f8406;if(_0x1010ce[_0xab09('0x32')][_0xab09('0x40')]){_0x7829e0[_0xab09('0x41')]=[{'all':!![]}];}return db['WhatsappTransferReport'][_0xab09('0x42')](_0x7829e0);})['then'](function(_0x54a260){_0x262949[_0xab09('0x43')]=_0x54a260;return _0x262949;})[_0xab09('0x24')](respondWithFilteredResult(_0x1fe627,_0x7829e0))[_0xab09('0x44')](handleError(_0x1fe627,null));};exports[_0xab09('0x45')]=function(_0x159347,_0x4f7542){var _0x1790ec={'raw':!![],'where':{'id':_0x159347['params']['id']}},_0x59cce7={};_0x59cce7[_0xab09('0x33')]=_['keys'](db[_0xab09('0x2c')][_0xab09('0x2d')]);_0x59cce7[_0xab09('0x32')]=_[_0xab09('0x46')](_0x159347['query']);_0x59cce7[_0xab09('0x3d')]=_[_0xab09('0x34')](_0x59cce7['model'],_0x59cce7[_0xab09('0x32')]);_0x1790ec[_0xab09('0x36')]=_[_0xab09('0x34')](_0x59cce7[_0xab09('0x33')],qs[_0xab09('0x35')](_0x159347[_0xab09('0x32')][_0xab09('0x35')]));_0x1790ec[_0xab09('0x36')]=_0x1790ec[_0xab09('0x36')]['length']?_0x1790ec['attributes']:_0x59cce7['model'];if(_0x159347[_0xab09('0x32')][_0xab09('0x40')]){_0x1790ec[_0xab09('0x41')]=[{'all':!![]}];}_0x1790ec=_[_0xab09('0x3e')]({},_0x1790ec,_0x159347[_0xab09('0x47')]);return db[_0xab09('0x2c')]['find'](_0x1790ec)[_0xab09('0x24')](handleEntityNotFound(_0x4f7542,null))[_0xab09('0x24')](respondWithResult(_0x4f7542,null))['catch'](handleError(_0x4f7542,null));};exports[_0xab09('0x48')]=function(_0x30a014,_0xf69e4a){return db[_0xab09('0x2c')][_0xab09('0x48')](_0x30a014[_0xab09('0x49')],{})['then'](respondWithResult(_0xf69e4a,0xc9))[_0xab09('0x44')](handleError(_0xf69e4a,null));};exports['update']=function(_0x239238,_0x48aa39){if(_0x239238['body']['id']){delete _0x239238[_0xab09('0x49')]['id'];}return db['WhatsappTransferReport'][_0xab09('0x4a')]({'where':{'id':_0x239238[_0xab09('0x4b')]['id']}})[_0xab09('0x24')](handleEntityNotFound(_0x48aa39,null))['then'](saveUpdates(_0x239238['body'],null))[_0xab09('0x24')](respondWithResult(_0x48aa39,null))[_0xab09('0x44')](handleError(_0x48aa39,null));};exports[_0xab09('0x25')]=function(_0x4954a2,_0x34c3d6){return db[_0xab09('0x2c')][_0xab09('0x4a')]({'where':{'id':_0x4954a2[_0xab09('0x4b')]['id']}})['then'](handleEntityNotFound(_0x34c3d6,null))[_0xab09('0x24')](removeEntity(_0x34c3d6,null))[_0xab09('0x44')](handleError(_0x34c3d6,null));};exports[_0xab09('0x4c')]=function(_0x2d0b0b,_0x410f2e){return db['WhatsappTransferReport']['describe']()['then'](respondWithResult(_0x410f2e,null))[_0xab09('0x44')](handleError(_0x410f2e,null));}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.model.js b/server/api/whatsappTransferReport/whatsappTransferReport.model.js index 41ab31a..2eda6a1 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 _0x8359=['../../config/environment','./whatsappTransferReport.attributes','exports','define','WhatsappTransferReport','report_whatsapp_transfer','uniqueid','lodash','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0x50bf5a,_0x807bba){var _0x4ddc1d=function(_0x349a61){while(--_0x349a61){_0x50bf5a['push'](_0x50bf5a['shift']());}};_0x4ddc1d(++_0x807bba);}(_0x8359,0x149));var _0x9835=function(_0x417955,_0x4ed8c8){_0x417955=_0x417955-0x0;var _0x3a94ef=_0x8359[_0x417955];return _0x3a94ef;};'use strict';var _=require(_0x9835('0x0'));var util=require('util');var logger=require(_0x9835('0x1'))(_0x9835('0x2'));var moment=require(_0x9835('0x3'));var BPromise=require('bluebird');var rp=require(_0x9835('0x4'));var fs=require('fs');var path=require(_0x9835('0x5'));var rimraf=require(_0x9835('0x6'));var config=require(_0x9835('0x7'));var attributes=require(_0x9835('0x8'));module[_0x9835('0x9')]=function(_0xe4acab,_0x49d0e2){return _0xe4acab[_0x9835('0xa')](_0x9835('0xb'),attributes,{'tableName':_0x9835('0xc'),'paranoid':![],'indexes':[{'name':_0x9835('0xd'),'fields':[_0x9835('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xed9e=['lodash','../../config/logger','bluebird','path','../../config/environment','./whatsappTransferReport.attributes','exports','report_whatsapp_transfer','uniqueid'];(function(_0x178a27,_0x61d989){var _0x455a43=function(_0x41df54){while(--_0x41df54){_0x178a27['push'](_0x178a27['shift']());}};_0x455a43(++_0x61d989);}(_0xed9e,0xab));var _0xeed9=function(_0x2a24b3,_0x3f4ef2){_0x2a24b3=_0x2a24b3-0x0;var _0x2d9039=_0xed9e[_0x2a24b3];return _0x2d9039;};'use strict';var _=require(_0xeed9('0x0'));var util=require('util');var logger=require(_0xeed9('0x1'))('api');var moment=require('moment');var BPromise=require(_0xeed9('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xeed9('0x3'));var rimraf=require('rimraf');var config=require(_0xeed9('0x4'));var attributes=require(_0xeed9('0x5'));module[_0xeed9('0x6')]=function(_0x154640,_0x3b1659){return _0x154640['define']('WhatsappTransferReport',attributes,{'tableName':_0xeed9('0x7'),'paranoid':![],'indexes':[{'name':_0xeed9('0x8'),'fields':[_0xeed9('0x8')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js b/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js index c4d05cb..a776481 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 _0x5c91=['info','WhatsappTransferReport,\x20%s,\x20%s','debug','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','request','then'];(function(_0x29b902,_0x4baa6f){var _0x34d0f6=function(_0x37a2cf){while(--_0x37a2cf){_0x29b902['push'](_0x29b902['shift']());}};_0x34d0f6(++_0x4baa6f);}(_0x5c91,0x113));var _0x15c9=function(_0x4af815,_0x22f3e9){_0x4af815=_0x4af815-0x0;var _0x5dec4f=_0x5c91[_0x4af815];return _0x5dec4f;};'use strict';var _=require(_0x15c9('0x0'));var util=require(_0x15c9('0x1'));var moment=require(_0x15c9('0x2'));var BPromise=require(_0x15c9('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x15c9('0x4'));var db=require(_0x15c9('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x15c9('0x6'))(_0x15c9('0x7'));var config=require(_0x15c9('0x8'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1a2271,_0x50bf4c,_0x1b8b83){return new BPromise(function(_0x1527dc,_0x103c18){return client[_0x15c9('0x9')](_0x1a2271,_0x1b8b83)[_0x15c9('0xa')](function(_0x3a54d2){logger[_0x15c9('0xb')](_0x15c9('0xc'),_0x50bf4c,'request\x20sent');logger[_0x15c9('0xd')](_0x15c9('0xe'),_0x50bf4c,_0x15c9('0xf'),JSON[_0x15c9('0x10')](_0x3a54d2));if(_0x3a54d2['error']){if(_0x3a54d2[_0x15c9('0x11')][_0x15c9('0x12')]===0x1f4){logger[_0x15c9('0x11')](_0x15c9('0xc'),_0x50bf4c,_0x3a54d2[_0x15c9('0x11')][_0x15c9('0x13')]);return _0x103c18(_0x3a54d2[_0x15c9('0x11')][_0x15c9('0x13')]);}logger[_0x15c9('0x11')]('WhatsappTransferReport,\x20%s,\x20%s',_0x50bf4c,_0x3a54d2[_0x15c9('0x11')][_0x15c9('0x13')]);return _0x1527dc(_0x3a54d2['error'][_0x15c9('0x13')]);}else{logger[_0x15c9('0xb')](_0x15c9('0xc'),_0x50bf4c,'request\x20sent');_0x1527dc(_0x3a54d2[_0x15c9('0x14')][_0x15c9('0x13')]);}})[_0x15c9('0x15')](function(_0x33be7a){logger[_0x15c9('0x11')]('WhatsappTransferReport,\x20%s,\x20%s',_0x50bf4c,_0x33be7a);_0x103c18(_0x33be7a);});});} \ No newline at end of file +var _0x8948=['randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','then','WhatsappTransferReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','moment','bluebird'];(function(_0x279d37,_0x14de3f){var _0x530173=function(_0x37fc79){while(--_0x37fc79){_0x279d37['push'](_0x279d37['shift']());}};_0x530173(++_0x14de3f);}(_0x8948,0x13d));var _0x8894=function(_0x109832,_0x347896){_0x109832=_0x109832-0x0;var _0x15e8f4=_0x8948[_0x109832];return _0x15e8f4;};'use strict';var _=require(_0x8894('0x0'));var util=require('util');var moment=require(_0x8894('0x1'));var BPromise=require(_0x8894('0x2'));var rs=require(_0x8894('0x3'));var fs=require('fs');var Redis=require(_0x8894('0x4'));var db=require(_0x8894('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x8894('0x6'));var config=require(_0x8894('0x7'));var jayson=require(_0x8894('0x8'));var client=jayson[_0x8894('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x272e99,_0x26ccc2,_0x5a7918){return new BPromise(function(_0x5beb5d,_0x2cda8f){return client['request'](_0x272e99,_0x5a7918)[_0x8894('0xa')](function(_0x486e19){logger['info'](_0x8894('0xb'),_0x26ccc2,_0x8894('0xc'));logger[_0x8894('0xd')](_0x8894('0xe'),_0x26ccc2,_0x8894('0xc'),JSON[_0x8894('0xf')](_0x486e19));if(_0x486e19['error']){if(_0x486e19['error']['code']===0x1f4){logger[_0x8894('0x10')](_0x8894('0xb'),_0x26ccc2,_0x486e19[_0x8894('0x10')][_0x8894('0x11')]);return _0x2cda8f(_0x486e19[_0x8894('0x10')][_0x8894('0x11')]);}logger[_0x8894('0x10')](_0x8894('0xb'),_0x26ccc2,_0x486e19[_0x8894('0x10')][_0x8894('0x11')]);return _0x5beb5d(_0x486e19[_0x8894('0x10')][_0x8894('0x11')]);}else{logger['info'](_0x8894('0xb'),_0x26ccc2,_0x8894('0xc'));_0x5beb5d(_0x486e19[_0x8894('0x12')][_0x8894('0x11')]);}})[_0x8894('0x13')](function(_0x57d1f8){logger[_0x8894('0x10')]('WhatsappTransferReport,\x20%s,\x20%s',_0x26ccc2,_0x57d1f8);_0x2cda8f(_0x57d1f8);});});} \ No newline at end of file diff --git a/server/app.js b/server/app.js index ec425f7..a89d1c4 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe486=['status','join','None','default','catch','error','exit','lodash','./mysqldb','./config/environment','./config/logger','app','./config/pm2','./config/pm2/config','./config/schedule','./config/schedule/chat','./config/schedule/whatsapp','./config/schedule/transcribe','sync','listen','then','info','start','Online\x20apps:','map','filter','online','name','Offline\x20apps:'];(function(_0x1c43ac,_0x45465c){var _0xe3170d=function(_0x21eef0){while(--_0x21eef0){_0x1c43ac['push'](_0x1c43ac['shift']());}};_0xe3170d(++_0x45465c);}(_0xe486,0x180));var _0x6e48=function(_0x2416b9,_0x313d5d){_0x2416b9=_0x2416b9-0x0;var _0x9eefeb=_0xe486[_0x2416b9];return _0x9eefeb;};'use strict';var _=require(_0x6e48('0x0'));var mysqldb=require(_0x6e48('0x1'));var rpc=require('./rpc');var config=require(_0x6e48('0x2'));var logger=require(_0x6e48('0x3'))(_0x6e48('0x4'));var pm2=require(_0x6e48('0x5'));var pm2Config=require(_0x6e48('0x6'));var schedule=require(_0x6e48('0x7'));var chat=require(_0x6e48('0x8'));var whatsapp=require(_0x6e48('0x9'));var transcribe=require(_0x6e48('0xa'));function main(){return mysqldb['db']['sequelize'][_0x6e48('0xb')]()['then'](function(){return rpc[_0x6e48('0xc')]();})[_0x6e48('0xd')](function(_0x35cad1){logger[_0x6e48('0xe')](_0x35cad1);return chat[_0x6e48('0xf')]();})[_0x6e48('0xd')](function(){return whatsapp['start']();})[_0x6e48('0xd')](function(){return schedule[_0x6e48('0xf')]();})[_0x6e48('0xd')](function(){return transcribe[_0x6e48('0xf')]();})[_0x6e48('0xd')](function(_0x100d1f){logger[_0x6e48('0xe')](_0x100d1f);return pm2[_0x6e48('0xf')](pm2Config);})[_0x6e48('0xd')](function(_0x44df17){logger['info'](_0x6e48('0x10'),_[_0x6e48('0x11')](_[_0x6e48('0x12')](_0x44df17,{'status':_0x6e48('0x13')}),_0x6e48('0x14'))['join']());logger[_0x6e48('0xe')](_0x6e48('0x15'),_['map'](_[_0x6e48('0x12')](_0x44df17,function(_0x12b9fa){return _0x12b9fa[_0x6e48('0x16')]!==_0x6e48('0x13');}),_0x6e48('0x14'))[_0x6e48('0x17')]()||_0x6e48('0x18'));config['seedDB']&&require('./config/seedDB')[_0x6e48('0x19')]();require('./config/license')['default']();})[_0x6e48('0x1a')](function(_0x2f9ee7){logger[_0x6e48('0x1b')]('Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s',_0x2f9ee7);process[_0x6e48('0x1c')](0x1);});}main(); \ No newline at end of file +var _0xfa63=['default','./config/license','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','lodash','./mysqldb','./rpc','./config/environment','./config/logger','./config/pm2','./config/pm2/config','./config/schedule','./config/schedule/chat','./config/schedule/whatsapp','./config/schedule/transcribe','sync','listen','then','start','info','map','filter','online','name','join','Offline\x20apps:','status','None','seedDB'];(function(_0x40ac5e,_0x2de228){var _0x2839d6=function(_0x123d47){while(--_0x123d47){_0x40ac5e['push'](_0x40ac5e['shift']());}};_0x2839d6(++_0x2de228);}(_0xfa63,0xcf));var _0x3fa6=function(_0x38525f,_0x405f77){_0x38525f=_0x38525f-0x0;var _0x5e4cf6=_0xfa63[_0x38525f];return _0x5e4cf6;};'use strict';var _=require(_0x3fa6('0x0'));var mysqldb=require(_0x3fa6('0x1'));var rpc=require(_0x3fa6('0x2'));var config=require(_0x3fa6('0x3'));var logger=require(_0x3fa6('0x4'))('app');var pm2=require(_0x3fa6('0x5'));var pm2Config=require(_0x3fa6('0x6'));var schedule=require(_0x3fa6('0x7'));var chat=require(_0x3fa6('0x8'));var whatsapp=require(_0x3fa6('0x9'));var transcribe=require(_0x3fa6('0xa'));function main(){return mysqldb['db']['sequelize'][_0x3fa6('0xb')]()['then'](function(){return rpc[_0x3fa6('0xc')]();})[_0x3fa6('0xd')](function(_0x418098){logger['info'](_0x418098);return chat['start']();})[_0x3fa6('0xd')](function(){return whatsapp[_0x3fa6('0xe')]();})[_0x3fa6('0xd')](function(){return schedule['start']();})[_0x3fa6('0xd')](function(){return transcribe[_0x3fa6('0xe')]();})[_0x3fa6('0xd')](function(_0x5a2176){logger['info'](_0x5a2176);return pm2['start'](pm2Config);})[_0x3fa6('0xd')](function(_0x21e535){logger[_0x3fa6('0xf')]('Online\x20apps:',_[_0x3fa6('0x10')](_[_0x3fa6('0x11')](_0x21e535,{'status':_0x3fa6('0x12')}),_0x3fa6('0x13'))[_0x3fa6('0x14')]());logger['info'](_0x3fa6('0x15'),_[_0x3fa6('0x10')](_[_0x3fa6('0x11')](_0x21e535,function(_0x3af9f9){return _0x3af9f9[_0x3fa6('0x16')]!==_0x3fa6('0x12');}),_0x3fa6('0x13'))[_0x3fa6('0x14')]()||_0x3fa6('0x17'));config[_0x3fa6('0x18')]&&require('./config/seedDB')[_0x3fa6('0x19')]();require(_0x3fa6('0x1a'))[_0x3fa6('0x19')]();})['catch'](function(_0x2e32a3){logger[_0x3fa6('0x1b')](_0x3fa6('0x1c'),_0x2e32a3);process['exit'](0x1);});}main(); \ No newline at end of file diff --git a/server/components/auth/service.js b/server/components/auth/service.js index 5299f38..d88d46d 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 _0x6ae3=['User','name','pass','Wrong\x20credentials.','Unknown\x20authorization\x20format','query','apikey','getUuid','find','findOne','blockDuration','apiKeyNonce','Invalid\x20API\x20access\x20key','blocked','blockedAt','add','minutes','canUpdate','getLicense','update','Forbidden','isMiddleware','signToken','role','cookie','motion.token','redirect','/dashboards/general','send','isNil','apiKeyIat','generateApiKey','regenerateApiKey','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','split','toLowerCase','format','The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','updatePasswordsHistory','unshift','encryptString','join','promisify','payload','options','verify','secrets','randomBytes','hex','floor','toString','HS512','../../mysqldb','../../config/license/hardware','../encryptor','lodash','jsonwebtoken','express-jwt','composable-middleware','basic-auth','bluebird','moment','session','fullname','internal','email','userpic','md5secret','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','pauseType','showWebBar','crudPermissions','passwordResetAt','alias','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarExpires','phoneBarRemoteControl','phoneBarRemoteControlPort','interface','privacyEnabled','settingsEnabled','wssPort','downloadOmnichannelInteractions','downloadAttachments','use','user','ChatInteraction','params','closed','disposition','then','status','unmanaged','json','Unmanaged.','Forbidden.','catch','isAuthenticated','headers','authorization','startsWith'];(function(_0x9cd9fb,_0x25338c){var _0x207fcd=function(_0x24b005){while(--_0x24b005){_0x9cd9fb['push'](_0x9cd9fb['shift']());}};_0x207fcd(++_0x25338c);}(_0x6ae3,0x127));var _0x36ae=function(_0x5dd56a,_0x3ab71b){_0x5dd56a=_0x5dd56a-0x0;var _0x22fb2b=_0x6ae3[_0x5dd56a];return _0x22fb2b;};'use strict';var db=require(_0x36ae('0x0'))['db'];var config=require('../../config/environment');var hardwareConf=require(_0x36ae('0x1'));var licenseUtil=require('../../config/license/util');var encryptor=require(_0x36ae('0x2'));var _=require(_0x36ae('0x3'));var jwt=require(_0x36ae('0x4'));var expressJwt=require(_0x36ae('0x5'));var compose=require(_0x36ae('0x6'));var basicAuth=require(_0x36ae('0x7'));var crypto=require('crypto');var BPromise=require(_0x36ae('0x8'));var util=require('util');var moment=require(_0x36ae('0x9'));var validateJwt=expressJwt({'secret':config['secrets'][_0x36ae('0xa')]});var userAttributes=['id','role',_0x36ae('0xb'),'name',_0x36ae('0xc'),_0x36ae('0xd'),_0x36ae('0xe'),'permissions',_0x36ae('0xf'),_0x36ae('0x10'),_0x36ae('0x11'),_0x36ae('0x12'),_0x36ae('0x13'),_0x36ae('0x14'),_0x36ae('0x15'),_0x36ae('0x16'),_0x36ae('0x17'),'lastLoginAt','lastPauseAt',_0x36ae('0x18'),'allowmessenger',_0x36ae('0x19'),_0x36ae('0x1a'),_0x36ae('0x1b'),_0x36ae('0x1c'),_0x36ae('0x1d'),_0x36ae('0x1e'),_0x36ae('0x1f'),_0x36ae('0x20'),_0x36ae('0x21'),'phoneBarPrefixRequired',_0x36ae('0x22'),_0x36ae('0x23'),'hotdesk',_0x36ae('0x24'),'userProfileId',_0x36ae('0x25'),_0x36ae('0x26'),_0x36ae('0x27'),'downloadVoiceRecordings',_0x36ae('0x28'),_0x36ae('0x29')];exports['isChatInteractionAuthorized']=function(){return this['isAuthenticated'](!![])[_0x36ae('0x2a')](function(_0x576345,_0x404041,_0x1f4bb9){if(_0x576345[_0x36ae('0x2b')]){_0x1f4bb9();}else{return db[_0x36ae('0x2c')]['findOne']({'where':{'id':_0x576345[_0x36ae('0x2d')]['id']},'attributes':['id',_0x36ae('0x2e'),_0x36ae('0x2f')],'raw':!![]})[_0x36ae('0x30')](function(_0xd96bc8){if(_0xd96bc8&&_0xd96bc8['closed']){return _0x404041[_0x36ae('0x31')](_0xd96bc8[_0x36ae('0x2f')]===_0x36ae('0x32')?0x195:0x193)[_0x36ae('0x33')]({'message':_0xd96bc8['disposition']===_0x36ae('0x32')?_0x36ae('0x34'):_0x36ae('0x35')});}else{_0x1f4bb9();}})[_0x36ae('0x36')](function(_0x157b17){_0x1f4bb9(_0x157b17);});}});};exports[_0x36ae('0x37')]=function isAuthenticated(_0x55215e){return compose()[_0x36ae('0x2a')](function(_0x510d28,_0x5f0110,_0x16b181){var _0x74f73d;if(_0x510d28[_0x36ae('0x38')][_0x36ae('0x39')]){if(_[_0x36ae('0x3a')](_0x510d28[_0x36ae('0x38')][_0x36ae('0x39')],'Basic')){var _0x24caf4=basicAuth(_0x510d28);db[_0x36ae('0x3b')]['find']({'where':{'name':_0x24caf4[_0x36ae('0x3c')]}})[_0x36ae('0x30')](function(_0xd19084){if(!_0xd19084||!_0xd19084['authenticate'](_0x24caf4[_0x36ae('0x3d')])){return _0x5f0110[_0x36ae('0x31')](0x191)['json']({'message':_0x36ae('0x3e')});}_0x510d28[_0x36ae('0x2b')]={'id':_0xd19084['id']};_0x16b181();})[_0x36ae('0x36')](function(_0x8881f2){_0x16b181(_0x8881f2);});}else if(_[_0x36ae('0x3a')](_0x510d28[_0x36ae('0x38')][_0x36ae('0x39')],'Bearer')){validateJwt(_0x510d28,_0x5f0110,_0x16b181);}else{if(_0x55215e){_0x16b181();}else{return _0x5f0110[_0x36ae('0x31')](0x193)[_0x36ae('0x33')]({'message':_0x36ae('0x3f')});}}}else if(_0x510d28[_0x36ae('0x40')][_0x36ae('0x41')]){try{var _0x3ef116={'audience':hardwareConf[_0x36ae('0x42')](),'issuer':hardwareConf[_0x36ae('0x42')]()};verifyJwt(_0x510d28['query'][_0x36ae('0x41')],_0x3ef116)[_0x36ae('0x30')](function(_0x965450){return db[_0x36ae('0x3b')][_0x36ae('0x43')]({'where':{'id':_0x965450['sub']}})[_0x36ae('0x30')](function(_0x37daee){_0x74f73d=_0x37daee;return db['Setting'][_0x36ae('0x44')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0x36ae('0x45')],'raw':!![]});})[_0x36ae('0x30')](function(_0x2eb834){if(!_0x74f73d||!_['isEqual'](_0x74f73d[_0x36ae('0x46')],_0x965450['nonce'])){return _0x5f0110[_0x36ae('0x31')](0x191)[_0x36ae('0x33')]({'message':'API\x20access\x20key\x20is\x20not\x20valid\x20anymore'});}if(_0x74f73d['disabled']){return _0x5f0110['status'](0x191)[_0x36ae('0x33')]({'message':_0x36ae('0x47')});}if(_0x74f73d[_0x36ae('0x48')]){if(_0x2eb834[_0x36ae('0x45')]>0x0){if(moment(_0x74f73d[_0x36ae('0x49')])[_0x36ae('0x4a')](_0x2eb834['blockDuration'],_0x36ae('0x4b'))>moment()){return _0x5f0110[_0x36ae('0x31')](0x191)['json']({'message':_0x36ae('0x47')});}}else{return _0x5f0110[_0x36ae('0x31')](0x191)['json']({'message':'Invalid\x20API\x20access\x20key'});}}_0x510d28[_0x36ae('0x2b')]={'id':_0x74f73d['id']};_0x16b181();});})[_0x36ae('0x36')](function(){return _0x5f0110['status'](0x191)[_0x36ae('0x33')]({'message':_0x36ae('0x47')});});}catch(_0x13db2b){_0x16b181(_0x13db2b);}}else if(_0x55215e){_0x16b181();}else{return _0x5f0110['status'](0x193)[_0x36ae('0x33')]({'message':'Unknown\x20authorization\x20format'});}})[_0x36ae('0x2a')](function(_0x534be7,_0x30db85,_0x577713){if(_0x534be7[_0x36ae('0x2b')]){db[_0x36ae('0x3b')][_0x36ae('0x43')]({'where':{'id':_0x534be7[_0x36ae('0x2b')]['id']},'attributes':userAttributes})[_0x36ae('0x30')](function(_0x7579b4){if(!_0x7579b4){return _0x30db85[_0x36ae('0x31')](0x194)[_0x36ae('0x33')]({'message':'User\x20not\x20found.'});}_0x534be7[_0x36ae('0x2b')]=_0x7579b4;_0x577713();})[_0x36ae('0x36')](function(_0x28e88d){_0x577713(_0x28e88d);});}else if(_0x55215e){_0x577713();}else{return _0x30db85['status'](0x194)[_0x36ae('0x33')]({'message':'User\x20object\x20not\x20found.'});}});};exports[_0x36ae('0x4c')]=function canUpdate(){return compose()[_0x36ae('0x2a')](function(_0xe7755d,_0x57eecc,_0xf44d59){return licenseUtil[_0x36ae('0x4d')]()['then'](function(_0x208173){if(_0x208173[_0x36ae('0x4e')]){_0xf44d59();}else{return _0x57eecc[_0x36ae('0x31')](0x193)[_0x36ae('0x33')]({'message':_0x36ae('0x4f')});}})['catch'](function(_0x44c7bb){_0xf44d59(_0x44c7bb);});});};exports[_0x36ae('0x50')]=function(_0x407440,_0x51303a,_0x469190){_0x407440[_0x36ae('0x50')]=!![];return _0x469190();};exports[_0x36ae('0x51')]=function signToken(_0x44b91f){return signJwt(_0x44b91f);};exports['setTokenCookie']=function(_0x4ee994,_0x4e5a16){if(!_0x4ee994[_0x36ae('0x2b')]){return _0x4e5a16['status'](0x194)[_0x36ae('0x33')]({'message':'It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.'});}var _0x535ab2={'payload':{'id':_0x4ee994[_0x36ae('0x2b')]['id'],'role':_0x4ee994[_0x36ae('0x2b')][_0x36ae('0x52')]},'options':{'expiresIn':0x15180}};return signJwt(_0x535ab2)[_0x36ae('0x30')](function(_0x376eed){_0x4e5a16[_0x36ae('0x53')](_0x36ae('0x54'),_0x376eed);_0x4e5a16[_0x36ae('0x55')](_0x36ae('0x56'));})[_0x36ae('0x36')](function(_0x244219){return _0x4e5a16[_0x36ae('0x31')](0x1f4)[_0x36ae('0x57')](_0x244219);});};exports['retrieveApiKey']=function(_0x4a2c7b){if(_['isNil'](_0x4a2c7b[_0x36ae('0x46')])||_[_0x36ae('0x58')](_0x4a2c7b[_0x36ae('0x59')])){return null;}else{return createJwt(_0x4a2c7b);}};exports[_0x36ae('0x5a')]=function(_0x3b633c){_0x3b633c[_0x36ae('0x46')]=generateNonce();_0x3b633c[_0x36ae('0x59')]=generateIssuedAt();return createJwt(_0x3b633c);};exports[_0x36ae('0x5b')]=function(_0x551ae5,_0x1fa4f6){var _0x1b2dd0=_0x551ae5['query']['apikey'];if(_0x1b2dd0){var _0x4ed47e={'nonce':_0x1fa4f6[_0x36ae('0x46')],'iat':_0x1fa4f6[_0x36ae('0x59')],'audience':hardwareConf[_0x36ae('0x42')](),'issuer':hardwareConf[_0x36ae('0x42')]()};return verifyJwt(_0x1b2dd0,_0x4ed47e)['then'](function(){return generateApiKey(_0x1fa4f6);});}else{throw{'message':_0x36ae('0x5c')};}};exports[_0x36ae('0x5d')]=function(_0x3a0eaf){var _0x3272cc=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x3272cc[_0x36ae('0x5e')](_0x3a0eaf))throw new db[(_0x36ae('0x5f'))][(_0x36ae('0x60'))](_0x36ae('0x61'));return;};exports['validatePasswordHistory']=function(_0xd14316,_0x28f481,_0x347d00){var _0x55bf51=encryptor[_0x36ae('0x62')](_0x28f481)[_0x36ae('0x63')](',');for(var _0x13003e=0x0;_0x13003e<_0x347d00;_0x13003e++){if(!_0x55bf51[_0x13003e])break;if(_0xd14316['toLowerCase']()===_0x55bf51[_0x13003e][_0x36ae('0x64')]()){var _0x582ad7=util[_0x36ae('0x65')](_0x36ae('0x66'),_0x347d00);if(_0x347d00===0x1){_0x582ad7=_0x36ae('0x67');}throw new db[(_0x36ae('0x5f'))][(_0x36ae('0x60'))](_0x582ad7);}}return;};exports[_0x36ae('0x68')]=function(_0x40f17b,_0x155148){var _0xac9f9e=_0x155148?encryptor[_0x36ae('0x62')](_0x155148)[_0x36ae('0x63')](','):[];if(_0xac9f9e['length']===0x5){_0xac9f9e['splice'](-0x1,0x1);}_0xac9f9e[_0x36ae('0x69')](_0x40f17b);return encryptor[_0x36ae('0x6a')](_0xac9f9e[_0x36ae('0x6b')](','));};function signJwt(_0x27f696){var _0x48650d=BPromise[_0x36ae('0x6c')](jwt['sign'],{'context':jwt});var _0x50001f=_0x27f696['secret']||config['secrets'][_0x36ae('0xa')];return new BPromise(function(_0x1103da,_0x50aeed){_0x48650d(_0x27f696[_0x36ae('0x6d')],_0x50001f,_0x27f696[_0x36ae('0x6e')])[_0x36ae('0x30')](function(_0x50fd2d){_0x1103da(_0x50fd2d);})[_0x36ae('0x36')](function(_0x4d9ca4){_0x50aeed(_0x4d9ca4);});});}function verifyJwt(_0x5ce592,_0x2c588f,_0x27482f){var _0x590a68=BPromise['promisify'](jwt[_0x36ae('0x6f')],{'context':jwt});var _0x4b4662=_0x27482f||config[_0x36ae('0x70')][_0x36ae('0xa')];return new BPromise(function(_0x5fb565,_0x5d5d4f){_0x590a68(_0x5ce592,_0x4b4662,_0x2c588f)[_0x36ae('0x30')](function(_0x32b351){_0x5fb565(_0x32b351);})[_0x36ae('0x36')](function(_0x420171){_0x5d5d4f(_0x420171);});});}function generateNonce(){return crypto[_0x36ae('0x71')](0x10)['toString'](_0x36ae('0x72'));}function generateIssuedAt(){return Math[_0x36ae('0x73')](Date['now']()/0x3e8)[_0x36ae('0x74')]();}function createJwt(_0x5c6051){var _0xdacfaf={'payload':{'iat':_0x5c6051[_0x36ae('0x59')],'nonce':_0x5c6051[_0x36ae('0x46')]},'options':{'algorithm':_0x36ae('0x75'),'subject':_0x5c6051['id'][_0x36ae('0x74')](),'issuer':hardwareConf[_0x36ae('0x42')](),'audience':hardwareConf[_0x36ae('0x42')]()}};return signJwt(_0xdacfaf)['then'](function(_0x19ef90){return{'iat':_0x5c6051[_0x36ae('0x59')],'nonce':_0x5c6051[_0x36ae('0x46')],'token':_0x19ef90};});} \ No newline at end of file +var _0xbcd5=['fullname','name','email','permissions','md5secret','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','showWebBar','lastLoginAt','lastPauseAt','crudPermissions','passwordResetAt','alias','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarExpires','phoneBarPrefixRequired','phoneBarRemoteControl','hotdesk','interface','privacyEnabled','settingsEnabled','wssPort','downloadAttachments','isChatInteractionAuthorized','isAuthenticated','use','user','ChatInteraction','params','closed','disposition','then','status','unmanaged','Forbidden.','catch','headers','authorization','Basic','find','pass','json','Wrong\x20credentials.','Bearer','Unknown\x20authorization\x20format','query','apikey','getUuid','User','sub','Setting','allowedLoginAttempts','isEqual','apiKeyNonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','Invalid\x20API\x20access\x20key','blockDuration','minutes','User\x20not\x20found.','User\x20object\x20not\x20found.','getLicense','update','Forbidden','isMiddleware','signToken','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','motion.token','redirect','/dashboards/general','send','retrieveApiKey','isNil','generateApiKey','apiKeyIat','regenerateApiKey','validatePasswordPattern','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','validatePasswordHistory','split','toLowerCase','format','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','updatePasswordsHistory','decryptString','splice','unshift','encryptString','join','promisify','sign','secret','payload','options','verify','randomBytes','now','toString','HS512','../../mysqldb','../../config/environment','../../config/license/util','lodash','jsonwebtoken','express-jwt','basic-auth','crypto','bluebird','util','moment','secrets','session','role'];(function(_0x4ee634,_0x328075){var _0x3b8710=function(_0x3e303e){while(--_0x3e303e){_0x4ee634['push'](_0x4ee634['shift']());}};_0x3b8710(++_0x328075);}(_0xbcd5,0x15d));var _0x5bcd=function(_0x1d24eb,_0x12295b){_0x1d24eb=_0x1d24eb-0x0;var _0x1dc576=_0xbcd5[_0x1d24eb];return _0x1dc576;};'use strict';var db=require(_0x5bcd('0x0'))['db'];var config=require(_0x5bcd('0x1'));var hardwareConf=require('../../config/license/hardware');var licenseUtil=require(_0x5bcd('0x2'));var encryptor=require('../encryptor');var _=require(_0x5bcd('0x3'));var jwt=require(_0x5bcd('0x4'));var expressJwt=require(_0x5bcd('0x5'));var compose=require('composable-middleware');var basicAuth=require(_0x5bcd('0x6'));var crypto=require(_0x5bcd('0x7'));var BPromise=require(_0x5bcd('0x8'));var util=require(_0x5bcd('0x9'));var moment=require(_0x5bcd('0xa'));var validateJwt=expressJwt({'secret':config[_0x5bcd('0xb')][_0x5bcd('0xc')]});var userAttributes=['id',_0x5bcd('0xd'),_0x5bcd('0xe'),_0x5bcd('0xf'),'internal',_0x5bcd('0x10'),'userpic',_0x5bcd('0x11'),_0x5bcd('0x12'),_0x5bcd('0x13'),_0x5bcd('0x14'),_0x5bcd('0x15'),_0x5bcd('0x16'),_0x5bcd('0x17'),_0x5bcd('0x18'),'pauseType',_0x5bcd('0x19'),_0x5bcd('0x1a'),_0x5bcd('0x1b'),_0x5bcd('0x1c'),'allowmessenger',_0x5bcd('0x1d'),_0x5bcd('0x1e'),_0x5bcd('0x1f'),_0x5bcd('0x20'),'phoneBarDnd','phoneBarEnableRecording',_0x5bcd('0x21'),_0x5bcd('0x22'),_0x5bcd('0x23'),_0x5bcd('0x24'),_0x5bcd('0x25'),'phoneBarRemoteControlPort',_0x5bcd('0x26'),_0x5bcd('0x27'),'userProfileId',_0x5bcd('0x28'),_0x5bcd('0x29'),_0x5bcd('0x2a'),'downloadVoiceRecordings','downloadOmnichannelInteractions',_0x5bcd('0x2b')];exports[_0x5bcd('0x2c')]=function(){return this[_0x5bcd('0x2d')](!![])[_0x5bcd('0x2e')](function(_0x3085dc,_0x7bfea9,_0x13e838){if(_0x3085dc[_0x5bcd('0x2f')]){_0x13e838();}else{return db[_0x5bcd('0x30')]['findOne']({'where':{'id':_0x3085dc[_0x5bcd('0x31')]['id']},'attributes':['id',_0x5bcd('0x32'),_0x5bcd('0x33')],'raw':!![]})[_0x5bcd('0x34')](function(_0x4d6975){if(_0x4d6975&&_0x4d6975[_0x5bcd('0x32')]){return _0x7bfea9[_0x5bcd('0x35')](_0x4d6975['disposition']===_0x5bcd('0x36')?0x195:0x193)['json']({'message':_0x4d6975['disposition']===_0x5bcd('0x36')?'Unmanaged.':_0x5bcd('0x37')});}else{_0x13e838();}})[_0x5bcd('0x38')](function(_0x2fdb59){_0x13e838(_0x2fdb59);});}});};exports[_0x5bcd('0x2d')]=function isAuthenticated(_0x102d4a){return compose()['use'](function(_0x3fa9ef,_0x7a19c8,_0xec3cc5){var _0x4ed4f8;if(_0x3fa9ef[_0x5bcd('0x39')]['authorization']){if(_['startsWith'](_0x3fa9ef['headers'][_0x5bcd('0x3a')],_0x5bcd('0x3b'))){var _0x57b83a=basicAuth(_0x3fa9ef);db['User'][_0x5bcd('0x3c')]({'where':{'name':_0x57b83a[_0x5bcd('0xf')]}})['then'](function(_0x295448){if(!_0x295448||!_0x295448['authenticate'](_0x57b83a[_0x5bcd('0x3d')])){return _0x7a19c8[_0x5bcd('0x35')](0x191)[_0x5bcd('0x3e')]({'message':_0x5bcd('0x3f')});}_0x3fa9ef['user']={'id':_0x295448['id']};_0xec3cc5();})['catch'](function(_0x71e172){_0xec3cc5(_0x71e172);});}else if(_['startsWith'](_0x3fa9ef[_0x5bcd('0x39')][_0x5bcd('0x3a')],_0x5bcd('0x40'))){validateJwt(_0x3fa9ef,_0x7a19c8,_0xec3cc5);}else{if(_0x102d4a){_0xec3cc5();}else{return _0x7a19c8[_0x5bcd('0x35')](0x193)[_0x5bcd('0x3e')]({'message':_0x5bcd('0x41')});}}}else if(_0x3fa9ef[_0x5bcd('0x42')][_0x5bcd('0x43')]){try{var _0x4722d4={'audience':hardwareConf['getUuid'](),'issuer':hardwareConf[_0x5bcd('0x44')]()};verifyJwt(_0x3fa9ef['query'][_0x5bcd('0x43')],_0x4722d4)['then'](function(_0x526b4d){return db[_0x5bcd('0x45')][_0x5bcd('0x3c')]({'where':{'id':_0x526b4d[_0x5bcd('0x46')]}})['then'](function(_0x1035a5){_0x4ed4f8=_0x1035a5;return db[_0x5bcd('0x47')]['findOne']({'where':{'id':0x1},'attributes':[_0x5bcd('0x48'),'blockDuration'],'raw':!![]});})[_0x5bcd('0x34')](function(_0x2af464){if(!_0x4ed4f8||!_[_0x5bcd('0x49')](_0x4ed4f8[_0x5bcd('0x4a')],_0x526b4d['nonce'])){return _0x7a19c8['status'](0x191)[_0x5bcd('0x3e')]({'message':_0x5bcd('0x4b')});}if(_0x4ed4f8['disabled']){return _0x7a19c8[_0x5bcd('0x35')](0x191)[_0x5bcd('0x3e')]({'message':_0x5bcd('0x4c')});}if(_0x4ed4f8['blocked']){if(_0x2af464[_0x5bcd('0x4d')]>0x0){if(moment(_0x4ed4f8['blockedAt'])['add'](_0x2af464[_0x5bcd('0x4d')],_0x5bcd('0x4e'))>moment()){return _0x7a19c8[_0x5bcd('0x35')](0x191)[_0x5bcd('0x3e')]({'message':'Invalid\x20API\x20access\x20key'});}}else{return _0x7a19c8[_0x5bcd('0x35')](0x191)[_0x5bcd('0x3e')]({'message':'Invalid\x20API\x20access\x20key'});}}_0x3fa9ef[_0x5bcd('0x2f')]={'id':_0x4ed4f8['id']};_0xec3cc5();});})[_0x5bcd('0x38')](function(){return _0x7a19c8[_0x5bcd('0x35')](0x191)[_0x5bcd('0x3e')]({'message':_0x5bcd('0x4c')});});}catch(_0x13ed80){_0xec3cc5(_0x13ed80);}}else if(_0x102d4a){_0xec3cc5();}else{return _0x7a19c8[_0x5bcd('0x35')](0x193)[_0x5bcd('0x3e')]({'message':_0x5bcd('0x41')});}})[_0x5bcd('0x2e')](function(_0x260755,_0x2cc5ed,_0x171d68){if(_0x260755['user']){db['User'][_0x5bcd('0x3c')]({'where':{'id':_0x260755[_0x5bcd('0x2f')]['id']},'attributes':userAttributes})[_0x5bcd('0x34')](function(_0x34d9b3){if(!_0x34d9b3){return _0x2cc5ed[_0x5bcd('0x35')](0x194)['json']({'message':_0x5bcd('0x4f')});}_0x260755['user']=_0x34d9b3;_0x171d68();})[_0x5bcd('0x38')](function(_0xc4dc7a){_0x171d68(_0xc4dc7a);});}else if(_0x102d4a){_0x171d68();}else{return _0x2cc5ed[_0x5bcd('0x35')](0x194)[_0x5bcd('0x3e')]({'message':_0x5bcd('0x50')});}});};exports['canUpdate']=function canUpdate(){return compose()['use'](function(_0x24c55e,_0x551afd,_0x17355f){return licenseUtil[_0x5bcd('0x51')]()[_0x5bcd('0x34')](function(_0x3f3838){if(_0x3f3838[_0x5bcd('0x52')]){_0x17355f();}else{return _0x551afd['status'](0x193)[_0x5bcd('0x3e')]({'message':_0x5bcd('0x53')});}})[_0x5bcd('0x38')](function(_0x4cbbe3){_0x17355f(_0x4cbbe3);});});};exports['isMiddleware']=function(_0x1c0f6e,_0x52df6c,_0x3793ce){_0x1c0f6e[_0x5bcd('0x54')]=!![];return _0x3793ce();};exports[_0x5bcd('0x55')]=function signToken(_0x41ff98){return signJwt(_0x41ff98);};exports[_0x5bcd('0x56')]=function(_0x43f0bf,_0x2dd372){if(!_0x43f0bf[_0x5bcd('0x2f')]){return _0x2dd372[_0x5bcd('0x35')](0x194)[_0x5bcd('0x3e')]({'message':_0x5bcd('0x57')});}var _0x4628ac={'payload':{'id':_0x43f0bf[_0x5bcd('0x2f')]['id'],'role':_0x43f0bf['user'][_0x5bcd('0xd')]},'options':{'expiresIn':0x15180}};return signJwt(_0x4628ac)['then'](function(_0x276c77){_0x2dd372['cookie'](_0x5bcd('0x58'),_0x276c77);_0x2dd372[_0x5bcd('0x59')](_0x5bcd('0x5a'));})[_0x5bcd('0x38')](function(_0x579b72){return _0x2dd372['status'](0x1f4)[_0x5bcd('0x5b')](_0x579b72);});};exports[_0x5bcd('0x5c')]=function(_0x8cd8a5){if(_[_0x5bcd('0x5d')](_0x8cd8a5[_0x5bcd('0x4a')])||_[_0x5bcd('0x5d')](_0x8cd8a5['apiKeyIat'])){return null;}else{return createJwt(_0x8cd8a5);}};exports[_0x5bcd('0x5e')]=function(_0x1eed5a){_0x1eed5a[_0x5bcd('0x4a')]=generateNonce();_0x1eed5a[_0x5bcd('0x5f')]=generateIssuedAt();return createJwt(_0x1eed5a);};exports[_0x5bcd('0x60')]=function(_0x250570,_0x26eac4){var _0x29c02a=_0x250570[_0x5bcd('0x42')][_0x5bcd('0x43')];if(_0x29c02a){var _0x2e037a={'nonce':_0x26eac4[_0x5bcd('0x4a')],'iat':_0x26eac4['apiKeyIat'],'audience':hardwareConf[_0x5bcd('0x44')](),'issuer':hardwareConf[_0x5bcd('0x44')]()};return verifyJwt(_0x29c02a,_0x2e037a)[_0x5bcd('0x34')](function(){return generateApiKey(_0x26eac4);});}else{throw{'message':'Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one'};}};exports[_0x5bcd('0x61')]=function(_0x2befa8){var _0x53c844=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x53c844['test'](_0x2befa8))throw new db['Sequelize'][(_0x5bcd('0x62'))](_0x5bcd('0x63'));return;};exports[_0x5bcd('0x64')]=function(_0x3d43bc,_0x129eeb,_0xa4e821){var _0x263de2=encryptor['decryptString'](_0x129eeb)[_0x5bcd('0x65')](',');for(var _0x22ea37=0x0;_0x22ea37<_0xa4e821;_0x22ea37++){if(!_0x263de2[_0x22ea37])break;if(_0x3d43bc['toLowerCase']()===_0x263de2[_0x22ea37][_0x5bcd('0x66')]()){var _0x1fd239=util[_0x5bcd('0x67')]('The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.',_0xa4e821);if(_0xa4e821===0x1){_0x1fd239=_0x5bcd('0x68');}throw new db['Sequelize'][(_0x5bcd('0x62'))](_0x1fd239);}}return;};exports[_0x5bcd('0x69')]=function(_0x170842,_0x4d6077){var _0x4c0615=_0x4d6077?encryptor[_0x5bcd('0x6a')](_0x4d6077)[_0x5bcd('0x65')](','):[];if(_0x4c0615['length']===0x5){_0x4c0615[_0x5bcd('0x6b')](-0x1,0x1);}_0x4c0615[_0x5bcd('0x6c')](_0x170842);return encryptor[_0x5bcd('0x6d')](_0x4c0615[_0x5bcd('0x6e')](','));};function signJwt(_0x122f15){var _0x26b0d8=BPromise[_0x5bcd('0x6f')](jwt[_0x5bcd('0x70')],{'context':jwt});var _0x3072a4=_0x122f15[_0x5bcd('0x71')]||config['secrets'][_0x5bcd('0xc')];return new BPromise(function(_0x40d650,_0x1d3a4f){_0x26b0d8(_0x122f15[_0x5bcd('0x72')],_0x3072a4,_0x122f15[_0x5bcd('0x73')])[_0x5bcd('0x34')](function(_0xeab63f){_0x40d650(_0xeab63f);})['catch'](function(_0xb2c932){_0x1d3a4f(_0xb2c932);});});}function verifyJwt(_0xf9ef1d,_0x427d82,_0x42bdaa){var _0x218ba4=BPromise[_0x5bcd('0x6f')](jwt[_0x5bcd('0x74')],{'context':jwt});var _0xc40fef=_0x42bdaa||config[_0x5bcd('0xb')][_0x5bcd('0xc')];return new BPromise(function(_0x13672e,_0x2f814d){_0x218ba4(_0xf9ef1d,_0xc40fef,_0x427d82)[_0x5bcd('0x34')](function(_0x49ec30){_0x13672e(_0x49ec30);})[_0x5bcd('0x38')](function(_0xf3c968){_0x2f814d(_0xf3c968);});});}function generateNonce(){return crypto[_0x5bcd('0x75')](0x10)['toString']('hex');}function generateIssuedAt(){return Math['floor'](Date[_0x5bcd('0x76')]()/0x3e8)[_0x5bcd('0x77')]();}function createJwt(_0x29777a){var _0x23a080={'payload':{'iat':_0x29777a[_0x5bcd('0x5f')],'nonce':_0x29777a[_0x5bcd('0x4a')]},'options':{'algorithm':_0x5bcd('0x78'),'subject':_0x29777a['id'][_0x5bcd('0x77')](),'issuer':hardwareConf[_0x5bcd('0x44')](),'audience':hardwareConf[_0x5bcd('0x44')]()}};return signJwt(_0x23a080)[_0x5bcd('0x34')](function(_0x318139){return{'iat':_0x29777a[_0x5bcd('0x5f')],'nonce':_0x29777a[_0x5bcd('0x4a')],'token':_0x318139};});} \ No newline at end of file diff --git a/server/components/encryptor/index.js b/server/components/encryptor/index.js index a39b1d7..cbd7d54 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 _0x941f=['test','getCiphers','filter','indexOf','hasOwnProperty','encryptFile','createWriteStream','createCipher','data','binary','end','write','close','decryptFile','createReadStream','createDecipher','update','unlink','encryptString','secret','utf8','final','base64','crypto','bluebird','../../config/environment','../../config/logger','app','secrets','aes-256-ctr','aes192','encrypt','algorithm','join','error','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:'];(function(_0x4ef024,_0x3db22a){var _0x4314a7=function(_0x200041){while(--_0x200041){_0x4ef024['push'](_0x4ef024['shift']());}};_0x4314a7(++_0x3db22a);}(_0x941f,0x113));var _0xf941=function(_0x1bcb4b,_0x32fbe9){_0x1bcb4b=_0x1bcb4b-0x0;var _0x1c8c26=_0x941f[_0x1bcb4b];return _0x1c8c26;};'use strict';var crypto=require(_0xf941('0x0'));var fs=require('fs');var BPromise=require(_0xf941('0x1'));var _=require('lodash');var config=require(_0xf941('0x2'));var logger=require(_0xf941('0x3'))(_0xf941('0x4'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0xf941('0x5')]['session'],'algorithm':_0xf941('0x6')};const fileOptions={'algorithm':_0xf941('0x7')};if(config[_0xf941('0x8')]&&config[_0xf941('0x8')][_0xf941('0x9')]){var isSupported=isAlgorithmSupported(config[_0xf941('0x8')][_0xf941('0x9')]);if(isSupported){fileOptions[_0xf941('0x9')]=config[_0xf941('0x8')][_0xf941('0x9')];}else{var supportedAlgorithms=getSupportedCiphers()[_0xf941('0xa')](',\x20');logger[_0xf941('0xb')](config[_0xf941('0x8')][_0xf941('0x9')],_0xf941('0xc'),supportedAlgorithms);}}function isASupportedCipher(_0x6e2e60){return AES_SUPPORTED_RX[_0xf941('0xd')](_0x6e2e60);}function getSupportedCiphers(){return crypto[_0xf941('0xe')]()[_0xf941('0xf')](isASupportedCipher);}function isAlgorithmSupported(_0x28226c){return getSupportedCiphers()[_0xf941('0x10')](_0x28226c)>-0x1;}function combineOptions(_0x1c9aac){var _0xe50a13={};for(var _0x2f1196 in fileOptions){if(fileOptions[_0xf941('0x11')](_0x2f1196)){_0xe50a13[_0x2f1196]=fileOptions[_0x2f1196];}}if(_0x1c9aac){for(var _0x4f064a in _0x1c9aac){if(_0x1c9aac[_0xf941('0x11')](_0x4f064a)){_0xe50a13[_0x4f064a]=_0x1c9aac[_0x4f064a];}}}return _0xe50a13;}exports[_0xf941('0x12')]=function(_0x432dec,_0x483af6,_0x57777b,_0x52f03b){return new BPromise(function(_0x4f5afc,_0x1fffe3){_0x52f03b=combineOptions(_0x52f03b);var _0x5ddb12=new Buffer(_0x57777b);var _0x5e7e74=fs['createReadStream'](_0x432dec);var _0x48d04=fs[_0xf941('0x13')](_0x483af6);var _0x4cd2cb=crypto[_0xf941('0x14')](_0x52f03b[_0xf941('0x9')],_0x5ddb12);_0x5e7e74['on'](_0xf941('0x15'),function(_0x144bf2){var _0x5c13f6=new Buffer(_0x4cd2cb['update'](_0x144bf2),_0xf941('0x16'));_0x48d04['write'](_0x5c13f6);});_0x5e7e74['on'](_0xf941('0x17'),function(){try{var _0x4ae69c=new Buffer(_0x4cd2cb['final'](_0xf941('0x16')),_0xf941('0x16'));_0x48d04[_0xf941('0x18')](_0x4ae69c);_0x48d04[_0xf941('0x17')]();_0x48d04['on'](_0xf941('0x19'),function(){return _0x4f5afc(_0x483af6);});}catch(_0x301131){fs['unlink'](_0x483af6);return _0x1fffe3(_0x301131);}});});};exports[_0xf941('0x1a')]=function(_0x2eafa4,_0x18a3f2,_0x5855be,_0x54e9fb){return new BPromise(function(_0x285d11,_0x3b6857){_0x54e9fb=combineOptions(_0x54e9fb);var _0x122776=new Buffer(_0x5855be);var _0x255726=fs[_0xf941('0x1b')](_0x2eafa4);var _0x5c73de=fs[_0xf941('0x13')](_0x18a3f2);var _0x4a17ef=crypto[_0xf941('0x1c')](_0x54e9fb[_0xf941('0x9')],_0x122776);_0x255726['on'](_0xf941('0x15'),function(_0x13efb1){var _0xfb6606=new Buffer(_0x4a17ef[_0xf941('0x1d')](_0x13efb1),_0xf941('0x16'));_0x5c73de[_0xf941('0x18')](_0xfb6606);});_0x255726['on'](_0xf941('0x17'),function(){try{var _0x1c9f02=new Buffer(_0x4a17ef['final'](_0xf941('0x16')),'binary');_0x5c73de[_0xf941('0x18')](_0x1c9f02);_0x5c73de[_0xf941('0x17')]();_0x5c73de['on']('close',function(){return _0x285d11(_0x18a3f2);});}catch(_0x5c097d){fs[_0xf941('0x1e')](_0x18a3f2);return _0x3b6857(_0x5c097d);}});});};exports[_0xf941('0x1f')]=function(_0x142158,_0x327b4b,_0x2e6bd1){var _0x18353b=_0x2e6bd1||stringOptions[_0xf941('0x9')];var _0x4744fa=_0x327b4b||stringOptions[_0xf941('0x20')];var _0x48e43b=crypto[_0xf941('0x14')](_0x18353b,_0x4744fa);var _0x5882dc=_0x48e43b[_0xf941('0x1d')](_0x142158,_0xf941('0x21'),'base64');_0x5882dc+=_0x48e43b[_0xf941('0x22')](_0xf941('0x23'));return _0x5882dc;};exports['decryptString']=function(_0x14b656,_0x1a2ad3,_0x32be6e){var _0x574794=_0x32be6e||stringOptions[_0xf941('0x9')];var _0x100467=_0x1a2ad3||stringOptions['secret'];var _0x1a592c=crypto[_0xf941('0x1c')](_0x574794,_0x100467);var _0x29f739=_0x1a592c['update'](_0x14b656,_0xf941('0x23'),'utf8');_0x29f739+=_0x1a592c[_0xf941('0x22')]('utf8');return _0x29f739;}; \ No newline at end of file +var _0x5ee6=['end','final','binary','close','unlink','decryptFile','createDecipher','utf8','base64','decryptString','secret','crypto','lodash','../../config/environment','../../config/logger','app','secrets','session','aes192','encrypt','algorithm','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','test','getCiphers','filter','indexOf','hasOwnProperty','encryptFile','createReadStream','createWriteStream','createCipher','data','update','write'];(function(_0x3547d7,_0x31561a){var _0x32fb3c=function(_0x2b0a39){while(--_0x2b0a39){_0x3547d7['push'](_0x3547d7['shift']());}};_0x32fb3c(++_0x31561a);}(_0x5ee6,0x181));var _0x65ee=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x5ee6[_0x2641f9];return _0x585741;};'use strict';var crypto=require(_0x65ee('0x0'));var fs=require('fs');var BPromise=require('bluebird');var _=require(_0x65ee('0x1'));var config=require(_0x65ee('0x2'));var logger=require(_0x65ee('0x3'))(_0x65ee('0x4'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0x65ee('0x5')][_0x65ee('0x6')],'algorithm':'aes-256-ctr'};const fileOptions={'algorithm':_0x65ee('0x7')};if(config[_0x65ee('0x8')]&&config['encrypt'][_0x65ee('0x9')]){var isSupported=isAlgorithmSupported(config[_0x65ee('0x8')][_0x65ee('0x9')]);if(isSupported){fileOptions[_0x65ee('0x9')]=config[_0x65ee('0x8')][_0x65ee('0x9')];}else{var supportedAlgorithms=getSupportedCiphers()['join'](',\x20');logger['error'](config[_0x65ee('0x8')]['algorithm'],_0x65ee('0xa'),supportedAlgorithms);}}function isASupportedCipher(_0xe881b2){return AES_SUPPORTED_RX[_0x65ee('0xb')](_0xe881b2);}function getSupportedCiphers(){return crypto[_0x65ee('0xc')]()[_0x65ee('0xd')](isASupportedCipher);}function isAlgorithmSupported(_0x1bae01){return getSupportedCiphers()[_0x65ee('0xe')](_0x1bae01)>-0x1;}function combineOptions(_0x294b37){var _0x26a9b3={};for(var _0x3c2708 in fileOptions){if(fileOptions[_0x65ee('0xf')](_0x3c2708)){_0x26a9b3[_0x3c2708]=fileOptions[_0x3c2708];}}if(_0x294b37){for(var _0x5c8ec6 in _0x294b37){if(_0x294b37['hasOwnProperty'](_0x5c8ec6)){_0x26a9b3[_0x5c8ec6]=_0x294b37[_0x5c8ec6];}}}return _0x26a9b3;}exports[_0x65ee('0x10')]=function(_0x179da5,_0x117710,_0x2d675f,_0x1e891e){return new BPromise(function(_0x3b6e67,_0x1011f7){_0x1e891e=combineOptions(_0x1e891e);var _0x3ea7d4=new Buffer(_0x2d675f);var _0x118342=fs[_0x65ee('0x11')](_0x179da5);var _0xa6300d=fs[_0x65ee('0x12')](_0x117710);var _0x4b4cbe=crypto[_0x65ee('0x13')](_0x1e891e[_0x65ee('0x9')],_0x3ea7d4);_0x118342['on'](_0x65ee('0x14'),function(_0x4b6c60){var _0x3cc437=new Buffer(_0x4b4cbe[_0x65ee('0x15')](_0x4b6c60),'binary');_0xa6300d[_0x65ee('0x16')](_0x3cc437);});_0x118342['on'](_0x65ee('0x17'),function(){try{var _0x4ef668=new Buffer(_0x4b4cbe[_0x65ee('0x18')]('binary'),_0x65ee('0x19'));_0xa6300d[_0x65ee('0x16')](_0x4ef668);_0xa6300d['end']();_0xa6300d['on'](_0x65ee('0x1a'),function(){return _0x3b6e67(_0x117710);});}catch(_0x29ba7e){fs[_0x65ee('0x1b')](_0x117710);return _0x1011f7(_0x29ba7e);}});});};exports[_0x65ee('0x1c')]=function(_0x33a575,_0x3a4262,_0x5ebb79,_0x1a85bb){return new BPromise(function(_0x9c4974,_0x4b6725){_0x1a85bb=combineOptions(_0x1a85bb);var _0x2e3026=new Buffer(_0x5ebb79);var _0x5c4cce=fs[_0x65ee('0x11')](_0x33a575);var _0x357c4c=fs['createWriteStream'](_0x3a4262);var _0x51347e=crypto[_0x65ee('0x1d')](_0x1a85bb[_0x65ee('0x9')],_0x2e3026);_0x5c4cce['on'](_0x65ee('0x14'),function(_0x5182ce){var _0xbbd00f=new Buffer(_0x51347e[_0x65ee('0x15')](_0x5182ce),_0x65ee('0x19'));_0x357c4c[_0x65ee('0x16')](_0xbbd00f);});_0x5c4cce['on'](_0x65ee('0x17'),function(){try{var _0x3c3dc4=new Buffer(_0x51347e[_0x65ee('0x18')](_0x65ee('0x19')),_0x65ee('0x19'));_0x357c4c['write'](_0x3c3dc4);_0x357c4c[_0x65ee('0x17')]();_0x357c4c['on']('close',function(){return _0x9c4974(_0x3a4262);});}catch(_0x35ac8b){fs[_0x65ee('0x1b')](_0x3a4262);return _0x4b6725(_0x35ac8b);}});});};exports['encryptString']=function(_0x24000a,_0x192fa3,_0x4e3efb){var _0xc9a604=_0x4e3efb||stringOptions[_0x65ee('0x9')];var _0xc2aa21=_0x192fa3||stringOptions['secret'];var _0x3243cd=crypto[_0x65ee('0x13')](_0xc9a604,_0xc2aa21);var _0x302647=_0x3243cd[_0x65ee('0x15')](_0x24000a,_0x65ee('0x1e'),_0x65ee('0x1f'));_0x302647+=_0x3243cd[_0x65ee('0x18')]('base64');return _0x302647;};exports[_0x65ee('0x20')]=function(_0x465ced,_0x352a74,_0x3ebef2){var _0xf44793=_0x3ebef2||stringOptions[_0x65ee('0x9')];var _0x1939f4=_0x352a74||stringOptions[_0x65ee('0x21')];var _0x3f2b90=crypto[_0x65ee('0x1d')](_0xf44793,_0x1939f4);var _0x2aa310=_0x3f2b90['update'](_0x465ced,_0x65ee('0x1f'),_0x65ee('0x1e'));_0x2aa310+=_0x3f2b90[_0x65ee('0x18')](_0x65ee('0x1e'));return _0x2aa310;}; \ No newline at end of file diff --git a/server/components/export/csv.js b/server/components/export/csv.js index 17f4b59..3302bfd 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 _0x4662=['then','%s.%s','csv','writeFileSync','zip','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','util','path','lodash','bluebird','zip-dir','../../mysqldb','../../config/logger','argv','savename','update','info','CSV','Setting','split','splitSizeCsv','sequelize','query','format','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','num','Empty','length','range','isInteger','forEach','push','SELECT','dirname','basename','join','mkdirSync'];(function(_0x5e7514,_0x30c2e1){var _0x12f472=function(_0x33ddb6){while(--_0x33ddb6){_0x5e7514['push'](_0x5e7514['shift']());}};_0x12f472(++_0x30c2e1);}(_0x4662,0x114));var _0x2466=function(_0x3af823,_0x48e911){_0x3af823=_0x3af823-0x0;var _0x4b474f=_0x4662[_0x3af823];return _0x4b474f;};'use strict';var util=require(_0x2466('0x0'));var path=require(_0x2466('0x1'));var _=require(_0x2466('0x2'));var csv=require('to-csv');var fs=require('fs');var BPromise=require(_0x2466('0x3'));var zipdir=require(_0x2466('0x4'));var rimraf=require('rimraf');var db=require('../../mysqldb')['db'];var dbH=require(_0x2466('0x5'))['dbH'];var logger=require(_0x2466('0x6'))('analytics');var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0x2466('0x7')][0x3];var PATH=process[_0x2466('0x7')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x30dff2,_0x195845){var _0x53a31e={'status':_0x30dff2};var _0x236a41={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x195845){_0x53a31e[_0x2466('0x8')]=_0x195845;}return db['AnalyticExtractedReport'][_0x2466('0x9')](_0x53a31e,_0x236a41);}function main(){var _0x31ef7c=0x1388;var _0x3aa3d0;logger[_0x2466('0xa')](util['format']('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x2466('0xb')));return db[_0x2466('0xc')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x2466('0xd'),_0x2466('0xe')]})['then'](function(_0x5894d1){if(_0x5894d1){_0x3aa3d0=_0x5894d1;_0x31ef7c=_0x3aa3d0['splitSizeCsv']||0x1388;}})['then'](function(){return dbH[_0x2466('0xf')][_0x2466('0x10')](util[_0x2466('0x11')](_0x2466('0x12'),QUERY),{'type':dbH[_0x2466('0xf')][_0x2466('0x13')]['SELECT']});})['then'](function(_0x2dcc87){if(!_0x2dcc87[0x0][_0x2466('0x14')]){return analyticExtractedReport(_0x2466('0x15'));}var _0xee8f38=[];var _0x1e482f=0x0;if(_0x3aa3d0[_0x2466('0xd')]){if(_0x2dcc87&&_0x2dcc87[_0x2466('0x16')]){var _0x5118e8=_[_0x2466('0x17')](_0x2dcc87[0x0][_0x2466('0x14')]/_0x31ef7c);var _0x3d9559=Number[_0x2466('0x18')](_0x2dcc87[0x0][_0x2466('0x14')]/_0x31ef7c)?_0x2dcc87[0x0][_0x2466('0x14')]%_0x31ef7c:0x0;_0x5118e8[_0x2466('0x19')](function(_0x168802){if(_0x168802>0x0){_0x1e482f+=_0x31ef7c;}_0xee8f38[_0x2466('0x1a')](dbH[_0x2466('0xf')][_0x2466('0x10')](util[_0x2466('0x11')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x31ef7c,_0x1e482f),{'type':dbH['sequelize'][_0x2466('0x13')][_0x2466('0x1b')]}));});if(_0x3d9559>0x0){_0x1e482f+=_0x31ef7c;_0xee8f38['push'](dbH['sequelize'][_0x2466('0x10')](util[_0x2466('0x11')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x3d9559,_0x1e482f),{'type':dbH[_0x2466('0xf')][_0x2466('0x13')]['SELECT']}));}}}else{_0xee8f38[_0x2466('0x1a')](dbH[_0x2466('0xf')]['query'](QUERY,{'type':dbH[_0x2466('0xf')][_0x2466('0x13')]['SELECT']}));}var _0x350893=path[_0x2466('0x1c')](PATH);var _0x2aff14=path[_0x2466('0x1d')](PATH,'.csv');var _0xf731de=_0x3aa3d0['split']&&_0xee8f38[_0x2466('0x16')]>0x1;var _0x2078f6=[];if(!fs['existsSync'](path[_0x2466('0x1e')](_0x350893,_0x2aff14))&&_0xf731de){fs[_0x2466('0x1f')](path[_0x2466('0x1e')](_0x350893,_0x2aff14));}return BPromise['each'](_0xee8f38,function(_0x16a8b9){_0x2078f6[_0x2466('0x1a')](_0x16a8b9);})[_0x2466('0x20')](function(){for(var _0x421e47=0x0;_0x421e47<_0x2078f6[_0x2466('0x16')];_0x421e47+=0x1){var _0x3fea57;var _0x38a3ab=_0x2078f6[_0x421e47];if(_0xf731de){_0x3fea57=path[_0x2466('0x1e')](_0x350893,_0x2aff14,util[_0x2466('0x11')]('%s%d.%s',_0x2aff14,_0x421e47,'csv'));}else{_0x3fea57=path[_0x2466('0x1e')](_0x350893,util[_0x2466('0x11')](_0x2466('0x21'),_0x2aff14,_0x2466('0x22')));}fs[_0x2466('0x23')](_0x3fea57,csv(_0x38a3ab));}})[_0x2466('0x20')](function(){if(_0xf731de){return new Promise(function(_0xdec5fb){zipdir(path[_0x2466('0x1e')](_0x350893,_0x2aff14),{'saveTo':path[_0x2466('0x1e')](_0x350893,util[_0x2466('0x11')]('%s.%s',_0x2aff14,_0x2466('0x24')))},function(_0x3d245e,_0x48fb26){rimraf(path['join'](_0x350893,_0x2aff14),function(){});_0xdec5fb(_0x2466('0x25'));});});}})['then'](function(){logger[_0x2466('0xa')](util[_0x2466('0x11')](_0x2466('0x26'),EXTRACTED_REPORT_ID,'CSV'));return analyticExtractedReport(_0x2466('0x27'),_0xf731de?util[_0x2466('0x11')](_0x2466('0x21'),_0x2aff14,_0xf731de?_0x2466('0x24'):_0x2466('0x22')):null);});})[_0x2466('0x28')](function(_0x229a12){logger[_0x2466('0xa')](util['format'](_0x2466('0x29'),EXTRACTED_REPORT_ID,_0x2466('0xb')),util[_0x2466('0x2a')](_0x229a12,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x2466('0x2b'));})['finally'](function(){process['exit'](EXIT_CODE);});}main(); \ No newline at end of file +var _0x21f8=['query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','num','range','%s\x20limit\x20%d\x20OFFSET\x20%d','push','length','join','mkdirSync','each','%s%d.%s','csv','%s.%s','writeFileSync','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Failed','finally','exit','util','path','lodash','to-csv','bluebird','zip-dir','rimraf','../../config/logger','analytics','argv','AnalyticExtractedReport','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','Setting','find','split','splitSizeCsv','then','sequelize'];(function(_0x243b59,_0x3f9495){var _0x3e1676=function(_0x354052){while(--_0x354052){_0x243b59['push'](_0x243b59['shift']());}};_0x3e1676(++_0x3f9495);}(_0x21f8,0x71));var _0x821f=function(_0x46428c,_0x20ab75){_0x46428c=_0x46428c-0x0;var _0x16a677=_0x21f8[_0x46428c];return _0x16a677;};'use strict';var util=require(_0x821f('0x0'));var path=require(_0x821f('0x1'));var _=require(_0x821f('0x2'));var csv=require(_0x821f('0x3'));var fs=require('fs');var BPromise=require(_0x821f('0x4'));var zipdir=require(_0x821f('0x5'));var rimraf=require(_0x821f('0x6'));var db=require('../../mysqldb')['db'];var dbH=require('../../mysqldb')['dbH'];var logger=require(_0x821f('0x7'))(_0x821f('0x8'));var EXTRACTED_REPORT_ID=Number(process[_0x821f('0x9')][0x2]);var QUERY=process[_0x821f('0x9')][0x3];var PATH=process[_0x821f('0x9')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x3a42fe,_0x1b9945){var _0xfcb0a={'status':_0x3a42fe};var _0x4e260d={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x1b9945){_0xfcb0a['savename']=_0x1b9945;}return db[_0x821f('0xa')][_0x821f('0xb')](_0xfcb0a,_0x4e260d);}function main(){var _0x81e2f4=0x1388;var _0x53ce42;logger[_0x821f('0xc')](util[_0x821f('0xd')](_0x821f('0xe'),EXTRACTED_REPORT_ID,_0x821f('0xf')));return db[_0x821f('0x10')][_0x821f('0x11')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x821f('0x12'),_0x821f('0x13')]})[_0x821f('0x14')](function(_0x2aeb4e){if(_0x2aeb4e){_0x53ce42=_0x2aeb4e;_0x81e2f4=_0x53ce42['splitSizeCsv']||0x1388;}})['then'](function(){return dbH[_0x821f('0x15')][_0x821f('0x16')](util[_0x821f('0xd')](_0x821f('0x17'),QUERY),{'type':dbH[_0x821f('0x15')][_0x821f('0x18')][_0x821f('0x19')]});})[_0x821f('0x14')](function(_0x1aeda5){if(!_0x1aeda5[0x0][_0x821f('0x1a')]){return analyticExtractedReport('Empty');}var _0x3419ab=[];var _0x594165=0x0;if(_0x53ce42[_0x821f('0x12')]){if(_0x1aeda5&&_0x1aeda5['length']){var _0x46acae=_[_0x821f('0x1b')](_0x1aeda5[0x0][_0x821f('0x1a')]/_0x81e2f4);var _0x27c41c=Number['isInteger'](_0x1aeda5[0x0][_0x821f('0x1a')]/_0x81e2f4)?_0x1aeda5[0x0][_0x821f('0x1a')]%_0x81e2f4:0x0;_0x46acae['forEach'](function(_0x193b41){if(_0x193b41>0x0){_0x594165+=_0x81e2f4;}_0x3419ab['push'](dbH[_0x821f('0x15')]['query'](util[_0x821f('0xd')](_0x821f('0x1c'),QUERY,_0x81e2f4,_0x594165),{'type':dbH['sequelize']['QueryTypes'][_0x821f('0x19')]}));});if(_0x27c41c>0x0){_0x594165+=_0x81e2f4;_0x3419ab[_0x821f('0x1d')](dbH[_0x821f('0x15')]['query'](util[_0x821f('0xd')](_0x821f('0x1c'),QUERY,_0x27c41c,_0x594165),{'type':dbH[_0x821f('0x15')]['QueryTypes'][_0x821f('0x19')]}));}}}else{_0x3419ab[_0x821f('0x1d')](dbH['sequelize']['query'](QUERY,{'type':dbH['sequelize']['QueryTypes'][_0x821f('0x19')]}));}var _0x4af347=path['dirname'](PATH);var _0x21c1d9=path['basename'](PATH,'.csv');var _0x3d7994=_0x53ce42[_0x821f('0x12')]&&_0x3419ab[_0x821f('0x1e')]>0x1;var _0x368a74=[];if(!fs['existsSync'](path[_0x821f('0x1f')](_0x4af347,_0x21c1d9))&&_0x3d7994){fs[_0x821f('0x20')](path[_0x821f('0x1f')](_0x4af347,_0x21c1d9));}return BPromise[_0x821f('0x21')](_0x3419ab,function(_0x47f0b6){_0x368a74[_0x821f('0x1d')](_0x47f0b6);})[_0x821f('0x14')](function(){for(var _0x130649=0x0;_0x130649<_0x368a74[_0x821f('0x1e')];_0x130649+=0x1){var _0x53d87e;var _0xceb073=_0x368a74[_0x130649];if(_0x3d7994){_0x53d87e=path['join'](_0x4af347,_0x21c1d9,util['format'](_0x821f('0x22'),_0x21c1d9,_0x130649,_0x821f('0x23')));}else{_0x53d87e=path[_0x821f('0x1f')](_0x4af347,util[_0x821f('0xd')](_0x821f('0x24'),_0x21c1d9,'csv'));}fs[_0x821f('0x25')](_0x53d87e,csv(_0xceb073));}})[_0x821f('0x14')](function(){if(_0x3d7994){return new Promise(function(_0x17db9d){zipdir(path[_0x821f('0x1f')](_0x4af347,_0x21c1d9),{'saveTo':path['join'](_0x4af347,util[_0x821f('0xd')](_0x821f('0x24'),_0x21c1d9,_0x821f('0x26')))},function(_0x15891b,_0x1d2660){rimraf(path[_0x821f('0x1f')](_0x4af347,_0x21c1d9),function(){});_0x17db9d('zip\x20finished');});});}})[_0x821f('0x14')](function(){logger['info'](util[_0x821f('0xd')](_0x821f('0x27'),EXTRACTED_REPORT_ID,'CSV'));return analyticExtractedReport('Completed',_0x3d7994?util[_0x821f('0xd')](_0x821f('0x24'),_0x21c1d9,_0x3d7994?_0x821f('0x26'):_0x821f('0x23')):null);});})[_0x821f('0x28')](function(_0x5e09d9){logger['info'](util[_0x821f('0xd')](_0x821f('0x29'),EXTRACTED_REPORT_ID,_0x821f('0xf')),util['inspect'](_0x5e09d9,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x821f('0x2a'));})[_0x821f('0x2b')](function(){process[_0x821f('0x2c')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/export/pdf.js b/server/components/export/pdf.js index 4dcc836..834801c 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 _0xa9aa=['finally','/fonts/arial-bold.ttf','/fonts/arial-italic.ttf','%s\x20#%d','channel','interactionId','YYYY-MM-DD','center','Interaction\x20Transcript','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','pipe','finish','error','end','createPdfFromHTML','catch','lodash','path','moment','html-to-pdfmake','pdfmake/src/printer','zip-dir','rimraf','jsdom','JSDOM','window','bluebird','../../mysqldb','dbH','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport','update','map','tableHeader','toString','fill','auto','body','push','concat','chunk','format','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name','startDate','length','header','pageBreak','before','landscape','\x20/\x20','Arial','black','num','Empty','Setting','find','splitSizePdf','then','split','range','isInteger','sequelize','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','SELECT','query','dirname','basename','existsSync','mkdirSync','flatten','createPdfKitDocument','join','%s%d.%s','%s.%s','pdf','all','zip\x20finished','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','PDF','Completed','zip','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','findOne','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed'];(function(_0x2d0230,_0xc380c){var _0x494278=function(_0x142b9a){while(--_0x142b9a){_0x2d0230['push'](_0x2d0230['shift']());}};_0x494278(++_0xc380c);}(_0xa9aa,0x1e1));var _0xaa9a=function(_0x1c117d,_0x3f439d){_0x1c117d=_0x1c117d-0x0;var _0x3566e4=_0xa9aa[_0x1c117d];return _0x3566e4;};'use strict';var _=require(_0xaa9a('0x0'));var fs=require('fs');var util=require('util');var path=require(_0xaa9a('0x1'));var moment=require(_0xaa9a('0x2'));var htmlToPdfmake=require(_0xaa9a('0x3'));var PdfPrinter=require(_0xaa9a('0x4'));var zipdir=require(_0xaa9a('0x5'));var rimraf=require(_0xaa9a('0x6'));var JSDOM=require(_0xaa9a('0x7'))[_0xaa9a('0x8')];var window=new JSDOM('')[_0xaa9a('0x9')];var BPromise=require(_0xaa9a('0xa'));var db=require(_0xaa9a('0xb'))['db'];var dbH=require(_0xaa9a('0xb'))[_0xaa9a('0xc')];var logger=require('../../config/logger')(_0xaa9a('0xd'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process['argv'][0x3];var PATH=process['argv'][0x4];var NAME=process[_0xaa9a('0xe')][0x5];var FORMAT=_0xaa9a('0xf');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x3468da,_0x12102b){var _0x2dc3cc={'status':_0x3468da};var _0x27258c={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x12102b){_0x2dc3cc[_0xaa9a('0x10')]=_0x12102b;}return db[_0xaa9a('0x11')][_0xaa9a('0x12')](_0x2dc3cc,_0x27258c);}function getHeaders(_0x45715b){return _[_0xaa9a('0x13')](_0x45715b,function(_0x3deb3e){return{'text':_0x3deb3e,'style':_0xaa9a('0x14')};});}function getRows(_0x30ea75,_0x5bf042){return _[_0xaa9a('0x13')](_0x5bf042,function(_0x458e70){return _(_0x458e70)['pick'](_0x30ea75)[_0xaa9a('0x13')](function(_0x4bdbb8){return _0x4bdbb8?_[_0xaa9a('0x15')](_0x4bdbb8):'';})['value']();});}function createTable(_0x26af38,_0x5e619d){var _0x2afd09={'widths':_[_0xaa9a('0x16')](Array(_0x26af38['length']),0x91),'heights':function(_0x4a7091){return _0x4a7091===0x0?_0xaa9a('0x17'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x2d2298=getHeaders(_0x26af38);_0x2afd09[_0xaa9a('0x18')][_0xaa9a('0x19')](_0x2d2298);var _0x527909=getRows(_0x26af38,_0x5e619d);_0x2afd09[_0xaa9a('0x18')]=_0x2afd09[_0xaa9a('0x18')][_0xaa9a('0x1a')](_0x527909);return _0x2afd09;}function createTables(_0x1642a6){var _0x3f029b=[];var _0x274bdf=_[_0xaa9a('0x1b')](Object['keys'](_0x1642a6[0x0]),0x5);_0x274bdf['forEach'](function(_0xb0a64a){_0x3f029b[_0xaa9a('0x19')](createTable(_0xb0a64a,_0x1642a6));});return _0x3f029b;}function getPDFDocDefinition(_0x429a11){var _0x5587a7=util[_0xaa9a('0x1c')](_0xaa9a('0x1d'),NAME,EXTRACTED_REPORT[_0xaa9a('0x1e')],moment(EXTRACTED_REPORT[_0xaa9a('0x1f')])[_0xaa9a('0x1c')](FORMAT),moment(EXTRACTED_REPORT['endDate'])[_0xaa9a('0x1c')](FORMAT));var _0x1ffc85=[];for(var _0x228e22=0x0;_0x228e22<_0x429a11[_0xaa9a('0x20')];_0x228e22++){var _0x5c1c39=[];if(_0x228e22===0x0){_0x5c1c39['push']({'text':_0x5587a7,'style':_0xaa9a('0x21')});}var _0x335ef9={'table':_0x429a11[_0x228e22]};if(_0x228e22>0x0){_0x335ef9[_0xaa9a('0x22')]=_0xaa9a('0x23');_0x335ef9['margin']=[0x0,0x46,0x0,0x0];}_0x5c1c39['push'](_0x335ef9);_0x1ffc85[_0xaa9a('0x19')](_0x5c1c39);}return{'pageSize':'A4','pageOrientation':_0xaa9a('0x24'),'content':_0x1ffc85,'footer':function(_0x20ac86,_0x529463){return{'text':_0x20ac86[_0xaa9a('0x15')]()+_0xaa9a('0x25')+_0x529463,'style':'footer'};},'defaultStyle':{'font':_0xaa9a('0x26')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0xaa9a('0x27')},'footer':{'alignment':'right','margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x2d63bd){var _0x588af8=0x1388;var _0x29907e;if(!_0x2d63bd[0x0][_0xaa9a('0x28')]){return analyticExtractedReport(_0xaa9a('0x29'));}return db[_0xaa9a('0x2a')][_0xaa9a('0x2b')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0xaa9a('0x2c')]})[_0xaa9a('0x2d')](function(_0x90112c){if(_0x90112c){_0x29907e=_0x90112c;_0x588af8=_0x29907e[_0xaa9a('0x2c')]||0x3e8;}})[_0xaa9a('0x2d')](function(){var _0x308e4d=[];var _0x114ec3=0x0;if(_0x29907e[_0xaa9a('0x2e')]){if(_0x2d63bd&&_0x2d63bd[_0xaa9a('0x20')]){var _0x1fdb58=_[_0xaa9a('0x2f')](_0x2d63bd[0x0][_0xaa9a('0x28')]/_0x588af8);var _0x113478=Number[_0xaa9a('0x30')](_0x2d63bd[0x0]['num']/_0x588af8)?_0x2d63bd[0x0][_0xaa9a('0x28')]%_0x588af8:0x0;_0x1fdb58['forEach'](function(_0x52b16a){if(_0x52b16a>0x0){_0x114ec3+=_0x588af8;}_0x308e4d['push'](dbH[_0xaa9a('0x31')]['query'](util[_0xaa9a('0x1c')](_0xaa9a('0x32'),QUERY,_0x588af8,_0x114ec3),{'type':dbH[_0xaa9a('0x31')][_0xaa9a('0x33')][_0xaa9a('0x34')]}));});if(_0x113478>0x0){_0x114ec3+=_0x588af8;_0x308e4d['push'](dbH[_0xaa9a('0x31')][_0xaa9a('0x35')](util[_0xaa9a('0x1c')](_0xaa9a('0x32'),QUERY,_0x113478,_0x114ec3),{'type':dbH[_0xaa9a('0x31')][_0xaa9a('0x33')][_0xaa9a('0x34')]}));}}}else{_0x308e4d[_0xaa9a('0x19')](dbH[_0xaa9a('0x31')][_0xaa9a('0x35')](QUERY,{'type':dbH[_0xaa9a('0x31')][_0xaa9a('0x33')][_0xaa9a('0x34')]}));}var _0x2b9614=path[_0xaa9a('0x36')](PATH);var _0xb6f82b=path[_0xaa9a('0x37')](PATH,'.pdf');var _0x63de42=_0x29907e[_0xaa9a('0x2e')]&&_0x308e4d['length']>0x1;var _0x5ddfd6=[];if(!fs[_0xaa9a('0x38')](path['join'](_0x2b9614,_0xb6f82b))&&_0x63de42){fs[_0xaa9a('0x39')](path['join'](_0x2b9614,_0xb6f82b));}return BPromise['each'](_0x308e4d,function(_0x5db986){_0x5ddfd6[_0xaa9a('0x19')](_0x5db986);})[_0xaa9a('0x2d')](function(){var _0x7d1c9f=[];for(var _0x576eed=0x0;_0x576eed<_0x5ddfd6[_0xaa9a('0x20')];_0x576eed+=0x1){var _0x1c4868=_0x5ddfd6[_0x576eed];var _0x24de9f=createTables(_[_0xaa9a('0x3a')](_0x1c4868));var _0x4a85c9;var _0x2a422a=getPDFDocDefinition(_0x24de9f);var _0x562619=getPDFPrinter();var _0x595d37=_0x562619[_0xaa9a('0x3b')](_0x2a422a);if(_0x63de42){_0x4a85c9=path[_0xaa9a('0x3c')](_0x2b9614,_0xb6f82b,util[_0xaa9a('0x1c')](_0xaa9a('0x3d'),_0xb6f82b,_0x576eed,'pdf'));}else{_0x4a85c9=path['join'](_0x2b9614,util[_0xaa9a('0x1c')](_0xaa9a('0x3e'),_0xb6f82b,_0xaa9a('0x3f')));}_0x7d1c9f[_0xaa9a('0x19')](writePDFDocument(_0x595d37,_0x4a85c9));}return Promise[_0xaa9a('0x40')](_0x7d1c9f);})[_0xaa9a('0x2d')](function(){if(_0x63de42){return new Promise(function(_0x399005){zipdir(path[_0xaa9a('0x3c')](_0x2b9614,_0xb6f82b),{'saveTo':path['join'](_0x2b9614,util[_0xaa9a('0x1c')](_0xaa9a('0x3e'),_0xb6f82b,'zip'))},function(){rimraf(path[_0xaa9a('0x3c')](_0x2b9614,_0xb6f82b),function(){});_0x399005(_0xaa9a('0x41'));});});}})['then'](function(){if(!_0x63de42)return;rimraf(path[_0xaa9a('0x3c')](_0x2b9614,_0xb6f82b),function(){});})['then'](function(){logger[_0xaa9a('0x42')](util[_0xaa9a('0x1c')](_0xaa9a('0x43'),EXTRACTED_REPORT_ID,_0xaa9a('0x44')));return analyticExtractedReport(_0xaa9a('0x45'),_0x63de42?util[_0xaa9a('0x1c')]('%s.%s',_0xb6f82b,_0x63de42?_0xaa9a('0x46'):_0xaa9a('0x3f')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0xaa9a('0x42')](util[_0xaa9a('0x1c')](_0xaa9a('0x47'),EXTRACTED_REPORT_ID,_0xaa9a('0x44')));return db[_0xaa9a('0x11')][_0xaa9a('0x48')]({'where':{'id':EXTRACTED_REPORT_ID}})['then'](function(_0x43d7fa){EXTRACTED_REPORT=_0x43d7fa;return dbH[_0xaa9a('0x31')][_0xaa9a('0x35')](util['format'](_0xaa9a('0x49'),QUERY),{'type':dbH[_0xaa9a('0x31')][_0xaa9a('0x33')][_0xaa9a('0x34')]});})[_0xaa9a('0x2d')](extractReport)['catch'](function(_0xc63b80){logger[_0xaa9a('0x42')](util[_0xaa9a('0x1c')](_0xaa9a('0x4a'),EXTRACTED_REPORT_ID,_0xaa9a('0x44')),util[_0xaa9a('0x4b')](_0xc63b80,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xaa9a('0x4c'));})[_0xaa9a('0x4d')](function(){process['exit'](EXIT_CODE);});}main();function getPDFPrinter(){var _0x241507=new PdfPrinter({'Arial':{'normal':__dirname+'/fonts/arial-regular.ttf','bold':__dirname+_0xaa9a('0x4e'),'italics':__dirname+_0xaa9a('0x4f'),'bolditalics':__dirname+'/fonts/arial-bold-italic.ttf'}});return _0x241507;}function getPDFDocDefinitionFromHTML(_0x1b322b,_0x20931c){var _0xce1bdc=util[_0xaa9a('0x1c')](_0xaa9a('0x50'),_0x20931c[_0xaa9a('0x51')],_0x20931c[_0xaa9a('0x52')]);var _0x5063a1=moment()[_0xaa9a('0x1c')](_0xaa9a('0x53'))[_0xaa9a('0x15')]();var _0x3d5979=htmlToPdfmake(_0x1b322b,{'window':window,'tableAutoSize':!![]});return{'content':[_0x3d5979],'defaultStyle':{'font':_0xaa9a('0x26')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0xaa9a('0x54'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0xaa9a('0x54'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0xaa9a('0x54')}},'header':function(){return[{'text':_0xaa9a('0x55'),'style':_0xaa9a('0x21')}];},'footer':function(_0x4d0a1c,_0x41734c){return[{'text':util[_0xaa9a('0x1c')](_0xaa9a('0x56'),_0xce1bdc,_0x4d0a1c,_0x41734c,_0x5063a1),'style':'footer'}];}};}function writePDFDocument(_0x3b73db,_0x4c65bb){return new Promise(function(_0x2e013d,_0x36cb50){var _0x477b7d=_0x3b73db[_0xaa9a('0x57')](fs['createWriteStream'](_0x4c65bb));_0x477b7d['on'](_0xaa9a('0x58'),function(){_0x2e013d(_0xaa9a('0x58'));});_0x477b7d['on'](_0xaa9a('0x59'),function(_0x12d62f){_0x36cb50(_0x12d62f);});_0x3b73db[_0xaa9a('0x5a')]();});}exports[_0xaa9a('0x5b')]=function(_0x3f3c7c,_0x391701){var _0x5b7b81=getPDFPrinter();var _0xd72bcd=getPDFDocDefinitionFromHTML(_0x3f3c7c,_0x391701);var _0x3bd9af=_0x5b7b81[_0xaa9a('0x3b')](_0xd72bcd);return writePDFDocument(_0x3bd9af,_0x391701[_0xaa9a('0x1')])[_0xaa9a('0x5c')](function(_0x1ec0bc){throw _0x1ec0bc;});}; \ No newline at end of file +var _0x00a4=['footer','Arial','right','num','Setting','find','splitSizePdf','then','isInteger','sequelize','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','query','SELECT','dirname','basename','split','mkdirSync','join','each','createPdfKitDocument','%s%d.%s','%s.%s','all','zip','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','pdf','info','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','PDF','findOne','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','exit','/fonts/arial-italic.ttf','/fonts/arial-bold-italic.ttf','channel','interactionId','YYYY-MM-DD','center','header','pipe','createWriteStream','finish','error','createPdfFromHTML','lodash','util','path','moment','html-to-pdfmake','pdfmake/src/printer','zip-dir','JSDOM','bluebird','../../mysqldb','dbH','../../config/logger','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','AnalyticExtractedReport','map','pick','fill','length','auto','concat','forEach','push','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name','format','endDate','before','margin','landscape','toString','\x20/\x20'];(function(_0x5a53f6,_0x41dcfb){var _0x2962f3=function(_0x4ebcb4){while(--_0x4ebcb4){_0x5a53f6['push'](_0x5a53f6['shift']());}};_0x2962f3(++_0x41dcfb);}(_0x00a4,0xdb));var _0x400a=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x00a4[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0x400a('0x0'));var fs=require('fs');var util=require(_0x400a('0x1'));var path=require(_0x400a('0x2'));var moment=require(_0x400a('0x3'));var htmlToPdfmake=require(_0x400a('0x4'));var PdfPrinter=require(_0x400a('0x5'));var zipdir=require(_0x400a('0x6'));var rimraf=require('rimraf');var JSDOM=require('jsdom')[_0x400a('0x7')];var window=new JSDOM('')['window'];var BPromise=require(_0x400a('0x8'));var db=require('../../mysqldb')['db'];var dbH=require(_0x400a('0x9'))[_0x400a('0xa')];var logger=require(_0x400a('0xb'))(_0x400a('0xc'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0x400a('0xd')][0x3];var PATH=process['argv'][0x4];var NAME=process[_0x400a('0xd')][0x5];var FORMAT=_0x400a('0xe');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x8e507d,_0x3f56d4){var _0x52d7cf={'status':_0x8e507d};var _0x2b0577={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x3f56d4){_0x52d7cf['savename']=_0x3f56d4;}return db[_0x400a('0xf')]['update'](_0x52d7cf,_0x2b0577);}function getHeaders(_0x4963df){return _['map'](_0x4963df,function(_0x229221){return{'text':_0x229221,'style':'tableHeader'};});}function getRows(_0x3d3e62,_0x18692c){return _[_0x400a('0x10')](_0x18692c,function(_0x30bf3d){return _(_0x30bf3d)[_0x400a('0x11')](_0x3d3e62)['map'](function(_0x319d63){return _0x319d63?_['toString'](_0x319d63):'';})['value']();});}function createTable(_0x25922f,_0x568f26){var _0x1a39c6={'widths':_[_0x400a('0x12')](Array(_0x25922f[_0x400a('0x13')]),0x91),'heights':function(_0x23b8fd){return _0x23b8fd===0x0?_0x400a('0x14'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x1829f9=getHeaders(_0x25922f);_0x1a39c6['body']['push'](_0x1829f9);var _0x61788f=getRows(_0x25922f,_0x568f26);_0x1a39c6['body']=_0x1a39c6['body'][_0x400a('0x15')](_0x61788f);return _0x1a39c6;}function createTables(_0xa99b10){var _0x439597=[];var _0x1efec2=_['chunk'](Object['keys'](_0xa99b10[0x0]),0x5);_0x1efec2[_0x400a('0x16')](function(_0x5a4fc4){_0x439597[_0x400a('0x17')](createTable(_0x5a4fc4,_0xa99b10));});return _0x439597;}function getPDFDocDefinition(_0x5824a4){var _0x285c7a=util['format'](_0x400a('0x18'),NAME,EXTRACTED_REPORT[_0x400a('0x19')],moment(EXTRACTED_REPORT['startDate'])[_0x400a('0x1a')](FORMAT),moment(EXTRACTED_REPORT[_0x400a('0x1b')])[_0x400a('0x1a')](FORMAT));var _0x346a18=[];for(var _0x3cc852=0x0;_0x3cc852<_0x5824a4['length'];_0x3cc852++){var _0x519db6=[];if(_0x3cc852===0x0){_0x519db6['push']({'text':_0x285c7a,'style':'header'});}var _0x457c59={'table':_0x5824a4[_0x3cc852]};if(_0x3cc852>0x0){_0x457c59['pageBreak']=_0x400a('0x1c');_0x457c59[_0x400a('0x1d')]=[0x0,0x46,0x0,0x0];}_0x519db6[_0x400a('0x17')](_0x457c59);_0x346a18['push'](_0x519db6);}return{'pageSize':'A4','pageOrientation':_0x400a('0x1e'),'content':_0x346a18,'footer':function(_0x265af2,_0x345b08){return{'text':_0x265af2[_0x400a('0x1f')]()+_0x400a('0x20')+_0x345b08,'style':_0x400a('0x21')};},'defaultStyle':{'font':_0x400a('0x22')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':'black'},'footer':{'alignment':_0x400a('0x23'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x22f7a5){var _0xc6045c=0x1388;var _0x4374cb;if(!_0x22f7a5[0x0][_0x400a('0x24')]){return analyticExtractedReport('Empty');}return db[_0x400a('0x25')][_0x400a('0x26')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0x400a('0x27')]})[_0x400a('0x28')](function(_0x2769e6){if(_0x2769e6){_0x4374cb=_0x2769e6;_0xc6045c=_0x4374cb['splitSizePdf']||0x3e8;}})['then'](function(){var _0x5b31ea=[];var _0x55e566=0x0;if(_0x4374cb['split']){if(_0x22f7a5&&_0x22f7a5[_0x400a('0x13')]){var _0x54b661=_['range'](_0x22f7a5[0x0][_0x400a('0x24')]/_0xc6045c);var _0x35afd8=Number[_0x400a('0x29')](_0x22f7a5[0x0][_0x400a('0x24')]/_0xc6045c)?_0x22f7a5[0x0]['num']%_0xc6045c:0x0;_0x54b661[_0x400a('0x16')](function(_0x2367dc){if(_0x2367dc>0x0){_0x55e566+=_0xc6045c;}_0x5b31ea[_0x400a('0x17')](dbH[_0x400a('0x2a')]['query'](util['format'](_0x400a('0x2b'),QUERY,_0xc6045c,_0x55e566),{'type':dbH[_0x400a('0x2a')][_0x400a('0x2c')]['SELECT']}));});if(_0x35afd8>0x0){_0x55e566+=_0xc6045c;_0x5b31ea[_0x400a('0x17')](dbH['sequelize'][_0x400a('0x2d')](util[_0x400a('0x1a')](_0x400a('0x2b'),QUERY,_0x35afd8,_0x55e566),{'type':dbH[_0x400a('0x2a')][_0x400a('0x2c')][_0x400a('0x2e')]}));}}}else{_0x5b31ea[_0x400a('0x17')](dbH[_0x400a('0x2a')]['query'](QUERY,{'type':dbH['sequelize'][_0x400a('0x2c')][_0x400a('0x2e')]}));}var _0x248d41=path[_0x400a('0x2f')](PATH);var _0x2b7b68=path[_0x400a('0x30')](PATH,'.pdf');var _0x208943=_0x4374cb[_0x400a('0x31')]&&_0x5b31ea[_0x400a('0x13')]>0x1;var _0x59c26e=[];if(!fs['existsSync'](path['join'](_0x248d41,_0x2b7b68))&&_0x208943){fs[_0x400a('0x32')](path[_0x400a('0x33')](_0x248d41,_0x2b7b68));}return BPromise[_0x400a('0x34')](_0x5b31ea,function(_0x26c130){_0x59c26e[_0x400a('0x17')](_0x26c130);})['then'](function(){var _0x5ac127=[];for(var _0x59c627=0x0;_0x59c627<_0x59c26e['length'];_0x59c627+=0x1){var _0x400d03=_0x59c26e[_0x59c627];var _0x12b8b5=createTables(_['flatten'](_0x400d03));var _0x5a0187;var _0xf8f69c=getPDFDocDefinition(_0x12b8b5);var _0x1b2892=getPDFPrinter();var _0x592f6a=_0x1b2892[_0x400a('0x35')](_0xf8f69c);if(_0x208943){_0x5a0187=path['join'](_0x248d41,_0x2b7b68,util[_0x400a('0x1a')](_0x400a('0x36'),_0x2b7b68,_0x59c627,'pdf'));}else{_0x5a0187=path[_0x400a('0x33')](_0x248d41,util['format'](_0x400a('0x37'),_0x2b7b68,'pdf'));}_0x5ac127['push'](writePDFDocument(_0x592f6a,_0x5a0187));}return Promise[_0x400a('0x38')](_0x5ac127);})[_0x400a('0x28')](function(){if(_0x208943){return new Promise(function(_0x4e4bf5){zipdir(path[_0x400a('0x33')](_0x248d41,_0x2b7b68),{'saveTo':path[_0x400a('0x33')](_0x248d41,util[_0x400a('0x1a')](_0x400a('0x37'),_0x2b7b68,_0x400a('0x39')))},function(){rimraf(path[_0x400a('0x33')](_0x248d41,_0x2b7b68),function(){});_0x4e4bf5(_0x400a('0x3a'));});});}})[_0x400a('0x28')](function(){if(!_0x208943)return;rimraf(path[_0x400a('0x33')](_0x248d41,_0x2b7b68),function(){});})[_0x400a('0x28')](function(){logger['info'](util[_0x400a('0x1a')](_0x400a('0x3b'),EXTRACTED_REPORT_ID,'PDF'));return analyticExtractedReport('Completed',_0x208943?util[_0x400a('0x1a')](_0x400a('0x37'),_0x2b7b68,_0x208943?'zip':_0x400a('0x3c')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0x400a('0x3d')](util[_0x400a('0x1a')](_0x400a('0x3e'),EXTRACTED_REPORT_ID,_0x400a('0x3f')));return db['AnalyticExtractedReport'][_0x400a('0x40')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0x400a('0x28')](function(_0x350c69){EXTRACTED_REPORT=_0x350c69;return dbH[_0x400a('0x2a')][_0x400a('0x2d')](util[_0x400a('0x1a')](_0x400a('0x41'),QUERY),{'type':dbH[_0x400a('0x2a')][_0x400a('0x2c')][_0x400a('0x2e')]});})[_0x400a('0x28')](extractReport)[_0x400a('0x42')](function(_0x2b8560){logger[_0x400a('0x3d')](util[_0x400a('0x1a')](_0x400a('0x43'),EXTRACTED_REPORT_ID,_0x400a('0x3f')),util[_0x400a('0x44')](_0x2b8560,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x400a('0x45'));})[_0x400a('0x46')](function(){process[_0x400a('0x47')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x120b1b=new PdfPrinter({'Arial':{'normal':__dirname+'/fonts/arial-regular.ttf','bold':__dirname+'/fonts/arial-bold.ttf','italics':__dirname+_0x400a('0x48'),'bolditalics':__dirname+_0x400a('0x49')}});return _0x120b1b;}function getPDFDocDefinitionFromHTML(_0xbfd267,_0x47503b){var _0x1853a0=util[_0x400a('0x1a')]('%s\x20#%d',_0x47503b[_0x400a('0x4a')],_0x47503b[_0x400a('0x4b')]);var _0x47f633=moment()[_0x400a('0x1a')](_0x400a('0x4c'))['toString']();var _0x3dbaad=htmlToPdfmake(_0xbfd267,{'window':window,'tableAutoSize':!![]});return{'content':[_0x3dbaad],'defaultStyle':{'font':_0x400a('0x22')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0x400a('0x4d'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0x400a('0x4d'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0x400a('0x4d')}},'header':function(){return[{'text':'Interaction\x20Transcript','style':_0x400a('0x4e')}];},'footer':function(_0x543d53,_0x33706c){return[{'text':util[_0x400a('0x1a')]('\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s',_0x1853a0,_0x543d53,_0x33706c,_0x47f633),'style':_0x400a('0x21')}];}};}function writePDFDocument(_0x39b2f4,_0x10a9ef){return new Promise(function(_0x15c740,_0x3b8618){var _0x1802a1=_0x39b2f4[_0x400a('0x4f')](fs[_0x400a('0x50')](_0x10a9ef));_0x1802a1['on']('finish',function(){_0x15c740(_0x400a('0x51'));});_0x1802a1['on'](_0x400a('0x52'),function(_0x49300c){_0x3b8618(_0x49300c);});_0x39b2f4['end']();});}exports[_0x400a('0x53')]=function(_0x5c7cec,_0x59b304){var _0x58745c=getPDFPrinter();var _0x42be4b=getPDFDocDefinitionFromHTML(_0x5c7cec,_0x59b304);var _0x4a6ff2=_0x58745c[_0x400a('0x35')](_0x42be4b);return writePDFDocument(_0x4a6ff2,_0x59b304[_0x400a('0x2')])[_0x400a('0x42')](function(_0x24cffe){throw _0x24cffe;});}; \ No newline at end of file diff --git a/server/components/export/xlsx.js b/server/components/export/xlsx.js index 7eabfd8..577ddf3 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 _0xc7ee=['dirname','.xlsx','existsSync','join','mkdirSync','each','%s%d.%s','xlsx','writeFileSync','%s.%s','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','zip','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','exit','util','path','lodash','json2xls','bluebird','zip-dir','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','info','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','Setting','find','split','splitSizeXlsx','then','sequelize','query','format','SELECT','Empty','length','range','num','forEach','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','push'];(function(_0x283376,_0x485afa){var _0x159184=function(_0x359fca){while(--_0x359fca){_0x283376['push'](_0x283376['shift']());}};_0x159184(++_0x485afa);}(_0xc7ee,0x1aa));var _0xec7e=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0xc7ee[_0x3bf83f];return _0x22c4a9;};'use strict';var util=require(_0xec7e('0x0'));var path=require(_0xec7e('0x1'));var _=require(_0xec7e('0x2'));var fs=require('fs');var json2xls=require(_0xec7e('0x3'));var BPromise=require(_0xec7e('0x4'));var zipdir=require(_0xec7e('0x5'));var rimraf=require('rimraf');var db=require(_0xec7e('0x6'))['db'];var dbH=require(_0xec7e('0x6'))[_0xec7e('0x7')];var logger=require(_0xec7e('0x8'))(_0xec7e('0x9'));var EXTRACTED_REPORT_ID=Number(process[_0xec7e('0xa')][0x2]);var QUERY=process[_0xec7e('0xa')][0x3];var PATH=process[_0xec7e('0xa')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x6c6886,_0x42b468){var _0x2d1f7f={'status':_0x6c6886};var _0x37d03a={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x42b468){_0x2d1f7f[_0xec7e('0xb')]=_0x42b468;}return db[_0xec7e('0xc')]['update'](_0x2d1f7f,_0x37d03a);}function main(){var _0x311495=0x1388;var _0x25ee79;logger[_0xec7e('0xd')](util['format'](_0xec7e('0xe'),EXTRACTED_REPORT_ID,_0xec7e('0xf')));return db[_0xec7e('0x10')][_0xec7e('0x11')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xec7e('0x12'),_0xec7e('0x13')]})[_0xec7e('0x14')](function(_0x6fabd4){if(_0x6fabd4){_0x25ee79=_0x6fabd4;_0x311495=_0x25ee79['splitSizeXlsx']||0x1388;}})[_0xec7e('0x14')](function(){return dbH[_0xec7e('0x15')][_0xec7e('0x16')](util[_0xec7e('0x17')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0xec7e('0x15')]['QueryTypes'][_0xec7e('0x18')]});})[_0xec7e('0x14')](function(_0x22510a){if(!_0x22510a[0x0]['num']){return analyticExtractedReport(_0xec7e('0x19'));}var _0x50bc12=[];var _0x4b25cb=0x0;if(_0x25ee79[_0xec7e('0x12')]){if(_0x22510a&&_0x22510a[_0xec7e('0x1a')]){var _0x252705=_[_0xec7e('0x1b')](_0x22510a[0x0][_0xec7e('0x1c')]/_0x311495);var _0x353ab3=Number['isInteger'](_0x22510a[0x0][_0xec7e('0x1c')]/_0x311495)?_0x22510a[0x0][_0xec7e('0x1c')]%_0x311495:0x0;_0x252705[_0xec7e('0x1d')](function(_0xdb6bc5){if(_0xdb6bc5>0x0){_0x4b25cb+=_0x311495;}_0x50bc12['push'](dbH[_0xec7e('0x15')]['query'](util[_0xec7e('0x17')](_0xec7e('0x1e'),QUERY,_0x311495,_0x4b25cb),{'type':dbH['sequelize'][_0xec7e('0x1f')][_0xec7e('0x18')]}));});if(_0x353ab3>0x0){_0x4b25cb+=_0x311495;_0x50bc12[_0xec7e('0x20')](dbH[_0xec7e('0x15')][_0xec7e('0x16')](util['format']('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x353ab3,_0x4b25cb),{'type':dbH[_0xec7e('0x15')][_0xec7e('0x1f')]['SELECT']}));}}}else{_0x50bc12[_0xec7e('0x20')](dbH['sequelize'][_0xec7e('0x16')](QUERY,{'type':dbH[_0xec7e('0x15')][_0xec7e('0x1f')]['SELECT']}));}var _0x481fb5=path[_0xec7e('0x21')](PATH);var _0x55f819=path['basename'](PATH,_0xec7e('0x22'));var _0x5dc19c=_0x25ee79[_0xec7e('0x12')]&&_0x50bc12[_0xec7e('0x1a')]>0x1;var _0x2f61e7=[];if(!fs[_0xec7e('0x23')](path[_0xec7e('0x24')](_0x481fb5,_0x55f819))&&_0x5dc19c){fs[_0xec7e('0x25')](path['join'](_0x481fb5,_0x55f819));}return BPromise[_0xec7e('0x26')](_0x50bc12,function(_0x337faa){_0x2f61e7[_0xec7e('0x20')](_0x337faa);})[_0xec7e('0x14')](function(){for(var _0x3b2e27=0x0;_0x3b2e27<_0x2f61e7[_0xec7e('0x1a')];_0x3b2e27+=0x1){var _0x24cf8e;var _0x2f9b97=_0x2f61e7[_0x3b2e27];if(_0x5dc19c){_0x24cf8e=path[_0xec7e('0x24')](_0x481fb5,_0x55f819,util['format'](_0xec7e('0x27'),_0x55f819,_0x3b2e27,_0xec7e('0x28')));}else{_0x24cf8e=path[_0xec7e('0x24')](_0x481fb5,util[_0xec7e('0x17')]('%s.%s',_0x55f819,'xlsx'));}fs[_0xec7e('0x29')](_0x24cf8e,json2xls(_0x2f9b97),'binary');}})['then'](function(){if(_0x5dc19c){return new Promise(function(_0x6dedce){zipdir(path[_0xec7e('0x24')](_0x481fb5,_0x55f819),{'saveTo':path[_0xec7e('0x24')](_0x481fb5,util[_0xec7e('0x17')](_0xec7e('0x2a'),_0x55f819,'zip'))},function(_0x19ac47,_0x441ecb){rimraf(path[_0xec7e('0x24')](_0x481fb5,_0x55f819),function(){});_0x6dedce(_0xec7e('0x2b'));});});}})[_0xec7e('0x14')](function(){logger['info'](util['format'](_0xec7e('0x2c'),EXTRACTED_REPORT_ID,_0xec7e('0xf')));return analyticExtractedReport(_0xec7e('0x2d'),_0x5dc19c?util[_0xec7e('0x17')](_0xec7e('0x2a'),_0x55f819,_0x5dc19c?_0xec7e('0x2e'):_0xec7e('0x28')):null);});})[_0xec7e('0x2f')](function(_0x46aa1a){logger[_0xec7e('0xd')](util['format'](_0xec7e('0x30'),EXTRACTED_REPORT_ID,_0xec7e('0xf')),util[_0xec7e('0x31')](_0x46aa1a,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})['finally'](function(){process[_0xec7e('0x32')](EXIT_CODE);});}main(); \ No newline at end of file +var _0x2567=['rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','Setting','find','split','splitSizeXlsx','then','sequelize','query','QueryTypes','num','Empty','length','range','isInteger','forEach','push','%s\x20limit\x20%d\x20OFFSET\x20%d','SELECT','dirname','basename','.xlsx','existsSync','join','mkdirSync','each','%s%d.%s','xlsx','%s.%s','writeFileSync','binary','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','zip','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','util','path','lodash','json2xls','bluebird','zip-dir'];(function(_0x59bd49,_0x412540){var _0x2315c8=function(_0x38e44d){while(--_0x38e44d){_0x59bd49['push'](_0x59bd49['shift']());}};_0x2315c8(++_0x412540);}(_0x2567,0x14a));var _0x7256=function(_0x527221,_0x3ad559){_0x527221=_0x527221-0x0;var _0xdd8990=_0x2567[_0x527221];return _0xdd8990;};'use strict';var util=require(_0x7256('0x0'));var path=require(_0x7256('0x1'));var _=require(_0x7256('0x2'));var fs=require('fs');var json2xls=require(_0x7256('0x3'));var BPromise=require(_0x7256('0x4'));var zipdir=require(_0x7256('0x5'));var rimraf=require(_0x7256('0x6'));var db=require(_0x7256('0x7'))['db'];var dbH=require(_0x7256('0x7'))[_0x7256('0x8')];var logger=require(_0x7256('0x9'))(_0x7256('0xa'));var EXTRACTED_REPORT_ID=Number(process[_0x7256('0xb')][0x2]);var QUERY=process[_0x7256('0xb')][0x3];var PATH=process[_0x7256('0xb')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x55aba0,_0x18d39f){var _0x41ea59={'status':_0x55aba0};var _0x55723d={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x18d39f){_0x41ea59[_0x7256('0xc')]=_0x18d39f;}return db[_0x7256('0xd')][_0x7256('0xe')](_0x41ea59,_0x55723d);}function main(){var _0x3912ca=0x1388;var _0x398271;logger[_0x7256('0xf')](util[_0x7256('0x10')](_0x7256('0x11'),EXTRACTED_REPORT_ID,_0x7256('0x12')));return db[_0x7256('0x13')][_0x7256('0x14')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x7256('0x15'),_0x7256('0x16')]})[_0x7256('0x17')](function(_0x4959b9){if(_0x4959b9){_0x398271=_0x4959b9;_0x3912ca=_0x398271['splitSizeXlsx']||0x1388;}})[_0x7256('0x17')](function(){return dbH[_0x7256('0x18')][_0x7256('0x19')](util[_0x7256('0x10')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0x7256('0x18')][_0x7256('0x1a')]['SELECT']});})[_0x7256('0x17')](function(_0x64cfb4){if(!_0x64cfb4[0x0][_0x7256('0x1b')]){return analyticExtractedReport(_0x7256('0x1c'));}var _0x3bb254=[];var _0x5c6081=0x0;if(_0x398271[_0x7256('0x15')]){if(_0x64cfb4&&_0x64cfb4[_0x7256('0x1d')]){var _0x15f702=_[_0x7256('0x1e')](_0x64cfb4[0x0][_0x7256('0x1b')]/_0x3912ca);var _0xa08eaa=Number[_0x7256('0x1f')](_0x64cfb4[0x0][_0x7256('0x1b')]/_0x3912ca)?_0x64cfb4[0x0][_0x7256('0x1b')]%_0x3912ca:0x0;_0x15f702[_0x7256('0x20')](function(_0x2f1410){if(_0x2f1410>0x0){_0x5c6081+=_0x3912ca;}_0x3bb254[_0x7256('0x21')](dbH[_0x7256('0x18')]['query'](util[_0x7256('0x10')](_0x7256('0x22'),QUERY,_0x3912ca,_0x5c6081),{'type':dbH[_0x7256('0x18')][_0x7256('0x1a')][_0x7256('0x23')]}));});if(_0xa08eaa>0x0){_0x5c6081+=_0x3912ca;_0x3bb254[_0x7256('0x21')](dbH[_0x7256('0x18')][_0x7256('0x19')](util[_0x7256('0x10')](_0x7256('0x22'),QUERY,_0xa08eaa,_0x5c6081),{'type':dbH[_0x7256('0x18')][_0x7256('0x1a')][_0x7256('0x23')]}));}}}else{_0x3bb254[_0x7256('0x21')](dbH[_0x7256('0x18')][_0x7256('0x19')](QUERY,{'type':dbH[_0x7256('0x18')]['QueryTypes'][_0x7256('0x23')]}));}var _0x43bb29=path[_0x7256('0x24')](PATH);var _0xf68163=path[_0x7256('0x25')](PATH,_0x7256('0x26'));var _0x32033c=_0x398271['split']&&_0x3bb254['length']>0x1;var _0x924b10=[];if(!fs[_0x7256('0x27')](path[_0x7256('0x28')](_0x43bb29,_0xf68163))&&_0x32033c){fs[_0x7256('0x29')](path['join'](_0x43bb29,_0xf68163));}return BPromise[_0x7256('0x2a')](_0x3bb254,function(_0x4dd110){_0x924b10[_0x7256('0x21')](_0x4dd110);})[_0x7256('0x17')](function(){for(var _0x5a6659=0x0;_0x5a6659<_0x924b10[_0x7256('0x1d')];_0x5a6659+=0x1){var _0x16e75a;var _0x3357fa=_0x924b10[_0x5a6659];if(_0x32033c){_0x16e75a=path[_0x7256('0x28')](_0x43bb29,_0xf68163,util[_0x7256('0x10')](_0x7256('0x2b'),_0xf68163,_0x5a6659,_0x7256('0x2c')));}else{_0x16e75a=path[_0x7256('0x28')](_0x43bb29,util[_0x7256('0x10')](_0x7256('0x2d'),_0xf68163,'xlsx'));}fs[_0x7256('0x2e')](_0x16e75a,json2xls(_0x3357fa),_0x7256('0x2f'));}})[_0x7256('0x17')](function(){if(_0x32033c){return new Promise(function(_0x3eb620){zipdir(path['join'](_0x43bb29,_0xf68163),{'saveTo':path[_0x7256('0x28')](_0x43bb29,util[_0x7256('0x10')](_0x7256('0x2d'),_0xf68163,'zip'))},function(_0x3ef608,_0x37d398){rimraf(path[_0x7256('0x28')](_0x43bb29,_0xf68163),function(){});_0x3eb620(_0x7256('0x30'));});});}})[_0x7256('0x17')](function(){logger[_0x7256('0xf')](util['format'](_0x7256('0x31'),EXTRACTED_REPORT_ID,_0x7256('0x12')));return analyticExtractedReport(_0x7256('0x32'),_0x32033c?util[_0x7256('0x10')](_0x7256('0x2d'),_0xf68163,_0x32033c?_0x7256('0x33'):_0x7256('0x2c')):null);});})['catch'](function(_0x59df4e){logger[_0x7256('0xf')](util[_0x7256('0x10')](_0x7256('0x34'),EXTRACTED_REPORT_ID,_0x7256('0x12')),util[_0x7256('0x35')](_0x59df4e,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x7256('0x36'));})[_0x7256('0x37')](function(){process['exit'](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/extensions/rewrite.js b/server/components/extensions/rewrite.js index 340ca42..1d5d69a 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 _0x39ea=['sortBy','catch','error','lodash','util','models','Interval','then','intervals','VoiceExtension','findAll','IntervalId','uniq','CAST(priority\x20AS\x20UNSIGNED)','filter','groupBy','exten','queue','playback','hasOwnProperty','priority','extensions','push','type','format','CDR(type)=%s','context','inbound','CDR(routeid)=','VoiceExtensionId','Set','extension','cutdigits','${EXTEN}','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','recordingFormat','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','length','createdAt','updatedAt','interval','map','tag','CDR(tag)=','outbound','callerID','ExecIf','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','answer','indexOf','app','toLowerCase','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','GotoIfTime',',${EXTEN},','last','concat','transaction','destroy','bulkCreate'];(function(_0x1b4260,_0x5aeb6d){var _0x48189f=function(_0x556beb){while(--_0x556beb){_0x1b4260['push'](_0x1b4260['shift']());}};_0x48189f(++_0x5aeb6d);}(_0x39ea,0xd8));var _0xa39e=function(_0x452599,_0x454f00){_0x452599=_0x452599-0x0;var _0x3cb6e5=_0x39ea[_0x452599];return _0x3cb6e5;};'use strict';var _=require(_0xa39e('0x0'));var util=require(_0xa39e('0x1'));function rewrite(_0x3a6926,_0x20c64e){var _0x115395=this;return _0x3a6926[_0xa39e('0x2')][_0xa39e('0x3')]['findAll']({'raw':!![]})[_0xa39e('0x4')](function(_0xc00213){_0x115395[_0xa39e('0x5')]=_0xc00213;return _0x3a6926[_0xa39e('0x2')][_0xa39e('0x6')][_0xa39e('0x7')]({'where':{'IntervalId':_0x20c64e[_0xa39e('0x8')]},'raw':!![]});})[_0xa39e('0x4')](function(_0x149c77){return _0x3a6926[_0xa39e('0x2')][_0xa39e('0x6')]['findAll']({'where':{'exten':{'$in':_[_0xa39e('0x9')](_['map'](_0x149c77,'exten'))}},'order':[{'raw':_0xa39e('0xa')}],'raw':!![]});})[_0xa39e('0x4')](function(_0x4176e1){var _0x35e310=_['filter'](_0x4176e1,{'priority':'1'});var _0x34ea40=_[_0xa39e('0xb')](_0x4176e1,{'isApp':0x1});var _0x40dadf=_[_0xa39e('0xc')](_0x34ea40,_0xa39e('0xd'));var _0x2f4d38=[_0xa39e('0xe'),_0xa39e('0xf')];var _0x17ccef=[];var _0x39141c=[];for(var _0x713b12 in _0x40dadf){if(_0x40dadf[_0xa39e('0x10')](_0x713b12)){_0x115395[_0xa39e('0x11')]=0x2;_0x115395['extensions']=[];_0x115395['extension']=_['find'](_0x35e310,{'exten':_0x40dadf[_0x713b12][0x0][_0xa39e('0xd')]});_0x115395[_0xa39e('0x12')][_0xa39e('0x13')]({'type':_0x40dadf[_0x713b12][0x0][_0xa39e('0x14')],'app':'Set','appdata':util[_0xa39e('0x15')](_0xa39e('0x16'),_0x40dadf[_0x713b12][0x0]['type']),'context':_0x40dadf[_0x713b12][0x0][_0xa39e('0x17')],'exten':_0x40dadf[_0x713b12][0x0][_0xa39e('0xd')],'priority':_0x115395[_0xa39e('0x11')]++,'VoiceExtensionId':_0x40dadf[_0x713b12][0x0]['VoiceExtensionId']});if(_0x40dadf[_0x713b12][0x0][_0xa39e('0x14')]===_0xa39e('0x18')){_0x115395['extensions'][_0xa39e('0x13')]({'type':_0x40dadf[_0x713b12][0x0][_0xa39e('0x14')],'app':'Set','appdata':_0xa39e('0x19')+_0x40dadf[_0x713b12][0x0][_0xa39e('0x1a')],'context':_0x40dadf[_0x713b12][0x0][_0xa39e('0x17')],'exten':_0x40dadf[_0x713b12][0x0][_0xa39e('0xd')],'priority':_0x115395[_0xa39e('0x11')]++,'VoiceExtensionId':_0x40dadf[_0x713b12][0x0]['VoiceExtensionId']});}else if(_0x40dadf[_0x713b12][0x0][_0xa39e('0x14')]==='outbound'){if(_0x115395['extension']){_0x115395[_0xa39e('0x12')]['push']({'type':_0x40dadf[_0x713b12][0x0][_0xa39e('0x14')],'app':_0xa39e('0x1b'),'appdata':'CDR(destination)='+(_0x115395[_0xa39e('0x1c')][_0xa39e('0x1d')]?'${EXTEN:'+_0x115395[_0xa39e('0x1c')][_0xa39e('0x1d')]+'}':_0xa39e('0x1e')),'context':_0x40dadf[_0x713b12][0x0]['context'],'exten':_0x40dadf[_0x713b12][0x0][_0xa39e('0xd')],'priority':_0x115395['priority']++,'VoiceExtensionId':_0x40dadf[_0x713b12][0x0][_0xa39e('0x1a')]});}_0x115395['extensions']['push']({'type':_0x40dadf[_0x713b12][0x0]['type'],'app':'Set','appdata':_0xa39e('0x19')+_0x40dadf[_0x713b12][0x0]['VoiceExtensionId'],'context':_0x40dadf[_0x713b12][0x0][_0xa39e('0x17')],'exten':_0x40dadf[_0x713b12][0x0]['exten'],'priority':_0x115395[_0xa39e('0x11')]++,'VoiceExtensionId':_0x40dadf[_0x713b12][0x0][_0xa39e('0x1a')]});var _0xa91992=_0x115395[_0xa39e('0x11')]++;_0x115395[_0xa39e('0x12')][_0xa39e('0x13')]({'type':_0x40dadf[_0x713b12][0x0][_0xa39e('0x14')],'app':'ExecIf','appdata':'$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto('+(_0xa91992+0x2)+_0xa39e('0x1f')+(_0xa91992+0x1)+')','context':_0x40dadf[_0x713b12][0x0]['context'],'exten':_0x40dadf[_0x713b12][0x0][_0xa39e('0xd')],'priority':_0xa91992,'VoiceExtensionId':_0x40dadf[_0x713b12][0x0][_0xa39e('0x1a')]});if(_0x115395[_0xa39e('0x1c')]){_0x115395[_0xa39e('0x12')]['push']({'type':_0x40dadf[_0x713b12][0x0][_0xa39e('0x14')],'app':_0xa39e('0x1b'),'appdata':_0x115395[_0xa39e('0x1c')][_0xa39e('0x1d')]?_0xa39e('0x20')+_0x115395[_0xa39e('0x1c')]['cutdigits']+'}':_0xa39e('0x21'),'context':_0x40dadf[_0x713b12][0x0]['context'],'exten':_0x40dadf[_0x713b12][0x0][_0xa39e('0xd')],'priority':_0x115395[_0xa39e('0x11')]++,'VoiceExtensionId':_0x40dadf[_0x713b12][0x0]['VoiceExtensionId']});}_0x115395[_0xa39e('0x12')]['push']({'type':_0x40dadf[_0x713b12][0x0]['type'],'app':'Set','appdata':_0xa39e('0x22')+_0x40dadf[_0x713b12][0x0]['VoiceExtensionId'],'context':_0x40dadf[_0x713b12][0x0][_0xa39e('0x17')],'exten':_0x40dadf[_0x713b12][0x0][_0xa39e('0xd')],'priority':_0x115395[_0xa39e('0x11')]++,'VoiceExtensionId':_0x40dadf[_0x713b12][0x0][_0xa39e('0x1a')]});if(_0x115395[_0xa39e('0x1c')]&&_0x115395['extension'][_0xa39e('0x10')]('recordingFormat')&&_0x115395[_0xa39e('0x1c')][_0xa39e('0x23')]!=='none'){_0x115395[_0xa39e('0x12')][_0xa39e('0x13')]({'type':_0x40dadf[_0x713b12][0x0][_0xa39e('0x14')],'app':_0xa39e('0x1b'),'appdata':_0xa39e('0x24'),'context':_0x40dadf[_0x713b12][0x0][_0xa39e('0x17')],'exten':_0x40dadf[_0x713b12][0x0]['exten'],'priority':_0x115395[_0xa39e('0x11')]++,'VoiceExtensionId':_0x40dadf[_0x713b12][0x0][_0xa39e('0x1a')]});_0x115395['extensions'][_0xa39e('0x13')]({'type':_0x40dadf[_0x713b12][0x0]['type'],'app':_0xa39e('0x1b'),'appdata':_0xa39e('0x25')+_0x115395[_0xa39e('0x1c')][_0xa39e('0x23')]||_0xa39e('0x26'),'context':_0x40dadf[_0x713b12][0x0][_0xa39e('0x17')],'exten':_0x40dadf[_0x713b12][0x0][_0xa39e('0xd')],'priority':_0x115395[_0xa39e('0x11')]++,'VoiceExtensionId':_0x40dadf[_0x713b12][0x0][_0xa39e('0x1a')]});}}_0x115395[_0xa39e('0x12')]['push']({'type':_0x40dadf[_0x713b12][0x0]['type'],'app':_0xa39e('0x1b'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0x40dadf[_0x713b12][0x0][_0xa39e('0x17')],'exten':_0x40dadf[_0x713b12][0x0][_0xa39e('0xd')],'priority':_0x115395[_0xa39e('0x11')]++,'VoiceExtensionId':_0x40dadf[_0x713b12][0x0][_0xa39e('0x1a')]});_0x115395[_0xa39e('0x12')][_0xa39e('0x13')]({'type':_0x40dadf[_0x713b12][0x0][_0xa39e('0x14')],'app':'Set','appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x40dadf[_0x713b12][0x0]['context'],'exten':_0x40dadf[_0x713b12][0x0][_0xa39e('0xd')],'priority':_0x115395[_0xa39e('0x11')]++,'VoiceExtensionId':_0x40dadf[_0x713b12][0x0][_0xa39e('0x1a')]});_0x115395[_0xa39e('0x12')][_0xa39e('0x13')]({'type':_0x40dadf[_0x713b12][0x0][_0xa39e('0x14')],'app':_0xa39e('0x1b'),'appdata':'MONITOR_OPTIONS=ab','context':_0x40dadf[_0x713b12][0x0][_0xa39e('0x17')],'exten':_0x40dadf[_0x713b12][0x0][_0xa39e('0xd')],'priority':_0x115395[_0xa39e('0x11')]++,'VoiceExtensionId':_0x40dadf[_0x713b12][0x0]['VoiceExtensionId']});for(var _0xd4c0d9=0x0,_0x3e1df3=0x0;_0xd4c0d9<_0x40dadf[_0x713b12][_0xa39e('0x27')];_0xd4c0d9+=0x1,_0x3e1df3=0x0){var _0xf27235=_0x40dadf[_0x713b12][_0xd4c0d9];if(_0xf27235[_0xa39e('0x14')]){_0xf27235[_0xa39e('0x14')]=_0xf27235['type']['toLowerCase']();}var _0x467e07=[];var _0x42b24a=[];delete _0xf27235['id'];delete _0xf27235[_0xa39e('0x28')];delete _0xf27235[_0xa39e('0x29')];var _0xbcd05c=_0xf27235[_0xa39e('0x2a')]!=='*,*,*,*'?[_0xf27235['interval']]:_0xf27235[_0xa39e('0x8')]?_[_0xa39e('0x2b')](_[_0xa39e('0xb')](_0x115395[_0xa39e('0x5')],{'IntervalId':_0xf27235['IntervalId']}),_0xa39e('0x2a')):[];if(_0xf27235[_0xa39e('0x10')](_0xa39e('0x2c'))){if(_0xf27235[_0xa39e('0x2c')]&&_0xf27235[_0xa39e('0x2c')]!=='--'){_0x467e07[_0xa39e('0x13')]({'type':_0xf27235['type'],'app':_0xa39e('0x1b'),'appdata':_0xa39e('0x2d')+_0xf27235[_0xa39e('0x2c')],'context':_0xf27235[_0xa39e('0x17')],'exten':_0xf27235[_0xa39e('0xd')],'priority':_0xbcd05c['length']+_0x115395[_0xa39e('0x11')]+_0x3e1df3++,'VoiceExtensionId':_0xf27235['VoiceExtensionId']});}}if(_0xf27235['type']===_0xa39e('0x2e')&&_0xf27235[_0xa39e('0x10')](_0xa39e('0x2f'))){if(_0xf27235[_0xa39e('0x2f')]){_0x467e07[_0xa39e('0x13')]({'type':_0xf27235['type'],'app':_0xa39e('0x30'),'appdata':_0xa39e('0x31')+_0xf27235[_0xa39e('0x2f')]+')','context':_0xf27235[_0xa39e('0x17')],'exten':_0xf27235[_0xa39e('0xd')],'priority':_0xbcd05c['length']+_0x115395[_0xa39e('0x11')]+_0x3e1df3++,'VoiceExtensionId':_0xf27235[_0xa39e('0x1a')]});}else{_0x467e07['push']({'type':_0xf27235[_0xa39e('0x14')],'app':_0xa39e('0x30'),'appdata':_0xa39e('0x32'),'context':_0xf27235['context'],'exten':_0xf27235[_0xa39e('0xd')],'priority':_0xbcd05c[_0xa39e('0x27')]+_0x115395[_0xa39e('0x11')]+_0x3e1df3++,'VoiceExtensionId':_0xf27235[_0xa39e('0x1a')]});}}if(_0xf27235[_0xa39e('0x10')](_0xa39e('0x33'))){if(_0x2f4d38[_0xa39e('0x34')](_0xf27235[_0xa39e('0x35')][_0xa39e('0x36')]())>=0x0&&_0xf27235[_0xa39e('0x37')]!==_0xa39e('0x38')){if(_0xf27235[_0xa39e('0x33')]){_0x467e07['push']({'type':_0xf27235[_0xa39e('0x14')],'app':_0xa39e('0x30'),'appdata':_0xa39e('0x39'),'context':_0xf27235[_0xa39e('0x17')],'exten':_0xf27235[_0xa39e('0xd')],'priority':_0xbcd05c[_0xa39e('0x27')]+_0x115395[_0xa39e('0x11')]+_0x3e1df3++,'VoiceExtensionId':_0xf27235['VoiceExtensionId']});_0x467e07[_0xa39e('0x13')]({'type':_0xf27235[_0xa39e('0x14')],'app':_0xa39e('0x1b'),'appdata':_0xa39e('0x3a'),'context':_0xf27235[_0xa39e('0x17')],'exten':_0xf27235[_0xa39e('0xd')],'priority':_0xbcd05c[_0xa39e('0x27')]+_0x115395[_0xa39e('0x11')]+_0x3e1df3++,'VoiceExtensionId':_0xf27235[_0xa39e('0x1a')]});}else{_0x467e07[_0xa39e('0x13')]({'type':_0xf27235[_0xa39e('0x14')],'app':_0xa39e('0x30'),'appdata':_0xa39e('0x3b'),'context':_0xf27235[_0xa39e('0x17')],'exten':_0xf27235[_0xa39e('0xd')],'priority':_0xbcd05c[_0xa39e('0x27')]+_0x115395['priority']+_0x3e1df3++,'VoiceExtensionId':_0xf27235['VoiceExtensionId']});_0x467e07[_0xa39e('0x13')]({'type':_0xf27235[_0xa39e('0x14')],'app':_0xa39e('0x1b'),'appdata':_0xa39e('0x3c'),'context':_0xf27235['context'],'exten':_0xf27235['exten'],'priority':_0xbcd05c[_0xa39e('0x27')]+_0x115395[_0xa39e('0x11')]+_0x3e1df3++,'VoiceExtensionId':_0xf27235[_0xa39e('0x1a')]});}}}for(var _0xe2d4bd=0x0;_0xe2d4bd<_0xbcd05c[_0xa39e('0x27')];_0xe2d4bd+=0x1){var _0x39f9d8=_0x115395[_0xa39e('0x11')]+_0xbcd05c[_0xa39e('0x27')];var _0x394b2a=_0xe2d4bd===_0xbcd05c[_0xa39e('0x27')]-0x1?_0x115395['priority']+_0x467e07[_0xa39e('0x27')]+_0x42b24a[_0xa39e('0x27')]+0x2:_0x115395['priority']+_0xe2d4bd+0x1;_0x467e07['splice'](_0xe2d4bd,0x0,{'type':_0xf27235[_0xa39e('0x14')],'app':_0xa39e('0x3d'),'appdata':_0xbcd05c[_0xe2d4bd]+'?'+_0xf27235[_0xa39e('0x17')]+',${EXTEN},'+_0x39f9d8+':'+_0xf27235[_0xa39e('0x17')]+_0xa39e('0x3e')+_0x394b2a,'exten':_0xf27235[_0xa39e('0xd')],'context':_0xf27235[_0xa39e('0x17')],'priority':_0x115395['priority']+_0xe2d4bd,'VoiceExtensionId':_0x40dadf[_0x713b12][0x0][_0xa39e('0x1a')]});}_0xf27235[_0xa39e('0x11')]=_0x467e07['length']?_[_0xa39e('0x3f')](_0x467e07)[_0xa39e('0x11')]+0x1:_0x115395[_0xa39e('0x11')];_0x115395[_0xa39e('0x11')]=(_0x42b24a['length']?_[_0xa39e('0x3f')](_0x42b24a)[_0xa39e('0x11')]:_0xf27235[_0xa39e('0x11')])+0x1;_0x115395[_0xa39e('0x12')]=_['concat'](_0x115395[_0xa39e('0x12')],_0x467e07,[_0xf27235],_0x42b24a);}_0x115395[_0xa39e('0x12')]['push']({'type':_0x40dadf[_0x713b12][0x0]['type'],'app':'Hangup','exten':_0x40dadf[_0x713b12][0x0][_0xa39e('0xd')],'context':_0x40dadf[_0x713b12][0x0][_0xa39e('0x17')],'priority':_0x115395['priority'],'VoiceExtensionId':_0x40dadf[_0x713b12][0x0][_0xa39e('0x1a')]});_0x17ccef[_0xa39e('0x13')](_0x40dadf[_0x713b12][0x0]['VoiceExtensionId']);_0x39141c=_[_0xa39e('0x40')](_0x39141c,_0x115395[_0xa39e('0x12')]);}}return _0x3a6926[_0xa39e('0x41')](function(_0xd237fa){return _0x3a6926[_0xa39e('0x2')][_0xa39e('0x6')][_0xa39e('0x42')]({'where':{'VoiceExtensionId':{'$in':_0x17ccef}},'transaction':_0xd237fa})[_0xa39e('0x4')](function(_0x5277f2){return _0x3a6926['models'][_0xa39e('0x6')][_0xa39e('0x43')](_[_0xa39e('0x44')](_0x39141c,_0xa39e('0x11')),{'transaction':_0xd237fa});});});})[_0xa39e('0x45')](function(_0x31fcd9){console[_0xa39e('0x46')](_0x31fcd9);});}exports['rewrite']=rewrite; \ No newline at end of file +var _0xe771=['CDR(tag)=','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','answer','indexOf','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice',',${EXTEN},','last','Hangup','concat','transaction','destroy','bulkCreate','catch','error','rewrite','lodash','util','Interval','findAll','then','intervals','models','VoiceExtension','IntervalId','map','CAST(priority\x20AS\x20UNSIGNED)','filter','groupBy','queue','hasOwnProperty','priority','extensions','find','exten','type','Set','CDR(type)=%s','context','inbound','CDR(routeid)=','VoiceExtensionId','outbound','extension','push','CDR(destination)=','${EXTEN:','cutdigits','${EXTEN}','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','length','toLowerCase','createdAt','interval','*,*,*,*','tag'];(function(_0x4a479f,_0x9b870){var _0x30c771=function(_0x5f5a01){while(--_0x5f5a01){_0x4a479f['push'](_0x4a479f['shift']());}};_0x30c771(++_0x9b870);}(_0xe771,0x179));var _0x1e77=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0xe771[_0x138adb];return _0x1b27f2;};'use strict';var _=require(_0x1e77('0x0'));var util=require(_0x1e77('0x1'));function rewrite(_0x52953e,_0x39296b){var _0x5c91a8=this;return _0x52953e['models'][_0x1e77('0x2')][_0x1e77('0x3')]({'raw':!![]})[_0x1e77('0x4')](function(_0x3d161b){_0x5c91a8[_0x1e77('0x5')]=_0x3d161b;return _0x52953e[_0x1e77('0x6')][_0x1e77('0x7')][_0x1e77('0x3')]({'where':{'IntervalId':_0x39296b[_0x1e77('0x8')]},'raw':!![]});})['then'](function(_0x566ada){return _0x52953e['models'][_0x1e77('0x7')][_0x1e77('0x3')]({'where':{'exten':{'$in':_['uniq'](_[_0x1e77('0x9')](_0x566ada,'exten'))}},'order':[{'raw':_0x1e77('0xa')}],'raw':!![]});})[_0x1e77('0x4')](function(_0x253e3b){var _0x18a6fd=_[_0x1e77('0xb')](_0x253e3b,{'priority':'1'});var _0x5eb105=_[_0x1e77('0xb')](_0x253e3b,{'isApp':0x1});var _0x1f3329=_[_0x1e77('0xc')](_0x5eb105,'exten');var _0x2fae2c=[_0x1e77('0xd'),'playback'];var _0x50030e=[];var _0x3bae30=[];for(var _0x3dbc22 in _0x1f3329){if(_0x1f3329[_0x1e77('0xe')](_0x3dbc22)){_0x5c91a8[_0x1e77('0xf')]=0x2;_0x5c91a8[_0x1e77('0x10')]=[];_0x5c91a8['extension']=_[_0x1e77('0x11')](_0x18a6fd,{'exten':_0x1f3329[_0x3dbc22][0x0][_0x1e77('0x12')]});_0x5c91a8[_0x1e77('0x10')]['push']({'type':_0x1f3329[_0x3dbc22][0x0][_0x1e77('0x13')],'app':_0x1e77('0x14'),'appdata':util['format'](_0x1e77('0x15'),_0x1f3329[_0x3dbc22][0x0]['type']),'context':_0x1f3329[_0x3dbc22][0x0][_0x1e77('0x16')],'exten':_0x1f3329[_0x3dbc22][0x0][_0x1e77('0x12')],'priority':_0x5c91a8[_0x1e77('0xf')]++,'VoiceExtensionId':_0x1f3329[_0x3dbc22][0x0]['VoiceExtensionId']});if(_0x1f3329[_0x3dbc22][0x0]['type']===_0x1e77('0x17')){_0x5c91a8[_0x1e77('0x10')]['push']({'type':_0x1f3329[_0x3dbc22][0x0][_0x1e77('0x13')],'app':'Set','appdata':_0x1e77('0x18')+_0x1f3329[_0x3dbc22][0x0][_0x1e77('0x19')],'context':_0x1f3329[_0x3dbc22][0x0][_0x1e77('0x16')],'exten':_0x1f3329[_0x3dbc22][0x0][_0x1e77('0x12')],'priority':_0x5c91a8[_0x1e77('0xf')]++,'VoiceExtensionId':_0x1f3329[_0x3dbc22][0x0][_0x1e77('0x19')]});}else if(_0x1f3329[_0x3dbc22][0x0][_0x1e77('0x13')]===_0x1e77('0x1a')){if(_0x5c91a8[_0x1e77('0x1b')]){_0x5c91a8['extensions'][_0x1e77('0x1c')]({'type':_0x1f3329[_0x3dbc22][0x0]['type'],'app':'Set','appdata':_0x1e77('0x1d')+(_0x5c91a8[_0x1e77('0x1b')]['cutdigits']?_0x1e77('0x1e')+_0x5c91a8[_0x1e77('0x1b')][_0x1e77('0x1f')]+'}':_0x1e77('0x20')),'context':_0x1f3329[_0x3dbc22][0x0][_0x1e77('0x16')],'exten':_0x1f3329[_0x3dbc22][0x0][_0x1e77('0x12')],'priority':_0x5c91a8[_0x1e77('0xf')]++,'VoiceExtensionId':_0x1f3329[_0x3dbc22][0x0][_0x1e77('0x19')]});}_0x5c91a8[_0x1e77('0x10')][_0x1e77('0x1c')]({'type':_0x1f3329[_0x3dbc22][0x0][_0x1e77('0x13')],'app':_0x1e77('0x14'),'appdata':_0x1e77('0x18')+_0x1f3329[_0x3dbc22][0x0][_0x1e77('0x19')],'context':_0x1f3329[_0x3dbc22][0x0][_0x1e77('0x16')],'exten':_0x1f3329[_0x3dbc22][0x0][_0x1e77('0x12')],'priority':_0x5c91a8[_0x1e77('0xf')]++,'VoiceExtensionId':_0x1f3329[_0x3dbc22][0x0][_0x1e77('0x19')]});var _0x364fc9=_0x5c91a8[_0x1e77('0xf')]++;_0x5c91a8[_0x1e77('0x10')]['push']({'type':_0x1f3329[_0x3dbc22][0x0][_0x1e77('0x13')],'app':_0x1e77('0x21'),'appdata':_0x1e77('0x22')+(_0x364fc9+0x2)+_0x1e77('0x23')+(_0x364fc9+0x1)+')','context':_0x1f3329[_0x3dbc22][0x0][_0x1e77('0x16')],'exten':_0x1f3329[_0x3dbc22][0x0][_0x1e77('0x12')],'priority':_0x364fc9,'VoiceExtensionId':_0x1f3329[_0x3dbc22][0x0][_0x1e77('0x19')]});if(_0x5c91a8[_0x1e77('0x1b')]){_0x5c91a8[_0x1e77('0x10')][_0x1e77('0x1c')]({'type':_0x1f3329[_0x3dbc22][0x0]['type'],'app':_0x1e77('0x14'),'appdata':_0x5c91a8[_0x1e77('0x1b')][_0x1e77('0x1f')]?_0x1e77('0x24')+_0x5c91a8['extension'][_0x1e77('0x1f')]+'}':'CDR(prefix)=noprefix','context':_0x1f3329[_0x3dbc22][0x0][_0x1e77('0x16')],'exten':_0x1f3329[_0x3dbc22][0x0][_0x1e77('0x12')],'priority':_0x5c91a8[_0x1e77('0xf')]++,'VoiceExtensionId':_0x1f3329[_0x3dbc22][0x0][_0x1e77('0x19')]});}_0x5c91a8['extensions'][_0x1e77('0x1c')]({'type':_0x1f3329[_0x3dbc22][0x0][_0x1e77('0x13')],'app':_0x1e77('0x14'),'appdata':'outboundrouteid='+_0x1f3329[_0x3dbc22][0x0][_0x1e77('0x19')],'context':_0x1f3329[_0x3dbc22][0x0][_0x1e77('0x16')],'exten':_0x1f3329[_0x3dbc22][0x0]['exten'],'priority':_0x5c91a8[_0x1e77('0xf')]++,'VoiceExtensionId':_0x1f3329[_0x3dbc22][0x0][_0x1e77('0x19')]});if(_0x5c91a8['extension']&&_0x5c91a8[_0x1e77('0x1b')][_0x1e77('0xe')](_0x1e77('0x25'))&&_0x5c91a8[_0x1e77('0x1b')]['recordingFormat']!==_0x1e77('0x26')){_0x5c91a8[_0x1e77('0x10')][_0x1e77('0x1c')]({'type':_0x1f3329[_0x3dbc22][0x0][_0x1e77('0x13')],'app':_0x1e77('0x14'),'appdata':_0x1e77('0x27'),'context':_0x1f3329[_0x3dbc22][0x0][_0x1e77('0x16')],'exten':_0x1f3329[_0x3dbc22][0x0]['exten'],'priority':_0x5c91a8[_0x1e77('0xf')]++,'VoiceExtensionId':_0x1f3329[_0x3dbc22][0x0]['VoiceExtensionId']});_0x5c91a8[_0x1e77('0x10')][_0x1e77('0x1c')]({'type':_0x1f3329[_0x3dbc22][0x0][_0x1e77('0x13')],'app':_0x1e77('0x14'),'appdata':_0x1e77('0x28')+_0x5c91a8[_0x1e77('0x1b')][_0x1e77('0x25')]||'wav','context':_0x1f3329[_0x3dbc22][0x0][_0x1e77('0x16')],'exten':_0x1f3329[_0x3dbc22][0x0][_0x1e77('0x12')],'priority':_0x5c91a8[_0x1e77('0xf')]++,'VoiceExtensionId':_0x1f3329[_0x3dbc22][0x0][_0x1e77('0x19')]});}}_0x5c91a8['extensions']['push']({'type':_0x1f3329[_0x3dbc22][0x0][_0x1e77('0x13')],'app':_0x1e77('0x14'),'appdata':_0x1e77('0x29'),'context':_0x1f3329[_0x3dbc22][0x0][_0x1e77('0x16')],'exten':_0x1f3329[_0x3dbc22][0x0][_0x1e77('0x12')],'priority':_0x5c91a8[_0x1e77('0xf')]++,'VoiceExtensionId':_0x1f3329[_0x3dbc22][0x0][_0x1e77('0x19')]});_0x5c91a8[_0x1e77('0x10')][_0x1e77('0x1c')]({'type':_0x1f3329[_0x3dbc22][0x0]['type'],'app':_0x1e77('0x14'),'appdata':_0x1e77('0x2a'),'context':_0x1f3329[_0x3dbc22][0x0][_0x1e77('0x16')],'exten':_0x1f3329[_0x3dbc22][0x0][_0x1e77('0x12')],'priority':_0x5c91a8[_0x1e77('0xf')]++,'VoiceExtensionId':_0x1f3329[_0x3dbc22][0x0][_0x1e77('0x19')]});_0x5c91a8[_0x1e77('0x10')][_0x1e77('0x1c')]({'type':_0x1f3329[_0x3dbc22][0x0][_0x1e77('0x13')],'app':_0x1e77('0x14'),'appdata':'MONITOR_OPTIONS=ab','context':_0x1f3329[_0x3dbc22][0x0][_0x1e77('0x16')],'exten':_0x1f3329[_0x3dbc22][0x0][_0x1e77('0x12')],'priority':_0x5c91a8[_0x1e77('0xf')]++,'VoiceExtensionId':_0x1f3329[_0x3dbc22][0x0][_0x1e77('0x19')]});for(var _0x4a108d=0x0,_0x2f47b0=0x0;_0x4a108d<_0x1f3329[_0x3dbc22][_0x1e77('0x2b')];_0x4a108d+=0x1,_0x2f47b0=0x0){var _0x3242ca=_0x1f3329[_0x3dbc22][_0x4a108d];if(_0x3242ca['type']){_0x3242ca['type']=_0x3242ca[_0x1e77('0x13')][_0x1e77('0x2c')]();}var _0x506932=[];var _0x166d97=[];delete _0x3242ca['id'];delete _0x3242ca[_0x1e77('0x2d')];delete _0x3242ca['updatedAt'];var _0x1c40f1=_0x3242ca[_0x1e77('0x2e')]!==_0x1e77('0x2f')?[_0x3242ca[_0x1e77('0x2e')]]:_0x3242ca[_0x1e77('0x8')]?_[_0x1e77('0x9')](_[_0x1e77('0xb')](_0x5c91a8['intervals'],{'IntervalId':_0x3242ca['IntervalId']}),'interval'):[];if(_0x3242ca['hasOwnProperty'](_0x1e77('0x30'))){if(_0x3242ca[_0x1e77('0x30')]&&_0x3242ca[_0x1e77('0x30')]!=='--'){_0x506932[_0x1e77('0x1c')]({'type':_0x3242ca[_0x1e77('0x13')],'app':_0x1e77('0x14'),'appdata':_0x1e77('0x31')+_0x3242ca[_0x1e77('0x30')],'context':_0x3242ca[_0x1e77('0x16')],'exten':_0x3242ca[_0x1e77('0x12')],'priority':_0x1c40f1['length']+_0x5c91a8['priority']+_0x2f47b0++,'VoiceExtensionId':_0x3242ca[_0x1e77('0x19')]});}}if(_0x3242ca[_0x1e77('0x13')]===_0x1e77('0x1a')&&_0x3242ca['hasOwnProperty'](_0x1e77('0x32'))){if(_0x3242ca[_0x1e77('0x32')]){_0x506932[_0x1e77('0x1c')]({'type':_0x3242ca[_0x1e77('0x13')],'app':_0x1e77('0x21'),'appdata':_0x1e77('0x33')+_0x3242ca[_0x1e77('0x32')]+')','context':_0x3242ca[_0x1e77('0x16')],'exten':_0x3242ca['exten'],'priority':_0x1c40f1[_0x1e77('0x2b')]+_0x5c91a8[_0x1e77('0xf')]+_0x2f47b0++,'VoiceExtensionId':_0x3242ca[_0x1e77('0x19')]});}else{_0x506932[_0x1e77('0x1c')]({'type':_0x3242ca[_0x1e77('0x13')],'app':_0x1e77('0x21'),'appdata':_0x1e77('0x34'),'context':_0x3242ca['context'],'exten':_0x3242ca[_0x1e77('0x12')],'priority':_0x1c40f1[_0x1e77('0x2b')]+_0x5c91a8['priority']+_0x2f47b0++,'VoiceExtensionId':_0x3242ca[_0x1e77('0x19')]});}}if(_0x3242ca['hasOwnProperty'](_0x1e77('0x35'))){if(_0x2fae2c[_0x1e77('0x36')](_0x3242ca['app'][_0x1e77('0x2c')]())>=0x0&&_0x3242ca[_0x1e77('0x37')]!==_0x1e77('0x38')){if(_0x3242ca[_0x1e77('0x35')]){_0x506932[_0x1e77('0x1c')]({'type':_0x3242ca[_0x1e77('0x13')],'app':'ExecIf','appdata':_0x1e77('0x39'),'context':_0x3242ca[_0x1e77('0x16')],'exten':_0x3242ca[_0x1e77('0x12')],'priority':_0x1c40f1['length']+_0x5c91a8[_0x1e77('0xf')]+_0x2f47b0++,'VoiceExtensionId':_0x3242ca['VoiceExtensionId']});_0x506932[_0x1e77('0x1c')]({'type':_0x3242ca[_0x1e77('0x13')],'app':_0x1e77('0x14'),'appdata':'XCALLY-MOTION-ANSWER=1','context':_0x3242ca[_0x1e77('0x16')],'exten':_0x3242ca[_0x1e77('0x12')],'priority':_0x1c40f1['length']+_0x5c91a8[_0x1e77('0xf')]+_0x2f47b0++,'VoiceExtensionId':_0x3242ca[_0x1e77('0x19')]});}else{_0x506932['push']({'type':_0x3242ca[_0x1e77('0x13')],'app':_0x1e77('0x21'),'appdata':_0x1e77('0x3a'),'context':_0x3242ca[_0x1e77('0x16')],'exten':_0x3242ca['exten'],'priority':_0x1c40f1[_0x1e77('0x2b')]+_0x5c91a8['priority']+_0x2f47b0++,'VoiceExtensionId':_0x3242ca['VoiceExtensionId']});_0x506932[_0x1e77('0x1c')]({'type':_0x3242ca[_0x1e77('0x13')],'app':_0x1e77('0x14'),'appdata':_0x1e77('0x3b'),'context':_0x3242ca['context'],'exten':_0x3242ca[_0x1e77('0x12')],'priority':_0x1c40f1['length']+_0x5c91a8[_0x1e77('0xf')]+_0x2f47b0++,'VoiceExtensionId':_0x3242ca[_0x1e77('0x19')]});}}}for(var _0x3e8b00=0x0;_0x3e8b00<_0x1c40f1['length'];_0x3e8b00+=0x1){var _0x4859ef=_0x5c91a8[_0x1e77('0xf')]+_0x1c40f1[_0x1e77('0x2b')];var _0x157e49=_0x3e8b00===_0x1c40f1[_0x1e77('0x2b')]-0x1?_0x5c91a8['priority']+_0x506932[_0x1e77('0x2b')]+_0x166d97[_0x1e77('0x2b')]+0x2:_0x5c91a8[_0x1e77('0xf')]+_0x3e8b00+0x1;_0x506932[_0x1e77('0x3c')](_0x3e8b00,0x0,{'type':_0x3242ca['type'],'app':'GotoIfTime','appdata':_0x1c40f1[_0x3e8b00]+'?'+_0x3242ca[_0x1e77('0x16')]+_0x1e77('0x3d')+_0x4859ef+':'+_0x3242ca[_0x1e77('0x16')]+_0x1e77('0x3d')+_0x157e49,'exten':_0x3242ca['exten'],'context':_0x3242ca[_0x1e77('0x16')],'priority':_0x5c91a8[_0x1e77('0xf')]+_0x3e8b00,'VoiceExtensionId':_0x1f3329[_0x3dbc22][0x0][_0x1e77('0x19')]});}_0x3242ca['priority']=_0x506932['length']?_[_0x1e77('0x3e')](_0x506932)[_0x1e77('0xf')]+0x1:_0x5c91a8['priority'];_0x5c91a8[_0x1e77('0xf')]=(_0x166d97[_0x1e77('0x2b')]?_[_0x1e77('0x3e')](_0x166d97)[_0x1e77('0xf')]:_0x3242ca[_0x1e77('0xf')])+0x1;_0x5c91a8[_0x1e77('0x10')]=_['concat'](_0x5c91a8['extensions'],_0x506932,[_0x3242ca],_0x166d97);}_0x5c91a8[_0x1e77('0x10')][_0x1e77('0x1c')]({'type':_0x1f3329[_0x3dbc22][0x0]['type'],'app':_0x1e77('0x3f'),'exten':_0x1f3329[_0x3dbc22][0x0][_0x1e77('0x12')],'context':_0x1f3329[_0x3dbc22][0x0][_0x1e77('0x16')],'priority':_0x5c91a8[_0x1e77('0xf')],'VoiceExtensionId':_0x1f3329[_0x3dbc22][0x0][_0x1e77('0x19')]});_0x50030e[_0x1e77('0x1c')](_0x1f3329[_0x3dbc22][0x0][_0x1e77('0x19')]);_0x3bae30=_[_0x1e77('0x40')](_0x3bae30,_0x5c91a8[_0x1e77('0x10')]);}}return _0x52953e[_0x1e77('0x41')](function(_0x5bb495){return _0x52953e['models'][_0x1e77('0x7')][_0x1e77('0x42')]({'where':{'VoiceExtensionId':{'$in':_0x50030e}},'transaction':_0x5bb495})['then'](function(_0x387ad5){return _0x52953e[_0x1e77('0x6')][_0x1e77('0x7')][_0x1e77('0x43')](_['sortBy'](_0x3bae30,'priority'),{'transaction':_0x5bb495});});});})[_0x1e77('0x44')](function(_0x413af3){console[_0x1e77('0x45')](_0x413af3);});}exports[_0x1e77('0x46')]=rewrite; \ No newline at end of file diff --git a/server/components/import/cm/csv.js b/server/components/import/cm/csv.js index 992ef12..d754735 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 _0x51f5=['Error\x20while\x20creating\x20contact:\x20','stringify','cmContact','inspect','insert','into','cm_hopper','scheduledAt','ContactId','ListId','createdAt','updatedAt','select','field','NOW()','toString','from','cm_contacts','where','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','\x20=\x20?','id\x20IN\x20?','calleridnum','cm_hopper_final','fromQuery','str','cm_hopper_black','VoiceQueue','dialCheckDuplicateType','CmList','Lists','always','query','VoiceQueueId','onlyIfOpen','sequelize','all','findAll','outbound','BlackLists','get','Campaign','CampaignId','generalCheckHopper','finally','emit','contact:csv_','resume','resolve','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','exit','SIGINT','info','CSV\x20import\x20process\x20stopped!','createReadStream','parse','duplicate','pause','CSV\x20parsed\x20correctly!','Error\x20executing\x20contact\x20csv\x20import:','squel','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','api','defaults','redis','localhost','socket.io-emitter','../../../api/cmContact/cmContact.socket','register','argv','undefined','null','zipObject','split','Missing\x20ListId\x20parameter!','Missing\x20socket_timestamp\x20parameter!','contact','index','test','isNil','error','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','length','map','message','join','hasOwnProperty','data','phone','phone\x20not\x20specified!','birthDate','YYYY-MM-DD','isValid','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','CompanyId','find','Duplicate\x20Contact','CmContact','create','keys','then','push','catch'];(function(_0x49f807,_0x4e6424){var _0x2ef8a6=function(_0x13670a){while(--_0x13670a){_0x49f807['push'](_0x49f807['shift']());}};_0x2ef8a6(++_0x4e6424);}(_0x51f5,0xb0));var _0x551f=function(_0x896dc3,_0xfba64d){_0x896dc3=_0x896dc3-0x0;var _0x2c4938=_0x51f5[_0x896dc3];return _0x2c4938;};'use strict';var BPromise=require('bluebird');var util=require('util');var _=require('lodash');var fs=require('fs');var squel=require(_0x551f('0x0'));var Papa=require('papaparse');var Redis=require(_0x551f('0x1'));var db=require(_0x551f('0x2'))['db'];var config=require(_0x551f('0x3'));var logger=require(_0x551f('0x4'))(_0x551f('0x5'));config['redis']=_[_0x551f('0x6')](config[_0x551f('0x7')],{'host':_0x551f('0x8'),'port':0x18eb});var socket=require(_0x551f('0x9'))(new Redis(config['redis']));require(_0x551f('0xa'))[_0x551f('0xb')](socket);try{if(!process[_0x551f('0xc')][0x2]||process[_0x551f('0xc')][0x2]===_0x551f('0xd')||process[_0x551f('0xc')][0x2]===_0x551f('0xe')){throw new Error('Missing\x20filepath\x20parameter!');}var FILEPATH=process['argv'][0x2];if(!process[_0x551f('0xc')][0x3]||process[_0x551f('0xc')][0x3]===_0x551f('0xd')||process[_0x551f('0xc')][0x3]==='null'||!process[_0x551f('0xc')][0x4]||process['argv'][0x4]===_0x551f('0xd')||process[_0x551f('0xc')][0x4]==='null'){throw new Error('Missing\x20binding\x20parameters!');}var FIELDS=_[_0x551f('0xf')](process[_0x551f('0xc')][0x3][_0x551f('0x10')](','),process[_0x551f('0xc')][0x4][_0x551f('0x10')](','));if(!process[_0x551f('0xc')][0x5]||process[_0x551f('0xc')][0x5]===_0x551f('0xd')||process['argv'][0x5]==='null'){throw new Error(_0x551f('0x11'));}var LISTID=process['argv'][0x5];var COMPANYID=process[_0x551f('0xc')][0x6]&&process[_0x551f('0xc')][0x6]!==_0x551f('0xd')&&process['argv'][0x6]!=='null'?process['argv'][0x6]:null;var DUPLICATES=process[_0x551f('0xc')][0x7]&&process[_0x551f('0xc')][0x7]!==_0x551f('0xd')&&process[_0x551f('0xc')][0x7]!==_0x551f('0xe')?process['argv'][0x7]:null;if(!process['argv'][0x8]||process[_0x551f('0xc')][0x8]==='undefined'||process[_0x551f('0xc')][0x8]===_0x551f('0xe')){throw new Error(_0x551f('0x12'));}var SOCKET_TIMESTAMP=process['argv'][0x8];}catch(_0x18bd66){logger['error'](_0x18bd66);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(_0x1953a2,_0x28c70b,_0x47b678,_0x233c5d){var _0x7c5e91={'message':_0x28c70b};_0x7c5e91[_0x1953a2]=!![];if(_0x47b678){_0x7c5e91[_0x551f('0x13')]=_0x47b678;}if(_0x233c5d){_0x7c5e91[_0x551f('0x14')]=_0x233c5d;}return _0x7c5e91;}function isEmail(_0x184951){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))*$/[_0x551f('0x15')](_0x184951);}function checkRow(_0x683a09,_0x125c30,_0x3c72a3){return new BPromise(function(_0x4ad1d0,_0xb60d78){if(_[_0x551f('0x16')](_0x683a09)){return _0xb60d78(handleCheckRowError(_0x551f('0x17'),_0x551f('0x18'),null,_0x3c72a3));}if(_0x683a09[_0x551f('0x19')]&&_0x683a09[_0x551f('0x19')][_0x551f('0x1a')]){var _0x56fc7a=_[_0x551f('0x1b')](_0x683a09[_0x551f('0x19')],_0x551f('0x1c'))[_0x551f('0x1d')](';');return _0xb60d78(handleCheckRowError(_0x551f('0x17'),_0x56fc7a,null,_0x3c72a3));}var _0x45ddb5={};for(var _0x69ef65 in FIELDS){if(FIELDS[_0x551f('0x1e')](_0x69ef65)&&FIELDS[_0x69ef65]){_0x45ddb5[_0x69ef65]=_0x683a09[_0x551f('0x1f')][0x0][FIELDS[_0x69ef65]]||_0x683a09[_0x551f('0x1f')][0x0]['\ufeff'+FIELDS[_0x69ef65]];}}if(!_0x45ddb5['firstName']){return _0xb60d78(handleCheckRowError(_0x551f('0x17'),'firstName\x20not\x20specified!',null,_0x3c72a3));}if(!_0x45ddb5[_0x551f('0x20')]){return _0xb60d78(handleCheckRowError(_0x551f('0x17'),_0x551f('0x21'),null,_0x3c72a3));}if(_0x45ddb5[_0x551f('0x22')]){var _0x32db95=moment(_0x45ddb5[_0x551f('0x22')],_0x551f('0x23'));if(!_0x32db95[_0x551f('0x24')]()){return _0xb60d78(handleCheckRowError(_0x551f('0x17'),_0x551f('0x25'),null,_0x3c72a3));}}if(_0x45ddb5['email']){if(!isEmail(_0x45ddb5[_0x551f('0x26')])){return _0xb60d78(handleCheckRowError(_0x551f('0x17'),'email\x20format\x20is\x20not\x20valid!',null,_0x3c72a3));}}_0x45ddb5['ListId']=LISTID;_0x45ddb5[_0x551f('0x27')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x551f('0x1a')]&&_0x125c30){var _0x392120={};for(var _0x2809ac=0x0,_0x3cfae2=DUPLICATES[_0x551f('0x1a')];_0x2809ac<_0x3cfae2;_0x2809ac+=0x1){_0x392120[DUPLICATES[_0x2809ac]]=_0x45ddb5[DUPLICATES[_0x2809ac]];}var _0x14816e=_[_0x551f('0x28')](_0x125c30,_0x392120);if(_0x14816e){return _0xb60d78(handleCheckRowError('duplicate',_0x551f('0x29'),_0x14816e,_0x3c72a3));}}return db[_0x551f('0x2a')][_0x551f('0x2b')](_0x45ddb5,{'raw':!![],'hooks':![],'fields':_[_0x551f('0x2c')](_0x45ddb5)})[_0x551f('0x2d')](function(_0x2ee79d){if(DUPLICATES&&DUPLICATES[_0x551f('0x1a')]&&_0x125c30){_0x125c30[_0x551f('0x2e')](_['pick'](_0x45ddb5,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x2ee79d['id'];return _0x4ad1d0();})[_0x551f('0x2f')](function(_0xbc86dc){return _0xb60d78(handleCheckRowError(_0x551f('0x17'),_0x551f('0x30')+(_0xbc86dc[_0x551f('0x1c')]||JSON[_0x551f('0x31')](_0xbc86dc)),null,_0x3c72a3));});});}function checkHopper(){function _0x7d1eb7(){return function(_0x29e9ee){logger[_0x551f('0x17')](_0x551f('0x32'),'checkHopper',util[_0x551f('0x33')](_0x29e9ee,{'showHidden':![],'depth':null}));};}var _0x246391=function(_0x3018b7,_0x202774){var _0x34cff0=squel[_0x551f('0x34')]()[_0x551f('0x35')](_0x551f('0x36'))['fromQuery'](['phone',_0x551f('0x37'),_0x551f('0x38'),_0x551f('0x39'),_0x202774,_0x551f('0x3a'),_0x551f('0x3b')],squel[_0x551f('0x3c')]()[_0x551f('0x3d')](_0x551f('0x20'),_0x551f('0x20'))['field'](_0x551f('0x3e'),'scheduledAt')['field']('id',_0x551f('0x38'))[_0x551f('0x3d')](LISTID[_0x551f('0x3f')](),_0x551f('0x39'))[_0x551f('0x3d')](_0x3018b7['id'][_0x551f('0x3f')](),_0x202774)[_0x551f('0x3d')](_0x551f('0x3e'),_0x551f('0x3a'))[_0x551f('0x3d')]('NOW()',_0x551f('0x3b'))[_0x551f('0x40')](_0x551f('0x41'))[_0x551f('0x42')](_0x551f('0x43'))[_0x551f('0x42')](_0x551f('0x44'),LISTID['toString']())[_0x551f('0x42')](_0x551f('0x45'))[_0x551f('0x42')](_0x551f('0x46'),squel[_0x551f('0x3c')]()['field'](_0x551f('0x20'))['from'](_0x551f('0x36'))[_0x551f('0x42')](_0x202774+_0x551f('0x47'),_0x3018b7['id'][_0x551f('0x3f')]())))[_0x551f('0x3f')]();return _0x34cff0;};var _0x5cd641=function(_0x372fd9,_0x45a386){var _0x48c906=squel[_0x551f('0x34')]()[_0x551f('0x35')](_0x551f('0x36'))['fromQuery']([_0x551f('0x20'),'scheduledAt','ContactId',_0x551f('0x39'),_0x45a386,_0x551f('0x3a'),'updatedAt'],squel['select']()['field']('phone','phone')[_0x551f('0x3d')](_0x551f('0x3e'),_0x551f('0x37'))['field']('id','ContactId')[_0x551f('0x3d')](LISTID[_0x551f('0x3f')](),_0x551f('0x39'))[_0x551f('0x3d')](_0x372fd9['id']['toString'](),_0x45a386)[_0x551f('0x3d')](_0x551f('0x3e'),_0x551f('0x3a'))[_0x551f('0x3d')]('NOW()',_0x551f('0x3b'))[_0x551f('0x40')](_0x551f('0x41'))[_0x551f('0x42')](_0x551f('0x43'))[_0x551f('0x42')](_0x551f('0x44'),LISTID[_0x551f('0x3f')]())[_0x551f('0x42')](_0x551f('0x48'),squel['str'](hopperContacts))[_0x551f('0x42')](_0x551f('0x45'))[_0x551f('0x42')](_0x551f('0x46'),squel[_0x551f('0x3c')]()['field'](_0x551f('0x49'))[_0x551f('0x40')](_0x551f('0x4a'))[_0x551f('0x42')](_0x45a386+'\x20=\x20?',_0x372fd9['id'][_0x551f('0x3f')]()))[_0x551f('0x42')](_0x551f('0x46'),squel[_0x551f('0x3c')]()[_0x551f('0x3d')](_0x551f('0x20'))[_0x551f('0x40')](_0x551f('0x36'))[_0x551f('0x42')](_0x45a386+_0x551f('0x47'),_0x372fd9['id'][_0x551f('0x3f')]())))['toString']();return _0x48c906;};function _0x5aa7be(_0x1abcb7,_0x2d9eee){var _0x38caf2=squel[_0x551f('0x34')]()['into'](_0x551f('0x36'))[_0x551f('0x4b')]([_0x551f('0x20'),_0x551f('0x37'),_0x551f('0x38'),_0x551f('0x39'),_0x2d9eee,'createdAt',_0x551f('0x3b')],squel[_0x551f('0x3c')]()['field']('phone',_0x551f('0x20'))['field'](_0x551f('0x3e'),'scheduledAt')[_0x551f('0x3d')]('id',_0x551f('0x38'))[_0x551f('0x3d')](LISTID[_0x551f('0x3f')](),_0x551f('0x39'))[_0x551f('0x3d')](_0x1abcb7['id']['toString'](),_0x2d9eee)[_0x551f('0x3d')](_0x551f('0x3e'),_0x551f('0x3a'))[_0x551f('0x3d')](_0x551f('0x3e'),_0x551f('0x3b'))[_0x551f('0x40')]('cm_contacts')[_0x551f('0x42')](_0x551f('0x43'))[_0x551f('0x42')]('ListId\x20=\x20?',LISTID[_0x551f('0x3f')]())[_0x551f('0x42')](_0x551f('0x48'),squel[_0x551f('0x4c')](hopperContacts))[_0x551f('0x42')]('phone\x20IS\x20NOT\x20NULL'))['toString']();return _0x38caf2;}function _0x25e3ac(_0x3ad815,_0x17884d){var _0x1d6408=squel[_0x551f('0x34')]()['into'](_0x551f('0x4d'))[_0x551f('0x4b')](['phone',_0x551f('0x38'),_0x551f('0x39'),_0x17884d,_0x551f('0x3a'),'updatedAt'],squel[_0x551f('0x3c')]()['field'](_0x551f('0x20'),'phone')[_0x551f('0x3d')]('id',_0x551f('0x38'))[_0x551f('0x3d')](LISTID['toString'](),_0x551f('0x39'))[_0x551f('0x3d')](_0x3ad815['id'][_0x551f('0x3f')](),_0x17884d)[_0x551f('0x3d')](_0x551f('0x3e'),_0x551f('0x3a'))['field']('NOW()','updatedAt')['from'](_0x551f('0x41'))[_0x551f('0x42')](_0x551f('0x43'))[_0x551f('0x42')](_0x551f('0x44'),LISTID[_0x551f('0x3f')]())[_0x551f('0x42')](_0x551f('0x48'),squel[_0x551f('0x4c')](hopperContacts))[_0x551f('0x42')]('phone\x20IS\x20NOT\x20NULL'))[_0x551f('0x3f')]();return _0x1d6408;}return db[_0x551f('0x4e')]['findAll']({'where':{'type':'outbound'},'attributes':['id',_0x551f('0x4f')],'include':[{'model':db[_0x551f('0x50')],'as':_0x551f('0x51'),'where':{'id':LISTID}}]})[_0x551f('0x2d')](function(_0x581fd0){var _0x484d85=[];if(_0x581fd0){var _0x309224;for(var _0x4f12f7=0x0,_0x2dca6a;_0x4f12f7<_0x581fd0[_0x551f('0x1a')];_0x4f12f7+=0x1){_0x2dca6a=_0x581fd0[_0x4f12f7]['get']({'plain':!![]});switch(_0x2dca6a[_0x551f('0x4f')]){case _0x551f('0x52'):_0x484d85[_0x551f('0x2e')](db['sequelize'][_0x551f('0x53')](_0x5cd641(_0x2dca6a,_0x551f('0x54')))['then'](function(){})[_0x551f('0x2f')](_0x7d1eb7()));break;case _0x551f('0x55'):_0x484d85[_0x551f('0x2e')](db['sequelize'][_0x551f('0x53')](_0x246391(_0x2dca6a,'VoiceQueueId'))[_0x551f('0x2d')](function(){})[_0x551f('0x2f')](_0x7d1eb7()));break;default:_0x484d85[_0x551f('0x2e')](db[_0x551f('0x56')][_0x551f('0x53')](_0x5aa7be(_0x2dca6a,_0x551f('0x54')))[_0x551f('0x2d')](function(){})[_0x551f('0x2f')](_0x7d1eb7()));}}}return _0x484d85;})[_0x551f('0x57')]()[_0x551f('0x2d')](function(){return db[_0x551f('0x4e')][_0x551f('0x58')]({'where':{'type':_0x551f('0x59')},'attributes':['id'],'include':[{'model':db[_0x551f('0x50')],'as':_0x551f('0x5a'),'where':{'id':LISTID}}]})[_0x551f('0x2d')](function(_0x443707){var _0xd7cf8b=[];if(_0x443707){var _0x12a2a8;for(var _0x37a18c=0x0,_0x5c95c0;_0x37a18c<_0x443707['length'];_0x37a18c+=0x1){_0x5c95c0=_0x443707[_0x37a18c][_0x551f('0x5b')]({'plain':!![]});_0xd7cf8b[_0x551f('0x2e')](db['sequelize']['query'](_0x25e3ac(_0x5c95c0,'VoiceQueueId'))['then'](function(){})[_0x551f('0x2f')](_0x7d1eb7()));}}return _0xd7cf8b;})['all']();})[_0x551f('0x2d')](function(){return db[_0x551f('0x5c')]['findAll']({'attributes':['id',_0x551f('0x4f')],'include':[{'model':db['CmList'],'as':_0x551f('0x51'),'where':{'id':LISTID}}]})['then'](function(_0x38c651){var _0x4e18c2=[];if(_0x38c651){for(var _0x374659=0x0,_0x8a704f;_0x374659<_0x38c651[_0x551f('0x1a')];_0x374659+=0x1){_0x8a704f=_0x38c651[_0x374659][_0x551f('0x5b')]({'plain':!![]});switch(_0x8a704f[_0x551f('0x4f')]){case _0x551f('0x52'):_0x4e18c2[_0x551f('0x2e')](db[_0x551f('0x56')][_0x551f('0x53')](_0x5cd641(_0x8a704f,_0x551f('0x5d')))['then'](function(){})[_0x551f('0x2f')](_0x7d1eb7()));break;case _0x551f('0x55'):_0x4e18c2['push'](db[_0x551f('0x56')][_0x551f('0x53')](_0x246391(_0x8a704f,_0x551f('0x5d')))[_0x551f('0x2d')](function(){})['catch'](_0x7d1eb7()));break;default:_0x4e18c2[_0x551f('0x2e')](db[_0x551f('0x56')][_0x551f('0x53')](_0x5aa7be(_0x8a704f,'CampaignId'))['then'](function(){})['catch'](_0x7d1eb7()));}}}return _0x4e18c2;})['all']();})[_0x551f('0x2d')](function(){return db[_0x551f('0x5c')]['findAll']({'attributes':['id'],'include':[{'model':db['CmList'],'as':_0x551f('0x5a'),'where':{'id':LISTID}}]})[_0x551f('0x2d')](function(_0x5e6c4a){var _0x459e27=[];if(_0x5e6c4a){for(var _0x2677da=0x0,_0x2ad009;_0x2677da<_0x5e6c4a['length'];_0x2677da+=0x1){_0x2ad009=_0x5e6c4a[_0x2677da][_0x551f('0x5b')]({'plain':!![]});_0x459e27[_0x551f('0x2e')](db[_0x551f('0x56')][_0x551f('0x53')](_0x25e3ac(_0x2ad009,_0x551f('0x5d')))['then'](function(){})[_0x551f('0x2f')](_0x7d1eb7()));}}return _0x459e27;})[_0x551f('0x57')]();})[_0x551f('0x2f')](function(_0x1c2316){logger[_0x551f('0x17')]('cmContact,\x20%s,\x20%s',_0x551f('0x5e'),_0x1c2316[_0x551f('0x1c')]);});}var processPromises=function(_0x53c3d5){return BPromise[_0x551f('0x57')](promises)[_0x551f('0x2d')](function(_0x5803c5){})[_0x551f('0x2f')](function(_0x5865bc){logger[_0x551f('0x17')]('Error\x20processing\x20rows\x20block:',JSON[_0x551f('0x31')](_0x5865bc));})[_0x551f('0x5f')](function(){socket[_0x551f('0x60')](_0x551f('0x61')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x53c3d5){return _0x53c3d5[_0x551f('0x62')]();}});};var endCsv=function(){return BPromise[_0x551f('0x63')]()[_0x551f('0x2d')](function(){if(hopperContacts){return checkHopper();}})[_0x551f('0x2d')](function(){socket[_0x551f('0x60')](_0x551f('0x61')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x551f('0x64')](FILEPATH);}catch(_0xf43336){logger['error'](_0x551f('0x65'),JSON[_0x551f('0x31')](_0xf43336));}finally{process[_0x551f('0x66')](0x0);}});};process['on'](_0x551f('0x67'),function(){logger[_0x551f('0x68')](_0x551f('0x69'));endCsv();});function main(){return BPromise[_0x551f('0x63')]()[_0x551f('0x2d')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x551f('0x10')](',');return db[_0x551f('0x2a')][_0x551f('0x58')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x551f('0x2d')](function(_0x348557){var _0xdc90e9=fs[_0x551f('0x6a')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x551f('0x6b')](_0xdc90e9,{'header':!![],'skipEmptyLines':!![],'step':function(_0x4611df,_0x2f26de){total+=0x1;var _0x5abefe=total;promises[_0x551f('0x2e')](checkRow(_0x4611df,_0x348557,_0x5abefe)[_0x551f('0x2d')](function(){success+=0x1;})[_0x551f('0x2f')](function(_0x4dec38){if(_0x4dec38[_0x551f('0x17')]){errors+=0x1;delete _0x4dec38[_0x551f('0x17')];}else if(_0x4dec38[_0x551f('0x6c')]){duplicates+=0x1;delete _0x4dec38[_0x551f('0x6c')];}rows['push'](_0x4dec38);}));if(total%0xc8===0x0){_0x2f26de[_0x551f('0x6d')]();return processPromises(_0x2f26de);}},'complete':function(){return processPromises()[_0x551f('0x2d')](function(){logger[_0x551f('0x68')](_0x551f('0x6e'));endCsv();});},'error':function(_0x236c41,_0x1d2e05){logger[_0x551f('0x68')]('CSV\x20parse\x20error',JSON[_0x551f('0x31')](_0x236c41));endCsv();}});})[_0x551f('0x2f')](function(_0x21362d){logger[_0x551f('0x17')](_0x551f('0x6f'),JSON['stringify'](_0x21362d));});}main(); \ No newline at end of file +var _0x5b4c=['outbound','CmList','Lists','get','always','sequelize','query','VoiceQueueId','push','all','BlackLists','dialCheckDuplicateType','CampaignId','onlyIfOpen','Campaign','cmContact,\x20%s,\x20%s','generalCheckHopper','finally','emit','resolve','unlinkSync','exit','info','parse','pause','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','bluebird','util','lodash','squel','ioredis','../../../config/environment','../../../config/logger','defaults','redis','socket.io-emitter','../../../api/cmContact/cmContact.socket','register','argv','undefined','null','Missing\x20filepath\x20parameter!','Missing\x20binding\x20parameters!','split','Missing\x20ListId\x20parameter!','error','contact','test','isNil','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','map','message','data','firstName','firstName\x20not\x20specified!','phone\x20not\x20specified!','birthDate','isValid','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','email\x20format\x20is\x20not\x20valid!','ListId','CompanyId','length','find','duplicate','CmContact','keys','then','pick','catch','Error\x20while\x20creating\x20contact:\x20','stringify','inspect','insert','into','fromQuery','phone','scheduledAt','createdAt','updatedAt','field','NOW()','toString','from','where','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20NOT\x20IN\x20(?)','select','cm_hopper','ContactId','cm_contacts','id\x20IN\x20?','phone\x20IS\x20NOT\x20NULL','calleridnum','cm_hopper_final','\x20=\x20?','cm_hopper_black','str','VoiceQueue','findAll'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x5b4c,0x157));var _0xc5b4=function(_0x225b77,_0x137869){_0x225b77=_0x225b77-0x0;var _0x3698e1=_0x5b4c[_0x225b77];return _0x3698e1;};'use strict';var BPromise=require(_0xc5b4('0x0'));var util=require(_0xc5b4('0x1'));var _=require(_0xc5b4('0x2'));var fs=require('fs');var squel=require(_0xc5b4('0x3'));var Papa=require('papaparse');var Redis=require(_0xc5b4('0x4'));var db=require('../../../mysqldb')['db'];var config=require(_0xc5b4('0x5'));var logger=require(_0xc5b4('0x6'))('api');config['redis']=_[_0xc5b4('0x7')](config[_0xc5b4('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0xc5b4('0x9'))(new Redis(config['redis']));require(_0xc5b4('0xa'))[_0xc5b4('0xb')](socket);try{if(!process['argv'][0x2]||process[_0xc5b4('0xc')][0x2]===_0xc5b4('0xd')||process[_0xc5b4('0xc')][0x2]===_0xc5b4('0xe')){throw new Error(_0xc5b4('0xf'));}var FILEPATH=process[_0xc5b4('0xc')][0x2];if(!process[_0xc5b4('0xc')][0x3]||process[_0xc5b4('0xc')][0x3]===_0xc5b4('0xd')||process['argv'][0x3]===_0xc5b4('0xe')||!process[_0xc5b4('0xc')][0x4]||process[_0xc5b4('0xc')][0x4]===_0xc5b4('0xd')||process[_0xc5b4('0xc')][0x4]===_0xc5b4('0xe')){throw new Error(_0xc5b4('0x10'));}var FIELDS=_['zipObject'](process[_0xc5b4('0xc')][0x3]['split'](','),process[_0xc5b4('0xc')][0x4][_0xc5b4('0x11')](','));if(!process['argv'][0x5]||process[_0xc5b4('0xc')][0x5]===_0xc5b4('0xd')||process['argv'][0x5]===_0xc5b4('0xe')){throw new Error(_0xc5b4('0x12'));}var LISTID=process[_0xc5b4('0xc')][0x5];var COMPANYID=process['argv'][0x6]&&process['argv'][0x6]!=='undefined'&&process[_0xc5b4('0xc')][0x6]!==_0xc5b4('0xe')?process[_0xc5b4('0xc')][0x6]:null;var DUPLICATES=process[_0xc5b4('0xc')][0x7]&&process[_0xc5b4('0xc')][0x7]!=='undefined'&&process[_0xc5b4('0xc')][0x7]!==_0xc5b4('0xe')?process[_0xc5b4('0xc')][0x7]:null;if(!process[_0xc5b4('0xc')][0x8]||process[_0xc5b4('0xc')][0x8]===_0xc5b4('0xd')||process[_0xc5b4('0xc')][0x8]===_0xc5b4('0xe')){throw new Error('Missing\x20socket_timestamp\x20parameter!');}var SOCKET_TIMESTAMP=process['argv'][0x8];}catch(_0x4c641e){logger[_0xc5b4('0x13')](_0x4c641e);endCsv();}var total=0x0;var pTotal=0x0;var success=0x0;var errors=0x0;var duplicates=0x0;var rows=[];var hopperContacts='';var promises=[];var index=0x0;var alreadyInvalid=![];function handleCheckRowError(_0x355d23,_0x26235a,_0x38c617,_0x1ad0aa){var _0x3eeff0={'message':_0x26235a};_0x3eeff0[_0x355d23]=!![];if(_0x38c617){_0x3eeff0[_0xc5b4('0x14')]=_0x38c617;}if(_0x1ad0aa){_0x3eeff0['index']=_0x1ad0aa;}return _0x3eeff0;}function isEmail(_0x57494f){return/^([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22))*\x40([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d))*$/[_0xc5b4('0x15')](_0x57494f);}function checkRow(_0x93d69a,_0x383ab0,_0x145b72){return new BPromise(function(_0x3f89c,_0x279ee9){if(_[_0xc5b4('0x16')](_0x93d69a)){return _0x279ee9(handleCheckRowError(_0xc5b4('0x13'),_0xc5b4('0x17'),null,_0x145b72));}if(_0x93d69a[_0xc5b4('0x18')]&&_0x93d69a[_0xc5b4('0x18')]['length']){var _0x217539=_[_0xc5b4('0x19')](_0x93d69a[_0xc5b4('0x18')],_0xc5b4('0x1a'))['join'](';');return _0x279ee9(handleCheckRowError(_0xc5b4('0x13'),_0x217539,null,_0x145b72));}var _0x8bfa51={};for(var _0x24b50a in FIELDS){if(FIELDS['hasOwnProperty'](_0x24b50a)&&FIELDS[_0x24b50a]){_0x8bfa51[_0x24b50a]=_0x93d69a[_0xc5b4('0x1b')][0x0][FIELDS[_0x24b50a]]||_0x93d69a[_0xc5b4('0x1b')][0x0]['\ufeff'+FIELDS[_0x24b50a]];}}if(!_0x8bfa51[_0xc5b4('0x1c')]){return _0x279ee9(handleCheckRowError(_0xc5b4('0x13'),_0xc5b4('0x1d'),null,_0x145b72));}if(!_0x8bfa51['phone']){return _0x279ee9(handleCheckRowError(_0xc5b4('0x13'),_0xc5b4('0x1e'),null,_0x145b72));}if(_0x8bfa51['birthDate']){var _0x38f64f=moment(_0x8bfa51[_0xc5b4('0x1f')],'YYYY-MM-DD');if(!_0x38f64f[_0xc5b4('0x20')]()){return _0x279ee9(handleCheckRowError(_0xc5b4('0x13'),_0xc5b4('0x21'),null,_0x145b72));}}if(_0x8bfa51['email']){if(!isEmail(_0x8bfa51[_0xc5b4('0x22')])){return _0x279ee9(handleCheckRowError(_0xc5b4('0x13'),_0xc5b4('0x23'),null,_0x145b72));}}_0x8bfa51[_0xc5b4('0x24')]=LISTID;_0x8bfa51[_0xc5b4('0x25')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0xc5b4('0x26')]&&_0x383ab0){var _0xcbc131={};for(var _0x19cc9c=0x0,_0x7d3a94=DUPLICATES[_0xc5b4('0x26')];_0x19cc9c<_0x7d3a94;_0x19cc9c+=0x1){_0xcbc131[DUPLICATES[_0x19cc9c]]=_0x8bfa51[DUPLICATES[_0x19cc9c]];}var _0x1b9304=_[_0xc5b4('0x27')](_0x383ab0,_0xcbc131);if(_0x1b9304){return _0x279ee9(handleCheckRowError(_0xc5b4('0x28'),'Duplicate\x20Contact',_0x1b9304,_0x145b72));}}return db[_0xc5b4('0x29')]['create'](_0x8bfa51,{'raw':!![],'hooks':![],'fields':_[_0xc5b4('0x2a')](_0x8bfa51)})[_0xc5b4('0x2b')](function(_0x2892f4){if(DUPLICATES&&DUPLICATES[_0xc5b4('0x26')]&&_0x383ab0){_0x383ab0['push'](_[_0xc5b4('0x2c')](_0x8bfa51,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x2892f4['id'];return _0x3f89c();})[_0xc5b4('0x2d')](function(_0x3d0118){return _0x279ee9(handleCheckRowError(_0xc5b4('0x13'),_0xc5b4('0x2e')+(_0x3d0118[_0xc5b4('0x1a')]||JSON[_0xc5b4('0x2f')](_0x3d0118)),null,_0x145b72));});});}function checkHopper(){function _0x1ae44d(){return function(_0x2e8cce){logger['error']('cmContact','checkHopper',util[_0xc5b4('0x30')](_0x2e8cce,{'showHidden':![],'depth':null}));};}var _0x20836f=function(_0xe5e59,_0x2a9344){var _0x4f4056=squel[_0xc5b4('0x31')]()[_0xc5b4('0x32')]('cm_hopper')[_0xc5b4('0x33')]([_0xc5b4('0x34'),_0xc5b4('0x35'),'ContactId',_0xc5b4('0x24'),_0x2a9344,_0xc5b4('0x36'),_0xc5b4('0x37')],squel['select']()[_0xc5b4('0x38')](_0xc5b4('0x34'),_0xc5b4('0x34'))[_0xc5b4('0x38')](_0xc5b4('0x39'),_0xc5b4('0x35'))[_0xc5b4('0x38')]('id','ContactId')['field'](LISTID[_0xc5b4('0x3a')](),_0xc5b4('0x24'))[_0xc5b4('0x38')](_0xe5e59['id'][_0xc5b4('0x3a')](),_0x2a9344)[_0xc5b4('0x38')](_0xc5b4('0x39'),_0xc5b4('0x36'))[_0xc5b4('0x38')]('NOW()',_0xc5b4('0x37'))[_0xc5b4('0x3b')]('cm_contacts')[_0xc5b4('0x3c')](_0xc5b4('0x3d'))[_0xc5b4('0x3c')](_0xc5b4('0x3e'),LISTID[_0xc5b4('0x3a')]())[_0xc5b4('0x3c')]('phone\x20IS\x20NOT\x20NULL')['where'](_0xc5b4('0x3f'),squel[_0xc5b4('0x40')]()[_0xc5b4('0x38')]('phone')[_0xc5b4('0x3b')](_0xc5b4('0x41'))[_0xc5b4('0x3c')](_0x2a9344+'\x20=\x20?',_0xe5e59['id']['toString']())))[_0xc5b4('0x3a')]();return _0x4f4056;};var _0x56fad1=function(_0x492415,_0x1a7d22){var _0x112c87=squel[_0xc5b4('0x31')]()[_0xc5b4('0x32')]('cm_hopper')[_0xc5b4('0x33')]([_0xc5b4('0x34'),_0xc5b4('0x35'),_0xc5b4('0x42'),_0xc5b4('0x24'),_0x1a7d22,_0xc5b4('0x36'),'updatedAt'],squel[_0xc5b4('0x40')]()[_0xc5b4('0x38')]('phone','phone')[_0xc5b4('0x38')](_0xc5b4('0x39'),_0xc5b4('0x35'))['field']('id',_0xc5b4('0x42'))[_0xc5b4('0x38')](LISTID['toString'](),'ListId')[_0xc5b4('0x38')](_0x492415['id'][_0xc5b4('0x3a')](),_0x1a7d22)['field'](_0xc5b4('0x39'),_0xc5b4('0x36'))[_0xc5b4('0x38')](_0xc5b4('0x39'),_0xc5b4('0x37'))[_0xc5b4('0x3b')](_0xc5b4('0x43'))[_0xc5b4('0x3c')]('deletedAt\x20IS\x20NULL')['where'](_0xc5b4('0x3e'),LISTID[_0xc5b4('0x3a')]())['where'](_0xc5b4('0x44'),squel['str'](hopperContacts))[_0xc5b4('0x3c')](_0xc5b4('0x45'))['where'](_0xc5b4('0x3f'),squel[_0xc5b4('0x40')]()[_0xc5b4('0x38')](_0xc5b4('0x46'))[_0xc5b4('0x3b')](_0xc5b4('0x47'))[_0xc5b4('0x3c')](_0x1a7d22+_0xc5b4('0x48'),_0x492415['id'][_0xc5b4('0x3a')]()))[_0xc5b4('0x3c')]('phone\x20NOT\x20IN\x20(?)',squel[_0xc5b4('0x40')]()[_0xc5b4('0x38')]('phone')[_0xc5b4('0x3b')](_0xc5b4('0x41'))[_0xc5b4('0x3c')](_0x1a7d22+_0xc5b4('0x48'),_0x492415['id']['toString']())))[_0xc5b4('0x3a')]();return _0x112c87;};function _0x4fca65(_0x6d0cef,_0x4ccaa0){var _0x149623=squel[_0xc5b4('0x31')]()['into'](_0xc5b4('0x41'))[_0xc5b4('0x33')]([_0xc5b4('0x34'),_0xc5b4('0x35'),_0xc5b4('0x42'),_0xc5b4('0x24'),_0x4ccaa0,_0xc5b4('0x36'),_0xc5b4('0x37')],squel['select']()[_0xc5b4('0x38')](_0xc5b4('0x34'),_0xc5b4('0x34'))[_0xc5b4('0x38')]('NOW()',_0xc5b4('0x35'))[_0xc5b4('0x38')]('id',_0xc5b4('0x42'))[_0xc5b4('0x38')](LISTID[_0xc5b4('0x3a')](),_0xc5b4('0x24'))[_0xc5b4('0x38')](_0x6d0cef['id'][_0xc5b4('0x3a')](),_0x4ccaa0)[_0xc5b4('0x38')](_0xc5b4('0x39'),_0xc5b4('0x36'))[_0xc5b4('0x38')](_0xc5b4('0x39'),'updatedAt')['from']('cm_contacts')['where'](_0xc5b4('0x3d'))[_0xc5b4('0x3c')]('ListId\x20=\x20?',LISTID[_0xc5b4('0x3a')]())[_0xc5b4('0x3c')](_0xc5b4('0x44'),squel['str'](hopperContacts))[_0xc5b4('0x3c')](_0xc5b4('0x45')))[_0xc5b4('0x3a')]();return _0x149623;}function _0x82f72c(_0x274e81,_0x1d5bba){var _0x191b35=squel[_0xc5b4('0x31')]()['into'](_0xc5b4('0x49'))[_0xc5b4('0x33')](['phone',_0xc5b4('0x42'),'ListId',_0x1d5bba,_0xc5b4('0x36'),_0xc5b4('0x37')],squel[_0xc5b4('0x40')]()[_0xc5b4('0x38')](_0xc5b4('0x34'),_0xc5b4('0x34'))['field']('id',_0xc5b4('0x42'))[_0xc5b4('0x38')](LISTID[_0xc5b4('0x3a')](),_0xc5b4('0x24'))['field'](_0x274e81['id']['toString'](),_0x1d5bba)[_0xc5b4('0x38')]('NOW()',_0xc5b4('0x36'))[_0xc5b4('0x38')](_0xc5b4('0x39'),_0xc5b4('0x37'))[_0xc5b4('0x3b')](_0xc5b4('0x43'))['where']('deletedAt\x20IS\x20NULL')[_0xc5b4('0x3c')](_0xc5b4('0x3e'),LISTID[_0xc5b4('0x3a')]())[_0xc5b4('0x3c')]('id\x20IN\x20?',squel[_0xc5b4('0x4a')](hopperContacts))[_0xc5b4('0x3c')]('phone\x20IS\x20NOT\x20NULL'))['toString']();return _0x191b35;}return db[_0xc5b4('0x4b')][_0xc5b4('0x4c')]({'where':{'type':_0xc5b4('0x4d')},'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db[_0xc5b4('0x4e')],'as':_0xc5b4('0x4f'),'where':{'id':LISTID}}]})[_0xc5b4('0x2b')](function(_0x46ad9f){var _0x5d2818=[];if(_0x46ad9f){var _0x470103;for(var _0x553f4e=0x0,_0x520457;_0x553f4e<_0x46ad9f['length'];_0x553f4e+=0x1){_0x520457=_0x46ad9f[_0x553f4e][_0xc5b4('0x50')]({'plain':!![]});switch(_0x520457['dialCheckDuplicateType']){case _0xc5b4('0x51'):_0x5d2818['push'](db[_0xc5b4('0x52')][_0xc5b4('0x53')](_0x56fad1(_0x520457,_0xc5b4('0x54')))[_0xc5b4('0x2b')](function(){})['catch'](_0x1ae44d()));break;case'onlyIfOpen':_0x5d2818[_0xc5b4('0x55')](db[_0xc5b4('0x52')][_0xc5b4('0x53')](_0x20836f(_0x520457,_0xc5b4('0x54')))[_0xc5b4('0x2b')](function(){})[_0xc5b4('0x2d')](_0x1ae44d()));break;default:_0x5d2818[_0xc5b4('0x55')](db[_0xc5b4('0x52')][_0xc5b4('0x53')](_0x4fca65(_0x520457,_0xc5b4('0x54')))[_0xc5b4('0x2b')](function(){})[_0xc5b4('0x2d')](_0x1ae44d()));}}}return _0x5d2818;})[_0xc5b4('0x56')]()[_0xc5b4('0x2b')](function(){return db['VoiceQueue']['findAll']({'where':{'type':'outbound'},'attributes':['id'],'include':[{'model':db[_0xc5b4('0x4e')],'as':_0xc5b4('0x57'),'where':{'id':LISTID}}]})[_0xc5b4('0x2b')](function(_0x176ab0){var _0x396140=[];if(_0x176ab0){var _0x579b3f;for(var _0x42a07f=0x0,_0x57c1b0;_0x42a07f<_0x176ab0[_0xc5b4('0x26')];_0x42a07f+=0x1){_0x57c1b0=_0x176ab0[_0x42a07f][_0xc5b4('0x50')]({'plain':!![]});_0x396140['push'](db[_0xc5b4('0x52')][_0xc5b4('0x53')](_0x82f72c(_0x57c1b0,_0xc5b4('0x54')))['then'](function(){})['catch'](_0x1ae44d()));}}return _0x396140;})['all']();})[_0xc5b4('0x2b')](function(){return db['Campaign']['findAll']({'attributes':['id',_0xc5b4('0x58')],'include':[{'model':db[_0xc5b4('0x4e')],'as':'Lists','where':{'id':LISTID}}]})[_0xc5b4('0x2b')](function(_0x88ee3a){var _0x46c17c=[];if(_0x88ee3a){for(var _0x36aa35=0x0,_0x53aac2;_0x36aa35<_0x88ee3a[_0xc5b4('0x26')];_0x36aa35+=0x1){_0x53aac2=_0x88ee3a[_0x36aa35][_0xc5b4('0x50')]({'plain':!![]});switch(_0x53aac2['dialCheckDuplicateType']){case'always':_0x46c17c[_0xc5b4('0x55')](db[_0xc5b4('0x52')][_0xc5b4('0x53')](_0x56fad1(_0x53aac2,_0xc5b4('0x59')))[_0xc5b4('0x2b')](function(){})[_0xc5b4('0x2d')](_0x1ae44d()));break;case _0xc5b4('0x5a'):_0x46c17c['push'](db[_0xc5b4('0x52')]['query'](_0x20836f(_0x53aac2,_0xc5b4('0x59')))[_0xc5b4('0x2b')](function(){})[_0xc5b4('0x2d')](_0x1ae44d()));break;default:_0x46c17c['push'](db['sequelize'][_0xc5b4('0x53')](_0x4fca65(_0x53aac2,_0xc5b4('0x59')))['then'](function(){})[_0xc5b4('0x2d')](_0x1ae44d()));}}}return _0x46c17c;})[_0xc5b4('0x56')]();})[_0xc5b4('0x2b')](function(){return db[_0xc5b4('0x5b')][_0xc5b4('0x4c')]({'attributes':['id'],'include':[{'model':db[_0xc5b4('0x4e')],'as':'BlackLists','where':{'id':LISTID}}]})[_0xc5b4('0x2b')](function(_0x2a9bfd){var _0x485cf1=[];if(_0x2a9bfd){for(var _0x24887c=0x0,_0xb89b99;_0x24887c<_0x2a9bfd['length'];_0x24887c+=0x1){_0xb89b99=_0x2a9bfd[_0x24887c][_0xc5b4('0x50')]({'plain':!![]});_0x485cf1[_0xc5b4('0x55')](db[_0xc5b4('0x52')][_0xc5b4('0x53')](_0x82f72c(_0xb89b99,_0xc5b4('0x59')))[_0xc5b4('0x2b')](function(){})[_0xc5b4('0x2d')](_0x1ae44d()));}}return _0x485cf1;})[_0xc5b4('0x56')]();})[_0xc5b4('0x2d')](function(_0x2a3943){logger['error'](_0xc5b4('0x5c'),_0xc5b4('0x5d'),_0x2a3943[_0xc5b4('0x1a')]);});}var processPromises=function(_0x27e1d4){return BPromise[_0xc5b4('0x56')](promises)[_0xc5b4('0x2b')](function(_0x58fdc8){})[_0xc5b4('0x2d')](function(_0x4a1a5d){logger[_0xc5b4('0x13')]('Error\x20processing\x20rows\x20block:',JSON[_0xc5b4('0x2f')](_0x4a1a5d));})[_0xc5b4('0x5e')](function(){socket[_0xc5b4('0x5f')]('contact:csv_'+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x27e1d4){return _0x27e1d4['resume']();}});};var endCsv=function(){return BPromise[_0xc5b4('0x60')]()[_0xc5b4('0x2b')](function(){if(hopperContacts){return checkHopper();}})[_0xc5b4('0x2b')](function(){socket['emit']('contact:csv_'+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0xc5b4('0x61')](FILEPATH);}catch(_0x11970d){logger['error']('Unable\x20to\x20delete\x20temp\x20file:',JSON[_0xc5b4('0x2f')](_0x11970d));}finally{process[_0xc5b4('0x62')](0x0);}});};process['on']('SIGINT',function(){logger[_0xc5b4('0x63')]('CSV\x20import\x20process\x20stopped!');endCsv();});function main(){return BPromise['resolve']()[_0xc5b4('0x2b')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0xc5b4('0x11')](',');return db[_0xc5b4('0x29')][_0xc5b4('0x4c')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0xc5b4('0x2b')](function(_0x4a119a){var _0x5b4761=fs['createReadStream'](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0xc5b4('0x64')](_0x5b4761,{'header':!![],'skipEmptyLines':!![],'step':function(_0x4caa5c,_0x17ab6e){total+=0x1;var _0x2dd4c7=total;promises[_0xc5b4('0x55')](checkRow(_0x4caa5c,_0x4a119a,_0x2dd4c7)[_0xc5b4('0x2b')](function(){success+=0x1;})[_0xc5b4('0x2d')](function(_0x14c817){if(_0x14c817[_0xc5b4('0x13')]){errors+=0x1;delete _0x14c817['error'];}else if(_0x14c817[_0xc5b4('0x28')]){duplicates+=0x1;delete _0x14c817['duplicate'];}rows[_0xc5b4('0x55')](_0x14c817);}));if(total%0xc8===0x0){_0x17ab6e[_0xc5b4('0x65')]();return processPromises(_0x17ab6e);}},'complete':function(){return processPromises()[_0xc5b4('0x2b')](function(){logger['info'](_0xc5b4('0x66'));endCsv();});},'error':function(_0x45974f,_0xa40bb){logger[_0xc5b4('0x63')](_0xc5b4('0x67'),JSON[_0xc5b4('0x2f')](_0x45974f));endCsv();}});})[_0xc5b4('0x2d')](function(_0x99044a){logger[_0xc5b4('0x13')](_0xc5b4('0x68'),JSON[_0xc5b4('0x2f')](_0x99044a));});}main(); \ No newline at end of file diff --git a/server/components/import/cm/csv2.js b/server/components/import/cm/csv2.js index adb5ff7..70dbd28 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 _0x0ba8=['header','writeFileSync','parse','data','length','rows','hasOwnProperty','trim','replace','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','agent\x20not\x20exists','email','email\x20wrong\x20format','dateOfBirth','YYYY-MM-DD','isValid','firstName','SystemRow','emit','contact:import:','Abort\x20parser','abort','SystemError','step','duplicates','CREATE\x20TABLE\x20','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',',\x20scheduledAt\x20=\x20NOW()','DROP\x20TABLE\x20','voice_queues_has_cm_lists','voice_queues','VoiceQueueId','voice_queues_has_cm_blacklists','campaigns_has_cm_lists','campaigns','CampaignId','each','then','finish','affectedRows','unlink','complete','argv','arguments\x20\x20\x20','existsSync','binding\x20doesn\x27t\x20exists','body\x20id\x20mandatory','No\x20agent\x20available','SIGINT','uncaughtException','path','papaparse','util','bluebird','moment','squel','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','redis','localhost','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','test','join','.id\x20=\x20','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','cm_contacts.phone','cm_contacts.id','cm_contacts.createdAt','cm_contacts.priority','cm_contacts.UserId','insert','into','cm_hopper','fromQuery','phone','scheduledat','ContactId','createdAt','priority','UserId','recallme','select','fields','from','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','\x22onlyIfOpen\x22','cm_contacts.ListId','cm_hopper_black','ListId\x20=\x20?','concat','keys','ListId','CompanyId','updatedAt',')\x20NOT\x20IN\x20?','id\x20IN\x20?','MIN(id)','min_id','group','toString','info','Received\x20SIGINT','error','exit','errors','push','code','message','sequelize','query','spread','catch','main','send','start','binding','socket_timestamp','root','server/files/tmp'];(function(_0x5c0993,_0x1d8da6){var _0x218155=function(_0x320cfc){while(--_0x320cfc){_0x5c0993['push'](_0x5c0993['shift']());}};_0x218155(++_0x1d8da6);}(_0x0ba8,0x1bb));var _0x80ba=function(_0x14ae01,_0x861682){_0x14ae01=_0x14ae01-0x0;var _0x4cdfaa=_0x0ba8[_0x14ae01];return _0x4cdfaa;};'use strict';var fs=require('fs');var path=require(_0x80ba('0x0'));var _=require('lodash');var Papa=require(_0x80ba('0x1'));var util=require(_0x80ba('0x2'));var BPromise=require(_0x80ba('0x3'));var moment=require(_0x80ba('0x4'));var squel=require(_0x80ba('0x5'));var Redis=require(_0x80ba('0x6'));var db=require(_0x80ba('0x7'))['db'];var config=require(_0x80ba('0x8'));var logger=require(_0x80ba('0x9'))('import');config[_0x80ba('0xa')]=_['defaults'](config[_0x80ba('0xa')],{'host':_0x80ba('0xb'),'port':0x18eb});var socket=require(_0x80ba('0xc'))(new Redis(config[_0x80ba('0xa')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var stopped=![];var NOW=moment()[_0x80ba('0xd')](_0x80ba('0xe'));function isEmail(_0x167996){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))*$/[_0x80ba('0xf')](_0x167996);}function selectNotIn(_0xcbe06a,_0x4ec4d4,_0x5a1d18,_0x3411aa,_0x96bfbe){return squel['select']()['field']('phone')['from'](_0x3411aa)[_0x80ba('0x10')](_0x4ec4d4,null,_0x4ec4d4+_0x80ba('0x11')+_0x3411aa+'.'+_0x5a1d18)[_0x80ba('0x12')](_0x3411aa+'.'+_0x5a1d18+_0x80ba('0x13')+_0xcbe06a+'.'+_0x5a1d18)[_0x80ba('0x12')](_0x4ec4d4+_0x80ba('0x14')+_0x96bfbe['join']()+')');}function insertCmHopper(_0x15becd,_0x54c52f,_0x5e9987,_0x3e5c52,_0x2cee8f){var _0xa67a3e=[_0x80ba('0x15'),'cm_contacts.scheduledat',_0x80ba('0x16'),'cm_contacts.ListId',_0x54c52f+'.'+_0x3e5c52,_0x80ba('0x17'),'cm_contacts.updatedAt',_0x80ba('0x18'),_0x80ba('0x19'),'\x22'+_0x2cee8f+'\x22'];return squel[_0x80ba('0x1a')]()[_0x80ba('0x1b')](_0x80ba('0x1c'))[_0x80ba('0x1d')]([_0x80ba('0x1e'),_0x80ba('0x1f'),_0x80ba('0x20'),'ListId',_0x3e5c52,_0x80ba('0x21'),'updatedAt',_0x80ba('0x22'),_0x80ba('0x23'),_0x80ba('0x24')],squel[_0x80ba('0x25')]()[_0x80ba('0x26')](_0xa67a3e)[_0x80ba('0x27')](_0x54c52f)[_0x80ba('0x10')](_0x80ba('0x28'),null,_0x80ba('0x29')+_0x54c52f+_0x80ba('0x2a'))[_0x80ba('0x10')](_0x5e9987,null,_0x5e9987+_0x80ba('0x11')+_0x54c52f+'.'+_0x3e5c52)['where'](_0x54c52f+_0x80ba('0x2b'),_0x15becd)[_0x80ba('0x12')](_0x80ba('0x2c'),NOW)[_0x80ba('0x12')](_0x80ba('0x2d'),selectNotIn(_0x54c52f,_0x5e9987,_0x3e5c52,_0x80ba('0x1c'),[_0x80ba('0x2e'),_0x80ba('0x2f')]))[_0x80ba('0x12')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x54c52f,_0x5e9987,_0x3e5c52,'cm_hopper',[_0x80ba('0x2e')])))['toString']();}function insertCmHopperBlack(_0x7de8ac,_0x3b8846,_0x2640af,_0x29ccf2){var _0x13493a=[_0x80ba('0x15'),_0x80ba('0x16'),_0x80ba('0x30'),_0x3b8846+'.'+_0x29ccf2,_0x80ba('0x17'),'cm_contacts.updatedAt'];return squel[_0x80ba('0x1a')]()[_0x80ba('0x1b')]('cm_hopper_black')[_0x80ba('0x1d')]([_0x80ba('0x1e'),_0x80ba('0x20'),'ListId',_0x29ccf2,_0x80ba('0x21'),'updatedAt'],squel[_0x80ba('0x25')]()[_0x80ba('0x26')](_0x13493a)[_0x80ba('0x27')](_0x3b8846)['join'](_0x80ba('0x28'),null,_0x80ba('0x29')+_0x3b8846+'.CmListId')['join'](_0x2640af,null,_0x2640af+'.id\x20=\x20'+_0x3b8846+'.'+_0x29ccf2)[_0x80ba('0x12')](_0x3b8846+'.CmListId\x20=\x20?',_0x7de8ac)[_0x80ba('0x12')](_0x80ba('0x2c'),NOW)[_0x80ba('0x12')](_0x80ba('0x2d'),squel[_0x80ba('0x25')]()['field'](_0x80ba('0x1e'))[_0x80ba('0x27')](_0x80ba('0x31'))[_0x80ba('0x12')](_0x80ba('0x32'),_0x7de8ac)[_0x80ba('0x12')](_0x29ccf2+'\x20=\x20?',_0x3b8846+'.'+_0x29ccf2)))['toString']();}function insertCmContact(_0x537cd2,_0x397710,_0xf8cb5f,_0x230429){var _0x4d17e9=_[_0x80ba('0x33')](_[_0x80ba('0x34')](_0x230429),[_0x80ba('0x35'),_0x80ba('0x36'),_0x80ba('0x21'),_0x80ba('0x37')]);return squel[_0x80ba('0x1a')]()[_0x80ba('0x1b')](_0x80ba('0x28'))[_0x80ba('0x1d')](_0x4d17e9,squel['select']()[_0x80ba('0x26')](_0x4d17e9)[_0x80ba('0x27')](_0x397710)['where']('('+_0xf8cb5f[_0x80ba('0x10')](',')+_0x80ba('0x38'),squel[_0x80ba('0x25')]()[_0x80ba('0x26')](_0xf8cb5f)[_0x80ba('0x27')]('cm_contacts')[_0x80ba('0x12')](_0x80ba('0x32'),_0x537cd2)[_0x80ba('0x12')]('deletedAt\x20IS\x20NULL'))['where'](_0x80ba('0x39'),squel[_0x80ba('0x25')]()['field'](_0x80ba('0x3a'),_0x80ba('0x3b'))[_0x80ba('0x27')](_0x397710)[_0x80ba('0x3c')](_0xf8cb5f[_0x80ba('0x10')](','))))[_0x80ba('0x3d')]();}function handleStop(){logger[_0x80ba('0x3e')](_0x80ba('0x3f'));stopped=!![];}function handleUncaughtException(_0x2f210c){logger[_0x80ba('0x40')](_0x2f210c['message']);process[_0x80ba('0x41')](0x1);}function handleError(_0x10b21d,_0x49ec2b){stats[_0x80ba('0x42')][_0x80ba('0x43')]({'name':_0x49ec2b[_0x80ba('0x44')],'message':_0x49ec2b[_0x80ba('0x45')],'row':_0x10b21d});}function handleQuery(_0x338dd7){logger[_0x80ba('0x3e')](_0x338dd7);return db[_0x80ba('0x46')][_0x80ba('0x47')](_0x338dd7)[_0x80ba('0x48')](function(_0x54cb67){results[_0x80ba('0x43')](_0x54cb67);})[_0x80ba('0x49')](function(_0xad5ac8){logger[_0x80ba('0x40')](_0xad5ac8[_0x80ba('0x45')]);});}function main(_0x1b3a29,_0x54d093,_0x2370ec,_0x4ee362){logger[_0x80ba('0x3e')](_0x80ba('0x4a'),_0x1b3a29,JSON['stringify'](_0x54d093));process[_0x80ba('0x4b')](_0x80ba('0x4c'));var _0xc3013f=_0x54d093[_0x80ba('0x4d')];var _0x3290d0=_0x54d093[_0x80ba('0x4e')];var _0xd35da9=path[_0x80ba('0x10')](config[_0x80ba('0x4f')],_0x80ba('0x50'),_0x3290d0+'.csv');var _0x364783=_[_0x80ba('0x34')](_0xc3013f)['join']();logger[_0x80ba('0x3e')](_0x80ba('0x51'),_0x364783);fs[_0x80ba('0x52')](_0xd35da9,_0x364783+'\x0a');Papa[_0x80ba('0x53')](fs['createReadStream'](_0x1b3a29),{'header':!![],'skipEmptyLines':!![],'step':function(_0x236749,_0x3aa9f0){try{for(var _0x6e8a95=0x0,_0x52f186=[];_0x6e8a95<_0x236749[_0x80ba('0x54')][_0x80ba('0x55')];_0x6e8a95++){stats[_0x80ba('0x56')]+=0x1;if(_0x236749[_0x80ba('0x42')][_0x6e8a95]){handleError(_0x236749[_0x80ba('0x54')][_0x6e8a95],_0x236749[_0x80ba('0x42')][_0x6e8a95]);}else{var _0x1149e2=[];for(var _0x3bdcfa in _0xc3013f){if(_0xc3013f[_0x80ba('0x57')](_0x3bdcfa)){if(_0x236749['data'][_0x6e8a95][_0xc3013f[_0x3bdcfa]]){var _0x5c6eae=_[_0x80ba('0x58')](_0x236749[_0x80ba('0x54')][_0x6e8a95][_0xc3013f[_0x3bdcfa]][_0x80ba('0x59')](/"/g,'\x27'));switch(_0x3bdcfa){case _0x80ba('0x1f'):var _0x3a88d5=moment(_0x5c6eae,_0x80ba('0xe'),!![]);if(_0x3a88d5['isValid']()){_0x52f186[_0x80ba('0x43')]('\x22'+_0x5c6eae+'\x22');}else{_0x1149e2[_0x80ba('0x43')](_0x80ba('0x5a'));}break;case _0x80ba('0x22'):var _0xa157cb=parseInt(_0x5c6eae);_0x5c6eae=_['isNaN'](_0xa157cb)||_0xa157cb<0x0||_0xa157cb>0x4?_0x4ee362?0x3:0x2:_0xa157cb;_0x52f186['push']('\x22'+_0x5c6eae+'\x22');break;case _0x80ba('0x23'):var _0x2177aa=parseInt(_0x5c6eae);if(_['isNumber'](_0x2177aa)&&_['includes'](_0x2370ec,_0x2177aa)){_0x52f186[_0x80ba('0x43')]('\x22'+_0x2177aa+'\x22');}else{_0x1149e2[_0x80ba('0x43')](_0x80ba('0x5b'));}break;case _0x80ba('0x5c'):if(isEmail(_0x5c6eae)){_0x52f186[_0x80ba('0x43')]('\x22'+_0x5c6eae+'\x22');}else{_0x1149e2[_0x80ba('0x43')](_0x80ba('0x5d'));}break;case _0x80ba('0x5e'):var _0x18d2bf=moment(_0x5c6eae,_0x80ba('0x5f'),!![]);if(_0x18d2bf[_0x80ba('0x60')]()){_0x52f186[_0x80ba('0x43')]('\x22'+_0x5c6eae+'\x22');}else{_0x1149e2[_0x80ba('0x43')]('dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)');}break;default:_0x52f186[_0x80ba('0x43')]('\x22'+_0x5c6eae+'\x22');}}else{switch(_0x3bdcfa){case _0x80ba('0x61'):case _0x80ba('0x1e'):_0x1149e2[_0x80ba('0x43')](_0x3bdcfa+'\x20not\x20specified');break;default:_0x52f186['push']('\x22\x22');}}}}if(_0x1149e2[_0x80ba('0x55')]){handleError(_0x236749[_0x80ba('0x54')][_0x6e8a95],{'code':_0x80ba('0x62'),'message':_0x1149e2[_0x80ba('0x10')]()});}else{fs['appendFileSync'](_0xd35da9,_0x52f186[_0x80ba('0x10')]()+'\x0a');}_0x52f186=[];}if(!(stats[_0x80ba('0x56')]%0xc8)){socket[_0x80ba('0x63')](_0x80ba('0x64')+_0x3290d0,stats);stats[_0x80ba('0x42')]=[];}}if(stopped){logger['info'](_0x80ba('0x65'));_0x3aa9f0[_0x80ba('0x66')]();}}catch(_0x141ab4){handleError(_0x236749[_0x80ba('0x54')][_0x6e8a95],{'code':_0x80ba('0x67'),'message':_0x141ab4[_0x80ba('0x45')]});logger[_0x80ba('0x40')](_0x80ba('0x68'),_0x141ab4['message']);}},'complete':function(){try{var _0x53ca14=[];var _0x282acb='cm_contacts';if(_0x54d093[_0x80ba('0x69')]&&_0x54d093['duplicates']['length']){_0x282acb='cm_contacts_'+_0x3290d0;_0x53ca14['push'](_0x80ba('0x6a')+_0x282acb+'\x20LIKE\x20cm_contacts;');}var _0x3c5b62=util[_0x80ba('0xd')](_0x80ba('0x6b'),_0xd35da9,_0x282acb,_0x364783,_0x54d093[_0x80ba('0x35')],_0x54d093[_0x80ba('0x36')]||null,NOW,NOW);if(_['isNil'](_0xc3013f[_0x80ba('0x1f')])){_0x3c5b62+=_0x80ba('0x6c');}_0x53ca14[_0x80ba('0x43')](_0x3c5b62);if(_0x54d093[_0x80ba('0x69')]&&_0x54d093[_0x80ba('0x69')][_0x80ba('0x55')]){_0x53ca14[_0x80ba('0x43')](insertCmContact(_0x54d093[_0x80ba('0x35')],_0x282acb,_0x54d093[_0x80ba('0x69')],_0xc3013f));_0x53ca14[_0x80ba('0x43')](_0x80ba('0x6d')+_0x282acb+';');}_0x53ca14[_0x80ba('0x43')](insertCmHopper(_0x54d093[_0x80ba('0x35')],_0x80ba('0x6e'),_0x80ba('0x6f'),_0x80ba('0x70'),_0x4ee362));_0x53ca14['push'](insertCmHopperBlack(_0x54d093[_0x80ba('0x35')],_0x80ba('0x71'),_0x80ba('0x6f'),_0x80ba('0x70')));_0x53ca14[_0x80ba('0x43')](insertCmHopper(_0x54d093[_0x80ba('0x35')],_0x80ba('0x72'),_0x80ba('0x73'),_0x80ba('0x74'),_0x4ee362));_0x53ca14['push'](insertCmHopperBlack(_0x54d093['ListId'],'campaigns_has_cm_blacklists',_0x80ba('0x73'),_0x80ba('0x74')));BPromise[_0x80ba('0x75')](_0x53ca14,handleQuery)[_0x80ba('0x76')](function(_0x56b576){stats[_0x80ba('0x77')]=!![];stats[_0x80ba('0x78')]=_0x54d093[_0x80ba('0x69')]&&_0x54d093[_0x80ba('0x69')][_0x80ba('0x55')]?results[0x2][_0x80ba('0x78')]:results[0x0][_0x80ba('0x78')];socket[_0x80ba('0x63')](_0x80ba('0x64')+_0x3290d0,stats);fs[_0x80ba('0x79')](_0x1b3a29);fs['unlink'](_0xd35da9);process[_0x80ba('0x41')](0x0);})['catch'](function(_0x5bca6c){logger[_0x80ba('0x40')](_0x5bca6c[_0x80ba('0x45')]);process[_0x80ba('0x41')](0x1);});}catch(_0x38a6a0){logger['error'](_0x80ba('0x7a'),_0x38a6a0[_0x80ba('0x45')]);process[_0x80ba('0x41')](0x1);}},'error':function(_0x4d685b,_0x12495,_0x14f6a4,_0x198f79){throw new Error(_0x198f79);}});}function validate(){if(process[_0x80ba('0x7b')]&&process[_0x80ba('0x7b')][_0x80ba('0x55')]<0x4){throw new Error(_0x80ba('0x7c'));}var _0x3b79c7=path[_0x80ba('0x10')](config['root'],_0x80ba('0x50'),process[_0x80ba('0x7b')][0x2]);if(!fs[_0x80ba('0x7d')](_0x3b79c7)){throw new Error('file\x20doesn\x27t\x20exists');}var _0x5dc760={};try{_0x5dc760=JSON[_0x80ba('0x53')](process[_0x80ba('0x7b')][0x3]);if(!_0x5dc760['binding']){throw new Error(_0x80ba('0x7e'));}if(!_0x5dc760['binding'][_0x80ba('0x1e')]){throw new Error('phone\x20is\x20mandatory');}if(!_0x5dc760[_0x80ba('0x4d')][_0x80ba('0x61')]){throw new Error('firstName\x20is\x20mandatory');}var _0x577be0=0x0;if(_0x5dc760[_0x80ba('0x4d')][_0x80ba('0x23')]){_0x577be0=0x1;}if(!_0x5dc760[_0x80ba('0x35')]){throw new Error('ListId\x20is\x20mandatory');}}catch(_0x57003f){throw new Error(_0x80ba('0x7f'));}var _0xf50071=[];try{_0xf50071=_['map'](JSON[_0x80ba('0x53')](process[_0x80ba('0x7b')][0x4]),'id');}catch(_0x2062db){logger[_0x80ba('0x3e')](_0x80ba('0x80'));}main(_0x3b79c7,_0x5dc760,_0xf50071,_0x577be0);}validate();process['on'](_0x80ba('0x81'),handleStop);process['on'](_0x80ba('0x82'),handleUncaughtException); \ No newline at end of file +var _0xa5b6=['cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','insert','cm_hopper','fromQuery','scheduledat','ContactId','ListId','createdAt','updatedAt','UserId','recallme','cm_contacts.ListId\x20=\x20','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','toString','into','fields','cm_contacts','.CmListId','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','field','ListId\x20=\x20?','\x20=\x20?','concat','keys','CompanyId','id\x20IN\x20?','MIN(id)','min_id','group','info','Received\x20SIGINT','error','message','exit','push','code','sequelize','spread','main','start','socket_timestamp','server/files/tmp','.csv','writeFileSync','createReadStream','data','length','rows','errors','hasOwnProperty','trim','replace','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','priority','isNaN','includes','agent\x20not\x20exists','email','email\x20wrong\x20format','isValid','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','\x20not\x20specified','appendFileSync','emit','contact:import:','SystemError','step','duplicates','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','isNil',',\x20scheduledAt\x20=\x20NOW()','DROP\x20TABLE\x20','voice_queues_has_cm_lists','voice_queues','VoiceQueueId','voice_queues_has_cm_blacklists','campaigns_has_cm_lists','campaigns','CampaignId','campaigns_has_cm_blacklists','each','then','finish','affectedRows','unlink','catch','complete','argv','arguments\x20\x20\x20','existsSync','file\x20doesn\x27t\x20exists','parse','binding','binding\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','firstName','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','map','No\x20agent\x20available','SIGINT','uncaughtException','path','lodash','papaparse','util','bluebird','moment','squel','../../../mysqldb','../../../config/environment','import','defaults','redis','localhost','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','test','select','phone','from','join','.id\x20=\x20','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt'];(function(_0x499b91,_0x13f90e){var _0xd9a4e8=function(_0x589c73){while(--_0x589c73){_0x499b91['push'](_0x499b91['shift']());}};_0xd9a4e8(++_0x13f90e);}(_0xa5b6,0x6b));var _0x6a5b=function(_0xb66df,_0x4fb5ce){_0xb66df=_0xb66df-0x0;var _0x42a702=_0xa5b6[_0xb66df];return _0x42a702;};'use strict';var fs=require('fs');var path=require(_0x6a5b('0x0'));var _=require(_0x6a5b('0x1'));var Papa=require(_0x6a5b('0x2'));var util=require(_0x6a5b('0x3'));var BPromise=require(_0x6a5b('0x4'));var moment=require(_0x6a5b('0x5'));var squel=require(_0x6a5b('0x6'));var Redis=require('ioredis');var db=require(_0x6a5b('0x7'))['db'];var config=require(_0x6a5b('0x8'));var logger=require('../../../config/logger')(_0x6a5b('0x9'));config['redis']=_[_0x6a5b('0xa')](config[_0x6a5b('0xb')],{'host':_0x6a5b('0xc'),'port':0x18eb});var socket=require(_0x6a5b('0xd'))(new Redis(config[_0x6a5b('0xb')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var stopped=![];var NOW=moment()[_0x6a5b('0xe')](_0x6a5b('0xf'));function isEmail(_0x23bc09){return/^([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22))*\x40([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d))*$/[_0x6a5b('0x10')](_0x23bc09);}function selectNotIn(_0x29b3c3,_0x3ceb2a,_0x460bf9,_0x51787e,_0x11f1f6){return squel[_0x6a5b('0x11')]()['field'](_0x6a5b('0x12'))[_0x6a5b('0x13')](_0x51787e)[_0x6a5b('0x14')](_0x3ceb2a,null,_0x3ceb2a+_0x6a5b('0x15')+_0x51787e+'.'+_0x460bf9)[_0x6a5b('0x16')](_0x51787e+'.'+_0x460bf9+_0x6a5b('0x17')+_0x29b3c3+'.'+_0x460bf9)['where'](_0x3ceb2a+_0x6a5b('0x18')+_0x11f1f6['join']()+')');}function insertCmHopper(_0x5d2922,_0x215042,_0x3f04fc,_0x12467f,_0x5cf43a){var _0x8a883e=[_0x6a5b('0x19'),_0x6a5b('0x1a'),_0x6a5b('0x1b'),_0x6a5b('0x1c'),_0x215042+'.'+_0x12467f,_0x6a5b('0x1d'),_0x6a5b('0x1e'),_0x6a5b('0x1f'),_0x6a5b('0x20'),'\x22'+_0x5cf43a+'\x22'];return squel[_0x6a5b('0x21')]()['into'](_0x6a5b('0x22'))[_0x6a5b('0x23')]([_0x6a5b('0x12'),_0x6a5b('0x24'),_0x6a5b('0x25'),_0x6a5b('0x26'),_0x12467f,_0x6a5b('0x27'),_0x6a5b('0x28'),'priority',_0x6a5b('0x29'),_0x6a5b('0x2a')],squel['select']()['fields'](_0x8a883e)['from'](_0x215042)['join']('cm_contacts',null,_0x6a5b('0x2b')+_0x215042+'.CmListId')[_0x6a5b('0x14')](_0x3f04fc,null,_0x3f04fc+_0x6a5b('0x15')+_0x215042+'.'+_0x12467f)[_0x6a5b('0x16')](_0x215042+'.CmListId\x20=\x20?',_0x5d2922)[_0x6a5b('0x16')]('cm_contacts.createdAt\x20=\x20?',NOW)['where'](_0x6a5b('0x2c'),selectNotIn(_0x215042,_0x3f04fc,_0x12467f,_0x6a5b('0x22'),[_0x6a5b('0x2d'),'\x22onlyIfOpen\x22']))[_0x6a5b('0x16')](_0x6a5b('0x2c'),selectNotIn(_0x215042,_0x3f04fc,_0x12467f,_0x6a5b('0x22'),['\x22always\x22'])))[_0x6a5b('0x2e')]();}function insertCmHopperBlack(_0x22b21f,_0x189848,_0x3bcfe8,_0x5883f7){var _0x5584ab=['cm_contacts.phone',_0x6a5b('0x1b'),_0x6a5b('0x1c'),_0x189848+'.'+_0x5883f7,_0x6a5b('0x1d'),_0x6a5b('0x1e')];return squel[_0x6a5b('0x21')]()[_0x6a5b('0x2f')]('cm_hopper_black')['fromQuery']([_0x6a5b('0x12'),_0x6a5b('0x25'),_0x6a5b('0x26'),_0x5883f7,_0x6a5b('0x27'),_0x6a5b('0x28')],squel[_0x6a5b('0x11')]()[_0x6a5b('0x30')](_0x5584ab)[_0x6a5b('0x13')](_0x189848)[_0x6a5b('0x14')](_0x6a5b('0x31'),null,_0x6a5b('0x2b')+_0x189848+_0x6a5b('0x32'))['join'](_0x3bcfe8,null,_0x3bcfe8+_0x6a5b('0x15')+_0x189848+'.'+_0x5883f7)['where'](_0x189848+_0x6a5b('0x33'),_0x22b21f)['where'](_0x6a5b('0x34'),NOW)[_0x6a5b('0x16')](_0x6a5b('0x2c'),squel[_0x6a5b('0x11')]()[_0x6a5b('0x35')](_0x6a5b('0x12'))[_0x6a5b('0x13')]('cm_hopper_black')[_0x6a5b('0x16')](_0x6a5b('0x36'),_0x22b21f)[_0x6a5b('0x16')](_0x5883f7+_0x6a5b('0x37'),_0x189848+'.'+_0x5883f7)))['toString']();}function insertCmContact(_0xa7fed9,_0x57fe4d,_0x471ba9,_0x3e5e35){var _0x1362fa=_[_0x6a5b('0x38')](_[_0x6a5b('0x39')](_0x3e5e35),[_0x6a5b('0x26'),_0x6a5b('0x3a'),_0x6a5b('0x27'),'updatedAt']);return squel[_0x6a5b('0x21')]()['into'](_0x6a5b('0x31'))['fromQuery'](_0x1362fa,squel[_0x6a5b('0x11')]()[_0x6a5b('0x30')](_0x1362fa)[_0x6a5b('0x13')](_0x57fe4d)[_0x6a5b('0x16')]('('+_0x471ba9[_0x6a5b('0x14')](',')+')\x20NOT\x20IN\x20?',squel[_0x6a5b('0x11')]()[_0x6a5b('0x30')](_0x471ba9)[_0x6a5b('0x13')](_0x6a5b('0x31'))[_0x6a5b('0x16')]('ListId\x20=\x20?',_0xa7fed9)[_0x6a5b('0x16')]('deletedAt\x20IS\x20NULL'))[_0x6a5b('0x16')](_0x6a5b('0x3b'),squel['select']()['field'](_0x6a5b('0x3c'),_0x6a5b('0x3d'))[_0x6a5b('0x13')](_0x57fe4d)[_0x6a5b('0x3e')](_0x471ba9[_0x6a5b('0x14')](','))))[_0x6a5b('0x2e')]();}function handleStop(){logger[_0x6a5b('0x3f')](_0x6a5b('0x40'));stopped=!![];}function handleUncaughtException(_0x41157a){logger[_0x6a5b('0x41')](_0x41157a[_0x6a5b('0x42')]);process[_0x6a5b('0x43')](0x1);}function handleError(_0x266fd0,_0x3ef129){stats['errors'][_0x6a5b('0x44')]({'name':_0x3ef129[_0x6a5b('0x45')],'message':_0x3ef129[_0x6a5b('0x42')],'row':_0x266fd0});}function handleQuery(_0x817244){logger['info'](_0x817244);return db[_0x6a5b('0x46')]['query'](_0x817244)[_0x6a5b('0x47')](function(_0x3fc152){results[_0x6a5b('0x44')](_0x3fc152);})['catch'](function(_0x53de3f){logger['error'](_0x53de3f[_0x6a5b('0x42')]);});}function main(_0x5ce4fb,_0x1ce550,_0x18408a,_0xa097b5){logger[_0x6a5b('0x3f')](_0x6a5b('0x48'),_0x5ce4fb,JSON['stringify'](_0x1ce550));process['send'](_0x6a5b('0x49'));var _0x1780c0=_0x1ce550['binding'];var _0x2fb34a=_0x1ce550[_0x6a5b('0x4a')];var _0x5c21d5=path['join'](config['root'],_0x6a5b('0x4b'),_0x2fb34a+_0x6a5b('0x4c'));var _0x37052d=_[_0x6a5b('0x39')](_0x1780c0)[_0x6a5b('0x14')]();logger[_0x6a5b('0x3f')]('header',_0x37052d);fs[_0x6a5b('0x4d')](_0x5c21d5,_0x37052d+'\x0a');Papa['parse'](fs[_0x6a5b('0x4e')](_0x5ce4fb),{'header':!![],'skipEmptyLines':!![],'step':function(_0xf524d7,_0x199a01){try{for(var _0xd7342a=0x0,_0x2dc056=[];_0xd7342a<_0xf524d7[_0x6a5b('0x4f')][_0x6a5b('0x50')];_0xd7342a++){stats[_0x6a5b('0x51')]+=0x1;if(_0xf524d7[_0x6a5b('0x52')][_0xd7342a]){handleError(_0xf524d7['data'][_0xd7342a],_0xf524d7['errors'][_0xd7342a]);}else{var _0x43a91a=[];for(var _0x4d65de in _0x1780c0){if(_0x1780c0[_0x6a5b('0x53')](_0x4d65de)){if(_0xf524d7[_0x6a5b('0x4f')][_0xd7342a][_0x1780c0[_0x4d65de]]){var _0x124ead=_[_0x6a5b('0x54')](_0xf524d7[_0x6a5b('0x4f')][_0xd7342a][_0x1780c0[_0x4d65de]][_0x6a5b('0x55')](/"/g,'\x27'));switch(_0x4d65de){case _0x6a5b('0x24'):var _0x4f2135=moment(_0x124ead,_0x6a5b('0xf'),!![]);if(_0x4f2135['isValid']()){_0x2dc056['push']('\x22'+_0x124ead+'\x22');}else{_0x43a91a[_0x6a5b('0x44')](_0x6a5b('0x56'));}break;case _0x6a5b('0x57'):var _0x45077c=parseInt(_0x124ead);_0x124ead=_[_0x6a5b('0x58')](_0x45077c)||_0x45077c<0x0||_0x45077c>0x4?_0xa097b5?0x3:0x2:_0x45077c;_0x2dc056[_0x6a5b('0x44')]('\x22'+_0x124ead+'\x22');break;case'UserId':var _0x2c63e0=parseInt(_0x124ead);if(_['isNumber'](_0x2c63e0)&&_[_0x6a5b('0x59')](_0x18408a,_0x2c63e0)){_0x2dc056[_0x6a5b('0x44')]('\x22'+_0x2c63e0+'\x22');}else{_0x43a91a[_0x6a5b('0x44')](_0x6a5b('0x5a'));}break;case _0x6a5b('0x5b'):if(isEmail(_0x124ead)){_0x2dc056['push']('\x22'+_0x124ead+'\x22');}else{_0x43a91a[_0x6a5b('0x44')](_0x6a5b('0x5c'));}break;case'dateOfBirth':var _0x2a818d=moment(_0x124ead,'YYYY-MM-DD',!![]);if(_0x2a818d[_0x6a5b('0x5d')]()){_0x2dc056[_0x6a5b('0x44')]('\x22'+_0x124ead+'\x22');}else{_0x43a91a['push'](_0x6a5b('0x5e'));}break;default:_0x2dc056[_0x6a5b('0x44')]('\x22'+_0x124ead+'\x22');}}else{switch(_0x4d65de){case'firstName':case _0x6a5b('0x12'):_0x43a91a[_0x6a5b('0x44')](_0x4d65de+_0x6a5b('0x5f'));break;default:_0x2dc056['push']('\x22\x22');}}}}if(_0x43a91a['length']){handleError(_0xf524d7[_0x6a5b('0x4f')][_0xd7342a],{'code':'SystemRow','message':_0x43a91a['join']()});}else{fs[_0x6a5b('0x60')](_0x5c21d5,_0x2dc056[_0x6a5b('0x14')]()+'\x0a');}_0x2dc056=[];}if(!(stats['rows']%0xc8)){socket[_0x6a5b('0x61')](_0x6a5b('0x62')+_0x2fb34a,stats);stats[_0x6a5b('0x52')]=[];}}if(stopped){logger[_0x6a5b('0x3f')]('Abort\x20parser');_0x199a01['abort']();}}catch(_0x19200f){handleError(_0xf524d7[_0x6a5b('0x4f')][_0xd7342a],{'code':_0x6a5b('0x63'),'message':_0x19200f[_0x6a5b('0x42')]});logger[_0x6a5b('0x41')](_0x6a5b('0x64'),_0x19200f[_0x6a5b('0x42')]);}},'complete':function(){try{var _0x5aa016=[];var _0x50b627=_0x6a5b('0x31');if(_0x1ce550[_0x6a5b('0x65')]&&_0x1ce550[_0x6a5b('0x65')]['length']){_0x50b627='cm_contacts_'+_0x2fb34a;_0x5aa016[_0x6a5b('0x44')](_0x6a5b('0x66')+_0x50b627+_0x6a5b('0x67'));}var _0x3a35c7=util[_0x6a5b('0xe')]('LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20id\x20=\x20NULL,\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27',_0x5c21d5,_0x50b627,_0x37052d,_0x1ce550[_0x6a5b('0x26')],_0x1ce550[_0x6a5b('0x3a')]||null,NOW,NOW);if(_[_0x6a5b('0x68')](_0x1780c0[_0x6a5b('0x24')])){_0x3a35c7+=_0x6a5b('0x69');}_0x5aa016[_0x6a5b('0x44')](_0x3a35c7);if(_0x1ce550[_0x6a5b('0x65')]&&_0x1ce550['duplicates'][_0x6a5b('0x50')]){_0x5aa016[_0x6a5b('0x44')](insertCmContact(_0x1ce550[_0x6a5b('0x26')],_0x50b627,_0x1ce550['duplicates'],_0x1780c0));_0x5aa016[_0x6a5b('0x44')](_0x6a5b('0x6a')+_0x50b627+';');}_0x5aa016[_0x6a5b('0x44')](insertCmHopper(_0x1ce550[_0x6a5b('0x26')],_0x6a5b('0x6b'),_0x6a5b('0x6c'),_0x6a5b('0x6d'),_0xa097b5));_0x5aa016[_0x6a5b('0x44')](insertCmHopperBlack(_0x1ce550['ListId'],_0x6a5b('0x6e'),_0x6a5b('0x6c'),'VoiceQueueId'));_0x5aa016[_0x6a5b('0x44')](insertCmHopper(_0x1ce550['ListId'],_0x6a5b('0x6f'),_0x6a5b('0x70'),_0x6a5b('0x71'),_0xa097b5));_0x5aa016[_0x6a5b('0x44')](insertCmHopperBlack(_0x1ce550['ListId'],_0x6a5b('0x72'),_0x6a5b('0x70'),'CampaignId'));BPromise[_0x6a5b('0x73')](_0x5aa016,handleQuery)[_0x6a5b('0x74')](function(_0x5e1448){stats[_0x6a5b('0x75')]=!![];stats[_0x6a5b('0x76')]=_0x1ce550[_0x6a5b('0x65')]&&_0x1ce550[_0x6a5b('0x65')]['length']?results[0x2]['affectedRows']:results[0x0][_0x6a5b('0x76')];socket['emit'](_0x6a5b('0x62')+_0x2fb34a,stats);fs[_0x6a5b('0x77')](_0x5ce4fb);fs['unlink'](_0x5c21d5);process[_0x6a5b('0x43')](0x0);})[_0x6a5b('0x78')](function(_0x4b8fce){logger['error'](_0x4b8fce[_0x6a5b('0x42')]);process[_0x6a5b('0x43')](0x1);});}catch(_0x2efab4){logger[_0x6a5b('0x41')](_0x6a5b('0x79'),_0x2efab4[_0x6a5b('0x42')]);process[_0x6a5b('0x43')](0x1);}},'error':function(_0x2fc5ac,_0x4bd478,_0x4ab658,_0x498848){throw new Error(_0x498848);}});}function validate(){if(process['argv']&&process[_0x6a5b('0x7a')]['length']<0x4){throw new Error(_0x6a5b('0x7b'));}var _0x31e164=path['join'](config['root'],_0x6a5b('0x4b'),process[_0x6a5b('0x7a')][0x2]);if(!fs[_0x6a5b('0x7c')](_0x31e164)){throw new Error(_0x6a5b('0x7d'));}var _0xf8f284={};try{_0xf8f284=JSON[_0x6a5b('0x7e')](process[_0x6a5b('0x7a')][0x3]);if(!_0xf8f284[_0x6a5b('0x7f')]){throw new Error(_0x6a5b('0x80'));}if(!_0xf8f284[_0x6a5b('0x7f')][_0x6a5b('0x12')]){throw new Error(_0x6a5b('0x81'));}if(!_0xf8f284[_0x6a5b('0x7f')][_0x6a5b('0x82')]){throw new Error(_0x6a5b('0x83'));}var _0x27c6fd=0x0;if(_0xf8f284[_0x6a5b('0x7f')][_0x6a5b('0x29')]){_0x27c6fd=0x1;}if(!_0xf8f284[_0x6a5b('0x26')]){throw new Error(_0x6a5b('0x84'));}}catch(_0x4b6f33){throw new Error('body\x20id\x20mandatory');}var _0x5704c0=[];try{_0x5704c0=_[_0x6a5b('0x85')](JSON['parse'](process[_0x6a5b('0x7a')][0x4]),'id');}catch(_0x218489){logger[_0x6a5b('0x3f')](_0x6a5b('0x86'));}main(_0x31e164,_0xf8f284,_0x5704c0,_0x27c6fd);}validate();process['on'](_0x6a5b('0x87'),handleStop);process['on'](_0x6a5b('0x88'),handleUncaughtException); \ No newline at end of file diff --git a/server/components/integrations/configuration.js b/server/components/integrations/configuration.js index a4737f1..2ada281 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 _0xe12f=['getSubjects','string','[xCALLY\x20Ticket]','toLowerCase','inbound','push','variable','queue','calleridnum','outbound','getDescriptions','***\x20Call\x20Info\x20***','keyValue','Caller\x20Number','Caller\x20Name','calleridname','destexten','Queue','UniqueId','uniqueid','Date','agentcalledAt','destcalleridname','Agent\x20Number','destcalleridnum','***\x20Time\x20Info\x20***','Agent\x20Connect','agentcompleteAt','holdtime','membername','starttime','Complete\x20Time','endtime','Duration','duration','Billable\x20Time','billableseconds'];(function(_0x34cd13,_0x113ac4){var _0x15de19=function(_0x13bdea){while(--_0x13bdea){_0x34cd13['push'](_0x34cd13['shift']());}};_0x15de19(++_0x113ac4);}(_0xe12f,0xde));var _0xfe12=function(_0x293ad8,_0x180ac5){_0x293ad8=_0x293ad8-0x0;var _0x4dc4b8=_0xe12f[_0x293ad8];return _0x4dc4b8;};'use strict';exports[_0xfe12('0x0')]=function(_0x42e5b9,_0x3575f5){var _0x3a8cd8=[{'type':_0xfe12('0x1'),'content':_0xfe12('0x2'),'variableName':null}];switch(_0x42e5b9[_0xfe12('0x3')]()){case'voice':switch(_0x3575f5[_0xfe12('0x3')]()){case _0xfe12('0x4'):_0x3a8cd8[_0xfe12('0x5')]({'type':_0xfe12('0x6'),'content':'','variableName':_0xfe12('0x7')});_0x3a8cd8['push']({'type':_0xfe12('0x6'),'content':'','variableName':_0xfe12('0x8')});break;case _0xfe12('0x9'):_0x3a8cd8['push']({'type':_0xfe12('0x1'),'content':'Outbound\x20Call','variableName':null});_0x3a8cd8['push']({'type':_0xfe12('0x6'),'content':'','variableName':'destcalleridnum'});break;}}return _0x3a8cd8;};exports[_0xfe12('0xa')]=function(_0x33069d,_0x180851){var _0x5284bc=[];switch(_0x33069d['toLowerCase']()){case'voice':switch(_0x180851['toLowerCase']()){case _0xfe12('0x4'):_0x5284bc=[{'type':_0xfe12('0x1'),'content':_0xfe12('0xb'),'key':null,'keyType':null,'variableName':null},{'type':_0xfe12('0xc'),'content':'','key':_0xfe12('0xd'),'keyType':'variable','variableName':'calleridnum'},{'type':_0xfe12('0xc'),'content':'','key':_0xfe12('0xe'),'keyType':_0xfe12('0x6'),'variableName':_0xfe12('0xf')},{'type':'keyValue','content':'','key':'Call\x20To','keyType':_0xfe12('0x6'),'variableName':_0xfe12('0x10')},{'type':'keyValue','content':'','key':_0xfe12('0x11'),'keyType':_0xfe12('0x6'),'variableName':_0xfe12('0x7')},{'type':'keyValue','content':'','key':_0xfe12('0x12'),'keyType':'variable','variableName':_0xfe12('0x13')},{'type':'keyValue','content':'','key':_0xfe12('0x14'),'keyType':_0xfe12('0x6'),'variableName':_0xfe12('0x15')},{'type':_0xfe12('0x1'),'content':'***\x20Agent\x20Info\x20***','key':null,'keyType':null,'variableName':null},{'type':_0xfe12('0xc'),'content':'','key':'Agent\x20Name','keyType':_0xfe12('0x6'),'variableName':_0xfe12('0x16')},{'type':_0xfe12('0xc'),'content':'','key':_0xfe12('0x17'),'keyType':'variable','variableName':_0xfe12('0x18')},{'type':_0xfe12('0x1'),'content':_0xfe12('0x19'),'key':null,'keyType':null,'variableName':null},{'type':_0xfe12('0xc'),'content':'','key':'Agent\x20Ring','keyType':'variable','variableName':_0xfe12('0x15')},{'type':_0xfe12('0xc'),'content':'','key':_0xfe12('0x1a'),'keyType':_0xfe12('0x6'),'variableName':'agentconnectAt'},{'type':_0xfe12('0xc'),'content':'','key':'Agent\x20Complete','keyType':_0xfe12('0x6'),'variableName':_0xfe12('0x1b')},{'type':_0xfe12('0xc'),'content':'','key':'Hold\x20Time','keyType':_0xfe12('0x6'),'variableName':_0xfe12('0x1c')},{'type':'keyValue','content':'','key':'Talk\x20Time','keyType':'variable','variableName':'talktime'}];break;case _0xfe12('0x9'):_0x5284bc=[{'type':_0xfe12('0x1'),'content':_0xfe12('0xb'),'variableName':null},{'type':_0xfe12('0xc'),'content':'','key':'Called\x20Number','keyType':'variable','keyContent':'','variableName':_0xfe12('0x18')},{'type':_0xfe12('0xc'),'content':'','key':'Member\x20Name','keyType':_0xfe12('0x6'),'keyContent':'','variableName':_0xfe12('0x1d')},{'type':'keyValue','content':'','key':_0xfe12('0x12'),'keyType':'variable','keyContent':'','variableName':_0xfe12('0x13')},{'type':_0xfe12('0xc'),'content':'','key':'Date','keyType':'variable','keyContent':'','variableName':_0xfe12('0x1e')},{'type':_0xfe12('0x1'),'content':_0xfe12('0x19')},{'type':_0xfe12('0xc'),'content':'','key':'Answer\x20Time','keyType':'variable','keyContent':'','variableName':'answertime'},{'type':_0xfe12('0xc'),'content':'','key':_0xfe12('0x1f'),'keyType':_0xfe12('0x6'),'keyContent':'','variableName':_0xfe12('0x20')},{'type':'keyValue','content':'','key':_0xfe12('0x21'),'keyType':_0xfe12('0x6'),'keyContent':'','variableName':_0xfe12('0x22')},{'type':_0xfe12('0xc'),'content':'','key':_0xfe12('0x23'),'keyType':'variable','keyContent':'','variableName':_0xfe12('0x24')}];break;}}return _0x5284bc;}; \ No newline at end of file +var _0x4f4d=['agentcompleteAt','Hold\x20Time','holdtime','Talk\x20Time','talktime','Member\x20Name','membername','starttime','***\x20Time\x20Info\x20***','Answer\x20Time','Complete\x20Time','endtime','Duration','duration','Billable\x20Time','getSubjects','string','[xCALLY\x20Ticket]','toLowerCase','inbound','push','queue','variable','calleridnum','outbound','getDescriptions','***\x20Call\x20Info\x20***','keyValue','Caller\x20Name','Call\x20To','UniqueId','uniqueid','Date','***\x20Agent\x20Info\x20***','Agent\x20Name','destcalleridname','destcalleridnum','Agent\x20Ring','Agent\x20Complete'];(function(_0x2d9357,_0x2b2efd){var _0x334c81=function(_0x15f0fd){while(--_0x15f0fd){_0x2d9357['push'](_0x2d9357['shift']());}};_0x334c81(++_0x2b2efd);}(_0x4f4d,0x195));var _0xd4f4=function(_0x52b7b9,_0x43ed4b){_0x52b7b9=_0x52b7b9-0x0;var _0x5b5d30=_0x4f4d[_0x52b7b9];return _0x5b5d30;};'use strict';exports[_0xd4f4('0x0')]=function(_0x41aa9a,_0x560297){var _0xf0692b=[{'type':_0xd4f4('0x1'),'content':_0xd4f4('0x2'),'variableName':null}];switch(_0x41aa9a[_0xd4f4('0x3')]()){case'voice':switch(_0x560297['toLowerCase']()){case _0xd4f4('0x4'):_0xf0692b[_0xd4f4('0x5')]({'type':'variable','content':'','variableName':_0xd4f4('0x6')});_0xf0692b[_0xd4f4('0x5')]({'type':_0xd4f4('0x7'),'content':'','variableName':_0xd4f4('0x8')});break;case _0xd4f4('0x9'):_0xf0692b[_0xd4f4('0x5')]({'type':_0xd4f4('0x1'),'content':'Outbound\x20Call','variableName':null});_0xf0692b[_0xd4f4('0x5')]({'type':_0xd4f4('0x7'),'content':'','variableName':'destcalleridnum'});break;}}return _0xf0692b;};exports[_0xd4f4('0xa')]=function(_0x24b244,_0x3c7929){var _0x25e6e2=[];switch(_0x24b244[_0xd4f4('0x3')]()){case'voice':switch(_0x3c7929[_0xd4f4('0x3')]()){case _0xd4f4('0x4'):_0x25e6e2=[{'type':_0xd4f4('0x1'),'content':_0xd4f4('0xb'),'key':null,'keyType':null,'variableName':null},{'type':_0xd4f4('0xc'),'content':'','key':'Caller\x20Number','keyType':_0xd4f4('0x7'),'variableName':'calleridnum'},{'type':_0xd4f4('0xc'),'content':'','key':_0xd4f4('0xd'),'keyType':_0xd4f4('0x7'),'variableName':'calleridname'},{'type':_0xd4f4('0xc'),'content':'','key':_0xd4f4('0xe'),'keyType':_0xd4f4('0x7'),'variableName':'destexten'},{'type':_0xd4f4('0xc'),'content':'','key':'Queue','keyType':'variable','variableName':'queue'},{'type':'keyValue','content':'','key':_0xd4f4('0xf'),'keyType':_0xd4f4('0x7'),'variableName':_0xd4f4('0x10')},{'type':_0xd4f4('0xc'),'content':'','key':_0xd4f4('0x11'),'keyType':_0xd4f4('0x7'),'variableName':'agentcalledAt'},{'type':'string','content':_0xd4f4('0x12'),'key':null,'keyType':null,'variableName':null},{'type':_0xd4f4('0xc'),'content':'','key':_0xd4f4('0x13'),'keyType':'variable','variableName':_0xd4f4('0x14')},{'type':_0xd4f4('0xc'),'content':'','key':'Agent\x20Number','keyType':_0xd4f4('0x7'),'variableName':_0xd4f4('0x15')},{'type':_0xd4f4('0x1'),'content':'***\x20Time\x20Info\x20***','key':null,'keyType':null,'variableName':null},{'type':_0xd4f4('0xc'),'content':'','key':_0xd4f4('0x16'),'keyType':_0xd4f4('0x7'),'variableName':'agentcalledAt'},{'type':'keyValue','content':'','key':'Agent\x20Connect','keyType':_0xd4f4('0x7'),'variableName':'agentconnectAt'},{'type':'keyValue','content':'','key':_0xd4f4('0x17'),'keyType':_0xd4f4('0x7'),'variableName':_0xd4f4('0x18')},{'type':_0xd4f4('0xc'),'content':'','key':_0xd4f4('0x19'),'keyType':_0xd4f4('0x7'),'variableName':_0xd4f4('0x1a')},{'type':'keyValue','content':'','key':_0xd4f4('0x1b'),'keyType':_0xd4f4('0x7'),'variableName':_0xd4f4('0x1c')}];break;case _0xd4f4('0x9'):_0x25e6e2=[{'type':_0xd4f4('0x1'),'content':_0xd4f4('0xb'),'variableName':null},{'type':'keyValue','content':'','key':'Called\x20Number','keyType':_0xd4f4('0x7'),'keyContent':'','variableName':_0xd4f4('0x15')},{'type':_0xd4f4('0xc'),'content':'','key':_0xd4f4('0x1d'),'keyType':_0xd4f4('0x7'),'keyContent':'','variableName':_0xd4f4('0x1e')},{'type':_0xd4f4('0xc'),'content':'','key':_0xd4f4('0xf'),'keyType':_0xd4f4('0x7'),'keyContent':'','variableName':_0xd4f4('0x10')},{'type':_0xd4f4('0xc'),'content':'','key':'Date','keyType':_0xd4f4('0x7'),'keyContent':'','variableName':_0xd4f4('0x1f')},{'type':_0xd4f4('0x1'),'content':_0xd4f4('0x20')},{'type':_0xd4f4('0xc'),'content':'','key':_0xd4f4('0x21'),'keyType':_0xd4f4('0x7'),'keyContent':'','variableName':'answertime'},{'type':_0xd4f4('0xc'),'content':'','key':_0xd4f4('0x22'),'keyType':'variable','keyContent':'','variableName':_0xd4f4('0x23')},{'type':_0xd4f4('0xc'),'content':'','key':_0xd4f4('0x24'),'keyType':'variable','keyContent':'','variableName':_0xd4f4('0x25')},{'type':_0xd4f4('0xc'),'content':'','key':_0xd4f4('0x26'),'keyType':_0xd4f4('0x7'),'keyContent':'','variableName':'billableseconds'}];break;}}return _0x25e6e2;}; \ No newline at end of file diff --git a/server/components/interaction/service.js b/server/components/interaction/service.js index 47ccb3f..875bbed 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 _0xaffb=['[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','toUpperCase','name','role','null','findOne','then','update','info','catch','error','tracked','user','query','body','omit','html','lodash','../../mysqldb','../../config/logger','mail-interactions','fax-interactions','sms-interactions','chat-interactions','whatsapp-interactions','upperFirst','InteractionId','unknown','toLowerCase'];(function(_0x2c6df3,_0x379693){var _0x2fe1cc=function(_0x29cb03){while(--_0x29cb03){_0x2c6df3['push'](_0x2c6df3['shift']());}};_0x2fe1cc(++_0x379693);}(_0xaffb,0x85));var _0xbaff=function(_0x4715d2,_0x3371b2){_0x4715d2=_0x4715d2-0x0;var _0x141811=_0xaffb[_0x4715d2];return _0x141811;};'use strict';var _=require(_0xbaff('0x0'));var db=require(_0xbaff('0x1'))['db'];var loggers={'openchannel':require('../../config/logger')('openchannel-interactions'),'mail':require(_0xbaff('0x2'))(_0xbaff('0x3')),'fax':require(_0xbaff('0x2'))(_0xbaff('0x4')),'sms':require(_0xbaff('0x2'))(_0xbaff('0x5')),'chat':require(_0xbaff('0x2'))(_0xbaff('0x6')),'whatsapp':require(_0xbaff('0x2'))(_0xbaff('0x7'))};function getInteractionId(_0x3f861e,_0xc23ea4,_0x295e39){if(_0x3f861e&&_0x3f861e[_[_0xbaff('0x8')](_0x295e39)+_0xbaff('0x9')]){return _0x3f861e[_[_0xbaff('0x8')](_0x295e39)+_0xbaff('0x9')];}else if(_0x3f861e&&_0x3f861e['id']){return _0x3f861e['id'];}else if(_0xc23ea4&&_0xc23ea4['id']){return _0xc23ea4['id'];}else{return _0xbaff('0xa');}}function log(_0x52b335,_0x1d5ca5,_0x5caec6,_0x5d9e24,_0x1e540b,_0x479c3e){loggers[_0x1e540b[_0xbaff('0xb')]()][_0x52b335](_0xbaff('0xc'),_0x479c3e[_0xbaff('0xd')](),_0x1d5ca5?_0x1d5ca5['id']:null,_0x1d5ca5?_0x1d5ca5[_0xbaff('0xe')]:null,_0x1d5ca5?_0x1d5ca5[_0xbaff('0xf')]:null,getInteractionId(_0x5caec6,_0x5d9e24,_0x1e540b),_0x5caec6?JSON['stringify'](_0x5caec6):_0xbaff('0x10'));}function updateUser(_0xa82d8f,_0x5d4236,_0x16450c,_0x3f580c,_0x20a503){db[_[_0xbaff('0x8')](_0x3f580c)+'Interaction'][_0xbaff('0x11')]({'where':{'id':getInteractionId(_0x5d4236,_0x16450c,_0x3f580c)}})[_0xbaff('0x12')](function(_0x1a6d0b){if(_0x1a6d0b){return _0x1a6d0b[_0xbaff('0x13')]({'UserId':_0xa82d8f?_0xa82d8f['id']:null});}})[_0xbaff('0x12')](function(_0x3bbac4){if(_0x3bbac4){log(_0xbaff('0x14'),_0xa82d8f,_0x5d4236,_0x16450c,_0x3f580c,_0x20a503);}})[_0xbaff('0x15')](function(){log(_0xbaff('0x16'),_0xa82d8f,_0x5d4236,_0x16450c,_0x3f580c,_0x20a503);});}exports[_0xbaff('0x17')]=function(_0x3f6f94,_0x5e5060){return function(_0x5809a5,_0x30ff3d,_0x12e5c8){var _0x3ab75a=_0x5809a5[_0xbaff('0x18')];var _0x2e378b={};var _0xc362ff=_0x5809a5[_0xbaff('0x19')];if(_0x2e378b){_0x2e378b=_['clone'](_0x5809a5[_0xbaff('0x1a')]);_0x2e378b=_[_0xbaff('0x1b')](_0x2e378b,[_0xbaff('0x1a'),_0xbaff('0x1c'),'phone','fax','mobile']);}updateUser(_0x3ab75a,_0x2e378b,_0xc362ff,_0x3f6f94,_0x5e5060);_0x12e5c8(null);};}; \ No newline at end of file +var _0xe657=['clone','body','omit','html','fax','mobile','../../config/logger','mail-interactions','sms-interactions','whatsapp-interactions','upperFirst','InteractionId','unknown','toLowerCase','toUpperCase','role','null','Interaction','then','catch','error','tracked','user','query'];(function(_0x1d37fc,_0x4db492){var _0x652aa6=function(_0x34f767){while(--_0x34f767){_0x1d37fc['push'](_0x1d37fc['shift']());}};_0x652aa6(++_0x4db492);}(_0xe657,0x1ce));var _0x7e65=function(_0x1a7a16,_0x682c85){_0x1a7a16=_0x1a7a16-0x0;var _0xf0d62e=_0xe657[_0x1a7a16];return _0xf0d62e;};'use strict';var _=require('lodash');var db=require('../../mysqldb')['db'];var loggers={'openchannel':require(_0x7e65('0x0'))('openchannel-interactions'),'mail':require(_0x7e65('0x0'))(_0x7e65('0x1')),'fax':require(_0x7e65('0x0'))('fax-interactions'),'sms':require(_0x7e65('0x0'))(_0x7e65('0x2')),'chat':require(_0x7e65('0x0'))('chat-interactions'),'whatsapp':require('../../config/logger')(_0x7e65('0x3'))};function getInteractionId(_0x3092d3,_0x42d1ba,_0x336ba5){if(_0x3092d3&&_0x3092d3[_[_0x7e65('0x4')](_0x336ba5)+_0x7e65('0x5')]){return _0x3092d3[_[_0x7e65('0x4')](_0x336ba5)+_0x7e65('0x5')];}else if(_0x3092d3&&_0x3092d3['id']){return _0x3092d3['id'];}else if(_0x42d1ba&&_0x42d1ba['id']){return _0x42d1ba['id'];}else{return _0x7e65('0x6');}}function log(_0x52cd9d,_0x59e62c,_0x3bdcd7,_0x1b1cca,_0x41c827,_0x40c152){loggers[_0x41c827[_0x7e65('0x7')]()][_0x52cd9d]('[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x40c152[_0x7e65('0x8')](),_0x59e62c?_0x59e62c['id']:null,_0x59e62c?_0x59e62c['name']:null,_0x59e62c?_0x59e62c[_0x7e65('0x9')]:null,getInteractionId(_0x3bdcd7,_0x1b1cca,_0x41c827),_0x3bdcd7?JSON['stringify'](_0x3bdcd7):_0x7e65('0xa'));}function updateUser(_0x537170,_0x2c398b,_0x537315,_0xdf307b,_0x1c205e){db[_['upperFirst'](_0xdf307b)+_0x7e65('0xb')]['findOne']({'where':{'id':getInteractionId(_0x2c398b,_0x537315,_0xdf307b)}})['then'](function(_0x15ed0d){if(_0x15ed0d){return _0x15ed0d['update']({'UserId':_0x537170?_0x537170['id']:null});}})[_0x7e65('0xc')](function(_0x269bd9){if(_0x269bd9){log('info',_0x537170,_0x2c398b,_0x537315,_0xdf307b,_0x1c205e);}})[_0x7e65('0xd')](function(){log(_0x7e65('0xe'),_0x537170,_0x2c398b,_0x537315,_0xdf307b,_0x1c205e);});}exports[_0x7e65('0xf')]=function(_0x18afc7,_0x2f5b71){return function(_0x4b6ec7,_0x46273b,_0x5b7e4e){var _0x5c2d8d=_0x4b6ec7[_0x7e65('0x10')];var _0x168141={};var _0x355d98=_0x4b6ec7[_0x7e65('0x11')];if(_0x168141){_0x168141=_[_0x7e65('0x12')](_0x4b6ec7[_0x7e65('0x13')]);_0x168141=_[_0x7e65('0x14')](_0x168141,[_0x7e65('0x13'),_0x7e65('0x15'),'phone',_0x7e65('0x16'),_0x7e65('0x17')]);}updateUser(_0x5c2d8d,_0x168141,_0x355d98,_0x18afc7,_0x2f5b71);_0x5b7e4e(null);};}; \ No newline at end of file diff --git a/server/components/license/service.js b/server/components/license/service.js index 13c1c97..9772ad2 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 _0x29b0=['util','composable-middleware','../../mysqldb','../../config/environment','data1','license','split','createDecipher','%s:%s:%s','update','base64','utf8','final','parse','hasOwnProperty','use','License','findOne','then','count','status','format','Maximum\x20%s\x20limit\x20have\x20been\x20reached','users','User','admin','user','isUserLimit'];(function(_0x3477c4,_0x309176){var _0xb1b1b5=function(_0x497eeb){while(--_0x497eeb){_0x3477c4['push'](_0x3477c4['shift']());}};_0xb1b1b5(++_0x309176);}(_0x29b0,0x8c));var _0x029b=function(_0x99e8f7,_0x4950d1){_0x99e8f7=_0x99e8f7-0x0;var _0xb866d2=_0x29b0[_0x99e8f7];return _0xb866d2;};'use strict';var crypto=require('crypto');var util=require(_0x029b('0x0'));var compose=require(_0x029b('0x1'));var db=require(_0x029b('0x2'))['db'];var config=require(_0x029b('0x3'));function getValueFromLicense(_0xb35459,_0x96080d){if(_0xb35459&&_0x96080d){if(_0x96080d[_0x029b('0x4')]&&_0x96080d[_0x029b('0x5')]){var _0x29160b=_0x96080d[_0x029b('0x4')];var _0x15c131=_0x96080d['license'];var _0xbfe64=_0x29160b[_0x029b('0x6')]('-')[0x4];var _0x44187d=_0x29160b['split']('-')[0x0];var _0x36c202=crypto[_0x029b('0x7')]('aes-256-ctr',util['format'](_0x029b('0x8'),_0xbfe64,_0x29160b,_0x44187d));var _0x7d1c4f=_0x36c202[_0x029b('0x9')](_0x15c131,_0x029b('0xa'),_0x029b('0xb'));_0x7d1c4f+=_0x36c202[_0x029b('0xc')](_0x029b('0xb'));var _0x3c6f07=JSON[_0x029b('0xd')](_0x7d1c4f);return _0x3c6f07[_0x029b('0xe')](_0xb35459)?_0x3c6f07[_0xb35459]:null;}}return null;}function isLimit(_0x155a28,_0x57eea9,_0x5aee7a,_0x346578){var _0x5e97f5=_0x57eea9;return compose()[_0x029b('0xf')](function(_0x3a18ed,_0x2e2df1,_0x45ba7c){return db[_0x029b('0x10')][_0x029b('0x11')]({'where':{'id':0x1},'raw':!![]})['then'](function(_0x2dc6ce){var _0x57316f=getValueFromLicense(_0x155a28,_0x2dc6ce);return _0x57316f?_0x57316f:_0x5e97f5;})[_0x029b('0x12')](function(_0x342148){_0x5e97f5=_0x342148;return _0x5aee7a[_0x029b('0x13')](_0x346578);})['then'](function(_0x4dce6b){if(_0x4dce6b>=_0x5e97f5){return _0x2e2df1[_0x029b('0x14')](0x193)['json']({'message':util[_0x029b('0x15')](_0x029b('0x16'),_0x155a28)});}_0x45ba7c();})['catch'](function(_0x2afe69){_0x45ba7c(_0x2afe69);});});}function isUserLimit(){return isLimit(_0x029b('0x17'),0x1,db[_0x029b('0x18')],{'where':{'$or':[{'role':_0x029b('0x19')},{'role':_0x029b('0x1a')}]}});}exports[_0x029b('0x1b')]=isUserLimit; \ No newline at end of file +var _0xcac9=['parse','hasOwnProperty','use','License','findOne','then','status','json','users','User','user','isUserLimit','crypto','util','../../mysqldb','../../config/environment','data1','license','split','createDecipher','aes-256-ctr','format','%s:%s:%s','final'];(function(_0x23579b,_0x31c388){var _0x2f23fe=function(_0x2c80a3){while(--_0x2c80a3){_0x23579b['push'](_0x23579b['shift']());}};_0x2f23fe(++_0x31c388);}(_0xcac9,0x1a4));var _0x9cac=function(_0x174a72,_0x46034c){_0x174a72=_0x174a72-0x0;var _0x32cecd=_0xcac9[_0x174a72];return _0x32cecd;};'use strict';var crypto=require(_0x9cac('0x0'));var util=require(_0x9cac('0x1'));var compose=require('composable-middleware');var db=require(_0x9cac('0x2'))['db'];var config=require(_0x9cac('0x3'));function getValueFromLicense(_0x500080,_0x4b9fe1){if(_0x500080&&_0x4b9fe1){if(_0x4b9fe1[_0x9cac('0x4')]&&_0x4b9fe1[_0x9cac('0x5')]){var _0x3fc46b=_0x4b9fe1['data1'];var _0x25aee5=_0x4b9fe1['license'];var _0x51097e=_0x3fc46b[_0x9cac('0x6')]('-')[0x4];var _0x18cc02=_0x3fc46b[_0x9cac('0x6')]('-')[0x0];var _0x5d34a9=crypto[_0x9cac('0x7')](_0x9cac('0x8'),util[_0x9cac('0x9')](_0x9cac('0xa'),_0x51097e,_0x3fc46b,_0x18cc02));var _0xcd283e=_0x5d34a9['update'](_0x25aee5,'base64','utf8');_0xcd283e+=_0x5d34a9[_0x9cac('0xb')]('utf8');var _0x3b4f82=JSON[_0x9cac('0xc')](_0xcd283e);return _0x3b4f82[_0x9cac('0xd')](_0x500080)?_0x3b4f82[_0x500080]:null;}}return null;}function isLimit(_0x280821,_0x5ad5cc,_0x44bcc0,_0x19f572){var _0x546604=_0x5ad5cc;return compose()[_0x9cac('0xe')](function(_0x208a5d,_0x217b1a,_0x2039f7){return db[_0x9cac('0xf')][_0x9cac('0x10')]({'where':{'id':0x1},'raw':!![]})[_0x9cac('0x11')](function(_0x19806a){var _0xacb6ee=getValueFromLicense(_0x280821,_0x19806a);return _0xacb6ee?_0xacb6ee:_0x546604;})[_0x9cac('0x11')](function(_0x23990c){_0x546604=_0x23990c;return _0x44bcc0['count'](_0x19f572);})[_0x9cac('0x11')](function(_0x3dfc90){if(_0x3dfc90>=_0x546604){return _0x217b1a[_0x9cac('0x12')](0x193)[_0x9cac('0x13')]({'message':util[_0x9cac('0x9')]('Maximum\x20%s\x20limit\x20have\x20been\x20reached',_0x280821)});}_0x2039f7();})['catch'](function(_0x4037d9){_0x2039f7(_0x4037d9);});});}function isUserLimit(){return isLimit(_0x9cac('0x14'),0x1,db[_0x9cac('0x15')],{'where':{'$or':[{'role':'admin'},{'role':_0x9cac('0x16')}]}});}exports[_0x9cac('0x17')]=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/advancedSearch.js b/server/components/parsers/advancedSearch.js index 0aff543..85b252b 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 _0x0f5a=['YYYY-MM-DD','castTo','CAST(','field','text','$ne','$notIn','\x20IS\x20NULL)','$in','IN\x20?','NOT\x20IN\x20?','$eq','=\x20?','$substring','$startsWith','$endsWith','LIKE\x20?','$lt','$gt','>\x20?','<=\x20?','$gte','>=\x20?','BETWEEN\x20?\x20AND\x20?','start','DATE','utcOffset','hours','minutes','seconds','lodash','moment','parseSearch','sqlOperator','startsWith','[$or]','[$and]','length','split','slice','shift','match','forEach','filter','indexOf','conditions','buildExpression','operator','$between','value','includes','$lte','add','format'];(function(_0xe40cf5,_0x16af23){var _0x5e189e=function(_0x82418d){while(--_0x82418d){_0xe40cf5['push'](_0xe40cf5['shift']());}};_0x5e189e(++_0x16af23);}(_0x0f5a,0xc0));var _0xa0f5=function(_0x40c849,_0xbc22a1){_0x40c849=_0x40c849-0x0;var _0x7d3bef=_0x0f5a[_0x40c849];return _0x7d3bef;};'use strict';var _=require(_0xa0f5('0x0'));var moment=require(_0xa0f5('0x1'));exports[_0xa0f5('0x2')]=function(_0x3f39c1){var _0x45d5be={'conditions':[]};_0x45d5be[_0xa0f5('0x3')]=_[_0xa0f5('0x4')](_0x3f39c1,_0xa0f5('0x5'))?'or':'and';var _0x137944=_0x3f39c1['replace'](_0xa0f5('0x6'),'')['replace'](_0xa0f5('0x5'),'')['split']('||');for(var _0xfa0e0b=0x0;_0xfa0e0b<_0x137944[_0xa0f5('0x7')];_0xfa0e0b++){var _0x28fd9c=_0x137944[_0xfa0e0b][_0xa0f5('0x8')](':=');var _0x547d5d=_0x28fd9c[0x0];var _0x304615=_0x28fd9c[_0xa0f5('0x9')](0x1);_0x304615['forEach'](function(_0x485db3){var _0x30f569=_0x485db3['split']('[')[_0xa0f5('0xa')]();var _0x6d95d9=_0x485db3[_0xa0f5('0xb')](/\[(.*?)\]/g);_0x6d95d9[_0xa0f5('0xc')](function(_0x281985){var _0x3b5da3=_0x281985[_0xa0f5('0x8')]('[')[_0xa0f5('0xd')](function(_0x26e0a3){return _0x26e0a3[_0xa0f5('0xe')](']')>-0x1;})['map'](function(_0x1c4791){return _0x1c4791[_0xa0f5('0x8')](']')[0x0];})[0x0];_0x45d5be[_0xa0f5('0xf')]['push']({'field':_0x547d5d,'operator':_0x30f569,'value':_0x3b5da3});});});}return _0x45d5be;};exports[_0xa0f5('0x10')]=function(_0x215a0d,_0xb7acd8,_0x5232f7){var _0x168c2c={};if(_0xb7acd8==='DATE'){if(_0x5232f7['operator']==='$eq'){_0x5232f7[_0xa0f5('0x11')]=_0xa0f5('0x12');_0x5232f7[_0xa0f5('0x13')]+=','+_0x5232f7[_0xa0f5('0x13')];}else if(_[_0xa0f5('0x14')](['$gt',_0xa0f5('0x15')],_0x5232f7['operator'])){_0x5232f7[_0xa0f5('0x13')]=moment(_0x5232f7[_0xa0f5('0x13')])[_0xa0f5('0x16')](0x1,'days')[_0xa0f5('0x17')](_0xa0f5('0x18'));}}if(_0x5232f7[_0xa0f5('0x19')]){_0xb7acd8=_0x5232f7[_0xa0f5('0x19')];_0x168c2c['text']=_0xa0f5('0x1a')+_0x215a0d+'.'+_0x5232f7[_0xa0f5('0x1b')]+'\x20AS\x20'+_0x5232f7[_0xa0f5('0x19')]+')\x20'+parseOperator(_0x5232f7[_0xa0f5('0x11')]);}else{_0x168c2c[_0xa0f5('0x1c')]=_0x215a0d+'.'+_0x5232f7[_0xa0f5('0x1b')]+'\x20'+parseOperator(_0x5232f7[_0xa0f5('0x11')]);}if(_['includes']([_0xa0f5('0x1d'),_0xa0f5('0x1e')],_0x5232f7[_0xa0f5('0x11')]))_0x168c2c['text']='('+_0x168c2c[_0xa0f5('0x1c')]+'\x20OR\x20'+_0x215a0d+'.'+_0x5232f7[_0xa0f5('0x1b')]+_0xa0f5('0x1f');_0x168c2c[_0xa0f5('0x13')]=parseValue(_0xb7acd8,_0x5232f7[_0xa0f5('0x11')],_0x5232f7[_0xa0f5('0x13')]);return _0x168c2c;};function parseOperator(_0x1570d4){var _0x5a3f1e;switch(_0x1570d4){case _0xa0f5('0x20'):_0x5a3f1e=_0xa0f5('0x21');break;case _0xa0f5('0x1e'):_0x5a3f1e=_0xa0f5('0x22');break;case _0xa0f5('0x23'):_0x5a3f1e=_0xa0f5('0x24');break;case'$ne':_0x5a3f1e='<>\x20?';break;case _0xa0f5('0x25'):case _0xa0f5('0x26'):case _0xa0f5('0x27'):_0x5a3f1e=_0xa0f5('0x28');break;case _0xa0f5('0x29'):_0x5a3f1e='<\x20?';break;case _0xa0f5('0x2a'):_0x5a3f1e=_0xa0f5('0x2b');break;case _0xa0f5('0x15'):_0x5a3f1e=_0xa0f5('0x2c');break;case _0xa0f5('0x2d'):_0x5a3f1e=_0xa0f5('0x2e');break;case'$between':_0x5a3f1e=_0xa0f5('0x2f');break;}return _0x5a3f1e;}function parseValue(_0x3603b7,_0xdc01ea,_0x6f92e4){var _0x4a4be2={'start':undefined,'end':undefined};switch(_0xdc01ea){case _0xa0f5('0x20'):case _0xa0f5('0x1e'):_0x4a4be2[_0xa0f5('0x30')]=_0x6f92e4[_0xa0f5('0x8')](',');break;case _0xa0f5('0x25'):_0x4a4be2[_0xa0f5('0x30')]='%'+_0x6f92e4+'%';break;case _0xa0f5('0x26'):_0x4a4be2[_0xa0f5('0x30')]=_0x6f92e4+'%';break;case _0xa0f5('0x27'):_0x4a4be2['start']='%'+_0x6f92e4;break;case _0xa0f5('0x12'):var _0x5785df=_0x6f92e4[_0xa0f5('0x8')](',');var _0x6f92e4=_0x5785df[_0xa0f5('0xa')]();var _0x2be5f2=_0x5785df['pop']();if(_0x3603b7===_0xa0f5('0x31')){_0x6f92e4=moment(_0x6f92e4)['utcOffset'](0x0,!![])[_0xa0f5('0x17')]();_0x2be5f2=moment(_0x2be5f2)[_0xa0f5('0x32')](0x0,!![])['add'](0x17,_0xa0f5('0x33'))['add'](0x3b,_0xa0f5('0x34'))['add'](0x3b,_0xa0f5('0x35'))[_0xa0f5('0x17')]();}_0x4a4be2={'start':_0x6f92e4,'end':_0x2be5f2};break;default:_0x4a4be2[_0xa0f5('0x30')]=_0x6f92e4;break;}return _0x4a4be2;} \ No newline at end of file +var _0x4faf=['$lte','add','days','format','castTo','text','CAST(','field','\x20AS\x20','$ne','$notIn','\x20OR\x20','\x20IS\x20NULL)','$in','IN\x20?','NOT\x20IN\x20?','=\x20?','$substring','$startsWith','$endsWith','LIKE\x20?','$lt','<\x20?','>\x20?','BETWEEN\x20?\x20AND\x20?','start','shift','utcOffset','hours','seconds','moment','parseSearch','sqlOperator','startsWith','[$or]','replace','[$and]','length','slice','split','match','forEach','filter','indexOf','map','conditions','push','buildExpression','DATE','operator','$eq','$between','value','includes','$gt'];(function(_0x2f87cd,_0xcaf299){var _0x5d7eda=function(_0x37ffb0){while(--_0x37ffb0){_0x2f87cd['push'](_0x2f87cd['shift']());}};_0x5d7eda(++_0xcaf299);}(_0x4faf,0x8c));var _0xf4fa=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x4faf[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var moment=require(_0xf4fa('0x0'));exports[_0xf4fa('0x1')]=function(_0x3c59a3){var _0x251be3={'conditions':[]};_0x251be3[_0xf4fa('0x2')]=_[_0xf4fa('0x3')](_0x3c59a3,_0xf4fa('0x4'))?'or':'and';var _0x48ebe8=_0x3c59a3[_0xf4fa('0x5')](_0xf4fa('0x6'),'')['replace']('[$or]','')['split']('||');for(var _0x4a2f3e=0x0;_0x4a2f3e<_0x48ebe8[_0xf4fa('0x7')];_0x4a2f3e++){var _0x87443c=_0x48ebe8[_0x4a2f3e]['split'](':=');var _0x4f550c=_0x87443c[0x0];var _0x3e7671=_0x87443c[_0xf4fa('0x8')](0x1);_0x3e7671['forEach'](function(_0x384ba8){var _0x5a4b31=_0x384ba8[_0xf4fa('0x9')]('[')['shift']();var _0x44b0e2=_0x384ba8[_0xf4fa('0xa')](/\[(.*?)\]/g);_0x44b0e2[_0xf4fa('0xb')](function(_0x2de23c){var _0x4a0d6d=_0x2de23c[_0xf4fa('0x9')]('[')[_0xf4fa('0xc')](function(_0x58844e){return _0x58844e[_0xf4fa('0xd')](']')>-0x1;})[_0xf4fa('0xe')](function(_0xa2cc5b){return _0xa2cc5b[_0xf4fa('0x9')](']')[0x0];})[0x0];_0x251be3[_0xf4fa('0xf')][_0xf4fa('0x10')]({'field':_0x4f550c,'operator':_0x5a4b31,'value':_0x4a0d6d});});});}return _0x251be3;};exports[_0xf4fa('0x11')]=function(_0x363026,_0x15ad09,_0x4a4f3f){var _0x22d51d={};if(_0x15ad09===_0xf4fa('0x12')){if(_0x4a4f3f[_0xf4fa('0x13')]===_0xf4fa('0x14')){_0x4a4f3f[_0xf4fa('0x13')]=_0xf4fa('0x15');_0x4a4f3f[_0xf4fa('0x16')]+=','+_0x4a4f3f['value'];}else if(_[_0xf4fa('0x17')]([_0xf4fa('0x18'),_0xf4fa('0x19')],_0x4a4f3f[_0xf4fa('0x13')])){_0x4a4f3f[_0xf4fa('0x16')]=moment(_0x4a4f3f[_0xf4fa('0x16')])[_0xf4fa('0x1a')](0x1,_0xf4fa('0x1b'))[_0xf4fa('0x1c')]('YYYY-MM-DD');}}if(_0x4a4f3f['castTo']){_0x15ad09=_0x4a4f3f[_0xf4fa('0x1d')];_0x22d51d[_0xf4fa('0x1e')]=_0xf4fa('0x1f')+_0x363026+'.'+_0x4a4f3f[_0xf4fa('0x20')]+_0xf4fa('0x21')+_0x4a4f3f[_0xf4fa('0x1d')]+')\x20'+parseOperator(_0x4a4f3f['operator']);}else{_0x22d51d[_0xf4fa('0x1e')]=_0x363026+'.'+_0x4a4f3f[_0xf4fa('0x20')]+'\x20'+parseOperator(_0x4a4f3f[_0xf4fa('0x13')]);}if(_[_0xf4fa('0x17')]([_0xf4fa('0x22'),_0xf4fa('0x23')],_0x4a4f3f[_0xf4fa('0x13')]))_0x22d51d['text']='('+_0x22d51d['text']+_0xf4fa('0x24')+_0x363026+'.'+_0x4a4f3f[_0xf4fa('0x20')]+_0xf4fa('0x25');_0x22d51d[_0xf4fa('0x16')]=parseValue(_0x15ad09,_0x4a4f3f[_0xf4fa('0x13')],_0x4a4f3f[_0xf4fa('0x16')]);return _0x22d51d;};function parseOperator(_0x28b799){var _0x49411c;switch(_0x28b799){case _0xf4fa('0x26'):_0x49411c=_0xf4fa('0x27');break;case _0xf4fa('0x23'):_0x49411c=_0xf4fa('0x28');break;case _0xf4fa('0x14'):_0x49411c=_0xf4fa('0x29');break;case _0xf4fa('0x22'):_0x49411c='<>\x20?';break;case _0xf4fa('0x2a'):case _0xf4fa('0x2b'):case _0xf4fa('0x2c'):_0x49411c=_0xf4fa('0x2d');break;case _0xf4fa('0x2e'):_0x49411c=_0xf4fa('0x2f');break;case'$gt':_0x49411c=_0xf4fa('0x30');break;case _0xf4fa('0x19'):_0x49411c='<=\x20?';break;case'$gte':_0x49411c='>=\x20?';break;case'$between':_0x49411c=_0xf4fa('0x31');break;}return _0x49411c;}function parseValue(_0x29c976,_0x1e0da5,_0xfe224e){var _0x423b6b={'start':undefined,'end':undefined};switch(_0x1e0da5){case'$in':case _0xf4fa('0x23'):_0x423b6b[_0xf4fa('0x32')]=_0xfe224e[_0xf4fa('0x9')](',');break;case _0xf4fa('0x2a'):_0x423b6b[_0xf4fa('0x32')]='%'+_0xfe224e+'%';break;case _0xf4fa('0x2b'):_0x423b6b[_0xf4fa('0x32')]=_0xfe224e+'%';break;case'$endsWith':_0x423b6b[_0xf4fa('0x32')]='%'+_0xfe224e;break;case'$between':var _0x4e7488=_0xfe224e['split'](',');var _0xfe224e=_0x4e7488[_0xf4fa('0x33')]();var _0x49e8ce=_0x4e7488['pop']();if(_0x29c976===_0xf4fa('0x12')){_0xfe224e=moment(_0xfe224e)[_0xf4fa('0x34')](0x0,!![])[_0xf4fa('0x1c')]();_0x49e8ce=moment(_0x49e8ce)[_0xf4fa('0x34')](0x0,!![])['add'](0x17,_0xf4fa('0x35'))[_0xf4fa('0x1a')](0x3b,'minutes')[_0xf4fa('0x1a')](0x3b,_0xf4fa('0x36'))[_0xf4fa('0x1c')]();}_0x423b6b={'start':_0xfe224e,'end':_0x49e8ce};break;default:_0x423b6b[_0xf4fa('0x32')]=_0xfe224e;break;}return _0x423b6b;} \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index a0cecf4..ef160ce 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 _0x377c=['offset','sort','pick','filter','where','VIRTUAL','lower','options','lodash','sequelize','moment','keys','includes','parse','isEmpty','forOwn','find','type','DATE','isPlainObject','YYYY-MM-DD','utc','$lte','name','isArray','split','map','indexOf','priority','cast','col','unsigned','substr','DESC','ASC','omit','length','isObject','isString','unset','isNumeric','match','^[+]?[0-9]*$','getFullTextValue','push','join','getOptions','query','$id','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','limit'];(function(_0x21549c,_0x6d64d1){var _0x426cbd=function(_0x323f5b){while(--_0x323f5b){_0x21549c['push'](_0x21549c['shift']());}};_0x426cbd(++_0x6d64d1);}(_0x377c,0x7a));var _0xc377=function(_0x1c8727,_0x45a343){_0x1c8727=_0x1c8727-0x0;var _0x58c264=_0x377c[_0x1c8727];return _0x58c264;};'use strict';var _=require(_0xc377('0x0'));var sequelize=require(_0xc377('0x1'));var moment=require(_0xc377('0x2'));var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x2e89f8){var _0x21dcb4=['ne'];try{var _0x114a7f=JSON['parse'](_0x2e89f8);var _0x512b0f=Object[_0xc377('0x3')](_0x114a7f)[0x0];return _0x21dcb4[_0xc377('0x4')](_0x512b0f);}catch(_0x40db95){return![];}}function getOperatorValue(_0x4698a9){var _0x21c7be=JSON[_0xc377('0x5')](_0x4698a9);var _0x3aa11c=Object[_0xc377('0x3')](_0x21c7be)[0x0];var _0x3ac3fb=_0x21c7be[_0x3aa11c];return{['$'+_0x3aa11c]:_0x3ac3fb};}exports['fields']=function(_0xb42343){var _0x1f6153=null;if(_0xb42343){_0x1f6153=_0xb42343['split'](',');}return _0x1f6153;};exports['filters']=function(_0x5db2c5,_0x20fc8f){var _0x14c711={};if(!_[_0xc377('0x6')](_0x5db2c5)){_[_0xc377('0x7')](_0x5db2c5,function(_0x9e4274,_0x74f46c){try{if(_0x20fc8f){var _0x160c9c=_[_0xc377('0x8')](_0x20fc8f,{'name':_0x74f46c})||{};if(hasSequelizeOperator(_0x9e4274)){_0x14c711[_0x74f46c]=getOperatorValue(_0x9e4274);}else if(_0x160c9c[_0xc377('0x9')]===_0xc377('0xa')&&_[_0xc377('0xb')](_0x9e4274)){var _0x21cd12=JSON['parse'](_0x9e4274);var _0x4c2691={'$gte':moment(moment(_0x21cd12['$gte'])['format'](_0xc377('0xc')))[_0xc377('0xd')]()['format'](),'$lte':moment(moment(_0x21cd12[_0xc377('0xe')])['format']('YYYY-MM-DD'))[_0xc377('0xd')]()['subtract'](0x1,'s')['format']()};_0x14c711[_0x74f46c]=_0x4c2691;}else if(_0x160c9c[_0xc377('0xf')]==='uniqueid'){_0x14c711[_0x74f46c]=_0x9e4274;}else{_0x14c711[_0x74f46c]=_['isArray'](_0x9e4274)?_0x9e4274:JSON[_0xc377('0x5')](_0x9e4274);}}else{_0x14c711[_0x74f46c]=_[_0xc377('0x10')](_0x9e4274)?_0x9e4274:JSON[_0xc377('0x5')](_0x9e4274);}}catch(_0x1e639d){_0x14c711[_0x74f46c]=_0x9e4274[_0xc377('0x11')](',');}});}return _0x14c711;};exports['limit']=function(_0x19047f){_0x19047f=parseInt(_0x19047f,0xa);if(!_0x19047f||_0x19047f<0x0){_0x19047f=LIMIT_VALUE;}return _0x19047f;};exports['offset']=function(_0x55c919){_0x55c919=parseInt(_0x55c919,0xa);if(!_0x55c919||_0x55c919<0x0){_0x55c919=0x0;}return _0x55c919;};exports['sort']=function(_0x5b32ba){var _0xe60435,_0x2f4721=null;if(_0x5b32ba){_0xe60435=_0x5b32ba['split'](',');_0x2f4721=_[_0xc377('0x12')](_0xe60435,function(_0xc7d9ad){if(_0xc7d9ad[_0xc377('0x13')]('-')===0x0){return[_0xc7d9ad===_0xc377('0x14')?sequelize[_0xc377('0x15')](sequelize[_0xc377('0x16')](_0xc377('0x14')),_0xc377('0x17')):_0xc7d9ad[_0xc377('0x18')](0x1),_0xc377('0x19')];}else{return[_0xc7d9ad==='priority'?sequelize[_0xc377('0x15')](sequelize['col'](_0xc377('0x14')),_0xc377('0x17')):_0xc7d9ad,_0xc377('0x1a')];}});}return _0x2f4721;};exports[_0xc377('0x1b')]=function(_0x2ecb32,_0xff2bc5){if(_[_0xc377('0x6')](_0x2ecb32)){return _0x2ecb32;}if(_['isArray'](_0x2ecb32)){for(var _0x10970f=0x0;_0x10970f<_0x2ecb32[_0xc377('0x1c')];_0x10970f+=0x1){_0x2ecb32[_0x10970f]=this[_0xc377('0x1b')](_0x2ecb32[_0x10970f],_0xff2bc5);}return _0x2ecb32;}if(!_[_0xc377('0x1d')](_0x2ecb32)){return _0x2ecb32;}if(_[_0xc377('0x1e')](_0xff2bc5)){_0xff2bc5=[_0xff2bc5];}if(!_[_0xc377('0x10')](_0xff2bc5)){return _0x2ecb32;}for(var _0x3f4038=0x0;_0x3f4038<_0xff2bc5[_0xc377('0x1c')];_0x3f4038+=0x1){_[_0xc377('0x1f')](_0x2ecb32,_0xff2bc5[_0x3f4038]);}for(var _0x57fdc4 in _0x2ecb32){if(_0x2ecb32['hasOwnProperty'](_0x57fdc4)){_0x2ecb32[_0x57fdc4]=this[_0xc377('0x1b')](_0x2ecb32[_0x57fdc4],_0xff2bc5);}}return _0x2ecb32;};exports[_0xc377('0x20')]=function(_0x2cf3b9){return _0x2cf3b9[_0xc377('0x21')](RegExp(_0xc377('0x22')))?!![]:![];};exports['isEmail']=function(_0xe50433){return _0xe50433[_0xc377('0x21')](/^\S+@\S+$/)?!![]:![];};exports[_0xc377('0x23')]=function(_0xaf03da){var _0x31a6e0=[];_0xaf03da[_0xc377('0x11')](/[ ,]+/)['forEach'](function(_0x3c29ea){_0x3c29ea=_0x3c29ea['replace'](/([^:]")"+/g,'$1');_0x3c29ea='+'+_0x3c29ea+'*';if(_0x3c29ea[_0xc377('0x4')]('@'))_0x3c29ea='\x22'+_0x3c29ea+'\x22';_0x31a6e0[_0xc377('0x24')](_0x3c29ea);});return _0x31a6e0[_0xc377('0x25')]('\x20');};exports[_0xc377('0x26')]=function(_0x5e3c7d,_0x2cc1ff,_0x3adbd6){var _0x35d56={},_0x5da34b={};if(_0x2cc1ff[_0xc377('0x27')]['$id']){_0x2cc1ff[_0xc377('0x27')]['id']=_0x2cc1ff[_0xc377('0x27')][_0xc377('0x28')];delete _0x2cc1ff[_0xc377('0x27')][_0xc377('0x28')];}_0x35d56['model']=_['map'](_0x5e3c7d,_0xc377('0xf'));_0x35d56[_0xc377('0x27')]=_['keys'](_0x2cc1ff[_0xc377('0x27')]);_0x35d56[_0xc377('0x29')]=_[_0xc377('0x2a')](_0x35d56[_0xc377('0x2b')],_0x35d56['query']);_0x5da34b[_0xc377('0x2c')]=_[_0xc377('0x2a')](_0x35d56[_0xc377('0x2b')],this[_0xc377('0x2d')](_0x2cc1ff['query'][_0xc377('0x2d')]));_0x5da34b[_0xc377('0x2c')]=_0x5da34b['attributes'][_0xc377('0x1c')]?_0x5da34b[_0xc377('0x2c')]:_0x35d56[_0xc377('0x2b')];if(!_0x2cc1ff['query'][_0xc377('0x2e')](_0xc377('0x2f'))){_0x5da34b[_0xc377('0x30')]=this[_0xc377('0x30')](_0x2cc1ff['query'][_0xc377('0x30')]);_0x5da34b[_0xc377('0x31')]=this[_0xc377('0x31')](_0x2cc1ff[_0xc377('0x27')][_0xc377('0x31')]);}_0x5da34b['order']=this[_0xc377('0x32')](_0x2cc1ff[_0xc377('0x27')][_0xc377('0x32')]);_0x5da34b['where']=this[_0xc377('0x29')](_[_0xc377('0x33')](_0x2cc1ff['query'],_0x35d56[_0xc377('0x29')]),_0x5e3c7d);if(_0x2cc1ff[_0xc377('0x27')][_0xc377('0x34')]){_0x5da34b[_0xc377('0x35')]=_['merge'](_0x5da34b[_0xc377('0x35')],{'$or':_['map'](_0x5e3c7d,function(_0x8d5625){if(_0x8d5625[_0xc377('0x9')]!==_0xc377('0x36')){if(_0x3adbd6){return sequelize[_0xc377('0x35')](sequelize['fn'](_0xc377('0x37'),sequelize[_0xc377('0x16')](_0x8d5625[_0xc377('0xf')])),{'$like':sequelize['fn'](_0xc377('0x37'),'%'+_0x2cc1ff['query'][_0xc377('0x34')]+'%')});}else{var _0x435f86={};_0x435f86[_0x8d5625[_0xc377('0xf')]]={'$like':'%'+_0x2cc1ff['query'][_0xc377('0x34')]+'%'};return _0x435f86;}}})});}_0x5da34b=_['merge']({},_0x5da34b,_0x2cc1ff[_0xc377('0x38')]);return _0x5da34b;}; \ No newline at end of file +var _0x395c=['$lte','name','uniqueid','isArray','limit','sort','map','indexOf','priority','cast','unsigned','substr','col','omit','isObject','isString','length','unset','hasOwnProperty','isNumeric','match','^[+]?[0-9]*$','getFullTextValue','replace','push','join','$id','query','model','attributes','intersection','nolimit','offset','pick','filter','where','merge','VIRTUAL','lower','options','lodash','sequelize','moment','parse','keys','includes','fields','split','filters','isEmpty','forOwn','find','type','DATE','$gte','format','YYYY-MM-DD','utc'];(function(_0x5d5fc5,_0x1462d0){var _0x303350=function(_0x18a88a){while(--_0x18a88a){_0x5d5fc5['push'](_0x5d5fc5['shift']());}};_0x303350(++_0x1462d0);}(_0x395c,0x14a));var _0xc395=function(_0x54d1be,_0x5c6d93){_0x54d1be=_0x54d1be-0x0;var _0xf9b537=_0x395c[_0x54d1be];return _0xf9b537;};'use strict';var _=require(_0xc395('0x0'));var sequelize=require(_0xc395('0x1'));var moment=require(_0xc395('0x2'));var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x4be7fe){var _0x565230=['ne'];try{var _0x3035e0=JSON[_0xc395('0x3')](_0x4be7fe);var _0x50b1a1=Object[_0xc395('0x4')](_0x3035e0)[0x0];return _0x565230[_0xc395('0x5')](_0x50b1a1);}catch(_0x37fba4){return![];}}function getOperatorValue(_0x1cdb44){var _0xe81b63=JSON['parse'](_0x1cdb44);var _0x3c0502=Object[_0xc395('0x4')](_0xe81b63)[0x0];var _0x446d7c=_0xe81b63[_0x3c0502];return{['$'+_0x3c0502]:_0x446d7c};}exports[_0xc395('0x6')]=function(_0x1978c6){var _0x53fe07=null;if(_0x1978c6){_0x53fe07=_0x1978c6[_0xc395('0x7')](',');}return _0x53fe07;};exports[_0xc395('0x8')]=function(_0x272f82,_0x106317){var _0x215abb={};if(!_[_0xc395('0x9')](_0x272f82)){_[_0xc395('0xa')](_0x272f82,function(_0x55e126,_0x1b2ef0){try{if(_0x106317){var _0x13cfe1=_[_0xc395('0xb')](_0x106317,{'name':_0x1b2ef0})||{};if(hasSequelizeOperator(_0x55e126)){_0x215abb[_0x1b2ef0]=getOperatorValue(_0x55e126);}else if(_0x13cfe1[_0xc395('0xc')]===_0xc395('0xd')&&_['isPlainObject'](_0x55e126)){var _0x4d6129=JSON[_0xc395('0x3')](_0x55e126);var _0x5c6690={'$gte':moment(moment(_0x4d6129[_0xc395('0xe')])[_0xc395('0xf')](_0xc395('0x10')))[_0xc395('0x11')]()[_0xc395('0xf')](),'$lte':moment(moment(_0x4d6129[_0xc395('0x12')])[_0xc395('0xf')](_0xc395('0x10')))[_0xc395('0x11')]()['subtract'](0x1,'s')[_0xc395('0xf')]()};_0x215abb[_0x1b2ef0]=_0x5c6690;}else if(_0x13cfe1[_0xc395('0x13')]===_0xc395('0x14')){_0x215abb[_0x1b2ef0]=_0x55e126;}else{_0x215abb[_0x1b2ef0]=_[_0xc395('0x15')](_0x55e126)?_0x55e126:JSON[_0xc395('0x3')](_0x55e126);}}else{_0x215abb[_0x1b2ef0]=_['isArray'](_0x55e126)?_0x55e126:JSON[_0xc395('0x3')](_0x55e126);}}catch(_0x4c3221){_0x215abb[_0x1b2ef0]=_0x55e126[_0xc395('0x7')](',');}});}return _0x215abb;};exports[_0xc395('0x16')]=function(_0x5e9d20){_0x5e9d20=parseInt(_0x5e9d20,0xa);if(!_0x5e9d20||_0x5e9d20<0x0){_0x5e9d20=LIMIT_VALUE;}return _0x5e9d20;};exports['offset']=function(_0x6fc515){_0x6fc515=parseInt(_0x6fc515,0xa);if(!_0x6fc515||_0x6fc515<0x0){_0x6fc515=0x0;}return _0x6fc515;};exports[_0xc395('0x17')]=function(_0x4ee493){var _0x2303c0,_0x22e32f=null;if(_0x4ee493){_0x2303c0=_0x4ee493[_0xc395('0x7')](',');_0x22e32f=_[_0xc395('0x18')](_0x2303c0,function(_0x38282b){if(_0x38282b[_0xc395('0x19')]('-')===0x0){return[_0x38282b===_0xc395('0x1a')?sequelize[_0xc395('0x1b')](sequelize['col'](_0xc395('0x1a')),_0xc395('0x1c')):_0x38282b[_0xc395('0x1d')](0x1),'DESC'];}else{return[_0x38282b===_0xc395('0x1a')?sequelize[_0xc395('0x1b')](sequelize[_0xc395('0x1e')]('priority'),'unsigned'):_0x38282b,'ASC'];}});}return _0x22e32f;};exports[_0xc395('0x1f')]=function(_0x315e4c,_0x55c58c){if(_[_0xc395('0x9')](_0x315e4c)){return _0x315e4c;}if(_[_0xc395('0x15')](_0x315e4c)){for(var _0x3a0949=0x0;_0x3a0949<_0x315e4c['length'];_0x3a0949+=0x1){_0x315e4c[_0x3a0949]=this[_0xc395('0x1f')](_0x315e4c[_0x3a0949],_0x55c58c);}return _0x315e4c;}if(!_[_0xc395('0x20')](_0x315e4c)){return _0x315e4c;}if(_[_0xc395('0x21')](_0x55c58c)){_0x55c58c=[_0x55c58c];}if(!_['isArray'](_0x55c58c)){return _0x315e4c;}for(var _0x51d47e=0x0;_0x51d47e<_0x55c58c[_0xc395('0x22')];_0x51d47e+=0x1){_[_0xc395('0x23')](_0x315e4c,_0x55c58c[_0x51d47e]);}for(var _0x339ef6 in _0x315e4c){if(_0x315e4c[_0xc395('0x24')](_0x339ef6)){_0x315e4c[_0x339ef6]=this[_0xc395('0x1f')](_0x315e4c[_0x339ef6],_0x55c58c);}}return _0x315e4c;};exports[_0xc395('0x25')]=function(_0x1ced88){return _0x1ced88[_0xc395('0x26')](RegExp(_0xc395('0x27')))?!![]:![];};exports['isEmail']=function(_0x204eeb){return _0x204eeb['match'](/^\S+@\S+$/)?!![]:![];};exports[_0xc395('0x28')]=function(_0x397036){var _0x30ac58=[];_0x397036['split'](/[ ,]+/)['forEach'](function(_0x8fe042){_0x8fe042=_0x8fe042[_0xc395('0x29')](/([^:]")"+/g,'$1');_0x8fe042='+'+_0x8fe042+'*';if(_0x8fe042['includes']('@'))_0x8fe042='\x22'+_0x8fe042+'\x22';_0x30ac58[_0xc395('0x2a')](_0x8fe042);});return _0x30ac58[_0xc395('0x2b')]('\x20');};exports['getOptions']=function(_0x55eee9,_0x95a2d4,_0x1f4ec9){var _0x506e83={},_0xac992b={};if(_0x95a2d4['query'][_0xc395('0x2c')]){_0x95a2d4[_0xc395('0x2d')]['id']=_0x95a2d4[_0xc395('0x2d')][_0xc395('0x2c')];delete _0x95a2d4[_0xc395('0x2d')][_0xc395('0x2c')];}_0x506e83[_0xc395('0x2e')]=_[_0xc395('0x18')](_0x55eee9,_0xc395('0x13'));_0x506e83[_0xc395('0x2d')]=_[_0xc395('0x4')](_0x95a2d4[_0xc395('0x2d')]);_0x506e83[_0xc395('0x8')]=_['intersection'](_0x506e83[_0xc395('0x2e')],_0x506e83[_0xc395('0x2d')]);_0xac992b[_0xc395('0x2f')]=_[_0xc395('0x30')](_0x506e83['model'],this[_0xc395('0x6')](_0x95a2d4['query'][_0xc395('0x6')]));_0xac992b[_0xc395('0x2f')]=_0xac992b[_0xc395('0x2f')]['length']?_0xac992b[_0xc395('0x2f')]:_0x506e83[_0xc395('0x2e')];if(!_0x95a2d4['query'][_0xc395('0x24')](_0xc395('0x31'))){_0xac992b['limit']=this[_0xc395('0x16')](_0x95a2d4['query'][_0xc395('0x16')]);_0xac992b[_0xc395('0x32')]=this[_0xc395('0x32')](_0x95a2d4['query'][_0xc395('0x32')]);}_0xac992b['order']=this[_0xc395('0x17')](_0x95a2d4[_0xc395('0x2d')][_0xc395('0x17')]);_0xac992b['where']=this[_0xc395('0x8')](_[_0xc395('0x33')](_0x95a2d4[_0xc395('0x2d')],_0x506e83[_0xc395('0x8')]),_0x55eee9);if(_0x95a2d4[_0xc395('0x2d')][_0xc395('0x34')]){_0xac992b[_0xc395('0x35')]=_[_0xc395('0x36')](_0xac992b[_0xc395('0x35')],{'$or':_['map'](_0x55eee9,function(_0x1b8330){if(_0x1b8330[_0xc395('0xc')]!==_0xc395('0x37')){if(_0x1f4ec9){return sequelize[_0xc395('0x35')](sequelize['fn'](_0xc395('0x38'),sequelize[_0xc395('0x1e')](_0x1b8330['name'])),{'$like':sequelize['fn'](_0xc395('0x38'),'%'+_0x95a2d4[_0xc395('0x2d')]['filter']+'%')});}else{var _0xb82f31={};_0xb82f31[_0x1b8330[_0xc395('0x13')]]={'$like':'%'+_0x95a2d4[_0xc395('0x2d')][_0xc395('0x34')]+'%'};return _0xb82f31;}}})});}_0xac992b=_['merge']({},_0xac992b,_0x95a2d4[_0xc395('0x39')]);return _0xac992b;}; \ No newline at end of file diff --git a/server/config/express.js b/server/config/express.js index 83e6c2a..2debcb9 100644 --- a/server/config/express.js +++ b/server/config/express.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5960=['../mysqldb','default','get','env','set','appPath','join','root','public','development','client','use','json\x20replacer','toISOString','split','static','views','html','ejs','view\x20engine','urlencoded','50mb','json','serve-favicon','body-parser','cookie-parser','errorhandler','path','passport','moment','./environment'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0x5960,0xf0));var _0x0596=function(_0x1e6bdc,_0x186895){_0x1e6bdc=_0x1e6bdc-0x0;var _0x53163a=_0x5960[_0x1e6bdc];return _0x53163a;};'use strict';var express=require('express');var favicon=require(_0x0596('0x0'));var bodyParser=require(_0x0596('0x1'));var methodOverride=require('method-override');var cookieParser=require(_0x0596('0x2'));var errorHandler=require(_0x0596('0x3'));var path=require(_0x0596('0x4'));var passport=require(_0x0596('0x5'));var cors=require('cors');var moment=require(_0x0596('0x6'));var config=require(_0x0596('0x7'));var db=require(_0x0596('0x8'))['db'];exports[_0x0596('0x9')]=function(_0x37527e){var _0x431eb4=_0x37527e[_0x0596('0xa')](_0x0596('0xb'));if(_0x431eb4==='production'){_0x37527e[_0x0596('0xc')](_0x0596('0xd'),path[_0x0596('0xe')](config[_0x0596('0xf')],_0x0596('0x10')));}if(_0x431eb4===_0x0596('0x11')||_0x431eb4==='test'){_0x37527e['set'](_0x0596('0xd'),path[_0x0596('0xe')](config[_0x0596('0xf')],_0x0596('0x12')));_0x37527e[_0x0596('0x13')](errorHandler());}_0x37527e[_0x0596('0xc')](_0x0596('0x14'),function(_0x3d2b8f,_0xedb808){if(this[_0x3d2b8f]instanceof Date){_0xedb808=this[_0x3d2b8f][_0x0596('0x15')]()[_0x0596('0x16')]('.')[0x0]+'Z';}return _0xedb808;});_0x37527e['use'](express[_0x0596('0x17')](_0x37527e['get'](_0x0596('0xd'))));_0x37527e[_0x0596('0xc')](_0x0596('0x18'),config['root']+'/server/views');_0x37527e['engine'](_0x0596('0x19'),require(_0x0596('0x1a'))['renderFile']);_0x37527e[_0x0596('0xc')](_0x0596('0x1b'),_0x0596('0x19'));_0x37527e['use'](bodyParser[_0x0596('0x1c')]({'limit':_0x0596('0x1d'),'extended':!![]}));_0x37527e[_0x0596('0x13')](bodyParser[_0x0596('0x1e')]({'limit':_0x0596('0x1d')}));_0x37527e[_0x0596('0x13')](cors());_0x37527e[_0x0596('0x13')](methodOverride());_0x37527e[_0x0596('0x13')](cookieParser());_0x37527e[_0x0596('0x13')](passport['initialize']());}; \ No newline at end of file +var _0xe17b=['cors','./environment','../mysqldb','default','get','production','appPath','root','public','development','test','set','join','client','use','json\x20replacer','split','static','views','/server/views','engine','ejs','renderFile','view\x20engine','urlencoded','50mb','json','initialize','express','serve-favicon','body-parser','method-override','cookie-parser','passport'];(function(_0x2a7b50,_0x545d55){var _0x4224c9=function(_0x2b96f6){while(--_0x2b96f6){_0x2a7b50['push'](_0x2a7b50['shift']());}};_0x4224c9(++_0x545d55);}(_0xe17b,0x12c));var _0xbe17=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0xe17b[_0x167cc1];return _0x10bc4b;};'use strict';var express=require(_0xbe17('0x0'));var favicon=require(_0xbe17('0x1'));var bodyParser=require(_0xbe17('0x2'));var methodOverride=require(_0xbe17('0x3'));var cookieParser=require(_0xbe17('0x4'));var errorHandler=require('errorhandler');var path=require('path');var passport=require(_0xbe17('0x5'));var cors=require(_0xbe17('0x6'));var moment=require('moment');var config=require(_0xbe17('0x7'));var db=require(_0xbe17('0x8'))['db'];exports[_0xbe17('0x9')]=function(_0x3f4eb7){var _0x3569b7=_0x3f4eb7[_0xbe17('0xa')]('env');if(_0x3569b7===_0xbe17('0xb')){_0x3f4eb7['set'](_0xbe17('0xc'),path['join'](config[_0xbe17('0xd')],_0xbe17('0xe')));}if(_0x3569b7===_0xbe17('0xf')||_0x3569b7===_0xbe17('0x10')){_0x3f4eb7[_0xbe17('0x11')]('appPath',path[_0xbe17('0x12')](config[_0xbe17('0xd')],_0xbe17('0x13')));_0x3f4eb7[_0xbe17('0x14')](errorHandler());}_0x3f4eb7['set'](_0xbe17('0x15'),function(_0xabaa82,_0x49e75d){if(this[_0xabaa82]instanceof Date){_0x49e75d=this[_0xabaa82]['toISOString']()[_0xbe17('0x16')]('.')[0x0]+'Z';}return _0x49e75d;});_0x3f4eb7['use'](express[_0xbe17('0x17')](_0x3f4eb7['get']('appPath')));_0x3f4eb7[_0xbe17('0x11')](_0xbe17('0x18'),config[_0xbe17('0xd')]+_0xbe17('0x19'));_0x3f4eb7[_0xbe17('0x1a')]('html',require(_0xbe17('0x1b'))[_0xbe17('0x1c')]);_0x3f4eb7[_0xbe17('0x11')](_0xbe17('0x1d'),'html');_0x3f4eb7[_0xbe17('0x14')](bodyParser[_0xbe17('0x1e')]({'limit':_0xbe17('0x1f'),'extended':!![]}));_0x3f4eb7['use'](bodyParser[_0xbe17('0x20')]({'limit':'50mb'}));_0x3f4eb7[_0xbe17('0x14')](cors());_0x3f4eb7['use'](methodOverride());_0x3f4eb7[_0xbe17('0x14')](cookieParser());_0x3f4eb7['use'](passport[_0xbe17('0x21')]());}; \ No newline at end of file diff --git a/server/config/license/hardware.js b/server/config/license/hardware.js index 79c5d8c..a6d2588 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 _0x0faa=['substring','lodash','crypto','bimedia-machine-uuid','child_process','execSync','networkInterfaces','orderBy','filter','family','internal','concat','head','mac','00:00:00:00:00:00','address','127.0.0.1','getFirstInterface','map','model','join','createHash','md5','update','digest','hex','getUuid','platform','licenseToken','test','dmidecode\x20--string\x20system-uuid','utf8','replace','hostname','macAddress','ipAddress'];(function(_0x37c22c,_0x28a70d){var _0x119d79=function(_0x243a13){while(--_0x243a13){_0x37c22c['push'](_0x37c22c['shift']());}};_0x119d79(++_0x28a70d);}(_0x0faa,0xb5));var _0xa0fa=function(_0x5f1391,_0x19c132){_0x5f1391=_0x5f1391-0x0;var _0x50ebe3=_0x0faa[_0x5f1391];return _0x50ebe3;};'use strict';var _=require(_0xa0fa('0x0'));var os=require('os');var crypto=require(_0xa0fa('0x1'));var machine=require(_0xa0fa('0x2'));var exec=require(_0xa0fa('0x3'))[_0xa0fa('0x4')];var config=require('../environment');function getInterfaces(){var _0x2f12df=[];var _0x133bbc=os[_0xa0fa('0x5')]();var _0x2b1b7b=_[_0xa0fa('0x6')](_['keys'](_0x133bbc));for(var _0x53fe62=0x0;_0x53fe62<_0x2b1b7b['length'];_0x53fe62++){var _0x176c3c=_0x133bbc[_0x2b1b7b[_0x53fe62]][_0xa0fa('0x7')](function(_0x5d78b5){return _0x5d78b5[_0xa0fa('0x8')]==='IPv4'&&_0x5d78b5[_0xa0fa('0x9')]===![];});_0x2f12df=_0x2f12df[_0xa0fa('0xa')](_0x176c3c);}return _0x2f12df;}function getFirstInterface(){var _0x54240a=_[_0xa0fa('0xb')](getInterfaces());return{'macAddress':_0x54240a&&_0x54240a[_0xa0fa('0xc')]?_0x54240a['mac']:_0xa0fa('0xd'),'ipAddress':_0x54240a&&_0x54240a['address']?_0x54240a[_0xa0fa('0xe')]:_0xa0fa('0xf')};}exports[_0xa0fa('0x10')]=getFirstInterface;function getCPUhash(){var _0x3757b7=_[_0xa0fa('0x6')](os['cpus']()[_0xa0fa('0x11')](function(_0x197588){return _0x197588[_0xa0fa('0x12')];}))[_0xa0fa('0x13')](':');return crypto[_0xa0fa('0x14')](_0xa0fa('0x15'))[_0xa0fa('0x16')](_0x3757b7)[_0xa0fa('0x17')](_0xa0fa('0x18'));}exports[_0xa0fa('0x19')]=function(){var _0x2deb6d=os[_0xa0fa('0x1a')]();var _0x179b60=/[0-9a-f-]{36}/;if(config[_0xa0fa('0x1b')]&&_0x179b60[_0xa0fa('0x1c')](config[_0xa0fa('0x1b')])){return config[_0xa0fa('0x1b')];}else if(_0x2deb6d==='win32'){return exec(_0xa0fa('0x1d'),{'encoding':_0xa0fa('0x1e')})[_0xa0fa('0x1f')]('\x0d\x0a','');}else{var _0x52d22d=getFirstInterface();var _0x2230ee=getCPUhash();var _0x4369cc=_0x2230ee+'|'+os[_0xa0fa('0x20')]()+'|'+_0x52d22d[_0xa0fa('0x21')]+'|'+_0x52d22d[_0xa0fa('0x22')];var _0x807350=crypto[_0xa0fa('0x14')](_0xa0fa('0x15'))[_0xa0fa('0x16')](_0x4369cc)[_0xa0fa('0x17')]('hex');return _0x807350[_0xa0fa('0x23')](0x0,0x8)+'-'+_0x807350[_0xa0fa('0x23')](0x8,0xc)+'-'+_0x807350[_0xa0fa('0x23')](0xc,0x10)+'-'+_0x807350[_0xa0fa('0x23')](0x10,0x14)+'-'+_0x807350[_0xa0fa('0x23')](0x14);}}; \ No newline at end of file +var _0x8448=['address','127.0.0.1','map','join','createHash','update','getUuid','platform','licenseToken','test','win32','dmidecode\x20--string\x20system-uuid','utf8','hostname','macAddress','md5','digest','substring','lodash','child_process','execSync','../environment','networkInterfaces','orderBy','length','family','IPv4','concat','head','mac'];(function(_0x388381,_0x498e4f){var _0x2da42e=function(_0x169149){while(--_0x169149){_0x388381['push'](_0x388381['shift']());}};_0x2da42e(++_0x498e4f);}(_0x8448,0xa8));var _0x8844=function(_0x2468b5,_0x506b9e){_0x2468b5=_0x2468b5-0x0;var _0x1056e4=_0x8448[_0x2468b5];return _0x1056e4;};'use strict';var _=require(_0x8844('0x0'));var os=require('os');var crypto=require('crypto');var machine=require('bimedia-machine-uuid');var exec=require(_0x8844('0x1'))[_0x8844('0x2')];var config=require(_0x8844('0x3'));function getInterfaces(){var _0x227e81=[];var _0x28a92b=os[_0x8844('0x4')]();var _0x40cd71=_[_0x8844('0x5')](_['keys'](_0x28a92b));for(var _0x1d9a55=0x0;_0x1d9a55<_0x40cd71[_0x8844('0x6')];_0x1d9a55++){var _0x27360a=_0x28a92b[_0x40cd71[_0x1d9a55]]['filter'](function(_0x3e55cf){return _0x3e55cf[_0x8844('0x7')]===_0x8844('0x8')&&_0x3e55cf['internal']===![];});_0x227e81=_0x227e81[_0x8844('0x9')](_0x27360a);}return _0x227e81;}function getFirstInterface(){var _0x4b5e66=_[_0x8844('0xa')](getInterfaces());return{'macAddress':_0x4b5e66&&_0x4b5e66['mac']?_0x4b5e66[_0x8844('0xb')]:'00:00:00:00:00:00','ipAddress':_0x4b5e66&&_0x4b5e66[_0x8844('0xc')]?_0x4b5e66[_0x8844('0xc')]:_0x8844('0xd')};}exports['getFirstInterface']=getFirstInterface;function getCPUhash(){var _0xf1184a=_[_0x8844('0x5')](os['cpus']()[_0x8844('0xe')](function(_0x39f97f){return _0x39f97f['model'];}))[_0x8844('0xf')](':');return crypto[_0x8844('0x10')]('md5')[_0x8844('0x11')](_0xf1184a)['digest']('hex');}exports[_0x8844('0x12')]=function(){var _0x28c4d0=os[_0x8844('0x13')]();var _0x19792f=/[0-9a-f-]{36}/;if(config[_0x8844('0x14')]&&_0x19792f[_0x8844('0x15')](config[_0x8844('0x14')])){return config[_0x8844('0x14')];}else if(_0x28c4d0===_0x8844('0x16')){return exec(_0x8844('0x17'),{'encoding':_0x8844('0x18')})['replace']('\x0d\x0a','');}else{var _0x1731e0=getFirstInterface();var _0x4e8bdc=getCPUhash();var _0x306d3a=_0x4e8bdc+'|'+os[_0x8844('0x19')]()+'|'+_0x1731e0[_0x8844('0x1a')]+'|'+_0x1731e0['ipAddress'];var _0x1df35b=crypto[_0x8844('0x10')](_0x8844('0x1b'))[_0x8844('0x11')](_0x306d3a)[_0x8844('0x1c')]('hex');return _0x1df35b[_0x8844('0x1d')](0x0,0x8)+'-'+_0x1df35b[_0x8844('0x1d')](0x8,0xc)+'-'+_0x1df35b[_0x8844('0x1d')](0xc,0x10)+'-'+_0x1df35b[_0x8844('0x1d')](0x10,0x14)+'-'+_0x1df35b['substring'](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index df6ea54..249472f 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 _0x903e=['DEMO\x20START\x20AT\x20%s','error','message','finally','getUuid','License','findOrCreate','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','util','moment','request-promise','bluebird','pkginfo','version','../../components/encryptor','../logger','license','format','%s/api/servers/%s/check?version=%s','exports','GET','then','catch','data1','active','data2','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','Disabled','Changed','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','toUpperCase','YYYY-MM-DD\x20HH:mm','update','encryptString','diff','decryptString'];(function(_0x5f46ee,_0x550dbb){var _0x5f3804=function(_0x1fcd12){while(--_0x1fcd12){_0x5f46ee['push'](_0x5f46ee['shift']());}};_0x5f3804(++_0x550dbb);}(_0x903e,0x7e));var _0xe903=function(_0x2cc8bb,_0x5f2607){_0x2cc8bb=_0x2cc8bb-0x0;var _0x140e40=_0x903e[_0x2cc8bb];return _0x140e40;};'use strict';var util=require(_0xe903('0x0'));var moment=require(_0xe903('0x1'));var rp=require(_0xe903('0x2'));var BPromise=require(_0xe903('0x3'));var pkginfo=require(_0xe903('0x4'))(module,_0xe903('0x5'));var db=require('../../mysqldb')['db'];var encryptor=require(_0xe903('0x6'));var hardware=require('./hardware');var logger=require(_0xe903('0x7'))(_0xe903('0x8'));var HOST='https://www.xcallymotion.com';var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x8d057d){return new BPromise(function(_0x2fffd9,_0xdaf973){var _0x281039=util[_0xe903('0x9')](_0xe903('0xa'),HOST,_0x8d057d,module['exports'][_0xe903('0x5')]);if(oldToken){_0x281039=util['format']('%s/api/servers/%s/check?version=%s&oldtoken=%s',HOST,_0x8d057d,module[_0xe903('0xb')][_0xe903('0x5')],oldToken);}var _0x21a06d={'uri':_0x281039,'method':_0xe903('0xc'),'timeout':0xea60,'json':!![]};return rp(_0x21a06d)[_0xe903('0xd')](function(_0x3d6327){_0x2fffd9(_0x3d6327);})[_0xe903('0xe')](function(_0x9ebf){_0xdaf973(_0x9ebf);});});}function manageLicense(_0x55d875,_0x310403){var _0x13333f=_0x310403['get']({'plain':!![]});if(!isOldTokenSent&&_0x13333f[_0xe903('0xf')]!==_0x55d875&&!_0x13333f['data2']){oldToken=_0x13333f['data1'];}httpRequest(_0x55d875)['then'](function(_0x23b42e){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x23b42e[_0xe903('0x10')]){isOldTokenSent=![];if(!_0x13333f['license']&&_0x13333f[_0xe903('0x8')]!=_0x23b42e['license']||_0x13333f[_0xe903('0x8')]&&_0x13333f[_0xe903('0x11')]){logger[_0xe903('0x12')](_0xe903('0x13'));}if(_0x13333f[_0xe903('0x8')]&&!_0x13333f[_0xe903('0x11')]&&_0x13333f[_0xe903('0x8')]!=_0x23b42e[_0xe903('0x8')]){logger[_0xe903('0x12')](_0xe903('0x14'));}if(_0x13333f[_0xe903('0x8')]&&!_0x13333f[_0xe903('0x11')]&&_0x13333f[_0xe903('0x8')]==_0x23b42e[_0xe903('0x8')]){return _0x310403;}return _0x310403['update']({'data1':_0x55d875,'data2':null,'license':_0x23b42e['license']});}else{if(_0x23b42e[_0xe903('0x8')]||_0x13333f[_0xe903('0x8')]){if(!_0x13333f[_0xe903('0x11')]){if(_0x13333f['data1']==_0x55d875){GRAY_PERIOD_REASON=_0xe903('0x15');logger[_0xe903('0x12')]('THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED');}else{GRAY_PERIOD_REASON=_0xe903('0x16');logger[_0xe903('0x12')](_0xe903('0x17'),_0x13333f[_0xe903('0xf')],_0x55d875);}logger[_0xe903('0x12')]('%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s',GRAY_PERIOD_REASON[_0xe903('0x18')](),moment()[_0xe903('0x9')](_0xe903('0x19')));return _0x310403[_0xe903('0x1a')]({'data2':encryptor[_0xe903('0x1b')](moment()['format']('YYYY-MM-DD\x20HH:mm'))});}else{if(moment()[_0xe903('0x1c')](encryptor[_0xe903('0x1d')](_0x13333f['data2']),'days')>DAYS){logger['info'](_0xe903('0x1e'),moment()[_0xe903('0x9')](_0xe903('0x19')));isOldTokenSent=![];return _0x310403['update']({'data1':_0x55d875,'data2':null,'license':null});}}}else{if(_0x13333f['data1']!=_0x55d875){logger['info'](_0xe903('0x17'),_0x13333f[_0xe903('0xf')],_0x55d875);return _0x310403[_0xe903('0x1a')]({'data1':_0x55d875,'data2':null,'license':null});}}}return _0x310403;})[_0xe903('0xd')](function(_0x4398a9){_0x310403=_0x4398a9;})[_0xe903('0xe')](function(_0x37fa75){logger[_0xe903('0x1f')](_0x37fa75[_0xe903('0x20')]);})[_0xe903('0x21')](function(){setTimeout(function(){manageLicense(hardware[_0xe903('0x22')](),_0x310403);},TIME);});}function defaultLicense(){var _0x532435=hardware['getUuid']();if(_0x532435){return db[_0xe903('0x23')][_0xe903('0x24')]({'where':{'id':0x1},'defaults':{'data1':_0x532435}})[_0xe903('0x25')](function(_0x1755db,_0x1d941d){logger['info'](_0xe903('0x26'),_0x532435);manageLicense(_0x532435,_0x1755db);})[_0xe903('0xe')](function(_0x3a0a2b){logger['error'](_0x3a0a2b['message']);});}}exports['default']=defaultLicense; \ No newline at end of file +var _0xec76=['request-promise','pkginfo','../../mysqldb','./hardware','../logger','license','https://www.xcallymotion.com','format','exports','version','%s/api/servers/%s/check?version=%s&oldtoken=%s','GET','catch','get','data1','data2','then','active','info','update','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','YYYY-MM-DD\x20HH:mm','encryptString','diff','decryptString','error','message','getUuid','License','findOrCreate','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','default','util','moment'];(function(_0x1ad20c,_0x2483e3){var _0x5603f0=function(_0x3048b0){while(--_0x3048b0){_0x1ad20c['push'](_0x1ad20c['shift']());}};_0x5603f0(++_0x2483e3);}(_0xec76,0x96));var _0x6ec7=function(_0x7cce00,_0xcd20a6){_0x7cce00=_0x7cce00-0x0;var _0x30f6b0=_0xec76[_0x7cce00];return _0x30f6b0;};'use strict';var util=require(_0x6ec7('0x0'));var moment=require(_0x6ec7('0x1'));var rp=require(_0x6ec7('0x2'));var BPromise=require('bluebird');var pkginfo=require(_0x6ec7('0x3'))(module,'version');var db=require(_0x6ec7('0x4'))['db'];var encryptor=require('../../components/encryptor');var hardware=require(_0x6ec7('0x5'));var logger=require(_0x6ec7('0x6'))(_0x6ec7('0x7'));var HOST=_0x6ec7('0x8');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x41372f){return new BPromise(function(_0x49c466,_0x24dcce){var _0x470d20=util[_0x6ec7('0x9')]('%s/api/servers/%s/check?version=%s',HOST,_0x41372f,module[_0x6ec7('0xa')][_0x6ec7('0xb')]);if(oldToken){_0x470d20=util[_0x6ec7('0x9')](_0x6ec7('0xc'),HOST,_0x41372f,module['exports']['version'],oldToken);}var _0xf267aa={'uri':_0x470d20,'method':_0x6ec7('0xd'),'timeout':0xea60,'json':!![]};return rp(_0xf267aa)['then'](function(_0x21438f){_0x49c466(_0x21438f);})[_0x6ec7('0xe')](function(_0x45046a){_0x24dcce(_0x45046a);});});}function manageLicense(_0x1ee863,_0x4944d3){var _0x13085b=_0x4944d3[_0x6ec7('0xf')]({'plain':!![]});if(!isOldTokenSent&&_0x13085b[_0x6ec7('0x10')]!==_0x1ee863&&!_0x13085b[_0x6ec7('0x11')]){oldToken=_0x13085b[_0x6ec7('0x10')];}httpRequest(_0x1ee863)[_0x6ec7('0x12')](function(_0x2f7424){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x2f7424[_0x6ec7('0x13')]){isOldTokenSent=![];if(!_0x13085b[_0x6ec7('0x7')]&&_0x13085b['license']!=_0x2f7424[_0x6ec7('0x7')]||_0x13085b[_0x6ec7('0x7')]&&_0x13085b['data2']){logger[_0x6ec7('0x14')]('THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED');}if(_0x13085b[_0x6ec7('0x7')]&&!_0x13085b[_0x6ec7('0x11')]&&_0x13085b['license']!=_0x2f7424[_0x6ec7('0x7')]){logger['info']('THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED');}if(_0x13085b[_0x6ec7('0x7')]&&!_0x13085b[_0x6ec7('0x11')]&&_0x13085b[_0x6ec7('0x7')]==_0x2f7424['license']){return _0x4944d3;}return _0x4944d3[_0x6ec7('0x15')]({'data1':_0x1ee863,'data2':null,'license':_0x2f7424[_0x6ec7('0x7')]});}else{if(_0x2f7424[_0x6ec7('0x7')]||_0x13085b[_0x6ec7('0x7')]){if(!_0x13085b[_0x6ec7('0x11')]){if(_0x13085b[_0x6ec7('0x10')]==_0x1ee863){GRAY_PERIOD_REASON=_0x6ec7('0x16');logger[_0x6ec7('0x14')](_0x6ec7('0x17'));}else{GRAY_PERIOD_REASON=_0x6ec7('0x18');logger[_0x6ec7('0x14')](_0x6ec7('0x19'),_0x13085b['data1'],_0x1ee863);}logger[_0x6ec7('0x14')]('%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s',GRAY_PERIOD_REASON['toUpperCase'](),moment()[_0x6ec7('0x9')](_0x6ec7('0x1a')));return _0x4944d3[_0x6ec7('0x15')]({'data2':encryptor[_0x6ec7('0x1b')](moment()[_0x6ec7('0x9')](_0x6ec7('0x1a')))});}else{if(moment()[_0x6ec7('0x1c')](encryptor[_0x6ec7('0x1d')](_0x13085b[_0x6ec7('0x11')]),'days')>DAYS){logger[_0x6ec7('0x14')]('DEMO\x20START\x20AT\x20%s',moment()[_0x6ec7('0x9')](_0x6ec7('0x1a')));isOldTokenSent=![];return _0x4944d3[_0x6ec7('0x15')]({'data1':_0x1ee863,'data2':null,'license':null});}}}else{if(_0x13085b[_0x6ec7('0x10')]!=_0x1ee863){logger['info'](_0x6ec7('0x19'),_0x13085b[_0x6ec7('0x10')],_0x1ee863);return _0x4944d3[_0x6ec7('0x15')]({'data1':_0x1ee863,'data2':null,'license':null});}}}return _0x4944d3;})[_0x6ec7('0x12')](function(_0x20f349){_0x4944d3=_0x20f349;})[_0x6ec7('0xe')](function(_0x4a7e6f){logger[_0x6ec7('0x1e')](_0x4a7e6f[_0x6ec7('0x1f')]);})['finally'](function(){setTimeout(function(){manageLicense(hardware[_0x6ec7('0x20')](),_0x4944d3);},TIME);});}function defaultLicense(){var _0x196d7a=hardware[_0x6ec7('0x20')]();if(_0x196d7a){return db[_0x6ec7('0x21')][_0x6ec7('0x22')]({'where':{'id':0x1},'defaults':{'data1':_0x196d7a}})[_0x6ec7('0x23')](function(_0x5f4b79,_0x1d4c53){logger[_0x6ec7('0x14')](_0x6ec7('0x24'),_0x196d7a);manageLicense(_0x196d7a,_0x5f4b79);})['catch'](function(_0x194e16){logger[_0x6ec7('0x1e')](_0x194e16[_0x6ec7('0x1f')]);});}}exports[_0x6ec7('0x25')]=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index 0f75b57..376c8c6 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 _0xc934=['gray','grayReason','message','findAll','role','sequelize','COUNT','count','admin','user','telephone','users','pick','countBy','License\x20limit\x20reached\x20for\x20telephones','exports','lodash','bluebird','./hardware','../../components/encryptor','../../mysqldb','2027-01-01T00:00:00.000Z','Demo\x20license','getUuid','Breaking\x20license','License','then','catch','data1','license','isEmpty','License\x20key\x20value\x20not\x20found','data2','split','decryptString','format','%s:%s:%s','parse','demo','uuid','machineUuid'];(function(_0x3d4e0f,_0x23f4ef){var _0x3e3dc1=function(_0x414a11){while(--_0x414a11){_0x3d4e0f['push'](_0x3d4e0f['shift']());}};_0x3e3dc1(++_0x23f4ef);}(_0xc934,0x181));var _0x4c93=function(_0x110124,_0x5e1c72){_0x110124=_0x110124-0x0;var _0x3782a7=_0xc934[_0x110124];return _0x3782a7;};'use strict';var util=require('util');var _=require(_0x4c93('0x0'));var moment=require('moment');var BPromise=require(_0x4c93('0x1'));var hardware=require(_0x4c93('0x2'));var encryptor=require(_0x4c93('0x3'));var db=require(_0x4c93('0x4'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x4c93('0x5'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0x4c93('0x6'),'machineUuid':hardware[_0x4c93('0x7')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x4c93('0x5'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0x4c93('0x8'),'machineUuid':hardware[_0x4c93('0x7')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x5a21d1){return new BPromise(function(_0x27278d,_0x5c429f){return db[_0x4c93('0x9')]['find'](_['defaults'](_0x5a21d1,{'raw':!![],'where':{'id':0x1}}))['then'](function(_0x8c3649){return checkLicense(_0x8c3649,null);})[_0x4c93('0xa')](function(_0x508e6f){_0x27278d(_0x508e6f);return;})[_0x4c93('0xb')](function(_0x187971){_0x5c429f(_0x187971);});});}function checkLicense(_0x1dbe0b,_0x261af4){if(!_0x1dbe0b){demoLicense['uuid']=_0x1dbe0b[_0x4c93('0xc')];return demoLicense;}try{var _0x2bb6a6=_0x261af4||_0x1dbe0b[_0x4c93('0xd')];if(_[_0x4c93('0xe')](_0x2bb6a6)){throw new Error(_0x4c93('0xf'));}var _0x3f96f2=_0x1dbe0b[_0x4c93('0xc')];var _0x3c0bbb=_0x1dbe0b[_0x4c93('0x10')];var _0x55406f=_0x3f96f2[_0x4c93('0x11')]('-')[0x4];var _0x4fcf8a=_0x3f96f2[_0x4c93('0x11')]('-')[0x0];var _0x4d54a9=encryptor[_0x4c93('0x12')](_0x2bb6a6,util[_0x4c93('0x13')](_0x4c93('0x14'),_0x55406f,_0x3f96f2,_0x4fcf8a));var _0x6be3c3=JSON[_0x4c93('0x15')](_0x4d54a9);_0x6be3c3[_0x4c93('0x16')]=![];_0x6be3c3[_0x4c93('0x17')]=_0x3f96f2;_0x6be3c3[_0x4c93('0x18')]=hardware[_0x4c93('0x7')]();if(_0x3c0bbb){var _0x3a5236=encryptor['decryptString'](_0x3c0bbb);_0x6be3c3[_0x4c93('0x19')]=_0x3a5236;_0x6be3c3['deadline']=moment(_0x3a5236)['add'](0x7,'days')['format']();_0x6be3c3[_0x4c93('0x1a')]=_0x6be3c3[_0x4c93('0x17')]!=_0x6be3c3['machineUuid']?'changed':'disabled';}return _0x6be3c3;}catch(_0x57288d){breakingLicense[_0x4c93('0x17')]=_0x1dbe0b[_0x4c93('0xc')];breakingLicense[_0x4c93('0x1b')]=_0x57288d['message'];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x44f0b2,_0x417873){getLicense()[_0x4c93('0xa')](function(_0x4c7bc2){return db['User'][_0x4c93('0x1c')]({'attributes':[_0x4c93('0x1d'),[db[_0x4c93('0x1e')]['fn'](_0x4c93('0x1f'),db[_0x4c93('0x1e')]['col'](_0x4c93('0x1d'))),_0x4c93('0x20')]],'group':_0x4c93('0x1d'),'where':{'role':{'$or':[_0x4c93('0x21'),_0x4c93('0x22'),_0x4c93('0x23')]}},'raw':!![]})[_0x4c93('0xa')](function(_0x3dd93e){var _0x57aec4={'user':_0x4c7bc2[_0x4c93('0x24')]||0x0,'telephone':_0x4c7bc2['telephones']||0x0};_0x3dd93e['forEach'](function(_0x3b0488){var _0xbb8cba=_0x3b0488[_0x4c93('0x1d')]===_0x4c93('0x21')?_0x4c93('0x22'):_0x3b0488[_0x4c93('0x1d')];_0x57aec4[_0xbb8cba]-=_0x3b0488['count'];if(_0x57aec4[_0xbb8cba]<0x0)_0x57aec4[_0xbb8cba]=0x0;});_0x44f0b2(_0x57aec4);return;});})[_0x4c93('0xb')](function(_0x15666c){_0x417873(_0x15666c);});});}function checkUserLimits(_0x2128fe){return new BPromise(function(_0x117d78,_0x3f5a0a){getLimits()[_0x4c93('0xa')](function(_0x55c521){var _0x907b7f=_[_0x4c93('0x25')](_[_0x4c93('0x26')](_0x2128fe,'role'),[_0x4c93('0x21'),_0x4c93('0x22'),_0x4c93('0x23')]);var _0x19570f=(_0x907b7f[_0x4c93('0x21')]||0x0)+(_0x907b7f[_0x4c93('0x22')]||0x0);var _0xcd7484=_0x907b7f['telephone']||0x0;if(_0x19570f>_0x55c521['user'])return _0x3f5a0a('License\x20limit\x20reached\x20for\x20users');if(_0xcd7484>_0x55c521[_0x4c93('0x23')])return _0x3f5a0a(_0x4c93('0x27'));return _0x117d78();})[_0x4c93('0xb')](function(_0xd97e69){_0x3f5a0a(_0xd97e69);});});}module[_0x4c93('0x28')]={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file +var _0x1926=['./hardware','../../components/encryptor','../../mysqldb','Demo\x20license','getUuid','2027-01-01T00:00:00.000Z','License','find','then','uuid','data1','license','isEmpty','License\x20key\x20value\x20not\x20found','data2','split','%s:%s:%s','parse','demo','machineUuid','gray','deadline','add','days','grayReason','disabled','message','User','findAll','role','sequelize','COUNT','col','count','admin','telephone','telephones','pick','countBy','user','License\x20limit\x20reached\x20for\x20users','License\x20limit\x20reached\x20for\x20telephones','catch','exports','util','lodash','moment','bluebird'];(function(_0x5d132d,_0x32ef8c){var _0x46f999=function(_0x16bcd6){while(--_0x16bcd6){_0x5d132d['push'](_0x5d132d['shift']());}};_0x46f999(++_0x32ef8c);}(_0x1926,0x14c));var _0x6192=function(_0x29c10e,_0x4155af){_0x29c10e=_0x29c10e-0x0;var _0x3017d7=_0x1926[_0x29c10e];return _0x3017d7;};'use strict';var util=require(_0x6192('0x0'));var _=require(_0x6192('0x1'));var moment=require(_0x6192('0x2'));var BPromise=require(_0x6192('0x3'));var hardware=require(_0x6192('0x4'));var encryptor=require(_0x6192('0x5'));var db=require(_0x6192('0x6'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':'2027-01-01T00:00:00.000Z','chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0x6192('0x7'),'machineUuid':hardware[_0x6192('0x8')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x6192('0x9'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':'Breaking\x20license','machineUuid':hardware[_0x6192('0x8')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x7040b0){return new BPromise(function(_0x215563,_0x55fc58){return db[_0x6192('0xa')][_0x6192('0xb')](_['defaults'](_0x7040b0,{'raw':!![],'where':{'id':0x1}}))[_0x6192('0xc')](function(_0x2a81db){return checkLicense(_0x2a81db,null);})[_0x6192('0xc')](function(_0x558f52){_0x215563(_0x558f52);return;})['catch'](function(_0x172f48){_0x55fc58(_0x172f48);});});}function checkLicense(_0xbdb7d1,_0x5c5bad){if(!_0xbdb7d1){demoLicense[_0x6192('0xd')]=_0xbdb7d1[_0x6192('0xe')];return demoLicense;}try{var _0x1a6484=_0x5c5bad||_0xbdb7d1[_0x6192('0xf')];if(_[_0x6192('0x10')](_0x1a6484)){throw new Error(_0x6192('0x11'));}var _0x5ad38b=_0xbdb7d1[_0x6192('0xe')];var _0x220e4e=_0xbdb7d1[_0x6192('0x12')];var _0x5d9b6d=_0x5ad38b[_0x6192('0x13')]('-')[0x4];var _0x5cbed0=_0x5ad38b['split']('-')[0x0];var _0x542938=encryptor['decryptString'](_0x1a6484,util['format'](_0x6192('0x14'),_0x5d9b6d,_0x5ad38b,_0x5cbed0));var _0x3b203e=JSON[_0x6192('0x15')](_0x542938);_0x3b203e[_0x6192('0x16')]=![];_0x3b203e[_0x6192('0xd')]=_0x5ad38b;_0x3b203e[_0x6192('0x17')]=hardware[_0x6192('0x8')]();if(_0x220e4e){var _0x3f9529=encryptor['decryptString'](_0x220e4e);_0x3b203e[_0x6192('0x18')]=_0x3f9529;_0x3b203e[_0x6192('0x19')]=moment(_0x3f9529)[_0x6192('0x1a')](0x7,_0x6192('0x1b'))['format']();_0x3b203e[_0x6192('0x1c')]=_0x3b203e[_0x6192('0xd')]!=_0x3b203e[_0x6192('0x17')]?'changed':_0x6192('0x1d');}return _0x3b203e;}catch(_0x5b8116){breakingLicense[_0x6192('0xd')]=_0xbdb7d1[_0x6192('0xe')];breakingLicense[_0x6192('0x1e')]=_0x5b8116['message'];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x1e1ef5,_0x4cee1e){getLicense()[_0x6192('0xc')](function(_0x2748cc){return db[_0x6192('0x1f')][_0x6192('0x20')]({'attributes':[_0x6192('0x21'),[db[_0x6192('0x22')]['fn'](_0x6192('0x23'),db[_0x6192('0x22')][_0x6192('0x24')]('role')),_0x6192('0x25')]],'group':'role','where':{'role':{'$or':[_0x6192('0x26'),'user',_0x6192('0x27')]}},'raw':!![]})[_0x6192('0xc')](function(_0x3a41d3){var _0x294324={'user':_0x2748cc['users']||0x0,'telephone':_0x2748cc[_0x6192('0x28')]||0x0};_0x3a41d3['forEach'](function(_0x430b8e){var _0x52bd2e=_0x430b8e['role']==='admin'?'user':_0x430b8e[_0x6192('0x21')];_0x294324[_0x52bd2e]-=_0x430b8e[_0x6192('0x25')];if(_0x294324[_0x52bd2e]<0x0)_0x294324[_0x52bd2e]=0x0;});_0x1e1ef5(_0x294324);return;});})['catch'](function(_0x5281bc){_0x4cee1e(_0x5281bc);});});}function checkUserLimits(_0x419273){return new BPromise(function(_0x72a726,_0x38d9ba){getLimits()[_0x6192('0xc')](function(_0xd2cdec){var _0x5f1e03=_[_0x6192('0x29')](_[_0x6192('0x2a')](_0x419273,'role'),[_0x6192('0x26'),_0x6192('0x2b'),_0x6192('0x27')]);var _0x29b7ed=(_0x5f1e03[_0x6192('0x26')]||0x0)+(_0x5f1e03[_0x6192('0x2b')]||0x0);var _0x1b5283=_0x5f1e03[_0x6192('0x27')]||0x0;if(_0x29b7ed>_0xd2cdec[_0x6192('0x2b')])return _0x38d9ba(_0x6192('0x2c'));if(_0x1b5283>_0xd2cdec[_0x6192('0x27')])return _0x38d9ba(_0x6192('0x2d'));return _0x72a726();})[_0x6192('0x2e')](function(_0x739591){_0x38d9ba(_0x739591);});});}module[_0x6192('0x2f')]={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file diff --git a/server/config/local.env.js b/server/config/local.env.js index a25c354..66bb220 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 _0x1c7c=['exports','http://localhost:9000','myappanuglar-secret','app-id'];(function(_0x1e7e6f,_0xbe1b64){var _0x157afb=function(_0x293ab8){while(--_0x293ab8){_0x1e7e6f['push'](_0x1e7e6f['shift']());}};_0x157afb(++_0xbe1b64);}(_0x1c7c,0x164));var _0xc1c7=function(_0x4f971d,_0x1dfa7c){_0x4f971d=_0x4f971d-0x0;var _0x240ceb=_0x1c7c[_0x4f971d];return _0x240ceb;};'use strict';module[_0xc1c7('0x0')]={'DOMAIN':_0xc1c7('0x1'),'SESSION_SECRET':_0xc1c7('0x2'),'GOOGLE_ID':_0xc1c7('0x3'),'GOOGLE_SECRET':'secret','DEBUG':''}; \ No newline at end of file +var _0x583c=['http://localhost:9000','myappanuglar-secret','app-id','exports'];(function(_0x662847,_0x1feaef){var _0x246d58=function(_0x4a51da){while(--_0x4a51da){_0x662847['push'](_0x662847['shift']());}};_0x246d58(++_0x1feaef);}(_0x583c,0x12b));var _0xc583=function(_0x45518f,_0x475a6b){_0x45518f=_0x45518f-0x0;var _0x198175=_0x583c[_0x45518f];return _0x198175;};'use strict';module[_0xc583('0x0')]={'DOMAIN':_0xc583('0x1'),'SESSION_SECRET':_0xc583('0x2'),'GOOGLE_ID':_0xc583('0x3'),'GOOGLE_SECRET':'secret','DEBUG':''}; \ No newline at end of file diff --git a/server/config/logger.js b/server/config/logger.js index 3922fa2..3dfc962 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4d23=['debugLevel','util','path','INFO','join','/var','log','xcally','format','%s-%s.log','message','replace','}}}','[%s]\x20[%s]\x20%s\x20-\x20%s','level','toUpperCase','exports','Logger','File','error','transports','info','env'];(function(_0x1696c3,_0x168bf2){var _0x4f748e=function(_0x384bc5){while(--_0x384bc5){_0x1696c3['push'](_0x1696c3['shift']());}};_0x4f748e(++_0x168bf2);}(_0x4d23,0x12c));var _0x34d2=function(_0x1b2c50,_0x48996f){_0x1b2c50=_0x1b2c50-0x0;var _0x585674=_0x4d23[_0x1b2c50];return _0x585674;};'use strict';var moment=require('moment');var winston=require('winston');var util=require(_0x34d2('0x0'));var path=require(_0x34d2('0x1'));var debugLevel=_0x34d2('0x2');function filename(_0x2acdcc,_0x11b1c6){return path[_0x34d2('0x3')](_0x34d2('0x4'),_0x34d2('0x5'),_0x34d2('0x6'),util[_0x34d2('0x7')](_0x34d2('0x8'),_0x2acdcc,_0x11b1c6));}function formatter(_0x56cf21,_0x28042f){_0x28042f[_0x34d2('0x9')]=_0x28042f['message']['replace'](/@@{/g,'{{{')[_0x34d2('0xa')](/}@@/g,_0x34d2('0xb'))[_0x34d2('0xa')](/@{/g,'{{')[_0x34d2('0xa')](/}@/g,'}}');return util[_0x34d2('0x7')](_0x34d2('0xc'),moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),_0x28042f[_0x34d2('0xd')][_0x34d2('0xe')](),_0x56cf21,_0x28042f[_0x34d2('0x9')]);}module[_0x34d2('0xf')]=function(_0x4bf678){return new winston[(_0x34d2('0x10'))]({'transports':[new winston['transports'][(_0x34d2('0x11'))]({'name':util['format']('%s-%s',_0x4bf678,_0x34d2('0x12')),'filename':filename(_0x4bf678,_0x34d2('0x12')),'level':_0x34d2('0x12'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x33c130){return formatter(_0x4bf678,_0x33c130);}}),new winston[(_0x34d2('0x13'))][(_0x34d2('0x11'))]({'name':util[_0x34d2('0x7')]('%s-%s',_0x4bf678,_0x34d2('0x14')),'filename':filename(_0x4bf678,_0x34d2('0x14')),'level':_0x34d2('0x14'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x34f288){return formatter(_0x4bf678,_0x34f288);}}),new winston[(_0x34d2('0x13'))]['Console']({'level':process[_0x34d2('0x15')][_0x34d2('0x16')]||debugLevel,'json':![],'formatter':function(_0x1c575e){return formatter(_0x4bf678,_0x1c575e);}})]});}; \ No newline at end of file +var _0x2ec4=['replace','{{{','}}}','[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss','toUpperCase','exports','Logger','transports','File','%s-%s','error','info','Console','env','debugLevel','moment','winston','util','INFO','join','log','xcally','format','message'];(function(_0x5fc146,_0x3d64a9){var _0x479e5b=function(_0x1d3852){while(--_0x1d3852){_0x5fc146['push'](_0x5fc146['shift']());}};_0x479e5b(++_0x3d64a9);}(_0x2ec4,0x1b9));var _0x42ec=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x2ec4[_0x1facfa];return _0x9ec701;};'use strict';var moment=require(_0x42ec('0x0'));var winston=require(_0x42ec('0x1'));var util=require(_0x42ec('0x2'));var path=require('path');var debugLevel=_0x42ec('0x3');function filename(_0x38c850,_0x5c6f52){return path[_0x42ec('0x4')]('/var',_0x42ec('0x5'),_0x42ec('0x6'),util[_0x42ec('0x7')]('%s-%s.log',_0x38c850,_0x5c6f52));}function formatter(_0x3880f8,_0x4b566e){_0x4b566e[_0x42ec('0x8')]=_0x4b566e['message'][_0x42ec('0x9')](/@@{/g,_0x42ec('0xa'))['replace'](/}@@/g,_0x42ec('0xb'))[_0x42ec('0x9')](/@{/g,'{{')[_0x42ec('0x9')](/}@/g,'}}');return util['format'](_0x42ec('0xc'),moment()[_0x42ec('0x7')](_0x42ec('0xd')),_0x4b566e['level'][_0x42ec('0xe')](),_0x3880f8,_0x4b566e['message']);}module[_0x42ec('0xf')]=function(_0x23448e){return new winston[(_0x42ec('0x10'))]({'transports':[new winston[(_0x42ec('0x11'))][(_0x42ec('0x12'))]({'name':util[_0x42ec('0x7')](_0x42ec('0x13'),_0x23448e,_0x42ec('0x14')),'filename':filename(_0x23448e,'error'),'level':_0x42ec('0x14'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x2f1246){return formatter(_0x23448e,_0x2f1246);}}),new winston[(_0x42ec('0x11'))]['File']({'name':util['format']('%s-%s',_0x23448e,_0x42ec('0x15')),'filename':filename(_0x23448e,_0x42ec('0x15')),'level':_0x42ec('0x15'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x15678b){return formatter(_0x23448e,_0x15678b);}}),new winston['transports'][(_0x42ec('0x16'))]({'level':process[_0x42ec('0x17')][_0x42ec('0x18')]||debugLevel,'json':![],'formatter':function(_0x2e6882){return formatter(_0x23448e,_0x2e6882);}})]});}; \ No newline at end of file diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index 507cc2c..e4f14fc 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 _0x0085=['../../services/email/index.js','routing','xdr','../../services/xdr/index.js','exports','path','express','join','../../services/express/index.js','ami','../../services/ami/index.js','agi','../../services/agi/index.js','email'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x0085,0x147));var _0x5008=function(_0x372cd8,_0x5b5c1f){_0x372cd8=_0x372cd8-0x0;var _0x4d70a7=_0x0085[_0x372cd8];return _0x4d70a7;};'use strict';var path=require(_0x5008('0x0'));var os=require('os');var config={'apps':[{'name':_0x5008('0x1'),'script':path[_0x5008('0x2')](__dirname,_0x5008('0x3'))},{'name':_0x5008('0x4'),'script':path['join'](__dirname,_0x5008('0x5'))},{'name':_0x5008('0x6'),'script':path[_0x5008('0x2')](__dirname,_0x5008('0x7'))},{'name':_0x5008('0x8'),'script':path[_0x5008('0x2')](__dirname,_0x5008('0x9'))},{'name':_0x5008('0xa'),'script':path[_0x5008('0x2')](__dirname,'../../services/routing/index.js')},{'name':_0x5008('0xb'),'script':path[_0x5008('0x2')](__dirname,_0x5008('0xc'))}]};module[_0x5008('0xd')]=config; \ No newline at end of file +var _0x5a85=['email','../../services/email/index.js','../../services/routing/index.js','xdr','exports','path','express','join','../../services/express/index.js','ami','../../services/ami/index.js','agi','../../services/agi/index.js'];(function(_0x599151,_0x60c9dc){var _0x3994ce=function(_0xaa3859){while(--_0xaa3859){_0x599151['push'](_0x599151['shift']());}};_0x3994ce(++_0x60c9dc);}(_0x5a85,0x1bf));var _0x55a8=function(_0x20588f,_0x3a0c65){_0x20588f=_0x20588f-0x0;var _0x1af455=_0x5a85[_0x20588f];return _0x1af455;};'use strict';var path=require(_0x55a8('0x0'));var os=require('os');var config={'apps':[{'name':_0x55a8('0x1'),'script':path[_0x55a8('0x2')](__dirname,_0x55a8('0x3'))},{'name':_0x55a8('0x4'),'script':path[_0x55a8('0x2')](__dirname,_0x55a8('0x5'))},{'name':_0x55a8('0x6'),'script':path[_0x55a8('0x2')](__dirname,_0x55a8('0x7'))},{'name':_0x55a8('0x8'),'script':path[_0x55a8('0x2')](__dirname,_0x55a8('0x9'))},{'name':'routing','script':path[_0x55a8('0x2')](__dirname,_0x55a8('0xa'))},{'name':_0x55a8('0xb'),'script':path['join'](__dirname,'../../services/xdr/index.js')}]};module[_0x55a8('0xc')]=config; \ No newline at end of file diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index 7292ca6..411c61b 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 _0x62bb=['describe','delete','pm2','bluebird','./config','connect','connected','start','stop','then','restart','disconnect','list'];(function(_0x5a090e,_0x223f2c){var _0x2215fe=function(_0x4d2daf){while(--_0x4d2daf){_0x5a090e['push'](_0x5a090e['shift']());}};_0x2215fe(++_0x223f2c);}(_0x62bb,0x106));var _0xb62b=function(_0x3f8c86,_0x42001c){_0x3f8c86=_0x3f8c86-0x0;var _0x3c4b45=_0x62bb[_0x3f8c86];return _0x3c4b45;};'use strict';var pm2=require(_0xb62b('0x0'));var BPromise=require(_0xb62b('0x1'));var config=require(_0xb62b('0x2'));function connect(){return new BPromise(function(_0x339234,_0x5a6ab5){return pm2[_0xb62b('0x3')](function(_0x329119){if(_0x329119){return _0x5a6ab5(_0x329119);}return _0x339234(_0xb62b('0x4'));});});};exports[_0xb62b('0x5')]=function(_0x5c2c34){return connect()['then'](function(){return new BPromise(function(_0x27766e,_0x5c606d){return pm2['start'](_0x5c2c34,function(_0x22a4f0,_0x183063){if(_0x22a4f0){return _0x5c606d(_0x22a4f0);}pm2['disconnect']();return _0x27766e(_0x183063);});});});};exports[_0xb62b('0x6')]=function(_0x2fb49b){return connect()[_0xb62b('0x7')](function(){return new BPromise(function(_0xfddd67,_0x5e569f){return pm2[_0xb62b('0x6')](_0x2fb49b,function(_0x3f910f,_0x3ad66a){if(_0x3f910f){return _0x5e569f(_0x3f910f);}pm2['disconnect']();return _0xfddd67(_0x3ad66a);});});});};exports[_0xb62b('0x8')]=function(_0x1e9ed5){return connect()[_0xb62b('0x7')](function(){return new BPromise(function(_0x53ba38,_0x11704f){return pm2['restart'](_0x1e9ed5,function(_0x30d1ad,_0x2c82a7){if(_0x30d1ad){return _0x11704f(_0x30d1ad);}pm2[_0xb62b('0x9')]();return _0x53ba38(_0x2c82a7);});});});};exports[_0xb62b('0xa')]=function(){return connect()['then'](function(){return new BPromise(function(_0x23792a,_0x25bae0){return pm2['list'](function(_0x1c808d,_0x2a0644){if(_0x1c808d){return _0x25bae0(_0x1c808d);}pm2[_0xb62b('0x9')]();return _0x23792a(_0x2a0644);});});});};exports[_0xb62b('0xb')]=function(_0x563513){return connect()[_0xb62b('0x7')](function(){return new BPromise(function(_0x53fb48,_0x3b7bd2){return pm2[_0xb62b('0xb')](_0x563513,function(_0x48a6ca,_0x4fceeb){if(_0x48a6ca){return _0x3b7bd2(_0x48a6ca);}pm2['disconnect']();return _0x53fb48(_0x4fceeb);});});});};exports[_0xb62b('0xc')]=function(_0x31f0c1){return connect()[_0xb62b('0x7')](function(){return new BPromise(function(_0x16c288,_0x30a2cc){return pm2[_0xb62b('0xc')](_0x31f0c1,function(_0x625317,_0x2b1a4f){if(_0x625317){return _0x30a2cc(_0x625317);}pm2[_0xb62b('0x9')]();return _0x16c288(_0x2b1a4f);});});});};exports['dump']=function(){return connect()[_0xb62b('0x7')](function(){return new BPromise(function(_0x5c7b81,_0x4e29e6){return pm2['dump'](function(_0x412450){if(_0x412450){return _0x4e29e6(_0x412450);}return _0x5c7b81('saved');});});});}; \ No newline at end of file +var _0x96fe=['start','disconnect','restart','list','describe','delete','dump','pm2','bluebird','./config','connect','connected','then'];(function(_0x17cd69,_0x3ac40b){var _0x16b47c=function(_0x3d9830){while(--_0x3d9830){_0x17cd69['push'](_0x17cd69['shift']());}};_0x16b47c(++_0x3ac40b);}(_0x96fe,0x1db));var _0xe96f=function(_0x432792,_0x16618c){_0x432792=_0x432792-0x0;var _0x5db705=_0x96fe[_0x432792];return _0x5db705;};'use strict';var pm2=require(_0xe96f('0x0'));var BPromise=require(_0xe96f('0x1'));var config=require(_0xe96f('0x2'));function connect(){return new BPromise(function(_0x1e6ae6,_0xf95092){return pm2[_0xe96f('0x3')](function(_0x157083){if(_0x157083){return _0xf95092(_0x157083);}return _0x1e6ae6(_0xe96f('0x4'));});});};exports['start']=function(_0x590ca6){return connect()[_0xe96f('0x5')](function(){return new BPromise(function(_0x11d6f7,_0x13a8de){return pm2[_0xe96f('0x6')](_0x590ca6,function(_0x2c8ac9,_0x46c9f1){if(_0x2c8ac9){return _0x13a8de(_0x2c8ac9);}pm2[_0xe96f('0x7')]();return _0x11d6f7(_0x46c9f1);});});});};exports['stop']=function(_0x4ae159){return connect()['then'](function(){return new BPromise(function(_0x499af9,_0x599240){return pm2['stop'](_0x4ae159,function(_0x25569c,_0x5357ff){if(_0x25569c){return _0x599240(_0x25569c);}pm2[_0xe96f('0x7')]();return _0x499af9(_0x5357ff);});});});};exports[_0xe96f('0x8')]=function(_0x49baa3){return connect()[_0xe96f('0x5')](function(){return new BPromise(function(_0x25fb72,_0x579a67){return pm2[_0xe96f('0x8')](_0x49baa3,function(_0x389cca,_0x4af5d4){if(_0x389cca){return _0x579a67(_0x389cca);}pm2[_0xe96f('0x7')]();return _0x25fb72(_0x4af5d4);});});});};exports[_0xe96f('0x9')]=function(){return connect()[_0xe96f('0x5')](function(){return new BPromise(function(_0x3aa079,_0xe72420){return pm2['list'](function(_0x4361a1,_0x4565df){if(_0x4361a1){return _0xe72420(_0x4361a1);}pm2['disconnect']();return _0x3aa079(_0x4565df);});});});};exports[_0xe96f('0xa')]=function(_0x2c7041){return connect()[_0xe96f('0x5')](function(){return new BPromise(function(_0x500056,_0x2adb61){return pm2[_0xe96f('0xa')](_0x2c7041,function(_0x118642,_0x380110){if(_0x118642){return _0x2adb61(_0x118642);}pm2[_0xe96f('0x7')]();return _0x500056(_0x380110);});});});};exports['delete']=function(_0x2e80bb){return connect()[_0xe96f('0x5')](function(){return new BPromise(function(_0x509935,_0x3f8e62){return pm2[_0xe96f('0xb')](_0x2e80bb,function(_0x254e83,_0x35a11){if(_0x254e83){return _0x3f8e62(_0x254e83);}pm2[_0xe96f('0x7')]();return _0x509935(_0x35a11);});});});};exports[_0xe96f('0xc')]=function(){return connect()[_0xe96f('0x5')](function(){return new BPromise(function(_0x2dcde8,_0x9d0ae7){return pm2['dump'](function(_0x1d1668){if(_0x1d1668){return _0x9d0ae7(_0x1d1668);}return _0x2dcde8('saved');});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index 2bdb912..e778092 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 _0xada4=['format','YYYY-MM-DD\x20HH:mm:ss','length','info','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','join','chatInteraction:update','catch','[CHAT]\x20Error\x20closing\x20interactions','start','lodash','moment','../../config/environment','../../mysqldb','../logger','defaults','redis','localhost','socket.io-emitter','chatTimeout','ChatInteraction','findAll','lastMsgAt','subtract','minutes','then','map','[CHAT]\x20Interactions\x20to\x20close:','update','system'];(function(_0x19cae8,_0x49dd0d){var _0x3ea9d1=function(_0x51c5c7){while(--_0x51c5c7){_0x19cae8['push'](_0x19cae8['shift']());}};_0x3ea9d1(++_0x49dd0d);}(_0xada4,0x64));var _0x4ada=function(_0x534d30,_0x60d2b2){_0x534d30=_0x534d30-0x0;var _0x4c4751=_0xada4[_0x534d30];return _0x4c4751;};'use strict';var _=require(_0x4ada('0x0'));var moment=require(_0x4ada('0x1'));var Redis=require('ioredis');var util=require('util');var config=require(_0x4ada('0x2'));var db=require(_0x4ada('0x3'))['db'];var logger=require(_0x4ada('0x4'))('schedule');config['redis']=_[_0x4ada('0x5')](config[_0x4ada('0x6')],{'host':_0x4ada('0x7'),'port':0x18eb});var io=require(_0x4ada('0x8'))(new Redis(config[_0x4ada('0x6')]));function closeInteractions(){var _0x13f672=0x0;var _0x497c78=[];return db['Setting']['find']({'raw':!![],'attributes':['id','chatTimeout'],'where':{'id':0x1}})['then'](function(_0x8883e){_0x13f672=_0x8883e[_0x4ada('0x9')];if(_0x13f672){return db[_0x4ada('0xa')][_0x4ada('0xb')]({'raw':!![],'attributes':['id',_0x4ada('0xc')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x4ada('0xd')](_0x8883e[_0x4ada('0x9')],_0x4ada('0xe'))}}});}else{return[];}})[_0x4ada('0xf')](function(_0x550947){if(_0x550947&&_0x550947['length']){_0x497c78=_[_0x4ada('0x10')](_0x550947||[],'id');logger['info'](_0x4ada('0x11'),_0x497c78['join']());return db['ChatInteraction'][_0x4ada('0x12')]({'closeReason':_0x4ada('0x13'),'disposition':'timeout','closed':!![],'closedAt':moment()[_0x4ada('0x14')](_0x4ada('0x15'))},{'where':{'id':_0x497c78}});}})[_0x4ada('0xf')](function(){if(_0x497c78&&_0x497c78[_0x4ada('0x16')]){logger[_0x4ada('0x17')](_0x4ada('0x18'),_0x497c78[_0x4ada('0x19')]());for(var _0x2e0654=0x0;_0x2e0654<_0x497c78['length'];_0x2e0654++){io['emit'](_0x4ada('0x1a'),{'id':_0x497c78[_0x2e0654],'closed':!![]});}}})[_0x4ada('0x1b')](function(_0x228ff3){logger['error'](_0x4ada('0x1c'),_0x228ff3?util['inspect'](_0x228ff3,{'showHidden':![],'depth':null}):'');});}exports[_0x4ada('0x1d')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0xf835=['findAll','subtract','minutes','length','map','info','[CHAT]\x20Interactions\x20to\x20close:','join','timeout','YYYY-MM-DD\x20HH:mm:ss','emit','chatInteraction:update','catch','error','[CHAT]\x20Error\x20closing\x20interactions','start','lodash','moment','ioredis','util','../../mysqldb','../logger','schedule','redis','defaults','socket.io-emitter','Setting','chatTimeout','then','ChatInteraction'];(function(_0x1f5104,_0xb4978d){var _0x3d0642=function(_0x54e28c){while(--_0x54e28c){_0x1f5104['push'](_0x1f5104['shift']());}};_0x3d0642(++_0xb4978d);}(_0xf835,0x100));var _0x5f83=function(_0x4a081b,_0x178562){_0x4a081b=_0x4a081b-0x0;var _0x51f811=_0xf835[_0x4a081b];return _0x51f811;};'use strict';var _=require(_0x5f83('0x0'));var moment=require(_0x5f83('0x1'));var Redis=require(_0x5f83('0x2'));var util=require(_0x5f83('0x3'));var config=require('../../config/environment');var db=require(_0x5f83('0x4'))['db'];var logger=require(_0x5f83('0x5'))(_0x5f83('0x6'));config[_0x5f83('0x7')]=_[_0x5f83('0x8')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x5f83('0x9'))(new Redis(config[_0x5f83('0x7')]));function closeInteractions(){var _0x46eff5=0x0;var _0x2b4baa=[];return db[_0x5f83('0xa')]['find']({'raw':!![],'attributes':['id',_0x5f83('0xb')],'where':{'id':0x1}})[_0x5f83('0xc')](function(_0x2e5952){_0x46eff5=_0x2e5952[_0x5f83('0xb')];if(_0x46eff5){return db[_0x5f83('0xd')][_0x5f83('0xe')]({'raw':!![],'attributes':['id','lastMsgAt'],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x5f83('0xf')](_0x2e5952[_0x5f83('0xb')],_0x5f83('0x10'))}}});}else{return[];}})['then'](function(_0x16a2e7){if(_0x16a2e7&&_0x16a2e7[_0x5f83('0x11')]){_0x2b4baa=_[_0x5f83('0x12')](_0x16a2e7||[],'id');logger[_0x5f83('0x13')](_0x5f83('0x14'),_0x2b4baa[_0x5f83('0x15')]());return db['ChatInteraction']['update']({'closeReason':'system','disposition':_0x5f83('0x16'),'closed':!![],'closedAt':moment()['format'](_0x5f83('0x17'))},{'where':{'id':_0x2b4baa}});}})['then'](function(){if(_0x2b4baa&&_0x2b4baa[_0x5f83('0x11')]){logger['info']('[CHAT]\x20Sending\x20updates\x20for\x20interactions:',_0x2b4baa['join']());for(var _0x55f3c2=0x0;_0x55f3c2<_0x2b4baa[_0x5f83('0x11')];_0x55f3c2++){io[_0x5f83('0x18')](_0x5f83('0x19'),{'id':_0x2b4baa[_0x55f3c2],'closed':!![]});}}})[_0x5f83('0x1a')](function(_0x2500f3){logger[_0x5f83('0x1b')](_0x5f83('0x1c'),_0x2500f3?util['inspect'](_0x2500f3,{'showHidden':![],'depth':null}):'');});}exports[_0x5f83('0x1d')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file diff --git a/server/config/schedule/index.js b/server/config/schedule/index.js index 5d0b5e8..f525e2b 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 _0xe203=['email\x20sent','catch','error\x20mail','data','isNil','subtractNumber\x20null\x20or\x20undefined','subtractUnit','subtractUnit\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','then','CustomReportId','runReport','no\x20report\x20id','findAll','MailServerOut','keys','map','toString','keyBy','intersection','difference','length','exists','stop','deleteJob','delete\x20cron','toRun','index','resolve','cron','active','isBetween','startAt','endAt','add','start','add\x20cron','stop\x20cron','update','run','lodash','cron-job-manager','jayson/promise','schedule','../../mysqldb','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','http','info','Try\x20to\x20send\x20a\x20mail\x20to','email','MailAccount','Smtp','service','host','port','secure','authentication','auth','pass','format','\x22%s\x22\x20<%s>','name','user','bcc','subtractNumber','join','../../files/reports','savename','%s.%s','extname','zip','existsSync','status','Sent','message','attachments','text','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','stringify','sendIfEmpty','request','error'];(function(_0x31e29a,_0x349c9b){var _0x32d892=function(_0x41cc86){while(--_0x41cc86){_0x31e29a['push'](_0x31e29a['shift']());}};_0x32d892(++_0x349c9b);}(_0xe203,0x183));var _0x3e20=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe203[_0x3dd15e];return _0x231fd0;};'use strict';var fs=require('fs');var util=require('util');var path=require('path');var _=require(_0x3e20('0x0'));var moment=require('moment');var CronJobManager=require(_0x3e20('0x1'));var jayson=require(_0x3e20('0x2'));var BPromise=require('bluebird');var logger=require('../logger')(_0x3e20('0x3'));var db=require(_0x3e20('0x4'))['db'];var analyticCustomReportController=require('../../api/analyticCustomReport/analyticCustomReport.controller');var analyticDefaultReportController=require(_0x3e20('0x5'));var client=jayson[_0x3e20('0x6')][_0x3e20('0x7')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x25539e,_0x25b30f){return function(){logger[_0x3e20('0x8')](_0x3e20('0x9'),_0x25539e[_0x3e20('0xa')]);var _0x299bfe=!![];var _0x28c930={'tls':{'rejectUnauthorized':![]}};if(_0x25539e[_0x3e20('0xb')][_0x3e20('0xc')]['service']){_0x28c930[_0x3e20('0xd')]=_0x25539e[_0x3e20('0xb')][_0x3e20('0xc')][_0x3e20('0xd')];}else{_0x28c930[_0x3e20('0xe')]=_0x25539e[_0x3e20('0xb')][_0x3e20('0xc')][_0x3e20('0xe')];_0x28c930['port']=_0x25539e['MailAccount'][_0x3e20('0xc')][_0x3e20('0xf')];_0x28c930[_0x3e20('0x10')]=_0x25539e['MailAccount'][_0x3e20('0xc')]['secure'];}if(_0x25539e['MailAccount'][_0x3e20('0xc')][_0x3e20('0x11')]){_0x28c930[_0x3e20('0x12')]={'user':_0x25539e[_0x3e20('0xb')][_0x3e20('0xc')]['user'],'pass':_0x25539e[_0x3e20('0xb')]['Smtp'][_0x3e20('0x13')]};}var _0x224b3f={'account':_0x28c930,'message':{'from':util[_0x3e20('0x14')](_0x3e20('0x15'),_0x25539e[_0x3e20('0xb')][_0x3e20('0x16')],_0x25539e['MailAccount']['email']||_0x25539e[_0x3e20('0xb')][_0x3e20('0xc')][_0x3e20('0x17')]),'to':_0x25539e[_0x3e20('0xa')],'cc':_0x25539e['cc'],'bcc':_0x25539e[_0x3e20('0x18')],'subject':util[_0x3e20('0x14')]('Report\x20%s\x20last\x20%s\x20%s',_0x25b30f['name'],_0x25539e[_0x3e20('0x19')],_0x25539e['subtractUnit'])}};var _0x5d9ffb=path[_0x3e20('0x1a')](__dirname,_0x3e20('0x1b'));var _0x445048=_0x25b30f[_0x3e20('0x1c')];var _0x5a2d3a=util[_0x3e20('0x14')](_0x3e20('0x1d'),path['basename'](_0x25b30f['savename'],path[_0x3e20('0x1e')](_0x25b30f['savename'])),_0x3e20('0x1f'));var _0x443f3e=path[_0x3e20('0x1a')](_0x5d9ffb,_0x445048);var _0x42130b=path[_0x3e20('0x1a')](_0x5d9ffb,_0x5a2d3a);if(fs[_0x3e20('0x20')](_0x443f3e)){_0x25b30f[_0x3e20('0x21')]=_0x3e20('0x22');_0x224b3f[_0x3e20('0x23')][_0x3e20('0x24')]=[{'filename':_0x445048,'path':_0x443f3e}];_0x224b3f['message'][_0x3e20('0x25')]=util[_0x3e20('0x14')](_0x3e20('0x26'),JSON[_0x3e20('0x27')](_0x25b30f,null,0x2));}else if(fs[_0x3e20('0x20')](_0x42130b)){_0x25b30f['status']=_0x3e20('0x22');_0x224b3f['message'][_0x3e20('0x24')]=[{'filename':_0x5a2d3a,'path':_0x42130b}];}else{_0x224b3f['message'][_0x3e20('0x25')]='Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a';if(!_0x25539e[_0x3e20('0x28')]){_0x299bfe=![];logger[_0x3e20('0x8')]('empty\x20file,\x20email\x20not\x20sent');}}if(_0x299bfe){return client[_0x3e20('0x29')]('SendMail',_0x224b3f)['then'](function(_0x559d96){if(_0x559d96[_0x3e20('0x2a')]){return logger[_0x3e20('0x2a')]('error\x20mail',JSON[_0x3e20('0x27')](_0x559d96));}return logger[_0x3e20('0x8')](_0x3e20('0x2b'));})[_0x3e20('0x2c')](function(_0x4f1acf){return logger['error'](_0x3e20('0x2d'),JSON[_0x3e20('0x27')](_0x4f1acf));});}};}function handleError(){return function(_0x40cf6d){return logger[_0x3e20('0x2a')](JSON['stringify'](_0x40cf6d));};}function handleResult(_0x2d298b){return function(_0x1d0e8e){logger['info'](_0x3e20('0x2e'),JSON['stringify'](_0x1d0e8e));if(_0x2d298b[_0x3e20('0xb')]&&_0x2d298b[_0x3e20('0xb')][_0x3e20('0xc')]&&!_[_0x3e20('0x2f')](_0x2d298b[_0x3e20('0xa')])){setTimeout(handleSendEmail(_0x2d298b,_0x1d0e8e),0x3c*0x3e8);}};}function handleJob(_0x3e1d1e){return function(){try{if(_[_0x3e20('0x2f')](_0x3e1d1e[_0x3e20('0x19')])){return logger[_0x3e20('0x8')](_0x3e20('0x30'));}if(_['isNil'](_0x3e1d1e[_0x3e20('0x31')])){return logger[_0x3e20('0x8')](_0x3e20('0x32'));}var _0x51f20b={'startDate':moment()[_0x3e20('0x33')](_0x3e1d1e[_0x3e20('0x19')],_0x3e1d1e['subtractUnit'])[_0x3e20('0x14')](_0x3e20('0x34')),'endDate':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'type':_0x3e20('0x35'),'output':_0x3e1d1e[_0x3e20('0x36')],'name':_0x3e1d1e[_0x3e20('0x16')]};if(!_['isNil'](_0x3e1d1e['DefaultReportId'])){logger['info']('exec\x20defaul\x20report\x20id:%s',_0x3e1d1e['DefaultReportId']);return analyticDefaultReportController['runReport']({'id':_0x3e1d1e['DefaultReportId']},_0x51f20b)[_0x3e20('0x37')](handleResult(_0x3e1d1e))[_0x3e20('0x2c')](handleError());}if(!_['isNil'](_0x3e1d1e[_0x3e20('0x38')])){logger['info']('exec\x20custom\x20report\x20id:%s',_0x3e1d1e[_0x3e20('0x38')]);return analyticCustomReportController[_0x3e20('0x39')]({'id':_0x3e1d1e[_0x3e20('0x38')]},_0x51f20b)['then'](handleResult(_0x3e1d1e))[_0x3e20('0x2c')](handleError());}}catch(_0x23b667){logger[_0x3e20('0x2a')](JSON[_0x3e20('0x27')](_0x23b667));}return logger['info'](_0x3e20('0x3a'));};}function getJobs(_0x4ff1f7){var _0x6bb5ab={};if(_0x4ff1f7){_0x6bb5ab['id']=_0x4ff1f7;}return db['Schedule'][_0x3e20('0x3b')]({'where':_0x6bb5ab,'include':[{'model':db[_0x3e20('0xb')],'attributes':['id',_0x3e20('0x16'),_0x3e20('0xa')],'include':[{'model':db[_0x3e20('0x3c')],'as':_0x3e20('0xc')}]}]})[_0x3e20('0x37')](function(_0x5c2192){var _0x137b1e=_[_0x3e20('0x3d')](manager['jobs']);var _0x49f766=_[_0x3e20('0x3e')](_0x5c2192,function(_0x2744fd){return _0x2744fd['id'][_0x3e20('0x3f')]();});var _0x1b10e4=_[_0x3e20('0x40')](_0x5c2192,function(_0x4f5a23){return _0x4f5a23['id'][_0x3e20('0x3f')]();});var _0x2d4298=_0x4ff1f7?_0x49f766:_['difference'](_0x49f766,_0x137b1e);var _0x40468d=_[_0x3e20('0x41')](_0x49f766,_0x137b1e);var _0x50c486=_[_0x3e20('0x42')](_0x137b1e,_0x49f766);var _0x269de6;var _0x24b046;for(_0x269de6=0x0;_0x269de6<_0x50c486[_0x3e20('0x43')]&&!_0x4ff1f7;_0x269de6+=0x1){_0x24b046=_0x50c486[_0x269de6]['toString']();if(manager[_0x3e20('0x44')](_0x24b046)){manager[_0x3e20('0x45')](_0x24b046);manager[_0x3e20('0x46')](_0x24b046);logger[_0x3e20('0x8')](_0x3e20('0x47'),_0x24b046);}}logger[_0x3e20('0x8')](_0x3e20('0x48'),JSON[_0x3e20('0x27')](_0x2d4298));for(_0x269de6=0x0;_0x269de6<_0x2d4298[_0x3e20('0x43')];_0x269de6+=0x1){_0x24b046=_0x2d4298[_0x269de6][_0x3e20('0x3f')]();logger[_0x3e20('0x8')](_0x3e20('0x49'),_0x24b046);if(_0x4ff1f7){logger[_0x3e20('0x8')]('my\x20id',_0x4ff1f7);logger[_0x3e20('0x8')](JSON[_0x3e20('0x27')](_0x1b10e4[_0x24b046]));BPromise[_0x3e20('0x4a')]()[_0x3e20('0x37')](handleJob(_0x1b10e4[_0x24b046]));logger['info']('run\x20job',_0x1b10e4[_0x24b046][_0x3e20('0x16')],_0x1b10e4[_0x24b046]['cron']);}else if(_0x1b10e4[_0x24b046][_0x3e20('0x4b')]&&_0x1b10e4[_0x24b046][_0x3e20('0x4c')]&&moment()[_0x3e20('0x4d')](_0x1b10e4[_0x24b046][_0x3e20('0x4e')],_0x1b10e4[_0x24b046][_0x3e20('0x4f')])){manager[_0x3e20('0x50')](_0x24b046,_0x1b10e4[_0x24b046][_0x3e20('0x4b')],handleJob(_0x1b10e4[_0x24b046]));manager[_0x3e20('0x51')](_0x24b046);logger[_0x3e20('0x8')](_0x3e20('0x52'),_0x1b10e4[_0x24b046][_0x3e20('0x16')],_0x1b10e4[_0x24b046]['cron']);}else if(manager[_0x3e20('0x44')](_0x24b046)){manager['stop'](_0x24b046);manager['deleteJob'](_0x24b046);logger[_0x3e20('0x8')](_0x3e20('0x53'),_0x1b10e4[_0x24b046][_0x3e20('0x16')],_0x1b10e4[_0x24b046]['cron']);}}for(_0x269de6=0x0,_0x24b046;_0x269de6<_0x40468d['length']&&!_0x4ff1f7;_0x269de6+=0x1){_0x24b046=_0x40468d[_0x269de6][_0x3e20('0x3f')]();if(manager[_0x3e20('0x44')](_0x24b046)){if(_0x1b10e4[_0x24b046][_0x3e20('0x4b')]&&_0x1b10e4[_0x24b046][_0x3e20('0x4c')]&&moment()[_0x3e20('0x4d')](_0x1b10e4[_0x24b046][_0x3e20('0x4e')],_0x1b10e4[_0x24b046][_0x3e20('0x4f')])){manager[_0x3e20('0x54')](_0x24b046,_0x1b10e4[_0x24b046][_0x3e20('0x4b')],handleJob(_0x1b10e4[_0x24b046]));logger[_0x3e20('0x8')]('update\x20cron',_0x1b10e4[_0x24b046][_0x3e20('0x16')],_0x1b10e4[_0x24b046]['cron']);}else{manager[_0x3e20('0x45')](_0x24b046);manager[_0x3e20('0x46')](_0x24b046);logger[_0x3e20('0x8')](_0x3e20('0x53'),_0x1b10e4[_0x24b046][_0x3e20('0x16')],_0x1b10e4[_0x24b046][_0x3e20('0x4b')]);}}}})[_0x3e20('0x2c')](function(_0x5183e6){logger['error'](JSON[_0x3e20('0x27')](_0x5183e6));});}exports[_0x3e20('0x55')]=function(_0x3da418){return getJobs(_0x3da418);};exports[_0x3e20('0x51')]=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file +var _0xe4ee=['resolve','run\x20job','cron','active','isBetween','startAt','endAt','add','start','exists','stop\x20cron','update','run','util','moment','cron-job-manager','jayson/promise','bluebird','schedule','../../mysqldb','../../api/analyticCustomReport/analyticCustomReport.controller','http','info','Try\x20to\x20send\x20a\x20mail\x20to','Smtp','service','MailAccount','host','port','secure','authentication','auth','user','format','\x22%s\x22\x20<%s>','name','email','bcc','Report\x20%s\x20last\x20%s\x20%s','subtractUnit','join','../../files/reports','savename','%s.%s','extname','zip','status','message','text','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','stringify','existsSync','Sent','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','sendIfEmpty','request','then','error','email\x20sent','catch','error\x20mail','isNil','subtractNumber','subtractNumber\x20null\x20or\x20undefined','subtractUnit\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','DefaultReportId','exec\x20defaul\x20report\x20id:%s','runReport','CustomReportId','no\x20report\x20id','findAll','keys','map','toString','keyBy','difference','length','stop','deleteJob','index'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0xe4ee,0x1b1));var _0xee4e=function(_0x514da9,_0x5f012a){_0x514da9=_0x514da9-0x0;var _0x291ff1=_0xe4ee[_0x514da9];return _0x291ff1;};'use strict';var fs=require('fs');var util=require(_0xee4e('0x0'));var path=require('path');var _=require('lodash');var moment=require(_0xee4e('0x1'));var CronJobManager=require(_0xee4e('0x2'));var jayson=require(_0xee4e('0x3'));var BPromise=require(_0xee4e('0x4'));var logger=require('../logger')(_0xee4e('0x5'));var db=require(_0xee4e('0x6'))['db'];var analyticCustomReportController=require(_0xee4e('0x7'));var analyticDefaultReportController=require('../../api/analyticDefaultReport/analyticDefaultReport.controller');var client=jayson['client'][_0xee4e('0x8')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x5a5ca3,_0x5e3476){return function(){logger[_0xee4e('0x9')](_0xee4e('0xa'),_0x5a5ca3['email']);var _0x3a99da=!![];var _0x48fb42={'tls':{'rejectUnauthorized':![]}};if(_0x5a5ca3['MailAccount'][_0xee4e('0xb')]['service']){_0x48fb42[_0xee4e('0xc')]=_0x5a5ca3[_0xee4e('0xd')][_0xee4e('0xb')]['service'];}else{_0x48fb42['host']=_0x5a5ca3['MailAccount'][_0xee4e('0xb')][_0xee4e('0xe')];_0x48fb42[_0xee4e('0xf')]=_0x5a5ca3[_0xee4e('0xd')]['Smtp'][_0xee4e('0xf')];_0x48fb42[_0xee4e('0x10')]=_0x5a5ca3[_0xee4e('0xd')]['Smtp'][_0xee4e('0x10')];}if(_0x5a5ca3['MailAccount'][_0xee4e('0xb')][_0xee4e('0x11')]){_0x48fb42[_0xee4e('0x12')]={'user':_0x5a5ca3[_0xee4e('0xd')][_0xee4e('0xb')][_0xee4e('0x13')],'pass':_0x5a5ca3[_0xee4e('0xd')]['Smtp']['pass']};}var _0x18e046={'account':_0x48fb42,'message':{'from':util[_0xee4e('0x14')](_0xee4e('0x15'),_0x5a5ca3[_0xee4e('0xd')][_0xee4e('0x16')],_0x5a5ca3['MailAccount'][_0xee4e('0x17')]||_0x5a5ca3[_0xee4e('0xd')][_0xee4e('0xb')][_0xee4e('0x13')]),'to':_0x5a5ca3[_0xee4e('0x17')],'cc':_0x5a5ca3['cc'],'bcc':_0x5a5ca3[_0xee4e('0x18')],'subject':util[_0xee4e('0x14')](_0xee4e('0x19'),_0x5e3476['name'],_0x5a5ca3['subtractNumber'],_0x5a5ca3[_0xee4e('0x1a')])}};var _0x3da591=path[_0xee4e('0x1b')](__dirname,_0xee4e('0x1c'));var _0x23820c=_0x5e3476[_0xee4e('0x1d')];var _0x29cd72=util[_0xee4e('0x14')](_0xee4e('0x1e'),path['basename'](_0x5e3476['savename'],path[_0xee4e('0x1f')](_0x5e3476[_0xee4e('0x1d')])),_0xee4e('0x20'));var _0x3e2218=path['join'](_0x3da591,_0x23820c);var _0x3b547d=path[_0xee4e('0x1b')](_0x3da591,_0x29cd72);if(fs['existsSync'](_0x3e2218)){_0x5e3476[_0xee4e('0x21')]='Sent';_0x18e046['message']['attachments']=[{'filename':_0x23820c,'path':_0x3e2218}];_0x18e046[_0xee4e('0x22')][_0xee4e('0x23')]=util[_0xee4e('0x14')](_0xee4e('0x24'),JSON[_0xee4e('0x25')](_0x5e3476,null,0x2));}else if(fs[_0xee4e('0x26')](_0x3b547d)){_0x5e3476[_0xee4e('0x21')]=_0xee4e('0x27');_0x18e046[_0xee4e('0x22')]['attachments']=[{'filename':_0x29cd72,'path':_0x3b547d}];}else{_0x18e046[_0xee4e('0x22')][_0xee4e('0x23')]=_0xee4e('0x28');if(!_0x5a5ca3[_0xee4e('0x29')]){_0x3a99da=![];logger[_0xee4e('0x9')]('empty\x20file,\x20email\x20not\x20sent');}}if(_0x3a99da){return client[_0xee4e('0x2a')]('SendMail',_0x18e046)[_0xee4e('0x2b')](function(_0x2dc2e9){if(_0x2dc2e9[_0xee4e('0x2c')]){return logger[_0xee4e('0x2c')]('error\x20mail',JSON['stringify'](_0x2dc2e9));}return logger[_0xee4e('0x9')](_0xee4e('0x2d'));})[_0xee4e('0x2e')](function(_0x79f7ec){return logger['error'](_0xee4e('0x2f'),JSON['stringify'](_0x79f7ec));});}};}function handleError(){return function(_0xe4fcc8){return logger[_0xee4e('0x2c')](JSON[_0xee4e('0x25')](_0xe4fcc8));};}function handleResult(_0x1afcfa){return function(_0x10fc35){logger[_0xee4e('0x9')]('data',JSON[_0xee4e('0x25')](_0x10fc35));if(_0x1afcfa['MailAccount']&&_0x1afcfa[_0xee4e('0xd')][_0xee4e('0xb')]&&!_[_0xee4e('0x30')](_0x1afcfa[_0xee4e('0x17')])){setTimeout(handleSendEmail(_0x1afcfa,_0x10fc35),0x3c*0x3e8);}};}function handleJob(_0x5f4787){return function(){try{if(_[_0xee4e('0x30')](_0x5f4787[_0xee4e('0x31')])){return logger['info'](_0xee4e('0x32'));}if(_['isNil'](_0x5f4787[_0xee4e('0x1a')])){return logger[_0xee4e('0x9')](_0xee4e('0x33'));}var _0x3d671f={'startDate':moment()[_0xee4e('0x34')](_0x5f4787['subtractNumber'],_0x5f4787['subtractUnit'])[_0xee4e('0x14')](_0xee4e('0x35')),'endDate':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'type':_0xee4e('0x36'),'output':_0x5f4787[_0xee4e('0x37')],'name':_0x5f4787[_0xee4e('0x16')]};if(!_['isNil'](_0x5f4787[_0xee4e('0x38')])){logger[_0xee4e('0x9')](_0xee4e('0x39'),_0x5f4787[_0xee4e('0x38')]);return analyticDefaultReportController[_0xee4e('0x3a')]({'id':_0x5f4787[_0xee4e('0x38')]},_0x3d671f)['then'](handleResult(_0x5f4787))[_0xee4e('0x2e')](handleError());}if(!_[_0xee4e('0x30')](_0x5f4787[_0xee4e('0x3b')])){logger['info']('exec\x20custom\x20report\x20id:%s',_0x5f4787[_0xee4e('0x3b')]);return analyticCustomReportController[_0xee4e('0x3a')]({'id':_0x5f4787['CustomReportId']},_0x3d671f)[_0xee4e('0x2b')](handleResult(_0x5f4787))['catch'](handleError());}}catch(_0x3a4296){logger[_0xee4e('0x2c')](JSON[_0xee4e('0x25')](_0x3a4296));}return logger[_0xee4e('0x9')](_0xee4e('0x3c'));};}function getJobs(_0x241a12){var _0x27edeb={};if(_0x241a12){_0x27edeb['id']=_0x241a12;}return db['Schedule'][_0xee4e('0x3d')]({'where':_0x27edeb,'include':[{'model':db[_0xee4e('0xd')],'attributes':['id',_0xee4e('0x16'),_0xee4e('0x17')],'include':[{'model':db['MailServerOut'],'as':'Smtp'}]}]})[_0xee4e('0x2b')](function(_0x4fca5b){var _0x2ce4b5=_[_0xee4e('0x3e')](manager['jobs']);var _0x4a7227=_[_0xee4e('0x3f')](_0x4fca5b,function(_0x5302ef){return _0x5302ef['id'][_0xee4e('0x40')]();});var _0x540aa8=_[_0xee4e('0x41')](_0x4fca5b,function(_0x266768){return _0x266768['id'][_0xee4e('0x40')]();});var _0x4f17be=_0x241a12?_0x4a7227:_[_0xee4e('0x42')](_0x4a7227,_0x2ce4b5);var _0x385827=_['intersection'](_0x4a7227,_0x2ce4b5);var _0x1a36c7=_[_0xee4e('0x42')](_0x2ce4b5,_0x4a7227);var _0x2ba028;var _0x2f841b;for(_0x2ba028=0x0;_0x2ba028<_0x1a36c7[_0xee4e('0x43')]&&!_0x241a12;_0x2ba028+=0x1){_0x2f841b=_0x1a36c7[_0x2ba028][_0xee4e('0x40')]();if(manager['exists'](_0x2f841b)){manager[_0xee4e('0x44')](_0x2f841b);manager[_0xee4e('0x45')](_0x2f841b);logger[_0xee4e('0x9')]('delete\x20cron',_0x2f841b);}}logger['info']('toRun',JSON[_0xee4e('0x25')](_0x4f17be));for(_0x2ba028=0x0;_0x2ba028<_0x4f17be['length'];_0x2ba028+=0x1){_0x2f841b=_0x4f17be[_0x2ba028]['toString']();logger[_0xee4e('0x9')](_0xee4e('0x46'),_0x2f841b);if(_0x241a12){logger[_0xee4e('0x9')]('my\x20id',_0x241a12);logger[_0xee4e('0x9')](JSON[_0xee4e('0x25')](_0x540aa8[_0x2f841b]));BPromise[_0xee4e('0x47')]()[_0xee4e('0x2b')](handleJob(_0x540aa8[_0x2f841b]));logger[_0xee4e('0x9')](_0xee4e('0x48'),_0x540aa8[_0x2f841b][_0xee4e('0x16')],_0x540aa8[_0x2f841b][_0xee4e('0x49')]);}else if(_0x540aa8[_0x2f841b]['cron']&&_0x540aa8[_0x2f841b][_0xee4e('0x4a')]&&moment()[_0xee4e('0x4b')](_0x540aa8[_0x2f841b][_0xee4e('0x4c')],_0x540aa8[_0x2f841b][_0xee4e('0x4d')])){manager[_0xee4e('0x4e')](_0x2f841b,_0x540aa8[_0x2f841b][_0xee4e('0x49')],handleJob(_0x540aa8[_0x2f841b]));manager[_0xee4e('0x4f')](_0x2f841b);logger['info']('add\x20cron',_0x540aa8[_0x2f841b]['name'],_0x540aa8[_0x2f841b][_0xee4e('0x49')]);}else if(manager[_0xee4e('0x50')](_0x2f841b)){manager['stop'](_0x2f841b);manager[_0xee4e('0x45')](_0x2f841b);logger[_0xee4e('0x9')](_0xee4e('0x51'),_0x540aa8[_0x2f841b][_0xee4e('0x16')],_0x540aa8[_0x2f841b]['cron']);}}for(_0x2ba028=0x0,_0x2f841b;_0x2ba028<_0x385827[_0xee4e('0x43')]&&!_0x241a12;_0x2ba028+=0x1){_0x2f841b=_0x385827[_0x2ba028]['toString']();if(manager[_0xee4e('0x50')](_0x2f841b)){if(_0x540aa8[_0x2f841b][_0xee4e('0x49')]&&_0x540aa8[_0x2f841b][_0xee4e('0x4a')]&&moment()[_0xee4e('0x4b')](_0x540aa8[_0x2f841b][_0xee4e('0x4c')],_0x540aa8[_0x2f841b][_0xee4e('0x4d')])){manager[_0xee4e('0x52')](_0x2f841b,_0x540aa8[_0x2f841b][_0xee4e('0x49')],handleJob(_0x540aa8[_0x2f841b]));logger[_0xee4e('0x9')]('update\x20cron',_0x540aa8[_0x2f841b][_0xee4e('0x16')],_0x540aa8[_0x2f841b][_0xee4e('0x49')]);}else{manager['stop'](_0x2f841b);manager[_0xee4e('0x45')](_0x2f841b);logger[_0xee4e('0x9')]('stop\x20cron',_0x540aa8[_0x2f841b][_0xee4e('0x16')],_0x540aa8[_0x2f841b][_0xee4e('0x49')]);}}}})[_0xee4e('0x2e')](function(_0x3a912d){logger[_0xee4e('0x2c')](JSON[_0xee4e('0x25')](_0x3a912d));});}exports[_0xee4e('0x53')]=function(_0x2f30ab){return getJobs(_0x2f30ab);};exports[_0xee4e('0x4f')]=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file diff --git a/server/config/schedule/transcribe.js b/server/config/schedule/transcribe.js index 6a3b6a5..393221c 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 _0x3423=['[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','Sequelize','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentAccountId','sentimentRegion','bucket','ValidationError','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','findOne','then','Cloud\x20Provider\x20not\x20available','data2','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','language','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','SentimentScore','Positive','Negative','Mixed','Neutral','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','CloudProvider','name','SequelizeValidationError','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','VoiceRecording','findAll','Settings\x20not\x20available','Transcribe\x20not\x20configured','transcribeAccountId','forEach','push','error','start','request-promise','util','bluebird','../../mysqldb','../../config/logger','transcribe','TranscribeService','getTranscriptionJob','detectSentiment','substring','info','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data1','transcribeRegion','TranscriptionJob','TranscriptionJobStatus','fileText','COMPLETED','Transcript','TranscriptFileUri','[RECORDING:%d]\x20Get\x20transcript','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','update'];(function(_0x4bc0bd,_0x5d7b4e){var _0x4520f0=function(_0x212d89){while(--_0x212d89){_0x4bc0bd['push'](_0x4bc0bd['shift']());}};_0x4520f0(++_0x5d7b4e);}(_0x3423,0x188));var _0x3342=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3423[_0x3dd15e];return _0x231fd0;};var _=require('lodash');var AWS=require('aws-sdk');var rp=require(_0x3342('0x0'));var util=require(_0x3342('0x1'));var BPromise=require(_0x3342('0x2'));var db=require(_0x3342('0x3'))['db'];var logger=require(_0x3342('0x4'))(_0x3342('0x5'));function getTranscriptionJob(_0x2207ce,_0x3c5d8d,_0x3075f8,_0x19206f){return new Promise(function(_0x467453,_0x2ccbe0){var _0x29c40c=new AWS[(_0x3342('0x6'))]({'accessKeyId':_0x3c5d8d,'secretAccessKey':_0x2207ce,'region':_0x3075f8});_0x29c40c[_0x3342('0x7')]({'TranscriptionJobName':_0x19206f},function(_0xce08ab,_0x305d13){if(_0xce08ab){return _0x2ccbe0(_0xce08ab);}else{return _0x467453(_0x305d13);}});});}function sentiment(_0xd9d129,_0x9cc419,_0x4ae4f3,_0x582c37,_0x2d0cb0){return new Promise(function(_0x481a17,_0x5a1fba){var _0x51b276=new AWS['Comprehend']({'accessKeyId':_0x9cc419,'secretAccessKey':_0xd9d129,'region':_0x4ae4f3});_0x51b276[_0x3342('0x8')]({'Text':_0x582c37,'LanguageCode':_0x2d0cb0[_0x3342('0x9')](0x0,0x2)},function(_0x51496d,_0x2d14c4){if(_0x51496d){return _0x5a1fba(_0x51496d);}else{return _0x481a17(_0x2d14c4);}});});}function checkTranscribeJob(_0x5a3cb1,_0x716d80,_0x36e1f4){var _0x592ba8;return new BPromise(function(_0x3e418d,_0x334f0e){logger[_0x3342('0xa')](util[_0x3342('0xb')](_0x3342('0xc'),_0x5a3cb1['id'],_0x5a3cb1[_0x3342('0xd')]));return getTranscriptionJob(_0x36e1f4[_0x3342('0xe')],_0x36e1f4['data2'],_0x716d80[_0x3342('0xf')],_0x5a3cb1[_0x3342('0xd')])['then'](function(_0x40d609){logger[_0x3342('0xa')](util['format']('[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s',_0x5a3cb1['id'],_0x5a3cb1[_0x3342('0xd')],_0x40d609[_0x3342('0x10')][_0x3342('0x11')]));if(!_0x5a3cb1[_0x3342('0x12')]){switch(_0x40d609[_0x3342('0x10')][_0x3342('0x11')]){case _0x3342('0x13'):var _0x3ebf6b={'transcribeStatus':_0x40d609[_0x3342('0x10')]['TranscriptionJobStatus'],'fileUri':_0x40d609[_0x3342('0x10')][_0x3342('0x14')][_0x3342('0x15')]};logger['info'](util[_0x3342('0xb')](_0x3342('0x16'),_0x5a3cb1['id']));return rp({'uri':_0x40d609['TranscriptionJob'][_0x3342('0x14')][_0x3342('0x15')],'json':!![]})['then'](function(_0x4e1b19){logger['info'](util[_0x3342('0xb')](_0x3342('0x17'),_0x5a3cb1['id']));if(_0x4e1b19&&_0x4e1b19[_0x3342('0x18')]&&_0x4e1b19[_0x3342('0x18')][_0x3342('0x19')]&&_0x4e1b19[_0x3342('0x18')][_0x3342('0x19')][_0x3342('0x1a')]){_0x3ebf6b['fileText']='';for(var _0x30ffc9=0x0;_0x30ffc9<_0x4e1b19['results']['transcripts'][_0x3342('0x1a')];_0x30ffc9++){_0x3ebf6b['fileText']+=_0x4e1b19['results'][_0x3342('0x19')][_0x30ffc9]['transcript']+'';}}return _0x5a3cb1[_0x3342('0x1b')](_0x3ebf6b);})['then'](function(){logger['info'](util['format'](_0x3342('0x1c'),_0x5a3cb1['id']));if(!_0x5a3cb1[_0x3342('0x1d')]){throw new db[(_0x3342('0x1e'))]['ValidationError'](_0x3342('0x1f'));}if(!_0x716d80[_0x3342('0x20')]||!_0x716d80[_0x3342('0x21')]||!_0x716d80[_0x3342('0x22')]||!_0x716d80['language']||!_0x716d80[_0x3342('0x23')]){throw new db[(_0x3342('0x1e'))][(_0x3342('0x24'))](_0x3342('0x25'));}if(!_0x3ebf6b[_0x3342('0x12')]){throw new Error(_0x3342('0x26'));}if(_0x716d80[_0x3342('0x21')]===_0x36e1f4['id']){return _0x36e1f4;}else{return db['CloudProvider'][_0x3342('0x27')]({'where':{'id':_settings['sentimentAccountId']}});}})[_0x3342('0x28')](function(_0x407f8c){if(!_0x407f8c){throw new db['Sequelize'][(_0x3342('0x24'))](_0x3342('0x29'));}if(!_0x407f8c[_0x3342('0xe')]||!_0x407f8c[_0x3342('0x2a')]){throw new db['Sequelize'][(_0x3342('0x24'))](_0x3342('0x2b'));}_0x592ba8=_0x407f8c;logger[_0x3342('0xa')](util[_0x3342('0xb')](_0x3342('0x2c'),_0x5a3cb1['id']));return sentiment(_0x592ba8[_0x3342('0xe')],_0x592ba8[_0x3342('0x2a')],_0x716d80[_0x3342('0x22')],_0x3ebf6b[_0x3342('0x12')],_0x716d80[_0x3342('0x2d')]);})[_0x3342('0x28')](function(_0x30dcea){logger['info'](util['format'](_0x3342('0x2e'),_0x5a3cb1['id']));return _0x5a3cb1['update']({'sentiment':_0x30dcea[_0x3342('0x2f')],'sPositive':_0x30dcea[_0x3342('0x30')][_0x3342('0x31')],'sNegative':_0x30dcea[_0x3342('0x30')][_0x3342('0x32')],'sMixed':_0x30dcea[_0x3342('0x30')][_0x3342('0x33')],'sNeutral':_0x30dcea['SentimentScore'][_0x3342('0x34')]});})[_0x3342('0x28')](function(){logger[_0x3342('0xa')](util[_0x3342('0xb')](_0x3342('0x1c'),_0x5a3cb1['id']));_0x3e418d();});case'FAILED':return _0x5a3cb1[_0x3342('0x1b')]({'transcribeStatus':'FAILED','failureReason':_0x40d609[_0x3342('0x10')][_0x3342('0x35')]})[_0x3342('0x28')](function(){logger[_0x3342('0xa')](util['format'](_0x3342('0x1c'),_0x5a3cb1['id']));_0x3e418d();});default:logger['info'](util[_0x3342('0xb')](_0x3342('0x36'),_0x5a3cb1['id']));break;}}else{return BPromise[_0x3342('0x37')]()[_0x3342('0x28')](function(){if(!_0x5a3cb1[_0x3342('0x1d')]){throw new db[(_0x3342('0x1e'))][(_0x3342('0x24'))]('Sentiment\x20Analysis\x20not\x20requested');}if(!_0x716d80[_0x3342('0x20')]||!_0x716d80[_0x3342('0x21')]||!_0x716d80['sentimentRegion']||!_0x716d80[_0x3342('0x2d')]||!_0x716d80[_0x3342('0x23')]){throw new db['Sequelize'][(_0x3342('0x24'))](_0x3342('0x25'));}if(!_0x5a3cb1['fileText']){throw new Error('Transcript\x20not\x20available');}if(_0x716d80['sentimentAccountId']===_0x36e1f4['id']){return _0x36e1f4;}else{return db[_0x3342('0x38')][_0x3342('0x27')]({'where':{'id':_settings['sentimentAccountId']}});}})[_0x3342('0x28')](function(_0x2a1f7e){if(!_0x2a1f7e){throw new db[(_0x3342('0x1e'))][(_0x3342('0x24'))](_0x3342('0x29'));}if(!_0x2a1f7e[_0x3342('0xe')]||!_0x2a1f7e[_0x3342('0x2a')]){throw new db[(_0x3342('0x1e'))]['ValidationError']('Cloud\x20Provider\x20not\x20configured');}_0x592ba8=_0x2a1f7e;logger[_0x3342('0xa')](util[_0x3342('0xb')](_0x3342('0x2c'),_0x5a3cb1['id']));return sentiment(_0x592ba8[_0x3342('0xe')],_0x592ba8[_0x3342('0x2a')],_0x716d80[_0x3342('0x22')],_0x5a3cb1['fileText'],_0x716d80[_0x3342('0x2d')]);})[_0x3342('0x28')](function(_0x283ce9){logger[_0x3342('0xa')](util[_0x3342('0xb')](_0x3342('0x2e'),_0x5a3cb1['id']));return _0x5a3cb1['update']({'sentiment':_0x283ce9[_0x3342('0x2f')],'sPositive':_0x283ce9['SentimentScore'][_0x3342('0x31')],'sNegative':_0x283ce9[_0x3342('0x30')][_0x3342('0x32')],'sMixed':_0x283ce9[_0x3342('0x30')]['Mixed'],'sNeutral':_0x283ce9[_0x3342('0x30')][_0x3342('0x34')],'transcribeStatus':'COMPLETED'});})[_0x3342('0x28')](function(){logger[_0x3342('0xa')](util[_0x3342('0xb')](_0x3342('0x1c'),_0x5a3cb1['id']));_0x3e418d();});}})['catch'](function(_0x2e2ebc){if(_0x2e2ebc){if(!_0x2e2ebc[_0x3342('0x39')]||_0x2e2ebc['name']!==_0x3342('0x3a')){logger['error'](util['format'](_0x3342('0x3b'),_0x5a3cb1['id']),util[_0x3342('0x3c')](_0x2e2ebc,{'showHidden':![],'depth':null}));}}_0x3e418d();});});}function checkTranscribe(){var _0x346534;var _0x296cbb;var _0x23925e;return db[_0x3342('0x3d')][_0x3342('0x3e')]({'where':{'transcribeStatus':'IN_PROGRESS'}})['then'](function(_0x3817fd){if(!_0x3817fd||!_0x3817fd['length']){throw new db[(_0x3342('0x1e'))]['ValidationError']('No\x20transcribe\x20job\x20to\x20check');}_0x346534=_0x3817fd;return db['Setting'][_0x3342('0x27')]({'where':{'id':0x1}});})[_0x3342('0x28')](function(_0x29ccb6){if(!_0x29ccb6){throw new db[(_0x3342('0x1e'))]['ValidationError'](_0x3342('0x3f'));}_0x296cbb=_0x29ccb6;if(!_0x296cbb[_0x3342('0x5')]||!_0x296cbb['transcribeAccountId']||!_0x296cbb[_0x3342('0xf')]||!_0x296cbb[_0x3342('0x2d')]||!_0x296cbb[_0x3342('0x23')]){throw new db['Sequelize'][(_0x3342('0x24'))](_0x3342('0x40'));}return db[_0x3342('0x38')][_0x3342('0x27')]({'where':{'id':_0x296cbb[_0x3342('0x41')]}});})['then'](function(_0x2699d2){if(!_0x2699d2){throw new db[(_0x3342('0x1e'))][(_0x3342('0x24'))](_0x3342('0x29'));}if(!_0x2699d2[_0x3342('0xe')]||!_0x2699d2[_0x3342('0x2a')]){throw new db[(_0x3342('0x1e'))][(_0x3342('0x24'))](_0x3342('0x2b'));}_0x23925e=_0x2699d2;var _0x542181=[];_0x346534[_0x3342('0x42')](function(_0x4eebaa){_0x542181[_0x3342('0x43')](checkTranscribeJob(_0x4eebaa,_0x296cbb,_0x23925e));});return BPromise['all'](_0x542181);})['catch'](function(_0x5bff74){if(_0x5bff74){if(!_0x5bff74['name']||_0x5bff74[_0x3342('0x39')]!==_0x3342('0x3a')){logger[_0x3342('0x44')](util[_0x3342('0x3c')](_0x5bff74,{'showHidden':![],'depth':null}));}}});}exports[_0x3342('0x45')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file +var _0x06ef=['TranscriptFileUri','results','transcripts','length','update','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','Sequelize','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentAccountId','sentimentRegion','bucket','Transcript\x20not\x20available','CloudProvider','findOne','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','language','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','SentimentScore','Negative','Mixed','Neutral','FAILED','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','tempSentiment','Sentiment\x20Analysis\x20not\x20configured','Cloud\x20Provider\x20not\x20available','Positive','catch','name','SequelizeValidationError','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','VoiceRecording','findAll','No\x20transcribe\x20job\x20to\x20check','Setting','Settings\x20not\x20available','transcribeAccountId','forEach','push','all','start','request-promise','transcribe','Comprehend','detectSentiment','substring','info','data1','data2','transcribeRegion','then','format','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','transcribeName','TranscriptionJob','fileText','TranscriptionJobStatus','COMPLETED','[RECORDING:%d]\x20Get\x20transcript','Transcript'];(function(_0x3e90f1,_0x1f5e33){var _0x477616=function(_0x236d57){while(--_0x236d57){_0x3e90f1['push'](_0x3e90f1['shift']());}};_0x477616(++_0x1f5e33);}(_0x06ef,0x185));var _0xf06e=function(_0x46c38d,_0x4c23b7){_0x46c38d=_0x46c38d-0x0;var _0x1e04b8=_0x06ef[_0x46c38d];return _0x1e04b8;};var _=require('lodash');var AWS=require('aws-sdk');var rp=require(_0xf06e('0x0'));var util=require('util');var BPromise=require('bluebird');var db=require('../../mysqldb')['db'];var logger=require('../../config/logger')(_0xf06e('0x1'));function getTranscriptionJob(_0x1281ca,_0x16d4da,_0x569390,_0x1ddeff){return new Promise(function(_0x71a36,_0x4be428){var _0x59b74b=new AWS['TranscribeService']({'accessKeyId':_0x16d4da,'secretAccessKey':_0x1281ca,'region':_0x569390});_0x59b74b['getTranscriptionJob']({'TranscriptionJobName':_0x1ddeff},function(_0x4ccbee,_0x25b56e){if(_0x4ccbee){return _0x4be428(_0x4ccbee);}else{return _0x71a36(_0x25b56e);}});});}function sentiment(_0x3ee37d,_0x1e1ec5,_0x2bb08c,_0xbb0e3c,_0x5e594e){return new Promise(function(_0x1fe49b,_0x3a33c1){var _0x4e3591=new AWS[(_0xf06e('0x2'))]({'accessKeyId':_0x1e1ec5,'secretAccessKey':_0x3ee37d,'region':_0x2bb08c});_0x4e3591[_0xf06e('0x3')]({'Text':_0xbb0e3c,'LanguageCode':_0x5e594e[_0xf06e('0x4')](0x0,0x2)},function(_0x400af5,_0x39979a){if(_0x400af5){return _0x3a33c1(_0x400af5);}else{return _0x1fe49b(_0x39979a);}});});}function checkTranscribeJob(_0x7b4c4,_0x49fe5d,_0x3daa50){var _0x2578e4;return new BPromise(function(_0x5c36b3,_0x1510a0){logger[_0xf06e('0x5')](util['format']('[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)',_0x7b4c4['id'],_0x7b4c4['transcribeName']));return getTranscriptionJob(_0x3daa50[_0xf06e('0x6')],_0x3daa50[_0xf06e('0x7')],_0x49fe5d[_0xf06e('0x8')],_0x7b4c4['transcribeName'])[_0xf06e('0x9')](function(_0x375f90){logger[_0xf06e('0x5')](util[_0xf06e('0xa')](_0xf06e('0xb'),_0x7b4c4['id'],_0x7b4c4[_0xf06e('0xc')],_0x375f90[_0xf06e('0xd')]['TranscriptionJobStatus']));if(!_0x7b4c4[_0xf06e('0xe')]){switch(_0x375f90[_0xf06e('0xd')][_0xf06e('0xf')]){case _0xf06e('0x10'):var _0x5c1a80={'transcribeStatus':_0x375f90['TranscriptionJob'][_0xf06e('0xf')],'fileUri':_0x375f90[_0xf06e('0xd')]['Transcript']['TranscriptFileUri']};logger[_0xf06e('0x5')](util[_0xf06e('0xa')](_0xf06e('0x11'),_0x7b4c4['id']));return rp({'uri':_0x375f90['TranscriptionJob'][_0xf06e('0x12')][_0xf06e('0x13')],'json':!![]})['then'](function(_0x3c3796){logger[_0xf06e('0x5')](util[_0xf06e('0xa')]('[RECORDING:%d]\x20Transcript\x20downloaded',_0x7b4c4['id']));if(_0x3c3796&&_0x3c3796[_0xf06e('0x14')]&&_0x3c3796[_0xf06e('0x14')][_0xf06e('0x15')]&&_0x3c3796[_0xf06e('0x14')][_0xf06e('0x15')]['length']){_0x5c1a80[_0xf06e('0xe')]='';for(var _0x4923d3=0x0;_0x4923d3<_0x3c3796[_0xf06e('0x14')][_0xf06e('0x15')][_0xf06e('0x16')];_0x4923d3++){_0x5c1a80[_0xf06e('0xe')]+=_0x3c3796[_0xf06e('0x14')][_0xf06e('0x15')][_0x4923d3]['transcript']+'';}}return _0x7b4c4[_0xf06e('0x17')](_0x5c1a80);})[_0xf06e('0x9')](function(){logger[_0xf06e('0x5')](util[_0xf06e('0xa')](_0xf06e('0x18'),_0x7b4c4['id']));if(!_0x7b4c4['tempSentiment']){throw new db[(_0xf06e('0x19'))][(_0xf06e('0x1a'))](_0xf06e('0x1b'));}if(!_0x49fe5d[_0xf06e('0x1c')]||!_0x49fe5d[_0xf06e('0x1d')]||!_0x49fe5d[_0xf06e('0x1e')]||!_0x49fe5d['language']||!_0x49fe5d[_0xf06e('0x1f')]){throw new db[(_0xf06e('0x19'))][(_0xf06e('0x1a'))]('Sentiment\x20Analysis\x20not\x20configured');}if(!_0x5c1a80[_0xf06e('0xe')]){throw new Error(_0xf06e('0x20'));}if(_0x49fe5d[_0xf06e('0x1d')]===_0x3daa50['id']){return _0x3daa50;}else{return db[_0xf06e('0x21')][_0xf06e('0x22')]({'where':{'id':_settings[_0xf06e('0x1d')]}});}})[_0xf06e('0x9')](function(_0x2c19a5){if(!_0x2c19a5){throw new db[(_0xf06e('0x19'))]['ValidationError']('Cloud\x20Provider\x20not\x20available');}if(!_0x2c19a5[_0xf06e('0x6')]||!_0x2c19a5[_0xf06e('0x7')]){throw new db['Sequelize'][(_0xf06e('0x1a'))](_0xf06e('0x23'));}_0x2578e4=_0x2c19a5;logger[_0xf06e('0x5')](util[_0xf06e('0xa')](_0xf06e('0x24'),_0x7b4c4['id']));return sentiment(_0x2578e4[_0xf06e('0x6')],_0x2578e4['data2'],_0x49fe5d[_0xf06e('0x1e')],_0x5c1a80[_0xf06e('0xe')],_0x49fe5d[_0xf06e('0x25')]);})['then'](function(_0x109218){logger[_0xf06e('0x5')](util[_0xf06e('0xa')](_0xf06e('0x26'),_0x7b4c4['id']));return _0x7b4c4[_0xf06e('0x17')]({'sentiment':_0x109218[_0xf06e('0x27')],'sPositive':_0x109218[_0xf06e('0x28')]['Positive'],'sNegative':_0x109218['SentimentScore'][_0xf06e('0x29')],'sMixed':_0x109218['SentimentScore'][_0xf06e('0x2a')],'sNeutral':_0x109218['SentimentScore'][_0xf06e('0x2b')]});})['then'](function(){logger[_0xf06e('0x5')](util[_0xf06e('0xa')](_0xf06e('0x18'),_0x7b4c4['id']));_0x5c36b3();});case _0xf06e('0x2c'):return _0x7b4c4[_0xf06e('0x17')]({'transcribeStatus':_0xf06e('0x2c'),'failureReason':_0x375f90['TranscriptionJob'][_0xf06e('0x2d')]})[_0xf06e('0x9')](function(){logger[_0xf06e('0x5')](util[_0xf06e('0xa')](_0xf06e('0x18'),_0x7b4c4['id']));_0x5c36b3();});default:logger[_0xf06e('0x5')](util[_0xf06e('0xa')](_0xf06e('0x2e'),_0x7b4c4['id']));break;}}else{return BPromise[_0xf06e('0x2f')]()[_0xf06e('0x9')](function(){if(!_0x7b4c4[_0xf06e('0x30')]){throw new db['Sequelize'][(_0xf06e('0x1a'))](_0xf06e('0x1b'));}if(!_0x49fe5d[_0xf06e('0x1c')]||!_0x49fe5d[_0xf06e('0x1d')]||!_0x49fe5d[_0xf06e('0x1e')]||!_0x49fe5d[_0xf06e('0x25')]||!_0x49fe5d[_0xf06e('0x1f')]){throw new db['Sequelize'][(_0xf06e('0x1a'))](_0xf06e('0x31'));}if(!_0x7b4c4['fileText']){throw new Error('Transcript\x20not\x20available');}if(_0x49fe5d[_0xf06e('0x1d')]===_0x3daa50['id']){return _0x3daa50;}else{return db[_0xf06e('0x21')][_0xf06e('0x22')]({'where':{'id':_settings[_0xf06e('0x1d')]}});}})[_0xf06e('0x9')](function(_0x410772){if(!_0x410772){throw new db['Sequelize']['ValidationError'](_0xf06e('0x32'));}if(!_0x410772['data1']||!_0x410772['data2']){throw new db['Sequelize'][(_0xf06e('0x1a'))](_0xf06e('0x23'));}_0x2578e4=_0x410772;logger['info'](util['format'](_0xf06e('0x24'),_0x7b4c4['id']));return sentiment(_0x2578e4[_0xf06e('0x6')],_0x2578e4['data2'],_0x49fe5d[_0xf06e('0x1e')],_0x7b4c4['fileText'],_0x49fe5d[_0xf06e('0x25')]);})[_0xf06e('0x9')](function(_0x41da27){logger[_0xf06e('0x5')](util['format'](_0xf06e('0x26'),_0x7b4c4['id']));return _0x7b4c4[_0xf06e('0x17')]({'sentiment':_0x41da27['Sentiment'],'sPositive':_0x41da27[_0xf06e('0x28')][_0xf06e('0x33')],'sNegative':_0x41da27[_0xf06e('0x28')][_0xf06e('0x29')],'sMixed':_0x41da27[_0xf06e('0x28')][_0xf06e('0x2a')],'sNeutral':_0x41da27[_0xf06e('0x28')][_0xf06e('0x2b')],'transcribeStatus':_0xf06e('0x10')});})[_0xf06e('0x9')](function(){logger[_0xf06e('0x5')](util['format']('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x7b4c4['id']));_0x5c36b3();});}})[_0xf06e('0x34')](function(_0x542b79){if(_0x542b79){if(!_0x542b79['name']||_0x542b79[_0xf06e('0x35')]!==_0xf06e('0x36')){logger[_0xf06e('0x37')](util[_0xf06e('0xa')](_0xf06e('0x38'),_0x7b4c4['id']),util[_0xf06e('0x39')](_0x542b79,{'showHidden':![],'depth':null}));}}_0x5c36b3();});});}function checkTranscribe(){var _0x195524;var _0x252629;var _0x4f7ce2;return db[_0xf06e('0x3a')][_0xf06e('0x3b')]({'where':{'transcribeStatus':'IN_PROGRESS'}})[_0xf06e('0x9')](function(_0x92394a){if(!_0x92394a||!_0x92394a[_0xf06e('0x16')]){throw new db['Sequelize']['ValidationError'](_0xf06e('0x3c'));}_0x195524=_0x92394a;return db[_0xf06e('0x3d')][_0xf06e('0x22')]({'where':{'id':0x1}});})['then'](function(_0x9ec791){if(!_0x9ec791){throw new db[(_0xf06e('0x19'))][(_0xf06e('0x1a'))](_0xf06e('0x3e'));}_0x252629=_0x9ec791;if(!_0x252629['transcribe']||!_0x252629['transcribeAccountId']||!_0x252629[_0xf06e('0x8')]||!_0x252629['language']||!_0x252629['bucket']){throw new db[(_0xf06e('0x19'))]['ValidationError']('Transcribe\x20not\x20configured');}return db[_0xf06e('0x21')][_0xf06e('0x22')]({'where':{'id':_0x252629[_0xf06e('0x3f')]}});})[_0xf06e('0x9')](function(_0x4aca1){if(!_0x4aca1){throw new db[(_0xf06e('0x19'))][(_0xf06e('0x1a'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x4aca1[_0xf06e('0x6')]||!_0x4aca1['data2']){throw new db[(_0xf06e('0x19'))]['ValidationError'](_0xf06e('0x23'));}_0x4f7ce2=_0x4aca1;var _0x1fe197=[];_0x195524[_0xf06e('0x40')](function(_0x2ca097){_0x1fe197[_0xf06e('0x41')](checkTranscribeJob(_0x2ca097,_0x252629,_0x4f7ce2));});return BPromise[_0xf06e('0x42')](_0x1fe197);})['catch'](function(_0x18b037){if(_0x18b037){if(!_0x18b037[_0xf06e('0x35')]||_0x18b037['name']!=='SequelizeValidationError'){logger['error'](util['inspect'](_0x18b037,{'showHidden':![],'depth':null}));}}});}exports[_0xf06e('0x43')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file diff --git a/server/config/schedule/whatsapp.js b/server/config/schedule/whatsapp.js index b4b3e39..a3a1e38 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 _0x116a=['schedule','redis','defaults','localhost','socket.io-emitter','WhatsappInteraction','findAll','lastMsgAt','map','info','update','system','timeout','then','join','length','emit','whatsappInteraction:update','error','[WHATSAPP]\x20Error\x20closing\x20interactions','inspect','lodash','moment','ioredis','util','../../config/environment','../logger'];(function(_0x3c4737,_0x2329ec){var _0x2bb926=function(_0x3b9605){while(--_0x3b9605){_0x3c4737['push'](_0x3c4737['shift']());}};_0x2bb926(++_0x2329ec);}(_0x116a,0x174));var _0xa116=function(_0x518b8b,_0x366fbf){_0x518b8b=_0x518b8b-0x0;var _0x1c8596=_0x116a[_0x518b8b];return _0x1c8596;};'use strict';var _=require(_0xa116('0x0'));var moment=require(_0xa116('0x1'));var Redis=require(_0xa116('0x2'));var util=require(_0xa116('0x3'));var config=require(_0xa116('0x4'));var db=require('../../mysqldb')['db'];var logger=require(_0xa116('0x5'))(_0xa116('0x6'));config[_0xa116('0x7')]=_[_0xa116('0x8')](config[_0xa116('0x7')],{'host':_0xa116('0x9'),'port':0x18eb});var io=require(_0xa116('0xa'))(new Redis(config[_0xa116('0x7')]));function closeInteractions(){var _0xf93552=[];return db[_0xa116('0xb')][_0xa116('0xc')]({'raw':!![],'attributes':['id',_0xa116('0xd')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()['subtract'](0x18,'hours')}}})['then'](function(_0x52925f){if(_0x52925f&&_0x52925f['length']){_0xf93552=_[_0xa116('0xe')](_0x52925f||[],'id');logger[_0xa116('0xf')]('[WHATSAPP]\x20Interactions\x20to\x20close:',_0xf93552['join']());return db['WhatsappInteraction'][_0xa116('0x10')]({'closeReason':_0xa116('0x11'),'disposition':_0xa116('0x12'),'closed':!![],'closedAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')},{'where':{'id':_0xf93552}});}})[_0xa116('0x13')](function(){if(_0xf93552&&_0xf93552['length']){logger[_0xa116('0xf')]('[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:',_0xf93552[_0xa116('0x14')]());for(var _0x27b457=0x0;_0x27b457<_0xf93552[_0xa116('0x15')];_0x27b457++){io[_0xa116('0x16')](_0xa116('0x17'),{'id':_0xf93552[_0x27b457],'closed':!![]});}}})['catch'](function(_0x5739de){logger[_0xa116('0x18')](_0xa116('0x19'),_0x5739de?util[_0xa116('0x1a')](_0x5739de,{'showHidden':![],'depth':null}):'');});}exports['start']=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0xff8d=['YYYY-MM-DD\x20HH:mm:ss','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','emit','whatsappInteraction:update','error','[WHATSAPP]\x20Error\x20closing\x20interactions','inspect','lodash','ioredis','util','../../config/environment','../../mysqldb','../logger','redis','localhost','WhatsappInteraction','subtract','hours','then','length','map','info','[WHATSAPP]\x20Interactions\x20to\x20close:','join','update','system','timeout'];(function(_0x5cfafb,_0x13f1bb){var _0x1e5480=function(_0x3910ac){while(--_0x3910ac){_0x5cfafb['push'](_0x5cfafb['shift']());}};_0x1e5480(++_0x13f1bb);}(_0xff8d,0xdf));var _0xdff8=function(_0x26e3a9,_0x5be104){_0x26e3a9=_0x26e3a9-0x0;var _0x4fa0ca=_0xff8d[_0x26e3a9];return _0x4fa0ca;};'use strict';var _=require(_0xdff8('0x0'));var moment=require('moment');var Redis=require(_0xdff8('0x1'));var util=require(_0xdff8('0x2'));var config=require(_0xdff8('0x3'));var db=require(_0xdff8('0x4'))['db'];var logger=require(_0xdff8('0x5'))('schedule');config[_0xdff8('0x6')]=_['defaults'](config['redis'],{'host':_0xdff8('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xdff8('0x6')]));function closeInteractions(){var _0x48351a=[];return db[_0xdff8('0x8')]['findAll']({'raw':!![],'attributes':['id','lastMsgAt'],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0xdff8('0x9')](0x18,_0xdff8('0xa'))}}})[_0xdff8('0xb')](function(_0x3f724a){if(_0x3f724a&&_0x3f724a[_0xdff8('0xc')]){_0x48351a=_[_0xdff8('0xd')](_0x3f724a||[],'id');logger[_0xdff8('0xe')](_0xdff8('0xf'),_0x48351a[_0xdff8('0x10')]());return db['WhatsappInteraction'][_0xdff8('0x11')]({'closeReason':_0xdff8('0x12'),'disposition':_0xdff8('0x13'),'closed':!![],'closedAt':moment()['format'](_0xdff8('0x14'))},{'where':{'id':_0x48351a}});}})[_0xdff8('0xb')](function(){if(_0x48351a&&_0x48351a['length']){logger[_0xdff8('0xe')](_0xdff8('0x15'),_0x48351a[_0xdff8('0x10')]());for(var _0x5245aa=0x0;_0x5245aa<_0x48351a[_0xdff8('0xc')];_0x5245aa++){io[_0xdff8('0x16')](_0xdff8('0x17'),{'id':_0x48351a[_0x5245aa],'closed':!![]});}}})['catch'](function(_0xf10871){logger[_0xdff8('0x18')](_0xdff8('0x19'),_0xf10871?util[_0xdff8('0x1a')](_0xf10871,{'showHidden':![],'depth':null}):'');});}exports['start']=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file diff --git a/server/config/seedContact.js b/server/config/seedContact.js index 3c1bebb..4133f08 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4afc=['Biondo','innocenzo.biondo','CmContact','destroy','then','log','CmHopper','bulkCreate','finished\x20populating','contacts2','hopper2','catch','util','../mysqldb','push','Innocenzo','@xcally.com','now'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x4afc,0x13e));var _0xc4af=function(_0x263a74,_0xc31414){_0x263a74=_0x263a74-0x0;var _0x2aa86c=_0x4afc[_0x263a74];return _0x2aa86c;};'use strict';var util=require(_0xc4af('0x0'));var db=require(_0xc4af('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0xc4af('0x2')]({'id':i,'firstName':_0xc4af('0x3')+i,'lastName':'Biondo'+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+_0xc4af('0x4')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0xc4af('0x2')]({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xc4af('0x5')](),'updatedAt':Date[_0xc4af('0x5')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2['push']({'id':i,'firstName':_0xc4af('0x3')+i,'lastName':_0xc4af('0x6')+i,'phone':0xf879fb460+i,'email':_0xc4af('0x7')+i+_0xc4af('0x4')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0xc4af('0x2')]({'id':i,'active':![],'scheduledat':Date[_0xc4af('0x5')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xc4af('0x5')](),'updatedAt':Date[_0xc4af('0x5')]()});}db[_0xc4af('0x8')][_0xc4af('0x9')]({'where':{}})['then'](function(){return db[_0xc4af('0x8')]['bulkCreate'](contacts);})[_0xc4af('0xa')](function(){console[_0xc4af('0xb')]('finished\x20populating','contacts1');return db[_0xc4af('0xc')]['destroy']({'where':{}});})['then'](function(){return db['CmHopper']['bulkCreate'](hopper);})[_0xc4af('0xa')](function(){console['log']('finished\x20populating','hopper1');return db[_0xc4af('0x8')][_0xc4af('0xd')](contacts2);})[_0xc4af('0xa')](function(){console[_0xc4af('0xb')](_0xc4af('0xe'),_0xc4af('0xf'));return db['CmHopper']['bulkCreate'](hopper2);})[_0xc4af('0xa')](function(){console['log']('finished\x20populating',_0xc4af('0x10'));})[_0xc4af('0x11')](function(_0x17f9a8){console[_0xc4af('0xb')](_0x17f9a8);}); \ No newline at end of file +var _0x3de6=['Innocenzo','Biondo','innocenzo.biondo','@xcally.com','now','destroy','CmContact','then','log','contacts1','CmHopper','bulkCreate','finished\x20populating','contacts2','hopper2','catch','util','../mysqldb','push'];(function(_0x4a405c,_0x23f82a){var _0x5daa12=function(_0x2bdf11){while(--_0x2bdf11){_0x4a405c['push'](_0x4a405c['shift']());}};_0x5daa12(++_0x23f82a);}(_0x3de6,0xbb));var _0x63de=function(_0x5ce759,_0x481b16){_0x5ce759=_0x5ce759-0x0;var _0x5b672c=_0x3de6[_0x5ce759];return _0x5b672c;};'use strict';var util=require(_0x63de('0x0'));var db=require(_0x63de('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0x63de('0x2')]({'id':i,'firstName':_0x63de('0x3')+i,'lastName':_0x63de('0x4')+i,'phone':0xf879fb460+i,'email':_0x63de('0x5')+i+_0x63de('0x6')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x63de('0x2')]({'id':i,'active':![],'scheduledat':Date[_0x63de('0x7')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date['now'](),'updatedAt':Date['now']()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0x63de('0x2')]({'id':i,'firstName':'Innocenzo'+i,'lastName':_0x63de('0x4')+i,'phone':0xf879fb460+i,'email':_0x63de('0x5')+i+_0x63de('0x6')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x63de('0x2')]({'id':i,'active':![],'scheduledat':Date[_0x63de('0x7')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x63de('0x7')](),'updatedAt':Date['now']()});}db['CmContact'][_0x63de('0x8')]({'where':{}})['then'](function(){return db[_0x63de('0x9')]['bulkCreate'](contacts);})[_0x63de('0xa')](function(){console[_0x63de('0xb')]('finished\x20populating',_0x63de('0xc'));return db['CmHopper']['destroy']({'where':{}});})['then'](function(){return db[_0x63de('0xd')][_0x63de('0xe')](hopper);})[_0x63de('0xa')](function(){console[_0x63de('0xb')](_0x63de('0xf'),'hopper1');return db[_0x63de('0x9')][_0x63de('0xe')](contacts2);})['then'](function(){console[_0x63de('0xb')]('finished\x20populating',_0x63de('0x10'));return db[_0x63de('0xd')]['bulkCreate'](hopper2);})['then'](function(){console[_0x63de('0xb')](_0x63de('0xf'),_0x63de('0x11'));})[_0x63de('0x12')](function(_0x423f32){console[_0x63de('0xb')](_0x423f32);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index ae7c7ad..a642ce4 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x99b8=['yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','\x22%s\x22\x20<%s>','then','log','add\x20user','catch','../mysqldb','push','format','%s%s','agent','friend','udp','wss','ulaw'];(function(_0x493dda,_0x1528d3){var _0x31a5a6=function(_0x43c676){while(--_0x43c676){_0x493dda['push'](_0x493dda['shift']());}};_0x31a5a6(++_0x1528d3);}(_0x99b8,0x7f));var _0x899b=function(_0x57a76c,_0x34edda){_0x57a76c=_0x57a76c-0x0;var _0x13996a=_0x99b8[_0x57a76c];return _0x13996a;};'use strict';var util=require('util');var db=require(_0x899b('0x0'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0x899b('0x1')]({'name':util[_0x899b('0x2')](_0x899b('0x3'),_0x899b('0x4'),i),'fullname':util['format']('%s%s',_0x899b('0x4'),i),'email':util['format']('%s%s@xcally.com',_0x899b('0x4'),i),'role':_0x899b('0x4'),'password':'password','internal':0xfa0+i,'type':_0x899b('0x5'),'transport':[_0x899b('0x6'),'ws',_0x899b('0x7')],'disallow':['all'],'allow':[_0x899b('0x8')],'defaultuser':util[_0x899b('0x2')]('%s%s','agent',i),'encryption':_0x899b('0x9'),'avpf':_0x899b('0x9'),'force_avp':_0x899b('0x9'),'icesupport':_0x899b('0x9'),'dtlsenable':_0x899b('0x9'),'dtlsverify':'no','dtlscertfile':_0x899b('0xa'),'dtlsprivatekey':_0x899b('0xb'),'dtlssetup':'actpass','callerid':util[_0x899b('0x2')](_0x899b('0xc'),util[_0x899b('0x2')](_0x899b('0x3'),_0x899b('0x4'),i),0xfa0+i)});}db['User']['bulkCreate'](users)[_0x899b('0xd')](function(){console[_0x899b('0xe')](_0x899b('0xf'));})[_0x899b('0x10')](function(_0x44007f){console['log'](_0x44007f);}); \ No newline at end of file +var _0xadab=['%s%s','agent','password','friend','udp','ulaw','yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','\x22%s\x22\x20<%s>','User','then','add\x20user','catch','log','util','format'];(function(_0x31e0a2,_0x1b51ab){var _0x19d493=function(_0x55d390){while(--_0x55d390){_0x31e0a2['push'](_0x31e0a2['shift']());}};_0x19d493(++_0x1b51ab);}(_0xadab,0x64));var _0xbada=function(_0x4b90b3,_0x164fb2){_0x4b90b3=_0x4b90b3-0x0;var _0x45472e=_0xadab[_0x4b90b3];return _0x45472e;};'use strict';var util=require(_0xbada('0x0'));var db=require('../mysqldb')['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users['push']({'name':util[_0xbada('0x1')](_0xbada('0x2'),_0xbada('0x3'),i),'fullname':util['format'](_0xbada('0x2'),'agent',i),'email':util[_0xbada('0x1')]('%s%s@xcally.com',_0xbada('0x3'),i),'role':_0xbada('0x3'),'password':_0xbada('0x4'),'internal':0xfa0+i,'type':_0xbada('0x5'),'transport':[_0xbada('0x6'),'ws','wss'],'disallow':['all'],'allow':[_0xbada('0x7')],'defaultuser':util[_0xbada('0x1')](_0xbada('0x2'),_0xbada('0x3'),i),'encryption':_0xbada('0x8'),'avpf':_0xbada('0x8'),'force_avp':_0xbada('0x8'),'icesupport':_0xbada('0x8'),'dtlsenable':_0xbada('0x8'),'dtlsverify':'no','dtlscertfile':_0xbada('0x9'),'dtlsprivatekey':_0xbada('0xa'),'dtlssetup':'actpass','callerid':util[_0xbada('0x1')](_0xbada('0xb'),util[_0xbada('0x1')](_0xbada('0x2'),'agent',i),0xfa0+i)});}db[_0xbada('0xc')]['bulkCreate'](users)[_0xbada('0xd')](function(){console['log'](_0xbada('0xe'));})[_0xbada('0xf')](function(_0x55651e){console[_0xbada('0x10')](_0x55651e);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index bda6bec..2039862 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8d62=['FaxInteraction','FaxInteractions','SmsInteraction','SmsInteractions','OpenchannelInteraction','OpenchannelInteractions','WhatsappInteraction','WhatsappInteractions','admin','voice:inbound','voice:outbound','include','push','ChatQueue','SmsQueue','OpenchannelQueue','WhatsappQueue','Campaign','user','VoiceQueues','VoiceQueue','FaxQueue','MailQueue','getChatQueues','getFaxQueues','getMailQueues','getWhatsappQueues','all','voice','mail','whatsapp','telephone:%s','trunk:%s','campaign:%s:%s','user:%s','leave','removeChatInteractions','user_has_chat_interactions:remove','user_has_mail_interactions:remove','removeFaxInteractions','emit','user_has_fax_interactions:remove','removeSmsInteractions','user_has_whatsapp_interactions:remove','catch','join','default','connection','setMaxListeners','request','remoteAddress','connectedAt','log','SocketIO\x20','nsp','DISCONNECTED','util','bluebird','../mysqldb','./environment','name','Agents','User','role','agent','telephone','type','ivr','UserProfileSection','findOne','then','autoAssociation','ChatQueues','FaxQueues','SmsQueues','MailQueues','OpenchannelQueues','WhatsappQueues','findAll','Telephones','Trunks','IvrCampaigns','UserProfileResource','resourceId','map','where','%s:queue:%s','length','format','handshake','query','userProfileId','ChatInteraction','ChatInteractions','MailInteraction','MailInteractions'];(function(_0x25917a,_0x1617e1){var _0x2e5603=function(_0x9625b2){while(--_0x9625b2){_0x25917a['push'](_0x25917a['shift']());}};_0x2e5603(++_0x1617e1);}(_0x8d62,0xf8));var _0x28d6=function(_0x46f7f4,_0x3ad8b8){_0x46f7f4=_0x46f7f4-0x0;var _0x1cceee=_0x8d62[_0x46f7f4];return _0x1cceee;};'use strict';var _=require('lodash');var util=require(_0x28d6('0x0'));var BPromise=require(_0x28d6('0x1'));var db=require(_0x28d6('0x2'))['db'];var config=require(_0x28d6('0x3'));var queryQueues={'attributes':['id',_0x28d6('0x4')],'include':[{'as':_0x28d6('0x5'),'model':db[_0x28d6('0x6')],'attributes':['id',_0x28d6('0x4'),_0x28d6('0x7')],'raw':!![],'where':{'role':_0x28d6('0x8')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0x28d6('0x4')],'where':{'role':_0x28d6('0x9')}};var queryTrunks={'raw':!![],'attributes':['id',_0x28d6('0x4')]};var queryAgents={'raw':!![],'attributes':['id',_0x28d6('0x4')],'where':{'role':'agent'}};var queryCampaigns={'raw':!![],'attributes':['id',_0x28d6('0x4'),_0x28d6('0xa')],'where':{'type':_0x28d6('0xb')}};function getAssociatedResources(_0x525c82,_0x274468,_0x4b564f){return db[_0x28d6('0xc')][_0x28d6('0xd')]({'where':{'name':_0x525c82,'userProfileId':_0x274468},'raw':!![]})[_0x28d6('0xe')](function(_0x239297){if(_0x239297){if(_0x239297[_0x28d6('0xf')]){switch(_0x525c82){case'VoiceQueues':case _0x28d6('0x10'):case _0x28d6('0x11'):case _0x28d6('0x12'):case _0x28d6('0x13'):case _0x28d6('0x14'):case _0x28d6('0x15'):return db[_0x4b564f][_0x28d6('0x16')](queryQueues);case _0x28d6('0x17'):return db[_0x4b564f]['findAll'](queryTelephones);case _0x28d6('0x18'):return db[_0x4b564f][_0x28d6('0x16')](queryTrunks);case _0x28d6('0x19'):return db[_0x4b564f]['findAll'](queryCampaigns);}}else{return db[_0x28d6('0x1a')]['findAll']({'attributes':[_0x28d6('0x1b')],'where':{'sectionId':_0x239297['id']},'raw':!![]})[_0x28d6('0xe')](function(_0x4b82e2){if(_0x4b82e2){var _0x1881a8={'where':{'id':_[_0x28d6('0x1c')](_0x4b82e2,_0x28d6('0x1b'))},'raw':!![]};switch(_0x4b564f){case _0x28d6('0x6'):_0x1881a8[_0x28d6('0x1d')]['role']=_0x28d6('0x9');break;case'Campaign':_0x1881a8[_0x28d6('0x1d')][_0x28d6('0xa')]=_0x28d6('0xb');break;}return db[_0x4b564f][_0x28d6('0x16')](_0x1881a8);}else{return[];}});}}else{return[];}})[_0x28d6('0xe')](function(_0x2f1b6b){return _0x2f1b6b;});}function joinOrLeaveQueues(_0x2d521d,_0x55f190,_0x29cfbf,_0x20f2fd){_0x2d521d[_0x55f190](util['format'](_0x28d6('0x1e'),_0x29cfbf,_0x20f2fd[_0x28d6('0x4')]));if(_0x20f2fd[_0x28d6('0x5')]){for(var _0x252c1d=0x0;_0x252c1d<_0x20f2fd[_0x28d6('0x5')][_0x28d6('0x1f')];_0x252c1d+=0x1){_0x2d521d[_0x55f190](util[_0x28d6('0x20')]('user:%s',_0x20f2fd[_0x28d6('0x5')][_0x252c1d]['name']));}}}function joinOrLeave(_0x4572ff,_0x2288eb,_0x455dd6){var _0x3d128b;if(_0x4572ff[_0x28d6('0x21')][_0x28d6('0x22')]['id']){db['User']['find']({'attributes':['id',_0x28d6('0x4'),_0x28d6('0x7'),_0x28d6('0x23')],'where':{'id':_0x4572ff[_0x28d6('0x21')]['query']['id']},'include':[{'model':db[_0x28d6('0x24')],'as':_0x28d6('0x25'),'attributes':['id'],'raw':!![]},{'model':db[_0x28d6('0x26')],'as':_0x28d6('0x27'),'attributes':['id'],'raw':!![]},{'model':db[_0x28d6('0x28')],'as':_0x28d6('0x29'),'attributes':['id'],'raw':!![]},{'model':db[_0x28d6('0x2a')],'as':_0x28d6('0x2b'),'attributes':['id'],'raw':!![]},{'model':db[_0x28d6('0x2c')],'as':_0x28d6('0x2d'),'attributes':['id'],'raw':!![]},{'model':db[_0x28d6('0x2e')],'as':_0x28d6('0x2f'),'attributes':['id'],'raw':!![]}]})[_0x28d6('0xe')](function(_0x3ba89f){if(_0x3ba89f){_0x3d128b=_0x3ba89f;_0x4572ff[_0x2288eb](util['format']('user:%s',_0x3ba89f[_0x28d6('0x4')]));var _0x8bb534=[];switch(_0x3ba89f[_0x28d6('0x7')]){case _0x28d6('0x30'):_0x4572ff[_0x2288eb](_0x28d6('0x31'));_0x4572ff[_0x2288eb](_0x28d6('0x32'));if(queryQueues['hasOwnProperty'](_0x28d6('0x33'))){delete queryQueues['include'];}_0x8bb534[_0x28d6('0x34')](db['VoiceQueue'][_0x28d6('0x16')](queryQueues));_0x8bb534[_0x28d6('0x34')](db[_0x28d6('0x35')][_0x28d6('0x16')](queryQueues));_0x8bb534[_0x28d6('0x34')](db['FaxQueue']['findAll'](queryQueues));_0x8bb534[_0x28d6('0x34')](db[_0x28d6('0x36')]['findAll'](queryQueues));_0x8bb534[_0x28d6('0x34')](db['MailQueue'][_0x28d6('0x16')](queryQueues));_0x8bb534['push'](db[_0x28d6('0x37')]['findAll'](queryQueues));_0x8bb534[_0x28d6('0x34')](db[_0x28d6('0x38')][_0x28d6('0x16')](queryQueues));_0x8bb534[_0x28d6('0x34')](db[_0x28d6('0x6')][_0x28d6('0x16')](queryTelephones));_0x8bb534[_0x28d6('0x34')](db['Trunk'][_0x28d6('0x16')](queryTrunks));_0x8bb534[_0x28d6('0x34')](db[_0x28d6('0x39')][_0x28d6('0x16')](queryCampaigns));_0x8bb534['push'](db[_0x28d6('0x6')][_0x28d6('0x16')](queryAgents));break;case _0x28d6('0x3a'):_0x4572ff[_0x2288eb](_0x28d6('0x31'));_0x4572ff[_0x2288eb]('voice:outbound');_0x8bb534[_0x28d6('0x34')](getAssociatedResources(_0x28d6('0x3b'),_0x3ba89f[_0x28d6('0x23')],_0x28d6('0x3c')));_0x8bb534[_0x28d6('0x34')](getAssociatedResources(_0x28d6('0x10'),_0x3ba89f[_0x28d6('0x23')],_0x28d6('0x35')));_0x8bb534[_0x28d6('0x34')](getAssociatedResources(_0x28d6('0x11'),_0x3ba89f[_0x28d6('0x23')],_0x28d6('0x3d')));_0x8bb534[_0x28d6('0x34')](getAssociatedResources(_0x28d6('0x12'),_0x3ba89f[_0x28d6('0x23')],_0x28d6('0x36')));_0x8bb534['push'](getAssociatedResources('MailQueues',_0x3ba89f['userProfileId'],_0x28d6('0x3e')));_0x8bb534['push'](getAssociatedResources('OpenchannelQueues',_0x3ba89f[_0x28d6('0x23')],'OpenchannelQueue'));_0x8bb534[_0x28d6('0x34')](getAssociatedResources(_0x28d6('0x15'),_0x3ba89f['userProfileId'],_0x28d6('0x38')));_0x8bb534[_0x28d6('0x34')](getAssociatedResources(_0x28d6('0x17'),_0x3ba89f[_0x28d6('0x23')],_0x28d6('0x6')));_0x8bb534[_0x28d6('0x34')](getAssociatedResources(_0x28d6('0x18'),_0x3ba89f[_0x28d6('0x23')],'Trunk'));_0x8bb534[_0x28d6('0x34')](getAssociatedResources(_0x28d6('0x19'),_0x3ba89f['userProfileId'],_0x28d6('0x39')));_0x8bb534[_0x28d6('0x34')](db[_0x28d6('0x6')]['findAll'](queryAgents));break;case _0x28d6('0x8'):_0x4572ff[_0x2288eb](_0x28d6('0x31'));_0x4572ff[_0x2288eb](_0x28d6('0x32'));_0x8bb534[_0x28d6('0x34')](_0x3ba89f['getVoiceQueues']({'attributes':['id',_0x28d6('0x4')]}));_0x8bb534[_0x28d6('0x34')](_0x3ba89f[_0x28d6('0x3f')]({'attributes':['id','name']}));_0x8bb534[_0x28d6('0x34')](_0x3ba89f[_0x28d6('0x40')]({'attributes':['id',_0x28d6('0x4')]}));_0x8bb534[_0x28d6('0x34')](_0x3ba89f['getSmsQueues']({'attributes':['id',_0x28d6('0x4')]}));_0x8bb534[_0x28d6('0x34')](_0x3ba89f[_0x28d6('0x41')]({'attributes':['id',_0x28d6('0x4')]}));_0x8bb534[_0x28d6('0x34')](_0x3ba89f['getOpenchannelQueues']({'attributes':['id',_0x28d6('0x4')]}));_0x8bb534[_0x28d6('0x34')](_0x3ba89f[_0x28d6('0x42')]({'attributes':['id',_0x28d6('0x4')]}));break;}return BPromise[_0x28d6('0x43')](_0x8bb534);}})[_0x28d6('0xe')](function(_0x10a52){if(_0x10a52&&_0x10a52[_0x28d6('0x1f')]){for(var _0x293c76=0x0;_0x293c76<_0x10a52[_0x28d6('0x1f')];_0x293c76+=0x1){for(var _0x4c8295=0x0;_0x4c8295<_0x10a52[_0x293c76]['length'];_0x4c8295+=0x1){switch(_0x293c76){case 0x0:joinOrLeaveQueues(_0x4572ff,_0x2288eb,_0x28d6('0x44'),_0x10a52[_0x293c76][_0x4c8295]);break;case 0x1:joinOrLeaveQueues(_0x4572ff,_0x2288eb,'chat',_0x10a52[_0x293c76][_0x4c8295]);break;case 0x2:joinOrLeaveQueues(_0x4572ff,_0x2288eb,'fax',_0x10a52[_0x293c76][_0x4c8295]);break;case 0x3:joinOrLeaveQueues(_0x4572ff,_0x2288eb,'sms',_0x10a52[_0x293c76][_0x4c8295]);break;case 0x4:joinOrLeaveQueues(_0x4572ff,_0x2288eb,_0x28d6('0x45'),_0x10a52[_0x293c76][_0x4c8295]);break;case 0x5:joinOrLeaveQueues(_0x4572ff,_0x2288eb,'openchannel',_0x10a52[_0x293c76][_0x4c8295]);break;case 0x6:joinOrLeaveQueues(_0x4572ff,_0x2288eb,_0x28d6('0x46'),_0x10a52[_0x293c76][_0x4c8295]);break;case 0x7:if(_0x3d128b['role']!==_0x28d6('0x8'))_0x4572ff[_0x2288eb](util[_0x28d6('0x20')](_0x28d6('0x47'),_0x10a52[_0x293c76][_0x4c8295]['name']));break;case 0x8:if(_0x3d128b['role']!=='agent')_0x4572ff[_0x2288eb](util[_0x28d6('0x20')](_0x28d6('0x48'),_0x10a52[_0x293c76][_0x4c8295]['name']));break;case 0x9:if(_0x3d128b[_0x28d6('0x7')]!==_0x28d6('0x8'))_0x4572ff[_0x2288eb](util[_0x28d6('0x20')](_0x28d6('0x49'),_0x10a52[_0x293c76][_0x4c8295][_0x28d6('0xa')],_0x10a52[_0x293c76][_0x4c8295][_0x28d6('0x4')]));break;case 0xa:_0x4572ff[_0x2288eb](util[_0x28d6('0x20')](_0x28d6('0x4a'),_0x10a52[_0x293c76][_0x4c8295]['name']));break;}}}}})[_0x28d6('0xe')](function(){if(_0x2288eb===_0x28d6('0x4b')){var _0x9fbbe2=_[_0x28d6('0x1c')](_0x3d128b[_0x28d6('0x25')],'id');return _0x3d128b[_0x28d6('0x4c')](_0x9fbbe2)[_0x28d6('0xe')](function(){for(var _0x4a31cb=0x0;_0x4a31cb<_0x9fbbe2[_0x28d6('0x1f')];_0x4a31cb+=0x1){_0x455dd6['emit'](_0x28d6('0x4d'),{'ChatInteractionId':Number(_0x9fbbe2[_0x4a31cb]),'UserId':Number(_0x3d128b['id'])});}});}})[_0x28d6('0xe')](function(){if(_0x2288eb===_0x28d6('0x4b')){var _0x15edd6=_[_0x28d6('0x1c')](_0x3d128b[_0x28d6('0x27')],'id');return _0x3d128b['removeMailInteractions'](_0x15edd6)[_0x28d6('0xe')](function(){for(var _0x5794ae=0x0;_0x5794ae<_0x15edd6[_0x28d6('0x1f')];_0x5794ae+=0x1){_0x455dd6['emit'](_0x28d6('0x4e'),{'MailInteractionId':Number(_0x15edd6[_0x5794ae]),'UserId':Number(_0x3d128b['id'])});}});}})[_0x28d6('0xe')](function(){if(_0x2288eb===_0x28d6('0x4b')){var _0x33a7c3=_['map'](_0x3d128b[_0x28d6('0x29')],'id');return _0x3d128b[_0x28d6('0x4f')](_0x33a7c3)[_0x28d6('0xe')](function(){for(var _0x3a9779=0x0;_0x3a9779<_0x33a7c3[_0x28d6('0x1f')];_0x3a9779+=0x1){_0x455dd6[_0x28d6('0x50')](_0x28d6('0x51'),{'FaxInteractionId':Number(_0x33a7c3[_0x3a9779]),'UserId':Number(_0x3d128b['id'])});}});}})[_0x28d6('0xe')](function(){if(_0x2288eb===_0x28d6('0x4b')){var _0xe55cde=_[_0x28d6('0x1c')](_0x3d128b['SmsInteractions'],'id');return _0x3d128b[_0x28d6('0x52')](_0xe55cde)[_0x28d6('0xe')](function(){for(var _0x45a288=0x0;_0x45a288<_0xe55cde[_0x28d6('0x1f')];_0x45a288+=0x1){_0x455dd6[_0x28d6('0x50')]('user_has_sms_interactions:remove',{'SmsInteractionId':Number(_0xe55cde[_0x45a288]),'UserId':Number(_0x3d128b['id'])});}});}})[_0x28d6('0xe')](function(){if(_0x2288eb===_0x28d6('0x4b')){var _0x40cd58=_[_0x28d6('0x1c')](_0x3d128b[_0x28d6('0x2d')],'id');return _0x3d128b['removeOpenchannelInteractions'](_0x40cd58)[_0x28d6('0xe')](function(){for(var _0x698103=0x0;_0x698103<_0x40cd58[_0x28d6('0x1f')];_0x698103+=0x1){_0x455dd6[_0x28d6('0x50')]('user_has_openchannel_interactions:remove',{'OpenchannelInteractionId':Number(_0x40cd58[_0x698103]),'UserId':Number(_0x3d128b['id'])});}});}})[_0x28d6('0xe')](function(){if(_0x2288eb==='leave'){var _0x3fc83c=_[_0x28d6('0x1c')](_0x3d128b[_0x28d6('0x2f')],'id');return _0x3d128b['removeWhatsappInteractions'](_0x3fc83c)[_0x28d6('0xe')](function(){for(var _0x102bf6=0x0;_0x102bf6<_0x3fc83c[_0x28d6('0x1f')];_0x102bf6+=0x1){_0x455dd6[_0x28d6('0x50')](_0x28d6('0x53'),{'WhatsappInteractionId':Number(_0x3fc83c[_0x102bf6]),'UserId':Number(_0x3d128b['id'])});}});}})[_0x28d6('0x54')](function(_0x312a09){_0x4572ff['log'](_0x312a09);});}}function onDisconnect(_0xf97c6b,_0x3daecc){joinOrLeave(_0xf97c6b,_0x28d6('0x4b'),_0x3daecc);}function onConnect(_0x2cfd63){joinOrLeave(_0x2cfd63,_0x28d6('0x55'));}exports[_0x28d6('0x56')]=function(_0x32e762){_0x32e762['on'](_0x28d6('0x57'),function(_0x3d64d5){_0x3d64d5[_0x28d6('0x58')](0x0);_0x3d64d5['address']=_0x3d64d5[_0x28d6('0x59')][_0x28d6('0x57')][_0x28d6('0x5a')]+':'+_0x3d64d5[_0x28d6('0x59')][_0x28d6('0x57')]['remotePort'];_0x3d64d5[_0x28d6('0x5b')]=new Date();_0x3d64d5[_0x28d6('0x5c')]=function(_0xd6b590){console[_0x28d6('0x5c')](_0x28d6('0x5d')+_0x3d64d5[_0x28d6('0x5e')][_0x28d6('0x4')]+'['+_0x3d64d5['address']+']',_0xd6b590);};_0x3d64d5['on']('disconnect',function(){onDisconnect(_0x3d64d5,_0x32e762);_0x3d64d5[_0x28d6('0x5c')](_0x28d6('0x5f'));});onConnect(_0x3d64d5);_0x3d64d5[_0x28d6('0x5c')]('CONNECTED');});}; \ No newline at end of file +var _0x21ab=['FaxInteractions','SmsInteraction','SmsInteractions','OpenchannelInteraction','OpenchannelInteractions','WhatsappInteraction','WhatsappInteractions','voice:inbound','voice:outbound','hasOwnProperty','include','push','VoiceQueue','ChatQueue','FaxQueue','MailQueue','OpenchannelQueue','WhatsappQueue','Trunk','Campaign','user','userProfileId','SmsQueue','OpenchannelQueues','IvrCampaigns','getVoiceQueues','getChatQueues','getFaxQueues','getSmsQueues','getMailQueues','getOpenchannelQueues','getWhatsappQueues','voice','chat','fax','sms','whatsapp','trunk:%s','campaign:%s:%s','type','leave','emit','MailInteractions','removeMailInteractions','user_has_mail_interactions:remove','removeFaxInteractions','user_has_fax_interactions:remove','removeSmsInteractions','user_has_sms_interactions:remove','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','user_has_whatsapp_interactions:remove','catch','log','join','default','connection','address','request','remoteAddress','connectedAt','nsp','disconnect','CONNECTED','util','../mysqldb','./environment','name','User','role','agent','telephone','ivr','UserProfileSection','findOne','then','autoAssociation','VoiceQueues','ChatQueues','FaxQueues','SmsQueues','MailQueues','Telephones','Trunks','findAll','resourceId','map','where','format','%s:queue:%s','Agents','length','user:%s','query','find','handshake','ChatInteraction','ChatInteractions','MailInteraction','FaxInteraction'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x21ab,0x16c));var _0xb21a=function(_0x2f1908,_0x5d837d){_0x2f1908=_0x2f1908-0x0;var _0x357795=_0x21ab[_0x2f1908];return _0x357795;};'use strict';var _=require('lodash');var util=require(_0xb21a('0x0'));var BPromise=require('bluebird');var db=require(_0xb21a('0x1'))['db'];var config=require(_0xb21a('0x2'));var queryQueues={'attributes':['id',_0xb21a('0x3')],'include':[{'as':'Agents','model':db[_0xb21a('0x4')],'attributes':['id',_0xb21a('0x3'),_0xb21a('0x5')],'raw':!![],'where':{'role':_0xb21a('0x6')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id','name'],'where':{'role':_0xb21a('0x7')}};var queryTrunks={'raw':!![],'attributes':['id',_0xb21a('0x3')]};var queryAgents={'raw':!![],'attributes':['id','name'],'where':{'role':'agent'}};var queryCampaigns={'raw':!![],'attributes':['id',_0xb21a('0x3'),'type'],'where':{'type':_0xb21a('0x8')}};function getAssociatedResources(_0x223581,_0x52a426,_0xaf968b){return db[_0xb21a('0x9')][_0xb21a('0xa')]({'where':{'name':_0x223581,'userProfileId':_0x52a426},'raw':!![]})[_0xb21a('0xb')](function(_0x3df19a){if(_0x3df19a){if(_0x3df19a[_0xb21a('0xc')]){switch(_0x223581){case _0xb21a('0xd'):case _0xb21a('0xe'):case _0xb21a('0xf'):case _0xb21a('0x10'):case _0xb21a('0x11'):case'OpenchannelQueues':case'WhatsappQueues':return db[_0xaf968b]['findAll'](queryQueues);case _0xb21a('0x12'):return db[_0xaf968b]['findAll'](queryTelephones);case _0xb21a('0x13'):return db[_0xaf968b]['findAll'](queryTrunks);case'IvrCampaigns':return db[_0xaf968b][_0xb21a('0x14')](queryCampaigns);}}else{return db['UserProfileResource'][_0xb21a('0x14')]({'attributes':[_0xb21a('0x15')],'where':{'sectionId':_0x3df19a['id']},'raw':!![]})[_0xb21a('0xb')](function(_0xd1d9c2){if(_0xd1d9c2){var _0x156acc={'where':{'id':_[_0xb21a('0x16')](_0xd1d9c2,'resourceId')},'raw':!![]};switch(_0xaf968b){case _0xb21a('0x4'):_0x156acc[_0xb21a('0x17')]['role']=_0xb21a('0x7');break;case'Campaign':_0x156acc[_0xb21a('0x17')]['type']='ivr';break;}return db[_0xaf968b][_0xb21a('0x14')](_0x156acc);}else{return[];}});}}else{return[];}})[_0xb21a('0xb')](function(_0x341a24){return _0x341a24;});}function joinOrLeaveQueues(_0x194963,_0x1d162d,_0x3b30be,_0x4a17e5){_0x194963[_0x1d162d](util[_0xb21a('0x18')](_0xb21a('0x19'),_0x3b30be,_0x4a17e5[_0xb21a('0x3')]));if(_0x4a17e5[_0xb21a('0x1a')]){for(var _0x5eb05d=0x0;_0x5eb05d<_0x4a17e5['Agents'][_0xb21a('0x1b')];_0x5eb05d+=0x1){_0x194963[_0x1d162d](util[_0xb21a('0x18')](_0xb21a('0x1c'),_0x4a17e5[_0xb21a('0x1a')][_0x5eb05d][_0xb21a('0x3')]));}}}function joinOrLeave(_0x554892,_0x5e3279,_0x1952b6){var _0x368b70;if(_0x554892['handshake'][_0xb21a('0x1d')]['id']){db[_0xb21a('0x4')][_0xb21a('0x1e')]({'attributes':['id',_0xb21a('0x3'),_0xb21a('0x5'),'userProfileId'],'where':{'id':_0x554892[_0xb21a('0x1f')][_0xb21a('0x1d')]['id']},'include':[{'model':db[_0xb21a('0x20')],'as':_0xb21a('0x21'),'attributes':['id'],'raw':!![]},{'model':db[_0xb21a('0x22')],'as':'MailInteractions','attributes':['id'],'raw':!![]},{'model':db[_0xb21a('0x23')],'as':_0xb21a('0x24'),'attributes':['id'],'raw':!![]},{'model':db[_0xb21a('0x25')],'as':_0xb21a('0x26'),'attributes':['id'],'raw':!![]},{'model':db[_0xb21a('0x27')],'as':_0xb21a('0x28'),'attributes':['id'],'raw':!![]},{'model':db[_0xb21a('0x29')],'as':_0xb21a('0x2a'),'attributes':['id'],'raw':!![]}]})[_0xb21a('0xb')](function(_0x4e7e8c){if(_0x4e7e8c){_0x368b70=_0x4e7e8c;_0x554892[_0x5e3279](util[_0xb21a('0x18')]('user:%s',_0x4e7e8c[_0xb21a('0x3')]));var _0x5c72eb=[];switch(_0x4e7e8c[_0xb21a('0x5')]){case'admin':_0x554892[_0x5e3279](_0xb21a('0x2b'));_0x554892[_0x5e3279](_0xb21a('0x2c'));if(queryQueues[_0xb21a('0x2d')](_0xb21a('0x2e'))){delete queryQueues['include'];}_0x5c72eb[_0xb21a('0x2f')](db[_0xb21a('0x30')][_0xb21a('0x14')](queryQueues));_0x5c72eb[_0xb21a('0x2f')](db[_0xb21a('0x31')][_0xb21a('0x14')](queryQueues));_0x5c72eb['push'](db[_0xb21a('0x32')][_0xb21a('0x14')](queryQueues));_0x5c72eb['push'](db['SmsQueue'][_0xb21a('0x14')](queryQueues));_0x5c72eb[_0xb21a('0x2f')](db[_0xb21a('0x33')][_0xb21a('0x14')](queryQueues));_0x5c72eb[_0xb21a('0x2f')](db[_0xb21a('0x34')]['findAll'](queryQueues));_0x5c72eb[_0xb21a('0x2f')](db[_0xb21a('0x35')]['findAll'](queryQueues));_0x5c72eb[_0xb21a('0x2f')](db['User']['findAll'](queryTelephones));_0x5c72eb[_0xb21a('0x2f')](db[_0xb21a('0x36')][_0xb21a('0x14')](queryTrunks));_0x5c72eb[_0xb21a('0x2f')](db[_0xb21a('0x37')][_0xb21a('0x14')](queryCampaigns));_0x5c72eb['push'](db[_0xb21a('0x4')]['findAll'](queryAgents));break;case _0xb21a('0x38'):_0x554892[_0x5e3279](_0xb21a('0x2b'));_0x554892[_0x5e3279](_0xb21a('0x2c'));_0x5c72eb[_0xb21a('0x2f')](getAssociatedResources(_0xb21a('0xd'),_0x4e7e8c[_0xb21a('0x39')],_0xb21a('0x30')));_0x5c72eb[_0xb21a('0x2f')](getAssociatedResources('ChatQueues',_0x4e7e8c[_0xb21a('0x39')],_0xb21a('0x31')));_0x5c72eb['push'](getAssociatedResources(_0xb21a('0xf'),_0x4e7e8c[_0xb21a('0x39')],'FaxQueue'));_0x5c72eb[_0xb21a('0x2f')](getAssociatedResources(_0xb21a('0x10'),_0x4e7e8c[_0xb21a('0x39')],_0xb21a('0x3a')));_0x5c72eb[_0xb21a('0x2f')](getAssociatedResources(_0xb21a('0x11'),_0x4e7e8c[_0xb21a('0x39')],'MailQueue'));_0x5c72eb[_0xb21a('0x2f')](getAssociatedResources(_0xb21a('0x3b'),_0x4e7e8c[_0xb21a('0x39')],_0xb21a('0x34')));_0x5c72eb['push'](getAssociatedResources('WhatsappQueues',_0x4e7e8c[_0xb21a('0x39')],_0xb21a('0x35')));_0x5c72eb[_0xb21a('0x2f')](getAssociatedResources('Telephones',_0x4e7e8c['userProfileId'],_0xb21a('0x4')));_0x5c72eb[_0xb21a('0x2f')](getAssociatedResources('Trunks',_0x4e7e8c[_0xb21a('0x39')],_0xb21a('0x36')));_0x5c72eb[_0xb21a('0x2f')](getAssociatedResources(_0xb21a('0x3c'),_0x4e7e8c[_0xb21a('0x39')],_0xb21a('0x37')));_0x5c72eb[_0xb21a('0x2f')](db[_0xb21a('0x4')]['findAll'](queryAgents));break;case _0xb21a('0x6'):_0x554892[_0x5e3279](_0xb21a('0x2b'));_0x554892[_0x5e3279](_0xb21a('0x2c'));_0x5c72eb[_0xb21a('0x2f')](_0x4e7e8c[_0xb21a('0x3d')]({'attributes':['id',_0xb21a('0x3')]}));_0x5c72eb[_0xb21a('0x2f')](_0x4e7e8c[_0xb21a('0x3e')]({'attributes':['id',_0xb21a('0x3')]}));_0x5c72eb[_0xb21a('0x2f')](_0x4e7e8c[_0xb21a('0x3f')]({'attributes':['id',_0xb21a('0x3')]}));_0x5c72eb[_0xb21a('0x2f')](_0x4e7e8c[_0xb21a('0x40')]({'attributes':['id',_0xb21a('0x3')]}));_0x5c72eb['push'](_0x4e7e8c[_0xb21a('0x41')]({'attributes':['id',_0xb21a('0x3')]}));_0x5c72eb[_0xb21a('0x2f')](_0x4e7e8c[_0xb21a('0x42')]({'attributes':['id',_0xb21a('0x3')]}));_0x5c72eb[_0xb21a('0x2f')](_0x4e7e8c[_0xb21a('0x43')]({'attributes':['id',_0xb21a('0x3')]}));break;}return BPromise['all'](_0x5c72eb);}})['then'](function(_0x5b8036){if(_0x5b8036&&_0x5b8036[_0xb21a('0x1b')]){for(var _0x2d0829=0x0;_0x2d0829<_0x5b8036['length'];_0x2d0829+=0x1){for(var _0x28be41=0x0;_0x28be41<_0x5b8036[_0x2d0829][_0xb21a('0x1b')];_0x28be41+=0x1){switch(_0x2d0829){case 0x0:joinOrLeaveQueues(_0x554892,_0x5e3279,_0xb21a('0x44'),_0x5b8036[_0x2d0829][_0x28be41]);break;case 0x1:joinOrLeaveQueues(_0x554892,_0x5e3279,_0xb21a('0x45'),_0x5b8036[_0x2d0829][_0x28be41]);break;case 0x2:joinOrLeaveQueues(_0x554892,_0x5e3279,_0xb21a('0x46'),_0x5b8036[_0x2d0829][_0x28be41]);break;case 0x3:joinOrLeaveQueues(_0x554892,_0x5e3279,_0xb21a('0x47'),_0x5b8036[_0x2d0829][_0x28be41]);break;case 0x4:joinOrLeaveQueues(_0x554892,_0x5e3279,'mail',_0x5b8036[_0x2d0829][_0x28be41]);break;case 0x5:joinOrLeaveQueues(_0x554892,_0x5e3279,'openchannel',_0x5b8036[_0x2d0829][_0x28be41]);break;case 0x6:joinOrLeaveQueues(_0x554892,_0x5e3279,_0xb21a('0x48'),_0x5b8036[_0x2d0829][_0x28be41]);break;case 0x7:if(_0x368b70[_0xb21a('0x5')]!=='agent')_0x554892[_0x5e3279](util[_0xb21a('0x18')]('telephone:%s',_0x5b8036[_0x2d0829][_0x28be41][_0xb21a('0x3')]));break;case 0x8:if(_0x368b70[_0xb21a('0x5')]!==_0xb21a('0x6'))_0x554892[_0x5e3279](util[_0xb21a('0x18')](_0xb21a('0x49'),_0x5b8036[_0x2d0829][_0x28be41][_0xb21a('0x3')]));break;case 0x9:if(_0x368b70[_0xb21a('0x5')]!==_0xb21a('0x6'))_0x554892[_0x5e3279](util[_0xb21a('0x18')](_0xb21a('0x4a'),_0x5b8036[_0x2d0829][_0x28be41][_0xb21a('0x4b')],_0x5b8036[_0x2d0829][_0x28be41][_0xb21a('0x3')]));break;case 0xa:_0x554892[_0x5e3279](util[_0xb21a('0x18')](_0xb21a('0x1c'),_0x5b8036[_0x2d0829][_0x28be41]['name']));break;}}}}})[_0xb21a('0xb')](function(){if(_0x5e3279===_0xb21a('0x4c')){var _0x16b203=_['map'](_0x368b70[_0xb21a('0x21')],'id');return _0x368b70['removeChatInteractions'](_0x16b203)[_0xb21a('0xb')](function(){for(var _0x4952ee=0x0;_0x4952ee<_0x16b203[_0xb21a('0x1b')];_0x4952ee+=0x1){_0x1952b6[_0xb21a('0x4d')]('user_has_chat_interactions:remove',{'ChatInteractionId':Number(_0x16b203[_0x4952ee]),'UserId':Number(_0x368b70['id'])});}});}})[_0xb21a('0xb')](function(){if(_0x5e3279===_0xb21a('0x4c')){var _0x2cdddf=_[_0xb21a('0x16')](_0x368b70[_0xb21a('0x4e')],'id');return _0x368b70[_0xb21a('0x4f')](_0x2cdddf)[_0xb21a('0xb')](function(){for(var _0x3e09e1=0x0;_0x3e09e1<_0x2cdddf[_0xb21a('0x1b')];_0x3e09e1+=0x1){_0x1952b6[_0xb21a('0x4d')](_0xb21a('0x50'),{'MailInteractionId':Number(_0x2cdddf[_0x3e09e1]),'UserId':Number(_0x368b70['id'])});}});}})['then'](function(){if(_0x5e3279===_0xb21a('0x4c')){var _0x15da15=_[_0xb21a('0x16')](_0x368b70['FaxInteractions'],'id');return _0x368b70[_0xb21a('0x51')](_0x15da15)['then'](function(){for(var _0x264bf1=0x0;_0x264bf1<_0x15da15[_0xb21a('0x1b')];_0x264bf1+=0x1){_0x1952b6[_0xb21a('0x4d')](_0xb21a('0x52'),{'FaxInteractionId':Number(_0x15da15[_0x264bf1]),'UserId':Number(_0x368b70['id'])});}});}})['then'](function(){if(_0x5e3279===_0xb21a('0x4c')){var _0x378989=_[_0xb21a('0x16')](_0x368b70[_0xb21a('0x26')],'id');return _0x368b70[_0xb21a('0x53')](_0x378989)[_0xb21a('0xb')](function(){for(var _0x390262=0x0;_0x390262<_0x378989[_0xb21a('0x1b')];_0x390262+=0x1){_0x1952b6[_0xb21a('0x4d')](_0xb21a('0x54'),{'SmsInteractionId':Number(_0x378989[_0x390262]),'UserId':Number(_0x368b70['id'])});}});}})[_0xb21a('0xb')](function(){if(_0x5e3279===_0xb21a('0x4c')){var _0x246c5d=_['map'](_0x368b70[_0xb21a('0x28')],'id');return _0x368b70[_0xb21a('0x55')](_0x246c5d)[_0xb21a('0xb')](function(){for(var _0x16e84d=0x0;_0x16e84d<_0x246c5d['length'];_0x16e84d+=0x1){_0x1952b6['emit'](_0xb21a('0x56'),{'OpenchannelInteractionId':Number(_0x246c5d[_0x16e84d]),'UserId':Number(_0x368b70['id'])});}});}})['then'](function(){if(_0x5e3279===_0xb21a('0x4c')){var _0x2b9a2d=_[_0xb21a('0x16')](_0x368b70[_0xb21a('0x2a')],'id');return _0x368b70['removeWhatsappInteractions'](_0x2b9a2d)[_0xb21a('0xb')](function(){for(var _0x39d7a6=0x0;_0x39d7a6<_0x2b9a2d[_0xb21a('0x1b')];_0x39d7a6+=0x1){_0x1952b6['emit'](_0xb21a('0x57'),{'WhatsappInteractionId':Number(_0x2b9a2d[_0x39d7a6]),'UserId':Number(_0x368b70['id'])});}});}})[_0xb21a('0x58')](function(_0x5f9923){_0x554892[_0xb21a('0x59')](_0x5f9923);});}}function onDisconnect(_0x143634,_0x30ff63){joinOrLeave(_0x143634,_0xb21a('0x4c'),_0x30ff63);}function onConnect(_0x3a6553){joinOrLeave(_0x3a6553,_0xb21a('0x5a'));}exports[_0xb21a('0x5b')]=function(_0x142a19){_0x142a19['on'](_0xb21a('0x5c'),function(_0x1c8667){_0x1c8667['setMaxListeners'](0x0);_0x1c8667[_0xb21a('0x5d')]=_0x1c8667[_0xb21a('0x5e')][_0xb21a('0x5c')][_0xb21a('0x5f')]+':'+_0x1c8667[_0xb21a('0x5e')]['connection']['remotePort'];_0x1c8667[_0xb21a('0x60')]=new Date();_0x1c8667[_0xb21a('0x59')]=function(_0x40adaf){console[_0xb21a('0x59')]('SocketIO\x20'+_0x1c8667[_0xb21a('0x61')][_0xb21a('0x3')]+'['+_0x1c8667[_0xb21a('0x5d')]+']',_0x40adaf);};_0x1c8667['on'](_0xb21a('0x62'),function(){onDisconnect(_0x1c8667,_0x142a19);_0x1c8667[_0xb21a('0x59')]('DISCONNECTED');});onConnect(_0x1c8667);_0x1c8667[_0xb21a('0x59')](_0xb21a('0x63'));});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index b8ecf0c..d1c08df 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 _0x0060=['Sequelize','contact','changed','closed','find','internal','length','hasOwnProperty','model','hook','toLowerCase','../../mysqldb','jayson/promise','../logger','triggers','client','Chat','ChatInteraction','afterCreate','afterUpdate','closedinteraction','ChatMessage','newmessage','Sms','newinteraction','SmsInteraction','SmsMessage','Whatsapp','WhatsappInteraction','WhatsappMessage','Fax','FaxInteraction','FaxMessage','Mail','MailInteraction','substatus','MailMessage','Openchannel','OpenchannelInteraction','OpenchannelMessage','request','then','EventManager','error','code','catch','Trigger,\x20%s','get','event','direction','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','QueryTypes','SELECT','UserId','User','name','fullname','email','interface','format','SIP/%s','channel','agent','incomingmessage','outgoingmessage','motionChannel','query'];(function(_0x9e579d,_0xac069c){var _0x3e6411=function(_0x580826){while(--_0x580826){_0x9e579d['push'](_0x9e579d['shift']());}};_0x3e6411(++_0xac069c);}(_0x0060,0xda));var _0x0006=function(_0x4595ac,_0x4a6c83){_0x4595ac=_0x4595ac-0x0;var _0x13c73c=_0x0060[_0x4595ac];return _0x13c73c;};'use strict';var util=require('util');var db=require(_0x0006('0x0'))['db'];var jayson=require(_0x0006('0x1'));var logger=require(_0x0006('0x2'))(_0x0006('0x3'));var _=require('lodash');var client=jayson[_0x0006('0x4')]['http']({'port':0x232a});var triggers=[{'channel':_0x0006('0x5'),'model':_0x0006('0x6'),'event':_0x0006('0x7'),'condition':'newinteraction','callback':afterCreate},{'channel':'Chat','model':_0x0006('0x6'),'event':_0x0006('0x8'),'condition':_0x0006('0x9'),'callback':afterUpdate},{'channel':'Chat','model':_0x0006('0xa'),'event':'afterCreate','condition':_0x0006('0xb'),'callback':afterCreateMessage},{'channel':_0x0006('0xc'),'model':'SmsInteraction','event':_0x0006('0x7'),'condition':_0x0006('0xd'),'callback':afterCreate},{'channel':_0x0006('0xc'),'model':_0x0006('0xe'),'event':_0x0006('0x8'),'condition':'closedinteraction','callback':afterUpdate},{'channel':_0x0006('0xc'),'model':_0x0006('0xf'),'event':'afterCreate','condition':'newmessage','callback':afterCreateMessage},{'channel':_0x0006('0x10'),'model':_0x0006('0x11'),'event':_0x0006('0x7'),'condition':_0x0006('0xd'),'callback':afterCreate},{'channel':'Whatsapp','model':_0x0006('0x11'),'event':_0x0006('0x8'),'condition':'closedinteraction','callback':afterUpdate},{'channel':_0x0006('0x10'),'model':_0x0006('0x12'),'event':_0x0006('0x7'),'condition':'newmessage','callback':afterCreateMessage},{'channel':_0x0006('0x13'),'model':_0x0006('0x14'),'event':'afterCreate','condition':_0x0006('0xd'),'callback':afterCreate},{'channel':_0x0006('0x13'),'model':_0x0006('0x14'),'event':_0x0006('0x8'),'condition':_0x0006('0x9'),'callback':afterUpdate},{'channel':_0x0006('0x13'),'model':_0x0006('0x15'),'event':'afterCreate','condition':_0x0006('0xb'),'callback':afterCreateMessage},{'channel':_0x0006('0x16'),'model':_0x0006('0x17'),'event':_0x0006('0x7'),'condition':_0x0006('0xd'),'callback':afterCreate},{'channel':_0x0006('0x16'),'model':_0x0006('0x17'),'event':'afterUpdate','condition':_0x0006('0x9'),'callback':afterUpdate},{'channel':_0x0006('0x16'),'model':_0x0006('0x17'),'event':'substatus','condition':_0x0006('0x18'),'callback':afterUpdate},{'channel':_0x0006('0x16'),'model':_0x0006('0x19'),'event':_0x0006('0x7'),'condition':_0x0006('0xb'),'callback':afterCreateMessage},{'channel':_0x0006('0x1a'),'model':_0x0006('0x1b'),'event':_0x0006('0x7'),'condition':_0x0006('0xd'),'callback':afterCreate},{'channel':'Openchannel','model':'OpenchannelInteraction','event':'afterUpdate','condition':_0x0006('0x9'),'callback':afterUpdate},{'channel':_0x0006('0x1a'),'model':_0x0006('0x1c'),'event':_0x0006('0x7'),'condition':_0x0006('0xb'),'callback':afterCreateMessage}];function request(_0x3218e0){return client[_0x0006('0x1d')]('EventManager',_0x3218e0)[_0x0006('0x1e')](function(_0x4424e5){logger['info']('Trigger,\x20%s',_0x0006('0x1f'),_0x4424e5);if(_0x4424e5[_0x0006('0x20')]){if(_0x4424e5[_0x0006('0x20')][_0x0006('0x21')]===0x1f4){logger[_0x0006('0x20')]('Trigger,\x20%s',_0x0006('0x1f'),_0x4424e5[_0x0006('0x20')]);}}})[_0x0006('0x22')](function(_0x57c1d9){logger[_0x0006('0x20')](_0x0006('0x23'),_0x0006('0x1f'),_0x57c1d9);});}function afterCreateMessage(_0x221d8d,_0x3b5ef9){return function(_0x21a73d,_0x4fad7b){_0x21a73d=_0x21a73d[_0x0006('0x24')]({'plain':!![]});_0x21a73d['channel']=_0x221d8d;_0x21a73d['motionChannel']=_0x221d8d;_0x21a73d[_0x0006('0x25')]=_0x21a73d[_0x0006('0x26')];var _0x29dbf8=_0x0006('0x27')+_0x21a73d[_0x0006('0x28')];return db[_0x0006('0x29')]['query'](_0x29dbf8,{'type':db['Sequelize'][_0x0006('0x2a')][_0x0006('0x2b')],'raw':!![]})[_0x0006('0x1e')](function(_0x155767){return _0x155767;})['then'](function(_0xc460e){if(_0xc460e){_0x21a73d['contact']=_0xc460e[0x0];}if(_0x21a73d[_0x0006('0x2c')]){return db[_0x0006('0x2d')]['find']({'where':{'id':_0x21a73d[_0x0006('0x2c')]},'attributes':['id',_0x0006('0x2e'),_0x0006('0x2f'),_0x0006('0x30'),'internal'],'raw':!![]})[_0x0006('0x1e')](function(_0x37cf43){_0x21a73d[_0x0006('0x31')]=util[_0x0006('0x32')](_0x0006('0x33'),_0x37cf43[_0x0006('0x2e')]);_0x21a73d[_0x0006('0x34')]=_0x221d8d;_0x21a73d[_0x0006('0x35')]=_0x37cf43;return request({'event':_0x0006('0x36'),'message':_0x21a73d});})[_0x0006('0x22')](function(_0x38faa9){console['error'](_0x38faa9);});}else{return request({'event':_0x0006('0x37'),'message':_0x21a73d});}});};}function afterCreate(_0x28ad9e,_0x479d75){return function(_0x5119ca,_0x439ac4){_0x5119ca=_0x5119ca[_0x0006('0x24')]({'plain':!![]});_0x5119ca['channel']=_0x28ad9e;_0x5119ca[_0x0006('0x38')]=_0x28ad9e;_0x5119ca['event']='opened';var _0x4d5af9=_0x0006('0x27')+_0x5119ca[_0x0006('0x28')];return db[_0x0006('0x29')][_0x0006('0x39')](_0x4d5af9,{'type':db[_0x0006('0x3a')][_0x0006('0x2a')][_0x0006('0x2b')],'raw':!![]})[_0x0006('0x1e')](function(_0x5009b4){return _0x5009b4;})[_0x0006('0x1e')](function(_0x54fc76){if(_0x54fc76){_0x5119ca[_0x0006('0x3b')]=_0x54fc76[0x0];}return request({'event':_0x479d75,'message':_0x5119ca});});};}function afterUpdate(_0x5e0173,_0x3a8b6e){return function(_0x4679a3,_0x432a87){if(_0x4679a3[_0x0006('0x3c')](_0x0006('0x3d'))&&_0x4679a3['closed']){_0x4679a3=_0x4679a3[_0x0006('0x24')]({'plain':!![]});_0x4679a3[_0x0006('0x34')]=_0x5e0173;_0x4679a3['motionChannel']=_0x5e0173;_0x4679a3[_0x0006('0x25')]=_0x0006('0x3d');var _0x312b85=_0x0006('0x27')+_0x4679a3[_0x0006('0x28')];return db[_0x0006('0x29')][_0x0006('0x39')](_0x312b85,{'type':db[_0x0006('0x3a')][_0x0006('0x2a')][_0x0006('0x2b')],'raw':!![]})['then'](function(_0x105c37){return _0x105c37;})[_0x0006('0x1e')](function(_0x53761f){if(_0x53761f){_0x4679a3[_0x0006('0x3b')]=_0x53761f[0x0];}if(_0x4679a3['UserId']){return db[_0x0006('0x2d')][_0x0006('0x3e')]({'where':{'id':_0x4679a3[_0x0006('0x2c')]},'attributes':['id',_0x0006('0x2e'),_0x0006('0x2f'),'email',_0x0006('0x3f')],'raw':!![]})[_0x0006('0x1e')](function(_0x4e8ac8){_0x4679a3[_0x0006('0x31')]=util[_0x0006('0x32')](_0x0006('0x33'),_0x4e8ac8[_0x0006('0x2e')]);_0x4679a3[_0x0006('0x35')]=_0x4e8ac8;return request({'event':_0x3a8b6e,'message':_0x4679a3});})[_0x0006('0x22')](function(_0xe9d515){console['error'](_0xe9d515);});}else{return request({'event':_0x3a8b6e,'message':_0x4679a3});}});}else if(_0x4679a3[_0x0006('0x3c')](_0x0006('0x18'))){_0x4679a3=_0x4679a3['get']({'plain':!![]});_0x4679a3[_0x0006('0x34')]=_0x5e0173;_0x4679a3[_0x0006('0x25')]=_0x0006('0x18');var _0x312b85=_0x0006('0x27')+_0x4679a3['ContactId'];return db['sequelize'][_0x0006('0x39')](_0x312b85,{'type':db['Sequelize'][_0x0006('0x2a')][_0x0006('0x2b')],'raw':!![]})['then'](function(_0x340ec6){return _0x340ec6;})[_0x0006('0x1e')](function(_0x549d63){if(_0x549d63){_0x4679a3[_0x0006('0x3b')]=_0x549d63[0x0];}if(_0x4679a3[_0x0006('0x2c')]){return db['User']['find']({'where':{'id':_0x4679a3[_0x0006('0x2c')]},'attributes':['id',_0x0006('0x2e'),_0x0006('0x2f'),_0x0006('0x30'),_0x0006('0x3f')],'raw':!![]})[_0x0006('0x1e')](function(_0x1f3d93){_0x4679a3[_0x0006('0x31')]=util[_0x0006('0x32')](_0x0006('0x33'),_0x1f3d93[_0x0006('0x2e')]);_0x4679a3[_0x0006('0x35')]=_0x1f3d93;return request({'event':_0x3a8b6e,'message':_0x4679a3});})[_0x0006('0x22')](function(_0x18ced9){console[_0x0006('0x20')](_0x18ced9);});}else{return request({'event':_0x3a8b6e,'message':_0x4679a3});}});}};}exports['default']=function(){for(var _0x1e336c=0x0;_0x1e336c=_0x1df3f6[_0x0f44('0x14')]){throw Error(_0x0f44('0x15'));}_0x1bec06(_0x23889f);})[_0x0f44('0x16')](function(_0x8a9805){_0x31c314(_0x8a9805);});});}; \ No newline at end of file +var _0x48ec=['chat','fax','sms','openchannel','isValidChannel','includes','clearBlockUser','isUndefined','blockedAt','updateAttributes','getLicense','role','agent','User','count','then','agents','Maximum\x20login\x20has\x20been\x20reached','catch','bluebird','../mysqldb','./license/util','voice','mail'];(function(_0x14d545,_0x1164cb){var _0x39fd5d=function(_0x30dfaa){while(--_0x30dfaa){_0x14d545['push'](_0x14d545['shift']());}};_0x39fd5d(++_0x1164cb);}(_0x48ec,0x17b));var _0xc48e=function(_0x333714,_0x3370ac){_0x333714=_0x333714-0x0;var _0x4c211e=_0x48ec[_0x333714];return _0x4c211e;};'use strict';var _=require('lodash');var BPromise=require(_0xc48e('0x0'));var db=require(_0xc48e('0x1'))['db'];var util=require(_0xc48e('0x2'));var channels=[_0xc48e('0x3'),_0xc48e('0x4'),_0xc48e('0x5'),_0xc48e('0x6'),_0xc48e('0x7'),'whatsapp',_0xc48e('0x8')];exports['getChannels']=function(){return channels;};exports[_0xc48e('0x9')]=function(_0x1d3986){_0x1d3986=_0x1d3986['toLowerCase']();return _[_0xc48e('0xa')](channels,_0x1d3986);};exports[_0xc48e('0xb')]=function(_0x59b779,_0x29d15a,_0x1f41ac,_0x52fd9a){var _0x207044={'loginAttempts':_0x29d15a,'blocked':_0x1f41ac};if(!_[_0xc48e('0xc')](_0x52fd9a)){_0x207044[_0xc48e('0xd')]=_0x52fd9a;}return _0x59b779[_0xc48e('0xe')](_0x207044);};exports[_0xc48e('0xf')]=function(_0x2625d9){return new BPromise(function(_0x3f0e8e,_0x27ded3){var _0x576953=0x0;if(_0x2625d9[_0xc48e('0x10')]!==_0xc48e('0x11')){_0x3f0e8e(_0x2625d9);}db[_0xc48e('0x12')][_0xc48e('0x13')]({'where':{'role':_0xc48e('0x11'),'online':!![],'id':{'$ne':_0x2625d9['id']}}})[_0xc48e('0x14')](function(_0x517988){_0x576953=_0x517988;return util[_0xc48e('0xf')]();})[_0xc48e('0x14')](function(_0x513d3c){if(_0x513d3c&&_0x513d3c[_0xc48e('0x15')]&&_0x576953>=_0x513d3c[_0xc48e('0x15')]){throw Error(_0xc48e('0x16'));}_0x3f0e8e(_0x2625d9);})[_0xc48e('0x17')](function(_0x36dd82){_0x27ded3(_0x36dd82);});});}; \ No newline at end of file diff --git a/server/errors/index.js b/server/errors/index.js index b66e218..a237cd8 100644 --- a/server/errors/index.js +++ b/server/errors/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x65d2=['status','render','json','send','exports','404'];(function(_0x10545c,_0x437d83){var _0x140729=function(_0x4e4e8e){while(--_0x4e4e8e){_0x10545c['push'](_0x10545c['shift']());}};_0x140729(++_0x437d83);}(_0x65d2,0xb8));var _0x265d=function(_0x1045d6,_0x2493f7){_0x1045d6=_0x1045d6-0x0;var _0x13770f=_0x65d2[_0x1045d6];return _0x13770f;};'use strict';module[_0x265d('0x0')][0x194]=function pageNotFound(_0x29ddde,_0x51b2e5){var _0x1dc156=_0x265d('0x1');var _0x3a315b=0x194;var _0x59c81e={'status':_0x3a315b};_0x51b2e5[_0x265d('0x2')](_0x59c81e[_0x265d('0x2')]);_0x51b2e5[_0x265d('0x3')](_0x1dc156,{},function(_0x579b25,_0x3e4ca8){if(_0x579b25){return _0x51b2e5[_0x265d('0x2')](_0x59c81e[_0x265d('0x2')])[_0x265d('0x4')](_0x59c81e);}_0x51b2e5[_0x265d('0x5')](_0x3e4ca8);});}; \ No newline at end of file +var _0xa988=['status','render','send','exports','404'];(function(_0x2867d8,_0xef3ee0){var _0x3b8176=function(_0x2b9eb8){while(--_0x2b9eb8){_0x2867d8['push'](_0x2867d8['shift']());}};_0x3b8176(++_0xef3ee0);}(_0xa988,0x1a7));var _0x8a98=function(_0x38abfa,_0x27933f){_0x38abfa=_0x38abfa-0x0;var _0x30ca18=_0xa988[_0x38abfa];return _0x30ca18;};'use strict';module[_0x8a98('0x0')][0x194]=function pageNotFound(_0x3d6ea0,_0x3441ea){var _0x281c23=_0x8a98('0x1');var _0x59970e=0x194;var _0x14901a={'status':_0x59970e};_0x3441ea[_0x8a98('0x2')](_0x14901a[_0x8a98('0x2')]);_0x3441ea[_0x8a98('0x3')](_0x281c23,{},function(_0x3b1af2,_0x28a583){if(_0x3b1af2){return _0x3441ea[_0x8a98('0x2')](_0x14901a[_0x8a98('0x2')])['json'](_0x14901a);}_0x3441ea[_0x8a98('0x4')](_0x28a583);});}; \ No newline at end of file diff --git a/server/mysqldb/index.js b/server/mysqldb/index.js index e16d529..0e80863 100644 --- a/server/mysqldb/index.js +++ b/server/mysqldb/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x528e=['VoiceExtension','HopperFinals','OpenchannelInteractions','ChatInteractions','SmsInteraction','SmsInteractions','FaxInteractions','MailInteractions','UserNotifications','belongsTo','UserProfile','belongsToMany','Groups','chat_group_has_users','Contacts','cm_user_has_contacts','cm_user_has_lists','Team','user_has_teams','user_has_mail_interactions','user_has_chat_interactions','user_has_fax_interactions','user_has_sms_interactions','user_has_openchannel_interactions','WhatsappInteractions','VoiceQueues','VoicePrefixes','ChatQueue','ChatQueues','FaxQueues','SmsQueues','UserSmsQueue','WhatsappQueue','WhatsappQueues','UserWhatsappQueue','user_has_voice_prefixes','ChatWebsites','user_has_chat_websites','FaxAccounts','user_has_fax_accounts','MailAccounts','user_has_mail_accounts','OpenchannelAccounts','user_has_openchannel_accounts','SmsAccounts','user_has_sms_accounts','WhatsappAccounts','user_has_whatsapp_accounts','SquareProjects','user_has_square_projects','ChanSpyId','Applications','VoiceMusicOnHold','Sounds','moh_has_sounds','Members','VoiceQueueId','Hoppers','CmHopperFinal','HopperHistories','JscriptySessions','TrunkId','TrunkBackupId','IntervalId','Pause','mandatoryDispositionPause','mandatoryDispositionPauseId','voice_queues_has_cm_lists','Agents','Teams','BlackLists','Messages','mailboxuser','mailbox','QueueCalls','AgentReports','uniqueid','Contact','ContactId','MailServerIn','MailAccountId','hasOne','Imap','Smtp','Dispositions','CannedAnswer','Answers','Interactions','ListId','TemplateId','team_has_mail_queues','MailInteractionId','Account','Owner','Tags','ThroughTags','Users','Attachment','Attachments','Interaction','ChatOfflineMessageId','restrict','List','DashboardItem','Items','FaxAccountId','Exntensions','TagId','fax_interaction_has_tags','FaxInteractionId','AttachmentId','team_has_fax_queues','FaxQueueReport','SmsMessage','SmsAccountId','SmsInteractionId','sms_interaction_has_tags','SmsQueue','SmsQueueId','OpenchannelAccountId','OpenchannelQueueId','openchannel_interaction_has_tags','OpenchannelInteractionId','team_has_openchannel_queues','ChatWebsiteId','Queue','Website','chat_interaction_has_tags','ChatInteractionId','team_has_chat_queues','ChatGroupId','CmCompany','CompanyId','Company','cm_contact_has_tags','Agent','CampaignId','OwnerId','CmHopperBlack','All','OneAll','AutomationAllId','OneAny','AutomationAnyId','Actions','AutomationId','ParentId','Intervals','Extensions','MailApplications','FaxApplications','SmsApplications','Schedule','DefaultReportId','CustomReportId','Sound','Mohs','mail_interaction_has_tags','whatsapp_interaction_has_tags','Trigger','AllConditions','TriggerAllId','AnyCondition','TriggerAnyId','TriggerId','Fields','MetricId','Configurations','AccountId','Subjects','SubjectId','Descriptions','DescriptionId','FieldId','Subject','Description','VariableId','SugarcrmAccount','SugarcrmField','Field','int_desk_configuration_has_tags','ZohoConfiguration','int_zendesk_configuration_has_tags','int_freshdesk_configuration_has_tags','ServicenowAccount','FreshsalesField','FromId','ToId','SessionId','ProjectId','MailQueues','team_has_sms_queues','HopperBlacks','TrunkBackup','Lists','campaigns_has_cm_lists','FromMailAccountId','FromAccount','ToUserId','ToAgent','ToQueue','ToMailAccountId','ToAccount','ChatTransferReport','FromUserId','FromAgent','ToChatQueueId','ToChatWebsiteId','FromFaxAccountId','ToFaxQueueId','ToFaxAccountId','ToOpenchannelQueueId','FromSmsAccountId','CustomFields','HopperHistory','Queues','userProfileId','UserProfileSection','UserProfileSections','Resources','sectionId','WhatsappAccountId','user_has_whatsapp_interactions','WhatsappInteractionId','FromWhatsappAccountId','ToWhatsappAccountId','ToQueueId','WhatsappQueueId','team_has_whatsapp_queues','../config/environment','sequelize','jstz','determine','motion2','127.0.0.1','mysql','utf8mb4','name','utf8','utf8_general_ci','sequelizeHistory','defaultsDeep','xcall','xC@LL1234','database','username','password','options','User','import','../api/user/user.model','VoiceChanSpy','../api/voiceChanSpy/voiceChanSpy.model','VoiceContext','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','ScreenRecording','../api/screenRecording/screenRecording.model','../api/voiceMail/voiceMail.model','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','VoiceCallReport','../api/voiceCallReport/voiceCallReport.model','VoiceAgentReport','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','../api/memberReport/memberReport.model','Trunk','../api/trunk/trunk.model','UserVoiceQueue','UserChatQueue','UserMailQueue','../api/userMailQueue/userMailQueue.model','../api/userFaxQueue/userFaxQueue.model','../api/userSmsQueue/userSmsQueue.model','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','../api/userWhatsappQueue/userWhatsappQueue.model','../api/mailServerIn/mailServerIn.model','MailServerOut','../api/mailServerOut/mailServerOut.model','MailAccount','MailQueue','MailSubstatus','MailInteraction','../api/mailInteraction/mailInteraction.model','MailMessage','../api/mailMessage/mailMessage.model','MailApplication','../api/mailApplication/mailApplication.model','MailQueueReport','../api/mailQueueReport/mailQueueReport.model','Dashboard','FaxAccount','../api/faxAccount/faxAccount.model','FaxApplication','FaxInteraction','FaxMessage','../api/faxMessage/faxMessage.model','FaxQueue','../api/faxQueueReport/faxQueueReport.model','SmsAccount','SmsApplication','../api/smsApplication/smsApplication.model','../api/smsInteraction/smsInteraction.model','../api/smsQueue/smsQueue.model','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','OpenchannelMessage','../api/openchannelMessage/openchannelMessage.model','OpenchannelQueue','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','ChatApplication','../api/chatApplication/chatApplication.model','ChatInteraction','../api/chatInteraction/chatInteraction.model','ChatMessage','../api/chatMessage/chatMessage.model','ChatOfflineMessage','../api/chatOfflineMessage/chatOfflineMessage.model','../api/chatQueue/chatQueue.model','ChatGroup','ChatProactiveAction','../api/chatProactiveAction/chatProactiveAction.model','../api/cmCompany/cmCompany.model','CmContact','CmHopper','../api/cmHopper/cmHopper.model','../api/cmHopperBlack/cmHopperBlack.model','../api/cmHopperFinal/cmHopperFinal.model','CmHopperHistory','ReportAgentPreview','../api/reportAgentPreview/reportAgentPreview.model','CmCustomField','../api/cmCustomField/cmCustomField.model','Action','../api/action/action.model','Automation','../api/automation/automation.model','../api/cannedAnswer/cannedAnswer.model','Disposition','Condition','Interval','../api/pause/pause.model','Cdr','../api/cdr/cdr.model','VoiceQueuesLog','../api/voiceQueuesLog/voiceQueuesLog.model','../api/schedule/schedule.model','Tag','../api/tag/tag.model','Template','../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','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','../api/intSalesforceField/intSalesforceField.model','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','../api/intSugarcrmField/intSugarcrmField.model','DeskAccount','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','../api/intDeskField/intDeskField.model','../api/intZohoAccount/intZohoAccount.model','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','../api/intZohoField/intZohoField.model','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','ZendeskConfiguration','ZendeskField','../api/intZendeskField/intZendeskField.model','FreshdeskAccount','FreshdeskConfiguration','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','VtigerAccount','VtigerConfiguration','../api/intVtigerConfiguration/intVtigerConfiguration.model','VtigerField','../api/intVtigerField/intVtigerField.model','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','ServicenowField','../api/intServicenowField/intServicenowField.model','Dynamics365Account','../api/intDynamics365Account/intDynamics365Account.model','Dynamics365Configuration','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','../api/intFreshsalesField/intFreshsalesField.model','Network','../api/network/network.model','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','../api/chatInternalMessage/chatInternalMessage.model','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','JscriptyQuestionReport','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','SquareReport','../api/squareReportDetail/squareReportDetail.model','JscriptyProject','Setting','../api/setting/setting.model','../api/squareOdbc/squareOdbc.model','SquareProject','SquareRecording','../api/squareRecording/squareRecording.model','../api/squareMessage/squareMessage.model','../api/team/team.model','../api/license/license.model','Campaign','../api/campaign/campaign.model','Migration','../api/migration/migration.model','../api/attachment/attachment.model','Plugin','../api/plugin/plugin.model','MailTransferReport','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','CmList','VoicePrefix','../api/voicePrefix/voicePrefix.model','../api/userProfile/userProfile.model','UserProfileResource','../api/userProfileResource/userProfileResource.model','UserNotification','../api/userNotification/userNotification.model','WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','../api/whatsappMessage/whatsappMessage.model','WhatsappQueueReport','WhatsappTransferReport','../api/whatsappQueue/whatsappQueue.model','../api/teamVoiceQueue/teamVoiceQueue.model','TeamVoicePrefix','../api/teamVoicePrefix/teamVoicePrefix.model','UserVoicePrefix','VoiceMail','cascade','VoiceRecording','Recordings','UserId','hasMany','UserVoiceQueueRt'];(function(_0x126f62,_0x470f78){var _0x34e3c6=function(_0x24d630){while(--_0x24d630){_0x126f62['push'](_0x126f62['shift']());}};_0x34e3c6(++_0x470f78);}(_0x528e,0xe5));var _0xe528=function(_0xf76211,_0x2fa5eb){_0xf76211=_0xf76211-0x0;var _0x3dc224=_0x528e[_0xf76211];return _0x3dc224;};'use strict';var config=require(_0xe528('0x0'));var Sequelize=require(_0xe528('0x1'));var _=require('lodash');var jstz=require(_0xe528('0x2'));var timezone=jstz[_0xe528('0x3')]();config[_0xe528('0x1')]=_['defaultsDeep'](config[_0xe528('0x1')],{'database':_0xe528('0x4'),'username':'xcall','password':'xC@LL1234','options':{'host':_0xe528('0x5'),'port':0xcea,'dialect':_0xe528('0x6'),'dialectOptions':{'charset':_0xe528('0x7')},'logging':![],'timezone':timezone[_0xe528('0x8')](),'define':{'charset':_0xe528('0x9'),'collate':_0xe528('0xa')}}});config[_0xe528('0xb')]=_[_0xe528('0xc')](config['sequelizeHistory'],{'database':_0xe528('0x4'),'username':_0xe528('0xd'),'password':_0xe528('0xe'),'options':{'host':'127.0.0.1','port':0xcea,'dialect':_0xe528('0x6'),'dialectOptions':{'charset':_0xe528('0x7')},'logging':![],'timezone':timezone[_0xe528('0x8')](),'define':{'charset':_0xe528('0x9'),'collate':_0xe528('0xa')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelize'][_0xe528('0xf')],config[_0xe528('0x1')][_0xe528('0x10')],config['sequelize'][_0xe528('0x11')],config[_0xe528('0x1')][_0xe528('0x12')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0xe528('0xb')][_0xe528('0xf')],config[_0xe528('0xb')][_0xe528('0x10')],config[_0xe528('0xb')][_0xe528('0x11')],config[_0xe528('0xb')][_0xe528('0x12')])};db[_0xe528('0x13')]=db[_0xe528('0x1')][_0xe528('0x14')](_0xe528('0x15'));db[_0xe528('0x16')]=db[_0xe528('0x1')][_0xe528('0x14')](_0xe528('0x17'));db[_0xe528('0x18')]=db[_0xe528('0x1')][_0xe528('0x14')]('../api/voiceContext/voiceContext.model');db['VoiceExtension']=db[_0xe528('0x1')][_0xe528('0x14')]('../api/voiceExtension/voiceExtension.model');db['VoiceMusicOnHold']=db[_0xe528('0x1')][_0xe528('0x14')](_0xe528('0x19'));db[_0xe528('0x1a')]=db['sequelize'][_0xe528('0x14')](_0xe528('0x1b'));db['VoiceRecording']=db[_0xe528('0x1')][_0xe528('0x14')]('../api/voiceRecording/voiceRecording.model');db[_0xe528('0x1c')]=db['sequelize']['import'](_0xe528('0x1d'));db['VoiceMail']=db['sequelize'][_0xe528('0x14')](_0xe528('0x1e'));db[_0xe528('0x1f')]=db[_0xe528('0x1')][_0xe528('0x14')](_0xe528('0x20'));db[_0xe528('0x21')]=db[_0xe528('0x1')]['import'](_0xe528('0x22'));db['VoiceDialReport']=db[_0xe528('0x1')][_0xe528('0x14')]('../api/voiceDialReport/voiceDialReport.model');db[_0xe528('0x23')]=db['sequelize'][_0xe528('0x14')](_0xe528('0x24'));db[_0xe528('0x25')]=db[_0xe528('0x1')]['import']('../api/voiceQueueReport/voiceQueueReport.model');db['MemberReport']=db[_0xe528('0x1')][_0xe528('0x14')](_0xe528('0x26'));db[_0xe528('0x27')]=db[_0xe528('0x1')][_0xe528('0x14')](_0xe528('0x28'));db['VoiceTransferReport']=db[_0xe528('0x1')][_0xe528('0x14')]('../api/voiceTransferReport/voiceTransferReport.model');db['UserVoiceQueueRt']=db['sequelize'][_0xe528('0x14')]('../api/userVoiceQueueRt/userVoiceQueueRt.model');db[_0xe528('0x29')]=db[_0xe528('0x1')][_0xe528('0x14')]('../api/userVoiceQueue/userVoiceQueue.model');db[_0xe528('0x2a')]=db['sequelize'][_0xe528('0x14')]('../api/userChatQueue/userChatQueue.model');db[_0xe528('0x2b')]=db['sequelize'][_0xe528('0x14')](_0xe528('0x2c'));db['UserFaxQueue']=db[_0xe528('0x1')][_0xe528('0x14')](_0xe528('0x2d'));db['UserSmsQueue']=db['sequelize']['import'](_0xe528('0x2e'));db[_0xe528('0x2f')]=db[_0xe528('0x1')]['import'](_0xe528('0x30'));db['UserWhatsappQueue']=db['sequelize'][_0xe528('0x14')](_0xe528('0x31'));db['MailServerIn']=db[_0xe528('0x1')][_0xe528('0x14')](_0xe528('0x32'));db[_0xe528('0x33')]=db[_0xe528('0x1')]['import'](_0xe528('0x34'));db[_0xe528('0x35')]=db['sequelize'][_0xe528('0x14')]('../api/mailAccount/mailAccount.model');db[_0xe528('0x36')]=db[_0xe528('0x1')][_0xe528('0x14')]('../api/mailQueue/mailQueue.model');db[_0xe528('0x37')]=db[_0xe528('0x1')][_0xe528('0x14')]('../api/mailSubstatus/mailSubstatus.model');db[_0xe528('0x38')]=db[_0xe528('0x1')][_0xe528('0x14')](_0xe528('0x39'));db[_0xe528('0x3a')]=db[_0xe528('0x1')][_0xe528('0x14')](_0xe528('0x3b'));db[_0xe528('0x3c')]=db[_0xe528('0x1')][_0xe528('0x14')](_0xe528('0x3d'));db[_0xe528('0x3e')]=db[_0xe528('0x1')][_0xe528('0x14')](_0xe528('0x3f'));db[_0xe528('0x40')]=db['sequelize'][_0xe528('0x14')]('../api/dashboard/dashboard.model');db['DashboardItem']=db['sequelize'][_0xe528('0x14')]('../api/dashboardItem/dashboardItem.model');db[_0xe528('0x41')]=db['sequelize']['import'](_0xe528('0x42'));db[_0xe528('0x43')]=db[_0xe528('0x1')][_0xe528('0x14')]('../api/faxApplication/faxApplication.model');db[_0xe528('0x44')]=db['sequelize'][_0xe528('0x14')]('../api/faxInteraction/faxInteraction.model');db[_0xe528('0x45')]=db[_0xe528('0x1')][_0xe528('0x14')](_0xe528('0x46'));db[_0xe528('0x47')]=db['sequelize'][_0xe528('0x14')]('../api/faxQueue/faxQueue.model');db['FaxQueueReport']=db[_0xe528('0x1')][_0xe528('0x14')](_0xe528('0x48'));db[_0xe528('0x49')]=db[_0xe528('0x1')][_0xe528('0x14')]('../api/smsAccount/smsAccount.model');db[_0xe528('0x4a')]=db['sequelize'][_0xe528('0x14')](_0xe528('0x4b'));db['SmsInteraction']=db[_0xe528('0x1')][_0xe528('0x14')](_0xe528('0x4c'));db['SmsMessage']=db[_0xe528('0x1')][_0xe528('0x14')]('../api/smsMessage/smsMessage.model');db['SmsQueue']=db[_0xe528('0x1')][_0xe528('0x14')](_0xe528('0x4d'));db[_0xe528('0x4e')]=db['sequelize']['import'](_0xe528('0x4f'));db[_0xe528('0x50')]=db[_0xe528('0x1')][_0xe528('0x14')](_0xe528('0x51'));db[_0xe528('0x52')]=db[_0xe528('0x1')][_0xe528('0x14')]('../api/openchannelInteraction/openchannelInteraction.model');db[_0xe528('0x53')]=db['sequelize'][_0xe528('0x14')](_0xe528('0x54'));db[_0xe528('0x55')]=db[_0xe528('0x1')][_0xe528('0x14')](_0xe528('0x56'));db[_0xe528('0x57')]=db[_0xe528('0x1')]['import'](_0xe528('0x58'));db[_0xe528('0x59')]=db[_0xe528('0x1')]['import']('../api/openchannelQueueReport/openchannelQueueReport.model');db[_0xe528('0x5a')]=db[_0xe528('0x1')]['import'](_0xe528('0x5b'));db[_0xe528('0x5c')]=db[_0xe528('0x1')][_0xe528('0x14')](_0xe528('0x5d'));db[_0xe528('0x5e')]=db['sequelize'][_0xe528('0x14')](_0xe528('0x5f'));db[_0xe528('0x60')]=db[_0xe528('0x1')][_0xe528('0x14')](_0xe528('0x61'));db['ChatQueue']=db[_0xe528('0x1')][_0xe528('0x14')](_0xe528('0x62'));db[_0xe528('0x63')]=db[_0xe528('0x1')][_0xe528('0x14')]('../api/chatGroup/chatGroup.model');db[_0xe528('0x64')]=db[_0xe528('0x1')][_0xe528('0x14')](_0xe528('0x65'));db['CmCompany']=db[_0xe528('0x1')][_0xe528('0x14')](_0xe528('0x66'));db[_0xe528('0x67')]=db[_0xe528('0x1')][_0xe528('0x14')]('../api/cmContact/cmContact.model');db[_0xe528('0x68')]=db[_0xe528('0x1')][_0xe528('0x14')](_0xe528('0x69'));db['CmHopperBlack']=db[_0xe528('0x1')][_0xe528('0x14')](_0xe528('0x6a'));db['CmHopperFinal']=db['sequelize'][_0xe528('0x14')](_0xe528('0x6b'));db[_0xe528('0x6c')]=db[_0xe528('0x1')][_0xe528('0x14')]('../api/cmHopperHistory/cmHopperHistory.model');db[_0xe528('0x6d')]=db[_0xe528('0x1')]['import'](_0xe528('0x6e'));db[_0xe528('0x6f')]=db[_0xe528('0x1')][_0xe528('0x14')](_0xe528('0x70'));db[_0xe528('0x71')]=db['sequelize']['import'](_0xe528('0x72'));db[_0xe528('0x73')]=db['sequelize'][_0xe528('0x14')](_0xe528('0x74'));db['CannedAnswer']=db[_0xe528('0x1')][_0xe528('0x14')](_0xe528('0x75'));db[_0xe528('0x76')]=db['sequelize']['import']('../api/disposition/disposition.model');db[_0xe528('0x77')]=db[_0xe528('0x1')]['import']('../api/condition/condition.model');db[_0xe528('0x78')]=db['sequelize']['import']('../api/interval/interval.model');db['Pause']=db[_0xe528('0x1')][_0xe528('0x14')](_0xe528('0x79'));db[_0xe528('0x7a')]=db[_0xe528('0x1')][_0xe528('0x14')](_0xe528('0x7b'));db[_0xe528('0x7c')]=db['sequelize'][_0xe528('0x14')](_0xe528('0x7d'));db['Schedule']=db['sequelize'][_0xe528('0x14')](_0xe528('0x7e'));db['Sound']=db['sequelize'][_0xe528('0x14')]('../api/sound/sound.model');db[_0xe528('0x7f')]=db['sequelize'][_0xe528('0x14')](_0xe528('0x80'));db[_0xe528('0x81')]=db['sequelize']['import']('../api/template/template.model');db['Trigger']=db[_0xe528('0x1')][_0xe528('0x14')](_0xe528('0x82'));db[_0xe528('0x83')]=db['sequelize']['import'](_0xe528('0x84'));db[_0xe528('0x85')]=db['sequelize'][_0xe528('0x14')](_0xe528('0x86'));db[_0xe528('0x87')]=db[_0xe528('0x1')]['import'](_0xe528('0x88'));db[_0xe528('0x89')]=db[_0xe528('0x1')][_0xe528('0x14')](_0xe528('0x8a'));db[_0xe528('0x8b')]=db['sequelize']['import'](_0xe528('0x8c'));db[_0xe528('0x8d')]=db[_0xe528('0x1')][_0xe528('0x14')](_0xe528('0x8e'));db[_0xe528('0x8f')]=db[_0xe528('0x1')][_0xe528('0x14')]('../api/analyticMetric/analyticMetric.model');db[_0xe528('0x90')]=db[_0xe528('0x1')][_0xe528('0x14')](_0xe528('0x91'));db['AnalyticTreeReport']=db['sequelize']['import']('../api/analyticTreeReport/analyticTreeReport.model');db[_0xe528('0x92')]=db[_0xe528('0x1')][_0xe528('0x14')](_0xe528('0x93'));db[_0xe528('0x94')]=db[_0xe528('0x1')][_0xe528('0x14')](_0xe528('0x95'));db[_0xe528('0x96')]=db['sequelize']['import'](_0xe528('0x97'));db['SugarcrmAccount']=db[_0xe528('0x1')]['import']('../api/intSugarcrmAccount/intSugarcrmAccount.model');db[_0xe528('0x98')]=db[_0xe528('0x1')][_0xe528('0x14')](_0xe528('0x99'));db['SugarcrmField']=db['sequelize'][_0xe528('0x14')](_0xe528('0x9a'));db[_0xe528('0x9b')]=db[_0xe528('0x1')]['import'](_0xe528('0x9c'));db[_0xe528('0x9d')]=db['sequelize'][_0xe528('0x14')](_0xe528('0x9e'));db[_0xe528('0x9f')]=db[_0xe528('0x1')]['import'](_0xe528('0xa0'));db['ZohoAccount']=db['sequelize'][_0xe528('0x14')](_0xe528('0xa1'));db['ZohoConfiguration']=db['sequelize'][_0xe528('0x14')](_0xe528('0xa2'));db[_0xe528('0xa3')]=db[_0xe528('0x1')][_0xe528('0x14')](_0xe528('0xa4'));db[_0xe528('0xa5')]=db[_0xe528('0x1')][_0xe528('0x14')](_0xe528('0xa6'));db[_0xe528('0xa7')]=db[_0xe528('0x1')]['import']('../api/intZendeskConfiguration/intZendeskConfiguration.model');db[_0xe528('0xa8')]=db[_0xe528('0x1')][_0xe528('0x14')](_0xe528('0xa9'));db[_0xe528('0xaa')]=db['sequelize'][_0xe528('0x14')]('../api/intFreshdeskAccount/intFreshdeskAccount.model');db[_0xe528('0xab')]=db[_0xe528('0x1')][_0xe528('0x14')](_0xe528('0xac'));db[_0xe528('0xad')]=db['sequelize']['import'](_0xe528('0xae'));db[_0xe528('0xaf')]=db['sequelize'][_0xe528('0x14')]('../api/intVtigerAccount/intVtigerAccount.model');db[_0xe528('0xb0')]=db[_0xe528('0x1')][_0xe528('0x14')](_0xe528('0xb1'));db[_0xe528('0xb2')]=db['sequelize'][_0xe528('0x14')](_0xe528('0xb3'));db['ServicenowAccount']=db['sequelize'][_0xe528('0x14')](_0xe528('0xb4'));db[_0xe528('0xb5')]=db[_0xe528('0x1')][_0xe528('0x14')](_0xe528('0xb6'));db[_0xe528('0xb7')]=db['sequelize'][_0xe528('0x14')](_0xe528('0xb8'));db[_0xe528('0xb9')]=db[_0xe528('0x1')]['import'](_0xe528('0xba'));db[_0xe528('0xbb')]=db[_0xe528('0x1')][_0xe528('0x14')]('../api/intDynamics365Configuration/intDynamics365Configuration.model');db[_0xe528('0xbc')]=db[_0xe528('0x1')]['import'](_0xe528('0xbd'));db[_0xe528('0xbe')]=db[_0xe528('0x1')][_0xe528('0x14')](_0xe528('0xbf'));db[_0xe528('0xc0')]=db[_0xe528('0x1')][_0xe528('0x14')](_0xe528('0xc1'));db['FreshsalesField']=db[_0xe528('0x1')][_0xe528('0x14')](_0xe528('0xc2'));db['Integration']=db[_0xe528('0x1')][_0xe528('0x14')]('../api/integration/integration.model');db[_0xe528('0xc3')]=db[_0xe528('0x1')]['import'](_0xe528('0xc4'));db[_0xe528('0xc5')]=db[_0xe528('0x1')][_0xe528('0x14')](_0xe528('0xc6'));db[_0xe528('0xc7')]=db[_0xe528('0x1')][_0xe528('0x14')](_0xe528('0xc8'));db[_0xe528('0xc9')]=db[_0xe528('0x1')]['import'](_0xe528('0xca'));db[_0xe528('0xcb')]=db[_0xe528('0x1')][_0xe528('0x14')](_0xe528('0xcc'));db[_0xe528('0xcd')]=db[_0xe528('0x1')][_0xe528('0x14')]('../api/jscriptySessionReport/jscriptySessionReport.model');db[_0xe528('0xce')]=db['sequelize'][_0xe528('0x14')](_0xe528('0xcf'));db[_0xe528('0xd0')]=db[_0xe528('0x1')][_0xe528('0x14')]('../api/squareReport/squareReport.model');db['SquareDetailsReport']=db[_0xe528('0x1')]['import'](_0xe528('0xd1'));db[_0xe528('0xd2')]=db['sequelize'][_0xe528('0x14')]('../api/jscriptyProject/jscriptyProject.model');db[_0xe528('0xd3')]=db[_0xe528('0x1')][_0xe528('0x14')](_0xe528('0xd4'));db['SquareOdbc']=db[_0xe528('0x1')][_0xe528('0x14')](_0xe528('0xd5'));db[_0xe528('0xd6')]=db[_0xe528('0x1')][_0xe528('0x14')]('../api/squareProject/squareProject.model');db[_0xe528('0xd7')]=db[_0xe528('0x1')][_0xe528('0x14')](_0xe528('0xd8'));db['SquareMessage']=db[_0xe528('0x1')]['import'](_0xe528('0xd9'));db['Team']=db[_0xe528('0x1')]['import'](_0xe528('0xda'));db['License']=db['sequelize']['import'](_0xe528('0xdb'));db[_0xe528('0xdc')]=db[_0xe528('0x1')]['import'](_0xe528('0xdd'));db[_0xe528('0xde')]=db['sequelize'][_0xe528('0x14')](_0xe528('0xdf'));db['Attachment']=db[_0xe528('0x1')]['import'](_0xe528('0xe0'));db[_0xe528('0xe1')]=db[_0xe528('0x1')][_0xe528('0x14')](_0xe528('0xe2'));db[_0xe528('0xe3')]=db[_0xe528('0x1')][_0xe528('0x14')]('../api/mailTransferReport/mailTransferReport.model');db['ChatTransferReport']=db[_0xe528('0x1')]['import'](_0xe528('0xe4'));db[_0xe528('0xe5')]=db[_0xe528('0x1')]['import'](_0xe528('0xe6'));db[_0xe528('0xe7')]=db[_0xe528('0x1')]['import'](_0xe528('0xe8'));db[_0xe528('0xe9')]=db['sequelize'][_0xe528('0x14')]('../api/smsTransferReport/smsTransferReport.model');db[_0xe528('0xea')]=db[_0xe528('0x1')][_0xe528('0x14')]('../api/cmList/cmList.model');db[_0xe528('0xeb')]=db[_0xe528('0x1')][_0xe528('0x14')](_0xe528('0xec'));db['UserProfile']=db[_0xe528('0x1')][_0xe528('0x14')](_0xe528('0xed'));db['UserProfileSection']=db[_0xe528('0x1')][_0xe528('0x14')]('../api/userProfileSection/userProfileSection.model');db[_0xe528('0xee')]=db[_0xe528('0x1')][_0xe528('0x14')](_0xe528('0xef'));db[_0xe528('0xf0')]=db[_0xe528('0x1')][_0xe528('0x14')](_0xe528('0xf1'));db[_0xe528('0xf2')]=db['sequelize']['import'](_0xe528('0xf3'));db[_0xe528('0xf4')]=db[_0xe528('0x1')]['import']('../api/whatsappApplication/whatsappApplication.model');db[_0xe528('0xf5')]=db[_0xe528('0x1')][_0xe528('0x14')](_0xe528('0xf6'));db[_0xe528('0xf7')]=db[_0xe528('0x1')][_0xe528('0x14')](_0xe528('0xf8'));db[_0xe528('0xf9')]=db[_0xe528('0x1')]['import']('../api/whatsappQueueReport/whatsappQueueReport.model');db[_0xe528('0xfa')]=db[_0xe528('0x1')][_0xe528('0x14')]('../api/whatsappTransferReport/whatsappTransferReport.model');db['WhatsappQueue']=db[_0xe528('0x1')][_0xe528('0x14')](_0xe528('0xfb'));db['CloudProvider']=db[_0xe528('0x1')][_0xe528('0x14')]('../api/cloudProvider/cloudProvider.model');db['TeamVoiceQueue']=db['sequelize']['import'](_0xe528('0xfc'));db[_0xe528('0xfd')]=db['sequelize'][_0xe528('0x14')](_0xe528('0xfe'));db[_0xe528('0xff')]=db[_0xe528('0x1')][_0xe528('0x14')]('../api/userVoicePrefix/userVoicePrefix.model');db[_0xe528('0x13')]['hasOne'](db[_0xe528('0x100')],{'as':_0xe528('0x100'),'onDelete':_0xe528('0x101'),'foreignKey':'UserId'});db['User']['hasMany'](db[_0xe528('0x102')],{'as':_0xe528('0x103'),'foreignKey':_0xe528('0x104')});db[_0xe528('0x13')][_0xe528('0x105')](db[_0xe528('0x106')],{'as':'VoiceQueuesRt','foreignKey':'UserId'});db[_0xe528('0x13')][_0xe528('0x105')](db[_0xe528('0x107')],{'as':'Extensions','onDelete':_0xe528('0x101'),'hooks':!![]});db[_0xe528('0x13')]['hasMany'](db['CmHopperFinal'],{'as':_0xe528('0x108'),'foreignKey':_0xe528('0x104')});db['User'][_0xe528('0x105')](db[_0xe528('0x6c')],{'as':'HopperHistory','foreignKey':_0xe528('0x104')});db['User'][_0xe528('0x105')](db['ReportAgentPreview'],{'as':_0xe528('0x6d'),'foreignKey':_0xe528('0x104')});db[_0xe528('0x13')][_0xe528('0x105')](db[_0xe528('0x52')],{'as':_0xe528('0x109'),'foreignKey':_0xe528('0x104')});db['User'][_0xe528('0x105')](db[_0xe528('0x5c')],{'as':_0xe528('0x10a'),'foreignKey':_0xe528('0x104')});db[_0xe528('0x13')][_0xe528('0x105')](db[_0xe528('0x10b')],{'as':_0xe528('0x10c'),'foreignKey':'UserId'});db[_0xe528('0x13')]['hasMany'](db[_0xe528('0x44')],{'as':_0xe528('0x10d'),'foreignKey':'UserId'});db[_0xe528('0x13')][_0xe528('0x105')](db['MailInteraction'],{'as':_0xe528('0x10e'),'foreignKey':_0xe528('0x104')});db['User']['hasMany'](db[_0xe528('0xf5')],{'as':'WhatsappInteractions','foreignKey':_0xe528('0x104')});db[_0xe528('0x13')][_0xe528('0x105')](db[_0xe528('0xf0')],{'as':_0xe528('0x10f'),'foreignKey':'SenderId'});db[_0xe528('0x13')][_0xe528('0x110')](db[_0xe528('0x111')],{'as':'UserProfile','foreignKey':'userProfileId'});db[_0xe528('0x13')][_0xe528('0x112')](db[_0xe528('0x63')],{'as':_0xe528('0x113'),'through':_0xe528('0x114')});db[_0xe528('0x13')][_0xe528('0x112')](db[_0xe528('0x67')],{'as':_0xe528('0x115'),'through':_0xe528('0x116')});db[_0xe528('0x13')][_0xe528('0x112')](db[_0xe528('0xea')],{'as':'Lists','through':_0xe528('0x117')});db['User'][_0xe528('0x112')](db[_0xe528('0x118')],{'through':_0xe528('0x119')});db[_0xe528('0x13')][_0xe528('0x112')](db[_0xe528('0x38')],{'as':'MailInteractions','through':_0xe528('0x11a')});db[_0xe528('0x13')][_0xe528('0x112')](db[_0xe528('0x5c')],{'as':'ChatInteractions','through':_0xe528('0x11b')});db[_0xe528('0x13')][_0xe528('0x112')](db[_0xe528('0x44')],{'as':'FaxInteractions','through':_0xe528('0x11c')});db[_0xe528('0x13')]['belongsToMany'](db[_0xe528('0x10b')],{'as':_0xe528('0x10c'),'through':_0xe528('0x11d')});db[_0xe528('0x13')][_0xe528('0x112')](db[_0xe528('0x52')],{'as':_0xe528('0x109'),'through':_0xe528('0x11e')});db[_0xe528('0x13')][_0xe528('0x112')](db[_0xe528('0xf5')],{'as':_0xe528('0x11f'),'through':'user_has_whatsapp_interactions'});db['User'][_0xe528('0x112')](db[_0xe528('0x1a')],{'as':_0xe528('0x120'),'through':'UserVoiceQueue','required':![]});db[_0xe528('0x13')]['belongsToMany'](db[_0xe528('0xeb')],{'as':_0xe528('0x121'),'through':_0xe528('0xff'),'required':![]});db[_0xe528('0x13')]['belongsToMany'](db[_0xe528('0x36')],{'as':'MailQueues','through':_0xe528('0x2b'),'required':![]});db['User']['belongsToMany'](db[_0xe528('0x122')],{'as':_0xe528('0x123'),'through':_0xe528('0x2a'),'required':![],'hooks':!![]});db[_0xe528('0x13')][_0xe528('0x112')](db[_0xe528('0x47')],{'as':_0xe528('0x124'),'through':'UserFaxQueue','required':![]});db[_0xe528('0x13')][_0xe528('0x112')](db['SmsQueue'],{'as':_0xe528('0x125'),'through':_0xe528('0x126'),'required':![]});db[_0xe528('0x13')][_0xe528('0x112')](db[_0xe528('0x55')],{'as':'OpenchannelQueues','through':'UserOpenchannelQueue','required':![]});db[_0xe528('0x13')][_0xe528('0x112')](db[_0xe528('0x127')],{'as':_0xe528('0x128'),'through':_0xe528('0x129'),'required':![]});db[_0xe528('0x13')][_0xe528('0x112')](db['CmList'],{'through':_0xe528('0x117')});db[_0xe528('0x13')][_0xe528('0x112')](db[_0xe528('0xeb')],{'as':_0xe528('0x121'),'through':_0xe528('0x12a'),'required':![]});db[_0xe528('0x13')][_0xe528('0x112')](db[_0xe528('0x57')],{'as':_0xe528('0x12b'),'through':_0xe528('0x12c')});db[_0xe528('0x13')][_0xe528('0x112')](db[_0xe528('0x41')],{'as':_0xe528('0x12d'),'through':_0xe528('0x12e')});db[_0xe528('0x13')][_0xe528('0x112')](db[_0xe528('0x35')],{'as':_0xe528('0x12f'),'through':_0xe528('0x130')});db['User'][_0xe528('0x112')](db[_0xe528('0x4e')],{'as':_0xe528('0x131'),'through':_0xe528('0x132')});db['User'][_0xe528('0x112')](db[_0xe528('0x49')],{'as':_0xe528('0x133'),'through':_0xe528('0x134')});db['User'][_0xe528('0x112')](db['WhatsappAccount'],{'as':_0xe528('0x135'),'through':_0xe528('0x136')});db['User']['belongsToMany'](db[_0xe528('0xd6')],{'as':_0xe528('0x137'),'through':_0xe528('0x138')});db['VoiceChanSpy'][_0xe528('0x105')](db[_0xe528('0x107')],{'as':'SpiedAgents','onDelete':'cascade','foreignKey':_0xe528('0x139')});db['VoiceContext'][_0xe528('0x105')](db['VoiceExtension'],{'onDelete':_0xe528('0x101')});db[_0xe528('0x107')][_0xe528('0x105')](db[_0xe528('0x107')],{'as':_0xe528('0x13a'),'onDelete':_0xe528('0x101')});db[_0xe528('0x13b')][_0xe528('0x112')](db['Sound'],{'as':_0xe528('0x13c'),'through':_0xe528('0x13d')});db[_0xe528('0x1a')][_0xe528('0x105')](db[_0xe528('0x106')],{'as':_0xe528('0x13e'),'foreignKey':_0xe528('0x13f')});db[_0xe528('0x1a')][_0xe528('0x105')](db[_0xe528('0x68')],{'as':_0xe528('0x140'),'foreignKey':_0xe528('0x13f')});db['VoiceQueue'][_0xe528('0x105')](db[_0xe528('0x141')],{'as':_0xe528('0x108'),'foreignKey':_0xe528('0x13f')});db[_0xe528('0x1a')][_0xe528('0x105')](db[_0xe528('0x6c')],{'as':_0xe528('0x142'),'foreignKey':_0xe528('0x13f')});db['VoiceQueue'][_0xe528('0x105')](db[_0xe528('0x6d')],{'as':'ReportAgentPreview','foreignKey':_0xe528('0x13f')});db[_0xe528('0x1a')][_0xe528('0x105')](db['CmHopperBlack'],{'as':'HopperBlacks','foreignKey':_0xe528('0x13f')});db[_0xe528('0x1a')][_0xe528('0x105')](db['JscriptySessionReport'],{'as':_0xe528('0x143'),'foreignKey':'VoiceQueueId'});db[_0xe528('0x1a')][_0xe528('0x110')](db[_0xe528('0x27')],{'as':_0xe528('0x27'),'foreignKey':_0xe528('0x144')});db['VoiceQueue'][_0xe528('0x110')](db[_0xe528('0x27')],{'as':'TrunkBackup','foreignKey':_0xe528('0x145')});db[_0xe528('0x1a')][_0xe528('0x110')](db[_0xe528('0x78')],{'as':_0xe528('0x78'),'foreignKey':_0xe528('0x146')});db[_0xe528('0x1a')]['belongsTo'](db[_0xe528('0x147')],{'as':_0xe528('0x148'),'foreignKey':_0xe528('0x149')});db[_0xe528('0x1a')][_0xe528('0x112')](db[_0xe528('0xea')],{'as':'Lists','through':_0xe528('0x14a')});db[_0xe528('0x1a')]['belongsToMany'](db[_0xe528('0x13')],{'as':_0xe528('0x14b'),'through':_0xe528('0x29')});db[_0xe528('0x1a')][_0xe528('0x112')](db['Team'],{'as':_0xe528('0x14c'),'through':'TeamVoiceQueue'});db[_0xe528('0x1a')][_0xe528('0x112')](db[_0xe528('0xea')],{'as':_0xe528('0x14d'),'through':'voice_queues_has_cm_blacklists'});db[_0xe528('0x102')][_0xe528('0x110')](db[_0xe528('0x13')],{'as':'User','foreignKey':_0xe528('0x104')});db[_0xe528('0x1c')]['belongsTo'](db['User'],{'as':_0xe528('0x13'),'foreignKey':_0xe528('0x104')});db[_0xe528('0x100')][_0xe528('0x105')](db[_0xe528('0x1f')],{'as':_0xe528('0x14e'),'onDelete':'cascade','foreignKey':_0xe528('0x14f'),'sourceKey':'mailbox'});db[_0xe528('0x1f')][_0xe528('0x110')](db[_0xe528('0x100')],{'foreignKey':_0xe528('0x14f'),'targetKey':_0xe528('0x150')});db['VoiceCallReport'][_0xe528('0x105')](db['VoiceQueueReport'],{'as':_0xe528('0x151'),'foreignKey':'uniqueid','constraints':![]});db[_0xe528('0x21')]['hasMany'](db[_0xe528('0x23')],{'as':_0xe528('0x152'),'foreignKey':_0xe528('0x153'),'constraints':![]});db[_0xe528('0x21')]['belongsTo'](db[_0xe528('0x13')],{'as':_0xe528('0x13'),'foreignKey':_0xe528('0x104')});db[_0xe528('0x21')][_0xe528('0x110')](db['CmContact'],{'as':_0xe528('0x154'),'foreignKey':_0xe528('0x155')});db[_0xe528('0x156')]['belongsTo'](db['MailAccount'],{'as':_0xe528('0x35'),'foreignKey':_0xe528('0x157')});db[_0xe528('0x33')]['belongsTo'](db[_0xe528('0x35')],{'as':_0xe528('0x35'),'foreignKey':'MailAccountId'});db[_0xe528('0x35')][_0xe528('0x158')](db[_0xe528('0x156')],{'as':_0xe528('0x159'),'onDelete':_0xe528('0x101')});db[_0xe528('0x35')][_0xe528('0x158')](db[_0xe528('0x33')],{'as':_0xe528('0x15a'),'onDelete':_0xe528('0x101')});db[_0xe528('0x35')][_0xe528('0x105')](db[_0xe528('0x76')],{'as':_0xe528('0x15b'),'foreignKey':_0xe528('0x157'),'onDelete':_0xe528('0x101')});db['MailAccount'][_0xe528('0x105')](db[_0xe528('0x15c')],{'as':_0xe528('0x15d'),'foreignKey':_0xe528('0x157')});db[_0xe528('0x35')]['hasMany'](db[_0xe528('0x3a')],{'as':_0xe528('0x14e'),'foreignKey':_0xe528('0x157')});db[_0xe528('0x35')][_0xe528('0x105')](db[_0xe528('0x38')],{'as':_0xe528('0x15e')});db[_0xe528('0x35')]['hasMany'](db[_0xe528('0x3c')],{'as':_0xe528('0x13a')});db[_0xe528('0x35')][_0xe528('0x110')](db[_0xe528('0xea')],{'as':'List','foreignKey':_0xe528('0x15f')});db[_0xe528('0x35')][_0xe528('0x110')](db[_0xe528('0x81')],{'as':_0xe528('0x81'),'foreignKey':_0xe528('0x160')});db[_0xe528('0x35')][_0xe528('0x110')](db[_0xe528('0x147')],{'as':_0xe528('0x148'),'foreignKey':_0xe528('0x149')});db['MailAccount'][_0xe528('0x112')](db[_0xe528('0x13')],{'as':_0xe528('0x14b'),'through':_0xe528('0x130')});db['MailQueue'][_0xe528('0x112')](db[_0xe528('0x13')],{'as':'Agents','through':_0xe528('0x2b')});db[_0xe528('0x36')][_0xe528('0x112')](db['Team'],{'through':_0xe528('0x161'),'as':'Teams'});db['MailInteraction'][_0xe528('0x105')](db[_0xe528('0x3a')],{'as':_0xe528('0x14e'),'onDelete':_0xe528('0x101'),'foreignKey':_0xe528('0x162')});db['MailInteraction'][_0xe528('0x110')](db['MailAccount'],{'as':_0xe528('0x163'),'foreignKey':_0xe528('0x157')});db[_0xe528('0x38')][_0xe528('0x110')](db[_0xe528('0x67')],{'as':_0xe528('0x154'),'foreignKey':'ContactId'});db[_0xe528('0x38')][_0xe528('0x110')](db[_0xe528('0x13')],{'as':_0xe528('0x164'),'foreignKey':'UserId'});db[_0xe528('0x38')]['belongsToMany'](db[_0xe528('0x7f')],{'through':'mail_interaction_has_tags','as':_0xe528('0x165')});db['MailInteraction'][_0xe528('0x112')](db[_0xe528('0x7f')],{'through':'mail_interaction_has_tags','as':_0xe528('0x166')});db[_0xe528('0x38')][_0xe528('0x112')](db[_0xe528('0x13')],{'as':_0xe528('0x167'),'through':_0xe528('0x11a'),'foreignKey':'MailInteractionId'});db[_0xe528('0x3a')][_0xe528('0x105')](db[_0xe528('0x168')],{'as':_0xe528('0x169'),'onDelete':_0xe528('0x101')});db[_0xe528('0x3a')][_0xe528('0x110')](db['User'],{'as':_0xe528('0x13')});db[_0xe528('0x3a')][_0xe528('0x110')](db[_0xe528('0x67')],{'onDelete':_0xe528('0x101'),'as':_0xe528('0x154')});db['MailMessage'][_0xe528('0x110')](db[_0xe528('0x38')],{'as':_0xe528('0x16a'),'foreignKey':'MailInteractionId'});db['MailMessage'][_0xe528('0x110')](db[_0xe528('0x35')],{'as':'Account','foreignKey':'MailAccountId'});db['MailMessage']['belongsTo'](db[_0xe528('0x57')],{'as':_0xe528('0x57'),'foreignKey':'ChatWebsiteId'});db[_0xe528('0x3a')]['belongsTo'](db[_0xe528('0x60')],{'as':_0xe528('0x60'),'foreignKey':_0xe528('0x16b')});db[_0xe528('0x3c')]['belongsTo'](db[_0xe528('0x13')],{'onDelete':'restrict'});db['MailApplication'][_0xe528('0x110')](db[_0xe528('0x36')],{'onDelete':_0xe528('0x16c')});db[_0xe528('0x3c')][_0xe528('0x110')](db[_0xe528('0x35')],{'onDelete':_0xe528('0x16c')});db[_0xe528('0x3c')][_0xe528('0x110')](db['Interval'],{'onDelete':_0xe528('0x16c'),'foreignKey':'IntervalId'});db[_0xe528('0x3c')][_0xe528('0x110')](db[_0xe528('0x7f')],{'onDelete':_0xe528('0x16c'),'foreignKey':'TagId'});db[_0xe528('0x3e')]['belongsTo'](db[_0xe528('0x35')],{});db[_0xe528('0x3e')]['belongsTo'](db[_0xe528('0xea')],{'as':_0xe528('0x16d'),'foreignKey':'ListId'});db['MailQueueReport']['belongsTo'](db[_0xe528('0x67')],{'as':_0xe528('0x154'),'foreignKey':_0xe528('0x155')});db[_0xe528('0x3e')]['belongsTo'](db[_0xe528('0x38')],{});db[_0xe528('0x3e')][_0xe528('0x110')](db[_0xe528('0x3a')],{});db[_0xe528('0x3e')][_0xe528('0x110')](db[_0xe528('0x13')],{});db[_0xe528('0x3e')][_0xe528('0x110')](db[_0xe528('0x36')],{});db[_0xe528('0x40')]['hasMany'](db[_0xe528('0x16e')],{'as':_0xe528('0x16f'),'onDelete':_0xe528('0x101')});db[_0xe528('0x41')][_0xe528('0x105')](db[_0xe528('0x76')],{'as':_0xe528('0x15b'),'foreignKey':_0xe528('0x170'),'onDelete':_0xe528('0x101')});db[_0xe528('0x41')][_0xe528('0x105')](db[_0xe528('0x15c')],{'as':'Answers','foreignKey':_0xe528('0x170')});db[_0xe528('0x41')]['hasMany'](db[_0xe528('0x44')],{'as':_0xe528('0x15e')});db[_0xe528('0x41')][_0xe528('0x105')](db[_0xe528('0x43')],{'as':_0xe528('0x13a')});db[_0xe528('0x41')][_0xe528('0x105')](db[_0xe528('0x107')],{'as':_0xe528('0x171'),'onDelete':_0xe528('0x101')});db[_0xe528('0x41')][_0xe528('0x105')](db['FaxMessage'],{'as':_0xe528('0x14e')});db[_0xe528('0x41')][_0xe528('0x110')](db['Trunk'],{'as':_0xe528('0x27')});db[_0xe528('0x41')][_0xe528('0x110')](db[_0xe528('0xea')],{'as':_0xe528('0x16d'),'foreignKey':_0xe528('0x15f')});db[_0xe528('0x41')]['belongsTo'](db[_0xe528('0x147')],{'as':_0xe528('0x148'),'foreignKey':'mandatoryDispositionPauseId'});db['FaxAccount'][_0xe528('0x112')](db[_0xe528('0x13')],{'as':'Agents','through':'user_has_fax_accounts'});db['FaxApplication'][_0xe528('0x110')](db['User'],{'onDelete':_0xe528('0x16c')});db[_0xe528('0x43')][_0xe528('0x110')](db['FaxQueue'],{'onDelete':_0xe528('0x16c')});db[_0xe528('0x43')][_0xe528('0x110')](db[_0xe528('0x41')],{'onDelete':_0xe528('0x16c')});db[_0xe528('0x43')][_0xe528('0x110')](db[_0xe528('0x7f')],{'onDelete':_0xe528('0x16c'),'foreignKey':_0xe528('0x172')});db[_0xe528('0x44')][_0xe528('0x105')](db['FaxMessage'],{'as':'Messages','onDelete':_0xe528('0x101'),'foreignKey':'FaxInteractionId'});db[_0xe528('0x44')][_0xe528('0x110')](db[_0xe528('0x41')],{'as':_0xe528('0x163'),'foreignKey':_0xe528('0x170')});db[_0xe528('0x44')]['belongsTo'](db[_0xe528('0x67')],{'as':'Contact','foreignKey':_0xe528('0x155')});db['FaxInteraction'][_0xe528('0x110')](db[_0xe528('0x13')],{'as':_0xe528('0x164'),'foreignKey':_0xe528('0x104')});db[_0xe528('0x44')][_0xe528('0x112')](db['Tag'],{'through':_0xe528('0x173'),'as':_0xe528('0x165')});db['FaxInteraction'][_0xe528('0x112')](db[_0xe528('0x7f')],{'through':_0xe528('0x173'),'as':_0xe528('0x166')});db[_0xe528('0x44')]['belongsToMany'](db[_0xe528('0x13')],{'as':'Users','through':_0xe528('0x11c'),'foreignKey':_0xe528('0x174')});db[_0xe528('0x45')][_0xe528('0x110')](db[_0xe528('0x13')],{'onDelete':'cascade','as':_0xe528('0x13')});db[_0xe528('0x45')][_0xe528('0x110')](db[_0xe528('0x44')],{'as':'Interaction','foreignKey':_0xe528('0x174')});db[_0xe528('0x45')][_0xe528('0x110')](db[_0xe528('0x67')],{'onDelete':_0xe528('0x101'),'as':'Contact'});db[_0xe528('0x45')]['belongsTo'](db[_0xe528('0x168')],{'as':_0xe528('0x168'),'foreignKey':_0xe528('0x175')});db[_0xe528('0x45')][_0xe528('0x110')](db[_0xe528('0x41')],{'as':_0xe528('0x163'),'foreignKey':_0xe528('0x170')});db[_0xe528('0x47')]['belongsToMany'](db['User'],{'as':'Agents','through':'UserFaxQueue'});db['FaxQueue'][_0xe528('0x112')](db['Team'],{'through':_0xe528('0x176'),'as':_0xe528('0x14c')});db['FaxQueueReport'][_0xe528('0x110')](db[_0xe528('0x41')],{});db['FaxQueueReport'][_0xe528('0x110')](db['CmList'],{'as':'List','foreignKey':_0xe528('0x15f')});db[_0xe528('0x177')][_0xe528('0x110')](db['CmContact'],{'as':'Contact','foreignKey':_0xe528('0x155')});db[_0xe528('0x177')][_0xe528('0x110')](db['FaxInteraction'],{});db[_0xe528('0x177')]['belongsTo'](db[_0xe528('0x45')],{});db[_0xe528('0x177')][_0xe528('0x110')](db[_0xe528('0x13')],{});db[_0xe528('0x177')][_0xe528('0x110')](db[_0xe528('0x47')],{});db[_0xe528('0x49')][_0xe528('0x105')](db[_0xe528('0x76')],{'as':'Dispositions','foreignKey':'SmsAccountId','onDelete':_0xe528('0x101')});db[_0xe528('0x49')][_0xe528('0x105')](db[_0xe528('0x15c')],{'as':_0xe528('0x15d'),'foreignKey':'SmsAccountId'});db[_0xe528('0x49')][_0xe528('0x105')](db[_0xe528('0x178')],{'as':_0xe528('0x14e'),'foreignKey':_0xe528('0x179')});db['SmsAccount']['hasMany'](db['SmsInteraction'],{'as':'Interactions'});db['SmsAccount'][_0xe528('0x105')](db['SmsApplication'],{'as':_0xe528('0x13a')});db[_0xe528('0x49')][_0xe528('0x110')](db['CmList'],{'as':_0xe528('0x16d'),'foreignKey':_0xe528('0x15f')});db[_0xe528('0x49')]['belongsTo'](db[_0xe528('0x147')],{'as':'mandatoryDispositionPause','foreignKey':_0xe528('0x149')});db['SmsAccount'][_0xe528('0x112')](db[_0xe528('0x13')],{'as':'Agents','through':_0xe528('0x134')});db['SmsApplication'][_0xe528('0x110')](db[_0xe528('0x13')],{'onDelete':'restrict'});db[_0xe528('0x4a')][_0xe528('0x110')](db['SmsQueue'],{'onDelete':_0xe528('0x16c')});db['SmsApplication'][_0xe528('0x110')](db[_0xe528('0x49')],{'onDelete':'restrict'});db[_0xe528('0x4a')][_0xe528('0x110')](db[_0xe528('0x78')],{'onDelete':_0xe528('0x16c'),'foreignKey':_0xe528('0x146')});db[_0xe528('0x4a')][_0xe528('0x110')](db[_0xe528('0x7f')],{'onDelete':_0xe528('0x16c'),'foreignKey':'TagId'});db[_0xe528('0x10b')][_0xe528('0x105')](db[_0xe528('0x178')],{'as':_0xe528('0x14e'),'onDelete':_0xe528('0x101'),'foreignKey':_0xe528('0x17a')});db[_0xe528('0x10b')][_0xe528('0x110')](db['SmsAccount'],{'as':'Account','foreignKey':_0xe528('0x179')});db[_0xe528('0x10b')][_0xe528('0x110')](db[_0xe528('0x67')],{'as':'Contact','foreignKey':_0xe528('0x155')});db[_0xe528('0x10b')][_0xe528('0x110')](db[_0xe528('0x13')],{'as':'Owner','foreignKey':'UserId'});db[_0xe528('0x10b')]['belongsToMany'](db[_0xe528('0x7f')],{'through':'sms_interaction_has_tags','as':_0xe528('0x165')});db['SmsInteraction'][_0xe528('0x112')](db['Tag'],{'through':_0xe528('0x17b'),'as':_0xe528('0x166')});db[_0xe528('0x10b')]['belongsToMany'](db[_0xe528('0x13')],{'as':_0xe528('0x167'),'through':_0xe528('0x11d'),'foreignKey':_0xe528('0x17a')});db[_0xe528('0x178')][_0xe528('0x110')](db[_0xe528('0x13')],{'as':'User'});db['SmsMessage'][_0xe528('0x110')](db[_0xe528('0x67')],{'onDelete':_0xe528('0x101'),'as':_0xe528('0x154')});db[_0xe528('0x178')][_0xe528('0x110')](db[_0xe528('0x10b')],{'onDelete':'cascade','as':_0xe528('0x16a'),'foreignKey':'SmsInteractionId'});db[_0xe528('0x178')][_0xe528('0x110')](db[_0xe528('0x49')],{'as':_0xe528('0x163'),'foreignKey':_0xe528('0x179')});db[_0xe528('0x17c')][_0xe528('0x112')](db[_0xe528('0x13')],{'as':'Agents','through':_0xe528('0x126'),'foreignKey':_0xe528('0x17d')});db['SmsQueue'][_0xe528('0x112')](db[_0xe528('0x118')],{'through':'team_has_sms_queues','as':_0xe528('0x14c')});db[_0xe528('0x4e')][_0xe528('0x105')](db[_0xe528('0x76')],{'as':_0xe528('0x15b'),'foreignKey':_0xe528('0x17e'),'onDelete':_0xe528('0x101')});db[_0xe528('0x4e')][_0xe528('0x105')](db['CannedAnswer'],{'as':_0xe528('0x15d'),'foreignKey':'OpenchannelAccountId'});db[_0xe528('0x4e')][_0xe528('0x105')](db[_0xe528('0x52')],{'as':_0xe528('0x15e'),'foreignKey':_0xe528('0x17e')});db[_0xe528('0x4e')][_0xe528('0x105')](db[_0xe528('0x53')],{'as':'Messages','foreignKey':_0xe528('0x17e')});db[_0xe528('0x4e')][_0xe528('0x105')](db[_0xe528('0x50')],{'as':_0xe528('0x13a'),'foreignKey':_0xe528('0x17e')});db[_0xe528('0x4e')][_0xe528('0x110')](db['CmList'],{'as':'List','foreignKey':_0xe528('0x15f')});db['OpenchannelAccount'][_0xe528('0x110')](db[_0xe528('0x147')],{'as':_0xe528('0x148'),'foreignKey':_0xe528('0x149')});db['OpenchannelAccount'][_0xe528('0x112')](db[_0xe528('0x13')],{'as':_0xe528('0x14b'),'through':_0xe528('0x132')});db[_0xe528('0x50')][_0xe528('0x110')](db[_0xe528('0x13')],{'onDelete':_0xe528('0x16c')});db[_0xe528('0x50')][_0xe528('0x110')](db[_0xe528('0x55')],{'onDelete':'restrict','foreignKey':_0xe528('0x17f')});db[_0xe528('0x50')][_0xe528('0x110')](db[_0xe528('0x4e')],{'onDelete':'restrict','foreignKey':_0xe528('0x17e')});db[_0xe528('0x50')][_0xe528('0x110')](db['Interval'],{'onDelete':'restrict','foreignKey':_0xe528('0x146')});db['OpenchannelApplication'][_0xe528('0x110')](db[_0xe528('0x7f')],{'onDelete':_0xe528('0x16c'),'foreignKey':_0xe528('0x172')});db[_0xe528('0x52')][_0xe528('0x105')](db[_0xe528('0x53')],{'as':_0xe528('0x14e'),'onDelete':_0xe528('0x101'),'foreignKey':'OpenchannelInteractionId'});db[_0xe528('0x52')][_0xe528('0x110')](db['OpenchannelAccount'],{'as':_0xe528('0x163'),'foreignKey':_0xe528('0x17e')});db[_0xe528('0x52')]['belongsTo'](db[_0xe528('0x67')],{'as':_0xe528('0x154'),'foreignKey':'ContactId'});db[_0xe528('0x52')][_0xe528('0x110')](db['User'],{'as':_0xe528('0x164'),'foreignKey':'UserId'});db['OpenchannelInteraction'][_0xe528('0x112')](db['Tag'],{'through':_0xe528('0x180'),'as':_0xe528('0x165')});db['OpenchannelInteraction']['belongsToMany'](db[_0xe528('0x7f')],{'through':_0xe528('0x180'),'as':'ThroughTags'});db[_0xe528('0x52')][_0xe528('0x112')](db[_0xe528('0x13')],{'as':_0xe528('0x167'),'through':_0xe528('0x11e'),'foreignKey':_0xe528('0x181')});db['OpenchannelMessage'][_0xe528('0x110')](db['User'],{'onDelete':_0xe528('0x101'),'as':_0xe528('0x13')});db[_0xe528('0x53')][_0xe528('0x110')](db[_0xe528('0x67')],{'onDelete':_0xe528('0x101'),'as':_0xe528('0x154')});db[_0xe528('0x53')][_0xe528('0x110')](db['OpenchannelInteraction'],{'onDelete':'cascade','as':'Interaction','foreignKey':'OpenchannelInteractionId'});db['OpenchannelMessage'][_0xe528('0x110')](db[_0xe528('0x168')],{'as':'Attachment','foreignKey':_0xe528('0x175')});db[_0xe528('0x53')][_0xe528('0x110')](db[_0xe528('0x4e')],{'as':_0xe528('0x163'),'foreignKey':'OpenchannelAccountId'});db[_0xe528('0x55')]['belongsToMany'](db[_0xe528('0x13')],{'as':'Agents','through':'UserOpenchannelQueue','foreignKey':_0xe528('0x17f')});db['OpenchannelQueue'][_0xe528('0x112')](db[_0xe528('0x118')],{'through':_0xe528('0x182'),'as':_0xe528('0x14c')});db[_0xe528('0x57')]['hasMany'](db[_0xe528('0x76')],{'as':_0xe528('0x15b'),'foreignKey':_0xe528('0x183'),'onDelete':_0xe528('0x101')});db[_0xe528('0x57')]['hasMany'](db[_0xe528('0x15c')],{'as':'Answers','foreignKey':_0xe528('0x183')});db[_0xe528('0x57')][_0xe528('0x105')](db[_0xe528('0x64')],{'as':'ProactiveActions'});db['ChatWebsite'][_0xe528('0x105')](db['ChatInteraction'],{'as':_0xe528('0x15e')});db['ChatWebsite'][_0xe528('0x105')](db['ChatApplication'],{'as':_0xe528('0x13a')});db['ChatWebsite'][_0xe528('0x105')](db['ChatMessage'],{'as':'Messages'});db['ChatWebsite'][_0xe528('0x110')](db[_0xe528('0xea')],{'as':_0xe528('0x16d'),'foreignKey':'ListId'});db[_0xe528('0x57')]['belongsTo'](db[_0xe528('0x78')],{'as':_0xe528('0x78'),'foreignKey':_0xe528('0x146')});db['ChatWebsite'][_0xe528('0x110')](db[_0xe528('0x35')],{'as':_0xe528('0x35'),'foreignKey':'MailAccountId'});db[_0xe528('0x57')][_0xe528('0x110')](db[_0xe528('0x147')],{'as':_0xe528('0x148'),'foreignKey':_0xe528('0x149')});db[_0xe528('0x57')]['belongsToMany'](db['User'],{'as':_0xe528('0x14b'),'through':_0xe528('0x12c')});db[_0xe528('0x59')][_0xe528('0x110')](db[_0xe528('0x4e')],{});db[_0xe528('0x59')][_0xe528('0x110')](db['CmList'],{'as':_0xe528('0x16d'),'foreignKey':'ListId'});db[_0xe528('0x59')][_0xe528('0x110')](db['CmContact'],{'as':_0xe528('0x154'),'foreignKey':_0xe528('0x155')});db[_0xe528('0x59')][_0xe528('0x110')](db[_0xe528('0x52')],{});db[_0xe528('0x59')][_0xe528('0x110')](db[_0xe528('0x53')],{});db['OpenchannelQueueReport']['belongsTo'](db[_0xe528('0x13')],{});db[_0xe528('0x59')]['belongsTo'](db[_0xe528('0x55')],{});db[_0xe528('0x5a')]['belongsTo'](db[_0xe528('0x13')],{'as':'Agent','foreignKey':_0xe528('0x104'),'onDelete':_0xe528('0x16c')});db['ChatApplication'][_0xe528('0x110')](db[_0xe528('0x122')],{'as':_0xe528('0x184'),'foreignKey':'ChatQueueId','onDelete':'restrict'});db[_0xe528('0x5a')]['belongsTo'](db['ChatWebsite'],{'as':_0xe528('0x185'),'foreignKey':'ChatWebsiteId','onDelete':_0xe528('0x16c')});db[_0xe528('0x5a')][_0xe528('0x110')](db['Tag'],{'onDelete':'restrict','foreignKey':_0xe528('0x172')});db['ChatInteraction'][_0xe528('0x105')](db[_0xe528('0x5e')],{'as':_0xe528('0x14e'),'onDelete':_0xe528('0x101'),'foreignKey':'ChatInteractionId'});db['ChatInteraction'][_0xe528('0x110')](db['ChatWebsite'],{'as':_0xe528('0x163'),'foreignKey':_0xe528('0x183')});db['ChatInteraction']['belongsTo'](db['CmContact'],{'as':_0xe528('0x154'),'foreignKey':'ContactId'});db[_0xe528('0x5c')][_0xe528('0x110')](db[_0xe528('0x13')],{'as':_0xe528('0x164'),'foreignKey':_0xe528('0x104')});db[_0xe528('0x5c')]['belongsToMany'](db[_0xe528('0x7f')],{'through':'chat_interaction_has_tags','as':_0xe528('0x165')});db[_0xe528('0x5c')]['belongsToMany'](db[_0xe528('0x7f')],{'through':_0xe528('0x186'),'as':_0xe528('0x166')});db['ChatInteraction'][_0xe528('0x112')](db[_0xe528('0x13')],{'as':_0xe528('0x167'),'through':_0xe528('0x11b'),'foreignKey':_0xe528('0x187')});db[_0xe528('0x5e')][_0xe528('0x110')](db[_0xe528('0x13')],{'onDelete':'cascade','as':_0xe528('0x13')});db['ChatMessage']['belongsTo'](db[_0xe528('0x67')],{'onDelete':_0xe528('0x101'),'as':_0xe528('0x154'),'foreignKey':_0xe528('0x155')});db['ChatMessage'][_0xe528('0x110')](db[_0xe528('0x5c')],{'onDelete':_0xe528('0x101'),'as':_0xe528('0x16a'),'foreignKey':_0xe528('0x187')});db['ChatMessage'][_0xe528('0x110')](db['Attachment'],{'as':_0xe528('0x168'),'foreignKey':_0xe528('0x175')});db[_0xe528('0x5e')][_0xe528('0x110')](db[_0xe528('0x57')],{'as':_0xe528('0x163'),'foreignKey':_0xe528('0x183')});db[_0xe528('0x60')][_0xe528('0x105')](db[_0xe528('0x168')],{'as':_0xe528('0x169'),'foreignKey':'ChatOfflineMessageId','onDelete':'cascade','hooks':!![]});db[_0xe528('0x60')]['belongsTo'](db['CmContact'],{'onDelete':_0xe528('0x101'),'as':'Contact','foreignKey':'ContactId'});db[_0xe528('0x60')][_0xe528('0x110')](db['ChatWebsite'],{'as':_0xe528('0x163'),'foreignKey':'ChatWebsiteId'});db[_0xe528('0x122')][_0xe528('0x112')](db[_0xe528('0x13')],{'as':_0xe528('0x14b'),'through':_0xe528('0x2a'),'hooks':!![]});db[_0xe528('0x122')][_0xe528('0x112')](db['Team'],{'through':_0xe528('0x188'),'as':_0xe528('0x14c')});db['ChatGroup'][_0xe528('0x105')](db['ChatInternalMessage'],{'as':_0xe528('0x14e'),'foreignKey':_0xe528('0x189'),'onDelete':_0xe528('0x101')});db[_0xe528('0x63')][_0xe528('0x112')](db[_0xe528('0x13')],{'as':'Members','through':'chat_group_has_users'});db[_0xe528('0x64')]['belongsTo'](db[_0xe528('0x57')],{'as':'Website','foreignKey':_0xe528('0x183')});db[_0xe528('0x18a')][_0xe528('0x105')](db[_0xe528('0x67')],{'as':_0xe528('0x115'),'foreignKey':_0xe528('0x18b')});db[_0xe528('0x67')][_0xe528('0x105')](db[_0xe528('0x68')],{'as':_0xe528('0x140'),'foreignKey':_0xe528('0x155')});db[_0xe528('0x67')][_0xe528('0x105')](db['CmHopperFinal'],{'as':_0xe528('0x108'),'foreignKey':_0xe528('0x155')});db[_0xe528('0x67')][_0xe528('0x105')](db[_0xe528('0x6c')],{'as':'HopperHistories','foreignKey':_0xe528('0x155')});db[_0xe528('0x67')]['hasMany'](db[_0xe528('0x6d')],{'as':_0xe528('0x6d'),'foreignKey':_0xe528('0x155')});db[_0xe528('0x67')][_0xe528('0x105')](db['JscriptySessionReport'],{'as':'JscriptySessions','foreignKey':_0xe528('0x155')});db[_0xe528('0x67')]['hasMany'](db['OpenchannelInteraction'],{'as':_0xe528('0x109'),'foreignKey':_0xe528('0x155'),'onDelete':_0xe528('0x16c')});db[_0xe528('0x67')][_0xe528('0x105')](db['ChatInteraction'],{'as':_0xe528('0x10a'),'foreignKey':_0xe528('0x155'),'onDelete':'restrict'});db[_0xe528('0x67')][_0xe528('0x105')](db[_0xe528('0x10b')],{'as':_0xe528('0x10c'),'foreignKey':_0xe528('0x155'),'onDelete':'restrict'});db[_0xe528('0x67')]['hasMany'](db[_0xe528('0x44')],{'as':_0xe528('0x10d'),'foreignKey':_0xe528('0x155'),'onDelete':'restrict'});db['CmContact']['hasMany'](db[_0xe528('0x38')],{'as':'MailInteractions','foreignKey':_0xe528('0x155'),'onDelete':_0xe528('0x16c')});db[_0xe528('0x67')][_0xe528('0x110')](db['CmCompany'],{'as':_0xe528('0x18c'),'foreignKey':_0xe528('0x18b')});db[_0xe528('0x67')][_0xe528('0x110')](db[_0xe528('0xea')],{'as':'List','foreignKey':_0xe528('0x15f'),'onDelete':_0xe528('0x101')});db[_0xe528('0x67')][_0xe528('0x112')](db[_0xe528('0x13')],{'as':_0xe528('0x167'),'through':'cm_user_has_contacts'});db[_0xe528('0x67')][_0xe528('0x112')](db['Tag'],{'as':_0xe528('0x165'),'through':_0xe528('0x18d')});db[_0xe528('0x67')][_0xe528('0x112')](db[_0xe528('0x7f')],{'through':_0xe528('0x18d'),'as':_0xe528('0x166')});db[_0xe528('0x68')]['belongsTo'](db[_0xe528('0x67')],{'as':'Contact','foreignKey':_0xe528('0x155'),'onDelete':_0xe528('0x101')});db[_0xe528('0x68')][_0xe528('0x110')](db[_0xe528('0xea')],{'as':_0xe528('0x16d'),'foreignKey':_0xe528('0x15f'),'onDelete':_0xe528('0x101')});db[_0xe528('0x68')][_0xe528('0x110')](db[_0xe528('0x13')],{'as':_0xe528('0x18e'),'foreignKey':_0xe528('0x104')});db['CmHopper'][_0xe528('0x110')](db[_0xe528('0x1a')],{'as':_0xe528('0x184'),'foreignKey':'VoiceQueueId','onDelete':'cascade'});db[_0xe528('0x68')]['belongsTo'](db[_0xe528('0xdc')],{'as':'Campaign','foreignKey':_0xe528('0x18f'),'onDelete':'cascade'});db['CmHopper']['belongsTo'](db[_0xe528('0x13')],{'as':_0xe528('0x164'),'foreignKey':_0xe528('0x190')});db['CmHopperBlack']['belongsTo'](db[_0xe528('0x67')],{'as':_0xe528('0x154'),'foreignKey':_0xe528('0x155'),'onDelete':_0xe528('0x101')});db[_0xe528('0x191')][_0xe528('0x110')](db[_0xe528('0xea')],{'as':_0xe528('0x16d'),'foreignKey':'ListId','onDelete':_0xe528('0x101')});db[_0xe528('0x191')][_0xe528('0x110')](db[_0xe528('0x1a')],{'as':_0xe528('0x184'),'foreignKey':'VoiceQueueId','onDelete':_0xe528('0x101')});db[_0xe528('0x191')][_0xe528('0x110')](db[_0xe528('0xdc')],{'as':_0xe528('0xdc'),'foreignKey':_0xe528('0x18f'),'onDelete':'cascade'});db[_0xe528('0x73')][_0xe528('0x105')](db['Condition'],{'as':{'plural':_0xe528('0x192'),'singular':_0xe528('0x193')},'foreignKey':_0xe528('0x194'),'onDelete':_0xe528('0x101'),'hooks':!![]});db[_0xe528('0x73')][_0xe528('0x105')](db[_0xe528('0x77')],{'as':{'plural':'Any','singular':_0xe528('0x195')},'foreignKey':_0xe528('0x196'),'onDelete':_0xe528('0x101'),'hooks':!![]});db[_0xe528('0x73')][_0xe528('0x105')](db[_0xe528('0x71')],{'as':_0xe528('0x197'),'foreignKey':_0xe528('0x198'),'onDelete':_0xe528('0x101'),'hooks':!![]});db['Disposition'][_0xe528('0x105')](db[_0xe528('0x76')],{'as':_0xe528('0x15b'),'foreignKey':_0xe528('0x199'),'onDelete':_0xe528('0x101')});db['Interval'][_0xe528('0x105')](db[_0xe528('0x78')],{'as':_0xe528('0x19a'),'foreignKey':_0xe528('0x146'),'onDelete':_0xe528('0x101'),'hooks':!![],'required':![]});db[_0xe528('0x78')][_0xe528('0x105')](db[_0xe528('0x107')],{'as':_0xe528('0x19b'),'foreignKey':_0xe528('0x146'),'onDelete':_0xe528('0x16c')});db['Interval'][_0xe528('0x105')](db[_0xe528('0x3c')],{'as':_0xe528('0x19c'),'foreignKey':_0xe528('0x146')});db[_0xe528('0x78')][_0xe528('0x105')](db[_0xe528('0x5a')],{'as':'ChatApplications','foreignKey':_0xe528('0x146')});db['Interval']['hasMany'](db['FaxApplication'],{'as':_0xe528('0x19d'),'foreignKey':_0xe528('0x146')});db[_0xe528('0x78')]['hasMany'](db[_0xe528('0x4a')],{'as':_0xe528('0x19e'),'foreignKey':_0xe528('0x146')});db[_0xe528('0x19f')]['belongsTo'](db[_0xe528('0x35')],{});db[_0xe528('0x19f')]['belongsTo'](db['AnalyticDefaultReport'],{'foreignKey':_0xe528('0x1a0')});db['Schedule'][_0xe528('0x110')](db['AnalyticCustomReport'],{'foreignKey':_0xe528('0x1a1')});db[_0xe528('0x1a2')][_0xe528('0x112')](db[_0xe528('0x13b')],{'as':_0xe528('0x1a3'),'through':_0xe528('0x13d'),'onDelete':_0xe528('0x16c')});db[_0xe528('0x7f')][_0xe528('0x112')](db[_0xe528('0x67')],{'through':_0xe528('0x18d')});db[_0xe528('0x7f')][_0xe528('0x112')](db[_0xe528('0x5c')],{'through':_0xe528('0x186')});db[_0xe528('0x7f')][_0xe528('0x112')](db['MailInteraction'],{'through':_0xe528('0x1a4')});db['Tag'][_0xe528('0x112')](db[_0xe528('0x10b')],{'through':'sms_interaction_has_tags'});db[_0xe528('0x7f')]['belongsToMany'](db[_0xe528('0x44')],{'through':'fax_interaction_has_tags'});db['Tag'][_0xe528('0x112')](db[_0xe528('0x52')],{'through':_0xe528('0x180')});db[_0xe528('0x7f')][_0xe528('0x112')](db['WhatsappInteraction'],{'through':_0xe528('0x1a5')});db[_0xe528('0x1a6')][_0xe528('0x105')](db[_0xe528('0x77')],{'as':{'plural':_0xe528('0x1a7'),'singular':'AllCondition'},'foreignKey':_0xe528('0x1a8'),'onDelete':'cascade','hooks':!![]});db['Trigger']['hasMany'](db[_0xe528('0x77')],{'as':{'plural':'AnyConditions','singular':_0xe528('0x1a9')},'foreignKey':_0xe528('0x1aa'),'onDelete':_0xe528('0x101'),'hooks':!![]});db[_0xe528('0x1a6')][_0xe528('0x105')](db[_0xe528('0x71')],{'as':_0xe528('0x197'),'foreignKey':_0xe528('0x1ab'),'onDelete':_0xe528('0x101'),'hooks':!![]});db[_0xe528('0x89')][_0xe528('0x105')](db[_0xe528('0x90')],{'as':_0xe528('0x1ac'),'onDelete':'cascade','foreignKey':'CustomReportId','hooks':!![]});db['AnalyticDefaultReport'][_0xe528('0x105')](db[_0xe528('0x90')],{'as':_0xe528('0x1ac'),'onDelete':_0xe528('0x101'),'foreignKey':'DefaultReportId'});db[_0xe528('0x8f')]['hasMany'](db[_0xe528('0x90')],{'as':_0xe528('0x1ac'),'onDelete':'cascade','foreignKey':_0xe528('0x1ad')});db[_0xe528('0x90')][_0xe528('0x110')](db[_0xe528('0x8f')],{'foreignKey':_0xe528('0x1ad')});db['SalesforceAccount'][_0xe528('0x105')](db[_0xe528('0x94')],{'as':_0xe528('0x1ae'),'onDelete':_0xe528('0x101'),'foreignKey':_0xe528('0x1af')});db[_0xe528('0x94')][_0xe528('0x105')](db['SalesforceField'],{'as':_0xe528('0x1b0'),'onDelete':_0xe528('0x101'),'foreignKey':_0xe528('0x1b1')});db[_0xe528('0x94')][_0xe528('0x105')](db[_0xe528('0x96')],{'as':_0xe528('0x1b2'),'onDelete':_0xe528('0x101'),'foreignKey':_0xe528('0x1b3')});db[_0xe528('0x94')][_0xe528('0x105')](db[_0xe528('0x96')],{'as':_0xe528('0x1ac'),'onDelete':_0xe528('0x101'),'foreignKey':_0xe528('0x1b4')});db[_0xe528('0x94')][_0xe528('0x110')](db[_0xe528('0x92')],{'as':_0xe528('0x163'),'foreignKey':_0xe528('0x1af')});db[_0xe528('0x96')][_0xe528('0x105')](db[_0xe528('0x96')],{'as':_0xe528('0x1b5'),'foreignKey':_0xe528('0x1b1')});db[_0xe528('0x96')][_0xe528('0x105')](db[_0xe528('0x96')],{'as':_0xe528('0x1b6'),'foreignKey':'DescriptionId'});db[_0xe528('0x96')]['hasMany'](db[_0xe528('0x96')],{'as':'Field','foreignKey':_0xe528('0x1b4')});db[_0xe528('0x96')][_0xe528('0x110')](db['Variable'],{'as':_0xe528('0x83'),'foreignKey':_0xe528('0x1b7')});db[_0xe528('0x1b8')][_0xe528('0x105')](db[_0xe528('0x98')],{'as':'Configurations','onDelete':_0xe528('0x101'),'foreignKey':_0xe528('0x1af')});db[_0xe528('0x98')][_0xe528('0x105')](db['SugarcrmField'],{'as':'Subjects','onDelete':_0xe528('0x101'),'foreignKey':_0xe528('0x1b1')});db[_0xe528('0x98')][_0xe528('0x105')](db[_0xe528('0x1b9')],{'as':_0xe528('0x1b2'),'onDelete':_0xe528('0x101'),'foreignKey':_0xe528('0x1b3')});db['SugarcrmConfiguration'][_0xe528('0x105')](db[_0xe528('0x1b9')],{'as':_0xe528('0x1ac'),'onDelete':'cascade','foreignKey':_0xe528('0x1b4')});db[_0xe528('0x98')][_0xe528('0x110')](db[_0xe528('0x1b8')],{'as':_0xe528('0x163'),'foreignKey':'AccountId'});db[_0xe528('0x1b9')][_0xe528('0x105')](db['SugarcrmField'],{'as':_0xe528('0x1b5'),'foreignKey':_0xe528('0x1b1')});db[_0xe528('0x1b9')][_0xe528('0x105')](db[_0xe528('0x1b9')],{'as':_0xe528('0x1b6'),'foreignKey':_0xe528('0x1b3')});db[_0xe528('0x1b9')][_0xe528('0x105')](db[_0xe528('0x1b9')],{'as':_0xe528('0x1ba'),'foreignKey':'FieldId'});db['SugarcrmField'][_0xe528('0x110')](db[_0xe528('0x83')],{'as':_0xe528('0x83'),'foreignKey':'VariableId'});db['DeskAccount']['hasMany'](db['DeskConfiguration'],{'as':_0xe528('0x1ae'),'onDelete':'cascade','foreignKey':_0xe528('0x1af')});db['DeskConfiguration'][_0xe528('0x105')](db[_0xe528('0x9f')],{'as':_0xe528('0x1b0'),'onDelete':'cascade','foreignKey':_0xe528('0x1b1')});db[_0xe528('0x9d')][_0xe528('0x105')](db[_0xe528('0x9f')],{'as':_0xe528('0x1b2'),'onDelete':_0xe528('0x101'),'foreignKey':'DescriptionId'});db['DeskConfiguration'][_0xe528('0x105')](db[_0xe528('0x9f')],{'as':_0xe528('0x1ac'),'onDelete':_0xe528('0x101'),'foreignKey':_0xe528('0x1b4')});db[_0xe528('0x9d')][_0xe528('0x110')](db[_0xe528('0x9b')],{'as':_0xe528('0x163'),'foreignKey':_0xe528('0x1af')});db['DeskConfiguration'][_0xe528('0x112')](db[_0xe528('0x7f')],{'through':_0xe528('0x1bb')});db[_0xe528('0x9f')]['hasMany'](db[_0xe528('0x9f')],{'as':_0xe528('0x1b5'),'foreignKey':_0xe528('0x1b1')});db['DeskField'][_0xe528('0x105')](db[_0xe528('0x9f')],{'as':_0xe528('0x1b6'),'foreignKey':_0xe528('0x1b3')});db['DeskField'][_0xe528('0x105')](db[_0xe528('0x9f')],{'as':_0xe528('0x1ba'),'foreignKey':'FieldId'});db[_0xe528('0x9f')][_0xe528('0x110')](db['Variable'],{'as':_0xe528('0x83'),'foreignKey':'VariableId'});db['ZohoAccount'][_0xe528('0x105')](db[_0xe528('0x1bc')],{'as':'Configurations','onDelete':_0xe528('0x101'),'foreignKey':'AccountId'});db['ZohoConfiguration'][_0xe528('0x105')](db['ZohoField'],{'as':_0xe528('0x1b0'),'onDelete':'cascade','foreignKey':'SubjectId'});db[_0xe528('0x1bc')][_0xe528('0x105')](db['ZohoField'],{'as':_0xe528('0x1b2'),'onDelete':'cascade','foreignKey':_0xe528('0x1b3')});db[_0xe528('0x1bc')][_0xe528('0x105')](db[_0xe528('0xa3')],{'as':_0xe528('0x1ac'),'onDelete':_0xe528('0x101'),'foreignKey':_0xe528('0x1b4')});db[_0xe528('0x1bc')][_0xe528('0x110')](db['ZohoAccount'],{'as':_0xe528('0x163'),'foreignKey':_0xe528('0x1af')});db['ZohoField'][_0xe528('0x105')](db[_0xe528('0xa3')],{'as':'Subject','foreignKey':_0xe528('0x1b1')});db[_0xe528('0xa3')]['hasMany'](db[_0xe528('0xa3')],{'as':_0xe528('0x1b6'),'foreignKey':'DescriptionId'});db[_0xe528('0xa3')][_0xe528('0x105')](db[_0xe528('0xa3')],{'as':_0xe528('0x1ba'),'foreignKey':_0xe528('0x1b4')});db[_0xe528('0xa3')][_0xe528('0x110')](db[_0xe528('0x83')],{'as':_0xe528('0x83'),'foreignKey':_0xe528('0x1b7')});db[_0xe528('0xa5')]['hasMany'](db['ZendeskConfiguration'],{'as':_0xe528('0x1ae'),'onDelete':_0xe528('0x101'),'foreignKey':'AccountId'});db['ZendeskConfiguration'][_0xe528('0x105')](db[_0xe528('0xa8')],{'as':_0xe528('0x1b0'),'foreignKey':'SubjectId'});db['ZendeskConfiguration'][_0xe528('0x105')](db[_0xe528('0xa8')],{'as':_0xe528('0x1b2'),'foreignKey':_0xe528('0x1b3')});db[_0xe528('0xa7')][_0xe528('0x105')](db[_0xe528('0xa8')],{'as':_0xe528('0x1ac'),'foreignKey':_0xe528('0x1b4')});db[_0xe528('0xa7')][_0xe528('0x110')](db['ZendeskAccount'],{'as':_0xe528('0x163'),'foreignKey':_0xe528('0x1af')});db[_0xe528('0xa7')]['belongsToMany'](db[_0xe528('0x7f')],{'through':_0xe528('0x1bd')});db[_0xe528('0xa8')]['hasMany'](db[_0xe528('0xa8')],{'as':_0xe528('0x1b5'),'foreignKey':_0xe528('0x1b1')});db[_0xe528('0xa8')][_0xe528('0x105')](db['ZendeskField'],{'as':_0xe528('0x1b6'),'foreignKey':_0xe528('0x1b3')});db[_0xe528('0xa8')][_0xe528('0x105')](db[_0xe528('0xa8')],{'as':_0xe528('0x1ba'),'foreignKey':_0xe528('0x1b4')});db[_0xe528('0xa8')]['belongsTo'](db[_0xe528('0x83')],{'as':_0xe528('0x83'),'foreignKey':_0xe528('0x1b7')});db['FreshdeskAccount'][_0xe528('0x105')](db[_0xe528('0xab')],{'as':'Configurations','onDelete':_0xe528('0x101'),'foreignKey':'AccountId'});db['FreshdeskConfiguration'][_0xe528('0x105')](db[_0xe528('0xad')],{'as':_0xe528('0x1b0'),'onDelete':_0xe528('0x101'),'foreignKey':_0xe528('0x1b1')});db[_0xe528('0xab')]['hasMany'](db[_0xe528('0xad')],{'as':_0xe528('0x1b2'),'onDelete':'cascade','foreignKey':_0xe528('0x1b3')});db[_0xe528('0xab')][_0xe528('0x105')](db[_0xe528('0xad')],{'as':'Fields','onDelete':_0xe528('0x101'),'foreignKey':_0xe528('0x1b4')});db[_0xe528('0xab')]['belongsTo'](db[_0xe528('0xaa')],{'as':'Account','foreignKey':_0xe528('0x1af')});db['FreshdeskConfiguration'][_0xe528('0x112')](db[_0xe528('0x7f')],{'through':_0xe528('0x1be')});db['FreshdeskField'][_0xe528('0x105')](db[_0xe528('0xad')],{'as':_0xe528('0x1b5'),'foreignKey':_0xe528('0x1b1')});db[_0xe528('0xad')]['hasMany'](db[_0xe528('0xad')],{'as':_0xe528('0x1b6'),'foreignKey':_0xe528('0x1b3')});db['FreshdeskField'][_0xe528('0x105')](db[_0xe528('0xad')],{'as':_0xe528('0x1ba'),'foreignKey':_0xe528('0x1b4')});db['FreshdeskField'][_0xe528('0x110')](db[_0xe528('0x83')],{'as':_0xe528('0x83'),'foreignKey':_0xe528('0x1b7')});db[_0xe528('0xaf')][_0xe528('0x105')](db[_0xe528('0xb0')],{'as':_0xe528('0x1ae'),'onDelete':'cascade','foreignKey':'AccountId'});db[_0xe528('0xb0')][_0xe528('0x105')](db[_0xe528('0xb2')],{'as':'Subjects','foreignKey':_0xe528('0x1b1')});db[_0xe528('0xb0')][_0xe528('0x105')](db[_0xe528('0xb2')],{'as':'Descriptions','foreignKey':'DescriptionId'});db[_0xe528('0xb0')][_0xe528('0x105')](db[_0xe528('0xb2')],{'as':'Fields','foreignKey':_0xe528('0x1b4')});db[_0xe528('0xb0')][_0xe528('0x110')](db[_0xe528('0xaf')],{'as':'Account','foreignKey':_0xe528('0x1af')});db['VtigerField'][_0xe528('0x105')](db[_0xe528('0xb2')],{'as':_0xe528('0x1b5'),'foreignKey':_0xe528('0x1b1')});db[_0xe528('0xb2')][_0xe528('0x105')](db[_0xe528('0xb2')],{'as':_0xe528('0x1b6'),'foreignKey':_0xe528('0x1b3')});db[_0xe528('0xb2')][_0xe528('0x105')](db[_0xe528('0xb2')],{'as':'Field','foreignKey':_0xe528('0x1b4')});db[_0xe528('0xb2')]['belongsTo'](db['Variable'],{'as':_0xe528('0x83'),'foreignKey':_0xe528('0x1b7')});db['ServicenowAccount'][_0xe528('0x105')](db['ServicenowConfiguration'],{'as':_0xe528('0x1ae'),'onDelete':_0xe528('0x101'),'foreignKey':_0xe528('0x1af')});db[_0xe528('0xb5')][_0xe528('0x105')](db['ServicenowField'],{'as':_0xe528('0x1b0'),'foreignKey':'SubjectId'});db[_0xe528('0xb5')]['hasMany'](db[_0xe528('0xb7')],{'as':_0xe528('0x1b2'),'foreignKey':_0xe528('0x1b3')});db[_0xe528('0xb5')][_0xe528('0x105')](db['ServicenowField'],{'as':_0xe528('0x1ac'),'foreignKey':'FieldId'});db[_0xe528('0xb5')][_0xe528('0x110')](db[_0xe528('0x1bf')],{'as':_0xe528('0x163'),'foreignKey':_0xe528('0x1af')});db[_0xe528('0xb7')]['hasMany'](db[_0xe528('0xb7')],{'as':'Subject','foreignKey':_0xe528('0x1b1')});db[_0xe528('0xb7')][_0xe528('0x105')](db[_0xe528('0xb7')],{'as':_0xe528('0x1b6'),'foreignKey':_0xe528('0x1b3')});db[_0xe528('0xb7')][_0xe528('0x105')](db[_0xe528('0xb7')],{'as':'Field','foreignKey':_0xe528('0x1b4')});db[_0xe528('0xb7')]['belongsTo'](db[_0xe528('0x83')],{'as':_0xe528('0x83'),'foreignKey':_0xe528('0x1b7')});db[_0xe528('0xb9')][_0xe528('0x105')](db[_0xe528('0xbb')],{'as':'Configurations','onDelete':_0xe528('0x101'),'foreignKey':_0xe528('0x1af')});db[_0xe528('0xbb')][_0xe528('0x105')](db[_0xe528('0xbc')],{'as':_0xe528('0x1b0'),'onDelete':_0xe528('0x101'),'foreignKey':_0xe528('0x1b1')});db[_0xe528('0xbb')][_0xe528('0x105')](db[_0xe528('0xbc')],{'as':_0xe528('0x1b2'),'onDelete':_0xe528('0x101'),'foreignKey':'DescriptionId'});db[_0xe528('0xbb')][_0xe528('0x105')](db['Dynamics365Field'],{'as':_0xe528('0x1ac'),'onDelete':_0xe528('0x101'),'foreignKey':_0xe528('0x1b4')});db[_0xe528('0xbb')][_0xe528('0x110')](db[_0xe528('0xb9')],{'as':_0xe528('0x163'),'foreignKey':_0xe528('0x1af')});db['Dynamics365Field'][_0xe528('0x105')](db[_0xe528('0xbc')],{'as':_0xe528('0x1b5'),'foreignKey':_0xe528('0x1b1')});db[_0xe528('0xbc')]['hasMany'](db['Dynamics365Field'],{'as':_0xe528('0x1b6'),'foreignKey':_0xe528('0x1b3')});db[_0xe528('0xbc')]['hasMany'](db[_0xe528('0xbc')],{'as':_0xe528('0x1ba'),'foreignKey':_0xe528('0x1b4')});db[_0xe528('0xbc')][_0xe528('0x110')](db['Variable'],{'as':_0xe528('0x83'),'foreignKey':_0xe528('0x1b7')});db[_0xe528('0xbe')][_0xe528('0x105')](db[_0xe528('0xc0')],{'as':'Configurations','onDelete':_0xe528('0x101'),'foreignKey':_0xe528('0x1af')});db[_0xe528('0xc0')]['hasMany'](db[_0xe528('0x1c0')],{'as':_0xe528('0x1b0'),'foreignKey':_0xe528('0x1b1')});db[_0xe528('0xc0')]['hasMany'](db['FreshsalesField'],{'as':'Descriptions','foreignKey':_0xe528('0x1b3')});db[_0xe528('0xc0')][_0xe528('0x105')](db[_0xe528('0x1c0')],{'as':_0xe528('0x1ac'),'foreignKey':_0xe528('0x1b4')});db['FreshsalesConfiguration'][_0xe528('0x110')](db[_0xe528('0xbe')],{'as':_0xe528('0x163'),'foreignKey':_0xe528('0x1af')});db['FreshsalesField'][_0xe528('0x105')](db[_0xe528('0x1c0')],{'as':_0xe528('0x1b5'),'foreignKey':_0xe528('0x1b1')});db[_0xe528('0x1c0')][_0xe528('0x105')](db[_0xe528('0x1c0')],{'as':_0xe528('0x1b6'),'foreignKey':'DescriptionId'});db[_0xe528('0x1c0')]['hasMany'](db[_0xe528('0x1c0')],{'as':_0xe528('0x1ba'),'foreignKey':_0xe528('0x1b4')});db['FreshsalesField'][_0xe528('0x110')](db[_0xe528('0x83')],{'as':_0xe528('0x83'),'foreignKey':'VariableId'});db[_0xe528('0xc5')][_0xe528('0x110')](db[_0xe528('0x57')],{});db['ChatQueueReport'][_0xe528('0x110')](db['CmList'],{'as':_0xe528('0x16d'),'foreignKey':_0xe528('0x15f')});db['ChatQueueReport']['belongsTo'](db[_0xe528('0x67')],{'as':'Contact','foreignKey':_0xe528('0x155')});db[_0xe528('0xc5')][_0xe528('0x110')](db['ChatInteraction'],{});db[_0xe528('0xc5')][_0xe528('0x110')](db[_0xe528('0x5e')],{});db[_0xe528('0xc5')][_0xe528('0x110')](db[_0xe528('0x13')],{});db[_0xe528('0xc5')][_0xe528('0x110')](db[_0xe528('0x122')],{});db[_0xe528('0xc7')][_0xe528('0x110')](db['User'],{'onDelete':_0xe528('0x101'),'foreignKey':_0xe528('0x1c1')});db[_0xe528('0xc7')]['belongsTo'](db[_0xe528('0x13')],{'onDelete':_0xe528('0x101'),'foreignKey':_0xe528('0x1c2')});db[_0xe528('0xcd')][_0xe528('0x105')](db[_0xe528('0xcb')],{'foreignKey':_0xe528('0x1c3'),'onDelete':_0xe528('0x101')});db['JscriptySessionReport']['hasMany'](db[_0xe528('0xc9')],{'foreignKey':_0xe528('0x1c3'),'onDelete':_0xe528('0x101')});db[_0xe528('0xce')][_0xe528('0x110')](db[_0xe528('0x49')],{});db[_0xe528('0xce')]['belongsTo'](db[_0xe528('0xea')],{'as':_0xe528('0x16d'),'foreignKey':_0xe528('0x15f')});db[_0xe528('0xce')][_0xe528('0x110')](db[_0xe528('0x67')],{'as':_0xe528('0x154'),'foreignKey':_0xe528('0x155')});db[_0xe528('0xce')]['belongsTo'](db[_0xe528('0x10b')],{});db[_0xe528('0xce')][_0xe528('0x110')](db[_0xe528('0x178')],{});db[_0xe528('0xce')][_0xe528('0x110')](db[_0xe528('0x13')],{});db[_0xe528('0xce')][_0xe528('0x110')](db[_0xe528('0x17c')],{});db[_0xe528('0xd2')][_0xe528('0x105')](db['JscriptySessionReport'],{'foreignKey':_0xe528('0x1c4')});db[_0xe528('0xd2')][_0xe528('0x105')](db[_0xe528('0xcb')],{'foreignKey':_0xe528('0x1c4')});db[_0xe528('0xd2')][_0xe528('0x105')](db[_0xe528('0xc9')],{'foreignKey':_0xe528('0x1c4')});db[_0xe528('0xd6')]['belongsToMany'](db['User'],{'as':_0xe528('0x167'),'through':_0xe528('0x138')});db[_0xe528('0x118')][_0xe528('0x112')](db['User'],{'as':_0xe528('0x14b'),'through':_0xe528('0x119')});db[_0xe528('0x118')]['belongsToMany'](db[_0xe528('0x1a')],{'through':'TeamVoiceQueue','as':'VoiceQueues'});db['Team'][_0xe528('0x112')](db[_0xe528('0x36')],{'through':_0xe528('0x161'),'as':_0xe528('0x1c5')});db[_0xe528('0x118')]['belongsToMany'](db[_0xe528('0x122')],{'through':_0xe528('0x188'),'as':_0xe528('0x123')});db[_0xe528('0x118')]['belongsToMany'](db[_0xe528('0x47')],{'through':'team_has_fax_queues','as':_0xe528('0x124')});db['Team']['belongsToMany'](db[_0xe528('0x17c')],{'through':_0xe528('0x1c6'),'as':'SmsQueues'});db[_0xe528('0x118')][_0xe528('0x112')](db[_0xe528('0x55')],{'through':_0xe528('0x182'),'as':'OpenchannelQueues'});db[_0xe528('0x118')][_0xe528('0x112')](db[_0xe528('0x127')],{'through':'team_has_whatsapp_queues','as':'WhatsappQueues'});db[_0xe528('0x118')][_0xe528('0x112')](db['VoicePrefix'],{'through':_0xe528('0xfd'),'as':_0xe528('0x121')});db[_0xe528('0xdc')][_0xe528('0x105')](db[_0xe528('0x68')],{'as':_0xe528('0x140'),'foreignKey':'CampaignId'});db[_0xe528('0xdc')][_0xe528('0x105')](db['CmHopperFinal'],{'as':_0xe528('0x108'),'foreignKey':_0xe528('0x18f')});db[_0xe528('0xdc')][_0xe528('0x105')](db[_0xe528('0x6c')],{'as':_0xe528('0x142'),'foreignKey':_0xe528('0x18f')});db[_0xe528('0xdc')]['hasMany'](db[_0xe528('0x191')],{'as':_0xe528('0x1c7'),'foreignKey':'CampaignId'});db[_0xe528('0xdc')][_0xe528('0x110')](db['Trunk'],{'as':_0xe528('0x27'),'foreignKey':_0xe528('0x144')});db[_0xe528('0xdc')][_0xe528('0x110')](db[_0xe528('0x27')],{'as':_0xe528('0x1c8'),'foreignKey':'TrunkBackupId'});db[_0xe528('0xdc')][_0xe528('0x110')](db[_0xe528('0x78')],{'as':_0xe528('0x78'),'foreignKey':_0xe528('0x146')});db[_0xe528('0xdc')][_0xe528('0x110')](db[_0xe528('0xd6')],{'as':_0xe528('0xd6'),'foreignKey':'SquareProjectId'});db[_0xe528('0xdc')]['belongsToMany'](db[_0xe528('0xea')],{'as':_0xe528('0x1c9'),'through':_0xe528('0x1ca')});db[_0xe528('0xdc')][_0xe528('0x112')](db[_0xe528('0xea')],{'as':_0xe528('0x14d'),'through':'campaigns_has_cm_blacklists'});db[_0xe528('0x168')]['belongsTo'](db[_0xe528('0x60')],{'as':_0xe528('0x60'),'foreignKey':_0xe528('0x16b')});db[_0xe528('0xe3')]['belongsTo'](db['MailMessage'],{});db[_0xe528('0xe3')]['belongsTo'](db[_0xe528('0x38')],{});db[_0xe528('0xe3')][_0xe528('0x110')](db[_0xe528('0x35')],{'foreignKey':_0xe528('0x1cb'),'as':_0xe528('0x1cc')});db['MailTransferReport']['belongsTo'](db[_0xe528('0x13')],{'foreignKey':'FromUserId','as':'FromAgent'});db[_0xe528('0xe3')][_0xe528('0x110')](db[_0xe528('0x13')],{'foreignKey':_0xe528('0x1cd'),'as':_0xe528('0x1ce')});db[_0xe528('0xe3')]['belongsTo'](db[_0xe528('0x36')],{'foreignKey':'ToMailQueueId','as':_0xe528('0x1cf')});db[_0xe528('0xe3')]['belongsTo'](db['MailAccount'],{'foreignKey':_0xe528('0x1d0'),'as':_0xe528('0x1d1')});db[_0xe528('0x1d2')]['belongsTo'](db[_0xe528('0x5e')],{});db[_0xe528('0x1d2')][_0xe528('0x110')](db['ChatInteraction'],{});db[_0xe528('0x1d2')][_0xe528('0x110')](db[_0xe528('0x57')],{'foreignKey':'FromChatWebsiteId','as':_0xe528('0x1cc')});db['ChatTransferReport']['belongsTo'](db['User'],{'foreignKey':_0xe528('0x1d3'),'as':_0xe528('0x1d4')});db[_0xe528('0x1d2')][_0xe528('0x110')](db['User'],{'foreignKey':_0xe528('0x1cd'),'as':'ToAgent'});db[_0xe528('0x1d2')][_0xe528('0x110')](db['ChatQueue'],{'foreignKey':_0xe528('0x1d5'),'as':_0xe528('0x1cf')});db[_0xe528('0x1d2')][_0xe528('0x110')](db['ChatWebsite'],{'foreignKey':_0xe528('0x1d6'),'as':_0xe528('0x1d1')});db['FaxTransferReport'][_0xe528('0x110')](db['FaxMessage'],{});db[_0xe528('0xe5')]['belongsTo'](db[_0xe528('0x44')],{});db['FaxTransferReport'][_0xe528('0x110')](db[_0xe528('0x41')],{'foreignKey':_0xe528('0x1d7'),'as':'FromAccount'});db[_0xe528('0xe5')][_0xe528('0x110')](db['User'],{'foreignKey':_0xe528('0x1d3'),'as':_0xe528('0x1d4')});db['FaxTransferReport'][_0xe528('0x110')](db[_0xe528('0x13')],{'foreignKey':_0xe528('0x1cd'),'as':'ToAgent'});db[_0xe528('0xe5')]['belongsTo'](db['FaxQueue'],{'foreignKey':_0xe528('0x1d8'),'as':_0xe528('0x1cf')});db['FaxTransferReport']['belongsTo'](db[_0xe528('0x41')],{'foreignKey':_0xe528('0x1d9'),'as':_0xe528('0x1d1')});db[_0xe528('0xe7')]['belongsTo'](db['OpenchannelMessage'],{});db[_0xe528('0xe7')][_0xe528('0x110')](db['OpenchannelInteraction'],{});db['OpenchannelTransferReport'][_0xe528('0x110')](db[_0xe528('0x4e')],{'foreignKey':'FromOpenchannelAccountId','as':'FromAccount'});db[_0xe528('0xe7')][_0xe528('0x110')](db[_0xe528('0x13')],{'foreignKey':_0xe528('0x1d3'),'as':_0xe528('0x1d4')});db['OpenchannelTransferReport']['belongsTo'](db['User'],{'foreignKey':'ToUserId','as':_0xe528('0x1ce')});db['OpenchannelTransferReport']['belongsTo'](db[_0xe528('0x55')],{'foreignKey':_0xe528('0x1da'),'as':'ToQueue'});db[_0xe528('0xe7')][_0xe528('0x110')](db[_0xe528('0x4e')],{'foreignKey':'ToOpenchannelAccountId','as':'ToAccount'});db[_0xe528('0xe9')][_0xe528('0x110')](db[_0xe528('0x178')],{});db[_0xe528('0xe9')][_0xe528('0x110')](db[_0xe528('0x10b')],{});db['SmsTransferReport']['belongsTo'](db['SmsAccount'],{'foreignKey':_0xe528('0x1db'),'as':'FromAccount'});db[_0xe528('0xe9')][_0xe528('0x110')](db[_0xe528('0x13')],{'foreignKey':_0xe528('0x1d3'),'as':_0xe528('0x1d4')});db[_0xe528('0xe9')][_0xe528('0x110')](db[_0xe528('0x13')],{'foreignKey':_0xe528('0x1cd'),'as':_0xe528('0x1ce')});db[_0xe528('0xe9')][_0xe528('0x110')](db[_0xe528('0x17c')],{'foreignKey':'ToSmsQueueId','as':_0xe528('0x1cf')});db['SmsTransferReport']['belongsTo'](db[_0xe528('0x49')],{'foreignKey':'ToSmsAccountId','as':_0xe528('0x1d1')});db['CmList']['hasMany'](db[_0xe528('0x76')],{'as':'Dispositions','foreignKey':_0xe528('0x15f'),'onDelete':'cascade'});db['CmList']['hasMany'](db[_0xe528('0x6f')],{'as':_0xe528('0x1dc'),'foreignKey':'ListId'});db['CmList'][_0xe528('0x105')](db[_0xe528('0x67')],{'as':_0xe528('0x115'),'onDelete':'cascade','foreignKey':_0xe528('0x15f')});db[_0xe528('0xea')]['hasMany'](db[_0xe528('0x141')],{'as':_0xe528('0x108'),'foreignKey':_0xe528('0x15f')});db[_0xe528('0xea')][_0xe528('0x105')](db[_0xe528('0x6c')],{'as':_0xe528('0x1dd'),'foreignKey':'ListId'});db[_0xe528('0xea')]['hasMany'](db[_0xe528('0x6d')],{'as':_0xe528('0x6d'),'foreignKey':'ListId'});db[_0xe528('0xea')][_0xe528('0x112')](db[_0xe528('0x1a')],{'as':_0xe528('0x1de'),'through':'voice_queues_has_cm_lists'});db[_0xe528('0xea')][_0xe528('0x112')](db[_0xe528('0x13')],{'as':_0xe528('0x14b'),'through':_0xe528('0x117')});db[_0xe528('0xeb')]['hasMany'](db[_0xe528('0x107')],{'as':_0xe528('0x19b'),'onDelete':_0xe528('0x101')});db[_0xe528('0xeb')][_0xe528('0x112')](db[_0xe528('0x13')],{'as':_0xe528('0x14b'),'through':_0xe528('0xff')});db['VoicePrefix']['belongsToMany'](db[_0xe528('0x118')],{'through':_0xe528('0xfd'),'as':'Teams'});db[_0xe528('0x111')]['hasMany'](db['User'],{'as':'Users','foreignKey':_0xe528('0x1df')});db[_0xe528('0x111')]['hasMany'](db[_0xe528('0x1e0')],{'as':_0xe528('0x1e1'),'foreignKey':_0xe528('0x1df'),'onDelete':'cascade'});db[_0xe528('0x1e0')][_0xe528('0x105')](db[_0xe528('0xee')],{'as':_0xe528('0x1e2'),'foreignKey':_0xe528('0x1e3'),'onDelete':_0xe528('0x101')});db[_0xe528('0xf2')][_0xe528('0x105')](db[_0xe528('0x76')],{'as':_0xe528('0x15b'),'foreignKey':'WhatsappAccountId','onDelete':'cascade'});db[_0xe528('0xf2')][_0xe528('0x105')](db['CannedAnswer'],{'as':'Answers','foreignKey':_0xe528('0x1e4')});db['WhatsappAccount']['hasMany'](db[_0xe528('0xf7')],{'as':_0xe528('0x14e'),'foreignKey':_0xe528('0x1e4')});db[_0xe528('0xf2')]['hasMany'](db[_0xe528('0xf5')],{'as':_0xe528('0x15e')});db[_0xe528('0xf2')][_0xe528('0x105')](db[_0xe528('0xf4')],{'as':_0xe528('0x13a')});db[_0xe528('0xf2')][_0xe528('0x110')](db['CmList'],{'as':_0xe528('0x16d'),'foreignKey':'ListId'});db[_0xe528('0xf2')]['belongsTo'](db['Pause'],{'as':_0xe528('0x148'),'foreignKey':_0xe528('0x149')});db['WhatsappAccount'][_0xe528('0x112')](db['User'],{'as':'Agents','through':_0xe528('0x136')});db['WhatsappApplication'][_0xe528('0x110')](db[_0xe528('0x13')],{'onDelete':_0xe528('0x16c')});db[_0xe528('0xf4')][_0xe528('0x110')](db[_0xe528('0x127')],{'onDelete':_0xe528('0x16c')});db[_0xe528('0xf4')][_0xe528('0x110')](db[_0xe528('0xf2')],{'onDelete':_0xe528('0x16c')});db['WhatsappApplication']['belongsTo'](db['Interval'],{'onDelete':_0xe528('0x16c'),'foreignKey':_0xe528('0x146')});db[_0xe528('0xf4')][_0xe528('0x110')](db[_0xe528('0x7f')],{'onDelete':_0xe528('0x16c'),'foreignKey':'TagId'});db[_0xe528('0xf5')][_0xe528('0x105')](db['WhatsappMessage'],{'as':_0xe528('0x14e'),'onDelete':_0xe528('0x101'),'foreignKey':'WhatsappInteractionId'});db['WhatsappInteraction'][_0xe528('0x110')](db['WhatsappAccount'],{'as':_0xe528('0x163'),'foreignKey':_0xe528('0x1e4')});db[_0xe528('0xf5')][_0xe528('0x110')](db[_0xe528('0x67')],{'as':_0xe528('0x154'),'foreignKey':_0xe528('0x155')});db[_0xe528('0xf5')][_0xe528('0x110')](db[_0xe528('0x13')],{'as':_0xe528('0x164'),'foreignKey':_0xe528('0x104')});db['WhatsappInteraction'][_0xe528('0x112')](db[_0xe528('0x7f')],{'through':_0xe528('0x1a5'),'as':_0xe528('0x165')});db[_0xe528('0xf5')]['belongsToMany'](db['Tag'],{'through':'whatsapp_interaction_has_tags','as':_0xe528('0x166')});db['WhatsappInteraction']['belongsToMany'](db[_0xe528('0x13')],{'as':_0xe528('0x167'),'through':_0xe528('0x1e5'),'foreignKey':_0xe528('0x1e6')});db[_0xe528('0xf7')][_0xe528('0x110')](db['User'],{'as':_0xe528('0x13')});db[_0xe528('0xf7')][_0xe528('0x110')](db['CmContact'],{'onDelete':_0xe528('0x101'),'as':_0xe528('0x154')});db['WhatsappMessage'][_0xe528('0x110')](db[_0xe528('0xf5')],{'onDelete':'cascade','as':_0xe528('0x16a'),'foreignKey':_0xe528('0x1e6')});db['WhatsappMessage'][_0xe528('0x110')](db['WhatsappAccount'],{'as':_0xe528('0x163'),'foreignKey':_0xe528('0x1e4')});db[_0xe528('0xf9')][_0xe528('0x110')](db[_0xe528('0xf2')],{});db[_0xe528('0xf9')][_0xe528('0x110')](db[_0xe528('0xea')],{'as':_0xe528('0x16d'),'foreignKey':_0xe528('0x15f')});db[_0xe528('0xf9')]['belongsTo'](db[_0xe528('0x67')],{'as':_0xe528('0x154'),'foreignKey':_0xe528('0x155')});db[_0xe528('0xf9')]['belongsTo'](db[_0xe528('0xf5')],{});db[_0xe528('0xf9')][_0xe528('0x110')](db[_0xe528('0x127')],{});db[_0xe528('0xf9')][_0xe528('0x110')](db[_0xe528('0xf7')],{});db['WhatsappQueueReport']['belongsTo'](db['User'],{});db[_0xe528('0xfa')][_0xe528('0x110')](db['WhatsappMessage'],{});db[_0xe528('0xfa')][_0xe528('0x110')](db[_0xe528('0xf5')],{});db[_0xe528('0xfa')][_0xe528('0x110')](db[_0xe528('0xf2')],{'foreignKey':_0xe528('0x1e7'),'as':_0xe528('0x1cc')});db['WhatsappTransferReport'][_0xe528('0x110')](db[_0xe528('0xf2')],{'foreignKey':_0xe528('0x1e8'),'as':'ToAccount'});db[_0xe528('0xfa')][_0xe528('0x110')](db[_0xe528('0x127')],{'foreignKey':_0xe528('0x1e9'),'as':'ToQueue'});db['WhatsappTransferReport']['belongsTo'](db['User'],{'foreignKey':_0xe528('0x1d3'),'as':'FromAgent'});db[_0xe528('0xfa')][_0xe528('0x110')](db[_0xe528('0x13')],{'foreignKey':'ToUserId','as':_0xe528('0x1ce')});db[_0xe528('0x127')][_0xe528('0x112')](db[_0xe528('0x13')],{'as':_0xe528('0x14b'),'through':_0xe528('0x129'),'foreignKey':_0xe528('0x1ea')});db[_0xe528('0x127')][_0xe528('0x112')](db[_0xe528('0x118')],{'through':_0xe528('0x1eb'),'as':_0xe528('0x14c')});module['exports']={'db':db,'dbH':dbH}; \ No newline at end of file +var _0xaf2c=['../api/cmList/cmList.model','VoicePrefix','../api/voicePrefix/voicePrefix.model','UserProfile','../api/userProfile/userProfile.model','../api/userProfileSection/userProfileSection.model','UserProfileResource','../api/userProfileResource/userProfileResource.model','UserNotification','WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','../api/whatsappInteraction/whatsappInteraction.model','../api/whatsappMessage/whatsappMessage.model','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','WhatsappTransferReport','../api/whatsappTransferReport/whatsappTransferReport.model','../api/whatsappQueue/whatsappQueue.model','CloudProvider','../api/cloudProvider/cloudProvider.model','TeamVoiceQueue','../api/teamVoiceQueue/teamVoiceQueue.model','TeamVoicePrefix','UserVoicePrefix','../api/userVoicePrefix/userVoicePrefix.model','cascade','hasMany','VoiceQueuesRt','UserId','Extensions','CmHopperHistory','HopperHistory','ReportAgentPreview','OpenchannelInteractions','SmsInteraction','FaxInteractions','MailInteractions','WhatsappInteraction','UserNotifications','SenderId','belongsTo','userProfileId','belongsToMany','ChatGroup','Groups','chat_group_has_users','Contacts','cm_user_has_contacts','CmList','cm_user_has_lists','ChatInteractions','user_has_chat_interactions','user_has_fax_interactions','SmsInteractions','user_has_sms_interactions','user_has_openchannel_interactions','WhatsappInteractions','user_has_whatsapp_interactions','VoicePrefixes','MailQueue','MailQueues','ChatQueue','ChatQueues','FaxQueues','SmsQueue','WhatsappQueue','WhatsappQueues','ChatWebsites','FaxAccounts','user_has_fax_accounts','user_has_mail_accounts','user_has_openchannel_accounts','SmsAccounts','user_has_sms_accounts','WhatsappAccounts','user_has_whatsapp_accounts','SquareProject','user_has_square_projects','ChanSpyId','VoiceContext','Applications','moh_has_sounds','Members','VoiceQueueId','Hoppers','HopperFinals','HopperHistories','HopperBlacks','Trunk','TrunkId','TrunkBackup','TrunkBackupId','IntervalId','mandatoryDispositionPauseId','voice_queues_has_cm_lists','Agents','Teams','BlackLists','voice_queues_has_cm_blacklists','Messages','mailboxuser','mailbox','QueueCalls','uniqueid','AgentReports','ContactId','MailServerIn','MailAccount','MailAccountId','hasOne','Imap','Smtp','Disposition','Dispositions','CannedAnswer','Answers','MailApplication','List','TemplateId','team_has_mail_queues','MailInteractionId','Contact','Owner','mail_interaction_has_tags','Tags','ThroughTags','Users','user_has_mail_interactions','Attachments','ChatOfflineMessage','ChatOfflineMessageId','restrict','TagId','ListId','Dashboard','Items','FaxAccountId','Interactions','Exntensions','fax_interaction_has_tags','FaxInteractionId','FaxMessage','AttachmentId','Account','team_has_fax_queues','SmsAccountId','mandatoryDispositionPause','SmsInteractionId','sms_interaction_has_tags','Interaction','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','OpenchannelApplication','OpenchannelQueueId','OpenchannelInteractionId','openchannel_interaction_has_tags','team_has_openchannel_queues','ChatWebsiteId','ProactiveActions','ChatInteraction','user_has_chat_websites','Agent','ChatInteractionId','chat_interaction_has_tags','team_has_chat_queues','ChatGroupId','Website','CmCompany','CompanyId','Company','cm_contact_has_tags','Queue','CampaignId','OwnerId','OneAll','AutomationAllId','Any','OneAny','AutomationAnyId','Actions','AutomationId','ParentId','Intervals','MailApplications','SmsApplications','DefaultReportId','CustomReportId','Mohs','whatsapp_interaction_has_tags','AllConditions','AllCondition','TriggerAllId','Trigger','TriggerAnyId','Fields','AnalyticMetric','MetricId','AccountId','SalesforceField','SubjectId','DescriptionId','FieldId','Subject','Description','VariableId','SugarcrmConfiguration','Configurations','Subjects','Descriptions','SugarcrmField','Field','DeskAccount','ZendeskConfiguration','int_zendesk_configuration_has_tags','FreshdeskConfiguration','Dynamics365Field','FreshsalesField','ChatQueueReport','FromId','SessionId','SmsQueueReport','ProjectId','user_has_teams','SmsQueues','OpenchannelQueues','team_has_whatsapp_queues','SquareProjectId','Lists','campaigns_has_cm_lists','campaigns_has_cm_blacklists','FromMailAccountId','FromAccount','FromAgent','ToUserId','ToAgent','ToMailAccountId','ToAccount','FromChatWebsiteId','FromUserId','ToChatQueueId','ToQueue','ToChatWebsiteId','FromFaxAccountId','ToFaxQueueId','ToFaxAccountId','OpenchannelTransferReport','FromOpenchannelAccountId','ToOpenchannelQueueId','ToOpenchannelAccountId','FromSmsAccountId','ToSmsAccountId','CustomFields','Queues','UserProfileSection','UserProfileSections','Resources','sectionId','WhatsappAccountId','WhatsappMessage','WhatsappInteractionId','FromWhatsappAccountId','ToWhatsappAccountId','ToQueueId','WhatsappQueueId','exports','../config/environment','jstz','sequelize','defaultsDeep','motion2','xcall','xC@LL1234','utf8mb4','name','utf8','utf8_general_ci','sequelizeHistory','127.0.0.1','mysql','database','username','password','options','User','import','../api/user/user.model','VoiceChanSpy','../api/voiceChanSpy/voiceChanSpy.model','../api/voiceContext/voiceContext.model','VoiceExtension','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','VoiceRecording','../api/voiceRecording/voiceRecording.model','ScreenRecording','../api/screenRecording/screenRecording.model','VoiceMail','../api/voiceMail/voiceMail.model','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','VoiceCallReport','../api/voiceCallReport/voiceCallReport.model','../api/voiceDialReport/voiceDialReport.model','VoiceAgentReport','../api/voiceAgentReport/voiceAgentReport.model','MemberReport','../api/memberReport/memberReport.model','../api/trunk/trunk.model','VoiceTransferReport','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','UserChatQueue','UserMailQueue','../api/userMailQueue/userMailQueue.model','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','../api/userSmsQueue/userSmsQueue.model','UserOpenchannelQueue','UserWhatsappQueue','../api/mailServerIn/mailServerIn.model','MailServerOut','../api/mailAccount/mailAccount.model','../api/mailQueue/mailQueue.model','MailSubstatus','../api/mailSubstatus/mailSubstatus.model','MailInteraction','../api/mailInteraction/mailInteraction.model','MailMessage','../api/mailMessage/mailMessage.model','../api/mailApplication/mailApplication.model','MailQueueReport','../api/mailQueueReport/mailQueueReport.model','../api/dashboard/dashboard.model','DashboardItem','../api/dashboardItem/dashboardItem.model','FaxAccount','FaxApplication','../api/faxApplication/faxApplication.model','FaxInteraction','../api/faxInteraction/faxInteraction.model','../api/faxMessage/faxMessage.model','FaxQueue','../api/faxQueue/faxQueue.model','FaxQueueReport','SmsAccount','../api/smsAccount/smsAccount.model','SmsApplication','../api/smsApplication/smsApplication.model','../api/smsInteraction/smsInteraction.model','SmsMessage','../api/smsQueue/smsQueue.model','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelMessage','../api/openchannelMessage/openchannelMessage.model','OpenchannelQueue','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','../api/openchannelQueueReport/openchannelQueueReport.model','ChatApplication','../api/chatApplication/chatApplication.model','../api/chatInteraction/chatInteraction.model','ChatMessage','../api/chatMessage/chatMessage.model','../api/chatOfflineMessage/chatOfflineMessage.model','../api/chatQueue/chatQueue.model','../api/chatGroup/chatGroup.model','ChatProactiveAction','../api/chatProactiveAction/chatProactiveAction.model','../api/cmCompany/cmCompany.model','CmContact','../api/cmContact/cmContact.model','CmHopper','../api/cmHopper/cmHopper.model','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','../api/cmHopperHistory/cmHopperHistory.model','CmCustomField','../api/cmCustomField/cmCustomField.model','Action','../api/action/action.model','Automation','../api/automation/automation.model','../api/cannedAnswer/cannedAnswer.model','../api/disposition/disposition.model','Condition','../api/condition/condition.model','Interval','Pause','../api/pause/pause.model','Cdr','../api/cdr/cdr.model','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','../api/schedule/schedule.model','Sound','Tag','../api/tag/tag.model','Template','../api/template/template.model','../api/trigger/trigger.model','Variable','Integration','../api/integration/integration.model','IntegrationReport','../api/integrationReport/integrationReport.model','AnalyticCustomReport','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','../api/analyticMetric/analyticMetric.model','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','AnalyticTreeReport','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SugarcrmAccount','../api/intSugarcrmAccount/intSugarcrmAccount.model','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','../api/intSugarcrmField/intSugarcrmField.model','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','../api/intDeskField/intDeskField.model','ZohoAccount','ZohoConfiguration','ZohoField','../api/intZohoField/intZohoField.model','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','../api/intZendeskField/intZendeskField.model','FreshdeskAccount','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','VtigerAccount','VtigerConfiguration','../api/intVtigerConfiguration/intVtigerConfiguration.model','VtigerField','../api/intVtigerField/intVtigerField.model','ServicenowAccount','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','ServicenowField','Dynamics365Account','../api/intDynamics365Account/intDynamics365Account.model','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','../api/intFreshsalesField/intFreshsalesField.model','Network','../api/network/network.model','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','JscriptyQuestionReport','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','../api/smsQueueReport/smsQueueReport.model','SquareReport','../api/squareReport/squareReport.model','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','JscriptyProject','../api/jscriptyProject/jscriptyProject.model','../api/setting/setting.model','SquareOdbc','../api/squareOdbc/squareOdbc.model','../api/squareProject/squareProject.model','SquareRecording','SquareMessage','../api/squareMessage/squareMessage.model','Team','../api/team/team.model','License','Campaign','../api/campaign/campaign.model','Migration','../api/migration/migration.model','Attachment','../api/attachment/attachment.model','Plugin','../api/plugin/plugin.model','MailTransferReport','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport'];(function(_0x533528,_0x409d05){var _0x3189f1=function(_0x5e63d2){while(--_0x5e63d2){_0x533528['push'](_0x533528['shift']());}};_0x3189f1(++_0x409d05);}(_0xaf2c,0x10c));var _0xcaf2=function(_0x10b623,_0x3a0272){_0x10b623=_0x10b623-0x0;var _0x3959f0=_0xaf2c[_0x10b623];return _0x3959f0;};'use strict';var config=require(_0xcaf2('0x0'));var Sequelize=require('sequelize');var _=require('lodash');var jstz=require(_0xcaf2('0x1'));var timezone=jstz['determine']();config[_0xcaf2('0x2')]=_[_0xcaf2('0x3')](config[_0xcaf2('0x2')],{'database':_0xcaf2('0x4'),'username':_0xcaf2('0x5'),'password':_0xcaf2('0x6'),'options':{'host':'127.0.0.1','port':0xcea,'dialect':'mysql','dialectOptions':{'charset':_0xcaf2('0x7')},'logging':![],'timezone':timezone[_0xcaf2('0x8')](),'define':{'charset':_0xcaf2('0x9'),'collate':_0xcaf2('0xa')}}});config[_0xcaf2('0xb')]=_[_0xcaf2('0x3')](config[_0xcaf2('0xb')],{'database':_0xcaf2('0x4'),'username':_0xcaf2('0x5'),'password':_0xcaf2('0x6'),'options':{'host':_0xcaf2('0xc'),'port':0xcea,'dialect':_0xcaf2('0xd'),'dialectOptions':{'charset':_0xcaf2('0x7')},'logging':![],'timezone':timezone[_0xcaf2('0x8')](),'define':{'charset':_0xcaf2('0x9'),'collate':_0xcaf2('0xa')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0xcaf2('0x2')][_0xcaf2('0xe')],config[_0xcaf2('0x2')][_0xcaf2('0xf')],config['sequelize'][_0xcaf2('0x10')],config[_0xcaf2('0x2')][_0xcaf2('0x11')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0xcaf2('0xb')][_0xcaf2('0xe')],config[_0xcaf2('0xb')][_0xcaf2('0xf')],config['sequelizeHistory'][_0xcaf2('0x10')],config[_0xcaf2('0xb')]['options'])};db[_0xcaf2('0x12')]=db['sequelize'][_0xcaf2('0x13')](_0xcaf2('0x14'));db[_0xcaf2('0x15')]=db[_0xcaf2('0x2')][_0xcaf2('0x13')](_0xcaf2('0x16'));db['VoiceContext']=db[_0xcaf2('0x2')]['import'](_0xcaf2('0x17'));db[_0xcaf2('0x18')]=db[_0xcaf2('0x2')][_0xcaf2('0x13')](_0xcaf2('0x19'));db[_0xcaf2('0x1a')]=db[_0xcaf2('0x2')][_0xcaf2('0x13')](_0xcaf2('0x1b'));db[_0xcaf2('0x1c')]=db[_0xcaf2('0x2')][_0xcaf2('0x13')]('../api/voiceQueue/voiceQueue.model');db[_0xcaf2('0x1d')]=db['sequelize'][_0xcaf2('0x13')](_0xcaf2('0x1e'));db[_0xcaf2('0x1f')]=db[_0xcaf2('0x2')][_0xcaf2('0x13')](_0xcaf2('0x20'));db[_0xcaf2('0x21')]=db[_0xcaf2('0x2')][_0xcaf2('0x13')](_0xcaf2('0x22'));db[_0xcaf2('0x23')]=db['sequelize'][_0xcaf2('0x13')](_0xcaf2('0x24'));db[_0xcaf2('0x25')]=db[_0xcaf2('0x2')]['import'](_0xcaf2('0x26'));db['VoiceDialReport']=db['sequelize'][_0xcaf2('0x13')](_0xcaf2('0x27'));db[_0xcaf2('0x28')]=db['sequelize'][_0xcaf2('0x13')](_0xcaf2('0x29'));db['VoiceQueueReport']=db[_0xcaf2('0x2')][_0xcaf2('0x13')]('../api/voiceQueueReport/voiceQueueReport.model');db[_0xcaf2('0x2a')]=db[_0xcaf2('0x2')]['import'](_0xcaf2('0x2b'));db['Trunk']=db[_0xcaf2('0x2')][_0xcaf2('0x13')](_0xcaf2('0x2c'));db[_0xcaf2('0x2d')]=db[_0xcaf2('0x2')][_0xcaf2('0x13')](_0xcaf2('0x2e'));db[_0xcaf2('0x2f')]=db[_0xcaf2('0x2')][_0xcaf2('0x13')](_0xcaf2('0x30'));db[_0xcaf2('0x31')]=db['sequelize'][_0xcaf2('0x13')](_0xcaf2('0x32'));db[_0xcaf2('0x33')]=db[_0xcaf2('0x2')][_0xcaf2('0x13')]('../api/userChatQueue/userChatQueue.model');db[_0xcaf2('0x34')]=db[_0xcaf2('0x2')][_0xcaf2('0x13')](_0xcaf2('0x35'));db[_0xcaf2('0x36')]=db[_0xcaf2('0x2')][_0xcaf2('0x13')](_0xcaf2('0x37'));db[_0xcaf2('0x38')]=db[_0xcaf2('0x2')][_0xcaf2('0x13')](_0xcaf2('0x39'));db[_0xcaf2('0x3a')]=db[_0xcaf2('0x2')][_0xcaf2('0x13')]('../api/userOpenchannelQueue/userOpenchannelQueue.model');db[_0xcaf2('0x3b')]=db[_0xcaf2('0x2')][_0xcaf2('0x13')]('../api/userWhatsappQueue/userWhatsappQueue.model');db['MailServerIn']=db[_0xcaf2('0x2')][_0xcaf2('0x13')](_0xcaf2('0x3c'));db[_0xcaf2('0x3d')]=db[_0xcaf2('0x2')][_0xcaf2('0x13')]('../api/mailServerOut/mailServerOut.model');db['MailAccount']=db[_0xcaf2('0x2')]['import'](_0xcaf2('0x3e'));db['MailQueue']=db['sequelize'][_0xcaf2('0x13')](_0xcaf2('0x3f'));db[_0xcaf2('0x40')]=db['sequelize'][_0xcaf2('0x13')](_0xcaf2('0x41'));db[_0xcaf2('0x42')]=db[_0xcaf2('0x2')][_0xcaf2('0x13')](_0xcaf2('0x43'));db[_0xcaf2('0x44')]=db[_0xcaf2('0x2')][_0xcaf2('0x13')](_0xcaf2('0x45'));db['MailApplication']=db[_0xcaf2('0x2')][_0xcaf2('0x13')](_0xcaf2('0x46'));db[_0xcaf2('0x47')]=db[_0xcaf2('0x2')][_0xcaf2('0x13')](_0xcaf2('0x48'));db['Dashboard']=db['sequelize'][_0xcaf2('0x13')](_0xcaf2('0x49'));db[_0xcaf2('0x4a')]=db['sequelize']['import'](_0xcaf2('0x4b'));db[_0xcaf2('0x4c')]=db[_0xcaf2('0x2')]['import']('../api/faxAccount/faxAccount.model');db[_0xcaf2('0x4d')]=db['sequelize'][_0xcaf2('0x13')](_0xcaf2('0x4e'));db[_0xcaf2('0x4f')]=db['sequelize'][_0xcaf2('0x13')](_0xcaf2('0x50'));db['FaxMessage']=db[_0xcaf2('0x2')][_0xcaf2('0x13')](_0xcaf2('0x51'));db[_0xcaf2('0x52')]=db[_0xcaf2('0x2')]['import'](_0xcaf2('0x53'));db[_0xcaf2('0x54')]=db[_0xcaf2('0x2')][_0xcaf2('0x13')]('../api/faxQueueReport/faxQueueReport.model');db[_0xcaf2('0x55')]=db[_0xcaf2('0x2')]['import'](_0xcaf2('0x56'));db[_0xcaf2('0x57')]=db['sequelize'][_0xcaf2('0x13')](_0xcaf2('0x58'));db['SmsInteraction']=db[_0xcaf2('0x2')][_0xcaf2('0x13')](_0xcaf2('0x59'));db[_0xcaf2('0x5a')]=db[_0xcaf2('0x2')]['import']('../api/smsMessage/smsMessage.model');db['SmsQueue']=db[_0xcaf2('0x2')][_0xcaf2('0x13')](_0xcaf2('0x5b'));db[_0xcaf2('0x5c')]=db[_0xcaf2('0x2')][_0xcaf2('0x13')](_0xcaf2('0x5d'));db['OpenchannelApplication']=db[_0xcaf2('0x2')][_0xcaf2('0x13')](_0xcaf2('0x5e'));db[_0xcaf2('0x5f')]=db[_0xcaf2('0x2')][_0xcaf2('0x13')](_0xcaf2('0x60'));db[_0xcaf2('0x61')]=db[_0xcaf2('0x2')]['import'](_0xcaf2('0x62'));db[_0xcaf2('0x63')]=db[_0xcaf2('0x2')][_0xcaf2('0x13')](_0xcaf2('0x64'));db[_0xcaf2('0x65')]=db['sequelize'][_0xcaf2('0x13')](_0xcaf2('0x66'));db[_0xcaf2('0x67')]=db[_0xcaf2('0x2')][_0xcaf2('0x13')](_0xcaf2('0x68'));db[_0xcaf2('0x69')]=db[_0xcaf2('0x2')][_0xcaf2('0x13')](_0xcaf2('0x6a'));db['ChatInteraction']=db[_0xcaf2('0x2')][_0xcaf2('0x13')](_0xcaf2('0x6b'));db[_0xcaf2('0x6c')]=db[_0xcaf2('0x2')][_0xcaf2('0x13')](_0xcaf2('0x6d'));db['ChatOfflineMessage']=db[_0xcaf2('0x2')][_0xcaf2('0x13')](_0xcaf2('0x6e'));db['ChatQueue']=db[_0xcaf2('0x2')][_0xcaf2('0x13')](_0xcaf2('0x6f'));db['ChatGroup']=db[_0xcaf2('0x2')][_0xcaf2('0x13')](_0xcaf2('0x70'));db[_0xcaf2('0x71')]=db[_0xcaf2('0x2')][_0xcaf2('0x13')](_0xcaf2('0x72'));db['CmCompany']=db[_0xcaf2('0x2')]['import'](_0xcaf2('0x73'));db[_0xcaf2('0x74')]=db[_0xcaf2('0x2')][_0xcaf2('0x13')](_0xcaf2('0x75'));db[_0xcaf2('0x76')]=db[_0xcaf2('0x2')][_0xcaf2('0x13')](_0xcaf2('0x77'));db[_0xcaf2('0x78')]=db[_0xcaf2('0x2')][_0xcaf2('0x13')](_0xcaf2('0x79'));db[_0xcaf2('0x7a')]=db['sequelize'][_0xcaf2('0x13')](_0xcaf2('0x7b'));db['CmHopperHistory']=db[_0xcaf2('0x2')][_0xcaf2('0x13')](_0xcaf2('0x7c'));db['ReportAgentPreview']=db[_0xcaf2('0x2')][_0xcaf2('0x13')]('../api/reportAgentPreview/reportAgentPreview.model');db[_0xcaf2('0x7d')]=db[_0xcaf2('0x2')][_0xcaf2('0x13')](_0xcaf2('0x7e'));db[_0xcaf2('0x7f')]=db[_0xcaf2('0x2')][_0xcaf2('0x13')](_0xcaf2('0x80'));db[_0xcaf2('0x81')]=db[_0xcaf2('0x2')][_0xcaf2('0x13')](_0xcaf2('0x82'));db['CannedAnswer']=db[_0xcaf2('0x2')][_0xcaf2('0x13')](_0xcaf2('0x83'));db['Disposition']=db[_0xcaf2('0x2')][_0xcaf2('0x13')](_0xcaf2('0x84'));db[_0xcaf2('0x85')]=db[_0xcaf2('0x2')][_0xcaf2('0x13')](_0xcaf2('0x86'));db[_0xcaf2('0x87')]=db[_0xcaf2('0x2')][_0xcaf2('0x13')]('../api/interval/interval.model');db[_0xcaf2('0x88')]=db['sequelize'][_0xcaf2('0x13')](_0xcaf2('0x89'));db[_0xcaf2('0x8a')]=db['sequelize'][_0xcaf2('0x13')](_0xcaf2('0x8b'));db['VoiceQueuesLog']=db[_0xcaf2('0x2')]['import'](_0xcaf2('0x8c'));db[_0xcaf2('0x8d')]=db[_0xcaf2('0x2')][_0xcaf2('0x13')](_0xcaf2('0x8e'));db[_0xcaf2('0x8f')]=db[_0xcaf2('0x2')][_0xcaf2('0x13')]('../api/sound/sound.model');db[_0xcaf2('0x90')]=db[_0xcaf2('0x2')][_0xcaf2('0x13')](_0xcaf2('0x91'));db[_0xcaf2('0x92')]=db[_0xcaf2('0x2')][_0xcaf2('0x13')](_0xcaf2('0x93'));db['Trigger']=db[_0xcaf2('0x2')]['import'](_0xcaf2('0x94'));db[_0xcaf2('0x95')]=db[_0xcaf2('0x2')][_0xcaf2('0x13')]('../api/variable/variable.model');db[_0xcaf2('0x96')]=db[_0xcaf2('0x2')][_0xcaf2('0x13')](_0xcaf2('0x97'));db[_0xcaf2('0x98')]=db[_0xcaf2('0x2')]['import'](_0xcaf2('0x99'));db[_0xcaf2('0x9a')]=db[_0xcaf2('0x2')][_0xcaf2('0x13')](_0xcaf2('0x9b'));db[_0xcaf2('0x9c')]=db[_0xcaf2('0x2')]['import'](_0xcaf2('0x9d'));db[_0xcaf2('0x9e')]=db[_0xcaf2('0x2')][_0xcaf2('0x13')]('../api/analyticExtractedReport/analyticExtractedReport.model');db['AnalyticMetric']=db[_0xcaf2('0x2')][_0xcaf2('0x13')](_0xcaf2('0x9f'));db[_0xcaf2('0xa0')]=db[_0xcaf2('0x2')]['import'](_0xcaf2('0xa1'));db[_0xcaf2('0xa2')]=db[_0xcaf2('0x2')]['import'](_0xcaf2('0xa3'));db[_0xcaf2('0xa4')]=db[_0xcaf2('0x2')][_0xcaf2('0x13')](_0xcaf2('0xa5'));db[_0xcaf2('0xa6')]=db['sequelize'][_0xcaf2('0x13')](_0xcaf2('0xa7'));db['SalesforceField']=db['sequelize'][_0xcaf2('0x13')]('../api/intSalesforceField/intSalesforceField.model');db[_0xcaf2('0xa8')]=db['sequelize']['import'](_0xcaf2('0xa9'));db['SugarcrmConfiguration']=db[_0xcaf2('0x2')][_0xcaf2('0x13')](_0xcaf2('0xaa'));db['SugarcrmField']=db[_0xcaf2('0x2')][_0xcaf2('0x13')](_0xcaf2('0xab'));db['DeskAccount']=db['sequelize']['import'](_0xcaf2('0xac'));db[_0xcaf2('0xad')]=db[_0xcaf2('0x2')][_0xcaf2('0x13')](_0xcaf2('0xae'));db[_0xcaf2('0xaf')]=db[_0xcaf2('0x2')]['import'](_0xcaf2('0xb0'));db[_0xcaf2('0xb1')]=db[_0xcaf2('0x2')]['import']('../api/intZohoAccount/intZohoAccount.model');db[_0xcaf2('0xb2')]=db[_0xcaf2('0x2')][_0xcaf2('0x13')]('../api/intZohoConfiguration/intZohoConfiguration.model');db[_0xcaf2('0xb3')]=db[_0xcaf2('0x2')][_0xcaf2('0x13')](_0xcaf2('0xb4'));db[_0xcaf2('0xb5')]=db[_0xcaf2('0x2')][_0xcaf2('0x13')](_0xcaf2('0xb6'));db['ZendeskConfiguration']=db[_0xcaf2('0x2')]['import'](_0xcaf2('0xb7'));db[_0xcaf2('0xb8')]=db['sequelize'][_0xcaf2('0x13')](_0xcaf2('0xb9'));db[_0xcaf2('0xba')]=db['sequelize'][_0xcaf2('0x13')]('../api/intFreshdeskAccount/intFreshdeskAccount.model');db['FreshdeskConfiguration']=db[_0xcaf2('0x2')][_0xcaf2('0x13')](_0xcaf2('0xbb'));db[_0xcaf2('0xbc')]=db[_0xcaf2('0x2')][_0xcaf2('0x13')](_0xcaf2('0xbd'));db[_0xcaf2('0xbe')]=db[_0xcaf2('0x2')]['import']('../api/intVtigerAccount/intVtigerAccount.model');db[_0xcaf2('0xbf')]=db[_0xcaf2('0x2')]['import'](_0xcaf2('0xc0'));db[_0xcaf2('0xc1')]=db[_0xcaf2('0x2')][_0xcaf2('0x13')](_0xcaf2('0xc2'));db[_0xcaf2('0xc3')]=db[_0xcaf2('0x2')][_0xcaf2('0x13')]('../api/intServicenowAccount/intServicenowAccount.model');db[_0xcaf2('0xc4')]=db[_0xcaf2('0x2')][_0xcaf2('0x13')](_0xcaf2('0xc5'));db[_0xcaf2('0xc6')]=db[_0xcaf2('0x2')][_0xcaf2('0x13')]('../api/intServicenowField/intServicenowField.model');db[_0xcaf2('0xc7')]=db[_0xcaf2('0x2')][_0xcaf2('0x13')](_0xcaf2('0xc8'));db[_0xcaf2('0xc9')]=db[_0xcaf2('0x2')][_0xcaf2('0x13')](_0xcaf2('0xca'));db['Dynamics365Field']=db[_0xcaf2('0x2')][_0xcaf2('0x13')](_0xcaf2('0xcb'));db[_0xcaf2('0xcc')]=db[_0xcaf2('0x2')][_0xcaf2('0x13')](_0xcaf2('0xcd'));db[_0xcaf2('0xce')]=db['sequelize'][_0xcaf2('0x13')](_0xcaf2('0xcf'));db['FreshsalesField']=db[_0xcaf2('0x2')][_0xcaf2('0x13')](_0xcaf2('0xd0'));db[_0xcaf2('0x96')]=db[_0xcaf2('0x2')][_0xcaf2('0x13')](_0xcaf2('0x97'));db[_0xcaf2('0xd1')]=db['sequelize'][_0xcaf2('0x13')](_0xcaf2('0xd2'));db['ChatQueueReport']=db[_0xcaf2('0x2')]['import'](_0xcaf2('0xd3'));db[_0xcaf2('0xd4')]=db[_0xcaf2('0x2')][_0xcaf2('0x13')]('../api/chatInternalMessage/chatInternalMessage.model');db[_0xcaf2('0xd5')]=db[_0xcaf2('0x2')][_0xcaf2('0x13')](_0xcaf2('0xd6'));db[_0xcaf2('0xd7')]=db[_0xcaf2('0x2')]['import'](_0xcaf2('0xd8'));db[_0xcaf2('0xd9')]=db[_0xcaf2('0x2')][_0xcaf2('0x13')](_0xcaf2('0xda'));db['SmsQueueReport']=db[_0xcaf2('0x2')][_0xcaf2('0x13')](_0xcaf2('0xdb'));db[_0xcaf2('0xdc')]=db[_0xcaf2('0x2')]['import'](_0xcaf2('0xdd'));db[_0xcaf2('0xde')]=db['sequelize']['import'](_0xcaf2('0xdf'));db[_0xcaf2('0xe0')]=db[_0xcaf2('0x2')]['import'](_0xcaf2('0xe1'));db['Setting']=db[_0xcaf2('0x2')][_0xcaf2('0x13')](_0xcaf2('0xe2'));db[_0xcaf2('0xe3')]=db[_0xcaf2('0x2')][_0xcaf2('0x13')](_0xcaf2('0xe4'));db['SquareProject']=db[_0xcaf2('0x2')][_0xcaf2('0x13')](_0xcaf2('0xe5'));db[_0xcaf2('0xe6')]=db['sequelize'][_0xcaf2('0x13')]('../api/squareRecording/squareRecording.model');db[_0xcaf2('0xe7')]=db[_0xcaf2('0x2')]['import'](_0xcaf2('0xe8'));db[_0xcaf2('0xe9')]=db[_0xcaf2('0x2')][_0xcaf2('0x13')](_0xcaf2('0xea'));db[_0xcaf2('0xeb')]=db[_0xcaf2('0x2')][_0xcaf2('0x13')]('../api/license/license.model');db[_0xcaf2('0xec')]=db['sequelize']['import'](_0xcaf2('0xed'));db[_0xcaf2('0xee')]=db['sequelize'][_0xcaf2('0x13')](_0xcaf2('0xef'));db[_0xcaf2('0xf0')]=db[_0xcaf2('0x2')][_0xcaf2('0x13')](_0xcaf2('0xf1'));db[_0xcaf2('0xf2')]=db[_0xcaf2('0x2')][_0xcaf2('0x13')](_0xcaf2('0xf3'));db[_0xcaf2('0xf4')]=db['sequelize'][_0xcaf2('0x13')]('../api/mailTransferReport/mailTransferReport.model');db[_0xcaf2('0xf5')]=db[_0xcaf2('0x2')]['import'](_0xcaf2('0xf6'));db[_0xcaf2('0xf7')]=db[_0xcaf2('0x2')][_0xcaf2('0x13')](_0xcaf2('0xf8'));db['OpenchannelTransferReport']=db['sequelize']['import'](_0xcaf2('0xf9'));db[_0xcaf2('0xfa')]=db[_0xcaf2('0x2')][_0xcaf2('0x13')]('../api/smsTransferReport/smsTransferReport.model');db['CmList']=db[_0xcaf2('0x2')][_0xcaf2('0x13')](_0xcaf2('0xfb'));db[_0xcaf2('0xfc')]=db['sequelize']['import'](_0xcaf2('0xfd'));db[_0xcaf2('0xfe')]=db[_0xcaf2('0x2')][_0xcaf2('0x13')](_0xcaf2('0xff'));db['UserProfileSection']=db['sequelize'][_0xcaf2('0x13')](_0xcaf2('0x100'));db[_0xcaf2('0x101')]=db[_0xcaf2('0x2')][_0xcaf2('0x13')](_0xcaf2('0x102'));db[_0xcaf2('0x103')]=db['sequelize'][_0xcaf2('0x13')]('../api/userNotification/userNotification.model');db[_0xcaf2('0x104')]=db[_0xcaf2('0x2')][_0xcaf2('0x13')](_0xcaf2('0x105'));db[_0xcaf2('0x106')]=db[_0xcaf2('0x2')][_0xcaf2('0x13')](_0xcaf2('0x107'));db['WhatsappInteraction']=db[_0xcaf2('0x2')]['import'](_0xcaf2('0x108'));db['WhatsappMessage']=db['sequelize'][_0xcaf2('0x13')](_0xcaf2('0x109'));db[_0xcaf2('0x10a')]=db[_0xcaf2('0x2')][_0xcaf2('0x13')](_0xcaf2('0x10b'));db[_0xcaf2('0x10c')]=db[_0xcaf2('0x2')][_0xcaf2('0x13')](_0xcaf2('0x10d'));db['WhatsappQueue']=db[_0xcaf2('0x2')][_0xcaf2('0x13')](_0xcaf2('0x10e'));db[_0xcaf2('0x10f')]=db[_0xcaf2('0x2')][_0xcaf2('0x13')](_0xcaf2('0x110'));db[_0xcaf2('0x111')]=db['sequelize'][_0xcaf2('0x13')](_0xcaf2('0x112'));db[_0xcaf2('0x113')]=db['sequelize']['import']('../api/teamVoicePrefix/teamVoicePrefix.model');db[_0xcaf2('0x114')]=db[_0xcaf2('0x2')]['import'](_0xcaf2('0x115'));db[_0xcaf2('0x12')]['hasOne'](db['VoiceMail'],{'as':'VoiceMail','onDelete':_0xcaf2('0x116'),'foreignKey':'UserId'});db[_0xcaf2('0x12')]['hasMany'](db[_0xcaf2('0x1d')],{'as':'Recordings','foreignKey':'UserId'});db[_0xcaf2('0x12')][_0xcaf2('0x117')](db[_0xcaf2('0x2f')],{'as':_0xcaf2('0x118'),'foreignKey':_0xcaf2('0x119')});db[_0xcaf2('0x12')]['hasMany'](db[_0xcaf2('0x18')],{'as':_0xcaf2('0x11a'),'onDelete':_0xcaf2('0x116'),'hooks':!![]});db[_0xcaf2('0x12')][_0xcaf2('0x117')](db[_0xcaf2('0x7a')],{'as':'HopperFinals','foreignKey':_0xcaf2('0x119')});db[_0xcaf2('0x12')]['hasMany'](db[_0xcaf2('0x11b')],{'as':_0xcaf2('0x11c'),'foreignKey':'UserId'});db[_0xcaf2('0x12')][_0xcaf2('0x117')](db[_0xcaf2('0x11d')],{'as':'ReportAgentPreview','foreignKey':_0xcaf2('0x119')});db[_0xcaf2('0x12')][_0xcaf2('0x117')](db['OpenchannelInteraction'],{'as':_0xcaf2('0x11e'),'foreignKey':_0xcaf2('0x119')});db[_0xcaf2('0x12')][_0xcaf2('0x117')](db['ChatInteraction'],{'as':'ChatInteractions','foreignKey':_0xcaf2('0x119')});db[_0xcaf2('0x12')][_0xcaf2('0x117')](db[_0xcaf2('0x11f')],{'as':'SmsInteractions','foreignKey':_0xcaf2('0x119')});db[_0xcaf2('0x12')]['hasMany'](db[_0xcaf2('0x4f')],{'as':_0xcaf2('0x120'),'foreignKey':_0xcaf2('0x119')});db[_0xcaf2('0x12')][_0xcaf2('0x117')](db[_0xcaf2('0x42')],{'as':_0xcaf2('0x121'),'foreignKey':_0xcaf2('0x119')});db['User'][_0xcaf2('0x117')](db[_0xcaf2('0x122')],{'as':'WhatsappInteractions','foreignKey':_0xcaf2('0x119')});db[_0xcaf2('0x12')][_0xcaf2('0x117')](db['UserNotification'],{'as':_0xcaf2('0x123'),'foreignKey':_0xcaf2('0x124')});db['User'][_0xcaf2('0x125')](db[_0xcaf2('0xfe')],{'as':'UserProfile','foreignKey':_0xcaf2('0x126')});db[_0xcaf2('0x12')][_0xcaf2('0x127')](db[_0xcaf2('0x128')],{'as':_0xcaf2('0x129'),'through':_0xcaf2('0x12a')});db[_0xcaf2('0x12')][_0xcaf2('0x127')](db[_0xcaf2('0x74')],{'as':_0xcaf2('0x12b'),'through':_0xcaf2('0x12c')});db[_0xcaf2('0x12')][_0xcaf2('0x127')](db[_0xcaf2('0x12d')],{'as':'Lists','through':_0xcaf2('0x12e')});db[_0xcaf2('0x12')]['belongsToMany'](db['Team'],{'through':'user_has_teams'});db[_0xcaf2('0x12')][_0xcaf2('0x127')](db['MailInteraction'],{'as':_0xcaf2('0x121'),'through':'user_has_mail_interactions'});db[_0xcaf2('0x12')][_0xcaf2('0x127')](db['ChatInteraction'],{'as':_0xcaf2('0x12f'),'through':_0xcaf2('0x130')});db[_0xcaf2('0x12')][_0xcaf2('0x127')](db[_0xcaf2('0x4f')],{'as':_0xcaf2('0x120'),'through':_0xcaf2('0x131')});db[_0xcaf2('0x12')][_0xcaf2('0x127')](db[_0xcaf2('0x11f')],{'as':_0xcaf2('0x132'),'through':_0xcaf2('0x133')});db[_0xcaf2('0x12')]['belongsToMany'](db[_0xcaf2('0x5f')],{'as':_0xcaf2('0x11e'),'through':_0xcaf2('0x134')});db[_0xcaf2('0x12')]['belongsToMany'](db[_0xcaf2('0x122')],{'as':_0xcaf2('0x135'),'through':_0xcaf2('0x136')});db[_0xcaf2('0x12')]['belongsToMany'](db[_0xcaf2('0x1c')],{'as':'VoiceQueues','through':_0xcaf2('0x31'),'required':![]});db['User'][_0xcaf2('0x127')](db[_0xcaf2('0xfc')],{'as':_0xcaf2('0x137'),'through':_0xcaf2('0x114'),'required':![]});db[_0xcaf2('0x12')][_0xcaf2('0x127')](db[_0xcaf2('0x138')],{'as':_0xcaf2('0x139'),'through':_0xcaf2('0x34'),'required':![]});db['User'][_0xcaf2('0x127')](db[_0xcaf2('0x13a')],{'as':_0xcaf2('0x13b'),'through':_0xcaf2('0x33'),'required':![],'hooks':!![]});db[_0xcaf2('0x12')][_0xcaf2('0x127')](db[_0xcaf2('0x52')],{'as':_0xcaf2('0x13c'),'through':_0xcaf2('0x36'),'required':![]});db[_0xcaf2('0x12')]['belongsToMany'](db[_0xcaf2('0x13d')],{'as':'SmsQueues','through':'UserSmsQueue','required':![]});db[_0xcaf2('0x12')][_0xcaf2('0x127')](db['OpenchannelQueue'],{'as':'OpenchannelQueues','through':'UserOpenchannelQueue','required':![]});db[_0xcaf2('0x12')][_0xcaf2('0x127')](db[_0xcaf2('0x13e')],{'as':_0xcaf2('0x13f'),'through':_0xcaf2('0x3b'),'required':![]});db['User'][_0xcaf2('0x127')](db[_0xcaf2('0x12d')],{'through':'cm_user_has_lists'});db[_0xcaf2('0x12')]['belongsToMany'](db[_0xcaf2('0x65')],{'as':_0xcaf2('0x140'),'through':'user_has_chat_websites'});db['User'][_0xcaf2('0x127')](db[_0xcaf2('0x4c')],{'as':_0xcaf2('0x141'),'through':_0xcaf2('0x142')});db[_0xcaf2('0x12')][_0xcaf2('0x127')](db['MailAccount'],{'as':'MailAccounts','through':_0xcaf2('0x143')});db['User'][_0xcaf2('0x127')](db[_0xcaf2('0x5c')],{'as':'OpenchannelAccounts','through':_0xcaf2('0x144')});db['User'][_0xcaf2('0x127')](db['SmsAccount'],{'as':_0xcaf2('0x145'),'through':_0xcaf2('0x146')});db[_0xcaf2('0x12')][_0xcaf2('0x127')](db[_0xcaf2('0x104')],{'as':_0xcaf2('0x147'),'through':_0xcaf2('0x148')});db[_0xcaf2('0x12')][_0xcaf2('0x127')](db[_0xcaf2('0x149')],{'as':'SquareProjects','through':_0xcaf2('0x14a')});db['VoiceChanSpy']['hasMany'](db[_0xcaf2('0x18')],{'as':'SpiedAgents','onDelete':_0xcaf2('0x116'),'foreignKey':_0xcaf2('0x14b')});db[_0xcaf2('0x14c')][_0xcaf2('0x117')](db[_0xcaf2('0x18')],{'onDelete':_0xcaf2('0x116')});db[_0xcaf2('0x18')][_0xcaf2('0x117')](db[_0xcaf2('0x18')],{'as':_0xcaf2('0x14d'),'onDelete':'cascade'});db[_0xcaf2('0x1a')]['belongsToMany'](db[_0xcaf2('0x8f')],{'as':'Sounds','through':_0xcaf2('0x14e')});db[_0xcaf2('0x1c')][_0xcaf2('0x117')](db['UserVoiceQueueRt'],{'as':_0xcaf2('0x14f'),'foreignKey':_0xcaf2('0x150')});db[_0xcaf2('0x1c')][_0xcaf2('0x117')](db[_0xcaf2('0x76')],{'as':_0xcaf2('0x151'),'foreignKey':_0xcaf2('0x150')});db[_0xcaf2('0x1c')][_0xcaf2('0x117')](db[_0xcaf2('0x7a')],{'as':_0xcaf2('0x152'),'foreignKey':'VoiceQueueId'});db[_0xcaf2('0x1c')][_0xcaf2('0x117')](db[_0xcaf2('0x11b')],{'as':_0xcaf2('0x153'),'foreignKey':_0xcaf2('0x150')});db['VoiceQueue'][_0xcaf2('0x117')](db[_0xcaf2('0x11d')],{'as':_0xcaf2('0x11d'),'foreignKey':'VoiceQueueId'});db['VoiceQueue'][_0xcaf2('0x117')](db[_0xcaf2('0x78')],{'as':_0xcaf2('0x154'),'foreignKey':_0xcaf2('0x150')});db[_0xcaf2('0x1c')][_0xcaf2('0x117')](db[_0xcaf2('0xd9')],{'as':'JscriptySessions','foreignKey':'VoiceQueueId'});db[_0xcaf2('0x1c')]['belongsTo'](db[_0xcaf2('0x155')],{'as':_0xcaf2('0x155'),'foreignKey':_0xcaf2('0x156')});db[_0xcaf2('0x1c')]['belongsTo'](db['Trunk'],{'as':_0xcaf2('0x157'),'foreignKey':_0xcaf2('0x158')});db[_0xcaf2('0x1c')][_0xcaf2('0x125')](db['Interval'],{'as':_0xcaf2('0x87'),'foreignKey':_0xcaf2('0x159')});db[_0xcaf2('0x1c')][_0xcaf2('0x125')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':_0xcaf2('0x15a')});db[_0xcaf2('0x1c')]['belongsToMany'](db[_0xcaf2('0x12d')],{'as':'Lists','through':_0xcaf2('0x15b')});db['VoiceQueue']['belongsToMany'](db[_0xcaf2('0x12')],{'as':_0xcaf2('0x15c'),'through':_0xcaf2('0x31')});db[_0xcaf2('0x1c')][_0xcaf2('0x127')](db[_0xcaf2('0xe9')],{'as':_0xcaf2('0x15d'),'through':_0xcaf2('0x111')});db[_0xcaf2('0x1c')][_0xcaf2('0x127')](db[_0xcaf2('0x12d')],{'as':_0xcaf2('0x15e'),'through':_0xcaf2('0x15f')});db[_0xcaf2('0x1d')][_0xcaf2('0x125')](db[_0xcaf2('0x12')],{'as':'User','foreignKey':_0xcaf2('0x119')});db[_0xcaf2('0x1f')][_0xcaf2('0x125')](db[_0xcaf2('0x12')],{'as':_0xcaf2('0x12'),'foreignKey':_0xcaf2('0x119')});db[_0xcaf2('0x21')]['hasMany'](db[_0xcaf2('0x23')],{'as':_0xcaf2('0x160'),'onDelete':_0xcaf2('0x116'),'foreignKey':_0xcaf2('0x161'),'sourceKey':_0xcaf2('0x162')});db[_0xcaf2('0x23')]['belongsTo'](db[_0xcaf2('0x21')],{'foreignKey':_0xcaf2('0x161'),'targetKey':_0xcaf2('0x162')});db[_0xcaf2('0x25')][_0xcaf2('0x117')](db['VoiceQueueReport'],{'as':_0xcaf2('0x163'),'foreignKey':_0xcaf2('0x164'),'constraints':![]});db[_0xcaf2('0x25')][_0xcaf2('0x117')](db[_0xcaf2('0x28')],{'as':_0xcaf2('0x165'),'foreignKey':_0xcaf2('0x164'),'constraints':![]});db['VoiceCallReport']['belongsTo'](db['User'],{'as':_0xcaf2('0x12'),'foreignKey':_0xcaf2('0x119')});db[_0xcaf2('0x25')][_0xcaf2('0x125')](db[_0xcaf2('0x74')],{'as':'Contact','foreignKey':_0xcaf2('0x166')});db[_0xcaf2('0x167')][_0xcaf2('0x125')](db[_0xcaf2('0x168')],{'as':_0xcaf2('0x168'),'foreignKey':_0xcaf2('0x169')});db[_0xcaf2('0x3d')][_0xcaf2('0x125')](db[_0xcaf2('0x168')],{'as':_0xcaf2('0x168'),'foreignKey':'MailAccountId'});db[_0xcaf2('0x168')][_0xcaf2('0x16a')](db['MailServerIn'],{'as':_0xcaf2('0x16b'),'onDelete':_0xcaf2('0x116')});db[_0xcaf2('0x168')]['hasOne'](db[_0xcaf2('0x3d')],{'as':_0xcaf2('0x16c'),'onDelete':_0xcaf2('0x116')});db[_0xcaf2('0x168')]['hasMany'](db[_0xcaf2('0x16d')],{'as':_0xcaf2('0x16e'),'foreignKey':_0xcaf2('0x169'),'onDelete':'cascade'});db[_0xcaf2('0x168')][_0xcaf2('0x117')](db[_0xcaf2('0x16f')],{'as':_0xcaf2('0x170'),'foreignKey':_0xcaf2('0x169')});db[_0xcaf2('0x168')][_0xcaf2('0x117')](db[_0xcaf2('0x44')],{'as':_0xcaf2('0x160'),'foreignKey':_0xcaf2('0x169')});db['MailAccount'][_0xcaf2('0x117')](db[_0xcaf2('0x42')],{'as':'Interactions'});db[_0xcaf2('0x168')]['hasMany'](db[_0xcaf2('0x171')],{'as':_0xcaf2('0x14d')});db[_0xcaf2('0x168')][_0xcaf2('0x125')](db[_0xcaf2('0x12d')],{'as':_0xcaf2('0x172'),'foreignKey':'ListId'});db[_0xcaf2('0x168')]['belongsTo'](db[_0xcaf2('0x92')],{'as':_0xcaf2('0x92'),'foreignKey':_0xcaf2('0x173')});db[_0xcaf2('0x168')]['belongsTo'](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':'mandatoryDispositionPauseId'});db['MailAccount'][_0xcaf2('0x127')](db[_0xcaf2('0x12')],{'as':_0xcaf2('0x15c'),'through':_0xcaf2('0x143')});db[_0xcaf2('0x138')][_0xcaf2('0x127')](db['User'],{'as':_0xcaf2('0x15c'),'through':_0xcaf2('0x34')});db['MailQueue'][_0xcaf2('0x127')](db[_0xcaf2('0xe9')],{'through':_0xcaf2('0x174'),'as':'Teams'});db['MailInteraction'][_0xcaf2('0x117')](db['MailMessage'],{'as':_0xcaf2('0x160'),'onDelete':_0xcaf2('0x116'),'foreignKey':_0xcaf2('0x175')});db['MailInteraction'][_0xcaf2('0x125')](db['MailAccount'],{'as':'Account','foreignKey':_0xcaf2('0x169')});db[_0xcaf2('0x42')]['belongsTo'](db[_0xcaf2('0x74')],{'as':_0xcaf2('0x176'),'foreignKey':_0xcaf2('0x166')});db[_0xcaf2('0x42')][_0xcaf2('0x125')](db[_0xcaf2('0x12')],{'as':_0xcaf2('0x177'),'foreignKey':_0xcaf2('0x119')});db[_0xcaf2('0x42')][_0xcaf2('0x127')](db[_0xcaf2('0x90')],{'through':_0xcaf2('0x178'),'as':_0xcaf2('0x179')});db['MailInteraction'][_0xcaf2('0x127')](db[_0xcaf2('0x90')],{'through':_0xcaf2('0x178'),'as':_0xcaf2('0x17a')});db[_0xcaf2('0x42')]['belongsToMany'](db[_0xcaf2('0x12')],{'as':_0xcaf2('0x17b'),'through':_0xcaf2('0x17c'),'foreignKey':'MailInteractionId'});db[_0xcaf2('0x44')][_0xcaf2('0x117')](db[_0xcaf2('0xf0')],{'as':_0xcaf2('0x17d'),'onDelete':_0xcaf2('0x116')});db[_0xcaf2('0x44')][_0xcaf2('0x125')](db[_0xcaf2('0x12')],{'as':_0xcaf2('0x12')});db['MailMessage']['belongsTo'](db['CmContact'],{'onDelete':_0xcaf2('0x116'),'as':_0xcaf2('0x176')});db[_0xcaf2('0x44')]['belongsTo'](db[_0xcaf2('0x42')],{'as':'Interaction','foreignKey':'MailInteractionId'});db[_0xcaf2('0x44')][_0xcaf2('0x125')](db[_0xcaf2('0x168')],{'as':'Account','foreignKey':_0xcaf2('0x169')});db[_0xcaf2('0x44')][_0xcaf2('0x125')](db['ChatWebsite'],{'as':_0xcaf2('0x65'),'foreignKey':'ChatWebsiteId'});db[_0xcaf2('0x44')][_0xcaf2('0x125')](db[_0xcaf2('0x17e')],{'as':_0xcaf2('0x17e'),'foreignKey':_0xcaf2('0x17f')});db[_0xcaf2('0x171')][_0xcaf2('0x125')](db['User'],{'onDelete':_0xcaf2('0x180')});db[_0xcaf2('0x171')][_0xcaf2('0x125')](db[_0xcaf2('0x138')],{'onDelete':_0xcaf2('0x180')});db['MailApplication']['belongsTo'](db[_0xcaf2('0x168')],{'onDelete':_0xcaf2('0x180')});db['MailApplication'][_0xcaf2('0x125')](db['Interval'],{'onDelete':_0xcaf2('0x180'),'foreignKey':'IntervalId'});db[_0xcaf2('0x171')][_0xcaf2('0x125')](db[_0xcaf2('0x90')],{'onDelete':_0xcaf2('0x180'),'foreignKey':_0xcaf2('0x181')});db['MailQueueReport'][_0xcaf2('0x125')](db['MailAccount'],{});db[_0xcaf2('0x47')][_0xcaf2('0x125')](db[_0xcaf2('0x12d')],{'as':'List','foreignKey':_0xcaf2('0x182')});db['MailQueueReport'][_0xcaf2('0x125')](db['CmContact'],{'as':_0xcaf2('0x176'),'foreignKey':_0xcaf2('0x166')});db['MailQueueReport']['belongsTo'](db['MailInteraction'],{});db['MailQueueReport'][_0xcaf2('0x125')](db[_0xcaf2('0x44')],{});db[_0xcaf2('0x47')][_0xcaf2('0x125')](db[_0xcaf2('0x12')],{});db[_0xcaf2('0x47')][_0xcaf2('0x125')](db[_0xcaf2('0x138')],{});db[_0xcaf2('0x183')][_0xcaf2('0x117')](db[_0xcaf2('0x4a')],{'as':_0xcaf2('0x184'),'onDelete':'cascade'});db[_0xcaf2('0x4c')][_0xcaf2('0x117')](db[_0xcaf2('0x16d')],{'as':_0xcaf2('0x16e'),'foreignKey':_0xcaf2('0x185'),'onDelete':_0xcaf2('0x116')});db['FaxAccount'][_0xcaf2('0x117')](db[_0xcaf2('0x16f')],{'as':_0xcaf2('0x170'),'foreignKey':'FaxAccountId'});db[_0xcaf2('0x4c')]['hasMany'](db[_0xcaf2('0x4f')],{'as':_0xcaf2('0x186')});db['FaxAccount'][_0xcaf2('0x117')](db['FaxApplication'],{'as':_0xcaf2('0x14d')});db[_0xcaf2('0x4c')][_0xcaf2('0x117')](db['VoiceExtension'],{'as':_0xcaf2('0x187'),'onDelete':'cascade'});db[_0xcaf2('0x4c')]['hasMany'](db['FaxMessage'],{'as':_0xcaf2('0x160')});db[_0xcaf2('0x4c')][_0xcaf2('0x125')](db[_0xcaf2('0x155')],{'as':_0xcaf2('0x155')});db[_0xcaf2('0x4c')]['belongsTo'](db['CmList'],{'as':'List','foreignKey':_0xcaf2('0x182')});db[_0xcaf2('0x4c')][_0xcaf2('0x125')](db[_0xcaf2('0x88')],{'as':'mandatoryDispositionPause','foreignKey':'mandatoryDispositionPauseId'});db[_0xcaf2('0x4c')][_0xcaf2('0x127')](db[_0xcaf2('0x12')],{'as':_0xcaf2('0x15c'),'through':_0xcaf2('0x142')});db[_0xcaf2('0x4d')][_0xcaf2('0x125')](db[_0xcaf2('0x12')],{'onDelete':'restrict'});db['FaxApplication']['belongsTo'](db['FaxQueue'],{'onDelete':_0xcaf2('0x180')});db[_0xcaf2('0x4d')][_0xcaf2('0x125')](db[_0xcaf2('0x4c')],{'onDelete':_0xcaf2('0x180')});db[_0xcaf2('0x4d')][_0xcaf2('0x125')](db[_0xcaf2('0x90')],{'onDelete':_0xcaf2('0x180'),'foreignKey':_0xcaf2('0x181')});db[_0xcaf2('0x4f')][_0xcaf2('0x117')](db['FaxMessage'],{'as':'Messages','onDelete':_0xcaf2('0x116'),'foreignKey':'FaxInteractionId'});db[_0xcaf2('0x4f')][_0xcaf2('0x125')](db[_0xcaf2('0x4c')],{'as':'Account','foreignKey':_0xcaf2('0x185')});db[_0xcaf2('0x4f')][_0xcaf2('0x125')](db[_0xcaf2('0x74')],{'as':_0xcaf2('0x176'),'foreignKey':_0xcaf2('0x166')});db[_0xcaf2('0x4f')][_0xcaf2('0x125')](db[_0xcaf2('0x12')],{'as':_0xcaf2('0x177'),'foreignKey':_0xcaf2('0x119')});db['FaxInteraction'][_0xcaf2('0x127')](db[_0xcaf2('0x90')],{'through':_0xcaf2('0x188'),'as':_0xcaf2('0x179')});db[_0xcaf2('0x4f')][_0xcaf2('0x127')](db[_0xcaf2('0x90')],{'through':_0xcaf2('0x188'),'as':'ThroughTags'});db[_0xcaf2('0x4f')][_0xcaf2('0x127')](db[_0xcaf2('0x12')],{'as':_0xcaf2('0x17b'),'through':_0xcaf2('0x131'),'foreignKey':_0xcaf2('0x189')});db[_0xcaf2('0x18a')]['belongsTo'](db['User'],{'onDelete':'cascade','as':'User'});db['FaxMessage'][_0xcaf2('0x125')](db[_0xcaf2('0x4f')],{'as':'Interaction','foreignKey':'FaxInteractionId'});db[_0xcaf2('0x18a')]['belongsTo'](db[_0xcaf2('0x74')],{'onDelete':_0xcaf2('0x116'),'as':_0xcaf2('0x176')});db['FaxMessage']['belongsTo'](db[_0xcaf2('0xf0')],{'as':'Attachment','foreignKey':_0xcaf2('0x18b')});db[_0xcaf2('0x18a')]['belongsTo'](db['FaxAccount'],{'as':_0xcaf2('0x18c'),'foreignKey':_0xcaf2('0x185')});db[_0xcaf2('0x52')]['belongsToMany'](db[_0xcaf2('0x12')],{'as':_0xcaf2('0x15c'),'through':_0xcaf2('0x36')});db[_0xcaf2('0x52')][_0xcaf2('0x127')](db['Team'],{'through':_0xcaf2('0x18d'),'as':_0xcaf2('0x15d')});db[_0xcaf2('0x54')]['belongsTo'](db[_0xcaf2('0x4c')],{});db[_0xcaf2('0x54')][_0xcaf2('0x125')](db[_0xcaf2('0x12d')],{'as':_0xcaf2('0x172'),'foreignKey':_0xcaf2('0x182')});db[_0xcaf2('0x54')][_0xcaf2('0x125')](db[_0xcaf2('0x74')],{'as':_0xcaf2('0x176'),'foreignKey':_0xcaf2('0x166')});db[_0xcaf2('0x54')]['belongsTo'](db[_0xcaf2('0x4f')],{});db['FaxQueueReport'][_0xcaf2('0x125')](db[_0xcaf2('0x18a')],{});db[_0xcaf2('0x54')][_0xcaf2('0x125')](db[_0xcaf2('0x12')],{});db['FaxQueueReport'][_0xcaf2('0x125')](db['FaxQueue'],{});db[_0xcaf2('0x55')][_0xcaf2('0x117')](db['Disposition'],{'as':_0xcaf2('0x16e'),'foreignKey':_0xcaf2('0x18e'),'onDelete':_0xcaf2('0x116')});db['SmsAccount'][_0xcaf2('0x117')](db['CannedAnswer'],{'as':_0xcaf2('0x170'),'foreignKey':_0xcaf2('0x18e')});db['SmsAccount'][_0xcaf2('0x117')](db[_0xcaf2('0x5a')],{'as':_0xcaf2('0x160'),'foreignKey':_0xcaf2('0x18e')});db[_0xcaf2('0x55')][_0xcaf2('0x117')](db[_0xcaf2('0x11f')],{'as':_0xcaf2('0x186')});db[_0xcaf2('0x55')]['hasMany'](db[_0xcaf2('0x57')],{'as':_0xcaf2('0x14d')});db[_0xcaf2('0x55')][_0xcaf2('0x125')](db[_0xcaf2('0x12d')],{'as':_0xcaf2('0x172'),'foreignKey':_0xcaf2('0x182')});db['SmsAccount'][_0xcaf2('0x125')](db[_0xcaf2('0x88')],{'as':_0xcaf2('0x18f'),'foreignKey':_0xcaf2('0x15a')});db[_0xcaf2('0x55')][_0xcaf2('0x127')](db[_0xcaf2('0x12')],{'as':_0xcaf2('0x15c'),'through':'user_has_sms_accounts'});db['SmsApplication'][_0xcaf2('0x125')](db[_0xcaf2('0x12')],{'onDelete':_0xcaf2('0x180')});db['SmsApplication']['belongsTo'](db[_0xcaf2('0x13d')],{'onDelete':_0xcaf2('0x180')});db['SmsApplication'][_0xcaf2('0x125')](db['SmsAccount'],{'onDelete':_0xcaf2('0x180')});db[_0xcaf2('0x57')][_0xcaf2('0x125')](db[_0xcaf2('0x87')],{'onDelete':'restrict','foreignKey':_0xcaf2('0x159')});db[_0xcaf2('0x57')][_0xcaf2('0x125')](db[_0xcaf2('0x90')],{'onDelete':_0xcaf2('0x180'),'foreignKey':_0xcaf2('0x181')});db[_0xcaf2('0x11f')][_0xcaf2('0x117')](db['SmsMessage'],{'as':_0xcaf2('0x160'),'onDelete':_0xcaf2('0x116'),'foreignKey':_0xcaf2('0x190')});db['SmsInteraction'][_0xcaf2('0x125')](db['SmsAccount'],{'as':_0xcaf2('0x18c'),'foreignKey':'SmsAccountId'});db['SmsInteraction']['belongsTo'](db[_0xcaf2('0x74')],{'as':_0xcaf2('0x176'),'foreignKey':_0xcaf2('0x166')});db['SmsInteraction'][_0xcaf2('0x125')](db[_0xcaf2('0x12')],{'as':_0xcaf2('0x177'),'foreignKey':'UserId'});db[_0xcaf2('0x11f')]['belongsToMany'](db[_0xcaf2('0x90')],{'through':_0xcaf2('0x191'),'as':_0xcaf2('0x179')});db[_0xcaf2('0x11f')][_0xcaf2('0x127')](db['Tag'],{'through':_0xcaf2('0x191'),'as':_0xcaf2('0x17a')});db[_0xcaf2('0x11f')][_0xcaf2('0x127')](db[_0xcaf2('0x12')],{'as':_0xcaf2('0x17b'),'through':_0xcaf2('0x133'),'foreignKey':_0xcaf2('0x190')});db['SmsMessage']['belongsTo'](db['User'],{'as':_0xcaf2('0x12')});db[_0xcaf2('0x5a')]['belongsTo'](db[_0xcaf2('0x74')],{'onDelete':'cascade','as':_0xcaf2('0x176')});db['SmsMessage'][_0xcaf2('0x125')](db[_0xcaf2('0x11f')],{'onDelete':_0xcaf2('0x116'),'as':_0xcaf2('0x192'),'foreignKey':_0xcaf2('0x190')});db[_0xcaf2('0x5a')][_0xcaf2('0x125')](db['SmsAccount'],{'as':_0xcaf2('0x18c'),'foreignKey':_0xcaf2('0x18e')});db[_0xcaf2('0x13d')][_0xcaf2('0x127')](db[_0xcaf2('0x12')],{'as':_0xcaf2('0x15c'),'through':_0xcaf2('0x38'),'foreignKey':_0xcaf2('0x193')});db[_0xcaf2('0x13d')][_0xcaf2('0x127')](db[_0xcaf2('0xe9')],{'through':_0xcaf2('0x194'),'as':_0xcaf2('0x15d')});db[_0xcaf2('0x5c')][_0xcaf2('0x117')](db[_0xcaf2('0x16d')],{'as':_0xcaf2('0x16e'),'foreignKey':_0xcaf2('0x195'),'onDelete':'cascade'});db[_0xcaf2('0x5c')][_0xcaf2('0x117')](db[_0xcaf2('0x16f')],{'as':_0xcaf2('0x170'),'foreignKey':_0xcaf2('0x195')});db[_0xcaf2('0x5c')][_0xcaf2('0x117')](db['OpenchannelInteraction'],{'as':'Interactions','foreignKey':'OpenchannelAccountId'});db[_0xcaf2('0x5c')][_0xcaf2('0x117')](db[_0xcaf2('0x61')],{'as':'Messages','foreignKey':_0xcaf2('0x195')});db[_0xcaf2('0x5c')][_0xcaf2('0x117')](db[_0xcaf2('0x196')],{'as':_0xcaf2('0x14d'),'foreignKey':_0xcaf2('0x195')});db[_0xcaf2('0x5c')]['belongsTo'](db[_0xcaf2('0x12d')],{'as':'List','foreignKey':_0xcaf2('0x182')});db[_0xcaf2('0x5c')][_0xcaf2('0x125')](db['Pause'],{'as':_0xcaf2('0x18f'),'foreignKey':_0xcaf2('0x15a')});db[_0xcaf2('0x5c')][_0xcaf2('0x127')](db[_0xcaf2('0x12')],{'as':_0xcaf2('0x15c'),'through':'user_has_openchannel_accounts'});db[_0xcaf2('0x196')][_0xcaf2('0x125')](db['User'],{'onDelete':'restrict'});db['OpenchannelApplication'][_0xcaf2('0x125')](db[_0xcaf2('0x63')],{'onDelete':_0xcaf2('0x180'),'foreignKey':_0xcaf2('0x197')});db[_0xcaf2('0x196')][_0xcaf2('0x125')](db[_0xcaf2('0x5c')],{'onDelete':'restrict','foreignKey':'OpenchannelAccountId'});db[_0xcaf2('0x196')]['belongsTo'](db['Interval'],{'onDelete':'restrict','foreignKey':_0xcaf2('0x159')});db[_0xcaf2('0x196')][_0xcaf2('0x125')](db[_0xcaf2('0x90')],{'onDelete':_0xcaf2('0x180'),'foreignKey':'TagId'});db[_0xcaf2('0x5f')][_0xcaf2('0x117')](db['OpenchannelMessage'],{'as':_0xcaf2('0x160'),'onDelete':'cascade','foreignKey':_0xcaf2('0x198')});db[_0xcaf2('0x5f')][_0xcaf2('0x125')](db[_0xcaf2('0x5c')],{'as':_0xcaf2('0x18c'),'foreignKey':_0xcaf2('0x195')});db['OpenchannelInteraction'][_0xcaf2('0x125')](db[_0xcaf2('0x74')],{'as':'Contact','foreignKey':_0xcaf2('0x166')});db['OpenchannelInteraction'][_0xcaf2('0x125')](db[_0xcaf2('0x12')],{'as':_0xcaf2('0x177'),'foreignKey':'UserId'});db[_0xcaf2('0x5f')][_0xcaf2('0x127')](db['Tag'],{'through':_0xcaf2('0x199'),'as':_0xcaf2('0x179')});db[_0xcaf2('0x5f')][_0xcaf2('0x127')](db['Tag'],{'through':_0xcaf2('0x199'),'as':_0xcaf2('0x17a')});db[_0xcaf2('0x5f')][_0xcaf2('0x127')](db[_0xcaf2('0x12')],{'as':_0xcaf2('0x17b'),'through':_0xcaf2('0x134'),'foreignKey':_0xcaf2('0x198')});db[_0xcaf2('0x61')]['belongsTo'](db[_0xcaf2('0x12')],{'onDelete':_0xcaf2('0x116'),'as':'User'});db[_0xcaf2('0x61')][_0xcaf2('0x125')](db[_0xcaf2('0x74')],{'onDelete':_0xcaf2('0x116'),'as':'Contact'});db[_0xcaf2('0x61')][_0xcaf2('0x125')](db[_0xcaf2('0x5f')],{'onDelete':_0xcaf2('0x116'),'as':_0xcaf2('0x192'),'foreignKey':_0xcaf2('0x198')});db[_0xcaf2('0x61')][_0xcaf2('0x125')](db[_0xcaf2('0xf0')],{'as':_0xcaf2('0xf0'),'foreignKey':_0xcaf2('0x18b')});db[_0xcaf2('0x61')][_0xcaf2('0x125')](db[_0xcaf2('0x5c')],{'as':_0xcaf2('0x18c'),'foreignKey':'OpenchannelAccountId'});db[_0xcaf2('0x63')][_0xcaf2('0x127')](db['User'],{'as':'Agents','through':'UserOpenchannelQueue','foreignKey':_0xcaf2('0x197')});db[_0xcaf2('0x63')][_0xcaf2('0x127')](db[_0xcaf2('0xe9')],{'through':_0xcaf2('0x19a'),'as':_0xcaf2('0x15d')});db[_0xcaf2('0x65')][_0xcaf2('0x117')](db[_0xcaf2('0x16d')],{'as':_0xcaf2('0x16e'),'foreignKey':_0xcaf2('0x19b'),'onDelete':'cascade'});db[_0xcaf2('0x65')][_0xcaf2('0x117')](db['CannedAnswer'],{'as':'Answers','foreignKey':_0xcaf2('0x19b')});db[_0xcaf2('0x65')][_0xcaf2('0x117')](db[_0xcaf2('0x71')],{'as':_0xcaf2('0x19c')});db['ChatWebsite']['hasMany'](db[_0xcaf2('0x19d')],{'as':'Interactions'});db[_0xcaf2('0x65')][_0xcaf2('0x117')](db[_0xcaf2('0x69')],{'as':_0xcaf2('0x14d')});db[_0xcaf2('0x65')]['hasMany'](db['ChatMessage'],{'as':'Messages'});db[_0xcaf2('0x65')][_0xcaf2('0x125')](db[_0xcaf2('0x12d')],{'as':_0xcaf2('0x172'),'foreignKey':_0xcaf2('0x182')});db[_0xcaf2('0x65')][_0xcaf2('0x125')](db['Interval'],{'as':_0xcaf2('0x87'),'foreignKey':'IntervalId'});db[_0xcaf2('0x65')]['belongsTo'](db[_0xcaf2('0x168')],{'as':_0xcaf2('0x168'),'foreignKey':'MailAccountId'});db[_0xcaf2('0x65')][_0xcaf2('0x125')](db['Pause'],{'as':_0xcaf2('0x18f'),'foreignKey':_0xcaf2('0x15a')});db[_0xcaf2('0x65')]['belongsToMany'](db['User'],{'as':'Agents','through':_0xcaf2('0x19e')});db[_0xcaf2('0x67')][_0xcaf2('0x125')](db[_0xcaf2('0x5c')],{});db['OpenchannelQueueReport'][_0xcaf2('0x125')](db['CmList'],{'as':_0xcaf2('0x172'),'foreignKey':'ListId'});db['OpenchannelQueueReport'][_0xcaf2('0x125')](db['CmContact'],{'as':'Contact','foreignKey':_0xcaf2('0x166')});db[_0xcaf2('0x67')]['belongsTo'](db['OpenchannelInteraction'],{});db[_0xcaf2('0x67')]['belongsTo'](db['OpenchannelMessage'],{});db[_0xcaf2('0x67')][_0xcaf2('0x125')](db[_0xcaf2('0x12')],{});db[_0xcaf2('0x67')][_0xcaf2('0x125')](db[_0xcaf2('0x63')],{});db[_0xcaf2('0x69')]['belongsTo'](db[_0xcaf2('0x12')],{'as':_0xcaf2('0x19f'),'foreignKey':_0xcaf2('0x119'),'onDelete':_0xcaf2('0x180')});db[_0xcaf2('0x69')][_0xcaf2('0x125')](db[_0xcaf2('0x13a')],{'as':'Queue','foreignKey':'ChatQueueId','onDelete':_0xcaf2('0x180')});db['ChatApplication'][_0xcaf2('0x125')](db['ChatWebsite'],{'as':'Website','foreignKey':_0xcaf2('0x19b'),'onDelete':_0xcaf2('0x180')});db[_0xcaf2('0x69')][_0xcaf2('0x125')](db[_0xcaf2('0x90')],{'onDelete':_0xcaf2('0x180'),'foreignKey':'TagId'});db[_0xcaf2('0x19d')][_0xcaf2('0x117')](db['ChatMessage'],{'as':_0xcaf2('0x160'),'onDelete':_0xcaf2('0x116'),'foreignKey':_0xcaf2('0x1a0')});db[_0xcaf2('0x19d')][_0xcaf2('0x125')](db[_0xcaf2('0x65')],{'as':_0xcaf2('0x18c'),'foreignKey':'ChatWebsiteId'});db[_0xcaf2('0x19d')][_0xcaf2('0x125')](db[_0xcaf2('0x74')],{'as':'Contact','foreignKey':_0xcaf2('0x166')});db[_0xcaf2('0x19d')][_0xcaf2('0x125')](db[_0xcaf2('0x12')],{'as':_0xcaf2('0x177'),'foreignKey':_0xcaf2('0x119')});db[_0xcaf2('0x19d')][_0xcaf2('0x127')](db[_0xcaf2('0x90')],{'through':_0xcaf2('0x1a1'),'as':_0xcaf2('0x179')});db[_0xcaf2('0x19d')][_0xcaf2('0x127')](db['Tag'],{'through':_0xcaf2('0x1a1'),'as':_0xcaf2('0x17a')});db[_0xcaf2('0x19d')][_0xcaf2('0x127')](db['User'],{'as':_0xcaf2('0x17b'),'through':_0xcaf2('0x130'),'foreignKey':'ChatInteractionId'});db['ChatMessage']['belongsTo'](db[_0xcaf2('0x12')],{'onDelete':_0xcaf2('0x116'),'as':_0xcaf2('0x12')});db[_0xcaf2('0x6c')][_0xcaf2('0x125')](db[_0xcaf2('0x74')],{'onDelete':'cascade','as':_0xcaf2('0x176'),'foreignKey':_0xcaf2('0x166')});db['ChatMessage'][_0xcaf2('0x125')](db[_0xcaf2('0x19d')],{'onDelete':_0xcaf2('0x116'),'as':_0xcaf2('0x192'),'foreignKey':'ChatInteractionId'});db[_0xcaf2('0x6c')][_0xcaf2('0x125')](db[_0xcaf2('0xf0')],{'as':_0xcaf2('0xf0'),'foreignKey':_0xcaf2('0x18b')});db[_0xcaf2('0x6c')][_0xcaf2('0x125')](db[_0xcaf2('0x65')],{'as':_0xcaf2('0x18c'),'foreignKey':_0xcaf2('0x19b')});db[_0xcaf2('0x17e')][_0xcaf2('0x117')](db['Attachment'],{'as':'Attachments','foreignKey':_0xcaf2('0x17f'),'onDelete':_0xcaf2('0x116'),'hooks':!![]});db[_0xcaf2('0x17e')][_0xcaf2('0x125')](db[_0xcaf2('0x74')],{'onDelete':'cascade','as':_0xcaf2('0x176'),'foreignKey':_0xcaf2('0x166')});db[_0xcaf2('0x17e')][_0xcaf2('0x125')](db[_0xcaf2('0x65')],{'as':_0xcaf2('0x18c'),'foreignKey':_0xcaf2('0x19b')});db[_0xcaf2('0x13a')][_0xcaf2('0x127')](db[_0xcaf2('0x12')],{'as':'Agents','through':_0xcaf2('0x33'),'hooks':!![]});db[_0xcaf2('0x13a')]['belongsToMany'](db[_0xcaf2('0xe9')],{'through':_0xcaf2('0x1a2'),'as':_0xcaf2('0x15d')});db[_0xcaf2('0x128')][_0xcaf2('0x117')](db[_0xcaf2('0xd4')],{'as':_0xcaf2('0x160'),'foreignKey':_0xcaf2('0x1a3'),'onDelete':_0xcaf2('0x116')});db[_0xcaf2('0x128')][_0xcaf2('0x127')](db[_0xcaf2('0x12')],{'as':'Members','through':_0xcaf2('0x12a')});db[_0xcaf2('0x71')][_0xcaf2('0x125')](db[_0xcaf2('0x65')],{'as':_0xcaf2('0x1a4'),'foreignKey':_0xcaf2('0x19b')});db[_0xcaf2('0x1a5')][_0xcaf2('0x117')](db[_0xcaf2('0x74')],{'as':'Contacts','foreignKey':_0xcaf2('0x1a6')});db['CmContact'][_0xcaf2('0x117')](db[_0xcaf2('0x76')],{'as':_0xcaf2('0x151'),'foreignKey':_0xcaf2('0x166')});db[_0xcaf2('0x74')][_0xcaf2('0x117')](db[_0xcaf2('0x7a')],{'as':_0xcaf2('0x152'),'foreignKey':_0xcaf2('0x166')});db[_0xcaf2('0x74')]['hasMany'](db['CmHopperHistory'],{'as':_0xcaf2('0x153'),'foreignKey':'ContactId'});db['CmContact'][_0xcaf2('0x117')](db[_0xcaf2('0x11d')],{'as':_0xcaf2('0x11d'),'foreignKey':'ContactId'});db[_0xcaf2('0x74')][_0xcaf2('0x117')](db[_0xcaf2('0xd9')],{'as':'JscriptySessions','foreignKey':_0xcaf2('0x166')});db['CmContact'][_0xcaf2('0x117')](db[_0xcaf2('0x5f')],{'as':_0xcaf2('0x11e'),'foreignKey':_0xcaf2('0x166'),'onDelete':_0xcaf2('0x180')});db[_0xcaf2('0x74')][_0xcaf2('0x117')](db[_0xcaf2('0x19d')],{'as':'ChatInteractions','foreignKey':_0xcaf2('0x166'),'onDelete':_0xcaf2('0x180')});db[_0xcaf2('0x74')]['hasMany'](db['SmsInteraction'],{'as':_0xcaf2('0x132'),'foreignKey':'ContactId','onDelete':_0xcaf2('0x180')});db[_0xcaf2('0x74')][_0xcaf2('0x117')](db[_0xcaf2('0x4f')],{'as':_0xcaf2('0x120'),'foreignKey':_0xcaf2('0x166'),'onDelete':_0xcaf2('0x180')});db['CmContact'][_0xcaf2('0x117')](db[_0xcaf2('0x42')],{'as':_0xcaf2('0x121'),'foreignKey':_0xcaf2('0x166'),'onDelete':_0xcaf2('0x180')});db[_0xcaf2('0x74')]['belongsTo'](db[_0xcaf2('0x1a5')],{'as':_0xcaf2('0x1a7'),'foreignKey':_0xcaf2('0x1a6')});db[_0xcaf2('0x74')][_0xcaf2('0x125')](db[_0xcaf2('0x12d')],{'as':'List','foreignKey':_0xcaf2('0x182'),'onDelete':_0xcaf2('0x116')});db[_0xcaf2('0x74')][_0xcaf2('0x127')](db[_0xcaf2('0x12')],{'as':'Users','through':_0xcaf2('0x12c')});db[_0xcaf2('0x74')][_0xcaf2('0x127')](db[_0xcaf2('0x90')],{'as':_0xcaf2('0x179'),'through':_0xcaf2('0x1a8')});db[_0xcaf2('0x74')][_0xcaf2('0x127')](db[_0xcaf2('0x90')],{'through':_0xcaf2('0x1a8'),'as':'ThroughTags'});db[_0xcaf2('0x76')][_0xcaf2('0x125')](db[_0xcaf2('0x74')],{'as':_0xcaf2('0x176'),'foreignKey':_0xcaf2('0x166'),'onDelete':'cascade'});db[_0xcaf2('0x76')]['belongsTo'](db[_0xcaf2('0x12d')],{'as':_0xcaf2('0x172'),'foreignKey':_0xcaf2('0x182'),'onDelete':'cascade'});db[_0xcaf2('0x76')][_0xcaf2('0x125')](db[_0xcaf2('0x12')],{'as':_0xcaf2('0x19f'),'foreignKey':'UserId'});db[_0xcaf2('0x76')][_0xcaf2('0x125')](db['VoiceQueue'],{'as':_0xcaf2('0x1a9'),'foreignKey':_0xcaf2('0x150'),'onDelete':_0xcaf2('0x116')});db['CmHopper']['belongsTo'](db[_0xcaf2('0xec')],{'as':_0xcaf2('0xec'),'foreignKey':_0xcaf2('0x1aa'),'onDelete':_0xcaf2('0x116')});db['CmHopper'][_0xcaf2('0x125')](db[_0xcaf2('0x12')],{'as':_0xcaf2('0x177'),'foreignKey':_0xcaf2('0x1ab')});db[_0xcaf2('0x78')][_0xcaf2('0x125')](db[_0xcaf2('0x74')],{'as':_0xcaf2('0x176'),'foreignKey':'ContactId','onDelete':_0xcaf2('0x116')});db[_0xcaf2('0x78')][_0xcaf2('0x125')](db['CmList'],{'as':_0xcaf2('0x172'),'foreignKey':'ListId','onDelete':_0xcaf2('0x116')});db[_0xcaf2('0x78')]['belongsTo'](db[_0xcaf2('0x1c')],{'as':_0xcaf2('0x1a9'),'foreignKey':_0xcaf2('0x150'),'onDelete':_0xcaf2('0x116')});db[_0xcaf2('0x78')][_0xcaf2('0x125')](db[_0xcaf2('0xec')],{'as':_0xcaf2('0xec'),'foreignKey':'CampaignId','onDelete':_0xcaf2('0x116')});db[_0xcaf2('0x81')][_0xcaf2('0x117')](db[_0xcaf2('0x85')],{'as':{'plural':'All','singular':_0xcaf2('0x1ac')},'foreignKey':_0xcaf2('0x1ad'),'onDelete':_0xcaf2('0x116'),'hooks':!![]});db[_0xcaf2('0x81')][_0xcaf2('0x117')](db[_0xcaf2('0x85')],{'as':{'plural':_0xcaf2('0x1ae'),'singular':_0xcaf2('0x1af')},'foreignKey':_0xcaf2('0x1b0'),'onDelete':'cascade','hooks':!![]});db[_0xcaf2('0x81')][_0xcaf2('0x117')](db[_0xcaf2('0x7f')],{'as':_0xcaf2('0x1b1'),'foreignKey':_0xcaf2('0x1b2'),'onDelete':_0xcaf2('0x116'),'hooks':!![]});db[_0xcaf2('0x16d')]['hasMany'](db[_0xcaf2('0x16d')],{'as':'Dispositions','foreignKey':_0xcaf2('0x1b3'),'onDelete':_0xcaf2('0x116')});db[_0xcaf2('0x87')]['hasMany'](db[_0xcaf2('0x87')],{'as':_0xcaf2('0x1b4'),'foreignKey':_0xcaf2('0x159'),'onDelete':'cascade','hooks':!![],'required':![]});db[_0xcaf2('0x87')][_0xcaf2('0x117')](db[_0xcaf2('0x18')],{'as':_0xcaf2('0x11a'),'foreignKey':_0xcaf2('0x159'),'onDelete':_0xcaf2('0x180')});db[_0xcaf2('0x87')][_0xcaf2('0x117')](db[_0xcaf2('0x171')],{'as':_0xcaf2('0x1b5'),'foreignKey':_0xcaf2('0x159')});db[_0xcaf2('0x87')][_0xcaf2('0x117')](db[_0xcaf2('0x69')],{'as':'ChatApplications','foreignKey':'IntervalId'});db[_0xcaf2('0x87')][_0xcaf2('0x117')](db[_0xcaf2('0x4d')],{'as':'FaxApplications','foreignKey':'IntervalId'});db[_0xcaf2('0x87')][_0xcaf2('0x117')](db[_0xcaf2('0x57')],{'as':_0xcaf2('0x1b6'),'foreignKey':_0xcaf2('0x159')});db[_0xcaf2('0x8d')][_0xcaf2('0x125')](db['MailAccount'],{});db[_0xcaf2('0x8d')][_0xcaf2('0x125')](db[_0xcaf2('0x9c')],{'foreignKey':_0xcaf2('0x1b7')});db[_0xcaf2('0x8d')][_0xcaf2('0x125')](db['AnalyticCustomReport'],{'foreignKey':_0xcaf2('0x1b8')});db[_0xcaf2('0x8f')]['belongsToMany'](db[_0xcaf2('0x1a')],{'as':_0xcaf2('0x1b9'),'through':_0xcaf2('0x14e'),'onDelete':_0xcaf2('0x180')});db[_0xcaf2('0x90')]['belongsToMany'](db[_0xcaf2('0x74')],{'through':_0xcaf2('0x1a8')});db[_0xcaf2('0x90')][_0xcaf2('0x127')](db['ChatInteraction'],{'through':_0xcaf2('0x1a1')});db[_0xcaf2('0x90')][_0xcaf2('0x127')](db[_0xcaf2('0x42')],{'through':_0xcaf2('0x178')});db['Tag']['belongsToMany'](db[_0xcaf2('0x11f')],{'through':_0xcaf2('0x191')});db[_0xcaf2('0x90')][_0xcaf2('0x127')](db[_0xcaf2('0x4f')],{'through':_0xcaf2('0x188')});db[_0xcaf2('0x90')]['belongsToMany'](db[_0xcaf2('0x5f')],{'through':_0xcaf2('0x199')});db[_0xcaf2('0x90')][_0xcaf2('0x127')](db['WhatsappInteraction'],{'through':_0xcaf2('0x1ba')});db['Trigger'][_0xcaf2('0x117')](db[_0xcaf2('0x85')],{'as':{'plural':_0xcaf2('0x1bb'),'singular':_0xcaf2('0x1bc')},'foreignKey':_0xcaf2('0x1bd'),'onDelete':_0xcaf2('0x116'),'hooks':!![]});db[_0xcaf2('0x1be')]['hasMany'](db[_0xcaf2('0x85')],{'as':{'plural':'AnyConditions','singular':'AnyCondition'},'foreignKey':_0xcaf2('0x1bf'),'onDelete':'cascade','hooks':!![]});db['Trigger'][_0xcaf2('0x117')](db['Action'],{'as':_0xcaf2('0x1b1'),'foreignKey':'TriggerId','onDelete':_0xcaf2('0x116'),'hooks':!![]});db[_0xcaf2('0x9a')]['hasMany'](db['AnalyticFieldReport'],{'as':_0xcaf2('0x1c0'),'onDelete':_0xcaf2('0x116'),'foreignKey':_0xcaf2('0x1b8'),'hooks':!![]});db[_0xcaf2('0x9c')][_0xcaf2('0x117')](db[_0xcaf2('0xa0')],{'as':_0xcaf2('0x1c0'),'onDelete':_0xcaf2('0x116'),'foreignKey':_0xcaf2('0x1b7')});db[_0xcaf2('0x1c1')][_0xcaf2('0x117')](db['AnalyticFieldReport'],{'as':_0xcaf2('0x1c0'),'onDelete':'cascade','foreignKey':_0xcaf2('0x1c2')});db['AnalyticFieldReport'][_0xcaf2('0x125')](db['AnalyticMetric'],{'foreignKey':'MetricId'});db['SalesforceAccount']['hasMany'](db['SalesforceConfiguration'],{'as':'Configurations','onDelete':_0xcaf2('0x116'),'foreignKey':_0xcaf2('0x1c3')});db[_0xcaf2('0xa6')][_0xcaf2('0x117')](db[_0xcaf2('0x1c4')],{'as':'Subjects','onDelete':_0xcaf2('0x116'),'foreignKey':_0xcaf2('0x1c5')});db[_0xcaf2('0xa6')][_0xcaf2('0x117')](db['SalesforceField'],{'as':'Descriptions','onDelete':_0xcaf2('0x116'),'foreignKey':_0xcaf2('0x1c6')});db[_0xcaf2('0xa6')][_0xcaf2('0x117')](db[_0xcaf2('0x1c4')],{'as':_0xcaf2('0x1c0'),'onDelete':_0xcaf2('0x116'),'foreignKey':_0xcaf2('0x1c7')});db[_0xcaf2('0xa6')]['belongsTo'](db[_0xcaf2('0xa4')],{'as':_0xcaf2('0x18c'),'foreignKey':_0xcaf2('0x1c3')});db[_0xcaf2('0x1c4')]['hasMany'](db[_0xcaf2('0x1c4')],{'as':_0xcaf2('0x1c8'),'foreignKey':_0xcaf2('0x1c5')});db[_0xcaf2('0x1c4')][_0xcaf2('0x117')](db[_0xcaf2('0x1c4')],{'as':_0xcaf2('0x1c9'),'foreignKey':_0xcaf2('0x1c6')});db[_0xcaf2('0x1c4')]['hasMany'](db['SalesforceField'],{'as':'Field','foreignKey':'FieldId'});db[_0xcaf2('0x1c4')][_0xcaf2('0x125')](db[_0xcaf2('0x95')],{'as':_0xcaf2('0x95'),'foreignKey':_0xcaf2('0x1ca')});db[_0xcaf2('0xa8')]['hasMany'](db[_0xcaf2('0x1cb')],{'as':_0xcaf2('0x1cc'),'onDelete':_0xcaf2('0x116'),'foreignKey':'AccountId'});db[_0xcaf2('0x1cb')][_0xcaf2('0x117')](db['SugarcrmField'],{'as':_0xcaf2('0x1cd'),'onDelete':_0xcaf2('0x116'),'foreignKey':_0xcaf2('0x1c5')});db[_0xcaf2('0x1cb')][_0xcaf2('0x117')](db['SugarcrmField'],{'as':_0xcaf2('0x1ce'),'onDelete':_0xcaf2('0x116'),'foreignKey':'DescriptionId'});db[_0xcaf2('0x1cb')]['hasMany'](db['SugarcrmField'],{'as':_0xcaf2('0x1c0'),'onDelete':_0xcaf2('0x116'),'foreignKey':_0xcaf2('0x1c7')});db[_0xcaf2('0x1cb')][_0xcaf2('0x125')](db[_0xcaf2('0xa8')],{'as':'Account','foreignKey':_0xcaf2('0x1c3')});db['SugarcrmField'][_0xcaf2('0x117')](db[_0xcaf2('0x1cf')],{'as':'Subject','foreignKey':_0xcaf2('0x1c5')});db[_0xcaf2('0x1cf')]['hasMany'](db[_0xcaf2('0x1cf')],{'as':_0xcaf2('0x1c9'),'foreignKey':'DescriptionId'});db[_0xcaf2('0x1cf')][_0xcaf2('0x117')](db[_0xcaf2('0x1cf')],{'as':_0xcaf2('0x1d0'),'foreignKey':_0xcaf2('0x1c7')});db[_0xcaf2('0x1cf')]['belongsTo'](db[_0xcaf2('0x95')],{'as':_0xcaf2('0x95'),'foreignKey':_0xcaf2('0x1ca')});db[_0xcaf2('0x1d1')][_0xcaf2('0x117')](db[_0xcaf2('0xad')],{'as':_0xcaf2('0x1cc'),'onDelete':_0xcaf2('0x116'),'foreignKey':_0xcaf2('0x1c3')});db[_0xcaf2('0xad')][_0xcaf2('0x117')](db[_0xcaf2('0xaf')],{'as':_0xcaf2('0x1cd'),'onDelete':'cascade','foreignKey':'SubjectId'});db['DeskConfiguration']['hasMany'](db[_0xcaf2('0xaf')],{'as':_0xcaf2('0x1ce'),'onDelete':'cascade','foreignKey':'DescriptionId'});db[_0xcaf2('0xad')][_0xcaf2('0x117')](db[_0xcaf2('0xaf')],{'as':_0xcaf2('0x1c0'),'onDelete':_0xcaf2('0x116'),'foreignKey':_0xcaf2('0x1c7')});db[_0xcaf2('0xad')][_0xcaf2('0x125')](db['DeskAccount'],{'as':'Account','foreignKey':'AccountId'});db['DeskConfiguration'][_0xcaf2('0x127')](db['Tag'],{'through':'int_desk_configuration_has_tags'});db[_0xcaf2('0xaf')][_0xcaf2('0x117')](db[_0xcaf2('0xaf')],{'as':_0xcaf2('0x1c8'),'foreignKey':'SubjectId'});db[_0xcaf2('0xaf')][_0xcaf2('0x117')](db['DeskField'],{'as':_0xcaf2('0x1c9'),'foreignKey':_0xcaf2('0x1c6')});db[_0xcaf2('0xaf')]['hasMany'](db[_0xcaf2('0xaf')],{'as':_0xcaf2('0x1d0'),'foreignKey':_0xcaf2('0x1c7')});db[_0xcaf2('0xaf')][_0xcaf2('0x125')](db[_0xcaf2('0x95')],{'as':_0xcaf2('0x95'),'foreignKey':_0xcaf2('0x1ca')});db[_0xcaf2('0xb1')]['hasMany'](db['ZohoConfiguration'],{'as':'Configurations','onDelete':'cascade','foreignKey':_0xcaf2('0x1c3')});db[_0xcaf2('0xb2')][_0xcaf2('0x117')](db[_0xcaf2('0xb3')],{'as':'Subjects','onDelete':_0xcaf2('0x116'),'foreignKey':_0xcaf2('0x1c5')});db['ZohoConfiguration'][_0xcaf2('0x117')](db[_0xcaf2('0xb3')],{'as':_0xcaf2('0x1ce'),'onDelete':_0xcaf2('0x116'),'foreignKey':_0xcaf2('0x1c6')});db[_0xcaf2('0xb2')]['hasMany'](db['ZohoField'],{'as':_0xcaf2('0x1c0'),'onDelete':_0xcaf2('0x116'),'foreignKey':_0xcaf2('0x1c7')});db[_0xcaf2('0xb2')][_0xcaf2('0x125')](db[_0xcaf2('0xb1')],{'as':_0xcaf2('0x18c'),'foreignKey':_0xcaf2('0x1c3')});db[_0xcaf2('0xb3')][_0xcaf2('0x117')](db[_0xcaf2('0xb3')],{'as':'Subject','foreignKey':_0xcaf2('0x1c5')});db[_0xcaf2('0xb3')][_0xcaf2('0x117')](db[_0xcaf2('0xb3')],{'as':'Description','foreignKey':'DescriptionId'});db[_0xcaf2('0xb3')][_0xcaf2('0x117')](db[_0xcaf2('0xb3')],{'as':_0xcaf2('0x1d0'),'foreignKey':_0xcaf2('0x1c7')});db[_0xcaf2('0xb3')]['belongsTo'](db['Variable'],{'as':_0xcaf2('0x95'),'foreignKey':_0xcaf2('0x1ca')});db[_0xcaf2('0xb5')]['hasMany'](db[_0xcaf2('0x1d2')],{'as':_0xcaf2('0x1cc'),'onDelete':_0xcaf2('0x116'),'foreignKey':_0xcaf2('0x1c3')});db['ZendeskConfiguration']['hasMany'](db[_0xcaf2('0xb8')],{'as':_0xcaf2('0x1cd'),'foreignKey':_0xcaf2('0x1c5')});db[_0xcaf2('0x1d2')]['hasMany'](db[_0xcaf2('0xb8')],{'as':_0xcaf2('0x1ce'),'foreignKey':'DescriptionId'});db[_0xcaf2('0x1d2')][_0xcaf2('0x117')](db[_0xcaf2('0xb8')],{'as':'Fields','foreignKey':'FieldId'});db[_0xcaf2('0x1d2')][_0xcaf2('0x125')](db[_0xcaf2('0xb5')],{'as':_0xcaf2('0x18c'),'foreignKey':'AccountId'});db[_0xcaf2('0x1d2')][_0xcaf2('0x127')](db['Tag'],{'through':_0xcaf2('0x1d3')});db[_0xcaf2('0xb8')]['hasMany'](db['ZendeskField'],{'as':'Subject','foreignKey':_0xcaf2('0x1c5')});db[_0xcaf2('0xb8')]['hasMany'](db['ZendeskField'],{'as':'Description','foreignKey':_0xcaf2('0x1c6')});db[_0xcaf2('0xb8')][_0xcaf2('0x117')](db[_0xcaf2('0xb8')],{'as':_0xcaf2('0x1d0'),'foreignKey':_0xcaf2('0x1c7')});db[_0xcaf2('0xb8')]['belongsTo'](db[_0xcaf2('0x95')],{'as':_0xcaf2('0x95'),'foreignKey':_0xcaf2('0x1ca')});db[_0xcaf2('0xba')][_0xcaf2('0x117')](db[_0xcaf2('0x1d4')],{'as':'Configurations','onDelete':'cascade','foreignKey':_0xcaf2('0x1c3')});db[_0xcaf2('0x1d4')][_0xcaf2('0x117')](db[_0xcaf2('0xbc')],{'as':_0xcaf2('0x1cd'),'onDelete':'cascade','foreignKey':_0xcaf2('0x1c5')});db[_0xcaf2('0x1d4')]['hasMany'](db[_0xcaf2('0xbc')],{'as':_0xcaf2('0x1ce'),'onDelete':_0xcaf2('0x116'),'foreignKey':_0xcaf2('0x1c6')});db[_0xcaf2('0x1d4')]['hasMany'](db['FreshdeskField'],{'as':_0xcaf2('0x1c0'),'onDelete':_0xcaf2('0x116'),'foreignKey':_0xcaf2('0x1c7')});db[_0xcaf2('0x1d4')][_0xcaf2('0x125')](db[_0xcaf2('0xba')],{'as':'Account','foreignKey':'AccountId'});db['FreshdeskConfiguration']['belongsToMany'](db[_0xcaf2('0x90')],{'through':'int_freshdesk_configuration_has_tags'});db['FreshdeskField'][_0xcaf2('0x117')](db[_0xcaf2('0xbc')],{'as':_0xcaf2('0x1c8'),'foreignKey':_0xcaf2('0x1c5')});db[_0xcaf2('0xbc')][_0xcaf2('0x117')](db[_0xcaf2('0xbc')],{'as':_0xcaf2('0x1c9'),'foreignKey':_0xcaf2('0x1c6')});db[_0xcaf2('0xbc')][_0xcaf2('0x117')](db[_0xcaf2('0xbc')],{'as':'Field','foreignKey':'FieldId'});db['FreshdeskField']['belongsTo'](db['Variable'],{'as':_0xcaf2('0x95'),'foreignKey':_0xcaf2('0x1ca')});db[_0xcaf2('0xbe')]['hasMany'](db['VtigerConfiguration'],{'as':'Configurations','onDelete':'cascade','foreignKey':_0xcaf2('0x1c3')});db[_0xcaf2('0xbf')][_0xcaf2('0x117')](db['VtigerField'],{'as':_0xcaf2('0x1cd'),'foreignKey':_0xcaf2('0x1c5')});db[_0xcaf2('0xbf')][_0xcaf2('0x117')](db[_0xcaf2('0xc1')],{'as':_0xcaf2('0x1ce'),'foreignKey':_0xcaf2('0x1c6')});db[_0xcaf2('0xbf')]['hasMany'](db['VtigerField'],{'as':'Fields','foreignKey':'FieldId'});db[_0xcaf2('0xbf')][_0xcaf2('0x125')](db[_0xcaf2('0xbe')],{'as':_0xcaf2('0x18c'),'foreignKey':'AccountId'});db[_0xcaf2('0xc1')][_0xcaf2('0x117')](db[_0xcaf2('0xc1')],{'as':_0xcaf2('0x1c8'),'foreignKey':'SubjectId'});db['VtigerField']['hasMany'](db[_0xcaf2('0xc1')],{'as':_0xcaf2('0x1c9'),'foreignKey':_0xcaf2('0x1c6')});db['VtigerField'][_0xcaf2('0x117')](db[_0xcaf2('0xc1')],{'as':'Field','foreignKey':'FieldId'});db[_0xcaf2('0xc1')]['belongsTo'](db[_0xcaf2('0x95')],{'as':'Variable','foreignKey':_0xcaf2('0x1ca')});db[_0xcaf2('0xc3')][_0xcaf2('0x117')](db['ServicenowConfiguration'],{'as':_0xcaf2('0x1cc'),'onDelete':'cascade','foreignKey':'AccountId'});db[_0xcaf2('0xc4')][_0xcaf2('0x117')](db[_0xcaf2('0xc6')],{'as':_0xcaf2('0x1cd'),'foreignKey':_0xcaf2('0x1c5')});db[_0xcaf2('0xc4')]['hasMany'](db[_0xcaf2('0xc6')],{'as':_0xcaf2('0x1ce'),'foreignKey':_0xcaf2('0x1c6')});db[_0xcaf2('0xc4')]['hasMany'](db[_0xcaf2('0xc6')],{'as':_0xcaf2('0x1c0'),'foreignKey':_0xcaf2('0x1c7')});db[_0xcaf2('0xc4')][_0xcaf2('0x125')](db['ServicenowAccount'],{'as':_0xcaf2('0x18c'),'foreignKey':_0xcaf2('0x1c3')});db[_0xcaf2('0xc6')]['hasMany'](db['ServicenowField'],{'as':_0xcaf2('0x1c8'),'foreignKey':_0xcaf2('0x1c5')});db['ServicenowField'][_0xcaf2('0x117')](db[_0xcaf2('0xc6')],{'as':_0xcaf2('0x1c9'),'foreignKey':_0xcaf2('0x1c6')});db['ServicenowField'][_0xcaf2('0x117')](db['ServicenowField'],{'as':_0xcaf2('0x1d0'),'foreignKey':'FieldId'});db['ServicenowField'][_0xcaf2('0x125')](db[_0xcaf2('0x95')],{'as':_0xcaf2('0x95'),'foreignKey':'VariableId'});db[_0xcaf2('0xc7')]['hasMany'](db['Dynamics365Configuration'],{'as':_0xcaf2('0x1cc'),'onDelete':_0xcaf2('0x116'),'foreignKey':'AccountId'});db[_0xcaf2('0xc9')][_0xcaf2('0x117')](db[_0xcaf2('0x1d5')],{'as':_0xcaf2('0x1cd'),'onDelete':_0xcaf2('0x116'),'foreignKey':'SubjectId'});db['Dynamics365Configuration']['hasMany'](db[_0xcaf2('0x1d5')],{'as':_0xcaf2('0x1ce'),'onDelete':'cascade','foreignKey':_0xcaf2('0x1c6')});db[_0xcaf2('0xc9')][_0xcaf2('0x117')](db[_0xcaf2('0x1d5')],{'as':_0xcaf2('0x1c0'),'onDelete':_0xcaf2('0x116'),'foreignKey':_0xcaf2('0x1c7')});db[_0xcaf2('0xc9')][_0xcaf2('0x125')](db[_0xcaf2('0xc7')],{'as':_0xcaf2('0x18c'),'foreignKey':_0xcaf2('0x1c3')});db[_0xcaf2('0x1d5')][_0xcaf2('0x117')](db[_0xcaf2('0x1d5')],{'as':_0xcaf2('0x1c8'),'foreignKey':_0xcaf2('0x1c5')});db[_0xcaf2('0x1d5')][_0xcaf2('0x117')](db[_0xcaf2('0x1d5')],{'as':'Description','foreignKey':_0xcaf2('0x1c6')});db[_0xcaf2('0x1d5')][_0xcaf2('0x117')](db[_0xcaf2('0x1d5')],{'as':_0xcaf2('0x1d0'),'foreignKey':_0xcaf2('0x1c7')});db[_0xcaf2('0x1d5')][_0xcaf2('0x125')](db[_0xcaf2('0x95')],{'as':_0xcaf2('0x95'),'foreignKey':'VariableId'});db['FreshsalesAccount'][_0xcaf2('0x117')](db[_0xcaf2('0xce')],{'as':_0xcaf2('0x1cc'),'onDelete':_0xcaf2('0x116'),'foreignKey':_0xcaf2('0x1c3')});db['FreshsalesConfiguration'][_0xcaf2('0x117')](db[_0xcaf2('0x1d6')],{'as':_0xcaf2('0x1cd'),'foreignKey':'SubjectId'});db['FreshsalesConfiguration']['hasMany'](db['FreshsalesField'],{'as':'Descriptions','foreignKey':_0xcaf2('0x1c6')});db[_0xcaf2('0xce')][_0xcaf2('0x117')](db[_0xcaf2('0x1d6')],{'as':_0xcaf2('0x1c0'),'foreignKey':_0xcaf2('0x1c7')});db['FreshsalesConfiguration'][_0xcaf2('0x125')](db[_0xcaf2('0xcc')],{'as':_0xcaf2('0x18c'),'foreignKey':_0xcaf2('0x1c3')});db[_0xcaf2('0x1d6')][_0xcaf2('0x117')](db['FreshsalesField'],{'as':'Subject','foreignKey':_0xcaf2('0x1c5')});db[_0xcaf2('0x1d6')][_0xcaf2('0x117')](db[_0xcaf2('0x1d6')],{'as':_0xcaf2('0x1c9'),'foreignKey':_0xcaf2('0x1c6')});db[_0xcaf2('0x1d6')][_0xcaf2('0x117')](db['FreshsalesField'],{'as':_0xcaf2('0x1d0'),'foreignKey':'FieldId'});db['FreshsalesField'][_0xcaf2('0x125')](db[_0xcaf2('0x95')],{'as':'Variable','foreignKey':'VariableId'});db[_0xcaf2('0x1d7')][_0xcaf2('0x125')](db[_0xcaf2('0x65')],{});db['ChatQueueReport']['belongsTo'](db[_0xcaf2('0x12d')],{'as':'List','foreignKey':_0xcaf2('0x182')});db[_0xcaf2('0x1d7')][_0xcaf2('0x125')](db[_0xcaf2('0x74')],{'as':_0xcaf2('0x176'),'foreignKey':'ContactId'});db['ChatQueueReport'][_0xcaf2('0x125')](db[_0xcaf2('0x19d')],{});db[_0xcaf2('0x1d7')][_0xcaf2('0x125')](db[_0xcaf2('0x6c')],{});db[_0xcaf2('0x1d7')][_0xcaf2('0x125')](db[_0xcaf2('0x12')],{});db[_0xcaf2('0x1d7')][_0xcaf2('0x125')](db[_0xcaf2('0x13a')],{});db['ChatInternalMessage'][_0xcaf2('0x125')](db['User'],{'onDelete':_0xcaf2('0x116'),'foreignKey':_0xcaf2('0x1d8')});db[_0xcaf2('0xd4')]['belongsTo'](db[_0xcaf2('0x12')],{'onDelete':_0xcaf2('0x116'),'foreignKey':'ToId'});db[_0xcaf2('0xd9')][_0xcaf2('0x117')](db[_0xcaf2('0xd7')],{'foreignKey':_0xcaf2('0x1d9'),'onDelete':_0xcaf2('0x116')});db[_0xcaf2('0xd9')][_0xcaf2('0x117')](db['JscriptyAnswerReport'],{'foreignKey':_0xcaf2('0x1d9'),'onDelete':_0xcaf2('0x116')});db[_0xcaf2('0x1da')][_0xcaf2('0x125')](db['SmsAccount'],{});db['SmsQueueReport'][_0xcaf2('0x125')](db[_0xcaf2('0x12d')],{'as':'List','foreignKey':_0xcaf2('0x182')});db[_0xcaf2('0x1da')][_0xcaf2('0x125')](db[_0xcaf2('0x74')],{'as':_0xcaf2('0x176'),'foreignKey':_0xcaf2('0x166')});db[_0xcaf2('0x1da')][_0xcaf2('0x125')](db['SmsInteraction'],{});db[_0xcaf2('0x1da')][_0xcaf2('0x125')](db[_0xcaf2('0x5a')],{});db['SmsQueueReport'][_0xcaf2('0x125')](db[_0xcaf2('0x12')],{});db[_0xcaf2('0x1da')]['belongsTo'](db['SmsQueue'],{});db['JscriptyProject'][_0xcaf2('0x117')](db[_0xcaf2('0xd9')],{'foreignKey':_0xcaf2('0x1db')});db[_0xcaf2('0xe0')][_0xcaf2('0x117')](db[_0xcaf2('0xd7')],{'foreignKey':'ProjectId'});db[_0xcaf2('0xe0')][_0xcaf2('0x117')](db[_0xcaf2('0xd5')],{'foreignKey':_0xcaf2('0x1db')});db[_0xcaf2('0x149')]['belongsToMany'](db['User'],{'as':_0xcaf2('0x17b'),'through':_0xcaf2('0x14a')});db[_0xcaf2('0xe9')][_0xcaf2('0x127')](db[_0xcaf2('0x12')],{'as':_0xcaf2('0x15c'),'through':_0xcaf2('0x1dc')});db['Team']['belongsToMany'](db[_0xcaf2('0x1c')],{'through':'TeamVoiceQueue','as':'VoiceQueues'});db['Team']['belongsToMany'](db['MailQueue'],{'through':_0xcaf2('0x174'),'as':_0xcaf2('0x139')});db['Team']['belongsToMany'](db[_0xcaf2('0x13a')],{'through':_0xcaf2('0x1a2'),'as':_0xcaf2('0x13b')});db[_0xcaf2('0xe9')][_0xcaf2('0x127')](db[_0xcaf2('0x52')],{'through':_0xcaf2('0x18d'),'as':_0xcaf2('0x13c')});db[_0xcaf2('0xe9')][_0xcaf2('0x127')](db[_0xcaf2('0x13d')],{'through':_0xcaf2('0x194'),'as':_0xcaf2('0x1dd')});db[_0xcaf2('0xe9')][_0xcaf2('0x127')](db[_0xcaf2('0x63')],{'through':_0xcaf2('0x19a'),'as':_0xcaf2('0x1de')});db[_0xcaf2('0xe9')][_0xcaf2('0x127')](db[_0xcaf2('0x13e')],{'through':_0xcaf2('0x1df'),'as':_0xcaf2('0x13f')});db['Team'][_0xcaf2('0x127')](db[_0xcaf2('0xfc')],{'through':_0xcaf2('0x113'),'as':_0xcaf2('0x137')});db[_0xcaf2('0xec')][_0xcaf2('0x117')](db[_0xcaf2('0x76')],{'as':_0xcaf2('0x151'),'foreignKey':'CampaignId'});db[_0xcaf2('0xec')]['hasMany'](db[_0xcaf2('0x7a')],{'as':'HopperFinals','foreignKey':_0xcaf2('0x1aa')});db[_0xcaf2('0xec')][_0xcaf2('0x117')](db[_0xcaf2('0x11b')],{'as':'HopperHistories','foreignKey':_0xcaf2('0x1aa')});db['Campaign']['hasMany'](db[_0xcaf2('0x78')],{'as':_0xcaf2('0x154'),'foreignKey':_0xcaf2('0x1aa')});db[_0xcaf2('0xec')][_0xcaf2('0x125')](db[_0xcaf2('0x155')],{'as':_0xcaf2('0x155'),'foreignKey':_0xcaf2('0x156')});db[_0xcaf2('0xec')]['belongsTo'](db[_0xcaf2('0x155')],{'as':_0xcaf2('0x157'),'foreignKey':_0xcaf2('0x158')});db[_0xcaf2('0xec')]['belongsTo'](db[_0xcaf2('0x87')],{'as':_0xcaf2('0x87'),'foreignKey':_0xcaf2('0x159')});db['Campaign'][_0xcaf2('0x125')](db[_0xcaf2('0x149')],{'as':_0xcaf2('0x149'),'foreignKey':_0xcaf2('0x1e0')});db[_0xcaf2('0xec')]['belongsToMany'](db[_0xcaf2('0x12d')],{'as':_0xcaf2('0x1e1'),'through':_0xcaf2('0x1e2')});db[_0xcaf2('0xec')][_0xcaf2('0x127')](db[_0xcaf2('0x12d')],{'as':_0xcaf2('0x15e'),'through':_0xcaf2('0x1e3')});db[_0xcaf2('0xf0')][_0xcaf2('0x125')](db[_0xcaf2('0x17e')],{'as':'ChatOfflineMessage','foreignKey':_0xcaf2('0x17f')});db[_0xcaf2('0xf4')][_0xcaf2('0x125')](db[_0xcaf2('0x44')],{});db['MailTransferReport']['belongsTo'](db[_0xcaf2('0x42')],{});db[_0xcaf2('0xf4')][_0xcaf2('0x125')](db[_0xcaf2('0x168')],{'foreignKey':_0xcaf2('0x1e4'),'as':_0xcaf2('0x1e5')});db[_0xcaf2('0xf4')][_0xcaf2('0x125')](db[_0xcaf2('0x12')],{'foreignKey':'FromUserId','as':_0xcaf2('0x1e6')});db[_0xcaf2('0xf4')][_0xcaf2('0x125')](db[_0xcaf2('0x12')],{'foreignKey':_0xcaf2('0x1e7'),'as':_0xcaf2('0x1e8')});db[_0xcaf2('0xf4')][_0xcaf2('0x125')](db[_0xcaf2('0x138')],{'foreignKey':'ToMailQueueId','as':'ToQueue'});db['MailTransferReport'][_0xcaf2('0x125')](db[_0xcaf2('0x168')],{'foreignKey':_0xcaf2('0x1e9'),'as':_0xcaf2('0x1ea')});db['ChatTransferReport'][_0xcaf2('0x125')](db[_0xcaf2('0x6c')],{});db[_0xcaf2('0xf5')][_0xcaf2('0x125')](db[_0xcaf2('0x19d')],{});db[_0xcaf2('0xf5')]['belongsTo'](db[_0xcaf2('0x65')],{'foreignKey':_0xcaf2('0x1eb'),'as':'FromAccount'});db[_0xcaf2('0xf5')][_0xcaf2('0x125')](db['User'],{'foreignKey':_0xcaf2('0x1ec'),'as':'FromAgent'});db[_0xcaf2('0xf5')][_0xcaf2('0x125')](db[_0xcaf2('0x12')],{'foreignKey':'ToUserId','as':_0xcaf2('0x1e8')});db[_0xcaf2('0xf5')]['belongsTo'](db['ChatQueue'],{'foreignKey':_0xcaf2('0x1ed'),'as':_0xcaf2('0x1ee')});db['ChatTransferReport'][_0xcaf2('0x125')](db[_0xcaf2('0x65')],{'foreignKey':_0xcaf2('0x1ef'),'as':'ToAccount'});db[_0xcaf2('0xf7')]['belongsTo'](db['FaxMessage'],{});db['FaxTransferReport']['belongsTo'](db['FaxInteraction'],{});db[_0xcaf2('0xf7')][_0xcaf2('0x125')](db[_0xcaf2('0x4c')],{'foreignKey':_0xcaf2('0x1f0'),'as':_0xcaf2('0x1e5')});db['FaxTransferReport'][_0xcaf2('0x125')](db['User'],{'foreignKey':_0xcaf2('0x1ec'),'as':_0xcaf2('0x1e6')});db[_0xcaf2('0xf7')][_0xcaf2('0x125')](db[_0xcaf2('0x12')],{'foreignKey':_0xcaf2('0x1e7'),'as':_0xcaf2('0x1e8')});db['FaxTransferReport'][_0xcaf2('0x125')](db['FaxQueue'],{'foreignKey':_0xcaf2('0x1f1'),'as':'ToQueue'});db[_0xcaf2('0xf7')]['belongsTo'](db[_0xcaf2('0x4c')],{'foreignKey':_0xcaf2('0x1f2'),'as':_0xcaf2('0x1ea')});db[_0xcaf2('0x1f3')][_0xcaf2('0x125')](db[_0xcaf2('0x61')],{});db[_0xcaf2('0x1f3')][_0xcaf2('0x125')](db[_0xcaf2('0x5f')],{});db[_0xcaf2('0x1f3')][_0xcaf2('0x125')](db[_0xcaf2('0x5c')],{'foreignKey':_0xcaf2('0x1f4'),'as':'FromAccount'});db[_0xcaf2('0x1f3')][_0xcaf2('0x125')](db[_0xcaf2('0x12')],{'foreignKey':_0xcaf2('0x1ec'),'as':_0xcaf2('0x1e6')});db['OpenchannelTransferReport'][_0xcaf2('0x125')](db[_0xcaf2('0x12')],{'foreignKey':_0xcaf2('0x1e7'),'as':'ToAgent'});db[_0xcaf2('0x1f3')][_0xcaf2('0x125')](db[_0xcaf2('0x63')],{'foreignKey':_0xcaf2('0x1f5'),'as':'ToQueue'});db[_0xcaf2('0x1f3')]['belongsTo'](db['OpenchannelAccount'],{'foreignKey':_0xcaf2('0x1f6'),'as':_0xcaf2('0x1ea')});db[_0xcaf2('0xfa')][_0xcaf2('0x125')](db[_0xcaf2('0x5a')],{});db[_0xcaf2('0xfa')][_0xcaf2('0x125')](db[_0xcaf2('0x11f')],{});db[_0xcaf2('0xfa')][_0xcaf2('0x125')](db[_0xcaf2('0x55')],{'foreignKey':_0xcaf2('0x1f7'),'as':_0xcaf2('0x1e5')});db[_0xcaf2('0xfa')][_0xcaf2('0x125')](db[_0xcaf2('0x12')],{'foreignKey':_0xcaf2('0x1ec'),'as':_0xcaf2('0x1e6')});db[_0xcaf2('0xfa')][_0xcaf2('0x125')](db['User'],{'foreignKey':_0xcaf2('0x1e7'),'as':_0xcaf2('0x1e8')});db['SmsTransferReport'][_0xcaf2('0x125')](db[_0xcaf2('0x13d')],{'foreignKey':'ToSmsQueueId','as':_0xcaf2('0x1ee')});db[_0xcaf2('0xfa')]['belongsTo'](db['SmsAccount'],{'foreignKey':_0xcaf2('0x1f8'),'as':_0xcaf2('0x1ea')});db[_0xcaf2('0x12d')][_0xcaf2('0x117')](db['Disposition'],{'as':_0xcaf2('0x16e'),'foreignKey':'ListId','onDelete':_0xcaf2('0x116')});db[_0xcaf2('0x12d')][_0xcaf2('0x117')](db[_0xcaf2('0x7d')],{'as':_0xcaf2('0x1f9'),'foreignKey':_0xcaf2('0x182')});db[_0xcaf2('0x12d')][_0xcaf2('0x117')](db[_0xcaf2('0x74')],{'as':'Contacts','onDelete':'cascade','foreignKey':'ListId'});db[_0xcaf2('0x12d')][_0xcaf2('0x117')](db[_0xcaf2('0x7a')],{'as':'HopperFinals','foreignKey':_0xcaf2('0x182')});db[_0xcaf2('0x12d')][_0xcaf2('0x117')](db[_0xcaf2('0x11b')],{'as':_0xcaf2('0x11c'),'foreignKey':_0xcaf2('0x182')});db[_0xcaf2('0x12d')][_0xcaf2('0x117')](db[_0xcaf2('0x11d')],{'as':'ReportAgentPreview','foreignKey':_0xcaf2('0x182')});db[_0xcaf2('0x12d')]['belongsToMany'](db['VoiceQueue'],{'as':_0xcaf2('0x1fa'),'through':'voice_queues_has_cm_lists'});db['CmList']['belongsToMany'](db[_0xcaf2('0x12')],{'as':_0xcaf2('0x15c'),'through':'cm_user_has_lists'});db[_0xcaf2('0xfc')][_0xcaf2('0x117')](db[_0xcaf2('0x18')],{'as':_0xcaf2('0x11a'),'onDelete':_0xcaf2('0x116')});db[_0xcaf2('0xfc')][_0xcaf2('0x127')](db[_0xcaf2('0x12')],{'as':_0xcaf2('0x15c'),'through':'UserVoicePrefix'});db['VoicePrefix'][_0xcaf2('0x127')](db[_0xcaf2('0xe9')],{'through':_0xcaf2('0x113'),'as':_0xcaf2('0x15d')});db[_0xcaf2('0xfe')][_0xcaf2('0x117')](db['User'],{'as':_0xcaf2('0x17b'),'foreignKey':_0xcaf2('0x126')});db['UserProfile'][_0xcaf2('0x117')](db[_0xcaf2('0x1fb')],{'as':_0xcaf2('0x1fc'),'foreignKey':_0xcaf2('0x126'),'onDelete':_0xcaf2('0x116')});db[_0xcaf2('0x1fb')]['hasMany'](db[_0xcaf2('0x101')],{'as':_0xcaf2('0x1fd'),'foreignKey':_0xcaf2('0x1fe'),'onDelete':_0xcaf2('0x116')});db['WhatsappAccount']['hasMany'](db['Disposition'],{'as':_0xcaf2('0x16e'),'foreignKey':_0xcaf2('0x1ff'),'onDelete':_0xcaf2('0x116')});db[_0xcaf2('0x104')][_0xcaf2('0x117')](db[_0xcaf2('0x16f')],{'as':'Answers','foreignKey':'WhatsappAccountId'});db[_0xcaf2('0x104')][_0xcaf2('0x117')](db[_0xcaf2('0x200')],{'as':'Messages','foreignKey':_0xcaf2('0x1ff')});db[_0xcaf2('0x104')][_0xcaf2('0x117')](db[_0xcaf2('0x122')],{'as':'Interactions'});db['WhatsappAccount'][_0xcaf2('0x117')](db[_0xcaf2('0x106')],{'as':'Applications'});db['WhatsappAccount'][_0xcaf2('0x125')](db[_0xcaf2('0x12d')],{'as':_0xcaf2('0x172'),'foreignKey':_0xcaf2('0x182')});db[_0xcaf2('0x104')]['belongsTo'](db[_0xcaf2('0x88')],{'as':_0xcaf2('0x18f'),'foreignKey':_0xcaf2('0x15a')});db[_0xcaf2('0x104')]['belongsToMany'](db[_0xcaf2('0x12')],{'as':'Agents','through':'user_has_whatsapp_accounts'});db[_0xcaf2('0x106')][_0xcaf2('0x125')](db[_0xcaf2('0x12')],{'onDelete':_0xcaf2('0x180')});db[_0xcaf2('0x106')][_0xcaf2('0x125')](db[_0xcaf2('0x13e')],{'onDelete':_0xcaf2('0x180')});db[_0xcaf2('0x106')][_0xcaf2('0x125')](db[_0xcaf2('0x104')],{'onDelete':_0xcaf2('0x180')});db[_0xcaf2('0x106')][_0xcaf2('0x125')](db[_0xcaf2('0x87')],{'onDelete':_0xcaf2('0x180'),'foreignKey':_0xcaf2('0x159')});db[_0xcaf2('0x106')]['belongsTo'](db[_0xcaf2('0x90')],{'onDelete':'restrict','foreignKey':_0xcaf2('0x181')});db[_0xcaf2('0x122')][_0xcaf2('0x117')](db[_0xcaf2('0x200')],{'as':_0xcaf2('0x160'),'onDelete':_0xcaf2('0x116'),'foreignKey':'WhatsappInteractionId'});db[_0xcaf2('0x122')][_0xcaf2('0x125')](db[_0xcaf2('0x104')],{'as':_0xcaf2('0x18c'),'foreignKey':'WhatsappAccountId'});db[_0xcaf2('0x122')][_0xcaf2('0x125')](db[_0xcaf2('0x74')],{'as':_0xcaf2('0x176'),'foreignKey':_0xcaf2('0x166')});db[_0xcaf2('0x122')][_0xcaf2('0x125')](db['User'],{'as':'Owner','foreignKey':'UserId'});db[_0xcaf2('0x122')][_0xcaf2('0x127')](db['Tag'],{'through':_0xcaf2('0x1ba'),'as':_0xcaf2('0x179')});db[_0xcaf2('0x122')][_0xcaf2('0x127')](db[_0xcaf2('0x90')],{'through':_0xcaf2('0x1ba'),'as':'ThroughTags'});db['WhatsappInteraction']['belongsToMany'](db[_0xcaf2('0x12')],{'as':_0xcaf2('0x17b'),'through':_0xcaf2('0x136'),'foreignKey':_0xcaf2('0x201')});db['WhatsappMessage']['belongsTo'](db[_0xcaf2('0x12')],{'as':_0xcaf2('0x12')});db[_0xcaf2('0x200')][_0xcaf2('0x125')](db[_0xcaf2('0x74')],{'onDelete':_0xcaf2('0x116'),'as':_0xcaf2('0x176')});db[_0xcaf2('0x200')][_0xcaf2('0x125')](db[_0xcaf2('0x122')],{'onDelete':_0xcaf2('0x116'),'as':_0xcaf2('0x192'),'foreignKey':'WhatsappInteractionId'});db[_0xcaf2('0x200')][_0xcaf2('0x125')](db[_0xcaf2('0x104')],{'as':_0xcaf2('0x18c'),'foreignKey':_0xcaf2('0x1ff')});db[_0xcaf2('0x10a')][_0xcaf2('0x125')](db[_0xcaf2('0x104')],{});db[_0xcaf2('0x10a')][_0xcaf2('0x125')](db[_0xcaf2('0x12d')],{'as':_0xcaf2('0x172'),'foreignKey':_0xcaf2('0x182')});db[_0xcaf2('0x10a')][_0xcaf2('0x125')](db[_0xcaf2('0x74')],{'as':'Contact','foreignKey':_0xcaf2('0x166')});db[_0xcaf2('0x10a')]['belongsTo'](db[_0xcaf2('0x122')],{});db['WhatsappQueueReport'][_0xcaf2('0x125')](db[_0xcaf2('0x13e')],{});db['WhatsappQueueReport']['belongsTo'](db[_0xcaf2('0x200')],{});db[_0xcaf2('0x10a')]['belongsTo'](db[_0xcaf2('0x12')],{});db[_0xcaf2('0x10c')][_0xcaf2('0x125')](db[_0xcaf2('0x200')],{});db[_0xcaf2('0x10c')][_0xcaf2('0x125')](db['WhatsappInteraction'],{});db['WhatsappTransferReport']['belongsTo'](db['WhatsappAccount'],{'foreignKey':_0xcaf2('0x202'),'as':_0xcaf2('0x1e5')});db[_0xcaf2('0x10c')][_0xcaf2('0x125')](db[_0xcaf2('0x104')],{'foreignKey':_0xcaf2('0x203'),'as':_0xcaf2('0x1ea')});db[_0xcaf2('0x10c')][_0xcaf2('0x125')](db['WhatsappQueue'],{'foreignKey':_0xcaf2('0x204'),'as':_0xcaf2('0x1ee')});db['WhatsappTransferReport']['belongsTo'](db[_0xcaf2('0x12')],{'foreignKey':_0xcaf2('0x1ec'),'as':_0xcaf2('0x1e6')});db[_0xcaf2('0x10c')][_0xcaf2('0x125')](db[_0xcaf2('0x12')],{'foreignKey':_0xcaf2('0x1e7'),'as':_0xcaf2('0x1e8')});db[_0xcaf2('0x13e')][_0xcaf2('0x127')](db[_0xcaf2('0x12')],{'as':_0xcaf2('0x15c'),'through':_0xcaf2('0x3b'),'foreignKey':_0xcaf2('0x205')});db['WhatsappQueue'][_0xcaf2('0x127')](db[_0xcaf2('0xe9')],{'through':_0xcaf2('0x1df'),'as':_0xcaf2('0x15d')});module[_0xcaf2('0x206')]={'db':db,'dbH':dbH}; \ No newline at end of file diff --git a/server/routes.js b/server/routes.js index f265de5..b539fa6 100644 --- a/server/routes.js +++ b/server/routes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4891=['./api/intZohoField','/api/integrations/zendesk/accounts','./api/intZendeskAccount','/api/integrations/zendesk/configurations','./api/intZendeskConfiguration','/api/integrations/zendesk/fields','./api/intZendeskField','/api/integrations/freshdesk/accounts','/api/integrations/freshdesk/configurations','./api/intFreshdeskConfiguration','./api/intFreshdeskField','./api/intVtigerAccount','/api/integrations/vtiger/configurations','./api/intVtigerConfiguration','./api/intVtigerField','./api/intServicenowAccount','/api/integrations/servicenow/configurations','/api/integrations/servicenow/fields','./api/intServicenowField','/api/integrations/dynamics365/accounts','./api/intDynamics365Account','/api/integrations/dynamics365/fields','./api/intDynamics365Field','/api/integrations/freshsales/accounts','./api/intFreshsalesAccount','/api/integrations/freshsales/configurations','./api/intFreshsalesConfiguration','/api/integrations/freshsales/fields','./api/intFreshsalesField','./api/network','/api/chat/reports/queue','./api/chatQueueReport','/api/chat/internal/messages','./api/chatInternalMessage','/api/jscripty/answers/reports','./api/jscriptyAnswerReport','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','./api/jscriptySessionReport','/api/sms/reports/queue','./api/smsQueueReport','/api/square/reports','./api/squareReport','/api/square/details/reports','/api/jscripty/projects','./api/jscriptyProject','./api/setting','/api/square/odbc','./api/squareOdbc','/api/square/projects','./api/squareProject','/api/square/recordings','./api/squareMessage','/api/teams','/api/license','./api/campaign','/api/migrations','./api/migration','/api/attachments','./api/attachment','./api/mailTransferReport','/api/chat/reports/transfer','./api/chatTransferReport','/api/fax/reports/transfer','./api/faxTransferReport','/api/openchannel/reports/transfer','./api/openchannelTransferReport','/api/sms/reports/transfer','./api/smsTransferReport','/api/cm/lists','/api/userProfiles','./api/userProfile','/api/userProfile/sections','./api/userProfileSection','/api/userProfile/resources','/api/userNotifications','./api/userNotification','/api/whatsapp/accounts','./api/whatsappAccount','/api/whatsapp/interactions','./api/whatsappInteraction','/api/whatsapp/messages','./api/whatsappMessage','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','/api/whatsapp/queues','./api/whatsappQueue','/api/cloudProviders','./api/cloudProvider','/api/realtime','./api/realtime','./api/authLocal','/api/auth/google','/api/jira','./api/jira','./api/rpc','/api/version','./api/version','/api/system','./api/system','./api/pm2','/api/webbar','./api/webbar','/apidoc','static','join','/www','root','/demo','snippet','3.0.0','/plugins','/server/files/plugins','route','get','sendFile','resolve','appPath','username','password','newPassword','firstName','lastName','street','mobile','fax','email','clientSecret','code','accessKey','tenantId','token','channelSecret','accessToken','accessTokenSecret','authToken','consumerKey','consumerSecret','membername','calleridname','exten','vidaooApiKey','clientEmail','privateKey','secretaccesskey','key','pass','accountSid','dsn','isPlainObject','isArray','length','isString','replace','@@{','}@@','includes','lodash','express-winston','util','./config/environment','./config/logger','api','auth','default','use','logger','isEmpty','body','headers','x-forwarded-for','connection','remoteAddress','url','statusCode','responseTime','user','name','role','inspect','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','agent_id','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','format','method','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/mohs','./api/voiceQueue','/api/voice/recordings','/api/screen/recordings','./api/screenRecording','/api/voice/mails','./api/voiceMail','/api/voice/mails/messages','/api/voice/calls/reports','/api/voice/dials/reports','./api/voiceDialReport','/api/voice/agents/reports','./api/voiceAgentReport','/api/voice/queues/reports','./api/voiceQueueReport','/api/members/reports','./api/memberReport','/api/trunks','./api/trunk','/api/mail/out_servers','./api/mailServerOut','./api/mailAccount','./api/mailQueue','/api/mail/substatuses','./api/mailSubstatus','./api/mailInteraction','/api/mail/messages','./api/mailMessage','/api/mail/applications','./api/mailApplication','/api/dashboards','/api/dashboards/items','/api/fax/accounts','./api/faxAccount','/api/fax/applications','./api/faxApplication','/api/fax/interactions','./api/faxInteraction','/api/fax/messages','/api/fax/queues','./api/faxQueue','/api/fax/reports/queue','./api/faxQueueReport','/api/sms/accounts','./api/smsAccount','/api/sms/applications','./api/smsApplication','/api/sms/interactions','./api/smsInteraction','/api/sms/queues','/api/openchannel/accounts','./api/openchannelAccount','/api/openchannel/applications','./api/openchannelApplication','/api/openchannel/interactions','/api/openchannel/messages','./api/openchannelMessage','/api/openchannel/queues','/api/chat/websites','./api/chatWebsite','/api/openchannel/reports/queue','./api/openchannelQueueReport','/api/chat/applications','./api/chatApplication','/api/chat/interactions','./api/chatInteraction','/api/chat/messages','./api/chatMessage','/api/chat/offline_messages','/api/chat/queues','/api/chat/groups','/api/chat/proactive_actions','./api/chatProactiveAction','/api/cm/companies','./api/cmContact','/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/action','/api/automations','./api/automation','/api/canned_answers','./api/cannedAnswer','./api/disposition','/api/conditions','/api/intervals','./api/interval','/api/pauses','./api/pause','/api/cdr','./api/cdr','./api/voiceQueuesLog','/api/schedules','/api/sounds','./api/sound','/api/tags','/api/templates','/api/triggers','/api/variables','./api/variable','./api/integration','/api/integrations/reports','./api/integrationReport','/api/analytics/custom_reports','/api/analytics/default_reports','/api/analytics/extracted_reports','./api/analyticExtractedReport','/api/analytics/metrics','./api/analyticMetric','./api/analyticFieldReport','/api/analytics/tree_reports','./api/analyticTreeReport','/api/integrations/salesforce/accounts','./api/intSalesforceAccount','/api/integrations/salesforce/configurations','./api/intSalesforceConfiguration','/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','/api/integrations/sugarcrm/configurations','/api/integrations/sugarcrm/fields','./api/intSugarcrmField','/api/integrations/desk/accounts','/api/integrations/desk/configurations','/api/integrations/desk/fields','/api/integrations/zoho/accounts','./api/intZohoAccount','/api/integrations/zoho/configurations','./api/intZohoConfiguration','/api/integrations/zoho/fields'];(function(_0x2c9126,_0x437d3d){var _0xd5b615=function(_0x2dc2dd){while(--_0x2dc2dd){_0x2c9126['push'](_0x2c9126['shift']());}};_0xd5b615(++_0x437d3d);}(_0x4891,0x9e));var _0x1489=function(_0x5797d8,_0x4efa24){_0x5797d8=_0x5797d8-0x0;var _0xab7ead=_0x4891[_0x5797d8];return _0xab7ead;};'use strict';var _=require(_0x1489('0x0'));var path=require('path');var express=require('express');var ewinston=require(_0x1489('0x1'));var util=require(_0x1489('0x2'));var errors=require('./errors');var config=require(_0x1489('0x3'));var logger=require(_0x1489('0x4'))(_0x1489('0x5'));var authLogger=require('./config/logger')(_0x1489('0x6'));exports[_0x1489('0x7')]=function(_0xe9580f){_0xe9580f[_0x1489('0x8')](ewinston[_0x1489('0x9')]({'winstonInstance':logger,'meta':![],'statusLevels':!![],'msg':function(_0x1eb92d,_0x442888){var _0x1c202d='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s';if(!_[_0x1489('0xa')](_0x1eb92d[_0x1489('0xb')])){_0x1c202d+='\x20body=%s';var _0x1df2ef=_0x1eb92d[_0x1489('0xb')];maskSensitiveData(_0x1df2ef);}return util['format'](_0x1c202d,_0x1eb92d['method'],_0x1eb92d[_0x1489('0xc')][_0x1489('0xd')]?_0x1eb92d[_0x1489('0xc')][_0x1489('0xd')]:_0x1eb92d[_0x1489('0xe')][_0x1489('0xf')]||_0x1eb92d['ip'],_0x1eb92d[_0x1489('0x10')],_0x442888[_0x1489('0x11')],_0x442888[_0x1489('0x12')],_0x1eb92d['user']?_0x1eb92d[_0x1489('0x13')]['id']:null,_0x1eb92d[_0x1489('0x13')]?_0x1eb92d['user'][_0x1489('0x14')]:null,_0x1eb92d[_0x1489('0x13')]?_0x1eb92d['user'][_0x1489('0x15')]:null,_0x1df2ef?util[_0x1489('0x16')](_0x1df2ef,![],null):'');}}));_0xe9580f[_0x1489('0x8')](ewinston['logger']({'winstonInstance':authLogger,'meta':![],'statusLevels':!![],'msg':function(_0x2f961f,_0x428cfc){var _0x924d27=_0x1489('0x17');if(_0x2f961f['body']&&_0x2f961f[_0x1489('0xb')]['device']&&_0x2f961f[_0x1489('0xb')][_0x1489('0x18')]){_0x924d27=_0x1489('0x19');}return util[_0x1489('0x1a')](_0x924d27,_0x2f961f[_0x1489('0x1b')],_0x2f961f['headers'][_0x1489('0xd')]?_0x2f961f['headers'][_0x1489('0xd')]:_0x2f961f[_0x1489('0xe')][_0x1489('0xf')]||_0x2f961f['ip'],_0x2f961f[_0x1489('0x10')],_0x428cfc[_0x1489('0x11')],_0x428cfc[_0x1489('0x12')],_0x2f961f[_0x1489('0x13')]?_0x2f961f[_0x1489('0x13')]['id']:null,_0x2f961f[_0x1489('0x13')]?_0x2f961f[_0x1489('0x13')][_0x1489('0x14')]:null,_0x2f961f['user']?_0x2f961f[_0x1489('0x13')]['role']:null,_0x2f961f[_0x1489('0xb')]&&_0x2f961f[_0x1489('0xb')][_0x1489('0x1c')]?_0x2f961f[_0x1489('0xb')]['device']:_0x1489('0x1d'),_0x2f961f['body']&&_0x2f961f[_0x1489('0xb')]['agent_id']?_0x2f961f[_0x1489('0xb')][_0x1489('0x18')]:'',_0x2f961f[_0x1489('0xb')]&&_0x2f961f[_0x1489('0xb')][_0x1489('0x1e')]?_0x2f961f[_0x1489('0xb')][_0x1489('0x1e')]:'');},'ignoreRoute':function(_0x1f1d97){var _0x17255e=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x17255e[_0x1489('0x1f')](_0x1f1d97['url']);}}));_0xe9580f[_0x1489('0x8')](_0x1489('0x20'),require(_0x1489('0x21')));_0xe9580f['use'](_0x1489('0x22'),require(_0x1489('0x23')));_0xe9580f[_0x1489('0x8')](_0x1489('0x24'),require(_0x1489('0x25')));_0xe9580f[_0x1489('0x8')](_0x1489('0x26'),require(_0x1489('0x27')));_0xe9580f['use'](_0x1489('0x28'),require('./api/voiceMusicOnHold'));_0xe9580f[_0x1489('0x8')]('/api/voice/queues',require(_0x1489('0x29')));_0xe9580f[_0x1489('0x8')](_0x1489('0x2a'),require('./api/voiceRecording'));_0xe9580f[_0x1489('0x8')](_0x1489('0x2b'),require(_0x1489('0x2c')));_0xe9580f[_0x1489('0x8')](_0x1489('0x2d'),require(_0x1489('0x2e')));_0xe9580f[_0x1489('0x8')](_0x1489('0x2f'),require('./api/voiceMailMessage'));_0xe9580f[_0x1489('0x8')](_0x1489('0x30'),require('./api/voiceCallReport'));_0xe9580f[_0x1489('0x8')](_0x1489('0x31'),require(_0x1489('0x32')));_0xe9580f[_0x1489('0x8')](_0x1489('0x33'),require(_0x1489('0x34')));_0xe9580f[_0x1489('0x8')](_0x1489('0x35'),require(_0x1489('0x36')));_0xe9580f[_0x1489('0x8')](_0x1489('0x37'),require(_0x1489('0x38')));_0xe9580f['use'](_0x1489('0x39'),require(_0x1489('0x3a')));_0xe9580f['use']('/api/voice/transfers/reports',require('./api/voiceTransferReport'));_0xe9580f[_0x1489('0x8')](_0x1489('0x3b'),require(_0x1489('0x3c')));_0xe9580f[_0x1489('0x8')]('/api/mail/accounts',require(_0x1489('0x3d')));_0xe9580f[_0x1489('0x8')]('/api/mail/queues',require(_0x1489('0x3e')));_0xe9580f[_0x1489('0x8')](_0x1489('0x3f'),require(_0x1489('0x40')));_0xe9580f[_0x1489('0x8')]('/api/mail/interactions',require(_0x1489('0x41')));_0xe9580f[_0x1489('0x8')](_0x1489('0x42'),require(_0x1489('0x43')));_0xe9580f[_0x1489('0x8')](_0x1489('0x44'),require(_0x1489('0x45')));_0xe9580f[_0x1489('0x8')]('/api/mail/reports/queue',require('./api/mailQueueReport'));_0xe9580f[_0x1489('0x8')](_0x1489('0x46'),require('./api/dashboard'));_0xe9580f[_0x1489('0x8')](_0x1489('0x47'),require('./api/dashboardItem'));_0xe9580f['use'](_0x1489('0x48'),require(_0x1489('0x49')));_0xe9580f[_0x1489('0x8')](_0x1489('0x4a'),require(_0x1489('0x4b')));_0xe9580f[_0x1489('0x8')](_0x1489('0x4c'),require(_0x1489('0x4d')));_0xe9580f['use'](_0x1489('0x4e'),require('./api/faxMessage'));_0xe9580f['use'](_0x1489('0x4f'),require(_0x1489('0x50')));_0xe9580f[_0x1489('0x8')](_0x1489('0x51'),require(_0x1489('0x52')));_0xe9580f['use'](_0x1489('0x53'),require(_0x1489('0x54')));_0xe9580f[_0x1489('0x8')](_0x1489('0x55'),require(_0x1489('0x56')));_0xe9580f['use'](_0x1489('0x57'),require(_0x1489('0x58')));_0xe9580f[_0x1489('0x8')]('/api/sms/messages',require('./api/smsMessage'));_0xe9580f[_0x1489('0x8')](_0x1489('0x59'),require('./api/smsQueue'));_0xe9580f[_0x1489('0x8')](_0x1489('0x5a'),require(_0x1489('0x5b')));_0xe9580f['use'](_0x1489('0x5c'),require(_0x1489('0x5d')));_0xe9580f[_0x1489('0x8')](_0x1489('0x5e'),require('./api/openchannelInteraction'));_0xe9580f[_0x1489('0x8')](_0x1489('0x5f'),require(_0x1489('0x60')));_0xe9580f['use'](_0x1489('0x61'),require('./api/openchannelQueue'));_0xe9580f[_0x1489('0x8')](_0x1489('0x62'),require(_0x1489('0x63')));_0xe9580f[_0x1489('0x8')](_0x1489('0x64'),require(_0x1489('0x65')));_0xe9580f[_0x1489('0x8')](_0x1489('0x66'),require(_0x1489('0x67')));_0xe9580f[_0x1489('0x8')](_0x1489('0x68'),require(_0x1489('0x69')));_0xe9580f[_0x1489('0x8')](_0x1489('0x6a'),require(_0x1489('0x6b')));_0xe9580f[_0x1489('0x8')](_0x1489('0x6c'),require('./api/chatOfflineMessage'));_0xe9580f[_0x1489('0x8')](_0x1489('0x6d'),require('./api/chatQueue'));_0xe9580f['use'](_0x1489('0x6e'),require('./api/chatGroup'));_0xe9580f[_0x1489('0x8')](_0x1489('0x6f'),require(_0x1489('0x70')));_0xe9580f[_0x1489('0x8')](_0x1489('0x71'),require('./api/cmCompany'));_0xe9580f['use']('/api/cm/contacts',require(_0x1489('0x72')));_0xe9580f['use'](_0x1489('0x73'),require('./api/cmHopper'));_0xe9580f[_0x1489('0x8')](_0x1489('0x74'),require(_0x1489('0x75')));_0xe9580f['use'](_0x1489('0x76'),require(_0x1489('0x77')));_0xe9580f['use'](_0x1489('0x78'),require(_0x1489('0x79')));_0xe9580f[_0x1489('0x8')](_0x1489('0x7a'),require('./api/cmCustomField'));_0xe9580f['use']('/api/actions',require(_0x1489('0x7b')));_0xe9580f[_0x1489('0x8')](_0x1489('0x7c'),require(_0x1489('0x7d')));_0xe9580f[_0x1489('0x8')](_0x1489('0x7e'),require(_0x1489('0x7f')));_0xe9580f[_0x1489('0x8')]('/api/dispositions',require(_0x1489('0x80')));_0xe9580f[_0x1489('0x8')](_0x1489('0x81'),require('./api/condition'));_0xe9580f[_0x1489('0x8')](_0x1489('0x82'),require(_0x1489('0x83')));_0xe9580f['use'](_0x1489('0x84'),require(_0x1489('0x85')));_0xe9580f['use'](_0x1489('0x86'),require(_0x1489('0x87')));_0xe9580f[_0x1489('0x8')]('/api/voiceQueuesLog',require(_0x1489('0x88')));_0xe9580f[_0x1489('0x8')](_0x1489('0x89'),require('./api/schedule'));_0xe9580f[_0x1489('0x8')](_0x1489('0x8a'),require(_0x1489('0x8b')));_0xe9580f[_0x1489('0x8')](_0x1489('0x8c'),require('./api/tag'));_0xe9580f[_0x1489('0x8')](_0x1489('0x8d'),require('./api/template'));_0xe9580f[_0x1489('0x8')](_0x1489('0x8e'),require('./api/trigger'));_0xe9580f[_0x1489('0x8')](_0x1489('0x8f'),require(_0x1489('0x90')));_0xe9580f[_0x1489('0x8')]('/api/integrations',require(_0x1489('0x91')));_0xe9580f[_0x1489('0x8')](_0x1489('0x92'),require(_0x1489('0x93')));_0xe9580f[_0x1489('0x8')](_0x1489('0x94'),require('./api/analyticCustomReport'));_0xe9580f[_0x1489('0x8')](_0x1489('0x95'),require('./api/analyticDefaultReport'));_0xe9580f[_0x1489('0x8')](_0x1489('0x96'),require(_0x1489('0x97')));_0xe9580f[_0x1489('0x8')](_0x1489('0x98'),require(_0x1489('0x99')));_0xe9580f[_0x1489('0x8')]('/api/analytics/field_reports',require(_0x1489('0x9a')));_0xe9580f[_0x1489('0x8')](_0x1489('0x9b'),require(_0x1489('0x9c')));_0xe9580f[_0x1489('0x8')](_0x1489('0x9d'),require(_0x1489('0x9e')));_0xe9580f[_0x1489('0x8')](_0x1489('0x9f'),require(_0x1489('0xa0')));_0xe9580f['use']('/api/integrations/salesforce/fields',require('./api/intSalesforceField'));_0xe9580f[_0x1489('0x8')](_0x1489('0xa1'),require(_0x1489('0xa2')));_0xe9580f[_0x1489('0x8')](_0x1489('0xa3'),require('./api/intSugarcrmConfiguration'));_0xe9580f['use'](_0x1489('0xa4'),require(_0x1489('0xa5')));_0xe9580f['use'](_0x1489('0xa6'),require('./api/intDeskAccount'));_0xe9580f[_0x1489('0x8')](_0x1489('0xa7'),require('./api/intDeskConfiguration'));_0xe9580f['use'](_0x1489('0xa8'),require('./api/intDeskField'));_0xe9580f[_0x1489('0x8')](_0x1489('0xa9'),require(_0x1489('0xaa')));_0xe9580f[_0x1489('0x8')](_0x1489('0xab'),require(_0x1489('0xac')));_0xe9580f[_0x1489('0x8')](_0x1489('0xad'),require(_0x1489('0xae')));_0xe9580f[_0x1489('0x8')](_0x1489('0xaf'),require(_0x1489('0xb0')));_0xe9580f[_0x1489('0x8')](_0x1489('0xb1'),require(_0x1489('0xb2')));_0xe9580f[_0x1489('0x8')](_0x1489('0xb3'),require(_0x1489('0xb4')));_0xe9580f[_0x1489('0x8')](_0x1489('0xb5'),require('./api/intFreshdeskAccount'));_0xe9580f[_0x1489('0x8')](_0x1489('0xb6'),require(_0x1489('0xb7')));_0xe9580f[_0x1489('0x8')]('/api/integrations/freshdesk/fields',require(_0x1489('0xb8')));_0xe9580f['use']('/api/integrations/vtiger/accounts',require(_0x1489('0xb9')));_0xe9580f[_0x1489('0x8')](_0x1489('0xba'),require(_0x1489('0xbb')));_0xe9580f[_0x1489('0x8')]('/api/integrations/vtiger/fields',require(_0x1489('0xbc')));_0xe9580f[_0x1489('0x8')]('/api/integrations/servicenow/accounts',require(_0x1489('0xbd')));_0xe9580f[_0x1489('0x8')](_0x1489('0xbe'),require('./api/intServicenowConfiguration'));_0xe9580f[_0x1489('0x8')](_0x1489('0xbf'),require(_0x1489('0xc0')));_0xe9580f['use'](_0x1489('0xc1'),require(_0x1489('0xc2')));_0xe9580f[_0x1489('0x8')]('/api/integrations/dynamics365/configurations',require('./api/intDynamics365Configuration'));_0xe9580f[_0x1489('0x8')](_0x1489('0xc3'),require(_0x1489('0xc4')));_0xe9580f[_0x1489('0x8')](_0x1489('0xc5'),require(_0x1489('0xc6')));_0xe9580f['use'](_0x1489('0xc7'),require(_0x1489('0xc8')));_0xe9580f[_0x1489('0x8')](_0x1489('0xc9'),require(_0x1489('0xca')));_0xe9580f[_0x1489('0x8')]('/api/networks',require(_0x1489('0xcb')));_0xe9580f[_0x1489('0x8')](_0x1489('0xcc'),require(_0x1489('0xcd')));_0xe9580f[_0x1489('0x8')](_0x1489('0xce'),require(_0x1489('0xcf')));_0xe9580f[_0x1489('0x8')](_0x1489('0xd0'),require(_0x1489('0xd1')));_0xe9580f['use']('/api/jscripty/questions/reports',require(_0x1489('0xd2')));_0xe9580f['use'](_0x1489('0xd3'),require(_0x1489('0xd4')));_0xe9580f[_0x1489('0x8')](_0x1489('0xd5'),require(_0x1489('0xd6')));_0xe9580f['use'](_0x1489('0xd7'),require(_0x1489('0xd8')));_0xe9580f[_0x1489('0x8')](_0x1489('0xd9'),require('./api/squareReportDetail'));_0xe9580f[_0x1489('0x8')](_0x1489('0xda'),require(_0x1489('0xdb')));_0xe9580f[_0x1489('0x8')]('/api/settings',require(_0x1489('0xdc')));_0xe9580f[_0x1489('0x8')](_0x1489('0xdd'),require(_0x1489('0xde')));_0xe9580f[_0x1489('0x8')](_0x1489('0xdf'),require(_0x1489('0xe0')));_0xe9580f[_0x1489('0x8')](_0x1489('0xe1'),require('./api/squareRecording'));_0xe9580f[_0x1489('0x8')]('/api/square/messages',require(_0x1489('0xe2')));_0xe9580f[_0x1489('0x8')](_0x1489('0xe3'),require('./api/team'));_0xe9580f[_0x1489('0x8')](_0x1489('0xe4'),require('./api/license'));_0xe9580f[_0x1489('0x8')]('/api/campaigns',require(_0x1489('0xe5')));_0xe9580f[_0x1489('0x8')](_0x1489('0xe6'),require(_0x1489('0xe7')));_0xe9580f[_0x1489('0x8')](_0x1489('0xe8'),require(_0x1489('0xe9')));_0xe9580f[_0x1489('0x8')]('/api/plugins',require('./api/plugin'));_0xe9580f[_0x1489('0x8')]('/api/mail/reports/transfer',require(_0x1489('0xea')));_0xe9580f[_0x1489('0x8')](_0x1489('0xeb'),require(_0x1489('0xec')));_0xe9580f['use'](_0x1489('0xed'),require(_0x1489('0xee')));_0xe9580f[_0x1489('0x8')](_0x1489('0xef'),require(_0x1489('0xf0')));_0xe9580f[_0x1489('0x8')](_0x1489('0xf1'),require(_0x1489('0xf2')));_0xe9580f[_0x1489('0x8')](_0x1489('0xf3'),require('./api/cmList'));_0xe9580f['use']('/api/voice/prefixes',require('./api/voicePrefix'));_0xe9580f[_0x1489('0x8')](_0x1489('0xf4'),require(_0x1489('0xf5')));_0xe9580f['use'](_0x1489('0xf6'),require(_0x1489('0xf7')));_0xe9580f[_0x1489('0x8')](_0x1489('0xf8'),require('./api/userProfileResource'));_0xe9580f[_0x1489('0x8')](_0x1489('0xf9'),require(_0x1489('0xfa')));_0xe9580f[_0x1489('0x8')](_0x1489('0xfb'),require(_0x1489('0xfc')));_0xe9580f[_0x1489('0x8')]('/api/whatsapp/applications',require('./api/whatsappApplication'));_0xe9580f['use'](_0x1489('0xfd'),require(_0x1489('0xfe')));_0xe9580f[_0x1489('0x8')](_0x1489('0xff'),require(_0x1489('0x100')));_0xe9580f['use']('/api/whatsapp/reports/queue',require(_0x1489('0x101')));_0xe9580f[_0x1489('0x8')](_0x1489('0x102'),require(_0x1489('0x103')));_0xe9580f[_0x1489('0x8')](_0x1489('0x104'),require(_0x1489('0x105')));_0xe9580f['use'](_0x1489('0x106'),require(_0x1489('0x107')));_0xe9580f[_0x1489('0x8')](_0x1489('0x108'),require(_0x1489('0x109')));_0xe9580f[_0x1489('0x8')]('/api/auth/local',require(_0x1489('0x10a')));_0xe9580f[_0x1489('0x8')](_0x1489('0x10b'),require('./api/authGoogle'));_0xe9580f['use'](_0x1489('0x10c'),require(_0x1489('0x10d')));_0xe9580f[_0x1489('0x8')]('/api/rpc',require(_0x1489('0x10e')));_0xe9580f[_0x1489('0x8')](_0x1489('0x10f'),require(_0x1489('0x110')));_0xe9580f['use'](_0x1489('0x111'),require(_0x1489('0x112')));_0xe9580f['use']('/api/pm2',require(_0x1489('0x113')));_0xe9580f['use'](_0x1489('0x114'),require(_0x1489('0x115')));_0xe9580f[_0x1489('0x8')](_0x1489('0x116'),express[_0x1489('0x117')](path[_0x1489('0x118')](config['root'],_0x1489('0x116'))));_0xe9580f[_0x1489('0x8')](_0x1489('0x119'),express[_0x1489('0x117')](path[_0x1489('0x118')](config[_0x1489('0x11a')],_0x1489('0x119'))));_0xe9580f[_0x1489('0x8')](_0x1489('0x11b'),express[_0x1489('0x117')](path[_0x1489('0x118')](config[_0x1489('0x11a')],_0x1489('0x11b'))));_0xe9580f[_0x1489('0x8')]('/snippet',express[_0x1489('0x117')](path[_0x1489('0x118')](config['root'],_0x1489('0x11c'),_0x1489('0x11d'))));_0xe9580f[_0x1489('0x8')](_0x1489('0x11e'),express[_0x1489('0x117')](path[_0x1489('0x118')](config['root'],_0x1489('0x11f'))));_0xe9580f[_0x1489('0x120')]('/:url(api|auth|components|app|bower_components|assets)/*')[_0x1489('0x121')](errors[0x194]);_0xe9580f[_0x1489('0x120')]('/*')[_0x1489('0x121')](function(_0x54e3c3,_0x498e01){_0x498e01[_0x1489('0x122')](path[_0x1489('0x123')](_0xe9580f[_0x1489('0x121')](_0x1489('0x124'))+'/index.html'));});};var sensitiveFields=[_0x1489('0x125'),_0x1489('0x126'),_0x1489('0x127'),'apiKey',_0x1489('0x128'),_0x1489('0x129'),_0x1489('0x12a'),'phone',_0x1489('0x12b'),_0x1489('0x12c'),_0x1489('0x12d'),'clientId',_0x1489('0x12e'),'securityToken',_0x1489('0x12f'),_0x1489('0x130'),_0x1489('0x131'),_0x1489('0x132'),_0x1489('0x133'),_0x1489('0x134'),_0x1489('0x135'),_0x1489('0x136'),_0x1489('0x137'),_0x1489('0x138'),_0x1489('0x139'),_0x1489('0x13a'),'calleridnum',_0x1489('0x13b'),_0x1489('0x13c'),_0x1489('0x13d'),_0x1489('0x13e'),'accesskeyid',_0x1489('0x13f'),_0x1489('0x140'),_0x1489('0x13'),_0x1489('0x141'),_0x1489('0x142'),'localstationid',_0x1489('0x143'),'secret','registry','oldPassword'];function maskSensitiveData(_0x5ca407){var _0x2b1774=/(?!^)[\s\S](?!$)/g;if(!_[_0x1489('0x144')](_0x5ca407))return;for(var _0x4c4507 in _0x5ca407){if(_[_0x1489('0x145')](_0x5ca407[_0x4c4507])){for(var _0x335736=0x0;_0x335736<_0x5ca407[_0x4c4507][_0x1489('0x146')];_0x335736++){maskSensitiveData(_0x5ca407[_0x4c4507][_0x335736]);}}else if(_[_0x1489('0x144')](_0x5ca407[_0x4c4507])){maskSensitiveData(_0x5ca407[_0x4c4507]);}else if(_[_0x1489('0x147')](_0x5ca407[_0x4c4507])){_0x5ca407[_0x4c4507]=_0x5ca407[_0x4c4507][_0x1489('0x148')](/{{{/g,_0x1489('0x149'))[_0x1489('0x148')](/}}}/g,_0x1489('0x14a'))[_0x1489('0x148')](/{{/g,'@{')[_0x1489('0x148')](/}}/g,'}@');if(_[_0x1489('0x14b')](sensitiveFields,_0x4c4507)){_0x5ca407[_0x4c4507]=_0x5ca407[_0x4c4507][_0x1489('0x148')](_0x2b1774,'*');}}}} \ No newline at end of file +var _0x555b=['/demo','snippet','3.0.0','/server/files/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','get','resolve','appPath','/index.html','username','password','newPassword','firstName','lastName','street','phone','mobile','fax','clientId','securityToken','token','accessToken','authToken','consumerKey','consumerSecret','membername','calleridname','calleridnum','exten','vidaooApiKey','clientEmail','privateKey','accesskeyid','key','pass','accountSid','localstationid','dsn','secret','oldPassword','isArray','isPlainObject','isString','replace','@@{','}@@','includes','lodash','path','express','util','./errors','./config/environment','api','./config/logger','auth','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','isEmpty','body','\x20body=%s','format','method','headers','x-forwarded-for','connection','url','statusCode','responseTime','user','inspect','use','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','other','agent_id','agent_name','/api/users','./api/user','/api/voice/chanspy','/api/voice/contexts','./api/voiceContext','/api/voice/extensions','./api/voiceExtension','/api/voice/mohs','./api/voiceMusicOnHold','/api/voice/queues','./api/voiceQueue','./api/voiceRecording','/api/screen/recordings','./api/screenRecording','./api/voiceMail','./api/voiceMailMessage','/api/voice/dials/reports','./api/voiceDialReport','/api/voice/agents/reports','./api/voiceAgentReport','/api/voice/queues/reports','./api/voiceQueueReport','/api/members/reports','./api/memberReport','/api/trunks','./api/trunk','./api/voiceTransferReport','/api/mail/out_servers','./api/mailServerOut','/api/mail/accounts','/api/mail/queues','./api/mailQueue','/api/mail/substatuses','./api/mailSubstatus','./api/mailInteraction','./api/mailMessage','/api/mail/applications','/api/mail/reports/queue','./api/mailQueueReport','/api/dashboards','/api/dashboards/items','/api/fax/accounts','./api/faxAccount','/api/fax/applications','/api/fax/interactions','./api/faxInteraction','/api/fax/messages','./api/faxMessage','/api/fax/queues','./api/faxQueue','./api/faxQueueReport','/api/sms/accounts','./api/smsAccount','/api/sms/applications','./api/smsApplication','/api/sms/interactions','./api/smsInteraction','/api/sms/messages','/api/sms/queues','./api/smsQueue','/api/openchannel/accounts','./api/openchannelAccount','./api/openchannelApplication','/api/openchannel/interactions','./api/openchannelInteraction','/api/openchannel/messages','./api/openchannelQueue','./api/openchannelQueueReport','/api/chat/applications','./api/chatApplication','/api/chat/interactions','./api/chatInteraction','./api/chatMessage','./api/chatOfflineMessage','/api/chat/queues','./api/chatQueue','/api/chat/groups','./api/chatGroup','/api/chat/proactive_actions','./api/chatProactiveAction','./api/cmCompany','./api/cmContact','/api/cm/hopper','./api/cmHopper','/api/cm/hopper_black','./api/cmHopperBlack','/api/cm/hopper_final','./api/cmHopperFinal','/api/cm/hopper_history','/api/cm/custom_fields','./api/cmCustomField','/api/actions','./api/action','/api/automations','./api/automation','/api/canned_answers','/api/dispositions','./api/disposition','/api/conditions','./api/condition','/api/intervals','/api/pauses','/api/cdr','./api/cdr','/api/schedules','/api/sounds','./api/sound','./api/template','/api/triggers','./api/trigger','/api/integrations','./api/integration','/api/integrations/reports','./api/integrationReport','/api/analytics/custom_reports','./api/analyticCustomReport','/api/analytics/default_reports','./api/analyticDefaultReport','./api/analyticExtractedReport','./api/analyticMetric','/api/analytics/field_reports','./api/analyticFieldReport','/api/analytics/tree_reports','./api/analyticTreeReport','/api/integrations/salesforce/accounts','./api/intSalesforceConfiguration','/api/integrations/salesforce/fields','./api/intSalesforceField','/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','/api/integrations/sugarcrm/configurations','./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','/api/integrations/desk/accounts','./api/intDeskAccount','/api/integrations/desk/configurations','./api/intDeskConfiguration','/api/integrations/desk/fields','/api/integrations/zoho/accounts','./api/intZohoAccount','./api/intZohoConfiguration','/api/integrations/zendesk/accounts','/api/integrations/zendesk/configurations','/api/integrations/zendesk/fields','./api/intZendeskField','/api/integrations/freshdesk/accounts','./api/intFreshdeskAccount','/api/integrations/freshdesk/configurations','/api/integrations/freshdesk/fields','./api/intFreshdeskField','/api/integrations/vtiger/accounts','./api/intVtigerAccount','/api/integrations/vtiger/configurations','/api/integrations/vtiger/fields','./api/intVtigerField','/api/integrations/servicenow/accounts','/api/integrations/servicenow/configurations','/api/integrations/servicenow/fields','./api/intServicenowField','/api/integrations/dynamics365/configurations','./api/intDynamics365Configuration','./api/intDynamics365Field','/api/integrations/freshsales/accounts','./api/intFreshsalesAccount','/api/integrations/freshsales/configurations','./api/intFreshsalesConfiguration','/api/integrations/freshsales/fields','./api/intFreshsalesField','/api/networks','./api/network','/api/chat/reports/queue','./api/chatQueueReport','/api/jscripty/answers/reports','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','./api/jscriptySessionReport','/api/sms/reports/queue','./api/smsQueueReport','/api/square/reports','./api/squareReport','./api/squareReportDetail','/api/jscripty/projects','/api/settings','./api/setting','/api/square/odbc','./api/squareOdbc','/api/square/projects','./api/squareProject','./api/squareRecording','/api/square/messages','./api/squareMessage','/api/teams','./api/team','/api/campaigns','./api/campaign','/api/migrations','./api/migration','/api/attachments','./api/plugin','/api/mail/reports/transfer','./api/mailTransferReport','./api/chatTransferReport','/api/fax/reports/transfer','./api/openchannelTransferReport','./api/smsTransferReport','/api/cm/lists','/api/voice/prefixes','./api/voicePrefix','/api/userProfiles','./api/userProfile','/api/userProfile/sections','./api/userProfileSection','/api/userNotifications','/api/whatsapp/accounts','/api/whatsapp/applications','./api/whatsappApplication','./api/whatsappInteraction','/api/whatsapp/messages','./api/whatsappMessage','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','/api/whatsapp/queues','./api/whatsappQueue','/api/cloudProviders','/api/realtime','./api/realtime','/api/auth/local','./api/authLocal','/api/auth/google','/api/jira','./api/jira','/api/rpc','./api/rpc','./api/version','/api/system','./api/system','/api/pm2','/api/webbar','./api/webbar','/apidoc','static','/www','join','root'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x555b,0x174));var _0xb555=function(_0x4bc2f8,_0x1eff7d){_0x4bc2f8=_0x4bc2f8-0x0;var _0xdc2b97=_0x555b[_0x4bc2f8];return _0xdc2b97;};'use strict';var _=require(_0xb555('0x0'));var path=require(_0xb555('0x1'));var express=require(_0xb555('0x2'));var ewinston=require('express-winston');var util=require(_0xb555('0x3'));var errors=require(_0xb555('0x4'));var config=require(_0xb555('0x5'));var logger=require('./config/logger')(_0xb555('0x6'));var authLogger=require(_0xb555('0x7'))(_0xb555('0x8'));exports['default']=function(_0xcd6a1d){_0xcd6a1d['use'](ewinston[_0xb555('0x9')]({'winstonInstance':logger,'meta':![],'statusLevels':!![],'msg':function(_0x5aec7c,_0x459208){var _0x37bd00=_0xb555('0xa');if(!_[_0xb555('0xb')](_0x5aec7c[_0xb555('0xc')])){_0x37bd00+=_0xb555('0xd');var _0x2a486c=_0x5aec7c[_0xb555('0xc')];maskSensitiveData(_0x2a486c);}return util[_0xb555('0xe')](_0x37bd00,_0x5aec7c[_0xb555('0xf')],_0x5aec7c[_0xb555('0x10')][_0xb555('0x11')]?_0x5aec7c[_0xb555('0x10')][_0xb555('0x11')]:_0x5aec7c[_0xb555('0x12')]['remoteAddress']||_0x5aec7c['ip'],_0x5aec7c[_0xb555('0x13')],_0x459208[_0xb555('0x14')],_0x459208[_0xb555('0x15')],_0x5aec7c[_0xb555('0x16')]?_0x5aec7c[_0xb555('0x16')]['id']:null,_0x5aec7c[_0xb555('0x16')]?_0x5aec7c['user']['name']:null,_0x5aec7c[_0xb555('0x16')]?_0x5aec7c[_0xb555('0x16')]['role']:null,_0x2a486c?util[_0xb555('0x17')](_0x2a486c,![],null):'');}}));_0xcd6a1d[_0xb555('0x18')](ewinston[_0xb555('0x9')]({'winstonInstance':authLogger,'meta':![],'statusLevels':!![],'msg':function(_0x1dc76c,_0x549f25){var _0x53649e=_0xb555('0x19');if(_0x1dc76c[_0xb555('0xc')]&&_0x1dc76c[_0xb555('0xc')]['device']&&_0x1dc76c[_0xb555('0xc')]['agent_id']){_0x53649e=_0xb555('0x1a');}return util[_0xb555('0xe')](_0x53649e,_0x1dc76c[_0xb555('0xf')],_0x1dc76c[_0xb555('0x10')][_0xb555('0x11')]?_0x1dc76c[_0xb555('0x10')][_0xb555('0x11')]:_0x1dc76c['connection']['remoteAddress']||_0x1dc76c['ip'],_0x1dc76c[_0xb555('0x13')],_0x549f25[_0xb555('0x14')],_0x549f25[_0xb555('0x15')],_0x1dc76c[_0xb555('0x16')]?_0x1dc76c[_0xb555('0x16')]['id']:null,_0x1dc76c[_0xb555('0x16')]?_0x1dc76c[_0xb555('0x16')]['name']:null,_0x1dc76c[_0xb555('0x16')]?_0x1dc76c[_0xb555('0x16')]['role']:null,_0x1dc76c[_0xb555('0xc')]&&_0x1dc76c[_0xb555('0xc')]['device']?_0x1dc76c[_0xb555('0xc')]['device']:_0xb555('0x1b'),_0x1dc76c[_0xb555('0xc')]&&_0x1dc76c[_0xb555('0xc')]['agent_id']?_0x1dc76c[_0xb555('0xc')][_0xb555('0x1c')]:'',_0x1dc76c['body']&&_0x1dc76c['body'][_0xb555('0x1d')]?_0x1dc76c['body'][_0xb555('0x1d')]:'');},'ignoreRoute':function(_0x249900){var _0xa014f9=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0xa014f9['test'](_0x249900[_0xb555('0x13')]);}}));_0xcd6a1d['use'](_0xb555('0x1e'),require(_0xb555('0x1f')));_0xcd6a1d[_0xb555('0x18')](_0xb555('0x20'),require('./api/voiceChanSpy'));_0xcd6a1d[_0xb555('0x18')](_0xb555('0x21'),require(_0xb555('0x22')));_0xcd6a1d[_0xb555('0x18')](_0xb555('0x23'),require(_0xb555('0x24')));_0xcd6a1d[_0xb555('0x18')](_0xb555('0x25'),require(_0xb555('0x26')));_0xcd6a1d[_0xb555('0x18')](_0xb555('0x27'),require(_0xb555('0x28')));_0xcd6a1d['use']('/api/voice/recordings',require(_0xb555('0x29')));_0xcd6a1d[_0xb555('0x18')](_0xb555('0x2a'),require(_0xb555('0x2b')));_0xcd6a1d[_0xb555('0x18')]('/api/voice/mails',require(_0xb555('0x2c')));_0xcd6a1d[_0xb555('0x18')]('/api/voice/mails/messages',require(_0xb555('0x2d')));_0xcd6a1d[_0xb555('0x18')]('/api/voice/calls/reports',require('./api/voiceCallReport'));_0xcd6a1d[_0xb555('0x18')](_0xb555('0x2e'),require(_0xb555('0x2f')));_0xcd6a1d[_0xb555('0x18')](_0xb555('0x30'),require(_0xb555('0x31')));_0xcd6a1d['use'](_0xb555('0x32'),require(_0xb555('0x33')));_0xcd6a1d[_0xb555('0x18')](_0xb555('0x34'),require(_0xb555('0x35')));_0xcd6a1d[_0xb555('0x18')](_0xb555('0x36'),require(_0xb555('0x37')));_0xcd6a1d[_0xb555('0x18')]('/api/voice/transfers/reports',require(_0xb555('0x38')));_0xcd6a1d[_0xb555('0x18')](_0xb555('0x39'),require(_0xb555('0x3a')));_0xcd6a1d['use'](_0xb555('0x3b'),require('./api/mailAccount'));_0xcd6a1d[_0xb555('0x18')](_0xb555('0x3c'),require(_0xb555('0x3d')));_0xcd6a1d[_0xb555('0x18')](_0xb555('0x3e'),require(_0xb555('0x3f')));_0xcd6a1d['use']('/api/mail/interactions',require(_0xb555('0x40')));_0xcd6a1d[_0xb555('0x18')]('/api/mail/messages',require(_0xb555('0x41')));_0xcd6a1d[_0xb555('0x18')](_0xb555('0x42'),require('./api/mailApplication'));_0xcd6a1d[_0xb555('0x18')](_0xb555('0x43'),require(_0xb555('0x44')));_0xcd6a1d[_0xb555('0x18')](_0xb555('0x45'),require('./api/dashboard'));_0xcd6a1d[_0xb555('0x18')](_0xb555('0x46'),require('./api/dashboardItem'));_0xcd6a1d[_0xb555('0x18')](_0xb555('0x47'),require(_0xb555('0x48')));_0xcd6a1d[_0xb555('0x18')](_0xb555('0x49'),require('./api/faxApplication'));_0xcd6a1d[_0xb555('0x18')](_0xb555('0x4a'),require(_0xb555('0x4b')));_0xcd6a1d[_0xb555('0x18')](_0xb555('0x4c'),require(_0xb555('0x4d')));_0xcd6a1d[_0xb555('0x18')](_0xb555('0x4e'),require(_0xb555('0x4f')));_0xcd6a1d['use']('/api/fax/reports/queue',require(_0xb555('0x50')));_0xcd6a1d['use'](_0xb555('0x51'),require(_0xb555('0x52')));_0xcd6a1d[_0xb555('0x18')](_0xb555('0x53'),require(_0xb555('0x54')));_0xcd6a1d[_0xb555('0x18')](_0xb555('0x55'),require(_0xb555('0x56')));_0xcd6a1d['use'](_0xb555('0x57'),require('./api/smsMessage'));_0xcd6a1d['use'](_0xb555('0x58'),require(_0xb555('0x59')));_0xcd6a1d['use'](_0xb555('0x5a'),require(_0xb555('0x5b')));_0xcd6a1d[_0xb555('0x18')]('/api/openchannel/applications',require(_0xb555('0x5c')));_0xcd6a1d[_0xb555('0x18')](_0xb555('0x5d'),require(_0xb555('0x5e')));_0xcd6a1d[_0xb555('0x18')](_0xb555('0x5f'),require('./api/openchannelMessage'));_0xcd6a1d[_0xb555('0x18')]('/api/openchannel/queues',require(_0xb555('0x60')));_0xcd6a1d[_0xb555('0x18')]('/api/chat/websites',require('./api/chatWebsite'));_0xcd6a1d[_0xb555('0x18')]('/api/openchannel/reports/queue',require(_0xb555('0x61')));_0xcd6a1d[_0xb555('0x18')](_0xb555('0x62'),require(_0xb555('0x63')));_0xcd6a1d[_0xb555('0x18')](_0xb555('0x64'),require(_0xb555('0x65')));_0xcd6a1d[_0xb555('0x18')]('/api/chat/messages',require(_0xb555('0x66')));_0xcd6a1d['use']('/api/chat/offline_messages',require(_0xb555('0x67')));_0xcd6a1d[_0xb555('0x18')](_0xb555('0x68'),require(_0xb555('0x69')));_0xcd6a1d[_0xb555('0x18')](_0xb555('0x6a'),require(_0xb555('0x6b')));_0xcd6a1d[_0xb555('0x18')](_0xb555('0x6c'),require(_0xb555('0x6d')));_0xcd6a1d[_0xb555('0x18')]('/api/cm/companies',require(_0xb555('0x6e')));_0xcd6a1d['use']('/api/cm/contacts',require(_0xb555('0x6f')));_0xcd6a1d[_0xb555('0x18')](_0xb555('0x70'),require(_0xb555('0x71')));_0xcd6a1d[_0xb555('0x18')](_0xb555('0x72'),require(_0xb555('0x73')));_0xcd6a1d[_0xb555('0x18')](_0xb555('0x74'),require(_0xb555('0x75')));_0xcd6a1d[_0xb555('0x18')](_0xb555('0x76'),require('./api/cmHopperHistory'));_0xcd6a1d['use'](_0xb555('0x77'),require(_0xb555('0x78')));_0xcd6a1d[_0xb555('0x18')](_0xb555('0x79'),require(_0xb555('0x7a')));_0xcd6a1d[_0xb555('0x18')](_0xb555('0x7b'),require(_0xb555('0x7c')));_0xcd6a1d['use'](_0xb555('0x7d'),require('./api/cannedAnswer'));_0xcd6a1d[_0xb555('0x18')](_0xb555('0x7e'),require(_0xb555('0x7f')));_0xcd6a1d[_0xb555('0x18')](_0xb555('0x80'),require(_0xb555('0x81')));_0xcd6a1d[_0xb555('0x18')](_0xb555('0x82'),require('./api/interval'));_0xcd6a1d[_0xb555('0x18')](_0xb555('0x83'),require('./api/pause'));_0xcd6a1d['use'](_0xb555('0x84'),require(_0xb555('0x85')));_0xcd6a1d['use']('/api/voiceQueuesLog',require('./api/voiceQueuesLog'));_0xcd6a1d[_0xb555('0x18')](_0xb555('0x86'),require('./api/schedule'));_0xcd6a1d['use'](_0xb555('0x87'),require(_0xb555('0x88')));_0xcd6a1d[_0xb555('0x18')]('/api/tags',require('./api/tag'));_0xcd6a1d[_0xb555('0x18')]('/api/templates',require(_0xb555('0x89')));_0xcd6a1d[_0xb555('0x18')](_0xb555('0x8a'),require(_0xb555('0x8b')));_0xcd6a1d['use']('/api/variables',require('./api/variable'));_0xcd6a1d[_0xb555('0x18')](_0xb555('0x8c'),require(_0xb555('0x8d')));_0xcd6a1d['use'](_0xb555('0x8e'),require(_0xb555('0x8f')));_0xcd6a1d[_0xb555('0x18')](_0xb555('0x90'),require(_0xb555('0x91')));_0xcd6a1d[_0xb555('0x18')](_0xb555('0x92'),require(_0xb555('0x93')));_0xcd6a1d[_0xb555('0x18')]('/api/analytics/extracted_reports',require(_0xb555('0x94')));_0xcd6a1d['use']('/api/analytics/metrics',require(_0xb555('0x95')));_0xcd6a1d[_0xb555('0x18')](_0xb555('0x96'),require(_0xb555('0x97')));_0xcd6a1d[_0xb555('0x18')](_0xb555('0x98'),require(_0xb555('0x99')));_0xcd6a1d[_0xb555('0x18')](_0xb555('0x9a'),require('./api/intSalesforceAccount'));_0xcd6a1d[_0xb555('0x18')]('/api/integrations/salesforce/configurations',require(_0xb555('0x9b')));_0xcd6a1d['use'](_0xb555('0x9c'),require(_0xb555('0x9d')));_0xcd6a1d[_0xb555('0x18')](_0xb555('0x9e'),require(_0xb555('0x9f')));_0xcd6a1d['use'](_0xb555('0xa0'),require(_0xb555('0xa1')));_0xcd6a1d[_0xb555('0x18')](_0xb555('0xa2'),require('./api/intSugarcrmField'));_0xcd6a1d[_0xb555('0x18')](_0xb555('0xa3'),require(_0xb555('0xa4')));_0xcd6a1d[_0xb555('0x18')](_0xb555('0xa5'),require(_0xb555('0xa6')));_0xcd6a1d[_0xb555('0x18')](_0xb555('0xa7'),require('./api/intDeskField'));_0xcd6a1d[_0xb555('0x18')](_0xb555('0xa8'),require(_0xb555('0xa9')));_0xcd6a1d[_0xb555('0x18')]('/api/integrations/zoho/configurations',require(_0xb555('0xaa')));_0xcd6a1d['use']('/api/integrations/zoho/fields',require('./api/intZohoField'));_0xcd6a1d[_0xb555('0x18')](_0xb555('0xab'),require('./api/intZendeskAccount'));_0xcd6a1d[_0xb555('0x18')](_0xb555('0xac'),require('./api/intZendeskConfiguration'));_0xcd6a1d[_0xb555('0x18')](_0xb555('0xad'),require(_0xb555('0xae')));_0xcd6a1d[_0xb555('0x18')](_0xb555('0xaf'),require(_0xb555('0xb0')));_0xcd6a1d['use'](_0xb555('0xb1'),require('./api/intFreshdeskConfiguration'));_0xcd6a1d[_0xb555('0x18')](_0xb555('0xb2'),require(_0xb555('0xb3')));_0xcd6a1d[_0xb555('0x18')](_0xb555('0xb4'),require(_0xb555('0xb5')));_0xcd6a1d[_0xb555('0x18')](_0xb555('0xb6'),require('./api/intVtigerConfiguration'));_0xcd6a1d[_0xb555('0x18')](_0xb555('0xb7'),require(_0xb555('0xb8')));_0xcd6a1d[_0xb555('0x18')](_0xb555('0xb9'),require('./api/intServicenowAccount'));_0xcd6a1d['use'](_0xb555('0xba'),require('./api/intServicenowConfiguration'));_0xcd6a1d[_0xb555('0x18')](_0xb555('0xbb'),require(_0xb555('0xbc')));_0xcd6a1d['use']('/api/integrations/dynamics365/accounts',require('./api/intDynamics365Account'));_0xcd6a1d[_0xb555('0x18')](_0xb555('0xbd'),require(_0xb555('0xbe')));_0xcd6a1d[_0xb555('0x18')]('/api/integrations/dynamics365/fields',require(_0xb555('0xbf')));_0xcd6a1d['use'](_0xb555('0xc0'),require(_0xb555('0xc1')));_0xcd6a1d[_0xb555('0x18')](_0xb555('0xc2'),require(_0xb555('0xc3')));_0xcd6a1d[_0xb555('0x18')](_0xb555('0xc4'),require(_0xb555('0xc5')));_0xcd6a1d[_0xb555('0x18')](_0xb555('0xc6'),require(_0xb555('0xc7')));_0xcd6a1d['use'](_0xb555('0xc8'),require(_0xb555('0xc9')));_0xcd6a1d[_0xb555('0x18')]('/api/chat/internal/messages',require('./api/chatInternalMessage'));_0xcd6a1d[_0xb555('0x18')](_0xb555('0xca'),require('./api/jscriptyAnswerReport'));_0xcd6a1d[_0xb555('0x18')](_0xb555('0xcb'),require(_0xb555('0xcc')));_0xcd6a1d['use'](_0xb555('0xcd'),require(_0xb555('0xce')));_0xcd6a1d[_0xb555('0x18')](_0xb555('0xcf'),require(_0xb555('0xd0')));_0xcd6a1d[_0xb555('0x18')](_0xb555('0xd1'),require(_0xb555('0xd2')));_0xcd6a1d[_0xb555('0x18')]('/api/square/details/reports',require(_0xb555('0xd3')));_0xcd6a1d[_0xb555('0x18')](_0xb555('0xd4'),require('./api/jscriptyProject'));_0xcd6a1d[_0xb555('0x18')](_0xb555('0xd5'),require(_0xb555('0xd6')));_0xcd6a1d[_0xb555('0x18')](_0xb555('0xd7'),require(_0xb555('0xd8')));_0xcd6a1d[_0xb555('0x18')](_0xb555('0xd9'),require(_0xb555('0xda')));_0xcd6a1d[_0xb555('0x18')]('/api/square/recordings',require(_0xb555('0xdb')));_0xcd6a1d[_0xb555('0x18')](_0xb555('0xdc'),require(_0xb555('0xdd')));_0xcd6a1d[_0xb555('0x18')](_0xb555('0xde'),require(_0xb555('0xdf')));_0xcd6a1d[_0xb555('0x18')]('/api/license',require('./api/license'));_0xcd6a1d[_0xb555('0x18')](_0xb555('0xe0'),require(_0xb555('0xe1')));_0xcd6a1d[_0xb555('0x18')](_0xb555('0xe2'),require(_0xb555('0xe3')));_0xcd6a1d['use'](_0xb555('0xe4'),require('./api/attachment'));_0xcd6a1d[_0xb555('0x18')]('/api/plugins',require(_0xb555('0xe5')));_0xcd6a1d[_0xb555('0x18')](_0xb555('0xe6'),require(_0xb555('0xe7')));_0xcd6a1d['use']('/api/chat/reports/transfer',require(_0xb555('0xe8')));_0xcd6a1d['use'](_0xb555('0xe9'),require('./api/faxTransferReport'));_0xcd6a1d['use']('/api/openchannel/reports/transfer',require(_0xb555('0xea')));_0xcd6a1d[_0xb555('0x18')]('/api/sms/reports/transfer',require(_0xb555('0xeb')));_0xcd6a1d['use'](_0xb555('0xec'),require('./api/cmList'));_0xcd6a1d[_0xb555('0x18')](_0xb555('0xed'),require(_0xb555('0xee')));_0xcd6a1d['use'](_0xb555('0xef'),require(_0xb555('0xf0')));_0xcd6a1d[_0xb555('0x18')](_0xb555('0xf1'),require(_0xb555('0xf2')));_0xcd6a1d['use']('/api/userProfile/resources',require('./api/userProfileResource'));_0xcd6a1d[_0xb555('0x18')](_0xb555('0xf3'),require('./api/userNotification'));_0xcd6a1d[_0xb555('0x18')](_0xb555('0xf4'),require('./api/whatsappAccount'));_0xcd6a1d[_0xb555('0x18')](_0xb555('0xf5'),require(_0xb555('0xf6')));_0xcd6a1d[_0xb555('0x18')]('/api/whatsapp/interactions',require(_0xb555('0xf7')));_0xcd6a1d['use'](_0xb555('0xf8'),require(_0xb555('0xf9')));_0xcd6a1d[_0xb555('0x18')]('/api/whatsapp/reports/queue',require(_0xb555('0xfa')));_0xcd6a1d['use'](_0xb555('0xfb'),require(_0xb555('0xfc')));_0xcd6a1d[_0xb555('0x18')](_0xb555('0xfd'),require(_0xb555('0xfe')));_0xcd6a1d[_0xb555('0x18')](_0xb555('0xff'),require('./api/cloudProvider'));_0xcd6a1d['use'](_0xb555('0x100'),require(_0xb555('0x101')));_0xcd6a1d[_0xb555('0x18')](_0xb555('0x102'),require(_0xb555('0x103')));_0xcd6a1d[_0xb555('0x18')](_0xb555('0x104'),require('./api/authGoogle'));_0xcd6a1d[_0xb555('0x18')](_0xb555('0x105'),require(_0xb555('0x106')));_0xcd6a1d['use'](_0xb555('0x107'),require(_0xb555('0x108')));_0xcd6a1d[_0xb555('0x18')]('/api/version',require(_0xb555('0x109')));_0xcd6a1d[_0xb555('0x18')](_0xb555('0x10a'),require(_0xb555('0x10b')));_0xcd6a1d[_0xb555('0x18')](_0xb555('0x10c'),require('./api/pm2'));_0xcd6a1d[_0xb555('0x18')](_0xb555('0x10d'),require(_0xb555('0x10e')));_0xcd6a1d[_0xb555('0x18')](_0xb555('0x10f'),express[_0xb555('0x110')](path['join'](config['root'],_0xb555('0x10f'))));_0xcd6a1d[_0xb555('0x18')](_0xb555('0x111'),express[_0xb555('0x110')](path[_0xb555('0x112')](config[_0xb555('0x113')],_0xb555('0x111'))));_0xcd6a1d[_0xb555('0x18')](_0xb555('0x114'),express['static'](path[_0xb555('0x112')](config[_0xb555('0x113')],_0xb555('0x114'))));_0xcd6a1d[_0xb555('0x18')]('/snippet',express[_0xb555('0x110')](path['join'](config[_0xb555('0x113')],_0xb555('0x115'),_0xb555('0x116'))));_0xcd6a1d[_0xb555('0x18')]('/plugins',express[_0xb555('0x110')](path[_0xb555('0x112')](config[_0xb555('0x113')],_0xb555('0x117'))));_0xcd6a1d[_0xb555('0x118')](_0xb555('0x119'))[_0xb555('0x11a')](errors[0x194]);_0xcd6a1d[_0xb555('0x118')]('/*')[_0xb555('0x11a')](function(_0x422b88,_0x6b98d2){_0x6b98d2['sendFile'](path[_0xb555('0x11b')](_0xcd6a1d['get'](_0xb555('0x11c'))+_0xb555('0x11d')));});};var sensitiveFields=[_0xb555('0x11e'),_0xb555('0x11f'),_0xb555('0x120'),'apiKey',_0xb555('0x121'),_0xb555('0x122'),_0xb555('0x123'),_0xb555('0x124'),_0xb555('0x125'),_0xb555('0x126'),'email',_0xb555('0x127'),'clientSecret',_0xb555('0x128'),'code','accessKey','tenantId',_0xb555('0x129'),'channelSecret',_0xb555('0x12a'),'accessTokenSecret',_0xb555('0x12b'),_0xb555('0x12c'),_0xb555('0x12d'),_0xb555('0x12e'),_0xb555('0x12f'),_0xb555('0x130'),_0xb555('0x131'),_0xb555('0x132'),_0xb555('0x133'),_0xb555('0x134'),_0xb555('0x135'),'secretaccesskey',_0xb555('0x136'),_0xb555('0x16'),_0xb555('0x137'),_0xb555('0x138'),_0xb555('0x139'),_0xb555('0x13a'),_0xb555('0x13b'),'registry',_0xb555('0x13c')];function maskSensitiveData(_0x1cb173){var _0x34429b=/(?!^)[\s\S](?!$)/g;if(!_['isPlainObject'](_0x1cb173))return;for(var _0x2c82d5 in _0x1cb173){if(_[_0xb555('0x13d')](_0x1cb173[_0x2c82d5])){for(var _0x305db5=0x0;_0x305db5<_0x1cb173[_0x2c82d5]['length'];_0x305db5++){maskSensitiveData(_0x1cb173[_0x2c82d5][_0x305db5]);}}else if(_[_0xb555('0x13e')](_0x1cb173[_0x2c82d5])){maskSensitiveData(_0x1cb173[_0x2c82d5]);}else if(_[_0xb555('0x13f')](_0x1cb173[_0x2c82d5])){_0x1cb173[_0x2c82d5]=_0x1cb173[_0x2c82d5][_0xb555('0x140')](/{{{/g,_0xb555('0x141'))['replace'](/}}}/g,_0xb555('0x142'))[_0xb555('0x140')](/{{/g,'@{')['replace'](/}}/g,'}@');if(_[_0xb555('0x143')](sensitiveFields,_0x2c82d5)){_0x1cb173[_0x2c82d5]=_0x1cb173[_0x2c82d5][_0xb555('0x140')](_0x34429b,'*');}}}} \ No newline at end of file diff --git a/server/rpc/index.js b/server/rpc/index.js index 955e8a8..a478559 100644 --- a/server/rpc/index.js +++ b/server/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9a8a=['../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/squareProject/squareProject.rpc','../api/squareMessage/squareMessage.rpc','../api/campaign/campaign.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','../api/whatsappQueue/whatsappQueue.rpc','server','http','rpc','port','localhost','error','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','default','RPC\x20listening\x20on\x20','jayson/promise','lodash','../config/environment','merge','../api/voiceExtension/voiceExtension.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/memberReport/memberReport.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/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxApplication/faxApplication.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueue/faxQueue.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsAccount/smsAccount.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsMessage/smsMessage.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatQueue/chatQueue.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/interval/interval.rpc','../api/pause/pause.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/intDynamics365Account/intDynamics365Account.rpc'];(function(_0x49b207,_0x408ade){var _0x2dc8fa=function(_0x150975){while(--_0x150975){_0x49b207['push'](_0x49b207['shift']());}};_0x2dc8fa(++_0x408ade);}(_0x9a8a,0x143));var _0xa9a8=function(_0x2df3da,_0xa60cd2){_0x2df3da=_0x2df3da-0x0;var _0x5375d9=_0x9a8a[_0x2df3da];return _0x5375d9;};'use strict';var jayson=require(_0xa9a8('0x0'));var BPromise=require('bluebird');var _=require(_0xa9a8('0x1'));var config=require(_0xa9a8('0x2'));exports['listen']=function(){return new BPromise(function(_0x144b52,_0x39eaea){var _0x24ac23={};_0x24ac23=_[_0xa9a8('0x3')](_0x24ac23,require('../api/user/user.rpc'));_0x24ac23=_[_0xa9a8('0x3')](_0x24ac23,require(_0xa9a8('0x4')));_0x24ac23=_[_0xa9a8('0x3')](_0x24ac23,require('../api/voiceQueue/voiceQueue.rpc'));_0x24ac23=_['merge'](_0x24ac23,require(_0xa9a8('0x5')));_0x24ac23=_[_0xa9a8('0x3')](_0x24ac23,require('../api/voiceCallReport/voiceCallReport.rpc'));_0x24ac23=_[_0xa9a8('0x3')](_0x24ac23,require(_0xa9a8('0x6')));_0x24ac23=_[_0xa9a8('0x3')](_0x24ac23,require(_0xa9a8('0x7')));_0x24ac23=_[_0xa9a8('0x3')](_0x24ac23,require(_0xa9a8('0x8')));_0x24ac23=_[_0xa9a8('0x3')](_0x24ac23,require(_0xa9a8('0x9')));_0x24ac23=_[_0xa9a8('0x3')](_0x24ac23,require('../api/trunk/trunk.rpc'));_0x24ac23=_[_0xa9a8('0x3')](_0x24ac23,require(_0xa9a8('0xa')));_0x24ac23=_[_0xa9a8('0x3')](_0x24ac23,require(_0xa9a8('0xb')));_0x24ac23=_[_0xa9a8('0x3')](_0x24ac23,require(_0xa9a8('0xc')));_0x24ac23=_[_0xa9a8('0x3')](_0x24ac23,require(_0xa9a8('0xd')));_0x24ac23=_['merge'](_0x24ac23,require(_0xa9a8('0xe')));_0x24ac23=_[_0xa9a8('0x3')](_0x24ac23,require(_0xa9a8('0xf')));_0x24ac23=_[_0xa9a8('0x3')](_0x24ac23,require(_0xa9a8('0x10')));_0x24ac23=_[_0xa9a8('0x3')](_0x24ac23,require(_0xa9a8('0x11')));_0x24ac23=_['merge'](_0x24ac23,require(_0xa9a8('0x12')));_0x24ac23=_[_0xa9a8('0x3')](_0x24ac23,require('../api/faxAccount/faxAccount.rpc'));_0x24ac23=_[_0xa9a8('0x3')](_0x24ac23,require(_0xa9a8('0x13')));_0x24ac23=_[_0xa9a8('0x3')](_0x24ac23,require(_0xa9a8('0x14')));_0x24ac23=_[_0xa9a8('0x3')](_0x24ac23,require(_0xa9a8('0x15')));_0x24ac23=_[_0xa9a8('0x3')](_0x24ac23,require(_0xa9a8('0x16')));_0x24ac23=_[_0xa9a8('0x3')](_0x24ac23,require(_0xa9a8('0x17')));_0x24ac23=_['merge'](_0x24ac23,require(_0xa9a8('0x18')));_0x24ac23=_[_0xa9a8('0x3')](_0x24ac23,require(_0xa9a8('0x19')));_0x24ac23=_['merge'](_0x24ac23,require(_0xa9a8('0x1a')));_0x24ac23=_['merge'](_0x24ac23,require(_0xa9a8('0x1b')));_0x24ac23=_[_0xa9a8('0x3')](_0x24ac23,require('../api/openchannelApplication/openchannelApplication.rpc'));_0x24ac23=_['merge'](_0x24ac23,require(_0xa9a8('0x1c')));_0x24ac23=_['merge'](_0x24ac23,require(_0xa9a8('0x1d')));_0x24ac23=_[_0xa9a8('0x3')](_0x24ac23,require(_0xa9a8('0x1e')));_0x24ac23=_[_0xa9a8('0x3')](_0x24ac23,require(_0xa9a8('0x1f')));_0x24ac23=_['merge'](_0x24ac23,require(_0xa9a8('0x20')));_0x24ac23=_[_0xa9a8('0x3')](_0x24ac23,require('../api/chatMessage/chatMessage.rpc'));_0x24ac23=_[_0xa9a8('0x3')](_0x24ac23,require(_0xa9a8('0x21')));_0x24ac23=_[_0xa9a8('0x3')](_0x24ac23,require('../api/cmContact/cmContact.rpc'));_0x24ac23=_['merge'](_0x24ac23,require(_0xa9a8('0x22')));_0x24ac23=_[_0xa9a8('0x3')](_0x24ac23,require(_0xa9a8('0x23')));_0x24ac23=_[_0xa9a8('0x3')](_0x24ac23,require(_0xa9a8('0x24')));_0x24ac23=_[_0xa9a8('0x3')](_0x24ac23,require(_0xa9a8('0x25')));_0x24ac23=_['merge'](_0x24ac23,require(_0xa9a8('0x26')));_0x24ac23=_[_0xa9a8('0x3')](_0x24ac23,require(_0xa9a8('0x27')));_0x24ac23=_[_0xa9a8('0x3')](_0x24ac23,require(_0xa9a8('0x28')));_0x24ac23=_[_0xa9a8('0x3')](_0x24ac23,require('../api/sound/sound.rpc'));_0x24ac23=_[_0xa9a8('0x3')](_0x24ac23,require(_0xa9a8('0x29')));_0x24ac23=_[_0xa9a8('0x3')](_0x24ac23,require('../api/trigger/trigger.rpc'));_0x24ac23=_[_0xa9a8('0x3')](_0x24ac23,require(_0xa9a8('0x2a')));_0x24ac23=_[_0xa9a8('0x3')](_0x24ac23,require(_0xa9a8('0x2b')));_0x24ac23=_['merge'](_0x24ac23,require(_0xa9a8('0x2c')));_0x24ac23=_['merge'](_0x24ac23,require(_0xa9a8('0x2d')));_0x24ac23=_[_0xa9a8('0x3')](_0x24ac23,require(_0xa9a8('0x2e')));_0x24ac23=_[_0xa9a8('0x3')](_0x24ac23,require(_0xa9a8('0x2f')));_0x24ac23=_[_0xa9a8('0x3')](_0x24ac23,require(_0xa9a8('0x30')));_0x24ac23=_[_0xa9a8('0x3')](_0x24ac23,require(_0xa9a8('0x31')));_0x24ac23=_[_0xa9a8('0x3')](_0x24ac23,require(_0xa9a8('0x32')));_0x24ac23=_[_0xa9a8('0x3')](_0x24ac23,require(_0xa9a8('0x33')));_0x24ac23=_['merge'](_0x24ac23,require(_0xa9a8('0x34')));_0x24ac23=_['merge'](_0x24ac23,require(_0xa9a8('0x35')));_0x24ac23=_[_0xa9a8('0x3')](_0x24ac23,require(_0xa9a8('0x36')));_0x24ac23=_[_0xa9a8('0x3')](_0x24ac23,require(_0xa9a8('0x37')));_0x24ac23=_['merge'](_0x24ac23,require(_0xa9a8('0x38')));_0x24ac23=_[_0xa9a8('0x3')](_0x24ac23,require(_0xa9a8('0x39')));_0x24ac23=_[_0xa9a8('0x3')](_0x24ac23,require(_0xa9a8('0x3a')));_0x24ac23=_['merge'](_0x24ac23,require(_0xa9a8('0x3b')));_0x24ac23=_['merge'](_0x24ac23,require('../api/squareRecording/squareRecording.rpc'));_0x24ac23=_[_0xa9a8('0x3')](_0x24ac23,require(_0xa9a8('0x3c')));_0x24ac23=_[_0xa9a8('0x3')](_0x24ac23,require(_0xa9a8('0x3d')));_0x24ac23=_[_0xa9a8('0x3')](_0x24ac23,require('../api/attachment/attachment.rpc'));_0x24ac23=_[_0xa9a8('0x3')](_0x24ac23,require('../api/plugin/plugin.rpc'));_0x24ac23=_[_0xa9a8('0x3')](_0x24ac23,require('../api/whatsappAccount/whatsappAccount.rpc'));_0x24ac23=_[_0xa9a8('0x3')](_0x24ac23,require('../api/whatsappInteraction/whatsappInteraction.rpc'));_0x24ac23=_[_0xa9a8('0x3')](_0x24ac23,require(_0xa9a8('0x3e')));_0x24ac23=_[_0xa9a8('0x3')](_0x24ac23,require(_0xa9a8('0x3f')));_0x24ac23=_[_0xa9a8('0x3')](_0x24ac23,require(_0xa9a8('0x40')));var _0x16b18c=jayson[_0xa9a8('0x41')](_0x24ac23)[_0xa9a8('0x42')]();var _0x1c2dbc=config[_0xa9a8('0x43')][_0xa9a8('0x44')]||config['port']+0x1;var _0x5b3da8=config[_0xa9a8('0x43')]['ip']||_0xa9a8('0x45');_0x16b18c['on'](_0xa9a8('0x46'),function(_0x5bedd9){return _0x39eaea(_0x5bedd9);});_0x16b18c['listen'](_0x1c2dbc,_0x5b3da8,function(){console[_0xa9a8('0x47')](_0xa9a8('0x48'),_0x5b3da8,_0x1c2dbc);require('../config/triggers')[_0xa9a8('0x49')]();return _0x144b52(_0xa9a8('0x4a')+_0x5b3da8+':'+_0x1c2dbc);});});}; \ No newline at end of file +var _0x8ff8=['../api/mailServerIn/mailServerIn.rpc','../api/mailQueue/mailQueue.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.rpc','../api/faxAccount/faxAccount.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueue/faxQueue.rpc','../api/smsAccount/smsAccount.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsMessage/smsMessage.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatMessage/chatMessage.rpc','../api/chatQueue/chatQueue.rpc','../api/cmContact/cmContact.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/interval/interval.rpc','../api/pause/pause.rpc','../api/sound/sound.rpc','../api/trigger/trigger.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/setting/setting.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareRecording/squareRecording.rpc','../api/squareMessage/squareMessage.rpc','../api/campaign/campaign.rpc','../api/attachment/attachment.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','../api/whatsappQueue/whatsappQueue.rpc','server','rpc','port','error','RPC\x20listening\x20on\x20','jayson/promise','lodash','../config/environment','listen','merge','../api/user/user.rpc','../api/voiceExtension/voiceExtension.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/memberReport/memberReport.rpc','../api/trunk/trunk.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc'];(function(_0x3c01d1,_0x3ab46b){var _0x52822e=function(_0x1e013f){while(--_0x1e013f){_0x3c01d1['push'](_0x3c01d1['shift']());}};_0x52822e(++_0x3ab46b);}(_0x8ff8,0x113));var _0x88ff=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x8ff8[_0x321bb2];return _0x9c12ed;};'use strict';var jayson=require(_0x88ff('0x0'));var BPromise=require('bluebird');var _=require(_0x88ff('0x1'));var config=require(_0x88ff('0x2'));exports[_0x88ff('0x3')]=function(){return new BPromise(function(_0x37b88d,_0x18bc3f){var _0x3e6b3d={};_0x3e6b3d=_[_0x88ff('0x4')](_0x3e6b3d,require(_0x88ff('0x5')));_0x3e6b3d=_['merge'](_0x3e6b3d,require(_0x88ff('0x6')));_0x3e6b3d=_['merge'](_0x3e6b3d,require(_0x88ff('0x7')));_0x3e6b3d=_[_0x88ff('0x4')](_0x3e6b3d,require(_0x88ff('0x8')));_0x3e6b3d=_[_0x88ff('0x4')](_0x3e6b3d,require(_0x88ff('0x9')));_0x3e6b3d=_[_0x88ff('0x4')](_0x3e6b3d,require(_0x88ff('0xa')));_0x3e6b3d=_[_0x88ff('0x4')](_0x3e6b3d,require(_0x88ff('0xb')));_0x3e6b3d=_[_0x88ff('0x4')](_0x3e6b3d,require(_0x88ff('0xc')));_0x3e6b3d=_[_0x88ff('0x4')](_0x3e6b3d,require(_0x88ff('0xd')));_0x3e6b3d=_[_0x88ff('0x4')](_0x3e6b3d,require(_0x88ff('0xe')));_0x3e6b3d=_[_0x88ff('0x4')](_0x3e6b3d,require(_0x88ff('0xf')));_0x3e6b3d=_[_0x88ff('0x4')](_0x3e6b3d,require(_0x88ff('0x10')));_0x3e6b3d=_[_0x88ff('0x4')](_0x3e6b3d,require(_0x88ff('0x11')));_0x3e6b3d=_[_0x88ff('0x4')](_0x3e6b3d,require('../api/mailAccount/mailAccount.rpc'));_0x3e6b3d=_[_0x88ff('0x4')](_0x3e6b3d,require(_0x88ff('0x12')));_0x3e6b3d=_[_0x88ff('0x4')](_0x3e6b3d,require(_0x88ff('0x13')));_0x3e6b3d=_[_0x88ff('0x4')](_0x3e6b3d,require(_0x88ff('0x14')));_0x3e6b3d=_[_0x88ff('0x4')](_0x3e6b3d,require(_0x88ff('0x15')));_0x3e6b3d=_['merge'](_0x3e6b3d,require('../api/mailQueueReport/mailQueueReport.rpc'));_0x3e6b3d=_['merge'](_0x3e6b3d,require(_0x88ff('0x16')));_0x3e6b3d=_[_0x88ff('0x4')](_0x3e6b3d,require('../api/faxApplication/faxApplication.rpc'));_0x3e6b3d=_[_0x88ff('0x4')](_0x3e6b3d,require(_0x88ff('0x17')));_0x3e6b3d=_[_0x88ff('0x4')](_0x3e6b3d,require(_0x88ff('0x18')));_0x3e6b3d=_[_0x88ff('0x4')](_0x3e6b3d,require(_0x88ff('0x19')));_0x3e6b3d=_[_0x88ff('0x4')](_0x3e6b3d,require('../api/faxQueueReport/faxQueueReport.rpc'));_0x3e6b3d=_['merge'](_0x3e6b3d,require(_0x88ff('0x1a')));_0x3e6b3d=_[_0x88ff('0x4')](_0x3e6b3d,require(_0x88ff('0x1b')));_0x3e6b3d=_['merge'](_0x3e6b3d,require(_0x88ff('0x1c')));_0x3e6b3d=_[_0x88ff('0x4')](_0x3e6b3d,require(_0x88ff('0x1d')));_0x3e6b3d=_[_0x88ff('0x4')](_0x3e6b3d,require(_0x88ff('0x1e')));_0x3e6b3d=_['merge'](_0x3e6b3d,require(_0x88ff('0x1f')));_0x3e6b3d=_[_0x88ff('0x4')](_0x3e6b3d,require('../api/openchannelMessage/openchannelMessage.rpc'));_0x3e6b3d=_[_0x88ff('0x4')](_0x3e6b3d,require(_0x88ff('0x20')));_0x3e6b3d=_[_0x88ff('0x4')](_0x3e6b3d,require(_0x88ff('0x21')));_0x3e6b3d=_[_0x88ff('0x4')](_0x3e6b3d,require(_0x88ff('0x22')));_0x3e6b3d=_[_0x88ff('0x4')](_0x3e6b3d,require(_0x88ff('0x23')));_0x3e6b3d=_[_0x88ff('0x4')](_0x3e6b3d,require(_0x88ff('0x24')));_0x3e6b3d=_[_0x88ff('0x4')](_0x3e6b3d,require(_0x88ff('0x25')));_0x3e6b3d=_[_0x88ff('0x4')](_0x3e6b3d,require('../api/cmHopper/cmHopper.rpc'));_0x3e6b3d=_[_0x88ff('0x4')](_0x3e6b3d,require(_0x88ff('0x26')));_0x3e6b3d=_['merge'](_0x3e6b3d,require(_0x88ff('0x27')));_0x3e6b3d=_[_0x88ff('0x4')](_0x3e6b3d,require(_0x88ff('0x28')));_0x3e6b3d=_[_0x88ff('0x4')](_0x3e6b3d,require(_0x88ff('0x29')));_0x3e6b3d=_['merge'](_0x3e6b3d,require(_0x88ff('0x2a')));_0x3e6b3d=_[_0x88ff('0x4')](_0x3e6b3d,require(_0x88ff('0x2b')));_0x3e6b3d=_['merge'](_0x3e6b3d,require(_0x88ff('0x2c')));_0x3e6b3d=_[_0x88ff('0x4')](_0x3e6b3d,require('../api/template/template.rpc'));_0x3e6b3d=_[_0x88ff('0x4')](_0x3e6b3d,require(_0x88ff('0x2d')));_0x3e6b3d=_[_0x88ff('0x4')](_0x3e6b3d,require('../api/variable/variable.rpc'));_0x3e6b3d=_[_0x88ff('0x4')](_0x3e6b3d,require(_0x88ff('0x2e')));_0x3e6b3d=_['merge'](_0x3e6b3d,require(_0x88ff('0x2f')));_0x3e6b3d=_['merge'](_0x3e6b3d,require(_0x88ff('0x30')));_0x3e6b3d=_[_0x88ff('0x4')](_0x3e6b3d,require(_0x88ff('0x31')));_0x3e6b3d=_[_0x88ff('0x4')](_0x3e6b3d,require(_0x88ff('0x32')));_0x3e6b3d=_[_0x88ff('0x4')](_0x3e6b3d,require(_0x88ff('0x33')));_0x3e6b3d=_[_0x88ff('0x4')](_0x3e6b3d,require('../api/intVtigerAccount/intVtigerAccount.rpc'));_0x3e6b3d=_[_0x88ff('0x4')](_0x3e6b3d,require(_0x88ff('0x34')));_0x3e6b3d=_['merge'](_0x3e6b3d,require(_0x88ff('0x35')));_0x3e6b3d=_[_0x88ff('0x4')](_0x3e6b3d,require(_0x88ff('0x36')));_0x3e6b3d=_[_0x88ff('0x4')](_0x3e6b3d,require('../api/chatQueueReport/chatQueueReport.rpc'));_0x3e6b3d=_['merge'](_0x3e6b3d,require(_0x88ff('0x37')));_0x3e6b3d=_[_0x88ff('0x4')](_0x3e6b3d,require('../api/squareReport/squareReport.rpc'));_0x3e6b3d=_['merge'](_0x3e6b3d,require(_0x88ff('0x38')));_0x3e6b3d=_[_0x88ff('0x4')](_0x3e6b3d,require(_0x88ff('0x39')));_0x3e6b3d=_[_0x88ff('0x4')](_0x3e6b3d,require(_0x88ff('0x3a')));_0x3e6b3d=_[_0x88ff('0x4')](_0x3e6b3d,require('../api/squareProject/squareProject.rpc'));_0x3e6b3d=_[_0x88ff('0x4')](_0x3e6b3d,require(_0x88ff('0x3b')));_0x3e6b3d=_['merge'](_0x3e6b3d,require(_0x88ff('0x3c')));_0x3e6b3d=_['merge'](_0x3e6b3d,require(_0x88ff('0x3d')));_0x3e6b3d=_[_0x88ff('0x4')](_0x3e6b3d,require(_0x88ff('0x3e')));_0x3e6b3d=_[_0x88ff('0x4')](_0x3e6b3d,require('../api/plugin/plugin.rpc'));_0x3e6b3d=_[_0x88ff('0x4')](_0x3e6b3d,require(_0x88ff('0x3f')));_0x3e6b3d=_['merge'](_0x3e6b3d,require(_0x88ff('0x40')));_0x3e6b3d=_['merge'](_0x3e6b3d,require(_0x88ff('0x41')));_0x3e6b3d=_['merge'](_0x3e6b3d,require(_0x88ff('0x42')));_0x3e6b3d=_[_0x88ff('0x4')](_0x3e6b3d,require(_0x88ff('0x43')));var _0x592b58=jayson[_0x88ff('0x44')](_0x3e6b3d)['http']();var _0xa97411=config[_0x88ff('0x45')][_0x88ff('0x46')]||config[_0x88ff('0x46')]+0x1;var _0x3a4a46=config[_0x88ff('0x45')]['ip']||'localhost';_0x592b58['on'](_0x88ff('0x47'),function(_0x1fc2dd){return _0x18bc3f(_0x1fc2dd);});_0x592b58['listen'](_0xa97411,_0x3a4a46,function(){console['log']('Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!',_0x3a4a46,_0xa97411);require('../config/triggers')['default']();return _0x37b88d(_0x88ff('0x48')+_0x3a4a46+':'+_0xa97411);});});}; \ No newline at end of file diff --git a/server/services/agi/channel.js b/server/services/agi/channel.js index fb2b975..e0983c2 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 _0x9a6e=['EXEC\x20%s\x20%s','join','setContext','SET\x20CONTEXT\x20%s','setExtension','SET\x20EXTENSION\x20%s','setPriority','SET\x20PRIORITY\x20%s','setVariable','isBoolean','isNumber','toString','SET\x20VARIABLE\x20%s\x20\x22%s\x22','sayNumber','sayDigits','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','getVariable','GET\x20VARIABLE\x20\x22%s\x22','recordFile','wav','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','EventEmitter','./reply','./error','call','utf8','headers','emit','ready','line','toLowerCase','hangup','substring','520-Invalid','search','520\x20End\x20of\x20proper','function','no\x20code','replace','indexOf','startsWith','split','length','match','E_AGI_SOCKET_ERROR','code','E_AGI_SOCKET_CLOSE','timeout','destroy','pipe','command','write','close','inherits','prototype','sendRequest','sync','answer','ANSWER','beep','format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','VERBOSE\x20\x22%s\x22','exec','isArray'];(function(_0x48741f,_0x3895d7){var _0x2805b0=function(_0x133b16){while(--_0x133b16){_0x48741f['push'](_0x48741f['shift']());}};_0x2805b0(++_0x3895d7);}(_0x9a6e,0xc1));var _0xe9a6=function(_0x48910d,_0xe8d0e1){_0x48910d=_0x48910d-0x0;var _0x1b4c22=_0x9a6e[_0x48910d];return _0x1b4c22;};'use strict';var util=require(_0xe9a6('0x0'));var _=require(_0xe9a6('0x1'));var EventEmitter=require('events')[_0xe9a6('0x2')];var AGIReply=require(_0xe9a6('0x3'));var AGIError=require(_0xe9a6('0x4'));function AGIChannel(_0x219397){var _0xc06690=this,_0x9febd8=new AGIReply(),_0x5292c9=![],_0x3e860c={};EventEmitter[_0xe9a6('0x5')](_0xc06690);_0x219397['setEncoding']('utf8');_0x219397['setTimeout'](0x8*0x3c*0x3c*0x3e8);_0x9febd8['setEncoding'](_0xe9a6('0x6'));_0x9febd8['on'](_0xe9a6('0x7'),function(_0xc6145f){for(var _0x1a0b47 in _0xc6145f){_0xc06690[_0x1a0b47]=_0xc6145f[_0x1a0b47];}_0xc06690[_0xe9a6('0x8')](_0xe9a6('0x9'));});_0x9febd8['on'](_0xe9a6('0xa'),function(_0x357108){if(_0x357108[_0xe9a6('0xb')]()==_0xe9a6('0xc')){_0xc06690['emit']('hangup');return;}if(_0x357108[_0xe9a6('0xd')](0x0,0xb)==_0xe9a6('0xe')){_0x5292c9=!![];}if(_0x5292c9){_0x3e860c['rx']+=_0x357108+'\x0a';if(_0x357108[_0xe9a6('0xf')](_0xe9a6('0x10'))!=-0x1){_0x5292c9=![];}}else{_0x3e860c['rx']=_0x357108;}if(_0x5292c9){return;}if(typeof _0x3e860c['cb']==_0xe9a6('0x11')){var _0x19e272=_0x3e860c['rx']['substring'](0x0,0x3),_0x2ac6ad=null,_0x57fb36=null;_0x19e272=parseInt(_0x19e272);if(isNaN(_0x19e272)){_0x3e860c['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0xe9a6('0x12')});return;}if(_0x19e272!=0xc8){_0x3e860c['cb'](null,{'code':_0x19e272,'result':-0x1,'extra':'KO'});return;}_0x2ac6ad=_0x3e860c['rx'][_0xe9a6('0xd')](0x4)[_0xe9a6('0x13')]('result=','');if(_0x2ac6ad[_0xe9a6('0x14')]('\x20')!=-0x1){_0x2ac6ad=_0x2ac6ad['substr'](0x0,_0x2ac6ad[_0xe9a6('0x14')]('\x20'));}if(_[_0xe9a6('0x15')](_0x2ac6ad,'-1')){_0x2ac6ad=parseInt(_0x2ac6ad);}_0x57fb36=_0x3e860c['rx'][_0xe9a6('0x16')]('\x20');if(_0x57fb36['length']==0x3){_0x57fb36=_0x57fb36[0x2]['substring'](0x1,_0x57fb36[0x2]['length']-0x1);}else if(_0x57fb36[_0xe9a6('0x17')]>0x3){var _0x368276=/\((.+)\)/;var _0x1a11a3=_0x3e860c['rx'][_0xe9a6('0x18')](_0x368276);if(_0x1a11a3){_0x57fb36=_0x1a11a3[0x1];}else{_0x57fb36=null;}}else{_0x57fb36=null;}_0x3e860c['cb'](null,{'code':_0x19e272,'result':_0x2ac6ad,'extra':_0x57fb36});}});_0x219397['on']('error',function(_0x324f8f){_0xc06690[_0xe9a6('0x8')]('error',new AGIError(_0xe9a6('0x19'),_0x324f8f[_0xe9a6('0x1a')]));});_0x219397['on']('close',function(){_0xc06690[_0xe9a6('0x8')]('close',new AGIError(_0xe9a6('0x1b')));});_0x219397['on'](_0xe9a6('0x1c'),function(){_0xc06690[_0xe9a6('0x8')](_0xe9a6('0x1c'),new AGIError('E_AGI_SOCKET_TIMEOUT'));_0x219397[_0xe9a6('0x1d')]();});_0x219397[_0xe9a6('0x1e')](_0x9febd8);this[_0xe9a6('0x1f')]=function(_0x54c068,_0x3f0ebf){var _0x54c068=_0x54c068||'',_0x3f0ebf=typeof _0x3f0ebf==_0xe9a6('0x11')?_0x3f0ebf:new Function();_0x3e860c={'tx':_0x54c068,'rx':'','cb':_0x3f0ebf};_0x219397[_0xe9a6('0x20')](_0x54c068+'\x0a');},this[_0xe9a6('0x21')]=function(){_0x219397[_0xe9a6('0x1d')]();};}util[_0xe9a6('0x22')](AGIChannel,EventEmitter);AGIChannel[_0xe9a6('0x23')][_0xe9a6('0x24')]=function(_0x36713f){return this['command'][_0xe9a6('0x25')](this,_0x36713f);};AGIChannel['prototype'][_0xe9a6('0x26')]=function(){return this[_0xe9a6('0x24')](_0xe9a6('0x27'));};AGIChannel[_0xe9a6('0x23')]['getData']=function(_0x54abab,_0x1e1030,_0x2b4515){_0x54abab=_0x54abab===undefined?_0xe9a6('0x28'):_0x54abab;_0x1e1030=_0x1e1030===undefined?'5':_0x1e1030;_0x2b4515=_0x2b4515===undefined?'1':_0x2b4515;return this[_0xe9a6('0x24')](util[_0xe9a6('0x29')](_0xe9a6('0x2a'),_0x54abab,_0x1e1030*0x3e8,_0x2b4515));};AGIChannel['prototype'][_0xe9a6('0x2b')]=function(_0x3da878){_0x3da878=_0x3da878||'NO\x20MESSAGE';return this['sendRequest'](util[_0xe9a6('0x29')](_0xe9a6('0x2c'),_0x3da878));};AGIChannel[_0xe9a6('0x23')][_0xe9a6('0x2d')]=function(_0x73e555,_0x348e7b){if(_[_0xe9a6('0x2e')](_0x348e7b)){return this[_0xe9a6('0x24')](util[_0xe9a6('0x29')](_0xe9a6('0x2f'),_0x73e555,_0x348e7b[_0xe9a6('0x30')](',')));}return this[_0xe9a6('0x24')](util[_0xe9a6('0x29')](_0xe9a6('0x2f'),_0x73e555,_0x348e7b));};AGIChannel[_0xe9a6('0x23')][_0xe9a6('0x31')]=function(_0x283a0b){return this[_0xe9a6('0x24')](util['format'](_0xe9a6('0x32'),_0x283a0b));};AGIChannel[_0xe9a6('0x23')][_0xe9a6('0x33')]=function(_0x1c2236){return this[_0xe9a6('0x24')](util[_0xe9a6('0x29')](_0xe9a6('0x34'),_0x1c2236));};AGIChannel[_0xe9a6('0x23')][_0xe9a6('0x35')]=function(_0x51ce17){return this[_0xe9a6('0x24')](util[_0xe9a6('0x29')](_0xe9a6('0x36'),_0x51ce17));};AGIChannel['prototype'][_0xe9a6('0xc')]=function(){return this[_0xe9a6('0x24')]('HANGUP');};AGIChannel[_0xe9a6('0x23')][_0xe9a6('0x37')]=function(_0x5f58e4,_0x338a7a){var _0xb1389d=_[_0xe9a6('0x38')](_0x338a7a)||_[_0xe9a6('0x39')](_0x338a7a)?_0x338a7a[_0xe9a6('0x3a')]():_0x338a7a;return this[_0xe9a6('0x24')](util['format'](_0xe9a6('0x3b'),_0x5f58e4,_0xb1389d?_0xb1389d[_0xe9a6('0x3a')]()[_0xe9a6('0x13')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0xe9a6('0x23')][_0xe9a6('0x3c')]=function(_0x1b3aad,_0x42455f){return this[_0xe9a6('0x24')](util['format']('SAY\x20NUMBER\x20%s\x20%s',_0x1b3aad,_0x42455f));};AGIChannel['prototype'][_0xe9a6('0x3d')]=function(_0x22659e,_0xc7013c){return this[_0xe9a6('0x24')](util[_0xe9a6('0x29')](_0xe9a6('0x3e'),_0x22659e,_0xc7013c));};AGIChannel[_0xe9a6('0x23')][_0xe9a6('0x3f')]=function(_0x4aee7d,_0xf503a9){return this[_0xe9a6('0x24')](util[_0xe9a6('0x29')](_0xe9a6('0x40'),_0x4aee7d,_0xf503a9));};AGIChannel['prototype'][_0xe9a6('0x41')]=function(_0x36fe7e,_0x71adeb,_0x484cec){_0x71adeb=_0x71adeb||this['extension'];_0x484cec=_0x484cec||0x1;this[_0xe9a6('0x31')](_0x36fe7e);this['setExtension'](_0x71adeb);this[_0xe9a6('0x35')](_0x484cec);return this[_0xe9a6('0x2b')](util[_0xe9a6('0x29')]('GOTO\x20%s\x20%s\x20%s',_0x36fe7e,_0x71adeb,_0x484cec));};AGIChannel[_0xe9a6('0x23')][_0xe9a6('0x42')]=function(_0x2ce4a3){return this[_0xe9a6('0x24')](util['format'](_0xe9a6('0x43'),_0x2ce4a3));};AGIChannel[_0xe9a6('0x23')][_0xe9a6('0x44')]=function(_0x49a63c,_0x1a00cb,_0x3d91de,_0x30a55b,_0x3f9d73,_0x32b0bf){_0x1a00cb=_0x1a00cb||_0xe9a6('0x45');_0x3d91de=_0x3d91de||'';_0x30a55b=_0x30a55b===undefined?-0x1:_0x30a55b==='-1'?-0x1:_0x30a55b*0x3e8;_0x3f9d73=_0x3f9d73===undefined?'':'s='+_0x3f9d73;_0x32b0bf=_0x32b0bf?_0xe9a6('0x46'):'';return this[_0xe9a6('0x24')](util['format'](_0xe9a6('0x47'),_0x49a63c,_0x1a00cb,_0x3d91de,_0x30a55b,_0x32b0bf,_0x3f9d73));};AGIChannel[_0xe9a6('0x23')][_0xe9a6('0x48')]=function(_0x44aca4,_0x258cf5){_0x258cf5=_0x258cf5||'';return this[_0xe9a6('0x24')](util[_0xe9a6('0x29')](_0xe9a6('0x49'),_0x44aca4,_0x258cf5));};AGIChannel['prototype']['agi']=function(_0x3e2748){return this['exec'](_0xe9a6('0x4a'),_0x3e2748);};AGIChannel[_0xe9a6('0x23')][_0xe9a6('0x4b')]=function(_0x1b34fd){return this['exec'](_0xe9a6('0x4c'),_0x1b34fd);};AGIChannel['prototype']['error']=function(_0x1677f5,_0x93eca4){this[_0xe9a6('0x2b')](util['format'](_0xe9a6('0x4d'),_0x1677f5['id'],_0x1677f5[_0xe9a6('0x4e')],_0x93eca4));return{'code':0x1f4,'result':'-1','extra':''};};module[_0xe9a6('0x4f')]=AGIChannel; \ No newline at end of file +var _0xd101=['GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','VERBOSE\x20\x22%s\x22','exec','isArray','EXEC\x20%s\x20%s','join','setContext','SET\x20EXTENSION\x20%s','setPriority','SET\x20PRIORITY\x20%s','HANGUP','isNumber','toString','sayNumber','SAY\x20NUMBER\x20%s\x20%s','sayDigits','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','continueAt','extension','getVariable','GET\x20VARIABLE\x20\x22%s\x22','recordFile','wav','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','agi','wait','WAIT','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','exports','util','events','EventEmitter','./reply','./error','call','setEncoding','utf8','setTimeout','headers','emit','ready','line','toLowerCase','hangup','520-Invalid','search','520\x20End\x20of\x20proper','function','substring','no\x20code','replace','result=','substr','indexOf','startsWith','split','length','match','error','E_AGI_SOCKET_ERROR','code','close','E_AGI_SOCKET_CLOSE','E_AGI_SOCKET_TIMEOUT','destroy','pipe','command','write','inherits','prototype','sendRequest','sync','ANSWER','getData','beep','format'];(function(_0x1beef3,_0x57c4b8){var _0x5af964=function(_0x36f463){while(--_0x36f463){_0x1beef3['push'](_0x1beef3['shift']());}};_0x5af964(++_0x57c4b8);}(_0xd101,0xc1));var _0x1d10=function(_0xb4002c,_0x210353){_0xb4002c=_0xb4002c-0x0;var _0x4395d3=_0xd101[_0xb4002c];return _0x4395d3;};'use strict';var util=require(_0x1d10('0x0'));var _=require('lodash');var EventEmitter=require(_0x1d10('0x1'))[_0x1d10('0x2')];var AGIReply=require(_0x1d10('0x3'));var AGIError=require(_0x1d10('0x4'));function AGIChannel(_0xaa1d24){var _0x25b425=this,_0x12c320=new AGIReply(),_0x1e83e0=![],_0x5c5c42={};EventEmitter[_0x1d10('0x5')](_0x25b425);_0xaa1d24[_0x1d10('0x6')](_0x1d10('0x7'));_0xaa1d24[_0x1d10('0x8')](0x8*0x3c*0x3c*0x3e8);_0x12c320[_0x1d10('0x6')](_0x1d10('0x7'));_0x12c320['on'](_0x1d10('0x9'),function(_0x43df2c){for(var _0x3a15c8 in _0x43df2c){_0x25b425[_0x3a15c8]=_0x43df2c[_0x3a15c8];}_0x25b425[_0x1d10('0xa')](_0x1d10('0xb'));});_0x12c320['on'](_0x1d10('0xc'),function(_0x1610b4){if(_0x1610b4[_0x1d10('0xd')]()==_0x1d10('0xe')){_0x25b425[_0x1d10('0xa')](_0x1d10('0xe'));return;}if(_0x1610b4['substring'](0x0,0xb)==_0x1d10('0xf')){_0x1e83e0=!![];}if(_0x1e83e0){_0x5c5c42['rx']+=_0x1610b4+'\x0a';if(_0x1610b4[_0x1d10('0x10')](_0x1d10('0x11'))!=-0x1){_0x1e83e0=![];}}else{_0x5c5c42['rx']=_0x1610b4;}if(_0x1e83e0){return;}if(typeof _0x5c5c42['cb']==_0x1d10('0x12')){var _0x268506=_0x5c5c42['rx'][_0x1d10('0x13')](0x0,0x3),_0x5b71d8=null,_0x3f6bd8=null;_0x268506=parseInt(_0x268506);if(isNaN(_0x268506)){_0x5c5c42['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x1d10('0x14')});return;}if(_0x268506!=0xc8){_0x5c5c42['cb'](null,{'code':_0x268506,'result':-0x1,'extra':'KO'});return;}_0x5b71d8=_0x5c5c42['rx'][_0x1d10('0x13')](0x4)[_0x1d10('0x15')](_0x1d10('0x16'),'');if(_0x5b71d8['indexOf']('\x20')!=-0x1){_0x5b71d8=_0x5b71d8[_0x1d10('0x17')](0x0,_0x5b71d8[_0x1d10('0x18')]('\x20'));}if(_[_0x1d10('0x19')](_0x5b71d8,'-1')){_0x5b71d8=parseInt(_0x5b71d8);}_0x3f6bd8=_0x5c5c42['rx'][_0x1d10('0x1a')]('\x20');if(_0x3f6bd8['length']==0x3){_0x3f6bd8=_0x3f6bd8[0x2][_0x1d10('0x13')](0x1,_0x3f6bd8[0x2][_0x1d10('0x1b')]-0x1);}else if(_0x3f6bd8[_0x1d10('0x1b')]>0x3){var _0x3f2f2b=/\((.+)\)/;var _0x1b2051=_0x5c5c42['rx'][_0x1d10('0x1c')](_0x3f2f2b);if(_0x1b2051){_0x3f6bd8=_0x1b2051[0x1];}else{_0x3f6bd8=null;}}else{_0x3f6bd8=null;}_0x5c5c42['cb'](null,{'code':_0x268506,'result':_0x5b71d8,'extra':_0x3f6bd8});}});_0xaa1d24['on'](_0x1d10('0x1d'),function(_0x4f3e2a){_0x25b425[_0x1d10('0xa')](_0x1d10('0x1d'),new AGIError(_0x1d10('0x1e'),_0x4f3e2a[_0x1d10('0x1f')]));});_0xaa1d24['on'](_0x1d10('0x20'),function(){_0x25b425['emit']('close',new AGIError(_0x1d10('0x21')));});_0xaa1d24['on']('timeout',function(){_0x25b425['emit']('timeout',new AGIError(_0x1d10('0x22')));_0xaa1d24[_0x1d10('0x23')]();});_0xaa1d24[_0x1d10('0x24')](_0x12c320);this[_0x1d10('0x25')]=function(_0x4ce84a,_0x5e5315){var _0x4ce84a=_0x4ce84a||'',_0x5e5315=typeof _0x5e5315==_0x1d10('0x12')?_0x5e5315:new Function();_0x5c5c42={'tx':_0x4ce84a,'rx':'','cb':_0x5e5315};_0xaa1d24[_0x1d10('0x26')](_0x4ce84a+'\x0a');},this[_0x1d10('0x20')]=function(){_0xaa1d24[_0x1d10('0x23')]();};}util[_0x1d10('0x27')](AGIChannel,EventEmitter);AGIChannel[_0x1d10('0x28')][_0x1d10('0x29')]=function(_0x3af06d){return this[_0x1d10('0x25')][_0x1d10('0x2a')](this,_0x3af06d);};AGIChannel[_0x1d10('0x28')]['answer']=function(){return this[_0x1d10('0x29')](_0x1d10('0x2b'));};AGIChannel[_0x1d10('0x28')][_0x1d10('0x2c')]=function(_0x18e7d9,_0x3bffbe,_0x38f583){_0x18e7d9=_0x18e7d9===undefined?_0x1d10('0x2d'):_0x18e7d9;_0x3bffbe=_0x3bffbe===undefined?'5':_0x3bffbe;_0x38f583=_0x38f583===undefined?'1':_0x38f583;return this['sendRequest'](util[_0x1d10('0x2e')](_0x1d10('0x2f'),_0x18e7d9,_0x3bffbe*0x3e8,_0x38f583));};AGIChannel['prototype'][_0x1d10('0x30')]=function(_0x52d514){_0x52d514=_0x52d514||'NO\x20MESSAGE';return this[_0x1d10('0x29')](util['format'](_0x1d10('0x31'),_0x52d514));};AGIChannel[_0x1d10('0x28')][_0x1d10('0x32')]=function(_0x15fdac,_0x1a43fd){if(_[_0x1d10('0x33')](_0x1a43fd)){return this['sendRequest'](util['format'](_0x1d10('0x34'),_0x15fdac,_0x1a43fd[_0x1d10('0x35')](',')));}return this[_0x1d10('0x29')](util[_0x1d10('0x2e')](_0x1d10('0x34'),_0x15fdac,_0x1a43fd));};AGIChannel[_0x1d10('0x28')][_0x1d10('0x36')]=function(_0x1c6cad){return this[_0x1d10('0x29')](util[_0x1d10('0x2e')]('SET\x20CONTEXT\x20%s',_0x1c6cad));};AGIChannel[_0x1d10('0x28')]['setExtension']=function(_0x1b0f8f){return this[_0x1d10('0x29')](util['format'](_0x1d10('0x37'),_0x1b0f8f));};AGIChannel['prototype'][_0x1d10('0x38')]=function(_0x2d4121){return this[_0x1d10('0x29')](util[_0x1d10('0x2e')](_0x1d10('0x39'),_0x2d4121));};AGIChannel['prototype']['hangup']=function(){return this[_0x1d10('0x29')](_0x1d10('0x3a'));};AGIChannel[_0x1d10('0x28')]['setVariable']=function(_0x4a9cde,_0x5e0423){var _0x135d14=_['isBoolean'](_0x5e0423)||_[_0x1d10('0x3b')](_0x5e0423)?_0x5e0423[_0x1d10('0x3c')]():_0x5e0423;return this[_0x1d10('0x29')](util[_0x1d10('0x2e')]('SET\x20VARIABLE\x20%s\x20\x22%s\x22',_0x4a9cde,_0x135d14?_0x135d14['toString']()[_0x1d10('0x15')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x1d10('0x28')][_0x1d10('0x3d')]=function(_0x230c19,_0x549e83){return this[_0x1d10('0x29')](util['format'](_0x1d10('0x3e'),_0x230c19,_0x549e83));};AGIChannel[_0x1d10('0x28')][_0x1d10('0x3f')]=function(_0x8d8405,_0x38addd){return this[_0x1d10('0x29')](util[_0x1d10('0x2e')](_0x1d10('0x40'),_0x8d8405,_0x38addd));};AGIChannel[_0x1d10('0x28')][_0x1d10('0x41')]=function(_0x1cae38,_0x347f9d){return this[_0x1d10('0x29')](util['format']('SAY\x20PHONETIC\x20\x22%s\x22\x20%s',_0x1cae38,_0x347f9d));};AGIChannel[_0x1d10('0x28')][_0x1d10('0x42')]=function(_0x3be3b0,_0xb15892,_0x1368ef){_0xb15892=_0xb15892||this[_0x1d10('0x43')];_0x1368ef=_0x1368ef||0x1;this[_0x1d10('0x36')](_0x3be3b0);this['setExtension'](_0xb15892);this[_0x1d10('0x38')](_0x1368ef);return this[_0x1d10('0x30')](util[_0x1d10('0x2e')]('GOTO\x20%s\x20%s\x20%s',_0x3be3b0,_0xb15892,_0x1368ef));};AGIChannel[_0x1d10('0x28')][_0x1d10('0x44')]=function(_0x2ee987){return this['sendRequest'](util['format'](_0x1d10('0x45'),_0x2ee987));};AGIChannel[_0x1d10('0x28')][_0x1d10('0x46')]=function(_0x2db4f7,_0x23fde4,_0x2c4933,_0xd34935,_0x50f8e7,_0xf71ad5){_0x23fde4=_0x23fde4||_0x1d10('0x47');_0x2c4933=_0x2c4933||'';_0xd34935=_0xd34935===undefined?-0x1:_0xd34935==='-1'?-0x1:_0xd34935*0x3e8;_0x50f8e7=_0x50f8e7===undefined?'':'s='+_0x50f8e7;_0xf71ad5=_0xf71ad5?'BEEP':'';return this[_0x1d10('0x29')](util['format'](_0x1d10('0x48'),_0x2db4f7,_0x23fde4,_0x2c4933,_0xd34935,_0xf71ad5,_0x50f8e7));};AGIChannel['prototype']['streamFile']=function(_0x11f446,_0x3183b4){_0x3183b4=_0x3183b4||'';return this[_0x1d10('0x29')](util[_0x1d10('0x2e')](_0x1d10('0x49'),_0x11f446,_0x3183b4));};AGIChannel[_0x1d10('0x28')][_0x1d10('0x4a')]=function(_0x198930){return this[_0x1d10('0x32')]('AGI',_0x198930);};AGIChannel['prototype'][_0x1d10('0x4b')]=function(_0x38bcba){return this[_0x1d10('0x32')](_0x1d10('0x4c'),_0x38bcba);};AGIChannel[_0x1d10('0x28')][_0x1d10('0x1d')]=function(_0x5c3572,_0x2db27f){this[_0x1d10('0x30')](util[_0x1d10('0x2e')](_0x1d10('0x4d'),_0x5c3572['id'],_0x5c3572[_0x1d10('0x4e')],_0x2db27f));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x1d10('0x4f')]=AGIChannel; \ No newline at end of file diff --git a/server/services/agi/error.js b/server/services/agi/error.js index 290d47d..fb96792 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 _0xb441=['Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED','push','format','apply','name','exports','Undefined\x20error.','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20error.\x20Code:\x20%s.','Server\x20closed.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20error.\x20Code:\x20%s.','Socket\x20closed.','Empty\x20command.'];(function(_0x2d357c,_0x58bd29){var _0x1a3480=function(_0x4d8264){while(--_0x4d8264){_0x2d357c['push'](_0x2d357c['shift']());}};_0x1a3480(++_0x58bd29);}(_0xb441,0x98));var _0x1b44=function(_0x3943fc,_0x5e44fc){_0x3943fc=_0x3943fc-0x0;var _0x2a432d=_0xb441[_0x3943fc];return _0x2a432d;};'use strict';var util=require('util');var error={'E_AGI_UNDEFINED':_0x1b44('0x0'),'E_AGI_ARGUMENT_PORT':_0x1b44('0x1'),'E_AGI_SERVER_ERROR':_0x1b44('0x2'),'E_AGI_SERVER_CLOSE':_0x1b44('0x3'),'E_AGI_SERVER_MAXCONNECTION':'[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','E_AGI_SERVER_VOICE_DISABLED':_0x1b44('0x4'),'E_AGI_SOCKET_ERROR':_0x1b44('0x5'),'E_AGI_SOCKET_CLOSE':_0x1b44('0x6'),'E_AGI_SOCKET_TIMEOUT':'Socket\x20timeout.','E_AGI_COMMAND_EMPTY':_0x1b44('0x7'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0x1b44('0x8'),'E_AGI_IVR_ENTRY':_0x1b44('0x9')};function AGIError(_0x3156ef){var _0x3156ef=_0x3156ef||null,_0x18bdca=_0x18bdca||[],_0xf6878=0x1,_0x352eb0='';if(!error[_0x3156ef]){_0x3156ef=_0x1b44('0xa');}_0x18bdca[_0x1b44('0xb')](error[_0x3156ef]);while(arguments[_0xf6878]){_0x18bdca['push'](arguments[_0xf6878]);_0xf6878++;}_0x352eb0=util[_0x1b44('0xc')][_0x1b44('0xd')](util,_0x18bdca);this['message']=_0x352eb0;this[_0x1b44('0xe')]=_0x3156ef;}module[_0x1b44('0xf')]=AGIError; \ No newline at end of file +var _0x6bfa=['Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20error.\x20Code:\x20%s.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20closed.','Socket\x20timeout.','Empty\x20command.','Missing\x20\x27ivr.entry\x27\x20menu.','push','format','apply','message','exports','util','Undefined\x20error.'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x6bfa,0x140));var _0xa6bf=function(_0x2442a8,_0x3e0d90){_0x2442a8=_0x2442a8-0x0;var _0x105340=_0x6bfa[_0x2442a8];return _0x105340;};'use strict';var util=require(_0xa6bf('0x0'));var error={'E_AGI_UNDEFINED':_0xa6bf('0x1'),'E_AGI_ARGUMENT_PORT':_0xa6bf('0x2'),'E_AGI_SERVER_ERROR':_0xa6bf('0x3'),'E_AGI_SERVER_CLOSE':'Server\x20closed.','E_AGI_SERVER_MAXCONNECTION':'[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','E_AGI_SERVER_VOICE_DISABLED':_0xa6bf('0x4'),'E_AGI_SOCKET_ERROR':'Socket\x20error.\x20Code:\x20%s.','E_AGI_SOCKET_CLOSE':_0xa6bf('0x5'),'E_AGI_SOCKET_TIMEOUT':_0xa6bf('0x6'),'E_AGI_COMMAND_EMPTY':_0xa6bf('0x7'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':'Missing\x20\x27ivr.agi_network_script\x27.','E_AGI_IVR_ENTRY':_0xa6bf('0x8')};function AGIError(_0x43e34b){var _0x43e34b=_0x43e34b||null,_0xeac108=_0xeac108||[],_0x38a87c=0x1,_0x26d04e='';if(!error[_0x43e34b]){_0x43e34b='E_AGI_UNDEFINED';}_0xeac108[_0xa6bf('0x9')](error[_0x43e34b]);while(arguments[_0x38a87c]){_0xeac108[_0xa6bf('0x9')](arguments[_0x38a87c]);_0x38a87c++;}_0x26d04e=util[_0xa6bf('0xa')][_0xa6bf('0xb')](util,_0xeac108);this[_0xa6bf('0xc')]=_0x26d04e;this['name']=_0x43e34b;}module[_0xa6bf('0xd')]=AGIError; \ No newline at end of file diff --git a/server/services/agi/graph/index.js b/server/services/agi/graph/index.js index 11d5740..409c4c5 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 _0x826a=['vertices','edges','numberOfEdges','addVertex','prototype','push','size','relations','getVertex','traverseBFS','info','no\x20vertex\x20found','stop\x20traverse','length','condition','agicommand','vswitch','default','target','includes','max\x20retry\x20reach','condition\x20not\x20found','exports','lodash','../../../config/logger','agi','menu','getsecretdigits'];(function(_0x736228,_0xff19f2){var _0xda63a8=function(_0x568427){while(--_0x568427){_0x736228['push'](_0x736228['shift']());}};_0xda63a8(++_0xff19f2);}(_0x826a,0x1d7));var _0xa826=function(_0x161af9,_0x4ee29d){_0x161af9=_0x161af9-0x0;var _0x43dbab=_0x826a[_0x161af9];return _0x43dbab;};'use strict';var _=require(_0xa826('0x0'));var logger=require(_0xa826('0x1'))(_0xa826('0x2'));var verticesWithRetry=[_0xa826('0x3'),'getdigits',_0xa826('0x4')];var Graph=function(){this[_0xa826('0x5')]={};this[_0xa826('0x6')]={};this[_0xa826('0x7')]=0x0;};Graph['prototype'][_0xa826('0x8')]=function(_0x960d9e){this[_0xa826('0x5')][_0x960d9e['id']]=_0x960d9e;this[_0xa826('0x6')][_0x960d9e['id']]=[];};Graph[_0xa826('0x9')]['addEdge']=function(_0x3ad79d,_0x5d4894,_0x4b9865){this['edges'][_0x3ad79d][_0xa826('0xa')]({'target':_0x5d4894,'condition':_0x4b9865});this[_0xa826('0x7')]+=0x1;};Graph[_0xa826('0x9')][_0xa826('0xb')]=function(){return _[_0xa826('0xb')](this['vertices']);};Graph['prototype'][_0xa826('0xc')]=function(){return this['numberOfEdges'];};Graph[_0xa826('0x9')][_0xa826('0xd')]=function(_0x3154e5){return this[_0xa826('0x5')][_0x3154e5];};Graph[_0xa826('0x9')][_0xa826('0xe')]=function(_0x4c6548,_0x3e4c9b){if(!this['vertices'][_0x4c6548]){return logger[_0xa826('0xf')](_0xa826('0x10'));}var _0x1240ee=_0x3e4c9b(this[_0xa826('0x5')][_0x4c6548]);if(!_0x1240ee){return logger[_0xa826('0xf')](_0xa826('0x11'));}if(this[_0xa826('0x6')][_0x4c6548][_0xa826('0x12')]===0x0){return logger[_0xa826('0xf')]('no\x20edge/s\x20available');}for(var _0x1850ee=0x0,_0x1ed2cf=[],_0x50e29b=![];_0x1850ee\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','timeout','evtHangup','hangup','sync','production','start','joinAt','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','traverseBFS','clear','vertex','gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','agicommand','response','code','result','isUndefined','toString','agicommand\x20not\x20found','finally','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','continueAt','close','Project\x20%s\x20not\x20published','Project\x20%s\x20not\x20found','voice','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','[LICENSE]','./server','connection','xml2json','lodash','syncho','util','../../config/environment','../../config/logger','../../config/license/util','./rpc','./mailRpc','./graph','./vertices','agi','defaults','127.0.0.1','nextTick','error','stack','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','port','name','message','format','[%s]\x20%s','info','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','callerid','dnid','uniqueid','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','mxGraphModel','root','hasOwnProperty','maxRetry'];(function(_0x521929,_0x479be5){var _0x632436=function(_0x288290){while(--_0x288290){_0x521929['push'](_0x521929['shift']());}};_0x632436(++_0x479be5);}(_0xbc0b,0xf1));var _0xbbc0=function(_0x101e7b,_0x4ef05b){_0x101e7b=_0x101e7b-0x0;var _0x4995c0=_0xbc0b[_0x101e7b];return _0x4995c0;};'use strict';var parser=require(_0xbbc0('0x0'));var _=require(_0xbbc0('0x1'));var syncho=require(_0xbbc0('0x2'));var util=require(_0xbbc0('0x3'));var moment=require('moment');var config=require(_0xbbc0('0x4'));var logger=require(_0xbbc0('0x5'))('agi');var utilLicense=require(_0xbbc0('0x6'));var rpc=require(_0xbbc0('0x7'));var mailRpc=require(_0xbbc0('0x8'));var Graph=require(_0xbbc0('0x9'));var Vertices=require(_0xbbc0('0xa'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config[_0xbbc0('0xb')]=_[_0xbbc0('0xc')](config[_0xbbc0('0xb')],{'ip':_0xbbc0('0xd'),'port':0x11dd});function connectionHandler(_0x26a635){process[_0xbbc0('0xe')](function(){syncho(function(){try{setChannelVariables(_0x26a635);agiHandler(_0x26a635);}catch(_0x580b75){logger[_0xbbc0('0xf')](_0x580b75[_0xbbc0('0x10')]);}});});}function listeningHandler(){console['log'](_0xbbc0('0x11'),config[_0xbbc0('0xb')][_0xbbc0('0x12')]);logger['info'](util['format']('[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d',config[_0xbbc0('0xb')]['ip'],config[_0xbbc0('0xb')][_0xbbc0('0x12')]));}function errorHandler(_0x40fa8b){if(_0x40fa8b&&_0x40fa8b[_0xbbc0('0x13')]&&_0x40fa8b[_0xbbc0('0x14')]){logger['error'](util[_0xbbc0('0x15')](_0xbbc0('0x16'),_0x40fa8b['name'],_0x40fa8b[_0xbbc0('0x14')]));}else{logger[_0xbbc0('0xf')](util[_0xbbc0('0x15')]('[ERROR]\x20%s',_0x40fa8b[_0xbbc0('0x10')]));}}function closeHandler(){logger[_0xbbc0('0x17')](util['format'](_0xbbc0('0x18'),this[_0xbbc0('0x19')],this[_0xbbc0('0x1a')],this[_0xbbc0('0x1b')],this[_0xbbc0('0x1c')],this[_0xbbc0('0x1d')]));try{createSquareReport(this);}catch(_0x22f4b2){logger[_0xbbc0('0xf')](_0x22f4b2[_0xbbc0('0x10')]);}}function timeoutHandler(){logger['info'](util[_0xbbc0('0x15')]('[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0xbbc0('0x19')],this[_0xbbc0('0x1a')],this[_0xbbc0('0x1b')],this[_0xbbc0('0x1c')],this['uniqueid']));}function hangupHandler(){logger[_0xbbc0('0x17')](util['format'](_0xbbc0('0x1e'),this['arg_1'],this[_0xbbc0('0x1a')],this['callerid'],this[_0xbbc0('0x1c')],this['uniqueid']));this['evtHangup']=!![];}function getRoot(_0x36cb2b){return parser['toJson'](_0x36cb2b,{'object':!![]})[_0xbbc0('0x1f')][_0xbbc0('0x20')];}function addVertex(_0x1e3842,_0x55ce71,_0x25f25f){_0x55ce71['agicommand']=_0x25f25f;if(_0x55ce71[_0xbbc0('0x21')]('retry')){_0x55ce71[_0xbbc0('0x22')]=parseInt(_0x55ce71['retry'],0xa);}_0x1e3842[_0xbbc0('0x23')](_[_0xbbc0('0x24')](_0x55ce71,_0xbbc0('0x25')));}function initGraph(_0x3131da,_0x344c7e){var _0x53cff5=new Graph();for(var _0x3004d7 in _0x3131da){if(_0x3131da['hasOwnProperty'](_0x3004d7)){if(_['isArray'](_0x3131da[_0x3004d7])){for(var _0xa52b1d=0x0;_0xa52b1d<_0x3131da[_0x3004d7][_0xbbc0('0x26')];_0xa52b1d+=0x1){addVertex(_0x53cff5,_0x3131da[_0x3004d7][_0xa52b1d],_0x3004d7);}}else{addVertex(_0x53cff5,_0x3131da[_0x3004d7],_0x3004d7);}}}for(var _0x5250b7=0x0;_0x5250b7<_0x344c7e[_0xbbc0('0x26')];_0x5250b7+=0x1){if(_0x344c7e[_0x5250b7][_0xbbc0('0x27')]&&_0x344c7e[_0x5250b7][_0xbbc0('0x28')]){_0x53cff5[_0xbbc0('0x29')](_0x344c7e[_0x5250b7][_0xbbc0('0x27')],_0x344c7e[_0x5250b7][_0xbbc0('0x28')],_0x344c7e[_0x5250b7][_0xbbc0('0x2a')]);}}return _0x53cff5;}function getSquareProject(_0x1898eb,_0x3afa20){rpc[_0xbbc0('0x2b')](_0x1898eb)[_0xbbc0('0x2c')](function(_0x2d33b8){_0x3afa20(null,_0x2d33b8);})[_0xbbc0('0x2d')](function(_0x749b2b){_0x3afa20(null,_0x749b2b);});}function createSquareReport(_0x161847,_0x16eb2d){rpc[_0xbbc0('0x2e')](_0x161847)[_0xbbc0('0x2c')](function(_0x2afe96){if(_0x16eb2d){_0x16eb2d(null,_0x2afe96);}})[_0xbbc0('0x2d')](function(_0x54ee34){if(_0x16eb2d){_0x16eb2d(null,_0x54ee34);}});}function setChannelVariables(_0x484a31){for(var _0x5c8ccb in _0x484a31){if(_0x484a31['hasOwnProperty'](_0x5c8ccb)){if(_0x5c8ccb['indexOf'](_0xbbc0('0x2f'))===0x0){_0x484a31[_0x5c8ccb[_0xbbc0('0x30')](0x4)]=_0x484a31[_0x5c8ccb];delete _0x484a31[_0x5c8ccb];}}}}function getLogFromObject(_0x5e9fcf){return util[_0xbbc0('0x31')](_0x5e9fcf,{'showHidden':![],'depth':null});}function agiHandler(_0x1dc3c5){var _0x10a8cf,_0x4c09ab,_0x5c0064,_0x1c4cf1,_0x434c3b;logger[_0xbbc0('0x32')](_0xbbc0('0x33'),JSON[_0xbbc0('0x34')](_0x1dc3c5,null,0x2));logger[_0xbbc0('0x17')](util['format'](_0xbbc0('0x35'),_0x1dc3c5[_0xbbc0('0x19')],_0x1dc3c5[_0xbbc0('0x1a')],_0x1dc3c5[_0xbbc0('0x1b')],_0x1dc3c5[_0xbbc0('0x1c')],_0x1dc3c5[_0xbbc0('0x1d')]));_0x1dc3c5['on'](_0xbbc0('0xf'),errorHandler);_0x1dc3c5['on']('close',closeHandler);_0x1dc3c5['on'](_0xbbc0('0x36'),timeoutHandler);_0x1dc3c5[_0xbbc0('0x37')]=![];_0x1dc3c5['on'](_0xbbc0('0x38'),hangupHandler);var _0x45e2d5=getSquareProject[_0xbbc0('0x39')](null,_0x1dc3c5[_0xbbc0('0x19')]);if(_0x45e2d5){if(_0x45e2d5[_0xbbc0('0x3a')]){_0x10a8cf=getRoot(_0x45e2d5[_0xbbc0('0x3a')]);if(_0x10a8cf&&_0x10a8cf[_0xbbc0('0x3b')]){logger[_0xbbc0('0x32')](_0xbbc0('0x20'),JSON[_0xbbc0('0x34')](_0x10a8cf,null,0x2));_0x1dc3c5[_0xbbc0('0x3c')]=moment()[_0xbbc0('0x15')]('YYYY-MM-DD\x20HH:mm:ss');_0x4c09ab=initGraph(_[_0xbbc0('0x24')](_0x10a8cf,_0xbbc0('0x25')),_0x10a8cf[_0xbbc0('0x25')]);_0x5c0064=new Vertices(_0x1dc3c5,rpc,mailRpc);logger[_0xbbc0('0x17')](util[_0xbbc0('0x15')](_0xbbc0('0x3d'),_0x1dc3c5[_0xbbc0('0x19')],_0x1dc3c5['calleridname'],_0x1dc3c5[_0xbbc0('0x1b')],_0x1dc3c5['dnid'],_0x1dc3c5[_0xbbc0('0x1d')]));_0x4c09ab[_0xbbc0('0x3e')](_0x10a8cf['start']['id'],function(_0x4ec48f){try{_0x4ec48f=_0x5c0064[_0xbbc0('0x3f')](_0x4ec48f);logger['debug'](_0xbbc0('0x40'),JSON[_0xbbc0('0x34')](_0x4ec48f,null,0x2));if(_0x4ec48f['agicommand']===_0xbbc0('0x41')){logger[_0xbbc0('0x17')](_0xbbc0('0x42'));_0x1dc3c5[_0xbbc0('0x43')]=_0x4ec48f[_0xbbc0('0x43')]||_0x1dc3c5['context'];_0x1dc3c5['extension']=_0x4ec48f[_0xbbc0('0x44')];_0x1dc3c5[_0xbbc0('0x45')]=_0x4ec48f[_0xbbc0('0x45')]?_0x4ec48f[_0xbbc0('0x45')]-0x1:0x1;return null;}else if(_0x4ec48f&&_0x5c0064[_0x4ec48f[_0xbbc0('0x46')]]){_0x434c3b=_0x5c0064[_0x4ec48f[_0xbbc0('0x46')]](_0x4ec48f);logger['info'](_0xbbc0('0x47'),JSON[_0xbbc0('0x34')](_0x434c3b,null,0x2));if(_0x434c3b&&_0x434c3b[_0xbbc0('0x48')]===AGI_CODE_SUCCESS&&_0x434c3b[_0xbbc0('0x49')]!==AGI_RESULT_ERROR&&!_0x1dc3c5[_0xbbc0('0x37')]){logger['debug'](_0xbbc0('0x47'),getLogFromObject(_0x434c3b));return _[_0xbbc0('0x4a')](_0x434c3b[_0xbbc0('0x49')])?null:_0x434c3b[_0xbbc0('0x49')][_0xbbc0('0x4b')]();}else{logger[_0xbbc0('0xf')](_0xbbc0('0x47'),getLogFromObject(_0x434c3b));return null;}}else{logger[_0xbbc0('0xf')](_0xbbc0('0x4c'));return null;}}catch(_0x5cb16a){logger[_0xbbc0('0xf')](_0x5cb16a['stack']);return null;}});if(_0x10a8cf[_0xbbc0('0x4d')]){logger[_0xbbc0('0x17')](util[_0xbbc0('0x15')]('[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x1dc3c5[_0xbbc0('0x19')],_0x1dc3c5['calleridname'],_0x1dc3c5['callerid'],_0x1dc3c5[_0xbbc0('0x1c')],_0x1dc3c5[_0xbbc0('0x1d')]));_0x4c09ab['traverseBFS'](_0x10a8cf[_0xbbc0('0x4d')]['id'],function(_0x495499){try{_0x495499=_0x5c0064['clear'](_0x495499);logger[_0xbbc0('0x32')](_0xbbc0('0x40'),JSON[_0xbbc0('0x34')](_0x495499,null,0x2));if(_0x495499&&_0x5c0064[_0x495499[_0xbbc0('0x46')]]){_0x434c3b=_0x5c0064[_0x495499[_0xbbc0('0x46')]](_0x495499);if(_0x434c3b){logger[_0xbbc0('0x32')](_0xbbc0('0x47'),getLogFromObject(_0x434c3b));return _[_0xbbc0('0x4a')](_0x434c3b[_0xbbc0('0x49')])?null:_0x434c3b[_0xbbc0('0x49')]['toString']();}else{logger[_0xbbc0('0xf')](_0xbbc0('0x47'),getLogFromObject(_0x434c3b));return null;}}else{logger[_0xbbc0('0xf')](_0xbbc0('0x4c'));return null;}}catch(_0x667eeb){logger['error'](_0x667eeb[_0xbbc0('0x10')]);return null;}});}logger[_0xbbc0('0x17')](util[_0xbbc0('0x15')](_0xbbc0('0x4e'),_0x1dc3c5[_0xbbc0('0x19')],_0x1dc3c5[_0xbbc0('0x1a')],_0x1dc3c5[_0xbbc0('0x1b')],_0x1dc3c5[_0xbbc0('0x1c')],_0x1dc3c5[_0xbbc0('0x1d')]));logger[_0xbbc0('0x17')](util[_0xbbc0('0x15')](_0xbbc0('0x4f'),_0x1dc3c5[_0xbbc0('0x43')],_0x1dc3c5[_0xbbc0('0x44')],parseInt(_0x1dc3c5['priority'],0xa)+0x1));_0x1dc3c5[_0xbbc0('0x50')](_0x1dc3c5['context'],_0x1dc3c5[_0xbbc0('0x44')],parseInt(_0x1dc3c5[_0xbbc0('0x45')],0xa)+0x1);_0x1dc3c5[_0xbbc0('0x51')]();}}else{logger[_0xbbc0('0xf')](util['format'](_0xbbc0('0x52'),_0x1dc3c5[_0xbbc0('0x19')]));_0x1dc3c5[_0xbbc0('0x50')](_0x1dc3c5['context'],_0x1dc3c5[_0xbbc0('0x44')],parseInt(_0x1dc3c5[_0xbbc0('0x45')],0xa)+0x1);_0x1dc3c5[_0xbbc0('0x51')]();}}else{logger[_0xbbc0('0xf')](util[_0xbbc0('0x15')](_0xbbc0('0x53'),_0x1dc3c5[_0xbbc0('0x19')]));_0x1dc3c5['continueAt'](_0x1dc3c5[_0xbbc0('0x43')],_0x1dc3c5[_0xbbc0('0x44')],parseInt(_0x1dc3c5[_0xbbc0('0x45')],0xa)+0x1);_0x1dc3c5[_0xbbc0('0x51')]();}}function main(){var _0x19e3a6;return utilLicense['getLicense']()[_0xbbc0('0x2c')](function(_0x1037cf){if(_0x1037cf){if(_0x1037cf[_0xbbc0('0x54')]){if(_0x1037cf['callysquare']&&_0x1037cf[_0xbbc0('0x55')]>0x0){logger[_0xbbc0('0x17')](util[_0xbbc0('0x15')](_0xbbc0('0x56'),_0x1037cf[_0xbbc0('0x55')]));_0x19e3a6=_0x1037cf[_0xbbc0('0x55')];}else{logger['info'](_0xbbc0('0x57'));}}else{logger[_0xbbc0('0x17')](_0xbbc0('0x58'));_0x19e3a6=-0x1;}}})[_0xbbc0('0x2d')](function(_0x5c17be){logger['error'](_0xbbc0('0x59'),_0x5c17be['stack']);})[_0xbbc0('0x4d')](function(){var _0x3f4d4d=require(_0xbbc0('0x5a'))(config[_0xbbc0('0xb')][_0xbbc0('0x12')],config['agi']['ip'],_0x19e3a6);_0x3f4d4d['on']('error',errorHandler);_0x3f4d4d['on']('listening',listeningHandler);_0x3f4d4d['on'](_0xbbc0('0x5b'),connectionHandler);_0x3f4d4d['on']('close',closeHandler);});}main(); \ No newline at end of file +var _0x0680=['continueAt','Project\x20%s\x20not\x20published','voice','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','[LICENSE]','./server','listening','xml2json','lodash','syncho','util','moment','../../config/environment','../../config/logger','agi','../../config/license/util','./rpc','./mailRpc','./graph','./vertices','defaults','127.0.0.1','nextTick','stack','log','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','port','info','format','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','name','message','error','[%s]\x20%s','[ERROR]\x20%s','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','calleridname','callerid','dnid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','uniqueid','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','mxGraphModel','agicommand','maxRetry','retry','addVertex','omit','mxCell','hasOwnProperty','isArray','length','source','addEdge','target','value','getSquareProject','then','catch','createSquareReport','indexOf','agi_','debug','variables','stringify','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close','timeout','evtHangup','hangup','sync','production','start','YYYY-MM-DD\x20HH:mm:ss','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','clear','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','result','response','isUndefined','toString','finally','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','traverseBFS','vertex','agicommand\x20not\x20found','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s'];(function(_0x5950f1,_0x1a5c72){var _0x2ea241=function(_0x1c357d){while(--_0x1c357d){_0x5950f1['push'](_0x5950f1['shift']());}};_0x2ea241(++_0x1a5c72);}(_0x0680,0x1e5));var _0x0068=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0680[_0x3dd15e];return _0x231fd0;};'use strict';var parser=require(_0x0068('0x0'));var _=require(_0x0068('0x1'));var syncho=require(_0x0068('0x2'));var util=require(_0x0068('0x3'));var moment=require(_0x0068('0x4'));var config=require(_0x0068('0x5'));var logger=require(_0x0068('0x6'))(_0x0068('0x7'));var utilLicense=require(_0x0068('0x8'));var rpc=require(_0x0068('0x9'));var mailRpc=require(_0x0068('0xa'));var Graph=require(_0x0068('0xb'));var Vertices=require(_0x0068('0xc'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config[_0x0068('0x7')]=_[_0x0068('0xd')](config[_0x0068('0x7')],{'ip':_0x0068('0xe'),'port':0x11dd});function connectionHandler(_0x3f8388){process[_0x0068('0xf')](function(){syncho(function(){try{setChannelVariables(_0x3f8388);agiHandler(_0x3f8388);}catch(_0x548913){logger['error'](_0x548913[_0x0068('0x10')]);}});});}function listeningHandler(){console[_0x0068('0x11')](_0x0068('0x12'),config[_0x0068('0x7')][_0x0068('0x13')]);logger[_0x0068('0x14')](util[_0x0068('0x15')](_0x0068('0x16'),config[_0x0068('0x7')]['ip'],config[_0x0068('0x7')][_0x0068('0x13')]));}function errorHandler(_0x196b43){if(_0x196b43&&_0x196b43[_0x0068('0x17')]&&_0x196b43[_0x0068('0x18')]){logger[_0x0068('0x19')](util[_0x0068('0x15')](_0x0068('0x1a'),_0x196b43[_0x0068('0x17')],_0x196b43['message']));}else{logger[_0x0068('0x19')](util[_0x0068('0x15')](_0x0068('0x1b'),_0x196b43['stack']));}}function closeHandler(){logger['info'](util['format'](_0x0068('0x1c'),this['arg_1'],this[_0x0068('0x1d')],this[_0x0068('0x1e')],this[_0x0068('0x1f')],this['uniqueid']));try{createSquareReport(this);}catch(_0x885c0c){logger['error'](_0x885c0c[_0x0068('0x10')]);}}function timeoutHandler(){logger[_0x0068('0x14')](util[_0x0068('0x15')](_0x0068('0x20'),this[_0x0068('0x21')],this[_0x0068('0x1d')],this['callerid'],this[_0x0068('0x1f')],this[_0x0068('0x22')]));}function hangupHandler(){logger[_0x0068('0x14')](util[_0x0068('0x15')](_0x0068('0x23'),this[_0x0068('0x21')],this[_0x0068('0x1d')],this[_0x0068('0x1e')],this[_0x0068('0x1f')],this[_0x0068('0x22')]));this['evtHangup']=!![];}function getRoot(_0x5cafe0){return parser['toJson'](_0x5cafe0,{'object':!![]})[_0x0068('0x24')]['root'];}function addVertex(_0x5be626,_0x149bac,_0x2cc2d5){_0x149bac[_0x0068('0x25')]=_0x2cc2d5;if(_0x149bac['hasOwnProperty']('retry')){_0x149bac[_0x0068('0x26')]=parseInt(_0x149bac[_0x0068('0x27')],0xa);}_0x5be626[_0x0068('0x28')](_[_0x0068('0x29')](_0x149bac,_0x0068('0x2a')));}function initGraph(_0x3b5f87,_0x43b58d){var _0x4162c2=new Graph();for(var _0x185921 in _0x3b5f87){if(_0x3b5f87[_0x0068('0x2b')](_0x185921)){if(_[_0x0068('0x2c')](_0x3b5f87[_0x185921])){for(var _0x409953=0x0;_0x409953<_0x3b5f87[_0x185921][_0x0068('0x2d')];_0x409953+=0x1){addVertex(_0x4162c2,_0x3b5f87[_0x185921][_0x409953],_0x185921);}}else{addVertex(_0x4162c2,_0x3b5f87[_0x185921],_0x185921);}}}for(var _0x55d39b=0x0;_0x55d39b<_0x43b58d[_0x0068('0x2d')];_0x55d39b+=0x1){if(_0x43b58d[_0x55d39b][_0x0068('0x2e')]&&_0x43b58d[_0x55d39b]['target']){_0x4162c2[_0x0068('0x2f')](_0x43b58d[_0x55d39b]['source'],_0x43b58d[_0x55d39b][_0x0068('0x30')],_0x43b58d[_0x55d39b][_0x0068('0x31')]);}}return _0x4162c2;}function getSquareProject(_0x83afb9,_0x28c05e){rpc[_0x0068('0x32')](_0x83afb9)[_0x0068('0x33')](function(_0x38b759){_0x28c05e(null,_0x38b759);})[_0x0068('0x34')](function(_0x3d0c43){_0x28c05e(null,_0x3d0c43);});}function createSquareReport(_0x498147,_0x467385){rpc[_0x0068('0x35')](_0x498147)['then'](function(_0x45d441){if(_0x467385){_0x467385(null,_0x45d441);}})[_0x0068('0x34')](function(_0x44b540){if(_0x467385){_0x467385(null,_0x44b540);}});}function setChannelVariables(_0x3e8fab){for(var _0x15a285 in _0x3e8fab){if(_0x3e8fab[_0x0068('0x2b')](_0x15a285)){if(_0x15a285[_0x0068('0x36')](_0x0068('0x37'))===0x0){_0x3e8fab[_0x15a285['substring'](0x4)]=_0x3e8fab[_0x15a285];delete _0x3e8fab[_0x15a285];}}}}function getLogFromObject(_0x228c65){return util['inspect'](_0x228c65,{'showHidden':![],'depth':null});}function agiHandler(_0x3239f7){var _0x3aaa5b,_0x312a27,_0x318047,_0x4a8c00,_0x46e3a3;logger[_0x0068('0x38')](_0x0068('0x39'),JSON[_0x0068('0x3a')](_0x3239f7,null,0x2));logger[_0x0068('0x14')](util['format'](_0x0068('0x3b'),_0x3239f7[_0x0068('0x21')],_0x3239f7[_0x0068('0x1d')],_0x3239f7[_0x0068('0x1e')],_0x3239f7['dnid'],_0x3239f7[_0x0068('0x22')]));_0x3239f7['on'](_0x0068('0x19'),errorHandler);_0x3239f7['on'](_0x0068('0x3c'),closeHandler);_0x3239f7['on'](_0x0068('0x3d'),timeoutHandler);_0x3239f7[_0x0068('0x3e')]=![];_0x3239f7['on'](_0x0068('0x3f'),hangupHandler);var _0x159eee=getSquareProject[_0x0068('0x40')](null,_0x3239f7['arg_1']);if(_0x159eee){if(_0x159eee[_0x0068('0x41')]){_0x3aaa5b=getRoot(_0x159eee['production']);if(_0x3aaa5b&&_0x3aaa5b[_0x0068('0x42')]){logger[_0x0068('0x38')]('root',JSON[_0x0068('0x3a')](_0x3aaa5b,null,0x2));_0x3239f7['joinAt']=moment()[_0x0068('0x15')](_0x0068('0x43'));_0x312a27=initGraph(_[_0x0068('0x29')](_0x3aaa5b,_0x0068('0x2a')),_0x3aaa5b[_0x0068('0x2a')]);_0x318047=new Vertices(_0x3239f7,rpc,mailRpc);logger[_0x0068('0x14')](util[_0x0068('0x15')](_0x0068('0x44'),_0x3239f7[_0x0068('0x21')],_0x3239f7[_0x0068('0x1d')],_0x3239f7[_0x0068('0x1e')],_0x3239f7[_0x0068('0x1f')],_0x3239f7[_0x0068('0x22')]));_0x312a27['traverseBFS'](_0x3aaa5b[_0x0068('0x42')]['id'],function(_0x1807b0){try{_0x1807b0=_0x318047[_0x0068('0x45')](_0x1807b0);logger[_0x0068('0x38')]('vertex',JSON[_0x0068('0x3a')](_0x1807b0,null,0x2));if(_0x1807b0[_0x0068('0x25')]==='gotoc'){logger[_0x0068('0x14')](_0x0068('0x46'));_0x3239f7['context']=_0x1807b0[_0x0068('0x47')]||_0x3239f7[_0x0068('0x47')];_0x3239f7[_0x0068('0x48')]=_0x1807b0[_0x0068('0x48')];_0x3239f7[_0x0068('0x49')]=_0x1807b0[_0x0068('0x49')]?_0x1807b0[_0x0068('0x49')]-0x1:0x1;return null;}else if(_0x1807b0&&_0x318047[_0x1807b0[_0x0068('0x25')]]){_0x46e3a3=_0x318047[_0x1807b0[_0x0068('0x25')]](_0x1807b0);logger[_0x0068('0x14')]('response',JSON[_0x0068('0x3a')](_0x46e3a3,null,0x2));if(_0x46e3a3&&_0x46e3a3['code']===AGI_CODE_SUCCESS&&_0x46e3a3[_0x0068('0x4a')]!==AGI_RESULT_ERROR&&!_0x3239f7[_0x0068('0x3e')]){logger[_0x0068('0x38')](_0x0068('0x4b'),getLogFromObject(_0x46e3a3));return _[_0x0068('0x4c')](_0x46e3a3[_0x0068('0x4a')])?null:_0x46e3a3[_0x0068('0x4a')][_0x0068('0x4d')]();}else{logger[_0x0068('0x19')](_0x0068('0x4b'),getLogFromObject(_0x46e3a3));return null;}}else{logger[_0x0068('0x19')]('agicommand\x20not\x20found');return null;}}catch(_0x52455e){logger['error'](_0x52455e[_0x0068('0x10')]);return null;}});if(_0x3aaa5b[_0x0068('0x4e')]){logger[_0x0068('0x14')](util[_0x0068('0x15')](_0x0068('0x4f'),_0x3239f7[_0x0068('0x21')],_0x3239f7[_0x0068('0x1d')],_0x3239f7['callerid'],_0x3239f7[_0x0068('0x1f')],_0x3239f7['uniqueid']));_0x312a27[_0x0068('0x50')](_0x3aaa5b['finally']['id'],function(_0x2cdc65){try{_0x2cdc65=_0x318047[_0x0068('0x45')](_0x2cdc65);logger[_0x0068('0x38')](_0x0068('0x51'),JSON[_0x0068('0x3a')](_0x2cdc65,null,0x2));if(_0x2cdc65&&_0x318047[_0x2cdc65[_0x0068('0x25')]]){_0x46e3a3=_0x318047[_0x2cdc65[_0x0068('0x25')]](_0x2cdc65);if(_0x46e3a3){logger[_0x0068('0x38')]('response',getLogFromObject(_0x46e3a3));return _['isUndefined'](_0x46e3a3[_0x0068('0x4a')])?null:_0x46e3a3[_0x0068('0x4a')][_0x0068('0x4d')]();}else{logger['error'](_0x0068('0x4b'),getLogFromObject(_0x46e3a3));return null;}}else{logger[_0x0068('0x19')](_0x0068('0x52'));return null;}}catch(_0xce805b){logger[_0x0068('0x19')](_0xce805b['stack']);return null;}});}logger[_0x0068('0x14')](util[_0x0068('0x15')](_0x0068('0x53'),_0x3239f7[_0x0068('0x21')],_0x3239f7[_0x0068('0x1d')],_0x3239f7['callerid'],_0x3239f7[_0x0068('0x1f')],_0x3239f7[_0x0068('0x22')]));logger['info'](util[_0x0068('0x15')](_0x0068('0x54'),_0x3239f7['context'],_0x3239f7[_0x0068('0x48')],parseInt(_0x3239f7[_0x0068('0x49')],0xa)+0x1));_0x3239f7[_0x0068('0x55')](_0x3239f7[_0x0068('0x47')],_0x3239f7['extension'],parseInt(_0x3239f7[_0x0068('0x49')],0xa)+0x1);_0x3239f7[_0x0068('0x3c')]();}}else{logger['error'](util[_0x0068('0x15')](_0x0068('0x56'),_0x3239f7['arg_1']));_0x3239f7[_0x0068('0x55')](_0x3239f7[_0x0068('0x47')],_0x3239f7[_0x0068('0x48')],parseInt(_0x3239f7[_0x0068('0x49')],0xa)+0x1);_0x3239f7[_0x0068('0x3c')]();}}else{logger[_0x0068('0x19')](util[_0x0068('0x15')]('Project\x20%s\x20not\x20found',_0x3239f7[_0x0068('0x21')]));_0x3239f7[_0x0068('0x55')](_0x3239f7[_0x0068('0x47')],_0x3239f7[_0x0068('0x48')],parseInt(_0x3239f7[_0x0068('0x49')],0xa)+0x1);_0x3239f7[_0x0068('0x3c')]();}}function main(){var _0x29a347;return utilLicense['getLicense']()['then'](function(_0x1a7280){if(_0x1a7280){if(_0x1a7280[_0x0068('0x57')]){if(_0x1a7280[_0x0068('0x58')]&&_0x1a7280['callysquare']>0x0){logger[_0x0068('0x14')](util[_0x0068('0x15')](_0x0068('0x59'),_0x1a7280[_0x0068('0x58')]));_0x29a347=_0x1a7280['callysquare'];}else{logger[_0x0068('0x14')](_0x0068('0x5a'));}}else{logger['info'](_0x0068('0x5b'));_0x29a347=-0x1;}}})[_0x0068('0x34')](function(_0x1206a1){logger[_0x0068('0x19')](_0x0068('0x5c'),_0x1206a1['stack']);})[_0x0068('0x4e')](function(){var _0x87c453=require(_0x0068('0x5d'))(config[_0x0068('0x7')][_0x0068('0x13')],config[_0x0068('0x7')]['ip'],_0x29a347);_0x87c453['on'](_0x0068('0x19'),errorHandler);_0x87c453['on'](_0x0068('0x5e'),listeningHandler);_0x87c453['on']('connection',connectionHandler);_0x87c453['on'](_0x0068('0x3c'),closeHandler);});}main(); \ No newline at end of file diff --git a/server/services/agi/mailRpc/index.js b/server/services/agi/mailRpc/index.js index fac0e98..c1c6950 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 _0xa4f1=['sendMailMessage','SendMail','jayson/promise','request','then','error','result','catch'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xa4f1,0x132));var _0x1a4f=function(_0x42bdad,_0x12836c){_0x42bdad=_0x42bdad-0x0;var _0x122626=_0xa4f1[_0x42bdad];return _0x122626;};'use strict';var BPromise=require('bluebird');var jayson=require(_0x1a4f('0x0'));var client=jayson['client']['http']({'port':0x232b});function request(_0x5466d5,_0x13c15d){return new BPromise(function(_0x367c5e,_0xda4077){return client[_0x1a4f('0x1')](_0x5466d5,_0x13c15d)[_0x1a4f('0x2')](function(_0x358f19){if(_0x358f19[_0x1a4f('0x3')]){return _0xda4077(_0x358f19[_0x1a4f('0x3')]['message']);}else{return _0x367c5e(_0x358f19[_0x1a4f('0x4')]);}})[_0x1a4f('0x5')](function(_0x463686){return _0xda4077(_0x463686);});});}exports[_0x1a4f('0x6')]=function(_0x5498d1,_0x528a8a){return request(_0x1a4f('0x7'),{'account':_0x5498d1,'message':_0x528a8a});}; \ No newline at end of file +var _0xa409=['error','message','catch','sendMailMessage','SendMail','bluebird','jayson/promise','client','request','then'];(function(_0x7261e6,_0x3e3bf7){var _0x20d5ed=function(_0x522641){while(--_0x522641){_0x7261e6['push'](_0x7261e6['shift']());}};_0x20d5ed(++_0x3e3bf7);}(_0xa409,0xb9));var _0x9a40=function(_0x2b44ce,_0x14ada8){_0x2b44ce=_0x2b44ce-0x0;var _0x44ad14=_0xa409[_0x2b44ce];return _0x44ad14;};'use strict';var BPromise=require(_0x9a40('0x0'));var jayson=require(_0x9a40('0x1'));var client=jayson[_0x9a40('0x2')]['http']({'port':0x232b});function request(_0x45581f,_0x182460){return new BPromise(function(_0x103d37,_0x5a16ee){return client[_0x9a40('0x3')](_0x45581f,_0x182460)[_0x9a40('0x4')](function(_0x4e7f2d){if(_0x4e7f2d[_0x9a40('0x5')]){return _0x5a16ee(_0x4e7f2d[_0x9a40('0x5')][_0x9a40('0x6')]);}else{return _0x103d37(_0x4e7f2d['result']);}})[_0x9a40('0x7')](function(_0x2af459){return _0x5a16ee(_0x2af459);});});}exports[_0x9a40('0x8')]=function(_0x385f6f,_0x597e81){return request(_0x9a40('0x9'),{'account':_0x385f6f,'message':_0x597e81});}; \ No newline at end of file diff --git a/server/services/agi/reply.js b/server/services/agi/reply.js index e86feeb..1e84be7 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 _0xe559=['call','_localBuffer','_inBody','\x0d\x0a\x0d\x0a','indexOf','substring','length','split','slice','trim','headers','emit','exports','util','stream'];(function(_0x15da16,_0x279689){var _0x498922=function(_0x4de3cb){while(--_0x4de3cb){_0x15da16['push'](_0x15da16['shift']());}};_0x498922(++_0x279689);}(_0xe559,0xc1));var _0x9e55=function(_0x4b7bd7,_0x511b87){_0x4b7bd7=_0x4b7bd7-0x0;var _0x4fe4a0=_0xe559[_0x4b7bd7];return _0x4fe4a0;};'use strict';var util=require(_0x9e55('0x0'));var Transform=require(_0x9e55('0x1'))['Transform'];function AGIReply(_0x2a85a7){Transform[_0x9e55('0x2')](this,_0x2a85a7);this[_0x9e55('0x3')]='';this[_0x9e55('0x4')]=![];}util['inherits'](AGIReply,Transform);AGIReply['prototype']['_transform']=function(_0x2f8e65,_0x234ad0,_0x3f52d0){var _0x488459='\x0a',_0x51599c=['\x0a\x0a',_0x9e55('0x5')],_0x240e85=-0x1,_0x4951b2=-0x1,_0x459f3d='',_0x330914=0x0,_0x3ffb42='',_0x299c8a='';this[_0x9e55('0x3')]+=_0x2f8e65['toString']();_0x3ffb42=this[_0x9e55('0x3')];if(!this[_0x9e55('0x4')]){_0x330914=0x0;while(_0x51599c[_0x330914]){while((_0x4951b2=_0x3ffb42[_0x9e55('0x6')](_0x51599c[_0x330914]))!=-0x1){_0x459f3d=_0x51599c[_0x330914];_0x299c8a=_0x3ffb42[_0x9e55('0x7')](0x0,_0x4951b2);_0x3ffb42=_0x3ffb42['substring'](_0x4951b2+_0x459f3d[_0x9e55('0x8')]);var _0x14c304=_0x299c8a[_0x9e55('0x9')](_0x488459),_0xb6ed1b=0x0,_0x3aff71={},_0x418493='',_0x3d3a3a='',_0x31f22e=-0x1;while(_0x14c304[_0xb6ed1b]){_0x31f22e=_0x14c304[_0xb6ed1b][_0x9e55('0x6')](':');if(_0x31f22e!=-0x1){_0x418493=_0x14c304[_0xb6ed1b][_0x9e55('0xa')](0x0,_0x31f22e)[_0x9e55('0xb')]();_0x3d3a3a=_0x14c304[_0xb6ed1b][_0x9e55('0xa')](_0x31f22e+0x1)['trim']();if(_0x418493[_0x9e55('0x8')]>0x0){_0x3aff71[_0x418493]=_0x3d3a3a;}}else{}_0xb6ed1b++;}this['emit'](_0x9e55('0xc'),_0x3aff71);this[_0x9e55('0x4')]=!![];}_0x330914++;}this[_0x9e55('0x3')]=_0x3ffb42;}else{while((_0x240e85=_0x3ffb42[_0x9e55('0x6')](_0x488459))!=-0x1){_0x299c8a=_0x3ffb42[_0x9e55('0x7')](0x0,_0x240e85);this[_0x9e55('0xd')]('line',_0x299c8a);_0x3ffb42=_0x3ffb42[_0x9e55('0x7')](_0x240e85+_0x488459[_0x9e55('0x8')]);}this['_localBuffer']=_0x3ffb42;}_0x3f52d0();};module[_0x9e55('0xe')]=AGIReply; \ No newline at end of file +var _0x84a0=['split','slice','trim','emit','headers','exports','util','stream','Transform','_localBuffer','_inBody','_transform','\x0d\x0a\x0d\x0a','indexOf','substring','length'];(function(_0x3fce35,_0x44a2a4){var _0x337b34=function(_0x475d0a){while(--_0x475d0a){_0x3fce35['push'](_0x3fce35['shift']());}};_0x337b34(++_0x44a2a4);}(_0x84a0,0x66));var _0x084a=function(_0x1df5cd,_0x3dc641){_0x1df5cd=_0x1df5cd-0x0;var _0xf6df9b=_0x84a0[_0x1df5cd];return _0xf6df9b;};'use strict';var util=require(_0x084a('0x0'));var Transform=require(_0x084a('0x1'))[_0x084a('0x2')];function AGIReply(_0x1fff7f){Transform['call'](this,_0x1fff7f);this[_0x084a('0x3')]='';this[_0x084a('0x4')]=![];}util['inherits'](AGIReply,Transform);AGIReply['prototype'][_0x084a('0x5')]=function(_0x1c0292,_0x5617b5,_0x16f8a7){var _0x4325ce='\x0a',_0x2e6810=['\x0a\x0a',_0x084a('0x6')],_0x373d2=-0x1,_0x2b30bc=-0x1,_0x58d419='',_0x1051a9=0x0,_0x13415d='',_0x8198ad='';this[_0x084a('0x3')]+=_0x1c0292['toString']();_0x13415d=this['_localBuffer'];if(!this[_0x084a('0x4')]){_0x1051a9=0x0;while(_0x2e6810[_0x1051a9]){while((_0x2b30bc=_0x13415d[_0x084a('0x7')](_0x2e6810[_0x1051a9]))!=-0x1){_0x58d419=_0x2e6810[_0x1051a9];_0x8198ad=_0x13415d[_0x084a('0x8')](0x0,_0x2b30bc);_0x13415d=_0x13415d[_0x084a('0x8')](_0x2b30bc+_0x58d419[_0x084a('0x9')]);var _0x57c405=_0x8198ad[_0x084a('0xa')](_0x4325ce),_0x4ef41f=0x0,_0xc451b1={},_0x3ca72f='',_0xec90a5='',_0x9245b1=-0x1;while(_0x57c405[_0x4ef41f]){_0x9245b1=_0x57c405[_0x4ef41f][_0x084a('0x7')](':');if(_0x9245b1!=-0x1){_0x3ca72f=_0x57c405[_0x4ef41f][_0x084a('0xb')](0x0,_0x9245b1)[_0x084a('0xc')]();_0xec90a5=_0x57c405[_0x4ef41f]['slice'](_0x9245b1+0x1)[_0x084a('0xc')]();if(_0x3ca72f['length']>0x0){_0xc451b1[_0x3ca72f]=_0xec90a5;}}else{}_0x4ef41f++;}this[_0x084a('0xd')](_0x084a('0xe'),_0xc451b1);this[_0x084a('0x4')]=!![];}_0x1051a9++;}this[_0x084a('0x3')]=_0x13415d;}else{while((_0x373d2=_0x13415d[_0x084a('0x7')](_0x4325ce))!=-0x1){_0x8198ad=_0x13415d['substring'](0x0,_0x373d2);this[_0x084a('0xd')]('line',_0x8198ad);_0x13415d=_0x13415d[_0x084a('0x8')](_0x373d2+_0x4325ce[_0x084a('0x9')]);}this['_localBuffer']=_0x13415d;}_0x16f8a7();};module[_0x084a('0xf')]=AGIReply; \ No newline at end of file diff --git a/server/services/agi/rpc/index.js b/server/services/agi/rpc/index.js index 10da9d8..5865a55 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 _0x2c7f=['ShowUser','getTrunkById','ShowTrunk','getSoundById','ShowSound','save_name','getIntervalById','ShowInterval','Interval','Intervals','getSmsAccountById','ShowSmsAccount','createSmsMessage','CreateSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','CreateSquareReport','arg_1','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','CreateSquareRecording','createSquareMessage','CreateSquareMessage','createCmContact','phone','then','ShowPause','agentLogin','LoginUser','agentPause','PauseUser','agentUnpause','UnpauseUser','LogoutUser','moment','lodash','jayson/promise','client','http','request','error','result','getSquareProject','ShowSquareProject','getMailAccountById','ShowMailAccount','MailServerOut','email','name','ShowVoiceQueue','ShowVariable','getSquareOdbcById','ShowSquareOdbc','dsn','getUserById'];(function(_0x4f52b5,_0x2eb457){var _0x475c11=function(_0x378b2c){while(--_0x378b2c){_0x4f52b5['push'](_0x4f52b5['shift']());}};_0x475c11(++_0x2eb457);}(_0x2c7f,0x103));var _0xf2c7=function(_0x27d65c,_0x67181e){_0x27d65c=_0x27d65c-0x0;var _0x1e514b=_0x2c7f[_0x27d65c];return _0x1e514b;};'use strict';var BPromise=require('bluebird');var moment=require(_0xf2c7('0x0'));var _=require(_0xf2c7('0x1'));var util=require('util');var jayson=require(_0xf2c7('0x2'));var client=jayson[_0xf2c7('0x3')][_0xf2c7('0x4')]({'port':0x2329});function request(_0x67a107,_0x3553fd){return new BPromise(function(_0x2145d8,_0x4ea853){return client[_0xf2c7('0x5')](_0x67a107,_0x3553fd)['then'](function(_0x2ddf18){if(_0x2ddf18[_0xf2c7('0x6')]){return _0x4ea853(_0x2ddf18['error']['message']);}else{return _0x2145d8(_0x2ddf18[_0xf2c7('0x7')]);}})['catch'](function(_0x18ae62){return _0x4ea853(_0x18ae62);});});}exports[_0xf2c7('0x8')]=function(_0x22cecb){return request(_0xf2c7('0x9'),{'options':{'raw':![],'where':{'name':_0x22cecb},'attributes':['production']}});};exports[_0xf2c7('0xa')]=function(_0x3df300){return request(_0xf2c7('0xb'),{'options':{'raw':![],'where':{'id':_0x3df300},'include':[{'model':_0xf2c7('0xc'),'as':'Smtp'}],'attributes':['id','name',_0xf2c7('0xd')]}});};exports['getSquareProjectById']=function(_0xc4eade){return request(_0xf2c7('0x9'),{'options':{'where':{'id':_0xc4eade},'attributes':[_0xf2c7('0xe')]}});};exports['getVoiceQueueById']=function(_0x3f0de7){return request(_0xf2c7('0xf'),{'options':{'where':{'id':_0x3f0de7},'attributes':[_0xf2c7('0xe')]}});};exports['getVariableById']=function(_0xea2575){return request(_0xf2c7('0x10'),{'options':{'where':{'id':_0xea2575},'attributes':[_0xf2c7('0xe')]}});};exports[_0xf2c7('0x11')]=function(_0x4e5114){return request(_0xf2c7('0x12'),{'options':{'where':{'id':_0x4e5114},'attributes':[_0xf2c7('0x13')]}});};exports[_0xf2c7('0x14')]=function(_0x23d1d8){return request(_0xf2c7('0x15'),{'options':{'where':{'id':_0x23d1d8},'attributes':['name']}});};exports[_0xf2c7('0x16')]=function(_0x374b54){return request(_0xf2c7('0x17'),{'options':{'where':{'id':_0x374b54},'attributes':[_0xf2c7('0xe')]}});};exports[_0xf2c7('0x18')]=function(_0x54f5df){return request(_0xf2c7('0x19'),{'options':{'where':{'id':_0x54f5df},'attributes':[_0xf2c7('0x1a')]}});};exports[_0xf2c7('0x1b')]=function(_0x3b2640){return request(_0xf2c7('0x1c'),{'options':{'raw':![],'where':{'id':_0x3b2640},'include':[{'model':_0xf2c7('0x1d'),'as':_0xf2c7('0x1e')}]}});};exports[_0xf2c7('0x1f')]=function(_0x59100d){return request(_0xf2c7('0x20'),{'options':{'where':{'id':_0x59100d},'attributes':['id',_0xf2c7('0xe')]}});};exports[_0xf2c7('0x21')]=function(_0x4973d3){return request(_0xf2c7('0x22'),{'body':_0x4973d3});};exports[_0xf2c7('0x23')]=function(_0x45db04){return request(_0xf2c7('0x24'),{'body':_0x45db04});};exports['createSquareReport']=function(_0x213ed1){return request(_0xf2c7('0x25'),{'body':_['merge'](_0x213ed1,{'project_name':_0x213ed1[_0xf2c7('0x26')],'prev_project_name':_0x213ed1[_0xf2c7('0x27')]||'','is_subproject':_0x213ed1['arg_2']?!![]:![],'leaveAt':moment()[_0xf2c7('0x28')](_0xf2c7('0x29'))})});};exports['createSquareRecording']=function(_0x12d32c){return request(_0xf2c7('0x2a'),{'body':_0x12d32c});};exports[_0xf2c7('0x2b')]=function(_0x3266f4){return request(_0xf2c7('0x2c'),{'body':_0x3266f4});};exports[_0xf2c7('0x2d')]=function(_0x468974){return request('ShowCmHopper',{'options':{'raw':![],'where':{'phone':_0x468974[_0xf2c7('0x2e')],'ListId':_0x468974['ListId']}}})[_0xf2c7('0x2f')](function(_0x4fd50c){if(_0x4fd50c){return _0x4fd50c;}return request('CreateCmContact',{'body':_0x468974});});};exports['getPauseById']=function(_0x1a92d7){return request(_0xf2c7('0x30'),{'options':{'where':{'id':_0x1a92d7},'attributes':[_0xf2c7('0xe')]}});};exports[_0xf2c7('0x31')]=function(_0x4715f1,_0x4d94a3){return request(_0xf2c7('0x32'),{'body':{'interface':_0x4d94a3},'options':{'where':_0x4715f1}});};exports[_0xf2c7('0x33')]=function(_0x2367b7,_0x1fe29a,_0x4e2056){return request(_0xf2c7('0x34'),{'body':{'type':_0x1fe29a,'uniqueid':_0x4e2056},'options':{'where':_0x2367b7}});};exports[_0xf2c7('0x35')]=function(_0x27306e){return request(_0xf2c7('0x36'),{'body':{},'options':{'where':_0x27306e}});};exports['agentLogout']=function(_0x24e8a1){return request(_0xf2c7('0x37'),{'body':{},'options':{'where':_0x24e8a1}});}; \ No newline at end of file +var _0xc822=['ShowSquareOdbc','dsn','getUserById','getTrunkById','ShowTrunk','getSoundById','ShowSound','save_name','getIntervalById','ShowInterval','Intervals','getSmsAccountById','ShowSmsAccount','createSmsMessage','CreateSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','createSquareReport','CreateSquareReport','merge','arg_1','arg_2','createSquareRecording','CreateSquareRecording','createSquareMessage','CreateSquareMessage','createCmContact','ShowCmHopper','phone','ListId','CreateCmContact','ShowPause','agentLogin','LoginUser','agentPause','PauseUser','agentUnpause','UnpauseUser','bluebird','moment','lodash','util','jayson/promise','http','error','message','catch','getSquareProject','ShowSquareProject','getMailAccountById','ShowMailAccount','MailServerOut','Smtp','name','email','getSquareProjectById','ShowVoiceQueue','ShowVariable','getSquareOdbcById'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xc822,0xd7));var _0x2c82=function(_0x29e3b6,_0x40b0b4){_0x29e3b6=_0x29e3b6-0x0;var _0x55d4b0=_0xc822[_0x29e3b6];return _0x55d4b0;};'use strict';var BPromise=require(_0x2c82('0x0'));var moment=require(_0x2c82('0x1'));var _=require(_0x2c82('0x2'));var util=require(_0x2c82('0x3'));var jayson=require(_0x2c82('0x4'));var client=jayson['client'][_0x2c82('0x5')]({'port':0x2329});function request(_0x57b817,_0x326bdd){return new BPromise(function(_0x1c6031,_0x56275b){return client['request'](_0x57b817,_0x326bdd)['then'](function(_0x32b493){if(_0x32b493[_0x2c82('0x6')]){return _0x56275b(_0x32b493[_0x2c82('0x6')][_0x2c82('0x7')]);}else{return _0x1c6031(_0x32b493['result']);}})[_0x2c82('0x8')](function(_0x484f32){return _0x56275b(_0x484f32);});});}exports[_0x2c82('0x9')]=function(_0x5f46f6){return request(_0x2c82('0xa'),{'options':{'raw':![],'where':{'name':_0x5f46f6},'attributes':['production']}});};exports[_0x2c82('0xb')]=function(_0x4fbe37){return request(_0x2c82('0xc'),{'options':{'raw':![],'where':{'id':_0x4fbe37},'include':[{'model':_0x2c82('0xd'),'as':_0x2c82('0xe')}],'attributes':['id',_0x2c82('0xf'),_0x2c82('0x10')]}});};exports[_0x2c82('0x11')]=function(_0x1f520b){return request('ShowSquareProject',{'options':{'where':{'id':_0x1f520b},'attributes':['name']}});};exports['getVoiceQueueById']=function(_0x3f52b8){return request(_0x2c82('0x12'),{'options':{'where':{'id':_0x3f52b8},'attributes':[_0x2c82('0xf')]}});};exports['getVariableById']=function(_0x3ca778){return request(_0x2c82('0x13'),{'options':{'where':{'id':_0x3ca778},'attributes':[_0x2c82('0xf')]}});};exports[_0x2c82('0x14')]=function(_0x3117da){return request(_0x2c82('0x15'),{'options':{'where':{'id':_0x3117da},'attributes':[_0x2c82('0x16')]}});};exports[_0x2c82('0x17')]=function(_0x5b4092){return request('ShowUser',{'options':{'where':{'id':_0x5b4092},'attributes':[_0x2c82('0xf')]}});};exports[_0x2c82('0x18')]=function(_0x277c97){return request(_0x2c82('0x19'),{'options':{'where':{'id':_0x277c97},'attributes':[_0x2c82('0xf')]}});};exports[_0x2c82('0x1a')]=function(_0x421991){return request(_0x2c82('0x1b'),{'options':{'where':{'id':_0x421991},'attributes':[_0x2c82('0x1c')]}});};exports[_0x2c82('0x1d')]=function(_0x3af980){return request(_0x2c82('0x1e'),{'options':{'raw':![],'where':{'id':_0x3af980},'include':[{'model':'Interval','as':_0x2c82('0x1f')}]}});};exports[_0x2c82('0x20')]=function(_0x456bbb){return request(_0x2c82('0x21'),{'options':{'where':{'id':_0x456bbb},'attributes':['id',_0x2c82('0xf')]}});};exports[_0x2c82('0x22')]=function(_0x1c78de){return request(_0x2c82('0x23'),{'body':_0x1c78de});};exports[_0x2c82('0x24')]=function(_0x626a92){return request(_0x2c82('0x25'),{'body':_0x626a92});};exports[_0x2c82('0x26')]=function(_0x175d2d){return request(_0x2c82('0x27'),{'body':_[_0x2c82('0x28')](_0x175d2d,{'project_name':_0x175d2d[_0x2c82('0x29')],'prev_project_name':_0x175d2d['arg_2']||'','is_subproject':_0x175d2d[_0x2c82('0x2a')]?!![]:![],'leaveAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')})});};exports[_0x2c82('0x2b')]=function(_0x3327ba){return request(_0x2c82('0x2c'),{'body':_0x3327ba});};exports[_0x2c82('0x2d')]=function(_0x386faa){return request(_0x2c82('0x2e'),{'body':_0x386faa});};exports[_0x2c82('0x2f')]=function(_0xa39f39){return request(_0x2c82('0x30'),{'options':{'raw':![],'where':{'phone':_0xa39f39[_0x2c82('0x31')],'ListId':_0xa39f39[_0x2c82('0x32')]}}})['then'](function(_0x3bd594){if(_0x3bd594){return _0x3bd594;}return request(_0x2c82('0x33'),{'body':_0xa39f39});});};exports['getPauseById']=function(_0x170919){return request(_0x2c82('0x34'),{'options':{'where':{'id':_0x170919},'attributes':[_0x2c82('0xf')]}});};exports[_0x2c82('0x35')]=function(_0x2f1163,_0x4cb6f6){return request(_0x2c82('0x36'),{'body':{'interface':_0x4cb6f6},'options':{'where':_0x2f1163}});};exports[_0x2c82('0x37')]=function(_0x2621a1,_0x1f6d78,_0x4b53e8){return request(_0x2c82('0x38'),{'body':{'type':_0x1f6d78,'uniqueid':_0x4b53e8},'options':{'where':_0x2621a1}});};exports[_0x2c82('0x39')]=function(_0x5b7832){return request(_0x2c82('0x3a'),{'body':{},'options':{'where':_0x5b7832}});};exports['agentLogout']=function(_0x42af08){return request('LogoutUser',{'body':{},'options':{'where':_0x42af08}});}; \ No newline at end of file diff --git a/server/services/agi/scripts/aws/index.js b/server/services/agi/scripts/aws/index.js index b4e3777..ef91893 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 _0x307e=['./polly','./lex','exports'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x307e,0xc9));var _0xe307=function(_0x1f850a,_0x39d53f){_0x1f850a=_0x1f850a-0x0;var _0x29e43b=_0x307e[_0x1f850a];return _0x29e43b;};var polly=require(_0xe307('0x0'));var lex=require(_0xe307('0x1'));module[_0xe307('0x2')]={'polly':polly,'lex':lex}; \ No newline at end of file +var _0x3981=['./polly','exports'];(function(_0x3bd1bc,_0x4f1169){var _0x410fa1=function(_0x40c5e4){while(--_0x40c5e4){_0x3bd1bc['push'](_0x3bd1bc['shift']());}};_0x410fa1(++_0x4f1169);}(_0x3981,0x144));var _0x1398=function(_0x4eb7b4,_0x1a0743){_0x4eb7b4=_0x4eb7b4-0x0;var _0x24393c=_0x3981[_0x4eb7b4];return _0x24393c;};var polly=require(_0x1398('0x0'));var lex=require('./lex');module[_0x1398('0x1')]={'polly':polly,'lex':lex}; \ No newline at end of file diff --git a/server/services/agi/scripts/aws/lex/index.js b/server/services/agi/scripts/aws/lex/index.js index c648559..bea396e 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 _0x6e6c=['exports','./lib/api'];(function(_0x523adf,_0x3e1620){var _0x283870=function(_0xa0e816){while(--_0xa0e816){_0x523adf['push'](_0x523adf['shift']());}};_0x283870(++_0x3e1620);}(_0x6e6c,0xc3));var _0xc6e6=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x6e6c[_0x397e5f];return _0x5302b8;};'use strict';var lex=require(_0xc6e6('0x0'));module[_0xc6e6('0x1')]=function(_0x545f2c,_0x370b21,_0x1b63fe,_0x58f303,_0x550e47,_0x2e97f5){return lex(_0x545f2c,_0x370b21,_0x1b63fe,_0x58f303,_0x550e47,_0x2e97f5);}; \ No newline at end of file +var _0x0bb5=['./lib/api','exports'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x0bb5,0x148));var _0x50bb=function(_0x26380b,_0x112ff8){_0x26380b=_0x26380b-0x0;var _0x43f180=_0x0bb5[_0x26380b];return _0x43f180;};'use strict';var lex=require(_0x50bb('0x0'));module[_0x50bb('0x1')]=function(_0x5e61cf,_0x5a12b6,_0x348380,_0x1aaa37,_0x6b7575,_0x117e36){return lex(_0x5e61cf,_0x5a12b6,_0x348380,_0x1aaa37,_0x6b7575,_0x117e36);}; \ No newline at end of file diff --git a/server/services/agi/scripts/aws/lex/lib/api.js b/server/services/agi/scripts/aws/lex/lib/api.js index cf6d794..06516e4 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(_0x587359,_0x19f7c2){var _0x275b34=function(_0x9cf4eb){while(--_0x9cf4eb){_0x587359['push'](_0x587359['shift']());}};_0x275b34(++_0x19f7c2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x433a86,_0x175b5c){_0x433a86=_0x433a86-0x0;var _0x23000c=_0xa9e0[_0x433a86];return _0x23000c;};'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(_0x2d7972,_0x57f968){var _0x296318=function(_0x126bc9){while(--_0x126bc9){_0x2d7972['push'](_0x2d7972['shift']());}};_0x296318(++_0x57f968);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0xa9e0[_0x1ac595];return _0x455fff;};'use strict';var BPromise=require(_0x0a9e('0x0'));var AWS=require(_0x0a9e('0x1'));function lexResult(_0x29929c,_0x5dd881){return new BPromise(function(_0x550fbc,_0x18d5c9){_0x29929c['postText'](_0x5dd881,function(_0x333808,_0x432180){if(_0x333808){_0x18d5c9(_0x333808);}if(_0x432180[_0x0a9e('0x2')]){for(const _0x991246 in _0x432180[_0x0a9e('0x2')]){if(_0x432180['slots'][_0x0a9e('0x3')](_0x991246)){var _0x441e3a=_0x432180[_0x0a9e('0x2')][_0x991246];_0x432180['slot_'+_0x991246]=_0x441e3a;}}}_0x550fbc(_0x432180);});});}module['exports']=function(_0xe42b77,_0x56465b,_0x52cace,_0x39753a,_0xf81284,_0x307b3e){var _0x3ab53f=new AWS[(_0x0a9e('0x4'))]({'accessKeyId':_0x56465b,'secretAccessKey':_0x52cace,'region':_0x39753a});var _0xbd1168={'botAlias':'$LATEST','botName':_0x307b3e,'inputText':_0xf81284,'userId':_0xe42b77};return lexResult(_0x3ab53f,_0xbd1168);}; \ No newline at end of file diff --git a/server/services/agi/scripts/aws/polly/index.js b/server/services/agi/scripts/aws/polly/index.js index bccc3fe..da2c958 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 _0x4743=['./lib/api'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x4743,0xed));var _0x3474=function(_0x3d8291,_0x560e85){_0x3d8291=_0x3d8291-0x0;var _0x2bad5c=_0x4743[_0x3d8291];return _0x2bad5c;};'use strict';var polly=require(_0x3474('0x0'));module['exports']=function(_0x1b0e3e,_0x40e94b,_0x4c7c7a,_0x1718bf,_0x517ed9,_0x530303,_0x552f88){return polly(_0x1b0e3e,_0x40e94b,_0x4c7c7a,_0x1718bf,_0x517ed9,_0x530303,_0x552f88);}; \ No newline at end of file +var _0x443f=['./lib/api','exports'];(function(_0x385603,_0x1cf762){var _0x2e10ca=function(_0x1824c0){while(--_0x1824c0){_0x385603['push'](_0x385603['shift']());}};_0x2e10ca(++_0x1cf762);}(_0x443f,0x72));var _0xf443=function(_0x15add1,_0x410d97){_0x15add1=_0x15add1-0x0;var _0x5d7f3f=_0x443f[_0x15add1];return _0x5d7f3f;};'use strict';var polly=require(_0xf443('0x0'));module[_0xf443('0x1')]=function(_0x4f9e39,_0x8caa9f,_0x1fb117,_0x32639e,_0x2cb709,_0x3535fc,_0x4b72ea){return polly(_0x4f9e39,_0x8caa9f,_0x1fb117,_0x32639e,_0x2cb709,_0x3535fc,_0x4b72ea);}; \ No newline at end of file diff --git a/server/services/agi/scripts/aws/polly/lib/api.js b/server/services/agi/scripts/aws/polly/lib/api.js index 082456b..b6bcce6 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 _0x8d4c=['aws-sdk','synthesizeSpeech','AudioStream','writeFile','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!','exports','Polly','path','bluebird','randomstring'];(function(_0x41bfe2,_0x103a52){var _0x444437=function(_0x22fcaa){while(--_0x22fcaa){_0x41bfe2['push'](_0x41bfe2['shift']());}};_0x444437(++_0x103a52);}(_0x8d4c,0x194));var _0xc8d4=function(_0x5cb4f0,_0xb16665){_0x5cb4f0=_0x5cb4f0-0x0;var _0x22208=_0x8d4c[_0x5cb4f0];return _0x22208;};'use strict';var fs=require('fs');var path=require(_0xc8d4('0x0'));var BPromise=require(_0xc8d4('0x1'));var rs=require(_0xc8d4('0x2'));var AWS=require(_0xc8d4('0x3'));function pollyResult(_0x24a710,_0x271b33,_0x547c16){return new BPromise(function(_0x1f7116,_0x4e8e1d){_0x24a710[_0xc8d4('0x4')](_0x271b33,function(_0x4bb1d9,_0x192c5a){if(_0x4bb1d9){_0x4e8e1d(_0x4bb1d9);}else if(_0x192c5a){if(_0x192c5a[_0xc8d4('0x5')]instanceof Buffer){fs[_0xc8d4('0x6')](_0x547c16,_0x192c5a[_0xc8d4('0x5')],function(_0x9b3ddc){if(_0x9b3ddc){_0x4e8e1d(_0x9b3ddc);}else{_0x1f7116();}});}else{_0x4e8e1d(new Error(_0xc8d4('0x7')));}}else{_0x4e8e1d(new Error(_0xc8d4('0x8')));}});});}module[_0xc8d4('0x9')]=function(_0x3f34f2,_0x462b12,_0x2ff05e,_0x59d995,_0x35ca09,_0x1f8080,_0x309cbb){var _0x3db253=new AWS[(_0xc8d4('0xa'))]({'accessKeyId':_0x3f34f2,'secretAccessKey':_0x462b12,'region':_0x2ff05e});var _0xa53bd4={'Text':_0x35ca09,'TextType':_0x1f8080||'text','OutputFormat':'mp3','VoiceId':_0x59d995};return pollyResult(_0x3db253,_0xa53bd4,_0x309cbb);}; \ No newline at end of file +var _0x1236=['bluebird','randomstring','aws-sdk','synthesizeSpeech','AudioStream','writeFile','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!','exports','Polly','text','path'];(function(_0x1e87af,_0x5695dd){var _0x51ce67=function(_0x3c815a){while(--_0x3c815a){_0x1e87af['push'](_0x1e87af['shift']());}};_0x51ce67(++_0x5695dd);}(_0x1236,0x11f));var _0x6123=function(_0x1d06de,_0x48c7bd){_0x1d06de=_0x1d06de-0x0;var _0x1b6f44=_0x1236[_0x1d06de];return _0x1b6f44;};'use strict';var fs=require('fs');var path=require(_0x6123('0x0'));var BPromise=require(_0x6123('0x1'));var rs=require(_0x6123('0x2'));var AWS=require(_0x6123('0x3'));function pollyResult(_0x225914,_0x3f5795,_0x17ca2d){return new BPromise(function(_0x115bfd,_0x35f5b9){_0x225914[_0x6123('0x4')](_0x3f5795,function(_0x1a261e,_0x4584b1){if(_0x1a261e){_0x35f5b9(_0x1a261e);}else if(_0x4584b1){if(_0x4584b1[_0x6123('0x5')]instanceof Buffer){fs[_0x6123('0x6')](_0x17ca2d,_0x4584b1[_0x6123('0x5')],function(_0x1c93ac){if(_0x1c93ac){_0x35f5b9(_0x1c93ac);}else{_0x115bfd();}});}else{_0x35f5b9(new Error(_0x6123('0x7')));}}else{_0x35f5b9(new Error(_0x6123('0x8')));}});});}module[_0x6123('0x9')]=function(_0x1308bc,_0x6c292e,_0x36eaa3,_0x232da3,_0x535050,_0x40fc67,_0x2dc55a){var _0x758ec=new AWS[(_0x6123('0xa'))]({'accessKeyId':_0x1308bc,'secretAccessKey':_0x6c292e,'region':_0x36eaa3});var _0x1606ea={'Text':_0x535050,'TextType':_0x40fc67||_0x6123('0xb'),'OutputFormat':'mp3','VoiceId':_0x232da3};return pollyResult(_0x758ec,_0x1606ea,_0x2dc55a);}; \ No newline at end of file diff --git a/server/services/agi/scripts/google/asr/index.js b/server/services/agi/scripts/google/asr/index.js index 87d4f62..78c3208 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. * // * * // ************************************************************************* -'use strict';var asr=require('./lib/api');module['exports']=function(_0x2ae631,_0x39586a,_0x3faa30,_0x1ea7cf){return asr(_0x2ae631,_0x39586a,_0x3faa30);}; \ No newline at end of file +var _0x5a1d=['exports','./lib/api'];(function(_0x5e8b7e,_0x258072){var _0x19d445=function(_0xf028e8){while(--_0xf028e8){_0x5e8b7e['push'](_0x5e8b7e['shift']());}};_0x19d445(++_0x258072);}(_0x5a1d,0x1b1));var _0xd5a1=function(_0x51c250,_0x3e7528){_0x51c250=_0x51c250-0x0;var _0xc5ba72=_0x5a1d[_0x51c250];return _0xc5ba72;};'use strict';var asr=require(_0xd5a1('0x0'));module[_0xd5a1('0x1')]=function(_0x3bd67d,_0xdff785,_0x1770d0,_0x8390ce){return asr(_0x3bd67d,_0xdff785,_0x1770d0);}; \ No newline at end of file diff --git a/server/services/agi/scripts/google/asr/lib/api.js b/server/services/agi/scripts/google/asr/lib/api.js index 5cafdad..790ea9c 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 _0xad95=['/v1/speech:recognize?key=','8000','url','bluebird','https://speech.googleapis.com','length','key\x20should\x20be\x20a\x20string','undefined','string','readFileSync','POST'];(function(_0x133ebd,_0x5471e0){var _0xc485d4=function(_0x4dcc42){while(--_0x4dcc42){_0x133ebd['push'](_0x133ebd['shift']());}};_0xc485d4(++_0x5471e0);}(_0xad95,0x70));var _0x5ad9=function(_0xc6d513,_0x2aac65){_0xc6d513=_0xc6d513-0x0;var _0x2464c6=_0xad95[_0xc6d513];return _0x2464c6;};'use strict';var url=require(_0x5ad9('0x0'));var BPromise=require(_0x5ad9('0x1'));var fs=require('fs');var host=_0x5ad9('0x2');module['exports']=function(_0x52ad89,_0x409d5b,_0x235c61){return new BPromise(function(_0x59809d,_0x5c9fd6){var _0x185bff;if(typeof _0x52ad89!=='string'||_0x52ad89['length']===0x0){return _0x5c9fd6('filepath\x20should\x20be\x20a\x20string');}if(typeof _0x409d5b!=='string'||_0x409d5b[_0x5ad9('0x3')]===0x0){return _0x5c9fd6(_0x5ad9('0x4'));}if(typeof _0x235c61!==_0x5ad9('0x5')&&(typeof _0x235c61!==_0x5ad9('0x6')||_0x235c61[_0x5ad9('0x3')]===0x0)){return _0x5c9fd6('lang\x20should\x20be\x20a\x20string');}try{_0x185bff=fs[_0x5ad9('0x7')](_0x52ad89)['toString']('base64');}catch(_0x301e69){return _0x5c9fd6(_0x301e69);}return _0x59809d({'method':_0x5ad9('0x8'),'uri':host+_0x5ad9('0x9')+_0x409d5b,'body':{'config':{'encoding':'LINEAR16','sampleRateHertz':_0x5ad9('0xa'),'languageCode':_0x235c61},'audio':{'content':_0x185bff}},'json':!![]});});}; \ No newline at end of file +var _0xe13a=['exports','string','length','filepath\x20should\x20be\x20a\x20string','undefined','lang\x20should\x20be\x20a\x20string','readFileSync','toString','base64','POST','LINEAR16','8000','bluebird','https://speech.googleapis.com'];(function(_0x367e5b,_0x5721e4){var _0x4b909e=function(_0x22c6a4){while(--_0x22c6a4){_0x367e5b['push'](_0x367e5b['shift']());}};_0x4b909e(++_0x5721e4);}(_0xe13a,0x178));var _0xae13=function(_0x1ada70,_0x11c0a1){_0x1ada70=_0x1ada70-0x0;var _0x4ae274=_0xe13a[_0x1ada70];return _0x4ae274;};'use strict';var url=require('url');var BPromise=require(_0xae13('0x0'));var fs=require('fs');var host=_0xae13('0x1');module[_0xae13('0x2')]=function(_0x6066c0,_0x4cf961,_0x3aaf90){return new BPromise(function(_0x6840ca,_0x3ebbfe){var _0x10abd7;if(typeof _0x6066c0!==_0xae13('0x3')||_0x6066c0[_0xae13('0x4')]===0x0){return _0x3ebbfe(_0xae13('0x5'));}if(typeof _0x4cf961!==_0xae13('0x3')||_0x4cf961[_0xae13('0x4')]===0x0){return _0x3ebbfe('key\x20should\x20be\x20a\x20string');}if(typeof _0x3aaf90!==_0xae13('0x6')&&(typeof _0x3aaf90!==_0xae13('0x3')||_0x3aaf90[_0xae13('0x4')]===0x0)){return _0x3ebbfe(_0xae13('0x7'));}try{_0x10abd7=fs[_0xae13('0x8')](_0x6066c0)[_0xae13('0x9')](_0xae13('0xa'));}catch(_0x2d1149){return _0x3ebbfe(_0x2d1149);}return _0x6840ca({'method':_0xae13('0xb'),'uri':host+'/v1/speech:recognize?key='+_0x4cf961,'body':{'config':{'encoding':_0xae13('0xc'),'sampleRateHertz':_0xae13('0xd'),'languageCode':_0x3aaf90},'audio':{'content':_0x10abd7}},'json':!![]});});}; \ No newline at end of file diff --git a/server/services/agi/scripts/google/index.js b/server/services/agi/scripts/google/index.js index 326e80d..64eeee7 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 _0x4d79=['exports'];(function(_0xd97532,_0x338f9b){var _0x2993c4=function(_0x1a5cc9){while(--_0x1a5cc9){_0xd97532['push'](_0xd97532['shift']());}};_0x2993c4(++_0x338f9b);}(_0x4d79,0x6e));var _0x94d7=function(_0x34a6e9,_0x25cabe){_0x34a6e9=_0x34a6e9-0x0;var _0x11015c=_0x4d79[_0x34a6e9];return _0x11015c;};var asr=require('./asr');module[_0x94d7('0x0')]={'asr':asr}; \ No newline at end of file +var _0x840a=['exports','./asr'];(function(_0x48e209,_0x226218){var _0xf94d86=function(_0x44ef6b){while(--_0x44ef6b){_0x48e209['push'](_0x48e209['shift']());}};_0xf94d86(++_0x226218);}(_0x840a,0x17f));var _0xa840=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x840a[_0x321bb2];return _0x9c12ed;};var asr=require(_0xa840('0x0'));module[_0xa840('0x1')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/scripts/index.js b/server/services/agi/scripts/index.js index 51e06be..e758a63 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 _0xdef8=['replace','SessionsClient','sessionPath','detectIntent','Dialogflow\x20V2\x20response:','queryResult','allRequiredParamsPresent','diagnosticInfo','fields','end_conversation','boolValue','intent','displayName','isFallback','languageCode','queryText','responseId','intentDetectionConfidence','tildeASR','Tilde\x20ASR\x20transcription','awsPolly','polly','awsLex','lex','ispeechTTS','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','format','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','model=%s','freeform=3','nda','text','channelData','CustomActionData','AudioFromTts','Data','audiofile','dirName','apiai-promise','bluebird','dialogflow','md5','path','querystring','request-promise','randomstring','sox','google-tts-api','url','parse','util','./aws','./google','./tilde','../../../config/logger','agi','https://api.ispeech.org/api/rest','protocol','host','WHAT_EVER','get','statusCode','\x20failed,\x20status\x20code\x20=\x20','statusMessage','request\x20to\x20','createWriteStream','finish','info','finish\x20download\x20file','close','error','unlink','download\x20error','pipe','end','https:','data','transcode','error\x20convert','finish\x20to\x20convert','start','tmp','generate','.wav','writeFileSync','base64','then','chmodSync','777','readFileSync','toString','googleCloudTTS','?key=','input','voice','MP3','text:synthesize','POST','resolve','googleCloudTTS\x20path','split','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','utf8','application/x-www-form-urlencoded','stringify','null','generic','slice','parse\x20response\x20failed:\x0a','length','text\x20length\x20limit\x20reached','lang\x20\x22','\x22\x20might\x20not\x20exist','.mp3','goggleTTS\x20path','googleASR','asr','results','map','alternatives','transcript','join','confidence','googleASR\x20transcription','catch','[%s]\x20%s:%s','name','message','googleDialogflow','textRequest','result','resolvedQuery','action','actionIncomplete','fulfillment','speech','score','status','code','metadata','endConversation','isFallbackIntent','googleDialogflowV2'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdef8,0x1d3));var _0x8def=function(_0x113183,_0x12dba2){_0x113183=_0x113183-0x0;var _0x2197c4=_0xdef8[_0x113183];return _0x2197c4;};'use strict';var apiai=require(_0x8def('0x0'));var BPromise=require(_0x8def('0x1'));var dialogflow=require(_0x8def('0x2'));var fs=require('fs');var http=require('http');var https=require('https');var md5=require(_0x8def('0x3'));var path=require(_0x8def('0x4'));var querystring=require(_0x8def('0x5'));var rp=require(_0x8def('0x6'));var rs=require(_0x8def('0x7'));var sox=require(_0x8def('0x8'));var tts=require(_0x8def('0x9'));var urlParse=require(_0x8def('0xa'))[_0x8def('0xb')];var util=require(_0x8def('0xc'));var aws=require(_0x8def('0xd'));var google=require(_0x8def('0xe'));var sestek=require('./sestek');var tilde=require(_0x8def('0xf'));var logger=require(_0x8def('0x10'))(_0x8def('0x11'));var ISPEECH_API=_0x8def('0x12');function downloadFile(_0x548ca9,_0x3956ed){return new BPromise(function(_0x3ac908,_0x5ae7ac){var _0x5155b0=urlParse(_0x548ca9);var _0x120b6d=_0x5155b0[_0x8def('0x13')]==='https:'?https:http;var _0x47f754={'host':_0x5155b0[_0x8def('0x14')],'path':_0x5155b0[_0x8def('0x4')],'headers':{'user-agent':_0x8def('0x15')}};_0x120b6d[_0x8def('0x16')](_0x47f754,function(_0x2293d6){if(_0x2293d6[_0x8def('0x17')]!==0xc8){logger['error']('request\x20to\x20'+_0x548ca9+_0x8def('0x18')+_0x2293d6['statusCode']+'\x20('+_0x2293d6[_0x8def('0x19')]+')');_0x5ae7ac(new Error(_0x8def('0x1a')+_0x548ca9+_0x8def('0x18')+_0x2293d6[_0x8def('0x17')]+'\x20('+_0x2293d6[_0x8def('0x19')]+')'));return;}var _0x1522ba=fs[_0x8def('0x1b')](_0x3956ed);_0x1522ba['on'](_0x8def('0x1c'),function(){logger[_0x8def('0x1d')](_0x8def('0x1e'));_0x1522ba[_0x8def('0x1f')](_0x3ac908);});_0x1522ba['on'](_0x8def('0x20'),function(_0x1bf1d7){fs[_0x8def('0x21')](_0x3956ed);logger[_0x8def('0x20')](_0x8def('0x22'),_0x1bf1d7);_0x5ae7ac(_0x1bf1d7);});_0x2293d6[_0x8def('0x23')](_0x1522ba);})['on'](_0x8def('0x20'),function(_0x3be9c5){logger['error'](_0x3be9c5);_0x5ae7ac(_0x3be9c5);})[_0x8def('0x24')]();});}function uploadFile(_0x49b9b6){return new BPromise(function(_0x437c2c,_0x84c615){var _0x31b8af=urlParse(_0x49b9b6);var _0x58c28e=_0x31b8af[_0x8def('0x13')]===_0x8def('0x25')?https:http;var _0x208ccb={'host':_0x31b8af[_0x8def('0x14')],'path':_0x31b8af[_0x8def('0x4')],'headers':{'user-agent':_0x8def('0x15')}};_0x58c28e[_0x8def('0x16')](_0x208ccb,function(_0xe19727){if(_0xe19727[_0x8def('0x17')]!==0xc8){_0x84c615(new Error(_0x8def('0x1a')+_0x49b9b6+'\x20failed,\x20status\x20code\x20=\x20'+_0xe19727['statusCode']+'\x20('+_0xe19727[_0x8def('0x19')]+')'));return;}var _0x3badb9='';_0xe19727['on'](_0x8def('0x26'),function(_0x2de022){_0x3badb9+=_0x2de022;});_0xe19727['on']('end',function(){_0x437c2c(_0x3badb9);});})['on'](_0x8def('0x20'),function(_0x3a91d1){_0x84c615(_0x3a91d1);})[_0x8def('0x24')]();});}function convertFile(_0x18fe2a,_0x223d5f){return new BPromise(function(_0xa94405,_0x1bee1b){var _0x503899=sox[_0x8def('0x27')](_0x18fe2a,_0x223d5f,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x503899['on'](_0x8def('0x20'),function(_0xc96019){logger[_0x8def('0x20')](_0x8def('0x28'),_0xc96019);_0x1bee1b(_0xc96019);});_0x503899['on'](_0x8def('0x24'),function(){logger[_0x8def('0x1d')](_0x8def('0x29'));_0xa94405();});_0x503899[_0x8def('0x2a')]();});}function base64Decode(_0x3c57db,_0x1eebce){var _0x530af8=path['resolve'](__dirname,_0x8def('0x2b'),rs[_0x8def('0x2c')](0x4)+_0x8def('0x2d'));fs[_0x8def('0x2e')](_0x530af8,_0x3c57db,_0x8def('0x2f'));return convertFile(_0x530af8,_0x1eebce)[_0x8def('0x30')](function(){try{fs[_0x8def('0x21')](_0x530af8);fs[_0x8def('0x31')](_0x1eebce,_0x8def('0x32'));}catch(_0x36a407){logger[_0x8def('0x20')](_0x36a407);}return _0x1eebce['split']('.')[0x0];});}function base64Encode(_0x5a3972){var _0x21a696=fs[_0x8def('0x33')](_0x5a3972);return new Buffer(_0x21a696)[_0x8def('0x34')](_0x8def('0x2f'));}exports[_0x8def('0x35')]=function(_0x4d7f11,_0x57b006,_0x45a845,_0x5a9569,_0x37a16d,_0x27896a){var _0x92ccb9,_0x3f9d7b;var _0x5518ca='https://texttospeech.googleapis.com/v1/';var _0x24902a=_0x8def('0x36')+_0x4d7f11;var _0x15b17f={};if(_0x57b006==='ssml'){_0x15b17f[_0x8def('0x37')]={'ssml':_0x45a845};}else{_0x15b17f[_0x8def('0x37')]={'text':_0x45a845};};_0x15b17f[_0x8def('0x38')]={'languageCode':_0x5a9569,'ssmlGender':_0x37a16d};_0x15b17f['audioConfig']={'audioEncoding':_0x8def('0x39'),'sampleRateHertz':0x1f40};var _0x2c7df6={'url':_0x5518ca+_0x8def('0x3a')+_0x24902a,'method':_0x8def('0x3b'),'json':!![],'body':_0x15b17f};return rp(_0x2c7df6)['then'](function(_0x2a579c){return new BPromise(function(_0x121ad7,_0x4cd7cd){_0x92ccb9=path[_0x8def('0x3c')](__dirname,_0x8def('0x2b'),rs[_0x8def('0x2c')](0x4)+'.mp3');var _0x21b93e=Buffer['from'](_0x2a579c['audioContent'],'base64');return fs['writeFile'](_0x92ccb9,_0x21b93e,function(_0x1c672a){_0x4cd7cd(_0x1c672a);},function(_0x221e43){fs[_0x8def('0x31')](_0x92ccb9,_0x8def('0x32'));_0x121ad7(_0x221e43);});});})[_0x8def('0x30')](function(_0x731be4){_0x3f9d7b=path['resolve'](__dirname,_0x8def('0x2b'),rs[_0x8def('0x2c')](0x4)+_0x8def('0x2d'));return convertFile(_0x92ccb9,_0x3f9d7b);})[_0x8def('0x30')](function(){try{fs['unlink'](_0x92ccb9);fs[_0x8def('0x31')](_0x3f9d7b,_0x8def('0x32'));}catch(_0x27700){logger[_0x8def('0x20')](_0x27700);}logger[_0x8def('0x1d')](_0x8def('0x3d'),_0x3f9d7b['split']('.')[0x0]);return _0x3f9d7b[_0x8def('0x3e')]('.')[0x0];});};exports['googleTTS']=function(_0xc25a65,_0x5acad5){var _0x500b09=_0x8def('0x3f');var _0x5b4350,_0xf75097;var _0x1754fa;var _0x3f3525={'encoding':_0x8def('0x40'),'method':_0x8def('0x3b'),'timeout':0x2710,'url':_0x500b09,'headers':{'Content-Type':_0x8def('0x41')},'body':'f.req='+encodeURIComponent(JSON[_0x8def('0x42')]([[['jQ1olc',JSON['stringify']([_0xc25a65,_0x5acad5||'en',![],_0x8def('0x43')]),null,_0x8def('0x44')]]]))};return rp(_0x3f3525)['then'](function(_0x539aa4){try{_0x1754fa=eval(_0x539aa4[_0x8def('0x45')](0x5))[0x0][0x2];}catch(_0x3c3845){throw new Error(_0x8def('0x46')+_0x539aa4['data']);}if(!_0x1754fa){if(_0xc25a65[_0x8def('0x47')]>0xc8){throw new Error(_0x8def('0x48'));}else{throw new Error(_0x8def('0x49')+_0x5acad5+_0x8def('0x4a'));}}try{_0x1754fa=eval(_0x1754fa)[0x0];}catch(_0x901d9c){throw new Error('parse\x20response\x20failed:\x0a'+res[_0x8def('0x26')]);}const _0x11e152=_0x1754fa;_0x5b4350=path[_0x8def('0x3c')](__dirname,_0x8def('0x2b'),rs[_0x8def('0x2c')](0x4)+_0x8def('0x4b'));fs['writeFileSync'](_0x5b4350,_0x1754fa,{'encoding':'base64'});_0xf75097=path[_0x8def('0x3c')](__dirname,_0x8def('0x2b'),rs[_0x8def('0x2c')](0x4)+_0x8def('0x2d'));return convertFile(_0x5b4350,_0xf75097);})[_0x8def('0x30')](function(){try{fs['unlink'](_0x5b4350);fs[_0x8def('0x31')](_0xf75097,_0x8def('0x32'));}catch(_0x49ce97){logger[_0x8def('0x20')](_0x49ce97);}logger['info'](_0x8def('0x4c'),_0xf75097[_0x8def('0x3e')]('.')[0x0]);return _0xf75097[_0x8def('0x3e')]('.')[0x0];});};exports[_0x8def('0x4d')]=function(_0x5cc5ee,_0x410ba1,_0x269496){return google[_0x8def('0x4e')](_0x5cc5ee,_0x410ba1,_0x269496)['then'](function(_0x2c823f){logger[_0x8def('0x1d')](_0x2c823f['uri']);return rp(_0x2c823f);})[_0x8def('0x30')](function(_0x2b1456){var _0x56ef5a='';var _0xe32976=0x0;try{fs[_0x8def('0x21')](_0x5cc5ee);}catch(_0x21b46f){logger[_0x8def('0x20')](_0x21b46f);}if(_0x2b1456&&_0x2b1456[_0x8def('0x4f')]){_0x56ef5a=_0x2b1456['results'][_0x8def('0x50')](function(_0x2926a1){return _0x2926a1&&_0x2926a1[_0x8def('0x51')][0x0]&&_0x2926a1[_0x8def('0x51')][0x0][_0x8def('0x52')]?_0x2926a1[_0x8def('0x51')][0x0][_0x8def('0x52')]:'';})[_0x8def('0x53')]('\x0a');_0xe32976=_0x2b1456['results']['map'](function(_0x69239){return _0x69239&&_0x69239[_0x8def('0x51')][0x0]&&_0x69239[_0x8def('0x51')][0x0][_0x8def('0x54')]?_0x69239['alternatives'][0x0][_0x8def('0x54')]:0x0;})['join']('\x0a');}logger[_0x8def('0x1d')](_0x8def('0x55'),_0x56ef5a);logger[_0x8def('0x1d')]('googleASR\x20confidence',_0xe32976);return{'transcript':_0x56ef5a,'confidence':_0xe32976};})[_0x8def('0x56')](function(_0x1b23e0){logger[_0x8def('0x20')](_0x8def('0x57'),_0x1b23e0['statusCode'],_0x1b23e0[_0x8def('0x58')],_0x1b23e0[_0x8def('0x59')]);});};exports[_0x8def('0x5a')]=function(_0x48218b,_0x40e250,_0x237d8d,_0x3eb268){var _0x462070=apiai(_0x40e250,{'language':_0x3eb268||'en'});return _0x462070[_0x8def('0x5b')](_0x237d8d,{'sessionId':md5(_0x48218b)})[_0x8def('0x30')](function(_0x12152c){logger[_0x8def('0x1d')](JSON[_0x8def('0x42')](_0x12152c));return{'source':_0x12152c[_0x8def('0x5c')]['source'],'resolvedQuery':_0x12152c['result'][_0x8def('0x5d')],'action':_0x12152c[_0x8def('0x5c')][_0x8def('0x5e')],'actionIncomplete':_0x12152c[_0x8def('0x5c')][_0x8def('0x5f')],'speech':_0x12152c[_0x8def('0x5c')][_0x8def('0x60')][_0x8def('0x61')],'score':_0x12152c[_0x8def('0x5c')][_0x8def('0x62')],'statusCode':_0x12152c[_0x8def('0x63')][_0x8def('0x64')],'endConversation':_0x12152c[_0x8def('0x5c')][_0x8def('0x65')][_0x8def('0x66')]||![],'isFallbackIntent':_0x12152c[_0x8def('0x5c')][_0x8def('0x65')][_0x8def('0x67')]};});};exports[_0x8def('0x68')]=function(_0x3c48ab,_0x269b0e,_0x2fd38e,_0x2d6f7d,_0x4e760e,_0x1b91a8){var _0x3eb29d=_0x2d6f7d[_0x8def('0x69')](/\\n/g,'\x0a');var _0x576c75={'credentials':{'private_key':_0x3eb29d,'client_email':_0x2fd38e}};var _0x256362=new dialogflow[(_0x8def('0x6a'))](_0x576c75);var _0xeb86e9=_0x256362[_0x8def('0x6b')](_0x269b0e,md5(_0x3c48ab));var _0x30b1c4={'session':_0xeb86e9,'queryInput':{'text':{'text':_0x4e760e,'languageCode':_0x1b91a8}}};return _0x256362[_0x8def('0x6c')](_0x30b1c4)['then'](function(_0x43ab20){if(_0x43ab20&&_0x43ab20['length']){logger[_0x8def('0x1d')](_0x8def('0x6d'),JSON[_0x8def('0x42')](_0x43ab20));var _0x404654=_0x43ab20[0x0];if(_0x404654){var _0x1268fd={'action':_0x404654['queryResult']['action'],'allRequiredParamsPresent':_0x404654[_0x8def('0x6e')][_0x8def('0x6f')],'endConversation':_0x404654['queryResult'][_0x8def('0x70')]&&_0x404654[_0x8def('0x6e')][_0x8def('0x70')][_0x8def('0x71')]?_0x404654[_0x8def('0x6e')][_0x8def('0x70')][_0x8def('0x71')][_0x8def('0x72')][_0x8def('0x73')]:![],'fulfillmentText':_0x404654[_0x8def('0x6e')]['fulfillmentText'],'intentName':_0x404654[_0x8def('0x6e')][_0x8def('0x74')][_0x8def('0x58')],'intentDisplayName':_0x404654['queryResult'][_0x8def('0x74')][_0x8def('0x75')],'isFallbackIntent':_0x404654['queryResult']['intent'][_0x8def('0x76')],'languageCode':_0x404654[_0x8def('0x6e')][_0x8def('0x77')],'queryText':_0x404654[_0x8def('0x6e')][_0x8def('0x78')],'responseId':_0x404654[_0x8def('0x79')],'score':_0x404654[_0x8def('0x6e')][_0x8def('0x7a')],'speech':_0x404654['queryResult']['fulfillmentText'],'providerResponse':JSON[_0x8def('0x42')](_0x43ab20)};return _0x1268fd;}}});};exports[_0x8def('0x7b')]=function(_0x367504,_0x286e05,_0x36819c,_0x42323d){return tilde[_0x8def('0x4e')](_0x367504,_0x286e05,_0x36819c,_0x42323d)[_0x8def('0x30')](function(_0x26d682){try{fs[_0x8def('0x21')](_0x367504);}catch(_0x4a940c){logger['error'](_0x4a940c);}logger[_0x8def('0x1d')](_0x8def('0x7c'),_0x26d682[_0x8def('0x52')]);logger[_0x8def('0x1d')]('Tilde\x20ASR\x20confidence',_0x26d682[_0x8def('0x54')]);return _0x26d682;});};exports[_0x8def('0x7d')]=function(_0x5bb57e,_0x4fa2ca,_0xf24df5,_0x4029fe,_0x166832,_0x1d95e9){var _0x5799a7=path[_0x8def('0x3c')](__dirname,_0x8def('0x2b'),rs[_0x8def('0x2c')](0x4)+_0x8def('0x4b'));var _0x2d65aa;return aws[_0x8def('0x7e')](_0x5bb57e,_0x4fa2ca,_0xf24df5,_0x4029fe,_0x166832,_0x1d95e9,_0x5799a7)[_0x8def('0x30')](function(){_0x2d65aa=path[_0x8def('0x3c')](__dirname,_0x8def('0x2b'),rs[_0x8def('0x2c')](0x4)+'.wav');return convertFile(_0x5799a7,_0x2d65aa);})[_0x8def('0x30')](function(){try{fs[_0x8def('0x21')](_0x5799a7);fs[_0x8def('0x31')](_0x2d65aa,_0x8def('0x32'));}catch(_0x5e9e7e){logger[_0x8def('0x20')](_0x5e9e7e);}return _0x2d65aa['split']('.')[0x0];});};exports[_0x8def('0x7f')]=function(_0x3f502a,_0x4cb39b,_0x3a392c,_0x352dec,_0xb303e2,_0x158a6d){return aws[_0x8def('0x80')](_0x3f502a,_0x4cb39b,_0x3a392c,_0x352dec,_0xb303e2,_0x158a6d)['then'](function(_0x1c3133){logger['info'](JSON[_0x8def('0x42')](_0x1c3133));return _0x1c3133;});};exports[_0x8def('0x81')]=function(_0x35ede5,_0x3120fd,_0x46555c,_0x53601a){var _0x5485e6=util['format'](_0x8def('0x82'),ISPEECH_API,_0x35ede5,encodeURIComponent(_0x3120fd),_0x46555c,_0x53601a);var _0x15365d=path[_0x8def('0x3c')](__dirname,'tmp',rs[_0x8def('0x2c')](0x4)+_0x8def('0x4b'));var _0x4be4b2;return downloadFile(_0x5485e6,_0x15365d)[_0x8def('0x30')](function(){_0x4be4b2=path[_0x8def('0x3c')](__dirname,'tmp',rs[_0x8def('0x2c')](0x4)+_0x8def('0x2d'));return convertFile(_0x15365d,_0x4be4b2);})[_0x8def('0x30')](function(){try{fs[_0x8def('0x21')](_0x15365d);fs[_0x8def('0x31')](_0x4be4b2,'777');}catch(_0x4cc41c){logger[_0x8def('0x20')](_0x4cc41c);}return _0x4be4b2['split']('.')[0x0];});};exports['ispeechASR']=function(_0x4df862,_0x36f025,_0xa4fa2d,_0x54bef8){var _0xf8dabb=util[_0x8def('0x83')](_0x8def('0x84'),ISPEECH_API,_0x36f025,_0xa4fa2d,base64Encode(_0x4df862),_0x54bef8?util['format'](_0x8def('0x85'),encodeURIComponent(_0x54bef8)):_0x8def('0x86'));return uploadFile(_0xf8dabb)[_0x8def('0x30')](function(_0x1d876d){return querystring['parse'](_0x1d876d);});};exports['sestekNDA']=function(_0x54f6cd,_0x4bf03d){return sestek[_0x8def('0x87')](_0x54f6cd,_0x4bf03d)[_0x8def('0x30')](function(_0x15fc2a){logger[_0x8def('0x1d')](JSON['stringify'](_0x15fc2a));var _0x47f4fe={'speech':_0x15fc2a[_0x8def('0x88')],'action':_0x15fc2a[_0x8def('0x89')]?_0x15fc2a[_0x8def('0x89')]['CustomAction']:undefined,'actiondata':_0x15fc2a[_0x8def('0x89')]?_0x15fc2a[_0x8def('0x89')][_0x8def('0x8a')]:undefined};if(_0x15fc2a[_0x8def('0x89')]&&_0x15fc2a[_0x8def('0x89')][_0x8def('0x8b')]){return base64Decode(_0x15fc2a['channelData']['AudioFromTts'][_0x8def('0x8c')],path[_0x8def('0x3c')](__dirname,_0x8def('0x2b'),rs['generate'](0x4)+_0x8def('0x2d')))[_0x8def('0x30')](function(_0x458fa){_0x47f4fe[_0x8def('0x8d')]=_0x458fa;return _0x47f4fe;});}return _0x47f4fe;});};exports[_0x8def('0x8e')]=function(){return __dirname;}; \ No newline at end of file +var _0x0900=['CustomActionData','AudioFromTts','Data','dirName','dialogflow','http','https','md5','querystring','request-promise','sox','google-tts-api','url','parse','./aws','./google','./sestek','./tilde','../../../config/logger','agi','https://api.ispeech.org/api/rest','protocol','https:','host','path','WHAT_EVER','get','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusCode','statusMessage','createWriteStream','finish','info','finish\x20download\x20file','close','error','unlink','download\x20error','end','transcode','wav','finish\x20to\x20convert','start','resolve','tmp','generate','.wav','writeFileSync','base64','then','777','split','readFileSync','googleCloudTTS','?key=','input','audioConfig','MP3','text:synthesize','POST','.mp3','from','audioContent','writeFile','chmodSync','googleCloudTTS\x20path','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','utf8','f.req=','stringify','jQ1olc','null','generic','slice','data','length','text\x20length\x20limit\x20reached','lang\x20\x22','\x22\x20might\x20not\x20exist','parse\x20response\x20failed:\x0a','goggleTTS\x20path','googleASR','uri','results','map','alternatives','transcript','join','confidence','googleASR\x20transcription','googleASR\x20confidence','catch','message','textRequest','result','source','resolvedQuery','fulfillment','status','endConversation','metadata','googleDialogflowV2','replace','SessionsClient','sessionPath','detectIntent','Dialogflow\x20V2\x20response:','queryResult','allRequiredParamsPresent','diagnosticInfo','fields','boolValue','fulfillmentText','intent','name','displayName','languageCode','queryText','responseId','intentDetectionConfidence','tildeASR','asr','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','awsPolly','polly','awsLex','lex','ispeechTTS','format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','model=%s','freeform=3','sestekNDA','nda','text','channelData','CustomAction'];(function(_0x1a485a,_0x1d1114){var _0x3f74b5=function(_0xd21a59){while(--_0xd21a59){_0x1a485a['push'](_0x1a485a['shift']());}};_0x3f74b5(++_0x1d1114);}(_0x0900,0x11e));var _0x0090=function(_0x1d1162,_0x5b2464){_0x1d1162=_0x1d1162-0x0;var _0x2da1f0=_0x0900[_0x1d1162];return _0x2da1f0;};'use strict';var apiai=require('apiai-promise');var BPromise=require('bluebird');var dialogflow=require(_0x0090('0x0'));var fs=require('fs');var http=require(_0x0090('0x1'));var https=require(_0x0090('0x2'));var md5=require(_0x0090('0x3'));var path=require('path');var querystring=require(_0x0090('0x4'));var rp=require(_0x0090('0x5'));var rs=require('randomstring');var sox=require(_0x0090('0x6'));var tts=require(_0x0090('0x7'));var urlParse=require(_0x0090('0x8'))[_0x0090('0x9')];var util=require('util');var aws=require(_0x0090('0xa'));var google=require(_0x0090('0xb'));var sestek=require(_0x0090('0xc'));var tilde=require(_0x0090('0xd'));var logger=require(_0x0090('0xe'))(_0x0090('0xf'));var ISPEECH_API=_0x0090('0x10');function downloadFile(_0x36209c,_0x3339f3){return new BPromise(function(_0x1e8a51,_0x56890b){var _0x3f4e30=urlParse(_0x36209c);var _0x40a9cb=_0x3f4e30[_0x0090('0x11')]===_0x0090('0x12')?https:http;var _0x334be3={'host':_0x3f4e30[_0x0090('0x13')],'path':_0x3f4e30[_0x0090('0x14')],'headers':{'user-agent':_0x0090('0x15')}};_0x40a9cb[_0x0090('0x16')](_0x334be3,function(_0x3820a7){if(_0x3820a7['statusCode']!==0xc8){logger['error'](_0x0090('0x17')+_0x36209c+_0x0090('0x18')+_0x3820a7[_0x0090('0x19')]+'\x20('+_0x3820a7[_0x0090('0x1a')]+')');_0x56890b(new Error(_0x0090('0x17')+_0x36209c+'\x20failed,\x20status\x20code\x20=\x20'+_0x3820a7[_0x0090('0x19')]+'\x20('+_0x3820a7[_0x0090('0x1a')]+')'));return;}var _0x2267ed=fs[_0x0090('0x1b')](_0x3339f3);_0x2267ed['on'](_0x0090('0x1c'),function(){logger[_0x0090('0x1d')](_0x0090('0x1e'));_0x2267ed[_0x0090('0x1f')](_0x1e8a51);});_0x2267ed['on'](_0x0090('0x20'),function(_0x4f0d1e){fs[_0x0090('0x21')](_0x3339f3);logger[_0x0090('0x20')](_0x0090('0x22'),_0x4f0d1e);_0x56890b(_0x4f0d1e);});_0x3820a7['pipe'](_0x2267ed);})['on'](_0x0090('0x20'),function(_0x577b3a){logger[_0x0090('0x20')](_0x577b3a);_0x56890b(_0x577b3a);})[_0x0090('0x23')]();});}function uploadFile(_0x59ab2b){return new BPromise(function(_0x3a9eff,_0x5f202f){var _0x47db71=urlParse(_0x59ab2b);var _0x1ca7c4=_0x47db71[_0x0090('0x11')]===_0x0090('0x12')?https:http;var _0x1adbf8={'host':_0x47db71['host'],'path':_0x47db71['path'],'headers':{'user-agent':_0x0090('0x15')}};_0x1ca7c4[_0x0090('0x16')](_0x1adbf8,function(_0x192a7e){if(_0x192a7e[_0x0090('0x19')]!==0xc8){_0x5f202f(new Error(_0x0090('0x17')+_0x59ab2b+_0x0090('0x18')+_0x192a7e['statusCode']+'\x20('+_0x192a7e[_0x0090('0x1a')]+')'));return;}var _0x1a69ca='';_0x192a7e['on']('data',function(_0x49b2ff){_0x1a69ca+=_0x49b2ff;});_0x192a7e['on'](_0x0090('0x23'),function(){_0x3a9eff(_0x1a69ca);});})['on'](_0x0090('0x20'),function(_0x541e06){_0x5f202f(_0x541e06);})[_0x0090('0x23')]();});}function convertFile(_0x2a3e94,_0x5de5a8){return new BPromise(function(_0x3a6b6a,_0x260ba7){var _0x50f552=sox[_0x0090('0x24')](_0x2a3e94,_0x5de5a8,{'sampleRate':0x1f40,'format':_0x0090('0x25'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x50f552['on'](_0x0090('0x20'),function(_0xf35e40){logger[_0x0090('0x20')]('error\x20convert',_0xf35e40);_0x260ba7(_0xf35e40);});_0x50f552['on']('end',function(){logger[_0x0090('0x1d')](_0x0090('0x26'));_0x3a6b6a();});_0x50f552[_0x0090('0x27')]();});}function base64Decode(_0x5d19ec,_0x2f68c0){var _0x1af607=path[_0x0090('0x28')](__dirname,_0x0090('0x29'),rs[_0x0090('0x2a')](0x4)+_0x0090('0x2b'));fs[_0x0090('0x2c')](_0x1af607,_0x5d19ec,_0x0090('0x2d'));return convertFile(_0x1af607,_0x2f68c0)[_0x0090('0x2e')](function(){try{fs[_0x0090('0x21')](_0x1af607);fs['chmodSync'](_0x2f68c0,_0x0090('0x2f'));}catch(_0x561ad8){logger[_0x0090('0x20')](_0x561ad8);}return _0x2f68c0[_0x0090('0x30')]('.')[0x0];});}function base64Encode(_0x401d4f){var _0x27666e=fs[_0x0090('0x31')](_0x401d4f);return new Buffer(_0x27666e)['toString']('base64');}exports[_0x0090('0x32')]=function(_0x4f59cb,_0x5bd70a,_0x4eb6d8,_0x304880,_0x5039db,_0x2a7545){var _0x58aa75,_0x29222b;var _0x3644e0='https://texttospeech.googleapis.com/v1/';var _0xe128d4=_0x0090('0x33')+_0x4f59cb;var _0x3637c4={};if(_0x5bd70a==='ssml'){_0x3637c4[_0x0090('0x34')]={'ssml':_0x4eb6d8};}else{_0x3637c4['input']={'text':_0x4eb6d8};};_0x3637c4['voice']={'languageCode':_0x304880,'ssmlGender':_0x5039db};_0x3637c4[_0x0090('0x35')]={'audioEncoding':_0x0090('0x36'),'sampleRateHertz':0x1f40};var _0x273d75={'url':_0x3644e0+_0x0090('0x37')+_0xe128d4,'method':_0x0090('0x38'),'json':!![],'body':_0x3637c4};return rp(_0x273d75)[_0x0090('0x2e')](function(_0x3ef7d2){return new BPromise(function(_0x340296,_0x1cd8a9){_0x58aa75=path['resolve'](__dirname,_0x0090('0x29'),rs[_0x0090('0x2a')](0x4)+_0x0090('0x39'));var _0x47c04f=Buffer[_0x0090('0x3a')](_0x3ef7d2[_0x0090('0x3b')],_0x0090('0x2d'));return fs[_0x0090('0x3c')](_0x58aa75,_0x47c04f,function(_0x25f54a){_0x1cd8a9(_0x25f54a);},function(_0x2010df){fs[_0x0090('0x3d')](_0x58aa75,_0x0090('0x2f'));_0x340296(_0x2010df);});});})['then'](function(_0x20f18c){_0x29222b=path[_0x0090('0x28')](__dirname,_0x0090('0x29'),rs[_0x0090('0x2a')](0x4)+'.wav');return convertFile(_0x58aa75,_0x29222b);})[_0x0090('0x2e')](function(){try{fs['unlink'](_0x58aa75);fs[_0x0090('0x3d')](_0x29222b,'777');}catch(_0x1a3e7e){logger[_0x0090('0x20')](_0x1a3e7e);}logger['info'](_0x0090('0x3e'),_0x29222b[_0x0090('0x30')]('.')[0x0]);return _0x29222b['split']('.')[0x0];});};exports['googleTTS']=function(_0x1f3888,_0x546955){var _0x579aac=_0x0090('0x3f');var _0x59d6d4,_0x1972fb;var _0x2f5c23;var _0xdf566d={'encoding':_0x0090('0x40'),'method':_0x0090('0x38'),'timeout':0x2710,'url':_0x579aac,'headers':{'Content-Type':'application/x-www-form-urlencoded'},'body':_0x0090('0x41')+encodeURIComponent(JSON[_0x0090('0x42')]([[[_0x0090('0x43'),JSON['stringify']([_0x1f3888,_0x546955||'en',![],_0x0090('0x44')]),null,_0x0090('0x45')]]]))};return rp(_0xdf566d)['then'](function(_0x1d800b){try{_0x2f5c23=eval(_0x1d800b[_0x0090('0x46')](0x5))[0x0][0x2];}catch(_0x7e0d67){throw new Error('parse\x20response\x20failed:\x0a'+_0x1d800b[_0x0090('0x47')]);}if(!_0x2f5c23){if(_0x1f3888[_0x0090('0x48')]>0xc8){throw new Error(_0x0090('0x49'));}else{throw new Error(_0x0090('0x4a')+_0x546955+_0x0090('0x4b'));}}try{_0x2f5c23=eval(_0x2f5c23)[0x0];}catch(_0x3c67b0){throw new Error(_0x0090('0x4c')+res['data']);}const _0x15f5f1=_0x2f5c23;_0x59d6d4=path['resolve'](__dirname,_0x0090('0x29'),rs[_0x0090('0x2a')](0x4)+'.mp3');fs[_0x0090('0x2c')](_0x59d6d4,_0x2f5c23,{'encoding':_0x0090('0x2d')});_0x1972fb=path['resolve'](__dirname,_0x0090('0x29'),rs['generate'](0x4)+_0x0090('0x2b'));return convertFile(_0x59d6d4,_0x1972fb);})[_0x0090('0x2e')](function(){try{fs['unlink'](_0x59d6d4);fs[_0x0090('0x3d')](_0x1972fb,_0x0090('0x2f'));}catch(_0xa99ae5){logger[_0x0090('0x20')](_0xa99ae5);}logger[_0x0090('0x1d')](_0x0090('0x4d'),_0x1972fb[_0x0090('0x30')]('.')[0x0]);return _0x1972fb[_0x0090('0x30')]('.')[0x0];});};exports[_0x0090('0x4e')]=function(_0x4ded98,_0x53b8bc,_0x1be844){return google['asr'](_0x4ded98,_0x53b8bc,_0x1be844)[_0x0090('0x2e')](function(_0x3a259f){logger[_0x0090('0x1d')](_0x3a259f[_0x0090('0x4f')]);return rp(_0x3a259f);})[_0x0090('0x2e')](function(_0x4063aa){var _0x486fc6='';var _0x263e40=0x0;try{fs[_0x0090('0x21')](_0x4ded98);}catch(_0x2e3065){logger[_0x0090('0x20')](_0x2e3065);}if(_0x4063aa&&_0x4063aa[_0x0090('0x50')]){_0x486fc6=_0x4063aa[_0x0090('0x50')][_0x0090('0x51')](function(_0x18c90b){return _0x18c90b&&_0x18c90b[_0x0090('0x52')][0x0]&&_0x18c90b[_0x0090('0x52')][0x0][_0x0090('0x53')]?_0x18c90b[_0x0090('0x52')][0x0][_0x0090('0x53')]:'';})[_0x0090('0x54')]('\x0a');_0x263e40=_0x4063aa[_0x0090('0x50')][_0x0090('0x51')](function(_0xab74e5){return _0xab74e5&&_0xab74e5[_0x0090('0x52')][0x0]&&_0xab74e5['alternatives'][0x0][_0x0090('0x55')]?_0xab74e5[_0x0090('0x52')][0x0]['confidence']:0x0;})['join']('\x0a');}logger[_0x0090('0x1d')](_0x0090('0x56'),_0x486fc6);logger['info'](_0x0090('0x57'),_0x263e40);return{'transcript':_0x486fc6,'confidence':_0x263e40};})[_0x0090('0x58')](function(_0x468864){logger[_0x0090('0x20')]('[%s]\x20%s:%s',_0x468864[_0x0090('0x19')],_0x468864['name'],_0x468864[_0x0090('0x59')]);});};exports['googleDialogflow']=function(_0x4529ce,_0x55e529,_0x459ee2,_0x410e02){var _0x56b79f=apiai(_0x55e529,{'language':_0x410e02||'en'});return _0x56b79f[_0x0090('0x5a')](_0x459ee2,{'sessionId':md5(_0x4529ce)})[_0x0090('0x2e')](function(_0x488ab5){logger[_0x0090('0x1d')](JSON[_0x0090('0x42')](_0x488ab5));return{'source':_0x488ab5[_0x0090('0x5b')][_0x0090('0x5c')],'resolvedQuery':_0x488ab5['result'][_0x0090('0x5d')],'action':_0x488ab5[_0x0090('0x5b')]['action'],'actionIncomplete':_0x488ab5[_0x0090('0x5b')]['actionIncomplete'],'speech':_0x488ab5[_0x0090('0x5b')][_0x0090('0x5e')]['speech'],'score':_0x488ab5[_0x0090('0x5b')]['score'],'statusCode':_0x488ab5[_0x0090('0x5f')]['code'],'endConversation':_0x488ab5[_0x0090('0x5b')]['metadata'][_0x0090('0x60')]||![],'isFallbackIntent':_0x488ab5[_0x0090('0x5b')][_0x0090('0x61')]['isFallbackIntent']};});};exports[_0x0090('0x62')]=function(_0x266879,_0x2bb212,_0x5c0b80,_0x2f0fba,_0x3dccc2,_0xff9fc5){var _0x15e0c8=_0x2f0fba[_0x0090('0x63')](/\\n/g,'\x0a');var _0x5bec44={'credentials':{'private_key':_0x15e0c8,'client_email':_0x5c0b80}};var _0x4ca0a6=new dialogflow[(_0x0090('0x64'))](_0x5bec44);var _0x33b9fa=_0x4ca0a6[_0x0090('0x65')](_0x2bb212,md5(_0x266879));var _0x41e99e={'session':_0x33b9fa,'queryInput':{'text':{'text':_0x3dccc2,'languageCode':_0xff9fc5}}};return _0x4ca0a6[_0x0090('0x66')](_0x41e99e)[_0x0090('0x2e')](function(_0x4f1579){if(_0x4f1579&&_0x4f1579[_0x0090('0x48')]){logger[_0x0090('0x1d')](_0x0090('0x67'),JSON['stringify'](_0x4f1579));var _0x3a6a60=_0x4f1579[0x0];if(_0x3a6a60){var _0x2c1812={'action':_0x3a6a60[_0x0090('0x68')]['action'],'allRequiredParamsPresent':_0x3a6a60['queryResult'][_0x0090('0x69')],'endConversation':_0x3a6a60[_0x0090('0x68')][_0x0090('0x6a')]&&_0x3a6a60[_0x0090('0x68')]['diagnosticInfo']['fields']?_0x3a6a60[_0x0090('0x68')][_0x0090('0x6a')][_0x0090('0x6b')]['end_conversation'][_0x0090('0x6c')]:![],'fulfillmentText':_0x3a6a60[_0x0090('0x68')][_0x0090('0x6d')],'intentName':_0x3a6a60[_0x0090('0x68')][_0x0090('0x6e')][_0x0090('0x6f')],'intentDisplayName':_0x3a6a60[_0x0090('0x68')][_0x0090('0x6e')][_0x0090('0x70')],'isFallbackIntent':_0x3a6a60[_0x0090('0x68')]['intent']['isFallback'],'languageCode':_0x3a6a60[_0x0090('0x68')][_0x0090('0x71')],'queryText':_0x3a6a60[_0x0090('0x68')][_0x0090('0x72')],'responseId':_0x3a6a60[_0x0090('0x73')],'score':_0x3a6a60['queryResult'][_0x0090('0x74')],'speech':_0x3a6a60[_0x0090('0x68')][_0x0090('0x6d')],'providerResponse':JSON[_0x0090('0x42')](_0x4f1579)};return _0x2c1812;}}});};exports[_0x0090('0x75')]=function(_0x182511,_0x40edda,_0x49adfe,_0x1650a6){return tilde[_0x0090('0x76')](_0x182511,_0x40edda,_0x49adfe,_0x1650a6)['then'](function(_0x3b6045){try{fs['unlink'](_0x182511);}catch(_0x437466){logger[_0x0090('0x20')](_0x437466);}logger[_0x0090('0x1d')](_0x0090('0x77'),_0x3b6045['transcript']);logger[_0x0090('0x1d')](_0x0090('0x78'),_0x3b6045['confidence']);return _0x3b6045;});};exports[_0x0090('0x79')]=function(_0x53d1c7,_0x5b6314,_0x53fef1,_0x1c5c5d,_0x60a257,_0x49dfd2){var _0x278e84=path[_0x0090('0x28')](__dirname,_0x0090('0x29'),rs[_0x0090('0x2a')](0x4)+_0x0090('0x39'));var _0x5f3a01;return aws[_0x0090('0x7a')](_0x53d1c7,_0x5b6314,_0x53fef1,_0x1c5c5d,_0x60a257,_0x49dfd2,_0x278e84)[_0x0090('0x2e')](function(){_0x5f3a01=path[_0x0090('0x28')](__dirname,_0x0090('0x29'),rs[_0x0090('0x2a')](0x4)+'.wav');return convertFile(_0x278e84,_0x5f3a01);})[_0x0090('0x2e')](function(){try{fs[_0x0090('0x21')](_0x278e84);fs[_0x0090('0x3d')](_0x5f3a01,_0x0090('0x2f'));}catch(_0x448ddd){logger[_0x0090('0x20')](_0x448ddd);}return _0x5f3a01[_0x0090('0x30')]('.')[0x0];});};exports[_0x0090('0x7b')]=function(_0x51a78e,_0x48c507,_0x133532,_0x3c7e6c,_0x4d355b,_0x4be850){return aws[_0x0090('0x7c')](_0x51a78e,_0x48c507,_0x133532,_0x3c7e6c,_0x4d355b,_0x4be850)['then'](function(_0x41ca43){logger[_0x0090('0x1d')](JSON[_0x0090('0x42')](_0x41ca43));return _0x41ca43;});};exports[_0x0090('0x7d')]=function(_0x145b55,_0x5ba8dd,_0x3bfd1b,_0x225533){var _0x405abf=util[_0x0090('0x7e')](_0x0090('0x7f'),ISPEECH_API,_0x145b55,encodeURIComponent(_0x5ba8dd),_0x3bfd1b,_0x225533);var _0x4693a5=path[_0x0090('0x28')](__dirname,_0x0090('0x29'),rs[_0x0090('0x2a')](0x4)+_0x0090('0x39'));var _0x3d2123;return downloadFile(_0x405abf,_0x4693a5)[_0x0090('0x2e')](function(){_0x3d2123=path['resolve'](__dirname,_0x0090('0x29'),rs['generate'](0x4)+'.wav');return convertFile(_0x4693a5,_0x3d2123);})[_0x0090('0x2e')](function(){try{fs[_0x0090('0x21')](_0x4693a5);fs[_0x0090('0x3d')](_0x3d2123,'777');}catch(_0x503878){logger[_0x0090('0x20')](_0x503878);}return _0x3d2123['split']('.')[0x0];});};exports[_0x0090('0x80')]=function(_0x154c0a,_0x4f1c06,_0x18d826,_0x2851ff){var _0xf7c705=util[_0x0090('0x7e')](_0x0090('0x81'),ISPEECH_API,_0x4f1c06,_0x18d826,base64Encode(_0x154c0a),_0x2851ff?util['format'](_0x0090('0x82'),encodeURIComponent(_0x2851ff)):_0x0090('0x83'));return uploadFile(_0xf7c705)[_0x0090('0x2e')](function(_0x1e8286){return querystring[_0x0090('0x9')](_0x1e8286);});};exports[_0x0090('0x84')]=function(_0x1d558d,_0x541967){return sestek[_0x0090('0x85')](_0x1d558d,_0x541967)[_0x0090('0x2e')](function(_0x3c9d7a){logger['info'](JSON[_0x0090('0x42')](_0x3c9d7a));var _0x344078={'speech':_0x3c9d7a[_0x0090('0x86')],'action':_0x3c9d7a[_0x0090('0x87')]?_0x3c9d7a[_0x0090('0x87')][_0x0090('0x88')]:undefined,'actiondata':_0x3c9d7a[_0x0090('0x87')]?_0x3c9d7a[_0x0090('0x87')][_0x0090('0x89')]:undefined};if(_0x3c9d7a[_0x0090('0x87')]&&_0x3c9d7a['channelData'][_0x0090('0x8a')]){return base64Decode(_0x3c9d7a[_0x0090('0x87')]['AudioFromTts'][_0x0090('0x8b')],path[_0x0090('0x28')](__dirname,'tmp',rs[_0x0090('0x2a')](0x4)+_0x0090('0x2b')))[_0x0090('0x2e')](function(_0x5af2ad){_0x344078['audiofile']=_0x5af2ad;return _0x344078;});}return _0x344078;});};exports[_0x0090('0x8c')]=function(){return __dirname;}; \ No newline at end of file diff --git a/server/services/agi/scripts/sestek/index.js b/server/services/agi/scripts/sestek/index.js index a720fa1..35ec9cc 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 _0x4671=['exports','./nda'];(function(_0xe06071,_0x4eeaa1){var _0x8ad8be=function(_0xb48521){while(--_0xb48521){_0xe06071['push'](_0xe06071['shift']());}};_0x8ad8be(++_0x4eeaa1);}(_0x4671,0x8f));var _0x1467=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x4671[_0x14add3];return _0x4a174f;};var nda=require(_0x1467('0x0'));module[_0x1467('0x1')]={'nda':nda}; \ No newline at end of file +var _0x686a=['exports'];(function(_0x22f07d,_0x1c816f){var _0x443806=function(_0x5afaf6){while(--_0x5afaf6){_0x22f07d['push'](_0x22f07d['shift']());}};_0x443806(++_0x1c816f);}(_0x686a,0xe8));var _0xa686=function(_0x28f1de,_0x355054){_0x28f1de=_0x28f1de-0x0;var _0x5b5dad=_0x686a[_0x28f1de];return _0x5b5dad;};var nda=require('./nda');module[_0xa686('0x0')]={'nda':nda}; \ No newline at end of file diff --git a/server/services/agi/scripts/sestek/nda/index.js b/server/services/agi/scripts/sestek/nda/index.js index eadd81d..06f1e5f 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 _0x9086=['exports','POST','ndauth_url','username','then','resolve','/api/NaturalDialogAssistant/v1/Run','message','Nda','uniqueid','callerid','calleridname','extension','text','Bearer\x20','access_token','project','body','channelData','ProjectName','AudioOutputSettings','audio/wav','CustomAction','custom_action','custom_action_data','CustomActionData','info','request-promise','url','agi'];(function(_0xbac38b,_0x594e20){var _0x353527=function(_0xa6cfb0){while(--_0xa6cfb0){_0xbac38b['push'](_0xbac38b['shift']());}};_0x353527(++_0x594e20);}(_0x9086,0x10b));var _0x6908=function(_0x19d828,_0x2439ce){_0x19d828=_0x19d828-0x0;var _0x25b133=_0x9086[_0x19d828];return _0x25b133;};'use strict';var rp=require(_0x6908('0x0'));var url=require(_0x6908('0x1'));var logger=require('../../../../../config/logger')(_0x6908('0x2'));module[_0x6908('0x3')]=function(_0x38d58b,_0x230e29){var _0x17351a={'method':_0x6908('0x4'),'uri':url['resolve'](_0x230e29[_0x6908('0x5')],'/token'),'form':{'grant_type':'password','username':_0x230e29[_0x6908('0x6')],'password':_0x230e29['password']},'json':!![]};return rp(_0x17351a)[_0x6908('0x7')](function(_0x2049a1){var _0x2ce577={'method':'POST','uri':url[_0x6908('0x8')](_0x230e29['ndassistant_url'],_0x6908('0x9')),'body':{'type':_0x230e29['ndaactivity_type']||_0x6908('0xa'),'channelId':_0x6908('0xb'),'conversation':{'id':_0x38d58b[_0x6908('0xc')]},'from':{'id':_0x38d58b[_0x6908('0xd')],'name':_0x38d58b[_0x6908('0xe')]},'recipient':{'id':_0x38d58b['dnid'],'name':_0x38d58b[_0x6908('0xf')]},'text':_0x230e29[_0x6908('0x10')],'channelData':{}},'headers':{'Authorization':_0x6908('0x11')+_0x2049a1[_0x6908('0x12')]},'json':!![]};if(_0x230e29[_0x6908('0x13')]){_0x2ce577[_0x6908('0x14')][_0x6908('0x15')][_0x6908('0x16')]=_0x230e29[_0x6908('0x13')];}if(_0x230e29['ndagenerate_audio']=='1'){_0x2ce577[_0x6908('0x14')]['channelData'][_0x6908('0x17')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x6908('0x18')};}if(_0x230e29['custom_action']){_0x2ce577[_0x6908('0x14')][_0x6908('0x15')][_0x6908('0x19')]=_0x230e29[_0x6908('0x1a')];if(_0x230e29[_0x6908('0x1b')]){_0x2ce577['body']['channelData'][_0x6908('0x1c')]=_0x230e29[_0x6908('0x1b')];}}logger[_0x6908('0x1d')](JSON['stringify'](_0x2ce577));return rp(_0x2ce577);});}; \ No newline at end of file +var _0x6ce9=['../../../../../config/logger','POST','resolve','ndauth_url','password','username','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','message','Nda','uniqueid','callerid','calleridname','dnid','extension','text','Bearer\x20','project','body','channelData','ndagenerate_audio','AudioOutputSettings','audio/wav','custom_action','CustomAction','custom_action_data','CustomActionData','stringify','request-promise','url'];(function(_0x4ba2d2,_0x9f2ef){var _0x179cc9=function(_0x89e18f){while(--_0x89e18f){_0x4ba2d2['push'](_0x4ba2d2['shift']());}};_0x179cc9(++_0x9f2ef);}(_0x6ce9,0x76));var _0x96ce=function(_0x396474,_0x4d3a6a){_0x396474=_0x396474-0x0;var _0x525676=_0x6ce9[_0x396474];return _0x525676;};'use strict';var rp=require(_0x96ce('0x0'));var url=require(_0x96ce('0x1'));var logger=require(_0x96ce('0x2'))('agi');module['exports']=function(_0x18bbb2,_0x5bf6d5){var _0x28a6a3={'method':_0x96ce('0x3'),'uri':url[_0x96ce('0x4')](_0x5bf6d5[_0x96ce('0x5')],'/token'),'form':{'grant_type':_0x96ce('0x6'),'username':_0x5bf6d5[_0x96ce('0x7')],'password':_0x5bf6d5[_0x96ce('0x6')]},'json':!![]};return rp(_0x28a6a3)['then'](function(_0x1abd8c){var _0x16a140={'method':_0x96ce('0x3'),'uri':url['resolve'](_0x5bf6d5['ndassistant_url'],_0x96ce('0x8')),'body':{'type':_0x5bf6d5[_0x96ce('0x9')]||_0x96ce('0xa'),'channelId':_0x96ce('0xb'),'conversation':{'id':_0x18bbb2[_0x96ce('0xc')]},'from':{'id':_0x18bbb2[_0x96ce('0xd')],'name':_0x18bbb2[_0x96ce('0xe')]},'recipient':{'id':_0x18bbb2[_0x96ce('0xf')],'name':_0x18bbb2[_0x96ce('0x10')]},'text':_0x5bf6d5[_0x96ce('0x11')],'channelData':{}},'headers':{'Authorization':_0x96ce('0x12')+_0x1abd8c['access_token']},'json':!![]};if(_0x5bf6d5[_0x96ce('0x13')]){_0x16a140[_0x96ce('0x14')][_0x96ce('0x15')]['ProjectName']=_0x5bf6d5[_0x96ce('0x13')];}if(_0x5bf6d5[_0x96ce('0x16')]=='1'){_0x16a140[_0x96ce('0x14')][_0x96ce('0x15')][_0x96ce('0x17')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x96ce('0x18')};}if(_0x5bf6d5[_0x96ce('0x19')]){_0x16a140[_0x96ce('0x14')][_0x96ce('0x15')][_0x96ce('0x1a')]=_0x5bf6d5[_0x96ce('0x19')];if(_0x5bf6d5[_0x96ce('0x1b')]){_0x16a140[_0x96ce('0x14')][_0x96ce('0x15')][_0x96ce('0x1c')]=_0x5bf6d5['custom_action_data'];}}logger['info'](JSON[_0x96ce('0x1d')](_0x16a140));return rp(_0x16a140);});}; \ No newline at end of file diff --git a/server/services/agi/scripts/tilde/asr/index.js b/server/services/agi/scripts/tilde/asr/index.js index 844af1b..b882d4e 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 _0xf954=['./lib/api','exports'];(function(_0x27451a,_0x2d14e0){var _0x2296d3=function(_0x4e4042){while(--_0x4e4042){_0x27451a['push'](_0x27451a['shift']());}};_0x2296d3(++_0x2d14e0);}(_0xf954,0x10e));var _0x4f95=function(_0x4c06ac,_0x568788){_0x4c06ac=_0x4c06ac-0x0;var _0x2333cb=_0xf954[_0x4c06ac];return _0x2333cb;};'use strict';var asr=require(_0x4f95('0x0'));module[_0x4f95('0x1')]=function(_0xff99e2,_0x3566ed,_0x3a559c,_0x32b836){return asr(_0xff99e2,_0x3566ed,_0x3a559c,_0x32b836);}; \ No newline at end of file +var _0xe3a3=['exports'];(function(_0x5645ad,_0x580ea3){var _0x17d292=function(_0xe66902){while(--_0xe66902){_0x5645ad['push'](_0x5645ad['shift']());}};_0x17d292(++_0x580ea3);}(_0xe3a3,0x1d7));var _0x3e3a=function(_0x525a65,_0x3c77d7){_0x525a65=_0x525a65-0x0;var _0x280efa=_0xe3a3[_0x525a65];return _0x280efa;};'use strict';var asr=require('./lib/api');module[_0x3e3a('0x0')]=function(_0x56ad0f,_0x3c5b3b,_0x446edc,_0x4f360a){return asr(_0x56ad0f,_0x3c5b3b,_0x446edc,_0x4f360a);}; \ No newline at end of file diff --git a/server/services/agi/scripts/tilde/asr/lib/api.js b/server/services/agi/scripts/tilde/asr/lib/api.js index 62b970c..27baa46 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 _0xf6e4=['digest','Open\x20Tilde\x20ASR\x20socket','unix','stringify','createReadStream','data','send','close','EOS','error','Tilde\x20ASR\x20send\x20error','terminate','parse','status','result','final','hypotheses','likelihood','Success.','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Tilde\x20ASR\x20parse\x20error','Close\x20Tilde\x20ASR\x20socket','Error\x20Tilde\x20ASR\x20socket','isNil','isObject','message','bluebird','crypto','../../../../../../config/logger','exports','info','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','createHash','update'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0xf6e4,0x1be));var _0x4f6e=function(_0x45f854,_0x1c95dc){_0x45f854=_0x45f854-0x0;var _0x3d4c00=_0xf6e4[_0x45f854];return _0x3d4c00;};'use strict';var BPromise=require(_0x4f6e('0x0'));var _=require('lodash');var fs=require('fs');var WebSocket=require('ws');var moment=require('moment');var crypto=require(_0x4f6e('0x1'));var logger=require(_0x4f6e('0x2'))('agi');module[_0x4f6e('0x3')]=function(_0x7b2876,_0x2fd762,_0x1050a3,_0x45ea14){return new BPromise(function(_0x504493,_0x14203c){logger[_0x4f6e('0x4')](_0x4f6e('0x5'),_0x45ea14||_0x4f6e('0x6'));var _0x546bff=new WebSocket(_0x45ea14||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE',{'perMessageDeflate':![]});var _0x4afef9='';var _0x50e2f1='0';var _0x5d2495='1';var _0x271305=_0x4f6e('0x7');function _0x50be16(_0x24c4d4){var _0x2e1487=crypto[_0x4f6e('0x8')]('sha1');_0x2e1487[_0x4f6e('0x9')](_0x24c4d4);return _0x2e1487[_0x4f6e('0xa')]('hex');}function _0x2aef93(){try{logger[_0x4f6e('0x4')](_0x4f6e('0xb'));var _0x219e0b=moment()[_0x4f6e('0xc')]();var _0x497388=_0x50be16(_0x219e0b+_0x2fd762+_0x1050a3);_0x546bff['send'](JSON[_0x4f6e('0xd')]({'appID':_0x2fd762,'timestamp':_0x219e0b,'appKey':_0x497388}));var _0xc8cdac=fs[_0x4f6e('0xe')](_0x7b2876);_0xc8cdac['on'](_0x4f6e('0xf'),function(_0x106165){_0x546bff[_0x4f6e('0x10')](_0x106165);});_0xc8cdac['on'](_0x4f6e('0x11'),function(){_0x546bff[_0x4f6e('0x10')](_0x4f6e('0x12'));});}catch(_0x192fae){logger[_0x4f6e('0x13')](_0x4f6e('0x14'),JSON[_0x4f6e('0xd')](_0x192fae));_0x546bff[_0x4f6e('0x15')]();}}function _0x3674a4(_0x36eb02){try{if(_0x36eb02){var _0x2fba30=JSON[_0x4f6e('0x16')](_0x36eb02);switch(_0x2fba30[_0x4f6e('0x17')]){case 0x0:if(_0x2fba30[_0x4f6e('0x18')]){if(_0x2fba30[_0x4f6e('0x18')][_0x4f6e('0x19')]){logger[_0x4f6e('0x4')]('Tilde\x20ASR\x20hypoteses',JSON[_0x4f6e('0xd')](_0x2fba30[_0x4f6e('0x18')]['hypotheses']));_0x4afef9=_0x2fba30[_0x4f6e('0x18')][_0x4f6e('0x1a')][0x0]['transcript'];_0x50e2f1=_0x2fba30[_0x4f6e('0x18')][_0x4f6e('0x1a')][0x0][_0x4f6e('0x1b')];_0x5d2495='0';_0x271305=_0x4f6e('0x1c');_0x546bff[_0x4f6e('0x15')]();}}break;case 0x1:logger[_0x4f6e('0x4')](_0x4f6e('0x7'));_0x5d2495='1';_0x271305='No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech';break;case 0x2:logger[_0x4f6e('0x4')](_0x4f6e('0x1d'));_0x5d2495='2';_0x271305=_0x4f6e('0x1d');break;case 0x9:logger[_0x4f6e('0x4')]('Not\x20available.\x20Max\x20load\x20limit\x20reached.');_0x5d2495='9';_0x271305='Not\x20available.\x20Max\x20load\x20limit\x20reached.';break;case 0xa:logger[_0x4f6e('0x4')](_0x4f6e('0x1e'));_0x5d2495='10';_0x271305=_0x4f6e('0x1e');break;case 0xb:logger[_0x4f6e('0x4')](_0x4f6e('0x1f'));_0x5d2495='11';_0x271305=_0x4f6e('0x1f');}}}catch(_0xde3224){logger[_0x4f6e('0x13')](_0x4f6e('0x20'),JSON['stringify'](_0xde3224));_0x546bff[_0x4f6e('0x15')]();}}function _0x3d5fc3(){logger['info'](_0x4f6e('0x21'));_0x504493({'transcript':_0x4afef9,'confidence':_0x50e2f1,'status':_0x5d2495,'status_message':_0x271305});}function _0xf48f38(_0x3ebf91){logger[_0x4f6e('0x13')](_0x4f6e('0x22'));if(!_[_0x4f6e('0x23')](_0x3ebf91)){logger[_0x4f6e('0x13')](_[_0x4f6e('0x24')](_0x3ebf91)?JSON[_0x4f6e('0xd')](_0x3ebf91):_0x3ebf91);}}_0x546bff['on']('open',_0x2aef93);_0x546bff['on'](_0x4f6e('0x25'),_0x3674a4);_0x546bff['on'](_0x4f6e('0x11'),_0x3d5fc3);_0x546bff['on'](_0x4f6e('0x13'),_0xf48f38);});}; \ No newline at end of file +var _0x6b62=['close','EOS','error','terminate','parse','status','result','final','Tilde\x20ASR\x20hypoteses','hypotheses','likelihood','Success.','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Tilde\x20ASR\x20parse\x20error','Close\x20Tilde\x20ASR\x20socket','isNil','open','message','lodash','moment','../../../../../../config/logger','agi','info','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','createHash','sha1','update','hex','Open\x20Tilde\x20ASR\x20socket','send','stringify','createReadStream','data'];(function(_0x1e07e7,_0x247af2){var _0x42d587=function(_0x1a8ba1){while(--_0x1a8ba1){_0x1e07e7['push'](_0x1e07e7['shift']());}};_0x42d587(++_0x247af2);}(_0x6b62,0xce));var _0x26b6=function(_0x3f5872,_0xbd9e7b){_0x3f5872=_0x3f5872-0x0;var _0x5970e2=_0x6b62[_0x3f5872];return _0x5970e2;};'use strict';var BPromise=require('bluebird');var _=require(_0x26b6('0x0'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x26b6('0x1'));var crypto=require('crypto');var logger=require(_0x26b6('0x2'))(_0x26b6('0x3'));module['exports']=function(_0x1a0f11,_0x2a5292,_0x3b3d12,_0x10897d){return new BPromise(function(_0x3fb9c7,_0x11b714){logger[_0x26b6('0x4')]('Tilde\x20URI',_0x10897d||_0x26b6('0x5'));var _0x56949b=new WebSocket(_0x10897d||_0x26b6('0x5'),{'perMessageDeflate':![]});var _0x44f16b='';var _0x2773cd='0';var _0x3268eb='1';var _0x35de1f=_0x26b6('0x6');function _0x45cacc(_0x162213){var _0x6f6853=crypto[_0x26b6('0x7')](_0x26b6('0x8'));_0x6f6853[_0x26b6('0x9')](_0x162213);return _0x6f6853['digest'](_0x26b6('0xa'));}function _0x50f6d2(){try{logger['info'](_0x26b6('0xb'));var _0x4df97c=moment()['unix']();var _0x3c09ad=_0x45cacc(_0x4df97c+_0x2a5292+_0x3b3d12);_0x56949b[_0x26b6('0xc')](JSON[_0x26b6('0xd')]({'appID':_0x2a5292,'timestamp':_0x4df97c,'appKey':_0x3c09ad}));var _0xec3a8d=fs[_0x26b6('0xe')](_0x1a0f11);_0xec3a8d['on'](_0x26b6('0xf'),function(_0x4d7e1b){_0x56949b['send'](_0x4d7e1b);});_0xec3a8d['on'](_0x26b6('0x10'),function(){_0x56949b['send'](_0x26b6('0x11'));});}catch(_0x20db17){logger[_0x26b6('0x12')]('Tilde\x20ASR\x20send\x20error',JSON[_0x26b6('0xd')](_0x20db17));_0x56949b[_0x26b6('0x13')]();}}function _0x53638a(_0x5c337b){try{if(_0x5c337b){var _0xd3e476=JSON[_0x26b6('0x14')](_0x5c337b);switch(_0xd3e476[_0x26b6('0x15')]){case 0x0:if(_0xd3e476[_0x26b6('0x16')]){if(_0xd3e476[_0x26b6('0x16')][_0x26b6('0x17')]){logger['info'](_0x26b6('0x18'),JSON[_0x26b6('0xd')](_0xd3e476[_0x26b6('0x16')][_0x26b6('0x19')]));_0x44f16b=_0xd3e476[_0x26b6('0x16')][_0x26b6('0x19')][0x0]['transcript'];_0x2773cd=_0xd3e476['result']['hypotheses'][0x0][_0x26b6('0x1a')];_0x3268eb='0';_0x35de1f=_0x26b6('0x1b');_0x56949b[_0x26b6('0x13')]();}}break;case 0x1:logger[_0x26b6('0x4')](_0x26b6('0x6'));_0x3268eb='1';_0x35de1f=_0x26b6('0x6');break;case 0x2:logger[_0x26b6('0x4')](_0x26b6('0x1c'));_0x3268eb='2';_0x35de1f='Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.';break;case 0x9:logger[_0x26b6('0x4')]('Not\x20available.\x20Max\x20load\x20limit\x20reached.');_0x3268eb='9';_0x35de1f=_0x26b6('0x1d');break;case 0xa:logger[_0x26b6('0x4')](_0x26b6('0x1e'));_0x3268eb='10';_0x35de1f='Authentication\x20failed.';break;case 0xb:logger[_0x26b6('0x4')](_0x26b6('0x1f'));_0x3268eb='11';_0x35de1f='All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.';}}}catch(_0x2d70e2){logger[_0x26b6('0x12')](_0x26b6('0x20'),JSON[_0x26b6('0xd')](_0x2d70e2));_0x56949b[_0x26b6('0x13')]();}}function _0x65ef36(){logger[_0x26b6('0x4')](_0x26b6('0x21'));_0x3fb9c7({'transcript':_0x44f16b,'confidence':_0x2773cd,'status':_0x3268eb,'status_message':_0x35de1f});}function _0x2c2d18(_0x354c3e){logger[_0x26b6('0x12')]('Error\x20Tilde\x20ASR\x20socket');if(!_[_0x26b6('0x22')](_0x354c3e)){logger['error'](_['isObject'](_0x354c3e)?JSON[_0x26b6('0xd')](_0x354c3e):_0x354c3e);}}_0x56949b['on'](_0x26b6('0x23'),_0x50f6d2);_0x56949b['on'](_0x26b6('0x24'),_0x53638a);_0x56949b['on'](_0x26b6('0x10'),_0x65ef36);_0x56949b['on'](_0x26b6('0x12'),_0x2c2d18);});}; \ No newline at end of file diff --git a/server/services/agi/scripts/tilde/index.js b/server/services/agi/scripts/tilde/index.js index 6216245..28cc26c 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 _0x232a=['./asr'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0x232a,0xfa));var _0xa232=function(_0x5c1ac9,_0x3664c0){_0x5c1ac9=_0x5c1ac9-0x0;var _0x135919=_0x232a[_0x5c1ac9];return _0x135919;};var asr=require(_0xa232('0x0'));module['exports']={'asr':asr}; \ No newline at end of file +var _0x35f4=['./asr'];(function(_0x9028ee,_0x489bca){var _0x27a0db=function(_0x54a982){while(--_0x54a982){_0x9028ee['push'](_0x9028ee['shift']());}};_0x27a0db(++_0x489bca);}(_0x35f4,0x183));var _0x435f=function(_0x888385,_0x9cdc66){_0x888385=_0x888385-0x0;var _0x22d5c2=_0x35f4[_0x888385];return _0x22d5c2;};var asr=require(_0x435f('0x0'));module['exports']={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/server.js b/server/services/agi/server.js index 2b48fa9..8e10cf9 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 _0xa3ba=['code','close','nextTick','util','events','EventEmitter','./error','127.0.0.1','call','error','E_AGI_ARGUMENT_PORT','emit','listening','getConnections','E_AGI_SERVER_ERROR','destroy','E_AGI_SERVER_MAXCONNECTION','ready'];(function(_0xf1efb2,_0x5af75c){var _0x505f10=function(_0x28f232){while(--_0x28f232){_0xf1efb2['push'](_0xf1efb2['shift']());}};_0x505f10(++_0x5af75c);}(_0xa3ba,0xc9));var _0xaa3b=function(_0x4bc65f,_0x39ec43){_0x4bc65f=_0x4bc65f-0x0;var _0x44f85f=_0xa3ba[_0x4bc65f];return _0x44f85f;};'use strict';var util=require(_0xaa3b('0x0'));var net=require('net');var EventEmitter=require(_0xaa3b('0x1'))[_0xaa3b('0x2')];var AGIError=require(_0xaa3b('0x3'));var AGIChannel=require('./channel');var AGIServer=function(_0x2de794,_0x5bfb58,_0x36c0c6){var _0xf302ef=this,_0x2de794=_0x2de794||0x11dd,_0x5bfb58=_0x5bfb58||_0xaa3b('0x4'),_0x2676ca=null,_0x594c4d=0x0;EventEmitter[_0xaa3b('0x5')](_0xf302ef);function _0x1b51f5(){if(!_0x2de794){_0xf302ef['emit'](_0xaa3b('0x6'),new AGIError(_0xaa3b('0x7')));return![];}_0x2676ca=net['createServer']();_0x2676ca['listen'](_0x2de794,_0x5bfb58);_0x2676ca['on']('listening',function(){_0xf302ef[_0xaa3b('0x8')](_0xaa3b('0x9'));});_0x2676ca['on']('connection',function(_0x5e5875){_0x2676ca[_0xaa3b('0xa')](function(_0x4121bd,_0x5bf63){if(_0x4121bd){_0xf302ef[_0xaa3b('0x8')]('error',new AGIError(_0xaa3b('0xb'),_0x4121bd));}else if(_0x36c0c6&&_0x36c0c6<0x0){_0xf302ef[_0xaa3b('0x8')](_0xaa3b('0x6'),new AGIError('E_AGI_SERVER_VOICE_DISABLED'));_0x5e5875[_0xaa3b('0xc')]();}else if(_0x36c0c6&&_0x36c0c6>0x0&&_0x36c0c6<_0x5bf63){_0x594c4d+=0x1;_0xf302ef['emit']('error',new AGIError(_0xaa3b('0xd'),_0x594c4d));_0x5e5875[_0xaa3b('0xc')]();}else{var _0x59e6fa=new AGIChannel(_0x5e5875);_0x59e6fa['on'](_0xaa3b('0xe'),function(){_0xf302ef[_0xaa3b('0x8')]('connection',_0x59e6fa);});}});});_0x2676ca['on']('error',function(_0x137f32){_0xf302ef[_0xaa3b('0x8')]('error',new AGIError(_0xaa3b('0xb'),_0x137f32[_0xaa3b('0xf')]));});_0x2676ca['on'](_0xaa3b('0x10'),function(){_0xf302ef[_0xaa3b('0x8')]('close',new AGIError('E_AGI_SERVER_CLOSE'));});}process[_0xaa3b('0x11')](function(){_0x1b51f5();});};util['inherits'](AGIServer,EventEmitter);module['exports']=function(_0x1c03eb,_0x27f450,_0x211504){return new AGIServer(_0x1c03eb,_0x27f450,_0x211504);}; \ No newline at end of file +var _0x46a8=['E_AGI_SERVER_MAXCONNECTION','code','close','E_AGI_SERVER_CLOSE','nextTick','inherits','exports','util','net','./channel','127.0.0.1','emit','error','E_AGI_ARGUMENT_PORT','createServer','listen','listening','connection','getConnections','E_AGI_SERVER_ERROR','E_AGI_SERVER_VOICE_DISABLED','destroy'];(function(_0x383a9d,_0x298fd3){var _0x150332=function(_0x41fe69){while(--_0x41fe69){_0x383a9d['push'](_0x383a9d['shift']());}};_0x150332(++_0x298fd3);}(_0x46a8,0x151));var _0x846a=function(_0x59358f,_0x2cc171){_0x59358f=_0x59358f-0x0;var _0x4ffe87=_0x46a8[_0x59358f];return _0x4ffe87;};'use strict';var util=require(_0x846a('0x0'));var net=require(_0x846a('0x1'));var EventEmitter=require('events')['EventEmitter'];var AGIError=require('./error');var AGIChannel=require(_0x846a('0x2'));var AGIServer=function(_0xe33325,_0x2c8791,_0x3c5718){var _0x59fa2a=this,_0xe33325=_0xe33325||0x11dd,_0x2c8791=_0x2c8791||_0x846a('0x3'),_0x1fdf37=null,_0x3b6cbb=0x0;EventEmitter['call'](_0x59fa2a);function _0x680aed(){if(!_0xe33325){_0x59fa2a[_0x846a('0x4')](_0x846a('0x5'),new AGIError(_0x846a('0x6')));return![];}_0x1fdf37=net[_0x846a('0x7')]();_0x1fdf37[_0x846a('0x8')](_0xe33325,_0x2c8791);_0x1fdf37['on']('listening',function(){_0x59fa2a['emit'](_0x846a('0x9'));});_0x1fdf37['on'](_0x846a('0xa'),function(_0x13394c){_0x1fdf37[_0x846a('0xb')](function(_0x41b621,_0x147bb4){if(_0x41b621){_0x59fa2a[_0x846a('0x4')]('error',new AGIError(_0x846a('0xc'),_0x41b621));}else if(_0x3c5718&&_0x3c5718<0x0){_0x59fa2a[_0x846a('0x4')]('error',new AGIError(_0x846a('0xd')));_0x13394c[_0x846a('0xe')]();}else if(_0x3c5718&&_0x3c5718>0x0&&_0x3c5718<_0x147bb4){_0x3b6cbb+=0x1;_0x59fa2a[_0x846a('0x4')](_0x846a('0x5'),new AGIError(_0x846a('0xf'),_0x3b6cbb));_0x13394c['destroy']();}else{var _0x3d7957=new AGIChannel(_0x13394c);_0x3d7957['on']('ready',function(){_0x59fa2a['emit'](_0x846a('0xa'),_0x3d7957);});}});});_0x1fdf37['on']('error',function(_0x39a5f7){_0x59fa2a['emit'](_0x846a('0x5'),new AGIError(_0x846a('0xc'),_0x39a5f7[_0x846a('0x10')]));});_0x1fdf37['on']('close',function(){_0x59fa2a['emit'](_0x846a('0x11'),new AGIError(_0x846a('0x12')));});}process[_0x846a('0x13')](function(){_0x680aed();});};util[_0x846a('0x14')](AGIServer,EventEmitter);module[_0x846a('0x15')]=function(_0xb49454,_0x555354,_0x20eef2){return new AGIServer(_0xb49454,_0x555354,_0x20eef2);}; \ No newline at end of file diff --git a/server/services/agi/vertices.js b/server/services/agi/vertices.js index bde19d0..fb3810d 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 _0x199c=['no\x20intervals\x20found','IFTIME\x20%s\x20%s','true','hangup','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','ispeech\x20%s\x20file\x20created','IspeechASR\x20Result\x20%s','ispeechtts','Trying\x20ispeech\x20TTS\x20%s','ispeech\x20TTS\x20is\x20unreachable','login','Enter\x20in\x20LOGIN\x20(%s)\x20block','no\x20find\x20by\x20configured','findBy','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','logout','FIND\x20AGENT\x20%s\x20BY\x20%s','failure','math','operation','no\x20operation\x20configured','math\x20%s','%s[%s]','variable\x20%s[key]\x20set','Enter\x20in\x20MENU\x20(%s)\x20block','output','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','getPause','pause_id','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','Executed\x20command\x20%s\x20%s','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','indexOf','macro','gosub','position','recordingFormat','%s_%s','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','restapi','Response:','inspect','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','%s_STATUS_MESSAGE','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','digits','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','number','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','no\x20mail\x20account\x20configured','account_id','Smtp','no\x20mail\x20account\x20found','email','user','bcc','subject','service','host','port','secure','authentication','auth','pass','template_id','sendMail\x20message','Trying\x20SendMail\x20with\x20account\x20%s','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','sendSMS','sms_account_id','no\x20sms\x20account\x20configured','Trying\x20SendSMS\x20with\x20account\x20%s','set','variable_value','start','Enter\x20in\x20START\x20(%s)\x20block','yes','Skipped\x20Answer','subproject','project_id','no\x20subproject\x20selected','getSquareProject','no\x20subproject\x20found\x20with\x20id\x20%d','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','agi://%s/square,\x22%s\x22,\x22%s\x22','127.0.0.1','system','Enter\x20in\x20SYSTEM\x20(%s)\x20block','command','google_cloud_tts','apiKey','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','tts','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20is\x20unreachable','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','Enter\x20in\x20SWITCH\x20(%s)\x20block','no\x20variable\x20selected','join','exports','path','util','lodash','odbc','randomstring','moment','../../config/logger','agi','../../config/environment','./scripts','/var/opt/motion2/server/files','rawHeaders','menu','channel','mailRpc','prototype','rpc','name','catch','getVoiceQueue','then','getSquareOdbc','getSquareOdbcById','dsn','getUserById','getTrunk','getTrunkById','getSoundById','getSoundPath','save_name','getMailAccount','getIntervals','getIntervalById','IntervalId','interval','format','%s/sounds/converted/%s','getQueryOdbc','open','error','Error\x20getting\x20ODBC\x20connection\x20%s','info','ODBC\x20connection\x20successfully','Error\x20executing\x20query\x20%s','Query\x20executed\x20correctly\x20%s','close','Error\x20closing\x20connection\x20to\x20odbc\x20%s','createSmsMessage','createSquareDetailsReport','uniqueid','label','agicommand','arg_1','callerid','createSquareRecording','extension','priority','dnid','file','createSquareMessage','createCmContact','isEmpty','isNil','random','lastName','list_id','scheduledAt','toString','callback_priority','getPauseById','agentPause','agentUnpause','agentLogout','agentLogin','internal','%s/%s@from-sip/n','exec','trim','googleCloudTTS','text','languageCode','en-US','ssmlGender','MALE','MP3','googleTTS','google_tts_language','restAPI','url','method','timeout','includes','POST','PUT','toUpperCase','body','rawBody','parse','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','computedVariables','sync','render','stringify','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','statusMessage','message','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','key','dialogflow_language','googleDialogflowV2','client_email','sestekNDA','ispeechTTS','ispeech_tts_language','speed','ispeechASR','ispeech_asr_language','isConfigured','model','awsPolly','aws_access_key_id','aws_secret_access_key','aws_text_type','awsLex','aws_lex_region','googleASR','google_asr_language','appsecret','uri','clear','clone','replaceObjectAllVariables','replaceAllVariables','recursiveNodeIndex','hasOwnProperty','isPlainObject','isArray','isString','saveRestApiResult','%s.%s','length','split','extra','getAndSetVariable','setVariable','maxRetry','mrcpsynth','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','MRCPSynth','result','noop','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','grammar','no\x20grammar\x20configured','MRCP_RECOG_CONFIDENCE','MRCP_RECOG_TRANSCRIPT','RECOG_INSTANCE()','MRCP_RECOG_INSTANCE','Enter\x20in\x20AGI\x20(%s)\x20block','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','wait','callback','Enter\x20in\x20CALLBACK\x20(%s)\x20block','no\x20list\x20selected','delay','phone','custom_app','application','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','no\x20text\x20configured','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','LUMENVOX_ASR_CONFIDENCE','RECOG_INPUT()','LUMENVOX_ASR_TRANSCRIPT','LUMENVOX_ASR_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','sestekasr','MRCPRecog','RECOG_CONFIDENCE()','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_INSTANCE','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20database\x20selected','no\x20odbc\x20database\x20found','query','replace','query:\x20%s','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','getVariable','forEach','%s_ROWS_COUNT','variable\x20%s\x20set','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','no\x20user\x20selected','no\x20user\x20found','DIAL','SIP/%s','Executed\x20command\x20%s','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','speech','out','Dialogflow\x20is\x20unreachable','dialogflowV2','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','dialogflowV2_project_id','no\x20client_email\x20configured','no\x20private_key\x20configured','no\x20anguage\x20configured','Trying\x20DialogflowV2:\x20%s','providerResponse','DIALOGFLOW_%s','DialogflowV2\x20Result\x20%s','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','no\x20ndauth\x20url\x20configured','username','no\x20password\x20configured','ndassistant_url','bot','Trying\x20SestekNDA:\x20%s','SESTEK_NDA_%s','sesteknda','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','unlink','.wav','SestekNDA\x20Result\x20%s','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','opts','Enter\x20in\x20FINALLY\x20(%s)\x20block','finally','getdigits','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','retry','file_id','getSound','no\x20file\x20audio\x20found','response','maxdigit','mindigit','no\x20variable\x20found','hiddendigitsnum','generate','hiddendigitspos','first','substr','getsecretdigits','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','GOAL\x20%s','goalname','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','aws\x20Polly\x20%s\x20file\x20created','streamFile','aws\x20Polly\x20is\x20unreachable','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','aws_bot_name','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','AWS_LEX_%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','Amazon\x20Lex\x20is\x20unreachable','wav','%s/recordings/%s','beep','NOBEEP','intKey','google\x20%s\x20file\x20created','GoogleASR\x20Result\x20%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','appid','no\x20appid\x20configured','no\x20appsecret\x20configured','recordFile','tildeASR','TildeASR\x20Result\x20%s','gotoc','continueAt','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','no\x20condition\x20configured','EVAL\x20CONDITION\x20%s\x20%s','false','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','no\x20interval\x20configured'];(function(_0x255cab,_0x53a59e){var _0x53fd8b=function(_0x4268c4){while(--_0x4268c4){_0x255cab['push'](_0x255cab['shift']());}};_0x53fd8b(++_0x53a59e);}(_0x199c,0x7b));var _0xc199=function(_0x3fff3b,_0x5be12a){_0x3fff3b=_0x3fff3b-0x0;var _0xdfdc32=_0x199c[_0x3fff3b];return _0xdfdc32;};'use strict';var fs=require('fs');var path=require(_0xc199('0x0'));var util=require(_0xc199('0x1'));var _=require(_0xc199('0x2'));var sh=require('shelljs');var odbc=require(_0xc199('0x3'))();var rs=require(_0xc199('0x4'));var moment=require(_0xc199('0x5'));var Mustache=require('mustache');var rp=require('request-promise');var logger=require(_0xc199('0x6'))(_0xc199('0x7'));var config=require(_0xc199('0x8'));var scripts=require(_0xc199('0x9'));var FILES_PATH=_0xc199('0xa');var recursiveMapAttributes=[_0xc199('0xb'),'rawBody'];var verticesWithRetry=[_0xc199('0xc'),'getdigits','getsecretdigits'];var AGIVertices=function(_0x4d2c0d,_0x172dce,_0x3af5cc){this[_0xc199('0xd')]=_0x4d2c0d;this['rpc']=_0x172dce;this[_0xc199('0xe')]=_0x3af5cc;};AGIVertices[_0xc199('0xf')]['getVariable']=function(_0x1493b5,_0x45d641){this[_0xc199('0x10')]['getVariableById'](_0x1493b5)['then'](function(_0x57c280){_0x45d641(null,_0x57c280?_0x57c280[_0xc199('0x11')]:![]);})[_0xc199('0x12')](function(_0x3112d9){_0x45d641(_0x3112d9);});};AGIVertices[_0xc199('0xf')][_0xc199('0x13')]=function(_0x187dd8,_0x3936c){this['rpc']['getVoiceQueueById'](_0x187dd8)[_0xc199('0x14')](function(_0x414aa5){_0x3936c(null,_0x414aa5?_0x414aa5[_0xc199('0x11')]:![]);})[_0xc199('0x12')](function(_0x3459d9){_0x3936c(_0x3459d9);});};AGIVertices[_0xc199('0xf')]['getSquareProject']=function(_0x25fc10,_0x22ba85){this[_0xc199('0x10')]['getSquareProjectById'](_0x25fc10)['then'](function(_0x44892a){_0x22ba85(null,_0x44892a?_0x44892a['name']:![]);})['catch'](function(_0x445adf){_0x22ba85(_0x445adf);});};AGIVertices['prototype'][_0xc199('0x15')]=function(_0x3a8370,_0x7f3518){this[_0xc199('0x10')][_0xc199('0x16')](_0x3a8370)[_0xc199('0x14')](function(_0x2fb987){_0x7f3518(null,_0x2fb987?_0x2fb987[_0xc199('0x17')]:![]);})[_0xc199('0x12')](function(_0x4857a1){_0x7f3518(_0x4857a1);});};AGIVertices[_0xc199('0xf')]['getUser']=function(_0x20c391,_0x3ed957){this['rpc'][_0xc199('0x18')](_0x20c391)['then'](function(_0x18a20a){_0x3ed957(null,_0x18a20a?_0x18a20a[_0xc199('0x11')]:![]);})[_0xc199('0x12')](function(_0xcf659c){_0x3ed957(_0xcf659c);});};AGIVertices[_0xc199('0xf')][_0xc199('0x19')]=function(_0x1dc1a9,_0x29eb0d){this['rpc'][_0xc199('0x1a')](_0x1dc1a9)[_0xc199('0x14')](function(_0x4e4701){_0x29eb0d(null,_0x4e4701?_0x4e4701[_0xc199('0x11')]:![]);})[_0xc199('0x12')](function(_0x31d098){_0x29eb0d(_0x31d098);});};AGIVertices[_0xc199('0xf')]['getSound']=function(_0x86bbb1,_0x3a97be){var _0x189099=this;this[_0xc199('0x10')][_0xc199('0x1b')](_0x86bbb1)[_0xc199('0x14')](function(_0x7cd50c){_0x3a97be(null,_0x7cd50c?_0x189099[_0xc199('0x1c')](_0x7cd50c[_0xc199('0x1d')]):![]);})[_0xc199('0x12')](function(_0x5558b1){_0x3a97be(_0x5558b1);});};AGIVertices['prototype'][_0xc199('0x1e')]=function(_0x56d576,_0x4c85dd){this[_0xc199('0x10')]['getMailAccountById'](_0x56d576)['then'](function(_0xd09144){_0x4c85dd(null,_0xd09144?_0xd09144:![]);})[_0xc199('0x12')](function(_0x165296){_0x4c85dd(_0x165296);});};AGIVertices[_0xc199('0xf')]['sendMailMessage']=function(_0x42be5d,_0x59a193,_0xbd6526){this[_0xc199('0xe')]['sendMailMessage'](_0x42be5d,_0x59a193)['then'](function(){_0xbd6526(null);})[_0xc199('0x12')](function(_0x2ff295){_0xbd6526(_0x2ff295);});};AGIVertices[_0xc199('0xf')][_0xc199('0x1f')]=function(_0x255277,_0x327cf5){this['rpc'][_0xc199('0x20')](_0x255277)[_0xc199('0x14')](function(_0x271875){if(_0x271875){if(_0x271875[_0xc199('0x21')]){_0x327cf5(null,[_0x271875['interval']]);}else{_0x327cf5(null,_['map'](_0x271875['Intervals'],_0xc199('0x22')));}}else{_0x327cf5(null,![]);}})[_0xc199('0x12')](function(_0xd83b5c){_0x327cf5(_0xd83b5c);});};AGIVertices[_0xc199('0xf')]['getSoundPath']=function(_0xac0f9){return util[_0xc199('0x23')](_0xc199('0x24'),FILES_PATH,_0xac0f9);};AGIVertices[_0xc199('0xf')][_0xc199('0x25')]=function(_0x54ca32,_0x302efd,_0x397061){odbc[_0xc199('0x26')](_0x54ca32,function(_0x2b53d9){if(_0x2b53d9){logger[_0xc199('0x27')](_0xc199('0x28'),_0x2b53d9);_0x397061(_0x2b53d9);}else{logger[_0xc199('0x29')](_0xc199('0x2a'));odbc['query'](_0x302efd,function(_0x3807f6,_0x2779de){if(_0x3807f6){logger['info'](_0xc199('0x2b'),_0x302efd);_0x397061(_0x3807f6);}else{logger['info'](_0xc199('0x2c'),_0x302efd);odbc[_0xc199('0x2d')](function(_0x59d19d){if(_0x59d19d){logger['error'](_0xc199('0x2e'),_0x59d19d);}_0x397061(null,_0x2779de);});}});}});};AGIVertices['prototype']['getSmsAccount']=function(_0x3ccac5,_0xe4614b){this[_0xc199('0x10')]['getSmsAccountById'](_0x3ccac5)['then'](function(_0x24ad25){_0xe4614b(null,_0x24ad25?_0x24ad25:![]);})[_0xc199('0x12')](function(_0x297ea4){_0xe4614b(_0x297ea4);});};AGIVertices['prototype'][_0xc199('0x2f')]=function(_0x42fe43,_0x482137){this[_0xc199('0x10')]['createSmsMessage'](_0x42fe43)[_0xc199('0x14')](function(_0x27a3d0){_0x482137(null,_0x27a3d0);})[_0xc199('0x12')](function(_0xeffa22){_0x482137(_0xeffa22);});};AGIVertices[_0xc199('0xf')][_0xc199('0x30')]=function(_0x62ea5c,_0x25270a,_0x3a6f4d){this[_0xc199('0x10')][_0xc199('0x30')]({'uniqueid':this[_0xc199('0xd')][_0xc199('0x31')],'node':_0x62ea5c[_0xc199('0x32')],'application':_0x62ea5c[_0xc199('0x33')],'data':_0x25270a||null,'project_name':this[_0xc199('0xd')][_0xc199('0x34')],'callerid':this[_0xc199('0xd')][_0xc199('0x35')]})['then'](function(_0x3c7111){if(_0x3a6f4d){_0x3a6f4d(null,_0x3c7111);}})[_0xc199('0x12')](function(_0x5e9d81){if(_0x3a6f4d){_0x3a6f4d(_0x5e9d81);}});};AGIVertices[_0xc199('0xf')][_0xc199('0x36')]=function(_0x31ab0c,_0x3353a7,_0x1ba1bb,_0x5cdcde){this['rpc'][_0xc199('0x36')]({'uniqueid':this['channel'][_0xc199('0x31')],'callerid':this[_0xc199('0xd')][_0xc199('0x35')],'calleridname':this[_0xc199('0xd')]['calleridname'],'context':this[_0xc199('0xd')]['context'],'extension':this[_0xc199('0xd')][_0xc199('0x37')],'priority':this[_0xc199('0xd')][_0xc199('0x38')],'accountcode':this['channel']['accountcode'],'dnid':this[_0xc199('0xd')][_0xc199('0x39')],'projectName':this[_0xc199('0xd')][_0xc199('0x34')],'saveName':_0x3353a7,'filename':_0x31ab0c[_0xc199('0x3a')]||_0x3353a7,'savePath':_0x1ba1bb})['then'](function(_0x1863cd){_0x5cdcde(null,_0x1863cd);})[_0xc199('0x12')](function(_0x35d1e5){_0x5cdcde(_0x35d1e5);});};AGIVertices[_0xc199('0xf')][_0xc199('0x3b')]=function(_0x181c42,_0x5eed75,_0x325a53,_0x3ccee2,_0x30e00d){this[_0xc199('0x10')]['createSquareMessage']({'uniqueid':this['channel'][_0xc199('0x31')],'body':_0x181c42,'direction':_0x5eed75,'providerName':_0x325a53,'providerResponse':_0x3ccee2})['then'](function(_0xd09239){if(_0x30e00d){_0x30e00d(null,_0xd09239);}})[_0xc199('0x12')](function(_0x5dc5ca){if(_0x30e00d){_0x30e00d(_0x5dc5ca);}});};AGIVertices[_0xc199('0xf')][_0xc199('0x3c')]=function(_0x19221a,_0xfbc909){this[_0xc199('0x10')]['createCmContact']({'firstName':_[_0xc199('0x3d')](_0x19221a[_0xc199('0x11')])||_[_0xc199('0x3e')](_0x19221a[_0xc199('0x11')])?'callback_'+Math[_0xc199('0x3f')]():_0x19221a[_0xc199('0x11')],'lastName':_[_0xc199('0x3d')](_0x19221a[_0xc199('0x40')])||_[_0xc199('0x3e')](_0x19221a[_0xc199('0x40')])?null:_0x19221a['lastName'],'phone':_0x19221a['phone'],'ListId':_0x19221a[_0xc199('0x41')],'scheduledat':_0x19221a['scheduledAt'],'callbackUniqueid':this[_0xc199('0xd')][_0xc199('0x31')],'tags':'callback','description':'Callback\x20scheduled\x20at\x20'+_0x19221a[_0xc199('0x42')][_0xc199('0x43')](),'priority':_0x19221a[_0xc199('0x44')]})['then'](function(_0x1eac7a){_0xfbc909(null,_0x1eac7a);})[_0xc199('0x12')](function(_0x31f7bf){_0xfbc909(_0x31f7bf);});};AGIVertices[_0xc199('0xf')]['getPause']=function(_0x1f63ae,_0x5e919f){this['rpc'][_0xc199('0x45')](_0x1f63ae)[_0xc199('0x14')](function(_0x6c1ac9){_0x5e919f(null,_0x6c1ac9?_0x6c1ac9[_0xc199('0x11')]:![]);})[_0xc199('0x12')](function(_0x329805){_0x5e919f(_0x329805);});};AGIVertices[_0xc199('0xf')][_0xc199('0x46')]=function(_0x5e0f05,_0x29f609,_0x41cfcc){var _0x5bd31c={'role':'agent'};_0x5bd31c[_0x5e0f05]=this[_0xc199('0xd')][_0xc199('0x35')];this['rpc'][_0xc199('0x46')](_0x5bd31c,_0x29f609,this['channel'][_0xc199('0x31')])['then'](function(_0x58344f){_0x41cfcc(null,_[_0xc199('0x3e')](_0x58344f)?![]:!![]);})[_0xc199('0x12')](function(_0x39bf3f){logger[_0xc199('0x27')](_0x39bf3f);_0x41cfcc(null,![]);});};AGIVertices['prototype'][_0xc199('0x47')]=function(_0x421084,_0x512776){var _0xd5d450={'role':'agent'};_0xd5d450[_0x421084]=this[_0xc199('0xd')]['callerid'];this['rpc'][_0xc199('0x47')](_0xd5d450)[_0xc199('0x14')](function(_0x47ad96){_0x512776(null,_[_0xc199('0x3e')](_0x47ad96)?![]:!![]);})[_0xc199('0x12')](function(_0x4642f6){logger[_0xc199('0x27')](_0x4642f6);_0x512776(null,![]);});};AGIVertices[_0xc199('0xf')][_0xc199('0x48')]=function(_0x2c9f48,_0x38e9cf){var _0x5b3874={'role':'agent'};_0x5b3874[_0x2c9f48]=this[_0xc199('0xd')][_0xc199('0x35')];this['rpc'][_0xc199('0x48')](_0x5b3874)['then'](function(_0x32bc92){_0x38e9cf(null,_[_0xc199('0x3e')](_0x32bc92)?![]:!![]);})[_0xc199('0x12')](function(_0xeb93a6){logger[_0xc199('0x27')](_0xeb93a6);_0x38e9cf(null,![]);});};AGIVertices[_0xc199('0xf')][_0xc199('0x49')]=function(_0x18a4e0,_0xdf3646){var _0x1132b8={'role':'agent'};_0x1132b8[_0x18a4e0]=this['channel']['callerid'];var _0x3aff9e=_0x18a4e0!=_0xc199('0x4a')?util[_0xc199('0x23')](_0xc199('0x4b'),'LOCAL',this[_0xc199('0xd')]['callerid']):undefined;this['rpc'][_0xc199('0x49')](_0x1132b8,_0x3aff9e)[_0xc199('0x14')](function(_0x30854e){_0xdf3646(null,_[_0xc199('0x3e')](_0x30854e)?![]:!![]);})[_0xc199('0x12')](function(_0x1e3add){logger[_0xc199('0x27')](_0x1e3add);_0xdf3646(null,![]);});};AGIVertices[_0xc199('0xf')]['shellCommand']=function(_0x32addf,_0x4a8273){sh[_0xc199('0x4c')](_[_0xc199('0x4d')](_0x32addf),function(_0x87f0a0,_0x5669e5){var _0x122202=_0x5669e5['replace'](/(\r\n|\n|\r)/gm,'');_0x4a8273(null,_0x122202);});};AGIVertices[_0xc199('0xf')][_0xc199('0x4e')]=function(_0x391b70,_0x12b125){scripts[_0xc199('0x4e')](_0x391b70['apiKey'],_0x391b70['google_cloud_tts_text_type']||_0xc199('0x4f'),_0x391b70['text'],_0x391b70[_0xc199('0x50')]||_0xc199('0x51'),_0x391b70[_0xc199('0x52')]||_0xc199('0x53'),_0x391b70['audioEncoding']||_0xc199('0x54'))[_0xc199('0x14')](function(_0x9a7aa1){_0x12b125(null,_0x9a7aa1);})[_0xc199('0x12')](function(_0x2d4b24){_0x12b125(_0x2d4b24);});};AGIVertices[_0xc199('0xf')][_0xc199('0x55')]=function(_0x5b0f9e,_0x31e788){scripts[_0xc199('0x55')](_0x5b0f9e['text'],_0x5b0f9e[_0xc199('0x56')]||'en',0x1)[_0xc199('0x14')](function(_0x560b86){_0x31e788(null,_0x560b86);})[_0xc199('0x12')](function(_0x41908e){_0x31e788(_0x41908e);});};AGIVertices[_0xc199('0xf')][_0xc199('0x57')]=function(_0x337601,_0xfb6cfe){var _0x1edbc9={'uri':_0x337601[_0xc199('0x58')],'method':_0x337601[_0xc199('0x59')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x337601[_0xc199('0x5a')])==='number'&&parseInt(_0x337601[_0xc199('0x5a')])>=0x1?parseInt(_0x337601[_0xc199('0x5a')])*0x3e8:0x5*0x3e8};if(_[_0xc199('0x5b')]([_0xc199('0x5c'),_0xc199('0x5d')],_0x1edbc9['method'][_0xc199('0x5e')]())){try{_0x1edbc9[_0xc199('0x5f')]=_0x337601[_0xc199('0x60')]?JSON[_0xc199('0x61')](_0x337601[_0xc199('0x60')]):{};}catch(_0xcc7095){logger['error'](_0xc199('0x62'),_0xcc7095);}}try{_0x1edbc9[_0xc199('0x63')]=_0x337601['rawHeaders']?JSON[_0xc199('0x61')](_0x337601[_0xc199('0xb')]):{};}catch(_0x340042){logger[_0xc199('0x27')]('An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function',_0x340042);}if(_0x337601[_0xc199('0x64')]){try{var _0x5ede3d=require(_0x337601[_0xc199('0x64')])[_0xc199('0x65')](this,_0x1edbc9);_0x1edbc9['uri']=Mustache['render'](_0x337601[_0xc199('0x58')],_0x5ede3d,{},['$$','$$']);if(_0x1edbc9['headers']){_0x1edbc9['headers']=JSON[_0xc199('0x61')](Mustache[_0xc199('0x66')](JSON['stringify'](_0x1edbc9[_0xc199('0x63')]),_0x5ede3d,{},['$$','$$']));}if(_0x1edbc9[_0xc199('0x5f')]){_0x1edbc9[_0xc199('0x5f')]=JSON['parse'](Mustache[_0xc199('0x66')](JSON[_0xc199('0x67')](_0x1edbc9[_0xc199('0x5f')]),_0x5ede3d,{},['$$','$$']));}}catch(_0x50afa6){logger['error'](_0xc199('0x68'),_0x50afa6);}}rp(_0x1edbc9)['then'](function(_0x773628){var _0x2ab9e7={'statusCode':_0x773628[_0xc199('0x69')]||0xc8,'statusMessage':_0x773628[_0xc199('0x6a')]||'OK','headers':_0x773628['headers']||{},'body':_0x773628[_0xc199('0x5f')]||{}};_0xfb6cfe(null,_0x2ab9e7);})[_0xc199('0x12')](function(_0x146b28){var _0x5ea599={'statusCode':_0x146b28[_0xc199('0x69')]||0x1f4,'statusMessage':_0x146b28[_0xc199('0x6b')]||_0xc199('0x6c'),'headers':_0x146b28[_0xc199('0x6d')][_0xc199('0x63')]||{},'body':_0x146b28[_0xc199('0x6d')][_0xc199('0x5f')]||{}};_0xfb6cfe(null,_0x5ea599);});};AGIVertices[_0xc199('0xf')][_0xc199('0x6e')]=function(_0x122bb3,_0x226cd8){scripts[_0xc199('0x6e')](this['channel'][_0xc199('0x31')],_0x122bb3[_0xc199('0x6f')],_0x122bb3[_0xc199('0x4f')],_0x122bb3[_0xc199('0x70')]||'en')['then'](function(_0x1920eb){_0x226cd8(null,_0x1920eb);})['catch'](function(_0x292457){_0x226cd8(_0x292457);});};AGIVertices['prototype'][_0xc199('0x71')]=function(_0x1eace5,_0x837dee){scripts[_0xc199('0x71')](this[_0xc199('0xd')][_0xc199('0x31')],_0x1eace5['dialogflowV2_project_id'],_0x1eace5[_0xc199('0x72')],_0x1eace5['private_key'],_0x1eace5[_0xc199('0x4f')],_0x1eace5['dialogflowV2_language']||'en')[_0xc199('0x14')](function(_0x171825){_0x837dee(null,_0x171825);})['catch'](function(_0x5be025){_0x837dee(_0x5be025);});};AGIVertices[_0xc199('0xf')][_0xc199('0x73')]=function(_0x1bf146,_0x11fa37){scripts[_0xc199('0x73')](this[_0xc199('0xd')],_0x1bf146)[_0xc199('0x14')](function(_0xb4afd1){_0x11fa37(null,_0xb4afd1);})[_0xc199('0x12')](function(_0x4c530c){_0x11fa37(_0x4c530c);});};AGIVertices['prototype']['ispeechTTS']=function(_0xa8b3ac,_0x16660e){scripts[_0xc199('0x74')](_0xa8b3ac['key'],_0xa8b3ac['text'],_0xa8b3ac[_0xc199('0x75')]||_0xc199('0x51'),_0xa8b3ac[_0xc199('0x76')])[_0xc199('0x14')](function(_0x52259c){_0x16660e(null,_0x52259c);})[_0xc199('0x12')](function(_0x567a95){_0x16660e(_0x567a95);});};AGIVertices[_0xc199('0xf')][_0xc199('0x77')]=function(_0x444b46,_0x5a666b,_0x15545e){scripts[_0xc199('0x77')](_0x5a666b,_0x444b46[_0xc199('0x6f')],_0x444b46[_0xc199('0x78')]||'en-US',this[_0xc199('0x79')](_0x444b46[_0xc199('0x7a')])?_0x444b46[_0xc199('0x7a')]:undefined)[_0xc199('0x14')](function(_0x3bd57a){_0x15545e(null,_0x3bd57a);})[_0xc199('0x12')](function(_0x326044){_0x15545e(_0x326044);});};AGIVertices[_0xc199('0xf')]['awsPolly']=function(_0x5a4381,_0x37b377){scripts[_0xc199('0x7b')](_0x5a4381[_0xc199('0x7c')],_0x5a4381[_0xc199('0x7d')],_0x5a4381['aws_polly_region'],_0x5a4381['aws_polly_voice']||'Amy',_0x5a4381[_0xc199('0x4f')],_0x5a4381[_0xc199('0x7e')]||'text')['then'](function(_0x2005e9){_0x37b377(null,_0x2005e9);})[_0xc199('0x12')](function(_0x16f83d){_0x37b377(_0x16f83d);});};AGIVertices[_0xc199('0xf')][_0xc199('0x7f')]=function(_0x553d6b,_0x3c00bf){scripts[_0xc199('0x7f')](this[_0xc199('0xd')][_0xc199('0x31')],_0x553d6b[_0xc199('0x7c')],_0x553d6b[_0xc199('0x7d')],_0x553d6b[_0xc199('0x80')],_0x553d6b[_0xc199('0x4f')],_0x553d6b['aws_bot_name'])['then'](function(_0x414f1e){_0x3c00bf(null,_0x414f1e);})[_0xc199('0x12')](function(_0x3873d7){_0x3c00bf(_0x3873d7);});};AGIVertices['prototype'][_0xc199('0x81')]=function(_0x45daa7,_0x3943cd,_0x1ceb14){scripts[_0xc199('0x81')](_0x3943cd,_0x45daa7[_0xc199('0x6f')],_0x45daa7[_0xc199('0x82')]||'en-US')['then'](function(_0x377a49){_0x1ceb14(null,_0x377a49);})['catch'](function(_0x19c00f){_0x1ceb14(_0x19c00f);});};AGIVertices['prototype']['tildeASR']=function(_0x45c59d,_0x286c5e,_0xcbc2c4){scripts['tildeASR'](_0x286c5e,_0x45c59d['appid'],_0x45c59d[_0xc199('0x83')],_0x45c59d[_0xc199('0x84')])[_0xc199('0x14')](function(_0x32cb23){_0xcbc2c4(null,_0x32cb23);})[_0xc199('0x12')](function(_0x51f86c){_0xcbc2c4(_0x51f86c);});};AGIVertices['prototype'][_0xc199('0x85')]=function(_0x56334c){var _0x5c0c50=_[_0xc199('0x5b')](verticesWithRetry,_0x56334c[_0xc199('0x33')])?_0x56334c:_[_0xc199('0x86')](_0x56334c);for(var _0x5c02d9 in _0x5c0c50){if(_0x5c0c50['hasOwnProperty'](_0x5c02d9)){if(_0x5c0c50[_0x5c02d9]&&_['isString'](_0x5c0c50[_0x5c02d9])){if(_[_0xc199('0x5b')](recursiveMapAttributes,_0x5c02d9)){_0x5c0c50[_0x5c02d9]=this[_0xc199('0x87')](_0x5c0c50[_0x5c02d9]);}else{_0x5c0c50[_0x5c02d9]=this[_0xc199('0x88')](_0x5c0c50[_0x5c02d9]);}}}}return _0x5c0c50;};AGIVertices[_0xc199('0xf')][_0xc199('0x89')]=function(_0x2e30ba){for(var _0x49dc15 in _0x2e30ba){if(_0x2e30ba[_0xc199('0x8a')](_0x49dc15)){if(_[_0xc199('0x8b')](_0x2e30ba[_0x49dc15])){this[_0xc199('0x89')](_0x2e30ba[_0x49dc15]);}else if(_[_0xc199('0x8c')](_0x2e30ba[_0x49dc15])){for(var _0x89f032=0x0;_0x89f032<_0x2e30ba[_0x49dc15]['length'];_0x89f032++){this[_0xc199('0x89')](_0x2e30ba[_0x49dc15][_0x89f032]);}}else if(_[_0xc199('0x8d')](_0x2e30ba[_0x49dc15])){_0x2e30ba[_0x49dc15]=this[_0xc199('0x88')](_0x2e30ba[_0x49dc15]);}}}};AGIVertices[_0xc199('0xf')][_0xc199('0x8e')]=function(_0x23d6bc,_0x2d0646){for(var _0x16ff62 in _0x23d6bc){if(_0x23d6bc['hasOwnProperty'](_0x16ff62)){if(_[_0xc199('0x8b')](_0x23d6bc[_0x16ff62])){if(!_[_0xc199('0x3d')](_0x23d6bc[_0x16ff62])){this[_0xc199('0x8e')](_0x23d6bc[_0x16ff62],util[_0xc199('0x23')](_0xc199('0x8f'),_0x2d0646,_0x16ff62));}}else if(_[_0xc199('0x8c')](_0x23d6bc[_0x16ff62])){for(var _0x35693c=0x0;_0x35693c<_0x23d6bc[_0x16ff62][_0xc199('0x90')];_0x35693c++){this[_0xc199('0x8e')](_0x23d6bc[_0x16ff62][_0x35693c],util['format']('%s.%s',_0x2d0646,_0x16ff62+'['+_0x35693c+']'));}}else{if(!_[_0xc199('0x3e')](_0x23d6bc[_0x16ff62])){this[_0xc199('0xd')]['setVariable'](util['format']('%s.%s',_0x2d0646,_0x16ff62),_0x23d6bc[_0x16ff62]);}}}}};AGIVertices[_0xc199('0xf')][_0xc199('0x87')]=function(_0x1dabed){try{var _0x7e3e5=JSON['parse'](_0x1dabed);this[_0xc199('0x89')](_0x7e3e5);return JSON['stringify'](_0x7e3e5);}catch(_0x315a28){return this['replaceAllVariables'](_0x1dabed);}};AGIVertices[_0xc199('0xf')][_0xc199('0x88')]=function(_0x53c02b){var _0x8b0286=_0x53c02b[_0xc199('0x91')]('{');for(var _0x3458e6=0x1;_0x3458e6<_0x8b0286[_0xc199('0x90')];_0x3458e6+=0x1){var _0x5a379b=_0x8b0286[_0x3458e6]['split']('}');if(_0x5a379b[_0xc199('0x90')]>0x1){_0x53c02b=_0x53c02b['replaceAll']('{'+_0x5a379b[0x0]+'}',this[_0xc199('0xd')]['getVariable'](_0x5a379b[0x0])[_0xc199('0x92')]||_0x5a379b[0x0]);}}if(_0x8b0286[_0xc199('0x90')]===0x1){return _0x53c02b['toString']();}return this['replaceAllVariables'](_0x53c02b);};AGIVertices[_0xc199('0xf')][_0xc199('0x93')]=function(_0x4557ba,_0x1f8f75){var _0x572d8a=this[_0xc199('0xd')]['getVariable'](_0x4557ba);if(_0x572d8a['result']===-0x1){return _0x572d8a;}logger[_0xc199('0x29')](util['format']('The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s',_0x1f8f75,_0x572d8a[_0xc199('0x92')]));return this[_0xc199('0xd')][_0xc199('0x94')](_0x1f8f75,_0x572d8a[_0xc199('0x92')]);};AGIVertices[_0xc199('0xf')]['isConfigured']=function(_0xc35f6a){return _0xc35f6a&&_0xc35f6a!=='0'&&_0xc35f6a!=='-1'&&_0xc35f6a!=='';};AGIVertices['prototype'][_0xc199('0x95')]=function(_0x596f63){this['createSquareDetailsReport'][_0xc199('0x65')](this,_0x596f63,'-');_0x596f63['retry']=_0x596f63['maxRetry'];return{'code':0xc8,'result':'-'};};AGIVertices['prototype'][_0xc199('0x96')]=function(_0x20c67b){logger['info'](util['format'](_0xc199('0x97'),_0x20c67b[_0xc199('0x32')]));if(!this[_0xc199('0x79')](_0x20c67b[_0xc199('0x4f')])){return this[_0xc199('0xd')]['noop']('no\x20text\x20configured');}var _0x11ad30='\x22'+_0x20c67b[_0xc199('0x4f')]+'\x22';if(this[_0xc199('0x79')](_0x20c67b[_0xc199('0x6d')])){_0x11ad30+=','+_0x20c67b[_0xc199('0x6d')];}var _0x2c1cdd=this[_0xc199('0xd')][_0xc199('0x4c')](_0xc199('0x98'),_0x11ad30);if(_0x2c1cdd[_0xc199('0x99')]===-0x1){return _0x2c1cdd;}return this['channel'][_0xc199('0x9a')](util[_0xc199('0x23')](_0xc199('0x9b'),_0x11ad30));};AGIVertices['prototype'][_0xc199('0x9c')]=function(_0x4c4a7f){logger[_0xc199('0x29')](util[_0xc199('0x23')](_0xc199('0x9d'),_0x4c4a7f[_0xc199('0x32')]));if(!this['isConfigured'](_0x4c4a7f[_0xc199('0x9e')])){return this[_0xc199('0xd')]['noop'](_0xc199('0x9f'));}var _0x466f82=_0x4c4a7f[_0xc199('0x9e')];if(this[_0xc199('0x79')](_0x4c4a7f[_0xc199('0x6d')])){_0x466f82+=','+_0x4c4a7f[_0xc199('0x6d')];}var _0x37572a=this[_0xc199('0xd')]['exec']('MRCPRecog',_0x466f82);if(_0x37572a[_0xc199('0x99')]===-0x1){return _0x37572a;}var _0x11928b=this[_0xc199('0x93')]('RECOG_CONFIDENCE()',_0xc199('0xa0'));if(_0x11928b[_0xc199('0x99')]===-0x1){return _0x11928b;}var _0x3a830e=this[_0xc199('0x93')]('RECOG_INPUT()',_0xc199('0xa1'));if(_0x3a830e[_0xc199('0x99')]===-0x1){return _0x3a830e;}var _0x10c133=this[_0xc199('0x93')](_0xc199('0xa2'),_0xc199('0xa3'));if(_0x10c133[_0xc199('0x99')]===-0x1){return _0x10c133;}return this[_0xc199('0xd')][_0xc199('0x9a')](util[_0xc199('0x23')]('Executed\x20command\x20MRCPRecog\x20%s',_0x466f82));};AGIVertices[_0xc199('0xf')]['agi']=function(_0x1a125a){logger[_0xc199('0x29')](util[_0xc199('0x23')](_0xc199('0xa4'),_0x1a125a[_0xc199('0x32')]));return this['channel'][_0xc199('0x7')]([_0x1a125a['command'],_0x1a125a['args']]);};AGIVertices[_0xc199('0xf')][_0xc199('0xa5')]=function(_0x439798){logger['info'](util[_0xc199('0x23')](_0xc199('0xa6'),_0x439798[_0xc199('0x32')]));if(this[_0xc199('0x79')](_0x439798[_0xc199('0x5a')])){logger['info'](util[_0xc199('0x23')]('Wait\x20%s\x20seconds\x20before\x20answer',_0x439798['timeout']));var _0x1e1e6c=this[_0xc199('0xd')][_0xc199('0xa7')](_0x439798[_0xc199('0x5a')]);if(_0x1e1e6c[_0xc199('0x99')]===-0x1){return _0x1e1e6c;}}return this['channel']['answer']();};AGIVertices[_0xc199('0xf')][_0xc199('0xa8')]=function(_0xbb0871){logger[_0xc199('0x29')](util[_0xc199('0x23')](_0xc199('0xa9'),_0xbb0871['label']));if(!this[_0xc199('0x79')](_0xbb0871[_0xc199('0x41')])){return this[_0xc199('0xd')][_0xc199('0x27')](_0xbb0871,_0xc199('0xaa'));}_0xbb0871[_0xc199('0x42')]=moment();if(this[_0xc199('0x79')](_0xbb0871['delay'])){_0xbb0871[_0xc199('0x42')]=moment()['add'](_0xbb0871[_0xc199('0xab')],'minutes');}if(!this[_0xc199('0x79')](_0xbb0871['callback_priority'])){_0xbb0871['callback_priority']=0x2;}this[_0xc199('0x3c')][_0xc199('0x65')](this,_0xbb0871);return this[_0xc199('0xd')][_0xc199('0x9a')](util[_0xc199('0x23')]('CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s',_0xbb0871[_0xc199('0xac')],_0xbb0871['list_id'],_0xbb0871[_0xc199('0x42')]));};AGIVertices[_0xc199('0xf')][_0xc199('0xad')]=function(_0x2ed745){logger[_0xc199('0x29')](util['format']('Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block',_0x2ed745[_0xc199('0x32')]));var _0x2f8290=this[_0xc199('0xd')]['exec'](_0x2ed745[_0xc199('0xae')],_0x2ed745[_0xc199('0x6d')]);if(_0x2f8290[_0xc199('0x99')]===-0x1){return _0x2f8290;}return this['channel']['noop'](util[_0xc199('0x23')]('Executed\x20command\x20%s\x20%s',_0x2ed745['application'],_0x2ed745[_0xc199('0x6d')]));};AGIVertices[_0xc199('0xf')][_0xc199('0xaf')]=function(_0x33f636){logger[_0xc199('0x29')](util[_0xc199('0x23')](_0xc199('0xb0'),_0x33f636[_0xc199('0x32')]));if(!this[_0xc199('0x79')](_0x33f636[_0xc199('0x4f')])){return this[_0xc199('0xd')][_0xc199('0x9a')](_0xc199('0xb1'));}var _0x57195e='\x22'+_0x33f636['text']+'\x22';if(this[_0xc199('0x79')](_0x33f636['options'])){_0x57195e+=','+_0x33f636[_0xc199('0x6d')];}var _0x28ddbc=this['channel'][_0xc199('0x4c')](_0xc199('0x98'),_0x57195e);if(_0x28ddbc[_0xc199('0x99')]===-0x1){return _0x28ddbc;}return this[_0xc199('0xd')][_0xc199('0x9a')](util[_0xc199('0x23')]('Executed\x20command\x20MRCPSynth\x20%s',_0x57195e));};AGIVertices[_0xc199('0xf')]['sestektts']=function(_0x236f3a){logger[_0xc199('0x29')](util[_0xc199('0x23')](_0xc199('0xb2'),_0x236f3a[_0xc199('0x32')]));if(!this[_0xc199('0x79')](_0x236f3a['text'])){return this[_0xc199('0xd')][_0xc199('0x9a')](_0xc199('0xb1'));}var _0x306bf7='\x22'+_0x236f3a[_0xc199('0x4f')]+'\x22';if(this[_0xc199('0x79')](_0x236f3a['options'])){_0x306bf7+=','+_0x236f3a[_0xc199('0x6d')];}var _0x406eb4=this[_0xc199('0xd')][_0xc199('0x4c')](_0xc199('0x98'),_0x306bf7);if(_0x406eb4[_0xc199('0x99')]===-0x1){return _0x406eb4;}return this[_0xc199('0xd')]['noop'](util[_0xc199('0x23')](_0xc199('0x9b'),_0x306bf7));};AGIVertices[_0xc199('0xf')][_0xc199('0xb3')]=function(_0x4bc659){logger[_0xc199('0x29')](util[_0xc199('0x23')](_0xc199('0xb4'),_0x4bc659[_0xc199('0x32')]));if(!this[_0xc199('0x79')](_0x4bc659[_0xc199('0x9e')])){return this['channel'][_0xc199('0x9a')](_0xc199('0x9f'));}var _0x56b0d0=_0x4bc659[_0xc199('0x9e')];if(this[_0xc199('0x79')](_0x4bc659[_0xc199('0x6d')])){_0x56b0d0+=','+_0x4bc659[_0xc199('0x6d')];}var _0x420678=this[_0xc199('0xd')][_0xc199('0x4c')]('MRCPRecog',_0x56b0d0);if(_0x420678[_0xc199('0x99')]===-0x1){return _0x420678;}var _0x2f4bde=this[_0xc199('0x93')]('RECOG_CONFIDENCE()',_0xc199('0xb5'));if(_0x2f4bde[_0xc199('0x99')]===-0x1){return _0x2f4bde;}var _0x58928b=this[_0xc199('0x93')](_0xc199('0xb6'),_0xc199('0xb7'));if(_0x58928b[_0xc199('0x99')]===-0x1){return _0x58928b;}var _0x40d29b=this[_0xc199('0x93')](_0xc199('0xa2'),_0xc199('0xb8'));if(_0x40d29b['result']===-0x1){return _0x40d29b;}return this['channel'][_0xc199('0x9a')](util[_0xc199('0x23')](_0xc199('0xb9'),_0x56b0d0));};AGIVertices['prototype'][_0xc199('0xba')]=function(_0x4cd3b9){logger['info'](util[_0xc199('0x23')]('Enter\x20in\x20SESTEKASR\x20(%s)\x20block',_0x4cd3b9[_0xc199('0x32')]));if(!this[_0xc199('0x79')](_0x4cd3b9[_0xc199('0x9e')])){return this[_0xc199('0xd')][_0xc199('0x9a')](_0xc199('0x9f'));}var _0x519a81=_0x4cd3b9[_0xc199('0x9e')];if(this[_0xc199('0x79')](_0x4cd3b9[_0xc199('0x6d')])){_0x519a81+=','+_0x4cd3b9['options'];}var _0x4d768c=this[_0xc199('0xd')][_0xc199('0x4c')](_0xc199('0xbb'),_0x519a81);if(_0x4d768c[_0xc199('0x99')]===-0x1){return _0x4d768c;}var _0x5b14ec=this['getAndSetVariable'](_0xc199('0xbc'),_0xc199('0xbd'));if(_0x5b14ec['result']===-0x1){return _0x5b14ec;}var _0x22ef52=this[_0xc199('0x93')]('RECOG_INPUT()','SESTEK_ASR_TRANSCRIPT');if(_0x22ef52[_0xc199('0x99')]===-0x1){return _0x22ef52;}var _0x2ab992=this[_0xc199('0x93')](_0xc199('0xa2'),_0xc199('0xbe'));if(_0x2ab992['result']===-0x1){return _0x2ab992;}return this[_0xc199('0xd')][_0xc199('0x9a')](util[_0xc199('0x23')](_0xc199('0xb9'),_0x519a81));};AGIVertices[_0xc199('0xf')][_0xc199('0xbf')]=function(_0x266dc7){logger['info'](util[_0xc199('0x23')](_0xc199('0xc0'),_0x266dc7[_0xc199('0x32')]));if(!this['isConfigured'](_0x266dc7[_0xc199('0xc1')])){return this[_0xc199('0xd')][_0xc199('0x27')](_0x266dc7,_0xc199('0xc2'));}var _0x504a12=this[_0xc199('0x15')]['sync'](this,_0x266dc7[_0xc199('0xc1')]);if(!_0x504a12){return this[_0xc199('0xd')][_0xc199('0x27')](_0x266dc7,_0xc199('0xc3'));}if(!this[_0xc199('0x79')](_0x266dc7[_0xc199('0xc4')])){return this[_0xc199('0xd')]['error'](_0x266dc7,'no\x20query\x20configured');}var _0x2f4e5b=_0x266dc7[_0xc199('0xc4')][_0xc199('0xc5')](/(\r\n|\n|\r)/gm,'\x20');this['channel'][_0xc199('0x9a')](util[_0xc199('0x23')](_0xc199('0xc6'),_0x2f4e5b));var _0x1103a1=this[_0xc199('0x25')][_0xc199('0x65')](this,_0x504a12,_0x2f4e5b);this[_0xc199('0x30')]['sync'](this,_0x266dc7,_0x2f4e5b);if(!this[_0xc199('0x79')](_0x266dc7[_0xc199('0xc7')])){return this[_0xc199('0xd')][_0xc199('0x9a')](_0xc199('0xc8'));}var _0x29f26b=this[_0xc199('0xc9')]['sync'](this,_0x266dc7['variable_id']);if(!_0x29f26b){return this['channel'][_0xc199('0x27')](_0x266dc7,'no\x20variable\x20found');}var _0x2daf54=this;_0x1103a1[_0xc199('0xca')](function(_0x44461e,_0x1d3b05){Object['keys'](_0x44461e)['forEach'](function(_0x2df578){_0x2daf54[_0xc199('0xd')][_0xc199('0x94')](util['format']('%s[%s][%s]',_0x29f26b,_0x1d3b05,_0x2df578),_0x44461e[_0x2df578]);});});this[_0xc199('0xd')]['setVariable'](util[_0xc199('0x23')](_0xc199('0xcb'),_0x29f26b),_0x1103a1[_0xc199('0x90')]);return this[_0xc199('0xd')][_0xc199('0x9a')](util[_0xc199('0x23')](_0xc199('0xcc'),_0x29f26b));};AGIVertices[_0xc199('0xf')]['dial']=function(_0xc171ff){logger[_0xc199('0xcd')](util[_0xc199('0x23')](_0xc199('0xce'),_0xc171ff[_0xc199('0x32')]));if(!this[_0xc199('0x79')](_0xc171ff[_0xc199('0xcf')])){return this[_0xc199('0xd')][_0xc199('0x27')](_0xc171ff,_0xc199('0xd0'));}var _0x24af19=this['getUser'][_0xc199('0x65')](this,_0xc171ff[_0xc199('0xcf')]);if(!_0x24af19){return this[_0xc199('0xd')][_0xc199('0x27')](_0xc171ff,_0xc199('0xd1'));}var _0x48e023=this[_0xc199('0xd')][_0xc199('0x4c')](_0xc199('0xd2'),[util[_0xc199('0x23')](_0xc199('0xd3'),_0x24af19),_0xc171ff[_0xc199('0x5a')],_0xc171ff['opts'],_0xc171ff[_0xc199('0x58')]]);if(_0x48e023['result']===-0x1){return _0x48e023;}return this[_0xc199('0xd')][_0xc199('0x9a')](util[_0xc199('0x23')](_0xc199('0xd4'),_0xc199('0xd2')));};AGIVertices[_0xc199('0xf')][_0xc199('0xd5')]=function(_0x588eab){logger[_0xc199('0x29')](util['format'](_0xc199('0xd6'),_0x588eab['label']));if(!this['isConfigured'](_0x588eab['key'])){return this[_0xc199('0xd')]['noop'](_0xc199('0xd7'));}if(!this[_0xc199('0x79')](_0x588eab[_0xc199('0x4f')])){return this[_0xc199('0xd')]['noop']('no\x20text\x20configured');}this[_0xc199('0xd')]['bot']=!![];this['createSquareDetailsReport'](_0x588eab);this[_0xc199('0x3b')](_0x588eab[_0xc199('0x4f')],'in','','');this['channel']['noop'](util[_0xc199('0x23')]('Trying\x20Dialogflow:\x20%s',_0x588eab[_0xc199('0x4f')]));var _0x466ffa=this[_0xc199('0x6e')][_0xc199('0x65')](this,_0x588eab);if(_0x466ffa){for(var _0x4051c3 in _0x466ffa){if(_0x466ffa[_0xc199('0x8a')](_0x4051c3)){this[_0xc199('0xd')][_0xc199('0x94')](util[_0xc199('0x23')]('DIALOGFLOW_%s',_0x4051c3[_0xc199('0x5e')]()),_0x466ffa[_0x4051c3]);}}this[_0xc199('0x3b')](_0x466ffa[_0xc199('0xd8')],_0xc199('0xd9'),'dialogflow','');return this[_0xc199('0xd')][_0xc199('0x9a')](util[_0xc199('0x23')]('Dialogflow\x20Result\x20%s',_0x466ffa[_0xc199('0xd8')]));}return this['channel'][_0xc199('0x27')](_0x588eab,_0xc199('0xda'));};AGIVertices[_0xc199('0xf')][_0xc199('0xdb')]=function(_0x389dc3){logger[_0xc199('0x29')](util['format'](_0xc199('0xdc'),_0x389dc3[_0xc199('0x32')]));if(!this[_0xc199('0x79')](_0x389dc3[_0xc199('0xdd')])){return this[_0xc199('0xd')][_0xc199('0x9a')]('no\x20project_id\x20configured');}if(!this[_0xc199('0x79')](_0x389dc3['client_email'])){return this[_0xc199('0xd')]['noop'](_0xc199('0xde'));}if(!this['isConfigured'](_0x389dc3['private_key'])){return this[_0xc199('0xd')]['noop'](_0xc199('0xdf'));}if(!this[_0xc199('0x79')](_0x389dc3['dialogflowV2_language'])){return this[_0xc199('0xd')][_0xc199('0x9a')](_0xc199('0xe0'));}if(!this[_0xc199('0x79')](_0x389dc3[_0xc199('0x4f')])){return this[_0xc199('0xd')]['noop'](_0xc199('0xb1'));}this[_0xc199('0xd')]['bot']=!![];this[_0xc199('0x30')](_0x389dc3);this[_0xc199('0x3b')](_0x389dc3['text'],'in','','');this[_0xc199('0xd')][_0xc199('0x9a')](util[_0xc199('0x23')](_0xc199('0xe1'),_0x389dc3[_0xc199('0x4f')]));var _0x7d8b75=this[_0xc199('0x71')][_0xc199('0x65')](this,_0x389dc3);if(_0x7d8b75){for(var _0x279f54 in _0x7d8b75){if(_0x7d8b75[_0xc199('0x8a')](_0x279f54)){if(_0x279f54!==_0xc199('0xe2')){this[_0xc199('0xd')][_0xc199('0x94')](util[_0xc199('0x23')](_0xc199('0xe3'),_0x279f54[_0xc199('0x5e')]()),_0x7d8b75[_0x279f54]);}}}this['createSquareMessage'](_0x7d8b75[_0xc199('0xd8')],_0xc199('0xd9'),'dialogflowV2',_0x7d8b75[_0xc199('0xe2')]);return this[_0xc199('0xd')][_0xc199('0x9a')](util[_0xc199('0x23')](_0xc199('0xe4'),_0x7d8b75[_0xc199('0xd8')]));}return this[_0xc199('0xd')][_0xc199('0x27')](_0x389dc3,'DialogflowV2\x20is\x20unreachable');};AGIVertices['prototype']['sesteknda']=function(_0x1eb0b5){logger[_0xc199('0x29')](util['format'](_0xc199('0xe5'),_0x1eb0b5[_0xc199('0x32')]));if(!this[_0xc199('0x79')](_0x1eb0b5[_0xc199('0xe6')])){return this[_0xc199('0xd')][_0xc199('0x9a')](_0xc199('0xe7'));}if(!this[_0xc199('0x79')](_0x1eb0b5[_0xc199('0xe8')])){return this['channel'][_0xc199('0x9a')]('no\x20username\x20configured');}if(!this[_0xc199('0x79')](_0x1eb0b5['password'])){return this['channel']['noop'](_0xc199('0xe9'));}if(!this['isConfigured'](_0x1eb0b5[_0xc199('0xea')])){return this[_0xc199('0xd')][_0xc199('0x9a')](_0xc199('0xb1'));}this[_0xc199('0xd')][_0xc199('0xeb')]=!![];this[_0xc199('0x30')](_0x1eb0b5);this[_0xc199('0x3b')](_0x1eb0b5['text'],'in','','');this[_0xc199('0xd')][_0xc199('0x9a')](util['format'](_0xc199('0xec'),_0x1eb0b5['text']));var _0x38f0d1=this['sestekNDA'][_0xc199('0x65')](this,_0x1eb0b5);if(_0x38f0d1){for(var _0x424f6b in _0x38f0d1){if(_0x38f0d1[_0xc199('0x8a')](_0x424f6b)){this[_0xc199('0xd')][_0xc199('0x94')](util['format'](_0xc199('0xed'),_0x424f6b[_0xc199('0x5e')]()),_0x38f0d1[_0x424f6b]);}}this['createSquareMessage'](_0x38f0d1[_0xc199('0xd8')],'out',_0xc199('0xee'),'');if(_0x38f0d1[_0xc199('0xef')]){this['channel'][_0xc199('0x9a')](util[_0xc199('0x23')](_0xc199('0xf0'),_0x38f0d1[_0xc199('0xef')]));var _0xdc59c4=this[_0xc199('0xd')]['streamFile'](_0x38f0d1[_0xc199('0xef')]);try{fs[_0xc199('0xf1')](_0x38f0d1['audiofile']+_0xc199('0xf2'));}catch(_0x30d052){logger['error'](_0x30d052);}return _0xdc59c4;}else{return this[_0xc199('0xd')][_0xc199('0x9a')](util[_0xc199('0x23')](_0xc199('0xf3'),_0x38f0d1[_0xc199('0xd8')]));}}return this[_0xc199('0xd')][_0xc199('0x27')](_0x1eb0b5,'SestekNDA\x20is\x20unreachable');};AGIVertices[_0xc199('0xf')]['end']=function(_0x3d7a40){logger[_0xc199('0x29')](util[_0xc199('0x23')](_0xc199('0xf4'),_0x3d7a40[_0xc199('0x32')]));return this[_0xc199('0xd')][_0xc199('0x9a')]('end');};AGIVertices[_0xc199('0xf')][_0xc199('0xf5')]=function(_0x5d564d){logger[_0xc199('0x29')](util[_0xc199('0x23')](_0xc199('0xf6'),_0x5d564d[_0xc199('0x32')]));var _0x51b4ec='';if(_0x5d564d[_0xc199('0xf7')]){if(!this[_0xc199('0x79')](_0x5d564d['trunk_id'])){return this[_0xc199('0xd')]['error'](_0x5d564d,_0xc199('0xf8'));}else{var _0xdbb1f=parseInt(_0x5d564d[_0xc199('0xf7')],0xa);if(isNaN(_0xdbb1f)){_0x51b4ec=_0x5d564d[_0xc199('0xf7')];}else{_0x51b4ec=this[_0xc199('0x19')][_0xc199('0x65')](this,_0x5d564d[_0xc199('0xf7')]);if(!_0x51b4ec){return this[_0xc199('0xd')][_0xc199('0x27')](_0x5d564d,_0xc199('0xf9'));}}}}else if(_0x5d564d[_0xc199('0xfa')]){_0x51b4ec=_0x5d564d[_0xc199('0xfa')];}else{return this[_0xc199('0xd')]['error'](_0x5d564d,'no\x20trunk\x20selected');}var _0x578725=this[_0xc199('0xd')][_0xc199('0x4c')](_0xc199('0xd2'),[util[_0xc199('0x23')](_0xc199('0xfb'),_0x51b4ec,_0x5d564d['phone']),_0x5d564d['timeout'],_0x5d564d[_0xc199('0xfc')],_0x5d564d[_0xc199('0x58')]]);if(_0x578725[_0xc199('0x99')]===-0x1){return _0x578725;}return this['channel'][_0xc199('0x9a')](util[_0xc199('0x23')](_0xc199('0xd4'),_0xc199('0xd2')));};AGIVertices[_0xc199('0xf')]['finally']=function(_0x4a3e20){logger[_0xc199('0x29')](util[_0xc199('0x23')](_0xc199('0xfd'),_0x4a3e20[_0xc199('0x32')]));return this[_0xc199('0xd')]['noop'](_0xc199('0xfe'));};AGIVertices[_0xc199('0xf')][_0xc199('0xff')]=function(_0x46b5a7){logger[_0xc199('0x29')](util[_0xc199('0x23')](_0xc199('0x100'),_0x46b5a7['label']));if(_0x46b5a7[_0xc199('0x101')]===0x0){return this[_0xc199('0x95')](_0x46b5a7);}_0x46b5a7[_0xc199('0x101')]-=0x1;if(!this[_0xc199('0x79')](_0x46b5a7[_0xc199('0x102')])){return this[_0xc199('0xd')][_0xc199('0x27')](_0x46b5a7,'no\x20file\x20audio\x20selected');}var _0x3da274=this[_0xc199('0x103')][_0xc199('0x65')](this,_0x46b5a7[_0xc199('0x102')]);if(!_0x3da274){return this[_0xc199('0xd')][_0xc199('0x27')](_0x46b5a7,_0xc199('0x104'));}if(!this[_0xc199('0x79')](_0x46b5a7[_0xc199('0xc7')])){return this[_0xc199('0xd')][_0xc199('0x27')](_0xc199('0xc8'));}var _0x3aee3f=this['channel']['getData'](_0x3da274,_0x46b5a7[_0xc199('0x105')],_0x46b5a7[_0xc199('0x106')]);var _0x1d86db=_0x3aee3f['result']?_0x3aee3f[_0xc199('0x99')][_0xc199('0x43')]():'';logger[_0xc199('0x29')]('test',JSON[_0xc199('0x67')](_0x3aee3f));if(_0x3aee3f[_0xc199('0x99')]===-0x1){this[_0xc199('0x30')][_0xc199('0x65')](this,_0x46b5a7,_0x1d86db);return _0x3aee3f;}else if(_0x3aee3f['extra']===_0xc199('0x5a')){_0x3aee3f[_0xc199('0x99')]=_0x1d86db[_0xc199('0x90')]>=parseInt(_0x46b5a7[_0xc199('0x107')])?'x':'i';}else{_0x3aee3f[_0xc199('0x99')]=_0x1d86db['length']>=parseInt(_0x46b5a7['mindigit'])&&_0x1d86db[_0xc199('0x90')]<=parseInt(_0x46b5a7['maxdigit'])?'x':'i';}var _0x36efc9=this[_0xc199('0xc9')][_0xc199('0x65')](this,_0x46b5a7[_0xc199('0xc7')]);if(!_0x36efc9){return this[_0xc199('0xd')][_0xc199('0x27')](_0x46b5a7,_0xc199('0x108'));}this[_0xc199('0xd')][_0xc199('0x94')](_0x36efc9,_0x1d86db);if(this[_0xc199('0x79')](_0x46b5a7['hiddendigitsnum'])){var _0x957a24=parseInt(_0x46b5a7[_0xc199('0x109')],0xa);var _0x2f9fdb=rs[_0xc199('0x10a')]({'charset':'*','length':_0x957a24});var _0x2b4b44=_0x1d86db[_0xc199('0x90')];if(_0x2b4b44>0x0){if(_0x2b4b44>_0x957a24){this['createSquareDetailsReport']['sync'](this,_0x46b5a7,_0x46b5a7[_0xc199('0x10b')]===_0xc199('0x10c')?_0x2f9fdb+_0x1d86db[_0xc199('0x10d')](_0x957a24):_0x1d86db[_0xc199('0x10d')](0x0,_0x2b4b44-_0x957a24)+_0x2f9fdb);}else{this[_0xc199('0x30')][_0xc199('0x65')](this,_0x46b5a7,rs[_0xc199('0x10a')]({'charset':'*','length':_0x2b4b44}));}}else{this[_0xc199('0x30')][_0xc199('0x65')](this,_0x46b5a7,'');}}else{this[_0xc199('0x30')]['sync'](this,_0x46b5a7,_0x1d86db);}return _0x3aee3f;};AGIVertices[_0xc199('0xf')][_0xc199('0x10e')]=function(_0x42df10){logger[_0xc199('0x29')](util[_0xc199('0x23')](_0xc199('0x10f'),_0x42df10['label']));return this[_0xc199('0xff')](_0x42df10);};AGIVertices[_0xc199('0xf')][_0xc199('0x110')]=function(_0xba101b){logger[_0xc199('0x29')](util[_0xc199('0x23')](_0xc199('0x111'),_0xba101b['label']));this[_0xc199('0x30')]['sync'](this,_0xba101b,_0xba101b['goalname']);return this['channel']['noop'](util['format'](_0xc199('0x112'),_0xba101b[_0xc199('0x113')]));};AGIVertices['prototype'][_0xc199('0x114')]=function(_0x1b89c3){logger['info'](util[_0xc199('0x23')](_0xc199('0x115'),_0x1b89c3['label']));if(!this[_0xc199('0x79')](_0x1b89c3[_0xc199('0x7c')])||!this[_0xc199('0x79')](_0x1b89c3[_0xc199('0x7d')])){return this['channel'][_0xc199('0x9a')](_0xc199('0x116'));}if(!this[_0xc199('0x79')](_0x1b89c3['text'])){return this['channel'][_0xc199('0x9a')](_0xc199('0xb1'));}this[_0xc199('0xd')]['noop'](util['format']('Trying\x20aws\x20Polly\x20%s',_0x1b89c3['text']));var _0x374dc2=this[_0xc199('0x7b')][_0xc199('0x65')](this,_0x1b89c3);if(_0x374dc2){this[_0xc199('0xd')][_0xc199('0x9a')](util[_0xc199('0x23')](_0xc199('0x117'),_0x374dc2));var _0x21a257=this['channel'][_0xc199('0x118')](_0x374dc2);try{fs[_0xc199('0xf1')](_0x374dc2+'.wav');}catch(_0x5f3caf){logger['error'](_0x5f3caf);}return _0x21a257;}return this[_0xc199('0xd')][_0xc199('0x27')](_0x1b89c3,_0xc199('0x119'));};AGIVertices[_0xc199('0xf')][_0xc199('0x11a')]=function(_0x14bf88){logger['info'](util[_0xc199('0x23')](_0xc199('0x11b'),_0x14bf88[_0xc199('0x32')]));if(!this[_0xc199('0x79')](_0x14bf88[_0xc199('0x7c')])||!this[_0xc199('0x79')](_0x14bf88[_0xc199('0x7d')])){return this['channel'][_0xc199('0x9a')](_0xc199('0x116'));}if(!this[_0xc199('0x79')](_0x14bf88[_0xc199('0x11c')])){return this['channel']['noop'](_0xc199('0x11d'));}if(!this[_0xc199('0x79')](_0x14bf88[_0xc199('0x4f')])){return this[_0xc199('0xd')]['noop'](_0xc199('0xb1'));}this[_0xc199('0xd')]['bot']=!![];this['createSquareDetailsReport'](_0x14bf88);this['createSquareMessage'](_0x14bf88[_0xc199('0x4f')],'in','','');this[_0xc199('0xd')][_0xc199('0x9a')](util[_0xc199('0x23')](_0xc199('0x11e'),_0x14bf88[_0xc199('0x4f')]));var _0x4461ce=this[_0xc199('0x7f')]['sync'](this,_0x14bf88);if(_0x4461ce){for(var _0x2e6a26 in _0x4461ce){if(_0x4461ce['hasOwnProperty'](_0x2e6a26)&&_[_0xc199('0x8d')](_0x4461ce[_0x2e6a26])){this[_0xc199('0xd')][_0xc199('0x94')](util[_0xc199('0x23')](_0xc199('0x11f'),_0x2e6a26[_0xc199('0x5e')]()),_0x4461ce[_0x2e6a26]);}}if(_[_0xc199('0x3e')](_0x4461ce[_0xc199('0x6b')])){return this['channel'][_0xc199('0x9a')](_0xc199('0x120'));}else{this['createSquareMessage'](_0x4461ce['message'],_0xc199('0xd9'),'amazonlex','');return this['channel'][_0xc199('0x9a')](util[_0xc199('0x23')]('Amazon\x20Lex\x20Result\x20%s',_0x4461ce['message']));}}return this[_0xc199('0xd')][_0xc199('0x27')](_0x14bf88,_0xc199('0x121'));};AGIVertices[_0xc199('0xf')]['googleasr']=function(_0x18f7e8){logger[_0xc199('0x29')](util[_0xc199('0x23')]('Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s',_0x18f7e8[_0xc199('0x32')],_0x18f7e8[_0xc199('0x5a')]));if(!this[_0xc199('0x79')](_0x18f7e8[_0xc199('0x6f')])){return this[_0xc199('0xd')][_0xc199('0x9a')](_0xc199('0xd7'));}var _0xe1388f=_0xc199('0x122');var _0xbb94bd=util['format'](_0xc199('0x123'),FILES_PATH,rs[_0xc199('0x10a')](0x4));var _0x46eefa=util[_0xc199('0x23')](_0xc199('0x8f'),_0xbb94bd,_0xe1388f);var _0x4a26de=!![];if(_0x18f7e8[_0xc199('0x124')]===_0xc199('0x125')){_0x4a26de=![];}var _0x20c167=this[_0xc199('0xd')]['recordFile'](_0xbb94bd,_0xe1388f,_0x18f7e8[_0xc199('0x126')],_0x18f7e8['timeout'],undefined,_0x4a26de);if(_0x20c167[_0xc199('0x99')]!==-0x1){this['channel']['noop'](util[_0xc199('0x23')](_0xc199('0x127'),_0x46eefa));var _0x14a9e3=this[_0xc199('0x81')][_0xc199('0x65')](this,_0x18f7e8,_0x46eefa);if(_0x14a9e3){for(var _0x372efd in _0x14a9e3){if(_0x14a9e3['hasOwnProperty'](_0x372efd)){this[_0xc199('0xd')]['setVariable'](util['format']('GOOGLE_ASR_%s',_0x372efd[_0xc199('0x5e')]()),_0x14a9e3[_0x372efd]);}}return this[_0xc199('0xd')][_0xc199('0x9a')](util[_0xc199('0x23')](_0xc199('0x128'),JSON[_0xc199('0x67')](_0x14a9e3)));}}return _0x20c167;};AGIVertices[_0xc199('0xf')][_0xc199('0x129')]=function(_0x2f4292){logger['info'](util['format'](_0xc199('0x12a'),_0x2f4292['label']));if(!this[_0xc199('0x79')](_0x2f4292[_0xc199('0x12b')])){return this[_0xc199('0xd')]['noop'](_0xc199('0x12c'));}if(!this['isConfigured'](_0x2f4292['appsecret'])){return this['channel'][_0xc199('0x9a')](_0xc199('0x12d'));}var _0x1c82bb=_0xc199('0x122');var _0x33e64d=util[_0xc199('0x23')](_0xc199('0x123'),FILES_PATH,rs[_0xc199('0x10a')](0x4));var _0x21e96e=util[_0xc199('0x23')]('%s.%s',_0x33e64d,_0x1c82bb);var _0x4684a4=!![];if(_0x2f4292[_0xc199('0x124')]===_0xc199('0x125')){_0x4684a4=![];}var _0x39870d=this[_0xc199('0xd')][_0xc199('0x12e')](_0x33e64d,_0x1c82bb,_0x2f4292[_0xc199('0x126')],_0x2f4292[_0xc199('0x5a')],undefined,_0x4684a4);if(_0x39870d[_0xc199('0x99')]!==-0x1){this[_0xc199('0xd')]['noop'](util[_0xc199('0x23')]('tilde\x20%s\x20file\x20created',_0x21e96e));var _0x1032f7=this[_0xc199('0x12f')][_0xc199('0x65')](this,_0x2f4292,_0x21e96e);if(_0x1032f7){for(var _0x1af0af in _0x1032f7){if(_0x1032f7[_0xc199('0x8a')](_0x1af0af)){this[_0xc199('0xd')][_0xc199('0x94')](util[_0xc199('0x23')]('TILDE_ASR_%s',_0x1af0af['toUpperCase']()),_0x1032f7[_0x1af0af]);}}return this[_0xc199('0xd')][_0xc199('0x9a')](util['format'](_0xc199('0x130'),JSON['stringify'](_0x1032f7)));}}return _0x39870d;};AGIVertices[_0xc199('0xf')][_0xc199('0x131')]=function(_0x5e1743){logger[_0xc199('0x29')](util[_0xc199('0x23')]('Enter\x20in\x20GOTO\x20(%s)\x20block',_0x5e1743[_0xc199('0x32')]));return this['channel'][_0xc199('0x132')](_0x5e1743['context'],_0x5e1743['extension'],_0x5e1743['priority']);};AGIVertices[_0xc199('0xf')]['gotoif']=function(_0x28a13a){logger['info'](util[_0xc199('0x23')](_0xc199('0x133'),_0x28a13a[_0xc199('0x32')]));if(!this['isConfigured'](_0x28a13a[_0xc199('0x134')])){return this['channel'][_0xc199('0x27')](_0x28a13a,_0xc199('0x135'));}try{var _0x4acd4c=eval(_0x28a13a[_0xc199('0x134')])?'true':'false';this['channel'][_0xc199('0x9a')](util[_0xc199('0x23')](_0xc199('0x136'),_0x28a13a['condition'],_0x4acd4c));return{'code':0xc8,'result':_0x4acd4c};}catch(_0x359fbf){return{'code':0xc8,'result':_0xc199('0x137')};}};AGIVertices[_0xc199('0xf')]['gotoiftime']=function(_0x745ba2){logger[_0xc199('0x29')](util[_0xc199('0x23')](_0xc199('0x138'),_0x745ba2[_0xc199('0x32')]));if(!this[_0xc199('0x79')](_0x745ba2[_0xc199('0x139')])){return this[_0xc199('0xd')][_0xc199('0x27')](_0x745ba2,_0xc199('0x13a'));}var _0x37244d=this['getIntervals'][_0xc199('0x65')](this,_0x745ba2['interval_id']);if(!_0x37244d){return this['channel'][_0xc199('0x27')](_0x745ba2,_0xc199('0x13b'));}for(var _0xf0517a=0x0;_0xf0517a<_0x37244d['length'];_0xf0517a+=0x1){var _0x489967=this[_0xc199('0xd')][_0xc199('0xc9')](util[_0xc199('0x23')]('IFTIME(%s?true:false)',_0x37244d[_0xf0517a]));if(_0x489967[_0xc199('0x99')]===-0x1){return _0x489967;}logger[_0xc199('0x29')](util['format'](_0xc199('0x13c'),_0x37244d[_0xf0517a],_0x489967[_0xc199('0x92')]));if(_0x489967[_0xc199('0x92')]===_0xc199('0x13d')){logger[_0xc199('0x29')](util[_0xc199('0x23')](_0xc199('0x13c'),_0x37244d[_0xf0517a],_0xc199('0x13d')));this[_0xc199('0xd')][_0xc199('0x9a')](util[_0xc199('0x23')](_0xc199('0x13c'),_0x37244d[_0xf0517a],_0xc199('0x13d')));return{'code':0xc8,'result':_0xc199('0x13d')};}else{logger[_0xc199('0x29')](util[_0xc199('0x23')](_0xc199('0x13c'),_0x37244d[_0xf0517a],_0xc199('0x137')));this[_0xc199('0xd')][_0xc199('0x9a')](util[_0xc199('0x23')](_0xc199('0x13c'),_0x37244d[_0xf0517a],_0xc199('0x137')));}}return{'code':0xc8,'result':_0xc199('0x137')};};AGIVertices[_0xc199('0xf')][_0xc199('0x13e')]=function(_0x56c80c){logger[_0xc199('0x29')](util[_0xc199('0x23')]('Enter\x20in\x20HANGUP\x20(%s)\x20block',_0x56c80c[_0xc199('0x32')]));return this[_0xc199('0xd')]['hangup']();};AGIVertices[_0xc199('0xf')][_0xc199('0x13f')]=function(_0x48dc09){logger[_0xc199('0x29')](util[_0xc199('0x23')](_0xc199('0x140'),_0x48dc09['label']));if(!this[_0xc199('0x79')](_0x48dc09['key'])){return this[_0xc199('0xd')]['noop'](_0xc199('0xd7'));}var _0x1526f9=_0xc199('0x122');var _0x5d37d4=util[_0xc199('0x23')]('%s/recordings/%s',FILES_PATH,rs[_0xc199('0x10a')](0x4));var _0x3c5122=util[_0xc199('0x23')](_0xc199('0x8f'),_0x5d37d4,_0x1526f9);var _0x418b14=!![];if(_0x48dc09[_0xc199('0x124')]===_0xc199('0x125')){_0x418b14=![];}var _0x444446=this[_0xc199('0xd')][_0xc199('0x12e')](_0x5d37d4,_0x1526f9,_0x48dc09[_0xc199('0x126')],_0x48dc09[_0xc199('0x5a')],undefined,_0x418b14);if(_0x444446[_0xc199('0x99')]!==-0x1){this[_0xc199('0xd')][_0xc199('0x9a')](util[_0xc199('0x23')](_0xc199('0x141'),_0x3c5122));var _0xb7e914=this['ispeechASR']['sync'](this,_0x48dc09,_0x3c5122);if(_0xb7e914){for(var _0x326c33 in _0xb7e914){if(_0xb7e914['hasOwnProperty'](_0x326c33)){this[_0xc199('0xd')][_0xc199('0x94')](util[_0xc199('0x23')]('ISPEECH_ASR_%s',_0x326c33['toUpperCase']()),_0xb7e914[_0x326c33]);}}return this['channel']['noop'](util[_0xc199('0x23')](_0xc199('0x142'),JSON['stringify'](_0xb7e914)));}}return _0x444446;};AGIVertices['prototype'][_0xc199('0x143')]=function(_0x1ee919){logger[_0xc199('0x29')](util[_0xc199('0x23')]('Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block',_0x1ee919[_0xc199('0x32')]));if(!this['isConfigured'](_0x1ee919[_0xc199('0x6f')])){return this[_0xc199('0xd')]['noop']('no\x20key\x20configured');}if(!this['isConfigured'](_0x1ee919[_0xc199('0x4f')])){return this[_0xc199('0xd')][_0xc199('0x9a')](_0xc199('0xb1'));}this[_0xc199('0xd')][_0xc199('0x9a')](util[_0xc199('0x23')](_0xc199('0x144'),_0x1ee919[_0xc199('0x4f')]));var _0x2b4e0a=this['ispeechTTS'][_0xc199('0x65')](this,_0x1ee919);if(_0x2b4e0a){this['channel'][_0xc199('0x9a')](util['format'](_0xc199('0x141'),_0x2b4e0a));var _0x407b02=this['channel'][_0xc199('0x118')](_0x2b4e0a,_0x1ee919[_0xc199('0x126')]);try{fs['unlink'](_0x2b4e0a+_0xc199('0xf2'));}catch(_0x37a3a6){logger['error'](_0x37a3a6);}return _0x407b02;}return this[_0xc199('0xd')][_0xc199('0x27')](_0x1ee919,_0xc199('0x145'));};AGIVertices[_0xc199('0xf')][_0xc199('0x146')]=function(_0x5f27e2){logger[_0xc199('0x29')](util[_0xc199('0x23')](_0xc199('0x147'),_0x5f27e2[_0xc199('0x32')]));if(!this[_0xc199('0x79')](_0x5f27e2['findBy'])){return this[_0xc199('0xd')][_0xc199('0x27')](_0x5f27e2,_0xc199('0x148'));}logger[_0xc199('0x29')](util[_0xc199('0x23')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0xc199('0xd')][_0xc199('0x35')],_0x5f27e2[_0xc199('0x149')]));var _0x26a785=this[_0xc199('0x49')]['sync'](this,_0x5f27e2['findBy']);if(_0x26a785){logger['info'](util['format'](_0xc199('0x14a'),this[_0xc199('0xd')][_0xc199('0x35')],_0x5f27e2[_0xc199('0x149')]));this['channel']['noop'](util[_0xc199('0x23')]('AGENT\x20%s\x20FOUND\x20BY',this[_0xc199('0xd')][_0xc199('0x35')],_0x5f27e2[_0xc199('0x149')]));return{'code':0xc8,'result':_0xc199('0x14b')};}else{logger[_0xc199('0x29')](util[_0xc199('0x23')](_0xc199('0x14c'),this[_0xc199('0xd')][_0xc199('0x35')],_0x5f27e2['findBy']));this[_0xc199('0xd')]['noop'](util['format']('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this['channel']['callerid'],_0x5f27e2[_0xc199('0x149')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0xc199('0xf')][_0xc199('0x14d')]=function(_0x1a64b4){logger['info'](util[_0xc199('0x23')]('Enter\x20in\x20LOGOUT\x20(%s)\x20block',_0x1a64b4['label']));if(!this[_0xc199('0x79')](_0x1a64b4[_0xc199('0x149')])){return this[_0xc199('0xd')][_0xc199('0x27')](_0x1a64b4,_0xc199('0x148'));}logger[_0xc199('0x29')](util[_0xc199('0x23')](_0xc199('0x14e'),this[_0xc199('0xd')][_0xc199('0x35')],_0x1a64b4[_0xc199('0x149')]));var _0x5801cf=this['agentLogout']['sync'](this,_0x1a64b4[_0xc199('0x149')]);if(_0x5801cf){logger[_0xc199('0x29')](util[_0xc199('0x23')]('AGENT\x20%s\x20FOUND\x20BY',this[_0xc199('0xd')]['callerid'],_0x1a64b4[_0xc199('0x149')]));this['channel'][_0xc199('0x9a')](util[_0xc199('0x23')](_0xc199('0x14a'),this[_0xc199('0xd')][_0xc199('0x35')],_0x1a64b4[_0xc199('0x149')]));return{'code':0xc8,'result':_0xc199('0x14b')};}else{logger[_0xc199('0x29')](util[_0xc199('0x23')](_0xc199('0x14c'),this[_0xc199('0xd')]['callerid'],_0x1a64b4['findBy']));this[_0xc199('0xd')][_0xc199('0x9a')](util[_0xc199('0x23')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0xc199('0xd')][_0xc199('0x35')],_0x1a64b4[_0xc199('0x149')]));return{'code':0xc8,'result':_0xc199('0x14f')};}};AGIVertices['prototype'][_0xc199('0x150')]=function(_0x3a43f1){logger[_0xc199('0x29')](util['format']('Enter\x20in\x20MATH\x20(%s)\x20block',_0x3a43f1['label']));if(!this[_0xc199('0x79')](_0x3a43f1[_0xc199('0x151')])){return this[_0xc199('0xd')]['error'](_0x3a43f1,_0xc199('0x152'));}this[_0xc199('0xd')][_0xc199('0x9a')](util['format'](_0xc199('0x153'),_0x3a43f1[_0xc199('0x151')]));var _0x5c883f=eval(_0x3a43f1[_0xc199('0x151')]);if(!this[_0xc199('0x79')](_0x3a43f1[_0xc199('0xc7')])){return this[_0xc199('0xd')][_0xc199('0x9a')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0xc06dd3=this[_0xc199('0xc9')][_0xc199('0x65')](this,_0x3a43f1[_0xc199('0xc7')]);if(!_0xc06dd3){return this['channel'][_0xc199('0x27')](_0x3a43f1,_0xc199('0x108'));}if(_[_0xc199('0x8c')](_0x5c883f)){var _0x5d3071=this;_0x5c883f[_0xc199('0xca')](function(_0x5e0f68,_0x17862d){_0x5d3071['channel'][_0xc199('0x94')](util[_0xc199('0x23')](_0xc199('0x154'),_0xc06dd3,_0x17862d),_0x5e0f68);});return this['channel']['noop'](util[_0xc199('0x23')](_0xc199('0x155'),_0xc06dd3));}else{return this[_0xc199('0xd')][_0xc199('0x94')](_0xc06dd3,_0x5c883f);}};AGIVertices['prototype'][_0xc199('0xc')]=function(_0x3f3f75){logger['info'](util['format'](_0xc199('0x156'),_0x3f3f75[_0xc199('0x32')]));if(_0x3f3f75['retry']===0x0){return this[_0xc199('0x95')](_0x3f3f75);}_0x3f3f75[_0xc199('0x101')]-=0x1;if(!this['isConfigured'](_0x3f3f75['file_id'])){return this[_0xc199('0xd')][_0xc199('0x27')](_0x3f3f75,'no\x20file\x20audio\x20selected');}var _0x259b2e=this[_0xc199('0x103')][_0xc199('0x65')](this,_0x3f3f75[_0xc199('0x102')]);if(!_0x259b2e){return this[_0xc199('0xd')][_0xc199('0x27')](_0x3f3f75,_0xc199('0x104'));}var _0x5b77be=this[_0xc199('0xd')]['getData'](_0x259b2e,_0x3f3f75['response'],_0x3f3f75['digit']);var _0x454d7c=_0x5b77be[_0xc199('0x99')];if(_0x5b77be[_0xc199('0x99')]===-0x1){this['createSquareDetailsReport'][_0xc199('0x65')](this,_0x3f3f75,'-1');return _0x5b77be;}else if(_0x5b77be[_0xc199('0x92')]==='timeout'){_0x5b77be['result']=_0x5b77be[_0xc199('0x99')][_0xc199('0x90')]>0x0?_0x5b77be[_0xc199('0x99')]:'t';}else if(_[_0xc199('0x3d')](_0x5b77be[_0xc199('0x99')])){_0x5b77be[_0xc199('0x99')]='#';_0x454d7c='#';}if(!this[_0xc199('0x79')](_0x3f3f75[_0xc199('0xc7')])){this[_0xc199('0xd')][_0xc199('0x9a')](_0xc199('0xc8'));}else{var _0x1ea1b0=this[_0xc199('0xc9')][_0xc199('0x65')](this,_0x3f3f75['variable_id']);if(!_0x1ea1b0){return this[_0xc199('0xd')]['error'](_0x3f3f75,_0xc199('0x108'));}this[_0xc199('0xd')][_0xc199('0x94')](_0x1ea1b0,_0x454d7c);}this['createSquareDetailsReport']['sync'](this,_0x3f3f75,_0x454d7c);return _0x5b77be;};AGIVertices['prototype'][_0xc199('0x9a')]=function(_0x279cd8){logger['info'](util[_0xc199('0x23')]('Enter\x20in\x20NOOP\x20(%s)\x20block',_0x279cd8[_0xc199('0x32')]));return this[_0xc199('0xd')][_0xc199('0x9a')](_0x279cd8[_0xc199('0x157')]||_0x279cd8['label']);};AGIVertices[_0xc199('0xf')][_0xc199('0x158')]=function(_0x454c3a){logger['info'](util[_0xc199('0x23')](_0xc199('0x159'),_0x454c3a[_0xc199('0x32')]));if(!this[_0xc199('0x79')](_0x454c3a[_0xc199('0x149')])){return this['channel']['error'](_0x454c3a,'no\x20find\x20by\x20configured');}logger[_0xc199('0x29')](util[_0xc199('0x23')](_0xc199('0x14e'),this[_0xc199('0xd')][_0xc199('0x35')],_0x454c3a[_0xc199('0x149')]));var _0x4adfc8=this[_0xc199('0x15a')]['sync'](this,_0x454c3a[_0xc199('0x15b')]);var _0xe2fe41=this[_0xc199('0x46')][_0xc199('0x65')](this,_0x454c3a[_0xc199('0x149')],_0x4adfc8);if(_0xe2fe41){logger[_0xc199('0x29')](util[_0xc199('0x23')](_0xc199('0x14a'),this[_0xc199('0xd')][_0xc199('0x35')],_0x454c3a[_0xc199('0x149')]));this[_0xc199('0xd')]['noop'](util[_0xc199('0x23')](_0xc199('0x14a'),this[_0xc199('0xd')][_0xc199('0x35')],_0x454c3a[_0xc199('0x149')]));return{'code':0xc8,'result':_0xc199('0x14b')};}else{logger[_0xc199('0x29')](util[_0xc199('0x23')](_0xc199('0x14c'),this[_0xc199('0xd')][_0xc199('0x35')],_0x454c3a[_0xc199('0x149')]));this[_0xc199('0xd')][_0xc199('0x9a')](util[_0xc199('0x23')](_0xc199('0x14a'),this[_0xc199('0xd')]['callerid'],_0x454c3a[_0xc199('0x149')]));return{'code':0xc8,'result':_0xc199('0x14f')};}};AGIVertices['prototype']['playback']=function(_0x938d91){logger[_0xc199('0x29')](util[_0xc199('0x23')](_0xc199('0x15c'),_0x938d91['label']));if(!this[_0xc199('0x79')](_0x938d91[_0xc199('0x102')])){return this[_0xc199('0xd')][_0xc199('0x27')](_0x938d91,'no\x20file\x20audio\x20selected');}var _0xcfbc1e=this[_0xc199('0x103')][_0xc199('0x65')](this,_0x938d91[_0xc199('0x102')]);if(!_0xcfbc1e){return this['channel'][_0xc199('0x27')](_0x938d91,_0xc199('0x104'));}var _0x54f59e=this[_0xc199('0xd')][_0xc199('0x4c')](_0xc199('0x15d'),[_0xcfbc1e,_0x938d91[_0xc199('0xfc')]]);if(_0x54f59e['result']===-0x1){return _0x54f59e;}return this['channel'][_0xc199('0x9a')](util['format'](_0xc199('0x15e'),_0xc199('0x15d'),_0xcfbc1e));};AGIVertices[_0xc199('0xf')][_0xc199('0x15f')]=function(_0xae16c3){logger[_0xc199('0x29')](util[_0xc199('0x23')](_0xc199('0x160'),_0xae16c3['label']));if(!this['isConfigured'](_0xae16c3[_0xc199('0x161')])){return this['channel'][_0xc199('0x27')](_0xae16c3,'no\x20queue\x20selected');}var _0x1c7aa2='';var _0x1b6ddc=parseInt(_0xae16c3[_0xc199('0x161')],0xa);if(isNaN(_0x1b6ddc)){_0x1c7aa2=_0xae16c3['queue_id'];}else{_0x1c7aa2=this[_0xc199('0x13')]['sync'](this,_0xae16c3[_0xc199('0x161')]);if(!_0x1c7aa2){return this[_0xc199('0xd')][_0xc199('0x27')](_0xae16c3,'no\x20queue\x20found');}}var _0x32c12a='';if(this[_0xc199('0x79')](_0xae16c3[_0xc199('0x102')])){var _0x288534=this[_0xc199('0x103')][_0xc199('0x65')](this,_0xae16c3[_0xc199('0x102')]);if(_0x288534){_0x32c12a=_0x288534;}}this['createSquareDetailsReport'][_0xc199('0x65')](this,_0xae16c3,_0x1c7aa2);if(_0xae16c3[_0xc199('0xfc')][_0xc199('0x162')]('x')<0x0){_0xae16c3[_0xc199('0xfc')]+='x';}if(_0xae16c3[_0xc199('0xfc')][_0xc199('0x162')]('X')<0x0){_0xae16c3[_0xc199('0xfc')]+='X';}this['channel'][_0xc199('0x94')]('XMCS-QUEUE',_0x1c7aa2?_0x1c7aa2['toLowerCase']():'');var _0x4a53e6=this[_0xc199('0xd')][_0xc199('0x4c')]('QUEUE',[_0x1c7aa2,_0xae16c3[_0xc199('0xfc')],_0xae16c3[_0xc199('0x58')],_0x32c12a,_0xae16c3['timeout'],_0xae16c3[_0xc199('0x7')],_0xae16c3[_0xc199('0x163')],_0xae16c3[_0xc199('0x164')],'',_0xae16c3[_0xc199('0x165')]]);if(_0x4a53e6[_0xc199('0x99')]===-0x1){return _0x4a53e6;}return this[_0xc199('0xd')][_0xc199('0x9a')](util[_0xc199('0x23')]('Executed\x20command\x20%s\x20%s','QUEUE',_0x1c7aa2));};AGIVertices[_0xc199('0xf')]['record']=function(_0x477fa3){logger[_0xc199('0x29')](util['format']('Enter\x20in\x20RECORD\x20(%s)\x20block',_0x477fa3[_0xc199('0x32')]));var _0x32177b=_0x477fa3[_0xc199('0x166')]||'wav';var _0x2e3aaa=util['format'](_0xc199('0x167'),this[_0xc199('0xd')][_0xc199('0x31')],rs[_0xc199('0x10a')](0x5));var _0x14a834=util[_0xc199('0x23')]('%s/recordings/%s.%s',FILES_PATH,_0x2e3aaa,_0x32177b);var _0x5ab9b0=util[_0xc199('0x23')]('%s/recordings/%s',FILES_PATH,_0x2e3aaa);this['createSquareRecording']['sync'](this,_0x477fa3,_0x2e3aaa,_0x14a834);this[_0xc199('0xd')][_0xc199('0x94')]('RECORDING_SAVENAME',_0x2e3aaa);logger[_0xc199('0x29')](_0xc199('0x168'),_0x5ab9b0,_0x32177b,_0x477fa3[_0xc199('0x169')],_0x477fa3[_0xc199('0x5a')]);return this['channel'][_0xc199('0x12e')](_0x5ab9b0,_0x32177b,_0x477fa3[_0xc199('0x169')],_0x477fa3['timeout'],undefined,!![]);};AGIVertices[_0xc199('0xf')][_0xc199('0x16a')]=function(_0x2562bd){logger['info'](util['format']('Enter\x20in\x20RESTAPI\x20(%s)\x20block',_0x2562bd[_0xc199('0x32')]));if(!this[_0xc199('0x79')](_0x2562bd['url'])){return this[_0xc199('0xd')][_0xc199('0x9a')]('no\x20url\x20configured');}var _0x3e4519=this[_0xc199('0x57')]['sync'](this,_0x2562bd);logger[_0xc199('0x29')](util[_0xc199('0x23')](_0xc199('0x16b'),util[_0xc199('0x16c')](_0x3e4519,{'showHidden':![],'depth':null})));if(!this['isConfigured'](_0x2562bd[_0xc199('0xc7')])){return this[_0xc199('0xd')]['noop'](_0xc199('0x16d'));}var _0x23fc76=this[_0xc199('0xc9')][_0xc199('0x65')](this,_0x2562bd[_0xc199('0xc7')]);if(!_0x23fc76){return this[_0xc199('0xd')][_0xc199('0x27')](_0x2562bd,'no\x20variable\x20found');}this['channel'][_0xc199('0x94')](util[_0xc199('0x23')](_0xc199('0x16e'),_0x23fc76),_0x3e4519[_0xc199('0x69')]?_0x3e4519['statusCode']:'200');this[_0xc199('0xd')][_0xc199('0x94')](util[_0xc199('0x23')](_0xc199('0x16f'),_0x23fc76),_0x3e4519[_0xc199('0x6a')]?_0x3e4519[_0xc199('0x6a')]:'OK');if(_0x3e4519['body']){try{this[_0xc199('0x8e')](_0x3e4519[_0xc199('0x5f')],_0x23fc76);}catch(_0x422d76){logger[_0xc199('0x27')](util['format']('Unable\x20to\x20set\x20result\x20in\x20variable\x20%s',_0x23fc76));}}return this['channel'][_0xc199('0x9a')](util['format'](_0xc199('0xcc'),_0x23fc76));};AGIVertices[_0xc199('0xf')][_0xc199('0x170')]=function(_0x296908){logger[_0xc199('0x29')](util[_0xc199('0x23')](_0xc199('0x171'),_0x296908[_0xc199('0x32')]));return this[_0xc199('0xd')][_0xc199('0x172')](_0x296908[_0xc199('0x173')][_0xc199('0xc5')](/\s+/g,''),_0x296908[_0xc199('0x169')]);};AGIVertices[_0xc199('0xf')][_0xc199('0x174')]=function(_0x522aff){logger[_0xc199('0x29')](util[_0xc199('0x23')](_0xc199('0x175'),_0x522aff[_0xc199('0x32')]));return this['channel'][_0xc199('0x176')](_0x522aff[_0xc199('0x177')]['replace'](/\s+/g,''),_0x522aff[_0xc199('0x169')]);};AGIVertices[_0xc199('0xf')]['sayphonetic']=function(_0x2b707e){logger['info'](util['format'](_0xc199('0x178'),_0x2b707e[_0xc199('0x32')]));return this['channel']['sayPhonetic'](_0x2b707e[_0xc199('0x4f')],_0x2b707e[_0xc199('0x169')]);};AGIVertices['prototype']['sendMail']=function(_0x67eb5b){logger[_0xc199('0x29')](util['format']('Enter\x20in\x20SENDMAIL\x20(%s)\x20block',_0x67eb5b[_0xc199('0x32')]));if(!this[_0xc199('0x79')](_0x67eb5b['account_id'])){return this[_0xc199('0xd')][_0xc199('0x9a')](_0xc199('0x179'));}var _0x27424f=this[_0xc199('0x1e')][_0xc199('0x65')](this,_0x67eb5b[_0xc199('0x17a')]);if(!_0x27424f||!_0x27424f[_0xc199('0x17b')]){return this[_0xc199('0xd')][_0xc199('0x27')](_0x67eb5b,_0xc199('0x17c'));}var _0x11f46c={'from':util[_0xc199('0x23')]('\x22%s\x22\x20<%s>',_0x27424f[_0xc199('0x11')],_0x27424f[_0xc199('0x17d')]||_0x27424f['Smtp'][_0xc199('0x17e')]),'to':_0x67eb5b['to']||'','cc':_0x67eb5b['cc']||'','bcc':_0x67eb5b[_0xc199('0x17f')]||'','subject':_0x67eb5b[_0xc199('0x180')],'html':_0x67eb5b[_0xc199('0x4f')],'text':_0x67eb5b[_0xc199('0x4f')]};var _0x48a966={'tls':{'rejectUnauthorized':![]}};if(_0x27424f[_0xc199('0x17b')][_0xc199('0x181')]){_0x48a966[_0xc199('0x181')]=_0x27424f[_0xc199('0x17b')][_0xc199('0x181')];}else{_0x48a966['host']=_0x27424f['Smtp'][_0xc199('0x182')];_0x48a966[_0xc199('0x183')]=_0x27424f['Smtp'][_0xc199('0x183')];_0x48a966[_0xc199('0x184')]=_0x27424f['Smtp'][_0xc199('0x184')];}if(_0x27424f[_0xc199('0x17b')][_0xc199('0x185')]){_0x48a966[_0xc199('0x186')]={'user':_0x27424f[_0xc199('0x17b')]['user'],'pass':_0x27424f[_0xc199('0x17b')][_0xc199('0x187')]};}if(this[_0xc199('0x79')](_0x67eb5b[_0xc199('0x188')])){}logger[_0xc199('0xcd')](_0xc199('0x189'),JSON[_0xc199('0x67')](_0x11f46c));this[_0xc199('0x30')][_0xc199('0x65')](this,_0x67eb5b,_0x67eb5b[_0xc199('0x17a')]);this['channel'][_0xc199('0x9a')](util[_0xc199('0x23')](_0xc199('0x18a'),_0x27424f[_0xc199('0x11')]));this['sendMailMessage'][_0xc199('0x65')](this,_0x48a966,_0x11f46c);return this['channel'][_0xc199('0x9a')](_0xc199('0x18b'));};AGIVertices[_0xc199('0xf')][_0xc199('0x18c')]=function(_0x1029f7){logger['info'](util['format'](_0xc199('0x18d'),_0x1029f7[_0xc199('0x32')]));return this['channel']['noop'](_0xc199('0x18e'));};AGIVertices[_0xc199('0xf')][_0xc199('0x18f')]=function(_0x37507f){logger['info'](util[_0xc199('0x23')]('Enter\x20in\x20SENDSMS\x20(%s)\x20block',_0x37507f[_0xc199('0x32')]));if(!this[_0xc199('0x79')](_0x37507f[_0xc199('0x190')])){return this[_0xc199('0xd')][_0xc199('0x9a')](_0xc199('0x191'));}var _0x363730=this['getSmsAccount'][_0xc199('0x65')](this,_0x37507f[_0xc199('0x190')]);if(!_0x363730){return this[_0xc199('0xd')][_0xc199('0x27')](_0x37507f,'no\x20sms\x20account\x20found');}var _0x4819d9={'body':_0x37507f['sms_text'],'phone':_0x37507f['to']||'','SmsAccountId':_0x363730['id']};logger[_0xc199('0xcd')]('sendSMS\x20message',JSON['stringify'](_0x4819d9));this[_0xc199('0x30')]['sync'](this,_0x37507f,_0x37507f[_0xc199('0x190')]);this[_0xc199('0xd')][_0xc199('0x9a')](util[_0xc199('0x23')](_0xc199('0x192'),_0x363730[_0xc199('0x11')]));this['createSmsMessage'][_0xc199('0x65')](this,_0x4819d9);return this['channel'][_0xc199('0x9a')]('Sms\x20message\x20added\x20to\x20outgoing\x20process');};AGIVertices['prototype'][_0xc199('0x193')]=function(_0x313d64){logger[_0xc199('0x29')](util['format']('Enter\x20in\x20SET\x20(%s)\x20block',_0x313d64[_0xc199('0x32')]));if(!this['isConfigured'](_0x313d64[_0xc199('0xc7')])){return this[_0xc199('0xd')][_0xc199('0x27')](_0x313d64,'no\x20variable\x20selected');}var _0x46f071=this['getVariable'][_0xc199('0x65')](this,_0x313d64['variable_id']);if(!_0x46f071){return this[_0xc199('0xd')][_0xc199('0x27')](_0x313d64,_0xc199('0x108'));}return this[_0xc199('0xd')]['setVariable'](_0x46f071,_0x313d64[_0xc199('0x194')]);};AGIVertices['prototype'][_0xc199('0x195')]=function(_0x104375){logger[_0xc199('0x29')](util[_0xc199('0x23')](_0xc199('0x196'),_0x104375[_0xc199('0x32')]));this[_0xc199('0xd')]['noop']('START\x20CALLY\x20SQUARE');if(_0x104375[_0xc199('0xa5')]===_0xc199('0x197')){this[_0xc199('0xd')][_0xc199('0x9a')]('Answer');return this[_0xc199('0xd')]['answer']();}return this[_0xc199('0xd')][_0xc199('0x9a')](_0xc199('0x198'));};AGIVertices[_0xc199('0xf')][_0xc199('0x199')]=function(_0xacdf56){logger[_0xc199('0x29')](util[_0xc199('0x23')]('Enter\x20in\x20SUBPROJECT\x20(%s)\x20block',_0xacdf56[_0xc199('0x32')]));if(!this[_0xc199('0x79')](_0xacdf56[_0xc199('0x19a')])){return this[_0xc199('0xd')][_0xc199('0x27')](_0xacdf56,_0xc199('0x19b'));}var _0x580edb=this[_0xc199('0x19c')]['sync'](this,_0xacdf56[_0xc199('0x19a')]);if(!this[_0xc199('0x79')](_0x580edb)){return this[_0xc199('0xd')][_0xc199('0x27')](_0xacdf56,util[_0xc199('0x23')](_0xc199('0x19d'),_0xacdf56[_0xc199('0x19a')]));}if(_0x580edb===this[_0xc199('0xd')]['arg_1']){return this[_0xc199('0xd')][_0xc199('0x27')](_0xacdf56,_0xc199('0x19e'));}this[_0xc199('0x30')][_0xc199('0x65')](this,_0xacdf56,_0x580edb);var _0x52778b=this[_0xc199('0xd')][_0xc199('0x4c')]('AGI',util[_0xc199('0x23')](_0xc199('0x19f'),config[_0xc199('0x7')][_0xc199('0x182')]||_0xc199('0x1a0'),_0x580edb,this[_0xc199('0xd')][_0xc199('0x34')]));if(_0x52778b[_0xc199('0x99')]===-0x1){return _0x52778b;}return this['channel']['noop'](util[_0xc199('0x23')](_0xc199('0x15e'),'AGI',_0x580edb));};AGIVertices[_0xc199('0xf')][_0xc199('0x1a1')]=function(_0x4d8d70){logger[_0xc199('0x29')](util[_0xc199('0x23')](_0xc199('0x1a2'),_0x4d8d70[_0xc199('0x32')]));var _0x120c6d=this['shellCommand'][_0xc199('0x65')](this,_0x4d8d70[_0xc199('0x1a3')]);this['createSquareDetailsReport'][_0xc199('0x65')](this,_0x4d8d70,_0x4d8d70[_0xc199('0x1a3')]);if(this[_0xc199('0x79')](_0x4d8d70[_0xc199('0xc7')])){var _0x10e4d6=this[_0xc199('0xc9')][_0xc199('0x65')](this,_0x4d8d70['variable_id']);if(_0x10e4d6){this[_0xc199('0xd')]['setVariable'](_0x10e4d6,_0x120c6d);return this[_0xc199('0xd')][_0xc199('0x9a')](util[_0xc199('0x23')]('sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s',_0x4d8d70[_0xc199('0x1a3')],_0x10e4d6));}}return this[_0xc199('0xd')][_0xc199('0x9a')](util[_0xc199('0x23')]('sh\x20command:\x20%s\x20result\x20no\x20stored',_0x4d8d70[_0xc199('0x1a3')]));};AGIVertices[_0xc199('0xf')][_0xc199('0x1a4')]=function(_0x285dd4){logger[_0xc199('0x29')](util[_0xc199('0x23')]('Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block',_0x285dd4[_0xc199('0x32')]));_0x285dd4[_0xc199('0x4f')]=_0x285dd4['text'][_0xc199('0xc5')](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0x285dd4[_0xc199('0x1a5')])){return this[_0xc199('0xd')][_0xc199('0x9a')](_0xc199('0x1a6'));}if(!this[_0xc199('0x79')](_0x285dd4[_0xc199('0x4f')])){return this[_0xc199('0xd')]['noop'](_0xc199('0xb1'));}this[_0xc199('0xd')]['noop'](util[_0xc199('0x23')](_0xc199('0x1a7'),_0x285dd4[_0xc199('0x4f')]));var _0x66b03e=this[_0xc199('0x4e')][_0xc199('0x65')](this,_0x285dd4);if(_0x66b03e){this[_0xc199('0xd')][_0xc199('0x9a')](util[_0xc199('0x23')]('Google\x20Cloud\x20TTS\x20%s\x20file\x20created',_0x66b03e));var _0x16e257=this['channel']['streamFile'](_0x66b03e);try{fs[_0xc199('0xf1')](_0x66b03e+_0xc199('0xf2'));}catch(_0x585032){logger[_0xc199('0x27')](_0x585032);}return _0x16e257;}return this[_0xc199('0xd')]['error'](_0x285dd4,'Google\x20Cloud\x20TTS\x20is\x20unreachable');};AGIVertices[_0xc199('0xf')][_0xc199('0x1a8')]=function(_0x2ab1da){logger[_0xc199('0x29')](util[_0xc199('0x23')](_0xc199('0x1a9'),_0x2ab1da['label']));_0x2ab1da[_0xc199('0x4f')]=_0x2ab1da['text'][_0xc199('0xc5')](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0x2ab1da[_0xc199('0x4f')])){return this[_0xc199('0xd')][_0xc199('0x9a')]('no\x20text\x20configured');}this[_0xc199('0xd')][_0xc199('0x9a')](util[_0xc199('0x23')](_0xc199('0x1aa'),_0x2ab1da[_0xc199('0x4f')]));var _0x59f4b6=this[_0xc199('0x55')][_0xc199('0x65')](this,_0x2ab1da);if(_0x59f4b6){this[_0xc199('0xd')][_0xc199('0x9a')](util[_0xc199('0x23')]('Google\x20TTS\x20%s\x20file\x20created',_0x59f4b6));var _0x1e5341=this['channel'][_0xc199('0x118')](_0x59f4b6);try{fs['unlink'](_0x59f4b6+'.wav');}catch(_0x368b2e){logger[_0xc199('0x27')](_0x368b2e);}return _0x1e5341;}return this[_0xc199('0xd')][_0xc199('0x27')](_0x2ab1da,_0xc199('0x1ab'));};AGIVertices['prototype'][_0xc199('0x1ac')]=function(_0x461b38){logger[_0xc199('0x29')](util[_0xc199('0x23')](_0xc199('0x1ad'),_0x461b38[_0xc199('0x32')]));if(!this[_0xc199('0x79')](_0x461b38['findBy'])){return this[_0xc199('0xd')][_0xc199('0x27')](_0x461b38,_0xc199('0x148'));}logger[_0xc199('0x29')](util['format'](_0xc199('0x14e'),this['channel']['callerid'],_0x461b38[_0xc199('0x149')]));var _0x4afca3=this[_0xc199('0x47')][_0xc199('0x65')](this,_0x461b38[_0xc199('0x149')]);if(_0x4afca3){logger[_0xc199('0x29')](util[_0xc199('0x23')](_0xc199('0x14a'),this[_0xc199('0xd')][_0xc199('0x35')],_0x461b38[_0xc199('0x149')]));this[_0xc199('0xd')][_0xc199('0x9a')](util[_0xc199('0x23')](_0xc199('0x14a'),this['channel'][_0xc199('0x35')],_0x461b38[_0xc199('0x149')]));return{'code':0xc8,'result':_0xc199('0x14b')};}else{logger[_0xc199('0x29')](util['format'](_0xc199('0x14c'),this[_0xc199('0xd')][_0xc199('0x35')],_0x461b38[_0xc199('0x149')]));this[_0xc199('0xd')][_0xc199('0x9a')](util[_0xc199('0x23')](_0xc199('0x14c'),this['channel'][_0xc199('0x35')],_0x461b38[_0xc199('0x149')]));return{'code':0xc8,'result':_0xc199('0x14f')};}};AGIVertices[_0xc199('0xf')][_0xc199('0x1ae')]=function(_0x47ff00){logger[_0xc199('0x29')](util['format'](_0xc199('0x1af'),_0x47ff00[_0xc199('0x32')]));var _0x1093d4=this[_0xc199('0xd')][_0xc199('0x4c')](_0xc199('0x1b0'),[_0x47ff00[_0xc199('0x1b1')],_0x47ff00[_0xc199('0x6d')]]);if(_0x1093d4[_0xc199('0x99')]===-0x1){return _0x1093d4;}return this[_0xc199('0xd')][_0xc199('0x9a')](util[_0xc199('0x23')]('Executed\x20command\x20%s\x20%s',_0xc199('0x1b0'),_0x47ff00[_0xc199('0x1b1')]));};AGIVertices['prototype']['vswitch']=function(_0x5a996b){logger['info'](util[_0xc199('0x23')](_0xc199('0x1b2'),_0x5a996b[_0xc199('0x32')]));if(!this[_0xc199('0x79')](_0x5a996b['variable_id'])){return this[_0xc199('0xd')][_0xc199('0x27')](_0x5a996b,_0xc199('0x1b3'));}var _0x228b7f=this[_0xc199('0xc9')][_0xc199('0x65')](this,_0x5a996b[_0xc199('0xc7')]);if(!_0x228b7f){return this['channel'][_0xc199('0x27')](_0x5a996b,'no\x20variable\x20found');}var _0x4d6b63=this[_0xc199('0xd')]['getVariable'](_0x228b7f);return{'code':0xc8,'result':_0x4d6b63[_0xc199('0x92')]?_0x4d6b63[_0xc199('0x92')]:'-'};};String[_0xc199('0xf')]['replaceAll']=function(_0x21c2b4,_0x481cc8){return this[_0xc199('0x91')](_0x21c2b4)[_0xc199('0x1b4')](_0x481cc8);};module[_0xc199('0x1b5')]=AGIVertices; \ No newline at end of file +var _0x6100=['variable_value','start','Enter\x20in\x20START\x20(%s)\x20block','yes','subproject','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','getSquareProject','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','AGI','127.0.0.1','system','Enter\x20in\x20SYSTEM\x20(%s)\x20block','sh\x20command:\x20%s\x20result\x20no\x20stored','google_cloud_tts','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','tts','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20%s\x20file\x20created','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','Enter\x20in\x20SWITCH\x20(%s)\x20block','exports','path','util','lodash','shelljs','odbc','moment','mustache','request-promise','../../config/logger','agi','../../config/environment','./scripts','rawHeaders','menu','getdigits','getsecretdigits','rpc','mailRpc','prototype','getVariable','getVariableById','then','name','catch','getVoiceQueue','getVoiceQueueById','getSquareProjectById','getSquareOdbc','getSquareOdbcById','getUser','getUserById','getTrunk','getTrunkById','getSound','getSoundById','getSoundPath','save_name','getMailAccount','sendMailMessage','IntervalId','interval','%s/sounds/converted/%s','getQueryOdbc','open','Error\x20getting\x20ODBC\x20connection\x20%s','info','ODBC\x20connection\x20successfully','query','Error\x20executing\x20query\x20%s','Query\x20executed\x20correctly\x20%s','close','error','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','createSquareDetailsReport','channel','uniqueid','agicommand','arg_1','callerid','calleridname','extension','priority','accountcode','file','createSquareMessage','createCmContact','isEmpty','isNil','lastName','phone','callback','Callback\x20scheduled\x20at\x20','toString','callback_priority','getPause','agentPause','agent','agentUnpause','agentLogout','internal','format','%s/%s@from-sip/n','LOCAL','agentLogin','shellCommand','exec','replace','googleCloudTTS','apiKey','text','en-US','ssmlGender','MALE','MP3','googleTTS','google_tts_language','restAPI','url','timeout','includes','PUT','toUpperCase','body','parse','rawBody','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','render','stringify','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','statusMessage','message','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflowV2','client_email','dialogflowV2_language','sestekNDA','ispeechTTS','key','speed','ispeechASR','ispeech_asr_language','model','aws_access_key_id','aws_secret_access_key','aws_polly_voice','aws_text_type','awsLex','aws_lex_region','googleASR','tildeASR','appid','appsecret','uri','clear','clone','isString','replaceObjectAllVariables','recursiveNodeIndex','hasOwnProperty','isArray','length','replaceAllVariables','isPlainObject','saveRestApiResult','%s.%s','split','replaceAll','getAndSetVariable','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','extra','setVariable','isConfigured','maxRetry','sync','mrcpsynth','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','label','noop','no\x20text\x20configured','MRCPSynth','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','grammar','no\x20grammar\x20configured','MRCPRecog','RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','RECOG_INSTANCE()','MRCP_RECOG_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','command','args','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','Wait\x20%s\x20seconds\x20before\x20answer','wait','Enter\x20in\x20CALLBACK\x20(%s)\x20block','list_id','no\x20list\x20selected','scheduledAt','add','delay','custom_app','Executed\x20command\x20%s\x20%s','application','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_TRANSCRIPT','LUMENVOX_ASR_INSTANCE','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20database\x20selected','query:\x20%s','variable_id','no\x20variable\x20found','forEach','keys','%s[%s][%s]','dial','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','no\x20user\x20found','DIAL','SIP/%s','Executed\x20command\x20%s','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','bot','Trying\x20Dialogflow:\x20%s','googleDialogflow','DIALOGFLOW_%s','speech','Dialogflow\x20Result\x20%s','dialogflowV2','dialogflowV2_project_id','no\x20project_id\x20configured','no\x20client_email\x20configured','private_key','no\x20private_key\x20configured','Trying\x20DialogflowV2:\x20%s','out','providerResponse','DialogflowV2\x20Result\x20%s','DialogflowV2\x20is\x20unreachable','sesteknda','ndauth_url','no\x20ndauth\x20url\x20configured','username','no\x20username\x20configured','password','no\x20password\x20configured','SESTEK_NDA_%s','audiofile','streamFile','unlink','.wav','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','end','Enter\x20in\x20END\x20(%s)\x20block','ext_dial','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','trunk_name','no\x20trunk\x20selected','SIP/%s/%s','opts','Enter\x20in\x20FINALLY\x20(%s)\x20block','finally','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','retry','file_id','getData','response','maxdigit','test','mindigit','hiddendigitsnum','hiddendigitspos','first','substr','generate','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','Enter\x20in\x20GOAL\x20(%s)\x20block','GOAL\x20%s','awspolly','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','awsPolly','aws\x20Polly\x20%s\x20file\x20created','aws\x20Polly\x20is\x20unreachable','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','aws_bot_name','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','AWS_LEX_%s','amazonlex','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','wav','%s/recordings/%s','NOBEEP','recordFile','intKey','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appid\x20configured','no\x20appsecret\x20configured','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','no\x20condition\x20configured','EVAL\x20CONDITION\x20%s\x20%s','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','no\x20interval\x20configured','getIntervals','no\x20intervals\x20found','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','true','false','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','ispeech\x20TTS\x20is\x20unreachable','findBy','no\x20find\x20by\x20configured','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','logout','Enter\x20in\x20LOGOUT\x20(%s)\x20block','FIND\x20AGENT\x20%s\x20BY\x20%s','AGENT\x20%s\x20FOUND\x20BY','math','Enter\x20in\x20MATH\x20(%s)\x20block','operation','no\x20operation\x20configured','no\x20variable\x20selected\x20for\x20the\x20result','%s[%s]','Enter\x20in\x20MENU\x20(%s)\x20block','no\x20file\x20audio\x20selected','no\x20file\x20audio\x20found','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','output','Enter\x20in\x20PAUSE\x20(%s)\x20block','pause_id','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','queue','queue_id','no\x20queue\x20found','indexOf','toLowerCase','macro','position','QUEUE','recordingFormat','%s_%s','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','Response:','200','%s_STATUS_MESSAGE','variable\x20%s\x20set','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','digits','escape_digits','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','number','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','no\x20mail\x20account\x20configured','account_id','no\x20mail\x20account\x20found','email','Smtp','user','service','host','port','secure','authentication','auth','template_id','Trying\x20SendMail\x20with\x20account\x20%s','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','Enter\x20in\x20SENDSMS\x20(%s)\x20block','no\x20sms\x20account\x20configured','sms_account_id','no\x20sms\x20account\x20found','sendSMS\x20message','createSmsMessage','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected'];(function(_0xae01dd,_0xbd8a3c){var _0x8c26df=function(_0x359827){while(--_0x359827){_0xae01dd['push'](_0xae01dd['shift']());}};_0x8c26df(++_0xbd8a3c);}(_0x6100,0x1e1));var _0x0610=function(_0x7237f6,_0x17ac54){_0x7237f6=_0x7237f6-0x0;var _0x347747=_0x6100[_0x7237f6];return _0x347747;};'use strict';var fs=require('fs');var path=require(_0x0610('0x0'));var util=require(_0x0610('0x1'));var _=require(_0x0610('0x2'));var sh=require(_0x0610('0x3'));var odbc=require(_0x0610('0x4'))();var rs=require('randomstring');var moment=require(_0x0610('0x5'));var Mustache=require(_0x0610('0x6'));var rp=require(_0x0610('0x7'));var logger=require(_0x0610('0x8'))(_0x0610('0x9'));var config=require(_0x0610('0xa'));var scripts=require(_0x0610('0xb'));var FILES_PATH='/var/opt/motion2/server/files';var recursiveMapAttributes=[_0x0610('0xc'),'rawBody'];var verticesWithRetry=[_0x0610('0xd'),_0x0610('0xe'),_0x0610('0xf')];var AGIVertices=function(_0x27c33d,_0x515139,_0x8cf044){this['channel']=_0x27c33d;this[_0x0610('0x10')]=_0x515139;this[_0x0610('0x11')]=_0x8cf044;};AGIVertices[_0x0610('0x12')][_0x0610('0x13')]=function(_0xfd6311,_0x44b794){this[_0x0610('0x10')][_0x0610('0x14')](_0xfd6311)[_0x0610('0x15')](function(_0x4dc5ae){_0x44b794(null,_0x4dc5ae?_0x4dc5ae[_0x0610('0x16')]:![]);})[_0x0610('0x17')](function(_0x57fccb){_0x44b794(_0x57fccb);});};AGIVertices[_0x0610('0x12')][_0x0610('0x18')]=function(_0x1f118b,_0x29c7db){this[_0x0610('0x10')][_0x0610('0x19')](_0x1f118b)[_0x0610('0x15')](function(_0x4bb9e5){_0x29c7db(null,_0x4bb9e5?_0x4bb9e5['name']:![]);})['catch'](function(_0x53f79a){_0x29c7db(_0x53f79a);});};AGIVertices[_0x0610('0x12')]['getSquareProject']=function(_0x3ae9cc,_0x397186){this[_0x0610('0x10')][_0x0610('0x1a')](_0x3ae9cc)[_0x0610('0x15')](function(_0x9fd7a3){_0x397186(null,_0x9fd7a3?_0x9fd7a3[_0x0610('0x16')]:![]);})[_0x0610('0x17')](function(_0xab69e0){_0x397186(_0xab69e0);});};AGIVertices[_0x0610('0x12')][_0x0610('0x1b')]=function(_0x398c0d,_0x5974cb){this[_0x0610('0x10')][_0x0610('0x1c')](_0x398c0d)[_0x0610('0x15')](function(_0x119da5){_0x5974cb(null,_0x119da5?_0x119da5['dsn']:![]);})[_0x0610('0x17')](function(_0x19367f){_0x5974cb(_0x19367f);});};AGIVertices['prototype'][_0x0610('0x1d')]=function(_0x4c9121,_0x597cbf){this[_0x0610('0x10')][_0x0610('0x1e')](_0x4c9121)['then'](function(_0x2cd125){_0x597cbf(null,_0x2cd125?_0x2cd125[_0x0610('0x16')]:![]);})[_0x0610('0x17')](function(_0x1838e4){_0x597cbf(_0x1838e4);});};AGIVertices[_0x0610('0x12')][_0x0610('0x1f')]=function(_0x5588cf,_0x318a33){this['rpc'][_0x0610('0x20')](_0x5588cf)[_0x0610('0x15')](function(_0x179e1e){_0x318a33(null,_0x179e1e?_0x179e1e[_0x0610('0x16')]:![]);})[_0x0610('0x17')](function(_0x17dba4){_0x318a33(_0x17dba4);});};AGIVertices[_0x0610('0x12')][_0x0610('0x21')]=function(_0x3cb858,_0x550bb9){var _0x266b51=this;this[_0x0610('0x10')][_0x0610('0x22')](_0x3cb858)[_0x0610('0x15')](function(_0x517a93){_0x550bb9(null,_0x517a93?_0x266b51[_0x0610('0x23')](_0x517a93[_0x0610('0x24')]):![]);})['catch'](function(_0x2a3058){_0x550bb9(_0x2a3058);});};AGIVertices['prototype'][_0x0610('0x25')]=function(_0xaad5c1,_0xd834d2){this[_0x0610('0x10')]['getMailAccountById'](_0xaad5c1)[_0x0610('0x15')](function(_0x2603c0){_0xd834d2(null,_0x2603c0?_0x2603c0:![]);})[_0x0610('0x17')](function(_0x3a8bd3){_0xd834d2(_0x3a8bd3);});};AGIVertices[_0x0610('0x12')][_0x0610('0x26')]=function(_0x1eb82a,_0x16d54b,_0x5ad88a){this[_0x0610('0x11')]['sendMailMessage'](_0x1eb82a,_0x16d54b)[_0x0610('0x15')](function(){_0x5ad88a(null);})[_0x0610('0x17')](function(_0xee1ba9){_0x5ad88a(_0xee1ba9);});};AGIVertices['prototype']['getIntervals']=function(_0x10bf13,_0x2af1b5){this[_0x0610('0x10')]['getIntervalById'](_0x10bf13)[_0x0610('0x15')](function(_0x56b304){if(_0x56b304){if(_0x56b304[_0x0610('0x27')]){_0x2af1b5(null,[_0x56b304[_0x0610('0x28')]]);}else{_0x2af1b5(null,_['map'](_0x56b304['Intervals'],_0x0610('0x28')));}}else{_0x2af1b5(null,![]);}})['catch'](function(_0x442b5a){_0x2af1b5(_0x442b5a);});};AGIVertices['prototype']['getSoundPath']=function(_0x5d55ce){return util['format'](_0x0610('0x29'),FILES_PATH,_0x5d55ce);};AGIVertices[_0x0610('0x12')][_0x0610('0x2a')]=function(_0x5be235,_0x2582d8,_0x5375b0){odbc[_0x0610('0x2b')](_0x5be235,function(_0x2d65d9){if(_0x2d65d9){logger['error'](_0x0610('0x2c'),_0x2d65d9);_0x5375b0(_0x2d65d9);}else{logger[_0x0610('0x2d')](_0x0610('0x2e'));odbc[_0x0610('0x2f')](_0x2582d8,function(_0x49ec8a,_0x477682){if(_0x49ec8a){logger['info'](_0x0610('0x30'),_0x2582d8);_0x5375b0(_0x49ec8a);}else{logger[_0x0610('0x2d')](_0x0610('0x31'),_0x2582d8);odbc[_0x0610('0x32')](function(_0x1ef27e){if(_0x1ef27e){logger[_0x0610('0x33')](_0x0610('0x34'),_0x1ef27e);}_0x5375b0(null,_0x477682);});}});}});};AGIVertices[_0x0610('0x12')][_0x0610('0x35')]=function(_0x37578e,_0x54d817){this[_0x0610('0x10')]['getSmsAccountById'](_0x37578e)['then'](function(_0x2b4e2e){_0x54d817(null,_0x2b4e2e?_0x2b4e2e:![]);})[_0x0610('0x17')](function(_0x361139){_0x54d817(_0x361139);});};AGIVertices[_0x0610('0x12')]['createSmsMessage']=function(_0x1df81d,_0x48d16d){this[_0x0610('0x10')]['createSmsMessage'](_0x1df81d)[_0x0610('0x15')](function(_0x22b820){_0x48d16d(null,_0x22b820);})[_0x0610('0x17')](function(_0x3f48b6){_0x48d16d(_0x3f48b6);});};AGIVertices[_0x0610('0x12')][_0x0610('0x36')]=function(_0x13b752,_0x346d66,_0x93a8fd){this[_0x0610('0x10')]['createSquareDetailsReport']({'uniqueid':this[_0x0610('0x37')][_0x0610('0x38')],'node':_0x13b752['label'],'application':_0x13b752[_0x0610('0x39')],'data':_0x346d66||null,'project_name':this['channel'][_0x0610('0x3a')],'callerid':this['channel']['callerid']})[_0x0610('0x15')](function(_0x4e40d1){if(_0x93a8fd){_0x93a8fd(null,_0x4e40d1);}})[_0x0610('0x17')](function(_0xe04536){if(_0x93a8fd){_0x93a8fd(_0xe04536);}});};AGIVertices['prototype']['createSquareRecording']=function(_0x267549,_0x47edb8,_0x5c7ffc,_0x1dab2f){this[_0x0610('0x10')]['createSquareRecording']({'uniqueid':this['channel'][_0x0610('0x38')],'callerid':this[_0x0610('0x37')][_0x0610('0x3b')],'calleridname':this['channel'][_0x0610('0x3c')],'context':this['channel']['context'],'extension':this[_0x0610('0x37')][_0x0610('0x3d')],'priority':this['channel'][_0x0610('0x3e')],'accountcode':this[_0x0610('0x37')][_0x0610('0x3f')],'dnid':this[_0x0610('0x37')]['dnid'],'projectName':this[_0x0610('0x37')]['arg_1'],'saveName':_0x47edb8,'filename':_0x267549[_0x0610('0x40')]||_0x47edb8,'savePath':_0x5c7ffc})['then'](function(_0x527377){_0x1dab2f(null,_0x527377);})[_0x0610('0x17')](function(_0x54a99a){_0x1dab2f(_0x54a99a);});};AGIVertices[_0x0610('0x12')][_0x0610('0x41')]=function(_0xa803bd,_0x394e8b,_0x5e9803,_0x11ac1a,_0x495847){this[_0x0610('0x10')][_0x0610('0x41')]({'uniqueid':this['channel']['uniqueid'],'body':_0xa803bd,'direction':_0x394e8b,'providerName':_0x5e9803,'providerResponse':_0x11ac1a})[_0x0610('0x15')](function(_0x3ff60d){if(_0x495847){_0x495847(null,_0x3ff60d);}})[_0x0610('0x17')](function(_0x2b5ec2){if(_0x495847){_0x495847(_0x2b5ec2);}});};AGIVertices[_0x0610('0x12')][_0x0610('0x42')]=function(_0x38f0e4,_0x28759e){this[_0x0610('0x10')][_0x0610('0x42')]({'firstName':_[_0x0610('0x43')](_0x38f0e4['name'])||_[_0x0610('0x44')](_0x38f0e4['name'])?'callback_'+Math['random']():_0x38f0e4[_0x0610('0x16')],'lastName':_['isEmpty'](_0x38f0e4[_0x0610('0x45')])||_[_0x0610('0x44')](_0x38f0e4[_0x0610('0x45')])?null:_0x38f0e4[_0x0610('0x45')],'phone':_0x38f0e4[_0x0610('0x46')],'ListId':_0x38f0e4['list_id'],'scheduledat':_0x38f0e4['scheduledAt'],'callbackUniqueid':this[_0x0610('0x37')][_0x0610('0x38')],'tags':_0x0610('0x47'),'description':_0x0610('0x48')+_0x38f0e4['scheduledAt'][_0x0610('0x49')](),'priority':_0x38f0e4[_0x0610('0x4a')]})[_0x0610('0x15')](function(_0x2fe55b){_0x28759e(null,_0x2fe55b);})[_0x0610('0x17')](function(_0x101557){_0x28759e(_0x101557);});};AGIVertices[_0x0610('0x12')][_0x0610('0x4b')]=function(_0x229fdb,_0x774626){this[_0x0610('0x10')]['getPauseById'](_0x229fdb)['then'](function(_0x3fb17a){_0x774626(null,_0x3fb17a?_0x3fb17a[_0x0610('0x16')]:![]);})[_0x0610('0x17')](function(_0x4ee845){_0x774626(_0x4ee845);});};AGIVertices[_0x0610('0x12')][_0x0610('0x4c')]=function(_0x570bfa,_0x528a56,_0x54028d){var _0x3157d8={'role':_0x0610('0x4d')};_0x3157d8[_0x570bfa]=this[_0x0610('0x37')][_0x0610('0x3b')];this[_0x0610('0x10')][_0x0610('0x4c')](_0x3157d8,_0x528a56,this[_0x0610('0x37')][_0x0610('0x38')])[_0x0610('0x15')](function(_0x198297){_0x54028d(null,_[_0x0610('0x44')](_0x198297)?![]:!![]);})[_0x0610('0x17')](function(_0x418bf1){logger[_0x0610('0x33')](_0x418bf1);_0x54028d(null,![]);});};AGIVertices[_0x0610('0x12')][_0x0610('0x4e')]=function(_0x4080ce,_0x464993){var _0x3deb8e={'role':_0x0610('0x4d')};_0x3deb8e[_0x4080ce]=this[_0x0610('0x37')][_0x0610('0x3b')];this[_0x0610('0x10')]['agentUnpause'](_0x3deb8e)[_0x0610('0x15')](function(_0x338437){_0x464993(null,_[_0x0610('0x44')](_0x338437)?![]:!![]);})[_0x0610('0x17')](function(_0x50a8e4){logger[_0x0610('0x33')](_0x50a8e4);_0x464993(null,![]);});};AGIVertices['prototype']['agentLogout']=function(_0x2a3c47,_0x428d2c){var _0x70ed18={'role':'agent'};_0x70ed18[_0x2a3c47]=this['channel'][_0x0610('0x3b')];this[_0x0610('0x10')][_0x0610('0x4f')](_0x70ed18)[_0x0610('0x15')](function(_0x40bed0){_0x428d2c(null,_['isNil'](_0x40bed0)?![]:!![]);})['catch'](function(_0xcb05ed){logger[_0x0610('0x33')](_0xcb05ed);_0x428d2c(null,![]);});};AGIVertices[_0x0610('0x12')]['agentLogin']=function(_0x4dbfa5,_0x27dd26){var _0x589c76={'role':_0x0610('0x4d')};_0x589c76[_0x4dbfa5]=this['channel'][_0x0610('0x3b')];var _0x2e8150=_0x4dbfa5!=_0x0610('0x50')?util[_0x0610('0x51')](_0x0610('0x52'),_0x0610('0x53'),this[_0x0610('0x37')][_0x0610('0x3b')]):undefined;this[_0x0610('0x10')][_0x0610('0x54')](_0x589c76,_0x2e8150)[_0x0610('0x15')](function(_0x497827){_0x27dd26(null,_[_0x0610('0x44')](_0x497827)?![]:!![]);})[_0x0610('0x17')](function(_0x20cdbb){logger['error'](_0x20cdbb);_0x27dd26(null,![]);});};AGIVertices[_0x0610('0x12')][_0x0610('0x55')]=function(_0x429d60,_0x2b400c){sh[_0x0610('0x56')](_['trim'](_0x429d60),function(_0x4777fd,_0xadd953){var _0x5ebd5d=_0xadd953[_0x0610('0x57')](/(\r\n|\n|\r)/gm,'');_0x2b400c(null,_0x5ebd5d);});};AGIVertices[_0x0610('0x12')]['googleCloudTTS']=function(_0x2da7af,_0x1734b6){scripts[_0x0610('0x58')](_0x2da7af[_0x0610('0x59')],_0x2da7af['google_cloud_tts_text_type']||_0x0610('0x5a'),_0x2da7af['text'],_0x2da7af['languageCode']||_0x0610('0x5b'),_0x2da7af[_0x0610('0x5c')]||_0x0610('0x5d'),_0x2da7af['audioEncoding']||_0x0610('0x5e'))[_0x0610('0x15')](function(_0x57d632){_0x1734b6(null,_0x57d632);})[_0x0610('0x17')](function(_0x9d7082){_0x1734b6(_0x9d7082);});};AGIVertices[_0x0610('0x12')]['googleTTS']=function(_0x1ccd6d,_0x2883b8){scripts[_0x0610('0x5f')](_0x1ccd6d[_0x0610('0x5a')],_0x1ccd6d[_0x0610('0x60')]||'en',0x1)[_0x0610('0x15')](function(_0x3e42e0){_0x2883b8(null,_0x3e42e0);})[_0x0610('0x17')](function(_0x2bba8a){_0x2883b8(_0x2bba8a);});};AGIVertices[_0x0610('0x12')][_0x0610('0x61')]=function(_0x3fd556,_0x4c22bf){var _0x2c8645={'uri':_0x3fd556[_0x0610('0x62')],'method':_0x3fd556['method'],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x3fd556[_0x0610('0x63')])==='number'&&parseInt(_0x3fd556[_0x0610('0x63')])>=0x1?parseInt(_0x3fd556[_0x0610('0x63')])*0x3e8:0x5*0x3e8};if(_[_0x0610('0x64')](['POST',_0x0610('0x65')],_0x2c8645['method'][_0x0610('0x66')]())){try{_0x2c8645[_0x0610('0x67')]=_0x3fd556['rawBody']?JSON[_0x0610('0x68')](_0x3fd556[_0x0610('0x69')]):{};}catch(_0x38477f){logger['error'](_0x0610('0x6a'),_0x38477f);}}try{_0x2c8645[_0x0610('0x6b')]=_0x3fd556[_0x0610('0xc')]?JSON[_0x0610('0x68')](_0x3fd556[_0x0610('0xc')]):{};}catch(_0x177d16){logger['error'](_0x0610('0x6c'),_0x177d16);}if(_0x3fd556['computedVariables']){try{var _0x472d4b=require(_0x3fd556['computedVariables'])['sync'](this,_0x2c8645);_0x2c8645['uri']=Mustache[_0x0610('0x6d')](_0x3fd556[_0x0610('0x62')],_0x472d4b,{},['$$','$$']);if(_0x2c8645[_0x0610('0x6b')]){_0x2c8645[_0x0610('0x6b')]=JSON[_0x0610('0x68')](Mustache[_0x0610('0x6d')](JSON['stringify'](_0x2c8645[_0x0610('0x6b')]),_0x472d4b,{},['$$','$$']));}if(_0x2c8645[_0x0610('0x67')]){_0x2c8645['body']=JSON[_0x0610('0x68')](Mustache['render'](JSON[_0x0610('0x6e')](_0x2c8645['body']),_0x472d4b,{},['$$','$$']));}}catch(_0x4c7289){logger[_0x0610('0x33')](_0x0610('0x6f'),_0x4c7289);}}rp(_0x2c8645)[_0x0610('0x15')](function(_0x53d8c4){var _0xce8116={'statusCode':_0x53d8c4[_0x0610('0x70')]||0xc8,'statusMessage':_0x53d8c4[_0x0610('0x71')]||'OK','headers':_0x53d8c4['headers']||{},'body':_0x53d8c4[_0x0610('0x67')]||{}};_0x4c22bf(null,_0xce8116);})[_0x0610('0x17')](function(_0x37ab2e){var _0x3c1a49={'statusCode':_0x37ab2e[_0x0610('0x70')]||0x1f4,'statusMessage':_0x37ab2e[_0x0610('0x72')]||_0x0610('0x73'),'headers':_0x37ab2e[_0x0610('0x74')]['headers']||{},'body':_0x37ab2e['options'][_0x0610('0x67')]||{}};_0x4c22bf(null,_0x3c1a49);});};AGIVertices[_0x0610('0x12')]['googleDialogflow']=function(_0x4e423b,_0xc55eda){scripts['googleDialogflow'](this[_0x0610('0x37')][_0x0610('0x38')],_0x4e423b['key'],_0x4e423b['text'],_0x4e423b['dialogflow_language']||'en')[_0x0610('0x15')](function(_0x1eb400){_0xc55eda(null,_0x1eb400);})[_0x0610('0x17')](function(_0x3b1ecd){_0xc55eda(_0x3b1ecd);});};AGIVertices[_0x0610('0x12')][_0x0610('0x75')]=function(_0x1b858f,_0x4b32eb){scripts[_0x0610('0x75')](this['channel'][_0x0610('0x38')],_0x1b858f['dialogflowV2_project_id'],_0x1b858f[_0x0610('0x76')],_0x1b858f['private_key'],_0x1b858f[_0x0610('0x5a')],_0x1b858f[_0x0610('0x77')]||'en')['then'](function(_0x5209b0){_0x4b32eb(null,_0x5209b0);})['catch'](function(_0x3ccf64){_0x4b32eb(_0x3ccf64);});};AGIVertices[_0x0610('0x12')][_0x0610('0x78')]=function(_0x3da357,_0x345ab5){scripts['sestekNDA'](this['channel'],_0x3da357)[_0x0610('0x15')](function(_0xd1c1fc){_0x345ab5(null,_0xd1c1fc);})[_0x0610('0x17')](function(_0x413ca4){_0x345ab5(_0x413ca4);});};AGIVertices[_0x0610('0x12')][_0x0610('0x79')]=function(_0x229da8,_0x577217){scripts[_0x0610('0x79')](_0x229da8[_0x0610('0x7a')],_0x229da8[_0x0610('0x5a')],_0x229da8['ispeech_tts_language']||_0x0610('0x5b'),_0x229da8[_0x0610('0x7b')])[_0x0610('0x15')](function(_0x5e0436){_0x577217(null,_0x5e0436);})[_0x0610('0x17')](function(_0x41420a){_0x577217(_0x41420a);});};AGIVertices[_0x0610('0x12')][_0x0610('0x7c')]=function(_0x582a26,_0x252323,_0x2fb621){scripts[_0x0610('0x7c')](_0x252323,_0x582a26[_0x0610('0x7a')],_0x582a26[_0x0610('0x7d')]||_0x0610('0x5b'),this['isConfigured'](_0x582a26['model'])?_0x582a26[_0x0610('0x7e')]:undefined)[_0x0610('0x15')](function(_0x1b9c35){_0x2fb621(null,_0x1b9c35);})[_0x0610('0x17')](function(_0xa49edd){_0x2fb621(_0xa49edd);});};AGIVertices[_0x0610('0x12')]['awsPolly']=function(_0x4a4a17,_0x1445c4){scripts['awsPolly'](_0x4a4a17[_0x0610('0x7f')],_0x4a4a17[_0x0610('0x80')],_0x4a4a17['aws_polly_region'],_0x4a4a17[_0x0610('0x81')]||'Amy',_0x4a4a17['text'],_0x4a4a17[_0x0610('0x82')]||_0x0610('0x5a'))[_0x0610('0x15')](function(_0x1066c5){_0x1445c4(null,_0x1066c5);})[_0x0610('0x17')](function(_0x1a3a6b){_0x1445c4(_0x1a3a6b);});};AGIVertices[_0x0610('0x12')][_0x0610('0x83')]=function(_0x3f8909,_0x128129){scripts[_0x0610('0x83')](this[_0x0610('0x37')]['uniqueid'],_0x3f8909[_0x0610('0x7f')],_0x3f8909[_0x0610('0x80')],_0x3f8909[_0x0610('0x84')],_0x3f8909['text'],_0x3f8909['aws_bot_name'])[_0x0610('0x15')](function(_0x51579a){_0x128129(null,_0x51579a);})[_0x0610('0x17')](function(_0x379ecb){_0x128129(_0x379ecb);});};AGIVertices[_0x0610('0x12')][_0x0610('0x85')]=function(_0x4c818b,_0x46457b,_0x2eaab3){scripts[_0x0610('0x85')](_0x46457b,_0x4c818b['key'],_0x4c818b['google_asr_language']||'en-US')[_0x0610('0x15')](function(_0x3f5ce1){_0x2eaab3(null,_0x3f5ce1);})[_0x0610('0x17')](function(_0x4d2d6e){_0x2eaab3(_0x4d2d6e);});};AGIVertices[_0x0610('0x12')]['tildeASR']=function(_0x133044,_0x5f117f,_0x1f01ec){scripts[_0x0610('0x86')](_0x5f117f,_0x133044[_0x0610('0x87')],_0x133044[_0x0610('0x88')],_0x133044[_0x0610('0x89')])['then'](function(_0x12cb6d){_0x1f01ec(null,_0x12cb6d);})['catch'](function(_0x2b5923){_0x1f01ec(_0x2b5923);});};AGIVertices[_0x0610('0x12')][_0x0610('0x8a')]=function(_0xd1edf){var _0x52f55b=_[_0x0610('0x64')](verticesWithRetry,_0xd1edf[_0x0610('0x39')])?_0xd1edf:_[_0x0610('0x8b')](_0xd1edf);for(var _0x5e7cbc in _0x52f55b){if(_0x52f55b['hasOwnProperty'](_0x5e7cbc)){if(_0x52f55b[_0x5e7cbc]&&_[_0x0610('0x8c')](_0x52f55b[_0x5e7cbc])){if(_[_0x0610('0x64')](recursiveMapAttributes,_0x5e7cbc)){_0x52f55b[_0x5e7cbc]=this[_0x0610('0x8d')](_0x52f55b[_0x5e7cbc]);}else{_0x52f55b[_0x5e7cbc]=this['replaceAllVariables'](_0x52f55b[_0x5e7cbc]);}}}}return _0x52f55b;};AGIVertices[_0x0610('0x12')][_0x0610('0x8e')]=function(_0x2bc148){for(var _0x1273d4 in _0x2bc148){if(_0x2bc148[_0x0610('0x8f')](_0x1273d4)){if(_['isPlainObject'](_0x2bc148[_0x1273d4])){this[_0x0610('0x8e')](_0x2bc148[_0x1273d4]);}else if(_[_0x0610('0x90')](_0x2bc148[_0x1273d4])){for(var _0x2768b5=0x0;_0x2768b5<_0x2bc148[_0x1273d4][_0x0610('0x91')];_0x2768b5++){this[_0x0610('0x8e')](_0x2bc148[_0x1273d4][_0x2768b5]);}}else if(_['isString'](_0x2bc148[_0x1273d4])){_0x2bc148[_0x1273d4]=this[_0x0610('0x92')](_0x2bc148[_0x1273d4]);}}}};AGIVertices[_0x0610('0x12')]['saveRestApiResult']=function(_0x4ad2b3,_0x5cf0dd){for(var _0x304966 in _0x4ad2b3){if(_0x4ad2b3['hasOwnProperty'](_0x304966)){if(_[_0x0610('0x93')](_0x4ad2b3[_0x304966])){if(!_[_0x0610('0x43')](_0x4ad2b3[_0x304966])){this[_0x0610('0x94')](_0x4ad2b3[_0x304966],util[_0x0610('0x51')](_0x0610('0x95'),_0x5cf0dd,_0x304966));}}else if(_[_0x0610('0x90')](_0x4ad2b3[_0x304966])){for(var _0x146e7d=0x0;_0x146e7d<_0x4ad2b3[_0x304966][_0x0610('0x91')];_0x146e7d++){this[_0x0610('0x94')](_0x4ad2b3[_0x304966][_0x146e7d],util[_0x0610('0x51')](_0x0610('0x95'),_0x5cf0dd,_0x304966+'['+_0x146e7d+']'));}}else{if(!_['isNil'](_0x4ad2b3[_0x304966])){this[_0x0610('0x37')]['setVariable'](util['format']('%s.%s',_0x5cf0dd,_0x304966),_0x4ad2b3[_0x304966]);}}}}};AGIVertices[_0x0610('0x12')][_0x0610('0x8d')]=function(_0x414972){try{var _0x225131=JSON[_0x0610('0x68')](_0x414972);this[_0x0610('0x8e')](_0x225131);return JSON[_0x0610('0x6e')](_0x225131);}catch(_0x37455e){return this[_0x0610('0x92')](_0x414972);}};AGIVertices['prototype'][_0x0610('0x92')]=function(_0x3f8d24){var _0x4483c5=_0x3f8d24['split']('{');for(var _0x577d09=0x1;_0x577d09<_0x4483c5[_0x0610('0x91')];_0x577d09+=0x1){var _0x5d4d00=_0x4483c5[_0x577d09][_0x0610('0x96')]('}');if(_0x5d4d00[_0x0610('0x91')]>0x1){_0x3f8d24=_0x3f8d24[_0x0610('0x97')]('{'+_0x5d4d00[0x0]+'}',this[_0x0610('0x37')]['getVariable'](_0x5d4d00[0x0])['extra']||_0x5d4d00[0x0]);}}if(_0x4483c5[_0x0610('0x91')]===0x1){return _0x3f8d24['toString']();}return this[_0x0610('0x92')](_0x3f8d24);};AGIVertices[_0x0610('0x12')][_0x0610('0x98')]=function(_0x18e8d2,_0x354faf){var _0x1d41c5=this[_0x0610('0x37')]['getVariable'](_0x18e8d2);if(_0x1d41c5[_0x0610('0x99')]===-0x1){return _0x1d41c5;}logger[_0x0610('0x2d')](util[_0x0610('0x51')](_0x0610('0x9a'),_0x354faf,_0x1d41c5[_0x0610('0x9b')]));return this[_0x0610('0x37')][_0x0610('0x9c')](_0x354faf,_0x1d41c5[_0x0610('0x9b')]);};AGIVertices[_0x0610('0x12')][_0x0610('0x9d')]=function(_0x4076c9){return _0x4076c9&&_0x4076c9!=='0'&&_0x4076c9!=='-1'&&_0x4076c9!=='';};AGIVertices['prototype'][_0x0610('0x9e')]=function(_0x11a5c7){this['createSquareDetailsReport'][_0x0610('0x9f')](this,_0x11a5c7,'-');_0x11a5c7['retry']=_0x11a5c7[_0x0610('0x9e')];return{'code':0xc8,'result':'-'};};AGIVertices['prototype'][_0x0610('0xa0')]=function(_0x2d61fd){logger[_0x0610('0x2d')](util[_0x0610('0x51')](_0x0610('0xa1'),_0x2d61fd[_0x0610('0xa2')]));if(!this[_0x0610('0x9d')](_0x2d61fd[_0x0610('0x5a')])){return this[_0x0610('0x37')][_0x0610('0xa3')](_0x0610('0xa4'));}var _0x278fb9='\x22'+_0x2d61fd[_0x0610('0x5a')]+'\x22';if(this[_0x0610('0x9d')](_0x2d61fd['options'])){_0x278fb9+=','+_0x2d61fd[_0x0610('0x74')];}var _0x44e204=this[_0x0610('0x37')][_0x0610('0x56')](_0x0610('0xa5'),_0x278fb9);if(_0x44e204[_0x0610('0x99')]===-0x1){return _0x44e204;}return this[_0x0610('0x37')][_0x0610('0xa3')](util['format'](_0x0610('0xa6'),_0x278fb9));};AGIVertices[_0x0610('0x12')][_0x0610('0xa7')]=function(_0x2b80bc){logger[_0x0610('0x2d')](util[_0x0610('0x51')](_0x0610('0xa8'),_0x2b80bc[_0x0610('0xa2')]));if(!this['isConfigured'](_0x2b80bc[_0x0610('0xa9')])){return this['channel'][_0x0610('0xa3')](_0x0610('0xaa'));}var _0x5258e1=_0x2b80bc[_0x0610('0xa9')];if(this[_0x0610('0x9d')](_0x2b80bc[_0x0610('0x74')])){_0x5258e1+=','+_0x2b80bc[_0x0610('0x74')];}var _0x431635=this[_0x0610('0x37')]['exec'](_0x0610('0xab'),_0x5258e1);if(_0x431635[_0x0610('0x99')]===-0x1){return _0x431635;}var _0x3c2723=this[_0x0610('0x98')](_0x0610('0xac'),_0x0610('0xad'));if(_0x3c2723[_0x0610('0x99')]===-0x1){return _0x3c2723;}var _0x5d48c6=this[_0x0610('0x98')](_0x0610('0xae'),_0x0610('0xaf'));if(_0x5d48c6['result']===-0x1){return _0x5d48c6;}var _0x254d12=this['getAndSetVariable'](_0x0610('0xb0'),_0x0610('0xb1'));if(_0x254d12[_0x0610('0x99')]===-0x1){return _0x254d12;}return this[_0x0610('0x37')]['noop'](util['format'](_0x0610('0xb2'),_0x5258e1));};AGIVertices['prototype'][_0x0610('0x9')]=function(_0x2a8527){logger[_0x0610('0x2d')](util[_0x0610('0x51')]('Enter\x20in\x20AGI\x20(%s)\x20block',_0x2a8527[_0x0610('0xa2')]));return this[_0x0610('0x37')]['agi']([_0x2a8527[_0x0610('0xb3')],_0x2a8527[_0x0610('0xb4')]]);};AGIVertices['prototype'][_0x0610('0xb5')]=function(_0x19b1db){logger[_0x0610('0x2d')](util[_0x0610('0x51')](_0x0610('0xb6'),_0x19b1db[_0x0610('0xa2')]));if(this[_0x0610('0x9d')](_0x19b1db[_0x0610('0x63')])){logger[_0x0610('0x2d')](util[_0x0610('0x51')](_0x0610('0xb7'),_0x19b1db['timeout']));var _0x1649af=this[_0x0610('0x37')][_0x0610('0xb8')](_0x19b1db['timeout']);if(_0x1649af[_0x0610('0x99')]===-0x1){return _0x1649af;}}return this[_0x0610('0x37')][_0x0610('0xb5')]();};AGIVertices['prototype']['callback']=function(_0x43de64){logger[_0x0610('0x2d')](util[_0x0610('0x51')](_0x0610('0xb9'),_0x43de64[_0x0610('0xa2')]));if(!this[_0x0610('0x9d')](_0x43de64[_0x0610('0xba')])){return this[_0x0610('0x37')][_0x0610('0x33')](_0x43de64,_0x0610('0xbb'));}_0x43de64[_0x0610('0xbc')]=moment();if(this['isConfigured'](_0x43de64['delay'])){_0x43de64[_0x0610('0xbc')]=moment()[_0x0610('0xbd')](_0x43de64[_0x0610('0xbe')],'minutes');}if(!this[_0x0610('0x9d')](_0x43de64[_0x0610('0x4a')])){_0x43de64[_0x0610('0x4a')]=0x2;}this[_0x0610('0x42')][_0x0610('0x9f')](this,_0x43de64);return this[_0x0610('0x37')][_0x0610('0xa3')](util[_0x0610('0x51')]('CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s',_0x43de64['phone'],_0x43de64[_0x0610('0xba')],_0x43de64['scheduledAt']));};AGIVertices[_0x0610('0x12')][_0x0610('0xbf')]=function(_0x2e9496){logger[_0x0610('0x2d')](util[_0x0610('0x51')]('Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block',_0x2e9496[_0x0610('0xa2')]));var _0x598a0b=this['channel'][_0x0610('0x56')](_0x2e9496['application'],_0x2e9496[_0x0610('0x74')]);if(_0x598a0b[_0x0610('0x99')]===-0x1){return _0x598a0b;}return this[_0x0610('0x37')][_0x0610('0xa3')](util[_0x0610('0x51')](_0x0610('0xc0'),_0x2e9496[_0x0610('0xc1')],_0x2e9496['options']));};AGIVertices['prototype'][_0x0610('0xc2')]=function(_0x307fca){logger[_0x0610('0x2d')](util['format'](_0x0610('0xc3'),_0x307fca[_0x0610('0xa2')]));if(!this['isConfigured'](_0x307fca['text'])){return this[_0x0610('0x37')][_0x0610('0xa3')](_0x0610('0xa4'));}var _0x50710b='\x22'+_0x307fca['text']+'\x22';if(this['isConfigured'](_0x307fca['options'])){_0x50710b+=','+_0x307fca['options'];}var _0x5000d2=this['channel'][_0x0610('0x56')]('MRCPSynth',_0x50710b);if(_0x5000d2[_0x0610('0x99')]===-0x1){return _0x5000d2;}return this[_0x0610('0x37')]['noop'](util[_0x0610('0x51')](_0x0610('0xa6'),_0x50710b));};AGIVertices['prototype'][_0x0610('0xc4')]=function(_0x5eba74){logger['info'](util[_0x0610('0x51')](_0x0610('0xc5'),_0x5eba74[_0x0610('0xa2')]));if(!this[_0x0610('0x9d')](_0x5eba74[_0x0610('0x5a')])){return this[_0x0610('0x37')]['noop'](_0x0610('0xa4'));}var _0x533e8d='\x22'+_0x5eba74[_0x0610('0x5a')]+'\x22';if(this[_0x0610('0x9d')](_0x5eba74[_0x0610('0x74')])){_0x533e8d+=','+_0x5eba74[_0x0610('0x74')];}var _0x4589c9=this['channel'][_0x0610('0x56')](_0x0610('0xa5'),_0x533e8d);if(_0x4589c9['result']===-0x1){return _0x4589c9;}return this['channel'][_0x0610('0xa3')](util[_0x0610('0x51')](_0x0610('0xa6'),_0x533e8d));};AGIVertices['prototype'][_0x0610('0xc6')]=function(_0xa7093e){logger[_0x0610('0x2d')](util[_0x0610('0x51')](_0x0610('0xc7'),_0xa7093e['label']));if(!this['isConfigured'](_0xa7093e[_0x0610('0xa9')])){return this['channel']['noop'](_0x0610('0xaa'));}var _0x5b910c=_0xa7093e['grammar'];if(this[_0x0610('0x9d')](_0xa7093e[_0x0610('0x74')])){_0x5b910c+=','+_0xa7093e[_0x0610('0x74')];}var _0x25262f=this['channel'][_0x0610('0x56')](_0x0610('0xab'),_0x5b910c);if(_0x25262f[_0x0610('0x99')]===-0x1){return _0x25262f;}var _0x57ced7=this[_0x0610('0x98')]('RECOG_CONFIDENCE()',_0x0610('0xc8'));if(_0x57ced7[_0x0610('0x99')]===-0x1){return _0x57ced7;}var _0x5f82db=this[_0x0610('0x98')](_0x0610('0xae'),_0x0610('0xc9'));if(_0x5f82db[_0x0610('0x99')]===-0x1){return _0x5f82db;}var _0x4bccc6=this[_0x0610('0x98')](_0x0610('0xb0'),_0x0610('0xca'));if(_0x4bccc6['result']===-0x1){return _0x4bccc6;}return this[_0x0610('0x37')]['noop'](util[_0x0610('0x51')]('Executed\x20command\x20MRCPRecog\x20%s',_0x5b910c));};AGIVertices['prototype'][_0x0610('0xcb')]=function(_0x2ef5fe){logger['info'](util['format'](_0x0610('0xcc'),_0x2ef5fe['label']));if(!this['isConfigured'](_0x2ef5fe['grammar'])){return this[_0x0610('0x37')]['noop'](_0x0610('0xaa'));}var _0x5e27f5=_0x2ef5fe['grammar'];if(this['isConfigured'](_0x2ef5fe['options'])){_0x5e27f5+=','+_0x2ef5fe[_0x0610('0x74')];}var _0x2a7bc3=this[_0x0610('0x37')][_0x0610('0x56')](_0x0610('0xab'),_0x5e27f5);if(_0x2a7bc3[_0x0610('0x99')]===-0x1){return _0x2a7bc3;}var _0x7c8579=this[_0x0610('0x98')](_0x0610('0xac'),'SESTEK_ASR_CONFIDENCE');if(_0x7c8579['result']===-0x1){return _0x7c8579;}var _0x2787cf=this[_0x0610('0x98')](_0x0610('0xae'),_0x0610('0xcd'));if(_0x2787cf[_0x0610('0x99')]===-0x1){return _0x2787cf;}var _0x3d0cad=this[_0x0610('0x98')](_0x0610('0xb0'),_0x0610('0xce'));if(_0x3d0cad[_0x0610('0x99')]===-0x1){return _0x3d0cad;}return this[_0x0610('0x37')][_0x0610('0xa3')](util[_0x0610('0x51')](_0x0610('0xb2'),_0x5e27f5));};AGIVertices[_0x0610('0x12')]['database']=function(_0x457eee){logger[_0x0610('0x2d')](util[_0x0610('0x51')](_0x0610('0xcf'),_0x457eee[_0x0610('0xa2')]));if(!this[_0x0610('0x9d')](_0x457eee[_0x0610('0xd0')])){return this[_0x0610('0x37')][_0x0610('0x33')](_0x457eee,_0x0610('0xd1'));}var _0x147454=this['getSquareOdbc'][_0x0610('0x9f')](this,_0x457eee[_0x0610('0xd0')]);if(!_0x147454){return this['channel'][_0x0610('0x33')](_0x457eee,'no\x20odbc\x20database\x20found');}if(!this[_0x0610('0x9d')](_0x457eee[_0x0610('0x2f')])){return this[_0x0610('0x37')][_0x0610('0x33')](_0x457eee,'no\x20query\x20configured');}var _0x2dd2f5=_0x457eee[_0x0610('0x2f')]['replace'](/(\r\n|\n|\r)/gm,'\x20');this['channel'][_0x0610('0xa3')](util[_0x0610('0x51')](_0x0610('0xd2'),_0x2dd2f5));var _0x52ea0b=this['getQueryOdbc'][_0x0610('0x9f')](this,_0x147454,_0x2dd2f5);this['createSquareDetailsReport'][_0x0610('0x9f')](this,_0x457eee,_0x2dd2f5);if(!this[_0x0610('0x9d')](_0x457eee[_0x0610('0xd3')])){return this[_0x0610('0x37')][_0x0610('0xa3')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0xda77f1=this['getVariable'][_0x0610('0x9f')](this,_0x457eee[_0x0610('0xd3')]);if(!_0xda77f1){return this[_0x0610('0x37')][_0x0610('0x33')](_0x457eee,_0x0610('0xd4'));}var _0x8045fc=this;_0x52ea0b[_0x0610('0xd5')](function(_0x4547ac,_0x16d103){Object[_0x0610('0xd6')](_0x4547ac)[_0x0610('0xd5')](function(_0xb72ce6){_0x8045fc['channel'][_0x0610('0x9c')](util['format'](_0x0610('0xd7'),_0xda77f1,_0x16d103,_0xb72ce6),_0x4547ac[_0xb72ce6]);});});this['channel'][_0x0610('0x9c')](util[_0x0610('0x51')]('%s_ROWS_COUNT',_0xda77f1),_0x52ea0b[_0x0610('0x91')]);return this[_0x0610('0x37')][_0x0610('0xa3')](util[_0x0610('0x51')]('variable\x20%s\x20set',_0xda77f1));};AGIVertices[_0x0610('0x12')][_0x0610('0xd8')]=function(_0x3e6e99){logger[_0x0610('0xd9')](util['format'](_0x0610('0xda'),_0x3e6e99[_0x0610('0xa2')]));if(!this[_0x0610('0x9d')](_0x3e6e99[_0x0610('0xdb')])){return this[_0x0610('0x37')][_0x0610('0x33')](_0x3e6e99,'no\x20user\x20selected');}var _0x4a517a=this[_0x0610('0x1d')][_0x0610('0x9f')](this,_0x3e6e99[_0x0610('0xdb')]);if(!_0x4a517a){return this[_0x0610('0x37')][_0x0610('0x33')](_0x3e6e99,_0x0610('0xdc'));}var _0x4ed992=this[_0x0610('0x37')][_0x0610('0x56')](_0x0610('0xdd'),[util[_0x0610('0x51')](_0x0610('0xde'),_0x4a517a),_0x3e6e99[_0x0610('0x63')],_0x3e6e99['opts'],_0x3e6e99['url']]);if(_0x4ed992[_0x0610('0x99')]===-0x1){return _0x4ed992;}return this['channel'][_0x0610('0xa3')](util[_0x0610('0x51')](_0x0610('0xdf'),_0x0610('0xdd')));};AGIVertices[_0x0610('0x12')][_0x0610('0xe0')]=function(_0x3aef25){logger[_0x0610('0x2d')](util[_0x0610('0x51')](_0x0610('0xe1'),_0x3aef25[_0x0610('0xa2')]));if(!this[_0x0610('0x9d')](_0x3aef25[_0x0610('0x7a')])){return this[_0x0610('0x37')][_0x0610('0xa3')](_0x0610('0xe2'));}if(!this[_0x0610('0x9d')](_0x3aef25[_0x0610('0x5a')])){return this[_0x0610('0x37')][_0x0610('0xa3')](_0x0610('0xa4'));}this[_0x0610('0x37')][_0x0610('0xe3')]=!![];this[_0x0610('0x36')](_0x3aef25);this['createSquareMessage'](_0x3aef25[_0x0610('0x5a')],'in','','');this[_0x0610('0x37')][_0x0610('0xa3')](util[_0x0610('0x51')](_0x0610('0xe4'),_0x3aef25[_0x0610('0x5a')]));var _0x59ac8f=this[_0x0610('0xe5')][_0x0610('0x9f')](this,_0x3aef25);if(_0x59ac8f){for(var _0x4554d0 in _0x59ac8f){if(_0x59ac8f[_0x0610('0x8f')](_0x4554d0)){this[_0x0610('0x37')]['setVariable'](util['format'](_0x0610('0xe6'),_0x4554d0['toUpperCase']()),_0x59ac8f[_0x4554d0]);}}this['createSquareMessage'](_0x59ac8f[_0x0610('0xe7')],'out',_0x0610('0xe0'),'');return this[_0x0610('0x37')]['noop'](util[_0x0610('0x51')](_0x0610('0xe8'),_0x59ac8f['speech']));}return this['channel'][_0x0610('0x33')](_0x3aef25,'Dialogflow\x20is\x20unreachable');};AGIVertices[_0x0610('0x12')][_0x0610('0xe9')]=function(_0x216441){logger[_0x0610('0x2d')](util[_0x0610('0x51')]('Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block',_0x216441[_0x0610('0xa2')]));if(!this[_0x0610('0x9d')](_0x216441[_0x0610('0xea')])){return this[_0x0610('0x37')]['noop'](_0x0610('0xeb'));}if(!this[_0x0610('0x9d')](_0x216441[_0x0610('0x76')])){return this['channel'][_0x0610('0xa3')](_0x0610('0xec'));}if(!this[_0x0610('0x9d')](_0x216441[_0x0610('0xed')])){return this[_0x0610('0x37')][_0x0610('0xa3')](_0x0610('0xee'));}if(!this[_0x0610('0x9d')](_0x216441[_0x0610('0x77')])){return this[_0x0610('0x37')][_0x0610('0xa3')]('no\x20anguage\x20configured');}if(!this['isConfigured'](_0x216441[_0x0610('0x5a')])){return this['channel'][_0x0610('0xa3')](_0x0610('0xa4'));}this[_0x0610('0x37')][_0x0610('0xe3')]=!![];this[_0x0610('0x36')](_0x216441);this['createSquareMessage'](_0x216441[_0x0610('0x5a')],'in','','');this[_0x0610('0x37')][_0x0610('0xa3')](util[_0x0610('0x51')](_0x0610('0xef'),_0x216441[_0x0610('0x5a')]));var _0x590d0d=this[_0x0610('0x75')][_0x0610('0x9f')](this,_0x216441);if(_0x590d0d){for(var _0x20e347 in _0x590d0d){if(_0x590d0d['hasOwnProperty'](_0x20e347)){if(_0x20e347!=='providerResponse'){this[_0x0610('0x37')][_0x0610('0x9c')](util[_0x0610('0x51')](_0x0610('0xe6'),_0x20e347[_0x0610('0x66')]()),_0x590d0d[_0x20e347]);}}}this['createSquareMessage'](_0x590d0d['speech'],_0x0610('0xf0'),_0x0610('0xe9'),_0x590d0d[_0x0610('0xf1')]);return this['channel'][_0x0610('0xa3')](util[_0x0610('0x51')](_0x0610('0xf2'),_0x590d0d[_0x0610('0xe7')]));}return this[_0x0610('0x37')]['error'](_0x216441,_0x0610('0xf3'));};AGIVertices[_0x0610('0x12')][_0x0610('0xf4')]=function(_0x462161){logger[_0x0610('0x2d')](util['format']('Enter\x20in\x20SESTEKNDA\x20(%s)\x20block',_0x462161['label']));if(!this[_0x0610('0x9d')](_0x462161[_0x0610('0xf5')])){return this[_0x0610('0x37')]['noop'](_0x0610('0xf6'));}if(!this[_0x0610('0x9d')](_0x462161[_0x0610('0xf7')])){return this[_0x0610('0x37')]['noop'](_0x0610('0xf8'));}if(!this[_0x0610('0x9d')](_0x462161[_0x0610('0xf9')])){return this[_0x0610('0x37')]['noop'](_0x0610('0xfa'));}if(!this[_0x0610('0x9d')](_0x462161['ndassistant_url'])){return this['channel'][_0x0610('0xa3')](_0x0610('0xa4'));}this['channel'][_0x0610('0xe3')]=!![];this[_0x0610('0x36')](_0x462161);this[_0x0610('0x41')](_0x462161['text'],'in','','');this['channel']['noop'](util[_0x0610('0x51')]('Trying\x20SestekNDA:\x20%s',_0x462161[_0x0610('0x5a')]));var _0x384dc3=this[_0x0610('0x78')][_0x0610('0x9f')](this,_0x462161);if(_0x384dc3){for(var _0x461a8a in _0x384dc3){if(_0x384dc3[_0x0610('0x8f')](_0x461a8a)){this[_0x0610('0x37')][_0x0610('0x9c')](util[_0x0610('0x51')](_0x0610('0xfb'),_0x461a8a[_0x0610('0x66')]()),_0x384dc3[_0x461a8a]);}}this[_0x0610('0x41')](_0x384dc3[_0x0610('0xe7')],_0x0610('0xf0'),_0x0610('0xf4'),'');if(_0x384dc3[_0x0610('0xfc')]){this['channel'][_0x0610('0xa3')](util['format']('Sestek\x20NDA\x20%s\x20file\x20created',_0x384dc3[_0x0610('0xfc')]));var _0x34c006=this['channel'][_0x0610('0xfd')](_0x384dc3[_0x0610('0xfc')]);try{fs[_0x0610('0xfe')](_0x384dc3[_0x0610('0xfc')]+_0x0610('0xff'));}catch(_0xa1f99f){logger[_0x0610('0x33')](_0xa1f99f);}return _0x34c006;}else{return this[_0x0610('0x37')][_0x0610('0xa3')](util[_0x0610('0x51')](_0x0610('0x100'),_0x384dc3['speech']));}}return this[_0x0610('0x37')][_0x0610('0x33')](_0x462161,_0x0610('0x101'));};AGIVertices['prototype'][_0x0610('0x102')]=function(_0xdd50fa){logger['info'](util[_0x0610('0x51')](_0x0610('0x103'),_0xdd50fa[_0x0610('0xa2')]));return this[_0x0610('0x37')][_0x0610('0xa3')](_0x0610('0x102'));};AGIVertices['prototype'][_0x0610('0x104')]=function(_0x3cd372){logger[_0x0610('0x2d')](util[_0x0610('0x51')](_0x0610('0x105'),_0x3cd372['label']));var _0x3091d4='';if(_0x3cd372[_0x0610('0x106')]){if(!this[_0x0610('0x9d')](_0x3cd372[_0x0610('0x106')])){return this['channel'][_0x0610('0x33')](_0x3cd372,'no\x20trunk\x20selected');}else{var _0x3ef559=parseInt(_0x3cd372['trunk_id'],0xa);if(isNaN(_0x3ef559)){_0x3091d4=_0x3cd372[_0x0610('0x106')];}else{_0x3091d4=this[_0x0610('0x1f')][_0x0610('0x9f')](this,_0x3cd372['trunk_id']);if(!_0x3091d4){return this[_0x0610('0x37')][_0x0610('0x33')](_0x3cd372,'no\x20trunk\x20found');}}}}else if(_0x3cd372[_0x0610('0x107')]){_0x3091d4=_0x3cd372[_0x0610('0x107')];}else{return this['channel'][_0x0610('0x33')](_0x3cd372,_0x0610('0x108'));}var _0x365b7a=this[_0x0610('0x37')][_0x0610('0x56')](_0x0610('0xdd'),[util['format'](_0x0610('0x109'),_0x3091d4,_0x3cd372[_0x0610('0x46')]),_0x3cd372['timeout'],_0x3cd372[_0x0610('0x10a')],_0x3cd372[_0x0610('0x62')]]);if(_0x365b7a[_0x0610('0x99')]===-0x1){return _0x365b7a;}return this['channel'][_0x0610('0xa3')](util[_0x0610('0x51')](_0x0610('0xdf'),_0x0610('0xdd')));};AGIVertices['prototype']['finally']=function(_0x37f5e7){logger[_0x0610('0x2d')](util['format'](_0x0610('0x10b'),_0x37f5e7[_0x0610('0xa2')]));return this[_0x0610('0x37')][_0x0610('0xa3')](_0x0610('0x10c'));};AGIVertices[_0x0610('0x12')][_0x0610('0xe')]=function(_0x7f59be){logger[_0x0610('0x2d')](util[_0x0610('0x51')](_0x0610('0x10d'),_0x7f59be[_0x0610('0xa2')]));if(_0x7f59be[_0x0610('0x10e')]===0x0){return this[_0x0610('0x9e')](_0x7f59be);}_0x7f59be[_0x0610('0x10e')]-=0x1;if(!this[_0x0610('0x9d')](_0x7f59be[_0x0610('0x10f')])){return this[_0x0610('0x37')]['error'](_0x7f59be,'no\x20file\x20audio\x20selected');}var _0x3a5dc7=this['getSound']['sync'](this,_0x7f59be[_0x0610('0x10f')]);if(!_0x3a5dc7){return this[_0x0610('0x37')][_0x0610('0x33')](_0x7f59be,'no\x20file\x20audio\x20found');}if(!this[_0x0610('0x9d')](_0x7f59be[_0x0610('0xd3')])){return this[_0x0610('0x37')][_0x0610('0x33')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x5602a6=this[_0x0610('0x37')][_0x0610('0x110')](_0x3a5dc7,_0x7f59be[_0x0610('0x111')],_0x7f59be[_0x0610('0x112')]);var _0x36077d=_0x5602a6[_0x0610('0x99')]?_0x5602a6[_0x0610('0x99')][_0x0610('0x49')]():'';logger['info'](_0x0610('0x113'),JSON[_0x0610('0x6e')](_0x5602a6));if(_0x5602a6[_0x0610('0x99')]===-0x1){this[_0x0610('0x36')][_0x0610('0x9f')](this,_0x7f59be,_0x36077d);return _0x5602a6;}else if(_0x5602a6['extra']===_0x0610('0x63')){_0x5602a6[_0x0610('0x99')]=_0x36077d['length']>=parseInt(_0x7f59be[_0x0610('0x114')])?'x':'i';}else{_0x5602a6[_0x0610('0x99')]=_0x36077d[_0x0610('0x91')]>=parseInt(_0x7f59be[_0x0610('0x114')])&&_0x36077d[_0x0610('0x91')]<=parseInt(_0x7f59be['maxdigit'])?'x':'i';}var _0xa8d63d=this[_0x0610('0x13')][_0x0610('0x9f')](this,_0x7f59be[_0x0610('0xd3')]);if(!_0xa8d63d){return this[_0x0610('0x37')][_0x0610('0x33')](_0x7f59be,'no\x20variable\x20found');}this['channel'][_0x0610('0x9c')](_0xa8d63d,_0x36077d);if(this['isConfigured'](_0x7f59be[_0x0610('0x115')])){var _0x48b940=parseInt(_0x7f59be['hiddendigitsnum'],0xa);var _0x3a4d6c=rs['generate']({'charset':'*','length':_0x48b940});var _0x159bf3=_0x36077d[_0x0610('0x91')];if(_0x159bf3>0x0){if(_0x159bf3>_0x48b940){this[_0x0610('0x36')]['sync'](this,_0x7f59be,_0x7f59be[_0x0610('0x116')]===_0x0610('0x117')?_0x3a4d6c+_0x36077d[_0x0610('0x118')](_0x48b940):_0x36077d[_0x0610('0x118')](0x0,_0x159bf3-_0x48b940)+_0x3a4d6c);}else{this[_0x0610('0x36')][_0x0610('0x9f')](this,_0x7f59be,rs[_0x0610('0x119')]({'charset':'*','length':_0x159bf3}));}}else{this[_0x0610('0x36')][_0x0610('0x9f')](this,_0x7f59be,'');}}else{this[_0x0610('0x36')][_0x0610('0x9f')](this,_0x7f59be,_0x36077d);}return _0x5602a6;};AGIVertices[_0x0610('0x12')][_0x0610('0xf')]=function(_0xfa556d){logger[_0x0610('0x2d')](util[_0x0610('0x51')](_0x0610('0x11a'),_0xfa556d[_0x0610('0xa2')]));return this['getdigits'](_0xfa556d);};AGIVertices[_0x0610('0x12')]['goal']=function(_0x113abf){logger[_0x0610('0x2d')](util[_0x0610('0x51')](_0x0610('0x11b'),_0x113abf[_0x0610('0xa2')]));this[_0x0610('0x36')]['sync'](this,_0x113abf,_0x113abf['goalname']);return this[_0x0610('0x37')]['noop'](util['format'](_0x0610('0x11c'),_0x113abf['goalname']));};AGIVertices[_0x0610('0x12')][_0x0610('0x11d')]=function(_0x58ccbc){logger[_0x0610('0x2d')](util[_0x0610('0x51')]('[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block',_0x58ccbc[_0x0610('0xa2')]));if(!this[_0x0610('0x9d')](_0x58ccbc[_0x0610('0x7f')])||!this[_0x0610('0x9d')](_0x58ccbc['aws_secret_access_key'])){return this['channel'][_0x0610('0xa3')](_0x0610('0x11e'));}if(!this[_0x0610('0x9d')](_0x58ccbc['text'])){return this[_0x0610('0x37')][_0x0610('0xa3')]('no\x20text\x20configured');}this['channel']['noop'](util[_0x0610('0x51')](_0x0610('0x11f'),_0x58ccbc[_0x0610('0x5a')]));var _0x1d652f=this[_0x0610('0x120')][_0x0610('0x9f')](this,_0x58ccbc);if(_0x1d652f){this[_0x0610('0x37')][_0x0610('0xa3')](util['format'](_0x0610('0x121'),_0x1d652f));var _0x5c4e28=this['channel'][_0x0610('0xfd')](_0x1d652f);try{fs[_0x0610('0xfe')](_0x1d652f+_0x0610('0xff'));}catch(_0xc3bdde){logger[_0x0610('0x33')](_0xc3bdde);}return _0x5c4e28;}return this['channel']['error'](_0x58ccbc,_0x0610('0x122'));};AGIVertices[_0x0610('0x12')]['awslex']=function(_0x28d836){logger[_0x0610('0x2d')](util[_0x0610('0x51')](_0x0610('0x123'),_0x28d836['label']));if(!this[_0x0610('0x9d')](_0x28d836[_0x0610('0x7f')])||!this['isConfigured'](_0x28d836[_0x0610('0x80')])){return this[_0x0610('0x37')]['noop'](_0x0610('0x11e'));}if(!this[_0x0610('0x9d')](_0x28d836[_0x0610('0x124')])){return this[_0x0610('0x37')][_0x0610('0xa3')](_0x0610('0x125'));}if(!this[_0x0610('0x9d')](_0x28d836[_0x0610('0x5a')])){return this[_0x0610('0x37')][_0x0610('0xa3')]('no\x20text\x20configured');}this['channel'][_0x0610('0xe3')]=!![];this[_0x0610('0x36')](_0x28d836);this[_0x0610('0x41')](_0x28d836[_0x0610('0x5a')],'in','','');this[_0x0610('0x37')][_0x0610('0xa3')](util[_0x0610('0x51')](_0x0610('0x126'),_0x28d836[_0x0610('0x5a')]));var _0x58d803=this['awsLex'][_0x0610('0x9f')](this,_0x28d836);if(_0x58d803){for(var _0xb045eb in _0x58d803){if(_0x58d803[_0x0610('0x8f')](_0xb045eb)&&_['isString'](_0x58d803[_0xb045eb])){this[_0x0610('0x37')][_0x0610('0x9c')](util['format'](_0x0610('0x127'),_0xb045eb[_0x0610('0x66')]()),_0x58d803[_0xb045eb]);}}if(_[_0x0610('0x44')](_0x58d803[_0x0610('0x72')])){return this[_0x0610('0x37')][_0x0610('0xa3')]('Amazon\x20Lex\x20ready\x20for\x20fulfillment');}else{this[_0x0610('0x41')](_0x58d803[_0x0610('0x72')],_0x0610('0xf0'),_0x0610('0x128'),'');return this[_0x0610('0x37')][_0x0610('0xa3')](util[_0x0610('0x51')](_0x0610('0x129'),_0x58d803[_0x0610('0x72')]));}}return this['channel'][_0x0610('0x33')](_0x28d836,_0x0610('0x12a'));};AGIVertices['prototype'][_0x0610('0x12b')]=function(_0x28c064){logger[_0x0610('0x2d')](util['format'](_0x0610('0x12c'),_0x28c064[_0x0610('0xa2')],_0x28c064['timeout']));if(!this[_0x0610('0x9d')](_0x28c064[_0x0610('0x7a')])){return this['channel']['noop']('no\x20key\x20configured');}var _0x5a04c3=_0x0610('0x12d');var _0x320cb1=util[_0x0610('0x51')](_0x0610('0x12e'),FILES_PATH,rs['generate'](0x4));var _0x1084a0=util[_0x0610('0x51')]('%s.%s',_0x320cb1,_0x5a04c3);var _0x539354=!![];if(_0x28c064['beep']===_0x0610('0x12f')){_0x539354=![];}var _0x3a17cd=this[_0x0610('0x37')][_0x0610('0x130')](_0x320cb1,_0x5a04c3,_0x28c064[_0x0610('0x131')],_0x28c064['timeout'],undefined,_0x539354);if(_0x3a17cd['result']!==-0x1){this[_0x0610('0x37')][_0x0610('0xa3')](util[_0x0610('0x51')](_0x0610('0x132'),_0x1084a0));var _0x1531cd=this[_0x0610('0x85')]['sync'](this,_0x28c064,_0x1084a0);if(_0x1531cd){for(var _0x1f92ea in _0x1531cd){if(_0x1531cd[_0x0610('0x8f')](_0x1f92ea)){this[_0x0610('0x37')]['setVariable'](util['format'](_0x0610('0x133'),_0x1f92ea['toUpperCase']()),_0x1531cd[_0x1f92ea]);}}return this['channel']['noop'](util[_0x0610('0x51')]('GoogleASR\x20Result\x20%s',JSON[_0x0610('0x6e')](_0x1531cd)));}}return _0x3a17cd;};AGIVertices[_0x0610('0x12')][_0x0610('0x134')]=function(_0x2c035c){logger[_0x0610('0x2d')](util[_0x0610('0x51')](_0x0610('0x135'),_0x2c035c[_0x0610('0xa2')]));if(!this[_0x0610('0x9d')](_0x2c035c[_0x0610('0x87')])){return this[_0x0610('0x37')][_0x0610('0xa3')](_0x0610('0x136'));}if(!this[_0x0610('0x9d')](_0x2c035c[_0x0610('0x88')])){return this['channel'][_0x0610('0xa3')](_0x0610('0x137'));}var _0x9a5698=_0x0610('0x12d');var _0x662d2c=util[_0x0610('0x51')](_0x0610('0x12e'),FILES_PATH,rs[_0x0610('0x119')](0x4));var _0x5c0ec7=util[_0x0610('0x51')](_0x0610('0x95'),_0x662d2c,_0x9a5698);var _0x1d2306=!![];if(_0x2c035c['beep']===_0x0610('0x12f')){_0x1d2306=![];}var _0x389191=this[_0x0610('0x37')]['recordFile'](_0x662d2c,_0x9a5698,_0x2c035c[_0x0610('0x131')],_0x2c035c[_0x0610('0x63')],undefined,_0x1d2306);if(_0x389191['result']!==-0x1){this['channel']['noop'](util[_0x0610('0x51')](_0x0610('0x138'),_0x5c0ec7));var _0x4feb18=this[_0x0610('0x86')][_0x0610('0x9f')](this,_0x2c035c,_0x5c0ec7);if(_0x4feb18){for(var _0x566350 in _0x4feb18){if(_0x4feb18['hasOwnProperty'](_0x566350)){this[_0x0610('0x37')][_0x0610('0x9c')](util['format'](_0x0610('0x139'),_0x566350[_0x0610('0x66')]()),_0x4feb18[_0x566350]);}}return this[_0x0610('0x37')]['noop'](util[_0x0610('0x51')]('TildeASR\x20Result\x20%s',JSON['stringify'](_0x4feb18)));}}return _0x389191;};AGIVertices[_0x0610('0x12')]['gotoc']=function(_0x2cef0b){logger[_0x0610('0x2d')](util[_0x0610('0x51')](_0x0610('0x13a'),_0x2cef0b[_0x0610('0xa2')]));return this[_0x0610('0x37')][_0x0610('0x13b')](_0x2cef0b['context'],_0x2cef0b['extension'],_0x2cef0b[_0x0610('0x3e')]);};AGIVertices[_0x0610('0x12')][_0x0610('0x13c')]=function(_0xa777e3){logger[_0x0610('0x2d')](util[_0x0610('0x51')](_0x0610('0x13d'),_0xa777e3[_0x0610('0xa2')]));if(!this[_0x0610('0x9d')](_0xa777e3[_0x0610('0x13e')])){return this[_0x0610('0x37')][_0x0610('0x33')](_0xa777e3,_0x0610('0x13f'));}try{var _0x55701b=eval(_0xa777e3['condition'])?'true':'false';this[_0x0610('0x37')][_0x0610('0xa3')](util[_0x0610('0x51')](_0x0610('0x140'),_0xa777e3[_0x0610('0x13e')],_0x55701b));return{'code':0xc8,'result':_0x55701b};}catch(_0x4d9617){return{'code':0xc8,'result':'false'};}};AGIVertices[_0x0610('0x12')][_0x0610('0x141')]=function(_0x14c81c){logger[_0x0610('0x2d')](util['format'](_0x0610('0x142'),_0x14c81c[_0x0610('0xa2')]));if(!this[_0x0610('0x9d')](_0x14c81c[_0x0610('0x143')])){return this[_0x0610('0x37')][_0x0610('0x33')](_0x14c81c,_0x0610('0x144'));}var _0x32dafe=this[_0x0610('0x145')][_0x0610('0x9f')](this,_0x14c81c[_0x0610('0x143')]);if(!_0x32dafe){return this[_0x0610('0x37')][_0x0610('0x33')](_0x14c81c,_0x0610('0x146'));}for(var _0x2b6d1e=0x0;_0x2b6d1e<_0x32dafe[_0x0610('0x91')];_0x2b6d1e+=0x1){var _0x445450=this['channel'][_0x0610('0x13')](util['format'](_0x0610('0x147'),_0x32dafe[_0x2b6d1e]));if(_0x445450[_0x0610('0x99')]===-0x1){return _0x445450;}logger['info'](util['format'](_0x0610('0x148'),_0x32dafe[_0x2b6d1e],_0x445450['extra']));if(_0x445450[_0x0610('0x9b')]==='true'){logger['info'](util[_0x0610('0x51')]('IFTIME\x20%s\x20%s',_0x32dafe[_0x2b6d1e],_0x0610('0x149')));this[_0x0610('0x37')][_0x0610('0xa3')](util['format']('IFTIME\x20%s\x20%s',_0x32dafe[_0x2b6d1e],_0x0610('0x149')));return{'code':0xc8,'result':'true'};}else{logger[_0x0610('0x2d')](util[_0x0610('0x51')](_0x0610('0x148'),_0x32dafe[_0x2b6d1e],_0x0610('0x14a')));this['channel'][_0x0610('0xa3')](util[_0x0610('0x51')]('IFTIME\x20%s\x20%s',_0x32dafe[_0x2b6d1e],_0x0610('0x14a')));}}return{'code':0xc8,'result':_0x0610('0x14a')};};AGIVertices['prototype'][_0x0610('0x14b')]=function(_0x22d381){logger[_0x0610('0x2d')](util[_0x0610('0x51')](_0x0610('0x14c'),_0x22d381[_0x0610('0xa2')]));return this[_0x0610('0x37')][_0x0610('0x14b')]();};AGIVertices[_0x0610('0x12')][_0x0610('0x14d')]=function(_0x1dd0ad){logger['info'](util['format'](_0x0610('0x14e'),_0x1dd0ad[_0x0610('0xa2')]));if(!this[_0x0610('0x9d')](_0x1dd0ad[_0x0610('0x7a')])){return this[_0x0610('0x37')]['noop']('no\x20key\x20configured');}var _0x57c6ae=_0x0610('0x12d');var _0x256014=util['format'](_0x0610('0x12e'),FILES_PATH,rs[_0x0610('0x119')](0x4));var _0xc9f209=util['format'](_0x0610('0x95'),_0x256014,_0x57c6ae);var _0x480eb4=!![];if(_0x1dd0ad['beep']==='NOBEEP'){_0x480eb4=![];}var _0x2a93b4=this['channel'][_0x0610('0x130')](_0x256014,_0x57c6ae,_0x1dd0ad[_0x0610('0x131')],_0x1dd0ad['timeout'],undefined,_0x480eb4);if(_0x2a93b4['result']!==-0x1){this['channel'][_0x0610('0xa3')](util[_0x0610('0x51')](_0x0610('0x14f'),_0xc9f209));var _0x50a5d8=this['ispeechASR'][_0x0610('0x9f')](this,_0x1dd0ad,_0xc9f209);if(_0x50a5d8){for(var _0x9cfa4e in _0x50a5d8){if(_0x50a5d8[_0x0610('0x8f')](_0x9cfa4e)){this[_0x0610('0x37')][_0x0610('0x9c')](util['format'](_0x0610('0x150'),_0x9cfa4e[_0x0610('0x66')]()),_0x50a5d8[_0x9cfa4e]);}}return this[_0x0610('0x37')][_0x0610('0xa3')](util[_0x0610('0x51')](_0x0610('0x151'),JSON[_0x0610('0x6e')](_0x50a5d8)));}}return _0x2a93b4;};AGIVertices[_0x0610('0x12')][_0x0610('0x152')]=function(_0x23de5c){logger[_0x0610('0x2d')](util['format'](_0x0610('0x153'),_0x23de5c[_0x0610('0xa2')]));if(!this[_0x0610('0x9d')](_0x23de5c[_0x0610('0x7a')])){return this[_0x0610('0x37')][_0x0610('0xa3')](_0x0610('0xe2'));}if(!this['isConfigured'](_0x23de5c['text'])){return this['channel'][_0x0610('0xa3')](_0x0610('0xa4'));}this['channel'][_0x0610('0xa3')](util['format'](_0x0610('0x154'),_0x23de5c[_0x0610('0x5a')]));var _0x1d9bde=this[_0x0610('0x79')][_0x0610('0x9f')](this,_0x23de5c);if(_0x1d9bde){this[_0x0610('0x37')][_0x0610('0xa3')](util['format'](_0x0610('0x14f'),_0x1d9bde));var _0x560084=this[_0x0610('0x37')][_0x0610('0xfd')](_0x1d9bde,_0x23de5c[_0x0610('0x131')]);try{fs[_0x0610('0xfe')](_0x1d9bde+_0x0610('0xff'));}catch(_0x48882a){logger['error'](_0x48882a);}return _0x560084;}return this[_0x0610('0x37')]['error'](_0x23de5c,_0x0610('0x155'));};AGIVertices[_0x0610('0x12')]['login']=function(_0xb8a2ba){logger[_0x0610('0x2d')](util[_0x0610('0x51')]('Enter\x20in\x20LOGIN\x20(%s)\x20block',_0xb8a2ba[_0x0610('0xa2')]));if(!this[_0x0610('0x9d')](_0xb8a2ba[_0x0610('0x156')])){return this[_0x0610('0x37')]['error'](_0xb8a2ba,_0x0610('0x157'));}logger[_0x0610('0x2d')](util[_0x0610('0x51')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this['channel']['callerid'],_0xb8a2ba['findBy']));var _0xe9ec86=this[_0x0610('0x54')][_0x0610('0x9f')](this,_0xb8a2ba[_0x0610('0x156')]);if(_0xe9ec86){logger[_0x0610('0x2d')](util['format']('AGENT\x20%s\x20FOUND\x20BY',this['channel']['callerid'],_0xb8a2ba[_0x0610('0x156')]));this[_0x0610('0x37')]['noop'](util[_0x0610('0x51')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x0610('0x37')]['callerid'],_0xb8a2ba[_0x0610('0x156')]));return{'code':0xc8,'result':_0x0610('0x158')};}else{logger[_0x0610('0x2d')](util[_0x0610('0x51')](_0x0610('0x159'),this[_0x0610('0x37')][_0x0610('0x3b')],_0xb8a2ba[_0x0610('0x156')]));this[_0x0610('0x37')][_0x0610('0xa3')](util['format'](_0x0610('0x159'),this['channel'][_0x0610('0x3b')],_0xb8a2ba[_0x0610('0x156')]));return{'code':0xc8,'result':_0x0610('0x15a')};}};AGIVertices['prototype'][_0x0610('0x15b')]=function(_0x12dd35){logger[_0x0610('0x2d')](util[_0x0610('0x51')](_0x0610('0x15c'),_0x12dd35[_0x0610('0xa2')]));if(!this[_0x0610('0x9d')](_0x12dd35['findBy'])){return this[_0x0610('0x37')][_0x0610('0x33')](_0x12dd35,'no\x20find\x20by\x20configured');}logger[_0x0610('0x2d')](util['format'](_0x0610('0x15d'),this[_0x0610('0x37')]['callerid'],_0x12dd35[_0x0610('0x156')]));var _0x6ff26d=this['agentLogout'][_0x0610('0x9f')](this,_0x12dd35['findBy']);if(_0x6ff26d){logger[_0x0610('0x2d')](util['format']('AGENT\x20%s\x20FOUND\x20BY',this[_0x0610('0x37')][_0x0610('0x3b')],_0x12dd35[_0x0610('0x156')]));this['channel']['noop'](util[_0x0610('0x51')](_0x0610('0x15e'),this[_0x0610('0x37')][_0x0610('0x3b')],_0x12dd35['findBy']));return{'code':0xc8,'result':_0x0610('0x158')};}else{logger[_0x0610('0x2d')](util[_0x0610('0x51')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this['channel'][_0x0610('0x3b')],_0x12dd35[_0x0610('0x156')]));this[_0x0610('0x37')]['noop'](util[_0x0610('0x51')](_0x0610('0x159'),this[_0x0610('0x37')]['callerid'],_0x12dd35['findBy']));return{'code':0xc8,'result':_0x0610('0x15a')};}};AGIVertices[_0x0610('0x12')][_0x0610('0x15f')]=function(_0x4dbd8e){logger[_0x0610('0x2d')](util['format'](_0x0610('0x160'),_0x4dbd8e[_0x0610('0xa2')]));if(!this[_0x0610('0x9d')](_0x4dbd8e[_0x0610('0x161')])){return this['channel'][_0x0610('0x33')](_0x4dbd8e,_0x0610('0x162'));}this['channel'][_0x0610('0xa3')](util[_0x0610('0x51')]('math\x20%s',_0x4dbd8e[_0x0610('0x161')]));var _0x2e4dcc=eval(_0x4dbd8e[_0x0610('0x161')]);if(!this[_0x0610('0x9d')](_0x4dbd8e[_0x0610('0xd3')])){return this[_0x0610('0x37')]['noop'](_0x0610('0x163'));}var _0x4bd109=this[_0x0610('0x13')][_0x0610('0x9f')](this,_0x4dbd8e[_0x0610('0xd3')]);if(!_0x4bd109){return this[_0x0610('0x37')][_0x0610('0x33')](_0x4dbd8e,'no\x20variable\x20found');}if(_[_0x0610('0x90')](_0x2e4dcc)){var _0x5800ab=this;_0x2e4dcc['forEach'](function(_0x31bfd4,_0x2ea4c2){_0x5800ab[_0x0610('0x37')][_0x0610('0x9c')](util[_0x0610('0x51')](_0x0610('0x164'),_0x4bd109,_0x2ea4c2),_0x31bfd4);});return this[_0x0610('0x37')][_0x0610('0xa3')](util[_0x0610('0x51')]('variable\x20%s[key]\x20set',_0x4bd109));}else{return this[_0x0610('0x37')][_0x0610('0x9c')](_0x4bd109,_0x2e4dcc);}};AGIVertices['prototype']['menu']=function(_0x142a3f){logger[_0x0610('0x2d')](util['format'](_0x0610('0x165'),_0x142a3f['label']));if(_0x142a3f['retry']===0x0){return this[_0x0610('0x9e')](_0x142a3f);}_0x142a3f[_0x0610('0x10e')]-=0x1;if(!this[_0x0610('0x9d')](_0x142a3f['file_id'])){return this[_0x0610('0x37')][_0x0610('0x33')](_0x142a3f,_0x0610('0x166'));}var _0x1263fa=this[_0x0610('0x21')][_0x0610('0x9f')](this,_0x142a3f[_0x0610('0x10f')]);if(!_0x1263fa){return this['channel'][_0x0610('0x33')](_0x142a3f,_0x0610('0x167'));}var _0x3f5eaf=this['channel'][_0x0610('0x110')](_0x1263fa,_0x142a3f[_0x0610('0x111')],_0x142a3f[_0x0610('0x168')]);var _0xc213b3=_0x3f5eaf[_0x0610('0x99')];if(_0x3f5eaf[_0x0610('0x99')]===-0x1){this[_0x0610('0x36')][_0x0610('0x9f')](this,_0x142a3f,'-1');return _0x3f5eaf;}else if(_0x3f5eaf[_0x0610('0x9b')]===_0x0610('0x63')){_0x3f5eaf[_0x0610('0x99')]=_0x3f5eaf['result'][_0x0610('0x91')]>0x0?_0x3f5eaf['result']:'t';}else if(_[_0x0610('0x43')](_0x3f5eaf[_0x0610('0x99')])){_0x3f5eaf['result']='#';_0xc213b3='#';}if(!this[_0x0610('0x9d')](_0x142a3f['variable_id'])){this[_0x0610('0x37')][_0x0610('0xa3')](_0x0610('0x163'));}else{var _0x12142f=this['getVariable'][_0x0610('0x9f')](this,_0x142a3f['variable_id']);if(!_0x12142f){return this['channel'][_0x0610('0x33')](_0x142a3f,_0x0610('0xd4'));}this[_0x0610('0x37')][_0x0610('0x9c')](_0x12142f,_0xc213b3);}this['createSquareDetailsReport'][_0x0610('0x9f')](this,_0x142a3f,_0xc213b3);return _0x3f5eaf;};AGIVertices[_0x0610('0x12')]['noop']=function(_0x2eaa3d){logger[_0x0610('0x2d')](util[_0x0610('0x51')](_0x0610('0x169'),_0x2eaa3d[_0x0610('0xa2')]));return this[_0x0610('0x37')]['noop'](_0x2eaa3d[_0x0610('0x16a')]||_0x2eaa3d[_0x0610('0xa2')]);};AGIVertices['prototype']['pause']=function(_0x50217a){logger[_0x0610('0x2d')](util[_0x0610('0x51')](_0x0610('0x16b'),_0x50217a[_0x0610('0xa2')]));if(!this['isConfigured'](_0x50217a[_0x0610('0x156')])){return this['channel'][_0x0610('0x33')](_0x50217a,_0x0610('0x157'));}logger[_0x0610('0x2d')](util[_0x0610('0x51')](_0x0610('0x15d'),this[_0x0610('0x37')][_0x0610('0x3b')],_0x50217a['findBy']));var _0x9f9577=this[_0x0610('0x4b')][_0x0610('0x9f')](this,_0x50217a[_0x0610('0x16c')]);var _0x9b0df7=this[_0x0610('0x4c')][_0x0610('0x9f')](this,_0x50217a[_0x0610('0x156')],_0x9f9577);if(_0x9b0df7){logger['info'](util[_0x0610('0x51')](_0x0610('0x15e'),this[_0x0610('0x37')]['callerid'],_0x50217a[_0x0610('0x156')]));this[_0x0610('0x37')][_0x0610('0xa3')](util['format'](_0x0610('0x15e'),this[_0x0610('0x37')][_0x0610('0x3b')],_0x50217a['findBy']));return{'code':0xc8,'result':_0x0610('0x158')};}else{logger[_0x0610('0x2d')](util[_0x0610('0x51')](_0x0610('0x159'),this[_0x0610('0x37')][_0x0610('0x3b')],_0x50217a[_0x0610('0x156')]));this[_0x0610('0x37')][_0x0610('0xa3')](util[_0x0610('0x51')](_0x0610('0x15e'),this[_0x0610('0x37')][_0x0610('0x3b')],_0x50217a[_0x0610('0x156')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0x0610('0x12')][_0x0610('0x16d')]=function(_0x525530){logger['info'](util[_0x0610('0x51')](_0x0610('0x16e'),_0x525530[_0x0610('0xa2')]));if(!this[_0x0610('0x9d')](_0x525530[_0x0610('0x10f')])){return this['channel']['error'](_0x525530,'no\x20file\x20audio\x20selected');}var _0x2467b4=this[_0x0610('0x21')]['sync'](this,_0x525530[_0x0610('0x10f')]);if(!_0x2467b4){return this['channel']['error'](_0x525530,_0x0610('0x167'));}var _0x3610a2=this[_0x0610('0x37')][_0x0610('0x56')](_0x0610('0x16f'),[_0x2467b4,_0x525530[_0x0610('0x10a')]]);if(_0x3610a2[_0x0610('0x99')]===-0x1){return _0x3610a2;}return this['channel'][_0x0610('0xa3')](util['format'](_0x0610('0xc0'),_0x0610('0x16f'),_0x2467b4));};AGIVertices['prototype'][_0x0610('0x170')]=function(_0x46a775){logger[_0x0610('0x2d')](util[_0x0610('0x51')]('Enter\x20in\x20QUEUE\x20(%s)\x20block',_0x46a775[_0x0610('0xa2')]));if(!this[_0x0610('0x9d')](_0x46a775[_0x0610('0x171')])){return this[_0x0610('0x37')][_0x0610('0x33')](_0x46a775,'no\x20queue\x20selected');}var _0x3da237='';var _0x13a988=parseInt(_0x46a775['queue_id'],0xa);if(isNaN(_0x13a988)){_0x3da237=_0x46a775[_0x0610('0x171')];}else{_0x3da237=this[_0x0610('0x18')]['sync'](this,_0x46a775['queue_id']);if(!_0x3da237){return this['channel'][_0x0610('0x33')](_0x46a775,_0x0610('0x172'));}}var _0x48ee49='';if(this[_0x0610('0x9d')](_0x46a775['file_id'])){var _0x453a96=this[_0x0610('0x21')][_0x0610('0x9f')](this,_0x46a775[_0x0610('0x10f')]);if(_0x453a96){_0x48ee49=_0x453a96;}}this[_0x0610('0x36')]['sync'](this,_0x46a775,_0x3da237);if(_0x46a775[_0x0610('0x10a')]['indexOf']('x')<0x0){_0x46a775[_0x0610('0x10a')]+='x';}if(_0x46a775[_0x0610('0x10a')][_0x0610('0x173')]('X')<0x0){_0x46a775[_0x0610('0x10a')]+='X';}this[_0x0610('0x37')]['setVariable']('XMCS-QUEUE',_0x3da237?_0x3da237[_0x0610('0x174')]():'');var _0x2df9db=this[_0x0610('0x37')][_0x0610('0x56')]('QUEUE',[_0x3da237,_0x46a775[_0x0610('0x10a')],_0x46a775['url'],_0x48ee49,_0x46a775[_0x0610('0x63')],_0x46a775[_0x0610('0x9')],_0x46a775[_0x0610('0x175')],_0x46a775['gosub'],'',_0x46a775[_0x0610('0x176')]]);if(_0x2df9db['result']===-0x1){return _0x2df9db;}return this[_0x0610('0x37')]['noop'](util[_0x0610('0x51')](_0x0610('0xc0'),_0x0610('0x177'),_0x3da237));};AGIVertices[_0x0610('0x12')]['record']=function(_0x566264){logger[_0x0610('0x2d')](util['format']('Enter\x20in\x20RECORD\x20(%s)\x20block',_0x566264[_0x0610('0xa2')]));var _0x5a63ef=_0x566264[_0x0610('0x178')]||'wav';var _0x527cd7=util['format'](_0x0610('0x179'),this['channel'][_0x0610('0x38')],rs[_0x0610('0x119')](0x5));var _0x3df0bf=util[_0x0610('0x51')]('%s/recordings/%s.%s',FILES_PATH,_0x527cd7,_0x5a63ef);var _0x444de7=util[_0x0610('0x51')](_0x0610('0x12e'),FILES_PATH,_0x527cd7);this['createSquareRecording'][_0x0610('0x9f')](this,_0x566264,_0x527cd7,_0x3df0bf);this[_0x0610('0x37')][_0x0610('0x9c')]('RECORDING_SAVENAME',_0x527cd7);logger['info']('Recording\x20%s\x20%s\x20%s\x20%s',_0x444de7,_0x5a63ef,_0x566264['escape_digits'],_0x566264[_0x0610('0x63')]);return this[_0x0610('0x37')][_0x0610('0x130')](_0x444de7,_0x5a63ef,_0x566264['escape_digits'],_0x566264[_0x0610('0x63')],undefined,!![]);};AGIVertices[_0x0610('0x12')][_0x0610('0x17a')]=function(_0x3a2707){logger[_0x0610('0x2d')](util[_0x0610('0x51')](_0x0610('0x17b'),_0x3a2707[_0x0610('0xa2')]));if(!this[_0x0610('0x9d')](_0x3a2707[_0x0610('0x62')])){return this['channel'][_0x0610('0xa3')](_0x0610('0x17c'));}var _0x56b1d9=this[_0x0610('0x61')][_0x0610('0x9f')](this,_0x3a2707);logger['info'](util['format'](_0x0610('0x17d'),util['inspect'](_0x56b1d9,{'showHidden':![],'depth':null})));if(!this[_0x0610('0x9d')](_0x3a2707[_0x0610('0xd3')])){return this[_0x0610('0x37')][_0x0610('0xa3')]('no\x20variable\x20selected\x20for\x20the\x20response');}var _0x2a735a=this[_0x0610('0x13')][_0x0610('0x9f')](this,_0x3a2707[_0x0610('0xd3')]);if(!_0x2a735a){return this[_0x0610('0x37')][_0x0610('0x33')](_0x3a2707,_0x0610('0xd4'));}this[_0x0610('0x37')][_0x0610('0x9c')](util['format']('%s_STATUS_CODE',_0x2a735a),_0x56b1d9['statusCode']?_0x56b1d9[_0x0610('0x70')]:_0x0610('0x17e'));this[_0x0610('0x37')][_0x0610('0x9c')](util['format'](_0x0610('0x17f'),_0x2a735a),_0x56b1d9[_0x0610('0x71')]?_0x56b1d9['statusMessage']:'OK');if(_0x56b1d9['body']){try{this[_0x0610('0x94')](_0x56b1d9[_0x0610('0x67')],_0x2a735a);}catch(_0x4d4f84){logger['error'](util[_0x0610('0x51')]('Unable\x20to\x20set\x20result\x20in\x20variable\x20%s',_0x2a735a));}}return this[_0x0610('0x37')][_0x0610('0xa3')](util[_0x0610('0x51')](_0x0610('0x180'),_0x2a735a));};AGIVertices[_0x0610('0x12')][_0x0610('0x181')]=function(_0x23e5a5){logger[_0x0610('0x2d')](util[_0x0610('0x51')](_0x0610('0x182'),_0x23e5a5['label']));return this[_0x0610('0x37')][_0x0610('0x183')](_0x23e5a5[_0x0610('0x184')][_0x0610('0x57')](/\s+/g,''),_0x23e5a5[_0x0610('0x185')]);};AGIVertices[_0x0610('0x12')][_0x0610('0x186')]=function(_0x4fa000){logger['info'](util['format'](_0x0610('0x187'),_0x4fa000['label']));return this[_0x0610('0x37')]['sayNumber'](_0x4fa000[_0x0610('0x188')][_0x0610('0x57')](/\s+/g,''),_0x4fa000[_0x0610('0x185')]);};AGIVertices['prototype'][_0x0610('0x189')]=function(_0x3d93a7){logger[_0x0610('0x2d')](util['format'](_0x0610('0x18a'),_0x3d93a7['label']));return this[_0x0610('0x37')][_0x0610('0x18b')](_0x3d93a7[_0x0610('0x5a')],_0x3d93a7['escape_digits']);};AGIVertices[_0x0610('0x12')]['sendMail']=function(_0x4c9a11){logger[_0x0610('0x2d')](util['format']('Enter\x20in\x20SENDMAIL\x20(%s)\x20block',_0x4c9a11[_0x0610('0xa2')]));if(!this[_0x0610('0x9d')](_0x4c9a11['account_id'])){return this[_0x0610('0x37')][_0x0610('0xa3')](_0x0610('0x18c'));}var _0x11110a=this[_0x0610('0x25')][_0x0610('0x9f')](this,_0x4c9a11[_0x0610('0x18d')]);if(!_0x11110a||!_0x11110a['Smtp']){return this[_0x0610('0x37')][_0x0610('0x33')](_0x4c9a11,_0x0610('0x18e'));}var _0x2ca888={'from':util[_0x0610('0x51')]('\x22%s\x22\x20<%s>',_0x11110a[_0x0610('0x16')],_0x11110a[_0x0610('0x18f')]||_0x11110a[_0x0610('0x190')][_0x0610('0x191')]),'to':_0x4c9a11['to']||'','cc':_0x4c9a11['cc']||'','bcc':_0x4c9a11['bcc']||'','subject':_0x4c9a11['subject'],'html':_0x4c9a11[_0x0610('0x5a')],'text':_0x4c9a11[_0x0610('0x5a')]};var _0x359e3d={'tls':{'rejectUnauthorized':![]}};if(_0x11110a['Smtp']['service']){_0x359e3d[_0x0610('0x192')]=_0x11110a['Smtp'][_0x0610('0x192')];}else{_0x359e3d[_0x0610('0x193')]=_0x11110a[_0x0610('0x190')][_0x0610('0x193')];_0x359e3d[_0x0610('0x194')]=_0x11110a[_0x0610('0x190')][_0x0610('0x194')];_0x359e3d['secure']=_0x11110a[_0x0610('0x190')][_0x0610('0x195')];}if(_0x11110a['Smtp'][_0x0610('0x196')]){_0x359e3d[_0x0610('0x197')]={'user':_0x11110a['Smtp'][_0x0610('0x191')],'pass':_0x11110a[_0x0610('0x190')]['pass']};}if(this[_0x0610('0x9d')](_0x4c9a11[_0x0610('0x198')])){}logger[_0x0610('0xd9')]('sendMail\x20message',JSON[_0x0610('0x6e')](_0x2ca888));this['createSquareDetailsReport']['sync'](this,_0x4c9a11,_0x4c9a11[_0x0610('0x18d')]);this[_0x0610('0x37')]['noop'](util[_0x0610('0x51')](_0x0610('0x199'),_0x11110a[_0x0610('0x16')]));this[_0x0610('0x26')][_0x0610('0x9f')](this,_0x359e3d,_0x2ca888);return this[_0x0610('0x37')][_0x0610('0xa3')]('Mail\x20message\x20added\x20to\x20outgoing\x20process');};AGIVertices[_0x0610('0x12')][_0x0610('0x19a')]=function(_0x146a5c){logger[_0x0610('0x2d')](util[_0x0610('0x51')](_0x0610('0x19b'),_0x146a5c[_0x0610('0xa2')]));return this[_0x0610('0x37')][_0x0610('0xa3')](_0x0610('0x19c'));};AGIVertices[_0x0610('0x12')]['sendSMS']=function(_0x59201d){logger['info'](util[_0x0610('0x51')](_0x0610('0x19d'),_0x59201d[_0x0610('0xa2')]));if(!this[_0x0610('0x9d')](_0x59201d['sms_account_id'])){return this[_0x0610('0x37')][_0x0610('0xa3')](_0x0610('0x19e'));}var _0x4e1e9c=this[_0x0610('0x35')]['sync'](this,_0x59201d[_0x0610('0x19f')]);if(!_0x4e1e9c){return this['channel'][_0x0610('0x33')](_0x59201d,_0x0610('0x1a0'));}var _0x22f94f={'body':_0x59201d['sms_text'],'phone':_0x59201d['to']||'','SmsAccountId':_0x4e1e9c['id']};logger['debug'](_0x0610('0x1a1'),JSON[_0x0610('0x6e')](_0x22f94f));this['createSquareDetailsReport'][_0x0610('0x9f')](this,_0x59201d,_0x59201d[_0x0610('0x19f')]);this['channel'][_0x0610('0xa3')](util[_0x0610('0x51')]('Trying\x20SendSMS\x20with\x20account\x20%s',_0x4e1e9c[_0x0610('0x16')]));this[_0x0610('0x1a2')][_0x0610('0x9f')](this,_0x22f94f);return this[_0x0610('0x37')][_0x0610('0xa3')](_0x0610('0x1a3'));};AGIVertices[_0x0610('0x12')][_0x0610('0x1a4')]=function(_0x2f412d){logger['info'](util['format'](_0x0610('0x1a5'),_0x2f412d[_0x0610('0xa2')]));if(!this['isConfigured'](_0x2f412d['variable_id'])){return this[_0x0610('0x37')][_0x0610('0x33')](_0x2f412d,_0x0610('0x1a6'));}var _0x23d0b4=this['getVariable'][_0x0610('0x9f')](this,_0x2f412d[_0x0610('0xd3')]);if(!_0x23d0b4){return this[_0x0610('0x37')][_0x0610('0x33')](_0x2f412d,_0x0610('0xd4'));}return this['channel'][_0x0610('0x9c')](_0x23d0b4,_0x2f412d[_0x0610('0x1a7')]);};AGIVertices[_0x0610('0x12')][_0x0610('0x1a8')]=function(_0xf03411){logger['info'](util[_0x0610('0x51')](_0x0610('0x1a9'),_0xf03411[_0x0610('0xa2')]));this[_0x0610('0x37')][_0x0610('0xa3')]('START\x20CALLY\x20SQUARE');if(_0xf03411[_0x0610('0xb5')]===_0x0610('0x1aa')){this['channel'][_0x0610('0xa3')]('Answer');return this[_0x0610('0x37')][_0x0610('0xb5')]();}return this[_0x0610('0x37')][_0x0610('0xa3')]('Skipped\x20Answer');};AGIVertices[_0x0610('0x12')][_0x0610('0x1ab')]=function(_0x54e0fe){logger[_0x0610('0x2d')](util[_0x0610('0x51')](_0x0610('0x1ac'),_0x54e0fe[_0x0610('0xa2')]));if(!this[_0x0610('0x9d')](_0x54e0fe[_0x0610('0x1ad')])){return this['channel'][_0x0610('0x33')](_0x54e0fe,'no\x20subproject\x20selected');}var _0x3deec2=this[_0x0610('0x1ae')][_0x0610('0x9f')](this,_0x54e0fe[_0x0610('0x1ad')]);if(!this[_0x0610('0x9d')](_0x3deec2)){return this[_0x0610('0x37')][_0x0610('0x33')](_0x54e0fe,util[_0x0610('0x51')]('no\x20subproject\x20found\x20with\x20id\x20%d',_0x54e0fe[_0x0610('0x1ad')]));}if(_0x3deec2===this[_0x0610('0x37')][_0x0610('0x3a')]){return this[_0x0610('0x37')][_0x0610('0x33')](_0x54e0fe,_0x0610('0x1af'));}this[_0x0610('0x36')]['sync'](this,_0x54e0fe,_0x3deec2);var _0x143a3d=this[_0x0610('0x37')][_0x0610('0x56')](_0x0610('0x1b0'),util['format']('agi://%s/square,\x22%s\x22,\x22%s\x22',config[_0x0610('0x9')][_0x0610('0x193')]||_0x0610('0x1b1'),_0x3deec2,this[_0x0610('0x37')][_0x0610('0x3a')]));if(_0x143a3d['result']===-0x1){return _0x143a3d;}return this['channel'][_0x0610('0xa3')](util[_0x0610('0x51')](_0x0610('0xc0'),_0x0610('0x1b0'),_0x3deec2));};AGIVertices['prototype'][_0x0610('0x1b2')]=function(_0x3f85fc){logger[_0x0610('0x2d')](util[_0x0610('0x51')](_0x0610('0x1b3'),_0x3f85fc[_0x0610('0xa2')]));var _0x58c59a=this[_0x0610('0x55')][_0x0610('0x9f')](this,_0x3f85fc[_0x0610('0xb3')]);this[_0x0610('0x36')][_0x0610('0x9f')](this,_0x3f85fc,_0x3f85fc[_0x0610('0xb3')]);if(this[_0x0610('0x9d')](_0x3f85fc['variable_id'])){var _0x110366=this[_0x0610('0x13')][_0x0610('0x9f')](this,_0x3f85fc[_0x0610('0xd3')]);if(_0x110366){this['channel'][_0x0610('0x9c')](_0x110366,_0x58c59a);return this[_0x0610('0x37')]['noop'](util[_0x0610('0x51')]('sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s',_0x3f85fc[_0x0610('0xb3')],_0x110366));}}return this[_0x0610('0x37')][_0x0610('0xa3')](util['format'](_0x0610('0x1b4'),_0x3f85fc['command']));};AGIVertices['prototype'][_0x0610('0x1b5')]=function(_0xbb328b){logger[_0x0610('0x2d')](util[_0x0610('0x51')](_0x0610('0x1b6'),_0xbb328b[_0x0610('0xa2')]));_0xbb328b[_0x0610('0x5a')]=_0xbb328b['text'][_0x0610('0x57')](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0xbb328b[_0x0610('0x59')])){return this['channel'][_0x0610('0xa3')](_0x0610('0x1b7'));}if(!this[_0x0610('0x9d')](_0xbb328b[_0x0610('0x5a')])){return this['channel']['noop'](_0x0610('0xa4'));}this[_0x0610('0x37')][_0x0610('0xa3')](util['format'](_0x0610('0x1b8'),_0xbb328b['text']));var _0x3f78c1=this[_0x0610('0x58')]['sync'](this,_0xbb328b);if(_0x3f78c1){this['channel']['noop'](util['format'](_0x0610('0x1b9'),_0x3f78c1));var _0x4d0e2b=this[_0x0610('0x37')]['streamFile'](_0x3f78c1);try{fs[_0x0610('0xfe')](_0x3f78c1+_0x0610('0xff'));}catch(_0x451b7b){logger['error'](_0x451b7b);}return _0x4d0e2b;}return this[_0x0610('0x37')]['error'](_0xbb328b,'Google\x20Cloud\x20TTS\x20is\x20unreachable');};AGIVertices[_0x0610('0x12')][_0x0610('0x1ba')]=function(_0x402606){logger[_0x0610('0x2d')](util[_0x0610('0x51')]('Enter\x20in\x20GOOGLETTS\x20(%s)\x20block',_0x402606[_0x0610('0xa2')]));_0x402606['text']=_0x402606[_0x0610('0x5a')][_0x0610('0x57')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x0610('0x9d')](_0x402606[_0x0610('0x5a')])){return this[_0x0610('0x37')][_0x0610('0xa3')]('no\x20text\x20configured');}this[_0x0610('0x37')][_0x0610('0xa3')](util[_0x0610('0x51')](_0x0610('0x1bb'),_0x402606[_0x0610('0x5a')]));var _0x32273f=this['googleTTS'][_0x0610('0x9f')](this,_0x402606);if(_0x32273f){this[_0x0610('0x37')][_0x0610('0xa3')](util[_0x0610('0x51')](_0x0610('0x1bc'),_0x32273f));var _0x1da2d6=this[_0x0610('0x37')]['streamFile'](_0x32273f);try{fs[_0x0610('0xfe')](_0x32273f+_0x0610('0xff'));}catch(_0x1f7db1){logger['error'](_0x1f7db1);}return _0x1da2d6;}return this[_0x0610('0x37')]['error'](_0x402606,'Google\x20TTS\x20is\x20unreachable');};AGIVertices[_0x0610('0x12')]['unpause']=function(_0x1880a4){logger[_0x0610('0x2d')](util[_0x0610('0x51')](_0x0610('0x1bd'),_0x1880a4['label']));if(!this[_0x0610('0x9d')](_0x1880a4[_0x0610('0x156')])){return this['channel'][_0x0610('0x33')](_0x1880a4,'no\x20find\x20by\x20configured');}logger[_0x0610('0x2d')](util[_0x0610('0x51')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x0610('0x37')][_0x0610('0x3b')],_0x1880a4[_0x0610('0x156')]));var _0x1a80b3=this[_0x0610('0x4e')][_0x0610('0x9f')](this,_0x1880a4[_0x0610('0x156')]);if(_0x1a80b3){logger[_0x0610('0x2d')](util[_0x0610('0x51')]('AGENT\x20%s\x20FOUND\x20BY',this['channel']['callerid'],_0x1880a4[_0x0610('0x156')]));this['channel'][_0x0610('0xa3')](util[_0x0610('0x51')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x0610('0x37')][_0x0610('0x3b')],_0x1880a4[_0x0610('0x156')]));return{'code':0xc8,'result':_0x0610('0x158')};}else{logger[_0x0610('0x2d')](util[_0x0610('0x51')](_0x0610('0x159'),this[_0x0610('0x37')][_0x0610('0x3b')],_0x1880a4[_0x0610('0x156')]));this[_0x0610('0x37')][_0x0610('0xa3')](util[_0x0610('0x51')](_0x0610('0x159'),this[_0x0610('0x37')]['callerid'],_0x1880a4[_0x0610('0x156')]));return{'code':0xc8,'result':_0x0610('0x15a')};}};AGIVertices['prototype'][_0x0610('0x1be')]=function(_0x1785c6){logger[_0x0610('0x2d')](util[_0x0610('0x51')](_0x0610('0x1bf'),_0x1785c6[_0x0610('0xa2')]));var _0x4e4ad9=this[_0x0610('0x37')]['exec'](_0x0610('0x1c0'),[_0x1785c6[_0x0610('0x1c1')],_0x1785c6[_0x0610('0x74')]]);if(_0x4e4ad9[_0x0610('0x99')]===-0x1){return _0x4e4ad9;}return this[_0x0610('0x37')][_0x0610('0xa3')](util[_0x0610('0x51')](_0x0610('0xc0'),'VOICEMAIL',_0x1785c6[_0x0610('0x1c1')]));};AGIVertices[_0x0610('0x12')]['vswitch']=function(_0x47ebd6){logger[_0x0610('0x2d')](util[_0x0610('0x51')](_0x0610('0x1c2'),_0x47ebd6[_0x0610('0xa2')]));if(!this[_0x0610('0x9d')](_0x47ebd6[_0x0610('0xd3')])){return this[_0x0610('0x37')][_0x0610('0x33')](_0x47ebd6,'no\x20variable\x20selected');}var _0x38e42c=this[_0x0610('0x13')][_0x0610('0x9f')](this,_0x47ebd6[_0x0610('0xd3')]);if(!_0x38e42c){return this[_0x0610('0x37')][_0x0610('0x33')](_0x47ebd6,_0x0610('0xd4'));}var _0x19701d=this['channel'][_0x0610('0x13')](_0x38e42c);return{'code':0xc8,'result':_0x19701d[_0x0610('0x9b')]?_0x19701d[_0x0610('0x9b')]:'-'};};String['prototype'][_0x0610('0x97')]=function(_0x414961,_0x573bca){return this[_0x0610('0x96')](_0x414961)['join'](_0x573bca);};module[_0x0610('0x1c3')]=AGIVertices; \ No newline at end of file diff --git a/server/services/ami/acw/index.js b/server/services/ami/acw/index.js index 8af47b6..e1beb82 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 _0x012e=['info','acwTimeout','timer','stopAcw','lastPauseAt','format','YYYY-MM-DD\x20HH:mm:ss','uniqueid','queue','updateAcw','[%s][UPDATE][ACWTIME:%s]','catch','error','[%s][UPDATE][ERRORS:%s]','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','finally','[ACW][START]\x20%s','[%s][TIMER][STOP][AGENT:%s]','saveUnpause','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','stringify','message','acw','[ACW][syncAgentConnect]\x20%s','syncHangupRequest','isUndefined','[%s][HANGUP:UNIQUEID]','linkedid','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','[ACW][syncHangup]\x20%s','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','[ACW][syncBlindTransfer]\x20%s','autopause','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','util','lodash','moment','../ami','../../../config/logger','../rpc/user','../rpc/voiceAgentReport','voiceQueues','agents','timers','channels','agentconnect','syncAgentConnect','bind','hanguprequest','hangup','syncHangup','syncAgentRingNoAnswer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','custom:agentConnectPreview','milliseconds','diff','seconds','prototype','startAcw','interface','ACW','mandatoryDisposition','mandatoryDispositionPause','name','Action','QueuePause','then','getAgent','voicePause','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','savePause'];(function(_0x430ff2,_0x258c9e){var _0xd6136b=function(_0x5c826c){while(--_0x5c826c){_0x430ff2['push'](_0x430ff2['shift']());}};_0xd6136b(++_0x258c9e);}(_0x012e,0x185));var _0xe012=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x012e[_0x501510];return _0x1e6ee5;};'use strict';var util=require(_0xe012('0x0'));var _=require(_0xe012('0x1'));var moment=require(_0xe012('0x2'));var ami=require(_0xe012('0x3'));var logger=require(_0xe012('0x4'))('acw');var RpcUser=require(_0xe012('0x5'));var RpcVoiceAgentReport=require(_0xe012('0x6'));function Acw(_0x22b0e9){this[_0xe012('0x7')]=_0x22b0e9[_0xe012('0x7')];this['agents']=_0x22b0e9[_0xe012('0x8')];this[_0xe012('0x9')]=_0x22b0e9['timers'];this[_0xe012('0xa')]={};ami['on'](_0xe012('0xb'),this[_0xe012('0xc')][_0xe012('0xd')](this));ami['on'](_0xe012('0xe'),this['syncHangupRequest']['bind'](this));ami['on'](_0xe012('0xf'),this[_0xe012('0x10')][_0xe012('0xd')](this));ami['on']('agentringnoanswer',this[_0xe012('0x11')]['bind'](this));ami['on']('attendedtransfer',this[_0xe012('0x12')][_0xe012('0xd')](this));ami['on'](_0xe012('0x13'),this[_0xe012('0x14')][_0xe012('0xd')](this));ami['on'](_0xe012('0x15'),this['syncAgentConnectPreview']['bind'](this));}function getDiff(_0x4f48e7){var _0x460305=moment()[_0xe012('0x16')](0x0);var _0x2077f2=moment(_0x4f48e7)[_0xe012('0x16')](0x0);return _0x460305[_0xe012('0x17')](_0x2077f2,_0xe012('0x18'));}Acw[_0xe012('0x19')][_0xe012('0x1a')]=function(_0x616c42){try{var _0x25be99=this;var _0x453bc2=this['channels'][_0x616c42][_0xe012('0x1b')];var _0x433be6=this[_0xe012('0xa')][_0x616c42]['queue'];var _0x120b09=this[_0xe012('0x7')][_0x433be6];var _0x88d53e=![];var _0x5e444d=_0xe012('0x1c');if(_0x120b09[_0xe012('0x1d')]){if(_0x120b09[_0xe012('0x1e')][_0xe012('0x1f')]){_0x88d53e=!![];_0x5e444d=_0x120b09['mandatoryDispositionPause'][_0xe012('0x1f')];}}ami[_0xe012('0x20')]({'action':_0xe012('0x21'),'interface':_0x453bc2,'paused':!![],'reason':_0x5e444d})[_0xe012('0x22')](function(_0x4f1f25){if(_0x25be99[_0xe012('0x8')][_0x453bc2]){return RpcUser[_0xe012('0x23')](_0x25be99[_0xe012('0x8')][_0x453bc2]['id'])[_0xe012('0x22')](function(_0x1c35fd){if(_0x1c35fd&&!_0x1c35fd[_0xe012('0x24')]){logger['info'](_0xe012('0x25'),_0x616c42,_0x453bc2,_0x433be6);var _0x521988=_0x25be99[_0xe012('0xa')][_0x616c42][_0xe012('0x26')]&&_0x25be99[_0xe012('0xa')][_0x616c42][_0xe012('0x27')]?_0x25be99[_0xe012('0xa')][_0x616c42][_0xe012('0x27')]:_0x616c42;return RpcUser[_0xe012('0x28')](_0x25be99[_0xe012('0x8')][_0x453bc2],_0x5e444d,_0x521988)[_0xe012('0x22')](function(_0x492ef8){if(!_0x88d53e){_0x25be99['timers'][_0x453bc2]={};logger[_0xe012('0x29')]('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0x616c42,_0x25be99[_0xe012('0x7')][_0x433be6][_0xe012('0x2a')],_0x453bc2,_0x433be6);_0x25be99[_0xe012('0x9')][_0x453bc2][_0xe012('0x2b')]=setTimeout(_0x25be99[_0xe012('0x2c')][_0xe012('0xd')](_0x25be99,_0x453bc2),_0x25be99['voiceQueues'][_0x433be6][_0xe012('0x2a')]*0x3e8);_0x25be99['timers'][_0x453bc2][_0xe012('0x2d')]=moment()[_0xe012('0x2e')](_0xe012('0x2f'));_0x25be99[_0xe012('0x9')][_0x453bc2][_0xe012('0x30')]=_0x616c42;_0x25be99[_0xe012('0x9')][_0x453bc2][_0xe012('0x31')]=_0x433be6;_0x25be99['timers'][_0x453bc2][_0xe012('0x32')]=function(){var _0x3122f5=getDiff(_0x25be99[_0xe012('0x9')][_0x453bc2][_0xe012('0x2d')]);clearTimeout(_0x25be99[_0xe012('0x9')][_0x453bc2][_0xe012('0x2b')]);_0x25be99['timers'][_0x453bc2]['timer']=![];RpcVoiceAgentReport['update']({'acwtime':_0x3122f5},_0x25be99[_0xe012('0x9')][_0x453bc2][_0xe012('0x30')],_0x453bc2)[_0xe012('0x22')](function(_0x5dbf6a){logger[_0xe012('0x29')](_0xe012('0x33'),_0x616c42,_0x3122f5,_0x5dbf6a);})[_0xe012('0x34')](function(_0x2a1b76){logger[_0xe012('0x35')](_0xe012('0x36'),_0x616c42,_0x2a1b76);});delete _0x25be99[_0xe012('0x9')][_0x453bc2];};}});}else{logger[_0xe012('0x29')]('[%s][INPAUSE][AGENT:%s][QUEUE:%s]',_0x616c42,_0x453bc2,_0x433be6);}});}})[_0xe012('0x34')](function(_0x1d5c70){logger['error'](_0xe012('0x37'),_0x616c42,_0x25be99[_0xe012('0x7')][_0x433be6][_0xe012('0x2a')],_0x453bc2,_0x433be6);})[_0xe012('0x38')](function(){delete _0x25be99[_0xe012('0xa')][_0x616c42];});}catch(_0x3f616f){logger[_0xe012('0x35')](_0xe012('0x39'),_0x3f616f['message']);}};Acw[_0xe012('0x19')][_0xe012('0x2c')]=function(_0x1778a2){try{var _0x3c148e=this;if(_0x3c148e[_0xe012('0x9')][_0x1778a2]){_0x3c148e[_0xe012('0x9')][_0x1778a2][_0xe012('0x2b')]=![];var _0x218856=_0x3c148e[_0xe012('0x9')][_0x1778a2][_0xe012('0x30')];var _0x159327=_0x3c148e[_0xe012('0x9')][_0x1778a2][_0xe012('0x31')];var _0x49a677=_0x3c148e[_0xe012('0x7')][_0x159327][_0xe012('0x2a')];logger['info'](_0xe012('0x3a'),_0x218856,_0x1778a2);RpcUser[_0xe012('0x3b')](this[_0xe012('0x8')][_0x1778a2]);RpcVoiceAgentReport['update']({'acwtime':_0x49a677,'agentacw':!![]},_0x218856,_0x1778a2)[_0xe012('0x22')](function(_0x27e27a){logger[_0xe012('0x29')](_0xe012('0x33'),_0x218856,_0x49a677,_0x27e27a);})['catch'](function(_0x4d6b9b){logger[_0xe012('0x35')](_0xe012('0x36'),_0x218856,_0x4d6b9b);});}else{logger['error'](_0xe012('0x3c'),_0x1778a2);if(_0x3c148e['timers']){logger[_0xe012('0x29')](_0xe012('0x3d'),JSON[_0xe012('0x3e')](_0x3c148e[_0xe012('0x9')]));}}}catch(_0xc9e2a5){logger['error']('[ACW][STOP]\x20%s',_0xc9e2a5[_0xe012('0x3f')]);}};Acw[_0xe012('0x19')]['syncAgentConnect']=function(_0xe8ac1e){try{if(this[_0xe012('0x7')][_0xe8ac1e[_0xe012('0x31')]]&&(this[_0xe012('0x7')][_0xe8ac1e[_0xe012('0x31')]][_0xe012('0x40')]||this[_0xe012('0x7')][_0xe8ac1e[_0xe012('0x31')]]['mandatoryDisposition'])){if(this['agents'][_0xe8ac1e[_0xe012('0x1b')]]){this[_0xe012('0xa')][_0xe8ac1e[_0xe012('0x30')]]={'queue':_0xe8ac1e[_0xe012('0x31')],'interface':_0xe8ac1e[_0xe012('0x1b')],'destlinkedid':_0xe8ac1e[_0xe012('0x27')]};}}}catch(_0xf4214f){logger[_0xe012('0x35')](_0xe012('0x41'),_0xf4214f[_0xe012('0x3f')]);}};Acw[_0xe012('0x19')]['syncAgentConnectPreview']=function(_0x36fd58){try{if(this[_0xe012('0x7')][_0x36fd58[_0xe012('0x31')]]&&(this[_0xe012('0x7')][_0x36fd58[_0xe012('0x31')]][_0xe012('0x40')]||this[_0xe012('0x7')][_0x36fd58['queue']]['mandatoryDisposition'])){if(this[_0xe012('0x8')][_0x36fd58['interface']]){this[_0xe012('0xa')][_0x36fd58['uniqueid']]={'queue':_0x36fd58[_0xe012('0x31')],'interface':_0x36fd58[_0xe012('0x1b')]};}}}catch(_0xee1430){logger[_0xe012('0x35')]('[ACW][syncAgentConnectPreview]\x20%s',_0xee1430[_0xe012('0x3f')]);}};Acw[_0xe012('0x19')][_0xe012('0x42')]=function(_0x1cb7bd){try{if(this[_0xe012('0xa')][_0x1cb7bd[_0xe012('0x30')]]&&_[_0xe012('0x43')](this[_0xe012('0xa')][_0x1cb7bd[_0xe012('0x30')]][_0xe012('0x26')])){logger[_0xe012('0x29')](_0xe012('0x44'),_0x1cb7bd[_0xe012('0x30')]);this[_0xe012('0x1a')](_0x1cb7bd[_0xe012('0x30')]);}else if(this['channels'][_0x1cb7bd[_0xe012('0x45')]]&&_[_0xe012('0x43')](this[_0xe012('0xa')][_0x1cb7bd[_0xe012('0x45')]][_0xe012('0x26')])){logger[_0xe012('0x29')]('[%s][HANGUP:LINKEDID]',_0x1cb7bd[_0xe012('0x45')]);this['startAcw'](_0x1cb7bd[_0xe012('0x45')]);}}catch(_0x915761){logger[_0xe012('0x35')]('[ACW][syncHangupRequest]\x20%s',_0x915761[_0xe012('0x3f')]);}};Acw['prototype'][_0xe012('0x10')]=function(_0x27e1c1){try{if(this[_0xe012('0xa')][_0x27e1c1['uniqueid']]&&this[_0xe012('0xa')][_0x27e1c1[_0xe012('0x30')]][_0xe012('0x26')]){logger[_0xe012('0x29')]('[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]',_0x27e1c1[_0xe012('0x30')]);this[_0xe012('0x1a')](_0x27e1c1['uniqueid']);}else if(this[_0xe012('0xa')][_0x27e1c1['linkedid']]&&this[_0xe012('0xa')][_0x27e1c1[_0xe012('0x45')]][_0xe012('0x26')]){logger['info'](_0xe012('0x46'),_0x27e1c1[_0xe012('0x45')]);this[_0xe012('0x1a')](_0x27e1c1[_0xe012('0x45')]);}}catch(_0xc5e5aa){logger[_0xe012('0x35')](_0xe012('0x47'),_0xc5e5aa[_0xe012('0x3f')]);}};Acw[_0xe012('0x19')]['syncAttendedTransfer']=function(_0x2773fc){try{if(!_[_0xe012('0x48')](this[_0xe012('0xa')][_0x2773fc['transfereeuniqueid']])){this[_0xe012('0x1a')](_0x2773fc[_0xe012('0x49')]);if(this[_0xe012('0xa')][_0x2773fc[_0xe012('0x4a')]]){this[_0xe012('0xa')][_0x2773fc[_0xe012('0x4a')]]['attended']=!![];this[_0xe012('0xa')][_0x2773fc[_0xe012('0x4b')]]=this[_0xe012('0xa')][_0x2773fc[_0xe012('0x4a')]];delete this['channels'][_0x2773fc[_0xe012('0x4a')]];}}else if(!_[_0xe012('0x48')](this[_0xe012('0xa')][_0x2773fc[_0xe012('0x4b')]])){this[_0xe012('0x1a')](_0x2773fc[_0xe012('0x4b')]);if(this[_0xe012('0xa')][_0x2773fc[_0xe012('0x4c')]]){this[_0xe012('0xa')][_0x2773fc['origtransfereruniqueid']][_0xe012('0x26')]=!![];this[_0xe012('0xa')][_0x2773fc[_0xe012('0x49')]]=this[_0xe012('0xa')][_0x2773fc[_0xe012('0x4c')]];delete this['channels'][_0x2773fc['origtransfereruniqueid']];}}}catch(_0x51f49d){logger[_0xe012('0x35')]('[ACW][syncAttendedTransfer]\x20%s',_0x51f49d['message']);}};Acw[_0xe012('0x19')][_0xe012('0x14')]=function(_0x5c9fab){try{if(this[_0xe012('0xa')][_0x5c9fab[_0xe012('0x4d')]]){logger['info'](_0xe012('0x4e'),JSON[_0xe012('0x3e')](_0x5c9fab[_0xe012('0x4d')]));this[_0xe012('0x1a')](_0x5c9fab['transfereruniqueid']);}else if(this[_0xe012('0xa')][_0x5c9fab[_0xe012('0x4f')]]){logger[_0xe012('0x29')](_0xe012('0x50'),JSON['stringify'](_0x5c9fab[_0xe012('0x4f')]));this['startAcw'](_0x5c9fab[_0xe012('0x4f')]);}}catch(_0x5881c5){logger['error'](_0xe012('0x51'),_0x5881c5[_0xe012('0x3f')]);}};Acw[_0xe012('0x19')][_0xe012('0x11')]=function(_0x270e8d){try{if(this['voiceQueues'][_0x270e8d[_0xe012('0x31')]]&&this[_0xe012('0x7')][_0x270e8d[_0xe012('0x31')]][_0xe012('0x52')]==='all'){if(this[_0xe012('0x8')][_0x270e8d['interface']]){logger[_0xe012('0x29')](_0xe012('0x53'),_0x270e8d[_0xe012('0x30')],_0x270e8d[_0xe012('0x1b')],_0x270e8d[_0xe012('0x31')]);return RpcUser[_0xe012('0x28')](this[_0xe012('0x8')][_0x270e8d[_0xe012('0x1b')]],_0xe012('0x54'),_0x270e8d[_0xe012('0x30')]);}}}catch(_0x47a20e){logger[_0xe012('0x35')](_0xe012('0x55'),_0x47a20e[_0xe012('0x3f')]);}};module['exports']=Acw; \ No newline at end of file +var _0x3e5d=['syncBlindTransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','diff','seconds','prototype','startAcw','queue','ACW','mandatoryDisposition','mandatoryDispositionPause','name','Action','QueuePause','then','getAgent','voicePause','[%s][START][AGENT:%s][QUEUE:%s]','destlinkedid','savePause','info','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','timer','stopAcw','lastPauseAt','format','YYYY-MM-DD\x20HH:mm:ss','uniqueid','updateAcw','catch','[%s][UPDATE][ERRORS:%s]','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','error','finally','[ACW][START]\x20%s','saveUnpause','update','[%s][UPDATE][ACWTIME:%s]','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','stringify','[ACW][STOP]\x20%s','message','interface','[ACW][syncAgentConnect]\x20%s','[ACW][syncAgentConnectPreview]\x20%s','isUndefined','attended','[%s][HANGUP:UNIQUEID]','linkedid','[%s][HANGUP:LINKEDID]','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','[ACW][syncHangup]\x20%s','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','transfererlinkedid','[ACW][syncBlindTransfer]\x20%s','autopause','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','exports','util','lodash','moment','../ami','../../../config/logger','acw','../rpc/voiceAgentReport','voiceQueues','agents','timers','channels','agentconnect','syncAgentConnect','bind','hanguprequest','syncHangupRequest','syncHangup','agentringnoanswer','syncAgentRingNoAnswer','attendedtransfer','blindtransfer'];(function(_0x866893,_0x5d1eaf){var _0x12f9a7=function(_0x47fb12){while(--_0x47fb12){_0x866893['push'](_0x866893['shift']());}};_0x12f9a7(++_0x5d1eaf);}(_0x3e5d,0x15b));var _0xd3e5=function(_0x1cf1e1,_0x2f49f6){_0x1cf1e1=_0x1cf1e1-0x0;var _0x358c4c=_0x3e5d[_0x1cf1e1];return _0x358c4c;};'use strict';var util=require(_0xd3e5('0x0'));var _=require(_0xd3e5('0x1'));var moment=require(_0xd3e5('0x2'));var ami=require(_0xd3e5('0x3'));var logger=require(_0xd3e5('0x4'))(_0xd3e5('0x5'));var RpcUser=require('../rpc/user');var RpcVoiceAgentReport=require(_0xd3e5('0x6'));function Acw(_0x192841){this[_0xd3e5('0x7')]=_0x192841[_0xd3e5('0x7')];this[_0xd3e5('0x8')]=_0x192841[_0xd3e5('0x8')];this[_0xd3e5('0x9')]=_0x192841['timers'];this[_0xd3e5('0xa')]={};ami['on'](_0xd3e5('0xb'),this[_0xd3e5('0xc')][_0xd3e5('0xd')](this));ami['on'](_0xd3e5('0xe'),this[_0xd3e5('0xf')][_0xd3e5('0xd')](this));ami['on']('hangup',this[_0xd3e5('0x10')][_0xd3e5('0xd')](this));ami['on'](_0xd3e5('0x11'),this[_0xd3e5('0x12')][_0xd3e5('0xd')](this));ami['on'](_0xd3e5('0x13'),this['syncAttendedTransfer'][_0xd3e5('0xd')](this));ami['on'](_0xd3e5('0x14'),this[_0xd3e5('0x15')]['bind'](this));ami['on'](_0xd3e5('0x16'),this[_0xd3e5('0x17')]['bind'](this));}function getDiff(_0x24a502){var _0x4e7983=moment()[_0xd3e5('0x18')](0x0);var _0x154afb=moment(_0x24a502)[_0xd3e5('0x18')](0x0);return _0x4e7983[_0xd3e5('0x19')](_0x154afb,_0xd3e5('0x1a'));}Acw[_0xd3e5('0x1b')][_0xd3e5('0x1c')]=function(_0x17c817){try{var _0x31b94f=this;var _0x3107c1=this[_0xd3e5('0xa')][_0x17c817]['interface'];var _0x144a64=this[_0xd3e5('0xa')][_0x17c817][_0xd3e5('0x1d')];var _0x3d5fcb=this[_0xd3e5('0x7')][_0x144a64];var _0x5a67b2=![];var _0x2959ce=_0xd3e5('0x1e');if(_0x3d5fcb[_0xd3e5('0x1f')]){if(_0x3d5fcb[_0xd3e5('0x20')][_0xd3e5('0x21')]){_0x5a67b2=!![];_0x2959ce=_0x3d5fcb[_0xd3e5('0x20')][_0xd3e5('0x21')];}}ami[_0xd3e5('0x22')]({'action':_0xd3e5('0x23'),'interface':_0x3107c1,'paused':!![],'reason':_0x2959ce})[_0xd3e5('0x24')](function(_0x539d89){if(_0x31b94f[_0xd3e5('0x8')][_0x3107c1]){return RpcUser[_0xd3e5('0x25')](_0x31b94f[_0xd3e5('0x8')][_0x3107c1]['id'])[_0xd3e5('0x24')](function(_0x118b5f){if(_0x118b5f&&!_0x118b5f[_0xd3e5('0x26')]){logger['info'](_0xd3e5('0x27'),_0x17c817,_0x3107c1,_0x144a64);var _0x25ab31=_0x31b94f[_0xd3e5('0xa')][_0x17c817]['attended']&&_0x31b94f['channels'][_0x17c817][_0xd3e5('0x28')]?_0x31b94f[_0xd3e5('0xa')][_0x17c817][_0xd3e5('0x28')]:_0x17c817;return RpcUser[_0xd3e5('0x29')](_0x31b94f[_0xd3e5('0x8')][_0x3107c1],_0x2959ce,_0x25ab31)['then'](function(_0x500022){if(!_0x5a67b2){_0x31b94f[_0xd3e5('0x9')][_0x3107c1]={};logger[_0xd3e5('0x2a')](_0xd3e5('0x2b'),_0x17c817,_0x31b94f['voiceQueues'][_0x144a64][_0xd3e5('0x2c')],_0x3107c1,_0x144a64);_0x31b94f['timers'][_0x3107c1][_0xd3e5('0x2d')]=setTimeout(_0x31b94f[_0xd3e5('0x2e')]['bind'](_0x31b94f,_0x3107c1),_0x31b94f[_0xd3e5('0x7')][_0x144a64][_0xd3e5('0x2c')]*0x3e8);_0x31b94f[_0xd3e5('0x9')][_0x3107c1][_0xd3e5('0x2f')]=moment()[_0xd3e5('0x30')](_0xd3e5('0x31'));_0x31b94f[_0xd3e5('0x9')][_0x3107c1][_0xd3e5('0x32')]=_0x17c817;_0x31b94f[_0xd3e5('0x9')][_0x3107c1][_0xd3e5('0x1d')]=_0x144a64;_0x31b94f[_0xd3e5('0x9')][_0x3107c1][_0xd3e5('0x33')]=function(){var _0x5b43bf=getDiff(_0x31b94f[_0xd3e5('0x9')][_0x3107c1]['lastPauseAt']);clearTimeout(_0x31b94f[_0xd3e5('0x9')][_0x3107c1][_0xd3e5('0x2d')]);_0x31b94f[_0xd3e5('0x9')][_0x3107c1][_0xd3e5('0x2d')]=![];RpcVoiceAgentReport['update']({'acwtime':_0x5b43bf},_0x31b94f[_0xd3e5('0x9')][_0x3107c1][_0xd3e5('0x32')],_0x3107c1)['then'](function(_0x37959a){logger[_0xd3e5('0x2a')]('[%s][UPDATE][ACWTIME:%s]',_0x17c817,_0x5b43bf,_0x37959a);})[_0xd3e5('0x34')](function(_0x38b69a){logger['error'](_0xd3e5('0x35'),_0x17c817,_0x38b69a);});delete _0x31b94f['timers'][_0x3107c1];};}});}else{logger[_0xd3e5('0x2a')](_0xd3e5('0x36'),_0x17c817,_0x3107c1,_0x144a64);}});}})[_0xd3e5('0x34')](function(_0x198759){logger[_0xd3e5('0x37')](_0xd3e5('0x2b'),_0x17c817,_0x31b94f[_0xd3e5('0x7')][_0x144a64][_0xd3e5('0x2c')],_0x3107c1,_0x144a64);})[_0xd3e5('0x38')](function(){delete _0x31b94f['channels'][_0x17c817];});}catch(_0x298dd6){logger[_0xd3e5('0x37')](_0xd3e5('0x39'),_0x298dd6['message']);}};Acw['prototype'][_0xd3e5('0x2e')]=function(_0x54133c){try{var _0x1a7501=this;if(_0x1a7501[_0xd3e5('0x9')][_0x54133c]){_0x1a7501['timers'][_0x54133c]['timer']=![];var _0x46c1b7=_0x1a7501[_0xd3e5('0x9')][_0x54133c][_0xd3e5('0x32')];var _0x1d77de=_0x1a7501['timers'][_0x54133c][_0xd3e5('0x1d')];var _0x3f37f7=_0x1a7501[_0xd3e5('0x7')][_0x1d77de][_0xd3e5('0x2c')];logger[_0xd3e5('0x2a')]('[%s][TIMER][STOP][AGENT:%s]',_0x46c1b7,_0x54133c);RpcUser[_0xd3e5('0x3a')](this[_0xd3e5('0x8')][_0x54133c]);RpcVoiceAgentReport[_0xd3e5('0x3b')]({'acwtime':_0x3f37f7,'agentacw':!![]},_0x46c1b7,_0x54133c)[_0xd3e5('0x24')](function(_0x45b216){logger[_0xd3e5('0x2a')](_0xd3e5('0x3c'),_0x46c1b7,_0x3f37f7,_0x45b216);})['catch'](function(_0x483932){logger[_0xd3e5('0x37')]('[%s][UPDATE][ERRORS:%s]',_0x46c1b7,_0x483932);});}else{logger[_0xd3e5('0x37')](_0xd3e5('0x3d'),_0x54133c);if(_0x1a7501[_0xd3e5('0x9')]){logger[_0xd3e5('0x2a')]('[ACW][TIMERS]',JSON[_0xd3e5('0x3e')](_0x1a7501[_0xd3e5('0x9')]));}}}catch(_0x4504c6){logger[_0xd3e5('0x37')](_0xd3e5('0x3f'),_0x4504c6[_0xd3e5('0x40')]);}};Acw[_0xd3e5('0x1b')][_0xd3e5('0xc')]=function(_0x3ffb00){try{if(this[_0xd3e5('0x7')][_0x3ffb00[_0xd3e5('0x1d')]]&&(this[_0xd3e5('0x7')][_0x3ffb00[_0xd3e5('0x1d')]][_0xd3e5('0x5')]||this['voiceQueues'][_0x3ffb00[_0xd3e5('0x1d')]][_0xd3e5('0x1f')])){if(this[_0xd3e5('0x8')][_0x3ffb00[_0xd3e5('0x41')]]){this[_0xd3e5('0xa')][_0x3ffb00[_0xd3e5('0x32')]]={'queue':_0x3ffb00[_0xd3e5('0x1d')],'interface':_0x3ffb00[_0xd3e5('0x41')],'destlinkedid':_0x3ffb00[_0xd3e5('0x28')]};}}}catch(_0x248e8d){logger[_0xd3e5('0x37')](_0xd3e5('0x42'),_0x248e8d[_0xd3e5('0x40')]);}};Acw[_0xd3e5('0x1b')]['syncAgentConnectPreview']=function(_0x37d096){try{if(this[_0xd3e5('0x7')][_0x37d096[_0xd3e5('0x1d')]]&&(this[_0xd3e5('0x7')][_0x37d096[_0xd3e5('0x1d')]]['acw']||this['voiceQueues'][_0x37d096['queue']][_0xd3e5('0x1f')])){if(this[_0xd3e5('0x8')][_0x37d096[_0xd3e5('0x41')]]){this[_0xd3e5('0xa')][_0x37d096[_0xd3e5('0x32')]]={'queue':_0x37d096[_0xd3e5('0x1d')],'interface':_0x37d096[_0xd3e5('0x41')]};}}}catch(_0x27cece){logger[_0xd3e5('0x37')](_0xd3e5('0x43'),_0x27cece[_0xd3e5('0x40')]);}};Acw[_0xd3e5('0x1b')]['syncHangupRequest']=function(_0x598f62){try{if(this[_0xd3e5('0xa')][_0x598f62[_0xd3e5('0x32')]]&&_[_0xd3e5('0x44')](this['channels'][_0x598f62[_0xd3e5('0x32')]][_0xd3e5('0x45')])){logger[_0xd3e5('0x2a')](_0xd3e5('0x46'),_0x598f62[_0xd3e5('0x32')]);this['startAcw'](_0x598f62['uniqueid']);}else if(this[_0xd3e5('0xa')][_0x598f62[_0xd3e5('0x47')]]&&_[_0xd3e5('0x44')](this[_0xd3e5('0xa')][_0x598f62[_0xd3e5('0x47')]]['attended'])){logger[_0xd3e5('0x2a')](_0xd3e5('0x48'),_0x598f62[_0xd3e5('0x47')]);this[_0xd3e5('0x1c')](_0x598f62[_0xd3e5('0x47')]);}}catch(_0x3e7d31){logger[_0xd3e5('0x37')](_0xd3e5('0x49'),_0x3e7d31[_0xd3e5('0x40')]);}};Acw[_0xd3e5('0x1b')][_0xd3e5('0x10')]=function(_0x48c32d){try{if(this['channels'][_0x48c32d[_0xd3e5('0x32')]]&&this[_0xd3e5('0xa')][_0x48c32d[_0xd3e5('0x32')]][_0xd3e5('0x45')]){logger['info'](_0xd3e5('0x4a'),_0x48c32d[_0xd3e5('0x32')]);this[_0xd3e5('0x1c')](_0x48c32d[_0xd3e5('0x32')]);}else if(this['channels'][_0x48c32d[_0xd3e5('0x47')]]&&this['channels'][_0x48c32d[_0xd3e5('0x47')]][_0xd3e5('0x45')]){logger[_0xd3e5('0x2a')](_0xd3e5('0x4b'),_0x48c32d[_0xd3e5('0x47')]);this[_0xd3e5('0x1c')](_0x48c32d[_0xd3e5('0x47')]);}}catch(_0x1ef780){logger[_0xd3e5('0x37')](_0xd3e5('0x4c'),_0x1ef780[_0xd3e5('0x40')]);}};Acw[_0xd3e5('0x1b')]['syncAttendedTransfer']=function(_0x3b4c5c){try{if(!_[_0xd3e5('0x4d')](this[_0xd3e5('0xa')][_0x3b4c5c['transfereeuniqueid']])){this[_0xd3e5('0x1c')](_0x3b4c5c[_0xd3e5('0x4e')]);if(this[_0xd3e5('0xa')][_0x3b4c5c['secondtransfereruniqueid']]){this[_0xd3e5('0xa')][_0x3b4c5c[_0xd3e5('0x4f')]][_0xd3e5('0x45')]=!![];this[_0xd3e5('0xa')][_0x3b4c5c[_0xd3e5('0x50')]]=this[_0xd3e5('0xa')][_0x3b4c5c[_0xd3e5('0x4f')]];delete this['channels'][_0x3b4c5c['secondtransfereruniqueid']];}}else if(!_[_0xd3e5('0x4d')](this['channels'][_0x3b4c5c[_0xd3e5('0x50')]])){this[_0xd3e5('0x1c')](_0x3b4c5c['transfertargetuniqueid']);if(this[_0xd3e5('0xa')][_0x3b4c5c['origtransfereruniqueid']]){this[_0xd3e5('0xa')][_0x3b4c5c['origtransfereruniqueid']][_0xd3e5('0x45')]=!![];this[_0xd3e5('0xa')][_0x3b4c5c[_0xd3e5('0x4e')]]=this[_0xd3e5('0xa')][_0x3b4c5c[_0xd3e5('0x51')]];delete this[_0xd3e5('0xa')][_0x3b4c5c[_0xd3e5('0x51')]];}}}catch(_0x4ecf80){logger['error'](_0xd3e5('0x52'),_0x4ecf80[_0xd3e5('0x40')]);}};Acw['prototype']['syncBlindTransfer']=function(_0x4e3ea3){try{if(this[_0xd3e5('0xa')][_0x4e3ea3[_0xd3e5('0x53')]]){logger[_0xd3e5('0x2a')](_0xd3e5('0x54'),JSON[_0xd3e5('0x3e')](_0x4e3ea3[_0xd3e5('0x53')]));this[_0xd3e5('0x1c')](_0x4e3ea3[_0xd3e5('0x53')]);}else if(this[_0xd3e5('0xa')][_0x4e3ea3[_0xd3e5('0x55')]]){logger['info']('[%s][BLINDTRANSFER:LINKEDID]',JSON[_0xd3e5('0x3e')](_0x4e3ea3[_0xd3e5('0x55')]));this['startAcw'](_0x4e3ea3[_0xd3e5('0x55')]);}}catch(_0x1b4fbd){logger[_0xd3e5('0x37')](_0xd3e5('0x56'),_0x1b4fbd[_0xd3e5('0x40')]);}};Acw[_0xd3e5('0x1b')]['syncAgentRingNoAnswer']=function(_0x382ff8){try{if(this[_0xd3e5('0x7')][_0x382ff8[_0xd3e5('0x1d')]]&&this['voiceQueues'][_0x382ff8[_0xd3e5('0x1d')]][_0xd3e5('0x57')]==='all'){if(this['agents'][_0x382ff8[_0xd3e5('0x41')]]){logger[_0xd3e5('0x2a')](_0xd3e5('0x58'),_0x382ff8[_0xd3e5('0x32')],_0x382ff8[_0xd3e5('0x41')],_0x382ff8[_0xd3e5('0x1d')]);return RpcUser[_0xd3e5('0x29')](this[_0xd3e5('0x8')][_0x382ff8['interface']],_0xd3e5('0x59'),_0x382ff8[_0xd3e5('0x32')]);}}}catch(_0x383002){logger[_0xd3e5('0x37')](_0xd3e5('0x5a'),_0x383002['message']);}};module[_0xd3e5('0x5b')]=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index a9dce68..ce1d897 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 _0x2098=['info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','close','connect','shutdown','fullybooted','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','then','catch','once','exports','util','lodash','../../config/logger','ami','../../config/environment','asterisk','port','username','password','keepConnected','Action','promisify','action','error','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','inspect','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','actionSipShowRegistry','sipshowregistry','devicestatelist','actionSipPeerStatus','actionQueueSummary','queuesummary','actionCoreShowChannels','coreshowchannels'];(function(_0x4ffaae,_0x1a9eb3){var _0x2078f6=function(_0x3571ab){while(--_0x3571ab){_0x4ffaae['push'](_0x4ffaae['shift']());}};_0x2078f6(++_0x1a9eb3);}(_0x2098,0x7e));var _0x8209=function(_0x272437,_0xd81a3b){_0x272437=_0x272437-0x0;var _0x4c0438=_0x2098[_0x272437];return _0x4c0438;};'use strict';var Manager=require('asterisk-manager');var BPromise=require('bluebird');var moment=require('moment');var util=require(_0x8209('0x0'));var _=require(_0x8209('0x1'));var logger=require(_0x8209('0x2'))(_0x8209('0x3'));var config=require(_0x8209('0x4'));var ami=new Manager(config[_0x8209('0x5')][_0x8209('0x6')],config[_0x8209('0x5')]['ip'],config[_0x8209('0x5')][_0x8209('0x7')],config[_0x8209('0x5')][_0x8209('0x8')],!![]);ami[_0x8209('0x9')]();ami[_0x8209('0xa')]=BPromise[_0x8209('0xb')](ami[_0x8209('0xc')]);function error(_0x3219a6){logger[_0x8209('0xd')](util[_0x8209('0xe')](_0x8209('0xf'),config['asterisk']['username'],config[_0x8209('0x5')]['ip'],config[_0x8209('0x5')][_0x8209('0x6')],util[_0x8209('0x10')](_0x3219a6,![],null)));}function close(){logger[_0x8209('0xd')](util['format'](_0x8209('0x11'),config[_0x8209('0x5')][_0x8209('0x7')],config[_0x8209('0x5')]['ip'],config['asterisk'][_0x8209('0x6')]));}ami[_0x8209('0x12')]=function(){return function(){return ami[_0x8209('0xa')]({'action':_0x8209('0x13')});};};ami['actionDeviceStateList']=function(){return function(){return ami['Action']({'action':_0x8209('0x14')});};};ami[_0x8209('0x15')]=function(){return function(){return ami[_0x8209('0xa')]({'action':'sippeerstatus'});};};ami[_0x8209('0x16')]=function(){return function(){return ami[_0x8209('0xa')]({'action':_0x8209('0x17')});};};ami[_0x8209('0x18')]=function(){return function(){return ami[_0x8209('0xa')]({'action':_0x8209('0x19')});};};function connect(_0x1b7679){logger[_0x8209('0x1a')](util[_0x8209('0xe')](_0x8209('0x1b'),config[_0x8209('0x5')][_0x8209('0x7')],config[_0x8209('0x5')]['ip'],config[_0x8209('0x5')][_0x8209('0x6')]));ami['once'](_0x8209('0xd'),error);ami['once'](_0x8209('0x1c'),close);}ami['on'](_0x8209('0x1d'),connect);ami['on'](_0x8209('0x1e'),function(_0xa7f91){logger[_0x8209('0x1a')](util[_0x8209('0xe')]('Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s',config[_0x8209('0x5')]['username'],config['asterisk']['ip'],config[_0x8209('0x5')][_0x8209('0x6')],util['inspect'](_0xa7f91,![],null)));});ami['on'](_0x8209('0x1f'),function(_0x1312fe){logger[_0x8209('0x1a')](util[_0x8209('0xe')](_0x8209('0x20'),config[_0x8209('0x5')][_0x8209('0x7')],config[_0x8209('0x5')]['ip'],config['asterisk'][_0x8209('0x6')]));return BPromise[_0x8209('0x21')]()[_0x8209('0x22')](ami[_0x8209('0x12')]())[_0x8209('0x22')](ami['actionDeviceStateList']())['then'](ami['actionSipPeerStatus']())['then'](ami['actionQueueSummary']())['then'](ami['actionCoreShowChannels']())[_0x8209('0x23')](function(_0x22ed8c){console['log'](_0x22ed8c);});});ami[_0x8209('0x24')](_0x8209('0xd'),error);ami[_0x8209('0x24')]('close',close);module[_0x8209('0x25')]=ami; \ No newline at end of file +var _0x3b38=['promisify','action','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','error','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','actionSipShowRegistry','devicestatelist','actionSipPeerStatus','sippeerstatus','actionQueueSummary','coreshowchannels','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','close','connect','shutdown','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','fullybooted','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','then','actionDeviceStateList','actionCoreShowChannels','catch','exports','bluebird','moment','util','lodash','../../config/logger','asterisk','port','username','password','keepConnected','Action'];(function(_0x3bb40e,_0x4ec80f){var _0x4eeed8=function(_0x5bfe3f){while(--_0x5bfe3f){_0x3bb40e['push'](_0x3bb40e['shift']());}};_0x4eeed8(++_0x4ec80f);}(_0x3b38,0x67));var _0x83b3=function(_0x4406e7,_0x33dba4){_0x4406e7=_0x4406e7-0x0;var _0x40ec5c=_0x3b38[_0x4406e7];return _0x40ec5c;};'use strict';var Manager=require('asterisk-manager');var BPromise=require(_0x83b3('0x0'));var moment=require(_0x83b3('0x1'));var util=require(_0x83b3('0x2'));var _=require(_0x83b3('0x3'));var logger=require(_0x83b3('0x4'))('ami');var config=require('../../config/environment');var ami=new Manager(config[_0x83b3('0x5')][_0x83b3('0x6')],config[_0x83b3('0x5')]['ip'],config['asterisk'][_0x83b3('0x7')],config[_0x83b3('0x5')][_0x83b3('0x8')],!![]);ami[_0x83b3('0x9')]();ami[_0x83b3('0xa')]=BPromise[_0x83b3('0xb')](ami[_0x83b3('0xc')]);function error(_0x44dfa2){logger['error'](util[_0x83b3('0xd')](_0x83b3('0xe'),config[_0x83b3('0x5')][_0x83b3('0x7')],config[_0x83b3('0x5')]['ip'],config['asterisk'][_0x83b3('0x6')],util['inspect'](_0x44dfa2,![],null)));}function close(){logger[_0x83b3('0xf')](util[_0x83b3('0xd')](_0x83b3('0x10'),config[_0x83b3('0x5')][_0x83b3('0x7')],config['asterisk']['ip'],config[_0x83b3('0x5')]['port']));}ami[_0x83b3('0x11')]=function(){return function(){return ami['Action']({'action':'sipshowregistry'});};};ami['actionDeviceStateList']=function(){return function(){return ami[_0x83b3('0xa')]({'action':_0x83b3('0x12')});};};ami[_0x83b3('0x13')]=function(){return function(){return ami[_0x83b3('0xa')]({'action':_0x83b3('0x14')});};};ami[_0x83b3('0x15')]=function(){return function(){return ami[_0x83b3('0xa')]({'action':'queuesummary'});};};ami['actionCoreShowChannels']=function(){return function(){return ami['Action']({'action':_0x83b3('0x16')});};};function connect(_0x449be3){logger[_0x83b3('0x17')](util[_0x83b3('0xd')](_0x83b3('0x18'),config[_0x83b3('0x5')][_0x83b3('0x7')],config['asterisk']['ip'],config[_0x83b3('0x5')]['port']));ami[_0x83b3('0x19')](_0x83b3('0xf'),error);ami[_0x83b3('0x19')](_0x83b3('0x1a'),close);}ami['on'](_0x83b3('0x1b'),connect);ami['on'](_0x83b3('0x1c'),function(_0x3ed249){logger[_0x83b3('0x17')](util[_0x83b3('0xd')](_0x83b3('0x1d'),config[_0x83b3('0x5')]['username'],config['asterisk']['ip'],config[_0x83b3('0x5')][_0x83b3('0x6')],util['inspect'](_0x3ed249,![],null)));});ami['on'](_0x83b3('0x1e'),function(_0xb485b6){logger['info'](util[_0x83b3('0xd')](_0x83b3('0x1f'),config[_0x83b3('0x5')][_0x83b3('0x7')],config[_0x83b3('0x5')]['ip'],config[_0x83b3('0x5')][_0x83b3('0x6')]));return BPromise[_0x83b3('0x20')]()[_0x83b3('0x21')](ami[_0x83b3('0x11')]())[_0x83b3('0x21')](ami[_0x83b3('0x22')]())['then'](ami[_0x83b3('0x13')]())['then'](ami[_0x83b3('0x15')]())[_0x83b3('0x21')](ami[_0x83b3('0x23')]())[_0x83b3('0x24')](function(_0x552a5e){console['log'](_0x552a5e);});});ami[_0x83b3('0x19')](_0x83b3('0xf'),error);ami['once']('close',close);module[_0x83b3('0x25')]=ami; \ No newline at end of file diff --git a/server/services/ami/client.js b/server/services/ami/client.js index ae89ac0..505f521 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 _0xac4a=['ami','client','http','then','debug','memberReport','error','message','result','catch','rpc','jayson/promise','bluebird','../../config/logger'];(function(_0x491cbe,_0x45c8ba){var _0x59449d=function(_0x21b463){while(--_0x21b463){_0x491cbe['push'](_0x491cbe['shift']());}};_0x59449d(++_0x45c8ba);}(_0xac4a,0x13f));var _0xaac4=function(_0x5ad6cd,_0x5e6599){_0x5ad6cd=_0x5ad6cd-0x0;var _0x3e301b=_0xac4a[_0x5ad6cd];return _0x3e301b;};'use strict';var jayson=require(_0xaac4('0x0'));var BPromise=require(_0xaac4('0x1'));var logger=require(_0xaac4('0x2'))(_0xaac4('0x3'));var client=jayson[_0xaac4('0x4')][_0xaac4('0x5')]({'port':0x2329});client['Request']=function(_0x58626e,_0x2af0f6){return new BPromise(function(_0x2a5762,_0x32d34c){return client['request'](_0x58626e,_0x2af0f6)[_0xaac4('0x6')](function(_0x53d03a){logger[_0xaac4('0x7')]('rpc',_0xaac4('0x8'),_0x58626e,_0x2af0f6,_0x53d03a);if(_0x53d03a[_0xaac4('0x9')]){logger['error']('rpc',_0xaac4('0x8'),_0x58626e,_0x53d03a['error'][_0xaac4('0xa')],_0x2af0f6);return _0x32d34c(_0x53d03a['error']['message']);}else{return _0x2a5762(_0x53d03a[_0xaac4('0xb')]);}})[_0xaac4('0xc')](function(_0x38d1d0){logger[_0xaac4('0x9')](_0xaac4('0xd'),'memberReport',_0x58626e,_0x38d1d0,_0x2af0f6);return _0x32d34c(_0x38d1d0);});});};module['exports']=client; \ No newline at end of file +var _0x9bde=['message','result','catch','exports','bluebird','ami','http','Request','request','debug','rpc','memberReport','error'];(function(_0x4884a7,_0x18e38a){var _0x56b60e=function(_0x2ba8a3){while(--_0x2ba8a3){_0x4884a7['push'](_0x4884a7['shift']());}};_0x56b60e(++_0x18e38a);}(_0x9bde,0xe1));var _0xe9bd=function(_0x2837c8,_0x5df47c){_0x2837c8=_0x2837c8-0x0;var _0x30590a=_0x9bde[_0x2837c8];return _0x30590a;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0xe9bd('0x0'));var logger=require('../../config/logger')(_0xe9bd('0x1'));var client=jayson['client'][_0xe9bd('0x2')]({'port':0x2329});client[_0xe9bd('0x3')]=function(_0x131f6a,_0x1c1b34){return new BPromise(function(_0x10822d,_0x1a4d14){return client[_0xe9bd('0x4')](_0x131f6a,_0x1c1b34)['then'](function(_0x4763e9){logger[_0xe9bd('0x5')](_0xe9bd('0x6'),_0xe9bd('0x7'),_0x131f6a,_0x1c1b34,_0x4763e9);if(_0x4763e9[_0xe9bd('0x8')]){logger[_0xe9bd('0x8')](_0xe9bd('0x6'),_0xe9bd('0x7'),_0x131f6a,_0x4763e9[_0xe9bd('0x8')][_0xe9bd('0x9')],_0x1c1b34);return _0x1a4d14(_0x4763e9['error']['message']);}else{return _0x10822d(_0x4763e9[_0xe9bd('0xa')]);}})[_0xe9bd('0xb')](function(_0x2601ac){logger['error'](_0xe9bd('0x6'),_0xe9bd('0x7'),_0x131f6a,_0x2601ac,_0x1c1b34);return _0x1a4d14(_0x2601ac);});});};module[_0xe9bd('0xc')]=client; \ No newline at end of file diff --git a/server/services/ami/dialer/action.js b/server/services/ami/dialer/action.js index 1623d08..fdc756d 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 _0x3c7b=['recallme','originatecalleridnum','prototype','getCaller','\x22%s\x22\x20<%s>','dialCutDigit','substring','util','isNil','string','voiceQueue','uniqueid','name','Contact','phone','firstName','lastName','number','queue','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','idHopper','ContactFirstName','callback','callbackuniqueid','callbackat'];(function(_0x56482c,_0x16118d){var _0x5aae7a=function(_0x52512f){while(--_0x52512f){_0x56482c['push'](_0x56482c['shift']());}};_0x5aae7a(++_0x16118d);}(_0x3c7b,0x183));var _0xb3c7=function(_0x45206e,_0x1d786d){_0x45206e=_0x45206e-0x0;var _0x12f285=_0x3c7b[_0x45206e];return _0x12f285;};'use strict';var util=require(_0xb3c7('0x0'));var _=require('lodash');var moment=require('moment');function checkNameSurname(_0x180edb,_0x44a67f,_0x181460){var _0x5f4dd7='';if(!_[_0xb3c7('0x1')](_0x44a67f)&&_0xb3c7('0x2')===typeof _0x44a67f){_0x5f4dd7+=_0x44a67f;}if(!_[_0xb3c7('0x1')](_0x181460)&&_0xb3c7('0x2')===typeof _0x181460){_0x5f4dd7+='\x20'+_0x181460;}if(_0x5f4dd7!==''){return _0x5f4dd7;}return _0x180edb;}function Action(_0x4c6e4e,_0xb2c2b,_0x11a6dd){this[_0xb3c7('0x3')]=_0x4c6e4e;this[_0xb3c7('0x4')]=_0x11a6dd||undefined;this[_0xb3c7('0x5')]=checkNameSurname(_0xb2c2b[_0xb3c7('0x6')][_0xb3c7('0x7')],_0xb2c2b[_0xb3c7('0x6')][_0xb3c7('0x8')],_0xb2c2b[_0xb3c7('0x6')][_0xb3c7('0x9')]);this[_0xb3c7('0xa')]=_0xb2c2b[_0xb3c7('0x6')]['phone'];this[_0xb3c7('0xb')]=_0x4c6e4e[_0xb3c7('0x5')];this['active']=_0xb2c2b['active']||![];this['type']=_0x4c6e4e['type'];this[_0xb3c7('0xc')]=_0x4c6e4e[_0xb3c7('0xc')]||0x3;this[_0xb3c7('0xd')]=_0xb2c2b[_0xb3c7('0xd')];this[_0xb3c7('0xe')]=_0xb2c2b[_0xb3c7('0xe')];this[_0xb3c7('0xf')]=_0xb2c2b[_0xb3c7('0xf')];this['countnoanswerretry']=_0xb2c2b[_0xb3c7('0x10')];this['countnosuchnumberretry']=_0xb2c2b[_0xb3c7('0x11')];this[_0xb3c7('0x12')]=_0xb2c2b[_0xb3c7('0x12')];this['countabandonedretry']=_0xb2c2b['countabandonedretry'];this['countmachineretry']=_0xb2c2b[_0xb3c7('0x13')];this[_0xb3c7('0x14')]=_0xb2c2b[_0xb3c7('0x14')];this[_0xb3c7('0x15')]=_0xb2c2b[_0xb3c7('0x15')];this['ListId']=_0xb2c2b[_0xb3c7('0x16')];this['UserId']=_0xb2c2b[_0xb3c7('0x17')];this[_0xb3c7('0x18')]=_0xb2c2b[_0xb3c7('0x18')];this[_0xb3c7('0x19')]=_0xb2c2b[_0xb3c7('0x19')];this[_0xb3c7('0x1a')]=_0xb2c2b['id'];this[_0xb3c7('0x1b')]=_0xb2c2b[_0xb3c7('0x6')][_0xb3c7('0x8')]||'';this['starttime']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0xb3c7('0x1c')]=_0xb2c2b[_0xb3c7('0x1c')];this[_0xb3c7('0x1d')]=_0xb2c2b[_0xb3c7('0x1d')];this['callbackat']=_0xb2c2b[_0xb3c7('0x1e')];this[_0xb3c7('0x1f')]=_0xb2c2b[_0xb3c7('0x1f')];this[_0xb3c7('0x20')]='';this['originatecalleridname']='';}Action[_0xb3c7('0x21')][_0xb3c7('0x22')]=function(){return util['format'](_0xb3c7('0x23'),this[_0xb3c7('0x5')],this[_0xb3c7('0x3')][_0xb3c7('0x24')]>0x0?this[_0xb3c7('0xa')][_0xb3c7('0x25')](this[_0xb3c7('0x3')][_0xb3c7('0x24')]):this[_0xb3c7('0xa')]);};Action[_0xb3c7('0x21')]['getQueue']=function(){return this[_0xb3c7('0xb')];};module['exports']=Action; \ No newline at end of file +var _0x5985=['countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ListId','UserId','VoiceQueueId','CampaignId','idHopper','ContactFirstName','starttime','format','YYYY-MM-DD\x20HH:mm:ss','callback','callbackat','recallme','originatecalleridnum','originatecalleridname','prototype','getCaller','\x22%s\x22\x20<%s>','name','number','substring','exports','util','lodash','moment','isNil','voiceQueue','uniqueid','Contact','phone','lastName','queue','active','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry'];(function(_0x5644d8,_0x5bff4f){var _0x3d742a=function(_0x519fc9){while(--_0x519fc9){_0x5644d8['push'](_0x5644d8['shift']());}};_0x3d742a(++_0x5bff4f);}(_0x5985,0x16a));var _0x5598=function(_0x3b02c8,_0x28fa16){_0x3b02c8=_0x3b02c8-0x0;var _0x381dfa=_0x5985[_0x3b02c8];return _0x381dfa;};'use strict';var util=require(_0x5598('0x0'));var _=require(_0x5598('0x1'));var moment=require(_0x5598('0x2'));function checkNameSurname(_0x5b0b84,_0x1327ad,_0x5ce251){var _0x4657ad='';if(!_[_0x5598('0x3')](_0x1327ad)&&'string'===typeof _0x1327ad){_0x4657ad+=_0x1327ad;}if(!_[_0x5598('0x3')](_0x5ce251)&&'string'===typeof _0x5ce251){_0x4657ad+='\x20'+_0x5ce251;}if(_0x4657ad!==''){return _0x4657ad;}return _0x5b0b84;}function Action(_0x3c314f,_0x23ed77,_0x2d218a){this[_0x5598('0x4')]=_0x3c314f;this[_0x5598('0x5')]=_0x2d218a||undefined;this['name']=checkNameSurname(_0x23ed77[_0x5598('0x6')][_0x5598('0x7')],_0x23ed77[_0x5598('0x6')]['firstName'],_0x23ed77[_0x5598('0x6')][_0x5598('0x8')]);this['number']=_0x23ed77[_0x5598('0x6')][_0x5598('0x7')];this[_0x5598('0x9')]=_0x3c314f['name'];this[_0x5598('0xa')]=_0x23ed77[_0x5598('0xa')]||![];this['type']=_0x3c314f['type'];this[_0x5598('0xb')]=_0x3c314f['dialQueueTimeout']||0x3;this[_0x5598('0xc')]=_0x23ed77['scheduledat'];this[_0x5598('0xd')]=_0x23ed77['countbusyretry'];this[_0x5598('0xe')]=_0x23ed77['countcongestionretry'];this[_0x5598('0xf')]=_0x23ed77[_0x5598('0xf')];this[_0x5598('0x10')]=_0x23ed77[_0x5598('0x10')];this['countdropretry']=_0x23ed77[_0x5598('0x11')];this['countabandonedretry']=_0x23ed77[_0x5598('0x12')];this[_0x5598('0x13')]=_0x23ed77['countmachineretry'];this[_0x5598('0x14')]=_0x23ed77[_0x5598('0x14')];this['ContactId']=_0x23ed77['ContactId'];this[_0x5598('0x15')]=_0x23ed77[_0x5598('0x15')];this[_0x5598('0x16')]=_0x23ed77['UserId'];this[_0x5598('0x17')]=_0x23ed77[_0x5598('0x17')];this['CampaignId']=_0x23ed77[_0x5598('0x18')];this[_0x5598('0x19')]=_0x23ed77['id'];this[_0x5598('0x1a')]=_0x23ed77[_0x5598('0x6')]['firstName']||'';this[_0x5598('0x1b')]=moment()[_0x5598('0x1c')](_0x5598('0x1d'));this[_0x5598('0x1e')]=_0x23ed77['callback'];this['callbackuniqueid']=_0x23ed77['callbackuniqueid'];this[_0x5598('0x1f')]=_0x23ed77[_0x5598('0x1f')];this['recallme']=_0x23ed77[_0x5598('0x20')];this[_0x5598('0x21')]='';this[_0x5598('0x22')]='';}Action[_0x5598('0x23')][_0x5598('0x24')]=function(){return util[_0x5598('0x1c')](_0x5598('0x25'),this[_0x5598('0x26')],this['voiceQueue']['dialCutDigit']>0x0?this[_0x5598('0x27')][_0x5598('0x28')](this['voiceQueue']['dialCutDigit']):this[_0x5598('0x27')]);};Action[_0x5598('0x23')]['getQueue']=function(){return this[_0x5598('0x9')];};module[_0x5598('0x29')]=Action; \ No newline at end of file diff --git a/server/services/ami/dialer/agentComplete.js b/server/services/ami/dialer/agentComplete.js index 62aab6d..82ffcc1 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 _0x7cee=['originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','seconds','statedesc','scheduledat','type','campaigntype','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','answertime','endtime','format','ringtime','holdtime','talktime','membername','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId'];(function(_0x26e312,_0x4c0fed){var _0x3d73ce=function(_0x41e646){while(--_0x41e646){_0x26e312['push'](_0x26e312['shift']());}};_0x3d73ce(++_0x4c0fed);}(_0x7cee,0x1a1));var _0xe7ce=function(_0x145b3c,_0x31ea4a){_0x145b3c=_0x145b3c-0x0;var _0x1b6e36=_0x7cee[_0x145b3c];return _0x1b6e36;};'use strict';var util=require(_0xe7ce('0x0'));var _=require(_0xe7ce('0x1'));var moment=require(_0xe7ce('0x2'));function getSeconds(_0x1f778b,_0x386096){var _0x9f2dbb=moment(_0x1f778b)['milliseconds'](0x0);var _0x511cbc=moment(_0x386096)[_0xe7ce('0x3')](0x0);return _0x9f2dbb[_0xe7ce('0x4')](_0x511cbc,_0xe7ce('0x5'));}function AgentComplete(_0x5dfc53,_0x5b9b71){this['state']=0x4;this[_0xe7ce('0x6')]='Answer';this[_0xe7ce('0x7')]=_0x5dfc53[_0xe7ce('0x7')];this['type']=_0x5dfc53[_0xe7ce('0x8')];this[_0xe7ce('0x9')]=_0x5dfc53[_0xe7ce('0x8')]==='outbound'?_0xe7ce('0xa'):_0x5dfc53[_0xe7ce('0x8')];this[_0xe7ce('0xb')]=_0x5dfc53[_0xe7ce('0xb')];this[_0xe7ce('0xc')]=_0x5dfc53[_0xe7ce('0xc')];this['countnoanswerretry']=_0x5dfc53[_0xe7ce('0xd')];this[_0xe7ce('0xe')]=_0x5dfc53[_0xe7ce('0xb')]+_0x5dfc53[_0xe7ce('0xc')]+_0x5dfc53['countnoanswerretry']+_0x5dfc53[_0xe7ce('0xf')]+_0x5dfc53[_0xe7ce('0x10')]+_0x5dfc53[_0xe7ce('0x11')]+_0x5dfc53[_0xe7ce('0x12')]+_0x5dfc53[_0xe7ce('0x13')];this[_0xe7ce('0xf')]=_0x5dfc53[_0xe7ce('0xf')];this[_0xe7ce('0x10')]=_0x5dfc53[_0xe7ce('0x10')];this['countabandonedretry']=_0x5dfc53['countabandonedretry'];this[_0xe7ce('0x12')]=_0x5dfc53[_0xe7ce('0x12')];this['countagentrejectretry']=_0x5dfc53[_0xe7ce('0x13')];this[_0xe7ce('0x14')]=_0x5b9b71[_0xe7ce('0x14')];this[_0xe7ce('0x15')]=_0x5dfc53[_0xe7ce('0x16')];this[_0xe7ce('0x17')]=_0x5dfc53[_0xe7ce('0x18')];this[_0xe7ce('0x19')]=_0x5dfc53[_0xe7ce('0x19')];this['responsetime']=_0x5dfc53[_0xe7ce('0x1a')];this[_0xe7ce('0x1b')]=_0x5dfc53[_0xe7ce('0x1b')];this[_0xe7ce('0x1c')]=moment()[_0xe7ce('0x1d')]('YYYY-MM-DD\x20HH:mm:ss');this[_0xe7ce('0x1e')]=getSeconds(_0x5dfc53[_0xe7ce('0x1a')],_0x5dfc53[_0xe7ce('0x19')]);this[_0xe7ce('0x1f')]=getSeconds(_0x5dfc53[_0xe7ce('0x1b')],_0x5dfc53[_0xe7ce('0x1a')]);this[_0xe7ce('0x20')]=getSeconds(this[_0xe7ce('0x1c')],_0x5dfc53[_0xe7ce('0x1b')]);this[_0xe7ce('0xa')]=_0x5b9b71['queue'];this['membername']=_0x5b9b71[_0xe7ce('0x21')];this['reason']=_0x5b9b71['reason'];this['callback']=_0x5dfc53[_0xe7ce('0x22')];this[_0xe7ce('0x23')]=_0x5dfc53[_0xe7ce('0x23')];this[_0xe7ce('0x24')]=_0x5dfc53[_0xe7ce('0x24')];this['recallme']=_0x5dfc53[_0xe7ce('0x25')];this[_0xe7ce('0x26')]=_0x5dfc53[_0xe7ce('0x26')];this[_0xe7ce('0x27')]=_0x5dfc53[_0xe7ce('0x27')];this['UserId']=_0x5dfc53[_0xe7ce('0x28')];this[_0xe7ce('0x29')]=_0x5dfc53[_0xe7ce('0x29')];this[_0xe7ce('0x2a')]=_0x5dfc53[_0xe7ce('0x2a')];this[_0xe7ce('0x2b')]=_0x5dfc53[_0xe7ce('0x2b')]||'';this[_0xe7ce('0x2c')]=_0x5dfc53[_0xe7ce('0x2c')]||'';}module[_0xe7ce('0x2d')]=AgentComplete; \ No newline at end of file +var _0xca6d=['countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','uniqueid','name','calleridnum','number','starttime','responsetime','answertime','endtime','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','talktime','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','exports','lodash','moment','milliseconds','diff','seconds','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xca6d,0x75));var _0xdca6=function(_0x126252,_0x2e41d4){_0x126252=_0x126252-0x0;var _0x589e99=_0xca6d[_0x126252];return _0x589e99;};'use strict';var util=require('util');var _=require(_0xdca6('0x0'));var moment=require(_0xdca6('0x1'));function getSeconds(_0x3bc794,_0x152b11){var _0x115e25=moment(_0x3bc794)[_0xdca6('0x2')](0x0);var _0x11f599=moment(_0x152b11)['milliseconds'](0x0);return _0x115e25[_0xdca6('0x3')](_0x11f599,_0xdca6('0x4'));}function AgentComplete(_0x358d0f,_0x1da642){this['state']=0x4;this['statedesc']='Answer';this[_0xdca6('0x5')]=_0x358d0f[_0xdca6('0x5')];this['type']=_0x358d0f[_0xdca6('0x6')];this[_0xdca6('0x7')]=_0x358d0f[_0xdca6('0x6')]===_0xdca6('0x8')?_0xdca6('0x9'):_0x358d0f[_0xdca6('0x6')];this['countbusyretry']=_0x358d0f[_0xdca6('0xa')];this['countcongestionretry']=_0x358d0f[_0xdca6('0xb')];this[_0xdca6('0xc')]=_0x358d0f['countnoanswerretry'];this[_0xdca6('0xd')]=_0x358d0f['countbusyretry']+_0x358d0f[_0xdca6('0xb')]+_0x358d0f[_0xdca6('0xc')]+_0x358d0f['countnosuchnumberretry']+_0x358d0f[_0xdca6('0xe')]+_0x358d0f[_0xdca6('0xf')]+_0x358d0f[_0xdca6('0x10')]+_0x358d0f[_0xdca6('0x11')];this['countnosuchnumberretry']=_0x358d0f[_0xdca6('0x12')];this[_0xdca6('0xe')]=_0x358d0f[_0xdca6('0xe')];this['countabandonedretry']=_0x358d0f[_0xdca6('0xf')];this[_0xdca6('0x10')]=_0x358d0f[_0xdca6('0x10')];this[_0xdca6('0x11')]=_0x358d0f[_0xdca6('0x11')];this[_0xdca6('0x13')]=_0x1da642['uniqueid'];this['calleridname']=_0x358d0f[_0xdca6('0x14')];this[_0xdca6('0x15')]=_0x358d0f[_0xdca6('0x16')];this[_0xdca6('0x17')]=_0x358d0f[_0xdca6('0x17')];this[_0xdca6('0x18')]=_0x358d0f[_0xdca6('0x18')];this[_0xdca6('0x19')]=_0x358d0f[_0xdca6('0x19')];this[_0xdca6('0x1a')]=moment()['format'](_0xdca6('0x1b'));this[_0xdca6('0x1c')]=getSeconds(_0x358d0f[_0xdca6('0x18')],_0x358d0f[_0xdca6('0x17')]);this[_0xdca6('0x1d')]=getSeconds(_0x358d0f[_0xdca6('0x19')],_0x358d0f[_0xdca6('0x18')]);this[_0xdca6('0x1e')]=getSeconds(this[_0xdca6('0x1a')],_0x358d0f[_0xdca6('0x19')]);this['queue']=_0x1da642['queue'];this[_0xdca6('0x1f')]=_0x1da642['membername'];this['reason']=_0x1da642[_0xdca6('0x20')];this[_0xdca6('0x21')]=_0x358d0f[_0xdca6('0x21')];this[_0xdca6('0x22')]=_0x358d0f[_0xdca6('0x22')];this[_0xdca6('0x23')]=_0x358d0f[_0xdca6('0x23')];this[_0xdca6('0x24')]=_0x358d0f['recallme'];this[_0xdca6('0x25')]=_0x358d0f[_0xdca6('0x25')];this[_0xdca6('0x26')]=_0x358d0f['ListId'];this[_0xdca6('0x27')]=_0x358d0f[_0xdca6('0x27')];this[_0xdca6('0x28')]=_0x358d0f[_0xdca6('0x28')];this[_0xdca6('0x29')]=_0x358d0f[_0xdca6('0x29')];this['originatecalleridnum']=_0x358d0f[_0xdca6('0x2a')]||'';this['originatecalleridname']=_0x358d0f['originatecalleridname']||'';}module[_0xdca6('0x2b')]=AgentComplete; \ No newline at end of file diff --git a/server/services/ami/dialer/final.js b/server/services/ami/dialer/final.js index dff3006..7c4c015 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 _0x106f=['scheduledat','type','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countabandonedretry','countmachineretry','countdropretry','countagentrejectretry','queue','calleridname','calleridnum','starttime','responsetime','ringtime','holdtime','talktime','callback','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','milliseconds','diff','seconds','uniqueid'];(function(_0x1b38ad,_0x5c1196){var _0x17bb1e=function(_0x252bcf){while(--_0x252bcf){_0x1b38ad['push'](_0x1b38ad['shift']());}};_0x17bb1e(++_0x5c1196);}(_0x106f,0x162));var _0xf106=function(_0x528ae6,_0x2d752d){_0x528ae6=_0x528ae6-0x0;var _0x1b22f7=_0x106f[_0x528ae6];return _0x1b22f7;};'use strict';var util=require(_0xf106('0x0'));var _=require(_0xf106('0x1'));var moment=require('moment');function getSeconds(_0x4014dd,_0x6d8236){var _0x59bc3a=moment(_0x4014dd)[_0xf106('0x2')](0x0);var _0x4ab04f=moment(_0x6d8236)[_0xf106('0x2')](0x0);return _0x59bc3a[_0xf106('0x3')](_0x4ab04f,_0xf106('0x4'));}function Final(_0x318376){this[_0xf106('0x5')]=_0x318376[_0xf106('0x5')];this[_0xf106('0x6')]=_0x318376['scheduledat'];this[_0xf106('0x7')]=_0x318376[_0xf106('0x7')];this['campaigntype']=_0x318376['type']==='outbound'?'queue':_0x318376['type'];this[_0xf106('0x8')]=_0x318376[_0xf106('0x8')];this[_0xf106('0x9')]=_0x318376[_0xf106('0x9')];this[_0xf106('0xa')]=_0x318376[_0xf106('0xa')];this[_0xf106('0xb')]=_0x318376[_0xf106('0x8')]+_0x318376[_0xf106('0x9')]+_0x318376[_0xf106('0xa')]+_0x318376[_0xf106('0xc')]+_0x318376['countdropretry']+_0x318376[_0xf106('0xd')]+_0x318376[_0xf106('0xe')]+_0x318376['countagentrejectretry'];this['countnosuchnumberretry']=_0x318376[_0xf106('0xc')];this[_0xf106('0xf')]=_0x318376[_0xf106('0xf')];this['countabandonedretry']=_0x318376[_0xf106('0xd')];this[_0xf106('0xe')]=_0x318376[_0xf106('0xe')];this['countagentrejectretry']=_0x318376[_0xf106('0x10')];this[_0xf106('0x11')]=_0x318376['queue'];this[_0xf106('0x12')]=_0x318376[_0xf106('0x12')];this[_0xf106('0x13')]=_0x318376['calleridnum'];this['starttime']=_0x318376[_0xf106('0x14')];this[_0xf106('0x15')]=_0x318376[_0xf106('0x15')];this['endtime']=_0x318376[_0xf106('0x15')];this[_0xf106('0x16')]=_0x318376[_0xf106('0x16')]||0x0;this[_0xf106('0x17')]=_0x318376[_0xf106('0x17')]||0x0;this[_0xf106('0x18')]=_0x318376[_0xf106('0x18')]||0x0;this[_0xf106('0x19')]=_0x318376[_0xf106('0x19')];this['callbackuniqueid']=_0x318376['callbackuniqueid'];this[_0xf106('0x1a')]=_0x318376['callbackat'];this[_0xf106('0x1b')]=_0x318376[_0xf106('0x1b')];this[_0xf106('0x1c')]=_0x318376[_0xf106('0x1c')];this[_0xf106('0x1d')]=_0x318376['ListId'];this['UserId']=_0x318376[_0xf106('0x1e')];this[_0xf106('0x1f')]=_0x318376[_0xf106('0x1f')];this[_0xf106('0x20')]=_0x318376[_0xf106('0x20')];this[_0xf106('0x21')]=_0x318376[_0xf106('0x21')]||'';this[_0xf106('0x22')]=_0x318376[_0xf106('0x22')]||'';}module[_0xf106('0x23')]=Final; \ No newline at end of file +var _0x4944=['CampaignId','originatecalleridnum','originatecalleridname','exports','util','moment','milliseconds','seconds','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridname','calleridnum','starttime','responsetime','endtime','ringtime','talktime','callback','callbackuniqueid','callbackat','ListId','UserId','VoiceQueueId'];(function(_0x4771de,_0x102b59){var _0x2c63ed=function(_0x3d7e60){while(--_0x3d7e60){_0x4771de['push'](_0x4771de['shift']());}};_0x2c63ed(++_0x102b59);}(_0x4944,0x6d));var _0x4494=function(_0x171695,_0x43d437){_0x171695=_0x171695-0x0;var _0x1dc26f=_0x4944[_0x171695];return _0x1dc26f;};'use strict';var util=require(_0x4494('0x0'));var _=require('lodash');var moment=require(_0x4494('0x1'));function getSeconds(_0x39932f,_0x2578d3){var _0x138f00=moment(_0x39932f)[_0x4494('0x2')](0x0);var _0x5074d9=moment(_0x2578d3)[_0x4494('0x2')](0x0);return _0x138f00['diff'](_0x5074d9,_0x4494('0x3'));}function Final(_0x1c2a03){this[_0x4494('0x4')]=_0x1c2a03[_0x4494('0x4')];this[_0x4494('0x5')]=_0x1c2a03[_0x4494('0x5')];this[_0x4494('0x6')]=_0x1c2a03[_0x4494('0x6')];this[_0x4494('0x7')]=_0x1c2a03['type']===_0x4494('0x8')?_0x4494('0x9'):_0x1c2a03[_0x4494('0x6')];this[_0x4494('0xa')]=_0x1c2a03['countbusyretry'];this['countcongestionretry']=_0x1c2a03[_0x4494('0xb')];this[_0x4494('0xc')]=_0x1c2a03[_0x4494('0xc')];this['countglobal']=_0x1c2a03['countbusyretry']+_0x1c2a03[_0x4494('0xb')]+_0x1c2a03[_0x4494('0xc')]+_0x1c2a03[_0x4494('0xd')]+_0x1c2a03[_0x4494('0xe')]+_0x1c2a03[_0x4494('0xf')]+_0x1c2a03[_0x4494('0x10')]+_0x1c2a03['countagentrejectretry'];this[_0x4494('0xd')]=_0x1c2a03[_0x4494('0xd')];this[_0x4494('0xe')]=_0x1c2a03[_0x4494('0xe')];this[_0x4494('0xf')]=_0x1c2a03[_0x4494('0xf')];this[_0x4494('0x10')]=_0x1c2a03['countmachineretry'];this[_0x4494('0x11')]=_0x1c2a03['countagentrejectretry'];this['queue']=_0x1c2a03[_0x4494('0x9')];this[_0x4494('0x12')]=_0x1c2a03['calleridname'];this['calleridnum']=_0x1c2a03[_0x4494('0x13')];this['starttime']=_0x1c2a03[_0x4494('0x14')];this[_0x4494('0x15')]=_0x1c2a03['responsetime'];this[_0x4494('0x16')]=_0x1c2a03['responsetime'];this[_0x4494('0x17')]=_0x1c2a03[_0x4494('0x17')]||0x0;this['holdtime']=_0x1c2a03['holdtime']||0x0;this[_0x4494('0x18')]=_0x1c2a03[_0x4494('0x18')]||0x0;this[_0x4494('0x19')]=_0x1c2a03[_0x4494('0x19')];this[_0x4494('0x1a')]=_0x1c2a03[_0x4494('0x1a')];this[_0x4494('0x1b')]=_0x1c2a03[_0x4494('0x1b')];this['recallme']=_0x1c2a03['recallme'];this['ContactId']=_0x1c2a03['ContactId'];this[_0x4494('0x1c')]=_0x1c2a03[_0x4494('0x1c')];this[_0x4494('0x1d')]=_0x1c2a03[_0x4494('0x1d')];this['VoiceQueueId']=_0x1c2a03[_0x4494('0x1e')];this[_0x4494('0x1f')]=_0x1c2a03['CampaignId'];this[_0x4494('0x20')]=_0x1c2a03[_0x4494('0x20')]||'';this[_0x4494('0x21')]=_0x1c2a03['originatecalleridname']||'';}module[_0x4494('0x22')]=Final; \ No newline at end of file diff --git a/server/services/ami/dialer/hangup.js b/server/services/ami/dialer/hangup.js index 31888b6..064ba9d 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 _0x7e20=['calleridname','name','calleridnum','starttime','responsetime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','talktime','queue','IVR','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','UserId','VoiceQueueId','CampaignId','exports','lodash','moment','milliseconds','diff','Answer','scheduledat','type','campaigntype','outbound','countbusyretry','countcongestionretry','countglobal','countnoanswerretry','countnosuchnumberretry','countmachineretry','countagentrejectretry','countdropretry','countabandonedretry','uniqueid'];(function(_0x3a35eb,_0x29fa51){var _0x4da7d7=function(_0x1464b8){while(--_0x1464b8){_0x3a35eb['push'](_0x3a35eb['shift']());}};_0x4da7d7(++_0x29fa51);}(_0x7e20,0x167));var _0x07e2=function(_0x93701a,_0x41eecb){_0x93701a=_0x93701a-0x0;var _0x55f2e1=_0x7e20[_0x93701a];return _0x55f2e1;};'use strict';var util=require('util');var _=require(_0x07e2('0x0'));var moment=require(_0x07e2('0x1'));function getSeconds(_0x4b55cd,_0x1feab3){var _0x57f6e5=moment(_0x4b55cd)[_0x07e2('0x2')](0x0);var _0x45a539=moment(_0x1feab3)[_0x07e2('0x2')](0x0);return _0x57f6e5[_0x07e2('0x3')](_0x45a539,'seconds');}function Hangup(_0x5eda16,_0x3d8250){this['state']=0x4;this['statedesc']=_0x07e2('0x4');this[_0x07e2('0x5')]=_0x5eda16[_0x07e2('0x5')];this[_0x07e2('0x6')]=_0x5eda16[_0x07e2('0x6')];this[_0x07e2('0x7')]=_0x5eda16[_0x07e2('0x6')]===_0x07e2('0x8')?'queue':_0x5eda16['type'];this[_0x07e2('0x9')]=_0x5eda16[_0x07e2('0x9')];this['countcongestionretry']=_0x5eda16[_0x07e2('0xa')];this['countnoanswerretry']=_0x5eda16['countnoanswerretry'];this[_0x07e2('0xb')]=_0x5eda16[_0x07e2('0x9')]+_0x5eda16[_0x07e2('0xa')]+_0x5eda16[_0x07e2('0xc')]+_0x5eda16[_0x07e2('0xd')]+_0x5eda16['countdropretry']+_0x5eda16['countabandonedretry']+_0x5eda16[_0x07e2('0xe')]+_0x5eda16[_0x07e2('0xf')];this[_0x07e2('0xd')]=_0x5eda16['countnosuchnumberretry'];this[_0x07e2('0x10')]=_0x5eda16[_0x07e2('0x10')];this[_0x07e2('0x11')]=_0x5eda16[_0x07e2('0x11')];this[_0x07e2('0xe')]=_0x5eda16[_0x07e2('0xe')];this[_0x07e2('0xf')]=_0x5eda16[_0x07e2('0xf')];this[_0x07e2('0x12')]=_0x3d8250['uniqueid'];this[_0x07e2('0x13')]=_0x5eda16[_0x07e2('0x14')];this[_0x07e2('0x15')]=_0x5eda16['number'];this['starttime']=_0x5eda16[_0x07e2('0x16')];this[_0x07e2('0x17')]=_0x5eda16[_0x07e2('0x17')];this[_0x07e2('0x18')]=moment()[_0x07e2('0x19')](_0x07e2('0x1a'));this[_0x07e2('0x1b')]=getSeconds(_0x5eda16['responsetime'],_0x5eda16[_0x07e2('0x16')]);this[_0x07e2('0x1c')]=0x0;this[_0x07e2('0x1d')]=getSeconds(this[_0x07e2('0x18')],_0x5eda16[_0x07e2('0x17')]);this[_0x07e2('0x1e')]=_0x5eda16[_0x07e2('0x1e')];this['membername']=_0x07e2('0x1f');this[_0x07e2('0x20')]=_0x3d8250['cause-txt'];this[_0x07e2('0x21')]=_0x5eda16[_0x07e2('0x21')];this['callbackuniqueid']=_0x5eda16[_0x07e2('0x22')];this['callbackat']=_0x5eda16[_0x07e2('0x23')];this['recallme']=_0x5eda16[_0x07e2('0x24')];this[_0x07e2('0x25')]=_0x5eda16[_0x07e2('0x25')];this['ListId']=_0x5eda16['ListId'];this[_0x07e2('0x26')]=_0x5eda16['UserId'];this[_0x07e2('0x27')]=_0x5eda16[_0x07e2('0x27')];this[_0x07e2('0x28')]=_0x5eda16[_0x07e2('0x28')];}module[_0x07e2('0x29')]=Hangup; \ No newline at end of file +var _0x7223=['countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','endtime','format','ringtime','holdtime','membername','IVR','cause-txt','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','util','moment','milliseconds','diff','seconds','state','statedesc','scheduledat','type','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry'];(function(_0x476107,_0x5a96cf){var _0x26c057=function(_0x52419a){while(--_0x52419a){_0x476107['push'](_0x476107['shift']());}};_0x26c057(++_0x5a96cf);}(_0x7223,0x116));var _0x3722=function(_0x50007c,_0x1cbf11){_0x50007c=_0x50007c-0x0;var _0x5c1ec7=_0x7223[_0x50007c];return _0x5c1ec7;};'use strict';var util=require(_0x3722('0x0'));var _=require('lodash');var moment=require(_0x3722('0x1'));function getSeconds(_0x819841,_0x4ecc7f){var _0x83a45d=moment(_0x819841)[_0x3722('0x2')](0x0);var _0x1bb8c2=moment(_0x4ecc7f)[_0x3722('0x2')](0x0);return _0x83a45d[_0x3722('0x3')](_0x1bb8c2,_0x3722('0x4'));}function Hangup(_0x4cdb6d,_0x10fbff){this[_0x3722('0x5')]=0x4;this[_0x3722('0x6')]='Answer';this[_0x3722('0x7')]=_0x4cdb6d[_0x3722('0x7')];this[_0x3722('0x8')]=_0x4cdb6d[_0x3722('0x8')];this['campaigntype']=_0x4cdb6d[_0x3722('0x8')]===_0x3722('0x9')?'queue':_0x4cdb6d['type'];this[_0x3722('0xa')]=_0x4cdb6d[_0x3722('0xa')];this[_0x3722('0xb')]=_0x4cdb6d[_0x3722('0xb')];this[_0x3722('0xc')]=_0x4cdb6d['countnoanswerretry'];this[_0x3722('0xd')]=_0x4cdb6d['countbusyretry']+_0x4cdb6d[_0x3722('0xb')]+_0x4cdb6d['countnoanswerretry']+_0x4cdb6d[_0x3722('0xe')]+_0x4cdb6d[_0x3722('0xf')]+_0x4cdb6d[_0x3722('0x10')]+_0x4cdb6d[_0x3722('0x11')]+_0x4cdb6d[_0x3722('0x12')];this[_0x3722('0xe')]=_0x4cdb6d['countnosuchnumberretry'];this[_0x3722('0xf')]=_0x4cdb6d[_0x3722('0xf')];this[_0x3722('0x10')]=_0x4cdb6d[_0x3722('0x10')];this[_0x3722('0x11')]=_0x4cdb6d['countmachineretry'];this[_0x3722('0x12')]=_0x4cdb6d['countagentrejectretry'];this['uniqueid']=_0x10fbff[_0x3722('0x13')];this[_0x3722('0x14')]=_0x4cdb6d[_0x3722('0x15')];this[_0x3722('0x16')]=_0x4cdb6d[_0x3722('0x17')];this[_0x3722('0x18')]=_0x4cdb6d[_0x3722('0x18')];this['responsetime']=_0x4cdb6d[_0x3722('0x19')];this[_0x3722('0x1a')]=moment()[_0x3722('0x1b')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x3722('0x1c')]=getSeconds(_0x4cdb6d[_0x3722('0x19')],_0x4cdb6d['starttime']);this[_0x3722('0x1d')]=0x0;this['talktime']=getSeconds(this[_0x3722('0x1a')],_0x4cdb6d[_0x3722('0x19')]);this['queue']=_0x4cdb6d['queue'];this[_0x3722('0x1e')]=_0x3722('0x1f');this['reason']=_0x10fbff[_0x3722('0x20')];this[_0x3722('0x21')]=_0x4cdb6d[_0x3722('0x21')];this[_0x3722('0x22')]=_0x4cdb6d[_0x3722('0x22')];this[_0x3722('0x23')]=_0x4cdb6d[_0x3722('0x23')];this['recallme']=_0x4cdb6d[_0x3722('0x24')];this[_0x3722('0x25')]=_0x4cdb6d['ContactId'];this[_0x3722('0x26')]=_0x4cdb6d[_0x3722('0x26')];this[_0x3722('0x27')]=_0x4cdb6d[_0x3722('0x27')];this[_0x3722('0x28')]=_0x4cdb6d[_0x3722('0x28')];this[_0x3722('0x29')]=_0x4cdb6d['CampaignId'];}module['exports']=Hangup; \ No newline at end of file diff --git a/server/services/ami/dialer/history.js b/server/services/ami/dialer/history.js index ddf084d..cebeb75 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 _0x3e59=['countagentrejectretry','countnosuchnumberretry','countmachineretry','number','starttime','responsetime','endtime','ringtime','talktime','callback','callbackuniqueid','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','moment','milliseconds','diff','seconds','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countabandonedretry'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x3e59,0xec));var _0x93e5=function(_0x38037a,_0x196abc){_0x38037a=_0x38037a-0x0;var _0x1a1246=_0x3e59[_0x38037a];return _0x1a1246;};'use strict';var util=require(_0x93e5('0x0'));var _=require('lodash');var moment=require(_0x93e5('0x1'));function getSeconds(_0x4ff060,_0x4d56ba){var _0x3ed98a=moment(_0x4ff060)[_0x93e5('0x2')](0x0);var _0x41ca33=moment(_0x4d56ba)[_0x93e5('0x2')](0x0);return _0x3ed98a[_0x93e5('0x3')](_0x41ca33,_0x93e5('0x4'));}function History(_0x571e48){this[_0x93e5('0x5')]=_0x571e48[_0x93e5('0x5')];this[_0x93e5('0x6')]=_0x571e48[_0x93e5('0x6')]||undefined;this['type']=_0x571e48[_0x93e5('0x7')];this[_0x93e5('0x8')]=_0x571e48['type']===_0x93e5('0x9')?_0x93e5('0xa'):_0x571e48[_0x93e5('0x7')];this[_0x93e5('0xb')]=_0x571e48[_0x93e5('0xb')];this[_0x93e5('0xc')]=_0x571e48[_0x93e5('0xc')];this[_0x93e5('0xd')]=_0x571e48[_0x93e5('0xd')];this[_0x93e5('0xe')]=_0x571e48['countbusyretry']+_0x571e48[_0x93e5('0xc')]+_0x571e48['countnoanswerretry']+_0x571e48['countnosuchnumberretry']+_0x571e48['countdropretry']+_0x571e48[_0x93e5('0xf')]+_0x571e48['countmachineretry']+_0x571e48[_0x93e5('0x10')];this[_0x93e5('0x11')]=_0x571e48[_0x93e5('0x11')];this['countdropretry']=_0x571e48['countdropretry'];this['countabandonedretry']=_0x571e48[_0x93e5('0xf')];this[_0x93e5('0x12')]=_0x571e48[_0x93e5('0x12')];this[_0x93e5('0x10')]=_0x571e48['countagentrejectretry'];this['queue']=_0x571e48[_0x93e5('0xa')];this['calleridname']=_0x571e48['name'];this['calleridnum']=_0x571e48[_0x93e5('0x13')];this[_0x93e5('0x14')]=_0x571e48[_0x93e5('0x14')];this[_0x93e5('0x15')]=_0x571e48['responsetime'];this[_0x93e5('0x16')]=_0x571e48['responsetime'];this[_0x93e5('0x17')]=getSeconds(_0x571e48[_0x93e5('0x15')],_0x571e48[_0x93e5('0x14')]);this['holdtime']=0x0;this[_0x93e5('0x18')]=0x0;this[_0x93e5('0x19')]=_0x571e48[_0x93e5('0x19')];this['callbackuniqueid']=_0x571e48[_0x93e5('0x1a')];this['callbackat']=_0x571e48['callbackat'];this[_0x93e5('0x1b')]=_0x571e48[_0x93e5('0x1b')];this['ContactId']=_0x571e48[_0x93e5('0x1c')];this[_0x93e5('0x1d')]=_0x571e48[_0x93e5('0x1d')];this['UserId']=_0x571e48[_0x93e5('0x1e')];this[_0x93e5('0x1f')]=_0x571e48['VoiceQueueId'];this[_0x93e5('0x20')]=_0x571e48[_0x93e5('0x20')];this['originatecalleridnum']=_0x571e48[_0x93e5('0x21')]||'';this[_0x93e5('0x22')]=_0x571e48[_0x93e5('0x22')]||'';}module[_0x93e5('0x23')]=History; \ No newline at end of file +var _0x46de=['exports','lodash','moment','milliseconds','diff','seconds','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','countabandonedretry','calleridname','name','calleridnum','number','starttime','responsetime','ringtime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname'];(function(_0x2718d7,_0x460200){var _0x29faf0=function(_0x97b4a8){while(--_0x97b4a8){_0x2718d7['push'](_0x2718d7['shift']());}};_0x29faf0(++_0x460200);}(_0x46de,0x160));var _0xe46d=function(_0x50efff,_0x16022a){_0x50efff=_0x50efff-0x0;var _0x337538=_0x46de[_0x50efff];return _0x337538;};'use strict';var util=require('util');var _=require(_0xe46d('0x0'));var moment=require(_0xe46d('0x1'));function getSeconds(_0x4f6fe7,_0x28fcb2){var _0x414edd=moment(_0x4f6fe7)[_0xe46d('0x2')](0x0);var _0x5dae8e=moment(_0x28fcb2)[_0xe46d('0x2')](0x0);return _0x414edd[_0xe46d('0x3')](_0x5dae8e,_0xe46d('0x4'));}function History(_0x104508){this[_0xe46d('0x5')]=_0x104508[_0xe46d('0x5')];this[_0xe46d('0x6')]=_0x104508[_0xe46d('0x6')]||undefined;this[_0xe46d('0x7')]=_0x104508['type'];this[_0xe46d('0x8')]=_0x104508['type']===_0xe46d('0x9')?_0xe46d('0xa'):_0x104508[_0xe46d('0x7')];this[_0xe46d('0xb')]=_0x104508[_0xe46d('0xb')];this[_0xe46d('0xc')]=_0x104508[_0xe46d('0xc')];this[_0xe46d('0xd')]=_0x104508[_0xe46d('0xd')];this[_0xe46d('0xe')]=_0x104508[_0xe46d('0xb')]+_0x104508[_0xe46d('0xc')]+_0x104508[_0xe46d('0xd')]+_0x104508['countnosuchnumberretry']+_0x104508[_0xe46d('0xf')]+_0x104508['countabandonedretry']+_0x104508[_0xe46d('0x10')]+_0x104508[_0xe46d('0x11')];this[_0xe46d('0x12')]=_0x104508[_0xe46d('0x12')];this[_0xe46d('0xf')]=_0x104508[_0xe46d('0xf')];this[_0xe46d('0x13')]=_0x104508['countabandonedretry'];this[_0xe46d('0x10')]=_0x104508[_0xe46d('0x10')];this[_0xe46d('0x11')]=_0x104508[_0xe46d('0x11')];this[_0xe46d('0xa')]=_0x104508['queue'];this[_0xe46d('0x14')]=_0x104508[_0xe46d('0x15')];this[_0xe46d('0x16')]=_0x104508[_0xe46d('0x17')];this[_0xe46d('0x18')]=_0x104508['starttime'];this[_0xe46d('0x19')]=_0x104508['responsetime'];this['endtime']=_0x104508[_0xe46d('0x19')];this[_0xe46d('0x1a')]=getSeconds(_0x104508[_0xe46d('0x19')],_0x104508[_0xe46d('0x18')]);this['holdtime']=0x0;this['talktime']=0x0;this['callback']=_0x104508[_0xe46d('0x1b')];this['callbackuniqueid']=_0x104508[_0xe46d('0x1c')];this[_0xe46d('0x1d')]=_0x104508[_0xe46d('0x1d')];this[_0xe46d('0x1e')]=_0x104508[_0xe46d('0x1e')];this[_0xe46d('0x1f')]=_0x104508[_0xe46d('0x1f')];this[_0xe46d('0x20')]=_0x104508[_0xe46d('0x20')];this['UserId']=_0x104508[_0xe46d('0x21')];this['VoiceQueueId']=_0x104508[_0xe46d('0x22')];this[_0xe46d('0x23')]=_0x104508[_0xe46d('0x23')];this[_0xe46d('0x24')]=_0x104508[_0xe46d('0x24')]||'';this['originatecalleridname']=_0x104508[_0xe46d('0x25')]||'';}module[_0xe46d('0x26')]=History; \ No newline at end of file diff --git a/server/services/ami/dialer/index.js b/server/services/ami/dialer/index.js index 7c647d9..b3e4f7b 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 _0x1542=['[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','Machine','countdropretry','reason\x2019\x20machine....','minutes','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','[syncHangupIvr]','dialQueueProject','AGI','cause-txt','Unknow','reason','agent','agiafterat','dialQueueProject2','[syncAgentComplete][createHistory]','[syncAgentComplete]','answertime','queueCallerAbandonCreateState','[syncQueueCallerAbandon]\x20[Drop]','droptime','dialQueueTimeout','outboundDropCallsDayTimeout','Drop','dropreason','TIMEOUT','dialDropMaxRetry','dialDropRetryFrequency','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','CALLEREXIT','dialAbandonedRetryFrequency','Abandoned','[syncAgentComplete][createHistory][11]','actionid','locked','paused','stateinterface','rrmemory','queueBooked','idHopper','queueStatusComplete','[booked][unlockQueueStatus]','roundrobin','[Catch][Preview][syncQueueStatusComplete]','[unlock][syncQueueStatusComplete]','_rr','unlockRR','[booked][RR]','contactAgent-idHopper:\x20','run','[booked][RR][finaly]','Agent:\x20','[booked][unlock]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','syncCampaigns','checkIsTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTime','checkIfTimeIntervals','INTERVAL_IS_EMPTY','Failure','\x20Intervals\x20is\x20empty\x20','timezones','TIMEZONE_UNKNOW','\x20Timezone\x20unknow\x20','isArray','length','push','command','iftime\x20%s,%s','interval','content','true','indexOf','all','some','GLOBAL_INTERVAL_IS_OVERTIME','INTERVAL_IS_OVERTIME','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','progressive','handlePower','power','dialPowerLevel','booked','method\x20not\x20recognized','launchHandleIvr','handleIvr','dialActive','dialGlobalInterval','dialTimezone','checkDialMethod','[syncQueueSummary]','[syncCampaigns]','\x5cw{0,','pow','replace','random','match','actionOriginate','originate','voiceQueue\x20is\x20undefine','phone','Contact','getCaller','\x22agi://%s/square,%s\x22','NONE','\x22%s,%s%s,,,%s\x22','dialQueueOptions','ACTIVE','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','dialAMDMaximumWordLength','XMD-CAMPAIGNID','tags','updatedAt','%s%s','XMD-','toUpper','dialRandomLastDigitCallerIdNumber','XMD-ORIGINATECALLERIDNAME','XMD-ORIGINATECALLERIDNUM','originatecalleridnum','SIP/%s/%s%s','trim','dialCutDigit','substring','from-sip','[originateError]:\x20%s','[originate][error]','originate\x20action\x20Error','responsetime','getQueue','response','[callProgressDetecting]\x20','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionRetryFrequency','dialNoSuchNumberMaxRetry','[rescheduleContact][Drop]','dialAbandonedMaxRetry','[callProgressDetecting]','evt\x20is\x20undefine','outboundNoSuchCallsDay','custom:agentnosuchnumber','checkRetriveMax','reason\x200\x20no\x20such\x20number....','NoAnswer','custom:agentnoanswer','noanswer','[syncAgentComplete][createHistory][3]','dialNoAnswerMaxRetry','reason\x203\x20ringing\x20no\x20answer','Busy','custom:agentbusy','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','Congestion','custom:agentcongestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','outboundAbandonedCallsDay','reason\x2011\x20abandoned','AgentReject','custom:agentreject','agentreject','[syncAgentComplete][createHistory][20]','dialAgentRejectMaxRetry','reason\x2020\x20agentreject','Global','[moveContactManagedDialer][0]','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','round','predictiveIntervalMinThreshold','floor','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','check\x20handlePredictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','dialPredictiveOptimization','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Max\x20Drop\x20','started\x20in\x20predictive\x20at','getDataPredictive','startMethodPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(',')\x20are\x20more\x20than\x20threshold\x20(','predictiveIntervalAnsweredCalls','abandonmentRate','agentBusyFactor','busyFactor','[getDataPredictive]','Unknown\x20Predictive','check\x20failure','getDataPredictiveOld','outboundQueuePauses','predictiveIntervalPauses','[CatchErlangB]','one\x20call\x20every:','[handlePredictive]','fail\x20to\x20scheduled\x20calls','[booked][checkContactBlack]','queueStatusComplete:\x20','Queue:\x20','[unlockOriginate][syncQueueStatusComplete]','scheduledat','dialRecallMeTimeout','Agent','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','RECALLINQUEUE','[Originate][HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','BLACKLIST','inBlackList','limitCalls','dialOrderByScheduledAt','[getContactCampaign2][Empty]','ivrTotalCallsDays','[actionOriginate]\x20','Contact.phone','checkContactBlack','[actionOriginateIvr]\x20','dialLimitQueue','not_inuse','RUNNING','[getContactDialer2]','[handlePredictive][limitChannel]','tryOriginatePredictive','[actionOriginatePredictive]\x20','--------\x20Drop\x20Rate\x20--------','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','m\x20=\x20','p\x20=\x20','interval\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','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','Ts\x20=\x20','exports','util','lodash','bluebird','uuid','moment','ioredis','../preview/util/util','../../../config/environment/','dialer','../../../config/logger','predictive','predictiveCalls','syncQueueSummary','../ami','redis','defaults','socket.io-emitter','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/voiceQueueRt','./action','./final','./agentComplete','./queueCallerAbandon','./hangup','env','XCALLY_IP_AGI','127.0.0.1','prototype','finally','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','actions','contactsId','optionPredictive','startPredictive','startProgressive','ivrOriginated','queueBookedRR','agentconnect','syncAgentConnect','syncQueueCallerAbandon','bind','originateresponse','agentcomplete','syncAgentComplete','custom:queuesummary','hangup','syncHangup','syncNewExten','varset','queuemember','syncQueueMember','queuestatuscomplete','loopCampaigns','loopClearZombieChannels','isUndefined','AGENTS_NOT_LOGGED','name','message','NOT_ACTIVE','Interval','INTERVAL_IS_NULL','\x20INTERVAL_IS_NULL','Intervals','isEmpty','[ifTime][Action]','Error','stringify','milliseconds','diff','seconds','emit','type','outbound','strategy','answered','available','loggedIn','sumDuration','sumHoldTime','total','abandoned','waiting','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundNoAnswerCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalAvailable','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','Trunk','callerid','md5','format','voice_queue:save','campaign:save','info','-----\x20Stats\x20Predictive\x20---','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalTotalCalls','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','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\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','---------\x20ErlangB\x20---------','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','merge','handlePredictive','clearing\x20variable\x20handle\x20predictive','ivr','string','\x22%s\x22\x20<%s>','\x22\x22\x20<>','error','inspect','stack','[decremetOriginate]\x20object\x20originated\x20is\x20negative','[decremetOriginate]\x20is\x20null\x20or\x20undefined','RESCHEDULED_CONTACTS','[getContactDialer2][ReScheduled]','contactsRescheduled','AVAILABLE_CONTACTS_FINISHED','[getContactDialer2][Empty]','sendMessageOneNotActive','talking','pTalking','[syncQueueSummary]\x20Campaign\x20Queue:\x20','IS_DISACTIVED','is\x20disactive','is\x20not\x20active','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','statedesc','endtime','starttime','clearZombieChannels','uniqueId','[uniqueid]','undefined','enqueue','isNil','Action','status','channel','No\x20such\x20channel','updateOriginated','queue','[Dialer][checkChannel]','[Dialer][checkChannel][ivr]','resolve','countReScheduled','catch','[countReScheduled]\x20','checkIsBlackList','then','checkIsBlackListIvr','[checkIsBlackListIvr]\x20','averageHandleTime','[averageHandleTime]\x20','rescheduleContact','[rescheduleContact]\x20','unlockContact','[unlockContact]\x20','getContactDialer','temp','getContactDialerIvr','[getContactDialerIvr]\x20','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','moveContactManagedDialer','[moveContactManagedDialer]\x20','createHistory','[createHistory]\x20','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','emptyContact','notFound','pick','ContactId','ListId','UserId','CampaignId','[emptyContact][createHistory]','[emptyContact]','isSuccess','Success','isTrunkReachable','active','SIP/%s','reachable','saveInDb','syncVarSet','uniqueid','variable','amdstatus','exten','xcally-motion-dialer','dialAMDActive','value','HANGUP','state','membername','custom:amd','amd','[syncHangupInAMD]','MACHINE','AMD','countglobal','buildObj','[syncAgentComplete][createHistory][0]','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','dialGlobalMaxRetry','stateGlobal','reason19\x20machine....','dialMachineMaxRetry','createStateFinal','add','dialMachineRetryFrequency','YYYY-MM-DD\x20HH:mm:ss','VoiceQueueId','[rescheduleContact][Machine]','HangupInAMD'];(function(_0x4e9701,_0x40592c){var _0x49b20c=function(_0x44de4d){while(--_0x44de4d){_0x4e9701['push'](_0x4e9701['shift']());}};_0x49b20c(++_0x40592c);}(_0x1542,0x116));var _0x2154=function(_0x392850,_0x189b7f){_0x392850=_0x392850-0x0;var _0x174276=_0x1542[_0x392850];return _0x174276;};'use strict';var util=require(_0x2154('0x0'));var _=require(_0x2154('0x1'));var BPromise=require(_0x2154('0x2'));var uuid=require(_0x2154('0x3'));var moment=require(_0x2154('0x4'));var rr=require('rr');var md5=require('md5');var Redis=require(_0x2154('0x5'));var ut=require(_0x2154('0x6'));var config=require(_0x2154('0x7'));var logger=require('../../../config/logger')(_0x2154('0x8'));var loggerBooked=require(_0x2154('0x9'))('booked');var loggerPredictive=require(_0x2154('0x9'))(_0x2154('0xa'));var loggerPredictiveCalls=require(_0x2154('0x9'))(_0x2154('0xb'));var loggerSyncQueueSummary=require(_0x2154('0x9'))(_0x2154('0xc'));var ami=require(_0x2154('0xd'));config[_0x2154('0xe')]=_[_0x2154('0xf')](config[_0x2154('0xe')],{'host':'localhost','port':0x18eb});var io=require(_0x2154('0x10'))(new Redis(config[_0x2154('0xe')]));var cmHopper=require(_0x2154('0x11'));var cmHopperHistory=require(_0x2154('0x12'));var cmHopperBlack=require('../rpc/cmHopperBlack');var voiceQueueRt=require(_0x2154('0x13'));var Action=require(_0x2154('0x14'));var History=require('./history');var Final=require(_0x2154('0x15'));var AgentComplete=require(_0x2154('0x16'));var QueueCallerAbandon=require(_0x2154('0x17'));var Hangup=require(_0x2154('0x18'));var ipAgi=process[_0x2154('0x19')][_0x2154('0x1a')]||_0x2154('0x1b');var strategy={'rrmemory':'rrmemory','roundrobin':'roundrobin'};var Sequence=function(){};Sequence[_0x2154('0x1c')]['enqueue']=function(_0x44c441){this['tail']=this['tail']?this['tail'][_0x2154('0x1d')](_0x44c441):_0x44c441();};function Dialer(_0x57e662,_0x157858){this['sequence']=new Sequence();this[_0x2154('0x1e')]=_0x157858;this[_0x2154('0x1f')]=_0x57e662[_0x2154('0x1f')];this[_0x2154('0x20')]=_0x57e662[_0x2154('0x20')];this[_0x2154('0x21')]=_0x57e662[_0x2154('0x21')];this[_0x2154('0x22')]=_0x57e662[_0x2154('0x22')];this[_0x2154('0x23')]=config['maxNumberOriginate']||0x2;this[_0x2154('0x24')]={};this[_0x2154('0x25')]={};this[_0x2154('0x26')]={};this['uniqueId']={};this[_0x2154('0x27')]={};this[_0x2154('0x28')]={};this[_0x2154('0x29')]={};this[_0x2154('0x2a')]={};this['queueBooked']={};this[_0x2154('0x2b')]={};ami['on'](_0x2154('0x2c'),this[_0x2154('0x2d')]['bind'](this));ami['on']('queuecallerabandon',this[_0x2154('0x2e')][_0x2154('0x2f')](this));ami['on'](_0x2154('0x30'),this['syncOriginateResponse']['bind'](this));ami['on'](_0x2154('0x31'),this[_0x2154('0x32')][_0x2154('0x2f')](this));ami['on'](_0x2154('0x33'),this['syncQueueSummary'][_0x2154('0x2f')](this));ami['on'](_0x2154('0x34'),this[_0x2154('0x35')]['bind'](this));ami['on']('newexten',this[_0x2154('0x36')][_0x2154('0x2f')](this));ami['on'](_0x2154('0x37'),this['syncVarSet'][_0x2154('0x2f')](this));ami['on'](_0x2154('0x38'),this[_0x2154('0x39')][_0x2154('0x2f')](this));ami['on'](_0x2154('0x3a'),this['syncQueueStatusComplete'][_0x2154('0x2f')](this));this[_0x2154('0x3b')]();this[_0x2154('0x3c')]();}function isNotNull(_0x156f1a){return _0x156f1a!==null&&!_[_0x2154('0x3d')](_0x156f1a);}function checkIsLoggedIn(_0x2dee3e,_0xe5c717){return function(){if(_0xe5c717<=0x0){_0x2dee3e['message']=_0x2154('0x3e');throw _0x2dee3e[_0x2154('0x3f')]+'\x20AGENTS\x20NOT\x20LOGGED';}};}function isActive(_0x1c25d7){return _0x1c25d7;}function checkIsActive(_0x504e86,_0x4aa34f){return function(){if(!isActive(_0x4aa34f)){_0x504e86[_0x2154('0x40')]=_0x2154('0x41');throw _0x504e86[_0x2154('0x3f')]+'\x20NOT\x20Active';}};}function checkInterval(_0x3feb60){return function(){if(!isNotNull(_0x3feb60[_0x2154('0x42')])){_0x3feb60[_0x2154('0x40')]=_0x2154('0x43');throw _0x3feb60[_0x2154('0x3f')]+_0x2154('0x44');}if(!isNotNull(_0x3feb60[_0x2154('0x42')][_0x2154('0x45')])){_0x3feb60['message']=_0x2154('0x43');throw _0x3feb60['name']+_0x2154('0x44');}if(!isNotNull(_[_0x2154('0x46')](_0x3feb60[_0x2154('0x42')][_0x2154('0x45')]))){_0x3feb60[_0x2154('0x40')]='INTERVAL_IS_NULL';throw _0x3feb60['name']+_0x2154('0x44');}};}function msgResponse(_0x3ff05a,_0x471c0e,_0x275ee3){return{'action':_0x3ff05a,'response':_0x471c0e,'message':_0x275ee3,'stack':_0x275ee3};}function myreject(_0x32d51d){return function(_0x366c1a){return _0x32d51d(msgResponse(_0x2154('0x47'),_0x2154('0x48'),JSON[_0x2154('0x49')](_0x366c1a)));};}function getSeconds(_0x490046,_0x4fa576){var _0x34582f=moment(_0x490046)['milliseconds'](0x0);var _0x3a160f=moment(_0x4fa576)[_0x2154('0x4a')](0x0);return _0x34582f[_0x2154('0x4b')](_0x3a160f,_0x2154('0x4c'));}function emit(_0x3670a5,_0x392f2a,_0x58ce76){io['to'](_0x3670a5)[_0x2154('0x4d')](_0x392f2a,_0x58ce76);}function emitVoiceQueueSummary(_0x2ccbb5){if(_0x2ccbb5[_0x2154('0x4e')]===_0x2154('0x4f')){var _0x1a4167={'id':_0x2ccbb5['id'],'name':_0x2ccbb5[_0x2154('0x3f')],'strategy':_0x2ccbb5[_0x2154('0x50')],'answered':_0x2ccbb5[_0x2154('0x51')],'available':_0x2ccbb5[_0x2154('0x52')],'loggedIn':_0x2ccbb5[_0x2154('0x53')],'pTalking':_0x2ccbb5['pTalking'],'sumBillable':_0x2ccbb5['sumBillable'],'sumDuration':_0x2ccbb5[_0x2154('0x54')],'sumHoldTime':_0x2ccbb5[_0x2154('0x55')]||0x0,'talking':_0x2ccbb5['talking'],'total':_0x2ccbb5[_0x2154('0x56')],'type':_0x2ccbb5[_0x2154('0x4e')],'unmanaged':_0x2ccbb5['unmanaged'],'abandoned':_0x2ccbb5[_0x2154('0x57')],'waiting':_0x2ccbb5[_0x2154('0x58')],'loggedInDb':_0x2ccbb5['loggedInDb'],'dialActive':_0x2ccbb5['dialActive'],'dialMethod':_0x2ccbb5[_0x2154('0x59')],'dialOriginateCallerIdName':_0x2ccbb5[_0x2154('0x5a')],'dialOriginateCallerIdNumber':_0x2ccbb5[_0x2154('0x5b')],'dialOriginateTimeout':_0x2ccbb5[_0x2154('0x5c')],'dialPrefix':_0x2ccbb5[_0x2154('0x5d')],'outboundAnswerAgiCallsDay':_0x2ccbb5[_0x2154('0x5e')],'outboundAnswerCallsDay':_0x2ccbb5[_0x2154('0x5f')],'outboundBlacklistCallsDay':_0x2ccbb5[_0x2154('0x60')],'outboundBusyCallsDay':_0x2ccbb5[_0x2154('0x61')],'outboundCongestionCallsDay':_0x2ccbb5[_0x2154('0x62')],'outboundDropCallsDayACS':_0x2ccbb5[_0x2154('0x63')],'outboundDropCallsDayCallersExit':_0x2ccbb5['outboundDropCallsDayCallersExit'],'outboundDropCallsDayTimeout':_0x2ccbb5['outboundDropCallsDayTimeout'],'outboundNoAnswerCallsDay':_0x2ccbb5[_0x2154('0x64')],'outboundNoSuchCallsDay':_0x2ccbb5['outboundNoSuchCallsDay'],'outboundOriginateFailureCallsDay':_0x2ccbb5[_0x2154('0x65')],'outboundReCallsDay':_0x2ccbb5[_0x2154('0x66')],'outboundRejectCallsDay':_0x2ccbb5[_0x2154('0x67')],'outboundUnknownCallsDay':_0x2ccbb5[_0x2154('0x68')],'predictiveIntervalAnsweredCalls':_0x2ccbb5['predictiveIntervalAnsweredCalls'],'predictiveIntervalAvgHoldtime':_0x2ccbb5[_0x2154('0x69')],'predictiveIntervalAvgTalktime':_0x2ccbb5[_0x2154('0x6a')],'predictiveIntervalDroppedCallsCallersExit':_0x2ccbb5[_0x2154('0x6b')],'predictiveIntervalDroppedCallsTimeout':_0x2ccbb5[_0x2154('0x6c')],'predictiveIntervalErlangCalls':_0x2ccbb5[_0x2154('0x6d')],'predictiveIntervalErlangCallsDroppedCalls':_0x2ccbb5[_0x2154('0x6e')],'predictiveIntervalHitRate':_0x2ccbb5['predictiveIntervalHitRate'],'predictiveIntervalMultiplicativeFactor':_0x2ccbb5['predictiveIntervalMultiplicativeFactor'],'predictiveIntervalPauses':_0x2ccbb5['predictiveIntervalPauses'],'predictiveIntervalAvailable':_0x2ccbb5[_0x2154('0x6f')],'predictiveIntervalTotalCalls':_0x2ccbb5['predictiveIntervalTotalCalls'],'message':_0x2ccbb5['message'],'originated':_0x2ccbb5[_0x2154('0x70')],'erlangCalls':_0x2ccbb5[_0x2154('0x71')],'erlangCallToSecond':_0x2ccbb5[_0x2154('0x72')],'erlangAbandonmentRate':_0x2ccbb5[_0x2154('0x73')],'erlangBusyFactor':_0x2ccbb5[_0x2154('0x74')],'startPredictive':_0x2ccbb5[_0x2154('0x28')],'startProgressive':_0x2ccbb5[_0x2154('0x29')]};if(_0x2ccbb5[_0x2154('0x75')]){_0x1a4167['Trunk']={'id':_0x2ccbb5[_0x2154('0x75')]['id'],'name':_0x2ccbb5[_0x2154('0x75')][_0x2154('0x3f')],'active':_0x2ccbb5['Trunk']['active'],'callerid':_0x2ccbb5[_0x2154('0x75')][_0x2154('0x76')]};}if(_0x2ccbb5[_0x2154('0x42')]){_0x1a4167['Interval']={'id':_0x2ccbb5[_0x2154('0x42')]['id'],'name':_0x2ccbb5[_0x2154('0x42')][_0x2154('0x3f')]};}var _0x7027c1=md5(JSON[_0x2154('0x49')](_0x1a4167));if(_0x2ccbb5[_0x2154('0x77')]!==_0x7027c1){_0x2ccbb5[_0x2154('0x77')]=_0x7027c1;emit(util[_0x2154('0x78')]('voice:queue:%s',_0x1a4167[_0x2154('0x3f')]),_0x2154('0x79'),_0x1a4167);}}}function emitCampaignSummary(_0x738aa3){if(_0x738aa3[_0x2154('0x4e')]==='ivr'){emit(util[_0x2154('0x78')]('campaign:ivr:%s',_0x738aa3['name']),_0x2154('0x7a'),_0x738aa3);}}function checkGetDataPredictive(_0x436844){if(isNotNull(_0x436844)&&!_[_0x2154('0x46')](_0x436844)){loggerPredictive[_0x2154('0x7b')](_0x2154('0x7c'));loggerPredictive[_0x2154('0x7b')](_0x2154('0x7d'),_0x436844[_0x2154('0x7e')]);loggerPredictive[_0x2154('0x7b')](_0x2154('0x7f'),_0x436844['predictiveIntervalAnsweredCalls']);loggerPredictive['info'](_0x2154('0x80'),_0x436844['predictiveIntervalDroppedCallsTimeout']);loggerPredictive[_0x2154('0x7b')]('Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x436844[_0x2154('0x6b')]);loggerPredictive[_0x2154('0x7b')](_0x2154('0x81'),_0x436844[_0x2154('0x69')]);loggerPredictive[_0x2154('0x7b')](_0x2154('0x82'),_0x436844[_0x2154('0x6a')]);loggerPredictive[_0x2154('0x7b')](_0x2154('0x83'));if(_0x436844[_0x2154('0x7e')]>0x0){if(!_[_0x2154('0x3d')](_0x436844[_0x2154('0x6a')])&&_0x436844[_0x2154('0x6a')]>0x0){return!![];}loggerPredictive[_0x2154('0x7b')]('Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive');if(!_['isUndefined'](_0x436844[_0x2154('0x69')])&&_0x436844[_0x2154('0x69')]>0x0){return!![];}loggerPredictive[_0x2154('0x7b')](_0x2154('0x84'));}else{loggerPredictive[_0x2154('0x7b')]('Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive');}}else{loggerPredictive['info'](_0x2154('0x85'));}return![];}function mergeDataErlangB(_0x1b9ba5){return function(_0x442b0b){loggerPredictive[_0x2154('0x7b')](_0x2154('0x86'));loggerPredictive['info'](_0x2154('0x87'),_0x442b0b[_0x2154('0x71')]);loggerPredictive[_0x2154('0x7b')](_0x2154('0x88'),_0x442b0b[_0x2154('0x72')]);loggerPredictive['info'](_0x2154('0x89'),_0x442b0b['erlangAbandonmentRate']);loggerPredictive[_0x2154('0x7b')](_0x2154('0x8a'),_0x442b0b[_0x2154('0x74')]);loggerPredictive[_0x2154('0x7b')](_0x2154('0x89'),_0x442b0b[_0x2154('0x73')]);loggerPredictive['info'](_0x2154('0x83'));_[_0x2154('0x8b')](_0x1b9ba5,_0x442b0b);};}function getDiff(_0x13adfb){var _0x30226b=moment()[_0x2154('0x4a')](0x0);var _0x460e45=moment(_0x13adfb)[_0x2154('0x4a')](0x0);return _0x30226b['diff'](_0x460e45,_0x2154('0x4c'));}function ifInterval(_0x1df413,_0x333899){if(_['isUndefined'](_0x333899)){return![];}return getDiff(_0x333899)<_0x1df413*0x3c;}function freeVariablesPredictive(_0x5a8802){if(isNotNull(_0x5a8802)){if(!_['isUndefined'](_0x5a8802[_0x2154('0x29')])){_0x5a8802['startProgressive']=undefined;loggerPredictive[_0x2154('0x7b')](_0x5a8802['name'],'clearing\x20variable\x20start\x20progressive');}if(!_[_0x2154('0x3d')](_0x5a8802['startPredictive'])){_0x5a8802[_0x2154('0x28')]=undefined;loggerPredictive[_0x2154('0x7b')](_0x5a8802[_0x2154('0x3f')],'clearing\x20variable\x20start\x20predictive');}if(!_[_0x2154('0x3d')](_0x5a8802['handlePredictive'])){clearInterval(_0x5a8802['handlePredictive']);_0x5a8802[_0x2154('0x8c')]=undefined;loggerPredictive[_0x2154('0x7b')](_0x5a8802[_0x2154('0x3f')],_0x2154('0x8d'));}}}function erlangb(_0xeea70b,_0x56c693){if(_0x56c693===0x0){return 0x0;}var _0x393a1a=0x1;for(var _0x5cdc86=0x1;_0x5cdc86<=_0x56c693;_0x5cdc86+=0x1){_0x393a1a=0x1+_0x393a1a*_0x5cdc86/_0xeea70b;}return 0x1/_0x393a1a;}function isVoiceQueueOutbound(_0x9407e1){return _0x9407e1===_0x2154('0x4f');}function isNotPreview(_0xc1dd4f){return _0xc1dd4f!==_0x2154('0x1e');}function isCampaignIvr(_0x5e19f4){return _0x5e19f4===_0x2154('0x8e');}function getCallerId(_0x582acf,_0x47301c,_0xb97e38){if(!_['isUndefined'](_0xb97e38)&&typeof _0xb97e38===_0x2154('0x8f')&&!_[_0x2154('0x46')](_0xb97e38)){if(!_[_0x2154('0x3d')](_0x47301c)&&typeof _0x47301c==='string'&&!_['isEmpty'](_0x47301c)){return util[_0x2154('0x78')](_0x2154('0x90'),_0x47301c,_0xb97e38);}return util['format'](_0x2154('0x90'),_0xb97e38,_0xb97e38);}if(!_[_0x2154('0x3d')](_0x582acf)&&typeof _0x582acf===_0x2154('0x8f')&&!_[_0x2154('0x46')](_0x582acf)){return _0x582acf;}return _0x2154('0x91');}function loggerCatchQueueSummary(_0x478173,_0x1869f7){return function(_0x1208b8){freeVariablesPredictive(_0x1869f7);emitVoiceQueueSummary(_0x1869f7);emitCampaignSummary(_0x1869f7);loggerSyncQueueSummary[_0x2154('0x92')](_0x478173,util[_0x2154('0x93')](_0x1208b8,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x59e144,_0x147927){return function(_0x2f9a07){loggerPredictive[_0x2154('0x92')](_0x147927[_0x2154('0x3f')],_0x59e144);loggerPredictive[_0x2154('0x92')](_0x2f9a07[_0x2154('0x94')]);freeVariablesPredictive(_0x147927);};}function loggerCatch(_0x101d70){return function(_0x106df9){logger['error'](_0x101d70,util[_0x2154('0x93')](_0x106df9,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x3aa46d){return _0x3aa46d&&!_[_0x2154('0x3d')](_0x3aa46d)&&_0x3aa46d['length']>0x0;}function decremetOriginate(_0x5402ff){if(!_[_0x2154('0x3d')](_0x5402ff)&&_0x5402ff!==null){if(typeof _0x5402ff['originated']!=='undefined'){if(_0x5402ff['originated']>0x0){_0x5402ff[_0x2154('0x70')]-=0x1;}else{logger[_0x2154('0x92')](_0x2154('0x95'));}}}else{logger[_0x2154('0x92')](_0x2154('0x96'));}}function checkContactLowerLimitOriginate(_0x51ba5c,_0x26b0d0,_0x31232b){if(_0x26b0d0>_0x31232b){for(var _0x5477e8=0x0;_0x5477e8<_0x26b0d0-_0x31232b;_0x5477e8+=0x1){decremetOriginate(_0x51ba5c);}}}function loggerGetContactDialer(_0x213b63,_0x2f79ab,_0x18b1c8){return function(_0x8443ab){checkContactLowerLimitOriginate(_0x2f79ab,_0x18b1c8,0x0);logger[_0x2154('0x92')](_0x213b63,util['inspect'](_0x8443ab,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x557404){return function(_0x4fcc08){if(isNotNull(_0x4fcc08)&&isNotNull(_0x4fcc08[0x0])){if(_0x4fcc08[0x0]['contactsRescheduled']>0x0){_0x557404[_0x2154('0x40')]=_0x2154('0x97');logger['info'](_0x2154('0x98')+_0x557404[_0x2154('0x3f')],_0x4fcc08[0x0][_0x2154('0x99')],'contacts');}else{_0x557404[_0x2154('0x40')]=_0x2154('0x9a');logger['info'](_0x2154('0x9b')+_0x557404[_0x2154('0x3f')]);}}};}function notSendMessagesQueue(_0x4adacd){if(_0x4adacd[_0x2154('0x9c')]){freeVariablesPredictive(_0x4adacd);if(_0x4adacd[_0x2154('0x70')]===0x0&&_0x4adacd[_0x2154('0x9d')]===0x0&&_0x4adacd['waiting']===0x0&&(_0x4adacd[_0x2154('0x9e')]||0x0)===0x0){_0x4adacd[_0x2154('0x9c')]=![];_0x4adacd[_0x2154('0x52')]=0x0;_0x4adacd[_0x2154('0x40')]=_0x2154('0x41');loggerSyncQueueSummary[_0x2154('0x92')](_0x2154('0x9f'),_0x4adacd[_0x2154('0x3f')],'is\x20not\x20active');}else{_0x4adacd[_0x2154('0x40')]=_0x2154('0xa0');loggerSyncQueueSummary[_0x2154('0x92')]('[syncQueueSummary]\x20Campaign\x20Queue:\x20',_0x4adacd[_0x2154('0x3f')],_0x2154('0xa1'));}emitVoiceQueueSummary(_0x4adacd);}}function notSendMessagesCampaign(_0x3245ad){if(_0x3245ad['sendMessageOneNotActive']){if(_0x3245ad[_0x2154('0x70')]===0x0){_0x3245ad[_0x2154('0x9c')]=![];_0x3245ad[_0x2154('0x40')]=_0x2154('0x41');loggerSyncQueueSummary[_0x2154('0x92')]('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0x3245ad[_0x2154('0x3f')],_0x2154('0xa2'));}else{_0x3245ad[_0x2154('0x40')]=_0x2154('0xa0');loggerSyncQueueSummary['error'](_0x2154('0xa3'),_0x3245ad[_0x2154('0x3f')],'is\x20disactive');}emitCampaignSummary(_0x3245ad);}}function createObjHistory(_0x4a641c,_0x24c45b,_0x5ff870,_0x498be2,_0x82fb43){_0x4a641c[_0x2154('0x40')]=_0x5ff870;var _0x4c422c=new Action(_0x4a641c,_0x24c45b);var _0x1feca3=new History(_0x4c422c);_0x1feca3['state']=_0x498be2;_0x1feca3[_0x2154('0xa4')]=_0x82fb43;_0x1feca3[_0x2154('0xa5')]=_0x4c422c[_0x2154('0xa6')];return _0x1feca3;}Dialer[_0x2154('0x1c')]['loopClearZombieChannels']=function(){var _0x3a9ff0=this;setInterval(function(){_0x3a9ff0[_0x2154('0xa7')](_0x3a9ff0[_0x2154('0xa8')],_0x2154('0xa9'));_0x3a9ff0[_0x2154('0xa7')](_0x3a9ff0[_0x2154('0x25')],'[actions]');},0x32c8);};Dialer[_0x2154('0x1c')][_0x2154('0xa7')]=function(_0xed64d9,_0x346d59){var _0x4b9fe6=this;for(var _0x473f99 in _0xed64d9){if(typeof _0xed64d9[_0x473f99]!==_0x2154('0xaa')){this['sequence'][_0x2154('0xab')](function(){if(!_[_0x2154('0xac')](_0xed64d9[_0x473f99])){return ami[_0x2154('0xad')]({'action':_0x2154('0xae'),'channel':_0xed64d9[_0x473f99][_0x2154('0xaf')]})['catch'](function(_0x2a1678){if(_0x2a1678[_0x2154('0x40')]===_0x2154('0xb0')){setTimeout(function(){if(_0xed64d9[_0x473f99]&&_0xed64d9[_0x473f99][_0x2154('0x4e')]!==_0x2154('0x8e')){_0x4b9fe6[_0x2154('0xb1')](_0x4b9fe6[_0x2154('0x1f')][_0xed64d9[_0x473f99][_0x2154('0xb2')]]);logger[_0x2154('0x92')](_0x2154('0xb3'),_0x346d59,_0x473f99,_0xed64d9[_0x473f99]['queue']);delete _0xed64d9[_0x473f99];}if(_0xed64d9[_0x473f99]&&_0xed64d9[_0x473f99][_0x2154('0x4e')]===_0x2154('0x8e')){_0x4b9fe6[_0x2154('0xb1')](_0x4b9fe6[_0x2154('0x20')][_0xed64d9[_0x473f99][_0x2154('0xb2')]]);logger[_0x2154('0x92')](_0x2154('0xb4'),_0x346d59,_0x473f99,_0xed64d9[_0x473f99][_0x2154('0xb2')]);delete _0xed64d9[_0x473f99];}},0x2328);}});}});}}};Dialer[_0x2154('0x1c')]['countReScheduled']=function(_0x3ae502){return BPromise[_0x2154('0xb5')]()['then'](cmHopper[_0x2154('0xb6')](_0x3ae502))[_0x2154('0xb7')](loggerCatch(_0x2154('0xb8')));};Dialer['prototype'][_0x2154('0xb9')]=function(_0x3220a9){return BPromise[_0x2154('0xb5')]()[_0x2154('0xba')](cmHopperBlack[_0x2154('0xb9')](_0x3220a9))[_0x2154('0xb7')](loggerCatch('[checkIsBlackList]\x20'));};Dialer[_0x2154('0x1c')][_0x2154('0xbb')]=function(_0x2ac713){return BPromise[_0x2154('0xb5')]()[_0x2154('0xba')](cmHopperBlack[_0x2154('0xbb')](_0x2ac713))['catch'](loggerCatch(_0x2154('0xbc')));};Dialer[_0x2154('0x1c')][_0x2154('0xbd')]=function(_0x28fe17){return BPromise[_0x2154('0xb5')]()[_0x2154('0xba')](cmHopperHistory['avgHandleTime'](_0x28fe17))['catch'](loggerCatch(_0x2154('0xbe')));};Dialer[_0x2154('0x1c')][_0x2154('0xbf')]=function(_0x17b9f0){return BPromise[_0x2154('0xb5')]()[_0x2154('0xba')](cmHopper[_0x2154('0xbf')](_0x17b9f0))['catch'](loggerCatch(_0x2154('0xc0')));};Dialer[_0x2154('0x1c')][_0x2154('0xc1')]=function(_0x2006eb,_0x4ccacd,_0x3e3007){return BPromise[_0x2154('0xb5')]()['then'](cmHopper[_0x2154('0xc1')](_0x2006eb,_0x4ccacd,_0x3e3007))[_0x2154('0xb7')](loggerCatch(_0x2154('0xc2')));};Dialer['prototype'][_0x2154('0xc3')]=function(_0x3e94d5,_0x1c4900,_0x4063eb,_0x728e7a,_0x33fbe1){return BPromise[_0x2154('0xb5')]()[_0x2154('0xba')](cmHopper['getContactDialer'](_0x3e94d5,_0x1c4900,_0x4063eb,_0x728e7a))[_0x2154('0xb7')](function(_0x38de0f){_0x33fbe1[_0x2154('0xc4')]-=_0x4063eb;_0x33fbe1[_0x2154('0xc4')]=_0x33fbe1['temp']>0x0?_0x33fbe1[_0x2154('0xc4')]:0x0;loggerCatch('[getContactDialer]\x20')(_0x38de0f);});};Dialer['prototype'][_0x2154('0xc5')]=function(_0x24c755,_0x508cda,_0x37d742,_0xc5cb0a){return BPromise[_0x2154('0xb5')]()[_0x2154('0xba')](cmHopper[_0x2154('0xc5')](_0x24c755,_0x508cda,_0x37d742))[_0x2154('0xb7')](function(_0x25cff2){_0xc5cb0a['temp']-=_0x508cda;_0xc5cb0a['temp']=_0xc5cb0a[_0x2154('0xc4')]>0x0?_0xc5cb0a['temp']:0x0;loggerCatch(_0x2154('0xc6'))(_0x25cff2);});};Dialer[_0x2154('0x1c')][_0x2154('0xc7')]=function(_0x507055){return BPromise[_0x2154('0xb5')]()[_0x2154('0xba')](voiceQueueRt[_0x2154('0xc7')](_0x507055))['catch'](loggerCatch(_0x2154('0xc8')));};Dialer[_0x2154('0x1c')]['moveContactManagedDialer']=function(_0x4e1c3c){return BPromise[_0x2154('0xb5')]()[_0x2154('0xba')](cmHopper[_0x2154('0xc9')](_0x4e1c3c))[_0x2154('0xb7')](loggerCatch(_0x2154('0xca')));};Dialer[_0x2154('0x1c')][_0x2154('0xcb')]=function(_0x41f5e3){return BPromise[_0x2154('0xb5')]()[_0x2154('0xba')](cmHopperHistory[_0x2154('0xcb')](_0x41f5e3))[_0x2154('0xb7')](loggerCatch(_0x2154('0xcc')));};Dialer[_0x2154('0x1c')]['updateOriginated']=function(_0x88cf31){if(!_[_0x2154('0x3d')](_0x88cf31)&&_0x88cf31!==null){if(typeof _0x88cf31[_0x2154('0x70')]!==_0x2154('0xaa')){if(_0x88cf31[_0x2154('0x70')]>0x0){_0x88cf31[_0x2154('0x70')]-=0x1;}else{logger['error']('[updateOriginated]\x20object\x20originated\x20is\x20negative');}}}else{logger[_0x2154('0x92')](_0x2154('0xcd'));}};Dialer['prototype'][_0x2154('0xce')]=function(_0x2d5c21,_0xfa4f23){var _0x50d3aa=this;return function(_0x4ed546){_0x50d3aa[_0x2154('0xb1')](_0xfa4f23);logger[_0x2154('0x92')](_0x2d5c21,util['inspect'](_0x4ed546,{'showHidden':![],'depth':null}));};};Dialer[_0x2154('0x1c')][_0x2154('0xcf')]=function(_0x57e6d1,_0x487618,_0x3b6b55){var _0x112dae={'state':0x19,'statedesc':_0x2154('0xd0')};this[_0x2154('0xb1')](_0x487618);this['saveInDb'](_[_0x2154('0x8b')](_0x112dae,_[_0x2154('0xd1')](_0x3b6b55,[_0x2154('0xd2'),_0x2154('0xd3'),_0x2154('0xd4'),'VoiceQueueId',_0x2154('0xd5')])),_0x2154('0xd6'),_0x2154('0xd7'));logger[_0x2154('0x92')](_0x57e6d1);};Dialer['prototype'][_0x2154('0xd8')]=function(_0x27ac02){return _0x27ac02===_0x2154('0xd9');};Dialer[_0x2154('0x1c')][_0x2154('0xda')]=function(_0x5ee95d){return!_[_0x2154('0x3d')](_0x5ee95d)&&_0x5ee95d&&!_[_0x2154('0x3d')](_0x5ee95d[_0x2154('0x3f')])&&!_[_0x2154('0x3d')](_0x5ee95d[_0x2154('0xdb')])&&_0x5ee95d[_0x2154('0xdb')]&&(this[_0x2154('0x22')][util['format'](_0x2154('0xdc'),_0x5ee95d[_0x2154('0x3f')])][_0x2154('0xae')]===_0x2154('0xdd')||this[_0x2154('0x22')][util[_0x2154('0x78')]('SIP/%s',_0x5ee95d['name'])]['status']==='unmonitored');};Dialer[_0x2154('0x1c')][_0x2154('0xde')]=function(_0x53c295,_0xd7a688,_0x38e059){this[_0x2154('0xcb')](_0x53c295)['catch'](loggerCatch(_0xd7a688));this[_0x2154('0xc9')](_0x53c295)[_0x2154('0xb7')](loggerCatch(_0x38e059));};Dialer['prototype'][_0x2154('0xdf')]=function(_0x185f2a){var _0x4d2457=this['uniqueId'][_0x185f2a[_0x2154('0xe0')]];var _0x597968;if(!_[_0x2154('0xac')](_0x185f2a)&&!_[_0x2154('0xac')](_0x185f2a[_0x2154('0xe1')])&&!_[_0x2154('0xac')](_0x185f2a['variable'][_0x2154('0xe2')])&&_0x185f2a[_0x2154('0xe3')]===_0x2154('0xe4')&&_0x4d2457){if(_0x4d2457[_0x2154('0x4e')]!==_0x2154('0x8e')&&this[_0x2154('0x1f')][_0x4d2457['queue']][_0x2154('0xe5')]&&_0x185f2a[_0x2154('0xe6')]===_0x2154('0xe7')){delete this[_0x2154('0xa8')][_0x185f2a[_0x2154('0xe0')]];this['updateOriginated'](this['voiceQueues'][_0x4d2457[_0x2154('0xb2')]]);this[_0x2154('0x1f')][_0x4d2457[_0x2154('0xb2')]][_0x2154('0x5f')]+=0x1;this[_0x2154('0x1f')][_0x4d2457[_0x2154('0xb2')]][_0x2154('0x5e')]+=0x1;_0x597968=new Hangup(_0x4d2457,_0x185f2a);_0x597968[_0x2154('0xe8')]=0x12;_0x597968['statedesc']='HangupInAMD';_0x597968[_0x2154('0xe9')]='AMD';ami['emit'](_0x2154('0xea'),ut['buildObj'](_0x597968,_0x2154('0xeb')));this[_0x2154('0xde')](_0x597968,'[syncHangupInAMD][createHistory]',_0x2154('0xec'));}if(_0x4d2457[_0x2154('0x4e')]!==_0x2154('0x8e')&&this[_0x2154('0x1f')][_0x4d2457[_0x2154('0xb2')]][_0x2154('0xe5')]&&_0x185f2a['value']===_0x2154('0xed')){var _0x105aab=this;return new BPromise(function(_0x2cb5cb,_0x1f1741){delete _0x105aab[_0x2154('0xa8')][_0x185f2a[_0x2154('0xe0')]];_0x105aab['updateOriginated'](_0x105aab[_0x2154('0x1f')][_0x4d2457[_0x2154('0xb2')]]);_0x105aab[_0x2154('0x1f')][_0x4d2457[_0x2154('0xb2')]][_0x2154('0x5f')]+=0x1;_0x105aab[_0x2154('0x1f')][_0x4d2457['queue']][_0x2154('0x5e')]+=0x1;var _0x209c7a=_0x105aab[_0x2154('0x1f')][_0x4d2457['queue']];var _0x5df506=new Hangup(_0x4d2457,_0x185f2a);_0x5df506[_0x2154('0xe8')]=0x13;_0x5df506[_0x2154('0xa4')]='Machine';_0x5df506[_0x2154('0xe9')]=_0x2154('0xee');_0x5df506['countmachineretry']+=0x1;_0x5df506[_0x2154('0xef')]+=0x1;_0x5df506[_0x2154('0xeb')]=!![];ami[_0x2154('0x4d')](_0x2154('0xea'),ut[_0x2154('0xf0')](_0x5df506,'amd'));_0x105aab['createHistory'](_0x5df506)['catch'](loggerCatch(_0x2154('0xf1')));if(_0x5df506[_0x2154('0xf2')]+_0x5df506[_0x2154('0xf3')]+_0x5df506[_0x2154('0xf4')]+_0x5df506[_0x2154('0xf5')]+_0x5df506['countdropretry']+_0x5df506[_0x2154('0xf6')]+_0x5df506[_0x2154('0xf7')]+_0x5df506[_0x2154('0xf8')]>=_0x209c7a[_0x2154('0xf9')]){_0x105aab[_0x2154('0xfa')](_0x5df506,_0x2cb5cb,_0x1f1741,_0x2154('0xfb'));}else{if(_0x5df506['countmachineretry']>=_0x209c7a[_0x2154('0xfc')]){_0x105aab[_0x2154('0xfd')](_0x5df506,_0x2cb5cb,_0x1f1741,'reason\x2019\x20machine....');}else{_0x105aab[_0x2154('0xbf')]({'active':![],'countmachineretry':_0x5df506[_0x2154('0xf7')],'scheduledat':moment()[_0x2154('0xfe')](_0x209c7a[_0x2154('0xff')],'minutes')[_0x2154('0x78')](_0x2154('0x100')),'ContactId':_0x5df506[_0x2154('0xd2')],'ListId':_0x5df506['ListId'],'VoiceQueueId':_0x5df506[_0x2154('0x101')]||undefined,'CampaignId':_0x5df506[_0x2154('0xd5')]||undefined})[_0x2154('0xb7')](loggerCatch(_0x2154('0x102')));_0x2cb5cb({'reschedule':0x1});}}});}if(_0x4d2457[_0x2154('0x4e')]===_0x2154('0x8e')&&this[_0x2154('0x20')][_0x4d2457[_0x2154('0xb2')]][_0x2154('0xe5')]&&_0x185f2a['value']===_0x2154('0xe7')){delete this[_0x2154('0xa8')][_0x185f2a[_0x2154('0xe0')]];this[_0x2154('0xb1')](this[_0x2154('0x20')][_0x4d2457[_0x2154('0xb2')]]);_0x597968=new Hangup(_0x4d2457,_0x185f2a);_0x597968[_0x2154('0xe8')]=0x12;_0x597968[_0x2154('0xa4')]=_0x2154('0x103');_0x597968[_0x2154('0xe9')]=_0x2154('0xee');ami[_0x2154('0x4d')](_0x2154('0xea'),ut[_0x2154('0xf0')](_0x597968,'amd'));this['saveInDb'](_0x597968,_0x2154('0x104'),_0x2154('0x105'));}if(_0x4d2457['type']===_0x2154('0x8e')&&this[_0x2154('0x20')][_0x4d2457[_0x2154('0xb2')]][_0x2154('0xe5')]&&_0x185f2a[_0x2154('0xe6')]===_0x2154('0xed')){var _0x105aab=this;return new BPromise(function(_0xe12b87,_0x30d5ec){delete _0x105aab[_0x2154('0xa8')][_0x185f2a[_0x2154('0xe0')]];_0x105aab['updateOriginated'](_0x105aab['campaigns'][_0x4d2457[_0x2154('0xb2')]]);_0x105aab[_0x2154('0x20')][_0x4d2457['queue']][_0x2154('0x5f')]+=0x1;_0x105aab[_0x2154('0x20')][_0x4d2457[_0x2154('0xb2')]]['outboundAnswerAgiCallsDay']+=0x1;var _0xd54085=_0x105aab['campaigns'][_0x4d2457['queue']];var _0x3f1527=new Hangup(_0x4d2457,_0x185f2a);_0x3f1527[_0x2154('0xe8')]=0x13;_0x3f1527['statedesc']=_0x2154('0x106');_0x3f1527[_0x2154('0xe9')]=_0x2154('0xee');_0x3f1527[_0x2154('0xf7')]+=0x1;_0x3f1527[_0x2154('0xef')]+=0x1;_0x3f1527[_0x2154('0xeb')]=!![];ami[_0x2154('0x4d')]('custom:amd',ut[_0x2154('0xf0')](_0x3f1527,_0x2154('0xeb')));_0x105aab[_0x2154('0xcb')](_0x3f1527)[_0x2154('0xb7')](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x3f1527[_0x2154('0xf2')]+_0x3f1527[_0x2154('0xf3')]+_0x3f1527[_0x2154('0xf4')]+_0x3f1527['countnosuchnumberretry']+_0x3f1527[_0x2154('0x107')]+_0x3f1527[_0x2154('0xf6')]+_0x3f1527['countmachineretry']+_0x3f1527[_0x2154('0xf8')]>=_0xd54085['dialGlobalMaxRetry']){_0x105aab[_0x2154('0xfa')](_0x3f1527,_0xe12b87,_0x30d5ec,_0x2154('0xfb'));}else{if(_0x3f1527['countmachineretry']>=_0xd54085[_0x2154('0xfc')]){_0x105aab[_0x2154('0xfd')](_0x3f1527,_0xe12b87,_0x30d5ec,_0x2154('0x108'));}else{_0x105aab[_0x2154('0xbf')]({'active':![],'countmachineretry':_0x3f1527[_0x2154('0xf7')],'scheduledat':moment()[_0x2154('0xfe')](_0xd54085[_0x2154('0xff')],_0x2154('0x109'))[_0x2154('0x78')](_0x2154('0x100')),'ContactId':_0x3f1527['ContactId'],'ListId':_0x3f1527[_0x2154('0xd3')],'VoiceQueueId':_0x3f1527[_0x2154('0x101')]||undefined,'CampaignId':_0x3f1527[_0x2154('0xd5')]||undefined})[_0x2154('0xb7')](loggerCatch(_0x2154('0x102')));_0xe12b87({'reschedule':0x1});}}});}}};Dialer[_0x2154('0x1c')][_0x2154('0x35')]=function(_0x5b87fb){var _0x4dce57=this[_0x2154('0xa8')][_0x5b87fb[_0x2154('0xe0')]];var _0x5c72a8=this;var _0x43f968;if(_0x4dce57&&_0x4dce57[_0x2154('0x4e')]===_0x2154('0x8e')){delete this['uniqueId'][_0x5b87fb[_0x2154('0xe0')]];this['updateOriginated'](this[_0x2154('0x20')][_0x4dce57[_0x2154('0xb2')]]);this[_0x2154('0x20')][_0x4dce57['queue']][_0x2154('0x10a')]+=0x1;_0x43f968=new Hangup(_0x4dce57,_0x5b87fb);this['createHistory'](_0x43f968)[_0x2154('0xb7')](loggerCatch(_0x2154('0x10b')));this[_0x2154('0xc9')](_0x43f968)['catch'](loggerCatch(_0x2154('0x10c')));}if(_0x4dce57&&_0x4dce57[_0x2154('0x4e')]!=='ivr'&&isNotNull(this[_0x2154('0x1f')][_0x4dce57['queue']][_0x2154('0x10d')])){delete this[_0x2154('0xa8')][_0x5b87fb[_0x2154('0xe0')]];this[_0x2154('0xb1')](this[_0x2154('0x1f')][_0x4dce57[_0x2154('0xb2')]]);this[_0x2154('0x1f')][_0x4dce57[_0x2154('0xb2')]][_0x2154('0x5f')]+=0x1;this[_0x2154('0x1f')][_0x4dce57[_0x2154('0xb2')]]['outboundAnswerAgiCallsDay']+=0x1;_0x43f968=new Hangup(_0x4dce57,_0x5b87fb);_0x43f968[_0x2154('0xe8')]=0x10;_0x43f968[_0x2154('0xa4')]='AnswerAGI';_0x43f968[_0x2154('0xe9')]=_0x2154('0x10e');this['createHistory'](_0x43f968)[_0x2154('0xb7')](loggerCatch(_0x2154('0x10b')));this[_0x2154('0xc9')](_0x43f968)[_0x2154('0xb7')](loggerCatch('[syncHangupIvr]'));}if(_0x4dce57&&_0x4dce57[_0x2154('0x4e')]!==_0x2154('0x8e')&&!isNotNull(this[_0x2154('0x1f')][_0x4dce57[_0x2154('0xb2')]][_0x2154('0x10d')])){delete this[_0x2154('0xa8')][_0x5b87fb[_0x2154('0xe0')]];this[_0x2154('0xb1')](this[_0x2154('0x1f')][_0x4dce57[_0x2154('0xb2')]]);this[_0x2154('0x1f')][_0x4dce57[_0x2154('0xb2')]][_0x2154('0x68')]+=0x1;_0x43f968=new Hangup(_0x4dce57,_0x5b87fb);_0x43f968[_0x2154('0xe8')]=0xc;_0x43f968[_0x2154('0xa4')]=_0x5b87fb[_0x2154('0x10f')];_0x43f968[_0x2154('0xe9')]=_0x2154('0x110');this['createHistory'](_0x43f968)[_0x2154('0xb7')](loggerCatch(_0x2154('0x10b')));this[_0x2154('0xc9')](_0x43f968)[_0x2154('0xb7')](loggerCatch('[syncHangupIvr]'));}};Dialer[_0x2154('0x1c')][_0x2154('0x32')]=function(_0x5aa002){var _0x412ad4=this[_0x2154('0xa8')][_0x5aa002['uniqueid']];var _0x1f360b=this;if(this[_0x2154('0x1f')][_0x5aa002[_0x2154('0xb2')]]){if(_0x412ad4&&_0x412ad4[_0x2154('0x4e')]!=='ivr'){delete this[_0x2154('0xa8')][_0x5aa002[_0x2154('0xe0')]];this['voiceQueues'][_0x5aa002[_0x2154('0xb2')]]['outboundAnswerCallsDay']+=0x1;var _0xddac8d=new AgentComplete(_0x412ad4,_0x5aa002);if(_0x5aa002[_0x2154('0x111')]===_0x2154('0x112')){_0xddac8d[_0x2154('0x113')]=this['voiceQueues'][_0x5aa002[_0x2154('0xb2')]][_0x2154('0x114')]&&this[_0x2154('0x1f')][_0x5aa002[_0x2154('0xb2')]]['dialAgiAfterHangupAgent']?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined;}this[_0x2154('0xcb')](_0xddac8d)[_0x2154('0xb7')](loggerCatch(_0x2154('0x115')));this[_0x2154('0xc9')](_0xddac8d)[_0x2154('0xb7')](loggerCatch(_0x2154('0x116')));}}};Dialer[_0x2154('0x1c')][_0x2154('0x2d')]=function(_0x465c73){if(this[_0x2154('0x1f')][_0x465c73['queue']]){if(this[_0x2154('0xa8')][_0x465c73[_0x2154('0xe0')]]&&this[_0x2154('0xa8')][_0x465c73[_0x2154('0xe0')]][_0x2154('0x4e')]!==_0x2154('0x8e')){this['updateOriginated'](this[_0x2154('0x1f')][_0x465c73['queue']]);this['uniqueId'][_0x465c73['uniqueid']][_0x2154('0x117')]=moment()[_0x2154('0x78')](_0x2154('0x100'));}}};Dialer[_0x2154('0x1c')][_0x2154('0x118')]=function(_0x4150c6){this[_0x2154('0xcb')](_0x4150c6)[_0x2154('0xb7')](loggerCatch('[syncAgentComplete][createHistory]'));this['moveContactManagedDialer'](_0x4150c6)[_0x2154('0xb7')](loggerCatch(_0x2154('0x119')));};Dialer[_0x2154('0x1c')][_0x2154('0x2e')]=function(_0x14fc65){var _0x4b1027=this[_0x2154('0xa8')][_0x14fc65[_0x2154('0xe0')]];var _0x49cc0c=this;if(this[_0x2154('0x1f')][_0x14fc65['queue']]){if(_0x4b1027&&_0x4b1027[_0x2154('0x4e')]!==_0x2154('0x8e')){delete this['uniqueId'][_0x14fc65[_0x2154('0xe0')]];this[_0x2154('0xb1')](this[_0x2154('0x1f')][_0x14fc65['queue']]);_0x4b1027[_0x2154('0x11a')]=moment()[_0x2154('0x78')](_0x2154('0x100'));var _0x376563=new QueueCallerAbandon(_0x4b1027,_0x14fc65);if(getSeconds(_0x4b1027[_0x2154('0x11a')],_0x4b1027['responsetime'])>=_0x4b1027[_0x2154('0x11b')]){this[_0x2154('0x1f')][_0x14fc65[_0x2154('0xb2')]]['predictiveIntervalDroppedCallsTimeout']+=0x1;this[_0x2154('0x1f')][_0x14fc65[_0x2154('0xb2')]][_0x2154('0x11c')]+=0x1;this[_0x2154('0x1f')][_0x14fc65[_0x2154('0xb2')]][_0x2154('0x6e')]+=0x1;_0x376563[_0x2154('0xe8')]=0xa;_0x376563['statedesc']=_0x2154('0x11d');_0x376563[_0x2154('0x11e')]=_0x2154('0x11f');_0x376563['agiafterat']=this[_0x2154('0x1f')][_0x14fc65[_0x2154('0xb2')]][_0x2154('0x114')]?moment()[_0x2154('0x78')](_0x2154('0x100')):undefined;_0x376563[_0x2154('0x107')]+=0x1;_0x376563[_0x2154('0xef')]+=0x1;if(_0x376563[_0x2154('0x107')]>=this[_0x2154('0x1f')][_0x14fc65['queue']][_0x2154('0x120')]){this[_0x2154('0x118')](_0x376563);}else{this[_0x2154('0xbf')]({'active':![],'countdropretry':_0x376563['countdropretry'],'scheduledat':moment()[_0x2154('0xfe')](this['voiceQueues'][_0x14fc65[_0x2154('0xb2')]][_0x2154('0x121')],_0x2154('0x109'))[_0x2154('0x78')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x4b1027['ContactId'],'ListId':_0x4b1027['ListId'],'VoiceQueueId':_0x4b1027['VoiceQueueId']||undefined,'CampaignId':_0x4b1027[_0x2154('0xd5')]||undefined})['catch'](loggerCatch('[rescheduleContact][Drop]'));var _0x17d1aa=new History(_0x376563);_0x17d1aa['state']=0xa;_0x17d1aa[_0x2154('0xa4')]=_0x2154('0x11d');_0x17d1aa[_0x2154('0xa6')]=moment()[_0x2154('0x78')]('YYYY-MM-DD\x20HH:mm:ss');_0x17d1aa['endtime']=_0x17d1aa[_0x2154('0xa6')];_0x17d1aa[_0x2154('0x122')]=_0x376563['calleridname'];_0x17d1aa[_0x2154('0x123')]=_0x376563[_0x2154('0x123')];this['createHistory'](_0x17d1aa)[_0x2154('0xb7')](loggerCatch(_0x2154('0x124')));}}else{this['voiceQueues'][_0x14fc65[_0x2154('0xb2')]][_0x2154('0x6b')]+=0x1;this[_0x2154('0x1f')][_0x14fc65[_0x2154('0xb2')]]['outboundDropCallsDayCallersExit']+=0x1;_0x376563[_0x2154('0xe8')]=0xb;_0x376563[_0x2154('0xa4')]='Abandoned';_0x376563[_0x2154('0x11e')]=_0x2154('0x125');_0x376563[_0x2154('0xf6')]+=0x1;_0x376563[_0x2154('0xef')]+=0x1;if(_0x376563[_0x2154('0xf6')]>=this[_0x2154('0x1f')][_0x14fc65[_0x2154('0xb2')]]['dialAbandonedMaxRetry']){this[_0x2154('0x118')](_0x376563);}else{this['rescheduleContact']({'active':![],'countabandonedretry':_0x376563[_0x2154('0xf6')],'scheduledat':moment()[_0x2154('0xfe')](this[_0x2154('0x1f')][_0x14fc65[_0x2154('0xb2')]][_0x2154('0x126')],_0x2154('0x109'))[_0x2154('0x78')](_0x2154('0x100')),'ContactId':_0x4b1027['ContactId'],'ListId':_0x4b1027[_0x2154('0xd3')],'VoiceQueueId':_0x4b1027[_0x2154('0x101')]||undefined,'CampaignId':_0x4b1027[_0x2154('0xd5')]||undefined})[_0x2154('0xb7')](loggerCatch('[rescheduleContact][Abandoned]'));var _0x17d1aa=new History(_0x376563);_0x17d1aa[_0x2154('0xe8')]=0xb;_0x17d1aa[_0x2154('0xa4')]=_0x2154('0x127');_0x17d1aa['starttime']=moment()[_0x2154('0x78')](_0x2154('0x100'));_0x17d1aa[_0x2154('0xa5')]=_0x17d1aa['starttime'];_0x17d1aa[_0x2154('0x122')]=_0x376563[_0x2154('0x122')];_0x17d1aa[_0x2154('0x123')]=_0x376563[_0x2154('0x123')];this['createHistory'](_0x17d1aa)[_0x2154('0xb7')](loggerCatch(_0x2154('0x128')));}}}}};Dialer[_0x2154('0x1c')][_0x2154('0x36')]=function(_0x3981a7){if(this[_0x2154('0x25')][_0x3981a7[_0x2154('0xe0')]]){this[_0x2154('0x25')][_0x3981a7[_0x2154('0xe0')]][_0x2154('0xaf')]=_0x3981a7[_0x2154('0xaf')];}if(this[_0x2154('0xa8')][_0x3981a7[_0x2154('0xe0')]]){this['uniqueId'][_0x3981a7['uniqueid']][_0x2154('0xaf')]=_0x3981a7[_0x2154('0xaf')];}};Dialer[_0x2154('0x1c')][_0x2154('0x39')]=function(_0x3a3eb1){if(strategy[this['voiceQueues'][this[_0x2154('0x25')][_0x3a3eb1[_0x2154('0x129')]][_0x2154('0xb2')]][_0x2154('0x50')]]==='roundrobin'){if(this[_0x2154('0x25')][_0x3a3eb1[_0x2154('0x129')]]&&_['isNil'](this['actions'][_0x3a3eb1['actionid']][_0x2154('0x12a')])&&_0x3a3eb1['status']==='1'&&_0x3a3eb1[_0x2154('0x12b')]==='0'){if(this[_0x2154('0x21')][_0x3a3eb1[_0x2154('0x12c')]]){if(!this['agents'][_0x3a3eb1[_0x2154('0x12c')]]['locked']){this[_0x2154('0x21')][_0x3a3eb1[_0x2154('0x12c')]][_0x2154('0x12a')]=!![];this['actions'][_0x3a3eb1['actionid']][_0x2154('0x12a')]=!![];this[_0x2154('0x25')][_0x3a3eb1[_0x2154('0x129')]][_0x2154('0x12c')]=_0x3a3eb1[_0x2154('0x12c')];}}}}else if((strategy[this[_0x2154('0x1f')][this['actions'][_0x3a3eb1[_0x2154('0x129')]][_0x2154('0xb2')]][_0x2154('0x50')]]||_0x2154('0x12d'))==='rrmemory'){if(this[_0x2154('0x25')][_0x3a3eb1[_0x2154('0x129')]]){if(this[_0x2154('0x21')][_0x3a3eb1[_0x2154('0x12c')]]){this[_0x2154('0x25')][_0x3a3eb1['actionid']]['stateinterface']=_0x3a3eb1['stateinterface'];if(_['isNil'](this[_0x2154('0x12e')][this['actions'][_0x3a3eb1[_0x2154('0x129')]][_0x2154('0xb2')]])){this['queueBooked'][this[_0x2154('0x25')][_0x3a3eb1[_0x2154('0x129')]][_0x2154('0xb2')]]=[];}this[_0x2154('0x12e')][this[_0x2154('0x25')][_0x3a3eb1[_0x2154('0x129')]][_0x2154('0xb2')]]['push'](_[_0x2154('0x8b')](_[_0x2154('0xd1')](this[_0x2154('0x25')][_0x3a3eb1['actionid']],[_0x2154('0x12f'),_0x2154('0x12c')]),{'status':_0x3a3eb1[_0x2154('0xae')],'paused':_0x3a3eb1['paused']}));}}}};function unlockQueueStatus(_0x3730df,_0x4fc2b8){setTimeout(function(){if(_['isUndefined'](_0x3730df[_0x2154('0x130')])){loggerBooked[_0x2154('0x92')]('[unlockQueueStatus][undefined]',_0x4fc2b8);}_0x3730df[_0x2154('0x130')]=!![];loggerBooked['info'](_0x2154('0x131'),_0x4fc2b8,JSON[_0x2154('0x49')](_[_0x2154('0xd1')](_0x3730df,['name',_0x2154('0x130')])));},0x1f3);}Dialer[_0x2154('0x1c')]['syncQueueStatusComplete']=function(_0x326669){var _0x38dceb=this;var _0x1f8a74=_0x38dceb[_0x2154('0x1f')][_0x38dceb[_0x2154('0x25')][_0x326669[_0x2154('0x129')]]['queue']];if(strategy[this[_0x2154('0x1f')][this['actions'][_0x326669[_0x2154('0x129')]][_0x2154('0xb2')]][_0x2154('0x50')]]===_0x2154('0x132')){if(this[_0x2154('0x25')][_0x326669[_0x2154('0x129')]]&&this[_0x2154('0x25')][_0x326669[_0x2154('0x129')]][_0x2154('0x12c')]){this[_0x2154('0x1e')]['run'](this[_0x2154('0x25')][_0x326669[_0x2154('0x129')]][_0x2154('0x12f')],this[_0x2154('0x25')][_0x326669[_0x2154('0x129')]][_0x2154('0x12c')])['catch'](function(_0x38bf63){logger[_0x2154('0x92')](_0x2154('0x133'),util['inspect'](_0x38bf63,{'showHidden':![],'depth':null}));})[_0x2154('0x1d')](function(){_0x38dceb['updateOriginated'](_0x38dceb['voiceQueues'][_0x38dceb[_0x2154('0x25')][_0x326669[_0x2154('0x129')]][_0x2154('0xb2')]]);_0x38dceb[_0x2154('0x21')][_0x38dceb[_0x2154('0x25')][_0x326669[_0x2154('0x129')]][_0x2154('0x12c')]][_0x2154('0x12a')]=![];delete _0x38dceb['actions'][_0x326669[_0x2154('0x129')]];unlockQueueStatus(_0x1f8a74);});}else{this[_0x2154('0xb1')](this[_0x2154('0x1f')][this[_0x2154('0x25')][_0x326669[_0x2154('0x129')]][_0x2154('0xb2')]]);this[_0x2154('0xbf')]({'active':![],'ContactId':this[_0x2154('0x25')][_0x326669[_0x2154('0x129')]][_0x2154('0xd2')],'ListId':this[_0x2154('0x25')][_0x326669[_0x2154('0x129')]][_0x2154('0xd3')],'VoiceQueueId':this[_0x2154('0x25')][_0x326669[_0x2154('0x129')]][_0x2154('0x101')]||undefined,'CampaignId':this[_0x2154('0x25')][_0x326669['actionid']]['CampaignId']||undefined})[_0x2154('0xb7')](loggerCatch(_0x2154('0x134')));delete this[_0x2154('0x25')][_0x326669[_0x2154('0x129')]];unlockQueueStatus(_0x1f8a74);}}else if((strategy[this[_0x2154('0x1f')][this[_0x2154('0x25')][_0x326669[_0x2154('0x129')]][_0x2154('0xb2')]]['strategy']]||_0x2154('0x12d'))===_0x2154('0x12d')){var _0x5c7942;if(this[_0x2154('0x25')][_0x326669[_0x2154('0x129')]]&&!_[_0x2154('0x46')](this['queueBooked'][this['actions'][_0x326669['actionid']]['queue']])){if(this[_0x2154('0x2b')][_0x38dceb[_0x2154('0x25')][_0x326669[_0x2154('0x129')]]['queue']]){this['queueBookedRR'][_0x38dceb[_0x2154('0x25')][_0x326669[_0x2154('0x129')]][_0x2154('0xb2')]]=this[_0x2154('0x2b')][this[_0x2154('0x25')][_0x326669[_0x2154('0x129')]]['queue']]?this[_0x2154('0x2b')][this[_0x2154('0x25')][_0x326669[_0x2154('0x129')]][_0x2154('0xb2')]]:this[_0x2154('0x12e')][this[_0x2154('0x25')][_0x326669[_0x2154('0x129')]][_0x2154('0xb2')]]?this[_0x2154('0x12e')][this[_0x2154('0x25')][_0x326669[_0x2154('0x129')]][_0x2154('0xb2')]][_0x2154('0x135')]||0x0:0x0;}this[_0x2154('0x12e')][this[_0x2154('0x25')][_0x326669[_0x2154('0x129')]][_0x2154('0xb2')]][_0x2154('0x135')]=this[_0x2154('0x2b')][this[_0x2154('0x25')][_0x326669[_0x2154('0x129')]]['queue']];for(var _0xf697f=0x0;_0xf697f=0x0;})[_0x2154('0xb7')](myreject(_0x1c030b)));}}else{_0x31fbef[_0x2154('0x151')](ami[_0x2154('0xad')]({'action':_0x2154('0x152'),'command':util[_0x2154('0x78')](_0x2154('0x153'),_0x2a84d8,!_['isUndefined'](config['timezones'][_0x3bb635])?_0x3bb635:'')})[_0x2154('0xba')](function(_0x210d5a){return _0x210d5a[_0x2154('0x155')][_0x2154('0x157')](_0x2154('0x156'))>=0x0;})[_0x2154('0xb7')](myreject(_0x1c030b)));}BPromise[_0x2154('0x158')](_0x31fbef)[_0x2154('0xba')](function(_0x2f0421){var _0x8d58bc=_[_0x2154('0x159')](_0x2f0421);if(_0x8d58bc){return _0x50242c(_0x8d58bc);}else{_0x46b8f8[_0x2154('0x40')]=_0x50e309?_0x2154('0x15a'):_0x2154('0x15b');return _0x1c030b(msgResponse('[ifTime][promiseAll]',_0x2154('0x14a'),'Global:\x20'+_0x50e309+'\x20'+_0x25cf27+_0x2154('0x15c')+util[_0x2154('0x93')](_0x2a84d8,{'showHidden':![],'depth':null})+_0x2154('0x15d')+_0x3bb635));}})['catch'](function(_0x1bf0be){return _0x1c030b(msgResponse(_0x2154('0x147'),_0x2154('0x14a'),JSON[_0x2154('0x49')](_0x1bf0be)));});});};Dialer[_0x2154('0x1c')]['checkDialMethod']=function(_0x2930d1){var _0x883afe=this;return function(){switch(_0x2930d1['dialMethod']){case _0x2154('0x15e'):freeVariablesPredictive(_0x2930d1);_0x883afe[_0x2154('0x15f')](_0x2930d1,0x1);break;case _0x2154('0x160'):freeVariablesPredictive(_0x2930d1);_0x883afe[_0x2154('0x15f')](_0x2930d1,_0x2930d1[_0x2154('0x161')]);break;case'predictive':_0x883afe[_0x2154('0xa')](_0x2930d1);break;case _0x2154('0x162'):freeVariablesPredictive(_0x2930d1);_0x883afe[_0x2154('0x15f')](_0x2930d1,0x1);break;default:freeVariablesPredictive(_0x2930d1);logger[_0x2154('0x92')]('Queue',_0x2930d1[_0x2154('0x3f')],_0x2154('0x163'));}};};Dialer[_0x2154('0x1c')][_0x2154('0x164')]=function(_0x3d5c1a){var _0x5c7c2c=this;return function(){_0x5c7c2c[_0x2154('0x165')](_0x3d5c1a);};};Dialer[_0x2154('0x1c')]['syncQueueSummary']=function(_0x54e2a5){var _0x31895e=this;if(isNotPreview(_0x54e2a5[_0x2154('0x59')])){if(isVoiceQueueOutbound(_0x54e2a5[_0x2154('0x4e')])&&isActive(_0x54e2a5[_0x2154('0x166')])){_0x54e2a5[_0x2154('0x9c')]=!![];BPromise[_0x2154('0xb5')]()[_0x2154('0xba')](checkIsLoggedIn(_0x54e2a5,_0x54e2a5[_0x2154('0x53')]))[_0x2154('0xba')](checkIsActive(_0x54e2a5,_0x54e2a5[_0x2154('0x166')]))[_0x2154('0xba')](checkInterval(_0x54e2a5))[_0x2154('0xba')](_0x31895e[_0x2154('0x142')](_0x54e2a5))[_0x2154('0xba')](_0x31895e[_0x2154('0x146')](_0x54e2a5[_0x2154('0x167')],_0x54e2a5[_0x2154('0x168')],_0x54e2a5['name'],_0x54e2a5))[_0x2154('0xba')](_0x31895e[_0x2154('0x148')](_0x54e2a5[_0x2154('0x42')],_0x54e2a5[_0x2154('0x168')],_0x54e2a5['name'],_0x54e2a5))[_0x2154('0xba')](_0x31895e[_0x2154('0x169')](_0x54e2a5))[_0x2154('0xb7')](loggerCatchQueueSummary(_0x2154('0x16a'),_0x54e2a5));}else{notSendMessagesQueue(_0x54e2a5);}}else{freeVariablesPredictive(_0x54e2a5);}};Dialer[_0x2154('0x1c')][_0x2154('0x141')]=function(){var _0x2960b2=this;var _0x4b8761;for(var _0x4b3c81 in this[_0x2154('0x20')]){if(typeof this[_0x2154('0x20')][_0x4b3c81]!==_0x2154('0xaa')){_0x4b8761=this[_0x2154('0x20')][_0x4b3c81];if(isCampaignIvr(_0x4b8761['type'])&&isActive(_0x4b8761[_0x2154('0xdb')])){_0x4b8761[_0x2154('0x9c')]=!![];BPromise[_0x2154('0xb5')]()[_0x2154('0xba')](checkIsActive(_0x4b8761,_0x4b8761[_0x2154('0xdb')]))[_0x2154('0xba')](checkInterval(_0x4b8761))['then'](_0x2960b2['checkIsTrunkReachable'](_0x4b8761))[_0x2154('0xba')](_0x2960b2[_0x2154('0x146')](_0x4b8761[_0x2154('0x167')],_0x4b8761[_0x2154('0x168')],_0x4b8761[_0x2154('0x3f')],_0x4b8761))['then'](_0x2960b2['checkIfTimeIntervals'](_0x4b8761[_0x2154('0x42')],_0x4b8761['dialTimezone'],_0x4b8761[_0x2154('0x3f')],_0x4b8761))['then'](_0x2960b2[_0x2154('0x164')](_0x4b8761))[_0x2154('0xb7')](loggerCatchQueueSummary(_0x2154('0x16b'),_0x4b8761));}else{notSendMessagesCampaign(_0x4b8761);}}}};function getCallerIdRandom(_0x1541d3,_0x4f3c9a){var _0x78bdab;var _0x577dd9;var _0x2af4dd;if(_0x4f3c9a<=0x0){_0x4f3c9a=0x1;}_0x78bdab=new RegExp(_0x2154('0x16c')+_0x4f3c9a+'}$');_0x577dd9=Math[_0x2154('0x16d')](0xa,_0x4f3c9a-0x1);_0x2af4dd=Math[_0x2154('0x16d')](0xa,_0x4f3c9a)-0x1;return util[_0x2154('0x78')]('%s',_[_0x2154('0x16e')](_0x1541d3,_0x78bdab,_[_0x2154('0x16f')](_0x577dd9,_0x2af4dd)));}function extractCalleridName(_0x5b0049){var _0x2f2b97=_0x5b0049[_0x2154('0x170')](/"(.*?)"/);return _0x2f2b97?_0x2f2b97[0x1]:_0x5b0049;}function extractCalleridNumber(_0x425c0d){var _0x36ad23=_0x425c0d[_0x2154('0x170')](/<(.*?)>/);return _0x36ad23?_0x36ad23[0x1]:_0x425c0d;}Dialer[_0x2154('0x1c')][_0x2154('0x171')]=function(_0x26d687,_0x2afb63){var _0x3bff80=this;var _0x54ab1d=uuid['v4']();this[_0x2154('0x25')][_0x54ab1d]=new Action(_0x26d687,_0x2afb63,_0x54ab1d);return new BPromise(function(_0x55405f,_0x21e1b1){if(_[_0x2154('0x3d')](_0x26d687)&&typeof _0x26d687!=='object'){return _0x21e1b1(msgResponse(_0x2154('0x172'),_0x2154('0x14a'),_0x2154('0x173')));}if(_['isUndefined'](_0x2afb63['Contact'][_0x2154('0x174')])||_0x2afb63[_0x2154('0x175')][_0x2154('0x174')]===null){return _0x21e1b1(msgResponse('originate',_0x2154('0x14a'),'contact\x20is\x20undefine'));}var _0x55b027={'XMD-CALLERID':_0x3bff80[_0x2154('0x25')][_0x54ab1d][_0x2154('0x176')](),'XMD-AGI':_0x26d687['dialQueueProject']?util['format'](_0x2154('0x177'),ipAgi,_0x26d687[_0x2154('0x10d')]):_0x2154('0x178'),'XMD-AGIAFTER':_0x26d687[_0x2154('0x114')]?util[_0x2154('0x78')](_0x2154('0x177'),ipAgi,_0x26d687['dialQueueProject2']):_0x2154('0x178'),'XMD-QUEUE':_0x26d687[_0x2154('0x4e')]===_0x2154('0x4f')?util[_0x2154('0x78')](_0x2154('0x179'),_0x26d687[_0x2154('0x3f')],_0x26d687[_0x2154('0x17a')]||'',_0x26d687['dialAgiAfterHangupAgent']?'c':'',_0x26d687[_0x2154('0x11b')]||0x3):_0x2154('0x178'),'XMD-CONTACTID':_0x2afb63['ContactId'],'XMD-CDRTYPE':_0x2154('0x8'),'CALLERID(all)':_0x3bff80[_0x2154('0x25')][_0x54ab1d][_0x2154('0x176')](),'XMD-AMD':_0x26d687['dialAMDActive']?_0x2154('0x17b'):_0x2154('0x178'),'XMD-DESTINATION':_0x2154('0xe4')};if(_0x26d687['dialAMDActive']){_0x55b027[_0x2154('0x17c')]=_0x26d687[_0x2154('0x17d')]||0x9c4;_0x55b027['XMD-AMDGREETING']=_0x26d687['dialAMDGreeting']||0x5dc;_0x55b027[_0x2154('0x17e')]=_0x26d687[_0x2154('0x17f')]||0x320;_0x55b027[_0x2154('0x180')]=_0x26d687[_0x2154('0x181')]||0x1388;_0x55b027['XMD-AMDMINWORDLENGTH']=_0x26d687[_0x2154('0x182')]||0x64;_0x55b027[_0x2154('0x183')]=_0x26d687[_0x2154('0x184')]||0x32;_0x55b027[_0x2154('0x185')]=_0x26d687[_0x2154('0x186')]||0x3;_0x55b027[_0x2154('0x187')]=_0x26d687[_0x2154('0x188')]||0x100;_0x55b027['XMD-AMDMAXIMUMWORDLENGTH']=_0x26d687[_0x2154('0x189')]||0x1388;}if(_0x26d687[_0x2154('0x4e')]===_0x2154('0x4f')){_0x55b027['XMD-VOICEQUEUEID']=_0x2afb63[_0x2154('0x101')];}else{_0x55b027[_0x2154('0x18a')]=_0x2afb63[_0x2154('0xd5')];}for(var _0x591740 in _0x2afb63[_0x2154('0x175')]){if(typeof _0x2afb63[_0x2154('0x175')][_0x591740]!==_0x2154('0xaa')){if(isNotNull(_0x2afb63['Contact'][_0x591740])&&_0x591740!=='id'&&_0x591740!==_0x2154('0x18b')&&_0x591740!=='createdAt'&&_0x591740!==_0x2154('0x18c')){_0x55b027[util[_0x2154('0x78')](_0x2154('0x18d'),_0x2154('0x18e'),_[_0x2154('0x18f')](_0x591740))]=_0x2afb63[_0x2154('0x175')][_0x591740];}}}var _0x1f2777=_0x3bff80[_0x2154('0xda')](_0x26d687[_0x2154('0x75')])?getCallerId(_0x26d687[_0x2154('0x75')][_0x2154('0x76')],_0x26d687['dialOriginateCallerIdName'],_0x26d687[_0x2154('0x190')]>0x0?getCallerIdRandom(_0x26d687[_0x2154('0x5b')],_0x26d687[_0x2154('0x190')]):_0x26d687['dialOriginateCallerIdNumber']):getCallerId(_[_0x2154('0xac')](_0x26d687['TrunkBackup'])?_0x26d687[_0x2154('0x75')]['callerid']:_0x26d687[_0x2154('0x143')][_0x2154('0x76')],_0x26d687[_0x2154('0x5a')],_0x26d687[_0x2154('0x190')]>0x0?getCallerIdRandom(_0x26d687[_0x2154('0x5b')],_0x26d687[_0x2154('0x190')]):_0x26d687['dialOriginateCallerIdNumber']);if(_0x1f2777){_0x55b027[_0x2154('0x191')]=_0x3bff80[_0x2154('0x25')][_0x54ab1d]['originatecalleridname']=extractCalleridName(_0x1f2777);_0x55b027[_0x2154('0x192')]=_0x3bff80[_0x2154('0x25')][_0x54ab1d][_0x2154('0x193')]=extractCalleridNumber(_0x1f2777);}return ami[_0x2154('0xad')]({'actionid':_0x54ab1d,'action':_0x2154('0x172'),'channel':_0x3bff80['isTrunkReachable'](_0x26d687[_0x2154('0x75')])?util[_0x2154('0x78')](_0x2154('0x194'),_0x26d687[_0x2154('0x75')][_0x2154('0x3f')],isNotNull(_0x26d687[_0x2154('0x5d')])?_0x26d687[_0x2154('0x5d')][_0x2154('0x195')]()||'':'',_0x26d687[_0x2154('0x196')]>0x0?_0x2afb63['Contact']['phone'][_0x2154('0x197')](_0x26d687[_0x2154('0x196')]):_0x2afb63[_0x2154('0x175')][_0x2154('0x174')]):util[_0x2154('0x78')](_0x2154('0x194'),_[_0x2154('0xac')](_0x26d687[_0x2154('0x143')])?_0x26d687[_0x2154('0x75')][_0x2154('0x3f')]:_0x26d687[_0x2154('0x143')]['name'],isNotNull(_0x26d687[_0x2154('0x5d')])?_0x26d687[_0x2154('0x5d')][_0x2154('0x195')]()||'':'',_0x26d687['dialCutDigit']>0x0?_0x2afb63[_0x2154('0x175')][_0x2154('0x174')][_0x2154('0x197')](_0x26d687[_0x2154('0x196')]):_0x2afb63[_0x2154('0x175')][_0x2154('0x174')]),'callerid':_0x1f2777,'Exten':_0x2154('0xe4'),'Context':_0x2154('0x198'),'Priority':'1','variable':_0x55b027,'timeout':(_0x26d687[_0x2154('0x5c')]||0x1e)*0x3e8,'async':!![],'channelid':_0x54ab1d})['then'](function(_0x493323){return _0x55405f(_0x493323);})[_0x2154('0xb7')](function(_0x29ee62){_0x26d687[_0x2154('0x65')]+=0x1;var _0x31ea0d=new History(_0x3bff80[_0x2154('0x25')][_0x54ab1d]);logger[_0x2154('0x92')](util['format'](_0x2154('0x199'),JSON[_0x2154('0x49')](_0x29ee62)));_0x31ea0d[_0x2154('0xe8')]=0xe;_0x31ea0d['statedesc']='OriginateError';_0x31ea0d[_0x2154('0xa6')]=moment()[_0x2154('0x78')](_0x2154('0x100'));_0x31ea0d[_0x2154('0xa5')]=_0x31ea0d['starttime'];_0x3bff80[_0x2154('0xcb')](_0x31ea0d)[_0x2154('0xb7')](loggerCatch(_0x2154('0x19a')));_0x3bff80[_0x2154('0xc9')](_0x31ea0d)['catch'](loggerCatch('[originate][error]'))['finally'](function(){delete _0x3bff80[_0x2154('0x25')][_0x54ab1d];return _0x21e1b1(msgResponse(_0x2154('0x172'),_0x2154('0x48'),_0x2154('0x19b')));});});});};Dialer[_0x2154('0x1c')]['syncOriginateResponse']=function(_0x56e2be){var _0x4aa960=this[_0x2154('0x25')][_0x56e2be['actionid']];if(_0x4aa960){delete this['actions'][_0x56e2be['actionid']];_0x4aa960[_0x2154('0x19c')]=moment()[_0x2154('0x78')](_0x2154('0x100'));var _0x4d9549=_0x4aa960[_0x2154('0x4e')]===_0x2154('0x8e')?this[_0x2154('0x20')][_0x4aa960[_0x2154('0xb2')]]:this[_0x2154('0x1f')][_0x4aa960[_0x2154('0x19d')]()];if(!this[_0x2154('0xd8')](_0x56e2be[_0x2154('0x19e')])){this['updateOriginated'](_0x4d9549);return this['callProgressDetecting'](_0x4aa960,_0x4d9549,_0x56e2be)[_0x2154('0xb7')](loggerCatch(_0x2154('0x19f')));}this[_0x2154('0xa8')][_0x56e2be[_0x2154('0xe0')]]=_0x4aa960;}};Dialer[_0x2154('0x1c')]['checkRetriveMax']=function(_0xd5cc8c,_0x3de7db,_0x280fa6){var _0x275bd5=new History(_0x3de7db);if(_0x275bd5['countbusyretry']+_0x275bd5['countcongestionretry']+_0x275bd5[_0x2154('0xf4')]+_0x275bd5[_0x2154('0xf5')]+_0x275bd5[_0x2154('0x107')]+_0x275bd5[_0x2154('0xf6')]+_0x275bd5[_0x2154('0xf7')]+_0x275bd5[_0x2154('0xf8')]>=_0x280fa6[_0x2154('0xf9')]-0x1){return!![];}switch(_0xd5cc8c){case 0x3:if(_0x275bd5['countnoanswerretry']>=_0x280fa6['dialNoAnswerMaxRetry']-0x1){return!![];}this[_0x2154('0xbf')]({'active':![],'countnoanswerretry':_0x275bd5[_0x2154('0xf4')]+=0x1,'scheduledat':moment()[_0x2154('0xfe')](_0x280fa6['dialNoAnswerRetryFrequency'],_0x2154('0x109'))[_0x2154('0x78')](_0x2154('0x100')),'ContactId':_0x275bd5[_0x2154('0xd2')],'ListId':_0x275bd5['ListId'],'VoiceQueueId':_0x275bd5['VoiceQueueId']||undefined,'CampaignId':_0x275bd5[_0x2154('0xd5')]||undefined})['catch'](loggerCatch(_0x2154('0x1a0')));break;case 0x5:if(_0x275bd5[_0x2154('0xf2')]>=_0x280fa6[_0x2154('0x1a1')]-0x1){return!![];}this[_0x2154('0xbf')]({'active':![],'countbusyretry':_0x275bd5['countbusyretry']+=0x1,'scheduledat':moment()['add'](_0x280fa6[_0x2154('0x1a2')],'minutes')[_0x2154('0x78')](_0x2154('0x100')),'ContactId':_0x275bd5['ContactId'],'ListId':_0x275bd5[_0x2154('0xd3')],'VoiceQueueId':_0x275bd5['VoiceQueueId']||undefined,'CampaignId':_0x275bd5[_0x2154('0xd5')]||undefined})[_0x2154('0xb7')](loggerCatch(_0x2154('0x1a3')));break;case 0x8:if(_0x275bd5['countcongestionretry']>=_0x280fa6['dialCongestionMaxRetry']-0x1){return!![];}this['rescheduleContact']({'active':![],'countcongestionretry':_0x275bd5['countcongestionretry']+=0x1,'scheduledat':moment()['add'](_0x280fa6[_0x2154('0x1a4')],_0x2154('0x109'))[_0x2154('0x78')](_0x2154('0x100')),'ContactId':_0x275bd5[_0x2154('0xd2')],'ListId':_0x275bd5[_0x2154('0xd3')],'VoiceQueueId':_0x275bd5[_0x2154('0x101')]||undefined,'CampaignId':_0x275bd5[_0x2154('0xd5')]||undefined})['catch'](loggerCatch('[rescheduleContact]\x20[Congestion]'));break;case 0x0:if(_0x275bd5[_0x2154('0xf5')]>=_0x280fa6[_0x2154('0x1a5')]-0x1){return!![];}else{this[_0x2154('0xbf')]({'active':![],'countnosuchnumberretry':_0x275bd5[_0x2154('0xf5')]+=0x1,'scheduledat':moment()['add'](_0x280fa6['dialNoSuchNumberRetryFrequency'],_0x2154('0x109'))['format'](_0x2154('0x100')),'ContactId':_0x275bd5['ContactId'],'ListId':_0x275bd5['ListId'],'VoiceQueueId':_0x275bd5[_0x2154('0x101')]||undefined,'CampaignId':_0x275bd5['CampaignId']||undefined})[_0x2154('0xb7')](loggerCatch('[rescheduleContact][NoSuchNumber]'));}break;case 0xa:if(_0x275bd5[_0x2154('0x107')]>=_0x280fa6[_0x2154('0x120')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countdropretry':_0x275bd5[_0x2154('0x107')]+=0x1,'scheduledat':moment()[_0x2154('0xfe')](_0x280fa6[_0x2154('0x121')],_0x2154('0x109'))[_0x2154('0x78')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x275bd5[_0x2154('0xd2')],'ListId':_0x275bd5[_0x2154('0xd3')],'VoiceQueueId':_0x275bd5[_0x2154('0x101')]||undefined,'CampaignId':_0x275bd5[_0x2154('0xd5')]||undefined})[_0x2154('0xb7')](loggerCatch(_0x2154('0x1a6')));break;case 0xb:if(_0x275bd5[_0x2154('0xf6')]>=_0x280fa6[_0x2154('0x1a7')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countabandonedretry':_0x275bd5['countabandonedretry']+=0x1,'scheduledat':moment()[_0x2154('0xfe')](_0x280fa6[_0x2154('0x126')],_0x2154('0x109'))[_0x2154('0x78')](_0x2154('0x100')),'ContactId':_0x275bd5[_0x2154('0xd2')],'ListId':_0x275bd5[_0x2154('0xd3')],'VoiceQueueId':_0x275bd5[_0x2154('0x101')]||undefined,'CampaignId':_0x275bd5[_0x2154('0xd5')]||undefined})[_0x2154('0xb7')](loggerCatch('[rescheduleContact][Abandoned]'));break;case 0x13:if(_0x275bd5[_0x2154('0xf7')]>=_0x280fa6[_0x2154('0xfc')]-0x1){return!![];}this[_0x2154('0xbf')]({'active':![],'countmachineretry':_0x275bd5[_0x2154('0xf7')]+=0x1,'scheduledat':moment()[_0x2154('0xfe')](_0x280fa6[_0x2154('0xff')],_0x2154('0x109'))[_0x2154('0x78')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x275bd5[_0x2154('0xd2')],'ListId':_0x275bd5[_0x2154('0xd3')],'VoiceQueueId':_0x275bd5[_0x2154('0x101')]||undefined,'CampaignId':_0x275bd5[_0x2154('0xd5')]||undefined})[_0x2154('0xb7')](loggerCatch(_0x2154('0x102')));break;case 0x14:if(_0x275bd5[_0x2154('0xf8')]>=_0x280fa6['dialAgentRejectMaxRetry']-0x1){return!![];}this[_0x2154('0xbf')]({'active':![],'countagentrejectretry':_0x275bd5['countagentrejectretry']+=0x1,'scheduledat':moment()['add'](_0x280fa6['dialAgentRejectRetryFrequency'],_0x2154('0x109'))[_0x2154('0x78')](_0x2154('0x100')),'ContactId':_0x275bd5[_0x2154('0xd2')],'ListId':_0x275bd5[_0x2154('0xd3')],'VoiceQueueId':_0x275bd5[_0x2154('0x101')]||undefined,'CampaignId':_0x275bd5[_0x2154('0xd5')]||undefined})[_0x2154('0xb7')](loggerCatch('[rescheduleContact][AgentReject]'));break;default:return!![];}};Dialer[_0x2154('0x1c')]['callProgressDetecting']=function(_0x345d8e,_0x4f2d69,_0x28ed0b){var _0x24a0a7=this;var _0x10060a=new History(_0x345d8e);return new BPromise(function(_0x26dbf4,_0x3641b3){if(_[_0x2154('0x3d')](_0x4f2d69)&&typeof _0x4f2d69!=='object'){return _0x3641b3(msgResponse('[callProgressDetecting]',_0x2154('0x14a'),'entity\x20is\x20undefine'));}if(_[_0x2154('0x3d')](_0x28ed0b)&&typeof _0x28ed0b!=='object'){return _0x3641b3(msgResponse(_0x2154('0x1a8'),_0x2154('0x14a'),_0x2154('0x1a9')));}switch(_0x28ed0b[_0x2154('0x111')]){case'0':_0x4f2d69[_0x2154('0x1aa')]+=0x1;_0x10060a[_0x2154('0xe8')]=0x0;_0x10060a[_0x2154('0xa4')]='NoSuchNumber';_0x10060a[_0x2154('0xf5')]+=0x1;_0x10060a[_0x2154('0xef')]+=0x1;ami[_0x2154('0x4d')](_0x2154('0x1ab'),ut[_0x2154('0xf0')](_0x345d8e,'nosuchnumber'));_0x24a0a7[_0x2154('0xcb')](_0x10060a)['catch'](loggerCatch(_0x2154('0xf1')));if(_0x24a0a7[_0x2154('0x1ac')](0x0,_0x345d8e,_0x4f2d69)){if(_0x10060a[_0x2154('0xf5')]>=_0x4f2d69[_0x2154('0x1a5')]){_0x24a0a7[_0x2154('0xfd')](_0x10060a,_0x26dbf4,_0x3641b3,_0x2154('0x1ad'));}else{_0x24a0a7[_0x2154('0xfa')](_0x10060a,_0x26dbf4,_0x3641b3,_0x2154('0x1ad'));}}break;case'3':_0x4f2d69[_0x2154('0x64')]+=0x1;_0x10060a[_0x2154('0xe8')]=0x3;_0x10060a[_0x2154('0xa4')]=_0x2154('0x1ae');_0x10060a[_0x2154('0xf4')]+=0x1;_0x10060a[_0x2154('0xef')]+=0x1;ami['emit'](_0x2154('0x1af'),ut[_0x2154('0xf0')](_0x345d8e,_0x2154('0x1b0')));_0x24a0a7[_0x2154('0xcb')](_0x10060a)['catch'](loggerCatch(_0x2154('0x1b1')));if(_0x24a0a7['checkRetriveMax'](0x3,_0x345d8e,_0x4f2d69)){if(_0x10060a['countnoanswerretry']>=_0x4f2d69[_0x2154('0x1b2')]){_0x24a0a7[_0x2154('0xfd')](_0x10060a,_0x26dbf4,_0x3641b3,_0x2154('0x1b3'));}else{_0x24a0a7[_0x2154('0xfa')](_0x10060a,_0x26dbf4,_0x3641b3,_0x2154('0x1b3'));}}break;case'5':_0x4f2d69[_0x2154('0x61')]+=0x1;_0x10060a[_0x2154('0xe8')]=0x5;_0x10060a[_0x2154('0xa4')]=_0x2154('0x1b4');_0x10060a[_0x2154('0xf2')]+=0x1;_0x10060a[_0x2154('0xef')]+=0x1;ami[_0x2154('0x4d')](_0x2154('0x1b5'),ut[_0x2154('0xf0')](_0x345d8e,'busy'));_0x24a0a7[_0x2154('0xcb')](_0x10060a)[_0x2154('0xb7')](loggerCatch(_0x2154('0x1b6')));if(_0x24a0a7[_0x2154('0x1ac')](0x5,_0x345d8e,_0x4f2d69)){if(_0x10060a[_0x2154('0xf2')]>=_0x4f2d69[_0x2154('0x1a1')]){_0x24a0a7[_0x2154('0xfd')](_0x10060a,_0x26dbf4,_0x3641b3,_0x2154('0x1b7'));}else{_0x24a0a7[_0x2154('0xfa')](_0x10060a,_0x26dbf4,_0x3641b3,'reason\x205\x20busy');}}break;case'8':_0x4f2d69[_0x2154('0x62')]+=0x1;_0x10060a[_0x2154('0xe8')]=0x8;_0x10060a['statedesc']=_0x2154('0x1b8');_0x10060a[_0x2154('0xf3')]+=0x1;_0x10060a[_0x2154('0xef')]+=0x1;ami[_0x2154('0x4d')](_0x2154('0x1b9'),ut[_0x2154('0xf0')](_0x345d8e,'congestion'));_0x24a0a7[_0x2154('0xcb')](_0x10060a)['catch'](loggerCatch(_0x2154('0x1ba')));if(_0x24a0a7['checkRetriveMax'](0x8,_0x345d8e,_0x4f2d69)){if(_0x10060a[_0x2154('0xf3')]>=_0x4f2d69['dialCongestionMaxRetry']){_0x24a0a7[_0x2154('0xfd')](_0x10060a,_0x26dbf4,_0x3641b3,_0x2154('0x1bb'));}else{_0x24a0a7['stateGlobal'](_0x10060a,_0x26dbf4,_0x3641b3,_0x2154('0x1bb'));}}break;case'11':_0x4f2d69[_0x2154('0x1bc')]+=0x1;_0x10060a[_0x2154('0xe8')]=0xb;_0x10060a['statedesc']=_0x2154('0x127');_0x10060a[_0x2154('0xf6')]+=0x1;_0x10060a[_0x2154('0xef')]+=0x1;_0x24a0a7['createHistory'](_0x10060a)[_0x2154('0xb7')](loggerCatch('[syncAgentComplete][createHistory][11]'));if(_0x24a0a7[_0x2154('0x1ac')](0xb,_0x345d8e,_0x4f2d69)){if(_0x10060a[_0x2154('0xf6')]>=_0x4f2d69['dialAbandonedMaxRetry']){_0x24a0a7['createStateFinal'](_0x10060a,_0x26dbf4,_0x3641b3,_0x2154('0x1bd'));}else{_0x24a0a7[_0x2154('0xfa')](_0x10060a,_0x26dbf4,_0x3641b3,'reason\x2011\x20abandoned');}}break;case'20':_0x4f2d69['outboundRejectCallsDay']+=0x1;_0x10060a[_0x2154('0xe8')]=0x14;_0x10060a[_0x2154('0xa4')]=_0x2154('0x1be');_0x10060a[_0x2154('0xf8')]+=0x1;_0x10060a[_0x2154('0xef')]+=0x1;ami[_0x2154('0x4d')](_0x2154('0x1bf'),ut['buildObj'](_0x345d8e,_0x2154('0x1c0')));_0x24a0a7[_0x2154('0xcb')](_0x10060a)[_0x2154('0xb7')](loggerCatch(_0x2154('0x1c1')));if(_0x24a0a7[_0x2154('0x1ac')](0x14,_0x345d8e,_0x4f2d69)){if(_0x10060a['countagentrejectretry']>=_0x4f2d69[_0x2154('0x1c2')]){_0x24a0a7['createStateFinal'](_0x10060a,_0x26dbf4,_0x3641b3,_0x2154('0x1c3'));}else{_0x24a0a7['stateGlobal'](_0x10060a,_0x26dbf4,_0x3641b3,_0x2154('0x1c3'));}}break;default:_0x4f2d69[_0x2154('0x68')]+=0x1;_0x10060a[_0x2154('0xe8')]=0xc;_0x10060a[_0x2154('0xa4')]=_0x28ed0b['reason'];_0x24a0a7[_0x2154('0xcb')](_0x10060a)[_0x2154('0xb7')](loggerCatch('[syncAgentComplete][createHistory][?]'));if(_0x24a0a7[_0x2154('0x1ac')](_0x28ed0b[_0x2154('0x111')],_0x345d8e,_0x4f2d69)){if(_0x10060a[_0x2154('0xf2')]+_0x10060a[_0x2154('0xf3')]+_0x10060a[_0x2154('0xf4')]+_0x10060a['countnosuchnumberretry']+_0x10060a[_0x2154('0x107')]+_0x10060a['countabandonedretry']+_0x10060a[_0x2154('0xf7')]+_0x10060a[_0x2154('0xf8')]>=_0x4f2d69[_0x2154('0xf9')]){_0x24a0a7[_0x2154('0xfa')](_0x10060a,_0x26dbf4,_0x3641b3,_0x28ed0b[_0x2154('0x111')]);}else{_0x24a0a7[_0x2154('0xfd')](_0x10060a,_0x26dbf4,_0x3641b3,_0x28ed0b['reason']);}}}});};Dialer[_0x2154('0x1c')][_0x2154('0xfa')]=function(_0x35a2bc,_0x272fc8,_0x550255,_0x566804){var _0x26f965=new Final(_0x35a2bc);_0x26f965[_0x2154('0xe8')]=0xf;_0x26f965[_0x2154('0xa4')]=_0x2154('0x1c4');this[_0x2154('0xfd')](_0x26f965,_0x272fc8,_0x550255,_0x566804);};Dialer[_0x2154('0x1c')][_0x2154('0xfd')]=function(_0xfabae8,_0x2ad539,_0x47ee7c,_0x298aa6){this[_0x2154('0xc9')](_0xfabae8)[_0x2154('0xba')](function(){return _0x2ad539(msgResponse(_0x2154('0x1a8'),_0x2154('0xd9'),_0x298aa6));})['catch'](function(){return _0x47ee7c(msgResponse(_0x2154('0x1c5'),'Failure',_0x2154('0x1c6')));});};Dialer[_0x2154('0x1c')][_0x2154('0xa')]=function(_0x468c02){var _0x1479b5=_0x468c02[_0x2154('0x1c7')]/0x64;var _0x42e96e=_0x468c02[_0x2154('0x11c')]/(_0x468c02[_0x2154('0x11c')]+_0x468c02[_0x2154('0x5f')]);var _0x4c02ec=Math['round'](_0x468c02[_0x2154('0x6f')]*(_0x468c02['predictiveIntervalMaxThreshold']/0x64));var _0x2f4e88=Math[_0x2154('0x1c8')](_0x468c02['predictiveIntervalAvailable']*(_0x468c02[_0x2154('0x1c9')]/0x64));var _0x40a009=_0x468c02['available']+_0x468c02[_0x2154('0x9d')];var _0x589e6d=Math[_0x2154('0x1ca')](_0x468c02[_0x2154('0x71')]*_0x468c02[_0x2154('0x73')]*_0x468c02[_0x2154('0x1cb')]*_0x468c02[_0x2154('0x1cc')]);if(_[_0x2154('0x3d')](_0x468c02[_0x2154('0x29')])){if(!_[_0x2154('0x3d')](_0x468c02[_0x2154('0x28')])){_0x468c02[_0x2154('0x28')]=undefined;loggerPredictive[_0x2154('0x92')](_0x2154('0x1cd'),_0x2154('0x1ce'));}if(!_['isUndefined'](_0x468c02['handlePredictive'])){loggerPredictive[_0x2154('0x92')](_0x2154('0x1cd'),_0x2154('0x1cf'));clearInterval(_0x468c02[_0x2154('0x8c')]);_0x468c02[_0x2154('0x8c')]=undefined;}_0x468c02['startProgressive']=moment()[_0x2154('0x78')](_0x2154('0x100'));loggerPredictive[_0x2154('0x7b')](_0x468c02[_0x2154('0x3f')],_0x2154('0x1d0'),_0x468c02[_0x2154('0x29')]);this[_0x2154('0x15f')](_0x468c02,0x1);}else if(ifInterval(_0x468c02[_0x2154('0x1d1')],_0x468c02[_0x2154('0x29')])){this[_0x2154('0x15f')](_0x468c02,0x1);loggerPredictiveCalls[_0x2154('0x7b')](_0x2154('0x1d2'),_0x468c02[_0x2154('0x29')],_0x468c02[_0x2154('0x3f')]);_0x468c02[_0x2154('0x71')]=0x0;_0x468c02['predictiveIntervalErlangCallsDroppedCalls']=0x0;}else if(_0x1479b5<_0x42e96e&&_0x468c02[_0x2154('0x1d3')]===_0x2154('0x1d4')){freeVariablesPredictive(_0x468c02);loggerPredictive[_0x2154('0x7b')](_0x2154('0x1d5'),'Dropped\x20calls\x20day',_0x42e96e,'startProgressive',_0x468c02['name']);}else if(_0x589e6d<_0x468c02[_0x2154('0x6e')]&&_0x468c02[_0x2154('0x1d3')]===_0x2154('0x1d4')){freeVariablesPredictive(_0x468c02);loggerPredictive[_0x2154('0x7b')]('[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]',_0x2154('0x1d6'),_0x589e6d,'Drop\x20in\x20this\x20interval',_0x468c02[_0x2154('0x6e')],'startProgressive',_0x468c02['name']);}else if(!ifInterval(_0x468c02[_0x2154('0x1d1')],_0x468c02['startProgressive'])&&_[_0x2154('0x3d')](_0x468c02[_0x2154('0x28')])&&!_[_0x2154('0x3d')](_0x468c02['startProgressive'])){_0x468c02[_0x2154('0x28')]=moment()[_0x2154('0x78')](_0x2154('0x100'));loggerPredictive[_0x2154('0x7b')](_0x468c02[_0x2154('0x3f')],_0x2154('0x1d7'),_0x468c02[_0x2154('0x28')]);this[_0x2154('0xbd')](_0x468c02['dialPredictiveInterval'])[_0x2154('0xba')](this[_0x2154('0x1d8')](_0x468c02))[_0x2154('0xba')](mergeDataErlangB(_0x468c02))[_0x2154('0xba')](this[_0x2154('0x1d9')](_0x468c02))[_0x2154('0xb7')](loggerCatchPredictive(_0x2154('0x1da'),_0x468c02));}else if(!ifInterval(_0x468c02['dialPredictiveInterval'],_0x468c02[_0x2154('0x28')])){_0x468c02['predictiveIntervalErlangCallsDroppedCalls']=0x0;_0x468c02[_0x2154('0x28')]=moment()[_0x2154('0x78')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive['info'](_0x468c02[_0x2154('0x3f')],_0x2154('0x1db'),_0x468c02['startPredictive']);clearInterval(_0x468c02[_0x2154('0x8c')]);_0x468c02[_0x2154('0x8c')]=undefined;this[_0x2154('0xbd')](_0x468c02[_0x2154('0x1d1')])[_0x2154('0xba')](this[_0x2154('0x1d8')](_0x468c02))[_0x2154('0xba')](mergeDataErlangB(_0x468c02))[_0x2154('0xba')](this[_0x2154('0x1d9')](_0x468c02))[_0x2154('0xb7')](loggerCatchPredictive(_0x2154('0x1dc'),_0x468c02));}else if(_0x468c02['predictiveIntervalAvailable']&&_0x40a009<_0x468c02[_0x2154('0x6f')]-_0x2f4e88){freeVariablesPredictive(_0x468c02);loggerPredictive['info'](_0x468c02['name'],_0x2154('0x1dd'),_0x40a009,_0x2154('0x1de'),_0x468c02[_0x2154('0x6f')],'-',_0x2f4e88,'=',_0x468c02[_0x2154('0x6f')]-_0x2f4e88,')');}else if(_0x468c02[_0x2154('0x6f')]&&_0x40a009>_0x468c02[_0x2154('0x6f')]+_0x4c02ec){freeVariablesPredictive(_0x468c02);loggerPredictive['info'](_0x468c02[_0x2154('0x3f')],_0x2154('0x1dd'),_0x40a009,_0x2154('0x1df'),_0x468c02['predictiveIntervalAvailable'],'+',_0x4c02ec,'=',_0x468c02[_0x2154('0x6f')]+_0x4c02ec,')');}};Dialer[_0x2154('0x1c')][_0x2154('0x1d8')]=function(_0x1fe1dc){var _0x20c795=this;return function(_0x3d471d){return new BPromise(function(_0x219471,_0x110482){_[_0x2154('0x8b')](_0x1fe1dc,_0x3d471d[0x0]);if(checkGetDataPredictive(_0x3d471d[0x0])){var _0x43a020=_0x1fe1dc['predictiveIntervalAvailable']=_0x1fe1dc[_0x2154('0x9d')]+_0x1fe1dc[_0x2154('0x52')];var _0x43b2d2=_0x1fe1dc[_0x2154('0x1d1')]*0x3c;var _0x2c60a2=_0x3d471d[0x0][_0x2154('0x6a')]+_0x3d471d[0x0][_0x2154('0x69')];var _0x58be3c=(_0x3d471d[0x0][_0x2154('0x1e0')]+_0x3d471d[0x0][_0x2154('0x6c')]+_0x3d471d[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x3d471d[0x0][_0x2154('0x7e')];_0x1fe1dc[_0x2154('0x1cb')]=_0x58be3c>0x0?_0x58be3c:0x1;switch(_0x1fe1dc[_0x2154('0x1d3')]){case _0x2154('0x1d4'):var _0xc4ea66=_0x1fe1dc[_0x2154('0x1c7')]/0x64;return _0x20c795[_0x2154('0x1e1')](_0x43a020,_0x43b2d2,_0x2c60a2,_0x58be3c,_0xc4ea66)[_0x2154('0xba')](function(_0x5233aa){return _0x219471(_0x5233aa);});case _0x2154('0x1e2'):var _0x5201dd=_0x1fe1dc[_0x2154('0x1c7')]/0x64;return _0x20c795[_0x2154('0x1e3')](_0x43a020,_0x43b2d2,_0x2c60a2,_0x58be3c,_0x5201dd)['then'](function(_0x13dc23){return _0x219471(_0x13dc23);});default:return _0x110482(msgResponse(_0x2154('0x1e4'),_0x2154('0x14a'),_0x2154('0x1e5')));}}else{return _0x110482(msgResponse('[getDataPredictive]','Failure',_0x2154('0x1e6')));}});};};Dialer[_0x2154('0x1c')][_0x2154('0x1e7')]=function(_0x4d8418){var _0x235a3d=this;return function(_0xbd81bb){return new BPromise(function(_0x2427e3,_0x1711e7){_[_0x2154('0x8b')](_0x4d8418,_0xbd81bb[0x0]);if(checkGetDataPredictive(_0xbd81bb[0x0])){loggerPredictive[_0x2154('0x7b')](JSON[_0x2154('0x49')](_0xbd81bb[0x0]));if(_0x4d8418['dialPredictiveOptimization']===_0x2154('0x1d4')){return _0x235a3d[_0x2154('0xc7')](_0x4d8418['id'])[_0x2154('0xba')](function(_0x1ef8c2){var _0x47304a=_0x4d8418['loggedIn']-_0x1ef8c2[0x0][_0x2154('0x1e8')];var _0x2cac33=_0x4d8418[_0x2154('0x1d1')]*0x3c;var _0x3d1df9=_0xbd81bb[0x0][_0x2154('0x6a')]+_0xbd81bb[0x0][_0x2154('0x69')];var _0x266316=(_0xbd81bb[0x0][_0x2154('0x1e0')]+_0xbd81bb[0x0][_0x2154('0x6c')]+_0xbd81bb[0x0][_0x2154('0x6b')])/_0xbd81bb[0x0]['predictiveIntervalTotalCalls'];var _0x515c2e=_0x4d8418['dialPredictiveOptimizationPercentage']/0x64;_0x4d8418[_0x2154('0x1e9')]=_0x1ef8c2[0x0][_0x2154('0x1e8')]||0x0;_0x4d8418[_0x2154('0x1cb')]=_0x266316>0x0?_0x266316:0x1;return _0x235a3d['abandonmentRate'](_0x47304a,_0x2cac33,_0x3d1df9,_0x266316,_0x515c2e);})[_0x2154('0xba')](function(_0x327933){return _0x2427e3(_0x327933);})[_0x2154('0xb7')](function(_0x19f0eb){return _0x1711e7(msgResponse(_0x2154('0x1ea'),'Failure',JSON[_0x2154('0x49')](_0x19f0eb)));});}if(_0x4d8418[_0x2154('0x1d3')]==='agentBusyFactor'){return _0x235a3d[_0x2154('0xc7')](_0x4d8418['id'])[_0x2154('0xba')](function(_0x5b799a){var _0x1b23f8=_0x4d8418['loggedIn']-_0x5b799a[0x0]['outboundQueuePauses'];var _0x2a1f18=_0x4d8418[_0x2154('0x1d1')]*0x3c;var _0x1afb47=_0xbd81bb[0x0][_0x2154('0x6a')]+_0xbd81bb[0x0]['predictiveIntervalAvgHoldtime'];var _0x3e9698=(_0xbd81bb[0x0][_0x2154('0x1e0')]+_0xbd81bb[0x0]['predictiveIntervalDroppedCallsTimeout']+_0xbd81bb[0x0][_0x2154('0x6b')])/_0xbd81bb[0x0]['predictiveIntervalTotalCalls'];var _0x10b528=_0x4d8418[_0x2154('0x1c7')]/0x64;_0x4d8418[_0x2154('0x1e9')]=_0x5b799a[0x0][_0x2154('0x1e8')]||0x0;_0x4d8418['predictiveIntervalHitRate']=_0x3e9698>0x0?_0x3e9698:0x1;return _0x235a3d['busyFactor'](_0x1b23f8,_0x2a1f18,_0x1afb47,_0x3e9698,_0x10b528);})[_0x2154('0xba')](function(_0xf71536){return _0x2427e3(_0xf71536);})[_0x2154('0xb7')](function(_0x3be3de){return _0x1711e7(msgResponse(_0x2154('0x1ea'),_0x2154('0x14a'),JSON[_0x2154('0x49')](_0x3be3de)));});}}else{return _0x1711e7(msgResponse('[getDataPredictive]',_0x2154('0x14a'),_0x2154('0x1e6')));}});};};Dialer[_0x2154('0x1c')]['startMethodPredictive']=function(_0x4b6b89){var _0x4c7ad6=this;return function(){var _0x2cde3d=0x0;var _0x130d81=Math[_0x2154('0x1ca')](_0x4b6b89['erlangCallToSecond']*0x3e8);if(_0x130d81>0x0){_0x130d81=_0x130d81<0x64?0x64:_0x130d81;loggerPredictive['info'](_0x4b6b89['name'],_0x2154('0x1eb'),_0x130d81,_0x2154('0x4a'));_0x4b6b89['handlePredictive']=setInterval(function(){_0x4c7ad6[_0x2154('0x8c')](_0x4b6b89);loggerPredictiveCalls['info'](_0x2154('0x1ec'),_0x2cde3d+=0x1);},_0x130d81);}else{loggerPredictive['info'](_0x4b6b89[_0x2154('0x3f')],_0x2154('0x1ed'));}};};Dialer[_0x2154('0x1c')]['checkContactBlack']=function(_0x3c392c,_0x2a2ebf){var _0xfd7688=this;return function(_0x351113){if(_[_0x2154('0x46')](_0x351113)){if(_[_0x2154('0xac')](_0x2a2ebf[_0x2154('0xd4')])||!_0x2a2ebf['recallme']){if(_0x3c392c[_0x2154('0x59')]===_0x2154('0x162')){_0x3c392c[_0x2154('0x130')]=_[_0x2154('0x3d')](_0x3c392c[_0x2154('0x130')])?!![]:_0x3c392c[_0x2154('0x130')];var _0x35eea5=uuid['v4']();_0xfd7688['actions'][_0x35eea5]=new Action(_0x3c392c,_0x2a2ebf,_0x35eea5);loggerBooked[_0x2154('0x7b')](_0x2154('0x1ee'),_0x35eea5,_0x2154('0x1ef'),JSON[_0x2154('0x49')](_0x3c392c[_0x2154('0x130')]),_0x2154('0x1f0'),_0x3c392c[_0x2154('0x3f')]);if(_0x3c392c[_0x2154('0x130')]){_0x3c392c['queueStatusComplete']=![];_0xfd7688[_0x2154('0x12e')][_0xfd7688['actions'][_0x35eea5]['queue']]=[];ami['Action']({'actionid':_0x35eea5,'action':'queuestatus','queue':_0x3c392c[_0x2154('0x3f')]})[_0x2154('0xb7')](function(){_0xfd7688['updateOriginated'](_0x3c392c);_0xfd7688[_0x2154('0xbf')]({'active':![],'ContactId':_0xfd7688['actions'][_0x35eea5]['ContactId'],'ListId':_0xfd7688['actions'][_0x35eea5][_0x2154('0xd3')],'VoiceQueueId':_0xfd7688[_0x2154('0x25')][_0x35eea5]['VoiceQueueId']||undefined,'CampaignId':_0xfd7688['actions'][_0x35eea5][_0x2154('0xd5')]||undefined})[_0x2154('0xb7')](loggerCatch(_0x2154('0x1f1')));delete _0xfd7688[_0x2154('0x25')][_0x35eea5];});}else{loggerBooked['info']('[booked][checkContactBlack][else]',JSON[_0x2154('0x49')](_0x3c392c[_0x2154('0x130')]),'Queue:\x20',_0x3c392c[_0x2154('0x3f')]);_0xfd7688[_0x2154('0xb1')](_0x3c392c);_0xfd7688['rescheduleContact']({'active':![],'ContactId':_0xfd7688['actions'][_0x35eea5][_0x2154('0xd2')],'ListId':_0xfd7688['actions'][_0x35eea5][_0x2154('0xd3')],'VoiceQueueId':_0xfd7688['actions'][_0x35eea5]['VoiceQueueId']||undefined,'CampaignId':_0xfd7688[_0x2154('0x25')][_0x35eea5][_0x2154('0xd5')]||undefined})['catch'](loggerCatch(_0x2154('0x1f1')));delete _0xfd7688[_0x2154('0x25')][_0x35eea5];}}else{return _0xfd7688['actionOriginate'](_0x3c392c,_0x2a2ebf);}}else{if(getDiff(_0x2a2ebf[_0x2154('0x1f2')])<_0x3c392c[_0x2154('0x1f3')]*0x3c){if(_0x2a2ebf[_0x2154('0x1f4')]&&!_0x2a2ebf[_0x2154('0x1f4')]['voicePause']){_0xfd7688[_0x2154('0x1e')]['run'](_0x2a2ebf['id'])['finally'](function(){_0xfd7688[_0x2154('0xb1')](_0x3c392c);});}else{_0xfd7688[_0x2154('0xc1')]({'active':![]},_0x2a2ebf['id'],0x1)['finally'](function(){_0xfd7688[_0x2154('0xb1')](_0x3c392c);});}}else{_0x3c392c[_0x2154('0x66')]+=0x1;_0xfd7688[_0x2154('0xb1')](_0x3c392c);if(_0x3c392c[_0x2154('0x1f5')]){_0xfd7688['rescheduleContact']({'active':![],'recallme':![],'UserId':null,'ContactId':_0x2a2ebf[_0x2154('0xd2')],'ListId':_0x2a2ebf[_0x2154('0xd3')],'VoiceQueueId':_0x2a2ebf['VoiceQueueId']||undefined,'CampaignId':_0x2a2ebf[_0x2154('0xd5')]||undefined})[_0x2154('0xb7')](loggerCatch(_0x2154('0x1f6')));_0xfd7688[_0x2154('0xcb')](createObjHistory(_0x3c392c,_0x2a2ebf,_0x2154('0x1f7'),0x17,'RecallInQueue'))[_0x2154('0xb7')](loggerCatch(_0x2154('0x1f8')));}else{_0xfd7688['saveInDb'](createObjHistory(_0x3c392c,_0x2a2ebf,'RECALLFAILEDTIMEOUT',0x16,_0x2154('0x1f9')),_0x2154('0x1fa'),'[Originate][HistoryRecallClose]');}}}}else{_0x3c392c[_0x2154('0x60')]+=0x1;_0xfd7688[_0x2154('0xde')](createObjHistory(_0x3c392c,_0x2a2ebf,_0x2154('0x1fb'),0xd,'Blacklist'),'[Originate][historyBlacklist]','[Originate][MoveBlacklist]');throw _0x2154('0x1fc');}};};Dialer[_0x2154('0x1c')][_0x2154('0x165')]=function(_0x4db00b){var _0x10c6b5=this;var _0x54b10e=_0x4db00b[_0x2154('0x1fd')]-_0x4db00b['originated']-_0x4db00b['temp'];emitCampaignSummary(_0x4db00b);if(_0x54b10e>0x0){if(_0x54b10e>this[_0x2154('0x23')]){_0x54b10e=this['maxNumberOriginate'];}_0x4db00b['temp']+=_0x54b10e;this[_0x2154('0xc5')](_0x4db00b['id'],_0x54b10e,_0x4db00b[_0x2154('0x1fe')],_0x4db00b)[_0x2154('0xba')](function(_0x1f3169){_0x4db00b[_0x2154('0xc4')]-=_0x54b10e;_0x4db00b[_0x2154('0xc4')]=_0x4db00b[_0x2154('0xc4')]>0x0?_0x4db00b['temp']:0x0;if(!checkContactEmpty(_0x1f3169)){_0x4db00b['message']=_0x2154('0x9a');logger[_0x2154('0x7b')](_0x2154('0x1ff')+_0x4db00b[_0x2154('0x3f')]);}else{_0x4db00b['originated']+=_0x1f3169[_0x2154('0x150')];_0x4db00b[_0x2154('0x40')]='RUNNING';for(var _0x3ba0de=0x0;_0x3ba0de<_0x1f3169['length'];_0x3ba0de+=0x1){_0x4db00b[_0x2154('0x200')]+=0x1;if(_[_0x2154('0xac')](_0x1f3169[_0x3ba0de])||_[_0x2154('0xac')](_0x1f3169[_0x3ba0de][_0x2154('0x175')])||_['isNil'](_0x1f3169[_0x3ba0de][_0x2154('0x175')]['phone'])){_0x10c6b5['emptyContact'](_0x2154('0x201'),_0x4db00b,_0x1f3169[_0x3ba0de]);}else{_0x10c6b5[_0x2154('0xbb')](_['pick'](_0x1f3169[_0x3ba0de],[_0x2154('0xd5'),_0x2154('0x202')]))['then'](_0x10c6b5[_0x2154('0x203')](_0x4db00b,_0x1f3169[_0x3ba0de]))[_0x2154('0xb7')](_0x10c6b5[_0x2154('0xce')](_0x2154('0x204'),_0x4db00b));}}}})[_0x2154('0xb7')](loggerGetContactDialer('[getContactCampaign2]',_0x4db00b,_0x54b10e));}};Dialer['prototype'][_0x2154('0x15f')]=function(_0x3c7dc1,_0x562757){var _0x10e62a=this;var _0x4a2ebd=[];var _0x6a36dd=_0x562757>=0x1?_0x562757:0x1;if(_0x3c7dc1[_0x2154('0x59')]==='booked'){_0x6a36dd=0x1;}var _0x288f36=Math[_0x2154('0x1ca')](_0x3c7dc1[_0x2154('0x52')]*_0x6a36dd)-_0x3c7dc1[_0x2154('0x70')]-_0x3c7dc1[_0x2154('0xc4')];emitVoiceQueueSummary(_0x3c7dc1);if(_0x3c7dc1[_0x2154('0x205')]>0x0){var _0x53821c=_0x3c7dc1[_0x2154('0x205')]-_0x3c7dc1['originated']-_0x3c7dc1[_0x2154('0x9d')]-_0x3c7dc1[_0x2154('0xc4')]-_0x3c7dc1[_0x2154('0x9e')];if(_0x288f36>_0x53821c){_0x288f36=_0x53821c;}}if(_0x288f36>0x0){if(_0x3c7dc1['dialMethod']===_0x2154('0x162')){_0x288f36=0x1;}if(_0x288f36>this['maxNumberOriginate']){_0x288f36=this[_0x2154('0x23')];}_0x3c7dc1[_0x2154('0xc4')]+=_0x288f36;for(var _0x2568d1 in this['agents']){if(typeof this['agents'][_0x2568d1]!=='undefined'){if(this[_0x2154('0x21')][_0x2568d1][_0x2154('0xe8')]===_0x2154('0x206')&&this[_0x2154('0x21')][_0x2568d1]['status']==='reachable'){_0x4a2ebd[_0x2154('0x151')](this[_0x2154('0x21')][_0x2568d1]['id']);}}}this[_0x2154('0xc3')](_0x3c7dc1['id'],_0x4a2ebd,_0x288f36,_0x3c7dc1[_0x2154('0x1fe')],_0x3c7dc1)[_0x2154('0xba')](function(_0x12f13c){_0x3c7dc1[_0x2154('0xc4')]-=_0x288f36;_0x3c7dc1[_0x2154('0xc4')]=_0x3c7dc1['temp']>0x0?_0x3c7dc1[_0x2154('0xc4')]:0x0;if(!checkContactEmpty(_0x12f13c)){_0x10e62a[_0x2154('0xb6')](_0x3c7dc1)[_0x2154('0xba')](sendMessageReschedule(_0x3c7dc1))[_0x2154('0xb7')](loggerCatch('[countReScheduled]\x20'));}else{_0x3c7dc1[_0x2154('0x70')]+=_0x12f13c[_0x2154('0x150')];_0x3c7dc1[_0x2154('0x40')]=_0x3c7dc1[_0x2154('0x59')]===_0x2154('0x162')?_0x2154('0x17b'):_0x2154('0x207');for(var _0x181a18=0x0;_0x181a18<_0x12f13c[_0x2154('0x150')];_0x181a18+=0x1){if(_[_0x2154('0xac')](_0x12f13c[_0x181a18])||_['isNil'](_0x12f13c[_0x181a18][_0x2154('0x175')])||_[_0x2154('0xac')](_0x12f13c[_0x181a18][_0x2154('0x175')][_0x2154('0x174')])){_0x10e62a[_0x2154('0xcf')](_0x2154('0x201'),_0x3c7dc1,_0x12f13c[_0x181a18]);}else{_0x10e62a['checkIsBlackList'](_[_0x2154('0xd1')](_0x12f13c[_0x181a18],[_0x2154('0x101'),_0x2154('0x202')]))[_0x2154('0xba')](_0x10e62a[_0x2154('0x203')](_0x3c7dc1,_0x12f13c[_0x181a18]))[_0x2154('0xb7')](_0x10e62a['loggerHandler'](_0x2154('0x201'),_0x3c7dc1));}}}})[_0x2154('0xb7')](loggerGetContactDialer(_0x2154('0x208'),_0x3c7dc1,_0x288f36));}};Dialer['prototype'][_0x2154('0x8c')]=function(_0x342216){if(_0x342216['dialLimitQueue']>0x0){var _0x385315=_0x342216[_0x2154('0x205')]-_0x342216[_0x2154('0x70')]-_0x342216[_0x2154('0x9d')];if(_0x385315>0x0){this['tryOriginatePredictive'](_0x342216);}else{loggerPredictiveCalls[_0x2154('0x7b')](_0x2154('0x209'));}}else{this[_0x2154('0x20a')](_0x342216);}};Dialer['prototype'][_0x2154('0x20a')]=function(_0x369441){var _0x279adf=this;var _0x4cab7a=[];_0x369441['originated']+=0x1;for(var _0x143cba in this[_0x2154('0x21')]){if(typeof this[_0x2154('0x21')][_0x143cba]!==_0x2154('0xaa')){if(this[_0x2154('0x21')][_0x143cba][_0x2154('0xe8')]===_0x2154('0x206')&&this[_0x2154('0x21')][_0x143cba][_0x2154('0xae')]==='reachable'){_0x4cab7a[_0x2154('0x151')](this[_0x2154('0x21')][_0x143cba]['id']);}}}this[_0x2154('0xc3')](_0x369441['id'],_0x4cab7a,0x1,_0x369441[_0x2154('0x1fe')],_0x369441)[_0x2154('0xba')](function(_0x2c7c78){if(!checkContactEmpty(_0x2c7c78)){checkContactLowerLimitOriginate(_0x369441,0x1,0x0);_0x279adf[_0x2154('0xb6')](_0x369441)[_0x2154('0xba')](sendMessageReschedule(_0x369441))['catch'](loggerCatch(_0x2154('0xb8')));}else{_0x369441[_0x2154('0x40')]=_0x2154('0x207');if(_['isNil'](_0x2c7c78[0x0])||_[_0x2154('0xac')](_0x2c7c78[0x0][_0x2154('0x175')])||_[_0x2154('0xac')](_0x2c7c78[0x0][_0x2154('0x175')][_0x2154('0x174')])){_0x279adf['emptyContact'](_0x2154('0x201'),_0x369441,_0x2c7c78[0x0]);}else{_0x279adf[_0x2154('0xb9')](_['pick'](_0x2c7c78[0x0],[_0x2154('0x101'),_0x2154('0x202')]))[_0x2154('0xba')](_0x279adf[_0x2154('0x203')](_0x369441,_0x2c7c78[0x0]))[_0x2154('0xb7')](_0x279adf[_0x2154('0xce')](_0x2154('0x20b'),_0x369441));}}})['catch'](loggerGetContactDialer('[getContactDialerPredictive]',_0x369441,0x1));emitVoiceQueueSummary(_0x369441);};Dialer[_0x2154('0x1c')][_0x2154('0x1e1')]=function(_0x59a707,_0x264d1f,_0x3d1362,_0xd5fa23,_0x47efec,_0xd9452){loggerPredictive['info'](_0x2154('0x20c'));loggerPredictive[_0x2154('0x7b')]('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',_0x59a707);loggerPredictive['info']('Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x264d1f);loggerPredictive[_0x2154('0x7b')](_0x2154('0x20d'),_0x3d1362);loggerPredictive[_0x2154('0x7b')]('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',_0xd5fa23);loggerPredictive[_0x2154('0x7b')](_0x2154('0x20e'),_0x47efec);loggerPredictive[_0x2154('0x7b')](_0x2154('0x83'));return new BPromise(function(_0x534541,_0x2dedce){if(_0x59a707<=0x0||isNaN(_0x59a707)){return _0x2dedce(msgResponse(_0x2154('0x20f'),_0x2154('0x48'),_0x2154('0x210')+_0x59a707));}if(_0x3d1362<=0x0||isNaN(_0x3d1362)){return _0x2dedce(msgResponse('[abandonmentRate]',_0x2154('0x48'),'Ts\x20=\x20'+_0x3d1362));}if(_0xd5fa23<=0x0||isNaN(_0xd5fa23)){return _0x2dedce(msgResponse('[abandonmentRate]','Error',_0x2154('0x211')+_0xd5fa23));}if(_0x264d1f<=0x0||isNaN(_0x264d1f)){return _0x2dedce(msgResponse('[abandonmentRate]','Error',_0x2154('0x212')+_0x264d1f));}if(_0x47efec<=0x0||isNaN(_0x47efec)){return _0x2dedce(msgResponse('[abandonmentRate]',_0x2154('0x48'),'Amax\x20=\x20'+_0x47efec));}_0xd9452=_0xd9452||0x0;var _0x249bc6=0x1/_0x3d1362;var _0x2e1fda=0x0;var _0x574c4e=0x0;var _0x3f8cb5=0x0;var _0xaaf5fe=0x0;for(var _0xe99792=0x0;_0x3f8cb5<_0x47efec;_0xe99792+=0x1){_0x574c4e=_0xe99792/_0x264d1f;_0x2e1fda=(_0xd5fa23*_0x574c4e+_0xd9452)/_0x249bc6;_0x3f8cb5=erlangb(_0x2e1fda,_0x59a707);_0xaaf5fe=_0x2e1fda/_0x59a707*(0x1-erlangb(_0x2e1fda,_0x59a707));}return _0x534541({'erlangCalls':_0xe99792,'erlangCallToSecond':_0x264d1f/_0xe99792,'erlangAbandonmentRate':_0x3f8cb5,'erlangBusyFactor':_0xaaf5fe});});};Dialer[_0x2154('0x1c')][_0x2154('0x1e3')]=function(_0x1e4ecb,_0x3d9a2a,_0x4d8d0e,_0x4fb400,_0x4ccb83,_0x23f0c0){loggerPredictive[_0x2154('0x7b')](_0x2154('0x213'));loggerPredictive[_0x2154('0x7b')](_0x2154('0x214'),_0x1e4ecb);loggerPredictive['info']('Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x3d9a2a);loggerPredictive[_0x2154('0x7b')](_0x2154('0x20d'),_0x4d8d0e);loggerPredictive[_0x2154('0x7b')](_0x2154('0x215'),_0x4fb400);loggerPredictive[_0x2154('0x7b')](_0x2154('0x216'),_0x4ccb83);loggerPredictive[_0x2154('0x7b')]('---------------------------');return new BPromise(function(_0x345d3b,_0x23aee4){if(_0x1e4ecb<=0x0||isNaN(_0x1e4ecb)){return _0x23aee4(msgResponse(_0x2154('0x217'),_0x2154('0x48'),_0x2154('0x210')+_0x1e4ecb));}if(_0x4d8d0e<=0x0||isNaN(_0x4d8d0e)){return _0x23aee4(msgResponse(_0x2154('0x217'),_0x2154('0x48'),_0x2154('0x218')+_0x4d8d0e));}if(_0x4fb400<=0x0||isNaN(_0x4fb400)){return _0x23aee4(msgResponse(_0x2154('0x217'),_0x2154('0x48'),_0x2154('0x211')+_0x4fb400));}if(_0x3d9a2a<=0x0||isNaN(_0x3d9a2a)){return _0x23aee4(msgResponse('[busyFactor]',_0x2154('0x48'),_0x2154('0x212')+_0x3d9a2a));}if(_0x4ccb83<=0x0||isNaN(_0x4ccb83)){return _0x23aee4(msgResponse('[busyFactor]',_0x2154('0x48'),'Umin\x20=\x20'+_0x4ccb83));}_0x23f0c0=_0x23f0c0||0x0;var _0x377e11=0x1/_0x4d8d0e;var _0x2bf8a0=0x0;var _0xadb053=0x0;var _0xd6218e=0x0;var _0x41b64b=0x0;for(var _0x1ce8d2=0x0;_0x41b64b<_0x4ccb83;_0x1ce8d2+=0x1){_0xadb053=_0x1ce8d2/_0x3d9a2a;_0x2bf8a0=(_0x4fb400*_0xadb053+_0x23f0c0)/_0x377e11;_0xd6218e=erlangb(_0x2bf8a0,_0x1e4ecb);_0x41b64b=_0x2bf8a0/_0x1e4ecb*(0x1-erlangb(_0x2bf8a0,_0x1e4ecb));}return _0x345d3b({'erlangCalls':_0x1ce8d2,'erlangCallToSecond':_0x3d9a2a/_0x1ce8d2,'erlangAbandonmentRate':_0xd6218e,'erlangBusyFactor':_0x41b64b});});};module[_0x2154('0x219')]=Dialer; \ No newline at end of file +var _0x803f=['Congestion','[syncAgentComplete][createHistory][8]','dialCongestionMaxRetry','reason\x208\x20congestion','outboundAbandonedCallsDay','[syncAgentComplete][createHistory][11]','reason\x2011\x20abandoned','outboundRejectCallsDay','custom:agentreject','agentreject','[syncAgentComplete][createHistory][20]','[syncAgentComplete][createHistory][?]','Global','Success','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','predictiveIntervalMaxThreshold','round','predictiveIntervalMinThreshold','floor','[startMethodPredictive][StartProgressive]','check\x20handlePredictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','dialPredictiveOptimization','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Drop\x20in\x20this\x20interval','dialPredictiveInterval','started\x20in\x20predictive\x20at','getDataPredictive','recalculate\x20predictive\x20at','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(',')\x20are\x20more\x20than\x20threshold\x20(','abandonmentRate','agentBusyFactor','busyFactor','[getDataPredictive]','Unknown\x20Predictive','check\x20failure','getDataPredictiveOld','outboundQueuePauses','one\x20call\x20every:','[handlePredictive]','fail\x20to\x20scheduled\x20calls','checkContactBlack','recallme','[booked][checkContactBlack]','queueStatusComplete:\x20','Queue:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','Agent','[rescheduleContact][dialRecallInQueue]','RECALLINQUEUE','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','[Originate][HistoryRecallClose]','BLACKLIST','Blacklist','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','handleIvr','limitCalls','getContactDialerIvr','dialOrderByScheduledAt','AVAILABLE_CONTACTS_FINISHED','[getContactCampaign2][Empty]','RUNNING','[actionOriginate]\x20','Contact.phone','[actionOriginateIvr]\x20','[getContactCampaign2]','dialLimitQueue','not_inuse','ACTIVE','[getContactDialer2]','tryOriginatePredictive','[handlePredictive][limitChannel]','--------\x20Drop\x20Rate\x20--------','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','m\x20=\x20','Ts\x20=\x20','p\x20=\x20','interval\x20=\x20','Amax\x20=\x20','----\x20Agent\x20Busy\x20Factor\x20----','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','Umin\x20=\x20','exports','util','bluebird','uuid','md5','ioredis','../preview/util/util','../../../config/environment/','../../../config/logger','booked','predictiveCalls','syncQueueSummary','../ami','redis','socket.io-emitter','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueRt','./action','./history','./queueCallerAbandon','./hangup','XCALLY_IP_AGI','rrmemory','roundrobin','prototype','enqueue','tail','finally','sequence','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','contactsId','uniqueId','optionPredictive','startPredictive','startProgressive','queueBooked','queueBookedRR','syncAgentConnect','bind','queuecallerabandon','syncQueueCallerAbandon','originateresponse','syncOriginateResponse','agentcomplete','syncAgentComplete','hangup','syncHangup','syncNewExten','varset','queuemember','queuestatuscomplete','syncQueueStatusComplete','loopCampaigns','loopClearZombieChannels','message','AGENTS_NOT_LOGGED','name','\x20AGENTS\x20NOT\x20LOGGED','INTERVAL_IS_NULL','\x20INTERVAL_IS_NULL','Interval','Intervals','isEmpty','Error','milliseconds','diff','seconds','emit','type','outbound','strategy','answered','available','sumDuration','sumHoldTime','total','unmanaged','abandoned','waiting','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','outboundAnswerAgiCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayCallersExit','outboundNoAnswerCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCallToSecond','erlangAbandonmentRate','Trunk','active','callerid','stringify','format','voice_queue:save','campaign:ivr:%s','campaign:save','info','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','---------------------------','isUndefined','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','---------\x20ErlangB\x20---------','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangCalls','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangBusyFactor','merge','clearing\x20variable\x20start\x20progressive','handlePredictive','clearing\x20variable\x20handle\x20predictive','ivr','string','\x22%s\x22\x20<%s>','\x22\x22\x20<>','error','inspect','stack','length','undefined','[decremetOriginate]\x20object\x20originated\x20is\x20negative','[decremetOriginate]\x20is\x20null\x20or\x20undefined','contactsRescheduled','RESCHEDULED_CONTACTS','[getContactDialer2][ReScheduled]','contacts','sendMessageOneNotActive','talking','pTalking','NOT_ACTIVE','[syncQueueSummary]\x20Campaign\x20Queue:\x20','is\x20not\x20active','IS_DISACTIVED','is\x20disactive','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','state','statedesc','endtime','starttime','clearZombieChannels','[uniqueid]','actions','[actions]','Action','status','channel','catch','No\x20such\x20channel','queue','[Dialer][checkChannel]','updateOriginated','[Dialer][checkChannel][ivr]','countReScheduled','resolve','[countReScheduled]\x20','checkIsBlackList','[checkIsBlackList]\x20','checkIsBlackListIvr','then','averageHandleTime','avgHandleTime','[averageHandleTime]\x20','rescheduleContact','[rescheduleContact]\x20','unlockContact','[unlockContact]\x20','getContactDialer','temp','[getContactDialer]\x20','[getContactDialerIvr]\x20','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','moveContactManagedDialer','[moveContactManagedDialer]\x20','createHistory','[createHistory]\x20','[updateOriginated]\x20object\x20originated\x20is\x20negative','loggerHandler','emptyContact','notFound','pick','ListId','UserId','VoiceQueueId','CampaignId','[emptyContact][createHistory]','[emptyContact]','isSuccess','reachable','SIP/%s','unmonitored','saveInDb','syncVarSet','uniqueid','isNil','variable','amdstatus','xcally-motion-dialer','dialAMDActive','HANGUP','outboundAnswerCallsDay','AMD','custom:amd','buildObj','amd','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','MACHINE','Machine','[syncAgentComplete][createHistory][0]','countbusyretry','countcongestionretry','countnoanswerretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','dialGlobalMaxRetry','reason\x2019\x20machine....','YYYY-MM-DD\x20HH:mm:ss','ContactId','[rescheduleContact][Machine]','value','HangupInAMD','membername','[syncHangupInAMDIvr][createHistory]','countglobal','stateGlobal','createStateFinal','add','dialMachineRetryFrequency','minutes','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','[syncHangupIvr]','dialQueueProject','AnswerAGI','cause-txt','Unknow','dialQueueProject2','dialAgiAfterHangupAgent','[syncAgentComplete][createHistory]','[syncAgentComplete]','answertime','queueCallerAbandonCreateState','droptime','responsetime','dialQueueTimeout','outboundDropCallsDayTimeout','dropreason','TIMEOUT','agiafterat','dialDropMaxRetry','dialDropRetryFrequency','Drop','calleridname','calleridnum','Abandoned','dialAbandonedRetryFrequency','[rescheduleContact][Abandoned]','syncQueueMember','actionid','locked','paused','stateinterface','push','idHopper','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','queueStatusComplete','preview','run','[Catch][Preview][syncQueueStatusComplete]','_rr','unlockRR','[booked][RR]','Agent:\x20','contactAgent-idHopper:\x20','[booked][RR][finaly]','[booked][unlock]','[unlock][syncQueueStatusComplete]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','checkIsTrunkReachable','TRUNK_IS_NOT_REACHABLE','checkIfTime','ifTime','checkIfTimeIntervals','Failure','\x20Intervals\x20is\x20null\x20','\x20Intervals\x20is\x20empty\x20','timezones','\x20Timezone\x20unknow\x20','isArray','command','iftime\x20%s,%s','interval','content','indexOf','true','all','some','GLOBAL_INTERVAL_IS_OVERTIME','[ifTime][promiseAll]','Global:\x20','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','progressive','power','handlePower','dialPowerLevel','predictive','method\x20not\x20recognized','launchHandleIvr','loggedIn','dialGlobalInterval','dialTimezone','[syncQueueSummary]','[syncCampaigns]','pow','replace','random','match','actionOriginate','object','originate','voiceQueue\x20is\x20undefine','Contact','phone','getCaller','NONE','\x22agi://%s/square,%s\x22','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','XMD-AMDGREETING','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','tags','createdAt','%s%s','XMD-','isTrunkReachable','dialRandomLastDigitCallerIdNumber','TrunkBackup','XMD-ORIGINATECALLERIDNAME','XMD-ORIGINATECALLERIDNUM','SIP/%s/%s%s','dialPrefix','trim','dialCutDigit','substring','[originateError]:\x20%s','OriginateError','[originate][error]','originate\x20action\x20Error','callProgressDetecting','[callProgressDetecting]\x20','checkRetriveMax','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','countnosuchnumberretry','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','dialAbandonedMaxRetry','dialMachineMaxRetry','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','[callProgressDetecting]','entity\x20is\x20undefine','evt\x20is\x20undefine','reason','nosuchnumber','reason\x200\x20no\x20such\x20number....','NoAnswer','custom:agentnoanswer','noanswer','[syncAgentComplete][createHistory][3]','dialNoAnswerMaxRetry','reason\x203\x20ringing\x20no\x20answer','Busy','custom:agentbusy','[syncAgentComplete][createHistory][5]','reason\x205\x20busy'];(function(_0x1aeda2,_0x1217eb){var _0x32dc6d=function(_0x34a460){while(--_0x34a460){_0x1aeda2['push'](_0x1aeda2['shift']());}};_0x32dc6d(++_0x1217eb);}(_0x803f,0x64));var _0xf803=function(_0x55656f,_0x71d94e){_0x55656f=_0x55656f-0x0;var _0x1a0f73=_0x803f[_0x55656f];return _0x1a0f73;};'use strict';var util=require(_0xf803('0x0'));var _=require('lodash');var BPromise=require(_0xf803('0x1'));var uuid=require(_0xf803('0x2'));var moment=require('moment');var rr=require('rr');var md5=require(_0xf803('0x3'));var Redis=require(_0xf803('0x4'));var ut=require(_0xf803('0x5'));var config=require(_0xf803('0x6'));var logger=require(_0xf803('0x7'))('dialer');var loggerBooked=require(_0xf803('0x7'))(_0xf803('0x8'));var loggerPredictive=require(_0xf803('0x7'))('predictive');var loggerPredictiveCalls=require(_0xf803('0x7'))(_0xf803('0x9'));var loggerSyncQueueSummary=require('../../../config/logger')(_0xf803('0xa'));var ami=require(_0xf803('0xb'));config[_0xf803('0xc')]=_['defaults'](config[_0xf803('0xc')],{'host':'localhost','port':0x18eb});var io=require(_0xf803('0xd'))(new Redis(config[_0xf803('0xc')]));var cmHopper=require('../rpc/cmHopper');var cmHopperHistory=require(_0xf803('0xe'));var cmHopperBlack=require(_0xf803('0xf'));var voiceQueueRt=require(_0xf803('0x10'));var Action=require(_0xf803('0x11'));var History=require(_0xf803('0x12'));var Final=require('./final');var AgentComplete=require('./agentComplete');var QueueCallerAbandon=require(_0xf803('0x13'));var Hangup=require(_0xf803('0x14'));var ipAgi=process['env'][_0xf803('0x15')]||'127.0.0.1';var strategy={'rrmemory':_0xf803('0x16'),'roundrobin':_0xf803('0x17')};var Sequence=function(){};Sequence[_0xf803('0x18')][_0xf803('0x19')]=function(_0x58a80b){this[_0xf803('0x1a')]=this[_0xf803('0x1a')]?this[_0xf803('0x1a')][_0xf803('0x1b')](_0x58a80b):_0x58a80b();};function Dialer(_0x2aaef6,_0xd170bc){this[_0xf803('0x1c')]=new Sequence();this['preview']=_0xd170bc;this['voiceQueues']=_0x2aaef6[_0xf803('0x1d')];this[_0xf803('0x1e')]=_0x2aaef6[_0xf803('0x1e')];this[_0xf803('0x1f')]=_0x2aaef6[_0xf803('0x1f')];this[_0xf803('0x20')]=_0x2aaef6[_0xf803('0x20')];this[_0xf803('0x21')]=config[_0xf803('0x21')]||0x2;this[_0xf803('0x22')]={};this['actions']={};this[_0xf803('0x23')]={};this[_0xf803('0x24')]={};this[_0xf803('0x25')]={};this[_0xf803('0x26')]={};this[_0xf803('0x27')]={};this['ivrOriginated']={};this[_0xf803('0x28')]={};this[_0xf803('0x29')]={};ami['on']('agentconnect',this[_0xf803('0x2a')][_0xf803('0x2b')](this));ami['on'](_0xf803('0x2c'),this[_0xf803('0x2d')][_0xf803('0x2b')](this));ami['on'](_0xf803('0x2e'),this[_0xf803('0x2f')][_0xf803('0x2b')](this));ami['on'](_0xf803('0x30'),this[_0xf803('0x31')][_0xf803('0x2b')](this));ami['on']('custom:queuesummary',this[_0xf803('0xa')][_0xf803('0x2b')](this));ami['on'](_0xf803('0x32'),this[_0xf803('0x33')]['bind'](this));ami['on']('newexten',this[_0xf803('0x34')][_0xf803('0x2b')](this));ami['on'](_0xf803('0x35'),this['syncVarSet'][_0xf803('0x2b')](this));ami['on'](_0xf803('0x36'),this['syncQueueMember']['bind'](this));ami['on'](_0xf803('0x37'),this[_0xf803('0x38')]['bind'](this));this[_0xf803('0x39')]();this[_0xf803('0x3a')]();}function isNotNull(_0x3711a1){return _0x3711a1!==null&&!_['isUndefined'](_0x3711a1);}function checkIsLoggedIn(_0x73852c,_0x27c32f){return function(){if(_0x27c32f<=0x0){_0x73852c[_0xf803('0x3b')]=_0xf803('0x3c');throw _0x73852c[_0xf803('0x3d')]+_0xf803('0x3e');}};}function isActive(_0x34b5fa){return _0x34b5fa;}function checkIsActive(_0x2ebd22,_0x3cadd8){return function(){if(!isActive(_0x3cadd8)){_0x2ebd22[_0xf803('0x3b')]='NOT_ACTIVE';throw _0x2ebd22[_0xf803('0x3d')]+'\x20NOT\x20Active';}};}function checkInterval(_0x42e145){return function(){if(!isNotNull(_0x42e145['Interval'])){_0x42e145[_0xf803('0x3b')]=_0xf803('0x3f');throw _0x42e145[_0xf803('0x3d')]+_0xf803('0x40');}if(!isNotNull(_0x42e145[_0xf803('0x41')][_0xf803('0x42')])){_0x42e145[_0xf803('0x3b')]='INTERVAL_IS_NULL';throw _0x42e145[_0xf803('0x3d')]+_0xf803('0x40');}if(!isNotNull(_[_0xf803('0x43')](_0x42e145[_0xf803('0x41')][_0xf803('0x42')]))){_0x42e145[_0xf803('0x3b')]=_0xf803('0x3f');throw _0x42e145[_0xf803('0x3d')]+_0xf803('0x40');}};}function msgResponse(_0x3879d7,_0x55dccd,_0x55d42c){return{'action':_0x3879d7,'response':_0x55dccd,'message':_0x55d42c,'stack':_0x55d42c};}function myreject(_0x3e8399){return function(_0x5b2f05){return _0x3e8399(msgResponse('[ifTime][Action]',_0xf803('0x44'),JSON['stringify'](_0x5b2f05)));};}function getSeconds(_0x188a82,_0x27b064){var _0x2cae0c=moment(_0x188a82)[_0xf803('0x45')](0x0);var _0x2a2193=moment(_0x27b064)[_0xf803('0x45')](0x0);return _0x2cae0c[_0xf803('0x46')](_0x2a2193,_0xf803('0x47'));}function emit(_0x450be6,_0xc6a3c7,_0x479289){io['to'](_0x450be6)[_0xf803('0x48')](_0xc6a3c7,_0x479289);}function emitVoiceQueueSummary(_0x300db7){if(_0x300db7[_0xf803('0x49')]===_0xf803('0x4a')){var _0x43cc68={'id':_0x300db7['id'],'name':_0x300db7['name'],'strategy':_0x300db7[_0xf803('0x4b')],'answered':_0x300db7[_0xf803('0x4c')],'available':_0x300db7[_0xf803('0x4d')],'loggedIn':_0x300db7['loggedIn'],'pTalking':_0x300db7['pTalking'],'sumBillable':_0x300db7['sumBillable'],'sumDuration':_0x300db7[_0xf803('0x4e')],'sumHoldTime':_0x300db7[_0xf803('0x4f')]||0x0,'talking':_0x300db7['talking'],'total':_0x300db7[_0xf803('0x50')],'type':_0x300db7['type'],'unmanaged':_0x300db7[_0xf803('0x51')],'abandoned':_0x300db7[_0xf803('0x52')],'waiting':_0x300db7[_0xf803('0x53')],'loggedInDb':_0x300db7[_0xf803('0x54')],'dialActive':_0x300db7[_0xf803('0x55')],'dialMethod':_0x300db7[_0xf803('0x56')],'dialOriginateCallerIdName':_0x300db7[_0xf803('0x57')],'dialOriginateCallerIdNumber':_0x300db7[_0xf803('0x58')],'dialOriginateTimeout':_0x300db7[_0xf803('0x59')],'dialPrefix':_0x300db7['dialPrefix'],'outboundAnswerAgiCallsDay':_0x300db7[_0xf803('0x5a')],'outboundAnswerCallsDay':_0x300db7['outboundAnswerCallsDay'],'outboundBlacklistCallsDay':_0x300db7[_0xf803('0x5b')],'outboundBusyCallsDay':_0x300db7[_0xf803('0x5c')],'outboundCongestionCallsDay':_0x300db7[_0xf803('0x5d')],'outboundDropCallsDayACS':_0x300db7['outboundDropCallsDayACS'],'outboundDropCallsDayCallersExit':_0x300db7[_0xf803('0x5e')],'outboundDropCallsDayTimeout':_0x300db7['outboundDropCallsDayTimeout'],'outboundNoAnswerCallsDay':_0x300db7[_0xf803('0x5f')],'outboundNoSuchCallsDay':_0x300db7['outboundNoSuchCallsDay'],'outboundOriginateFailureCallsDay':_0x300db7[_0xf803('0x60')],'outboundReCallsDay':_0x300db7[_0xf803('0x61')],'outboundRejectCallsDay':_0x300db7['outboundRejectCallsDay'],'outboundUnknownCallsDay':_0x300db7[_0xf803('0x62')],'predictiveIntervalAnsweredCalls':_0x300db7[_0xf803('0x63')],'predictiveIntervalAvgHoldtime':_0x300db7[_0xf803('0x64')],'predictiveIntervalAvgTalktime':_0x300db7[_0xf803('0x65')],'predictiveIntervalDroppedCallsCallersExit':_0x300db7[_0xf803('0x66')],'predictiveIntervalDroppedCallsTimeout':_0x300db7[_0xf803('0x67')],'predictiveIntervalErlangCalls':_0x300db7[_0xf803('0x68')],'predictiveIntervalErlangCallsDroppedCalls':_0x300db7[_0xf803('0x69')],'predictiveIntervalHitRate':_0x300db7[_0xf803('0x6a')],'predictiveIntervalMultiplicativeFactor':_0x300db7[_0xf803('0x6b')],'predictiveIntervalPauses':_0x300db7[_0xf803('0x6c')],'predictiveIntervalAvailable':_0x300db7[_0xf803('0x6d')],'predictiveIntervalTotalCalls':_0x300db7[_0xf803('0x6e')],'message':_0x300db7['message'],'originated':_0x300db7[_0xf803('0x6f')],'erlangCalls':_0x300db7['erlangCalls'],'erlangCallToSecond':_0x300db7[_0xf803('0x70')],'erlangAbandonmentRate':_0x300db7[_0xf803('0x71')],'erlangBusyFactor':_0x300db7['erlangBusyFactor'],'startPredictive':_0x300db7[_0xf803('0x26')],'startProgressive':_0x300db7['startProgressive']};if(_0x300db7[_0xf803('0x72')]){_0x43cc68[_0xf803('0x72')]={'id':_0x300db7['Trunk']['id'],'name':_0x300db7[_0xf803('0x72')][_0xf803('0x3d')],'active':_0x300db7[_0xf803('0x72')][_0xf803('0x73')],'callerid':_0x300db7[_0xf803('0x72')][_0xf803('0x74')]};}if(_0x300db7[_0xf803('0x41')]){_0x43cc68[_0xf803('0x41')]={'id':_0x300db7['Interval']['id'],'name':_0x300db7[_0xf803('0x41')]['name']};}var _0x1756b3=md5(JSON[_0xf803('0x75')](_0x43cc68));if(_0x300db7['md5']!==_0x1756b3){_0x300db7['md5']=_0x1756b3;emit(util[_0xf803('0x76')]('voice:queue:%s',_0x43cc68[_0xf803('0x3d')]),_0xf803('0x77'),_0x43cc68);}}}function emitCampaignSummary(_0x3b96a2){if(_0x3b96a2[_0xf803('0x49')]==='ivr'){emit(util[_0xf803('0x76')](_0xf803('0x78'),_0x3b96a2[_0xf803('0x3d')]),_0xf803('0x79'),_0x3b96a2);}}function checkGetDataPredictive(_0x77edc1){if(isNotNull(_0x77edc1)&&!_[_0xf803('0x43')](_0x77edc1)){loggerPredictive[_0xf803('0x7a')]('-----\x20Stats\x20Predictive\x20---');loggerPredictive['info'](_0xf803('0x7b'),_0x77edc1[_0xf803('0x6e')]);loggerPredictive['info']('Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x77edc1[_0xf803('0x63')]);loggerPredictive[_0xf803('0x7a')](_0xf803('0x7c'),_0x77edc1['predictiveIntervalDroppedCallsTimeout']);loggerPredictive['info'](_0xf803('0x7d'),_0x77edc1[_0xf803('0x66')]);loggerPredictive['info']('AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x77edc1[_0xf803('0x64')]);loggerPredictive['info'](_0xf803('0x7e'),_0x77edc1['predictiveIntervalAvgTalktime']);loggerPredictive[_0xf803('0x7a')](_0xf803('0x7f'));if(_0x77edc1[_0xf803('0x6e')]>0x0){if(!_[_0xf803('0x80')](_0x77edc1[_0xf803('0x65')])&&_0x77edc1[_0xf803('0x65')]>0x0){return!![];}loggerPredictive['info'](_0xf803('0x81'));if(!_[_0xf803('0x80')](_0x77edc1[_0xf803('0x64')])&&_0x77edc1['predictiveIntervalAvgHoldtime']>0x0){return!![];}loggerPredictive['info'](_0xf803('0x82'));}else{loggerPredictive[_0xf803('0x7a')](_0xf803('0x83'));}}else{loggerPredictive[_0xf803('0x7a')](_0xf803('0x84'));}return![];}function mergeDataErlangB(_0x2e7514){return function(_0x76de86){loggerPredictive['info'](_0xf803('0x85'));loggerPredictive[_0xf803('0x7a')](_0xf803('0x86'),_0x76de86[_0xf803('0x87')]);loggerPredictive[_0xf803('0x7a')]('One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x76de86[_0xf803('0x70')]);loggerPredictive[_0xf803('0x7a')](_0xf803('0x88'),_0x76de86[_0xf803('0x71')]);loggerPredictive[_0xf803('0x7a')]('Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x76de86[_0xf803('0x89')]);loggerPredictive[_0xf803('0x7a')]('Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x76de86[_0xf803('0x71')]);loggerPredictive[_0xf803('0x7a')](_0xf803('0x7f'));_[_0xf803('0x8a')](_0x2e7514,_0x76de86);};}function getDiff(_0x49e7d1){var _0x123c2f=moment()[_0xf803('0x45')](0x0);var _0x12d0da=moment(_0x49e7d1)[_0xf803('0x45')](0x0);return _0x123c2f[_0xf803('0x46')](_0x12d0da,_0xf803('0x47'));}function ifInterval(_0x135976,_0x2a30ad){if(_[_0xf803('0x80')](_0x2a30ad)){return![];}return getDiff(_0x2a30ad)<_0x135976*0x3c;}function freeVariablesPredictive(_0x5e7446){if(isNotNull(_0x5e7446)){if(!_[_0xf803('0x80')](_0x5e7446['startProgressive'])){_0x5e7446[_0xf803('0x27')]=undefined;loggerPredictive[_0xf803('0x7a')](_0x5e7446[_0xf803('0x3d')],_0xf803('0x8b'));}if(!_['isUndefined'](_0x5e7446['startPredictive'])){_0x5e7446[_0xf803('0x26')]=undefined;loggerPredictive[_0xf803('0x7a')](_0x5e7446[_0xf803('0x3d')],'clearing\x20variable\x20start\x20predictive');}if(!_[_0xf803('0x80')](_0x5e7446['handlePredictive'])){clearInterval(_0x5e7446[_0xf803('0x8c')]);_0x5e7446[_0xf803('0x8c')]=undefined;loggerPredictive[_0xf803('0x7a')](_0x5e7446[_0xf803('0x3d')],_0xf803('0x8d'));}}}function erlangb(_0x28080d,_0x3197ef){if(_0x3197ef===0x0){return 0x0;}var _0x3c6a55=0x1;for(var _0x507b8b=0x1;_0x507b8b<=_0x3197ef;_0x507b8b+=0x1){_0x3c6a55=0x1+_0x3c6a55*_0x507b8b/_0x28080d;}return 0x1/_0x3c6a55;}function isVoiceQueueOutbound(_0x253261){return _0x253261==='outbound';}function isNotPreview(_0x4bad89){return _0x4bad89!=='preview';}function isCampaignIvr(_0x56db6a){return _0x56db6a===_0xf803('0x8e');}function getCallerId(_0x5036a3,_0x2a603e,_0x36c54e){if(!_[_0xf803('0x80')](_0x36c54e)&&typeof _0x36c54e===_0xf803('0x8f')&&!_['isEmpty'](_0x36c54e)){if(!_[_0xf803('0x80')](_0x2a603e)&&typeof _0x2a603e==='string'&&!_[_0xf803('0x43')](_0x2a603e)){return util[_0xf803('0x76')](_0xf803('0x90'),_0x2a603e,_0x36c54e);}return util[_0xf803('0x76')](_0xf803('0x90'),_0x36c54e,_0x36c54e);}if(!_[_0xf803('0x80')](_0x5036a3)&&typeof _0x5036a3==='string'&&!_[_0xf803('0x43')](_0x5036a3)){return _0x5036a3;}return _0xf803('0x91');}function loggerCatchQueueSummary(_0x547aa4,_0x805577){return function(_0x23ce84){freeVariablesPredictive(_0x805577);emitVoiceQueueSummary(_0x805577);emitCampaignSummary(_0x805577);loggerSyncQueueSummary[_0xf803('0x92')](_0x547aa4,util[_0xf803('0x93')](_0x23ce84,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x21b09f,_0x1280c2){return function(_0x264e57){loggerPredictive[_0xf803('0x92')](_0x1280c2[_0xf803('0x3d')],_0x21b09f);loggerPredictive[_0xf803('0x92')](_0x264e57[_0xf803('0x94')]);freeVariablesPredictive(_0x1280c2);};}function loggerCatch(_0x228691){return function(_0x4e57fe){logger[_0xf803('0x92')](_0x228691,util[_0xf803('0x93')](_0x4e57fe,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x4a2805){return _0x4a2805&&!_[_0xf803('0x80')](_0x4a2805)&&_0x4a2805[_0xf803('0x95')]>0x0;}function decremetOriginate(_0x2b5d66){if(!_[_0xf803('0x80')](_0x2b5d66)&&_0x2b5d66!==null){if(typeof _0x2b5d66['originated']!==_0xf803('0x96')){if(_0x2b5d66[_0xf803('0x6f')]>0x0){_0x2b5d66[_0xf803('0x6f')]-=0x1;}else{logger[_0xf803('0x92')](_0xf803('0x97'));}}}else{logger[_0xf803('0x92')](_0xf803('0x98'));}}function checkContactLowerLimitOriginate(_0x423473,_0x55cd95,_0x1f207b){if(_0x55cd95>_0x1f207b){for(var _0x5467bf=0x0;_0x5467bf<_0x55cd95-_0x1f207b;_0x5467bf+=0x1){decremetOriginate(_0x423473);}}}function loggerGetContactDialer(_0x5b3016,_0x3863ec,_0x402021){return function(_0x44c935){checkContactLowerLimitOriginate(_0x3863ec,_0x402021,0x0);logger[_0xf803('0x92')](_0x5b3016,util[_0xf803('0x93')](_0x44c935,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x402ed6){return function(_0x3cf463){if(isNotNull(_0x3cf463)&&isNotNull(_0x3cf463[0x0])){if(_0x3cf463[0x0][_0xf803('0x99')]>0x0){_0x402ed6[_0xf803('0x3b')]=_0xf803('0x9a');logger[_0xf803('0x7a')](_0xf803('0x9b')+_0x402ed6[_0xf803('0x3d')],_0x3cf463[0x0][_0xf803('0x99')],_0xf803('0x9c'));}else{_0x402ed6['message']='AVAILABLE_CONTACTS_FINISHED';logger[_0xf803('0x7a')]('[getContactDialer2][Empty]'+_0x402ed6[_0xf803('0x3d')]);}}};}function notSendMessagesQueue(_0x5f2f74){if(_0x5f2f74[_0xf803('0x9d')]){freeVariablesPredictive(_0x5f2f74);if(_0x5f2f74[_0xf803('0x6f')]===0x0&&_0x5f2f74[_0xf803('0x9e')]===0x0&&_0x5f2f74[_0xf803('0x53')]===0x0&&(_0x5f2f74[_0xf803('0x9f')]||0x0)===0x0){_0x5f2f74['sendMessageOneNotActive']=![];_0x5f2f74['available']=0x0;_0x5f2f74[_0xf803('0x3b')]=_0xf803('0xa0');loggerSyncQueueSummary[_0xf803('0x92')](_0xf803('0xa1'),_0x5f2f74[_0xf803('0x3d')],_0xf803('0xa2'));}else{_0x5f2f74[_0xf803('0x3b')]=_0xf803('0xa3');loggerSyncQueueSummary[_0xf803('0x92')](_0xf803('0xa1'),_0x5f2f74[_0xf803('0x3d')],_0xf803('0xa4'));}emitVoiceQueueSummary(_0x5f2f74);}}function notSendMessagesCampaign(_0x316c39){if(_0x316c39[_0xf803('0x9d')]){if(_0x316c39[_0xf803('0x6f')]===0x0){_0x316c39[_0xf803('0x9d')]=![];_0x316c39['message']=_0xf803('0xa0');loggerSyncQueueSummary['error'](_0xf803('0xa5'),_0x316c39[_0xf803('0x3d')],_0xf803('0xa2'));}else{_0x316c39[_0xf803('0x3b')]='IS_DISACTIVED';loggerSyncQueueSummary[_0xf803('0x92')](_0xf803('0xa5'),_0x316c39[_0xf803('0x3d')],_0xf803('0xa4'));}emitCampaignSummary(_0x316c39);}}function createObjHistory(_0x3a0816,_0x650f91,_0x1b11cc,_0xa2b37,_0x2074e3){_0x3a0816['message']=_0x1b11cc;var _0x3f7a63=new Action(_0x3a0816,_0x650f91);var _0x411db1=new History(_0x3f7a63);_0x411db1[_0xf803('0xa6')]=_0xa2b37;_0x411db1[_0xf803('0xa7')]=_0x2074e3;_0x411db1[_0xf803('0xa8')]=_0x3f7a63[_0xf803('0xa9')];return _0x411db1;}Dialer['prototype'][_0xf803('0x3a')]=function(){var _0x1cc113=this;setInterval(function(){_0x1cc113[_0xf803('0xaa')](_0x1cc113['uniqueId'],_0xf803('0xab'));_0x1cc113['clearZombieChannels'](_0x1cc113[_0xf803('0xac')],_0xf803('0xad'));},0x32c8);};Dialer[_0xf803('0x18')][_0xf803('0xaa')]=function(_0x2933fd,_0x8753e){var _0x26ce6e=this;for(var _0x5f0450 in _0x2933fd){if(typeof _0x2933fd[_0x5f0450]!==_0xf803('0x96')){this[_0xf803('0x1c')][_0xf803('0x19')](function(){if(!_['isNil'](_0x2933fd[_0x5f0450])){return ami[_0xf803('0xae')]({'action':_0xf803('0xaf'),'channel':_0x2933fd[_0x5f0450][_0xf803('0xb0')]})[_0xf803('0xb1')](function(_0xc6742){if(_0xc6742['message']===_0xf803('0xb2')){setTimeout(function(){if(_0x2933fd[_0x5f0450]&&_0x2933fd[_0x5f0450][_0xf803('0x49')]!=='ivr'){_0x26ce6e['updateOriginated'](_0x26ce6e[_0xf803('0x1d')][_0x2933fd[_0x5f0450][_0xf803('0xb3')]]);logger[_0xf803('0x92')](_0xf803('0xb4'),_0x8753e,_0x5f0450,_0x2933fd[_0x5f0450][_0xf803('0xb3')]);delete _0x2933fd[_0x5f0450];}if(_0x2933fd[_0x5f0450]&&_0x2933fd[_0x5f0450][_0xf803('0x49')]===_0xf803('0x8e')){_0x26ce6e[_0xf803('0xb5')](_0x26ce6e['campaigns'][_0x2933fd[_0x5f0450][_0xf803('0xb3')]]);logger[_0xf803('0x92')](_0xf803('0xb6'),_0x8753e,_0x5f0450,_0x2933fd[_0x5f0450]['queue']);delete _0x2933fd[_0x5f0450];}},0x2328);}});}});}}};Dialer[_0xf803('0x18')][_0xf803('0xb7')]=function(_0x338bc7){return BPromise[_0xf803('0xb8')]()['then'](cmHopper[_0xf803('0xb7')](_0x338bc7))[_0xf803('0xb1')](loggerCatch(_0xf803('0xb9')));};Dialer[_0xf803('0x18')][_0xf803('0xba')]=function(_0x4d4cfd){return BPromise[_0xf803('0xb8')]()['then'](cmHopperBlack['checkIsBlackList'](_0x4d4cfd))[_0xf803('0xb1')](loggerCatch(_0xf803('0xbb')));};Dialer['prototype'][_0xf803('0xbc')]=function(_0x5dbb66){return BPromise[_0xf803('0xb8')]()[_0xf803('0xbd')](cmHopperBlack[_0xf803('0xbc')](_0x5dbb66))[_0xf803('0xb1')](loggerCatch('[checkIsBlackListIvr]\x20'));};Dialer[_0xf803('0x18')][_0xf803('0xbe')]=function(_0x47404b){return BPromise[_0xf803('0xb8')]()[_0xf803('0xbd')](cmHopperHistory[_0xf803('0xbf')](_0x47404b))[_0xf803('0xb1')](loggerCatch(_0xf803('0xc0')));};Dialer[_0xf803('0x18')][_0xf803('0xc1')]=function(_0xb882fc){return BPromise[_0xf803('0xb8')]()['then'](cmHopper[_0xf803('0xc1')](_0xb882fc))[_0xf803('0xb1')](loggerCatch(_0xf803('0xc2')));};Dialer[_0xf803('0x18')][_0xf803('0xc3')]=function(_0x11d690,_0x48092e,_0xb4689c){return BPromise[_0xf803('0xb8')]()['then'](cmHopper[_0xf803('0xc3')](_0x11d690,_0x48092e,_0xb4689c))[_0xf803('0xb1')](loggerCatch(_0xf803('0xc4')));};Dialer[_0xf803('0x18')][_0xf803('0xc5')]=function(_0x38d67a,_0x6b5d1c,_0x3d2aa5,_0x2409dd,_0x44e891){return BPromise[_0xf803('0xb8')]()[_0xf803('0xbd')](cmHopper[_0xf803('0xc5')](_0x38d67a,_0x6b5d1c,_0x3d2aa5,_0x2409dd))['catch'](function(_0x3af23b){_0x44e891['temp']-=_0x3d2aa5;_0x44e891['temp']=_0x44e891[_0xf803('0xc6')]>0x0?_0x44e891[_0xf803('0xc6')]:0x0;loggerCatch(_0xf803('0xc7'))(_0x3af23b);});};Dialer[_0xf803('0x18')]['getContactDialerIvr']=function(_0x3f3c4f,_0x19ccd3,_0x20bf58,_0x1b5bf0){return BPromise[_0xf803('0xb8')]()[_0xf803('0xbd')](cmHopper['getContactDialerIvr'](_0x3f3c4f,_0x19ccd3,_0x20bf58))[_0xf803('0xb1')](function(_0x4c30d5){_0x1b5bf0['temp']-=_0x19ccd3;_0x1b5bf0[_0xf803('0xc6')]=_0x1b5bf0[_0xf803('0xc6')]>0x0?_0x1b5bf0[_0xf803('0xc6')]:0x0;loggerCatch(_0xf803('0xc8'))(_0x4c30d5);});};Dialer[_0xf803('0x18')]['getVoiceQueueRtPauses']=function(_0x11bad3){return BPromise[_0xf803('0xb8')]()[_0xf803('0xbd')](voiceQueueRt[_0xf803('0xc9')](_0x11bad3))['catch'](loggerCatch(_0xf803('0xca')));};Dialer['prototype'][_0xf803('0xcb')]=function(_0xe991a0){return BPromise[_0xf803('0xb8')]()[_0xf803('0xbd')](cmHopper[_0xf803('0xcb')](_0xe991a0))[_0xf803('0xb1')](loggerCatch(_0xf803('0xcc')));};Dialer[_0xf803('0x18')][_0xf803('0xcd')]=function(_0x4187cb){return BPromise['resolve']()[_0xf803('0xbd')](cmHopperHistory['createHistory'](_0x4187cb))[_0xf803('0xb1')](loggerCatch(_0xf803('0xce')));};Dialer['prototype'][_0xf803('0xb5')]=function(_0x1a8ee0){if(!_['isUndefined'](_0x1a8ee0)&&_0x1a8ee0!==null){if(typeof _0x1a8ee0[_0xf803('0x6f')]!=='undefined'){if(_0x1a8ee0[_0xf803('0x6f')]>0x0){_0x1a8ee0[_0xf803('0x6f')]-=0x1;}else{logger[_0xf803('0x92')](_0xf803('0xcf'));}}}else{logger[_0xf803('0x92')]('[updateOriginated]\x20is\x20null\x20or\x20undefined');}};Dialer[_0xf803('0x18')][_0xf803('0xd0')]=function(_0x4e7598,_0x1f0aa6){var _0x488db8=this;return function(_0x521b75){_0x488db8[_0xf803('0xb5')](_0x1f0aa6);logger[_0xf803('0x92')](_0x4e7598,util[_0xf803('0x93')](_0x521b75,{'showHidden':![],'depth':null}));};};Dialer[_0xf803('0x18')][_0xf803('0xd1')]=function(_0x4be98c,_0x5537c7,_0x49bf25){var _0x114df7={'state':0x19,'statedesc':_0xf803('0xd2')};this['updateOriginated'](_0x5537c7);this['saveInDb'](_[_0xf803('0x8a')](_0x114df7,_[_0xf803('0xd3')](_0x49bf25,['ContactId',_0xf803('0xd4'),_0xf803('0xd5'),_0xf803('0xd6'),_0xf803('0xd7')])),_0xf803('0xd8'),_0xf803('0xd9'));logger[_0xf803('0x92')](_0x4be98c);};Dialer['prototype'][_0xf803('0xda')]=function(_0x59e8be){return _0x59e8be==='Success';};Dialer[_0xf803('0x18')]['isTrunkReachable']=function(_0x3375db){return!_['isUndefined'](_0x3375db)&&_0x3375db&&!_[_0xf803('0x80')](_0x3375db[_0xf803('0x3d')])&&!_[_0xf803('0x80')](_0x3375db[_0xf803('0x73')])&&_0x3375db[_0xf803('0x73')]&&(this[_0xf803('0x20')][util['format']('SIP/%s',_0x3375db[_0xf803('0x3d')])][_0xf803('0xaf')]===_0xf803('0xdb')||this[_0xf803('0x20')][util[_0xf803('0x76')](_0xf803('0xdc'),_0x3375db[_0xf803('0x3d')])][_0xf803('0xaf')]===_0xf803('0xdd'));};Dialer[_0xf803('0x18')][_0xf803('0xde')]=function(_0x3fc71b,_0x19f05d,_0x31e030){this[_0xf803('0xcd')](_0x3fc71b)[_0xf803('0xb1')](loggerCatch(_0x19f05d));this[_0xf803('0xcb')](_0x3fc71b)[_0xf803('0xb1')](loggerCatch(_0x31e030));};Dialer[_0xf803('0x18')][_0xf803('0xdf')]=function(_0x231b63){var _0x12e988=this[_0xf803('0x24')][_0x231b63[_0xf803('0xe0')]];var _0x5550c6;if(!_[_0xf803('0xe1')](_0x231b63)&&!_[_0xf803('0xe1')](_0x231b63['variable'])&&!_[_0xf803('0xe1')](_0x231b63[_0xf803('0xe2')][_0xf803('0xe3')])&&_0x231b63['exten']===_0xf803('0xe4')&&_0x12e988){if(_0x12e988['type']!==_0xf803('0x8e')&&this[_0xf803('0x1d')][_0x12e988[_0xf803('0xb3')]][_0xf803('0xe5')]&&_0x231b63['value']===_0xf803('0xe6')){delete this['uniqueId'][_0x231b63[_0xf803('0xe0')]];this['updateOriginated'](this[_0xf803('0x1d')][_0x12e988[_0xf803('0xb3')]]);this['voiceQueues'][_0x12e988['queue']][_0xf803('0xe7')]+=0x1;this[_0xf803('0x1d')][_0x12e988['queue']][_0xf803('0x5a')]+=0x1;_0x5550c6=new Hangup(_0x12e988,_0x231b63);_0x5550c6['state']=0x12;_0x5550c6[_0xf803('0xa7')]='HangupInAMD';_0x5550c6['membername']=_0xf803('0xe8');ami[_0xf803('0x48')](_0xf803('0xe9'),ut[_0xf803('0xea')](_0x5550c6,_0xf803('0xeb')));this[_0xf803('0xde')](_0x5550c6,_0xf803('0xec'),_0xf803('0xed'));}if(_0x12e988[_0xf803('0x49')]!==_0xf803('0x8e')&&this[_0xf803('0x1d')][_0x12e988[_0xf803('0xb3')]]['dialAMDActive']&&_0x231b63['value']===_0xf803('0xee')){var _0x28db4c=this;return new BPromise(function(_0x46b966,_0x13be28){delete _0x28db4c[_0xf803('0x24')][_0x231b63['uniqueid']];_0x28db4c[_0xf803('0xb5')](_0x28db4c[_0xf803('0x1d')][_0x12e988[_0xf803('0xb3')]]);_0x28db4c['voiceQueues'][_0x12e988[_0xf803('0xb3')]]['outboundAnswerCallsDay']+=0x1;_0x28db4c[_0xf803('0x1d')][_0x12e988[_0xf803('0xb3')]]['outboundAnswerAgiCallsDay']+=0x1;var _0x4a2948=_0x28db4c['voiceQueues'][_0x12e988[_0xf803('0xb3')]];var _0x1ee5c9=new Hangup(_0x12e988,_0x231b63);_0x1ee5c9[_0xf803('0xa6')]=0x13;_0x1ee5c9['statedesc']=_0xf803('0xef');_0x1ee5c9['membername']=_0xf803('0xe8');_0x1ee5c9['countmachineretry']+=0x1;_0x1ee5c9['countglobal']+=0x1;_0x1ee5c9[_0xf803('0xeb')]=!![];ami['emit'](_0xf803('0xe9'),ut[_0xf803('0xea')](_0x1ee5c9,_0xf803('0xeb')));_0x28db4c['createHistory'](_0x1ee5c9)[_0xf803('0xb1')](loggerCatch(_0xf803('0xf0')));if(_0x1ee5c9[_0xf803('0xf1')]+_0x1ee5c9[_0xf803('0xf2')]+_0x1ee5c9[_0xf803('0xf3')]+_0x1ee5c9['countnosuchnumberretry']+_0x1ee5c9[_0xf803('0xf4')]+_0x1ee5c9[_0xf803('0xf5')]+_0x1ee5c9[_0xf803('0xf6')]+_0x1ee5c9[_0xf803('0xf7')]>=_0x4a2948[_0xf803('0xf8')]){_0x28db4c['stateGlobal'](_0x1ee5c9,_0x46b966,_0x13be28,'reason19\x20machine....');}else{if(_0x1ee5c9[_0xf803('0xf6')]>=_0x4a2948['dialMachineMaxRetry']){_0x28db4c['createStateFinal'](_0x1ee5c9,_0x46b966,_0x13be28,_0xf803('0xf9'));}else{_0x28db4c[_0xf803('0xc1')]({'active':![],'countmachineretry':_0x1ee5c9[_0xf803('0xf6')],'scheduledat':moment()['add'](_0x4a2948['dialMachineRetryFrequency'],'minutes')[_0xf803('0x76')](_0xf803('0xfa')),'ContactId':_0x1ee5c9[_0xf803('0xfb')],'ListId':_0x1ee5c9[_0xf803('0xd4')],'VoiceQueueId':_0x1ee5c9[_0xf803('0xd6')]||undefined,'CampaignId':_0x1ee5c9['CampaignId']||undefined})['catch'](loggerCatch(_0xf803('0xfc')));_0x46b966({'reschedule':0x1});}}});}if(_0x12e988['type']===_0xf803('0x8e')&&this[_0xf803('0x1e')][_0x12e988[_0xf803('0xb3')]][_0xf803('0xe5')]&&_0x231b63[_0xf803('0xfd')]===_0xf803('0xe6')){delete this[_0xf803('0x24')][_0x231b63['uniqueid']];this['updateOriginated'](this[_0xf803('0x1e')][_0x12e988[_0xf803('0xb3')]]);_0x5550c6=new Hangup(_0x12e988,_0x231b63);_0x5550c6[_0xf803('0xa6')]=0x12;_0x5550c6[_0xf803('0xa7')]=_0xf803('0xfe');_0x5550c6[_0xf803('0xff')]=_0xf803('0xe8');ami['emit'](_0xf803('0xe9'),ut['buildObj'](_0x5550c6,_0xf803('0xeb')));this[_0xf803('0xde')](_0x5550c6,_0xf803('0x100'),'[syncHangupInAMDIvr]');}if(_0x12e988['type']===_0xf803('0x8e')&&this[_0xf803('0x1e')][_0x12e988[_0xf803('0xb3')]][_0xf803('0xe5')]&&_0x231b63[_0xf803('0xfd')]===_0xf803('0xee')){var _0x28db4c=this;return new BPromise(function(_0x347d5b,_0xdafc48){delete _0x28db4c[_0xf803('0x24')][_0x231b63['uniqueid']];_0x28db4c[_0xf803('0xb5')](_0x28db4c['campaigns'][_0x12e988['queue']]);_0x28db4c[_0xf803('0x1e')][_0x12e988[_0xf803('0xb3')]][_0xf803('0xe7')]+=0x1;_0x28db4c['campaigns'][_0x12e988[_0xf803('0xb3')]]['outboundAnswerAgiCallsDay']+=0x1;var _0x4ac635=_0x28db4c[_0xf803('0x1e')][_0x12e988[_0xf803('0xb3')]];var _0x55985d=new Hangup(_0x12e988,_0x231b63);_0x55985d[_0xf803('0xa6')]=0x13;_0x55985d[_0xf803('0xa7')]=_0xf803('0xef');_0x55985d[_0xf803('0xff')]=_0xf803('0xe8');_0x55985d['countmachineretry']+=0x1;_0x55985d[_0xf803('0x101')]+=0x1;_0x55985d[_0xf803('0xeb')]=!![];ami['emit'](_0xf803('0xe9'),ut['buildObj'](_0x55985d,_0xf803('0xeb')));_0x28db4c['createHistory'](_0x55985d)[_0xf803('0xb1')](loggerCatch(_0xf803('0xf0')));if(_0x55985d[_0xf803('0xf1')]+_0x55985d[_0xf803('0xf2')]+_0x55985d[_0xf803('0xf3')]+_0x55985d['countnosuchnumberretry']+_0x55985d['countdropretry']+_0x55985d[_0xf803('0xf5')]+_0x55985d[_0xf803('0xf6')]+_0x55985d['countagentrejectretry']>=_0x4ac635['dialGlobalMaxRetry']){_0x28db4c[_0xf803('0x102')](_0x55985d,_0x347d5b,_0xdafc48,'reason19\x20machine....');}else{if(_0x55985d['countmachineretry']>=_0x4ac635['dialMachineMaxRetry']){_0x28db4c[_0xf803('0x103')](_0x55985d,_0x347d5b,_0xdafc48,_0xf803('0xf9'));}else{_0x28db4c[_0xf803('0xc1')]({'active':![],'countmachineretry':_0x55985d[_0xf803('0xf6')],'scheduledat':moment()[_0xf803('0x104')](_0x4ac635[_0xf803('0x105')],_0xf803('0x106'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x55985d[_0xf803('0xfb')],'ListId':_0x55985d[_0xf803('0xd4')],'VoiceQueueId':_0x55985d[_0xf803('0xd6')]||undefined,'CampaignId':_0x55985d[_0xf803('0xd7')]||undefined})['catch'](loggerCatch('[rescheduleContact][Machine]'));_0x347d5b({'reschedule':0x1});}}});}}};Dialer['prototype']['syncHangup']=function(_0x3eddc1){var _0x2104c1=this['uniqueId'][_0x3eddc1[_0xf803('0xe0')]];var _0x44b1ed=this;var _0x11c4b9;if(_0x2104c1&&_0x2104c1[_0xf803('0x49')]===_0xf803('0x8e')){delete this['uniqueId'][_0x3eddc1[_0xf803('0xe0')]];this[_0xf803('0xb5')](this[_0xf803('0x1e')][_0x2104c1[_0xf803('0xb3')]]);this[_0xf803('0x1e')][_0x2104c1[_0xf803('0xb3')]][_0xf803('0x107')]+=0x1;_0x11c4b9=new Hangup(_0x2104c1,_0x3eddc1);this[_0xf803('0xcd')](_0x11c4b9)[_0xf803('0xb1')](loggerCatch(_0xf803('0x108')));this[_0xf803('0xcb')](_0x11c4b9)['catch'](loggerCatch(_0xf803('0x109')));}if(_0x2104c1&&_0x2104c1[_0xf803('0x49')]!=='ivr'&&isNotNull(this[_0xf803('0x1d')][_0x2104c1[_0xf803('0xb3')]][_0xf803('0x10a')])){delete this[_0xf803('0x24')][_0x3eddc1[_0xf803('0xe0')]];this[_0xf803('0xb5')](this[_0xf803('0x1d')][_0x2104c1[_0xf803('0xb3')]]);this[_0xf803('0x1d')][_0x2104c1['queue']][_0xf803('0xe7')]+=0x1;this[_0xf803('0x1d')][_0x2104c1[_0xf803('0xb3')]][_0xf803('0x5a')]+=0x1;_0x11c4b9=new Hangup(_0x2104c1,_0x3eddc1);_0x11c4b9[_0xf803('0xa6')]=0x10;_0x11c4b9[_0xf803('0xa7')]=_0xf803('0x10b');_0x11c4b9[_0xf803('0xff')]='AGI';this[_0xf803('0xcd')](_0x11c4b9)[_0xf803('0xb1')](loggerCatch('[syncHangupIvr][createHistory]'));this[_0xf803('0xcb')](_0x11c4b9)[_0xf803('0xb1')](loggerCatch(_0xf803('0x109')));}if(_0x2104c1&&_0x2104c1[_0xf803('0x49')]!==_0xf803('0x8e')&&!isNotNull(this['voiceQueues'][_0x2104c1[_0xf803('0xb3')]][_0xf803('0x10a')])){delete this[_0xf803('0x24')][_0x3eddc1[_0xf803('0xe0')]];this[_0xf803('0xb5')](this[_0xf803('0x1d')][_0x2104c1['queue']]);this[_0xf803('0x1d')][_0x2104c1[_0xf803('0xb3')]][_0xf803('0x62')]+=0x1;_0x11c4b9=new Hangup(_0x2104c1,_0x3eddc1);_0x11c4b9[_0xf803('0xa6')]=0xc;_0x11c4b9['statedesc']=_0x3eddc1[_0xf803('0x10c')];_0x11c4b9[_0xf803('0xff')]=_0xf803('0x10d');this[_0xf803('0xcd')](_0x11c4b9)[_0xf803('0xb1')](loggerCatch(_0xf803('0x108')));this[_0xf803('0xcb')](_0x11c4b9)[_0xf803('0xb1')](loggerCatch(_0xf803('0x109')));}};Dialer[_0xf803('0x18')][_0xf803('0x31')]=function(_0x596868){var _0x1a1111=this[_0xf803('0x24')][_0x596868[_0xf803('0xe0')]];var _0x84e2f2=this;if(this[_0xf803('0x1d')][_0x596868['queue']]){if(_0x1a1111&&_0x1a1111['type']!==_0xf803('0x8e')){delete this[_0xf803('0x24')][_0x596868[_0xf803('0xe0')]];this[_0xf803('0x1d')][_0x596868['queue']][_0xf803('0xe7')]+=0x1;var _0x176adb=new AgentComplete(_0x1a1111,_0x596868);if(_0x596868['reason']==='agent'){_0x176adb['agiafterat']=this[_0xf803('0x1d')][_0x596868[_0xf803('0xb3')]][_0xf803('0x10e')]&&this[_0xf803('0x1d')][_0x596868[_0xf803('0xb3')]][_0xf803('0x10f')]?moment()[_0xf803('0x76')](_0xf803('0xfa')):undefined;}this[_0xf803('0xcd')](_0x176adb)[_0xf803('0xb1')](loggerCatch(_0xf803('0x110')));this[_0xf803('0xcb')](_0x176adb)['catch'](loggerCatch(_0xf803('0x111')));}}};Dialer[_0xf803('0x18')][_0xf803('0x2a')]=function(_0x1ccbcc){if(this[_0xf803('0x1d')][_0x1ccbcc[_0xf803('0xb3')]]){if(this['uniqueId'][_0x1ccbcc[_0xf803('0xe0')]]&&this[_0xf803('0x24')][_0x1ccbcc[_0xf803('0xe0')]]['type']!==_0xf803('0x8e')){this[_0xf803('0xb5')](this[_0xf803('0x1d')][_0x1ccbcc[_0xf803('0xb3')]]);this['uniqueId'][_0x1ccbcc[_0xf803('0xe0')]][_0xf803('0x112')]=moment()['format'](_0xf803('0xfa'));}}};Dialer[_0xf803('0x18')][_0xf803('0x113')]=function(_0x34f597){this[_0xf803('0xcd')](_0x34f597)[_0xf803('0xb1')](loggerCatch(_0xf803('0x110')));this['moveContactManagedDialer'](_0x34f597)[_0xf803('0xb1')](loggerCatch('[syncQueueCallerAbandon]\x20[Drop]'));};Dialer[_0xf803('0x18')][_0xf803('0x2d')]=function(_0x4e02e7){var _0xc6413=this[_0xf803('0x24')][_0x4e02e7['uniqueid']];var _0x12504b=this;if(this[_0xf803('0x1d')][_0x4e02e7[_0xf803('0xb3')]]){if(_0xc6413&&_0xc6413['type']!==_0xf803('0x8e')){delete this[_0xf803('0x24')][_0x4e02e7['uniqueid']];this[_0xf803('0xb5')](this['voiceQueues'][_0x4e02e7[_0xf803('0xb3')]]);_0xc6413[_0xf803('0x114')]=moment()[_0xf803('0x76')]('YYYY-MM-DD\x20HH:mm:ss');var _0x1c2f3e=new QueueCallerAbandon(_0xc6413,_0x4e02e7);if(getSeconds(_0xc6413[_0xf803('0x114')],_0xc6413[_0xf803('0x115')])>=_0xc6413[_0xf803('0x116')]){this[_0xf803('0x1d')][_0x4e02e7[_0xf803('0xb3')]][_0xf803('0x67')]+=0x1;this['voiceQueues'][_0x4e02e7[_0xf803('0xb3')]][_0xf803('0x117')]+=0x1;this[_0xf803('0x1d')][_0x4e02e7[_0xf803('0xb3')]][_0xf803('0x69')]+=0x1;_0x1c2f3e['state']=0xa;_0x1c2f3e['statedesc']='Drop';_0x1c2f3e[_0xf803('0x118')]=_0xf803('0x119');_0x1c2f3e[_0xf803('0x11a')]=this[_0xf803('0x1d')][_0x4e02e7[_0xf803('0xb3')]][_0xf803('0x10e')]?moment()['format'](_0xf803('0xfa')):undefined;_0x1c2f3e[_0xf803('0xf4')]+=0x1;_0x1c2f3e['countglobal']+=0x1;if(_0x1c2f3e[_0xf803('0xf4')]>=this[_0xf803('0x1d')][_0x4e02e7[_0xf803('0xb3')]][_0xf803('0x11b')]){this[_0xf803('0x113')](_0x1c2f3e);}else{this['rescheduleContact']({'active':![],'countdropretry':_0x1c2f3e[_0xf803('0xf4')],'scheduledat':moment()[_0xf803('0x104')](this[_0xf803('0x1d')][_0x4e02e7[_0xf803('0xb3')]][_0xf803('0x11c')],_0xf803('0x106'))[_0xf803('0x76')](_0xf803('0xfa')),'ContactId':_0xc6413[_0xf803('0xfb')],'ListId':_0xc6413[_0xf803('0xd4')],'VoiceQueueId':_0xc6413[_0xf803('0xd6')]||undefined,'CampaignId':_0xc6413[_0xf803('0xd7')]||undefined})[_0xf803('0xb1')](loggerCatch('[rescheduleContact][Drop]'));var _0x39141a=new History(_0x1c2f3e);_0x39141a[_0xf803('0xa6')]=0xa;_0x39141a[_0xf803('0xa7')]=_0xf803('0x11d');_0x39141a[_0xf803('0xa9')]=moment()[_0xf803('0x76')]('YYYY-MM-DD\x20HH:mm:ss');_0x39141a[_0xf803('0xa8')]=_0x39141a[_0xf803('0xa9')];_0x39141a['calleridname']=_0x1c2f3e[_0xf803('0x11e')];_0x39141a['calleridnum']=_0x1c2f3e[_0xf803('0x11f')];this[_0xf803('0xcd')](_0x39141a)[_0xf803('0xb1')](loggerCatch('[syncAgentComplete][createHistory][10]'));}}else{this[_0xf803('0x1d')][_0x4e02e7[_0xf803('0xb3')]][_0xf803('0x66')]+=0x1;this['voiceQueues'][_0x4e02e7[_0xf803('0xb3')]][_0xf803('0x5e')]+=0x1;_0x1c2f3e[_0xf803('0xa6')]=0xb;_0x1c2f3e[_0xf803('0xa7')]=_0xf803('0x120');_0x1c2f3e['dropreason']='CALLEREXIT';_0x1c2f3e['countabandonedretry']+=0x1;_0x1c2f3e[_0xf803('0x101')]+=0x1;if(_0x1c2f3e[_0xf803('0xf5')]>=this[_0xf803('0x1d')][_0x4e02e7['queue']]['dialAbandonedMaxRetry']){this[_0xf803('0x113')](_0x1c2f3e);}else{this[_0xf803('0xc1')]({'active':![],'countabandonedretry':_0x1c2f3e[_0xf803('0xf5')],'scheduledat':moment()[_0xf803('0x104')](this['voiceQueues'][_0x4e02e7[_0xf803('0xb3')]][_0xf803('0x121')],'minutes')[_0xf803('0x76')](_0xf803('0xfa')),'ContactId':_0xc6413[_0xf803('0xfb')],'ListId':_0xc6413[_0xf803('0xd4')],'VoiceQueueId':_0xc6413[_0xf803('0xd6')]||undefined,'CampaignId':_0xc6413['CampaignId']||undefined})['catch'](loggerCatch(_0xf803('0x122')));var _0x39141a=new History(_0x1c2f3e);_0x39141a[_0xf803('0xa6')]=0xb;_0x39141a[_0xf803('0xa7')]=_0xf803('0x120');_0x39141a[_0xf803('0xa9')]=moment()[_0xf803('0x76')]('YYYY-MM-DD\x20HH:mm:ss');_0x39141a[_0xf803('0xa8')]=_0x39141a[_0xf803('0xa9')];_0x39141a[_0xf803('0x11e')]=_0x1c2f3e[_0xf803('0x11e')];_0x39141a[_0xf803('0x11f')]=_0x1c2f3e[_0xf803('0x11f')];this[_0xf803('0xcd')](_0x39141a)[_0xf803('0xb1')](loggerCatch('[syncAgentComplete][createHistory][11]'));}}}}};Dialer['prototype'][_0xf803('0x34')]=function(_0x422e0e){if(this['actions'][_0x422e0e[_0xf803('0xe0')]]){this[_0xf803('0xac')][_0x422e0e[_0xf803('0xe0')]]['channel']=_0x422e0e['channel'];}if(this[_0xf803('0x24')][_0x422e0e[_0xf803('0xe0')]]){this[_0xf803('0x24')][_0x422e0e['uniqueid']][_0xf803('0xb0')]=_0x422e0e[_0xf803('0xb0')];}};Dialer[_0xf803('0x18')][_0xf803('0x123')]=function(_0x54e5db){if(strategy[this[_0xf803('0x1d')][this[_0xf803('0xac')][_0x54e5db[_0xf803('0x124')]]['queue']][_0xf803('0x4b')]]==='roundrobin'){if(this[_0xf803('0xac')][_0x54e5db[_0xf803('0x124')]]&&_['isNil'](this[_0xf803('0xac')][_0x54e5db[_0xf803('0x124')]][_0xf803('0x125')])&&_0x54e5db[_0xf803('0xaf')]==='1'&&_0x54e5db[_0xf803('0x126')]==='0'){if(this[_0xf803('0x1f')][_0x54e5db[_0xf803('0x127')]]){if(!this[_0xf803('0x1f')][_0x54e5db[_0xf803('0x127')]][_0xf803('0x125')]){this[_0xf803('0x1f')][_0x54e5db[_0xf803('0x127')]][_0xf803('0x125')]=!![];this[_0xf803('0xac')][_0x54e5db[_0xf803('0x124')]][_0xf803('0x125')]=!![];this[_0xf803('0xac')][_0x54e5db['actionid']][_0xf803('0x127')]=_0x54e5db[_0xf803('0x127')];}}}}else if((strategy[this[_0xf803('0x1d')][this[_0xf803('0xac')][_0x54e5db[_0xf803('0x124')]][_0xf803('0xb3')]][_0xf803('0x4b')]]||_0xf803('0x16'))===_0xf803('0x16')){if(this[_0xf803('0xac')][_0x54e5db[_0xf803('0x124')]]){if(this[_0xf803('0x1f')][_0x54e5db['stateinterface']]){this[_0xf803('0xac')][_0x54e5db['actionid']][_0xf803('0x127')]=_0x54e5db[_0xf803('0x127')];if(_['isNil'](this['queueBooked'][this['actions'][_0x54e5db[_0xf803('0x124')]][_0xf803('0xb3')]])){this[_0xf803('0x28')][this[_0xf803('0xac')][_0x54e5db[_0xf803('0x124')]][_0xf803('0xb3')]]=[];}this[_0xf803('0x28')][this['actions'][_0x54e5db[_0xf803('0x124')]][_0xf803('0xb3')]][_0xf803('0x128')](_[_0xf803('0x8a')](_[_0xf803('0xd3')](this[_0xf803('0xac')][_0x54e5db[_0xf803('0x124')]],[_0xf803('0x129'),_0xf803('0x127')]),{'status':_0x54e5db[_0xf803('0xaf')],'paused':_0x54e5db['paused']}));}}}};function unlockQueueStatus(_0xb5782a,_0x26ec4b){setTimeout(function(){if(_[_0xf803('0x80')](_0xb5782a['queueStatusComplete'])){loggerBooked['error'](_0xf803('0x12a'),_0x26ec4b);}_0xb5782a['queueStatusComplete']=!![];loggerBooked[_0xf803('0x7a')](_0xf803('0x12b'),_0x26ec4b,JSON[_0xf803('0x75')](_[_0xf803('0xd3')](_0xb5782a,['name',_0xf803('0x12c')])));},0x1f3);}Dialer[_0xf803('0x18')]['syncQueueStatusComplete']=function(_0x4525d9){var _0x71887e=this;var _0x11a3cf=_0x71887e[_0xf803('0x1d')][_0x71887e['actions'][_0x4525d9[_0xf803('0x124')]][_0xf803('0xb3')]];if(strategy[this[_0xf803('0x1d')][this['actions'][_0x4525d9[_0xf803('0x124')]][_0xf803('0xb3')]][_0xf803('0x4b')]]===_0xf803('0x17')){if(this['actions'][_0x4525d9[_0xf803('0x124')]]&&this['actions'][_0x4525d9[_0xf803('0x124')]]['stateinterface']){this[_0xf803('0x12d')][_0xf803('0x12e')](this[_0xf803('0xac')][_0x4525d9[_0xf803('0x124')]][_0xf803('0x129')],this[_0xf803('0xac')][_0x4525d9[_0xf803('0x124')]]['stateinterface'])[_0xf803('0xb1')](function(_0x3e5b17){logger['error'](_0xf803('0x12f'),util[_0xf803('0x93')](_0x3e5b17,{'showHidden':![],'depth':null}));})[_0xf803('0x1b')](function(){_0x71887e[_0xf803('0xb5')](_0x71887e[_0xf803('0x1d')][_0x71887e[_0xf803('0xac')][_0x4525d9[_0xf803('0x124')]][_0xf803('0xb3')]]);_0x71887e[_0xf803('0x1f')][_0x71887e['actions'][_0x4525d9[_0xf803('0x124')]][_0xf803('0x127')]][_0xf803('0x125')]=![];delete _0x71887e[_0xf803('0xac')][_0x4525d9[_0xf803('0x124')]];unlockQueueStatus(_0x11a3cf);});}else{this['updateOriginated'](this['voiceQueues'][this[_0xf803('0xac')][_0x4525d9[_0xf803('0x124')]][_0xf803('0xb3')]]);this[_0xf803('0xc1')]({'active':![],'ContactId':this['actions'][_0x4525d9[_0xf803('0x124')]][_0xf803('0xfb')],'ListId':this[_0xf803('0xac')][_0x4525d9[_0xf803('0x124')]][_0xf803('0xd4')],'VoiceQueueId':this[_0xf803('0xac')][_0x4525d9['actionid']][_0xf803('0xd6')]||undefined,'CampaignId':this['actions'][_0x4525d9['actionid']][_0xf803('0xd7')]||undefined})[_0xf803('0xb1')](loggerCatch('[unlock][syncQueueStatusComplete]'));delete this[_0xf803('0xac')][_0x4525d9['actionid']];unlockQueueStatus(_0x11a3cf);}}else if((strategy[this[_0xf803('0x1d')][this[_0xf803('0xac')][_0x4525d9[_0xf803('0x124')]][_0xf803('0xb3')]][_0xf803('0x4b')]]||'rrmemory')==='rrmemory'){var _0x4ff0d5;if(this[_0xf803('0xac')][_0x4525d9[_0xf803('0x124')]]&&!_[_0xf803('0x43')](this['queueBooked'][this[_0xf803('0xac')][_0x4525d9[_0xf803('0x124')]][_0xf803('0xb3')]])){if(this[_0xf803('0x29')][_0x71887e[_0xf803('0xac')][_0x4525d9[_0xf803('0x124')]]['queue']]){this[_0xf803('0x29')][_0x71887e[_0xf803('0xac')][_0x4525d9[_0xf803('0x124')]][_0xf803('0xb3')]]=this[_0xf803('0x29')][this[_0xf803('0xac')][_0x4525d9[_0xf803('0x124')]][_0xf803('0xb3')]]?this[_0xf803('0x29')][this[_0xf803('0xac')][_0x4525d9[_0xf803('0x124')]][_0xf803('0xb3')]]:this[_0xf803('0x28')][this[_0xf803('0xac')][_0x4525d9[_0xf803('0x124')]][_0xf803('0xb3')]]?this['queueBooked'][this[_0xf803('0xac')][_0x4525d9['actionid']][_0xf803('0xb3')]][_0xf803('0x130')]||0x0:0x0;}this[_0xf803('0x28')][this[_0xf803('0xac')][_0x4525d9[_0xf803('0x124')]][_0xf803('0xb3')]][_0xf803('0x130')]=this['queueBookedRR'][this['actions'][_0x4525d9[_0xf803('0x124')]][_0xf803('0xb3')]];for(var _0x2f60ec=0x0;_0x2f60ec=0x0;})['catch'](myreject(_0x48d7b6)));}}else{_0x5b233c['push'](ami[_0xf803('0xae')]({'action':_0xf803('0x147'),'command':util[_0xf803('0x76')]('iftime\x20%s,%s',_0x292282,!_[_0xf803('0x80')](config[_0xf803('0x144')][_0x1e8ad0])?_0x1e8ad0:'')})['then'](function(_0x1d4fe0){return _0x1d4fe0['content'][_0xf803('0x14b')](_0xf803('0x14c'))>=0x0;})[_0xf803('0xb1')](myreject(_0x48d7b6)));}BPromise[_0xf803('0x14d')](_0x5b233c)['then'](function(_0x50812d){var _0x489d04=_[_0xf803('0x14e')](_0x50812d);if(_0x489d04){return _0x42da46(_0x489d04);}else{_0x2ff2e8['message']=_0xdd018?_0xf803('0x14f'):'INTERVAL_IS_OVERTIME';return _0x48d7b6(msgResponse(_0xf803('0x150'),_0xf803('0x141'),_0xf803('0x151')+_0xdd018+'\x20'+_0xdffd73+_0xf803('0x152')+util[_0xf803('0x93')](_0x292282,{'showHidden':![],'depth':null})+_0xf803('0x153')+_0x1e8ad0));}})[_0xf803('0xb1')](function(_0x4af308){return _0x48d7b6(msgResponse(_0xf803('0x13f'),_0xf803('0x141'),JSON[_0xf803('0x75')](_0x4af308)));});});};Dialer['prototype']['checkDialMethod']=function(_0x307d94){var _0x3fb717=this;return function(){switch(_0x307d94[_0xf803('0x56')]){case _0xf803('0x154'):freeVariablesPredictive(_0x307d94);_0x3fb717['handlePower'](_0x307d94,0x1);break;case _0xf803('0x155'):freeVariablesPredictive(_0x307d94);_0x3fb717[_0xf803('0x156')](_0x307d94,_0x307d94[_0xf803('0x157')]);break;case'predictive':_0x3fb717[_0xf803('0x158')](_0x307d94);break;case _0xf803('0x8'):freeVariablesPredictive(_0x307d94);_0x3fb717[_0xf803('0x156')](_0x307d94,0x1);break;default:freeVariablesPredictive(_0x307d94);logger['error']('Queue',_0x307d94[_0xf803('0x3d')],_0xf803('0x159'));}};};Dialer[_0xf803('0x18')][_0xf803('0x15a')]=function(_0x1f705a){var _0x2e8ca7=this;return function(){_0x2e8ca7['handleIvr'](_0x1f705a);};};Dialer[_0xf803('0x18')][_0xf803('0xa')]=function(_0x58d377){var _0x204d6e=this;if(isNotPreview(_0x58d377[_0xf803('0x56')])){if(isVoiceQueueOutbound(_0x58d377['type'])&&isActive(_0x58d377[_0xf803('0x55')])){_0x58d377[_0xf803('0x9d')]=!![];BPromise[_0xf803('0xb8')]()[_0xf803('0xbd')](checkIsLoggedIn(_0x58d377,_0x58d377[_0xf803('0x15b')]))['then'](checkIsActive(_0x58d377,_0x58d377[_0xf803('0x55')]))[_0xf803('0xbd')](checkInterval(_0x58d377))[_0xf803('0xbd')](_0x204d6e[_0xf803('0x13c')](_0x58d377))[_0xf803('0xbd')](_0x204d6e['checkIfTime'](_0x58d377[_0xf803('0x15c')],_0x58d377['dialTimezone'],_0x58d377[_0xf803('0x3d')],_0x58d377))[_0xf803('0xbd')](_0x204d6e['checkIfTimeIntervals'](_0x58d377[_0xf803('0x41')],_0x58d377[_0xf803('0x15d')],_0x58d377['name'],_0x58d377))[_0xf803('0xbd')](_0x204d6e['checkDialMethod'](_0x58d377))[_0xf803('0xb1')](loggerCatchQueueSummary(_0xf803('0x15e'),_0x58d377));}else{notSendMessagesQueue(_0x58d377);}}else{freeVariablesPredictive(_0x58d377);}};Dialer[_0xf803('0x18')]['syncCampaigns']=function(){var _0x1b9c2c=this;var _0x14264d;for(var _0x3bc296 in this[_0xf803('0x1e')]){if(typeof this[_0xf803('0x1e')][_0x3bc296]!==_0xf803('0x96')){_0x14264d=this['campaigns'][_0x3bc296];if(isCampaignIvr(_0x14264d['type'])&&isActive(_0x14264d['active'])){_0x14264d['sendMessageOneNotActive']=!![];BPromise[_0xf803('0xb8')]()['then'](checkIsActive(_0x14264d,_0x14264d['active']))[_0xf803('0xbd')](checkInterval(_0x14264d))[_0xf803('0xbd')](_0x1b9c2c[_0xf803('0x13c')](_0x14264d))[_0xf803('0xbd')](_0x1b9c2c[_0xf803('0x13e')](_0x14264d[_0xf803('0x15c')],_0x14264d[_0xf803('0x15d')],_0x14264d[_0xf803('0x3d')],_0x14264d))[_0xf803('0xbd')](_0x1b9c2c['checkIfTimeIntervals'](_0x14264d[_0xf803('0x41')],_0x14264d[_0xf803('0x15d')],_0x14264d['name'],_0x14264d))['then'](_0x1b9c2c['launchHandleIvr'](_0x14264d))[_0xf803('0xb1')](loggerCatchQueueSummary(_0xf803('0x15f'),_0x14264d));}else{notSendMessagesCampaign(_0x14264d);}}}};function getCallerIdRandom(_0x4ca526,_0x2655c2){var _0x4878d9;var _0x3673f2;var _0xcbeddd;if(_0x2655c2<=0x0){_0x2655c2=0x1;}_0x4878d9=new RegExp('\x5cw{0,'+_0x2655c2+'}$');_0x3673f2=Math['pow'](0xa,_0x2655c2-0x1);_0xcbeddd=Math[_0xf803('0x160')](0xa,_0x2655c2)-0x1;return util['format']('%s',_[_0xf803('0x161')](_0x4ca526,_0x4878d9,_[_0xf803('0x162')](_0x3673f2,_0xcbeddd)));}function extractCalleridName(_0x388123){var _0x3abd6d=_0x388123[_0xf803('0x163')](/"(.*?)"/);return _0x3abd6d?_0x3abd6d[0x1]:_0x388123;}function extractCalleridNumber(_0x4111fa){var _0x54c1b7=_0x4111fa[_0xf803('0x163')](/<(.*?)>/);return _0x54c1b7?_0x54c1b7[0x1]:_0x4111fa;}Dialer[_0xf803('0x18')][_0xf803('0x164')]=function(_0x2c15aa,_0x269c5){var _0x1102ea=this;var _0x188d74=uuid['v4']();this[_0xf803('0xac')][_0x188d74]=new Action(_0x2c15aa,_0x269c5,_0x188d74);return new BPromise(function(_0x48c4a0,_0xfb6eff){if(_[_0xf803('0x80')](_0x2c15aa)&&typeof _0x2c15aa!==_0xf803('0x165')){return _0xfb6eff(msgResponse(_0xf803('0x166'),_0xf803('0x141'),_0xf803('0x167')));}if(_[_0xf803('0x80')](_0x269c5[_0xf803('0x168')][_0xf803('0x169')])||_0x269c5[_0xf803('0x168')][_0xf803('0x169')]===null){return _0xfb6eff(msgResponse(_0xf803('0x166'),_0xf803('0x141'),'contact\x20is\x20undefine'));}var _0x4f9e0c={'XMD-CALLERID':_0x1102ea['actions'][_0x188d74][_0xf803('0x16a')](),'XMD-AGI':_0x2c15aa[_0xf803('0x10a')]?util[_0xf803('0x76')]('\x22agi://%s/square,%s\x22',ipAgi,_0x2c15aa[_0xf803('0x10a')]):_0xf803('0x16b'),'XMD-AGIAFTER':_0x2c15aa['dialQueueProject2']?util['format'](_0xf803('0x16c'),ipAgi,_0x2c15aa['dialQueueProject2']):_0xf803('0x16b'),'XMD-QUEUE':_0x2c15aa[_0xf803('0x49')]===_0xf803('0x4a')?util['format']('\x22%s,%s%s,,,%s\x22',_0x2c15aa[_0xf803('0x3d')],_0x2c15aa['dialQueueOptions']||'',_0x2c15aa['dialAgiAfterHangupAgent']?'c':'',_0x2c15aa[_0xf803('0x116')]||0x3):'NONE','XMD-CONTACTID':_0x269c5[_0xf803('0xfb')],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0x1102ea[_0xf803('0xac')][_0x188d74]['getCaller'](),'XMD-AMD':_0x2c15aa[_0xf803('0xe5')]?'ACTIVE':_0xf803('0x16b'),'XMD-DESTINATION':_0xf803('0xe4')};if(_0x2c15aa[_0xf803('0xe5')]){_0x4f9e0c[_0xf803('0x16d')]=_0x2c15aa[_0xf803('0x16e')]||0x9c4;_0x4f9e0c[_0xf803('0x16f')]=_0x2c15aa[_0xf803('0x170')]||0x5dc;_0x4f9e0c[_0xf803('0x171')]=_0x2c15aa[_0xf803('0x172')]||0x320;_0x4f9e0c[_0xf803('0x173')]=_0x2c15aa[_0xf803('0x174')]||0x1388;_0x4f9e0c[_0xf803('0x175')]=_0x2c15aa[_0xf803('0x176')]||0x64;_0x4f9e0c[_0xf803('0x177')]=_0x2c15aa['dialAMDBetweenWordsSilence']||0x32;_0x4f9e0c[_0xf803('0x178')]=_0x2c15aa[_0xf803('0x179')]||0x3;_0x4f9e0c[_0xf803('0x17a')]=_0x2c15aa['dialAMDSilenceThreshold']||0x100;_0x4f9e0c[_0xf803('0x17b')]=_0x2c15aa[_0xf803('0x17c')]||0x1388;}if(_0x2c15aa[_0xf803('0x49')]===_0xf803('0x4a')){_0x4f9e0c[_0xf803('0x17d')]=_0x269c5['VoiceQueueId'];}else{_0x4f9e0c[_0xf803('0x17e')]=_0x269c5[_0xf803('0xd7')];}for(var _0x3aeb32 in _0x269c5['Contact']){if(typeof _0x269c5[_0xf803('0x168')][_0x3aeb32]!==_0xf803('0x96')){if(isNotNull(_0x269c5[_0xf803('0x168')][_0x3aeb32])&&_0x3aeb32!=='id'&&_0x3aeb32!==_0xf803('0x17f')&&_0x3aeb32!==_0xf803('0x180')&&_0x3aeb32!=='updatedAt'){_0x4f9e0c[util[_0xf803('0x76')](_0xf803('0x181'),_0xf803('0x182'),_['toUpper'](_0x3aeb32))]=_0x269c5[_0xf803('0x168')][_0x3aeb32];}}}var _0x5dbe99=_0x1102ea[_0xf803('0x183')](_0x2c15aa[_0xf803('0x72')])?getCallerId(_0x2c15aa['Trunk'][_0xf803('0x74')],_0x2c15aa[_0xf803('0x57')],_0x2c15aa['dialRandomLastDigitCallerIdNumber']>0x0?getCallerIdRandom(_0x2c15aa['dialOriginateCallerIdNumber'],_0x2c15aa[_0xf803('0x184')]):_0x2c15aa[_0xf803('0x58')]):getCallerId(_[_0xf803('0xe1')](_0x2c15aa[_0xf803('0x185')])?_0x2c15aa[_0xf803('0x72')][_0xf803('0x74')]:_0x2c15aa['TrunkBackup'][_0xf803('0x74')],_0x2c15aa['dialOriginateCallerIdName'],_0x2c15aa['dialRandomLastDigitCallerIdNumber']>0x0?getCallerIdRandom(_0x2c15aa[_0xf803('0x58')],_0x2c15aa['dialRandomLastDigitCallerIdNumber']):_0x2c15aa['dialOriginateCallerIdNumber']);if(_0x5dbe99){_0x4f9e0c[_0xf803('0x186')]=_0x1102ea[_0xf803('0xac')][_0x188d74]['originatecalleridname']=extractCalleridName(_0x5dbe99);_0x4f9e0c[_0xf803('0x187')]=_0x1102ea[_0xf803('0xac')][_0x188d74]['originatecalleridnum']=extractCalleridNumber(_0x5dbe99);}return ami['Action']({'actionid':_0x188d74,'action':_0xf803('0x166'),'channel':_0x1102ea[_0xf803('0x183')](_0x2c15aa[_0xf803('0x72')])?util[_0xf803('0x76')](_0xf803('0x188'),_0x2c15aa[_0xf803('0x72')][_0xf803('0x3d')],isNotNull(_0x2c15aa[_0xf803('0x189')])?_0x2c15aa[_0xf803('0x189')][_0xf803('0x18a')]()||'':'',_0x2c15aa[_0xf803('0x18b')]>0x0?_0x269c5['Contact'][_0xf803('0x169')][_0xf803('0x18c')](_0x2c15aa[_0xf803('0x18b')]):_0x269c5[_0xf803('0x168')][_0xf803('0x169')]):util[_0xf803('0x76')](_0xf803('0x188'),_[_0xf803('0xe1')](_0x2c15aa[_0xf803('0x185')])?_0x2c15aa[_0xf803('0x72')][_0xf803('0x3d')]:_0x2c15aa[_0xf803('0x185')][_0xf803('0x3d')],isNotNull(_0x2c15aa[_0xf803('0x189')])?_0x2c15aa[_0xf803('0x189')]['trim']()||'':'',_0x2c15aa['dialCutDigit']>0x0?_0x269c5[_0xf803('0x168')][_0xf803('0x169')][_0xf803('0x18c')](_0x2c15aa['dialCutDigit']):_0x269c5[_0xf803('0x168')][_0xf803('0x169')]),'callerid':_0x5dbe99,'Exten':_0xf803('0xe4'),'Context':'from-sip','Priority':'1','variable':_0x4f9e0c,'timeout':(_0x2c15aa[_0xf803('0x59')]||0x1e)*0x3e8,'async':!![],'channelid':_0x188d74})['then'](function(_0x11c38b){return _0x48c4a0(_0x11c38b);})[_0xf803('0xb1')](function(_0x528216){_0x2c15aa[_0xf803('0x60')]+=0x1;var _0x21aa7a=new History(_0x1102ea[_0xf803('0xac')][_0x188d74]);logger[_0xf803('0x92')](util[_0xf803('0x76')](_0xf803('0x18d'),JSON[_0xf803('0x75')](_0x528216)));_0x21aa7a[_0xf803('0xa6')]=0xe;_0x21aa7a['statedesc']=_0xf803('0x18e');_0x21aa7a[_0xf803('0xa9')]=moment()['format'](_0xf803('0xfa'));_0x21aa7a['endtime']=_0x21aa7a[_0xf803('0xa9')];_0x1102ea['createHistory'](_0x21aa7a)[_0xf803('0xb1')](loggerCatch(_0xf803('0x18f')));_0x1102ea[_0xf803('0xcb')](_0x21aa7a)[_0xf803('0xb1')](loggerCatch(_0xf803('0x18f')))['finally'](function(){delete _0x1102ea[_0xf803('0xac')][_0x188d74];return _0xfb6eff(msgResponse(_0xf803('0x166'),_0xf803('0x44'),_0xf803('0x190')));});});});};Dialer[_0xf803('0x18')]['syncOriginateResponse']=function(_0x5cfd02){var _0x1c9945=this[_0xf803('0xac')][_0x5cfd02[_0xf803('0x124')]];if(_0x1c9945){delete this[_0xf803('0xac')][_0x5cfd02[_0xf803('0x124')]];_0x1c9945[_0xf803('0x115')]=moment()[_0xf803('0x76')]('YYYY-MM-DD\x20HH:mm:ss');var _0x5938c3=_0x1c9945[_0xf803('0x49')]===_0xf803('0x8e')?this[_0xf803('0x1e')][_0x1c9945[_0xf803('0xb3')]]:this['voiceQueues'][_0x1c9945['getQueue']()];if(!this[_0xf803('0xda')](_0x5cfd02['response'])){this[_0xf803('0xb5')](_0x5938c3);return this[_0xf803('0x191')](_0x1c9945,_0x5938c3,_0x5cfd02)['catch'](loggerCatch(_0xf803('0x192')));}this[_0xf803('0x24')][_0x5cfd02[_0xf803('0xe0')]]=_0x1c9945;}};Dialer['prototype'][_0xf803('0x193')]=function(_0x389800,_0x4a9c70,_0x58c149){var _0x5be877=new History(_0x4a9c70);if(_0x5be877[_0xf803('0xf1')]+_0x5be877['countcongestionretry']+_0x5be877[_0xf803('0xf3')]+_0x5be877['countnosuchnumberretry']+_0x5be877['countdropretry']+_0x5be877[_0xf803('0xf5')]+_0x5be877['countmachineretry']+_0x5be877['countagentrejectretry']>=_0x58c149[_0xf803('0xf8')]-0x1){return!![];}switch(_0x389800){case 0x3:if(_0x5be877[_0xf803('0xf3')]>=_0x58c149['dialNoAnswerMaxRetry']-0x1){return!![];}this['rescheduleContact']({'active':![],'countnoanswerretry':_0x5be877['countnoanswerretry']+=0x1,'scheduledat':moment()[_0xf803('0x104')](_0x58c149[_0xf803('0x194')],'minutes')[_0xf803('0x76')](_0xf803('0xfa')),'ContactId':_0x5be877[_0xf803('0xfb')],'ListId':_0x5be877[_0xf803('0xd4')],'VoiceQueueId':_0x5be877[_0xf803('0xd6')]||undefined,'CampaignId':_0x5be877[_0xf803('0xd7')]||undefined})[_0xf803('0xb1')](loggerCatch(_0xf803('0x195')));break;case 0x5:if(_0x5be877[_0xf803('0xf1')]>=_0x58c149[_0xf803('0x196')]-0x1){return!![];}this[_0xf803('0xc1')]({'active':![],'countbusyretry':_0x5be877[_0xf803('0xf1')]+=0x1,'scheduledat':moment()['add'](_0x58c149[_0xf803('0x197')],_0xf803('0x106'))[_0xf803('0x76')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x5be877[_0xf803('0xfb')],'ListId':_0x5be877[_0xf803('0xd4')],'VoiceQueueId':_0x5be877[_0xf803('0xd6')]||undefined,'CampaignId':_0x5be877[_0xf803('0xd7')]||undefined})[_0xf803('0xb1')](loggerCatch(_0xf803('0x198')));break;case 0x8:if(_0x5be877[_0xf803('0xf2')]>=_0x58c149['dialCongestionMaxRetry']-0x1){return!![];}this[_0xf803('0xc1')]({'active':![],'countcongestionretry':_0x5be877[_0xf803('0xf2')]+=0x1,'scheduledat':moment()[_0xf803('0x104')](_0x58c149[_0xf803('0x199')],_0xf803('0x106'))[_0xf803('0x76')](_0xf803('0xfa')),'ContactId':_0x5be877['ContactId'],'ListId':_0x5be877[_0xf803('0xd4')],'VoiceQueueId':_0x5be877[_0xf803('0xd6')]||undefined,'CampaignId':_0x5be877[_0xf803('0xd7')]||undefined})['catch'](loggerCatch(_0xf803('0x19a')));break;case 0x0:if(_0x5be877['countnosuchnumberretry']>=_0x58c149[_0xf803('0x19b')]-0x1){return!![];}else{this[_0xf803('0xc1')]({'active':![],'countnosuchnumberretry':_0x5be877[_0xf803('0x19c')]+=0x1,'scheduledat':moment()['add'](_0x58c149[_0xf803('0x19d')],_0xf803('0x106'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x5be877['ContactId'],'ListId':_0x5be877['ListId'],'VoiceQueueId':_0x5be877['VoiceQueueId']||undefined,'CampaignId':_0x5be877[_0xf803('0xd7')]||undefined})[_0xf803('0xb1')](loggerCatch(_0xf803('0x19e')));}break;case 0xa:if(_0x5be877['countdropretry']>=_0x58c149[_0xf803('0x11b')]-0x1){return!![];}this[_0xf803('0xc1')]({'active':![],'countdropretry':_0x5be877[_0xf803('0xf4')]+=0x1,'scheduledat':moment()[_0xf803('0x104')](_0x58c149[_0xf803('0x11c')],_0xf803('0x106'))[_0xf803('0x76')](_0xf803('0xfa')),'ContactId':_0x5be877['ContactId'],'ListId':_0x5be877[_0xf803('0xd4')],'VoiceQueueId':_0x5be877[_0xf803('0xd6')]||undefined,'CampaignId':_0x5be877[_0xf803('0xd7')]||undefined})[_0xf803('0xb1')](loggerCatch('[rescheduleContact][Drop]'));break;case 0xb:if(_0x5be877['countabandonedretry']>=_0x58c149[_0xf803('0x19f')]-0x1){return!![];}this[_0xf803('0xc1')]({'active':![],'countabandonedretry':_0x5be877[_0xf803('0xf5')]+=0x1,'scheduledat':moment()['add'](_0x58c149[_0xf803('0x121')],_0xf803('0x106'))[_0xf803('0x76')](_0xf803('0xfa')),'ContactId':_0x5be877[_0xf803('0xfb')],'ListId':_0x5be877['ListId'],'VoiceQueueId':_0x5be877[_0xf803('0xd6')]||undefined,'CampaignId':_0x5be877[_0xf803('0xd7')]||undefined})[_0xf803('0xb1')](loggerCatch('[rescheduleContact][Abandoned]'));break;case 0x13:if(_0x5be877[_0xf803('0xf6')]>=_0x58c149[_0xf803('0x1a0')]-0x1){return!![];}this[_0xf803('0xc1')]({'active':![],'countmachineretry':_0x5be877[_0xf803('0xf6')]+=0x1,'scheduledat':moment()[_0xf803('0x104')](_0x58c149[_0xf803('0x105')],_0xf803('0x106'))[_0xf803('0x76')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x5be877[_0xf803('0xfb')],'ListId':_0x5be877[_0xf803('0xd4')],'VoiceQueueId':_0x5be877[_0xf803('0xd6')]||undefined,'CampaignId':_0x5be877[_0xf803('0xd7')]||undefined})[_0xf803('0xb1')](loggerCatch(_0xf803('0xfc')));break;case 0x14:if(_0x5be877[_0xf803('0xf7')]>=_0x58c149[_0xf803('0x1a1')]-0x1){return!![];}this[_0xf803('0xc1')]({'active':![],'countagentrejectretry':_0x5be877[_0xf803('0xf7')]+=0x1,'scheduledat':moment()['add'](_0x58c149[_0xf803('0x1a2')],_0xf803('0x106'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x5be877[_0xf803('0xfb')],'ListId':_0x5be877['ListId'],'VoiceQueueId':_0x5be877[_0xf803('0xd6')]||undefined,'CampaignId':_0x5be877[_0xf803('0xd7')]||undefined})[_0xf803('0xb1')](loggerCatch('[rescheduleContact][AgentReject]'));break;default:return!![];}};Dialer[_0xf803('0x18')]['callProgressDetecting']=function(_0x5bbd77,_0x25e895,_0x277888){var _0x53c658=this;var _0x5e76bc=new History(_0x5bbd77);return new BPromise(function(_0x5d0210,_0x28875d){if(_[_0xf803('0x80')](_0x25e895)&&typeof _0x25e895!==_0xf803('0x165')){return _0x28875d(msgResponse(_0xf803('0x1a3'),_0xf803('0x141'),_0xf803('0x1a4')));}if(_[_0xf803('0x80')](_0x277888)&&typeof _0x277888!==_0xf803('0x165')){return _0x28875d(msgResponse(_0xf803('0x1a3'),_0xf803('0x141'),_0xf803('0x1a5')));}switch(_0x277888[_0xf803('0x1a6')]){case'0':_0x25e895['outboundNoSuchCallsDay']+=0x1;_0x5e76bc[_0xf803('0xa6')]=0x0;_0x5e76bc[_0xf803('0xa7')]='NoSuchNumber';_0x5e76bc[_0xf803('0x19c')]+=0x1;_0x5e76bc['countglobal']+=0x1;ami[_0xf803('0x48')]('custom:agentnosuchnumber',ut[_0xf803('0xea')](_0x5bbd77,_0xf803('0x1a7')));_0x53c658['createHistory'](_0x5e76bc)[_0xf803('0xb1')](loggerCatch(_0xf803('0xf0')));if(_0x53c658[_0xf803('0x193')](0x0,_0x5bbd77,_0x25e895)){if(_0x5e76bc[_0xf803('0x19c')]>=_0x25e895[_0xf803('0x19b')]){_0x53c658[_0xf803('0x103')](_0x5e76bc,_0x5d0210,_0x28875d,_0xf803('0x1a8'));}else{_0x53c658[_0xf803('0x102')](_0x5e76bc,_0x5d0210,_0x28875d,_0xf803('0x1a8'));}}break;case'3':_0x25e895[_0xf803('0x5f')]+=0x1;_0x5e76bc[_0xf803('0xa6')]=0x3;_0x5e76bc['statedesc']=_0xf803('0x1a9');_0x5e76bc['countnoanswerretry']+=0x1;_0x5e76bc['countglobal']+=0x1;ami[_0xf803('0x48')](_0xf803('0x1aa'),ut[_0xf803('0xea')](_0x5bbd77,_0xf803('0x1ab')));_0x53c658['createHistory'](_0x5e76bc)[_0xf803('0xb1')](loggerCatch(_0xf803('0x1ac')));if(_0x53c658[_0xf803('0x193')](0x3,_0x5bbd77,_0x25e895)){if(_0x5e76bc[_0xf803('0xf3')]>=_0x25e895[_0xf803('0x1ad')]){_0x53c658['createStateFinal'](_0x5e76bc,_0x5d0210,_0x28875d,_0xf803('0x1ae'));}else{_0x53c658[_0xf803('0x102')](_0x5e76bc,_0x5d0210,_0x28875d,_0xf803('0x1ae'));}}break;case'5':_0x25e895['outboundBusyCallsDay']+=0x1;_0x5e76bc['state']=0x5;_0x5e76bc[_0xf803('0xa7')]=_0xf803('0x1af');_0x5e76bc[_0xf803('0xf1')]+=0x1;_0x5e76bc['countglobal']+=0x1;ami[_0xf803('0x48')](_0xf803('0x1b0'),ut[_0xf803('0xea')](_0x5bbd77,'busy'));_0x53c658['createHistory'](_0x5e76bc)[_0xf803('0xb1')](loggerCatch(_0xf803('0x1b1')));if(_0x53c658[_0xf803('0x193')](0x5,_0x5bbd77,_0x25e895)){if(_0x5e76bc[_0xf803('0xf1')]>=_0x25e895[_0xf803('0x196')]){_0x53c658[_0xf803('0x103')](_0x5e76bc,_0x5d0210,_0x28875d,_0xf803('0x1b2'));}else{_0x53c658[_0xf803('0x102')](_0x5e76bc,_0x5d0210,_0x28875d,_0xf803('0x1b2'));}}break;case'8':_0x25e895[_0xf803('0x5d')]+=0x1;_0x5e76bc['state']=0x8;_0x5e76bc[_0xf803('0xa7')]=_0xf803('0x1b3');_0x5e76bc[_0xf803('0xf2')]+=0x1;_0x5e76bc[_0xf803('0x101')]+=0x1;ami[_0xf803('0x48')]('custom:agentcongestion',ut[_0xf803('0xea')](_0x5bbd77,'congestion'));_0x53c658[_0xf803('0xcd')](_0x5e76bc)['catch'](loggerCatch(_0xf803('0x1b4')));if(_0x53c658[_0xf803('0x193')](0x8,_0x5bbd77,_0x25e895)){if(_0x5e76bc[_0xf803('0xf2')]>=_0x25e895[_0xf803('0x1b5')]){_0x53c658['createStateFinal'](_0x5e76bc,_0x5d0210,_0x28875d,'reason\x208\x20congestion');}else{_0x53c658[_0xf803('0x102')](_0x5e76bc,_0x5d0210,_0x28875d,_0xf803('0x1b6'));}}break;case'11':_0x25e895[_0xf803('0x1b7')]+=0x1;_0x5e76bc[_0xf803('0xa6')]=0xb;_0x5e76bc[_0xf803('0xa7')]=_0xf803('0x120');_0x5e76bc[_0xf803('0xf5')]+=0x1;_0x5e76bc['countglobal']+=0x1;_0x53c658['createHistory'](_0x5e76bc)[_0xf803('0xb1')](loggerCatch(_0xf803('0x1b8')));if(_0x53c658['checkRetriveMax'](0xb,_0x5bbd77,_0x25e895)){if(_0x5e76bc[_0xf803('0xf5')]>=_0x25e895[_0xf803('0x19f')]){_0x53c658[_0xf803('0x103')](_0x5e76bc,_0x5d0210,_0x28875d,_0xf803('0x1b9'));}else{_0x53c658[_0xf803('0x102')](_0x5e76bc,_0x5d0210,_0x28875d,_0xf803('0x1b9'));}}break;case'20':_0x25e895[_0xf803('0x1ba')]+=0x1;_0x5e76bc[_0xf803('0xa6')]=0x14;_0x5e76bc['statedesc']='AgentReject';_0x5e76bc[_0xf803('0xf7')]+=0x1;_0x5e76bc['countglobal']+=0x1;ami[_0xf803('0x48')](_0xf803('0x1bb'),ut['buildObj'](_0x5bbd77,_0xf803('0x1bc')));_0x53c658['createHistory'](_0x5e76bc)[_0xf803('0xb1')](loggerCatch(_0xf803('0x1bd')));if(_0x53c658['checkRetriveMax'](0x14,_0x5bbd77,_0x25e895)){if(_0x5e76bc['countagentrejectretry']>=_0x25e895['dialAgentRejectMaxRetry']){_0x53c658[_0xf803('0x103')](_0x5e76bc,_0x5d0210,_0x28875d,'reason\x2020\x20agentreject');}else{_0x53c658[_0xf803('0x102')](_0x5e76bc,_0x5d0210,_0x28875d,'reason\x2020\x20agentreject');}}break;default:_0x25e895[_0xf803('0x62')]+=0x1;_0x5e76bc[_0xf803('0xa6')]=0xc;_0x5e76bc['statedesc']=_0x277888[_0xf803('0x1a6')];_0x53c658[_0xf803('0xcd')](_0x5e76bc)[_0xf803('0xb1')](loggerCatch(_0xf803('0x1be')));if(_0x53c658['checkRetriveMax'](_0x277888[_0xf803('0x1a6')],_0x5bbd77,_0x25e895)){if(_0x5e76bc[_0xf803('0xf1')]+_0x5e76bc[_0xf803('0xf2')]+_0x5e76bc[_0xf803('0xf3')]+_0x5e76bc[_0xf803('0x19c')]+_0x5e76bc[_0xf803('0xf4')]+_0x5e76bc[_0xf803('0xf5')]+_0x5e76bc[_0xf803('0xf6')]+_0x5e76bc[_0xf803('0xf7')]>=_0x25e895[_0xf803('0xf8')]){_0x53c658[_0xf803('0x102')](_0x5e76bc,_0x5d0210,_0x28875d,_0x277888[_0xf803('0x1a6')]);}else{_0x53c658['createStateFinal'](_0x5e76bc,_0x5d0210,_0x28875d,_0x277888[_0xf803('0x1a6')]);}}}});};Dialer[_0xf803('0x18')][_0xf803('0x102')]=function(_0x69b172,_0x392677,_0x3f873d,_0x19187b){var _0x5c51ad=new Final(_0x69b172);_0x5c51ad[_0xf803('0xa6')]=0xf;_0x5c51ad['statedesc']=_0xf803('0x1bf');this[_0xf803('0x103')](_0x5c51ad,_0x392677,_0x3f873d,_0x19187b);};Dialer['prototype']['createStateFinal']=function(_0x66ffdf,_0x2ae791,_0x1512e0,_0x48f4f7){this[_0xf803('0xcb')](_0x66ffdf)[_0xf803('0xbd')](function(){return _0x2ae791(msgResponse(_0xf803('0x1a3'),_0xf803('0x1c0'),_0x48f4f7));})[_0xf803('0xb1')](function(){return _0x1512e0(msgResponse('[moveContactManagedDialer][0]',_0xf803('0x141'),_0xf803('0x1c1')));});};Dialer[_0xf803('0x18')]['predictive']=function(_0x31a3fd){var _0x53be0d=_0x31a3fd[_0xf803('0x1c2')]/0x64;var _0x147d3a=_0x31a3fd[_0xf803('0x117')]/(_0x31a3fd[_0xf803('0x117')]+_0x31a3fd[_0xf803('0xe7')]);var _0x5b7a29=Math['round'](_0x31a3fd[_0xf803('0x6d')]*(_0x31a3fd[_0xf803('0x1c3')]/0x64));var _0xaef74f=Math[_0xf803('0x1c4')](_0x31a3fd[_0xf803('0x6d')]*(_0x31a3fd[_0xf803('0x1c5')]/0x64));var _0x1b9dd1=_0x31a3fd[_0xf803('0x4d')]+_0x31a3fd[_0xf803('0x9e')];var _0x5b38c5=Math[_0xf803('0x1c6')](_0x31a3fd['erlangCalls']*_0x31a3fd['erlangAbandonmentRate']*_0x31a3fd['predictiveIntervalHitRate']*_0x31a3fd[_0xf803('0x6b')]);if(_[_0xf803('0x80')](_0x31a3fd[_0xf803('0x27')])){if(!_[_0xf803('0x80')](_0x31a3fd['startPredictive'])){_0x31a3fd[_0xf803('0x26')]=undefined;loggerPredictive['error']('[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine');}if(!_[_0xf803('0x80')](_0x31a3fd[_0xf803('0x8c')])){loggerPredictive[_0xf803('0x92')](_0xf803('0x1c7'),_0xf803('0x1c8'));clearInterval(_0x31a3fd['handlePredictive']);_0x31a3fd[_0xf803('0x8c')]=undefined;}_0x31a3fd['startProgressive']=moment()[_0xf803('0x76')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0xf803('0x7a')](_0x31a3fd[_0xf803('0x3d')],_0xf803('0x1c9'),_0x31a3fd['startProgressive']);this[_0xf803('0x156')](_0x31a3fd,0x1);}else if(ifInterval(_0x31a3fd['dialPredictiveInterval'],_0x31a3fd[_0xf803('0x27')])){this['handlePower'](_0x31a3fd,0x1);loggerPredictiveCalls[_0xf803('0x7a')]('[startMethodPredictive][StartProgressive][Loop]',_0x31a3fd['startProgressive'],_0x31a3fd['name']);_0x31a3fd[_0xf803('0x87')]=0x0;_0x31a3fd[_0xf803('0x69')]=0x0;}else if(_0x53be0d<_0x147d3a&&_0x31a3fd['dialPredictiveOptimization']==='dropRate'){freeVariablesPredictive(_0x31a3fd);loggerPredictive[_0xf803('0x7a')](_0xf803('0x1ca'),_0xf803('0x1cb'),_0x147d3a,'startProgressive',_0x31a3fd[_0xf803('0x3d')]);}else if(_0x5b38c5<_0x31a3fd[_0xf803('0x69')]&&_0x31a3fd[_0xf803('0x1cc')]===_0xf803('0x1cd')){freeVariablesPredictive(_0x31a3fd);loggerPredictive['info'](_0xf803('0x1ce'),'Max\x20Drop\x20',_0x5b38c5,_0xf803('0x1cf'),_0x31a3fd[_0xf803('0x69')],_0xf803('0x27'),_0x31a3fd[_0xf803('0x3d')]);}else if(!ifInterval(_0x31a3fd[_0xf803('0x1d0')],_0x31a3fd[_0xf803('0x27')])&&_[_0xf803('0x80')](_0x31a3fd[_0xf803('0x26')])&&!_[_0xf803('0x80')](_0x31a3fd[_0xf803('0x27')])){_0x31a3fd['startPredictive']=moment()['format'](_0xf803('0xfa'));loggerPredictive[_0xf803('0x7a')](_0x31a3fd[_0xf803('0x3d')],_0xf803('0x1d1'),_0x31a3fd[_0xf803('0x26')]);this[_0xf803('0xbe')](_0x31a3fd[_0xf803('0x1d0')])['then'](this[_0xf803('0x1d2')](_0x31a3fd))['then'](mergeDataErlangB(_0x31a3fd))[_0xf803('0xbd')](this['startMethodPredictive'](_0x31a3fd))[_0xf803('0xb1')](loggerCatchPredictive('Predictive\x20after\x20first\x20interval',_0x31a3fd));}else if(!ifInterval(_0x31a3fd['dialPredictiveInterval'],_0x31a3fd[_0xf803('0x26')])){_0x31a3fd[_0xf803('0x69')]=0x0;_0x31a3fd[_0xf803('0x26')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0xf803('0x7a')](_0x31a3fd[_0xf803('0x3d')],_0xf803('0x1d3'),_0x31a3fd[_0xf803('0x26')]);clearInterval(_0x31a3fd[_0xf803('0x8c')]);_0x31a3fd[_0xf803('0x8c')]=undefined;this['averageHandleTime'](_0x31a3fd[_0xf803('0x1d0')])[_0xf803('0xbd')](this[_0xf803('0x1d2')](_0x31a3fd))[_0xf803('0xbd')](mergeDataErlangB(_0x31a3fd))[_0xf803('0xbd')](this['startMethodPredictive'](_0x31a3fd))[_0xf803('0xb1')](loggerCatchPredictive(_0xf803('0x1d4'),_0x31a3fd));}else if(_0x31a3fd[_0xf803('0x6d')]&&_0x1b9dd1<_0x31a3fd[_0xf803('0x6d')]-_0xaef74f){freeVariablesPredictive(_0x31a3fd);loggerPredictive['info'](_0x31a3fd['name'],_0xf803('0x1d5'),_0x1b9dd1,_0xf803('0x1d6'),_0x31a3fd[_0xf803('0x6d')],'-',_0xaef74f,'=',_0x31a3fd[_0xf803('0x6d')]-_0xaef74f,')');}else if(_0x31a3fd['predictiveIntervalAvailable']&&_0x1b9dd1>_0x31a3fd['predictiveIntervalAvailable']+_0x5b7a29){freeVariablesPredictive(_0x31a3fd);loggerPredictive[_0xf803('0x7a')](_0x31a3fd[_0xf803('0x3d')],_0xf803('0x1d5'),_0x1b9dd1,_0xf803('0x1d7'),_0x31a3fd[_0xf803('0x6d')],'+',_0x5b7a29,'=',_0x31a3fd[_0xf803('0x6d')]+_0x5b7a29,')');}};Dialer[_0xf803('0x18')][_0xf803('0x1d2')]=function(_0x62ed15){var _0x5e9a52=this;return function(_0x5afef0){return new BPromise(function(_0x53f780,_0x409cbd){_[_0xf803('0x8a')](_0x62ed15,_0x5afef0[0x0]);if(checkGetDataPredictive(_0x5afef0[0x0])){var _0x185da1=_0x62ed15[_0xf803('0x6d')]=_0x62ed15['talking']+_0x62ed15[_0xf803('0x4d')];var _0x5ab5de=_0x62ed15['dialPredictiveInterval']*0x3c;var _0x13a377=_0x5afef0[0x0]['predictiveIntervalAvgTalktime']+_0x5afef0[0x0][_0xf803('0x64')];var _0x326506=(_0x5afef0[0x0][_0xf803('0x63')]+_0x5afef0[0x0][_0xf803('0x67')]+_0x5afef0[0x0][_0xf803('0x66')])/_0x5afef0[0x0]['predictiveIntervalTotalCalls'];_0x62ed15[_0xf803('0x6a')]=_0x326506>0x0?_0x326506:0x1;switch(_0x62ed15[_0xf803('0x1cc')]){case _0xf803('0x1cd'):var _0x167f86=_0x62ed15[_0xf803('0x1c2')]/0x64;return _0x5e9a52[_0xf803('0x1d8')](_0x185da1,_0x5ab5de,_0x13a377,_0x326506,_0x167f86)['then'](function(_0x3d3bde){return _0x53f780(_0x3d3bde);});case _0xf803('0x1d9'):var _0x1f354a=_0x62ed15['dialPredictiveOptimizationPercentage']/0x64;return _0x5e9a52[_0xf803('0x1da')](_0x185da1,_0x5ab5de,_0x13a377,_0x326506,_0x1f354a)[_0xf803('0xbd')](function(_0x326ee2){return _0x53f780(_0x326ee2);});default:return _0x409cbd(msgResponse(_0xf803('0x1db'),_0xf803('0x141'),_0xf803('0x1dc')));}}else{return _0x409cbd(msgResponse(_0xf803('0x1db'),_0xf803('0x141'),_0xf803('0x1dd')));}});};};Dialer[_0xf803('0x18')][_0xf803('0x1de')]=function(_0x330a35){var _0x5e77f0=this;return function(_0x4173d3){return new BPromise(function(_0x3e4462,_0x471cf2){_[_0xf803('0x8a')](_0x330a35,_0x4173d3[0x0]);if(checkGetDataPredictive(_0x4173d3[0x0])){loggerPredictive[_0xf803('0x7a')](JSON[_0xf803('0x75')](_0x4173d3[0x0]));if(_0x330a35[_0xf803('0x1cc')]===_0xf803('0x1cd')){return _0x5e77f0[_0xf803('0xc9')](_0x330a35['id'])[_0xf803('0xbd')](function(_0x4fc0fb){var _0x4d504f=_0x330a35['loggedIn']-_0x4fc0fb[0x0][_0xf803('0x1df')];var _0x25b832=_0x330a35[_0xf803('0x1d0')]*0x3c;var _0x40b544=_0x4173d3[0x0][_0xf803('0x65')]+_0x4173d3[0x0][_0xf803('0x64')];var _0x51481f=(_0x4173d3[0x0]['predictiveIntervalAnsweredCalls']+_0x4173d3[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x4173d3[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x4173d3[0x0][_0xf803('0x6e')];var _0x2a612c=_0x330a35[_0xf803('0x1c2')]/0x64;_0x330a35[_0xf803('0x6c')]=_0x4fc0fb[0x0][_0xf803('0x1df')]||0x0;_0x330a35[_0xf803('0x6a')]=_0x51481f>0x0?_0x51481f:0x1;return _0x5e77f0[_0xf803('0x1d8')](_0x4d504f,_0x25b832,_0x40b544,_0x51481f,_0x2a612c);})[_0xf803('0xbd')](function(_0x416571){return _0x3e4462(_0x416571);})['catch'](function(_0x476b3b){return _0x471cf2(msgResponse('[CatchErlangB]',_0xf803('0x141'),JSON[_0xf803('0x75')](_0x476b3b)));});}if(_0x330a35['dialPredictiveOptimization']===_0xf803('0x1d9')){return _0x5e77f0['getVoiceQueueRtPauses'](_0x330a35['id'])[_0xf803('0xbd')](function(_0x685f28){var _0x80a7f=_0x330a35['loggedIn']-_0x685f28[0x0][_0xf803('0x1df')];var _0x186a50=_0x330a35[_0xf803('0x1d0')]*0x3c;var _0x134743=_0x4173d3[0x0][_0xf803('0x65')]+_0x4173d3[0x0]['predictiveIntervalAvgHoldtime'];var _0x13276d=(_0x4173d3[0x0][_0xf803('0x63')]+_0x4173d3[0x0][_0xf803('0x67')]+_0x4173d3[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x4173d3[0x0][_0xf803('0x6e')];var _0x3edf00=_0x330a35[_0xf803('0x1c2')]/0x64;_0x330a35[_0xf803('0x6c')]=_0x685f28[0x0][_0xf803('0x1df')]||0x0;_0x330a35[_0xf803('0x6a')]=_0x13276d>0x0?_0x13276d:0x1;return _0x5e77f0[_0xf803('0x1da')](_0x80a7f,_0x186a50,_0x134743,_0x13276d,_0x3edf00);})[_0xf803('0xbd')](function(_0x388859){return _0x3e4462(_0x388859);})[_0xf803('0xb1')](function(_0x58da9f){return _0x471cf2(msgResponse('[CatchErlangB]',_0xf803('0x141'),JSON[_0xf803('0x75')](_0x58da9f)));});}}else{return _0x471cf2(msgResponse(_0xf803('0x1db'),'Failure',_0xf803('0x1dd')));}});};};Dialer[_0xf803('0x18')]['startMethodPredictive']=function(_0x4b241b){var _0x128e2d=this;return function(){var _0x10eeac=0x0;var _0x45d961=Math[_0xf803('0x1c6')](_0x4b241b[_0xf803('0x70')]*0x3e8);if(_0x45d961>0x0){_0x45d961=_0x45d961<0x64?0x64:_0x45d961;loggerPredictive[_0xf803('0x7a')](_0x4b241b['name'],_0xf803('0x1e0'),_0x45d961,_0xf803('0x45'));_0x4b241b[_0xf803('0x8c')]=setInterval(function(){_0x128e2d[_0xf803('0x8c')](_0x4b241b);loggerPredictiveCalls[_0xf803('0x7a')](_0xf803('0x1e1'),_0x10eeac+=0x1);},_0x45d961);}else{loggerPredictive[_0xf803('0x7a')](_0x4b241b[_0xf803('0x3d')],_0xf803('0x1e2'));}};};Dialer[_0xf803('0x18')][_0xf803('0x1e3')]=function(_0xd0c34,_0x2d183a){var _0x14fb18=this;return function(_0x550457){if(_[_0xf803('0x43')](_0x550457)){if(_[_0xf803('0xe1')](_0x2d183a[_0xf803('0xd5')])||!_0x2d183a[_0xf803('0x1e4')]){if(_0xd0c34['dialMethod']===_0xf803('0x8')){_0xd0c34[_0xf803('0x12c')]=_[_0xf803('0x80')](_0xd0c34[_0xf803('0x12c')])?!![]:_0xd0c34[_0xf803('0x12c')];var _0x8ff1e=uuid['v4']();_0x14fb18['actions'][_0x8ff1e]=new Action(_0xd0c34,_0x2d183a,_0x8ff1e);loggerBooked[_0xf803('0x7a')](_0xf803('0x1e5'),_0x8ff1e,_0xf803('0x1e6'),JSON[_0xf803('0x75')](_0xd0c34['queueStatusComplete']),_0xf803('0x1e7'),_0xd0c34[_0xf803('0x3d')]);if(_0xd0c34['queueStatusComplete']){_0xd0c34['queueStatusComplete']=![];_0x14fb18['queueBooked'][_0x14fb18['actions'][_0x8ff1e][_0xf803('0xb3')]]=[];ami['Action']({'actionid':_0x8ff1e,'action':_0xf803('0x1e8'),'queue':_0xd0c34['name']})[_0xf803('0xb1')](function(){_0x14fb18[_0xf803('0xb5')](_0xd0c34);_0x14fb18[_0xf803('0xc1')]({'active':![],'ContactId':_0x14fb18[_0xf803('0xac')][_0x8ff1e][_0xf803('0xfb')],'ListId':_0x14fb18[_0xf803('0xac')][_0x8ff1e][_0xf803('0xd4')],'VoiceQueueId':_0x14fb18['actions'][_0x8ff1e][_0xf803('0xd6')]||undefined,'CampaignId':_0x14fb18[_0xf803('0xac')][_0x8ff1e][_0xf803('0xd7')]||undefined})['catch'](loggerCatch(_0xf803('0x1e9')));delete _0x14fb18[_0xf803('0xac')][_0x8ff1e];});}else{loggerBooked[_0xf803('0x7a')](_0xf803('0x1ea'),JSON['stringify'](_0xd0c34['queueStatusComplete']),'Queue:\x20',_0xd0c34[_0xf803('0x3d')]);_0x14fb18[_0xf803('0xb5')](_0xd0c34);_0x14fb18[_0xf803('0xc1')]({'active':![],'ContactId':_0x14fb18[_0xf803('0xac')][_0x8ff1e]['ContactId'],'ListId':_0x14fb18[_0xf803('0xac')][_0x8ff1e]['ListId'],'VoiceQueueId':_0x14fb18[_0xf803('0xac')][_0x8ff1e][_0xf803('0xd6')]||undefined,'CampaignId':_0x14fb18['actions'][_0x8ff1e][_0xf803('0xd7')]||undefined})[_0xf803('0xb1')](loggerCatch(_0xf803('0x1e9')));delete _0x14fb18[_0xf803('0xac')][_0x8ff1e];}}else{return _0x14fb18[_0xf803('0x164')](_0xd0c34,_0x2d183a);}}else{if(getDiff(_0x2d183a['scheduledat'])<_0xd0c34['dialRecallMeTimeout']*0x3c){if(_0x2d183a[_0xf803('0x1eb')]&&!_0x2d183a[_0xf803('0x1eb')]['voicePause']){_0x14fb18['preview']['run'](_0x2d183a['id'])['finally'](function(){_0x14fb18['updateOriginated'](_0xd0c34);});}else{_0x14fb18[_0xf803('0xc3')]({'active':![]},_0x2d183a['id'],0x1)[_0xf803('0x1b')](function(){_0x14fb18[_0xf803('0xb5')](_0xd0c34);});}}else{_0xd0c34['outboundReCallsDay']+=0x1;_0x14fb18[_0xf803('0xb5')](_0xd0c34);if(_0xd0c34['dialRecallInQueue']){_0x14fb18['rescheduleContact']({'active':![],'recallme':![],'UserId':null,'ContactId':_0x2d183a['ContactId'],'ListId':_0x2d183a[_0xf803('0xd4')],'VoiceQueueId':_0x2d183a[_0xf803('0xd6')]||undefined,'CampaignId':_0x2d183a['CampaignId']||undefined})[_0xf803('0xb1')](loggerCatch(_0xf803('0x1ec')));_0x14fb18['createHistory'](createObjHistory(_0xd0c34,_0x2d183a,_0xf803('0x1ed'),0x17,_0xf803('0x1ee')))[_0xf803('0xb1')](loggerCatch(_0xf803('0x1ef')));}else{_0x14fb18[_0xf803('0xde')](createObjHistory(_0xd0c34,_0x2d183a,'RECALLFAILEDTIMEOUT',0x16,'RecallFailedTimeout'),'[Originate][HistoryRecallClose][historyCatch]',_0xf803('0x1f0'));}}}}else{_0xd0c34[_0xf803('0x5b')]+=0x1;_0x14fb18[_0xf803('0xde')](createObjHistory(_0xd0c34,_0x2d183a,_0xf803('0x1f1'),0xd,_0xf803('0x1f2')),_0xf803('0x1f3'),_0xf803('0x1f4'));throw'inBlackList';}};};Dialer[_0xf803('0x18')][_0xf803('0x1f5')]=function(_0x27b4a1){var _0x55ed0d=this;var _0x3c201b=_0x27b4a1[_0xf803('0x1f6')]-_0x27b4a1[_0xf803('0x6f')]-_0x27b4a1[_0xf803('0xc6')];emitCampaignSummary(_0x27b4a1);if(_0x3c201b>0x0){if(_0x3c201b>this[_0xf803('0x21')]){_0x3c201b=this[_0xf803('0x21')];}_0x27b4a1[_0xf803('0xc6')]+=_0x3c201b;this[_0xf803('0x1f7')](_0x27b4a1['id'],_0x3c201b,_0x27b4a1[_0xf803('0x1f8')],_0x27b4a1)[_0xf803('0xbd')](function(_0x14fae7){_0x27b4a1[_0xf803('0xc6')]-=_0x3c201b;_0x27b4a1['temp']=_0x27b4a1['temp']>0x0?_0x27b4a1[_0xf803('0xc6')]:0x0;if(!checkContactEmpty(_0x14fae7)){_0x27b4a1['message']=_0xf803('0x1f9');logger[_0xf803('0x7a')](_0xf803('0x1fa')+_0x27b4a1['name']);}else{_0x27b4a1[_0xf803('0x6f')]+=_0x14fae7['length'];_0x27b4a1[_0xf803('0x3b')]=_0xf803('0x1fb');for(var _0x400f12=0x0;_0x400f12<_0x14fae7[_0xf803('0x95')];_0x400f12+=0x1){_0x27b4a1['ivrTotalCallsDays']+=0x1;if(_['isNil'](_0x14fae7[_0x400f12])||_[_0xf803('0xe1')](_0x14fae7[_0x400f12][_0xf803('0x168')])||_[_0xf803('0xe1')](_0x14fae7[_0x400f12][_0xf803('0x168')][_0xf803('0x169')])){_0x55ed0d[_0xf803('0xd1')](_0xf803('0x1fc'),_0x27b4a1,_0x14fae7[_0x400f12]);}else{_0x55ed0d[_0xf803('0xbc')](_[_0xf803('0xd3')](_0x14fae7[_0x400f12],[_0xf803('0xd7'),_0xf803('0x1fd')]))[_0xf803('0xbd')](_0x55ed0d[_0xf803('0x1e3')](_0x27b4a1,_0x14fae7[_0x400f12]))[_0xf803('0xb1')](_0x55ed0d[_0xf803('0xd0')](_0xf803('0x1fe'),_0x27b4a1));}}}})['catch'](loggerGetContactDialer(_0xf803('0x1ff'),_0x27b4a1,_0x3c201b));}};Dialer[_0xf803('0x18')][_0xf803('0x156')]=function(_0x3d36d3,_0x353af9){var _0x33bf16=this;var _0x3c4ebe=[];var _0x252be6=_0x353af9>=0x1?_0x353af9:0x1;if(_0x3d36d3[_0xf803('0x56')]===_0xf803('0x8')){_0x252be6=0x1;}var _0x1c87ff=Math[_0xf803('0x1c6')](_0x3d36d3[_0xf803('0x4d')]*_0x252be6)-_0x3d36d3['originated']-_0x3d36d3[_0xf803('0xc6')];emitVoiceQueueSummary(_0x3d36d3);if(_0x3d36d3[_0xf803('0x200')]>0x0){var _0x1c58bb=_0x3d36d3['dialLimitQueue']-_0x3d36d3[_0xf803('0x6f')]-_0x3d36d3['talking']-_0x3d36d3[_0xf803('0xc6')]-_0x3d36d3[_0xf803('0x9f')];if(_0x1c87ff>_0x1c58bb){_0x1c87ff=_0x1c58bb;}}if(_0x1c87ff>0x0){if(_0x3d36d3[_0xf803('0x56')]==='booked'){_0x1c87ff=0x1;}if(_0x1c87ff>this[_0xf803('0x21')]){_0x1c87ff=this['maxNumberOriginate'];}_0x3d36d3[_0xf803('0xc6')]+=_0x1c87ff;for(var _0x373274 in this[_0xf803('0x1f')]){if(typeof this[_0xf803('0x1f')][_0x373274]!==_0xf803('0x96')){if(this['agents'][_0x373274]['state']===_0xf803('0x201')&&this[_0xf803('0x1f')][_0x373274][_0xf803('0xaf')]==='reachable'){_0x3c4ebe['push'](this['agents'][_0x373274]['id']);}}}this[_0xf803('0xc5')](_0x3d36d3['id'],_0x3c4ebe,_0x1c87ff,_0x3d36d3['dialOrderByScheduledAt'],_0x3d36d3)['then'](function(_0x583760){_0x3d36d3[_0xf803('0xc6')]-=_0x1c87ff;_0x3d36d3[_0xf803('0xc6')]=_0x3d36d3[_0xf803('0xc6')]>0x0?_0x3d36d3[_0xf803('0xc6')]:0x0;if(!checkContactEmpty(_0x583760)){_0x33bf16['countReScheduled'](_0x3d36d3)[_0xf803('0xbd')](sendMessageReschedule(_0x3d36d3))[_0xf803('0xb1')](loggerCatch(_0xf803('0xb9')));}else{_0x3d36d3[_0xf803('0x6f')]+=_0x583760[_0xf803('0x95')];_0x3d36d3[_0xf803('0x3b')]=_0x3d36d3['dialMethod']===_0xf803('0x8')?_0xf803('0x202'):_0xf803('0x1fb');for(var _0x15e6e4=0x0;_0x15e6e4<_0x583760[_0xf803('0x95')];_0x15e6e4+=0x1){if(_[_0xf803('0xe1')](_0x583760[_0x15e6e4])||_[_0xf803('0xe1')](_0x583760[_0x15e6e4][_0xf803('0x168')])||_['isNil'](_0x583760[_0x15e6e4][_0xf803('0x168')][_0xf803('0x169')])){_0x33bf16['emptyContact'](_0xf803('0x1fc'),_0x3d36d3,_0x583760[_0x15e6e4]);}else{_0x33bf16[_0xf803('0xba')](_[_0xf803('0xd3')](_0x583760[_0x15e6e4],[_0xf803('0xd6'),'Contact.phone']))[_0xf803('0xbd')](_0x33bf16['checkContactBlack'](_0x3d36d3,_0x583760[_0x15e6e4]))[_0xf803('0xb1')](_0x33bf16[_0xf803('0xd0')](_0xf803('0x1fc'),_0x3d36d3));}}}})[_0xf803('0xb1')](loggerGetContactDialer(_0xf803('0x203'),_0x3d36d3,_0x1c87ff));}};Dialer[_0xf803('0x18')]['handlePredictive']=function(_0x786656){if(_0x786656[_0xf803('0x200')]>0x0){var _0x1fd267=_0x786656[_0xf803('0x200')]-_0x786656[_0xf803('0x6f')]-_0x786656[_0xf803('0x9e')];if(_0x1fd267>0x0){this[_0xf803('0x204')](_0x786656);}else{loggerPredictiveCalls[_0xf803('0x7a')](_0xf803('0x205'));}}else{this[_0xf803('0x204')](_0x786656);}};Dialer[_0xf803('0x18')]['tryOriginatePredictive']=function(_0x2ae9c5){var _0x4ce668=this;var _0x16536a=[];_0x2ae9c5[_0xf803('0x6f')]+=0x1;for(var _0x3af85b in this[_0xf803('0x1f')]){if(typeof this[_0xf803('0x1f')][_0x3af85b]!=='undefined'){if(this[_0xf803('0x1f')][_0x3af85b][_0xf803('0xa6')]==='not_inuse'&&this[_0xf803('0x1f')][_0x3af85b][_0xf803('0xaf')]===_0xf803('0xdb')){_0x16536a[_0xf803('0x128')](this[_0xf803('0x1f')][_0x3af85b]['id']);}}}this[_0xf803('0xc5')](_0x2ae9c5['id'],_0x16536a,0x1,_0x2ae9c5['dialOrderByScheduledAt'],_0x2ae9c5)[_0xf803('0xbd')](function(_0x387936){if(!checkContactEmpty(_0x387936)){checkContactLowerLimitOriginate(_0x2ae9c5,0x1,0x0);_0x4ce668[_0xf803('0xb7')](_0x2ae9c5)[_0xf803('0xbd')](sendMessageReschedule(_0x2ae9c5))[_0xf803('0xb1')](loggerCatch(_0xf803('0xb9')));}else{_0x2ae9c5['message']=_0xf803('0x1fb');if(_[_0xf803('0xe1')](_0x387936[0x0])||_[_0xf803('0xe1')](_0x387936[0x0][_0xf803('0x168')])||_[_0xf803('0xe1')](_0x387936[0x0][_0xf803('0x168')]['phone'])){_0x4ce668['emptyContact'](_0xf803('0x1fc'),_0x2ae9c5,_0x387936[0x0]);}else{_0x4ce668[_0xf803('0xba')](_[_0xf803('0xd3')](_0x387936[0x0],[_0xf803('0xd6'),'Contact.phone']))[_0xf803('0xbd')](_0x4ce668[_0xf803('0x1e3')](_0x2ae9c5,_0x387936[0x0]))[_0xf803('0xb1')](_0x4ce668['loggerHandler']('[actionOriginatePredictive]\x20',_0x2ae9c5));}}})[_0xf803('0xb1')](loggerGetContactDialer('[getContactDialerPredictive]',_0x2ae9c5,0x1));emitVoiceQueueSummary(_0x2ae9c5);};Dialer[_0xf803('0x18')][_0xf803('0x1d8')]=function(_0x3ee485,_0x58708b,_0x400ed2,_0xb6b6d1,_0x2e21a5,_0x5219a7){loggerPredictive['info'](_0xf803('0x206'));loggerPredictive[_0xf803('0x7a')](_0xf803('0x207'),_0x3ee485);loggerPredictive[_0xf803('0x7a')](_0xf803('0x208'),_0x58708b);loggerPredictive[_0xf803('0x7a')](_0xf803('0x209'),_0x400ed2);loggerPredictive['info']('P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0xb6b6d1);loggerPredictive[_0xf803('0x7a')](_0xf803('0x20a'),_0x2e21a5);loggerPredictive['info'](_0xf803('0x7f'));return new BPromise(function(_0x5e71a2,_0x376263){if(_0x3ee485<=0x0||isNaN(_0x3ee485)){return _0x376263(msgResponse(_0xf803('0x20b'),'Error',_0xf803('0x20c')+_0x3ee485));}if(_0x400ed2<=0x0||isNaN(_0x400ed2)){return _0x376263(msgResponse('[abandonmentRate]',_0xf803('0x44'),_0xf803('0x20d')+_0x400ed2));}if(_0xb6b6d1<=0x0||isNaN(_0xb6b6d1)){return _0x376263(msgResponse(_0xf803('0x20b'),_0xf803('0x44'),_0xf803('0x20e')+_0xb6b6d1));}if(_0x58708b<=0x0||isNaN(_0x58708b)){return _0x376263(msgResponse(_0xf803('0x20b'),_0xf803('0x44'),_0xf803('0x20f')+_0x58708b));}if(_0x2e21a5<=0x0||isNaN(_0x2e21a5)){return _0x376263(msgResponse(_0xf803('0x20b'),_0xf803('0x44'),_0xf803('0x210')+_0x2e21a5));}_0x5219a7=_0x5219a7||0x0;var _0x170bba=0x1/_0x400ed2;var _0x34a7d5=0x0;var _0xab9e13=0x0;var _0x48c1cc=0x0;var _0x1b2fe2=0x0;for(var _0x2316eb=0x0;_0x48c1cc<_0x2e21a5;_0x2316eb+=0x1){_0xab9e13=_0x2316eb/_0x58708b;_0x34a7d5=(_0xb6b6d1*_0xab9e13+_0x5219a7)/_0x170bba;_0x48c1cc=erlangb(_0x34a7d5,_0x3ee485);_0x1b2fe2=_0x34a7d5/_0x3ee485*(0x1-erlangb(_0x34a7d5,_0x3ee485));}return _0x5e71a2({'erlangCalls':_0x2316eb,'erlangCallToSecond':_0x58708b/_0x2316eb,'erlangAbandonmentRate':_0x48c1cc,'erlangBusyFactor':_0x1b2fe2});});};Dialer[_0xf803('0x18')][_0xf803('0x1da')]=function(_0x3ef1cb,_0x464e99,_0x2ad4ee,_0x36790a,_0x151373,_0x2ca3dc){loggerPredictive[_0xf803('0x7a')](_0xf803('0x211'));loggerPredictive['info'](_0xf803('0x207'),_0x3ef1cb);loggerPredictive[_0xf803('0x7a')](_0xf803('0x208'),_0x464e99);loggerPredictive[_0xf803('0x7a')]('Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x2ad4ee);loggerPredictive[_0xf803('0x7a')](_0xf803('0x212'),_0x36790a);loggerPredictive[_0xf803('0x7a')](_0xf803('0x213'),_0x151373);loggerPredictive[_0xf803('0x7a')](_0xf803('0x7f'));return new BPromise(function(_0x146d00,_0x494e74){if(_0x3ef1cb<=0x0||isNaN(_0x3ef1cb)){return _0x494e74(msgResponse(_0xf803('0x214'),_0xf803('0x44'),'m\x20=\x20'+_0x3ef1cb));}if(_0x2ad4ee<=0x0||isNaN(_0x2ad4ee)){return _0x494e74(msgResponse(_0xf803('0x214'),_0xf803('0x44'),_0xf803('0x20d')+_0x2ad4ee));}if(_0x36790a<=0x0||isNaN(_0x36790a)){return _0x494e74(msgResponse(_0xf803('0x214'),_0xf803('0x44'),_0xf803('0x20e')+_0x36790a));}if(_0x464e99<=0x0||isNaN(_0x464e99)){return _0x494e74(msgResponse(_0xf803('0x214'),_0xf803('0x44'),_0xf803('0x20f')+_0x464e99));}if(_0x151373<=0x0||isNaN(_0x151373)){return _0x494e74(msgResponse(_0xf803('0x214'),_0xf803('0x44'),_0xf803('0x215')+_0x151373));}_0x2ca3dc=_0x2ca3dc||0x0;var _0x287005=0x1/_0x2ad4ee;var _0x2aa1e9=0x0;var _0x1a79e3=0x0;var _0x357e16=0x0;var _0x3719d7=0x0;for(var _0x3108f4=0x0;_0x3719d7<_0x151373;_0x3108f4+=0x1){_0x1a79e3=_0x3108f4/_0x464e99;_0x2aa1e9=(_0x36790a*_0x1a79e3+_0x2ca3dc)/_0x287005;_0x357e16=erlangb(_0x2aa1e9,_0x3ef1cb);_0x3719d7=_0x2aa1e9/_0x3ef1cb*(0x1-erlangb(_0x2aa1e9,_0x3ef1cb));}return _0x146d00({'erlangCalls':_0x3108f4,'erlangCallToSecond':_0x464e99/_0x3108f4,'erlangAbandonmentRate':_0x357e16,'erlangBusyFactor':_0x3719d7});});};module[_0xf803('0x216')]=Dialer; \ No newline at end of file diff --git a/server/services/ami/dialer/queueCallerAbandon.js b/server/services/ami/dialer/queueCallerAbandon.js index d795033..1f8cbd4 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 _0x3784=['endtime','ringtime','holdtime','membername','connectedlinename','reason','callback','callbackat','recallme','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','scheduledat','type','queue','countbusyretry','countcongestionretry','countglobal','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridname','calleridnum','number','starttime','responsetime','droptime'];(function(_0xb06221,_0x3b47da){var _0x542c06=function(_0x5cd5ff){while(--_0x5cd5ff){_0xb06221['push'](_0xb06221['shift']());}};_0x542c06(++_0x3b47da);}(_0x3784,0x16f));var _0x4378=function(_0x444080,_0x8aaa0b){_0x444080=_0x444080-0x0;var _0x4f14ce=_0x3784[_0x444080];return _0x4f14ce;};'use strict';var util=require(_0x4378('0x0'));var _=require(_0x4378('0x1'));var moment=require(_0x4378('0x2'));function getSeconds(_0x145ab7,_0x4f21f2){var _0x5c8663=moment(_0x145ab7)[_0x4378('0x3')](0x0);var _0x2e4a13=moment(_0x4f21f2)[_0x4378('0x3')](0x0);return _0x5c8663[_0x4378('0x4')](_0x2e4a13,'seconds');}function QueueCallerAbandon(_0x5a3b4b,_0x5b2a53){this[_0x4378('0x5')]=_0x5a3b4b['scheduledat'];this[_0x4378('0x6')]=_0x5a3b4b[_0x4378('0x6')];this['campaigntype']=_0x5a3b4b[_0x4378('0x6')]==='outbound'?_0x4378('0x7'):_0x5a3b4b[_0x4378('0x6')];this['countbusyretry']=_0x5a3b4b[_0x4378('0x8')];this[_0x4378('0x9')]=_0x5a3b4b['countcongestionretry'];this['countnoanswerretry']=_0x5a3b4b['countnoanswerretry'];this[_0x4378('0xa')]=_0x5a3b4b[_0x4378('0x8')]+_0x5a3b4b[_0x4378('0x9')]+_0x5a3b4b[_0x4378('0xb')]+_0x5a3b4b[_0x4378('0xc')]+_0x5a3b4b[_0x4378('0xd')]+_0x5a3b4b[_0x4378('0xe')]+_0x5a3b4b[_0x4378('0xf')]+_0x5a3b4b[_0x4378('0x10')];this[_0x4378('0xc')]=_0x5a3b4b['countnosuchnumberretry'];this[_0x4378('0xd')]=_0x5a3b4b[_0x4378('0xd')];this[_0x4378('0xe')]=_0x5a3b4b[_0x4378('0xe')];this[_0x4378('0xf')]=_0x5a3b4b[_0x4378('0xf')];this[_0x4378('0x10')]=_0x5a3b4b['countagentrejectretry'];this['uniqueid']=_0x5b2a53['uniqueid'];this[_0x4378('0x11')]=_0x5a3b4b['name'];this[_0x4378('0x12')]=_0x5a3b4b[_0x4378('0x13')];this[_0x4378('0x14')]=_0x5a3b4b['starttime'];this[_0x4378('0x15')]=_0x5a3b4b[_0x4378('0x15')];this[_0x4378('0x16')]=_0x5a3b4b['droptime'];this[_0x4378('0x17')]=this[_0x4378('0x16')];this[_0x4378('0x18')]=getSeconds(_0x5a3b4b[_0x4378('0x15')],_0x5a3b4b['starttime']);this[_0x4378('0x19')]=getSeconds(this[_0x4378('0x16')],_0x5a3b4b[_0x4378('0x15')]);this['talktime']=0x0;this['queue']=_0x5b2a53[_0x4378('0x7')];this[_0x4378('0x1a')]=_0x5b2a53[_0x4378('0x1b')];this['reason']=_0x5b2a53[_0x4378('0x1c')];this['callback']=_0x5a3b4b[_0x4378('0x1d')];this['callbackuniqueid']=_0x5a3b4b['callbackuniqueid'];this[_0x4378('0x1e')]=_0x5a3b4b[_0x4378('0x1e')];this[_0x4378('0x1f')]=_0x5a3b4b[_0x4378('0x1f')];this['ContactId']=_0x5a3b4b['ContactId'];this[_0x4378('0x20')]=_0x5a3b4b[_0x4378('0x20')];this[_0x4378('0x21')]=_0x5a3b4b[_0x4378('0x21')];this['VoiceQueueId']=_0x5a3b4b[_0x4378('0x22')];this[_0x4378('0x23')]=_0x5a3b4b[_0x4378('0x23')];this[_0x4378('0x24')]=_0x5a3b4b[_0x4378('0x24')]||'';this[_0x4378('0x25')]=_0x5a3b4b[_0x4378('0x25')]||'';}module[_0x4378('0x26')]=QueueCallerAbandon; \ No newline at end of file +var _0xbd1f=['scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countabandonedretry','countagentrejectretry','countnosuchnumberretry','countdropretry','countmachineretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','droptime','ringtime','holdtime','membername','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','exports','util','lodash','moment','milliseconds','diff','seconds'];(function(_0x1b5a3c,_0x16313c){var _0xc45d36=function(_0x2f5c8b){while(--_0x2f5c8b){_0x1b5a3c['push'](_0x1b5a3c['shift']());}};_0xc45d36(++_0x16313c);}(_0xbd1f,0x102));var _0xfbd1=function(_0x5c3023,_0x59be84){_0x5c3023=_0x5c3023-0x0;var _0x3e3f58=_0xbd1f[_0x5c3023];return _0x3e3f58;};'use strict';var util=require(_0xfbd1('0x0'));var _=require(_0xfbd1('0x1'));var moment=require(_0xfbd1('0x2'));function getSeconds(_0x20b355,_0x501045){var _0x56724f=moment(_0x20b355)['milliseconds'](0x0);var _0x4bbbf9=moment(_0x501045)[_0xfbd1('0x3')](0x0);return _0x56724f[_0xfbd1('0x4')](_0x4bbbf9,_0xfbd1('0x5'));}function QueueCallerAbandon(_0x178b3c,_0x4507ac){this[_0xfbd1('0x6')]=_0x178b3c[_0xfbd1('0x6')];this[_0xfbd1('0x7')]=_0x178b3c[_0xfbd1('0x7')];this[_0xfbd1('0x8')]=_0x178b3c['type']===_0xfbd1('0x9')?_0xfbd1('0xa'):_0x178b3c[_0xfbd1('0x7')];this['countbusyretry']=_0x178b3c[_0xfbd1('0xb')];this['countcongestionretry']=_0x178b3c[_0xfbd1('0xc')];this[_0xfbd1('0xd')]=_0x178b3c[_0xfbd1('0xd')];this[_0xfbd1('0xe')]=_0x178b3c[_0xfbd1('0xb')]+_0x178b3c['countcongestionretry']+_0x178b3c[_0xfbd1('0xd')]+_0x178b3c['countnosuchnumberretry']+_0x178b3c['countdropretry']+_0x178b3c[_0xfbd1('0xf')]+_0x178b3c['countmachineretry']+_0x178b3c[_0xfbd1('0x10')];this[_0xfbd1('0x11')]=_0x178b3c[_0xfbd1('0x11')];this[_0xfbd1('0x12')]=_0x178b3c[_0xfbd1('0x12')];this['countabandonedretry']=_0x178b3c[_0xfbd1('0xf')];this['countmachineretry']=_0x178b3c[_0xfbd1('0x13')];this['countagentrejectretry']=_0x178b3c['countagentrejectretry'];this[_0xfbd1('0x14')]=_0x4507ac['uniqueid'];this[_0xfbd1('0x15')]=_0x178b3c[_0xfbd1('0x16')];this[_0xfbd1('0x17')]=_0x178b3c[_0xfbd1('0x18')];this[_0xfbd1('0x19')]=_0x178b3c[_0xfbd1('0x19')];this[_0xfbd1('0x1a')]=_0x178b3c[_0xfbd1('0x1a')];this['droptime']=_0x178b3c['droptime'];this['endtime']=this[_0xfbd1('0x1b')];this[_0xfbd1('0x1c')]=getSeconds(_0x178b3c[_0xfbd1('0x1a')],_0x178b3c[_0xfbd1('0x19')]);this[_0xfbd1('0x1d')]=getSeconds(this[_0xfbd1('0x1b')],_0x178b3c[_0xfbd1('0x1a')]);this['talktime']=0x0;this[_0xfbd1('0xa')]=_0x4507ac[_0xfbd1('0xa')];this[_0xfbd1('0x1e')]=_0x4507ac[_0xfbd1('0x1f')];this[_0xfbd1('0x20')]=_0x4507ac[_0xfbd1('0x20')];this[_0xfbd1('0x21')]=_0x178b3c[_0xfbd1('0x21')];this[_0xfbd1('0x22')]=_0x178b3c[_0xfbd1('0x22')];this[_0xfbd1('0x23')]=_0x178b3c[_0xfbd1('0x23')];this[_0xfbd1('0x24')]=_0x178b3c[_0xfbd1('0x24')];this[_0xfbd1('0x25')]=_0x178b3c['ContactId'];this[_0xfbd1('0x26')]=_0x178b3c[_0xfbd1('0x26')];this['UserId']=_0x178b3c[_0xfbd1('0x27')];this[_0xfbd1('0x28')]=_0x178b3c[_0xfbd1('0x28')];this[_0xfbd1('0x29')]=_0x178b3c['CampaignId'];this['originatecalleridnum']=_0x178b3c[_0xfbd1('0x2a')]||'';this['originatecalleridname']=_0x178b3c['originatecalleridname']||'';}module[_0xfbd1('0x2b')]=QueueCallerAbandon; \ No newline at end of file diff --git a/server/services/ami/fax/action.js b/server/services/ami/fax/action.js index 529a682..71cb473 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(_0x1b4888,_0x1debd6){var _0x532bf2=function(_0x570a17){while(--_0x570a17){_0x1b4888['push'](_0x1b4888['shift']());}};_0x532bf2(++_0x1debd6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5037ab,_0x43209e){_0x5037ab=_0x5037ab-0x0;var _0x512adb=_0xa9e0[_0x5037ab];return _0x512adb;};'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(_0x373e2c,_0x19d258){var _0x578eae=function(_0x2c5593){while(--_0x2c5593){_0x373e2c['push'](_0x373e2c['shift']());}};_0x578eae(++_0x19d258);}(_0xa9e0,0x123));var _0x0a9e=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0xa9e0[_0x24237f];return _0x48298e;};'use strict';var util=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));function Action(_0x5dd881,_0x550fbc,_0x18d5c9){this['uniqueid']=_0x5dd881||undefined;this[_0x0a9e('0x3')]=util[_0x0a9e('0x4')](_0x0a9e('0x5'),_0x550fbc[_0x0a9e('0x6')],_0x550fbc[_0x0a9e('0x7')]['name'],_0x18d5c9[_0x0a9e('0x8')]);this[_0x0a9e('0x9')]=_0x550fbc[_0x0a9e('0x9')];this['headerinfo']=_0x550fbc['headerinfo'];this[_0x0a9e('0xa')]=_0x18d5c9['path'];this['AttachmentId']=_0x18d5c9[_0x0a9e('0xb')];}module[_0x0a9e('0xc')]=Action; \ No newline at end of file diff --git a/server/services/ami/fax/index.js b/server/services/ami/fax/index.js index 66c1efb..1ae6edc 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 _0x6d12=['faxpages','SUCCESS','updateStatus','faxstatusstring','SENDING\x20FAILED:\x20','SENDING\x20FAILED','send','execOriginate','FaxAccountId','[Fax][execOriginate][success]','[Fax][execOriginate][failure]','checkAfterSend','checkTrunk','Trunk','isValid','message','Trunk\x20Reachable','format','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','execute','%s/%s.tif','XMF-PATH','Convert\x20pdf\x20to\x20tif','variablesAction','ext','isNil','active','SIP/%s','reachable','isTrunkReachable','[Fax][checkTrunk][Trunk\x20not\x20work]','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','util','uuid','moment','path','tiff2pdf','./util/gs','fax','./channel','./action','../rpc/faxAccount','../rpc/attachment','channels','faxAccounts','trunks','newchannel','bind','varset','syncVarSet','syncNewState','newexten','faxstatus','syncFaxStatus','receivefax','hangup','syncHangup','originateresponse','syncNewchannel','context','from-voip-provider','exten','localstationid','uniqueid','channel','name','info','\x20syncNewchannel\x20','prototype','variable','hasOwnProperty','channelstate','channelstatedesc','syncNewExten','value','operation','status','filename','\x20syncFaxStatus\x20','syncReceiveFax','remotestationid','pagestransferred','resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','create','parse','.pdf','application/pdf','then','notify','error','\x20notify\x20','catch','\x20receiveFax\x20','actions','merge','pick','response','AttachmentId','update','SENDING\x20FAILED\x20','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','logger','finally','[Fax][Message][NoUpdate2]','\x20hangup\x20sendFile\x20','stringify'];(function(_0x1dc254,_0x2ab043){var _0x549dc6=function(_0x550ddb){while(--_0x550ddb){_0x1dc254['push'](_0x1dc254['shift']());}};_0x549dc6(++_0x2ab043);}(_0x6d12,0x17d));var _0x26d1=function(_0x2540db,_0x9b7318){_0x2540db=_0x2540db-0x0;var _0xbf6e9f=_0x6d12[_0x2540db];return _0xbf6e9f;};'use strict';var util=require(_0x26d1('0x0'));var _=require('lodash');var BPromise=require('bluebird');var uuid=require(_0x26d1('0x1'));var moment=require(_0x26d1('0x2'));var path=require(_0x26d1('0x3'));var tiff2pdf=require(_0x26d1('0x4'));var gs=require(_0x26d1('0x5'));var logger=require('../../../config/logger')(_0x26d1('0x6'));var ami=require('../ami');var rpcDb=require('./rpcDb');var Channel=require(_0x26d1('0x7'));var ut=require('./util/util');var Action=require(_0x26d1('0x8'));var faxAccount=require(_0x26d1('0x9'));var attachment=require(_0x26d1('0xa'));var faxMessage=require('../rpc/faxMessage');function Fax(_0x1ef8a6){this[_0x26d1('0xb')]={};this[_0x26d1('0xc')]=_0x1ef8a6['faxAccounts'];this[_0x26d1('0xd')]=_0x1ef8a6['trunks'];this['actions']={};ami['on'](_0x26d1('0xe'),this['syncNewchannel'][_0x26d1('0xf')](this));ami['on'](_0x26d1('0x10'),this[_0x26d1('0x11')]['bind'](this));ami['on']('newstate',this[_0x26d1('0x12')]['bind'](this));ami['on'](_0x26d1('0x13'),this['syncNewExten'][_0x26d1('0xf')](this));ami['on'](_0x26d1('0x14'),this[_0x26d1('0x15')][_0x26d1('0xf')](this));ami['on'](_0x26d1('0x16'),this['syncReceiveFax'][_0x26d1('0xf')](this));ami['on'](_0x26d1('0x17'),this[_0x26d1('0x18')][_0x26d1('0xf')](this));ami['on'](_0x26d1('0x19'),this['syncOriginateResponse']['bind'](this));}Fax['prototype'][_0x26d1('0x1a')]=function(_0x482040){if(_0x482040[_0x26d1('0x1b')]===_0x26d1('0x1c')){for(var _0x1da6b2 in this[_0x26d1('0xc')]){if(this[_0x26d1('0xc')]['hasOwnProperty'](_0x1da6b2)){if(_0x482040[_0x26d1('0x1d')]===this[_0x26d1('0xc')][_0x1da6b2][_0x26d1('0x1e')]){this['channels'][_0x482040['uniqueid']]={};this['channels'][_0x482040[_0x26d1('0x1f')]][_0x26d1('0x20')]=_0x482040[_0x26d1('0x20')];this[_0x26d1('0xb')][_0x482040[_0x26d1('0x1f')]]['id']=this[_0x26d1('0xc')][_0x1da6b2]['id'];this[_0x26d1('0xb')][_0x482040[_0x26d1('0x1f')]]['name']=this[_0x26d1('0xc')][_0x1da6b2][_0x26d1('0x21')];logger[_0x26d1('0x22')](_0x482040['uniqueid'],_0x26d1('0x23'));}}}}if(this['actions'][_0x482040['uniqueid']]){this['channels'][_0x482040[_0x26d1('0x1f')]]={};this[_0x26d1('0xb')][_0x482040[_0x26d1('0x1f')]][_0x26d1('0x20')]=_0x482040[_0x26d1('0x20')];logger[_0x26d1('0x22')](_0x482040[_0x26d1('0x1f')],'\x20syncNewchannel\x20');}};Fax[_0x26d1('0x24')][_0x26d1('0x11')]=function(_0x37cfde){if(this[_0x26d1('0xb')][_0x37cfde[_0x26d1('0x1f')]]){for(var _0xd86e9d in _0x37cfde[_0x26d1('0x25')]){if(_0x37cfde[_0x26d1('0x25')][_0x26d1('0x26')](_0xd86e9d)){this[_0x26d1('0xb')][_0x37cfde[_0x26d1('0x1f')]][_0xd86e9d]=_0x37cfde['value'];}}}};Fax[_0x26d1('0x24')][_0x26d1('0x12')]=function(_0x80cc9f){if(this['channels'][_0x80cc9f[_0x26d1('0x1f')]]){this[_0x26d1('0xb')][_0x80cc9f[_0x26d1('0x1f')]][_0x26d1('0x27')]=_0x80cc9f[_0x26d1('0x27')];this['channels'][_0x80cc9f[_0x26d1('0x1f')]][_0x26d1('0x28')]=_0x80cc9f[_0x26d1('0x28')];}};Fax[_0x26d1('0x24')][_0x26d1('0x29')]=function(_0x7f612){if(this[_0x26d1('0xb')][_0x7f612[_0x26d1('0x1f')]]){for(var _0x45d752 in _0x7f612[_0x26d1('0x25')]){if(_0x7f612[_0x26d1('0x25')]['hasOwnProperty'](_0x45d752)){this[_0x26d1('0xb')][_0x7f612['uniqueid']][_0x45d752]=_0x7f612[_0x26d1('0x2a')];}}}};Fax[_0x26d1('0x24')][_0x26d1('0x15')]=function(_0x540f18){if(this[_0x26d1('0xb')][_0x540f18[_0x26d1('0x1f')]]){this[_0x26d1('0xb')][_0x540f18[_0x26d1('0x1f')]][_0x26d1('0x2b')]=_0x540f18[_0x26d1('0x2b')];this[_0x26d1('0xb')][_0x540f18[_0x26d1('0x1f')]][_0x26d1('0x2c')]=_0x540f18[_0x26d1('0x2c')];this[_0x26d1('0xb')][_0x540f18['uniqueid']][_0x26d1('0x1e')]=_0x540f18['localstationid'];this['channels'][_0x540f18[_0x26d1('0x1f')]][_0x26d1('0x2d')]=_0x540f18[_0x26d1('0x2d')];logger['info'](_0x540f18[_0x26d1('0x1f')],_0x26d1('0x2e'));}};Fax['prototype'][_0x26d1('0x2f')]=function(_0x180ed1){var _0x1bd2a3=this;if(this[_0x26d1('0xb')][_0x180ed1[_0x26d1('0x1f')]]){var _0x5acb89=this[_0x26d1('0xb')][_0x180ed1[_0x26d1('0x1f')]]['id'];this[_0x26d1('0xb')][_0x180ed1[_0x26d1('0x1f')]][_0x26d1('0x30')]=_0x180ed1[_0x26d1('0x30')];this[_0x26d1('0xb')][_0x180ed1[_0x26d1('0x1f')]][_0x26d1('0x31')]=_0x180ed1['pagestransferred'];this[_0x26d1('0xb')][_0x180ed1['uniqueid']]['localstationid']=_0x180ed1['localstationid'];this[_0x26d1('0xb')][_0x180ed1[_0x26d1('0x1f')]][_0x26d1('0x32')]=_0x180ed1['resolution'];this[_0x26d1('0xb')][_0x180ed1['uniqueid']]['transferrate']=_0x180ed1[_0x26d1('0x33')];this[_0x26d1('0xb')][_0x180ed1['uniqueid']][_0x26d1('0x2d')]=_0x180ed1[_0x26d1('0x2d')];this[_0x26d1('0xb')][_0x180ed1[_0x26d1('0x1f')]][_0x26d1('0x34')]=_0x180ed1[_0x26d1('0x34')];if(this[_0x26d1('0xb')][_0x180ed1['uniqueid']][_0x26d1('0x31')]>0x0){tiff2pdf(_0x180ed1[_0x26d1('0x2d')],_0x26d1('0x35'),function(_0x59d13c){logger[_0x26d1('0x22')](_0x180ed1['uniqueid'],'\x20result\x20conversion\x20file\x20',_0x59d13c['message']);attachment[_0x26d1('0x36')]({'name':path['parse'](_0x180ed1[_0x26d1('0x2d')])[_0x26d1('0x21')],'basename':path[_0x26d1('0x37')](_0x180ed1[_0x26d1('0x2d')])[_0x26d1('0x21')]+_0x26d1('0x38'),'type':_0x26d1('0x39')})[_0x26d1('0x3a')](function(_0xb9a163){faxAccount[_0x26d1('0x3b')](_0x5acb89,{'from':_0x180ed1['calleridnum'],'mapKey':_0x26d1('0x6'),'body':path[_0x26d1('0x37')](_0x180ed1[_0x26d1('0x2d')])[_0x26d1('0x21')]+_0x26d1('0x38'),'AttachmentId':_0xb9a163['id']})['catch'](function(_0x43d245){logger[_0x26d1('0x3c')](_0x180ed1[_0x26d1('0x1f')],_0x26d1('0x3d'),JSON['stringify'](_0x43d245));});})[_0x26d1('0x3e')](function(_0x3b9ec5){logger['error'](_0x180ed1['uniqueid'],_0x26d1('0x3f'),JSON['stringify'](_0x3b9ec5));});});}logger[_0x26d1('0x22')](_0x180ed1[_0x26d1('0x1f')],_0x26d1('0x3f'));}};Fax[_0x26d1('0x24')]['syncOriginateResponse']=function(_0x5c50b9){if(this[_0x26d1('0x40')][_0x5c50b9[_0x26d1('0x1f')]]){_[_0x26d1('0x41')](this[_0x26d1('0xb')][_0x5c50b9[_0x26d1('0x1f')]],_[_0x26d1('0x42')](_0x5c50b9,[_0x26d1('0x43'),'reason']));}};function updateStatus(_0x51d8e4){if(_0x51d8e4[_0x26d1('0x44')]){faxMessage[_0x26d1('0x45')](_0x51d8e4[_0x26d1('0x44')],{'failMessage':_0x26d1('0x46')})['then'](function(_0x3ef09a){ut['logger'](_0x26d1('0x47'),_0x3ef09a);})[_0x26d1('0x3e')](function(_0x4b5fae){ut['logger'](_0x26d1('0x48'),_0x4b5fae);});}else{ut['logger'](_0x26d1('0x49'));}}Fax[_0x26d1('0x24')]['updateStatus']=function(_0x286d3d,_0x458a96,_0x4932b0){var _0x4bf9dd=this;var _0x4d3cc7={};if(_0x458a96){_0x4d3cc7={'read':_0x458a96};}else{_0x4d3cc7={'failMessage':_0x4932b0};}if(this[_0x26d1('0x40')][_0x286d3d]['AttachmentId']){faxMessage[_0x26d1('0x45')](this[_0x26d1('0x40')][_0x286d3d][_0x26d1('0x44')],_0x4d3cc7)[_0x26d1('0x3a')](function(_0x4fb78d){ut[_0x26d1('0x4a')]('[Fax][Message][Updated]',_0x4fb78d);})['catch'](function(_0x2c741d){ut[_0x26d1('0x4a')]('[Fax][Message][NoUpdate1]',_0x2c741d);})[_0x26d1('0x4b')](function(){delete _0x4bf9dd[_0x26d1('0xb')][_0x286d3d];delete _0x4bf9dd[_0x26d1('0x40')][_0x286d3d];});}else{ut[_0x26d1('0x4a')](_0x26d1('0x4c'));delete this[_0x26d1('0xb')][_0x286d3d];delete this[_0x26d1('0x40')][_0x286d3d];}};Fax[_0x26d1('0x24')][_0x26d1('0x18')]=function(_0x303b2e){var _0x5b0b3d=this;if(this['channels'][_0x303b2e[_0x26d1('0x1f')]]){if(this['actions'][_0x303b2e['uniqueid']]){this[_0x26d1('0xb')][_0x303b2e['uniqueid']]['id']=this['actions'][_0x303b2e[_0x26d1('0x1f')]]['id'];this[_0x26d1('0xb')][_0x303b2e[_0x26d1('0x1f')]][_0x26d1('0x21')]=this[_0x26d1('0x40')][_0x303b2e[_0x26d1('0x1f')]]['name'];}logger[_0x26d1('0x22')](_0x303b2e[_0x26d1('0x1f')],this[_0x26d1('0x40')][_0x303b2e[_0x26d1('0x1f')]]?_0x26d1('0x4d'):'\x20hangup\x20faxRiceive\x20',JSON[_0x26d1('0x4e')](this['channels'][_0x303b2e[_0x26d1('0x1f')]]));if(this['actions'][_0x303b2e[_0x26d1('0x1f')]]){if(this['channels'][_0x303b2e[_0x26d1('0x1f')]][_0x26d1('0x4f')]>0x0&&this[_0x26d1('0xb')][_0x303b2e[_0x26d1('0x1f')]]['faxstatus']===_0x26d1('0x50')){this[_0x26d1('0x51')](_0x303b2e[_0x26d1('0x1f')],!![]);}else{this[_0x26d1('0x51')](_0x303b2e['uniqueid'],![],this[_0x26d1('0xb')][_0x303b2e[_0x26d1('0x1f')]][_0x26d1('0x52')]?_0x26d1('0x53')+this['channels'][_0x303b2e[_0x26d1('0x1f')]][_0x26d1('0x52')]:_0x26d1('0x54'));}}}};Fax[_0x26d1('0x24')][_0x26d1('0x55')]=function(_0x1bb860){var _0x2a4ffa=this;return new BPromise(function(_0x50ccfc,_0x192943){_0x2a4ffa[_0x26d1('0x56')](_0x1bb860,_0x2a4ffa['faxAccounts'][_0x1bb860[_0x26d1('0x57')]])[_0x26d1('0x3a')](function(_0x106d1d){ut[_0x26d1('0x4a')](_0x26d1('0x58'),_0x106d1d);_0x50ccfc(ut['message']('Fax\x20received'));})[_0x26d1('0x3e')](function(_0x36a209){ut[_0x26d1('0x4a')](_0x26d1('0x59'),_0x36a209);updateStatus(_0x1bb860);_0x192943(ut['message']('Fax\x20failed'));});});};Fax['prototype'][_0x26d1('0x5a')]=function(_0x28a41b){var _0x5af17e=this;return new BPromise(function(_0x3df1f0,_0xb2c78c){var _0x29887e=_0x5af17e[_0x26d1('0x5b')](_0x5af17e[_0x26d1('0xc')][_0x28a41b[_0x26d1('0x57')]][_0x26d1('0x5c')],_0x28a41b);if(_0x29887e[_0x26d1('0x5d')]){_0x3df1f0(ut[_0x26d1('0x5e')](_0x26d1('0x5f')));}else{_0xb2c78c(ut['message'](_0x29887e['message']));}});};function originate(_0x4728c2,_0x1def9e,_0x5c89e9){return new BPromise(function(_0x402b87,_0x158564){if(_0x5c89e9){var _0x1068ca=util[_0x26d1('0x60')](_0x26d1('0x61'),path[_0x26d1('0x37')](_0x4728c2[_0x26d1('0x3')])[_0x26d1('0x21')],_0x4728c2[_0x26d1('0x3')]);gs[_0x26d1('0x62')](_0x1068ca)[_0x26d1('0x3a')](function(){_0x4728c2[_0x26d1('0x3')]=util['format'](_0x26d1('0x63'),path['parse'](_0x4728c2[_0x26d1('0x3')])['dir'],path[_0x26d1('0x37')](_0x4728c2['path'])[_0x26d1('0x21')]);_0x1def9e[_0x26d1('0x64')]=_0x4728c2[_0x26d1('0x3')];ut['logger'](_0x26d1('0x65'),'');ami['Action'](ut[_0x26d1('0x66')](_0x4728c2,_0x1def9e))[_0x26d1('0x3a')](function(_0x43c089){_0x402b87(_0x43c089);})['catch'](function(_0x2d3c6a){_0x158564(_0x2d3c6a);});})[_0x26d1('0x3e')](function(_0x1cd35b){_0x158564(_0x1cd35b);});}else{ami['Action'](ut[_0x26d1('0x66')](_0x4728c2,_0x1def9e))[_0x26d1('0x3a')](function(_0x4775fa){_0x402b87(_0x4775fa);})[_0x26d1('0x3e')](function(_0x2a6e37){_0x158564(_0x2a6e37);});}});}Fax['prototype'][_0x26d1('0x56')]=function(_0x4ac8af,_0x2067eb){var _0x15afcb=this;return new BPromise(function(_0x456399,_0x220b7e){var _0x4e1042=uuid['v4']();var _0x3da167=ut['addVariables'](_0x4ac8af,_0x2067eb);_0x15afcb[_0x26d1('0x40')][_0x4e1042]=new Action(_0x4e1042,_0x2067eb,_0x4ac8af);var _0x2a7610=_0x15afcb['actions'][_0x4e1042];if(path[_0x26d1('0x37')](_0x4ac8af[_0x26d1('0x3')])[_0x26d1('0x67')]===_0x26d1('0x38')){originate(_0x2a7610,_0x3da167,!![])[_0x26d1('0x3a')](function(_0x144e24){_0x456399(_0x144e24);})['catch'](function(_0x308b20){_0x220b7e(_0x308b20);});}else{originate(_0x2a7610,_0x3da167,![])['then'](function(_0x4d7036){_0x456399(_0x4d7036);})[_0x26d1('0x3e')](function(_0xbefa35){_0x220b7e(_0xbefa35);});}});};Fax[_0x26d1('0x24')]['isTrunkReachable']=function(_0x4e5d8c){return!_[_0x26d1('0x68')](_0x4e5d8c)&&!_['isNil'](_0x4e5d8c['name'])&&!_[_0x26d1('0x68')](_0x4e5d8c[_0x26d1('0x69')])&&_0x4e5d8c[_0x26d1('0x69')]&&!_[_0x26d1('0x68')](this[_0x26d1('0xd')][util[_0x26d1('0x60')](_0x26d1('0x6a'),_0x4e5d8c[_0x26d1('0x21')])])&&!_[_0x26d1('0x68')](this['trunks'][util[_0x26d1('0x60')]('SIP/%s',_0x4e5d8c['name'])][_0x26d1('0x2c')])&&(this['trunks'][util[_0x26d1('0x60')](_0x26d1('0x6a'),_0x4e5d8c[_0x26d1('0x21')])][_0x26d1('0x2c')]===_0x26d1('0x6b')||this['trunks'][util[_0x26d1('0x60')](_0x26d1('0x6a'),_0x4e5d8c['name'])][_0x26d1('0x2c')]==='unmonitored');};Fax[_0x26d1('0x24')][_0x26d1('0x5b')]=function(_0x1bc25e,_0x399b25){if(!this[_0x26d1('0x6c')](_0x1bc25e)){ut[_0x26d1('0x4a')](_0x26d1('0x6d'),_[_0x26d1('0x68')](_0x1bc25e)?'':_0x1bc25e[_0x26d1('0x21')]+_0x26d1('0x6e'));return{'isValid':![],'message':_0x26d1('0x6f')};}if(_['isNil'](_0x399b25[_0x26d1('0x6')])){ut['logger'](_0x26d1('0x70'),JSON[_0x26d1('0x4e')](_0x399b25));return{'isValid':![],'message':_0x26d1('0x71')};}if(_[_0x26d1('0x68')](_0x399b25[_0x26d1('0x3')])){ut[_0x26d1('0x4a')](_0x26d1('0x72'),JSON[_0x26d1('0x4e')](_0x399b25));return{'isValid':![],'message':'Empty\x20path'};}return{'isValid':!![],'message':'Is\x20Valid'};};module['exports']=Fax; \ No newline at end of file +var _0x3691=['isNil','active','SIP/%s','checkTrunk','[Fax][checkTrunk][Trunk\x20not\x20work]','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','Empty\x20path','Is\x20Valid','exports','util','uuid','path','tiff2pdf','./util/gs','../ami','./rpcDb','./channel','./util/util','./action','../rpc/faxAccount','../rpc/attachment','../rpc/faxMessage','channels','faxAccounts','trunks','syncNewchannel','syncVarSet','bind','newstate','newexten','syncNewExten','faxstatus','syncFaxStatus','receivefax','syncHangup','originateresponse','syncOriginateResponse','prototype','context','from-voip-provider','hasOwnProperty','exten','localstationid','uniqueid','channel','name','info','\x20syncNewchannel\x20','actions','variable','value','syncNewState','channelstate','channelstatedesc','operation','status','\x20syncFaxStatus\x20','syncReceiveFax','remotestationid','pagestransferred','resolution','transferrate','filename','calleridnum','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','message','create','parse','.pdf','application/pdf','then','notify','fax','catch','error','\x20notify\x20','stringify','\x20receiveFax\x20','merge','pick','response','reason','AttachmentId','update','logger','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate2]','updateStatus','[Fax][Message][NoUpdate1]','\x20hangup\x20sendFile\x20','SUCCESS','faxstatusstring','SENDING\x20FAILED:\x20','SENDING\x20FAILED','send','execOriginate','FaxAccountId','[Fax][execOriginate][success]','Fax\x20received','[Fax][execOriginate][failure]','Fax\x20failed','checkAfterSend','Trunk','Trunk\x20Reachable','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','format','%s/%s.tif','XMF-PATH','Convert\x20pdf\x20to\x20tif','variablesAction','Action','addVariables','ext','isTrunkReachable'];(function(_0x55677b,_0x3e5655){var _0x104b88=function(_0x78d34f){while(--_0x78d34f){_0x55677b['push'](_0x55677b['shift']());}};_0x104b88(++_0x3e5655);}(_0x3691,0x82));var _0x1369=function(_0x3da242,_0x23eb65){_0x3da242=_0x3da242-0x0;var _0x48380d=_0x3691[_0x3da242];return _0x48380d;};'use strict';var util=require(_0x1369('0x0'));var _=require('lodash');var BPromise=require('bluebird');var uuid=require(_0x1369('0x1'));var moment=require('moment');var path=require(_0x1369('0x2'));var tiff2pdf=require(_0x1369('0x3'));var gs=require(_0x1369('0x4'));var logger=require('../../../config/logger')('fax');var ami=require(_0x1369('0x5'));var rpcDb=require(_0x1369('0x6'));var Channel=require(_0x1369('0x7'));var ut=require(_0x1369('0x8'));var Action=require(_0x1369('0x9'));var faxAccount=require(_0x1369('0xa'));var attachment=require(_0x1369('0xb'));var faxMessage=require(_0x1369('0xc'));function Fax(_0x38b25d){this[_0x1369('0xd')]={};this[_0x1369('0xe')]=_0x38b25d[_0x1369('0xe')];this['trunks']=_0x38b25d[_0x1369('0xf')];this['actions']={};ami['on']('newchannel',this[_0x1369('0x10')]['bind'](this));ami['on']('varset',this[_0x1369('0x11')][_0x1369('0x12')](this));ami['on'](_0x1369('0x13'),this['syncNewState'][_0x1369('0x12')](this));ami['on'](_0x1369('0x14'),this[_0x1369('0x15')][_0x1369('0x12')](this));ami['on'](_0x1369('0x16'),this[_0x1369('0x17')][_0x1369('0x12')](this));ami['on'](_0x1369('0x18'),this['syncReceiveFax'][_0x1369('0x12')](this));ami['on']('hangup',this[_0x1369('0x19')][_0x1369('0x12')](this));ami['on'](_0x1369('0x1a'),this[_0x1369('0x1b')]['bind'](this));}Fax[_0x1369('0x1c')]['syncNewchannel']=function(_0x2afc66){if(_0x2afc66[_0x1369('0x1d')]===_0x1369('0x1e')){for(var _0x1962c8 in this[_0x1369('0xe')]){if(this[_0x1369('0xe')][_0x1369('0x1f')](_0x1962c8)){if(_0x2afc66[_0x1369('0x20')]===this['faxAccounts'][_0x1962c8][_0x1369('0x21')]){this[_0x1369('0xd')][_0x2afc66[_0x1369('0x22')]]={};this[_0x1369('0xd')][_0x2afc66['uniqueid']][_0x1369('0x23')]=_0x2afc66['channel'];this['channels'][_0x2afc66[_0x1369('0x22')]]['id']=this[_0x1369('0xe')][_0x1962c8]['id'];this[_0x1369('0xd')][_0x2afc66[_0x1369('0x22')]][_0x1369('0x24')]=this[_0x1369('0xe')][_0x1962c8][_0x1369('0x24')];logger[_0x1369('0x25')](_0x2afc66[_0x1369('0x22')],_0x1369('0x26'));}}}}if(this[_0x1369('0x27')][_0x2afc66[_0x1369('0x22')]]){this[_0x1369('0xd')][_0x2afc66[_0x1369('0x22')]]={};this[_0x1369('0xd')][_0x2afc66['uniqueid']][_0x1369('0x23')]=_0x2afc66[_0x1369('0x23')];logger[_0x1369('0x25')](_0x2afc66[_0x1369('0x22')],_0x1369('0x26'));}};Fax['prototype'][_0x1369('0x11')]=function(_0x362738){if(this[_0x1369('0xd')][_0x362738['uniqueid']]){for(var _0xef95d2 in _0x362738[_0x1369('0x28')]){if(_0x362738[_0x1369('0x28')]['hasOwnProperty'](_0xef95d2)){this[_0x1369('0xd')][_0x362738[_0x1369('0x22')]][_0xef95d2]=_0x362738[_0x1369('0x29')];}}}};Fax['prototype'][_0x1369('0x2a')]=function(_0x47ba11){if(this[_0x1369('0xd')][_0x47ba11[_0x1369('0x22')]]){this[_0x1369('0xd')][_0x47ba11['uniqueid']][_0x1369('0x2b')]=_0x47ba11['channelstate'];this[_0x1369('0xd')][_0x47ba11[_0x1369('0x22')]]['channelstatedesc']=_0x47ba11[_0x1369('0x2c')];}};Fax[_0x1369('0x1c')][_0x1369('0x15')]=function(_0x126859){if(this[_0x1369('0xd')][_0x126859['uniqueid']]){for(var _0x5bac23 in _0x126859['variable']){if(_0x126859[_0x1369('0x28')][_0x1369('0x1f')](_0x5bac23)){this[_0x1369('0xd')][_0x126859['uniqueid']][_0x5bac23]=_0x126859[_0x1369('0x29')];}}}};Fax['prototype'][_0x1369('0x17')]=function(_0x22df9a){if(this[_0x1369('0xd')][_0x22df9a['uniqueid']]){this[_0x1369('0xd')][_0x22df9a[_0x1369('0x22')]][_0x1369('0x2d')]=_0x22df9a[_0x1369('0x2d')];this[_0x1369('0xd')][_0x22df9a[_0x1369('0x22')]]['status']=_0x22df9a[_0x1369('0x2e')];this[_0x1369('0xd')][_0x22df9a[_0x1369('0x22')]][_0x1369('0x21')]=_0x22df9a[_0x1369('0x21')];this['channels'][_0x22df9a[_0x1369('0x22')]]['filename']=_0x22df9a['filename'];logger[_0x1369('0x25')](_0x22df9a[_0x1369('0x22')],_0x1369('0x2f'));}};Fax[_0x1369('0x1c')][_0x1369('0x30')]=function(_0x45d68f){var _0x492d02=this;if(this[_0x1369('0xd')][_0x45d68f[_0x1369('0x22')]]){var _0x2f71b3=this[_0x1369('0xd')][_0x45d68f[_0x1369('0x22')]]['id'];this[_0x1369('0xd')][_0x45d68f[_0x1369('0x22')]]['remotestationid']=_0x45d68f[_0x1369('0x31')];this[_0x1369('0xd')][_0x45d68f[_0x1369('0x22')]][_0x1369('0x32')]=_0x45d68f[_0x1369('0x32')];this[_0x1369('0xd')][_0x45d68f['uniqueid']][_0x1369('0x21')]=_0x45d68f[_0x1369('0x21')];this['channels'][_0x45d68f[_0x1369('0x22')]][_0x1369('0x33')]=_0x45d68f[_0x1369('0x33')];this[_0x1369('0xd')][_0x45d68f[_0x1369('0x22')]][_0x1369('0x34')]=_0x45d68f[_0x1369('0x34')];this[_0x1369('0xd')][_0x45d68f['uniqueid']][_0x1369('0x35')]=_0x45d68f[_0x1369('0x35')];this[_0x1369('0xd')][_0x45d68f[_0x1369('0x22')]][_0x1369('0x36')]=_0x45d68f[_0x1369('0x36')];if(this['channels'][_0x45d68f[_0x1369('0x22')]][_0x1369('0x32')]>0x0){tiff2pdf(_0x45d68f[_0x1369('0x35')],_0x1369('0x37'),function(_0x3dbc04){logger[_0x1369('0x25')](_0x45d68f[_0x1369('0x22')],_0x1369('0x38'),_0x3dbc04[_0x1369('0x39')]);attachment[_0x1369('0x3a')]({'name':path[_0x1369('0x3b')](_0x45d68f[_0x1369('0x35')])[_0x1369('0x24')],'basename':path[_0x1369('0x3b')](_0x45d68f[_0x1369('0x35')])[_0x1369('0x24')]+_0x1369('0x3c'),'type':_0x1369('0x3d')})[_0x1369('0x3e')](function(_0x296201){faxAccount[_0x1369('0x3f')](_0x2f71b3,{'from':_0x45d68f[_0x1369('0x36')],'mapKey':_0x1369('0x40'),'body':path[_0x1369('0x3b')](_0x45d68f[_0x1369('0x35')])[_0x1369('0x24')]+_0x1369('0x3c'),'AttachmentId':_0x296201['id']})[_0x1369('0x41')](function(_0x3dc7b3){logger[_0x1369('0x42')](_0x45d68f[_0x1369('0x22')],_0x1369('0x43'),JSON[_0x1369('0x44')](_0x3dc7b3));});})[_0x1369('0x41')](function(_0x40bdc2){logger[_0x1369('0x42')](_0x45d68f[_0x1369('0x22')],_0x1369('0x45'),JSON['stringify'](_0x40bdc2));});});}logger['info'](_0x45d68f['uniqueid'],_0x1369('0x45'));}};Fax[_0x1369('0x1c')]['syncOriginateResponse']=function(_0x3df15a){if(this[_0x1369('0x27')][_0x3df15a[_0x1369('0x22')]]){_[_0x1369('0x46')](this[_0x1369('0xd')][_0x3df15a[_0x1369('0x22')]],_[_0x1369('0x47')](_0x3df15a,[_0x1369('0x48'),_0x1369('0x49')]));}};function updateStatus(_0x551fec){if(_0x551fec[_0x1369('0x4a')]){faxMessage[_0x1369('0x4b')](_0x551fec[_0x1369('0x4a')],{'failMessage':'SENDING\x20FAILED\x20'})[_0x1369('0x3e')](function(_0x5b8968){ut[_0x1369('0x4c')](_0x1369('0x4d'),_0x5b8968);})[_0x1369('0x41')](function(_0x1fabac){ut[_0x1369('0x4c')]('[Fax][Message][Error][NoUpdate1]',_0x1fabac);});}else{ut[_0x1369('0x4c')](_0x1369('0x4e'));}}Fax[_0x1369('0x1c')][_0x1369('0x4f')]=function(_0x4d3b85,_0x29dcaa,_0x1acf1c){var _0x4b29a6=this;var _0x28fd8f={};if(_0x29dcaa){_0x28fd8f={'read':_0x29dcaa};}else{_0x28fd8f={'failMessage':_0x1acf1c};}if(this[_0x1369('0x27')][_0x4d3b85][_0x1369('0x4a')]){faxMessage[_0x1369('0x4b')](this[_0x1369('0x27')][_0x4d3b85][_0x1369('0x4a')],_0x28fd8f)[_0x1369('0x3e')](function(_0x51640d){ut[_0x1369('0x4c')]('[Fax][Message][Updated]',_0x51640d);})[_0x1369('0x41')](function(_0x430f80){ut[_0x1369('0x4c')](_0x1369('0x50'),_0x430f80);})['finally'](function(){delete _0x4b29a6[_0x1369('0xd')][_0x4d3b85];delete _0x4b29a6[_0x1369('0x27')][_0x4d3b85];});}else{ut[_0x1369('0x4c')]('[Fax][Message][NoUpdate2]');delete this[_0x1369('0xd')][_0x4d3b85];delete this[_0x1369('0x27')][_0x4d3b85];}};Fax['prototype']['syncHangup']=function(_0x17fd8c){var _0x193a5c=this;if(this['channels'][_0x17fd8c[_0x1369('0x22')]]){if(this[_0x1369('0x27')][_0x17fd8c[_0x1369('0x22')]]){this['channels'][_0x17fd8c[_0x1369('0x22')]]['id']=this[_0x1369('0x27')][_0x17fd8c[_0x1369('0x22')]]['id'];this[_0x1369('0xd')][_0x17fd8c[_0x1369('0x22')]]['name']=this[_0x1369('0x27')][_0x17fd8c[_0x1369('0x22')]]['name'];}logger[_0x1369('0x25')](_0x17fd8c['uniqueid'],this[_0x1369('0x27')][_0x17fd8c[_0x1369('0x22')]]?_0x1369('0x51'):'\x20hangup\x20faxRiceive\x20',JSON[_0x1369('0x44')](this[_0x1369('0xd')][_0x17fd8c[_0x1369('0x22')]]));if(this[_0x1369('0x27')][_0x17fd8c[_0x1369('0x22')]]){if(this['channels'][_0x17fd8c['uniqueid']]['faxpages']>0x0&&this['channels'][_0x17fd8c[_0x1369('0x22')]]['faxstatus']===_0x1369('0x52')){this[_0x1369('0x4f')](_0x17fd8c['uniqueid'],!![]);}else{this[_0x1369('0x4f')](_0x17fd8c[_0x1369('0x22')],![],this['channels'][_0x17fd8c[_0x1369('0x22')]][_0x1369('0x53')]?_0x1369('0x54')+this[_0x1369('0xd')][_0x17fd8c[_0x1369('0x22')]][_0x1369('0x53')]:_0x1369('0x55'));}}}};Fax[_0x1369('0x1c')][_0x1369('0x56')]=function(_0x313f2f){var _0x426918=this;return new BPromise(function(_0xa68877,_0x3a1723){_0x426918[_0x1369('0x57')](_0x313f2f,_0x426918['faxAccounts'][_0x313f2f[_0x1369('0x58')]])[_0x1369('0x3e')](function(_0x1e4772){ut['logger'](_0x1369('0x59'),_0x1e4772);_0xa68877(ut[_0x1369('0x39')](_0x1369('0x5a')));})[_0x1369('0x41')](function(_0x4d0df0){ut['logger'](_0x1369('0x5b'),_0x4d0df0);updateStatus(_0x313f2f);_0x3a1723(ut['message'](_0x1369('0x5c')));});});};Fax['prototype'][_0x1369('0x5d')]=function(_0x5a6b87){var _0x321b27=this;return new BPromise(function(_0x2a449a,_0x450bd3){var _0x2cc867=_0x321b27['checkTrunk'](_0x321b27[_0x1369('0xe')][_0x5a6b87[_0x1369('0x58')]][_0x1369('0x5e')],_0x5a6b87);if(_0x2cc867['isValid']){_0x2a449a(ut[_0x1369('0x39')](_0x1369('0x5f')));}else{_0x450bd3(ut[_0x1369('0x39')](_0x2cc867[_0x1369('0x39')]));}});};function originate(_0x3d74d1,_0x488b53,_0x39a4da){return new BPromise(function(_0x1a53e8,_0x475cb4){if(_0x39a4da){var _0x2a7eaa=util['format'](_0x1369('0x60'),path[_0x1369('0x3b')](_0x3d74d1[_0x1369('0x2')])[_0x1369('0x24')],_0x3d74d1[_0x1369('0x2')]);gs['execute'](_0x2a7eaa)[_0x1369('0x3e')](function(){_0x3d74d1['path']=util[_0x1369('0x61')](_0x1369('0x62'),path[_0x1369('0x3b')](_0x3d74d1[_0x1369('0x2')])['dir'],path[_0x1369('0x3b')](_0x3d74d1['path'])['name']);_0x488b53[_0x1369('0x63')]=_0x3d74d1[_0x1369('0x2')];ut['logger'](_0x1369('0x64'),'');ami['Action'](ut[_0x1369('0x65')](_0x3d74d1,_0x488b53))[_0x1369('0x3e')](function(_0x384819){_0x1a53e8(_0x384819);})[_0x1369('0x41')](function(_0x517fd6){_0x475cb4(_0x517fd6);});})[_0x1369('0x41')](function(_0x5b3c78){_0x475cb4(_0x5b3c78);});}else{ami[_0x1369('0x66')](ut[_0x1369('0x65')](_0x3d74d1,_0x488b53))[_0x1369('0x3e')](function(_0x35a954){_0x1a53e8(_0x35a954);})[_0x1369('0x41')](function(_0x4054ad){_0x475cb4(_0x4054ad);});}});}Fax[_0x1369('0x1c')][_0x1369('0x57')]=function(_0x595a27,_0x447a18){var _0x450d06=this;return new BPromise(function(_0x57e20b,_0x29cbb2){var _0x4e8214=uuid['v4']();var _0x40be25=ut[_0x1369('0x67')](_0x595a27,_0x447a18);_0x450d06['actions'][_0x4e8214]=new Action(_0x4e8214,_0x447a18,_0x595a27);var _0x3e8297=_0x450d06[_0x1369('0x27')][_0x4e8214];if(path[_0x1369('0x3b')](_0x595a27['path'])[_0x1369('0x68')]===_0x1369('0x3c')){originate(_0x3e8297,_0x40be25,!![])[_0x1369('0x3e')](function(_0x264b0e){_0x57e20b(_0x264b0e);})[_0x1369('0x41')](function(_0x3284cc){_0x29cbb2(_0x3284cc);});}else{originate(_0x3e8297,_0x40be25,![])[_0x1369('0x3e')](function(_0x11aa55){_0x57e20b(_0x11aa55);})['catch'](function(_0x133fc2){_0x29cbb2(_0x133fc2);});}});};Fax[_0x1369('0x1c')][_0x1369('0x69')]=function(_0x51ec96){return!_[_0x1369('0x6a')](_0x51ec96)&&!_[_0x1369('0x6a')](_0x51ec96[_0x1369('0x24')])&&!_[_0x1369('0x6a')](_0x51ec96[_0x1369('0x6b')])&&_0x51ec96[_0x1369('0x6b')]&&!_[_0x1369('0x6a')](this[_0x1369('0xf')][util[_0x1369('0x61')](_0x1369('0x6c'),_0x51ec96[_0x1369('0x24')])])&&!_[_0x1369('0x6a')](this['trunks'][util['format'](_0x1369('0x6c'),_0x51ec96[_0x1369('0x24')])][_0x1369('0x2e')])&&(this[_0x1369('0xf')][util[_0x1369('0x61')]('SIP/%s',_0x51ec96['name'])]['status']==='reachable'||this[_0x1369('0xf')][util[_0x1369('0x61')](_0x1369('0x6c'),_0x51ec96['name'])][_0x1369('0x2e')]==='unmonitored');};Fax[_0x1369('0x1c')][_0x1369('0x6d')]=function(_0x172a1f,_0x280c70){if(!this[_0x1369('0x69')](_0x172a1f)){ut['logger'](_0x1369('0x6e'),_[_0x1369('0x6a')](_0x172a1f)?'':_0x172a1f[_0x1369('0x24')]+_0x1369('0x6f'));return{'isValid':![],'message':_0x1369('0x70')};}if(_[_0x1369('0x6a')](_0x280c70[_0x1369('0x40')])){ut[_0x1369('0x4c')](_0x1369('0x71'),JSON['stringify'](_0x280c70));return{'isValid':![],'message':_0x1369('0x72')};}if(_[_0x1369('0x6a')](_0x280c70['path'])){ut[_0x1369('0x4c')]('[Fax][checkTrunk][Empty\x20path]',JSON['stringify'](_0x280c70));return{'isValid':![],'message':_0x1369('0x73')};}return{'isValid':!![],'message':_0x1369('0x74')};};module[_0x1369('0x75')]=Fax; \ No newline at end of file diff --git a/server/services/ami/fax/rpcDb.js b/server/services/ami/fax/rpcDb.js index 8f22a42..acf7f23 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 _0xe409=['[Notify]\x20','util','bluebird','preview','../rpc/faxAccount','error','inspect','notify','resolve','then'];(function(_0x3707a7,_0x52219f){var _0x315464=function(_0x258286){while(--_0x258286){_0x3707a7['push'](_0x3707a7['shift']());}};_0x315464(++_0x52219f);}(_0xe409,0x191));var _0x9e40=function(_0x26fa7d,_0x16ee27){_0x26fa7d=_0x26fa7d-0x0;var _0x4f2500=_0xe409[_0x26fa7d];return _0x4f2500;};'use strict';var util=require(_0x9e40('0x0'));var BPromise=require(_0x9e40('0x1'));var logger=require('../../../config/logger')(_0x9e40('0x2'));var _=require('lodash');var faxAccount=require(_0x9e40('0x3'));function loggerCatch(_0x192f00){return function(_0x26581d){logger[_0x9e40('0x4')](_0x192f00,util[_0x9e40('0x5')](_0x26581d,{'showHidden':![],'depth':null}));};}exports[_0x9e40('0x6')]=function(_0x3440aa,_0x2443f2){return BPromise[_0x9e40('0x7')]()[_0x9e40('0x8')](faxAccount[_0x9e40('0x6')](_0x3440aa,_0x2443f2))['catch'](loggerCatch(_0x9e40('0x9')));}; \ No newline at end of file +var _0x063d=['notify','catch','[Notify]\x20','util','bluebird','../../../config/logger','../rpc/faxAccount','inspect'];(function(_0x77d76e,_0x106ed2){var _0x5620c8=function(_0x481b37){while(--_0x481b37){_0x77d76e['push'](_0x77d76e['shift']());}};_0x5620c8(++_0x106ed2);}(_0x063d,0xbb));var _0xd063=function(_0x42cd10,_0x582044){_0x42cd10=_0x42cd10-0x0;var _0x22a6b6=_0x063d[_0x42cd10];return _0x22a6b6;};'use strict';var util=require(_0xd063('0x0'));var BPromise=require(_0xd063('0x1'));var logger=require(_0xd063('0x2'))('preview');var _=require('lodash');var faxAccount=require(_0xd063('0x3'));function loggerCatch(_0x3f27eb){return function(_0x118984){logger['error'](_0x3f27eb,util[_0xd063('0x4')](_0x118984,{'showHidden':![],'depth':null}));};}exports[_0xd063('0x5')]=function(_0x4d1994,_0x5dd4e0){return BPromise['resolve']()['then'](faxAccount['notify'](_0x4d1994,_0x5dd4e0))[_0xd063('0x6')](loggerCatch(_0xd063('0x7')));}; \ No newline at end of file diff --git a/server/services/ami/fax/util/gs.js b/server/services/ami/fax/util/gs.js index 0e25e57..c0a8887 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 _0x5a87=['info','Exec\x20gs','\x20Error\x20:','inspect','util','../../../../config/logger','child_process','exec','execute'];(function(_0x401b3e,_0xed8de5){var _0x4f290f=function(_0xa45f77){while(--_0xa45f77){_0x401b3e['push'](_0x401b3e['shift']());}};_0x4f290f(++_0xed8de5);}(_0x5a87,0x1d8));var _0x75a8=function(_0x199fd9,_0x55fe3e){_0x199fd9=_0x199fd9-0x0;var _0x1b11fa=_0x5a87[_0x199fd9];return _0x1b11fa;};'use strict';var util=require(_0x75a8('0x0'));var logger=require(_0x75a8('0x1'))('fax');var BPromise=require('bluebird');var exec=require(_0x75a8('0x2'))[_0x75a8('0x3')];exports[_0x75a8('0x4')]=function(_0x22a75f){return new BPromise(function(_0x3a15ab,_0x254820){exec(_0x22a75f,function(_0x1f30bc,_0x1467b1,_0x45f1ae){logger[_0x75a8('0x5')](_0x75a8('0x6'),_0x1467b1);if(_0x1f30bc){logger['info'](_0x75a8('0x6'),_0x75a8('0x7'),util[_0x75a8('0x8')](_0x1f30bc,{'showHidden':![],'depth':null}),_0x1467b1,_0x45f1ae);_0x254820(_0x1f30bc);}_0x3a15ab(_0x1467b1);});});}; \ No newline at end of file +var _0x19f1=['info','Exec\x20gs','inspect','util','../../../../config/logger','fax','bluebird','child_process','exec','execute'];(function(_0x3e8a58,_0x59660e){var _0x5d165a=function(_0x2e179b){while(--_0x2e179b){_0x3e8a58['push'](_0x3e8a58['shift']());}};_0x5d165a(++_0x59660e);}(_0x19f1,0x143));var _0x119f=function(_0x1809d4,_0x2fd2b0){_0x1809d4=_0x1809d4-0x0;var _0x41d9f4=_0x19f1[_0x1809d4];return _0x41d9f4;};'use strict';var util=require(_0x119f('0x0'));var logger=require(_0x119f('0x1'))(_0x119f('0x2'));var BPromise=require(_0x119f('0x3'));var exec=require(_0x119f('0x4'))[_0x119f('0x5')];exports[_0x119f('0x6')]=function(_0x1f8b16){return new BPromise(function(_0x358bfb,_0xcbfa13){exec(_0x1f8b16,function(_0x51159b,_0x391984,_0x3461f1){logger[_0x119f('0x7')]('Exec\x20gs',_0x391984);if(_0x51159b){logger['info'](_0x119f('0x8'),'\x20Error\x20:',util[_0x119f('0x9')](_0x51159b,{'showHidden':![],'depth':null}),_0x391984,_0x3461f1);_0xcbfa13(_0x51159b);}_0x358bfb(_0x391984);});});}; \ No newline at end of file diff --git a/server/services/ami/fax/util/util.js b/server/services/ami/fax/util/util.js index 6b54084..c0f77c8 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 _0x9c99=['message','logger','info','inspect','addVariables','ecm','headerinfo','minrate','modem','gateway','faxdetect','t38timeout','path','variablesAction','uniqueid','originate','channel','xcally-motion-fax','format','util','moment','../../../../config/logger'];(function(_0x1f9f37,_0x18776e){var _0x21c080=function(_0x4acb93){while(--_0x4acb93){_0x1f9f37['push'](_0x1f9f37['shift']());}};_0x21c080(++_0x18776e);}(_0x9c99,0xd9));var _0x99c9=function(_0x9148ba,_0x2cb1b5){_0x9148ba=_0x9148ba-0x0;var _0x355e3b=_0x9c99[_0x9148ba];return _0x355e3b;};'use strict';var util=require(_0x99c9('0x0'));var _=require('lodash');var moment=require(_0x99c9('0x1'));var logger=require(_0x99c9('0x2'))('fax');exports[_0x99c9('0x3')]=function(_0x4836eb){return{'message':_0x4836eb};};exports[_0x99c9('0x4')]=function(_0x2119d7,_0xb1ab5c){logger[_0x99c9('0x5')](_0x2119d7,util[_0x99c9('0x6')](_0xb1ab5c,{'showHidden':![],'depth':null}));};exports[_0x99c9('0x7')]=function(_0x56a333,_0x1e9a19){var _0x6dbc58={'XMF-ECM':_0x1e9a19[_0x99c9('0x8')],'XMF-HEADERINFO':_0x1e9a19[_0x99c9('0x9')],'XMF-MINRATE':_0x1e9a19[_0x99c9('0xa')],'XMF-MAXRATE':_0x1e9a19['maxrate'],'XMF-MODEM':util['format']('\x22%s\x22',_0x1e9a19[_0x99c9('0xb')]),'XMF-GATEWAY':_0x1e9a19[_0x99c9('0xc')],'XMF-FAXDETECT':_0x1e9a19[_0x99c9('0xd')],'XMF-T38TIMEOUT':_0x1e9a19[_0x99c9('0xe')],'XMF-LOCALSTATIONID':_0x1e9a19['localstationid'],'XMF-PATH':_0x56a333[_0x99c9('0xf')]};return _0x6dbc58;};exports[_0x99c9('0x10')]=function(_0x36b875,_0x13198d){return{'actionid':_0x36b875[_0x99c9('0x11')],'action':_0x99c9('0x12'),'channel':_0x36b875[_0x99c9('0x13')],'Exten':_0x99c9('0x14'),'Context':'from-sip','Priority':'1','callerid':util[_0x99c9('0x15')]('\x22%s\x22\x20<%s>',_0x36b875[_0x99c9('0x9')]?_0x36b875[_0x99c9('0x9')]:'',_0x36b875['localstationid']),'variable':_0x13198d,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x36b875['uniqueid']};}; \ No newline at end of file +var _0xff1c=['fax','message','info','inspect','addVariables','headerinfo','format','\x22%s\x22','modem','gateway','faxdetect','t38timeout','localstationid','path','variablesAction','uniqueid','originate','channel','xcally-motion-fax','from-sip','\x22%s\x22\x20<%s>','util','moment'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0xff1c,0x185));var _0xcff1=function(_0x44f914,_0x36060b){_0x44f914=_0x44f914-0x0;var _0x7f34f6=_0xff1c[_0x44f914];return _0x7f34f6;};'use strict';var util=require(_0xcff1('0x0'));var _=require('lodash');var moment=require(_0xcff1('0x1'));var logger=require('../../../../config/logger')(_0xcff1('0x2'));exports[_0xcff1('0x3')]=function(_0x2811f1){return{'message':_0x2811f1};};exports['logger']=function(_0x5477cc,_0x244b1b){logger[_0xcff1('0x4')](_0x5477cc,util[_0xcff1('0x5')](_0x244b1b,{'showHidden':![],'depth':null}));};exports[_0xcff1('0x6')]=function(_0x4c287c,_0x22cb3c){var _0x4cdf81={'XMF-ECM':_0x22cb3c['ecm'],'XMF-HEADERINFO':_0x22cb3c[_0xcff1('0x7')],'XMF-MINRATE':_0x22cb3c['minrate'],'XMF-MAXRATE':_0x22cb3c['maxrate'],'XMF-MODEM':util[_0xcff1('0x8')](_0xcff1('0x9'),_0x22cb3c[_0xcff1('0xa')]),'XMF-GATEWAY':_0x22cb3c[_0xcff1('0xb')],'XMF-FAXDETECT':_0x22cb3c[_0xcff1('0xc')],'XMF-T38TIMEOUT':_0x22cb3c[_0xcff1('0xd')],'XMF-LOCALSTATIONID':_0x22cb3c[_0xcff1('0xe')],'XMF-PATH':_0x4c287c[_0xcff1('0xf')]};return _0x4cdf81;};exports[_0xcff1('0x10')]=function(_0x2a411f,_0xc51cd6){return{'actionid':_0x2a411f[_0xcff1('0x11')],'action':_0xcff1('0x12'),'channel':_0x2a411f[_0xcff1('0x13')],'Exten':_0xcff1('0x14'),'Context':_0xcff1('0x15'),'Priority':'1','callerid':util[_0xcff1('0x8')](_0xcff1('0x16'),_0x2a411f['headerinfo']?_0x2a411f[_0xcff1('0x7')]:'',_0x2a411f['localstationid']),'variable':_0xc51cd6,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x2a411f[_0xcff1('0x11')]};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index 6ec7876..d5b288c 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 _0xbeb4=['moment','./report','./acw','./trigger','./fax','./rpc/user','./rpc/voiceCallReport','./rpc/trigger','./rpc/template','./rpc/campaign','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/salesforce','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/freshsales','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','get','hour','resolve','getAgents','initAgents','then','getTelephones','initTelephones','getTrunks','getVoiceQueues','initTriggers','initTemplates','getZendeskAccounts','initZendeskAccounts','getSalesforceAccounts','getSugarcrmAccounts','initSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','getDeskAccounts','initZohoAccounts','getVtigerAccounts','initVtigerAccounts','getFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','getDynamics365Accounts','getCampaigns','initCampaigns','getVoiceExtensions','initVoiceExtensions','initFaxAccounts','getVoiceQueueReports','initVoiceQueueReports','getVoiceQueueHopperHistory','initVoiceQueueHopperHistory','getCampaignHopperHistory','initCampaignHopperHistory','getVoiceCallReports','log','listen','sync','catch','bluebird','util'];(function(_0xd1f854,_0x532346){var _0x548294=function(_0x4be823){while(--_0x4be823){_0xd1f854['push'](_0xd1f854['shift']());}};_0x548294(++_0x532346);}(_0xbeb4,0x10a));var _0x4beb=function(_0x519e89,_0x41ec0d){_0x519e89=_0x519e89-0x0;var _0x1a0f42=_0xbeb4[_0x519e89];return _0x1a0f42;};'use strict';var BPromise=require(_0x4beb('0x0'));var util=require(_0x4beb('0x1'));var moment=require(_0x4beb('0x2'));var server=require('./server');var Realtime=require('./realtime');var Report=require(_0x4beb('0x3'));var Acw=require(_0x4beb('0x4'));var Trigger=require(_0x4beb('0x5'));var Dialer=require('./dialer');var Preview=require('./preview');var Fax=require(_0x4beb('0x6'));var user=require(_0x4beb('0x7'));var voiceQueue=require('./rpc/voiceQueue');var voiceQueueReport=require('./rpc/voiceQueueReport');var voiceCallReport=require(_0x4beb('0x8'));var trunk=require('./rpc/trunk');var trigger=require(_0x4beb('0x9'));var template=require(_0x4beb('0xa'));var cmHopperHistory=require('./rpc/cmHopperHistory');var campaign=require(_0x4beb('0xb'));var voiceExtension=require(_0x4beb('0xc'));var faxAccount=require(_0x4beb('0xd'));var zendesk=require(_0x4beb('0xe'));var salesforce=require(_0x4beb('0xf'));var sugarcrm=require(_0x4beb('0x10'));var freshdesk=require(_0x4beb('0x11'));var desk=require(_0x4beb('0x12'));var zoho=require(_0x4beb('0x13'));var vtiger=require(_0x4beb('0x14'));var freshsales=require(_0x4beb('0x15'));var servicenow=require(_0x4beb('0x16'));var dynamics365=require(_0x4beb('0x17'));var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0x4beb('0x18')](_0x4beb('0x19'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x4beb('0x18')](_0x4beb('0x19'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise[_0x4beb('0x1a')]()['then'](user[_0x4beb('0x1b')]())['then'](realtime[_0x4beb('0x1c')]())[_0x4beb('0x1d')](user[_0x4beb('0x1e')]())['then'](realtime[_0x4beb('0x1f')]())[_0x4beb('0x1d')](trunk[_0x4beb('0x20')]())[_0x4beb('0x1d')](realtime['initTrunks']())[_0x4beb('0x1d')](voiceQueue[_0x4beb('0x21')]())['then'](realtime['initVoiceQueues']())[_0x4beb('0x1d')](trigger['getTriggers']())[_0x4beb('0x1d')](realtime[_0x4beb('0x22')]())[_0x4beb('0x1d')](template['getTemplates']())[_0x4beb('0x1d')](realtime[_0x4beb('0x23')]())[_0x4beb('0x1d')](zendesk[_0x4beb('0x24')]())[_0x4beb('0x1d')](realtime[_0x4beb('0x25')]())['then'](salesforce[_0x4beb('0x26')]())['then'](realtime['initSalesforceAccounts']())['then'](sugarcrm[_0x4beb('0x27')]())[_0x4beb('0x1d')](realtime[_0x4beb('0x28')]())[_0x4beb('0x1d')](freshdesk[_0x4beb('0x29')]())[_0x4beb('0x1d')](realtime[_0x4beb('0x2a')]())['then'](desk[_0x4beb('0x2b')]())[_0x4beb('0x1d')](realtime['initDeskAccounts']())[_0x4beb('0x1d')](zoho['getZohoAccounts']())[_0x4beb('0x1d')](realtime[_0x4beb('0x2c')]())[_0x4beb('0x1d')](vtiger[_0x4beb('0x2d')]())[_0x4beb('0x1d')](realtime[_0x4beb('0x2e')]())[_0x4beb('0x1d')](freshsales[_0x4beb('0x2f')]())[_0x4beb('0x1d')](realtime['initFreshsalesAccounts']())[_0x4beb('0x1d')](servicenow[_0x4beb('0x30')]())[_0x4beb('0x1d')](realtime[_0x4beb('0x31')]())[_0x4beb('0x1d')](dynamics365[_0x4beb('0x32')]())['then'](realtime['initDynamics365Accounts']())[_0x4beb('0x1d')](campaign[_0x4beb('0x33')]())['then'](realtime[_0x4beb('0x34')]())[_0x4beb('0x1d')](voiceExtension[_0x4beb('0x35')]())[_0x4beb('0x1d')](realtime[_0x4beb('0x36')]())[_0x4beb('0x1d')](faxAccount['getFaxAccounts']())[_0x4beb('0x1d')](realtime[_0x4beb('0x37')]())['then'](function(){return realtime;});}function initParams(){return BPromise[_0x4beb('0x1a')]()[_0x4beb('0x1d')](voiceQueueReport[_0x4beb('0x38')]())[_0x4beb('0x1d')](realtime[_0x4beb('0x39')]())['then'](cmHopperHistory[_0x4beb('0x3a')]())[_0x4beb('0x1d')](realtime[_0x4beb('0x3b')]())['then'](cmHopperHistory[_0x4beb('0x3c')]())[_0x4beb('0x1d')](realtime[_0x4beb('0x3d')]())[_0x4beb('0x1d')](voiceCallReport[_0x4beb('0x3e')]())[_0x4beb('0x1d')](realtime['initVoiceCallReports']())['then'](function(_0x19d7db){})['catch'](function(_0x5729bf){console[_0x4beb('0x3f')](_0x5729bf);});}function main(){return server[_0x4beb('0x40')](realtime,preview,fax)[_0x4beb('0x1d')](function(_0x2e3686){return initRealtime();})[_0x4beb('0x1d')](function(){return initParams();})[_0x4beb('0x1d')](function(){report[_0x4beb('0x41')]();setInterval(initRealtime,0x1388);})[_0x4beb('0x42')](function(_0x5dc069){console[_0x4beb('0x3f')](_0x5dc069);});}main(); \ No newline at end of file +var _0x458e=['sync','util','moment','./server','./report','./acw','./trigger','./dialer','./preview','./fax','./rpc/user','./rpc/voiceQueueReport','./rpc/trunk','./rpc/trigger','./rpc/template','./rpc/campaign','./rpc/voiceExtension','./rpc/integrations/salesforce','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/freshsales','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','get','hour','then','getAgents','initAgents','getTelephones','initTelephones','getTrunks','initTrunks','getVoiceQueues','initVoiceQueues','getTriggers','initTemplates','getZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','getSugarcrmAccounts','initSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','getDeskAccounts','getZohoAccounts','getVtigerAccounts','initVtigerAccounts','getFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','getDynamics365Accounts','getCampaigns','initCampaigns','initVoiceExtensions','getFaxAccounts','initFaxAccounts','resolve','getVoiceQueueReports','initVoiceQueueReports','getVoiceQueueHopperHistory','initVoiceQueueHopperHistory','getCampaignHopperHistory','getVoiceCallReports','catch','log'];(function(_0x210f48,_0x585ad0){var _0x2f421f=function(_0x279f27){while(--_0x279f27){_0x210f48['push'](_0x210f48['shift']());}};_0x2f421f(++_0x585ad0);}(_0x458e,0xc7));var _0xe458=function(_0x3c3e92,_0x539b90){_0x3c3e92=_0x3c3e92-0x0;var _0x3a545c=_0x458e[_0x3c3e92];return _0x3a545c;};'use strict';var BPromise=require('bluebird');var util=require(_0xe458('0x0'));var moment=require(_0xe458('0x1'));var server=require(_0xe458('0x2'));var Realtime=require('./realtime');var Report=require(_0xe458('0x3'));var Acw=require(_0xe458('0x4'));var Trigger=require(_0xe458('0x5'));var Dialer=require(_0xe458('0x6'));var Preview=require(_0xe458('0x7'));var Fax=require(_0xe458('0x8'));var user=require(_0xe458('0x9'));var voiceQueue=require('./rpc/voiceQueue');var voiceQueueReport=require(_0xe458('0xa'));var voiceCallReport=require('./rpc/voiceCallReport');var trunk=require(_0xe458('0xb'));var trigger=require(_0xe458('0xc'));var template=require(_0xe458('0xd'));var cmHopperHistory=require('./rpc/cmHopperHistory');var campaign=require(_0xe458('0xe'));var voiceExtension=require(_0xe458('0xf'));var faxAccount=require('./rpc/faxAccount');var zendesk=require('./rpc/integrations/zendesk');var salesforce=require(_0xe458('0x10'));var sugarcrm=require('./rpc/integrations/sugarcrm');var freshdesk=require(_0xe458('0x11'));var desk=require(_0xe458('0x12'));var zoho=require(_0xe458('0x13'));var vtiger=require('./rpc/integrations/vtiger');var freshsales=require(_0xe458('0x14'));var servicenow=require(_0xe458('0x15'));var dynamics365=require(_0xe458('0x16'));var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0xe458('0x17')](_0xe458('0x18'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0xe458('0x17')](_0xe458('0x18'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise['resolve']()[_0xe458('0x19')](user[_0xe458('0x1a')]())[_0xe458('0x19')](realtime[_0xe458('0x1b')]())['then'](user[_0xe458('0x1c')]())[_0xe458('0x19')](realtime[_0xe458('0x1d')]())[_0xe458('0x19')](trunk[_0xe458('0x1e')]())[_0xe458('0x19')](realtime[_0xe458('0x1f')]())['then'](voiceQueue[_0xe458('0x20')]())[_0xe458('0x19')](realtime[_0xe458('0x21')]())['then'](trigger[_0xe458('0x22')]())[_0xe458('0x19')](realtime['initTriggers']())['then'](template['getTemplates']())[_0xe458('0x19')](realtime[_0xe458('0x23')]())[_0xe458('0x19')](zendesk[_0xe458('0x24')]())[_0xe458('0x19')](realtime['initZendeskAccounts']())[_0xe458('0x19')](salesforce[_0xe458('0x25')]())[_0xe458('0x19')](realtime[_0xe458('0x26')]())['then'](sugarcrm[_0xe458('0x27')]())[_0xe458('0x19')](realtime[_0xe458('0x28')]())[_0xe458('0x19')](freshdesk[_0xe458('0x29')]())[_0xe458('0x19')](realtime[_0xe458('0x2a')]())[_0xe458('0x19')](desk[_0xe458('0x2b')]())[_0xe458('0x19')](realtime['initDeskAccounts']())[_0xe458('0x19')](zoho[_0xe458('0x2c')]())[_0xe458('0x19')](realtime['initZohoAccounts']())['then'](vtiger[_0xe458('0x2d')]())[_0xe458('0x19')](realtime[_0xe458('0x2e')]())[_0xe458('0x19')](freshsales[_0xe458('0x2f')]())[_0xe458('0x19')](realtime['initFreshsalesAccounts']())[_0xe458('0x19')](servicenow[_0xe458('0x30')]())['then'](realtime[_0xe458('0x31')]())['then'](dynamics365[_0xe458('0x32')]())[_0xe458('0x19')](realtime['initDynamics365Accounts']())['then'](campaign[_0xe458('0x33')]())[_0xe458('0x19')](realtime[_0xe458('0x34')]())[_0xe458('0x19')](voiceExtension['getVoiceExtensions']())[_0xe458('0x19')](realtime[_0xe458('0x35')]())[_0xe458('0x19')](faxAccount[_0xe458('0x36')]())['then'](realtime[_0xe458('0x37')]())[_0xe458('0x19')](function(){return realtime;});}function initParams(){return BPromise[_0xe458('0x38')]()[_0xe458('0x19')](voiceQueueReport[_0xe458('0x39')]())[_0xe458('0x19')](realtime[_0xe458('0x3a')]())['then'](cmHopperHistory[_0xe458('0x3b')]())[_0xe458('0x19')](realtime[_0xe458('0x3c')]())[_0xe458('0x19')](cmHopperHistory[_0xe458('0x3d')]())[_0xe458('0x19')](realtime['initCampaignHopperHistory']())[_0xe458('0x19')](voiceCallReport[_0xe458('0x3e')]())['then'](realtime['initVoiceCallReports']())['then'](function(_0x3a96e4){})[_0xe458('0x3f')](function(_0x1aad98){console[_0xe458('0x40')](_0x1aad98);});}function main(){return server['listen'](realtime,preview,fax)['then'](function(_0x415342){return initRealtime();})[_0xe458('0x19')](function(){return initParams();})[_0xe458('0x19')](function(){report[_0xe458('0x41')]();setInterval(initRealtime,0x1388);})[_0xe458('0x3f')](function(_0x37390c){console[_0xe458('0x40')](_0x37390c);});}main(); \ No newline at end of file diff --git a/server/services/ami/model/agent.js b/server/services/ami/model/agent.js index 87b36c2..1ffa916 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 _0xe706=['address','phone','online','voiceStatus','voiceStatusTime','voiceStatusCallerIdNumber','voiceStatusQueue','onhold','updateStatusRealtime','not_inuse','inuse','talking','format','interface','stringify','md5','user:%s','emit','user:presence','lodash','util','moment','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','email','accountcode','fullname','state','unknown','stateTime','status'];(function(_0x3a7004,_0x2faf31){var _0x3b6f05=function(_0x572db5){while(--_0x572db5){_0x3a7004['push'](_0x3a7004['shift']());}};_0x3b6f05(++_0x2faf31);}(_0xe706,0xa3));var _0x6e70=function(_0x19a21c,_0x4e03f8){_0x19a21c=_0x19a21c-0x0;var _0x3e9b9f=_0xe706[_0x19a21c];return _0x3e9b9f;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var moment=require(_0x6e70('0x2'));var md5=require('md5');var Redis=require(_0x6e70('0x3'));var config=require(_0x6e70('0x4'));config[_0x6e70('0x5')]=_[_0x6e70('0x6')](config[_0x6e70('0x5')],{'host':_0x6e70('0x7'),'port':0x18eb});var io=require(_0x6e70('0x8'))(new Redis(config[_0x6e70('0x5')]));function Agent(_0x1b0389){this['id']=_0x1b0389['id']||0x0;this[_0x6e70('0x9')]=_0x1b0389[_0x6e70('0x9')]||'';this[_0x6e70('0xa')]=_0x1b0389[_0x6e70('0xa')]||'';this[_0x6e70('0xb')]=_0x1b0389[_0x6e70('0xb')]||'';this[_0x6e70('0xc')]=_0x1b0389[_0x6e70('0xc')]||'';this[_0x6e70('0xd')]=_0x6e70('0xe');this[_0x6e70('0xf')]=0x0;this[_0x6e70('0x10')]=_0x6e70('0xe');this[_0x6e70('0x11')]='';this[_0x6e70('0x12')]='';this['mobile']='';this['interface']='';this[_0x6e70('0x13')]=_0x1b0389[_0x6e70('0x13')]||![];this[_0x6e70('0x14')]=_0x6e70('0xe');this[_0x6e70('0x15')]=0x0;this[_0x6e70('0x16')]='';this[_0x6e70('0x17')]='';this[_0x6e70('0x18')]=![];this['local']=![];this['md5']='';}Agent['prototype'][_0x6e70('0x19')]=function(_0x5a37a6){var _0x53aed0;if(_0x5a37a6&&_0x5a37a6[_0x6e70('0xd')]){_0x53aed0=_0x5a37a6[_0x6e70('0xd')]['toLowerCase']();switch(_0x53aed0){case _0x6e70('0x1a'):_0x53aed0='idle';break;case _0x6e70('0x1b'):_0x53aed0=_0x6e70('0x1c');break;}}if(_0x53aed0&&this['voiceStatus']!==_0x53aed0||_0x5a37a6['statePause']){this[_0x6e70('0x15')]=_['toNumber'](moment()[_0x6e70('0x1d')]('x'));}if(_0x53aed0){this[_0x6e70('0x14')]=_0x53aed0;}var _0x53acdc={'id':this['id'],'name':this['name'],'email':this[_0x6e70('0xa')],'accountcode':this[_0x6e70('0xb')],'fullname':this[_0x6e70('0xc')],'state':this[_0x6e70('0xd')],'stateTime':this[_0x6e70('0xf')],'status':this[_0x6e70('0x10')],'address':this[_0x6e70('0x11')],'online':this[_0x6e70('0x13')],'voiceStatus':this[_0x6e70('0x14')],'voiceStatusTime':this[_0x6e70('0x15')],'voiceStatusCallerIdNumber':this['voiceStatusCallerIdNumber'],'voiceStatusQueue':this[_0x6e70('0x17')],'interface':this[_0x6e70('0x1e')],'onhold':this[_0x6e70('0x18')]};var _0x502b2d=md5(JSON[_0x6e70('0x1f')](_0x53acdc));if(this[_0x6e70('0x20')]!==_0x502b2d){this[_0x6e70('0x20')]=_0x502b2d;io['to'](util['format'](_0x6e70('0x21'),_0x53acdc['name']))['emit']('user:save',_0x53acdc);io[_0x6e70('0x22')](_0x6e70('0x23'),_0x53acdc);}};module['exports']=Agent; \ No newline at end of file +var _0x0713=['idle','inuse','talking','voiceStatusTime','toNumber','format','voiceStatusQueue','stringify','user:%s','emit','user:save','user:presence','exports','moment','md5','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','name','email','accountcode','fullname','unknown','stateTime','status','address','mobile','interface','online','voiceStatus','voiceStatusCallerIdNumber','onhold','local','prototype','state','toLowerCase','not_inuse'];(function(_0x2bf868,_0x3bf8e1){var _0x2e2293=function(_0xb3adcc){while(--_0xb3adcc){_0x2bf868['push'](_0x2bf868['shift']());}};_0x2e2293(++_0x3bf8e1);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3071('0x0'));var md5=require(_0x3071('0x1'));var Redis=require(_0x3071('0x2'));var config=require(_0x3071('0x3'));config[_0x3071('0x4')]=_['defaults'](config[_0x3071('0x4')],{'host':_0x3071('0x5'),'port':0x18eb});var io=require(_0x3071('0x6'))(new Redis(config[_0x3071('0x4')]));function Agent(_0xabd7b6){this['id']=_0xabd7b6['id']||0x0;this[_0x3071('0x7')]=_0xabd7b6[_0x3071('0x7')]||'';this[_0x3071('0x8')]=_0xabd7b6[_0x3071('0x8')]||'';this[_0x3071('0x9')]=_0xabd7b6[_0x3071('0x9')]||'';this[_0x3071('0xa')]=_0xabd7b6[_0x3071('0xa')]||'';this['state']=_0x3071('0xb');this[_0x3071('0xc')]=0x0;this[_0x3071('0xd')]=_0x3071('0xb');this[_0x3071('0xe')]='';this['phone']='';this[_0x3071('0xf')]='';this[_0x3071('0x10')]='';this[_0x3071('0x11')]=_0xabd7b6[_0x3071('0x11')]||![];this[_0x3071('0x12')]='unknown';this['voiceStatusTime']=0x0;this[_0x3071('0x13')]='';this['voiceStatusQueue']='';this[_0x3071('0x14')]=![];this[_0x3071('0x15')]=![];this['md5']='';}Agent[_0x3071('0x16')]['updateStatusRealtime']=function(_0x2fc15d){var _0x45c93b;if(_0x2fc15d&&_0x2fc15d[_0x3071('0x17')]){_0x45c93b=_0x2fc15d[_0x3071('0x17')][_0x3071('0x18')]();switch(_0x45c93b){case _0x3071('0x19'):_0x45c93b=_0x3071('0x1a');break;case _0x3071('0x1b'):_0x45c93b=_0x3071('0x1c');break;}}if(_0x45c93b&&this[_0x3071('0x12')]!==_0x45c93b||_0x2fc15d['statePause']){this[_0x3071('0x1d')]=_[_0x3071('0x1e')](moment()[_0x3071('0x1f')]('x'));}if(_0x45c93b){this[_0x3071('0x12')]=_0x45c93b;}var _0x3acf0e={'id':this['id'],'name':this[_0x3071('0x7')],'email':this[_0x3071('0x8')],'accountcode':this[_0x3071('0x9')],'fullname':this['fullname'],'state':this[_0x3071('0x17')],'stateTime':this[_0x3071('0xc')],'status':this[_0x3071('0xd')],'address':this['address'],'online':this[_0x3071('0x11')],'voiceStatus':this['voiceStatus'],'voiceStatusTime':this[_0x3071('0x1d')],'voiceStatusCallerIdNumber':this[_0x3071('0x13')],'voiceStatusQueue':this[_0x3071('0x20')],'interface':this[_0x3071('0x10')],'onhold':this[_0x3071('0x14')]};var _0x34c50e=md5(JSON[_0x3071('0x21')](_0x3acf0e));if(this[_0x3071('0x1')]!==_0x34c50e){this['md5']=_0x34c50e;io['to'](util['format'](_0x3071('0x22'),_0x3acf0e[_0x3071('0x7')]))[_0x3071('0x23')](_0x3071('0x24'),_0x3acf0e);io[_0x3071('0x23')](_0x3071('0x25'),_0x3acf0e);}};module[_0x3071('0x26')]=Agent; \ No newline at end of file diff --git a/server/services/ami/model/campaign.js b/server/services/ami/model/campaign.js index 4ebd2d5..50473ca 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 _0xeabb=['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','name','campaign','originated','ivrAnswerCallsDay','message','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xeabb,0xbb));var _0xbeab=function(_0x63500b,_0x508aa1){_0x63500b=_0x63500b-0x0;var _0x492332=_0xeabb[_0x63500b];return _0x492332;};'use strict';function Campaign(_0x4c7725){this['id']=_0x4c7725['id']||0x0;this[_0xbeab('0x0')]=_0x4c7725[_0xbeab('0x0')]||'';this['type']=_0x4c7725['type']||_0xbeab('0x1');this[_0xbeab('0x2')]=0x0;this['temp']=0x0;this[_0xbeab('0x3')]=0x0;this['ivrTotalCallsDays']=0x0;this[_0xbeab('0x4')]='';this[_0xbeab('0x5')]=!![];this[_0xbeab('0x6')]=_0x4c7725[_0xbeab('0x6')];this['limitCalls']=_0x4c7725[_0xbeab('0x7')];this[_0xbeab('0x8')]=_0x4c7725[_0xbeab('0x8')]||null;this[_0xbeab('0x9')]=_0x4c7725['dialGlobalInterval']?_0x4c7725[_0xbeab('0x9')]:null;this[_0xbeab('0xa')]=_0x4c7725[_0xbeab('0xa')];this[_0xbeab('0xb')]=_0x4c7725[_0xbeab('0xb')];this[_0xbeab('0xc')]=_0x4c7725['dialOriginateTimeout']||0x1e;this[_0xbeab('0xd')]=_0x4c7725[_0xbeab('0xd')];this[_0xbeab('0xe')]=_0x4c7725[_0xbeab('0xe')];this[_0xbeab('0xf')]=_0x4c7725[_0xbeab('0xf')];this[_0xbeab('0x10')]=_0x4c7725[_0xbeab('0x10')];this['dialNoAnswerMaxRetry']=_0x4c7725[_0xbeab('0x11')];this[_0xbeab('0x12')]=_0x4c7725['dialNoAnswerRetryFrequency'];this[_0xbeab('0x13')]=_0x4c7725[_0xbeab('0x13')];this[_0xbeab('0x14')]=_0x4c7725[_0xbeab('0x14')]||0x3;this[_0xbeab('0x15')]=_0x4c7725[_0xbeab('0x15')]||0x96;this['dialDropMaxRetry']=_0x4c7725[_0xbeab('0x16')]||0x3;this[_0xbeab('0x17')]=_0x4c7725['dialDropRetryFrequency']||0x96;this[_0xbeab('0x18')]=_0x4c7725[_0xbeab('0x18')]||0x3;this[_0xbeab('0x19')]=_0x4c7725[_0xbeab('0x19')]||0x96;this[_0xbeab('0x1a')]=_0x4c7725['dialMachineMaxRetry']||0x3;this[_0xbeab('0x1b')]=_0x4c7725[_0xbeab('0x1b')]||0x96;this[_0xbeab('0x1c')]=_0x4c7725[_0xbeab('0x1c')]||0x3;this[_0xbeab('0x1d')]=_0x4c7725[_0xbeab('0x1d')]||0x96;this['dialOrderByScheduledAt']=_0x4c7725[_0xbeab('0x1e')]||_0xbeab('0x1f');this[_0xbeab('0x20')]=_0x4c7725[_0xbeab('0x20')]||undefined;this[_0xbeab('0x21')]=_0x4c7725['dialRandomLastDigitCallerIdNumber']||undefined;this[_0xbeab('0x22')]=_0x4c7725[_0xbeab('0x22')]||undefined;this[_0xbeab('0x23')]=_0x4c7725['TrunkBackup']?_0x4c7725[_0xbeab('0x23')]:undefined;this[_0xbeab('0x24')]=_0x4c7725[_0xbeab('0x24')]?_0x4c7725['Trunk']:undefined;this['Interval']=_0x4c7725[_0xbeab('0x25')]?_0x4c7725[_0xbeab('0x25')]:undefined;this[_0xbeab('0x26')]=_0x4c7725[_0xbeab('0x26')]?_0x4c7725['SquareProject']:undefined;this[_0xbeab('0x27')]=_0x4c7725[_0xbeab('0x26')]?_0x4c7725[_0xbeab('0x26')]['name']:undefined;this[_0xbeab('0x28')]=_0x4c7725[_0xbeab('0x28')]||![];this[_0xbeab('0x29')]=_0x4c7725['dialAMDInitialSilence'];this[_0xbeab('0x2a')]=_0x4c7725[_0xbeab('0x2a')];this[_0xbeab('0x2b')]=_0x4c7725[_0xbeab('0x2b')];this['dialAMDTotalAnalysisTime']=_0x4c7725[_0xbeab('0x2c')];this['dialAMDMinWordLength']=_0x4c7725[_0xbeab('0x2d')];this[_0xbeab('0x2e')]=_0x4c7725[_0xbeab('0x2e')];this[_0xbeab('0x2f')]=_0x4c7725[_0xbeab('0x2f')];this['dialAMDSilenceThreshold']=_0x4c7725[_0xbeab('0x30')];this[_0xbeab('0x31')]=_0x4c7725[_0xbeab('0x31')];}module[_0xbeab('0x32')]=Campaign; \ No newline at end of file +var _0x6d16=['dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','campaign','originated','temp','message','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry'];(function(_0x503ffd,_0x8ecde){var _0x160437=function(_0x2d45dd){while(--_0x2d45dd){_0x503ffd['push'](_0x503ffd['shift']());}};_0x160437(++_0x8ecde);}(_0x6d16,0xb6));var _0x66d1=function(_0x87db3c,_0x727b5a){_0x87db3c=_0x87db3c-0x0;var _0x36f93f=_0x6d16[_0x87db3c];return _0x36f93f;};'use strict';function Campaign(_0xa9bec9){this['id']=_0xa9bec9['id']||0x0;this[_0x66d1('0x0')]=_0xa9bec9[_0x66d1('0x0')]||'';this[_0x66d1('0x1')]=_0xa9bec9[_0x66d1('0x1')]||_0x66d1('0x2');this[_0x66d1('0x3')]=0x0;this[_0x66d1('0x4')]=0x0;this['ivrAnswerCallsDay']=0x0;this['ivrTotalCallsDays']=0x0;this[_0x66d1('0x5')]='';this['sendMessageOneNotActive']=!![];this[_0x66d1('0x6')]=_0xa9bec9[_0x66d1('0x6')];this[_0x66d1('0x7')]=_0xa9bec9[_0x66d1('0x7')];this['dialTimezone']=_0xa9bec9[_0x66d1('0x8')]||null;this[_0x66d1('0x9')]=_0xa9bec9[_0x66d1('0x9')]?_0xa9bec9['dialGlobalInterval']:null;this[_0x66d1('0xa')]=_0xa9bec9[_0x66d1('0xa')];this[_0x66d1('0xb')]=_0xa9bec9[_0x66d1('0xb')];this[_0x66d1('0xc')]=_0xa9bec9[_0x66d1('0xc')]||0x1e;this[_0x66d1('0xd')]=_0xa9bec9['dialCongestionMaxRetry'];this[_0x66d1('0xe')]=_0xa9bec9[_0x66d1('0xe')];this[_0x66d1('0xf')]=_0xa9bec9[_0x66d1('0xf')];this[_0x66d1('0x10')]=_0xa9bec9[_0x66d1('0x10')];this[_0x66d1('0x11')]=_0xa9bec9[_0x66d1('0x11')];this[_0x66d1('0x12')]=_0xa9bec9[_0x66d1('0x12')];this['dialGlobalMaxRetry']=_0xa9bec9[_0x66d1('0x13')];this[_0x66d1('0x14')]=_0xa9bec9['dialNoSuchNumberMaxRetry']||0x3;this['dialNoSuchNumberRetryFrequency']=_0xa9bec9[_0x66d1('0x15')]||0x96;this[_0x66d1('0x16')]=_0xa9bec9['dialDropMaxRetry']||0x3;this[_0x66d1('0x17')]=_0xa9bec9[_0x66d1('0x17')]||0x96;this[_0x66d1('0x18')]=_0xa9bec9['dialAbandonedMaxRetry']||0x3;this[_0x66d1('0x19')]=_0xa9bec9[_0x66d1('0x19')]||0x96;this['dialMachineMaxRetry']=_0xa9bec9[_0x66d1('0x1a')]||0x3;this['dialMachineRetryFrequency']=_0xa9bec9[_0x66d1('0x1b')]||0x96;this[_0x66d1('0x1c')]=_0xa9bec9['dialAgentRejectMaxRetry']||0x3;this[_0x66d1('0x1d')]=_0xa9bec9[_0x66d1('0x1d')]||0x96;this[_0x66d1('0x1e')]=_0xa9bec9[_0x66d1('0x1e')]||'DESC';this[_0x66d1('0x1f')]=_0xa9bec9[_0x66d1('0x1f')]||undefined;this[_0x66d1('0x20')]=_0xa9bec9['dialRandomLastDigitCallerIdNumber']||undefined;this['dialCutDigit']=_0xa9bec9[_0x66d1('0x21')]||undefined;this[_0x66d1('0x22')]=_0xa9bec9['TrunkBackup']?_0xa9bec9['TrunkBackup']:undefined;this['Trunk']=_0xa9bec9['Trunk']?_0xa9bec9[_0x66d1('0x23')]:undefined;this[_0x66d1('0x24')]=_0xa9bec9[_0x66d1('0x24')]?_0xa9bec9['Interval']:undefined;this[_0x66d1('0x25')]=_0xa9bec9[_0x66d1('0x25')]?_0xa9bec9['SquareProject']:undefined;this[_0x66d1('0x26')]=_0xa9bec9[_0x66d1('0x25')]?_0xa9bec9[_0x66d1('0x25')][_0x66d1('0x0')]:undefined;this[_0x66d1('0x27')]=_0xa9bec9[_0x66d1('0x27')]||![];this[_0x66d1('0x28')]=_0xa9bec9[_0x66d1('0x28')];this[_0x66d1('0x29')]=_0xa9bec9['dialAMDGreeting'];this[_0x66d1('0x2a')]=_0xa9bec9[_0x66d1('0x2a')];this['dialAMDTotalAnalysisTime']=_0xa9bec9[_0x66d1('0x2b')];this['dialAMDMinWordLength']=_0xa9bec9[_0x66d1('0x2c')];this[_0x66d1('0x2d')]=_0xa9bec9[_0x66d1('0x2d')];this[_0x66d1('0x2e')]=_0xa9bec9[_0x66d1('0x2e')];this[_0x66d1('0x2f')]=_0xa9bec9[_0x66d1('0x2f')];this[_0x66d1('0x30')]=_0xa9bec9[_0x66d1('0x30')];}module[_0x66d1('0x31')]=Campaign; \ No newline at end of file diff --git a/server/services/ami/model/channel.js b/server/services/ami/model/channel.js index 8044e79..0fcad1b 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 _0x02ce=['monitorFilename','queue','monitors','transfercalleridnum','transferconnectedlinenum','transferType','mohtime','exports','starttime','channel','destinationchannel','calleridname','connectedlinename','accountcode','context','uniqueid','linkedid','exten','answered','answertime','endtime','lastapplication','lastdata','duration','billableseconds','holdtime','type','tag','disposition','monitor'];(function(_0x15ba4b,_0x54147b){var _0x48cbf0=function(_0x5cec00){while(--_0x5cec00){_0x15ba4b['push'](_0x15ba4b['shift']());}};_0x48cbf0(++_0x54147b);}(_0x02ce,0x1ac));var _0xe02c=function(_0x2225d6,_0x33c654){_0x2225d6=_0x2225d6-0x0;var _0x2d5b20=_0x02ce[_0x2225d6];return _0x2d5b20;};'use strict';function Channel(){this[_0xe02c('0x0')]=null;this[_0xe02c('0x1')]='';this[_0xe02c('0x2')]='';this['calleridnum']=0x0;this[_0xe02c('0x3')]='';this['connectedlinenum']=undefined;this[_0xe02c('0x4')]=undefined;this[_0xe02c('0x5')]=0x0;this[_0xe02c('0x6')]='';this[_0xe02c('0x7')]=0x0;this[_0xe02c('0x8')]=0x0;this[_0xe02c('0x9')]=0x0;this[_0xe02c('0xa')]=![];this[_0xe02c('0xb')]=null;this[_0xe02c('0xc')]=null;this['unmanaged']=![];this['abandoned']=![];this[_0xe02c('0xd')]='';this[_0xe02c('0xe')]='';this[_0xe02c('0xf')]=0x0;this[_0xe02c('0x10')]=0x0;this[_0xe02c('0x11')]=0x0;this[_0xe02c('0x12')]=null;this[_0xe02c('0x13')]=null;this[_0xe02c('0x14')]=null;this[_0xe02c('0x15')]=![];this[_0xe02c('0x16')]=null;this[_0xe02c('0x17')]=null;this[_0xe02c('0x18')]=[];this[_0xe02c('0x19')]=undefined;this[_0xe02c('0x1a')]=undefined;this[_0xe02c('0x1b')]=undefined;this[_0xe02c('0x1c')]=0x0;}module[_0xe02c('0x1d')]=Channel; \ No newline at end of file +var _0xc87b=['holdtime','type','tag','disposition','monitorFilename','monitors','transfercalleridnum','transferconnectedlinenum','mohtime','exports','starttime','channel','destinationchannel','calleridnum','connectedlinenum','connectedlinename','accountcode','uniqueid','linkedid','exten','answered','endtime','unmanaged','abandoned','lastapplication','lastdata','duration','billableseconds'];(function(_0x4d9cf6,_0x25b660){var _0x37c52f=function(_0x158aa0){while(--_0x158aa0){_0x4d9cf6['push'](_0x4d9cf6['shift']());}};_0x37c52f(++_0x25b660);}(_0xc87b,0xb2));var _0xbc87=function(_0x24061a,_0x1c9f4d){_0x24061a=_0x24061a-0x0;var _0x82054e=_0xc87b[_0x24061a];return _0x82054e;};'use strict';function Channel(){this[_0xbc87('0x0')]=null;this[_0xbc87('0x1')]='';this[_0xbc87('0x2')]='';this[_0xbc87('0x3')]=0x0;this['calleridname']='';this[_0xbc87('0x4')]=undefined;this[_0xbc87('0x5')]=undefined;this[_0xbc87('0x6')]=0x0;this['context']='';this[_0xbc87('0x7')]=0x0;this[_0xbc87('0x8')]=0x0;this[_0xbc87('0x9')]=0x0;this[_0xbc87('0xa')]=![];this['answertime']=null;this[_0xbc87('0xb')]=null;this[_0xbc87('0xc')]=![];this[_0xbc87('0xd')]=![];this[_0xbc87('0xe')]='';this[_0xbc87('0xf')]='';this[_0xbc87('0x10')]=0x0;this[_0xbc87('0x11')]=0x0;this[_0xbc87('0x12')]=0x0;this[_0xbc87('0x13')]=null;this[_0xbc87('0x14')]=null;this[_0xbc87('0x15')]=null;this['monitor']=![];this[_0xbc87('0x16')]=null;this['queue']=null;this[_0xbc87('0x17')]=[];this[_0xbc87('0x18')]=undefined;this[_0xbc87('0x19')]=undefined;this['transferType']=undefined;this[_0xbc87('0x1a')]=0x0;}module[_0xbc87('0x1b')]=Channel; \ No newline at end of file diff --git a/server/services/ami/model/deskAccount.js b/server/services/ami/model/deskAccount.js index a8ae4a8..8847414 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 _0x3f04=['serverUrl','Configurations','exports','name','remoteUri','authType','password','consumerKey','consumerSecret','token','tokenSecret','type'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x3f04,0x1d7));var _0x43f0=function(_0x111076,_0x5606e3){_0x111076=_0x111076-0x0;var _0x25b218=_0x3f04[_0x111076];return _0x25b218;};'use strict';function DeskAccount(_0x5e1f1b){this['id']=_0x5e1f1b['id']||0x0;this[_0x43f0('0x0')]=_0x5e1f1b[_0x43f0('0x0')]||'';this['username']=_0x5e1f1b['username']||'';this[_0x43f0('0x1')]=_0x5e1f1b[_0x43f0('0x1')]||'';this['authType']=_0x5e1f1b[_0x43f0('0x2')]||'';this[_0x43f0('0x3')]=_0x5e1f1b[_0x43f0('0x3')]||'';this[_0x43f0('0x4')]=_0x5e1f1b[_0x43f0('0x4')]||'';this[_0x43f0('0x5')]=_0x5e1f1b[_0x43f0('0x5')]||'';this[_0x43f0('0x6')]=_0x5e1f1b['token']||'';this[_0x43f0('0x7')]=_0x5e1f1b['tokenSecret']||'';this[_0x43f0('0x8')]=_0x5e1f1b[_0x43f0('0x8')]||'';this[_0x43f0('0x9')]=_0x5e1f1b[_0x43f0('0x9')]||'';this[_0x43f0('0xa')]=_0x5e1f1b[_0x43f0('0xa')]||{};}module[_0x43f0('0xb')]=DeskAccount; \ No newline at end of file +var _0x1c21=['token','tokenSecret','type','serverUrl','exports','name','username','remoteUri','authType','password','consumerSecret'];(function(_0x47adb8,_0x591ccc){var _0x4689a8=function(_0x2ba76f){while(--_0x2ba76f){_0x47adb8['push'](_0x47adb8['shift']());}};_0x4689a8(++_0x591ccc);}(_0x1c21,0x1f4));var _0x11c2=function(_0x2a2f1b,_0xbd475b){_0x2a2f1b=_0x2a2f1b-0x0;var _0x54b718=_0x1c21[_0x2a2f1b];return _0x54b718;};'use strict';function DeskAccount(_0x248b0e){this['id']=_0x248b0e['id']||0x0;this[_0x11c2('0x0')]=_0x248b0e['name']||'';this[_0x11c2('0x1')]=_0x248b0e[_0x11c2('0x1')]||'';this[_0x11c2('0x2')]=_0x248b0e[_0x11c2('0x2')]||'';this[_0x11c2('0x3')]=_0x248b0e['authType']||'';this['password']=_0x248b0e[_0x11c2('0x4')]||'';this['consumerKey']=_0x248b0e['consumerKey']||'';this[_0x11c2('0x5')]=_0x248b0e[_0x11c2('0x5')]||'';this[_0x11c2('0x6')]=_0x248b0e[_0x11c2('0x6')]||'';this[_0x11c2('0x7')]=_0x248b0e[_0x11c2('0x7')]||'';this[_0x11c2('0x8')]=_0x248b0e[_0x11c2('0x8')]||'';this[_0x11c2('0x9')]=_0x248b0e[_0x11c2('0x9')]||'';this['Configurations']=_0x248b0e['Configurations']||{};}module[_0x11c2('0xa')]=DeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/dynamics365Account.js b/server/services/ami/model/dynamics365Account.js index 86599f6..4097b69 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 _0x9ffd=['name','username','password','remoteUri','tenantId','clientId','clientSecret','serverUrl','Configurations','exports'];(function(_0x4a006b,_0x3acaec){var _0x39a775=function(_0x9436e9){while(--_0x9436e9){_0x4a006b['push'](_0x4a006b['shift']());}};_0x39a775(++_0x3acaec);}(_0x9ffd,0xaa));var _0xd9ff=function(_0x259ad0,_0x58a797){_0x259ad0=_0x259ad0-0x0;var _0x32e5d1=_0x9ffd[_0x259ad0];return _0x32e5d1;};'use strict';function Dynamics365Account(_0x4c26a1){this['id']=_0x4c26a1['id']||0x0;this[_0xd9ff('0x0')]=_0x4c26a1[_0xd9ff('0x0')]||'';this['username']=_0x4c26a1[_0xd9ff('0x1')]||'';this[_0xd9ff('0x2')]=_0x4c26a1[_0xd9ff('0x2')]||'';this[_0xd9ff('0x3')]=_0x4c26a1['remoteUri']||'';this[_0xd9ff('0x4')]=_0x4c26a1[_0xd9ff('0x4')]||'';this['clientId']=_0x4c26a1[_0xd9ff('0x5')]||'';this[_0xd9ff('0x6')]=_0x4c26a1[_0xd9ff('0x6')]||{};this[_0xd9ff('0x7')]=_0x4c26a1[_0xd9ff('0x7')]||'';this[_0xd9ff('0x8')]=_0x4c26a1[_0xd9ff('0x8')]||{};}module[_0xd9ff('0x9')]=Dynamics365Account; \ No newline at end of file +var _0x0713=['Configurations','exports','name','username','password','remoteUri','tenantId','clientId','clientSecret','serverUrl'];(function(_0x34bc6c,_0x10d089){var _0x168820=function(_0xb058d9){while(--_0xb058d9){_0x34bc6c['push'](_0x34bc6c['shift']());}};_0x168820(++_0x10d089);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';function Dynamics365Account(_0x4bf247){this['id']=_0x4bf247['id']||0x0;this['name']=_0x4bf247[_0x3071('0x0')]||'';this[_0x3071('0x1')]=_0x4bf247[_0x3071('0x1')]||'';this[_0x3071('0x2')]=_0x4bf247[_0x3071('0x2')]||'';this['remoteUri']=_0x4bf247[_0x3071('0x3')]||'';this[_0x3071('0x4')]=_0x4bf247[_0x3071('0x4')]||'';this[_0x3071('0x5')]=_0x4bf247[_0x3071('0x5')]||'';this[_0x3071('0x6')]=_0x4bf247[_0x3071('0x6')]||{};this[_0x3071('0x7')]=_0x4bf247[_0x3071('0x7')]||'';this[_0x3071('0x8')]=_0x4bf247[_0x3071('0x8')]||{};}module[_0x3071('0x9')]=Dynamics365Account; \ No newline at end of file diff --git a/server/services/ami/model/faxAccount.js b/server/services/ami/model/faxAccount.js index 5abc3ed..39abf88 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 _0x1bd0=['localstationid','minrate','maxrate','modem','v17,v27,v29','gateway','faxdetect','t38timeout','tech','Trunk','ListId','key','exports','name','description','ecm','headerinfo'];(function(_0x373dee,_0x1a8c45){var _0x46798f=function(_0xc389f0){while(--_0xc389f0){_0x373dee['push'](_0x373dee['shift']());}};_0x46798f(++_0x1a8c45);}(_0x1bd0,0x1d8));var _0x01bd=function(_0x1c7b72,_0x4e340a){_0x1c7b72=_0x1c7b72-0x0;var _0x16e645=_0x1bd0[_0x1c7b72];return _0x16e645;};'use strict';function FaxAccount(_0x323c62){this['id']=_0x323c62['id']||0x0;this[_0x01bd('0x0')]=_0x323c62[_0x01bd('0x0')]||'';this[_0x01bd('0x1')]=_0x323c62[_0x01bd('0x1')];this[_0x01bd('0x2')]=_0x323c62[_0x01bd('0x2')];this[_0x01bd('0x3')]=_0x323c62['headerinfo'];this[_0x01bd('0x4')]=_0x323c62[_0x01bd('0x4')];this[_0x01bd('0x5')]=_0x323c62[_0x01bd('0x5')]||0x960;this[_0x01bd('0x6')]=_0x323c62['maxrate']||0x3840;this[_0x01bd('0x7')]=_0x323c62['modem']||_0x01bd('0x8');this[_0x01bd('0x9')]=_0x323c62[_0x01bd('0x9')]||'no';this[_0x01bd('0xa')]=_0x323c62[_0x01bd('0xa')]||'no';this[_0x01bd('0xb')]=_0x323c62[_0x01bd('0xb')]||0x1388;this[_0x01bd('0xc')]=_0x323c62[_0x01bd('0xc')]||'SIP';this[_0x01bd('0xd')]=_0x323c62[_0x01bd('0xd')]?_0x323c62['Trunk']:undefined;this[_0x01bd('0xe')]=_0x323c62[_0x01bd('0xe')];this[_0x01bd('0xf')]=_0x323c62[_0x01bd('0xf')];}module[_0x01bd('0x10')]=FaxAccount; \ No newline at end of file +var _0x7428=['key','name','description','ecm','headerinfo','localstationid','minrate','maxrate','modem','v17,v27,v29','gateway','faxdetect','t38timeout','tech','SIP','Trunk','ListId'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x7428,0x1aa));var _0x8742=function(_0x16c4c4,_0x2c5a29){_0x16c4c4=_0x16c4c4-0x0;var _0x4a4c77=_0x7428[_0x16c4c4];return _0x4a4c77;};'use strict';function FaxAccount(_0x4b5b38){this['id']=_0x4b5b38['id']||0x0;this[_0x8742('0x0')]=_0x4b5b38[_0x8742('0x0')]||'';this[_0x8742('0x1')]=_0x4b5b38[_0x8742('0x1')];this[_0x8742('0x2')]=_0x4b5b38[_0x8742('0x2')];this[_0x8742('0x3')]=_0x4b5b38[_0x8742('0x3')];this[_0x8742('0x4')]=_0x4b5b38[_0x8742('0x4')];this[_0x8742('0x5')]=_0x4b5b38[_0x8742('0x5')]||0x960;this[_0x8742('0x6')]=_0x4b5b38[_0x8742('0x6')]||0x3840;this[_0x8742('0x7')]=_0x4b5b38[_0x8742('0x7')]||_0x8742('0x8');this[_0x8742('0x9')]=_0x4b5b38[_0x8742('0x9')]||'no';this['faxdetect']=_0x4b5b38[_0x8742('0xa')]||'no';this[_0x8742('0xb')]=_0x4b5b38[_0x8742('0xb')]||0x1388;this[_0x8742('0xc')]=_0x4b5b38[_0x8742('0xc')]||_0x8742('0xd');this[_0x8742('0xe')]=_0x4b5b38[_0x8742('0xe')]?_0x4b5b38[_0x8742('0xe')]:undefined;this['ListId']=_0x4b5b38[_0x8742('0xf')];this['key']=_0x4b5b38[_0x8742('0x10')];}module['exports']=FaxAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshdeskAccount.js b/server/services/ami/model/freshdeskAccount.js index ca38c67..cf1e507 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 _0xf069=['name','username','apiKey','token','remoteUri','serverUrl','Configurations'];(function(_0xc67528,_0x24e2fb){var _0x38e26d=function(_0x1b0efe){while(--_0x1b0efe){_0xc67528['push'](_0xc67528['shift']());}};_0x38e26d(++_0x24e2fb);}(_0xf069,0x77));var _0x9f06=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xf069[_0x14add3];return _0x4a174f;};'use strict';function FreshdeskAccount(_0x3cb9c1){this['id']=_0x3cb9c1['id']||0x0;this[_0x9f06('0x0')]=_0x3cb9c1[_0x9f06('0x0')]||'';this[_0x9f06('0x1')]=_0x3cb9c1[_0x9f06('0x1')]||'';this[_0x9f06('0x2')]=_0x3cb9c1[_0x9f06('0x3')]||'';this['remoteUri']=_0x3cb9c1[_0x9f06('0x4')]||'';this['serverUrl']=_0x3cb9c1[_0x9f06('0x5')]||'';this[_0x9f06('0x6')]=_0x3cb9c1['Configurations']||{};}module['exports']=FreshdeskAccount; \ No newline at end of file +var _0x1270=['remoteUri','serverUrl','Configurations','exports','name','username','apiKey','token'];(function(_0x18f5b5,_0x25c072){var _0x517c5f=function(_0x1ba3aa){while(--_0x1ba3aa){_0x18f5b5['push'](_0x18f5b5['shift']());}};_0x517c5f(++_0x25c072);}(_0x1270,0x74));var _0x0127=function(_0xd6575d,_0x4ec5aa){_0xd6575d=_0xd6575d-0x0;var _0x325ac3=_0x1270[_0xd6575d];return _0x325ac3;};'use strict';function FreshdeskAccount(_0x37c9ff){this['id']=_0x37c9ff['id']||0x0;this[_0x0127('0x0')]=_0x37c9ff[_0x0127('0x0')]||'';this['username']=_0x37c9ff[_0x0127('0x1')]||'';this[_0x0127('0x2')]=_0x37c9ff[_0x0127('0x3')]||'';this[_0x0127('0x4')]=_0x37c9ff[_0x0127('0x4')]||'';this[_0x0127('0x5')]=_0x37c9ff['serverUrl']||'';this[_0x0127('0x6')]=_0x37c9ff['Configurations']||{};}module[_0x0127('0x7')]=FreshdeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshsalesAccount.js b/server/services/ami/model/freshsalesAccount.js index 9b18397..e2c412d 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 _0xbeff=['Configurations','exports','name','username','apiKey','remoteUri','serverUrl'];(function(_0x590f55,_0x314c3b){var _0x14142f=function(_0x543482){while(--_0x543482){_0x590f55['push'](_0x590f55['shift']());}};_0x14142f(++_0x314c3b);}(_0xbeff,0x8e));var _0xfbef=function(_0x3863d3,_0x1bd991){_0x3863d3=_0x3863d3-0x0;var _0x4861cb=_0xbeff[_0x3863d3];return _0x4861cb;};'use strict';function FreshsalesAccount(_0x4c3934){this['id']=_0x4c3934['id']||0x0;this[_0xfbef('0x0')]=_0x4c3934[_0xfbef('0x0')]||'';this[_0xfbef('0x1')]=_0x4c3934[_0xfbef('0x1')]||'';this[_0xfbef('0x2')]=_0x4c3934['token']||'';this['remoteUri']=_0x4c3934[_0xfbef('0x3')]||'';this[_0xfbef('0x4')]=_0x4c3934[_0xfbef('0x4')]||'';this[_0xfbef('0x5')]=_0x4c3934['Configurations']||{};}module[_0xfbef('0x6')]=FreshsalesAccount; \ No newline at end of file +var _0x6657=['apiKey','remoteUri','serverUrl','Configurations','exports','name','username'];(function(_0x29c2f7,_0x1ffb8b){var _0x3582e6=function(_0x4e91dc){while(--_0x4e91dc){_0x29c2f7['push'](_0x29c2f7['shift']());}};_0x3582e6(++_0x1ffb8b);}(_0x6657,0x17f));var _0x7665=function(_0x551e6b,_0x378961){_0x551e6b=_0x551e6b-0x0;var _0x5e35cb=_0x6657[_0x551e6b];return _0x5e35cb;};'use strict';function FreshsalesAccount(_0x7771c6){this['id']=_0x7771c6['id']||0x0;this['name']=_0x7771c6[_0x7665('0x0')]||'';this[_0x7665('0x1')]=_0x7771c6[_0x7665('0x1')]||'';this[_0x7665('0x2')]=_0x7771c6['token']||'';this[_0x7665('0x3')]=_0x7771c6[_0x7665('0x3')]||'';this[_0x7665('0x4')]=_0x7771c6[_0x7665('0x4')]||'';this[_0x7665('0x5')]=_0x7771c6[_0x7665('0x5')]||{};}module[_0x7665('0x6')]=FreshsalesAccount; \ No newline at end of file diff --git a/server/services/ami/model/queueReport.js b/server/services/ami/model/queueReport.js index a904168..5bfbcc3 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 _0xa4e2=['uniqueid','calleridnum','queue','queuecallerjoinAt','position','count','queuecallerabandon','queuecallerabandonAt','queuecallercomplete','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','connectedlinename','accountcode','context','priority','holdtime','assigned','motionChannel','voice','mohtime','variables','exports','type'];(function(_0x1ccdf7,_0x215d5a){var _0x52a0ae=function(_0x40324a){while(--_0x40324a){_0x1ccdf7['push'](_0x1ccdf7['shift']());}};_0x52a0ae(++_0x215d5a);}(_0xa4e2,0x107));var _0x2a4e=function(_0x1cd6c2,_0x5c1747){_0x1cd6c2=_0x1cd6c2-0x0;var _0x119f22=_0xa4e2[_0x1cd6c2];return _0x119f22;};'use strict';function QueueReport(){this[_0x2a4e('0x0')]='inbound';this[_0x2a4e('0x1')]='';this[_0x2a4e('0x2')]='';this['calleridname']='';this[_0x2a4e('0x3')]='';this[_0x2a4e('0x4')]=null;this['queuecallerleaveAt']=null;this[_0x2a4e('0x5')]=0x1;this[_0x2a4e('0x6')]=0x1;this[_0x2a4e('0x7')]=![];this[_0x2a4e('0x8')]=null;this[_0x2a4e('0x9')]=![];this[_0x2a4e('0xa')]=null;this[_0x2a4e('0xb')]=![];this[_0x2a4e('0xc')]=null;this['originalposition']=0x1;this['channel']='';this['connectedlinenum']='';this[_0x2a4e('0xd')]='';this[_0x2a4e('0xe')]='';this[_0x2a4e('0xf')]='';this['exten']='';this[_0x2a4e('0x10')]='';this[_0x2a4e('0x11')]=0x0;this[_0x2a4e('0x12')]=![];this['lastAssignedTo']='';this[_0x2a4e('0x13')]=_0x2a4e('0x14');this[_0x2a4e('0x15')]=0x0;this[_0x2a4e('0x16')]={};}module[_0x2a4e('0x17')]=QueueReport; \ No newline at end of file +var _0xfd87=['type','inbound','uniqueid','calleridname','queue','queuecallerjoinAt','position','count','queuecallerabandon','queuecallerabandonAt','queuecallercomplete','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','channel','connectedlinenum','accountcode','exten','priority','holdtime','assigned','lastAssignedTo','motionChannel','mohtime','exports'];(function(_0x3c7577,_0x46dcf5){var _0x35dde6=function(_0x4f6948){while(--_0x4f6948){_0x3c7577['push'](_0x3c7577['shift']());}};_0x35dde6(++_0x46dcf5);}(_0xfd87,0x1a9));var _0x7fd8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfd87[_0x3dd15e];return _0x231fd0;};'use strict';function QueueReport(){this[_0x7fd8('0x0')]=_0x7fd8('0x1');this[_0x7fd8('0x2')]='';this['calleridnum']='';this[_0x7fd8('0x3')]='';this[_0x7fd8('0x4')]='';this[_0x7fd8('0x5')]=null;this['queuecallerleaveAt']=null;this[_0x7fd8('0x6')]=0x1;this[_0x7fd8('0x7')]=0x1;this[_0x7fd8('0x8')]=![];this[_0x7fd8('0x9')]=null;this[_0x7fd8('0xa')]=![];this[_0x7fd8('0xb')]=null;this[_0x7fd8('0xc')]=![];this[_0x7fd8('0xd')]=null;this['originalposition']=0x1;this[_0x7fd8('0xe')]='';this[_0x7fd8('0xf')]='';this['connectedlinename']='';this[_0x7fd8('0x10')]='';this['context']='';this[_0x7fd8('0x11')]='';this[_0x7fd8('0x12')]='';this[_0x7fd8('0x13')]=0x0;this[_0x7fd8('0x14')]=![];this[_0x7fd8('0x15')]='';this[_0x7fd8('0x16')]='voice';this[_0x7fd8('0x17')]=0x0;this['variables']={};}module[_0x7fd8('0x18')]=QueueReport; \ No newline at end of file diff --git a/server/services/ami/model/salesforceAccount.js b/server/services/ami/model/salesforceAccount.js index 5eca0a6..e388ff2 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 _0x8291=['Configurations','exports','name','username','remoteUri','password','clientId','clientSecret','type','integrationTab','serverUrl'];(function(_0x416ad,_0x3797e5){var _0x160983=function(_0x1aa782){while(--_0x1aa782){_0x416ad['push'](_0x416ad['shift']());}};_0x160983(++_0x3797e5);}(_0x8291,0x1af));var _0x1829=function(_0x513194,_0x2f763b){_0x513194=_0x513194-0x0;var _0x33dffa=_0x8291[_0x513194];return _0x33dffa;};'use strict';function SalesforceAccount(_0x7c819e){this['id']=_0x7c819e['id']||0x0;this[_0x1829('0x0')]=_0x7c819e['name']||'';this['username']=_0x7c819e[_0x1829('0x1')]||'';this[_0x1829('0x2')]=_0x7c819e['remoteUri']||'';this['password']=_0x7c819e[_0x1829('0x3')]||'';this[_0x1829('0x4')]=_0x7c819e[_0x1829('0x4')]||'';this[_0x1829('0x5')]=_0x7c819e[_0x1829('0x5')]||'';this['securityToken']=_0x7c819e['securityToken']||'';this[_0x1829('0x6')]=_0x7c819e[_0x1829('0x6')]||_0x1829('0x7');this['serverUrl']=_0x7c819e[_0x1829('0x8')]||'';this[_0x1829('0x9')]=_0x7c819e['Configurations']||{};}module[_0x1829('0xa')]=SalesforceAccount; \ No newline at end of file +var _0x434a=['username','remoteUri','password','clientId','clientSecret','securityToken','type','Configurations','exports','name'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x434a,0x9f));var _0xa434=function(_0xc47dac,_0x45b2e2){_0xc47dac=_0xc47dac-0x0;var _0x598437=_0x434a[_0xc47dac];return _0x598437;};'use strict';function SalesforceAccount(_0x100f4a){this['id']=_0x100f4a['id']||0x0;this[_0xa434('0x0')]=_0x100f4a['name']||'';this[_0xa434('0x1')]=_0x100f4a['username']||'';this[_0xa434('0x2')]=_0x100f4a['remoteUri']||'';this[_0xa434('0x3')]=_0x100f4a[_0xa434('0x3')]||'';this[_0xa434('0x4')]=_0x100f4a['clientId']||'';this[_0xa434('0x5')]=_0x100f4a[_0xa434('0x5')]||'';this[_0xa434('0x6')]=_0x100f4a['securityToken']||'';this[_0xa434('0x7')]=_0x100f4a[_0xa434('0x7')]||'integrationTab';this['serverUrl']=_0x100f4a['serverUrl']||'';this[_0xa434('0x8')]=_0x100f4a[_0xa434('0x8')]||{};}module[_0xa434('0x9')]=SalesforceAccount; \ No newline at end of file diff --git a/server/services/ami/model/servicenowAccount.js b/server/services/ami/model/servicenowAccount.js index 30dc185..3f0b406 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 _0xb964=['remoteUri','Configurations','name','password'];(function(_0x17bb21,_0x369098){var _0x2956a6=function(_0x3e5ecf){while(--_0x3e5ecf){_0x17bb21['push'](_0x17bb21['shift']());}};_0x2956a6(++_0x369098);}(_0xb964,0x92));var _0x4b96=function(_0x5b419d,_0x5defda){_0x5b419d=_0x5b419d-0x0;var _0x46f451=_0xb964[_0x5b419d];return _0x46f451;};'use strict';function ServicenowAccount(_0x4223a3){this['id']=_0x4223a3['id']||0x0;this[_0x4b96('0x0')]=_0x4223a3[_0x4b96('0x0')]||'';this['username']=_0x4223a3['username']||'';this[_0x4b96('0x1')]=_0x4223a3[_0x4b96('0x1')]||'';this[_0x4b96('0x2')]=_0x4223a3[_0x4b96('0x2')]||'';this['serverUrl']=_0x4223a3['serverUrl']||'';this[_0x4b96('0x3')]=_0x4223a3[_0x4b96('0x3')]||{};}module['exports']=ServicenowAccount; \ No newline at end of file +var _0x90ec=['remoteUri','serverUrl','Configurations','exports','name','username','password'];(function(_0x58a4ac,_0x43fd42){var _0x545810=function(_0x308e65){while(--_0x308e65){_0x58a4ac['push'](_0x58a4ac['shift']());}};_0x545810(++_0x43fd42);}(_0x90ec,0xc8));var _0xc90e=function(_0x3b7c71,_0x173154){_0x3b7c71=_0x3b7c71-0x0;var _0x1f603a=_0x90ec[_0x3b7c71];return _0x1f603a;};'use strict';function ServicenowAccount(_0x2acf41){this['id']=_0x2acf41['id']||0x0;this['name']=_0x2acf41[_0xc90e('0x0')]||'';this[_0xc90e('0x1')]=_0x2acf41[_0xc90e('0x1')]||'';this[_0xc90e('0x2')]=_0x2acf41['password']||'';this['remoteUri']=_0x2acf41[_0xc90e('0x3')]||'';this[_0xc90e('0x4')]=_0x2acf41[_0xc90e('0x4')]||'';this[_0xc90e('0x5')]=_0x2acf41[_0xc90e('0x5')]||{};}module[_0xc90e('0x6')]=ServicenowAccount; \ No newline at end of file diff --git a/server/services/ami/model/sugarcrmAccount.js b/server/services/ami/model/sugarcrmAccount.js index 447e26a..155b074 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 _0x6293=['Configurations','exports','name','username','password','remoteUri','serverUrl'];(function(_0xa462ee,_0x40d37f){var _0x526b06=function(_0x24250a){while(--_0x24250a){_0xa462ee['push'](_0xa462ee['shift']());}};_0x526b06(++_0x40d37f);}(_0x6293,0x64));var _0x3629=function(_0x1c1259,_0x2db8ee){_0x1c1259=_0x1c1259-0x0;var _0x1dab5c=_0x6293[_0x1c1259];return _0x1dab5c;};'use strict';function SugarcrmAccount(_0x1ca9a2){this['id']=_0x1ca9a2['id']||0x0;this[_0x3629('0x0')]=_0x1ca9a2[_0x3629('0x0')]||'';this[_0x3629('0x1')]=_0x1ca9a2[_0x3629('0x1')]||'';this[_0x3629('0x2')]=_0x1ca9a2[_0x3629('0x2')]||'';this[_0x3629('0x3')]=_0x1ca9a2[_0x3629('0x3')]||'';this[_0x3629('0x4')]=_0x1ca9a2[_0x3629('0x4')]||'';this[_0x3629('0x5')]=_0x1ca9a2[_0x3629('0x5')]||{};}module[_0x3629('0x6')]=SugarcrmAccount; \ No newline at end of file +var _0x1af1=['username','password','remoteUri','serverUrl','Configurations','exports','name'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x1af1,0x1e9));var _0x11af=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1af1[_0x3dd15e];return _0x231fd0;};'use strict';function SugarcrmAccount(_0x398b53){this['id']=_0x398b53['id']||0x0;this[_0x11af('0x0')]=_0x398b53['name']||'';this['username']=_0x398b53[_0x11af('0x1')]||'';this[_0x11af('0x2')]=_0x398b53[_0x11af('0x2')]||'';this[_0x11af('0x3')]=_0x398b53[_0x11af('0x3')]||'';this[_0x11af('0x4')]=_0x398b53['serverUrl']||'';this[_0x11af('0x5')]=_0x398b53[_0x11af('0x5')]||{};}module[_0x11af('0x6')]=SugarcrmAccount; \ No newline at end of file diff --git a/server/services/ami/model/telephone.js b/server/services/ami/model/telephone.js index 631e269..918affd 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 _0xf3aa=['unknown','address','exports','name','accountcode','state','status'];(function(_0x514030,_0x45aa55){var _0x5aab41=function(_0x4c255d){while(--_0x4c255d){_0x514030['push'](_0x514030['shift']());}};_0x5aab41(++_0x45aa55);}(_0xf3aa,0xf1));var _0xaf3a=function(_0x28a8c2,_0x494d5){_0x28a8c2=_0x28a8c2-0x0;var _0x37ac3c=_0xf3aa[_0x28a8c2];return _0x37ac3c;};'use strict';function Telephone(_0x41feef){this['id']=_0x41feef['id']||0x0;this[_0xaf3a('0x0')]=_0x41feef[_0xaf3a('0x0')]||'';this[_0xaf3a('0x1')]=_0x41feef['accountcode']||'';this[_0xaf3a('0x2')]='unknown';this['stateTime']=0x0;this[_0xaf3a('0x3')]=_0xaf3a('0x4');this[_0xaf3a('0x5')]='';}module[_0xaf3a('0x6')]=Telephone; \ No newline at end of file +var _0x3eae=['unknown','stateTime','address','exports','name','accountcode','state'];(function(_0x513334,_0x5a4c25){var _0x781254=function(_0x64a826){while(--_0x64a826){_0x513334['push'](_0x513334['shift']());}};_0x781254(++_0x5a4c25);}(_0x3eae,0x66));var _0xe3ea=function(_0x24392f,_0x15a3e5){_0x24392f=_0x24392f-0x0;var _0x591e33=_0x3eae[_0x24392f];return _0x591e33;};'use strict';function Telephone(_0x14ad49){this['id']=_0x14ad49['id']||0x0;this['name']=_0x14ad49[_0xe3ea('0x0')]||'';this[_0xe3ea('0x1')]=_0x14ad49['accountcode']||'';this[_0xe3ea('0x2')]=_0xe3ea('0x3');this[_0xe3ea('0x4')]=0x0;this['status']='unknown';this[_0xe3ea('0x5')]='';}module[_0xe3ea('0x6')]=Telephone; \ No newline at end of file diff --git a/server/services/ami/model/template.js b/server/services/ami/model/template.js index 8cd8dcb..8a5cd63 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(_0x1a3e8f,_0x542bb8){var _0x32084b=function(_0xfc91d7){while(--_0xfc91d7){_0x1a3e8f['push'](_0x1a3e8f['shift']());}};_0x32084b(++_0x542bb8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0xa9e0[_0x297fd3];return _0x2af381;};'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(_0x33cdfe,_0x1da086){var _0x2d6ca4=function(_0x1f243a){while(--_0x1f243a){_0x33cdfe['push'](_0x33cdfe['shift']());}};_0x2d6ca4(++_0x1da086);}(_0xa9e0,0x123));var _0x0a9e=function(_0x38a7ac,_0x45514b){_0x38a7ac=_0x38a7ac-0x0;var _0x53061a=_0xa9e0[_0x38a7ac];return _0x53061a;};'use strict';function template(_0x1f0015){this['id']=_0x1f0015['id']||0x0;this[_0x0a9e('0x0')]=_0x1f0015[_0x0a9e('0x0')]||'';this['html']=_0x1f0015['html']||'';}module[_0x0a9e('0x1')]=template; \ No newline at end of file diff --git a/server/services/ami/model/trigger.js b/server/services/ami/model/trigger.js index 39a5be0..94fb6f4 100644 --- a/server/services/ami/model/trigger.js +++ b/server/services/ami/model/trigger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x757a=['name','status','AllConditions','AnyConditions','Actions','exports'];(function(_0x2a0f10,_0x505475){var _0x20befe=function(_0x10fd2f){while(--_0x10fd2f){_0x2a0f10['push'](_0x2a0f10['shift']());}};_0x20befe(++_0x505475);}(_0x757a,0xde));var _0xa757=function(_0x2c620e,_0x444aca){_0x2c620e=_0x2c620e-0x0;var _0x36f354=_0x757a[_0x2c620e];return _0x36f354;};'use strict';function Trigger(_0x1acf7d){this['id']=_0x1acf7d['id']||0x0;this[_0xa757('0x0')]=_0x1acf7d[_0xa757('0x0')]||'';this['channel']=_0x1acf7d['channel']||'voice';this[_0xa757('0x1')]=_0x1acf7d[_0xa757('0x1')]||![];this[_0xa757('0x2')]=_0x1acf7d[_0xa757('0x2')]||[];this[_0xa757('0x3')]=_0x1acf7d[_0xa757('0x3')]||[];this['Actions']=_0x1acf7d[_0xa757('0x4')]||[];}module[_0xa757('0x5')]=Trigger; \ No newline at end of file +var _0x757a=['name','status','AllConditions','AnyConditions','Actions','exports'];(function(_0xc9cda6,_0x18d645){var _0x32354b=function(_0x12fe63){while(--_0x12fe63){_0xc9cda6['push'](_0xc9cda6['shift']());}};_0x32354b(++_0x18d645);}(_0x757a,0xde));var _0xa757=function(_0x3524a4,_0x3c479a){_0x3524a4=_0x3524a4-0x0;var _0x16f2c7=_0x757a[_0x3524a4];return _0x16f2c7;};'use strict';function Trigger(_0x1acf7d){this['id']=_0x1acf7d['id']||0x0;this[_0xa757('0x0')]=_0x1acf7d[_0xa757('0x0')]||'';this['channel']=_0x1acf7d['channel']||'voice';this[_0xa757('0x1')]=_0x1acf7d[_0xa757('0x1')]||![];this[_0xa757('0x2')]=_0x1acf7d[_0xa757('0x2')]||[];this[_0xa757('0x3')]=_0x1acf7d[_0xa757('0x3')]||[];this['Actions']=_0x1acf7d[_0xa757('0x4')]||[];}module[_0xa757('0x5')]=Trigger; \ No newline at end of file diff --git a/server/services/ami/model/trunk.js b/server/services/ami/model/trunk.js index 2623c2b..d491b59 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 _0x44d4=['port','domain','domainport','refresh','stateRegistry','address','defaultuser','active','name','state','unknown','status','registry','indexOf','split'];(function(_0x52cd66,_0x37dfc3){var _0x26fc62=function(_0x110933){while(--_0x110933){_0x52cd66['push'](_0x52cd66['shift']());}};_0x26fc62(++_0x37dfc3);}(_0x44d4,0xf7));var _0x444d=function(_0x47feb6,_0x246208){_0x47feb6=_0x47feb6-0x0;var _0x4c9734=_0x44d4[_0x47feb6];return _0x4c9734;};'use strict';function Trunk(_0x489a0e){this['id']=_0x489a0e['id']||0x0;this[_0x444d('0x0')]=_0x489a0e[_0x444d('0x0')]||![];this[_0x444d('0x1')]=_0x489a0e[_0x444d('0x1')]||'';this[_0x444d('0x2')]=_0x444d('0x3');this['stateTime']=0x0;this[_0x444d('0x4')]=_0x444d('0x3');this[_0x444d('0x5')]=_0x489a0e['registry']&&_0x489a0e[_0x444d('0x5')][_0x444d('0x6')](':')?_0x489a0e[_0x444d('0x5')][_0x444d('0x7')](':')[0x0]:'';this['host']='';this[_0x444d('0x8')]='';this[_0x444d('0x9')]='';this[_0x444d('0xa')]='';this[_0x444d('0xb')]='';this[_0x444d('0xc')]=_0x444d('0x3');this['registrationtime']='';this[_0x444d('0xd')]='';this[_0x444d('0xe')]=_0x489a0e[_0x444d('0xe')]||'';}module['exports']=Trunk; \ No newline at end of file +var _0xa110=['refresh','stateRegistry','address','defaultuser','active','name','state','unknown','stateTime','registry','indexOf','split','host','port','domain','domainport'];(function(_0x3f2154,_0x1affbb){var _0x3ff02b=function(_0x3ccdc5){while(--_0x3ccdc5){_0x3f2154['push'](_0x3f2154['shift']());}};_0x3ff02b(++_0x1affbb);}(_0xa110,0x64));var _0x0a11=function(_0x309571,_0x1264e0){_0x309571=_0x309571-0x0;var _0x42d4c9=_0xa110[_0x309571];return _0x42d4c9;};'use strict';function Trunk(_0x489c85){this['id']=_0x489c85['id']||0x0;this['active']=_0x489c85[_0x0a11('0x0')]||![];this[_0x0a11('0x1')]=_0x489c85[_0x0a11('0x1')]||'';this[_0x0a11('0x2')]=_0x0a11('0x3');this[_0x0a11('0x4')]=0x0;this['status']=_0x0a11('0x3');this[_0x0a11('0x5')]=_0x489c85['registry']&&_0x489c85['registry'][_0x0a11('0x6')](':')?_0x489c85[_0x0a11('0x5')][_0x0a11('0x7')](':')[0x0]:'';this[_0x0a11('0x8')]='';this[_0x0a11('0x9')]='';this[_0x0a11('0xa')]='';this[_0x0a11('0xb')]='';this[_0x0a11('0xc')]='';this[_0x0a11('0xd')]=_0x0a11('0x3');this['registrationtime']='';this[_0x0a11('0xe')]='';this['defaultuser']=_0x489c85[_0x0a11('0xf')]||'';}module['exports']=Trunk; \ No newline at end of file diff --git a/server/services/ami/model/voiceExtension.js b/server/services/ami/model/voiceExtension.js index c5142d7..c6c2681 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 _0x940c=['exports','recordingFormat','none','mandatoryDisposition'];(function(_0x1f9570,_0x37296f){var _0x196714=function(_0x163177){while(--_0x163177){_0x1f9570['push'](_0x1f9570['shift']());}};_0x196714(++_0x37296f);}(_0x940c,0x189));var _0xc940=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x940c[_0x3dd15e];return _0x231fd0;};'use strict';function voiceExtension(_0x6f1df2){this['id']=_0x6f1df2['id']||0x0;this['exten']=_0x6f1df2['exten']||'';this[_0xc940('0x0')]=_0x6f1df2[_0xc940('0x0')]||_0xc940('0x1');this[_0xc940('0x2')]=_0x6f1df2['mandatoryDisposition']||![];}module[_0xc940('0x3')]=voiceExtension; \ No newline at end of file +var _0x35ff=['recordingFormat','mandatoryDisposition','exten'];(function(_0x21c269,_0x1947a8){var _0x53b1ec=function(_0x30c7a5){while(--_0x30c7a5){_0x21c269['push'](_0x21c269['shift']());}};_0x53b1ec(++_0x1947a8);}(_0x35ff,0x8c));var _0xf35f=function(_0x197d26,_0x5e2760){_0x197d26=_0x197d26-0x0;var _0x3f30bf=_0x35ff[_0x197d26];return _0x3f30bf;};'use strict';function voiceExtension(_0x568d3d){this['id']=_0x568d3d['id']||0x0;this['exten']=_0x568d3d[_0xf35f('0x0')]||'';this[_0xf35f('0x1')]=_0x568d3d[_0xf35f('0x1')]||'none';this[_0xf35f('0x2')]=_0x568d3d['mandatoryDisposition']||![];}module['exports']=voiceExtension; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueue.js b/server/services/ami/model/voiceQueue.js index ad54eed..325e640 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 _0x2fcb=['DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','pTalking','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundReCallsDay','outboundAbandonedDay','startPredictive','handlePredictive','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangAbandonmentRate','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialQueueProject2','dialAgiAfterHangupAgent','mandatoryDispositionPause','exports','inuse','unavailable','ringing','onhold','wav49','gsm','rrmemory','roundrobin','name','monitor_format','type','inbound','waiting','talking','total','answered','sumDuration','abandoned','available','acw','acwTimeout','autopause','sendMessageOneNotActive','originated','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2fcb,0x98));var _0xb2fc=function(_0x20564a,_0x2812fe){_0x20564a=_0x20564a-0x0;var _0x9dad98=_0x2fcb[_0x20564a];return _0x9dad98;};'use strict';var statusDesc=['unknown','not_inuse',_0xb2fc('0x0'),'busy','invalid',_0xb2fc('0x1'),_0xb2fc('0x2'),'ringinuse',_0xb2fc('0x3')];var monitorFormat={'wav':'wav','wav49':_0xb2fc('0x4'),'gsm':_0xb2fc('0x5')};var strategy={'rrmemory':_0xb2fc('0x6'),'roundrobin':_0xb2fc('0x7')};function VoiceQueue(_0x36e952){this['id']=_0x36e952['id']||0x0;this[_0xb2fc('0x8')]=_0x36e952[_0xb2fc('0x8')]||'';this[_0xb2fc('0x9')]=_0x36e952[_0xb2fc('0x9')]||'';this[_0xb2fc('0xa')]=_0x36e952[_0xb2fc('0xa')]||_0xb2fc('0xb');this[_0xb2fc('0xc')]=0x0;this[_0xb2fc('0xd')]=0x0;this[_0xb2fc('0xe')]=0x0;this[_0xb2fc('0xf')]=0x0;this[_0xb2fc('0x10')]=0x0;this['sumHoldTime']=0x0;this['sumBillable']=0x0;this['unmanaged']=0x0;this[_0xb2fc('0x11')]=0x0;this['loggedIn']=0x0;this[_0xb2fc('0x12')]=0x0;this[_0xb2fc('0x13')]=_0x36e952[_0xb2fc('0x13')]||![];this[_0xb2fc('0x14')]=_0x36e952['acwTimeout']||0xa;this[_0xb2fc('0x15')]=_0x36e952[_0xb2fc('0x15')]||'no';this[_0xb2fc('0x16')]=!![];this['message']='';this[_0xb2fc('0x17')]=0x0;this[_0xb2fc('0x18')]=0x0;this[_0xb2fc('0x19')]=_0x36e952[_0xb2fc('0x19')]||null;this[_0xb2fc('0x1a')]=_0x36e952[_0xb2fc('0x1a')]?_0x36e952[_0xb2fc('0x1a')]:null;this[_0xb2fc('0x1b')]=_0x36e952[_0xb2fc('0x1b')];this[_0xb2fc('0x1c')]=_0x36e952['dialMethod']||_0xb2fc('0x1d');this[_0xb2fc('0x1e')]=_0x36e952[_0xb2fc('0x1e')]||0x0;this['dialLimitQueue']=_0x36e952['dialLimitQueue']||0x0;this[_0xb2fc('0x1f')]=_0x36e952[_0xb2fc('0x1f')]||0x1;this[_0xb2fc('0x20')]=_0x36e952[_0xb2fc('0x20')]||_0xb2fc('0x21');this[_0xb2fc('0x22')]=_0x36e952[_0xb2fc('0x22')]||0.03;this['dialPredictiveInterval']=_0x36e952[_0xb2fc('0x23')]||0x258;this['dialOriginateCallerIdName']=_0x36e952['dialOriginateCallerIdName']||_0xb2fc('0x24');this['dialOriginateCallerIdNumber']=_0x36e952[_0xb2fc('0x25')]||'anonymous';this[_0xb2fc('0x26')]=_0x36e952[_0xb2fc('0x26')]||0x1e;this[_0xb2fc('0x27')]=_0x36e952['dialQueueOptions']||_0xb2fc('0x28');this[_0xb2fc('0x29')]=_0x36e952[_0xb2fc('0x29')]||0x3;this[_0xb2fc('0x2a')]=_0x36e952['dialQueueProject']||undefined;this[_0xb2fc('0x2b')]=_0x36e952[_0xb2fc('0x2b')]||0x3;this[_0xb2fc('0x2c')]=_0x36e952[_0xb2fc('0x2c')]||0x96;this[_0xb2fc('0x2d')]=_0x36e952[_0xb2fc('0x2d')]||0x3;this[_0xb2fc('0x2e')]=_0x36e952['dialBusyRetryFrequency']||0x96;this['dialNoAnswerMaxRetry']=_0x36e952['dialNoAnswerMaxRetry']||0x3;this['dialNoAnswerRetryFrequency']=_0x36e952['dialNoAnswerRetryFrequency']||0x96;this[_0xb2fc('0x2f')]=_0x36e952['dialNoSuchNumberMaxRetry']||0x3;this[_0xb2fc('0x30')]=_0x36e952[_0xb2fc('0x30')]||0x96;this[_0xb2fc('0x31')]=_0x36e952[_0xb2fc('0x31')]||0x3;this['dialDropRetryFrequency']=_0x36e952['dialDropRetryFrequency']||0x96;this[_0xb2fc('0x32')]=_0x36e952['dialAbandonedMaxRetry']||0x3;this['dialAbandonedRetryFrequency']=_0x36e952[_0xb2fc('0x33')]||0x96;this[_0xb2fc('0x34')]=_0x36e952[_0xb2fc('0x34')]||0x3;this[_0xb2fc('0x35')]=_0x36e952[_0xb2fc('0x35')]||0x96;this[_0xb2fc('0x36')]=_0x36e952[_0xb2fc('0x36')]||0x3;this[_0xb2fc('0x37')]=_0x36e952['dialAgentRejectRetryFrequency']||0x96;this[_0xb2fc('0x38')]=_0x36e952[_0xb2fc('0x38')]||0x4;this['Trunk']=_0x36e952[_0xb2fc('0x39')]?_0x36e952[_0xb2fc('0x39')]:undefined;this[_0xb2fc('0x3a')]=_0x36e952['TrunkBackup']?_0x36e952['TrunkBackup']:undefined;this[_0xb2fc('0x3b')]=_0x36e952[_0xb2fc('0x3b')]||undefined;this['Interval']=_0x36e952[_0xb2fc('0x3c')]?_0x36e952[_0xb2fc('0x3c')]:undefined;this['dialOrderByScheduledAt']=_0x36e952[_0xb2fc('0x3d')]||_0xb2fc('0x3e');this[_0xb2fc('0x3f')]=_0x36e952['dialRandomLastDigitCallerIdNumber']||undefined;this[_0xb2fc('0x40')]=_0x36e952[_0xb2fc('0x40')]||undefined;this['strategy']=strategy[_0x36e952[_0xb2fc('0x41')]]||_0xb2fc('0x6');this['queueStatusComplete']=!![];this[_0xb2fc('0x42')]=_0x36e952[_0xb2fc('0x42')]||![];this[_0xb2fc('0x43')]=_0x36e952[_0xb2fc('0x43')];this['dialAMDGreeting']=_0x36e952[_0xb2fc('0x44')];this[_0xb2fc('0x45')]=_0x36e952[_0xb2fc('0x45')];this[_0xb2fc('0x46')]=_0x36e952[_0xb2fc('0x46')];this[_0xb2fc('0x47')]=_0x36e952['dialAMDMinWordLength'];this[_0xb2fc('0x48')]=_0x36e952[_0xb2fc('0x48')];this[_0xb2fc('0x49')]=_0x36e952[_0xb2fc('0x49')];this[_0xb2fc('0x4a')]=_0x36e952[_0xb2fc('0x4a')];this[_0xb2fc('0x4b')]=_0x36e952[_0xb2fc('0x4b')];this[_0xb2fc('0x4c')]=0x0;this[_0xb2fc('0x4d')]=0x0;this[_0xb2fc('0x4e')]=_0x36e952['timeout'];this[_0xb2fc('0x4f')]=0x0;this[_0xb2fc('0x50')]=0x0;this['outboundNoAnswerCallsDay']=0x0;this['outboundBusyCallsDay']=0x0;this[_0xb2fc('0x51')]=0x0;this[_0xb2fc('0x52')]=0x0;this[_0xb2fc('0x53')]=0x0;this[_0xb2fc('0x54')]=0x0;this['outboundOriginateFailureCallsDay']=0x0;this[_0xb2fc('0x55')]=0x0;this[_0xb2fc('0x56')]=0x0;this['outboundDropCallsDayACS']=0x0;this[_0xb2fc('0x57')]=0x0;this[_0xb2fc('0x58')]=0x0;this['startProgressive']=undefined;this[_0xb2fc('0x59')]=undefined;this[_0xb2fc('0x5a')]=undefined;this['predictiveIntervalMultiplicativeFactor']=1.05;this['predictiveIntervalTotalCalls']=0x0;this['predictiveIntervalAnsweredCalls']=0x0;this[_0xb2fc('0x5b')]=0x0;this[_0xb2fc('0x5c')]=0x0;this[_0xb2fc('0x5d')]=0x0;this[_0xb2fc('0x5e')]=0x0;this['predictiveIntervalPauses']=0x0;this['predictiveIntervalAvailable']=0x0;this[_0xb2fc('0x5f')]=_0x36e952['dialPredictiveIntervalMaxThreshold']||0x14;this['predictiveIntervalMinThreshold']=_0x36e952[_0xb2fc('0x60')]||0xa;this['predictiveIntervalErlangCalls']=0x0;this[_0xb2fc('0x61')]=0x0;this[_0xb2fc('0x62')]=0x1;this['erlangCalls']=0x0;this['erlangCallToSecond']=0x0;this[_0xb2fc('0x63')]=0x0;this[_0xb2fc('0x64')]=0x0;this[_0xb2fc('0x65')]=_0x36e952[_0xb2fc('0x65')]||0x1e;this[_0xb2fc('0x66')]=_0x36e952[_0xb2fc('0x66')]||![];this[_0xb2fc('0x67')]=_0x36e952[_0xb2fc('0x67')]||undefined;this['dialAgiAfterHangupClient']=_0x36e952['dialAgiAfterHangupClient']||![];this[_0xb2fc('0x68')]=_0x36e952[_0xb2fc('0x68')]||![];this[_0xb2fc('0x9')]=monitorFormat[_0x36e952[_0xb2fc('0x9')]]?monitorFormat[_0x36e952[_0xb2fc('0x9')]]:undefined;this['mandatoryDisposition']=_0x36e952['mandatoryDisposition']||![];this[_0xb2fc('0x69')]=_0x36e952[_0xb2fc('0x69')]?_0x36e952['mandatoryDispositionPause']:undefined;}module[_0xb2fc('0x6a')]=VoiceQueue; \ No newline at end of file +var _0x49f5=['message','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdNumber','anonymous','dialOriginateTimeout','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','pTalking','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundReCallsDay','outboundAbandonedDay','startProgressive','startPredictive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalAvailable','dialPredictiveIntervalMaxThreshold','predictiveIntervalErlangCalls','erlangCalls','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','exports','not_inuse','busy','unavailable','ringing','ringinuse','onhold','wav','wav49','rrmemory','name','monitor_format','type','inbound','waiting','talking','total','answered','sumDuration','sumHoldTime','sumBillable','unmanaged','abandoned','loggedIn','available','acw','acwTimeout','autopause','sendMessageOneNotActive'];(function(_0x1e54da,_0x52a355){var _0x284966=function(_0x55d6cb){while(--_0x55d6cb){_0x1e54da['push'](_0x1e54da['shift']());}};_0x284966(++_0x52a355);}(_0x49f5,0xd0));var _0x549f=function(_0x3ac563,_0x53621e){_0x3ac563=_0x3ac563-0x0;var _0x3e855f=_0x49f5[_0x3ac563];return _0x3e855f;};'use strict';var statusDesc=['unknown',_0x549f('0x0'),'inuse',_0x549f('0x1'),'invalid',_0x549f('0x2'),_0x549f('0x3'),_0x549f('0x4'),_0x549f('0x5')];var monitorFormat={'wav':_0x549f('0x6'),'wav49':_0x549f('0x7'),'gsm':'gsm'};var strategy={'rrmemory':_0x549f('0x8'),'roundrobin':'roundrobin'};function VoiceQueue(_0x1e3d1b){this['id']=_0x1e3d1b['id']||0x0;this[_0x549f('0x9')]=_0x1e3d1b[_0x549f('0x9')]||'';this[_0x549f('0xa')]=_0x1e3d1b[_0x549f('0xa')]||'';this['type']=_0x1e3d1b[_0x549f('0xb')]||_0x549f('0xc');this[_0x549f('0xd')]=0x0;this[_0x549f('0xe')]=0x0;this[_0x549f('0xf')]=0x0;this[_0x549f('0x10')]=0x0;this[_0x549f('0x11')]=0x0;this[_0x549f('0x12')]=0x0;this[_0x549f('0x13')]=0x0;this[_0x549f('0x14')]=0x0;this[_0x549f('0x15')]=0x0;this[_0x549f('0x16')]=0x0;this[_0x549f('0x17')]=0x0;this[_0x549f('0x18')]=_0x1e3d1b[_0x549f('0x18')]||![];this['acwTimeout']=_0x1e3d1b[_0x549f('0x19')]||0xa;this[_0x549f('0x1a')]=_0x1e3d1b[_0x549f('0x1a')]||'no';this[_0x549f('0x1b')]=!![];this[_0x549f('0x1c')]='';this['originated']=0x0;this[_0x549f('0x1d')]=0x0;this[_0x549f('0x1e')]=_0x1e3d1b[_0x549f('0x1e')]||null;this[_0x549f('0x1f')]=_0x1e3d1b[_0x549f('0x1f')]?_0x1e3d1b[_0x549f('0x1f')]:null;this[_0x549f('0x20')]=_0x1e3d1b[_0x549f('0x20')];this[_0x549f('0x21')]=_0x1e3d1b[_0x549f('0x21')]||_0x549f('0x22');this['dialLimitChannel']=_0x1e3d1b[_0x549f('0x23')]||0x0;this[_0x549f('0x24')]=_0x1e3d1b[_0x549f('0x24')]||0x0;this['dialPowerLevel']=_0x1e3d1b[_0x549f('0x25')]||0x1;this['dialPredictiveOptimization']=_0x1e3d1b[_0x549f('0x26')]||_0x549f('0x27');this[_0x549f('0x28')]=_0x1e3d1b['dialPredictiveOptimizationPercentage']||0.03;this[_0x549f('0x29')]=_0x1e3d1b[_0x549f('0x29')]||0x258;this['dialOriginateCallerIdName']=_0x1e3d1b['dialOriginateCallerIdName']||'anonymous';this[_0x549f('0x2a')]=_0x1e3d1b['dialOriginateCallerIdNumber']||_0x549f('0x2b');this[_0x549f('0x2c')]=_0x1e3d1b[_0x549f('0x2c')]||0x1e;this['dialQueueOptions']=_0x1e3d1b['dialQueueOptions']||_0x549f('0x2d');this[_0x549f('0x2e')]=_0x1e3d1b['dialQueueTimeout']||0x3;this[_0x549f('0x2f')]=_0x1e3d1b['dialQueueProject']||undefined;this['dialCongestionMaxRetry']=_0x1e3d1b[_0x549f('0x30')]||0x3;this['dialCongestionRetryFrequency']=_0x1e3d1b[_0x549f('0x31')]||0x96;this[_0x549f('0x32')]=_0x1e3d1b[_0x549f('0x32')]||0x3;this[_0x549f('0x33')]=_0x1e3d1b[_0x549f('0x33')]||0x96;this[_0x549f('0x34')]=_0x1e3d1b[_0x549f('0x34')]||0x3;this[_0x549f('0x35')]=_0x1e3d1b['dialNoAnswerRetryFrequency']||0x96;this[_0x549f('0x36')]=_0x1e3d1b[_0x549f('0x36')]||0x3;this['dialNoSuchNumberRetryFrequency']=_0x1e3d1b[_0x549f('0x37')]||0x96;this['dialDropMaxRetry']=_0x1e3d1b['dialDropMaxRetry']||0x3;this[_0x549f('0x38')]=_0x1e3d1b[_0x549f('0x38')]||0x96;this[_0x549f('0x39')]=_0x1e3d1b[_0x549f('0x39')]||0x3;this[_0x549f('0x3a')]=_0x1e3d1b[_0x549f('0x3a')]||0x96;this[_0x549f('0x3b')]=_0x1e3d1b[_0x549f('0x3b')]||0x3;this[_0x549f('0x3c')]=_0x1e3d1b[_0x549f('0x3c')]||0x96;this['dialAgentRejectMaxRetry']=_0x1e3d1b[_0x549f('0x3d')]||0x3;this[_0x549f('0x3e')]=_0x1e3d1b[_0x549f('0x3e')]||0x96;this[_0x549f('0x3f')]=_0x1e3d1b[_0x549f('0x3f')]||0x4;this[_0x549f('0x40')]=_0x1e3d1b['Trunk']?_0x1e3d1b[_0x549f('0x40')]:undefined;this[_0x549f('0x41')]=_0x1e3d1b['TrunkBackup']?_0x1e3d1b[_0x549f('0x41')]:undefined;this['dialPrefix']=_0x1e3d1b[_0x549f('0x42')]||undefined;this[_0x549f('0x43')]=_0x1e3d1b[_0x549f('0x43')]?_0x1e3d1b[_0x549f('0x43')]:undefined;this[_0x549f('0x44')]=_0x1e3d1b[_0x549f('0x44')]||_0x549f('0x45');this[_0x549f('0x46')]=_0x1e3d1b[_0x549f('0x46')]||undefined;this[_0x549f('0x47')]=_0x1e3d1b[_0x549f('0x47')]||undefined;this['strategy']=strategy[_0x1e3d1b[_0x549f('0x48')]]||'rrmemory';this[_0x549f('0x49')]=!![];this[_0x549f('0x4a')]=_0x1e3d1b['dialAMDActive']||![];this[_0x549f('0x4b')]=_0x1e3d1b['dialAMDInitialSilence'];this[_0x549f('0x4c')]=_0x1e3d1b['dialAMDGreeting'];this[_0x549f('0x4d')]=_0x1e3d1b[_0x549f('0x4d')];this[_0x549f('0x4e')]=_0x1e3d1b['dialAMDTotalAnalysisTime'];this[_0x549f('0x4f')]=_0x1e3d1b[_0x549f('0x4f')];this[_0x549f('0x50')]=_0x1e3d1b[_0x549f('0x50')];this[_0x549f('0x51')]=_0x1e3d1b[_0x549f('0x51')];this[_0x549f('0x52')]=_0x1e3d1b['dialAMDSilenceThreshold'];this[_0x549f('0x53')]=_0x1e3d1b[_0x549f('0x53')];this[_0x549f('0x54')]=0x0;this[_0x549f('0x55')]=0x0;this['timeout']=_0x1e3d1b[_0x549f('0x56')];this[_0x549f('0x57')]=0x0;this[_0x549f('0x58')]=0x0;this[_0x549f('0x59')]=0x0;this['outboundBusyCallsDay']=0x0;this[_0x549f('0x5a')]=0x0;this[_0x549f('0x5b')]=0x0;this['outboundUnknownCallsDay']=0x0;this['outboundBlacklistCallsDay']=0x0;this[_0x549f('0x5c')]=0x0;this[_0x549f('0x5d')]=0x0;this[_0x549f('0x5e')]=0x0;this['outboundDropCallsDayACS']=0x0;this[_0x549f('0x5f')]=0x0;this[_0x549f('0x60')]=0x0;this[_0x549f('0x61')]=undefined;this[_0x549f('0x62')]=undefined;this[_0x549f('0x63')]=undefined;this[_0x549f('0x64')]=1.05;this['predictiveIntervalTotalCalls']=0x0;this[_0x549f('0x65')]=0x0;this['predictiveIntervalDroppedCallsCallersExit']=0x0;this[_0x549f('0x66')]=0x0;this['predictiveIntervalAvgHoldtime']=0x0;this[_0x549f('0x67')]=0x0;this[_0x549f('0x68')]=0x0;this[_0x549f('0x69')]=0x0;this['predictiveIntervalMaxThreshold']=_0x1e3d1b[_0x549f('0x6a')]||0x14;this['predictiveIntervalMinThreshold']=_0x1e3d1b['dialPredictiveIntervalMaxThreshold']||0xa;this[_0x549f('0x6b')]=0x0;this['predictiveIntervalErlangCallsDroppedCalls']=0x0;this['predictiveIntervalHitRate']=0x1;this[_0x549f('0x6c')]=0x0;this['erlangCallToSecond']=0x0;this['erlangAbandonmentRate']=0x0;this[_0x549f('0x6d')]=0x0;this[_0x549f('0x6e')]=_0x1e3d1b['dialRecallMeTimeout']||0x1e;this[_0x549f('0x6f')]=_0x1e3d1b['dialRecallInQueue']||![];this[_0x549f('0x70')]=_0x1e3d1b['dialQueueProject2']||undefined;this[_0x549f('0x71')]=_0x1e3d1b['dialAgiAfterHangupClient']||![];this[_0x549f('0x72')]=_0x1e3d1b['dialAgiAfterHangupAgent']||![];this[_0x549f('0xa')]=monitorFormat[_0x1e3d1b[_0x549f('0xa')]]?monitorFormat[_0x1e3d1b['monitor_format']]:undefined;this[_0x549f('0x73')]=_0x1e3d1b[_0x549f('0x73')]||![];this[_0x549f('0x74')]=_0x1e3d1b[_0x549f('0x74')]?_0x1e3d1b['mandatoryDispositionPause']:undefined;}module[_0x549f('0x75')]=VoiceQueue; \ No newline at end of file diff --git a/server/services/ami/model/vtigerAccount.js b/server/services/ami/model/vtigerAccount.js index ce56c15..31530a3 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 _0xc769=['accessKey','remoteUri','serverUrl','Configurations','exports','name','username'];(function(_0x49ca18,_0x5e6d05){var _0x145d54=function(_0x30b9be){while(--_0x30b9be){_0x49ca18['push'](_0x49ca18['shift']());}};_0x145d54(++_0x5e6d05);}(_0xc769,0x1ef));var _0x9c76=function(_0x52909f,_0x74cfdd){_0x52909f=_0x52909f-0x0;var _0x555148=_0xc769[_0x52909f];return _0x555148;};'use strict';function VtigerAccount(_0x40622){this['id']=_0x40622['id']||0x0;this[_0x9c76('0x0')]=_0x40622[_0x9c76('0x0')]||'';this[_0x9c76('0x1')]=_0x40622[_0x9c76('0x1')]||'';this[_0x9c76('0x2')]=_0x40622['accessKey']||'';this[_0x9c76('0x3')]=_0x40622[_0x9c76('0x3')]||'';this[_0x9c76('0x4')]=_0x40622[_0x9c76('0x4')]||'';this['Configurations']=_0x40622[_0x9c76('0x5')]||{};}module[_0x9c76('0x6')]=VtigerAccount; \ No newline at end of file +var _0x7cef=['remoteUri','serverUrl','Configurations','exports','name','username','accessKey'];(function(_0x56dda5,_0x40d426){var _0x12574f=function(_0x27934c){while(--_0x27934c){_0x56dda5['push'](_0x56dda5['shift']());}};_0x12574f(++_0x40d426);}(_0x7cef,0xe4));var _0xf7ce=function(_0x9d781e,_0x19598a){_0x9d781e=_0x9d781e-0x0;var _0x1011d3=_0x7cef[_0x9d781e];return _0x1011d3;};'use strict';function VtigerAccount(_0xdcbf20){this['id']=_0xdcbf20['id']||0x0;this[_0xf7ce('0x0')]=_0xdcbf20['name']||'';this[_0xf7ce('0x1')]=_0xdcbf20[_0xf7ce('0x1')]||'';this['accessKey']=_0xdcbf20[_0xf7ce('0x2')]||'';this[_0xf7ce('0x3')]=_0xdcbf20[_0xf7ce('0x3')]||'';this[_0xf7ce('0x4')]=_0xdcbf20[_0xf7ce('0x4')]||'';this[_0xf7ce('0x5')]=_0xdcbf20[_0xf7ce('0x5')]||{};}module[_0xf7ce('0x6')]=VtigerAccount; \ No newline at end of file diff --git a/server/services/ami/model/zendeskAccount.js b/server/services/ami/model/zendeskAccount.js index 8b206c2..add9837 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 _0xaa87=['password','token','remoteUri','authType','type','integrationTab','serverUrl','Configurations','exports','name','username'];(function(_0x500419,_0x549162){var _0x241c1a=function(_0x3bea1a){while(--_0x3bea1a){_0x500419['push'](_0x500419['shift']());}};_0x241c1a(++_0x549162);}(_0xaa87,0xb9));var _0x7aa8=function(_0x2dadb9,_0x42cfe6){_0x2dadb9=_0x2dadb9-0x0;var _0x2f0097=_0xaa87[_0x2dadb9];return _0x2f0097;};'use strict';function ZendeskAccount(_0x251a7e){this['id']=_0x251a7e['id']||0x0;this[_0x7aa8('0x0')]=_0x251a7e[_0x7aa8('0x0')]||'';this['username']=_0x251a7e[_0x7aa8('0x1')]||'';this[_0x7aa8('0x2')]=_0x251a7e['password']||'';this[_0x7aa8('0x3')]=_0x251a7e[_0x7aa8('0x3')]||'';this[_0x7aa8('0x4')]=_0x251a7e[_0x7aa8('0x4')]||'';this[_0x7aa8('0x5')]=_0x251a7e[_0x7aa8('0x5')]||'';this[_0x7aa8('0x6')]=_0x251a7e[_0x7aa8('0x6')]||_0x7aa8('0x7');this['serverUrl']=_0x251a7e[_0x7aa8('0x8')]||'';this[_0x7aa8('0x9')]=_0x251a7e[_0x7aa8('0x9')]||{};}module[_0x7aa8('0xa')]=ZendeskAccount; \ No newline at end of file +var _0xf309=['exports','name','username','password','token','remoteUri','authType','type','serverUrl','Configurations'];(function(_0x1bc150,_0x2d1bfd){var _0x234d69=function(_0x12e003){while(--_0x12e003){_0x1bc150['push'](_0x1bc150['shift']());}};_0x234d69(++_0x2d1bfd);}(_0xf309,0x1d7));var _0x9f30=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xf309[_0x432682];return _0x463d05;};'use strict';function ZendeskAccount(_0x5b7864){this['id']=_0x5b7864['id']||0x0;this['name']=_0x5b7864[_0x9f30('0x0')]||'';this[_0x9f30('0x1')]=_0x5b7864[_0x9f30('0x1')]||'';this[_0x9f30('0x2')]=_0x5b7864['password']||'';this[_0x9f30('0x3')]=_0x5b7864[_0x9f30('0x3')]||'';this[_0x9f30('0x4')]=_0x5b7864['remoteUri']||'';this[_0x9f30('0x5')]=_0x5b7864[_0x9f30('0x5')]||'';this[_0x9f30('0x6')]=_0x5b7864[_0x9f30('0x6')]||'integrationTab';this[_0x9f30('0x7')]=_0x5b7864[_0x9f30('0x7')]||'';this[_0x9f30('0x8')]=_0x5b7864[_0x9f30('0x8')]||{};}module[_0x9f30('0x9')]=ZendeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/zohoAccount.js b/server/services/ami/model/zohoAccount.js index 594304b..bf1018f 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 _0xc7a4=['clientSecret','serverUrl','code','refreshToken','Configurations','exports','name','description','host','zone','clientId'];(function(_0x2f04d5,_0x5ea168){var _0x484590=function(_0x4640e7){while(--_0x4640e7){_0x2f04d5['push'](_0x2f04d5['shift']());}};_0x484590(++_0x5ea168);}(_0xc7a4,0xa0));var _0x4c7a=function(_0x3af967,_0x9e4b6d){_0x3af967=_0x3af967-0x0;var _0x5c105a=_0xc7a4[_0x3af967];return _0x5c105a;};'use strict';function ZohoAccount(_0x54de4f){this['id']=_0x54de4f['id']||0x0;this[_0x4c7a('0x0')]=_0x54de4f[_0x4c7a('0x0')]||'';this['description']=_0x54de4f[_0x4c7a('0x1')]||'';this[_0x4c7a('0x2')]=_0x54de4f[_0x4c7a('0x2')]||'';this[_0x4c7a('0x3')]=_0x54de4f[_0x4c7a('0x3')]||'';this['clientId']=_0x54de4f[_0x4c7a('0x4')]||'';this[_0x4c7a('0x5')]=_0x54de4f[_0x4c7a('0x5')]||'';this[_0x4c7a('0x6')]=_0x54de4f[_0x4c7a('0x6')]||'';this[_0x4c7a('0x7')]=_0x54de4f[_0x4c7a('0x7')]||'';this[_0x4c7a('0x8')]=_0x54de4f[_0x4c7a('0x8')]||'';this[_0x4c7a('0x9')]=_0x54de4f[_0x4c7a('0x9')]||{};}module[_0x4c7a('0xa')]=ZohoAccount; \ No newline at end of file +var _0xb6ea=['Configurations','exports','name','description','host','zone','clientId','clientSecret','serverUrl','code','refreshToken'];(function(_0x2070da,_0x45e586){var _0x4f9fe1=function(_0x5b6f2a){while(--_0x5b6f2a){_0x2070da['push'](_0x2070da['shift']());}};_0x4f9fe1(++_0x45e586);}(_0xb6ea,0x10a));var _0xab6e=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0xb6ea[_0x4b369d];return _0x571a98;};'use strict';function ZohoAccount(_0x3627fd){this['id']=_0x3627fd['id']||0x0;this[_0xab6e('0x0')]=_0x3627fd['name']||'';this[_0xab6e('0x1')]=_0x3627fd['description']||'';this[_0xab6e('0x2')]=_0x3627fd[_0xab6e('0x2')]||'';this['zone']=_0x3627fd[_0xab6e('0x3')]||'';this[_0xab6e('0x4')]=_0x3627fd[_0xab6e('0x4')]||'';this['clientSecret']=_0x3627fd[_0xab6e('0x5')]||'';this[_0xab6e('0x6')]=_0x3627fd[_0xab6e('0x6')]||'';this[_0xab6e('0x7')]=_0x3627fd[_0xab6e('0x7')]||'';this['refreshToken']=_0x3627fd[_0xab6e('0x8')]||'';this['Configurations']=_0x3627fd[_0xab6e('0x9')]||{};}module[_0xab6e('0xa')]=ZohoAccount; \ No newline at end of file diff --git a/server/services/ami/preview/action.js b/server/services/ami/preview/action.js index d4eda01..cd986eb 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 _0x137b=['countabandonedretry','countagentrejectretry','countmachineretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','prototype','getCaller','\x22%s\x22\x20<%s>','exports','util','lodash','moment','isNil','uniqueid','idContact','name','type','campaigntype','queue','dialAnswer','membername','Agent','channelAgent','format','SIP/%s','calleridname','Contact','lastName','active','calleridnum','phone','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry'];(function(_0x178f75,_0x52da1f){var _0x4925f0=function(_0x62fbab){while(--_0x62fbab){_0x178f75['push'](_0x178f75['shift']());}};_0x4925f0(++_0x52da1f);}(_0x137b,0xc9));var _0xb137=function(_0x42d7f4,_0x5e9ae8){_0x42d7f4=_0x42d7f4-0x0;var _0x49e630=_0x137b[_0x42d7f4];return _0x49e630;};'use strict';var util=require(_0xb137('0x0'));var _=require(_0xb137('0x1'));var moment=require(_0xb137('0x2'));function checkNameSurname(_0x517533,_0x2b8d7f,_0x422849){var _0x59eb94='';if(!_[_0xb137('0x3')](_0x2b8d7f)&&'string'===typeof _0x2b8d7f){_0x59eb94+=_0x2b8d7f;}if(!_[_0xb137('0x3')](_0x422849)&&'string'===typeof _0x422849){_0x59eb94+='\x20'+_0x422849;}if(_0x59eb94!==''){return _0x59eb94;}return _0x517533;}function Action(_0x2c9f40,_0x313818,_0x41858b,_0x315577,_0x3dbc0e){this[_0xb137('0x4')]=_0x41858b||undefined;this[_0xb137('0x5')]=_0x2c9f40['id'];this['queue']=_0x313818[_0xb137('0x6')];this[_0xb137('0x7')]=_0x313818[_0xb137('0x7')];this[_0xb137('0x8')]=_0xb137('0x9');this[_0xb137('0xa')]=![];this[_0xb137('0xb')]=_[_0xb137('0x3')](_0x2c9f40['Agent'])?undefined:_0x2c9f40[_0xb137('0xc')][_0xb137('0x6')];this[_0xb137('0xd')]=this[_0xb137('0xb')]?util[_0xb137('0xe')](_0xb137('0xf'),this[_0xb137('0xb')]):_0x315577||undefined;this[_0xb137('0x10')]=checkNameSurname(_0x2c9f40['Contact']['phone'],_0x2c9f40[_0xb137('0x11')]['firstName'],_0x2c9f40[_0xb137('0x11')][_0xb137('0x12')]);this[_0xb137('0x13')]=_0x2c9f40['active']||![];this[_0xb137('0x14')]=_0x2c9f40[_0xb137('0x11')][_0xb137('0x15')];this['scheduledat']=_0x2c9f40[_0xb137('0x16')];this[_0xb137('0x17')]=_0x2c9f40[_0xb137('0x17')]||0x0;this[_0xb137('0x18')]=_0x2c9f40[_0xb137('0x18')]||0x0;this[_0xb137('0x19')]=_0x2c9f40[_0xb137('0x19')]||0x0;this[_0xb137('0x1a')]=(_0x2c9f40[_0xb137('0x17')]||0x0)+(_0x2c9f40[_0xb137('0x18')]||0x0)+(_0x2c9f40[_0xb137('0x19')]||0x0)+(_0x2c9f40[_0xb137('0x1b')]||0x0)+(_0x2c9f40[_0xb137('0x1c')]||0x0)+(_0x2c9f40[_0xb137('0x1d')]||0x0)+(_0x2c9f40['countmachineretry']||0x0)+(_0x2c9f40[_0xb137('0x1e')]||0x0);this[_0xb137('0x1b')]=_0x2c9f40[_0xb137('0x1b')]||0x0;this[_0xb137('0x1c')]=_0x2c9f40[_0xb137('0x1c')]||0x0;this[_0xb137('0x1d')]=_0x2c9f40['countabandonedretry']||0x0;this[_0xb137('0x1f')]=_0x2c9f40[_0xb137('0x1f')]||0x0;this[_0xb137('0x1e')]=_0x2c9f40[_0xb137('0x1e')]||0x0;this[_0xb137('0x20')]=_0x2c9f40['callback'];this[_0xb137('0x21')]=_0x2c9f40[_0xb137('0x21')];this[_0xb137('0x22')]=_0x2c9f40[_0xb137('0x22')];this[_0xb137('0x23')]=_0x2c9f40[_0xb137('0x23')];this[_0xb137('0x24')]=_0x2c9f40[_0xb137('0x24')];this[_0xb137('0x25')]=_0x2c9f40['ListId'];this['UserId']=_[_0xb137('0x3')](_0x2c9f40['Agent'])?_0x2c9f40[_0xb137('0x26')]:_0x2c9f40[_0xb137('0xc')]['id'];this[_0xb137('0x27')]=_0x2c9f40['VoiceQueueId'];this[_0xb137('0x28')]='';this[_0xb137('0x29')]='';}Action[_0xb137('0x2a')][_0xb137('0x2b')]=function(){return util['format'](_0xb137('0x2c'),this[_0xb137('0x10')],this['number']);};module[_0xb137('0x2d')]=Action; \ No newline at end of file +var _0x74c6=['callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','VoiceQueueId','originatecalleridnum','originatecalleridname','prototype','getCaller','number','exports','util','lodash','moment','isNil','string','queue','name','type','campaigntype','dialAnswer','Agent','channelAgent','membername','SIP/%s','calleridname','Contact','phone','firstName','lastName','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry'];(function(_0x421196,_0x1cbd94){var _0x2738af=function(_0xc956ff){while(--_0xc956ff){_0x421196['push'](_0x421196['shift']());}};_0x2738af(++_0x1cbd94);}(_0x74c6,0x15d));var _0x674c=function(_0x1eb126,_0x1c0265){_0x1eb126=_0x1eb126-0x0;var _0x345fc8=_0x74c6[_0x1eb126];return _0x345fc8;};'use strict';var util=require(_0x674c('0x0'));var _=require(_0x674c('0x1'));var moment=require(_0x674c('0x2'));function checkNameSurname(_0x3f0c64,_0x1abff6,_0x3a9bba){var _0x76a519='';if(!_[_0x674c('0x3')](_0x1abff6)&&_0x674c('0x4')===typeof _0x1abff6){_0x76a519+=_0x1abff6;}if(!_[_0x674c('0x3')](_0x3a9bba)&&'string'===typeof _0x3a9bba){_0x76a519+='\x20'+_0x3a9bba;}if(_0x76a519!==''){return _0x76a519;}return _0x3f0c64;}function Action(_0x4e9d88,_0x5466c5,_0x2b1080,_0x1cd419,_0x1a0ff3){this['uniqueid']=_0x2b1080||undefined;this['idContact']=_0x4e9d88['id'];this[_0x674c('0x5')]=_0x5466c5[_0x674c('0x6')];this['type']=_0x5466c5[_0x674c('0x7')];this[_0x674c('0x8')]='queue';this[_0x674c('0x9')]=![];this['membername']=_[_0x674c('0x3')](_0x4e9d88[_0x674c('0xa')])?undefined:_0x4e9d88[_0x674c('0xa')][_0x674c('0x6')];this[_0x674c('0xb')]=this[_0x674c('0xc')]?util['format'](_0x674c('0xd'),this[_0x674c('0xc')]):_0x1cd419||undefined;this[_0x674c('0xe')]=checkNameSurname(_0x4e9d88[_0x674c('0xf')][_0x674c('0x10')],_0x4e9d88[_0x674c('0xf')][_0x674c('0x11')],_0x4e9d88[_0x674c('0xf')][_0x674c('0x12')]);this['active']=_0x4e9d88['active']||![];this['calleridnum']=_0x4e9d88[_0x674c('0xf')][_0x674c('0x10')];this[_0x674c('0x13')]=_0x4e9d88['scheduledat'];this[_0x674c('0x14')]=_0x4e9d88[_0x674c('0x14')]||0x0;this[_0x674c('0x15')]=_0x4e9d88[_0x674c('0x15')]||0x0;this[_0x674c('0x16')]=_0x4e9d88['countnoanswerretry']||0x0;this[_0x674c('0x17')]=(_0x4e9d88[_0x674c('0x14')]||0x0)+(_0x4e9d88[_0x674c('0x15')]||0x0)+(_0x4e9d88['countnoanswerretry']||0x0)+(_0x4e9d88[_0x674c('0x18')]||0x0)+(_0x4e9d88[_0x674c('0x19')]||0x0)+(_0x4e9d88['countabandonedretry']||0x0)+(_0x4e9d88['countmachineretry']||0x0)+(_0x4e9d88['countagentrejectretry']||0x0);this['countnosuchnumberretry']=_0x4e9d88[_0x674c('0x18')]||0x0;this[_0x674c('0x19')]=_0x4e9d88[_0x674c('0x19')]||0x0;this[_0x674c('0x1a')]=_0x4e9d88['countabandonedretry']||0x0;this['countmachineretry']=_0x4e9d88[_0x674c('0x1b')]||0x0;this[_0x674c('0x1c')]=_0x4e9d88[_0x674c('0x1c')]||0x0;this[_0x674c('0x1d')]=_0x4e9d88[_0x674c('0x1d')];this[_0x674c('0x1e')]=_0x4e9d88['callbackuniqueid'];this['callbackat']=_0x4e9d88[_0x674c('0x1f')];this['recallme']=_0x4e9d88[_0x674c('0x20')];this[_0x674c('0x21')]=_0x4e9d88[_0x674c('0x21')];this[_0x674c('0x22')]=_0x4e9d88['ListId'];this['UserId']=_[_0x674c('0x3')](_0x4e9d88[_0x674c('0xa')])?_0x4e9d88['UserId']:_0x4e9d88[_0x674c('0xa')]['id'];this['VoiceQueueId']=_0x4e9d88[_0x674c('0x23')];this[_0x674c('0x24')]='';this[_0x674c('0x25')]='';}Action[_0x674c('0x26')][_0x674c('0x27')]=function(){return util['format']('\x22%s\x22\x20<%s>',this[_0x674c('0xe')],this[_0x674c('0x28')]);};module[_0x674c('0x29')]=Action; \ No newline at end of file diff --git a/server/services/ami/preview/index.js b/server/services/ami/preview/index.js index 3a18b08..530f317 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 _0xa6ed=['substring','getCallerId','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','originatecalleridname','originatecalleridnum','addVariables','merge','variablesAction','channelAgent','destconnectedlinenum','user:%s','accountcode','calleridnum','[originated][increment]','[originateFailure][logOriginateFailure]','actionid','logLookAgent','clone','isFailure','response','custom:agentringnoanswer','rejected','[callProgressDetectingAgent][logAnswer]','[syncHangup][talking]','cause','[syncHangup][talking][cause]','statedesc','dialQueueProject','channelstate','transfer','unlockContact','[syncHangup][talking][transfer]','destuniqueid','variables','filterKey','keys','addVariable','value','error','[syncVarSet][Preview]','syncAttendedTransfer','transfertargetlinkedid','transfererlinkedid','exports','util','bluebird','uuid','moment','ioredis','../../../config/logger','preview','../ami','./rpcDb','redis','localhost','socket.io-emitter','prototype','enqueue','tail','sequence','voiceQueues','trunks','actions','agents','clockClearZombieChannels','originateresponse','syncOriginateResponse','bind','hangup','syncHangup','hanguprequest','syncHangupRequest','dialend','newexten','syncNewExten','varset','syncVarSet','attendedtransfer','syncBlindTransfer','loopCampaigns','campaignsPreview','emit','name','strategy','answered','available','sumBillable','talking','type','unmanaged','abandoned','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdName','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalAvailable','predictiveIntervalTotalCalls','message','originated','erlangCalls','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','active','callerid','Interval','stringify','md5','format','voice:queue:%s','voice_queue:save','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','voice_queue_presence:remove','pTalking','sendMessageOneNotActive','NOT_ACTIVE','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','IS_DISACTIVED','\x20is\x20disactive','syncCampaigns','outbound','clearZombieChannels','hasOwnProperty','setMessage','recallMe','isNil','info','[clearZombieChannels][talking]','Queue','queue','originated:\x20','pTalking:\x20','dialAnswer','pick','ListId','Action','status','channel','catch','No\x20such\x20channel','[clearZombieChannel]','decrementTalkink','loggerError','[Dialer][checkChannel][pTalking][Preview]','size','clearZombieChannel','agentReadyId','then','length','scheduledat','dialRecallMeTimeout','Agent','voicePause','run','logger2','[RecallMe]','disableContact','starttime','logCustomer','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','createBody','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','createCustomerHistory','[HistoryRecallClose]','[getContactRecallMe]','loggedIn','AGENTS_NOT_LOGGED','isActive','isTrunkReachable','TrunkBackup','ACTIVE','callProgressDetectingCustomer','countnosuchnumberretry','totalGlobal','custom:agentnosuchnumber','buildObj','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','dialGlobalMaxRetry','Global','createCustomerFinal','[callProgressDetectingCustomer][logNoSuchGlobal]','dialNoSuchNumberMaxRetry','rescheduleContact','dialNoSuchNumberRetryFrequency','unlockAgent','activeContact','linkedid','ANSWER','YYYY-MM-DD\x20HH:mm:ss','responsetime','[syncHangup][talking][increment]','uniqueid','\x20Queue','custom:agentconnect','connect','custom:agentConnectPreview','custom:agentcomplete','complete','total','[16]','countglobal','Answer','crateCustomerReportQueue','talktime','[syncHangup][talking][decrement]','countbusyretry','Busy','custom:agentbusy','busy','[callProgressDetectingCustomer][logBusy]','cloneAction','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','scheduledAt','NOANSWER','countnoanswerretry','NoAnswer','custom:agentnoanswer','noanswer','[callProgressDetectingCustomer][logNoAnswer]','[callProgressDetectingCustomer][logNoAnswerGlobal]','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','CONGESTION','countcongestionretry','Congestion','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','CANCEL','countagentrejectretry','AgentReject','custom:agentreject','agentreject','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','ABANDONED','outboundAbandonedCallsDay','countabandonedretry','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','cause-txt','dialstatus','amd','[callProgressDetectingCustomer][hangupInAMD]','custom:amd','[callProgressDetectingCustomer][machine]','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknownGlobal]','updateOriginated','[originated][decrement][callProgressDetectingCustomer]','destlinkedid','callProgressDetectingAgent','isUndefined','object','reason','logAgent','NoSuchNumber','createAgentHistory','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[originated][decrement][callProgressDetectingAgent]','phone','VoiceQueueId','Contact\x20is\x20undefined','lookAgent','isEmpty','Queue:\x20','\x20IdHopper:\x20','idContact','custom:agentcalled','called','Calling','[Preview][execCall][failure]','logBlacklist','[Blacklist][error]','Contact\x20in\x20black\x20List','SIP/%s','reachable','unlock','execRun','validateContact','isValid','checkIsBlackList','Contact.phone','checkInBlack','[Preview][checkIsBlackList]','Call\x20unsuccessful','[Preview][validateContact][Empty\x20Contact]','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','[Preview][validateContact][Trunk\x20not\x20work]','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','\x20Trunk\x20Backup\x20is\x20not\x20active','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','execCall','SIP/%s/%s%s','dialPrefix','trim','dialCutDigit','Contact'];(function(_0xa51977,_0x2ec8ed){var _0x566fa6=function(_0x53497a){while(--_0x53497a){_0xa51977['push'](_0xa51977['shift']());}};_0x566fa6(++_0x2ec8ed);}(_0xa6ed,0x17c));var _0xda6e=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xa6ed[_0x20a584];return _0x4b41a8;};'use strict';var util=require(_0xda6e('0x0'));var _=require('lodash');var BPromise=require(_0xda6e('0x1'));var uuid=require(_0xda6e('0x2'));var moment=require(_0xda6e('0x3'));var md5=require('md5');var Redis=require(_0xda6e('0x4'));var config=require('../../../config/environment');var logger=require(_0xda6e('0x5'))(_0xda6e('0x6'));var loggerAction=require(_0xda6e('0x5'))('actionPreview');var ami=require(_0xda6e('0x7'));var rpcDb=require(_0xda6e('0x8'));var Action=require('./action');var ut=require('./util/util');config[_0xda6e('0x9')]=_['defaults'](config['redis'],{'host':_0xda6e('0xa'),'port':0x18eb});var io=require(_0xda6e('0xb'))(new Redis(config[_0xda6e('0x9')]));var Sequence=function(){};Sequence[_0xda6e('0xc')][_0xda6e('0xd')]=function(_0x25281b){this[_0xda6e('0xe')]=this[_0xda6e('0xe')]?this[_0xda6e('0xe')]['finally'](_0x25281b):_0x25281b();};function Preview(_0x28217f){this[_0xda6e('0xf')]=new Sequence();this['campaignsPreview']=_0x28217f[_0xda6e('0x10')];this[_0xda6e('0x11')]=_0x28217f[_0xda6e('0x11')];this[_0xda6e('0x12')]={};this[_0xda6e('0x13')]=_0x28217f[_0xda6e('0x13')];this[_0xda6e('0x14')]=0x0;ami['on'](_0xda6e('0x15'),this[_0xda6e('0x16')][_0xda6e('0x17')](this));ami['on'](_0xda6e('0x18'),this[_0xda6e('0x19')][_0xda6e('0x17')](this));ami['on'](_0xda6e('0x1a'),this[_0xda6e('0x1b')][_0xda6e('0x17')](this));ami['on'](_0xda6e('0x1c'),this['syncDialEnd']['bind'](this));ami['on'](_0xda6e('0x1d'),this[_0xda6e('0x1e')][_0xda6e('0x17')](this));ami['on'](_0xda6e('0x1f'),this[_0xda6e('0x20')][_0xda6e('0x17')](this));ami['on'](_0xda6e('0x21'),this['syncAttendedTransfer'][_0xda6e('0x17')](this));ami['on']('blindtransfer',this[_0xda6e('0x22')][_0xda6e('0x17')](this));this[_0xda6e('0x23')](this[_0xda6e('0x24')]);}function emit(_0x446112,_0x51b900,_0x83b6df){io['to'](_0x446112)[_0xda6e('0x25')](_0x51b900,_0x83b6df);}function emitCampaignPreview(_0x141dee){if(_0x141dee['type']==='outbound'){var _0x4e1139={'id':_0x141dee['id'],'name':_0x141dee[_0xda6e('0x26')],'strategy':_0x141dee[_0xda6e('0x27')],'answered':_0x141dee[_0xda6e('0x28')],'available':_0x141dee[_0xda6e('0x29')],'loggedIn':_0x141dee['loggedIn'],'pTalking':_0x141dee['pTalking'],'sumBillable':_0x141dee[_0xda6e('0x2a')],'sumDuration':_0x141dee['sumDuration'],'sumHoldTime':_0x141dee['sumHoldTime']||0x0,'talking':_0x141dee[_0xda6e('0x2b')],'total':_0x141dee['total'],'type':_0x141dee[_0xda6e('0x2c')],'unmanaged':_0x141dee[_0xda6e('0x2d')],'abandoned':_0x141dee[_0xda6e('0x2e')],'waiting':_0x141dee['waiting'],'loggedInDb':_0x141dee[_0xda6e('0x2f')],'dialActive':_0x141dee[_0xda6e('0x30')],'dialMethod':_0x141dee[_0xda6e('0x31')],'dialOriginateCallerIdName':_0x141dee[_0xda6e('0x32')],'dialOriginateCallerIdNumber':_0x141dee['dialOriginateCallerIdNumber'],'dialOriginateTimeout':_0x141dee['dialOriginateTimeout'],'dialPrefix':_0x141dee['dialPrefix'],'outboundAnswerAgiCallsDay':_0x141dee[_0xda6e('0x33')],'outboundAnswerCallsDay':_0x141dee[_0xda6e('0x34')],'outboundBlacklistCallsDay':_0x141dee[_0xda6e('0x35')],'outboundBusyCallsDay':_0x141dee['outboundBusyCallsDay'],'outboundCongestionCallsDay':_0x141dee[_0xda6e('0x36')],'outboundDropCallsDayACS':_0x141dee[_0xda6e('0x37')],'outboundDropCallsDayCallersExit':_0x141dee[_0xda6e('0x38')],'outboundDropCallsDayTimeout':_0x141dee[_0xda6e('0x39')],'outboundNoAnswerCallsDay':_0x141dee[_0xda6e('0x3a')],'outboundNoSuchCallsDay':_0x141dee[_0xda6e('0x3b')],'outboundOriginateFailureCallsDay':_0x141dee['outboundOriginateFailureCallsDay'],'outboundReCallsDay':_0x141dee[_0xda6e('0x3c')],'outboundRejectCallsDay':_0x141dee[_0xda6e('0x3d')],'outboundUnknownCallsDay':_0x141dee[_0xda6e('0x3e')],'outboundAbandonedCallsDay':_0x141dee['outboundAbandonedCallsDay'],'predictiveIntervalAnsweredCalls':_0x141dee[_0xda6e('0x3f')],'predictiveIntervalAvgHoldtime':_0x141dee['predictiveIntervalAvgHoldtime'],'predictiveIntervalAvgTalktime':_0x141dee[_0xda6e('0x40')],'predictiveIntervalDroppedCallsCallersExit':_0x141dee['predictiveIntervalDroppedCallsCallersExit'],'predictiveIntervalDroppedCallsTimeout':_0x141dee[_0xda6e('0x41')],'predictiveIntervalErlangCalls':_0x141dee['predictiveIntervalErlangCalls'],'predictiveIntervalErlangCallsDroppedCalls':_0x141dee[_0xda6e('0x42')],'predictiveIntervalHitRate':_0x141dee[_0xda6e('0x43')],'predictiveIntervalMultiplicativeFactor':_0x141dee['predictiveIntervalMultiplicativeFactor'],'predictiveIntervalPauses':_0x141dee['predictiveIntervalPauses'],'predictiveIntervalAvailable':_0x141dee[_0xda6e('0x44')],'predictiveIntervalTotalCalls':_0x141dee[_0xda6e('0x45')],'message':_0x141dee[_0xda6e('0x46')],'originated':_0x141dee[_0xda6e('0x47')],'erlangCalls':_0x141dee[_0xda6e('0x48')],'erlangCallToSecond':_0x141dee['erlangCallToSecond'],'erlangAbandonmentRate':_0x141dee[_0xda6e('0x49')],'erlangBusyFactor':_0x141dee[_0xda6e('0x4a')],'startPredictive':_0x141dee[_0xda6e('0x4b')],'startProgressive':_0x141dee[_0xda6e('0x4c')]};if(_0x141dee[_0xda6e('0x4d')]){_0x4e1139[_0xda6e('0x4d')]={'id':_0x141dee[_0xda6e('0x4d')]['id'],'name':_0x141dee[_0xda6e('0x4d')]['name'],'active':_0x141dee['Trunk'][_0xda6e('0x4e')],'callerid':_0x141dee[_0xda6e('0x4d')][_0xda6e('0x4f')]};}if(_0x141dee['Interval']){_0x4e1139[_0xda6e('0x50')]={'id':_0x141dee[_0xda6e('0x50')]['id'],'name':_0x141dee[_0xda6e('0x50')][_0xda6e('0x26')]};}var _0x4c45be=md5(JSON[_0xda6e('0x51')](_0x4e1139));if(_0x141dee[_0xda6e('0x52')]!==_0x4c45be){_0x141dee[_0xda6e('0x52')]=_0x4c45be;emit(util[_0xda6e('0x53')](_0xda6e('0x54'),_0x4e1139[_0xda6e('0x26')]),_0xda6e('0x55'),_0x4e1139);}}}function emitVoiceQueueChannelRemove(_0x345eae){logger['info'](_0xda6e('0x56'),JSON[_0xda6e('0x51')](_0x345eae));emit(util[_0xda6e('0x53')](_0xda6e('0x54'),_0x345eae[_0xda6e('0x26')]),'voice_queue_channel:remove',_0x345eae);io[_0xda6e('0x25')](_0xda6e('0x57'),_0x345eae);}function notSendMessagesQueue(_0x10a8e4){if(_0x10a8e4['sendMessageOneNotActive']){if(_0x10a8e4[_0xda6e('0x47')]===0x0&&_0x10a8e4[_0xda6e('0x58')]===0x0){_0x10a8e4[_0xda6e('0x59')]=![];_0x10a8e4['available']=0x0;_0x10a8e4['paused']=0x0;_0x10a8e4['message']=_0xda6e('0x5a');ut[_0xda6e('0x5b')](_0xda6e('0x5c'),_0x10a8e4[_0xda6e('0x26')]+_0xda6e('0x5d'));}else{_0x10a8e4['message']=_0xda6e('0x5e');ut[_0xda6e('0x5b')](_0xda6e('0x5c'),_0x10a8e4[_0xda6e('0x26')]+_0xda6e('0x5f'));}emitCampaignPreview(_0x10a8e4);}}Preview[_0xda6e('0xc')][_0xda6e('0x23')]=function(){var _0x413baf=this;setInterval(function(){_0x413baf[_0xda6e('0x60')]();},0x7cf);};Preview[_0xda6e('0xc')][_0xda6e('0x60')]=function(){var _0x39ff96=this[_0xda6e('0x24')];this['clockClearZombieChannels']+=0x1;for(var _0x57066f in _0x39ff96){if(_0x39ff96['hasOwnProperty'](_0x57066f)&&(_0x39ff96[_0x57066f][_0xda6e('0x31')]===_0xda6e('0x6')||_0x39ff96[_0x57066f][_0xda6e('0x31')]==='booked')&&_0x39ff96[_0x57066f][_0xda6e('0x2c')]===_0xda6e('0x61')){if(this[_0xda6e('0x14')]>0x7){this[_0xda6e('0x14')]=0x0;this[_0xda6e('0x62')]();}}if(_0x39ff96[_0xda6e('0x63')](_0x57066f)&&_0x39ff96[_0x57066f][_0xda6e('0x31')]===_0xda6e('0x6')&&_0x39ff96[_0x57066f][_0xda6e('0x2c')]===_0xda6e('0x61')){if(_0x39ff96[_0x57066f][_0xda6e('0x30')]){this[_0xda6e('0x64')](_0x39ff96[_0x57066f]);this[_0xda6e('0x65')](_0x39ff96[_0x57066f]);}else{notSendMessagesQueue(_0x39ff96[_0x57066f]);}}}};Preview['prototype']['clearZombieChannel']=function(_0x793a2c){var _0xafcdc2=this;this['sequence'][_0xda6e('0xd')](function(){if(!_[_0xda6e('0x66')](_0xafcdc2[_0xda6e('0x12')][_0x793a2c])){loggerAction[_0xda6e('0x67')](_0xda6e('0x68'),_0x793a2c,_0xda6e('0x69'),_0xafcdc2[_0xda6e('0x12')][_0x793a2c][_0xda6e('0x6a')],_0xda6e('0x6b'),JSON[_0xda6e('0x51')](_0xafcdc2['campaignsPreview'][_0xafcdc2[_0xda6e('0x12')][_0x793a2c][_0xda6e('0x6a')]]['originated']),_0xda6e('0x6c'),JSON['stringify'](_0xafcdc2[_0xda6e('0x24')][_0xafcdc2[_0xda6e('0x12')][_0x793a2c][_0xda6e('0x6a')]][_0xda6e('0x58')]),JSON['stringify'](_0xafcdc2[_0xda6e('0x12')][_0x793a2c][_0xda6e('0x6d')]),JSON[_0xda6e('0x51')](_[_0xda6e('0x6e')](_0xafcdc2[_0xda6e('0x12')][_0x793a2c],['contactId','UserId','VoiceQueueId',_0xda6e('0x6f')])));return ami[_0xda6e('0x70')]({'action':_0xda6e('0x71'),'channel':_0xafcdc2[_0xda6e('0x12')][_0x793a2c][_0xda6e('0x72')]})[_0xda6e('0x73')](function(_0x3b75bd){if(_0x3b75bd[_0xda6e('0x46')]===_0xda6e('0x74')){setTimeout(function(){if(_0xafcdc2['actions'][_0x793a2c]){ut['updateOriginated'](_0xafcdc2[_0xda6e('0x24')][_0xafcdc2[_0xda6e('0x12')][_0x793a2c][_0xda6e('0x6a')]],_0xda6e('0x75'));if(_0xafcdc2[_0xda6e('0x12')][_0x793a2c][_0xda6e('0x6d')]===!![]){ut[_0xda6e('0x76')](_0xafcdc2['campaignsPreview'][_0xafcdc2[_0xda6e('0x12')][_0x793a2c][_0xda6e('0x6a')]],_0xda6e('0x75'));ut[_0xda6e('0x77')](_0xda6e('0x78')+_0x793a2c,_0xafcdc2[_0xda6e('0x12')][_0x793a2c][_0xda6e('0x6a')]);}ut[_0xda6e('0x77')]('[Dialer][checkChannel][Preview]'+_0x793a2c,_0xafcdc2[_0xda6e('0x12')][_0x793a2c]['queue']);delete _0xafcdc2['actions'][_0x793a2c];}},0x2328);}});}});};Preview[_0xda6e('0xc')][_0xda6e('0x62')]=function(){var _0xfd814b=this;loggerAction[_0xda6e('0x67')]('[action]',_[_0xda6e('0x79')](this[_0xda6e('0x12')]));for(var _0x4b8d26 in this[_0xda6e('0x12')]){if(_0xfd814b[_0xda6e('0x12')]['hasOwnProperty'](_0x4b8d26)){_0xfd814b[_0xda6e('0x7a')](_0x4b8d26);}}};Preview[_0xda6e('0xc')][_0xda6e('0x65')]=function(_0x2eff53){var _0x100c74=this;rpcDb['getContactRecallMe'](_0x2eff53['id'],ut[_0xda6e('0x7b')](this[_0xda6e('0x13')]))[_0xda6e('0x7c')](function(_0x2e6321){if(!_[_0xda6e('0x66')](_0x2e6321)){for(var _0xad9f3d=0x0;_0xad9f3d<_0x2e6321[_0xda6e('0x7d')];_0xad9f3d+=0x1){if(ut['getDiff'](_0x2e6321[_0xad9f3d][_0xda6e('0x7e')])<_0x2eff53[_0xda6e('0x7f')]*0x3c){if(_0x2e6321[_0xad9f3d]['Agent']&&!_0x2e6321[_0xad9f3d][_0xda6e('0x80')][_0xda6e('0x81')]){_0x100c74[_0xda6e('0x82')](_0x2e6321[_0xad9f3d]['id'])['then'](ut[_0xda6e('0x83')](_0xda6e('0x84')))[_0xda6e('0x73')](ut[_0xda6e('0x83')](_0xda6e('0x84')));}else{rpcDb[_0xda6e('0x85')](_0x2e6321[_0xad9f3d]['id']);}}else{var _0xba30e5=new Action(_0x2e6321[_0xad9f3d],_0x2eff53);_0xba30e5[_0xda6e('0x86')]=moment()[_0xda6e('0x53')]('YYYY-MM-DD\x20HH:mm:ss');_0x2eff53[_0xda6e('0x3c')]+=0x1;ut[_0xda6e('0x87')](_0xba30e5,0x17,_0xda6e('0x88'));if(_0x2eff53[_0xda6e('0x89')]){rpcDb[_0xda6e('0x8a')](ut[_0xda6e('0x8b')](_0x2e6321[_0xad9f3d]));rpcDb['createCustomerHistory'](_0xba30e5,_0xda6e('0x8c'));}else{ut[_0xda6e('0x87')](_0xba30e5,0x16,_0xda6e('0x8d'));rpcDb[_0xda6e('0x8e')](_0xba30e5,'[HistoryRecallClose]');rpcDb['createCustomerFinal'](_0xba30e5,_0xda6e('0x8f'));}}}}})['catch'](ut[_0xda6e('0x83')](_0xda6e('0x90')));};Preview[_0xda6e('0xc')][_0xda6e('0x64')]=function(_0x5a0891){_0x5a0891[_0xda6e('0x59')]=!![];if(ut['IsNotLoggedIn'](_0x5a0891[_0xda6e('0x91')])){_0x5a0891['message']=_0xda6e('0x92');}else if(!ut[_0xda6e('0x93')](_0x5a0891[_0xda6e('0x30')])){_0x5a0891['message']=_0xda6e('0x5a');}else if(!this[_0xda6e('0x94')](_0x5a0891[_0xda6e('0x4d')])){if(!this['isTrunkReachable'](_0x5a0891[_0xda6e('0x95')])){_0x5a0891['message']='TRUNK_IS_NOT_REACHABLE';}else{_0x5a0891[_0xda6e('0x46')]='ACTIVE';}}else{_0x5a0891[_0xda6e('0x46')]=_0xda6e('0x96');}emitCampaignPreview(_0x5a0891);};Preview[_0xda6e('0xc')][_0xda6e('0x97')]=function(_0x155530,_0x300aaa,_0x444d43){var _0x3b0eb5=this;var _0x1a0c89=this[_0xda6e('0x12')][_0x300aaa];var _0x4923f0=this['campaignsPreview'][_0x1a0c89['queue']];var _0x26f1c4;if(_0x4923f0){switch(_0x444d43){case'1':_0x4923f0[_0xda6e('0x3b')]+=0x1;_0x1a0c89[_0xda6e('0x98')]+=0x1;_0x1a0c89['countglobal']=ut[_0xda6e('0x99')](_0x1a0c89);ut['logCustomer'](_0x1a0c89,0x0,'NoSuchNumber');ami[_0xda6e('0x25')](_0xda6e('0x9a'),ut[_0xda6e('0x9b')](_0x1a0c89,_0xda6e('0x9c')));rpcDb['createCustomerHistory'](_0x1a0c89,_0xda6e('0x9d'));if(ut[_0xda6e('0x99')](_0x1a0c89)>=_0x4923f0[_0xda6e('0x9e')]){_0x26f1c4=ut['cloneAction'](_0x1a0c89,0xf,_0xda6e('0x9f'));rpcDb[_0xda6e('0xa0')](_0x26f1c4,_0xda6e('0xa1'));}else{if(_0x1a0c89[_0xda6e('0x98')]>=_0x4923f0[_0xda6e('0xa2')]){rpcDb['createCustomerFinal'](_0x1a0c89,_0xda6e('0xa1'));}else{rpcDb[_0xda6e('0xa3')](ut['scheduledAt'](_0x1a0c89,_0xda6e('0x98'),_0x4923f0[_0xda6e('0xa4')]),_0x1a0c89[_0xda6e('0xa5')],_0x1a0c89[_0xda6e('0xa6')]);}}delete this['actions'][_0x155530[_0xda6e('0xa7')]];break;case _0xda6e('0xa8'):var _0x5b1109=moment()['format'](_0xda6e('0xa9'));_0x1a0c89[_0xda6e('0xaa')]=_0x5b1109;_0x1a0c89['answertime']=_0x5b1109;_0x1a0c89[_0xda6e('0x6d')]=!![];_0x4923f0[_0xda6e('0x58')]+=0x1;logger[_0xda6e('0x67')](_0xda6e('0xab'),_0x1a0c89[_0xda6e('0xac')],_0xda6e('0xad'),_0x4923f0['name'],_0xda6e('0x6c'),_0x4923f0[_0xda6e('0x58')]);ami[_0xda6e('0x25')](_0xda6e('0xae'),ut[_0xda6e('0x9b')](_0x1a0c89,_0xda6e('0xaf'),this[_0xda6e('0x24')][_0x1a0c89['queue']]));if(_0x4923f0['acw']){ami[_0xda6e('0x25')](_0xda6e('0xb0'),ut['buildAcw'](_0x1a0c89));}break;case'16':ami[_0xda6e('0x25')](_0xda6e('0xb1'),ut['buildObj'](_0x1a0c89,_0xda6e('0xb2'),this[_0xda6e('0x24')][_0x1a0c89[_0xda6e('0x6a')]]));emitVoiceQueueChannelRemove(ut[_0xda6e('0x9b')](_0x1a0c89,_0xda6e('0xb2')));_0x4923f0['outboundAnswerCallsDay']+=0x1;_0x4923f0[_0xda6e('0xb3')]+=0x1;_0x4923f0[_0xda6e('0x28')]+=0x1;ut[_0xda6e('0x76')](_0x4923f0,_0xda6e('0xb4'));_0x1a0c89[_0xda6e('0xb5')]=ut[_0xda6e('0x99')](_0x1a0c89);ut[_0xda6e('0x87')](_0x1a0c89,0x4,_0xda6e('0xb6'));rpcDb[_0xda6e('0x8e')](_0x1a0c89,'[callProgressDetectingCustomer][logAnswer]');rpcDb['createCustomerFinal'](_0x1a0c89,'[callProgressDetectingCustomer][logAnswerGlobal]');rpcDb[_0xda6e('0xb7')](_0x1a0c89);_0x4923f0['sumDuration']+=_0x1a0c89[_0xda6e('0xb8')];_0x4923f0[_0xda6e('0x2a')]+=_0x1a0c89[_0xda6e('0xb8')];logger['info'](_0xda6e('0xb9'),_0x1a0c89[_0xda6e('0xac')],_0xda6e('0xad'),_0x4923f0[_0xda6e('0x26')],_0xda6e('0x6c'),_0x4923f0[_0xda6e('0x58')]);delete this[_0xda6e('0x12')][_0x155530[_0xda6e('0xa7')]];break;case'BUSY':_0x4923f0['outboundBusyCallsDay']+=0x1;_0x1a0c89[_0xda6e('0xba')]+=0x1;_0x1a0c89['countglobal']=ut[_0xda6e('0x99')](_0x1a0c89);ut[_0xda6e('0x87')](_0x1a0c89,0x5,_0xda6e('0xbb'));ami[_0xda6e('0x25')](_0xda6e('0xbc'),ut[_0xda6e('0x9b')](_0x1a0c89,_0xda6e('0xbd')));rpcDb[_0xda6e('0x8e')](_0x1a0c89,_0xda6e('0xbe'));if(ut[_0xda6e('0x99')](_0x1a0c89)>=_0x4923f0['dialGlobalMaxRetry']){_0x26f1c4=ut[_0xda6e('0xbf')](_0x1a0c89,0xf,_0xda6e('0x9f'));rpcDb[_0xda6e('0xa0')](_0x26f1c4,_0xda6e('0xc0'));}else{if(_0x1a0c89['countbusyretry']>=_0x4923f0[_0xda6e('0xc1')]){rpcDb[_0xda6e('0xa0')](_0x1a0c89,'[callProgressDetectingCustomer][logBusy]');}else{rpcDb[_0xda6e('0xa3')](ut[_0xda6e('0xc2')](_0x1a0c89,_0xda6e('0xba'),_0x4923f0['dialBusyRetryFrequency']),_0x1a0c89[_0xda6e('0xa5')],_0x1a0c89[_0xda6e('0xa6')]);}}break;case _0xda6e('0xc3'):_0x4923f0['outboundNoAnswerCallsDay']+=0x1;_0x1a0c89[_0xda6e('0xc4')]+=0x1;_0x1a0c89[_0xda6e('0xb5')]=ut[_0xda6e('0x99')](_0x1a0c89);ut[_0xda6e('0x87')](_0x1a0c89,0x3,_0xda6e('0xc5'));ami['emit'](_0xda6e('0xc6'),ut[_0xda6e('0x9b')](_0x1a0c89,_0xda6e('0xc7')));rpcDb[_0xda6e('0x8e')](_0x1a0c89,_0xda6e('0xc8'));if(ut[_0xda6e('0x99')](_0x1a0c89)>=_0x4923f0[_0xda6e('0x9e')]){_0x26f1c4=ut[_0xda6e('0xbf')](_0x1a0c89,0xf,_0xda6e('0x9f'));rpcDb[_0xda6e('0xa0')](_0x26f1c4,_0xda6e('0xc9'));}else{if(_0x1a0c89[_0xda6e('0xc4')]>=_0x4923f0[_0xda6e('0xca')]){rpcDb['createCustomerFinal'](_0x1a0c89,'[callProgressDetectingCustomer][logNoAnswer]');}else{rpcDb[_0xda6e('0xa3')](ut['scheduledAt'](_0x1a0c89,'countnoanswerretry',_0x4923f0[_0xda6e('0xcb')]),_0x1a0c89[_0xda6e('0xa5')],_0x1a0c89[_0xda6e('0xa6')]);}}break;case _0xda6e('0xcc'):_0x4923f0[_0xda6e('0x36')]+=0x1;_0x1a0c89[_0xda6e('0xcd')]+=0x1;_0x1a0c89[_0xda6e('0xb5')]=ut[_0xda6e('0x99')](_0x1a0c89);ut['logCustomer'](_0x1a0c89,0x8,_0xda6e('0xce'));ami[_0xda6e('0x25')](_0xda6e('0xcf'),ut['buildObj'](_0x1a0c89,_0xda6e('0xd0')));rpcDb[_0xda6e('0x8e')](_0x1a0c89,_0xda6e('0xd1'));if(ut['totalGlobal'](_0x1a0c89)>=_0x4923f0[_0xda6e('0x9e')]){_0x26f1c4=ut[_0xda6e('0xbf')](_0x1a0c89,0xf,_0xda6e('0x9f'));rpcDb[_0xda6e('0xa0')](_0x26f1c4,_0xda6e('0xd2'));}else{if(_0x1a0c89[_0xda6e('0xcd')]>=_0x4923f0['dialCongestionMaxRetry']){rpcDb[_0xda6e('0xa0')](_0x1a0c89,'[callProgressDetectingCustomer][logCongestion]');}else{rpcDb['rescheduleContact'](ut['scheduledAt'](_0x1a0c89,_0xda6e('0xcd'),_0x4923f0['dialBusyRetryFrequency']),_0x1a0c89[_0xda6e('0xa5')],_0x1a0c89[_0xda6e('0xa6')]);}}break;case _0xda6e('0xd3'):_0x4923f0[_0xda6e('0x3d')]+=0x1;_0x1a0c89[_0xda6e('0xd4')]+=0x1;_0x1a0c89['countglobal']=ut['totalGlobal'](_0x1a0c89);ut[_0xda6e('0x87')](_0x1a0c89,0x14,_0xda6e('0xd5'));ami[_0xda6e('0x25')](_0xda6e('0xd6'),ut['buildObj'](_0x1a0c89,_0xda6e('0xd7')));rpcDb[_0xda6e('0x8e')](_0x1a0c89,'[syncHangupRequest][logAgentReject]');if(ut[_0xda6e('0x99')](_0x1a0c89)>=_0x4923f0[_0xda6e('0x9e')]){_0x26f1c4=ut[_0xda6e('0xbf')](_0x1a0c89,0x14,'AgentReject');rpcDb['createCustomerFinal'](_0x26f1c4,_0xda6e('0xd8'));}else{if(_0x1a0c89[_0xda6e('0xd4')]>=_0x4923f0[_0xda6e('0xd9')]){rpcDb[_0xda6e('0xa0')](_0x1a0c89,'[callProgressDetectingCustomer][logAgentReject]');}else{rpcDb[_0xda6e('0xa3')](ut[_0xda6e('0xc2')](_0x1a0c89,'countagentrejectretry',_0x4923f0[_0xda6e('0xda')]),_0x1a0c89[_0xda6e('0xa5')],_0x1a0c89[_0xda6e('0xa6')]);}}break;case _0xda6e('0xdb'):_0x4923f0[_0xda6e('0xdc')]+=0x1;_0x1a0c89[_0xda6e('0xdd')]+=0x1;_0x1a0c89[_0xda6e('0xb5')]=ut['totalGlobal'](_0x1a0c89);ut[_0xda6e('0x87')](_0x1a0c89,0xb,'Abandoned');rpcDb[_0xda6e('0x8e')](_0x1a0c89,_0xda6e('0xde'));if(ut['totalGlobal'](_0x1a0c89)>=_0x4923f0[_0xda6e('0x9e')]){_0x26f1c4=ut['cloneAction'](_0x1a0c89,0xf,_0xda6e('0x9f'));rpcDb[_0xda6e('0xa0')](_0x26f1c4,'[callProgressDetectingCustomer][logAbandoned]');}else{if(_0x1a0c89[_0xda6e('0xdf')]>=_0x4923f0['dialAbandonedMaxRety']){rpcDb[_0xda6e('0xa0')](_0x1a0c89,_0xda6e('0xde'));}else{rpcDb['rescheduleContact'](ut[_0xda6e('0xc2')](_0x1a0c89,_0xda6e('0xdd'),_0x4923f0['dialAbandonedRetryFrequency']),_0x1a0c89[_0xda6e('0xa5')],_0x1a0c89[_0xda6e('0xa6')]);}}break;case'18':_0x4923f0[_0xda6e('0x3e')]+=0x1;_0x1a0c89['countmachineretry']+=0x1;_0x1a0c89[_0xda6e('0xb5')]=ut[_0xda6e('0x99')](_0x1a0c89);ut[_0xda6e('0x87')](_0x1a0c89,0x12,_0x155530[_0xda6e('0xe0')]||_0x155530[_0xda6e('0xe1')]);ami[_0xda6e('0x25')]('custom:amd',ut['buildObj'](_0x1a0c89,_0xda6e('0xe2')));rpcDb[_0xda6e('0x8e')](_0x1a0c89,_0xda6e('0xe3'));if(ut[_0xda6e('0x99')](_0x1a0c89)>=_0x4923f0['dialGlobalMaxRetry']){_0x26f1c4=ut['cloneAction'](_0x1a0c89,0xf,_0xda6e('0x9f'));rpcDb[_0xda6e('0xa0')](_0x26f1c4,_0xda6e('0xe3'));}else{rpcDb[_0xda6e('0xa0')](_0x1a0c89,'[callProgressDetectingCustomer][hangupInAMD]');}delete this[_0xda6e('0x12')][_0x155530['linkedid']];break;case'19':_0x4923f0[_0xda6e('0x3e')]+=0x1;_0x1a0c89['countglobal']=ut['totalGlobal'](_0x1a0c89);ut[_0xda6e('0x87')](_0x1a0c89,0x13,_0x155530[_0xda6e('0xe0')]||_0x155530['dialstatus']);ami[_0xda6e('0x25')](_0xda6e('0xe4'),ut['buildObj'](_0x1a0c89,_0xda6e('0xe2')));rpcDb[_0xda6e('0x8e')](_0x1a0c89,_0xda6e('0xe5'));if(ut['totalGlobal'](_0x1a0c89)>=_0x4923f0[_0xda6e('0x9e')]){_0x26f1c4=ut[_0xda6e('0xbf')](_0x1a0c89,0xf,_0xda6e('0x9f'));rpcDb[_0xda6e('0xa0')](_0x26f1c4,_0xda6e('0xe5'));}else{rpcDb[_0xda6e('0xa0')](_0x1a0c89,_0xda6e('0xe5'));}delete this[_0xda6e('0x12')][_0x155530['linkedid']];break;default:if(_0x1a0c89[_0xda6e('0x6d')]){ut[_0xda6e('0x76')](_0x4923f0,_0xda6e('0xe6'));ut[_0xda6e('0x77')](_0xda6e('0xe7')+_0x4923f0[_0xda6e('0x26')],_0x155530);}_0x4923f0[_0xda6e('0x3e')]+=0x1;_0x1a0c89[_0xda6e('0xb5')]=ut[_0xda6e('0x99')](_0x1a0c89);ut[_0xda6e('0x87')](_0x1a0c89,0xc,_0x155530[_0xda6e('0xe0')]||_0x155530[_0xda6e('0xe1')]);rpcDb[_0xda6e('0x8e')](_0x1a0c89,'[callProgressDetectingCustomer][logUnknown]');if(ut[_0xda6e('0x99')](_0x1a0c89)>=_0x4923f0[_0xda6e('0x9e')]){_0x26f1c4=ut[_0xda6e('0xbf')](_0x1a0c89,0xf,_0xda6e('0x9f'));rpcDb[_0xda6e('0xa0')](_0x26f1c4,_0xda6e('0xe8'));}else{rpcDb[_0xda6e('0xa0')](_0x1a0c89,'[callProgressDetectingCustomer][logUnknownGlobal]');}delete this[_0xda6e('0x12')][_0x155530[_0xda6e('0xa7')]];}if(!(_0x1a0c89['dialAnswer']&&_0x444d43==='16')){ut[_0xda6e('0xe9')](_0x4923f0,'[callProgressDetectingCustomer]');logger[_0xda6e('0x67')](_0xda6e('0xea'),_0x1a0c89[_0xda6e('0xac')],_0xda6e('0xad'),_0x4923f0[_0xda6e('0x26')],_0xda6e('0x6b'),_0x4923f0[_0xda6e('0x47')]);}if(_0x444d43!==_0xda6e('0xa8')){delete this[_0xda6e('0x12')][_0x155530[_0xda6e('0xa7')]];delete this['actions'][_0x155530[_0xda6e('0xeb')]];}}};Preview[_0xda6e('0xc')][_0xda6e('0xec')]=function(_0x21dd8f,_0x71c2b8,_0x16e2c2){if(_[_0xda6e('0xed')](_0x71c2b8)&&_0xda6e('0xee')!==typeof _0x71c2b8){return;}if(_[_0xda6e('0xed')](_0x16e2c2)&&'object'!==typeof _0x16e2c2){return;}switch(_0x16e2c2[_0xda6e('0xef')]){case'0':ut[_0xda6e('0xf0')](_0x21dd8f,0x0,_0xda6e('0xf1'));rpcDb[_0xda6e('0xf2')](_0x21dd8f,'[callProgressDetectingAgent][logNoSuch]');break;case'3':ut['logAgent'](_0x21dd8f,0x3,_0xda6e('0xc5'));rpcDb[_0xda6e('0xf2')](_0x21dd8f,'[callProgressDetectingAgent][logNoAnswer]');break;case'5':ut[_0xda6e('0xf0')](_0x21dd8f,0x5,_0xda6e('0xbb'));rpcDb[_0xda6e('0xf2')](_0x21dd8f,_0xda6e('0xf3'));break;case'8':ut[_0xda6e('0xf0')](_0x21dd8f,0x8,_0xda6e('0xce'));rpcDb[_0xda6e('0xf2')](_0x21dd8f,_0xda6e('0xf4'));break;case'22':ut[_0xda6e('0xf0')](_0x21dd8f,0x16,_0xda6e('0xf5'));rpcDb[_0xda6e('0xf2')](_0x21dd8f,'[callProgressDetectingAgent][logAnswerAGI]');break;default:ut[_0xda6e('0xf0')](_0x21dd8f,0xc,_0x16e2c2[_0xda6e('0xef')]);rpcDb[_0xda6e('0xf2')](_0x21dd8f,_0xda6e('0xf4'));}ut['updateOriginated'](_0x71c2b8,'[callProgressDetectingAgent]');logger[_0xda6e('0x67')](_0xda6e('0xf6'),_0x21dd8f['uniqueid'],_0xda6e('0xad'),_0x71c2b8[_0xda6e('0x26')],'originated:\x20',_0x71c2b8['originated']);delete this['actions'][_0x21dd8f['uniqueid']];};Preview[_0xda6e('0xc')]['checkInBlack']=function(_0x1c1e68,_0x318304,_0x264c17,_0x1498bd,_0x339432){var _0xc41004=this;return new BPromise(function(_0x3dc408,_0x582981){if(_[_0xda6e('0x66')](_0x318304)||_[_0xda6e('0x66')](_0x318304['Contact'])||_['isNil'](_0x318304['Contact'][_0xda6e('0xf7')])||_[_0xda6e('0x66')](_0x318304[_0xda6e('0xf8')])){_0x582981(ut[_0xda6e('0x46')](_0xda6e('0xf9'),_0x1498bd,_0x339432));return;}var _0x51650b=uuid['v4']();var _0xccf1de=_0xc41004[_0xda6e('0x24')][_0x318304[_0xda6e('0x69')]['name']];var _0xf0be12=_0x264c17?_0xc41004[_0xda6e('0x13')][_0x264c17]['id']:undefined;_0xc41004[_0xda6e('0x12')][_0x51650b]=new Action(_0x318304,_0xccf1de,_0x51650b,_0x264c17,_0xf0be12);var _0x51d548=_0xc41004[_0xda6e('0x12')][_0x51650b];_0x51d548['unlockAgent']=_0x1498bd;_0x51d548['activeContact']=_0x339432;_0x51d548[_0xda6e('0xfa')]=_0x264c17;if(_[_0xda6e('0xfb')](_0x1c1e68)){_0xc41004['execCall'](_0x51d548,_0xccf1de,_0x318304,_0x264c17)[_0xda6e('0x7c')](function(_0xf1ddcd){logger['info']('[Preview][execCall][success]',_0xda6e('0xfc')+_0x51d548[_0xda6e('0x6a')]+_0xda6e('0xfd')+_0x51d548[_0xda6e('0xfe')],JSON['stringify'](_0xf1ddcd));ami[_0xda6e('0x25')](_0xda6e('0xff'),ut[_0xda6e('0x9b')](_0x51d548,_0xda6e('0x100'),_0xc41004[_0xda6e('0x24')][_0x51d548[_0xda6e('0x6a')]]));_0x3dc408(ut[_0xda6e('0x46')](_0xda6e('0x101')));})[_0xda6e('0x73')](function(_0x16cc6d){ut['logger'](_0xda6e('0x102'),_0x16cc6d);_0x582981(ut['message']('Call\x20failed',_0x1498bd,_0x339432));});}else{_0xccf1de[_0xda6e('0x35')]+=0x1;ut[_0xda6e('0x103')](_0x51d548);rpcDb['createHistory'](_0x51d548,_0xda6e('0x104'));delete _0xc41004['actions'][_0x51650b];_0x582981(ut['message'](_0xda6e('0x105'),_0x1498bd,_0x339432));}});};Preview[_0xda6e('0xc')][_0xda6e('0x94')]=function(_0x11620e){return!_[_0xda6e('0x66')](_0x11620e)&&!_[_0xda6e('0x66')](_0x11620e[_0xda6e('0x26')])&&!_[_0xda6e('0x66')](_0x11620e[_0xda6e('0x4e')])&&_0x11620e[_0xda6e('0x4e')]&&!_[_0xda6e('0x66')](this[_0xda6e('0x11')][util[_0xda6e('0x53')](_0xda6e('0x106'),_0x11620e[_0xda6e('0x26')])])&&!_[_0xda6e('0x66')](this[_0xda6e('0x11')][util[_0xda6e('0x53')](_0xda6e('0x106'),_0x11620e[_0xda6e('0x26')])]['status'])&&(this[_0xda6e('0x11')][util[_0xda6e('0x53')](_0xda6e('0x106'),_0x11620e['name'])][_0xda6e('0x71')]===_0xda6e('0x107')||this[_0xda6e('0x11')][util['format'](_0xda6e('0x106'),_0x11620e[_0xda6e('0x26')])][_0xda6e('0x71')]==='unmonitored');};Preview[_0xda6e('0xc')][_0xda6e('0x82')]=function(_0x5ac1bd,_0x2905f3){var _0x2fd19f=this;return new BPromise(function(_0x13f60e,_0x586eb1){_0x2fd19f['execRun'](_0x5ac1bd,_0x2905f3)[_0xda6e('0x7c')](function(_0x5c5a37){_0x13f60e(_[_0xda6e('0x6e')](_0x5c5a37,[_0xda6e('0x46')]));})[_0xda6e('0x73')](function(_0x1ed7c2){if(_0x1ed7c2[_0xda6e('0x108')]){rpcDb['unlockContact'](_0x5ac1bd);}if(_0x1ed7c2[_0xda6e('0x4e')]){rpcDb['disableContact'](_0x5ac1bd);}_0x586eb1(_['pick'](_0x1ed7c2,['message']));});});};Preview[_0xda6e('0xc')][_0xda6e('0x109')]=function(_0x45116f,_0x53bc05){var _0x54eee3=this;return new BPromise(function(_0x9c0ee3,_0x33b110){var _0x2a2161,_0x3ba9f5;rpcDb['getContactPreview'](_0x45116f)[_0xda6e('0x7c')](function(_0x344648){if(!_[_0xda6e('0x66')](_0x344648[0x0])){_0x3ba9f5=_0x344648[0x0]['recallme']?![]:!![];_0x2a2161=_0x344648[0x0]['recallme']?!![]:![];_0x2a2161=_0x53bc05?!![]:_0x2a2161;}var _0xc6ecea=_0x54eee3[_0xda6e('0x10a')](_0x344648);if(_0xc6ecea[_0xda6e('0x10b')]){rpcDb[_0xda6e('0x10c')](_['pick'](_0x344648[0x0],[_0xda6e('0xf8'),_0xda6e('0x10d')]))[_0xda6e('0x7c')](function(_0x1bb153){_0x54eee3[_0xda6e('0x10e')](_0x1bb153,_0x344648[0x0],_0x53bc05,_0x3ba9f5,_0x2a2161)[_0xda6e('0x7c')](function(_0x2829c){_0x9c0ee3(_0x2829c);})['catch'](function(_0xba8ccf){_0x33b110(_0xba8ccf);});})[_0xda6e('0x73')](function(_0x4356a2){ut[_0xda6e('0x5b')](_0xda6e('0x10f'),_0x4356a2);_0x33b110(ut[_0xda6e('0x46')](_0xda6e('0x110'),_0x3ba9f5,_0x2a2161));});}else{_0x33b110(ut[_0xda6e('0x46')](_0xc6ecea[_0xda6e('0x46')],_0x3ba9f5,_0x2a2161));}})[_0xda6e('0x73')](function(_0x15a04d){ut[_0xda6e('0x5b')]('[Preview][getContactPreview]',_0x15a04d);_0x33b110(ut[_0xda6e('0x46')]('Call\x20unsuccessful',![],!![]));});});};Preview[_0xda6e('0xc')][_0xda6e('0x10a')]=function(_0x4b4d34){if(_['isNil'](_0x4b4d34)||_[_0xda6e('0xfb')](_0x4b4d34)||!_[_0xda6e('0x66')](_0x4b4d34[0x0][_0xda6e('0x80')])&&_[_0xda6e('0x66')](_0x4b4d34[0x0][_0xda6e('0x80')][_0xda6e('0x26')])){ut[_0xda6e('0x5b')](_0xda6e('0x111'),_0x4b4d34);return{'isValid':![],'message':'Empty\x20Contact'};}var _0x10472b=this[_0xda6e('0x24')][_0x4b4d34[0x0]['Queue'][_0xda6e('0x26')]];_0x10472b[_0xda6e('0x46')]=_0xda6e('0x96');if(_['isNil'](_0x10472b)){ut[_0xda6e('0x5b')](_0xda6e('0x112'),_0x10472b);return{'isValid':![],'message':_0xda6e('0x113')};}if(!this[_0xda6e('0x94')](_0x10472b['Trunk'])){ut[_0xda6e('0x5b')](_0xda6e('0x114'),_0xda6e('0x115')+_0x10472b[_0xda6e('0x26')]+_0xda6e('0x116'));if(!this[_0xda6e('0x94')](_0x10472b[_0xda6e('0x95')])){ut[_0xda6e('0x5b')](_0xda6e('0x114'),_0x10472b[_0xda6e('0x26')]+_0xda6e('0x117'));return{'isValid':![],'message':'Trunk\x20not\x20work'};}}if(!ut[_0xda6e('0x93')](_0x10472b[_0xda6e('0x30')])){ut[_0xda6e('0x5b')](_0xda6e('0x118'),_0x10472b[_0xda6e('0x26')]+_0xda6e('0x119'));return{'isValid':![],'message':_0xda6e('0x115')+_0x10472b[_0xda6e('0x26')]+_0xda6e('0x119')};}return{'isValid':!![],'message':'Is\x20Valid'};};Preview[_0xda6e('0xc')][_0xda6e('0x11a')]=function(_0x483d0a,_0x382b92,_0x726733,_0x426719){var _0x12a9e8=this;return new BPromise(function(_0x1f5a88,_0x561419){var _0x31d04c=_0x483d0a[_0xda6e('0xac')];var _0x518719=_0x12a9e8[_0xda6e('0x94')](_0x382b92[_0xda6e('0x4d')])?util[_0xda6e('0x53')](_0xda6e('0x11b'),_0x382b92[_0xda6e('0x4d')]['name'],_[_0xda6e('0x66')](_0x382b92[_0xda6e('0x11c')])?'':_0x382b92[_0xda6e('0x11c')][_0xda6e('0x11d')]()||'',_0x382b92[_0xda6e('0x11e')]>0x0?_0x726733[_0xda6e('0x11f')][_0xda6e('0xf7')][_0xda6e('0x120')](_0x382b92[_0xda6e('0x11e')]):_0x726733[_0xda6e('0x11f')]['phone']):util[_0xda6e('0x53')]('SIP/%s/%s%s',_[_0xda6e('0x66')](_0x382b92[_0xda6e('0x95')])?_0x382b92[_0xda6e('0x4d')][_0xda6e('0x26')]:_0x382b92[_0xda6e('0x95')][_0xda6e('0x26')],_[_0xda6e('0x66')](_0x382b92[_0xda6e('0x11c')])?'':_0x382b92['dialPrefix'][_0xda6e('0x11d')]()||'',_0x382b92['dialCutDigit']>0x0?_0x726733['Contact'][_0xda6e('0xf7')][_0xda6e('0x120')](_0x382b92[_0xda6e('0x11e')]):_0x726733[_0xda6e('0x11f')][_0xda6e('0xf7')]);var _0x35eefd=_0x12a9e8[_0xda6e('0x94')](_0x382b92[_0xda6e('0x4d')])?ut[_0xda6e('0x121')](_0x382b92[_0xda6e('0x4d')]['callerid'],_0x382b92[_0xda6e('0x32')],_0x382b92[_0xda6e('0x122')]>0x0?ut[_0xda6e('0x123')](_0x382b92[_0xda6e('0x124')],_0x382b92[_0xda6e('0x122')]):_0x382b92[_0xda6e('0x124')]):ut[_0xda6e('0x121')](_[_0xda6e('0x66')](_0x382b92[_0xda6e('0x95')])?_0x382b92[_0xda6e('0x4d')][_0xda6e('0x4f')]:_0x382b92[_0xda6e('0x95')][_0xda6e('0x4f')],_0x382b92[_0xda6e('0x32')],_0x382b92[_0xda6e('0x122')]>0x0?ut[_0xda6e('0x123')](_0x382b92[_0xda6e('0x124')],_0x382b92[_0xda6e('0x122')]):_0x382b92[_0xda6e('0x124')]);if(_0x35eefd){_0x483d0a[_0xda6e('0x125')]=ut['extractCalleridName'](_0x35eefd);_0x483d0a[_0xda6e('0x126')]=ut['extractCalleridNumber'](_0x35eefd);}var _0x5a1a27=ut[_0xda6e('0x127')](_0x382b92,_0x726733,_0x518719,_0x35eefd,_0x31d04c,_0x483d0a);_[_0xda6e('0x128')](_0x483d0a,ut['toLowerVariables'](_0x5a1a27));_0x483d0a[_0xda6e('0x86')]=moment()[_0xda6e('0x53')](_0xda6e('0xa9'));ami[_0xda6e('0x70')](ut[_0xda6e('0x129')](_0x483d0a,_0x382b92,_0x5a1a27,_0x483d0a['activeContact'],_0x426719))[_0xda6e('0x7c')](function(_0x26d071){var _0x5f2606=_0x483d0a[_0xda6e('0x12a')];if(!_[_0xda6e('0x66')](_0x5f2606)){if(!_['isNil'](_0x12a9e8['agents'][_0x5f2606])){_0x12a9e8[_0xda6e('0x13')][_0x5f2606][_0xda6e('0x12b')]=_0x483d0a['calleridnum'];emit(util[_0xda6e('0x53')](_0xda6e('0x12c'),_0x12a9e8[_0xda6e('0x13')][_0x5f2606][_0xda6e('0x26')]),'user:agentconnect',{'destaccountcode':_0x12a9e8[_0xda6e('0x13')][_0x5f2606][_0xda6e('0x12d')],'destconnectedlinenum':_0x483d0a[_0xda6e('0x12e')]});}}_0x382b92[_0xda6e('0x47')]+=0x1;logger[_0xda6e('0x67')](_0xda6e('0x12f'),_0x31d04c,_0xda6e('0xad'),_0x382b92[_0xda6e('0x26')],_0xda6e('0x6b'),_0x382b92['originated']);_0x1f5a88(_0x26d071);})['catch'](function(_0x2e2aa8){ut['logAgent'](_0x483d0a,0xe,'OriginateError');rpcDb[_0xda6e('0xf2')](_0x483d0a,_0xda6e('0x130'));_0x561419(_0x2e2aa8);});});};Preview[_0xda6e('0xc')][_0xda6e('0x1e')]=function(_0x6ecf0f){if(this[_0xda6e('0x12')][_0x6ecf0f[_0xda6e('0xa7')]]){this[_0xda6e('0x12')][_0x6ecf0f['linkedid']]['channel']=_0x6ecf0f[_0xda6e('0x72')];}};Preview[_0xda6e('0xc')][_0xda6e('0x16')]=function(_0x50dfd6){var _0x5a3a05=this;var _0x26464e=this[_0xda6e('0x12')][_0x50dfd6[_0xda6e('0x131')]];if(_0x26464e){if(_0x26464e[_0xda6e('0xfa')]&&this[_0xda6e('0x13')][_0x26464e[_0xda6e('0xfa')]]){ut[_0xda6e('0x132')](_0x26464e,this['agents'][_0x26464e[_0xda6e('0xfa')]]['name'],this['agents'][_0x26464e[_0xda6e('0xfa')]]['id']);}var _0x1da43d=_[_0xda6e('0x133')](_0x26464e);_0x1da43d[_0xda6e('0xaa')]=moment()['format'](_0xda6e('0xa9'));var _0x1cc931=_0x5a3a05[_0xda6e('0x24')][_0x26464e[_0xda6e('0x6a')]];if(ut[_0xda6e('0x134')](_0x50dfd6[_0xda6e('0x135')])){if(_0x26464e[_0xda6e('0xa5')]){rpcDb['unlockContact'](_0x26464e[_0xda6e('0xfe')]);}if(_0x26464e[_0xda6e('0xa6')]){rpcDb[_0xda6e('0x85')](_0x26464e[_0xda6e('0xfe')]);}ami[_0xda6e('0x25')](_0xda6e('0x136'),ut[_0xda6e('0x9b')](_0x26464e,_0xda6e('0x137'),this[_0xda6e('0x24')][_0x26464e['queue']]));this[_0xda6e('0xec')](_0x1da43d,_0x1cc931,_0x50dfd6);}else{_0x26464e['starttime']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');ut[_0xda6e('0xf0')](_0x1da43d,0x4,_0xda6e('0xb6'));rpcDb[_0xda6e('0xf2')](_0x1da43d,_0xda6e('0x138'));}}};Preview['prototype'][_0xda6e('0x19')]=function(_0x3e801a){var _0x244136=this;var _0x353d88=this['actions'][_0x3e801a[_0xda6e('0xa7')]];var _0x2fcc32;if(_0x353d88){_0x2fcc32=this[_0xda6e('0x24')][_0x353d88[_0xda6e('0x6a')]];logger[_0xda6e('0x67')](_0xda6e('0x139'),_0x3e801a[_0xda6e('0xa7')],'\x20Queue',_0x2fcc32[_0xda6e('0x26')],_0xda6e('0x6c'),_0x2fcc32[_0xda6e('0x58')]);}if(this[_0xda6e('0x12')][_0x3e801a[_0xda6e('0xa7')]]&&_0x3e801a['linkedid']!==_0x3e801a[_0xda6e('0xac')]){if(_0x3e801a[_0xda6e('0x13a')]==='16'&&this['actions'][_0x3e801a[_0xda6e('0xa7')]][_0xda6e('0x6d')]){this[_0xda6e('0x97')](_0x3e801a,_0x3e801a[_0xda6e('0xa7')],_0x3e801a[_0xda6e('0x13a')]);}else if(this[_0xda6e('0x12')][_0x3e801a[_0xda6e('0xa7')]][_0xda6e('0x6d')]){logger[_0xda6e('0x67')](_0xda6e('0x13b'),_0x3e801a[_0xda6e('0xa7')],_0x3e801a[_0xda6e('0x13a')],'\x20Queue',_0x2fcc32[_0xda6e('0x26')],_0xda6e('0x6c'),_0x2fcc32[_0xda6e('0x58')]);this[_0xda6e('0x97')](_0x3e801a,_0x3e801a['linkedid'],_0x3e801a['cause']);}}else if(_0x353d88&&_['isNil'](_0x353d88[_0xda6e('0x13c')])&&_0x2fcc32[_0xda6e('0x13d')]&&_0x3e801a['linkedid']===_0x3e801a['uniqueid']&&_[_0xda6e('0x66')](_0x3e801a[_0xda6e('0xef')])&&_0x3e801a['cause']==='16'&&_0x3e801a[_0xda6e('0x13e')]==='6'&&_[_0xda6e('0xed')](_0x353d88[_0xda6e('0x13f')])){if(_0x353d88[_0xda6e('0xa5')]){rpcDb[_0xda6e('0x140')](_0x353d88[_0xda6e('0xfe')]);}if(_0x353d88['activeContact']){rpcDb['disableContact'](_0x353d88['idContact']);}_0x3e801a['reason']='22';this[_0xda6e('0xec')](_0x353d88,_0x2fcc32,_0x3e801a);}else if(_0x353d88&&_0x353d88[_0xda6e('0x13f')]){if(_0x3e801a['cause']==='16'&&this['actions'][_0x3e801a[_0xda6e('0xa7')]][_0xda6e('0x6d')]){logger['info'](_0xda6e('0x141'),_0x3e801a[_0xda6e('0xa7')],_0x3e801a[_0xda6e('0x13a')],'\x20Queue',_0x2fcc32[_0xda6e('0x26')],_0xda6e('0x6c'),_0x2fcc32[_0xda6e('0x58')]);this[_0xda6e('0x97')](_0x3e801a,_0x3e801a[_0xda6e('0xa7')],_0x3e801a[_0xda6e('0x13a')]);}else if(this[_0xda6e('0x12')][_0x3e801a[_0xda6e('0xa7')]][_0xda6e('0x6d')]){logger[_0xda6e('0x67')](_0xda6e('0x13b'),_0x3e801a[_0xda6e('0xa7')],_0x3e801a['cause'],_0xda6e('0xad'),_0x2fcc32['name'],_0xda6e('0x6c'),_0x2fcc32[_0xda6e('0x58')]);this[_0xda6e('0x97')](_0x3e801a,_0x3e801a[_0xda6e('0xa7')],_0x3e801a['cause']);}}};Preview[_0xda6e('0xc')]['syncDialEnd']=function(_0x12174f){if(this['actions'][_0x12174f[_0xda6e('0xeb')]]&&_0x12174f[_0xda6e('0xeb')]!==_0x12174f[_0xda6e('0x142')]){this['callProgressDetectingCustomer'](_0x12174f,_0x12174f['destlinkedid'],_0x12174f[_0xda6e('0xe1')]);}};Preview[_0xda6e('0xc')][_0xda6e('0x1b')]=function(_0x159687){if(this[_0xda6e('0x12')][_0x159687[_0xda6e('0xa7')]]&&_0x159687['linkedid']!==_0x159687[_0xda6e('0xac')]&&!this[_0xda6e('0x12')][_0x159687[_0xda6e('0xa7')]]['dialAnswer']){if(_0x159687['cause']==='1'){this[_0xda6e('0x97')](_0x159687,_0x159687[_0xda6e('0xa7')],_0x159687[_0xda6e('0x13a')]);}}};Preview[_0xda6e('0xc')]['addVariable']=function(_0x479f79,_0x4aaf0c,_0x360abd){if(this['actions'][_0x479f79]){if(_[_0xda6e('0x66')](this[_0xda6e('0x12')][_0x479f79][_0xda6e('0x143')])){this[_0xda6e('0x12')][_0x479f79][_0xda6e('0x143')]={};}this[_0xda6e('0x12')][_0x479f79][_0xda6e('0x143')][_0x4aaf0c]=_0x360abd;}};Preview[_0xda6e('0xc')]['syncVarSet']=function(_0x80bf2b){try{if(!_[_0xda6e('0x66')](_0x80bf2b)){if(ut[_0xda6e('0x144')](_[_0xda6e('0x145')](_0x80bf2b['variable'])[0x0])){this[_0xda6e('0x146')](_0x80bf2b[_0xda6e('0xac')],_[_0xda6e('0x145')](_0x80bf2b['variable'])[0x0],_0x80bf2b[_0xda6e('0x147')]);}}}catch(_0x471ebf){logger[_0xda6e('0x148')](_0xda6e('0x149'),util['inspect'](_0x471ebf,{'showHidden':![],'depth':null}));}};Preview['prototype'][_0xda6e('0x14a')]=function(_0x22ab8e){if(_0x22ab8e){if(this['actions'][_0x22ab8e[_0xda6e('0x14b')]]){this[_0xda6e('0x12')][_0x22ab8e['transfertargetlinkedid']][_0xda6e('0x13f')]=!![];}}};Preview[_0xda6e('0xc')][_0xda6e('0x22')]=function(_0x36a981){if(_0x36a981){if(this['actions'][_0x36a981[_0xda6e('0x14c')]]){this[_0xda6e('0x12')][_0x36a981[_0xda6e('0x14c')]]['transfer']=!![];}}};module[_0xda6e('0x14d')]=Preview; \ No newline at end of file +var _0xc4aa=['syncCampaigns','hasOwnProperty','preview','type','setMessage','recallMe','clearZombieChannel','enqueue','[clearZombieChannels][talking]','Queue','originated:\x20','queue','pTalking:\x20','pick','contactId','UserId','VoiceQueueId','ListId','status','channel','catch','No\x20such\x20channel','updateOriginated','dialAnswer','decrementTalkink','[clearZombieChannel]','loggerError','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','[action]','size','getContactRecallMe','agentReadyId','then','isNil','length','getDiff','dialRecallMeTimeout','voicePause','run','logger2','[RecallMe]','logCustomer','dialRecallInQueue','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','[HistoryRecallClose]','[getContactRecallMe]','IsNotLoggedIn','AGENTS_NOT_LOGGED','isActive','TrunkBackup','TRUNK_IS_NOT_REACHABLE','ACTIVE','callProgressDetectingCustomer','countglobal','totalGlobal','NoSuchNumber','buildObj','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','dialGlobalMaxRetry','Global','createCustomerFinal','[callProgressDetectingCustomer][logNoSuchGlobal]','countnosuchnumberretry','dialNoSuchNumberMaxRetry','rescheduleContact','scheduledAt','dialNoSuchNumberRetryFrequency','unlockAgent','activeContact','linkedid','YYYY-MM-DD\x20HH:mm:ss','responsetime','[syncHangup][talking][increment]','\x20Queue','custom:agentconnect','connect','buildAcw','custom:agentcomplete','complete','outboundAnswerCallsDay','[16]','Answer','[callProgressDetectingCustomer][logAnswerGlobal]','talktime','[syncHangup][talking][decrement]','uniqueid','BUSY','countbusyretry','Busy','busy','cloneAction','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','[callProgressDetectingCustomer][logBusy]','NoAnswer','custom:agentnoanswer','noanswer','[callProgressDetectingCustomer][logNoAnswer]','[callProgressDetectingCustomer][logNoAnswerGlobal]','countnoanswerretry','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','CONGESTION','countcongestionretry','Congestion','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','dialCongestionMaxRetry','dialBusyRetryFrequency','CANCEL','countagentrejectretry','AgentReject','custom:agentreject','agentreject','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','ABANDONED','countabandonedretry','Abandoned','countabandonedetry','dialAbandonedMaxRety','[callProgressDetectingCustomer][logAbandoned]','dialAbandonedRetryFrequency','cause-txt','[callProgressDetectingCustomer][hangupInAMD]','dialstatus','custom:amd','amd','[callProgressDetectingCustomer][machine]','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','[originated][decrement][callProgressDetectingCustomer]','ANSWER','callProgressDetectingAgent','isUndefined','object','reason','logAgent','createAgentHistory','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','checkInBlack','Contact','phone','Contact\x20is\x20undefined','isEmpty','execCall','[Preview][execCall][success]','Queue:\x20','idContact','custom:agentcalled','called','Calling','[Preview][execCall][failure]','Call\x20failed','logBlacklist','isTrunkReachable','SIP/%s','reachable','unmonitored','execRun','unlockContact','disableContact','recallme','validateContact','isValid','logger','[Preview][checkIsBlackList]','Call\x20unsuccessful','[Preview][getContactPreview]','Agent','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','[Preview][validateContact][Trunk\x20not\x20work]','\x20Trunk\x20Backup\x20is\x20not\x20active','Trunk\x20not\x20work','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','Is\x20Valid','SIP/%s/%s%s','trim','dialCutDigit','substring','getCallerId','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','originatecalleridname','extractCalleridName','extractCalleridNumber','addVariables','merge','toLowerVariables','Action','channelAgent','destconnectedlinenum','user:%s','user:agentconnect','accountcode','calleridnum','[originated][increment]','OriginateError','[originateFailure][logOriginateFailure]','syncOriginateResponse','lookAgent','logLookAgent','clone','isFailure','response','custom:agentringnoanswer','rejected','starttime','[callProgressDetectingAgent][logAnswer]','[syncHangup][talking]','cause','[syncHangup][talking][cause]','channelstate','transfer','[syncHangup][talking][transfer]','syncDialEnd','destlinkedid','syncHangupRequest','addVariable','variables','filterKey','keys','variable','value','error','inspect','transfertargetlinkedid','transfererlinkedid','exports','util','uuid','moment','md5','ioredis','../../../config/environment','../../../config/logger','actionPreview','../ami','./rpcDb','./action','redis','localhost','socket.io-emitter','prototype','tail','finally','sequence','voiceQueues','trunks','actions','agents','clockClearZombieChannels','originateresponse','bind','hangup','syncHangup','newexten','syncNewExten','varset','syncVarSet','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','loopCampaigns','campaignsPreview','emit','outbound','name','strategy','answered','available','loggedIn','pTalking','sumBillable','sumDuration','sumHoldTime','talking','total','abandoned','waiting','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundBlacklistCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','active','callerid','Interval','voice_queue:save','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','stringify','format','voice:queue:%s','voice_queue_channel:remove','voice_queue_presence:remove','sendMessageOneNotActive','NOT_ACTIVE','[CampaignPreview]\x20Campaign\x20Queue:\x20','message','IS_DISACTIVED','\x20is\x20disactive'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xc4aa,0xf9));var _0xac4a=function(_0x51020b,_0x38c2c7){_0x51020b=_0x51020b-0x0;var _0x371e47=_0xc4aa[_0x51020b];return _0x371e47;};'use strict';var util=require(_0xac4a('0x0'));var _=require('lodash');var BPromise=require('bluebird');var uuid=require(_0xac4a('0x1'));var moment=require(_0xac4a('0x2'));var md5=require(_0xac4a('0x3'));var Redis=require(_0xac4a('0x4'));var config=require(_0xac4a('0x5'));var logger=require('../../../config/logger')('preview');var loggerAction=require(_0xac4a('0x6'))(_0xac4a('0x7'));var ami=require(_0xac4a('0x8'));var rpcDb=require(_0xac4a('0x9'));var Action=require(_0xac4a('0xa'));var ut=require('./util/util');config[_0xac4a('0xb')]=_['defaults'](config['redis'],{'host':_0xac4a('0xc'),'port':0x18eb});var io=require(_0xac4a('0xd'))(new Redis(config[_0xac4a('0xb')]));var Sequence=function(){};Sequence[_0xac4a('0xe')]['enqueue']=function(_0x1be171){this[_0xac4a('0xf')]=this['tail']?this['tail'][_0xac4a('0x10')](_0x1be171):_0x1be171();};function Preview(_0x13e354){this[_0xac4a('0x11')]=new Sequence();this['campaignsPreview']=_0x13e354[_0xac4a('0x12')];this[_0xac4a('0x13')]=_0x13e354[_0xac4a('0x13')];this[_0xac4a('0x14')]={};this['agents']=_0x13e354[_0xac4a('0x15')];this[_0xac4a('0x16')]=0x0;ami['on'](_0xac4a('0x17'),this['syncOriginateResponse'][_0xac4a('0x18')](this));ami['on'](_0xac4a('0x19'),this[_0xac4a('0x1a')][_0xac4a('0x18')](this));ami['on']('hanguprequest',this['syncHangupRequest'][_0xac4a('0x18')](this));ami['on']('dialend',this['syncDialEnd'][_0xac4a('0x18')](this));ami['on'](_0xac4a('0x1b'),this[_0xac4a('0x1c')]['bind'](this));ami['on'](_0xac4a('0x1d'),this[_0xac4a('0x1e')][_0xac4a('0x18')](this));ami['on'](_0xac4a('0x1f'),this[_0xac4a('0x20')]['bind'](this));ami['on'](_0xac4a('0x21'),this[_0xac4a('0x22')][_0xac4a('0x18')](this));this[_0xac4a('0x23')](this[_0xac4a('0x24')]);}function emit(_0x211d2b,_0xa33125,_0xc65a62){io['to'](_0x211d2b)[_0xac4a('0x25')](_0xa33125,_0xc65a62);}function emitCampaignPreview(_0x52d1af){if(_0x52d1af['type']===_0xac4a('0x26')){var _0x35ede0={'id':_0x52d1af['id'],'name':_0x52d1af[_0xac4a('0x27')],'strategy':_0x52d1af[_0xac4a('0x28')],'answered':_0x52d1af[_0xac4a('0x29')],'available':_0x52d1af[_0xac4a('0x2a')],'loggedIn':_0x52d1af[_0xac4a('0x2b')],'pTalking':_0x52d1af[_0xac4a('0x2c')],'sumBillable':_0x52d1af[_0xac4a('0x2d')],'sumDuration':_0x52d1af[_0xac4a('0x2e')],'sumHoldTime':_0x52d1af[_0xac4a('0x2f')]||0x0,'talking':_0x52d1af[_0xac4a('0x30')],'total':_0x52d1af[_0xac4a('0x31')],'type':_0x52d1af['type'],'unmanaged':_0x52d1af['unmanaged'],'abandoned':_0x52d1af[_0xac4a('0x32')],'waiting':_0x52d1af[_0xac4a('0x33')],'loggedInDb':_0x52d1af[_0xac4a('0x34')],'dialActive':_0x52d1af[_0xac4a('0x35')],'dialMethod':_0x52d1af[_0xac4a('0x36')],'dialOriginateCallerIdName':_0x52d1af[_0xac4a('0x37')],'dialOriginateCallerIdNumber':_0x52d1af[_0xac4a('0x38')],'dialOriginateTimeout':_0x52d1af[_0xac4a('0x39')],'dialPrefix':_0x52d1af[_0xac4a('0x3a')],'outboundAnswerAgiCallsDay':_0x52d1af['outboundAnswerAgiCallsDay'],'outboundAnswerCallsDay':_0x52d1af['outboundAnswerCallsDay'],'outboundBlacklistCallsDay':_0x52d1af[_0xac4a('0x3b')],'outboundBusyCallsDay':_0x52d1af['outboundBusyCallsDay'],'outboundCongestionCallsDay':_0x52d1af[_0xac4a('0x3c')],'outboundDropCallsDayACS':_0x52d1af[_0xac4a('0x3d')],'outboundDropCallsDayCallersExit':_0x52d1af[_0xac4a('0x3e')],'outboundDropCallsDayTimeout':_0x52d1af[_0xac4a('0x3f')],'outboundNoAnswerCallsDay':_0x52d1af[_0xac4a('0x40')],'outboundNoSuchCallsDay':_0x52d1af[_0xac4a('0x41')],'outboundOriginateFailureCallsDay':_0x52d1af[_0xac4a('0x42')],'outboundReCallsDay':_0x52d1af[_0xac4a('0x43')],'outboundRejectCallsDay':_0x52d1af[_0xac4a('0x44')],'outboundUnknownCallsDay':_0x52d1af[_0xac4a('0x45')],'outboundAbandonedCallsDay':_0x52d1af['outboundAbandonedCallsDay'],'predictiveIntervalAnsweredCalls':_0x52d1af[_0xac4a('0x46')],'predictiveIntervalAvgHoldtime':_0x52d1af[_0xac4a('0x47')],'predictiveIntervalAvgTalktime':_0x52d1af[_0xac4a('0x48')],'predictiveIntervalDroppedCallsCallersExit':_0x52d1af[_0xac4a('0x49')],'predictiveIntervalDroppedCallsTimeout':_0x52d1af[_0xac4a('0x4a')],'predictiveIntervalErlangCalls':_0x52d1af[_0xac4a('0x4b')],'predictiveIntervalErlangCallsDroppedCalls':_0x52d1af[_0xac4a('0x4c')],'predictiveIntervalHitRate':_0x52d1af[_0xac4a('0x4d')],'predictiveIntervalMultiplicativeFactor':_0x52d1af[_0xac4a('0x4e')],'predictiveIntervalPauses':_0x52d1af[_0xac4a('0x4f')],'predictiveIntervalAvailable':_0x52d1af[_0xac4a('0x50')],'predictiveIntervalTotalCalls':_0x52d1af[_0xac4a('0x51')],'message':_0x52d1af['message'],'originated':_0x52d1af[_0xac4a('0x52')],'erlangCalls':_0x52d1af[_0xac4a('0x53')],'erlangCallToSecond':_0x52d1af[_0xac4a('0x54')],'erlangAbandonmentRate':_0x52d1af[_0xac4a('0x55')],'erlangBusyFactor':_0x52d1af[_0xac4a('0x56')],'startPredictive':_0x52d1af[_0xac4a('0x57')],'startProgressive':_0x52d1af[_0xac4a('0x58')]};if(_0x52d1af[_0xac4a('0x59')]){_0x35ede0[_0xac4a('0x59')]={'id':_0x52d1af[_0xac4a('0x59')]['id'],'name':_0x52d1af[_0xac4a('0x59')][_0xac4a('0x27')],'active':_0x52d1af['Trunk'][_0xac4a('0x5a')],'callerid':_0x52d1af['Trunk'][_0xac4a('0x5b')]};}if(_0x52d1af['Interval']){_0x35ede0[_0xac4a('0x5c')]={'id':_0x52d1af[_0xac4a('0x5c')]['id'],'name':_0x52d1af[_0xac4a('0x5c')][_0xac4a('0x27')]};}var _0x313b47=md5(JSON['stringify'](_0x35ede0));if(_0x52d1af[_0xac4a('0x3')]!==_0x313b47){_0x52d1af[_0xac4a('0x3')]=_0x313b47;emit(util['format']('voice:queue:%s',_0x35ede0[_0xac4a('0x27')]),_0xac4a('0x5d'),_0x35ede0);}}}function emitVoiceQueueChannelRemove(_0x280414){logger[_0xac4a('0x5e')](_0xac4a('0x5f'),JSON[_0xac4a('0x60')](_0x280414));emit(util[_0xac4a('0x61')](_0xac4a('0x62'),_0x280414['name']),_0xac4a('0x63'),_0x280414);io[_0xac4a('0x25')](_0xac4a('0x64'),_0x280414);}function notSendMessagesQueue(_0x56b041){if(_0x56b041[_0xac4a('0x65')]){if(_0x56b041[_0xac4a('0x52')]===0x0&&_0x56b041[_0xac4a('0x2c')]===0x0){_0x56b041[_0xac4a('0x65')]=![];_0x56b041[_0xac4a('0x2a')]=0x0;_0x56b041['paused']=0x0;_0x56b041['message']=_0xac4a('0x66');ut['logger'](_0xac4a('0x67'),_0x56b041[_0xac4a('0x27')]+'\x20is\x20not\x20active');}else{_0x56b041[_0xac4a('0x68')]=_0xac4a('0x69');ut['logger'](_0xac4a('0x67'),_0x56b041[_0xac4a('0x27')]+_0xac4a('0x6a'));}emitCampaignPreview(_0x56b041);}}Preview['prototype'][_0xac4a('0x23')]=function(){var _0x27651e=this;setInterval(function(){_0x27651e[_0xac4a('0x6b')]();},0x7cf);};Preview[_0xac4a('0xe')][_0xac4a('0x6b')]=function(){var _0xf4c3f0=this[_0xac4a('0x24')];this[_0xac4a('0x16')]+=0x1;for(var _0x1c0dfd in _0xf4c3f0){if(_0xf4c3f0[_0xac4a('0x6c')](_0x1c0dfd)&&(_0xf4c3f0[_0x1c0dfd][_0xac4a('0x36')]===_0xac4a('0x6d')||_0xf4c3f0[_0x1c0dfd][_0xac4a('0x36')]==='booked')&&_0xf4c3f0[_0x1c0dfd][_0xac4a('0x6e')]===_0xac4a('0x26')){if(this[_0xac4a('0x16')]>0x7){this[_0xac4a('0x16')]=0x0;this['clearZombieChannels']();}}if(_0xf4c3f0[_0xac4a('0x6c')](_0x1c0dfd)&&_0xf4c3f0[_0x1c0dfd]['dialMethod']===_0xac4a('0x6d')&&_0xf4c3f0[_0x1c0dfd][_0xac4a('0x6e')]===_0xac4a('0x26')){if(_0xf4c3f0[_0x1c0dfd][_0xac4a('0x35')]){this[_0xac4a('0x6f')](_0xf4c3f0[_0x1c0dfd]);this[_0xac4a('0x70')](_0xf4c3f0[_0x1c0dfd]);}else{notSendMessagesQueue(_0xf4c3f0[_0x1c0dfd]);}}}};Preview[_0xac4a('0xe')][_0xac4a('0x71')]=function(_0x229b22){var _0x5d547b=this;this[_0xac4a('0x11')][_0xac4a('0x72')](function(){if(!_['isNil'](_0x5d547b['actions'][_0x229b22])){loggerAction[_0xac4a('0x5e')](_0xac4a('0x73'),_0x229b22,_0xac4a('0x74'),_0x5d547b['actions'][_0x229b22]['queue'],_0xac4a('0x75'),JSON['stringify'](_0x5d547b[_0xac4a('0x24')][_0x5d547b[_0xac4a('0x14')][_0x229b22][_0xac4a('0x76')]][_0xac4a('0x52')]),_0xac4a('0x77'),JSON[_0xac4a('0x60')](_0x5d547b[_0xac4a('0x24')][_0x5d547b['actions'][_0x229b22][_0xac4a('0x76')]][_0xac4a('0x2c')]),JSON[_0xac4a('0x60')](_0x5d547b[_0xac4a('0x14')][_0x229b22]['dialAnswer']),JSON[_0xac4a('0x60')](_[_0xac4a('0x78')](_0x5d547b[_0xac4a('0x14')][_0x229b22],[_0xac4a('0x79'),_0xac4a('0x7a'),_0xac4a('0x7b'),_0xac4a('0x7c')])));return ami['Action']({'action':_0xac4a('0x7d'),'channel':_0x5d547b[_0xac4a('0x14')][_0x229b22][_0xac4a('0x7e')]})[_0xac4a('0x7f')](function(_0x186496){if(_0x186496['message']===_0xac4a('0x80')){setTimeout(function(){if(_0x5d547b[_0xac4a('0x14')][_0x229b22]){ut[_0xac4a('0x81')](_0x5d547b[_0xac4a('0x24')][_0x5d547b[_0xac4a('0x14')][_0x229b22][_0xac4a('0x76')]],'[clearZombieChannel]');if(_0x5d547b[_0xac4a('0x14')][_0x229b22][_0xac4a('0x82')]===!![]){ut[_0xac4a('0x83')](_0x5d547b[_0xac4a('0x24')][_0x5d547b[_0xac4a('0x14')][_0x229b22][_0xac4a('0x76')]],_0xac4a('0x84'));ut[_0xac4a('0x85')](_0xac4a('0x86')+_0x229b22,_0x5d547b[_0xac4a('0x14')][_0x229b22]['queue']);}ut['loggerError'](_0xac4a('0x87')+_0x229b22,_0x5d547b[_0xac4a('0x14')][_0x229b22][_0xac4a('0x76')]);delete _0x5d547b[_0xac4a('0x14')][_0x229b22];}},0x2328);}});}});};Preview['prototype']['clearZombieChannels']=function(){var _0x2f3f56=this;loggerAction[_0xac4a('0x5e')](_0xac4a('0x88'),_[_0xac4a('0x89')](this[_0xac4a('0x14')]));for(var _0xc329ed in this[_0xac4a('0x14')]){if(_0x2f3f56[_0xac4a('0x14')]['hasOwnProperty'](_0xc329ed)){_0x2f3f56[_0xac4a('0x71')](_0xc329ed);}}};Preview[_0xac4a('0xe')][_0xac4a('0x70')]=function(_0x104577){var _0x1c2343=this;rpcDb[_0xac4a('0x8a')](_0x104577['id'],ut[_0xac4a('0x8b')](this[_0xac4a('0x15')]))[_0xac4a('0x8c')](function(_0x17a623){if(!_[_0xac4a('0x8d')](_0x17a623)){for(var _0x4fe99d=0x0;_0x4fe99d<_0x17a623[_0xac4a('0x8e')];_0x4fe99d+=0x1){if(ut[_0xac4a('0x8f')](_0x17a623[_0x4fe99d]['scheduledat'])<_0x104577[_0xac4a('0x90')]*0x3c){if(_0x17a623[_0x4fe99d]['Agent']&&!_0x17a623[_0x4fe99d]['Agent'][_0xac4a('0x91')]){_0x1c2343[_0xac4a('0x92')](_0x17a623[_0x4fe99d]['id'])['then'](ut[_0xac4a('0x93')]('[RecallMe]'))[_0xac4a('0x7f')](ut[_0xac4a('0x93')](_0xac4a('0x94')));}else{rpcDb['disableContact'](_0x17a623[_0x4fe99d]['id']);}}else{var _0x3427cf=new Action(_0x17a623[_0x4fe99d],_0x104577);_0x3427cf['starttime']=moment()[_0xac4a('0x61')]('YYYY-MM-DD\x20HH:mm:ss');_0x104577[_0xac4a('0x43')]+=0x1;ut[_0xac4a('0x95')](_0x3427cf,0x17,'RecallInQueue');if(_0x104577[_0xac4a('0x96')]){rpcDb['rescheduleContactInQueue'](ut[_0xac4a('0x97')](_0x17a623[_0x4fe99d]));rpcDb[_0xac4a('0x98')](_0x3427cf,_0xac4a('0x99'));}else{ut[_0xac4a('0x95')](_0x3427cf,0x16,'RecallFailedTimeout');rpcDb[_0xac4a('0x98')](_0x3427cf,_0xac4a('0x9a'));rpcDb['createCustomerFinal'](_0x3427cf,_0xac4a('0x9a'));}}}}})[_0xac4a('0x7f')](ut['logger2'](_0xac4a('0x9b')));};Preview[_0xac4a('0xe')][_0xac4a('0x6f')]=function(_0xe50196){_0xe50196['sendMessageOneNotActive']=!![];if(ut[_0xac4a('0x9c')](_0xe50196[_0xac4a('0x2b')])){_0xe50196['message']=_0xac4a('0x9d');}else if(!ut[_0xac4a('0x9e')](_0xe50196['dialActive'])){_0xe50196['message']='NOT_ACTIVE';}else if(!this['isTrunkReachable'](_0xe50196[_0xac4a('0x59')])){if(!this['isTrunkReachable'](_0xe50196[_0xac4a('0x9f')])){_0xe50196[_0xac4a('0x68')]=_0xac4a('0xa0');}else{_0xe50196[_0xac4a('0x68')]=_0xac4a('0xa1');}}else{_0xe50196[_0xac4a('0x68')]='ACTIVE';}emitCampaignPreview(_0xe50196);};Preview[_0xac4a('0xe')][_0xac4a('0xa2')]=function(_0x2dfd4f,_0x1f6cf5,_0x4f9410){var _0xf1ab01=this;var _0x5ad022=this[_0xac4a('0x14')][_0x1f6cf5];var _0x10f3a9=this['campaignsPreview'][_0x5ad022[_0xac4a('0x76')]];var _0x43e10d;if(_0x10f3a9){switch(_0x4f9410){case'1':_0x10f3a9[_0xac4a('0x41')]+=0x1;_0x5ad022['countnosuchnumberretry']+=0x1;_0x5ad022[_0xac4a('0xa3')]=ut[_0xac4a('0xa4')](_0x5ad022);ut['logCustomer'](_0x5ad022,0x0,_0xac4a('0xa5'));ami[_0xac4a('0x25')]('custom:agentnosuchnumber',ut[_0xac4a('0xa6')](_0x5ad022,_0xac4a('0xa7')));rpcDb['createCustomerHistory'](_0x5ad022,_0xac4a('0xa8'));if(ut['totalGlobal'](_0x5ad022)>=_0x10f3a9[_0xac4a('0xa9')]){_0x43e10d=ut['cloneAction'](_0x5ad022,0xf,_0xac4a('0xaa'));rpcDb[_0xac4a('0xab')](_0x43e10d,_0xac4a('0xac'));}else{if(_0x5ad022[_0xac4a('0xad')]>=_0x10f3a9[_0xac4a('0xae')]){rpcDb['createCustomerFinal'](_0x5ad022,_0xac4a('0xac'));}else{rpcDb[_0xac4a('0xaf')](ut[_0xac4a('0xb0')](_0x5ad022,_0xac4a('0xad'),_0x10f3a9[_0xac4a('0xb1')]),_0x5ad022[_0xac4a('0xb2')],_0x5ad022[_0xac4a('0xb3')]);}}delete this[_0xac4a('0x14')][_0x2dfd4f[_0xac4a('0xb4')]];break;case'ANSWER':var _0x2d935f=moment()[_0xac4a('0x61')](_0xac4a('0xb5'));_0x5ad022[_0xac4a('0xb6')]=_0x2d935f;_0x5ad022['answertime']=_0x2d935f;_0x5ad022[_0xac4a('0x82')]=!![];_0x10f3a9['pTalking']+=0x1;logger[_0xac4a('0x5e')](_0xac4a('0xb7'),_0x5ad022['uniqueid'],_0xac4a('0xb8'),_0x10f3a9[_0xac4a('0x27')],_0xac4a('0x77'),_0x10f3a9[_0xac4a('0x2c')]);ami[_0xac4a('0x25')](_0xac4a('0xb9'),ut['buildObj'](_0x5ad022,_0xac4a('0xba'),this[_0xac4a('0x24')][_0x5ad022[_0xac4a('0x76')]]));if(_0x10f3a9['acw']){ami[_0xac4a('0x25')]('custom:agentConnectPreview',ut[_0xac4a('0xbb')](_0x5ad022));}break;case'16':ami[_0xac4a('0x25')](_0xac4a('0xbc'),ut[_0xac4a('0xa6')](_0x5ad022,_0xac4a('0xbd'),this[_0xac4a('0x24')][_0x5ad022['queue']]));emitVoiceQueueChannelRemove(ut['buildObj'](_0x5ad022,_0xac4a('0xbd')));_0x10f3a9[_0xac4a('0xbe')]+=0x1;_0x10f3a9[_0xac4a('0x31')]+=0x1;_0x10f3a9[_0xac4a('0x29')]+=0x1;ut[_0xac4a('0x83')](_0x10f3a9,_0xac4a('0xbf'));_0x5ad022[_0xac4a('0xa3')]=ut['totalGlobal'](_0x5ad022);ut[_0xac4a('0x95')](_0x5ad022,0x4,_0xac4a('0xc0'));rpcDb[_0xac4a('0x98')](_0x5ad022,'[callProgressDetectingCustomer][logAnswer]');rpcDb[_0xac4a('0xab')](_0x5ad022,_0xac4a('0xc1'));rpcDb['crateCustomerReportQueue'](_0x5ad022);_0x10f3a9[_0xac4a('0x2e')]+=_0x5ad022[_0xac4a('0xc2')];_0x10f3a9[_0xac4a('0x2d')]+=_0x5ad022['talktime'];logger[_0xac4a('0x5e')](_0xac4a('0xc3'),_0x5ad022[_0xac4a('0xc4')],'\x20Queue',_0x10f3a9[_0xac4a('0x27')],_0xac4a('0x77'),_0x10f3a9['pTalking']);delete this[_0xac4a('0x14')][_0x2dfd4f[_0xac4a('0xb4')]];break;case _0xac4a('0xc5'):_0x10f3a9['outboundBusyCallsDay']+=0x1;_0x5ad022[_0xac4a('0xc6')]+=0x1;_0x5ad022['countglobal']=ut['totalGlobal'](_0x5ad022);ut['logCustomer'](_0x5ad022,0x5,_0xac4a('0xc7'));ami[_0xac4a('0x25')]('custom:agentbusy',ut[_0xac4a('0xa6')](_0x5ad022,_0xac4a('0xc8')));rpcDb[_0xac4a('0x98')](_0x5ad022,'[callProgressDetectingCustomer][logBusy]');if(ut[_0xac4a('0xa4')](_0x5ad022)>=_0x10f3a9[_0xac4a('0xa9')]){_0x43e10d=ut[_0xac4a('0xc9')](_0x5ad022,0xf,'Global');rpcDb[_0xac4a('0xab')](_0x43e10d,_0xac4a('0xca'));}else{if(_0x5ad022[_0xac4a('0xc6')]>=_0x10f3a9[_0xac4a('0xcb')]){rpcDb[_0xac4a('0xab')](_0x5ad022,_0xac4a('0xcc'));}else{rpcDb[_0xac4a('0xaf')](ut[_0xac4a('0xb0')](_0x5ad022,_0xac4a('0xc6'),_0x10f3a9['dialBusyRetryFrequency']),_0x5ad022[_0xac4a('0xb2')],_0x5ad022[_0xac4a('0xb3')]);}}break;case'NOANSWER':_0x10f3a9[_0xac4a('0x40')]+=0x1;_0x5ad022['countnoanswerretry']+=0x1;_0x5ad022[_0xac4a('0xa3')]=ut['totalGlobal'](_0x5ad022);ut[_0xac4a('0x95')](_0x5ad022,0x3,_0xac4a('0xcd'));ami[_0xac4a('0x25')](_0xac4a('0xce'),ut[_0xac4a('0xa6')](_0x5ad022,_0xac4a('0xcf')));rpcDb[_0xac4a('0x98')](_0x5ad022,_0xac4a('0xd0'));if(ut[_0xac4a('0xa4')](_0x5ad022)>=_0x10f3a9['dialGlobalMaxRetry']){_0x43e10d=ut[_0xac4a('0xc9')](_0x5ad022,0xf,_0xac4a('0xaa'));rpcDb[_0xac4a('0xab')](_0x43e10d,_0xac4a('0xd1'));}else{if(_0x5ad022[_0xac4a('0xd2')]>=_0x10f3a9[_0xac4a('0xd3')]){rpcDb[_0xac4a('0xab')](_0x5ad022,_0xac4a('0xd0'));}else{rpcDb[_0xac4a('0xaf')](ut['scheduledAt'](_0x5ad022,_0xac4a('0xd2'),_0x10f3a9[_0xac4a('0xd4')]),_0x5ad022[_0xac4a('0xb2')],_0x5ad022[_0xac4a('0xb3')]);}}break;case _0xac4a('0xd5'):_0x10f3a9[_0xac4a('0x3c')]+=0x1;_0x5ad022[_0xac4a('0xd6')]+=0x1;_0x5ad022['countglobal']=ut[_0xac4a('0xa4')](_0x5ad022);ut[_0xac4a('0x95')](_0x5ad022,0x8,_0xac4a('0xd7'));ami[_0xac4a('0x25')](_0xac4a('0xd8'),ut[_0xac4a('0xa6')](_0x5ad022,_0xac4a('0xd9')));rpcDb[_0xac4a('0x98')](_0x5ad022,_0xac4a('0xda'));if(ut[_0xac4a('0xa4')](_0x5ad022)>=_0x10f3a9[_0xac4a('0xa9')]){_0x43e10d=ut[_0xac4a('0xc9')](_0x5ad022,0xf,_0xac4a('0xaa'));rpcDb[_0xac4a('0xab')](_0x43e10d,_0xac4a('0xdb'));}else{if(_0x5ad022['countcongestionretry']>=_0x10f3a9[_0xac4a('0xdc')]){rpcDb[_0xac4a('0xab')](_0x5ad022,_0xac4a('0xda'));}else{rpcDb[_0xac4a('0xaf')](ut[_0xac4a('0xb0')](_0x5ad022,'countcongestionretry',_0x10f3a9[_0xac4a('0xdd')]),_0x5ad022[_0xac4a('0xb2')],_0x5ad022[_0xac4a('0xb3')]);}}break;case _0xac4a('0xde'):_0x10f3a9[_0xac4a('0x44')]+=0x1;_0x5ad022[_0xac4a('0xdf')]+=0x1;_0x5ad022[_0xac4a('0xa3')]=ut[_0xac4a('0xa4')](_0x5ad022);ut[_0xac4a('0x95')](_0x5ad022,0x14,_0xac4a('0xe0'));ami['emit'](_0xac4a('0xe1'),ut[_0xac4a('0xa6')](_0x5ad022,_0xac4a('0xe2')));rpcDb[_0xac4a('0x98')](_0x5ad022,'[syncHangupRequest][logAgentReject]');if(ut['totalGlobal'](_0x5ad022)>=_0x10f3a9[_0xac4a('0xa9')]){_0x43e10d=ut['cloneAction'](_0x5ad022,0x14,_0xac4a('0xe0'));rpcDb[_0xac4a('0xab')](_0x43e10d,'[callProgressDetectingCustomer][logAgentReject]');}else{if(_0x5ad022['countagentrejectretry']>=_0x10f3a9[_0xac4a('0xe3')]){rpcDb['createCustomerFinal'](_0x5ad022,'[callProgressDetectingCustomer][logAgentReject]');}else{rpcDb['rescheduleContact'](ut['scheduledAt'](_0x5ad022,'countagentrejectretry',_0x10f3a9[_0xac4a('0xe4')]),_0x5ad022['unlockAgent'],_0x5ad022[_0xac4a('0xb3')]);}}break;case _0xac4a('0xe5'):_0x10f3a9['outboundAbandonedCallsDay']+=0x1;_0x5ad022[_0xac4a('0xe6')]+=0x1;_0x5ad022[_0xac4a('0xa3')]=ut[_0xac4a('0xa4')](_0x5ad022);ut[_0xac4a('0x95')](_0x5ad022,0xb,_0xac4a('0xe7'));rpcDb[_0xac4a('0x98')](_0x5ad022,'[callProgressDetectingCustomer][logAbandoned]');if(ut[_0xac4a('0xa4')](_0x5ad022)>=_0x10f3a9[_0xac4a('0xa9')]){_0x43e10d=ut[_0xac4a('0xc9')](_0x5ad022,0xf,_0xac4a('0xaa'));rpcDb[_0xac4a('0xab')](_0x43e10d,'[callProgressDetectingCustomer][logAbandoned]');}else{if(_0x5ad022[_0xac4a('0xe8')]>=_0x10f3a9[_0xac4a('0xe9')]){rpcDb[_0xac4a('0xab')](_0x5ad022,_0xac4a('0xea'));}else{rpcDb[_0xac4a('0xaf')](ut[_0xac4a('0xb0')](_0x5ad022,_0xac4a('0xe6'),_0x10f3a9[_0xac4a('0xeb')]),_0x5ad022[_0xac4a('0xb2')],_0x5ad022[_0xac4a('0xb3')]);}}break;case'18':_0x10f3a9[_0xac4a('0x45')]+=0x1;_0x5ad022['countmachineretry']+=0x1;_0x5ad022[_0xac4a('0xa3')]=ut[_0xac4a('0xa4')](_0x5ad022);ut['logCustomer'](_0x5ad022,0x12,_0x2dfd4f[_0xac4a('0xec')]||_0x2dfd4f['dialstatus']);ami['emit']('custom:amd',ut[_0xac4a('0xa6')](_0x5ad022,'amd'));rpcDb[_0xac4a('0x98')](_0x5ad022,'[callProgressDetectingCustomer][hangupInAMD]');if(ut['totalGlobal'](_0x5ad022)>=_0x10f3a9['dialGlobalMaxRetry']){_0x43e10d=ut[_0xac4a('0xc9')](_0x5ad022,0xf,_0xac4a('0xaa'));rpcDb[_0xac4a('0xab')](_0x43e10d,_0xac4a('0xed'));}else{rpcDb[_0xac4a('0xab')](_0x5ad022,_0xac4a('0xed'));}delete this['actions'][_0x2dfd4f[_0xac4a('0xb4')]];break;case'19':_0x10f3a9[_0xac4a('0x45')]+=0x1;_0x5ad022['countglobal']=ut['totalGlobal'](_0x5ad022);ut[_0xac4a('0x95')](_0x5ad022,0x13,_0x2dfd4f[_0xac4a('0xec')]||_0x2dfd4f[_0xac4a('0xee')]);ami[_0xac4a('0x25')](_0xac4a('0xef'),ut[_0xac4a('0xa6')](_0x5ad022,_0xac4a('0xf0')));rpcDb['createCustomerHistory'](_0x5ad022,_0xac4a('0xf1'));if(ut[_0xac4a('0xa4')](_0x5ad022)>=_0x10f3a9[_0xac4a('0xa9')]){_0x43e10d=ut['cloneAction'](_0x5ad022,0xf,_0xac4a('0xaa'));rpcDb['createCustomerFinal'](_0x43e10d,_0xac4a('0xf1'));}else{rpcDb[_0xac4a('0xab')](_0x5ad022,_0xac4a('0xf1'));}delete this[_0xac4a('0x14')][_0x2dfd4f['linkedid']];break;default:if(_0x5ad022[_0xac4a('0x82')]){ut['decrementTalkink'](_0x10f3a9,_0xac4a('0xf2'));ut['loggerError'](_0xac4a('0xf3')+_0x10f3a9[_0xac4a('0x27')],_0x2dfd4f);}_0x10f3a9[_0xac4a('0x45')]+=0x1;_0x5ad022[_0xac4a('0xa3')]=ut[_0xac4a('0xa4')](_0x5ad022);ut[_0xac4a('0x95')](_0x5ad022,0xc,_0x2dfd4f[_0xac4a('0xec')]||_0x2dfd4f[_0xac4a('0xee')]);rpcDb[_0xac4a('0x98')](_0x5ad022,_0xac4a('0xf4'));if(ut['totalGlobal'](_0x5ad022)>=_0x10f3a9[_0xac4a('0xa9')]){_0x43e10d=ut['cloneAction'](_0x5ad022,0xf,_0xac4a('0xaa'));rpcDb[_0xac4a('0xab')](_0x43e10d,_0xac4a('0xf5'));}else{rpcDb[_0xac4a('0xab')](_0x5ad022,'[callProgressDetectingCustomer][logUnknownGlobal]');}delete this['actions'][_0x2dfd4f[_0xac4a('0xb4')]];}if(!(_0x5ad022[_0xac4a('0x82')]&&_0x4f9410==='16')){ut[_0xac4a('0x81')](_0x10f3a9,_0xac4a('0xf6'));logger[_0xac4a('0x5e')](_0xac4a('0xf7'),_0x5ad022[_0xac4a('0xc4')],_0xac4a('0xb8'),_0x10f3a9[_0xac4a('0x27')],_0xac4a('0x75'),_0x10f3a9[_0xac4a('0x52')]);}if(_0x4f9410!==_0xac4a('0xf8')){delete this[_0xac4a('0x14')][_0x2dfd4f[_0xac4a('0xb4')]];delete this[_0xac4a('0x14')][_0x2dfd4f['destlinkedid']];}}};Preview[_0xac4a('0xe')][_0xac4a('0xf9')]=function(_0x28715c,_0x525319,_0x465efa){if(_[_0xac4a('0xfa')](_0x525319)&&_0xac4a('0xfb')!==typeof _0x525319){return;}if(_[_0xac4a('0xfa')](_0x465efa)&&_0xac4a('0xfb')!==typeof _0x465efa){return;}switch(_0x465efa[_0xac4a('0xfc')]){case'0':ut[_0xac4a('0xfd')](_0x28715c,0x0,'NoSuchNumber');rpcDb[_0xac4a('0xfe')](_0x28715c,'[callProgressDetectingAgent][logNoSuch]');break;case'3':ut[_0xac4a('0xfd')](_0x28715c,0x3,_0xac4a('0xcd'));rpcDb['createAgentHistory'](_0x28715c,'[callProgressDetectingAgent][logNoAnswer]');break;case'5':ut[_0xac4a('0xfd')](_0x28715c,0x5,_0xac4a('0xc7'));rpcDb['createAgentHistory'](_0x28715c,_0xac4a('0xff'));break;case'8':ut[_0xac4a('0xfd')](_0x28715c,0x8,_0xac4a('0xd7'));rpcDb['createAgentHistory'](_0x28715c,_0xac4a('0x100'));break;case'22':ut[_0xac4a('0xfd')](_0x28715c,0x16,_0xac4a('0x101'));rpcDb[_0xac4a('0xfe')](_0x28715c,_0xac4a('0x102'));break;default:ut['logAgent'](_0x28715c,0xc,_0x465efa[_0xac4a('0xfc')]);rpcDb[_0xac4a('0xfe')](_0x28715c,_0xac4a('0x100'));}ut['updateOriginated'](_0x525319,_0xac4a('0x103'));logger[_0xac4a('0x5e')](_0xac4a('0x104'),_0x28715c[_0xac4a('0xc4')],_0xac4a('0xb8'),_0x525319['name'],_0xac4a('0x75'),_0x525319[_0xac4a('0x52')]);delete this[_0xac4a('0x14')][_0x28715c[_0xac4a('0xc4')]];};Preview['prototype'][_0xac4a('0x105')]=function(_0x434c6b,_0x5eec15,_0x5d982e,_0x4c05a9,_0x3825f9){var _0x157695=this;return new BPromise(function(_0x486e48,_0x4f9ca4){if(_[_0xac4a('0x8d')](_0x5eec15)||_[_0xac4a('0x8d')](_0x5eec15[_0xac4a('0x106')])||_[_0xac4a('0x8d')](_0x5eec15[_0xac4a('0x106')][_0xac4a('0x107')])||_['isNil'](_0x5eec15[_0xac4a('0x7b')])){_0x4f9ca4(ut['message'](_0xac4a('0x108'),_0x4c05a9,_0x3825f9));return;}var _0x548d67=uuid['v4']();var _0x4bc20c=_0x157695[_0xac4a('0x24')][_0x5eec15[_0xac4a('0x74')][_0xac4a('0x27')]];var _0x159860=_0x5d982e?_0x157695['agents'][_0x5d982e]['id']:undefined;_0x157695[_0xac4a('0x14')][_0x548d67]=new Action(_0x5eec15,_0x4bc20c,_0x548d67,_0x5d982e,_0x159860);var _0x38ecbf=_0x157695[_0xac4a('0x14')][_0x548d67];_0x38ecbf[_0xac4a('0xb2')]=_0x4c05a9;_0x38ecbf[_0xac4a('0xb3')]=_0x3825f9;_0x38ecbf['lookAgent']=_0x5d982e;if(_[_0xac4a('0x109')](_0x434c6b)){_0x157695[_0xac4a('0x10a')](_0x38ecbf,_0x4bc20c,_0x5eec15,_0x5d982e)['then'](function(_0x28e189){logger[_0xac4a('0x5e')](_0xac4a('0x10b'),_0xac4a('0x10c')+_0x38ecbf['queue']+'\x20IdHopper:\x20'+_0x38ecbf[_0xac4a('0x10d')],JSON[_0xac4a('0x60')](_0x28e189));ami[_0xac4a('0x25')](_0xac4a('0x10e'),ut[_0xac4a('0xa6')](_0x38ecbf,_0xac4a('0x10f'),_0x157695['campaignsPreview'][_0x38ecbf[_0xac4a('0x76')]]));_0x486e48(ut[_0xac4a('0x68')](_0xac4a('0x110')));})['catch'](function(_0x1889f5){ut['logger'](_0xac4a('0x111'),_0x1889f5);_0x4f9ca4(ut[_0xac4a('0x68')](_0xac4a('0x112'),_0x4c05a9,_0x3825f9));});}else{_0x4bc20c[_0xac4a('0x3b')]+=0x1;ut[_0xac4a('0x113')](_0x38ecbf);rpcDb['createHistory'](_0x38ecbf,'[Blacklist][error]');delete _0x157695[_0xac4a('0x14')][_0x548d67];_0x4f9ca4(ut[_0xac4a('0x68')]('Contact\x20in\x20black\x20List',_0x4c05a9,_0x3825f9));}});};Preview[_0xac4a('0xe')][_0xac4a('0x114')]=function(_0x40f9ec){return!_[_0xac4a('0x8d')](_0x40f9ec)&&!_[_0xac4a('0x8d')](_0x40f9ec[_0xac4a('0x27')])&&!_[_0xac4a('0x8d')](_0x40f9ec[_0xac4a('0x5a')])&&_0x40f9ec[_0xac4a('0x5a')]&&!_[_0xac4a('0x8d')](this[_0xac4a('0x13')][util[_0xac4a('0x61')](_0xac4a('0x115'),_0x40f9ec[_0xac4a('0x27')])])&&!_[_0xac4a('0x8d')](this[_0xac4a('0x13')][util[_0xac4a('0x61')](_0xac4a('0x115'),_0x40f9ec[_0xac4a('0x27')])][_0xac4a('0x7d')])&&(this[_0xac4a('0x13')][util[_0xac4a('0x61')](_0xac4a('0x115'),_0x40f9ec[_0xac4a('0x27')])][_0xac4a('0x7d')]===_0xac4a('0x116')||this['trunks'][util[_0xac4a('0x61')](_0xac4a('0x115'),_0x40f9ec['name'])][_0xac4a('0x7d')]===_0xac4a('0x117'));};Preview[_0xac4a('0xe')][_0xac4a('0x92')]=function(_0x8b8b9c,_0x32b698){var _0x434713=this;return new BPromise(function(_0x2a381f,_0x15796d){_0x434713[_0xac4a('0x118')](_0x8b8b9c,_0x32b698)[_0xac4a('0x8c')](function(_0x5c8f7d){_0x2a381f(_['pick'](_0x5c8f7d,[_0xac4a('0x68')]));})[_0xac4a('0x7f')](function(_0x48900e){if(_0x48900e['unlock']){rpcDb[_0xac4a('0x119')](_0x8b8b9c);}if(_0x48900e[_0xac4a('0x5a')]){rpcDb[_0xac4a('0x11a')](_0x8b8b9c);}_0x15796d(_[_0xac4a('0x78')](_0x48900e,['message']));});});};Preview['prototype'][_0xac4a('0x118')]=function(_0x1c816c,_0x5a67de){var _0x217edb=this;return new BPromise(function(_0x1bebf9,_0x50de8f){var _0x57d94f,_0x4b202f;rpcDb['getContactPreview'](_0x1c816c)['then'](function(_0x3cee0a){if(!_[_0xac4a('0x8d')](_0x3cee0a[0x0])){_0x4b202f=_0x3cee0a[0x0][_0xac4a('0x11b')]?![]:!![];_0x57d94f=_0x3cee0a[0x0][_0xac4a('0x11b')]?!![]:![];_0x57d94f=_0x5a67de?!![]:_0x57d94f;}var _0x1bc74a=_0x217edb[_0xac4a('0x11c')](_0x3cee0a);if(_0x1bc74a[_0xac4a('0x11d')]){rpcDb['checkIsBlackList'](_[_0xac4a('0x78')](_0x3cee0a[0x0],['VoiceQueueId','Contact.phone']))[_0xac4a('0x8c')](function(_0x111bca){_0x217edb[_0xac4a('0x105')](_0x111bca,_0x3cee0a[0x0],_0x5a67de,_0x4b202f,_0x57d94f)[_0xac4a('0x8c')](function(_0x16356b){_0x1bebf9(_0x16356b);})[_0xac4a('0x7f')](function(_0x4794f6){_0x50de8f(_0x4794f6);});})[_0xac4a('0x7f')](function(_0x44361e){ut[_0xac4a('0x11e')](_0xac4a('0x11f'),_0x44361e);_0x50de8f(ut['message'](_0xac4a('0x120'),_0x4b202f,_0x57d94f));});}else{_0x50de8f(ut[_0xac4a('0x68')](_0x1bc74a[_0xac4a('0x68')],_0x4b202f,_0x57d94f));}})['catch'](function(_0x41ed96){ut[_0xac4a('0x11e')](_0xac4a('0x121'),_0x41ed96);_0x50de8f(ut[_0xac4a('0x68')](_0xac4a('0x120'),![],!![]));});});};Preview[_0xac4a('0xe')]['validateContact']=function(_0x599607){if(_[_0xac4a('0x8d')](_0x599607)||_[_0xac4a('0x109')](_0x599607)||!_[_0xac4a('0x8d')](_0x599607[0x0]['Agent'])&&_[_0xac4a('0x8d')](_0x599607[0x0][_0xac4a('0x122')][_0xac4a('0x27')])){ut[_0xac4a('0x11e')](_0xac4a('0x123'),_0x599607);return{'isValid':![],'message':_0xac4a('0x124')};}var _0x11976b=this[_0xac4a('0x24')][_0x599607[0x0][_0xac4a('0x74')]['name']];_0x11976b['message']=_0xac4a('0xa1');if(_[_0xac4a('0x8d')](_0x11976b)){ut[_0xac4a('0x11e')](_0xac4a('0x125'),_0x11976b);return{'isValid':![],'message':_0xac4a('0x126')};}if(!this[_0xac4a('0x114')](_0x11976b['Trunk'])){ut[_0xac4a('0x11e')]('[Preview][validateContact][Trunk\x20not\x20work]',_0xac4a('0x127')+_0x11976b['name']+_0xac4a('0x128'));if(!this[_0xac4a('0x114')](_0x11976b[_0xac4a('0x9f')])){ut[_0xac4a('0x11e')](_0xac4a('0x129'),_0x11976b['name']+_0xac4a('0x12a'));return{'isValid':![],'message':_0xac4a('0x12b')};}}if(!ut['isActive'](_0x11976b[_0xac4a('0x35')])){ut['logger'](_0xac4a('0x12c'),_0x11976b[_0xac4a('0x27')]+_0xac4a('0x12d'));return{'isValid':![],'message':_0xac4a('0x127')+_0x11976b[_0xac4a('0x27')]+_0xac4a('0x12d')};}return{'isValid':!![],'message':_0xac4a('0x12e')};};Preview['prototype']['execCall']=function(_0xfe3daf,_0x4db1a4,_0x1b0756,_0x686146){var _0x118ac4=this;return new BPromise(function(_0x5f202c,_0x742967){var _0x24783e=_0xfe3daf['uniqueid'];var _0x445939=_0x118ac4[_0xac4a('0x114')](_0x4db1a4[_0xac4a('0x59')])?util['format'](_0xac4a('0x12f'),_0x4db1a4[_0xac4a('0x59')]['name'],_['isNil'](_0x4db1a4[_0xac4a('0x3a')])?'':_0x4db1a4[_0xac4a('0x3a')][_0xac4a('0x130')]()||'',_0x4db1a4[_0xac4a('0x131')]>0x0?_0x1b0756[_0xac4a('0x106')][_0xac4a('0x107')][_0xac4a('0x132')](_0x4db1a4[_0xac4a('0x131')]):_0x1b0756['Contact'][_0xac4a('0x107')]):util[_0xac4a('0x61')](_0xac4a('0x12f'),_[_0xac4a('0x8d')](_0x4db1a4[_0xac4a('0x9f')])?_0x4db1a4[_0xac4a('0x59')][_0xac4a('0x27')]:_0x4db1a4[_0xac4a('0x9f')][_0xac4a('0x27')],_[_0xac4a('0x8d')](_0x4db1a4[_0xac4a('0x3a')])?'':_0x4db1a4['dialPrefix'][_0xac4a('0x130')]()||'',_0x4db1a4[_0xac4a('0x131')]>0x0?_0x1b0756[_0xac4a('0x106')][_0xac4a('0x107')][_0xac4a('0x132')](_0x4db1a4[_0xac4a('0x131')]):_0x1b0756[_0xac4a('0x106')][_0xac4a('0x107')]);var _0x5f07e4=_0x118ac4[_0xac4a('0x114')](_0x4db1a4['Trunk'])?ut[_0xac4a('0x133')](_0x4db1a4[_0xac4a('0x59')]['callerid'],_0x4db1a4[_0xac4a('0x37')],_0x4db1a4[_0xac4a('0x134')]>0x0?ut[_0xac4a('0x135')](_0x4db1a4[_0xac4a('0x38')],_0x4db1a4[_0xac4a('0x134')]):_0x4db1a4['dialOriginateCallerIdNumber']):ut[_0xac4a('0x133')](_['isNil'](_0x4db1a4['TrunkBackup'])?_0x4db1a4[_0xac4a('0x59')][_0xac4a('0x5b')]:_0x4db1a4['TrunkBackup'][_0xac4a('0x5b')],_0x4db1a4[_0xac4a('0x37')],_0x4db1a4[_0xac4a('0x134')]>0x0?ut['getCallerIdRandom'](_0x4db1a4[_0xac4a('0x38')],_0x4db1a4[_0xac4a('0x134')]):_0x4db1a4[_0xac4a('0x38')]);if(_0x5f07e4){_0xfe3daf[_0xac4a('0x136')]=ut[_0xac4a('0x137')](_0x5f07e4);_0xfe3daf['originatecalleridnum']=ut[_0xac4a('0x138')](_0x5f07e4);}var _0x4a0d11=ut[_0xac4a('0x139')](_0x4db1a4,_0x1b0756,_0x445939,_0x5f07e4,_0x24783e,_0xfe3daf);_[_0xac4a('0x13a')](_0xfe3daf,ut[_0xac4a('0x13b')](_0x4a0d11));_0xfe3daf['starttime']=moment()[_0xac4a('0x61')](_0xac4a('0xb5'));ami[_0xac4a('0x13c')](ut['variablesAction'](_0xfe3daf,_0x4db1a4,_0x4a0d11,_0xfe3daf['activeContact'],_0x686146))[_0xac4a('0x8c')](function(_0xce3758){var _0x52d400=_0xfe3daf[_0xac4a('0x13d')];if(!_[_0xac4a('0x8d')](_0x52d400)){if(!_[_0xac4a('0x8d')](_0x118ac4[_0xac4a('0x15')][_0x52d400])){_0x118ac4[_0xac4a('0x15')][_0x52d400][_0xac4a('0x13e')]=_0xfe3daf['calleridnum'];emit(util['format'](_0xac4a('0x13f'),_0x118ac4[_0xac4a('0x15')][_0x52d400][_0xac4a('0x27')]),_0xac4a('0x140'),{'destaccountcode':_0x118ac4[_0xac4a('0x15')][_0x52d400][_0xac4a('0x141')],'destconnectedlinenum':_0xfe3daf[_0xac4a('0x142')]});}}_0x4db1a4[_0xac4a('0x52')]+=0x1;logger[_0xac4a('0x5e')](_0xac4a('0x143'),_0x24783e,_0xac4a('0xb8'),_0x4db1a4[_0xac4a('0x27')],_0xac4a('0x75'),_0x4db1a4[_0xac4a('0x52')]);_0x5f202c(_0xce3758);})[_0xac4a('0x7f')](function(_0x3f5fbe){ut[_0xac4a('0xfd')](_0xfe3daf,0xe,_0xac4a('0x144'));rpcDb[_0xac4a('0xfe')](_0xfe3daf,_0xac4a('0x145'));_0x742967(_0x3f5fbe);});});};Preview['prototype'][_0xac4a('0x1c')]=function(_0x4c5721){if(this['actions'][_0x4c5721[_0xac4a('0xb4')]]){this[_0xac4a('0x14')][_0x4c5721[_0xac4a('0xb4')]]['channel']=_0x4c5721[_0xac4a('0x7e')];}};Preview['prototype'][_0xac4a('0x146')]=function(_0x23cc3d){var _0x5d6d28=this;var _0x1a1f0a=this['actions'][_0x23cc3d['actionid']];if(_0x1a1f0a){if(_0x1a1f0a[_0xac4a('0x147')]&&this[_0xac4a('0x15')][_0x1a1f0a[_0xac4a('0x147')]]){ut[_0xac4a('0x148')](_0x1a1f0a,this[_0xac4a('0x15')][_0x1a1f0a[_0xac4a('0x147')]][_0xac4a('0x27')],this['agents'][_0x1a1f0a[_0xac4a('0x147')]]['id']);}var _0x2e18ab=_[_0xac4a('0x149')](_0x1a1f0a);_0x2e18ab['responsetime']=moment()[_0xac4a('0x61')](_0xac4a('0xb5'));var _0x45df6f=_0x5d6d28[_0xac4a('0x24')][_0x1a1f0a[_0xac4a('0x76')]];if(ut[_0xac4a('0x14a')](_0x23cc3d[_0xac4a('0x14b')])){if(_0x1a1f0a[_0xac4a('0xb2')]){rpcDb['unlockContact'](_0x1a1f0a['idContact']);}if(_0x1a1f0a['activeContact']){rpcDb['disableContact'](_0x1a1f0a[_0xac4a('0x10d')]);}ami['emit'](_0xac4a('0x14c'),ut['buildObj'](_0x1a1f0a,_0xac4a('0x14d'),this[_0xac4a('0x24')][_0x1a1f0a[_0xac4a('0x76')]]));this[_0xac4a('0xf9')](_0x2e18ab,_0x45df6f,_0x23cc3d);}else{_0x1a1f0a[_0xac4a('0x14e')]=moment()['format'](_0xac4a('0xb5'));ut[_0xac4a('0xfd')](_0x2e18ab,0x4,'Answer');rpcDb[_0xac4a('0xfe')](_0x2e18ab,_0xac4a('0x14f'));}}};Preview[_0xac4a('0xe')][_0xac4a('0x1a')]=function(_0x19c2f5){var _0x1de1ca=this;var _0x47b314=this[_0xac4a('0x14')][_0x19c2f5[_0xac4a('0xb4')]];var _0x572e40;if(_0x47b314){_0x572e40=this[_0xac4a('0x24')][_0x47b314[_0xac4a('0x76')]];logger[_0xac4a('0x5e')](_0xac4a('0x150'),_0x19c2f5[_0xac4a('0xb4')],_0xac4a('0xb8'),_0x572e40[_0xac4a('0x27')],_0xac4a('0x77'),_0x572e40[_0xac4a('0x2c')]);}if(this[_0xac4a('0x14')][_0x19c2f5[_0xac4a('0xb4')]]&&_0x19c2f5[_0xac4a('0xb4')]!==_0x19c2f5[_0xac4a('0xc4')]){if(_0x19c2f5['cause']==='16'&&this[_0xac4a('0x14')][_0x19c2f5[_0xac4a('0xb4')]][_0xac4a('0x82')]){this[_0xac4a('0xa2')](_0x19c2f5,_0x19c2f5['linkedid'],_0x19c2f5[_0xac4a('0x151')]);}else if(this[_0xac4a('0x14')][_0x19c2f5[_0xac4a('0xb4')]][_0xac4a('0x82')]){logger[_0xac4a('0x5e')](_0xac4a('0x152'),_0x19c2f5[_0xac4a('0xb4')],_0x19c2f5[_0xac4a('0x151')],_0xac4a('0xb8'),_0x572e40['name'],'pTalking:\x20',_0x572e40[_0xac4a('0x2c')]);this[_0xac4a('0xa2')](_0x19c2f5,_0x19c2f5[_0xac4a('0xb4')],_0x19c2f5[_0xac4a('0x151')]);}}else if(_0x47b314&&_[_0xac4a('0x8d')](_0x47b314['statedesc'])&&_0x572e40['dialQueueProject']&&_0x19c2f5[_0xac4a('0xb4')]===_0x19c2f5[_0xac4a('0xc4')]&&_['isNil'](_0x19c2f5[_0xac4a('0xfc')])&&_0x19c2f5[_0xac4a('0x151')]==='16'&&_0x19c2f5[_0xac4a('0x153')]==='6'&&_['isUndefined'](_0x47b314[_0xac4a('0x154')])){if(_0x47b314[_0xac4a('0xb2')]){rpcDb[_0xac4a('0x119')](_0x47b314[_0xac4a('0x10d')]);}if(_0x47b314[_0xac4a('0xb3')]){rpcDb[_0xac4a('0x11a')](_0x47b314[_0xac4a('0x10d')]);}_0x19c2f5['reason']='22';this[_0xac4a('0xf9')](_0x47b314,_0x572e40,_0x19c2f5);}else if(_0x47b314&&_0x47b314[_0xac4a('0x154')]){if(_0x19c2f5[_0xac4a('0x151')]==='16'&&this[_0xac4a('0x14')][_0x19c2f5['linkedid']][_0xac4a('0x82')]){logger['info'](_0xac4a('0x155'),_0x19c2f5[_0xac4a('0xb4')],_0x19c2f5['cause'],'\x20Queue',_0x572e40[_0xac4a('0x27')],_0xac4a('0x77'),_0x572e40['pTalking']);this[_0xac4a('0xa2')](_0x19c2f5,_0x19c2f5['linkedid'],_0x19c2f5['cause']);}else if(this[_0xac4a('0x14')][_0x19c2f5[_0xac4a('0xb4')]]['dialAnswer']){logger[_0xac4a('0x5e')](_0xac4a('0x152'),_0x19c2f5[_0xac4a('0xb4')],_0x19c2f5[_0xac4a('0x151')],_0xac4a('0xb8'),_0x572e40[_0xac4a('0x27')],_0xac4a('0x77'),_0x572e40[_0xac4a('0x2c')]);this[_0xac4a('0xa2')](_0x19c2f5,_0x19c2f5[_0xac4a('0xb4')],_0x19c2f5[_0xac4a('0x151')]);}}};Preview[_0xac4a('0xe')][_0xac4a('0x156')]=function(_0x14d593){if(this[_0xac4a('0x14')][_0x14d593['destlinkedid']]&&_0x14d593['destlinkedid']!==_0x14d593['destuniqueid']){this[_0xac4a('0xa2')](_0x14d593,_0x14d593[_0xac4a('0x157')],_0x14d593[_0xac4a('0xee')]);}};Preview[_0xac4a('0xe')][_0xac4a('0x158')]=function(_0x4fe31e){if(this[_0xac4a('0x14')][_0x4fe31e[_0xac4a('0xb4')]]&&_0x4fe31e[_0xac4a('0xb4')]!==_0x4fe31e[_0xac4a('0xc4')]&&!this[_0xac4a('0x14')][_0x4fe31e[_0xac4a('0xb4')]]['dialAnswer']){if(_0x4fe31e[_0xac4a('0x151')]==='1'){this[_0xac4a('0xa2')](_0x4fe31e,_0x4fe31e[_0xac4a('0xb4')],_0x4fe31e[_0xac4a('0x151')]);}}};Preview[_0xac4a('0xe')][_0xac4a('0x159')]=function(_0x599afb,_0x311835,_0x4ea65c){if(this[_0xac4a('0x14')][_0x599afb]){if(_[_0xac4a('0x8d')](this[_0xac4a('0x14')][_0x599afb]['variables'])){this['actions'][_0x599afb][_0xac4a('0x15a')]={};}this['actions'][_0x599afb][_0xac4a('0x15a')][_0x311835]=_0x4ea65c;}};Preview[_0xac4a('0xe')][_0xac4a('0x1e')]=function(_0x425cb7){try{if(!_[_0xac4a('0x8d')](_0x425cb7)){if(ut[_0xac4a('0x15b')](_[_0xac4a('0x15c')](_0x425cb7[_0xac4a('0x15d')])[0x0])){this[_0xac4a('0x159')](_0x425cb7['uniqueid'],_['keys'](_0x425cb7[_0xac4a('0x15d')])[0x0],_0x425cb7[_0xac4a('0x15e')]);}}}catch(_0x31d577){logger[_0xac4a('0x15f')]('[syncVarSet][Preview]',util[_0xac4a('0x160')](_0x31d577,{'showHidden':![],'depth':null}));}};Preview[_0xac4a('0xe')][_0xac4a('0x20')]=function(_0x55c9d7){if(_0x55c9d7){if(this[_0xac4a('0x14')][_0x55c9d7[_0xac4a('0x161')]]){this[_0xac4a('0x14')][_0x55c9d7[_0xac4a('0x161')]][_0xac4a('0x154')]=!![];}}};Preview[_0xac4a('0xe')]['syncBlindTransfer']=function(_0x2417bd){if(_0x2417bd){if(this[_0xac4a('0x14')][_0x2417bd[_0xac4a('0x162')]]){this[_0xac4a('0x14')][_0x2417bd[_0xac4a('0x162')]][_0xac4a('0x154')]=!![];}}};module[_0xac4a('0x163')]=Preview; \ No newline at end of file diff --git a/server/services/ami/preview/rpcDb.js b/server/services/ami/preview/rpcDb.js index 4d747ed..c63136c 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 _0x8ac7=['membername','context','from-sip','exten','holdtime','lastAssignedTo','queuecallerexitreason','COMPLETED','create','[voiceQueueReport]\x20','getContactRecallMe','[rescheduleContactInQueue]\x20','bluebird','../../../config/logger','preview','lodash','../rpc/cmHopper','../rpc/cmHopperFinal','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/agentReportPreview','../rpc/voiceQueueReport','error','inspect','resolve','then','createHistory','catch','[createHistory]\x20','moveContactManagedDialer','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','[getContactPreview]\x20','rescheduleContact','active','countReScheduled','[countReScheduled]\x20','unlockContact','[unlockContact]\x20','disableContact','[activeContact]\x20','crateCustomerReportQueue','type','uniqueid','calleridnum','queue','queuecallerjoinAt','answertime','queuecallerleaveAt','queuecallercomplete','endtime','connectedlinename'];(function(_0x46a30d,_0x34b9ad){var _0x3d1914=function(_0x363d20){while(--_0x363d20){_0x46a30d['push'](_0x46a30d['shift']());}};_0x3d1914(++_0x34b9ad);}(_0x8ac7,0x115));var _0x78ac=function(_0x4e81ec,_0x432bd4){_0x4e81ec=_0x4e81ec-0x0;var _0x2ea1ba=_0x8ac7[_0x4e81ec];return _0x2ea1ba;};'use strict';var util=require('util');var BPromise=require(_0x78ac('0x0'));var logger=require(_0x78ac('0x1'))(_0x78ac('0x2'));var _=require(_0x78ac('0x3'));var cmHopper=require(_0x78ac('0x4'));var cmHopperFinal=require(_0x78ac('0x5'));var cmHopperHistory=require(_0x78ac('0x6'));var cmHopperBlack=require(_0x78ac('0x7'));var voiceQueueRt=require('../rpc/voiceQueueRt');var agentReportPreview=require(_0x78ac('0x8'));var voiceQueueReport=require(_0x78ac('0x9'));function loggerCatch(_0x68555a){return function(_0x1d2bc2){logger[_0x78ac('0xa')](_0x68555a,util[_0x78ac('0xb')](_0x1d2bc2,{'showHidden':![],'depth':null}));};}function create(_0x18e512){return BPromise[_0x78ac('0xc')]()[_0x78ac('0xd')](cmHopperHistory[_0x78ac('0xe')](_0x18e512))[_0x78ac('0xf')](loggerCatch(_0x78ac('0x10')));}function createAgent(_0x2b318f){return BPromise[_0x78ac('0xc')]()['then'](agentReportPreview[_0x78ac('0xe')](_0x2b318f))[_0x78ac('0xf')](loggerCatch('[createHistory]\x20'));}function moveContact(_0x66f222){return BPromise[_0x78ac('0xc')]()[_0x78ac('0xd')](cmHopper[_0x78ac('0x11')](_0x66f222,!![]))[_0x78ac('0xf')](loggerCatch('[moveContactManagedDialer]\x20'));}exports[_0x78ac('0x12')]=function(_0x323590){return BPromise[_0x78ac('0xc')]()[_0x78ac('0xd')](cmHopperBlack[_0x78ac('0x12')](_0x323590))[_0x78ac('0xf')](loggerCatch(_0x78ac('0x13')));};exports['getContactPreview']=function(_0x1a5752){return BPromise[_0x78ac('0xc')]()[_0x78ac('0xd')](cmHopper[_0x78ac('0x14')](_0x1a5752))['catch'](loggerCatch(_0x78ac('0x15')));};exports[_0x78ac('0xe')]=function(_0x4a30e6,_0x2f15a2){create(_0x4a30e6)[_0x78ac('0xf')](loggerCatch(_0x2f15a2));moveContact(_0x4a30e6)[_0x78ac('0xf')](loggerCatch(_0x2f15a2));};exports['createAgentHistory']=function(_0x289a0f,_0x3b6bf7){createAgent(_0x289a0f)[_0x78ac('0xf')](loggerCatch(_0x3b6bf7));};exports['createCustomerHistory']=function(_0x2d94f5,_0x3c8333){create(_0x2d94f5)['catch'](loggerCatch(_0x3c8333));};exports['createCustomerFinal']=function(_0x18b81c,_0xdec172){moveContact(_0x18b81c)[_0x78ac('0xf')](loggerCatch(_0xdec172));};exports[_0x78ac('0x16')]=function(_0x2b43db,_0x2d0560,_0x4e2d83){if(_0x2d0560){_0x2b43db['UserId']=null;}if(_0x4e2d83){_0x2b43db[_0x78ac('0x17')]=![];}return BPromise[_0x78ac('0xc')]()[_0x78ac('0xd')](cmHopper[_0x78ac('0x16')](_0x2b43db))['catch'](loggerCatch('[rescheduleContact]\x20'));};exports[_0x78ac('0x18')]=function(_0x59834c){return BPromise[_0x78ac('0xc')]()[_0x78ac('0xd')](cmHopper[_0x78ac('0x18')](_0x59834c))[_0x78ac('0xf')](loggerCatch(_0x78ac('0x19')));};exports['unlockContact']=function(_0x421546){return BPromise[_0x78ac('0xc')]()[_0x78ac('0xd')](cmHopper[_0x78ac('0x1a')]({'UserId':null},_0x421546,0x1))['catch'](loggerCatch(_0x78ac('0x1b')));};exports[_0x78ac('0x1c')]=function(_0x3ae8cd){return BPromise['resolve']()['then'](cmHopper['unlockContact']({'active':![]},_0x3ae8cd,0x1))['catch'](loggerCatch(_0x78ac('0x1d')));};exports[_0x78ac('0x1e')]=function(_0x55ea37){var _0x353ba0={};_0x353ba0[_0x78ac('0x1f')]=_0x55ea37[_0x78ac('0x1f')];_0x353ba0[_0x78ac('0x20')]=_0x55ea37[_0x78ac('0x20')];_0x353ba0[_0x78ac('0x21')]=_0x55ea37[_0x78ac('0x21')];_0x353ba0['calleridname']=_0x55ea37['calleridname'];_0x353ba0[_0x78ac('0x22')]=_0x55ea37[_0x78ac('0x22')];_0x353ba0[_0x78ac('0x23')]=_0x55ea37[_0x78ac('0x24')];_0x353ba0[_0x78ac('0x25')]=_0x55ea37['answertime'];_0x353ba0[_0x78ac('0x26')]=0x1;_0x353ba0['queuecallercompleteAt']=_0x55ea37[_0x78ac('0x27')];_0x353ba0[_0x78ac('0x28')]=_0x55ea37[_0x78ac('0x29')];_0x353ba0[_0x78ac('0x2a')]=_0x78ac('0x2b');_0x353ba0[_0x78ac('0x2c')]='xcally-motion-preview';_0x353ba0[_0x78ac('0x2d')]=0x0;_0x353ba0['assigned']=0x1;_0x353ba0[_0x78ac('0x2e')]=_0x55ea37['membername'];_0x353ba0[_0x78ac('0x2f')]=_0x78ac('0x30');return BPromise[_0x78ac('0xc')]()[_0x78ac('0xd')](voiceQueueReport[_0x78ac('0x31')](_0x353ba0))[_0x78ac('0xf')](loggerCatch(_0x78ac('0x32')));};exports[_0x78ac('0x33')]=function(_0x30cdb9,_0x104e98){return BPromise['resolve']()['then'](cmHopper[_0x78ac('0x33')](_0x30cdb9,_0x104e98))[_0x78ac('0xf')](loggerCatch('[GetContactRecallMe]\x20'));};exports['rescheduleContactInQueue']=function(_0x5815d3){return BPromise[_0x78ac('0xc')]()[_0x78ac('0xd')](cmHopper[_0x78ac('0x16')](_0x5815d3,!![],!![]))['catch'](loggerCatch(_0x78ac('0x34')));}; \ No newline at end of file +var _0xb4a9=['[rescheduleContactInQueue]\x20','util','bluebird','../rpc/cmHopper','../rpc/cmHopperFinal','../rpc/cmHopperHistory','../rpc/voiceQueueRt','../rpc/agentReportPreview','../rpc/voiceQueueReport','error','inspect','resolve','then','createHistory','catch','[createHistory]\x20','moveContactManagedDialer','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','[getContactPreview]\x20','createCustomerHistory','createCustomerFinal','rescheduleContact','UserId','active','[rescheduleContact]\x20','countReScheduled','[countReScheduled]\x20','unlockContact','[unlockContact]\x20','[activeContact]\x20','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','answertime','queuecallerleaveAt','queuecallercomplete','endtime','connectedlinename','membername','context','from-sip','exten','xcally-motion-preview','holdtime','assigned','lastAssignedTo','COMPLETED','create','getContactRecallMe'];(function(_0x3a9a94,_0x1688dd){var _0x1e477e=function(_0x315e87){while(--_0x315e87){_0x3a9a94['push'](_0x3a9a94['shift']());}};_0x1e477e(++_0x1688dd);}(_0xb4a9,0x1f0));var _0x9b4a=function(_0xee2aa9,_0x40271b){_0xee2aa9=_0xee2aa9-0x0;var _0x5e7fad=_0xb4a9[_0xee2aa9];return _0x5e7fad;};'use strict';var util=require(_0x9b4a('0x0'));var BPromise=require(_0x9b4a('0x1'));var logger=require('../../../config/logger')('preview');var _=require('lodash');var cmHopper=require(_0x9b4a('0x2'));var cmHopperFinal=require(_0x9b4a('0x3'));var cmHopperHistory=require(_0x9b4a('0x4'));var cmHopperBlack=require('../rpc/cmHopperBlack');var voiceQueueRt=require(_0x9b4a('0x5'));var agentReportPreview=require(_0x9b4a('0x6'));var voiceQueueReport=require(_0x9b4a('0x7'));function loggerCatch(_0x23db5c){return function(_0x2f7edb){logger[_0x9b4a('0x8')](_0x23db5c,util[_0x9b4a('0x9')](_0x2f7edb,{'showHidden':![],'depth':null}));};}function create(_0x33c244){return BPromise[_0x9b4a('0xa')]()[_0x9b4a('0xb')](cmHopperHistory[_0x9b4a('0xc')](_0x33c244))[_0x9b4a('0xd')](loggerCatch('[createHistory]\x20'));}function createAgent(_0x5f2b0e){return BPromise[_0x9b4a('0xa')]()[_0x9b4a('0xb')](agentReportPreview[_0x9b4a('0xc')](_0x5f2b0e))['catch'](loggerCatch(_0x9b4a('0xe')));}function moveContact(_0x2a5e37){return BPromise[_0x9b4a('0xa')]()[_0x9b4a('0xb')](cmHopper[_0x9b4a('0xf')](_0x2a5e37,!![]))[_0x9b4a('0xd')](loggerCatch('[moveContactManagedDialer]\x20'));}exports[_0x9b4a('0x10')]=function(_0x405617){return BPromise[_0x9b4a('0xa')]()[_0x9b4a('0xb')](cmHopperBlack[_0x9b4a('0x10')](_0x405617))[_0x9b4a('0xd')](loggerCatch(_0x9b4a('0x11')));};exports['getContactPreview']=function(_0x4830b4){return BPromise['resolve']()[_0x9b4a('0xb')](cmHopper[_0x9b4a('0x12')](_0x4830b4))[_0x9b4a('0xd')](loggerCatch(_0x9b4a('0x13')));};exports['createHistory']=function(_0x5972a0,_0x2072f3){create(_0x5972a0)[_0x9b4a('0xd')](loggerCatch(_0x2072f3));moveContact(_0x5972a0)[_0x9b4a('0xd')](loggerCatch(_0x2072f3));};exports['createAgentHistory']=function(_0x280da1,_0x194664){createAgent(_0x280da1)[_0x9b4a('0xd')](loggerCatch(_0x194664));};exports[_0x9b4a('0x14')]=function(_0x14e2f0,_0x52cc40){create(_0x14e2f0)[_0x9b4a('0xd')](loggerCatch(_0x52cc40));};exports[_0x9b4a('0x15')]=function(_0x1dfb8c,_0x514c02){moveContact(_0x1dfb8c)[_0x9b4a('0xd')](loggerCatch(_0x514c02));};exports[_0x9b4a('0x16')]=function(_0x13d72f,_0xe166b1,_0x5b47fa){if(_0xe166b1){_0x13d72f[_0x9b4a('0x17')]=null;}if(_0x5b47fa){_0x13d72f[_0x9b4a('0x18')]=![];}return BPromise[_0x9b4a('0xa')]()['then'](cmHopper[_0x9b4a('0x16')](_0x13d72f))[_0x9b4a('0xd')](loggerCatch(_0x9b4a('0x19')));};exports[_0x9b4a('0x1a')]=function(_0x2356c9){return BPromise[_0x9b4a('0xa')]()[_0x9b4a('0xb')](cmHopper[_0x9b4a('0x1a')](_0x2356c9))[_0x9b4a('0xd')](loggerCatch(_0x9b4a('0x1b')));};exports[_0x9b4a('0x1c')]=function(_0x1539c2){return BPromise[_0x9b4a('0xa')]()[_0x9b4a('0xb')](cmHopper[_0x9b4a('0x1c')]({'UserId':null},_0x1539c2,0x1))[_0x9b4a('0xd')](loggerCatch(_0x9b4a('0x1d')));};exports['disableContact']=function(_0x56a2d4){return BPromise['resolve']()[_0x9b4a('0xb')](cmHopper[_0x9b4a('0x1c')]({'active':![]},_0x56a2d4,0x1))[_0x9b4a('0xd')](loggerCatch(_0x9b4a('0x1e')));};exports[_0x9b4a('0x1f')]=function(_0x587188){var _0x3876c4={};_0x3876c4[_0x9b4a('0x20')]=_0x587188['type'];_0x3876c4[_0x9b4a('0x21')]=_0x587188['uniqueid'];_0x3876c4[_0x9b4a('0x22')]=_0x587188[_0x9b4a('0x22')];_0x3876c4[_0x9b4a('0x23')]=_0x587188[_0x9b4a('0x23')];_0x3876c4[_0x9b4a('0x24')]=_0x587188['queue'];_0x3876c4[_0x9b4a('0x25')]=_0x587188[_0x9b4a('0x26')];_0x3876c4[_0x9b4a('0x27')]=_0x587188['answertime'];_0x3876c4[_0x9b4a('0x28')]=0x1;_0x3876c4['queuecallercompleteAt']=_0x587188[_0x9b4a('0x29')];_0x3876c4[_0x9b4a('0x2a')]=_0x587188[_0x9b4a('0x2b')];_0x3876c4[_0x9b4a('0x2c')]=_0x9b4a('0x2d');_0x3876c4[_0x9b4a('0x2e')]=_0x9b4a('0x2f');_0x3876c4[_0x9b4a('0x30')]=0x0;_0x3876c4[_0x9b4a('0x31')]=0x1;_0x3876c4[_0x9b4a('0x32')]=_0x587188[_0x9b4a('0x2b')];_0x3876c4['queuecallerexitreason']=_0x9b4a('0x33');return BPromise[_0x9b4a('0xa')]()[_0x9b4a('0xb')](voiceQueueReport[_0x9b4a('0x34')](_0x3876c4))[_0x9b4a('0xd')](loggerCatch('[voiceQueueReport]\x20'));};exports['getContactRecallMe']=function(_0x10fdb1,_0xad226f){return BPromise[_0x9b4a('0xa')]()[_0x9b4a('0xb')](cmHopper[_0x9b4a('0x35')](_0x10fdb1,_0xad226f))[_0x9b4a('0xd')](loggerCatch('[GetContactRecallMe]\x20'));};exports['rescheduleContactInQueue']=function(_0x5a3e3e){return BPromise[_0x9b4a('0xa')]()[_0x9b4a('0xb')](cmHopper[_0x9b4a('0x16')](_0x5a3e3e,!![],!![]))[_0x9b4a('0xd')](loggerCatch(_0x9b4a('0x36')));}; \ No newline at end of file diff --git a/server/services/ami/preview/util/util.js b/server/services/ami/preview/util/util.js index 2d42937..25721e8 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 _0xb4bd=['add','minutes','ListId','decrementTalkink','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','lastevent','queue','interface','motionChannel','voice','mandatoryDisposition','buildAcw','agentReadyId','not_inuse','status','reachable','filterKey','idContact','type','campaigntype','dialAnswer','membername','callbackuniqueid','callbackat','recallme','sipcallid','xmd-voicequeueid','xmd-queue','xmd-phone','xmd-listid','xmd-dialurl','xmd-dialtimeout','xmd-dialoptions','xmd-dialid','xmd-contactid','xmd-callerid','xmd-agiafter','xmd-agi','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','rtpaudioqosjitterbridged','\x5cw{0,','pow','replace','random','extractCalleridNumber','match','util','lodash','moment','../../../../config/logger','XCALLY_IP_AGI','127.0.0.1','milliseconds','diff','seconds','error','inspect','logger','info','logger2','message','getCallerId','isUndefined','string','isEmpty','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','isActive','isNil','name','calleridname','calleridnum','ContactId','dialer','VoiceQueueId','\x22rtTxX%s%s\x22','dialQueueProject2','monitor_format','U(xcally-mixmonitor-context)','dialPreviewUrl','\x22agi://%s/square,%s\x22','dialQueueProject','originatecalleridname','xcally-motion-preview','_XCALLY_MIXMONITOR_UNIQUEID','Contact','tags','updatedAt','%s%s','XMD-','toUpper','toLowerVariables','hasOwnProperty','toLower','updateOriginated','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','state','statedesc','starttime','responsetime','endtime','ringtime','UserId','logCustomer','talktime','answertime','isFailure','Failure','RECALL','BOOKED','uniqueid','originate','channelAgent','from-sip','totalGlobal','countnoanswerretry','countagentrejectretry','countnosuchnumberretry','clone','Global','active','scheduledat'];(function(_0x31e7cb,_0x240132){var _0x1109c3=function(_0x24561d){while(--_0x24561d){_0x31e7cb['push'](_0x31e7cb['shift']());}};_0x1109c3(++_0x240132);}(_0xb4bd,0xbf));var _0xdb4b=function(_0x5ac1e5,_0x4b5012){_0x5ac1e5=_0x5ac1e5-0x0;var _0x1bccc6=_0xb4bd[_0x5ac1e5];return _0x1bccc6;};'use strict';var util=require(_0xdb4b('0x0'));var _=require(_0xdb4b('0x1'));var moment=require(_0xdb4b('0x2'));var logger=require(_0xdb4b('0x3'))('preview');var ipAgi=process['env'][_0xdb4b('0x4')]||_0xdb4b('0x5');function getSeconds(_0x52df0a,_0x47235d){var _0x5203ee=moment(_0x52df0a)['milliseconds'](0x0);var _0x22baa8=moment(_0x47235d)[_0xdb4b('0x6')](0x0);return _0x5203ee[_0xdb4b('0x7')](_0x22baa8,_0xdb4b('0x8'));}exports['loggerCatch']=function(_0x3f5182){return function(_0x1010ac){logger[_0xdb4b('0x9')](_0x3f5182,util[_0xdb4b('0xa')](_0x1010ac,{'showHidden':![],'depth':null}));};};exports[_0xdb4b('0xb')]=function(_0x4e2f7a,_0xd2e699){logger[_0xdb4b('0xc')](_0x4e2f7a,util[_0xdb4b('0xa')](_0xd2e699,{'showHidden':![],'depth':null}));};exports['loggerError']=function(_0x5b909d,_0x5f079c){logger[_0xdb4b('0x9')](_0x5b909d,util[_0xdb4b('0xa')](_0x5f079c,{'showHidden':![],'depth':null}));};exports[_0xdb4b('0xd')]=function(_0x2f37fb){return function(_0x2253da){logger[_0xdb4b('0xc')](_0x2f37fb,util[_0xdb4b('0xa')](_0x2253da,{'showHidden':![],'depth':null}));};};exports[_0xdb4b('0xe')]=function(_0x27d36d,_0x559bd1,_0x44ac15){return{'message':_0x27d36d,'unlock':_0x559bd1,'active':_0x44ac15};};exports[_0xdb4b('0xf')]=function(_0x4e7850,_0x5a3964,_0x2f4b0e){if(!_[_0xdb4b('0x10')](_0x2f4b0e)&&_0xdb4b('0x11')===typeof _0x2f4b0e&&!_[_0xdb4b('0x12')](_0x2f4b0e)){if(!_['isUndefined'](_0x5a3964)&&'string'===typeof _0x5a3964&&!_['isEmpty'](_0x5a3964)){return util[_0xdb4b('0x13')](_0xdb4b('0x14'),_0x5a3964,_0x2f4b0e);}return util[_0xdb4b('0x13')](_0xdb4b('0x14'),_0x2f4b0e,_0x2f4b0e);}if(!_[_0xdb4b('0x10')](_0x4e7850)&&'string'===typeof _0x4e7850&&!_[_0xdb4b('0x12')](_0x4e7850)){return _0x4e7850;}return _0xdb4b('0x15');};exports[_0xdb4b('0x16')]=function(_0x9f2a87){if(_[_0xdb4b('0x17')](_0x9f2a87)){return![];}return _0x9f2a87;};exports['addVariables']=function(_0x9c7a73,_0x5793dc,_0x17632f,_0x59a1d4,_0x4284aa,_0x2d70b1){var _0x1f9b2c={'XMD-QUEUE':_0x5793dc['Queue']?_0x5793dc['Queue'][_0xdb4b('0x18')]:'','XMD-CALLERID':_0x59a1d4,'XMD-CALLERID-PREVIEW':_0x2d70b1?util[_0xdb4b('0x13')]('\x22%s\x22\x20<%s>',_0x2d70b1[_0xdb4b('0x19')],_0x2d70b1[_0xdb4b('0x1a')]):_0x59a1d4,'XMD-DIALID':_0x4284aa,'XMD-CONTACTID':_0x5793dc[_0xdb4b('0x1b')],'XMD-CDRTYPE':_0xdb4b('0x1c'),'CALLERID(all)':_0x59a1d4,'XMD-VOICEQUEUEID':_0x5793dc[_0xdb4b('0x1d')],'XMD-DIALCHANNEL':_0x17632f,'XMD-DIALTIMEOUT':_0x9c7a73['dialOriginateTimeout']||0x1e,'XMD-DIALOPTIONS':util['format'](_0xdb4b('0x1e'),_0x9c7a73[_0xdb4b('0x1f')]?'g':'',_[_0xdb4b('0x12')](_0x9c7a73[_0xdb4b('0x20')])?'':_0xdb4b('0x21')),'XMD-DIALURL':_0x9c7a73[_0xdb4b('0x22')]||'','XMD-AGI':_0x9c7a73['dialQueueProject']?util['format'](_0xdb4b('0x23'),ipAgi,_0x9c7a73[_0xdb4b('0x24')]):'NONE','XMD-AGIAFTER':_0x9c7a73[_0xdb4b('0x1f')]?util[_0xdb4b('0x13')]('\x22agi://%s/square,%s\x22',ipAgi,_0x9c7a73[_0xdb4b('0x1f')]):'NONE','XMD-ORIGINATECALLERIDNUM':_0x2d70b1?_0x2d70b1['originatecalleridnum']:'','XMD-ORIGINATECALLERIDNAME':_0x2d70b1?_0x2d70b1[_0xdb4b('0x25')]:'','XMD-DESTINATION':_0xdb4b('0x26')};if(!_[_0xdb4b('0x12')](_0x9c7a73[_0xdb4b('0x20')])){_0x1f9b2c[util['format']('%s','_XCALLY_MIXMONITOR_FORMAT')]=_0x9c7a73[_0xdb4b('0x20')];_0x1f9b2c[util[_0xdb4b('0x13')]('%s',_0xdb4b('0x27'))]=_0x4284aa;}if(_0x5793dc&&_0x5793dc[_0xdb4b('0x28')]){for(var _0x44da09 in _0x5793dc['Contact']){if(_0x5793dc[_0xdb4b('0x28')]['hasOwnProperty'](_0x44da09)){if(!_[_0xdb4b('0x17')](_0x5793dc[_0xdb4b('0x28')][_0x44da09])&&_0x44da09!=='id'&&_0x44da09!==_0xdb4b('0x29')&&_0x44da09!=='createdAt'&&_0x44da09!==_0xdb4b('0x2a')){_0x1f9b2c[util['format'](_0xdb4b('0x2b'),_0xdb4b('0x2c'),_[_0xdb4b('0x2d')](_0x44da09))]=_0x5793dc[_0xdb4b('0x28')][_0x44da09];}}}}return _0x1f9b2c;};exports[_0xdb4b('0x2e')]=function(_0x52f6e7){var _0x48a4af={};for(var _0x5f132a in _0x52f6e7){if(_0x52f6e7[_0xdb4b('0x2f')](_0x5f132a)){_0x48a4af[util['format']('%s',_[_0xdb4b('0x30')](_0x5f132a))]=_0x52f6e7[_0x5f132a];}}return{'variables':_0x48a4af};};exports[_0xdb4b('0x31')]=function(_0x7906f,_0x29e576){if(!_[_0xdb4b('0x17')](_0x7906f)){if(_0x7906f['hasOwnProperty'](_0xdb4b('0x32'))){if(_0x7906f[_0xdb4b('0x32')]>0x0){_0x7906f['originated']-=0x1;}else{logger[_0xdb4b('0x9')](_0xdb4b('0x33'),_0x29e576);}}}else{logger[_0xdb4b('0x9')](_0xdb4b('0x34'),_0x29e576);}};exports[_0xdb4b('0x35')]=function(_0x27e6ff){var _0x5f2438=moment()['format'](_0xdb4b('0x36'));_0x27e6ff[_0xdb4b('0x37')]=0xd;_0x27e6ff[_0xdb4b('0x38')]='Blacklist';_0x27e6ff[_0xdb4b('0x39')]=_0x5f2438;_0x27e6ff[_0xdb4b('0x3a')]=_0x5f2438;_0x27e6ff[_0xdb4b('0x3b')]=_0x5f2438;};exports['logAgent']=function(_0xb68843,_0x466271,_0x2bd506){var _0xc96c59=moment()[_0xdb4b('0x13')]('YYYY-MM-DD\x20HH:mm:ss');_0xb68843[_0xdb4b('0x37')]=_0x466271;_0xb68843[_0xdb4b('0x38')]=_0x2bd506;_0xb68843['responsetime']=_0xc96c59;_0xb68843[_0xdb4b('0x3c')]=getSeconds(_0xb68843[_0xdb4b('0x3a')],_0xb68843['starttime']);};exports['logLookAgent']=function(_0x284550,_0x3d3c29,_0x3dcfd){_0x284550['membername']=_0x3d3c29;_0x284550[_0xdb4b('0x3d')]=_0x3dcfd;};exports[_0xdb4b('0x3e')]=function(_0x3feec2,_0x34989a,_0x3f8495){var _0x156ff3=moment()[_0xdb4b('0x13')](_0xdb4b('0x36'));_0x3feec2[_0xdb4b('0x37')]=_0x34989a;_0x3feec2[_0xdb4b('0x38')]=_0x3f8495;_0x3feec2[_0xdb4b('0x3a')]=_0x3feec2[_0xdb4b('0x3a')]?_0x3feec2[_0xdb4b('0x3a')]:_0x156ff3;_0x3feec2[_0xdb4b('0x3b')]=_0x3feec2['endtime']?_0x3feec2[_0xdb4b('0x3b')]:_0x156ff3;_0x3feec2['ringtime']=getSeconds(_0x3feec2['responsetime']||0x0,_0x3feec2['starttime']||0x0);_0x3feec2[_0xdb4b('0x3f')]=_0x3feec2[_0xdb4b('0x40')]?getSeconds(_0x3feec2[_0xdb4b('0x3b')],_0x3feec2[_0xdb4b('0x40')]):0x0;};exports[_0xdb4b('0x41')]=function(_0x3f5f34){return _0x3f5f34===_0xdb4b('0x42');};exports['variablesAction']=function(_0x1e2416,_0x1e7138,_0x37b2ed,_0x4d2286,_0x11ee4e){var _0x4b82c2=_0x4d2286?_0xdb4b('0x43'):_0x1e2416[_0xdb4b('0x19')];_0x4b82c2=_0x11ee4e?_0xdb4b('0x44'):_0x4b82c2;return{'actionid':_0x1e2416[_0xdb4b('0x45')],'action':_0xdb4b('0x46'),'channel':_0x1e2416[_0xdb4b('0x47')],'callerid':util[_0xdb4b('0x13')]('\x22%s\x22\x20<%s>',_0x4b82c2,_0x1e2416[_0xdb4b('0x1a')]),'Exten':_0xdb4b('0x26'),'Context':_0xdb4b('0x48'),'Priority':'1','variable':_0x37b2ed,'timeout':(_0x1e7138['timeout']||0x1e)*0x3e8,'async':!![],'channelid':_0x1e2416[_0xdb4b('0x45')]};};exports[_0xdb4b('0x49')]=function(_0x169979){return _0x169979['countbusyretry']+_0x169979['countcongestionretry']+_0x169979[_0xdb4b('0x4a')]+_0x169979[_0xdb4b('0x4b')]+_0x169979[_0xdb4b('0x4c')];};exports['cloneAction']=function(_0x39f53c){var _0x1eea88=_[_0xdb4b('0x4d')](_0x39f53c);_0x1eea88['state']=0xf;_0x1eea88[_0xdb4b('0x38')]=_0xdb4b('0x4e');return _0x1eea88;};exports['scheduledAt']=function(_0x4e1ddf,_0x538b33,_0x27ab87){var _0x22cc6e={};_0x22cc6e[_0x538b33]=_0x4e1ddf[_0x538b33];_0x22cc6e[_0xdb4b('0x4f')]=![];_0x22cc6e[_0xdb4b('0x50')]=moment()[_0xdb4b('0x51')](_0x27ab87,_0xdb4b('0x52'))['format'](_0xdb4b('0x36'));_0x22cc6e[_0xdb4b('0x1b')]=_0x4e1ddf[_0xdb4b('0x1b')];_0x22cc6e[_0xdb4b('0x53')]=_0x4e1ddf[_0xdb4b('0x53')];_0x22cc6e[_0xdb4b('0x1d')]=_0x4e1ddf[_0xdb4b('0x1d')]||undefined;return _0x22cc6e;};exports[_0xdb4b('0x54')]=function(_0x1df500,_0x2e6931){if(!_[_0xdb4b('0x17')](_0x1df500)){if(_0x1df500['pTalking']>0x0){_0x1df500[_0xdb4b('0x55')]-=0x1;}else{logger['error'](_0x2e6931,_0xdb4b('0x56'));}}else{logger[_0xdb4b('0x9')](_0x2e6931,_0xdb4b('0x57'));}};exports[_0xdb4b('0x58')]=function(_0x54a5a3){if(_0x54a5a3<=0x0){return!![];}return![];};exports['buildObj']=function(_0x406576,_0x2cf41e,_0x1eeffd){_0x406576[_0xdb4b('0x59')]=_0x2cf41e;_0x406576[_0xdb4b('0x18')]=_0x406576[_0xdb4b('0x5a')];_0x406576[_0xdb4b('0x5b')]=_0x406576['channelAgent'];_0x406576[_0xdb4b('0x5c')]=_0xdb4b('0x5d');if(_0x1eeffd){_0x406576[_0xdb4b('0x5e')]=_0x1eeffd[_0xdb4b('0x5e')];}return _0x406576;};exports[_0xdb4b('0x5f')]=function(_0x14714d){var _0xe4f72f={};_0xe4f72f[_0xdb4b('0x5a')]=_0x14714d['queue'];_0xe4f72f[_0xdb4b('0x5b')]=_0x14714d[_0xdb4b('0x47')];_0xe4f72f[_0xdb4b('0x45')]=_0x14714d[_0xdb4b('0x45')];return _0xe4f72f;};exports[_0xdb4b('0x60')]=function(_0x6a5360){var _0x39db3c=[];for(var _0x489f79 in _0x6a5360){if(_0x6a5360[_0xdb4b('0x2f')](_0x489f79)){if(!_[_0xdb4b('0x17')](_0x6a5360[_0x489f79])&&_0x6a5360[_0x489f79][_0xdb4b('0x37')]===_0xdb4b('0x61')&&_0x6a5360[_0x489f79][_0xdb4b('0x62')]===_0xdb4b('0x63')){_0x39db3c['push'](_0x6a5360[_0x489f79]['id']);}}}return _0x39db3c;};exports['getDiff']=function(_0x251e08){var _0x44aac4=moment()[_0xdb4b('0x6')](0x0);var _0x210eb4=moment(_0x251e08)[_0xdb4b('0x6')](0x0);return _0x44aac4[_0xdb4b('0x7')](_0x210eb4,'seconds');};exports['createBody']=function(_0x156946){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x156946[_0xdb4b('0x1b')],'ListId':_0x156946[_0xdb4b('0x53')],'VoiceQueueId':_0x156946['VoiceQueueId']||undefined,'CampaignId':_0x156946['CampaignId']||undefined};};exports[_0xdb4b('0x64')]=function(_0x4c680e){if(_0x4c680e===_0xdb4b('0x45')||_0x4c680e===_0xdb4b('0x65')||_0x4c680e==='queue'||_0x4c680e===_0xdb4b('0x66')||_0x4c680e===_0xdb4b('0x67')||_0x4c680e===_0xdb4b('0x68')||_0x4c680e===_0xdb4b('0x69')||_0x4c680e===_0xdb4b('0x47')||_0x4c680e===_0xdb4b('0x19')||_0x4c680e==='active'||_0x4c680e===_0xdb4b('0x1a')||_0x4c680e==='scheduledat'||_0x4c680e==='countbusyretry'||_0x4c680e==='countcongestionretry'||_0x4c680e===_0xdb4b('0x4a')||_0x4c680e==='countglobal'||_0x4c680e==='callback'||_0x4c680e===_0xdb4b('0x6a')||_0x4c680e===_0xdb4b('0x6b')||_0x4c680e===_0xdb4b('0x6c')||_0x4c680e==='ContactId'||_0x4c680e===_0xdb4b('0x53')||_0x4c680e==='UserId'||_0x4c680e===_0xdb4b('0x1d')||_0x4c680e===_0xdb4b('0x6d')||_0x4c680e===_0xdb4b('0x6e')||_0x4c680e===_0xdb4b('0x6f')||_0x4c680e===_0xdb4b('0x70')||_0x4c680e===_0xdb4b('0x71')||_0x4c680e===_0xdb4b('0x72')||_0x4c680e===_0xdb4b('0x73')||_0x4c680e===_0xdb4b('0x74')||_0x4c680e===_0xdb4b('0x75')||_0x4c680e==='xmd-dialchannel'||_0x4c680e===_0xdb4b('0x76')||_0x4c680e==='xmd-cdrtype'||_0x4c680e===_0xdb4b('0x77')||_0x4c680e===_0xdb4b('0x78')||_0x4c680e===_0xdb4b('0x79')||_0x4c680e===_0xdb4b('0x7a')||_0x4c680e===_0xdb4b('0x7b')||_0x4c680e===_0xdb4b('0x7c')||_0x4c680e==='rtpaudioqosjitterbridged'||_0x4c680e===_0xdb4b('0x7d')||_0x4c680e===_0xdb4b('0x7e')||_0x4c680e===_0xdb4b('0x7f')||_0x4c680e===_0xdb4b('0x80')||_0x4c680e==='rtpaudioqos'||_0x4c680e==='rtpaudioqosbridged'||_0x4c680e==='rtpaudioqosjitter'||_0x4c680e===_0xdb4b('0x81')||_0x4c680e===_0xdb4b('0x7d')||_0x4c680e===_0xdb4b('0x7e')||_0x4c680e===_0xdb4b('0x7f')||_0x4c680e===_0xdb4b('0x80')||_0x4c680e==='bridgepeer'||_0x4c680e==='bridgepvtcallid'||_0x4c680e===_0xdb4b('0x37')||_0x4c680e==='statedesc'){return![];}return!![];};exports['getCallerIdRandom']=function(_0x5dc8e4,_0x7e0335){var _0x5df402,_0x5d1fb4,_0x58efe5;if(_0x7e0335<=0x0){_0x7e0335=0x1;}_0x5df402=new RegExp(_0xdb4b('0x82')+_0x7e0335+'}$');_0x5d1fb4=Math[_0xdb4b('0x83')](0xa,_0x7e0335-0x1);_0x58efe5=Math[_0xdb4b('0x83')](0xa,_0x7e0335)-0x1;return util[_0xdb4b('0x13')]('%s',_[_0xdb4b('0x84')](_0x5dc8e4,_0x5df402,_[_0xdb4b('0x85')](_0x5d1fb4,_0x58efe5)));};exports['extractCalleridName']=function(_0x3956d7){var _0x21810a=_0x3956d7['match'](/"(.*?)"/);return _0x21810a?_0x21810a[0x1]:_0x3956d7;};exports[_0xdb4b('0x86')]=function(_0x2e5c63){var _0x5698e2=_0x2e5c63[_0xdb4b('0x87')](/<(.*?)>/);return _0x5698e2?_0x5698e2[0x1]:_0x2e5c63;}; \ No newline at end of file +var _0x7fe1=['[updateOriginated]\x20is\x20null\x20or\x20undefined','state','statedesc','Blacklist','starttime','endtime','logAgent','YYYY-MM-DD\x20HH:mm:ss','responsetime','membername','UserId','logCustomer','talktime','answertime','isFailure','RECALL','uniqueid','originate','channelAgent','from-sip','timeout','totalGlobal','countbusyretry','countcongestionretry','countagentrejectretry','countnosuchnumberretry','cloneAction','clone','Global','scheduledAt','active','scheduledat','add','ListId','decrementTalkink','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','IsNotLoggedIn','queue','voice','mandatoryDisposition','buildAcw','interface','agentReadyId','not_inuse','status','reachable','push','getDiff','CampaignId','filterKey','idContact','type','campaigntype','dialAnswer','countnoanswerretry','countglobal','callback','callbackuniqueid','callbackat','recallme','sipcallid','xmd-dialtimeout','xmd-dialoptions','xmd-contactid','xmd-cdrtype','xmd-callerid','xmd-agiafter','rtpaudioqos','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosbridged','bridgepvtcallid','getCallerIdRandom','\x5cw{0,','pow','random','extractCalleridName','match','extractCalleridNumber','util','../../../../config/logger','preview','env','XCALLY_IP_AGI','127.0.0.1','milliseconds','seconds','loggerCatch','error','inspect','logger','loggerError','logger2','info','message','getCallerId','isUndefined','string','isEmpty','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','isActive','isNil','addVariables','Queue','name','calleridname','calleridnum','ContactId','dialer','VoiceQueueId','dialOriginateTimeout','\x22rtTxX%s%s\x22','dialQueueProject2','monitor_format','U(xcally-mixmonitor-context)','dialPreviewUrl','\x22agi://%s/square,%s\x22','dialQueueProject','NONE','originatecalleridnum','originatecalleridname','xcally-motion-preview','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','Contact','hasOwnProperty','updatedAt','%s%s','XMD-','toLowerVariables','updateOriginated','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative'];(function(_0x2bd1ec,_0x3fe65f){var _0x2f7577=function(_0x5234fb){while(--_0x5234fb){_0x2bd1ec['push'](_0x2bd1ec['shift']());}};_0x2f7577(++_0x3fe65f);}(_0x7fe1,0x1f4));var _0x17fe=function(_0x15a3d3,_0x1fe368){_0x15a3d3=_0x15a3d3-0x0;var _0x1fa778=_0x7fe1[_0x15a3d3];return _0x1fa778;};'use strict';var util=require(_0x17fe('0x0'));var _=require('lodash');var moment=require('moment');var logger=require(_0x17fe('0x1'))(_0x17fe('0x2'));var ipAgi=process[_0x17fe('0x3')][_0x17fe('0x4')]||_0x17fe('0x5');function getSeconds(_0x4fbcaf,_0x96b393){var _0xe560fa=moment(_0x4fbcaf)[_0x17fe('0x6')](0x0);var _0x5dcc1e=moment(_0x96b393)[_0x17fe('0x6')](0x0);return _0xe560fa['diff'](_0x5dcc1e,_0x17fe('0x7'));}exports[_0x17fe('0x8')]=function(_0x6f1527){return function(_0xcff51e){logger[_0x17fe('0x9')](_0x6f1527,util[_0x17fe('0xa')](_0xcff51e,{'showHidden':![],'depth':null}));};};exports[_0x17fe('0xb')]=function(_0x36bb25,_0x60b8ea){logger['info'](_0x36bb25,util[_0x17fe('0xa')](_0x60b8ea,{'showHidden':![],'depth':null}));};exports[_0x17fe('0xc')]=function(_0x7366e8,_0x41c43e){logger[_0x17fe('0x9')](_0x7366e8,util['inspect'](_0x41c43e,{'showHidden':![],'depth':null}));};exports[_0x17fe('0xd')]=function(_0x2a00af){return function(_0x57f314){logger[_0x17fe('0xe')](_0x2a00af,util['inspect'](_0x57f314,{'showHidden':![],'depth':null}));};};exports[_0x17fe('0xf')]=function(_0x37d07b,_0x33ea20,_0x2f5049){return{'message':_0x37d07b,'unlock':_0x33ea20,'active':_0x2f5049};};exports[_0x17fe('0x10')]=function(_0x38f1ef,_0x416aa9,_0x10fa60){if(!_[_0x17fe('0x11')](_0x10fa60)&&_0x17fe('0x12')===typeof _0x10fa60&&!_[_0x17fe('0x13')](_0x10fa60)){if(!_['isUndefined'](_0x416aa9)&&'string'===typeof _0x416aa9&&!_[_0x17fe('0x13')](_0x416aa9)){return util[_0x17fe('0x14')]('\x22%s\x22\x20<%s>',_0x416aa9,_0x10fa60);}return util[_0x17fe('0x14')](_0x17fe('0x15'),_0x10fa60,_0x10fa60);}if(!_['isUndefined'](_0x38f1ef)&&_0x17fe('0x12')===typeof _0x38f1ef&&!_[_0x17fe('0x13')](_0x38f1ef)){return _0x38f1ef;}return _0x17fe('0x16');};exports[_0x17fe('0x17')]=function(_0x5221f2){if(_[_0x17fe('0x18')](_0x5221f2)){return![];}return _0x5221f2;};exports[_0x17fe('0x19')]=function(_0xf3a2a1,_0x3c556e,_0xef7b17,_0x2f33cb,_0x371b41,_0x11628){var _0x183544={'XMD-QUEUE':_0x3c556e[_0x17fe('0x1a')]?_0x3c556e[_0x17fe('0x1a')][_0x17fe('0x1b')]:'','XMD-CALLERID':_0x2f33cb,'XMD-CALLERID-PREVIEW':_0x11628?util[_0x17fe('0x14')]('\x22%s\x22\x20<%s>',_0x11628[_0x17fe('0x1c')],_0x11628[_0x17fe('0x1d')]):_0x2f33cb,'XMD-DIALID':_0x371b41,'XMD-CONTACTID':_0x3c556e[_0x17fe('0x1e')],'XMD-CDRTYPE':_0x17fe('0x1f'),'CALLERID(all)':_0x2f33cb,'XMD-VOICEQUEUEID':_0x3c556e[_0x17fe('0x20')],'XMD-DIALCHANNEL':_0xef7b17,'XMD-DIALTIMEOUT':_0xf3a2a1[_0x17fe('0x21')]||0x1e,'XMD-DIALOPTIONS':util[_0x17fe('0x14')](_0x17fe('0x22'),_0xf3a2a1[_0x17fe('0x23')]?'g':'',_[_0x17fe('0x13')](_0xf3a2a1[_0x17fe('0x24')])?'':_0x17fe('0x25')),'XMD-DIALURL':_0xf3a2a1[_0x17fe('0x26')]||'','XMD-AGI':_0xf3a2a1['dialQueueProject']?util[_0x17fe('0x14')](_0x17fe('0x27'),ipAgi,_0xf3a2a1[_0x17fe('0x28')]):_0x17fe('0x29'),'XMD-AGIAFTER':_0xf3a2a1[_0x17fe('0x23')]?util[_0x17fe('0x14')]('\x22agi://%s/square,%s\x22',ipAgi,_0xf3a2a1[_0x17fe('0x23')]):_0x17fe('0x29'),'XMD-ORIGINATECALLERIDNUM':_0x11628?_0x11628[_0x17fe('0x2a')]:'','XMD-ORIGINATECALLERIDNAME':_0x11628?_0x11628[_0x17fe('0x2b')]:'','XMD-DESTINATION':_0x17fe('0x2c')};if(!_[_0x17fe('0x13')](_0xf3a2a1['monitor_format'])){_0x183544[util[_0x17fe('0x14')]('%s',_0x17fe('0x2d'))]=_0xf3a2a1[_0x17fe('0x24')];_0x183544[util[_0x17fe('0x14')]('%s',_0x17fe('0x2e'))]=_0x371b41;}if(_0x3c556e&&_0x3c556e[_0x17fe('0x2f')]){for(var _0xfe99ec in _0x3c556e[_0x17fe('0x2f')]){if(_0x3c556e[_0x17fe('0x2f')][_0x17fe('0x30')](_0xfe99ec)){if(!_['isNil'](_0x3c556e[_0x17fe('0x2f')][_0xfe99ec])&&_0xfe99ec!=='id'&&_0xfe99ec!=='tags'&&_0xfe99ec!=='createdAt'&&_0xfe99ec!==_0x17fe('0x31')){_0x183544[util[_0x17fe('0x14')](_0x17fe('0x32'),_0x17fe('0x33'),_['toUpper'](_0xfe99ec))]=_0x3c556e[_0x17fe('0x2f')][_0xfe99ec];}}}}return _0x183544;};exports[_0x17fe('0x34')]=function(_0x3c74f7){var _0x19a062={};for(var _0x149097 in _0x3c74f7){if(_0x3c74f7[_0x17fe('0x30')](_0x149097)){_0x19a062[util[_0x17fe('0x14')]('%s',_['toLower'](_0x149097))]=_0x3c74f7[_0x149097];}}return{'variables':_0x19a062};};exports[_0x17fe('0x35')]=function(_0x53605d,_0x3cc2e1){if(!_[_0x17fe('0x18')](_0x53605d)){if(_0x53605d[_0x17fe('0x30')]('originated')){if(_0x53605d[_0x17fe('0x36')]>0x0){_0x53605d[_0x17fe('0x36')]-=0x1;}else{logger[_0x17fe('0x9')](_0x17fe('0x37'),_0x3cc2e1);}}}else{logger[_0x17fe('0x9')](_0x17fe('0x38'),_0x3cc2e1);}};exports['logBlacklist']=function(_0x25cd19){var _0x1c93a0=moment()[_0x17fe('0x14')]('YYYY-MM-DD\x20HH:mm:ss');_0x25cd19[_0x17fe('0x39')]=0xd;_0x25cd19[_0x17fe('0x3a')]=_0x17fe('0x3b');_0x25cd19[_0x17fe('0x3c')]=_0x1c93a0;_0x25cd19['responsetime']=_0x1c93a0;_0x25cd19[_0x17fe('0x3d')]=_0x1c93a0;};exports[_0x17fe('0x3e')]=function(_0x2c57a4,_0x9d6372,_0x45a45c){var _0x45bbac=moment()[_0x17fe('0x14')](_0x17fe('0x3f'));_0x2c57a4['state']=_0x9d6372;_0x2c57a4['statedesc']=_0x45a45c;_0x2c57a4['responsetime']=_0x45bbac;_0x2c57a4['ringtime']=getSeconds(_0x2c57a4[_0x17fe('0x40')],_0x2c57a4[_0x17fe('0x3c')]);};exports['logLookAgent']=function(_0x515530,_0x55b30a,_0x2f229a){_0x515530[_0x17fe('0x41')]=_0x55b30a;_0x515530[_0x17fe('0x42')]=_0x2f229a;};exports[_0x17fe('0x43')]=function(_0xc52eb5,_0x4c6099,_0x3499fd){var _0x4fa9d4=moment()[_0x17fe('0x14')]('YYYY-MM-DD\x20HH:mm:ss');_0xc52eb5[_0x17fe('0x39')]=_0x4c6099;_0xc52eb5[_0x17fe('0x3a')]=_0x3499fd;_0xc52eb5[_0x17fe('0x40')]=_0xc52eb5[_0x17fe('0x40')]?_0xc52eb5[_0x17fe('0x40')]:_0x4fa9d4;_0xc52eb5[_0x17fe('0x3d')]=_0xc52eb5[_0x17fe('0x3d')]?_0xc52eb5[_0x17fe('0x3d')]:_0x4fa9d4;_0xc52eb5['ringtime']=getSeconds(_0xc52eb5[_0x17fe('0x40')]||0x0,_0xc52eb5['starttime']||0x0);_0xc52eb5[_0x17fe('0x44')]=_0xc52eb5[_0x17fe('0x45')]?getSeconds(_0xc52eb5[_0x17fe('0x3d')],_0xc52eb5[_0x17fe('0x45')]):0x0;};exports[_0x17fe('0x46')]=function(_0x4cd8bf){return _0x4cd8bf==='Failure';};exports['variablesAction']=function(_0x1316ef,_0x42858f,_0x4812d9,_0x553d06,_0x5c25fb){var _0x48291b=_0x553d06?_0x17fe('0x47'):_0x1316ef[_0x17fe('0x1c')];_0x48291b=_0x5c25fb?'BOOKED':_0x48291b;return{'actionid':_0x1316ef[_0x17fe('0x48')],'action':_0x17fe('0x49'),'channel':_0x1316ef[_0x17fe('0x4a')],'callerid':util[_0x17fe('0x14')](_0x17fe('0x15'),_0x48291b,_0x1316ef[_0x17fe('0x1d')]),'Exten':_0x17fe('0x2c'),'Context':_0x17fe('0x4b'),'Priority':'1','variable':_0x4812d9,'timeout':(_0x42858f[_0x17fe('0x4c')]||0x1e)*0x3e8,'async':!![],'channelid':_0x1316ef['uniqueid']};};exports[_0x17fe('0x4d')]=function(_0x1c9042){return _0x1c9042[_0x17fe('0x4e')]+_0x1c9042[_0x17fe('0x4f')]+_0x1c9042['countnoanswerretry']+_0x1c9042[_0x17fe('0x50')]+_0x1c9042[_0x17fe('0x51')];};exports[_0x17fe('0x52')]=function(_0x414006){var _0x3633bc=_[_0x17fe('0x53')](_0x414006);_0x3633bc['state']=0xf;_0x3633bc['statedesc']=_0x17fe('0x54');return _0x3633bc;};exports[_0x17fe('0x55')]=function(_0x703d39,_0x568a5d,_0x31401e){var _0x5be6e0={};_0x5be6e0[_0x568a5d]=_0x703d39[_0x568a5d];_0x5be6e0[_0x17fe('0x56')]=![];_0x5be6e0[_0x17fe('0x57')]=moment()[_0x17fe('0x58')](_0x31401e,'minutes')['format'](_0x17fe('0x3f'));_0x5be6e0['ContactId']=_0x703d39[_0x17fe('0x1e')];_0x5be6e0['ListId']=_0x703d39[_0x17fe('0x59')];_0x5be6e0[_0x17fe('0x20')]=_0x703d39[_0x17fe('0x20')]||undefined;return _0x5be6e0;};exports[_0x17fe('0x5a')]=function(_0xf04025,_0x462dc6){if(!_[_0x17fe('0x18')](_0xf04025)){if(_0xf04025[_0x17fe('0x5b')]>0x0){_0xf04025[_0x17fe('0x5b')]-=0x1;}else{logger[_0x17fe('0x9')](_0x462dc6,_0x17fe('0x5c'));}}else{logger[_0x17fe('0x9')](_0x462dc6,'[decrementTalkink]\x20is\x20null\x20or\x20undefined');}};exports[_0x17fe('0x5d')]=function(_0x119823){if(_0x119823<=0x0){return!![];}return![];};exports['buildObj']=function(_0x29eea9,_0x197b1f,_0x5da213){_0x29eea9['lastevent']=_0x197b1f;_0x29eea9[_0x17fe('0x1b')]=_0x29eea9[_0x17fe('0x5e')];_0x29eea9['interface']=_0x29eea9[_0x17fe('0x4a')];_0x29eea9['motionChannel']=_0x17fe('0x5f');if(_0x5da213){_0x29eea9[_0x17fe('0x60')]=_0x5da213[_0x17fe('0x60')];}return _0x29eea9;};exports[_0x17fe('0x61')]=function(_0x3fb18a){var _0x1b657e={};_0x1b657e['queue']=_0x3fb18a[_0x17fe('0x5e')];_0x1b657e[_0x17fe('0x62')]=_0x3fb18a[_0x17fe('0x4a')];_0x1b657e[_0x17fe('0x48')]=_0x3fb18a[_0x17fe('0x48')];return _0x1b657e;};exports[_0x17fe('0x63')]=function(_0x18c0d2){var _0xf6f5e4=[];for(var _0xf6bca5 in _0x18c0d2){if(_0x18c0d2[_0x17fe('0x30')](_0xf6bca5)){if(!_[_0x17fe('0x18')](_0x18c0d2[_0xf6bca5])&&_0x18c0d2[_0xf6bca5]['state']===_0x17fe('0x64')&&_0x18c0d2[_0xf6bca5][_0x17fe('0x65')]===_0x17fe('0x66')){_0xf6f5e4[_0x17fe('0x67')](_0x18c0d2[_0xf6bca5]['id']);}}}return _0xf6f5e4;};exports[_0x17fe('0x68')]=function(_0x5674ab){var _0x5d6c3a=moment()[_0x17fe('0x6')](0x0);var _0xbf8920=moment(_0x5674ab)[_0x17fe('0x6')](0x0);return _0x5d6c3a['diff'](_0xbf8920,_0x17fe('0x7'));};exports['createBody']=function(_0x52791c){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x52791c[_0x17fe('0x1e')],'ListId':_0x52791c[_0x17fe('0x59')],'VoiceQueueId':_0x52791c['VoiceQueueId']||undefined,'CampaignId':_0x52791c[_0x17fe('0x69')]||undefined};};exports[_0x17fe('0x6a')]=function(_0x2f830e){if(_0x2f830e===_0x17fe('0x48')||_0x2f830e===_0x17fe('0x6b')||_0x2f830e===_0x17fe('0x5e')||_0x2f830e===_0x17fe('0x6c')||_0x2f830e===_0x17fe('0x6d')||_0x2f830e===_0x17fe('0x6e')||_0x2f830e==='membername'||_0x2f830e===_0x17fe('0x4a')||_0x2f830e===_0x17fe('0x1c')||_0x2f830e==='active'||_0x2f830e===_0x17fe('0x1d')||_0x2f830e===_0x17fe('0x57')||_0x2f830e===_0x17fe('0x4e')||_0x2f830e===_0x17fe('0x4f')||_0x2f830e===_0x17fe('0x6f')||_0x2f830e===_0x17fe('0x70')||_0x2f830e===_0x17fe('0x71')||_0x2f830e===_0x17fe('0x72')||_0x2f830e===_0x17fe('0x73')||_0x2f830e===_0x17fe('0x74')||_0x2f830e===_0x17fe('0x1e')||_0x2f830e===_0x17fe('0x59')||_0x2f830e==='UserId'||_0x2f830e===_0x17fe('0x20')||_0x2f830e===_0x17fe('0x75')||_0x2f830e==='xmd-voicequeueid'||_0x2f830e==='xmd-queue'||_0x2f830e==='xmd-phone'||_0x2f830e==='xmd-listid'||_0x2f830e==='xmd-dialurl'||_0x2f830e===_0x17fe('0x76')||_0x2f830e===_0x17fe('0x77')||_0x2f830e==='xmd-dialid'||_0x2f830e==='xmd-dialchannel'||_0x2f830e===_0x17fe('0x78')||_0x2f830e===_0x17fe('0x79')||_0x2f830e===_0x17fe('0x7a')||_0x2f830e===_0x17fe('0x7b')||_0x2f830e==='xmd-agi'||_0x2f830e===_0x17fe('0x7c')||_0x2f830e==='rtpaudioqosbridged'||_0x2f830e===_0x17fe('0x7d')||_0x2f830e===_0x17fe('0x7e')||_0x2f830e===_0x17fe('0x7f')||_0x2f830e===_0x17fe('0x80')||_0x2f830e===_0x17fe('0x81')||_0x2f830e==='rtpaudioqosrttbridged'||_0x2f830e==='rtpaudioqos'||_0x2f830e===_0x17fe('0x82')||_0x2f830e===_0x17fe('0x7d')||_0x2f830e===_0x17fe('0x7e')||_0x2f830e===_0x17fe('0x7f')||_0x2f830e==='rtpaudioqoslossbridged'||_0x2f830e===_0x17fe('0x81')||_0x2f830e==='rtpaudioqosrttbridged'||_0x2f830e==='bridgepeer'||_0x2f830e===_0x17fe('0x83')||_0x2f830e===_0x17fe('0x39')||_0x2f830e==='statedesc'){return![];}return!![];};exports[_0x17fe('0x84')]=function(_0x15a886,_0x389f44){var _0x3fe181,_0x1fb0f4,_0x3de9a2;if(_0x389f44<=0x0){_0x389f44=0x1;}_0x3fe181=new RegExp(_0x17fe('0x85')+_0x389f44+'}$');_0x1fb0f4=Math[_0x17fe('0x86')](0xa,_0x389f44-0x1);_0x3de9a2=Math[_0x17fe('0x86')](0xa,_0x389f44)-0x1;return util['format']('%s',_['replace'](_0x15a886,_0x3fe181,_[_0x17fe('0x87')](_0x1fb0f4,_0x3de9a2)));};exports[_0x17fe('0x88')]=function(_0x1bac38){var _0x17737b=_0x1bac38[_0x17fe('0x89')](/"(.*?)"/);return _0x17737b?_0x17737b[0x1]:_0x1bac38;};exports[_0x17fe('0x8a')]=function(_0x4797f9){var _0x4a51ea=_0x4797f9[_0x17fe('0x89')](/<(.*?)>/);return _0x4a51ea?_0x4a51ea[0x1]:_0x4797f9;}; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index 7e7012a..d1043bd 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 _0xbb9a=['reload','voicequeuechannel','voicechannel','voicequeuechannelhangup','voicequeuechannelredirect','queueadd','string','number','boolean','queueremove'];(function(_0x2bd2e0,_0x2a8e4e){var _0x4bb63b=function(_0x3e19ec){while(--_0x3e19ec){_0x2bd2e0['push'](_0x2bd2e0['shift']());}};_0x4bb63b(++_0x2a8e4e);}(_0xbb9a,0x13b));var _0xabb9=function(_0x209bee,_0x298502){_0x209bee=_0x209bee-0x0;var _0x137ac1=_0xbb9a[_0x209bee];return _0x137ac1;};'use strict';exports[_0xabb9('0x0')]={'queue':{'type':_0xabb9('0x1'),'required':!![]},'interface':{'type':_0xabb9('0x1'),'required':!![]},'membername':{'type':'string','required':!![]},'penalty':{'type':_0xabb9('0x2'),'required':![]},'paused':{'type':_0xabb9('0x3'),'required':![]}};exports[_0xabb9('0x4')]={'queue':{'type':_0xabb9('0x1'),'required':!![]},'interface':{'type':_0xabb9('0x1'),'required':!![]}};exports['queuepause']={'interface':{'type':'string','required':!![]},'paused':{'type':_0xabb9('0x3')},'reason':{'type':_0xabb9('0x1'),'required':![]}};exports[_0xabb9('0x5')]={'module':{'type':_0xabb9('0x1'),'required':![]}};exports[_0xabb9('0x6')]={'uniqueid':{'type':_0xabb9('0x1'),'required':!![]}};exports[_0xabb9('0x7')]={'uniqueid':{'type':_0xabb9('0x1'),'required':!![]},'filename':{'type':_0xabb9('0x1')},'format':{'type':'string'},'mixmonitorid':{'type':'string'}};exports[_0xabb9('0x8')]={'uniqueid':{'type':_0xabb9('0x1'),'required':!![]}};exports[_0xabb9('0x9')]={'uniqueid':{'type':_0xabb9('0x1'),'required':!![]},'exten':{'type':_0xabb9('0x1'),'required':!![]},'context':{'type':_0xabb9('0x1')}}; \ No newline at end of file +var _0xae90=['number','queueremove','queuepause','reload','voicequeuechannel','voicechannel','voicequeuechannelhangup','voicequeuechannelredirect','queueadd','string'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xae90,0x1c0));var _0x0ae9=function(_0x3ec761,_0x37adc1){_0x3ec761=_0x3ec761-0x0;var _0x27123b=_0xae90[_0x3ec761];return _0x27123b;};'use strict';exports[_0x0ae9('0x0')]={'queue':{'type':_0x0ae9('0x1'),'required':!![]},'interface':{'type':_0x0ae9('0x1'),'required':!![]},'membername':{'type':_0x0ae9('0x1'),'required':!![]},'penalty':{'type':_0x0ae9('0x2'),'required':![]},'paused':{'type':'boolean','required':![]}};exports[_0x0ae9('0x3')]={'queue':{'type':_0x0ae9('0x1'),'required':!![]},'interface':{'type':_0x0ae9('0x1'),'required':!![]}};exports[_0x0ae9('0x4')]={'interface':{'type':'string','required':!![]},'paused':{'type':'boolean'},'reason':{'type':'string','required':![]}};exports[_0x0ae9('0x5')]={'module':{'type':_0x0ae9('0x1'),'required':![]}};exports[_0x0ae9('0x6')]={'uniqueid':{'type':_0x0ae9('0x1'),'required':!![]}};exports[_0x0ae9('0x7')]={'uniqueid':{'type':_0x0ae9('0x1'),'required':!![]},'filename':{'type':_0x0ae9('0x1')},'format':{'type':'string'},'mixmonitorid':{'type':_0x0ae9('0x1')}};exports[_0x0ae9('0x8')]={'uniqueid':{'type':'string','required':!![]}};exports[_0x0ae9('0x9')]={'uniqueid':{'type':'string','required':!![]},'exten':{'type':'string','required':!![]},'context':{'type':_0x0ae9('0x1')}}; \ No newline at end of file diff --git a/server/services/ami/realtime/index.js b/server/services/ami/realtime/index.js index 3076d1d..ce044a7 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 _0x6056=['../model/zendeskAccount','../model/salesforceAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/deskAccount','../model/vtigerAccount','../model/servicenowAccount','../model/freshsalesAccount','../model/faxAccount','telephones','triggers','campaigns','templates','outbound','voiceExtensions','channels','outboundChannels','timers','zendeskAccounts','salesforceAccounts','freshdeskAccounts','vtigerAccounts','servicenowAccounts','freshsalesAccounts','hasOwnProperty','mapKeys','format','SIP/%s','isNil','interface','total','answered','sumHoldTime','sumDuration','sumBillable','isEmpty','ivrAnswerCallsDay','unmanaged','abandoned','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundCongestionCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundReCallsDay','outboundAnswerCallsDay','queueStatusComplete','prototype','agents','isUndefined','mergeFromDatabase','length','name','initTrunks','trunks','voiceQueues','initTriggers','initTemplates','initZendeskAccounts','initSalesforceAccounts','initFreshdeskAccounts','initZohoAccounts','zohoAccounts','initDeskAccounts','deskAccounts','sugarcrmAccounts','initVtigerAccounts','initServicenowAccounts','initDynamics365Accounts','dynamics365Accounts','initFreshsalesAccounts','initVoiceQueueHopperHistory','groupBy','queuecallerexit','queuecallerleaveAt','seconds','queuecallercompleteAt','queuecallerexitAt','diff','initVoiceCallReports','ANSWERED','duration','billableseconds','initVoiceExtensions','initCampaignHopperHistory','merge','faxAccounts','util','lodash','moment','../model/agent','../model/telephone','../model/trunk','../model/voiceQueue','../model/trigger','../model/template','../model/campaign','../model/voiceExtension'];(function(_0x80ace2,_0x567fd3){var _0x293164=function(_0x4105c7){while(--_0x4105c7){_0x80ace2['push'](_0x80ace2['shift']());}};_0x293164(++_0x567fd3);}(_0x6056,0x1f3));var _0x6605=function(_0x130319,_0x5722d8){_0x130319=_0x130319-0x0;var _0x235ae3=_0x6056[_0x130319];return _0x235ae3;};'use strict';var BPromise=require('bluebird');var util=require(_0x6605('0x0'));var _=require(_0x6605('0x1'));var moment=require(_0x6605('0x2'));var Agent=require(_0x6605('0x3'));var Telephone=require(_0x6605('0x4'));var Trunk=require(_0x6605('0x5'));var VoiceQueue=require(_0x6605('0x6'));var Trigger=require(_0x6605('0x7'));var Template=require(_0x6605('0x8'));var Campaign=require(_0x6605('0x9'));var VoiceExtension=require(_0x6605('0xa'));var ZendeskAccount=require(_0x6605('0xb'));var SalesforceAccount=require(_0x6605('0xc'));var FreshdeskAccount=require(_0x6605('0xd'));var SugarcrmAccount=require(_0x6605('0xe'));var ZohoAccount=require('../model/zohoAccount');var DeskAccount=require(_0x6605('0xf'));var VtigerAccount=require(_0x6605('0x10'));var ServicenowAccount=require(_0x6605('0x11'));var Dynamics365Account=require('../model/dynamics365Account');var FreshsalesAccount=require(_0x6605('0x12'));var FaxAccount=require(_0x6605('0x13'));var Realtime=function(){this['agents']={};this[_0x6605('0x14')]={};this['trunks']={};this['voiceQueues']={};this[_0x6605('0x15')]={};this[_0x6605('0x16')]={};this[_0x6605('0x17')]={};this[_0x6605('0x18')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0x6605('0x19')]={};this[_0x6605('0x1a')]={};this['queueChannels']={};this[_0x6605('0x1b')]={};this[_0x6605('0x1c')]={};this['settings']={};this[_0x6605('0x1d')]={};this[_0x6605('0x1e')]={};this['sugarcrmAccounts']={};this[_0x6605('0x1f')]={};this['zohoAccounts']={};this['deskAccounts']={};this[_0x6605('0x20')]={};this[_0x6605('0x21')]={};this['dynamics365Accounts']={};this[_0x6605('0x22')]={};this['faxAccounts']={};};function freeIsNotKey(_0xffc322,_0x146898,_0xa93bf0){var _0x2e05d3=_['mapKeys'](_0xffc322,function(_0x4addbf,_0x2215e6){return _0x4addbf[_0xa93bf0];});for(var _0x5ab0b4 in _0x146898){if(_0x146898[_0x6605('0x23')](_0x5ab0b4)){if(!_0x2e05d3[_0x5ab0b4]){delete _0x146898[_0x5ab0b4];}}}}function freeIsNotKeySip(_0x5787a2,_0x232a3e){var _0x443278=_[_0x6605('0x24')](_0x5787a2,function(_0x17f5d7,_0x226bc3){return util[_0x6605('0x25')](_0x6605('0x26'),_0x17f5d7['name']);});for(var _0x4f7bf7 in _0x232a3e){if(_0x232a3e['hasOwnProperty'](_0x4f7bf7)){if(!_0x443278[_0x4f7bf7]){delete _0x232a3e[_0x4f7bf7];}}}}function freeIsNotKeyAgent(_0x253aa3,_0x54dea1){var _0x5e77b9=_[_0x6605('0x24')](_0x253aa3,function(_0x3eed66,_0x3b6b64){var _0x3ab98f=_[_0x6605('0x27')](_0x3eed66[_0x6605('0x28')])?util[_0x6605('0x25')](_0x6605('0x26'),_0x3eed66['name']):_0x3eed66[_0x6605('0x28')];return _0x3ab98f;});for(var _0x315e79 in _0x54dea1){if(_0x54dea1[_0x6605('0x23')](_0x315e79)){if(!_0x5e77b9[_0x315e79]){delete _0x54dea1[_0x315e79];}}}}function clearVoiceCallReports(_0x313af0){_0x313af0[_0x6605('0x29')]=0x0;_0x313af0[_0x6605('0x2a')]=0x0;_0x313af0[_0x6605('0x2b')]=0x0;_0x313af0[_0x6605('0x2c')]=0x0;_0x313af0[_0x6605('0x2d')]=0x0;}function clearCampaigns(_0x40fe69){if(!_[_0x6605('0x2e')](_0x40fe69)){for(var _0x4dee44 in _0x40fe69){if(_0x40fe69[_0x6605('0x23')](_0x4dee44)){_0x40fe69[_0x4dee44]['ivrTotalCallsDays']=0x0;_0x40fe69[_0x4dee44][_0x6605('0x2f')]=0x0;}}}}function clearVoiceQueues(_0x4390e0){if(!_[_0x6605('0x2e')](_0x4390e0)){for(var _0x431178 in _0x4390e0){if(_0x4390e0[_0x6605('0x23')](_0x431178)){_0x4390e0[_0x431178][_0x6605('0x29')]=0x0;_0x4390e0[_0x431178][_0x6605('0x2a')]=0x0;_0x4390e0[_0x431178][_0x6605('0x30')]=0x0;_0x4390e0[_0x431178][_0x6605('0x31')]=0x0;_0x4390e0[_0x431178][_0x6605('0x2b')]=0x0;_0x4390e0[_0x431178][_0x6605('0x2c')]=0x0;_0x4390e0[_0x431178][_0x6605('0x2d')]=0x0;_0x4390e0[_0x431178][_0x6605('0x32')]=0x0;_0x4390e0[_0x431178][_0x6605('0x33')]=0x0;_0x4390e0[_0x431178]['outboundBusyCallsDay']=0x0;_0x4390e0[_0x431178][_0x6605('0x34')]=0x0;_0x4390e0[_0x431178]['outboundNoSuchCallsDay']=0x0;_0x4390e0[_0x431178][_0x6605('0x35')]=0x0;_0x4390e0[_0x431178][_0x6605('0x36')]=0x0;_0x4390e0[_0x431178][_0x6605('0x37')]=0x0;_0x4390e0[_0x431178][_0x6605('0x38')]=0x0;_0x4390e0[_0x431178][_0x6605('0x39')]=0x0;_0x4390e0[_0x431178][_0x6605('0x3a')]=0x0;_0x4390e0[_0x431178][_0x6605('0x3b')]=0x0;_0x4390e0[_0x431178][_0x6605('0x32')]=0x0;_0x4390e0[_0x431178][_0x6605('0x3c')]=0x0;_0x4390e0[_0x431178][_0x6605('0x3d')]=!![];}}}}Realtime[_0x6605('0x3e')]['mergeFromDatabase']=function(_0x3a79cb,_0x2cdeaa){for(var _0x592ea1 in _0x2cdeaa){if(_0x3a79cb['hasOwnProperty'](_0x592ea1)){_0x3a79cb[_0x592ea1]=_0x2cdeaa[_0x592ea1];}}};Realtime[_0x6605('0x3e')]['initAgents']=function(){var _0x5c06f3=this;return function(_0x4e45ef){if(_0x4e45ef){freeIsNotKeyAgent(_0x4e45ef,_0x5c06f3[_0x6605('0x3f')]);for(var _0xab43f1=0x0,_0xc04236={},_0x5c9763={};_0xab43f1<_0x4e45ef['length'];_0xab43f1+=0x1){_0xc04236=_0x4e45ef[_0xab43f1];var _0x2c2fd0=_[_0x6605('0x27')](_0xc04236[_0x6605('0x28')])?util[_0x6605('0x25')]('SIP/%s',_0xc04236['name']):_0xc04236['interface'];if(_[_0x6605('0x40')](_0x5c06f3[_0x6605('0x3f')][_0x2c2fd0])){_0x5c06f3[_0x6605('0x3f')][_0x2c2fd0]=new Agent(_0xc04236);}else{_0x5c06f3[_0x6605('0x41')](_0x5c06f3['agents'][_0x2c2fd0],_0xc04236);}}}return _0x5c06f3['agents'];};};Realtime[_0x6605('0x3e')]['initTelephones']=function(){var _0x3b5e8f=this;return function(_0x442b54){if(_0x442b54){freeIsNotKeySip(_0x442b54,_0x3b5e8f[_0x6605('0x14')]);for(var _0x19edcf=0x0,_0x11f473={},_0x47024c={};_0x19edcf<_0x442b54[_0x6605('0x42')];_0x19edcf+=0x1){_0x11f473=_0x442b54[_0x19edcf];if(_[_0x6605('0x40')](_0x3b5e8f[_0x6605('0x14')][util[_0x6605('0x25')](_0x6605('0x26'),_0x11f473[_0x6605('0x43')])])){_0x3b5e8f[_0x6605('0x14')][util['format'](_0x6605('0x26'),_0x11f473['name'])]=new Telephone(_0x11f473);}else{_0x3b5e8f['mergeFromDatabase'](_0x3b5e8f[_0x6605('0x14')][util[_0x6605('0x25')]('SIP/%s',_0x11f473['name'])],_0x11f473);}}}return _0x3b5e8f[_0x6605('0x14')];};};Realtime[_0x6605('0x3e')][_0x6605('0x44')]=function(){var _0x149617=this;return function(_0x1d184c){if(_0x1d184c){freeIsNotKeySip(_0x1d184c,_0x149617[_0x6605('0x45')]);for(var _0xb9e83c=0x0,_0x444a94={},_0x5802da={};_0xb9e83c<_0x1d184c['length'];_0xb9e83c+=0x1){_0x444a94=_0x1d184c[_0xb9e83c];if(_['isUndefined'](_0x149617[_0x6605('0x45')][util['format'](_0x6605('0x26'),_0x444a94[_0x6605('0x43')])])){_0x149617[_0x6605('0x45')][util['format'](_0x6605('0x26'),_0x444a94[_0x6605('0x43')])]=new Trunk(_0x444a94);}else{_0x149617[_0x6605('0x41')](_0x149617[_0x6605('0x45')][util[_0x6605('0x25')]('SIP/%s',_0x444a94[_0x6605('0x43')])],_0x444a94);}}}return _0x149617['trunks'];};};Realtime[_0x6605('0x3e')]['initVoiceQueues']=function(){var _0x5bbdee=this;return function(_0x2c1b65){if(_0x2c1b65){freeIsNotKey(_0x2c1b65,_0x5bbdee[_0x6605('0x46')],_0x6605('0x43'));for(var _0x251388=0x0,_0x432e10={},_0x571ce6={};_0x251388<_0x2c1b65[_0x6605('0x42')];_0x251388+=0x1){_0x432e10=_0x2c1b65[_0x251388];if(_[_0x6605('0x40')](_0x5bbdee[_0x6605('0x46')][_0x432e10[_0x6605('0x43')]])){_0x5bbdee[_0x6605('0x46')][_0x432e10['name']]=new VoiceQueue(_0x432e10);}else{_0x5bbdee['mergeFromDatabase'](_0x5bbdee[_0x6605('0x46')][_0x432e10[_0x6605('0x43')]],_0x432e10);}}}return _0x5bbdee[_0x6605('0x46')];};};Realtime[_0x6605('0x3e')][_0x6605('0x47')]=function(){var _0x1bd8c5=this;return function(_0x3df038){if(_0x3df038){freeIsNotKey(_0x3df038,_0x1bd8c5[_0x6605('0x15')],'id');for(var _0x54d9b1=0x0,_0x319d01={},_0x421404={};_0x54d9b1<_0x3df038[_0x6605('0x42')];_0x54d9b1+=0x1){_0x319d01=_0x3df038[_0x54d9b1];if(_[_0x6605('0x40')](_0x1bd8c5[_0x6605('0x15')][_0x319d01['id']])){_0x1bd8c5[_0x6605('0x15')][_0x319d01['id']]=new Trigger(_0x319d01);}else{_0x1bd8c5[_0x6605('0x41')](_0x1bd8c5['triggers'][_0x319d01['id']],_0x319d01);}}}return _0x1bd8c5['triggers'];};};Realtime[_0x6605('0x3e')][_0x6605('0x48')]=function(){var _0x33866a=this;return function(_0x5ba137){if(_0x5ba137){freeIsNotKey(_0x5ba137,_0x33866a[_0x6605('0x17')],'id');for(var _0x25a1ec=0x0,_0x29b2fb={},_0x5843a8={};_0x25a1ec<_0x5ba137[_0x6605('0x42')];_0x25a1ec+=0x1){_0x29b2fb=_0x5ba137[_0x25a1ec];if(_[_0x6605('0x40')](_0x33866a[_0x6605('0x17')][_0x29b2fb['id']])){_0x33866a[_0x6605('0x17')][_0x29b2fb['id']]=new Template(_0x29b2fb);}else{_0x33866a[_0x6605('0x41')](_0x33866a['templates'][_0x29b2fb['id']],_0x29b2fb);}}}return _0x33866a[_0x6605('0x17')];};};Realtime[_0x6605('0x3e')][_0x6605('0x49')]=function(){var _0x32b4b2=this;return function(_0x4084da){if(_0x4084da){freeIsNotKey(_0x4084da,_0x32b4b2[_0x6605('0x1d')],'id');for(var _0x24e1b7=0x0,_0x50f856={},_0x679faf={};_0x24e1b7<_0x4084da[_0x6605('0x42')];_0x24e1b7+=0x1){_0x50f856=_0x4084da[_0x24e1b7];if(_[_0x6605('0x40')](_0x32b4b2[_0x6605('0x1d')][_0x50f856['id']])){_0x32b4b2[_0x6605('0x1d')][_0x50f856['id']]=new ZendeskAccount(_0x50f856);}else{_0x32b4b2[_0x6605('0x41')](_0x32b4b2['zendeskAccounts'][_0x50f856['id']],_0x50f856);}}}return _0x32b4b2['zendeskAccounts'];};};Realtime['prototype'][_0x6605('0x4a')]=function(){var _0x4c8461=this;return function(_0xce4d1b){if(_0xce4d1b){freeIsNotKey(_0xce4d1b,_0x4c8461['salesforceAccounts'],'id');for(var _0x587494=0x0,_0x4a4e19={},_0x20d63d={};_0x587494<_0xce4d1b[_0x6605('0x42')];_0x587494+=0x1){_0x4a4e19=_0xce4d1b[_0x587494];if(_[_0x6605('0x40')](_0x4c8461[_0x6605('0x1e')][_0x4a4e19['id']])){_0x4c8461[_0x6605('0x1e')][_0x4a4e19['id']]=new SalesforceAccount(_0x4a4e19);}else{_0x4c8461[_0x6605('0x41')](_0x4c8461[_0x6605('0x1e')][_0x4a4e19['id']],_0x4a4e19);}}}return _0x4c8461[_0x6605('0x1e')];};};Realtime[_0x6605('0x3e')][_0x6605('0x4b')]=function(){var _0x11497f=this;return function(_0x524351){if(_0x524351){freeIsNotKey(_0x524351,_0x11497f['freshdeskAccounts'],'id');for(var _0x38a2ef=0x0,_0x462022={},_0x4dd70b={};_0x38a2ef<_0x524351[_0x6605('0x42')];_0x38a2ef+=0x1){_0x462022=_0x524351[_0x38a2ef];if(_[_0x6605('0x40')](_0x11497f['freshdeskAccounts'][_0x462022['id']])){_0x11497f['freshdeskAccounts'][_0x462022['id']]=new FreshdeskAccount(_0x462022);}else{_0x11497f[_0x6605('0x41')](_0x11497f[_0x6605('0x1f')][_0x462022['id']],_0x462022);}}}return _0x11497f[_0x6605('0x1f')];};};Realtime[_0x6605('0x3e')][_0x6605('0x4c')]=function(){var _0x3f431c=this;return function(_0x5b0acc){if(_0x5b0acc){freeIsNotKey(_0x5b0acc,_0x3f431c[_0x6605('0x4d')],'id');for(var _0x4e12c7=0x0,_0x3c2b54={},_0xaddb21={};_0x4e12c7<_0x5b0acc['length'];_0x4e12c7+=0x1){_0x3c2b54=_0x5b0acc[_0x4e12c7];if(_[_0x6605('0x40')](_0x3f431c['zohoAccounts'][_0x3c2b54['id']])){_0x3f431c[_0x6605('0x4d')][_0x3c2b54['id']]=new ZohoAccount(_0x3c2b54);}else{_0x3f431c[_0x6605('0x41')](_0x3f431c['zohoAccounts'][_0x3c2b54['id']],_0x3c2b54);}}}return _0x3f431c[_0x6605('0x4d')];};};Realtime[_0x6605('0x3e')][_0x6605('0x4e')]=function(){var _0x59428d=this;return function(_0x592eb8){if(_0x592eb8){freeIsNotKey(_0x592eb8,_0x59428d[_0x6605('0x4f')],'id');for(var _0x240869=0x0,_0x1f8757={},_0x5bf55a={};_0x240869<_0x592eb8['length'];_0x240869+=0x1){_0x1f8757=_0x592eb8[_0x240869];if(_[_0x6605('0x40')](_0x59428d['deskAccounts'][_0x1f8757['id']])){_0x59428d[_0x6605('0x4f')][_0x1f8757['id']]=new DeskAccount(_0x1f8757);}else{_0x59428d[_0x6605('0x41')](_0x59428d[_0x6605('0x4f')][_0x1f8757['id']],_0x1f8757);}}}return _0x59428d[_0x6605('0x4f')];};};Realtime['prototype']['initSugarcrmAccounts']=function(){var _0x2a5984=this;return function(_0x4a24ce){if(_0x4a24ce){freeIsNotKey(_0x4a24ce,_0x2a5984['sugarcrmAccounts'],'id');for(var _0xda1aa5=0x0,_0x246452={},_0x52f816={};_0xda1aa5<_0x4a24ce[_0x6605('0x42')];_0xda1aa5+=0x1){_0x246452=_0x4a24ce[_0xda1aa5];if(_[_0x6605('0x40')](_0x2a5984[_0x6605('0x50')][_0x246452['id']])){_0x2a5984[_0x6605('0x50')][_0x246452['id']]=new SugarcrmAccount(_0x246452);}else{_0x2a5984[_0x6605('0x41')](_0x2a5984[_0x6605('0x50')][_0x246452['id']],_0x246452);}}}return _0x2a5984[_0x6605('0x50')];};};Realtime[_0x6605('0x3e')][_0x6605('0x51')]=function(){var _0x154a20=this;return function(_0x1243cd){if(_0x1243cd){freeIsNotKey(_0x1243cd,_0x154a20['vtigerAccounts'],'id');for(var _0x1dd160=0x0,_0x4d901b={},_0x540996={};_0x1dd160<_0x1243cd[_0x6605('0x42')];_0x1dd160+=0x1){_0x4d901b=_0x1243cd[_0x1dd160];if(_[_0x6605('0x40')](_0x154a20[_0x6605('0x20')][_0x4d901b['id']])){_0x154a20['vtigerAccounts'][_0x4d901b['id']]=new VtigerAccount(_0x4d901b);}else{_0x154a20[_0x6605('0x41')](_0x154a20[_0x6605('0x20')][_0x4d901b['id']],_0x4d901b);}}}return _0x154a20[_0x6605('0x20')];};};Realtime[_0x6605('0x3e')][_0x6605('0x52')]=function(){var _0xcdc4c6=this;return function(_0x1d1a0a){if(_0x1d1a0a){freeIsNotKey(_0x1d1a0a,_0xcdc4c6[_0x6605('0x21')],'id');for(var _0x42b18f=0x0,_0x3ea5c8={},_0x17b3ca={};_0x42b18f<_0x1d1a0a['length'];_0x42b18f+=0x1){_0x3ea5c8=_0x1d1a0a[_0x42b18f];if(_[_0x6605('0x40')](_0xcdc4c6[_0x6605('0x21')][_0x3ea5c8['id']])){_0xcdc4c6[_0x6605('0x21')][_0x3ea5c8['id']]=new ServicenowAccount(_0x3ea5c8);}else{_0xcdc4c6[_0x6605('0x41')](_0xcdc4c6[_0x6605('0x21')][_0x3ea5c8['id']],_0x3ea5c8);}}}return _0xcdc4c6[_0x6605('0x21')];};};Realtime[_0x6605('0x3e')][_0x6605('0x53')]=function(){var _0x37c173=this;return function(_0x54b62b){if(_0x54b62b){freeIsNotKey(_0x54b62b,_0x37c173['dynamics365Accounts'],'id');for(var _0x20fedc=0x0,_0x35604f={},_0x5108b3={};_0x20fedc<_0x54b62b[_0x6605('0x42')];_0x20fedc+=0x1){_0x35604f=_0x54b62b[_0x20fedc];if(_[_0x6605('0x40')](_0x37c173[_0x6605('0x54')][_0x35604f['id']])){_0x37c173['dynamics365Accounts'][_0x35604f['id']]=new Dynamics365Account(_0x35604f);}else{_0x37c173[_0x6605('0x41')](_0x37c173['dynamics365Accounts'][_0x35604f['id']],_0x35604f);}}}return _0x37c173[_0x6605('0x54')];};};Realtime['prototype'][_0x6605('0x55')]=function(){var _0x2eb1a5=this;return function(_0x17723b){if(_0x17723b){freeIsNotKey(_0x17723b,_0x2eb1a5[_0x6605('0x22')],'id');for(var _0x50e07b=0x0,_0x39860b={},_0x2cd253={};_0x50e07b<_0x17723b[_0x6605('0x42')];_0x50e07b+=0x1){_0x39860b=_0x17723b[_0x50e07b];if(_['isUndefined'](_0x2eb1a5[_0x6605('0x22')][_0x39860b['id']])){_0x2eb1a5[_0x6605('0x22')][_0x39860b['id']]=new FreshsalesAccount(_0x39860b);}else{_0x2eb1a5['mergeFromDatabase'](_0x2eb1a5[_0x6605('0x22')][_0x39860b['id']],_0x39860b);}}}return _0x2eb1a5[_0x6605('0x22')];};};Realtime[_0x6605('0x3e')][_0x6605('0x56')]=function(){var _0x358566=this;return function(_0x472091){for(var _0x15f34f=0x0;_0x15f34f<_0x472091[_0x6605('0x42')];_0x15f34f+=0x1){_['merge'](_0x358566['voiceQueues'][_0x472091[_0x15f34f]['name']],_0x472091[_0x15f34f]);}return _0x358566[_0x6605('0x46')];};};Realtime[_0x6605('0x3e')]['initVoiceQueueReports']=function(){var _0x1215de=this;return function(_0xc8a76b){clearVoiceQueues(_0x1215de[_0x6605('0x46')]);if(_0xc8a76b){_0xc8a76b=_[_0x6605('0x57')](_0xc8a76b,'uniqueid');for(var _0x5385a2 in _0xc8a76b){if(_0xc8a76b['hasOwnProperty'](_0x5385a2)){var _0x5b39bb={};for(var _0x36c3ef=0x0;_0x36c3ef<_0xc8a76b[_0x5385a2]['length'];_0x36c3ef+=0x1){var _0x1a2611=_0xc8a76b[_0x5385a2][_0x36c3ef]['queue'];if(_0x1215de[_0x6605('0x46')][_0x1a2611]){if(_0xc8a76b[_0x5385a2][_0x36c3ef][_0x6605('0x58')]){_0x1215de[_0x6605('0x46')][_0x1a2611][_0x6605('0x30')]+=0x1;}if(_0xc8a76b[_0x5385a2][_0x36c3ef]['queuecallerabandon']){_0x1215de['voiceQueues'][_0x1a2611][_0x6605('0x31')]+=0x1;}_0x1215de[_0x6605('0x46')][_0x1a2611]['sumHoldTime']+=moment(_0xc8a76b[_0x5385a2][_0x36c3ef][_0x6605('0x59')])['diff'](moment(_0xc8a76b[_0x5385a2][_0x36c3ef]['queuecallerjoinAt']),_0x6605('0x5a'))||0x0;if(_0x36c3ef===_0xc8a76b[_0x5385a2][_0x6605('0x42')]-0x1){_0x1215de['voiceQueues'][_0x1a2611][_0x6605('0x2c')]+=moment(_0xc8a76b[_0x5385a2][_0x36c3ef][_0x6605('0x5b')]||_0xc8a76b[_0x5385a2][_0x36c3ef]['queuecallerabandonAt']||_0xc8a76b[_0x5385a2][_0x36c3ef][_0x6605('0x5c')])[_0x6605('0x5d')](moment(_0xc8a76b[_0x5385a2][_0x36c3ef]['queuecallerjoinAt']),'seconds')||0x0;_0x1215de[_0x6605('0x46')][_0x1a2611][_0x6605('0x29')]+=0x1;if(_0xc8a76b[_0x5385a2][_0x36c3ef]['queuecallercomplete']){_0x1215de['voiceQueues'][_0x1a2611][_0x6605('0x2a')]+=0x1;_0x1215de['voiceQueues'][_0x1a2611][_0x6605('0x2d')]+=moment(_0xc8a76b[_0x5385a2][_0x36c3ef]['queuecallercompleteAt'])[_0x6605('0x5d')](moment(_0xc8a76b[_0x5385a2][_0x36c3ef][_0x6605('0x59')]),_0x6605('0x5a'))||0x0;}}else{_0x1215de[_0x6605('0x46')][_0x1a2611]['sumDuration']+=_0x1215de[_0x6605('0x46')][_0x1a2611]['sumHoldTime']||0x0;}}}}}}return _0x1215de[_0x6605('0x46')];};};Realtime[_0x6605('0x3e')][_0x6605('0x5e')]=function(){var _0x1a1b05=this;return function(_0x9520a8){clearVoiceCallReports(_0x1a1b05[_0x6605('0x18')]);if(_0x9520a8){for(var _0x2d6936=0x0;_0x2d6936<_0x9520a8[_0x6605('0x42')];_0x2d6936+=0x1){_0x1a1b05[_0x6605('0x18')][_0x6605('0x29')]+=0x1;_0x1a1b05[_0x6605('0x18')][_0x6605('0x2c')]+=_0x9520a8[_0x2d6936]['duration'];if(_0x9520a8[_0x2d6936]['disposition']===_0x6605('0x5f')){_0x1a1b05[_0x6605('0x18')][_0x6605('0x2a')]+=0x1;_0x1a1b05['outbound']['sumHoldTime']+=_0x9520a8[_0x2d6936][_0x6605('0x60')]-_0x9520a8[_0x2d6936][_0x6605('0x61')]||0x0;_0x1a1b05[_0x6605('0x18')][_0x6605('0x2d')]+=_0x9520a8[_0x2d6936][_0x6605('0x61')];}}}return _0x1a1b05[_0x6605('0x18')];};};Realtime[_0x6605('0x3e')]['initCampaigns']=function(){var _0x5b66c9=this;return function(_0x92b25f){if(_0x92b25f){freeIsNotKey(_0x92b25f,_0x5b66c9[_0x6605('0x16')],'name');for(var _0x1ad2a7=0x0,_0x85ef65={};_0x1ad2a7<_0x92b25f['length'];_0x1ad2a7+=0x1){_0x85ef65=_0x92b25f[_0x1ad2a7];if(_[_0x6605('0x40')](_0x5b66c9['campaigns'][_0x85ef65['name']])){_0x5b66c9['campaigns'][_0x85ef65[_0x6605('0x43')]]=new Campaign(_0x85ef65);}else{_0x5b66c9[_0x6605('0x41')](_0x5b66c9['campaigns'][_0x85ef65[_0x6605('0x43')]],_0x85ef65);_0x5b66c9[_0x6605('0x16')][_0x85ef65[_0x6605('0x43')]]['dialQueueProject']=_0x85ef65['SquareProject']?_0x85ef65['SquareProject']['name']:undefined;}}}return _0x5b66c9[_0x6605('0x16')];};};Realtime['prototype'][_0x6605('0x62')]=function(){var _0xf20c67=this;return function(_0x533f41){if(_0x533f41){freeIsNotKey(_0x533f41,_0xf20c67['voiceExtensions'],'id');for(var _0x386675=0x0,_0x528e50={};_0x386675<_0x533f41[_0x6605('0x42')];_0x386675+=0x1){_0x528e50=_0x533f41[_0x386675];if(_[_0x6605('0x40')](_0xf20c67['voiceExtensions'][_0x528e50['id']])){_0xf20c67[_0x6605('0x19')][_0x528e50['id']]=new VoiceExtension(_0x528e50);}else{_0xf20c67['mergeFromDatabase'](_0xf20c67[_0x6605('0x19')][_0x528e50['id']],_0x528e50);}}}return _0xf20c67[_0x6605('0x19')];};};Realtime[_0x6605('0x3e')][_0x6605('0x63')]=function(){var _0x212312=this;return function(_0x36985a){clearCampaigns(_0x212312['campaigns']);for(var _0x1131da=0x0;_0x1131da<_0x36985a[_0x6605('0x42')];_0x1131da+=0x1){_[_0x6605('0x64')](_0x212312[_0x6605('0x16')][_0x36985a[_0x1131da][_0x6605('0x43')]],_0x36985a[_0x1131da]);}return _0x212312[_0x6605('0x16')];};};Realtime[_0x6605('0x3e')]['initFaxAccounts']=function(){var _0x1a0cf0=this;return function(_0x5eac0b){if(_0x5eac0b){freeIsNotKey(_0x5eac0b,_0x1a0cf0['faxAccounts'],'id');for(var _0x500732=0x0,_0x18defb={},_0x25863b={};_0x500732<_0x5eac0b[_0x6605('0x42')];_0x500732+=0x1){_0x18defb=_0x5eac0b[_0x500732];if(_[_0x6605('0x40')](_0x1a0cf0['faxAccounts'][_0x18defb['id']])){_0x1a0cf0[_0x6605('0x65')][_0x18defb['id']]=new FaxAccount(_0x18defb);}else{_0x1a0cf0[_0x6605('0x41')](_0x1a0cf0[_0x6605('0x65')][_0x18defb['id']],_0x18defb);}}}return _0x1a0cf0['faxAccounts'];};};module['exports']=Realtime; \ No newline at end of file +var _0xb72c=['queuecallerexitAt','diff','queuecallerjoinAt','queuecallercomplete','initVoiceCallReports','outbound','duration','disposition','ANSWERED','billableseconds','initCampaigns','dialQueueProject','SquareProject','initVoiceExtensions','initCampaignHopperHistory','initFaxAccounts','bluebird','../model/agent','../model/telephone','../model/trunk','../model/voiceQueue','../model/template','../model/campaign','../model/voiceExtension','../model/zendeskAccount','../model/sugarcrmAccount','../model/zohoAccount','../model/vtigerAccount','../model/dynamics365Account','../model/freshsalesAccount','agents','telephones','trunks','voiceQueues','campaigns','templates','voiceExtensions','channels','outboundChannels','timers','settings','zendeskAccounts','salesforceAccounts','sugarcrmAccounts','freshdeskAccounts','zohoAccounts','vtigerAccounts','freshsalesAccounts','faxAccounts','hasOwnProperty','mapKeys','format','isNil','interface','SIP/%s','name','total','answered','sumHoldTime','sumDuration','isEmpty','ivrTotalCallsDays','ivrAnswerCallsDay','unmanaged','abandoned','sumBillable','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundAnswerCallsDay','prototype','length','mergeFromDatabase','initTelephones','isUndefined','initTrunks','initVoiceQueues','initTriggers','triggers','initSalesforceAccounts','initFreshdeskAccounts','initZohoAccounts','initDeskAccounts','deskAccounts','initServicenowAccounts','servicenowAccounts','initDynamics365Accounts','dynamics365Accounts','initVoiceQueueHopperHistory','merge','initVoiceQueueReports','groupBy','queuecallerexit','queuecallerabandon','queuecallerleaveAt','seconds','queuecallercompleteAt'];(function(_0x4a037c,_0x2839e2){var _0x9c5ada=function(_0x219a93){while(--_0x219a93){_0x4a037c['push'](_0x4a037c['shift']());}};_0x9c5ada(++_0x2839e2);}(_0xb72c,0x145));var _0xcb72=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb72c[_0x3dd15e];return _0x231fd0;};'use strict';var BPromise=require(_0xcb72('0x0'));var util=require('util');var _=require('lodash');var moment=require('moment');var Agent=require(_0xcb72('0x1'));var Telephone=require(_0xcb72('0x2'));var Trunk=require(_0xcb72('0x3'));var VoiceQueue=require(_0xcb72('0x4'));var Trigger=require('../model/trigger');var Template=require(_0xcb72('0x5'));var Campaign=require(_0xcb72('0x6'));var VoiceExtension=require(_0xcb72('0x7'));var ZendeskAccount=require(_0xcb72('0x8'));var SalesforceAccount=require('../model/salesforceAccount');var FreshdeskAccount=require('../model/freshdeskAccount');var SugarcrmAccount=require(_0xcb72('0x9'));var ZohoAccount=require(_0xcb72('0xa'));var DeskAccount=require('../model/deskAccount');var VtigerAccount=require(_0xcb72('0xb'));var ServicenowAccount=require('../model/servicenowAccount');var Dynamics365Account=require(_0xcb72('0xc'));var FreshsalesAccount=require(_0xcb72('0xd'));var FaxAccount=require('../model/faxAccount');var Realtime=function(){this[_0xcb72('0xe')]={};this[_0xcb72('0xf')]={};this[_0xcb72('0x10')]={};this[_0xcb72('0x11')]={};this['triggers']={};this[_0xcb72('0x12')]={};this[_0xcb72('0x13')]={};this['outbound']={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0xcb72('0x14')]={};this[_0xcb72('0x15')]={};this['queueChannels']={};this[_0xcb72('0x16')]={};this[_0xcb72('0x17')]={};this[_0xcb72('0x18')]={};this[_0xcb72('0x19')]={};this[_0xcb72('0x1a')]={};this[_0xcb72('0x1b')]={};this[_0xcb72('0x1c')]={};this[_0xcb72('0x1d')]={};this['deskAccounts']={};this[_0xcb72('0x1e')]={};this['servicenowAccounts']={};this['dynamics365Accounts']={};this[_0xcb72('0x1f')]={};this[_0xcb72('0x20')]={};};function freeIsNotKey(_0x1e1dd8,_0x62772d,_0x1c5218){var _0x275b71=_['mapKeys'](_0x1e1dd8,function(_0x12ffd3,_0x23618b){return _0x12ffd3[_0x1c5218];});for(var _0x1fac8b in _0x62772d){if(_0x62772d[_0xcb72('0x21')](_0x1fac8b)){if(!_0x275b71[_0x1fac8b]){delete _0x62772d[_0x1fac8b];}}}}function freeIsNotKeySip(_0x3dbd7e,_0x557b18){var _0x25c479=_[_0xcb72('0x22')](_0x3dbd7e,function(_0x54ff72,_0x561141){return util[_0xcb72('0x23')]('SIP/%s',_0x54ff72['name']);});for(var _0xd36e95 in _0x557b18){if(_0x557b18['hasOwnProperty'](_0xd36e95)){if(!_0x25c479[_0xd36e95]){delete _0x557b18[_0xd36e95];}}}}function freeIsNotKeyAgent(_0x42687e,_0xe36caa){var _0x2bc266=_[_0xcb72('0x22')](_0x42687e,function(_0x13ec18,_0x593465){var _0x157714=_[_0xcb72('0x24')](_0x13ec18[_0xcb72('0x25')])?util[_0xcb72('0x23')](_0xcb72('0x26'),_0x13ec18[_0xcb72('0x27')]):_0x13ec18['interface'];return _0x157714;});for(var _0x4e83d7 in _0xe36caa){if(_0xe36caa[_0xcb72('0x21')](_0x4e83d7)){if(!_0x2bc266[_0x4e83d7]){delete _0xe36caa[_0x4e83d7];}}}}function clearVoiceCallReports(_0x5a727b){_0x5a727b[_0xcb72('0x28')]=0x0;_0x5a727b[_0xcb72('0x29')]=0x0;_0x5a727b[_0xcb72('0x2a')]=0x0;_0x5a727b[_0xcb72('0x2b')]=0x0;_0x5a727b['sumBillable']=0x0;}function clearCampaigns(_0x2cd727){if(!_[_0xcb72('0x2c')](_0x2cd727)){for(var _0x2e2b40 in _0x2cd727){if(_0x2cd727[_0xcb72('0x21')](_0x2e2b40)){_0x2cd727[_0x2e2b40][_0xcb72('0x2d')]=0x0;_0x2cd727[_0x2e2b40][_0xcb72('0x2e')]=0x0;}}}}function clearVoiceQueues(_0x217cc){if(!_[_0xcb72('0x2c')](_0x217cc)){for(var _0x5f122a in _0x217cc){if(_0x217cc[_0xcb72('0x21')](_0x5f122a)){_0x217cc[_0x5f122a]['total']=0x0;_0x217cc[_0x5f122a]['answered']=0x0;_0x217cc[_0x5f122a][_0xcb72('0x2f')]=0x0;_0x217cc[_0x5f122a][_0xcb72('0x30')]=0x0;_0x217cc[_0x5f122a]['sumHoldTime']=0x0;_0x217cc[_0x5f122a][_0xcb72('0x2b')]=0x0;_0x217cc[_0x5f122a][_0xcb72('0x31')]=0x0;_0x217cc[_0x5f122a][_0xcb72('0x32')]=0x0;_0x217cc[_0x5f122a][_0xcb72('0x33')]=0x0;_0x217cc[_0x5f122a][_0xcb72('0x34')]=0x0;_0x217cc[_0x5f122a][_0xcb72('0x35')]=0x0;_0x217cc[_0x5f122a]['outboundNoSuchCallsDay']=0x0;_0x217cc[_0x5f122a]['outboundUnknownCallsDay']=0x0;_0x217cc[_0x5f122a][_0xcb72('0x36')]=0x0;_0x217cc[_0x5f122a][_0xcb72('0x37')]=0x0;_0x217cc[_0x5f122a][_0xcb72('0x38')]=0x0;_0x217cc[_0x5f122a][_0xcb72('0x39')]=0x0;_0x217cc[_0x5f122a]['outboundRejectCallsDay']=0x0;_0x217cc[_0x5f122a][_0xcb72('0x3a')]=0x0;_0x217cc[_0x5f122a][_0xcb72('0x32')]=0x0;_0x217cc[_0x5f122a][_0xcb72('0x3b')]=0x0;_0x217cc[_0x5f122a]['queueStatusComplete']=!![];}}}}Realtime[_0xcb72('0x3c')]['mergeFromDatabase']=function(_0x49fa1a,_0x184826){for(var _0x52e467 in _0x184826){if(_0x49fa1a[_0xcb72('0x21')](_0x52e467)){_0x49fa1a[_0x52e467]=_0x184826[_0x52e467];}}};Realtime[_0xcb72('0x3c')]['initAgents']=function(){var _0x33c7ee=this;return function(_0x4ace01){if(_0x4ace01){freeIsNotKeyAgent(_0x4ace01,_0x33c7ee[_0xcb72('0xe')]);for(var _0x54d6fa=0x0,_0xce485b={},_0x438bf6={};_0x54d6fa<_0x4ace01[_0xcb72('0x3d')];_0x54d6fa+=0x1){_0xce485b=_0x4ace01[_0x54d6fa];var _0x5538ac=_[_0xcb72('0x24')](_0xce485b['interface'])?util[_0xcb72('0x23')]('SIP/%s',_0xce485b['name']):_0xce485b[_0xcb72('0x25')];if(_['isUndefined'](_0x33c7ee['agents'][_0x5538ac])){_0x33c7ee[_0xcb72('0xe')][_0x5538ac]=new Agent(_0xce485b);}else{_0x33c7ee[_0xcb72('0x3e')](_0x33c7ee[_0xcb72('0xe')][_0x5538ac],_0xce485b);}}}return _0x33c7ee[_0xcb72('0xe')];};};Realtime[_0xcb72('0x3c')][_0xcb72('0x3f')]=function(){var _0x3eb32d=this;return function(_0x31455e){if(_0x31455e){freeIsNotKeySip(_0x31455e,_0x3eb32d[_0xcb72('0xf')]);for(var _0x49c987=0x0,_0x51dc2f={},_0xd7c235={};_0x49c987<_0x31455e[_0xcb72('0x3d')];_0x49c987+=0x1){_0x51dc2f=_0x31455e[_0x49c987];if(_[_0xcb72('0x40')](_0x3eb32d['telephones'][util[_0xcb72('0x23')](_0xcb72('0x26'),_0x51dc2f[_0xcb72('0x27')])])){_0x3eb32d[_0xcb72('0xf')][util[_0xcb72('0x23')]('SIP/%s',_0x51dc2f[_0xcb72('0x27')])]=new Telephone(_0x51dc2f);}else{_0x3eb32d[_0xcb72('0x3e')](_0x3eb32d[_0xcb72('0xf')][util[_0xcb72('0x23')](_0xcb72('0x26'),_0x51dc2f[_0xcb72('0x27')])],_0x51dc2f);}}}return _0x3eb32d[_0xcb72('0xf')];};};Realtime[_0xcb72('0x3c')][_0xcb72('0x41')]=function(){var _0xd9368c=this;return function(_0x34c5be){if(_0x34c5be){freeIsNotKeySip(_0x34c5be,_0xd9368c[_0xcb72('0x10')]);for(var _0x1e2d05=0x0,_0x3e023d={},_0x4e5587={};_0x1e2d05<_0x34c5be[_0xcb72('0x3d')];_0x1e2d05+=0x1){_0x3e023d=_0x34c5be[_0x1e2d05];if(_['isUndefined'](_0xd9368c[_0xcb72('0x10')][util[_0xcb72('0x23')]('SIP/%s',_0x3e023d['name'])])){_0xd9368c['trunks'][util['format'](_0xcb72('0x26'),_0x3e023d[_0xcb72('0x27')])]=new Trunk(_0x3e023d);}else{_0xd9368c[_0xcb72('0x3e')](_0xd9368c[_0xcb72('0x10')][util[_0xcb72('0x23')]('SIP/%s',_0x3e023d[_0xcb72('0x27')])],_0x3e023d);}}}return _0xd9368c[_0xcb72('0x10')];};};Realtime['prototype'][_0xcb72('0x42')]=function(){var _0x3dc0dd=this;return function(_0x1042c4){if(_0x1042c4){freeIsNotKey(_0x1042c4,_0x3dc0dd[_0xcb72('0x11')],'name');for(var _0x3508f3=0x0,_0x348068={},_0x38798e={};_0x3508f3<_0x1042c4[_0xcb72('0x3d')];_0x3508f3+=0x1){_0x348068=_0x1042c4[_0x3508f3];if(_['isUndefined'](_0x3dc0dd[_0xcb72('0x11')][_0x348068[_0xcb72('0x27')]])){_0x3dc0dd[_0xcb72('0x11')][_0x348068['name']]=new VoiceQueue(_0x348068);}else{_0x3dc0dd[_0xcb72('0x3e')](_0x3dc0dd['voiceQueues'][_0x348068[_0xcb72('0x27')]],_0x348068);}}}return _0x3dc0dd['voiceQueues'];};};Realtime[_0xcb72('0x3c')][_0xcb72('0x43')]=function(){var _0xf31d17=this;return function(_0x3ba8f5){if(_0x3ba8f5){freeIsNotKey(_0x3ba8f5,_0xf31d17[_0xcb72('0x44')],'id');for(var _0x3c8116=0x0,_0x522716={},_0x1bf156={};_0x3c8116<_0x3ba8f5[_0xcb72('0x3d')];_0x3c8116+=0x1){_0x522716=_0x3ba8f5[_0x3c8116];if(_['isUndefined'](_0xf31d17['triggers'][_0x522716['id']])){_0xf31d17[_0xcb72('0x44')][_0x522716['id']]=new Trigger(_0x522716);}else{_0xf31d17[_0xcb72('0x3e')](_0xf31d17[_0xcb72('0x44')][_0x522716['id']],_0x522716);}}}return _0xf31d17['triggers'];};};Realtime[_0xcb72('0x3c')]['initTemplates']=function(){var _0x366dec=this;return function(_0x1d9d7e){if(_0x1d9d7e){freeIsNotKey(_0x1d9d7e,_0x366dec['templates'],'id');for(var _0x35d165=0x0,_0x415075={},_0x24a0e7={};_0x35d165<_0x1d9d7e['length'];_0x35d165+=0x1){_0x415075=_0x1d9d7e[_0x35d165];if(_['isUndefined'](_0x366dec[_0xcb72('0x13')][_0x415075['id']])){_0x366dec[_0xcb72('0x13')][_0x415075['id']]=new Template(_0x415075);}else{_0x366dec[_0xcb72('0x3e')](_0x366dec[_0xcb72('0x13')][_0x415075['id']],_0x415075);}}}return _0x366dec['templates'];};};Realtime['prototype']['initZendeskAccounts']=function(){var _0x4ef83c=this;return function(_0x2150f4){if(_0x2150f4){freeIsNotKey(_0x2150f4,_0x4ef83c[_0xcb72('0x19')],'id');for(var _0x58e280=0x0,_0xf58178={},_0x52a7d6={};_0x58e280<_0x2150f4['length'];_0x58e280+=0x1){_0xf58178=_0x2150f4[_0x58e280];if(_[_0xcb72('0x40')](_0x4ef83c[_0xcb72('0x19')][_0xf58178['id']])){_0x4ef83c[_0xcb72('0x19')][_0xf58178['id']]=new ZendeskAccount(_0xf58178);}else{_0x4ef83c['mergeFromDatabase'](_0x4ef83c['zendeskAccounts'][_0xf58178['id']],_0xf58178);}}}return _0x4ef83c[_0xcb72('0x19')];};};Realtime[_0xcb72('0x3c')][_0xcb72('0x45')]=function(){var _0x3afff4=this;return function(_0x2ebcff){if(_0x2ebcff){freeIsNotKey(_0x2ebcff,_0x3afff4[_0xcb72('0x1a')],'id');for(var _0x1495b9=0x0,_0x213ea5={},_0x7996fe={};_0x1495b9<_0x2ebcff[_0xcb72('0x3d')];_0x1495b9+=0x1){_0x213ea5=_0x2ebcff[_0x1495b9];if(_[_0xcb72('0x40')](_0x3afff4[_0xcb72('0x1a')][_0x213ea5['id']])){_0x3afff4[_0xcb72('0x1a')][_0x213ea5['id']]=new SalesforceAccount(_0x213ea5);}else{_0x3afff4[_0xcb72('0x3e')](_0x3afff4[_0xcb72('0x1a')][_0x213ea5['id']],_0x213ea5);}}}return _0x3afff4[_0xcb72('0x1a')];};};Realtime[_0xcb72('0x3c')][_0xcb72('0x46')]=function(){var _0x498b6f=this;return function(_0x24c507){if(_0x24c507){freeIsNotKey(_0x24c507,_0x498b6f[_0xcb72('0x1c')],'id');for(var _0x3d2f25=0x0,_0xcb078e={},_0x50e79e={};_0x3d2f25<_0x24c507[_0xcb72('0x3d')];_0x3d2f25+=0x1){_0xcb078e=_0x24c507[_0x3d2f25];if(_['isUndefined'](_0x498b6f[_0xcb72('0x1c')][_0xcb078e['id']])){_0x498b6f[_0xcb72('0x1c')][_0xcb078e['id']]=new FreshdeskAccount(_0xcb078e);}else{_0x498b6f['mergeFromDatabase'](_0x498b6f[_0xcb72('0x1c')][_0xcb078e['id']],_0xcb078e);}}}return _0x498b6f[_0xcb72('0x1c')];};};Realtime['prototype'][_0xcb72('0x47')]=function(){var _0x24393b=this;return function(_0x4b16ac){if(_0x4b16ac){freeIsNotKey(_0x4b16ac,_0x24393b[_0xcb72('0x1d')],'id');for(var _0x521af2=0x0,_0x421910={},_0x24b5eb={};_0x521af2<_0x4b16ac[_0xcb72('0x3d')];_0x521af2+=0x1){_0x421910=_0x4b16ac[_0x521af2];if(_[_0xcb72('0x40')](_0x24393b[_0xcb72('0x1d')][_0x421910['id']])){_0x24393b[_0xcb72('0x1d')][_0x421910['id']]=new ZohoAccount(_0x421910);}else{_0x24393b[_0xcb72('0x3e')](_0x24393b['zohoAccounts'][_0x421910['id']],_0x421910);}}}return _0x24393b[_0xcb72('0x1d')];};};Realtime[_0xcb72('0x3c')][_0xcb72('0x48')]=function(){var _0x4a1937=this;return function(_0x3115dc){if(_0x3115dc){freeIsNotKey(_0x3115dc,_0x4a1937[_0xcb72('0x49')],'id');for(var _0x625440=0x0,_0x2b7e76={},_0x2f4e98={};_0x625440<_0x3115dc['length'];_0x625440+=0x1){_0x2b7e76=_0x3115dc[_0x625440];if(_['isUndefined'](_0x4a1937[_0xcb72('0x49')][_0x2b7e76['id']])){_0x4a1937[_0xcb72('0x49')][_0x2b7e76['id']]=new DeskAccount(_0x2b7e76);}else{_0x4a1937[_0xcb72('0x3e')](_0x4a1937[_0xcb72('0x49')][_0x2b7e76['id']],_0x2b7e76);}}}return _0x4a1937[_0xcb72('0x49')];};};Realtime[_0xcb72('0x3c')]['initSugarcrmAccounts']=function(){var _0x1e9ead=this;return function(_0x59f548){if(_0x59f548){freeIsNotKey(_0x59f548,_0x1e9ead[_0xcb72('0x1b')],'id');for(var _0x388ba8=0x0,_0x35c63d={},_0x1adfe9={};_0x388ba8<_0x59f548['length'];_0x388ba8+=0x1){_0x35c63d=_0x59f548[_0x388ba8];if(_[_0xcb72('0x40')](_0x1e9ead[_0xcb72('0x1b')][_0x35c63d['id']])){_0x1e9ead['sugarcrmAccounts'][_0x35c63d['id']]=new SugarcrmAccount(_0x35c63d);}else{_0x1e9ead[_0xcb72('0x3e')](_0x1e9ead[_0xcb72('0x1b')][_0x35c63d['id']],_0x35c63d);}}}return _0x1e9ead[_0xcb72('0x1b')];};};Realtime[_0xcb72('0x3c')]['initVtigerAccounts']=function(){var _0x11d8d3=this;return function(_0x43f00a){if(_0x43f00a){freeIsNotKey(_0x43f00a,_0x11d8d3[_0xcb72('0x1e')],'id');for(var _0x1bf29f=0x0,_0x17ac6d={},_0x472801={};_0x1bf29f<_0x43f00a[_0xcb72('0x3d')];_0x1bf29f+=0x1){_0x17ac6d=_0x43f00a[_0x1bf29f];if(_['isUndefined'](_0x11d8d3[_0xcb72('0x1e')][_0x17ac6d['id']])){_0x11d8d3[_0xcb72('0x1e')][_0x17ac6d['id']]=new VtigerAccount(_0x17ac6d);}else{_0x11d8d3['mergeFromDatabase'](_0x11d8d3['vtigerAccounts'][_0x17ac6d['id']],_0x17ac6d);}}}return _0x11d8d3[_0xcb72('0x1e')];};};Realtime[_0xcb72('0x3c')][_0xcb72('0x4a')]=function(){var _0x52143c=this;return function(_0x37f1a5){if(_0x37f1a5){freeIsNotKey(_0x37f1a5,_0x52143c[_0xcb72('0x4b')],'id');for(var _0x5a039e=0x0,_0x1d6c17={},_0x37bd68={};_0x5a039e<_0x37f1a5[_0xcb72('0x3d')];_0x5a039e+=0x1){_0x1d6c17=_0x37f1a5[_0x5a039e];if(_[_0xcb72('0x40')](_0x52143c['servicenowAccounts'][_0x1d6c17['id']])){_0x52143c[_0xcb72('0x4b')][_0x1d6c17['id']]=new ServicenowAccount(_0x1d6c17);}else{_0x52143c['mergeFromDatabase'](_0x52143c['servicenowAccounts'][_0x1d6c17['id']],_0x1d6c17);}}}return _0x52143c['servicenowAccounts'];};};Realtime[_0xcb72('0x3c')][_0xcb72('0x4c')]=function(){var _0x5b673e=this;return function(_0x5cb131){if(_0x5cb131){freeIsNotKey(_0x5cb131,_0x5b673e[_0xcb72('0x4d')],'id');for(var _0x4dee36=0x0,_0x3ef3b9={},_0x275be5={};_0x4dee36<_0x5cb131['length'];_0x4dee36+=0x1){_0x3ef3b9=_0x5cb131[_0x4dee36];if(_[_0xcb72('0x40')](_0x5b673e[_0xcb72('0x4d')][_0x3ef3b9['id']])){_0x5b673e[_0xcb72('0x4d')][_0x3ef3b9['id']]=new Dynamics365Account(_0x3ef3b9);}else{_0x5b673e[_0xcb72('0x3e')](_0x5b673e[_0xcb72('0x4d')][_0x3ef3b9['id']],_0x3ef3b9);}}}return _0x5b673e['dynamics365Accounts'];};};Realtime['prototype']['initFreshsalesAccounts']=function(){var _0x33d0e8=this;return function(_0x469fd5){if(_0x469fd5){freeIsNotKey(_0x469fd5,_0x33d0e8['freshsalesAccounts'],'id');for(var _0x1ff439=0x0,_0x8287d3={},_0x5017ef={};_0x1ff439<_0x469fd5[_0xcb72('0x3d')];_0x1ff439+=0x1){_0x8287d3=_0x469fd5[_0x1ff439];if(_[_0xcb72('0x40')](_0x33d0e8[_0xcb72('0x1f')][_0x8287d3['id']])){_0x33d0e8[_0xcb72('0x1f')][_0x8287d3['id']]=new FreshsalesAccount(_0x8287d3);}else{_0x33d0e8[_0xcb72('0x3e')](_0x33d0e8[_0xcb72('0x1f')][_0x8287d3['id']],_0x8287d3);}}}return _0x33d0e8['freshsalesAccounts'];};};Realtime[_0xcb72('0x3c')][_0xcb72('0x4e')]=function(){var _0x34d3f3=this;return function(_0x5154dc){for(var _0x41f573=0x0;_0x41f573<_0x5154dc[_0xcb72('0x3d')];_0x41f573+=0x1){_[_0xcb72('0x4f')](_0x34d3f3[_0xcb72('0x11')][_0x5154dc[_0x41f573][_0xcb72('0x27')]],_0x5154dc[_0x41f573]);}return _0x34d3f3[_0xcb72('0x11')];};};Realtime[_0xcb72('0x3c')][_0xcb72('0x50')]=function(){var _0x40cc02=this;return function(_0x1dbb3f){clearVoiceQueues(_0x40cc02[_0xcb72('0x11')]);if(_0x1dbb3f){_0x1dbb3f=_[_0xcb72('0x51')](_0x1dbb3f,'uniqueid');for(var _0x5462fa in _0x1dbb3f){if(_0x1dbb3f[_0xcb72('0x21')](_0x5462fa)){var _0x186d6c={};for(var _0x426880=0x0;_0x426880<_0x1dbb3f[_0x5462fa][_0xcb72('0x3d')];_0x426880+=0x1){var _0x2b1b52=_0x1dbb3f[_0x5462fa][_0x426880]['queue'];if(_0x40cc02[_0xcb72('0x11')][_0x2b1b52]){if(_0x1dbb3f[_0x5462fa][_0x426880][_0xcb72('0x52')]){_0x40cc02[_0xcb72('0x11')][_0x2b1b52][_0xcb72('0x2f')]+=0x1;}if(_0x1dbb3f[_0x5462fa][_0x426880][_0xcb72('0x53')]){_0x40cc02[_0xcb72('0x11')][_0x2b1b52][_0xcb72('0x30')]+=0x1;}_0x40cc02['voiceQueues'][_0x2b1b52][_0xcb72('0x2a')]+=moment(_0x1dbb3f[_0x5462fa][_0x426880][_0xcb72('0x54')])['diff'](moment(_0x1dbb3f[_0x5462fa][_0x426880]['queuecallerjoinAt']),_0xcb72('0x55'))||0x0;if(_0x426880===_0x1dbb3f[_0x5462fa][_0xcb72('0x3d')]-0x1){_0x40cc02[_0xcb72('0x11')][_0x2b1b52][_0xcb72('0x2b')]+=moment(_0x1dbb3f[_0x5462fa][_0x426880][_0xcb72('0x56')]||_0x1dbb3f[_0x5462fa][_0x426880]['queuecallerabandonAt']||_0x1dbb3f[_0x5462fa][_0x426880][_0xcb72('0x57')])[_0xcb72('0x58')](moment(_0x1dbb3f[_0x5462fa][_0x426880][_0xcb72('0x59')]),_0xcb72('0x55'))||0x0;_0x40cc02[_0xcb72('0x11')][_0x2b1b52][_0xcb72('0x28')]+=0x1;if(_0x1dbb3f[_0x5462fa][_0x426880][_0xcb72('0x5a')]){_0x40cc02['voiceQueues'][_0x2b1b52][_0xcb72('0x29')]+=0x1;_0x40cc02[_0xcb72('0x11')][_0x2b1b52][_0xcb72('0x31')]+=moment(_0x1dbb3f[_0x5462fa][_0x426880][_0xcb72('0x56')])[_0xcb72('0x58')](moment(_0x1dbb3f[_0x5462fa][_0x426880][_0xcb72('0x54')]),_0xcb72('0x55'))||0x0;}}else{_0x40cc02['voiceQueues'][_0x2b1b52][_0xcb72('0x2b')]+=_0x40cc02['voiceQueues'][_0x2b1b52]['sumHoldTime']||0x0;}}}}}}return _0x40cc02['voiceQueues'];};};Realtime['prototype'][_0xcb72('0x5b')]=function(){var _0x12cb63=this;return function(_0x1bdd1c){clearVoiceCallReports(_0x12cb63['outbound']);if(_0x1bdd1c){for(var _0xc7fcd0=0x0;_0xc7fcd0<_0x1bdd1c[_0xcb72('0x3d')];_0xc7fcd0+=0x1){_0x12cb63[_0xcb72('0x5c')][_0xcb72('0x28')]+=0x1;_0x12cb63[_0xcb72('0x5c')]['sumDuration']+=_0x1bdd1c[_0xc7fcd0][_0xcb72('0x5d')];if(_0x1bdd1c[_0xc7fcd0][_0xcb72('0x5e')]===_0xcb72('0x5f')){_0x12cb63[_0xcb72('0x5c')][_0xcb72('0x29')]+=0x1;_0x12cb63[_0xcb72('0x5c')][_0xcb72('0x2a')]+=_0x1bdd1c[_0xc7fcd0][_0xcb72('0x5d')]-_0x1bdd1c[_0xc7fcd0]['billableseconds']||0x0;_0x12cb63[_0xcb72('0x5c')][_0xcb72('0x31')]+=_0x1bdd1c[_0xc7fcd0][_0xcb72('0x60')];}}}return _0x12cb63[_0xcb72('0x5c')];};};Realtime['prototype'][_0xcb72('0x61')]=function(){var _0x461e5=this;return function(_0x35d74f){if(_0x35d74f){freeIsNotKey(_0x35d74f,_0x461e5['campaigns'],_0xcb72('0x27'));for(var _0x4604e3=0x0,_0x4d799b={};_0x4604e3<_0x35d74f['length'];_0x4604e3+=0x1){_0x4d799b=_0x35d74f[_0x4604e3];if(_['isUndefined'](_0x461e5[_0xcb72('0x12')][_0x4d799b[_0xcb72('0x27')]])){_0x461e5[_0xcb72('0x12')][_0x4d799b[_0xcb72('0x27')]]=new Campaign(_0x4d799b);}else{_0x461e5[_0xcb72('0x3e')](_0x461e5[_0xcb72('0x12')][_0x4d799b['name']],_0x4d799b);_0x461e5[_0xcb72('0x12')][_0x4d799b[_0xcb72('0x27')]][_0xcb72('0x62')]=_0x4d799b[_0xcb72('0x63')]?_0x4d799b[_0xcb72('0x63')][_0xcb72('0x27')]:undefined;}}}return _0x461e5[_0xcb72('0x12')];};};Realtime[_0xcb72('0x3c')][_0xcb72('0x64')]=function(){var _0x8fc845=this;return function(_0x56c86b){if(_0x56c86b){freeIsNotKey(_0x56c86b,_0x8fc845['voiceExtensions'],'id');for(var _0x3f5339=0x0,_0x738173={};_0x3f5339<_0x56c86b[_0xcb72('0x3d')];_0x3f5339+=0x1){_0x738173=_0x56c86b[_0x3f5339];if(_[_0xcb72('0x40')](_0x8fc845[_0xcb72('0x14')][_0x738173['id']])){_0x8fc845[_0xcb72('0x14')][_0x738173['id']]=new VoiceExtension(_0x738173);}else{_0x8fc845[_0xcb72('0x3e')](_0x8fc845[_0xcb72('0x14')][_0x738173['id']],_0x738173);}}}return _0x8fc845[_0xcb72('0x14')];};};Realtime[_0xcb72('0x3c')][_0xcb72('0x65')]=function(){var _0x336b68=this;return function(_0x29466c){clearCampaigns(_0x336b68['campaigns']);for(var _0x4fda6e=0x0;_0x4fda6e<_0x29466c[_0xcb72('0x3d')];_0x4fda6e+=0x1){_[_0xcb72('0x4f')](_0x336b68[_0xcb72('0x12')][_0x29466c[_0x4fda6e][_0xcb72('0x27')]],_0x29466c[_0x4fda6e]);}return _0x336b68[_0xcb72('0x12')];};};Realtime[_0xcb72('0x3c')][_0xcb72('0x66')]=function(){var _0x4318b7=this;return function(_0x178195){if(_0x178195){freeIsNotKey(_0x178195,_0x4318b7[_0xcb72('0x20')],'id');for(var _0x173c83=0x0,_0x58fdf2={},_0x1ef355={};_0x173c83<_0x178195['length'];_0x173c83+=0x1){_0x58fdf2=_0x178195[_0x173c83];if(_['isUndefined'](_0x4318b7['faxAccounts'][_0x58fdf2['id']])){_0x4318b7[_0xcb72('0x20')][_0x58fdf2['id']]=new FaxAccount(_0x58fdf2);}else{_0x4318b7[_0xcb72('0x3e')](_0x4318b7[_0xcb72('0x20')][_0x58fdf2['id']],_0x58fdf2);}}}return _0x4318b7[_0xcb72('0x20')];};};module['exports']=Realtime; \ No newline at end of file diff --git a/server/services/ami/report/index.js b/server/services/ami/report/index.js index 7a5564f..c041a9e 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 _0x3847=['connectedlinenum','originatecalleridnum','xcally-motion-dialer','startsWith','substring','indexOf','mobile','phone','membername','transfererlinkedid','attendedTransfer','exports','lodash','moment','util','../../../config/environment','../ami','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceQueueReport','../rpc/voiceTransferReport','./voiceCallReport','./voiceAgentReport','./voiceDialReport','./userReport','realtime','agents','prototype','sync','xdr','custom:voiceQueueReport','custom:voiceCallReport','voiceCallReport','voiceAgentReport','bind','voiceDialReport','blindtransfer','attendedtransfer','findAgent','accountcode','name','isNil','telephones','find','interface','format','SIP/%s','voiceQueueReport','assigned','lastAssignedTo','queuecallercomplete','queuecallercompleteAt','YYYY-MM-DD\x20HH:mm:ss','queuecallerexitAt','create','match','destination','type','dialer','lastapplication','queue','lastdata','from-voip-provider','callerid','context','from-sip','xcally-motion-preview','calleridpreview','calleridnum','destinationchannel','channel','ANSWERED','\x22%s\x22\x20<%s>','transfers','linkedid','transfereelinkedid','uniqueid','blindTransfer','monitors','monitorFilename','filename','createdAt','exten','calleridname'];(function(_0x4b7976,_0x55e10b){var _0x422298=function(_0x531d4b){while(--_0x531d4b){_0x4b7976['push'](_0x4b7976['shift']());}};_0x422298(++_0x55e10b);}(_0x3847,0x160));var _0x7384=function(_0x574285,_0x1980fe){_0x574285=_0x574285-0x0;var _0x5157cc=_0x3847[_0x574285];return _0x5157cc;};'use strict';var _=require(_0x7384('0x0'));var moment=require(_0x7384('0x1'));var util=require(_0x7384('0x2'));var config=require(_0x7384('0x3'));var ami=require(_0x7384('0x4'));var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');var RpcVoiceCallReport=require(_0x7384('0x5'));var RpcVoiceDialReport=require(_0x7384('0x6'));var RpcMemberReport=require(_0x7384('0x7'));var RpcVoiceQueueReport=require(_0x7384('0x8'));var RpcVoiceRecording=require('../rpc/voiceRecording');var RpcVoiceTransferReport=require(_0x7384('0x9'));var VoiceQueueReport=require('./voiceQueueReport');var VoiceCallReport=require(_0x7384('0xa'));var VoiceAgentReport=require(_0x7384('0xb'));var VoiceDialReport=require(_0x7384('0xc'));var UserReport=require(_0x7384('0xd'));function Report(_0x3aefa4){this[_0x7384('0xe')]=_0x3aefa4;this[_0x7384('0xf')]=_0x3aefa4['agents'];this['telephones']=_0x3aefa4['telephones'];}Report[_0x7384('0x10')][_0x7384('0x11')]=function(_0xb47aa0){var _0x598a98=new VoiceQueueReport(this['realtime']);var _0x1abc8f=new VoiceAgentReport(this['realtime']);var _0x2ebb78=new VoiceDialReport(this[_0x7384('0xe')]);var _0x12a68f=new VoiceCallReport(this['realtime']);var _0x2d9a5f=new UserReport(this[_0x7384('0xe')]);if(config[_0x7384('0x12')]&&config['xdr']['disabled']){ami['on'](_0x7384('0x13'),this['voiceQueueReport']['bind'](this));ami['on'](_0x7384('0x14'),this[_0x7384('0x15')]['bind'](this));ami['on']('custom:voiceAgentReport',this[_0x7384('0x16')][_0x7384('0x17')](this));ami['on']('custom:voiceDialReport',this[_0x7384('0x18')]['bind'](this));ami['on'](_0x7384('0x19'),this['blindTransfer'][_0x7384('0x17')](this));ami['on'](_0x7384('0x1a'),this['attendedTransfer'][_0x7384('0x17')](this));}};Report['prototype'][_0x7384('0x1b')]=function(_0x49663c){var _0xc792de;_0xc792de=_['find'](this[_0x7384('0xf')],function(_0x41660f){return _0x41660f[_0x7384('0x1c')]==_0x49663c||_0x41660f[_0x7384('0x1d')]==_0x49663c;});if(_[_0x7384('0x1e')](_0xc792de)){var _0x93eb30=_['find'](this[_0x7384('0x1f')],function(_0x28b266){return _0x28b266[_0x7384('0x1c')]==_0x49663c||_0x28b266['name']==_0x49663c;});if(_0x93eb30){_0xc792de=_[_0x7384('0x20')](this[_0x7384('0xf')],function(_0x286047){return _0x286047[_0x7384('0x21')]==util[_0x7384('0x22')](_0x7384('0x23'),_0x93eb30[_0x7384('0x1d')]);});}}return _0xc792de;};Report['prototype'][_0x7384('0x24')]=function(_0x20b187){for(var _0x45f266=0x0;_0x45f266<_0x20b187['length'];_0x45f266+=0x1){var _0x121b4c=this[_0x7384('0x1b')](_0x20b187[_0x45f266]['connectedlinenum']);if(_0x121b4c){_0x20b187[_0x45f266][_0x7384('0x1c')]=_0x121b4c['accountcode'];_0x20b187[_0x45f266][_0x7384('0x25')]=!![];_0x20b187[_0x45f266][_0x7384('0x26')]=_0x121b4c[_0x7384('0x1d')];_0x20b187[_0x45f266]['interface']=_[_0x7384('0x1e')](_0x121b4c[_0x7384('0x21')])?util[_0x7384('0x22')](_0x7384('0x23'),_0x121b4c[_0x7384('0x1d')]):_0x121b4c[_0x7384('0x21')];if(_0x20b187[_0x45f266][_0x7384('0x27')]){_0x20b187[_0x45f266][_0x7384('0x28')]=moment()[_0x7384('0x22')](_0x7384('0x29'));}if(_0x20b187[_0x45f266]['queuecallerexit']){_0x20b187[_0x45f266][_0x7384('0x2a')]=moment()['format'](_0x7384('0x29'));}RpcMemberReport['voiceQueueReport'](_0x20b187[_0x45f266]);}RpcVoiceQueueReport[_0x7384('0x2b')](_0x20b187[_0x45f266]);}};function extractCalleridNumber(_0x396884){var _0x1c2387=_0x396884[_0x7384('0x2c')](/<(.*?)>/);return _0x1c2387?_0x1c2387[0x1]:_0x396884;}Report[_0x7384('0x10')][_0x7384('0x15')]=function(_0x4fdb67){_0x4fdb67['destination']=_0x4fdb67[_0x7384('0x2d')]||_0x4fdb67['exten'];if(_0x4fdb67[_0x7384('0x2e')]==_0x7384('0x2f')){_0x4fdb67[_0x7384('0x30')]=_0x7384('0x31');_0x4fdb67[_0x7384('0x32')]=_0x4fdb67[_0x7384('0x31')];if(_0x4fdb67['context']==_0x7384('0x33')){_0x4fdb67[_0x7384('0x1c')]='';_0x4fdb67['destination']=extractCalleridNumber(_0x4fdb67[_0x7384('0x34')]);}else if(_0x4fdb67[_0x7384('0x35')]==_0x7384('0x36')){if(_0x4fdb67[_0x7384('0x2d')]==_0x7384('0x37')){_0x4fdb67[_0x7384('0x2d')]=extractCalleridNumber(_0x4fdb67[_0x7384('0x38')]);_0x4fdb67[_0x7384('0x39')]=_0x4fdb67['originatecalleridnum'];_0x4fdb67[_0x7384('0x3a')]=[_0x4fdb67[_0x7384('0x3b')],_0x4fdb67[_0x7384('0x3b')]=_0x4fdb67[_0x7384('0x3a')]][0x0];_0x4fdb67[_0x7384('0x34')]=_0x4fdb67[_0x7384('0x38')];}else{_0x4fdb67[_0x7384('0x2d')]=_0x4fdb67[_0x7384('0x39')];_0x4fdb67['calleridnum']=_0x4fdb67['originatecalleridnum'];if(_0x4fdb67['disposition']==_0x7384('0x3c')){_0x4fdb67['accountcode']=_0x4fdb67['connectedlinenum'];}else{_0x4fdb67['accountcode']='';}}}}else{_0x4fdb67['callerid']=util[_0x7384('0x22')](_0x7384('0x3d'),_0x4fdb67['calleridname'],_0x4fdb67[_0x7384('0x39')]);}if(RpcVoiceTransferReport['transfers'][_0x4fdb67['linkedid']]){var _0xb5c3b7=RpcVoiceTransferReport[_0x7384('0x3e')][_0x4fdb67[_0x7384('0x3f')]];_0xb5c3b7[_0x7384('0x40')]=_0x4fdb67[_0x7384('0x41')];RpcVoiceTransferReport[_0x7384('0x42')](_0xb5c3b7);delete RpcVoiceTransferReport['transfers'][_0x4fdb67[_0x7384('0x3f')]];}RpcVoiceCallReport[_0x7384('0x2b')](_0x4fdb67);if(_0x4fdb67['monitor']){for(var _0x45e741=0x0;_0x45e741<_0x4fdb67[_0x7384('0x43')]['length'];_0x45e741+=0x1){_0x4fdb67[_0x7384('0x44')]=_0x4fdb67[_0x7384('0x43')][_0x45e741][_0x7384('0x45')];_0x4fdb67[_0x7384('0x46')]=_0x4fdb67['monitors'][_0x45e741]['createdAt'];if(_0x4fdb67[_0x7384('0x47')]==_0x7384('0x37')){_0x4fdb67[_0x7384('0x39')]=_0x4fdb67['connectedlinenum'];_0x4fdb67[_0x7384('0x48')]=_0x4fdb67['connectedlinename'];_0x4fdb67[_0x7384('0x49')]=_0x4fdb67['accountcode'];_0x4fdb67['connectedlinename']=_0x4fdb67['membername'];_0x4fdb67['exten']=_0x4fdb67[_0x7384('0x4a')];}else if(_0x4fdb67[_0x7384('0x47')]==_0x7384('0x4b')){_0x4fdb67['calleridnum']=_0x4fdb67[_0x7384('0x2d')];_0x4fdb67[_0x7384('0x47')]=_0x4fdb67[_0x7384('0x4a')];}RpcVoiceRecording['create'](_0x4fdb67);}}};Report['prototype']['voiceAgentReport']=function(_0x36f0f0){if(_['isArray'](_0x36f0f0)){_0x36f0f0['forEach'](function(_0x4a9d77){RpcVoiceAgentReport[_0x7384('0x2b')](_0x4a9d77);});}else{RpcVoiceAgentReport[_0x7384('0x2b')](_0x36f0f0);}};Report[_0x7384('0x10')]['voiceDialReport']=function(_0x47ea61){RpcVoiceDialReport[_0x7384('0x2b')](_0x47ea61);var _0x29d3da;var _0x1541d4;var _0x5bf686=_0x47ea61[_0x7384('0x3b')];if(_[_0x7384('0x4c')](_0x5bf686,'Local')){_0x1541d4=_0x5bf686[_0x7384('0x4d')](_0x5bf686[_0x7384('0x4e')]('/')+0x1,_0x5bf686[_0x7384('0x4e')]('@'));_0x29d3da=_['find'](this[_0x7384('0xf')],function(_0x21a907){return _0x21a907[_0x7384('0x4f')]==_0x1541d4||_0x21a907[_0x7384('0x50')]==_0x1541d4||_0x21a907[_0x7384('0x1c')]==_0x1541d4;});}else{_0x1541d4=_0x5bf686[_0x7384('0x4d')](_0x5bf686[_0x7384('0x4e')]('/')+0x1,_0x5bf686['lastIndexOf']('-'));_0x29d3da=this['findAgent'](_0x1541d4);}if(_0x29d3da){_0x47ea61[_0x7384('0x21')]=_[_0x7384('0x1e')](_0x29d3da[_0x7384('0x21')])?util[_0x7384('0x22')](_0x7384('0x23'),_0x29d3da[_0x7384('0x1d')]):_0x29d3da[_0x7384('0x21')];_0x47ea61[_0x7384('0x51')]=_0x29d3da[_0x7384('0x1d')];_0x47ea61[_0x7384('0x1c')]=_0x29d3da[_0x7384('0x1c')];RpcMemberReport['voiceDialReport'](_0x47ea61);}};Report[_0x7384('0x10')][_0x7384('0x42')]=function(_0x4426fe){RpcVoiceTransferReport[_0x7384('0x3e')][_0x4426fe[_0x7384('0x52')]]=_0x4426fe;};Report[_0x7384('0x10')][_0x7384('0x53')]=function(_0x3867d2){RpcVoiceTransferReport['attendedTransfer'](_0x3867d2);};module[_0x7384('0x54')]=Report; \ No newline at end of file +var _0xcdb0=['monitors','monitorFilename','filename','createdAt','xcally-motion-preview','connectedlinename','membername','isArray','forEach','startsWith','Local','substring','indexOf','mobile','phone','transfererlinkedid','moment','util','../../../config/environment','../ami','../rpc/voiceAgentReport','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceQueueReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceQueueReport','./voiceCallReport','./voiceDialReport','./userReport','realtime','agents','telephones','prototype','disabled','custom:voiceQueueReport','voiceQueueReport','bind','custom:voiceCallReport','voiceCallReport','custom:voiceAgentReport','voiceAgentReport','custom:voiceDialReport','voiceDialReport','attendedTransfer','findAgent','find','accountcode','name','isNil','interface','format','SIP/%s','length','lastAssignedTo','queuecallercomplete','queuecallercompleteAt','queuecallerexit','YYYY-MM-DD\x20HH:mm:ss','create','match','destination','exten','type','queue','context','calleridnum','channel','callerid','originatecalleridnum','ANSWERED','connectedlinenum','\x22%s\x22\x20<%s>','calleridname','linkedid','transfers','transfereelinkedid','uniqueid','blindTransfer','monitor'];(function(_0x47635e,_0xfa18e0){var _0x3d7b0c=function(_0x5d2bb0){while(--_0x5d2bb0){_0x47635e['push'](_0x47635e['shift']());}};_0x3d7b0c(++_0xfa18e0);}(_0xcdb0,0xb0));var _0x0cdb=function(_0x1c9623,_0xf8dd7d){_0x1c9623=_0x1c9623-0x0;var _0x5a9d11=_0xcdb0[_0x1c9623];return _0x5a9d11;};'use strict';var _=require('lodash');var moment=require(_0x0cdb('0x0'));var util=require(_0x0cdb('0x1'));var config=require(_0x0cdb('0x2'));var ami=require(_0x0cdb('0x3'));var RpcVoiceAgentReport=require(_0x0cdb('0x4'));var RpcVoiceCallReport=require('../rpc/voiceCallReport');var RpcVoiceDialReport=require(_0x0cdb('0x5'));var RpcMemberReport=require(_0x0cdb('0x6'));var RpcVoiceQueueReport=require(_0x0cdb('0x7'));var RpcVoiceRecording=require(_0x0cdb('0x8'));var RpcVoiceTransferReport=require(_0x0cdb('0x9'));var VoiceQueueReport=require(_0x0cdb('0xa'));var VoiceCallReport=require(_0x0cdb('0xb'));var VoiceAgentReport=require('./voiceAgentReport');var VoiceDialReport=require(_0x0cdb('0xc'));var UserReport=require(_0x0cdb('0xd'));function Report(_0x16bc7f){this[_0x0cdb('0xe')]=_0x16bc7f;this[_0x0cdb('0xf')]=_0x16bc7f[_0x0cdb('0xf')];this['telephones']=_0x16bc7f[_0x0cdb('0x10')];}Report[_0x0cdb('0x11')]['sync']=function(_0x2ae801){var _0x217939=new VoiceQueueReport(this['realtime']);var _0x5980eb=new VoiceAgentReport(this[_0x0cdb('0xe')]);var _0x5cad91=new VoiceDialReport(this[_0x0cdb('0xe')]);var _0x3ed6be=new VoiceCallReport(this[_0x0cdb('0xe')]);var _0x56bb35=new UserReport(this[_0x0cdb('0xe')]);if(config['xdr']&&config['xdr'][_0x0cdb('0x12')]){ami['on'](_0x0cdb('0x13'),this[_0x0cdb('0x14')][_0x0cdb('0x15')](this));ami['on'](_0x0cdb('0x16'),this[_0x0cdb('0x17')][_0x0cdb('0x15')](this));ami['on'](_0x0cdb('0x18'),this[_0x0cdb('0x19')]['bind'](this));ami['on'](_0x0cdb('0x1a'),this[_0x0cdb('0x1b')][_0x0cdb('0x15')](this));ami['on']('blindtransfer',this['blindTransfer'][_0x0cdb('0x15')](this));ami['on']('attendedtransfer',this[_0x0cdb('0x1c')][_0x0cdb('0x15')](this));}};Report[_0x0cdb('0x11')][_0x0cdb('0x1d')]=function(_0x28e0a0){var _0x59a441;_0x59a441=_[_0x0cdb('0x1e')](this[_0x0cdb('0xf')],function(_0x5ead34){return _0x5ead34[_0x0cdb('0x1f')]==_0x28e0a0||_0x5ead34[_0x0cdb('0x20')]==_0x28e0a0;});if(_[_0x0cdb('0x21')](_0x59a441)){var _0x4a169c=_[_0x0cdb('0x1e')](this[_0x0cdb('0x10')],function(_0x544f4e){return _0x544f4e[_0x0cdb('0x1f')]==_0x28e0a0||_0x544f4e[_0x0cdb('0x20')]==_0x28e0a0;});if(_0x4a169c){_0x59a441=_['find'](this[_0x0cdb('0xf')],function(_0xffab0c){return _0xffab0c[_0x0cdb('0x22')]==util[_0x0cdb('0x23')](_0x0cdb('0x24'),_0x4a169c[_0x0cdb('0x20')]);});}}return _0x59a441;};Report[_0x0cdb('0x11')][_0x0cdb('0x14')]=function(_0x39e74b){for(var _0x3bfeb7=0x0;_0x3bfeb7<_0x39e74b[_0x0cdb('0x25')];_0x3bfeb7+=0x1){var _0x58d019=this['findAgent'](_0x39e74b[_0x3bfeb7]['connectedlinenum']);if(_0x58d019){_0x39e74b[_0x3bfeb7]['accountcode']=_0x58d019[_0x0cdb('0x1f')];_0x39e74b[_0x3bfeb7]['assigned']=!![];_0x39e74b[_0x3bfeb7][_0x0cdb('0x26')]=_0x58d019['name'];_0x39e74b[_0x3bfeb7][_0x0cdb('0x22')]=_[_0x0cdb('0x21')](_0x58d019[_0x0cdb('0x22')])?util[_0x0cdb('0x23')](_0x0cdb('0x24'),_0x58d019['name']):_0x58d019[_0x0cdb('0x22')];if(_0x39e74b[_0x3bfeb7][_0x0cdb('0x27')]){_0x39e74b[_0x3bfeb7][_0x0cdb('0x28')]=moment()[_0x0cdb('0x23')]('YYYY-MM-DD\x20HH:mm:ss');}if(_0x39e74b[_0x3bfeb7][_0x0cdb('0x29')]){_0x39e74b[_0x3bfeb7]['queuecallerexitAt']=moment()[_0x0cdb('0x23')](_0x0cdb('0x2a'));}RpcMemberReport['voiceQueueReport'](_0x39e74b[_0x3bfeb7]);}RpcVoiceQueueReport[_0x0cdb('0x2b')](_0x39e74b[_0x3bfeb7]);}};function extractCalleridNumber(_0x31fae1){var _0x16aefd=_0x31fae1[_0x0cdb('0x2c')](/<(.*?)>/);return _0x16aefd?_0x16aefd[0x1]:_0x31fae1;}Report[_0x0cdb('0x11')][_0x0cdb('0x17')]=function(_0x3c448c){_0x3c448c[_0x0cdb('0x2d')]=_0x3c448c[_0x0cdb('0x2d')]||_0x3c448c[_0x0cdb('0x2e')];if(_0x3c448c[_0x0cdb('0x2f')]=='dialer'){_0x3c448c['lastapplication']=_0x0cdb('0x30');_0x3c448c['lastdata']=_0x3c448c[_0x0cdb('0x30')];if(_0x3c448c[_0x0cdb('0x31')]=='from-voip-provider'){_0x3c448c['accountcode']='';_0x3c448c[_0x0cdb('0x2d')]=extractCalleridNumber(_0x3c448c['callerid']);}else if(_0x3c448c[_0x0cdb('0x31')]=='from-sip'){if(_0x3c448c[_0x0cdb('0x2d')]=='xcally-motion-preview'){_0x3c448c['destination']=extractCalleridNumber(_0x3c448c['calleridpreview']);_0x3c448c[_0x0cdb('0x32')]=_0x3c448c['originatecalleridnum'];_0x3c448c['destinationchannel']=[_0x3c448c[_0x0cdb('0x33')],_0x3c448c[_0x0cdb('0x33')]=_0x3c448c['destinationchannel']][0x0];_0x3c448c[_0x0cdb('0x34')]=_0x3c448c['calleridpreview'];}else{_0x3c448c[_0x0cdb('0x2d')]=_0x3c448c['calleridnum'];_0x3c448c[_0x0cdb('0x32')]=_0x3c448c[_0x0cdb('0x35')];if(_0x3c448c['disposition']==_0x0cdb('0x36')){_0x3c448c['accountcode']=_0x3c448c[_0x0cdb('0x37')];}else{_0x3c448c[_0x0cdb('0x1f')]='';}}}}else{_0x3c448c[_0x0cdb('0x34')]=util[_0x0cdb('0x23')](_0x0cdb('0x38'),_0x3c448c[_0x0cdb('0x39')],_0x3c448c['calleridnum']);}if(RpcVoiceTransferReport['transfers'][_0x3c448c[_0x0cdb('0x3a')]]){var _0x175ebc=RpcVoiceTransferReport[_0x0cdb('0x3b')][_0x3c448c[_0x0cdb('0x3a')]];_0x175ebc[_0x0cdb('0x3c')]=_0x3c448c[_0x0cdb('0x3d')];RpcVoiceTransferReport[_0x0cdb('0x3e')](_0x175ebc);delete RpcVoiceTransferReport[_0x0cdb('0x3b')][_0x3c448c['linkedid']];}RpcVoiceCallReport[_0x0cdb('0x2b')](_0x3c448c);if(_0x3c448c[_0x0cdb('0x3f')]){for(var _0x4644c6=0x0;_0x4644c6<_0x3c448c[_0x0cdb('0x40')][_0x0cdb('0x25')];_0x4644c6+=0x1){_0x3c448c[_0x0cdb('0x41')]=_0x3c448c['monitors'][_0x4644c6][_0x0cdb('0x42')];_0x3c448c[_0x0cdb('0x43')]=_0x3c448c[_0x0cdb('0x40')][_0x4644c6]['createdAt'];if(_0x3c448c[_0x0cdb('0x2e')]==_0x0cdb('0x44')){_0x3c448c[_0x0cdb('0x32')]=_0x3c448c[_0x0cdb('0x37')];_0x3c448c[_0x0cdb('0x39')]=_0x3c448c['connectedlinename'];_0x3c448c['connectedlinenum']=_0x3c448c[_0x0cdb('0x1f')];_0x3c448c[_0x0cdb('0x45')]=_0x3c448c[_0x0cdb('0x46')];_0x3c448c[_0x0cdb('0x2e')]=_0x3c448c[_0x0cdb('0x35')];}else if(_0x3c448c['exten']=='xcally-motion-dialer'){_0x3c448c[_0x0cdb('0x32')]=_0x3c448c[_0x0cdb('0x2d')];_0x3c448c[_0x0cdb('0x2e')]=_0x3c448c[_0x0cdb('0x35')];}RpcVoiceRecording['create'](_0x3c448c);}}};Report[_0x0cdb('0x11')][_0x0cdb('0x19')]=function(_0xc66cfe){if(_[_0x0cdb('0x47')](_0xc66cfe)){_0xc66cfe[_0x0cdb('0x48')](function(_0x27f538){RpcVoiceAgentReport[_0x0cdb('0x2b')](_0x27f538);});}else{RpcVoiceAgentReport[_0x0cdb('0x2b')](_0xc66cfe);}};Report[_0x0cdb('0x11')][_0x0cdb('0x1b')]=function(_0x3545e9){RpcVoiceDialReport['create'](_0x3545e9);var _0x220ec4;var _0x3737a9;var _0x15a87d=_0x3545e9[_0x0cdb('0x33')];if(_[_0x0cdb('0x49')](_0x15a87d,_0x0cdb('0x4a'))){_0x3737a9=_0x15a87d[_0x0cdb('0x4b')](_0x15a87d['indexOf']('/')+0x1,_0x15a87d[_0x0cdb('0x4c')]('@'));_0x220ec4=_[_0x0cdb('0x1e')](this[_0x0cdb('0xf')],function(_0x2e6828){return _0x2e6828[_0x0cdb('0x4d')]==_0x3737a9||_0x2e6828[_0x0cdb('0x4e')]==_0x3737a9||_0x2e6828[_0x0cdb('0x1f')]==_0x3737a9;});}else{_0x3737a9=_0x15a87d[_0x0cdb('0x4b')](_0x15a87d[_0x0cdb('0x4c')]('/')+0x1,_0x15a87d['lastIndexOf']('-'));_0x220ec4=this[_0x0cdb('0x1d')](_0x3737a9);}if(_0x220ec4){_0x3545e9['interface']=_[_0x0cdb('0x21')](_0x220ec4[_0x0cdb('0x22')])?util[_0x0cdb('0x23')]('SIP/%s',_0x220ec4[_0x0cdb('0x20')]):_0x220ec4[_0x0cdb('0x22')];_0x3545e9[_0x0cdb('0x46')]=_0x220ec4[_0x0cdb('0x20')];_0x3545e9['accountcode']=_0x220ec4[_0x0cdb('0x1f')];RpcMemberReport['voiceDialReport'](_0x3545e9);}};Report['prototype'][_0x0cdb('0x3e')]=function(_0x29126f){RpcVoiceTransferReport[_0x0cdb('0x3b')][_0x29126f[_0x0cdb('0x4f')]]=_0x29126f;};Report[_0x0cdb('0x11')][_0x0cdb('0x1c')]=function(_0x254944){RpcVoiceTransferReport[_0x0cdb('0x1c')](_0x254944);};module['exports']=Report; \ No newline at end of file diff --git a/server/services/ami/report/userReport.js b/server/services/ami/report/userReport.js index 86a0d69..f9d21d6 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 _0xb4d9=['trunk:save','[userReport][devicestatechange]\x20device:%s\x20state:%s','device','[userReport][devicestatechange]','local','inuse','toLowerCase','stateTime','toNumber','[userReport][devicestatechange]\x20sending\x20telephone:save\x20event:','telephone:%s','telephone:save','[userReport][devicestatechange]\x20sending\x20trunk:save\x20event:','startsWith','Local','substring','indexOf','mobile','phone','accountcode','updateStatusRealtime','[userReport][peerstatus]\x20peer:%s\x20address:%s\x20status:%s','peer','address','[userReport][peerstatus]','status','[userReport][peerstatus]\x20sending\x20telephone:save\x20event:','trunk:%s','exports','lodash','moment','util','ioredis','bluebird','../../../config/environment','../../../config/logger','ami','defaults','redis','localhost','socket.io-emitter','trunks','agents','telephones','syncRegistry','bind','registry','syncDeviceState','peerstatus','syncPeerStatus','syncRealtimeShow','resolve','then','actionSipShowRegistry','catch','error','actionDeviceStateList','[userReport][devicestatelist]','inspect','actionSipPeerStatus','prototype','isNotNull','isUndefined','emit','info','[userReport][registry]\x20registry:%s\x20state:%s','state','debug','[userReport][registry]','find','username','stateRegistry','merge','omit','event','actionid','[userReport][registry]\x20sending\x20trunk:save\x20event:','format','name'];(function(_0x186818,_0x25d02f){var _0x14ab0d=function(_0x311c0c){while(--_0x311c0c){_0x186818['push'](_0x186818['shift']());}};_0x14ab0d(++_0x25d02f);}(_0xb4d9,0x159));var _0x9b4d=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xb4d9[_0x4565bf];return _0x5610ba;};'use strict';var _=require(_0x9b4d('0x0'));var moment=require(_0x9b4d('0x1'));var util=require(_0x9b4d('0x2'));var Redis=require(_0x9b4d('0x3'));var BPromise=require(_0x9b4d('0x4'));var config=require(_0x9b4d('0x5'));var logger=require(_0x9b4d('0x6'))(_0x9b4d('0x7'));var ami=require('../ami');config['redis']=_[_0x9b4d('0x8')](config[_0x9b4d('0x9')],{'host':_0x9b4d('0xa'),'port':0x18eb});var io=require(_0x9b4d('0xb'))(new Redis(config[_0x9b4d('0x9')]));function UserReport(_0x21d879){this[_0x9b4d('0xc')]=_0x21d879[_0x9b4d('0xc')];this['agents']=_0x21d879[_0x9b4d('0xd')];this['telephones']=_0x21d879[_0x9b4d('0xe')];ami['on']('registryentry',this[_0x9b4d('0xf')][_0x9b4d('0x10')](this));ami['on'](_0x9b4d('0x11'),this['syncRegistry'][_0x9b4d('0x10')](this));ami['on']('devicestatechange',this[_0x9b4d('0x12')][_0x9b4d('0x10')](this));ami['on'](_0x9b4d('0x13'),this[_0x9b4d('0x14')]['bind'](this));return this[_0x9b4d('0x15')]();}function showSipRegistrations(){Promise[_0x9b4d('0x16')]()[_0x9b4d('0x17')](ami[_0x9b4d('0x18')]())[_0x9b4d('0x19')](function(_0x49ad72){logger[_0x9b4d('0x1a')]('[userReport][sipshowregistry]',util['inspect'](_0x49ad72,{'showHidden':![],'depth':null}));});}function listDeviceStates(){Promise[_0x9b4d('0x16')]()[_0x9b4d('0x17')](ami[_0x9b4d('0x1b')]())[_0x9b4d('0x19')](function(_0x56f7b0){logger[_0x9b4d('0x1a')](_0x9b4d('0x1c'),util[_0x9b4d('0x1d')](_0x56f7b0,{'showHidden':![],'depth':null}));});}function showPeersStatus(){Promise[_0x9b4d('0x16')]()[_0x9b4d('0x17')](ami[_0x9b4d('0x1e')]())[_0x9b4d('0x19')](function(_0x30857a){logger[_0x9b4d('0x1a')]('[userReport][sippeerstatus]',util[_0x9b4d('0x1d')](_0x30857a,{'showHidden':![],'depth':null}));});}UserReport[_0x9b4d('0x1f')][_0x9b4d('0x15')]=function(){setInterval(function(){BPromise[_0x9b4d('0x16')]()[_0x9b4d('0x17')](showSipRegistrations())[_0x9b4d('0x17')](listDeviceStates())[_0x9b4d('0x17')](showPeersStatus());},0x32c8);};UserReport[_0x9b4d('0x1f')][_0x9b4d('0x20')]=function(_0x51eff7){return _0x51eff7!==null&&!_[_0x9b4d('0x21')](_0x51eff7);};UserReport['prototype'][_0x9b4d('0x22')]=function(_0x6380b8,_0x21811f,_0x799e7d){io['to'](_0x6380b8)[_0x9b4d('0x22')](_0x21811f,_0x799e7d);};UserReport['prototype'][_0x9b4d('0xf')]=function(_0x274ec6){try{if(this[_0x9b4d('0x20')](_0x274ec6)){logger[_0x9b4d('0x23')](_0x9b4d('0x24'),_0x274ec6['username'],_0x274ec6[_0x9b4d('0x25')]);logger[_0x9b4d('0x26')](_0x9b4d('0x27'),util[_0x9b4d('0x1d')](_0x274ec6,{'showHidden':![],'depth':null}));var _0x52c073=_[_0x9b4d('0x28')](this['trunks'],{'defaultuser':_0x274ec6[_0x9b4d('0x29')]});if(_0x52c073){_0x274ec6[_0x9b4d('0x2a')]=_0x274ec6[_0x9b4d('0x25')];_[_0x9b4d('0x2b')](_0x52c073,_[_0x9b4d('0x2c')](_0x274ec6,[_0x9b4d('0x2d'),_0x9b4d('0x2e'),_0x9b4d('0x29'),_0x9b4d('0x25')]));logger[_0x9b4d('0x26')](_0x9b4d('0x2f'),util['inspect'](_0x52c073,{'showHidden':![],'depth':null}));this[_0x9b4d('0x22')](util[_0x9b4d('0x30')]('trunk:%s',_0x52c073[_0x9b4d('0x31')]),_0x9b4d('0x32'),_0x52c073);}}}catch(_0x537b99){logger['error'](_0x9b4d('0x27'),util[_0x9b4d('0x1d')](_0x537b99,{'showHidden':![],'depth':null}));}};UserReport[_0x9b4d('0x1f')]['syncDeviceState']=function(_0x55dcba){try{if(this[_0x9b4d('0x20')](_0x55dcba)){logger[_0x9b4d('0x23')](_0x9b4d('0x33'),_0x55dcba[_0x9b4d('0x34')],_0x55dcba[_0x9b4d('0x25')]);logger[_0x9b4d('0x26')](_0x9b4d('0x35'),util[_0x9b4d('0x1d')](_0x55dcba,{'showHidden':![],'depth':null}));if(this[_0x9b4d('0xd')][_0x55dcba[_0x9b4d('0x34')]]){if(!this['agents'][_0x55dcba[_0x9b4d('0x34')]][_0x9b4d('0x36')]||_0x55dcba['state']['toLowerCase']()==_0x9b4d('0x37')){this[_0x9b4d('0xd')][_0x55dcba[_0x9b4d('0x34')]][_0x9b4d('0x36')]=![];if(this['agents'][_0x55dcba['device']][_0x9b4d('0x25')]!==_0x55dcba[_0x9b4d('0x25')][_0x9b4d('0x38')]()){this['agents'][_0x55dcba[_0x9b4d('0x34')]][_0x9b4d('0x39')]=_[_0x9b4d('0x3a')](moment()[_0x9b4d('0x30')]('x'));}this['agents'][_0x55dcba[_0x9b4d('0x34')]][_0x9b4d('0x25')]=_0x55dcba[_0x9b4d('0x25')][_0x9b4d('0x38')]();this[_0x9b4d('0xd')][_0x55dcba['device']]['updateStatusRealtime'](_0x55dcba);}}else if(this[_0x9b4d('0xe')][_0x55dcba[_0x9b4d('0x34')]]){if(this[_0x9b4d('0xe')][_0x55dcba['device']][_0x9b4d('0x25')]!==_0x55dcba['state']['toLowerCase']()){this[_0x9b4d('0xe')][_0x55dcba['device']][_0x9b4d('0x39')]=_['toNumber'](moment()[_0x9b4d('0x30')]('x'));}this[_0x9b4d('0xe')][_0x55dcba[_0x9b4d('0x34')]]['state']=_0x55dcba[_0x9b4d('0x25')][_0x9b4d('0x38')]();logger[_0x9b4d('0x26')](_0x9b4d('0x3b'),util['inspect'](this[_0x9b4d('0xe')][_0x55dcba[_0x9b4d('0x34')]],{'showHidden':![],'depth':null}));this[_0x9b4d('0x22')](util[_0x9b4d('0x30')](_0x9b4d('0x3c'),this[_0x9b4d('0xe')][_0x55dcba[_0x9b4d('0x34')]]['name']),_0x9b4d('0x3d'),this[_0x9b4d('0xe')][_0x55dcba[_0x9b4d('0x34')]]);}else if(this['trunks'][_0x55dcba[_0x9b4d('0x34')]]){if(this['trunks'][_0x55dcba[_0x9b4d('0x34')]]['state']!==_0x55dcba[_0x9b4d('0x25')][_0x9b4d('0x38')]()){this[_0x9b4d('0xc')][_0x55dcba[_0x9b4d('0x34')]]['stateTime']=_[_0x9b4d('0x3a')](moment()['format']('x'));}this[_0x9b4d('0xc')][_0x55dcba['device']][_0x9b4d('0x25')]=_0x55dcba[_0x9b4d('0x25')]['toLowerCase']();logger[_0x9b4d('0x26')](_0x9b4d('0x3e'),util[_0x9b4d('0x1d')](this[_0x9b4d('0xc')][_0x55dcba[_0x9b4d('0x34')]],{'showHidden':![],'depth':null}));this['emit'](util[_0x9b4d('0x30')]('trunk:%s',this[_0x9b4d('0xc')][_0x55dcba['device']][_0x9b4d('0x31')]),'trunk:save',this[_0x9b4d('0xc')][_0x55dcba[_0x9b4d('0x34')]]);}else if(_[_0x9b4d('0x3f')](_0x55dcba[_0x9b4d('0x34')],_0x9b4d('0x40'))){var _0x1ec046=_0x55dcba[_0x9b4d('0x34')];var _0x147fd7=_0x1ec046[_0x9b4d('0x41')](_0x1ec046[_0x9b4d('0x42')]('/')+0x1,_0x1ec046['indexOf']('@'));var _0x4c9e46=_[_0x9b4d('0x28')](this[_0x9b4d('0xd')],function(_0x859e9c){return _0x859e9c[_0x9b4d('0x43')]==_0x147fd7||_0x859e9c[_0x9b4d('0x44')]==_0x147fd7||_0x859e9c[_0x9b4d('0x45')]==_0x147fd7;});if(_0x4c9e46){if(_0x4c9e46[_0x9b4d('0x25')]!==_0x55dcba[_0x9b4d('0x25')][_0x9b4d('0x38')]()){_0x4c9e46[_0x9b4d('0x39')]=_[_0x9b4d('0x3a')](moment()['format']('x'));}_0x4c9e46[_0x9b4d('0x25')]=_0x55dcba[_0x9b4d('0x25')][_0x9b4d('0x38')]();_0x4c9e46[_0x9b4d('0x36')]=!![];_0x4c9e46[_0x9b4d('0x46')](_0x55dcba);}}}}catch(_0x41f83d){logger[_0x9b4d('0x1a')](_0x9b4d('0x35'),util[_0x9b4d('0x1d')](_0x41f83d,{'showHidden':![],'depth':null}));}};UserReport[_0x9b4d('0x1f')][_0x9b4d('0x14')]=function(_0x423c02){try{if(this['isNotNull'](_0x423c02)&&this[_0x9b4d('0x20')](_0x423c02['peerstatus'])){logger[_0x9b4d('0x23')](_0x9b4d('0x47'),_0x423c02[_0x9b4d('0x48')],_0x423c02[_0x9b4d('0x49')],_0x423c02[_0x9b4d('0x13')]);logger['debug'](_0x9b4d('0x4a'),util[_0x9b4d('0x1d')](_0x423c02,{'showHidden':![],'depth':null}));if(this[_0x9b4d('0xd')][_0x423c02[_0x9b4d('0x48')]]){if(!this['agents'][_0x423c02[_0x9b4d('0x48')]]['local']||_0x423c02[_0x9b4d('0x13')]['toLowerCase']()=='registered'){this[_0x9b4d('0xd')][_0x423c02[_0x9b4d('0x48')]][_0x9b4d('0x36')]=![];this[_0x9b4d('0xd')][_0x423c02[_0x9b4d('0x48')]]['status']=_0x423c02[_0x9b4d('0x13')][_0x9b4d('0x38')]();this[_0x9b4d('0xd')][_0x423c02[_0x9b4d('0x48')]][_0x9b4d('0x49')]=_0x423c02['address'];this[_0x9b4d('0xd')][_0x423c02['peer']][_0x9b4d('0x46')](_0x423c02);}}else if(this[_0x9b4d('0xe')][_0x423c02['peer']]){this[_0x9b4d('0xe')][_0x423c02['peer']][_0x9b4d('0x4b')]=_0x423c02[_0x9b4d('0x13')][_0x9b4d('0x38')]();this[_0x9b4d('0xe')][_0x423c02[_0x9b4d('0x48')]][_0x9b4d('0x49')]=_0x423c02['address'];logger[_0x9b4d('0x26')](_0x9b4d('0x4c'),util['inspect'](this['telephones'][_0x423c02['peer']],{'showHidden':![],'depth':null}));this['emit'](util['format'](_0x9b4d('0x3c'),this[_0x9b4d('0xe')][_0x423c02['peer']][_0x9b4d('0x31')]),_0x9b4d('0x3d'),this['telephones'][_0x423c02[_0x9b4d('0x48')]]);}else if(this[_0x9b4d('0xc')][_0x423c02['peer']]){this[_0x9b4d('0xc')][_0x423c02[_0x9b4d('0x48')]]['status']=_0x423c02[_0x9b4d('0x13')][_0x9b4d('0x38')]();this['trunks'][_0x423c02[_0x9b4d('0x48')]][_0x9b4d('0x49')]=_0x423c02[_0x9b4d('0x49')];logger[_0x9b4d('0x26')]('[userReport][peerstatus]\x20sending\x20trunk:save\x20event:',util[_0x9b4d('0x1d')](this['trunks'][_0x423c02['peer']],{'showHidden':![],'depth':null}));this[_0x9b4d('0x22')](util[_0x9b4d('0x30')](_0x9b4d('0x4d'),this['trunks'][_0x423c02[_0x9b4d('0x48')]][_0x9b4d('0x31')]),'trunk:save',this['trunks'][_0x423c02[_0x9b4d('0x48')]]);}}}catch(_0x511be4){logger[_0x9b4d('0x1a')](_0x9b4d('0x4a'),util[_0x9b4d('0x1d')](_0x511be4,{'showHidden':![],'depth':null}));}};module[_0x9b4d('0x4e')]=UserReport; \ No newline at end of file +var _0x6c65=['moment','util','ioredis','bluebird','../../../config/logger','ami','redis','defaults','localhost','socket.io-emitter','trunks','agents','telephones','bind','registry','devicestatechange','syncDeviceState','peerstatus','syncPeerStatus','syncRealtimeShow','resolve','then','actionSipShowRegistry','catch','error','[userReport][devicestatelist]','inspect','actionSipPeerStatus','prototype','isNotNull','isUndefined','emit','syncRegistry','info','debug','[userReport][registry]','find','stateRegistry','state','omit','event','actionid','[userReport][registry]\x20sending\x20trunk:save\x20event:','trunk:%s','name','[userReport][devicestatechange]\x20device:%s\x20state:%s','device','[userReport][devicestatechange]','local','toLowerCase','inuse','stateTime','toNumber','format','updateStatusRealtime','telephone:%s','telephone:save','trunk:save','startsWith','Local','substring','indexOf','phone','accountcode','peer','address','[userReport][peerstatus]','registered','status','[userReport][peerstatus]\x20sending\x20trunk:save\x20event:','exports','lodash'];(function(_0x14eea5,_0x4088b4){var _0x33cfb6=function(_0x2502da){while(--_0x2502da){_0x14eea5['push'](_0x14eea5['shift']());}};_0x33cfb6(++_0x4088b4);}(_0x6c65,0x8f));var _0x56c6=function(_0x54d4fe,_0x55e869){_0x54d4fe=_0x54d4fe-0x0;var _0x1ab5bb=_0x6c65[_0x54d4fe];return _0x1ab5bb;};'use strict';var _=require(_0x56c6('0x0'));var moment=require(_0x56c6('0x1'));var util=require(_0x56c6('0x2'));var Redis=require(_0x56c6('0x3'));var BPromise=require(_0x56c6('0x4'));var config=require('../../../config/environment');var logger=require(_0x56c6('0x5'))(_0x56c6('0x6'));var ami=require('../ami');config[_0x56c6('0x7')]=_[_0x56c6('0x8')](config[_0x56c6('0x7')],{'host':_0x56c6('0x9'),'port':0x18eb});var io=require(_0x56c6('0xa'))(new Redis(config[_0x56c6('0x7')]));function UserReport(_0x3f5974){this[_0x56c6('0xb')]=_0x3f5974[_0x56c6('0xb')];this[_0x56c6('0xc')]=_0x3f5974['agents'];this[_0x56c6('0xd')]=_0x3f5974['telephones'];ami['on']('registryentry',this['syncRegistry'][_0x56c6('0xe')](this));ami['on'](_0x56c6('0xf'),this['syncRegistry']['bind'](this));ami['on'](_0x56c6('0x10'),this[_0x56c6('0x11')]['bind'](this));ami['on'](_0x56c6('0x12'),this[_0x56c6('0x13')][_0x56c6('0xe')](this));return this[_0x56c6('0x14')]();}function showSipRegistrations(){Promise[_0x56c6('0x15')]()[_0x56c6('0x16')](ami[_0x56c6('0x17')]())[_0x56c6('0x18')](function(_0x57f9c0){logger[_0x56c6('0x19')]('[userReport][sipshowregistry]',util['inspect'](_0x57f9c0,{'showHidden':![],'depth':null}));});}function listDeviceStates(){Promise[_0x56c6('0x15')]()[_0x56c6('0x16')](ami['actionDeviceStateList']())[_0x56c6('0x18')](function(_0x75c358){logger['error'](_0x56c6('0x1a'),util[_0x56c6('0x1b')](_0x75c358,{'showHidden':![],'depth':null}));});}function showPeersStatus(){Promise[_0x56c6('0x15')]()[_0x56c6('0x16')](ami[_0x56c6('0x1c')]())[_0x56c6('0x18')](function(_0x426c18){logger[_0x56c6('0x19')]('[userReport][sippeerstatus]',util[_0x56c6('0x1b')](_0x426c18,{'showHidden':![],'depth':null}));});}UserReport[_0x56c6('0x1d')]['syncRealtimeShow']=function(){setInterval(function(){BPromise[_0x56c6('0x15')]()[_0x56c6('0x16')](showSipRegistrations())[_0x56c6('0x16')](listDeviceStates())[_0x56c6('0x16')](showPeersStatus());},0x32c8);};UserReport[_0x56c6('0x1d')][_0x56c6('0x1e')]=function(_0x1c3e7a){return _0x1c3e7a!==null&&!_[_0x56c6('0x1f')](_0x1c3e7a);};UserReport[_0x56c6('0x1d')][_0x56c6('0x20')]=function(_0x2a595a,_0x5e8818,_0x132b4a){io['to'](_0x2a595a)[_0x56c6('0x20')](_0x5e8818,_0x132b4a);};UserReport[_0x56c6('0x1d')][_0x56c6('0x21')]=function(_0x299e1c){try{if(this[_0x56c6('0x1e')](_0x299e1c)){logger[_0x56c6('0x22')]('[userReport][registry]\x20registry:%s\x20state:%s',_0x299e1c['username'],_0x299e1c['state']);logger[_0x56c6('0x23')](_0x56c6('0x24'),util[_0x56c6('0x1b')](_0x299e1c,{'showHidden':![],'depth':null}));var _0xd941cd=_[_0x56c6('0x25')](this['trunks'],{'defaultuser':_0x299e1c['username']});if(_0xd941cd){_0x299e1c[_0x56c6('0x26')]=_0x299e1c[_0x56c6('0x27')];_['merge'](_0xd941cd,_[_0x56c6('0x28')](_0x299e1c,[_0x56c6('0x29'),_0x56c6('0x2a'),'username',_0x56c6('0x27')]));logger[_0x56c6('0x23')](_0x56c6('0x2b'),util[_0x56c6('0x1b')](_0xd941cd,{'showHidden':![],'depth':null}));this[_0x56c6('0x20')](util['format'](_0x56c6('0x2c'),_0xd941cd[_0x56c6('0x2d')]),'trunk:save',_0xd941cd);}}}catch(_0x36f3d8){logger[_0x56c6('0x19')](_0x56c6('0x24'),util[_0x56c6('0x1b')](_0x36f3d8,{'showHidden':![],'depth':null}));}};UserReport[_0x56c6('0x1d')][_0x56c6('0x11')]=function(_0x19ad1e){try{if(this[_0x56c6('0x1e')](_0x19ad1e)){logger['info'](_0x56c6('0x2e'),_0x19ad1e[_0x56c6('0x2f')],_0x19ad1e['state']);logger['debug'](_0x56c6('0x30'),util[_0x56c6('0x1b')](_0x19ad1e,{'showHidden':![],'depth':null}));if(this[_0x56c6('0xc')][_0x19ad1e['device']]){if(!this[_0x56c6('0xc')][_0x19ad1e['device']][_0x56c6('0x31')]||_0x19ad1e[_0x56c6('0x27')][_0x56c6('0x32')]()==_0x56c6('0x33')){this[_0x56c6('0xc')][_0x19ad1e['device']][_0x56c6('0x31')]=![];if(this[_0x56c6('0xc')][_0x19ad1e[_0x56c6('0x2f')]][_0x56c6('0x27')]!==_0x19ad1e[_0x56c6('0x27')][_0x56c6('0x32')]()){this['agents'][_0x19ad1e[_0x56c6('0x2f')]][_0x56c6('0x34')]=_[_0x56c6('0x35')](moment()[_0x56c6('0x36')]('x'));}this[_0x56c6('0xc')][_0x19ad1e['device']][_0x56c6('0x27')]=_0x19ad1e[_0x56c6('0x27')][_0x56c6('0x32')]();this['agents'][_0x19ad1e[_0x56c6('0x2f')]][_0x56c6('0x37')](_0x19ad1e);}}else if(this[_0x56c6('0xd')][_0x19ad1e[_0x56c6('0x2f')]]){if(this[_0x56c6('0xd')][_0x19ad1e[_0x56c6('0x2f')]][_0x56c6('0x27')]!==_0x19ad1e[_0x56c6('0x27')][_0x56c6('0x32')]()){this[_0x56c6('0xd')][_0x19ad1e[_0x56c6('0x2f')]][_0x56c6('0x34')]=_[_0x56c6('0x35')](moment()[_0x56c6('0x36')]('x'));}this[_0x56c6('0xd')][_0x19ad1e[_0x56c6('0x2f')]][_0x56c6('0x27')]=_0x19ad1e['state'][_0x56c6('0x32')]();logger[_0x56c6('0x23')]('[userReport][devicestatechange]\x20sending\x20telephone:save\x20event:',util[_0x56c6('0x1b')](this[_0x56c6('0xd')][_0x19ad1e[_0x56c6('0x2f')]],{'showHidden':![],'depth':null}));this[_0x56c6('0x20')](util[_0x56c6('0x36')](_0x56c6('0x38'),this[_0x56c6('0xd')][_0x19ad1e[_0x56c6('0x2f')]][_0x56c6('0x2d')]),_0x56c6('0x39'),this[_0x56c6('0xd')][_0x19ad1e[_0x56c6('0x2f')]]);}else if(this['trunks'][_0x19ad1e[_0x56c6('0x2f')]]){if(this[_0x56c6('0xb')][_0x19ad1e['device']]['state']!==_0x19ad1e[_0x56c6('0x27')][_0x56c6('0x32')]()){this[_0x56c6('0xb')][_0x19ad1e[_0x56c6('0x2f')]][_0x56c6('0x34')]=_['toNumber'](moment()[_0x56c6('0x36')]('x'));}this['trunks'][_0x19ad1e[_0x56c6('0x2f')]][_0x56c6('0x27')]=_0x19ad1e[_0x56c6('0x27')][_0x56c6('0x32')]();logger['debug']('[userReport][devicestatechange]\x20sending\x20trunk:save\x20event:',util[_0x56c6('0x1b')](this[_0x56c6('0xb')][_0x19ad1e[_0x56c6('0x2f')]],{'showHidden':![],'depth':null}));this['emit'](util['format']('trunk:%s',this[_0x56c6('0xb')][_0x19ad1e[_0x56c6('0x2f')]][_0x56c6('0x2d')]),_0x56c6('0x3a'),this[_0x56c6('0xb')][_0x19ad1e[_0x56c6('0x2f')]]);}else if(_[_0x56c6('0x3b')](_0x19ad1e['device'],_0x56c6('0x3c'))){var _0x194677=_0x19ad1e[_0x56c6('0x2f')];var _0x49cd2c=_0x194677[_0x56c6('0x3d')](_0x194677[_0x56c6('0x3e')]('/')+0x1,_0x194677[_0x56c6('0x3e')]('@'));var _0x5ed826=_['find'](this['agents'],function(_0x953a76){return _0x953a76['mobile']==_0x49cd2c||_0x953a76[_0x56c6('0x3f')]==_0x49cd2c||_0x953a76[_0x56c6('0x40')]==_0x49cd2c;});if(_0x5ed826){if(_0x5ed826['state']!==_0x19ad1e[_0x56c6('0x27')][_0x56c6('0x32')]()){_0x5ed826[_0x56c6('0x34')]=_['toNumber'](moment()[_0x56c6('0x36')]('x'));}_0x5ed826[_0x56c6('0x27')]=_0x19ad1e[_0x56c6('0x27')][_0x56c6('0x32')]();_0x5ed826['local']=!![];_0x5ed826['updateStatusRealtime'](_0x19ad1e);}}}}catch(_0x1a3cd6){logger['error'](_0x56c6('0x30'),util[_0x56c6('0x1b')](_0x1a3cd6,{'showHidden':![],'depth':null}));}};UserReport[_0x56c6('0x1d')]['syncPeerStatus']=function(_0x36b25d){try{if(this[_0x56c6('0x1e')](_0x36b25d)&&this[_0x56c6('0x1e')](_0x36b25d['peerstatus'])){logger[_0x56c6('0x22')]('[userReport][peerstatus]\x20peer:%s\x20address:%s\x20status:%s',_0x36b25d[_0x56c6('0x41')],_0x36b25d[_0x56c6('0x42')],_0x36b25d[_0x56c6('0x12')]);logger[_0x56c6('0x23')](_0x56c6('0x43'),util[_0x56c6('0x1b')](_0x36b25d,{'showHidden':![],'depth':null}));if(this[_0x56c6('0xc')][_0x36b25d['peer']]){if(!this[_0x56c6('0xc')][_0x36b25d[_0x56c6('0x41')]]['local']||_0x36b25d[_0x56c6('0x12')][_0x56c6('0x32')]()==_0x56c6('0x44')){this[_0x56c6('0xc')][_0x36b25d[_0x56c6('0x41')]][_0x56c6('0x31')]=![];this[_0x56c6('0xc')][_0x36b25d[_0x56c6('0x41')]]['status']=_0x36b25d[_0x56c6('0x12')]['toLowerCase']();this[_0x56c6('0xc')][_0x36b25d[_0x56c6('0x41')]][_0x56c6('0x42')]=_0x36b25d[_0x56c6('0x42')];this[_0x56c6('0xc')][_0x36b25d[_0x56c6('0x41')]][_0x56c6('0x37')](_0x36b25d);}}else if(this[_0x56c6('0xd')][_0x36b25d['peer']]){this[_0x56c6('0xd')][_0x36b25d[_0x56c6('0x41')]][_0x56c6('0x45')]=_0x36b25d[_0x56c6('0x12')][_0x56c6('0x32')]();this['telephones'][_0x36b25d[_0x56c6('0x41')]][_0x56c6('0x42')]=_0x36b25d['address'];logger[_0x56c6('0x23')]('[userReport][peerstatus]\x20sending\x20telephone:save\x20event:',util[_0x56c6('0x1b')](this[_0x56c6('0xd')][_0x36b25d['peer']],{'showHidden':![],'depth':null}));this[_0x56c6('0x20')](util['format']('telephone:%s',this[_0x56c6('0xd')][_0x36b25d[_0x56c6('0x41')]]['name']),_0x56c6('0x39'),this['telephones'][_0x36b25d[_0x56c6('0x41')]]);}else if(this[_0x56c6('0xb')][_0x36b25d[_0x56c6('0x41')]]){this[_0x56c6('0xb')][_0x36b25d['peer']][_0x56c6('0x45')]=_0x36b25d['peerstatus']['toLowerCase']();this[_0x56c6('0xb')][_0x36b25d[_0x56c6('0x41')]][_0x56c6('0x42')]=_0x36b25d[_0x56c6('0x42')];logger['debug'](_0x56c6('0x46'),util[_0x56c6('0x1b')](this[_0x56c6('0xb')][_0x36b25d[_0x56c6('0x41')]],{'showHidden':![],'depth':null}));this[_0x56c6('0x20')](util[_0x56c6('0x36')]('trunk:%s',this[_0x56c6('0xb')][_0x36b25d[_0x56c6('0x41')]][_0x56c6('0x2d')]),_0x56c6('0x3a'),this[_0x56c6('0xb')][_0x36b25d[_0x56c6('0x41')]]);}}}catch(_0x5b88a0){logger[_0x56c6('0x19')]('[userReport][peerstatus]',util[_0x56c6('0x1b')](_0x5b88a0,{'showHidden':![],'depth':null}));}};module[_0x56c6('0x47')]=UserReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceAgentReport.js b/server/services/ami/report/voiceAgentReport.js index d7b5577..83be33a 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 _0x13f5=['rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepeer','bridgepvtcallid','membercalls','memberdynamic','memberinterface','memberlastcall','memberpenalty','memberrealtime','isNil','includes','[%s][voiceAgentReport][hangup]\x20destuniqueid:%s','values','[%s][voiceAgentReport][hangup]','[%s][voiceAgentReport][attendedtransfer]\x20event:','transfereeuniqueid','complete','diff','seconds','secondtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]','[%s][voiceAgentReport][blindtransfer]\x20event:','transfereruniqueid','[%s][voiceAgentReport][blindtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','[%s][voiceAgentReport][musiconholdstart]\x20event:','channel','lastIndexOf','[%s][voiceAgentReport][musiconholdstart]\x20interface:%s','[%s][voiceAgentReport][musiconholdstart]','[%s][voiceAgentReport][musiconholdstop]\x20event:','[%s][voiceAgentReport][musiconholdstop]\x20interface:%s','[%s][voiceAgentReport][musiconholdstop]','exports','lodash','moment','util','ioredis','../../../config/logger','redis','defaults','localhost','socket.io-emitter','channels','voiceChannels','voiceQueues','agents','variables','agentcalled','syncAgentCalled','bind','syncAgentConnect','syncAgentRingNoAnswer','queuecallerabandon','syncQueueCallerAbandon','agentcomplete','syncAgentComplete','varset','syncVarSet','hangup','syncHangup','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','prototype','emit','isNotNull','isUndefined','[%s][voiceAgentReport][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','uniqueid','membername','destuniqueid','debug','[%s][voiceAgentReport][agentcalled]\x20event:','format','YYYY-MM-DD\x20HH:mm:ss','called','queue','mandatoryDisposition','type','inbound','voice','merge','omit','event','privilege','inspect','custom:agentcalled','user:%s','[%s][voiceAgentReport][agentcalled]','[%s][voiceAgentReport][agentconnect]\x20event:','hasOwnProperty','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connectedlinename','connectedlinenum','destchannelstate','destchannelstatedesc','holdtime','lastevent','connect','routealias','interface','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentconnect\x20event:','custom:agentconnect','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:agentconnect\x20event:','agentringnoanswer','info','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:answered_elsewhere','agentringnoanswerAt','answered_elsewhere','reason','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentansweredelsewhere\x20event:','custom:agentansweredelsewhere','error','[%s][voiceAgentReport][agentconnect]','[%s][voiceAgentReport][agentringnoanswer]\x20event:','[%s][voiceAgentReport][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:rejected','rejected','[%s][voiceAgentReport][agentringnoanswer]\x20sending\x20agentringnoanswer\x20event:','custom:agentringnoanswer','[%s][voiceAgentReport][agentringnoanswer]','[%s][voiceAgentReport][queuecallerabandon]\x20event:','[%s][voiceAgentReport][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','[%s][voiceAgentReport][queuecallerabandon]\x20sending\x20agentqueuecallerabandon\x20event:','custom:agentqueuecallerabandon','[%s][voiceAgentReport][agentcomplete]\x20event:','[%s][voiceAgentReport][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','transfer','agent','talktime','acw','destconnectedlinenum','[%s][voiceAgentReport][agentcomplete]\x20sending\x20agentcomplete\x20event:','custom:agentcomplete','[%s][voiceAgentReport][agentcomplete]','addVariable','keys','value','variable','[%s][voiceAgentReport][varset]','rtpaudioqos','rtpaudioqosbridged'];(function(_0x320120,_0x51ae7e){var _0x228e37=function(_0x299921){while(--_0x299921){_0x320120['push'](_0x320120['shift']());}};_0x228e37(++_0x51ae7e);}(_0x13f5,0xc3));var _0x513f=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x13f5[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0x513f('0x0'));var moment=require(_0x513f('0x1'));var util=require(_0x513f('0x2'));var Redis=require(_0x513f('0x3'));var config=require('../../../config/environment');var logger=require(_0x513f('0x4'))('ami');var ami=require('../ami');config[_0x513f('0x5')]=_[_0x513f('0x6')](config[_0x513f('0x5')],{'host':_0x513f('0x7'),'port':0x18eb});var io=require(_0x513f('0x8'))(new Redis(config[_0x513f('0x5')]));function VoiceAgentReport(_0x2be368){this[_0x513f('0x9')]={};this[_0x513f('0xa')]=_0x2be368[_0x513f('0x9')];this[_0x513f('0xb')]=_0x2be368[_0x513f('0xb')];this['agents']=_0x2be368[_0x513f('0xc')];this[_0x513f('0xd')]={};ami['on'](_0x513f('0xe'),this[_0x513f('0xf')][_0x513f('0x10')](this));ami['on']('agentconnect',this[_0x513f('0x11')][_0x513f('0x10')](this));ami['on']('agentringnoanswer',this[_0x513f('0x12')][_0x513f('0x10')](this));ami['on'](_0x513f('0x13'),this[_0x513f('0x14')][_0x513f('0x10')](this));ami['on'](_0x513f('0x15'),this[_0x513f('0x16')][_0x513f('0x10')](this));ami['on'](_0x513f('0x17'),this[_0x513f('0x18')][_0x513f('0x10')](this));ami['on'](_0x513f('0x19'),this[_0x513f('0x1a')][_0x513f('0x10')](this));ami['on']('musiconholdstart',this[_0x513f('0x1b')]['bind'](this));ami['on'](_0x513f('0x1c'),this[_0x513f('0x1d')][_0x513f('0x10')](this));ami['on'](_0x513f('0x1e'),this[_0x513f('0x1f')]['bind'](this));ami['on'](_0x513f('0x20'),this[_0x513f('0x21')]['bind'](this));}VoiceAgentReport[_0x513f('0x22')]['emit']=function(_0x2c13d6,_0x1d4462,_0x511ae0){io['to'](_0x2c13d6)[_0x513f('0x23')](_0x1d4462,_0x511ae0);};VoiceAgentReport[_0x513f('0x22')][_0x513f('0x24')]=function(_0x2201c2){return _0x2201c2!==null&&!_[_0x513f('0x25')](_0x2201c2);};VoiceAgentReport[_0x513f('0x22')]['syncAgentCalled']=function(_0x350f07){try{if(this[_0x513f('0x24')](_0x350f07)){logger['info'](_0x513f('0x26'),_0x350f07[_0x513f('0x27')],_0x350f07[_0x513f('0x28')],_0x350f07[_0x513f('0x29')]);logger[_0x513f('0x2a')](_0x513f('0x2b'),_0x350f07['uniqueid'],util['inspect'](_0x350f07,{'showHidden':![],'depth':null}));if(_['isUndefined'](this[_0x513f('0x9')][_0x350f07[_0x513f('0x27')]])){this[_0x513f('0x9')][_0x350f07[_0x513f('0x27')]]={};}if(_[_0x513f('0x25')](this[_0x513f('0x9')][_0x350f07[_0x513f('0x27')]][_0x350f07[_0x513f('0x29')]])){this[_0x513f('0x9')][_0x350f07['uniqueid']][_0x350f07[_0x513f('0x29')]]={'agentcalledAt':moment()[_0x513f('0x2c')](_0x513f('0x2d')),'lastevent':_0x513f('0x2e'),'mandatoryDisposition':this['voiceQueues'][_0x350f07[_0x513f('0x2f')]]?this[_0x513f('0xb')][_0x350f07['queue']][_0x513f('0x30')]||![]:![],'type':this['voiceQueues'][_0x350f07['queue']]?this[_0x513f('0xb')][_0x350f07[_0x513f('0x2f')]][_0x513f('0x31')]||_0x513f('0x32'):'inbound','variables':this[_0x513f('0xd')][_0x350f07[_0x513f('0x27')]],'motionChannel':_0x513f('0x33')};}_[_0x513f('0x34')](this['channels'][_0x350f07[_0x513f('0x27')]][_0x350f07[_0x513f('0x29')]],_[_0x513f('0x35')](_0x350f07,[_0x513f('0x36'),_0x513f('0x37')]));logger[_0x513f('0x2a')]('[%s][voiceAgentReport][agentcalled]\x20sending\x20agentcalled\x20event:',_0x350f07['uniqueid'],util[_0x513f('0x38')](this[_0x513f('0x9')][_0x350f07['uniqueid']][_0x350f07['destuniqueid']],{'showHidden':![],'depth':null}));ami[_0x513f('0x23')](_0x513f('0x39'),this[_0x513f('0x9')][_0x350f07['uniqueid']][_0x350f07[_0x513f('0x29')]]);logger[_0x513f('0x2a')]('[%s][voiceAgentReport][agentcalled]\x20sending\x20user:called\x20event:',_0x350f07[_0x513f('0x27')],util[_0x513f('0x38')](this[_0x513f('0x9')][_0x350f07[_0x513f('0x27')]][_0x350f07[_0x513f('0x29')]],{'showHidden':![],'depth':null}));this[_0x513f('0x23')](util[_0x513f('0x2c')](_0x513f('0x3a'),_0x350f07[_0x513f('0x28')]),'user:called',this[_0x513f('0x9')][_0x350f07['uniqueid']][_0x350f07['destuniqueid']]);}}catch(_0x1c2285){logger['error'](_0x513f('0x3b'),_0x350f07[_0x513f('0x27')],util['inspect'](_0x1c2285,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x513f('0x22')]['syncAgentConnect']=function(_0x59e71e){try{if(this[_0x513f('0x24')](_0x59e71e)){if(this[_0x513f('0x9')][_0x59e71e[_0x513f('0x27')]]){logger[_0x513f('0x2a')](_0x513f('0x3c'),_0x59e71e['uniqueid'],util[_0x513f('0x38')](_0x59e71e,{'showHidden':![],'depth':null}));for(var _0x1612ca in this['channels'][_0x59e71e[_0x513f('0x27')]]){if(this[_0x513f('0x9')][_0x59e71e[_0x513f('0x27')]][_0x513f('0x3d')](_0x1612ca)){if(_0x59e71e[_0x513f('0x29')]===_0x1612ca){logger['info'](_0x513f('0x3e'),_0x59e71e[_0x513f('0x27')],_0x59e71e[_0x513f('0x28')],_0x59e71e[_0x513f('0x29')]);this['channels'][_0x59e71e['uniqueid']][_0x1612ca][_0x513f('0x3f')]=moment()[_0x513f('0x2c')](_0x513f('0x2d'));this[_0x513f('0x9')][_0x59e71e['uniqueid']][_0x1612ca]['connectedlinename']=_0x59e71e[_0x513f('0x40')];this[_0x513f('0x9')][_0x59e71e[_0x513f('0x27')]][_0x1612ca][_0x513f('0x41')]=_0x59e71e[_0x513f('0x41')];this['channels'][_0x59e71e[_0x513f('0x27')]][_0x1612ca][_0x513f('0x42')]=_0x59e71e[_0x513f('0x42')];this['channels'][_0x59e71e[_0x513f('0x27')]][_0x1612ca][_0x513f('0x43')]=_0x59e71e['destchannelstatedesc'];this[_0x513f('0x9')][_0x59e71e[_0x513f('0x27')]][_0x1612ca][_0x513f('0x44')]=_0x59e71e[_0x513f('0x44')];this[_0x513f('0x9')][_0x59e71e['uniqueid']][_0x1612ca][_0x513f('0x45')]=_0x513f('0x46');if(this[_0x513f('0xa')][this[_0x513f('0x9')][_0x59e71e['uniqueid']][_0x1612ca]['uniqueid']]){var _0x60ea27=this[_0x513f('0xa')][this[_0x513f('0x9')][_0x59e71e[_0x513f('0x27')]][_0x1612ca][_0x513f('0x27')]][_0x513f('0x47')];this[_0x513f('0x9')][_0x59e71e['uniqueid']][_0x1612ca][_0x513f('0x47')]=_0x60ea27;_0x59e71e[_0x513f('0x47')]=_0x60ea27;}_[_0x513f('0x34')](this['agents'][_0x59e71e[_0x513f('0x48')]],_['pick'](_0x59e71e,[_0x513f('0x2f'),'destconnectedlinenum',_0x513f('0x47')]));logger['debug'](_0x513f('0x49'),_0x59e71e[_0x513f('0x27')],util[_0x513f('0x38')](this['channels'][_0x59e71e[_0x513f('0x27')]][_0x59e71e['destuniqueid']],{'showHidden':![],'depth':null}));ami[_0x513f('0x23')](_0x513f('0x4a'),this['channels'][_0x59e71e[_0x513f('0x27')]][_0x59e71e[_0x513f('0x29')]]);logger['debug'](_0x513f('0x4b'),_0x59e71e[_0x513f('0x27')],util['inspect'](this[_0x513f('0x9')][_0x59e71e['uniqueid']][_0x59e71e[_0x513f('0x29')]],{'showHidden':![],'depth':null}));this['emit'](util[_0x513f('0x2c')]('user:%s',_0x59e71e[_0x513f('0x28')]),'user:agentconnect',this[_0x513f('0x9')][_0x59e71e['uniqueid']][_0x59e71e[_0x513f('0x29')]]);}else if(!this['channels'][_0x59e71e['uniqueid']][_0x1612ca][_0x513f('0x4c')]&&!this[_0x513f('0x9')][_0x59e71e['uniqueid']][_0x1612ca][_0x513f('0x15')]){logger[_0x513f('0x4d')](_0x513f('0x4e'),_0x59e71e['uniqueid'],this[_0x513f('0x9')][_0x59e71e[_0x513f('0x27')]][_0x1612ca][_0x513f('0x28')],_0x1612ca);this[_0x513f('0x9')][_0x59e71e['uniqueid']][_0x1612ca][_0x513f('0x4c')]=!![];this[_0x513f('0x9')][_0x59e71e['uniqueid']][_0x1612ca][_0x513f('0x4f')]=moment()[_0x513f('0x2c')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x513f('0x9')][_0x59e71e[_0x513f('0x27')]][_0x1612ca]['answeredelsewheredestinationuniqueid']=_0x59e71e['destuniqueid'];this['channels'][_0x59e71e[_0x513f('0x27')]][_0x1612ca]['answeredelsewheremembername']=_0x59e71e['membername'];this[_0x513f('0x9')][_0x59e71e[_0x513f('0x27')]][_0x1612ca][_0x513f('0x45')]=_0x513f('0x50');this[_0x513f('0x9')][_0x59e71e[_0x513f('0x27')]][_0x1612ca][_0x513f('0x51')]='answered_elsewhere';logger[_0x513f('0x2a')](_0x513f('0x52'),_0x59e71e[_0x513f('0x27')],util['inspect'](this['channels'][_0x59e71e[_0x513f('0x27')]][_0x1612ca],{'showHidden':![],'depth':null}));ami[_0x513f('0x23')](_0x513f('0x53'),this[_0x513f('0x9')][_0x59e71e[_0x513f('0x27')]][_0x1612ca]);}}}}}}catch(_0x4902f2){logger[_0x513f('0x54')](_0x513f('0x55'),_0x59e71e[_0x513f('0x27')],util[_0x513f('0x38')](_0x4902f2,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x513f('0x22')]['syncAgentRingNoAnswer']=function(_0x5a70a0){try{if(this[_0x513f('0x24')](_0x5a70a0)){logger[_0x513f('0x2a')](_0x513f('0x56'),_0x5a70a0[_0x513f('0x27')],util[_0x513f('0x38')](_0x5a70a0,{'showHidden':![],'depth':null}));if(this['channels'][_0x5a70a0[_0x513f('0x27')]]&&this[_0x513f('0x9')][_0x5a70a0['uniqueid']][_0x5a70a0[_0x513f('0x29')]]){logger[_0x513f('0x4d')](_0x513f('0x57'),_0x5a70a0[_0x513f('0x27')],_0x5a70a0[_0x513f('0x28')],_0x5a70a0['destuniqueid']);this['channels'][_0x5a70a0[_0x513f('0x27')]][_0x5a70a0[_0x513f('0x29')]][_0x513f('0x4c')]=!![];this[_0x513f('0x9')][_0x5a70a0[_0x513f('0x27')]][_0x5a70a0[_0x513f('0x29')]][_0x513f('0x4f')]=moment()[_0x513f('0x2c')](_0x513f('0x2d'));this[_0x513f('0x9')][_0x5a70a0[_0x513f('0x27')]][_0x5a70a0[_0x513f('0x29')]][_0x513f('0x45')]=_0x513f('0x58');this[_0x513f('0x9')][_0x5a70a0[_0x513f('0x27')]][_0x5a70a0[_0x513f('0x29')]][_0x513f('0x51')]='rejected';logger[_0x513f('0x2a')](_0x513f('0x59'),_0x5a70a0[_0x513f('0x27')],util[_0x513f('0x38')](this['channels'][_0x5a70a0[_0x513f('0x27')]][_0x5a70a0[_0x513f('0x29')]],{'showHidden':![],'depth':null}));ami['emit'](_0x513f('0x5a'),this[_0x513f('0x9')][_0x5a70a0['uniqueid']][_0x5a70a0['destuniqueid']]);}}}catch(_0x3c9154){logger['error'](_0x513f('0x5b'),_0x5a70a0['uniqueid'],util[_0x513f('0x38')](_0x3c9154,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x513f('0x22')][_0x513f('0x14')]=function(_0x11b2c5){try{if(this[_0x513f('0x24')](_0x11b2c5)){logger['debug'](_0x513f('0x5c'),_0x11b2c5['uniqueid'],util[_0x513f('0x38')](_0x11b2c5,{'showHidden':![],'depth':null}));if(this[_0x513f('0x9')][_0x11b2c5['uniqueid']]){for(var _0x349abf in this[_0x513f('0x9')][_0x11b2c5[_0x513f('0x27')]]){if(this[_0x513f('0x9')][_0x11b2c5['uniqueid']]['hasOwnProperty'](_0x349abf)&&!this[_0x513f('0x9')][_0x11b2c5['uniqueid']][_0x349abf]['agentringnoanswer']&&!this[_0x513f('0x9')][_0x11b2c5['uniqueid']][_0x349abf][_0x513f('0x15')]){logger[_0x513f('0x4d')](_0x513f('0x5d'),_0x11b2c5[_0x513f('0x27')],this[_0x513f('0x9')][_0x11b2c5[_0x513f('0x27')]][_0x349abf][_0x513f('0x28')],_0x349abf);this[_0x513f('0x9')][_0x11b2c5['uniqueid']][_0x349abf][_0x513f('0x4c')]=!![];this[_0x513f('0x9')][_0x11b2c5[_0x513f('0x27')]][_0x349abf][_0x513f('0x4f')]=moment()['format'](_0x513f('0x2d'));this[_0x513f('0x9')][_0x11b2c5[_0x513f('0x27')]][_0x349abf][_0x513f('0x45')]=_0x513f('0x5e');this[_0x513f('0x9')][_0x11b2c5[_0x513f('0x27')]][_0x349abf][_0x513f('0x51')]='abandoned';logger[_0x513f('0x2a')](_0x513f('0x5f'),_0x11b2c5[_0x513f('0x27')],util[_0x513f('0x38')](this['channels'][_0x11b2c5[_0x513f('0x27')]][_0x349abf],{'showHidden':![],'depth':null}));ami[_0x513f('0x23')](_0x513f('0x60'),this[_0x513f('0x9')][_0x11b2c5[_0x513f('0x27')]][_0x349abf]);}}}}}catch(_0x444f10){logger[_0x513f('0x54')]('[%s][voiceAgentReport][queuecallerabandon]',_0x11b2c5['uniqueid'],util[_0x513f('0x38')](_0x444f10,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x513f('0x16')]=function(_0x41e999){try{if(this[_0x513f('0x24')](_0x41e999)){logger[_0x513f('0x2a')](_0x513f('0x61'),_0x41e999[_0x513f('0x27')],util[_0x513f('0x38')](_0x41e999,{'showHidden':![],'depth':null}));if(this[_0x513f('0x9')][_0x41e999[_0x513f('0x27')]]){for(var _0x4b3ce0 in this[_0x513f('0x9')][_0x41e999[_0x513f('0x27')]]){if(this[_0x513f('0x9')][_0x41e999[_0x513f('0x27')]][_0x513f('0x3d')](_0x4b3ce0)){if(this[_0x513f('0x9')][_0x41e999[_0x513f('0x27')]][_0x4b3ce0]['agentconnectAt']&&!this[_0x513f('0x9')][_0x41e999[_0x513f('0x27')]][_0x4b3ce0][_0x513f('0x15')]){logger[_0x513f('0x4d')](_0x513f('0x62'),_0x41e999[_0x513f('0x27')],this[_0x513f('0x9')][_0x41e999['uniqueid']][_0x4b3ce0]['membername'],_0x4b3ce0);this[_0x513f('0x9')][_0x41e999[_0x513f('0x27')]][_0x4b3ce0][_0x513f('0x15')]=!![];this['channels'][_0x41e999['uniqueid']][_0x4b3ce0][_0x513f('0x63')]=moment()[_0x513f('0x2c')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x513f('0x9')][_0x41e999[_0x513f('0x27')]][_0x4b3ce0]['lastevent']='complete';this[_0x513f('0x9')][_0x41e999['uniqueid']][_0x4b3ce0][_0x513f('0x51')]=_0x41e999[_0x513f('0x51')]==_0x513f('0x64')?_0x513f('0x65'):_0x41e999[_0x513f('0x51')];this[_0x513f('0x9')][_0x41e999[_0x513f('0x27')]][_0x4b3ce0][_0x513f('0x66')]=_0x41e999[_0x513f('0x66')];if(this[_0x513f('0xb')][_0x41e999['queue']]&&this['voiceQueues'][_0x41e999[_0x513f('0x2f')]][_0x513f('0x67')]){this[_0x513f('0x9')][_0x41e999[_0x513f('0x27')]][_0x4b3ce0]['acwtime']=this[_0x513f('0xb')][_0x41e999['queue']]['acwTimeout'];this[_0x513f('0x9')][_0x41e999[_0x513f('0x27')]][_0x4b3ce0]['agentacw']=!![];}this[_0x513f('0xc')][_0x41e999[_0x513f('0x48')]]=_[_0x513f('0x35')](this[_0x513f('0xc')][_0x41e999[_0x513f('0x48')]],[_0x513f('0x2f'),_0x513f('0x68')]);logger[_0x513f('0x2a')](_0x513f('0x69'),_0x41e999[_0x513f('0x27')],util[_0x513f('0x38')](this['channels'][_0x41e999[_0x513f('0x27')]][_0x4b3ce0],{'showHidden':![],'depth':null}));ami[_0x513f('0x23')](_0x513f('0x6a'),this['channels'][_0x41e999['uniqueid']][_0x4b3ce0]);logger[_0x513f('0x2a')]('[%s][voiceAgentReport][agentcomplete]\x20sending\x20user:agentcomplete\x20event:',_0x41e999[_0x513f('0x27')],util['inspect'](this[_0x513f('0x9')][_0x41e999['uniqueid']][_0x4b3ce0],{'showHidden':![],'depth':null}));this['emit'](util[_0x513f('0x2c')]('user:%s',_0x41e999['membername']),'user:agentcomplete',this['channels'][_0x41e999[_0x513f('0x27')]][_0x4b3ce0]);}}}}}}catch(_0x1788cc){logger['error'](_0x513f('0x6b'),_0x41e999['uniqueid'],util['inspect'](_0x1788cc,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x513f('0x18')]=function(_0x4b7351){try{if(this[_0x513f('0x24')](_0x4b7351)){logger[_0x513f('0x2a')]('[%s][voiceAgentReport][varset]\x20event:',_0x4b7351[_0x513f('0x27')],util[_0x513f('0x38')](_0x4b7351,{'showHidden':![],'depth':null}));this[_0x513f('0x6c')](_0x4b7351[_0x513f('0x27')],_[_0x513f('0x6d')](_0x4b7351['variable'])[0x0],_0x4b7351[_0x513f('0x6e')]);if(this['channels'][_0x4b7351['uniqueid']]){for(var _0x1e8b8c in this[_0x513f('0x9')][_0x4b7351[_0x513f('0x27')]]){if(this[_0x513f('0x9')][_0x4b7351['uniqueid']][_0x513f('0x3d')](_0x1e8b8c)){logger[_0x513f('0x4d')]('[%s][voiceAgentReport][varset]\x20destuniqueid:%s\x20variable:%s\x20value:%s',_0x4b7351[_0x513f('0x27')],_0x1e8b8c,_[_0x513f('0x6d')](_0x4b7351[_0x513f('0x6f')])[0x0],_0x4b7351[_0x513f('0x6e')]);if(_['isUndefined'](this[_0x513f('0x9')][_0x4b7351['uniqueid']][_0x1e8b8c][_0x513f('0xd')])){this['channels'][_0x4b7351[_0x513f('0x27')]][_0x1e8b8c][_0x513f('0xd')]={};}this[_0x513f('0x9')][_0x4b7351[_0x513f('0x27')]][_0x1e8b8c][_0x513f('0xd')]=this[_0x513f('0xd')][_0x4b7351[_0x513f('0x27')]];}}}}}catch(_0x1cc12b){logger[_0x513f('0x54')](_0x513f('0x70'),_0x4b7351[_0x513f('0x27')],util[_0x513f('0x38')](_0x1cc12b,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x513f('0x6c')]=function(_0x110f19,_0x4efad6,_0x262620){var _0x3498d3=[_0x513f('0x71'),_0x513f('0x72'),_0x513f('0x73'),_0x513f('0x74'),_0x513f('0x75'),_0x513f('0x76'),_0x513f('0x77'),_0x513f('0x78'),_0x513f('0x79'),_0x513f('0x7a'),_0x513f('0x7b'),_0x513f('0x7c'),_0x513f('0x7d'),_0x513f('0x7e'),_0x513f('0x7f'),_0x513f('0x80'),_0x513f('0x28'),_0x513f('0x81'),_0x513f('0x82')];if(!_[_0x513f('0x83')](_0x4efad6)&&!_[_0x513f('0x84')](_0x3498d3,_0x4efad6)){if(_[_0x513f('0x25')](this[_0x513f('0xd')][_0x110f19])){this[_0x513f('0xd')][_0x110f19]={};}this[_0x513f('0xd')][_0x110f19][_0x4efad6]=_0x262620;}};VoiceAgentReport[_0x513f('0x22')][_0x513f('0x1a')]=function(_0x473f9b){try{if(this[_0x513f('0x24')](_0x473f9b)){logger[_0x513f('0x2a')]('[%s][voiceAgentReport][hangup]\x20event:',_0x473f9b[_0x513f('0x27')],util['inspect'](_0x473f9b,{'showHidden':![],'depth':null}));if(this[_0x513f('0x9')][_0x473f9b['uniqueid']]){for(var _0x5de09e in this[_0x513f('0x9')][_0x473f9b[_0x513f('0x27')]]){if(this['channels'][_0x473f9b[_0x513f('0x27')]][_0x513f('0x3d')](_0x5de09e)){if(this[_0x513f('0x9')][_0x473f9b[_0x513f('0x27')]][_0x5de09e][_0x513f('0x51')]==_0x513f('0x64')&&this[_0x513f('0x9')][_0x473f9b[_0x513f('0x27')]][_0x5de09e][_0x513f('0x15')]){logger[_0x513f('0x4d')](_0x513f('0x85'),_0x473f9b[_0x513f('0x27')],_0x5de09e);this[_0x513f('0x9')][_0x473f9b['uniqueid']][_0x5de09e]['agentcompleteAt']=moment()[_0x513f('0x2c')](_0x513f('0x2d'));}}}logger[_0x513f('0x2a')]('[%s][voiceAgentReport][hangup]\x20sending\x20voiceAgentReport\x20event:',_0x473f9b[_0x513f('0x27')],util['inspect'](_[_0x513f('0x86')](this[_0x513f('0x9')][_0x473f9b['uniqueid']]),{'showHidden':![],'depth':null}));ami[_0x513f('0x23')]('custom:voiceAgentReport',_[_0x513f('0x86')](this[_0x513f('0x9')][_0x473f9b['uniqueid']]));delete this[_0x513f('0x9')][_0x473f9b[_0x513f('0x27')]];}if(this[_0x513f('0xd')][_0x473f9b[_0x513f('0x27')]]){delete this[_0x513f('0xd')][_0x473f9b[_0x513f('0x27')]];}}}catch(_0x1b2a4e){logger['error'](_0x513f('0x87'),_0x473f9b['uniqueid'],util['inspect'](_0x1b2a4e,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x513f('0x1f')]=function(_0x4660d1){try{if(this[_0x513f('0x24')](_0x4660d1)){logger[_0x513f('0x2a')](_0x513f('0x88'),_0x4660d1[_0x513f('0x27')],util[_0x513f('0x38')](_0x4660d1,{'showHidden':![],'depth':null}));if(this['channels'][_0x4660d1[_0x513f('0x89')]]){for(var _0x2f46e7 in this[_0x513f('0x9')][_0x4660d1['transfereeuniqueid']]){if(this[_0x513f('0x9')][_0x4660d1['transfereeuniqueid']][_0x513f('0x3d')](_0x2f46e7)){if(_0x4660d1['origtransfereruniqueid']===_0x2f46e7){logger[_0x513f('0x4d')]('[%s][voiceAgentReport][attendedtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0x4660d1['uniqueid'],this['channels'][_0x4660d1[_0x513f('0x89')]][_0x2f46e7][_0x513f('0x28')],_0x2f46e7);var _0x56d7e0=moment();this[_0x513f('0x9')][_0x4660d1['transfereeuniqueid']][_0x2f46e7][_0x513f('0x15')]=!![];this[_0x513f('0x9')][_0x4660d1[_0x513f('0x89')]][_0x2f46e7][_0x513f('0x63')]=moment()[_0x513f('0x2c')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x513f('0x9')][_0x4660d1[_0x513f('0x89')]][_0x2f46e7][_0x513f('0x45')]=_0x513f('0x8a');this[_0x513f('0x9')][_0x4660d1[_0x513f('0x89')]][_0x2f46e7][_0x513f('0x51')]=_0x513f('0x64');this[_0x513f('0x9')][_0x4660d1[_0x513f('0x89')]][_0x2f46e7][_0x513f('0x66')]=_0x56d7e0[_0x513f('0x8b')](this[_0x513f('0x9')][_0x4660d1[_0x513f('0x89')]][_0x2f46e7][_0x513f('0x3f')],_0x513f('0x8c'));}}}}if(this[_0x513f('0x9')][_0x4660d1[_0x513f('0x8d')]]){var _0x5db05f=this['channels'][_0x4660d1[_0x513f('0x8d')]];this[_0x513f('0x9')][_0x4660d1[_0x513f('0x8d')]]=this[_0x513f('0x9')][_0x4660d1['transfereeuniqueid']];this[_0x513f('0x9')][_0x4660d1[_0x513f('0x89')]]=_0x5db05f;}}}catch(_0x2b925a){logger[_0x513f('0x54')](_0x513f('0x8e'),_0x4660d1[_0x513f('0x27')],util[_0x513f('0x38')](_0x2b925a,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x513f('0x21')]=function(_0x20e14b){try{if(this[_0x513f('0x24')](_0x20e14b)){logger[_0x513f('0x2a')](_0x513f('0x8f'),_0x20e14b[_0x513f('0x27')],util[_0x513f('0x38')](_0x20e14b,{'showHidden':![],'depth':null}));if(this[_0x513f('0x9')][_0x20e14b['transfereeuniqueid']]){for(var _0x152588 in this[_0x513f('0x9')][_0x20e14b[_0x513f('0x89')]]){if(this[_0x513f('0x9')][_0x20e14b['transfereeuniqueid']]['hasOwnProperty'](_0x152588)){if(_0x20e14b[_0x513f('0x90')]===_0x152588){logger['info'](_0x513f('0x91'),_0x20e14b[_0x513f('0x27')],this['channels'][_0x20e14b[_0x513f('0x89')]][_0x152588]['membername'],_0x152588);var _0x43a7e4=moment();this[_0x513f('0x9')][_0x20e14b['transfereeuniqueid']][_0x152588][_0x513f('0x15')]=!![];this[_0x513f('0x9')][_0x20e14b[_0x513f('0x89')]][_0x152588][_0x513f('0x63')]=_0x43a7e4;this[_0x513f('0x9')][_0x20e14b[_0x513f('0x89')]][_0x152588][_0x513f('0x45')]=_0x513f('0x8a');this[_0x513f('0x9')][_0x20e14b[_0x513f('0x89')]][_0x152588][_0x513f('0x51')]=_0x513f('0x64');this[_0x513f('0x9')][_0x20e14b[_0x513f('0x89')]][_0x152588][_0x513f('0x66')]=_0x43a7e4[_0x513f('0x8b')](this[_0x513f('0x9')][_0x20e14b[_0x513f('0x89')]][_0x152588][_0x513f('0x3f')],_0x513f('0x8c'));}}}}}}catch(_0x27fcaa){logger[_0x513f('0x54')]('[%s][voiceAgentReport][blindtransfer]',_0x20e14b[_0x513f('0x27')],util[_0x513f('0x38')](_0x27fcaa,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype']['syncMusicOnHoldStart']=function(_0x23cdb8){var _0x1047e0='';try{if(this[_0x513f('0x24')](_0x23cdb8)){logger['debug'](_0x513f('0x92'),_0x23cdb8[_0x513f('0x27')],util['inspect'](_0x23cdb8,{'showHidden':![],'depth':null}));if(_0x23cdb8[_0x513f('0x93')]){_0x1047e0=_0x23cdb8['channel']['substring'](0x0,_0x23cdb8['channel'][_0x513f('0x94')]('-'));if(this[_0x513f('0xc')][_0x1047e0]){logger['info'](_0x513f('0x95'),_0x23cdb8[_0x513f('0x27')],_0x1047e0);this[_0x513f('0xc')][_0x1047e0]['onhold']=!![];}}}}catch(_0x422c33){logger[_0x513f('0x54')](_0x513f('0x96'),_0x23cdb8[_0x513f('0x27')],util[_0x513f('0x38')](_0x422c33,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x513f('0x22')][_0x513f('0x1d')]=function(_0x37080d){var _0x32242f='';try{if(this['isNotNull'](_0x37080d)){logger['debug'](_0x513f('0x97'),_0x37080d['uniqueid'],util[_0x513f('0x38')](_0x37080d,{'showHidden':![],'depth':null}));if(_0x37080d[_0x513f('0x93')]){_0x32242f=_0x37080d[_0x513f('0x93')]['substring'](0x0,_0x37080d['channel'][_0x513f('0x94')]('-'));if(this[_0x513f('0xc')][_0x32242f]){logger[_0x513f('0x4d')](_0x513f('0x98'),_0x37080d['uniqueid'],_0x32242f);this[_0x513f('0xc')][_0x32242f]['onhold']=![];}}}}catch(_0x3b6820){logger['error'](_0x513f('0x99'),_0x37080d[_0x513f('0x27')],util[_0x513f('0x38')](_0x3b6820,{'showHidden':![],'depth':null}));}};module[_0x513f('0x9a')]=VoiceAgentReport; \ No newline at end of file +var _0xb2cb=['variables','agentcalled','syncAgentCalled','bind','agentconnect','syncAgentConnect','syncAgentRingNoAnswer','queuecallerabandon','syncQueueCallerAbandon','agentcomplete','varset','syncVarSet','musiconholdstart','musiconholdstop','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','emit','prototype','isNotNull','info','[%s][voiceAgentReport][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','uniqueid','membername','destuniqueid','debug','inspect','isUndefined','format','called','queue','mandatoryDisposition','inbound','merge','omit','event','privilege','[%s][voiceAgentReport][agentcalled]\x20sending\x20agentcalled\x20event:','custom:agentcalled','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:called\x20event:','user:%s','user:called','error','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connectedlinename','connectedlinenum','destchannelstate','destchannelstatedesc','holdtime','lastevent','voiceChannels','routealias','interface','pick','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentconnect\x20event:','custom:agentconnect','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:agentconnect\x20event:','user:agentconnect','agentringnoanswer','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:answered_elsewhere','YYYY-MM-DD\x20HH:mm:ss','answeredelsewheredestinationuniqueid','answeredelsewheremembername','answered_elsewhere','reason','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentansweredelsewhere\x20event:','[%s][voiceAgentReport][agentconnect]','[%s][voiceAgentReport][agentringnoanswer]\x20event:','[%s][voiceAgentReport][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:rejected','rejected','[%s][voiceAgentReport][agentringnoanswer]','[%s][voiceAgentReport][queuecallerabandon]\x20event:','hasOwnProperty','agentringnoanswerAt','abandoned','custom:agentqueuecallerabandon','syncAgentComplete','[%s][voiceAgentReport][agentcomplete]\x20event:','[%s][voiceAgentReport][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','complete','agent','talktime','acwTimeout','destconnectedlinenum','[%s][voiceAgentReport][agentcomplete]\x20sending\x20agentcomplete\x20event:','custom:agentcomplete','[%s][voiceAgentReport][agentcomplete]\x20sending\x20user:agentcomplete\x20event:','user:agentcomplete','[%s][voiceAgentReport][agentcomplete]','[%s][voiceAgentReport][varset]\x20event:','keys','value','[%s][voiceAgentReport][varset]\x20destuniqueid:%s\x20variable:%s\x20value:%s','variable','addVariable','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqoslossbridged','rtpaudioqosrtt','sipcallid','bridgepeer','membercalls','memberinterface','memberlastcall','memberrealtime','isNil','syncHangup','[%s][voiceAgentReport][hangup]\x20event:','transfer','[%s][voiceAgentReport][hangup]\x20destuniqueid:%s','[%s][voiceAgentReport][hangup]\x20sending\x20voiceAgentReport\x20event:','values','custom:voiceAgentReport','[%s][voiceAgentReport][hangup]','transfereeuniqueid','origtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','diff','seconds','secondtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]','[%s][voiceAgentReport][blindtransfer]\x20event:','transfereruniqueid','[%s][voiceAgentReport][blindtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','syncMusicOnHoldStart','channel','substring','onhold','[%s][voiceAgentReport][musiconholdstart]','[%s][voiceAgentReport][musiconholdstop]\x20event:','lastIndexOf','[%s][voiceAgentReport][musiconholdstop]\x20interface:%s','[%s][voiceAgentReport][musiconholdstop]','lodash','moment','util','ioredis','../../../config/logger','ami','../ami','defaults','redis','localhost','socket.io-emitter','channels','voiceQueues','agents'];(function(_0x3e7260,_0x1fcd09){var _0x566ab8=function(_0x5aa90d){while(--_0x5aa90d){_0x3e7260['push'](_0x3e7260['shift']());}};_0x566ab8(++_0x1fcd09);}(_0xb2cb,0x8a));var _0xbb2c=function(_0xd8aad0,_0x4da2cd){_0xd8aad0=_0xd8aad0-0x0;var _0x570860=_0xb2cb[_0xd8aad0];return _0x570860;};'use strict';var _=require(_0xbb2c('0x0'));var moment=require(_0xbb2c('0x1'));var util=require(_0xbb2c('0x2'));var Redis=require(_0xbb2c('0x3'));var config=require('../../../config/environment');var logger=require(_0xbb2c('0x4'))(_0xbb2c('0x5'));var ami=require(_0xbb2c('0x6'));config['redis']=_[_0xbb2c('0x7')](config[_0xbb2c('0x8')],{'host':_0xbb2c('0x9'),'port':0x18eb});var io=require(_0xbb2c('0xa'))(new Redis(config['redis']));function VoiceAgentReport(_0xf1f24){this[_0xbb2c('0xb')]={};this['voiceChannels']=_0xf1f24['channels'];this[_0xbb2c('0xc')]=_0xf1f24[_0xbb2c('0xc')];this[_0xbb2c('0xd')]=_0xf1f24[_0xbb2c('0xd')];this[_0xbb2c('0xe')]={};ami['on'](_0xbb2c('0xf'),this[_0xbb2c('0x10')][_0xbb2c('0x11')](this));ami['on'](_0xbb2c('0x12'),this[_0xbb2c('0x13')][_0xbb2c('0x11')](this));ami['on']('agentringnoanswer',this[_0xbb2c('0x14')][_0xbb2c('0x11')](this));ami['on'](_0xbb2c('0x15'),this[_0xbb2c('0x16')][_0xbb2c('0x11')](this));ami['on'](_0xbb2c('0x17'),this['syncAgentComplete'][_0xbb2c('0x11')](this));ami['on'](_0xbb2c('0x18'),this[_0xbb2c('0x19')][_0xbb2c('0x11')](this));ami['on']('hangup',this['syncHangup']['bind'](this));ami['on'](_0xbb2c('0x1a'),this['syncMusicOnHoldStart']['bind'](this));ami['on'](_0xbb2c('0x1b'),this['syncMusicOnHoldStop'][_0xbb2c('0x11')](this));ami['on'](_0xbb2c('0x1c'),this[_0xbb2c('0x1d')][_0xbb2c('0x11')](this));ami['on'](_0xbb2c('0x1e'),this[_0xbb2c('0x1f')]['bind'](this));}VoiceAgentReport['prototype']['emit']=function(_0xb9a13c,_0x555e25,_0x12609c){io['to'](_0xb9a13c)[_0xbb2c('0x20')](_0x555e25,_0x12609c);};VoiceAgentReport[_0xbb2c('0x21')][_0xbb2c('0x22')]=function(_0x53a8d6){return _0x53a8d6!==null&&!_['isUndefined'](_0x53a8d6);};VoiceAgentReport['prototype']['syncAgentCalled']=function(_0x24135a){try{if(this[_0xbb2c('0x22')](_0x24135a)){logger[_0xbb2c('0x23')](_0xbb2c('0x24'),_0x24135a[_0xbb2c('0x25')],_0x24135a[_0xbb2c('0x26')],_0x24135a[_0xbb2c('0x27')]);logger[_0xbb2c('0x28')]('[%s][voiceAgentReport][agentcalled]\x20event:',_0x24135a[_0xbb2c('0x25')],util[_0xbb2c('0x29')](_0x24135a,{'showHidden':![],'depth':null}));if(_[_0xbb2c('0x2a')](this['channels'][_0x24135a[_0xbb2c('0x25')]])){this[_0xbb2c('0xb')][_0x24135a[_0xbb2c('0x25')]]={};}if(_[_0xbb2c('0x2a')](this[_0xbb2c('0xb')][_0x24135a['uniqueid']][_0x24135a[_0xbb2c('0x27')]])){this[_0xbb2c('0xb')][_0x24135a[_0xbb2c('0x25')]][_0x24135a[_0xbb2c('0x27')]]={'agentcalledAt':moment()[_0xbb2c('0x2b')]('YYYY-MM-DD\x20HH:mm:ss'),'lastevent':_0xbb2c('0x2c'),'mandatoryDisposition':this[_0xbb2c('0xc')][_0x24135a[_0xbb2c('0x2d')]]?this[_0xbb2c('0xc')][_0x24135a[_0xbb2c('0x2d')]][_0xbb2c('0x2e')]||![]:![],'type':this[_0xbb2c('0xc')][_0x24135a[_0xbb2c('0x2d')]]?this[_0xbb2c('0xc')][_0x24135a[_0xbb2c('0x2d')]]['type']||_0xbb2c('0x2f'):_0xbb2c('0x2f'),'variables':this[_0xbb2c('0xe')][_0x24135a['uniqueid']],'motionChannel':'voice'};}_[_0xbb2c('0x30')](this[_0xbb2c('0xb')][_0x24135a[_0xbb2c('0x25')]][_0x24135a['destuniqueid']],_[_0xbb2c('0x31')](_0x24135a,[_0xbb2c('0x32'),_0xbb2c('0x33')]));logger[_0xbb2c('0x28')](_0xbb2c('0x34'),_0x24135a[_0xbb2c('0x25')],util['inspect'](this['channels'][_0x24135a[_0xbb2c('0x25')]][_0x24135a['destuniqueid']],{'showHidden':![],'depth':null}));ami[_0xbb2c('0x20')](_0xbb2c('0x35'),this[_0xbb2c('0xb')][_0x24135a['uniqueid']][_0x24135a[_0xbb2c('0x27')]]);logger[_0xbb2c('0x28')](_0xbb2c('0x36'),_0x24135a[_0xbb2c('0x25')],util[_0xbb2c('0x29')](this[_0xbb2c('0xb')][_0x24135a[_0xbb2c('0x25')]][_0x24135a['destuniqueid']],{'showHidden':![],'depth':null}));this[_0xbb2c('0x20')](util[_0xbb2c('0x2b')](_0xbb2c('0x37'),_0x24135a[_0xbb2c('0x26')]),_0xbb2c('0x38'),this[_0xbb2c('0xb')][_0x24135a['uniqueid']][_0x24135a[_0xbb2c('0x27')]]);}}catch(_0x17b350){logger[_0xbb2c('0x39')]('[%s][voiceAgentReport][agentcalled]',_0x24135a[_0xbb2c('0x25')],util[_0xbb2c('0x29')](_0x17b350,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xbb2c('0x21')][_0xbb2c('0x13')]=function(_0x45818e){try{if(this['isNotNull'](_0x45818e)){if(this[_0xbb2c('0xb')][_0x45818e[_0xbb2c('0x25')]]){logger[_0xbb2c('0x28')]('[%s][voiceAgentReport][agentconnect]\x20event:',_0x45818e[_0xbb2c('0x25')],util['inspect'](_0x45818e,{'showHidden':![],'depth':null}));for(var _0x1afa20 in this[_0xbb2c('0xb')][_0x45818e[_0xbb2c('0x25')]]){if(this['channels'][_0x45818e[_0xbb2c('0x25')]]['hasOwnProperty'](_0x1afa20)){if(_0x45818e[_0xbb2c('0x27')]===_0x1afa20){logger['info'](_0xbb2c('0x3a'),_0x45818e['uniqueid'],_0x45818e[_0xbb2c('0x26')],_0x45818e[_0xbb2c('0x27')]);this[_0xbb2c('0xb')][_0x45818e[_0xbb2c('0x25')]][_0x1afa20][_0xbb2c('0x3b')]=moment()[_0xbb2c('0x2b')]('YYYY-MM-DD\x20HH:mm:ss');this[_0xbb2c('0xb')][_0x45818e[_0xbb2c('0x25')]][_0x1afa20][_0xbb2c('0x3c')]=_0x45818e['connectedlinename'];this[_0xbb2c('0xb')][_0x45818e[_0xbb2c('0x25')]][_0x1afa20][_0xbb2c('0x3d')]=_0x45818e[_0xbb2c('0x3d')];this[_0xbb2c('0xb')][_0x45818e[_0xbb2c('0x25')]][_0x1afa20][_0xbb2c('0x3e')]=_0x45818e[_0xbb2c('0x3e')];this[_0xbb2c('0xb')][_0x45818e[_0xbb2c('0x25')]][_0x1afa20][_0xbb2c('0x3f')]=_0x45818e[_0xbb2c('0x3f')];this[_0xbb2c('0xb')][_0x45818e[_0xbb2c('0x25')]][_0x1afa20]['holdtime']=_0x45818e[_0xbb2c('0x40')];this[_0xbb2c('0xb')][_0x45818e[_0xbb2c('0x25')]][_0x1afa20][_0xbb2c('0x41')]='connect';if(this['voiceChannels'][this[_0xbb2c('0xb')][_0x45818e[_0xbb2c('0x25')]][_0x1afa20]['uniqueid']]){var _0x10e38c=this[_0xbb2c('0x42')][this[_0xbb2c('0xb')][_0x45818e[_0xbb2c('0x25')]][_0x1afa20][_0xbb2c('0x25')]][_0xbb2c('0x43')];this[_0xbb2c('0xb')][_0x45818e[_0xbb2c('0x25')]][_0x1afa20][_0xbb2c('0x43')]=_0x10e38c;_0x45818e[_0xbb2c('0x43')]=_0x10e38c;}_['merge'](this[_0xbb2c('0xd')][_0x45818e[_0xbb2c('0x44')]],_[_0xbb2c('0x45')](_0x45818e,['queue','destconnectedlinenum','routealias']));logger['debug'](_0xbb2c('0x46'),_0x45818e[_0xbb2c('0x25')],util[_0xbb2c('0x29')](this[_0xbb2c('0xb')][_0x45818e[_0xbb2c('0x25')]][_0x45818e[_0xbb2c('0x27')]],{'showHidden':![],'depth':null}));ami[_0xbb2c('0x20')](_0xbb2c('0x47'),this[_0xbb2c('0xb')][_0x45818e[_0xbb2c('0x25')]][_0x45818e[_0xbb2c('0x27')]]);logger[_0xbb2c('0x28')](_0xbb2c('0x48'),_0x45818e[_0xbb2c('0x25')],util[_0xbb2c('0x29')](this[_0xbb2c('0xb')][_0x45818e[_0xbb2c('0x25')]][_0x45818e[_0xbb2c('0x27')]],{'showHidden':![],'depth':null}));this[_0xbb2c('0x20')](util[_0xbb2c('0x2b')]('user:%s',_0x45818e[_0xbb2c('0x26')]),_0xbb2c('0x49'),this[_0xbb2c('0xb')][_0x45818e[_0xbb2c('0x25')]][_0x45818e[_0xbb2c('0x27')]]);}else if(!this['channels'][_0x45818e[_0xbb2c('0x25')]][_0x1afa20][_0xbb2c('0x4a')]&&!this['channels'][_0x45818e[_0xbb2c('0x25')]][_0x1afa20]['agentcomplete']){logger[_0xbb2c('0x23')](_0xbb2c('0x4b'),_0x45818e['uniqueid'],this['channels'][_0x45818e[_0xbb2c('0x25')]][_0x1afa20][_0xbb2c('0x26')],_0x1afa20);this['channels'][_0x45818e[_0xbb2c('0x25')]][_0x1afa20][_0xbb2c('0x4a')]=!![];this[_0xbb2c('0xb')][_0x45818e[_0xbb2c('0x25')]][_0x1afa20]['agentringnoanswerAt']=moment()[_0xbb2c('0x2b')](_0xbb2c('0x4c'));this[_0xbb2c('0xb')][_0x45818e['uniqueid']][_0x1afa20][_0xbb2c('0x4d')]=_0x45818e[_0xbb2c('0x27')];this[_0xbb2c('0xb')][_0x45818e[_0xbb2c('0x25')]][_0x1afa20][_0xbb2c('0x4e')]=_0x45818e[_0xbb2c('0x26')];this[_0xbb2c('0xb')][_0x45818e[_0xbb2c('0x25')]][_0x1afa20][_0xbb2c('0x41')]=_0xbb2c('0x4f');this[_0xbb2c('0xb')][_0x45818e['uniqueid']][_0x1afa20][_0xbb2c('0x50')]='answered_elsewhere';logger['debug'](_0xbb2c('0x51'),_0x45818e[_0xbb2c('0x25')],util[_0xbb2c('0x29')](this['channels'][_0x45818e[_0xbb2c('0x25')]][_0x1afa20],{'showHidden':![],'depth':null}));ami[_0xbb2c('0x20')]('custom:agentansweredelsewhere',this['channels'][_0x45818e[_0xbb2c('0x25')]][_0x1afa20]);}}}}}}catch(_0x39ebd0){logger['error'](_0xbb2c('0x52'),_0x45818e[_0xbb2c('0x25')],util[_0xbb2c('0x29')](_0x39ebd0,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xbb2c('0x21')][_0xbb2c('0x14')]=function(_0x5e2d83){try{if(this[_0xbb2c('0x22')](_0x5e2d83)){logger[_0xbb2c('0x28')](_0xbb2c('0x53'),_0x5e2d83[_0xbb2c('0x25')],util['inspect'](_0x5e2d83,{'showHidden':![],'depth':null}));if(this[_0xbb2c('0xb')][_0x5e2d83['uniqueid']]&&this[_0xbb2c('0xb')][_0x5e2d83[_0xbb2c('0x25')]][_0x5e2d83[_0xbb2c('0x27')]]){logger[_0xbb2c('0x23')](_0xbb2c('0x54'),_0x5e2d83[_0xbb2c('0x25')],_0x5e2d83['membername'],_0x5e2d83['destuniqueid']);this[_0xbb2c('0xb')][_0x5e2d83[_0xbb2c('0x25')]][_0x5e2d83[_0xbb2c('0x27')]][_0xbb2c('0x4a')]=!![];this['channels'][_0x5e2d83[_0xbb2c('0x25')]][_0x5e2d83[_0xbb2c('0x27')]]['agentringnoanswerAt']=moment()[_0xbb2c('0x2b')]('YYYY-MM-DD\x20HH:mm:ss');this[_0xbb2c('0xb')][_0x5e2d83[_0xbb2c('0x25')]][_0x5e2d83[_0xbb2c('0x27')]][_0xbb2c('0x41')]=_0xbb2c('0x55');this['channels'][_0x5e2d83[_0xbb2c('0x25')]][_0x5e2d83['destuniqueid']][_0xbb2c('0x50')]=_0xbb2c('0x55');logger[_0xbb2c('0x28')]('[%s][voiceAgentReport][agentringnoanswer]\x20sending\x20agentringnoanswer\x20event:',_0x5e2d83[_0xbb2c('0x25')],util[_0xbb2c('0x29')](this['channels'][_0x5e2d83['uniqueid']][_0x5e2d83[_0xbb2c('0x27')]],{'showHidden':![],'depth':null}));ami[_0xbb2c('0x20')]('custom:agentringnoanswer',this[_0xbb2c('0xb')][_0x5e2d83[_0xbb2c('0x25')]][_0x5e2d83['destuniqueid']]);}}}catch(_0x153193){logger['error'](_0xbb2c('0x56'),_0x5e2d83[_0xbb2c('0x25')],util[_0xbb2c('0x29')](_0x153193,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xbb2c('0x21')]['syncQueueCallerAbandon']=function(_0x2a4ef4){try{if(this[_0xbb2c('0x22')](_0x2a4ef4)){logger[_0xbb2c('0x28')](_0xbb2c('0x57'),_0x2a4ef4[_0xbb2c('0x25')],util[_0xbb2c('0x29')](_0x2a4ef4,{'showHidden':![],'depth':null}));if(this[_0xbb2c('0xb')][_0x2a4ef4[_0xbb2c('0x25')]]){for(var _0x221e45 in this['channels'][_0x2a4ef4[_0xbb2c('0x25')]]){if(this['channels'][_0x2a4ef4['uniqueid']][_0xbb2c('0x58')](_0x221e45)&&!this[_0xbb2c('0xb')][_0x2a4ef4[_0xbb2c('0x25')]][_0x221e45][_0xbb2c('0x4a')]&&!this[_0xbb2c('0xb')][_0x2a4ef4[_0xbb2c('0x25')]][_0x221e45][_0xbb2c('0x17')]){logger['info']('[%s][voiceAgentReport][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned',_0x2a4ef4['uniqueid'],this['channels'][_0x2a4ef4[_0xbb2c('0x25')]][_0x221e45][_0xbb2c('0x26')],_0x221e45);this[_0xbb2c('0xb')][_0x2a4ef4['uniqueid']][_0x221e45][_0xbb2c('0x4a')]=!![];this['channels'][_0x2a4ef4['uniqueid']][_0x221e45][_0xbb2c('0x59')]=moment()[_0xbb2c('0x2b')](_0xbb2c('0x4c'));this[_0xbb2c('0xb')][_0x2a4ef4['uniqueid']][_0x221e45][_0xbb2c('0x41')]=_0xbb2c('0x5a');this['channels'][_0x2a4ef4[_0xbb2c('0x25')]][_0x221e45]['reason']=_0xbb2c('0x5a');logger[_0xbb2c('0x28')]('[%s][voiceAgentReport][queuecallerabandon]\x20sending\x20agentqueuecallerabandon\x20event:',_0x2a4ef4['uniqueid'],util[_0xbb2c('0x29')](this[_0xbb2c('0xb')][_0x2a4ef4[_0xbb2c('0x25')]][_0x221e45],{'showHidden':![],'depth':null}));ami[_0xbb2c('0x20')](_0xbb2c('0x5b'),this[_0xbb2c('0xb')][_0x2a4ef4[_0xbb2c('0x25')]][_0x221e45]);}}}}}catch(_0x49d292){logger['error']('[%s][voiceAgentReport][queuecallerabandon]',_0x2a4ef4['uniqueid'],util[_0xbb2c('0x29')](_0x49d292,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xbb2c('0x21')][_0xbb2c('0x5c')]=function(_0x498df4){try{if(this['isNotNull'](_0x498df4)){logger[_0xbb2c('0x28')](_0xbb2c('0x5d'),_0x498df4[_0xbb2c('0x25')],util['inspect'](_0x498df4,{'showHidden':![],'depth':null}));if(this[_0xbb2c('0xb')][_0x498df4[_0xbb2c('0x25')]]){for(var _0x2a0ea6 in this[_0xbb2c('0xb')][_0x498df4['uniqueid']]){if(this[_0xbb2c('0xb')][_0x498df4['uniqueid']][_0xbb2c('0x58')](_0x2a0ea6)){if(this[_0xbb2c('0xb')][_0x498df4['uniqueid']][_0x2a0ea6][_0xbb2c('0x3b')]&&!this[_0xbb2c('0xb')][_0x498df4[_0xbb2c('0x25')]][_0x2a0ea6][_0xbb2c('0x17')]){logger[_0xbb2c('0x23')](_0xbb2c('0x5e'),_0x498df4[_0xbb2c('0x25')],this[_0xbb2c('0xb')][_0x498df4[_0xbb2c('0x25')]][_0x2a0ea6][_0xbb2c('0x26')],_0x2a0ea6);this[_0xbb2c('0xb')][_0x498df4['uniqueid']][_0x2a0ea6][_0xbb2c('0x17')]=!![];this[_0xbb2c('0xb')][_0x498df4[_0xbb2c('0x25')]][_0x2a0ea6][_0xbb2c('0x5f')]=moment()[_0xbb2c('0x2b')](_0xbb2c('0x4c'));this['channels'][_0x498df4[_0xbb2c('0x25')]][_0x2a0ea6][_0xbb2c('0x41')]=_0xbb2c('0x60');this['channels'][_0x498df4[_0xbb2c('0x25')]][_0x2a0ea6][_0xbb2c('0x50')]=_0x498df4[_0xbb2c('0x50')]=='transfer'?_0xbb2c('0x61'):_0x498df4['reason'];this['channels'][_0x498df4[_0xbb2c('0x25')]][_0x2a0ea6][_0xbb2c('0x62')]=_0x498df4[_0xbb2c('0x62')];if(this['voiceQueues'][_0x498df4['queue']]&&this[_0xbb2c('0xc')][_0x498df4[_0xbb2c('0x2d')]]['acw']){this[_0xbb2c('0xb')][_0x498df4[_0xbb2c('0x25')]][_0x2a0ea6]['acwtime']=this['voiceQueues'][_0x498df4[_0xbb2c('0x2d')]][_0xbb2c('0x63')];this[_0xbb2c('0xb')][_0x498df4[_0xbb2c('0x25')]][_0x2a0ea6]['agentacw']=!![];}this[_0xbb2c('0xd')][_0x498df4[_0xbb2c('0x44')]]=_[_0xbb2c('0x31')](this[_0xbb2c('0xd')][_0x498df4[_0xbb2c('0x44')]],[_0xbb2c('0x2d'),_0xbb2c('0x64')]);logger['debug'](_0xbb2c('0x65'),_0x498df4[_0xbb2c('0x25')],util['inspect'](this[_0xbb2c('0xb')][_0x498df4[_0xbb2c('0x25')]][_0x2a0ea6],{'showHidden':![],'depth':null}));ami[_0xbb2c('0x20')](_0xbb2c('0x66'),this['channels'][_0x498df4['uniqueid']][_0x2a0ea6]);logger[_0xbb2c('0x28')](_0xbb2c('0x67'),_0x498df4[_0xbb2c('0x25')],util[_0xbb2c('0x29')](this['channels'][_0x498df4[_0xbb2c('0x25')]][_0x2a0ea6],{'showHidden':![],'depth':null}));this['emit'](util[_0xbb2c('0x2b')]('user:%s',_0x498df4[_0xbb2c('0x26')]),_0xbb2c('0x68'),this['channels'][_0x498df4[_0xbb2c('0x25')]][_0x2a0ea6]);}}}}}}catch(_0x19051e){logger[_0xbb2c('0x39')](_0xbb2c('0x69'),_0x498df4[_0xbb2c('0x25')],util['inspect'](_0x19051e,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xbb2c('0x21')][_0xbb2c('0x19')]=function(_0x1b0d0e){try{if(this[_0xbb2c('0x22')](_0x1b0d0e)){logger['debug'](_0xbb2c('0x6a'),_0x1b0d0e[_0xbb2c('0x25')],util['inspect'](_0x1b0d0e,{'showHidden':![],'depth':null}));this['addVariable'](_0x1b0d0e[_0xbb2c('0x25')],_[_0xbb2c('0x6b')](_0x1b0d0e['variable'])[0x0],_0x1b0d0e[_0xbb2c('0x6c')]);if(this['channels'][_0x1b0d0e[_0xbb2c('0x25')]]){for(var _0x1a8b38 in this[_0xbb2c('0xb')][_0x1b0d0e['uniqueid']]){if(this[_0xbb2c('0xb')][_0x1b0d0e['uniqueid']][_0xbb2c('0x58')](_0x1a8b38)){logger[_0xbb2c('0x23')](_0xbb2c('0x6d'),_0x1b0d0e['uniqueid'],_0x1a8b38,_[_0xbb2c('0x6b')](_0x1b0d0e[_0xbb2c('0x6e')])[0x0],_0x1b0d0e['value']);if(_[_0xbb2c('0x2a')](this[_0xbb2c('0xb')][_0x1b0d0e['uniqueid']][_0x1a8b38][_0xbb2c('0xe')])){this[_0xbb2c('0xb')][_0x1b0d0e[_0xbb2c('0x25')]][_0x1a8b38][_0xbb2c('0xe')]={};}this[_0xbb2c('0xb')][_0x1b0d0e['uniqueid']][_0x1a8b38]['variables']=this[_0xbb2c('0xe')][_0x1b0d0e['uniqueid']];}}}}}catch(_0x2c761c){logger[_0xbb2c('0x39')]('[%s][voiceAgentReport][varset]',_0x1b0d0e[_0xbb2c('0x25')],util[_0xbb2c('0x29')](_0x2c761c,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xbb2c('0x21')][_0xbb2c('0x6f')]=function(_0x185354,_0x2ff8c3,_0x3c5728){var _0x1c15e6=[_0xbb2c('0x70'),_0xbb2c('0x71'),_0xbb2c('0x72'),_0xbb2c('0x73'),'rtpaudioqosloss',_0xbb2c('0x74'),_0xbb2c('0x75'),'rtpaudioqosrttbridged',_0xbb2c('0x76'),'sipuri',_0xbb2c('0x77'),'bridgepvtcallid',_0xbb2c('0x78'),'memberdynamic',_0xbb2c('0x79'),_0xbb2c('0x7a'),'membername','memberpenalty',_0xbb2c('0x7b')];if(!_[_0xbb2c('0x7c')](_0x2ff8c3)&&!_['includes'](_0x1c15e6,_0x2ff8c3)){if(_[_0xbb2c('0x2a')](this[_0xbb2c('0xe')][_0x185354])){this[_0xbb2c('0xe')][_0x185354]={};}this[_0xbb2c('0xe')][_0x185354][_0x2ff8c3]=_0x3c5728;}};VoiceAgentReport[_0xbb2c('0x21')][_0xbb2c('0x7d')]=function(_0x45ec1d){try{if(this[_0xbb2c('0x22')](_0x45ec1d)){logger['debug'](_0xbb2c('0x7e'),_0x45ec1d['uniqueid'],util[_0xbb2c('0x29')](_0x45ec1d,{'showHidden':![],'depth':null}));if(this[_0xbb2c('0xb')][_0x45ec1d[_0xbb2c('0x25')]]){for(var _0x518e14 in this[_0xbb2c('0xb')][_0x45ec1d[_0xbb2c('0x25')]]){if(this['channels'][_0x45ec1d[_0xbb2c('0x25')]]['hasOwnProperty'](_0x518e14)){if(this['channels'][_0x45ec1d[_0xbb2c('0x25')]][_0x518e14][_0xbb2c('0x50')]==_0xbb2c('0x7f')&&this[_0xbb2c('0xb')][_0x45ec1d['uniqueid']][_0x518e14][_0xbb2c('0x17')]){logger['info'](_0xbb2c('0x80'),_0x45ec1d[_0xbb2c('0x25')],_0x518e14);this[_0xbb2c('0xb')][_0x45ec1d[_0xbb2c('0x25')]][_0x518e14][_0xbb2c('0x5f')]=moment()[_0xbb2c('0x2b')](_0xbb2c('0x4c'));}}}logger['debug'](_0xbb2c('0x81'),_0x45ec1d[_0xbb2c('0x25')],util['inspect'](_[_0xbb2c('0x82')](this['channels'][_0x45ec1d[_0xbb2c('0x25')]]),{'showHidden':![],'depth':null}));ami['emit'](_0xbb2c('0x83'),_[_0xbb2c('0x82')](this['channels'][_0x45ec1d['uniqueid']]));delete this[_0xbb2c('0xb')][_0x45ec1d[_0xbb2c('0x25')]];}if(this[_0xbb2c('0xe')][_0x45ec1d['uniqueid']]){delete this[_0xbb2c('0xe')][_0x45ec1d['uniqueid']];}}}catch(_0x4c9204){logger[_0xbb2c('0x39')](_0xbb2c('0x84'),_0x45ec1d[_0xbb2c('0x25')],util[_0xbb2c('0x29')](_0x4c9204,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0xbb2c('0x1d')]=function(_0x30c7a4){try{if(this[_0xbb2c('0x22')](_0x30c7a4)){logger[_0xbb2c('0x28')]('[%s][voiceAgentReport][attendedtransfer]\x20event:',_0x30c7a4['uniqueid'],util[_0xbb2c('0x29')](_0x30c7a4,{'showHidden':![],'depth':null}));if(this['channels'][_0x30c7a4['transfereeuniqueid']]){for(var _0x391725 in this[_0xbb2c('0xb')][_0x30c7a4['transfereeuniqueid']]){if(this['channels'][_0x30c7a4[_0xbb2c('0x85')]][_0xbb2c('0x58')](_0x391725)){if(_0x30c7a4[_0xbb2c('0x86')]===_0x391725){logger[_0xbb2c('0x23')](_0xbb2c('0x87'),_0x30c7a4[_0xbb2c('0x25')],this['channels'][_0x30c7a4['transfereeuniqueid']][_0x391725][_0xbb2c('0x26')],_0x391725);var _0x588754=moment();this[_0xbb2c('0xb')][_0x30c7a4[_0xbb2c('0x85')]][_0x391725][_0xbb2c('0x17')]=!![];this['channels'][_0x30c7a4[_0xbb2c('0x85')]][_0x391725][_0xbb2c('0x5f')]=moment()[_0xbb2c('0x2b')]('YYYY-MM-DD\x20HH:mm:ss');this[_0xbb2c('0xb')][_0x30c7a4[_0xbb2c('0x85')]][_0x391725][_0xbb2c('0x41')]=_0xbb2c('0x60');this['channels'][_0x30c7a4['transfereeuniqueid']][_0x391725][_0xbb2c('0x50')]=_0xbb2c('0x7f');this[_0xbb2c('0xb')][_0x30c7a4[_0xbb2c('0x85')]][_0x391725]['talktime']=_0x588754[_0xbb2c('0x88')](this[_0xbb2c('0xb')][_0x30c7a4['transfereeuniqueid']][_0x391725]['agentconnectAt'],_0xbb2c('0x89'));}}}}if(this[_0xbb2c('0xb')][_0x30c7a4[_0xbb2c('0x8a')]]){var _0x13e1af=this['channels'][_0x30c7a4[_0xbb2c('0x8a')]];this[_0xbb2c('0xb')][_0x30c7a4['secondtransfereruniqueid']]=this[_0xbb2c('0xb')][_0x30c7a4[_0xbb2c('0x85')]];this[_0xbb2c('0xb')][_0x30c7a4['transfereeuniqueid']]=_0x13e1af;}}}catch(_0x33924d){logger[_0xbb2c('0x39')](_0xbb2c('0x8b'),_0x30c7a4[_0xbb2c('0x25')],util['inspect'](_0x33924d,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xbb2c('0x21')][_0xbb2c('0x1f')]=function(_0x3be1d5){try{if(this['isNotNull'](_0x3be1d5)){logger[_0xbb2c('0x28')](_0xbb2c('0x8c'),_0x3be1d5[_0xbb2c('0x25')],util[_0xbb2c('0x29')](_0x3be1d5,{'showHidden':![],'depth':null}));if(this[_0xbb2c('0xb')][_0x3be1d5[_0xbb2c('0x85')]]){for(var _0x5cbf45 in this['channels'][_0x3be1d5[_0xbb2c('0x85')]]){if(this[_0xbb2c('0xb')][_0x3be1d5['transfereeuniqueid']][_0xbb2c('0x58')](_0x5cbf45)){if(_0x3be1d5[_0xbb2c('0x8d')]===_0x5cbf45){logger['info'](_0xbb2c('0x8e'),_0x3be1d5[_0xbb2c('0x25')],this[_0xbb2c('0xb')][_0x3be1d5[_0xbb2c('0x85')]][_0x5cbf45][_0xbb2c('0x26')],_0x5cbf45);var _0xc91537=moment();this[_0xbb2c('0xb')][_0x3be1d5[_0xbb2c('0x85')]][_0x5cbf45]['agentcomplete']=!![];this[_0xbb2c('0xb')][_0x3be1d5['transfereeuniqueid']][_0x5cbf45][_0xbb2c('0x5f')]=_0xc91537;this['channels'][_0x3be1d5[_0xbb2c('0x85')]][_0x5cbf45][_0xbb2c('0x41')]=_0xbb2c('0x60');this[_0xbb2c('0xb')][_0x3be1d5[_0xbb2c('0x85')]][_0x5cbf45][_0xbb2c('0x50')]=_0xbb2c('0x7f');this[_0xbb2c('0xb')][_0x3be1d5['transfereeuniqueid']][_0x5cbf45][_0xbb2c('0x62')]=_0xc91537['diff'](this[_0xbb2c('0xb')][_0x3be1d5['transfereeuniqueid']][_0x5cbf45][_0xbb2c('0x3b')],_0xbb2c('0x89'));}}}}}}catch(_0x3f3224){logger[_0xbb2c('0x39')]('[%s][voiceAgentReport][blindtransfer]',_0x3be1d5['uniqueid'],util[_0xbb2c('0x29')](_0x3f3224,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xbb2c('0x21')][_0xbb2c('0x8f')]=function(_0x40c31d){var _0x218060='';try{if(this['isNotNull'](_0x40c31d)){logger[_0xbb2c('0x28')]('[%s][voiceAgentReport][musiconholdstart]\x20event:',_0x40c31d[_0xbb2c('0x25')],util[_0xbb2c('0x29')](_0x40c31d,{'showHidden':![],'depth':null}));if(_0x40c31d[_0xbb2c('0x90')]){_0x218060=_0x40c31d[_0xbb2c('0x90')][_0xbb2c('0x91')](0x0,_0x40c31d[_0xbb2c('0x90')]['lastIndexOf']('-'));if(this[_0xbb2c('0xd')][_0x218060]){logger[_0xbb2c('0x23')]('[%s][voiceAgentReport][musiconholdstart]\x20interface:%s',_0x40c31d['uniqueid'],_0x218060);this[_0xbb2c('0xd')][_0x218060][_0xbb2c('0x92')]=!![];}}}}catch(_0x3ef09d){logger[_0xbb2c('0x39')](_0xbb2c('0x93'),_0x40c31d[_0xbb2c('0x25')],util['inspect'](_0x3ef09d,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xbb2c('0x21')]['syncMusicOnHoldStop']=function(_0x5009c5){var _0x2d5348='';try{if(this['isNotNull'](_0x5009c5)){logger[_0xbb2c('0x28')](_0xbb2c('0x94'),_0x5009c5[_0xbb2c('0x25')],util[_0xbb2c('0x29')](_0x5009c5,{'showHidden':![],'depth':null}));if(_0x5009c5['channel']){_0x2d5348=_0x5009c5[_0xbb2c('0x90')][_0xbb2c('0x91')](0x0,_0x5009c5[_0xbb2c('0x90')][_0xbb2c('0x95')]('-'));if(this[_0xbb2c('0xd')][_0x2d5348]){logger[_0xbb2c('0x23')](_0xbb2c('0x96'),_0x5009c5['uniqueid'],_0x2d5348);this['agents'][_0x2d5348][_0xbb2c('0x92')]=![];}}}}catch(_0x3d7010){logger['error'](_0xbb2c('0x97'),_0x5009c5[_0xbb2c('0x25')],util['inspect'](_0x3d7010,{'showHidden':![],'depth':null}));}};module['exports']=VoiceAgentReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceCallReport.js b/server/services/ami/report/voiceCallReport.js index fcb8984..f94ba5d 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 _0xf632=['ioredis','../../../config/environment','../../../config/logger','ami','../model/channel','unknown','not_inuse','inuse','busy','invalid','ringing','ringinuse','onhold','set','queue','agi','dial','voicemail','NO\x20ANSWER','FAILED','BUSY','redis','defaults','localhost','socket.io-emitter','channels','agents','blindTransfers','coreshowchannel','syncNewExten','bind','newexten','newchannel','syncNewChannel','newstate','syncNewState','syncVarSet','hangup','syncHangup','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','info','actionCoreShowChannels','error','[voiceCallReport][coreshowchannels]','inspect','prototype','isNotNull','isUndefined','emit','syncNewCallerId','[%s][voiceCallReport][newcallerid]\x20calleridname:%s\x20calleridnum:%s','uniqueid','calleridname','calleridnum','debug','[%s][voiceCallReport][newcallerid]\x20event:','linkedid','merge','pick','keys','context','channel','split','exten','xcally-motion-preview','destconnectedlinenum','connectedlinenum','format','user:%s','name','user:agentconnect','accountcode','[%s][voiceCallReport][newcallerid]','[%s][voiceCallReport][newchannel]\x20event:','[%s][voiceCallReport][newchannel]\x20context:%s\x20exten:%s','starttime','YYYY-MM-DD\x20HH:mm:ss','disposition','toNumber','channelstate','[%s][voiceCallReport][newchannel]\x20sending\x20user:agentconnect\x20event:','application','appdata','startsWith','CDR(routeAlias)','applicationdata','toLowerCase','[%s][voiceCallReport][newexten]\x20application:%s\x20appdata:%s','duration','subtract','seconds','includes','lastapplication','lastdata','cdr(','match','[%s][voiceCallReport][newexten]','answered','answertime','holdtime','connectedlinename','UserId','membername','routealias','[%s][voiceCallReport][newstate]\x20sending\x20user:agentconnect\x20event:','[%s][voiceCallReport][newstate]','syncMixMonitorFilename','[%s][voiceCallReport][mixMonitorFilename]\x20monitorFilename:%s','monitor','endsWith','replace','.WAV','monitorFilename','find','isNil','monitors','push','rec','OutgoingSpoolFailed','variable','value','xmd-phone','xmd-callerid','[%s][voiceCallReport][varset]\x20variable:xmd-callerid\x20value:%s','callerid','xmd-cdrtype','[%s][voiceCallReport][varset]\x20variable:xmd-cdrtype\x20value:%s','type','[%s][voiceCallReport][varset]\x20variable:xmd-queue\x20value:%s','xmd-originatecalleridnum','[%s][voiceCallReport][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','xmd-destination','destination','xmd-callerid-preview','[%s][voiceCallReport][varset]\x20variable:xmd-callerid-preview\x20value:%s','calleridpreview','xmcs-queue','[%s][voiceCallReport][varset]\x20variable:xmcs-queue\x20value:%s','sipcallid','[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s','sipcalluniqueid','mixmonitor_filename','sipcalllinkedid','[%s][voiceCallReport][varset]','cause-txt','endtime','billableseconds','diff','from-sip','omit','[%s][voiceCallReport][hangup]\x20sending\x20user:agentcomplete\x20event:','resolve','then','transferType','undefined','isEmpty','getSettings','stopRecordingOnTransfer','Action','StopMixMonitor','destinationchannel','catch','finally','webbar:stopmonitors','event','BlindTransfer','outbound','[%s][voiceCallReport][hangup]\x20sending\x20hangup\x20event:','custom:voiceCallReport','[%s][voiceCallReport][attendedtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','transfertargetcalleridnum','[%s][voiceCallReport][attendedtransfer]\x20event:','transfereeuniqueid','transfercalleridnum','origtransferercalleridnum','secondtransfereruniqueid','transferconnectedlinenum','origtransfereruniqueid','transfertargetuniqueid','origtransfererlinkedid','some','routeid','ATTENDED','[%s][voiceCallReport][attendedtransfer]','transfereecalleridnum','extension','BLIND','transfererchannel','transfereruniqueid','[%s][voiceCallReport][blindtransfer]','[%s][voiceCallReport][musiconholdstart]\x20event:','[%s][voiceCallReport][musiconholdstart]\x20mohstarttime:%s','mohstarttime','[%s][voiceCallReport][musiconholdstart]','mohtime','[%s][voiceCallReport][musiconholdstop]','exports','bluebird','lodash','moment','path'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xf632,0xcc));var _0x2f63=function(_0x1a33a3,_0x4683b5){_0x1a33a3=_0x1a33a3-0x0;var _0x4b9c41=_0xf632[_0x1a33a3];return _0x4b9c41;};'use strict';var BPromise=require(_0x2f63('0x0'));var _=require(_0x2f63('0x1'));var moment=require(_0x2f63('0x2'));var util=require('util');var path=require(_0x2f63('0x3'));var Redis=require(_0x2f63('0x4'));var config=require(_0x2f63('0x5'));var logger=require(_0x2f63('0x6'))(_0x2f63('0x7'));var ami=require('../ami');var Channel=require(_0x2f63('0x8'));var RpcSetting=require('../rpc/setting');var statusDesc=[_0x2f63('0x9'),_0x2f63('0xa'),_0x2f63('0xb'),_0x2f63('0xc'),_0x2f63('0xd'),'unavailable',_0x2f63('0xe'),_0x2f63('0xf'),_0x2f63('0x10')];var applications=[_0x2f63('0x11'),_0x2f63('0x12'),_0x2f63('0x13'),_0x2f63('0x14'),'playback',_0x2f63('0x15')];var dispositions=[_0x2f63('0x16'),_0x2f63('0x17'),_0x2f63('0x17'),'NO\x20ANSWER',_0x2f63('0x16'),'NO\x20ANSWER','ANSWERED',_0x2f63('0x18'),_0x2f63('0x17'),_0x2f63('0x17'),'FAILED'];var actions={};config[_0x2f63('0x19')]=_[_0x2f63('0x1a')](config[_0x2f63('0x19')],{'host':_0x2f63('0x1b'),'port':0x18eb});var io=require(_0x2f63('0x1c'))(new Redis(config['redis']));function VoiceCallReport(_0x3cae42){this[_0x2f63('0x1d')]=_0x3cae42['channels'];this[_0x2f63('0x1e')]=_0x3cae42[_0x2f63('0x1e')];this[_0x2f63('0x1f')]={};ami['on'](_0x2f63('0x20'),this[_0x2f63('0x21')][_0x2f63('0x22')](this));ami['on'](_0x2f63('0x23'),this[_0x2f63('0x21')]['bind'](this));ami['on'](_0x2f63('0x24'),this[_0x2f63('0x25')]['bind'](this));ami['on'](_0x2f63('0x26'),this[_0x2f63('0x27')][_0x2f63('0x22')](this));ami['on']('varset',this[_0x2f63('0x28')]['bind'](this));ami['on'](_0x2f63('0x29'),this[_0x2f63('0x2a')][_0x2f63('0x22')](this));ami['on']('newcallerid',this['syncNewCallerId'][_0x2f63('0x22')](this));ami['on'](_0x2f63('0x2b'),this[_0x2f63('0x2c')]['bind'](this));ami['on'](_0x2f63('0x2d'),this[_0x2f63('0x2e')][_0x2f63('0x22')](this));ami['on'](_0x2f63('0x2f'),this[_0x2f63('0x30')][_0x2f63('0x22')](this));ami['on'](_0x2f63('0x31'),this[_0x2f63('0x32')][_0x2f63('0x22')](this));try{logger[_0x2f63('0x33')]('[voiceCallReport][coreshowchannels]\x20started');ami[_0x2f63('0x34')]();}catch(_0x2985e6){logger[_0x2f63('0x35')](_0x2f63('0x36'),util[_0x2f63('0x37')](_0x2985e6,{'showHidden':![],'depth':null}));}}VoiceCallReport[_0x2f63('0x38')][_0x2f63('0x39')]=function(_0x5217b1){return _0x5217b1!==null&&!_[_0x2f63('0x3a')](_0x5217b1);};VoiceCallReport[_0x2f63('0x38')][_0x2f63('0x3b')]=function(_0x5db20b,_0x1b55aa,_0x5c53bb){io['to'](_0x5db20b)[_0x2f63('0x3b')](_0x1b55aa,_0x5c53bb);};VoiceCallReport['prototype'][_0x2f63('0x3c')]=function(_0x13979a){try{if(this[_0x2f63('0x39')](_0x13979a)){logger['info'](_0x2f63('0x3d'),_0x13979a[_0x2f63('0x3e')],_0x13979a[_0x2f63('0x3f')],_0x13979a[_0x2f63('0x40')]);logger[_0x2f63('0x41')](_0x2f63('0x42'),_0x13979a[_0x2f63('0x3e')],util[_0x2f63('0x37')](_0x13979a,{'showHidden':![],'depth':null}));if(_0x13979a[_0x2f63('0x3e')]===_0x13979a[_0x2f63('0x43')]){if(!_[_0x2f63('0x3a')](this[_0x2f63('0x1d')][_0x13979a[_0x2f63('0x3e')]])){_[_0x2f63('0x44')](this[_0x2f63('0x1d')][_0x13979a['uniqueid']],_[_0x2f63('0x45')](_0x13979a,_[_0x2f63('0x46')](this['channels'][_0x13979a['uniqueid']])));}}if(_0x13979a[_0x2f63('0x47')]==='from-sip'){if(this[_0x2f63('0x1e')][_0x13979a[_0x2f63('0x48')][_0x2f63('0x49')]('-')[0x0]]){if(_0x13979a[_0x2f63('0x4a')]==_0x2f63('0x4b')){this[_0x2f63('0x1e')][_0x13979a[_0x2f63('0x48')][_0x2f63('0x49')]('-')[0x0]][_0x2f63('0x4c')]=_0x13979a[_0x2f63('0x4d')];this[_0x2f63('0x3b')](util[_0x2f63('0x4e')](_0x2f63('0x4f'),this['agents'][_0x13979a[_0x2f63('0x48')][_0x2f63('0x49')]('-')[0x0]][_0x2f63('0x50')]),_0x2f63('0x51'),{'destaccountcode':this['agents'][_0x13979a['channel'][_0x2f63('0x49')]('-')[0x0]][_0x2f63('0x52')],'destconnectedlinenum':_0x13979a[_0x2f63('0x4d')]});}}}}}catch(_0x13cb90){logger[_0x2f63('0x35')](_0x2f63('0x53'),_0x13979a[_0x2f63('0x3e')],util[_0x2f63('0x37')](_0x13cb90,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x2f63('0x25')]=function(_0x4ff49e){try{if(this[_0x2f63('0x39')](_0x4ff49e)){logger[_0x2f63('0x41')](_0x2f63('0x54'),_0x4ff49e[_0x2f63('0x3e')],util[_0x2f63('0x37')](_0x4ff49e,{'showHidden':![],'depth':null}));if(_0x4ff49e[_0x2f63('0x3e')]===_0x4ff49e[_0x2f63('0x43')]&&_0x4ff49e[_0x2f63('0x48')]!='OutgoingSpoolFailed'){if(_['isUndefined'](this[_0x2f63('0x1d')][_0x4ff49e[_0x2f63('0x3e')]])){logger['info'](_0x2f63('0x55'),_0x4ff49e['uniqueid'],_0x4ff49e[_0x2f63('0x47')],_0x4ff49e['exten']);this[_0x2f63('0x1d')][_0x4ff49e['uniqueid']]=new Channel();this[_0x2f63('0x1d')][_0x4ff49e[_0x2f63('0x3e')]][_0x2f63('0x56')]=moment()[_0x2f63('0x4e')](_0x2f63('0x57'));this[_0x2f63('0x1d')][_0x4ff49e[_0x2f63('0x3e')]][_0x2f63('0x58')]=dispositions[_[_0x2f63('0x59')](_0x4ff49e[_0x2f63('0x5a')])];_['merge'](this['channels'][_0x4ff49e['uniqueid']],_[_0x2f63('0x45')](_0x4ff49e,_['keys'](this[_0x2f63('0x1d')][_0x4ff49e['uniqueid']])));if(_0x4ff49e[_0x2f63('0x47')]==='from-sip'){if(this[_0x2f63('0x1e')][_0x4ff49e[_0x2f63('0x48')][_0x2f63('0x49')]('-')[0x0]]){if(_[_0x2f63('0x3a')](this[_0x2f63('0x1e')][_0x4ff49e[_0x2f63('0x48')][_0x2f63('0x49')]('-')[0x0]]['destconnectedlinenum'])){this['agents'][_0x4ff49e['channel'][_0x2f63('0x49')]('-')[0x0]]['destconnectedlinenum']=_0x4ff49e[_0x2f63('0x4a')];logger['debug'](_0x2f63('0x5b'),_0x4ff49e[_0x2f63('0x3e')],util['inspect']({'destaccountcode':this['agents'][_0x4ff49e[_0x2f63('0x48')][_0x2f63('0x49')]('-')[0x0]][_0x2f63('0x52')],'destconnectedlinenum':_0x4ff49e[_0x2f63('0x4a')]},{'showHidden':![],'depth':null}));this[_0x2f63('0x3b')](util[_0x2f63('0x4e')]('user:%s',this['agents'][_0x4ff49e[_0x2f63('0x48')][_0x2f63('0x49')]('-')[0x0]][_0x2f63('0x50')]),_0x2f63('0x51'),{'destaccountcode':this[_0x2f63('0x1e')][_0x4ff49e[_0x2f63('0x48')][_0x2f63('0x49')]('-')[0x0]][_0x2f63('0x52')],'destconnectedlinenum':_0x4ff49e[_0x2f63('0x4a')]});}}}}}}}catch(_0x4afecf){logger[_0x2f63('0x35')]('[%s][voiceCallReport][newchannel]',_0x4ff49e[_0x2f63('0x3e')],util['inspect'](_0x4afecf,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x2f63('0x38')]['syncNewExten']=function(_0x5a0412){try{if(this[_0x2f63('0x39')](_0x5a0412)){logger['debug']('[%s][voiceCallReport][newexten]\x20event:',_0x5a0412['uniqueid'],util[_0x2f63('0x37')](_0x5a0412,{'showHidden':![],'depth':null}));if(_0x5a0412[_0x2f63('0x3e')]===_0x5a0412[_0x2f63('0x43')]&&_0x5a0412[_0x2f63('0x4a')]!='h'&&_0x5a0412[_0x2f63('0x48')]!='OutgoingSpoolFailed'){_0x5a0412['application']=_0x5a0412[_0x2f63('0x5c')]['toLowerCase']();_0x5a0412['applicationdata']=_0x5a0412[_0x2f63('0x5d')]&&_0x5a0412['appdata'][_0x2f63('0x5e')](_0x2f63('0x5f'))?_0x5a0412[_0x2f63('0x5d')]:(_0x5a0412[_0x2f63('0x5d')]||_0x5a0412[_0x2f63('0x60')])[_0x2f63('0x61')]();logger['info'](_0x2f63('0x62'),_0x5a0412[_0x2f63('0x3e')],_0x5a0412[_0x2f63('0x5c')],_0x5a0412['applicationdata']);if(_['isUndefined'](this[_0x2f63('0x1d')][_0x5a0412['uniqueid']])){this[_0x2f63('0x1d')][_0x5a0412[_0x2f63('0x3e')]]=new Channel();this[_0x2f63('0x1d')][_0x5a0412[_0x2f63('0x3e')]][_0x2f63('0x56')]=_0x5a0412[_0x2f63('0x63')]?moment()[_0x2f63('0x64')](moment['duration'](_0x5a0412[_0x2f63('0x63')])[_0x2f63('0x65')](),'seconds')[_0x2f63('0x4e')](_0x2f63('0x57')):moment()[_0x2f63('0x4e')](_0x2f63('0x57'));this[_0x2f63('0x1d')][_0x5a0412[_0x2f63('0x3e')]][_0x2f63('0x58')]=_0x2f63('0x16');}_['merge'](this[_0x2f63('0x1d')][_0x5a0412[_0x2f63('0x3e')]],_[_0x2f63('0x45')](_0x5a0412,_[_0x2f63('0x46')](this[_0x2f63('0x1d')][_0x5a0412[_0x2f63('0x3e')]])));if(_[_0x2f63('0x66')](applications,_0x5a0412[_0x2f63('0x5c')])){this[_0x2f63('0x1d')][_0x5a0412[_0x2f63('0x3e')]][_0x2f63('0x67')]=_0x5a0412['application'];this['channels'][_0x5a0412[_0x2f63('0x3e')]][_0x2f63('0x68')]=_0x5a0412['applicationdata'];if(_0x5a0412[_0x2f63('0x5c')]==='set'&&_['startsWith'](_0x5a0412[_0x2f63('0x60')][_0x2f63('0x61')](),_0x2f63('0x69'))){var _0x255fbf=_0x5a0412[_0x2f63('0x60')][_0x2f63('0x49')]('=');var _0x57b483=_0x255fbf[0x0][_0x2f63('0x61')]()[_0x2f63('0x6a')](/cdr\((.*)\)/);if(_0x57b483){this['channels'][_0x5a0412[_0x2f63('0x3e')]][_0x57b483[0x1]]=_0x255fbf[0x1];}}else if(_0x5a0412[_0x2f63('0x5c')]===_0x2f63('0x12')){this['channels'][_0x5a0412[_0x2f63('0x3e')]][_0x2f63('0x12')]=_0x5a0412[_0x2f63('0x60')][_0x2f63('0x49')](',')[0x0];}}}}}catch(_0x53596f){logger[_0x2f63('0x35')](_0x2f63('0x6b'),_0x5a0412[_0x2f63('0x3e')],util[_0x2f63('0x37')](_0x53596f,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x2f63('0x38')]['syncNewState']=function(_0x312c63){try{if(this[_0x2f63('0x39')](_0x312c63)){logger[_0x2f63('0x33')]('[%s][voiceCallReport][newstate]\x20linkedid:%s\x20calleridname:%s\x20calleridnum:%s',_0x312c63['uniqueid'],_0x312c63[_0x2f63('0x43')],_0x312c63[_0x2f63('0x3f')],_0x312c63['calleridnum']);logger[_0x2f63('0x41')]('[%s][voiceCallReport][newstate]\x20event:',_0x312c63[_0x2f63('0x3e')],util[_0x2f63('0x37')](_0x312c63,{'showHidden':![],'depth':null}));if(_0x312c63[_0x2f63('0x3e')]!==_0x312c63['linkedid']){if(this['channels'][_0x312c63[_0x2f63('0x43')]]){if(_0x312c63[_0x2f63('0x5a')]==='6'){if(!this[_0x2f63('0x1d')][_0x312c63['linkedid']][_0x2f63('0x6c')]){var _0xedae0b=moment();this[_0x2f63('0x1d')][_0x312c63[_0x2f63('0x43')]][_0x2f63('0x6c')]=!![];this[_0x2f63('0x1d')][_0x312c63[_0x2f63('0x43')]][_0x2f63('0x6d')]=_0xedae0b[_0x2f63('0x4e')]('YYYY-MM-DD\x20HH:mm:ss');if(this[_0x2f63('0x1d')][_0x312c63['linkedid']]['starttime']){this['channels'][_0x312c63['linkedid']][_0x2f63('0x6e')]=_0xedae0b['diff'](this['channels'][_0x312c63[_0x2f63('0x43')]]['starttime'],'seconds');}}this['channels'][_0x312c63[_0x2f63('0x43')]][_0x2f63('0x43')]=_0x312c63[_0x2f63('0x3e')];if(_0x312c63[_0x2f63('0x40')]!==_0x2f63('0x4b')){this[_0x2f63('0x1d')][_0x312c63[_0x2f63('0x43')]][_0x2f63('0x4d')]=_0x312c63['calleridnum'];}this[_0x2f63('0x1d')][_0x312c63[_0x2f63('0x43')]][_0x2f63('0x6f')]=_0x312c63['calleridname'];this[_0x2f63('0x1d')][_0x312c63[_0x2f63('0x43')]]['destinationchannel']=_0x312c63[_0x2f63('0x48')];this[_0x2f63('0x1d')][_0x312c63[_0x2f63('0x43')]]['disposition']=dispositions[_[_0x2f63('0x59')](_0x312c63['channelstate'])];if(this[_0x2f63('0x1e')][_0x312c63[_0x2f63('0x48')][_0x2f63('0x49')]('-')[0x0]]){this[_0x2f63('0x1d')][_0x312c63['linkedid']][_0x2f63('0x70')]=this[_0x2f63('0x1e')][_0x312c63[_0x2f63('0x48')][_0x2f63('0x49')]('-')[0x0]]['id'];this[_0x2f63('0x1d')][_0x312c63[_0x2f63('0x43')]][_0x2f63('0x71')]=this[_0x2f63('0x1e')][_0x312c63[_0x2f63('0x48')][_0x2f63('0x49')]('-')[0x0]][_0x2f63('0x50')];}}}}else{if(this['channels'][_0x312c63[_0x2f63('0x3e')]]){if(_0x312c63[_0x2f63('0x5a')]==='6'){if(this[_0x2f63('0x1e')][_0x312c63[_0x2f63('0x48')][_0x2f63('0x49')]('-')[0x0]]){this[_0x2f63('0x1d')][_0x312c63['uniqueid']][_0x2f63('0x70')]=this[_0x2f63('0x1e')][_0x312c63[_0x2f63('0x48')]['split']('-')[0x0]]['id'];this[_0x2f63('0x1d')][_0x312c63[_0x2f63('0x3e')]][_0x2f63('0x71')]=this[_0x2f63('0x1e')][_0x312c63[_0x2f63('0x48')][_0x2f63('0x49')]('-')[0x0]][_0x2f63('0x50')];}}}}if(_0x312c63[_0x2f63('0x5a')]==='6'&&_0x312c63[_0x2f63('0x47')]==='from-sip'){if(this[_0x2f63('0x1e')][_0x312c63[_0x2f63('0x48')]['split']('-')[0x0]]){this[_0x2f63('0x1e')][_0x312c63[_0x2f63('0x48')]['split']('-')[0x0]][_0x2f63('0x4c')]=_0x312c63['exten'];var _0xc9fede;if(this[_0x2f63('0x1d')][_0x312c63['uniqueid']])_0xc9fede=this[_0x2f63('0x1d')][_0x312c63[_0x2f63('0x3e')]][_0x2f63('0x72')];else if(this[_0x2f63('0x1d')][_0x312c63[_0x2f63('0x43')]])_0xc9fede=this[_0x2f63('0x1d')][_0x312c63[_0x2f63('0x43')]]['routealias'];logger[_0x2f63('0x41')](_0x2f63('0x73'),_0x312c63[_0x2f63('0x3e')],util[_0x2f63('0x37')]({'destaccountcode':this['agents'][_0x312c63[_0x2f63('0x48')]['split']('-')[0x0]]['accountcode'],'destconnectedlinenum':_0x312c63[_0x2f63('0x4a')],'routealias':_0xc9fede},{'showHidden':![],'depth':null}));this[_0x2f63('0x3b')](util[_0x2f63('0x4e')](_0x2f63('0x4f'),this[_0x2f63('0x1e')][_0x312c63[_0x2f63('0x48')]['split']('-')[0x0]][_0x2f63('0x50')]),_0x2f63('0x51'),{'destaccountcode':this['agents'][_0x312c63[_0x2f63('0x48')][_0x2f63('0x49')]('-')[0x0]]['accountcode'],'destconnectedlinenum':_0x312c63[_0x2f63('0x4a')],'routealias':_0xc9fede});}}}}catch(_0x5ae558){logger[_0x2f63('0x35')](_0x2f63('0x74'),_0x312c63[_0x2f63('0x3e')],util[_0x2f63('0x37')](_0x5ae558,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x2f63('0x75')]=function(_0x17f007,_0x4994af){try{if(this['channels'][_0x17f007]){logger[_0x2f63('0x33')](_0x2f63('0x76'),_0x17f007,_0x4994af);this[_0x2f63('0x1d')][_0x17f007][_0x2f63('0x77')]=!![];if(_[_0x2f63('0x78')](_0x4994af,'.wav49')){_0x4994af=_0x4994af[_0x2f63('0x79')]('.wav49',_0x2f63('0x7a'));}this[_0x2f63('0x1d')][_0x17f007][_0x2f63('0x7b')]=_0x4994af;var _0x5dbf4d=_[_0x2f63('0x7c')](this[_0x2f63('0x1d')][_0x17f007]['monitors'],{'filename':_0x4994af});if(_[_0x2f63('0x7d')](_0x5dbf4d)){this[_0x2f63('0x1d')][_0x17f007][_0x2f63('0x7e')][_0x2f63('0x7f')]({'filename':_0x4994af,'createdAt':moment()[_0x2f63('0x4e')](_0x2f63('0x57')),'mixmonitorid':'','status':_0x2f63('0x80')});}}}catch(_0x9883b2){logger[_0x2f63('0x35')]('[%s][voiceCallReport][mixMonitorFilename]',_0x17f007,util[_0x2f63('0x37')](_0x9883b2,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x2f63('0x38')][_0x2f63('0x28')]=function(_0x5d99d0){try{if(this['isNotNull'](_0x5d99d0)){logger[_0x2f63('0x41')]('[%s][voiceCallReport][varset]\x20event:',_0x5d99d0[_0x2f63('0x3e')],util[_0x2f63('0x37')](_0x5d99d0,{'showHidden':![],'depth':null}));if(this['channels'][_0x5d99d0['uniqueid']]&&_0x5d99d0[_0x2f63('0x48')]!=_0x2f63('0x81')){if(this[_0x2f63('0x39')](_0x5d99d0[_0x2f63('0x82')])){if(this['isNotNull'](_0x5d99d0[_0x2f63('0x82')]['mixmonitor_filename'])){logger['info']('[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s',_0x5d99d0[_0x2f63('0x3e')],_0x5d99d0[_0x2f63('0x83')]);this[_0x2f63('0x75')](_0x5d99d0[_0x2f63('0x3e')],_0x5d99d0[_0x2f63('0x83')]);}else if(this[_0x2f63('0x39')](_0x5d99d0[_0x2f63('0x82')][_0x2f63('0x84')])){logger['info']('[%s][voiceCallReport][varset]\x20variable:xmd-phone\x20value:%s',_0x5d99d0[_0x2f63('0x3e')],_0x5d99d0[_0x2f63('0x83')]);this[_0x2f63('0x1d')][_0x5d99d0[_0x2f63('0x3e')]][_0x2f63('0x40')]=_0x5d99d0[_0x2f63('0x83')];}else if(this[_0x2f63('0x39')](_0x5d99d0[_0x2f63('0x82')][_0x2f63('0x85')])){logger[_0x2f63('0x33')](_0x2f63('0x86'),_0x5d99d0[_0x2f63('0x3e')],_0x5d99d0['value']);this[_0x2f63('0x1d')][_0x5d99d0[_0x2f63('0x3e')]][_0x2f63('0x87')]=_0x5d99d0[_0x2f63('0x83')];}else if(this[_0x2f63('0x39')](_0x5d99d0[_0x2f63('0x82')][_0x2f63('0x88')])){logger[_0x2f63('0x33')](_0x2f63('0x89'),_0x5d99d0[_0x2f63('0x3e')],_0x5d99d0[_0x2f63('0x83')]);this[_0x2f63('0x1d')][_0x5d99d0[_0x2f63('0x3e')]][_0x2f63('0x8a')]=_0x5d99d0[_0x2f63('0x83')];}else if(this[_0x2f63('0x39')](_0x5d99d0[_0x2f63('0x82')]['xmd-queue'])){logger[_0x2f63('0x33')](_0x2f63('0x8b'),_0x5d99d0[_0x2f63('0x3e')],_0x5d99d0['value'][_0x2f63('0x49')](',')[0x0]);this[_0x2f63('0x1d')][_0x5d99d0[_0x2f63('0x3e')]][_0x2f63('0x12')]=_0x5d99d0['value']['split'](',')[0x0];}else if(this['isNotNull'](_0x5d99d0[_0x2f63('0x82')][_0x2f63('0x8c')])){logger[_0x2f63('0x33')](_0x2f63('0x8d'),_0x5d99d0[_0x2f63('0x3e')],_0x5d99d0['value']);this[_0x2f63('0x1d')][_0x5d99d0[_0x2f63('0x3e')]]['originatecalleridnum']=_0x5d99d0[_0x2f63('0x83')];}else if(this[_0x2f63('0x39')](_0x5d99d0[_0x2f63('0x82')][_0x2f63('0x8e')])){logger['info']('[%s][voiceCallReport][varset]\x20variable:xmd-destination\x20value:%s',_0x5d99d0[_0x2f63('0x3e')],_0x5d99d0[_0x2f63('0x83')]);this[_0x2f63('0x1d')][_0x5d99d0[_0x2f63('0x3e')]][_0x2f63('0x8f')]=_0x5d99d0[_0x2f63('0x83')];}else if(this[_0x2f63('0x39')](_0x5d99d0['variable'][_0x2f63('0x90')])){logger[_0x2f63('0x33')](_0x2f63('0x91'),_0x5d99d0[_0x2f63('0x3e')],_0x5d99d0[_0x2f63('0x83')]);this[_0x2f63('0x1d')][_0x5d99d0[_0x2f63('0x3e')]][_0x2f63('0x92')]=_0x5d99d0[_0x2f63('0x83')];}else if(this[_0x2f63('0x39')](_0x5d99d0['variable'][_0x2f63('0x93')])){logger['info'](_0x2f63('0x94'),_0x5d99d0[_0x2f63('0x3e')],_0x5d99d0[_0x2f63('0x83')]);this[_0x2f63('0x1d')][_0x5d99d0['uniqueid']]['queue']=_0x5d99d0[_0x2f63('0x83')];}else if(this[_0x2f63('0x39')](_0x5d99d0[_0x2f63('0x82')][_0x2f63('0x95')])){logger['info'](_0x2f63('0x96'),_0x5d99d0[_0x2f63('0x3e')],_0x5d99d0[_0x2f63('0x83')]);this[_0x2f63('0x1d')][_0x5d99d0[_0x2f63('0x3e')]][_0x2f63('0x97')]=_0x5d99d0['value'];}}}else if(this[_0x2f63('0x39')](_0x5d99d0[_0x2f63('0x82')][_0x2f63('0x98')])){if(_0x5d99d0[_0x2f63('0x83')]){var _0x311079=path['parse'](_0x5d99d0[_0x2f63('0x83')])[_0x2f63('0x50')];logger[_0x2f63('0x33')]('[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s',_0x311079,_0x5d99d0[_0x2f63('0x83')]);this[_0x2f63('0x75')](_0x311079,_0x5d99d0[_0x2f63('0x83')]);}}else if(this[_0x2f63('0x1d')][_0x5d99d0[_0x2f63('0x43')]]){if(this['isNotNull'](_0x5d99d0['variable'])){if(this[_0x2f63('0x39')](_0x5d99d0[_0x2f63('0x82')]['sipcallid'])){logger[_0x2f63('0x33')](_0x2f63('0x96'),_0x5d99d0['linkedid'],_0x5d99d0[_0x2f63('0x83')]);this[_0x2f63('0x1d')][_0x5d99d0[_0x2f63('0x43')]][_0x2f63('0x99')]=_0x5d99d0[_0x2f63('0x83')];}}}}}catch(_0x29abec){logger['error'](_0x2f63('0x9a'),_0x5d99d0['uniqueid'],util[_0x2f63('0x37')](_0x29abec,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x2f63('0x38')][_0x2f63('0x2a')]=function(_0x36fbf7){try{if(this[_0x2f63('0x39')](_0x36fbf7)){logger[_0x2f63('0x41')]('[%s][voiceCallReport][hangup]\x20event:',_0x36fbf7[_0x2f63('0x3e')],util[_0x2f63('0x37')](_0x36fbf7,{'showHidden':![],'depth':null}));if(this[_0x2f63('0x1d')][_0x36fbf7[_0x2f63('0x3e')]]){logger['info']('[%s][voiceCallReport][hangup]\x20reason:%s',_0x36fbf7[_0x2f63('0x3e')],_0x36fbf7[_0x2f63('0x9b')]);var _0x19bb9d=moment();this[_0x2f63('0x1d')][_0x36fbf7['uniqueid']][_0x2f63('0x9c')]=_0x19bb9d[_0x2f63('0x4e')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x2f63('0x1d')][_0x36fbf7[_0x2f63('0x3e')]][_0x2f63('0x63')]=_0x19bb9d['diff'](this[_0x2f63('0x1d')][_0x36fbf7[_0x2f63('0x3e')]][_0x2f63('0x56')],_0x2f63('0x65'));if(this[_0x2f63('0x1d')][_0x36fbf7[_0x2f63('0x3e')]][_0x2f63('0x6c')]){this[_0x2f63('0x1d')][_0x36fbf7[_0x2f63('0x3e')]][_0x2f63('0x9d')]=_0x19bb9d[_0x2f63('0x9e')](this[_0x2f63('0x1d')][_0x36fbf7['uniqueid']][_0x2f63('0x6d')],_0x2f63('0x65'));this[_0x2f63('0x1d')][_0x36fbf7['uniqueid']]['holdtime']=this[_0x2f63('0x1d')][_0x36fbf7['uniqueid']][_0x2f63('0x63')]-this[_0x2f63('0x1d')][_0x36fbf7[_0x2f63('0x3e')]][_0x2f63('0x9d')];}if(_0x36fbf7['context']===_0x2f63('0x9f')){if(this[_0x2f63('0x1e')][_0x36fbf7[_0x2f63('0x48')][_0x2f63('0x49')]('-')[0x0]]){this[_0x2f63('0x1e')][_0x36fbf7[_0x2f63('0x48')][_0x2f63('0x49')]('-')[0x0]]=_[_0x2f63('0xa0')](this['agents'][_0x36fbf7[_0x2f63('0x48')]['split']('-')[0x0]],[_0x2f63('0x4c')]);logger['debug'](_0x2f63('0xa1'),_0x36fbf7[_0x2f63('0x3e')],util[_0x2f63('0x37')]({'id':this[_0x2f63('0x1e')][_0x36fbf7[_0x2f63('0x48')][_0x2f63('0x49')]('-')[0x0]]['id'],'destaccountcode':this[_0x2f63('0x1e')][_0x36fbf7[_0x2f63('0x48')]['split']('-')[0x0]][_0x2f63('0x52')]},{'showHidden':![],'depth':null}));this[_0x2f63('0x3b')](util[_0x2f63('0x4e')]('user:%s',this[_0x2f63('0x1e')][_0x36fbf7[_0x2f63('0x48')][_0x2f63('0x49')]('-')[0x0]][_0x2f63('0x50')]),'user:agentcomplete',{'id':this[_0x2f63('0x1e')][_0x36fbf7['channel'][_0x2f63('0x49')]('-')[0x0]]['id'],'destaccountcode':this[_0x2f63('0x1e')][_0x36fbf7[_0x2f63('0x48')][_0x2f63('0x49')]('-')[0x0]][_0x2f63('0x52')]});}}var _0x2e84b0=this;Promise[_0x2f63('0xa2')]()[_0x2f63('0xa3')](function(){var _0x22ebb9=_0x2e84b0['channels'][_0x36fbf7[_0x2f63('0x3e')]];if(typeof _0x22ebb9[_0x2f63('0xa4')]===_0x2f63('0xa5'))return;if(_[_0x2f63('0xa6')](_0x22ebb9[_0x2f63('0x7e')]))return;return RpcSetting[_0x2f63('0xa7')]()['then'](function(_0x432124){if(!_0x432124[_0x2f63('0xa8')])return;return Promise[_0x2f63('0xa2')]()['then'](function(){return ami[_0x2f63('0xa9')]({'action':_0x2f63('0xaa'),'channel':_0x22ebb9['channel']})['catch'](function(){});})['then'](function(){return ami[_0x2f63('0xa9')]({'action':_0x2f63('0xaa'),'channel':_0x22ebb9[_0x2f63('0xab')]})[_0x2f63('0xac')](function(){})[_0x2f63('0xad')](function(){var _0x5d95c7=_0x2e84b0[_0x2f63('0x1e')][_0x22ebb9[_0x2f63('0xab')][_0x2f63('0x49')]('-')[0x0]];if(!_0x5d95c7)return;io[_0x2f63('0x3b')](_0x2f63('0xae'),{'agentId':_0x5d95c7['id'],'uniqueid':_0x22ebb9[_0x2f63('0x3e')]});});});});})[_0x2f63('0xa3')](function(){if(_0x36fbf7[_0x2f63('0xaf')]===_0x2f63('0xb0')){_0x2e84b0['blindTransfers'][_0x36fbf7[_0x2f63('0x3e')]]=_0x2e84b0[_0x2f63('0x1d')][_0x36fbf7[_0x2f63('0x3e')]];}else{if(_0x2e84b0['channels'][_0x36fbf7['uniqueid']][_0x2f63('0x8a')]===_0x2f63('0xb1')&&_0x2e84b0[_0x2f63('0x1f')][_0x36fbf7[_0x2f63('0x3e')]]){_0x2e84b0[_0x2f63('0x1d')][_0x36fbf7[_0x2f63('0x3e')]][_0x2f63('0x3e')]=[_0x2e84b0['channels'][_0x36fbf7[_0x2f63('0x3e')]][_0x2f63('0x43')],_0x2e84b0[_0x2f63('0x1d')][_0x36fbf7[_0x2f63('0x3e')]]['linkedid']=_0x2e84b0[_0x2f63('0x1d')][_0x36fbf7[_0x2f63('0x3e')]][_0x2f63('0x3e')]][0x0];delete _0x2e84b0[_0x2f63('0x1f')][_0x36fbf7[_0x2f63('0x3e')]];}}logger[_0x2f63('0x41')](_0x2f63('0xb2'),_0x36fbf7[_0x2f63('0x3e')],util[_0x2f63('0x37')](_0x2e84b0[_0x2f63('0x1d')][_0x36fbf7['uniqueid']],{'showHidden':![],'depth':null}));ami['emit'](_0x2f63('0xb3'),_0x2e84b0[_0x2f63('0x1d')][_0x36fbf7[_0x2f63('0x3e')]]);delete _0x2e84b0['channels'][_0x36fbf7[_0x2f63('0x3e')]];});}}}catch(_0x35e4af){logger[_0x2f63('0x35')]('[%s][voiceCallReport][hangup]',_0x36fbf7[_0x2f63('0x3e')],util[_0x2f63('0x37')](_0x35e4af,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x2f63('0x38')][_0x2f63('0x2c')]=function(_0x4a2426){try{if(this[_0x2f63('0x39')](_0x4a2426)){logger[_0x2f63('0x33')](_0x2f63('0xb4'),_0x4a2426[_0x2f63('0x3e')],_0x4a2426['origtransferercalleridnum'],_0x4a2426[_0x2f63('0xb5')]);logger['debug'](_0x2f63('0xb6'),_0x4a2426[_0x2f63('0x3e')],util[_0x2f63('0x37')](_0x4a2426,{'showHidden':![],'depth':null}));if(this[_0x2f63('0x1d')][_0x4a2426[_0x2f63('0xb7')]]){this['channels'][_0x4a2426[_0x2f63('0xb7')]][_0x2f63('0xb8')]=_0x4a2426[_0x2f63('0xb9')];this[_0x2f63('0x1d')][_0x4a2426[_0x2f63('0xb7')]]['transferconnectedlinenum']=_0x4a2426[_0x2f63('0xb5')];if(this['channels'][_0x4a2426[_0x2f63('0xba')]]){var _0x475717=this['channels'][_0x4a2426['secondtransfereruniqueid']];this[_0x2f63('0x1d')][_0x4a2426[_0x2f63('0xba')]]=this[_0x2f63('0x1d')][_0x4a2426[_0x2f63('0xb7')]];this[_0x2f63('0x1d')][_0x4a2426[_0x2f63('0xb7')]]=_0x475717;}}else if(this[_0x2f63('0x1d')][_0x4a2426['transfertargetuniqueid']]){this[_0x2f63('0x1d')][_0x4a2426['transfertargetuniqueid']]['transfercalleridnum']=_0x4a2426[_0x2f63('0xb9')];this[_0x2f63('0x1d')][_0x4a2426['transfertargetuniqueid']][_0x2f63('0xbb')]=_0x4a2426['transfertargetcalleridnum'];if(this[_0x2f63('0x1d')][_0x4a2426[_0x2f63('0xbc')]]){var _0x475717=this[_0x2f63('0x1d')][_0x4a2426[_0x2f63('0xbc')]];this[_0x2f63('0x1d')][_0x4a2426[_0x2f63('0xbc')]]=this[_0x2f63('0x1d')][_0x4a2426[_0x2f63('0xbd')]];this[_0x2f63('0x1d')][_0x4a2426[_0x2f63('0xbd')]]=_0x475717;}}if((this[_0x2f63('0x1d')][_0x4a2426[_0x2f63('0xbc')]]||this[_0x2f63('0x1d')][_0x4a2426[_0x2f63('0xbe')]])&&this[_0x2f63('0x1d')][_0x4a2426['secondtransfereruniqueid']]){var _0x770b8d=_[_0x2f63('0xbf')]([this[_0x2f63('0x1d')][_0x4a2426['origtransfereruniqueid']],this[_0x2f63('0x1d')][_0x4a2426[_0x2f63('0xbe')]],this[_0x2f63('0x1d')][_0x4a2426[_0x2f63('0xba')]]],function(_0xc298c){return _0xc298c&&_0xc298c['type']===_0x2f63('0xb1')&&_0xc298c[_0x2f63('0xc0')];});if(_0x770b8d){if(this[_0x2f63('0x1d')][_0x4a2426[_0x2f63('0xbc')]])this[_0x2f63('0x1d')][_0x4a2426[_0x2f63('0xbc')]][_0x2f63('0xa4')]=_0x2f63('0xc1');if(this[_0x2f63('0x1d')][_0x4a2426[_0x2f63('0xbe')]])this['channels'][_0x4a2426[_0x2f63('0xbe')]][_0x2f63('0xa4')]=_0x2f63('0xc1');this[_0x2f63('0x1d')][_0x4a2426['secondtransfereruniqueid']][_0x2f63('0xa4')]=_0x2f63('0xc1');}}}}catch(_0x44fe5f){logger[_0x2f63('0x35')](_0x2f63('0xc2'),_0x4a2426[_0x2f63('0x3e')],util[_0x2f63('0x37')](_0x44fe5f,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x2f63('0x38')]['syncBlindTransfer']=function(_0x1b7bcd){try{if(this[_0x2f63('0x39')](_0x1b7bcd)){logger['info']('[%s][voiceCallReport][blindtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s',_0x1b7bcd[_0x2f63('0x3e')],_0x1b7bcd[_0x2f63('0xc3')],_0x1b7bcd[_0x2f63('0xc4')]);logger[_0x2f63('0x41')]('[%s][voiceCallReport][blindtransfer]\x20event:',_0x1b7bcd[_0x2f63('0x3e')],util['inspect'](_0x1b7bcd,{'showHidden':![],'depth':null}));if(this['channels'][_0x1b7bcd[_0x2f63('0xb7')]]){this['channels'][_0x1b7bcd[_0x2f63('0xb7')]]['transfercalleridnum']=_0x1b7bcd[_0x2f63('0xc3')];this['channels'][_0x1b7bcd[_0x2f63('0xb7')]][_0x2f63('0xbb')]=_0x1b7bcd[_0x2f63('0xc4')];this['channels'][_0x1b7bcd[_0x2f63('0xb7')]][_0x2f63('0xa4')]=_0x2f63('0xc5');this[_0x2f63('0x2a')]({'event':'BlindTransfer','uniqueid':_0x1b7bcd[_0x2f63('0xb7')],'context':_0x1b7bcd[_0x2f63('0x47')],'channel':_0x1b7bcd[_0x2f63('0xc6')]});}else{this[_0x2f63('0x1d')][_0x1b7bcd[_0x2f63('0xc7')]][_0x2f63('0xa4')]=_0x2f63('0xc5');}}}catch(_0x2d0589){logger['error'](_0x2f63('0xc8'),_0x1b7bcd[_0x2f63('0x3e')],util[_0x2f63('0x37')](_0x2d0589,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x2f63('0x38')][_0x2f63('0x30')]=function(_0x3c15fb){try{if(this[_0x2f63('0x39')](_0x3c15fb)){logger[_0x2f63('0x41')](_0x2f63('0xc9'),_0x3c15fb[_0x2f63('0x3e')],util[_0x2f63('0x37')](_0x3c15fb,{'showHidden':![],'depth':null}));if(this[_0x2f63('0x1d')][_0x3c15fb[_0x2f63('0x3e')]]){if(!_[_0x2f63('0x7d')](this[_0x2f63('0x1d')][_0x3c15fb[_0x2f63('0x3e')]][_0x2f63('0x6d')])){this[_0x2f63('0x1d')][_0x3c15fb[_0x2f63('0x3e')]]['mohstarttime']=moment()[_0x2f63('0x4e')](_0x2f63('0x57'));logger['info'](_0x2f63('0xca'),_0x3c15fb[_0x2f63('0x3e')],this[_0x2f63('0x1d')][_0x3c15fb[_0x2f63('0x3e')]][_0x2f63('0xcb')]);}}}}catch(_0x2a1071){logger[_0x2f63('0x35')](_0x2f63('0xcc'),_0x3c15fb[_0x2f63('0x3e')],util[_0x2f63('0x37')](_0x2a1071,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x2f63('0x38')][_0x2f63('0x32')]=function(_0x36dd82){try{if(this[_0x2f63('0x39')](_0x36dd82)){logger['debug']('[%s][voiceCallReport][musiconholdstop]\x20event:',_0x36dd82[_0x2f63('0x3e')],util['inspect'](_0x36dd82,{'showHidden':![],'depth':null}));if(this[_0x2f63('0x1d')][_0x36dd82[_0x2f63('0x3e')]]){if(!_[_0x2f63('0x7d')](this[_0x2f63('0x1d')][_0x36dd82['uniqueid']][_0x2f63('0xcb')])){this['channels'][_0x36dd82['uniqueid']][_0x2f63('0xcd')]+=moment()['milliseconds'](0x0)[_0x2f63('0x9e')](this['channels'][_0x36dd82[_0x2f63('0x3e')]][_0x2f63('0xcb')],_0x2f63('0x65'));logger[_0x2f63('0x33')]('[%s][voiceCallReport][musiconholdstop]\x20mohtime:%s',_0x36dd82[_0x2f63('0x3e')],this[_0x2f63('0x1d')][_0x36dd82[_0x2f63('0x3e')]][_0x2f63('0xcd')]);delete this['channels'][_0x36dd82[_0x2f63('0x3e')]]['mohstarttime'];}}}}catch(_0x5aefe4){logger['error'](_0x2f63('0xce'),_0x36dd82['uniqueid'],util[_0x2f63('0x37')](_0x5aefe4,{'showHidden':![],'depth':null}));}};module[_0x2f63('0xcf')]=VoiceCallReport; \ No newline at end of file +var _0xf13d=['[%s][voiceCallReport][newchannel]','[%s][voiceCallReport][newexten]\x20event:','linkedid','OutgoingSpoolFailed','application','toLowerCase','applicationdata','appdata','CDR(routeAlias)','[%s][voiceCallReport][newexten]\x20application:%s\x20appdata:%s','starttime','duration','subtract','seconds','includes','lastapplication','lastdata','set','startsWith','cdr(','[%s][voiceCallReport][newexten]','[%s][voiceCallReport][newstate]\x20linkedid:%s\x20calleridname:%s\x20calleridnum:%s','calleridname','[%s][voiceCallReport][newstate]\x20event:','answered','answertime','diff','connectedlinenum','destinationchannel','UserId','membername','[%s][voiceCallReport][newstate]','[%s][voiceCallReport][mixMonitorFilename]\x20monitorFilename:%s','monitor','.wav49','replace','.WAV','monitorFilename','find','monitors','rec','[%s][voiceCallReport][mixMonitorFilename]','[%s][voiceCallReport][varset]\x20event:','variable','mixmonitor_filename','[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s','value','xmd-phone','callerid','xmd-cdrtype','type','[%s][voiceCallReport][varset]\x20variable:xmd-queue\x20value:%s','xmd-originatecalleridnum','[%s][voiceCallReport][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','originatecalleridnum','xmd-destination','[%s][voiceCallReport][varset]\x20variable:xmd-callerid-preview\x20value:%s','calleridpreview','xmcs-queue','[%s][voiceCallReport][varset]\x20variable:xmcs-queue\x20value:%s','sipcallid','[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s','sipcalluniqueid','parse','syncMixMonitorFilename','[%s][voiceCallReport][varset]','[%s][voiceCallReport][hangup]\x20event:','[%s][voiceCallReport][hangup]\x20reason:%s','billableseconds','omit','[%s][voiceCallReport][hangup]\x20sending\x20user:agentcomplete\x20event:','user:agentcomplete','resolve','then','transferType','undefined','getSettings','stopRecordingOnTransfer','Action','StopMixMonitor','catch','finally','webbar:stopmonitors','event','custom:voiceCallReport','[%s][voiceCallReport][hangup]','[%s][voiceCallReport][attendedtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','origtransferercalleridnum','transfertargetcalleridnum','transfercalleridnum','transfereeuniqueid','transferconnectedlinenum','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','origtransfererlinkedid','some','outbound','ATTENDED','[%s][voiceCallReport][attendedtransfer]','syncBlindTransfer','[%s][voiceCallReport][blindtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','extension','[%s][voiceCallReport][blindtransfer]\x20event:','transfereecalleridnum','BLIND','BlindTransfer','transfereruniqueid','mohstarttime','[%s][voiceCallReport][musiconholdstart]\x20mohstarttime:%s','[%s][voiceCallReport][musiconholdstart]','[%s][voiceCallReport][musiconholdstop]\x20event:','isNil','mohtime','milliseconds','[%s][voiceCallReport][musiconholdstop]\x20mohtime:%s','[%s][voiceCallReport][musiconholdstop]','exports','bluebird','lodash','moment','util','ioredis','../../../config/environment','../../../config/logger','ami','../ami','../model/channel','unknown','not_inuse','inuse','busy','invalid','unavailable','ringing','queue','agi','playback','voicemail','FAILED','NO\x20ANSWER','ANSWERED','redis','defaults','localhost','channels','agents','blindTransfers','coreshowchannel','bind','newexten','syncNewExten','newchannel','syncNewChannel','newstate','syncNewState','varset','syncVarSet','syncHangup','syncNewCallerId','attendedtransfer','syncAttendedTransfer','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','info','error','inspect','isUndefined','prototype','emit','[%s][voiceCallReport][newcallerid]\x20calleridname:%s\x20calleridnum:%s','uniqueid','calleridnum','debug','[%s][voiceCallReport][newcallerid]\x20event:','pick','keys','channel','exten','xcally-motion-preview','split','user:%s','name','user:agentconnect','[%s][voiceCallReport][newcallerid]','isNotNull','[%s][voiceCallReport][newchannel]\x20event:','context','format','YYYY-MM-DD\x20HH:mm:ss','disposition','channelstate','merge','from-sip','destconnectedlinenum','[%s][voiceCallReport][newchannel]\x20sending\x20user:agentconnect\x20event:','accountcode'];(function(_0x4e4061,_0x26503b){var _0x371dbd=function(_0x31a31f){while(--_0x31a31f){_0x4e4061['push'](_0x4e4061['shift']());}};_0x371dbd(++_0x26503b);}(_0xf13d,0x76));var _0xdf13=function(_0x1928c9,_0x13a6d1){_0x1928c9=_0x1928c9-0x0;var _0x51b5fb=_0xf13d[_0x1928c9];return _0x51b5fb;};'use strict';var BPromise=require(_0xdf13('0x0'));var _=require(_0xdf13('0x1'));var moment=require(_0xdf13('0x2'));var util=require(_0xdf13('0x3'));var path=require('path');var Redis=require(_0xdf13('0x4'));var config=require(_0xdf13('0x5'));var logger=require(_0xdf13('0x6'))(_0xdf13('0x7'));var ami=require(_0xdf13('0x8'));var Channel=require(_0xdf13('0x9'));var RpcSetting=require('../rpc/setting');var statusDesc=[_0xdf13('0xa'),_0xdf13('0xb'),_0xdf13('0xc'),_0xdf13('0xd'),_0xdf13('0xe'),_0xdf13('0xf'),_0xdf13('0x10'),'ringinuse','onhold'];var applications=['set',_0xdf13('0x11'),_0xdf13('0x12'),'dial',_0xdf13('0x13'),_0xdf13('0x14')];var dispositions=['NO\x20ANSWER',_0xdf13('0x15'),_0xdf13('0x15'),_0xdf13('0x16'),_0xdf13('0x16'),_0xdf13('0x16'),_0xdf13('0x17'),'BUSY','FAILED',_0xdf13('0x15'),_0xdf13('0x15')];var actions={};config[_0xdf13('0x18')]=_[_0xdf13('0x19')](config[_0xdf13('0x18')],{'host':_0xdf13('0x1a'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xdf13('0x18')]));function VoiceCallReport(_0x3f838a){this['channels']=_0x3f838a[_0xdf13('0x1b')];this[_0xdf13('0x1c')]=_0x3f838a[_0xdf13('0x1c')];this[_0xdf13('0x1d')]={};ami['on'](_0xdf13('0x1e'),this['syncNewExten'][_0xdf13('0x1f')](this));ami['on'](_0xdf13('0x20'),this[_0xdf13('0x21')]['bind'](this));ami['on'](_0xdf13('0x22'),this[_0xdf13('0x23')][_0xdf13('0x1f')](this));ami['on'](_0xdf13('0x24'),this[_0xdf13('0x25')]['bind'](this));ami['on'](_0xdf13('0x26'),this[_0xdf13('0x27')]['bind'](this));ami['on']('hangup',this[_0xdf13('0x28')][_0xdf13('0x1f')](this));ami['on']('newcallerid',this[_0xdf13('0x29')]['bind'](this));ami['on'](_0xdf13('0x2a'),this[_0xdf13('0x2b')][_0xdf13('0x1f')](this));ami['on']('blindtransfer',this['syncBlindTransfer'][_0xdf13('0x1f')](this));ami['on']('musiconholdstart',this[_0xdf13('0x2c')][_0xdf13('0x1f')](this));ami['on'](_0xdf13('0x2d'),this[_0xdf13('0x2e')][_0xdf13('0x1f')](this));try{logger[_0xdf13('0x2f')]('[voiceCallReport][coreshowchannels]\x20started');ami['actionCoreShowChannels']();}catch(_0x4c166e){logger[_0xdf13('0x30')]('[voiceCallReport][coreshowchannels]',util[_0xdf13('0x31')](_0x4c166e,{'showHidden':![],'depth':null}));}}VoiceCallReport['prototype']['isNotNull']=function(_0x313de9){return _0x313de9!==null&&!_[_0xdf13('0x32')](_0x313de9);};VoiceCallReport[_0xdf13('0x33')][_0xdf13('0x34')]=function(_0x37384c,_0x1876e9,_0x2cf969){io['to'](_0x37384c)[_0xdf13('0x34')](_0x1876e9,_0x2cf969);};VoiceCallReport[_0xdf13('0x33')]['syncNewCallerId']=function(_0x473caf){try{if(this['isNotNull'](_0x473caf)){logger[_0xdf13('0x2f')](_0xdf13('0x35'),_0x473caf[_0xdf13('0x36')],_0x473caf['calleridname'],_0x473caf[_0xdf13('0x37')]);logger[_0xdf13('0x38')](_0xdf13('0x39'),_0x473caf[_0xdf13('0x36')],util[_0xdf13('0x31')](_0x473caf,{'showHidden':![],'depth':null}));if(_0x473caf['uniqueid']===_0x473caf['linkedid']){if(!_['isUndefined'](this[_0xdf13('0x1b')][_0x473caf[_0xdf13('0x36')]])){_['merge'](this[_0xdf13('0x1b')][_0x473caf[_0xdf13('0x36')]],_[_0xdf13('0x3a')](_0x473caf,_[_0xdf13('0x3b')](this[_0xdf13('0x1b')][_0x473caf['uniqueid']])));}}if(_0x473caf['context']==='from-sip'){if(this[_0xdf13('0x1c')][_0x473caf[_0xdf13('0x3c')]['split']('-')[0x0]]){if(_0x473caf[_0xdf13('0x3d')]==_0xdf13('0x3e')){this[_0xdf13('0x1c')][_0x473caf[_0xdf13('0x3c')][_0xdf13('0x3f')]('-')[0x0]]['destconnectedlinenum']=_0x473caf['connectedlinenum'];this[_0xdf13('0x34')](util['format'](_0xdf13('0x40'),this[_0xdf13('0x1c')][_0x473caf['channel'][_0xdf13('0x3f')]('-')[0x0]][_0xdf13('0x41')]),_0xdf13('0x42'),{'destaccountcode':this[_0xdf13('0x1c')][_0x473caf[_0xdf13('0x3c')]['split']('-')[0x0]]['accountcode'],'destconnectedlinenum':_0x473caf['connectedlinenum']});}}}}}catch(_0xdc4d41){logger[_0xdf13('0x30')](_0xdf13('0x43'),_0x473caf[_0xdf13('0x36')],util[_0xdf13('0x31')](_0xdc4d41,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xdf13('0x33')][_0xdf13('0x23')]=function(_0x3aca71){try{if(this[_0xdf13('0x44')](_0x3aca71)){logger['debug'](_0xdf13('0x45'),_0x3aca71[_0xdf13('0x36')],util[_0xdf13('0x31')](_0x3aca71,{'showHidden':![],'depth':null}));if(_0x3aca71[_0xdf13('0x36')]===_0x3aca71['linkedid']&&_0x3aca71['channel']!='OutgoingSpoolFailed'){if(_[_0xdf13('0x32')](this['channels'][_0x3aca71['uniqueid']])){logger[_0xdf13('0x2f')]('[%s][voiceCallReport][newchannel]\x20context:%s\x20exten:%s',_0x3aca71[_0xdf13('0x36')],_0x3aca71[_0xdf13('0x46')],_0x3aca71[_0xdf13('0x3d')]);this['channels'][_0x3aca71['uniqueid']]=new Channel();this['channels'][_0x3aca71[_0xdf13('0x36')]]['starttime']=moment()[_0xdf13('0x47')](_0xdf13('0x48'));this[_0xdf13('0x1b')][_0x3aca71['uniqueid']][_0xdf13('0x49')]=dispositions[_['toNumber'](_0x3aca71[_0xdf13('0x4a')])];_[_0xdf13('0x4b')](this[_0xdf13('0x1b')][_0x3aca71[_0xdf13('0x36')]],_['pick'](_0x3aca71,_[_0xdf13('0x3b')](this[_0xdf13('0x1b')][_0x3aca71[_0xdf13('0x36')]])));if(_0x3aca71[_0xdf13('0x46')]===_0xdf13('0x4c')){if(this[_0xdf13('0x1c')][_0x3aca71[_0xdf13('0x3c')][_0xdf13('0x3f')]('-')[0x0]]){if(_['isUndefined'](this[_0xdf13('0x1c')][_0x3aca71['channel']['split']('-')[0x0]][_0xdf13('0x4d')])){this['agents'][_0x3aca71['channel'][_0xdf13('0x3f')]('-')[0x0]][_0xdf13('0x4d')]=_0x3aca71[_0xdf13('0x3d')];logger[_0xdf13('0x38')](_0xdf13('0x4e'),_0x3aca71[_0xdf13('0x36')],util[_0xdf13('0x31')]({'destaccountcode':this[_0xdf13('0x1c')][_0x3aca71[_0xdf13('0x3c')][_0xdf13('0x3f')]('-')[0x0]][_0xdf13('0x4f')],'destconnectedlinenum':_0x3aca71[_0xdf13('0x3d')]},{'showHidden':![],'depth':null}));this[_0xdf13('0x34')](util[_0xdf13('0x47')](_0xdf13('0x40'),this[_0xdf13('0x1c')][_0x3aca71[_0xdf13('0x3c')]['split']('-')[0x0]][_0xdf13('0x41')]),'user:agentconnect',{'destaccountcode':this['agents'][_0x3aca71[_0xdf13('0x3c')][_0xdf13('0x3f')]('-')[0x0]][_0xdf13('0x4f')],'destconnectedlinenum':_0x3aca71[_0xdf13('0x3d')]});}}}}}}}catch(_0x20f9a0){logger[_0xdf13('0x30')](_0xdf13('0x50'),_0x3aca71[_0xdf13('0x36')],util[_0xdf13('0x31')](_0x20f9a0,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xdf13('0x33')][_0xdf13('0x21')]=function(_0x18f8ac){try{if(this[_0xdf13('0x44')](_0x18f8ac)){logger[_0xdf13('0x38')](_0xdf13('0x51'),_0x18f8ac['uniqueid'],util['inspect'](_0x18f8ac,{'showHidden':![],'depth':null}));if(_0x18f8ac[_0xdf13('0x36')]===_0x18f8ac[_0xdf13('0x52')]&&_0x18f8ac[_0xdf13('0x3d')]!='h'&&_0x18f8ac['channel']!=_0xdf13('0x53')){_0x18f8ac[_0xdf13('0x54')]=_0x18f8ac[_0xdf13('0x54')][_0xdf13('0x55')]();_0x18f8ac[_0xdf13('0x56')]=_0x18f8ac['appdata']&&_0x18f8ac[_0xdf13('0x57')]['startsWith'](_0xdf13('0x58'))?_0x18f8ac['appdata']:(_0x18f8ac[_0xdf13('0x57')]||_0x18f8ac[_0xdf13('0x56')])['toLowerCase']();logger[_0xdf13('0x2f')](_0xdf13('0x59'),_0x18f8ac[_0xdf13('0x36')],_0x18f8ac[_0xdf13('0x54')],_0x18f8ac['applicationdata']);if(_[_0xdf13('0x32')](this[_0xdf13('0x1b')][_0x18f8ac['uniqueid']])){this[_0xdf13('0x1b')][_0x18f8ac[_0xdf13('0x36')]]=new Channel();this[_0xdf13('0x1b')][_0x18f8ac['uniqueid']][_0xdf13('0x5a')]=_0x18f8ac[_0xdf13('0x5b')]?moment()[_0xdf13('0x5c')](moment['duration'](_0x18f8ac[_0xdf13('0x5b')])[_0xdf13('0x5d')](),_0xdf13('0x5d'))[_0xdf13('0x47')](_0xdf13('0x48')):moment()[_0xdf13('0x47')](_0xdf13('0x48'));this[_0xdf13('0x1b')][_0x18f8ac[_0xdf13('0x36')]][_0xdf13('0x49')]='NO\x20ANSWER';}_[_0xdf13('0x4b')](this[_0xdf13('0x1b')][_0x18f8ac[_0xdf13('0x36')]],_[_0xdf13('0x3a')](_0x18f8ac,_[_0xdf13('0x3b')](this[_0xdf13('0x1b')][_0x18f8ac['uniqueid']])));if(_[_0xdf13('0x5e')](applications,_0x18f8ac['application'])){this[_0xdf13('0x1b')][_0x18f8ac['uniqueid']][_0xdf13('0x5f')]=_0x18f8ac[_0xdf13('0x54')];this[_0xdf13('0x1b')][_0x18f8ac[_0xdf13('0x36')]][_0xdf13('0x60')]=_0x18f8ac[_0xdf13('0x56')];if(_0x18f8ac[_0xdf13('0x54')]===_0xdf13('0x61')&&_[_0xdf13('0x62')](_0x18f8ac[_0xdf13('0x56')]['toLowerCase'](),_0xdf13('0x63'))){var _0x1d7c20=_0x18f8ac['applicationdata']['split']('=');var _0x3dd4be=_0x1d7c20[0x0][_0xdf13('0x55')]()['match'](/cdr\((.*)\)/);if(_0x3dd4be){this[_0xdf13('0x1b')][_0x18f8ac[_0xdf13('0x36')]][_0x3dd4be[0x1]]=_0x1d7c20[0x1];}}else if(_0x18f8ac[_0xdf13('0x54')]===_0xdf13('0x11')){this[_0xdf13('0x1b')][_0x18f8ac[_0xdf13('0x36')]][_0xdf13('0x11')]=_0x18f8ac[_0xdf13('0x56')][_0xdf13('0x3f')](',')[0x0];}}}}}catch(_0x490af1){logger[_0xdf13('0x30')](_0xdf13('0x64'),_0x18f8ac[_0xdf13('0x36')],util[_0xdf13('0x31')](_0x490af1,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xdf13('0x33')][_0xdf13('0x25')]=function(_0x3ca239){try{if(this[_0xdf13('0x44')](_0x3ca239)){logger['info'](_0xdf13('0x65'),_0x3ca239[_0xdf13('0x36')],_0x3ca239['linkedid'],_0x3ca239[_0xdf13('0x66')],_0x3ca239['calleridnum']);logger[_0xdf13('0x38')](_0xdf13('0x67'),_0x3ca239[_0xdf13('0x36')],util[_0xdf13('0x31')](_0x3ca239,{'showHidden':![],'depth':null}));if(_0x3ca239[_0xdf13('0x36')]!==_0x3ca239[_0xdf13('0x52')]){if(this[_0xdf13('0x1b')][_0x3ca239[_0xdf13('0x52')]]){if(_0x3ca239['channelstate']==='6'){if(!this['channels'][_0x3ca239[_0xdf13('0x52')]][_0xdf13('0x68')]){var _0x545473=moment();this[_0xdf13('0x1b')][_0x3ca239['linkedid']]['answered']=!![];this[_0xdf13('0x1b')][_0x3ca239[_0xdf13('0x52')]][_0xdf13('0x69')]=_0x545473[_0xdf13('0x47')](_0xdf13('0x48'));if(this[_0xdf13('0x1b')][_0x3ca239[_0xdf13('0x52')]][_0xdf13('0x5a')]){this[_0xdf13('0x1b')][_0x3ca239[_0xdf13('0x52')]]['holdtime']=_0x545473[_0xdf13('0x6a')](this[_0xdf13('0x1b')][_0x3ca239[_0xdf13('0x52')]][_0xdf13('0x5a')],_0xdf13('0x5d'));}}this[_0xdf13('0x1b')][_0x3ca239[_0xdf13('0x52')]][_0xdf13('0x52')]=_0x3ca239[_0xdf13('0x36')];if(_0x3ca239['calleridnum']!=='xcally-motion-preview'){this[_0xdf13('0x1b')][_0x3ca239['linkedid']][_0xdf13('0x6b')]=_0x3ca239[_0xdf13('0x37')];}this[_0xdf13('0x1b')][_0x3ca239[_0xdf13('0x52')]]['connectedlinename']=_0x3ca239[_0xdf13('0x66')];this[_0xdf13('0x1b')][_0x3ca239[_0xdf13('0x52')]][_0xdf13('0x6c')]=_0x3ca239[_0xdf13('0x3c')];this[_0xdf13('0x1b')][_0x3ca239[_0xdf13('0x52')]]['disposition']=dispositions[_['toNumber'](_0x3ca239['channelstate'])];if(this[_0xdf13('0x1c')][_0x3ca239[_0xdf13('0x3c')][_0xdf13('0x3f')]('-')[0x0]]){this[_0xdf13('0x1b')][_0x3ca239[_0xdf13('0x52')]][_0xdf13('0x6d')]=this[_0xdf13('0x1c')][_0x3ca239[_0xdf13('0x3c')]['split']('-')[0x0]]['id'];this[_0xdf13('0x1b')][_0x3ca239[_0xdf13('0x52')]][_0xdf13('0x6e')]=this[_0xdf13('0x1c')][_0x3ca239[_0xdf13('0x3c')]['split']('-')[0x0]][_0xdf13('0x41')];}}}}else{if(this['channels'][_0x3ca239[_0xdf13('0x36')]]){if(_0x3ca239[_0xdf13('0x4a')]==='6'){if(this[_0xdf13('0x1c')][_0x3ca239[_0xdf13('0x3c')][_0xdf13('0x3f')]('-')[0x0]]){this[_0xdf13('0x1b')][_0x3ca239[_0xdf13('0x36')]][_0xdf13('0x6d')]=this[_0xdf13('0x1c')][_0x3ca239[_0xdf13('0x3c')][_0xdf13('0x3f')]('-')[0x0]]['id'];this[_0xdf13('0x1b')][_0x3ca239[_0xdf13('0x36')]][_0xdf13('0x6e')]=this[_0xdf13('0x1c')][_0x3ca239[_0xdf13('0x3c')][_0xdf13('0x3f')]('-')[0x0]][_0xdf13('0x41')];}}}}if(_0x3ca239['channelstate']==='6'&&_0x3ca239['context']===_0xdf13('0x4c')){if(this[_0xdf13('0x1c')][_0x3ca239[_0xdf13('0x3c')][_0xdf13('0x3f')]('-')[0x0]]){this[_0xdf13('0x1c')][_0x3ca239[_0xdf13('0x3c')][_0xdf13('0x3f')]('-')[0x0]][_0xdf13('0x4d')]=_0x3ca239[_0xdf13('0x3d')];var _0x46fd79;if(this[_0xdf13('0x1b')][_0x3ca239[_0xdf13('0x36')]])_0x46fd79=this[_0xdf13('0x1b')][_0x3ca239['uniqueid']]['routealias'];else if(this['channels'][_0x3ca239[_0xdf13('0x52')]])_0x46fd79=this[_0xdf13('0x1b')][_0x3ca239[_0xdf13('0x52')]]['routealias'];logger[_0xdf13('0x38')]('[%s][voiceCallReport][newstate]\x20sending\x20user:agentconnect\x20event:',_0x3ca239[_0xdf13('0x36')],util['inspect']({'destaccountcode':this['agents'][_0x3ca239['channel'][_0xdf13('0x3f')]('-')[0x0]][_0xdf13('0x4f')],'destconnectedlinenum':_0x3ca239[_0xdf13('0x3d')],'routealias':_0x46fd79},{'showHidden':![],'depth':null}));this[_0xdf13('0x34')](util['format'](_0xdf13('0x40'),this['agents'][_0x3ca239['channel'][_0xdf13('0x3f')]('-')[0x0]][_0xdf13('0x41')]),_0xdf13('0x42'),{'destaccountcode':this[_0xdf13('0x1c')][_0x3ca239['channel']['split']('-')[0x0]][_0xdf13('0x4f')],'destconnectedlinenum':_0x3ca239[_0xdf13('0x3d')],'routealias':_0x46fd79});}}}}catch(_0x2e2de5){logger[_0xdf13('0x30')](_0xdf13('0x6f'),_0x3ca239[_0xdf13('0x36')],util['inspect'](_0x2e2de5,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xdf13('0x33')]['syncMixMonitorFilename']=function(_0x2c13bf,_0x55c6af){try{if(this[_0xdf13('0x1b')][_0x2c13bf]){logger[_0xdf13('0x2f')](_0xdf13('0x70'),_0x2c13bf,_0x55c6af);this['channels'][_0x2c13bf][_0xdf13('0x71')]=!![];if(_['endsWith'](_0x55c6af,_0xdf13('0x72'))){_0x55c6af=_0x55c6af[_0xdf13('0x73')](_0xdf13('0x72'),_0xdf13('0x74'));}this[_0xdf13('0x1b')][_0x2c13bf][_0xdf13('0x75')]=_0x55c6af;var _0xa315e4=_[_0xdf13('0x76')](this[_0xdf13('0x1b')][_0x2c13bf][_0xdf13('0x77')],{'filename':_0x55c6af});if(_['isNil'](_0xa315e4)){this[_0xdf13('0x1b')][_0x2c13bf][_0xdf13('0x77')]['push']({'filename':_0x55c6af,'createdAt':moment()[_0xdf13('0x47')](_0xdf13('0x48')),'mixmonitorid':'','status':_0xdf13('0x78')});}}}catch(_0x4504ed){logger[_0xdf13('0x30')](_0xdf13('0x79'),_0x2c13bf,util[_0xdf13('0x31')](_0x4504ed,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xdf13('0x33')][_0xdf13('0x27')]=function(_0x5aedac){try{if(this['isNotNull'](_0x5aedac)){logger[_0xdf13('0x38')](_0xdf13('0x7a'),_0x5aedac['uniqueid'],util['inspect'](_0x5aedac,{'showHidden':![],'depth':null}));if(this[_0xdf13('0x1b')][_0x5aedac[_0xdf13('0x36')]]&&_0x5aedac['channel']!=_0xdf13('0x53')){if(this[_0xdf13('0x44')](_0x5aedac[_0xdf13('0x7b')])){if(this[_0xdf13('0x44')](_0x5aedac[_0xdf13('0x7b')][_0xdf13('0x7c')])){logger[_0xdf13('0x2f')](_0xdf13('0x7d'),_0x5aedac[_0xdf13('0x36')],_0x5aedac[_0xdf13('0x7e')]);this['syncMixMonitorFilename'](_0x5aedac[_0xdf13('0x36')],_0x5aedac[_0xdf13('0x7e')]);}else if(this[_0xdf13('0x44')](_0x5aedac[_0xdf13('0x7b')][_0xdf13('0x7f')])){logger['info']('[%s][voiceCallReport][varset]\x20variable:xmd-phone\x20value:%s',_0x5aedac[_0xdf13('0x36')],_0x5aedac[_0xdf13('0x7e')]);this[_0xdf13('0x1b')][_0x5aedac[_0xdf13('0x36')]]['calleridnum']=_0x5aedac[_0xdf13('0x7e')];}else if(this['isNotNull'](_0x5aedac[_0xdf13('0x7b')]['xmd-callerid'])){logger[_0xdf13('0x2f')]('[%s][voiceCallReport][varset]\x20variable:xmd-callerid\x20value:%s',_0x5aedac[_0xdf13('0x36')],_0x5aedac[_0xdf13('0x7e')]);this['channels'][_0x5aedac['uniqueid']][_0xdf13('0x80')]=_0x5aedac[_0xdf13('0x7e')];}else if(this[_0xdf13('0x44')](_0x5aedac['variable'][_0xdf13('0x81')])){logger[_0xdf13('0x2f')]('[%s][voiceCallReport][varset]\x20variable:xmd-cdrtype\x20value:%s',_0x5aedac[_0xdf13('0x36')],_0x5aedac['value']);this[_0xdf13('0x1b')][_0x5aedac[_0xdf13('0x36')]][_0xdf13('0x82')]=_0x5aedac[_0xdf13('0x7e')];}else if(this['isNotNull'](_0x5aedac[_0xdf13('0x7b')]['xmd-queue'])){logger[_0xdf13('0x2f')](_0xdf13('0x83'),_0x5aedac['uniqueid'],_0x5aedac[_0xdf13('0x7e')]['split'](',')[0x0]);this[_0xdf13('0x1b')][_0x5aedac[_0xdf13('0x36')]]['queue']=_0x5aedac['value'][_0xdf13('0x3f')](',')[0x0];}else if(this[_0xdf13('0x44')](_0x5aedac[_0xdf13('0x7b')][_0xdf13('0x84')])){logger['info'](_0xdf13('0x85'),_0x5aedac[_0xdf13('0x36')],_0x5aedac[_0xdf13('0x7e')]);this[_0xdf13('0x1b')][_0x5aedac[_0xdf13('0x36')]][_0xdf13('0x86')]=_0x5aedac['value'];}else if(this[_0xdf13('0x44')](_0x5aedac[_0xdf13('0x7b')][_0xdf13('0x87')])){logger['info']('[%s][voiceCallReport][varset]\x20variable:xmd-destination\x20value:%s',_0x5aedac[_0xdf13('0x36')],_0x5aedac[_0xdf13('0x7e')]);this['channels'][_0x5aedac[_0xdf13('0x36')]]['destination']=_0x5aedac['value'];}else if(this['isNotNull'](_0x5aedac[_0xdf13('0x7b')]['xmd-callerid-preview'])){logger[_0xdf13('0x2f')](_0xdf13('0x88'),_0x5aedac[_0xdf13('0x36')],_0x5aedac[_0xdf13('0x7e')]);this[_0xdf13('0x1b')][_0x5aedac[_0xdf13('0x36')]][_0xdf13('0x89')]=_0x5aedac[_0xdf13('0x7e')];}else if(this[_0xdf13('0x44')](_0x5aedac[_0xdf13('0x7b')][_0xdf13('0x8a')])){logger['info'](_0xdf13('0x8b'),_0x5aedac['uniqueid'],_0x5aedac[_0xdf13('0x7e')]);this[_0xdf13('0x1b')][_0x5aedac[_0xdf13('0x36')]]['queue']=_0x5aedac[_0xdf13('0x7e')];}else if(this['isNotNull'](_0x5aedac['variable'][_0xdf13('0x8c')])){logger['info'](_0xdf13('0x8d'),_0x5aedac['uniqueid'],_0x5aedac['value']);this[_0xdf13('0x1b')][_0x5aedac[_0xdf13('0x36')]][_0xdf13('0x8e')]=_0x5aedac[_0xdf13('0x7e')];}}}else if(this[_0xdf13('0x44')](_0x5aedac[_0xdf13('0x7b')][_0xdf13('0x7c')])){if(_0x5aedac[_0xdf13('0x7e')]){var _0x159c90=path[_0xdf13('0x8f')](_0x5aedac[_0xdf13('0x7e')])[_0xdf13('0x41')];logger[_0xdf13('0x2f')](_0xdf13('0x7d'),_0x159c90,_0x5aedac[_0xdf13('0x7e')]);this[_0xdf13('0x90')](_0x159c90,_0x5aedac[_0xdf13('0x7e')]);}}else if(this[_0xdf13('0x1b')][_0x5aedac[_0xdf13('0x52')]]){if(this[_0xdf13('0x44')](_0x5aedac['variable'])){if(this['isNotNull'](_0x5aedac[_0xdf13('0x7b')]['sipcallid'])){logger[_0xdf13('0x2f')](_0xdf13('0x8d'),_0x5aedac[_0xdf13('0x52')],_0x5aedac[_0xdf13('0x7e')]);this[_0xdf13('0x1b')][_0x5aedac['linkedid']]['sipcalllinkedid']=_0x5aedac[_0xdf13('0x7e')];}}}}}catch(_0x566a16){logger[_0xdf13('0x30')](_0xdf13('0x91'),_0x5aedac[_0xdf13('0x36')],util[_0xdf13('0x31')](_0x566a16,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xdf13('0x33')][_0xdf13('0x28')]=function(_0x119405){try{if(this[_0xdf13('0x44')](_0x119405)){logger[_0xdf13('0x38')](_0xdf13('0x92'),_0x119405[_0xdf13('0x36')],util[_0xdf13('0x31')](_0x119405,{'showHidden':![],'depth':null}));if(this[_0xdf13('0x1b')][_0x119405['uniqueid']]){logger[_0xdf13('0x2f')](_0xdf13('0x93'),_0x119405['uniqueid'],_0x119405['cause-txt']);var _0x441040=moment();this[_0xdf13('0x1b')][_0x119405[_0xdf13('0x36')]]['endtime']=_0x441040[_0xdf13('0x47')](_0xdf13('0x48'));this[_0xdf13('0x1b')][_0x119405[_0xdf13('0x36')]][_0xdf13('0x5b')]=_0x441040[_0xdf13('0x6a')](this['channels'][_0x119405['uniqueid']][_0xdf13('0x5a')],'seconds');if(this[_0xdf13('0x1b')][_0x119405[_0xdf13('0x36')]]['answered']){this[_0xdf13('0x1b')][_0x119405[_0xdf13('0x36')]][_0xdf13('0x94')]=_0x441040[_0xdf13('0x6a')](this[_0xdf13('0x1b')][_0x119405[_0xdf13('0x36')]][_0xdf13('0x69')],_0xdf13('0x5d'));this[_0xdf13('0x1b')][_0x119405['uniqueid']]['holdtime']=this[_0xdf13('0x1b')][_0x119405[_0xdf13('0x36')]][_0xdf13('0x5b')]-this[_0xdf13('0x1b')][_0x119405['uniqueid']][_0xdf13('0x94')];}if(_0x119405['context']===_0xdf13('0x4c')){if(this[_0xdf13('0x1c')][_0x119405[_0xdf13('0x3c')]['split']('-')[0x0]]){this[_0xdf13('0x1c')][_0x119405[_0xdf13('0x3c')]['split']('-')[0x0]]=_[_0xdf13('0x95')](this[_0xdf13('0x1c')][_0x119405[_0xdf13('0x3c')][_0xdf13('0x3f')]('-')[0x0]],['destconnectedlinenum']);logger['debug'](_0xdf13('0x96'),_0x119405['uniqueid'],util[_0xdf13('0x31')]({'id':this['agents'][_0x119405[_0xdf13('0x3c')][_0xdf13('0x3f')]('-')[0x0]]['id'],'destaccountcode':this['agents'][_0x119405[_0xdf13('0x3c')][_0xdf13('0x3f')]('-')[0x0]][_0xdf13('0x4f')]},{'showHidden':![],'depth':null}));this[_0xdf13('0x34')](util['format'](_0xdf13('0x40'),this[_0xdf13('0x1c')][_0x119405[_0xdf13('0x3c')][_0xdf13('0x3f')]('-')[0x0]][_0xdf13('0x41')]),_0xdf13('0x97'),{'id':this[_0xdf13('0x1c')][_0x119405[_0xdf13('0x3c')]['split']('-')[0x0]]['id'],'destaccountcode':this[_0xdf13('0x1c')][_0x119405[_0xdf13('0x3c')][_0xdf13('0x3f')]('-')[0x0]][_0xdf13('0x4f')]});}}var _0x870ded=this;Promise[_0xdf13('0x98')]()[_0xdf13('0x99')](function(){var _0x37f685=_0x870ded[_0xdf13('0x1b')][_0x119405[_0xdf13('0x36')]];if(typeof _0x37f685[_0xdf13('0x9a')]===_0xdf13('0x9b'))return;if(_['isEmpty'](_0x37f685[_0xdf13('0x77')]))return;return RpcSetting[_0xdf13('0x9c')]()[_0xdf13('0x99')](function(_0x197826){if(!_0x197826[_0xdf13('0x9d')])return;return Promise[_0xdf13('0x98')]()[_0xdf13('0x99')](function(){return ami[_0xdf13('0x9e')]({'action':_0xdf13('0x9f'),'channel':_0x37f685['channel']})[_0xdf13('0xa0')](function(){});})[_0xdf13('0x99')](function(){return ami['Action']({'action':_0xdf13('0x9f'),'channel':_0x37f685[_0xdf13('0x6c')]})[_0xdf13('0xa0')](function(){})[_0xdf13('0xa1')](function(){var _0x1e2621=_0x870ded[_0xdf13('0x1c')][_0x37f685['destinationchannel']['split']('-')[0x0]];if(!_0x1e2621)return;io[_0xdf13('0x34')](_0xdf13('0xa2'),{'agentId':_0x1e2621['id'],'uniqueid':_0x37f685[_0xdf13('0x36')]});});});});})['then'](function(){if(_0x119405[_0xdf13('0xa3')]==='BlindTransfer'){_0x870ded[_0xdf13('0x1d')][_0x119405[_0xdf13('0x36')]]=_0x870ded[_0xdf13('0x1b')][_0x119405['uniqueid']];}else{if(_0x870ded['channels'][_0x119405[_0xdf13('0x36')]][_0xdf13('0x82')]==='outbound'&&_0x870ded[_0xdf13('0x1d')][_0x119405['uniqueid']]){_0x870ded['channels'][_0x119405['uniqueid']][_0xdf13('0x36')]=[_0x870ded[_0xdf13('0x1b')][_0x119405[_0xdf13('0x36')]]['linkedid'],_0x870ded[_0xdf13('0x1b')][_0x119405[_0xdf13('0x36')]][_0xdf13('0x52')]=_0x870ded[_0xdf13('0x1b')][_0x119405[_0xdf13('0x36')]][_0xdf13('0x36')]][0x0];delete _0x870ded[_0xdf13('0x1d')][_0x119405[_0xdf13('0x36')]];}}logger['debug']('[%s][voiceCallReport][hangup]\x20sending\x20hangup\x20event:',_0x119405[_0xdf13('0x36')],util['inspect'](_0x870ded[_0xdf13('0x1b')][_0x119405['uniqueid']],{'showHidden':![],'depth':null}));ami[_0xdf13('0x34')](_0xdf13('0xa4'),_0x870ded['channels'][_0x119405[_0xdf13('0x36')]]);delete _0x870ded['channels'][_0x119405[_0xdf13('0x36')]];});}}}catch(_0x3d16c2){logger[_0xdf13('0x30')](_0xdf13('0xa5'),_0x119405[_0xdf13('0x36')],util[_0xdf13('0x31')](_0x3d16c2,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0xdf13('0x2b')]=function(_0x50dcee){try{if(this[_0xdf13('0x44')](_0x50dcee)){logger[_0xdf13('0x2f')](_0xdf13('0xa6'),_0x50dcee[_0xdf13('0x36')],_0x50dcee[_0xdf13('0xa7')],_0x50dcee[_0xdf13('0xa8')]);logger['debug']('[%s][voiceCallReport][attendedtransfer]\x20event:',_0x50dcee[_0xdf13('0x36')],util[_0xdf13('0x31')](_0x50dcee,{'showHidden':![],'depth':null}));if(this['channels'][_0x50dcee['transfereeuniqueid']]){this[_0xdf13('0x1b')][_0x50dcee['transfereeuniqueid']][_0xdf13('0xa9')]=_0x50dcee['origtransferercalleridnum'];this[_0xdf13('0x1b')][_0x50dcee[_0xdf13('0xaa')]][_0xdf13('0xab')]=_0x50dcee['transfertargetcalleridnum'];if(this[_0xdf13('0x1b')][_0x50dcee[_0xdf13('0xac')]]){var _0x4b087b=this[_0xdf13('0x1b')][_0x50dcee['secondtransfereruniqueid']];this[_0xdf13('0x1b')][_0x50dcee[_0xdf13('0xac')]]=this['channels'][_0x50dcee['transfereeuniqueid']];this[_0xdf13('0x1b')][_0x50dcee[_0xdf13('0xaa')]]=_0x4b087b;}}else if(this[_0xdf13('0x1b')][_0x50dcee[_0xdf13('0xad')]]){this[_0xdf13('0x1b')][_0x50dcee[_0xdf13('0xad')]]['transfercalleridnum']=_0x50dcee['origtransferercalleridnum'];this[_0xdf13('0x1b')][_0x50dcee[_0xdf13('0xad')]][_0xdf13('0xab')]=_0x50dcee[_0xdf13('0xa8')];if(this[_0xdf13('0x1b')][_0x50dcee[_0xdf13('0xae')]]){var _0x4b087b=this[_0xdf13('0x1b')][_0x50dcee[_0xdf13('0xae')]];this[_0xdf13('0x1b')][_0x50dcee[_0xdf13('0xae')]]=this[_0xdf13('0x1b')][_0x50dcee[_0xdf13('0xad')]];this[_0xdf13('0x1b')][_0x50dcee[_0xdf13('0xad')]]=_0x4b087b;}}if((this['channels'][_0x50dcee['origtransfereruniqueid']]||this[_0xdf13('0x1b')][_0x50dcee[_0xdf13('0xaf')]])&&this[_0xdf13('0x1b')][_0x50dcee[_0xdf13('0xac')]]){var _0x27c48b=_[_0xdf13('0xb0')]([this[_0xdf13('0x1b')][_0x50dcee[_0xdf13('0xae')]],this[_0xdf13('0x1b')][_0x50dcee[_0xdf13('0xaf')]],this[_0xdf13('0x1b')][_0x50dcee['secondtransfereruniqueid']]],function(_0x285e6e){return _0x285e6e&&_0x285e6e['type']===_0xdf13('0xb1')&&_0x285e6e['routeid'];});if(_0x27c48b){if(this[_0xdf13('0x1b')][_0x50dcee[_0xdf13('0xae')]])this['channels'][_0x50dcee['origtransfereruniqueid']]['transferType']=_0xdf13('0xb2');if(this['channels'][_0x50dcee[_0xdf13('0xaf')]])this[_0xdf13('0x1b')][_0x50dcee[_0xdf13('0xaf')]][_0xdf13('0x9a')]=_0xdf13('0xb2');this[_0xdf13('0x1b')][_0x50dcee['secondtransfereruniqueid']][_0xdf13('0x9a')]=_0xdf13('0xb2');}}}}catch(_0x3e503d){logger[_0xdf13('0x30')](_0xdf13('0xb3'),_0x50dcee['uniqueid'],util['inspect'](_0x3e503d,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xdf13('0x33')][_0xdf13('0xb4')]=function(_0x5e993c){try{if(this['isNotNull'](_0x5e993c)){logger[_0xdf13('0x2f')](_0xdf13('0xb5'),_0x5e993c[_0xdf13('0x36')],_0x5e993c['transfereecalleridnum'],_0x5e993c[_0xdf13('0xb6')]);logger[_0xdf13('0x38')](_0xdf13('0xb7'),_0x5e993c['uniqueid'],util[_0xdf13('0x31')](_0x5e993c,{'showHidden':![],'depth':null}));if(this['channels'][_0x5e993c[_0xdf13('0xaa')]]){this[_0xdf13('0x1b')][_0x5e993c['transfereeuniqueid']]['transfercalleridnum']=_0x5e993c[_0xdf13('0xb8')];this[_0xdf13('0x1b')][_0x5e993c[_0xdf13('0xaa')]]['transferconnectedlinenum']=_0x5e993c[_0xdf13('0xb6')];this['channels'][_0x5e993c[_0xdf13('0xaa')]][_0xdf13('0x9a')]=_0xdf13('0xb9');this[_0xdf13('0x28')]({'event':_0xdf13('0xba'),'uniqueid':_0x5e993c['transfereeuniqueid'],'context':_0x5e993c['context'],'channel':_0x5e993c['transfererchannel']});}else{this[_0xdf13('0x1b')][_0x5e993c[_0xdf13('0xbb')]][_0xdf13('0x9a')]=_0xdf13('0xb9');}}}catch(_0x43e6f1){logger[_0xdf13('0x30')]('[%s][voiceCallReport][blindtransfer]',_0x5e993c[_0xdf13('0x36')],util[_0xdf13('0x31')](_0x43e6f1,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xdf13('0x33')][_0xdf13('0x2c')]=function(_0x1dd738){try{if(this['isNotNull'](_0x1dd738)){logger['debug']('[%s][voiceCallReport][musiconholdstart]\x20event:',_0x1dd738[_0xdf13('0x36')],util['inspect'](_0x1dd738,{'showHidden':![],'depth':null}));if(this['channels'][_0x1dd738[_0xdf13('0x36')]]){if(!_['isNil'](this[_0xdf13('0x1b')][_0x1dd738['uniqueid']]['answertime'])){this[_0xdf13('0x1b')][_0x1dd738['uniqueid']][_0xdf13('0xbc')]=moment()[_0xdf13('0x47')](_0xdf13('0x48'));logger[_0xdf13('0x2f')](_0xdf13('0xbd'),_0x1dd738[_0xdf13('0x36')],this['channels'][_0x1dd738[_0xdf13('0x36')]]['mohstarttime']);}}}}catch(_0x22e83a){logger['error'](_0xdf13('0xbe'),_0x1dd738[_0xdf13('0x36')],util[_0xdf13('0x31')](_0x22e83a,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0xdf13('0x2e')]=function(_0x440a6b){try{if(this[_0xdf13('0x44')](_0x440a6b)){logger[_0xdf13('0x38')](_0xdf13('0xbf'),_0x440a6b[_0xdf13('0x36')],util[_0xdf13('0x31')](_0x440a6b,{'showHidden':![],'depth':null}));if(this[_0xdf13('0x1b')][_0x440a6b[_0xdf13('0x36')]]){if(!_[_0xdf13('0xc0')](this['channels'][_0x440a6b[_0xdf13('0x36')]]['mohstarttime'])){this[_0xdf13('0x1b')][_0x440a6b[_0xdf13('0x36')]][_0xdf13('0xc1')]+=moment()[_0xdf13('0xc2')](0x0)['diff'](this[_0xdf13('0x1b')][_0x440a6b[_0xdf13('0x36')]][_0xdf13('0xbc')],_0xdf13('0x5d'));logger[_0xdf13('0x2f')](_0xdf13('0xc3'),_0x440a6b[_0xdf13('0x36')],this[_0xdf13('0x1b')][_0x440a6b[_0xdf13('0x36')]][_0xdf13('0xc1')]);delete this[_0xdf13('0x1b')][_0x440a6b[_0xdf13('0x36')]]['mohstarttime'];}}}}catch(_0x6d36d5){logger[_0xdf13('0x30')](_0xdf13('0xc4'),_0x440a6b[_0xdf13('0x36')],util['inspect'](_0x6d36d5,{'showHidden':![],'depth':null}));}};module[_0xdf13('0xc5')]=VoiceCallReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceDialReport.js b/server/services/ami/report/voiceDialReport.js index ca0eeb5..672902b 100644 --- a/server/services/ami/report/voiceDialReport.js +++ b/server/services/ami/report/voiceDialReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9287=['syncHangup','prototype','isNotNull','isUndefined','emit','debug','[%s][voiceDialReport][dialbegin]\x20event:','uniqueid','inspect','merge','called','channel','substring','lastIndexOf','event','privilege','[%s][voiceDialReport][dialbegin]\x20agent:%s\x20interface:%s\x20lastevent:called','[%s][voiceDialReport][dialbegin]\x20sending\x20voice_outbound_channel:save\x20event:','applications','voice_outbound_channel:save','[%s][voiceDialReport][dialbegin]\x20sending\x20dialbegin\x20event:','custom:dialbegin','error','[%s][voiceDialReport][dialbegin]','[%s][voiceDialReport][dialend]\x20event:','dialstatus','ANSWER','connectedlinenum','connectedlinename','answertime','format','YYYY-MM-DD\x20HH:mm:ss','lastevent','connect','info','[%s][voiceDialReport][dialend]\x20agent:%s\x20lastevent:connect','[%s][voiceDialReport][dialend]\x20sending\x20dialconnect\x20event:','custom:dialconnect','[%s][voiceDialReport][dialend]','[%s][voiceDialReport][varset]\x20event:','addVariable','keys','variable','value','outboundrouteid','variables','[%s][voiceDialReport][varset]\x20outboundrouteid:%s\x20variable:%s\x20value:%s','[%s][voiceDialReport][varset]\x20sending\x20voice_outbound_channel:save\x20event:','voice:outbound','[%s][voiceDialReport][varset]','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepeer','bridgepvtcallid','membercalls','memberpenalty','isNil','[%s][voiceDialReport][hangup]\x20reason:%s\x20lasteevent:complete','cause-txt','endtime','diff','seconds','complete','total','answered','holdtime','billableseconds','sumHoldTime','sumBillable','sumDuration','duration','custom:dialend','[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound:save\x20event:','voice_outbound:save','[DEBUG]\x20Emit\x20voice_outbound_channel:remove\x20event','stringify','[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound_channel:remove\x20event:','linkedid','destuniqueid','[%s][voiceDialReport][hangup]','syncNewExten','[%s][voiceDialReport][newexten]\x20event:','application','toLowerCase','applicationdata','appdata','cdr(','[%s][voiceDialReport][newexten]\x20application:%s\x20appdata:%s','split','match','[%s][voiceDialReport][newexten]','exports','lodash','moment','util','../../../config/environment','../../../config/logger','ami','../ami','redis','defaults','localhost','socket.io-emitter','channels','outbound','dialbegin','syncDialBegin','bind','dialend','syncDialEnd','varset','syncVarSet','newexten','hangup'];(function(_0x5c6994,_0x19ad9a){var _0x1d5c84=function(_0x4a385a){while(--_0x4a385a){_0x5c6994['push'](_0x5c6994['shift']());}};_0x1d5c84(++_0x19ad9a);}(_0x9287,0x1ca));var _0x7928=function(_0x123ff8,_0x2b9a42){_0x123ff8=_0x123ff8-0x0;var _0x2d8b5e=_0x9287[_0x123ff8];return _0x2d8b5e;};'use strict';var _=require(_0x7928('0x0'));var moment=require(_0x7928('0x1'));var util=require(_0x7928('0x2'));var Redis=require('ioredis');var config=require(_0x7928('0x3'));var logger=require(_0x7928('0x4'))(_0x7928('0x5'));var ami=require(_0x7928('0x6'));config[_0x7928('0x7')]=_[_0x7928('0x8')](config['redis'],{'host':_0x7928('0x9'),'port':0x18eb});var io=require(_0x7928('0xa'))(new Redis(config[_0x7928('0x7')]));function VoiceDialReport(_0x56220b){this[_0x7928('0xb')]=_0x56220b['outboundChannels'];this[_0x7928('0xc')]=_0x56220b[_0x7928('0xc')];this['applications']={};this['variables']={};ami['on'](_0x7928('0xd'),this[_0x7928('0xe')][_0x7928('0xf')](this));ami['on'](_0x7928('0x10'),this[_0x7928('0x11')][_0x7928('0xf')](this));ami['on'](_0x7928('0x12'),this[_0x7928('0x13')][_0x7928('0xf')](this));ami['on'](_0x7928('0x14'),this['syncNewExten'][_0x7928('0xf')](this));ami['on'](_0x7928('0x15'),this[_0x7928('0x16')][_0x7928('0xf')](this));}VoiceDialReport[_0x7928('0x17')][_0x7928('0x18')]=function(_0x4404df){return _0x4404df!==null&&!_[_0x7928('0x19')](_0x4404df);};VoiceDialReport[_0x7928('0x17')][_0x7928('0x1a')]=function(_0x36c8f6,_0xa36d54,_0x328bbd){io['to'](_0x36c8f6)['emit'](_0xa36d54,_0x328bbd);};VoiceDialReport[_0x7928('0x17')][_0x7928('0xe')]=function(_0x618206){try{if(this[_0x7928('0x18')](_0x618206)){logger[_0x7928('0x1b')](_0x7928('0x1c'),_0x618206[_0x7928('0x1d')],util[_0x7928('0x1e')](_0x618206,{'showHidden':![],'depth':null}));if(this[_0x7928('0xb')][_0x618206[_0x7928('0x1d')]]){_[_0x7928('0x1f')](this[_0x7928('0xb')][_0x618206[_0x7928('0x1d')]],{'starttime':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'lastevent':_0x7928('0x20'),'interface':_0x618206[_0x7928('0x21')][_0x7928('0x22')](0x0,_0x618206[_0x7928('0x21')]['lastIndexOf']('-')),'membername':_0x618206['channel']['substring'](_0x618206[_0x7928('0x21')][_0x7928('0x23')]('/')+0x1,_0x618206[_0x7928('0x21')]['lastIndexOf']('-'))},_['omit'](_0x618206,[_0x7928('0x24'),_0x7928('0x25')]));logger['info'](_0x7928('0x26'),_0x618206[_0x7928('0x1d')],this['channels'][_0x618206[_0x7928('0x1d')]]['membername'],this[_0x7928('0xb')][_0x618206[_0x7928('0x1d')]]['interface']);logger['debug'](_0x7928('0x27'),_0x618206[_0x7928('0x1d')],util[_0x7928('0x1e')](this[_0x7928('0xb')][_0x618206['uniqueid']],{'showHidden':![],'depth':null}));if(this[_0x7928('0x28')][_0x618206[_0x7928('0x1d')]])_[_0x7928('0x1f')](this[_0x7928('0xb')][_0x618206[_0x7928('0x1d')]],this[_0x7928('0x28')][_0x618206[_0x7928('0x1d')]]);this[_0x7928('0x1a')]('voice:outbound',_0x7928('0x29'),this['channels'][_0x618206[_0x7928('0x1d')]]);logger[_0x7928('0x1b')](_0x7928('0x2a'),_0x618206[_0x7928('0x1d')],util[_0x7928('0x1e')](this[_0x7928('0xb')][_0x618206[_0x7928('0x1d')]],{'showHidden':![],'depth':null}));ami[_0x7928('0x1a')](_0x7928('0x2b'),this[_0x7928('0xb')][_0x618206[_0x7928('0x1d')]]);}}}catch(_0x2f6771){logger[_0x7928('0x2c')](_0x7928('0x2d'),_0x618206['uniqueid'],util[_0x7928('0x1e')](_0x2f6771,{'showHidden':![],'depth':null}));}};VoiceDialReport['prototype'][_0x7928('0x11')]=function(_0x90896c){try{if(this['isNotNull'](_0x90896c)){logger['debug'](_0x7928('0x2e'),_0x90896c[_0x7928('0x1d')],util[_0x7928('0x1e')](_0x90896c,{'showHidden':![],'depth':null}));if(this[_0x7928('0xb')][_0x90896c[_0x7928('0x1d')]]){this[_0x7928('0xb')][_0x90896c[_0x7928('0x1d')]][_0x7928('0x2f')]=_0x90896c[_0x7928('0x2f')];if(_0x90896c[_0x7928('0x2f')]===_0x7928('0x30')){this[_0x7928('0xb')][_0x90896c['uniqueid']][_0x7928('0x31')]=_0x90896c['connectedlinenum'];this[_0x7928('0xb')][_0x90896c[_0x7928('0x1d')]][_0x7928('0x32')]=_0x90896c[_0x7928('0x32')];this[_0x7928('0xb')][_0x90896c[_0x7928('0x1d')]][_0x7928('0x33')]=moment()[_0x7928('0x34')](_0x7928('0x35'));this['channels'][_0x90896c[_0x7928('0x1d')]][_0x7928('0x36')]=_0x7928('0x37');logger[_0x7928('0x38')](_0x7928('0x39'),_0x90896c[_0x7928('0x1d')],_0x90896c[_0x7928('0x21')][_0x7928('0x22')](_0x90896c[_0x7928('0x21')]['lastIndexOf']('/')+0x1,_0x90896c[_0x7928('0x21')][_0x7928('0x23')]('-')));logger[_0x7928('0x1b')](_0x7928('0x3a'),_0x90896c[_0x7928('0x1d')],util[_0x7928('0x1e')](this['channels'][_0x90896c[_0x7928('0x1d')]],{'showHidden':![],'depth':null}));ami['emit'](_0x7928('0x3b'),this['channels'][_0x90896c[_0x7928('0x1d')]]);}logger[_0x7928('0x1b')]('[%s][voiceDialReport][dialend]\x20sending\x20voice_outbound_channel:save\x20event:',_0x90896c[_0x7928('0x1d')],util[_0x7928('0x1e')](this['channels'][_0x90896c['uniqueid']],{'showHidden':![],'depth':null}));this[_0x7928('0x1a')]('voice:outbound',_0x7928('0x29'),this['channels'][_0x90896c[_0x7928('0x1d')]]);}}}catch(_0x5a97fd){logger[_0x7928('0x2c')](_0x7928('0x3c'),_0x90896c[_0x7928('0x1d')],util[_0x7928('0x1e')](_0x5a97fd,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x7928('0x17')][_0x7928('0x13')]=function(_0x5ccab8){try{if(this[_0x7928('0x18')](_0x5ccab8)){logger[_0x7928('0x1b')](_0x7928('0x3d'),_0x5ccab8[_0x7928('0x1d')],util[_0x7928('0x1e')](_0x5ccab8,{'showHidden':![],'depth':null}));this[_0x7928('0x3e')](_0x5ccab8[_0x7928('0x1d')],_[_0x7928('0x3f')](_0x5ccab8[_0x7928('0x40')])[0x0],_0x5ccab8[_0x7928('0x41')]);if(this[_0x7928('0x18')](_0x5ccab8[_0x7928('0x40')])&&this[_0x7928('0x18')](_0x5ccab8[_0x7928('0x40')][_0x7928('0x42')])){if(_[_0x7928('0x19')](this[_0x7928('0xb')][_0x5ccab8[_0x7928('0x1d')]])){this[_0x7928('0xb')][_0x5ccab8['uniqueid']]={'routeId':_0x5ccab8[_0x7928('0x41')],'variables':this[_0x7928('0x43')][_0x5ccab8['uniqueid']],'motionChannel':'voice'};logger['info'](_0x7928('0x44'),_0x5ccab8[_0x7928('0x1d')],_0x5ccab8[_0x7928('0x40')][_0x7928('0x42')],_[_0x7928('0x3f')](_0x5ccab8[_0x7928('0x40')])[0x0],_0x5ccab8[_0x7928('0x41')]);logger['debug'](_0x7928('0x45'),_0x5ccab8[_0x7928('0x1d')],util[_0x7928('0x1e')](this[_0x7928('0xb')][_0x5ccab8[_0x7928('0x1d')]],{'showHidden':![],'depth':null}));this[_0x7928('0x1a')](_0x7928('0x46'),_0x7928('0x29'),this[_0x7928('0xb')][_0x5ccab8['uniqueid']]);}}}}catch(_0x24c9ba){logger[_0x7928('0x2c')](_0x7928('0x47'),_0x5ccab8[_0x7928('0x1d')],util[_0x7928('0x1e')](_0x24c9ba,{'showHidden':![],'depth':null}));}};VoiceDialReport['prototype'][_0x7928('0x3e')]=function(_0x177c38,_0x216cea,_0x4befed){var _0x3820ed=['rtpaudioqos',_0x7928('0x48'),_0x7928('0x49'),_0x7928('0x4a'),_0x7928('0x4b'),'rtpaudioqoslossbridged',_0x7928('0x4c'),_0x7928('0x4d'),_0x7928('0x4e'),_0x7928('0x4f'),_0x7928('0x50'),_0x7928('0x51'),_0x7928('0x52'),'memberdynamic','memberinterface','memberlastcall','membername',_0x7928('0x53'),'memberrealtime'];if(!_[_0x7928('0x54')](_0x216cea)&&!_['includes'](_0x3820ed,_0x216cea)){if(_[_0x7928('0x19')](this[_0x7928('0x43')][_0x177c38])){this[_0x7928('0x43')][_0x177c38]={};}this[_0x7928('0x43')][_0x177c38][_0x216cea]=_0x4befed;}};VoiceDialReport[_0x7928('0x17')][_0x7928('0x16')]=function(_0x39d8fe){try{if(this['isNotNull'](_0x39d8fe)){logger[_0x7928('0x1b')]('[%s][voiceDialReport][hangup]\x20event:',_0x39d8fe[_0x7928('0x1d')],util[_0x7928('0x1e')](_0x39d8fe,{'showHidden':![],'depth':null}));if(this[_0x7928('0xb')][_0x39d8fe[_0x7928('0x1d')]]){logger[_0x7928('0x38')](_0x7928('0x55'),_0x39d8fe[_0x7928('0x1d')],_0x39d8fe[_0x7928('0x56')]);this['channels'][_0x39d8fe[_0x7928('0x1d')]][_0x7928('0x57')]=moment()[_0x7928('0x34')](_0x7928('0x35'));this[_0x7928('0xb')][_0x39d8fe[_0x7928('0x1d')]]['duration']=moment(this[_0x7928('0xb')][_0x39d8fe[_0x7928('0x1d')]][_0x7928('0x57')])[_0x7928('0x58')](this[_0x7928('0xb')][_0x39d8fe[_0x7928('0x1d')]]['starttime'],_0x7928('0x59'));this[_0x7928('0xb')][_0x39d8fe[_0x7928('0x1d')]][_0x7928('0x36')]=_0x7928('0x5a');this[_0x7928('0xc')][_0x7928('0x5b')]+=0x1;if(this[_0x7928('0xb')][_0x39d8fe['uniqueid']][_0x7928('0x33')]){this[_0x7928('0xc')][_0x7928('0x5c')]+=0x1;this['channels'][_0x39d8fe[_0x7928('0x1d')]][_0x7928('0x5d')]=moment(this[_0x7928('0xb')][_0x39d8fe[_0x7928('0x1d')]][_0x7928('0x33')])['diff'](this[_0x7928('0xb')][_0x39d8fe[_0x7928('0x1d')]]['starttime'],'seconds');this[_0x7928('0xb')][_0x39d8fe['uniqueid']][_0x7928('0x5e')]=moment(this[_0x7928('0xb')][_0x39d8fe['uniqueid']][_0x7928('0x57')])[_0x7928('0x58')](this[_0x7928('0xb')][_0x39d8fe[_0x7928('0x1d')]]['answertime'],'seconds');this['outbound'][_0x7928('0x5f')]+=this[_0x7928('0xb')][_0x39d8fe[_0x7928('0x1d')]][_0x7928('0x5d')]||0x0;this[_0x7928('0xc')][_0x7928('0x60')]+=this[_0x7928('0xb')][_0x39d8fe[_0x7928('0x1d')]][_0x7928('0x5e')];}this[_0x7928('0xc')][_0x7928('0x61')]+=this[_0x7928('0xb')][_0x39d8fe[_0x7928('0x1d')]][_0x7928('0x62')];logger['debug']('[%s][voiceDialReport][hangup]\x20sending\x20voiceDialReport\x20event:',_0x39d8fe[_0x7928('0x1d')],util[_0x7928('0x1e')](this[_0x7928('0xb')][_0x39d8fe[_0x7928('0x1d')]],{'showHidden':![],'depth':null}));ami[_0x7928('0x1a')]('custom:voiceDialReport',this[_0x7928('0xb')][_0x39d8fe[_0x7928('0x1d')]]);logger[_0x7928('0x1b')]('[%s][voiceDialReport][hangup]\x20sending\x20dialend\x20event:',_0x39d8fe[_0x7928('0x1d')],util[_0x7928('0x1e')](this[_0x7928('0xb')][_0x39d8fe['uniqueid']],{'showHidden':![],'depth':null}));ami['emit'](_0x7928('0x63'),this[_0x7928('0xb')][_0x39d8fe[_0x7928('0x1d')]]);logger[_0x7928('0x1b')](_0x7928('0x64'),_0x39d8fe['uniqueid'],util[_0x7928('0x1e')](this[_0x7928('0xb')][_0x39d8fe[_0x7928('0x1d')]],{'showHidden':![],'depth':null}));this[_0x7928('0x1a')](_0x7928('0x46'),_0x7928('0x65'),this[_0x7928('0xc')]);logger['info'](_0x7928('0x66'),JSON[_0x7928('0x67')](this[_0x7928('0xb')][_0x39d8fe[_0x7928('0x1d')]]));logger[_0x7928('0x1b')](_0x7928('0x68'),_0x39d8fe[_0x7928('0x1d')],util[_0x7928('0x1e')](this[_0x7928('0xb')][_0x39d8fe[_0x7928('0x1d')]],{'showHidden':![],'depth':null}));this[_0x7928('0x1a')](_0x7928('0x46'),'voice_outbound_channel:remove',this[_0x7928('0xb')][_0x39d8fe[_0x7928('0x1d')]]);delete this[_0x7928('0xb')][_0x39d8fe['uniqueid']];}else if(this[_0x7928('0xb')][_0x39d8fe[_0x7928('0x69')]]){this[_0x7928('0xb')][_0x39d8fe[_0x7928('0x69')]][_0x7928('0x1d')]=this['channels'][_0x39d8fe['linkedid']][_0x7928('0x6a')];}if(this[_0x7928('0x43')][_0x39d8fe['uniqueid']]){delete this['variables'][_0x39d8fe[_0x7928('0x1d')]];}}}catch(_0x5ca055){logger[_0x7928('0x2c')](_0x7928('0x6b'),_0x39d8fe[_0x7928('0x1d')],util[_0x7928('0x1e')](_0x5ca055,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x7928('0x17')][_0x7928('0x6c')]=function(_0x18e535){try{if(this[_0x7928('0x18')](_0x18e535)){logger[_0x7928('0x1b')](_0x7928('0x6d'),_0x18e535[_0x7928('0x1d')],util['inspect'](_0x18e535,{'showHidden':![],'depth':null}));if(_0x18e535[_0x7928('0x6e')][_0x7928('0x6f')]()==='set'){_0x18e535[_0x7928('0x70')]=(_0x18e535[_0x7928('0x71')]||_0x18e535[_0x7928('0x70')])['toLowerCase']();if(_['startsWith'](_0x18e535[_0x7928('0x70')],_0x7928('0x72'))){if(_[_0x7928('0x19')](this['applications'][_0x18e535[_0x7928('0x1d')]]))this['applications'][_0x18e535[_0x7928('0x1d')]]={};logger['info'](_0x7928('0x73'),_0x18e535['uniqueid'],_0x18e535[_0x7928('0x6e')],_0x18e535[_0x7928('0x70')]);var _0x44225d=_0x18e535[_0x7928('0x70')][_0x7928('0x74')]('=');var _0x4ceeb0=_0x44225d[0x0][_0x7928('0x75')](/cdr\((.*)\)/);if(_0x4ceeb0)this[_0x7928('0x28')][_0x18e535[_0x7928('0x1d')]][_0x4ceeb0[0x1]]=_0x44225d[0x1];}}}}catch(_0x871635){logger[_0x7928('0x2c')](_0x7928('0x76'),_0x18e535[_0x7928('0x1d')],util[_0x7928('0x1e')](_0x871635,{'showHidden':![],'depth':null}));}};module[_0x7928('0x77')]=VoiceDialReport; \ No newline at end of file +var _0x719a=['YYYY-MM-DD\x20HH:mm:ss','called','channel','lastIndexOf','substring','omit','event','privilege','[%s][voiceDialReport][dialbegin]\x20agent:%s\x20interface:%s\x20lastevent:called','membername','interface','inspect','voice:outbound','voice_outbound_channel:save','custom:dialbegin','error','[%s][voiceDialReport][dialend]\x20event:','dialstatus','ANSWER','connectedlinenum','connectedlinename','lastevent','connect','info','[%s][voiceDialReport][dialend]\x20agent:%s\x20lastevent:connect','custom:dialconnect','[%s][voiceDialReport][dialend]\x20sending\x20voice_outbound_channel:save\x20event:','[%s][voiceDialReport][dialend]','syncVarSet','addVariable','variable','value','outboundrouteid','variables','voice','[%s][voiceDialReport][varset]\x20outboundrouteid:%s\x20variable:%s\x20value:%s','keys','[%s][voiceDialReport][varset]\x20sending\x20voice_outbound_channel:save\x20event:','[%s][voiceDialReport][varset]','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','sipcallid','sipuri','bridgepeer','memberdynamic','memberinterface','memberlastcall','memberpenalty','memberrealtime','isNil','includes','[%s][voiceDialReport][hangup]\x20reason:%s\x20lasteevent:complete','cause-txt','duration','diff','starttime','seconds','total','answertime','answered','holdtime','sumHoldTime','sumBillable','billableseconds','sumDuration','[%s][voiceDialReport][hangup]\x20sending\x20voiceDialReport\x20event:','custom:voiceDialReport','[%s][voiceDialReport][hangup]\x20sending\x20dialend\x20event:','custom:dialend','[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound:save\x20event:','voice_outbound:save','voice_outbound_channel:remove','linkedid','destuniqueid','[%s][voiceDialReport][hangup]','application','set','applicationdata','appdata','cdr(','[%s][voiceDialReport][newexten]\x20application:%s\x20appdata:%s','split','match','[%s][voiceDialReport][newexten]','exports','lodash','util','ioredis','../../../config/environment','../../../config/logger','ami','../ami','redis','defaults','socket.io-emitter','channels','outboundChannels','outbound','applications','dialbegin','syncDialBegin','bind','dialend','syncDialEnd','newexten','syncNewExten','hangup','syncHangup','prototype','isNotNull','isUndefined','emit','debug','[%s][voiceDialReport][dialbegin]\x20event:','uniqueid','merge','format'];(function(_0x47d4d4,_0x43d64d){var _0x2ddb9d=function(_0x11ca44){while(--_0x11ca44){_0x47d4d4['push'](_0x47d4d4['shift']());}};_0x2ddb9d(++_0x43d64d);}(_0x719a,0x14e));var _0xa719=function(_0x328833,_0x47f0db){_0x328833=_0x328833-0x0;var _0x3b0988=_0x719a[_0x328833];return _0x3b0988;};'use strict';var _=require(_0xa719('0x0'));var moment=require('moment');var util=require(_0xa719('0x1'));var Redis=require(_0xa719('0x2'));var config=require(_0xa719('0x3'));var logger=require(_0xa719('0x4'))(_0xa719('0x5'));var ami=require(_0xa719('0x6'));config[_0xa719('0x7')]=_[_0xa719('0x8')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0xa719('0x9'))(new Redis(config[_0xa719('0x7')]));function VoiceDialReport(_0x2c4b30){this[_0xa719('0xa')]=_0x2c4b30[_0xa719('0xb')];this[_0xa719('0xc')]=_0x2c4b30[_0xa719('0xc')];this[_0xa719('0xd')]={};this['variables']={};ami['on'](_0xa719('0xe'),this[_0xa719('0xf')][_0xa719('0x10')](this));ami['on'](_0xa719('0x11'),this[_0xa719('0x12')][_0xa719('0x10')](this));ami['on']('varset',this['syncVarSet'][_0xa719('0x10')](this));ami['on'](_0xa719('0x13'),this[_0xa719('0x14')]['bind'](this));ami['on'](_0xa719('0x15'),this[_0xa719('0x16')][_0xa719('0x10')](this));}VoiceDialReport[_0xa719('0x17')][_0xa719('0x18')]=function(_0x41c614){return _0x41c614!==null&&!_[_0xa719('0x19')](_0x41c614);};VoiceDialReport[_0xa719('0x17')][_0xa719('0x1a')]=function(_0x52d8dc,_0x34d473,_0x44a98d){io['to'](_0x52d8dc)[_0xa719('0x1a')](_0x34d473,_0x44a98d);};VoiceDialReport[_0xa719('0x17')]['syncDialBegin']=function(_0x1b1eed){try{if(this['isNotNull'](_0x1b1eed)){logger[_0xa719('0x1b')](_0xa719('0x1c'),_0x1b1eed[_0xa719('0x1d')],util['inspect'](_0x1b1eed,{'showHidden':![],'depth':null}));if(this[_0xa719('0xa')][_0x1b1eed['uniqueid']]){_[_0xa719('0x1e')](this[_0xa719('0xa')][_0x1b1eed[_0xa719('0x1d')]],{'starttime':moment()[_0xa719('0x1f')](_0xa719('0x20')),'lastevent':_0xa719('0x21'),'interface':_0x1b1eed[_0xa719('0x22')]['substring'](0x0,_0x1b1eed[_0xa719('0x22')][_0xa719('0x23')]('-')),'membername':_0x1b1eed[_0xa719('0x22')][_0xa719('0x24')](_0x1b1eed['channel'][_0xa719('0x23')]('/')+0x1,_0x1b1eed[_0xa719('0x22')][_0xa719('0x23')]('-'))},_[_0xa719('0x25')](_0x1b1eed,[_0xa719('0x26'),_0xa719('0x27')]));logger['info'](_0xa719('0x28'),_0x1b1eed['uniqueid'],this[_0xa719('0xa')][_0x1b1eed[_0xa719('0x1d')]][_0xa719('0x29')],this['channels'][_0x1b1eed[_0xa719('0x1d')]][_0xa719('0x2a')]);logger[_0xa719('0x1b')]('[%s][voiceDialReport][dialbegin]\x20sending\x20voice_outbound_channel:save\x20event:',_0x1b1eed[_0xa719('0x1d')],util[_0xa719('0x2b')](this[_0xa719('0xa')][_0x1b1eed[_0xa719('0x1d')]],{'showHidden':![],'depth':null}));if(this[_0xa719('0xd')][_0x1b1eed[_0xa719('0x1d')]])_[_0xa719('0x1e')](this[_0xa719('0xa')][_0x1b1eed[_0xa719('0x1d')]],this[_0xa719('0xd')][_0x1b1eed[_0xa719('0x1d')]]);this[_0xa719('0x1a')](_0xa719('0x2c'),_0xa719('0x2d'),this['channels'][_0x1b1eed['uniqueid']]);logger['debug']('[%s][voiceDialReport][dialbegin]\x20sending\x20dialbegin\x20event:',_0x1b1eed[_0xa719('0x1d')],util['inspect'](this[_0xa719('0xa')][_0x1b1eed['uniqueid']],{'showHidden':![],'depth':null}));ami[_0xa719('0x1a')](_0xa719('0x2e'),this[_0xa719('0xa')][_0x1b1eed[_0xa719('0x1d')]]);}}}catch(_0x4cd128){logger[_0xa719('0x2f')]('[%s][voiceDialReport][dialbegin]',_0x1b1eed[_0xa719('0x1d')],util[_0xa719('0x2b')](_0x4cd128,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xa719('0x17')][_0xa719('0x12')]=function(_0x116c3d){try{if(this[_0xa719('0x18')](_0x116c3d)){logger[_0xa719('0x1b')](_0xa719('0x30'),_0x116c3d['uniqueid'],util['inspect'](_0x116c3d,{'showHidden':![],'depth':null}));if(this[_0xa719('0xa')][_0x116c3d[_0xa719('0x1d')]]){this[_0xa719('0xa')][_0x116c3d[_0xa719('0x1d')]][_0xa719('0x31')]=_0x116c3d[_0xa719('0x31')];if(_0x116c3d[_0xa719('0x31')]===_0xa719('0x32')){this[_0xa719('0xa')][_0x116c3d[_0xa719('0x1d')]][_0xa719('0x33')]=_0x116c3d[_0xa719('0x33')];this[_0xa719('0xa')][_0x116c3d[_0xa719('0x1d')]][_0xa719('0x34')]=_0x116c3d[_0xa719('0x34')];this['channels'][_0x116c3d[_0xa719('0x1d')]]['answertime']=moment()[_0xa719('0x1f')](_0xa719('0x20'));this[_0xa719('0xa')][_0x116c3d[_0xa719('0x1d')]][_0xa719('0x35')]=_0xa719('0x36');logger[_0xa719('0x37')](_0xa719('0x38'),_0x116c3d[_0xa719('0x1d')],_0x116c3d[_0xa719('0x22')][_0xa719('0x24')](_0x116c3d[_0xa719('0x22')][_0xa719('0x23')]('/')+0x1,_0x116c3d[_0xa719('0x22')]['lastIndexOf']('-')));logger[_0xa719('0x1b')]('[%s][voiceDialReport][dialend]\x20sending\x20dialconnect\x20event:',_0x116c3d['uniqueid'],util[_0xa719('0x2b')](this['channels'][_0x116c3d[_0xa719('0x1d')]],{'showHidden':![],'depth':null}));ami[_0xa719('0x1a')](_0xa719('0x39'),this[_0xa719('0xa')][_0x116c3d[_0xa719('0x1d')]]);}logger[_0xa719('0x1b')](_0xa719('0x3a'),_0x116c3d['uniqueid'],util[_0xa719('0x2b')](this['channels'][_0x116c3d['uniqueid']],{'showHidden':![],'depth':null}));this[_0xa719('0x1a')]('voice:outbound',_0xa719('0x2d'),this['channels'][_0x116c3d[_0xa719('0x1d')]]);}}}catch(_0xa2da7d){logger['error'](_0xa719('0x3b'),_0x116c3d[_0xa719('0x1d')],util[_0xa719('0x2b')](_0xa2da7d,{'showHidden':![],'depth':null}));}};VoiceDialReport['prototype'][_0xa719('0x3c')]=function(_0x441095){try{if(this[_0xa719('0x18')](_0x441095)){logger[_0xa719('0x1b')]('[%s][voiceDialReport][varset]\x20event:',_0x441095[_0xa719('0x1d')],util[_0xa719('0x2b')](_0x441095,{'showHidden':![],'depth':null}));this[_0xa719('0x3d')](_0x441095[_0xa719('0x1d')],_['keys'](_0x441095[_0xa719('0x3e')])[0x0],_0x441095[_0xa719('0x3f')]);if(this[_0xa719('0x18')](_0x441095[_0xa719('0x3e')])&&this[_0xa719('0x18')](_0x441095[_0xa719('0x3e')][_0xa719('0x40')])){if(_[_0xa719('0x19')](this[_0xa719('0xa')][_0x441095[_0xa719('0x1d')]])){this[_0xa719('0xa')][_0x441095[_0xa719('0x1d')]]={'routeId':_0x441095[_0xa719('0x3f')],'variables':this[_0xa719('0x41')][_0x441095[_0xa719('0x1d')]],'motionChannel':_0xa719('0x42')};logger[_0xa719('0x37')](_0xa719('0x43'),_0x441095[_0xa719('0x1d')],_0x441095['variable'][_0xa719('0x40')],_[_0xa719('0x44')](_0x441095[_0xa719('0x3e')])[0x0],_0x441095[_0xa719('0x3f')]);logger[_0xa719('0x1b')](_0xa719('0x45'),_0x441095[_0xa719('0x1d')],util[_0xa719('0x2b')](this[_0xa719('0xa')][_0x441095['uniqueid']],{'showHidden':![],'depth':null}));this['emit'](_0xa719('0x2c'),'voice_outbound_channel:save',this[_0xa719('0xa')][_0x441095['uniqueid']]);}}}}catch(_0x3731d1){logger['error'](_0xa719('0x46'),_0x441095[_0xa719('0x1d')],util[_0xa719('0x2b')](_0x3731d1,{'showHidden':![],'depth':null}));}};VoiceDialReport['prototype'][_0xa719('0x3d')]=function(_0x1de5e2,_0x47901f,_0x31cd47){var _0x43bd09=[_0xa719('0x47'),_0xa719('0x48'),_0xa719('0x49'),_0xa719('0x4a'),_0xa719('0x4b'),_0xa719('0x4c'),_0xa719('0x4d'),'rtpaudioqosrttbridged',_0xa719('0x4e'),_0xa719('0x4f'),_0xa719('0x50'),'bridgepvtcallid','membercalls',_0xa719('0x51'),_0xa719('0x52'),_0xa719('0x53'),_0xa719('0x29'),_0xa719('0x54'),_0xa719('0x55')];if(!_[_0xa719('0x56')](_0x47901f)&&!_[_0xa719('0x57')](_0x43bd09,_0x47901f)){if(_[_0xa719('0x19')](this[_0xa719('0x41')][_0x1de5e2])){this[_0xa719('0x41')][_0x1de5e2]={};}this['variables'][_0x1de5e2][_0x47901f]=_0x31cd47;}};VoiceDialReport[_0xa719('0x17')][_0xa719('0x16')]=function(_0x5a757e){try{if(this[_0xa719('0x18')](_0x5a757e)){logger['debug']('[%s][voiceDialReport][hangup]\x20event:',_0x5a757e[_0xa719('0x1d')],util[_0xa719('0x2b')](_0x5a757e,{'showHidden':![],'depth':null}));if(this[_0xa719('0xa')][_0x5a757e['uniqueid']]){logger[_0xa719('0x37')](_0xa719('0x58'),_0x5a757e[_0xa719('0x1d')],_0x5a757e[_0xa719('0x59')]);this['channels'][_0x5a757e[_0xa719('0x1d')]]['endtime']=moment()[_0xa719('0x1f')]('YYYY-MM-DD\x20HH:mm:ss');this[_0xa719('0xa')][_0x5a757e[_0xa719('0x1d')]][_0xa719('0x5a')]=moment(this[_0xa719('0xa')][_0x5a757e[_0xa719('0x1d')]]['endtime'])[_0xa719('0x5b')](this['channels'][_0x5a757e[_0xa719('0x1d')]][_0xa719('0x5c')],_0xa719('0x5d'));this[_0xa719('0xa')][_0x5a757e[_0xa719('0x1d')]][_0xa719('0x35')]='complete';this[_0xa719('0xc')][_0xa719('0x5e')]+=0x1;if(this[_0xa719('0xa')][_0x5a757e[_0xa719('0x1d')]][_0xa719('0x5f')]){this[_0xa719('0xc')][_0xa719('0x60')]+=0x1;this[_0xa719('0xa')][_0x5a757e['uniqueid']][_0xa719('0x61')]=moment(this[_0xa719('0xa')][_0x5a757e['uniqueid']][_0xa719('0x5f')])[_0xa719('0x5b')](this['channels'][_0x5a757e[_0xa719('0x1d')]]['starttime'],'seconds');this[_0xa719('0xa')][_0x5a757e['uniqueid']]['billableseconds']=moment(this['channels'][_0x5a757e[_0xa719('0x1d')]]['endtime'])['diff'](this['channels'][_0x5a757e[_0xa719('0x1d')]][_0xa719('0x5f')],_0xa719('0x5d'));this[_0xa719('0xc')][_0xa719('0x62')]+=this['channels'][_0x5a757e['uniqueid']]['holdtime']||0x0;this[_0xa719('0xc')][_0xa719('0x63')]+=this['channels'][_0x5a757e[_0xa719('0x1d')]][_0xa719('0x64')];}this[_0xa719('0xc')][_0xa719('0x65')]+=this['channels'][_0x5a757e['uniqueid']][_0xa719('0x5a')];logger['debug'](_0xa719('0x66'),_0x5a757e[_0xa719('0x1d')],util['inspect'](this[_0xa719('0xa')][_0x5a757e[_0xa719('0x1d')]],{'showHidden':![],'depth':null}));ami[_0xa719('0x1a')](_0xa719('0x67'),this[_0xa719('0xa')][_0x5a757e[_0xa719('0x1d')]]);logger[_0xa719('0x1b')](_0xa719('0x68'),_0x5a757e[_0xa719('0x1d')],util['inspect'](this['channels'][_0x5a757e[_0xa719('0x1d')]],{'showHidden':![],'depth':null}));ami['emit'](_0xa719('0x69'),this['channels'][_0x5a757e[_0xa719('0x1d')]]);logger[_0xa719('0x1b')](_0xa719('0x6a'),_0x5a757e[_0xa719('0x1d')],util[_0xa719('0x2b')](this[_0xa719('0xa')][_0x5a757e[_0xa719('0x1d')]],{'showHidden':![],'depth':null}));this[_0xa719('0x1a')](_0xa719('0x2c'),_0xa719('0x6b'),this[_0xa719('0xc')]);logger[_0xa719('0x37')]('[DEBUG]\x20Emit\x20voice_outbound_channel:remove\x20event',JSON['stringify'](this['channels'][_0x5a757e[_0xa719('0x1d')]]));logger['debug']('[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound_channel:remove\x20event:',_0x5a757e[_0xa719('0x1d')],util[_0xa719('0x2b')](this[_0xa719('0xa')][_0x5a757e[_0xa719('0x1d')]],{'showHidden':![],'depth':null}));this[_0xa719('0x1a')](_0xa719('0x2c'),_0xa719('0x6c'),this[_0xa719('0xa')][_0x5a757e[_0xa719('0x1d')]]);delete this[_0xa719('0xa')][_0x5a757e['uniqueid']];}else if(this[_0xa719('0xa')][_0x5a757e[_0xa719('0x6d')]]){this[_0xa719('0xa')][_0x5a757e[_0xa719('0x6d')]][_0xa719('0x1d')]=this[_0xa719('0xa')][_0x5a757e[_0xa719('0x6d')]][_0xa719('0x6e')];}if(this['variables'][_0x5a757e[_0xa719('0x1d')]]){delete this[_0xa719('0x41')][_0x5a757e[_0xa719('0x1d')]];}}}catch(_0x28829d){logger['error'](_0xa719('0x6f'),_0x5a757e[_0xa719('0x1d')],util[_0xa719('0x2b')](_0x28829d,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xa719('0x17')][_0xa719('0x14')]=function(_0x556e96){try{if(this['isNotNull'](_0x556e96)){logger[_0xa719('0x1b')]('[%s][voiceDialReport][newexten]\x20event:',_0x556e96[_0xa719('0x1d')],util['inspect'](_0x556e96,{'showHidden':![],'depth':null}));if(_0x556e96[_0xa719('0x70')]['toLowerCase']()===_0xa719('0x71')){_0x556e96[_0xa719('0x72')]=(_0x556e96[_0xa719('0x73')]||_0x556e96['applicationdata'])['toLowerCase']();if(_['startsWith'](_0x556e96[_0xa719('0x72')],_0xa719('0x74'))){if(_[_0xa719('0x19')](this['applications'][_0x556e96[_0xa719('0x1d')]]))this['applications'][_0x556e96[_0xa719('0x1d')]]={};logger['info'](_0xa719('0x75'),_0x556e96[_0xa719('0x1d')],_0x556e96['application'],_0x556e96[_0xa719('0x72')]);var _0x1c4276=_0x556e96[_0xa719('0x72')][_0xa719('0x76')]('=');var _0x4f6e94=_0x1c4276[0x0][_0xa719('0x77')](/cdr\((.*)\)/);if(_0x4f6e94)this[_0xa719('0xd')][_0x556e96[_0xa719('0x1d')]][_0x4f6e94[0x1]]=_0x1c4276[0x1];}}}}catch(_0x9e93be){logger[_0xa719('0x2f')](_0xa719('0x78'),_0x556e96[_0xa719('0x1d')],util[_0xa719('0x2b')](_0x9e93be,{'showHidden':![],'depth':null}));}};module[_0xa719('0x79')]=VoiceDialReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceQueueReport.js b/server/services/ami/report/voiceQueueReport.js index 208119e..b320abc 100644 --- a/server/services/ami/report/voiceQueueReport.js +++ b/server/services/ami/report/voiceQueueReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5127=['status','channel','message','error','inspect','[%s][voiceQueueReport][checkQueueReport]','[%s][voiceQueueReport][checkVariables]','syncFullyBooted','[FullyBooted]\x20clear\x20realtime','clearQueueReport','emitVoiceQueueChannelRemove','emit','debug','[%s][voiceQueueReport][',']\x20sending\x20voice_queue_channel:save\x20event:','uniqueid','format','name','voice_queue_channel:save','voice_queue_presence:save','voice:queue:%s','voice_queue_presence:remove','emitVoiceQueueSummary','type','inbound','answered','loggedIn','sumDuration','unmanaged','Trunk','active','Interval','stringify','[voiceQueueReport][',']\x20sending\x20voice_queue:save\x20event:','voice_queue:save','isNotNull','isUndefined','clearZombieChannels','queues','catch','[voiceQueueReport][queues]','then','syncQueueSummary','queue','info','[voiceQueueReport][queuesummary]\x20name:%s','callers','toNumber','loggedin','available','talking','[voiceQueueReport][queuesummary]\x20sending\x20queuesummary\x20event:','custom:queuesummary','[voiceQueueReport][queuesummary]','[voiceQueueReport][queuesummarycomplete]\x20event:','[%s][voiceQueueReport][queuecallerjoin]','queuecallerjoinAt','YYYY-MM-DD\x20HH:mm:ss','position','count','routealias','[voiceQueueReport][queuecallerjoin]\x20name:%s\x20type:%s','merge','pick','keys','push','syncQueueCallerAbandon','queuecallercomplete','holdtime','queuecallerabandonAt','ABANDONED','lastAssignedTo','queuecallerabandon','[%s][voiceQueueReport][queuecallerabandon]','[%s][voiceQueueReport][queuecallerleave]','last','queuecallerleaveAt','connectedlinenum','connectedlinename','[voiceQueueReport][queuecallerleave]\x20name:%s\x20type:%s\x20connectedlinenum:%s\x20connectedlinename:%s','[%s][voiceQueueReport][agentconnect]','COMPLETEDBYAGENT','[%s][voiceQueueReport][agentcomplete]','assigned','membername','queuecallerexit','queuecallerexitAt','reason','transfer','startsWith','toLowerCase','local/','linkedid','add','seconds','FORWARDTRANSFER','transfertype','destexten','transferuniqueid','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:FORWARDTRANSFER','queuecallerexitreason','toUpperCase','agentcomplete','[%s][voiceQueueReport][varset]','addVariable','variable','value','queuestatus','CONTINUE','TIMEOUT','lastevent','queueposition','[%s][voiceQueueReport][varset]\x20name:%s\x20type:%s\x20variable:%s\x20value:%s','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepeer','bridgepvtcallid','membercalls','memberdynamic','memberpenalty','includes','abandoned','sumHoldTime','diff','length','sumBillable','milliseconds','queuecallercompleteAt','[%s][voiceQueueReport][hangup]\x20sending\x20queuecallerunmanaged\x20event:','[%s][voiceQueueReport][hangup]\x20sending\x20queuecallerabandon\x20event:','custom:queuecallerabandon','[%s][voiceQueueReport][hangup]\x20name:%s\x20type:%s\x20reason:%s','cause-txt','custom:voiceQueueReport','transfereeuniqueid','transferexten','secondtransfereruniqueid','ATTENDED','switch','[%s][voiceQueueReport][attendedTransfer]\x20name:%s\x20type:%s\x20transferexten:%s\x20transferuniqueid:%s','transfertargetuniqueid','origtransfererexten','origtransfereruniqueid','[%s][voiceQueueReport][attendedtransfer]','BLINDTRANSFER','BLIND','context','transfererchannel','[%s][voiceQueueReport][blindtransfer]','[%s][voiceQueueReport][musiconholdstart]','mohstarttime','[%s][voiceQueueReport][musiconholdstart]\x20mohstarttime:%s','mohtime','[%s][voiceQueueReport][musiconholdstop]\x20mohtime:%s','[%s][voiceQueueReport][musiconholdstop]','syncNewExten','[%s][voiceQueueReport][newexten]\x20event:','application','applicationdata','appdata','CDR(routeAlias)','[%s][voiceQueueReport][newexten]\x20application:%s\x20appdata:%s','match','[%s][voiceQueueReport][newexten]','exports','lodash','moment','util','md5','../../../config/logger','../ami','../model/queueReport','redis','defaults','localhost','prototype','tail','finally','sequence','queueReports','agents','channels','queueChannels','voiceQueues','flagQueueSummary','campaigns','variables','queuesummary','bind','syncQueueSummaryComplete','queuecallerjoin','syncQueueCallerJoin','queuecallerleave','syncQueueCallerLeave','syncAgentComplete','agentconnect','syncAgentConnect','varset','syncVarSet','hangup','syncHangup','fullybooted','newexten','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','loopQueueSummary','loopQueueShow','isEmpty','originated','pTalking','waiting','queueStatusComplete','hasOwnProperty','unlockRR','isNil','Action'];(function(_0x13bf21,_0x2ab2eb){var _0x3e3481=function(_0x52c6ca){while(--_0x52c6ca){_0x13bf21['push'](_0x13bf21['shift']());}};_0x3e3481(++_0x2ab2eb);}(_0x5127,0x18f));var _0x7512=function(_0x329664,_0x130748){_0x329664=_0x329664-0x0;var _0x4e346e=_0x5127[_0x329664];return _0x4e346e;};'use strict';var _=require(_0x7512('0x0'));var moment=require(_0x7512('0x1'));var util=require(_0x7512('0x2'));var md5=require(_0x7512('0x3'));var Redis=require('ioredis');var config=require('../../../config/environment');var logger=require(_0x7512('0x4'))('ami');var ami=require(_0x7512('0x5'));var QueueReport=require(_0x7512('0x6'));config[_0x7512('0x7')]=_[_0x7512('0x8')](config[_0x7512('0x7')],{'host':_0x7512('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));var Sequence=function(){};Sequence[_0x7512('0xa')]['enqueue']=function(_0x43ce62){this['tail']=this[_0x7512('0xb')]?this[_0x7512('0xb')][_0x7512('0xc')](_0x43ce62):_0x43ce62();};function VoiceQueueReport(_0x3db733){this[_0x7512('0xd')]=new Sequence();this[_0x7512('0xe')]={};this[_0x7512('0xf')]=_0x3db733[_0x7512('0xf')];this[_0x7512('0x10')]=_0x3db733[_0x7512('0x11')];this[_0x7512('0x12')]=_0x3db733[_0x7512('0x12')];this[_0x7512('0x13')]=!![];this[_0x7512('0x14')]=_0x3db733[_0x7512('0x14')];this[_0x7512('0x15')]={};ami['on'](_0x7512('0x16'),this['syncQueueSummary'][_0x7512('0x17')](this));ami['on']('queuesummarycomplete',this[_0x7512('0x18')][_0x7512('0x17')](this));ami['on'](_0x7512('0x19'),this[_0x7512('0x1a')][_0x7512('0x17')](this));ami['on']('queuecallerabandon',this['syncQueueCallerAbandon'][_0x7512('0x17')](this));ami['on'](_0x7512('0x1b'),this[_0x7512('0x1c')][_0x7512('0x17')](this));ami['on']('agentcomplete',this[_0x7512('0x1d')]['bind'](this));ami['on'](_0x7512('0x1e'),this[_0x7512('0x1f')][_0x7512('0x17')](this));ami['on'](_0x7512('0x20'),this[_0x7512('0x21')][_0x7512('0x17')](this));ami['on'](_0x7512('0x22'),this[_0x7512('0x23')][_0x7512('0x17')](this));ami['on'](_0x7512('0x24'),this['syncFullyBooted'][_0x7512('0x17')](this));ami['on'](_0x7512('0x25'),this['syncNewExten'][_0x7512('0x17')](this));ami['on'](_0x7512('0x26'),this[_0x7512('0x27')][_0x7512('0x17')](this));ami['on'](_0x7512('0x28'),this[_0x7512('0x29')]['bind'](this));ami['on'](_0x7512('0x2a'),this[_0x7512('0x2b')][_0x7512('0x17')](this));ami['on'](_0x7512('0x2c'),this[_0x7512('0x2d')]['bind'](this));this[_0x7512('0x2e')]();this[_0x7512('0x2f')]();}function clearChannels(_0x570f8e){if(!_[_0x7512('0x30')](_0x570f8e)){for(var _0x5e0cfd in _0x570f8e){if(_0x570f8e['hasOwnProperty'](_0x5e0cfd)){delete _0x570f8e[_0x5e0cfd];}}}}function clearCampaigns(_0x416a25){if(!_[_0x7512('0x30')](_0x416a25)){for(var _0x1a5985 in _0x416a25){if(_0x416a25['hasOwnProperty'](_0x1a5985)){_0x416a25[_0x1a5985]['originated']=0x0;}}}}function clearVoiceQueues(_0x5c8fdf){if(!_[_0x7512('0x30')](_0x5c8fdf)){for(var _0x551a1a in _0x5c8fdf){if(_0x5c8fdf['hasOwnProperty'](_0x551a1a)){_0x5c8fdf[_0x551a1a][_0x7512('0x31')]=0x0;_0x5c8fdf[_0x551a1a]['talking']=0x0;_0x5c8fdf[_0x551a1a][_0x7512('0x32')]=0x0;_0x5c8fdf[_0x551a1a][_0x7512('0x33')]=0x0;_0x5c8fdf[_0x551a1a][_0x7512('0x34')]=!![];}}}}function clearAgentBooked(_0x4c676c){if(!_['isEmpty'](_0x4c676c)){for(var _0x2621ff in _0x4c676c){if(_0x4c676c[_0x7512('0x35')](_0x2621ff)){_0x4c676c[_0x2621ff][_0x7512('0x36')]=!![];}}}}VoiceQueueReport[_0x7512('0xa')]['clearZombieChannels']=function(){var _0x569509=this;for(var _0x4e6690 in this['channels']){if(this[_0x7512('0x10')][_0x7512('0x35')](_0x4e6690)&&!this['channels'][_0x4e6690]['switch']){this[_0x7512('0xd')]['enqueue'](function(){if(!_[_0x7512('0x37')](_0x569509[_0x7512('0x10')][_0x4e6690])){return ami[_0x7512('0x38')]({'action':_0x7512('0x39'),'channel':_0x569509['channels'][_0x4e6690][_0x7512('0x3a')]})['catch'](function(_0x218606){if(_0x218606[_0x7512('0x3b')]==='No\x20such\x20channel'){setTimeout(function(){if(_0x569509['channels'][_0x4e6690]){delete _0x569509[_0x7512('0x10')][_0x4e6690];logger[_0x7512('0x3c')]('[%s][voiceQueueReport][checkChannel]',_0x4e6690,util[_0x7512('0x3d')](_0x218606,{'showHidden':![],'depth':null}));}if(_0x569509[_0x7512('0xe')][_0x4e6690]){delete _0x569509[_0x7512('0xe')][_0x4e6690];logger[_0x7512('0x3c')](_0x7512('0x3e'),_0x4e6690,util[_0x7512('0x3d')](_0x218606,{'showHidden':![],'depth':null}));}if(_0x569509['variables'][_0x4e6690]){delete _0x569509[_0x7512('0x15')][_0x4e6690];logger[_0x7512('0x3c')](_0x7512('0x3f'),_0x4e6690,util['inspect'](_0x218606,{'showHidden':![],'depth':null}));}},0x1f40);}});}});}}};VoiceQueueReport[_0x7512('0xa')][_0x7512('0x40')]=function(){logger['error'](_0x7512('0x41'));clearChannels(this[_0x7512('0x10')]);this['clearQueueReport'](this[_0x7512('0xe')]);clearAgentBooked(this['agents']);clearVoiceQueues(this[_0x7512('0x12')]);clearCampaigns(this[_0x7512('0x14')]);};VoiceQueueReport['prototype'][_0x7512('0x42')]=function(_0x58eb4f){var _0x3e212b=this;if(!_['isEmpty'](_0x58eb4f)){for(var _0x1d600e in _0x58eb4f){if(_0x58eb4f[_0x7512('0x35')](_0x1d600e)){_0x3e212b[_0x7512('0x43')](_0x58eb4f[_0x1d600e],'clearqueuereport');delete _0x58eb4f[_0x1d600e];}}}};VoiceQueueReport[_0x7512('0xa')][_0x7512('0x44')]=function(_0x260e39,_0x2f6d46,_0x58b9fc){io['to'](_0x260e39)[_0x7512('0x44')](_0x2f6d46,_0x58b9fc);};VoiceQueueReport[_0x7512('0xa')]['emitVoiceQueueChannelSave']=function(_0x5c140c,_0xd53c66){logger[_0x7512('0x45')](_0x7512('0x46')+_0xd53c66+_0x7512('0x47'),_0x5c140c[_0x7512('0x48')],util[_0x7512('0x3d')](_0x5c140c,{'showHidden':![],'depth':null}));this[_0x7512('0x44')](util[_0x7512('0x49')]('voice:queue:%s',_0x5c140c[_0x7512('0x4a')]),_0x7512('0x4b'),_0x5c140c);io[_0x7512('0x44')](_0x7512('0x4c'),_0x5c140c);};VoiceQueueReport[_0x7512('0xa')][_0x7512('0x43')]=function(_0x53a671,_0x2fe006){logger['debug'](_0x7512('0x46')+_0x2fe006+']\x20sending\x20voice_queue_channel:remove\x20event:',_0x53a671[_0x7512('0x48')],util['inspect'](_0x53a671,{'showHidden':![],'depth':null}));this[_0x7512('0x44')](util[_0x7512('0x49')](_0x7512('0x4d'),_0x53a671[_0x7512('0x4a')]),'voice_queue_channel:remove',_0x53a671);io['emit'](_0x7512('0x4e'),_0x53a671);};VoiceQueueReport[_0x7512('0xa')][_0x7512('0x4f')]=function(_0x30db6d,_0x163d2f){if(_0x30db6d[_0x7512('0x50')]===_0x7512('0x51')){var _0x5320b2={'id':_0x30db6d['id'],'name':_0x30db6d['name'],'strategy':_0x30db6d['strategy'],'answered':_0x30db6d[_0x7512('0x52')],'available':_0x30db6d['available'],'loggedIn':_0x30db6d[_0x7512('0x53')],'pTalking':_0x30db6d[_0x7512('0x32')],'sumBillable':_0x30db6d['sumBillable'],'sumDuration':_0x30db6d[_0x7512('0x54')],'sumHoldTime':_0x30db6d['sumHoldTime']||0x0,'talking':_0x30db6d['talking'],'total':_0x30db6d['total'],'type':_0x30db6d[_0x7512('0x50')],'unmanaged':_0x30db6d[_0x7512('0x55')],'abandoned':_0x30db6d['abandoned'],'waiting':_0x30db6d[_0x7512('0x33')]};if(_0x30db6d[_0x7512('0x56')]){_0x5320b2[_0x7512('0x56')]={'id':_0x30db6d['Trunk']['id'],'name':_0x30db6d['Trunk']['name'],'active':_0x30db6d[_0x7512('0x56')][_0x7512('0x57')],'callerid':_0x30db6d['Trunk']['callerid']};}if(_0x30db6d[_0x7512('0x58')]){_0x5320b2['Interval']={'id':_0x30db6d[_0x7512('0x58')]['id'],'name':_0x30db6d[_0x7512('0x58')]['name']};}var _0x57fd02=md5(JSON[_0x7512('0x59')](_0x5320b2));if(_0x30db6d[_0x7512('0x3')]!==_0x57fd02){_0x30db6d[_0x7512('0x3')]=_0x57fd02;logger[_0x7512('0x45')](_0x7512('0x5a')+_0x163d2f+_0x7512('0x5b'),util[_0x7512('0x3d')](_0x5320b2,{'showHidden':![],'depth':null}));this[_0x7512('0x44')](util[_0x7512('0x49')](_0x7512('0x4d'),_0x5320b2[_0x7512('0x4a')]),_0x7512('0x5c'),_0x5320b2);}}};VoiceQueueReport['prototype'][_0x7512('0x5d')]=function(_0x5d5ea2){return _0x5d5ea2!==null&&!_[_0x7512('0x5e')](_0x5d5ea2);};VoiceQueueReport[_0x7512('0xa')]['loopQueueShow']=function(){var _0x41d362=this;setInterval(function(){_0x41d362[_0x7512('0x5f')]();ami['Action']({'action':_0x7512('0x60')})[_0x7512('0x61')](function(_0xc8c1e8){logger[_0x7512('0x3c')](_0x7512('0x62'),util['inspect'](_0xc8c1e8,{'showHidden':![],'depth':null}));});},0x2710);};VoiceQueueReport[_0x7512('0xa')][_0x7512('0x2e')]=function(){var _0x42bda7=this;setInterval(function(){if(_0x42bda7[_0x7512('0x13')]){return ami[_0x7512('0x38')]({'action':_0x7512('0x16')})[_0x7512('0x63')](function(_0x1dc014){_0x42bda7[_0x7512('0x13')]=![];})[_0x7512('0x61')](function(_0x42380d){logger[_0x7512('0x3c')]('[voiceQueueReport][queuesummary]',util['inspect'](_0x42380d,{'showHidden':![],'depth':null}));});}},0x3e8);};VoiceQueueReport[_0x7512('0xa')][_0x7512('0x64')]=function(_0x46dc47){try{if(this[_0x7512('0x5d')](_0x46dc47)&&this[_0x7512('0x5d')](_0x46dc47['queue'])){logger[_0x7512('0x45')]('[voiceQueueReport][queuesummary]\x20event:',util['inspect'](_0x46dc47,{'showHidden':![],'depth':null}));if(this['voiceQueues'][_0x46dc47[_0x7512('0x65')]]){logger[_0x7512('0x66')](_0x7512('0x67'),_0x46dc47[_0x7512('0x65')]);var _0x3f219a=_['countBy'](this['channels'],_0x7512('0x65'))[_0x46dc47['queue']]||0x0;var _0xd61cfc=_0x3f219a-_0x46dc47[_0x7512('0x68')];if(this['voiceQueues'][_0x46dc47[_0x7512('0x65')]][_0x7512('0x33')]!==_[_0x7512('0x69')](_0x46dc47[_0x7512('0x68')])||this[_0x7512('0x12')][_0x46dc47[_0x7512('0x65')]][_0x7512('0x53')]!==_[_0x7512('0x69')](_0x46dc47[_0x7512('0x6a')])||this[_0x7512('0x12')][_0x46dc47[_0x7512('0x65')]][_0x7512('0x6b')]!==_['toNumber'](_0x46dc47[_0x7512('0x6b')])||this[_0x7512('0x12')][_0x46dc47[_0x7512('0x65')]][_0x7512('0x6c')]!==_0xd61cfc){this[_0x7512('0x12')][_0x46dc47[_0x7512('0x65')]][_0x7512('0x33')]=_['toNumber'](_0x46dc47[_0x7512('0x68')]);this[_0x7512('0x12')][_0x46dc47[_0x7512('0x65')]][_0x7512('0x53')]=_[_0x7512('0x69')](_0x46dc47['loggedin']);this[_0x7512('0x12')][_0x46dc47[_0x7512('0x65')]][_0x7512('0x6b')]=_['toNumber'](_0x46dc47[_0x7512('0x6b')]);this[_0x7512('0x12')][_0x46dc47[_0x7512('0x65')]][_0x7512('0x6c')]=_0xd61cfc>0x0?_0xd61cfc:0x0;this[_0x7512('0x12')][_0x46dc47[_0x7512('0x65')]]['talking']=this[_0x7512('0x12')][_0x46dc47[_0x7512('0x65')]]['talking']>_['toNumber'](_0x46dc47['loggedin'])?_[_0x7512('0x69')](_0x46dc47[_0x7512('0x6a')]):this['voiceQueues'][_0x46dc47[_0x7512('0x65')]][_0x7512('0x6c')];this[_0x7512('0x4f')](this[_0x7512('0x12')][_0x46dc47[_0x7512('0x65')]],_0x7512('0x16'));}logger['debug'](_0x7512('0x6d'),util['inspect'](this[_0x7512('0x12')][_0x46dc47['queue']],{'showHidden':![],'depth':null}));ami[_0x7512('0x44')](_0x7512('0x6e'),this[_0x7512('0x12')][_0x46dc47[_0x7512('0x65')]]);}}}catch(_0x5e9d19){logger[_0x7512('0x3c')](_0x7512('0x6f'),util[_0x7512('0x3d')](_0x5e9d19,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x7512('0xa')][_0x7512('0x18')]=function(_0x34fc55){logger[_0x7512('0x45')](_0x7512('0x70'),util[_0x7512('0x3d')](_0x34fc55,{'showHidden':![],'depth':null}));this[_0x7512('0x13')]=!![];};VoiceQueueReport[_0x7512('0xa')]['syncQueueCallerJoin']=function(_0x5b901b){try{if(this[_0x7512('0x5d')](_0x5b901b)){logger['debug'](_0x7512('0x71'),_0x5b901b['uniqueid'],util[_0x7512('0x3d')](_0x5b901b,{'showHidden':![],'depth':null}));if(_['isUndefined'](this['queueReports'][_0x5b901b[_0x7512('0x48')]]))this['queueReports'][_0x5b901b[_0x7512('0x48')]]=[];if(_[_0x7512('0x5e')](this[_0x7512('0x10')][_0x5b901b[_0x7512('0x48')]]))this[_0x7512('0x10')][_0x5b901b[_0x7512('0x48')]]={};var _0x3a2a68=new QueueReport();_0x3a2a68[_0x7512('0x4a')]=_0x5b901b[_0x7512('0x65')];_0x3a2a68[_0x7512('0x50')]=this['voiceQueues'][_0x3a2a68[_0x7512('0x4a')]]&&this[_0x7512('0x12')][_0x3a2a68[_0x7512('0x4a')]][_0x7512('0x50')]?this[_0x7512('0x12')][_0x3a2a68['name']][_0x7512('0x50')]||_0x7512('0x51'):'inbound';_0x3a2a68[_0x7512('0x65')]=_0x5b901b[_0x7512('0x65')];_0x3a2a68[_0x7512('0x72')]=moment()[_0x7512('0x49')](_0x7512('0x73'));_0x3a2a68[_0x7512('0x74')]=_0x5b901b[_0x7512('0x74')];_0x3a2a68[_0x7512('0x75')]=_0x5b901b['count'];_0x3a2a68[_0x7512('0x48')]=_0x5b901b[_0x7512('0x48')];_0x3a2a68[_0x7512('0x76')]=this[_0x7512('0x10')][_0x5b901b[_0x7512('0x48')]][_0x7512('0x76')];logger['info'](_0x7512('0x77'),_0x3a2a68[_0x7512('0x4a')],_0x3a2a68[_0x7512('0x50')]);_[_0x7512('0x78')](_0x3a2a68,_[_0x7512('0x79')](_0x5b901b,_[_0x7512('0x7a')](_0x3a2a68)));this[_0x7512('0xe')][_0x5b901b[_0x7512('0x48')]][_0x7512('0x7b')](_0x3a2a68);this[_0x7512('0x10')][_0x5b901b[_0x7512('0x48')]]=_0x3a2a68;this['emitVoiceQueueChannelSave'](_0x3a2a68,_0x7512('0x19'));}}catch(_0x31317d){logger['error'](_0x7512('0x71'),_0x5b901b['uniqueid'],util[_0x7512('0x3d')](_0x31317d,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x7512('0x7c')]=function(_0x8bfa15){try{if(this[_0x7512('0x5d')](_0x8bfa15)){logger[_0x7512('0x45')]('[%s][voiceQueueReport][queuecallerabandon]',_0x8bfa15[_0x7512('0x48')],util['inspect'](_0x8bfa15,{'showHidden':![],'depth':null}));if(this[_0x7512('0xe')][_0x8bfa15[_0x7512('0x48')]]){var _0x193aa2=_['last'](this[_0x7512('0xe')][_0x8bfa15[_0x7512('0x48')]]);_0x193aa2[_0x7512('0x7d')]=![];_0x193aa2['queuecallercompleteAt']=null;_0x193aa2[_0x7512('0x7e')]=_0x8bfa15['holdtime'];_0x193aa2['originalposition']=_0x8bfa15['originalposition'];_0x193aa2['queuecallerabandon']=!![];_0x193aa2[_0x7512('0x7f')]=moment()[_0x7512('0x49')](_0x7512('0x73'));_0x193aa2['queuecallerexitreason']=_0x7512('0x80');_0x193aa2[_0x7512('0x81')]=null;logger[_0x7512('0x66')]('[voiceQueueReport][queuecallerabandon]\x20name:%s\x20type:%s',_0x193aa2[_0x7512('0x4a')],_0x193aa2[_0x7512('0x50')]);this[_0x7512('0x10')][_0x8bfa15[_0x7512('0x48')]]=_0x193aa2;this['emitVoiceQueueChannelRemove'](_0x193aa2,_0x7512('0x82'));}}}catch(_0x2bbe8a){logger['error'](_0x7512('0x83'),_0x8bfa15[_0x7512('0x48')],util[_0x7512('0x3d')](_0x2bbe8a,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x7512('0x1c')]=function(_0x4d550f){try{if(this['isNotNull'](_0x4d550f)){logger[_0x7512('0x45')](_0x7512('0x84'),_0x4d550f['uniqueid'],util[_0x7512('0x3d')](_0x4d550f,{'showHidden':![],'depth':null}));if(this[_0x7512('0xe')][_0x4d550f[_0x7512('0x48')]]){var _0x1930d3=_[_0x7512('0x85')](this[_0x7512('0xe')][_0x4d550f['uniqueid']]);_0x1930d3[_0x7512('0x86')]=moment()['format'](_0x7512('0x73'));_0x1930d3[_0x7512('0x87')]=_0x4d550f[_0x7512('0x87')];_0x1930d3[_0x7512('0x88')]=_0x4d550f['connectedlinename'];logger[_0x7512('0x66')](_0x7512('0x89'),_0x1930d3['name'],_0x1930d3['type'],_0x4d550f[_0x7512('0x87')],_0x4d550f['connectedlinename']);this[_0x7512('0x10')][_0x4d550f[_0x7512('0x48')]]=_0x1930d3;this['emitVoiceQueueChannelSave'](_0x1930d3,'queuecallerleave');}}}catch(_0x3f20c7){logger[_0x7512('0x3c')](_0x7512('0x84'),_0x4d550f[_0x7512('0x48')],util['inspect'](_0x3f20c7,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x7512('0xa')][_0x7512('0x1f')]=function(_0x2f8992){try{if(this['isNotNull'](_0x2f8992)){logger['debug'](_0x7512('0x8a'),_0x2f8992[_0x7512('0x48')],util[_0x7512('0x3d')](_0x2f8992,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x2f8992['uniqueid']]){var _0x4b1db0=_[_0x7512('0x85')](this[_0x7512('0xe')][_0x2f8992['uniqueid']]);_0x4b1db0[_0x7512('0x7d')]=!![];_0x4b1db0['queuecallerexitreason']=_0x7512('0x8b');logger['info']('[voiceQueueReport][agentconnect]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETEDBYAGENT',_0x4b1db0[_0x7512('0x4a')],_0x4b1db0[_0x7512('0x50')]);}}}catch(_0x1da28d){logger[_0x7512('0x3c')](_0x7512('0x8a'),_0x2f8992[_0x7512('0x48')],util[_0x7512('0x3d')](_0x1da28d,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype']['syncAgentComplete']=function(_0x2452b2){try{if(this[_0x7512('0x5d')](_0x2452b2)){logger[_0x7512('0x45')](_0x7512('0x8c'),_0x2452b2[_0x7512('0x48')],util[_0x7512('0x3d')](_0x2452b2,{'showHidden':![],'depth':null}));if(this[_0x7512('0xe')][_0x2452b2[_0x7512('0x48')]]){var _0x1c340e=_[_0x7512('0x85')](this[_0x7512('0xe')][_0x2452b2[_0x7512('0x48')]]);_0x1c340e[_0x7512('0x82')]=![];_0x1c340e[_0x7512('0x7f')]=null;_0x1c340e[_0x7512('0x8d')]=!![];_0x1c340e['lastAssignedTo']=_0x2452b2[_0x7512('0x8e')];_0x1c340e['holdtime']=_0x2452b2[_0x7512('0x7e')];_0x1c340e[_0x7512('0x7d')]=!![];_0x1c340e[_0x7512('0x8f')]=![];_0x1c340e[_0x7512('0x90')]=null;if(!_0x1c340e['transfer']){if(_0x2452b2[_0x7512('0x91')]==_0x7512('0x92')){_0x1c340e['queuecallerexitreason']='COMPLETED';logger[_0x7512('0x66')]('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETED',_0x1c340e['name'],_0x1c340e[_0x7512('0x50')]);}else{if(_[_0x7512('0x93')](_0x2452b2[_0x7512('0x3a')][_0x7512('0x94')](),_0x7512('0x95'))){if(this[_0x7512('0xe')][_0x2452b2[_0x7512('0x96')]]){var _0x51e770=_[_0x7512('0x85')](this[_0x7512('0xe')][_0x2452b2['linkedid']]);_0x51e770[_0x7512('0x7d')]=![];_0x51e770[_0x7512('0x8f')]=!![];_0x51e770['queuecallerexitAt']=moment(_0x1c340e[_0x7512('0x72')])[_0x7512('0x97')](_0x2452b2[_0x7512('0x7e')],_0x7512('0x98'))[_0x7512('0x49')](_0x7512('0x73'));_0x51e770['queuecallerexitreason']=_0x7512('0x99');_0x51e770['transfer']=!![];_0x51e770[_0x7512('0x9a')]='FORWARD';_0x51e770['transferexten']=_0x2452b2[_0x7512('0x9b')];_0x51e770[_0x7512('0x9c')]=_0x2452b2[_0x7512('0x48')];logger[_0x7512('0x66')](_0x7512('0x9d'),_0x51e770[_0x7512('0x4a')],_0x51e770[_0x7512('0x50')]);var _0x494251=this[_0x7512('0xe')][_0x2452b2[_0x7512('0x96')]];this[_0x7512('0xe')][_0x2452b2[_0x7512('0x96')]]=this['queueReports'][_0x2452b2[_0x7512('0x48')]];this[_0x7512('0xe')][_0x2452b2[_0x7512('0x48')]]=_0x494251;}}else{_0x1c340e[_0x7512('0x9e')]='COMPLETEDBY'+_0x2452b2['reason'][_0x7512('0x9f')]();logger[_0x7512('0x66')]('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:%s',_0x1c340e[_0x7512('0x4a')],_0x1c340e[_0x7512('0x50')],_0x1c340e[_0x7512('0x9e')]);}}}this[_0x7512('0x10')][_0x2452b2[_0x7512('0x48')]]=_0x1c340e;this[_0x7512('0x43')](_0x1c340e,_0x7512('0xa0'));}}}catch(_0x4d7b9b){logger[_0x7512('0x3c')](_0x7512('0x8c'),_0x2452b2[_0x7512('0x48')],util['inspect'](_0x4d7b9b,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x7512('0xa')]['syncVarSet']=function(_0x3fab1d){try{if(this[_0x7512('0x5d')](_0x3fab1d)){logger[_0x7512('0x45')](_0x7512('0xa1'),_0x3fab1d[_0x7512('0x48')],util['inspect'](_0x3fab1d,{'showHidden':![],'depth':null}));this[_0x7512('0xa2')](_0x3fab1d[_0x7512('0x48')],_[_0x7512('0x7a')](_0x3fab1d[_0x7512('0xa3')])[0x0],_0x3fab1d[_0x7512('0xa4')]);if(this[_0x7512('0xe')][_0x3fab1d[_0x7512('0x48')]]){var _0xfd874e=_['last'](this[_0x7512('0xe')][_0x3fab1d['uniqueid']]);if(_0xfd874e){if(this[_0x7512('0x5d')](_0x3fab1d[_0x7512('0xa3')])&&this[_0x7512('0x5d')](_0x3fab1d[_0x7512('0xa3')][_0x7512('0xa5')])){switch(_0x3fab1d[_0x7512('0xa4')]){case _0x7512('0xa6'):_0xfd874e[_0x7512('0x8f')]=![];_0xfd874e[_0x7512('0x90')]=null;break;case _0x7512('0xa7'):_0xfd874e[_0x7512('0xa8')]='timeout';_0xfd874e['queuecallerexit']=!![];_0xfd874e['queuecallerexitAt']=moment()[_0x7512('0x49')]('YYYY-MM-DD\x20HH:mm:ss');_0xfd874e[_0x7512('0x86')]=moment()[_0x7512('0x49')](_0x7512('0x73'));logger[_0x7512('0x45')]('[%s][voiceQueueReport][varset]\x20sending\x20timeout\x20event:',_0x3fab1d[_0x7512('0x48')],util[_0x7512('0x3d')](_0xfd874e,{'showHidden':![],'depth':null}));ami['emit']('custom:timeout',_0xfd874e);break;default:_0xfd874e[_0x7512('0x8f')]=!![];_0xfd874e[_0x7512('0x90')]=moment()[_0x7512('0x49')](_0x7512('0x73'));_0xfd874e[_0x7512('0x86')]=moment()[_0x7512('0x49')](_0x7512('0x73'));}_0xfd874e[_0x7512('0x82')]=![];_0xfd874e[_0x7512('0x7f')]=null;_0xfd874e[_0x7512('0x9e')]=_0x3fab1d[_0x7512('0xa4')];this['channels'][_0x3fab1d['uniqueid']]=_0xfd874e;this[_0x7512('0x43')](_0xfd874e,_0x7512('0x20'));}else if(this[_0x7512('0x5d')](_0x3fab1d[_0x7512('0xa3')])&&this['isNotNull'](_0x3fab1d[_0x7512('0xa3')][_0x7512('0xa9')])){if(!_0xfd874e[_0x7512('0x82')]){_0xfd874e['queuecallerexit']=!![];_0xfd874e[_0x7512('0x90')]=moment()[_0x7512('0x49')](_0x7512('0x73'));_0xfd874e[_0x7512('0x9e')]='EXITWITHKEY';_0xfd874e['queuecallerleaveAt']=moment()[_0x7512('0x49')](_0x7512('0x73'));this[_0x7512('0x10')][_0x3fab1d[_0x7512('0x48')]]=_0xfd874e;}}logger[_0x7512('0x66')](_0x7512('0xaa'),_0x3fab1d['uniqueid'],_0xfd874e['name'],_0xfd874e[_0x7512('0x50')],_[_0x7512('0x7a')](_0x3fab1d['variable'])[0x0],_0x3fab1d[_0x7512('0xa4')]);_0xfd874e[_0x7512('0x15')]=this[_0x7512('0x15')][_0x3fab1d[_0x7512('0x48')]];}}}}catch(_0x57b4c1){logger[_0x7512('0x3c')](_0x7512('0xa1'),_0x3fab1d[_0x7512('0x48')],util[_0x7512('0x3d')](_0x57b4c1,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x7512('0xa')][_0x7512('0xa2')]=function(_0x186ebc,_0xe59376,_0x28aed7){var _0x473776=['rtpaudioqos',_0x7512('0xab'),_0x7512('0xac'),_0x7512('0xad'),_0x7512('0xae'),'rtpaudioqoslossbridged','rtpaudioqosrtt',_0x7512('0xaf'),_0x7512('0xb0'),_0x7512('0xb1'),_0x7512('0xb2'),_0x7512('0xb3'),_0x7512('0xb4'),_0x7512('0xb5'),'memberinterface','memberlastcall',_0x7512('0x8e'),_0x7512('0xb6'),'memberrealtime'];if(!_[_0x7512('0x37')](_0xe59376)&&!_[_0x7512('0xb7')](_0x473776,_0xe59376)){if(_[_0x7512('0x5e')](this[_0x7512('0x15')][_0x186ebc])){this[_0x7512('0x15')][_0x186ebc]={};}this['variables'][_0x186ebc][_0xe59376]=_0x28aed7;}};VoiceQueueReport[_0x7512('0xa')][_0x7512('0x23')]=function(_0x48ab53){try{if(this[_0x7512('0x5d')](_0x48ab53)){logger[_0x7512('0x45')]('[%s][voiceQueueReport][hangup]',_0x48ab53[_0x7512('0x48')],util['inspect'](_0x48ab53,{'showHidden':![],'depth':null}));if(this[_0x7512('0xe')][_0x48ab53[_0x7512('0x48')]]){for(var _0x36d977=0x0,_0x5dc861={};_0x36d9770x0?_0x7b0612:0x0;this[_0x6487('0xf')][_0x5ee1d7[_0x6487('0x65')]][_0x6487('0x30')]=this[_0x6487('0xf')][_0x5ee1d7['queue']]['talking']>_[_0x6487('0x68')](_0x5ee1d7[_0x6487('0x69')])?_[_0x6487('0x68')](_0x5ee1d7[_0x6487('0x69')]):this[_0x6487('0xf')][_0x5ee1d7[_0x6487('0x65')]][_0x6487('0x30')];this[_0x6487('0x6a')](this[_0x6487('0xf')][_0x5ee1d7[_0x6487('0x65')]],'queuesummary');}logger[_0x6487('0x5b')](_0x6487('0x6b'),util[_0x6487('0x3b')](this[_0x6487('0xf')][_0x5ee1d7[_0x6487('0x65')]],{'showHidden':![],'depth':null}));ami[_0x6487('0x41')](_0x6487('0x6c'),this[_0x6487('0xf')][_0x5ee1d7['queue']]);}}}catch(_0x367451){logger['error'](_0x6487('0x63'),util[_0x6487('0x3b')](_0x367451,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x6487('0x7')][_0x6487('0x16')]=function(_0xe9d794){logger['debug']('[voiceQueueReport][queuesummarycomplete]\x20event:',util[_0x6487('0x3b')](_0xe9d794,{'showHidden':![],'depth':null}));this[_0x6487('0x10')]=!![];};VoiceQueueReport[_0x6487('0x7')][_0x6487('0x6d')]=function(_0x3ee8a6){try{if(this[_0x6487('0x64')](_0x3ee8a6)){logger[_0x6487('0x5b')](_0x6487('0x6e'),_0x3ee8a6[_0x6487('0x45')],util[_0x6487('0x3b')](_0x3ee8a6,{'showHidden':![],'depth':null}));if(_[_0x6487('0x5f')](this[_0x6487('0xb')][_0x3ee8a6[_0x6487('0x45')]]))this[_0x6487('0xb')][_0x3ee8a6[_0x6487('0x45')]]=[];if(_['isUndefined'](this[_0x6487('0xd')][_0x3ee8a6[_0x6487('0x45')]]))this[_0x6487('0xd')][_0x3ee8a6[_0x6487('0x45')]]={};var _0x4b9fbd=new QueueReport();_0x4b9fbd[_0x6487('0x48')]=_0x3ee8a6['queue'];_0x4b9fbd[_0x6487('0x4d')]=this[_0x6487('0xf')][_0x4b9fbd[_0x6487('0x48')]]&&this[_0x6487('0xf')][_0x4b9fbd[_0x6487('0x48')]][_0x6487('0x4d')]?this[_0x6487('0xf')][_0x4b9fbd[_0x6487('0x48')]][_0x6487('0x4d')]||'inbound':_0x6487('0x6f');_0x4b9fbd['queue']=_0x3ee8a6['queue'];_0x4b9fbd[_0x6487('0x70')]=moment()[_0x6487('0x46')]('YYYY-MM-DD\x20HH:mm:ss');_0x4b9fbd[_0x6487('0x71')]=_0x3ee8a6[_0x6487('0x71')];_0x4b9fbd['count']=_0x3ee8a6[_0x6487('0x72')];_0x4b9fbd[_0x6487('0x45')]=_0x3ee8a6[_0x6487('0x45')];_0x4b9fbd[_0x6487('0x73')]=this['channels'][_0x3ee8a6[_0x6487('0x45')]]['routealias'];logger[_0x6487('0x74')]('[voiceQueueReport][queuecallerjoin]\x20name:%s\x20type:%s',_0x4b9fbd[_0x6487('0x48')],_0x4b9fbd['type']);_[_0x6487('0x75')](_0x4b9fbd,_[_0x6487('0x76')](_0x3ee8a6,_['keys'](_0x4b9fbd)));this[_0x6487('0xb')][_0x3ee8a6[_0x6487('0x45')]][_0x6487('0x77')](_0x4b9fbd);this['channels'][_0x3ee8a6[_0x6487('0x45')]]=_0x4b9fbd;this[_0x6487('0x42')](_0x4b9fbd,_0x6487('0x18'));}}catch(_0x55bd4f){logger[_0x6487('0x3c')](_0x6487('0x6e'),_0x3ee8a6[_0x6487('0x45')],util[_0x6487('0x3b')](_0x55bd4f,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x6487('0x7')][_0x6487('0x78')]=function(_0xceb29){try{if(this['isNotNull'](_0xceb29)){logger[_0x6487('0x5b')]('[%s][voiceQueueReport][queuecallerabandon]',_0xceb29[_0x6487('0x45')],util[_0x6487('0x3b')](_0xceb29,{'showHidden':![],'depth':null}));if(this[_0x6487('0xb')][_0xceb29[_0x6487('0x45')]]){var _0x7809ae=_[_0x6487('0x79')](this[_0x6487('0xb')][_0xceb29[_0x6487('0x45')]]);_0x7809ae[_0x6487('0x7a')]=![];_0x7809ae['queuecallercompleteAt']=null;_0x7809ae[_0x6487('0x7b')]=_0xceb29['holdtime'];_0x7809ae[_0x6487('0x7c')]=_0xceb29[_0x6487('0x7c')];_0x7809ae['queuecallerabandon']=!![];_0x7809ae[_0x6487('0x7d')]=moment()[_0x6487('0x46')]('YYYY-MM-DD\x20HH:mm:ss');_0x7809ae[_0x6487('0x7e')]=_0x6487('0x7f');_0x7809ae[_0x6487('0x80')]=null;logger[_0x6487('0x74')](_0x6487('0x81'),_0x7809ae[_0x6487('0x48')],_0x7809ae['type']);this[_0x6487('0xd')][_0xceb29[_0x6487('0x45')]]=_0x7809ae;this['emitVoiceQueueChannelRemove'](_0x7809ae,'queuecallerabandon');}}}catch(_0x5055d8){logger['error'](_0x6487('0x82'),_0xceb29[_0x6487('0x45')],util[_0x6487('0x3b')](_0x5055d8,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x6487('0x7')]['syncQueueCallerLeave']=function(_0x12b8f5){try{if(this[_0x6487('0x64')](_0x12b8f5)){logger['debug'](_0x6487('0x83'),_0x12b8f5['uniqueid'],util['inspect'](_0x12b8f5,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x12b8f5[_0x6487('0x45')]]){var _0x5424d0=_[_0x6487('0x79')](this['queueReports'][_0x12b8f5[_0x6487('0x45')]]);_0x5424d0['queuecallerleaveAt']=moment()[_0x6487('0x46')](_0x6487('0x84'));_0x5424d0[_0x6487('0x85')]=_0x12b8f5['connectedlinenum'];_0x5424d0[_0x6487('0x86')]=_0x12b8f5[_0x6487('0x86')];logger['info'](_0x6487('0x87'),_0x5424d0['name'],_0x5424d0[_0x6487('0x4d')],_0x12b8f5['connectedlinenum'],_0x12b8f5[_0x6487('0x86')]);this[_0x6487('0xd')][_0x12b8f5[_0x6487('0x45')]]=_0x5424d0;this[_0x6487('0x42')](_0x5424d0,'queuecallerleave');}}}catch(_0x17c8a0){logger[_0x6487('0x3c')](_0x6487('0x83'),_0x12b8f5['uniqueid'],util['inspect'](_0x17c8a0,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x6487('0x7')][_0x6487('0x88')]=function(_0x1bc347){try{if(this['isNotNull'](_0x1bc347)){logger[_0x6487('0x5b')](_0x6487('0x89'),_0x1bc347[_0x6487('0x45')],util['inspect'](_0x1bc347,{'showHidden':![],'depth':null}));if(this[_0x6487('0xb')][_0x1bc347[_0x6487('0x45')]]){var _0x2e163e=_[_0x6487('0x79')](this[_0x6487('0xb')][_0x1bc347[_0x6487('0x45')]]);_0x2e163e[_0x6487('0x7a')]=!![];_0x2e163e[_0x6487('0x7e')]='COMPLETEDBYAGENT';logger[_0x6487('0x74')]('[voiceQueueReport][agentconnect]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETEDBYAGENT',_0x2e163e[_0x6487('0x48')],_0x2e163e[_0x6487('0x4d')]);}}}catch(_0x1b9997){logger['error'](_0x6487('0x89'),_0x1bc347[_0x6487('0x45')],util[_0x6487('0x3b')](_0x1b9997,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x6487('0x7')]['syncAgentComplete']=function(_0x57fb13){try{if(this['isNotNull'](_0x57fb13)){logger[_0x6487('0x5b')](_0x6487('0x8a'),_0x57fb13['uniqueid'],util['inspect'](_0x57fb13,{'showHidden':![],'depth':null}));if(this[_0x6487('0xb')][_0x57fb13[_0x6487('0x45')]]){var _0x3b33b9=_[_0x6487('0x79')](this['queueReports'][_0x57fb13[_0x6487('0x45')]]);_0x3b33b9['queuecallerabandon']=![];_0x3b33b9[_0x6487('0x7d')]=null;_0x3b33b9['assigned']=!![];_0x3b33b9[_0x6487('0x80')]=_0x57fb13['membername'];_0x3b33b9[_0x6487('0x7b')]=_0x57fb13['holdtime'];_0x3b33b9['queuecallercomplete']=!![];_0x3b33b9[_0x6487('0x8b')]=![];_0x3b33b9[_0x6487('0x8c')]=null;if(!_0x3b33b9[_0x6487('0x8d')]){if(_0x57fb13[_0x6487('0x8e')]==_0x6487('0x8d')){_0x3b33b9[_0x6487('0x7e')]=_0x6487('0x8f');logger[_0x6487('0x74')](_0x6487('0x90'),_0x3b33b9[_0x6487('0x48')],_0x3b33b9['type']);}else{if(_[_0x6487('0x91')](_0x57fb13[_0x6487('0x92')]['toLowerCase'](),_0x6487('0x93'))){if(this['queueReports'][_0x57fb13[_0x6487('0x94')]]){var _0x9f8b2d=_[_0x6487('0x79')](this[_0x6487('0xb')][_0x57fb13[_0x6487('0x94')]]);_0x9f8b2d[_0x6487('0x7a')]=![];_0x9f8b2d[_0x6487('0x8b')]=!![];_0x9f8b2d[_0x6487('0x8c')]=moment(_0x3b33b9['queuecallerjoinAt'])[_0x6487('0x95')](_0x57fb13[_0x6487('0x7b')],_0x6487('0x96'))[_0x6487('0x46')](_0x6487('0x84'));_0x9f8b2d[_0x6487('0x7e')]=_0x6487('0x97');_0x9f8b2d['transfer']=!![];_0x9f8b2d[_0x6487('0x98')]=_0x6487('0x99');_0x9f8b2d['transferexten']=_0x57fb13['destexten'];_0x9f8b2d['transferuniqueid']=_0x57fb13[_0x6487('0x45')];logger['info']('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:FORWARDTRANSFER',_0x9f8b2d[_0x6487('0x48')],_0x9f8b2d['type']);var _0x3d287a=this[_0x6487('0xb')][_0x57fb13['linkedid']];this['queueReports'][_0x57fb13[_0x6487('0x94')]]=this[_0x6487('0xb')][_0x57fb13[_0x6487('0x45')]];this[_0x6487('0xb')][_0x57fb13['uniqueid']]=_0x3d287a;}}else{_0x3b33b9[_0x6487('0x7e')]=_0x6487('0x9a')+_0x57fb13['reason']['toUpperCase']();logger[_0x6487('0x74')](_0x6487('0x9b'),_0x3b33b9[_0x6487('0x48')],_0x3b33b9[_0x6487('0x4d')],_0x3b33b9['queuecallerexitreason']);}}}this[_0x6487('0xd')][_0x57fb13[_0x6487('0x45')]]=_0x3b33b9;this[_0x6487('0x3f')](_0x3b33b9,'agentcomplete');}}}catch(_0x29ba21){logger[_0x6487('0x3c')](_0x6487('0x8a'),_0x57fb13[_0x6487('0x45')],util[_0x6487('0x3b')](_0x29ba21,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x6487('0x7')][_0x6487('0x1e')]=function(_0x3f8931){try{if(this[_0x6487('0x64')](_0x3f8931)){logger[_0x6487('0x5b')](_0x6487('0x9c'),_0x3f8931[_0x6487('0x45')],util[_0x6487('0x3b')](_0x3f8931,{'showHidden':![],'depth':null}));this['addVariable'](_0x3f8931[_0x6487('0x45')],_['keys'](_0x3f8931[_0x6487('0x9d')])[0x0],_0x3f8931[_0x6487('0x9e')]);if(this[_0x6487('0xb')][_0x3f8931[_0x6487('0x45')]]){var _0x30058e=_['last'](this[_0x6487('0xb')][_0x3f8931[_0x6487('0x45')]]);if(_0x30058e){if(this['isNotNull'](_0x3f8931[_0x6487('0x9d')])&&this[_0x6487('0x64')](_0x3f8931[_0x6487('0x9d')]['queuestatus'])){switch(_0x3f8931[_0x6487('0x9e')]){case _0x6487('0x9f'):_0x30058e['queuecallerexit']=![];_0x30058e['queuecallerexitAt']=null;break;case _0x6487('0xa0'):_0x30058e[_0x6487('0xa1')]=_0x6487('0xa2');_0x30058e['queuecallerexit']=!![];_0x30058e[_0x6487('0x8c')]=moment()['format'](_0x6487('0x84'));_0x30058e['queuecallerleaveAt']=moment()[_0x6487('0x46')](_0x6487('0x84'));logger[_0x6487('0x5b')](_0x6487('0xa3'),_0x3f8931[_0x6487('0x45')],util[_0x6487('0x3b')](_0x30058e,{'showHidden':![],'depth':null}));ami['emit']('custom:timeout',_0x30058e);break;default:_0x30058e[_0x6487('0x8b')]=!![];_0x30058e['queuecallerexitAt']=moment()[_0x6487('0x46')](_0x6487('0x84'));_0x30058e['queuecallerleaveAt']=moment()[_0x6487('0x46')](_0x6487('0x84'));}_0x30058e[_0x6487('0x19')]=![];_0x30058e['queuecallerabandonAt']=null;_0x30058e[_0x6487('0x7e')]=_0x3f8931[_0x6487('0x9e')];this['channels'][_0x3f8931[_0x6487('0x45')]]=_0x30058e;this[_0x6487('0x3f')](_0x30058e,_0x6487('0x1d'));}else if(this[_0x6487('0x64')](_0x3f8931[_0x6487('0x9d')])&&this[_0x6487('0x64')](_0x3f8931['variable'][_0x6487('0xa4')])){if(!_0x30058e['queuecallerabandon']){_0x30058e[_0x6487('0x8b')]=!![];_0x30058e[_0x6487('0x8c')]=moment()[_0x6487('0x46')](_0x6487('0x84'));_0x30058e['queuecallerexitreason']=_0x6487('0xa5');_0x30058e[_0x6487('0xa6')]=moment()[_0x6487('0x46')](_0x6487('0x84'));this[_0x6487('0xd')][_0x3f8931['uniqueid']]=_0x30058e;}}logger[_0x6487('0x74')](_0x6487('0xa7'),_0x3f8931['uniqueid'],_0x30058e[_0x6487('0x48')],_0x30058e[_0x6487('0x4d')],_[_0x6487('0xa8')](_0x3f8931[_0x6487('0x9d')])[0x0],_0x3f8931['value']);_0x30058e['variables']=this['variables'][_0x3f8931[_0x6487('0x45')]];}}}}catch(_0x294621){logger[_0x6487('0x3c')](_0x6487('0x9c'),_0x3f8931[_0x6487('0x45')],util['inspect'](_0x294621,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x6487('0xa9')]=function(_0x58a2cd,_0x2944da,_0x162993){var _0x21bb4d=[_0x6487('0xaa'),_0x6487('0xab'),_0x6487('0xac'),_0x6487('0xad'),_0x6487('0xae'),'rtpaudioqoslossbridged','rtpaudioqosrtt',_0x6487('0xaf'),_0x6487('0xb0'),_0x6487('0xb1'),'bridgepeer',_0x6487('0xb2'),_0x6487('0xb3'),_0x6487('0xb4'),_0x6487('0xb5'),_0x6487('0xb6'),_0x6487('0xb7'),'memberpenalty',_0x6487('0xb8')];if(!_[_0x6487('0x36')](_0x2944da)&&!_['includes'](_0x21bb4d,_0x2944da)){if(_['isUndefined'](this['variables'][_0x58a2cd])){this[_0x6487('0x12')][_0x58a2cd]={};}this[_0x6487('0x12')][_0x58a2cd][_0x2944da]=_0x162993;}};VoiceQueueReport[_0x6487('0x7')][_0x6487('0x20')]=function(_0x5971c5){try{if(this[_0x6487('0x64')](_0x5971c5)){logger[_0x6487('0x5b')](_0x6487('0xb9'),_0x5971c5[_0x6487('0x45')],util['inspect'](_0x5971c5,{'showHidden':![],'depth':null}));if(this[_0x6487('0xb')][_0x5971c5[_0x6487('0x45')]]){for(var _0x6f94f7=0x0,_0x1f3c37={};_0x6f94f7=0x0?moment(_0x36a410[_0xa7e9('0x1a')])[_0xa7e9('0x10')](_0x36a410[_0xa7e9('0x1b')],'seconds'):null,'data1':'outbound','data2':_0x36a410[_0xa7e9('0x15')],'data3':_0x36a410[_0xa7e9('0x1c')],'data4':_0x36a410[_0xa7e9('0x1d')]||null,'role':_0xa7e9('0x14'),'internal':_0x36a410[_0xa7e9('0x15')]?_[_0xa7e9('0x16')](_0x36a410[_0xa7e9('0x15')]):undefined,'uniqueid':_0x36a410['uniqueid']},'log':_0xa7e9('0x8')});}; \ No newline at end of file +var _0x1aa4=['seconds','inbound','exten','agent','accountcode','toNumber','uniqueid','voiceDialReport','membername','endtime','diff','starttime','outbound','dialstring','lodash','util','voiceQueueReport','queuecallerexitAt','CreateMemberReport','voice','lastAssignedTo','isNil','interface','queuecallerleaveAt'];(function(_0x3da7e5,_0x17b2e7){var _0x43c1eb=function(_0x2ea023){while(--_0x2ea023){_0x3da7e5['push'](_0x3da7e5['shift']());}};_0x43c1eb(++_0x17b2e7);}(_0x1aa4,0x15e));var _0x41aa=function(_0x27adaa,_0x3a3182){_0x27adaa=_0x27adaa-0x0;var _0x2478a5=_0x1aa4[_0x27adaa];return _0x2478a5;};'use strict';var moment=require('moment');var _=require(_0x41aa('0x0'));var util=require(_0x41aa('0x1'));var client=require('../client');exports[_0x41aa('0x2')]=function(_0x13f049){var _0x341835=_0x13f049['queuecallercompleteAt']||_0x13f049[_0x41aa('0x3')];return client['Request'](_0x41aa('0x4'),{'body':{'channel':_0x41aa('0x5'),'membername':_0x13f049[_0x41aa('0x6')],'interface':_[_0x41aa('0x7')](_0x13f049[_0x41aa('0x8')])?util['format']('SIP/%s',_0x13f049['lastAssignedTo']):_0x13f049[_0x41aa('0x8')],'type':'TALKING','enterAt':_0x13f049[_0x41aa('0x9')],'exitAt':_0x341835,'duration':moment(_0x341835)['diff'](_0x13f049[_0x41aa('0x9')],_0x41aa('0xa')),'data1':_0x41aa('0xb'),'data2':_0x13f049['calleridnum'],'data3':_0x13f049[_0x41aa('0xc')],'data4':null,'data5':_0x13f049['queue'],'role':_0x41aa('0xd'),'internal':_0x13f049[_0x41aa('0xe')]?_[_0x41aa('0xf')](_0x13f049['accountcode']):undefined,'uniqueid':_0x13f049[_0x41aa('0x10')]},'log':'CreateMemberReport'});};exports[_0x41aa('0x11')]=function(_0x153f59){return client['Request'](_0x41aa('0x4'),{'body':{'channel':_0x41aa('0x5'),'membername':_0x153f59[_0x41aa('0x12')],'interface':_0x153f59[_0x41aa('0x8')],'type':'TALKING','enterAt':_0x153f59['starttime'],'exitAt':_0x153f59[_0x41aa('0x13')],'duration':moment(_0x153f59[_0x41aa('0x13')])[_0x41aa('0x14')](_0x153f59[_0x41aa('0x15')],'seconds')>=0x0?moment(_0x153f59[_0x41aa('0x13')])['diff'](_0x153f59[_0x41aa('0x15')],_0x41aa('0xa')):null,'data1':_0x41aa('0x16'),'data2':_0x153f59[_0x41aa('0xe')],'data3':_0x153f59[_0x41aa('0xc')],'data4':_0x153f59[_0x41aa('0x17')]||null,'role':_0x41aa('0xd'),'internal':_0x153f59[_0x41aa('0xe')]?_[_0x41aa('0xf')](_0x153f59[_0x41aa('0xe')]):undefined,'uniqueid':_0x153f59[_0x41aa('0x10')]},'log':_0x41aa('0x4')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/setting.js b/server/services/ami/rpc/setting.js index 31ffcc8..8f59e37 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 _0x8128=['stopRecordingOnTransfer','../client','ShowSetting'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x8128,0x1b1));var _0x8812=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x8128[_0x3bf83f];return _0x22c4a9;};'use strict';var client=require(_0x8812('0x0'));exports['getSettings']=function(){return client['Request'](_0x8812('0x1'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x8812('0x2')]},'log':'GetSettings'});}; \ No newline at end of file +var _0x36f9=['GetSettings','../client','Request'];(function(_0x2f99a4,_0x27d920){var _0x94892b=function(_0x342273){while(--_0x342273){_0x2f99a4['push'](_0x2f99a4['shift']());}};_0x94892b(++_0x27d920);}(_0x36f9,0x151));var _0x936f=function(_0x35fc38,_0x13e00f){_0x35fc38=_0x35fc38-0x0;var _0x152094=_0x36f9[_0x35fc38];return _0x152094;};'use strict';var client=require(_0x936f('0x0'));exports['getSettings']=function(){return client[_0x936f('0x1')]('ShowSetting',{'options':{'raw':!![],'where':{'id':0x1},'attributes':['stopRecordingOnTransfer']},'log':_0x936f('0x2')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/template.js b/server/services/ami/rpc/template.js index cf09bd8..7151a6c 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 _0x025e=['name','html','../client','GetTemplate'];(function(_0x119e18,_0x315f50){var _0x4255c7=function(_0x42a5f3){while(--_0x42a5f3){_0x119e18['push'](_0x119e18['shift']());}};_0x4255c7(++_0x315f50);}(_0x025e,0x116));var _0xe025=function(_0x1ccdf7,_0x215d5a){_0x1ccdf7=_0x1ccdf7-0x0;var _0x52a0ae=_0x025e[_0x1ccdf7];return _0x52a0ae;};'use strict';var client=require(_0xe025('0x0'));exports['getTemplates']=function(_0x73e587){return function(_0x107102){return client['Request'](_0xe025('0x1'),{'options':{'raw':!![],'attributes':['id',_0xe025('0x2'),_0xe025('0x3')]},'log':_0xe025('0x1')});};}; \ No newline at end of file +var _0x9b85=['Request','GetTemplate','name','getTemplates'];(function(_0x35d896,_0x31f68d){var _0x4f5aed=function(_0x27c667){while(--_0x27c667){_0x35d896['push'](_0x35d896['shift']());}};_0x4f5aed(++_0x31f68d);}(_0x9b85,0xd7));var _0x59b8=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9b85[_0x5ddb1c];return _0x354adc;};'use strict';var client=require('../client');exports[_0x59b8('0x0')]=function(_0x559639){return function(_0x459fb0){return client[_0x59b8('0x1')](_0x59b8('0x2'),{'options':{'raw':!![],'attributes':['id',_0x59b8('0x3'),'html']},'log':'GetTemplate'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trigger.js b/server/services/ami/rpc/trigger.js index 474705c..ce22ff5 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 _0x4cc3=['name','Condition','AllConditions','operator','value','AnyConditions','field','Action','Actions','action','data1','data4','data5','data6','data7','getTriggers','Request'];(function(_0x422abe,_0x7dafa4){var _0x358262=function(_0x2fe112){while(--_0x2fe112){_0x422abe['push'](_0x422abe['shift']());}};_0x358262(++_0x7dafa4);}(_0x4cc3,0x1c9));var _0x34cc=function(_0x6aa778,_0x1af314){_0x6aa778=_0x6aa778-0x0;var _0x3b4979=_0x4cc3[_0x6aa778];return _0x3b4979;};'use strict';var client=require('../client');exports[_0x34cc('0x0')]=function(_0x212426){return function(_0xf2ab9a){return client[_0x34cc('0x1')]('GetTrigger',{'options':{'raw':![],'attributes':['id',_0x34cc('0x2'),'channel','status'],'include':[{'model':_0x34cc('0x3'),'as':_0x34cc('0x4'),'attributes':['id','field',_0x34cc('0x5'),_0x34cc('0x6')]},{'model':_0x34cc('0x3'),'as':_0x34cc('0x7'),'attributes':['id',_0x34cc('0x8'),_0x34cc('0x5'),_0x34cc('0x6')]},{'model':_0x34cc('0x9'),'as':_0x34cc('0xa'),'attributes':['id',_0x34cc('0xb'),_0x34cc('0xc'),'data2','data3',_0x34cc('0xd'),_0x34cc('0xe'),_0x34cc('0xf'),_0x34cc('0x10')]}]},'log':'GetTrigger'});};}; \ No newline at end of file +var _0xec6e=['AnyConditions','operator','Actions','action','data1','data2','data3','../client','Request','GetTrigger','status','Condition','AllConditions','field','value'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0xec6e,0x133));var _0xeec6=function(_0x5e1e25,_0xdc1421){_0x5e1e25=_0x5e1e25-0x0;var _0x548e5f=_0xec6e[_0x5e1e25];return _0x548e5f;};'use strict';var client=require(_0xeec6('0x0'));exports['getTriggers']=function(_0xa015c1){return function(_0x85b53b){return client[_0xeec6('0x1')](_0xeec6('0x2'),{'options':{'raw':![],'attributes':['id','name','channel',_0xeec6('0x3')],'include':[{'model':_0xeec6('0x4'),'as':_0xeec6('0x5'),'attributes':['id',_0xeec6('0x6'),'operator',_0xeec6('0x7')]},{'model':_0xeec6('0x4'),'as':_0xeec6('0x8'),'attributes':['id',_0xeec6('0x6'),_0xeec6('0x9'),_0xeec6('0x7')]},{'model':'Action','as':_0xeec6('0xa'),'attributes':['id',_0xeec6('0xb'),_0xeec6('0xc'),_0xeec6('0xd'),_0xeec6('0xe'),'data4','data5','data6','data7']}]},'log':'GetTrigger'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trunk.js b/server/services/ami/rpc/trunk.js index 5550777..6f8df27 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 _0xcd7c=['name','defaultuser','../client','getTrunks','Request','GetTrunk'];(function(_0x3665dd,_0x4b86e0){var _0x35e9e9=function(_0xac9cca){while(--_0xac9cca){_0x3665dd['push'](_0x3665dd['shift']());}};_0x35e9e9(++_0x4b86e0);}(_0xcd7c,0x104));var _0xccd7=function(_0x24d06f,_0x4ccefd){_0x24d06f=_0x24d06f-0x0;var _0x5e062a=_0xcd7c[_0x24d06f];return _0x5e062a;};'use strict';var client=require(_0xccd7('0x0'));exports[_0xccd7('0x1')]=function(_0x582c86){return function(_0x2a1bc5){return client[_0xccd7('0x2')](_0xccd7('0x3'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0xccd7('0x4'),'registry',_0xccd7('0x5')]},'log':_0xccd7('0x3')});};}; \ No newline at end of file +var _0x5d20=['GetTrunk','name','registry','../client','getTrunks'];(function(_0x2a8eb4,_0x3bea2c){var _0x2e70ce=function(_0x1b4fcd){while(--_0x1b4fcd){_0x2a8eb4['push'](_0x2a8eb4['shift']());}};_0x2e70ce(++_0x3bea2c);}(_0x5d20,0x15c));var _0x05d2=function(_0x10c343,_0x9bf50a){_0x10c343=_0x10c343-0x0;var _0x37b10c=_0x5d20[_0x10c343];return _0x37b10c;};'use strict';var client=require(_0x05d2('0x0'));exports[_0x05d2('0x1')]=function(_0x4bdd05){return function(_0x1b92c1){return client['Request'](_0x05d2('0x2'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0x05d2('0x3'),_0x05d2('0x4'),'defaultuser']},'log':'GetTrunk'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/user.js b/server/services/ami/rpc/user.js index 7595888..b723a0e 100644 --- a/server/services/ami/rpc/user.js +++ b/server/services/ami/rpc/user.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70e0=['getAgents','Request','name','email','accountcode','fullname','lastLoginAt','lastPauseAt','interface','getTelephones','GetUser','telephone','savePause','PauseUser','saveUnpause','getAgent','agent','online','pauseType','../client'];(function(_0x327f4a,_0x3176a4){var _0x546bf2=function(_0x5467ea){while(--_0x5467ea){_0x327f4a['push'](_0x327f4a['shift']());}};_0x546bf2(++_0x3176a4);}(_0x70e0,0x17b));var _0x070e=function(_0x1abcc6,_0x96ae49){_0x1abcc6=_0x1abcc6-0x0;var _0x36872f=_0x70e0[_0x1abcc6];return _0x36872f;};'use strict';var client=require(_0x070e('0x0'));exports[_0x070e('0x1')]=function(){return function(){return client[_0x070e('0x2')]('GetUser',{'options':{'raw':![],'where':{'role':'agent'},'attributes':['id',_0x070e('0x3'),_0x070e('0x4'),_0x070e('0x5'),_0x070e('0x6'),'online',_0x070e('0x7'),'pauseType',_0x070e('0x8'),'voicePause','phone','mobile',_0x070e('0x9')]},'log':_0x070e('0x1')});};};exports[_0x070e('0xa')]=function(){return function(){return client[_0x070e('0x2')](_0x070e('0xb'),{'options':{'raw':!![],'where':{'role':_0x070e('0xc')},'attributes':['id',_0x070e('0x3'),'accountcode','internal']},'log':_0x070e('0xa')});};};exports[_0x070e('0xd')]=function(_0x12bb37,_0xb8d819,_0xa927a2){return client[_0x070e('0x2')](_0x070e('0xe'),{'body':{'type':_0xb8d819,'uniqueid':_0xa927a2},'options':{'where':{'id':_0x12bb37['id']}},'log':_0x070e('0xd')});};exports[_0x070e('0xf')]=function(_0x5bf079){return client[_0x070e('0x2')]('UnpauseUser',{'body':{},'options':{'where':{'id':_0x5bf079['id']}},'log':'savePause'});};exports[_0x070e('0x10')]=function(_0x56c7ba){return client['Request']('ShowUser',{'options':{'raw':![],'where':{'role':_0x070e('0x11'),'id':_0x56c7ba},'attributes':['id',_0x070e('0x3'),'email','accountcode',_0x070e('0x6'),_0x070e('0x12'),_0x070e('0x7'),_0x070e('0x13'),'lastPauseAt','voicePause',_0x070e('0x9')]},'log':_0x070e('0x10')});}; \ No newline at end of file +var _0xe706=['internal','savePause','PauseUser','saveUnpause','UnpauseUser','ShowUser','getAgent','../client','getAgents','Request','agent','name','email','accountcode','fullname','online','lastLoginAt','pauseType','lastPauseAt','voicePause','phone','mobile','interface','getTelephones','GetUser','telephone'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0xe706,0xa3));var _0x6e70=function(_0x1b959e,_0x5b2d5f){_0x1b959e=_0x1b959e-0x0;var _0xa5ecea=_0xe706[_0x1b959e];return _0xa5ecea;};'use strict';var client=require(_0x6e70('0x0'));exports[_0x6e70('0x1')]=function(){return function(){return client[_0x6e70('0x2')]('GetUser',{'options':{'raw':![],'where':{'role':_0x6e70('0x3')},'attributes':['id',_0x6e70('0x4'),_0x6e70('0x5'),_0x6e70('0x6'),_0x6e70('0x7'),_0x6e70('0x8'),_0x6e70('0x9'),_0x6e70('0xa'),_0x6e70('0xb'),_0x6e70('0xc'),_0x6e70('0xd'),_0x6e70('0xe'),_0x6e70('0xf')]},'log':_0x6e70('0x1')});};};exports[_0x6e70('0x10')]=function(){return function(){return client[_0x6e70('0x2')](_0x6e70('0x11'),{'options':{'raw':!![],'where':{'role':_0x6e70('0x12')},'attributes':['id',_0x6e70('0x4'),_0x6e70('0x6'),_0x6e70('0x13')]},'log':_0x6e70('0x10')});};};exports[_0x6e70('0x14')]=function(_0x4600f9,_0x5b3d07,_0x47f6b2){return client[_0x6e70('0x2')](_0x6e70('0x15'),{'body':{'type':_0x5b3d07,'uniqueid':_0x47f6b2},'options':{'where':{'id':_0x4600f9['id']}},'log':_0x6e70('0x14')});};exports[_0x6e70('0x16')]=function(_0x3b38f3){return client[_0x6e70('0x2')](_0x6e70('0x17'),{'body':{},'options':{'where':{'id':_0x3b38f3['id']}},'log':_0x6e70('0x14')});};exports['getAgent']=function(_0x52737e){return client['Request'](_0x6e70('0x18'),{'options':{'raw':![],'where':{'role':'agent','id':_0x52737e},'attributes':['id','name',_0x6e70('0x5'),_0x6e70('0x6'),'fullname',_0x6e70('0x8'),'lastLoginAt',_0x6e70('0xa'),_0x6e70('0xb'),'voicePause','interface']},'log':_0x6e70('0x19')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceAgentReport.js b/server/services/ami/rpc/voiceAgentReport.js index bc5a9e7..ca46d3b 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 _0xec83=['../client','create','Request','CreateVoiceAgentReport','update','UpdateVoiceAgentReport'];(function(_0x11ce46,_0x177a85){var _0x368a1e=function(_0x425454){while(--_0x425454){_0x11ce46['push'](_0x11ce46['shift']());}};_0x368a1e(++_0x177a85);}(_0xec83,0x10e));var _0x3ec8=function(_0x5d1044,_0x18f656){_0x5d1044=_0x5d1044-0x0;var _0x3cd90e=_0xec83[_0x5d1044];return _0x3cd90e;};'use strict';var client=require(_0x3ec8('0x0'));exports[_0x3ec8('0x1')]=function(_0x870458){return client[_0x3ec8('0x2')](_0x3ec8('0x3'),{'body':_0x870458,'log':_0x3ec8('0x3')});};exports[_0x3ec8('0x4')]=function(_0x5895f5,_0x2726e3,_0x26603a){return client[_0x3ec8('0x2')]('UpdateVoiceAgentReport',{'body':_0x5895f5,'options':{'where':{'uniqueid':_0x2726e3,'interface':_0x26603a,'agentcomplete':!![]}},'log':_0x3ec8('0x5')});}; \ No newline at end of file +var _0x23ef=['CreateVoiceAgentReport','update','Request','UpdateVoiceAgentReport','../client','create'];(function(_0x206118,_0x528c29){var _0x421b6d=function(_0x11d75a){while(--_0x11d75a){_0x206118['push'](_0x206118['shift']());}};_0x421b6d(++_0x528c29);}(_0x23ef,0x118));var _0xf23e=function(_0xceac40,_0xb7f69e){_0xceac40=_0xceac40-0x0;var _0x1cb0aa=_0x23ef[_0xceac40];return _0x1cb0aa;};'use strict';var client=require(_0xf23e('0x0'));exports[_0xf23e('0x1')]=function(_0x5c500b){return client['Request'](_0xf23e('0x2'),{'body':_0x5c500b,'log':'CreateVoiceAgentReport'});};exports[_0xf23e('0x3')]=function(_0x307d6d,_0x48846e,_0x3b5cc4){return client[_0xf23e('0x4')](_0xf23e('0x5'),{'body':_0x307d6d,'options':{'where':{'uniqueid':_0x48846e,'interface':_0x3b5cc4,'agentcomplete':!![]}},'log':'UpdateVoiceAgentReport'});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceCallReport.js b/server/services/ami/rpc/voiceCallReport.js index 44afb47..a24c517 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 _0x26e3=['CreateVoiceCallReport','merge','calleridnum','callerid','getVoiceCallReports','Request','GetVoiceCallReport','outbound','startOf','day','format','endOf','YYYY-MM-DD\x20HH:mm:ss','type','disposition','GetVoiceCallReports','../client','create'];(function(_0x2b74de,_0x195eb1){var _0x162415=function(_0x4f7004){while(--_0x4f7004){_0x2b74de['push'](_0x2b74de['shift']());}};_0x162415(++_0x195eb1);}(_0x26e3,0x6a));var _0x326e=function(_0x221b8c,_0x2c7afc){_0x221b8c=_0x221b8c-0x0;var _0x3fab9f=_0x26e3[_0x221b8c];return _0x3fab9f;};'use strict';var moment=require('moment');var util=require('util');var _=require('lodash');var client=require(_0x326e('0x0'));exports[_0x326e('0x1')]=function(_0x31408e){return client['Request'](_0x326e('0x2'),{'body':_[_0x326e('0x3')](_0x31408e,{'source':_0x31408e[_0x326e('0x4')],'destinationcontext':_0x31408e['context'],'callerid':_0x31408e[_0x326e('0x5')],'amaflags':'DOCUMENTATION'}),'log':'CreateVoiceCallReport'});};exports[_0x326e('0x6')]=function(){return function(){return client[_0x326e('0x7')](_0x326e('0x8'),{'options':{'where':{'type':[_0x326e('0x9')],'createdAt':{'$between':[moment()[_0x326e('0xa')](_0x326e('0xb'))[_0x326e('0xc')]('YYYY-MM-DD\x20HH:mm:ss'),moment()[_0x326e('0xd')](_0x326e('0xb'))[_0x326e('0xc')](_0x326e('0xe'))]}},'attributes':[_0x326e('0xf'),_0x326e('0x10'),'duration','billableseconds']},'log':_0x326e('0x11')});};}; \ No newline at end of file +var _0xc87c=['Request','CreateVoiceCallReport','calleridnum','context','callerid','DOCUMENTATION','GetVoiceCallReport','startOf','day','YYYY-MM-DD\x20HH:mm:ss','format','disposition','duration','billableseconds','moment','util','lodash','../client','create'];(function(_0x52e0fa,_0xe925de){var _0x532ce8=function(_0x39914a){while(--_0x39914a){_0x52e0fa['push'](_0x52e0fa['shift']());}};_0x532ce8(++_0xe925de);}(_0xc87c,0x177));var _0xcc87=function(_0x308f66,_0x1ceeb7){_0x308f66=_0x308f66-0x0;var _0x1aabec=_0xc87c[_0x308f66];return _0x1aabec;};'use strict';var moment=require(_0xcc87('0x0'));var util=require(_0xcc87('0x1'));var _=require(_0xcc87('0x2'));var client=require(_0xcc87('0x3'));exports[_0xcc87('0x4')]=function(_0x519432){return client[_0xcc87('0x5')](_0xcc87('0x6'),{'body':_['merge'](_0x519432,{'source':_0x519432[_0xcc87('0x7')],'destinationcontext':_0x519432[_0xcc87('0x8')],'callerid':_0x519432[_0xcc87('0x9')],'amaflags':_0xcc87('0xa')}),'log':_0xcc87('0x6')});};exports['getVoiceCallReports']=function(){return function(){return client['Request'](_0xcc87('0xb'),{'options':{'where':{'type':['outbound'],'createdAt':{'$between':[moment()[_0xcc87('0xc')](_0xcc87('0xd'))['format'](_0xcc87('0xe')),moment()['endOf'](_0xcc87('0xd'))[_0xcc87('0xf')]('YYYY-MM-DD\x20HH:mm:ss')]}},'attributes':['type',_0xcc87('0x10'),_0xcc87('0x11'),_0xcc87('0x12')]},'log':'GetVoiceCallReports'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceDialReport.js b/server/services/ami/rpc/voiceDialReport.js index 9064e16..843c4bc 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 _0x2c1e=['Request','CreateVoiceDialReport','create'];(function(_0x59c1c3,_0x1de385){var _0x293608=function(_0x3b2a1d){while(--_0x3b2a1d){_0x59c1c3['push'](_0x59c1c3['shift']());}};_0x293608(++_0x1de385);}(_0x2c1e,0x1c4));var _0xe2c1=function(_0x2c57a4,_0x168ff4){_0x2c57a4=_0x2c57a4-0x0;var _0x189879=_0x2c1e[_0x2c57a4];return _0x189879;};'use strict';var client=require('../client');exports[_0xe2c1('0x0')]=function(_0x4ee34){return client[_0xe2c1('0x1')](_0xe2c1('0x2'),{'body':_0x4ee34,'log':_0xe2c1('0x2')});}; \ No newline at end of file +var _0x9810=['create','Request','CreateVoiceDialReport','../client'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9810,0x1d3));var _0x0981=function(_0x87239,_0x38c793){_0x87239=_0x87239-0x0;var _0x53af1e=_0x9810[_0x87239];return _0x53af1e;};'use strict';var client=require(_0x0981('0x0'));exports[_0x0981('0x1')]=function(_0x493ce0){return client[_0x0981('0x2')](_0x0981('0x3'),{'body':_0x493ce0,'log':_0x0981('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceExtension.js b/server/services/ami/rpc/voiceExtension.js index a8a71e6..9faa0a1 100644 --- a/server/services/ami/rpc/voiceExtension.js +++ b/server/services/ami/rpc/voiceExtension.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8c38=['recordingFormat','../client','getVoiceExtensions','GetVoiceExtension','exten'];(function(_0x199edc,_0x3d8798){var _0x31c828=function(_0x1dcf55){while(--_0x1dcf55){_0x199edc['push'](_0x199edc['shift']());}};_0x31c828(++_0x3d8798);}(_0x8c38,0x83));var _0x88c3=function(_0x357845,_0x2f1576){_0x357845=_0x357845-0x0;var _0x54cdca=_0x8c38[_0x357845];return _0x54cdca;};'use strict';var client=require(_0x88c3('0x0'));exports[_0x88c3('0x1')]=function(){return function(){return client['Request'](_0x88c3('0x2'),{'options':{'raw':!![],'attributes':['id',_0x88c3('0x3'),_0x88c3('0x4')],'where':{'VoiceExtensionId':null}},'log':_0x88c3('0x1')});};}; \ No newline at end of file +var _0x8c38=['recordingFormat','../client','getVoiceExtensions','GetVoiceExtension','exten'];(function(_0x23555e,_0x2b5362){var _0x1991ef=function(_0x82f1a8){while(--_0x82f1a8){_0x23555e['push'](_0x23555e['shift']());}};_0x1991ef(++_0x2b5362);}(_0x8c38,0x83));var _0x88c3=function(_0x19e552,_0x20c618){_0x19e552=_0x19e552-0x0;var _0x4542d5=_0x8c38[_0x19e552];return _0x4542d5;};'use strict';var client=require(_0x88c3('0x0'));exports[_0x88c3('0x1')]=function(){return function(){return client['Request'](_0x88c3('0x2'),{'options':{'raw':!![],'attributes':['id',_0x88c3('0x3'),_0x88c3('0x4')],'where':{'VoiceExtensionId':null}},'log':_0x88c3('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueue.js b/server/services/ami/rpc/voiceQueue.js index 9dfa166..7023875 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 _0x69bd=['dialRecallMeTimeout','dialRecallInQueue','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','dialQueueProject2','monitor_format','strategy','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropRetryFrequency','dialAbandonedMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','Trunk','callerid','active','Pause','TrunkBackup','Interval','Intervals','interval','../client','getVoiceQueues','Request','GetVoiceQueue','name','acw','dialMethod','dialLimitChannel','dialPredictiveOptimization','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerRetryFrequency','dialTimezone','dialGlobalInterval','dialCheckDuplicateType','dialAMDActive','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','timeout'];(function(_0x37c8ef,_0x334449){var _0x5eaee9=function(_0x4b1b98){while(--_0x4b1b98){_0x37c8ef['push'](_0x37c8ef['shift']());}};_0x5eaee9(++_0x334449);}(_0x69bd,0xc9));var _0xd69b=function(_0x422905,_0x3bce3a){_0x422905=_0x422905-0x0;var _0x33dc6c=_0x69bd[_0x422905];return _0x33dc6c;};'use strict';var client=require(_0xd69b('0x0'));exports[_0xd69b('0x1')]=function(){return function(){return client[_0xd69b('0x2')](_0xd69b('0x3'),{'options':{'raw':![],'attributes':['id',_0xd69b('0x4'),_0xd69b('0x5'),'acwTimeout','autopause','monitor_format','type','dialActive',_0xd69b('0x6'),_0xd69b('0x7'),'dialLimitQueue','dialPowerLevel',_0xd69b('0x8'),'dialPredictiveOptimizationPercentage',_0xd69b('0x9'),_0xd69b('0xa'),_0xd69b('0xb'),_0xd69b('0xc'),_0xd69b('0xd'),_0xd69b('0xe'),_0xd69b('0xf'),_0xd69b('0x10'),'dialCongestionRetryFrequency',_0xd69b('0x11'),_0xd69b('0x12'),'dialNoAnswerMaxRetry',_0xd69b('0x13'),'dialGlobalMaxRetry',_0xd69b('0x14'),_0xd69b('0x15'),'dialPrefix',_0xd69b('0x16'),_0xd69b('0x17'),'dialAMDInitialSilence',_0xd69b('0x18'),_0xd69b('0x19'),'dialAMDTotalAnalysisTime','dialAMDMinWordLength',_0xd69b('0x1a'),_0xd69b('0x1b'),_0xd69b('0x1c'),_0xd69b('0x1d'),_0xd69b('0x1e'),_0xd69b('0x1f'),_0xd69b('0x20'),_0xd69b('0x21'),_0xd69b('0x22'),_0xd69b('0x23'),_0xd69b('0x24'),_0xd69b('0x25'),_0xd69b('0x26'),_0xd69b('0x27'),_0xd69b('0x28'),_0xd69b('0x29'),_0xd69b('0x2a'),'dialDropMaxRetry',_0xd69b('0x2b'),_0xd69b('0x2c'),'dialAbandonedRetryFrequency','dialMachineMaxRetry',_0xd69b('0x2d'),_0xd69b('0x2e'),_0xd69b('0x2f'),_0xd69b('0x30'),_0xd69b('0x31'),'dialPredictiveIntervalMinThreshold'],'include':[{'model':_0xd69b('0x32'),'as':'Trunk','attributes':['id',_0xd69b('0x4'),_0xd69b('0x33'),_0xd69b('0x34')]},{'model':_0xd69b('0x35'),'as':'mandatoryDispositionPause','attributes':['id',_0xd69b('0x4')]},{'model':_0xd69b('0x32'),'as':_0xd69b('0x36'),'attributes':['id','name','callerid',_0xd69b('0x34')]},{'model':'Interval','as':'Interval','attributes':['id','name'],'include':[{'model':_0xd69b('0x37'),'as':_0xd69b('0x38'),'attributes':['id',_0xd69b('0x4'),_0xd69b('0x39')]}]}]},'log':_0xd69b('0x1')});};}; \ No newline at end of file +var _0xecf3=['Intervals','interval','getVoiceQueues','GetVoiceQueue','name','acw','acwTimeout','autopause','monitor_format','type','dialActive','dialMethod','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialCheckDuplicateType','dialAMDActive','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDSilenceThreshold','dialAMDMaximumWordLength','timeout','dialRecallMeTimeout','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','dialQueueProject2','dialCutDigit','dialNoSuchNumberMaxRetry','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','Trunk','callerid','Pause','mandatoryDispositionPause','TrunkBackup','active','Interval'];(function(_0x35d568,_0x4d47ae){var _0x5dac84=function(_0x265aaf){while(--_0x265aaf){_0x35d568['push'](_0x35d568['shift']());}};_0x5dac84(++_0x4d47ae);}(_0xecf3,0x13d));var _0x3ecf=function(_0x10bc02,_0x24724d){_0x10bc02=_0x10bc02-0x0;var _0x5a2bbf=_0xecf3[_0x10bc02];return _0x5a2bbf;};'use strict';var client=require('../client');exports[_0x3ecf('0x0')]=function(){return function(){return client['Request'](_0x3ecf('0x1'),{'options':{'raw':![],'attributes':['id',_0x3ecf('0x2'),_0x3ecf('0x3'),_0x3ecf('0x4'),_0x3ecf('0x5'),_0x3ecf('0x6'),_0x3ecf('0x7'),_0x3ecf('0x8'),_0x3ecf('0x9'),'dialLimitChannel',_0x3ecf('0xa'),_0x3ecf('0xb'),_0x3ecf('0xc'),_0x3ecf('0xd'),_0x3ecf('0xe'),'dialOriginateCallerIdName',_0x3ecf('0xf'),_0x3ecf('0x10'),_0x3ecf('0x11'),_0x3ecf('0x12'),_0x3ecf('0x13'),_0x3ecf('0x14'),_0x3ecf('0x15'),_0x3ecf('0x16'),_0x3ecf('0x17'),_0x3ecf('0x18'),_0x3ecf('0x19'),_0x3ecf('0x1a'),'dialTimezone','dialGlobalInterval','dialPrefix',_0x3ecf('0x1b'),_0x3ecf('0x1c'),'dialAMDInitialSilence',_0x3ecf('0x1d'),_0x3ecf('0x1e'),_0x3ecf('0x1f'),_0x3ecf('0x20'),_0x3ecf('0x21'),'dialAMDMaximumNumberOfWords',_0x3ecf('0x22'),_0x3ecf('0x23'),_0x3ecf('0x24'),_0x3ecf('0x25'),'dialRecallInQueue',_0x3ecf('0x26'),_0x3ecf('0x27'),_0x3ecf('0x28'),_0x3ecf('0x29'),_0x3ecf('0x6'),'strategy','dialRandomLastDigitCallerIdNumber',_0x3ecf('0x2a'),_0x3ecf('0x2b'),'dialNoSuchNumberRetryFrequency',_0x3ecf('0x2c'),_0x3ecf('0x2d'),_0x3ecf('0x2e'),_0x3ecf('0x2f'),_0x3ecf('0x30'),_0x3ecf('0x31'),_0x3ecf('0x32'),_0x3ecf('0x33'),_0x3ecf('0x34'),_0x3ecf('0x35'),'dialPredictiveIntervalMinThreshold'],'include':[{'model':'Trunk','as':_0x3ecf('0x36'),'attributes':['id',_0x3ecf('0x2'),_0x3ecf('0x37'),'active']},{'model':_0x3ecf('0x38'),'as':_0x3ecf('0x39'),'attributes':['id',_0x3ecf('0x2')]},{'model':_0x3ecf('0x36'),'as':_0x3ecf('0x3a'),'attributes':['id',_0x3ecf('0x2'),'callerid',_0x3ecf('0x3b')]},{'model':_0x3ecf('0x3c'),'as':_0x3ecf('0x3c'),'attributes':['id',_0x3ecf('0x2')],'include':[{'model':_0x3ecf('0x3c'),'as':_0x3ecf('0x3d'),'attributes':['id','name',_0x3ecf('0x3e')]}]}]},'log':_0x3ecf('0x0')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueReport.js b/server/services/ami/rpc/voiceQueueReport.js index b4132e1..24e67fd 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(_0x427de6,_0x76fbe5){var _0x263970=function(_0x1d69fd){while(--_0x1d69fd){_0x427de6['push'](_0x427de6['shift']());}};_0x263970(++_0x76fbe5);}(_0xa9e0,0x123));var _0x0a9e=function(_0x13ea00,_0x12f610){_0x13ea00=_0x13ea00-0x0;var _0x1f7347=_0xa9e0[_0x13ea00];return _0x1f7347;};'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(_0x802949,_0x769749){var _0x508ed6=function(_0x3a60ac){while(--_0x3a60ac){_0x802949['push'](_0x802949['shift']());}};_0x508ed6(++_0x769749);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3ce3c,_0x319337){_0x3ce3c=_0x3ce3c-0x0;var _0x55a2c9=_0xa9e0[_0x3ce3c];return _0x55a2c9;};'use strict';var moment=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));var client=require(_0x0a9e('0x2'));exports['create']=function(_0x550fbc){return client[_0x0a9e('0x3')]('CreateVoiceQueueReport',{'body':_0x550fbc,'log':_0x0a9e('0x4')});};exports[_0x0a9e('0x5')]=function(){return function(){return client[_0x0a9e('0x3')](_0x0a9e('0x6'),{'options':{'where':{'createdAt':{'$between':[moment()[_0x0a9e('0x7')]('day')[_0x0a9e('0x8')](_0x0a9e('0x9')),moment()[_0x0a9e('0xa')]('day')['format'](_0x0a9e('0x9'))]}},'attributes':['uniqueid','queue',_0x0a9e('0xb'),_0x0a9e('0xc'),_0x0a9e('0xd'),_0x0a9e('0xe'),_0x0a9e('0xf'),_0x0a9e('0x10'),'queuecallerabandon','queuecallerabandonAt']},'log':'GetVoiceQueueReports'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueRt.js b/server/services/ami/rpc/voiceQueueRt.js index 86ba9eb..ccec5d1 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 _0xe9a3=['GetVoiceQueueRtPauses','../client','getVoiceQueueRtPauses','Request'];(function(_0x57c1de,_0x3ee720){var _0x33f233=function(_0x5345e0){while(--_0x5345e0){_0x57c1de['push'](_0x57c1de['shift']());}};_0x33f233(++_0x3ee720);}(_0xe9a3,0x1e9));var _0x3e9a=function(_0x181151,_0x1fab2a){_0x181151=_0x181151-0x0;var _0x363870=_0xe9a3[_0x181151];return _0x363870;};'use strict';var client=require(_0x3e9a('0x0'));exports[_0x3e9a('0x1')]=function(_0x5beb2e){return function(){return client[_0x3e9a('0x2')](_0x3e9a('0x3'),{'options':{'where':{'VoiceQueueId':_0x5beb2e,'paused':!![]},'raw':!![]},'log':_0x3e9a('0x1')});};}; \ No newline at end of file +var _0x8921=['getVoiceQueueRtPauses','Request','GetVoiceQueueRtPauses','../client'];(function(_0x33f6fb,_0x41d20f){var _0x42fc14=function(_0x2eb75b){while(--_0x2eb75b){_0x33f6fb['push'](_0x33f6fb['shift']());}};_0x42fc14(++_0x41d20f);}(_0x8921,0x177));var _0x1892=function(_0x2ce5b1,_0x26f163){_0x2ce5b1=_0x2ce5b1-0x0;var _0x4ba99e=_0x8921[_0x2ce5b1];return _0x4ba99e;};'use strict';var client=require(_0x1892('0x0'));exports[_0x1892('0x1')]=function(_0x8997bf){return function(){return client[_0x1892('0x2')](_0x1892('0x3'),{'options':{'where':{'VoiceQueueId':_0x8997bf,'paused':!![]},'raw':!![]},'log':_0x1892('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceRecording.js b/server/services/ami/rpc/voiceRecording.js index 51d605c..c3878a9 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(_0x383c19,_0x1c7208){var _0x2498d3=function(_0x41bbc3){while(--_0x41bbc3){_0x383c19['push'](_0x383c19['shift']());}};_0x2498d3(++_0x1c7208);}(_0x7a54,0x106));var _0x47a5=function(_0x4b9e9c,_0x31c23f){_0x4b9e9c=_0x4b9e9c-0x0;var _0x18197c=_0x7a54[_0x4b9e9c];return _0x18197c;};'use strict';var _=require(_0x47a5('0x0'));var client=require(_0x47a5('0x1'));exports[_0x47a5('0x2')]=function(_0x58157c){return client[_0x47a5('0x3')](_0x47a5('0x4'),{'body':_['merge'](_0x58157c,{'value':_0x58157c[_0x47a5('0x5')]}),'log':_0x47a5('0x4')});}; \ No newline at end of file +var _0x7a54=['create','Request','CreateVoiceRecording','monitorFilename','lodash','../client'];(function(_0x323f85,_0x1beb12){var _0x1de722=function(_0x4f6134){while(--_0x4f6134){_0x323f85['push'](_0x323f85['shift']());}};_0x1de722(++_0x1beb12);}(_0x7a54,0x106));var _0x47a5=function(_0x152162,_0x1ac321){_0x152162=_0x152162-0x0;var _0x3d23be=_0x7a54[_0x152162];return _0x3d23be;};'use strict';var _=require(_0x47a5('0x0'));var client=require(_0x47a5('0x1'));exports[_0x47a5('0x2')]=function(_0x58157c){return client[_0x47a5('0x3')](_0x47a5('0x4'),{'body':_['merge'](_0x58157c,{'value':_0x58157c[_0x47a5('0x5')]}),'log':_0x47a5('0x4')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceTransferReport.js b/server/services/ami/rpc/voiceTransferReport.js index e452f45..181d218 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 _0x90f4=['transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','origtransferercontext','attended','blindTransfer','Request','CreateVoiceTransferReport','result','transfererchannel','transferercalleridnum','transferercalleridname','transfererconnectedlinenum','transfererconnectedlinename','transfereraccountcode','transferercontext','transfererexten','transfererlinkedid','transfereecalleridname','transfereeconnectedlinename','transfereeaccountcode','transfereelinkedid','isexternal','context','extension','blind','origtransfererchannel','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','transfertargetchannel'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0x90f4,0xb0));var _0x490f=function(_0x18d9bb,_0x46e4ab){_0x18d9bb=_0x18d9bb-0x0;var _0x2dd06f=_0x90f4[_0x18d9bb];return _0x2dd06f;};'use strict';var client=require('../client');exports['transfers']={};exports[_0x490f('0x0')]=function(_0x42b7e2){return client[_0x490f('0x1')](_0x490f('0x2'),{'body':{'result':_0x42b7e2[_0x490f('0x3')],'transfererchannel':_0x42b7e2[_0x490f('0x4')],'transferercalleridnum':_0x42b7e2[_0x490f('0x5')],'transferercalleridname':_0x42b7e2[_0x490f('0x6')],'transfererconnectedlinenum':_0x42b7e2[_0x490f('0x7')],'transfererconnectedlinename':_0x42b7e2[_0x490f('0x8')],'transfereraccountcode':_0x42b7e2[_0x490f('0x9')],'transferercontext':_0x42b7e2[_0x490f('0xa')],'transfererexten':_0x42b7e2[_0x490f('0xb')],'transfererlinkedid':_0x42b7e2[_0x490f('0xc')],'transfereechannel':_0x42b7e2['transfereechannel'],'transfereecalleridnum':_0x42b7e2['transfereecalleridnum'],'transfereecalleridname':_0x42b7e2[_0x490f('0xd')],'transfereeconnectedlinenum':_0x42b7e2['transfereeconnectedlinenum'],'transfereeconnectedlinename':_0x42b7e2[_0x490f('0xe')],'transfereeaccountcode':_0x42b7e2[_0x490f('0xf')],'transfereecontext':_0x42b7e2['transfereecontext'],'transfereeexten':_0x42b7e2['transfereeexten'],'transfereelinkedid':_0x42b7e2[_0x490f('0x10')],'isexternal':_0x42b7e2[_0x490f('0x11')],'context':_0x42b7e2[_0x490f('0x12')],'extension':_0x42b7e2[_0x490f('0x13')],'type':_0x490f('0x14')},'log':_0x490f('0x2')});};exports['attendedTransfer']=function(_0xeb7e48){return client[_0x490f('0x1')](_0x490f('0x2'),{'body':{'result':_0xeb7e48[_0x490f('0x3')],'transfererchannel':_0xeb7e48[_0x490f('0x15')],'transferercalleridnum':_0xeb7e48[_0x490f('0x16')],'transferercalleridname':_0xeb7e48[_0x490f('0x17')],'transfererconnectedlinenum':_0xeb7e48['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0xeb7e48[_0x490f('0x18')],'transfereraccountcode':_0xeb7e48[_0x490f('0x19')],'transferercontext':_0xeb7e48[_0x490f('0x1a')],'transfererexten':_0xeb7e48['secondtransfererexten'],'transfererlinkedid':_0xeb7e48['origtransfererlinkedid'],'transfereechannel':_0xeb7e48[_0x490f('0x1b')],'transfereecalleridnum':_0xeb7e48['transfertargetcalleridnum'],'transfereecalleridname':_0xeb7e48['transfertargetcalleridname'],'transfereeconnectedlinenum':_0xeb7e48[_0x490f('0x1c')],'transfereeconnectedlinename':_0xeb7e48[_0x490f('0x1d')],'transfereeaccountcode':_0xeb7e48[_0x490f('0x1e')],'transfereecontext':_0xeb7e48[_0x490f('0x1f')],'transfereeexten':_0xeb7e48['transfertargetexten'],'transfereelinkedid':_0xeb7e48['transfertargetlinkedid'],'isexternal':_0xeb7e48[_0x490f('0x11')],'context':_0xeb7e48[_0x490f('0x20')],'extension':_0xeb7e48['origtransfererexten'],'type':_0x490f('0x21')},'log':_0x490f('0x2')});}; \ No newline at end of file +var _0xa651=['Request','CreateVoiceTransferReport','result','transfererchannel','transferercalleridnum','transfererconnectedlinenum','transfererconnectedlinename','transfererexten','transfererlinkedid','transfereechannel','transfereecalleridnum','transfereeconnectedlinenum','transfereeaccountcode','transfereecontext','transfereeexten','transfereelinkedid','context','blind','attendedTransfer','origtransfererchannel','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinename','origtransfereraccountcode','origtransfererlinkedid','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','origtransferercontext','origtransfererexten','attended','../client','transfers','blindTransfer'];(function(_0x412200,_0x5735c6){var _0x140699=function(_0x184ec2){while(--_0x184ec2){_0x412200['push'](_0x412200['shift']());}};_0x140699(++_0x5735c6);}(_0xa651,0x135));var _0x1a65=function(_0x11ec09,_0x24e078){_0x11ec09=_0x11ec09-0x0;var _0x410d64=_0xa651[_0x11ec09];return _0x410d64;};'use strict';var client=require(_0x1a65('0x0'));exports[_0x1a65('0x1')]={};exports[_0x1a65('0x2')]=function(_0x106f43){return client[_0x1a65('0x3')](_0x1a65('0x4'),{'body':{'result':_0x106f43[_0x1a65('0x5')],'transfererchannel':_0x106f43[_0x1a65('0x6')],'transferercalleridnum':_0x106f43[_0x1a65('0x7')],'transferercalleridname':_0x106f43['transferercalleridname'],'transfererconnectedlinenum':_0x106f43[_0x1a65('0x8')],'transfererconnectedlinename':_0x106f43[_0x1a65('0x9')],'transfereraccountcode':_0x106f43['transfereraccountcode'],'transferercontext':_0x106f43['transferercontext'],'transfererexten':_0x106f43[_0x1a65('0xa')],'transfererlinkedid':_0x106f43[_0x1a65('0xb')],'transfereechannel':_0x106f43[_0x1a65('0xc')],'transfereecalleridnum':_0x106f43[_0x1a65('0xd')],'transfereecalleridname':_0x106f43['transfereecalleridname'],'transfereeconnectedlinenum':_0x106f43[_0x1a65('0xe')],'transfereeconnectedlinename':_0x106f43['transfereeconnectedlinename'],'transfereeaccountcode':_0x106f43[_0x1a65('0xf')],'transfereecontext':_0x106f43[_0x1a65('0x10')],'transfereeexten':_0x106f43[_0x1a65('0x11')],'transfereelinkedid':_0x106f43[_0x1a65('0x12')],'isexternal':_0x106f43['isexternal'],'context':_0x106f43[_0x1a65('0x13')],'extension':_0x106f43['extension'],'type':_0x1a65('0x14')},'log':_0x1a65('0x4')});};exports[_0x1a65('0x15')]=function(_0x4e1022){return client['Request'](_0x1a65('0x4'),{'body':{'result':_0x4e1022[_0x1a65('0x5')],'transfererchannel':_0x4e1022[_0x1a65('0x16')],'transferercalleridnum':_0x4e1022[_0x1a65('0x17')],'transferercalleridname':_0x4e1022[_0x1a65('0x18')],'transfererconnectedlinenum':_0x4e1022['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0x4e1022[_0x1a65('0x19')],'transfereraccountcode':_0x4e1022[_0x1a65('0x1a')],'transferercontext':_0x4e1022['secondtransferercontext'],'transfererexten':_0x4e1022['secondtransfererexten'],'transfererlinkedid':_0x4e1022[_0x1a65('0x1b')],'transfereechannel':_0x4e1022['transfertargetchannel'],'transfereecalleridnum':_0x4e1022[_0x1a65('0x1c')],'transfereecalleridname':_0x4e1022[_0x1a65('0x1d')],'transfereeconnectedlinenum':_0x4e1022[_0x1a65('0x1e')],'transfereeconnectedlinename':_0x4e1022[_0x1a65('0x1f')],'transfereeaccountcode':_0x4e1022[_0x1a65('0x20')],'transfereecontext':_0x4e1022[_0x1a65('0x21')],'transfereeexten':_0x4e1022[_0x1a65('0x22')],'transfereelinkedid':_0x4e1022[_0x1a65('0x23')],'isexternal':_0x4e1022['isexternal'],'context':_0x4e1022[_0x1a65('0x24')],'extension':_0x4e1022[_0x1a65('0x25')],'type':_0x1a65('0x26')},'log':_0x1a65('0x4')});}; \ No newline at end of file diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index 8b413cb..871b70d 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 _0xc9c3=['exten','context','trunks','outboundChannels','run','event','Event\x20name\x20mandatory','custom:','faxAccounts','send','checkAfterSend','http','log','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','jayson/promise','bluebird','moment','../../../config/environment','../properties','../ami','listen','format','%s/%s','SIP','name','timers','agents','updateStatusRealtime','pause','asterisk','username','ami\x20disconnected','join','pick','module','then','message','catch','error','command','action','Command','Action','content','voiceQueues','hasOwnProperty','strategy','loggedIn','pTalking','sumBillable','sumDuration','sumHoldTime','total','unmanaged','abandoned','waiting','loggedInDb','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','active','Interval','find','omit','undefined','values','channels','length','isConnected','voicechannel','validate','map','uniqueid','channel','wav','monitors','/var/spool/asterisk/monitor/','toLowerCase','isNil','push','YYYY-MM-DD\x20HH:mm:ss','mixmonitorid','rec','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','resolve','destinationchannel','StopMixMonitor','status','stop','%s.%s','filename','StopMixMonitor\x20Success','voicequeuechannel','voicequeuechannelhangup','queueChannels','Redirect'];(function(_0x4c1db4,_0x5548b7){var _0x3b463b=function(_0x335136){while(--_0x335136){_0x4c1db4['push'](_0x4c1db4['shift']());}};_0x3b463b(++_0x5548b7);}(_0xc9c3,0x96));var _0x3c9c=function(_0x2a2b9a,_0x51f9b3){_0x2a2b9a=_0x2a2b9a-0x0;var _0x2ea8e8=_0xc9c3[_0x2a2b9a];return _0x2ea8e8;};'use strict';var _=require('lodash');var util=require('util');var jayson=require(_0x3c9c('0x0'));var schema=require('validate');var BPromise=require(_0x3c9c('0x1'));var moment=require(_0x3c9c('0x2'));var config=require(_0x3c9c('0x3'));var properties=require(_0x3c9c('0x4'));var ami=require(_0x3c9c('0x5'));exports[_0x3c9c('0x6')]=function(_0x143bfe,_0x512e80,_0x48b219){return new BPromise(function(_0x5c86bd,_0x5a2836){var _0x3ca0ce={'QueuePause':function(_0xc35e75){return new Promise(function(_0x2eb946,_0x3e5ccb){var _0x355ef3=util[_0x3c9c('0x7')](_0x3c9c('0x8'),_0x3c9c('0x9'),_0xc35e75[_0x3c9c('0xa')]);if(_0x143bfe['timers']&&_0x143bfe[_0x3c9c('0xb')][_0x355ef3]&&_0x143bfe[_0x3c9c('0xb')][_0x355ef3]['timer']){_0x143bfe[_0x3c9c('0xb')][_0x355ef3]['updateAcw']();}if(_0x143bfe[_0x3c9c('0xc')][_0x355ef3]){_0x143bfe[_0x3c9c('0xc')][_0x355ef3][_0x3c9c('0xd')]({'statePause':_0xc35e75[_0x3c9c('0xe')]?!![]:![]});}_0x2eb946({'code':0xc8,'message':'QueuePause'});});},'Reload':function(_0x50cf96){var _0x4a60d9=this;return new Promise(function(_0x857b1f,_0x59bbc6){if(ami['isConnected']()==![]){return _0x59bbc6(_0x4a60d9['error'](0x1f4,[config[_0x3c9c('0xf')]['ip'],config['asterisk'][_0x3c9c('0x10')],_0x3c9c('0x11')][_0x3c9c('0x12')]('\x20')));}_0x50cf96=_[_0x3c9c('0x13')](_0x50cf96,_['keys'](properties[_0x3c9c('0x14')]));_0x50cf96['action']='Reload';return ami['Action'](_0x50cf96)[_0x3c9c('0x15')](function(_0x32d94a){_0x857b1f({'code':0xc8,'message':_0x32d94a[_0x3c9c('0x16')]});})[_0x3c9c('0x17')](function(_0x3e63e0){_0x59bbc6(_0x4a60d9[_0x3c9c('0x18')](0x1f5,_0x3e63e0[_0x3c9c('0x16')]));});});},'Command':function(_0x56fa79){var _0x15a90a=this;return new Promise(function(_0x4c7122,_0x461711){if(ami['isConnected']()==![]){return _0x461711(_0x15a90a[_0x3c9c('0x18')](0x1f4,[config[_0x3c9c('0xf')]['ip'],config['asterisk'][_0x3c9c('0x10')],_0x3c9c('0x11')][_0x3c9c('0x12')]('\x20')));}_0x56fa79=_['pick'](_0x56fa79,_0x3c9c('0x19'));_0x56fa79[_0x3c9c('0x1a')]=_0x3c9c('0x1b');return ami[_0x3c9c('0x1c')](_0x56fa79)[_0x3c9c('0x15')](function(_0x3bc5c4){_0x4c7122({'code':0xc8,'message':_0x3bc5c4[_0x3c9c('0x1d')]});})[_0x3c9c('0x17')](function(_0x509bf7){_0x461711(_0x15a90a[_0x3c9c('0x18')](0x1f5,_0x509bf7['message']));});});},'VoiceQueues':function(_0x497145){return new Promise(function(_0xe04fca,_0x4ca078){var _0x527bb9=[];for(var _0x379880 in _0x143bfe[_0x3c9c('0x1e')]){if(_0x143bfe[_0x3c9c('0x1e')][_0x3c9c('0x1f')](_0x379880)){var _0x4c283d=_0x143bfe[_0x3c9c('0x1e')][_0x379880];var _0x65b831={'id':_0x4c283d['id'],'name':_0x4c283d['name'],'strategy':_0x4c283d[_0x3c9c('0x20')],'answered':_0x4c283d['answered'],'available':_0x4c283d['available'],'loggedIn':_0x4c283d[_0x3c9c('0x21')],'pTalking':_0x4c283d[_0x3c9c('0x22')],'sumBillable':_0x4c283d[_0x3c9c('0x23')],'sumDuration':_0x4c283d[_0x3c9c('0x24')],'sumHoldTime':_0x4c283d[_0x3c9c('0x25')]||0x0,'talking':_0x4c283d['talking'],'total':_0x4c283d[_0x3c9c('0x26')],'type':_0x4c283d['type'],'unmanaged':_0x4c283d[_0x3c9c('0x27')],'abandoned':_0x4c283d[_0x3c9c('0x28')],'waiting':_0x4c283d[_0x3c9c('0x29')],'loggedInDb':_0x4c283d[_0x3c9c('0x2a')]};if(_0x4c283d['type']===_0x3c9c('0x2b')){_0x65b831[_0x3c9c('0x2c')]=_0x4c283d[_0x3c9c('0x2c')];_0x65b831[_0x3c9c('0x2d')]=_0x4c283d[_0x3c9c('0x2d')];_0x65b831[_0x3c9c('0x2e')]=_0x4c283d[_0x3c9c('0x2e')];_0x65b831[_0x3c9c('0x2f')]=_0x4c283d['dialOriginateCallerIdNumber'];_0x65b831[_0x3c9c('0x30')]=_0x4c283d[_0x3c9c('0x30')];_0x65b831[_0x3c9c('0x31')]=_0x4c283d[_0x3c9c('0x31')];_0x65b831[_0x3c9c('0x32')]=_0x4c283d[_0x3c9c('0x32')];_0x65b831[_0x3c9c('0x33')]=_0x4c283d[_0x3c9c('0x33')];_0x65b831[_0x3c9c('0x34')]=_0x4c283d[_0x3c9c('0x34')];_0x65b831[_0x3c9c('0x35')]=_0x4c283d[_0x3c9c('0x35')];_0x65b831[_0x3c9c('0x36')]=_0x4c283d[_0x3c9c('0x36')];_0x65b831['outboundCongestionCallsDay']=_0x4c283d[_0x3c9c('0x37')];_0x65b831[_0x3c9c('0x38')]=_0x4c283d[_0x3c9c('0x38')];_0x65b831['outboundDropCallsDayCallersExit']=_0x4c283d[_0x3c9c('0x39')];_0x65b831[_0x3c9c('0x3a')]=_0x4c283d[_0x3c9c('0x3a')];_0x65b831[_0x3c9c('0x3b')]=_0x4c283d['outboundNoAnswerCallsDay'];_0x65b831['outboundNoSuchCallsDay']=_0x4c283d[_0x3c9c('0x3c')];_0x65b831[_0x3c9c('0x3d')]=_0x4c283d[_0x3c9c('0x3d')];_0x65b831['outboundReCallsDay']=_0x4c283d['outboundReCallsDay'];_0x65b831[_0x3c9c('0x3e')]=_0x4c283d['outboundRejectCallsDay'];_0x65b831['outboundUnknownCallsDay']=_0x4c283d[_0x3c9c('0x3f')];_0x65b831[_0x3c9c('0x40')]=_0x4c283d[_0x3c9c('0x40')];_0x65b831['predictiveIntervalAvgHoldtime']=_0x4c283d[_0x3c9c('0x41')];_0x65b831[_0x3c9c('0x42')]=_0x4c283d[_0x3c9c('0x42')];_0x65b831['predictiveIntervalDroppedCallsCallersExit']=_0x4c283d['predictiveIntervalDroppedCallsCallersExit'];_0x65b831['predictiveIntervalDroppedCallsTimeout']=_0x4c283d[_0x3c9c('0x43')];_0x65b831[_0x3c9c('0x44')]=_0x4c283d[_0x3c9c('0x44')];_0x65b831[_0x3c9c('0x45')]=_0x4c283d[_0x3c9c('0x45')];_0x65b831[_0x3c9c('0x46')]=_0x4c283d['predictiveIntervalHitRate'];_0x65b831['predictiveIntervalMultiplicativeFactor']=_0x4c283d[_0x3c9c('0x47')];_0x65b831[_0x3c9c('0x48')]=_0x4c283d[_0x3c9c('0x48')];_0x65b831['predictiveIntervalAvailable']=_0x4c283d[_0x3c9c('0x49')];_0x65b831[_0x3c9c('0x4a')]=_0x4c283d[_0x3c9c('0x4a')];_0x65b831['message']=_0x4c283d['message'];_0x65b831[_0x3c9c('0x4b')]=_0x4c283d[_0x3c9c('0x4b')];_0x65b831[_0x3c9c('0x4c')]=_0x4c283d['erlangCalls'];_0x65b831[_0x3c9c('0x4d')]=_0x4c283d[_0x3c9c('0x4d')];_0x65b831[_0x3c9c('0x4e')]=_0x4c283d[_0x3c9c('0x4e')];_0x65b831['erlangBusyFactor']=_0x4c283d[_0x3c9c('0x4f')];_0x65b831[_0x3c9c('0x50')]=_0x4c283d['startPredictive'];_0x65b831['startProgressive']=_0x4c283d[_0x3c9c('0x51')];}if(_0x4c283d[_0x3c9c('0x52')]){_0x65b831['Trunk']={'id':_0x4c283d[_0x3c9c('0x52')]['id'],'name':_0x4c283d[_0x3c9c('0x52')][_0x3c9c('0xa')],'active':_0x4c283d[_0x3c9c('0x52')][_0x3c9c('0x53')],'callerid':_0x4c283d[_0x3c9c('0x52')]['callerid']};}if(_0x4c283d[_0x3c9c('0x54')]){_0x65b831[_0x3c9c('0x54')]={'id':_0x4c283d[_0x3c9c('0x54')]['id'],'name':_0x4c283d[_0x3c9c('0x54')][_0x3c9c('0xa')]};}_0x527bb9['push'](_0x65b831);}}_0xe04fca({'count':_0x527bb9['length'],'rows':_0x527bb9});});},'UpdateVoiceQueue':function(_0x55a6ba){return new Promise(function(_0x3ff47a,_0x1da3e7){var _0x25285d=_[_0x3c9c('0x55')](_0x143bfe['voiceQueues'],{'id':parseInt(_0x55a6ba['id'])});var _0x798651=_[_0x3c9c('0x56')](_0x55a6ba,['id']);if(_0x25285d){for(var _0x27a013 in _0x798651){if(typeof _0x798651[_0x27a013]!==_0x3c9c('0x57')&&typeof _0x25285d[_0x27a013]!==_0x3c9c('0x57')){_0x25285d[_0x27a013]=_0x798651[_0x27a013];}}_0x3ff47a(_0x25285d);}else{_0x1da3e7();}});},'VoiceChannels':function(_0x58f6b7){return new Promise(function(_0x184c22,_0x1177b3){var _0x1804e3=_[_0x3c9c('0x58')](_0x143bfe[_0x3c9c('0x59')]);_0x184c22({'count':_0x1804e3[_0x3c9c('0x5a')],'rows':_0x1804e3});});},'VoiceChannelMixMonitor':function(_0x475fd6){var _0x5a74ce=this;return new Promise(function(_0x260d3b,_0x3a59f9){if(ami[_0x3c9c('0x5b')]()==![]){return _0x3a59f9(_0x5a74ce[_0x3c9c('0x18')](0x1f4,[config[_0x3c9c('0xf')]['ip'],config[_0x3c9c('0xf')]['username'],_0x3c9c('0x11')][_0x3c9c('0x12')]('\x20')));}var _0x2b0691=schema(properties[_0x3c9c('0x5c')])[_0x3c9c('0x5d')](_0x475fd6);if(_0x2b0691[_0x3c9c('0x5a')]>0x0){return _0x3a59f9(_0x5a74ce[_0x3c9c('0x18')](0x1f4,_[_0x3c9c('0x5e')](_0x2b0691,_0x3c9c('0x16'))[_0x3c9c('0x12')](',\x20')));}var _0x39b9d8=_[_0x3c9c('0x55')](_0x143bfe[_0x3c9c('0x59')],{'uniqueid':_0x475fd6[_0x3c9c('0x5f')]});if(_0x39b9d8&&_0x39b9d8[_0x3c9c('0x60')]){var _0x2b022f=util['format']('%s.%s',_0x475fd6['filename']||_0x475fd6[_0x3c9c('0x5f')],_0x475fd6[_0x3c9c('0x7')]||_0x3c9c('0x61'));return ami[_0x3c9c('0x1c')]({'action':'MixMonitor','channel':_0x39b9d8[_0x3c9c('0x60')],'file':_0x2b022f,'options':'ai(mixmonitorid)'})['then'](function(_0x34cd84){var _0x2849c6=_[_0x3c9c('0x55')](_0x39b9d8[_0x3c9c('0x62')],{'filename':_0x3c9c('0x63')+_0x2b022f[_0x3c9c('0x64')]()});if(_[_0x3c9c('0x65')](_0x2849c6)){_0x39b9d8[_0x3c9c('0x62')][_0x3c9c('0x66')]({'filename':'/var/spool/asterisk/monitor/'+_0x2b022f[_0x3c9c('0x64')](),'createdAt':moment()[_0x3c9c('0x7')](_0x3c9c('0x67')),'mixmonitorid':_0x34cd84[_0x3c9c('0x68')],'status':_0x3c9c('0x69')});}else{_0x2849c6[_0x3c9c('0x68')]=_0x34cd84[_0x3c9c('0x68')];_0x2849c6['status']='rec';}_0x260d3b({'code':0xc8,'message':[_0x475fd6[_0x3c9c('0x5f')],_0x3c9c('0x6a'),_0x34cd84[_0x3c9c('0x68')]][_0x3c9c('0x12')]('\x20'),'mixmonitorid':_0x34cd84[_0x3c9c('0x68')]});})[_0x3c9c('0x17')](function(_0x287ca1){_0x3a59f9(_0x5a74ce[_0x3c9c('0x18')](0x1f5,[_0x475fd6[_0x3c9c('0x5f')],_0x287ca1[_0x3c9c('0x16')][_0x3c9c('0x64')]()][_0x3c9c('0x12')]('\x20')));});}else{return _0x3a59f9(_0x5a74ce[_0x3c9c('0x18')](0x1f5,_0x3c9c('0x6b')));}});},'VoiceChannelStopMixMonitor':function(_0x581523){var _0x423891=this;return new Promise(function(_0x4306fe,_0x1b6f0a){if(ami[_0x3c9c('0x5b')]()==![]){return _0x1b6f0a(_0x423891[_0x3c9c('0x18')](0x1f4,[config['asterisk']['ip'],config[_0x3c9c('0xf')][_0x3c9c('0x10')],'ami\x20disconnected']['join']('\x20')));}var _0x1d810d=schema(properties[_0x3c9c('0x5c')])['validate'](_0x581523);if(_0x1d810d[_0x3c9c('0x5a')]>0x0){return _0x1b6f0a(_0x423891[_0x3c9c('0x18')](0x1f4,_[_0x3c9c('0x5e')](_0x1d810d,_0x3c9c('0x16'))[_0x3c9c('0x12')](',\x20')));}var _0x2264b7=_[_0x3c9c('0x55')](_0x143bfe[_0x3c9c('0x59')],{'uniqueid':_0x581523[_0x3c9c('0x5f')]});if(_0x2264b7){return BPromise[_0x3c9c('0x6c')]()[_0x3c9c('0x15')](function(){if(_0x2264b7['channel']){return ami[_0x3c9c('0x1c')]({'action':'StopMixMonitor','channel':_0x2264b7['channel'],'mixmonitorid':_0x581523[_0x3c9c('0x68')]})[_0x3c9c('0x17')](function(_0x1a1485){});}})[_0x3c9c('0x15')](function(){if(_0x2264b7[_0x3c9c('0x6d')]){return ami[_0x3c9c('0x1c')]({'action':_0x3c9c('0x6e'),'channel':_0x2264b7['destinationchannel'],'mixmonitorid':_0x581523[_0x3c9c('0x68')]})[_0x3c9c('0x17')](function(_0x31fb57){});}})[_0x3c9c('0x15')](function(_0x1cfaea){var _0x4fb887=_['find'](_0x2264b7[_0x3c9c('0x62')],{'mixmonitorid':_0x581523[_0x3c9c('0x68')]});if(_0x4fb887){_0x4fb887[_0x3c9c('0x6f')]=_0x3c9c('0x70');}})[_0x3c9c('0x15')](function(){var _0x990934=util[_0x3c9c('0x7')](_0x3c9c('0x71'),_0x581523[_0x3c9c('0x72')]||_0x581523[_0x3c9c('0x5f')],_0x581523[_0x3c9c('0x7')]||_0x3c9c('0x61'));var _0x4311c0=_[_0x3c9c('0x55')](_0x2264b7[_0x3c9c('0x62')],{'filename':_0x3c9c('0x63')+_0x990934[_0x3c9c('0x64')]()});if(_0x4311c0){_0x4311c0['status']=_0x3c9c('0x70');}})['then'](function(){_0x4306fe({'code':0xc8,'message':[_0x581523['uniqueid'],_0x3c9c('0x73')][_0x3c9c('0x12')]('\x20')});})[_0x3c9c('0x17')](function(_0x4b1b16){_0x1b6f0a(_0x423891[_0x3c9c('0x18')](0x1f5,[_0x581523[_0x3c9c('0x5f')],_0x4b1b16['message'][_0x3c9c('0x64')]()][_0x3c9c('0x12')]('\x20')));});}else{return _0x1b6f0a(_0x423891['error'](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannels':function(_0x5e4146){return new Promise(function(_0x1e93d7,_0x2fc65b){var _0xbc5b78=_[_0x3c9c('0x58')](_0x143bfe['queueChannels']);_0x1e93d7({'count':_0xbc5b78['length'],'rows':_0xbc5b78});});},'VoiceQueuesChannel':function(_0x2f2628){var _0x2dc609=this;return new Promise(function(_0x260a90,_0x94bc44){var _0x4342a9=schema(properties[_0x3c9c('0x74')])[_0x3c9c('0x5d')](_0x2f2628);if(_0x4342a9[_0x3c9c('0x5a')]>0x0){return _0x94bc44(_0x2dc609[_0x3c9c('0x18')](0x1f4,_['map'](_0x4342a9,'message')[_0x3c9c('0x12')](',\x20')));}var _0x5cf82a=_['find'](_0x143bfe['queueChannels'],{'uniqueid':_0x2f2628[_0x3c9c('0x5f')]});if(_0x5cf82a){_0x260a90(_0x5cf82a);}else{return _0x94bc44(_0x2dc609[_0x3c9c('0x18')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannelHangup':function(_0x56effa){var _0x53ccaf=this;return new Promise(function(_0x482612,_0x77afb5){if(ami['isConnected']()==![]){return _0x77afb5(_0x53ccaf[_0x3c9c('0x18')](0x1f4,[config[_0x3c9c('0xf')]['ip'],config[_0x3c9c('0xf')]['username'],'ami\x20disconnected'][_0x3c9c('0x12')]('\x20')));}var _0x5ca292=schema(properties[_0x3c9c('0x75')])[_0x3c9c('0x5d')](_0x56effa);if(_0x5ca292[_0x3c9c('0x5a')]>0x0){return _0x77afb5(_0x53ccaf[_0x3c9c('0x18')](0x1f4,_['map'](_0x5ca292,_0x3c9c('0x16'))[_0x3c9c('0x12')](',\x20')));}var _0x5c1a13=_[_0x3c9c('0x55')](_0x143bfe[_0x3c9c('0x76')],{'uniqueid':_0x56effa['uniqueid']});if(_0x5c1a13&&_0x5c1a13[_0x3c9c('0x60')]){return ami[_0x3c9c('0x1c')]({'action':'Hangup','channel':_0x5c1a13[_0x3c9c('0x60')]})[_0x3c9c('0x15')](function(_0xab562a){_0x482612({'code':0xc8,'message':[_0x56effa['uniqueid'],_0xab562a['message'][_0x3c9c('0x64')]()][_0x3c9c('0x12')]('\x20')});})['catch'](function(_0x386197){_0x77afb5(_0x53ccaf[_0x3c9c('0x18')](0x1f5,[_0x56effa[_0x3c9c('0x5f')],_0x386197['message'][_0x3c9c('0x64')]()][_0x3c9c('0x12')]('\x20')));});}else{return _0x77afb5(_0x53ccaf['error'](0x1f5,_0x3c9c('0x6b')));}});},'VoiceQueuesChannelRedirect':function(_0x2cb21d){var _0xc4b7c9=this;return new Promise(function(_0x3caddb,_0x1ecabd){if(ami[_0x3c9c('0x5b')]()==![]){return _0x1ecabd(_0xc4b7c9[_0x3c9c('0x18')](0x1f4,[config[_0x3c9c('0xf')]['ip'],config[_0x3c9c('0xf')][_0x3c9c('0x10')],'ami\x20disconnected'][_0x3c9c('0x12')]('\x20')));}var _0x150a27=schema(properties['voicequeuechannelredirect'])[_0x3c9c('0x5d')](_0x2cb21d);if(_0x150a27[_0x3c9c('0x5a')]>0x0){return _0x1ecabd(_0xc4b7c9['error'](0x1f4,_[_0x3c9c('0x5e')](_0x150a27,_0x3c9c('0x16'))[_0x3c9c('0x12')](',\x20')));}var _0x17d23e=_[_0x3c9c('0x55')](_0x143bfe['queueChannels'],{'uniqueid':_0x2cb21d[_0x3c9c('0x5f')]});if(_0x17d23e&&_0x17d23e[_0x3c9c('0x60')]){return ami[_0x3c9c('0x1c')]({'action':_0x3c9c('0x77'),'channel':_0x17d23e[_0x3c9c('0x60')],'exten':_0x2cb21d[_0x3c9c('0x78')],'context':_0x2cb21d[_0x3c9c('0x79')]||_0x17d23e[_0x3c9c('0x79')],'priority':0x1})[_0x3c9c('0x15')](function(_0x36018f){_0x3caddb({'code':0xc8,'message':[_0x2cb21d[_0x3c9c('0x5f')],_0x36018f[_0x3c9c('0x16')][_0x3c9c('0x64')]()]['join']('\x20')});})[_0x3c9c('0x17')](function(_0x296e46){_0x1ecabd(_0xc4b7c9['error'](0x1f5,[_0x2cb21d[_0x3c9c('0x5f')],_0x296e46[_0x3c9c('0x16')][_0x3c9c('0x64')]()]['join']('\x20')));});}else{return _0x1ecabd(_0xc4b7c9[_0x3c9c('0x18')](0x1f5,_0x3c9c('0x6b')));}});},'Agents':function(_0x21c7c3){return new Promise(function(_0x285ebc,_0x478572){var _0x773eea=_['values'](_0x143bfe[_0x3c9c('0xc')]);_0x285ebc({'count':_0x773eea['length'],'rows':_0x773eea});});},'Telephones':function(_0x2265e8){return new Promise(function(_0x48a57f,_0x4950c3){var _0x263270=_['values'](_0x143bfe['telephones']);_0x48a57f({'count':_0x263270[_0x3c9c('0x5a')],'rows':_0x263270});});},'Trunks':function(_0x2f3a98){return new Promise(function(_0x14ccbc,_0x9b3118){var _0x2f4e79=_[_0x3c9c('0x58')](_0x143bfe[_0x3c9c('0x7a')]);_0x14ccbc({'count':_0x2f4e79[_0x3c9c('0x5a')],'rows':_0x2f4e79});});},'OutboundChannels':function(_0x2e6b96){return new Promise(function(_0x13e236,_0x1528a6){var _0x570ae6=_['values'](_0x143bfe[_0x3c9c('0x7b')]);_0x13e236({'count':_0x570ae6['length'],'rows':_0x570ae6});});},'Outbound':function(_0x552ec1){return new Promise(function(_0x3bb0c1,_0x1838d7){_0x3bb0c1(_0x143bfe[_0x3c9c('0x2b')]);});},'Campaigns':function(_0x1748c7){return new Promise(function(_0x2dec50,_0x57746d){var _0x105e67=_[_0x3c9c('0x58')](_0x143bfe['campaigns']);_0x2dec50({'count':_0x105e67['length'],'rows':_0x105e67});});},'VoiceQueuesPreview':function(_0x308a24){var _0x5f42c1=this;return new Promise(function(_0x2e3cab,_0x1ceaa3){_0x512e80[_0x3c9c('0x7c')](_0x308a24['id'])[_0x3c9c('0x15')](function(_0x327e63){_0x2e3cab({'code':0xc8,'message':_0x327e63[_0x3c9c('0x16')]});})[_0x3c9c('0x17')](function(_0x18012e){_0x1ceaa3(_0x5f42c1[_0x3c9c('0x18')](0x1f4,_0x18012e[_0x3c9c('0x16')]));});});},'EventManager':function(_0x52af3a){var _0x32690f=this;return new Promise(function(_0x2f5738,_0xf6f1ea){if(!_0x52af3a[_0x3c9c('0x7d')]){return _0xf6f1ea(_0x32690f['error'](0x1f4,_0x3c9c('0x7e')));}ami['emit'](_0x3c9c('0x7f')+_0x52af3a[_0x3c9c('0x7d')],_0x52af3a['message']);_0x2f5738({'code':0xc8,'message':_0x52af3a});});},'FaxAccounts':function(_0x22d2bd){return new Promise(function(_0x4cd7b9,_0x49559f){var _0x3d34e3=_[_0x3c9c('0x58')](_0x143bfe[_0x3c9c('0x80')]);_0x4cd7b9({'count':_0x3d34e3[_0x3c9c('0x5a')],'rows':_0x3d34e3});});},'SendFax':function(_0x17e5ce){var _0x5c96ad=this;return new Promise(function(_0x3e2f73,_0x48c11d){_0x48b219[_0x3c9c('0x81')](_0x17e5ce)['then'](function(_0x12bb7b){_0x3e2f73({'code':0xc8,'message':_0x12bb7b[_0x3c9c('0x16')]});})[_0x3c9c('0x17')](function(_0x19db8a){_0x48c11d(_0x5c96ad[_0x3c9c('0x18')](0x1f4,_0x19db8a[_0x3c9c('0x16')]));});});},'CheckAfterSend':function(_0x1fe080){var _0x41c07b=this;return new Promise(function(_0x557dc6,_0xa1de30){_0x48b219[_0x3c9c('0x82')](_0x1fe080)[_0x3c9c('0x15')](function(_0x5614df){_0x557dc6({'code':0xc8,'message':_0x5614df[_0x3c9c('0x16')]});})[_0x3c9c('0x17')](function(_0x37d2b6){_0xa1de30(_0x41c07b[_0x3c9c('0x18')](0x1f4,_0x37d2b6[_0x3c9c('0x16')]));});});}};var _0xdfe4f7=jayson['server'](_0x3ca0ce)[_0x3c9c('0x83')]();_0xdfe4f7['on'](_0x3c9c('0x18'),function(_0x2e158c){return _0x5a2836(_0x2e158c);});_0xdfe4f7[_0x3c9c('0x6')](0x232a,'127.0.0.1',function(){console[_0x3c9c('0x84')](_0x3c9c('0x85'),0x232a);return _0x5c86bd(_0x3c9c('0x86')+0x232a);});});}; \ No newline at end of file +var _0xb511=['outboundCongestionCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','active','callerid','Interval','push','length','find','omit','undefined','values','channels','username','map','channel','filename','uniqueid','wav','ai(mixmonitorid)','monitors','/var/spool/asterisk/monitor/','toLowerCase','YYYY-MM-DD\x20HH:mm:ss','mixmonitorid','MixMonitor\x20Success','catch','Channel\x20doesn\x27t\x20exist','voicechannel','validate','StopMixMonitor','destinationchannel','stop','%s.%s','status','queueChannels','voicequeuechannelhangup','Hangup','Redirect','exten','context','telephones','trunks','outboundChannels','outbound','Event\x20name\x20mandatory','emit','custom:','faxAccounts','send','checkAfterSend','server','http','127.0.0.1','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','util','jayson/promise','bluebird','moment','../properties','../ami','listen','format','%s/%s','SIP','name','timers','timer','updateAcw','agents','pause','QueuePause','isConnected','asterisk','ami\x20disconnected','join','keys','module','action','Action','then','message','error','pick','command','content','voiceQueues','strategy','answered','available','loggedIn','sumBillable','sumDuration','sumHoldTime','total','type','unmanaged','abandoned','waiting','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay'];(function(_0x463b1c,_0x515717){var _0x3f79b9=function(_0x248bb1){while(--_0x248bb1){_0x463b1c['push'](_0x463b1c['shift']());}};_0x3f79b9(++_0x515717);}(_0xb511,0x165));var _0x1b51=function(_0xdabe57,_0xa9586){_0xdabe57=_0xdabe57-0x0;var _0x56de6d=_0xb511[_0xdabe57];return _0x56de6d;};'use strict';var _=require(_0x1b51('0x0'));var util=require(_0x1b51('0x1'));var jayson=require(_0x1b51('0x2'));var schema=require('validate');var BPromise=require(_0x1b51('0x3'));var moment=require(_0x1b51('0x4'));var config=require('../../../config/environment');var properties=require(_0x1b51('0x5'));var ami=require(_0x1b51('0x6'));exports[_0x1b51('0x7')]=function(_0x4d17ab,_0x14e88a,_0x463bec){return new BPromise(function(_0x506653,_0x475add){var _0x43c14c={'QueuePause':function(_0x5e7ece){return new Promise(function(_0xfa46a3,_0x1690c9){var _0x407a2f=util[_0x1b51('0x8')](_0x1b51('0x9'),_0x1b51('0xa'),_0x5e7ece[_0x1b51('0xb')]);if(_0x4d17ab[_0x1b51('0xc')]&&_0x4d17ab['timers'][_0x407a2f]&&_0x4d17ab[_0x1b51('0xc')][_0x407a2f][_0x1b51('0xd')]){_0x4d17ab[_0x1b51('0xc')][_0x407a2f][_0x1b51('0xe')]();}if(_0x4d17ab[_0x1b51('0xf')][_0x407a2f]){_0x4d17ab[_0x1b51('0xf')][_0x407a2f]['updateStatusRealtime']({'statePause':_0x5e7ece[_0x1b51('0x10')]?!![]:![]});}_0xfa46a3({'code':0xc8,'message':_0x1b51('0x11')});});},'Reload':function(_0x146dc0){var _0x119628=this;return new Promise(function(_0x3abd5c,_0x46c991){if(ami[_0x1b51('0x12')]()==![]){return _0x46c991(_0x119628['error'](0x1f4,[config[_0x1b51('0x13')]['ip'],config['asterisk']['username'],_0x1b51('0x14')][_0x1b51('0x15')]('\x20')));}_0x146dc0=_['pick'](_0x146dc0,_[_0x1b51('0x16')](properties[_0x1b51('0x17')]));_0x146dc0[_0x1b51('0x18')]='Reload';return ami[_0x1b51('0x19')](_0x146dc0)[_0x1b51('0x1a')](function(_0x24bfc1){_0x3abd5c({'code':0xc8,'message':_0x24bfc1[_0x1b51('0x1b')]});})['catch'](function(_0x238749){_0x46c991(_0x119628[_0x1b51('0x1c')](0x1f5,_0x238749[_0x1b51('0x1b')]));});});},'Command':function(_0x556762){var _0x5e222b=this;return new Promise(function(_0x1d67f3,_0x3ff992){if(ami['isConnected']()==![]){return _0x3ff992(_0x5e222b[_0x1b51('0x1c')](0x1f4,[config[_0x1b51('0x13')]['ip'],config['asterisk']['username'],_0x1b51('0x14')][_0x1b51('0x15')]('\x20')));}_0x556762=_[_0x1b51('0x1d')](_0x556762,_0x1b51('0x1e'));_0x556762['action']='Command';return ami[_0x1b51('0x19')](_0x556762)[_0x1b51('0x1a')](function(_0x4c6c6b){_0x1d67f3({'code':0xc8,'message':_0x4c6c6b[_0x1b51('0x1f')]});})['catch'](function(_0x4a2e45){_0x3ff992(_0x5e222b[_0x1b51('0x1c')](0x1f5,_0x4a2e45['message']));});});},'VoiceQueues':function(_0x1eac36){return new Promise(function(_0x2a720f,_0x54a526){var _0x1ba4d2=[];for(var _0x68cdfb in _0x4d17ab[_0x1b51('0x20')]){if(_0x4d17ab[_0x1b51('0x20')]['hasOwnProperty'](_0x68cdfb)){var _0x5559cf=_0x4d17ab[_0x1b51('0x20')][_0x68cdfb];var _0x1a6c68={'id':_0x5559cf['id'],'name':_0x5559cf[_0x1b51('0xb')],'strategy':_0x5559cf[_0x1b51('0x21')],'answered':_0x5559cf[_0x1b51('0x22')],'available':_0x5559cf[_0x1b51('0x23')],'loggedIn':_0x5559cf[_0x1b51('0x24')],'pTalking':_0x5559cf['pTalking'],'sumBillable':_0x5559cf[_0x1b51('0x25')],'sumDuration':_0x5559cf[_0x1b51('0x26')],'sumHoldTime':_0x5559cf[_0x1b51('0x27')]||0x0,'talking':_0x5559cf['talking'],'total':_0x5559cf[_0x1b51('0x28')],'type':_0x5559cf[_0x1b51('0x29')],'unmanaged':_0x5559cf[_0x1b51('0x2a')],'abandoned':_0x5559cf[_0x1b51('0x2b')],'waiting':_0x5559cf[_0x1b51('0x2c')],'loggedInDb':_0x5559cf[_0x1b51('0x2d')]};if(_0x5559cf[_0x1b51('0x29')]==='outbound'){_0x1a6c68[_0x1b51('0x2e')]=_0x5559cf[_0x1b51('0x2e')];_0x1a6c68[_0x1b51('0x2f')]=_0x5559cf[_0x1b51('0x2f')];_0x1a6c68[_0x1b51('0x30')]=_0x5559cf[_0x1b51('0x30')];_0x1a6c68[_0x1b51('0x31')]=_0x5559cf[_0x1b51('0x31')];_0x1a6c68[_0x1b51('0x32')]=_0x5559cf['dialOriginateTimeout'];_0x1a6c68[_0x1b51('0x33')]=_0x5559cf[_0x1b51('0x33')];_0x1a6c68['temp']=_0x5559cf[_0x1b51('0x34')];_0x1a6c68['outboundAnswerAgiCallsDay']=_0x5559cf[_0x1b51('0x35')];_0x1a6c68[_0x1b51('0x36')]=_0x5559cf[_0x1b51('0x36')];_0x1a6c68[_0x1b51('0x37')]=_0x5559cf['outboundBlacklistCallsDay'];_0x1a6c68[_0x1b51('0x38')]=_0x5559cf[_0x1b51('0x38')];_0x1a6c68[_0x1b51('0x39')]=_0x5559cf[_0x1b51('0x39')];_0x1a6c68['outboundDropCallsDayACS']=_0x5559cf['outboundDropCallsDayACS'];_0x1a6c68[_0x1b51('0x3a')]=_0x5559cf[_0x1b51('0x3a')];_0x1a6c68[_0x1b51('0x3b')]=_0x5559cf[_0x1b51('0x3b')];_0x1a6c68[_0x1b51('0x3c')]=_0x5559cf['outboundNoAnswerCallsDay'];_0x1a6c68[_0x1b51('0x3d')]=_0x5559cf[_0x1b51('0x3d')];_0x1a6c68[_0x1b51('0x3e')]=_0x5559cf[_0x1b51('0x3e')];_0x1a6c68[_0x1b51('0x3f')]=_0x5559cf[_0x1b51('0x3f')];_0x1a6c68['outboundRejectCallsDay']=_0x5559cf[_0x1b51('0x40')];_0x1a6c68[_0x1b51('0x41')]=_0x5559cf[_0x1b51('0x41')];_0x1a6c68[_0x1b51('0x42')]=_0x5559cf['predictiveIntervalAnsweredCalls'];_0x1a6c68[_0x1b51('0x43')]=_0x5559cf[_0x1b51('0x43')];_0x1a6c68[_0x1b51('0x44')]=_0x5559cf[_0x1b51('0x44')];_0x1a6c68['predictiveIntervalDroppedCallsCallersExit']=_0x5559cf[_0x1b51('0x45')];_0x1a6c68[_0x1b51('0x46')]=_0x5559cf[_0x1b51('0x46')];_0x1a6c68['predictiveIntervalErlangCalls']=_0x5559cf['predictiveIntervalErlangCalls'];_0x1a6c68[_0x1b51('0x47')]=_0x5559cf['predictiveIntervalErlangCallsDroppedCalls'];_0x1a6c68[_0x1b51('0x48')]=_0x5559cf['predictiveIntervalHitRate'];_0x1a6c68[_0x1b51('0x49')]=_0x5559cf[_0x1b51('0x49')];_0x1a6c68['predictiveIntervalPauses']=_0x5559cf[_0x1b51('0x4a')];_0x1a6c68['predictiveIntervalAvailable']=_0x5559cf[_0x1b51('0x4b')];_0x1a6c68[_0x1b51('0x4c')]=_0x5559cf[_0x1b51('0x4c')];_0x1a6c68[_0x1b51('0x1b')]=_0x5559cf[_0x1b51('0x1b')];_0x1a6c68[_0x1b51('0x4d')]=_0x5559cf['originated'];_0x1a6c68[_0x1b51('0x4e')]=_0x5559cf[_0x1b51('0x4e')];_0x1a6c68[_0x1b51('0x4f')]=_0x5559cf[_0x1b51('0x4f')];_0x1a6c68[_0x1b51('0x50')]=_0x5559cf[_0x1b51('0x50')];_0x1a6c68['erlangBusyFactor']=_0x5559cf[_0x1b51('0x51')];_0x1a6c68[_0x1b51('0x52')]=_0x5559cf[_0x1b51('0x52')];_0x1a6c68[_0x1b51('0x53')]=_0x5559cf[_0x1b51('0x53')];}if(_0x5559cf[_0x1b51('0x54')]){_0x1a6c68['Trunk']={'id':_0x5559cf[_0x1b51('0x54')]['id'],'name':_0x5559cf[_0x1b51('0x54')]['name'],'active':_0x5559cf[_0x1b51('0x54')][_0x1b51('0x55')],'callerid':_0x5559cf[_0x1b51('0x54')][_0x1b51('0x56')]};}if(_0x5559cf[_0x1b51('0x57')]){_0x1a6c68[_0x1b51('0x57')]={'id':_0x5559cf[_0x1b51('0x57')]['id'],'name':_0x5559cf[_0x1b51('0x57')][_0x1b51('0xb')]};}_0x1ba4d2[_0x1b51('0x58')](_0x1a6c68);}}_0x2a720f({'count':_0x1ba4d2[_0x1b51('0x59')],'rows':_0x1ba4d2});});},'UpdateVoiceQueue':function(_0xd27a41){return new Promise(function(_0x2732e8,_0x3e2921){var _0x526547=_[_0x1b51('0x5a')](_0x4d17ab[_0x1b51('0x20')],{'id':parseInt(_0xd27a41['id'])});var _0x94e9ff=_[_0x1b51('0x5b')](_0xd27a41,['id']);if(_0x526547){for(var _0x1a15b3 in _0x94e9ff){if(typeof _0x94e9ff[_0x1a15b3]!==_0x1b51('0x5c')&&typeof _0x526547[_0x1a15b3]!=='undefined'){_0x526547[_0x1a15b3]=_0x94e9ff[_0x1a15b3];}}_0x2732e8(_0x526547);}else{_0x3e2921();}});},'VoiceChannels':function(_0x3ef6af){return new Promise(function(_0x23035b,_0x43aef2){var _0x3a01d9=_[_0x1b51('0x5d')](_0x4d17ab[_0x1b51('0x5e')]);_0x23035b({'count':_0x3a01d9['length'],'rows':_0x3a01d9});});},'VoiceChannelMixMonitor':function(_0x3db7d3){var _0x16b0ec=this;return new Promise(function(_0xe39db8,_0x595cbc){if(ami[_0x1b51('0x12')]()==![]){return _0x595cbc(_0x16b0ec[_0x1b51('0x1c')](0x1f4,[config[_0x1b51('0x13')]['ip'],config[_0x1b51('0x13')][_0x1b51('0x5f')],_0x1b51('0x14')][_0x1b51('0x15')]('\x20')));}var _0x2d5a57=schema(properties['voicechannel'])['validate'](_0x3db7d3);if(_0x2d5a57['length']>0x0){return _0x595cbc(_0x16b0ec[_0x1b51('0x1c')](0x1f4,_[_0x1b51('0x60')](_0x2d5a57,'message')['join'](',\x20')));}var _0x56736b=_[_0x1b51('0x5a')](_0x4d17ab[_0x1b51('0x5e')],{'uniqueid':_0x3db7d3['uniqueid']});if(_0x56736b&&_0x56736b[_0x1b51('0x61')]){var _0x78b3f5=util[_0x1b51('0x8')]('%s.%s',_0x3db7d3[_0x1b51('0x62')]||_0x3db7d3[_0x1b51('0x63')],_0x3db7d3[_0x1b51('0x8')]||_0x1b51('0x64'));return ami['Action']({'action':'MixMonitor','channel':_0x56736b[_0x1b51('0x61')],'file':_0x78b3f5,'options':_0x1b51('0x65')})['then'](function(_0x2b0d49){var _0x18707e=_[_0x1b51('0x5a')](_0x56736b[_0x1b51('0x66')],{'filename':_0x1b51('0x67')+_0x78b3f5[_0x1b51('0x68')]()});if(_['isNil'](_0x18707e)){_0x56736b['monitors'][_0x1b51('0x58')]({'filename':_0x1b51('0x67')+_0x78b3f5[_0x1b51('0x68')](),'createdAt':moment()[_0x1b51('0x8')](_0x1b51('0x69')),'mixmonitorid':_0x2b0d49['mixmonitorid'],'status':'rec'});}else{_0x18707e[_0x1b51('0x6a')]=_0x2b0d49['mixmonitorid'];_0x18707e['status']='rec';}_0xe39db8({'code':0xc8,'message':[_0x3db7d3[_0x1b51('0x63')],_0x1b51('0x6b'),_0x2b0d49[_0x1b51('0x6a')]][_0x1b51('0x15')]('\x20'),'mixmonitorid':_0x2b0d49[_0x1b51('0x6a')]});})[_0x1b51('0x6c')](function(_0x36b520){_0x595cbc(_0x16b0ec[_0x1b51('0x1c')](0x1f5,[_0x3db7d3[_0x1b51('0x63')],_0x36b520[_0x1b51('0x1b')][_0x1b51('0x68')]()][_0x1b51('0x15')]('\x20')));});}else{return _0x595cbc(_0x16b0ec['error'](0x1f5,_0x1b51('0x6d')));}});},'VoiceChannelStopMixMonitor':function(_0x25b050){var _0x7b23ce=this;return new Promise(function(_0x2063c6,_0x875489){if(ami['isConnected']()==![]){return _0x875489(_0x7b23ce[_0x1b51('0x1c')](0x1f4,[config['asterisk']['ip'],config[_0x1b51('0x13')][_0x1b51('0x5f')],_0x1b51('0x14')][_0x1b51('0x15')]('\x20')));}var _0x3ddf0d=schema(properties[_0x1b51('0x6e')])[_0x1b51('0x6f')](_0x25b050);if(_0x3ddf0d['length']>0x0){return _0x875489(_0x7b23ce[_0x1b51('0x1c')](0x1f4,_['map'](_0x3ddf0d,_0x1b51('0x1b'))['join'](',\x20')));}var _0x4b8a15=_[_0x1b51('0x5a')](_0x4d17ab[_0x1b51('0x5e')],{'uniqueid':_0x25b050['uniqueid']});if(_0x4b8a15){return BPromise['resolve']()['then'](function(){if(_0x4b8a15[_0x1b51('0x61')]){return ami[_0x1b51('0x19')]({'action':_0x1b51('0x70'),'channel':_0x4b8a15[_0x1b51('0x61')],'mixmonitorid':_0x25b050[_0x1b51('0x6a')]})[_0x1b51('0x6c')](function(_0x41922f){});}})[_0x1b51('0x1a')](function(){if(_0x4b8a15[_0x1b51('0x71')]){return ami[_0x1b51('0x19')]({'action':_0x1b51('0x70'),'channel':_0x4b8a15['destinationchannel'],'mixmonitorid':_0x25b050['mixmonitorid']})[_0x1b51('0x6c')](function(_0x39d3ba){});}})[_0x1b51('0x1a')](function(_0x1353a9){var _0x5ba89d=_[_0x1b51('0x5a')](_0x4b8a15[_0x1b51('0x66')],{'mixmonitorid':_0x25b050[_0x1b51('0x6a')]});if(_0x5ba89d){_0x5ba89d['status']=_0x1b51('0x72');}})[_0x1b51('0x1a')](function(){var _0x19b760=util[_0x1b51('0x8')](_0x1b51('0x73'),_0x25b050[_0x1b51('0x62')]||_0x25b050[_0x1b51('0x63')],_0x25b050['format']||_0x1b51('0x64'));var _0x3b0af5=_[_0x1b51('0x5a')](_0x4b8a15['monitors'],{'filename':_0x1b51('0x67')+_0x19b760[_0x1b51('0x68')]()});if(_0x3b0af5){_0x3b0af5[_0x1b51('0x74')]=_0x1b51('0x72');}})[_0x1b51('0x1a')](function(){_0x2063c6({'code':0xc8,'message':[_0x25b050[_0x1b51('0x63')],'StopMixMonitor\x20Success'][_0x1b51('0x15')]('\x20')});})[_0x1b51('0x6c')](function(_0x3e72dc){_0x875489(_0x7b23ce['error'](0x1f5,[_0x25b050['uniqueid'],_0x3e72dc[_0x1b51('0x1b')]['toLowerCase']()]['join']('\x20')));});}else{return _0x875489(_0x7b23ce[_0x1b51('0x1c')](0x1f5,_0x1b51('0x6d')));}});},'VoiceQueuesChannels':function(_0x34336b){return new Promise(function(_0x2ccea1,_0x126ac1){var _0x35fe05=_['values'](_0x4d17ab[_0x1b51('0x75')]);_0x2ccea1({'count':_0x35fe05[_0x1b51('0x59')],'rows':_0x35fe05});});},'VoiceQueuesChannel':function(_0x30f64d){var _0x4d39b6=this;return new Promise(function(_0x4269f6,_0x2fad15){var _0xe37dc1=schema(properties['voicequeuechannel'])['validate'](_0x30f64d);if(_0xe37dc1[_0x1b51('0x59')]>0x0){return _0x2fad15(_0x4d39b6[_0x1b51('0x1c')](0x1f4,_[_0x1b51('0x60')](_0xe37dc1,_0x1b51('0x1b'))['join'](',\x20')));}var _0x5128a5=_[_0x1b51('0x5a')](_0x4d17ab['queueChannels'],{'uniqueid':_0x30f64d[_0x1b51('0x63')]});if(_0x5128a5){_0x4269f6(_0x5128a5);}else{return _0x2fad15(_0x4d39b6[_0x1b51('0x1c')](0x1f5,_0x1b51('0x6d')));}});},'VoiceQueuesChannelHangup':function(_0x549f69){var _0x71b46c=this;return new Promise(function(_0x31f9d9,_0x161af8){if(ami[_0x1b51('0x12')]()==![]){return _0x161af8(_0x71b46c[_0x1b51('0x1c')](0x1f4,[config[_0x1b51('0x13')]['ip'],config['asterisk'][_0x1b51('0x5f')],_0x1b51('0x14')]['join']('\x20')));}var _0x4ae114=schema(properties[_0x1b51('0x76')])[_0x1b51('0x6f')](_0x549f69);if(_0x4ae114[_0x1b51('0x59')]>0x0){return _0x161af8(_0x71b46c[_0x1b51('0x1c')](0x1f4,_['map'](_0x4ae114,_0x1b51('0x1b'))[_0x1b51('0x15')](',\x20')));}var _0x423a92=_[_0x1b51('0x5a')](_0x4d17ab[_0x1b51('0x75')],{'uniqueid':_0x549f69[_0x1b51('0x63')]});if(_0x423a92&&_0x423a92[_0x1b51('0x61')]){return ami['Action']({'action':_0x1b51('0x77'),'channel':_0x423a92[_0x1b51('0x61')]})['then'](function(_0x22c3c9){_0x31f9d9({'code':0xc8,'message':[_0x549f69[_0x1b51('0x63')],_0x22c3c9[_0x1b51('0x1b')][_0x1b51('0x68')]()]['join']('\x20')});})[_0x1b51('0x6c')](function(_0x9227f9){_0x161af8(_0x71b46c[_0x1b51('0x1c')](0x1f5,[_0x549f69[_0x1b51('0x63')],_0x9227f9[_0x1b51('0x1b')][_0x1b51('0x68')]()][_0x1b51('0x15')]('\x20')));});}else{return _0x161af8(_0x71b46c['error'](0x1f5,_0x1b51('0x6d')));}});},'VoiceQueuesChannelRedirect':function(_0x30b8a0){var _0x3e786c=this;return new Promise(function(_0x37b382,_0x46194a){if(ami['isConnected']()==![]){return _0x46194a(_0x3e786c[_0x1b51('0x1c')](0x1f4,[config[_0x1b51('0x13')]['ip'],config[_0x1b51('0x13')][_0x1b51('0x5f')],_0x1b51('0x14')][_0x1b51('0x15')]('\x20')));}var _0x8c050c=schema(properties['voicequeuechannelredirect'])['validate'](_0x30b8a0);if(_0x8c050c['length']>0x0){return _0x46194a(_0x3e786c[_0x1b51('0x1c')](0x1f4,_[_0x1b51('0x60')](_0x8c050c,_0x1b51('0x1b'))[_0x1b51('0x15')](',\x20')));}var _0x53de66=_[_0x1b51('0x5a')](_0x4d17ab[_0x1b51('0x75')],{'uniqueid':_0x30b8a0[_0x1b51('0x63')]});if(_0x53de66&&_0x53de66[_0x1b51('0x61')]){return ami[_0x1b51('0x19')]({'action':_0x1b51('0x78'),'channel':_0x53de66[_0x1b51('0x61')],'exten':_0x30b8a0[_0x1b51('0x79')],'context':_0x30b8a0['context']||_0x53de66[_0x1b51('0x7a')],'priority':0x1})[_0x1b51('0x1a')](function(_0x4d89f1){_0x37b382({'code':0xc8,'message':[_0x30b8a0[_0x1b51('0x63')],_0x4d89f1[_0x1b51('0x1b')]['toLowerCase']()][_0x1b51('0x15')]('\x20')});})[_0x1b51('0x6c')](function(_0x47ac6e){_0x46194a(_0x3e786c[_0x1b51('0x1c')](0x1f5,[_0x30b8a0['uniqueid'],_0x47ac6e[_0x1b51('0x1b')][_0x1b51('0x68')]()][_0x1b51('0x15')]('\x20')));});}else{return _0x46194a(_0x3e786c[_0x1b51('0x1c')](0x1f5,_0x1b51('0x6d')));}});},'Agents':function(_0x685925){return new Promise(function(_0x6d9b96,_0x40e315){var _0x58aead=_[_0x1b51('0x5d')](_0x4d17ab['agents']);_0x6d9b96({'count':_0x58aead[_0x1b51('0x59')],'rows':_0x58aead});});},'Telephones':function(_0x11ea3b){return new Promise(function(_0x1de9bd,_0x446563){var _0x1eaeeb=_[_0x1b51('0x5d')](_0x4d17ab[_0x1b51('0x7b')]);_0x1de9bd({'count':_0x1eaeeb[_0x1b51('0x59')],'rows':_0x1eaeeb});});},'Trunks':function(_0x409e71){return new Promise(function(_0x11af6f,_0x376b71){var _0x1fafbc=_['values'](_0x4d17ab[_0x1b51('0x7c')]);_0x11af6f({'count':_0x1fafbc['length'],'rows':_0x1fafbc});});},'OutboundChannels':function(_0x1e7c54){return new Promise(function(_0x51641d,_0x37a6c5){var _0x2a0645=_[_0x1b51('0x5d')](_0x4d17ab[_0x1b51('0x7d')]);_0x51641d({'count':_0x2a0645[_0x1b51('0x59')],'rows':_0x2a0645});});},'Outbound':function(_0x3d233d){return new Promise(function(_0x46119b,_0x32c072){_0x46119b(_0x4d17ab[_0x1b51('0x7e')]);});},'Campaigns':function(_0x3e9017){return new Promise(function(_0x22df69,_0x5ee437){var _0x464930=_['values'](_0x4d17ab['campaigns']);_0x22df69({'count':_0x464930[_0x1b51('0x59')],'rows':_0x464930});});},'VoiceQueuesPreview':function(_0x243934){var _0x281efc=this;return new Promise(function(_0x542e10,_0x16a99b){_0x14e88a['run'](_0x243934['id'])['then'](function(_0x33a575){_0x542e10({'code':0xc8,'message':_0x33a575[_0x1b51('0x1b')]});})[_0x1b51('0x6c')](function(_0x43d5d2){_0x16a99b(_0x281efc[_0x1b51('0x1c')](0x1f4,_0x43d5d2[_0x1b51('0x1b')]));});});},'EventManager':function(_0x20c1ea){var _0x31982c=this;return new Promise(function(_0x1f76d3,_0x2af6ac){if(!_0x20c1ea['event']){return _0x2af6ac(_0x31982c[_0x1b51('0x1c')](0x1f4,_0x1b51('0x7f')));}ami[_0x1b51('0x80')](_0x1b51('0x81')+_0x20c1ea['event'],_0x20c1ea['message']);_0x1f76d3({'code':0xc8,'message':_0x20c1ea});});},'FaxAccounts':function(_0x435b75){return new Promise(function(_0x551e1f,_0x56cd21){var _0x3e2b58=_[_0x1b51('0x5d')](_0x4d17ab[_0x1b51('0x82')]);_0x551e1f({'count':_0x3e2b58[_0x1b51('0x59')],'rows':_0x3e2b58});});},'SendFax':function(_0x1c4239){var _0x176299=this;return new Promise(function(_0x2f563a,_0x1d3dbb){_0x463bec[_0x1b51('0x83')](_0x1c4239)[_0x1b51('0x1a')](function(_0x5dc3e5){_0x2f563a({'code':0xc8,'message':_0x5dc3e5[_0x1b51('0x1b')]});})[_0x1b51('0x6c')](function(_0x482bc5){_0x1d3dbb(_0x176299['error'](0x1f4,_0x482bc5[_0x1b51('0x1b')]));});});},'CheckAfterSend':function(_0x3ea898){var _0x42734e=this;return new Promise(function(_0x2920c1,_0x1cf773){_0x463bec[_0x1b51('0x84')](_0x3ea898)['then'](function(_0x47fda3){_0x2920c1({'code':0xc8,'message':_0x47fda3['message']});})[_0x1b51('0x6c')](function(_0x4e3f14){_0x1cf773(_0x42734e[_0x1b51('0x1c')](0x1f4,_0x4e3f14[_0x1b51('0x1b')]));});});}};var _0x2ae6cc=jayson[_0x1b51('0x85')](_0x43c14c)[_0x1b51('0x86')]();_0x2ae6cc['on'](_0x1b51('0x1c'),function(_0x576cb6){return _0x475add(_0x576cb6);});_0x2ae6cc[_0x1b51('0x7')](0x232a,_0x1b51('0x87'),function(){console['log'](_0x1b51('0x88'),0x232a);return _0x506653(_0x1b51('0x89')+0x232a);});});}; \ No newline at end of file diff --git a/server/services/ami/trigger/cmContact/index.js b/server/services/ami/trigger/cmContact/index.js index 75ef17a..153948a 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 _0x5943=['length','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','join','data4','isNil','calleridname','Unknown','destcalleridname','','createContact','push','[CM][%s][%s]\x20Contact\x20created:%s','[CM][%s][%s]\x20Autocreate\x20disabled','format','name','trigger:%s','toLowerCase','lodash','bluebird','util','../../../../config/environment','../../../../config/logger','redis','defaults','socket.io-emitter','info','stringify','exec','data2','xmd-contactid','ListId','data3','split','phone','$or','map','routeId','destcalleridnum','calleridnum','firstName','mobile','fax','createdAt','scheduledAt','union','resolve','getContacts','then'];(function(_0x3899ec,_0x36caf){var _0x40d544=function(_0x1ad0f9){while(--_0x1ad0f9){_0x3899ec['push'](_0x3899ec['shift']());}};_0x40d544(++_0x36caf);}(_0x5943,0x77));var _0x3594=function(_0x27a8d7,_0x1c0842){_0x27a8d7=_0x27a8d7-0x0;var _0x106b72=_0x5943[_0x27a8d7];return _0x106b72;};'use strict';var _=require(_0x3594('0x0'));var BPromise=require(_0x3594('0x1'));var Redis=require('ioredis');var util=require(_0x3594('0x2'));var config=require(_0x3594('0x3'));var logger=require(_0x3594('0x4'))('trigger');var cmContactRpc=require('../../rpc/cmContact');config[_0x3594('0x5')]=_[_0x3594('0x6')](config[_0x3594('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0x3594('0x7'))(new Redis(config['redis']));function emit(_0x4db81c,_0x346520,_0x370cb4,_0x326094,_0x209070){logger[_0x3594('0x8')]('[CM][%s][%s]',_0x4db81c,_0x346520['id'],_0x370cb4,_0x326094,JSON[_0x3594('0x9')](_0x209070));io['to'](_0x370cb4)['emit'](_0x326094,_0x209070);}exports[_0x3594('0xa')]=function(_0x16e6c7,_0x22a0b5,_0x2f5ba1,_0x4cd4be){var _0x2d2cbc,_0xbca33;var _0x1fd4f4={};var _0x4eee25=Number(_0x2f5ba1['data1']);var _0x5cf63b=_0x2f5ba1[_0x3594('0xb')]?Boolean(Number(_0x2f5ba1[_0x3594('0xb')])):![];var _0x3eebfb;if(_0x4cd4be['xmd-contactid']){_0x1fd4f4['id']=_0x4cd4be[_0x3594('0xc')];}if(!_0x1fd4f4['id']){_0x1fd4f4[_0x3594('0xd')]=_0x4eee25;_0x3eebfb=_0x2f5ba1[_0x3594('0xe')]&&_0x2f5ba1[_0x3594('0xe')]!=='0'?_0x2f5ba1[_0x3594('0xe')][_0x3594('0xf')](','):[_0x3594('0x10')];_0x1fd4f4[_0x3594('0x11')]=_[_0x3594('0x12')](_0x3eebfb,function(_0x3958ad){var _0x392467={};_0x392467[_0x3958ad]=_0x4cd4be[_0x3594('0x13')]?_0x4cd4be[_0x3594('0x14')]:_0x4cd4be[_0x3594('0x15')];return _0x392467;});}var _0x3467de=['id',_0x3594('0x16'),'lastName','phone',_0x3594('0x17'),_0x3594('0x18'),_0x3594('0xd'),_0x3594('0x19'),_0x3594('0x1a'),'updatedAt'];var _0x3d1c26=_[_0x3594('0x1b')](_0x3467de,_0x3eebfb);BPromise[_0x3594('0x1c')]()['then'](cmContactRpc[_0x3594('0x1d')]({'attributes':_0x3d1c26,'where':_0x1fd4f4}))[_0x3594('0x1e')](function(_0xfb4000){_0xbca33=_0xfb4000;if(!_['isEmpty'](_0xbca33)){if(_0xbca33[_0x3594('0x1f')]===0x1){_0x2d2cbc=_0xbca33[0x0];logger['info'](_0x3594('0x20'),_0x4cd4be[_0x3594('0x21')],_0x22a0b5['id'],_0x2d2cbc['id']);}else{logger[_0x3594('0x8')](_0x3594('0x22'),_0x4cd4be[_0x3594('0x21')],_0x22a0b5['id'],_[_0x3594('0x12')](_0xbca33,'id')[_0x3594('0x23')](','));}return;}else{logger[_0x3594('0x8')]('[CM][%s][%s]\x20Contact\x20not\x20found',_0x4cd4be[_0x3594('0x21')],_0x22a0b5['id']);var _0x45c227={'ListId':_0x4eee25};var _0x462da0=_0x2f5ba1['data4']&&_0x2f5ba1['data4']!=='0'?_0x2f5ba1[_0x3594('0x24')]:_0x3594('0x10');if(_0x5cf63b){logger['info']('[CM][%s][%s]\x20Autocreate\x20enabled',_0x4cd4be['uniqueid'],_0x22a0b5['id']);_0x45c227[_0x462da0]=_[_0x3594('0x25')](_0x4cd4be[_0x3594('0x13')])?_0x4cd4be[_0x3594('0x15')]:_0x4cd4be[_0x3594('0x14')];if(_['isNil'](_0x4cd4be[_0x3594('0x13')])){_0x45c227[_0x3594('0x16')]=_0x4cd4be['calleridname']&&_0x4cd4be[_0x3594('0x26')]!==''?_0x4cd4be[_0x3594('0x26')]:_0x3594('0x27');}else{_0x45c227['firstName']=_0x4cd4be[_0x3594('0x28')]&&_0x4cd4be[_0x3594('0x28')]!==_0x3594('0x29')?_0x4cd4be[_0x3594('0x28')]:_0x3594('0x27');}return BPromise[_0x3594('0x1c')]()['then'](cmContactRpc[_0x3594('0x2a')](_0x45c227))[_0x3594('0x1e')](function(_0x27be7f){_0x2d2cbc=_0x27be7f;_0xbca33[_0x3594('0x2b')](_0x27be7f);if(_0x2d2cbc){logger[_0x3594('0x8')](_0x3594('0x2c'),_0x4cd4be[_0x3594('0x21')],_0x22a0b5['id'],_0x2d2cbc['id']);}return;});}else{logger['info'](_0x3594('0x2d'),_0x4cd4be[_0x3594('0x21')],_0x22a0b5['id']);_0x45c227[_0x462da0]=_[_0x3594('0x25')](_0x4cd4be['routeId'])?_0x4cd4be[_0x3594('0x15')]:_0x4cd4be[_0x3594('0x14')];if(_[_0x3594('0x25')](_0x4cd4be[_0x3594('0x13')])){_0x45c227[_0x3594('0x16')]=_0x4cd4be['calleridname']&&_0x4cd4be[_0x3594('0x26')]!==_0x3594('0x29')?_0x4cd4be[_0x3594('0x26')]:_0x3594('0x27');}else{_0x45c227[_0x3594('0x16')]=_0x4cd4be['destcalleridname']&&_0x4cd4be['destcalleridname']!==''?_0x4cd4be[_0x3594('0x28')]:_0x3594('0x27');}_0x2d2cbc=_0x45c227;_0xbca33[_0x3594('0x2b')](_0x45c227);return;}}})[_0x3594('0x1e')](function(){if(_0x16e6c7){emit(_0x4cd4be['uniqueid'],_0x22a0b5,util[_0x3594('0x2e')]('user:%s',_0x16e6c7[_0x3594('0x2f')]),util[_0x3594('0x2e')](_0x3594('0x30'),_0x2f5ba1['action'][_0x3594('0x31')]()),{'evt':_['merge'](_0x4cd4be,{'autoCreate':_0x5cf63b}),'contact':_0x2d2cbc===undefined?{}:_0x2d2cbc,'contacts':_0xbca33['length']===0x0?undefined:_0xbca33});}});}; \ No newline at end of file +var _0x099f=['phone','map','routeId','destcalleridnum','calleridnum','firstName','lastName','mobile','createdAt','scheduledAt','updatedAt','union','resolve','then','getContacts','isEmpty','length','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','join','data4','isNil','calleridname','','Unknown','destcalleridname','push','name','format','trigger:%s','action','toLowerCase','merge','lodash','bluebird','ioredis','util','trigger','../../rpc/cmContact','redis','defaults','localhost','socket.io-emitter','info','[CM][%s][%s]','data2','xmd-contactid','ListId','data3'];(function(_0x106a51,_0x7b2ebf){var _0x23f2a9=function(_0x4467d3){while(--_0x4467d3){_0x106a51['push'](_0x106a51['shift']());}};_0x23f2a9(++_0x7b2ebf);}(_0x099f,0x180));var _0xf099=function(_0x331b2f,_0xeca73d){_0x331b2f=_0x331b2f-0x0;var _0x1eda76=_0x099f[_0x331b2f];return _0x1eda76;};'use strict';var _=require(_0xf099('0x0'));var BPromise=require(_0xf099('0x1'));var Redis=require(_0xf099('0x2'));var util=require(_0xf099('0x3'));var config=require('../../../../config/environment');var logger=require('../../../../config/logger')(_0xf099('0x4'));var cmContactRpc=require(_0xf099('0x5'));config[_0xf099('0x6')]=_[_0xf099('0x7')](config[_0xf099('0x6')],{'host':_0xf099('0x8'),'port':0x18eb});var io=require(_0xf099('0x9'))(new Redis(config[_0xf099('0x6')]));function emit(_0x43fcdd,_0x552860,_0x792679,_0x45c49c,_0x1f0648){logger[_0xf099('0xa')](_0xf099('0xb'),_0x43fcdd,_0x552860['id'],_0x792679,_0x45c49c,JSON['stringify'](_0x1f0648));io['to'](_0x792679)['emit'](_0x45c49c,_0x1f0648);}exports['exec']=function(_0x3871cb,_0x1af8a5,_0x178c33,_0xfbf230){var _0xec8959,_0x501a5d;var _0x40a6ca={};var _0x4f8e57=Number(_0x178c33['data1']);var _0x2aaa05=_0x178c33[_0xf099('0xc')]?Boolean(Number(_0x178c33['data2'])):![];var _0x31e5a7;if(_0xfbf230[_0xf099('0xd')]){_0x40a6ca['id']=_0xfbf230[_0xf099('0xd')];}if(!_0x40a6ca['id']){_0x40a6ca[_0xf099('0xe')]=_0x4f8e57;_0x31e5a7=_0x178c33[_0xf099('0xf')]&&_0x178c33[_0xf099('0xf')]!=='0'?_0x178c33['data3']['split'](','):[_0xf099('0x10')];_0x40a6ca['$or']=_[_0xf099('0x11')](_0x31e5a7,function(_0x42682b){var _0x49f2ed={};_0x49f2ed[_0x42682b]=_0xfbf230[_0xf099('0x12')]?_0xfbf230[_0xf099('0x13')]:_0xfbf230[_0xf099('0x14')];return _0x49f2ed;});}var _0xce9fac=['id',_0xf099('0x15'),_0xf099('0x16'),_0xf099('0x10'),_0xf099('0x17'),'fax',_0xf099('0xe'),_0xf099('0x18'),_0xf099('0x19'),_0xf099('0x1a')];var _0x384efa=_[_0xf099('0x1b')](_0xce9fac,_0x31e5a7);BPromise[_0xf099('0x1c')]()[_0xf099('0x1d')](cmContactRpc[_0xf099('0x1e')]({'attributes':_0x384efa,'where':_0x40a6ca}))[_0xf099('0x1d')](function(_0x4964aa){_0x501a5d=_0x4964aa;if(!_[_0xf099('0x1f')](_0x501a5d)){if(_0x501a5d[_0xf099('0x20')]===0x1){_0xec8959=_0x501a5d[0x0];logger[_0xf099('0xa')](_0xf099('0x21'),_0xfbf230[_0xf099('0x22')],_0x1af8a5['id'],_0xec8959['id']);}else{logger[_0xf099('0xa')](_0xf099('0x23'),_0xfbf230['uniqueid'],_0x1af8a5['id'],_[_0xf099('0x11')](_0x501a5d,'id')[_0xf099('0x24')](','));}return;}else{logger[_0xf099('0xa')]('[CM][%s][%s]\x20Contact\x20not\x20found',_0xfbf230[_0xf099('0x22')],_0x1af8a5['id']);var _0x4015c0={'ListId':_0x4f8e57};var _0x559172=_0x178c33[_0xf099('0x25')]&&_0x178c33['data4']!=='0'?_0x178c33[_0xf099('0x25')]:_0xf099('0x10');if(_0x2aaa05){logger[_0xf099('0xa')]('[CM][%s][%s]\x20Autocreate\x20enabled',_0xfbf230[_0xf099('0x22')],_0x1af8a5['id']);_0x4015c0[_0x559172]=_[_0xf099('0x26')](_0xfbf230['routeId'])?_0xfbf230[_0xf099('0x14')]:_0xfbf230[_0xf099('0x13')];if(_['isNil'](_0xfbf230[_0xf099('0x12')])){_0x4015c0['firstName']=_0xfbf230['calleridname']&&_0xfbf230[_0xf099('0x27')]!==_0xf099('0x28')?_0xfbf230[_0xf099('0x27')]:_0xf099('0x29');}else{_0x4015c0['firstName']=_0xfbf230[_0xf099('0x2a')]&&_0xfbf230[_0xf099('0x2a')]!==_0xf099('0x28')?_0xfbf230[_0xf099('0x2a')]:'Unknown';}return BPromise[_0xf099('0x1c')]()['then'](cmContactRpc['createContact'](_0x4015c0))['then'](function(_0x52049c){_0xec8959=_0x52049c;_0x501a5d[_0xf099('0x2b')](_0x52049c);if(_0xec8959){logger[_0xf099('0xa')]('[CM][%s][%s]\x20Contact\x20created:%s',_0xfbf230[_0xf099('0x22')],_0x1af8a5['id'],_0xec8959['id']);}return;});}else{logger['info']('[CM][%s][%s]\x20Autocreate\x20disabled',_0xfbf230['uniqueid'],_0x1af8a5['id']);_0x4015c0[_0x559172]=_['isNil'](_0xfbf230[_0xf099('0x12')])?_0xfbf230[_0xf099('0x14')]:_0xfbf230[_0xf099('0x13')];if(_[_0xf099('0x26')](_0xfbf230['routeId'])){_0x4015c0[_0xf099('0x15')]=_0xfbf230[_0xf099('0x27')]&&_0xfbf230[_0xf099('0x27')]!==_0xf099('0x28')?_0xfbf230['calleridname']:_0xf099('0x29');}else{_0x4015c0['firstName']=_0xfbf230['destcalleridname']&&_0xfbf230[_0xf099('0x2a')]!==''?_0xfbf230[_0xf099('0x2a')]:_0xf099('0x29');}_0xec8959=_0x4015c0;_0x501a5d[_0xf099('0x2b')](_0x4015c0);return;}}})[_0xf099('0x1d')](function(){if(_0x3871cb){emit(_0xfbf230['uniqueid'],_0x1af8a5,util['format']('user:%s',_0x3871cb[_0xf099('0x2c')]),util[_0xf099('0x2d')](_0xf099('0x2e'),_0x178c33[_0xf099('0x2f')][_0xf099('0x30')]()),{'evt':_[_0xf099('0x31')](_0xfbf230,{'autoCreate':_0x2aaa05}),'contact':_0xec8959===undefined?{}:_0xec8959,'contacts':_0x501a5d[_0xf099('0x20')]===0x0?undefined:_0x501a5d});}});}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index ae89b2f..f7602b5 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 _0x886e=['ioredis','./urlforward','./cmContact','./script','../../../config/environment','../../../config/logger','trigger','../ami','redis','defaults','socket.io-emitter','popup','winapp','triggers','agents','voiceQueues','templates','voiceExtensions','zendeskAccounts','freshdeskAccounts','salesforceAccounts','sugarcrmAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','custom:agentcalled','syncCustomEvent','bind','custom:agentconnect','custom:agentringnoanswer','custom:agentcomplete','custom:agentnoanswer','custom:agentbusy','custom:agentcongestion','custom:queuecallerabandon','custom:timeout','custom:dialbegin','syncAgentDial','custom:dialconnect','custom:newinteraction','custom:closedinteraction','custom:incomingmessage','custom:outgoingmessage','custom:acceptmessage','custom:rejectmessage','prototype','emit','motionChannel','undefined','checkTriggers','interface','hasOwnProperty','checkTrigger','Actions','length','action','toLowerCase','contactmanager','browser','data1','TemplateId','html','data2','render','uri','isNil','data3','location','data4','windowWidth','data5','800','data6','600','winApplication','winArguments','user:%s','name','format','trigger:%s','merge','exec','integration','queue','routeId','urlforward','script','buildUri','parse','query','search','replace','channel','AllConditions','some','AnyConditions','checkConditions','account','chat','ChatWebsiteId','value','upperFirst','AccountId','interaction','event','operator','agent','membername','lastevent','exports','util','url'];(function(_0x5e5075,_0x254abf){var _0x54ae52=function(_0x3309ee){while(--_0x3309ee){_0x5e5075['push'](_0x5e5075['shift']());}};_0x54ae52(++_0x254abf);}(_0x886e,0x157));var _0xe886=function(_0x52df69,_0x45a692){_0x52df69=_0x52df69-0x0;var _0x4664df=_0x886e[_0x52df69];return _0x4664df;};'use strict';var util=require(_0xe886('0x0'));var _=require('lodash');var url=require(_0xe886('0x1'));var Mustache=require('mustache');var Redis=require(_0xe886('0x2'));var urlforward=require(_0xe886('0x3'));var integration=require('./integration');var cmContact=require(_0xe886('0x4'));var script=require(_0xe886('0x5'));var config=require(_0xe886('0x6'));var logger=require(_0xe886('0x7'))(_0xe886('0x8'));var ami=require(_0xe886('0x9'));config[_0xe886('0xa')]=_[_0xe886('0xb')](config[_0xe886('0xa')],{'host':'localhost','port':0x18eb});var io=require(_0xe886('0xc'))(new Redis(config['redis']));var operators={'equals':function(_0x55a0d3,_0x3794fe){return _0x55a0d3==_0x3794fe;},'not_equals':function(_0x165255,_0x102366){return _0x165255!=_0x102366;}};var barAndWebActions=[_0xe886('0xd'),_0xe886('0x1'),_0xe886('0xe')];function Trigger(_0x49b8fd){this[_0xe886('0xf')]=_0x49b8fd[_0xe886('0xf')];this['agents']=_0x49b8fd[_0xe886('0x10')];this[_0xe886('0x11')]=_0x49b8fd[_0xe886('0x11')];this['templates']=_0x49b8fd[_0xe886('0x12')];this[_0xe886('0x13')]=_0x49b8fd[_0xe886('0x13')];this[_0xe886('0x14')]=_0x49b8fd[_0xe886('0x14')];this[_0xe886('0x15')]=_0x49b8fd[_0xe886('0x15')];this['salesforceAccounts']=_0x49b8fd[_0xe886('0x16')];this['sugarcrmAccounts']=_0x49b8fd[_0xe886('0x17')];this['zohoAccounts']=_0x49b8fd[_0xe886('0x18')];this['deskAccounts']=_0x49b8fd[_0xe886('0x19')];this[_0xe886('0x1a')]=_0x49b8fd['vtigerAccounts'];this[_0xe886('0x1b')]=_0x49b8fd[_0xe886('0x1b')];this[_0xe886('0x1c')]=_0x49b8fd[_0xe886('0x1c')];this[_0xe886('0x1d')]=_0x49b8fd['freshsalesAccounts'];this['accounts']={'zendesk':this['zendeskAccounts'],'salesforce':this[_0xe886('0x16')],'freshdesk':this[_0xe886('0x15')],'sugarcrm':this[_0xe886('0x17')],'zoho':this[_0xe886('0x18')],'desk':this[_0xe886('0x19')],'vtiger':this['vtigerAccounts'],'dynamics365':this[_0xe886('0x1c')],'freshsales':this[_0xe886('0x1d')],'servicenow':this['servicenowAccounts']};ami['on'](_0xe886('0x1e'),this[_0xe886('0x1f')][_0xe886('0x20')](this));ami['on'](_0xe886('0x21'),this[_0xe886('0x1f')][_0xe886('0x20')](this));ami['on'](_0xe886('0x22'),this[_0xe886('0x1f')][_0xe886('0x20')](this));ami['on'](_0xe886('0x23'),this[_0xe886('0x1f')]['bind'](this));ami['on']('custom:agentnosuchnumber',this[_0xe886('0x1f')]['bind'](this));ami['on'](_0xe886('0x24'),this['syncCustomEvent'][_0xe886('0x20')](this));ami['on'](_0xe886('0x25'),this[_0xe886('0x1f')][_0xe886('0x20')](this));ami['on'](_0xe886('0x26'),this[_0xe886('0x1f')]['bind'](this));ami['on']('custom:agentreject',this[_0xe886('0x1f')][_0xe886('0x20')](this));ami['on']('custom:amd',this['syncCustomEvent']['bind'](this));ami['on'](_0xe886('0x27'),this[_0xe886('0x1f')][_0xe886('0x20')](this));ami['on'](_0xe886('0x28'),this[_0xe886('0x1f')][_0xe886('0x20')](this));ami['on'](_0xe886('0x29'),this[_0xe886('0x2a')]['bind'](this));ami['on'](_0xe886('0x2b'),this[_0xe886('0x2a')]['bind'](this));ami['on']('custom:dialend',this[_0xe886('0x2a')][_0xe886('0x20')](this));ami['on'](_0xe886('0x2c'),this[_0xe886('0x1f')][_0xe886('0x20')](this));ami['on'](_0xe886('0x2d'),this[_0xe886('0x1f')][_0xe886('0x20')](this));ami['on'](_0xe886('0x2e'),this[_0xe886('0x1f')][_0xe886('0x20')](this));ami['on'](_0xe886('0x2f'),this[_0xe886('0x1f')]['bind'](this));ami['on'](_0xe886('0x30'),this[_0xe886('0x1f')][_0xe886('0x20')](this));ami['on'](_0xe886('0x31'),this[_0xe886('0x1f')]['bind'](this));}Trigger[_0xe886('0x32')][_0xe886('0x33')]=function(_0x53010a,_0x5c65f8,_0xf53be7){logger['info'](_0x53010a,_0x5c65f8,JSON['stringify'](_0xf53be7));io['to'](_0x53010a)[_0xe886('0x33')](_0x5c65f8,_0xf53be7);};Trigger[_0xe886('0x32')][_0xe886('0x1f')]=function(_0x3c1990){var _0x112939=_['clone'](_0x3c1990);if(typeof _0x112939[_0xe886('0x34')]===_0xe886('0x35')){_0x112939['motionChannel']='voice';}this[_0xe886('0x36')](_0x112939);};Trigger[_0xe886('0x32')][_0xe886('0x2a')]=function(_0x5060db){if(this[_0xe886('0x10')][_0x5060db[_0xe886('0x37')]]){this[_0xe886('0x1f')](_0x5060db);}};Trigger['prototype'][_0xe886('0x36')]=function(_0x3c5d95){var _0x326e10;for(var _0x5bbe88 in this[_0xe886('0xf')]){if(this[_0xe886('0xf')][_0xe886('0x38')](_0x5bbe88)){if(this[_0xe886('0xf')][_0x5bbe88]['status']){_0x326e10=this[_0xe886('0x39')](this['triggers'][_0x5bbe88],_0x3c5d95);if(_0x326e10){_['merge'](_0x3c5d95,_0x3c5d95['variables']);for(var _0x81a11d=0x0,_0x4f6279,_0x1b1478,_0x28ac31;_0x81a11d0x0){_0x53c904=_[_0x7721('0x2a')](_0x315202,_0x343c19);}return _0x53c904;}function getCustomFields(_0x37b9f0,_0xd7d703){var _0x1da2d8=[];var _0x5c54f0={'custom_fields':{}};if(_0x37b9f0[_0x7721('0x29')]>0x0){_[_0x7721('0x2b')](_0x37b9f0,function(_0x497f9f){if(_['includes']([_0x7721('0x2c'),_0x7721('0x2d')],_0x497f9f['type'])&&_0x497f9f[_0x7721('0x2e')]&&!_0x497f9f[_0x7721('0x2f')]){_0x5c54f0[_0x497f9f[_0x7721('0x2e')]['toLowerCase']()]=_0x497f9f[_0x7721('0x30')][_0x7721('0x31')]();}else if(_[_0x7721('0x32')]([_0x7721('0x2c'),_0x7721('0x2d')],_0x497f9f['type'])&&_0x497f9f[_0x7721('0x33')]&&_0x497f9f[_0x7721('0x2f')]){_0x5c54f0[_0x7721('0x34')][_0x497f9f['idField']]=_0x497f9f[_0x7721('0x30')][_0x7721('0x31')]();}else if(_0x497f9f['type']===_0x7721('0x35')&&_0x497f9f['variableName']&&_0x497f9f[_0x7721('0x33')]&&_0x497f9f[_0x7721('0x2f')]){_0xd7d703[_0x497f9f[_0x7721('0x36')]]&&(_0x5c54f0[_0x7721('0x34')][_0x497f9f[_0x7721('0x33')]]=_0xd7d703[_0x497f9f[_0x7721('0x36')]][_0x7721('0x31')]());}else if(_0x497f9f[_0x7721('0x37')]===_0x7721('0x38')&&_0x497f9f[_0x7721('0x39')]&&_0x497f9f[_0x7721('0x39')]['name']&&_0x497f9f[_0x7721('0x33')]&&_0x497f9f['customField']){_0xd7d703[_0x497f9f[_0x7721('0x39')][_0x7721('0x3a')][_0x7721('0x3b')]()]&&(_0x5c54f0[_0x7721('0x34')][_0x497f9f[_0x7721('0x33')]]=_0xd7d703[_0x497f9f[_0x7721('0x39')]['name']['toLowerCase']()]['toString']());}});}if(_0x5c54f0['priority']){_0x5c54f0[_0x7721('0x3c')]=Number(_0x5c54f0[_0x7721('0x3c')]);}return _0x5c54f0;}function getTicket(_0x1acc72,_0x22ef35,_0x4a90ce,_0xa389fa,_0x4cf659){logger[_0x7721('0x15')](_0x7721('0x3d'));var _0x5a278e=_[_0x7721('0x3e')]({'subject':intUtil[_0x7721('0x3f')](_0xa389fa['Subjects'],_0x4cf659,'\x20'),'type':'phone','status':_0x7721('0x40'),'labels':[_0x7721('0x41'),_0x7721('0x42'),_0x7721('0x43')]['concat'](getTags(_0xa389fa[_0x7721('0x44')],_0x7721('0x3a'))),'description':intUtil[_0x7721('0x3f')](_0xa389fa[_0x7721('0x45')],_0x4cf659,'\x0a'),'_links':{'assigned_user':{'href':util[_0x7721('0xe')]('/api/v2/users/%d',_0x22ef35['id']),'class':_0x7721('0x46')}},'message':{'direction':'in','body':intUtil['getString'](_0xa389fa[_0x7721('0x45')],_0x4cf659,'\x0a')}},getCustomFields(_0xa389fa['Fields'],_0x4cf659));return request({'uri':util[_0x7721('0xe')](_0x7721('0x47'),_0x1acc72[_0x7721('0x10')],_0x4a90ce['id']),'method':'POST','body':_0x5a278e});}exports[_0x7721('0x48')]=function(_0x11d853,_0x1ad315,_0x481fa8,_0x9f7b1d,_0x754071,_0xdb3033){var _0x2d5f35,_0x135dbc;_0xdb3033[_0x7721('0x10')]=intUtil[_0x7721('0x49')](_0xdb3033['remoteUri']);_0xdb3033['serverUrl']=intUtil[_0x7721('0x49')](_0xdb3033[_0x7721('0x4a')]);if(_0x754071&&_0x754071[_0x7721('0x4b')]){logger[_0x7721('0x15')](_0x7721('0x4c'),_0x7721('0x4d'));_0x1ad315[_0x7721('0x4e')]=util[_0x7721('0xe')](_0x7721('0x4f'),_0xdb3033[_0x7721('0x4a')],_0x1ad315['uniqueid'],md5(_0x1ad315['uniqueid']));}else{_0x1ad315[_0x7721('0x4e')]='';}headers[_0x7721('0x50')]=getAuth(_0xdb3033);return getUser(_0xdb3033,_0x9f7b1d[_0x7721('0x51')])[_0x7721('0x11')](function(_0x589e95){_0x2d5f35=_0x589e95;logger[_0x7721('0x15')](_0x7721('0x52'),_0x2d5f35['id']);return getEndUser(_0xdb3033,_0x1ad315['calleridname'],_0x1ad315[_0x7721('0x53')]);})['then'](function(_0x2682b1){_0x135dbc=_0x2682b1;logger['info'](_0x7721('0x54'),_0x135dbc['id']);return getTicket(_0xdb3033,_0x2d5f35,_0x135dbc,_0x481fa8,_0x1ad315);})[_0x7721('0x11')](function(_0xf17c40){if(_0xf17c40){logger['info'](_0x7721('0x55'));logger[_0x7721('0x15')]('The\x20Ticket\x20ID\x20is:',_0xf17c40['id']);switch(_0xdb3033[_0x7721('0x37')]){case _0x7721('0x56'):logger[_0x7721('0x15')]('[QUEUE]',_0x7721('0x57'));emit(util['format'](_0x7721('0x58'),_0x9f7b1d[_0x7721('0x3a')]),_0x7721('0x59'),{'recordId':_0xf17c40['id']});break;case _0x7721('0x5a'):logger[_0x7721('0x15')](_0x7721('0x4c'),_0x7721('0x5b'));emit(util[_0x7721('0xe')](_0x7721('0x58'),_0x9f7b1d[_0x7721('0x3a')]),_0x7721('0x5c'),{'uri':util[_0x7721('0xe')](_0x7721('0x5d'),_0xf17c40['id'])});break;default:logger[_0x7721('0x5e')](_0x7721('0x4c'),'Desk\x20account\x20type\x20not\x20recognized');}}})[_0x7721('0x5f')](function(_0x2f6f30){console[_0x7721('0x5e')](_0x2f6f30);logger[_0x7721('0x5e')](_0x7721('0x4c'),JSON[_0x7721('0x1a')](_0x2f6f30));});};exports[_0x7721('0x60')]=function(_0x57484c,_0x234bee,_0x17036e,_0x134908,_0x3b7382,_0x1f1e84,_0x9c0d4){var _0x7fbd6c,_0x33287d;_0x1f1e84[_0x7721('0x10')]=intUtil[_0x7721('0x49')](_0x1f1e84[_0x7721('0x10')]);_0x1f1e84['serverUrl']=intUtil[_0x7721('0x49')](_0x1f1e84[_0x7721('0x4a')]);if(_0x9c0d4&&_0x9c0d4[_0x7721('0x61')]&&_0x9c0d4[_0x7721('0x61')]!==_0x7721('0x62')){logger[_0x7721('0x15')](_0x7721('0x63'),_0x7721('0x4d'));_0x234bee[_0x7721('0x4e')]=util[_0x7721('0xe')](_0x7721('0x4f'),_0x1f1e84[_0x7721('0x4a')],_0x234bee[_0x7721('0x64')],md5(_0x234bee[_0x7721('0x64')]));}headers[_0x7721('0x50')]=getAuth(_0x1f1e84);return getUser(_0x1f1e84,_0x134908['email'])['then'](function(_0x4e112e){_0x7fbd6c=_0x4e112e;logger[_0x7721('0x15')]('The\x20User\x20ID\x20is:',_0x7fbd6c['id']);return getEndUser(_0x1f1e84,_0x234bee['destcalleridname'],_0x234bee['destcalleridnum']);})['then'](function(_0x47925a){_0x33287d=_0x47925a;logger[_0x7721('0x15')](_0x7721('0x54'),_0x33287d['id']);return getTicket(_0x1f1e84,_0x7fbd6c,_0x33287d,_0x17036e,_0x234bee);})['then'](function(_0x5181d7){if(_0x5181d7){logger['info']('Ticket\x20created!');logger['info'](_0x7721('0x65'),_0x5181d7['id']);switch(_0x1f1e84['type']){case'integrationTab':logger['info'](_0x7721('0x4c'),_0x7721('0x57'));emit(util[_0x7721('0xe')]('user:%s',_0x134908[_0x7721('0x3a')]),_0x7721('0x59'),{'recordId':_0x5181d7['id']});break;case _0x7721('0x5a'):logger[_0x7721('0x15')](_0x7721('0x4c'),_0x7721('0x5b'));emit(util[_0x7721('0xe')](_0x7721('0x58'),_0x134908[_0x7721('0x3a')]),_0x7721('0x5c'),{'uri':util[_0x7721('0xe')](_0x7721('0x66'),_0x1f1e84[_0x7721('0x10')],_0x5181d7['id'])});break;default:logger[_0x7721('0x5e')](_0x7721('0x63'),'Desk\x20account\x20type\x20not\x20recognized');}}})[_0x7721('0x5f')](function(_0x2c93b0){logger[_0x7721('0x5e')](_0x7721('0x63'),JSON['stringify'](_0x2c93b0));});};exports[_0x7721('0x67')]=function(_0x104f05,_0x4c8284,_0x3e7df3,_0x5d37ad,_0x1f508d,_0x4bfb48){var _0x36a3a6,_0x3f9eaa;_0x4bfb48[_0x7721('0x10')]=intUtil[_0x7721('0x49')](_0x4bfb48[_0x7721('0x10')]);_0x4bfb48[_0x7721('0x4a')]=intUtil[_0x7721('0x49')](_0x4bfb48['serverUrl']);if(_0x1f508d&&_0x1f508d[_0x7721('0x4b')]){logger[_0x7721('0x15')]('['+_0x4c8284[_0x7721('0x68')][_0x7721('0x69')]()+']',_0x7721('0x4d'));_0x4c8284[_0x7721('0x4e')]=util[_0x7721('0xe')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4bfb48[_0x7721('0x4a')],_0x4c8284[_0x7721('0x64')],md5(_0x4c8284['uniqueid']));}else{_0x4c8284[_0x7721('0x4e')]='';}headers['Authorization']=getAuth(_0x4bfb48);return getUser(_0x4bfb48)[_0x7721('0x11')](function(_0x382800){_0x36a3a6=_0x382800;logger[_0x7721('0x15')](_0x7721('0x52'),_0x36a3a6['id']);return getEndUser(_0x4bfb48,_0x4c8284[_0x7721('0x6a')],_0x4c8284[_0x7721('0x53')]);})[_0x7721('0x11')](function(_0x5dca04){_0x3f9eaa=_0x5dca04;logger[_0x7721('0x15')](_0x7721('0x54'),_0x3f9eaa['id']);return getTicket(_0x4bfb48,_0x36a3a6,_0x3f9eaa,_0x3e7df3,_0x4c8284);})[_0x7721('0x11')](function(_0x5f08cc){if(_0x5f08cc){logger['info']('Ticket\x20created!');logger['info']('The\x20Ticket\x20ID\x20is:',_0x5f08cc['id']);}})[_0x7721('0x5f')](function(_0x2645dd){logger['error']('['+_0x4c8284[_0x7721('0x68')][_0x7721('0x69')]()+']',JSON[_0x7721('0x1a')](_0x2645dd));});}; \ No newline at end of file +var _0x5fc3=['map','forEach','includes','string','picklist','nameField','customField','toLowerCase','content','type','custom_fields','variable','variableName','idField','Variable','name','priority','Creating\x20new\x20ticket...','merge','getString','phone','new','xCALLY','Motion','CTI','concat','Descriptions','/api/v2/users/%d','user','Fields','%s/customers/%d/cases','queue','stripTrailingSlash','serverUrl','monitor_format','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','integrationTab','[QUEUE]','Displaying\x20ticket\x20to\x20agent...','user:%s','trigger:desk:display','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','https://xcally.desk.com/web/agent/case/%d','error','Desk\x20account\x20type\x20not\x20recognized','outbound','recordingFormat','none','recordingURL','The\x20User\x20ID\x20is:','destcalleridnum','Ticket\x20created!','[OUTBOUND]','unmanaged','lastevent','Recording\x20is\x20enabled!','lodash','request-promise','util','ioredis','./util','../../../../config/environment','../../../../config/logger','redis','defaults','emit','application/json','info','Getting\x20agent\x20with\x20email','%s/users','remoteUri','total_entries','entries','Agent\x20found!','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','format','%s/users/me','debug','stringify','authType','%s:%s','username','token','%s/token:%s','Basic\x20%s','toString','base64','Searching\x20enduser\x20with\x20phone','then','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','POST','length'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x5fc3,0xa8));var _0x35fc=function(_0x4e0a03,_0x5eb6b0){_0x4e0a03=_0x4e0a03-0x0;var _0x2478fc=_0x5fc3[_0x4e0a03];return _0x2478fc;};'use strict';var _=require(_0x35fc('0x0'));var rp=require(_0x35fc('0x1'));var md5=require('md5');var util=require(_0x35fc('0x2'));var Redis=require(_0x35fc('0x3'));var intUtil=require(_0x35fc('0x4'));var config=require(_0x35fc('0x5'));var logger=require(_0x35fc('0x6'))('desk');config[_0x35fc('0x7')]=_[_0x35fc('0x8')](config[_0x35fc('0x7')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x35fc('0x7')]));function emit(_0x508b32,_0x16e153,_0x27524f){io['to'](_0x508b32)[_0x35fc('0x9')](_0x16e153,_0x27524f);}var headers={'Content-Type':_0x35fc('0xa'),'Accept':_0x35fc('0xa')};function getUser(_0xf9d3a6,_0x2051ab){if(intUtil['validateEmail'](_0x2051ab)===!![]){logger[_0x35fc('0xb')](_0x35fc('0xc'),_0x2051ab);return request({'uri':util['format'](_0x35fc('0xd'),_0xf9d3a6[_0x35fc('0xe')])})['then'](function(_0xda83fb){if(_0xda83fb[_0x35fc('0xf')]){return _['find'](_0xda83fb['_embedded'][_0x35fc('0x10')],{'email':_0x2051ab});}})['then'](function(_0x397738){if(_0x397738){logger[_0x35fc('0xb')](_0x35fc('0x11'));return _0x397738;}else{logger[_0x35fc('0xb')](_0x35fc('0x12'));return request({'uri':util['format']('%s/users/me',_0xf9d3a6['remoteUri'])});}});}else{logger['info'](_0x35fc('0x13'));return request({'uri':util[_0x35fc('0x14')](_0x35fc('0x15'),_0xf9d3a6[_0x35fc('0xe')])});}}function request(_0x227a49){logger[_0x35fc('0x16')]('[HTTP]',JSON[_0x35fc('0x17')](_0x227a49));return rp(_[_0x35fc('0x8')](_0x227a49,{'method':'GET','headers':headers,'json':!![]}));}function getAuth(_0x41e165){var _0x363e47;if(_0x41e165[_0x35fc('0x18')]==='basic'){_0x363e47=util[_0x35fc('0x14')](_0x35fc('0x19'),_0x41e165[_0x35fc('0x1a')],_0x41e165['password']);}else if(_0x41e165[_0x35fc('0x18')]===_0x35fc('0x1b')){_0x363e47=util[_0x35fc('0x14')](_0x35fc('0x1c'),_0x41e165[_0x35fc('0x1a')],_0x41e165[_0x35fc('0x1b')]);}return util[_0x35fc('0x14')](_0x35fc('0x1d'),new Buffer(_0x363e47)[_0x35fc('0x1e')](_0x35fc('0x1f')));}function getEndUser(_0x5bd2b8,_0x323aee,_0xd5399f){logger[_0x35fc('0xb')](_0x35fc('0x20'),_0xd5399f);return request({'uri':util[_0x35fc('0x14')]('%s/customers/search',_0x5bd2b8[_0x35fc('0xe')]),'qs':{'phone':_0xd5399f}})[_0x35fc('0x21')](function(_0x561bf8){if(_0x561bf8[_0x35fc('0xf')]){logger[_0x35fc('0xb')](_0x35fc('0x22'));return _0x561bf8['_embedded'][_0x35fc('0x10')][0x0];}else{logger['info'](_0x35fc('0x23'));return request({'uri':util[_0x35fc('0x14')]('%s/customers',_0x5bd2b8['remoteUri']),'method':_0x35fc('0x24'),'body':{'first_name':_0x323aee,'title':_0x323aee,'phone_numbers':[{'type':'work','value':_0xd5399f}]}});}});}function getTags(_0x274208,_0x1a5d92){var _0x57001c=[];if(_0x274208&&_0x274208[_0x35fc('0x25')]>0x0){_0x57001c=_[_0x35fc('0x26')](_0x274208,_0x1a5d92);}return _0x57001c;}function getCustomFields(_0x383837,_0x9f3c8a){var _0x3735da=[];var _0x134dfa={'custom_fields':{}};if(_0x383837[_0x35fc('0x25')]>0x0){_[_0x35fc('0x27')](_0x383837,function(_0x54aedc){if(_[_0x35fc('0x28')]([_0x35fc('0x29'),_0x35fc('0x2a')],_0x54aedc['type'])&&_0x54aedc[_0x35fc('0x2b')]&&!_0x54aedc[_0x35fc('0x2c')]){_0x134dfa[_0x54aedc[_0x35fc('0x2b')][_0x35fc('0x2d')]()]=_0x54aedc[_0x35fc('0x2e')][_0x35fc('0x1e')]();}else if(_[_0x35fc('0x28')]([_0x35fc('0x29'),_0x35fc('0x2a')],_0x54aedc[_0x35fc('0x2f')])&&_0x54aedc['idField']&&_0x54aedc['customField']){_0x134dfa[_0x35fc('0x30')][_0x54aedc['idField']]=_0x54aedc[_0x35fc('0x2e')][_0x35fc('0x1e')]();}else if(_0x54aedc[_0x35fc('0x2f')]===_0x35fc('0x31')&&_0x54aedc[_0x35fc('0x32')]&&_0x54aedc[_0x35fc('0x33')]&&_0x54aedc['customField']){_0x9f3c8a[_0x54aedc[_0x35fc('0x32')]]&&(_0x134dfa[_0x35fc('0x30')][_0x54aedc[_0x35fc('0x33')]]=_0x9f3c8a[_0x54aedc[_0x35fc('0x32')]][_0x35fc('0x1e')]());}else if(_0x54aedc[_0x35fc('0x2f')]==='customVariable'&&_0x54aedc[_0x35fc('0x34')]&&_0x54aedc[_0x35fc('0x34')][_0x35fc('0x35')]&&_0x54aedc['idField']&&_0x54aedc[_0x35fc('0x2c')]){_0x9f3c8a[_0x54aedc['Variable'][_0x35fc('0x35')][_0x35fc('0x2d')]()]&&(_0x134dfa[_0x35fc('0x30')][_0x54aedc[_0x35fc('0x33')]]=_0x9f3c8a[_0x54aedc['Variable']['name']['toLowerCase']()][_0x35fc('0x1e')]());}});}if(_0x134dfa['priority']){_0x134dfa[_0x35fc('0x36')]=Number(_0x134dfa['priority']);}return _0x134dfa;}function getTicket(_0x9c6b65,_0x1f2d66,_0x2ca9ac,_0x22b724,_0x1c10e0){logger[_0x35fc('0xb')](_0x35fc('0x37'));var _0x4ec0dc=_[_0x35fc('0x38')]({'subject':intUtil[_0x35fc('0x39')](_0x22b724['Subjects'],_0x1c10e0,'\x20'),'type':_0x35fc('0x3a'),'status':_0x35fc('0x3b'),'labels':[_0x35fc('0x3c'),_0x35fc('0x3d'),_0x35fc('0x3e')][_0x35fc('0x3f')](getTags(_0x22b724['Tags'],_0x35fc('0x35'))),'description':intUtil[_0x35fc('0x39')](_0x22b724[_0x35fc('0x40')],_0x1c10e0,'\x0a'),'_links':{'assigned_user':{'href':util['format'](_0x35fc('0x41'),_0x1f2d66['id']),'class':_0x35fc('0x42')}},'message':{'direction':'in','body':intUtil['getString'](_0x22b724[_0x35fc('0x40')],_0x1c10e0,'\x0a')}},getCustomFields(_0x22b724[_0x35fc('0x43')],_0x1c10e0));return request({'uri':util[_0x35fc('0x14')](_0x35fc('0x44'),_0x9c6b65[_0x35fc('0xe')],_0x2ca9ac['id']),'method':_0x35fc('0x24'),'body':_0x4ec0dc});}exports[_0x35fc('0x45')]=function(_0x3ec51f,_0x5a7e9e,_0x596e83,_0x210d5d,_0x36fcf9,_0x4fdc6d){var _0x5c2e5c,_0x4ff202;_0x4fdc6d[_0x35fc('0xe')]=intUtil[_0x35fc('0x46')](_0x4fdc6d['remoteUri']);_0x4fdc6d[_0x35fc('0x47')]=intUtil[_0x35fc('0x46')](_0x4fdc6d[_0x35fc('0x47')]);if(_0x36fcf9&&_0x36fcf9[_0x35fc('0x48')]){logger['info']('[QUEUE]','Recording\x20is\x20enabled!');_0x5a7e9e['recordingURL']=util['format'](_0x35fc('0x49'),_0x4fdc6d[_0x35fc('0x47')],_0x5a7e9e['uniqueid'],md5(_0x5a7e9e[_0x35fc('0x4a')]));}else{_0x5a7e9e['recordingURL']='';}headers[_0x35fc('0x4b')]=getAuth(_0x4fdc6d);return getUser(_0x4fdc6d,_0x210d5d[_0x35fc('0x4c')])[_0x35fc('0x21')](function(_0x2de5d1){_0x5c2e5c=_0x2de5d1;logger[_0x35fc('0xb')]('The\x20User\x20ID\x20is:',_0x5c2e5c['id']);return getEndUser(_0x4fdc6d,_0x5a7e9e[_0x35fc('0x4d')],_0x5a7e9e[_0x35fc('0x4e')]);})['then'](function(_0x18181b){_0x4ff202=_0x18181b;logger[_0x35fc('0xb')](_0x35fc('0x4f'),_0x4ff202['id']);return getTicket(_0x4fdc6d,_0x5c2e5c,_0x4ff202,_0x596e83,_0x5a7e9e);})[_0x35fc('0x21')](function(_0x5bc8c3){if(_0x5bc8c3){logger[_0x35fc('0xb')]('Ticket\x20created!');logger['info'](_0x35fc('0x50'),_0x5bc8c3['id']);switch(_0x4fdc6d[_0x35fc('0x2f')]){case _0x35fc('0x51'):logger[_0x35fc('0xb')](_0x35fc('0x52'),_0x35fc('0x53'));emit(util[_0x35fc('0x14')](_0x35fc('0x54'),_0x210d5d['name']),_0x35fc('0x55'),{'recordId':_0x5bc8c3['id']});break;case _0x35fc('0x56'):logger[_0x35fc('0xb')](_0x35fc('0x52'),_0x35fc('0x57'));emit(util[_0x35fc('0x14')](_0x35fc('0x54'),_0x210d5d[_0x35fc('0x35')]),_0x35fc('0x58'),{'uri':util[_0x35fc('0x14')](_0x35fc('0x59'),_0x5bc8c3['id'])});break;default:logger[_0x35fc('0x5a')](_0x35fc('0x52'),_0x35fc('0x5b'));}}})['catch'](function(_0x553ed6){console[_0x35fc('0x5a')](_0x553ed6);logger[_0x35fc('0x5a')](_0x35fc('0x52'),JSON[_0x35fc('0x17')](_0x553ed6));});};exports[_0x35fc('0x5c')]=function(_0x3e6494,_0x4a4798,_0x4f024c,_0x388521,_0x19b2ce,_0x395d63,_0x38bc78){var _0x5b2595,_0x467980;_0x395d63[_0x35fc('0xe')]=intUtil['stripTrailingSlash'](_0x395d63[_0x35fc('0xe')]);_0x395d63[_0x35fc('0x47')]=intUtil['stripTrailingSlash'](_0x395d63[_0x35fc('0x47')]);if(_0x38bc78&&_0x38bc78[_0x35fc('0x5d')]&&_0x38bc78[_0x35fc('0x5d')]!==_0x35fc('0x5e')){logger['info']('[OUTBOUND]','Recording\x20is\x20enabled!');_0x4a4798[_0x35fc('0x5f')]=util[_0x35fc('0x14')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x395d63[_0x35fc('0x47')],_0x4a4798[_0x35fc('0x4a')],md5(_0x4a4798[_0x35fc('0x4a')]));}headers[_0x35fc('0x4b')]=getAuth(_0x395d63);return getUser(_0x395d63,_0x388521[_0x35fc('0x4c')])['then'](function(_0x2d9d45){_0x5b2595=_0x2d9d45;logger[_0x35fc('0xb')](_0x35fc('0x60'),_0x5b2595['id']);return getEndUser(_0x395d63,_0x4a4798['destcalleridname'],_0x4a4798[_0x35fc('0x61')]);})[_0x35fc('0x21')](function(_0x47fb1a){_0x467980=_0x47fb1a;logger[_0x35fc('0xb')](_0x35fc('0x4f'),_0x467980['id']);return getTicket(_0x395d63,_0x5b2595,_0x467980,_0x4f024c,_0x4a4798);})[_0x35fc('0x21')](function(_0x1c4c33){if(_0x1c4c33){logger[_0x35fc('0xb')](_0x35fc('0x62'));logger[_0x35fc('0xb')](_0x35fc('0x50'),_0x1c4c33['id']);switch(_0x395d63['type']){case _0x35fc('0x51'):logger[_0x35fc('0xb')](_0x35fc('0x52'),'Displaying\x20ticket\x20to\x20agent...');emit(util[_0x35fc('0x14')]('user:%s',_0x388521['name']),'trigger:desk:display',{'recordId':_0x1c4c33['id']});break;case _0x35fc('0x56'):logger[_0x35fc('0xb')](_0x35fc('0x52'),_0x35fc('0x57'));emit(util[_0x35fc('0x14')]('user:%s',_0x388521['name']),'trigger:browser:url',{'uri':util['format']('%s/agent/tickets/%s',_0x395d63[_0x35fc('0xe')],_0x1c4c33['id'])});break;default:logger[_0x35fc('0x5a')](_0x35fc('0x63'),_0x35fc('0x5b'));}}})['catch'](function(_0x458eb8){logger[_0x35fc('0x5a')](_0x35fc('0x63'),JSON[_0x35fc('0x17')](_0x458eb8));});};exports[_0x35fc('0x64')]=function(_0x1d0e53,_0x27071b,_0x2127e0,_0x462ceb,_0x4c3ace,_0x35d7c8){var _0x47c75f,_0xfbd737;_0x35d7c8[_0x35fc('0xe')]=intUtil[_0x35fc('0x46')](_0x35d7c8[_0x35fc('0xe')]);_0x35d7c8['serverUrl']=intUtil[_0x35fc('0x46')](_0x35d7c8['serverUrl']);if(_0x4c3ace&&_0x4c3ace['monitor_format']){logger['info']('['+_0x27071b[_0x35fc('0x65')]['toUpperCase']()+']',_0x35fc('0x66'));_0x27071b['recordingURL']=util[_0x35fc('0x14')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x35d7c8[_0x35fc('0x47')],_0x27071b[_0x35fc('0x4a')],md5(_0x27071b[_0x35fc('0x4a')]));}else{_0x27071b[_0x35fc('0x5f')]='';}headers['Authorization']=getAuth(_0x35d7c8);return getUser(_0x35d7c8)[_0x35fc('0x21')](function(_0x1e2214){_0x47c75f=_0x1e2214;logger[_0x35fc('0xb')]('The\x20User\x20ID\x20is:',_0x47c75f['id']);return getEndUser(_0x35d7c8,_0x27071b[_0x35fc('0x4d')],_0x27071b[_0x35fc('0x4e')]);})[_0x35fc('0x21')](function(_0x3c1b56){_0xfbd737=_0x3c1b56;logger[_0x35fc('0xb')](_0x35fc('0x4f'),_0xfbd737['id']);return getTicket(_0x35d7c8,_0x47c75f,_0xfbd737,_0x2127e0,_0x27071b);})[_0x35fc('0x21')](function(_0x4464d5){if(_0x4464d5){logger['info'](_0x35fc('0x62'));logger[_0x35fc('0xb')](_0x35fc('0x50'),_0x4464d5['id']);}})['catch'](function(_0x1c88d8){logger[_0x35fc('0x5a')]('['+_0x27071b['lastevent']['toUpperCase']()+']',JSON[_0x35fc('0x17')](_0x1c88d8));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/dynamics365.js b/server/services/ami/trigger/integration/dynamics365.js index c139db8..a8195b7 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 _0x0749=['odata-entityid','substring','calleridnum','replace','telephone1','contactid',']\x20Enduser\x20Created!','enduserId','forEach','includes','picklist','nameField','customField','idField','indexOf','content','ticketType','assign','getString','Subjects','Fields','phonecall','phonecalls','Descriptions','callDirection','queue','/contacts(','lastIndexOf','ticketId','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','emit','trigger:browser:url','stripTrailingSlash','serverUrl','unmanaged','https://login.microsoftonline.com/%s/oauth2/token','tenantId','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingFormat','none','recordingURL',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s',']\x20Call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...','name','error',']\x20Error\x20running\x20Dynamics365\x20integration','inspect','bluebird','request-promise','util','./util','md5','ioredis','../../../../config/logger','dynamics365','../../../../config/environment','redis','socket.io-emitter','POST','remoteUri','username','password','then','catch','toUpperCase',']\x20Wrong\x20credentials!','message','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','4.0','value','isNil','validateEmail','email','userEmail','length','isdisabled','info',']\x20Agent\x20found\x20','systemuserid','userId',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','toLowerCase','outbound','destcalleridnum','contacts','/systemusers(','headers'];(function(_0x4d210a,_0x26357c){var _0x39ae0f=function(_0x1941fd){while(--_0x1941fd){_0x4d210a['push'](_0x4d210a['shift']());}};_0x39ae0f(++_0x26357c);}(_0x0749,0x9a));var _0x9074=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0x0749[_0x13d07a];return _0x5ee0ee;};'use strict';var _=require('lodash');var BPromise=require(_0x9074('0x0'));var rp=require(_0x9074('0x1'));var util=require(_0x9074('0x2'));var intUtil=require(_0x9074('0x3'));var md5=require(_0x9074('0x4'));var Redis=require(_0x9074('0x5'));var logger=require(_0x9074('0x6'))(_0x9074('0x7'));var config=require(_0x9074('0x8'));config[_0x9074('0x9')]=_['defaults'](config[_0x9074('0x9')],{'host':'localhost','port':0x18eb});var io=require(_0x9074('0xa'))(new Redis(config[_0x9074('0x9')]));function getAuthToken(_0x175e06,_0x307b2c,_0x2c06a8){var _0xe4d5be={'method':_0x9074('0xb'),'uri':_0x307b2c,'form':{'client_id':_0x175e06['clientId'],'resource':_0x175e06[_0x9074('0xc')],'username':_0x175e06[_0x9074('0xd')],'password':_0x175e06[_0x9074('0xe')],'grant_type':_0x9074('0xe'),'client_secret':_0x175e06['clientSecret']},'json':!![]};return rp(_0xe4d5be)[_0x9074('0xf')](function(_0x483383){return _0x483383['access_token'];})[_0x9074('0x10')](function(_0x567585){logger['error']('['+[_0x2c06a8[_0x9074('0x11')]()]+_0x9074('0x12'));return _0x567585[_0x9074('0x13')];});}function getUser(_0x20c1e8,_0x4aaa06,_0x11111c,_0x28382b,_0x792577,_0x6b1c20){return new BPromise(function(_0x100882,_0x52f2c9){return getAuthToken(_0x4aaa06,_0x28382b,_0x6b1c20)[_0x9074('0xf')](function(_0x51d3e6){var _0x332828={'method':_0x9074('0x14'),'uri':_0x792577+_0x9074('0x15'),'headers':{'Authorization':_0x9074('0x16')+_0x51d3e6,'OData-Version':_0x9074('0x17')},'json':!![]};return rp(_0x332828);})[_0x9074('0xf')](function(_0x583d55){var _0x210c36=_0x583d55[_0x9074('0x18')];var _0x166d46=![];var _0x24245b=null;if(!_[_0x9074('0x19')](_0x11111c)){if(intUtil[_0x9074('0x1a')](_0x11111c[_0x9074('0x1b')])){_0x20c1e8[_0x9074('0x1c')]=_0x11111c[_0x9074('0x1b')];for(_0x24245b=0x0;_0x24245b<_0x210c36[_0x9074('0x1d')];_0x24245b++){if(_0x210c36[_0x24245b]['internalemailaddress']===_0x11111c[_0x9074('0x1b')]&&!_0x210c36[_0x24245b][_0x9074('0x1e')]){_0x166d46=!![];logger[_0x9074('0x1f')]('['+[_0x6b1c20['toUpperCase']()]+_0x9074('0x20')+_0x210c36[_0x24245b][_0x9074('0x21')]+'!');_0x20c1e8[_0x9074('0x22')]=_0x210c36[_0x24245b][_0x9074('0x21')];}}}}if(!_0x166d46){logger[_0x9074('0x1f')]('['+[_0x6b1c20[_0x9074('0x11')]()]+_0x9074('0x23'));_0x20c1e8[_0x9074('0x1c')]=_0x4aaa06[_0x9074('0xd')];for(_0x24245b=0x0;_0x24245b<_0x210c36[_0x9074('0x1d')];_0x24245b++){if(_0x210c36[_0x24245b]['internalemailaddress']===_0x4aaa06[_0x9074('0xd')]){_0x20c1e8['userId']=_0x210c36[_0x24245b][_0x9074('0x21')];}}}_0x100882(_0x20c1e8);})[_0x9074('0x10')](function(_0x3060ee){_0x52f2c9(_0x3060ee['message']);});});}function createEndUser(_0x582dc3,_0x2e6146,_0x54545d,_0x1d6765,_0x1fa669,_0x10a902){return new BPromise(function(_0x5340a3,_0x3518c5){return getAuthToken(_0x2e6146,_0x54545d,_0x10a902)[_0x9074('0xf')](function(_0x17b6ad){var _0xb86afe=_0x10a902[_0x9074('0x24')]()===_0x9074('0x25')?_0x1fa669[_0x9074('0x26')]:_0x1fa669['calleridnum'];var _0x390ca4={'method':'POST','uri':_0x1d6765+_0x9074('0x27'),'body':{'telephone1':_0xb86afe,'fullname':_0xb86afe,'firstname':_0xb86afe,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x9074('0x28')+_0x582dc3['userId']+')'},'headers':{'Authorization':_0x9074('0x16')+_0x17b6ad,'OData-Version':_0x9074('0x17')},'json':!![],'resolveWithFullResponse':!![]};return rp(_0x390ca4);})[_0x9074('0xf')](function(_0x3eb800){var _0x5eb6dc=_0x3eb800[_0x9074('0x29')][_0x9074('0x2a')];var _0x337655=_0x5eb6dc[_0x9074('0x2b')](_0x5eb6dc['lastIndexOf']('(')+0x1,_0x5eb6dc['lastIndexOf'](')'));_0x582dc3['enduserId']=_0x337655;_0x5340a3(_0x582dc3);})[_0x9074('0x10')](function(_0x24e668){_0x3518c5(_0x24e668['message']);});});}function getEndUser(_0x4cc1ff,_0xf45db3,_0xfc8f90,_0x420fe1,_0x2920a4,_0x270b64){return new BPromise(function(_0x19442c,_0x381158){var _0x108009=_0x270b64[_0x9074('0x24')]()==='outbound'?_0x2920a4[_0x9074('0x26')]:_0x2920a4[_0x9074('0x2c')];return getAuthToken(_0xf45db3,_0xfc8f90,_0x270b64)[_0x9074('0xf')](function(_0x1a66dc){var _0x421e7f={'method':_0x9074('0x14'),'uri':_0x420fe1+'contacts?$select=telephone1&$filter=telephone1\x20eq\x20\x27'+_0x108009[_0x9074('0x2d')]('+','%2b')+'\x27','headers':{'Authorization':_0x9074('0x16')+_0x1a66dc,'If-None-Match':null,'OData-Version':_0x9074('0x17')},'json':!![]};return rp(_0x421e7f);})['then'](function(_0x3e526d){var _0x22e359=null;if(_0x3e526d){var _0x2295a0=_0x3e526d['value'];var _0x134a1b=![];for(_0x22e359=0x0;_0x22e359<_0x2295a0[_0x9074('0x1d')];_0x22e359++){if(_0x2295a0[_0x22e359][_0x9074('0x2e')]===_0x108009){_0x134a1b=!![];_0x4cc1ff['enduserId']=_0x2295a0[_0x22e359][_0x9074('0x2f')];}}if(_0x134a1b){_0x19442c(_0x4cc1ff);}else{return createEndUser(_0x4cc1ff,_0xf45db3,_0xfc8f90,_0x420fe1,_0x2920a4,_0x270b64)['then'](function(_0x2ba459){logger[_0x9074('0x1f')]('['+[_0x270b64[_0x9074('0x11')]()]+']\x20Enduser\x20created!',_0x2ba459['enduserId']);_0x19442c(_0x2ba459);});}}else{return createEndUser(_0x4cc1ff,_0xf45db3,_0xfc8f90,_0x420fe1,_0x2920a4,_0x270b64)[_0x9074('0xf')](function(_0x44c813){logger[_0x9074('0x1f')]('['+[_0x270b64[_0x9074('0x11')]()]+_0x9074('0x30'),_0x44c813[_0x9074('0x31')]);_0x19442c(_0x44c813);});}});});}function getCustomFields(_0x16584e,_0x4076b5,_0x31d89c){var _0x454b51={};if(_0x16584e[_0x9074('0x1d')]>0x0){_[_0x9074('0x32')](_0x16584e,function(_0x2e6621){if(_[_0x9074('0x33')](['string',_0x9074('0x34')],_0x2e6621['type'])&&_0x2e6621[_0x9074('0x35')]&&!_0x2e6621[_0x9074('0x36')]){var _0x30833d=_0x2e6621[_0x9074('0x37')][_0x9074('0x24')]();var _0xa95b14=_0x30833d[_0x9074('0x2b')](0x0,_0x30833d[_0x9074('0x38')]('_'));var _0x2e8a55=_0x30833d[_0x9074('0x2b')](_0x30833d[_0x9074('0x38')]('_')+0x1);if(_0xa95b14===_0x31d89c){_0x454b51[_0x2e8a55]=_0x2e6621[_0x9074('0x39')];}}});}return _0x454b51;}function getTicket(_0x56c0e6,_0x2a21d8,_0x353f7b,_0x941320,_0x501ad7,_0x54cfe4,_0x59d161){return new BPromise(function(_0x3c0d9d,_0xa083){var _0xd88154;return getAuthToken(_0x2a21d8,_0x353f7b,_0x59d161)[_0x9074('0xf')](function(_0x1f8ca5){if(_0x54cfe4[_0x9074('0x3a')]==='incident'){_0xd88154={'method':_0x9074('0xb'),'uri':_0x941320+'incidents','body':Object[_0x9074('0x3b')]({},{'title':intUtil[_0x9074('0x3c')](_0x54cfe4[_0x9074('0x3d')],_0x501ad7,'\x20'),'description':intUtil[_0x9074('0x3c')](_0x54cfe4['Descriptions'],_0x501ad7,'\x0a'),'customerid_contact@odata.bind':'/contacts('+_0x56c0e6[_0x9074('0x31')]+')','ownerid@odata.bind':_0x9074('0x28')+_0x56c0e6[_0x9074('0x22')]+')','caseorigincode':'1'},getCustomFields(_0x54cfe4[_0x9074('0x3e')],_0x501ad7,_0x54cfe4['ticketType'])),'headers':{'Authorization':_0x9074('0x16')+_0x1f8ca5,'OData-Version':_0x9074('0x17')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x54cfe4[_0x9074('0x3a')]===_0x9074('0x3f')){_0xd88154={'method':_0x9074('0xb'),'uri':_0x941320+_0x9074('0x40'),'body':Object[_0x9074('0x3b')]({},{'subject':intUtil[_0x9074('0x3c')](_0x54cfe4[_0x9074('0x3d')],_0x501ad7,'\x20'),'phonenumber':String(_0x501ad7[_0x9074('0x2c')]),'description':intUtil[_0x9074('0x3c')](_0x54cfe4[_0x9074('0x41')],_0x501ad7,'\x0a'),'regardingobjectid_contact@odata.bind':'/contacts('+_0x56c0e6[_0x9074('0x31')]+')','ownerid@odata.bind':_0x9074('0x28')+_0x56c0e6[_0x9074('0x22')]+')','directioncode':_0x56c0e6[_0x9074('0x42')]===_0x9074('0x43')?![]:!![],'phonecall_activity_parties':[{'partyid_systemuser@odata.bind':_0x9074('0x28')+_0x56c0e6[_0x9074('0x22')]+')','participationtypemask':_0x56c0e6[_0x9074('0x42')]==='queue'?0x2:0x1},{'partyid_contact@odata.bind':_0x9074('0x44')+_0x56c0e6['enduserId']+')','participationtypemask':_0x56c0e6['callDirection']===_0x9074('0x43')?0x1:0x2}]},getCustomFields(_0x54cfe4[_0x9074('0x3e')],_0x501ad7,_0x54cfe4[_0x9074('0x3a')])),'headers':{'Authorization':_0x9074('0x16')+_0x1f8ca5,'OData-Version':_0x9074('0x17')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0xd88154);})[_0x9074('0xf')](function(_0x1048df){var _0x4be2da=_0x1048df[_0x9074('0x29')][_0x9074('0x2a')];var _0x5750f8=_0x4be2da[_0x9074('0x2b')](_0x4be2da[_0x9074('0x45')]('(')+0x1,_0x4be2da[_0x9074('0x45')](')'));_0x56c0e6[_0x9074('0x46')]=_0x5750f8;_0x3c0d9d(_0x56c0e6);})[_0x9074('0x10')](function(_0x49c7a3){_0xa083(_0x49c7a3[_0x9074('0x13')]);});});}function emit(_0xe91c62,_0x553910,_0x45cf7f,_0x2a7f50){var _0x10254b={'uri':util[_0x9074('0x47')](_0x9074('0x48'),_0xe91c62,_0x45cf7f,_0x2a7f50)};io['to'](util[_0x9074('0x47')]('user:%s',_0x553910))[_0x9074('0x49')](_0x9074('0x4a'),_0x10254b);}exports['cs']=function(_0x1d9764,_0x5a20d0,_0x4a8cf2,_0x4b2bea,_0x5b7b1f,_0x24c12b,_0x1ab7af,_0x31b4ab){var _0x29bfcf={};_0x24c12b[_0x9074('0xc')]=intUtil['stripTrailingSlash'](_0x24c12b['remoteUri']);_0x24c12b['serverUrl']=intUtil[_0x9074('0x4b')](_0x24c12b[_0x9074('0x4c')]);_0x29bfcf[_0x9074('0x42')]=_0x31b4ab===_0x9074('0x43')||_0x31b4ab===_0x9074('0x4d')?_0x9074('0x43'):'outbound';var _0x42e634=util['format']('%s/api/data/v9.0/',_0x24c12b[_0x9074('0xc')]);var _0x5c802b=util['format'](_0x9074('0x4e'),_0x24c12b[_0x9074('0x4f')]);var _0x4035a0=util['format'](_0x9074('0x50'),_0x24c12b[_0x9074('0x4c')],_0x5a20d0[_0x9074('0x51')],md5(_0x5a20d0[_0x9074('0x51')]));if(_0x5b7b1f&&_0x5b7b1f[_0x9074('0x52')]){logger['info'](_0x9074('0x53'),_0x9074('0x54'));_0x5a20d0['recordingURL']=_0x4035a0;}else if(_0x1ab7af&&_0x1ab7af[_0x9074('0x55')]&&_0x1ab7af[_0x9074('0x55')]!==_0x9074('0x56')){logger[_0x9074('0x1f')]('[OUTBOUND]','Recording\x20is\x20enabled!');_0x5a20d0['recordingURL']=_0x4035a0;}else{_0x5a20d0[_0x9074('0x57')]='';}return getUser(_0x29bfcf,_0x24c12b,_0x4b2bea,_0x5c802b,_0x42e634,_0x31b4ab)['then'](function(_0x4c6cd2){logger[_0x9074('0x1f')]('['+_0x31b4ab['toUpperCase']()+_0x9074('0x58'),_0x4c6cd2[_0x9074('0x22')]);logger[_0x9074('0x1f')]('['+_0x31b4ab[_0x9074('0x11')]()+_0x9074('0x59'),_0x4c6cd2[_0x9074('0x1c')]);return getEndUser(_0x4c6cd2,_0x24c12b,_0x5c802b,_0x42e634,_0x5a20d0,_0x31b4ab);})[_0x9074('0xf')](function(_0x1837b3){logger['info']('['+_0x31b4ab[_0x9074('0x11')]()+_0x9074('0x5a'),_0x1837b3[_0x9074('0x31')]);logger[_0x9074('0x1f')]('['+_0x31b4ab[_0x9074('0x11')]()+']\x20The\x20Enduser\x20phone\x20is:',_0x5a20d0[_0x9074('0x2c')]);return getTicket(_0x1837b3,_0x24c12b,_0x5c802b,_0x42e634,_0x5a20d0,_0x4a8cf2,_0x31b4ab);})[_0x9074('0xf')](function(_0x353d48){logger['info'](util['format']('['+_0x31b4ab[_0x9074('0x11')]()+_0x9074('0x5b'),_0x4a8cf2[_0x9074('0x3a')],_0x353d48[_0x9074('0x46')]));logger[_0x9074('0x1f')](util['format']('['+_0x31b4ab[_0x9074('0x11')]()+_0x9074('0x5c'),_0x31b4ab));if(_0x31b4ab!==_0x9074('0x4d')){logger[_0x9074('0x1f')]('['+_0x31b4ab[_0x9074('0x11')]()+']',_0x9074('0x5d'));emit(_0x24c12b['remoteUri'],_0x4b2bea[_0x9074('0x5e')],_0x4a8cf2[_0x9074('0x3a')],_0x353d48[_0x9074('0x46')]);}})[_0x9074('0x10')](function(_0x2de864){logger[_0x9074('0x5f')]('['+_0x31b4ab[_0x9074('0x11')]()+_0x9074('0x60'),util[_0x9074('0x61')](_0x2de864,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xa081=['%s/api/data/v9.0/','tenantId','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','[OUTBOUND]',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s','ticketId',']\x20Call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...','name','inspect','lodash','./util','md5','ioredis','../../../../config/logger','dynamics365','../../../../config/environment','defaults','socket.io-emitter','redis','POST','remoteUri','username','password','clientSecret','then','access_token','catch','error','toUpperCase',']\x20Wrong\x20credentials!','message','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','value','validateEmail','userEmail','email','isdisabled','info',']\x20Agent\x20found\x20','systemuserid',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','length','internalemailaddress','userId','toLowerCase','outbound','destcalleridnum','contacts','/systemusers(','headers','odata-entityid','substring','lastIndexOf','enduserId','calleridnum','replace','%2b','telephone1','contactid',']\x20Enduser\x20created!',']\x20Enduser\x20Created!','forEach','includes','string','picklist','nameField','customField','idField','indexOf','incidents','assign','getString','Subjects','Descriptions','Fields','ticketType','phonecall','/contacts(','callDirection','4.0','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','user:%s','emit','trigger:browser:url','stripTrailingSlash','serverUrl','queue','unmanaged'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa081,0x146));var _0x1a08=function(_0x275b73,_0x5c4387){_0x275b73=_0x275b73-0x0;var _0x2676f2=_0xa081[_0x275b73];return _0x2676f2;};'use strict';var _=require(_0x1a08('0x0'));var BPromise=require('bluebird');var rp=require('request-promise');var util=require('util');var intUtil=require(_0x1a08('0x1'));var md5=require(_0x1a08('0x2'));var Redis=require(_0x1a08('0x3'));var logger=require(_0x1a08('0x4'))(_0x1a08('0x5'));var config=require(_0x1a08('0x6'));config['redis']=_[_0x1a08('0x7')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x1a08('0x8'))(new Redis(config[_0x1a08('0x9')]));function getAuthToken(_0xcbf95,_0x2d396f,_0x34eded){var _0x39c861={'method':_0x1a08('0xa'),'uri':_0x2d396f,'form':{'client_id':_0xcbf95['clientId'],'resource':_0xcbf95[_0x1a08('0xb')],'username':_0xcbf95[_0x1a08('0xc')],'password':_0xcbf95[_0x1a08('0xd')],'grant_type':_0x1a08('0xd'),'client_secret':_0xcbf95[_0x1a08('0xe')]},'json':!![]};return rp(_0x39c861)[_0x1a08('0xf')](function(_0x11b072){return _0x11b072[_0x1a08('0x10')];})[_0x1a08('0x11')](function(_0x112ad1){logger[_0x1a08('0x12')]('['+[_0x34eded[_0x1a08('0x13')]()]+_0x1a08('0x14'));return _0x112ad1[_0x1a08('0x15')];});}function getUser(_0x57a178,_0x19ed2f,_0x3f61ae,_0x157348,_0xa2b7a9,_0x3df3e7){return new BPromise(function(_0x33ec65,_0x1f3315){return getAuthToken(_0x19ed2f,_0x157348,_0x3df3e7)[_0x1a08('0xf')](function(_0x534126){var _0x376738={'method':_0x1a08('0x16'),'uri':_0xa2b7a9+_0x1a08('0x17'),'headers':{'Authorization':_0x1a08('0x18')+_0x534126,'OData-Version':'4.0'},'json':!![]};return rp(_0x376738);})[_0x1a08('0xf')](function(_0x145ce){var _0x5059c2=_0x145ce[_0x1a08('0x19')];var _0x11dda5=![];var _0xa21ec9=null;if(!_['isNil'](_0x3f61ae)){if(intUtil[_0x1a08('0x1a')](_0x3f61ae['email'])){_0x57a178[_0x1a08('0x1b')]=_0x3f61ae['email'];for(_0xa21ec9=0x0;_0xa21ec9<_0x5059c2['length'];_0xa21ec9++){if(_0x5059c2[_0xa21ec9]['internalemailaddress']===_0x3f61ae[_0x1a08('0x1c')]&&!_0x5059c2[_0xa21ec9][_0x1a08('0x1d')]){_0x11dda5=!![];logger[_0x1a08('0x1e')]('['+[_0x3df3e7[_0x1a08('0x13')]()]+_0x1a08('0x1f')+_0x5059c2[_0xa21ec9][_0x1a08('0x20')]+'!');_0x57a178['userId']=_0x5059c2[_0xa21ec9]['systemuserid'];}}}}if(!_0x11dda5){logger[_0x1a08('0x1e')]('['+[_0x3df3e7[_0x1a08('0x13')]()]+_0x1a08('0x21'));_0x57a178[_0x1a08('0x1b')]=_0x19ed2f[_0x1a08('0xc')];for(_0xa21ec9=0x0;_0xa21ec9<_0x5059c2[_0x1a08('0x22')];_0xa21ec9++){if(_0x5059c2[_0xa21ec9][_0x1a08('0x23')]===_0x19ed2f[_0x1a08('0xc')]){_0x57a178[_0x1a08('0x24')]=_0x5059c2[_0xa21ec9]['systemuserid'];}}}_0x33ec65(_0x57a178);})[_0x1a08('0x11')](function(_0x4eef6c){_0x1f3315(_0x4eef6c[_0x1a08('0x15')]);});});}function createEndUser(_0x12ec84,_0x152c0c,_0x12c28f,_0x4b07b1,_0x38135e,_0x3ea25a){return new BPromise(function(_0x3a595c,_0xb0c02a){return getAuthToken(_0x152c0c,_0x12c28f,_0x3ea25a)[_0x1a08('0xf')](function(_0x2bc3ce){var _0x4280c9=_0x3ea25a[_0x1a08('0x25')]()===_0x1a08('0x26')?_0x38135e[_0x1a08('0x27')]:_0x38135e['calleridnum'];var _0x238c54={'method':_0x1a08('0xa'),'uri':_0x4b07b1+_0x1a08('0x28'),'body':{'telephone1':_0x4280c9,'fullname':_0x4280c9,'firstname':_0x4280c9,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x1a08('0x29')+_0x12ec84[_0x1a08('0x24')]+')'},'headers':{'Authorization':'Bearer\x20'+_0x2bc3ce,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};return rp(_0x238c54);})[_0x1a08('0xf')](function(_0x487fdf){var _0x2db64c=_0x487fdf[_0x1a08('0x2a')][_0x1a08('0x2b')];var _0x2ff94b=_0x2db64c[_0x1a08('0x2c')](_0x2db64c['lastIndexOf']('(')+0x1,_0x2db64c[_0x1a08('0x2d')](')'));_0x12ec84[_0x1a08('0x2e')]=_0x2ff94b;_0x3a595c(_0x12ec84);})['catch'](function(_0x481049){_0xb0c02a(_0x481049[_0x1a08('0x15')]);});});}function getEndUser(_0x477d9e,_0x2ee9b1,_0x34326d,_0x65a20d,_0x5bd208,_0xb35049){return new BPromise(function(_0x33fd6c,_0x22866e){var _0x354f5c=_0xb35049['toLowerCase']()===_0x1a08('0x26')?_0x5bd208['destcalleridnum']:_0x5bd208[_0x1a08('0x2f')];return getAuthToken(_0x2ee9b1,_0x34326d,_0xb35049)[_0x1a08('0xf')](function(_0xfe4338){var _0x17216d={'method':_0x1a08('0x16'),'uri':_0x65a20d+'contacts?$select=telephone1&$filter=telephone1\x20eq\x20\x27'+_0x354f5c[_0x1a08('0x30')]('+',_0x1a08('0x31'))+'\x27','headers':{'Authorization':_0x1a08('0x18')+_0xfe4338,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x17216d);})[_0x1a08('0xf')](function(_0x3c2827){var _0x5baa1b=null;if(_0x3c2827){var _0x20ee4b=_0x3c2827[_0x1a08('0x19')];var _0x17e463=![];for(_0x5baa1b=0x0;_0x5baa1b<_0x20ee4b[_0x1a08('0x22')];_0x5baa1b++){if(_0x20ee4b[_0x5baa1b][_0x1a08('0x32')]===_0x354f5c){_0x17e463=!![];_0x477d9e[_0x1a08('0x2e')]=_0x20ee4b[_0x5baa1b][_0x1a08('0x33')];}}if(_0x17e463){_0x33fd6c(_0x477d9e);}else{return createEndUser(_0x477d9e,_0x2ee9b1,_0x34326d,_0x65a20d,_0x5bd208,_0xb35049)[_0x1a08('0xf')](function(_0x1acc51){logger[_0x1a08('0x1e')]('['+[_0xb35049['toUpperCase']()]+_0x1a08('0x34'),_0x1acc51[_0x1a08('0x2e')]);_0x33fd6c(_0x1acc51);});}}else{return createEndUser(_0x477d9e,_0x2ee9b1,_0x34326d,_0x65a20d,_0x5bd208,_0xb35049)['then'](function(_0x3dd746){logger[_0x1a08('0x1e')]('['+[_0xb35049['toUpperCase']()]+_0x1a08('0x35'),_0x3dd746[_0x1a08('0x2e')]);_0x33fd6c(_0x3dd746);});}});});}function getCustomFields(_0x4410af,_0x5c9bd7,_0x389e2b){var _0x2008de={};if(_0x4410af[_0x1a08('0x22')]>0x0){_[_0x1a08('0x36')](_0x4410af,function(_0x2897c7){if(_[_0x1a08('0x37')]([_0x1a08('0x38'),_0x1a08('0x39')],_0x2897c7['type'])&&_0x2897c7[_0x1a08('0x3a')]&&!_0x2897c7[_0x1a08('0x3b')]){var _0x5d2032=_0x2897c7[_0x1a08('0x3c')][_0x1a08('0x25')]();var _0x21e1e7=_0x5d2032['substring'](0x0,_0x5d2032[_0x1a08('0x3d')]('_'));var _0x2f8913=_0x5d2032[_0x1a08('0x2c')](_0x5d2032['indexOf']('_')+0x1);if(_0x21e1e7===_0x389e2b){_0x2008de[_0x2f8913]=_0x2897c7['content'];}}});}return _0x2008de;}function getTicket(_0x9cf0cc,_0x35206d,_0x33a7e6,_0x286f04,_0x4258c5,_0x22aeba,_0x331447){return new BPromise(function(_0x382e14,_0xf6c648){var _0x4f2dfa;return getAuthToken(_0x35206d,_0x33a7e6,_0x331447)[_0x1a08('0xf')](function(_0x268e52){if(_0x22aeba['ticketType']==='incident'){_0x4f2dfa={'method':_0x1a08('0xa'),'uri':_0x286f04+_0x1a08('0x3e'),'body':Object[_0x1a08('0x3f')]({},{'title':intUtil[_0x1a08('0x40')](_0x22aeba[_0x1a08('0x41')],_0x4258c5,'\x20'),'description':intUtil[_0x1a08('0x40')](_0x22aeba[_0x1a08('0x42')],_0x4258c5,'\x0a'),'customerid_contact@odata.bind':'/contacts('+_0x9cf0cc[_0x1a08('0x2e')]+')','ownerid@odata.bind':'/systemusers('+_0x9cf0cc[_0x1a08('0x24')]+')','caseorigincode':'1'},getCustomFields(_0x22aeba[_0x1a08('0x43')],_0x4258c5,_0x22aeba[_0x1a08('0x44')])),'headers':{'Authorization':_0x1a08('0x18')+_0x268e52,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};}if(_0x22aeba[_0x1a08('0x44')]===_0x1a08('0x45')){_0x4f2dfa={'method':_0x1a08('0xa'),'uri':_0x286f04+'phonecalls','body':Object[_0x1a08('0x3f')]({},{'subject':intUtil[_0x1a08('0x40')](_0x22aeba['Subjects'],_0x4258c5,'\x20'),'phonenumber':String(_0x4258c5[_0x1a08('0x2f')]),'description':intUtil[_0x1a08('0x40')](_0x22aeba[_0x1a08('0x42')],_0x4258c5,'\x0a'),'regardingobjectid_contact@odata.bind':_0x1a08('0x46')+_0x9cf0cc[_0x1a08('0x2e')]+')','ownerid@odata.bind':'/systemusers('+_0x9cf0cc[_0x1a08('0x24')]+')','directioncode':_0x9cf0cc['callDirection']==='queue'?![]:!![],'phonecall_activity_parties':[{'partyid_systemuser@odata.bind':_0x1a08('0x29')+_0x9cf0cc[_0x1a08('0x24')]+')','participationtypemask':_0x9cf0cc[_0x1a08('0x47')]==='queue'?0x2:0x1},{'partyid_contact@odata.bind':_0x1a08('0x46')+_0x9cf0cc[_0x1a08('0x2e')]+')','participationtypemask':_0x9cf0cc[_0x1a08('0x47')]==='queue'?0x1:0x2}]},getCustomFields(_0x22aeba[_0x1a08('0x43')],_0x4258c5,_0x22aeba['ticketType'])),'headers':{'Authorization':_0x1a08('0x18')+_0x268e52,'OData-Version':_0x1a08('0x48')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x4f2dfa);})[_0x1a08('0xf')](function(_0x2de71c){var _0x52d348=_0x2de71c[_0x1a08('0x2a')][_0x1a08('0x2b')];var _0x52c3b3=_0x52d348[_0x1a08('0x2c')](_0x52d348[_0x1a08('0x2d')]('(')+0x1,_0x52d348[_0x1a08('0x2d')](')'));_0x9cf0cc['ticketId']=_0x52c3b3;_0x382e14(_0x9cf0cc);})['catch'](function(_0x2bdfb8){_0xf6c648(_0x2bdfb8['message']);});});}function emit(_0x4f7357,_0x1f8883,_0x349fb9,_0x5052b2){var _0x101592={'uri':util[_0x1a08('0x49')](_0x1a08('0x4a'),_0x4f7357,_0x349fb9,_0x5052b2)};io['to'](util['format'](_0x1a08('0x4b'),_0x1f8883))[_0x1a08('0x4c')](_0x1a08('0x4d'),_0x101592);}exports['cs']=function(_0x3da431,_0x10e9ba,_0x532677,_0x26ccd9,_0x52da45,_0x2b186c,_0x4f6ddd,_0x59a273){var _0x31c02b={};_0x2b186c['remoteUri']=intUtil[_0x1a08('0x4e')](_0x2b186c['remoteUri']);_0x2b186c[_0x1a08('0x4f')]=intUtil[_0x1a08('0x4e')](_0x2b186c['serverUrl']);_0x31c02b[_0x1a08('0x47')]=_0x59a273===_0x1a08('0x50')||_0x59a273===_0x1a08('0x51')?_0x1a08('0x50'):'outbound';var _0x57f66a=util[_0x1a08('0x49')](_0x1a08('0x52'),_0x2b186c[_0x1a08('0xb')]);var _0x350863=util[_0x1a08('0x49')]('https://login.microsoftonline.com/%s/oauth2/token',_0x2b186c[_0x1a08('0x53')]);var _0x410ade=util[_0x1a08('0x49')](_0x1a08('0x54'),_0x2b186c[_0x1a08('0x4f')],_0x10e9ba[_0x1a08('0x55')],md5(_0x10e9ba[_0x1a08('0x55')]));if(_0x52da45&&_0x52da45[_0x1a08('0x56')]){logger[_0x1a08('0x1e')](_0x1a08('0x57'),_0x1a08('0x58'));_0x10e9ba[_0x1a08('0x59')]=_0x410ade;}else if(_0x4f6ddd&&_0x4f6ddd[_0x1a08('0x5a')]&&_0x4f6ddd[_0x1a08('0x5a')]!=='none'){logger['info'](_0x1a08('0x5b'),_0x1a08('0x58'));_0x10e9ba['recordingURL']=_0x410ade;}else{_0x10e9ba['recordingURL']='';}return getUser(_0x31c02b,_0x2b186c,_0x26ccd9,_0x350863,_0x57f66a,_0x59a273)[_0x1a08('0xf')](function(_0x298c04){logger[_0x1a08('0x1e')]('['+_0x59a273[_0x1a08('0x13')]()+_0x1a08('0x5c'),_0x298c04[_0x1a08('0x24')]);logger[_0x1a08('0x1e')]('['+_0x59a273[_0x1a08('0x13')]()+_0x1a08('0x5d'),_0x298c04[_0x1a08('0x1b')]);return getEndUser(_0x298c04,_0x2b186c,_0x350863,_0x57f66a,_0x10e9ba,_0x59a273);})[_0x1a08('0xf')](function(_0x3d353f){logger[_0x1a08('0x1e')]('['+_0x59a273[_0x1a08('0x13')]()+_0x1a08('0x5e'),_0x3d353f[_0x1a08('0x2e')]);logger[_0x1a08('0x1e')]('['+_0x59a273[_0x1a08('0x13')]()+_0x1a08('0x5f'),_0x10e9ba['calleridnum']);return getTicket(_0x3d353f,_0x2b186c,_0x350863,_0x57f66a,_0x10e9ba,_0x532677,_0x59a273);})['then'](function(_0x442148){logger[_0x1a08('0x1e')](util[_0x1a08('0x49')]('['+_0x59a273['toUpperCase']()+_0x1a08('0x60'),_0x532677['ticketType'],_0x442148[_0x1a08('0x61')]));logger[_0x1a08('0x1e')](util[_0x1a08('0x49')]('['+_0x59a273[_0x1a08('0x13')]()+_0x1a08('0x62'),_0x59a273));if(_0x59a273!==_0x1a08('0x51')){logger[_0x1a08('0x1e')]('['+_0x59a273[_0x1a08('0x13')]()+']',_0x1a08('0x63'));emit(_0x2b186c['remoteUri'],_0x26ccd9[_0x1a08('0x64')],_0x532677[_0x1a08('0x44')],_0x442148[_0x1a08('0x61')]);}})[_0x1a08('0x11')](function(_0x30f689){logger['error']('['+_0x59a273['toUpperCase']()+']\x20Error\x20running\x20Dynamics365\x20integration',util[_0x1a08('0x65')](_0x30f689,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/freshdesk.js b/server/services/ami/trigger/integration/freshdesk.js index 92fc0b1..11f20d3 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 _0x55e6=['nameField','toLowerCase','content','type','idField','customField','push','toString','variable','variableName','Variable','queue','stripTrailingSlash','serverUrl','monitor_format','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','The\x20User\x20ID\x20is:','The\x20Enduser\x20ID\x20is:','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/helpdesk/tickets/%d','catch','error','recordingFormat','none','Authorization','destcalleridname','destcalleridnum','unmanaged','lastevent','lodash','request-promise','md5','util','ioredis','./util','freshdesk','defaults','redis','application/json','emit','info','Creating\x20new\x20ticket...','merge','Caller\x20-\x20%s','calleridname','calleridnum','getString','Subjects','Descriptions','
','Tags','name','Fields','custom_fields','mapValues','value','remoteUri','POST','then','validateEmail','%s/api/v2/agents','length','find','contact','email','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','format','Admin\x20account\x20selected.','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','Enduser\x20found!','%s/api/v2/contacts','Basic\x20%s','apiKey','debug','[HTTP]','stringify','GET','map','forEach','includes','string','picklist'];(function(_0x25025f,_0x502516){var _0x1661f2=function(_0x4c2951){while(--_0x4c2951){_0x25025f['push'](_0x25025f['shift']());}};_0x1661f2(++_0x502516);}(_0x55e6,0xd9));var _0x655e=function(_0x3c1360,_0x4724c3){_0x3c1360=_0x3c1360-0x0;var _0x4d1bc8=_0x55e6[_0x3c1360];return _0x4d1bc8;};'use strict';var _=require(_0x655e('0x0'));var rp=require(_0x655e('0x1'));var md5=require(_0x655e('0x2'));var util=require(_0x655e('0x3'));var Redis=require(_0x655e('0x4'));var intUtil=require(_0x655e('0x5'));var config=require('../../../../config/environment');var logger=require('../../../../config/logger')(_0x655e('0x6'));config['redis']=_[_0x655e('0x7')](config['redis'],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x655e('0x8')]));var headers={'Content-Type':_0x655e('0x9'),'Accept':_0x655e('0x9')};function emit(_0x1c39ed,_0x4c0bd7,_0x2e413b){io['to'](_0x1c39ed)[_0x655e('0xa')](_0x4c0bd7,_0x2e413b);}function getTicket(_0x539237,_0x5d1696,_0x88b4fc,_0x2c32f4,_0x9f76d3){logger[_0x655e('0xb')](_0x655e('0xc'));var _0x12fdbd=_[_0x655e('0xd')]({'responder_id':_0x5d1696['id'],'requester_id':_0x88b4fc['id'],'name':util['format'](_0x655e('0xe'),_0x9f76d3[_0x655e('0xf')]),'phone':_0x9f76d3[_0x655e('0x10')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0x655e('0x11')](_0x2c32f4[_0x655e('0x12')],_0x9f76d3,'\x20'),'description':intUtil[_0x655e('0x11')](_0x2c32f4[_0x655e('0x13')],_0x9f76d3,_0x655e('0x14')),'tags':getTags(_0x2c32f4[_0x655e('0x15')],_0x655e('0x16'))},getCustomFields(_0x2c32f4[_0x655e('0x17')],_0x9f76d3));_0x12fdbd[_0x655e('0x18')]=_[_0x655e('0x19')](_['keyBy'](_0x12fdbd['custom_fields'],'id'),_0x655e('0x1a'));return request({'uri':util['format']('%s/api/v2/tickets',_0x539237[_0x655e('0x1b')]),'method':_0x655e('0x1c'),'body':_0x12fdbd})[_0x655e('0x1d')](function(_0x421251){logger[_0x655e('0xb')]('Ticket\x20created!');return _0x421251;});}function getUser(_0xde5837,_0x2a12e5){if(intUtil[_0x655e('0x1e')](_0x2a12e5)){return request({'uri':util['format'](_0x655e('0x1f'),_0xde5837[_0x655e('0x1b')]),'qs':{'email':_0x2a12e5}})[_0x655e('0x1d')](function(_0x49951b){if(_0x49951b[_0x655e('0x20')]){logger['info']('Agent\x20found!');return _[_0x655e('0x21')](_0x49951b,function(_0x80a892){return _0x80a892[_0x655e('0x22')][_0x655e('0x23')]===_0x2a12e5;});}else{logger['info'](_0x655e('0x24'));return request({'uri':util[_0x655e('0x25')]('%s/api/v2/agents/me',_0xde5837[_0x655e('0x1b')])})['then'](function(_0x2835ae){logger[_0x655e('0xb')](_0x655e('0x26'));return _0x2835ae;});}});}else{logger[_0x655e('0xb')](_0x655e('0x27'));return request({'uri':util[_0x655e('0x25')]('%s/api/v2/agents/me',_0xde5837[_0x655e('0x1b')])})[_0x655e('0x1d')](function(_0x4c4ce4){logger[_0x655e('0xb')](_0x655e('0x26'));return _0x4c4ce4;});}}function getEndUser(_0x25cec3,_0x169bfe,_0x146627){logger['info']('Searching\x20enduser\x20with\x20phone',_0x146627);return request({'uri':util[_0x655e('0x25')]('%s/api/v2/contacts',_0x25cec3[_0x655e('0x1b')]),'qs':{'phone':_0x146627}})[_0x655e('0x1d')](function(_0x2b42e0){if(_0x2b42e0[_0x655e('0x20')]){logger[_0x655e('0xb')](_0x655e('0x28'));return _[_0x655e('0x21')](_0x2b42e0,{'phone':_0x146627});}else{logger['info']('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util[_0x655e('0x25')](_0x655e('0x29'),_0x25cec3['remoteUri']),'method':_0x655e('0x1c'),'body':{'name':_0x169bfe,'phone':_0x146627}})[_0x655e('0x1d')](function(_0x2af735){logger[_0x655e('0xb')]('Enduser\x20created.');return _0x2af735;});}});}function getAuth(_0x72e0ef){return util[_0x655e('0x25')](_0x655e('0x2a'),new Buffer(_0x72e0ef[_0x655e('0x2b')]+':X')['toString']('base64'));}function request(_0x576f0e){logger[_0x655e('0x2c')](_0x655e('0x2d'),JSON[_0x655e('0x2e')](_0x576f0e));return rp(_[_0x655e('0x7')](_0x576f0e,{'method':_0x655e('0x2f'),'headers':headers,'json':!![]}));}function getTags(_0x2ccdf4,_0x22c1ff){var _0x597a14=[];if(_0x2ccdf4&&_0x2ccdf4['length']>0x0){_0x597a14=_[_0x655e('0x30')](_0x2ccdf4,_0x22c1ff);}return _0x597a14;}function getCustomFields(_0x2a6bc3,_0x4067ae){var _0x3f80ad=[];var _0x3ca80c={'custom_fields':[]};if(_0x2a6bc3[_0x655e('0x20')]>0x0){_[_0x655e('0x31')](_0x2a6bc3,function(_0x51c023){if(_[_0x655e('0x32')]([_0x655e('0x33'),_0x655e('0x34')],_0x51c023['type'])&&_0x51c023[_0x655e('0x35')]&&!_0x51c023['customField']){_0x3ca80c[_0x51c023['nameField'][_0x655e('0x36')]()]=_0x51c023[_0x655e('0x37')]['toString']();}else if(_[_0x655e('0x32')]([_0x655e('0x33'),_0x655e('0x34')],_0x51c023[_0x655e('0x38')])&&_0x51c023[_0x655e('0x39')]&&_0x51c023[_0x655e('0x3a')]){_0x3ca80c[_0x655e('0x18')][_0x655e('0x3b')]({'id':_0x51c023[_0x655e('0x39')],'value':_0x51c023[_0x655e('0x37')][_0x655e('0x3c')]()});}else if(_0x51c023['type']===_0x655e('0x3d')&&_0x51c023[_0x655e('0x3e')]&&_0x51c023[_0x655e('0x39')]&&_0x51c023[_0x655e('0x3a')]){_0x4067ae[_0x51c023[_0x655e('0x3e')]]&&_0x3ca80c['custom_fields']['push']({'id':_0x51c023['idField'],'value':_0x4067ae[_0x51c023[_0x655e('0x3e')]]['toString']()});}else if(_0x51c023[_0x655e('0x38')]==='customVariable'&&_0x51c023[_0x655e('0x3f')]&&_0x51c023['Variable'][_0x655e('0x16')]&&_0x51c023[_0x655e('0x39')]&&_0x51c023[_0x655e('0x3a')]){_0x4067ae[_0x51c023[_0x655e('0x3f')][_0x655e('0x16')][_0x655e('0x36')]()]&&_0x3ca80c['custom_fields'][_0x655e('0x3b')]({'id':_0x51c023[_0x655e('0x39')],'value':_0x4067ae[_0x51c023[_0x655e('0x3f')][_0x655e('0x16')][_0x655e('0x36')]()][_0x655e('0x3c')]()});}});}return _0x3ca80c;}exports[_0x655e('0x40')]=function(_0x4a3b8d,_0x368ff1,_0x4ff288,_0x30a3da,_0x1aaa3f,_0x38587d){var _0x5bd8ac,_0x1e829b;_0x38587d[_0x655e('0x1b')]=intUtil[_0x655e('0x41')](_0x38587d['remoteUri']);_0x38587d['serverUrl']=intUtil['stripTrailingSlash'](_0x38587d[_0x655e('0x42')]);if(_0x1aaa3f&&_0x1aaa3f[_0x655e('0x43')]){logger[_0x655e('0xb')]('[QUEUE]',_0x655e('0x44'));_0x368ff1['recordingURL']=util[_0x655e('0x25')](_0x655e('0x45'),_0x38587d[_0x655e('0x42')],_0x368ff1[_0x655e('0x46')],md5(_0x368ff1[_0x655e('0x46')]));}else{_0x368ff1[_0x655e('0x47')]='';}headers['Authorization']=getAuth(_0x38587d);return getUser(_0x38587d,_0x30a3da[_0x655e('0x23')])[_0x655e('0x1d')](function(_0x14be1d){_0x5bd8ac=_0x14be1d;logger[_0x655e('0xb')](_0x655e('0x48'),_0x5bd8ac['id']);return getEndUser(_0x38587d,_0x368ff1['calleridname'],_0x368ff1[_0x655e('0x10')]);})[_0x655e('0x1d')](function(_0xfea6b8){_0x1e829b=_0xfea6b8;logger[_0x655e('0xb')](_0x655e('0x49'),_0x1e829b['id']);return getTicket(_0x38587d,_0x5bd8ac,_0x1e829b,_0x4ff288,_0x368ff1);})[_0x655e('0x1d')](function(_0x59d525){if(_0x59d525&&_0x59d525['id']){logger[_0x655e('0xb')](_0x655e('0x4a'));logger['info'](_0x655e('0x4b'),_0x59d525['id']);logger[_0x655e('0xb')](_0x655e('0x4c'),_0x655e('0x4d'));emit(util[_0x655e('0x25')](_0x655e('0x4e'),_0x30a3da['name']),_0x655e('0x4f'),{'uri':util[_0x655e('0x25')](_0x655e('0x50'),_0x38587d[_0x655e('0x1b')],_0x59d525['id'])});}})[_0x655e('0x51')](function(_0x5b693c){logger[_0x655e('0x52')](_0x655e('0x4c'),JSON[_0x655e('0x2e')](_0x5b693c));});};exports['outbound']=function(_0x5168ab,_0x5a59b8,_0x5715c3,_0x392bbb,_0x5250d9,_0x241c55,_0x2fa34c){var _0x50a6e5,_0x32465e;_0x241c55['remoteUri']=intUtil['stripTrailingSlash'](_0x241c55[_0x655e('0x1b')]);_0x241c55[_0x655e('0x42')]=intUtil[_0x655e('0x41')](_0x241c55['serverUrl']);if(_0x2fa34c&&_0x2fa34c[_0x655e('0x53')]&&_0x2fa34c[_0x655e('0x53')]!==_0x655e('0x54')){logger['info']('[OUTBOUND]',_0x655e('0x44'));_0x5a59b8['recordingURL']=util[_0x655e('0x25')](_0x655e('0x45'),_0x241c55['serverUrl'],_0x5a59b8[_0x655e('0x46')],md5(_0x5a59b8[_0x655e('0x46')]));}headers[_0x655e('0x55')]=getAuth(_0x241c55);return getUser(_0x241c55,_0x392bbb['email'])[_0x655e('0x1d')](function(_0x2f39f1){_0x50a6e5=_0x2f39f1;logger['info'](_0x655e('0x48'),_0x50a6e5['id']);return getEndUser(_0x241c55,_0x5a59b8[_0x655e('0x56')],_0x5a59b8[_0x655e('0x57')]);})[_0x655e('0x1d')](function(_0x3be03a){_0x32465e=_0x3be03a;logger[_0x655e('0xb')](_0x655e('0x49'),_0x32465e['id']);return getTicket(_0x241c55,_0x50a6e5,_0x32465e,_0x5715c3,_0x5a59b8);})['then'](function(_0x2c61b8){if(_0x2c61b8&&_0x2c61b8['id']){logger[_0x655e('0xb')](_0x655e('0x4a'));logger[_0x655e('0xb')](_0x655e('0x4b'),_0x2c61b8['id']);logger[_0x655e('0xb')]('[OUTBOUND]',_0x655e('0x4d'));emit(util[_0x655e('0x25')](_0x655e('0x4e'),_0x392bbb['name']),'trigger:browser:url',{'uri':util[_0x655e('0x25')](_0x655e('0x50'),_0x241c55['remoteUri'],_0x2c61b8['id'])});}})['catch'](function(_0x21aa9c){logger[_0x655e('0x52')]('[OUTBOUND]',JSON['stringify'](_0x21aa9c));});};exports[_0x655e('0x58')]=function(_0x4d108d,_0x3eaeae,_0x4ed767,_0x5ce44a,_0x4a902d,_0x3a7d0a){var _0x39a633,_0xc5005a;_0x3a7d0a[_0x655e('0x1b')]=intUtil[_0x655e('0x41')](_0x3a7d0a[_0x655e('0x1b')]);_0x3a7d0a['serverUrl']=intUtil['stripTrailingSlash'](_0x3a7d0a[_0x655e('0x42')]);if(_0x4a902d&&_0x4a902d[_0x655e('0x43')]){logger['info']('['+_0x3eaeae[_0x655e('0x59')]['toUpperCase']()+']',_0x655e('0x44'));_0x3eaeae[_0x655e('0x47')]=util[_0x655e('0x25')](_0x655e('0x45'),_0x3a7d0a['serverUrl'],_0x3eaeae['uniqueid'],md5(_0x3eaeae[_0x655e('0x46')]));}else{_0x3eaeae['recordingURL']='';}headers['Authorization']=getAuth(_0x3a7d0a);return getUser(_0x3a7d0a,'')[_0x655e('0x1d')](function(_0x3f0e8f){_0x39a633=_0x3f0e8f;logger[_0x655e('0xb')](_0x655e('0x48'),_0x39a633['id']);return getEndUser(_0x3a7d0a,_0x3eaeae[_0x655e('0xf')],_0x3eaeae[_0x655e('0x10')]);})[_0x655e('0x1d')](function(_0x1a54ed){_0xc5005a=_0x1a54ed;logger[_0x655e('0xb')]('The\x20Enduser\x20ID\x20is:',_0xc5005a['id']);return getTicket(_0x3a7d0a,_0x39a633,_0xc5005a,_0x4ed767,_0x3eaeae);})[_0x655e('0x1d')](function(_0x47f5d5){if(_0x47f5d5){logger[_0x655e('0xb')](_0x655e('0x4a'));logger['info'](_0x655e('0x4b'),_0x47f5d5['id']);}})[_0x655e('0x51')](function(_0x23da2a){logger[_0x655e('0x52')]('['+_0x3eaeae[_0x655e('0x59')]['toUpperCase']()+']',JSON[_0x655e('0x2e')](_0x23da2a));});}; \ No newline at end of file +var _0x996c=['toLowerCase','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','The\x20User\x20ID\x20is:','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','error','outbound','recordingFormat','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','Ticket\x20created!','%s/helpdesk/tickets/%d','catch','lastevent','toUpperCase','lodash','request-promise','md5','util','./util','../../../../config/environment','redis','defaults','localhost','socket.io-emitter','application/json','emit','info','Creating\x20new\x20ticket...','merge','format','Caller\x20-\x20%s','calleridname','calleridnum','getString','Subjects','Descriptions','
','name','mapValues','keyBy','custom_fields','value','%s/api/v2/tickets','POST','then','validateEmail','%s/api/v2/agents','remoteUri','Agent\x20found!','find','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','Admin\x20account\x20selected.','Searching\x20enduser\x20with\x20phone','%s/api/v2/contacts','length','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Enduser\x20created.','Basic\x20%s','apiKey','toString','base64','debug','[HTTP]','stringify','forEach','includes','type','idField','customField','push','content','variable','variableName','customVariable','Variable'];(function(_0xa388a2,_0x40bde6){var _0x7ce7f6=function(_0x5a242a){while(--_0x5a242a){_0xa388a2['push'](_0xa388a2['shift']());}};_0x7ce7f6(++_0x40bde6);}(_0x996c,0x1e3));var _0xc996=function(_0x4014e5,_0x125e6a){_0x4014e5=_0x4014e5-0x0;var _0x4ee8b7=_0x996c[_0x4014e5];return _0x4ee8b7;};'use strict';var _=require(_0xc996('0x0'));var rp=require(_0xc996('0x1'));var md5=require(_0xc996('0x2'));var util=require(_0xc996('0x3'));var Redis=require('ioredis');var intUtil=require(_0xc996('0x4'));var config=require(_0xc996('0x5'));var logger=require('../../../../config/logger')('freshdesk');config[_0xc996('0x6')]=_[_0xc996('0x7')](config[_0xc996('0x6')],{'host':_0xc996('0x8'),'port':0x18eb});var io=require(_0xc996('0x9'))(new Redis(config['redis']));var headers={'Content-Type':_0xc996('0xa'),'Accept':'application/json'};function emit(_0x1702c5,_0x15e441,_0x306c4e){io['to'](_0x1702c5)[_0xc996('0xb')](_0x15e441,_0x306c4e);}function getTicket(_0x4eaede,_0x1210b7,_0x58465e,_0x661cc6,_0x450db3){logger[_0xc996('0xc')](_0xc996('0xd'));var _0x2fdbec=_[_0xc996('0xe')]({'responder_id':_0x1210b7['id'],'requester_id':_0x58465e['id'],'name':util[_0xc996('0xf')](_0xc996('0x10'),_0x450db3[_0xc996('0x11')]),'phone':_0x450db3[_0xc996('0x12')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0xc996('0x13')](_0x661cc6[_0xc996('0x14')],_0x450db3,'\x20'),'description':intUtil[_0xc996('0x13')](_0x661cc6[_0xc996('0x15')],_0x450db3,_0xc996('0x16')),'tags':getTags(_0x661cc6['Tags'],_0xc996('0x17'))},getCustomFields(_0x661cc6['Fields'],_0x450db3));_0x2fdbec['custom_fields']=_[_0xc996('0x18')](_[_0xc996('0x19')](_0x2fdbec[_0xc996('0x1a')],'id'),_0xc996('0x1b'));return request({'uri':util[_0xc996('0xf')](_0xc996('0x1c'),_0x4eaede['remoteUri']),'method':_0xc996('0x1d'),'body':_0x2fdbec})[_0xc996('0x1e')](function(_0x352189){logger[_0xc996('0xc')]('Ticket\x20created!');return _0x352189;});}function getUser(_0x45707b,_0x14b630){if(intUtil[_0xc996('0x1f')](_0x14b630)){return request({'uri':util['format'](_0xc996('0x20'),_0x45707b[_0xc996('0x21')]),'qs':{'email':_0x14b630}})[_0xc996('0x1e')](function(_0x385798){if(_0x385798['length']){logger[_0xc996('0xc')](_0xc996('0x22'));return _[_0xc996('0x23')](_0x385798,function(_0x28dccd){return _0x28dccd['contact']['email']===_0x14b630;});}else{logger[_0xc996('0xc')](_0xc996('0x24'));return request({'uri':util[_0xc996('0xf')](_0xc996('0x25'),_0x45707b[_0xc996('0x21')])})['then'](function(_0x1c5d2b){logger['info']('Admin\x20account\x20selected.');return _0x1c5d2b;});}});}else{logger[_0xc996('0xc')](_0xc996('0x26'));return request({'uri':util['format'](_0xc996('0x25'),_0x45707b[_0xc996('0x21')])})[_0xc996('0x1e')](function(_0x1110ef){logger['info'](_0xc996('0x27'));return _0x1110ef;});}}function getEndUser(_0x555b20,_0x14872d,_0x346c10){logger[_0xc996('0xc')](_0xc996('0x28'),_0x346c10);return request({'uri':util[_0xc996('0xf')](_0xc996('0x29'),_0x555b20['remoteUri']),'qs':{'phone':_0x346c10}})[_0xc996('0x1e')](function(_0x1ebfbf){if(_0x1ebfbf[_0xc996('0x2a')]){logger['info']('Enduser\x20found!');return _[_0xc996('0x23')](_0x1ebfbf,{'phone':_0x346c10});}else{logger[_0xc996('0xc')](_0xc996('0x2b'));return request({'uri':util[_0xc996('0xf')](_0xc996('0x29'),_0x555b20[_0xc996('0x21')]),'method':_0xc996('0x1d'),'body':{'name':_0x14872d,'phone':_0x346c10}})['then'](function(_0x232a4e){logger[_0xc996('0xc')](_0xc996('0x2c'));return _0x232a4e;});}});}function getAuth(_0x46f81e){return util[_0xc996('0xf')](_0xc996('0x2d'),new Buffer(_0x46f81e[_0xc996('0x2e')]+':X')[_0xc996('0x2f')](_0xc996('0x30')));}function request(_0x256cf3){logger[_0xc996('0x31')](_0xc996('0x32'),JSON[_0xc996('0x33')](_0x256cf3));return rp(_[_0xc996('0x7')](_0x256cf3,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x5aa446,_0x2b3dad){var _0x44d56c=[];if(_0x5aa446&&_0x5aa446[_0xc996('0x2a')]>0x0){_0x44d56c=_['map'](_0x5aa446,_0x2b3dad);}return _0x44d56c;}function getCustomFields(_0x10c002,_0x50baee){var _0x523e04=[];var _0x50da23={'custom_fields':[]};if(_0x10c002[_0xc996('0x2a')]>0x0){_[_0xc996('0x34')](_0x10c002,function(_0x1d1c89){if(_[_0xc996('0x35')](['string','picklist'],_0x1d1c89[_0xc996('0x36')])&&_0x1d1c89['nameField']&&!_0x1d1c89['customField']){_0x50da23[_0x1d1c89['nameField']['toLowerCase']()]=_0x1d1c89['content'][_0xc996('0x2f')]();}else if(_[_0xc996('0x35')](['string','picklist'],_0x1d1c89[_0xc996('0x36')])&&_0x1d1c89[_0xc996('0x37')]&&_0x1d1c89[_0xc996('0x38')]){_0x50da23[_0xc996('0x1a')][_0xc996('0x39')]({'id':_0x1d1c89[_0xc996('0x37')],'value':_0x1d1c89[_0xc996('0x3a')][_0xc996('0x2f')]()});}else if(_0x1d1c89['type']===_0xc996('0x3b')&&_0x1d1c89[_0xc996('0x3c')]&&_0x1d1c89[_0xc996('0x37')]&&_0x1d1c89[_0xc996('0x38')]){_0x50baee[_0x1d1c89[_0xc996('0x3c')]]&&_0x50da23[_0xc996('0x1a')][_0xc996('0x39')]({'id':_0x1d1c89[_0xc996('0x37')],'value':_0x50baee[_0x1d1c89[_0xc996('0x3c')]]['toString']()});}else if(_0x1d1c89[_0xc996('0x36')]===_0xc996('0x3d')&&_0x1d1c89[_0xc996('0x3e')]&&_0x1d1c89[_0xc996('0x3e')][_0xc996('0x17')]&&_0x1d1c89['idField']&&_0x1d1c89['customField']){_0x50baee[_0x1d1c89[_0xc996('0x3e')]['name'][_0xc996('0x3f')]()]&&_0x50da23[_0xc996('0x1a')][_0xc996('0x39')]({'id':_0x1d1c89['idField'],'value':_0x50baee[_0x1d1c89[_0xc996('0x3e')]['name'][_0xc996('0x3f')]()][_0xc996('0x2f')]()});}});}return _0x50da23;}exports[_0xc996('0x40')]=function(_0x42c299,_0x5cea89,_0x4d5aff,_0x12f9d9,_0x361a39,_0x338b70){var _0x407383,_0x4decf5;_0x338b70['remoteUri']=intUtil[_0xc996('0x41')](_0x338b70[_0xc996('0x21')]);_0x338b70[_0xc996('0x42')]=intUtil[_0xc996('0x41')](_0x338b70['serverUrl']);if(_0x361a39&&_0x361a39[_0xc996('0x43')]){logger[_0xc996('0xc')](_0xc996('0x44'),'Recording\x20is\x20enabled!');_0x5cea89[_0xc996('0x45')]=util[_0xc996('0xf')](_0xc996('0x46'),_0x338b70[_0xc996('0x42')],_0x5cea89[_0xc996('0x47')],md5(_0x5cea89[_0xc996('0x47')]));}else{_0x5cea89[_0xc996('0x45')]='';}headers[_0xc996('0x48')]=getAuth(_0x338b70);return getUser(_0x338b70,_0x12f9d9['email'])[_0xc996('0x1e')](function(_0x7f7d9f){_0x407383=_0x7f7d9f;logger[_0xc996('0xc')](_0xc996('0x49'),_0x407383['id']);return getEndUser(_0x338b70,_0x5cea89[_0xc996('0x11')],_0x5cea89[_0xc996('0x12')]);})['then'](function(_0x2cb347){_0x4decf5=_0x2cb347;logger[_0xc996('0xc')](_0xc996('0x4a'),_0x4decf5['id']);return getTicket(_0x338b70,_0x407383,_0x4decf5,_0x4d5aff,_0x5cea89);})[_0xc996('0x1e')](function(_0x4fbb63){if(_0x4fbb63&&_0x4fbb63['id']){logger['info']('Ticket\x20created!');logger['info'](_0xc996('0x4b'),_0x4fbb63['id']);logger[_0xc996('0xc')](_0xc996('0x44'),_0xc996('0x4c'));emit(util['format'](_0xc996('0x4d'),_0x12f9d9[_0xc996('0x17')]),_0xc996('0x4e'),{'uri':util['format']('%s/helpdesk/tickets/%d',_0x338b70[_0xc996('0x21')],_0x4fbb63['id'])});}})['catch'](function(_0x4ddcbc){logger[_0xc996('0x4f')]('[QUEUE]',JSON[_0xc996('0x33')](_0x4ddcbc));});};exports[_0xc996('0x50')]=function(_0x1de571,_0x24c4e6,_0x423e5a,_0x3b8cb3,_0x6671ed,_0x14b0cf,_0x51579d){var _0x4a68f0,_0x36d7e8;_0x14b0cf['remoteUri']=intUtil[_0xc996('0x41')](_0x14b0cf[_0xc996('0x21')]);_0x14b0cf['serverUrl']=intUtil[_0xc996('0x41')](_0x14b0cf[_0xc996('0x42')]);if(_0x51579d&&_0x51579d[_0xc996('0x51')]&&_0x51579d['recordingFormat']!=='none'){logger[_0xc996('0xc')](_0xc996('0x52'),_0xc996('0x53'));_0x24c4e6['recordingURL']=util[_0xc996('0xf')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x14b0cf[_0xc996('0x42')],_0x24c4e6[_0xc996('0x47')],md5(_0x24c4e6[_0xc996('0x47')]));}headers['Authorization']=getAuth(_0x14b0cf);return getUser(_0x14b0cf,_0x3b8cb3['email'])[_0xc996('0x1e')](function(_0x29a3ee){_0x4a68f0=_0x29a3ee;logger[_0xc996('0xc')]('The\x20User\x20ID\x20is:',_0x4a68f0['id']);return getEndUser(_0x14b0cf,_0x24c4e6[_0xc996('0x54')],_0x24c4e6[_0xc996('0x55')]);})[_0xc996('0x1e')](function(_0x3a81a0){_0x36d7e8=_0x3a81a0;logger[_0xc996('0xc')](_0xc996('0x4a'),_0x36d7e8['id']);return getTicket(_0x14b0cf,_0x4a68f0,_0x36d7e8,_0x423e5a,_0x24c4e6);})['then'](function(_0x205783){if(_0x205783&&_0x205783['id']){logger[_0xc996('0xc')](_0xc996('0x56'));logger[_0xc996('0xc')](_0xc996('0x4b'),_0x205783['id']);logger[_0xc996('0xc')]('[OUTBOUND]',_0xc996('0x4c'));emit(util[_0xc996('0xf')]('user:%s',_0x3b8cb3[_0xc996('0x17')]),_0xc996('0x4e'),{'uri':util['format'](_0xc996('0x57'),_0x14b0cf[_0xc996('0x21')],_0x205783['id'])});}})[_0xc996('0x58')](function(_0x9d33c1){logger[_0xc996('0x4f')](_0xc996('0x52'),JSON[_0xc996('0x33')](_0x9d33c1));});};exports['unmanaged']=function(_0x2a5ad4,_0x14a4d5,_0x53798a,_0x1f7333,_0x22f59a,_0x49624a){var _0x471034,_0xd6f113;_0x49624a[_0xc996('0x21')]=intUtil[_0xc996('0x41')](_0x49624a[_0xc996('0x21')]);_0x49624a['serverUrl']=intUtil['stripTrailingSlash'](_0x49624a[_0xc996('0x42')]);if(_0x22f59a&&_0x22f59a[_0xc996('0x43')]){logger['info']('['+_0x14a4d5[_0xc996('0x59')][_0xc996('0x5a')]()+']',_0xc996('0x53'));_0x14a4d5[_0xc996('0x45')]=util[_0xc996('0xf')](_0xc996('0x46'),_0x49624a[_0xc996('0x42')],_0x14a4d5[_0xc996('0x47')],md5(_0x14a4d5['uniqueid']));}else{_0x14a4d5[_0xc996('0x45')]='';}headers[_0xc996('0x48')]=getAuth(_0x49624a);return getUser(_0x49624a,'')[_0xc996('0x1e')](function(_0x113622){_0x471034=_0x113622;logger['info'](_0xc996('0x49'),_0x471034['id']);return getEndUser(_0x49624a,_0x14a4d5[_0xc996('0x11')],_0x14a4d5['calleridnum']);})[_0xc996('0x1e')](function(_0x446c25){_0xd6f113=_0x446c25;logger[_0xc996('0xc')](_0xc996('0x4a'),_0xd6f113['id']);return getTicket(_0x49624a,_0x471034,_0xd6f113,_0x53798a,_0x14a4d5);})[_0xc996('0x1e')](function(_0x3164eb){if(_0x3164eb){logger['info'](_0xc996('0x56'));logger[_0xc996('0xc')](_0xc996('0x4b'),_0x3164eb['id']);}})[_0xc996('0x58')](function(_0x563632){logger['error']('['+_0x14a4d5['lastevent'][_0xc996('0x5a')]()+']',JSON[_0xc996('0x33')](_0x563632));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/freshsales.js b/server/services/ami/trigger/integration/freshsales.js index 43cad5e..b0103ac 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 _0xda5e=['userEmail','User\x20found:','userId','catch','&f=','&entities=contact','find','format','Searching\x20contact\x20with\x20phone\x20%s','contactNumber','mobile_number','endUserId','Contact\x20found\x20mobile_number:','work_number','Contact\x20found\x20work_number:','Contact\x20created:','POST','/api/contacts','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','Creating\x20new\x20task','/api/tasks','Subjects','Contact','ticketId','task','/contacts/','user:%s','emit','trigger:browser:url','Token\x20token=','apiKey','remoteUri','stripTrailingSlash','serverUrl','username','toLowerCase','outbound','destcalleridnum','calleridnum','callDirection','unmanaged','queue','agentEmail','%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...',']\x20Error\x20running\x20Freshsales\x20integration','inspect','md5','util','moment','bluebird','./util','../../../../config/environment','../../../../config/logger','freshsales','defaults','redis','localhost','socket.io-emitter','/api/selector/owners','headers','info','Getting\x20admin\x20information','then','users','length','email','adminEmail','adminId','Admin\x20found:','Requested\x20Resource\x20not\x20Found','error','toUpperCase','message','GET','Getting\x20user\x20list','Getting\x20user\x20with\x20email'];(function(_0x372f8f,_0x3827e4){var _0x127950=function(_0x57d307){while(--_0x57d307){_0x372f8f['push'](_0x372f8f['shift']());}};_0x127950(++_0x3827e4);}(_0xda5e,0xe4));var _0xeda5=function(_0x167307,_0x5a60ae){_0x167307=_0x167307-0x0;var _0x550140=_0xda5e[_0x167307];return _0x550140;};'use strict';var _=require('lodash');var rp=require('request-promise');var md5=require(_0xeda5('0x0'));var util=require(_0xeda5('0x1'));var moment=require(_0xeda5('0x2'));var Promise=require(_0xeda5('0x3'));var Redis=require('ioredis');var intUtil=require(_0xeda5('0x4'));var config=require(_0xeda5('0x5'));var logger=require(_0xeda5('0x6'))(_0xeda5('0x7'));config['redis']=_[_0xeda5('0x8')](config[_0xeda5('0x9')],{'host':_0xeda5('0xa'),'port':0x18eb});var io=require(_0xeda5('0xb'))(new Redis(config[_0xeda5('0x9')]));function getAdminId(_0x2d3886,_0x8d369c,_0x35dd7a,_0x46a65e){return new Promise(function(_0x404b28,_0x452869){var _0x3e2f4a=![];var _0x526a03={'method':'GET','uri':_0x46a65e+_0xeda5('0xc'),'json':!![]};_0x526a03[_0xeda5('0xd')]=_0x35dd7a;logger[_0xeda5('0xe')](_0xeda5('0xf'));return rp(_0x526a03)[_0xeda5('0x10')](function(_0x4e519c){if(_0x4e519c){var _0x3f131d=_0x4e519c[_0xeda5('0x11')];var _0x1c3f0e=null;for(_0x1c3f0e=0x0;_0x1c3f0e<_0x3f131d[_0xeda5('0x12')];_0x1c3f0e++){if(_0x3f131d[_0x1c3f0e][_0xeda5('0x13')]===_0x2d3886[_0xeda5('0x14')]){_0x2d3886[_0xeda5('0x15')]=_0x3f131d[_0x1c3f0e]['id'];_0x3e2f4a=!![];}}if(_0x3e2f4a){logger[_0xeda5('0xe')](_0xeda5('0x16'),_0x2d3886[_0xeda5('0x15')]);_0x404b28(_0x2d3886);}else{_0x452869({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}else{_0x452869({'statusCode':0x194,'message':_0xeda5('0x17')});}})['catch'](function(_0x29062a){logger[_0xeda5('0x18')]('['+[_0x8d369c[_0xeda5('0x19')]()]+']',_0x29062a[_0xeda5('0x1a')]);_0x452869(_0x29062a);});});}function getUser(_0x322fa8,_0x5b2aa5,_0xb68b0d){return function(_0x834c61){return new Promise(function(_0x24cf5b,_0x475055){var _0xfb4c2={'method':_0xeda5('0x1b'),'uri':_0xb68b0d+'/api/selector/owners','json':!![]};_0xfb4c2[_0xeda5('0xd')]=_0x5b2aa5;logger[_0xeda5('0xe')](_0xeda5('0x1c'));return rp(_0xfb4c2)['then'](function(_0x4b8d49){if(_0x4b8d49){var _0x581746=_0x4b8d49[_0xeda5('0x11')];var _0x4d084e=![];var _0x424737=null;if(_0x834c61['agentEmail']!==null){logger[_0xeda5('0xe')](_0xeda5('0x1d'),_0x834c61['agentEmail']);_0x834c61[_0xeda5('0x1e')]=_0x834c61['agentEmail'];for(_0x424737=0x0;_0x424737<_0x581746[_0xeda5('0x12')];_0x424737++){if(_0x581746[_0x424737]['email']===_0x834c61['agentEmail']){_0x4d084e=!![];_0x834c61['userId']=_0x581746[_0x424737]['id'];logger[_0xeda5('0xe')](_0xeda5('0x1f'),_0x834c61[_0xeda5('0x20')]);}}}if(!_0x4d084e){logger[_0xeda5('0xe')]('Admin\x20selected');_0x834c61[_0xeda5('0x1e')]=_0x834c61[_0xeda5('0x14')];_0x834c61['userId']=_0x834c61['adminId'];_0x4d084e=!![];}if(_0x4d084e){_0x24cf5b(_0x834c61);}else{_0x475055({'statusCode':0x194,'message':_0xeda5('0x17')});}}else{_0x475055({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}})[_0xeda5('0x21')](function(_0x56249f){logger['error']('['+[_0x322fa8['toUpperCase']()]+']',_0x56249f[_0xeda5('0x1a')]);_0x475055(_0x56249f);});});};}function searchContact(_0x20907b,_0x559079,_0x4c8345,_0x5b9f28){return new Promise(function(_0x25e6ba,_0x344d7b){var _0x11e296={'method':_0xeda5('0x1b'),'headers':_0x559079,'uri':_0x20907b+'/api/lookup?q='+_0x5b9f28+_0xeda5('0x22')+_0x4c8345+_0xeda5('0x23'),'json':!![]};rp(_0x11e296)['then'](function(_0x4841f2){var _0x307724=_[_0xeda5('0x24')](_0x4841f2['contacts']['contacts'],[_0x4c8345,_0x5b9f28]);_0x25e6ba(_0x307724);})[_0xeda5('0x21')](function(_0x48a578){_0x344d7b(_0x48a578);});});}function getEndUser(_0x37ef95,_0x3f8d48,_0x377ec1){return function(_0x105535){return new Promise(function(_0x1b24f5,_0x35aba4){logger[_0xeda5('0xe')](util[_0xeda5('0x25')](_0xeda5('0x26'),_0x105535[_0xeda5('0x27')]));searchContact(_0x377ec1,_0x3f8d48,_0xeda5('0x28'),_0x105535[_0xeda5('0x27')])['then'](function(_0x4bfffa){if(_0x4bfffa){_0x105535[_0xeda5('0x29')]=_0x4bfffa['id'];logger['info'](_0xeda5('0x2a'),_0x105535[_0xeda5('0x29')]);return _0x1b24f5(_0x105535);}searchContact(_0x377ec1,_0x3f8d48,_0xeda5('0x2b'),_0x105535['contactNumber'])['then'](function(_0x1a9efa){if(_0x1a9efa){_0x105535[_0xeda5('0x29')]=_0x1a9efa['id'];logger[_0xeda5('0xe')](_0xeda5('0x2c'),_0x105535['endUserId']);return _0x1b24f5(_0x105535);}createEndUser(_0x105535,_0x37ef95,_0x3f8d48,_0x377ec1)[_0xeda5('0x10')](function(_0x592459){logger['info'](_0xeda5('0x2d'),_0x592459[_0xeda5('0x29')]);return _0x1b24f5(_0x592459);});});})[_0xeda5('0x21')](function(_0x29b50c){_0x35aba4(_0x29b50c);});});};}function createEndUser(_0x6daf89,_0x2c50c6,_0x15cd4c,_0x3b7ea5){return new Promise(function(_0x125d05,_0x2209f5){var _0x5bea0b=moment();var _0x25a293={'method':_0xeda5('0x2e'),'uri':_0x3b7ea5+_0xeda5('0x2f'),'body':{'contact':{'last_name':_0x6daf89[_0xeda5('0x27')],'work_number':_0x6daf89['contactNumber'],'mobile_number':_0x6daf89[_0xeda5('0x27')],'owner_id':_0x6daf89[_0xeda5('0x20')],'created_at':_0x5bea0b['format'](_0xeda5('0x30'))}},'json':!![]};_0x25a293[_0xeda5('0xd')]=_0x15cd4c;logger[_0xeda5('0xe')](_0xeda5('0x31'));return rp(_0x25a293)[_0xeda5('0x10')](function(_0x1491d0){_0x6daf89[_0xeda5('0x29')]=_0x1491d0[_0xeda5('0x32')]['id'];_0x125d05(_0x6daf89);})[_0xeda5('0x21')](function(_0x3de961){logger[_0xeda5('0x18')]('['+[_0x2c50c6[_0xeda5('0x19')]()]+']',_0x3de961[_0xeda5('0x1a')]);_0x2209f5(_0x3de961[_0xeda5('0x1a')]);});});}function getTicket(_0x2cb10f,_0x95c4b8,_0x3205c5,_0x1c2267,_0x827a84){return function(_0x50beed){logger[_0xeda5('0xe')](_0xeda5('0x33'));return new Promise(function(_0x2db185,_0x4f59f6){var _0xbec6b1=moment();var _0x345ed2={'method':_0xeda5('0x2e'),'uri':_0x3205c5+_0xeda5('0x34'),'body':{'title':intUtil['getString'](_0x1c2267[_0xeda5('0x35')],_0x827a84,'\x20'),'description':intUtil['getString'](_0x1c2267['Descriptions'],_0x827a84,'\x0a'),'owner_id':_0x50beed[_0xeda5('0x20')],'creater_id':_0x50beed[_0xeda5('0x15')],'targetable_id':_0x50beed['endUserId'],'targetable_type':_0xeda5('0x36'),'created_at':_0xbec6b1[_0xeda5('0x25')](_0xeda5('0x30')),'due_date':_0xbec6b1['add'](0x1e,'m')[_0xeda5('0x25')](_0xeda5('0x30'))},'json':!![]};_0x345ed2[_0xeda5('0xd')]=_0x95c4b8;return rp(_0x345ed2)[_0xeda5('0x10')](function(_0xa80e36){_0x50beed[_0xeda5('0x37')]=_0xa80e36[_0xeda5('0x38')]['id'];logger[_0xeda5('0xe')]('Task\x20created:',_0x50beed[_0xeda5('0x37')]);_0x2db185(_0x50beed);})['catch'](function(_0x2606fb){logger['error']('['+[_0x2cb10f['toUpperCase']()]+']',_0x2606fb[_0xeda5('0x1a')]);_0x4f59f6(_0x2606fb[_0xeda5('0x1a')]);});});};}function emit(_0xb5b0fa,_0x49beb0,_0xc49bba){var _0x7d0434={'uri':_0xb5b0fa+_0xeda5('0x39')+_0xc49bba};io['to'](util['format'](_0xeda5('0x3a'),_0x49beb0))[_0xeda5('0x3b')](_0xeda5('0x3c'),_0x7d0434);}exports['cs']=function(_0xbe11c1,_0x15c198,_0x312f28,_0x596cd4,_0x2bbfc4,_0x4a9c8b,_0x259eb3,_0x58ef1c){var _0x56b766={};var _0xcf509a={'Authorization':_0xeda5('0x3d')+_0x4a9c8b[_0xeda5('0x3e')]};_0x4a9c8b[_0xeda5('0x3f')]=intUtil[_0xeda5('0x40')](_0x4a9c8b[_0xeda5('0x3f')]);_0x4a9c8b[_0xeda5('0x41')]=intUtil[_0xeda5('0x40')](_0x4a9c8b[_0xeda5('0x41')]);var _0x393bf5=_0x4a9c8b['remoteUri'];_0x56b766['adminEmail']=_0x4a9c8b[_0xeda5('0x42')];_0x56b766[_0xeda5('0x27')]=_0x58ef1c[_0xeda5('0x43')]()===_0xeda5('0x44')?_0x15c198[_0xeda5('0x45')]:_0x15c198[_0xeda5('0x46')];_0x56b766[_0xeda5('0x47')]=_0x58ef1c==='queue'||_0x58ef1c===_0xeda5('0x48')?_0xeda5('0x49'):_0xeda5('0x44');if(_0x596cd4){_0x56b766[_0xeda5('0x4a')]=_0x596cd4[_0xeda5('0x13')];}var _0x139eb2=util[_0xeda5('0x25')](_0xeda5('0x4b'),_0x4a9c8b['serverUrl'],_0x15c198[_0xeda5('0x4c')],md5(_0x15c198['uniqueid']));if(_0x2bbfc4&&_0x2bbfc4['monitor_format']){logger[_0xeda5('0xe')](_0xeda5('0x4d'),_0xeda5('0x4e'));_0x15c198[_0xeda5('0x4f')]=_0x139eb2;}else if(_0x259eb3&&_0x259eb3[_0xeda5('0x50')]&&_0x259eb3[_0xeda5('0x50')]!=='none'){logger[_0xeda5('0xe')](_0xeda5('0x51'),'Recording\x20is\x20enabled!');_0x15c198[_0xeda5('0x4f')]=_0x139eb2;}else{_0x15c198['recordingURL']='';}return getAdminId(_0x56b766,_0x58ef1c,_0xcf509a,_0x393bf5)['then'](getUser(_0x58ef1c,_0xcf509a,_0x393bf5))[_0xeda5('0x10')](getEndUser(_0x58ef1c,_0xcf509a,_0x393bf5))[_0xeda5('0x10')](getTicket(_0x58ef1c,_0xcf509a,_0x393bf5,_0x312f28,_0x15c198))['then'](function(_0x548555){logger[_0xeda5('0xe')](util['format'](_0xeda5('0x52'),_0x548555['ticketId']));if(_0x58ef1c!==_0xeda5('0x48')){logger[_0xeda5('0xe')]('['+[_0x58ef1c[_0xeda5('0x19')]()]+']',_0xeda5('0x53'));emit(_0x393bf5,_0x596cd4['name'],_0x548555[_0xeda5('0x29')]);}})[_0xeda5('0x21')](function(_0x24222c){logger[_0xeda5('0x18')]('['+[_0x58ef1c[_0xeda5('0x19')]()]+_0xeda5('0x54'),util[_0xeda5('0x55')](_0x24222c,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x1c1d=['&f=','&entities=contact','find','contacts','format','Searching\x20contact\x20with\x20phone\x20%s','contactNumber','mobile_number','endUserId','Contact\x20created:','POST','/api/contacts','headers','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','Creating\x20new\x20task','/api/tasks','getString','Subjects','Descriptions','YYYY-MM-DDTHH:mm:ss','add','ticketId','task','Task\x20created:','/contacts/','user:%s','emit','Token\x20token=','apiKey','remoteUri','stripTrailingSlash','serverUrl','username','outbound','calleridnum','callDirection','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','Displaying\x20task\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20Freshsales\x20integration','inspect','lodash','request-promise','md5','moment','ioredis','./util','redis','defaults','localhost','socket.io-emitter','info','Getting\x20admin\x20information','then','users','length','email','adminEmail','adminId','Admin\x20found:','Requested\x20Resource\x20not\x20Found','catch','error','toUpperCase','message','GET','/api/selector/owners','Getting\x20user\x20list','agentEmail','userEmail','userId','Admin\x20selected','/api/lookup?q='];(function(_0x3b0731,_0xcf9925){var _0x4204d7=function(_0x635ac5){while(--_0x635ac5){_0x3b0731['push'](_0x3b0731['shift']());}};_0x4204d7(++_0xcf9925);}(_0x1c1d,0x1d8));var _0xd1c1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1c1d[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xd1c1('0x0'));var rp=require(_0xd1c1('0x1'));var md5=require(_0xd1c1('0x2'));var util=require('util');var moment=require(_0xd1c1('0x3'));var Promise=require('bluebird');var Redis=require(_0xd1c1('0x4'));var intUtil=require(_0xd1c1('0x5'));var config=require('../../../../config/environment');var logger=require('../../../../config/logger')('freshsales');config[_0xd1c1('0x6')]=_[_0xd1c1('0x7')](config['redis'],{'host':_0xd1c1('0x8'),'port':0x18eb});var io=require(_0xd1c1('0x9'))(new Redis(config[_0xd1c1('0x6')]));function getAdminId(_0x425d9f,_0xad26b0,_0x5a23e5,_0x11b335){return new Promise(function(_0x4fa887,_0x39d8fd){var _0x1c3a28=![];var _0x48faaf={'method':'GET','uri':_0x11b335+'/api/selector/owners','json':!![]};_0x48faaf['headers']=_0x5a23e5;logger[_0xd1c1('0xa')](_0xd1c1('0xb'));return rp(_0x48faaf)[_0xd1c1('0xc')](function(_0x17380d){if(_0x17380d){var _0x25396f=_0x17380d[_0xd1c1('0xd')];var _0x189f04=null;for(_0x189f04=0x0;_0x189f04<_0x25396f[_0xd1c1('0xe')];_0x189f04++){if(_0x25396f[_0x189f04][_0xd1c1('0xf')]===_0x425d9f[_0xd1c1('0x10')]){_0x425d9f[_0xd1c1('0x11')]=_0x25396f[_0x189f04]['id'];_0x1c3a28=!![];}}if(_0x1c3a28){logger['info'](_0xd1c1('0x12'),_0x425d9f[_0xd1c1('0x11')]);_0x4fa887(_0x425d9f);}else{_0x39d8fd({'statusCode':0x194,'message':_0xd1c1('0x13')});}}else{_0x39d8fd({'statusCode':0x194,'message':_0xd1c1('0x13')});}})[_0xd1c1('0x14')](function(_0x3a7879){logger[_0xd1c1('0x15')]('['+[_0xad26b0[_0xd1c1('0x16')]()]+']',_0x3a7879[_0xd1c1('0x17')]);_0x39d8fd(_0x3a7879);});});}function getUser(_0x2e78ad,_0x232b7e,_0x2ede71){return function(_0x55e193){return new Promise(function(_0x228f56,_0x43dc13){var _0x2a8ce6={'method':_0xd1c1('0x18'),'uri':_0x2ede71+_0xd1c1('0x19'),'json':!![]};_0x2a8ce6['headers']=_0x232b7e;logger['info'](_0xd1c1('0x1a'));return rp(_0x2a8ce6)[_0xd1c1('0xc')](function(_0x6fe88){if(_0x6fe88){var _0x221a2d=_0x6fe88[_0xd1c1('0xd')];var _0x2942f5=![];var _0x4032e8=null;if(_0x55e193[_0xd1c1('0x1b')]!==null){logger[_0xd1c1('0xa')]('Getting\x20user\x20with\x20email',_0x55e193[_0xd1c1('0x1b')]);_0x55e193[_0xd1c1('0x1c')]=_0x55e193[_0xd1c1('0x1b')];for(_0x4032e8=0x0;_0x4032e8<_0x221a2d[_0xd1c1('0xe')];_0x4032e8++){if(_0x221a2d[_0x4032e8]['email']===_0x55e193[_0xd1c1('0x1b')]){_0x2942f5=!![];_0x55e193[_0xd1c1('0x1d')]=_0x221a2d[_0x4032e8]['id'];logger[_0xd1c1('0xa')]('User\x20found:',_0x55e193[_0xd1c1('0x1d')]);}}}if(!_0x2942f5){logger[_0xd1c1('0xa')](_0xd1c1('0x1e'));_0x55e193[_0xd1c1('0x1c')]=_0x55e193[_0xd1c1('0x10')];_0x55e193[_0xd1c1('0x1d')]=_0x55e193[_0xd1c1('0x11')];_0x2942f5=!![];}if(_0x2942f5){_0x228f56(_0x55e193);}else{_0x43dc13({'statusCode':0x194,'message':_0xd1c1('0x13')});}}else{_0x43dc13({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}})[_0xd1c1('0x14')](function(_0x3e1a7f){logger['error']('['+[_0x2e78ad[_0xd1c1('0x16')]()]+']',_0x3e1a7f[_0xd1c1('0x17')]);_0x43dc13(_0x3e1a7f);});});};}function searchContact(_0x2b21cc,_0x36d24f,_0x7560e,_0x237dcd){return new Promise(function(_0x185531,_0x4892a4){var _0x3694da={'method':_0xd1c1('0x18'),'headers':_0x36d24f,'uri':_0x2b21cc+_0xd1c1('0x1f')+_0x237dcd+_0xd1c1('0x20')+_0x7560e+_0xd1c1('0x21'),'json':!![]};rp(_0x3694da)['then'](function(_0x528938){var _0x5d9a1d=_[_0xd1c1('0x22')](_0x528938[_0xd1c1('0x23')][_0xd1c1('0x23')],[_0x7560e,_0x237dcd]);_0x185531(_0x5d9a1d);})[_0xd1c1('0x14')](function(_0x3e8af0){_0x4892a4(_0x3e8af0);});});}function getEndUser(_0x2831ef,_0x152d3c,_0x1112af){return function(_0x5c8647){return new Promise(function(_0x5642e0,_0x2fde3c){logger[_0xd1c1('0xa')](util[_0xd1c1('0x24')](_0xd1c1('0x25'),_0x5c8647[_0xd1c1('0x26')]));searchContact(_0x1112af,_0x152d3c,_0xd1c1('0x27'),_0x5c8647['contactNumber'])['then'](function(_0x45751d){if(_0x45751d){_0x5c8647[_0xd1c1('0x28')]=_0x45751d['id'];logger[_0xd1c1('0xa')]('Contact\x20found\x20mobile_number:',_0x5c8647[_0xd1c1('0x28')]);return _0x5642e0(_0x5c8647);}searchContact(_0x1112af,_0x152d3c,'work_number',_0x5c8647[_0xd1c1('0x26')])[_0xd1c1('0xc')](function(_0x17c991){if(_0x17c991){_0x5c8647[_0xd1c1('0x28')]=_0x17c991['id'];logger[_0xd1c1('0xa')]('Contact\x20found\x20work_number:',_0x5c8647['endUserId']);return _0x5642e0(_0x5c8647);}createEndUser(_0x5c8647,_0x2831ef,_0x152d3c,_0x1112af)[_0xd1c1('0xc')](function(_0x501eb3){logger[_0xd1c1('0xa')](_0xd1c1('0x29'),_0x501eb3['endUserId']);return _0x5642e0(_0x501eb3);});});})[_0xd1c1('0x14')](function(_0x39100e){_0x2fde3c(_0x39100e);});});};}function createEndUser(_0x179b97,_0x2b546e,_0x4c2739,_0x5c53e1){return new Promise(function(_0x59d92c,_0x1dbb81){var _0x193e1a=moment();var _0x527c19={'method':_0xd1c1('0x2a'),'uri':_0x5c53e1+_0xd1c1('0x2b'),'body':{'contact':{'last_name':_0x179b97[_0xd1c1('0x26')],'work_number':_0x179b97[_0xd1c1('0x26')],'mobile_number':_0x179b97[_0xd1c1('0x26')],'owner_id':_0x179b97['userId'],'created_at':_0x193e1a[_0xd1c1('0x24')]('YYYY-MM-DDTHH:mm:ss')}},'json':!![]};_0x527c19[_0xd1c1('0x2c')]=_0x4c2739;logger[_0xd1c1('0xa')](_0xd1c1('0x2d'));return rp(_0x527c19)[_0xd1c1('0xc')](function(_0x3208eb){_0x179b97[_0xd1c1('0x28')]=_0x3208eb[_0xd1c1('0x2e')]['id'];_0x59d92c(_0x179b97);})[_0xd1c1('0x14')](function(_0x63fdd4){logger[_0xd1c1('0x15')]('['+[_0x2b546e[_0xd1c1('0x16')]()]+']',_0x63fdd4[_0xd1c1('0x17')]);_0x1dbb81(_0x63fdd4['message']);});});}function getTicket(_0x47ac3e,_0x12154d,_0x1274d3,_0x102413,_0x102b32){return function(_0x10c9d6){logger['info'](_0xd1c1('0x2f'));return new Promise(function(_0x45333a,_0x571403){var _0x5bd949=moment();var _0x3a28e3={'method':_0xd1c1('0x2a'),'uri':_0x1274d3+_0xd1c1('0x30'),'body':{'title':intUtil[_0xd1c1('0x31')](_0x102413[_0xd1c1('0x32')],_0x102b32,'\x20'),'description':intUtil[_0xd1c1('0x31')](_0x102413[_0xd1c1('0x33')],_0x102b32,'\x0a'),'owner_id':_0x10c9d6[_0xd1c1('0x1d')],'creater_id':_0x10c9d6['adminId'],'targetable_id':_0x10c9d6[_0xd1c1('0x28')],'targetable_type':'Contact','created_at':_0x5bd949[_0xd1c1('0x24')](_0xd1c1('0x34')),'due_date':_0x5bd949[_0xd1c1('0x35')](0x1e,'m')[_0xd1c1('0x24')]('YYYY-MM-DDTHH:mm:ss')},'json':!![]};_0x3a28e3[_0xd1c1('0x2c')]=_0x12154d;return rp(_0x3a28e3)[_0xd1c1('0xc')](function(_0x56db12){_0x10c9d6[_0xd1c1('0x36')]=_0x56db12[_0xd1c1('0x37')]['id'];logger['info'](_0xd1c1('0x38'),_0x10c9d6[_0xd1c1('0x36')]);_0x45333a(_0x10c9d6);})[_0xd1c1('0x14')](function(_0xd7ee79){logger[_0xd1c1('0x15')]('['+[_0x47ac3e['toUpperCase']()]+']',_0xd7ee79['message']);_0x571403(_0xd7ee79[_0xd1c1('0x17')]);});});};}function emit(_0x1eb2a5,_0x395abc,_0x20084e){var _0x1707f2={'uri':_0x1eb2a5+_0xd1c1('0x39')+_0x20084e};io['to'](util[_0xd1c1('0x24')](_0xd1c1('0x3a'),_0x395abc))[_0xd1c1('0x3b')]('trigger:browser:url',_0x1707f2);}exports['cs']=function(_0xb23b9,_0x412338,_0xa8a727,_0x4c7be4,_0x247054,_0x55a82d,_0x3a6cec,_0xc7f4da){var _0x4413d1={};var _0x5d23d6={'Authorization':_0xd1c1('0x3c')+_0x55a82d[_0xd1c1('0x3d')]};_0x55a82d[_0xd1c1('0x3e')]=intUtil[_0xd1c1('0x3f')](_0x55a82d[_0xd1c1('0x3e')]);_0x55a82d['serverUrl']=intUtil[_0xd1c1('0x3f')](_0x55a82d[_0xd1c1('0x40')]);var _0x34f2c6=_0x55a82d[_0xd1c1('0x3e')];_0x4413d1[_0xd1c1('0x10')]=_0x55a82d[_0xd1c1('0x41')];_0x4413d1['contactNumber']=_0xc7f4da['toLowerCase']()===_0xd1c1('0x42')?_0x412338['destcalleridnum']:_0x412338[_0xd1c1('0x43')];_0x4413d1[_0xd1c1('0x44')]=_0xc7f4da===_0xd1c1('0x45')||_0xc7f4da===_0xd1c1('0x46')?_0xd1c1('0x45'):'outbound';if(_0x4c7be4){_0x4413d1[_0xd1c1('0x1b')]=_0x4c7be4[_0xd1c1('0xf')];}var _0x354784=util[_0xd1c1('0x24')](_0xd1c1('0x47'),_0x55a82d['serverUrl'],_0x412338['uniqueid'],md5(_0x412338[_0xd1c1('0x48')]));if(_0x247054&&_0x247054[_0xd1c1('0x49')]){logger['info'](_0xd1c1('0x4a'),_0xd1c1('0x4b'));_0x412338[_0xd1c1('0x4c')]=_0x354784;}else if(_0x3a6cec&&_0x3a6cec[_0xd1c1('0x4d')]&&_0x3a6cec[_0xd1c1('0x4d')]!==_0xd1c1('0x4e')){logger[_0xd1c1('0xa')](_0xd1c1('0x4f'),_0xd1c1('0x4b'));_0x412338[_0xd1c1('0x4c')]=_0x354784;}else{_0x412338[_0xd1c1('0x4c')]='';}return getAdminId(_0x4413d1,_0xc7f4da,_0x5d23d6,_0x34f2c6)['then'](getUser(_0xc7f4da,_0x5d23d6,_0x34f2c6))[_0xd1c1('0xc')](getEndUser(_0xc7f4da,_0x5d23d6,_0x34f2c6))[_0xd1c1('0xc')](getTicket(_0xc7f4da,_0x5d23d6,_0x34f2c6,_0xa8a727,_0x412338))[_0xd1c1('0xc')](function(_0x27f6b0){logger['info'](util[_0xd1c1('0x24')](_0xd1c1('0x50'),_0x27f6b0[_0xd1c1('0x36')]));if(_0xc7f4da!==_0xd1c1('0x46')){logger[_0xd1c1('0xa')]('['+[_0xc7f4da[_0xd1c1('0x16')]()]+']',_0xd1c1('0x51'));emit(_0x34f2c6,_0x4c7be4['name'],_0x27f6b0[_0xd1c1('0x28')]);}})[_0xd1c1('0x14')](function(_0x30a2ea){logger['error']('['+[_0xc7f4da[_0xd1c1('0x16')]()]+_0xd1c1('0x52'),util[_0xd1c1('0x53')](_0x30a2ea,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/index.js b/server/services/ami/trigger/integration/index.js index 704d506..771106d 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 _0x3529=['./dynamics365','./freshsales','zendesk','salesforce','sugarcrm','freshdesk','vtiger','dynamics365','freshsales','servicenow','toLowerCase','data1','find','Configurations','queue','routeId','outbound','log','EVENT\x20UNKNOWN','zoho','desk','unknown\x20integration','../../../../config/logger','error','[EXEC]','format','data3','%s\x20account\x20#%s\x20not\x20found','data2','lodash','util','./zendesk','./freshdesk','./zoho','./desk','./vtiger','./servicenow'];(function(_0x1ff7b5,_0x49cdf5){var _0x4cf0ad=function(_0x2ba23e){while(--_0x2ba23e){_0x1ff7b5['push'](_0x1ff7b5['shift']());}};_0x4cf0ad(++_0x49cdf5);}(_0x3529,0xd6));var _0x9352=function(_0x527824,_0xc824a9){_0x527824=_0x527824-0x0;var _0xc8b8ed=_0x3529[_0x527824];return _0xc8b8ed;};'use strict';var _=require(_0x9352('0x0'));var util=require(_0x9352('0x1'));var zendesk=require(_0x9352('0x2'));var salesforce=require('./salesforce');var sugarcrm=require('./sugarcrm');var freshdesk=require(_0x9352('0x3'));var zoho=require(_0x9352('0x4'));var desk=require(_0x9352('0x5'));var vtiger=require(_0x9352('0x6'));var servicenow=require(_0x9352('0x7'));var dynamics365=require(_0x9352('0x8'));var freshsales=require(_0x9352('0x9'));var integrations=[_0x9352('0xa'),_0x9352('0xb'),_0x9352('0xc'),_0x9352('0xd'),'zoho','desk',_0x9352('0xe'),_0x9352('0xf'),_0x9352('0x10'),_0x9352('0x11')];exports['exec']=function(_0x5a17e2,_0x15c9a9,_0xd3510,_0x57b54b,_0x21e383,_0x4cbea3){if(_0xd3510){if(_['includes'](integrations,_0x5a17e2['data1'][_0x9352('0x12')]())){try{var _0x4c4477=null;var _0x3ed22a='';var _0x51a186=_0xd3510[_0x5a17e2[_0x9352('0x13')][_0x9352('0x12')]()];if(_0x51a186){var _0x1011b1=_0x51a186[_0x5a17e2['data2']];if(_0x1011b1){var _0x1c4b91=_[_0x9352('0x14')](_0x1011b1[_0x9352('0x15')],{'id':parseInt(_0x5a17e2['data3'],0xa)});if(_0x1c4b91){if(_0x57b54b){if(_0x21e383&&_0x15c9a9[_0x9352('0x16')]){_0x3ed22a=_0x9352('0x16');}else if(_0x15c9a9[_0x9352('0x17')]){_0x3ed22a=_0x9352('0x18');}else{console[_0x9352('0x19')](_0x9352('0x1a'),_0x15c9a9);}}else{_0x3ed22a='unmanaged';}switch(_0x5a17e2['data1']['toLowerCase']()){case _0x9352('0xa'):zendesk[_0x3ed22a](_0x5a17e2,_0x15c9a9,_0x1c4b91,_0x57b54b,_0x21e383,_0x1011b1,_0x4cbea3);break;case _0x9352('0xb'):salesforce[_0x3ed22a](_0x5a17e2,_0x15c9a9,_0x1c4b91,_0x57b54b,_0x21e383,_0x1011b1,_0x4cbea3);break;case _0x9352('0xc'):sugarcrm[_0x3ed22a](_0x5a17e2,_0x15c9a9,_0x1c4b91,_0x57b54b,_0x21e383,_0x1011b1,_0x4cbea3);break;case _0x9352('0xd'):freshdesk[_0x3ed22a](_0x5a17e2,_0x15c9a9,_0x1c4b91,_0x57b54b,_0x21e383,_0x1011b1,_0x4cbea3);break;case _0x9352('0x1b'):zoho[_0x3ed22a](_0x5a17e2,_0x15c9a9,_0x1c4b91,_0x57b54b,_0x21e383,_0x1011b1,_0x4cbea3);break;case _0x9352('0x1c'):desk[_0x3ed22a](_0x5a17e2,_0x15c9a9,_0x1c4b91,_0x57b54b,_0x21e383,_0x1011b1,_0x4cbea3);break;case _0x9352('0xe'):vtiger[_0x3ed22a](_0x5a17e2,_0x15c9a9,_0x1c4b91,_0x57b54b,_0x21e383,_0x1011b1,_0x4cbea3);break;case'freshsales':freshsales['cs'](_0x5a17e2,_0x15c9a9,_0x1c4b91,_0x57b54b,_0x21e383,_0x1011b1,_0x4cbea3,_0x3ed22a);break;case _0x9352('0x11'):servicenow['cs'](_0x5a17e2,_0x15c9a9,_0x1c4b91,_0x57b54b,_0x21e383,_0x1011b1,_0x4cbea3,_0x3ed22a);break;case _0x9352('0xf'):dynamics365['cs'](_0x5a17e2,_0x15c9a9,_0x1c4b91,_0x57b54b,_0x21e383,_0x1011b1,_0x4cbea3,_0x3ed22a);break;default:console[_0x9352('0x19')](_0x9352('0x1d'));}}else{_0x4c4477=require(_0x9352('0x1e'))(_0x5a17e2[_0x9352('0x13')][_0x9352('0x12')]());_0x4c4477[_0x9352('0x1f')](_0x9352('0x20'),util[_0x9352('0x21')]('%s\x20configuration\x20#%s\x20not\x20found',_0x5a17e2[_0x9352('0x13')]['toLowerCase'](),_0x5a17e2[_0x9352('0x22')]));}}else{_0x4c4477=require(_0x9352('0x1e'))(_0x5a17e2[_0x9352('0x13')][_0x9352('0x12')]());_0x4c4477['error']('[EXEC]',util[_0x9352('0x21')](_0x9352('0x23'),_0x5a17e2[_0x9352('0x13')][_0x9352('0x12')](),_0x5a17e2[_0x9352('0x24')]));}}else{}}catch(_0x521754){console[_0x9352('0x1f')](_0x521754);}}}}; \ No newline at end of file +var _0xede1=['salesforce','sugarcrm','freshdesk','zoho','vtiger','dynamics365','freshsales','servicenow','exec','includes','data1','toLowerCase','data2','find','Configurations','data3','queue','routeId','log','EVENT\x20UNKNOWN','unmanaged','unknown\x20integration','../../../../config/logger','error','[EXEC]','format','%s\x20configuration\x20#%s\x20not\x20found','%s\x20account\x20#%s\x20not\x20found','./zendesk','./sugarcrm','./freshdesk','./zoho','./vtiger','./servicenow','./dynamics365','zendesk'];(function(_0xbb9dbf,_0x5dafa4){var _0x30223c=function(_0xaa9ca){while(--_0xaa9ca){_0xbb9dbf['push'](_0xbb9dbf['shift']());}};_0x30223c(++_0x5dafa4);}(_0xede1,0x1a8));var _0x1ede=function(_0x54efe3,_0x228f0d){_0x54efe3=_0x54efe3-0x0;var _0x1fd3bc=_0xede1[_0x54efe3];return _0x1fd3bc;};'use strict';var _=require('lodash');var util=require('util');var zendesk=require(_0x1ede('0x0'));var salesforce=require('./salesforce');var sugarcrm=require(_0x1ede('0x1'));var freshdesk=require(_0x1ede('0x2'));var zoho=require(_0x1ede('0x3'));var desk=require('./desk');var vtiger=require(_0x1ede('0x4'));var servicenow=require(_0x1ede('0x5'));var dynamics365=require(_0x1ede('0x6'));var freshsales=require('./freshsales');var integrations=[_0x1ede('0x7'),_0x1ede('0x8'),_0x1ede('0x9'),_0x1ede('0xa'),_0x1ede('0xb'),'desk',_0x1ede('0xc'),_0x1ede('0xd'),_0x1ede('0xe'),_0x1ede('0xf')];exports[_0x1ede('0x10')]=function(_0x200ffa,_0x335660,_0x520d9e,_0x104ed9,_0x28cfac,_0x468d47){if(_0x520d9e){if(_[_0x1ede('0x11')](integrations,_0x200ffa[_0x1ede('0x12')][_0x1ede('0x13')]())){try{var _0x5c8523=null;var _0x2bf74f='';var _0x5aaae9=_0x520d9e[_0x200ffa[_0x1ede('0x12')][_0x1ede('0x13')]()];if(_0x5aaae9){var _0x597ce6=_0x5aaae9[_0x200ffa[_0x1ede('0x14')]];if(_0x597ce6){var _0x34d4b3=_[_0x1ede('0x15')](_0x597ce6[_0x1ede('0x16')],{'id':parseInt(_0x200ffa[_0x1ede('0x17')],0xa)});if(_0x34d4b3){if(_0x104ed9){if(_0x28cfac&&_0x335660[_0x1ede('0x18')]){_0x2bf74f=_0x1ede('0x18');}else if(_0x335660[_0x1ede('0x19')]){_0x2bf74f='outbound';}else{console[_0x1ede('0x1a')](_0x1ede('0x1b'),_0x335660);}}else{_0x2bf74f=_0x1ede('0x1c');}switch(_0x200ffa[_0x1ede('0x12')]['toLowerCase']()){case _0x1ede('0x7'):zendesk[_0x2bf74f](_0x200ffa,_0x335660,_0x34d4b3,_0x104ed9,_0x28cfac,_0x597ce6,_0x468d47);break;case _0x1ede('0x8'):salesforce[_0x2bf74f](_0x200ffa,_0x335660,_0x34d4b3,_0x104ed9,_0x28cfac,_0x597ce6,_0x468d47);break;case _0x1ede('0x9'):sugarcrm[_0x2bf74f](_0x200ffa,_0x335660,_0x34d4b3,_0x104ed9,_0x28cfac,_0x597ce6,_0x468d47);break;case _0x1ede('0xa'):freshdesk[_0x2bf74f](_0x200ffa,_0x335660,_0x34d4b3,_0x104ed9,_0x28cfac,_0x597ce6,_0x468d47);break;case _0x1ede('0xb'):zoho[_0x2bf74f](_0x200ffa,_0x335660,_0x34d4b3,_0x104ed9,_0x28cfac,_0x597ce6,_0x468d47);break;case'desk':desk[_0x2bf74f](_0x200ffa,_0x335660,_0x34d4b3,_0x104ed9,_0x28cfac,_0x597ce6,_0x468d47);break;case _0x1ede('0xc'):vtiger[_0x2bf74f](_0x200ffa,_0x335660,_0x34d4b3,_0x104ed9,_0x28cfac,_0x597ce6,_0x468d47);break;case'freshsales':freshsales['cs'](_0x200ffa,_0x335660,_0x34d4b3,_0x104ed9,_0x28cfac,_0x597ce6,_0x468d47,_0x2bf74f);break;case'servicenow':servicenow['cs'](_0x200ffa,_0x335660,_0x34d4b3,_0x104ed9,_0x28cfac,_0x597ce6,_0x468d47,_0x2bf74f);break;case _0x1ede('0xd'):dynamics365['cs'](_0x200ffa,_0x335660,_0x34d4b3,_0x104ed9,_0x28cfac,_0x597ce6,_0x468d47,_0x2bf74f);break;default:console[_0x1ede('0x1a')](_0x1ede('0x1d'));}}else{_0x5c8523=require(_0x1ede('0x1e'))(_0x200ffa[_0x1ede('0x12')]['toLowerCase']());_0x5c8523[_0x1ede('0x1f')](_0x1ede('0x20'),util[_0x1ede('0x21')](_0x1ede('0x22'),_0x200ffa[_0x1ede('0x12')]['toLowerCase'](),_0x200ffa['data3']));}}else{_0x5c8523=require(_0x1ede('0x1e'))(_0x200ffa[_0x1ede('0x12')][_0x1ede('0x13')]());_0x5c8523['error']('[EXEC]',util[_0x1ede('0x21')](_0x1ede('0x23'),_0x200ffa['data1']['toLowerCase'](),_0x200ffa[_0x1ede('0x14')]));}}else{}}catch(_0x8d5fc0){console[_0x1ede('0x1f')](_0x8d5fc0);}}}}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/salesforce.js b/server/services/ami/trigger/integration/salesforce.js index 62c732f..8a6f7f4 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 _0x28cb=['socket.io-emitter','emit','Subjects','Descriptions','Task','ActivityDate','utc','IsRecurrence','endUserType','lead','account','WhatId','ticketType','Case','ContactId','AccountId','info','Association\x20between\x20Case\x20and\x20Lead\x20skipped','sobject','create','isNil','validateEmail','User','find','length','Email','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','$or','Contact','execute','additionalSearchLead','merge','Lead','additionalSearchAccount','Account','contact','first','attributes','type','toLowerCase','Enduser\x20with\x20phone\x20%s\x20not\x20found','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','format','Caller\x20-\x20%s','LastName','','Company','No\x20Company','upperFirst','forEach','includes','string','picklist','idField','content','toString','variable','variableName','Variable','name','concat','securityToken','Connection','remoteUri','https://login.salesforce.com','clientId','login','username','Connection\x20established.','queue','serverUrl','stripTrailingSlash','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','email','calleridname','Fields','[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','user:%s','trigger:salesforce:display','newTab','trigger:browser:url','%s/%s/e','instanceUrl','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','outbound','recordingFormat','none','[OUTBOUND]','uniqueid','destcalleridname','destcalleridnum','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','Salesforce\x20account\x20type\x20not\x20recognized','unmanaged','monitor_format','lastevent','calleridnum',']\x20Ticket\x20%s\x20created.',']\x20Integration\x20account\x20type\x20%s.','toUpperCase','lodash','moment','util','ioredis','./util','../../../../config/environment','../../../../config/logger','salesforce','redis','defaults','localhost'];(function(_0x28125e,_0x1124f9){var _0x25fb7b=function(_0x5d170c){while(--_0x5d170c){_0x28125e['push'](_0x28125e['shift']());}};_0x25fb7b(++_0x1124f9);}(_0x28cb,0x17e));var _0xb28c=function(_0x1d9aa0,_0x272488){_0x1d9aa0=_0x1d9aa0-0x0;var _0x226868=_0x28cb[_0x1d9aa0];return _0x226868;};'use strict';var _=require(_0xb28c('0x0'));var rp=require('request-promise');var moment=require(_0xb28c('0x1'));var BPromise=require('bluebird');var md5=require('md5');var jsforce=require('jsforce');var util=require(_0xb28c('0x2'));var Redis=require(_0xb28c('0x3'));var intUtil=require(_0xb28c('0x4'));var config=require(_0xb28c('0x5'));var logger=require(_0xb28c('0x6'))(_0xb28c('0x7'));config[_0xb28c('0x8')]=_[_0xb28c('0x9')](config[_0xb28c('0x8')],{'host':_0xb28c('0xa'),'port':0x18eb});var io=require(_0xb28c('0xb'))(new Redis(config['redis']));function emit(_0x5eabe2,_0x4eb4ea,_0x4b048c){io['to'](_0x5eabe2)[_0xb28c('0xc')](_0x4eb4ea,_0x4b048c);}function getTicket(_0x329cc0,_0x46b240,_0x15e39a,_0x519de5,_0x31bc9f,_0xb23943,_0x2d385f,_0x61f6eb){var _0x527a0b=Object['assign']({},{'OwnerId':_0x46b240['id'],'Subject':intUtil['getString'](_0x519de5[_0xb28c('0xd')],_0x31bc9f,'\x20'),'Description':intUtil['getString'](_0x519de5[_0xb28c('0xe')],_0x31bc9f,'\x0a')},getCustomFields(_0xb23943,_0x31bc9f));if(_0x15e39a){if(_0x519de5['ticketType']===_0xb28c('0xf')){_0x527a0b[_0xb28c('0x10')]=moment[_0xb28c('0x11')]();_0x527a0b['IsReminderSet']=![];_0x527a0b[_0xb28c('0x12')]=![];if(_0x15e39a[_0xb28c('0x13')]==='contact'||_0x15e39a[_0xb28c('0x13')]===_0xb28c('0x14')){_0x527a0b['WhoId']=_0x15e39a['id'];}else if(_0x15e39a[_0xb28c('0x13')]===_0xb28c('0x15')){_0x527a0b[_0xb28c('0x16')]=_0x15e39a['id'];}}else if(_0x519de5[_0xb28c('0x17')]===_0xb28c('0x18')){if(_0x15e39a[_0xb28c('0x13')]==='contact'){_0x527a0b[_0xb28c('0x19')]=_0x15e39a['id'];}else if(_0x15e39a[_0xb28c('0x13')]===_0xb28c('0x15')){_0x527a0b[_0xb28c('0x1a')]=_0x15e39a['id'];}else if(_0x15e39a[_0xb28c('0x13')]===_0xb28c('0x14')&&_0x519de5['leadId']){_0x527a0b[_0x519de5['leadId']]=_0x15e39a['id'];}else{logger[_0xb28c('0x1b')](_0xb28c('0x1c'));}}}return _0x2d385f[_0xb28c('0x1d')](_0x519de5['ticketType'])[_0xb28c('0x1e')](_0x527a0b);}function getUser(_0x33690e,_0x252563,_0x4aac9f){if(!_[_0xb28c('0x1f')](_0x252563)&&intUtil[_0xb28c('0x20')](_0x252563)){var _0x5d8015={'Email':_0x252563};var _0x4567b7={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x4aac9f[_0xb28c('0x1d')](_0xb28c('0x21'))[_0xb28c('0x22')](_0x5d8015,_0x4567b7)['execute']()['then'](function(_0x20519c){if(_0x20519c[_0xb28c('0x23')]){var _0x35f788=_[_0xb28c('0x22')](_0x20519c,function(_0x31e54f){return _0x31e54f[_0xb28c('0x24')]===_0x252563;});if(_0x35f788){logger[_0xb28c('0x1b')](_0xb28c('0x25'),_0x252563);return BPromise[_0xb28c('0x26')]({'id':_0x35f788['Id'],'name':_0x35f788[_0xb28c('0x27')]});}}else{logger[_0xb28c('0x1b')](_0xb28c('0x28'),_0x252563);return _0x4aac9f[_0xb28c('0x29')]()[_0xb28c('0x2a')](function(_0x3f941d){return BPromise[_0xb28c('0x26')]({'id':_0x3f941d[_0xb28c('0x2b')],'name':_0x3f941d[_0xb28c('0x2c')]});});}});}else{logger[_0xb28c('0x1b')](_0xb28c('0x28'),_0x252563);return _0x4aac9f['identity']()[_0xb28c('0x2a')](function(_0x1f9d9f){return BPromise[_0xb28c('0x26')]({'id':_0x1f9d9f['user_id'],'name':_0x1f9d9f[_0xb28c('0x2c')]});});}}function getEndUser(_0x104106,_0xbe748b,_0x53f6de,_0x2b019e,_0x371624){var _0xd4f0bc={'$or':{'Phone':_0x2b019e}};var _0x4db699={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0xb28c('0x26')]()[_0xb28c('0x2a')](function(){logger[_0xb28c('0x1b')](_0xb28c('0x2d'),_0x2b019e,_0xbe748b[_0xb28c('0x2e')]);switch(_0xbe748b[_0xb28c('0x2e')]){case _0xb28c('0x2f'):var _0x14d38f=_[_0xb28c('0x30')](_0xd4f0bc);if(_0xbe748b[_0xb28c('0x31')]){var _0x50e22d={};_0x50e22d[_0xbe748b['additionalSearchContact']]=_0x2b019e;_['merge'](_0x14d38f[_0xb28c('0x32')],_0x50e22d);}return _0x371624[_0xb28c('0x1d')](_0xb28c('0x33'))[_0xb28c('0x22')](_0x14d38f,_0x4db699)[_0xb28c('0x34')]()[_0xb28c('0x2a')](function(_0x4a2207){if(_0x4a2207&&_0x4a2207[_0xb28c('0x23')]){return _0x4a2207;}else{var _0x2e6f9f=_['cloneDeep'](_0xd4f0bc);if(_0xbe748b[_0xb28c('0x35')]){var _0x19abd3={};_0x19abd3[_0xbe748b[_0xb28c('0x35')]]=_0x2b019e;_[_0xb28c('0x36')](_0x2e6f9f[_0xb28c('0x32')],_0x19abd3);}return _0x371624[_0xb28c('0x1d')](_0xb28c('0x37'))[_0xb28c('0x22')](_0x2e6f9f,_0x4db699);}});case'account_contact_lead':var _0x23912c=_[_0xb28c('0x30')](_0xd4f0bc);if(_0xbe748b[_0xb28c('0x38')]){var _0x50e22d={};_0x50e22d[_0xbe748b[_0xb28c('0x38')]]=_0x2b019e;_[_0xb28c('0x36')](_0x23912c[_0xb28c('0x32')],_0x50e22d);}return _0x371624[_0xb28c('0x1d')](_0xb28c('0x39'))[_0xb28c('0x22')](_0x23912c,_0x4db699)[_0xb28c('0x34')]()[_0xb28c('0x2a')](function(_0x2becf2){if(_0x2becf2&&_0x2becf2[_0xb28c('0x23')]){return _0x2becf2;}else{var _0x897d33=_[_0xb28c('0x30')](_0xd4f0bc);if(_0xbe748b[_0xb28c('0x31')]){var _0x231738={};_0x231738[_0xbe748b[_0xb28c('0x31')]]=_0x2b019e;_['merge'](_0x897d33[_0xb28c('0x32')],_0x231738);}return _0x371624[_0xb28c('0x1d')](_0xb28c('0x33'))[_0xb28c('0x22')](_0x897d33,_0x4db699)[_0xb28c('0x2a')](function(_0x547406){if(_0x547406&&_0x547406[_0xb28c('0x23')]){return _0x547406;}else{var _0x5e9aac=_[_0xb28c('0x30')](_0xd4f0bc);if(_0xbe748b[_0xb28c('0x35')]){var _0x5ae91f={};_0x5ae91f[_0xbe748b[_0xb28c('0x35')]]=_0x2b019e;_['merge'](_0x5e9aac[_0xb28c('0x32')],_0x5ae91f);}return _0x371624[_0xb28c('0x1d')]('Lead')[_0xb28c('0x22')](_0x5e9aac,_0x4db699);}});}});case _0xb28c('0x3a'):var _0x14d38f=_['cloneDeep'](_0xd4f0bc);if(_0xbe748b['additionalSearchContact']){var _0x50e22d={};_0x50e22d[_0xbe748b['additionalSearchContact']]=_0x2b019e;_[_0xb28c('0x36')](_0x14d38f[_0xb28c('0x32')],_0x50e22d);}return _0x371624[_0xb28c('0x1d')](_0xb28c('0x33'))[_0xb28c('0x22')](_0x14d38f,_0x4db699)['execute']();case _0xb28c('0x14'):var _0x267c14=_['cloneDeep'](_0xd4f0bc);if(_0xbe748b[_0xb28c('0x35')]){var _0x50e22d={};_0x50e22d[_0xbe748b['additionalSearchLead']]=_0x2b019e;_[_0xb28c('0x36')](_0x267c14[_0xb28c('0x32')],_0x50e22d);}return _0x371624[_0xb28c('0x1d')](_0xb28c('0x37'))[_0xb28c('0x22')](_0x267c14,_0x4db699);case _0xb28c('0x15'):var _0x23912c=_['cloneDeep'](_0xd4f0bc);if(_0xbe748b[_0xb28c('0x38')]){var _0x50e22d={};_0x50e22d[_0xbe748b[_0xb28c('0x38')]]=_0x2b019e;_[_0xb28c('0x36')](_0x23912c['$or'],_0x50e22d);}return _0x371624[_0xb28c('0x1d')]('Account')[_0xb28c('0x22')](_0x23912c,_0x4db699);default:return null;}})[_0xb28c('0x2a')](function(_0x4ab39c){if(_0x4ab39c&&_0x4ab39c[_0xb28c('0x23')]){var _0x5c199f=_[_0xb28c('0x3b')](_0x4ab39c);if(_0x5c199f){return BPromise['resolve']({'id':_0x5c199f['Id'],'name':_0x5c199f[_0xb28c('0x27')],'phone':_0x5c199f['Phone'],'endUserType':_0x5c199f[_0xb28c('0x3c')][_0xb28c('0x3d')][_0xb28c('0x3e')]()});}}})[_0xb28c('0x2a')](function(_0x43f211){if(_0x43f211){logger[_0xb28c('0x1b')]('Enduser\x20(%s)\x20with\x20phone\x20%s\x20found',_0x43f211[_0xb28c('0x13')],_0x2b019e);return BPromise['resolve'](_0x43f211);}else{logger[_0xb28c('0x1b')](_0xb28c('0x3f'),_0x2b019e);var _0x410f2d={'Phone':_0x2b019e};if(_0xbe748b['moduleCreate']){if(_0xbe748b[_0xb28c('0x40')]===_0xb28c('0x3a')){logger[_0xb28c('0x1b')](_0xb28c('0x41'),_0x2b019e,_0xbe748b[_0xb28c('0x40')]);_0x410f2d['LastName']=_0x53f6de!==''?_0x53f6de:util[_0xb28c('0x42')](_0xb28c('0x43'),_0x2b019e);}else if(_0xbe748b[_0xb28c('0x40')]===_0xb28c('0x14')){logger[_0xb28c('0x1b')](_0xb28c('0x41'),_0x2b019e,_0xbe748b[_0xb28c('0x40')]);_0x410f2d[_0xb28c('0x44')]=_0x53f6de!==_0xb28c('0x45')?_0x53f6de:util[_0xb28c('0x42')](_0xb28c('0x43'),_0x2b019e);_0x410f2d[_0xb28c('0x46')]=_0xb28c('0x47');}else if(_0xbe748b[_0xb28c('0x40')]===_0xb28c('0x15')){logger[_0xb28c('0x1b')](_0xb28c('0x41'),_0x2b019e,_0xbe748b[_0xb28c('0x40')]);_0x410f2d[_0xb28c('0x27')]=_0x53f6de!==_0xb28c('0x45')?_0x53f6de:util[_0xb28c('0x42')](_0xb28c('0x43'),_0x2b019e);}else{return null;}}return _0x371624['sobject'](_[_0xb28c('0x48')](_0xbe748b['moduleCreate']))[_0xb28c('0x1e')](_0x410f2d)[_0xb28c('0x2a')](function(_0x35cc0){return BPromise[_0xb28c('0x26')]({'id':_0x35cc0['id'],'endUserType':_0xbe748b[_0xb28c('0x40')]});});}});}function getCustomFields(_0x47c0c7,_0x35f98d){var _0x3beee4={};if(_0x47c0c7[_0xb28c('0x23')]>0x0){_[_0xb28c('0x49')](_0x47c0c7,function(_0x22f749){if(_[_0xb28c('0x4a')]([_0xb28c('0x4b'),_0xb28c('0x4c')],_0x22f749['type'])&&_0x22f749[_0xb28c('0x4d')]){_0x3beee4[_0x22f749[_0xb28c('0x4d')]]=_0x22f749[_0xb28c('0x4e')][_0xb28c('0x4f')]();}else if(_0x22f749[_0xb28c('0x3d')]===_0xb28c('0x50')&&_0x22f749[_0xb28c('0x51')]&&_0x22f749[_0xb28c('0x4d')]){_0x35f98d[_0x22f749[_0xb28c('0x51')]]&&(_0x3beee4[_0x22f749['idField']]=_0x35f98d[_0x22f749[_0xb28c('0x51')]][_0xb28c('0x4f')]());}else if(_0x22f749[_0xb28c('0x3d')]==='customVariable'&&_0x22f749[_0xb28c('0x52')]&&_0x22f749[_0xb28c('0x52')][_0xb28c('0x53')]&&_0x22f749[_0xb28c('0x4d')]){_0x35f98d[_0x22f749[_0xb28c('0x52')][_0xb28c('0x53')][_0xb28c('0x3e')]()]&&(_0x3beee4[_0x22f749[_0xb28c('0x4d')]]=_0x35f98d[_0x22f749[_0xb28c('0x52')][_0xb28c('0x53')][_0xb28c('0x3e')]()][_0xb28c('0x4f')]());}});}return _0x3beee4;}function getConnection(_0xec0ce1){var _0x29e7f2=_0xec0ce1['password'][_0xb28c('0x54')](_0xec0ce1[_0xb28c('0x55')]);var _0x1b881a=new jsforce[(_0xb28c('0x56'))]({'oauth2':{'loginUrl':_0xec0ce1[_0xb28c('0x57')]||_0xb28c('0x58'),'clientId':_0xec0ce1[_0xb28c('0x59')],'clientSecret':_0xec0ce1['clientSecret']}});return _0x1b881a[_0xb28c('0x5a')](_0xec0ce1[_0xb28c('0x5b')],_0x29e7f2)[_0xb28c('0x2a')](function(){logger[_0xb28c('0x1b')](_0xb28c('0x5c'));return _0x1b881a;});}exports[_0xb28c('0x5d')]=function(_0x202fe7,_0x528043,_0x33b6aa,_0x57ff9c,_0x8dc54d,_0x4899fb){var _0x17ecf8,_0x36023c,_0xa0ef9c,_0x53599d;_0x4899fb[_0xb28c('0x5e')]=intUtil[_0xb28c('0x5f')](_0x4899fb[_0xb28c('0x5e')]);_0x4899fb[_0xb28c('0x57')]=intUtil[_0xb28c('0x5f')](_0x4899fb[_0xb28c('0x57')]);if(_0x8dc54d&&_0x8dc54d['monitor_format']){logger[_0xb28c('0x1b')](_0xb28c('0x60'),_0xb28c('0x61'));_0x528043[_0xb28c('0x62')]=util[_0xb28c('0x42')](_0xb28c('0x63'),_0x4899fb[_0xb28c('0x5e')],_0x528043['uniqueid'],md5(_0x528043['uniqueid']));}else{_0x528043['recordingURL']='';}return getConnection(_0x4899fb)[_0xb28c('0x2a')](function(_0x3170dc){_0x53599d=_0x3170dc;return getUser(_0x4899fb,_0x57ff9c[_0xb28c('0x64')],_0x53599d);})['then'](function(_0x325d52){_0x17ecf8=_0x325d52;return getEndUser(_0x4899fb,_0x33b6aa,_0x528043[_0xb28c('0x65')],_0x528043['calleridnum'],_0x53599d);})['then'](function(_0x35db50){_0x36023c=_0x35db50;return getTicket(_0x4899fb,_0x17ecf8,_0x36023c,_0x33b6aa,_0x528043,_0x33b6aa[_0xb28c('0x66')],_0x53599d,_0xb28c('0x5d'));})[_0xb28c('0x2a')](function(_0x517804){_0xa0ef9c=_0x517804;logger[_0xb28c('0x1b')](_0xb28c('0x67'),_0xa0ef9c['id']);logger[_0xb28c('0x1b')](_0xb28c('0x68'),_0xa0ef9c['id'],_0x57ff9c['name'],_0x4899fb[_0xb28c('0x3d')]);switch(_0x4899fb[_0xb28c('0x3d')]){case _0xb28c('0x69'):emit(util[_0xb28c('0x42')](_0xb28c('0x6a'),_0x57ff9c[_0xb28c('0x53')]),_0xb28c('0x6b'),{'recordId':_0xa0ef9c['id']});break;case _0xb28c('0x6c'):emit(util[_0xb28c('0x42')](_0xb28c('0x6a'),_0x57ff9c[_0xb28c('0x53')]),_0xb28c('0x6d'),{'uri':util[_0xb28c('0x42')](_0xb28c('0x6e'),_0x53599d[_0xb28c('0x6f')],_0xa0ef9c['id'])});break;default:logger[_0xb28c('0x70')](_0xb28c('0x71'));}})[_0xb28c('0x72')](function(_0x1eaec6){logger[_0xb28c('0x70')]('[QUEUE]',_0x1eaec6);});};exports[_0xb28c('0x73')]=function(_0xdc9143,_0x4ea1db,_0x18edf6,_0x1d1a95,_0x534f23,_0x270ee7,_0x50140e){var _0x16062b,_0x226c5f,_0x25a568,_0x194f69;_0x270ee7[_0xb28c('0x5e')]=intUtil[_0xb28c('0x5f')](_0x270ee7[_0xb28c('0x5e')]);_0x270ee7[_0xb28c('0x57')]=intUtil[_0xb28c('0x5f')](_0x270ee7[_0xb28c('0x57')]);if(_0x50140e&&_0x50140e['recordingFormat']&&_0x50140e[_0xb28c('0x74')]!==_0xb28c('0x75')){logger[_0xb28c('0x1b')](_0xb28c('0x76'),'Recording\x20is\x20enabled!');_0x4ea1db[_0xb28c('0x62')]=util[_0xb28c('0x42')](_0xb28c('0x63'),_0x270ee7[_0xb28c('0x5e')],_0x4ea1db['uniqueid'],md5(_0x4ea1db[_0xb28c('0x77')]));}return getConnection(_0x270ee7)[_0xb28c('0x2a')](function(_0xdad214){_0x194f69=_0xdad214;return getUser(_0x270ee7,_0x1d1a95[_0xb28c('0x64')],_0x194f69);})[_0xb28c('0x2a')](function(_0x2efee7){_0x16062b=_0x2efee7;return getEndUser(_0x270ee7,_0x18edf6,_0x4ea1db[_0xb28c('0x78')],_0x4ea1db[_0xb28c('0x79')],_0x194f69);})[_0xb28c('0x2a')](function(_0x55b514){_0x226c5f=_0x55b514;return getTicket(_0x270ee7,_0x16062b,_0x226c5f,_0x18edf6,_0x4ea1db,_0x18edf6[_0xb28c('0x66')],_0x194f69,_0xb28c('0x73'));})['then'](function(_0x508fba){_0x25a568=_0x508fba;logger[_0xb28c('0x1b')]('[OUTBOUND]\x20Ticket\x20%s\x20created.',_0x25a568['id']);logger['info'](_0xb28c('0x7a'),_0x25a568['id'],_0x1d1a95[_0xb28c('0x53')],_0x270ee7[_0xb28c('0x3d')]);switch(_0x270ee7[_0xb28c('0x3d')]){case'integrationTab':emit(util[_0xb28c('0x42')]('user:%s',_0x1d1a95[_0xb28c('0x53')]),_0xb28c('0x6b'),{'recordId':_0x25a568['id']});break;case _0xb28c('0x6c'):emit(util[_0xb28c('0x42')](_0xb28c('0x6a'),_0x1d1a95[_0xb28c('0x53')]),_0xb28c('0x6d'),{'uri':util[_0xb28c('0x42')]('%s/%s/e',_0x194f69[_0xb28c('0x6f')],_0x25a568['id'])});break;default:logger[_0xb28c('0x70')]('[OUTBOUND]',_0xb28c('0x7b'));}})[_0xb28c('0x72')](function(_0x3cb9cd){logger[_0xb28c('0x70')](_0xb28c('0x76'),_0x3cb9cd);});};exports[_0xb28c('0x7c')]=function(_0x393726,_0x306daa,_0x55c81d,_0xdb7422,_0x23be46,_0x4046dc){var _0x446a35,_0x382c30,_0x18052e,_0x1c4d95;_0x4046dc[_0xb28c('0x5e')]=intUtil[_0xb28c('0x5f')](_0x4046dc[_0xb28c('0x5e')]);_0x4046dc['remoteUri']=intUtil['stripTrailingSlash'](_0x4046dc[_0xb28c('0x57')]);if(_0x23be46&&_0x23be46[_0xb28c('0x7d')]){logger[_0xb28c('0x1b')]('['+_0x306daa[_0xb28c('0x7e')]['toUpperCase']()+']',_0xb28c('0x61'));_0x306daa[_0xb28c('0x62')]=util[_0xb28c('0x42')](_0xb28c('0x63'),_0x4046dc[_0xb28c('0x5e')],_0x306daa['uniqueid'],md5(_0x306daa[_0xb28c('0x77')]));}else{_0x306daa[_0xb28c('0x62')]='';}return getConnection(_0x4046dc)[_0xb28c('0x2a')](function(_0x2df308){_0x1c4d95=_0x2df308;if(!_[_0xb28c('0x1f')](_0xdb7422)){return getUser(_0x4046dc,_0xdb7422[_0xb28c('0x53')],_0x1c4d95);}else{return getUser(_0x4046dc,null,_0x1c4d95);}})[_0xb28c('0x2a')](function(_0x5503a0){_0x446a35=_0x5503a0;return getEndUser(_0x4046dc,_0x55c81d,_0x306daa[_0xb28c('0x65')],_0x306daa[_0xb28c('0x7f')],_0x1c4d95);})[_0xb28c('0x2a')](function(_0x4e7e73){_0x382c30=_0x4e7e73;return getTicket(_0x4046dc,_0x446a35,_0x382c30,_0x55c81d,_0x306daa,_0x55c81d[_0xb28c('0x66')],_0x1c4d95);})['then'](function(_0x3799b7){_0x18052e=_0x3799b7;logger[_0xb28c('0x1b')]('['+_0x306daa[_0xb28c('0x7e')]['toUpperCase']()+_0xb28c('0x80'),_0x18052e['id']);logger['info']('['+_0x306daa[_0xb28c('0x7e')]['toUpperCase']()+_0xb28c('0x81'),_0x4046dc[_0xb28c('0x3d')]);})['catch'](function(_0x13f97b){logger['error']('['+_0x306daa['lastevent'][_0xb28c('0x82')]()+']',_0x13f97b);});}; \ No newline at end of file +var _0x73cc=['identity','display_name','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','additionalSearchContact','$or','Contact','cloneDeep','additionalSearchLead','Lead','account_contact_lead','additionalSearchAccount','merge','Account','first','Phone','type','toLowerCase','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','Enduser\x20with\x20phone\x20%s\x20not\x20found','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','LastName','','format','Caller\x20-\x20%s','Name','upperFirst','create','picklist','idField','content','toString','variableName','Variable','name','password','concat','securityToken','remoteUri','clientId','clientSecret','login','username','Connection\x20established.','queue','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','Fields','[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','user:%s','trigger:browser:url','%s/%s/e','instanceUrl','error','catch','recordingFormat','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','outbound','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','trigger:salesforce:display','newTab','Salesforce\x20account\x20type\x20not\x20recognized','unmanaged','toUpperCase','calleridname','lastevent',']\x20Ticket\x20%s\x20created.',']\x20Integration\x20account\x20type\x20%s.','lodash','request-promise','moment','bluebird','md5','jsforce','ioredis','../../../../config/environment','salesforce','redis','localhost','socket.io-emitter','emit','assign','getString','Subjects','ticketType','ActivityDate','IsReminderSet','IsRecurrence','contact','endUserType','lead','WhoId','WhatId','Case','account','AccountId','leadId','info','Association\x20between\x20Case\x20and\x20Lead\x20skipped','sobject','isNil','validateEmail','User','find','execute','then','length','Email','Agent\x20%s\x20found.','resolve','user_id','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.'];(function(_0x4630ce,_0x4b90e2){var _0x465231=function(_0x356a35){while(--_0x356a35){_0x4630ce['push'](_0x4630ce['shift']());}};_0x465231(++_0x4b90e2);}(_0x73cc,0x1c8));var _0xc73c=function(_0x102348,_0x7ad319){_0x102348=_0x102348-0x0;var _0x58faed=_0x73cc[_0x102348];return _0x58faed;};'use strict';var _=require(_0xc73c('0x0'));var rp=require(_0xc73c('0x1'));var moment=require(_0xc73c('0x2'));var BPromise=require(_0xc73c('0x3'));var md5=require(_0xc73c('0x4'));var jsforce=require(_0xc73c('0x5'));var util=require('util');var Redis=require(_0xc73c('0x6'));var intUtil=require('./util');var config=require(_0xc73c('0x7'));var logger=require('../../../../config/logger')(_0xc73c('0x8'));config[_0xc73c('0x9')]=_['defaults'](config[_0xc73c('0x9')],{'host':_0xc73c('0xa'),'port':0x18eb});var io=require(_0xc73c('0xb'))(new Redis(config[_0xc73c('0x9')]));function emit(_0x362db2,_0x579135,_0x4eec9b){io['to'](_0x362db2)[_0xc73c('0xc')](_0x579135,_0x4eec9b);}function getTicket(_0x20f9a5,_0x3a4eaa,_0x262938,_0x5b2391,_0x215714,_0x2fc3c3,_0x368ca9,_0xf680de){var _0x5e0740=Object[_0xc73c('0xd')]({},{'OwnerId':_0x3a4eaa['id'],'Subject':intUtil[_0xc73c('0xe')](_0x5b2391[_0xc73c('0xf')],_0x215714,'\x20'),'Description':intUtil['getString'](_0x5b2391['Descriptions'],_0x215714,'\x0a')},getCustomFields(_0x2fc3c3,_0x215714));if(_0x262938){if(_0x5b2391[_0xc73c('0x10')]==='Task'){_0x5e0740[_0xc73c('0x11')]=moment['utc']();_0x5e0740[_0xc73c('0x12')]=![];_0x5e0740[_0xc73c('0x13')]=![];if(_0x262938['endUserType']===_0xc73c('0x14')||_0x262938[_0xc73c('0x15')]===_0xc73c('0x16')){_0x5e0740[_0xc73c('0x17')]=_0x262938['id'];}else if(_0x262938[_0xc73c('0x15')]==='account'){_0x5e0740[_0xc73c('0x18')]=_0x262938['id'];}}else if(_0x5b2391[_0xc73c('0x10')]===_0xc73c('0x19')){if(_0x262938[_0xc73c('0x15')]==='contact'){_0x5e0740['ContactId']=_0x262938['id'];}else if(_0x262938[_0xc73c('0x15')]===_0xc73c('0x1a')){_0x5e0740[_0xc73c('0x1b')]=_0x262938['id'];}else if(_0x262938['endUserType']===_0xc73c('0x16')&&_0x5b2391[_0xc73c('0x1c')]){_0x5e0740[_0x5b2391[_0xc73c('0x1c')]]=_0x262938['id'];}else{logger[_0xc73c('0x1d')](_0xc73c('0x1e'));}}}return _0x368ca9[_0xc73c('0x1f')](_0x5b2391[_0xc73c('0x10')])['create'](_0x5e0740);}function getUser(_0x2df882,_0x277087,_0xb7a8b2){if(!_[_0xc73c('0x20')](_0x277087)&&intUtil[_0xc73c('0x21')](_0x277087)){var _0x20cda7={'Email':_0x277087};var _0x1ec70b={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0xb7a8b2[_0xc73c('0x1f')](_0xc73c('0x22'))[_0xc73c('0x23')](_0x20cda7,_0x1ec70b)[_0xc73c('0x24')]()[_0xc73c('0x25')](function(_0x286bab){if(_0x286bab[_0xc73c('0x26')]){var _0x3b0c53=_[_0xc73c('0x23')](_0x286bab,function(_0x50aa5d){return _0x50aa5d[_0xc73c('0x27')]===_0x277087;});if(_0x3b0c53){logger[_0xc73c('0x1d')](_0xc73c('0x28'),_0x277087);return BPromise[_0xc73c('0x29')]({'id':_0x3b0c53['Id'],'name':_0x3b0c53['Name']});}}else{logger[_0xc73c('0x1d')]('Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.',_0x277087);return _0xb7a8b2['identity']()[_0xc73c('0x25')](function(_0x350626){return BPromise[_0xc73c('0x29')]({'id':_0x350626[_0xc73c('0x2a')],'name':_0x350626['display_name']});});}});}else{logger[_0xc73c('0x1d')](_0xc73c('0x2b'),_0x277087);return _0xb7a8b2[_0xc73c('0x2c')]()[_0xc73c('0x25')](function(_0x242272){return BPromise['resolve']({'id':_0x242272[_0xc73c('0x2a')],'name':_0x242272[_0xc73c('0x2d')]});});}}function getEndUser(_0x4818dc,_0x53542e,_0x25b5cb,_0x5450c9,_0xa248a6){var _0x365034={'$or':{'Phone':_0x5450c9}};var _0x2a6216={'Id':!![],'Name':!![],'Phone':!![]};return BPromise['resolve']()[_0xc73c('0x25')](function(){logger['info'](_0xc73c('0x2e'),_0x5450c9,_0x53542e[_0xc73c('0x2f')]);switch(_0x53542e[_0xc73c('0x2f')]){case _0xc73c('0x30'):var _0x25caa8=_['cloneDeep'](_0x365034);if(_0x53542e[_0xc73c('0x31')]){var _0x72a02e={};_0x72a02e[_0x53542e[_0xc73c('0x31')]]=_0x5450c9;_['merge'](_0x25caa8[_0xc73c('0x32')],_0x72a02e);}return _0xa248a6[_0xc73c('0x1f')](_0xc73c('0x33'))[_0xc73c('0x23')](_0x25caa8,_0x2a6216)[_0xc73c('0x24')]()['then'](function(_0x111ccf){if(_0x111ccf&&_0x111ccf['length']){return _0x111ccf;}else{var _0x72079f=_[_0xc73c('0x34')](_0x365034);if(_0x53542e['additionalSearchLead']){var _0x253d03={};_0x253d03[_0x53542e[_0xc73c('0x35')]]=_0x5450c9;_['merge'](_0x72079f['$or'],_0x253d03);}return _0xa248a6[_0xc73c('0x1f')](_0xc73c('0x36'))[_0xc73c('0x23')](_0x72079f,_0x2a6216);}});case _0xc73c('0x37'):var _0x38e510=_['cloneDeep'](_0x365034);if(_0x53542e[_0xc73c('0x38')]){var _0x72a02e={};_0x72a02e[_0x53542e['additionalSearchAccount']]=_0x5450c9;_[_0xc73c('0x39')](_0x38e510[_0xc73c('0x32')],_0x72a02e);}return _0xa248a6[_0xc73c('0x1f')](_0xc73c('0x3a'))[_0xc73c('0x23')](_0x38e510,_0x2a6216)[_0xc73c('0x24')]()['then'](function(_0x11b96e){if(_0x11b96e&&_0x11b96e[_0xc73c('0x26')]){return _0x11b96e;}else{var _0x538e3c=_[_0xc73c('0x34')](_0x365034);if(_0x53542e[_0xc73c('0x31')]){var _0x592b03={};_0x592b03[_0x53542e['additionalSearchContact']]=_0x5450c9;_['merge'](_0x538e3c['$or'],_0x592b03);}return _0xa248a6[_0xc73c('0x1f')](_0xc73c('0x33'))[_0xc73c('0x23')](_0x538e3c,_0x2a6216)['then'](function(_0x22e4df){if(_0x22e4df&&_0x22e4df[_0xc73c('0x26')]){return _0x22e4df;}else{var _0x55a25b=_[_0xc73c('0x34')](_0x365034);if(_0x53542e[_0xc73c('0x35')]){var _0x22b2d4={};_0x22b2d4[_0x53542e['additionalSearchLead']]=_0x5450c9;_['merge'](_0x55a25b[_0xc73c('0x32')],_0x22b2d4);}return _0xa248a6[_0xc73c('0x1f')](_0xc73c('0x36'))[_0xc73c('0x23')](_0x55a25b,_0x2a6216);}});}});case'contact':var _0x25caa8=_['cloneDeep'](_0x365034);if(_0x53542e[_0xc73c('0x31')]){var _0x72a02e={};_0x72a02e[_0x53542e[_0xc73c('0x31')]]=_0x5450c9;_[_0xc73c('0x39')](_0x25caa8[_0xc73c('0x32')],_0x72a02e);}return _0xa248a6[_0xc73c('0x1f')]('Contact')[_0xc73c('0x23')](_0x25caa8,_0x2a6216)[_0xc73c('0x24')]();case _0xc73c('0x16'):var _0x207b1f=_['cloneDeep'](_0x365034);if(_0x53542e[_0xc73c('0x35')]){var _0x72a02e={};_0x72a02e[_0x53542e[_0xc73c('0x35')]]=_0x5450c9;_[_0xc73c('0x39')](_0x207b1f['$or'],_0x72a02e);}return _0xa248a6[_0xc73c('0x1f')](_0xc73c('0x36'))[_0xc73c('0x23')](_0x207b1f,_0x2a6216);case'account':var _0x38e510=_[_0xc73c('0x34')](_0x365034);if(_0x53542e[_0xc73c('0x38')]){var _0x72a02e={};_0x72a02e[_0x53542e['additionalSearchAccount']]=_0x5450c9;_[_0xc73c('0x39')](_0x38e510[_0xc73c('0x32')],_0x72a02e);}return _0xa248a6[_0xc73c('0x1f')](_0xc73c('0x3a'))[_0xc73c('0x23')](_0x38e510,_0x2a6216);default:return null;}})[_0xc73c('0x25')](function(_0x358dda){if(_0x358dda&&_0x358dda[_0xc73c('0x26')]){var _0x395b92=_[_0xc73c('0x3b')](_0x358dda);if(_0x395b92){return BPromise['resolve']({'id':_0x395b92['Id'],'name':_0x395b92['Name'],'phone':_0x395b92[_0xc73c('0x3c')],'endUserType':_0x395b92['attributes'][_0xc73c('0x3d')][_0xc73c('0x3e')]()});}}})[_0xc73c('0x25')](function(_0x3a8975){if(_0x3a8975){logger[_0xc73c('0x1d')](_0xc73c('0x3f'),_0x3a8975[_0xc73c('0x15')],_0x5450c9);return BPromise['resolve'](_0x3a8975);}else{logger[_0xc73c('0x1d')](_0xc73c('0x40'),_0x5450c9);var _0x75c5e={'Phone':_0x5450c9};if(_0x53542e[_0xc73c('0x41')]){if(_0x53542e[_0xc73c('0x41')]===_0xc73c('0x14')){logger[_0xc73c('0x1d')](_0xc73c('0x42'),_0x5450c9,_0x53542e[_0xc73c('0x41')]);_0x75c5e[_0xc73c('0x43')]=_0x25b5cb!==_0xc73c('0x44')?_0x25b5cb:util[_0xc73c('0x45')](_0xc73c('0x46'),_0x5450c9);}else if(_0x53542e[_0xc73c('0x41')]===_0xc73c('0x16')){logger[_0xc73c('0x1d')]('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x5450c9,_0x53542e[_0xc73c('0x41')]);_0x75c5e['LastName']=_0x25b5cb!==''?_0x25b5cb:util[_0xc73c('0x45')](_0xc73c('0x46'),_0x5450c9);_0x75c5e['Company']='No\x20Company';}else if(_0x53542e[_0xc73c('0x41')]===_0xc73c('0x1a')){logger[_0xc73c('0x1d')]('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x5450c9,_0x53542e['moduleCreate']);_0x75c5e[_0xc73c('0x47')]=_0x25b5cb!==''?_0x25b5cb:util[_0xc73c('0x45')](_0xc73c('0x46'),_0x5450c9);}else{return null;}}return _0xa248a6[_0xc73c('0x1f')](_[_0xc73c('0x48')](_0x53542e[_0xc73c('0x41')]))[_0xc73c('0x49')](_0x75c5e)[_0xc73c('0x25')](function(_0x401b38){return BPromise[_0xc73c('0x29')]({'id':_0x401b38['id'],'endUserType':_0x53542e['moduleCreate']});});}});}function getCustomFields(_0x327bd5,_0x20fad4){var _0x470846={};if(_0x327bd5[_0xc73c('0x26')]>0x0){_['forEach'](_0x327bd5,function(_0x4bc020){if(_['includes'](['string',_0xc73c('0x4a')],_0x4bc020[_0xc73c('0x3d')])&&_0x4bc020[_0xc73c('0x4b')]){_0x470846[_0x4bc020[_0xc73c('0x4b')]]=_0x4bc020[_0xc73c('0x4c')][_0xc73c('0x4d')]();}else if(_0x4bc020[_0xc73c('0x3d')]==='variable'&&_0x4bc020['variableName']&&_0x4bc020[_0xc73c('0x4b')]){_0x20fad4[_0x4bc020[_0xc73c('0x4e')]]&&(_0x470846[_0x4bc020[_0xc73c('0x4b')]]=_0x20fad4[_0x4bc020['variableName']][_0xc73c('0x4d')]());}else if(_0x4bc020['type']==='customVariable'&&_0x4bc020['Variable']&&_0x4bc020[_0xc73c('0x4f')][_0xc73c('0x50')]&&_0x4bc020['idField']){_0x20fad4[_0x4bc020['Variable'][_0xc73c('0x50')][_0xc73c('0x3e')]()]&&(_0x470846[_0x4bc020[_0xc73c('0x4b')]]=_0x20fad4[_0x4bc020['Variable']['name'][_0xc73c('0x3e')]()]['toString']());}});}return _0x470846;}function getConnection(_0x301425){var _0x33ce6e=_0x301425[_0xc73c('0x51')][_0xc73c('0x52')](_0x301425[_0xc73c('0x53')]);var _0x8f5b58=new jsforce['Connection']({'oauth2':{'loginUrl':_0x301425[_0xc73c('0x54')]||'https://login.salesforce.com','clientId':_0x301425[_0xc73c('0x55')],'clientSecret':_0x301425[_0xc73c('0x56')]}});return _0x8f5b58[_0xc73c('0x57')](_0x301425[_0xc73c('0x58')],_0x33ce6e)[_0xc73c('0x25')](function(){logger[_0xc73c('0x1d')](_0xc73c('0x59'));return _0x8f5b58;});}exports[_0xc73c('0x5a')]=function(_0x4ba104,_0x1e8266,_0x4e46ce,_0x383f24,_0x337e53,_0x16eeb5){var _0x1348cd,_0x36275e,_0x56fb41,_0x2816a6;_0x16eeb5[_0xc73c('0x5b')]=intUtil[_0xc73c('0x5c')](_0x16eeb5[_0xc73c('0x5b')]);_0x16eeb5[_0xc73c('0x54')]=intUtil[_0xc73c('0x5c')](_0x16eeb5[_0xc73c('0x54')]);if(_0x337e53&&_0x337e53[_0xc73c('0x5d')]){logger[_0xc73c('0x1d')](_0xc73c('0x5e'),'Recording\x20is\x20enabled!');_0x1e8266[_0xc73c('0x5f')]=util[_0xc73c('0x45')](_0xc73c('0x60'),_0x16eeb5[_0xc73c('0x5b')],_0x1e8266[_0xc73c('0x61')],md5(_0x1e8266[_0xc73c('0x61')]));}else{_0x1e8266[_0xc73c('0x5f')]='';}return getConnection(_0x16eeb5)[_0xc73c('0x25')](function(_0x1f50bb){_0x2816a6=_0x1f50bb;return getUser(_0x16eeb5,_0x383f24[_0xc73c('0x62')],_0x2816a6);})[_0xc73c('0x25')](function(_0xb63bbd){_0x1348cd=_0xb63bbd;return getEndUser(_0x16eeb5,_0x4e46ce,_0x1e8266['calleridname'],_0x1e8266['calleridnum'],_0x2816a6);})['then'](function(_0x1c360b){_0x36275e=_0x1c360b;return getTicket(_0x16eeb5,_0x1348cd,_0x36275e,_0x4e46ce,_0x1e8266,_0x4e46ce[_0xc73c('0x63')],_0x2816a6,_0xc73c('0x5a'));})[_0xc73c('0x25')](function(_0x189f23){_0x56fb41=_0x189f23;logger[_0xc73c('0x1d')](_0xc73c('0x64'),_0x56fb41['id']);logger[_0xc73c('0x1d')](_0xc73c('0x65'),_0x56fb41['id'],_0x383f24[_0xc73c('0x50')],_0x16eeb5[_0xc73c('0x3d')]);switch(_0x16eeb5[_0xc73c('0x3d')]){case'integrationTab':emit(util[_0xc73c('0x45')](_0xc73c('0x66'),_0x383f24['name']),'trigger:salesforce:display',{'recordId':_0x56fb41['id']});break;case'newTab':emit(util[_0xc73c('0x45')](_0xc73c('0x66'),_0x383f24['name']),_0xc73c('0x67'),{'uri':util[_0xc73c('0x45')](_0xc73c('0x68'),_0x2816a6[_0xc73c('0x69')],_0x56fb41['id'])});break;default:logger[_0xc73c('0x6a')]('[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.');}})[_0xc73c('0x6b')](function(_0x4890f8){logger[_0xc73c('0x6a')](_0xc73c('0x5e'),_0x4890f8);});};exports['outbound']=function(_0x47c469,_0x27fe6a,_0x3ac849,_0x2f4562,_0x4786c7,_0x31274b,_0x9410e1){var _0x250a1d,_0x40488e,_0xf13200,_0x364980;_0x31274b[_0xc73c('0x5b')]=intUtil[_0xc73c('0x5c')](_0x31274b[_0xc73c('0x5b')]);_0x31274b['remoteUri']=intUtil[_0xc73c('0x5c')](_0x31274b[_0xc73c('0x54')]);if(_0x9410e1&&_0x9410e1[_0xc73c('0x6c')]&&_0x9410e1[_0xc73c('0x6c')]!=='none'){logger[_0xc73c('0x1d')](_0xc73c('0x6d'),_0xc73c('0x6e'));_0x27fe6a[_0xc73c('0x5f')]=util[_0xc73c('0x45')](_0xc73c('0x60'),_0x31274b[_0xc73c('0x5b')],_0x27fe6a[_0xc73c('0x61')],md5(_0x27fe6a[_0xc73c('0x61')]));}return getConnection(_0x31274b)[_0xc73c('0x25')](function(_0x24b62e){_0x364980=_0x24b62e;return getUser(_0x31274b,_0x2f4562['email'],_0x364980);})['then'](function(_0x623245){_0x250a1d=_0x623245;return getEndUser(_0x31274b,_0x3ac849,_0x27fe6a[_0xc73c('0x6f')],_0x27fe6a['destcalleridnum'],_0x364980);})[_0xc73c('0x25')](function(_0xb61d2){_0x40488e=_0xb61d2;return getTicket(_0x31274b,_0x250a1d,_0x40488e,_0x3ac849,_0x27fe6a,_0x3ac849['Fields'],_0x364980,_0xc73c('0x70'));})[_0xc73c('0x25')](function(_0x12c90b){_0xf13200=_0x12c90b;logger[_0xc73c('0x1d')](_0xc73c('0x71'),_0xf13200['id']);logger[_0xc73c('0x1d')](_0xc73c('0x72'),_0xf13200['id'],_0x2f4562[_0xc73c('0x50')],_0x31274b['type']);switch(_0x31274b[_0xc73c('0x3d')]){case _0xc73c('0x73'):emit(util[_0xc73c('0x45')](_0xc73c('0x66'),_0x2f4562['name']),_0xc73c('0x74'),{'recordId':_0xf13200['id']});break;case _0xc73c('0x75'):emit(util[_0xc73c('0x45')](_0xc73c('0x66'),_0x2f4562[_0xc73c('0x50')]),'trigger:browser:url',{'uri':util[_0xc73c('0x45')](_0xc73c('0x68'),_0x364980[_0xc73c('0x69')],_0xf13200['id'])});break;default:logger[_0xc73c('0x6a')](_0xc73c('0x6d'),_0xc73c('0x76'));}})[_0xc73c('0x6b')](function(_0x6491c6){logger[_0xc73c('0x6a')]('[OUTBOUND]',_0x6491c6);});};exports[_0xc73c('0x77')]=function(_0x20ef9c,_0x3377f7,_0xb783dd,_0x17e1e4,_0x357ff0,_0x1ee82f){var _0x58685e,_0x382b47,_0x292794,_0x4431e0;_0x1ee82f[_0xc73c('0x5b')]=intUtil['stripTrailingSlash'](_0x1ee82f[_0xc73c('0x5b')]);_0x1ee82f[_0xc73c('0x54')]=intUtil[_0xc73c('0x5c')](_0x1ee82f[_0xc73c('0x54')]);if(_0x357ff0&&_0x357ff0['monitor_format']){logger[_0xc73c('0x1d')]('['+_0x3377f7['lastevent'][_0xc73c('0x78')]()+']',_0xc73c('0x6e'));_0x3377f7[_0xc73c('0x5f')]=util[_0xc73c('0x45')](_0xc73c('0x60'),_0x1ee82f[_0xc73c('0x5b')],_0x3377f7['uniqueid'],md5(_0x3377f7[_0xc73c('0x61')]));}else{_0x3377f7[_0xc73c('0x5f')]='';}return getConnection(_0x1ee82f)['then'](function(_0x550f2f){_0x4431e0=_0x550f2f;if(!_[_0xc73c('0x20')](_0x17e1e4)){return getUser(_0x1ee82f,_0x17e1e4[_0xc73c('0x50')],_0x4431e0);}else{return getUser(_0x1ee82f,null,_0x4431e0);}})['then'](function(_0x3615cd){_0x58685e=_0x3615cd;return getEndUser(_0x1ee82f,_0xb783dd,_0x3377f7[_0xc73c('0x79')],_0x3377f7['calleridnum'],_0x4431e0);})[_0xc73c('0x25')](function(_0x2b7dfd){_0x382b47=_0x2b7dfd;return getTicket(_0x1ee82f,_0x58685e,_0x382b47,_0xb783dd,_0x3377f7,_0xb783dd[_0xc73c('0x63')],_0x4431e0);})['then'](function(_0xd49f5b){_0x292794=_0xd49f5b;logger[_0xc73c('0x1d')]('['+_0x3377f7[_0xc73c('0x7a')][_0xc73c('0x78')]()+_0xc73c('0x7b'),_0x292794['id']);logger[_0xc73c('0x1d')]('['+_0x3377f7[_0xc73c('0x7a')][_0xc73c('0x78')]()+_0xc73c('0x7c'),_0x1ee82f[_0xc73c('0x3d')]);})[_0xc73c('0x6b')](function(_0x4b2f9e){logger[_0xc73c('0x6a')]('['+_0x3377f7[_0xc73c('0x7a')][_0xc73c('0x78')]()+']',_0x4b2f9e);});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/servicenow.js b/server/services/ami/trigger/integration/servicenow.js index 541b5f5..d4a3222 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 _0xeb56=['variableName','customVariable','Variable','name',']\x20getTicket\x20input\x20crm','outbound','incident','assign','getString','Subjects','Descriptions','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketId','number',']\x20getTicket\x20crm','label','?sysparm_query=name%3D','label_entry','Incident','ticketNumber','forEach','push',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','all','Tags','map','%26sysparm_record_target%3Dincident','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','format','trigger:browser:url','username','password','sysparm_limit=1','sysparm_display_value=true','remoteUri','stripTrailingSlash','serverUrl','%s/api/now/table/','destcalleridnum','calleridnum','queue','unmanaged','uniqueid','monitor_format','recordingURL','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','Displaying\x20call\x20in\x20a\x20new\x20tab...','inspect','lodash','bluebird','request-promise','util','md5','ioredis','./util','../../../../config/environment','../../../../config/logger','servicenow','redis','localhost','sys_user?sysparm_query=user_name%3Dadmin','then','result','length','adminId','sys_id','],\x20getAdminUser\x20crm','catch','error','message','info','toUpperCase','validateEmail','userEmail','GET','],\x20getUser\x20rp\x20obj','],\x20getUser\x20entity','active','userId','adminEmail','],\x20getUser\x20crm',']\x20using\x20admin\x20profile','],\x20createEndUser\x20input\x20crm','POST','endUserNumber','user','true','System','],\x20EndUser\x20schema','endUserId','],\x20getEndUser\x20input\x20crm','sys_user?sysparm_query=phone%3D','],\x20getEndUser\x20crm','includes','string','picklist','customField','nameField','content','type','idField','toLowerCase','toString'];(function(_0x22d3eb,_0x4f872b){var _0x1867b8=function(_0x295bcc){while(--_0x295bcc){_0x22d3eb['push'](_0x22d3eb['shift']());}};_0x1867b8(++_0x4f872b);}(_0xeb56,0x17d));var _0x6eb5=function(_0x456bd2,_0x156c79){_0x456bd2=_0x456bd2-0x0;var _0x2218c1=_0xeb56[_0x456bd2];return _0x2218c1;};'use strict';var _=require(_0x6eb5('0x0'));var Promise=require(_0x6eb5('0x1'));var rp=require(_0x6eb5('0x2'));var util=require(_0x6eb5('0x3'));var md5=require(_0x6eb5('0x4'));var Redis=require(_0x6eb5('0x5'));var intUtil=require(_0x6eb5('0x6'));var config=require(_0x6eb5('0x7'));var logger=require(_0x6eb5('0x8'))(_0x6eb5('0x9'));config[_0x6eb5('0xa')]=_['defaults'](config[_0x6eb5('0xa')],{'host':_0x6eb5('0xb'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x6eb5('0xa')]));function getAdminUser(_0x1ffacb,_0x5f3ff2,_0xeb580a,_0x1e5ad6,_0x3fc826,_0x4bd230){return new Promise(function(_0x2d9b80,_0x53da45){var _0x51a29a={'method':'GET','uri':_0x1e5ad6+_0x6eb5('0xc')+'&'+_0x3fc826+'&'+_0x4bd230,'auth':_0x5f3ff2,'json':!![]};return rp(_0x51a29a)[_0x6eb5('0xd')](function(_0x74bef8){if(_0x74bef8[_0x6eb5('0xe')][_0x6eb5('0xf')]>0x0){_0xeb580a[_0x6eb5('0x10')]=_0x74bef8[_0x6eb5('0xe')][0x0][_0x6eb5('0x11')];}logger['info']('['+[_0x1ffacb['toUpperCase']()]+_0x6eb5('0x12'),_0xeb580a);_0x2d9b80(_0xeb580a);})[_0x6eb5('0x13')](function(_0x371f76){logger[_0x6eb5('0x14')]('['+[_0x1ffacb['toUpperCase']()]+']',_0x371f76[_0x6eb5('0x15')]);_0x53da45(_0x371f76[_0x6eb5('0x15')]);});});}function getUser(_0x5498df,_0x3d27c0,_0x54d0f7,_0x13b993,_0x100222){return function(_0xed059d){logger[_0x6eb5('0x16')]('['+[_0x5498df[_0x6eb5('0x17')]()]+'],\x20getUser\x20input\x20crm',_0xed059d);return new Promise(function(_0x333585,_0x2c6a78){if(intUtil[_0x6eb5('0x18')](_0xed059d[_0x6eb5('0x19')])){var _0x41739a={'method':_0x6eb5('0x1a'),'uri':_0x54d0f7+'sys_user?sysparm_query=email%3D'+_0xed059d[_0x6eb5('0x19')]+'&'+_0x13b993+'&'+_0x100222,'auth':_0x3d27c0,'json':!![]};logger[_0x6eb5('0x16')]('['+[_0x5498df[_0x6eb5('0x17')]()]+_0x6eb5('0x1b'),_0x41739a);return rp(_0x41739a)[_0x6eb5('0xd')](function(_0x3f40bb){logger['info']('['+[_0x5498df[_0x6eb5('0x17')]()]+_0x6eb5('0x1c'),_0x3f40bb);if(_0x3f40bb[_0x6eb5('0xe')][_0x6eb5('0xf')]>0x0&&String(_0x3f40bb['result'][0x0][_0x6eb5('0x1d')])==='true'){_0xed059d[_0x6eb5('0x1e')]=_0x3f40bb[_0x6eb5('0xe')][0x0][_0x6eb5('0x11')];}else{_0xed059d[_0x6eb5('0x1e')]=_0xed059d[_0x6eb5('0x10')];_0xed059d[_0x6eb5('0x19')]=_0xed059d[_0x6eb5('0x1f')];}logger[_0x6eb5('0x16')]('['+[_0x5498df[_0x6eb5('0x17')]()]+_0x6eb5('0x20'),_0xed059d);_0x333585(_0xed059d);})[_0x6eb5('0x13')](function(_0x1a7dfb){logger['error']('['+[_0x5498df[_0x6eb5('0x17')]()]+']',_0x1a7dfb[_0x6eb5('0x15')]);_0x2c6a78(_0x1a7dfb['message']);});}else{logger[_0x6eb5('0x16')]('['+[_0x5498df[_0x6eb5('0x17')]()]+_0x6eb5('0x21'));_0xed059d['userId']=_0xed059d[_0x6eb5('0x10')];_0xed059d[_0x6eb5('0x19')]=_0xed059d[_0x6eb5('0x1f')];_0x333585(_0xed059d);}});};}function createEndUser(_0x1e8f4e,_0x47f123,_0x2c5548,_0xb4dac5,_0x26a524){logger[_0x6eb5('0x16')]('['+[_0x1e8f4e[_0x6eb5('0x17')]()]+_0x6eb5('0x22'),_0x2c5548);return new Promise(function(_0xa6f5d8,_0x18fc88){var _0x579322={'method':_0x6eb5('0x23'),'uri':_0xb4dac5+'sys_user?'+_0x26a524,'body':{'user_name':_0x2c5548[_0x6eb5('0x24')],'roles':_0x6eb5('0x25'),'first_name':_0x2c5548[_0x6eb5('0x24')],'active':_0x6eb5('0x26'),'date_format':_0x6eb5('0x27'),'phone':_0x2c5548['endUserNumber']},'auth':_0x47f123,'json':!![]};return rp(_0x579322)[_0x6eb5('0xd')](function(_0x34d8a9){logger[_0x6eb5('0x16')]('['+[_0x1e8f4e[_0x6eb5('0x17')]()]+_0x6eb5('0x28'),_0x34d8a9[_0x6eb5('0xe')]);_0x2c5548[_0x6eb5('0x29')]=_0x34d8a9[_0x6eb5('0xe')][_0x6eb5('0x11')];_0xa6f5d8(_0x2c5548);})['catch'](function(_0x1cd97f){logger['error']('['+[_0x1e8f4e[_0x6eb5('0x17')]()]+']',_0x1cd97f[_0x6eb5('0x15')]);_0x18fc88(_0x1cd97f[_0x6eb5('0x15')]);});});}function getEndUser(_0x1f302b,_0x1bfcb1,_0x18c4a2,_0x2519d7,_0x47bb72){return function(_0x2cd0f7){logger[_0x6eb5('0x16')]('['+[_0x1f302b[_0x6eb5('0x17')]()]+_0x6eb5('0x2a'),_0x2cd0f7);return new Promise(function(_0x21d883,_0x950079){var _0xd9813c={'method':_0x6eb5('0x1a'),'uri':_0x18c4a2+_0x6eb5('0x2b')+_0x2cd0f7[_0x6eb5('0x24')]+'&'+_0x2519d7+'&'+_0x47bb72,'auth':_0x1bfcb1,'json':!![]};return rp(_0xd9813c)['then'](function(_0x5cfcd1){if(_0x5cfcd1[_0x6eb5('0xe')][_0x6eb5('0xf')]>0x0){_0x2cd0f7[_0x6eb5('0x29')]=_0x5cfcd1['result'][0x0][_0x6eb5('0x11')];logger[_0x6eb5('0x16')]('['+[_0x1f302b[_0x6eb5('0x17')]()]+_0x6eb5('0x2c'),_0x2cd0f7);_0x21d883(_0x2cd0f7);}else{return createEndUser(_0x1f302b,_0x1bfcb1,_0x2cd0f7,_0x18c4a2,_0x2519d7)['then'](function(_0x556ae6){logger[_0x6eb5('0x16')]('['+[_0x1f302b[_0x6eb5('0x17')]()]+'],\x20createEndUser\x20crm',_0x556ae6);_0x21d883(_0x556ae6);});}})[_0x6eb5('0x13')](function(_0x3cfd67){logger[_0x6eb5('0x14')]('['+[_0x1f302b['toUpperCase']()]+']',_0x3cfd67[_0x6eb5('0x15')]);_0x950079(_0x3cfd67[_0x6eb5('0x15')]);});});};}function getCustomFields(_0x11d329,_0x2b86ef){var _0x676042={};if(_0x11d329['length']>0x0){_['forEach'](_0x11d329,function(_0x18cde1){if(_[_0x6eb5('0x2d')]([_0x6eb5('0x2e'),_0x6eb5('0x2f')],_0x18cde1['type'])&&_0x18cde1['nameField']&&!_0x18cde1[_0x6eb5('0x30')]){_0x676042[_0x18cde1[_0x6eb5('0x31')]['toLowerCase']()]=_0x18cde1[_0x6eb5('0x32')]['toString']();}else if(_['includes']([_0x6eb5('0x2e'),'picklist'],_0x18cde1[_0x6eb5('0x33')])&&_0x18cde1[_0x6eb5('0x34')]&&_0x18cde1['customField']){_0x676042[_0x18cde1[_0x6eb5('0x34')][_0x6eb5('0x35')]()]=_0x18cde1['content'][_0x6eb5('0x36')]();}else if(_0x18cde1[_0x6eb5('0x33')]==='variable'&&_0x18cde1['variableName']&&_0x18cde1[_0x6eb5('0x34')]&&_0x18cde1['customField']){_0x676042[_0x18cde1[_0x6eb5('0x34')][_0x6eb5('0x35')]()]=_0x2b86ef[_0x18cde1[_0x6eb5('0x37')]][_0x6eb5('0x36')]();}else if(_0x18cde1['type']===_0x6eb5('0x38')&&_0x18cde1['Variable']&&_0x18cde1[_0x6eb5('0x39')][_0x6eb5('0x3a')]&&_0x18cde1['idField']&&_0x18cde1[_0x6eb5('0x30')]){_0x676042[_0x18cde1['idField'][_0x6eb5('0x35')]()]=_0x2b86ef[_0x18cde1['Variable'][_0x6eb5('0x3a')][_0x6eb5('0x35')]()][_0x6eb5('0x36')]();}});}return _0x676042;}function getTicket(_0xcc8945,_0x27aef7,_0x44b73c,_0xb958e7,_0x171938,_0x3f3d64){return function(_0x1c2c60){logger[_0x6eb5('0x16')]('['+[_0xcc8945[_0x6eb5('0x17')]()]+_0x6eb5('0x3b'),_0x1c2c60);return new Promise(function(_0x38e14d,_0x4ad83d){var _0x5121d2=_0xcc8945[_0x6eb5('0x35')]()===_0x6eb5('0x3c')?_0x1c2c60['userId']:_0x1c2c60[_0x6eb5('0x29')];var _0x364d58={'method':_0x6eb5('0x23'),'uri':_0x44b73c+_0x6eb5('0x3d')+'?'+_0x3f3d64,'body':Object[_0x6eb5('0x3e')]({},{'active':_0x6eb5('0x26'),'caller_id':_0x5121d2,'assigned_to':_0x1c2c60[_0x6eb5('0x1e')],'short_description':intUtil[_0x6eb5('0x3f')](_0xb958e7[_0x6eb5('0x40')],_0x171938,'\x20'),'description':intUtil['getString'](_0xb958e7[_0x6eb5('0x41')],_0x171938,'\x0a')},getCustomFields(_0xb958e7[_0x6eb5('0x42')],_0x171938)),'auth':_0x27aef7,'json':!![]};return rp(_0x364d58)[_0x6eb5('0xd')](function(_0x20cf3e){logger['info']('['+[_0xcc8945[_0x6eb5('0x17')]()]+_0x6eb5('0x43'),_0x20cf3e[_0x6eb5('0xe')]);_0x1c2c60[_0x6eb5('0x44')]=_0x20cf3e[_0x6eb5('0xe')][_0x6eb5('0x11')];_0x1c2c60['ticketNumber']=_0x20cf3e[_0x6eb5('0xe')][_0x6eb5('0x45')];logger[_0x6eb5('0x16')]('['+[_0xcc8945[_0x6eb5('0x17')]()]+_0x6eb5('0x46'),_0x1c2c60);_0x38e14d(_0x1c2c60);})['catch'](function(_0x1769d3){logger[_0x6eb5('0x14')]('['+[_0xcc8945[_0x6eb5('0x17')]()]+']',_0x1769d3[_0x6eb5('0x15')]);_0x4ad83d(_0x1769d3['message']);});});};}function createRemoteTag(_0x28b45f,_0x59bf08,_0x30db84,_0x298e89){return new Promise(function(_0x2a7f96,_0x1a4344){var _0x3028d2={'method':_0x6eb5('0x23'),'uri':_0x30db84+_0x6eb5('0x47')+'?'+_0x298e89,'body':{'short_description':_0x28b45f,'global':!![],'active':!![],'name':_0x28b45f},'auth':_0x59bf08,'json':!![]};return rp(_0x3028d2)[_0x6eb5('0xd')](function(_0x15f771){var _0x55b97c=_0x15f771[_0x6eb5('0xe')][_0x6eb5('0x11')];_0x2a7f96(_0x55b97c);});});}function getRemoteTag(_0x34dd5a,_0xb601fa,_0x31ddbb,_0x318eb5,_0x5acfd9){return new Promise(function(_0x296286,_0x318846){var _0x517abd={'method':_0x6eb5('0x1a'),'uri':_0x31ddbb+_0x6eb5('0x47')+_0x6eb5('0x48')+_0x34dd5a+'&'+_0x318eb5,'auth':_0xb601fa,'json':!![]};return rp(_0x517abd)[_0x6eb5('0xd')](function(_0x2e1e57){if(_0x2e1e57[_0x6eb5('0xe')][_0x6eb5('0xf')]>0x0){var _0x157d32=_0x2e1e57[_0x6eb5('0xe')][0x0][_0x6eb5('0x11')];_0x296286(_0x157d32);}else{return createRemoteTag(_0x34dd5a,_0xb601fa,_0x31ddbb,_0x318eb5)[_0x6eb5('0xd')](function(_0x3b91ea){_0x296286(_0x3b91ea);});}});});}function assignTagToIncident(_0x58ed69,_0x50ba20,_0x2e36ab,_0x3e45fb,_0x2d6641){return new Promise(function(_0xfa261b,_0xebd5f3){var _0x433c70={'method':_0x6eb5('0x23'),'uri':_0x2e36ab+_0x6eb5('0x49')+'?'+_0x2d6641,'body':{'label':_0x58ed69,'table':_0x6eb5('0x3d'),'id_type':_0x6eb5('0x4a'),'table_key':_0x3e45fb[_0x6eb5('0x44')],'title':'Incident\x20-\x20'+_0x3e45fb[_0x6eb5('0x4b')],'id_display':_0x3e45fb['ticketNumber']},'auth':_0x50ba20,'json':!![]};return rp(_0x433c70)[_0x6eb5('0xd')](function(_0xbc9e78){_0xfa261b();})['catch'](function(){_0xfa261b();});});}function manageTags(_0x27530f,_0xc6eb58,_0x496064,_0x5af5da,_0x3cc5a9,_0x3e3d22,_0x2de84d){return new Promise(function(_0x46f3be,_0x42328b){var _0x2f2f64=[];_0xc6eb58[_0x6eb5('0x4c')](function(_0x56f4f4){_0x2f2f64[_0x6eb5('0x4d')](getRemoteTag(_0x56f4f4,_0x496064,_0x5af5da,_0x3e3d22,_0x2de84d));});return Promise['all'](_0x2f2f64)[_0x6eb5('0xd')](function(_0x4238a4){if(_0x4238a4[_0x6eb5('0xf')]){logger[_0x6eb5('0x16')]('['+[_0x27530f[_0x6eb5('0x17')]()]+_0x6eb5('0x4e'),_0x4238a4);var _0x57cf01=[];_0x4238a4[_0x6eb5('0x4c')](function(_0xb4cb30){_0x57cf01[_0x6eb5('0x4d')](assignTagToIncident(_0xb4cb30,_0x496064,_0x5af5da,_0x3cc5a9,_0x3e3d22));});return Promise[_0x6eb5('0x4f')](_0x57cf01)[_0x6eb5('0xd')](function(){_0x46f3be();})[_0x6eb5('0x13')](function(){_0x46f3be();});}else{_0x46f3be();}});});}function getTags(_0xec9d4f,_0x408fdb,_0x3bc0d8,_0x559e38,_0x3b58cf,_0x5b3a8f){return function(_0x2290bd){return new Promise(function(_0x3e4ac9,_0x4068b8){var _0x256fad=[];var _0x2ae6d5=_0x559e38[_0x6eb5('0x50')];if(_0x2ae6d5&&_0x2ae6d5[_0x6eb5('0xf')]>0x0){_0x256fad=_[_0x6eb5('0x51')](_0x2ae6d5,'name');}if(_0x256fad['length']>0x0){return manageTags(_0xec9d4f,_0x256fad,_0x408fdb,_0x3bc0d8,_0x2290bd,_0x3b58cf,_0x5b3a8f)['then'](function(){_0x3e4ac9(_0x2290bd);});}else{_0x3e4ac9(_0x2290bd);}});};}function emit(_0x6862c7,_0x4837a5,_0x389c0f){var _0x15b84f=_0x6eb5('0x52')+'%26sysparm_record_row%3D1%26sysparm_record_rows%3D39'+_0x6eb5('0x53')+_0x6eb5('0x54');var _0x4f95e4={'uri':_0x6862c7+_0x6eb5('0x55')+_0x389c0f+_0x15b84f};io['to'](util[_0x6eb5('0x56')]('user:%s',_0x4837a5))['emit'](_0x6eb5('0x57'),_0x4f95e4);}exports['cs']=function(_0x3f7cb2,_0x162d92,_0xc6d832,_0x35a697,_0x323470,_0xa223d5,_0x174f0d,_0xae5eca){var _0x2b9c8f={};var _0x3e4350={'user':_0xa223d5[_0x6eb5('0x58')],'pass':_0xa223d5[_0x6eb5('0x59')]};var _0x2e6f31=_0x6eb5('0x5a');var _0x4ef827=_0x6eb5('0x5b');_0xa223d5[_0x6eb5('0x5c')]=intUtil[_0x6eb5('0x5d')](_0xa223d5['remoteUri']);_0xa223d5['serverUrl']=intUtil[_0x6eb5('0x5d')](_0xa223d5[_0x6eb5('0x5e')]);var _0xa611e3=util['format'](_0x6eb5('0x5f'),_0xa223d5['remoteUri']);_0x2b9c8f[_0x6eb5('0x19')]=!_['isNil'](_0x35a697)?_0x35a697['email']:null;_0x2b9c8f[_0x6eb5('0x1f')]=_0xa223d5['email'];_0x2b9c8f['endUserNumber']=_0xae5eca['toLowerCase']()===_0x6eb5('0x3c')?_0x162d92[_0x6eb5('0x60')]:_0x162d92[_0x6eb5('0x61')];_0x2b9c8f['callDirection']=_0xae5eca===_0x6eb5('0x62')||_0xae5eca===_0x6eb5('0x63')?_0x6eb5('0x62'):_0x6eb5('0x3c');var _0xa453ad=util[_0x6eb5('0x56')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0xa223d5[_0x6eb5('0x5e')],_0x162d92['uniqueid'],md5(_0x162d92[_0x6eb5('0x64')]));if(_0x323470&&_0x323470[_0x6eb5('0x65')]){logger[_0x6eb5('0x16')]('[QUEUE]','Recording\x20is\x20enabled!');_0x162d92[_0x6eb5('0x66')]=_0xa453ad;}else if(_0x174f0d&&_0x174f0d[_0x6eb5('0x67')]&&_0x174f0d[_0x6eb5('0x67')]!==_0x6eb5('0x68')){logger[_0x6eb5('0x16')](_0x6eb5('0x69'),_0x6eb5('0x6a'));_0x162d92[_0x6eb5('0x66')]=_0xa453ad;}else{_0x162d92[_0x6eb5('0x66')]='';}return getAdminUser(_0xae5eca,_0x3e4350,_0x2b9c8f,_0xa611e3,_0x4ef827,_0x2e6f31)[_0x6eb5('0xd')](getUser(_0xae5eca,_0x3e4350,_0xa611e3,_0x4ef827,_0x2e6f31))['then'](getEndUser(_0xae5eca,_0x3e4350,_0xa611e3,_0x4ef827,_0x2e6f31))[_0x6eb5('0xd')](getTicket(_0xae5eca,_0x3e4350,_0xa611e3,_0xc6d832,_0x162d92,_0x4ef827))[_0x6eb5('0xd')](function(_0x5588a3){logger[_0x6eb5('0x16')](util[_0x6eb5('0x56')]('The\x20ticket\x20ID\x20is:\x20%s',_0x5588a3[_0x6eb5('0x44')]));logger[_0x6eb5('0x16')](util['format']('call\x20direction:\x20%s',_0xae5eca));if(_0xae5eca!==_0x6eb5('0x63')){logger['info']('['+[_0xae5eca[_0x6eb5('0x17')]()]+']',_0x6eb5('0x6b'));emit(_0xa223d5['remoteUri'],_0x35a697[_0x6eb5('0x3a')],_0x5588a3[_0x6eb5('0x44')]);}})['catch'](function(_0x116297){logger[_0x6eb5('0x14')]('['+[_0xae5eca['toUpperCase']()]+']\x20Error\x20running\x20ServiceNow\x20integration',util[_0x6eb5('0x6c')](_0x116297,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xb93f=['Fields',']\x20POST\x20incident\x20entity\x20schema','ticketId','number',']\x20getTicket\x20crm','label','?sysparm_query=name%3D','Incident\x20-\x20','ticketNumber',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','push','all','Tags','map','%26sysparm_record_target%3Dincident','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','format','user:%s','trigger:browser:url','username','sysparm_limit=1','sysparm_display_value=true','remoteUri','stripTrailingSlash','serverUrl','%s/api/now/table/','email','destcalleridnum','calleridnum','callDirection','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','[OUTBOUND]','call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','lodash','bluebird','util','md5','ioredis','./util','../../../../config/environment','../../../../config/logger','defaults','socket.io-emitter','redis','sys_user?sysparm_query=user_name%3Dadmin','then','result','length','adminId','sys_id','info','toUpperCase','],\x20getAdminUser\x20crm','catch','error','message','],\x20getUser\x20input\x20crm','userEmail','GET','sys_user?sysparm_query=email%3D','],\x20getUser\x20rp\x20obj','],\x20getUser\x20entity','active','userId','adminEmail','],\x20getUser\x20crm',']\x20using\x20admin\x20profile','],\x20createEndUser\x20input\x20crm','POST','endUserNumber','true','System','],\x20EndUser\x20schema','endUserId','],\x20getEndUser\x20input\x20crm','],\x20getEndUser\x20crm','forEach','includes','string','picklist','type','nameField','customField','toLowerCase','content','toString','idField','variable','variableName','customVariable','Variable','name',']\x20getTicket\x20input\x20crm','outbound','incident','assign','getString','Subjects','Descriptions'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb93f,0x17e));var _0xfb93=function(_0x4c7fb5,_0x2548ef){_0x4c7fb5=_0x4c7fb5-0x0;var _0x2e10ac=_0xb93f[_0x4c7fb5];return _0x2e10ac;};'use strict';var _=require(_0xfb93('0x0'));var Promise=require(_0xfb93('0x1'));var rp=require('request-promise');var util=require(_0xfb93('0x2'));var md5=require(_0xfb93('0x3'));var Redis=require(_0xfb93('0x4'));var intUtil=require(_0xfb93('0x5'));var config=require(_0xfb93('0x6'));var logger=require(_0xfb93('0x7'))('servicenow');config['redis']=_[_0xfb93('0x8')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0xfb93('0x9'))(new Redis(config[_0xfb93('0xa')]));function getAdminUser(_0x5c1cbc,_0x21a066,_0x11a25b,_0x5655d1,_0x1c3c21,_0xeaf148){return new Promise(function(_0x261c57,_0x3e8ab1){var _0x4ab007={'method':'GET','uri':_0x5655d1+_0xfb93('0xb')+'&'+_0x1c3c21+'&'+_0xeaf148,'auth':_0x21a066,'json':!![]};return rp(_0x4ab007)[_0xfb93('0xc')](function(_0x2409b3){if(_0x2409b3[_0xfb93('0xd')][_0xfb93('0xe')]>0x0){_0x11a25b[_0xfb93('0xf')]=_0x2409b3[_0xfb93('0xd')][0x0][_0xfb93('0x10')];}logger[_0xfb93('0x11')]('['+[_0x5c1cbc[_0xfb93('0x12')]()]+_0xfb93('0x13'),_0x11a25b);_0x261c57(_0x11a25b);})[_0xfb93('0x14')](function(_0x50326a){logger[_0xfb93('0x15')]('['+[_0x5c1cbc[_0xfb93('0x12')]()]+']',_0x50326a[_0xfb93('0x16')]);_0x3e8ab1(_0x50326a[_0xfb93('0x16')]);});});}function getUser(_0x404691,_0x567445,_0x8e846a,_0x4e4719,_0x25df92){return function(_0x18ec11){logger['info']('['+[_0x404691[_0xfb93('0x12')]()]+_0xfb93('0x17'),_0x18ec11);return new Promise(function(_0x3093a6,_0xca1b48){if(intUtil['validateEmail'](_0x18ec11[_0xfb93('0x18')])){var _0x2c5fb1={'method':_0xfb93('0x19'),'uri':_0x8e846a+_0xfb93('0x1a')+_0x18ec11[_0xfb93('0x18')]+'&'+_0x4e4719+'&'+_0x25df92,'auth':_0x567445,'json':!![]};logger[_0xfb93('0x11')]('['+[_0x404691[_0xfb93('0x12')]()]+_0xfb93('0x1b'),_0x2c5fb1);return rp(_0x2c5fb1)[_0xfb93('0xc')](function(_0x1aedb3){logger[_0xfb93('0x11')]('['+[_0x404691[_0xfb93('0x12')]()]+_0xfb93('0x1c'),_0x1aedb3);if(_0x1aedb3[_0xfb93('0xd')][_0xfb93('0xe')]>0x0&&String(_0x1aedb3[_0xfb93('0xd')][0x0][_0xfb93('0x1d')])==='true'){_0x18ec11[_0xfb93('0x1e')]=_0x1aedb3[_0xfb93('0xd')][0x0][_0xfb93('0x10')];}else{_0x18ec11[_0xfb93('0x1e')]=_0x18ec11[_0xfb93('0xf')];_0x18ec11[_0xfb93('0x18')]=_0x18ec11[_0xfb93('0x1f')];}logger[_0xfb93('0x11')]('['+[_0x404691[_0xfb93('0x12')]()]+_0xfb93('0x20'),_0x18ec11);_0x3093a6(_0x18ec11);})[_0xfb93('0x14')](function(_0x677c5f){logger[_0xfb93('0x15')]('['+[_0x404691[_0xfb93('0x12')]()]+']',_0x677c5f[_0xfb93('0x16')]);_0xca1b48(_0x677c5f[_0xfb93('0x16')]);});}else{logger[_0xfb93('0x11')]('['+[_0x404691[_0xfb93('0x12')]()]+_0xfb93('0x21'));_0x18ec11[_0xfb93('0x1e')]=_0x18ec11[_0xfb93('0xf')];_0x18ec11[_0xfb93('0x18')]=_0x18ec11[_0xfb93('0x1f')];_0x3093a6(_0x18ec11);}});};}function createEndUser(_0xa64aad,_0x4348fa,_0x4e07db,_0x2e2d4f,_0x41c8b9){logger[_0xfb93('0x11')]('['+[_0xa64aad[_0xfb93('0x12')]()]+_0xfb93('0x22'),_0x4e07db);return new Promise(function(_0x540642,_0x71d33a){var _0x28ea4f={'method':_0xfb93('0x23'),'uri':_0x2e2d4f+'sys_user?'+_0x41c8b9,'body':{'user_name':_0x4e07db[_0xfb93('0x24')],'roles':'user','first_name':_0x4e07db[_0xfb93('0x24')],'active':_0xfb93('0x25'),'date_format':_0xfb93('0x26'),'phone':_0x4e07db[_0xfb93('0x24')]},'auth':_0x4348fa,'json':!![]};return rp(_0x28ea4f)['then'](function(_0x16399e){logger[_0xfb93('0x11')]('['+[_0xa64aad[_0xfb93('0x12')]()]+_0xfb93('0x27'),_0x16399e[_0xfb93('0xd')]);_0x4e07db[_0xfb93('0x28')]=_0x16399e[_0xfb93('0xd')][_0xfb93('0x10')];_0x540642(_0x4e07db);})[_0xfb93('0x14')](function(_0x471347){logger[_0xfb93('0x15')]('['+[_0xa64aad[_0xfb93('0x12')]()]+']',_0x471347['message']);_0x71d33a(_0x471347[_0xfb93('0x16')]);});});}function getEndUser(_0x2ae9de,_0x4d2eca,_0x3f912a,_0x34ab0e,_0x3bc800){return function(_0x243f49){logger[_0xfb93('0x11')]('['+[_0x2ae9de[_0xfb93('0x12')]()]+_0xfb93('0x29'),_0x243f49);return new Promise(function(_0xaa02d5,_0x2e9d5e){var _0x534b5e={'method':'GET','uri':_0x3f912a+'sys_user?sysparm_query=phone%3D'+_0x243f49[_0xfb93('0x24')]+'&'+_0x34ab0e+'&'+_0x3bc800,'auth':_0x4d2eca,'json':!![]};return rp(_0x534b5e)[_0xfb93('0xc')](function(_0x281d81){if(_0x281d81[_0xfb93('0xd')][_0xfb93('0xe')]>0x0){_0x243f49[_0xfb93('0x28')]=_0x281d81[_0xfb93('0xd')][0x0][_0xfb93('0x10')];logger[_0xfb93('0x11')]('['+[_0x2ae9de[_0xfb93('0x12')]()]+_0xfb93('0x2a'),_0x243f49);_0xaa02d5(_0x243f49);}else{return createEndUser(_0x2ae9de,_0x4d2eca,_0x243f49,_0x3f912a,_0x34ab0e)['then'](function(_0x5372de){logger['info']('['+[_0x2ae9de[_0xfb93('0x12')]()]+'],\x20createEndUser\x20crm',_0x5372de);_0xaa02d5(_0x5372de);});}})['catch'](function(_0x1ac152){logger[_0xfb93('0x15')]('['+[_0x2ae9de[_0xfb93('0x12')]()]+']',_0x1ac152['message']);_0x2e9d5e(_0x1ac152[_0xfb93('0x16')]);});});};}function getCustomFields(_0x3071d9,_0x6df596){var _0xf0770f={};if(_0x3071d9['length']>0x0){_[_0xfb93('0x2b')](_0x3071d9,function(_0x4078d8){if(_[_0xfb93('0x2c')]([_0xfb93('0x2d'),_0xfb93('0x2e')],_0x4078d8[_0xfb93('0x2f')])&&_0x4078d8[_0xfb93('0x30')]&&!_0x4078d8[_0xfb93('0x31')]){_0xf0770f[_0x4078d8[_0xfb93('0x30')][_0xfb93('0x32')]()]=_0x4078d8[_0xfb93('0x33')][_0xfb93('0x34')]();}else if(_[_0xfb93('0x2c')](['string',_0xfb93('0x2e')],_0x4078d8[_0xfb93('0x2f')])&&_0x4078d8[_0xfb93('0x35')]&&_0x4078d8['customField']){_0xf0770f[_0x4078d8['idField'][_0xfb93('0x32')]()]=_0x4078d8[_0xfb93('0x33')]['toString']();}else if(_0x4078d8['type']===_0xfb93('0x36')&&_0x4078d8['variableName']&&_0x4078d8[_0xfb93('0x35')]&&_0x4078d8['customField']){_0xf0770f[_0x4078d8[_0xfb93('0x35')][_0xfb93('0x32')]()]=_0x6df596[_0x4078d8[_0xfb93('0x37')]][_0xfb93('0x34')]();}else if(_0x4078d8[_0xfb93('0x2f')]===_0xfb93('0x38')&&_0x4078d8[_0xfb93('0x39')]&&_0x4078d8[_0xfb93('0x39')][_0xfb93('0x3a')]&&_0x4078d8[_0xfb93('0x35')]&&_0x4078d8['customField']){_0xf0770f[_0x4078d8[_0xfb93('0x35')][_0xfb93('0x32')]()]=_0x6df596[_0x4078d8[_0xfb93('0x39')][_0xfb93('0x3a')][_0xfb93('0x32')]()][_0xfb93('0x34')]();}});}return _0xf0770f;}function getTicket(_0x5eb30d,_0x171c4b,_0x17e5a3,_0x4402c7,_0x9a84bb,_0x57f53e){return function(_0x29369f){logger['info']('['+[_0x5eb30d[_0xfb93('0x12')]()]+_0xfb93('0x3b'),_0x29369f);return new Promise(function(_0x454d72,_0x1dd9dd){var _0x305ed5=_0x5eb30d['toLowerCase']()===_0xfb93('0x3c')?_0x29369f[_0xfb93('0x1e')]:_0x29369f[_0xfb93('0x28')];var _0x16d36b={'method':_0xfb93('0x23'),'uri':_0x17e5a3+_0xfb93('0x3d')+'?'+_0x57f53e,'body':Object[_0xfb93('0x3e')]({},{'active':_0xfb93('0x25'),'caller_id':_0x305ed5,'assigned_to':_0x29369f[_0xfb93('0x1e')],'short_description':intUtil[_0xfb93('0x3f')](_0x4402c7[_0xfb93('0x40')],_0x9a84bb,'\x20'),'description':intUtil['getString'](_0x4402c7[_0xfb93('0x41')],_0x9a84bb,'\x0a')},getCustomFields(_0x4402c7[_0xfb93('0x42')],_0x9a84bb)),'auth':_0x171c4b,'json':!![]};return rp(_0x16d36b)[_0xfb93('0xc')](function(_0x3a36a6){logger['info']('['+[_0x5eb30d[_0xfb93('0x12')]()]+_0xfb93('0x43'),_0x3a36a6[_0xfb93('0xd')]);_0x29369f[_0xfb93('0x44')]=_0x3a36a6[_0xfb93('0xd')]['sys_id'];_0x29369f['ticketNumber']=_0x3a36a6[_0xfb93('0xd')][_0xfb93('0x45')];logger[_0xfb93('0x11')]('['+[_0x5eb30d[_0xfb93('0x12')]()]+_0xfb93('0x46'),_0x29369f);_0x454d72(_0x29369f);})[_0xfb93('0x14')](function(_0x22a267){logger['error']('['+[_0x5eb30d[_0xfb93('0x12')]()]+']',_0x22a267['message']);_0x1dd9dd(_0x22a267[_0xfb93('0x16')]);});});};}function createRemoteTag(_0x46b058,_0x1f2815,_0x361acd,_0x136810){return new Promise(function(_0x35f829,_0x1dadf4){var _0x42e74a={'method':_0xfb93('0x23'),'uri':_0x361acd+_0xfb93('0x47')+'?'+_0x136810,'body':{'short_description':_0x46b058,'global':!![],'active':!![],'name':_0x46b058},'auth':_0x1f2815,'json':!![]};return rp(_0x42e74a)['then'](function(_0x5f1e48){var _0x2a452b=_0x5f1e48['result'][_0xfb93('0x10')];_0x35f829(_0x2a452b);});});}function getRemoteTag(_0x39a238,_0x5aa5db,_0x4df0ea,_0x324840,_0x42973f){return new Promise(function(_0x22e6b2,_0x277fe2){var _0x42bde2={'method':'GET','uri':_0x4df0ea+_0xfb93('0x47')+_0xfb93('0x48')+_0x39a238+'&'+_0x324840,'auth':_0x5aa5db,'json':!![]};return rp(_0x42bde2)['then'](function(_0x5a7d1f){if(_0x5a7d1f[_0xfb93('0xd')][_0xfb93('0xe')]>0x0){var _0x51e43e=_0x5a7d1f[_0xfb93('0xd')][0x0]['sys_id'];_0x22e6b2(_0x51e43e);}else{return createRemoteTag(_0x39a238,_0x5aa5db,_0x4df0ea,_0x324840)['then'](function(_0x368c20){_0x22e6b2(_0x368c20);});}});});}function assignTagToIncident(_0x391289,_0x3baa56,_0x1d521f,_0x4ff915,_0x605942){return new Promise(function(_0x25dd99,_0x6cbfbb){var _0x245229={'method':_0xfb93('0x23'),'uri':_0x1d521f+'label_entry'+'?'+_0x605942,'body':{'label':_0x391289,'table':_0xfb93('0x3d'),'id_type':'Incident','table_key':_0x4ff915['ticketId'],'title':_0xfb93('0x49')+_0x4ff915[_0xfb93('0x4a')],'id_display':_0x4ff915[_0xfb93('0x4a')]},'auth':_0x3baa56,'json':!![]};return rp(_0x245229)['then'](function(_0x512803){_0x25dd99();})[_0xfb93('0x14')](function(){_0x25dd99();});});}function manageTags(_0x4a9c27,_0xb879c3,_0x41d198,_0x1568ea,_0x41ce9a,_0x3d1d01,_0xcb9c6d){return new Promise(function(_0x458bd3,_0x1c0df3){var _0xb1c71c=[];_0xb879c3[_0xfb93('0x2b')](function(_0x389130){_0xb1c71c['push'](getRemoteTag(_0x389130,_0x41d198,_0x1568ea,_0x3d1d01,_0xcb9c6d));});return Promise['all'](_0xb1c71c)[_0xfb93('0xc')](function(_0x37ccb4){if(_0x37ccb4[_0xfb93('0xe')]){logger[_0xfb93('0x11')]('['+[_0x4a9c27['toUpperCase']()]+_0xfb93('0x4b'),_0x37ccb4);var _0x5057d5=[];_0x37ccb4[_0xfb93('0x2b')](function(_0x28edf8){_0x5057d5[_0xfb93('0x4c')](assignTagToIncident(_0x28edf8,_0x41d198,_0x1568ea,_0x41ce9a,_0x3d1d01));});return Promise[_0xfb93('0x4d')](_0x5057d5)['then'](function(){_0x458bd3();})[_0xfb93('0x14')](function(){_0x458bd3();});}else{_0x458bd3();}});});}function getTags(_0x2e13ee,_0x5a09d3,_0x275775,_0x400695,_0x2204a9,_0x151729){return function(_0x56cb33){return new Promise(function(_0x35d7aa,_0x267a60){var _0x130a78=[];var _0x28ff10=_0x400695[_0xfb93('0x4e')];if(_0x28ff10&&_0x28ff10[_0xfb93('0xe')]>0x0){_0x130a78=_[_0xfb93('0x4f')](_0x28ff10,'name');}if(_0x130a78[_0xfb93('0xe')]>0x0){return manageTags(_0x2e13ee,_0x130a78,_0x5a09d3,_0x275775,_0x56cb33,_0x2204a9,_0x151729)[_0xfb93('0xc')](function(){_0x35d7aa(_0x56cb33);});}else{_0x35d7aa(_0x56cb33);}});};}function emit(_0x48b7a0,_0x51d866,_0x2ccedd){var _0x5a79a1=_0xfb93('0x50')+_0xfb93('0x51')+'%26sysparm_record_list%3Dactive%253Dtrue'+_0xfb93('0x52');var _0x5192e5={'uri':_0x48b7a0+_0xfb93('0x53')+_0x2ccedd+_0x5a79a1};io['to'](util[_0xfb93('0x54')](_0xfb93('0x55'),_0x51d866))['emit'](_0xfb93('0x56'),_0x5192e5);}exports['cs']=function(_0x2c091f,_0x2d09ca,_0x174908,_0x521e51,_0x2d3f62,_0x26f2e6,_0x40ba36,_0x278c99){var _0x221be9={};var _0x35a473={'user':_0x26f2e6[_0xfb93('0x57')],'pass':_0x26f2e6['password']};var _0x23a6b0=_0xfb93('0x58');var _0x495c25=_0xfb93('0x59');_0x26f2e6[_0xfb93('0x5a')]=intUtil[_0xfb93('0x5b')](_0x26f2e6[_0xfb93('0x5a')]);_0x26f2e6[_0xfb93('0x5c')]=intUtil[_0xfb93('0x5b')](_0x26f2e6[_0xfb93('0x5c')]);var _0x4b08c8=util['format'](_0xfb93('0x5d'),_0x26f2e6[_0xfb93('0x5a')]);_0x221be9[_0xfb93('0x18')]=!_['isNil'](_0x521e51)?_0x521e51[_0xfb93('0x5e')]:null;_0x221be9[_0xfb93('0x1f')]=_0x26f2e6[_0xfb93('0x5e')];_0x221be9['endUserNumber']=_0x278c99[_0xfb93('0x32')]()===_0xfb93('0x3c')?_0x2d09ca[_0xfb93('0x5f')]:_0x2d09ca[_0xfb93('0x60')];_0x221be9[_0xfb93('0x61')]=_0x278c99===_0xfb93('0x62')||_0x278c99===_0xfb93('0x63')?_0xfb93('0x62'):_0xfb93('0x3c');var _0x51100e=util[_0xfb93('0x54')](_0xfb93('0x64'),_0x26f2e6[_0xfb93('0x5c')],_0x2d09ca[_0xfb93('0x65')],md5(_0x2d09ca[_0xfb93('0x65')]));if(_0x2d3f62&&_0x2d3f62[_0xfb93('0x66')]){logger[_0xfb93('0x11')](_0xfb93('0x67'),_0xfb93('0x68'));_0x2d09ca[_0xfb93('0x69')]=_0x51100e;}else if(_0x40ba36&&_0x40ba36[_0xfb93('0x6a')]&&_0x40ba36[_0xfb93('0x6a')]!=='none'){logger[_0xfb93('0x11')](_0xfb93('0x6b'),_0xfb93('0x68'));_0x2d09ca[_0xfb93('0x69')]=_0x51100e;}else{_0x2d09ca[_0xfb93('0x69')]='';}return getAdminUser(_0x278c99,_0x35a473,_0x221be9,_0x4b08c8,_0x495c25,_0x23a6b0)['then'](getUser(_0x278c99,_0x35a473,_0x4b08c8,_0x495c25,_0x23a6b0))[_0xfb93('0xc')](getEndUser(_0x278c99,_0x35a473,_0x4b08c8,_0x495c25,_0x23a6b0))[_0xfb93('0xc')](getTicket(_0x278c99,_0x35a473,_0x4b08c8,_0x174908,_0x2d09ca,_0x495c25))[_0xfb93('0xc')](function(_0x1918cc){logger[_0xfb93('0x11')](util[_0xfb93('0x54')]('The\x20ticket\x20ID\x20is:\x20%s',_0x1918cc['ticketId']));logger[_0xfb93('0x11')](util[_0xfb93('0x54')](_0xfb93('0x6c'),_0x278c99));if(_0x278c99!==_0xfb93('0x63')){logger['info']('['+[_0x278c99[_0xfb93('0x12')]()]+']',_0xfb93('0x6d'));emit(_0x26f2e6[_0xfb93('0x5a')],_0x521e51[_0xfb93('0x3a')],_0x1918cc[_0xfb93('0x44')]);}})[_0xfb93('0x14')](function(_0x5a7f6d){logger[_0xfb93('0x15')]('['+[_0x278c99['toUpperCase']()]+_0xfb93('0x6e'),util[_0xfb93('0x6f')](_0x5a7f6d,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/sugarcrm.js b/server/services/ami/trigger/integration/sugarcrm.js index 8b28321..09c2db5 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 _0x164c=['string','customField','nameField','toLowerCase','custom_fields','idField','content','customVariable','Variable','login','username','password','PLAIN','xCALLY\x20Motion\x20integration','sessionID','queue','remoteUri','stripTrailingSlash','serverUrl','%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','Inbound','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','users','version','charAt','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','catch','uri','[OUTBOUND]','destcalleridname','destcalleridnum','error','unmanaged','lastevent','contacts','lodash','bluebird','md5','util','./util','../../../../config/environment','../../../../config/logger','sugarcrm','redis','localhost','socket.io-emitter','POST','emit','info','Creating\x20new\x20ticket...','name','getString','Subjects','assigned_user_id','created_by','slice','replace','duration_minutes','parent_id','parent_type','Contacts','direction','length','forEach','variableName','push','set_entry','JSON','stringify','Calls','format','Basic\x20%s','apiKey','toString','base64','get_server_info','isNil','Getting\x20agent\x20with\x20name','Employees','user_name','then','entry_list','Agent\x20found!','resolve','name_value_list','value','user_id','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','get_entry_list','phone_home','find','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','first_name','','Caller\x20-\x20%s','debug','merge','map','type'];(function(_0x20384a,_0x3ffe25){var _0x5b783b=function(_0x3b2ad1){while(--_0x3b2ad1){_0x20384a['push'](_0x20384a['shift']());}};_0x5b783b(++_0x3ffe25);}(_0x164c,0x192));var _0xc164=function(_0x565d96,_0x42aae6){_0x565d96=_0x565d96-0x0;var _0xd058e6=_0x164c[_0x565d96];return _0xd058e6;};'use strict';var _=require(_0xc164('0x0'));var rp=require('request-promise');var BPromise=require(_0xc164('0x1'));var md5=require(_0xc164('0x2'));var util=require(_0xc164('0x3'));var Redis=require('ioredis');var intUtil=require(_0xc164('0x4'));var config=require(_0xc164('0x5'));var logger=require(_0xc164('0x6'))(_0xc164('0x7'));config['redis']=_['defaults'](config[_0xc164('0x8')],{'host':_0xc164('0x9'),'port':0x18eb});var io=require(_0xc164('0xa'))(new Redis(config[_0xc164('0x8')]));var def={'method':_0xc164('0xb'),'json':!![]};function emit(_0x40746e,_0x226340,_0x34cf66){io['to'](_0x40746e)[_0xc164('0xc')](_0x226340,_0x34cf66);}function getTicket(_0x2b7712,_0x265f78,_0x53b381,_0x2da2e4,_0x5a7890,_0x1c4157,_0x2392a7,_0x1d62fc){logger[_0xc164('0xd')](_0xc164('0xe'));var _0x4b93e2=new Date();var _0x20bf5c=[{'name':_0xc164('0xf'),'value':intUtil[_0xc164('0x10')](_0x2da2e4[_0xc164('0x11')],_0x5a7890,'\x20')},{'name':_0xc164('0x12'),'value':_0x265f78['id']},{'name':_0xc164('0x13'),'value':_0x265f78['id']},{'name':'description','value':intUtil[_0xc164('0x10')](_0x2da2e4['Descriptions'],_0x5a7890,'\x0a')},{'name':'date_start','value':_0x4b93e2['toISOString']()[_0xc164('0x14')](0x0,0x13)[_0xc164('0x15')]('T','\x20')},{'name':'duration_hours','value':'0'},{'name':_0xc164('0x16'),'value':'15'},{'name':_0xc164('0x17'),'value':_0x53b381['id']},{'name':_0xc164('0x18'),'value':_0xc164('0x19')},{'name':'parent_name','value':_0x53b381[_0xc164('0xf')]},{'name':_0xc164('0x1a'),'value':_0x1d62fc}];if(_0x1c4157[_0xc164('0x1b')]){_[_0xc164('0x1c')](_0x1c4157,function(_0x22299e){if(_0x5a7890[_0x22299e[_0xc164('0x1d')]]){_0x20bf5c[_0xc164('0x1e')]({'name':_0x22299e['idField'],'value':_0x5a7890[_0x22299e['variableName']]});}});}return request({'form':{'method':_0xc164('0x1f'),'input_type':_0xc164('0x20'),'response_type':_0xc164('0x20'),'rest_data':JSON[_0xc164('0x21')]({'session':_0x2392a7['id'],'module_name':_0xc164('0x22'),'name_value_list':_0x20bf5c})}});}function getAuth(_0x437f27){return util[_0xc164('0x23')](_0xc164('0x24'),new Buffer(_0x437f27[_0xc164('0x25')]+':X')[_0xc164('0x26')](_0xc164('0x27')));}function getServerInfo(_0x43329a){return request({'form':{'method':_0xc164('0x28'),'input_type':_0xc164('0x20'),'response_type':'JSON','rest_data':JSON['stringify']({'session':_0x43329a['id']})}});}function getUser(_0x64509b,_0xe08c83,_0x3977ff){if(!_[_0xc164('0x29')](_0xe08c83)){logger[_0xc164('0xd')](_0xc164('0x2a'),_0xe08c83);return request({'form':{'method':'get_entry_list','input_type':_0xc164('0x20'),'response_type':'JSON','rest_data':JSON['stringify']({'session':_0x3977ff['id'],'module_name':_0xc164('0x2b'),'query':util[_0xc164('0x23')]('INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200',_0xe08c83),'order_by':'','offset':'0','select_fields':['id',_0xc164('0xf'),_0xc164('0x2c')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xc164('0x2d')](function(_0x4d1dfb){if(_0x4d1dfb[_0xc164('0x2e')][_0xc164('0x1b')]){var _0x4383f5=_['find'](_0x4d1dfb[_0xc164('0x2e')],function(_0x565e85){return _0x565e85['name_value_list'][_0xc164('0x2c')]['value']===_0xe08c83;});if(_0x4383f5){logger[_0xc164('0xd')](_0xc164('0x2f'));return BPromise[_0xc164('0x30')]({'id':_0x4383f5[_0xc164('0x31')]['id']['value'],'name':_0x4383f5[_0xc164('0x31')][_0xc164('0xf')][_0xc164('0x32')]});}}logger[_0xc164('0xd')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0xc164('0x30')]({'id':_0x3977ff[_0xc164('0x31')][_0xc164('0x33')]['value'],'name':_0x3977ff['name_value_list'][_0xc164('0x2c')][_0xc164('0x32')]});});}else{logger[_0xc164('0xd')](_0xc164('0x34'));return BPromise[_0xc164('0x30')]({'id':_0x3977ff['name_value_list'][_0xc164('0x33')][_0xc164('0x32')],'name':_0x3977ff[_0xc164('0x31')]['user_name'][_0xc164('0x32')]});}}function getEndUser(_0xa51551,_0x229559,_0x30e79d,_0xf8b7e6){logger[_0xc164('0xd')](_0xc164('0x35'),_0x30e79d);return request({'form':{'method':_0xc164('0x36'),'input_type':'JSON','response_type':_0xc164('0x20'),'rest_data':JSON['stringify']({'session':_0xf8b7e6['id'],'module_name':_0xc164('0x19'),'query':util[_0xc164('0x23')]('contacts.phone_home\x20=\x20\x22%s\x22',_0x30e79d),'order_by':'','offset':'0','select_fields':['id','name',_0xc164('0x37')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xc164('0x2d')](function(_0x32a09f){if(_0x32a09f[_0xc164('0x2e')][_0xc164('0x1b')]){var _0x544781=_[_0xc164('0x38')](_0x32a09f[_0xc164('0x2e')],function(_0x4f33a9){return _0x4f33a9[_0xc164('0x31')]['phone_home']['value']===_0x30e79d;});if(_0x544781){logger['info'](_0xc164('0x39'));return BPromise[_0xc164('0x30')]({'id':_0x544781[_0xc164('0x31')]['id']['value'],'name':_0x544781[_0xc164('0x31')]['name'][_0xc164('0x32')],'phone':_0x544781[_0xc164('0x31')]['phone_home'][_0xc164('0x32')]});}}else{logger[_0xc164('0xd')](_0xc164('0x3a'));return request({'form':{'method':_0xc164('0x1f'),'input_type':_0xc164('0x20'),'response_type':_0xc164('0x20'),'rest_data':JSON[_0xc164('0x21')]({'session':_0xf8b7e6['id'],'module_name':_0xc164('0x19'),'name_value_list':[{'name':_0xc164('0x3b'),'value':_0x229559!==_0xc164('0x3c')?_0x229559:util[_0xc164('0x23')](_0xc164('0x3d'),_0x30e79d)},{'name':'phone_home','value':_0x30e79d}]})}})[_0xc164('0x2d')](function(_0x61cb24){logger['info']('Enduser\x20created.');return BPromise[_0xc164('0x30')]({'id':_0x61cb24['id'],'name':_0x61cb24[_0xc164('0x2e')]['first_name'][_0xc164('0x32')],'phone':_0x61cb24[_0xc164('0x2e')][_0xc164('0x37')]['value']});});}});}function request(_0x5c55cd){logger[_0xc164('0x3e')]('[HTTP]',JSON[_0xc164('0x21')](_0x5c55cd));return rp(_[_0xc164('0x3f')](def,_0x5c55cd));}function getTags(_0x499d9e,_0x4f2689){var _0x2996a6=[];if(_0x499d9e&&_0x499d9e['length']>0x0){_0x2996a6=_[_0xc164('0x40')](_0x499d9e,_0x4f2689);}return _0x2996a6;}function getCustomFields(_0x113a4c,_0x3c2314){var _0x3a652b=[];var _0x5753fa={'custom_fields':[]};if(_0x113a4c[_0xc164('0x1b')]>0x0){_['forEach'](_0x113a4c,function(_0x2831f1){if(_0x2831f1[_0xc164('0x41')]===_0xc164('0x42')&&_0x2831f1['nameField']&&!_0x2831f1[_0xc164('0x43')]){_0x5753fa[_0x2831f1[_0xc164('0x44')][_0xc164('0x45')]()]=_0x2831f1['content'][_0xc164('0x26')]();}else if(_0x2831f1[_0xc164('0x41')]==='string'&&_0x2831f1['idField']&&_0x2831f1[_0xc164('0x43')]){_0x5753fa[_0xc164('0x46')]['push']({'id':_0x2831f1[_0xc164('0x47')],'value':_0x2831f1[_0xc164('0x48')]['toString']()});}else if(_0x2831f1['type']==='variable'&&_0x2831f1['variableName']&&_0x2831f1[_0xc164('0x47')]&&_0x2831f1[_0xc164('0x43')]){_0x3c2314[_0x2831f1[_0xc164('0x1d')]]&&_0x5753fa[_0xc164('0x46')][_0xc164('0x1e')]({'id':_0x2831f1['idField'],'value':_0x3c2314[_0x2831f1[_0xc164('0x1d')]][_0xc164('0x26')]()});}else if(_0x2831f1[_0xc164('0x41')]===_0xc164('0x49')&&_0x2831f1[_0xc164('0x4a')]&&_0x2831f1['Variable']['name']&&_0x2831f1['idField']&&_0x2831f1[_0xc164('0x43')]){_0x3c2314[_0x2831f1['Variable'][_0xc164('0xf')][_0xc164('0x45')]()]&&_0x5753fa[_0xc164('0x46')][_0xc164('0x1e')]({'id':_0x2831f1[_0xc164('0x47')],'value':_0x3c2314[_0x2831f1[_0xc164('0x4a')]['name']['toLowerCase']()][_0xc164('0x26')]()});}});}return _0x5753fa;}function getConnection(_0x4e0614){return request({'method':_0xc164('0xb'),'form':{'method':_0xc164('0x4b'),'input_type':'JSON','response_type':'JSON','rest_data':JSON[_0xc164('0x21')]({'user_auth':{'user_name':_0x4e0614[_0xc164('0x4c')],'password':_0x4e0614[_0xc164('0x4d')],'encryption':_0xc164('0x4e')},'application':_0xc164('0x4f')})}})['then'](function(_0x39fce7){var _0x1528d8=_0x39fce7;if(_0x1528d8['id']){def[_0xc164('0x50')]=_0x1528d8['id'];return BPromise['resolve'](_0x1528d8);}else{throw new Error(util['format']('Account\x20%d\x20is\x20not\x20valid',_0x4e0614['id']));}});}function setRelationship(_0x4fe6ed,_0x3f5500,_0x104c43,_0x3b51da){return request({'form':{'method':'set_relationship','input_type':_0xc164('0x20'),'response_type':_0xc164('0x20'),'rest_data':JSON[_0xc164('0x21')]({'session':_0x4fe6ed['id'],'module_name':_0xc164('0x22'),'module_id':_0x104c43['id'],'link_field_name':_0x3b51da,'related_ids':[_0x3f5500['id']],'name_value_list':[],'delete':0x0})}});}exports[_0xc164('0x51')]=function(_0x444686,_0x598d04,_0x3f7711,_0x5813e0,_0x57cf34,_0x7b3c48){var _0x3b8db2,_0x6e73e,_0x51714d,_0x340818;_0x7b3c48[_0xc164('0x52')]=intUtil[_0xc164('0x53')](_0x7b3c48[_0xc164('0x52')]);_0x7b3c48['serverUrl']=intUtil[_0xc164('0x53')](_0x7b3c48[_0xc164('0x54')]);def['uri']=util[_0xc164('0x23')](_0xc164('0x55'),_0x7b3c48[_0xc164('0x52')]);if(_0x57cf34&&_0x57cf34[_0xc164('0x56')]){logger['info'](_0xc164('0x57'),_0xc164('0x58'));_0x598d04[_0xc164('0x59')]=util['format'](_0xc164('0x5a'),_0x7b3c48[_0xc164('0x54')],_0x598d04['uniqueid'],md5(_0x598d04[_0xc164('0x5b')]));}else{_0x598d04[_0xc164('0x59')]='';}return getConnection(_0x7b3c48)[_0xc164('0x2d')](function(_0x81d552){_0x340818=_0x81d552;return getUser(_0x7b3c48,_0x5813e0['name'],_0x340818);})[_0xc164('0x2d')](function(_0x41465e){_0x3b8db2=_0x41465e;logger[_0xc164('0xd')](_0xc164('0x5c'),_0x3b8db2['id']);return getEndUser(_0x7b3c48,_0x598d04[_0xc164('0x5d')],_0x598d04[_0xc164('0x5e')],_0x340818);})[_0xc164('0x2d')](function(_0x437c01){_0x6e73e=_0x437c01;logger[_0xc164('0xd')](_0xc164('0x5f'),_0x6e73e['id']);return getTicket(_0x7b3c48,_0x3b8db2,_0x6e73e,_0x3f7711,_0x598d04,_0x3f7711[_0xc164('0x60')],_0x340818,_0xc164('0x61'));})[_0xc164('0x2d')](function(_0x1c45e4){_0x51714d=_0x1c45e4;logger[_0xc164('0xd')](_0xc164('0x62'));logger[_0xc164('0xd')](_0xc164('0x63'),_0x51714d['id']);return setRelationship(_0x340818,_0x3b8db2,_0x51714d,_0xc164('0x64'));})[_0xc164('0x2d')](function(){return setRelationship(_0x340818,_0x6e73e,_0x51714d,'contacts');})[_0xc164('0x2d')](function(){return getServerInfo(_0x340818);})[_0xc164('0x2d')](function(_0x5da864){var _0x5bfb4c=parseInt(_0x5da864[_0xc164('0x65')][_0xc164('0x66')](0x0));var _0x59bffc=util[_0xc164('0x23')](_0xc164('0x67'),_0x7b3c48['remoteUri'],_0x51714d['id']);if(_0x5bfb4c>0x6){_0x59bffc=util['format'](_0xc164('0x68'),_0x7b3c48['remoteUri'],_0x51714d['id']);}logger['info'](_0xc164('0x57'),_0xc164('0x69'));emit(util[_0xc164('0x23')](_0xc164('0x6a'),_0x5813e0[_0xc164('0xf')]),_0xc164('0x6b'),{'uri':_0x59bffc});})[_0xc164('0x6c')](function(_0x4e0216){logger['error'](_0xc164('0x57'),JSON['stringify'](_0x4e0216));});};exports['outbound']=function(_0x5f2c17,_0x4701ea,_0x2e2189,_0x3cc6f5,_0x3204d5,_0x52057d,_0x40c1bb){var _0x5e7c84,_0x5989db,_0x5d24b8,_0x18bef8;_0x52057d['remoteUri']=intUtil[_0xc164('0x53')](_0x52057d[_0xc164('0x52')]);_0x52057d[_0xc164('0x54')]=intUtil[_0xc164('0x53')](_0x52057d[_0xc164('0x54')]);def[_0xc164('0x6d')]=util[_0xc164('0x23')](_0xc164('0x55'),_0x52057d[_0xc164('0x52')]);if(_0x40c1bb&&_0x40c1bb['recordingFormat']&&_0x40c1bb['recordingFormat']!=='none'){logger[_0xc164('0xd')](_0xc164('0x6e'),_0xc164('0x58'));_0x4701ea[_0xc164('0x59')]=util[_0xc164('0x23')](_0xc164('0x5a'),_0x52057d[_0xc164('0x54')],_0x4701ea['uniqueid'],md5(_0x4701ea[_0xc164('0x5b')]));}return getConnection(_0x52057d)[_0xc164('0x2d')](function(_0x4d0de7){_0x18bef8=_0x4d0de7;return getUser(_0x52057d,_0x3cc6f5[_0xc164('0xf')],_0x18bef8);})[_0xc164('0x2d')](function(_0x2bb2c3){_0x5e7c84=_0x2bb2c3;logger[_0xc164('0xd')]('The\x20User\x20ID\x20is:',_0x5e7c84['id']);return getEndUser(_0x52057d,_0x4701ea[_0xc164('0x6f')],_0x4701ea[_0xc164('0x70')],_0x18bef8);})['then'](function(_0x3f243b){_0x5989db=_0x3f243b;logger[_0xc164('0xd')](_0xc164('0x5f'),_0x5989db['id']);return getTicket(_0x52057d,_0x5e7c84,_0x5989db,_0x2e2189,_0x4701ea,_0x2e2189[_0xc164('0x60')],_0x18bef8,'Outbound');})['then'](function(_0x1d58cd){_0x5d24b8=_0x1d58cd;logger[_0xc164('0xd')](_0xc164('0x62'));logger['info'](_0xc164('0x63'),_0x5d24b8['id']);return setRelationship(_0x18bef8,_0x5e7c84,_0x5d24b8,'users');})['then'](function(){return setRelationship(_0x18bef8,_0x5989db,_0x5d24b8,'contacts');})[_0xc164('0x2d')](function(){return getServerInfo(_0x18bef8);})[_0xc164('0x2d')](function(_0x14fd96){var _0x58d251=parseInt(_0x14fd96[_0xc164('0x65')]['charAt'](0x0));var _0xe86ee9=util['format'](_0xc164('0x67'),_0x52057d[_0xc164('0x52')],_0x5d24b8['id']);if(_0x58d251>0x6){_0xe86ee9=util[_0xc164('0x23')]('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0x52057d[_0xc164('0x52')],_0x5d24b8['id']);}logger['info'](_0xc164('0x6e'),_0xc164('0x69'));emit(util[_0xc164('0x23')](_0xc164('0x6a'),_0x3cc6f5[_0xc164('0xf')]),'trigger:browser:url',{'uri':_0xe86ee9});})['catch'](function(_0x5be9d7){logger[_0xc164('0x71')](_0xc164('0x6e'),JSON['stringify'](_0x5be9d7));});};exports[_0xc164('0x72')]=function(_0x1c0928,_0x4ad7d1,_0x8e95f1,_0x41ed24,_0x3c0aba,_0x549081){var _0xf0f04e,_0x472d4a,_0x3d8d1b,_0x23e4fe;_0x549081[_0xc164('0x52')]=intUtil['stripTrailingSlash'](_0x549081['remoteUri']);_0x549081[_0xc164('0x54')]=intUtil['stripTrailingSlash'](_0x549081[_0xc164('0x54')]);def['uri']=util['format'](_0xc164('0x55'),_0x549081['remoteUri']);if(_0x3c0aba&&_0x3c0aba['monitor_format']){logger[_0xc164('0xd')]('['+_0x4ad7d1[_0xc164('0x73')]['toUpperCase']()+']',_0xc164('0x58'));_0x4ad7d1['recordingURL']=util[_0xc164('0x23')](_0xc164('0x5a'),_0x549081[_0xc164('0x54')],_0x4ad7d1[_0xc164('0x5b')],md5(_0x4ad7d1[_0xc164('0x5b')]));}else{_0x4ad7d1[_0xc164('0x59')]='';}return getConnection(_0x549081)[_0xc164('0x2d')](function(_0x433d71){_0x23e4fe=_0x433d71;if(!_[_0xc164('0x29')](_0x41ed24)){return getUser(_0x549081,_0x41ed24[_0xc164('0xf')],_0x23e4fe);}else{return getUser(_0x549081,null,_0x23e4fe);}})[_0xc164('0x2d')](function(_0x5f2550){_0xf0f04e=_0x5f2550;logger[_0xc164('0xd')](_0xc164('0x5c'),_0xf0f04e['id']);return getEndUser(_0x549081,_0x4ad7d1[_0xc164('0x5d')],_0x4ad7d1[_0xc164('0x5e')],_0x23e4fe);})[_0xc164('0x2d')](function(_0x226e89){_0x472d4a=_0x226e89;logger['info']('The\x20Enduser\x20ID\x20is:',_0x472d4a['id']);return getTicket(_0x549081,_0xf0f04e,_0x472d4a,_0x8e95f1,_0x4ad7d1,_0x8e95f1[_0xc164('0x60')],_0x23e4fe,_0xc164('0x61'));})[_0xc164('0x2d')](function(_0x9e3346){_0x3d8d1b=_0x9e3346;logger[_0xc164('0xd')](_0xc164('0x62'));logger['info']('The\x20Ticket\x20ID\x20is:',_0x3d8d1b['id']);return setRelationship(_0x23e4fe,_0xf0f04e,_0x3d8d1b,_0xc164('0x64'));})[_0xc164('0x2d')](function(){return setRelationship(_0x23e4fe,_0x472d4a,_0x3d8d1b,_0xc164('0x74'));})[_0xc164('0x2d')](function(){return getServerInfo(_0x23e4fe);})[_0xc164('0x6c')](function(_0x3c5c9b){logger[_0xc164('0x71')]('['+_0x4ad7d1['lastevent']['toUpperCase']()+']',JSON[_0xc164('0x21')](_0x3c5c9b));});}; \ No newline at end of file +var _0xc415=['The\x20Enduser\x20ID\x20is:','Fields','Inbound','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','users','contacts','charAt','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','catch','error','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','version','lastevent','toUpperCase','isNil','lodash','request-promise','bluebird','md5','util','./util','../../../../config/logger','sugarcrm','redis','defaults','localhost','socket.io-emitter','POST','emit','info','Creating\x20new\x20ticket...','name','getString','Subjects','description','toISOString','replace','duration_hours','duration_minutes','Contacts','parent_name','direction','length','forEach','variableName','push','idField','set_entry','JSON','stringify','Basic\x20%s','apiKey','toString','base64','get_server_info','Employees','format','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','user_name','entry_list','name_value_list','Agent\x20found!','value','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','resolve','user_id','Searching\x20enduser\x20with\x20phone','get_entry_list','phone_home','then','find','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','first_name','debug','[HTTP]','merge','map','type','string','customField','nameField','content','custom_fields','variable','customVariable','Variable','toLowerCase','login','username','password','PLAIN','xCALLY\x20Motion\x20integration','Account\x20%d\x20is\x20not\x20valid','set_relationship','queue','stripTrailingSlash','remoteUri','serverUrl','uri','%s/service/v4_1/rest.php','monitor_format','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20User\x20ID\x20is:','calleridname','calleridnum'];(function(_0x1577a7,_0x542b54){var _0x3618e2=function(_0x3300b6){while(--_0x3300b6){_0x1577a7['push'](_0x1577a7['shift']());}};_0x3618e2(++_0x542b54);}(_0xc415,0x17b));var _0x5c41=function(_0x5c5327,_0x56ee95){_0x5c5327=_0x5c5327-0x0;var _0x58a447=_0xc415[_0x5c5327];return _0x58a447;};'use strict';var _=require(_0x5c41('0x0'));var rp=require(_0x5c41('0x1'));var BPromise=require(_0x5c41('0x2'));var md5=require(_0x5c41('0x3'));var util=require(_0x5c41('0x4'));var Redis=require('ioredis');var intUtil=require(_0x5c41('0x5'));var config=require('../../../../config/environment');var logger=require(_0x5c41('0x6'))(_0x5c41('0x7'));config[_0x5c41('0x8')]=_[_0x5c41('0x9')](config['redis'],{'host':_0x5c41('0xa'),'port':0x18eb});var io=require(_0x5c41('0xb'))(new Redis(config[_0x5c41('0x8')]));var def={'method':_0x5c41('0xc'),'json':!![]};function emit(_0x4cd759,_0x212559,_0x125513){io['to'](_0x4cd759)[_0x5c41('0xd')](_0x212559,_0x125513);}function getTicket(_0x152b28,_0x175c7d,_0x32a3a5,_0x1db4c1,_0x748c54,_0x5f4ed4,_0x271f18,_0x2128ba){logger[_0x5c41('0xe')](_0x5c41('0xf'));var _0x260563=new Date();var _0x583889=[{'name':_0x5c41('0x10'),'value':intUtil[_0x5c41('0x11')](_0x1db4c1[_0x5c41('0x12')],_0x748c54,'\x20')},{'name':'assigned_user_id','value':_0x175c7d['id']},{'name':'created_by','value':_0x175c7d['id']},{'name':_0x5c41('0x13'),'value':intUtil[_0x5c41('0x11')](_0x1db4c1['Descriptions'],_0x748c54,'\x0a')},{'name':'date_start','value':_0x260563[_0x5c41('0x14')]()['slice'](0x0,0x13)[_0x5c41('0x15')]('T','\x20')},{'name':_0x5c41('0x16'),'value':'0'},{'name':_0x5c41('0x17'),'value':'15'},{'name':'parent_id','value':_0x32a3a5['id']},{'name':'parent_type','value':_0x5c41('0x18')},{'name':_0x5c41('0x19'),'value':_0x32a3a5[_0x5c41('0x10')]},{'name':_0x5c41('0x1a'),'value':_0x2128ba}];if(_0x5f4ed4[_0x5c41('0x1b')]){_[_0x5c41('0x1c')](_0x5f4ed4,function(_0x5d409b){if(_0x748c54[_0x5d409b[_0x5c41('0x1d')]]){_0x583889[_0x5c41('0x1e')]({'name':_0x5d409b[_0x5c41('0x1f')],'value':_0x748c54[_0x5d409b['variableName']]});}});}return request({'form':{'method':_0x5c41('0x20'),'input_type':_0x5c41('0x21'),'response_type':_0x5c41('0x21'),'rest_data':JSON[_0x5c41('0x22')]({'session':_0x271f18['id'],'module_name':'Calls','name_value_list':_0x583889})}});}function getAuth(_0xbac826){return util['format'](_0x5c41('0x23'),new Buffer(_0xbac826[_0x5c41('0x24')]+':X')[_0x5c41('0x25')](_0x5c41('0x26')));}function getServerInfo(_0x418a9f){return request({'form':{'method':_0x5c41('0x27'),'input_type':'JSON','response_type':_0x5c41('0x21'),'rest_data':JSON[_0x5c41('0x22')]({'session':_0x418a9f['id']})}});}function getUser(_0x196428,_0x351b45,_0x387eb7){if(!_['isNil'](_0x351b45)){logger['info']('Getting\x20agent\x20with\x20name',_0x351b45);return request({'form':{'method':'get_entry_list','input_type':'JSON','response_type':_0x5c41('0x21'),'rest_data':JSON[_0x5c41('0x22')]({'session':_0x387eb7['id'],'module_name':_0x5c41('0x28'),'query':util[_0x5c41('0x29')](_0x5c41('0x2a'),_0x351b45),'order_by':'','offset':'0','select_fields':['id',_0x5c41('0x10'),_0x5c41('0x2b')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0x1426f2){if(_0x1426f2['entry_list']['length']){var _0x4f14c9=_['find'](_0x1426f2[_0x5c41('0x2c')],function(_0x39ca57){return _0x39ca57[_0x5c41('0x2d')][_0x5c41('0x2b')]['value']===_0x351b45;});if(_0x4f14c9){logger[_0x5c41('0xe')](_0x5c41('0x2e'));return BPromise['resolve']({'id':_0x4f14c9[_0x5c41('0x2d')]['id'][_0x5c41('0x2f')],'name':_0x4f14c9[_0x5c41('0x2d')][_0x5c41('0x10')][_0x5c41('0x2f')]});}}logger['info'](_0x5c41('0x30'));return BPromise[_0x5c41('0x31')]({'id':_0x387eb7['name_value_list']['user_id'][_0x5c41('0x2f')],'name':_0x387eb7[_0x5c41('0x2d')][_0x5c41('0x2b')][_0x5c41('0x2f')]});});}else{logger['info']('Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!');return BPromise[_0x5c41('0x31')]({'id':_0x387eb7[_0x5c41('0x2d')][_0x5c41('0x32')]['value'],'name':_0x387eb7['name_value_list'][_0x5c41('0x2b')][_0x5c41('0x2f')]});}}function getEndUser(_0x193f2d,_0x2cb8c1,_0x53c27b,_0x1010be){logger[_0x5c41('0xe')](_0x5c41('0x33'),_0x53c27b);return request({'form':{'method':_0x5c41('0x34'),'input_type':'JSON','response_type':_0x5c41('0x21'),'rest_data':JSON[_0x5c41('0x22')]({'session':_0x1010be['id'],'module_name':_0x5c41('0x18'),'query':util['format']('contacts.phone_home\x20=\x20\x22%s\x22',_0x53c27b),'order_by':'','offset':'0','select_fields':['id',_0x5c41('0x10'),_0x5c41('0x35')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x5c41('0x36')](function(_0x138fc4){if(_0x138fc4[_0x5c41('0x2c')][_0x5c41('0x1b')]){var _0x181115=_[_0x5c41('0x37')](_0x138fc4[_0x5c41('0x2c')],function(_0x15fe05){return _0x15fe05[_0x5c41('0x2d')][_0x5c41('0x35')]['value']===_0x53c27b;});if(_0x181115){logger[_0x5c41('0xe')]('Enduser\x20found!');return BPromise['resolve']({'id':_0x181115[_0x5c41('0x2d')]['id']['value'],'name':_0x181115[_0x5c41('0x2d')][_0x5c41('0x10')][_0x5c41('0x2f')],'phone':_0x181115[_0x5c41('0x2d')][_0x5c41('0x35')][_0x5c41('0x2f')]});}}else{logger[_0x5c41('0xe')](_0x5c41('0x38'));return request({'form':{'method':_0x5c41('0x20'),'input_type':_0x5c41('0x21'),'response_type':_0x5c41('0x21'),'rest_data':JSON[_0x5c41('0x22')]({'session':_0x1010be['id'],'module_name':_0x5c41('0x18'),'name_value_list':[{'name':_0x5c41('0x39'),'value':_0x2cb8c1!==''?_0x2cb8c1:util[_0x5c41('0x29')]('Caller\x20-\x20%s',_0x53c27b)},{'name':'phone_home','value':_0x53c27b}]})}})[_0x5c41('0x36')](function(_0x583f21){logger[_0x5c41('0xe')]('Enduser\x20created.');return BPromise[_0x5c41('0x31')]({'id':_0x583f21['id'],'name':_0x583f21[_0x5c41('0x2c')]['first_name'][_0x5c41('0x2f')],'phone':_0x583f21[_0x5c41('0x2c')][_0x5c41('0x35')][_0x5c41('0x2f')]});});}});}function request(_0x2c352b){logger[_0x5c41('0x3a')](_0x5c41('0x3b'),JSON[_0x5c41('0x22')](_0x2c352b));return rp(_[_0x5c41('0x3c')](def,_0x2c352b));}function getTags(_0x382901,_0x22e845){var _0x28baae=[];if(_0x382901&&_0x382901[_0x5c41('0x1b')]>0x0){_0x28baae=_[_0x5c41('0x3d')](_0x382901,_0x22e845);}return _0x28baae;}function getCustomFields(_0x401aa3,_0x254f2a){var _0x328636=[];var _0x13f7d2={'custom_fields':[]};if(_0x401aa3[_0x5c41('0x1b')]>0x0){_['forEach'](_0x401aa3,function(_0x2f811e){if(_0x2f811e[_0x5c41('0x3e')]===_0x5c41('0x3f')&&_0x2f811e['nameField']&&!_0x2f811e[_0x5c41('0x40')]){_0x13f7d2[_0x2f811e[_0x5c41('0x41')]['toLowerCase']()]=_0x2f811e[_0x5c41('0x42')]['toString']();}else if(_0x2f811e[_0x5c41('0x3e')]==='string'&&_0x2f811e[_0x5c41('0x1f')]&&_0x2f811e['customField']){_0x13f7d2[_0x5c41('0x43')][_0x5c41('0x1e')]({'id':_0x2f811e['idField'],'value':_0x2f811e['content'][_0x5c41('0x25')]()});}else if(_0x2f811e[_0x5c41('0x3e')]===_0x5c41('0x44')&&_0x2f811e[_0x5c41('0x1d')]&&_0x2f811e['idField']&&_0x2f811e[_0x5c41('0x40')]){_0x254f2a[_0x2f811e[_0x5c41('0x1d')]]&&_0x13f7d2[_0x5c41('0x43')][_0x5c41('0x1e')]({'id':_0x2f811e[_0x5c41('0x1f')],'value':_0x254f2a[_0x2f811e[_0x5c41('0x1d')]][_0x5c41('0x25')]()});}else if(_0x2f811e[_0x5c41('0x3e')]===_0x5c41('0x45')&&_0x2f811e[_0x5c41('0x46')]&&_0x2f811e['Variable'][_0x5c41('0x10')]&&_0x2f811e[_0x5c41('0x1f')]&&_0x2f811e['customField']){_0x254f2a[_0x2f811e[_0x5c41('0x46')]['name'][_0x5c41('0x47')]()]&&_0x13f7d2[_0x5c41('0x43')]['push']({'id':_0x2f811e[_0x5c41('0x1f')],'value':_0x254f2a[_0x2f811e[_0x5c41('0x46')][_0x5c41('0x10')][_0x5c41('0x47')]()][_0x5c41('0x25')]()});}});}return _0x13f7d2;}function getConnection(_0x45bd0e){return request({'method':_0x5c41('0xc'),'form':{'method':_0x5c41('0x48'),'input_type':_0x5c41('0x21'),'response_type':'JSON','rest_data':JSON[_0x5c41('0x22')]({'user_auth':{'user_name':_0x45bd0e[_0x5c41('0x49')],'password':_0x45bd0e[_0x5c41('0x4a')],'encryption':_0x5c41('0x4b')},'application':_0x5c41('0x4c')})}})[_0x5c41('0x36')](function(_0x5aed92){var _0x43b598=_0x5aed92;if(_0x43b598['id']){def['sessionID']=_0x43b598['id'];return BPromise[_0x5c41('0x31')](_0x43b598);}else{throw new Error(util['format'](_0x5c41('0x4d'),_0x45bd0e['id']));}});}function setRelationship(_0x50b4a9,_0x4ff757,_0x4f451c,_0x21aad8){return request({'form':{'method':_0x5c41('0x4e'),'input_type':_0x5c41('0x21'),'response_type':'JSON','rest_data':JSON[_0x5c41('0x22')]({'session':_0x50b4a9['id'],'module_name':'Calls','module_id':_0x4f451c['id'],'link_field_name':_0x21aad8,'related_ids':[_0x4ff757['id']],'name_value_list':[],'delete':0x0})}});}exports[_0x5c41('0x4f')]=function(_0xd74bf7,_0x3f571b,_0x56c124,_0x5cf0bb,_0x5429f3,_0x56363b){var _0x115e54,_0x44726c,_0x2d123f,_0x256b4b;_0x56363b['remoteUri']=intUtil[_0x5c41('0x50')](_0x56363b[_0x5c41('0x51')]);_0x56363b[_0x5c41('0x52')]=intUtil[_0x5c41('0x50')](_0x56363b[_0x5c41('0x52')]);def[_0x5c41('0x53')]=util['format'](_0x5c41('0x54'),_0x56363b[_0x5c41('0x51')]);if(_0x5429f3&&_0x5429f3[_0x5c41('0x55')]){logger[_0x5c41('0xe')]('[QUEUE]',_0x5c41('0x56'));_0x3f571b[_0x5c41('0x57')]=util[_0x5c41('0x29')](_0x5c41('0x58'),_0x56363b[_0x5c41('0x52')],_0x3f571b[_0x5c41('0x59')],md5(_0x3f571b['uniqueid']));}else{_0x3f571b[_0x5c41('0x57')]='';}return getConnection(_0x56363b)[_0x5c41('0x36')](function(_0x2324e2){_0x256b4b=_0x2324e2;return getUser(_0x56363b,_0x5cf0bb[_0x5c41('0x10')],_0x256b4b);})[_0x5c41('0x36')](function(_0x47611c){_0x115e54=_0x47611c;logger['info'](_0x5c41('0x5a'),_0x115e54['id']);return getEndUser(_0x56363b,_0x3f571b[_0x5c41('0x5b')],_0x3f571b[_0x5c41('0x5c')],_0x256b4b);})[_0x5c41('0x36')](function(_0x55a6f0){_0x44726c=_0x55a6f0;logger['info'](_0x5c41('0x5d'),_0x44726c['id']);return getTicket(_0x56363b,_0x115e54,_0x44726c,_0x56c124,_0x3f571b,_0x56c124[_0x5c41('0x5e')],_0x256b4b,_0x5c41('0x5f'));})[_0x5c41('0x36')](function(_0x51b099){_0x2d123f=_0x51b099;logger[_0x5c41('0xe')](_0x5c41('0x60'));logger['info'](_0x5c41('0x61'),_0x2d123f['id']);return setRelationship(_0x256b4b,_0x115e54,_0x2d123f,_0x5c41('0x62'));})[_0x5c41('0x36')](function(){return setRelationship(_0x256b4b,_0x44726c,_0x2d123f,_0x5c41('0x63'));})[_0x5c41('0x36')](function(){return getServerInfo(_0x256b4b);})[_0x5c41('0x36')](function(_0x55ed28){var _0x4b2446=parseInt(_0x55ed28['version'][_0x5c41('0x64')](0x0));var _0x382df9=util['format'](_0x5c41('0x65'),_0x56363b[_0x5c41('0x51')],_0x2d123f['id']);if(_0x4b2446>0x6){_0x382df9=util['format'](_0x5c41('0x66'),_0x56363b[_0x5c41('0x51')],_0x2d123f['id']);}logger[_0x5c41('0xe')](_0x5c41('0x67'),_0x5c41('0x68'));emit(util['format'](_0x5c41('0x69'),_0x5cf0bb['name']),'trigger:browser:url',{'uri':_0x382df9});})[_0x5c41('0x6a')](function(_0x2996cc){logger[_0x5c41('0x6b')](_0x5c41('0x67'),JSON[_0x5c41('0x22')](_0x2996cc));});};exports[_0x5c41('0x6c')]=function(_0x51685f,_0x344799,_0x316120,_0x2a6e00,_0x588e85,_0x3bed8d,_0x4cb92d){var _0x521972,_0x1874dc,_0x2b57b3,_0x4ea46a;_0x3bed8d['remoteUri']=intUtil[_0x5c41('0x50')](_0x3bed8d[_0x5c41('0x51')]);_0x3bed8d[_0x5c41('0x52')]=intUtil[_0x5c41('0x50')](_0x3bed8d[_0x5c41('0x52')]);def[_0x5c41('0x53')]=util[_0x5c41('0x29')](_0x5c41('0x54'),_0x3bed8d[_0x5c41('0x51')]);if(_0x4cb92d&&_0x4cb92d[_0x5c41('0x6d')]&&_0x4cb92d[_0x5c41('0x6d')]!==_0x5c41('0x6e')){logger['info'](_0x5c41('0x6f'),_0x5c41('0x56'));_0x344799['recordingURL']=util[_0x5c41('0x29')](_0x5c41('0x58'),_0x3bed8d[_0x5c41('0x52')],_0x344799[_0x5c41('0x59')],md5(_0x344799[_0x5c41('0x59')]));}return getConnection(_0x3bed8d)[_0x5c41('0x36')](function(_0x3b35bc){_0x4ea46a=_0x3b35bc;return getUser(_0x3bed8d,_0x2a6e00[_0x5c41('0x10')],_0x4ea46a);})['then'](function(_0x467038){_0x521972=_0x467038;logger['info'](_0x5c41('0x5a'),_0x521972['id']);return getEndUser(_0x3bed8d,_0x344799[_0x5c41('0x70')],_0x344799[_0x5c41('0x71')],_0x4ea46a);})[_0x5c41('0x36')](function(_0x2cd377){_0x1874dc=_0x2cd377;logger['info'](_0x5c41('0x5d'),_0x1874dc['id']);return getTicket(_0x3bed8d,_0x521972,_0x1874dc,_0x316120,_0x344799,_0x316120['Fields'],_0x4ea46a,'Outbound');})['then'](function(_0x103c42){_0x2b57b3=_0x103c42;logger['info'](_0x5c41('0x60'));logger['info'](_0x5c41('0x61'),_0x2b57b3['id']);return setRelationship(_0x4ea46a,_0x521972,_0x2b57b3,_0x5c41('0x62'));})[_0x5c41('0x36')](function(){return setRelationship(_0x4ea46a,_0x1874dc,_0x2b57b3,_0x5c41('0x63'));})[_0x5c41('0x36')](function(){return getServerInfo(_0x4ea46a);})[_0x5c41('0x36')](function(_0x45ab77){var _0x3392e9=parseInt(_0x45ab77[_0x5c41('0x72')][_0x5c41('0x64')](0x0));var _0x50fb8f=util[_0x5c41('0x29')](_0x5c41('0x65'),_0x3bed8d['remoteUri'],_0x2b57b3['id']);if(_0x3392e9>0x6){_0x50fb8f=util[_0x5c41('0x29')](_0x5c41('0x66'),_0x3bed8d[_0x5c41('0x51')],_0x2b57b3['id']);}logger[_0x5c41('0xe')](_0x5c41('0x6f'),_0x5c41('0x68'));emit(util['format'](_0x5c41('0x69'),_0x2a6e00['name']),'trigger:browser:url',{'uri':_0x50fb8f});})[_0x5c41('0x6a')](function(_0x144427){logger[_0x5c41('0x6b')](_0x5c41('0x6f'),JSON[_0x5c41('0x22')](_0x144427));});};exports['unmanaged']=function(_0x24b05d,_0x4ee3db,_0x46c734,_0x556fd2,_0x582999,_0x10902f){var _0x503f70,_0x5d55d5,_0x28ced1,_0x51288c;_0x10902f[_0x5c41('0x51')]=intUtil['stripTrailingSlash'](_0x10902f[_0x5c41('0x51')]);_0x10902f[_0x5c41('0x52')]=intUtil[_0x5c41('0x50')](_0x10902f[_0x5c41('0x52')]);def['uri']=util[_0x5c41('0x29')]('%s/service/v4_1/rest.php',_0x10902f[_0x5c41('0x51')]);if(_0x582999&&_0x582999[_0x5c41('0x55')]){logger[_0x5c41('0xe')]('['+_0x4ee3db[_0x5c41('0x73')][_0x5c41('0x74')]()+']','Recording\x20is\x20enabled!');_0x4ee3db[_0x5c41('0x57')]=util[_0x5c41('0x29')](_0x5c41('0x58'),_0x10902f[_0x5c41('0x52')],_0x4ee3db[_0x5c41('0x59')],md5(_0x4ee3db[_0x5c41('0x59')]));}else{_0x4ee3db[_0x5c41('0x57')]='';}return getConnection(_0x10902f)['then'](function(_0xabc5c3){_0x51288c=_0xabc5c3;if(!_[_0x5c41('0x75')](_0x556fd2)){return getUser(_0x10902f,_0x556fd2[_0x5c41('0x10')],_0x51288c);}else{return getUser(_0x10902f,null,_0x51288c);}})[_0x5c41('0x36')](function(_0x5b7f61){_0x503f70=_0x5b7f61;logger[_0x5c41('0xe')](_0x5c41('0x5a'),_0x503f70['id']);return getEndUser(_0x10902f,_0x4ee3db[_0x5c41('0x5b')],_0x4ee3db['calleridnum'],_0x51288c);})[_0x5c41('0x36')](function(_0xe528fc){_0x5d55d5=_0xe528fc;logger[_0x5c41('0xe')]('The\x20Enduser\x20ID\x20is:',_0x5d55d5['id']);return getTicket(_0x10902f,_0x503f70,_0x5d55d5,_0x46c734,_0x4ee3db,_0x46c734['Fields'],_0x51288c,'Inbound');})[_0x5c41('0x36')](function(_0x5c5c10){_0x28ced1=_0x5c5c10;logger[_0x5c41('0xe')](_0x5c41('0x60'));logger[_0x5c41('0xe')](_0x5c41('0x61'),_0x28ced1['id']);return setRelationship(_0x51288c,_0x503f70,_0x28ced1,_0x5c41('0x62'));})['then'](function(){return setRelationship(_0x51288c,_0x5d55d5,_0x28ced1,_0x5c41('0x63'));})[_0x5c41('0x36')](function(){return getServerInfo(_0x51288c);})['catch'](function(_0x336a8f){logger[_0x5c41('0x6b')]('['+_0x4ee3db[_0x5c41('0x73')][_0x5c41('0x74')]()+']',JSON['stringify'](_0x336a8f));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/util.js b/server/services/ami/trigger/integration/util.js index 4745c31..5dcaf31 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 _0x4fe7=['key','stripTrailingSlash','slice','lastIndexOf','validateEmail','isNil','test','lodash','util','getString','length','type','push','content','variableName','toString','customVariable','Variable','name','toLowerCase','keyType','string','format','%s:\x20%s','keyContent','variable'];(function(_0xf44d98,_0x12a472){var _0x5ebb04=function(_0x930c33){while(--_0x930c33){_0xf44d98['push'](_0xf44d98['shift']());}};_0x5ebb04(++_0x12a472);}(_0x4fe7,0x13f));var _0x74fe=function(_0x30dbf1,_0x3601d0){_0x30dbf1=_0x30dbf1-0x0;var _0x285b90=_0x4fe7[_0x30dbf1];return _0x285b90;};'use strict';var _=require(_0x74fe('0x0'));var util=require(_0x74fe('0x1'));exports[_0x74fe('0x2')]=function(_0x4a710e,_0x4b0d4b,_0x365354){var _0x300748=[];if(_0x4a710e[_0x74fe('0x3')]>0x0){var _0x33ec87=_['sortBy'](_0x4a710e,['id']);for(var _0x1a8887=0x0;_0x1a8887<_0x33ec87[_0x74fe('0x3')];_0x1a8887++){var _0x417643=_0x33ec87[_0x1a8887];if(_0x417643[_0x74fe('0x4')]==='string'){_0x300748[_0x74fe('0x5')](_0x417643[_0x74fe('0x6')]);}else if(_0x417643['type']==='variable'&&_0x417643[_0x74fe('0x7')]){_0x4b0d4b[_0x417643['variableName']]&&_0x300748[_0x74fe('0x5')](_0x4b0d4b[_0x417643[_0x74fe('0x7')]][_0x74fe('0x8')]());}else if(_0x417643[_0x74fe('0x4')]===_0x74fe('0x9')&&_0x417643[_0x74fe('0xa')]&&_0x417643[_0x74fe('0xa')]['name']){_0x4b0d4b[_0x417643[_0x74fe('0xa')][_0x74fe('0xb')][_0x74fe('0xc')]()]&&_0x300748[_0x74fe('0x5')](_0x4b0d4b[_0x417643[_0x74fe('0xa')][_0x74fe('0xb')][_0x74fe('0xc')]()][_0x74fe('0x8')]());}else if(_0x417643[_0x74fe('0x4')]==='keyValue'){if(_0x417643[_0x74fe('0xd')]===_0x74fe('0xe')&&_0x417643['key']){_0x300748[_0x74fe('0x5')](util[_0x74fe('0xf')](_0x74fe('0x10'),_0x417643['key'],_0x417643[_0x74fe('0x11')]));}else if(_0x417643[_0x74fe('0xd')]===_0x74fe('0x12')&&_0x417643['variableName']&&_0x417643[_0x74fe('0x13')]){_0x4b0d4b[_0x417643[_0x74fe('0x7')]]&&_0x300748[_0x74fe('0x5')](util[_0x74fe('0xf')](_0x74fe('0x10'),_0x417643['key'],_0x4b0d4b[_0x417643['variableName']]));}else if(_0x417643['keyType']==='customVariable'&&_0x417643[_0x74fe('0xa')]&&_0x417643[_0x74fe('0xa')][_0x74fe('0xb')]&&_0x417643['key']){_0x4b0d4b[_0x417643[_0x74fe('0xa')][_0x74fe('0xb')][_0x74fe('0xc')]()]&&_0x300748[_0x74fe('0x5')](util[_0x74fe('0xf')](_0x74fe('0x10'),_0x417643['key'],_0x4b0d4b[_0x417643[_0x74fe('0xa')][_0x74fe('0xb')][_0x74fe('0xc')]()]));}}}}return _0x300748['join'](_0x365354);};exports[_0x74fe('0x14')]=function(_0x26c398){var _0x706edf=_0x26c398[_0x74fe('0x15')](-0x1);if(_0x706edf==='/'){_0x26c398=_0x26c398['substring'](0x0,_0x26c398[_0x74fe('0x16')](_0x706edf));}return _0x26c398;};exports[_0x74fe('0x17')]=function(_0x4a138c){if(!_[_0x74fe('0x18')](_0x4a138c)&&_0x4a138c!==''){var _0x2b44dd=/^(([^<>()\[\]\\.,;:\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 _0x2b44dd[_0x74fe('0x19')](String(_0x4a138c)[_0x74fe('0xc')]());}else{return![];}}; \ No newline at end of file +var _0x7ab4=['join','stripTrailingSlash','substring','lastIndexOf','validateEmail','isNil','test','util','getString','type','string','push','content','variable','variableName','toString','customVariable','Variable','toLowerCase','keyType','key','format','%s:\x20%s','name'];(function(_0x216e58,_0x497adc){var _0x5adcad=function(_0x22197f){while(--_0x22197f){_0x216e58['push'](_0x216e58['shift']());}};_0x5adcad(++_0x497adc);}(_0x7ab4,0x1b7));var _0x47ab=function(_0x1b6ae1,_0x7265ae){_0x1b6ae1=_0x1b6ae1-0x0;var _0x5843a2=_0x7ab4[_0x1b6ae1];return _0x5843a2;};'use strict';var _=require('lodash');var util=require(_0x47ab('0x0'));exports[_0x47ab('0x1')]=function(_0x42e4c4,_0x29401b,_0xa498a8){var _0x260c84=[];if(_0x42e4c4['length']>0x0){var _0x56c5e6=_['sortBy'](_0x42e4c4,['id']);for(var _0x471d54=0x0;_0x471d54<_0x56c5e6['length'];_0x471d54++){var _0x17f3d3=_0x56c5e6[_0x471d54];if(_0x17f3d3[_0x47ab('0x2')]===_0x47ab('0x3')){_0x260c84[_0x47ab('0x4')](_0x17f3d3[_0x47ab('0x5')]);}else if(_0x17f3d3[_0x47ab('0x2')]===_0x47ab('0x6')&&_0x17f3d3[_0x47ab('0x7')]){_0x29401b[_0x17f3d3[_0x47ab('0x7')]]&&_0x260c84[_0x47ab('0x4')](_0x29401b[_0x17f3d3[_0x47ab('0x7')]][_0x47ab('0x8')]());}else if(_0x17f3d3[_0x47ab('0x2')]===_0x47ab('0x9')&&_0x17f3d3[_0x47ab('0xa')]&&_0x17f3d3[_0x47ab('0xa')]['name']){_0x29401b[_0x17f3d3[_0x47ab('0xa')]['name'][_0x47ab('0xb')]()]&&_0x260c84[_0x47ab('0x4')](_0x29401b[_0x17f3d3['Variable']['name'][_0x47ab('0xb')]()][_0x47ab('0x8')]());}else if(_0x17f3d3[_0x47ab('0x2')]==='keyValue'){if(_0x17f3d3[_0x47ab('0xc')]===_0x47ab('0x3')&&_0x17f3d3[_0x47ab('0xd')]){_0x260c84[_0x47ab('0x4')](util[_0x47ab('0xe')](_0x47ab('0xf'),_0x17f3d3['key'],_0x17f3d3['keyContent']));}else if(_0x17f3d3[_0x47ab('0xc')]==='variable'&&_0x17f3d3[_0x47ab('0x7')]&&_0x17f3d3[_0x47ab('0xd')]){_0x29401b[_0x17f3d3[_0x47ab('0x7')]]&&_0x260c84[_0x47ab('0x4')](util['format'](_0x47ab('0xf'),_0x17f3d3[_0x47ab('0xd')],_0x29401b[_0x17f3d3[_0x47ab('0x7')]]));}else if(_0x17f3d3['keyType']==='customVariable'&&_0x17f3d3['Variable']&&_0x17f3d3[_0x47ab('0xa')]['name']&&_0x17f3d3['key']){_0x29401b[_0x17f3d3[_0x47ab('0xa')][_0x47ab('0x10')][_0x47ab('0xb')]()]&&_0x260c84[_0x47ab('0x4')](util[_0x47ab('0xe')](_0x47ab('0xf'),_0x17f3d3[_0x47ab('0xd')],_0x29401b[_0x17f3d3[_0x47ab('0xa')][_0x47ab('0x10')][_0x47ab('0xb')]()]));}}}}return _0x260c84[_0x47ab('0x11')](_0xa498a8);};exports[_0x47ab('0x12')]=function(_0x16b7d6){var _0x38ecfa=_0x16b7d6['slice'](-0x1);if(_0x38ecfa==='/'){_0x16b7d6=_0x16b7d6[_0x47ab('0x13')](0x0,_0x16b7d6[_0x47ab('0x14')](_0x38ecfa));}return _0x16b7d6;};exports[_0x47ab('0x15')]=function(_0xe1f3f3){if(!_[_0x47ab('0x16')](_0xe1f3f3)&&_0xe1f3f3!==''){var _0x3dad8f=/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;return _0x3dad8f[_0x47ab('0x17')](String(_0xe1f3f3)[_0x47ab('0xb')]());}else{return![];}}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/vtiger.js b/server/services/ami/trigger/integration/vtiger.js index 9eb7fa5..bb88055 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 _0xe706=['result','Agent\x20found!','email1','first_name','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','admin','getUser','username','Searching\x20end\x20user\x20with\x20phone','remoteUri','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Contacts','phone','catch','accessKey','getchallenge','token','Account\x20%d\x20is\x20not\x20valid','getConnection','queue','stripTrailingSlash','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Ticket\x20created!','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','split','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','outbound','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','The\x20Ticket\x20ID\x20is:','user:%s','unmanaged','lastevent','toUpperCase','lodash','request-promise','bluebird','util','ioredis','./util','../../../../config/environment','../../../../config/logger','vTiger','redis','defaults','localhost','socket.io-emitter','emit','length','forEach','includes','string','idField','content','toString','type','variable','variableName','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','merge','Normal','Open','Subjects','getString','Descriptions','POST','format','%s/webservice.php','create','stringify','then','success','resolve','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','statusCode','error','[vTiger],\x20%s,\x20%s,\x20%s','validateEmail','Getting\x20agent\x20with\x20email','GET','query','sessionName','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;'];(function(_0x47c329,_0x31dcda){var _0x3a4356=function(_0x16884d){while(--_0x16884d){_0x47c329['push'](_0x47c329['shift']());}};_0x3a4356(++_0x31dcda);}(_0xe706,0xa3));var _0x6e70=function(_0x96f54d,_0x5e5d21){_0x96f54d=_0x96f54d-0x0;var _0xdb885c=_0xe706[_0x96f54d];return _0xdb885c;};'use strict';var _=require(_0x6e70('0x0'));var rp=require(_0x6e70('0x1'));var BPromise=require(_0x6e70('0x2'));var md5=require('md5');var util=require(_0x6e70('0x3'));var Redis=require(_0x6e70('0x4'));var intUtil=require(_0x6e70('0x5'));var config=require(_0x6e70('0x6'));var logger=require(_0x6e70('0x7'))(_0x6e70('0x8'));config[_0x6e70('0x9')]=_[_0x6e70('0xa')](config[_0x6e70('0x9')],{'host':_0x6e70('0xb'),'port':0x18eb});var io=require(_0x6e70('0xc'))(new Redis(config[_0x6e70('0x9')]));function emit(_0x45a2d4,_0x188ed3,_0x3c4843){io['to'](_0x45a2d4)[_0x6e70('0xd')](_0x188ed3,_0x3c4843);}function getCustomFields(_0x954545,_0x25e61c){var _0x100eb7={};if(_0x954545[_0x6e70('0xe')]>0x0){_[_0x6e70('0xf')](_0x954545,function(_0x3f474a){if(_[_0x6e70('0x10')]([_0x6e70('0x11'),'picklist'],_0x3f474a['type'])&&_0x3f474a[_0x6e70('0x12')]){_0x100eb7[_0x3f474a[_0x6e70('0x12')]]=_0x3f474a[_0x6e70('0x13')][_0x6e70('0x14')]();}else if(_0x3f474a[_0x6e70('0x15')]===_0x6e70('0x16')&&_0x3f474a[_0x6e70('0x17')]&&_0x3f474a[_0x6e70('0x12')]&&_0x25e61c[_0x3f474a['variableName']]){_0x100eb7[_0x3f474a['idField']]=_0x25e61c[_0x3f474a['variableName']][_0x6e70('0x14')]();}else if(_0x3f474a['type']==='customVariable'&&_0x3f474a[_0x6e70('0x18')]&&_0x3f474a[_0x6e70('0x18')]['name']&&_0x3f474a[_0x6e70('0x12')]&&_0x25e61c[_0x3f474a['Variable'][_0x6e70('0x19')][_0x6e70('0x1a')]()]){_0x100eb7[_0x3f474a['idField']]=_0x25e61c[_0x3f474a['Variable'][_0x6e70('0x19')]['toLowerCase']()][_0x6e70('0x14')]();}});}return _0x100eb7;}function createTicket(_0x173afe,_0x53acdc,_0x497d61,_0xc238ba,_0x208e21,_0x2368eb,_0x3a9978){logger[_0x6e70('0x1b')](_0x6e70('0x1c'));var _0x1b2453=_[_0x6e70('0x1d')]({'parent_id':'','assigned_user_id':_0x53acdc['id'],'ticketpriorities':_0x6e70('0x1e'),'ticketstatus':_0x6e70('0x1f'),'ticket_title':intUtil['getString'](_0xc238ba[_0x6e70('0x20')],_0x208e21,'\x20'),'description':intUtil[_0x6e70('0x21')](_0xc238ba[_0x6e70('0x22')],_0x208e21,'\x0a'),'contact_id':_0x497d61['id']},getCustomFields(_0x2368eb,_0x208e21));var _0x502b2d={'method':_0x6e70('0x23'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x173afe['remoteUri']),'form':{'operation':_0x6e70('0x26'),'username':_0x173afe['username'],'sessionName':_0x3a9978['sessionName'],'elementType':'HelpDesk','element':JSON[_0x6e70('0x27')](_0x1b2453)},'json':!![]};return request(_0x502b2d)[_0x6e70('0x28')](function(_0x51d292){if(_0x51d292[_0x6e70('0x29')]){return BPromise[_0x6e70('0x2a')]({'id':_0x51d292['result']['id']});}else{throw new Error(util[_0x6e70('0x24')](_0x6e70('0x2b'),JSON[_0x6e70('0x27')](_0x51d292['error'])));}})['catch'](function(_0x2c4d37){var _0x3af17f=_0x2c4d37[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),'createTicket',_0x3af17f,JSON[_0x6e70('0x27')](_0x2c4d37));});}function getUser(_0x406f29,_0xecf336,_0x2864a0){if(intUtil[_0x6e70('0x2f')](_0xecf336)){logger[_0x6e70('0x1b')](_0x6e70('0x30'),_0xecf336);return request({'method':_0x6e70('0x31'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x406f29['remoteUri']),'qs':{'operation':_0x6e70('0x32'),'username':_0x406f29['username'],'sessionName':_0x2864a0[_0x6e70('0x33')],'query':util['format'](_0x6e70('0x34'),_0xecf336)},'json':!![]})[_0x6e70('0x28')](function(_0x30fa0b){if(_0x30fa0b['success']&&_0x30fa0b[_0x6e70('0x35')][_0x6e70('0xe')]){logger['info'](_0x6e70('0x36'));return BPromise[_0x6e70('0x2a')]({'id':_0x30fa0b['result'][0x0]['id'],'email':_0x30fa0b[_0x6e70('0x35')][0x0][_0x6e70('0x37')],'name':_0x30fa0b[_0x6e70('0x35')][0x0][_0x6e70('0x38')]+'\x20'+_0x30fa0b[_0x6e70('0x35')][_0x6e70('0x39')]});}else{logger[_0x6e70('0x1b')](_0x6e70('0x3a'));return BPromise[_0x6e70('0x2a')]({'id':_0x2864a0[_0x6e70('0x3b')],'email':_0x406f29['username'],'name':_0x6e70('0x3c')});}})['catch'](function(_0x23cd1a){var _0x3222a2=_0x23cd1a[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),_0x6e70('0x3d'),_0x3222a2,JSON[_0x6e70('0x27')](_0x23cd1a));});}else{logger[_0x6e70('0x1b')](_0x6e70('0x3a'));return BPromise[_0x6e70('0x2a')]({'id':_0x2864a0[_0x6e70('0x3b')],'email':_0x406f29[_0x6e70('0x3e')],'name':_0x6e70('0x3c')})['catch'](function(_0x5446a2){var _0x5424eb=_0x5446a2[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),_0x6e70('0x3d'),_0x5424eb,JSON[_0x6e70('0x27')](_0x5446a2));});}}function getEndUser(_0x3bdd87,_0x572a71,_0x3b508c,_0x9e7ad2){logger[_0x6e70('0x1b')](_0x6e70('0x3f'),_0x3b508c);return request({'method':_0x6e70('0x31'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x3bdd87[_0x6e70('0x40')]),'qs':{'operation':'query','username':_0x3bdd87[_0x6e70('0x3e')],'sessionName':_0x9e7ad2[_0x6e70('0x33')],'query':util[_0x6e70('0x24')](_0x6e70('0x41'),_0x3b508c,_0x3b508c,_0x3b508c,_0x3b508c,_0x3b508c)},'json':!![]})[_0x6e70('0x28')](function(_0x1de947){if(_0x1de947[_0x6e70('0x29')]&&_0x1de947['result']['length']){logger['info'](_0x6e70('0x42'));return BPromise[_0x6e70('0x2a')]({'id':_0x1de947[_0x6e70('0x35')][0x0]['id'],'name':_0x1de947[_0x6e70('0x35')][0x0][_0x6e70('0x43')]+'\x20'+_0x1de947['result'][0x0][_0x6e70('0x44')],'phone':_0x3b508c});}else{logger[_0x6e70('0x1b')](_0x6e70('0x45'));return request({'method':'POST','uri':util['format']('%s/webservice.php',_0x3bdd87[_0x6e70('0x40')]),'form':{'operation':'create','sessionName':_0x9e7ad2[_0x6e70('0x33')],'elementType':_0x6e70('0x46'),'element':JSON[_0x6e70('0x27')]({'lastname':_0x572a71,'phone':_0x3b508c,'assigned_user_id':'\x20'})},'json':!![]})[_0x6e70('0x28')](function(_0x59c87d){logger[_0x6e70('0x1b')]('Enduser\x20created.');return BPromise[_0x6e70('0x2a')]({'id':_0x59c87d[_0x6e70('0x35')]['id'],'name':_0x59c87d[_0x6e70('0x35')][_0x6e70('0x44')],'phone':_0x59c87d['result'][_0x6e70('0x47')]});})[_0x6e70('0x48')](function(_0x3d39c3){var _0xac87d6=_0x3d39c3[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),'getEndUser',_0xac87d6,JSON[_0x6e70('0x27')](_0x3d39c3));});}});}function getConnection(_0x3884a4){var _0x10de2a=_0x3884a4[_0x6e70('0x3e')];var _0x3f86cf=_0x3884a4[_0x6e70('0x49')];return request({'method':_0x6e70('0x31'),'uri':util['format'](_0x6e70('0x25'),_0x3884a4['remoteUri']),'qs':{'operation':_0x6e70('0x4a'),'username':_0x10de2a},'json':!![]})[_0x6e70('0x28')](function(_0x4b351e){if(_0x4b351e['success']){return request({'method':_0x6e70('0x23'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x3884a4['remoteUri']),'form':{'operation':'login','username':_0x10de2a,'accessKey':md5(_0x4b351e[_0x6e70('0x35')][_0x6e70('0x4b')]+_0x3f86cf)},'json':!![]});}})[_0x6e70('0x28')](function(_0x79653){if(_0x79653[_0x6e70('0x29')]){return BPromise[_0x6e70('0x2a')](_0x79653['result']);}else{throw new Error(util[_0x6e70('0x24')](_0x6e70('0x4c'),_0x3884a4['id']));}})[_0x6e70('0x48')](function(_0x6ed023){var _0x2c3a7d=_0x6ed023['statusCode']||0x1f4;logger['error'](_0x6e70('0x2e'),_0x6e70('0x4d'),_0x2c3a7d,JSON[_0x6e70('0x27')](_0x6ed023));});}function request(_0x15f994){logger[_0x6e70('0x1b')]('[HTTP]',JSON[_0x6e70('0x27')](_0x15f994));return rp(_0x15f994);}exports[_0x6e70('0x4e')]=function(_0x1fa320,_0x23ebfb,_0x3aba34,_0x4a111a,_0x1142cd,_0x1dd242){var _0x2c20d3,_0x3fb0d3,_0x8ef4f7,_0x3fd03d;_0x1dd242['remoteUri']=intUtil[_0x6e70('0x4f')](_0x1dd242[_0x6e70('0x40')]);if(_0x1142cd&&_0x1142cd['monitor_format']){logger[_0x6e70('0x1b')](_0x6e70('0x50'),'Recording\x20is\x20enabled!');_0x23ebfb[_0x6e70('0x51')]=util[_0x6e70('0x24')](_0x6e70('0x52'),_0x1dd242[_0x6e70('0x53')],_0x23ebfb[_0x6e70('0x54')],md5(_0x23ebfb['uniqueid']));}else{_0x23ebfb[_0x6e70('0x51')]='';}return getConnection(_0x1dd242)[_0x6e70('0x28')](function(_0x10d655){_0x3fd03d=_0x10d655;return getUser(_0x1dd242,_0x4a111a[_0x6e70('0x55')],_0x3fd03d);})[_0x6e70('0x28')](function(_0x1fe13a){_0x2c20d3=_0x1fe13a;logger[_0x6e70('0x1b')](_0x6e70('0x56'),_0x2c20d3['id']);return getEndUser(_0x1dd242,_0x23ebfb[_0x6e70('0x57')],_0x23ebfb[_0x6e70('0x58')],_0x3fd03d);})[_0x6e70('0x28')](function(_0x1b12a1){_0x3fb0d3=_0x1b12a1;logger[_0x6e70('0x1b')](_0x6e70('0x59'),_0x3fb0d3['id']);return createTicket(_0x1dd242,_0x2c20d3,_0x3fb0d3,_0x3aba34,_0x23ebfb,_0x3aba34[_0x6e70('0x5a')],_0x3fd03d);})[_0x6e70('0x28')](function(_0x324fa6){_0x8ef4f7=_0x324fa6;logger[_0x6e70('0x1b')](_0x6e70('0x5b'));logger[_0x6e70('0x1b')]('The\x20Ticket\x20ID\x20is:',_0x8ef4f7['id']);var _0x28898a=util[_0x6e70('0x24')](_0x6e70('0x5c'),_0x1dd242[_0x6e70('0x40')],_[_0x6e70('0x5d')](_0x8ef4f7['id'],'x')[0x1]);logger[_0x6e70('0x1b')]('[QUEUE]',_0x6e70('0x5e'));emit(util[_0x6e70('0x24')]('user:%s',_0x4a111a[_0x6e70('0x19')]),_0x6e70('0x5f'),{'uri':_0x28898a});})[_0x6e70('0x48')](function(_0x590f7f){logger['error'](_0x6e70('0x50'),JSON[_0x6e70('0x27')](_0x590f7f));});};exports[_0x6e70('0x60')]=function(_0x41a861,_0x10d299,_0x739946,_0x30cd88,_0x57bfe5,_0x4d47e1,_0x2c8dc6){var _0x1e23c5,_0x2bf9ec,_0x2ad395,_0x5b1e6f;_0x4d47e1['remoteUri']=intUtil[_0x6e70('0x4f')](_0x4d47e1[_0x6e70('0x40')]);_0x4d47e1['serverUrl']=intUtil['stripTrailingSlash'](_0x4d47e1[_0x6e70('0x53')]);if(_0x2c8dc6&&_0x2c8dc6['recordingFormat']&&_0x2c8dc6[_0x6e70('0x61')]!==_0x6e70('0x62')){logger[_0x6e70('0x1b')](_0x6e70('0x63'),_0x6e70('0x64'));_0x10d299[_0x6e70('0x51')]=util[_0x6e70('0x24')](_0x6e70('0x52'),_0x4d47e1['serverUrl'],_0x10d299[_0x6e70('0x54')],md5(_0x10d299[_0x6e70('0x54')]));}return getConnection(_0x4d47e1)[_0x6e70('0x28')](function(_0x346c79){_0x5b1e6f=_0x346c79;return getUser(_0x4d47e1,_0x30cd88[_0x6e70('0x55')],_0x5b1e6f);})['then'](function(_0x5f5b02){_0x1e23c5=_0x5f5b02;logger['info'](_0x6e70('0x56'),_0x1e23c5['id']);return getEndUser(_0x4d47e1,_0x10d299[_0x6e70('0x65')],_0x10d299[_0x6e70('0x66')],_0x5b1e6f);})['then'](function(_0x58cf1c){_0x2bf9ec=_0x58cf1c;logger[_0x6e70('0x1b')](_0x6e70('0x59'),_0x2bf9ec['id']);return createTicket(_0x4d47e1,_0x1e23c5,_0x2bf9ec,_0x739946,_0x10d299,_0x739946[_0x6e70('0x5a')],_0x5b1e6f);})[_0x6e70('0x28')](function(_0x2285f1){_0x2ad395=_0x2285f1;logger[_0x6e70('0x1b')]('Ticket\x20created!');logger[_0x6e70('0x1b')](_0x6e70('0x67'),_0x2ad395['id']);var _0x30d11b=util[_0x6e70('0x24')]('%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT',_0x4d47e1[_0x6e70('0x40')],_['split'](_0x2ad395['id'],'x')[0x1]);logger['info'](_0x6e70('0x63'),_0x6e70('0x5e'));emit(util[_0x6e70('0x24')](_0x6e70('0x68'),_0x30cd88[_0x6e70('0x19')]),_0x6e70('0x5f'),{'uri':_0x30d11b});})['catch'](function(_0x370eeb){logger[_0x6e70('0x2d')](_0x6e70('0x63'),JSON[_0x6e70('0x27')](_0x370eeb));});};exports[_0x6e70('0x69')]=function(_0x13c092,_0x363722,_0xd9b4a9,_0x2f1362,_0x29621a,_0x575938){var _0x44c877,_0x303c5a,_0x577c3b,_0x5d398a;_0x575938['remoteUri']=intUtil[_0x6e70('0x4f')](_0x575938[_0x6e70('0x40')]);_0x575938[_0x6e70('0x53')]=intUtil[_0x6e70('0x4f')](_0x575938[_0x6e70('0x53')]);if(_0x29621a&&_0x29621a['monitor_format']){logger['info']('['+_0x363722[_0x6e70('0x6a')][_0x6e70('0x6b')]()+']','Recording\x20is\x20enabled!');_0x363722[_0x6e70('0x51')]=util[_0x6e70('0x24')](_0x6e70('0x52'),_0x575938[_0x6e70('0x53')],_0x363722[_0x6e70('0x54')],md5(_0x363722[_0x6e70('0x54')]));}else{_0x363722[_0x6e70('0x51')]='';}return getConnection(_0x575938)[_0x6e70('0x28')](function(_0x3650e9){_0x5d398a=_0x3650e9;return getUser(_0x575938,'',_0x5d398a);})[_0x6e70('0x28')](function(_0x347cc4){_0x44c877=_0x347cc4;logger[_0x6e70('0x1b')](_0x6e70('0x56'),_0x44c877['id']);return getEndUser(_0x575938,_0x363722[_0x6e70('0x57')],_0x363722['calleridnum'],_0x5d398a);})['then'](function(_0x39ed95){_0x303c5a=_0x39ed95;logger['info'](_0x6e70('0x59'),_0x303c5a['id']);return createTicket(_0x575938,_0x44c877,_0x303c5a,_0xd9b4a9,_0x363722,_0xd9b4a9['Fields'],_0x5d398a);})['then'](function(_0x402f6f){_0x577c3b=_0x402f6f;logger['info']('Ticket\x20created!');logger[_0x6e70('0x1b')](_0x6e70('0x67'),_0x577c3b['id']);})[_0x6e70('0x48')](function(_0x4e9fda){logger['error']('['+_0x363722['lastevent'][_0x6e70('0x6b')]()+']',JSON['stringify'](_0x4e9fda));});}; \ No newline at end of file +var _0xd8b0=['info','Creating\x20new\x20ticket...','merge','Normal','Subjects','POST','format','%s/webservice.php','remoteUri','create','username','sessionName','HelpDesk','stringify','success','result','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','error','statusCode','[vTiger],\x20%s,\x20%s,\x20%s','validateEmail','Getting\x20agent\x20with\x20email','then','Agent\x20found!','resolve','email1','first_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','admin','catch','userId','getUser','Searching\x20end\x20user\x20with\x20phone','GET','query','Enduser\x20found!','firstname','Enduser\x20created.','lastname','phone','accessKey','getchallenge','login','token','getConnection','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','recordingURL','email','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Ticket\x20created!','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','split','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','outbound','recordingFormat','none','[OUTBOUND]','uniqueid','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','The\x20Ticket\x20ID\x20is:','user:%s','lastevent','toUpperCase','lodash','request-promise','ioredis','./util','../../../../config/environment','../../../../config/logger','vTiger','redis','localhost','socket.io-emitter','emit','length','forEach','includes','picklist','idField','content','toString','type','variable','variableName','customVariable','Variable','name','toLowerCase'];(function(_0x1a1b6e,_0x3a07a9){var _0x571e2c=function(_0x6cea62){while(--_0x6cea62){_0x1a1b6e['push'](_0x1a1b6e['shift']());}};_0x571e2c(++_0x3a07a9);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x0d8b('0x0'));var rp=require(_0x0d8b('0x1'));var BPromise=require('bluebird');var md5=require('md5');var util=require('util');var Redis=require(_0x0d8b('0x2'));var intUtil=require(_0x0d8b('0x3'));var config=require(_0x0d8b('0x4'));var logger=require(_0x0d8b('0x5'))(_0x0d8b('0x6'));config['redis']=_['defaults'](config[_0x0d8b('0x7')],{'host':_0x0d8b('0x8'),'port':0x18eb});var io=require(_0x0d8b('0x9'))(new Redis(config['redis']));function emit(_0x413284,_0x284169,_0x58e4e2){io['to'](_0x413284)[_0x0d8b('0xa')](_0x284169,_0x58e4e2);}function getCustomFields(_0x348e65,_0x3b027f){var _0x1f4800={};if(_0x348e65[_0x0d8b('0xb')]>0x0){_[_0x0d8b('0xc')](_0x348e65,function(_0x2c5e9e){if(_[_0x0d8b('0xd')](['string',_0x0d8b('0xe')],_0x2c5e9e['type'])&&_0x2c5e9e[_0x0d8b('0xf')]){_0x1f4800[_0x2c5e9e[_0x0d8b('0xf')]]=_0x2c5e9e[_0x0d8b('0x10')][_0x0d8b('0x11')]();}else if(_0x2c5e9e[_0x0d8b('0x12')]===_0x0d8b('0x13')&&_0x2c5e9e[_0x0d8b('0x14')]&&_0x2c5e9e[_0x0d8b('0xf')]&&_0x3b027f[_0x2c5e9e[_0x0d8b('0x14')]]){_0x1f4800[_0x2c5e9e[_0x0d8b('0xf')]]=_0x3b027f[_0x2c5e9e[_0x0d8b('0x14')]][_0x0d8b('0x11')]();}else if(_0x2c5e9e[_0x0d8b('0x12')]===_0x0d8b('0x15')&&_0x2c5e9e['Variable']&&_0x2c5e9e[_0x0d8b('0x16')][_0x0d8b('0x17')]&&_0x2c5e9e[_0x0d8b('0xf')]&&_0x3b027f[_0x2c5e9e[_0x0d8b('0x16')][_0x0d8b('0x17')]['toLowerCase']()]){_0x1f4800[_0x2c5e9e[_0x0d8b('0xf')]]=_0x3b027f[_0x2c5e9e[_0x0d8b('0x16')][_0x0d8b('0x17')][_0x0d8b('0x18')]()][_0x0d8b('0x11')]();}});}return _0x1f4800;}function createTicket(_0x18dd2d,_0x264b39,_0xa3612a,_0x4a15bf,_0x27512e,_0x23d58f,_0x196c0a){logger[_0x0d8b('0x19')](_0x0d8b('0x1a'));var _0x5b709c=_[_0x0d8b('0x1b')]({'parent_id':'','assigned_user_id':_0x264b39['id'],'ticketpriorities':_0x0d8b('0x1c'),'ticketstatus':'Open','ticket_title':intUtil['getString'](_0x4a15bf[_0x0d8b('0x1d')],_0x27512e,'\x20'),'description':intUtil['getString'](_0x4a15bf['Descriptions'],_0x27512e,'\x0a'),'contact_id':_0xa3612a['id']},getCustomFields(_0x23d58f,_0x27512e));var _0x5527d8={'method':_0x0d8b('0x1e'),'uri':util[_0x0d8b('0x1f')](_0x0d8b('0x20'),_0x18dd2d[_0x0d8b('0x21')]),'form':{'operation':_0x0d8b('0x22'),'username':_0x18dd2d[_0x0d8b('0x23')],'sessionName':_0x196c0a[_0x0d8b('0x24')],'elementType':_0x0d8b('0x25'),'element':JSON[_0x0d8b('0x26')](_0x5b709c)},'json':!![]};return request(_0x5527d8)['then'](function(_0xe8bbee){if(_0xe8bbee[_0x0d8b('0x27')]){return BPromise['resolve']({'id':_0xe8bbee[_0x0d8b('0x28')]['id']});}else{throw new Error(util['format'](_0x0d8b('0x29'),JSON[_0x0d8b('0x26')](_0xe8bbee[_0x0d8b('0x2a')])));}})['catch'](function(_0x59a905){var _0x28f639=_0x59a905[_0x0d8b('0x2b')]||0x1f4;logger['error'](_0x0d8b('0x2c'),'createTicket',_0x28f639,JSON[_0x0d8b('0x26')](_0x59a905));});}function getUser(_0x4b59e5,_0x97050a,_0x48f24f){if(intUtil[_0x0d8b('0x2d')](_0x97050a)){logger['info'](_0x0d8b('0x2e'),_0x97050a);return request({'method':'GET','uri':util[_0x0d8b('0x1f')](_0x0d8b('0x20'),_0x4b59e5[_0x0d8b('0x21')]),'qs':{'operation':'query','username':_0x4b59e5['username'],'sessionName':_0x48f24f['sessionName'],'query':util[_0x0d8b('0x1f')]('SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;',_0x97050a)},'json':!![]})[_0x0d8b('0x2f')](function(_0x54f6f3){if(_0x54f6f3['success']&&_0x54f6f3[_0x0d8b('0x28')][_0x0d8b('0xb')]){logger[_0x0d8b('0x19')](_0x0d8b('0x30'));return BPromise[_0x0d8b('0x31')]({'id':_0x54f6f3[_0x0d8b('0x28')][0x0]['id'],'email':_0x54f6f3[_0x0d8b('0x28')][0x0][_0x0d8b('0x32')],'name':_0x54f6f3['result'][0x0][_0x0d8b('0x33')]+'\x20'+_0x54f6f3[_0x0d8b('0x28')]['last_name']});}else{logger[_0x0d8b('0x19')](_0x0d8b('0x34'));return BPromise[_0x0d8b('0x31')]({'id':_0x48f24f['userId'],'email':_0x4b59e5[_0x0d8b('0x23')],'name':_0x0d8b('0x35')});}})[_0x0d8b('0x36')](function(_0x31ceba){var _0x933e01=_0x31ceba['statusCode']||0x1f4;logger[_0x0d8b('0x2a')](_0x0d8b('0x2c'),'getUser',_0x933e01,JSON[_0x0d8b('0x26')](_0x31ceba));});}else{logger[_0x0d8b('0x19')](_0x0d8b('0x34'));return BPromise[_0x0d8b('0x31')]({'id':_0x48f24f[_0x0d8b('0x37')],'email':_0x4b59e5['username'],'name':'admin'})[_0x0d8b('0x36')](function(_0x5c2c04){var _0x531c55=_0x5c2c04[_0x0d8b('0x2b')]||0x1f4;logger[_0x0d8b('0x2a')](_0x0d8b('0x2c'),_0x0d8b('0x38'),_0x531c55,JSON[_0x0d8b('0x26')](_0x5c2c04));});}}function getEndUser(_0x24c789,_0x579324,_0x6e5bab,_0x6a02ad){logger[_0x0d8b('0x19')](_0x0d8b('0x39'),_0x6e5bab);return request({'method':_0x0d8b('0x3a'),'uri':util[_0x0d8b('0x1f')](_0x0d8b('0x20'),_0x24c789['remoteUri']),'qs':{'operation':_0x0d8b('0x3b'),'username':_0x24c789[_0x0d8b('0x23')],'sessionName':_0x6a02ad[_0x0d8b('0x24')],'query':util[_0x0d8b('0x1f')]('SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;',_0x6e5bab,_0x6e5bab,_0x6e5bab,_0x6e5bab,_0x6e5bab)},'json':!![]})[_0x0d8b('0x2f')](function(_0x4b4bde){if(_0x4b4bde[_0x0d8b('0x27')]&&_0x4b4bde[_0x0d8b('0x28')][_0x0d8b('0xb')]){logger[_0x0d8b('0x19')](_0x0d8b('0x3c'));return BPromise[_0x0d8b('0x31')]({'id':_0x4b4bde[_0x0d8b('0x28')][0x0]['id'],'name':_0x4b4bde[_0x0d8b('0x28')][0x0][_0x0d8b('0x3d')]+'\x20'+_0x4b4bde[_0x0d8b('0x28')][0x0]['lastname'],'phone':_0x6e5bab});}else{logger['info']('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'method':'POST','uri':util['format'](_0x0d8b('0x20'),_0x24c789[_0x0d8b('0x21')]),'form':{'operation':_0x0d8b('0x22'),'sessionName':_0x6a02ad['sessionName'],'elementType':'Contacts','element':JSON[_0x0d8b('0x26')]({'lastname':_0x579324,'phone':_0x6e5bab,'assigned_user_id':'\x20'})},'json':!![]})[_0x0d8b('0x2f')](function(_0x344278){logger['info'](_0x0d8b('0x3e'));return BPromise[_0x0d8b('0x31')]({'id':_0x344278['result']['id'],'name':_0x344278['result'][_0x0d8b('0x3f')],'phone':_0x344278['result'][_0x0d8b('0x40')]});})['catch'](function(_0x53f643){var _0x30ccee=_0x53f643[_0x0d8b('0x2b')]||0x1f4;logger['error']('[vTiger],\x20%s,\x20%s,\x20%s','getEndUser',_0x30ccee,JSON['stringify'](_0x53f643));});}});}function getConnection(_0x374d40){var _0x1e0498=_0x374d40[_0x0d8b('0x23')];var _0x490eda=_0x374d40[_0x0d8b('0x41')];return request({'method':_0x0d8b('0x3a'),'uri':util[_0x0d8b('0x1f')](_0x0d8b('0x20'),_0x374d40[_0x0d8b('0x21')]),'qs':{'operation':_0x0d8b('0x42'),'username':_0x1e0498},'json':!![]})[_0x0d8b('0x2f')](function(_0x1d5067){if(_0x1d5067[_0x0d8b('0x27')]){return request({'method':_0x0d8b('0x1e'),'uri':util[_0x0d8b('0x1f')](_0x0d8b('0x20'),_0x374d40[_0x0d8b('0x21')]),'form':{'operation':_0x0d8b('0x43'),'username':_0x1e0498,'accessKey':md5(_0x1d5067[_0x0d8b('0x28')][_0x0d8b('0x44')]+_0x490eda)},'json':!![]});}})[_0x0d8b('0x2f')](function(_0x1e162c){if(_0x1e162c[_0x0d8b('0x27')]){return BPromise['resolve'](_0x1e162c[_0x0d8b('0x28')]);}else{throw new Error(util['format']('Account\x20%d\x20is\x20not\x20valid',_0x374d40['id']));}})[_0x0d8b('0x36')](function(_0x113fb7){var _0x3f943a=_0x113fb7[_0x0d8b('0x2b')]||0x1f4;logger['error'](_0x0d8b('0x2c'),_0x0d8b('0x45'),_0x3f943a,JSON[_0x0d8b('0x26')](_0x113fb7));});}function request(_0x241587){logger[_0x0d8b('0x19')]('[HTTP]',JSON['stringify'](_0x241587));return rp(_0x241587);}exports['queue']=function(_0x573f4f,_0x368ede,_0xf22c3c,_0x5e3bb4,_0x4950a8,_0x44c5c1){var _0x3d3cb6,_0x5c5bd7,_0x5ef6c3,_0x900906;_0x44c5c1[_0x0d8b('0x21')]=intUtil[_0x0d8b('0x46')](_0x44c5c1[_0x0d8b('0x21')]);if(_0x4950a8&&_0x4950a8[_0x0d8b('0x47')]){logger['info'](_0x0d8b('0x48'),_0x0d8b('0x49'));_0x368ede['recordingURL']=util['format'](_0x0d8b('0x4a'),_0x44c5c1[_0x0d8b('0x4b')],_0x368ede['uniqueid'],md5(_0x368ede['uniqueid']));}else{_0x368ede[_0x0d8b('0x4c')]='';}return getConnection(_0x44c5c1)[_0x0d8b('0x2f')](function(_0x377027){_0x900906=_0x377027;return getUser(_0x44c5c1,_0x5e3bb4[_0x0d8b('0x4d')],_0x900906);})['then'](function(_0x356b3d){_0x3d3cb6=_0x356b3d;logger['info']('The\x20User\x20ID\x20is:',_0x3d3cb6['id']);return getEndUser(_0x44c5c1,_0x368ede[_0x0d8b('0x4e')],_0x368ede[_0x0d8b('0x4f')],_0x900906);})['then'](function(_0x4a8f33){_0x5c5bd7=_0x4a8f33;logger[_0x0d8b('0x19')](_0x0d8b('0x50'),_0x5c5bd7['id']);return createTicket(_0x44c5c1,_0x3d3cb6,_0x5c5bd7,_0xf22c3c,_0x368ede,_0xf22c3c[_0x0d8b('0x51')],_0x900906);})[_0x0d8b('0x2f')](function(_0x3afc3a){_0x5ef6c3=_0x3afc3a;logger[_0x0d8b('0x19')](_0x0d8b('0x52'));logger[_0x0d8b('0x19')]('The\x20Ticket\x20ID\x20is:',_0x5ef6c3['id']);var _0x24a859=util[_0x0d8b('0x1f')](_0x0d8b('0x53'),_0x44c5c1[_0x0d8b('0x21')],_[_0x0d8b('0x54')](_0x5ef6c3['id'],'x')[0x1]);logger[_0x0d8b('0x19')](_0x0d8b('0x48'),_0x0d8b('0x55'));emit(util[_0x0d8b('0x1f')]('user:%s',_0x5e3bb4[_0x0d8b('0x17')]),_0x0d8b('0x56'),{'uri':_0x24a859});})[_0x0d8b('0x36')](function(_0x23de9e){logger[_0x0d8b('0x2a')]('[QUEUE]',JSON[_0x0d8b('0x26')](_0x23de9e));});};exports[_0x0d8b('0x57')]=function(_0x181d49,_0x17a87f,_0x1d6cd4,_0x59ada2,_0x4d0e7c,_0x3b1166,_0x291b83){var _0x3e4a41,_0xbbb520,_0x5a70bd,_0x199122;_0x3b1166[_0x0d8b('0x21')]=intUtil[_0x0d8b('0x46')](_0x3b1166['remoteUri']);_0x3b1166[_0x0d8b('0x4b')]=intUtil['stripTrailingSlash'](_0x3b1166[_0x0d8b('0x4b')]);if(_0x291b83&&_0x291b83[_0x0d8b('0x58')]&&_0x291b83[_0x0d8b('0x58')]!==_0x0d8b('0x59')){logger[_0x0d8b('0x19')](_0x0d8b('0x5a'),'Recording\x20is\x20enabled!');_0x17a87f[_0x0d8b('0x4c')]=util['format'](_0x0d8b('0x4a'),_0x3b1166[_0x0d8b('0x4b')],_0x17a87f[_0x0d8b('0x5b')],md5(_0x17a87f[_0x0d8b('0x5b')]));}return getConnection(_0x3b1166)['then'](function(_0x19e097){_0x199122=_0x19e097;return getUser(_0x3b1166,_0x59ada2[_0x0d8b('0x4d')],_0x199122);})[_0x0d8b('0x2f')](function(_0x2332fc){_0x3e4a41=_0x2332fc;logger[_0x0d8b('0x19')](_0x0d8b('0x5c'),_0x3e4a41['id']);return getEndUser(_0x3b1166,_0x17a87f[_0x0d8b('0x5d')],_0x17a87f[_0x0d8b('0x5e')],_0x199122);})[_0x0d8b('0x2f')](function(_0x34affb){_0xbbb520=_0x34affb;logger['info']('The\x20Enduser\x20ID\x20is:',_0xbbb520['id']);return createTicket(_0x3b1166,_0x3e4a41,_0xbbb520,_0x1d6cd4,_0x17a87f,_0x1d6cd4[_0x0d8b('0x51')],_0x199122);})[_0x0d8b('0x2f')](function(_0x53e399){_0x5a70bd=_0x53e399;logger[_0x0d8b('0x19')]('Ticket\x20created!');logger['info'](_0x0d8b('0x5f'),_0x5a70bd['id']);var _0x1c4e96=util['format']('%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT',_0x3b1166[_0x0d8b('0x21')],_[_0x0d8b('0x54')](_0x5a70bd['id'],'x')[0x1]);logger[_0x0d8b('0x19')](_0x0d8b('0x5a'),_0x0d8b('0x55'));emit(util[_0x0d8b('0x1f')](_0x0d8b('0x60'),_0x59ada2['name']),_0x0d8b('0x56'),{'uri':_0x1c4e96});})['catch'](function(_0x1a203e){logger[_0x0d8b('0x2a')](_0x0d8b('0x5a'),JSON[_0x0d8b('0x26')](_0x1a203e));});};exports['unmanaged']=function(_0x3fe47d,_0x4a1c4a,_0x3a356b,_0x2c6c5f,_0x1c5fe2,_0x2ebea3){var _0xc5c35f,_0x2b44e5,_0x3e927c,_0x91aa89;_0x2ebea3[_0x0d8b('0x21')]=intUtil[_0x0d8b('0x46')](_0x2ebea3['remoteUri']);_0x2ebea3[_0x0d8b('0x4b')]=intUtil['stripTrailingSlash'](_0x2ebea3[_0x0d8b('0x4b')]);if(_0x1c5fe2&&_0x1c5fe2[_0x0d8b('0x47')]){logger['info']('['+_0x4a1c4a[_0x0d8b('0x61')]['toUpperCase']()+']',_0x0d8b('0x49'));_0x4a1c4a[_0x0d8b('0x4c')]=util[_0x0d8b('0x1f')](_0x0d8b('0x4a'),_0x2ebea3[_0x0d8b('0x4b')],_0x4a1c4a[_0x0d8b('0x5b')],md5(_0x4a1c4a[_0x0d8b('0x5b')]));}else{_0x4a1c4a[_0x0d8b('0x4c')]='';}return getConnection(_0x2ebea3)['then'](function(_0x10eca6){_0x91aa89=_0x10eca6;return getUser(_0x2ebea3,'',_0x91aa89);})[_0x0d8b('0x2f')](function(_0x5b2916){_0xc5c35f=_0x5b2916;logger[_0x0d8b('0x19')](_0x0d8b('0x5c'),_0xc5c35f['id']);return getEndUser(_0x2ebea3,_0x4a1c4a[_0x0d8b('0x4e')],_0x4a1c4a[_0x0d8b('0x4f')],_0x91aa89);})[_0x0d8b('0x2f')](function(_0x9e44b4){_0x2b44e5=_0x9e44b4;logger[_0x0d8b('0x19')](_0x0d8b('0x50'),_0x2b44e5['id']);return createTicket(_0x2ebea3,_0xc5c35f,_0x2b44e5,_0x3a356b,_0x4a1c4a,_0x3a356b[_0x0d8b('0x51')],_0x91aa89);})[_0x0d8b('0x2f')](function(_0xe35028){_0x3e927c=_0xe35028;logger[_0x0d8b('0x19')]('Ticket\x20created!');logger[_0x0d8b('0x19')](_0x0d8b('0x5f'),_0x3e927c['id']);})[_0x0d8b('0x36')](function(_0x58525c){logger['error']('['+_0x4a1c4a[_0x0d8b('0x61')][_0x0d8b('0x62')]()+']',JSON[_0x0d8b('0x26')](_0x58525c));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/zendesk.js b/server/services/ami/trigger/integration/zendesk.js index 03bacee..4e33cb6 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 _0x328b=['%s/agent/tickets/%s','replace','Zendesk\x20account\x20type\x20not\x20recognized','catch','error','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','outbound','recordingFormat','[OUTBOUND]','recordingURL','destcalleridname','destcalleridnum','/api/v2','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','unmanaged','lastevent','The\x20User\x20ID\x20is:','toUpperCase','\x20Error\x20running\x20Zendesk\x20integration','request-promise','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','redis','defaults','localhost','application/json','info','Creating\x20new\x20ticket...','format','merge','Tags','name','getString','Subjects','Descriptions','Fields','then','Ticket\x20created!','ticket','validateEmail','%s/search.json','remoteUri','type:user\x20role:agent\x20email:%s','count','Agent\x20found!','find','results','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Admin\x20account\x20selected.','user','%s/users/me.json','Searching\x20enduser\x20with\x20phone','length','filter','end-user','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','POST','Enduser\x20created.','authType','password','username','token','Basic\x20%s','toString','debug','forEach','includes','picklist','type','nameField','customField','string','custom_fields','push','idField','content','variable','variableName','customVariable','Variable','toLowerCase','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url'];(function(_0x49b489,_0x1068e5){var _0x5994cd=function(_0x3765a2){while(--_0x3765a2){_0x49b489['push'](_0x49b489['shift']());}};_0x5994cd(++_0x1068e5);}(_0x328b,0x152));var _0xb328=function(_0x5c1449,_0x2af4b4){_0x5c1449=_0x5c1449-0x0;var _0x270473=_0x328b[_0x5c1449];return _0x270473;};'use strict';var _=require('lodash');var rp=require(_0xb328('0x0'));var md5=require(_0xb328('0x1'));var util=require(_0xb328('0x2'));var Redis=require(_0xb328('0x3'));var intUtil=require(_0xb328('0x4'));var config=require(_0xb328('0x5'));var logger=require(_0xb328('0x6'))('zendesk');config[_0xb328('0x7')]=_[_0xb328('0x8')](config[_0xb328('0x7')],{'host':_0xb328('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xb328('0x7')]));function emit(_0x10074d,_0x1b0992,_0x11d989){io['to'](_0x10074d)['emit'](_0x1b0992,_0x11d989);}var headers={'Content-Type':_0xb328('0xa'),'Accept':'application/json'};function getTicket(_0x2bc156,_0x318730,_0x4e1eff,_0x54d1ab,_0x2e3e69){logger[_0xb328('0xb')](_0xb328('0xc'));return request({'uri':util[_0xb328('0xd')]('%s/tickets.json',_0x2bc156['remoteUri']),'method':'POST','body':{'ticket':_[_0xb328('0xe')]({'requester_id':_0x4e1eff['id'],'submitter_id':_0x318730?_0x318730['id']:undefined,'assignee_id':_0x318730?_0x318730['id']:undefined,'tags':getTags(_0x54d1ab[_0xb328('0xf')],_0xb328('0x10')),'subject':intUtil[_0xb328('0x11')](_0x54d1ab[_0xb328('0x12')],_0x2e3e69,'\x20'),'description':intUtil[_0xb328('0x11')](_0x54d1ab[_0xb328('0x13')],_0x2e3e69,'\x0a'),'comment':{'public':![],'body':intUtil['getString'](_0x54d1ab[_0xb328('0x13')],_0x2e3e69,'\x0a')}},getCustomFields(_0x54d1ab[_0xb328('0x14')],_0x2e3e69))}})[_0xb328('0x15')](function(_0xe7df8d){logger[_0xb328('0xb')](_0xb328('0x16'));return _0xe7df8d[_0xb328('0x17')];});}function getUser(_0x2913e7,_0x4a2911){if(intUtil[_0xb328('0x18')](_0x4a2911)){logger[_0xb328('0xb')]('Getting\x20agent\x20with\x20email',_0x4a2911);return request({'uri':util['format'](_0xb328('0x19'),_0x2913e7[_0xb328('0x1a')]),'qs':{'query':util[_0xb328('0xd')](_0xb328('0x1b'),_0x4a2911)}})['then'](function(_0x462679){if(_0x462679[_0xb328('0x1c')]){logger[_0xb328('0xb')](_0xb328('0x1d'));return _[_0xb328('0x1e')](_0x462679[_0xb328('0x1f')],{'email':_0x4a2911,'role':'agent'});}else{logger[_0xb328('0xb')](_0xb328('0x20'));return request({'uri':util[_0xb328('0xd')]('%s/users/me.json',_0x2913e7['remoteUri'])})[_0xb328('0x15')](function(_0x25750d){logger[_0xb328('0xb')](_0xb328('0x21'));return _0x25750d[_0xb328('0x22')];});}});}else{logger[_0xb328('0xb')](_0xb328('0x20'));return request({'uri':util[_0xb328('0xd')](_0xb328('0x23'),_0x2913e7['remoteUri'])})[_0xb328('0x15')](function(_0x306efa){logger[_0xb328('0xb')](_0xb328('0x21'));return _0x306efa[_0xb328('0x22')];});}}function getEndUser(_0x513255,_0x51fbe8,_0xad3e6b){logger[_0xb328('0xb')](_0xb328('0x24'),_0xad3e6b);return request({'uri':util['format'](_0xb328('0x19'),_0x513255['remoteUri']),'qs':{'query':util[_0xb328('0xd')]('type:user\x20role:end-user\x20phone:%s',_0xad3e6b)}})[_0xb328('0x15')](function(_0x3e6a50){var _0x34f3f4;if(_0x3e6a50[_0xb328('0x1f')][_0xb328('0x25')]){_0x3e6a50[_0xb328('0x1f')]=_[_0xb328('0x26')](_0x3e6a50[_0xb328('0x1f')],{'suspended':![],'role':_0xb328('0x27')});if(_0x3e6a50[_0xb328('0x1f')]['length']){_0x34f3f4=_['first'](_0x3e6a50[_0xb328('0x1f')]);}}if(_0x34f3f4){logger[_0xb328('0xb')](_0xb328('0x28'));return _0x34f3f4;}else{logger['info'](_0xb328('0x29'));return request({'uri':util['format']('%s/users.json',_0x513255['remoteUri']),'method':_0xb328('0x2a'),'body':{'user':{'role':_0xb328('0x27'),'name':util['format']('Caller\x20-\x20%s',_0x51fbe8||_0xad3e6b),'phone':_0xad3e6b}}})[_0xb328('0x15')](function(_0xda3e4a){logger[_0xb328('0xb')](_0xb328('0x2b'));return _0xda3e4a[_0xb328('0x22')];});}});}function getAuth(_0x37dba1){var _0x28827f;if(_0x37dba1[_0xb328('0x2c')]===_0xb328('0x2d')){_0x28827f=util['format']('%s:%s',_0x37dba1[_0xb328('0x2e')],_0x37dba1[_0xb328('0x2d')]);}else if(_0x37dba1[_0xb328('0x2c')]==='token'){_0x28827f=util[_0xb328('0xd')]('%s/token:%s',_0x37dba1[_0xb328('0x2e')],_0x37dba1[_0xb328('0x2f')]);}return util[_0xb328('0xd')](_0xb328('0x30'),new Buffer(_0x28827f)[_0xb328('0x31')]('base64'));}function request(_0x11ceb7){logger[_0xb328('0x32')]('[HTTP]',JSON['stringify'](_0x11ceb7));return rp(_[_0xb328('0x8')](_0x11ceb7,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x2eea48,_0x33ec22){var _0x34d39f=[];if(_0x2eea48&&_0x2eea48[_0xb328('0x25')]>0x0){_0x34d39f=_['map'](_0x2eea48,_0x33ec22);}return _0x34d39f;}function getCustomFields(_0x364ed5,_0x33771c){var _0x3173a1=[];var _0x22b301={'custom_fields':[]};if(_0x364ed5['length']>0x0){_[_0xb328('0x33')](_0x364ed5,function(_0x2dcbbc){if(_[_0xb328('0x34')](['string',_0xb328('0x35')],_0x2dcbbc[_0xb328('0x36')])&&_0x2dcbbc[_0xb328('0x37')]&&!_0x2dcbbc[_0xb328('0x38')]){_0x22b301[_0x2dcbbc[_0xb328('0x37')]['toLowerCase']()]=_0x2dcbbc['content'][_0xb328('0x31')]();}else if(_[_0xb328('0x34')]([_0xb328('0x39'),_0xb328('0x35')],_0x2dcbbc[_0xb328('0x36')])&&_0x2dcbbc['idField']&&_0x2dcbbc[_0xb328('0x38')]){_0x22b301[_0xb328('0x3a')][_0xb328('0x3b')]({'id':_0x2dcbbc[_0xb328('0x3c')],'value':_0x2dcbbc[_0xb328('0x3d')][_0xb328('0x31')]()});}else if(_0x2dcbbc[_0xb328('0x36')]===_0xb328('0x3e')&&_0x2dcbbc['variableName']&&_0x2dcbbc[_0xb328('0x3c')]&&_0x2dcbbc[_0xb328('0x38')]){_0x33771c[_0x2dcbbc[_0xb328('0x3f')]]&&_0x22b301[_0xb328('0x3a')][_0xb328('0x3b')]({'id':_0x2dcbbc[_0xb328('0x3c')],'value':_0x33771c[_0x2dcbbc[_0xb328('0x3f')]][_0xb328('0x31')]()});}else if(_0x2dcbbc[_0xb328('0x36')]===_0xb328('0x40')&&_0x2dcbbc[_0xb328('0x41')]&&_0x2dcbbc[_0xb328('0x41')][_0xb328('0x10')]&&_0x2dcbbc[_0xb328('0x3c')]&&_0x2dcbbc[_0xb328('0x38')]){_0x33771c[_0x2dcbbc[_0xb328('0x41')][_0xb328('0x10')][_0xb328('0x42')]()]&&_0x22b301[_0xb328('0x3a')][_0xb328('0x3b')]({'id':_0x2dcbbc[_0xb328('0x3c')],'value':_0x33771c[_0x2dcbbc[_0xb328('0x41')][_0xb328('0x10')]['toLowerCase']()][_0xb328('0x31')]()});}});}return _0x22b301;}exports['queue']=function(_0x372b3c,_0x116baa,_0x34fbe8,_0x2d4ce7,_0x445359,_0x99f12a){var _0x184284,_0x48c5a2;_0x99f12a[_0xb328('0x1a')]=intUtil[_0xb328('0x43')](_0x99f12a['remoteUri']);_0x99f12a[_0xb328('0x44')]=intUtil[_0xb328('0x43')](_0x99f12a['serverUrl']);if(_0x445359&&_0x445359[_0xb328('0x45')]){logger[_0xb328('0xb')](_0xb328('0x46'),_0xb328('0x47'));_0x116baa['recordingURL']=util[_0xb328('0xd')](_0xb328('0x48'),_0x99f12a[_0xb328('0x44')],_0x116baa['uniqueid'],md5(_0x116baa[_0xb328('0x49')]));}else{_0x116baa['recordingURL']='';}headers[_0xb328('0x4a')]=getAuth(_0x99f12a);return getUser(_0x99f12a,_0x2d4ce7[_0xb328('0x4b')])[_0xb328('0x15')](function(_0x38aebe){_0x184284=_0x38aebe;logger['info']('The\x20User\x20ID\x20is:',_0x184284['id']);return getEndUser(_0x99f12a,_0x116baa[_0xb328('0x4c')],_0x116baa[_0xb328('0x4d')]);})[_0xb328('0x15')](function(_0x5d3197){_0x48c5a2=_0x5d3197;logger['info'](_0xb328('0x4e'),_0x48c5a2['id']);return getTicket(_0x99f12a,_0x184284,_0x48c5a2,_0x34fbe8,_0x116baa);})[_0xb328('0x15')](function(_0x2e7bc6){if(_0x2e7bc6){logger[_0xb328('0xb')](_0xb328('0x4f'),_0x2e7bc6['id']);switch(_0x99f12a[_0xb328('0x36')]){case'integrationTab':logger[_0xb328('0xb')](_0xb328('0x46'),_0xb328('0x50'));return request({'uri':util['format'](_0xb328('0x51'),_0x99f12a[_0xb328('0x1a')],_0x184284['id'],_0x2e7bc6['id']),'method':_0xb328('0x2a')});case _0xb328('0x52'):logger[_0xb328('0xb')](_0xb328('0x46'),_0xb328('0x53'));emit(util[_0xb328('0xd')](_0xb328('0x54'),_0x2d4ce7[_0xb328('0x10')]),_0xb328('0x55'),{'uri':util[_0xb328('0xd')](_0xb328('0x56'),_0x99f12a[_0xb328('0x1a')][_0xb328('0x57')]('/api/v2',''),_0x2e7bc6['id'])});break;default:logger['error'](_0xb328('0x46'),_0xb328('0x58'));}}})[_0xb328('0x59')](function(_0x206368){logger[_0xb328('0x5a')](_0xb328('0x5b'),util[_0xb328('0x5c')](_0x206368,{'showHidden':!![],'depth':null}));});};exports[_0xb328('0x5d')]=function(_0x553d98,_0x1b5370,_0x4a6a70,_0x2d7436,_0x14c14e,_0x724b57,_0x41902a){var _0x179218,_0x3c6142;_0x724b57[_0xb328('0x1a')]=intUtil['stripTrailingSlash'](_0x724b57[_0xb328('0x1a')]);_0x724b57[_0xb328('0x44')]=intUtil['stripTrailingSlash'](_0x724b57[_0xb328('0x44')]);if(_0x41902a&&_0x41902a[_0xb328('0x5e')]&&_0x41902a[_0xb328('0x5e')]!=='none'){logger['info'](_0xb328('0x5f'),_0xb328('0x47'));_0x1b5370[_0xb328('0x60')]=util[_0xb328('0xd')](_0xb328('0x48'),_0x724b57[_0xb328('0x44')],_0x1b5370[_0xb328('0x49')],md5(_0x1b5370[_0xb328('0x49')]));}headers[_0xb328('0x4a')]=getAuth(_0x724b57);return getUser(_0x724b57,_0x2d7436[_0xb328('0x4b')])['then'](function(_0x1ae433){_0x179218=_0x1ae433;logger[_0xb328('0xb')]('The\x20User\x20ID\x20is:',_0x179218['id']);return getEndUser(_0x724b57,_0x1b5370[_0xb328('0x61')],_0x1b5370[_0xb328('0x62')]);})['then'](function(_0x374e1f){_0x3c6142=_0x374e1f;logger['info'](_0xb328('0x4e'),_0x3c6142['id']);return getTicket(_0x724b57,_0x179218,_0x3c6142,_0x4a6a70,_0x1b5370);})[_0xb328('0x15')](function(_0x5c24a9){if(_0x5c24a9){logger[_0xb328('0xb')](_0xb328('0x4f'),_0x5c24a9['id']);switch(_0x724b57['type']){case'integrationTab':logger[_0xb328('0xb')]('[OUTBOUND]',_0xb328('0x50'));return request({'uri':util['format'](_0xb328('0x51'),_0x724b57['remoteUri'],_0x179218['id'],_0x5c24a9['id']),'method':'POST'});case _0xb328('0x52'):logger['info'](_0xb328('0x5f'),_0xb328('0x53'));emit(util['format'](_0xb328('0x54'),_0x2d7436[_0xb328('0x10')]),_0xb328('0x55'),{'uri':util[_0xb328('0xd')](_0xb328('0x56'),_0x724b57[_0xb328('0x1a')]['replace'](_0xb328('0x63'),''),_0x5c24a9['id'])});break;default:logger[_0xb328('0x5a')](_0xb328('0x5f'),'Zendesk\x20account\x20type\x20not\x20recognized');}}})[_0xb328('0x59')](function(_0x232142){logger[_0xb328('0x5a')](_0xb328('0x64'),util[_0xb328('0x5c')](_0x232142,{'showHidden':!![],'depth':null}));});};exports[_0xb328('0x65')]=function(_0x5250d7,_0x348042,_0x1cf7f8,_0x35c78d,_0x5939a3,_0x1d84be){var _0x467349,_0x27e2f8;_0x1d84be[_0xb328('0x1a')]=intUtil[_0xb328('0x43')](_0x1d84be[_0xb328('0x1a')]);_0x1d84be['serverUrl']=intUtil['stripTrailingSlash'](_0x1d84be[_0xb328('0x44')]);if(_0x5939a3&&_0x5939a3[_0xb328('0x45')]){logger['info']('['+_0x348042[_0xb328('0x66')]['toUpperCase']()+']',_0xb328('0x47'));_0x348042[_0xb328('0x60')]=util[_0xb328('0xd')](_0xb328('0x48'),_0x1d84be['serverUrl'],_0x348042[_0xb328('0x49')],md5(_0x348042['uniqueid']));}else{_0x348042['recordingURL']='';}headers[_0xb328('0x4a')]=getAuth(_0x1d84be);return getUser(_0x1d84be)['then'](function(_0x356bc8){_0x467349=_0x356bc8;logger[_0xb328('0xb')](_0xb328('0x67'),_0x467349['id']);return getEndUser(_0x1d84be,_0x348042[_0xb328('0x4c')],_0x348042[_0xb328('0x4d')]);})[_0xb328('0x15')](function(_0x1e5989){_0x27e2f8=_0x1e5989;logger['info'](_0xb328('0x4e'),_0x27e2f8['id']);return getTicket(_0x1d84be,_0x467349,_0x27e2f8,_0x1cf7f8,_0x348042);})[_0xb328('0x15')](function(_0x389c2f){if(_0x389c2f){logger['info'](_0xb328('0x4f'),_0x389c2f['id']);}})[_0xb328('0x59')](function(_0x4a9b98){logger[_0xb328('0x5a')]('['+_0x348042[_0xb328('0x66')][_0xb328('0x68')]()+']'+_0xb328('0x69'),util[_0xb328('0x5c')](_0x4a9b98,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x5a9b=['catch','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','unmanaged','lastevent','toUpperCase','\x20Error\x20running\x20Zendesk\x20integration','md5','util','./util','../../../../config/environment','../../../../config/logger','zendesk','redis','defaults','localhost','emit','application/json','info','Creating\x20new\x20ticket...','format','%s/tickets.json','remoteUri','POST','merge','Tags','getString','Subjects','Descriptions','Fields','then','Ticket\x20created!','ticket','Getting\x20agent\x20with\x20email','%s/search.json','type:user\x20role:agent\x20email:%s','count','Agent\x20found!','find','results','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','Admin\x20account\x20selected.','user','Searching\x20enduser\x20with\x20phone','type:user\x20role:end-user\x20phone:%s','filter','end-user','length','first','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Caller\x20-\x20%s','Enduser\x20created.','authType','password','%s:%s','token','Basic\x20%s','toString','base64','debug','[HTTP]','stringify','GET','map','forEach','string','nameField','toLowerCase','content','picklist','idField','customField','custom_fields','push','type','variable','variableName','customVariable','Variable','name','queue','stripTrailingSlash','monitor_format','[QUEUE]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','recordingURL','Authorization','email','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','integrationTab','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','%s/agent/tickets/%s','replace','/api/v2','error','Zendesk\x20account\x20type\x20not\x20recognized','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','outbound','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','The\x20Ticket\x20ID\x20is:','trigger:browser:url'];(function(_0x15f4d2,_0x3cb7c6){var _0x127d6a=function(_0x4ceb2f){while(--_0x4ceb2f){_0x15f4d2['push'](_0x15f4d2['shift']());}};_0x127d6a(++_0x3cb7c6);}(_0x5a9b,0xf0));var _0xb5a9=function(_0x6c8609,_0x5bf137){_0x6c8609=_0x6c8609-0x0;var _0x520004=_0x5a9b[_0x6c8609];return _0x520004;};'use strict';var _=require('lodash');var rp=require('request-promise');var md5=require(_0xb5a9('0x0'));var util=require(_0xb5a9('0x1'));var Redis=require('ioredis');var intUtil=require(_0xb5a9('0x2'));var config=require(_0xb5a9('0x3'));var logger=require(_0xb5a9('0x4'))(_0xb5a9('0x5'));config[_0xb5a9('0x6')]=_[_0xb5a9('0x7')](config['redis'],{'host':_0xb5a9('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xb5a9('0x6')]));function emit(_0xca161a,_0x3e0cdb,_0x46ad2f){io['to'](_0xca161a)[_0xb5a9('0x9')](_0x3e0cdb,_0x46ad2f);}var headers={'Content-Type':'application/json','Accept':_0xb5a9('0xa')};function getTicket(_0x18e1de,_0x3ce8b4,_0x132e2b,_0x2d39bf,_0x102ce3){logger[_0xb5a9('0xb')](_0xb5a9('0xc'));return request({'uri':util[_0xb5a9('0xd')](_0xb5a9('0xe'),_0x18e1de[_0xb5a9('0xf')]),'method':_0xb5a9('0x10'),'body':{'ticket':_[_0xb5a9('0x11')]({'requester_id':_0x132e2b['id'],'submitter_id':_0x3ce8b4?_0x3ce8b4['id']:undefined,'assignee_id':_0x3ce8b4?_0x3ce8b4['id']:undefined,'tags':getTags(_0x2d39bf[_0xb5a9('0x12')],'name'),'subject':intUtil[_0xb5a9('0x13')](_0x2d39bf[_0xb5a9('0x14')],_0x102ce3,'\x20'),'description':intUtil[_0xb5a9('0x13')](_0x2d39bf['Descriptions'],_0x102ce3,'\x0a'),'comment':{'public':![],'body':intUtil['getString'](_0x2d39bf[_0xb5a9('0x15')],_0x102ce3,'\x0a')}},getCustomFields(_0x2d39bf[_0xb5a9('0x16')],_0x102ce3))}})[_0xb5a9('0x17')](function(_0x415973){logger[_0xb5a9('0xb')](_0xb5a9('0x18'));return _0x415973[_0xb5a9('0x19')];});}function getUser(_0x145a99,_0x2f3178){if(intUtil['validateEmail'](_0x2f3178)){logger[_0xb5a9('0xb')](_0xb5a9('0x1a'),_0x2f3178);return request({'uri':util[_0xb5a9('0xd')](_0xb5a9('0x1b'),_0x145a99[_0xb5a9('0xf')]),'qs':{'query':util[_0xb5a9('0xd')](_0xb5a9('0x1c'),_0x2f3178)}})['then'](function(_0x45f14d){if(_0x45f14d[_0xb5a9('0x1d')]){logger[_0xb5a9('0xb')](_0xb5a9('0x1e'));return _[_0xb5a9('0x1f')](_0x45f14d[_0xb5a9('0x20')],{'email':_0x2f3178,'role':'agent'});}else{logger[_0xb5a9('0xb')](_0xb5a9('0x21'));return request({'uri':util[_0xb5a9('0xd')](_0xb5a9('0x22'),_0x145a99[_0xb5a9('0xf')])})['then'](function(_0x2ae53c){logger[_0xb5a9('0xb')]('Admin\x20account\x20selected.');return _0x2ae53c['user'];});}});}else{logger[_0xb5a9('0xb')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0xb5a9('0xd')]('%s/users/me.json',_0x145a99['remoteUri'])})['then'](function(_0x2891eb){logger[_0xb5a9('0xb')](_0xb5a9('0x23'));return _0x2891eb[_0xb5a9('0x24')];});}}function getEndUser(_0x202423,_0x593216,_0x32ca9d){logger[_0xb5a9('0xb')](_0xb5a9('0x25'),_0x32ca9d);return request({'uri':util[_0xb5a9('0xd')](_0xb5a9('0x1b'),_0x202423[_0xb5a9('0xf')]),'qs':{'query':util[_0xb5a9('0xd')](_0xb5a9('0x26'),_0x32ca9d)}})[_0xb5a9('0x17')](function(_0x17f3ce){var _0x452837;if(_0x17f3ce[_0xb5a9('0x20')]['length']){_0x17f3ce['results']=_[_0xb5a9('0x27')](_0x17f3ce[_0xb5a9('0x20')],{'suspended':![],'role':_0xb5a9('0x28')});if(_0x17f3ce[_0xb5a9('0x20')][_0xb5a9('0x29')]){_0x452837=_[_0xb5a9('0x2a')](_0x17f3ce[_0xb5a9('0x20')]);}}if(_0x452837){logger[_0xb5a9('0xb')](_0xb5a9('0x2b'));return _0x452837;}else{logger['info'](_0xb5a9('0x2c'));return request({'uri':util['format']('%s/users.json',_0x202423[_0xb5a9('0xf')]),'method':_0xb5a9('0x10'),'body':{'user':{'role':_0xb5a9('0x28'),'name':util['format'](_0xb5a9('0x2d'),_0x593216||_0x32ca9d),'phone':_0x32ca9d}}})[_0xb5a9('0x17')](function(_0x3d6e2b){logger[_0xb5a9('0xb')](_0xb5a9('0x2e'));return _0x3d6e2b[_0xb5a9('0x24')];});}});}function getAuth(_0x4b785f){var _0x282701;if(_0x4b785f[_0xb5a9('0x2f')]===_0xb5a9('0x30')){_0x282701=util[_0xb5a9('0xd')](_0xb5a9('0x31'),_0x4b785f['username'],_0x4b785f[_0xb5a9('0x30')]);}else if(_0x4b785f[_0xb5a9('0x2f')]===_0xb5a9('0x32')){_0x282701=util[_0xb5a9('0xd')]('%s/token:%s',_0x4b785f['username'],_0x4b785f[_0xb5a9('0x32')]);}return util[_0xb5a9('0xd')](_0xb5a9('0x33'),new Buffer(_0x282701)[_0xb5a9('0x34')](_0xb5a9('0x35')));}function request(_0x1fa70f){logger[_0xb5a9('0x36')](_0xb5a9('0x37'),JSON[_0xb5a9('0x38')](_0x1fa70f));return rp(_['defaults'](_0x1fa70f,{'method':_0xb5a9('0x39'),'headers':headers,'json':!![]}));}function getTags(_0x3be531,_0x38ce41){var _0x19f66b=[];if(_0x3be531&&_0x3be531[_0xb5a9('0x29')]>0x0){_0x19f66b=_[_0xb5a9('0x3a')](_0x3be531,_0x38ce41);}return _0x19f66b;}function getCustomFields(_0x452e82,_0x47adf7){var _0x146389=[];var _0x3724ad={'custom_fields':[]};if(_0x452e82[_0xb5a9('0x29')]>0x0){_[_0xb5a9('0x3b')](_0x452e82,function(_0x336f66){if(_['includes']([_0xb5a9('0x3c'),'picklist'],_0x336f66['type'])&&_0x336f66['nameField']&&!_0x336f66['customField']){_0x3724ad[_0x336f66[_0xb5a9('0x3d')][_0xb5a9('0x3e')]()]=_0x336f66[_0xb5a9('0x3f')]['toString']();}else if(_['includes']([_0xb5a9('0x3c'),_0xb5a9('0x40')],_0x336f66['type'])&&_0x336f66[_0xb5a9('0x41')]&&_0x336f66[_0xb5a9('0x42')]){_0x3724ad[_0xb5a9('0x43')][_0xb5a9('0x44')]({'id':_0x336f66[_0xb5a9('0x41')],'value':_0x336f66[_0xb5a9('0x3f')][_0xb5a9('0x34')]()});}else if(_0x336f66[_0xb5a9('0x45')]===_0xb5a9('0x46')&&_0x336f66['variableName']&&_0x336f66['idField']&&_0x336f66['customField']){_0x47adf7[_0x336f66['variableName']]&&_0x3724ad['custom_fields'][_0xb5a9('0x44')]({'id':_0x336f66['idField'],'value':_0x47adf7[_0x336f66[_0xb5a9('0x47')]][_0xb5a9('0x34')]()});}else if(_0x336f66[_0xb5a9('0x45')]===_0xb5a9('0x48')&&_0x336f66[_0xb5a9('0x49')]&&_0x336f66[_0xb5a9('0x49')][_0xb5a9('0x4a')]&&_0x336f66[_0xb5a9('0x41')]&&_0x336f66[_0xb5a9('0x42')]){_0x47adf7[_0x336f66[_0xb5a9('0x49')][_0xb5a9('0x4a')][_0xb5a9('0x3e')]()]&&_0x3724ad[_0xb5a9('0x43')][_0xb5a9('0x44')]({'id':_0x336f66[_0xb5a9('0x41')],'value':_0x47adf7[_0x336f66['Variable'][_0xb5a9('0x4a')]['toLowerCase']()][_0xb5a9('0x34')]()});}});}return _0x3724ad;}exports[_0xb5a9('0x4b')]=function(_0x3191fd,_0xaad31b,_0xbc514b,_0x412c2e,_0x374979,_0x1a7160){var _0x3fe8d5,_0x4a840f;_0x1a7160[_0xb5a9('0xf')]=intUtil['stripTrailingSlash'](_0x1a7160[_0xb5a9('0xf')]);_0x1a7160['serverUrl']=intUtil[_0xb5a9('0x4c')](_0x1a7160['serverUrl']);if(_0x374979&&_0x374979[_0xb5a9('0x4d')]){logger[_0xb5a9('0xb')](_0xb5a9('0x4e'),'Recording\x20is\x20enabled!');_0xaad31b['recordingURL']=util[_0xb5a9('0xd')](_0xb5a9('0x4f'),_0x1a7160[_0xb5a9('0x50')],_0xaad31b['uniqueid'],md5(_0xaad31b[_0xb5a9('0x51')]));}else{_0xaad31b[_0xb5a9('0x52')]='';}headers[_0xb5a9('0x53')]=getAuth(_0x1a7160);return getUser(_0x1a7160,_0x412c2e[_0xb5a9('0x54')])[_0xb5a9('0x17')](function(_0x2e0a8c){_0x3fe8d5=_0x2e0a8c;logger[_0xb5a9('0xb')]('The\x20User\x20ID\x20is:',_0x3fe8d5['id']);return getEndUser(_0x1a7160,_0xaad31b[_0xb5a9('0x55')],_0xaad31b[_0xb5a9('0x56')]);})[_0xb5a9('0x17')](function(_0x3e5b90){_0x4a840f=_0x3e5b90;logger['info'](_0xb5a9('0x57'),_0x4a840f['id']);return getTicket(_0x1a7160,_0x3fe8d5,_0x4a840f,_0xbc514b,_0xaad31b);})[_0xb5a9('0x17')](function(_0x247a62){if(_0x247a62){logger[_0xb5a9('0xb')]('The\x20Ticket\x20ID\x20is:',_0x247a62['id']);switch(_0x1a7160['type']){case _0xb5a9('0x58'):logger['info']('[QUEUE]',_0xb5a9('0x59'));return request({'uri':util[_0xb5a9('0xd')](_0xb5a9('0x5a'),_0x1a7160['remoteUri'],_0x3fe8d5['id'],_0x247a62['id']),'method':'POST'});case _0xb5a9('0x5b'):logger['info']('[QUEUE]',_0xb5a9('0x5c'));emit(util[_0xb5a9('0xd')](_0xb5a9('0x5d'),_0x412c2e[_0xb5a9('0x4a')]),'trigger:browser:url',{'uri':util[_0xb5a9('0xd')](_0xb5a9('0x5e'),_0x1a7160[_0xb5a9('0xf')][_0xb5a9('0x5f')](_0xb5a9('0x60'),''),_0x247a62['id'])});break;default:logger[_0xb5a9('0x61')]('[QUEUE]',_0xb5a9('0x62'));}}})['catch'](function(_0x15bf99){logger['error'](_0xb5a9('0x63'),util[_0xb5a9('0x64')](_0x15bf99,{'showHidden':!![],'depth':null}));});};exports[_0xb5a9('0x65')]=function(_0x1dec16,_0x54cadb,_0x2276e1,_0x4812f3,_0x449a2f,_0x31a803,_0x52b157){var _0x118790,_0x3a7e9a;_0x31a803[_0xb5a9('0xf')]=intUtil['stripTrailingSlash'](_0x31a803[_0xb5a9('0xf')]);_0x31a803[_0xb5a9('0x50')]=intUtil[_0xb5a9('0x4c')](_0x31a803[_0xb5a9('0x50')]);if(_0x52b157&&_0x52b157[_0xb5a9('0x66')]&&_0x52b157[_0xb5a9('0x66')]!==_0xb5a9('0x67')){logger[_0xb5a9('0xb')](_0xb5a9('0x68'),_0xb5a9('0x69'));_0x54cadb[_0xb5a9('0x52')]=util[_0xb5a9('0xd')](_0xb5a9('0x4f'),_0x31a803[_0xb5a9('0x50')],_0x54cadb[_0xb5a9('0x51')],md5(_0x54cadb[_0xb5a9('0x51')]));}headers[_0xb5a9('0x53')]=getAuth(_0x31a803);return getUser(_0x31a803,_0x4812f3['email'])[_0xb5a9('0x17')](function(_0x2bc631){_0x118790=_0x2bc631;logger[_0xb5a9('0xb')](_0xb5a9('0x6a'),_0x118790['id']);return getEndUser(_0x31a803,_0x54cadb[_0xb5a9('0x6b')],_0x54cadb[_0xb5a9('0x6c')]);})[_0xb5a9('0x17')](function(_0x79ea78){_0x3a7e9a=_0x79ea78;logger[_0xb5a9('0xb')](_0xb5a9('0x57'),_0x3a7e9a['id']);return getTicket(_0x31a803,_0x118790,_0x3a7e9a,_0x2276e1,_0x54cadb);})[_0xb5a9('0x17')](function(_0x2763e9){if(_0x2763e9){logger['info'](_0xb5a9('0x6d'),_0x2763e9['id']);switch(_0x31a803[_0xb5a9('0x45')]){case _0xb5a9('0x58'):logger['info'](_0xb5a9('0x68'),'Displaying\x20ticket\x20to\x20agent...');return request({'uri':util[_0xb5a9('0xd')](_0xb5a9('0x5a'),_0x31a803['remoteUri'],_0x118790['id'],_0x2763e9['id']),'method':_0xb5a9('0x10')});case _0xb5a9('0x5b'):logger[_0xb5a9('0xb')](_0xb5a9('0x68'),_0xb5a9('0x5c'));emit(util[_0xb5a9('0xd')](_0xb5a9('0x5d'),_0x4812f3[_0xb5a9('0x4a')]),_0xb5a9('0x6e'),{'uri':util[_0xb5a9('0xd')](_0xb5a9('0x5e'),_0x31a803[_0xb5a9('0xf')][_0xb5a9('0x5f')](_0xb5a9('0x60'),''),_0x2763e9['id'])});break;default:logger[_0xb5a9('0x61')](_0xb5a9('0x68'),'Zendesk\x20account\x20type\x20not\x20recognized');}}})[_0xb5a9('0x6f')](function(_0x4f8cf0){logger[_0xb5a9('0x61')](_0xb5a9('0x70'),util['inspect'](_0x4f8cf0,{'showHidden':!![],'depth':null}));});};exports[_0xb5a9('0x71')]=function(_0x110b12,_0x57ead1,_0x1290c7,_0x5c22ee,_0x4c1820,_0x3d4aa0){var _0x95ec29,_0x437199;_0x3d4aa0[_0xb5a9('0xf')]=intUtil[_0xb5a9('0x4c')](_0x3d4aa0[_0xb5a9('0xf')]);_0x3d4aa0[_0xb5a9('0x50')]=intUtil['stripTrailingSlash'](_0x3d4aa0['serverUrl']);if(_0x4c1820&&_0x4c1820[_0xb5a9('0x4d')]){logger[_0xb5a9('0xb')]('['+_0x57ead1[_0xb5a9('0x72')][_0xb5a9('0x73')]()+']',_0xb5a9('0x69'));_0x57ead1['recordingURL']=util['format'](_0xb5a9('0x4f'),_0x3d4aa0[_0xb5a9('0x50')],_0x57ead1[_0xb5a9('0x51')],md5(_0x57ead1[_0xb5a9('0x51')]));}else{_0x57ead1[_0xb5a9('0x52')]='';}headers[_0xb5a9('0x53')]=getAuth(_0x3d4aa0);return getUser(_0x3d4aa0)['then'](function(_0x426809){_0x95ec29=_0x426809;logger['info'](_0xb5a9('0x6a'),_0x95ec29['id']);return getEndUser(_0x3d4aa0,_0x57ead1[_0xb5a9('0x55')],_0x57ead1[_0xb5a9('0x56')]);})[_0xb5a9('0x17')](function(_0x17f981){_0x437199=_0x17f981;logger['info'](_0xb5a9('0x57'),_0x437199['id']);return getTicket(_0x3d4aa0,_0x95ec29,_0x437199,_0x1290c7,_0x57ead1);})[_0xb5a9('0x17')](function(_0x5cc08d){if(_0x5cc08d){logger['info']('The\x20Ticket\x20ID\x20is:',_0x5cc08d['id']);}})[_0xb5a9('0x6f')](function(_0x2900e6){logger[_0xb5a9('0x61')]('['+_0x57ead1[_0xb5a9('0x72')][_0xb5a9('0x73')]()+']'+_0xb5a9('0x74'),util[_0xb5a9('0x64')](_0x2900e6,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/zoho.js b/server/services/ami/trigger/integration/zoho.js index f635102..94d7668 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 _0x3d1f=['administrator','Subjects','Description','getString','Who_Id','Full_Name','First_Name','Last_Name','What_Id','$se_module','talktime','Call_Duration','utc','mm:ss','answertime','endtime','starttime','YYYY-MM-DDTHH:mm:ss','lastevent','called','Called','connect','Call_Result','Answered','rejected','Rejected','abandoned','timeout','Call_Start_Time','outbound','agentcalledAt','Call_Type','Inbound','Fields','/crm/v2/Calls','err','host','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','/api/voice/recordings/','uniqueid','/downloads?type=uniqueid&token=','recordingURL','zoho.eu','calleridname','calleridnum','The\x20Call\x20ID\x20is:','user:%s','trigger:browser:url','https://crm.','/crm/EntityInfo.do?module=Calls&id=','Recording\x20is\x20enabled!','com','The\x20User\x20ID\x20is:','Outbound','[OUTBOUND]','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','unmanaged','toUpperCase','md5','util','moment','ioredis','../../../../config/environment','../../../../config/logger','zoho','defaults','redis','localhost','socket.io-emitter','emit','[HTTP]','length','includes','string','idField','content','toString','variable','variableName','type','Variable','name','toLowerCase','indexOf','split','isNil','access_token','isBefore','expires_in','https://accounts.zoho.com','https://accounts.zoho.eu','POST','/oauth/v2/token','refreshToken','clientId','refresh_token','seconds','catch','error','stack','Search\x20user','GET','format','https://www.zohoapis.%s/crm/v2/users','Zoho-oauthtoken\x20','then','users','isArrayLikeObject','findIndex','email','info','Agent\x20found!','Using\x20the\x20admin\x20account!','profile','Administrator','user','The\x20failing\x20result\x20is','stringify','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','data','enduserType','https://www.zohoapis.','/crm/v2/','startCase','moduleCreate','role','first_name','last_name','code','SUCCESS','details','Error:\x20','log','CREATE\x20ERROR','moduleSearch','contact_lead','uri','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','Leads','nothing','contact','Creating\x20new\x20call...','Owner'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x3d1f,0x163));var _0xf3d1=function(_0x37f776,_0x3ff27c){_0x37f776=_0x37f776-0x0;var _0x2eb266=_0x3d1f[_0x37f776];return _0x2eb266;};'use strict';var _=require('lodash');var rp=require('request-promise');var md5=require(_0xf3d1('0x0'));var util=require(_0xf3d1('0x1'));var intUtil=require('./util');var moment=require(_0xf3d1('0x2'));var Redis=require(_0xf3d1('0x3'));var BPromise=require('bluebird');var config=require(_0xf3d1('0x4'));var logger=require(_0xf3d1('0x5'))(_0xf3d1('0x6'));config['redis']=_[_0xf3d1('0x7')](config[_0xf3d1('0x8')],{'host':_0xf3d1('0x9'),'port':0x18eb});var io=require(_0xf3d1('0xa'))(new Redis(config[_0xf3d1('0x8')]));function emit(_0x409665,_0x3a9452,_0x1a7b68){io['to'](_0x409665)[_0xf3d1('0xb')](_0x3a9452,_0x1a7b68);}function request(_0x4e2522){logger['debug'](_0xf3d1('0xc'),JSON['stringify'](_0x4e2522));return rp(_0x4e2522);}function getCustomFields(_0x5ca285,_0x23046e){var _0x120f95={};if(_0x5ca285[_0xf3d1('0xd')]>0x0){_['forEach'](_0x5ca285,function(_0x48f29a){if(_[_0xf3d1('0xe')]([_0xf3d1('0xf'),'picklist'],_0x48f29a['type'])&&_0x48f29a[_0xf3d1('0x10')]){_0x120f95[_0x48f29a[_0xf3d1('0x10')]]=_0x48f29a[_0xf3d1('0x11')][_0xf3d1('0x12')]();}else if(_0x48f29a['type']===_0xf3d1('0x13')&&_0x48f29a[_0xf3d1('0x14')]&&_0x48f29a[_0xf3d1('0x10')]&&_0x23046e[_0x48f29a['variableName']]){_0x120f95[_0x48f29a[_0xf3d1('0x10')]]=_0x23046e[_0x48f29a[_0xf3d1('0x14')]][_0xf3d1('0x12')]();}else if(_0x48f29a[_0xf3d1('0x15')]==='customVariable'&&_0x48f29a[_0xf3d1('0x16')]&&_0x48f29a['Variable']['name']&&_0x48f29a['idField']&&_0x23046e[_0x48f29a['Variable'][_0xf3d1('0x17')][_0xf3d1('0x18')]()]){_0x120f95[_0x48f29a['idField']]=_0x23046e[_0x48f29a[_0xf3d1('0x16')][_0xf3d1('0x17')]['toLowerCase']()][_0xf3d1('0x12')]();}});}return _0x120f95;}function getName(_0x5697fc){if(_0x5697fc[_0xf3d1('0x19')]('\x20')>0x0){var _0x1a1214=_0x5697fc[_0xf3d1('0x1a')](/ (.+)/);if(_0x1a1214[0x1]){return _0x1a1214;}}return[_0x5697fc,_0x5697fc];}var accountsTokens={};function getAccessToken(_0x813f44){return new Promise(function(_0x5e661f,_0x58e8c4){if(!_[_0xf3d1('0x1b')](accountsTokens[_0x813f44['id']])&&!_[_0xf3d1('0x1b')](accountsTokens[_0x813f44['id']][_0xf3d1('0x1c')])){if(moment()[_0xf3d1('0x1d')](accountsTokens[_0x813f44['id']][_0xf3d1('0x1e')])){_0x5e661f(accountsTokens[_0x813f44['id']]['access_token']);}}var _0x2bc86b;switch(_0x813f44['zone']){case'US':_0x2bc86b=_0xf3d1('0x1f');break;case'AU':_0x2bc86b='https://accounts.zoho.com.au';break;case'EU':_0x2bc86b=_0xf3d1('0x20');break;case'IN':_0x2bc86b='https://accounts.zoho.in';break;case'CN':_0x2bc86b='https://accounts.zoho.com.cn';break;default:_0x2bc86b=_0xf3d1('0x20');break;}var _0x3bb718={'method':_0xf3d1('0x21'),'uri':_0x2bc86b+_0xf3d1('0x22'),'qs':{'refresh_token':_0x813f44[_0xf3d1('0x23')],'client_id':_0x813f44[_0xf3d1('0x24')],'client_secret':_0x813f44['clientSecret'],'grant_type':_0xf3d1('0x25')},'json':!![]};return rp(_0x3bb718)['then'](function(_0xe60d25){accountsTokens[_0x813f44['id']]={'access_token':_0xe60d25[_0xf3d1('0x1c')],'expires_in':moment()['add'](_0xe60d25[_0xf3d1('0x1e')],_0xf3d1('0x26'))};_0x5e661f(_0xe60d25['access_token']);})[_0xf3d1('0x27')](function(_0x4a99e8){logger[_0xf3d1('0x28')]('Failing\x20creating\x20the\x20access_token',_0x4a99e8[_0xf3d1('0x29')]);_0x58e8c4(_0x4a99e8);});});}function getUser(_0x193c99,_0x57c2ba,_0x374153,_0x46b84d){logger['info'](_0xf3d1('0x2a'));return request({'method':_0xf3d1('0x2b'),'uri':util[_0xf3d1('0x2c')](_0xf3d1('0x2d'),_0x57c2ba),'qs':{'type':'ActiveUsers'},'headers':{'Authorization':_0xf3d1('0x2e')+_0x193c99},'json':!![]})[_0xf3d1('0x2f')](function(_0xfe2262){if(_0xfe2262[_0xf3d1('0x30')]){var _0x56b327=-0x1;if(_[_0xf3d1('0x31')](_0xfe2262[_0xf3d1('0x30')])){if(!_[_0xf3d1('0x1b')](_0x46b84d)){_0x56b327=_[_0xf3d1('0x32')](_0xfe2262[_0xf3d1('0x30')],function(_0x177d81){return _0x177d81[_0xf3d1('0x33')]===_0x46b84d;});}if(_0x56b327>=0x0){logger[_0xf3d1('0x34')](_0xf3d1('0x35'));}else{logger[_0xf3d1('0x34')](_0xf3d1('0x36'));_0x56b327=_[_0xf3d1('0x32')](_0xfe2262[_0xf3d1('0x30')],function(_0x54654e){return _0x54654e[_0xf3d1('0x37')]['name']===_0xf3d1('0x38');});}return _0xfe2262[_0xf3d1('0x30')][_0x56b327];}else{if(_0xfe2262[_0xf3d1('0x39')][_0xf3d1('0x37')][_0xf3d1('0x17')]==='Administrator'){logger[_0xf3d1('0x34')](_0xf3d1('0x36'));user=_0xfe2262[_0xf3d1('0x39')];return user;}else{logger[_0xf3d1('0x28')](_0xf3d1('0x3a'),JSON[_0xf3d1('0x3b')](_0xfe2262));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON['stringify'](_0xfe2262));}}}else{logger[_0xf3d1('0x28')](_0xf3d1('0x3a'),JSON[_0xf3d1('0x3b')](_0xfe2262));throw new Error(_0xf3d1('0x3c')+JSON[_0xf3d1('0x3b')](_0xfe2262));}})['catch'](function(_0x13fe27){console[_0xf3d1('0x28')](_0x13fe27);});}function getZohoUser(_0x215b43,_0x4dcb12){return new BPromise(function(_0x19213b,_0x42bd71){request(_0x215b43)['then'](function(_0x57d47b){var _0x13e8f7=null;if(_0x57d47b){_0x13e8f7=_0x57d47b[_0xf3d1('0x3d')][0x0];_0x13e8f7[_0xf3d1('0x3e')]=_0x4dcb12;}_0x19213b(_0x13e8f7);})[_0xf3d1('0x27')](function(_0x202cf4){_0x42bd71(_0x202cf4);});});}function createEndUser(_0x4eb9b9,_0x5d0766,_0x560119,_0x4bdeb2,_0x2e642e,_0x445f4b){var _0x560119=getName(_0x560119);return request({'method':_0xf3d1('0x21'),'uri':_0xf3d1('0x3f')+_0x5d0766+_0xf3d1('0x40')+_[_0xf3d1('0x41')](_0x445f4b[_0xf3d1('0x42')])+'s','body':{'data':[{'Last_Name':_0x560119[0x1],'First_Name':_0x560119[0x0],'Phone':_0x4bdeb2,'Owner':{'name':!_[_0xf3d1('0x1b')](_0x2e642e['role'][_0xf3d1('0x17')])?_0x2e642e[_0xf3d1('0x43')][_0xf3d1('0x17')]:!_[_0xf3d1('0x1b')](_0x2e642e['first_name'])?_0x2e642e[_0xf3d1('0x44')]+'\x20'+_0x2e642e[_0xf3d1('0x45')]:_0x2e642e[_0xf3d1('0x45')],'id':_0x2e642e['id']}}]},'headers':{'Authorization':_0xf3d1('0x2e')+_0x4eb9b9},'json':!![]})[_0xf3d1('0x2f')](function(_0x22a154){if(_0x22a154&&_0x22a154['data'][0x0][_0xf3d1('0x46')]===_0xf3d1('0x47')){var _0x1972a5=_0x22a154[_0xf3d1('0x3d')][0x0][_0xf3d1('0x48')];_0x1972a5[_0xf3d1('0x3e')]=_['startCase'](_0x445f4b['moduleCreate'])+'s';return _0x1972a5;}logger[_0xf3d1('0x28')]('The\x20failing\x20result\x20is',JSON[_0xf3d1('0x3b')](data));throw new Error(_0xf3d1('0x49')+JSON[_0xf3d1('0x3b')](data));})[_0xf3d1('0x27')](function(_0x5044e5){console[_0xf3d1('0x4a')](_0xf3d1('0x4b'),_0x5044e5);});}function getEndUser(_0x73f9ed,_0x5386ea,_0x35a014,_0x2f23ca,_0x1020ef,_0x542518,_0x2aa5ae){var _0x1ab033={'method':'GET','uri':'','headers':{'Authorization':_0xf3d1('0x2e')+_0x73f9ed},'json':!![]};switch(_0x2aa5ae[_0xf3d1('0x4c')]){case _0xf3d1('0x4d'):_0x1ab033[_0xf3d1('0x4e')]=_0xf3d1('0x3f')+_0x5386ea+_0xf3d1('0x4f')+_0x1020ef+'))';return getZohoUser(_0x1ab033,_0xf3d1('0x50'))[_0xf3d1('0x2f')](function(_0x185974){if(_0x185974)return _0x185974;_0x1ab033[_0xf3d1('0x4e')]=_0xf3d1('0x3f')+_0x5386ea+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x1020ef+'))';return getZohoUser(_0x1ab033,_0xf3d1('0x51'))[_0xf3d1('0x2f')](function(_0x37019f){if(_0x37019f)return _0x37019f;if(_0x2aa5ae[_0xf3d1('0x42')]!=_0xf3d1('0x52')){return createEndUser(_0x73f9ed,_0x5386ea,_0x2f23ca,_0x1020ef,_0x542518,_0x2aa5ae);}else{return{};}});});break;case _0xf3d1('0x53'):_0x1ab033[_0xf3d1('0x4e')]=_0xf3d1('0x3f')+_0x5386ea+'/crm/v2/Contacts/search?criteria=((Phone:equals:'+_0x1020ef+'))';return getZohoUser(_0x1ab033,_0xf3d1('0x50'))[_0xf3d1('0x2f')](function(_0x417b6a){if(_0x417b6a)return _0x417b6a;if(_0x2aa5ae[_0xf3d1('0x42')]!=_0xf3d1('0x52')){return createEndUser(_0x73f9ed,_0x5386ea,_0x2f23ca,_0x1020ef,_0x542518,_0x2aa5ae);}else{return{};}});break;case'lead':_0x1ab033[_0xf3d1('0x4e')]='https://www.zohoapis.'+_0x5386ea+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x1020ef+'))';return getZohoUser(_0x1ab033,'Leads')[_0xf3d1('0x2f')](function(_0x3fc508){if(_0x3fc508)return _0x3fc508;if(_0x2aa5ae[_0xf3d1('0x42')]!='nothing'){return createEndUser(_0x73f9ed,_0x5386ea,_0x2f23ca,_0x1020ef,_0x542518,_0x2aa5ae);}else{return{};}});break;}}function getCall(_0xcfc791,_0x5728ae,_0x4c4be5,_0x5aba7d,_0x2a18ee,_0x896143,_0x5c4775,_0x98d1b9){logger['info'](_0xf3d1('0x54'));var _0x1cecb1={};_0x1cecb1[_0xf3d1('0x55')]={'name':!_[_0xf3d1('0x1b')](_0x5aba7d['role'][_0xf3d1('0x17')])&&!_[_0xf3d1('0x1b')](_0x5aba7d[_0xf3d1('0x37')]['name'])&&_0x5aba7d['profile'][_0xf3d1('0x17')]===_0xf3d1('0x56')?_0x5aba7d[_0xf3d1('0x43')]['name']:!_[_0xf3d1('0x1b')](_0x5aba7d[_0xf3d1('0x44')])?_0x5aba7d[_0xf3d1('0x44')]+'\x20'+_0x5aba7d[_0xf3d1('0x45')]:_0x5aba7d['last_name'],'id':_0x5aba7d['id']};_0x1cecb1['Subject']=intUtil['getString'](_0x896143[_0xf3d1('0x57')],_0x5c4775,'\x20');_0x1cecb1[_0xf3d1('0x58')]=intUtil[_0xf3d1('0x59')](_0x896143['Descriptions'],_0x5c4775,'\x0a');if(_0x2a18ee['enduserType']===_0xf3d1('0x50')){_0x1cecb1[_0xf3d1('0x5a')]={'name':!_[_0xf3d1('0x1b')](_0x2a18ee['Full_Name'])?_0x2a18ee[_0xf3d1('0x5b')]:!_[_0xf3d1('0x1b')](_0x2a18ee[_0xf3d1('0x5c')])?_0x2a18ee[_0xf3d1('0x5c')]+'\x20'+_0x2a18ee[_0xf3d1('0x5d')]:_0x2a18ee[_0xf3d1('0x5d')],'id':_0x2a18ee['id']};}if(_0x2a18ee[_0xf3d1('0x3e')]===_0xf3d1('0x51')){_0x1cecb1[_0xf3d1('0x5e')]={'name':!_[_0xf3d1('0x1b')](_0x2a18ee[_0xf3d1('0x5b')])?_0x2a18ee[_0xf3d1('0x5b')]:!_[_0xf3d1('0x1b')](_0x2a18ee[_0xf3d1('0x5c')])?_0x2a18ee['First_Name']+'\x20'+_0x2a18ee[_0xf3d1('0x5d')]:_0x2a18ee[_0xf3d1('0x5d')],'id':_0x2a18ee['id']};_0x1cecb1[_0xf3d1('0x5f')]=_[_0xf3d1('0x41')](_0x2a18ee[_0xf3d1('0x3e')]);}if(_0x5c4775[_0xf3d1('0x60')]){_0x1cecb1[_0xf3d1('0x61')]=moment[_0xf3d1('0x62')](parseInt(_0x5c4775[_0xf3d1('0x60')])*0x3e8)['format'](_0xf3d1('0x63'));}else if(_0x5c4775[_0xf3d1('0x64')]&&_0x5c4775[_0xf3d1('0x65')]){_0x1cecb1[_0xf3d1('0x61')]=moment['utc'](moment(_0x5c4775[_0xf3d1('0x65')],'YYYY-MM-DDTHH:mm:ss')['diff'](moment(_0x5c4775[_0xf3d1('0x66')],_0xf3d1('0x67'))))['format']('mm:ss');}switch(_0x5c4775[_0xf3d1('0x68')]){case _0xf3d1('0x69'):_0x1cecb1['Call_Result']=_0xf3d1('0x6a');break;case'complete':case _0xf3d1('0x6b'):_0x1cecb1[_0xf3d1('0x6c')]=_0xf3d1('0x6d');break;case _0xf3d1('0x6e'):_0x1cecb1[_0xf3d1('0x6c')]=_0xf3d1('0x6f');break;case _0xf3d1('0x70'):_0x1cecb1['Call_Result']='Abandoned';break;case _0xf3d1('0x71'):_0x1cecb1[_0xf3d1('0x6c')]='Timeout';default:}_0x1cecb1[_0xf3d1('0x72')]=(_0x98d1b9===_0xf3d1('0x73')?moment(_0x5c4775[_0xf3d1('0x66')])[_0xf3d1('0x2c')]('YYYY-MM-DDTHH:mm:ss'):moment(_0x5c4775[_0xf3d1('0x74')])[_0xf3d1('0x2c')](_0xf3d1('0x67')))||moment()[_0xf3d1('0x2c')](_0xf3d1('0x67'));_0x1cecb1[_0xf3d1('0x75')]=_0x98d1b9||_0xf3d1('0x76');_0x1cecb1=_['merge'](_0x1cecb1,getCustomFields(_0x896143[_0xf3d1('0x77')],_0x5c4775));return request({'method':_0xf3d1('0x21'),'uri':_0xf3d1('0x3f')+_0x5728ae+_0xf3d1('0x78'),'headers':{'Authorization':_0xf3d1('0x2e')+_0xcfc791},'body':{'data':[_0x1cecb1]},'json':!![]})[_0xf3d1('0x2f')](function(_0x971b25){if(_0x971b25&&_0x971b25[_0xf3d1('0x3d')][0x0][_0xf3d1('0x46')]===_0xf3d1('0x47')){logger[_0xf3d1('0x34')]('Call\x20created!');return{'id':_0x971b25[_0xf3d1('0x3d')][0x0][_0xf3d1('0x48')]['id']};}})[_0xf3d1('0x27')](function(_0x1e0be0){logger[_0xf3d1('0x34')]('err',_0x1e0be0[_0xf3d1('0x29')]);console[_0xf3d1('0x4a')](_0xf3d1('0x79'),_0x1e0be0);});}exports['queue']=function(_0xd63132,_0x435156,_0x57586c,_0x280b09,_0x31ed60,_0x4dfc07){var _0x16ed3b,_0x27670a,_0x378a08;_0x4dfc07[_0xf3d1('0x7a')]=intUtil[_0xf3d1('0x7b')](_0x4dfc07[_0xf3d1('0x7a')]);_0x4dfc07[_0xf3d1('0x7c')]=intUtil['stripTrailingSlash'](_0x4dfc07[_0xf3d1('0x7c')]);if(_0x31ed60&&_0x31ed60[_0xf3d1('0x7d')]){logger[_0xf3d1('0x34')](_0xf3d1('0x7e'),'Recording\x20is\x20enabled!');_0x435156['recordingURL']=_0x4dfc07['serverUrl']+_0xf3d1('0x7f')+_0x435156[_0xf3d1('0x80')]+_0xf3d1('0x81')+md5(_0x435156['uniqueid']);}else{_0x435156[_0xf3d1('0x82')]='';}var _0x598b4e=_0x4dfc07[_0xf3d1('0x7a')]===_0xf3d1('0x83')?'eu':'com';return getAccessToken(_0x4dfc07)[_0xf3d1('0x2f')](function(_0x182096){_0x378a08=_0x182096;return getUser(_0x378a08,_0x598b4e,_0x4dfc07,_0x280b09['email']);})[_0xf3d1('0x2f')](function(_0x4bb118){_0x16ed3b=_0x4bb118;logger[_0xf3d1('0x34')]('The\x20User\x20ID\x20is:',_0x16ed3b['id']);return getEndUser(_0x378a08,_0x598b4e,_0x4dfc07,_0x435156[_0xf3d1('0x84')],_0x435156[_0xf3d1('0x85')],_0x16ed3b,_0x57586c);})[_0xf3d1('0x2f')](function(_0x35d7b0){_0x27670a=_0x35d7b0;return getCall(_0x378a08,_0x598b4e,_0x4dfc07,_0x16ed3b,_0x27670a,_0x57586c,_0x435156,_0xf3d1('0x76'));})[_0xf3d1('0x2f')](function(_0x2ae07d){if(_0x2ae07d){logger[_0xf3d1('0x34')](_0xf3d1('0x86'),_0x2ae07d['id']);logger['info'](_0xf3d1('0x7e'),'Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xf3d1('0x2c')](_0xf3d1('0x87'),_0x280b09[_0xf3d1('0x17')]),_0xf3d1('0x88'),{'uri':_0xf3d1('0x89')+_0x4dfc07['host']+_0xf3d1('0x8a')+_0x2ae07d['id']});}})[_0xf3d1('0x27')](function(_0x3ad073){logger['error'](_0xf3d1('0x7e'),JSON[_0xf3d1('0x3b')](_0x3ad073));});};exports[_0xf3d1('0x73')]=function(_0x3af327,_0x40445f,_0x494714,_0x49ac93,_0x1723b5,_0x557531,_0x2a4c34){var _0x514379,_0x22b269,_0x2f485e;_0x557531[_0xf3d1('0x7a')]=intUtil[_0xf3d1('0x7b')](_0x557531[_0xf3d1('0x7a')]);_0x557531[_0xf3d1('0x7c')]=intUtil[_0xf3d1('0x7b')](_0x557531[_0xf3d1('0x7c')]);if(_0x2a4c34&&_0x2a4c34['recordingFormat']&&_0x2a4c34['recordingFormat']!=='none'){logger['info']('[OUTBOUND]',_0xf3d1('0x8b'));_0x40445f['recordingURL']=_0x557531[_0xf3d1('0x7c')]+_0xf3d1('0x7f')+_0x40445f[_0xf3d1('0x80')]+_0xf3d1('0x81')+md5(_0x40445f[_0xf3d1('0x80')]);}var _0x3c322a=_0x557531[_0xf3d1('0x7a')]===_0xf3d1('0x83')?'eu':_0xf3d1('0x8c');return getAccessToken(_0x557531)[_0xf3d1('0x2f')](function(_0x2559a1){_0x2f485e=_0x2559a1;return getUser(_0x2f485e,_0x3c322a,_0x557531,_0x49ac93[_0xf3d1('0x33')]);})[_0xf3d1('0x2f')](function(_0x443850){_0x514379=_0x443850;logger[_0xf3d1('0x34')](_0xf3d1('0x8d'),_0x514379['id']);return getEndUser(_0x2f485e,_0x3c322a,_0x557531,_0x40445f['destcalleridname'],_0x40445f['destcalleridnum'],_0x514379,_0x494714);})[_0xf3d1('0x2f')](function(_0x31b622){_0x22b269=_0x31b622;return getCall(_0x2f485e,_0x3c322a,_0x557531,_0x514379,_0x22b269,_0x494714,_0x40445f,_0xf3d1('0x8e'));})[_0xf3d1('0x2f')](function(_0x3ce3b1){if(_0x3ce3b1){logger[_0xf3d1('0x34')]('The\x20Call\x20ID\x20is:',_0x3ce3b1['id']);logger['info'](_0xf3d1('0x8f'),_0xf3d1('0x90'));emit(util[_0xf3d1('0x2c')](_0xf3d1('0x87'),_0x49ac93[_0xf3d1('0x17')]),'trigger:browser:url',{'uri':'https://crm.'+_0x557531[_0xf3d1('0x7a')]+_0xf3d1('0x8a')+_0x3ce3b1['id']});}})[_0xf3d1('0x27')](function(_0x35869e){logger[_0xf3d1('0x28')](_0xf3d1('0x8f'),JSON[_0xf3d1('0x3b')](_0x35869e));});};exports[_0xf3d1('0x91')]=function(_0x2c7cad,_0x8ad9e,_0x1d8099,_0x4b0905,_0x3f3301,_0x3f260c){var _0x5703fc,_0x38b682,_0x16298a;_0x3f260c['host']=intUtil['stripTrailingSlash'](_0x3f260c['host']);_0x3f260c[_0xf3d1('0x7c')]=intUtil[_0xf3d1('0x7b')](_0x3f260c[_0xf3d1('0x7c')]);if(_0x3f3301&&_0x3f3301['monitor_format']){logger[_0xf3d1('0x34')]('['+_0x8ad9e[_0xf3d1('0x68')][_0xf3d1('0x92')]()+']',_0xf3d1('0x8b'));_0x8ad9e['recordingURL']=_0x3f260c['serverUrl']+_0xf3d1('0x7f')+_0x8ad9e['uniqueid']+_0xf3d1('0x81')+md5(_0x8ad9e[_0xf3d1('0x80')]);}else{_0x8ad9e['recordingURL']='';}var _0x52e573=_0x3f260c[_0xf3d1('0x7a')]===_0xf3d1('0x83')?'eu':_0xf3d1('0x8c');return getAccessToken(_0x3f260c)[_0xf3d1('0x2f')](function(_0x2ebabc){_0x16298a=_0x2ebabc;return getUser(_0x16298a,_0x52e573,_0x3f260c);})[_0xf3d1('0x2f')](function(_0x1792f9){_0x5703fc=_0x1792f9;logger[_0xf3d1('0x34')](_0xf3d1('0x8d'),_0x5703fc['id']);return getEndUser(_0x16298a,_0x52e573,_0x3f260c,_0x8ad9e['calleridname'],_0x8ad9e[_0xf3d1('0x85')],_0x5703fc,_0x1d8099);})[_0xf3d1('0x2f')](function(_0x584fbe){_0x38b682=_0x584fbe;return getCall(_0x16298a,_0x52e573,_0x3f260c,_0x5703fc,_0x38b682,_0x1d8099,_0x8ad9e,'Inbound');})['then'](function(_0x408985){if(_0x408985){logger['info']('The\x20Call\x20ID\x20is:',_0x408985['id']);}})['catch'](function(_0x26e92f){logger['error']('['+_0x8ad9e[_0xf3d1('0x68')][_0xf3d1('0x92')]()+']',JSON['stringify'](_0x26e92f));});}; \ No newline at end of file +var _0xec79=['uri','Contacts','/crm/v2/Leads/search?criteria=((Phone:equals:','nothing','/crm/v2/Contacts/search?criteria=((Phone:equals:','lead','Leads','Creating\x20new\x20call...','Owner','getString','Subjects','Descriptions','Who_Id','Full_Name','First_Name','Last_Name','What_Id','$se_module','talktime','Call_Duration','utc','endtime','YYYY-MM-DDTHH:mm:ss','starttime','Call_Result','Called','complete','Answered','rejected','Rejected','abandoned','Abandoned','Timeout','Call_Start_Time','agentcalledAt','Call_Type','Inbound','Fields','/crm/v2/Calls','code','Call\x20created!','stack','err','queue','host','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','/api/voice/recordings/','/downloads?type=uniqueid&token=','com','The\x20User\x20ID\x20is:','calleridname','calleridnum','trigger:browser:url','https://crm.','recordingFormat','[OUTBOUND]','uniqueid','zoho.eu','destcalleridname','destcalleridnum','Outbound','The\x20Call\x20ID\x20is:','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','/crm/EntityInfo.do?module=Calls&id=','lastevent','toUpperCase','lodash','request-promise','util','./util','moment','ioredis','bluebird','../../../../config/environment','../../../../config/logger','redis','defaults','localhost','emit','debug','[HTTP]','forEach','includes','type','idField','toString','variable','variableName','customVariable','Variable','name','toLowerCase','indexOf','split','isNil','isBefore','expires_in','access_token','zone','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','/oauth/v2/token','refreshToken','clientId','clientSecret','refresh_token','then','add','catch','Failing\x20creating\x20the\x20access_token','info','Search\x20user','GET','format','ActiveUsers','users','isArrayLikeObject','email','Using\x20the\x20admin\x20account!','profile','user','error','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','stringify','data','enduserType','POST','https://www.zohoapis.','/crm/v2/','startCase','moduleCreate','role','first_name','last_name','Zoho-oauthtoken\x20','SUCCESS','details','Error:\x20','log','CREATE\x20ERROR'];(function(_0x2c2581,_0x50b2d9){var _0x15a028=function(_0x5bb7f6){while(--_0x5bb7f6){_0x2c2581['push'](_0x2c2581['shift']());}};_0x15a028(++_0x50b2d9);}(_0xec79,0xdd));var _0x9ec7=function(_0x37cd8c,_0x425de5){_0x37cd8c=_0x37cd8c-0x0;var _0x213168=_0xec79[_0x37cd8c];return _0x213168;};'use strict';var _=require(_0x9ec7('0x0'));var rp=require(_0x9ec7('0x1'));var md5=require('md5');var util=require(_0x9ec7('0x2'));var intUtil=require(_0x9ec7('0x3'));var moment=require(_0x9ec7('0x4'));var Redis=require(_0x9ec7('0x5'));var BPromise=require(_0x9ec7('0x6'));var config=require(_0x9ec7('0x7'));var logger=require(_0x9ec7('0x8'))('zoho');config[_0x9ec7('0x9')]=_[_0x9ec7('0xa')](config[_0x9ec7('0x9')],{'host':_0x9ec7('0xb'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x9ec7('0x9')]));function emit(_0x3df0e5,_0xa6d5d5,_0x530a40){io['to'](_0x3df0e5)[_0x9ec7('0xc')](_0xa6d5d5,_0x530a40);}function request(_0x5d6e0d){logger[_0x9ec7('0xd')](_0x9ec7('0xe'),JSON['stringify'](_0x5d6e0d));return rp(_0x5d6e0d);}function getCustomFields(_0x4810dd,_0x2e45c7){var _0x24d3e3={};if(_0x4810dd['length']>0x0){_[_0x9ec7('0xf')](_0x4810dd,function(_0x5dc852){if(_[_0x9ec7('0x10')](['string','picklist'],_0x5dc852[_0x9ec7('0x11')])&&_0x5dc852[_0x9ec7('0x12')]){_0x24d3e3[_0x5dc852[_0x9ec7('0x12')]]=_0x5dc852['content'][_0x9ec7('0x13')]();}else if(_0x5dc852['type']===_0x9ec7('0x14')&&_0x5dc852[_0x9ec7('0x15')]&&_0x5dc852[_0x9ec7('0x12')]&&_0x2e45c7[_0x5dc852[_0x9ec7('0x15')]]){_0x24d3e3[_0x5dc852[_0x9ec7('0x12')]]=_0x2e45c7[_0x5dc852[_0x9ec7('0x15')]][_0x9ec7('0x13')]();}else if(_0x5dc852['type']===_0x9ec7('0x16')&&_0x5dc852['Variable']&&_0x5dc852[_0x9ec7('0x17')][_0x9ec7('0x18')]&&_0x5dc852[_0x9ec7('0x12')]&&_0x2e45c7[_0x5dc852[_0x9ec7('0x17')][_0x9ec7('0x18')]['toLowerCase']()]){_0x24d3e3[_0x5dc852[_0x9ec7('0x12')]]=_0x2e45c7[_0x5dc852[_0x9ec7('0x17')][_0x9ec7('0x18')][_0x9ec7('0x19')]()][_0x9ec7('0x13')]();}});}return _0x24d3e3;}function getName(_0xbe97c3){if(_0xbe97c3[_0x9ec7('0x1a')]('\x20')>0x0){var _0x57e6dd=_0xbe97c3[_0x9ec7('0x1b')](/ (.+)/);if(_0x57e6dd[0x1]){return _0x57e6dd;}}return[_0xbe97c3,_0xbe97c3];}var accountsTokens={};function getAccessToken(_0x1058f6){return new Promise(function(_0x4b97f0,_0x4f45a4){if(!_[_0x9ec7('0x1c')](accountsTokens[_0x1058f6['id']])&&!_[_0x9ec7('0x1c')](accountsTokens[_0x1058f6['id']]['access_token'])){if(moment()[_0x9ec7('0x1d')](accountsTokens[_0x1058f6['id']][_0x9ec7('0x1e')])){_0x4b97f0(accountsTokens[_0x1058f6['id']][_0x9ec7('0x1f')]);}}var _0x11f4e5;switch(_0x1058f6[_0x9ec7('0x20')]){case'US':_0x11f4e5='https://accounts.zoho.com';break;case'AU':_0x11f4e5=_0x9ec7('0x21');break;case'EU':_0x11f4e5=_0x9ec7('0x22');break;case'IN':_0x11f4e5=_0x9ec7('0x23');break;case'CN':_0x11f4e5=_0x9ec7('0x24');break;default:_0x11f4e5=_0x9ec7('0x22');break;}var _0x3ba220={'method':'POST','uri':_0x11f4e5+_0x9ec7('0x25'),'qs':{'refresh_token':_0x1058f6[_0x9ec7('0x26')],'client_id':_0x1058f6[_0x9ec7('0x27')],'client_secret':_0x1058f6[_0x9ec7('0x28')],'grant_type':_0x9ec7('0x29')},'json':!![]};return rp(_0x3ba220)[_0x9ec7('0x2a')](function(_0x1c3fbb){accountsTokens[_0x1058f6['id']]={'access_token':_0x1c3fbb[_0x9ec7('0x1f')],'expires_in':moment()[_0x9ec7('0x2b')](_0x1c3fbb[_0x9ec7('0x1e')],'seconds')};_0x4b97f0(_0x1c3fbb[_0x9ec7('0x1f')]);})[_0x9ec7('0x2c')](function(_0x541eca){logger['error'](_0x9ec7('0x2d'),_0x541eca['stack']);_0x4f45a4(_0x541eca);});});}function getUser(_0x458cd0,_0x175257,_0x1fa2ff,_0x228026){logger[_0x9ec7('0x2e')](_0x9ec7('0x2f'));return request({'method':_0x9ec7('0x30'),'uri':util[_0x9ec7('0x31')]('https://www.zohoapis.%s/crm/v2/users',_0x175257),'qs':{'type':_0x9ec7('0x32')},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x458cd0},'json':!![]})[_0x9ec7('0x2a')](function(_0x445cc6){if(_0x445cc6[_0x9ec7('0x33')]){var _0x94e4a5=-0x1;if(_[_0x9ec7('0x34')](_0x445cc6[_0x9ec7('0x33')])){if(!_[_0x9ec7('0x1c')](_0x228026)){_0x94e4a5=_['findIndex'](_0x445cc6[_0x9ec7('0x33')],function(_0x342284){return _0x342284[_0x9ec7('0x35')]===_0x228026;});}if(_0x94e4a5>=0x0){logger[_0x9ec7('0x2e')]('Agent\x20found!');}else{logger[_0x9ec7('0x2e')](_0x9ec7('0x36'));_0x94e4a5=_['findIndex'](_0x445cc6[_0x9ec7('0x33')],function(_0x5bf8aa){return _0x5bf8aa[_0x9ec7('0x37')][_0x9ec7('0x18')]==='Administrator';});}return _0x445cc6[_0x9ec7('0x33')][_0x94e4a5];}else{if(_0x445cc6[_0x9ec7('0x38')][_0x9ec7('0x37')][_0x9ec7('0x18')]==='Administrator'){logger[_0x9ec7('0x2e')](_0x9ec7('0x36'));user=_0x445cc6[_0x9ec7('0x38')];return user;}else{logger[_0x9ec7('0x39')](_0x9ec7('0x3a'),JSON['stringify'](_0x445cc6));throw new Error(_0x9ec7('0x3b')+JSON[_0x9ec7('0x3c')](_0x445cc6));}}}else{logger[_0x9ec7('0x39')](_0x9ec7('0x3a'),JSON[_0x9ec7('0x3c')](_0x445cc6));throw new Error(_0x9ec7('0x3b')+JSON[_0x9ec7('0x3c')](_0x445cc6));}})[_0x9ec7('0x2c')](function(_0x5341ed){console[_0x9ec7('0x39')](_0x5341ed);});}function getZohoUser(_0x15ae2e,_0xff2cad){return new BPromise(function(_0x3dbc0c,_0x570244){request(_0x15ae2e)[_0x9ec7('0x2a')](function(_0x19c765){var _0x23cefb=null;if(_0x19c765){_0x23cefb=_0x19c765[_0x9ec7('0x3d')][0x0];_0x23cefb[_0x9ec7('0x3e')]=_0xff2cad;}_0x3dbc0c(_0x23cefb);})[_0x9ec7('0x2c')](function(_0x18e665){_0x570244(_0x18e665);});});}function createEndUser(_0x5d546a,_0x3b8ec8,_0x187288,_0x123312,_0x7c711f,_0x4902e0){var _0x187288=getName(_0x187288);return request({'method':_0x9ec7('0x3f'),'uri':_0x9ec7('0x40')+_0x3b8ec8+_0x9ec7('0x41')+_[_0x9ec7('0x42')](_0x4902e0[_0x9ec7('0x43')])+'s','body':{'data':[{'Last_Name':_0x187288[0x1],'First_Name':_0x187288[0x0],'Phone':_0x123312,'Owner':{'name':!_[_0x9ec7('0x1c')](_0x7c711f[_0x9ec7('0x44')][_0x9ec7('0x18')])?_0x7c711f[_0x9ec7('0x44')][_0x9ec7('0x18')]:!_[_0x9ec7('0x1c')](_0x7c711f[_0x9ec7('0x45')])?_0x7c711f[_0x9ec7('0x45')]+'\x20'+_0x7c711f[_0x9ec7('0x46')]:_0x7c711f[_0x9ec7('0x46')],'id':_0x7c711f['id']}}]},'headers':{'Authorization':_0x9ec7('0x47')+_0x5d546a},'json':!![]})[_0x9ec7('0x2a')](function(_0x383b0f){if(_0x383b0f&&_0x383b0f[_0x9ec7('0x3d')][0x0]['code']===_0x9ec7('0x48')){var _0x486b27=_0x383b0f['data'][0x0][_0x9ec7('0x49')];_0x486b27[_0x9ec7('0x3e')]=_[_0x9ec7('0x42')](_0x4902e0[_0x9ec7('0x43')])+'s';return _0x486b27;}logger[_0x9ec7('0x39')](_0x9ec7('0x3a'),JSON[_0x9ec7('0x3c')](data));throw new Error(_0x9ec7('0x4a')+JSON[_0x9ec7('0x3c')](data));})[_0x9ec7('0x2c')](function(_0xbb9f0e){console[_0x9ec7('0x4b')](_0x9ec7('0x4c'),_0xbb9f0e);});}function getEndUser(_0x114cfa,_0x23f77c,_0x1f7aff,_0x46d229,_0x579cb6,_0x42e4d9,_0x523cb1){var _0x1549a8={'method':_0x9ec7('0x30'),'uri':'','headers':{'Authorization':_0x9ec7('0x47')+_0x114cfa},'json':!![]};switch(_0x523cb1['moduleSearch']){case'contact_lead':_0x1549a8[_0x9ec7('0x4d')]=_0x9ec7('0x40')+_0x23f77c+'/crm/v2/Contacts/search?criteria=((Phone:equals:'+_0x579cb6+'))';return getZohoUser(_0x1549a8,_0x9ec7('0x4e'))[_0x9ec7('0x2a')](function(_0xab0c07){if(_0xab0c07)return _0xab0c07;_0x1549a8[_0x9ec7('0x4d')]=_0x9ec7('0x40')+_0x23f77c+_0x9ec7('0x4f')+_0x579cb6+'))';return getZohoUser(_0x1549a8,'Leads')[_0x9ec7('0x2a')](function(_0x44ca07){if(_0x44ca07)return _0x44ca07;if(_0x523cb1['moduleCreate']!=_0x9ec7('0x50')){return createEndUser(_0x114cfa,_0x23f77c,_0x46d229,_0x579cb6,_0x42e4d9,_0x523cb1);}else{return{};}});});break;case'contact':_0x1549a8['uri']='https://www.zohoapis.'+_0x23f77c+_0x9ec7('0x51')+_0x579cb6+'))';return getZohoUser(_0x1549a8,_0x9ec7('0x4e'))[_0x9ec7('0x2a')](function(_0x3db754){if(_0x3db754)return _0x3db754;if(_0x523cb1[_0x9ec7('0x43')]!=_0x9ec7('0x50')){return createEndUser(_0x114cfa,_0x23f77c,_0x46d229,_0x579cb6,_0x42e4d9,_0x523cb1);}else{return{};}});break;case _0x9ec7('0x52'):_0x1549a8['uri']='https://www.zohoapis.'+_0x23f77c+_0x9ec7('0x4f')+_0x579cb6+'))';return getZohoUser(_0x1549a8,_0x9ec7('0x53'))[_0x9ec7('0x2a')](function(_0xab0861){if(_0xab0861)return _0xab0861;if(_0x523cb1['moduleCreate']!='nothing'){return createEndUser(_0x114cfa,_0x23f77c,_0x46d229,_0x579cb6,_0x42e4d9,_0x523cb1);}else{return{};}});break;}}function getCall(_0x44b392,_0x599263,_0x2be51e,_0x2c8636,_0x3fcd2f,_0x1ab6d6,_0x27159b,_0x46f090){logger['info'](_0x9ec7('0x54'));var _0xf4940f={};_0xf4940f[_0x9ec7('0x55')]={'name':!_[_0x9ec7('0x1c')](_0x2c8636[_0x9ec7('0x44')][_0x9ec7('0x18')])&&!_[_0x9ec7('0x1c')](_0x2c8636[_0x9ec7('0x37')]['name'])&&_0x2c8636[_0x9ec7('0x37')][_0x9ec7('0x18')]==='administrator'?_0x2c8636[_0x9ec7('0x44')][_0x9ec7('0x18')]:!_[_0x9ec7('0x1c')](_0x2c8636[_0x9ec7('0x45')])?_0x2c8636[_0x9ec7('0x45')]+'\x20'+_0x2c8636['last_name']:_0x2c8636[_0x9ec7('0x46')],'id':_0x2c8636['id']};_0xf4940f['Subject']=intUtil[_0x9ec7('0x56')](_0x1ab6d6[_0x9ec7('0x57')],_0x27159b,'\x20');_0xf4940f['Description']=intUtil[_0x9ec7('0x56')](_0x1ab6d6[_0x9ec7('0x58')],_0x27159b,'\x0a');if(_0x3fcd2f[_0x9ec7('0x3e')]==='Contacts'){_0xf4940f[_0x9ec7('0x59')]={'name':!_['isNil'](_0x3fcd2f[_0x9ec7('0x5a')])?_0x3fcd2f[_0x9ec7('0x5a')]:!_[_0x9ec7('0x1c')](_0x3fcd2f[_0x9ec7('0x5b')])?_0x3fcd2f[_0x9ec7('0x5b')]+'\x20'+_0x3fcd2f[_0x9ec7('0x5c')]:_0x3fcd2f['Last_Name'],'id':_0x3fcd2f['id']};}if(_0x3fcd2f[_0x9ec7('0x3e')]===_0x9ec7('0x53')){_0xf4940f[_0x9ec7('0x5d')]={'name':!_['isNil'](_0x3fcd2f[_0x9ec7('0x5a')])?_0x3fcd2f[_0x9ec7('0x5a')]:!_[_0x9ec7('0x1c')](_0x3fcd2f[_0x9ec7('0x5b')])?_0x3fcd2f[_0x9ec7('0x5b')]+'\x20'+_0x3fcd2f[_0x9ec7('0x5c')]:_0x3fcd2f['Last_Name'],'id':_0x3fcd2f['id']};_0xf4940f[_0x9ec7('0x5e')]=_['startCase'](_0x3fcd2f[_0x9ec7('0x3e')]);}if(_0x27159b[_0x9ec7('0x5f')]){_0xf4940f[_0x9ec7('0x60')]=moment[_0x9ec7('0x61')](parseInt(_0x27159b['talktime'])*0x3e8)[_0x9ec7('0x31')]('mm:ss');}else if(_0x27159b['answertime']&&_0x27159b[_0x9ec7('0x62')]){_0xf4940f[_0x9ec7('0x60')]=moment[_0x9ec7('0x61')](moment(_0x27159b[_0x9ec7('0x62')],_0x9ec7('0x63'))['diff'](moment(_0x27159b[_0x9ec7('0x64')],_0x9ec7('0x63'))))['format']('mm:ss');}switch(_0x27159b['lastevent']){case'called':_0xf4940f[_0x9ec7('0x65')]=_0x9ec7('0x66');break;case _0x9ec7('0x67'):case'connect':_0xf4940f['Call_Result']=_0x9ec7('0x68');break;case _0x9ec7('0x69'):_0xf4940f[_0x9ec7('0x65')]=_0x9ec7('0x6a');break;case _0x9ec7('0x6b'):_0xf4940f[_0x9ec7('0x65')]=_0x9ec7('0x6c');break;case'timeout':_0xf4940f[_0x9ec7('0x65')]=_0x9ec7('0x6d');default:}_0xf4940f[_0x9ec7('0x6e')]=(_0x46f090==='outbound'?moment(_0x27159b[_0x9ec7('0x64')])[_0x9ec7('0x31')](_0x9ec7('0x63')):moment(_0x27159b[_0x9ec7('0x6f')])[_0x9ec7('0x31')](_0x9ec7('0x63')))||moment()[_0x9ec7('0x31')](_0x9ec7('0x63'));_0xf4940f[_0x9ec7('0x70')]=_0x46f090||_0x9ec7('0x71');_0xf4940f=_['merge'](_0xf4940f,getCustomFields(_0x1ab6d6[_0x9ec7('0x72')],_0x27159b));return request({'method':'POST','uri':_0x9ec7('0x40')+_0x599263+_0x9ec7('0x73'),'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x44b392},'body':{'data':[_0xf4940f]},'json':!![]})[_0x9ec7('0x2a')](function(_0x9e29a7){if(_0x9e29a7&&_0x9e29a7[_0x9ec7('0x3d')][0x0][_0x9ec7('0x74')]===_0x9ec7('0x48')){logger[_0x9ec7('0x2e')](_0x9ec7('0x75'));return{'id':_0x9e29a7[_0x9ec7('0x3d')][0x0]['details']['id']};}})[_0x9ec7('0x2c')](function(_0x49fa62){logger[_0x9ec7('0x2e')]('err',_0x49fa62[_0x9ec7('0x76')]);console[_0x9ec7('0x4b')](_0x9ec7('0x77'),_0x49fa62);});}exports[_0x9ec7('0x78')]=function(_0x22ca3f,_0x24fd1c,_0x1a5a2a,_0x110d6c,_0x2c5c9a,_0xad8f4a){var _0x6b3f9,_0x27cd2d,_0x3fd718;_0xad8f4a[_0x9ec7('0x79')]=intUtil['stripTrailingSlash'](_0xad8f4a[_0x9ec7('0x79')]);_0xad8f4a[_0x9ec7('0x7a')]=intUtil[_0x9ec7('0x7b')](_0xad8f4a[_0x9ec7('0x7a')]);if(_0x2c5c9a&&_0x2c5c9a[_0x9ec7('0x7c')]){logger[_0x9ec7('0x2e')](_0x9ec7('0x7d'),_0x9ec7('0x7e'));_0x24fd1c[_0x9ec7('0x7f')]=_0xad8f4a[_0x9ec7('0x7a')]+_0x9ec7('0x80')+_0x24fd1c['uniqueid']+_0x9ec7('0x81')+md5(_0x24fd1c['uniqueid']);}else{_0x24fd1c[_0x9ec7('0x7f')]='';}var _0x2766d7=_0xad8f4a[_0x9ec7('0x79')]==='zoho.eu'?'eu':_0x9ec7('0x82');return getAccessToken(_0xad8f4a)[_0x9ec7('0x2a')](function(_0x15f87c){_0x3fd718=_0x15f87c;return getUser(_0x3fd718,_0x2766d7,_0xad8f4a,_0x110d6c[_0x9ec7('0x35')]);})[_0x9ec7('0x2a')](function(_0x34b384){_0x6b3f9=_0x34b384;logger[_0x9ec7('0x2e')](_0x9ec7('0x83'),_0x6b3f9['id']);return getEndUser(_0x3fd718,_0x2766d7,_0xad8f4a,_0x24fd1c[_0x9ec7('0x84')],_0x24fd1c[_0x9ec7('0x85')],_0x6b3f9,_0x1a5a2a);})[_0x9ec7('0x2a')](function(_0x4a4d65){_0x27cd2d=_0x4a4d65;return getCall(_0x3fd718,_0x2766d7,_0xad8f4a,_0x6b3f9,_0x27cd2d,_0x1a5a2a,_0x24fd1c,'Inbound');})[_0x9ec7('0x2a')](function(_0x50fa7f){if(_0x50fa7f){logger[_0x9ec7('0x2e')]('The\x20Call\x20ID\x20is:',_0x50fa7f['id']);logger[_0x9ec7('0x2e')]('[QUEUE]','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x9ec7('0x31')]('user:%s',_0x110d6c[_0x9ec7('0x18')]),_0x9ec7('0x86'),{'uri':_0x9ec7('0x87')+_0xad8f4a['host']+'/crm/EntityInfo.do?module=Calls&id='+_0x50fa7f['id']});}})[_0x9ec7('0x2c')](function(_0x5e2dd9){logger[_0x9ec7('0x39')](_0x9ec7('0x7d'),JSON[_0x9ec7('0x3c')](_0x5e2dd9));});};exports['outbound']=function(_0x1bc72a,_0x4f13ce,_0x5e8dd0,_0xb48eb6,_0x2a3b52,_0xa12306,_0x3b4865){var _0x5a2de7,_0x42e0cf,_0x457313;_0xa12306[_0x9ec7('0x79')]=intUtil['stripTrailingSlash'](_0xa12306[_0x9ec7('0x79')]);_0xa12306[_0x9ec7('0x7a')]=intUtil['stripTrailingSlash'](_0xa12306[_0x9ec7('0x7a')]);if(_0x3b4865&&_0x3b4865[_0x9ec7('0x88')]&&_0x3b4865[_0x9ec7('0x88')]!=='none'){logger[_0x9ec7('0x2e')](_0x9ec7('0x89'),'Recording\x20is\x20enabled!');_0x4f13ce[_0x9ec7('0x7f')]=_0xa12306['serverUrl']+_0x9ec7('0x80')+_0x4f13ce['uniqueid']+_0x9ec7('0x81')+md5(_0x4f13ce[_0x9ec7('0x8a')]);}var _0x4e1c5e=_0xa12306[_0x9ec7('0x79')]===_0x9ec7('0x8b')?'eu':_0x9ec7('0x82');return getAccessToken(_0xa12306)[_0x9ec7('0x2a')](function(_0x51b652){_0x457313=_0x51b652;return getUser(_0x457313,_0x4e1c5e,_0xa12306,_0xb48eb6[_0x9ec7('0x35')]);})['then'](function(_0x31a344){_0x5a2de7=_0x31a344;logger[_0x9ec7('0x2e')](_0x9ec7('0x83'),_0x5a2de7['id']);return getEndUser(_0x457313,_0x4e1c5e,_0xa12306,_0x4f13ce[_0x9ec7('0x8c')],_0x4f13ce[_0x9ec7('0x8d')],_0x5a2de7,_0x5e8dd0);})['then'](function(_0x263a00){_0x42e0cf=_0x263a00;return getCall(_0x457313,_0x4e1c5e,_0xa12306,_0x5a2de7,_0x42e0cf,_0x5e8dd0,_0x4f13ce,_0x9ec7('0x8e'));})[_0x9ec7('0x2a')](function(_0x598ff2){if(_0x598ff2){logger[_0x9ec7('0x2e')](_0x9ec7('0x8f'),_0x598ff2['id']);logger[_0x9ec7('0x2e')](_0x9ec7('0x89'),_0x9ec7('0x90'));emit(util[_0x9ec7('0x31')](_0x9ec7('0x91'),_0xb48eb6[_0x9ec7('0x18')]),_0x9ec7('0x86'),{'uri':_0x9ec7('0x87')+_0xa12306[_0x9ec7('0x79')]+_0x9ec7('0x92')+_0x598ff2['id']});}})['catch'](function(_0x43e4de){logger[_0x9ec7('0x39')]('[OUTBOUND]',JSON[_0x9ec7('0x3c')](_0x43e4de));});};exports['unmanaged']=function(_0x36ff66,_0x7adce0,_0xbc1dc0,_0xb8a242,_0x11ff64,_0x4d957c){var _0x225c4e,_0x461e72,_0xd2b5dc;_0x4d957c[_0x9ec7('0x79')]=intUtil[_0x9ec7('0x7b')](_0x4d957c[_0x9ec7('0x79')]);_0x4d957c['serverUrl']=intUtil[_0x9ec7('0x7b')](_0x4d957c[_0x9ec7('0x7a')]);if(_0x11ff64&&_0x11ff64[_0x9ec7('0x7c')]){logger['info']('['+_0x7adce0[_0x9ec7('0x93')][_0x9ec7('0x94')]()+']',_0x9ec7('0x7e'));_0x7adce0[_0x9ec7('0x7f')]=_0x4d957c['serverUrl']+_0x9ec7('0x80')+_0x7adce0[_0x9ec7('0x8a')]+'/downloads?type=uniqueid&token='+md5(_0x7adce0[_0x9ec7('0x8a')]);}else{_0x7adce0[_0x9ec7('0x7f')]='';}var _0x4b45c5=_0x4d957c['host']===_0x9ec7('0x8b')?'eu':_0x9ec7('0x82');return getAccessToken(_0x4d957c)[_0x9ec7('0x2a')](function(_0x31754a){_0xd2b5dc=_0x31754a;return getUser(_0xd2b5dc,_0x4b45c5,_0x4d957c);})[_0x9ec7('0x2a')](function(_0x3afdf1){_0x225c4e=_0x3afdf1;logger[_0x9ec7('0x2e')](_0x9ec7('0x83'),_0x225c4e['id']);return getEndUser(_0xd2b5dc,_0x4b45c5,_0x4d957c,_0x7adce0[_0x9ec7('0x84')],_0x7adce0[_0x9ec7('0x85')],_0x225c4e,_0xbc1dc0);})['then'](function(_0x156fa1){_0x461e72=_0x156fa1;return getCall(_0xd2b5dc,_0x4b45c5,_0x4d957c,_0x225c4e,_0x461e72,_0xbc1dc0,_0x7adce0,_0x9ec7('0x71'));})['then'](function(_0x3c910e){if(_0x3c910e){logger[_0x9ec7('0x2e')](_0x9ec7('0x8f'),_0x3c910e['id']);}})[_0x9ec7('0x2c')](function(_0x38b434){logger[_0x9ec7('0x39')]('['+_0x7adce0[_0x9ec7('0x93')][_0x9ec7('0x94')]()+']',JSON[_0x9ec7('0x3c')](_0x38b434));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/script/index.js b/server/services/ami/trigger/script/index.js index be7415b..78fb570 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 _0x9fbb=['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','shelljs','mustache','trigger','exec','data2','Script','render','data3','error'];(function(_0x21e0af,_0x176e49){var _0x57d906=function(_0x5f5949){while(--_0x5f5949){_0x21e0af['push'](_0x21e0af['shift']());}};_0x57d906(++_0x176e49);}(_0x9fbb,0xe1));var _0xb9fb=function(_0x4a8868,_0x40ca31){_0x4a8868=_0x4a8868-0x0;var _0x4d00c3=_0x9fbb[_0x4a8868];return _0x4d00c3;};'use strict';var util=require('util');var sh=require(_0xb9fb('0x0'));var Mustache=require(_0xb9fb('0x1'));var logger=require('../../../../config/logger')(_0xb9fb('0x2'));exports[_0xb9fb('0x3')]=function(_0x22a989,_0x49c67d){var _0x497059=_0x22a989[_0xb9fb('0x4')]?_0x22a989[_0xb9fb('0x4')]:_0xb9fb('0x5');var _0x1bf364=_0x22a989['data3']?Mustache[_0xb9fb('0x6')](_0x22a989[_0xb9fb('0x7')],_0x49c67d):_0x49c67d;sh['exec'](_0x1bf364,function(_0x3843c8,_0x22e595,_0x3a1d93){if(_0x3843c8!==0x0){logger[_0xb9fb('0x8')](util[_0xb9fb('0x9')](_0xb9fb('0xa'),_0x497059,_0x1bf364,_0x3843c8,_0x3a1d93));}else{logger[_0xb9fb('0xb')](util[_0xb9fb('0x9')](_0xb9fb('0xc'),_0x497059,_0x1bf364,_0x22e595));}});}; \ No newline at end of file +var _0xeaf4=['format','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s','info','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s','util','shelljs','mustache','../../../../config/logger','exec','data3','error'];(function(_0x18c0bc,_0x3d9186){var _0x440c03=function(_0x399a3f){while(--_0x399a3f){_0x18c0bc['push'](_0x18c0bc['shift']());}};_0x440c03(++_0x3d9186);}(_0xeaf4,0x1e8));var _0x4eaf=function(_0x35407f,_0x261d68){_0x35407f=_0x35407f-0x0;var _0x47ae44=_0xeaf4[_0x35407f];return _0x47ae44;};'use strict';var util=require(_0x4eaf('0x0'));var sh=require(_0x4eaf('0x1'));var Mustache=require(_0x4eaf('0x2'));var logger=require(_0x4eaf('0x3'))('trigger');exports[_0x4eaf('0x4')]=function(_0x32cd6c,_0x546613){var _0x376e82=_0x32cd6c['data2']?_0x32cd6c['data2']:'Script';var _0x5a9261=_0x32cd6c[_0x4eaf('0x5')]?Mustache['render'](_0x32cd6c[_0x4eaf('0x5')],_0x546613):_0x546613;sh['exec'](_0x5a9261,function(_0xbbe0e9,_0x406e10,_0x322135){if(_0xbbe0e9!==0x0){logger[_0x4eaf('0x6')](util[_0x4eaf('0x7')](_0x4eaf('0x8'),_0x376e82,_0x5a9261,_0xbbe0e9,_0x322135));}else{logger[_0x4eaf('0x9')](util[_0x4eaf('0x7')](_0x4eaf('0xa'),_0x376e82,_0x5a9261,_0x406e10));}});}; \ No newline at end of file diff --git a/server/services/ami/trigger/urlforward/index.js b/server/services/ami/trigger/urlforward/index.js index 2cfd7bc..a45a8ef 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 _0x0e57=['data7','parse','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','body','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','stringify','then',',\x20request\x20body:\x20','object','info','format','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','statusCode','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','name','message','request-promise','util','mustache','trigger','exec','data1','toUpperCase','render','data2','data5','number','data6','error','stack','GET','DELETE','POST','PUT'];(function(_0x1a72f3,_0x217011){var _0x57ef47=function(_0x20123d){while(--_0x20123d){_0x1a72f3['push'](_0x1a72f3['shift']());}};_0x57ef47(++_0x217011);}(_0x0e57,0xba));var _0x70e5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0e57[_0x3dd15e];return _0x231fd0;};'use strict';var rp=require(_0x70e5('0x0'));var util=require(_0x70e5('0x1'));var _=require('lodash');var Mustache=require(_0x70e5('0x2'));var logger=require('../../../../config/logger')(_0x70e5('0x3'));exports[_0x70e5('0x4')]=function(_0x27089a,_0x450cc7){var _0x1c436a,_0x1bd320;var _0x2ba915={'method':_0x27089a[_0x70e5('0x5')][_0x70e5('0x6')](),'uri':Mustache[_0x70e5('0x7')](_0x27089a[_0x70e5('0x8')],_0x450cc7),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x27089a[_0x70e5('0x9')])===_0x70e5('0xa')&&parseInt(_0x27089a[_0x70e5('0x9')])>=0x1&&parseInt(_0x27089a[_0x70e5('0x9')])<=0xa?parseInt(_0x27089a[_0x70e5('0x9')])*0x3e8:0x5*0x3e8};try{_0x2ba915['headers']=_0x27089a['data6']?JSON['parse'](Mustache[_0x70e5('0x7')](_0x27089a[_0x70e5('0xb')],_0x450cc7)):{};}catch(_0xacf144){logger[_0x70e5('0xc')](_0xacf144[_0x70e5('0xd')]);}switch(_0x27089a['data1']['toUpperCase']()){case _0x70e5('0xe'):case _0x70e5('0xf'):_0x1c436a=null;_0x2ba915['qs']=_0x450cc7;break;case _0x70e5('0x10'):case _0x70e5('0x11'):if(_0x27089a[_0x70e5('0x12')]){try{_0x1c436a=JSON[_0x70e5('0x13')](Mustache['render'](_0x27089a[_0x70e5('0x12')],_0x450cc7));_0x2ba915['body']=_0x1c436a;}catch(_0x53ece9){logger[_0x70e5('0xc')](_0x53ece9[_0x70e5('0xd')]);logger[_0x70e5('0xc')](_0x70e5('0x14'));}}else{_0x1c436a=_0x450cc7;_0x2ba915[_0x70e5('0x15')]=_0x1c436a;}break;}logger['info'](util['format'](_0x70e5('0x16'),_0x27089a[_0x70e5('0x5')],_0x27089a[_0x70e5('0x8')],JSON[_0x70e5('0x17')](_0x2ba915)));rp(_0x2ba915)[_0x70e5('0x18')](function(_0xb6f023){_0x1c436a=!_['isNil'](_0x1c436a)?_0x70e5('0x19')+_0x1c436a:'';_0x1bd320=typeof _0xb6f023['body']===_0x70e5('0x1a')?JSON['stringify'](_0xb6f023[_0x70e5('0x15')]):_0xb6f023['body'];logger[_0x70e5('0x1b')](util[_0x70e5('0x1c')](_0x70e5('0x1d'),_0x27089a[_0x70e5('0x5')],_0x27089a[_0x70e5('0x8')],_0xb6f023[_0x70e5('0x1e')],_0x1bd320));})['catch'](function(_0x3a051c){logger[_0x70e5('0xc')](util['format'](_0x70e5('0x1f'),_0x27089a[_0x70e5('0x5')],_0x27089a[_0x70e5('0x8')],_0x3a051c[_0x70e5('0x1e')],_0x3a051c[_0x70e5('0x20')],_0x3a051c[_0x70e5('0x21')]));});}; \ No newline at end of file +var _0xe918=['stack','toUpperCase','DELETE','POST','PUT','data7','body','error','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','info','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','stringify','then','isNil','object','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','statusCode','catch','name','request-promise','lodash','mustache','../../../../config/logger','trigger','exec','data1','render','data2','number','data5','headers','data6'];(function(_0x317935,_0x3a262b){var _0x2ea0a0=function(_0x40412a){while(--_0x40412a){_0x317935['push'](_0x317935['shift']());}};_0x2ea0a0(++_0x3a262b);}(_0xe918,0xfb));var _0x8e91=function(_0x3be86a,_0x4aff45){_0x3be86a=_0x3be86a-0x0;var _0x47c566=_0xe918[_0x3be86a];return _0x47c566;};'use strict';var rp=require(_0x8e91('0x0'));var util=require('util');var _=require(_0x8e91('0x1'));var Mustache=require(_0x8e91('0x2'));var logger=require(_0x8e91('0x3'))(_0x8e91('0x4'));exports[_0x8e91('0x5')]=function(_0x904529,_0x25dc2b){var _0xc830e9,_0x509057;var _0x330f25={'method':_0x904529[_0x8e91('0x6')]['toUpperCase'](),'uri':Mustache[_0x8e91('0x7')](_0x904529[_0x8e91('0x8')],_0x25dc2b),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x904529['data5'])===_0x8e91('0x9')&&parseInt(_0x904529[_0x8e91('0xa')])>=0x1&&parseInt(_0x904529['data5'])<=0xa?parseInt(_0x904529[_0x8e91('0xa')])*0x3e8:0x5*0x3e8};try{_0x330f25[_0x8e91('0xb')]=_0x904529[_0x8e91('0xc')]?JSON['parse'](Mustache[_0x8e91('0x7')](_0x904529['data6'],_0x25dc2b)):{};}catch(_0x12de5a){logger['error'](_0x12de5a[_0x8e91('0xd')]);}switch(_0x904529[_0x8e91('0x6')][_0x8e91('0xe')]()){case'GET':case _0x8e91('0xf'):_0xc830e9=null;_0x330f25['qs']=_0x25dc2b;break;case _0x8e91('0x10'):case _0x8e91('0x11'):if(_0x904529[_0x8e91('0x12')]){try{_0xc830e9=JSON['parse'](Mustache[_0x8e91('0x7')](_0x904529[_0x8e91('0x12')],_0x25dc2b));_0x330f25[_0x8e91('0x13')]=_0xc830e9;}catch(_0x4cd1d3){logger[_0x8e91('0x14')](_0x4cd1d3['stack']);logger['error'](_0x8e91('0x15'));}}else{_0xc830e9=_0x25dc2b;_0x330f25['body']=_0xc830e9;}break;}logger[_0x8e91('0x16')](util[_0x8e91('0x17')](_0x8e91('0x18'),_0x904529[_0x8e91('0x6')],_0x904529['data2'],JSON[_0x8e91('0x19')](_0x330f25)));rp(_0x330f25)[_0x8e91('0x1a')](function(_0x47ae4a){_0xc830e9=!_[_0x8e91('0x1b')](_0xc830e9)?',\x20request\x20body:\x20'+_0xc830e9:'';_0x509057=typeof _0x47ae4a[_0x8e91('0x13')]===_0x8e91('0x1c')?JSON[_0x8e91('0x19')](_0x47ae4a[_0x8e91('0x13')]):_0x47ae4a[_0x8e91('0x13')];logger['info'](util['format'](_0x8e91('0x1d'),_0x904529['data1'],_0x904529['data2'],_0x47ae4a[_0x8e91('0x1e')],_0x509057));})[_0x8e91('0x1f')](function(_0x13d926){logger[_0x8e91('0x14')](util['format']('%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s',_0x904529[_0x8e91('0x6')],_0x904529[_0x8e91('0x8')],_0x13d926[_0x8e91('0x1e')],_0x13d926[_0x8e91('0x20')],_0x13d926['message']));});}; \ No newline at end of file diff --git a/server/services/email/client.js b/server/services/email/client.js index eb63fe5..7e4c10f 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 _0xcda3=['http','Request','request','then','debug','rpc','error','message','result','jayson/promise','bluebird','../../config/logger','routing','client'];(function(_0xb742d8,_0x251713){var _0x34a4dc=function(_0xbc073){while(--_0xbc073){_0xb742d8['push'](_0xb742d8['shift']());}};_0x34a4dc(++_0x251713);}(_0xcda3,0x87));var _0x3cda=function(_0x184759,_0x1cc38a){_0x184759=_0x184759-0x0;var _0xf26d5f=_0xcda3[_0x184759];return _0xf26d5f;};'use strict';var jayson=require(_0x3cda('0x0'));var BPromise=require(_0x3cda('0x1'));var logger=require(_0x3cda('0x2'))(_0x3cda('0x3'));var client=jayson[_0x3cda('0x4')][_0x3cda('0x5')]({'port':0x2329});client[_0x3cda('0x6')]=function(_0x2704ef,_0x2e5e0d){return new BPromise(function(_0x48571f,_0xad796d){return client[_0x3cda('0x7')](_0x2704ef,_0x2e5e0d)[_0x3cda('0x8')](function(_0x1b8675){logger[_0x3cda('0x9')](_0x3cda('0xa'),_0x3cda('0x3'),_0x2704ef,_0x2e5e0d,_0x1b8675);if(_0x1b8675[_0x3cda('0xb')]){logger[_0x3cda('0xb')]('rpc','routing',_0x2704ef,_0x1b8675[_0x3cda('0xb')][_0x3cda('0xc')],_0x2e5e0d);return _0xad796d(_0x1b8675['error'][_0x3cda('0xc')]);}else{return _0x48571f(_0x1b8675[_0x3cda('0xd')]);}})['catch'](function(_0x221fab){logger[_0x3cda('0xb')](_0x3cda('0xa'),'routing',_0x2704ef,_0x221fab,_0x2e5e0d);return _0xad796d(_0x221fab);});});};module['exports']=client; \ No newline at end of file +var _0x3b24=['exports','jayson/promise','client','http','then','debug','rpc','routing','error','message','result','catch'];(function(_0x3a7438,_0x3d46c5){var _0xf0562c=function(_0x6dbb0b){while(--_0x6dbb0b){_0x3a7438['push'](_0x3a7438['shift']());}};_0xf0562c(++_0x3d46c5);}(_0x3b24,0xcd));var _0x43b2=function(_0xff00b2,_0x1d66c8){_0xff00b2=_0xff00b2-0x0;var _0x20864d=_0x3b24[_0xff00b2];return _0x20864d;};'use strict';var jayson=require(_0x43b2('0x0'));var BPromise=require('bluebird');var logger=require('../../config/logger')('routing');var client=jayson[_0x43b2('0x1')][_0x43b2('0x2')]({'port':0x2329});client['Request']=function(_0x349554,_0x1776db){return new BPromise(function(_0xfdebcd,_0x4c70c1){return client['request'](_0x349554,_0x1776db)[_0x43b2('0x3')](function(_0x3d28ed){logger[_0x43b2('0x4')](_0x43b2('0x5'),_0x43b2('0x6'),_0x349554,_0x1776db,_0x3d28ed);if(_0x3d28ed[_0x43b2('0x7')]){logger['error'](_0x43b2('0x5'),_0x43b2('0x6'),_0x349554,_0x3d28ed[_0x43b2('0x7')]['message'],_0x1776db);return _0x4c70c1(_0x3d28ed['error'][_0x43b2('0x8')]);}else{return _0xfdebcd(_0x3d28ed[_0x43b2('0x9')]);}})[_0x43b2('0xa')](function(_0x598dd4){logger[_0x43b2('0x7')](_0x43b2('0x5'),'routing',_0x349554,_0x598dd4,_0x1776db);return _0x4c70c1(_0x598dd4);});});};module[_0x43b2('0xb')]=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index 6f3358b..420dd5a 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 _0x283b=['bluebird','./server','./realtime','./lib/email','./rpc/mailAccount','./rpc/setting','resolve','then','mailAccounts','listen','getSettings','loginMailFrequency','catch','log'];(function(_0x540231,_0x117b98){var _0x31334b=function(_0xd90d86){while(--_0xd90d86){_0x540231['push'](_0x540231['shift']());}};_0x31334b(++_0x117b98);}(_0x283b,0x188));var _0xb283=function(_0x2c5f88,_0x1eb54b){_0x2c5f88=_0x2c5f88-0x0;var _0x2cad9d=_0x283b[_0x2c5f88];return _0x2cad9d;};'use strict';var BPromise=require(_0xb283('0x0'));var server=require(_0xb283('0x1'));var Realtime=require(_0xb283('0x2'));var EmailChannel=require(_0xb283('0x3'));var mailAccount=require(_0xb283('0x4'));var setting=require(_0xb283('0x5'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return BPromise[_0xb283('0x6')]()[_0xb283('0x7')](mailAccount['getMailAccounts']())['then'](realtime['initMailAccounts']())['then'](function(){email['refresh'](realtime[_0xb283('0x8')]);return realtime;});}function main(){return server[_0xb283('0x9')](realtime,email)['then'](function(){return initRealtime();})['then'](function(){return setting[_0xb283('0xa')]();})[_0xb283('0x7')](function(_0x3338b5){return setInterval(initRealtime,_0x3338b5[_0xb283('0xb')]*0x3e8);})[_0xb283('0xc')](function(_0x4043ea){console[_0xb283('0xd')](_0x4043ea);});}main(); \ No newline at end of file +var _0x3cd0=['refresh','mailAccounts','listen','getSettings','loginMailFrequency','catch','bluebird','./lib/email','./rpc/setting','resolve','then','getMailAccounts'];(function(_0x5f09c5,_0x2bfca0){var _0x426ad9=function(_0x18fe5f){while(--_0x18fe5f){_0x5f09c5['push'](_0x5f09c5['shift']());}};_0x426ad9(++_0x2bfca0);}(_0x3cd0,0x8a));var _0x03cd=function(_0x17b6e3,_0x4522ed){_0x17b6e3=_0x17b6e3-0x0;var _0x3906f3=_0x3cd0[_0x17b6e3];return _0x3906f3;};'use strict';var BPromise=require(_0x03cd('0x0'));var server=require('./server');var Realtime=require('./realtime');var EmailChannel=require(_0x03cd('0x1'));var mailAccount=require('./rpc/mailAccount');var setting=require(_0x03cd('0x2'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return BPromise[_0x03cd('0x3')]()[_0x03cd('0x4')](mailAccount[_0x03cd('0x5')]())[_0x03cd('0x4')](realtime['initMailAccounts']())[_0x03cd('0x4')](function(){email[_0x03cd('0x6')](realtime[_0x03cd('0x7')]);return realtime;});}function main(){return server[_0x03cd('0x8')](realtime,email)[_0x03cd('0x4')](function(){return initRealtime();})['then'](function(){return setting[_0x03cd('0x9')]();})['then'](function(_0x1b3936){return setInterval(initRealtime,_0x1b3936[_0x03cd('0xa')]*0x3e8);})[_0x03cd('0xb')](function(_0x1a80da){console['log'](_0x1a80da);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index 593f64c..bbb9a03 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 _0x482b=['smtp','prototype','emit','key','active','Imap','messageStatus','total','stringify','refresh','hasOwnProperty','handleImapBox','bind','handleImapEmail','end','handleImapEnd','error','handleImapError','status','disabled','connected','name','messages','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','lastName','from','notify','then','Mail\x20accepted\x20from\x20routing','catch','Mail\x20not\x20accepted\x20from\x20routing\x20%s','sendMail','verifySmtp','isNil','Smtp','verify','verified','lodash','moment','bluebird','md5','ioredis','../../../config/environment','email','redis','defaults','localhost','socket.io-emitter','info','start\x20email\x20channel','mailAccounts','imapAccounts'];(function(_0x1a19e8,_0x3f733a){var _0x17f9a8=function(_0x34b843){while(--_0x34b843){_0x1a19e8['push'](_0x1a19e8['shift']());}};_0x17f9a8(++_0x3f733a);}(_0x482b,0x164));var _0xb482=function(_0x3de39a,_0x28e424){_0x3de39a=_0x3de39a-0x0;var _0x410ab2=_0x482b[_0x3de39a];return _0x410ab2;};'use strict';var _=require(_0xb482('0x0'));var moment=require(_0xb482('0x1'));var BPromise=require(_0xb482('0x2'));var md5=require(_0xb482('0x3'));var Redis=require(_0xb482('0x4'));var config=require(_0xb482('0x5'));var logger=require('../../../config/logger')(_0xb482('0x6'));config[_0xb482('0x7')]=_[_0xb482('0x8')](config[_0xb482('0x7')],{'host':_0xb482('0x9'),'port':0x18eb});var io=require(_0xb482('0xa'))(new Redis(config['redis']));var EmailImap=require('./imap');var EmailSmtp=require('./smtp');var mailAccount=require('../rpc/mailAccount');var md5Accounts={};function EmailChannel(_0x10798a){logger[_0xb482('0xb')](_0xb482('0xc'));this[_0xb482('0xd')]=_0x10798a[_0xb482('0xd')];this[_0xb482('0xe')]={};this[_0xb482('0xf')]=new EmailSmtp();}EmailChannel[_0xb482('0x10')][_0xb482('0x11')]=function(_0x36d800){var _0x36ffed=this[_0xb482('0xd')][_0x36d800];var _0x1419ec={'id':_0x36ffed['id'],'name':_0x36ffed['name'],'key':_0x36ffed[_0xb482('0x12')],'active':_0x36ffed[_0xb482('0x13')],'Imap':{'status':_0x36ffed[_0xb482('0x14')]['status'],'messageStatus':_0x36ffed[_0xb482('0x14')][_0xb482('0x15')],'total':_0x36ffed[_0xb482('0x14')][_0xb482('0x16')]}};if(_['isNil'](md5Accounts[_0x36d800])){md5Accounts[_0x36d800]={};}var _0x2aa4a0=md5(JSON[_0xb482('0x17')](_0x1419ec));if(md5Accounts[_0x36d800][_0xb482('0x3')]!==_0x2aa4a0){md5Accounts[_0x36d800][_0xb482('0x3')]=_0x2aa4a0;io[_0xb482('0x11')]('mailAccount:update',_0x1419ec);}};EmailChannel[_0xb482('0x10')][_0xb482('0x18')]=function(_0x34c304){for(var _0x29a0b4 in _0x34c304){if(_0x34c304[_0xb482('0x19')](_0x29a0b4)){if(_0x34c304[_0x29a0b4][_0xb482('0x14')]&&_0x34c304[_0x29a0b4][_0xb482('0x13')]){var _0x1fa6a0=_0x34c304[_0x29a0b4][_0xb482('0x14')];if(!this[_0xb482('0xe')][_0xb482('0x19')](_0x1fa6a0['id'])){this[_0xb482('0xe')][_0x1fa6a0['id']]=new EmailImap(_0x1fa6a0,_0x34c304[_0x29a0b4][_0xb482('0x6')]);this['imapAccounts'][_0x1fa6a0['id']]['on']('box',this[_0xb482('0x1a')][_0xb482('0x1b')](this,_0x29a0b4));this[_0xb482('0xe')][_0x1fa6a0['id']]['on'](_0xb482('0x6'),this[_0xb482('0x1c')][_0xb482('0x1b')](this,_0x29a0b4));this[_0xb482('0xe')][_0x1fa6a0['id']]['on'](_0xb482('0x1d'),this[_0xb482('0x1e')][_0xb482('0x1b')](this,_0x29a0b4));this['imapAccounts'][_0x1fa6a0['id']]['on'](_0xb482('0x1f'),this[_0xb482('0x20')][_0xb482('0x1b')](this,_0x29a0b4));}}else{if(_['isNil'](this[_0xb482('0xd')][_0x29a0b4]['Imap'])){this['mailAccounts'][_0x29a0b4][_0xb482('0x14')]={};}this[_0xb482('0xd')][_0x29a0b4][_0xb482('0x14')][_0xb482('0x21')]=_0xb482('0x22');this[_0xb482('0xd')][_0x29a0b4][_0xb482('0x14')][_0xb482('0x15')]='';this['emit'](_0x29a0b4);}}}};EmailChannel['prototype'][_0xb482('0x1a')]=function(_0x3a524f,_0xc29999){if(this['mailAccounts'][_0x3a524f]){this['mailAccounts'][_0x3a524f][_0xb482('0x14')][_0xb482('0x21')]=_0xb482('0x23');this[_0xb482('0xd')][_0x3a524f][_0xb482('0x14')][_0xb482('0x15')]=_0xc29999[_0xb482('0x24')];if(_0xc29999[_0xb482('0x25')]){this[_0xb482('0xd')][_0x3a524f][_0xb482('0x14')][_0xb482('0x16')]=_0xc29999[_0xb482('0x25')][_0xb482('0x16')];}return this[_0xb482('0x11')](_0x3a524f);}};EmailChannel[_0xb482('0x10')][_0xb482('0x1c')]=function(_0x3217d1,_0x37d3b9){logger[_0xb482('0xb')](_0xb482('0x26'),_0x37d3b9[_0xb482('0x27')],_0x37d3b9[_0xb482('0x28')],_0x37d3b9[_0xb482('0x29')],_0x3217d1);if(this['mailAccounts'][_0x3217d1]){return mailAccount[_0xb482('0x2a')](_0x3217d1,_0x37d3b9)[_0xb482('0x2b')](function(_0x3de999){if(_0x3de999){logger[_0xb482('0xb')](_0xb482('0x2c'));}})[_0xb482('0x2d')](function(_0x454caa){logger[_0xb482('0x1f')](_0xb482('0x2e'),JSON[_0xb482('0x17')](_0x454caa));});}};EmailChannel[_0xb482('0x10')][_0xb482('0x1e')]=function(_0x12f435){if(this['mailAccounts'][_0x12f435]&&this[_0xb482('0xd')][_0x12f435][_0xb482('0x14')]){if(this[_0xb482('0xe')][this['mailAccounts'][_0x12f435]['Imap']['id']]){delete this['imapAccounts'][this[_0xb482('0xd')][_0x12f435][_0xb482('0x14')]['id']];}this['mailAccounts'][_0x12f435][_0xb482('0x14')]['lastSync']=moment();this[_0xb482('0x11')](_0x12f435);}};EmailChannel[_0xb482('0x10')][_0xb482('0x20')]=function(_0x53eb10,_0x307da2){if(this[_0xb482('0xd')][_0x53eb10]){this[_0xb482('0xd')][_0x53eb10][_0xb482('0x14')][_0xb482('0x21')]='error';this['mailAccounts'][_0x53eb10][_0xb482('0x14')][_0xb482('0x15')]=_0x307da2;return this[_0xb482('0x11')](_0x53eb10);}};EmailChannel[_0xb482('0x10')][_0xb482('0x2f')]=function(_0x2c01db,_0x2906d8){return this['smtp']['send'](_0x2c01db,_0x2906d8);};EmailChannel[_0xb482('0x10')][_0xb482('0x30')]=function(_0x2b9156){var _0x137762=this;if(this['mailAccounts'][_0x2b9156['id']]){if(_[_0xb482('0x31')](this['mailAccounts'][_0x2b9156['id']][_0xb482('0x32')])){this['mailAccounts'][_0x2b9156['id']]['Smtp']={};}this[_0xb482('0xd')][_0x2b9156['id']][_0xb482('0x32')]['lastSync']=moment();return new BPromise(function(_0x466e36,_0x14844a){return _0x137762[_0xb482('0xf')][_0xb482('0x33')](_0x2b9156)['then'](function(_0x3d3eaa){_0x137762[_0xb482('0xd')][_0x2b9156['id']][_0xb482('0x32')][_0xb482('0x21')]=_0xb482('0x34');_0x137762[_0xb482('0xd')][_0x2b9156['id']][_0xb482('0x32')][_0xb482('0x15')]='';_0x137762[_0xb482('0x11')](_0x2b9156['id']);_0x466e36(_0x3d3eaa);})[_0xb482('0x2d')](function(_0x196421){_0x137762[_0xb482('0xd')][_0x2b9156['id']][_0xb482('0x32')][_0xb482('0x21')]=_0xb482('0x1f');_0x137762['mailAccounts'][_0x2b9156['id']][_0xb482('0x32')]['messageStatus']=_0x196421;_0x137762['emit'](_0x2b9156['id']);_0x14844a(_0x196421);});});}return this[_0xb482('0xf')]['verify'](_0x2b9156);};module['exports']=EmailChannel; \ No newline at end of file +var _0xf88f=['defaults','localhost','socket.io-emitter','./smtp','info','start\x20email\x20channel','mailAccounts','imapAccounts','smtp','prototype','emit','name','key','active','Imap','status','messageStatus','total','isNil','stringify','mailAccount:update','refresh','hasOwnProperty','box','handleImapBox','bind','handleImapEmail','handleImapEnd','error','disabled','messages','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','from','notify','then','Mail\x20accepted\x20from\x20routing','catch','Mail\x20not\x20accepted\x20from\x20routing\x20%s','lastSync','handleImapError','send','verifySmtp','Smtp','verify','exports','lodash','moment','bluebird','md5','ioredis','../../../config/environment','email','redis'];(function(_0x37f8b0,_0x2da2c3){var _0x3896c5=function(_0x2fe426){while(--_0x2fe426){_0x37f8b0['push'](_0x37f8b0['shift']());}};_0x3896c5(++_0x2da2c3);}(_0xf88f,0x106));var _0xff88=function(_0x4bea5b,_0x1f003f){_0x4bea5b=_0x4bea5b-0x0;var _0x4bbf49=_0xf88f[_0x4bea5b];return _0x4bbf49;};'use strict';var _=require(_0xff88('0x0'));var moment=require(_0xff88('0x1'));var BPromise=require(_0xff88('0x2'));var md5=require(_0xff88('0x3'));var Redis=require(_0xff88('0x4'));var config=require(_0xff88('0x5'));var logger=require('../../../config/logger')(_0xff88('0x6'));config[_0xff88('0x7')]=_[_0xff88('0x8')](config[_0xff88('0x7')],{'host':_0xff88('0x9'),'port':0x18eb});var io=require(_0xff88('0xa'))(new Redis(config[_0xff88('0x7')]));var EmailImap=require('./imap');var EmailSmtp=require(_0xff88('0xb'));var mailAccount=require('../rpc/mailAccount');var md5Accounts={};function EmailChannel(_0x15da7a){logger[_0xff88('0xc')](_0xff88('0xd'));this['mailAccounts']=_0x15da7a[_0xff88('0xe')];this[_0xff88('0xf')]={};this[_0xff88('0x10')]=new EmailSmtp();}EmailChannel[_0xff88('0x11')][_0xff88('0x12')]=function(_0x5c9756){var _0x15a726=this[_0xff88('0xe')][_0x5c9756];var _0x25987a={'id':_0x15a726['id'],'name':_0x15a726[_0xff88('0x13')],'key':_0x15a726[_0xff88('0x14')],'active':_0x15a726[_0xff88('0x15')],'Imap':{'status':_0x15a726[_0xff88('0x16')][_0xff88('0x17')],'messageStatus':_0x15a726[_0xff88('0x16')][_0xff88('0x18')],'total':_0x15a726[_0xff88('0x16')][_0xff88('0x19')]}};if(_[_0xff88('0x1a')](md5Accounts[_0x5c9756])){md5Accounts[_0x5c9756]={};}var _0x215e69=md5(JSON[_0xff88('0x1b')](_0x25987a));if(md5Accounts[_0x5c9756][_0xff88('0x3')]!==_0x215e69){md5Accounts[_0x5c9756][_0xff88('0x3')]=_0x215e69;io[_0xff88('0x12')](_0xff88('0x1c'),_0x25987a);}};EmailChannel[_0xff88('0x11')][_0xff88('0x1d')]=function(_0x41e894){for(var _0x552991 in _0x41e894){if(_0x41e894[_0xff88('0x1e')](_0x552991)){if(_0x41e894[_0x552991][_0xff88('0x16')]&&_0x41e894[_0x552991]['active']){var _0x1923e4=_0x41e894[_0x552991][_0xff88('0x16')];if(!this[_0xff88('0xf')][_0xff88('0x1e')](_0x1923e4['id'])){this[_0xff88('0xf')][_0x1923e4['id']]=new EmailImap(_0x1923e4,_0x41e894[_0x552991][_0xff88('0x6')]);this[_0xff88('0xf')][_0x1923e4['id']]['on'](_0xff88('0x1f'),this[_0xff88('0x20')][_0xff88('0x21')](this,_0x552991));this[_0xff88('0xf')][_0x1923e4['id']]['on'](_0xff88('0x6'),this[_0xff88('0x22')][_0xff88('0x21')](this,_0x552991));this[_0xff88('0xf')][_0x1923e4['id']]['on']('end',this[_0xff88('0x23')][_0xff88('0x21')](this,_0x552991));this[_0xff88('0xf')][_0x1923e4['id']]['on'](_0xff88('0x24'),this['handleImapError'][_0xff88('0x21')](this,_0x552991));}}else{if(_[_0xff88('0x1a')](this[_0xff88('0xe')][_0x552991][_0xff88('0x16')])){this[_0xff88('0xe')][_0x552991][_0xff88('0x16')]={};}this[_0xff88('0xe')][_0x552991]['Imap'][_0xff88('0x17')]=_0xff88('0x25');this[_0xff88('0xe')][_0x552991][_0xff88('0x16')]['messageStatus']='';this[_0xff88('0x12')](_0x552991);}}}};EmailChannel[_0xff88('0x11')]['handleImapBox']=function(_0x434425,_0x4ed206){if(this['mailAccounts'][_0x434425]){this[_0xff88('0xe')][_0x434425][_0xff88('0x16')]['status']='connected';this['mailAccounts'][_0x434425][_0xff88('0x16')]['messageStatus']=_0x4ed206[_0xff88('0x13')];if(_0x4ed206[_0xff88('0x26')]){this[_0xff88('0xe')][_0x434425]['Imap'][_0xff88('0x19')]=_0x4ed206['messages'][_0xff88('0x19')];}return this[_0xff88('0x12')](_0x434425);}};EmailChannel['prototype'][_0xff88('0x22')]=function(_0x1575e9,_0x4493c7){logger[_0xff88('0xc')](_0xff88('0x27'),_0x4493c7[_0xff88('0x28')],_0x4493c7['lastName'],_0x4493c7[_0xff88('0x29')],_0x1575e9);if(this[_0xff88('0xe')][_0x1575e9]){return mailAccount[_0xff88('0x2a')](_0x1575e9,_0x4493c7)[_0xff88('0x2b')](function(_0x29460b){if(_0x29460b){logger[_0xff88('0xc')](_0xff88('0x2c'));}})[_0xff88('0x2d')](function(_0x2b79ff){logger[_0xff88('0x24')](_0xff88('0x2e'),JSON['stringify'](_0x2b79ff));});}};EmailChannel[_0xff88('0x11')][_0xff88('0x23')]=function(_0x4532c9){if(this[_0xff88('0xe')][_0x4532c9]&&this[_0xff88('0xe')][_0x4532c9][_0xff88('0x16')]){if(this[_0xff88('0xf')][this[_0xff88('0xe')][_0x4532c9][_0xff88('0x16')]['id']]){delete this['imapAccounts'][this[_0xff88('0xe')][_0x4532c9][_0xff88('0x16')]['id']];}this[_0xff88('0xe')][_0x4532c9]['Imap'][_0xff88('0x2f')]=moment();this[_0xff88('0x12')](_0x4532c9);}};EmailChannel[_0xff88('0x11')][_0xff88('0x30')]=function(_0x3e9b9c,_0x1c97f3){if(this['mailAccounts'][_0x3e9b9c]){this[_0xff88('0xe')][_0x3e9b9c]['Imap']['status']='error';this['mailAccounts'][_0x3e9b9c][_0xff88('0x16')][_0xff88('0x18')]=_0x1c97f3;return this[_0xff88('0x12')](_0x3e9b9c);}};EmailChannel['prototype']['sendMail']=function(_0x47555b,_0x72742e){return this[_0xff88('0x10')][_0xff88('0x31')](_0x47555b,_0x72742e);};EmailChannel[_0xff88('0x11')][_0xff88('0x32')]=function(_0x5001ac){var _0x4a4273=this;if(this[_0xff88('0xe')][_0x5001ac['id']]){if(_['isNil'](this[_0xff88('0xe')][_0x5001ac['id']][_0xff88('0x33')])){this[_0xff88('0xe')][_0x5001ac['id']][_0xff88('0x33')]={};}this[_0xff88('0xe')][_0x5001ac['id']][_0xff88('0x33')][_0xff88('0x2f')]=moment();return new BPromise(function(_0x44ecc1,_0x2753b7){return _0x4a4273[_0xff88('0x10')][_0xff88('0x34')](_0x5001ac)['then'](function(_0x42356d){_0x4a4273[_0xff88('0xe')][_0x5001ac['id']][_0xff88('0x33')][_0xff88('0x17')]='verified';_0x4a4273[_0xff88('0xe')][_0x5001ac['id']]['Smtp']['messageStatus']='';_0x4a4273[_0xff88('0x12')](_0x5001ac['id']);_0x44ecc1(_0x42356d);})[_0xff88('0x2d')](function(_0xc23d2d){_0x4a4273[_0xff88('0xe')][_0x5001ac['id']][_0xff88('0x33')]['status']='error';_0x4a4273[_0xff88('0xe')][_0x5001ac['id']][_0xff88('0x33')][_0xff88('0x18')]=_0xc23d2d;_0x4a4273[_0xff88('0x12')](_0x5001ac['id']);_0x2753b7(_0xc23d2d);});});}return this[_0xff88('0x10')][_0xff88('0x34')](_0x5001ac);};module[_0xff88('0x35')]=EmailChannel; \ No newline at end of file diff --git a/server/services/email/lib/imap.js b/server/services/email/lib/imap.js index 1bf239b..5069226 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 _0x0439=['handleError','inherits','prototype','connTimeout','authTimeout','isNil','service','authentication','user','password','port','tls','autotls','host','getHost','anonymous@xcally.com','openBox','handleOpenBox','emit','box','readUnseen','search','UNSEEN','handleReadUnseen','length','fetch','handleFetchMessage','closeBox','handleCloseBox','body','handleMessageBody','handleMessageAttributes','handleMessageEnd','handleSimpleParser','parser','email','handleFetchError','stringify','textCode','upperFirst','exports','path','util','imap','lodash','randomstring','mailparser','simpleParser','Iconv','events','EventEmitter','../../../config/logger','mailbox','account','once','ready','handleReady','end','bind','error'];(function(_0x3fd06c,_0x110ec5){var _0x48942a=function(_0x543d75){while(--_0x543d75){_0x3fd06c['push'](_0x3fd06c['shift']());}};_0x48942a(++_0x110ec5);}(_0x0439,0xdd));var _0x9043=function(_0x4607e1,_0x596f78){_0x4607e1=_0x4607e1-0x0;var _0x22f1b2=_0x0439[_0x4607e1];return _0x22f1b2;};'use strict';var fs=require('fs');var path=require(_0x9043('0x0'));var util=require(_0x9043('0x1'));var Imap=require(_0x9043('0x2'));var _=require(_0x9043('0x3'));var rs=require(_0x9043('0x4'));var simpleParser=require(_0x9043('0x5'))[_0x9043('0x6')];var Iconv=require('iconv')[_0x9043('0x7')];var EventEmitter=require(_0x9043('0x8'))[_0x9043('0x9')];var utils=require('./utils');var logger=require(_0x9043('0xa'))('email');function EmailImap(_0x4f79c2,_0x2fe4da){this[_0x9043('0xb')]='INBOX';this[_0x9043('0xc')]=this['getAccount'](_0x4f79c2,_0x2fe4da);this[_0x9043('0x2')]=new Imap(this[_0x9043('0xc')]);this['imap'][_0x9043('0xd')](_0x9043('0xe'),this[_0x9043('0xf')]['bind'](this));this['imap'][_0x9043('0xd')](_0x9043('0x10'),this['handleEnd'][_0x9043('0x11')](this));this[_0x9043('0x2')]['on'](_0x9043('0x12'),this[_0x9043('0x13')][_0x9043('0x11')](this));this[_0x9043('0x2')]['connect']();}util[_0x9043('0x14')](EmailImap,EventEmitter);EmailImap[_0x9043('0x15')]['getAccount']=function(_0x18f916,_0xe65772){var _0x5249d9={'connTimeout':_0x18f916[_0x9043('0x16')]?_0x18f916[_0x9043('0x16')]*0x3e8:0x2710,'authTimeout':_0x18f916[_0x9043('0x17')]?_0x18f916[_0x9043('0x17')]*0x3e8:0x1388};if(_[_0x9043('0x18')](_0x18f916[_0x9043('0x19')])){if(_0x18f916[_0x9043('0x1a')]){_0x5249d9[_0x9043('0x1b')]=_0x18f916[_0x9043('0x1b')];_0x5249d9[_0x9043('0x1c')]=_0x18f916['password'];}_0x5249d9['host']=_0x18f916['host'];_0x5249d9[_0x9043('0x1d')]=_0x18f916[_0x9043('0x1d')]||0x3e1;if(_0x18f916[_0x9043('0x1e')]){_0x5249d9[_0x9043('0x1e')]=!![];}else{_0x5249d9['tls']=![];_0x5249d9[_0x9043('0x1f')]='required';}}else{_0x5249d9['user']=_0x18f916[_0x9043('0x1b')];_0x5249d9[_0x9043('0x1c')]=_0x18f916[_0x9043('0x1c')];_0x5249d9[_0x9043('0x20')]=utils[_0x9043('0x21')](_0x18f916[_0x9043('0x19')]);_0x5249d9[_0x9043('0x1d')]=0x3e1;_0x5249d9[_0x9043('0x1e')]=!![];}_0x5249d9['email']=_0xe65772||_0x18f916[_0x9043('0x1b')]||_0x9043('0x22');return _0x5249d9;};EmailImap[_0x9043('0x15')]['handleReady']=function(){this[_0x9043('0x2')][_0x9043('0x23')](this[_0x9043('0xb')],![],this[_0x9043('0x24')][_0x9043('0x11')](this));};EmailImap['prototype'][_0x9043('0x24')]=function(_0xca0bb1,_0x6d23af){if(_0xca0bb1){this[_0x9043('0x13')](_0xca0bb1,!![]);}else{this[_0x9043('0x25')](_0x9043('0x26'),_0x6d23af);this['readUnseen']();}};EmailImap[_0x9043('0x15')]['handleCloseBox']=function(_0x45bec7){if(_0x45bec7){this[_0x9043('0x13')](_0x45bec7,!![]);}else{this[_0x9043('0x2')][_0x9043('0x10')]();}};EmailImap['prototype'][_0x9043('0x27')]=function(){this[_0x9043('0x2')][_0x9043('0x28')]([_0x9043('0x29')],this[_0x9043('0x2a')]['bind'](this));};EmailImap[_0x9043('0x15')][_0x9043('0x2a')]=function(_0xeaca86,_0x4e4363){if(_0xeaca86){this[_0x9043('0x13')](_0xeaca86,!![]);}else{if(_0x4e4363[_0x9043('0x2b')]){try{var _0x485b2c=this[_0x9043('0x2')][_0x9043('0x2c')](_0x4e4363,{'bodies':'','markSeen':!![]});_0x485b2c['on']('message',this[_0x9043('0x2d')][_0x9043('0x11')](this));_0x485b2c[_0x9043('0xd')](_0x9043('0x12'),this['handleFetchError'][_0x9043('0x11')](this));_0x485b2c[_0x9043('0xd')]('end',this['handleFetchEnd'][_0x9043('0x11')](this));}catch(_0x579277){logger[_0x9043('0x12')](_0x579277);}}else{this[_0x9043('0x2')][_0x9043('0x2e')](!![],this[_0x9043('0x2f')]['bind'](this));}}};EmailImap['prototype'][_0x9043('0x2d')]=function(_0x446956,_0x391a82){_0x446956['on'](_0x9043('0x30'),this[_0x9043('0x31')][_0x9043('0x11')](this));_0x446956[_0x9043('0xd')]('attributes',this[_0x9043('0x32')]['bind'](this));_0x446956[_0x9043('0xd')]('end',this[_0x9043('0x33')][_0x9043('0x11')](this));};EmailImap['prototype']['handleMessageBody']=function(_0x20e145,_0x2c8697){simpleParser(_0x20e145,{'Iconv':Iconv},this[_0x9043('0x34')][_0x9043('0x11')](this));};EmailImap[_0x9043('0x15')][_0x9043('0x32')]=function(_0x3a9fe2){};EmailImap[_0x9043('0x15')][_0x9043('0x33')]=function(){};EmailImap[_0x9043('0x15')][_0x9043('0x34')]=function(_0x19b858,_0x4a0f7b){if(_0x19b858){logger[_0x9043('0x12')](_0x19b858);}else{var _0x5187bf=this;utils[_0x9043('0x35')](this[_0x9043('0xc')],_0x4a0f7b,function(_0x5844a9){_0x5187bf[_0x9043('0x25')](_0x9043('0x36'),_0x5844a9);});}};EmailImap[_0x9043('0x15')]['handleFetchEnd']=function(){this[_0x9043('0x2')][_0x9043('0x2e')](!![],this[_0x9043('0x2f')][_0x9043('0x11')](this));};EmailImap[_0x9043('0x15')][_0x9043('0x37')]=function(_0x6d19b7){this[_0x9043('0x13')](_0x6d19b7);this['imap'][_0x9043('0x2e')](!![],this['handleCloseBox']['bind'](this));};EmailImap[_0x9043('0x15')]['handleEnd']=function(){this[_0x9043('0x25')]('end');};EmailImap[_0x9043('0x15')][_0x9043('0x13')]=function(_0x2c479d,_0x38028b){logger[_0x9043('0x12')](_0x9043('0x13'),this['account'][_0x9043('0x36')],JSON[_0x9043('0x38')](_0x2c479d));var _0x241f7e='';if(_0x2c479d){if(_0x2c479d['textCode']){_0x241f7e=_0x2c479d[_0x9043('0x39')];}else{for(var _0x570b46 in _0x2c479d){if(_0x2c479d['hasOwnProperty'](_0x570b46)){_0x241f7e+=_[_0x9043('0x3a')](_0x570b46)+':\x20'+_0x2c479d[_0x570b46]+'\x0a';}}}}if(_0x38028b){this['imap'][_0x9043('0x10')]();}else{this[_0x9043('0x25')]('error',_0x241f7e);this['emit'](_0x9043('0x10'));}};module[_0x9043('0x3b')]=EmailImap; \ No newline at end of file +var _0xe29d=['authTimeout','isNil','service','authentication','user','password','host','port','tls','autotls','required','anonymous@xcally.com','handleReady','openBox','handleOpenBox','emit','readUnseen','handleCloseBox','prototype','search','UNSEEN','handleReadUnseen','length','fetch','message','handleFetchMessage','handleFetchError','handleFetchEnd','closeBox','body','handleMessageBody','attributes','handleMessageAttributes','handleMessageEnd','handleSimpleParser','handleEnd','stringify','textCode','hasOwnProperty','exports','path','imap','lodash','simpleParser','Iconv','events','EventEmitter','../../../config/logger','email','mailbox','INBOX','account','getAccount','ready','once','end','bind','error','handleError','connect','inherits','connTimeout'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xe29d,0x66));var _0xde29=function(_0x31d6a7,_0x5a5235){_0x31d6a7=_0x31d6a7-0x0;var _0x185aee=_0xe29d[_0x31d6a7];return _0x185aee;};'use strict';var fs=require('fs');var path=require(_0xde29('0x0'));var util=require('util');var Imap=require(_0xde29('0x1'));var _=require(_0xde29('0x2'));var rs=require('randomstring');var simpleParser=require('mailparser')[_0xde29('0x3')];var Iconv=require('iconv')[_0xde29('0x4')];var EventEmitter=require(_0xde29('0x5'))[_0xde29('0x6')];var utils=require('./utils');var logger=require(_0xde29('0x7'))(_0xde29('0x8'));function EmailImap(_0x5bc924,_0x1ceba1){this[_0xde29('0x9')]=_0xde29('0xa');this[_0xde29('0xb')]=this[_0xde29('0xc')](_0x5bc924,_0x1ceba1);this['imap']=new Imap(this[_0xde29('0xb')]);this[_0xde29('0x1')]['once'](_0xde29('0xd'),this['handleReady']['bind'](this));this[_0xde29('0x1')][_0xde29('0xe')](_0xde29('0xf'),this['handleEnd'][_0xde29('0x10')](this));this[_0xde29('0x1')]['on'](_0xde29('0x11'),this[_0xde29('0x12')]['bind'](this));this[_0xde29('0x1')][_0xde29('0x13')]();}util[_0xde29('0x14')](EmailImap,EventEmitter);EmailImap['prototype']['getAccount']=function(_0x16835b,_0x448633){var _0x4af3d6={'connTimeout':_0x16835b[_0xde29('0x15')]?_0x16835b[_0xde29('0x15')]*0x3e8:0x2710,'authTimeout':_0x16835b['authTimeout']?_0x16835b[_0xde29('0x16')]*0x3e8:0x1388};if(_[_0xde29('0x17')](_0x16835b[_0xde29('0x18')])){if(_0x16835b[_0xde29('0x19')]){_0x4af3d6[_0xde29('0x1a')]=_0x16835b['user'];_0x4af3d6[_0xde29('0x1b')]=_0x16835b['password'];}_0x4af3d6['host']=_0x16835b[_0xde29('0x1c')];_0x4af3d6['port']=_0x16835b[_0xde29('0x1d')]||0x3e1;if(_0x16835b['tls']){_0x4af3d6[_0xde29('0x1e')]=!![];}else{_0x4af3d6[_0xde29('0x1e')]=![];_0x4af3d6[_0xde29('0x1f')]=_0xde29('0x20');}}else{_0x4af3d6[_0xde29('0x1a')]=_0x16835b[_0xde29('0x1a')];_0x4af3d6[_0xde29('0x1b')]=_0x16835b['password'];_0x4af3d6[_0xde29('0x1c')]=utils['getHost'](_0x16835b['service']);_0x4af3d6[_0xde29('0x1d')]=0x3e1;_0x4af3d6[_0xde29('0x1e')]=!![];}_0x4af3d6['email']=_0x448633||_0x16835b[_0xde29('0x1a')]||_0xde29('0x21');return _0x4af3d6;};EmailImap['prototype'][_0xde29('0x22')]=function(){this['imap'][_0xde29('0x23')](this[_0xde29('0x9')],![],this['handleOpenBox'][_0xde29('0x10')](this));};EmailImap['prototype'][_0xde29('0x24')]=function(_0x1c87c9,_0x1945fa){if(_0x1c87c9){this['handleError'](_0x1c87c9,!![]);}else{this[_0xde29('0x25')]('box',_0x1945fa);this[_0xde29('0x26')]();}};EmailImap['prototype'][_0xde29('0x27')]=function(_0x3f8e56){if(_0x3f8e56){this[_0xde29('0x12')](_0x3f8e56,!![]);}else{this[_0xde29('0x1')][_0xde29('0xf')]();}};EmailImap[_0xde29('0x28')][_0xde29('0x26')]=function(){this[_0xde29('0x1')][_0xde29('0x29')]([_0xde29('0x2a')],this[_0xde29('0x2b')]['bind'](this));};EmailImap[_0xde29('0x28')]['handleReadUnseen']=function(_0x3924e5,_0x173ddc){if(_0x3924e5){this[_0xde29('0x12')](_0x3924e5,!![]);}else{if(_0x173ddc[_0xde29('0x2c')]){try{var _0x392294=this[_0xde29('0x1')][_0xde29('0x2d')](_0x173ddc,{'bodies':'','markSeen':!![]});_0x392294['on'](_0xde29('0x2e'),this[_0xde29('0x2f')][_0xde29('0x10')](this));_0x392294['once'](_0xde29('0x11'),this[_0xde29('0x30')][_0xde29('0x10')](this));_0x392294[_0xde29('0xe')]('end',this[_0xde29('0x31')][_0xde29('0x10')](this));}catch(_0x5404dc){logger[_0xde29('0x11')](_0x5404dc);}}else{this[_0xde29('0x1')][_0xde29('0x32')](!![],this[_0xde29('0x27')][_0xde29('0x10')](this));}}};EmailImap[_0xde29('0x28')][_0xde29('0x2f')]=function(_0x5c40f9,_0x205f0f){_0x5c40f9['on'](_0xde29('0x33'),this[_0xde29('0x34')][_0xde29('0x10')](this));_0x5c40f9['once'](_0xde29('0x35'),this[_0xde29('0x36')][_0xde29('0x10')](this));_0x5c40f9[_0xde29('0xe')](_0xde29('0xf'),this[_0xde29('0x37')]['bind'](this));};EmailImap[_0xde29('0x28')][_0xde29('0x34')]=function(_0x2d3fcc,_0xf563b3){simpleParser(_0x2d3fcc,{'Iconv':Iconv},this[_0xde29('0x38')][_0xde29('0x10')](this));};EmailImap[_0xde29('0x28')][_0xde29('0x36')]=function(_0x3fbd96){};EmailImap[_0xde29('0x28')][_0xde29('0x37')]=function(){};EmailImap['prototype']['handleSimpleParser']=function(_0x2bb08b,_0x1d5e2c){if(_0x2bb08b){logger['error'](_0x2bb08b);}else{var _0x56094a=this;utils['parser'](this[_0xde29('0xb')],_0x1d5e2c,function(_0x1829b7){_0x56094a[_0xde29('0x25')]('email',_0x1829b7);});}};EmailImap[_0xde29('0x28')]['handleFetchEnd']=function(){this['imap'][_0xde29('0x32')](!![],this[_0xde29('0x27')][_0xde29('0x10')](this));};EmailImap[_0xde29('0x28')][_0xde29('0x30')]=function(_0x5df434){this[_0xde29('0x12')](_0x5df434);this['imap']['closeBox'](!![],this[_0xde29('0x27')][_0xde29('0x10')](this));};EmailImap[_0xde29('0x28')][_0xde29('0x39')]=function(){this[_0xde29('0x25')](_0xde29('0xf'));};EmailImap[_0xde29('0x28')]['handleError']=function(_0x28060c,_0x2f1b32){logger[_0xde29('0x11')]('handleError',this[_0xde29('0xb')][_0xde29('0x8')],JSON[_0xde29('0x3a')](_0x28060c));var _0x245c97='';if(_0x28060c){if(_0x28060c[_0xde29('0x3b')]){_0x245c97=_0x28060c[_0xde29('0x3b')];}else{for(var _0x2bfa95 in _0x28060c){if(_0x28060c[_0xde29('0x3c')](_0x2bfa95)){_0x245c97+=_['upperFirst'](_0x2bfa95)+':\x20'+_0x28060c[_0x2bfa95]+'\x0a';}}}}if(_0x2f1b32){this[_0xde29('0x1')][_0xde29('0xf')]();}else{this[_0xde29('0x25')](_0xde29('0x11'),_0x245c97);this[_0xde29('0x25')](_0xde29('0xf'));}};module[_0xde29('0x3d')]=EmailImap; \ No newline at end of file diff --git a/server/services/email/lib/smtp.js b/server/services/email/lib/smtp.js index 8142800..e1761de 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 _0xcd58=['createTransport','use','compile','toString','prototype','verify','exports','nodemailer','bluebird','nodemailer-plugin-inline-base64','send'];(function(_0x318807,_0x51678f){var _0x33ea7e=function(_0x41b62d){while(--_0x41b62d){_0x318807['push'](_0x318807['shift']());}};_0x33ea7e(++_0x51678f);}(_0xcd58,0x125));var _0x8cd5=function(_0x17784a,_0x42fe44){_0x17784a=_0x17784a-0x0;var _0x41aded=_0xcd58[_0x17784a];return _0x41aded;};'use strict';var nodemailer=require(_0x8cd5('0x0'));var BPromise=require(_0x8cd5('0x1'));var inlineBase64=require(_0x8cd5('0x2'));function EmailSmtp(){}EmailSmtp['prototype'][_0x8cd5('0x3')]=function(_0x5b2fbb,_0x4f0735){return new BPromise(function(_0x5aebeb,_0x2f6f08){var _0x3b4ff8=nodemailer[_0x8cd5('0x4')](_0x5b2fbb);_0x3b4ff8[_0x8cd5('0x5')](_0x8cd5('0x6'),inlineBase64());_0x3b4ff8['sendMail'](_0x4f0735,function(_0x24a8f6,_0x1c43a1){if(_0x24a8f6){_0x2f6f08(_0x24a8f6[_0x8cd5('0x7')]());}else{_0x5aebeb(_0x1c43a1);}});});};EmailSmtp[_0x8cd5('0x8')][_0x8cd5('0x9')]=function(_0x249bf6){return new BPromise(function(_0x16c14b,_0x5b22a3){var _0x3b42c4=nodemailer[_0x8cd5('0x4')](_0x249bf6);_0x3b42c4[_0x8cd5('0x9')](function(_0x4199a9,_0x9c440f){if(_0x4199a9){_0x5b22a3(_0x4199a9[_0x8cd5('0x7')]());}else{if(_0x9c440f){_0x16c14b(_0x9c440f);}else{_0x5b22a3('Not\x20verifired');}}});});};module[_0x8cd5('0xa')]=EmailSmtp; \ No newline at end of file +var _0x9f2d=['bluebird','nodemailer-plugin-inline-base64','prototype','createTransport','use','compile','toString','verify','Not\x20verifired','nodemailer'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x9f2d,0x10d));var _0xd9f2=function(_0x38bfa2,_0x3aa3c2){_0x38bfa2=_0x38bfa2-0x0;var _0x49f240=_0x9f2d[_0x38bfa2];return _0x49f240;};'use strict';var nodemailer=require(_0xd9f2('0x0'));var BPromise=require(_0xd9f2('0x1'));var inlineBase64=require(_0xd9f2('0x2'));function EmailSmtp(){}EmailSmtp[_0xd9f2('0x3')]['send']=function(_0xd2b400,_0x2fc9dd){return new BPromise(function(_0x9e6500,_0x814b5a){var _0xe4c4e3=nodemailer[_0xd9f2('0x4')](_0xd2b400);_0xe4c4e3[_0xd9f2('0x5')](_0xd9f2('0x6'),inlineBase64());_0xe4c4e3['sendMail'](_0x2fc9dd,function(_0x57df2c,_0x392e16){if(_0x57df2c){_0x814b5a(_0x57df2c[_0xd9f2('0x7')]());}else{_0x9e6500(_0x392e16);}});});};EmailSmtp[_0xd9f2('0x3')][_0xd9f2('0x8')]=function(_0x15a79a){return new BPromise(function(_0x527543,_0x19f8ee){var _0x27e5cb=nodemailer['createTransport'](_0x15a79a);_0x27e5cb[_0xd9f2('0x8')](function(_0x58101a,_0x6c86a4){if(_0x58101a){_0x19f8ee(_0x58101a[_0xd9f2('0x7')]());}else{if(_0x6c86a4){_0x527543(_0x6c86a4);}else{_0x19f8ee(_0xd9f2('0x9'));}}});});};module['exports']=EmailSmtp; \ No newline at end of file diff --git a/server/services/email/lib/utils.js b/server/services/email/lib/utils.js index 9c77850..e1d30de 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 _0xb7ac=['gmail','imap.gmail.com','yahoo','imap.mail.yahoo.com','hotmail','imap-mail.outlook.com','outlook365','outlook.office365.com','127.0.0.1','lodash','moment','randomstring','path','util','../../../config/logger','../../../config/environment','head','value','address','generate','@xcally.com','name','substring','indexOf','split','slice','join','Anonymous','length','pop','isEmpty','html','test','replace','attachments','forEach','push','_SRC','_IMG','\x20[Attachment:\x20','body','textAsHtml','Empty\x20message

','Attachments','Title','Data','getHost'];(function(_0x17f389,_0x47acc2){var _0x5b129f=function(_0xfba30a){while(--_0xfba30a){_0x17f389['push'](_0x17f389['shift']());}};_0x5b129f(++_0x47acc2);}(_0xb7ac,0x18a));var _0xcb7a=function(_0x8d6df9,_0x467f7d){_0x8d6df9=_0x8d6df9-0x0;var _0x3ee34d=_0xb7ac[_0x8d6df9];return _0x3ee34d;};'use strict';var _=require(_0xcb7a('0x0'));var moment=require(_0xcb7a('0x1'));var random=require(_0xcb7a('0x2'));var fs=require('fs');var path=require(_0xcb7a('0x3'));var util=require(_0xcb7a('0x4'));var tnef=require('node-tnef');var logger=require(_0xcb7a('0x5'))('email');var config=require(_0xcb7a('0x6'));function getAddress(_0xaa5a21){var _0x50be72=_[_0xcb7a('0x7')](_0xaa5a21[_0xcb7a('0x8')]);return _0x50be72&&_0x50be72[_0xcb7a('0x9')]?_0x50be72['address']:'anonymous'+random[_0xcb7a('0xa')](0x6)+_0xcb7a('0xb');}function getFirstName(_0x555ea7){var _0x2655b5=_[_0xcb7a('0x7')](_0x555ea7[_0xcb7a('0x8')]);if(_0x2655b5&&_0x2655b5[_0xcb7a('0xc')]){if(_0x2655b5[_0xcb7a('0xc')]==_0x2655b5[_0xcb7a('0x9')]){return _0x2655b5['name'][_0xcb7a('0xd')](0x0,_0x2655b5[_0xcb7a('0xc')][_0xcb7a('0xe')]('@'));}var _0x5d84a9=_0x2655b5[_0xcb7a('0xc')][_0xcb7a('0xf')](/\s+/);return _0x5d84a9['length']>0x1?_0x5d84a9[_0xcb7a('0x10')](0x0,-0x1)[_0xcb7a('0x11')]('\x20'):_0x2655b5[_0xcb7a('0xc')];}return _0xcb7a('0x12');}function getLastName(_0x3ec54d){var _0xb8b4f6=_[_0xcb7a('0x7')](_0x3ec54d[_0xcb7a('0x8')]);if(_0xb8b4f6&&_0xb8b4f6[_0xcb7a('0xc')]){var _0x578f9c=_0xb8b4f6[_0xcb7a('0xc')]['split'](/\s+/);return _0x578f9c[_0xcb7a('0x13')]>0x1?_0x578f9c[_0xcb7a('0x14')]():'';}return'';}function getMails(_0x7f1071,_0x37ea19){var _0x53721a='';for(var _0x2bb2e9=0x0;_0x2bb2e9<_0x37ea19[_0xcb7a('0x8')][_0xcb7a('0x13')];_0x2bb2e9+=0x1){if(_0x37ea19[_0xcb7a('0x8')][_0x2bb2e9][_0xcb7a('0x9')]!==_0x7f1071){if(!_[_0xcb7a('0x15')](_0x53721a)){_0x53721a+=',';}_0x53721a+=_0x37ea19[_0xcb7a('0x8')][_0x2bb2e9]['name']||_0x37ea19[_0xcb7a('0x8')][_0x2bb2e9][_0xcb7a('0x9')]||'';_0x53721a+='\x20<';_0x53721a+=_0x37ea19[_0xcb7a('0x8')][_0x2bb2e9][_0xcb7a('0x9')]?_0x37ea19['value'][_0x2bb2e9]['address']:'anonymous'+random[_0xcb7a('0xa')](0x6)+'@xcally.com';_0x53721a+='>';}}return _0x53721a;}function parseEmail(_0x273bbb,_0x112d6e,_0x30c745){if(_0x112d6e[_0xcb7a('0x16')]){var _0x45e54b=/)<[^<]*)*<\/script>/gi;while(_0x45e54b[_0xcb7a('0x17')](_0x112d6e[_0xcb7a('0x16')])){_0x112d6e[_0xcb7a('0x16')]=_0x112d6e[_0xcb7a('0x16')][_0xcb7a('0x18')](_0x45e54b,'');}if(_0x112d6e[_0xcb7a('0x16')]['includes']('{_0x4aabe1[_0xcb7a('0x1b')](_0x371d33['filename']);});var _0x527ae8=/]+>/g;var _0xe20b78=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x282350=_0x112d6e[_0xcb7a('0x16')]['replace'](_0xe20b78,_0xcb7a('0x1c'));var _0x2fef04=_0x282350['replace'](_0x527ae8,_0xcb7a('0x1d'));for(let _0x1f3a3d=0x0;_0x1f3a3d<_0x4aabe1[_0xcb7a('0x13')];_0x1f3a3d++){var _0x36e2dd=_0x2fef04[_0xcb7a('0x18')]('_IMG',_0xcb7a('0x1e')+_0x4aabe1[_0x1f3a3d]+'\x20]');_0x2fef04=_0x36e2dd;}_0x112d6e[_0xcb7a('0x16')]=_0x2fef04;}_0x30c745['body']=_0x112d6e['html'];}else{_0x30c745[_0xcb7a('0x1f')]=_0x112d6e[_0xcb7a('0x20')];}if(_0x30c745[_0xcb7a('0x1f')]){_0x30c745[_0xcb7a('0x1f')]=_0x30c745[_0xcb7a('0x1f')]['replace'](/0x0){var _0x49ccb5=['Auto-Submitted:\x20auto-replied',_0xcb7a('0x34'),'Precedence:\x20auto_reply'];for(var _0x1bc01c=0x0;_0x1bc01c<_0x112d6e[_0xcb7a('0x33')][_0xcb7a('0x13')];_0x1bc01c++){var _0x5c8e1b=_[_0xcb7a('0xe')](_0x49ccb5,_0x112d6e[_0xcb7a('0x33')][_0x1bc01c][_0xcb7a('0x35')]);if(_0x5c8e1b>=0x0){_0x30c745[_0xcb7a('0x36')]=!![];}}}return _0x30c745;}exports['parser']=function(_0x11e73d,_0x318147,_0x2838d1){var _0x2fcbd5={'from':getAddress(_0x318147['from']),'firstName':getFirstName(_0x318147[_0xcb7a('0x37')]),'lastName':getLastName(_0x318147[_0xcb7a('0x37')]),'mapKey':'email','message':{'from':getMails(_0x11e73d[_0xcb7a('0x24')],_0x318147['from']),'to':_0x11e73d[_0xcb7a('0x24')],'cc':'','subject':_0x318147['subject']||'','messageId':_0x318147[_0xcb7a('0x38')],'inReplyTo':_0x318147['inReplyTo'],'sentAt':moment(_0x318147['date'])[_0xcb7a('0x2c')](_0xcb7a('0x39')),'attach':![],'attachments':[]}};if(!_0x318147[_0xcb7a('0x16')]&&!_0x318147['textAsHtml']){var _0x156d32=_[_0xcb7a('0x3a')](_0x318147[_0xcb7a('0x19')],{'contentType':_0xcb7a('0x3b')});if(_0x156d32[_0xcb7a('0x13')]){logger['info'](util[_0xcb7a('0x2c')]('Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system',_0x318147[_0xcb7a('0x38')]));tnef[_0xcb7a('0x3c')](_[_0xcb7a('0x3d')](_0x156d32)[_0xcb7a('0x31')],function(_0xb710f3,_0x446cd2){if(_0x446cd2){_0x318147[_0xcb7a('0x16')]=_0x446cd2[_0xcb7a('0x3e')]||_0xcb7a('0x3f');if(_0x446cd2[_0xcb7a('0x40')]){for(var _0x3c1f9a=0x0;_0x3c1f9a<_0x446cd2[_0xcb7a('0x40')][_0xcb7a('0x13')];_0x3c1f9a++){var _0x401524=_0x446cd2[_0xcb7a('0x40')][_0x3c1f9a];_0x2fcbd5[_0xcb7a('0x22')]['attachments'][_0xcb7a('0x1b')]({'filename':_0x401524[_0xcb7a('0x41')],'content':Buffer[_0xcb7a('0x37')](_0x401524[_0xcb7a('0x42')])});}}}_0x2838d1(parseEmail(_0x11e73d,_0x318147,_0x2fcbd5));});}else{_0x318147[_0xcb7a('0x16')]=_0xcb7a('0x3f');_0x2838d1(parseEmail(_0x11e73d,_0x318147,_0x2fcbd5));}}else{_0x2838d1(parseEmail(_0x11e73d,_0x318147,_0x2fcbd5));}};exports[_0xcb7a('0x43')]=function(_0x5ec3f0){switch(_0x5ec3f0){case _0xcb7a('0x44'):return _0xcb7a('0x45');case _0xcb7a('0x46'):return _0xcb7a('0x47');case _0xcb7a('0x48'):return _0xcb7a('0x49');case _0xcb7a('0x4a'):return _0xcb7a('0x4b');}return _0xcb7a('0x4c');}; \ No newline at end of file +var _0xacf4=['outlook365','outlook.office365.com','127.0.0.1','randomstring','path','util','node-tnef','../../../config/logger','email','../../../config/environment','head','address','anonymous','generate','@xcally.com','name','substring','slice','join','Anonymous','value','length','test','html','replace','\x20[Attachment:\x20','body','textAsHtml','Empty\x20message

','Attachments','Title','Data','getHost','imap.gmail.com','yahoo','imap.mail.yahoo.com','hotmail','imap-mail.outlook.com'];(function(_0x5b3546,_0x168b1a){var _0x5eb84f=function(_0x1ab1ab){while(--_0x1ab1ab){_0x5b3546['push'](_0x5b3546['shift']());}};_0x5eb84f(++_0x168b1a);}(_0xacf4,0xe7));var _0x4acf=function(_0x2b3208,_0x26f23b){_0x2b3208=_0x2b3208-0x0;var _0xde06e1=_0xacf4[_0x2b3208];return _0xde06e1;};'use strict';var _=require('lodash');var moment=require('moment');var random=require(_0x4acf('0x0'));var fs=require('fs');var path=require(_0x4acf('0x1'));var util=require(_0x4acf('0x2'));var tnef=require(_0x4acf('0x3'));var logger=require(_0x4acf('0x4'))(_0x4acf('0x5'));var config=require(_0x4acf('0x6'));function getAddress(_0x5cf22d){var _0x380435=_[_0x4acf('0x7')](_0x5cf22d['value']);return _0x380435&&_0x380435[_0x4acf('0x8')]?_0x380435[_0x4acf('0x8')]:_0x4acf('0x9')+random[_0x4acf('0xa')](0x6)+_0x4acf('0xb');}function getFirstName(_0x50f5f4){var _0x55f61d=_[_0x4acf('0x7')](_0x50f5f4['value']);if(_0x55f61d&&_0x55f61d[_0x4acf('0xc')]){if(_0x55f61d[_0x4acf('0xc')]==_0x55f61d[_0x4acf('0x8')]){return _0x55f61d['name'][_0x4acf('0xd')](0x0,_0x55f61d[_0x4acf('0xc')]['indexOf']('@'));}var _0x5f22d9=_0x55f61d[_0x4acf('0xc')]['split'](/\s+/);return _0x5f22d9['length']>0x1?_0x5f22d9[_0x4acf('0xe')](0x0,-0x1)[_0x4acf('0xf')]('\x20'):_0x55f61d[_0x4acf('0xc')];}return _0x4acf('0x10');}function getLastName(_0x18629e){var _0x1a9949=_[_0x4acf('0x7')](_0x18629e[_0x4acf('0x11')]);if(_0x1a9949&&_0x1a9949[_0x4acf('0xc')]){var _0x312bb5=_0x1a9949[_0x4acf('0xc')]['split'](/\s+/);return _0x312bb5[_0x4acf('0x12')]>0x1?_0x312bb5['pop']():'';}return'';}function getMails(_0x34cec1,_0x4041c8){var _0xccf970='';for(var _0x5d934a=0x0;_0x5d934a<_0x4041c8['value'][_0x4acf('0x12')];_0x5d934a+=0x1){if(_0x4041c8[_0x4acf('0x11')][_0x5d934a][_0x4acf('0x8')]!==_0x34cec1){if(!_['isEmpty'](_0xccf970)){_0xccf970+=',';}_0xccf970+=_0x4041c8[_0x4acf('0x11')][_0x5d934a][_0x4acf('0xc')]||_0x4041c8[_0x4acf('0x11')][_0x5d934a][_0x4acf('0x8')]||'';_0xccf970+='\x20<';_0xccf970+=_0x4041c8[_0x4acf('0x11')][_0x5d934a][_0x4acf('0x8')]?_0x4041c8[_0x4acf('0x11')][_0x5d934a][_0x4acf('0x8')]:_0x4acf('0x9')+random[_0x4acf('0xa')](0x6)+_0x4acf('0xb');_0xccf970+='>';}}return _0xccf970;}function parseEmail(_0x5f0284,_0x28d698,_0x6bd89){if(_0x28d698['html']){var _0x41e5d2=/)<[^<]*)*<\/script>/gi;while(_0x41e5d2[_0x4acf('0x13')](_0x28d698['html'])){_0x28d698[_0x4acf('0x14')]=_0x28d698[_0x4acf('0x14')][_0x4acf('0x15')](_0x41e5d2,'');}if(_0x28d698[_0x4acf('0x14')]['includes'](_0x4acf('0x16'))){var _0x12e717=[];_0x28d698['attachments'][_0x4acf('0x17')](_0x1af4e9=>{_0x12e717['push'](_0x1af4e9[_0x4acf('0x18')]);});var _0x7ebb=/]+>/g;var _0x38152c=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x16458f=_0x28d698['html']['replace'](_0x38152c,_0x4acf('0x19'));var _0x3f548a=_0x16458f[_0x4acf('0x15')](_0x7ebb,_0x4acf('0x1a'));for(let _0x14086c=0x0;_0x14086c<_0x12e717[_0x4acf('0x12')];_0x14086c++){var _0xb83274=_0x3f548a[_0x4acf('0x15')](_0x4acf('0x1a'),_0x4acf('0x1b')+_0x12e717[_0x14086c]+'\x20]');_0x3f548a=_0xb83274;}_0x28d698[_0x4acf('0x14')]=_0x3f548a;}_0x6bd89[_0x4acf('0x1c')]=_0x28d698[_0x4acf('0x14')];}else{_0x6bd89[_0x4acf('0x1c')]=_0x28d698[_0x4acf('0x1d')];}if(_0x6bd89[_0x4acf('0x1c')]){_0x6bd89[_0x4acf('0x1c')]=_0x6bd89['body'][_0x4acf('0x15')](/0x0){var _0x55216a=['Auto-Submitted:\x20auto-replied',_0x4acf('0x30'),_0x4acf('0x31')];for(var _0x208af3=0x0;_0x208af3<_0x28d698['headerLines'][_0x4acf('0x12')];_0x208af3++){var _0x3b6574=_[_0x4acf('0x32')](_0x55216a,_0x28d698[_0x4acf('0x2f')][_0x208af3][_0x4acf('0x33')]);if(_0x3b6574>=0x0){_0x6bd89[_0x4acf('0x34')]=!![];}}}return _0x6bd89;}exports[_0x4acf('0x35')]=function(_0x17d5e9,_0x461547,_0x3b8cfa){var _0x25d84c={'from':getAddress(_0x461547['from']),'firstName':getFirstName(_0x461547[_0x4acf('0x36')]),'lastName':getLastName(_0x461547[_0x4acf('0x36')]),'mapKey':_0x4acf('0x5'),'message':{'from':getMails(_0x17d5e9[_0x4acf('0x5')],_0x461547[_0x4acf('0x36')]),'to':_0x17d5e9['email'],'cc':'','subject':_0x461547['subject']||'','messageId':_0x461547[_0x4acf('0x37')],'inReplyTo':_0x461547[_0x4acf('0x38')],'sentAt':moment(_0x461547[_0x4acf('0x39')])[_0x4acf('0x28')](_0x4acf('0x3a')),'attach':![],'attachments':[]}};if(!_0x461547[_0x4acf('0x14')]&&!_0x461547['textAsHtml']){var _0x2e7128=_['filter'](_0x461547[_0x4acf('0x24')],{'contentType':_0x4acf('0x3b')});if(_0x2e7128['length']){logger['info'](util[_0x4acf('0x28')](_0x4acf('0x3c'),_0x461547[_0x4acf('0x37')]));tnef[_0x4acf('0x3d')](_['first'](_0x2e7128)[_0x4acf('0x2c')],function(_0x13fac4,_0x2378c6){if(_0x2378c6){_0x461547[_0x4acf('0x14')]=_0x2378c6[_0x4acf('0x3e')]||_0x4acf('0x3f');if(_0x2378c6[_0x4acf('0x40')]){for(var _0x2d946c=0x0;_0x2d946c<_0x2378c6['Attachments']['length'];_0x2d946c++){var _0x1f5c5f=_0x2378c6[_0x4acf('0x40')][_0x2d946c];_0x25d84c[_0x4acf('0x1f')][_0x4acf('0x24')][_0x4acf('0x2d')]({'filename':_0x1f5c5f[_0x4acf('0x41')],'content':Buffer[_0x4acf('0x36')](_0x1f5c5f[_0x4acf('0x42')])});}}}_0x3b8cfa(parseEmail(_0x17d5e9,_0x461547,_0x25d84c));});}else{_0x461547[_0x4acf('0x14')]=_0x4acf('0x3f');_0x3b8cfa(parseEmail(_0x17d5e9,_0x461547,_0x25d84c));}}else{_0x3b8cfa(parseEmail(_0x17d5e9,_0x461547,_0x25d84c));}};exports[_0x4acf('0x43')]=function(_0x9aa592){switch(_0x9aa592){case'gmail':return _0x4acf('0x44');case _0x4acf('0x45'):return _0x4acf('0x46');case _0x4acf('0x47'):return _0x4acf('0x48');case _0x4acf('0x49'):return _0x4acf('0x4a');}return _0x4acf('0x4b');}; \ No newline at end of file diff --git a/server/services/email/model/mailAccount.js b/server/services/email/model/mailAccount.js index 2e6a94c..4952ddd 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 _0x0e0a=['lodash','name','Service','key','active','Imap','Smtp','exports'];(function(_0x4b2863,_0x494899){var _0x567d67=function(_0x751f03){while(--_0x751f03){_0x4b2863['push'](_0x4b2863['shift']());}};_0x567d67(++_0x494899);}(_0x0e0a,0x100));var _0xa0e0=function(_0x3ce8ca,_0x4bf3f5){_0x3ce8ca=_0x3ce8ca-0x0;var _0x2e96b3=_0x0e0a[_0x3ce8ca];return _0x2e96b3;};'use strict';var _=require(_0xa0e0('0x0'));function MailAccount(_0x5cd4c6){this['id']=_0x5cd4c6['id']||0x0;this[_0xa0e0('0x1')]=_0x5cd4c6[_0xa0e0('0x1')]||_0xa0e0('0x2');this[_0xa0e0('0x3')]=_0x5cd4c6[_0xa0e0('0x3')]||'SERV';this[_0xa0e0('0x4')]=_0x5cd4c6[_0xa0e0('0x4')]||![];this[_0xa0e0('0x5')]=_0x5cd4c6[_0xa0e0('0x5')]||[];this[_0xa0e0('0x6')]=_0x5cd4c6[_0xa0e0('0x6')]||[];}module[_0xa0e0('0x7')]=MailAccount; \ No newline at end of file +var _0x664b=['exports','name','key','SERV','active','Imap','Smtp'];(function(_0x187ee1,_0x3fd1e6){var _0x388160=function(_0x542dd2){while(--_0x542dd2){_0x187ee1['push'](_0x187ee1['shift']());}};_0x388160(++_0x3fd1e6);}(_0x664b,0x1ac));var _0xb664=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x664b[_0x4a9fb1];return _0x348672;};'use strict';var _=require('lodash');function MailAccount(_0x4f83e0){this['id']=_0x4f83e0['id']||0x0;this[_0xb664('0x0')]=_0x4f83e0['name']||'Service';this[_0xb664('0x1')]=_0x4f83e0[_0xb664('0x1')]||_0xb664('0x2');this[_0xb664('0x3')]=_0x4f83e0[_0xb664('0x3')]||![];this[_0xb664('0x4')]=_0x4f83e0[_0xb664('0x4')]||[];this[_0xb664('0x5')]=_0x4f83e0[_0xb664('0x5')]||[];}module[_0xb664('0x6')]=MailAccount; \ No newline at end of file diff --git a/server/services/email/realtime/index.js b/server/services/email/realtime/index.js index fcb11f2..9eb1faf 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 _0x0a39=['length','exports','lodash','mailAccounts','mapKeys','hasOwnProperty','prototype'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x0a39,0x79));var _0x90a3=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x0a39[_0x3ab51d];return _0x29a04e;};'use strict';var _=require(_0x90a3('0x0'));var MailAccount=require('../model/mailAccount');var Realtime=function(){this[_0x90a3('0x1')]={};};function freeIsNotKey(_0x5cc98d,_0x2c0796,_0x359bba){var _0x398557=_[_0x90a3('0x2')](_0x5cc98d,function(_0x425ce5,_0x22f6b2){return _0x425ce5[_0x359bba];});for(var _0x54070f in _0x2c0796){if(_0x2c0796['hasOwnProperty'](_0x54070f)){if(!_0x398557[_0x54070f]){delete _0x2c0796[_0x54070f];}}}}Realtime['prototype']['mergeFromDatabase']=function(_0x1926cf,_0x5b1224){for(var _0x4caecd in _0x5b1224){if(_0x1926cf[_0x90a3('0x3')](_0x4caecd)){_0x1926cf[_0x4caecd]=_0x5b1224[_0x4caecd];}}};Realtime[_0x90a3('0x4')]['initMailAccounts']=function(){var _0x25c834=this;return function(_0x302dae){if(_0x302dae){freeIsNotKey(_0x302dae,_0x25c834[_0x90a3('0x1')],'id');for(var _0x1abce9=0x0,_0xa20435={},_0x336e58={};_0x1abce9<_0x302dae[_0x90a3('0x5')];_0x1abce9+=0x1){_0xa20435=_0x302dae[_0x1abce9];if(_['isUndefined'](_0x25c834[_0x90a3('0x1')][_0xa20435['id']])){_0x25c834[_0x90a3('0x1')][_0xa20435['id']]=new MailAccount(_0xa20435);}else{_['merge'](_0x25c834['mailAccounts'][_0xa20435['id']],_0xa20435);}}}return _0x25c834['mailAccounts'];};};module[_0x90a3('0x6')]=Realtime; \ No newline at end of file +var _0x2cd5=['initMailAccounts','length','isUndefined','merge','exports','../model/mailAccount','mailAccounts','mapKeys','hasOwnProperty','mergeFromDatabase','prototype'];(function(_0x24d9a3,_0x243332){var _0x3e77ae=function(_0x3e9cd4){while(--_0x3e9cd4){_0x24d9a3['push'](_0x24d9a3['shift']());}};_0x3e77ae(++_0x243332);}(_0x2cd5,0x19c));var _0x52cd=function(_0xe95c54,_0x19dc54){_0xe95c54=_0xe95c54-0x0;var _0x46493d=_0x2cd5[_0xe95c54];return _0x46493d;};'use strict';var _=require('lodash');var MailAccount=require(_0x52cd('0x0'));var Realtime=function(){this[_0x52cd('0x1')]={};};function freeIsNotKey(_0x5db59a,_0x4e2fc7,_0x3b76e2){var _0x79b801=_[_0x52cd('0x2')](_0x5db59a,function(_0x12fab1,_0x2967ba){return _0x12fab1[_0x3b76e2];});for(var _0x3605bd in _0x4e2fc7){if(_0x4e2fc7[_0x52cd('0x3')](_0x3605bd)){if(!_0x79b801[_0x3605bd]){delete _0x4e2fc7[_0x3605bd];}}}}Realtime['prototype'][_0x52cd('0x4')]=function(_0x383e82,_0x266ab1){for(var _0x3898c7 in _0x266ab1){if(_0x383e82[_0x52cd('0x3')](_0x3898c7)){_0x383e82[_0x3898c7]=_0x266ab1[_0x3898c7];}}};Realtime[_0x52cd('0x5')][_0x52cd('0x6')]=function(){var _0x275436=this;return function(_0x30f9ef){if(_0x30f9ef){freeIsNotKey(_0x30f9ef,_0x275436['mailAccounts'],'id');for(var _0x341cb8=0x0,_0x2e5d55={},_0x298311={};_0x341cb8<_0x30f9ef[_0x52cd('0x7')];_0x341cb8+=0x1){_0x2e5d55=_0x30f9ef[_0x341cb8];if(_[_0x52cd('0x8')](_0x275436[_0x52cd('0x1')][_0x2e5d55['id']])){_0x275436[_0x52cd('0x1')][_0x2e5d55['id']]=new MailAccount(_0x2e5d55);}else{_[_0x52cd('0x9')](_0x275436[_0x52cd('0x1')][_0x2e5d55['id']],_0x2e5d55);}}}return _0x275436[_0x52cd('0x1')];};};module[_0x52cd('0xa')]=Realtime; \ No newline at end of file diff --git a/server/services/email/rpc/mailAccount.js b/server/services/email/rpc/mailAccount.js index 8148837..f47a032 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 _0x58e6=['TemplateId','MailServerIn','Imap','MailServerOut','notify','NotifyMailAccount','../client','getMailAccounts','service','active','key','ListId'];(function(_0x9f34dd,_0x2ccde2){var _0x47ed47=function(_0x3296f9){while(--_0x3296f9){_0x9f34dd['push'](_0x9f34dd['shift']());}};_0x47ed47(++_0x2ccde2);}(_0x58e6,0x1c2));var _0x658e=function(_0x1266ee,_0x2715cb){_0x1266ee=_0x1266ee-0x0;var _0x457d92=_0x58e6[_0x1266ee];return _0x457d92;};'use strict';var client=require(_0x658e('0x0'));exports[_0x658e('0x1')]=function(){return function(){return client['Request']('GetMailAccount',{'options':{'attributes':['id','name',_0x658e('0x2'),'email',_0x658e('0x3'),_0x658e('0x4'),_0x658e('0x5'),_0x658e('0x6')],'raw':![],'include':[{'model':_0x658e('0x7'),'as':_0x658e('0x8')},{'model':_0x658e('0x9'),'as':'Smtp'}]},'log':'getMailAccount'});};};exports[_0x658e('0xa')]=function(_0xa73acf,_0x1e2c26){return client['Request'](_0x658e('0xb'),{'account':{'id':_0xa73acf},'body':_0x1e2c26,'log':_0x658e('0xb')});}; \ No newline at end of file +var _0x34a5=['name','service','email','active','key','ListId','TemplateId','MailServerIn','Imap','MailServerOut','Smtp','getMailAccount','notify','NotifyMailAccount','../client'];(function(_0x45a2f4,_0x2ac8d6){var _0x523c07=function(_0x160237){while(--_0x160237){_0x45a2f4['push'](_0x45a2f4['shift']());}};_0x523c07(++_0x2ac8d6);}(_0x34a5,0xc2));var _0x534a=function(_0x1af06c,_0x133369){_0x1af06c=_0x1af06c-0x0;var _0x2e6b1d=_0x34a5[_0x1af06c];return _0x2e6b1d;};'use strict';var client=require(_0x534a('0x0'));exports['getMailAccounts']=function(){return function(){return client['Request']('GetMailAccount',{'options':{'attributes':['id',_0x534a('0x1'),_0x534a('0x2'),_0x534a('0x3'),_0x534a('0x4'),_0x534a('0x5'),_0x534a('0x6'),_0x534a('0x7')],'raw':![],'include':[{'model':_0x534a('0x8'),'as':_0x534a('0x9')},{'model':_0x534a('0xa'),'as':_0x534a('0xb')}]},'log':_0x534a('0xc')});};};exports[_0x534a('0xd')]=function(_0x3c85e8,_0x10ebcc){return client['Request'](_0x534a('0xe'),{'account':{'id':_0x3c85e8},'body':_0x10ebcc,'log':_0x534a('0xe')});}; \ No newline at end of file diff --git a/server/services/email/rpc/setting.js b/server/services/email/rpc/setting.js index bdbfb04..002eefe 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 _0x730e=['getSettings','Request','ShowSetting','loginMailFrequency','GetSettings','../client'];(function(_0x3b0731,_0xcf9925){var _0x4204d7=function(_0x635ac5){while(--_0x635ac5){_0x3b0731['push'](_0x3b0731['shift']());}};_0x4204d7(++_0xcf9925);}(_0x730e,0xd7));var _0xe730=function(_0x11452e,_0x109555){_0x11452e=_0x11452e-0x0;var _0x3e8260=_0x730e[_0x11452e];return _0x3e8260;};'use strict';var client=require(_0xe730('0x0'));exports[_0xe730('0x1')]=function(){return client[_0xe730('0x2')](_0xe730('0x3'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0xe730('0x4')]},'log':_0xe730('0x5')});}; \ No newline at end of file +var _0x7cf4=['GetSettings','../client','getSettings','Request','ShowSetting','loginMailFrequency'];(function(_0x1cb8f0,_0x3077f8){var _0x31cf46=function(_0x2a966f){while(--_0x2a966f){_0x1cb8f0['push'](_0x1cb8f0['shift']());}};_0x31cf46(++_0x3077f8);}(_0x7cf4,0x91));var _0x47cf=function(_0x4c8adf,_0x305009){_0x4c8adf=_0x4c8adf-0x0;var _0x495ac7=_0x7cf4[_0x4c8adf];return _0x495ac7;};'use strict';var client=require(_0x47cf('0x0'));exports[_0x47cf('0x1')]=function(){return client[_0x47cf('0x2')](_0x47cf('0x3'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x47cf('0x4')]},'log':_0x47cf('0x5')});}; \ No newline at end of file diff --git a/server/services/email/server/index.js b/server/services/email/server/index.js index c36524a..18c69aa 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(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xa9e0[_0x1facfa];return _0x9ec701;};'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(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x138f59,_0x1b53fb){_0x138f59=_0x138f59-0x0;var _0x3d114d=_0xa9e0[_0x138f59];return _0x3d114d;};'use strict';var jayson=require(_0x0a9e('0x0'));var BPromise=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var logger=require('../../../config/logger')('email');exports[_0x0a9e('0x3')]=function(_0x4ce2f1,_0x333808){return new BPromise(function(_0x432180,_0x2ab90b){var _0x991246={'SendMail':function(_0x981158){var _0x57b080=this;return new Promise(function(_0x219af0,_0x441e3a){_0x333808[_0x0a9e('0x4')](_0x981158['account'],_0x981158['message'])[_0x0a9e('0x5')](function(_0x56465b){_0x219af0({'code':0xc8,'message':_0x56465b});})['catch'](function(_0x39753a){_0x441e3a(_0x57b080[_0x0a9e('0x6')](0x1f4,_0x39753a));});});},'VerifySmtp':function(_0x307b3e){var _0x3ab53f=this;return new Promise(function(_0xfeb75b,_0xbd1168){_0x333808['verifySmtp'](_0x307b3e['account'])['then'](function(_0x4cfe67){_0xfeb75b({'code':0xc8,'message':_0x0a9e('0x7')});})[_0x0a9e('0x8')](function(_0xd5b662){_0xbd1168(_0x3ab53f[_0x0a9e('0x6')](0x1f4,_0xd5b662));});});},'MailAccounts':function(_0x32d742){return new Promise(function(_0x69aeb7,_0x5db4b0){var _0x4283ce=_[_0x0a9e('0x9')](_0x4ce2f1[_0x0a9e('0xa')]);for(var _0x281129=0x0;_0x281129<_0x4283ce[_0x0a9e('0xb')];_0x281129+=0x1){if(_0x4283ce[_0x281129][_0x0a9e('0xc')]&&_0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')]){delete _0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')];}if(_0x4283ce[_0x281129]['Smtp']&&_0x4283ce[_0x281129][_0x0a9e('0xe')][_0x0a9e('0xf')]){delete _0x4283ce[_0x281129]['Smtp'][_0x0a9e('0xf')];}}_0x69aeb7({'count':_0x4283ce['length'],'rows':_0x4283ce});});}};var _0x459eb1=jayson[_0x0a9e('0x10')](_0x991246)[_0x0a9e('0x11')]();_0x459eb1['on'](_0x0a9e('0x6'),function(_0x31b1ca){logger[_0x0a9e('0x6')](JSON[_0x0a9e('0x12')](_0x31b1ca));return _0x2ab90b(_0x31b1ca);});_0x459eb1[_0x0a9e('0x3')](0x232b,_0x0a9e('0x13'),function(){console[_0x0a9e('0x14')](_0x0a9e('0x15'),0x232b);return _0x432180(_0x0a9e('0x16')+0x232b);});});}; \ No newline at end of file diff --git a/server/services/express/index.js b/server/services/express/index.js index fb64fae..078b5a5 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 _0xa429=['../../config/socketio','default','../../routes','listening','log','Express\x20server\x20listening\x20on\x20port\x20%d!','exports','http','sticky-session','../../config/environment','timeout','listen','port','socket.io','websocket','polling','redis','defaults','adapter','socket.io-redis','../../config/triggers'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa429,0xaf));var _0x9a42=function(_0x2ffa30,_0x4c41eb){_0x2ffa30=_0x2ffa30-0x0;var _0x142513=_0xa429[_0x2ffa30];return _0x142513;};'use strict';var _=require('lodash');var http=require(_0x9a42('0x0'));var express=require('express');var sticky=require(_0x9a42('0x1'));var Redis=require('ioredis');var config=require(_0x9a42('0x2'));var app=express();var server=http['createServer'](app);server[_0x9a42('0x3')]=0xdbba0;if(sticky[_0x9a42('0x4')](server,config[_0x9a42('0x5')])){var socketio=require(_0x9a42('0x6'))(server,{'transports':[_0x9a42('0x7'),_0x9a42('0x8')]});config[_0x9a42('0x9')]=_[_0x9a42('0xa')](config[_0x9a42('0x9')],{'host':'localhost','port':0x18eb});socketio[_0x9a42('0xb')](require(_0x9a42('0xc'))({'pubClient':new Redis(config[_0x9a42('0x9')]),'subClient':new Redis(config[_0x9a42('0x9')])}));require(_0x9a42('0xd'))['default']();require(_0x9a42('0xe'))[_0x9a42('0xf')](socketio);require('../../config/express')[_0x9a42('0xf')](app);require(_0x9a42('0x10'))[_0x9a42('0xf')](app);}else{server['once'](_0x9a42('0x11'),function(){console[_0x9a42('0x12')](_0x9a42('0x13'),config[_0x9a42('0x5')]);});}exports=module[_0x9a42('0x14')]=app; \ No newline at end of file +var _0x82cb=['once','listening','log','Express\x20server\x20listening\x20on\x20port\x20%d!','exports','http','express','sticky-session','ioredis','../../config/environment','createServer','timeout','listen','websocket','polling','redis','defaults','localhost','adapter','socket.io-redis','../../config/triggers','../../config/socketio','default','../../config/express','../../routes'];(function(_0x165ad0,_0x48f424){var _0x203068=function(_0x2cdee6){while(--_0x2cdee6){_0x165ad0['push'](_0x165ad0['shift']());}};_0x203068(++_0x48f424);}(_0x82cb,0x17c));var _0xb82c=function(_0xec695c,_0x6d98df){_0xec695c=_0xec695c-0x0;var _0x3ccfd6=_0x82cb[_0xec695c];return _0x3ccfd6;};'use strict';var _=require('lodash');var http=require(_0xb82c('0x0'));var express=require(_0xb82c('0x1'));var sticky=require(_0xb82c('0x2'));var Redis=require(_0xb82c('0x3'));var config=require(_0xb82c('0x4'));var app=express();var server=http[_0xb82c('0x5')](app);server[_0xb82c('0x6')]=0xdbba0;if(sticky[_0xb82c('0x7')](server,config['port'])){var socketio=require('socket.io')(server,{'transports':[_0xb82c('0x8'),_0xb82c('0x9')]});config[_0xb82c('0xa')]=_[_0xb82c('0xb')](config[_0xb82c('0xa')],{'host':_0xb82c('0xc'),'port':0x18eb});socketio[_0xb82c('0xd')](require(_0xb82c('0xe'))({'pubClient':new Redis(config['redis']),'subClient':new Redis(config[_0xb82c('0xa')])}));require(_0xb82c('0xf'))['default']();require(_0xb82c('0x10'))[_0xb82c('0x11')](socketio);require(_0xb82c('0x12'))[_0xb82c('0x11')](app);require(_0xb82c('0x13'))[_0xb82c('0x11')](app);}else{server[_0xb82c('0x14')](_0xb82c('0x15'),function(){console[_0xb82c('0x16')](_0xb82c('0x17'),config['port']);});}exports=module[_0xb82c('0x18')]=app; \ No newline at end of file diff --git a/server/services/routing/client.js b/server/services/routing/client.js index b3b5ba8..23c5799 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 _0xee7b=['catch','exports','jayson/promise','bluebird','../../config/logger','routing','http','Request','debug','error','rpc','message'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0xee7b,0x1d6));var _0xbee7=function(_0x41c04c,_0x1aef4b){_0x41c04c=_0x41c04c-0x0;var _0x47eb30=_0xee7b[_0x41c04c];return _0x47eb30;};'use strict';var jayson=require(_0xbee7('0x0'));var BPromise=require(_0xbee7('0x1'));var logger=require(_0xbee7('0x2'))(_0xbee7('0x3'));var client=jayson['client'][_0xbee7('0x4')]({'port':0x2329});client[_0xbee7('0x5')]=function(_0x391071,_0x38ddfb){return new BPromise(function(_0x4092bb,_0xa3e50b){return client['request'](_0x391071,_0x38ddfb)['then'](function(_0x531c3d){logger[_0xbee7('0x6')]('rpc',_0xbee7('0x3'),_0x391071,_0x38ddfb,_0x531c3d);if(_0x531c3d[_0xbee7('0x7')]){logger[_0xbee7('0x7')](_0xbee7('0x8'),'routing',_0x391071,_0x531c3d[_0xbee7('0x7')][_0xbee7('0x9')],_0x38ddfb);return _0xa3e50b(_0x531c3d[_0xbee7('0x7')][_0xbee7('0x9')]);}else{return _0x4092bb(_0x531c3d['result']);}})[_0xbee7('0xa')](function(_0x6cc75d){logger['error'](_0xbee7('0x8'),_0xbee7('0x3'),_0x391071,_0x6cc75d,_0x38ddfb);return _0xa3e50b(_0x6cc75d);});});};module[_0xbee7('0xb')]=client; \ No newline at end of file +var _0x8236=['bluebird','routing','client','http','Request','debug','error','result','rpc','exports','jayson/promise'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x8236,0xba));var _0x6823=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0x8236[_0x4b055c];return _0x4b62bb;};'use strict';var jayson=require(_0x6823('0x0'));var BPromise=require(_0x6823('0x1'));var logger=require('../../config/logger')(_0x6823('0x2'));var client=jayson[_0x6823('0x3')][_0x6823('0x4')]({'port':0x2329});client[_0x6823('0x5')]=function(_0x4124b8,_0xc7c2ea){return new BPromise(function(_0x29ae69,_0x550c00){return client['request'](_0x4124b8,_0xc7c2ea)['then'](function(_0x4bf99b){logger[_0x6823('0x6')]('rpc',_0x6823('0x2'),_0x4124b8,_0xc7c2ea,_0x4bf99b);if(_0x4bf99b[_0x6823('0x7')]){logger['error']('rpc',_0x6823('0x2'),_0x4124b8,_0x4bf99b[_0x6823('0x7')]['message'],_0xc7c2ea);return _0x550c00(_0x4bf99b[_0x6823('0x7')]['message']);}else{return _0x29ae69(_0x4bf99b[_0x6823('0x8')]);}})['catch'](function(_0x565888){logger['error'](_0x6823('0x9'),_0x6823('0x2'),_0x4124b8,_0x565888,_0xc7c2ea);return _0x550c00(_0x565888);});});};module[_0x6823('0xa')]=client; \ No newline at end of file diff --git a/server/services/routing/index.js b/server/services/routing/index.js index 4e94403..4824244 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 _0x62c4=['./rpc/user','./rpc/openchannelQueue','./rpc/chatQueue','./rpc/faxQueue','./rpc/whatsappQueue','resolve','then','getAgents','initAgents','getIntervals','initIntervals','getOpenchannelQueues','initOpenchannelQueues','initChatQueues','getSmsQueues','getMailQueues','initMailQueues','getFaxQueues','initFaxQueues','initWhatsappQueues','catch','log','bluebird','./server','./realtime'];(function(_0xf20e30,_0x188279){var _0x296340=function(_0x206602){while(--_0x206602){_0xf20e30['push'](_0xf20e30['shift']());}};_0x296340(++_0x188279);}(_0x62c4,0x93));var _0x462c=function(_0x37ac01,_0x506745){_0x37ac01=_0x37ac01-0x0;var _0x217b4e=_0x62c4[_0x37ac01];return _0x217b4e;};'use strict';var BPromise=require(_0x462c('0x0'));var server=require(_0x462c('0x1'));var Realtime=require(_0x462c('0x2'));var user=require(_0x462c('0x3'));var interval=require('./rpc/interval');var openchannelQueue=require(_0x462c('0x4'));var chatQueue=require(_0x462c('0x5'));var smsQueue=require('./rpc/smsQueue');var mailQueue=require('./rpc/mailQueue');var faxQueue=require(_0x462c('0x6'));var whatsappQueue=require(_0x462c('0x7'));var realtime=new Realtime();function initRealtime(){return BPromise[_0x462c('0x8')]()[_0x462c('0x9')](user[_0x462c('0xa')]())[_0x462c('0x9')](realtime[_0x462c('0xb')]())[_0x462c('0x9')](interval[_0x462c('0xc')]())[_0x462c('0x9')](realtime[_0x462c('0xd')]())[_0x462c('0x9')](openchannelQueue[_0x462c('0xe')]())[_0x462c('0x9')](realtime[_0x462c('0xf')]())[_0x462c('0x9')](chatQueue['getChatQueues']())['then'](realtime[_0x462c('0x10')]())['then'](smsQueue[_0x462c('0x11')]())[_0x462c('0x9')](realtime['initSmsQueues']())[_0x462c('0x9')](mailQueue[_0x462c('0x12')]())[_0x462c('0x9')](realtime[_0x462c('0x13')]())['then'](faxQueue[_0x462c('0x14')]())[_0x462c('0x9')](realtime[_0x462c('0x15')]())[_0x462c('0x9')](whatsappQueue['getWhatsappQueues']())['then'](realtime[_0x462c('0x16')]())[_0x462c('0x9')](function(){return realtime;});}function main(){return server['listen'](realtime)[_0x462c('0x9')](function(_0x30c04d){return initRealtime();})['then'](function(_0x2f98b2){return setInterval(initRealtime,0x1388);})[_0x462c('0x17')](function(_0x4cf413){console[_0x462c('0x18')](_0x4cf413);});}main(); \ No newline at end of file +var _0x5629=['getAgents','initAgents','getIntervals','initIntervals','getOpenchannelQueues','initOpenchannelQueues','getChatQueues','initChatQueues','initSmsQueues','getMailQueues','initMailQueues','getFaxQueues','initFaxQueues','getWhatsappQueues','initWhatsappQueues','listen','bluebird','./server','./rpc/user','./rpc/interval','./rpc/chatQueue','./rpc/smsQueue','./rpc/mailQueue','./rpc/faxQueue','resolve','then'];(function(_0x362c1e,_0x42a74f){var _0x573180=function(_0x511b1b){while(--_0x511b1b){_0x362c1e['push'](_0x362c1e['shift']());}};_0x573180(++_0x42a74f);}(_0x5629,0x12e));var _0x9562=function(_0x2cd2f5,_0x268405){_0x2cd2f5=_0x2cd2f5-0x0;var _0x3ae97c=_0x5629[_0x2cd2f5];return _0x3ae97c;};'use strict';var BPromise=require(_0x9562('0x0'));var server=require(_0x9562('0x1'));var Realtime=require('./realtime');var user=require(_0x9562('0x2'));var interval=require(_0x9562('0x3'));var openchannelQueue=require('./rpc/openchannelQueue');var chatQueue=require(_0x9562('0x4'));var smsQueue=require(_0x9562('0x5'));var mailQueue=require(_0x9562('0x6'));var faxQueue=require(_0x9562('0x7'));var whatsappQueue=require('./rpc/whatsappQueue');var realtime=new Realtime();function initRealtime(){return BPromise[_0x9562('0x8')]()[_0x9562('0x9')](user[_0x9562('0xa')]())[_0x9562('0x9')](realtime[_0x9562('0xb')]())[_0x9562('0x9')](interval[_0x9562('0xc')]())[_0x9562('0x9')](realtime[_0x9562('0xd')]())[_0x9562('0x9')](openchannelQueue[_0x9562('0xe')]())[_0x9562('0x9')](realtime[_0x9562('0xf')]())['then'](chatQueue[_0x9562('0x10')]())[_0x9562('0x9')](realtime[_0x9562('0x11')]())[_0x9562('0x9')](smsQueue['getSmsQueues']())[_0x9562('0x9')](realtime[_0x9562('0x12')]())[_0x9562('0x9')](mailQueue[_0x9562('0x13')]())[_0x9562('0x9')](realtime[_0x9562('0x14')]())['then'](faxQueue[_0x9562('0x15')]())[_0x9562('0x9')](realtime[_0x9562('0x16')]())['then'](whatsappQueue[_0x9562('0x17')]())['then'](realtime[_0x9562('0x18')]())[_0x9562('0x9')](function(){return realtime;});}function main(){return server[_0x9562('0x19')](realtime)[_0x9562('0x9')](function(_0x3ca006){return initRealtime();})['then'](function(_0xb9581a){return setInterval(initRealtime,0x1388);})['catch'](function(_0x3b91a0){console['log'](_0x3b91a0);});}main(); \ No newline at end of file diff --git a/server/services/routing/lib/rule-engine.js b/server/services/routing/lib/rule-engine.js index 772fd30..71bc7b5 100644 --- a/server/services/routing/lib/rule-engine.js +++ b/server/services/routing/lib/rule-engine.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5fc3=['lodash','util','EventEmitter','init','isNil','ignoreFactChanges','inherits','activeRules','prototype','register','isArray','rules','isObject','sync','orderBy','asc','execute','clone','ruleRef','name','index_','push','call','nextTick','next','isEqual','restart','length','condition','matchPath','noop','findRules','filter','prioritize','priority','toJSON','map','consequence','toString','fromJSON','isString','parse'];(function(_0x3cc651,_0x55e349){var _0x2b0f17=function(_0x5731e6){while(--_0x5731e6){_0x3cc651['push'](_0x3cc651['shift']());}};_0x2b0f17(++_0x55e349);}(_0x5fc3,0xa8));var _0x35fc=function(_0x1a8f86,_0x5ed9c4){_0x1a8f86=_0x1a8f86-0x0;var _0x20d876=_0x5fc3[_0x1a8f86];return _0x20d876;};'use strict';var _=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var EventEmitter=require('events')[_0x35fc('0x2')];function RuleEngine(_0x2ac6da,_0x196bc2){this[_0x35fc('0x3')]();if(!_[_0x35fc('0x4')](_0x2ac6da)){this['register'](_0x2ac6da);}if(_0x196bc2){this[_0x35fc('0x5')]=_0x196bc2[_0x35fc('0x5')];}return this;}util[_0x35fc('0x6')](RuleEngine,EventEmitter);RuleEngine['prototype']['init']=function(_0x19a0d1){this['rules']=[];this[_0x35fc('0x7')]=[];};RuleEngine[_0x35fc('0x8')][_0x35fc('0x9')]=function(_0x1e5f90){if(Array[_0x35fc('0xa')](_0x1e5f90)){this[_0x35fc('0xb')]=this[_0x35fc('0xb')]['concat'](_0x1e5f90);}else if(_0x1e5f90!==null&&_[_0x35fc('0xc')](_0x1e5f90)){this[_0x35fc('0xb')]['push'](_0x1e5f90);}this[_0x35fc('0xd')]();};RuleEngine[_0x35fc('0x8')]['sync']=function(){this[_0x35fc('0x7')]=this[_0x35fc('0xb')]['filter'](function(_0x4cbe74){if(_[_0x35fc('0x4')](_0x4cbe74['on'])){_0x4cbe74['on']=!![];}if(_0x4cbe74['on']===!![]){return _0x4cbe74;}});this['activeRules']=_[_0x35fc('0xe')](this[_0x35fc('0x7')],['p'],[_0x35fc('0xf')]);};RuleEngine[_0x35fc('0x8')][_0x35fc('0x10')]=function(_0x5cfe94,_0x59507a){var _0x5eac0f=![];_0x5cfe94['result']=!![];var _0x398b67=_[_0x35fc('0x11')](_0x5cfe94);var _0x53b898=_[_0x35fc('0x11')](_0x5cfe94);var _0x227a49=this[_0x35fc('0x7')];var _0x480851=[];var _0x26ba54=this[_0x35fc('0x5')];(function FnRuleLoop(_0x553677){var _0x41e165={'rules':function(){return _0x227a49;},'rule':function(){return _0x227a49[_0x553677];},'when':function(_0x363e47){if(_0x363e47){var _0x2e513b=_0x227a49[_0x553677]['consequence'];_0x2e513b[_0x35fc('0x12')]=_0x227a49[_0x553677]['id']||_0x227a49[_0x553677][_0x35fc('0x13')]||_0x35fc('0x14')+_0x553677;process['nextTick'](function(){_0x480851[_0x35fc('0x15')](_0x2e513b[_0x35fc('0x12')]);_0x2e513b[_0x35fc('0x16')](_0x398b67,_0x41e165);});}else{process[_0x35fc('0x17')](function(){_0x41e165[_0x35fc('0x18')]();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x5eac0f=!![];return FnRuleLoop(0x0);},'next':function(_0x21f1a9){if(!_0x26ba54&&!_[_0x35fc('0x19')](_0x53b898,_0x398b67)){_0x53b898=_[_0x35fc('0x11')](_0x398b67);process[_0x35fc('0x17')](function(){_0x41e165[_0x35fc('0x1a')]();});}else{process['nextTick'](function(){if(_[_0x35fc('0x4')](_0x21f1a9)){return FnRuleLoop(_0x553677+0x1);}else{return FnRuleLoop(_0x21f1a9);}});}}};if(_0x553677<_0x227a49[_0x35fc('0x1b')]&&_0x5eac0f===![]){var _0x257719=_0x227a49[_0x553677][_0x35fc('0x1c')];_0x257719[_0x35fc('0x16')](_0x398b67,_0x41e165);}else{process['nextTick'](function(){_0x398b67[_0x35fc('0x1d')]=_0x480851;return _0x59507a?_0x59507a(_0x398b67):_[_0x35fc('0x1e')]();});}}(0x0));};RuleEngine['prototype'][_0x35fc('0x1f')]=function(_0x5a93df){if(_[_0x35fc('0x4')](_0x5a93df)){return this['rules'];}else{var _0x4086e9=_['matches'](_0x5a93df);return _[_0x35fc('0x20')](this[_0x35fc('0xb')],_0x4086e9);}};RuleEngine['prototype']['turn']=function(_0x47774c,_0x58edb6){var _0x274208=_0x47774c==='on'||_0x47774c==='ON'?!![]:![];var _0x1a5d92=this['findRules'](_0x58edb6);for(var _0x26b7cb=0x0,_0x645eac=_0x1a5d92[_0x35fc('0x1b')];_0x26b7cb<_0x645eac;_0x26b7cb+=0x1){_0x1a5d92[_0x26b7cb]['on']=_0x274208;}this[_0x35fc('0xd')]();};RuleEngine[_0x35fc('0x8')][_0x35fc('0x21')]=function(_0x11ccdb,_0x451f0c){_0x11ccdb=parseInt(_0x11ccdb,0xa);var _0x54aedc=this[_0x35fc('0x1f')](_0x451f0c);for(var _0x220931=0x0,_0x22af18=_0x54aedc['length'];_0x220931<_0x22af18;_0x220931+=0x1){_0x54aedc[_0x220931][_0x35fc('0x22')]=_0x11ccdb;}this[_0x35fc('0xd')]();};RuleEngine[_0x35fc('0x8')][_0x35fc('0x23')]=function(){var _0xd8a4ca=this[_0x35fc('0xb')];if(_0xd8a4ca instanceof Array){_0xd8a4ca=_0xd8a4ca[_0x35fc('0x24')](function(_0x37b435){_0x37b435[_0x35fc('0x1c')]=_0x37b435[_0x35fc('0x1c')]['toString']();_0x37b435['consequence']=_0x37b435[_0x35fc('0x25')]['toString']();return _0x37b435;});}else if(!_[_0x35fc('0x4')](_0xd8a4ca)){_0xd8a4ca[_0x35fc('0x1c')]=_0xd8a4ca[_0x35fc('0x1c')][_0x35fc('0x26')]();_0xd8a4ca[_0x35fc('0x25')]=_0xd8a4ca[_0x35fc('0x25')]['toString']();}return _0xd8a4ca;};RuleEngine[_0x35fc('0x8')][_0x35fc('0x27')]=function(_0x46b9ef){this[_0x35fc('0x3')]();if(_[_0x35fc('0x28')](_0x46b9ef)){_0x46b9ef=JSON[_0x35fc('0x29')](_0x46b9ef);}if(_0x46b9ef instanceof Array){_0x46b9ef=_0x46b9ef['map'](function(_0x2483be){_0x2483be[_0x35fc('0x1c')]=eval('('+_0x2483be[_0x35fc('0x1c')]+')');_0x2483be['consequence']=eval('('+_0x2483be[_0x35fc('0x25')]+')');return _0x2483be;});}else if(_0x46b9ef!==null&&typeof _0x46b9ef=='object'){_0x46b9ef[_0x35fc('0x1c')]=eval('('+_0x46b9ef[_0x35fc('0x1c')]+')');_0x46b9ef[_0x35fc('0x25')]=eval('('+_0x46b9ef[_0x35fc('0x25')]+')');}this['register'](_0x46b9ef);};module['exports']=RuleEngine; \ No newline at end of file +var _0x5fc3=['lodash','util','EventEmitter','init','isNil','ignoreFactChanges','inherits','activeRules','prototype','register','isArray','rules','isObject','sync','orderBy','asc','execute','clone','ruleRef','name','index_','push','call','nextTick','next','isEqual','restart','length','condition','matchPath','noop','findRules','filter','prioritize','priority','toJSON','map','consequence','toString','fromJSON','isString','parse'];(function(_0x2b9c5a,_0x52f3e7){var _0x2e0b2b=function(_0x51b225){while(--_0x51b225){_0x2b9c5a['push'](_0x2b9c5a['shift']());}};_0x2e0b2b(++_0x52f3e7);}(_0x5fc3,0xa8));var _0x35fc=function(_0x56fe98,_0x43dc16){_0x56fe98=_0x56fe98-0x0;var _0x212f4f=_0x5fc3[_0x56fe98];return _0x212f4f;};'use strict';var _=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var EventEmitter=require('events')[_0x35fc('0x2')];function RuleEngine(_0x2ac6da,_0x196bc2){this[_0x35fc('0x3')]();if(!_[_0x35fc('0x4')](_0x2ac6da)){this['register'](_0x2ac6da);}if(_0x196bc2){this[_0x35fc('0x5')]=_0x196bc2[_0x35fc('0x5')];}return this;}util[_0x35fc('0x6')](RuleEngine,EventEmitter);RuleEngine['prototype']['init']=function(_0x19a0d1){this['rules']=[];this[_0x35fc('0x7')]=[];};RuleEngine[_0x35fc('0x8')][_0x35fc('0x9')]=function(_0x1e5f90){if(Array[_0x35fc('0xa')](_0x1e5f90)){this[_0x35fc('0xb')]=this[_0x35fc('0xb')]['concat'](_0x1e5f90);}else if(_0x1e5f90!==null&&_[_0x35fc('0xc')](_0x1e5f90)){this[_0x35fc('0xb')]['push'](_0x1e5f90);}this[_0x35fc('0xd')]();};RuleEngine[_0x35fc('0x8')]['sync']=function(){this[_0x35fc('0x7')]=this[_0x35fc('0xb')]['filter'](function(_0x4cbe74){if(_[_0x35fc('0x4')](_0x4cbe74['on'])){_0x4cbe74['on']=!![];}if(_0x4cbe74['on']===!![]){return _0x4cbe74;}});this['activeRules']=_[_0x35fc('0xe')](this[_0x35fc('0x7')],['p'],[_0x35fc('0xf')]);};RuleEngine[_0x35fc('0x8')][_0x35fc('0x10')]=function(_0x5cfe94,_0x59507a){var _0x5eac0f=![];_0x5cfe94['result']=!![];var _0x398b67=_[_0x35fc('0x11')](_0x5cfe94);var _0x53b898=_[_0x35fc('0x11')](_0x5cfe94);var _0x227a49=this[_0x35fc('0x7')];var _0x480851=[];var _0x26ba54=this[_0x35fc('0x5')];(function FnRuleLoop(_0x553677){var _0x41e165={'rules':function(){return _0x227a49;},'rule':function(){return _0x227a49[_0x553677];},'when':function(_0x363e47){if(_0x363e47){var _0x2e513b=_0x227a49[_0x553677]['consequence'];_0x2e513b[_0x35fc('0x12')]=_0x227a49[_0x553677]['id']||_0x227a49[_0x553677][_0x35fc('0x13')]||_0x35fc('0x14')+_0x553677;process['nextTick'](function(){_0x480851[_0x35fc('0x15')](_0x2e513b[_0x35fc('0x12')]);_0x2e513b[_0x35fc('0x16')](_0x398b67,_0x41e165);});}else{process[_0x35fc('0x17')](function(){_0x41e165[_0x35fc('0x18')]();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x5eac0f=!![];return FnRuleLoop(0x0);},'next':function(_0x21f1a9){if(!_0x26ba54&&!_[_0x35fc('0x19')](_0x53b898,_0x398b67)){_0x53b898=_[_0x35fc('0x11')](_0x398b67);process[_0x35fc('0x17')](function(){_0x41e165[_0x35fc('0x1a')]();});}else{process['nextTick'](function(){if(_[_0x35fc('0x4')](_0x21f1a9)){return FnRuleLoop(_0x553677+0x1);}else{return FnRuleLoop(_0x21f1a9);}});}}};if(_0x553677<_0x227a49[_0x35fc('0x1b')]&&_0x5eac0f===![]){var _0x257719=_0x227a49[_0x553677][_0x35fc('0x1c')];_0x257719[_0x35fc('0x16')](_0x398b67,_0x41e165);}else{process['nextTick'](function(){_0x398b67[_0x35fc('0x1d')]=_0x480851;return _0x59507a?_0x59507a(_0x398b67):_[_0x35fc('0x1e')]();});}}(0x0));};RuleEngine['prototype'][_0x35fc('0x1f')]=function(_0x5a93df){if(_[_0x35fc('0x4')](_0x5a93df)){return this['rules'];}else{var _0x4086e9=_['matches'](_0x5a93df);return _[_0x35fc('0x20')](this[_0x35fc('0xb')],_0x4086e9);}};RuleEngine['prototype']['turn']=function(_0x47774c,_0x58edb6){var _0x274208=_0x47774c==='on'||_0x47774c==='ON'?!![]:![];var _0x1a5d92=this['findRules'](_0x58edb6);for(var _0x26b7cb=0x0,_0x645eac=_0x1a5d92[_0x35fc('0x1b')];_0x26b7cb<_0x645eac;_0x26b7cb+=0x1){_0x1a5d92[_0x26b7cb]['on']=_0x274208;}this[_0x35fc('0xd')]();};RuleEngine[_0x35fc('0x8')][_0x35fc('0x21')]=function(_0x11ccdb,_0x451f0c){_0x11ccdb=parseInt(_0x11ccdb,0xa);var _0x54aedc=this[_0x35fc('0x1f')](_0x451f0c);for(var _0x220931=0x0,_0x22af18=_0x54aedc['length'];_0x220931<_0x22af18;_0x220931+=0x1){_0x54aedc[_0x220931][_0x35fc('0x22')]=_0x11ccdb;}this[_0x35fc('0xd')]();};RuleEngine[_0x35fc('0x8')][_0x35fc('0x23')]=function(){var _0xd8a4ca=this[_0x35fc('0xb')];if(_0xd8a4ca instanceof Array){_0xd8a4ca=_0xd8a4ca[_0x35fc('0x24')](function(_0x37b435){_0x37b435[_0x35fc('0x1c')]=_0x37b435[_0x35fc('0x1c')]['toString']();_0x37b435['consequence']=_0x37b435[_0x35fc('0x25')]['toString']();return _0x37b435;});}else if(!_[_0x35fc('0x4')](_0xd8a4ca)){_0xd8a4ca[_0x35fc('0x1c')]=_0xd8a4ca[_0x35fc('0x1c')][_0x35fc('0x26')]();_0xd8a4ca[_0x35fc('0x25')]=_0xd8a4ca[_0x35fc('0x25')]['toString']();}return _0xd8a4ca;};RuleEngine[_0x35fc('0x8')][_0x35fc('0x27')]=function(_0x46b9ef){this[_0x35fc('0x3')]();if(_[_0x35fc('0x28')](_0x46b9ef)){_0x46b9ef=JSON[_0x35fc('0x29')](_0x46b9ef);}if(_0x46b9ef instanceof Array){_0x46b9ef=_0x46b9ef['map'](function(_0x2483be){_0x2483be[_0x35fc('0x1c')]=eval('('+_0x2483be[_0x35fc('0x1c')]+')');_0x2483be['consequence']=eval('('+_0x2483be[_0x35fc('0x25')]+')');return _0x2483be;});}else if(_0x46b9ef!==null&&typeof _0x46b9ef=='object'){_0x46b9ef[_0x35fc('0x1c')]=eval('('+_0x46b9ef[_0x35fc('0x1c')]+')');_0x46b9ef[_0x35fc('0x25')]=eval('('+_0x46b9ef[_0x35fc('0x25')]+')');}this['register'](_0x46b9ef);};module['exports']=RuleEngine; \ No newline at end of file diff --git a/server/services/routing/mailRpc/index.js b/server/services/routing/mailRpc/index.js index dd88a5b..3b1a448 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 _0xc187=['request','then','catch','sendMailMessage','SendMail','jayson/promise','client','http'];(function(_0x9d1e6b,_0x3bdc22){var _0x2b3070=function(_0x4c4ced){while(--_0x4c4ced){_0x9d1e6b['push'](_0x9d1e6b['shift']());}};_0x2b3070(++_0x3bdc22);}(_0xc187,0x155));var _0x7c18=function(_0x2f3848,_0x48564d){_0x2f3848=_0x2f3848-0x0;var _0x102668=_0xc187[_0x2f3848];return _0x102668;};'use strict';var BPromise=require('bluebird');var jayson=require(_0x7c18('0x0'));var client=jayson[_0x7c18('0x1')][_0x7c18('0x2')]({'port':0x232b});function request(_0x7a0f29,_0x1f2ae8){return new BPromise(function(_0x121817,_0xc65b99){return client[_0x7c18('0x3')](_0x7a0f29,_0x1f2ae8)[_0x7c18('0x4')](function(_0x4d6628){if(_0x4d6628['error']){return _0xc65b99(_0x4d6628['error']['message']);}else{return _0x121817(_0x4d6628['result']);}})[_0x7c18('0x5')](function(_0x2c5fda){return _0xc65b99(_0x2c5fda);});});}exports[_0x7c18('0x6')]=function(_0xb05dc1,_0x54fa92){return request(_0x7c18('0x7'),{'account':_0xb05dc1,'message':_0x54fa92});}; \ No newline at end of file +var _0xb3c9=['error','message','result','sendMailMessage','SendMail','jayson/promise','client','http','request','then'];(function(_0x5c50f7,_0x312a25){var _0x41aa2d=function(_0x239e67){while(--_0x239e67){_0x5c50f7['push'](_0x5c50f7['shift']());}};_0x41aa2d(++_0x312a25);}(_0xb3c9,0x1c7));var _0x9b3c=function(_0x3763a1,_0x5f1e2b){_0x3763a1=_0x3763a1-0x0;var _0x38c606=_0xb3c9[_0x3763a1];return _0x38c606;};'use strict';var BPromise=require('bluebird');var jayson=require(_0x9b3c('0x0'));var client=jayson[_0x9b3c('0x1')][_0x9b3c('0x2')]({'port':0x232b});function request(_0x342faf,_0xcc2b82){return new BPromise(function(_0x5ee2b2,_0x319457){return client[_0x9b3c('0x3')](_0x342faf,_0xcc2b82)[_0x9b3c('0x4')](function(_0x27e674){if(_0x27e674['error']){return _0x319457(_0x27e674[_0x9b3c('0x5')][_0x9b3c('0x6')]);}else{return _0x5ee2b2(_0x27e674[_0x9b3c('0x7')]);}})['catch'](function(_0x158ca5){return _0x319457(_0x158ca5);});});}exports[_0x9b3c('0x8')]=function(_0x2d7471,_0x310631){return request(_0x9b3c('0x9'),{'account':_0x2d7471,'message':_0x310631});}; \ No newline at end of file diff --git a/server/services/routing/model/agent.js b/server/services/routing/model/agent.js index 1066ffe..72d3e74 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 _0x1e91=['voicePause','chatPause','mailPause','faxPause','openchannelPause','chatStatus','unknown','chatStatusTime','chatCapacity','chatCurrentCapacity','mailStatus','mailStatusTime','mailCapacity','faxStatus','faxCapacity','faxCurrentCapacity','smsStatusTime','smsCapacity','smsCurrentCapacity','whatsappStatusTime','whatsappCapacity','whatsappCurrentCapacity','openchannelStatus','openchannelStatusTime','openchannelCapacity','openchannelCurrentCapacity','busy','getChannelStatus','CurrentCapacity','Capacity','maxcapacity','working','idle','prototype','updateRealtime','mail','openchannel','fax','sms','whatsapp','length','Status','toNumber','format','mailCurrentCapacity','faxStatusTime','smsStatus','whatsappStatus','busyQueue','user:save','exports','moment','md5','../../../config/environment','redis','defaults','socket.io-emitter','name','online'];(function(_0x521929,_0x479be5){var _0x632436=function(_0x288290){while(--_0x288290){_0x521929['push'](_0x521929['shift']());}};_0x632436(++_0x479be5);}(_0x1e91,0x1d0));var _0x11e9=function(_0x1fe508,_0x2bad26){_0x1fe508=_0x1fe508-0x0;var _0x58ebdb=_0x1e91[_0x1fe508];return _0x58ebdb;};'use strict';var _=require('lodash');var moment=require(_0x11e9('0x0'));var md5=require(_0x11e9('0x1'));var Redis=require('ioredis');var config=require(_0x11e9('0x2'));config[_0x11e9('0x3')]=_[_0x11e9('0x4')](config[_0x11e9('0x3')],{'host':'localhost','port':0x18eb});var io=require(_0x11e9('0x5'))(new Redis(config[_0x11e9('0x3')]));function Agent(_0x122b7c){this['id']=_0x122b7c['id']||0x0;this[_0x11e9('0x6')]=_0x122b7c[_0x11e9('0x6')]||'';this['online']=_0x122b7c[_0x11e9('0x7')]||!![];this[_0x11e9('0x8')]=_0x122b7c[_0x11e9('0x8')]||![];this[_0x11e9('0x9')]=_0x122b7c[_0x11e9('0x9')]||![];this['mailPause']=_0x122b7c[_0x11e9('0xa')]||![];this[_0x11e9('0xb')]=_0x122b7c[_0x11e9('0xb')]||![];this['smsPause']=_0x122b7c['smsPause']||![];this[_0x11e9('0xc')]=_0x122b7c[_0x11e9('0xc')]||![];this[_0x11e9('0xd')]=_0x11e9('0xe');this[_0x11e9('0xf')]=0x0;this[_0x11e9('0x10')]=_0x122b7c[_0x11e9('0x10')]||0x0;this[_0x11e9('0x11')]=0x0;this[_0x11e9('0x12')]=_0x11e9('0xe');this[_0x11e9('0x13')]=0x0;this[_0x11e9('0x14')]=_0x122b7c['mailCapacity']||0x0;this['mailCurrentCapacity']=0x0;this[_0x11e9('0x15')]=_0x11e9('0xe');this['faxStatusTime']=0x0;this[_0x11e9('0x16')]=_0x122b7c[_0x11e9('0x16')]||0x0;this[_0x11e9('0x17')]=0x0;this['smsStatus']=_0x11e9('0xe');this[_0x11e9('0x18')]=0x0;this[_0x11e9('0x19')]=_0x122b7c[_0x11e9('0x19')]||0x0;this[_0x11e9('0x1a')]=0x0;this['whatsappStatus']=_0x11e9('0xe');this[_0x11e9('0x1b')]=0x0;this[_0x11e9('0x1c')]=_0x122b7c[_0x11e9('0x1c')]||0x0;this[_0x11e9('0x1d')]=0x0;this[_0x11e9('0x1e')]=_0x11e9('0xe');this[_0x11e9('0x1f')]=0x0;this[_0x11e9('0x20')]=_0x122b7c[_0x11e9('0x20')]||0x0;this[_0x11e9('0x21')]=0x0;this[_0x11e9('0x22')]=![];this['busyQueue']=undefined;this[_0x11e9('0x1')]='';this['updateRealtime']();}Agent['prototype'][_0x11e9('0x23')]=function(_0x57eebe){if(this[_0x57eebe+_0x11e9('0x24')]>0x0){if(this[_0x57eebe+_0x11e9('0x25')]>0x0&&this[_0x57eebe+'CurrentCapacity']>=this[_0x57eebe+'Capacity']){return _0x11e9('0x26');}else{return _0x11e9('0x27');}}else{return _0x11e9('0x28');}};Agent[_0x11e9('0x29')][_0x11e9('0x2a')]=function(){var _0xccaa9b=[_0x11e9('0x2b'),'chat',_0x11e9('0x2c'),_0x11e9('0x2d'),_0x11e9('0x2e'),_0x11e9('0x2f')];for(var _0x4f0821=0x0;_0x4f0821<_0xccaa9b[_0x11e9('0x30')];_0x4f0821+=0x1){var _0x541d5d=this[_0x11e9('0x23')](_0xccaa9b[_0x4f0821]);if(this[_0xccaa9b[_0x4f0821]+_0x11e9('0x31')]!==_0x541d5d){this[_0xccaa9b[_0x4f0821]+'StatusTime']=_[_0x11e9('0x32')](moment()[_0x11e9('0x33')]('x'));}this[_0xccaa9b[_0x4f0821]+_0x11e9('0x31')]=_0x541d5d;}var _0x44ebd5={'id':this['id'],'name':this['name'],'online':this[_0x11e9('0x7')],'voicePause':this['voicePause'],'chatPause':this[_0x11e9('0x9')],'mailPause':this[_0x11e9('0xa')],'smsPause':this['smsPause'],'faxPause':this['faxPause'],'openchannelPause':this[_0x11e9('0xc')],'chatStatus':this[_0x11e9('0xd')],'chatStatusTime':this[_0x11e9('0xf')],'chatCapacity':this[_0x11e9('0x10')],'chatCurrentCapacity':this[_0x11e9('0x11')],'mailStatus':this['mailStatus'],'mailStatusTime':this[_0x11e9('0x13')],'mailCapacity':this[_0x11e9('0x14')],'mailCurrentCapacity':this[_0x11e9('0x34')],'faxStatus':this['faxStatus'],'faxStatusTime':this[_0x11e9('0x35')],'faxCapacity':this['faxCapacity'],'faxCurrentCapacity':this['faxCurrentCapacity'],'smsStatus':this[_0x11e9('0x36')],'smsStatusTime':this['smsStatusTime'],'smsCapacity':this[_0x11e9('0x19')],'smsCurrentCapacity':this[_0x11e9('0x1a')],'whatsappStatus':this[_0x11e9('0x37')],'whatsappStatusTime':this[_0x11e9('0x1b')],'whatsappCapacity':this[_0x11e9('0x1c')],'whatsappCurrentCapacity':this['whatsappCurrentCapacity'],'openchannelStatus':this[_0x11e9('0x1e')],'openchannelStatusTime':this['openchannelStatusTime'],'openchannelCapacity':this['openchannelCapacity'],'openchannelCurrentCapacity':this[_0x11e9('0x21')],'busy':this[_0x11e9('0x22')],'busyQueue':this[_0x11e9('0x38')]};var _0x104134=md5(JSON['stringify'](_0x44ebd5));if(this['md5']!==_0x104134){this[_0x11e9('0x1')]=_0x104134;io['emit'](_0x11e9('0x39'),_0x44ebd5);}};module[_0x11e9('0x3a')]=Agent; \ No newline at end of file +var _0xbf06=['chatStatus','unknown','chatStatusTime','chatCapacity','chatCurrentCapacity','mailStatus','mailStatusTime','faxStatusTime','faxCapacity','faxCurrentCapacity','smsStatus','smsCapacity','smsCurrentCapacity','whatsappStatusTime','whatsappCapacity','whatsappCurrentCapacity','openchannelStatus','openchannelCapacity','busy','updateRealtime','getChannelStatus','Capacity','CurrentCapacity','working','idle','prototype','sms','whatsapp','length','toNumber','format','openchannelPause','mailCapacity','mailCurrentCapacity','faxStatus','smsStatusTime','whatsappStatus','openchannelStatusTime','busyQueue','user:save','exports','moment','md5','ioredis','../../../config/environment','redis','defaults','name','online','voicePause','chatPause','mailPause','faxPause','smsPause'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xbf06,0x101));var _0x6bf0=function(_0x166d93,_0x301f09){_0x166d93=_0x166d93-0x0;var _0xba708=_0xbf06[_0x166d93];return _0xba708;};'use strict';var _=require('lodash');var moment=require(_0x6bf0('0x0'));var md5=require(_0x6bf0('0x1'));var Redis=require(_0x6bf0('0x2'));var config=require(_0x6bf0('0x3'));config[_0x6bf0('0x4')]=_[_0x6bf0('0x5')](config[_0x6bf0('0x4')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x6bf0('0x4')]));function Agent(_0x1d9a84){this['id']=_0x1d9a84['id']||0x0;this[_0x6bf0('0x6')]=_0x1d9a84[_0x6bf0('0x6')]||'';this['online']=_0x1d9a84[_0x6bf0('0x7')]||!![];this[_0x6bf0('0x8')]=_0x1d9a84[_0x6bf0('0x8')]||![];this[_0x6bf0('0x9')]=_0x1d9a84[_0x6bf0('0x9')]||![];this['mailPause']=_0x1d9a84[_0x6bf0('0xa')]||![];this[_0x6bf0('0xb')]=_0x1d9a84[_0x6bf0('0xb')]||![];this[_0x6bf0('0xc')]=_0x1d9a84[_0x6bf0('0xc')]||![];this['openchannelPause']=_0x1d9a84['openchannelPause']||![];this[_0x6bf0('0xd')]=_0x6bf0('0xe');this[_0x6bf0('0xf')]=0x0;this[_0x6bf0('0x10')]=_0x1d9a84[_0x6bf0('0x10')]||0x0;this[_0x6bf0('0x11')]=0x0;this[_0x6bf0('0x12')]=_0x6bf0('0xe');this[_0x6bf0('0x13')]=0x0;this['mailCapacity']=_0x1d9a84['mailCapacity']||0x0;this['mailCurrentCapacity']=0x0;this['faxStatus']=_0x6bf0('0xe');this[_0x6bf0('0x14')]=0x0;this[_0x6bf0('0x15')]=_0x1d9a84[_0x6bf0('0x15')]||0x0;this[_0x6bf0('0x16')]=0x0;this[_0x6bf0('0x17')]=_0x6bf0('0xe');this['smsStatusTime']=0x0;this[_0x6bf0('0x18')]=_0x1d9a84[_0x6bf0('0x18')]||0x0;this[_0x6bf0('0x19')]=0x0;this['whatsappStatus']='unknown';this[_0x6bf0('0x1a')]=0x0;this[_0x6bf0('0x1b')]=_0x1d9a84[_0x6bf0('0x1b')]||0x0;this[_0x6bf0('0x1c')]=0x0;this[_0x6bf0('0x1d')]=_0x6bf0('0xe');this['openchannelStatusTime']=0x0;this[_0x6bf0('0x1e')]=_0x1d9a84[_0x6bf0('0x1e')]||0x0;this['openchannelCurrentCapacity']=0x0;this[_0x6bf0('0x1f')]=![];this['busyQueue']=undefined;this[_0x6bf0('0x1')]='';this[_0x6bf0('0x20')]();}Agent['prototype'][_0x6bf0('0x21')]=function(_0x4767bd){if(this[_0x4767bd+'CurrentCapacity']>0x0){if(this[_0x4767bd+_0x6bf0('0x22')]>0x0&&this[_0x4767bd+_0x6bf0('0x23')]>=this[_0x4767bd+_0x6bf0('0x22')]){return'maxcapacity';}else{return _0x6bf0('0x24');}}else{return _0x6bf0('0x25');}};Agent[_0x6bf0('0x26')][_0x6bf0('0x20')]=function(){var _0x204bab=['mail','chat','openchannel','fax',_0x6bf0('0x27'),_0x6bf0('0x28')];for(var _0x20111e=0x0;_0x20111e<_0x204bab[_0x6bf0('0x29')];_0x20111e+=0x1){var _0x306b8a=this[_0x6bf0('0x21')](_0x204bab[_0x20111e]);if(this[_0x204bab[_0x20111e]+'Status']!==_0x306b8a){this[_0x204bab[_0x20111e]+'StatusTime']=_[_0x6bf0('0x2a')](moment()[_0x6bf0('0x2b')]('x'));}this[_0x204bab[_0x20111e]+'Status']=_0x306b8a;}var _0x220c3a={'id':this['id'],'name':this[_0x6bf0('0x6')],'online':this[_0x6bf0('0x7')],'voicePause':this[_0x6bf0('0x8')],'chatPause':this['chatPause'],'mailPause':this[_0x6bf0('0xa')],'smsPause':this[_0x6bf0('0xc')],'faxPause':this[_0x6bf0('0xb')],'openchannelPause':this[_0x6bf0('0x2c')],'chatStatus':this['chatStatus'],'chatStatusTime':this[_0x6bf0('0xf')],'chatCapacity':this['chatCapacity'],'chatCurrentCapacity':this[_0x6bf0('0x11')],'mailStatus':this[_0x6bf0('0x12')],'mailStatusTime':this[_0x6bf0('0x13')],'mailCapacity':this[_0x6bf0('0x2d')],'mailCurrentCapacity':this[_0x6bf0('0x2e')],'faxStatus':this[_0x6bf0('0x2f')],'faxStatusTime':this[_0x6bf0('0x14')],'faxCapacity':this[_0x6bf0('0x15')],'faxCurrentCapacity':this[_0x6bf0('0x16')],'smsStatus':this[_0x6bf0('0x17')],'smsStatusTime':this[_0x6bf0('0x30')],'smsCapacity':this[_0x6bf0('0x18')],'smsCurrentCapacity':this[_0x6bf0('0x19')],'whatsappStatus':this[_0x6bf0('0x31')],'whatsappStatusTime':this['whatsappStatusTime'],'whatsappCapacity':this[_0x6bf0('0x1b')],'whatsappCurrentCapacity':this[_0x6bf0('0x1c')],'openchannelStatus':this[_0x6bf0('0x1d')],'openchannelStatusTime':this[_0x6bf0('0x32')],'openchannelCapacity':this[_0x6bf0('0x1e')],'openchannelCurrentCapacity':this['openchannelCurrentCapacity'],'busy':this['busy'],'busyQueue':this[_0x6bf0('0x33')]};var _0xf5aea2=md5(JSON['stringify'](_0x220c3a));if(this[_0x6bf0('0x1')]!==_0xf5aea2){this[_0x6bf0('0x1')]=_0xf5aea2;io['emit'](_0x6bf0('0x34'),_0x220c3a);}};module[_0x6bf0('0x35')]=Agent; \ No newline at end of file diff --git a/server/services/routing/model/chatQueue.js b/server/services/routing/model/chatQueue.js index bec0208..7f04732 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 _0xc051=['paused','online','chatPause','available','stringify','chat:queue:%s','emit','chat_queue:save','exports','lodash','md5','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','prototype','_rr','loggedIn'];(function(_0x37cd16,_0x490cec){var _0x46804e=function(_0x585261){while(--_0x585261){_0x37cd16['push'](_0x37cd16['shift']());}};_0x46804e(++_0x490cec);}(_0xc051,0x191));var _0x1c05=function(_0x4a7d06,_0x4cbb90){_0x4a7d06=_0x4a7d06-0x0;var _0x283136=_0xc051[_0x4a7d06];return _0x283136;};'use strict';var _=require(_0x1c05('0x0'));var md5=require(_0x1c05('0x1'));var util=require('util');var Redis=require(_0x1c05('0x2'));var config=require(_0x1c05('0x3'));config[_0x1c05('0x4')]=_[_0x1c05('0x5')](config[_0x1c05('0x4')],{'host':_0x1c05('0x6'),'port':0x18eb});var io=require(_0x1c05('0x7'))(new Redis(config[_0x1c05('0x4')]));function ChatQueue(_0x519833){this['id']=_0x519833['id']||0x0;this[_0x1c05('0x8')]=_0x519833[_0x1c05('0x8')]||'';this['timeout']=_0x519833[_0x1c05('0x9')]||0xa;this[_0x1c05('0xa')]=_0x519833[_0x1c05('0xa')]||_0x1c05('0xb');this[_0x1c05('0xc')]=_0x519833[_0x1c05('0xc')];this[_0x1c05('0xd')]={};this[_0x1c05('0xe')]=0x0;this[_0x1c05('0x1')]='';this[_0x1c05('0xf')]();this['updateRealtime']();}ChatQueue[_0x1c05('0x10')][_0x1c05('0xf')]=function(){var _0x5f1963=this['mapAgentsId']['_rr'];this[_0x1c05('0xd')]=_['map'](this[_0x1c05('0xc')],'id');this[_0x1c05('0xd')][_0x1c05('0x11')]=_0x5f1963;};ChatQueue['prototype']['updateRealtime']=function(){this[_0x1c05('0x12')]=0x0;this[_0x1c05('0x13')]=0x0;for(var _0x2badbe=0x0;_0x2badbe=0x0?this[_0x1c05('0x16')]:0x0;var _0x11c6d7={'id':this['id'],'available':this['available'],'loggedIn':this[_0x1c05('0x12')],'name':this[_0x1c05('0x8')],'paused':this['paused'],'waiting':this['waiting']};var _0x27dd67=md5(JSON[_0x1c05('0x17')](_0x11c6d7));if(this[_0x1c05('0x1')]!==_0x27dd67){this[_0x1c05('0x1')]=_0x27dd67;io['to'](util['format'](_0x1c05('0x18'),_0x11c6d7['name']))[_0x1c05('0x19')](_0x1c05('0x1a'),_0x11c6d7);}};module[_0x1c05('0x1b')]=ChatQueue; \ No newline at end of file +var _0xdf9b=['mapAgentsId','waiting','md5','prototype','updateRouting','_rr','map','updateRealtime','loggedIn','paused','length','online','chatPause','available','format','emit','chat_queue:save','lodash','ioredis','redis','localhost','name','timeout','strategy','beepall','Agents'];(function(_0x5e4b51,_0x2cdf31){var _0x28a1e4=function(_0x35cf2a){while(--_0x35cf2a){_0x5e4b51['push'](_0x5e4b51['shift']());}};_0x28a1e4(++_0x2cdf31);}(_0xdf9b,0x1cb));var _0xbdf9=function(_0x51020b,_0x38c2c7){_0x51020b=_0x51020b-0x0;var _0x371e47=_0xdf9b[_0x51020b];return _0x371e47;};'use strict';var _=require(_0xbdf9('0x0'));var md5=require('md5');var util=require('util');var Redis=require(_0xbdf9('0x1'));var config=require('../../../config/environment');config['redis']=_['defaults'](config[_0xbdf9('0x2')],{'host':_0xbdf9('0x3'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xbdf9('0x2')]));function ChatQueue(_0x37938e){this['id']=_0x37938e['id']||0x0;this['name']=_0x37938e[_0xbdf9('0x4')]||'';this[_0xbdf9('0x5')]=_0x37938e['timeout']||0xa;this[_0xbdf9('0x6')]=_0x37938e[_0xbdf9('0x6')]||_0xbdf9('0x7');this[_0xbdf9('0x8')]=_0x37938e['Agents'];this[_0xbdf9('0x9')]={};this[_0xbdf9('0xa')]=0x0;this[_0xbdf9('0xb')]='';this['updateRouting']();this['updateRealtime']();}ChatQueue[_0xbdf9('0xc')][_0xbdf9('0xd')]=function(){var _0x146928=this[_0xbdf9('0x9')][_0xbdf9('0xe')];this[_0xbdf9('0x9')]=_[_0xbdf9('0xf')](this[_0xbdf9('0x8')],'id');this[_0xbdf9('0x9')][_0xbdf9('0xe')]=_0x146928;};ChatQueue[_0xbdf9('0xc')][_0xbdf9('0x10')]=function(){this[_0xbdf9('0x11')]=0x0;this[_0xbdf9('0x12')]=0x0;for(var _0x3603d5=0x0;_0x3603d5=0x0?this[_0xbdf9('0x16')]:0x0;var _0xbd2a6={'id':this['id'],'available':this[_0xbdf9('0x16')],'loggedIn':this['loggedIn'],'name':this[_0xbdf9('0x4')],'paused':this[_0xbdf9('0x12')],'waiting':this[_0xbdf9('0xa')]};var _0x3e351f=md5(JSON['stringify'](_0xbd2a6));if(this[_0xbdf9('0xb')]!==_0x3e351f){this['md5']=_0x3e351f;io['to'](util[_0xbdf9('0x17')]('chat:queue:%s',_0xbd2a6[_0xbdf9('0x4')]))[_0xbdf9('0x18')](_0xbdf9('0x19'),_0xbd2a6);}};module['exports']=ChatQueue; \ No newline at end of file diff --git a/server/services/routing/model/faxQueue.js b/server/services/routing/model/faxQueue.js index e6424cf..aa8f053 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 _0x89d0=['strategy','beepall','waiting','md5','updateRouting','updateRealtime','prototype','mapAgentsId','_rr','map','Agents','loggedIn','paused','length','online','faxPause','available','stringify','fax:queue:%s','fax_queue:save','exports','lodash','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout'];(function(_0x222741,_0x2adbad){var _0xcee5a9=function(_0x158f0d){while(--_0x158f0d){_0x222741['push'](_0x222741['shift']());}};_0xcee5a9(++_0x2adbad);}(_0x89d0,0x1e6));var _0x089d=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x89d0[_0x3bf83f];return _0x22c4a9;};'use strict';var _=require(_0x089d('0x0'));var md5=require('md5');var util=require(_0x089d('0x1'));var Redis=require(_0x089d('0x2'));var config=require(_0x089d('0x3'));config[_0x089d('0x4')]=_[_0x089d('0x5')](config[_0x089d('0x4')],{'host':_0x089d('0x6'),'port':0x18eb});var io=require(_0x089d('0x7'))(new Redis(config['redis']));function FaxQueue(_0x2231de){this['id']=_0x2231de['id']||0x0;this[_0x089d('0x8')]=_0x2231de[_0x089d('0x8')]||'';this[_0x089d('0x9')]=_0x2231de[_0x089d('0x9')]||0xa;this[_0x089d('0xa')]=_0x2231de['strategy']||_0x089d('0xb');this['Agents']=_0x2231de['Agents'];this['mapAgentsId']={};this[_0x089d('0xc')]=0x0;this[_0x089d('0xd')]='';this[_0x089d('0xe')]();this[_0x089d('0xf')]();}FaxQueue[_0x089d('0x10')][_0x089d('0xe')]=function(){var _0x2ad22c=this[_0x089d('0x11')][_0x089d('0x12')];this['mapAgentsId']=_[_0x089d('0x13')](this[_0x089d('0x14')],'id');this[_0x089d('0x11')][_0x089d('0x12')]=_0x2ad22c;};FaxQueue[_0x089d('0x10')]['updateRealtime']=function(){this[_0x089d('0x15')]=0x0;this[_0x089d('0x16')]=0x0;for(var _0x28e4dd=0x0;_0x28e4dd=0x0?this[_0x089d('0x1a')]:0x0;var _0x2bce85={'id':this['id'],'available':this['available'],'loggedIn':this[_0x089d('0x15')],'name':this[_0x089d('0x8')],'paused':this[_0x089d('0x16')],'waiting':this['waiting']};var _0x12d9b6=md5(JSON[_0x089d('0x1b')](_0x2bce85));if(this[_0x089d('0xd')]!==_0x12d9b6){this[_0x089d('0xd')]=_0x12d9b6;io['to'](util['format'](_0x089d('0x1c'),_0x2bce85['name']))['emit'](_0x089d('0x1d'),_0x2bce85);}};module[_0x089d('0x1e')]=FaxQueue; \ No newline at end of file +var _0x1667=['timeout','strategy','beepall','Agents','mapAgentsId','waiting','md5','updateRealtime','prototype','updateRouting','_rr','loggedIn','paused','faxPause','available','stringify','format','fax:queue:%s','emit','fax_queue:save','exports','lodash','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','name'];(function(_0x4c7fb5,_0x2548ef){var _0x2e10ac=function(_0xf7e27c){while(--_0xf7e27c){_0x4c7fb5['push'](_0x4c7fb5['shift']());}};_0x2e10ac(++_0x2548ef);}(_0x1667,0x149));var _0x7166=function(_0x680821,_0x23e67f){_0x680821=_0x680821-0x0;var _0x3f132c=_0x1667[_0x680821];return _0x3f132c;};'use strict';var _=require(_0x7166('0x0'));var md5=require('md5');var util=require('util');var Redis=require(_0x7166('0x1'));var config=require(_0x7166('0x2'));config[_0x7166('0x3')]=_['defaults'](config[_0x7166('0x3')],{'host':_0x7166('0x4'),'port':0x18eb});var io=require(_0x7166('0x5'))(new Redis(config[_0x7166('0x3')]));function FaxQueue(_0x1d33fa){this['id']=_0x1d33fa['id']||0x0;this['name']=_0x1d33fa[_0x7166('0x6')]||'';this['timeout']=_0x1d33fa[_0x7166('0x7')]||0xa;this[_0x7166('0x8')]=_0x1d33fa['strategy']||_0x7166('0x9');this[_0x7166('0xa')]=_0x1d33fa[_0x7166('0xa')];this[_0x7166('0xb')]={};this[_0x7166('0xc')]=0x0;this[_0x7166('0xd')]='';this['updateRouting']();this[_0x7166('0xe')]();}FaxQueue[_0x7166('0xf')][_0x7166('0x10')]=function(){var _0xd62358=this['mapAgentsId'][_0x7166('0x11')];this['mapAgentsId']=_['map'](this[_0x7166('0xa')],'id');this[_0x7166('0xb')][_0x7166('0x11')]=_0xd62358;};FaxQueue[_0x7166('0xf')][_0x7166('0xe')]=function(){this[_0x7166('0x12')]=0x0;this[_0x7166('0x13')]=0x0;for(var _0x39852c=0x0;_0x39852c=0x0?this[_0x7166('0x15')]:0x0;var _0x76a6fc={'id':this['id'],'available':this[_0x7166('0x15')],'loggedIn':this['loggedIn'],'name':this['name'],'paused':this['paused'],'waiting':this[_0x7166('0xc')]};var _0x4da989=md5(JSON[_0x7166('0x16')](_0x76a6fc));if(this[_0x7166('0xd')]!==_0x4da989){this[_0x7166('0xd')]=_0x4da989;io['to'](util[_0x7166('0x17')](_0x7166('0x18'),_0x76a6fc[_0x7166('0x6')]))[_0x7166('0x19')](_0x7166('0x1a'),_0x76a6fc);}};module[_0x7166('0x1b')]=FaxQueue; \ No newline at end of file diff --git a/server/services/routing/model/interval.js b/server/services/routing/model/interval.js index 7d6f25f..d1fc555 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 _0x917e=['name','Intervals','exports'];(function(_0x278015,_0x33e825){var _0x41e7f7=function(_0x28be19){while(--_0x28be19){_0x278015['push'](_0x278015['shift']());}};_0x41e7f7(++_0x33e825);}(_0x917e,0xa5));var _0xe917=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x917e[_0x3dd15e];return _0x231fd0;};'use strict';function Interval(_0x1a9b8b){this['id']=_0x1a9b8b['id']||0x0;this['name']=_0x1a9b8b[_0xe917('0x0')]||'';this[_0xe917('0x1')]=_0x1a9b8b[_0xe917('0x1')]||{};}module[_0xe917('0x2')]=Interval; \ No newline at end of file +var _0x5276=['Intervals','exports','name'];(function(_0x2a7211,_0x1821be){var _0x6eda40=function(_0x4491d2){while(--_0x4491d2){_0x2a7211['push'](_0x2a7211['shift']());}};_0x6eda40(++_0x1821be);}(_0x5276,0xc8));var _0x6527=function(_0x74eb58,_0x58f2d4){_0x74eb58=_0x74eb58-0x0;var _0x28e469=_0x5276[_0x74eb58];return _0x28e469;};'use strict';function Interval(_0x232c0e){this['id']=_0x232c0e['id']||0x0;this[_0x6527('0x0')]=_0x232c0e[_0x6527('0x0')]||'';this[_0x6527('0x1')]=_0x232c0e[_0x6527('0x1')]||{};}module[_0x6527('0x2')]=Interval; \ No newline at end of file diff --git a/server/services/routing/model/mailQueue.js b/server/services/routing/model/mailQueue.js index 1406fcb..fbd6996 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 _0xf3d1=['mail:queue:%s','emit','mail_queue:save','exports','lodash','util','redis','defaults','localhost','name','timeout','strategy','Agents','mapAgentsId','waiting','md5','updateRouting','updateRealtime','prototype','map','_rr','loggedIn','length','online','mailPause','paused','available','stringify','format'];(function(_0xffe34d,_0x17d49b){var _0x360736=function(_0xca72b5){while(--_0xca72b5){_0xffe34d['push'](_0xffe34d['shift']());}};_0x360736(++_0x17d49b);}(_0xf3d1,0xec));var _0x1f3d=function(_0x286fcd,_0x46781e){_0x286fcd=_0x286fcd-0x0;var _0x2a8de8=_0xf3d1[_0x286fcd];return _0x2a8de8;};'use strict';var _=require(_0x1f3d('0x0'));var md5=require('md5');var util=require(_0x1f3d('0x1'));var Redis=require('ioredis');var config=require('../../../config/environment');config[_0x1f3d('0x2')]=_[_0x1f3d('0x3')](config['redis'],{'host':_0x1f3d('0x4'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x1f3d('0x2')]));function MailQueue(_0xa7d427){this['id']=_0xa7d427['id']||0x0;this['name']=_0xa7d427[_0x1f3d('0x5')]||'';this[_0x1f3d('0x6')]=_0xa7d427[_0x1f3d('0x6')]||0xa;this['strategy']=_0xa7d427[_0x1f3d('0x7')]||'beepall';this[_0x1f3d('0x8')]=_0xa7d427['Agents'];this[_0x1f3d('0x9')]={};this[_0x1f3d('0xa')]=0x0;this[_0x1f3d('0xb')]='';this[_0x1f3d('0xc')]();this[_0x1f3d('0xd')]();}MailQueue[_0x1f3d('0xe')]['updateRouting']=function(){var _0x3d1016=this[_0x1f3d('0x9')]['_rr'];this[_0x1f3d('0x9')]=_[_0x1f3d('0xf')](this[_0x1f3d('0x8')],'id');this['mapAgentsId'][_0x1f3d('0x10')]=_0x3d1016;};MailQueue[_0x1f3d('0xe')][_0x1f3d('0xd')]=function(){this[_0x1f3d('0x11')]=0x0;this['paused']=0x0;for(var _0x1b8761=0x0;_0x1b8761=0x0?this[_0x1f3d('0x16')]:0x0;var _0x3e3012={'id':this['id'],'available':this[_0x1f3d('0x16')],'loggedIn':this[_0x1f3d('0x11')],'name':this[_0x1f3d('0x5')],'paused':this[_0x1f3d('0x15')],'waiting':this[_0x1f3d('0xa')]};var _0x4ed86c=md5(JSON[_0x1f3d('0x17')](_0x3e3012));if(this[_0x1f3d('0xb')]!==_0x4ed86c){this[_0x1f3d('0xb')]=_0x4ed86c;io['to'](util[_0x1f3d('0x18')](_0x1f3d('0x19'),_0x3e3012[_0x1f3d('0x5')]))[_0x1f3d('0x1a')](_0x1f3d('0x1b'),_0x3e3012);}};module[_0x1f3d('0x1c')]=MailQueue; \ No newline at end of file +var _0x7d44=['timeout','strategy','beepall','Agents','mapAgentsId','waiting','md5','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','paused','online','mailPause','available','mail:queue:%s','emit','mail_queue:save','exports','../../../config/environment','defaults','redis','localhost','socket.io-emitter','name'];(function(_0x50ffd4,_0x49445a){var _0xec696e=function(_0x58d4eb){while(--_0x58d4eb){_0x50ffd4['push'](_0x50ffd4['shift']());}};_0xec696e(++_0x49445a);}(_0x7d44,0xed));var _0x47d4=function(_0x1ec744,_0x3444a4){_0x1ec744=_0x1ec744-0x0;var _0x370924=_0x7d44[_0x1ec744];return _0x370924;};'use strict';var _=require('lodash');var md5=require('md5');var util=require('util');var Redis=require('ioredis');var config=require(_0x47d4('0x0'));config['redis']=_[_0x47d4('0x1')](config[_0x47d4('0x2')],{'host':_0x47d4('0x3'),'port':0x18eb});var io=require(_0x47d4('0x4'))(new Redis(config[_0x47d4('0x2')]));function MailQueue(_0x301c2f){this['id']=_0x301c2f['id']||0x0;this['name']=_0x301c2f[_0x47d4('0x5')]||'';this[_0x47d4('0x6')]=_0x301c2f['timeout']||0xa;this[_0x47d4('0x7')]=_0x301c2f[_0x47d4('0x7')]||_0x47d4('0x8');this[_0x47d4('0x9')]=_0x301c2f['Agents'];this[_0x47d4('0xa')]={};this[_0x47d4('0xb')]=0x0;this[_0x47d4('0xc')]='';this[_0x47d4('0xd')]();this[_0x47d4('0xe')]();}MailQueue[_0x47d4('0xf')]['updateRouting']=function(){var _0x2fb056=this['mapAgentsId'][_0x47d4('0x10')];this[_0x47d4('0xa')]=_[_0x47d4('0x11')](this['Agents'],'id');this[_0x47d4('0xa')]['_rr']=_0x2fb056;};MailQueue[_0x47d4('0xf')][_0x47d4('0xe')]=function(){this[_0x47d4('0x12')]=0x0;this[_0x47d4('0x13')]=0x0;for(var _0x824f80=0x0;_0x824f80=0x0?this[_0x47d4('0x16')]:0x0;var _0x481344={'id':this['id'],'available':this[_0x47d4('0x16')],'loggedIn':this[_0x47d4('0x12')],'name':this[_0x47d4('0x5')],'paused':this[_0x47d4('0x13')],'waiting':this[_0x47d4('0xb')]};var _0xb5a0ba=md5(JSON['stringify'](_0x481344));if(this['md5']!==_0xb5a0ba){this[_0x47d4('0xc')]=_0xb5a0ba;io['to'](util['format'](_0x47d4('0x17'),_0x481344[_0x47d4('0x5')]))[_0x47d4('0x18')](_0x47d4('0x19'),_0x481344);}};module[_0x47d4('0x1a')]=MailQueue; \ No newline at end of file diff --git a/server/services/routing/model/openchannelQueue.js b/server/services/routing/model/openchannelQueue.js index 9b1a85b..1292beb 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 _0x7a54=['exports','lodash','md5','util','../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','waiting','updateRealtime','mapAgentsId','_rr','map','Agents','prototype','loggedIn','paused','length','openchannelPause','available','stringify','format','openchannel:queue:%s','emit','openchannel_queue:save'];(function(_0x710815,_0x520da8){var _0x5b3b89=function(_0x2e1a8e){while(--_0x2e1a8e){_0x710815['push'](_0x710815['shift']());}};_0x5b3b89(++_0x520da8);}(_0x7a54,0x106));var _0x47a5=function(_0x329ea3,_0x497f35){_0x329ea3=_0x329ea3-0x0;var _0x29478b=_0x7a54[_0x329ea3];return _0x29478b;};'use strict';var _=require(_0x47a5('0x0'));var md5=require(_0x47a5('0x1'));var util=require(_0x47a5('0x2'));var Redis=require('ioredis');var config=require(_0x47a5('0x3'));config[_0x47a5('0x4')]=_['defaults'](config[_0x47a5('0x4')],{'host':_0x47a5('0x5'),'port':0x18eb});var io=require(_0x47a5('0x6'))(new Redis(config[_0x47a5('0x4')]));function OpenchannelQueue(_0xfdf934){this['id']=_0xfdf934['id']||0x0;this['name']=_0xfdf934[_0x47a5('0x7')]||'';this['timeout']=_0xfdf934[_0x47a5('0x8')]||0xa;this[_0x47a5('0x9')]=_0xfdf934['strategy']||_0x47a5('0xa');this['Agents']=_0xfdf934['Agents'];this['mapAgentsId']={};this[_0x47a5('0xb')]=0x0;this[_0x47a5('0x1')]='';this['updateRouting']();this[_0x47a5('0xc')]();}OpenchannelQueue['prototype']['updateRouting']=function(){var _0x1f47f4=this[_0x47a5('0xd')][_0x47a5('0xe')];this[_0x47a5('0xd')]=_[_0x47a5('0xf')](this[_0x47a5('0x10')],'id');this[_0x47a5('0xd')]['_rr']=_0x1f47f4;};OpenchannelQueue[_0x47a5('0x11')][_0x47a5('0xc')]=function(){this[_0x47a5('0x12')]=0x0;this[_0x47a5('0x13')]=0x0;for(var _0x139f25=0x0;_0x139f25=0x0?this['available']:0x0;var _0x423a81={'id':this['id'],'available':this[_0x47a5('0x16')],'loggedIn':this[_0x47a5('0x12')],'name':this[_0x47a5('0x7')],'paused':this[_0x47a5('0x13')],'waiting':this[_0x47a5('0xb')]};var _0x2763d6=md5(JSON[_0x47a5('0x17')](_0x423a81));if(this[_0x47a5('0x1')]!==_0x2763d6){this['md5']=_0x2763d6;io['to'](util[_0x47a5('0x18')](_0x47a5('0x19'),_0x423a81['name']))[_0x47a5('0x1a')](_0x47a5('0x1b'),_0x423a81);}};module[_0x47a5('0x1c')]=OpenchannelQueue; \ No newline at end of file +var _0xc4aa=['strategy','Agents','mapAgentsId','updateRouting','updateRealtime','map','_rr','prototype','loggedIn','paused','length','online','available','waiting','stringify','format','openchannel:queue:%s','emit','openchannel_queue:save','lodash','md5','util','ioredis','../../../config/environment','redis','socket.io-emitter','name','timeout'];(function(_0x172747,_0x1732bd){var _0x509692=function(_0x448c56){while(--_0x448c56){_0x172747['push'](_0x172747['shift']());}};_0x509692(++_0x1732bd);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x5d2803,_0xf375bd){_0x5d2803=_0x5d2803-0x0;var _0xdcad2c=_0xc4aa[_0x5d2803];return _0xdcad2c;};'use strict';var _=require(_0xac4a('0x0'));var md5=require(_0xac4a('0x1'));var util=require(_0xac4a('0x2'));var Redis=require(_0xac4a('0x3'));var config=require(_0xac4a('0x4'));config[_0xac4a('0x5')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0xac4a('0x6'))(new Redis(config[_0xac4a('0x5')]));function OpenchannelQueue(_0x730a38){this['id']=_0x730a38['id']||0x0;this[_0xac4a('0x7')]=_0x730a38[_0xac4a('0x7')]||'';this[_0xac4a('0x8')]=_0x730a38[_0xac4a('0x8')]||0xa;this[_0xac4a('0x9')]=_0x730a38['strategy']||'beepall';this[_0xac4a('0xa')]=_0x730a38[_0xac4a('0xa')];this[_0xac4a('0xb')]={};this['waiting']=0x0;this[_0xac4a('0x1')]='';this[_0xac4a('0xc')]();this[_0xac4a('0xd')]();}OpenchannelQueue['prototype'][_0xac4a('0xc')]=function(){var _0x488e3c=this[_0xac4a('0xb')]['_rr'];this[_0xac4a('0xb')]=_[_0xac4a('0xe')](this[_0xac4a('0xa')],'id');this['mapAgentsId'][_0xac4a('0xf')]=_0x488e3c;};OpenchannelQueue[_0xac4a('0x10')][_0xac4a('0xd')]=function(){this[_0xac4a('0x11')]=0x0;this[_0xac4a('0x12')]=0x0;for(var _0x3b71c0=0x0;_0x3b71c0=0x0?this[_0xac4a('0x15')]:0x0;var _0x44ec59={'id':this['id'],'available':this['available'],'loggedIn':this['loggedIn'],'name':this[_0xac4a('0x7')],'paused':this[_0xac4a('0x12')],'waiting':this[_0xac4a('0x16')]};var _0x4d837c=md5(JSON[_0xac4a('0x17')](_0x44ec59));if(this[_0xac4a('0x1')]!==_0x4d837c){this[_0xac4a('0x1')]=_0x4d837c;io['to'](util[_0xac4a('0x18')](_0xac4a('0x19'),_0x44ec59[_0xac4a('0x7')]))[_0xac4a('0x1a')](_0xac4a('0x1b'),_0x44ec59);}};module['exports']=OpenchannelQueue; \ No newline at end of file diff --git a/server/services/routing/model/smsQueue.js b/server/services/routing/model/smsQueue.js index 052f431..43d1bf7 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 _0xc831=['ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRealtime','prototype','updateRouting','map','_rr','loggedIn','length','online','smsPause','paused','available','stringify','format','emit','md5','util'];(function(_0x5a187b,_0x1f64fe){var _0x14d601=function(_0x45fd29){while(--_0x45fd29){_0x5a187b['push'](_0x5a187b['shift']());}};_0x14d601(++_0x1f64fe);}(_0xc831,0x103));var _0x1c83=function(_0x11d11c,_0x505414){_0x11d11c=_0x11d11c-0x0;var _0x23f135=_0xc831[_0x11d11c];return _0x23f135;};'use strict';var _=require('lodash');var md5=require(_0x1c83('0x0'));var util=require(_0x1c83('0x1'));var Redis=require(_0x1c83('0x2'));var config=require(_0x1c83('0x3'));config[_0x1c83('0x4')]=_[_0x1c83('0x5')](config[_0x1c83('0x4')],{'host':_0x1c83('0x6'),'port':0x18eb});var io=require(_0x1c83('0x7'))(new Redis(config[_0x1c83('0x4')]));function SmsQueue(_0x4fb4c3){this['id']=_0x4fb4c3['id']||0x0;this['name']=_0x4fb4c3[_0x1c83('0x8')]||'';this['timeout']=_0x4fb4c3[_0x1c83('0x9')]||0xa;this[_0x1c83('0xa')]=_0x4fb4c3[_0x1c83('0xa')]||_0x1c83('0xb');this[_0x1c83('0xc')]=_0x4fb4c3['Agents'];this[_0x1c83('0xd')]={};this[_0x1c83('0xe')]=0x0;this['md5']='';this['updateRouting']();this[_0x1c83('0xf')]();}SmsQueue[_0x1c83('0x10')][_0x1c83('0x11')]=function(){var _0x5db682=this[_0x1c83('0xd')]['_rr'];this['mapAgentsId']=_[_0x1c83('0x12')](this[_0x1c83('0xc')],'id');this[_0x1c83('0xd')][_0x1c83('0x13')]=_0x5db682;};SmsQueue[_0x1c83('0x10')][_0x1c83('0xf')]=function(){this[_0x1c83('0x14')]=0x0;this['paused']=0x0;for(var _0x43f74e=0x0;_0x43f74e=0x0?this[_0x1c83('0x19')]:0x0;var _0x1d6027={'id':this['id'],'available':this[_0x1c83('0x19')],'loggedIn':this[_0x1c83('0x14')],'name':this['name'],'paused':this[_0x1c83('0x18')],'waiting':this['waiting']};var _0x2d387d=md5(JSON[_0x1c83('0x1a')](_0x1d6027));if(this['md5']!==_0x2d387d){this[_0x1c83('0x0')]=_0x2d387d;io['to'](util[_0x1c83('0x1b')]('sms:queue:%s',_0x1d6027['name']))[_0x1c83('0x1c')]('sms_queue:save',_0x1d6027);}};module['exports']=SmsQueue; \ No newline at end of file +var _0x44ae=['mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','loggedIn','paused','length','online','smsPause','available','format','sms:queue:%s','emit','sms_queue:save','exports','lodash','md5','util','ioredis','redis','localhost','socket.io-emitter','name','timeout','strategy','Agents'];(function(_0x2966da,_0x5c8c85){var _0x4d734b=function(_0x4e81f6){while(--_0x4e81f6){_0x2966da['push'](_0x2966da['shift']());}};_0x4d734b(++_0x5c8c85);}(_0x44ae,0x17d));var _0xe44a=function(_0x52c617,_0x285a92){_0x52c617=_0x52c617-0x0;var _0xc6e1f2=_0x44ae[_0x52c617];return _0xc6e1f2;};'use strict';var _=require(_0xe44a('0x0'));var md5=require(_0xe44a('0x1'));var util=require(_0xe44a('0x2'));var Redis=require(_0xe44a('0x3'));var config=require('../../../config/environment');config[_0xe44a('0x4')]=_['defaults'](config[_0xe44a('0x4')],{'host':_0xe44a('0x5'),'port':0x18eb});var io=require(_0xe44a('0x6'))(new Redis(config[_0xe44a('0x4')]));function SmsQueue(_0x1a8842){this['id']=_0x1a8842['id']||0x0;this[_0xe44a('0x7')]=_0x1a8842['name']||'';this[_0xe44a('0x8')]=_0x1a8842[_0xe44a('0x8')]||0xa;this[_0xe44a('0x9')]=_0x1a8842[_0xe44a('0x9')]||'beepall';this[_0xe44a('0xa')]=_0x1a8842[_0xe44a('0xa')];this[_0xe44a('0xb')]={};this[_0xe44a('0xc')]=0x0;this['md5']='';this[_0xe44a('0xd')]();this[_0xe44a('0xe')]();}SmsQueue[_0xe44a('0xf')][_0xe44a('0xd')]=function(){var _0xe19628=this[_0xe44a('0xb')][_0xe44a('0x10')];this['mapAgentsId']=_['map'](this['Agents'],'id');this[_0xe44a('0xb')][_0xe44a('0x10')]=_0xe19628;};SmsQueue[_0xe44a('0xf')]['updateRealtime']=function(){this[_0xe44a('0x11')]=0x0;this[_0xe44a('0x12')]=0x0;for(var _0x3656b2=0x0;_0x3656b2=0x0?this[_0xe44a('0x16')]:0x0;var _0x509f30={'id':this['id'],'available':this[_0xe44a('0x16')],'loggedIn':this[_0xe44a('0x11')],'name':this[_0xe44a('0x7')],'paused':this[_0xe44a('0x12')],'waiting':this[_0xe44a('0xc')]};var _0x33e9ac=md5(JSON['stringify'](_0x509f30));if(this[_0xe44a('0x1')]!==_0x33e9ac){this['md5']=_0x33e9ac;io['to'](util[_0xe44a('0x17')](_0xe44a('0x18'),_0x509f30[_0xe44a('0x7')]))[_0xe44a('0x19')](_0xe44a('0x1a'),_0x509f30);}};module[_0xe44a('0x1b')]=SmsQueue; \ No newline at end of file diff --git a/server/services/routing/model/whatsappQueue.js b/server/services/routing/model/whatsappQueue.js index 59a77f4..80cb437 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 _0x5040=['redis','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','prototype','_rr','updateRealtime','paused','length','loggedIn','whatsappPause','available','format','whatsapp_queue:save','lodash','md5','ioredis','../../../config/environment','defaults'];(function(_0x49b6fa,_0x1213b8){var _0x134f4b=function(_0x288eae){while(--_0x288eae){_0x49b6fa['push'](_0x49b6fa['shift']());}};_0x134f4b(++_0x1213b8);}(_0x5040,0xc3));var _0x0504=function(_0x5f5c45,_0x1371d9){_0x5f5c45=_0x5f5c45-0x0;var _0x365424=_0x5040[_0x5f5c45];return _0x365424;};'use strict';var _=require(_0x0504('0x0'));var md5=require(_0x0504('0x1'));var util=require('util');var Redis=require(_0x0504('0x2'));var config=require(_0x0504('0x3'));config['redis']=_[_0x0504('0x4')](config[_0x0504('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0x0504('0x6'))(new Redis(config[_0x0504('0x5')]));function WhatsappQueue(_0x26167c){this['id']=_0x26167c['id']||0x0;this['name']=_0x26167c[_0x0504('0x7')]||'';this[_0x0504('0x8')]=_0x26167c['timeout']||0xa;this[_0x0504('0x9')]=_0x26167c['strategy']||_0x0504('0xa');this['Agents']=_0x26167c[_0x0504('0xb')];this[_0x0504('0xc')]={};this[_0x0504('0xd')]=0x0;this[_0x0504('0x1')]='';this[_0x0504('0xe')]();this['updateRealtime']();}WhatsappQueue[_0x0504('0xf')][_0x0504('0xe')]=function(){var _0x1e8cfd=this[_0x0504('0xc')][_0x0504('0x10')];this[_0x0504('0xc')]=_['map'](this[_0x0504('0xb')],'id');this['mapAgentsId'][_0x0504('0x10')]=_0x1e8cfd;};WhatsappQueue['prototype'][_0x0504('0x11')]=function(){this['loggedIn']=0x0;this[_0x0504('0x12')]=0x0;for(var _0x2f19a3=0x0;_0x2f19a3=0x0?this[_0x0504('0x16')]:0x0;var _0x5791ac={'id':this['id'],'available':this[_0x0504('0x16')],'loggedIn':this[_0x0504('0x14')],'name':this[_0x0504('0x7')],'paused':this[_0x0504('0x12')],'waiting':this['waiting']};var _0x48453c=md5(JSON['stringify'](_0x5791ac));if(this[_0x0504('0x1')]!==_0x48453c){this[_0x0504('0x1')]=_0x48453c;io['to'](util[_0x0504('0x17')]('whatsapp:queue:%s',_0x5791ac['name']))['emit'](_0x0504('0x18'),_0x5791ac);}};module['exports']=WhatsappQueue; \ No newline at end of file +var _0xf140=['redis','defaults','localhost','name','timeout','strategy','Agents','mapAgentsId','waiting','updateRealtime','prototype','_rr','map','paused','length','online','loggedIn','available','stringify','format','whatsapp:queue:%s','emit','whatsapp_queue:save','exports','md5','util','ioredis','../../../config/environment'];(function(_0xaed4a7,_0x1000bf){var _0x3abf09=function(_0x424b8b){while(--_0x424b8b){_0xaed4a7['push'](_0xaed4a7['shift']());}};_0x3abf09(++_0x1000bf);}(_0xf140,0x1a0));var _0x0f14=function(_0x16e3dc,_0x35770a){_0x16e3dc=_0x16e3dc-0x0;var _0x2f1001=_0xf140[_0x16e3dc];return _0x2f1001;};'use strict';var _=require('lodash');var md5=require(_0x0f14('0x0'));var util=require(_0x0f14('0x1'));var Redis=require(_0x0f14('0x2'));var config=require(_0x0f14('0x3'));config[_0x0f14('0x4')]=_[_0x0f14('0x5')](config[_0x0f14('0x4')],{'host':_0x0f14('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x0f14('0x4')]));function WhatsappQueue(_0x575f64){this['id']=_0x575f64['id']||0x0;this[_0x0f14('0x7')]=_0x575f64[_0x0f14('0x7')]||'';this['timeout']=_0x575f64[_0x0f14('0x8')]||0xa;this[_0x0f14('0x9')]=_0x575f64[_0x0f14('0x9')]||'beepall';this['Agents']=_0x575f64[_0x0f14('0xa')];this[_0x0f14('0xb')]={};this[_0x0f14('0xc')]=0x0;this['md5']='';this['updateRouting']();this[_0x0f14('0xd')]();}WhatsappQueue[_0x0f14('0xe')]['updateRouting']=function(){var _0x48a5df=this['mapAgentsId'][_0x0f14('0xf')];this[_0x0f14('0xb')]=_[_0x0f14('0x10')](this['Agents'],'id');this[_0x0f14('0xb')][_0x0f14('0xf')]=_0x48a5df;};WhatsappQueue[_0x0f14('0xe')][_0x0f14('0xd')]=function(){this['loggedIn']=0x0;this[_0x0f14('0x11')]=0x0;for(var _0x5d4ab3=0x0;_0x5d4ab3=0x0?this[_0x0f14('0x15')]:0x0;var _0x740817={'id':this['id'],'available':this[_0x0f14('0x15')],'loggedIn':this[_0x0f14('0x14')],'name':this[_0x0f14('0x7')],'paused':this[_0x0f14('0x11')],'waiting':this[_0x0f14('0xc')]};var _0x44fc1d=md5(JSON[_0x0f14('0x16')](_0x740817));if(this[_0x0f14('0x0')]!==_0x44fc1d){this[_0x0f14('0x0')]=_0x44fc1d;io['to'](util[_0x0f14('0x17')](_0x0f14('0x18'),_0x740817[_0x0f14('0x7')]))[_0x0f14('0x19')](_0x0f14('0x1a'),_0x740817);}};module[_0x0f14('0x1b')]=WhatsappQueue; \ No newline at end of file diff --git a/server/services/routing/realtime/index.js b/server/services/routing/realtime/index.js index cc4538f..1caf400 100644 --- a/server/services/routing/realtime/index.js +++ b/server/services/routing/realtime/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['isUndefined','initIntervals','updateRealtime','updateRouting','initSmsQueues','smsQueues','initMailQueues','mailQueues','initWhatsappQueues','whatsappQueues','exports','bluebird','util','lodash','../model/interval','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','intervals','openchannelQueues','chatQueues','faxQueues','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','hasOwnProperty','prototype','mergeFromDatabase','initAgents','agents','length'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xa9e0[_0x4cf98e];return _0x1623ac;};'use strict';var BPromise=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var moment=require('moment');var Agent=require('../model/agent');var Interval=require(_0x0a9e('0x3'));var OpenchannelQueue=require('../model/openchannelQueue');var ChatQueue=require(_0x0a9e('0x4'));var SmsQueue=require(_0x0a9e('0x5'));var MailQueue=require(_0x0a9e('0x6'));var FaxQueue=require(_0x0a9e('0x7'));var WhatsappQueue=require(_0x0a9e('0x8'));var Realtime=function(){this['agents']={};this[_0x0a9e('0x9')]={};this[_0x0a9e('0xa')]={};this[_0x0a9e('0xb')]={};this['smsQueues']={};this['mailQueues']={};this[_0x0a9e('0xc')]={};this['whatsappQueues']={};this['chatQueuesWaitingInteractions']={};this[_0x0a9e('0xd')]={};this[_0x0a9e('0xe')]={};this[_0x0a9e('0xf')]={};this[_0x0a9e('0x10')]={};this[_0x0a9e('0x11')]={};};function freeIsNotKey(_0xbd1168,_0x4a4c56,_0x50dfb2){var _0x527cdd=_['mapKeys'](_0xbd1168,function(_0x273d4d,_0x36471c){return _0x273d4d[_0x50dfb2];});for(var _0xd5b662 in _0x4a4c56){if(_0x4a4c56[_0x0a9e('0x12')](_0xd5b662)){if(!_0x527cdd[_0xd5b662]){delete _0x4a4c56[_0xd5b662];}}}}Realtime[_0x0a9e('0x13')][_0x0a9e('0x14')]=function(_0x5db4b0,_0x4283ce){for(var _0x239b12 in _0x4283ce){if(_0x5db4b0[_0x0a9e('0x12')](_0x239b12)){_0x5db4b0[_0x239b12]=_0x4283ce[_0x239b12];}}};Realtime[_0x0a9e('0x13')][_0x0a9e('0x15')]=function(){var _0x4d5611=this;return function(_0x52a03d){if(_0x52a03d){freeIsNotKey(_0x52a03d,_0x4d5611[_0x0a9e('0x16')],'id');for(var _0x5d0880=0x0,_0x1985b6={},_0x519dfd={};_0x5d0880<_0x52a03d[_0x0a9e('0x17')];_0x5d0880+=0x1){_0x1985b6=_0x52a03d[_0x5d0880];if(_[_0x0a9e('0x18')](_0x4d5611['agents'][_0x1985b6['id']])){_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']]=new Agent(_0x1985b6);}else{_0x4d5611['mergeFromDatabase'](_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']],_0x1985b6);}}}return _0x4d5611[_0x0a9e('0x16')];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x19')]=function(){var _0x31b1ca=this;return function(_0x2eb11f){if(_0x2eb11f){freeIsNotKey(_0x2eb11f,_0x31b1ca[_0x0a9e('0x9')],'id');for(var _0x20559e=0x0,_0x1314ae={},_0x112016={};_0x20559e<_0x2eb11f[_0x0a9e('0x17')];_0x20559e+=0x1){_0x1314ae=_0x2eb11f[_0x20559e];if(_[_0x0a9e('0x18')](_0x31b1ca['intervals'][_0x1314ae['id']])){_0x31b1ca[_0x0a9e('0x9')][_0x1314ae['id']]=new Interval(_0x1314ae);}else{_0x31b1ca[_0x0a9e('0x14')](_0x31b1ca['intervals'][_0x1314ae['id']],_0x1314ae);}}}return _0x31b1ca[_0x0a9e('0x9')];};};Realtime['prototype']['initOpenchannelQueues']=function(){var _0x3a02e1=this;return function(_0x432e56){if(_0x432e56){freeIsNotKey(_0x432e56,_0x3a02e1[_0x0a9e('0xa')],'id');for(var _0x30bae6=0x0,_0x4abc77={},_0xfb6e48={};_0x30bae6<_0x432e56[_0x0a9e('0x17')];_0x30bae6+=0x1){_0x4abc77=_0x432e56[_0x30bae6];if(_[_0x0a9e('0x18')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']])){_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']]=new OpenchannelQueue(_0x4abc77);}else{_0x3a02e1[_0x0a9e('0x14')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']],_0x4abc77);}_0x3a02e1['openchannelQueues'][_0x4abc77['id']]['updateRouting']();_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']][_0x0a9e('0x1a')]();}}return _0x3a02e1[_0x0a9e('0xa')];};};Realtime[_0x0a9e('0x13')]['initChatQueues']=function(){var _0x384319=this;return function(_0x479bc4){if(_0x479bc4){freeIsNotKey(_0x479bc4,_0x384319[_0x0a9e('0xb')],'id');for(var _0x5bfb33=0x0,_0x1dc186={},_0x34dc65={};_0x5bfb33<_0x479bc4[_0x0a9e('0x17')];_0x5bfb33+=0x1){_0x1dc186=_0x479bc4[_0x5bfb33];if(_[_0x0a9e('0x18')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']])){_0x384319[_0x0a9e('0xb')][_0x1dc186['id']]=new ChatQueue(_0x1dc186);}else{_0x384319[_0x0a9e('0x14')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']],_0x1dc186);}_0x384319['chatQueues'][_0x1dc186['id']][_0x0a9e('0x1b')]();_0x384319[_0x0a9e('0xb')][_0x1dc186['id']][_0x0a9e('0x1a')]();}}return _0x384319[_0x0a9e('0xb')];};};Realtime['prototype'][_0x0a9e('0x1c')]=function(){var _0x40e7a3=this;return function(_0x1843b2){if(_0x1843b2){freeIsNotKey(_0x1843b2,_0x40e7a3[_0x0a9e('0x1d')],'id');for(var _0x58b06f=0x0,_0x563b45={},_0x296f41={};_0x58b06f<_0x1843b2[_0x0a9e('0x17')];_0x58b06f+=0x1){_0x563b45=_0x1843b2[_0x58b06f];if(_[_0x0a9e('0x18')](_0x40e7a3['smsQueues'][_0x563b45['id']])){_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']]=new SmsQueue(_0x563b45);}else{_0x40e7a3['mergeFromDatabase'](_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']],_0x563b45);}_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1b')]();_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1a')]();}}return _0x40e7a3['smsQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x1e')]=function(){var _0x40cb85=this;return function(_0x2da5c0){if(_0x2da5c0){freeIsNotKey(_0x2da5c0,_0x40cb85[_0x0a9e('0x1f')],'id');for(var _0x409319=0x0,_0x332d35={},_0x39e565={};_0x409319<_0x2da5c0['length'];_0x409319+=0x1){_0x332d35=_0x2da5c0[_0x409319];if(_[_0x0a9e('0x18')](_0x40cb85['mailQueues'][_0x332d35['id']])){_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]=new MailQueue(_0x332d35);}else{_0x40cb85[_0x0a9e('0x14')](_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']],_0x332d35);}_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]['updateRouting']();_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']][_0x0a9e('0x1a')]();}}return _0x40cb85[_0x0a9e('0x1f')];};};Realtime[_0x0a9e('0x13')]['initFaxQueues']=function(){var _0x54135e=this;return function(_0x1e8694){if(_0x1e8694){freeIsNotKey(_0x1e8694,_0x54135e['faxQueues'],'id');for(var _0x24936a=0x0,_0x3d9717={},_0x381c37={};_0x24936a<_0x1e8694[_0x0a9e('0x17')];_0x24936a+=0x1){_0x3d9717=_0x1e8694[_0x24936a];if(_['isUndefined'](_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']])){_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]=new FaxQueue(_0x3d9717);}else{_0x54135e[_0x0a9e('0x14')](_0x54135e['faxQueues'][_0x3d9717['id']],_0x3d9717);}_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']][_0x0a9e('0x1b')]();_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]['updateRealtime']();}}return _0x54135e['faxQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x20')]=function(){var _0x5adda1=this;return function(_0x2b814e){if(_0x2b814e){freeIsNotKey(_0x2b814e,_0x5adda1[_0x0a9e('0x21')],'id');for(var _0x2e1b3a=0x0,_0x148f55={},_0x4b38d9={};_0x2e1b3a<_0x2b814e['length'];_0x2e1b3a+=0x1){_0x148f55=_0x2b814e[_0x2e1b3a];if(_[_0x0a9e('0x18')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']])){_0x5adda1['whatsappQueues'][_0x148f55['id']]=new WhatsappQueue(_0x148f55);}else{_0x5adda1[_0x0a9e('0x14')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']],_0x148f55);}_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']]['updateRouting']();_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']][_0x0a9e('0x1a')]();}}return _0x5adda1[_0x0a9e('0x21')];};};module[_0x0a9e('0x22')]=Realtime; \ No newline at end of file +var _0xb10b=['faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','mapKeys','hasOwnProperty','prototype','mergeFromDatabase','initAgents','agents','isUndefined','initIntervals','length','initOpenchannelQueues','updateRealtime','initChatQueues','chatQueues','initSmsQueues','updateRouting','initMailQueues','initFaxQueues','initWhatsappQueues','exports','bluebird','lodash','moment','../model/agent','../model/openchannelQueue','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','intervals','openchannelQueues','smsQueues','mailQueues'];(function(_0x4d7fb1,_0x4e8c97){var _0x83c7b7=function(_0x49e397){while(--_0x49e397){_0x4d7fb1['push'](_0x4d7fb1['shift']());}};_0x83c7b7(++_0x4e8c97);}(_0xb10b,0x12a));var _0xbb10=function(_0x5b47d9,_0x1327ce){_0x5b47d9=_0x5b47d9-0x0;var _0x4151f0=_0xb10b[_0x5b47d9];return _0x4151f0;};'use strict';var BPromise=require(_0xbb10('0x0'));var util=require('util');var _=require(_0xbb10('0x1'));var moment=require(_0xbb10('0x2'));var Agent=require(_0xbb10('0x3'));var Interval=require('../model/interval');var OpenchannelQueue=require(_0xbb10('0x4'));var ChatQueue=require(_0xbb10('0x5'));var SmsQueue=require(_0xbb10('0x6'));var MailQueue=require(_0xbb10('0x7'));var FaxQueue=require(_0xbb10('0x8'));var WhatsappQueue=require(_0xbb10('0x9'));var Realtime=function(){this['agents']={};this[_0xbb10('0xa')]={};this[_0xbb10('0xb')]={};this['chatQueues']={};this[_0xbb10('0xc')]={};this[_0xbb10('0xd')]={};this[_0xbb10('0xe')]={};this[_0xbb10('0xf')]={};this[_0xbb10('0x10')]={};this[_0xbb10('0x11')]={};this[_0xbb10('0x12')]={};this[_0xbb10('0x13')]={};this['faxQueuesWaitingInteractions']={};this['whatsappQueuesWaitingInteractions']={};};function freeIsNotKey(_0x20bd61,_0x118a74,_0xce64f3){var _0x5e136d=_[_0xbb10('0x14')](_0x20bd61,function(_0x5be7e0,_0x44fb19){return _0x5be7e0[_0xce64f3];});for(var _0x916a32 in _0x118a74){if(_0x118a74[_0xbb10('0x15')](_0x916a32)){if(!_0x5e136d[_0x916a32]){delete _0x118a74[_0x916a32];}}}}Realtime[_0xbb10('0x16')][_0xbb10('0x17')]=function(_0x147230,_0x58a612){for(var _0x26e021 in _0x58a612){if(_0x147230[_0xbb10('0x15')](_0x26e021)){_0x147230[_0x26e021]=_0x58a612[_0x26e021];}}};Realtime[_0xbb10('0x16')][_0xbb10('0x18')]=function(){var _0x3df17b=this;return function(_0x2f2ebf){if(_0x2f2ebf){freeIsNotKey(_0x2f2ebf,_0x3df17b[_0xbb10('0x19')],'id');for(var _0x36b5e8=0x0,_0x3e26f4={},_0x2b184e={};_0x36b5e8<_0x2f2ebf['length'];_0x36b5e8+=0x1){_0x3e26f4=_0x2f2ebf[_0x36b5e8];if(_[_0xbb10('0x1a')](_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']])){_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']]=new Agent(_0x3e26f4);}else{_0x3df17b[_0xbb10('0x17')](_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']],_0x3e26f4);}}}return _0x3df17b[_0xbb10('0x19')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x1b')]=function(){var _0xbf2906=this;return function(_0xe1c665){if(_0xe1c665){freeIsNotKey(_0xe1c665,_0xbf2906['intervals'],'id');for(var _0x5ff0cf=0x0,_0x19f48d={},_0x388fab={};_0x5ff0cf<_0xe1c665[_0xbb10('0x1c')];_0x5ff0cf+=0x1){_0x19f48d=_0xe1c665[_0x5ff0cf];if(_[_0xbb10('0x1a')](_0xbf2906[_0xbb10('0xa')][_0x19f48d['id']])){_0xbf2906['intervals'][_0x19f48d['id']]=new Interval(_0x19f48d);}else{_0xbf2906[_0xbb10('0x17')](_0xbf2906[_0xbb10('0xa')][_0x19f48d['id']],_0x19f48d);}}}return _0xbf2906['intervals'];};};Realtime['prototype'][_0xbb10('0x1d')]=function(){var _0x311abe=this;return function(_0x2e911d){if(_0x2e911d){freeIsNotKey(_0x2e911d,_0x311abe[_0xbb10('0xb')],'id');for(var _0x445761=0x0,_0x1824b7={},_0x407cb4={};_0x445761<_0x2e911d[_0xbb10('0x1c')];_0x445761+=0x1){_0x1824b7=_0x2e911d[_0x445761];if(_[_0xbb10('0x1a')](_0x311abe[_0xbb10('0xb')][_0x1824b7['id']])){_0x311abe[_0xbb10('0xb')][_0x1824b7['id']]=new OpenchannelQueue(_0x1824b7);}else{_0x311abe[_0xbb10('0x17')](_0x311abe['openchannelQueues'][_0x1824b7['id']],_0x1824b7);}_0x311abe['openchannelQueues'][_0x1824b7['id']]['updateRouting']();_0x311abe[_0xbb10('0xb')][_0x1824b7['id']][_0xbb10('0x1e')]();}}return _0x311abe[_0xbb10('0xb')];};};Realtime['prototype'][_0xbb10('0x1f')]=function(){var _0x24d586=this;return function(_0x6ed43b){if(_0x6ed43b){freeIsNotKey(_0x6ed43b,_0x24d586[_0xbb10('0x20')],'id');for(var _0x1acce9=0x0,_0x20d946={},_0x2a0e8b={};_0x1acce9<_0x6ed43b['length'];_0x1acce9+=0x1){_0x20d946=_0x6ed43b[_0x1acce9];if(_[_0xbb10('0x1a')](_0x24d586[_0xbb10('0x20')][_0x20d946['id']])){_0x24d586[_0xbb10('0x20')][_0x20d946['id']]=new ChatQueue(_0x20d946);}else{_0x24d586[_0xbb10('0x17')](_0x24d586[_0xbb10('0x20')][_0x20d946['id']],_0x20d946);}_0x24d586[_0xbb10('0x20')][_0x20d946['id']]['updateRouting']();_0x24d586[_0xbb10('0x20')][_0x20d946['id']]['updateRealtime']();}}return _0x24d586[_0xbb10('0x20')];};};Realtime['prototype'][_0xbb10('0x21')]=function(){var _0x1dcc9c=this;return function(_0x1b59f9){if(_0x1b59f9){freeIsNotKey(_0x1b59f9,_0x1dcc9c['smsQueues'],'id');for(var _0x518d47=0x0,_0x4c3744={},_0x34f65e={};_0x518d47<_0x1b59f9['length'];_0x518d47+=0x1){_0x4c3744=_0x1b59f9[_0x518d47];if(_[_0xbb10('0x1a')](_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']])){_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']]=new SmsQueue(_0x4c3744);}else{_0x1dcc9c[_0xbb10('0x17')](_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']],_0x4c3744);}_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']][_0xbb10('0x22')]();_0x1dcc9c['smsQueues'][_0x4c3744['id']][_0xbb10('0x1e')]();}}return _0x1dcc9c[_0xbb10('0xc')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x23')]=function(){var _0xfb2c5e=this;return function(_0x9de708){if(_0x9de708){freeIsNotKey(_0x9de708,_0xfb2c5e[_0xbb10('0xd')],'id');for(var _0x10202c=0x0,_0x3c8d7d={},_0x56943c={};_0x10202c<_0x9de708[_0xbb10('0x1c')];_0x10202c+=0x1){_0x3c8d7d=_0x9de708[_0x10202c];if(_[_0xbb10('0x1a')](_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']])){_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']]=new MailQueue(_0x3c8d7d);}else{_0xfb2c5e['mergeFromDatabase'](_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']],_0x3c8d7d);}_0xfb2c5e['mailQueues'][_0x3c8d7d['id']]['updateRouting']();_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']][_0xbb10('0x1e')]();}}return _0xfb2c5e[_0xbb10('0xd')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x24')]=function(){var _0x29d11a=this;return function(_0x547062){if(_0x547062){freeIsNotKey(_0x547062,_0x29d11a[_0xbb10('0xe')],'id');for(var _0x25d72f=0x0,_0x52de31={},_0x5e3fbd={};_0x25d72f<_0x547062['length'];_0x25d72f+=0x1){_0x52de31=_0x547062[_0x25d72f];if(_[_0xbb10('0x1a')](_0x29d11a[_0xbb10('0xe')][_0x52de31['id']])){_0x29d11a[_0xbb10('0xe')][_0x52de31['id']]=new FaxQueue(_0x52de31);}else{_0x29d11a['mergeFromDatabase'](_0x29d11a[_0xbb10('0xe')][_0x52de31['id']],_0x52de31);}_0x29d11a[_0xbb10('0xe')][_0x52de31['id']][_0xbb10('0x22')]();_0x29d11a['faxQueues'][_0x52de31['id']][_0xbb10('0x1e')]();}}return _0x29d11a[_0xbb10('0xe')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x25')]=function(){var _0x4f1cdd=this;return function(_0xd238e9){if(_0xd238e9){freeIsNotKey(_0xd238e9,_0x4f1cdd[_0xbb10('0xf')],'id');for(var _0x5835fd=0x0,_0xe2040f={},_0x2e3214={};_0x5835fd<_0xd238e9[_0xbb10('0x1c')];_0x5835fd+=0x1){_0xe2040f=_0xd238e9[_0x5835fd];if(_[_0xbb10('0x1a')](_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']])){_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']]=new WhatsappQueue(_0xe2040f);}else{_0x4f1cdd['mergeFromDatabase'](_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']],_0xe2040f);}_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']][_0xbb10('0x22')]();_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']]['updateRealtime']();}}return _0x4f1cdd[_0xbb10('0xf')];};};module[_0xbb10('0x26')]=Realtime; \ No newline at end of file diff --git a/server/services/routing/rpc/chatInteraction.js b/server/services/routing/rpc/chatInteraction.js index 409862e..4506f06 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 _0xf69e=['update','UpdateChatInteraction','updateChatInteraction','addTags','Request','AddTagsToChatInteraction','addTagsToChatInteraction','../client'];(function(_0x1d69ba,_0x4090c9){var _0x8bab8c=function(_0x33ce38){while(--_0x33ce38){_0x1d69ba['push'](_0x1d69ba['shift']());}};_0x8bab8c(++_0x4090c9);}(_0xf69e,0x1c7));var _0xef69=function(_0x48dc64,_0x5198cf){_0x48dc64=_0x48dc64-0x0;var _0x1a7194=_0xf69e[_0x48dc64];return _0x1a7194;};'use strict';var client=require(_0xef69('0x0'));exports[_0xef69('0x1')]=function(_0x27449a,_0xc12176){return client['Request'](_0xef69('0x2'),{'body':_0xc12176,'options':{'where':{'id':_0x27449a}},'log':_0xef69('0x3')});};exports[_0xef69('0x4')]=function(_0x1d1a93,_0x49133f){return client[_0xef69('0x5')](_0xef69('0x6'),{'body':_0x49133f,'options':{'where':{'id':_0x1d1a93}},'log':_0xef69('0x7')});}; \ No newline at end of file +var _0xe760=['Request','UpdateChatInteraction','addTags','addTagsToChatInteraction','update'];(function(_0x182140,_0x4d3397){var _0x1a6415=function(_0xcbc8eb){while(--_0xcbc8eb){_0x182140['push'](_0x182140['shift']());}};_0x1a6415(++_0x4d3397);}(_0xe760,0x9a));var _0x0e76=function(_0x2c87fd,_0x3fddbd){_0x2c87fd=_0x2c87fd-0x0;var _0x1f5bfe=_0xe760[_0x2c87fd];return _0x1f5bfe;};'use strict';var client=require('../client');exports[_0x0e76('0x0')]=function(_0x1f08f3,_0x2b151e){return client[_0x0e76('0x1')](_0x0e76('0x2'),{'body':_0x2b151e,'options':{'where':{'id':_0x1f08f3}},'log':'updateChatInteraction'});};exports[_0x0e76('0x3')]=function(_0x5a2215,_0x1ea0a0){return client[_0x0e76('0x1')]('AddTagsToChatInteraction',{'body':_0x1ea0a0,'options':{'where':{'id':_0x5a2215}},'log':_0x0e76('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatMessage.js b/server/services/routing/rpc/chatMessage.js index 698b60d..9eca427 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 _0xd29e=['CreateChatMessage','createChatMessage','../client','create'];(function(_0xe6b045,_0xdc398){var _0x274563=function(_0x46715a){while(--_0x46715a){_0xe6b045['push'](_0xe6b045['shift']());}};_0x274563(++_0xdc398);}(_0xd29e,0x8e));var _0xed29=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd29e[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0xed29('0x0'));exports[_0xed29('0x1')]=function(_0x203e0f){return client['Request'](_0xed29('0x2'),{'body':_0x203e0f,'log':_0xed29('0x3')});}; \ No newline at end of file +var _0x823a=['CreateChatMessage','createChatMessage','../client','create'];(function(_0x17edb4,_0x23fcdd){var _0x123c9d=function(_0x1abf3b){while(--_0x1abf3b){_0x17edb4['push'](_0x17edb4['shift']());}};_0x123c9d(++_0x23fcdd);}(_0x823a,0xfa));var _0xa823=function(_0x2cf437,_0x5b0508){_0x2cf437=_0x2cf437-0x0;var _0x2f1fd2=_0x823a[_0x2cf437];return _0x2f1fd2;};'use strict';var client=require(_0xa823('0x0'));exports[_0xa823('0x1')]=function(_0x3a97c0){return client['Request'](_0xa823('0x2'),{'body':_0x3a97c0,'log':_0xa823('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueue.js b/server/services/routing/rpc/chatQueue.js index 8c1d544..de5ee05 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 _0xbd3c=['Request','name','timeout','strategy','chatPause','../client','getChatQueues'];(function(_0x1bf080,_0x42b9e9){var _0x536f8c=function(_0x2b495a){while(--_0x2b495a){_0x1bf080['push'](_0x1bf080['shift']());}};_0x536f8c(++_0x42b9e9);}(_0xbd3c,0xc2));var _0xcbd3=function(_0x2d436d,_0x3586a6){_0x2d436d=_0x2d436d-0x0;var _0x19e2b6=_0xbd3c[_0x2d436d];return _0x19e2b6;};'use strict';var client=require(_0xcbd3('0x0'));exports[_0xcbd3('0x1')]=function(){return function(){return client[_0xcbd3('0x2')]('GetChatQueue',{'options':{'raw':![],'attributes':['id',_0xcbd3('0x3'),_0xcbd3('0x4'),_0xcbd3('0x5')],'include':[{'model':'User','as':'Agents','attributes':['id',_0xcbd3('0x3'),'online',_0xcbd3('0x6')]}]},'log':_0xcbd3('0x1')});};}; \ No newline at end of file +var _0x1ef3=['name','timeout','User','Agents','online','chatPause','../client','getChatQueues','GetChatQueue'];(function(_0x102881,_0x58d723){var _0x5c63d0=function(_0x955c59){while(--_0x955c59){_0x102881['push'](_0x102881['shift']());}};_0x5c63d0(++_0x58d723);}(_0x1ef3,0x69));var _0x31ef=function(_0x768bbb,_0x5592c4){_0x768bbb=_0x768bbb-0x0;var _0x5d05c6=_0x1ef3[_0x768bbb];return _0x5d05c6;};'use strict';var client=require(_0x31ef('0x0'));exports[_0x31ef('0x1')]=function(){return function(){return client['Request'](_0x31ef('0x2'),{'options':{'raw':![],'attributes':['id',_0x31ef('0x3'),_0x31ef('0x4'),'strategy'],'include':[{'model':_0x31ef('0x5'),'as':_0x31ef('0x6'),'attributes':['id','name',_0x31ef('0x7'),_0x31ef('0x8')]}]},'log':_0x31ef('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueueReport.js b/server/services/routing/rpc/chatQueueReport.js index 9d43c0c..115714e 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 _0xc2cc=['create','Request','CreateChatQueueReport','DESC'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xc2cc,0x70));var _0xcc2c=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0xc2cc[_0x59ee6f];return _0x4c0979;};'use strict';var client=require('../client');exports[_0xcc2c('0x0')]=function(_0x1a1db8){return client[_0xcc2c('0x1')]('CreateChatQueueReport',{'body':_0x1a1db8,'log':_0xcc2c('0x2')});};exports['update']=function(_0x23bd62,_0x47c883){return client[_0xcc2c('0x1')]('UpdateChatQueueReport',{'body':_0x47c883,'options':{'where':{'uniqueid':_0x23bd62},'order':[['id',_0xcc2c('0x3')]],'limit':0x1},'log':'UpdateChatQueueReport'});}; \ No newline at end of file +var _0x35aa=['CreateChatQueueReport','update','UpdateChatQueueReport','DESC','create','Request'];(function(_0x40473c,_0x43635d){var _0x424acc=function(_0x3c4633){while(--_0x3c4633){_0x40473c['push'](_0x40473c['shift']());}};_0x424acc(++_0x43635d);}(_0x35aa,0xbe));var _0xa35a=function(_0x157624,_0x3ee799){_0x157624=_0x157624-0x0;var _0x517e0c=_0x35aa[_0x157624];return _0x517e0c;};'use strict';var client=require('../client');exports[_0xa35a('0x0')]=function(_0x2d2970){return client[_0xa35a('0x1')](_0xa35a('0x2'),{'body':_0x2d2970,'log':'CreateChatQueueReport'});};exports[_0xa35a('0x3')]=function(_0x4303b4,_0x24cc2){return client[_0xa35a('0x1')](_0xa35a('0x4'),{'body':_0x24cc2,'options':{'where':{'uniqueid':_0x4303b4},'order':[['id',_0xa35a('0x5')]],'limit':0x1},'log':_0xa35a('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxInteraction.js b/server/services/routing/rpc/faxInteraction.js index a006530..3064104 100644 --- a/server/services/routing/rpc/faxInteraction.js +++ b/server/services/routing/rpc/faxInteraction.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['Request','AddTagsToFaxInteraction','addTagsToFaxInteraction','../client','update','UpdateFaxInteraction','updateFaxInteraction','addTags'];(function(_0x28e4ea,_0x4856fd){var _0x545c63=function(_0x1a6471){while(--_0x1a6471){_0x28e4ea['push'](_0x28e4ea['shift']());}};_0x545c63(++_0x4856fd);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'use strict';var client=require(_0x7995('0x0'));exports[_0x7995('0x1')]=function(_0x2722a3,_0x10a05d){return client['Request'](_0x7995('0x2'),{'body':_0x10a05d,'options':{'where':{'id':_0x2722a3}},'log':_0x7995('0x3')});};exports[_0x7995('0x4')]=function(_0x462a03,_0x576d89){return client[_0x7995('0x5')](_0x7995('0x6'),{'body':_0x576d89,'options':{'where':{'id':_0x462a03}},'log':_0x7995('0x7')});}; \ No newline at end of file +var _0x7a54=['Request','UpdateFaxInteraction','addTags','AddTagsToFaxInteraction','../client','update'];(function(_0xf168d3,_0x43dcfc){var _0x17fb54=function(_0x3d9674){while(--_0x3d9674){_0xf168d3['push'](_0xf168d3['shift']());}};_0x17fb54(++_0x43dcfc);}(_0x7a54,0x106));var _0x47a5=function(_0x183e84,_0x4cd2d9){_0x183e84=_0x183e84-0x0;var _0x40c4c3=_0x7a54[_0x183e84];return _0x40c4c3;};'use strict';var client=require(_0x47a5('0x0'));exports[_0x47a5('0x1')]=function(_0x44b31e,_0x58157c){return client[_0x47a5('0x2')](_0x47a5('0x3'),{'body':_0x58157c,'options':{'where':{'id':_0x44b31e}},'log':'updateFaxInteraction'});};exports[_0x47a5('0x4')]=function(_0x11bf85,_0x2a1a7e){return client[_0x47a5('0x2')](_0x47a5('0x5'),{'body':_0x2a1a7e,'options':{'where':{'id':_0x11bf85}},'log':'addTagsToFaxInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxMessage.js b/server/services/routing/rpc/faxMessage.js index d68b368..7ab269a 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 _0x4983=['Request','createFaxMessage','../client'];(function(_0xa0b432,_0x55f6c9){var _0x4a35ed=function(_0x2f6aa4){while(--_0x2f6aa4){_0xa0b432['push'](_0xa0b432['shift']());}};_0x4a35ed(++_0x55f6c9);}(_0x4983,0x158));var _0x3498=function(_0x4e18f5,_0x3538fd){_0x4e18f5=_0x4e18f5-0x0;var _0x3f0d78=_0x4983[_0x4e18f5];return _0x3f0d78;};'use strict';var client=require(_0x3498('0x0'));exports['create']=function(_0x1b19c1){return client[_0x3498('0x1')]('CreateFaxMessage',{'body':_0x1b19c1,'log':_0x3498('0x2')});}; \ No newline at end of file +var _0xb7b9=['../client','create','Request','createFaxMessage'];(function(_0x4001ad,_0x1e22dd){var _0x4c7ec2=function(_0x24cb8a){while(--_0x24cb8a){_0x4001ad['push'](_0x4001ad['shift']());}};_0x4c7ec2(++_0x1e22dd);}(_0xb7b9,0x1f4));var _0x9b7b=function(_0x17c8b9,_0x1ba8b4){_0x17c8b9=_0x17c8b9-0x0;var _0xa7e0b0=_0xb7b9[_0x17c8b9];return _0xa7e0b0;};'use strict';var client=require(_0x9b7b('0x0'));exports[_0x9b7b('0x1')]=function(_0x144975){return client[_0x9b7b('0x2')]('CreateFaxMessage',{'body':_0x144975,'log':_0x9b7b('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueue.js b/server/services/routing/rpc/faxQueue.js index 2547a28..416a652 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 _0x7e47=['timeout','strategy','User','Agents','online','../client','getFaxQueues','Request','name'];(function(_0x1a2757,_0x52d178){var _0x2ba7a5=function(_0xccde63){while(--_0xccde63){_0x1a2757['push'](_0x1a2757['shift']());}};_0x2ba7a5(++_0x52d178);}(_0x7e47,0xd4));var _0x77e4=function(_0x45b0e3,_0x1eb267){_0x45b0e3=_0x45b0e3-0x0;var _0x4dd1d9=_0x7e47[_0x45b0e3];return _0x4dd1d9;};'use strict';var client=require(_0x77e4('0x0'));exports[_0x77e4('0x1')]=function(){return function(){return client[_0x77e4('0x2')]('GetFaxQueue',{'options':{'raw':![],'attributes':['id',_0x77e4('0x3'),_0x77e4('0x4'),_0x77e4('0x5')],'include':[{'model':_0x77e4('0x6'),'as':_0x77e4('0x7'),'attributes':['id',_0x77e4('0x3'),_0x77e4('0x8'),'faxPause']}]},'log':_0x77e4('0x1')});};}; \ No newline at end of file +var _0xe461=['Request','GetFaxQueue','name','timeout','strategy','User','Agents','faxPause','../client','getFaxQueues'];(function(_0x3cc052,_0x1a2e1f){var _0x3940a3=function(_0x2c7961){while(--_0x2c7961){_0x3cc052['push'](_0x3cc052['shift']());}};_0x3940a3(++_0x1a2e1f);}(_0xe461,0x9e));var _0x1e46=function(_0x446ef5,_0xc9752e){_0x446ef5=_0x446ef5-0x0;var _0xcd1516=_0xe461[_0x446ef5];return _0xcd1516;};'use strict';var client=require(_0x1e46('0x0'));exports[_0x1e46('0x1')]=function(){return function(){return client[_0x1e46('0x2')](_0x1e46('0x3'),{'options':{'raw':![],'attributes':['id',_0x1e46('0x4'),_0x1e46('0x5'),_0x1e46('0x6')],'include':[{'model':_0x1e46('0x7'),'as':_0x1e46('0x8'),'attributes':['id',_0x1e46('0x4'),'online',_0x1e46('0x9')]}]},'log':_0x1e46('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueueReport.js b/server/services/routing/rpc/faxQueueReport.js index f202779..3fb41a0 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 _0x0043=['../client','create','Request','CreateFaxQueueReport','update','DESC','UpdateFaxQueueReport'];(function(_0x7f205b,_0x1535dc){var _0xf0df84=function(_0x502874){while(--_0x502874){_0x7f205b['push'](_0x7f205b['shift']());}};_0xf0df84(++_0x1535dc);}(_0x0043,0xe7));var _0x3004=function(_0x1969a7,_0x5a133a){_0x1969a7=_0x1969a7-0x0;var _0x3d665f=_0x0043[_0x1969a7];return _0x3d665f;};'use strict';var client=require(_0x3004('0x0'));exports[_0x3004('0x1')]=function(_0x15d85e){return client[_0x3004('0x2')]('CreateFaxQueueReport',{'body':_0x15d85e,'log':_0x3004('0x3')});};exports[_0x3004('0x4')]=function(_0x49a00b,_0x3b2c5f){return client[_0x3004('0x2')]('UpdateFaxQueueReport',{'body':_0x3b2c5f,'options':{'where':{'uniqueid':_0x49a00b},'order':[['id',_0x3004('0x5')]],'limit':0x1},'log':_0x3004('0x6')});}; \ No newline at end of file +var _0x4172=['Request','CreateFaxQueueReport','update','UpdateFaxQueueReport','DESC','../client'];(function(_0x45d3f0,_0x4be53f){var _0x314b79=function(_0x563d32){while(--_0x563d32){_0x45d3f0['push'](_0x45d3f0['shift']());}};_0x314b79(++_0x4be53f);}(_0x4172,0x1c7));var _0x2417=function(_0x42c71c,_0x406fac){_0x42c71c=_0x42c71c-0x0;var _0x4fc7ac=_0x4172[_0x42c71c];return _0x4fc7ac;};'use strict';var client=require(_0x2417('0x0'));exports['create']=function(_0x590a8b){return client[_0x2417('0x1')](_0x2417('0x2'),{'body':_0x590a8b,'log':_0x2417('0x2')});};exports[_0x2417('0x3')]=function(_0x295ab0,_0x8c86a8){return client['Request'](_0x2417('0x4'),{'body':_0x8c86a8,'options':{'where':{'uniqueid':_0x295ab0},'order':[['id',_0x2417('0x5')]],'limit':0x1},'log':_0x2417('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/interval.js b/server/services/routing/rpc/interval.js index fae675e..a23b12e 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 _0x7240=['../client','getIntervals','Request','Intervals','name','interval'];(function(_0x5dbb84,_0x1bbce9){var _0x1d6eae=function(_0xd93967){while(--_0xd93967){_0x5dbb84['push'](_0x5dbb84['shift']());}};_0x1d6eae(++_0x1bbce9);}(_0x7240,0xc0));var _0x0724=function(_0x3305de,_0x16582f){_0x3305de=_0x3305de-0x0;var _0x3b5a84=_0x7240[_0x3305de];return _0x3b5a84;};'use strict';var client=require(_0x0724('0x0'));exports[_0x0724('0x1')]=function(){return function(){return client[_0x0724('0x2')]('GetInterval',{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id','name'],'include':[{'model':'Interval','as':_0x0724('0x3'),'attributes':['id',_0x0724('0x4'),_0x0724('0x5')]}]},'log':'getIntervals'});};}; \ No newline at end of file +var _0xdcdd=['name','Interval','interval','../client','getIntervals','Request','GetInterval'];(function(_0x1da527,_0x2dc953){var _0x40fc7c=function(_0x9949f5){while(--_0x9949f5){_0x1da527['push'](_0x1da527['shift']());}};_0x40fc7c(++_0x2dc953);}(_0xdcdd,0xb9));var _0xddcd=function(_0x15d566,_0xec7bc2){_0x15d566=_0x15d566-0x0;var _0x283002=_0xdcdd[_0x15d566];return _0x283002;};'use strict';var client=require(_0xddcd('0x0'));exports[_0xddcd('0x1')]=function(){return function(){return client[_0xddcd('0x2')](_0xddcd('0x3'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0xddcd('0x4')],'include':[{'model':_0xddcd('0x5'),'as':'Intervals','attributes':['id',_0xddcd('0x4'),_0xddcd('0x6')]}]},'log':_0xddcd('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailInteraction.js b/server/services/routing/rpc/mailInteraction.js index 2d3535b..a349a1a 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 _0x3de3=['../client','UpdateMailInteraction','updateMailInteraction','addTags','Request','AddTagsToMailInteraction'];(function(_0x586baa,_0x1cfa01){var _0x1ff9a7=function(_0x2dbce0){while(--_0x2dbce0){_0x586baa['push'](_0x586baa['shift']());}};_0x1ff9a7(++_0x1cfa01);}(_0x3de3,0x1ce));var _0x33de=function(_0x3691a1,_0x47dc15){_0x3691a1=_0x3691a1-0x0;var _0x5bb392=_0x3de3[_0x3691a1];return _0x5bb392;};'use strict';var client=require(_0x33de('0x0'));exports['update']=function(_0x19d1ba,_0x100783){return client['Request'](_0x33de('0x1'),{'body':_0x100783,'options':{'where':{'id':_0x19d1ba}},'log':_0x33de('0x2')});};exports[_0x33de('0x3')]=function(_0xbdd404,_0x56b413){return client[_0x33de('0x4')](_0x33de('0x5'),{'body':_0x56b413,'options':{'where':{'id':_0xbdd404}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file +var _0xa456=['AddTagsToMailInteraction','addTagsToChatInteraction','../client','update','UpdateMailInteraction','updateMailInteraction','addTags','Request'];(function(_0x15b1ec,_0x15ee62){var _0x33320c=function(_0x26e74d){while(--_0x26e74d){_0x15b1ec['push'](_0x15b1ec['shift']());}};_0x33320c(++_0x15ee62);}(_0xa456,0x142));var _0x6a45=function(_0x2080a3,_0x48acfa){_0x2080a3=_0x2080a3-0x0;var _0x8d7d17=_0xa456[_0x2080a3];return _0x8d7d17;};'use strict';var client=require(_0x6a45('0x0'));exports[_0x6a45('0x1')]=function(_0x56dfe8,_0xd5464e){return client['Request'](_0x6a45('0x2'),{'body':_0xd5464e,'options':{'where':{'id':_0x56dfe8}},'log':_0x6a45('0x3')});};exports[_0x6a45('0x4')]=function(_0x500c72,_0x1f0701){return client[_0x6a45('0x5')](_0x6a45('0x6'),{'body':_0x1f0701,'options':{'where':{'id':_0x500c72}},'log':_0x6a45('0x7')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailMessage.js b/server/services/routing/rpc/mailMessage.js index 366b478..2748eeb 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 _0xcd60=['CreateMailMessage','createMailMessage','create'];(function(_0x197e8e,_0x31af8c){var _0x31cff4=function(_0xb0e84d){while(--_0xb0e84d){_0x197e8e['push'](_0x197e8e['shift']());}};_0x31cff4(++_0x31af8c);}(_0xcd60,0x15b));var _0x0cd6=function(_0xf9ae3d,_0x48e369){_0xf9ae3d=_0xf9ae3d-0x0;var _0x53adaa=_0xcd60[_0xf9ae3d];return _0x53adaa;};'use strict';var client=require('../client');exports[_0x0cd6('0x0')]=function(_0x5d9b38){return client['Request'](_0x0cd6('0x1'),{'body':_0x5d9b38,'log':_0x0cd6('0x2')});}; \ No newline at end of file +var _0xc23a=['create','Request','CreateMailMessage','createMailMessage','../client'];(function(_0x1e7031,_0x4587b9){var _0x9f2d64=function(_0x3c8c82){while(--_0x3c8c82){_0x1e7031['push'](_0x1e7031['shift']());}};_0x9f2d64(++_0x4587b9);}(_0xc23a,0xd1));var _0xac23=function(_0x12fc8d,_0x19ee33){_0x12fc8d=_0x12fc8d-0x0;var _0x3f9d04=_0xc23a[_0x12fc8d];return _0x3f9d04;};'use strict';var client=require(_0xac23('0x0'));exports[_0xac23('0x1')]=function(_0x409a97){return client[_0xac23('0x2')](_0xac23('0x3'),{'body':_0x409a97,'log':_0xac23('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueue.js b/server/services/routing/rpc/mailQueue.js index 8c27990..293e1b5 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 _0xf6c9=['getMailQueues','Request','name','timeout','strategy','User','Agents','online','mailPause','../client'];(function(_0x358fd3,_0x4a9c44){var _0x1ad0f3=function(_0x3c098d){while(--_0x3c098d){_0x358fd3['push'](_0x358fd3['shift']());}};_0x1ad0f3(++_0x4a9c44);}(_0xf6c9,0x10d));var _0x9f6c=function(_0x338ca2,_0x5ccdc2){_0x338ca2=_0x338ca2-0x0;var _0x46e84d=_0xf6c9[_0x338ca2];return _0x46e84d;};'use strict';var client=require(_0x9f6c('0x0'));exports[_0x9f6c('0x1')]=function(){return function(){return client[_0x9f6c('0x2')]('GetMailQueue',{'options':{'raw':![],'attributes':['id',_0x9f6c('0x3'),_0x9f6c('0x4'),_0x9f6c('0x5')],'include':[{'model':_0x9f6c('0x6'),'as':_0x9f6c('0x7'),'attributes':['id',_0x9f6c('0x3'),_0x9f6c('0x8'),_0x9f6c('0x9')]}]},'log':_0x9f6c('0x1')});};}; \ No newline at end of file +var _0xf77b=['User','Agents','online','mailPause','../client','getMailQueues','Request','GetMailQueue','name','strategy'];(function(_0x25b7f4,_0x1fc48c){var _0x138824=function(_0x3c8525){while(--_0x3c8525){_0x25b7f4['push'](_0x25b7f4['shift']());}};_0x138824(++_0x1fc48c);}(_0xf77b,0x1da));var _0xbf77=function(_0x261522,_0x1adc1f){_0x261522=_0x261522-0x0;var _0x98a25a=_0xf77b[_0x261522];return _0x98a25a;};'use strict';var client=require(_0xbf77('0x0'));exports[_0xbf77('0x1')]=function(){return function(){return client[_0xbf77('0x2')](_0xbf77('0x3'),{'options':{'raw':![],'attributes':['id',_0xbf77('0x4'),'timeout',_0xbf77('0x5')],'include':[{'model':_0xbf77('0x6'),'as':_0xbf77('0x7'),'attributes':['id',_0xbf77('0x4'),_0xbf77('0x8'),_0xbf77('0x9')]}]},'log':_0xbf77('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueueReport.js b/server/services/routing/rpc/mailQueueReport.js index 5670221..7239535 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 _0xa729=['UpdateMailQueueReport','../client','create','CreateMailQueueReport','DESC'];(function(_0x4576c9,_0x43e213){var _0x2c8bd5=function(_0x243736){while(--_0x243736){_0x4576c9['push'](_0x4576c9['shift']());}};_0x2c8bd5(++_0x43e213);}(_0xa729,0x119));var _0x9a72=function(_0x101383,_0x5bd543){_0x101383=_0x101383-0x0;var _0x46cfe9=_0xa729[_0x101383];return _0x46cfe9;};'use strict';var client=require(_0x9a72('0x0'));exports[_0x9a72('0x1')]=function(_0x5b1aa8){return client['Request'](_0x9a72('0x2'),{'body':_0x5b1aa8,'log':_0x9a72('0x2')});};exports['update']=function(_0x1c926e,_0x5779e6){return client['Request']('UpdateMailQueueReport',{'body':_0x5779e6,'options':{'where':{'uniqueid':_0x1c926e},'order':[['id',_0x9a72('0x3')]],'limit':0x1},'log':_0x9a72('0x4')});}; \ No newline at end of file +var _0xce35=['CreateMailQueueReport','update','DESC','UpdateMailQueueReport','../client','create','Request'];(function(_0x2dcf94,_0x518944){var _0x3d6cb6=function(_0x112f01){while(--_0x112f01){_0x2dcf94['push'](_0x2dcf94['shift']());}};_0x3d6cb6(++_0x518944);}(_0xce35,0x1a8));var _0x5ce3=function(_0xa42252,_0x44c78f){_0xa42252=_0xa42252-0x0;var _0x15e8b=_0xce35[_0xa42252];return _0x15e8b;};'use strict';var client=require(_0x5ce3('0x0'));exports[_0x5ce3('0x1')]=function(_0x245535){return client[_0x5ce3('0x2')](_0x5ce3('0x3'),{'body':_0x245535,'log':'CreateMailQueueReport'});};exports[_0x5ce3('0x4')]=function(_0x3dde80,_0x2faddb){return client['Request']('UpdateMailQueueReport',{'body':_0x2faddb,'options':{'where':{'uniqueid':_0x3dde80},'order':[['id',_0x5ce3('0x5')]],'limit':0x1},'log':_0x5ce3('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelInteraction.js b/server/services/routing/rpc/openchannelInteraction.js index 86ed11c..c414aaf 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 _0xe127=['update','UpdateOpenchannelInteraction','updateOpenchannelInteraction','addTags','Request','AddTagsToOpenchannelInteraction','../client'];(function(_0x279c27,_0x23ac03){var _0x11048a=function(_0x12a2e6){while(--_0x12a2e6){_0x279c27['push'](_0x279c27['shift']());}};_0x11048a(++_0x23ac03);}(_0xe127,0x1e9));var _0x7e12=function(_0x332e76,_0x1c4011){_0x332e76=_0x332e76-0x0;var _0x290949=_0xe127[_0x332e76];return _0x290949;};'use strict';var client=require(_0x7e12('0x0'));exports[_0x7e12('0x1')]=function(_0x5763c0,_0x2c3494){return client['Request'](_0x7e12('0x2'),{'body':_0x2c3494,'options':{'where':{'id':_0x5763c0}},'log':_0x7e12('0x3')});};exports[_0x7e12('0x4')]=function(_0x20b4ba,_0x351482){return client[_0x7e12('0x5')](_0x7e12('0x6'),{'body':_0x351482,'options':{'where':{'id':_0x20b4ba}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file +var _0xffeb=['AddTagsToOpenchannelInteraction','addTagsToChatInteraction','../client','Request','updateOpenchannelInteraction','addTags'];(function(_0x231a47,_0x46a963){var _0x48d7c9=function(_0x1e69b1){while(--_0x1e69b1){_0x231a47['push'](_0x231a47['shift']());}};_0x48d7c9(++_0x46a963);}(_0xffeb,0x134));var _0xbffe=function(_0x2fa51a,_0x4d691d){_0x2fa51a=_0x2fa51a-0x0;var _0xf7e4c0=_0xffeb[_0x2fa51a];return _0xf7e4c0;};'use strict';var client=require(_0xbffe('0x0'));exports['update']=function(_0x2609c2,_0xd3b781){return client[_0xbffe('0x1')]('UpdateOpenchannelInteraction',{'body':_0xd3b781,'options':{'where':{'id':_0x2609c2}},'log':_0xbffe('0x2')});};exports[_0xbffe('0x3')]=function(_0x4c52cb,_0x92755d){return client[_0xbffe('0x1')](_0xbffe('0x4'),{'body':_0x92755d,'options':{'where':{'id':_0x4c52cb}},'log':_0xbffe('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelMessage.js b/server/services/routing/rpc/openchannelMessage.js index f4482df..52f68df 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 _0xcfe0=['Request','createOpenchannelMessage','../client','create'];(function(_0x122c49,_0x452163){var _0x543888=function(_0x2b9d38){while(--_0x2b9d38){_0x122c49['push'](_0x122c49['shift']());}};_0x543888(++_0x452163);}(_0xcfe0,0x156));var _0x0cfe=function(_0x417bcc,_0x238d22){_0x417bcc=_0x417bcc-0x0;var _0x2e7fb3=_0xcfe0[_0x417bcc];return _0x2e7fb3;};'use strict';var client=require(_0x0cfe('0x0'));exports[_0x0cfe('0x1')]=function(_0x11590a){return client[_0x0cfe('0x2')]('CreateOpenchannelMessage',{'body':_0x11590a,'log':_0x0cfe('0x3')});}; \ No newline at end of file +var _0x9bc9=['../client','create','Request','CreateOpenchannelMessage','createOpenchannelMessage'];(function(_0x1e5db8,_0x44ef41){var _0x219a51=function(_0x5b86a3){while(--_0x5b86a3){_0x1e5db8['push'](_0x1e5db8['shift']());}};_0x219a51(++_0x44ef41);}(_0x9bc9,0xe1));var _0x99bc=function(_0x2a8eab,_0x334b58){_0x2a8eab=_0x2a8eab-0x0;var _0x5015c6=_0x9bc9[_0x2a8eab];return _0x5015c6;};'use strict';var client=require(_0x99bc('0x0'));exports[_0x99bc('0x1')]=function(_0x59760d){return client[_0x99bc('0x2')](_0x99bc('0x3'),{'body':_0x59760d,'log':_0x99bc('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueue.js b/server/services/routing/rpc/openchannelQueue.js index d72f8db..b14ccca 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 _0x3662=['openchannelPause','../client','getOpenchannelQueues','Request','name','timeout','strategy','User','Agents','online'];(function(_0x183cd6,_0xe4ece8){var _0x500cb9=function(_0x290b84){while(--_0x290b84){_0x183cd6['push'](_0x183cd6['shift']());}};_0x500cb9(++_0xe4ece8);}(_0x3662,0xfb));var _0x2366=function(_0x59dbc6,_0x1dd9c3){_0x59dbc6=_0x59dbc6-0x0;var _0xe15a6d=_0x3662[_0x59dbc6];return _0xe15a6d;};'use strict';var client=require(_0x2366('0x0'));exports[_0x2366('0x1')]=function(){return function(){return client[_0x2366('0x2')]('GetOpenchannelQueue',{'options':{'raw':![],'attributes':['id',_0x2366('0x3'),_0x2366('0x4'),_0x2366('0x5')],'include':[{'model':_0x2366('0x6'),'as':_0x2366('0x7'),'attributes':['id',_0x2366('0x3'),_0x2366('0x8'),_0x2366('0x9')]}]},'log':_0x2366('0x1')});};}; \ No newline at end of file +var _0x0cdd=['openchannelPause','../client','getOpenchannelQueues','Request','GetOpenchannelQueue','name','timeout'];(function(_0x4e3079,_0x2e48ea){var _0x4356fb=function(_0x3f31e0){while(--_0x3f31e0){_0x4e3079['push'](_0x4e3079['shift']());}};_0x4356fb(++_0x2e48ea);}(_0x0cdd,0x158));var _0xd0cd=function(_0x5617b7,_0x709746){_0x5617b7=_0x5617b7-0x0;var _0x4838a1=_0x0cdd[_0x5617b7];return _0x4838a1;};'use strict';var client=require(_0xd0cd('0x0'));exports[_0xd0cd('0x1')]=function(){return function(){return client[_0xd0cd('0x2')](_0xd0cd('0x3'),{'options':{'raw':![],'attributes':['id',_0xd0cd('0x4'),_0xd0cd('0x5'),'strategy'],'include':[{'model':'User','as':'Agents','attributes':['id',_0xd0cd('0x4'),'online',_0xd0cd('0x6')]}]},'log':_0xd0cd('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueueReport.js b/server/services/routing/rpc/openchannelQueueReport.js index d0ffd06..8c6f82d 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 _0x403c=['DESC','../client','create','Request','CreateOpenchannelQueueReport','update','UpdateOpenchannelQueueReport'];(function(_0x3bd401,_0x59f206){var _0xd5f52f=function(_0x12d248){while(--_0x12d248){_0x3bd401['push'](_0x3bd401['shift']());}};_0xd5f52f(++_0x59f206);}(_0x403c,0x112));var _0xc403=function(_0x31bbd9,_0x1db86f){_0x31bbd9=_0x31bbd9-0x0;var _0x680822=_0x403c[_0x31bbd9];return _0x680822;};'use strict';var client=require(_0xc403('0x0'));exports[_0xc403('0x1')]=function(_0x6fdfd7){return client[_0xc403('0x2')](_0xc403('0x3'),{'body':_0x6fdfd7,'log':_0xc403('0x3')});};exports[_0xc403('0x4')]=function(_0x4d8141,_0xab42e4){return client[_0xc403('0x2')](_0xc403('0x5'),{'body':_0xab42e4,'options':{'where':{'uniqueid':_0x4d8141},'order':[['id',_0xc403('0x6')]],'limit':0x1},'log':_0xc403('0x5')});}; \ No newline at end of file +var _0x4a24=['CreateOpenchannelQueueReport','UpdateOpenchannelQueueReport','Request'];(function(_0x25844c,_0x2682a2){var _0x49e34b=function(_0x13c1e6){while(--_0x13c1e6){_0x25844c['push'](_0x25844c['shift']());}};_0x49e34b(++_0x2682a2);}(_0x4a24,0xef));var _0x44a2=function(_0x544099,_0x372b30){_0x544099=_0x544099-0x0;var _0x20ab09=_0x4a24[_0x544099];return _0x20ab09;};'use strict';var client=require('../client');exports['create']=function(_0x25a55b){return client[_0x44a2('0x0')](_0x44a2('0x1'),{'body':_0x25a55b,'log':_0x44a2('0x1')});};exports['update']=function(_0x5661a6,_0xb9684d){return client[_0x44a2('0x0')](_0x44a2('0x2'),{'body':_0xb9684d,'options':{'where':{'uniqueid':_0x5661a6},'order':[['id','DESC']],'limit':0x1},'log':'UpdateOpenchannelQueueReport'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsInteraction.js b/server/services/routing/rpc/smsInteraction.js index 1d9aab7..e3ff13d 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 _0x6fad=['../client','update','UpdateSmsInteraction','addTags','Request','addTagsToSmsInteraction'];(function(_0x205562,_0x1695a5){var _0x32e766=function(_0x38aa4e){while(--_0x38aa4e){_0x205562['push'](_0x205562['shift']());}};_0x32e766(++_0x1695a5);}(_0x6fad,0x174));var _0xd6fa=function(_0xb113d7,_0x2fc306){_0xb113d7=_0xb113d7-0x0;var _0xd5a08d=_0x6fad[_0xb113d7];return _0xd5a08d;};'use strict';var client=require(_0xd6fa('0x0'));exports[_0xd6fa('0x1')]=function(_0x20c9f5,_0x44c709){return client['Request'](_0xd6fa('0x2'),{'body':_0x44c709,'options':{'where':{'id':_0x20c9f5}},'log':'updateSmsInteraction'});};exports[_0xd6fa('0x3')]=function(_0x48f433,_0x3e76d0){return client[_0xd6fa('0x4')]('AddTagsToSmsInteraction',{'body':_0x3e76d0,'options':{'where':{'id':_0x48f433}},'log':_0xd6fa('0x5')});}; \ No newline at end of file +var _0x294b=['addTags','AddTagsToSmsInteraction','addTagsToSmsInteraction','../client','Request','UpdateSmsInteraction','updateSmsInteraction'];(function(_0x2a2d7a,_0x3638fa){var _0x122240=function(_0x484c0f){while(--_0x484c0f){_0x2a2d7a['push'](_0x2a2d7a['shift']());}};_0x122240(++_0x3638fa);}(_0x294b,0xea));var _0xb294=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x294b[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0xb294('0x0'));exports['update']=function(_0x3ae39b,_0x16bc4c){return client[_0xb294('0x1')](_0xb294('0x2'),{'body':_0x16bc4c,'options':{'where':{'id':_0x3ae39b}},'log':_0xb294('0x3')});};exports[_0xb294('0x4')]=function(_0x58fe24,_0x5c0237){return client[_0xb294('0x1')](_0xb294('0x5'),{'body':_0x5c0237,'options':{'where':{'id':_0x58fe24}},'log':_0xb294('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsMessage.js b/server/services/routing/rpc/smsMessage.js index 148a2e0..19f0cf7 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 _0x26c4=['create'];(function(_0x3959da,_0x598a6b){var _0x4a1db9=function(_0x262716){while(--_0x262716){_0x3959da['push'](_0x3959da['shift']());}};_0x4a1db9(++_0x598a6b);}(_0x26c4,0x1eb));var _0x426c=function(_0x602ee5,_0x42c947){_0x602ee5=_0x602ee5-0x0;var _0x2892a9=_0x26c4[_0x602ee5];return _0x2892a9;};'use strict';var client=require('../client');exports[_0x426c('0x0')]=function(_0x44ccbf){return client['Request']('CreateSmsMessage',{'body':_0x44ccbf,'log':'createSmsMessage'});}; \ No newline at end of file +var _0x21e6=['createSmsMessage','../client','create','CreateSmsMessage'];(function(_0x5c4bf4,_0x1f5d28){var _0x555f0e=function(_0x2325a8){while(--_0x2325a8){_0x5c4bf4['push'](_0x5c4bf4['shift']());}};_0x555f0e(++_0x1f5d28);}(_0x21e6,0x155));var _0x621e=function(_0x54cd98,_0x3029e6){_0x54cd98=_0x54cd98-0x0;var _0x4abd09=_0x21e6[_0x54cd98];return _0x4abd09;};'use strict';var client=require(_0x621e('0x0'));exports[_0x621e('0x1')]=function(_0x40a068){return client['Request'](_0x621e('0x2'),{'body':_0x40a068,'log':_0x621e('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueue.js b/server/services/routing/rpc/smsQueue.js index 44e8de7..90416a7 100644 --- a/server/services/routing/rpc/smsQueue.js +++ b/server/services/routing/rpc/smsQueue.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb7e7=['online','../client','Request','name','strategy','Agents'];(function(_0x4ff0df,_0xcf9417){var _0x236925=function(_0x3d12c1){while(--_0x3d12c1){_0x4ff0df['push'](_0x4ff0df['shift']());}};_0x236925(++_0xcf9417);}(_0xb7e7,0x121));var _0x7b7e=function(_0x278e3c,_0x1c9cfd){_0x278e3c=_0x278e3c-0x0;var _0x3e2d9b=_0xb7e7[_0x278e3c];return _0x3e2d9b;};'use strict';var client=require(_0x7b7e('0x0'));exports['getSmsQueues']=function(){return function(){return client[_0x7b7e('0x1')]('GetSmsQueue',{'options':{'raw':![],'attributes':['id',_0x7b7e('0x2'),'timeout',_0x7b7e('0x3')],'include':[{'model':'User','as':_0x7b7e('0x4'),'attributes':['id',_0x7b7e('0x2'),_0x7b7e('0x5'),'smsPause']}]},'log':'getSmsQueues'});};}; \ No newline at end of file +var _0xb7e7=['online','../client','Request','name','strategy','Agents'];(function(_0x20ff58,_0x2ad62f){var _0xa1a390=function(_0x5bf50c){while(--_0x5bf50c){_0x20ff58['push'](_0x20ff58['shift']());}};_0xa1a390(++_0x2ad62f);}(_0xb7e7,0x121));var _0x7b7e=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0xb7e7[_0x297fd3];return _0x2af381;};'use strict';var client=require(_0x7b7e('0x0'));exports['getSmsQueues']=function(){return function(){return client[_0x7b7e('0x1')]('GetSmsQueue',{'options':{'raw':![],'attributes':['id',_0x7b7e('0x2'),'timeout',_0x7b7e('0x3')],'include':[{'model':'User','as':_0x7b7e('0x4'),'attributes':['id',_0x7b7e('0x2'),_0x7b7e('0x5'),'smsPause']}]},'log':'getSmsQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueueReport.js b/server/services/routing/rpc/smsQueueReport.js index f184fa4..a10601e 100644 --- a/server/services/routing/rpc/smsQueueReport.js +++ b/server/services/routing/rpc/smsQueueReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70e0=['create','CreateSmsQueueReport','update','UpdateSmsQueueReport','../client'];(function(_0x33fcbb,_0x291d0f){var _0x2efe40=function(_0x2e9442){while(--_0x2e9442){_0x33fcbb['push'](_0x33fcbb['shift']());}};_0x2efe40(++_0x291d0f);}(_0x70e0,0x17b));var _0x070e=function(_0x1b1b3b,_0x5ad512){_0x1b1b3b=_0x1b1b3b-0x0;var _0x381dce=_0x70e0[_0x1b1b3b];return _0x381dce;};'use strict';var client=require(_0x070e('0x0'));exports[_0x070e('0x1')]=function(_0x198c2e){return client['Request']('CreateSmsQueueReport',{'body':_0x198c2e,'log':_0x070e('0x2')});};exports[_0x070e('0x3')]=function(_0x277d32,_0x2593e5){return client['Request'](_0x070e('0x4'),{'body':_0x2593e5,'options':{'where':{'uniqueid':_0x277d32},'order':[['id','DESC']],'limit':0x1},'log':_0x070e('0x4')});}; \ No newline at end of file +var _0x9c44=['Request','CreateSmsQueueReport','update','UpdateSmsQueueReport'];(function(_0x49fc41,_0x33dee2){var _0x4bec26=function(_0x2c75dd){while(--_0x2c75dd){_0x49fc41['push'](_0x49fc41['shift']());}};_0x4bec26(++_0x33dee2);}(_0x9c44,0x178));var _0x49c4=function(_0x16b9ed,_0x56517a){_0x16b9ed=_0x16b9ed-0x0;var _0x66b1f8=_0x9c44[_0x16b9ed];return _0x66b1f8;};'use strict';var client=require('../client');exports['create']=function(_0x1ffbbf){return client[_0x49c4('0x0')](_0x49c4('0x1'),{'body':_0x1ffbbf,'log':_0x49c4('0x1')});};exports[_0x49c4('0x2')]=function(_0x2ad237,_0x4e0313){return client['Request'](_0x49c4('0x3'),{'body':_0x4e0313,'options':{'where':{'uniqueid':_0x2ad237},'order':[['id','DESC']],'limit':0x1},'log':_0x49c4('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/user.js b/server/services/routing/rpc/user.js index af025dc..df5baf2 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(_0x22639e,_0xcbfcc){var _0x43f1ca=function(_0x223ebe){while(--_0x223ebe){_0x22639e['push'](_0x22639e['shift']());}};_0x43f1ca(++_0xcbfcc);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3b5250,_0x7a0b2c){_0x3b5250=_0x3b5250-0x0;var _0xc844a1=_0xa9e0[_0x3b5250];return _0xc844a1;};'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(_0x294c63,_0x3c83b9){var _0x3756eb=function(_0x4865b5){while(--_0x4865b5){_0x294c63['push'](_0x294c63['shift']());}};_0x3756eb(++_0x3c83b9);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xa9e0[_0x4cf98e];return _0x1623ac;};'use strict';var client=require(_0x0a9e('0x0'));exports[_0x0a9e('0x1')]=function(){return function(){return client[_0x0a9e('0x2')]('GetUser',{'options':{'raw':!![],'where':{'role':'agent'},'attributes':['id',_0x0a9e('0x3'),'online',_0x0a9e('0x4'),_0x0a9e('0x5'),_0x0a9e('0x6'),_0x0a9e('0x7'),_0x0a9e('0x8'),'faxPause',_0x0a9e('0x9'),_0x0a9e('0xa'),_0x0a9e('0xb'),'chatCapacity','mailCapacity',_0x0a9e('0xc'),'smsCapacity','whatsappCapacity',_0x0a9e('0xd')]},'log':_0x0a9e('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappInteraction.js b/server/services/routing/rpc/whatsappInteraction.js index cc28352..b6d06a6 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 _0x565f=['update','UpdateWhatsappInteraction','updateWhatsappInteraction','addTags'];(function(_0x9b6521,_0x3f09eb){var _0x13fdce=function(_0x2552a8){while(--_0x2552a8){_0x9b6521['push'](_0x9b6521['shift']());}};_0x13fdce(++_0x3f09eb);}(_0x565f,0x68));var _0xf565=function(_0x135ea6,_0x539e9e){_0x135ea6=_0x135ea6-0x0;var _0x53f2a4=_0x565f[_0x135ea6];return _0x53f2a4;};'use strict';var client=require('../client');exports[_0xf565('0x0')]=function(_0x645987,_0x1d8f31){return client['Request'](_0xf565('0x1'),{'body':_0x1d8f31,'options':{'where':{'id':_0x645987}},'log':_0xf565('0x2')});};exports[_0xf565('0x3')]=function(_0x44400f,_0x35e885){return client['Request']('AddTagsToWhatsappInteraction',{'body':_0x35e885,'options':{'where':{'id':_0x44400f}},'log':'addTagsToWhatsappInteraction'});}; \ No newline at end of file +var _0xd2f5=['../client','Request','updateWhatsappInteraction','addTags','AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction'];(function(_0x5db1c0,_0x21819a){var _0x549cf4=function(_0xf0689b){while(--_0xf0689b){_0x5db1c0['push'](_0x5db1c0['shift']());}};_0x549cf4(++_0x21819a);}(_0xd2f5,0x144));var _0x5d2f=function(_0x14238b,_0x5e77b4){_0x14238b=_0x14238b-0x0;var _0x2f3166=_0xd2f5[_0x14238b];return _0x2f3166;};'use strict';var client=require(_0x5d2f('0x0'));exports['update']=function(_0x194209,_0x58ee4e){return client[_0x5d2f('0x1')]('UpdateWhatsappInteraction',{'body':_0x58ee4e,'options':{'where':{'id':_0x194209}},'log':_0x5d2f('0x2')});};exports[_0x5d2f('0x3')]=function(_0x102911,_0xc7102b){return client[_0x5d2f('0x1')](_0x5d2f('0x4'),{'body':_0xc7102b,'options':{'where':{'id':_0x102911}},'log':_0x5d2f('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappMessage.js b/server/services/routing/rpc/whatsappMessage.js index 0156397..eb0ca62 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 _0x8840=['create','CreateWhatsappMessage','createWhatsappMessage','../client'];(function(_0x4854d4,_0x5b00aa){var _0x3b209c=function(_0x384570){while(--_0x384570){_0x4854d4['push'](_0x4854d4['shift']());}};_0x3b209c(++_0x5b00aa);}(_0x8840,0x1b3));var _0x0884=function(_0x317cc5,_0x3b6179){_0x317cc5=_0x317cc5-0x0;var _0x44fe81=_0x8840[_0x317cc5];return _0x44fe81;};'use strict';var client=require(_0x0884('0x0'));exports[_0x0884('0x1')]=function(_0x3f2fcc){return client['Request'](_0x0884('0x2'),{'body':_0x3f2fcc,'log':_0x0884('0x3')});}; \ No newline at end of file +var _0x28d0=['Request','CreateWhatsappMessage','createWhatsappMessage','../client','create'];(function(_0x162780,_0x47f2e2){var _0x1ea2dc=function(_0x123898){while(--_0x123898){_0x162780['push'](_0x162780['shift']());}};_0x1ea2dc(++_0x47f2e2);}(_0x28d0,0x94));var _0x028d=function(_0x4ce11d,_0x439037){_0x4ce11d=_0x4ce11d-0x0;var _0x5c8e56=_0x28d0[_0x4ce11d];return _0x5c8e56;};'use strict';var client=require(_0x028d('0x0'));exports[_0x028d('0x1')]=function(_0x1536a5){return client[_0x028d('0x2')](_0x028d('0x3'),{'body':_0x1536a5,'log':_0x028d('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueue.js b/server/services/routing/rpc/whatsappQueue.js index ca85fd2..ad9ba22 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 _0xa5bf=['whatsappPause','../client','getWhatsappQueues','GetWhatsappQueue','name','timeout','User','Agents','online'];(function(_0x30a5cb,_0x34b705){var _0x202e1b=function(_0x63cec8){while(--_0x63cec8){_0x30a5cb['push'](_0x30a5cb['shift']());}};_0x202e1b(++_0x34b705);}(_0xa5bf,0xa3));var _0xfa5b=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0xa5bf[_0x1035c1];return _0x308d67;};'use strict';var client=require(_0xfa5b('0x0'));exports[_0xfa5b('0x1')]=function(){return function(){return client['Request'](_0xfa5b('0x2'),{'options':{'raw':![],'attributes':['id',_0xfa5b('0x3'),_0xfa5b('0x4'),'strategy'],'include':[{'model':_0xfa5b('0x5'),'as':_0xfa5b('0x6'),'attributes':['id','name',_0xfa5b('0x7'),_0xfa5b('0x8')]}]},'log':_0xfa5b('0x1')});};}; \ No newline at end of file +var _0xfe48=['getWhatsappQueues','name','timeout','strategy','User','Agents','whatsappPause','../client'];(function(_0x4f676e,_0x571ace){var _0x542a9b=function(_0x31a202){while(--_0x31a202){_0x4f676e['push'](_0x4f676e['shift']());}};_0x542a9b(++_0x571ace);}(_0xfe48,0x9f));var _0x8fe4=function(_0x92624e,_0x3ad9e0){_0x92624e=_0x92624e-0x0;var _0x592713=_0xfe48[_0x92624e];return _0x592713;};'use strict';var client=require(_0x8fe4('0x0'));exports[_0x8fe4('0x1')]=function(){return function(){return client['Request']('GetWhatsappQueue',{'options':{'raw':![],'attributes':['id',_0x8fe4('0x2'),_0x8fe4('0x3'),_0x8fe4('0x4')],'include':[{'model':_0x8fe4('0x5'),'as':_0x8fe4('0x6'),'attributes':['id',_0x8fe4('0x2'),'online',_0x8fe4('0x7')]}]},'log':_0x8fe4('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueueReport.js b/server/services/routing/rpc/whatsappQueueReport.js index e2d47fa..1eb33d9 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 _0x50e3=['UpdateWhatsappQueueReport','DESC','../client','create','Request','CreateWhatsappQueueReport'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0x50e3,0x68));var _0x350e=function(_0x264b35,_0x45de4c){_0x264b35=_0x264b35-0x0;var _0x3ff9ca=_0x50e3[_0x264b35];return _0x3ff9ca;};'use strict';var client=require(_0x350e('0x0'));exports[_0x350e('0x1')]=function(_0x52ee7f){return client[_0x350e('0x2')]('CreateWhatsappQueueReport',{'body':_0x52ee7f,'log':_0x350e('0x3')});};exports['update']=function(_0x5da4b5,_0x48d393){return client[_0x350e('0x2')](_0x350e('0x4'),{'body':_0x48d393,'options':{'where':{'uniqueid':_0x5da4b5},'order':[['id',_0x350e('0x5')]],'limit':0x1},'log':'UpdateWhatsappQueueReport'});}; \ No newline at end of file +var _0xacb6=['CreateWhatsappQueueReport','update','Request','UpdateWhatsappQueueReport','../client'];(function(_0x304690,_0x223e0f){var _0x5037b7=function(_0x4f87b2){while(--_0x4f87b2){_0x304690['push'](_0x304690['shift']());}};_0x5037b7(++_0x223e0f);}(_0xacb6,0x16c));var _0x6acb=function(_0x232559,_0x324eb3){_0x232559=_0x232559-0x0;var _0x25be03=_0xacb6[_0x232559];return _0x25be03;};'use strict';var client=require(_0x6acb('0x0'));exports['create']=function(_0x239aac){return client['Request'](_0x6acb('0x1'),{'body':_0x239aac,'log':_0x6acb('0x1')});};exports[_0x6acb('0x2')]=function(_0x36f05d,_0x45f7f5){return client[_0x6acb('0x3')](_0x6acb('0x4'),{'body':_0x45f7f5,'options':{'where':{'uniqueid':_0x36f05d},'order':[['id','DESC']],'limit':0x1},'log':_0x6acb('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/server/applications/agent.js b/server/services/routing/server/applications/agent.js index d15ba40..dd15e7a 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 _0xea33=['next','error','log','validate','util','seq-queue','../../../../config/logger','routing','./strategy','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','info','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','consequence','length','[%s][AGENT]\x20%s','map','find','agents','timeout','atimeout','channel','format','START:%s','rules','end','close','stop','complete'];(function(_0x1ee2f8,_0x51c949){var _0x60a464=function(_0x48137f){while(--_0x48137f){_0x1ee2f8['push'](_0x1ee2f8['shift']());}};_0x60a464(++_0x51c949);}(_0xea33,0x1c3));var _0x3ea3=function(_0x146837,_0x2aa6a2){_0x146837=_0x146837-0x0;var _0x3d7e60=_0xea33[_0x146837];return _0x3d7e60;};'use strict';var schema=require(_0x3ea3('0x0'));var _=require('lodash');var util=require(_0x3ea3('0x1'));var seqqueue=require(_0x3ea3('0x2'));var logger=require(_0x3ea3('0x3'))(_0x3ea3('0x4'));var strategy=require(_0x3ea3('0x5'));var queue=schema({'name':{'type':_0x3ea3('0x6'),'required':!![],'message':_0x3ea3('0x7')},'timeout':{'type':_0x3ea3('0x8'),'message':'timeout\x20is\x20a\x20number'}});function writeLog(_0x60d543,_0x57be73,_0x4a4783){return logger[_0x3ea3('0x9')](util['format'](_0x3ea3('0xa'),_0x60d543,_0x57be73[_0x3ea3('0xb')],_0x4a4783));}function handleFindAgent(_0x236b91){return function(_0x142238){return _0x142238[_0x3ea3('0xb')][_0x3ea3('0xc')]()===_0x236b91[_0x3ea3('0xc')]();};}exports[_0x3ea3('0xd')]=function(_0x3cc40a,_0x54e46d,_0x5b1129,_0x341645){return function(_0x1afb1f){try{var _0x3e35a1={'name':_0x54e46d[0x0],'timeout':_0x54e46d[0x1]};var _0x47b30a=queue[_0x3ea3('0x0')](_0x3e35a1,{'typecast':!![]});if(_0x47b30a[_0x3ea3('0xe')]){logger['error'](_0x3ea3('0xf'),_0x3cc40a,_[_0x3ea3('0x10')](_0x47b30a,'message')['join'](',\x20'));_0x1afb1f['stop']();}else{var _0x2025e2=_[_0x3ea3('0x11')](_0x5b1129[_0x3ea3('0x12')],handleFindAgent(_0x3e35a1[_0x3ea3('0xb')]));if(_0x2025e2){var _0x1c0f24=(_0x3e35a1[_0x3ea3('0x13')]||0xa)*0x3e8;var _0x1dab2a,_0xa93939;var _0x5684f4=seqqueue['createQueue'](_0x1c0f24);_0x5684f4['id']=_0x3cc40a;_0x5684f4[_0x3ea3('0x14')]=_0x1c0f24;_0x5684f4[_0x3ea3('0x15')]=_0x341645[_0x3ea3('0x15')];writeLog(_0x3cc40a,_0x2025e2,util[_0x3ea3('0x16')](_0x3ea3('0x17'),_0x1c0f24));_0x5b1129[_0x3ea3('0x18')][_0x3cc40a]['on'](_0x3ea3('0x19'),function(){logger['info']('[%s][AGENT]\x20ROUTING\x20STOPPED',_0x3cc40a);clearTimeout(_0xa93939);_0xa93939=undefined;_0x5684f4[_0x3ea3('0x1a')]();if(_0x5b1129['rules'][_0x3cc40a]){delete _0x5b1129[_0x3ea3('0x18')][_0x3cc40a];}_0x1afb1f[_0x3ea3('0x1b')]();});_0x5b1129[_0x3ea3('0x18')][_0x3cc40a]['on'](_0x3ea3('0x1c'),function(){if(_0x5b1129[_0x3ea3('0x18')][_0x3cc40a]){delete _0x5b1129['rules'][_0x3cc40a];}});_0xa93939=setTimeout(function(){logger[_0x3ea3('0x9')]('[%s][AGENT]\x20ROUTING\x20END',_0x3cc40a);clearTimeout(_0xa93939);_0x5684f4['close']();_0x1afb1f[_0x3ea3('0x1d')]();},_0x1c0f24);strategy['agent'](_0x5684f4,_0x2025e2,_0x5b1129,_0x341645);}else{logger[_0x3ea3('0x1e')]('[%s][AGENT]\x20agent\x20not\x20found\x20%s',_0x3cc40a,_0x3e35a1[_0x3ea3('0xb')]);_0x1afb1f[_0x3ea3('0x1b')]();}}}catch(_0x49d5f6){console[_0x3ea3('0x1f')](_0x49d5f6);logger[_0x3ea3('0x1e')]('[%s][QUEUE]\x20%s',_0x3cc40a,_0x49d5f6['stack']);_0x1afb1f[_0x3ea3('0x1b')]();}};}; \ No newline at end of file +var _0x2aa7=['[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','stack','lodash','util','../../../../config/logger','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','info','format','[%s][AGENT][NAME:%s][STATUS:%s]','toLowerCase','consequence','validate','length','error','[%s][AGENT]\x20%s','message','join','agents','name','timeout','createQueue','atimeout','channel','START:%s','rules','end','close','stop','[%s][AGENT]\x20ROUTING\x20END'];(function(_0x580647,_0x43d2c3){var _0x5f0792=function(_0x386cef){while(--_0x386cef){_0x580647['push'](_0x580647['shift']());}};_0x5f0792(++_0x43d2c3);}(_0x2aa7,0xa8));var _0x72aa=function(_0x5e3fa0,_0x4e1dac){_0x5e3fa0=_0x5e3fa0-0x0;var _0x4ef06c=_0x2aa7[_0x5e3fa0];return _0x4ef06c;};'use strict';var schema=require('validate');var _=require(_0x72aa('0x0'));var util=require(_0x72aa('0x1'));var seqqueue=require('seq-queue');var logger=require(_0x72aa('0x2'))('routing');var strategy=require('./strategy');var queue=schema({'name':{'type':_0x72aa('0x3'),'required':!![],'message':_0x72aa('0x4')},'timeout':{'type':_0x72aa('0x5'),'message':_0x72aa('0x6')}});function writeLog(_0xfeaa7e,_0x228da9,_0x2e2b81){return logger[_0x72aa('0x7')](util[_0x72aa('0x8')](_0x72aa('0x9'),_0xfeaa7e,_0x228da9['name'],_0x2e2b81));}function handleFindAgent(_0x26d6ff){return function(_0x46c254){return _0x46c254['name']['toLowerCase']()===_0x26d6ff[_0x72aa('0xa')]();};}exports[_0x72aa('0xb')]=function(_0x473ffc,_0x1d5d92,_0x56bd19,_0x496844){return function(_0x29d1bf){try{var _0x38a430={'name':_0x1d5d92[0x0],'timeout':_0x1d5d92[0x1]};var _0x1972f4=queue[_0x72aa('0xc')](_0x38a430,{'typecast':!![]});if(_0x1972f4[_0x72aa('0xd')]){logger[_0x72aa('0xe')](_0x72aa('0xf'),_0x473ffc,_['map'](_0x1972f4,_0x72aa('0x10'))[_0x72aa('0x11')](',\x20'));_0x29d1bf['stop']();}else{var _0x127a5a=_['find'](_0x56bd19[_0x72aa('0x12')],handleFindAgent(_0x38a430[_0x72aa('0x13')]));if(_0x127a5a){var _0x3cf223=(_0x38a430[_0x72aa('0x14')]||0xa)*0x3e8;var _0x2e8e3a,_0x2e7ec6;var _0x16f6c4=seqqueue[_0x72aa('0x15')](_0x3cf223);_0x16f6c4['id']=_0x473ffc;_0x16f6c4[_0x72aa('0x16')]=_0x3cf223;_0x16f6c4[_0x72aa('0x17')]=_0x496844[_0x72aa('0x17')];writeLog(_0x473ffc,_0x127a5a,util[_0x72aa('0x8')](_0x72aa('0x18'),_0x3cf223));_0x56bd19[_0x72aa('0x19')][_0x473ffc]['on'](_0x72aa('0x1a'),function(){logger[_0x72aa('0x7')]('[%s][AGENT]\x20ROUTING\x20STOPPED',_0x473ffc);clearTimeout(_0x2e7ec6);_0x2e7ec6=undefined;_0x16f6c4[_0x72aa('0x1b')]();if(_0x56bd19[_0x72aa('0x19')][_0x473ffc]){delete _0x56bd19[_0x72aa('0x19')][_0x473ffc];}_0x29d1bf[_0x72aa('0x1c')]();});_0x56bd19[_0x72aa('0x19')][_0x473ffc]['on']('complete',function(){if(_0x56bd19[_0x72aa('0x19')][_0x473ffc]){delete _0x56bd19[_0x72aa('0x19')][_0x473ffc];}});_0x2e7ec6=setTimeout(function(){logger[_0x72aa('0x7')](_0x72aa('0x1d'),_0x473ffc);clearTimeout(_0x2e7ec6);_0x16f6c4['close']();_0x29d1bf['next']();},_0x3cf223);strategy['agent'](_0x16f6c4,_0x127a5a,_0x56bd19,_0x496844);}else{logger['error'](_0x72aa('0x1e'),_0x473ffc,_0x38a430[_0x72aa('0x13')]);_0x29d1bf[_0x72aa('0x1c')]();}}}catch(_0x10bc11){console[_0x72aa('0x1f')](_0x10bc11);logger[_0x72aa('0xe')]('[%s][QUEUE]\x20%s',_0x473ffc,_0x10bc11[_0x72aa('0x20')]);_0x29d1bf[_0x72aa('0x1c')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/amazonlex.js b/server/services/routing/server/applications/amazonlex.js index 670a1d2..5d90db5 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 _0x316c=['message','body','amazonlex','providerName','providerResponse','stringify','then','Failed','moment','aws-sdk','./utils','../../../../config/logger','routing','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','consequence','isNil','interaction','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','format','YYYY-MM-DD\x20HH:mm:ss','channel','phone','chat','ChatWebsiteId','account','InteractionId','created','isEmpty','Message','create','catch','error','info','stop','$LATEST','postText'];(function(_0x4cf0b7,_0x560029){var _0x545f10=function(_0x993533){while(--_0x993533){_0x4cf0b7['push'](_0x4cf0b7['shift']());}};_0x545f10(++_0x560029);}(_0x316c,0x1a2));var _0xc316=function(_0x340eb2,_0x3184c6){_0x340eb2=_0x340eb2-0x0;var _0x1c0a6b=_0x316c[_0x340eb2];return _0x1c0a6b;};'use strict';var _=require('lodash');var moment=require(_0xc316('0x0'));var AWS=require(_0xc316('0x1'));var utils=require(_0xc316('0x2'));var logger=require(_0xc316('0x3'))(_0xc316('0x4'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0xc316('0x5')),'mailMessage':require(_0xc316('0x6')),'smsMessage':require(_0xc316('0x7')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0xc316('0x8'))};exports[_0xc316('0x9')]=function(_0x3a93b2,_0xf65cc9){return function(_0xf60c5a){try{if(!_[_0xc316('0xa')](this[_0xc316('0xb')]['UserId'])){logger['info'](_0xc316('0xc'),_0x3a93b2,_0xc316('0xd'));return _0xf60c5a[_0xc316('0xe')]();}var _0x1ad9d8={'ContactId':this['contact']['id'],'sentAt':moment()[_0xc316('0xf')](_0xc316('0x10')),'direction':'out'};if(this[_0xc316('0x11')]==='sms'||this['channel']==='whatsapp'){_0x1ad9d8['phone']=this['interaction'][_0xc316('0x12')];}var _0x5a0cc8=this[_0xc316('0x11')];if(_0x5a0cc8===_0xc316('0x13')){_0x1ad9d8[_0xc316('0x14')]=this[_0xc316('0x15')]['id'];}else{_0x1ad9d8[_['upperFirst'](_0x5a0cc8)+'AccountId']=this['account']['id'];}_0x1ad9d8[_['upperFirst'](_0x5a0cc8)+_0xc316('0x16')]=this[_0xc316('0xb')]['id'];if(this[_0xc316('0xb')][_0xc316('0x17')]){var _0x471021=_0xf65cc9[0x4];if(!_[_0xc316('0x18')](_0x471021)){_0x1ad9d8['body']=utils['getMustacheRender'](_0x471021,this);return rpc[_0x5a0cc8+_0xc316('0x19')][_0xc316('0x1a')](_0x1ad9d8)['then'](function(_0x283549){logger['info'](_0xc316('0xc'),_0x3a93b2,_0x1ad9d8['body']);})[_0xc316('0x1b')](function(_0x5b6e47){logger[_0xc316('0x1c')](_0xc316('0xc'),_0x3a93b2,JSON['stringify'](_0x5b6e47));})['finally'](function(){logger[_0xc316('0x1d')]('[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x3a93b2);_0xf60c5a[_0xc316('0x1e')]();});}else{logger[_0xc316('0x1d')]('[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x3a93b2);_0xf60c5a['stop']();}}else{var _0x3c8ebc=this;var _0x5da1d7=new AWS['LexRuntime']({'accessKeyId':_0xf65cc9[0x0],'secretAccessKey':_0xf65cc9[0x1],'region':_0xf65cc9[0x2]});var _0x4abd4={'botAlias':_0xc316('0x1f'),'botName':_0xf65cc9[0x3],'inputText':this['message']['body'],'userId':this[_0xc316('0x11')]+':'+this['interaction']['id']['toString']()};_0x5da1d7[_0xc316('0x20')](_0x4abd4,function(_0x138a5c,_0x5abfde){if(_0x138a5c){logger[_0xc316('0x1c')](_0xc316('0xc'),_0x3a93b2,_0x138a5c[_0xc316('0x21')]);_0xf60c5a[_0xc316('0xe')]();}else if(_0x5abfde&&_0x5abfde[_0xc316('0x21')]){_0x3c8ebc[_0xc316('0x22')][_0xc316('0x23')]=_0x5abfde;_0x1ad9d8[_0xc316('0x22')]=_0x5abfde[_0xc316('0x21')];_0x1ad9d8[_0xc316('0x24')]=_0xc316('0x23');_0x1ad9d8[_0xc316('0x25')]=JSON[_0xc316('0x26')](_0x5abfde);return rpc[_0x5a0cc8+_0xc316('0x19')][_0xc316('0x1a')](_0x1ad9d8)[_0xc316('0x27')](function(_0x28ddc3){logger[_0xc316('0x1d')](_0xc316('0xc'),_0x3a93b2,_0x1ad9d8[_0xc316('0x22')]);if(_0x5abfde['dialogState']==_0xc316('0x28')){_0xf60c5a[_0xc316('0xe')]();}else{_0xf60c5a[_0xc316('0x1e')]();}})[_0xc316('0x1b')](function(_0x10ccf0){logger['error'](_0xc316('0xc'),_0x3a93b2,JSON[_0xc316('0x26')](_0x10ccf0));_0xf60c5a['next']();});}else{_0xf60c5a[_0xc316('0xe')]();}});}}catch(_0x1309aa){logger[_0xc316('0x1c')](_0xc316('0xc'),_0x3a93b2,JSON['stringify'](_0x1309aa));_0xf60c5a['stop']();}};}; \ No newline at end of file +var _0x68a6=['LexRuntime','$LATEST','message','amazonlex','providerName','providerResponse','stringify','dialogState','next','lodash','moment','aws-sdk','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','consequence','isNil','UserId','info','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','format','out','channel','sms','whatsapp','phone','interaction','ChatWebsiteId','upperFirst','AccountId','InteractionId','created','isEmpty','body','getMustacheRender','Message','create','then','catch','error','finally','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop'];(function(_0x33f257,_0x1e0ad1){var _0x327566=function(_0x4c1b5f){while(--_0x4c1b5f){_0x33f257['push'](_0x33f257['shift']());}};_0x327566(++_0x1e0ad1);}(_0x68a6,0x67));var _0x668a=function(_0x2d63a5,_0x433cdc){_0x2d63a5=_0x2d63a5-0x0;var _0x576ac1=_0x68a6[_0x2d63a5];return _0x576ac1;};'use strict';var _=require(_0x668a('0x0'));var moment=require(_0x668a('0x1'));var AWS=require(_0x668a('0x2'));var utils=require('./utils');var logger=require(_0x668a('0x3'))(_0x668a('0x4'));var rpc={'chatMessage':require(_0x668a('0x5')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x668a('0x6')),'smsMessage':require(_0x668a('0x7')),'faxMessage':require(_0x668a('0x8')),'whatsappMessage':require('../../rpc/whatsappMessage')};exports[_0x668a('0x9')]=function(_0x5d17d2,_0x22e2fc){return function(_0x5309aa){try{if(!_[_0x668a('0xa')](this['interaction'][_0x668a('0xb')])){logger[_0x668a('0xc')](_0x668a('0xd'),_0x5d17d2,_0x668a('0xe'));return _0x5309aa['next']();}var _0xafb44b={'ContactId':this['contact']['id'],'sentAt':moment()[_0x668a('0xf')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0x668a('0x10')};if(this[_0x668a('0x11')]===_0x668a('0x12')||this[_0x668a('0x11')]===_0x668a('0x13')){_0xafb44b[_0x668a('0x14')]=this[_0x668a('0x15')][_0x668a('0x14')];}var _0x4759f2=this['channel'];if(_0x4759f2==='chat'){_0xafb44b[_0x668a('0x16')]=this['account']['id'];}else{_0xafb44b[_[_0x668a('0x17')](_0x4759f2)+_0x668a('0x18')]=this['account']['id'];}_0xafb44b[_[_0x668a('0x17')](_0x4759f2)+_0x668a('0x19')]=this['interaction']['id'];if(this[_0x668a('0x15')][_0x668a('0x1a')]){var _0x440800=_0x22e2fc[0x4];if(!_[_0x668a('0x1b')](_0x440800)){_0xafb44b[_0x668a('0x1c')]=utils[_0x668a('0x1d')](_0x440800,this);return rpc[_0x4759f2+_0x668a('0x1e')][_0x668a('0x1f')](_0xafb44b)[_0x668a('0x20')](function(_0x169f19){logger[_0x668a('0xc')](_0x668a('0xd'),_0x5d17d2,_0xafb44b['body']);})[_0x668a('0x21')](function(_0x598f8c){logger[_0x668a('0x22')]('[%s][AMAZONLEX]\x20%s',_0x5d17d2,JSON['stringify'](_0x598f8c));})[_0x668a('0x23')](function(){logger[_0x668a('0xc')](_0x668a('0x24'),_0x5d17d2);_0x5309aa[_0x668a('0x25')]();});}else{logger[_0x668a('0xc')]('[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x5d17d2);_0x5309aa[_0x668a('0x25')]();}}else{var _0x19c078=this;var _0x492872=new AWS[(_0x668a('0x26'))]({'accessKeyId':_0x22e2fc[0x0],'secretAccessKey':_0x22e2fc[0x1],'region':_0x22e2fc[0x2]});var _0x3a1372={'botAlias':_0x668a('0x27'),'botName':_0x22e2fc[0x3],'inputText':this['message']['body'],'userId':this[_0x668a('0x11')]+':'+this['interaction']['id']['toString']()};_0x492872['postText'](_0x3a1372,function(_0x51d027,_0x3714ff){if(_0x51d027){logger[_0x668a('0x22')](_0x668a('0xd'),_0x5d17d2,_0x51d027[_0x668a('0x28')]);_0x5309aa['next']();}else if(_0x3714ff&&_0x3714ff[_0x668a('0x28')]){_0x19c078[_0x668a('0x1c')][_0x668a('0x29')]=_0x3714ff;_0xafb44b[_0x668a('0x1c')]=_0x3714ff[_0x668a('0x28')];_0xafb44b[_0x668a('0x2a')]=_0x668a('0x29');_0xafb44b[_0x668a('0x2b')]=JSON[_0x668a('0x2c')](_0x3714ff);return rpc[_0x4759f2+_0x668a('0x1e')][_0x668a('0x1f')](_0xafb44b)[_0x668a('0x20')](function(_0x2d7ec3){logger[_0x668a('0xc')]('[%s][AMAZONLEX]\x20%s',_0x5d17d2,_0xafb44b[_0x668a('0x1c')]);if(_0x3714ff[_0x668a('0x2d')]=='Failed'){_0x5309aa[_0x668a('0x2e')]();}else{_0x5309aa[_0x668a('0x25')]();}})['catch'](function(_0x5a8cf9){logger[_0x668a('0x22')](_0x668a('0xd'),_0x5d17d2,JSON[_0x668a('0x2c')](_0x5a8cf9));_0x5309aa[_0x668a('0x2e')]();});}else{_0x5309aa[_0x668a('0x2e')]();}});}}catch(_0x4567e0){logger[_0x668a('0x22')](_0x668a('0xd'),_0x5d17d2,JSON[_0x668a('0x2c')](_0x4567e0));_0x5309aa['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/autoreply.js b/server/services/routing/server/applications/autoreply.js index 8e122b0..829c1e6 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 _0xbf92=['','headers','auto-replied','All','auto_reply','sendMailMessage','then','[%s][AUTOREPLY]\x20SMTP\x20SENT','Message','stringify','catch','error','[RPC][%s][AUTOREPLY]\x20%s','resolve','Interaction','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','create','stop','lodash','moment','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../mailRpc','consequence','channel','body','isAutoreply','info','next','isNil','created','interaction','[%s][AUTOREPLY]\x20%s','Autoreply\x20already\x20sent','autoreplyExecuted','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','message','from','read','subject','startsWith','Re:','Re:\x20','chat','account','upperFirst','AccountId','mail','service','Smtp','host','port','secure','authentication','auth','pass','inReplyTo','messageId','html','','replace','','replace','','headers','auto-replied','then','[%s][AUTOREPLY]\x20SMTP\x20SENT','messageId','stringify','resolve','update','catch','error','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','create','Interaction','lodash','moment'];(function(_0x30764b,_0x4b85d5){var _0x4153d1=function(_0x338bff){while(--_0x338bff){_0x30764b['push'](_0x30764b['shift']());}};_0x4153d1(++_0x4b85d5);}(_0x1ff5,0x15c));var _0x51ff=function(_0x5d5a16,_0xd9d6bb){_0x5d5a16=_0x5d5a16-0x0;var _0x58e7fe=_0x1ff5[_0x5d5a16];return _0x58e7fe;};'use strict';var _=require(_0x51ff('0x0'));var moment=require(_0x51ff('0x1'));var utils=require(_0x51ff('0x2'));var logger=require('../../../../config/logger')(_0x51ff('0x3'));var rpc={'chatMessage':require(_0x51ff('0x4')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x51ff('0x5')),'smsMessage':require(_0x51ff('0x6')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0x51ff('0x7')),'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require(_0x51ff('0x8')),'mailInteraction':require('../../rpc/mailInteraction'),'smsInteraction':require(_0x51ff('0x9')),'faxInteraction':require(_0x51ff('0xa')),'whatsappInteraction':require(_0x51ff('0xb'))};var mailRpc=require('../../mailRpc');exports[_0x51ff('0xc')]=function(_0xcaf9f4,_0x1ced0b,_0x34faf5,_0x542dae){return function(_0x5129bb){try{var _0x8b12=this[_0x51ff('0xd')];if(_0x8b12===_0x51ff('0xe')&&_0x542dae[_0x51ff('0xf')][_0x51ff('0x10')]){logger['info']('[%s][AUTOREPLY]\x20%s',_0xcaf9f4,'Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)');return _0x5129bb[_0x51ff('0x11')]();}if(_0x1ced0b[0x0]==='1'&&(_[_0x51ff('0x12')](this[_0x51ff('0x13')][_0x51ff('0x14')])||!this[_0x51ff('0x13')][_0x51ff('0x14')])){logger[_0x51ff('0x15')](_0x51ff('0x16'),_0xcaf9f4,_0x51ff('0x17'));return _0x5129bb[_0x51ff('0x11')]();}if(_0x1ced0b[0x0]==='2'&&this['interaction'][_0x51ff('0x18')]){logger[_0x51ff('0x15')](_0x51ff('0x19'),_0xcaf9f4,'One\x20Time\x20already\x20sent');return _0x5129bb[_0x51ff('0x11')]();}var _0x241b51={'ContactId':this[_0x51ff('0x1a')]['id'],'sentAt':moment()[_0x51ff('0x1b')](_0x51ff('0x1c')),'direction':_0x51ff('0x1d')};if(this[_0x51ff('0xd')]===_0x51ff('0xe')){_0x241b51[_0x51ff('0xf')]=utils['getMustacheRender'](_0x1ced0b[0x2],this);}else{_0x241b51[_0x51ff('0xf')]=utils[_0x51ff('0x1e')](_0x1ced0b[0x1],this);}if(this['message']){_0x241b51['to']=this[_0x51ff('0x1f')][_0x51ff('0x20')]||'';if(this[_0x51ff('0xd')]===_0x51ff('0xe')&&_0x1ced0b[0x1]==='1'){_0x241b51['cc']=this[_0x51ff('0x1f')]['cc']||'';}_0x241b51[_0x51ff('0x20')]=this[_0x51ff('0x1f')]['to']||'';_0x241b51[_0x51ff('0x21')]=this[_0x51ff('0x1f')][_0x51ff('0x21')]||'';_0x241b51[_0x51ff('0x22')]=!![];if(this[_0x51ff('0x1f')][_0x51ff('0x23')]){_0x241b51[_0x51ff('0x23')]='';_0x241b51[_0x51ff('0x23')]+=_['startsWith'](this['message'][_0x51ff('0x23')],'Re:')?'':'Re:\x20';_0x241b51[_0x51ff('0x23')]+=this[_0x51ff('0x1f')][_0x51ff('0x23')];}}if(this['channel']===_0x51ff('0x24')){_0x241b51['ChatWebsiteId']=this[_0x51ff('0x25')]['id'];}else{_0x241b51[_[_0x51ff('0x26')](this[_0x51ff('0xd')])+_0x51ff('0x27')]=this[_0x51ff('0x25')]['id'];}_0x241b51[_[_0x51ff('0x26')](this[_0x51ff('0xd')])+_0x51ff('0x28')]=this[_0x51ff('0x13')]['id'];var _0x2a9b68=this[_0x51ff('0x13')];if(rpc[this[_0x51ff('0xd')]+_0x51ff('0x29')]){if(this['channel']===_0x51ff('0xe')){var _0xb58431={'tls':{'rejectUnauthorized':![]}};if(this['account'][_0x51ff('0x2a')][_0x51ff('0x2b')]){_0xb58431['service']=this[_0x51ff('0x25')]['Smtp']['service'];}else{_0xb58431['host']=this[_0x51ff('0x25')][_0x51ff('0x2a')][_0x51ff('0x2c')];_0xb58431[_0x51ff('0x2d')]=this[_0x51ff('0x25')]['Smtp'][_0x51ff('0x2d')];_0xb58431[_0x51ff('0x2e')]=this[_0x51ff('0x25')][_0x51ff('0x2a')][_0x51ff('0x2e')];}if(this['account']['Smtp']['authentication']){_0xb58431[_0x51ff('0x2f')]={'user':this['account'][_0x51ff('0x2a')][_0x51ff('0x30')],'pass':this[_0x51ff('0x25')]['Smtp'][_0x51ff('0x31')]};}_0x241b51[_0x51ff('0x32')]=this[_0x51ff('0x1f')]['messageId'];_0x241b51[_0x51ff('0x33')]=_0x51ff('0x34')+_[_0x51ff('0x35')](_0x241b51[_0x51ff('0xf')],_0x51ff('0x36'),_0x51ff('0x37'))+_0x51ff('0x38');_0x241b51[_0x51ff('0x39')]={'Auto-Submitted':_0x51ff('0x3a'),'X-Auto-Response-Suppress':'All','Precedence':'auto_reply'};return mailRpc['sendMailMessage'](_0xb58431,_0x241b51)[_0x51ff('0x3b')](function(_0x1eb9f2){logger['info'](_0x51ff('0x3c'),_0xcaf9f4);_0x241b51['messageId']=_0x1eb9f2[_0x51ff('0x1f')][_0x51ff('0x3d')];return rpc[_0x8b12+_0x51ff('0x29')]['create'](_0x241b51);})['then'](function(_0x596982){logger[_0x51ff('0x15')](_0x51ff('0x16'),_0xcaf9f4,JSON[_0x51ff('0x3e')](_0x596982));})['catch'](function(_0x2e7d52){logger['error']('[RPC][%s][AUTOREPLY]\x20%s',_0xcaf9f4,JSON['stringify'](_0x2e7d52));})['finally'](function(){Promise[_0x51ff('0x3f')]()['then'](function(){if(_0x1ced0b[0x0]!=='2'||_0x2a9b68[_0x51ff('0x18')])return;return rpc[_0x8b12+'Interaction'][_0x51ff('0x40')](_0x2a9b68['id'],{'autoreplyExecuted':!![]})[_0x51ff('0x3b')](function(_0x3cc57a){logger[_0x51ff('0x15')]('[%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0xcaf9f4,JSON[_0x51ff('0x3e')](_0x3cc57a));})[_0x51ff('0x41')](function(_0x1996b2){logger[_0x51ff('0x42')](_0x51ff('0x43'),_0xcaf9f4,JSON[_0x51ff('0x3e')](_0x1996b2));});})[_0x51ff('0x3b')](function(){_0x5129bb['next']();});});}else{return rpc[this['channel']+_0x51ff('0x29')][_0x51ff('0x44')](_0x241b51)[_0x51ff('0x3b')](function(_0x360f13){logger[_0x51ff('0x15')]('[%s][AUTOREPLY]\x20%s',_0xcaf9f4,_0x241b51[_0x51ff('0xf')]);})[_0x51ff('0x41')](function(_0x872367){logger[_0x51ff('0x42')]('[%s][AUTOREPLY]\x20%s',_0xcaf9f4,JSON['stringify'](_0x872367));})['finally'](function(){Promise[_0x51ff('0x3f')]()[_0x51ff('0x3b')](function(){if(_0x1ced0b[0x0]!=='2'||_0x2a9b68[_0x51ff('0x18')])return;return rpc[_0x8b12+_0x51ff('0x45')][_0x51ff('0x40')](_0x2a9b68['id'],{'autoreplyExecuted':!![]})['then'](function(_0x3fd234){logger['info']('[%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0xcaf9f4,JSON['stringify'](_0x3fd234));})[_0x51ff('0x41')](function(_0xfbabb){logger['error'](_0x51ff('0x43'),_0xcaf9f4,JSON[_0x51ff('0x3e')](_0xfbabb));});})['then'](function(){_0x5129bb[_0x51ff('0x11')]();});});}}}catch(_0xe39a04){logger[_0x51ff('0x42')](_0x51ff('0x16'),_0xcaf9f4,JSON[_0x51ff('0x3e')](_0xe39a04));_0x5129bb['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/close.js b/server/services/routing/server/applications/close.js index 3c51be6..f319965 100644 --- a/server/services/routing/server/applications/close.js +++ b/server/services/routing/server/applications/close.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9642=['channel','Interaction','update','interaction','then','catch','error','[%s][CLOSE]\x20%s','finally','stop','moment','../../../../config/logger','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','info','[%s][CLOSE]\x20reason\x20%s','format','system'];(function(_0xf245cd,_0x313b67){var _0xbc6aeb=function(_0x467ae0){while(--_0x467ae0){_0xf245cd['push'](_0xf245cd['shift']());}};_0xbc6aeb(++_0x313b67);}(_0x9642,0x1d8));var _0x2964=function(_0x386835,_0x39bcbd){_0x386835=_0x386835-0x0;var _0x47835c=_0x9642[_0x386835];return _0x47835c;};'use strict';var moment=require(_0x2964('0x0'));var logger=require(_0x2964('0x1'))('routing');var rpc={'chatInteraction':require(_0x2964('0x2')),'openchannelInteraction':require(_0x2964('0x3')),'smsInteraction':require(_0x2964('0x4')),'mailInteraction':require(_0x2964('0x5')),'faxInteraction':require(_0x2964('0x6')),'whatsappInteraction':require(_0x2964('0x7'))};exports['consequence']=function(_0x4c0fce,_0x2a1c01,_0x385653,_0x4edb71){return function(_0x3b8fe0){try{logger[_0x2964('0x8')](_0x2964('0x9'),_0x4c0fce,_0x2a1c01[0x0]);var _0x2f4bd2={'closed':0x1,'closedAt':moment()[_0x2964('0xa')]('YYYY-MM-DD\x20HH:mm:ss'),'closeReason':_0x2964('0xb'),'disposition':_0x2a1c01[0x0]};if(rpc[_0x4edb71[_0x2964('0xc')]+_0x2964('0xd')]){rpc[_0x4edb71[_0x2964('0xc')]+_0x2964('0xd')][_0x2964('0xe')](_0x4edb71[_0x2964('0xf')]['id'],_0x2f4bd2)[_0x2964('0x10')](function(_0x9e6ed0){logger[_0x2964('0x8')]('[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!',_0x4c0fce,_0x4edb71[_0x2964('0xf')]['id']);})[_0x2964('0x11')](function(_0x1c9213){logger[_0x2964('0x12')](_0x2964('0x13'),_0x4c0fce,JSON['stringify'](_0x1c9213));})[_0x2964('0x14')](function(){_0x3b8fe0[_0x2964('0x15')]();});}}catch(_0x5975ef){logger[_0x2964('0x12')](_0x2964('0x13'),_0x4c0fce,JSON['stringify'](_0x5975ef));_0x3b8fe0[_0x2964('0x15')]();}};}; \ No newline at end of file +var _0x8d3d=['../../rpc/chatInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','consequence','info','[%s][CLOSE]\x20reason\x20%s','YYYY-MM-DD\x20HH:mm:ss','system','channel','Interaction','interaction','error','stringify','finally','stop','moment','../../../../config/logger'];(function(_0x1cf63c,_0xfdfeea){var _0x5dcc26=function(_0x15154b){while(--_0x15154b){_0x1cf63c['push'](_0x1cf63c['shift']());}};_0x5dcc26(++_0xfdfeea);}(_0x8d3d,0x8e));var _0xd8d3=function(_0x3246d9,_0x44bd95){_0x3246d9=_0x3246d9-0x0;var _0x3066c2=_0x8d3d[_0x3246d9];return _0x3066c2;};'use strict';var moment=require(_0xd8d3('0x0'));var logger=require(_0xd8d3('0x1'))('routing');var rpc={'chatInteraction':require(_0xd8d3('0x2')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'smsInteraction':require(_0xd8d3('0x3')),'mailInteraction':require(_0xd8d3('0x4')),'faxInteraction':require(_0xd8d3('0x5')),'whatsappInteraction':require('../../rpc/whatsappInteraction')};exports[_0xd8d3('0x6')]=function(_0x2f9360,_0x1ecb7f,_0xd652b2,_0x4d41b3){return function(_0x19af0b){try{logger[_0xd8d3('0x7')](_0xd8d3('0x8'),_0x2f9360,_0x1ecb7f[0x0]);var _0x41f175={'closed':0x1,'closedAt':moment()['format'](_0xd8d3('0x9')),'closeReason':_0xd8d3('0xa'),'disposition':_0x1ecb7f[0x0]};if(rpc[_0x4d41b3[_0xd8d3('0xb')]+_0xd8d3('0xc')]){rpc[_0x4d41b3['channel']+_0xd8d3('0xc')]['update'](_0x4d41b3['interaction']['id'],_0x41f175)['then'](function(_0x475a73){logger['info']('[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!',_0x2f9360,_0x4d41b3[_0xd8d3('0xd')]['id']);})['catch'](function(_0x374424){logger[_0xd8d3('0xe')]('[%s][CLOSE]\x20%s',_0x2f9360,JSON[_0xd8d3('0xf')](_0x374424));})[_0xd8d3('0x10')](function(){_0x19af0b[_0xd8d3('0x11')]();});}}catch(_0x27acc2){logger['error']('[%s][CLOSE]\x20%s',_0x2f9360,JSON[_0xd8d3('0xf')](_0x27acc2));_0x19af0b[_0xd8d3('0x11')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/dialogflow.js b/server/services/routing/server/applications/dialogflow.js index dbc8d41..c50fca2 100644 --- a/server/services/routing/server/applications/dialogflow.js +++ b/server/services/routing/server/applications/dialogflow.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5d59=['info','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','phone','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','isEmpty','getMustacheRender','Message','then','[%s][DIALOGFLOW]\x20%s','body','catch','error','stringify','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','textRequest','dialogflow','result','fulfillment','providerName','providerResponse','create','metadata','endConversation','message','moment','apiai-promise','md5','./utils','../../../../config/logger','routing','../../rpc/openchannelMessage','../../rpc/faxMessage','interaction'];(function(_0x56b198,_0xf35778){var _0x4ceeae=function(_0x3670b7){while(--_0x3670b7){_0x56b198['push'](_0x56b198['shift']());}};_0x4ceeae(++_0xf35778);}(_0x5d59,0x15f));var _0x95d5=function(_0x32cfed,_0x278ecd){_0x32cfed=_0x32cfed-0x0;var _0x5735e9=_0x5d59[_0x32cfed];return _0x5735e9;};'use strict';var _=require('lodash');var moment=require(_0x95d5('0x0'));var apiai=require(_0x95d5('0x1'));var md5=require(_0x95d5('0x2'));var utils=require(_0x95d5('0x3'));var logger=require(_0x95d5('0x4'))(_0x95d5('0x5'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x95d5('0x6')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0x95d5('0x7')),'whatsappMessage':require('../../rpc/whatsappMessage')};exports['consequence']=function(_0xfe94c,_0x11b2d4){return function(_0x121537){try{if(!_['isNil'](this[_0x95d5('0x8')]['UserId'])){logger[_0x95d5('0x9')]('[%s][DIALOGFLOW]\x20%s',_0xfe94c,_0x95d5('0xa'));return _0x121537[_0x95d5('0xb')]();}var _0x3a9f4e={'ContactId':this[_0x95d5('0xc')]['id'],'sentAt':moment()[_0x95d5('0xd')](_0x95d5('0xe')),'direction':_0x95d5('0xf')};if(this[_0x95d5('0x10')]==='sms'||this[_0x95d5('0x10')]==='whatsapp'){_0x3a9f4e['phone']=this[_0x95d5('0x8')][_0x95d5('0x11')];}var _0x2af6ca=this[_0x95d5('0x10')];if(_0x2af6ca==='chat'){_0x3a9f4e[_0x95d5('0x12')]=this[_0x95d5('0x13')]['id'];}else{_0x3a9f4e[_[_0x95d5('0x14')](_0x2af6ca)+_0x95d5('0x15')]=this[_0x95d5('0x13')]['id'];}_0x3a9f4e[_[_0x95d5('0x14')](_0x2af6ca)+_0x95d5('0x16')]=this[_0x95d5('0x8')]['id'];if(this[_0x95d5('0x8')]['created']){var _0x501dcb=_0x11b2d4[0x2];if(!_[_0x95d5('0x17')](_0x501dcb)){_0x3a9f4e['body']=utils[_0x95d5('0x18')](_0x501dcb,this);return rpc[_0x2af6ca+_0x95d5('0x19')]['create'](_0x3a9f4e)[_0x95d5('0x1a')](function(_0x3793eb){logger[_0x95d5('0x9')](_0x95d5('0x1b'),_0xfe94c,_0x3a9f4e[_0x95d5('0x1c')]);})[_0x95d5('0x1d')](function(_0x4acfbb){logger[_0x95d5('0x1e')](_0x95d5('0x1b'),_0xfe94c,JSON[_0x95d5('0x1f')](_0x4acfbb));})['finally'](function(){logger['info'](_0x95d5('0x20'),_0xfe94c);_0x121537[_0x95d5('0x21')]();});}else{logger['info'](_0x95d5('0x22'),_0xfe94c);_0x121537[_0x95d5('0x21')]();}}else{var _0x2ca4b6=this;var _0x51ba73=apiai(_0x11b2d4[0x0],{'language':_0x11b2d4[0x1]||'en'});return _0x51ba73[_0x95d5('0x23')](this['message']['body'],{'sessionId':md5(this['interaction']['id'])})['then'](function(_0x588825){_0x2ca4b6['body'][_0x95d5('0x24')]=_0x588825;_0x3a9f4e[_0x95d5('0x1c')]=_0x588825[_0x95d5('0x25')][_0x95d5('0x26')]['speech'];_0x3a9f4e[_0x95d5('0x27')]=_0x95d5('0x24');_0x3a9f4e[_0x95d5('0x28')]=JSON[_0x95d5('0x1f')](_0x588825);return rpc[_0x2af6ca+_0x95d5('0x19')][_0x95d5('0x29')](_0x3a9f4e)[_0x95d5('0x1a')](function(_0x1e6ee7){logger[_0x95d5('0x9')](_0x95d5('0x1b'),_0xfe94c,_0x3a9f4e['body']);if(_0x588825['result'][_0x95d5('0x2a')][_0x95d5('0x2b')]){_0x121537[_0x95d5('0xb')]();}else{_0x121537['stop']();}})[_0x95d5('0x1d')](function(_0x4e6f3b){logger[_0x95d5('0x1e')]('[%s][DIALOGFLOW]\x20%s',_0xfe94c,JSON[_0x95d5('0x1f')](_0x4e6f3b));_0x121537[_0x95d5('0xb')]();});})[_0x95d5('0x1d')](function(_0x21d4ff){logger[_0x95d5('0x1e')](_0x95d5('0x1b'),_0xfe94c,_0x21d4ff[_0x95d5('0x2c')]);_0x121537[_0x95d5('0xb')]();});}}catch(_0x561c75){logger['error']('[%s][DIALOGFLOW]\x20%s',_0xfe94c,JSON[_0x95d5('0x1f')](_0x561c75));_0x121537[_0x95d5('0x21')]();}};}; \ No newline at end of file +var _0xb422=['stringify','metadata','endConversation','error','md5','routing','../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','consequence','isNil','interaction','[%s][DIALOGFLOW]\x20%s','next','contact','format','out','channel','whatsapp','phone','chat','account','upperFirst','AccountId','InteractionId','created','body','getMustacheRender','Message','create','then','info','catch','finally','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','stop','message','dialogflow','result','speech','providerName','providerResponse'];(function(_0x25fcd8,_0x1104f1){var _0x356ddf=function(_0x1fb3f3){while(--_0x1fb3f3){_0x25fcd8['push'](_0x25fcd8['shift']());}};_0x356ddf(++_0x1104f1);}(_0xb422,0x85));var _0x2b42=function(_0x277a8d,_0x8f4900){_0x277a8d=_0x277a8d-0x0;var _0x3e1793=_0xb422[_0x277a8d];return _0x3e1793;};'use strict';var _=require('lodash');var moment=require('moment');var apiai=require('apiai-promise');var md5=require(_0x2b42('0x0'));var utils=require('./utils');var logger=require('../../../../config/logger')(_0x2b42('0x1'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x2b42('0x2')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0x2b42('0x3')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0x2b42('0x4'))};exports[_0x2b42('0x5')]=function(_0x750c2,_0x51b3bd){return function(_0xde9c67){try{if(!_[_0x2b42('0x6')](this[_0x2b42('0x7')]['UserId'])){logger['info'](_0x2b42('0x8'),_0x750c2,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0xde9c67[_0x2b42('0x9')]();}var _0xcc84af={'ContactId':this[_0x2b42('0xa')]['id'],'sentAt':moment()[_0x2b42('0xb')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0x2b42('0xc')};if(this[_0x2b42('0xd')]==='sms'||this[_0x2b42('0xd')]===_0x2b42('0xe')){_0xcc84af[_0x2b42('0xf')]=this[_0x2b42('0x7')]['phone'];}var _0x5054fe=this[_0x2b42('0xd')];if(_0x5054fe===_0x2b42('0x10')){_0xcc84af['ChatWebsiteId']=this[_0x2b42('0x11')]['id'];}else{_0xcc84af[_[_0x2b42('0x12')](_0x5054fe)+_0x2b42('0x13')]=this[_0x2b42('0x11')]['id'];}_0xcc84af[_[_0x2b42('0x12')](_0x5054fe)+_0x2b42('0x14')]=this[_0x2b42('0x7')]['id'];if(this[_0x2b42('0x7')][_0x2b42('0x15')]){var _0x1f7e7a=_0x51b3bd[0x2];if(!_['isEmpty'](_0x1f7e7a)){_0xcc84af[_0x2b42('0x16')]=utils[_0x2b42('0x17')](_0x1f7e7a,this);return rpc[_0x5054fe+_0x2b42('0x18')][_0x2b42('0x19')](_0xcc84af)[_0x2b42('0x1a')](function(_0x3ab83c){logger[_0x2b42('0x1b')](_0x2b42('0x8'),_0x750c2,_0xcc84af['body']);})[_0x2b42('0x1c')](function(_0x27d80a){logger['error'](_0x2b42('0x8'),_0x750c2,JSON['stringify'](_0x27d80a));})[_0x2b42('0x1d')](function(){logger[_0x2b42('0x1b')](_0x2b42('0x1e'),_0x750c2);_0xde9c67['stop']();});}else{logger['info'](_0x2b42('0x1f'),_0x750c2);_0xde9c67[_0x2b42('0x20')]();}}else{var _0x24ac96=this;var _0x2ee957=apiai(_0x51b3bd[0x0],{'language':_0x51b3bd[0x1]||'en'});return _0x2ee957['textRequest'](this[_0x2b42('0x21')][_0x2b42('0x16')],{'sessionId':md5(this['interaction']['id'])})[_0x2b42('0x1a')](function(_0x2e9aa1){_0x24ac96[_0x2b42('0x16')][_0x2b42('0x22')]=_0x2e9aa1;_0xcc84af[_0x2b42('0x16')]=_0x2e9aa1[_0x2b42('0x23')]['fulfillment'][_0x2b42('0x24')];_0xcc84af[_0x2b42('0x25')]=_0x2b42('0x22');_0xcc84af[_0x2b42('0x26')]=JSON[_0x2b42('0x27')](_0x2e9aa1);return rpc[_0x5054fe+_0x2b42('0x18')][_0x2b42('0x19')](_0xcc84af)[_0x2b42('0x1a')](function(_0x2db5d7){logger[_0x2b42('0x1b')](_0x2b42('0x8'),_0x750c2,_0xcc84af['body']);if(_0x2e9aa1['result'][_0x2b42('0x28')][_0x2b42('0x29')]){_0xde9c67[_0x2b42('0x9')]();}else{_0xde9c67[_0x2b42('0x20')]();}})['catch'](function(_0x286223){logger[_0x2b42('0x2a')](_0x2b42('0x8'),_0x750c2,JSON['stringify'](_0x286223));_0xde9c67['next']();});})[_0x2b42('0x1c')](function(_0x15298d){logger[_0x2b42('0x2a')](_0x2b42('0x8'),_0x750c2,_0x15298d['message']);_0xde9c67[_0x2b42('0x9')]();});}}catch(_0x38148e){logger[_0x2b42('0x2a')]('[%s][DIALOGFLOW]\x20%s',_0x750c2,JSON[_0x2b42('0x27')](_0x38148e));_0xde9c67[_0x2b42('0x20')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/dialogflowV2.js b/server/services/routing/server/applications/dialogflowV2.js index 8a617dc..10d420b 100644 --- a/server/services/routing/server/applications/dialogflowV2.js +++ b/server/services/routing/server/applications/dialogflowV2.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xba1e=['AccountId','InteractionId','created','isEmpty','Message','create','stringify','finally','stop','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','replace','SessionsClient','sessionPath','dialogflowV2','queryResult','diagnosticInfo','fields','end_conversation','DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT','allRequiredParamsPresent','DIALOGFLOWV2_ENDCONVERSATION','boolValue','DIALOGFLOWV2_INTENTNAME','intent','name','DIALOGFLOWV2_INTENTDISPLAYNAME','DIALOGFLOWV2_ISFALLBACKINTENT','languageCode','DIALOGFLOWV2_QUERYTEXT','queryText','DIALOGFLOWV2_SCORE','intentDetectionConfidence','providerName','providerResponse','length','push','fulfillmentText','all','message','lodash','dialogflow','md5','moment','bluebird','../../../../config/logger','routing','./utils','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','clone','body','then','info','[%s][DIALOGFLOWV2]\x20%s','catch','error','consequence','isNil','interaction','UserId','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','phone','ChatWebsiteId','account'];(function(_0x5e57da,_0x5ad9a5){var _0xc7ce65=function(_0x105a39){while(--_0x105a39){_0x5e57da['push'](_0x5e57da['shift']());}};_0xc7ce65(++_0x5ad9a5);}(_0xba1e,0xb9));var _0xeba1=function(_0x3856b0,_0x7753c2){_0x3856b0=_0x3856b0-0x0;var _0x2670c4=_0xba1e[_0x3856b0];return _0x2670c4;};'use strict';var _=require(_0xeba1('0x0'));var dialogflow=require(_0xeba1('0x1'));var md5=require(_0xeba1('0x2'));var moment=require(_0xeba1('0x3'));var Promise=require(_0xeba1('0x4'));var logger=require(_0xeba1('0x5'))(_0xeba1('0x6'));var utils=require(_0xeba1('0x7'));var rpc={'chatMessage':require(_0xeba1('0x8')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0xeba1('0x9')),'smsMessage':require(_0xeba1('0xa')),'faxMessage':require(_0xeba1('0xb')),'whatsappMessage':require(_0xeba1('0xc'))};function createMessage(_0x141958,_0x1457d1,_0x18d0d8,_0x2f108f){return new Promise(function(_0x44d226,_0x26542e){var _0x22f44f=_[_0xeba1('0xd')](_0x18d0d8);_0x22f44f[_0xeba1('0xe')]=_0x2f108f;return rpc[_0x1457d1+'Message']['create'](_0x22f44f)[_0xeba1('0xf')](function(){logger[_0xeba1('0x10')](_0xeba1('0x11'),_0x141958,_0x22f44f[_0xeba1('0xe')]);_0x44d226();})[_0xeba1('0x12')](function(_0x21496c){logger[_0xeba1('0x13')](_0xeba1('0x11'),_0x141958,JSON['stringify'](_0x21496c));_0x26542e(_0x21496c);});});}exports[_0xeba1('0x14')]=function(_0x1c3249,_0x363ec7){return function(_0x50226f){try{if(!_[_0xeba1('0x15')](this[_0xeba1('0x16')][_0xeba1('0x17')])){logger[_0xeba1('0x10')](_0xeba1('0x11'),_0x1c3249,_0xeba1('0x18'));return _0x50226f[_0xeba1('0x19')]();}var _0x551d5b={'ContactId':this[_0xeba1('0x1a')]['id'],'sentAt':moment()['format'](_0xeba1('0x1b')),'direction':_0xeba1('0x1c')};if(this[_0xeba1('0x1d')]===_0xeba1('0x1e')||this[_0xeba1('0x1d')]==='whatsapp'){_0x551d5b['phone']=this[_0xeba1('0x16')][_0xeba1('0x1f')];}var _0x9d9e8=this['channel'];if(_0x9d9e8==='chat'){_0x551d5b[_0xeba1('0x20')]=this[_0xeba1('0x21')]['id'];}else{_0x551d5b[_['upperFirst'](_0x9d9e8)+_0xeba1('0x22')]=this['account']['id'];}_0x551d5b[_['upperFirst'](_0x9d9e8)+_0xeba1('0x23')]=this[_0xeba1('0x16')]['id'];if(this[_0xeba1('0x16')][_0xeba1('0x24')]){var _0x41c44c=_0x363ec7[0x4];if(!_[_0xeba1('0x25')](_0x41c44c)){_0x551d5b[_0xeba1('0xe')]=utils['getMustacheRender'](_0x41c44c,this);return rpc[_0x9d9e8+_0xeba1('0x26')][_0xeba1('0x27')](_0x551d5b)[_0xeba1('0xf')](function(_0x2a0064){logger[_0xeba1('0x10')](_0xeba1('0x11'),_0x1c3249,_0x551d5b[_0xeba1('0xe')]);})[_0xeba1('0x12')](function(_0x19b704){logger['error'](_0xeba1('0x11'),_0x1c3249,JSON[_0xeba1('0x28')](_0x19b704));})[_0xeba1('0x29')](function(){logger['info']('[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x1c3249);_0x50226f[_0xeba1('0x2a')]();});}else{logger[_0xeba1('0x10')](_0xeba1('0x2b'),_0x1c3249);_0x50226f[_0xeba1('0x2a')]();}}else{var _0x240444=this;var _0x3bf2de=_0x363ec7[0x2][_0xeba1('0x2c')](/\\n/g,'\x0a');var _0x54721c={'credentials':{'private_key':_0x3bf2de,'client_email':_0x363ec7[0x1]}};var _0x41ffe7=new dialogflow[(_0xeba1('0x2d'))](_0x54721c);var _0xd40e11=_0x41ffe7[_0xeba1('0x2e')](_0x363ec7[0x0],md5(_0x240444[_0xeba1('0x16')]['id']));var _0x2129e8={'session':_0xd40e11,'queryInput':{'text':{'text':_0x240444['message'][_0xeba1('0xe')],'languageCode':_0x363ec7[0x3]||'en'}}};return _0x41ffe7['detectIntent'](_0x2129e8)['then'](function(_0x24acd5){if(_0x24acd5&&_0x24acd5['length']){_0x240444[_0xeba1('0xe')][_0xeba1('0x2f')]=_0x24acd5;var _0x329a27=_0x24acd5[0x0];var _0x84534d=_0x329a27[_0xeba1('0x30')][_0xeba1('0x31')]&&_0x329a27[_0xeba1('0x30')][_0xeba1('0x31')]['fields']?_0x329a27[_0xeba1('0x30')]['diagnosticInfo'][_0xeba1('0x32')][_0xeba1('0x33')]['boolValue']:![];_0x240444[_0xeba1('0xe')]['DIALOGFLOWV2_ACTION']=_0x329a27['queryResult']['action'];_0x240444[_0xeba1('0xe')][_0xeba1('0x34')]=_0x329a27[_0xeba1('0x30')][_0xeba1('0x35')];_0x240444[_0xeba1('0xe')][_0xeba1('0x36')]=_0x329a27[_0xeba1('0x30')][_0xeba1('0x31')]&&_0x329a27['queryResult']['diagnosticInfo'][_0xeba1('0x32')]?_0x329a27[_0xeba1('0x30')]['diagnosticInfo'][_0xeba1('0x32')][_0xeba1('0x33')][_0xeba1('0x37')]:![];_0x240444['body'][_0xeba1('0x38')]=_0x329a27[_0xeba1('0x30')][_0xeba1('0x39')][_0xeba1('0x3a')];_0x240444[_0xeba1('0xe')][_0xeba1('0x3b')]=_0x329a27[_0xeba1('0x30')]['intent']['displayName'];_0x240444[_0xeba1('0xe')][_0xeba1('0x3c')]=_0x329a27['queryResult'][_0xeba1('0x39')]['isFallback'];_0x240444[_0xeba1('0xe')]['DIALOGFLOWV2_LANGUAGECODE']=_0x329a27[_0xeba1('0x30')][_0xeba1('0x3d')];_0x240444[_0xeba1('0xe')][_0xeba1('0x3e')]=_0x329a27[_0xeba1('0x30')][_0xeba1('0x3f')];_0x240444[_0xeba1('0xe')][_0xeba1('0x40')]=_0x329a27['queryResult'][_0xeba1('0x41')];_0x551d5b[_0xeba1('0x42')]=_0xeba1('0x2f');_0x551d5b[_0xeba1('0x43')]=JSON[_0xeba1('0x28')](_0x24acd5);var _0x2ff596=[];for(var _0x512ef1=0x0;_0x512ef1<_0x24acd5[_0xeba1('0x44')];_0x512ef1++){var _0x28de47=_0x24acd5[_0x512ef1];if(_0x28de47&&_0x28de47[_0xeba1('0x30')]&&_0x28de47['queryResult']['fulfillmentText']){_0x2ff596[_0xeba1('0x45')](createMessage(_0x1c3249,_0x9d9e8,_0x551d5b,_0x28de47[_0xeba1('0x30')][_0xeba1('0x46')]));}}return Promise[_0xeba1('0x47')](_0x2ff596)[_0xeba1('0xf')](function(){if(_0x84534d){_0x50226f[_0xeba1('0x19')]();}else{_0x50226f[_0xeba1('0x2a')]();}})[_0xeba1('0x12')](function(_0x5724bb){logger[_0xeba1('0x13')](_0xeba1('0x11'),_0x1c3249,JSON['stringify'](_0x5724bb));_0x50226f[_0xeba1('0x19')]();});}})[_0xeba1('0x12')](function(_0x36ed5f){logger[_0xeba1('0x13')](_0xeba1('0x11'),_0x1c3249,_0x36ed5f[_0xeba1('0x48')]);_0x50226f[_0xeba1('0x19')]();});}}catch(_0xf75b28){logger[_0xeba1('0x13')](_0xeba1('0x11'),_0x1c3249,JSON[_0xeba1('0x28')](_0xf75b28));_0x50226f[_0xeba1('0x2a')]();}};}; \ No newline at end of file +var _0xce58=['finally','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','SessionsClient','message','detectIntent','then','dialogflowV2','queryResult','diagnosticInfo','fields','end_conversation','boolValue','allRequiredParamsPresent','DIALOGFLOWV2_ENDCONVERSATION','intent','name','DIALOGFLOWV2_INTENTDISPLAYNAME','displayName','DIALOGFLOWV2_ISFALLBACKINTENT','isFallback','languageCode','DIALOGFLOWV2_QUERYTEXT','queryText','intentDetectionConfidence','providerName','length','all','lodash','dialogflow','md5','moment','./utils','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','Message','create','[%s][DIALOGFLOWV2]\x20%s','body','catch','error','stringify','isNil','interaction','UserId','info','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','whatsapp','phone','chat','ChatWebsiteId','account','AccountId','upperFirst','InteractionId','created','isEmpty','getMustacheRender'];(function(_0x24061a,_0x1c9f4d){var _0x82054e=function(_0x2ec346){while(--_0x2ec346){_0x24061a['push'](_0x24061a['shift']());}};_0x82054e(++_0x1c9f4d);}(_0xce58,0x1b4));var _0x8ce5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xce58[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x8ce5('0x0'));var dialogflow=require(_0x8ce5('0x1'));var md5=require(_0x8ce5('0x2'));var moment=require(_0x8ce5('0x3'));var Promise=require('bluebird');var logger=require('../../../../config/logger')('routing');var utils=require(_0x8ce5('0x4'));var rpc={'chatMessage':require(_0x8ce5('0x5')),'openchannelMessage':require(_0x8ce5('0x6')),'mailMessage':require(_0x8ce5('0x7')),'smsMessage':require(_0x8ce5('0x8')),'faxMessage':require(_0x8ce5('0x9')),'whatsappMessage':require('../../rpc/whatsappMessage')};function createMessage(_0x4922a1,_0x554d8e,_0x43bb84,_0x1f5cfb){return new Promise(function(_0x502c77,_0x1df175){var _0x255507=_['clone'](_0x43bb84);_0x255507['body']=_0x1f5cfb;return rpc[_0x554d8e+_0x8ce5('0xa')][_0x8ce5('0xb')](_0x255507)['then'](function(){logger['info'](_0x8ce5('0xc'),_0x4922a1,_0x255507[_0x8ce5('0xd')]);_0x502c77();})[_0x8ce5('0xe')](function(_0x16b59c){logger[_0x8ce5('0xf')](_0x8ce5('0xc'),_0x4922a1,JSON[_0x8ce5('0x10')](_0x16b59c));_0x1df175(_0x16b59c);});});}exports['consequence']=function(_0xea380c,_0x62d4b0){return function(_0x18847b){try{if(!_[_0x8ce5('0x11')](this[_0x8ce5('0x12')][_0x8ce5('0x13')])){logger[_0x8ce5('0x14')]('[%s][DIALOGFLOWV2]\x20%s',_0xea380c,_0x8ce5('0x15'));return _0x18847b[_0x8ce5('0x16')]();}var _0x457345={'ContactId':this[_0x8ce5('0x17')]['id'],'sentAt':moment()[_0x8ce5('0x18')](_0x8ce5('0x19')),'direction':_0x8ce5('0x1a')};if(this[_0x8ce5('0x1b')]===_0x8ce5('0x1c')||this[_0x8ce5('0x1b')]===_0x8ce5('0x1d')){_0x457345['phone']=this[_0x8ce5('0x12')][_0x8ce5('0x1e')];}var _0x12527f=this['channel'];if(_0x12527f===_0x8ce5('0x1f')){_0x457345[_0x8ce5('0x20')]=this[_0x8ce5('0x21')]['id'];}else{_0x457345[_['upperFirst'](_0x12527f)+_0x8ce5('0x22')]=this[_0x8ce5('0x21')]['id'];}_0x457345[_[_0x8ce5('0x23')](_0x12527f)+_0x8ce5('0x24')]=this['interaction']['id'];if(this[_0x8ce5('0x12')][_0x8ce5('0x25')]){var _0x33c91f=_0x62d4b0[0x4];if(!_[_0x8ce5('0x26')](_0x33c91f)){_0x457345[_0x8ce5('0xd')]=utils[_0x8ce5('0x27')](_0x33c91f,this);return rpc[_0x12527f+_0x8ce5('0xa')][_0x8ce5('0xb')](_0x457345)['then'](function(_0x317bd7){logger[_0x8ce5('0x14')](_0x8ce5('0xc'),_0xea380c,_0x457345[_0x8ce5('0xd')]);})[_0x8ce5('0xe')](function(_0x3b7eaa){logger[_0x8ce5('0xf')](_0x8ce5('0xc'),_0xea380c,JSON['stringify'](_0x3b7eaa));})[_0x8ce5('0x28')](function(){logger[_0x8ce5('0x14')](_0x8ce5('0x29'),_0xea380c);_0x18847b[_0x8ce5('0x2a')]();});}else{logger['info']('[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0xea380c);_0x18847b[_0x8ce5('0x2a')]();}}else{var _0x49d65c=this;var _0x17c896=_0x62d4b0[0x2]['replace'](/\\n/g,'\x0a');var _0x74aade={'credentials':{'private_key':_0x17c896,'client_email':_0x62d4b0[0x1]}};var _0x4ae752=new dialogflow[(_0x8ce5('0x2b'))](_0x74aade);var _0x4b0bd0=_0x4ae752['sessionPath'](_0x62d4b0[0x0],md5(_0x49d65c[_0x8ce5('0x12')]['id']));var _0x42f6d7={'session':_0x4b0bd0,'queryInput':{'text':{'text':_0x49d65c[_0x8ce5('0x2c')][_0x8ce5('0xd')],'languageCode':_0x62d4b0[0x3]||'en'}}};return _0x4ae752[_0x8ce5('0x2d')](_0x42f6d7)[_0x8ce5('0x2e')](function(_0x46fbe3){if(_0x46fbe3&&_0x46fbe3['length']){_0x49d65c[_0x8ce5('0xd')][_0x8ce5('0x2f')]=_0x46fbe3;var _0x444d4f=_0x46fbe3[0x0];var _0x480670=_0x444d4f[_0x8ce5('0x30')][_0x8ce5('0x31')]&&_0x444d4f[_0x8ce5('0x30')]['diagnosticInfo'][_0x8ce5('0x32')]?_0x444d4f[_0x8ce5('0x30')][_0x8ce5('0x31')]['fields'][_0x8ce5('0x33')][_0x8ce5('0x34')]:![];_0x49d65c[_0x8ce5('0xd')]['DIALOGFLOWV2_ACTION']=_0x444d4f[_0x8ce5('0x30')]['action'];_0x49d65c[_0x8ce5('0xd')]['DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT']=_0x444d4f[_0x8ce5('0x30')][_0x8ce5('0x35')];_0x49d65c[_0x8ce5('0xd')][_0x8ce5('0x36')]=_0x444d4f[_0x8ce5('0x30')][_0x8ce5('0x31')]&&_0x444d4f['queryResult'][_0x8ce5('0x31')][_0x8ce5('0x32')]?_0x444d4f['queryResult'][_0x8ce5('0x31')][_0x8ce5('0x32')][_0x8ce5('0x33')][_0x8ce5('0x34')]:![];_0x49d65c['body']['DIALOGFLOWV2_INTENTNAME']=_0x444d4f[_0x8ce5('0x30')][_0x8ce5('0x37')][_0x8ce5('0x38')];_0x49d65c[_0x8ce5('0xd')][_0x8ce5('0x39')]=_0x444d4f[_0x8ce5('0x30')]['intent'][_0x8ce5('0x3a')];_0x49d65c[_0x8ce5('0xd')][_0x8ce5('0x3b')]=_0x444d4f['queryResult'][_0x8ce5('0x37')][_0x8ce5('0x3c')];_0x49d65c[_0x8ce5('0xd')]['DIALOGFLOWV2_LANGUAGECODE']=_0x444d4f[_0x8ce5('0x30')][_0x8ce5('0x3d')];_0x49d65c[_0x8ce5('0xd')][_0x8ce5('0x3e')]=_0x444d4f[_0x8ce5('0x30')][_0x8ce5('0x3f')];_0x49d65c[_0x8ce5('0xd')]['DIALOGFLOWV2_SCORE']=_0x444d4f[_0x8ce5('0x30')][_0x8ce5('0x40')];_0x457345[_0x8ce5('0x41')]=_0x8ce5('0x2f');_0x457345['providerResponse']=JSON[_0x8ce5('0x10')](_0x46fbe3);var _0x15396b=[];for(var _0x55cc77=0x0;_0x55cc77<_0x46fbe3[_0x8ce5('0x42')];_0x55cc77++){var _0x4acac2=_0x46fbe3[_0x55cc77];if(_0x4acac2&&_0x4acac2[_0x8ce5('0x30')]&&_0x4acac2[_0x8ce5('0x30')]['fulfillmentText']){_0x15396b['push'](createMessage(_0xea380c,_0x12527f,_0x457345,_0x4acac2[_0x8ce5('0x30')]['fulfillmentText']));}}return Promise[_0x8ce5('0x43')](_0x15396b)[_0x8ce5('0x2e')](function(){if(_0x480670){_0x18847b[_0x8ce5('0x16')]();}else{_0x18847b[_0x8ce5('0x2a')]();}})[_0x8ce5('0xe')](function(_0x5bb062){logger[_0x8ce5('0xf')]('[%s][DIALOGFLOWV2]\x20%s',_0xea380c,JSON['stringify'](_0x5bb062));_0x18847b[_0x8ce5('0x16')]();});}})[_0x8ce5('0xe')](function(_0x23aefb){logger[_0x8ce5('0xf')](_0x8ce5('0xc'),_0xea380c,_0x23aefb[_0x8ce5('0x2c')]);_0x18847b[_0x8ce5('0x16')]();});}}catch(_0x3af5bf){logger[_0x8ce5('0xf')](_0x8ce5('0xc'),_0xea380c,JSON[_0x8ce5('0x10')](_0x3af5bf));_0x18847b['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/gotoif.js b/server/services/routing/server/applications/gotoif.js index 771b94f..feb2318 100644 --- a/server/services/routing/server/applications/gotoif.js +++ b/server/services/routing/server/applications/gotoif.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x236c=['consequence','fromString','getMustacheRender','replace','length','error','[%s][GOTOIF]\x20%s','map','message','join','condition','priorityTrue','priorityFalse','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','next','findIndex','rules','info','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','stop','validate','lodash','html-to-text','./utils','../../../../config/logger','string','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','priority\x20true\x20is\x20a\x20number','number','priority\x20false\x20is\x20a\x20number'];(function(_0x738d67,_0x53868d){var _0x4270d0=function(_0x1fad6e){while(--_0x1fad6e){_0x738d67['push'](_0x738d67['shift']());}};_0x4270d0(++_0x53868d);}(_0x236c,0x1c7));var _0xc236=function(_0x15f109,_0x36798a){_0x15f109=_0x15f109-0x0;var _0x13732e=_0x236c[_0x15f109];return _0x13732e;};'use strict';var schema=require(_0xc236('0x0'));var _=require(_0xc236('0x1'));var htmlToText=require(_0xc236('0x2'));var utils=require(_0xc236('0x3'));var logger=require(_0xc236('0x4'))('routing');var gotoif=schema({'condition':{'type':_0xc236('0x5'),'required':!![],'message':_0xc236('0x6')},'priorityTrue':{'type':'number','message':_0xc236('0x7')},'priorityFalse':{'type':_0xc236('0x8'),'message':_0xc236('0x9')}});exports[_0xc236('0xa')]=function(_0xb1738f,_0x4e9428){return function(_0x573567){try{var _0x30de0b={'condition':htmlToText[_0xc236('0xb')](utils[_0xc236('0xc')](_0x4e9428[0x0],this),{'wordwrap':![]})[_0xc236('0xd')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x4e9428[0x1],'priorityFalse':_0x4e9428[0x2]};var _0x51dbe4=gotoif[_0xc236('0x0')](_0x30de0b,{'typecast':!![]});if(_0x51dbe4[_0xc236('0xe')]){logger[_0xc236('0xf')](_0xc236('0x10'),_0xb1738f,_[_0xc236('0x11')](_0x51dbe4,_0xc236('0x12'))[_0xc236('0x13')](',\x20'));_0x573567['stop']();}else{try{var _0x1f3451=eval('('+_0x30de0b[_0xc236('0x14')]+')');var _0x5c8a29=_0x1f3451?_0x30de0b[_0xc236('0x15')]:_0x30de0b[_0xc236('0x16')];logger['info'](_0xc236('0x17'),_0xb1738f,_0x30de0b[_0xc236('0x14')],_0x1f3451,_0x5c8a29||_0xc236('0x18'));if(_0x5c8a29){var _0x37138f=_[_0xc236('0x19')](_0x573567[_0xc236('0x1a')](),{'p':_0x5c8a29});if(_0x37138f>=0x0){logger[_0xc236('0x1b')](_0xc236('0x1c'),_0xb1738f,_0x5c8a29||_0xc236('0x18'),_0x37138f);_0x573567[_0xc236('0x18')](_0x37138f);}else{logger['info'](_0xc236('0x1d'),_0xb1738f,_0x5c8a29||_0xc236('0x18'));_0x573567[_0xc236('0x1e')]();}}else{_0x573567[_0xc236('0x18')]();}}catch(_0x5cb14f){logger[_0xc236('0xf')]('[%s][GOTOIF]\x20eval\x20error:\x20%s',_0xb1738f,_0x5cb14f[_0xc236('0x12')]);_0x573567[_0xc236('0x1e')]();}}}catch(_0x27e564){logger[_0xc236('0xf')]('[%s][GOTOIF]\x20%s',_0xb1738f,JSON['stringify'](_0x27e564));_0x573567[_0xc236('0x1e')]();}};}; \ No newline at end of file +var _0xdfec=['[%s][GOTOIF]\x20eval\x20error:\x20%s','stringify','validate','html-to-text','./utils','../../../../config/logger','routing','string','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','priority\x20true\x20is\x20a\x20number','priority\x20false\x20is\x20a\x20number','consequence','fromString','getMustacheRender','replace','length','error','[%s][GOTOIF]\x20%s','map','message','join','stop','condition','priorityTrue','priorityFalse','info','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','findIndex','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found'];(function(_0x4ecbbb,_0x395578){var _0x5d61c6=function(_0x2c5f8e){while(--_0x2c5f8e){_0x4ecbbb['push'](_0x4ecbbb['shift']());}};_0x5d61c6(++_0x395578);}(_0xdfec,0x102));var _0xcdfe=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xdfec[_0x321bb2];return _0x9c12ed;};'use strict';var schema=require(_0xcdfe('0x0'));var _=require('lodash');var htmlToText=require(_0xcdfe('0x1'));var utils=require(_0xcdfe('0x2'));var logger=require(_0xcdfe('0x3'))(_0xcdfe('0x4'));var gotoif=schema({'condition':{'type':_0xcdfe('0x5'),'required':!![],'message':_0xcdfe('0x6')},'priorityTrue':{'type':_0xcdfe('0x7'),'message':_0xcdfe('0x8')},'priorityFalse':{'type':_0xcdfe('0x7'),'message':_0xcdfe('0x9')}});exports[_0xcdfe('0xa')]=function(_0x1e1c64,_0x2d89ff){return function(_0x47fd62){try{var _0x125ded={'condition':htmlToText[_0xcdfe('0xb')](utils[_0xcdfe('0xc')](_0x2d89ff[0x0],this),{'wordwrap':![]})[_0xcdfe('0xd')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x2d89ff[0x1],'priorityFalse':_0x2d89ff[0x2]};var _0x56f337=gotoif['validate'](_0x125ded,{'typecast':!![]});if(_0x56f337[_0xcdfe('0xe')]){logger[_0xcdfe('0xf')](_0xcdfe('0x10'),_0x1e1c64,_[_0xcdfe('0x11')](_0x56f337,_0xcdfe('0x12'))[_0xcdfe('0x13')](',\x20'));_0x47fd62[_0xcdfe('0x14')]();}else{try{var _0x50cffc=eval('('+_0x125ded[_0xcdfe('0x15')]+')');var _0x4dda1e=_0x50cffc?_0x125ded[_0xcdfe('0x16')]:_0x125ded[_0xcdfe('0x17')];logger[_0xcdfe('0x18')](_0xcdfe('0x19'),_0x1e1c64,_0x125ded[_0xcdfe('0x15')],_0x50cffc,_0x4dda1e||'next');if(_0x4dda1e){var _0x5517dc=_[_0xcdfe('0x1a')](_0x47fd62['rules'](),{'p':_0x4dda1e});if(_0x5517dc>=0x0){logger[_0xcdfe('0x18')](_0xcdfe('0x1b'),_0x1e1c64,_0x4dda1e||_0xcdfe('0x1c'),_0x5517dc);_0x47fd62['next'](_0x5517dc);}else{logger[_0xcdfe('0x18')](_0xcdfe('0x1d'),_0x1e1c64,_0x4dda1e||_0xcdfe('0x1c'));_0x47fd62[_0xcdfe('0x14')]();}}else{_0x47fd62['next']();}}catch(_0x35ccd4){logger[_0xcdfe('0xf')](_0xcdfe('0x1e'),_0x1e1c64,_0x35ccd4[_0xcdfe('0x12')]);_0x47fd62[_0xcdfe('0x14')]();}}}catch(_0x3800e9){logger[_0xcdfe('0xf')](_0xcdfe('0x10'),_0x1e1c64,JSON[_0xcdfe('0x1f')](_0x3800e9));_0x47fd62[_0xcdfe('0x14')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/gotop.js b/server/services/routing/server/applications/gotop.js index 673d64b..e7c0961 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 _0xfc67=['routing','consequence','length','[%s][GOTOP]\x20%s','map','message','join','stop','info','[%s][GOTOP]\x20priority\x20%s','priority','findIndex','rules','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','validate','lodash','../../../../config/logger'];(function(_0x15eb35,_0x3510ff){var _0x20e5da=function(_0x3d9498){while(--_0x3d9498){_0x15eb35['push'](_0x15eb35['shift']());}};_0x20e5da(++_0x3510ff);}(_0xfc67,0x82));var _0x7fc6=function(_0x2bdf29,_0x40cab0){_0x2bdf29=_0x2bdf29-0x0;var _0x60cb83=_0xfc67[_0x2bdf29];return _0x60cb83;};'use strict';var schema=require(_0x7fc6('0x0'));var _=require(_0x7fc6('0x1'));var logger=require(_0x7fc6('0x2'))(_0x7fc6('0x3'));var gotop=schema({'priority':{'type':'number','required':!![],'message':'priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required'}});exports[_0x7fc6('0x4')]=function(_0x26b0d8,_0x1cdbf0){return function(_0x1f38fd){try{var _0x4b9d5c={'priority':_0x1cdbf0[0x0]};var _0x50a77f=gotop['validate'](_0x4b9d5c,{'typecast':!![]});if(_0x50a77f[_0x7fc6('0x5')]){logger['error'](_0x7fc6('0x6'),_0x26b0d8,_[_0x7fc6('0x7')](_0x50a77f,_0x7fc6('0x8'))[_0x7fc6('0x9')](',\x20'));_0x1f38fd[_0x7fc6('0xa')]();}else{logger[_0x7fc6('0xb')](_0x7fc6('0xc'),_0x26b0d8,_0x4b9d5c['priority']);if(_0x4b9d5c[_0x7fc6('0xd')]){var _0x46c80a=_[_0x7fc6('0xe')](_0x1f38fd[_0x7fc6('0xf')](),{'p':_0x4b9d5c[_0x7fc6('0xd')]});if(_0x46c80a>=0x0){logger['info'](_0x7fc6('0x10'),_0x26b0d8,_0x4b9d5c[_0x7fc6('0xd')]||'next',_0x46c80a);_0x1f38fd[_0x7fc6('0x11')](_0x46c80a);}else{logger[_0x7fc6('0xb')](_0x7fc6('0x12'),_0x26b0d8,_0x4b9d5c[_0x7fc6('0xd')]||_0x7fc6('0x11'));_0x1f38fd['stop']();}}else{_0x1f38fd[_0x7fc6('0x11')]();}}}catch(_0x3ac0e5){logger['error'](_0x7fc6('0x6'),_0x26b0d8,JSON['stringify'](_0x3ac0e5));_0x1f38fd[_0x7fc6('0xa')]();}};}; \ No newline at end of file +var _0xd7c1=['number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','length','error','[%s][GOTOP]\x20%s','map','message','stop','info','[%s][GOTOP]\x20priority\x20%s','priority','findIndex','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','validate','lodash','../../../../config/logger','routing'];(function(_0x1257a4,_0x1d002d){var _0x5ef875=function(_0x428054){while(--_0x428054){_0x1257a4['push'](_0x1257a4['shift']());}};_0x5ef875(++_0x1d002d);}(_0xd7c1,0x1ea));var _0x1d7c=function(_0xb12e89,_0x122d41){_0xb12e89=_0xb12e89-0x0;var _0x579360=_0xd7c1[_0xb12e89];return _0x579360;};'use strict';var schema=require(_0x1d7c('0x0'));var _=require(_0x1d7c('0x1'));var logger=require(_0x1d7c('0x2'))(_0x1d7c('0x3'));var gotop=schema({'priority':{'type':_0x1d7c('0x4'),'required':!![],'message':_0x1d7c('0x5')}});exports['consequence']=function(_0x5c5f01,_0x504e43){return function(_0x4ec808){try{var _0x299e7f={'priority':_0x504e43[0x0]};var _0x4860e0=gotop[_0x1d7c('0x0')](_0x299e7f,{'typecast':!![]});if(_0x4860e0[_0x1d7c('0x6')]){logger[_0x1d7c('0x7')](_0x1d7c('0x8'),_0x5c5f01,_[_0x1d7c('0x9')](_0x4860e0,_0x1d7c('0xa'))['join'](',\x20'));_0x4ec808[_0x1d7c('0xb')]();}else{logger[_0x1d7c('0xc')](_0x1d7c('0xd'),_0x5c5f01,_0x299e7f['priority']);if(_0x299e7f[_0x1d7c('0xe')]){var _0x2e253d=_[_0x1d7c('0xf')](_0x4ec808['rules'](),{'p':_0x299e7f['priority']});if(_0x2e253d>=0x0){logger[_0x1d7c('0xc')](_0x1d7c('0x10'),_0x5c5f01,_0x299e7f[_0x1d7c('0xe')]||_0x1d7c('0x11'),_0x2e253d);_0x4ec808[_0x1d7c('0x11')](_0x2e253d);}else{logger['info'](_0x1d7c('0x12'),_0x5c5f01,_0x299e7f['priority']||_0x1d7c('0x11'));_0x4ec808[_0x1d7c('0xb')]();}}else{_0x4ec808[_0x1d7c('0x11')]();}}}catch(_0x3315a6){logger['error']('[%s][GOTOP]\x20%s',_0x5c5f01,JSON['stringify'](_0x3315a6));_0x4ec808[_0x1d7c('0xb')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/message.js b/server/services/routing/server/applications/message.js index 4234e82..efefc7a 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 _0x0c19=['stringify','stop','lodash','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','getMustacheRender','contact','channel','chat','ChatWebsiteId','account','AccountId','upperFirst','interaction','Message','create','info','[%s][MESSAGE]\x20%s','body','next','error'];(function(_0x479d7d,_0x15a32b){var _0x446ae8=function(_0x8d3667){while(--_0x8d3667){_0x479d7d['push'](_0x479d7d['shift']());}};_0x446ae8(++_0x15a32b);}(_0x0c19,0xf5));var _0x90c1=function(_0x3fb2cf,_0x418468){_0x3fb2cf=_0x3fb2cf-0x0;var _0x415821=_0x0c19[_0x3fb2cf];return _0x415821;};'use strict';var _=require(_0x90c1('0x0'));var utils=require(_0x90c1('0x1'));var logger=require(_0x90c1('0x2'))(_0x90c1('0x3'));var rpc={'chatMessage':require(_0x90c1('0x4')),'openchannelMessage':require(_0x90c1('0x5')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0x90c1('0x6')),'faxMessage':require(_0x90c1('0x7')),'whatsappMessage':require(_0x90c1('0x8'))};exports['consequence']=function(_0x13fd68,_0xb605b6){return function(_0x5434a1){try{var _0x440f7a={'body':utils[_0x90c1('0x9')](_0xb605b6[0x0],this),'ContactId':this[_0x90c1('0xa')]['id']};if(this[_0x90c1('0xb')]===_0x90c1('0xc')){_0x440f7a[_0x90c1('0xd')]=this[_0x90c1('0xe')]['id'];}else{_0x440f7a[_['upperFirst'](this[_0x90c1('0xb')])+_0x90c1('0xf')]=this['account']['id'];}_0x440f7a[_[_0x90c1('0x10')](this['channel'])+'InteractionId']=this[_0x90c1('0x11')]['id'];if(rpc[this['channel']+_0x90c1('0x12')]){return rpc[this[_0x90c1('0xb')]+_0x90c1('0x12')][_0x90c1('0x13')](_0x440f7a)['then'](function(_0x59a0ca){logger[_0x90c1('0x14')](_0x90c1('0x15'),_0x13fd68,_0x440f7a[_0x90c1('0x16')]);_0x5434a1[_0x90c1('0x17')]();})['catch'](function(_0xaaab35){logger[_0x90c1('0x18')](_0x90c1('0x15'),_0x13fd68,JSON[_0x90c1('0x19')](_0xaaab35));_0x5434a1[_0x90c1('0x1a')]();});}}catch(_0x1cfb86){logger['error'](_0x90c1('0x15'),_0x13fd68,JSON[_0x90c1('0x19')](_0x1cfb86));_0x5434a1[_0x90c1('0x1a')]();}};}; \ No newline at end of file +var _0xd744=['../../../../config/logger','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','consequence','getMustacheRender','channel','chat','ChatWebsiteId','upperFirst','AccountId','account','InteractionId','interaction','Message','then','info','body','catch','error','[%s][MESSAGE]\x20%s','stringify','lodash','./utils'];(function(_0x1f357,_0x1c80fc){var _0x5c8813=function(_0x2b087e){while(--_0x2b087e){_0x1f357['push'](_0x1f357['shift']());}};_0x5c8813(++_0x1c80fc);}(_0xd744,0x7b));var _0x4d74=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0xd744[_0x59ee6f];return _0x4c0979;};'use strict';var _=require(_0x4d74('0x0'));var utils=require(_0x4d74('0x1'));var logger=require(_0x4d74('0x2'))('routing');var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x4d74('0x3')),'mailMessage':require(_0x4d74('0x4')),'smsMessage':require(_0x4d74('0x5')),'faxMessage':require(_0x4d74('0x6')),'whatsappMessage':require('../../rpc/whatsappMessage')};exports[_0x4d74('0x7')]=function(_0x3535e3,_0x3f5feb){return function(_0x41e795){try{var _0x57e0f0={'body':utils[_0x4d74('0x8')](_0x3f5feb[0x0],this),'ContactId':this['contact']['id']};if(this[_0x4d74('0x9')]===_0x4d74('0xa')){_0x57e0f0[_0x4d74('0xb')]=this['account']['id'];}else{_0x57e0f0[_[_0x4d74('0xc')](this[_0x4d74('0x9')])+_0x4d74('0xd')]=this[_0x4d74('0xe')]['id'];}_0x57e0f0[_[_0x4d74('0xc')](this[_0x4d74('0x9')])+_0x4d74('0xf')]=this[_0x4d74('0x10')]['id'];if(rpc[this['channel']+_0x4d74('0x11')]){return rpc[this[_0x4d74('0x9')]+_0x4d74('0x11')]['create'](_0x57e0f0)[_0x4d74('0x12')](function(_0x1cea6b){logger[_0x4d74('0x13')]('[%s][MESSAGE]\x20%s',_0x3535e3,_0x57e0f0[_0x4d74('0x14')]);_0x41e795['next']();})[_0x4d74('0x15')](function(_0x35e64d){logger[_0x4d74('0x16')](_0x4d74('0x17'),_0x3535e3,JSON[_0x4d74('0x18')](_0x35e64d));_0x41e795['stop']();});}}catch(_0x3dc4a9){logger[_0x4d74('0x16')]('[%s][MESSAGE]\x20%s',_0x3535e3,JSON['stringify'](_0x3dc4a9));_0x41e795['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/noop.js b/server/services/routing/server/applications/noop.js index f43130f..35a9348 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 _0x3d33=['routing','consequence','info','[%s][NOOP]\x20%s','getMustacheRender','next','error','stringify','stop','./utils','../../../../config/logger'];(function(_0x587fb5,_0x59cb3b){var _0x551105=function(_0x5bbef4){while(--_0x5bbef4){_0x587fb5['push'](_0x587fb5['shift']());}};_0x551105(++_0x59cb3b);}(_0x3d33,0x1b6));var _0x33d3=function(_0x2e7aa8,_0x2c6c40){_0x2e7aa8=_0x2e7aa8-0x0;var _0x13ec84=_0x3d33[_0x2e7aa8];return _0x13ec84;};'use strict';var utils=require(_0x33d3('0x0'));var logger=require(_0x33d3('0x1'))(_0x33d3('0x2'));exports[_0x33d3('0x3')]=function(_0x467e21,_0x5d0587){return function(_0x319497){try{logger[_0x33d3('0x4')](_0x33d3('0x5'),_0x467e21,utils[_0x33d3('0x6')](_0x5d0587[0x0],this));_0x319497[_0x33d3('0x7')]();}catch(_0x394d18){logger[_0x33d3('0x8')](_0x33d3('0x5'),_0x467e21,JSON[_0x33d3('0x9')](_0x394d18));_0x319497[_0x33d3('0xa')]();}};}; \ No newline at end of file +var _0xac47=['getMustacheRender','next','error','stringify','stop','./utils','../../../../config/logger','routing','consequence'];(function(_0x34a1b2,_0x3b2ee5){var _0x52c608=function(_0x545a81){while(--_0x545a81){_0x34a1b2['push'](_0x34a1b2['shift']());}};_0x52c608(++_0x3b2ee5);}(_0xac47,0xef));var _0x7ac4=function(_0xef66ed,_0x1a5239){_0xef66ed=_0xef66ed-0x0;var _0xa14f66=_0xac47[_0xef66ed];return _0xa14f66;};'use strict';var utils=require(_0x7ac4('0x0'));var logger=require(_0x7ac4('0x1'))(_0x7ac4('0x2'));exports[_0x7ac4('0x3')]=function(_0x17b7cc,_0x32bb16){return function(_0xe5889d){try{logger['info']('[%s][NOOP]\x20%s',_0x17b7cc,utils[_0x7ac4('0x4')](_0x32bb16[0x0],this));_0xe5889d[_0x7ac4('0x5')]();}catch(_0x4faa40){logger[_0x7ac4('0x6')]('[%s][NOOP]\x20%s',_0x17b7cc,JSON[_0x7ac4('0x7')](_0x4faa40));_0xe5889d[_0x7ac4('0x8')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/queue.js b/server/services/routing/server/applications/queue.js index 4299f8d..67b758b 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 _0x3233=['account','queue','from','joinAt','emit','format','%sQueuesWaitingInteractions','pick','%s_queue_waiting_interaction:%s','save','remove','../../rpc/mailQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport','../../rpc/whatsappQueueReport','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','body','YYYY-MM-DD\x20HH:mm:ss','contact','QueueId','upperFirst','channel','interaction','MessageId','message','chat','WebsiteId','info','name','QueueReport','create','catch','error','create\x20queue\x20report','update','update\x20queue\x20report','waiting','timeout','[%s][END:QUEUE][NAME:%s]','toLowerCase','consequence','length','[%s][QUEUE]\x20%s','join','stop','createQueue','qtimeout','rules','end','close','next','strategy','rrmemory','beepall','stack','validate','lodash','util','seq-queue','moment','ioredis','../../../../config/environment','routing','./strategy','defaults','localhost','socket.io-emitter','queue_id'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0x3233,0xc5));var _0x3323=function(_0x546644,_0x24fe66){_0x546644=_0x546644-0x0;var _0x517cbe=_0x3233[_0x546644];return _0x517cbe;};'use strict';var schema=require(_0x3323('0x0'));var _=require(_0x3323('0x1'));var util=require(_0x3323('0x2'));var seqqueue=require(_0x3323('0x3'));var moment=require(_0x3323('0x4'));var Redis=require(_0x3323('0x5'));var config=require(_0x3323('0x6'));var logger=require('../../../../config/logger')(_0x3323('0x7'));var strategy=require(_0x3323('0x8'));config['redis']=_[_0x3323('0x9')](config['redis'],{'host':_0x3323('0xa'),'port':0x18eb});var io=require(_0x3323('0xb'))(new Redis(config['redis']));var attributes=['id',_0x3323('0xc'),_0x3323('0xd'),_0x3323('0xe'),_0x3323('0xf'),_0x3323('0x10')];function emit(_0xdaf9c,_0x5aaa3b,_0x398038){io['to'](_0xdaf9c)[_0x3323('0x11')](_0x5aaa3b,_0x398038);}function emitChannelQueueInteraction(_0x4e724c,_0x5e208e,_0x7e02fd,_0x2468e6,_0x44aec4,_0x3b29e4,_0x37e250,_0x139583){var _0x282894=_['clone'](_0x7e02fd);_0x282894[_0x3323('0xc')]=_0x139583;_0x282894[_0x3323('0xe')]=_0x5e208e;_0x282894[_0x3323('0xd')]=_0x2468e6;_0x282894['id']=_0x44aec4;if(_0x3b29e4){_0x37e250[util[_0x3323('0x12')](_0x3323('0x13'),_0x4e724c)][_0x44aec4]=_[_0x3323('0x14')](_0x282894,attributes);}else{delete _0x37e250[util[_0x3323('0x12')](_0x3323('0x13'),_0x4e724c)][_0x44aec4];}emit(util[_0x3323('0x12')]('%s:queue:%s',_0x4e724c,_0x5e208e),util[_0x3323('0x12')](_0x3323('0x15'),_0x4e724c,_0x3b29e4?_0x3323('0x16'):_0x3323('0x17')),_[_0x3323('0x14')](_0x282894,attributes));}var rpc={'openchannelQueueReport':require('../../rpc/openchannelQueueReport'),'mailQueueReport':require(_0x3323('0x18')),'chatQueueReport':require(_0x3323('0x19')),'smsQueueReport':require(_0x3323('0x1a')),'faxQueueReport':require('../../rpc/faxQueueReport'),'whatsappQueueReport':require(_0x3323('0x1b'))};var queue=schema({'name':{'type':'string','required':!![],'message':_0x3323('0x1c')},'timeout':{'type':_0x3323('0x1d'),'message':_0x3323('0x1e')}});function startRouting(_0xd5fb2e,_0x161a87,_0x133bed,_0x4320cc){if(_0xd5fb2e&&_0x161a87&&_0x133bed){_0x161a87['waiting']+=0x1;var _0x1778a0={'uniqueid':_0xd5fb2e,'from':_0x133bed[_0x3323('0x1f')]?_0x133bed['body'][_0x3323('0xf')]:'','joinAt':moment()[_0x3323('0x12')](_0x3323('0x20')),'ContactId':_0x133bed[_0x3323('0x21')]?_0x133bed[_0x3323('0x21')]['id']:null,'ListId':_0x133bed['list']?_0x133bed['list']['id']:null};_0x1778a0[_['upperFirst'](_0x133bed['channel'])+_0x3323('0x22')]=_0x161a87['id']||null;_0x1778a0[_[_0x3323('0x23')](_0x133bed[_0x3323('0x24')])+'InteractionId']=_0x133bed[_0x3323('0x25')]?_0x133bed[_0x3323('0x25')]['id']:null;_0x1778a0[_[_0x3323('0x23')](_0x133bed[_0x3323('0x24')])+_0x3323('0x26')]=_0x133bed[_0x3323('0x27')]?_0x133bed['message']['id']:null;_0x1778a0[_[_0x3323('0x23')](_0x133bed[_0x3323('0x24')])+(_0x133bed['channel']!==_0x3323('0x28')?'AccountId':_0x3323('0x29'))]=_0x133bed[_0x3323('0xd')]?_0x133bed[_0x3323('0xd')]['id']:null;logger[_0x3323('0x2a')](util['format']('[%s][START:QUEUE][NAME:%s]',_0xd5fb2e,_0x161a87[_0x3323('0x2b')]));emitChannelQueueInteraction(_0x133bed[_0x3323('0x24')],_0x161a87['name'],_0x1778a0,_0x133bed[_0x3323('0xd')]['name'],_0x133bed['message']['id'],!![],_0x4320cc,_0x161a87['id']);if(rpc[_0x133bed[_0x3323('0x24')]+'QueueReport']){return rpc[_0x133bed[_0x3323('0x24')]+_0x3323('0x2c')][_0x3323('0x2d')](_0x1778a0)[_0x3323('0x2e')](function(_0x2322ce){logger[_0x3323('0x2f')](_0x3323('0x30'));});}}}function stopRouting(_0x5c4b35,_0x29bc81,_0x2d31bd,_0x2f483b){if(_0x5c4b35&&_0x29bc81){_0x29bc81['waiting']-=0x1;var _0x457e4c={'leaveAt':moment()[_0x3323('0x12')](_0x3323('0x20')),'acceptAt':moment()['format'](_0x3323('0x20')),'reason':'accepted'};logger[_0x3323('0x2a')](util[_0x3323('0x12')]('[%s][STOP:QUEUE][NAME:%s]',_0x5c4b35,_0x29bc81[_0x3323('0x2b')]));emitChannelQueueInteraction(_0x2d31bd[_0x3323('0x24')],_0x29bc81['name'],_0x2d31bd[_0x3323('0x1f')],_0x2d31bd[_0x3323('0xd')][_0x3323('0x2b')],_0x2d31bd['message']['id'],![],_0x2f483b,_0x29bc81['id']);if(rpc[_0x2d31bd[_0x3323('0x24')]+'QueueReport']){return rpc[_0x2d31bd[_0x3323('0x24')]+'QueueReport'][_0x3323('0x31')](_0x5c4b35,_0x457e4c)[_0x3323('0x2e')](function(_0x353b2f){logger[_0x3323('0x2f')](_0x3323('0x32'));});}}}function endRouting(_0x18f77c,_0x3e8e7f,_0x4f4762,_0x2a7bdb){if(_0x18f77c&&_0x3e8e7f){_0x3e8e7f[_0x3323('0x33')]-=0x1;var _0x1785f6={'leaveAt':moment()[_0x3323('0x12')](_0x3323('0x20')),'exitAt':moment()[_0x3323('0x12')]('YYYY-MM-DD\x20HH:mm:ss'),'reason':_0x3323('0x34')};logger['info'](util[_0x3323('0x12')](_0x3323('0x35'),_0x18f77c,_0x3e8e7f[_0x3323('0x2b')]));emitChannelQueueInteraction(_0x4f4762[_0x3323('0x24')],_0x3e8e7f[_0x3323('0x2b')],_0x4f4762[_0x3323('0x1f')],_0x4f4762[_0x3323('0xd')][_0x3323('0x2b')],_0x4f4762[_0x3323('0x27')]['id'],![],_0x2a7bdb);if(rpc[_0x4f4762[_0x3323('0x24')]+_0x3323('0x2c')]){return rpc[_0x4f4762[_0x3323('0x24')]+_0x3323('0x2c')][_0x3323('0x31')](_0x18f77c,_0x1785f6)['catch'](function(_0x1c1f5b){logger[_0x3323('0x2f')](_0x3323('0x32'));});}}}function handleFindQueue(_0x3b5057){return function(_0x922c72){return _0x922c72[_0x3323('0x2b')]['toLowerCase']()===_0x3b5057[_0x3323('0x36')]();};}exports[_0x3323('0x37')]=function(_0x4ce5cd,_0x5dc7f0,_0x48623b,_0x228f54){return function(_0x5a862c){try{var _0x10448d={'name':_0x5dc7f0[0x0],'timeout':_0x5dc7f0[0x1]};var _0x5d9863=queue[_0x3323('0x0')](_0x10448d,{'typecast':!![]});if(_0x5d9863[_0x3323('0x38')]){logger['error'](_0x3323('0x39'),_0x4ce5cd,_['map'](_0x5d9863,_0x3323('0x27'))[_0x3323('0x3a')](',\x20'));_0x5a862c[_0x3323('0x3b')]();}else{var _0x12e3eb=_['find'](_0x48623b[_0x228f54[_0x3323('0x24')]+'Queues'],handleFindQueue(_0x10448d[_0x3323('0x2b')]));if(_0x12e3eb){startRouting(_0x4ce5cd,_0x12e3eb,_0x228f54,_0x48623b);var _0xcee4a5=(_0x12e3eb[_0x3323('0x34')]||0xa)*0x3e8;var _0xf25f80=(_0x10448d['timeout']||0x14)*0x3e8;var _0x5626c1,_0x185c8d;if(_0xcee4a5>_0xf25f80){_0xf25f80=_0xcee4a5;}var _0x5bffe9=seqqueue[_0x3323('0x3c')](_0xcee4a5);_0x5bffe9['id']=_0x4ce5cd;_0x5bffe9['atimeout']=_0xcee4a5;_0x5bffe9[_0x3323('0x3d')]=_0xf25f80;_0x5bffe9[_0x3323('0x24')]=_0x228f54[_0x3323('0x24')];_0x48623b[_0x3323('0x3e')][_0x4ce5cd]['on'](_0x3323('0x3f'),function(){logger[_0x3323('0x2a')]('[%s][QUEUE]\x20ROUTING\x20STOPPED',_0x4ce5cd);stopRouting(_0x4ce5cd,_0x12e3eb,_0x228f54,_0x48623b);clearTimeout(_0x5626c1);_0x5626c1=undefined;_0x5bffe9[_0x3323('0x40')](!![]);if(_0x48623b[_0x3323('0x3e')][_0x4ce5cd]){delete _0x48623b['rules'][_0x4ce5cd];}_0x5a862c['stop']();});_0x48623b[_0x3323('0x3e')][_0x4ce5cd]['on']('complete',function(){if(_0x48623b['rules'][_0x4ce5cd]){delete _0x48623b[_0x3323('0x3e')][_0x4ce5cd];}});_0x5626c1=setTimeout(function(){logger[_0x3323('0x2a')]('[%s][QUEUE]\x20APPLICATION\x20END',_0x4ce5cd);endRouting(_0x4ce5cd,_0x12e3eb,_0x228f54,_0x48623b);clearTimeout(_0x5626c1);_0x5bffe9['close'](!![]);_0x5a862c[_0x3323('0x41')]();},_0xf25f80);switch(_0x12e3eb[_0x3323('0x42')]){case'rrmemory':strategy[_0x3323('0x43')](_0x5bffe9,_0x12e3eb,_0x48623b,_0x228f54);break;default:strategy[_0x3323('0x44')](_0x5bffe9,_0x12e3eb,_0x48623b,_0x228f54);}}else{logger[_0x3323('0x2f')]('[%s][QUEUE]\x20queue\x20not\x20found\x20%s',_0x4ce5cd,_0x10448d['name']);_0x5a862c[_0x3323('0x3b')]();}}}catch(_0x345b55){console['log'](_0x345b55);logger[_0x3323('0x2f')](_0x3323('0x39'),_0x4ce5cd,_0x345b55[_0x3323('0x45')]);_0x5a862c[_0x3323('0x3b')]();}};}; \ No newline at end of file +var _0x7c9a=['WebsiteId','info','[%s][START:QUEUE][NAME:%s]','name','QueueReport','create','error','create\x20queue\x20report','YYYY-MM-DD\x20HH:mm:ss','accepted','[%s][STOP:QUEUE][NAME:%s]','[%s][END:QUEUE][NAME:%s]','update','catch','update\x20queue\x20report','toLowerCase','consequence','length','[%s][QUEUE]\x20%s','map','join','find','Queues','timeout','createQueue','qtimeout','rules','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','close','complete','[%s][QUEUE]\x20APPLICATION\x20END','next','strategy','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','stop','log','stack','validate','util','seq-queue','ioredis','../../../../config/logger','routing','./strategy','redis','localhost','socket.io-emitter','queue_id','account','queue','from','joinAt','clone','pick','format','%s:queue:%s','save','remove','../../rpc/mailQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport','../../rpc/whatsappQueueReport','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','waiting','body','contact','list','upperFirst','channel','QueueId','InteractionId','interaction','message','AccountId'];(function(_0x2f9d3e,_0x29345f){var _0x32d8e6=function(_0x9f63fc){while(--_0x9f63fc){_0x2f9d3e['push'](_0x2f9d3e['shift']());}};_0x32d8e6(++_0x29345f);}(_0x7c9a,0x1b3));var _0xa7c9=function(_0x2843b8,_0x2d1367){_0x2843b8=_0x2843b8-0x0;var _0x4f177f=_0x7c9a[_0x2843b8];return _0x4f177f;};'use strict';var schema=require(_0xa7c9('0x0'));var _=require('lodash');var util=require(_0xa7c9('0x1'));var seqqueue=require(_0xa7c9('0x2'));var moment=require('moment');var Redis=require(_0xa7c9('0x3'));var config=require('../../../../config/environment');var logger=require(_0xa7c9('0x4'))(_0xa7c9('0x5'));var strategy=require(_0xa7c9('0x6'));config[_0xa7c9('0x7')]=_['defaults'](config[_0xa7c9('0x7')],{'host':_0xa7c9('0x8'),'port':0x18eb});var io=require(_0xa7c9('0x9'))(new Redis(config['redis']));var attributes=['id',_0xa7c9('0xa'),_0xa7c9('0xb'),_0xa7c9('0xc'),_0xa7c9('0xd'),_0xa7c9('0xe')];function emit(_0x3c30b7,_0x267c57,_0x3a214b){io['to'](_0x3c30b7)['emit'](_0x267c57,_0x3a214b);}function emitChannelQueueInteraction(_0x35f418,_0x56cd6c,_0x23349b,_0x19f78f,_0x6474d2,_0xea8e44,_0x4f7604,_0x23f9a0){var _0x352a8f=_[_0xa7c9('0xf')](_0x23349b);_0x352a8f[_0xa7c9('0xa')]=_0x23f9a0;_0x352a8f[_0xa7c9('0xc')]=_0x56cd6c;_0x352a8f[_0xa7c9('0xb')]=_0x19f78f;_0x352a8f['id']=_0x6474d2;if(_0xea8e44){_0x4f7604[util['format']('%sQueuesWaitingInteractions',_0x35f418)][_0x6474d2]=_[_0xa7c9('0x10')](_0x352a8f,attributes);}else{delete _0x4f7604[util[_0xa7c9('0x11')]('%sQueuesWaitingInteractions',_0x35f418)][_0x6474d2];}emit(util[_0xa7c9('0x11')](_0xa7c9('0x12'),_0x35f418,_0x56cd6c),util[_0xa7c9('0x11')]('%s_queue_waiting_interaction:%s',_0x35f418,_0xea8e44?_0xa7c9('0x13'):_0xa7c9('0x14')),_[_0xa7c9('0x10')](_0x352a8f,attributes));}var rpc={'openchannelQueueReport':require('../../rpc/openchannelQueueReport'),'mailQueueReport':require(_0xa7c9('0x15')),'chatQueueReport':require(_0xa7c9('0x16')),'smsQueueReport':require(_0xa7c9('0x17')),'faxQueueReport':require('../../rpc/faxQueueReport'),'whatsappQueueReport':require(_0xa7c9('0x18'))};var queue=schema({'name':{'type':'string','required':!![],'message':_0xa7c9('0x19')},'timeout':{'type':_0xa7c9('0x1a'),'message':_0xa7c9('0x1b')}});function startRouting(_0x36de47,_0x4477ac,_0x3c683a,_0x4aa649){if(_0x36de47&&_0x4477ac&&_0x3c683a){_0x4477ac[_0xa7c9('0x1c')]+=0x1;var _0x2693fb={'uniqueid':_0x36de47,'from':_0x3c683a[_0xa7c9('0x1d')]?_0x3c683a[_0xa7c9('0x1d')][_0xa7c9('0xd')]:'','joinAt':moment()[_0xa7c9('0x11')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x3c683a[_0xa7c9('0x1e')]?_0x3c683a[_0xa7c9('0x1e')]['id']:null,'ListId':_0x3c683a[_0xa7c9('0x1f')]?_0x3c683a['list']['id']:null};_0x2693fb[_[_0xa7c9('0x20')](_0x3c683a[_0xa7c9('0x21')])+_0xa7c9('0x22')]=_0x4477ac['id']||null;_0x2693fb[_['upperFirst'](_0x3c683a[_0xa7c9('0x21')])+_0xa7c9('0x23')]=_0x3c683a[_0xa7c9('0x24')]?_0x3c683a['interaction']['id']:null;_0x2693fb[_['upperFirst'](_0x3c683a[_0xa7c9('0x21')])+'MessageId']=_0x3c683a[_0xa7c9('0x25')]?_0x3c683a[_0xa7c9('0x25')]['id']:null;_0x2693fb[_['upperFirst'](_0x3c683a[_0xa7c9('0x21')])+(_0x3c683a[_0xa7c9('0x21')]!=='chat'?_0xa7c9('0x26'):_0xa7c9('0x27'))]=_0x3c683a[_0xa7c9('0xb')]?_0x3c683a[_0xa7c9('0xb')]['id']:null;logger[_0xa7c9('0x28')](util[_0xa7c9('0x11')](_0xa7c9('0x29'),_0x36de47,_0x4477ac[_0xa7c9('0x2a')]));emitChannelQueueInteraction(_0x3c683a[_0xa7c9('0x21')],_0x4477ac[_0xa7c9('0x2a')],_0x2693fb,_0x3c683a['account']['name'],_0x3c683a[_0xa7c9('0x25')]['id'],!![],_0x4aa649,_0x4477ac['id']);if(rpc[_0x3c683a[_0xa7c9('0x21')]+'QueueReport']){return rpc[_0x3c683a['channel']+_0xa7c9('0x2b')][_0xa7c9('0x2c')](_0x2693fb)['catch'](function(_0x2bcc82){logger[_0xa7c9('0x2d')](_0xa7c9('0x2e'));});}}}function stopRouting(_0x2da26f,_0x340814,_0x5d871c,_0x443102){if(_0x2da26f&&_0x340814){_0x340814[_0xa7c9('0x1c')]-=0x1;var _0x52be25={'leaveAt':moment()[_0xa7c9('0x11')](_0xa7c9('0x2f')),'acceptAt':moment()[_0xa7c9('0x11')]('YYYY-MM-DD\x20HH:mm:ss'),'reason':_0xa7c9('0x30')};logger[_0xa7c9('0x28')](util[_0xa7c9('0x11')](_0xa7c9('0x31'),_0x2da26f,_0x340814[_0xa7c9('0x2a')]));emitChannelQueueInteraction(_0x5d871c['channel'],_0x340814['name'],_0x5d871c[_0xa7c9('0x1d')],_0x5d871c['account'][_0xa7c9('0x2a')],_0x5d871c[_0xa7c9('0x25')]['id'],![],_0x443102,_0x340814['id']);if(rpc[_0x5d871c['channel']+_0xa7c9('0x2b')]){return rpc[_0x5d871c[_0xa7c9('0x21')]+_0xa7c9('0x2b')]['update'](_0x2da26f,_0x52be25)['catch'](function(_0x5c1c65){logger['error']('update\x20queue\x20report');});}}}function endRouting(_0x3df6f0,_0x482387,_0x3ba1bb,_0x11582d){if(_0x3df6f0&&_0x482387){_0x482387[_0xa7c9('0x1c')]-=0x1;var _0x1b9b46={'leaveAt':moment()['format'](_0xa7c9('0x2f')),'exitAt':moment()[_0xa7c9('0x11')](_0xa7c9('0x2f')),'reason':'timeout'};logger[_0xa7c9('0x28')](util['format'](_0xa7c9('0x32'),_0x3df6f0,_0x482387[_0xa7c9('0x2a')]));emitChannelQueueInteraction(_0x3ba1bb[_0xa7c9('0x21')],_0x482387[_0xa7c9('0x2a')],_0x3ba1bb['body'],_0x3ba1bb['account']['name'],_0x3ba1bb[_0xa7c9('0x25')]['id'],![],_0x11582d);if(rpc[_0x3ba1bb[_0xa7c9('0x21')]+_0xa7c9('0x2b')]){return rpc[_0x3ba1bb[_0xa7c9('0x21')]+'QueueReport'][_0xa7c9('0x33')](_0x3df6f0,_0x1b9b46)[_0xa7c9('0x34')](function(_0x15ab7a){logger['error'](_0xa7c9('0x35'));});}}}function handleFindQueue(_0x33d9e4){return function(_0x26f573){return _0x26f573[_0xa7c9('0x2a')][_0xa7c9('0x36')]()===_0x33d9e4['toLowerCase']();};}exports[_0xa7c9('0x37')]=function(_0x622446,_0x13d902,_0x440de7,_0x59f0eb){return function(_0x4d9d15){try{var _0x2e2ff2={'name':_0x13d902[0x0],'timeout':_0x13d902[0x1]};var _0x19e1d1=queue[_0xa7c9('0x0')](_0x2e2ff2,{'typecast':!![]});if(_0x19e1d1[_0xa7c9('0x38')]){logger['error'](_0xa7c9('0x39'),_0x622446,_[_0xa7c9('0x3a')](_0x19e1d1,_0xa7c9('0x25'))[_0xa7c9('0x3b')](',\x20'));_0x4d9d15['stop']();}else{var _0x230a64=_[_0xa7c9('0x3c')](_0x440de7[_0x59f0eb[_0xa7c9('0x21')]+_0xa7c9('0x3d')],handleFindQueue(_0x2e2ff2[_0xa7c9('0x2a')]));if(_0x230a64){startRouting(_0x622446,_0x230a64,_0x59f0eb,_0x440de7);var _0xe6de17=(_0x230a64[_0xa7c9('0x3e')]||0xa)*0x3e8;var _0x173e5e=(_0x2e2ff2[_0xa7c9('0x3e')]||0x14)*0x3e8;var _0x4efea1,_0x4626ce;if(_0xe6de17>_0x173e5e){_0x173e5e=_0xe6de17;}var _0x12c0a9=seqqueue[_0xa7c9('0x3f')](_0xe6de17);_0x12c0a9['id']=_0x622446;_0x12c0a9['atimeout']=_0xe6de17;_0x12c0a9[_0xa7c9('0x40')]=_0x173e5e;_0x12c0a9[_0xa7c9('0x21')]=_0x59f0eb[_0xa7c9('0x21')];_0x440de7[_0xa7c9('0x41')][_0x622446]['on'](_0xa7c9('0x42'),function(){logger[_0xa7c9('0x28')](_0xa7c9('0x43'),_0x622446);stopRouting(_0x622446,_0x230a64,_0x59f0eb,_0x440de7);clearTimeout(_0x4efea1);_0x4efea1=undefined;_0x12c0a9[_0xa7c9('0x44')](!![]);if(_0x440de7['rules'][_0x622446]){delete _0x440de7[_0xa7c9('0x41')][_0x622446];}_0x4d9d15['stop']();});_0x440de7[_0xa7c9('0x41')][_0x622446]['on'](_0xa7c9('0x45'),function(){if(_0x440de7[_0xa7c9('0x41')][_0x622446]){delete _0x440de7[_0xa7c9('0x41')][_0x622446];}});_0x4efea1=setTimeout(function(){logger[_0xa7c9('0x28')](_0xa7c9('0x46'),_0x622446);endRouting(_0x622446,_0x230a64,_0x59f0eb,_0x440de7);clearTimeout(_0x4efea1);_0x12c0a9[_0xa7c9('0x44')](!![]);_0x4d9d15[_0xa7c9('0x47')]();},_0x173e5e);switch(_0x230a64[_0xa7c9('0x48')]){case _0xa7c9('0x49'):strategy[_0xa7c9('0x49')](_0x12c0a9,_0x230a64,_0x440de7,_0x59f0eb);break;default:strategy[_0xa7c9('0x4a')](_0x12c0a9,_0x230a64,_0x440de7,_0x59f0eb);}}else{logger[_0xa7c9('0x2d')](_0xa7c9('0x4b'),_0x622446,_0x2e2ff2['name']);_0x4d9d15[_0xa7c9('0x4c')]();}}}catch(_0x9702f7){console[_0xa7c9('0x4d')](_0x9702f7);logger[_0xa7c9('0x2d')](_0xa7c9('0x39'),_0x622446,_0x9702f7[_0xa7c9('0x4e')]);_0x4d9d15[_0xa7c9('0x4c')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/strategy/agent.js b/server/services/routing/server/applications/strategy/agent.js index 2f4c654..6a6e2da 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 _0x355d=['routing','push','bind','timeout','handleDrained','prototype','handleRun','handleTimeout','info','[%s][AGENT]\x20try\x20with\x20%s','isNil','agents','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','isAgentAvailable','channel','busy','showNotification','writeLog','RINGING',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','busyQueue','TIMEOUT','exports','lodash','uuid','./util','../../../../../config/logger','notificationId','squeue','agent','realtime'];(function(_0x43a62d,_0x44367f){var _0x31e1f9=function(_0x35e322){while(--_0x35e322){_0x43a62d['push'](_0x43a62d['shift']());}};_0x31e1f9(++_0x44367f);}(_0x355d,0xa7));var _0xd355=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x355d[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xd355('0x0'));var uuid=require(_0xd355('0x1'));var util=require(_0xd355('0x2'));var logger=require(_0xd355('0x3'))('routing');var Agent=function(_0x2f9abe,_0x360c94,_0x455fe2,_0x16fcc7){this[_0xd355('0x4')]=uuid['v4']();this[_0xd355('0x5')]=_0x2f9abe;this[_0xd355('0x6')]=_0x360c94;this[_0xd355('0x7')]=_0x455fe2;this[_0xd355('0x8')]=_0x16fcc7;this[_0xd355('0x5')][_0xd355('0x9')](this['handleRun']['bind'](this),this['handleTimeout'][_0xd355('0xa')](this));this['squeue']['on'](_0xd355('0xb'),this['handleTimeout'][_0xd355('0xa')](this));this[_0xd355('0x5')]['on']('drained',this[_0xd355('0xc')][_0xd355('0xa')](this));};Agent[_0xd355('0xd')]['push']=function(){this[_0xd355('0x5')][_0xd355('0x9')](this[_0xd355('0xe')][_0xd355('0xa')](this),this[_0xd355('0xf')]['bind'](this));};Agent[_0xd355('0xd')][_0xd355('0xc')]=function(){this[_0xd355('0xf')](!![]);};Agent[_0xd355('0xd')][_0xd355('0xe')]=function(_0x22250c){logger[_0xd355('0x10')](_0xd355('0x11'),this['squeue']['id'],this[_0xd355('0x6')]['id']);if(_[_0xd355('0x12')](this['realtime'][_0xd355('0x13')][this[_0xd355('0x6')]['id']])){logger['info'](_0xd355('0x14'),this['squeue']['id'],this[_0xd355('0x6')]['id']);setTimeout(this[_0xd355('0x9')]['bind'](this),0x3e8);}else{if(this['routing'][_0xd355('0x15')]||util[_0xd355('0x16')](this[_0xd355('0x5')]['id'],this[_0xd355('0x7')][_0xd355('0x13')][this['agent']['id']],this[_0xd355('0x5')][_0xd355('0x17')],![])){this[_0xd355('0x7')][_0xd355('0x13')][this[_0xd355('0x6')]['id']][_0xd355('0x18')]=!![];this[_0xd355('0x7')]['agents'][this[_0xd355('0x6')]['id']]['busyQueue']=undefined;util[_0xd355('0x19')](this[_0xd355('0x4')],this[_0xd355('0x5')]['id'],this[_0xd355('0x7')][_0xd355('0x13')][this[_0xd355('0x6')]['id']],null,this[_0xd355('0x8')]);util[_0xd355('0x1a')](this[_0xd355('0x5')]['id'],this['realtime'][_0xd355('0x13')][this[_0xd355('0x6')]['id']],_0xd355('0x1b')+(this['routing'][_0xd355('0x15')]?_0xd355('0x1c'):''));}else{logger[_0xd355('0x10')](_0xd355('0x1d'),this[_0xd355('0x5')]['id'],this[_0xd355('0x6')]['id']);setTimeout(this['push'][_0xd355('0xa')](this),0x3e8);}}};Agent[_0xd355('0xd')]['handleTimeout']=function(_0x280aee){if(_[_0xd355('0x12')](this['realtime'][_0xd355('0x13')][this[_0xd355('0x6')]['id']])){return logger[_0xd355('0x10')](_0xd355('0x14'),this[_0xd355('0x5')]['id'],this[_0xd355('0x6')]['id']);}else{logger[_0xd355('0x10')](_0xd355('0x1e'),this[_0xd355('0x5')]['id'],this[_0xd355('0x6')]['id']);util[_0xd355('0x1f')](this['notificationId'],this[_0xd355('0x5')]['id'],this[_0xd355('0x7')][_0xd355('0x13')][this[_0xd355('0x6')]['id']],null,this['routing']);this['realtime']['agents'][this['agent']['id']][_0xd355('0x18')]=![];this['realtime']['agents'][this[_0xd355('0x6')]['id']][_0xd355('0x20')]=undefined;util[_0xd355('0x1a')](this[_0xd355('0x5')]['id'],this[_0xd355('0x7')][_0xd355('0x13')][this[_0xd355('0x6')]['id']],_0x280aee?'STOP':_0xd355('0x21'));}if(!_0x280aee){setTimeout(this['push'][_0xd355('0xa')](this),0x3e8);}};function agent(_0x221656,_0x4aacfd,_0x9933ec,_0x363fe6){return new Agent(_0x221656,_0x4aacfd,_0x9933ec,_0x363fe6);}module[_0xd355('0x22')]=agent; \ No newline at end of file +var _0x8a08=['RINGING',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','STOP','TIMEOUT','exports','lodash','uuid','./util','../../../../../config/logger','routing','notificationId','squeue','realtime','push','bind','handleTimeout','drained','handleDrained','prototype','handleRun','info','[%s][AGENT]\x20try\x20with\x20%s','isNil','agents','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','agent','isAgentAvailable','channel','busy','busyQueue','showNotification','writeLog'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0x8a08,0x1f2));var _0x88a0=function(_0x4c1e31,_0x4ff96d){_0x4c1e31=_0x4c1e31-0x0;var _0x58757c=_0x8a08[_0x4c1e31];return _0x58757c;};'use strict';var _=require(_0x88a0('0x0'));var uuid=require(_0x88a0('0x1'));var util=require(_0x88a0('0x2'));var logger=require(_0x88a0('0x3'))(_0x88a0('0x4'));var Agent=function(_0x49aba8,_0x3a0b90,_0x1ea0d1,_0x2eb5b1){this[_0x88a0('0x5')]=uuid['v4']();this[_0x88a0('0x6')]=_0x49aba8;this['agent']=_0x3a0b90;this[_0x88a0('0x7')]=_0x1ea0d1;this[_0x88a0('0x4')]=_0x2eb5b1;this[_0x88a0('0x6')][_0x88a0('0x8')](this['handleRun'][_0x88a0('0x9')](this),this[_0x88a0('0xa')][_0x88a0('0x9')](this));this[_0x88a0('0x6')]['on']('timeout',this[_0x88a0('0xa')][_0x88a0('0x9')](this));this[_0x88a0('0x6')]['on'](_0x88a0('0xb'),this[_0x88a0('0xc')]['bind'](this));};Agent[_0x88a0('0xd')][_0x88a0('0x8')]=function(){this[_0x88a0('0x6')][_0x88a0('0x8')](this[_0x88a0('0xe')]['bind'](this),this[_0x88a0('0xa')]['bind'](this));};Agent['prototype'][_0x88a0('0xc')]=function(){this[_0x88a0('0xa')](!![]);};Agent[_0x88a0('0xd')][_0x88a0('0xe')]=function(_0x313740){logger[_0x88a0('0xf')](_0x88a0('0x10'),this['squeue']['id'],this['agent']['id']);if(_[_0x88a0('0x11')](this[_0x88a0('0x7')][_0x88a0('0x12')][this['agent']['id']])){logger[_0x88a0('0xf')](_0x88a0('0x13'),this[_0x88a0('0x6')]['id'],this[_0x88a0('0x14')]['id']);setTimeout(this['push'][_0x88a0('0x9')](this),0x3e8);}else{if(this['routing']['forcedOwnership']||util[_0x88a0('0x15')](this[_0x88a0('0x6')]['id'],this['realtime'][_0x88a0('0x12')][this[_0x88a0('0x14')]['id']],this[_0x88a0('0x6')][_0x88a0('0x16')],![])){this['realtime']['agents'][this[_0x88a0('0x14')]['id']][_0x88a0('0x17')]=!![];this[_0x88a0('0x7')]['agents'][this[_0x88a0('0x14')]['id']][_0x88a0('0x18')]=undefined;util[_0x88a0('0x19')](this['notificationId'],this[_0x88a0('0x6')]['id'],this['realtime'][_0x88a0('0x12')][this[_0x88a0('0x14')]['id']],null,this[_0x88a0('0x4')]);util[_0x88a0('0x1a')](this[_0x88a0('0x6')]['id'],this[_0x88a0('0x7')][_0x88a0('0x12')][this[_0x88a0('0x14')]['id']],_0x88a0('0x1b')+(this[_0x88a0('0x4')]['forcedOwnership']?_0x88a0('0x1c'):''));}else{logger[_0x88a0('0xf')](_0x88a0('0x1d'),this[_0x88a0('0x6')]['id'],this[_0x88a0('0x14')]['id']);setTimeout(this[_0x88a0('0x8')]['bind'](this),0x3e8);}}};Agent['prototype']['handleTimeout']=function(_0xa68350){if(_[_0x88a0('0x11')](this['realtime'][_0x88a0('0x12')][this[_0x88a0('0x14')]['id']])){return logger[_0x88a0('0xf')](_0x88a0('0x13'),this[_0x88a0('0x6')]['id'],this[_0x88a0('0x14')]['id']);}else{logger[_0x88a0('0xf')](_0x88a0('0x1e'),this[_0x88a0('0x6')]['id'],this[_0x88a0('0x14')]['id']);util[_0x88a0('0x1f')](this[_0x88a0('0x5')],this[_0x88a0('0x6')]['id'],this[_0x88a0('0x7')][_0x88a0('0x12')][this[_0x88a0('0x14')]['id']],null,this[_0x88a0('0x4')]);this[_0x88a0('0x7')][_0x88a0('0x12')][this[_0x88a0('0x14')]['id']]['busy']=![];this['realtime'][_0x88a0('0x12')][this[_0x88a0('0x14')]['id']][_0x88a0('0x18')]=undefined;util[_0x88a0('0x1a')](this[_0x88a0('0x6')]['id'],this[_0x88a0('0x7')][_0x88a0('0x12')][this[_0x88a0('0x14')]['id']],_0xa68350?_0x88a0('0x20'):_0x88a0('0x21'));}if(!_0xa68350){setTimeout(this['push'][_0x88a0('0x9')](this),0x3e8);}};function agent(_0x2d9d1b,_0x247ea2,_0x5e7fe1,_0x1d14c3){return new Agent(_0x2d9d1b,_0x247ea2,_0x5e7fe1,_0x1d14c3);}module[_0x88a0('0x22')]=agent; \ No newline at end of file diff --git a/server/services/routing/server/applications/strategy/beepall.js b/server/services/routing/server/applications/strategy/beepall.js index 5b53e53..3f851c3 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 _0x06f4=['handleTimeout','drained','push','prototype','handleDrained','isNil','Agents','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','isAgentAvailable','agents','RINGING','busyQueue','name','[%s][QUEUE]\x20ALL\x20AGENTS\x20ARE\x20BUSY','info','[%s][QUEUE]\x20EMPTY','hideNotification','writeLog','STOP','TIMEOUT','busy','exports','lodash','uuid','../../../../../config/logger','routing','notificationId','squeue','queue','realtime','handleRun','bind'];(function(_0x461639,_0x11331f){var _0x4a85b1=function(_0x5a867f){while(--_0x5a867f){_0x461639['push'](_0x461639['shift']());}};_0x4a85b1(++_0x11331f);}(_0x06f4,0x136));var _0x406f=function(_0x4290e1,_0x552398){_0x4290e1=_0x4290e1-0x0;var _0x198aea=_0x06f4[_0x4290e1];return _0x198aea;};'use strict';var _=require(_0x406f('0x0'));var uuid=require(_0x406f('0x1'));var util=require('./util');var logger=require(_0x406f('0x2'))(_0x406f('0x3'));var Beepall=function(_0x58cd7d,_0x5cab5e,_0x3a4ff0,_0x5ed32f){this[_0x406f('0x4')]=uuid['v4']();this[_0x406f('0x5')]=_0x58cd7d;this[_0x406f('0x6')]=_0x5cab5e;this[_0x406f('0x7')]=_0x3a4ff0;this['routing']=_0x5ed32f;this[_0x406f('0x5')]['push'](this[_0x406f('0x8')][_0x406f('0x9')](this),this[_0x406f('0xa')]['bind'](this));this[_0x406f('0x5')]['on']('timeout',this['handleTimeout'][_0x406f('0x9')](this));this['squeue']['on'](_0x406f('0xb'),this['handleDrained'][_0x406f('0x9')](this));};Beepall['prototype'][_0x406f('0xc')]=function(){this[_0x406f('0x5')]['push'](this[_0x406f('0x8')][_0x406f('0x9')](this),this[_0x406f('0xa')][_0x406f('0x9')](this));};Beepall[_0x406f('0xd')][_0x406f('0xe')]=function(_0x29aef9){this[_0x406f('0xa')](!![]);};Beepall[_0x406f('0xd')][_0x406f('0x8')]=function(_0x2a3f3e){var _0x489445=!![];if(!_[_0x406f('0xf')](this[_0x406f('0x6')])&&!_[_0x406f('0xf')](this['queue'][_0x406f('0x10')])&&this[_0x406f('0x6')]['Agents']['length']>0x0){for(var _0x11c759=0x0,_0x4357e3;_0x11c7590x0){for(var _0x4da2b1=0x0,_0x1b8e27;_0x4da2b10x0&&_0x240000[_0x1f8d27+'CurrentCapacity']>=_0x240000[_0x1f8d27+_0x85d5('0x20')]){writeLog(_0x5ce96e,_0x240000,_0x1f8d27[_0x85d5('0x21')]()+_0x85d5('0x22'));return![];}}return!![];};exports['showNotification']=function(_0x2d0497,_0x367704,_0x815808,_0x370c97,_0x4605c5){return sendNotification(!![],_0x2d0497,_0x367704,_0x815808,_0x370c97,_0x4605c5);};exports['hideNotification']=function(_0x1cbef1,_0x476c8b,_0x330f8a,_0x22a961,_0x43ac91){return sendNotification(![],_0x1cbef1,_0x476c8b,_0x330f8a,_0x22a961,_0x43ac91);};exports['writeLog']=writeLog; \ No newline at end of file +var _0x3d04=['\x20interaction','account','notificationSound','body','queue','msg','notificationTemplate','error','[%s][QUEUE]\x20%s','message','name','notification:%s','save','remove','info','[%s][QUEUE][AGENT:%s][STATUS:%s]','isAgentAvailable','BUSY','online','Pause','hasOwnProperty','Capacity','CurrentCapacity','toUpperCase','\x20MAXCAPACITY','hideNotification','lodash','util','../utils','mustache','ioredis','../../../../../config/environment','../../../../../config/logger','routing','defaults','redis','localhost','socket.io-emitter','emit','format','user:save'];(function(_0x2a7298,_0x54b9df){var _0xbc7a81=function(_0x506cb2){while(--_0x506cb2){_0x2a7298['push'](_0x2a7298['shift']());}};_0xbc7a81(++_0x54b9df);}(_0x3d04,0xbe));var _0x43d0=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x3d04[_0x3b380d];return _0x54502b;};'use strict';var _=require(_0x43d0('0x0'));var util=require(_0x43d0('0x1'));var utils=require(_0x43d0('0x2'));var Mustache=require(_0x43d0('0x3'));var Redis=require(_0x43d0('0x4'));var config=require(_0x43d0('0x5'));var logger=require(_0x43d0('0x6'))(_0x43d0('0x7'));config['redis']=_[_0x43d0('0x8')](config[_0x43d0('0x9')],{'host':_0x43d0('0xa'),'port':0x18eb});var io=require(_0x43d0('0xb'))(new Redis(config['redis']));function emit(_0x484271,_0x50919e,_0x5efb95){io['to'](_0x484271)[_0x43d0('0xc')](_0x50919e,_0x5efb95);}function sendNotification(_0x3344d3,_0x331421,_0x46e560,_0x44a763,_0x4d75d9,_0x54e570){io['to'](util[_0x43d0('0xd')]('user:%s',_0x44a763['name']))[_0x43d0('0xc')](_0x43d0('0xe'),_0x44a763);var _0x2d7768=_0x54e570||{};var _0x375174=_0x46e560['split']('.');var _0x45e9b2={'uniqueid':_0x331421,'channel':_0x375174[0x0],'id':_0x375174[0x1],'title':_0x375174[0x0]+_0x43d0('0xf'),'interactionId':_0x375174[0x2],'queue':_0x4d75d9?_0x4d75d9['name']:null,'sound':_0x2d7768[_0x43d0('0x10')][_0x43d0('0x11')],'shake':_0x2d7768[_0x43d0('0x10')]['notificationShake']};try{if(!_0x2d7768[_0x43d0('0x12')]){_0x2d7768[_0x43d0('0x12')]={};}if(_0x4d75d9){_0x2d7768[_0x43d0('0x12')]['queue']=_0x4d75d9;}else if(_0x2d7768[_0x43d0('0x12')][_0x43d0('0x13')]){delete _0x2d7768[_0x43d0('0x12')][_0x43d0('0x13')];}_0x45e9b2[_0x43d0('0x14')]=utils['getMustacheRender'](_0x2d7768['account'][_0x43d0('0x15')],_0x2d7768);}catch(_0x3356f1){_0x45e9b2[_0x43d0('0x14')]='I\x20can\x27t\x20render\x20your\x20template';logger[_0x43d0('0x16')](util['format'](_0x43d0('0x17'),_0x331421,_0x3356f1[_0x43d0('0x18')]));}io['to'](util[_0x43d0('0xd')]('user:%s',_0x44a763[_0x43d0('0x19')]))[_0x43d0('0xc')](util['format'](_0x43d0('0x1a'),_0x3344d3?_0x43d0('0x1b'):_0x43d0('0x1c')),_0x45e9b2);}function writeLog(_0x248622,_0x3009a7,_0x28381b){return logger[_0x43d0('0x1d')](util[_0x43d0('0xd')](_0x43d0('0x1e'),_0x248622,_0x3009a7[_0x43d0('0x19')],_0x28381b));}exports[_0x43d0('0x1f')]=function(_0x19d2ff,_0x326be8,_0xbc72e6,_0x2efd77){if(_0x326be8['busy']){writeLog(_0x19d2ff,_0x326be8,_0x43d0('0x20'));return![];}if(!_0x326be8[_0x43d0('0x21')]){writeLog(_0x19d2ff,_0x326be8,'OFFLINE');return![];}if(_0x326be8[_0xbc72e6+_0x43d0('0x22')]){writeLog(_0x19d2ff,_0x326be8,'PAUSE');return![];}if(_0x2efd77&&_0x326be8[_0x43d0('0x23')](_0xbc72e6+_0x43d0('0x24'))&&_0x326be8['hasOwnProperty'](_0xbc72e6+_0x43d0('0x25'))){if(_0x326be8[_0xbc72e6+_0x43d0('0x24')]>0x0&&_0x326be8[_0xbc72e6+'CurrentCapacity']>=_0x326be8[_0xbc72e6+_0x43d0('0x24')]){writeLog(_0x19d2ff,_0x326be8,_0xbc72e6[_0x43d0('0x26')]()+_0x43d0('0x27'));return![];}}return!![];};exports['showNotification']=function(_0x447725,_0x38e89e,_0x2c4f3f,_0x1eb771,_0x37d78f){return sendNotification(!![],_0x447725,_0x38e89e,_0x2c4f3f,_0x1eb771,_0x37d78f);};exports[_0x43d0('0x28')]=function(_0x31a057,_0x4a3cd4,_0x2b0784,_0x2f5bc5,_0x6bc471){return sendNotification(![],_0x31a057,_0x4a3cd4,_0x2b0784,_0x2f5bc5,_0x6bc471);};exports['writeLog']=writeLog; \ No newline at end of file diff --git a/server/services/routing/server/applications/system.js b/server/services/routing/server/applications/system.js index 74d4a18..55f97da 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 _0x014e=['isEmpty','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','isObject','stringify','shelljs','lodash','./utils','../../../../config/logger','routing','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','validate','length','error','map','message','join','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','getMustacheRender','[%s][SYSTEM]\x20commnad:\x20%s'];(function(_0x1eb97a,_0x1227d2){var _0x204f4f=function(_0x14d022){while(--_0x14d022){_0x1eb97a['push'](_0x1eb97a['shift']());}};_0x204f4f(++_0x1227d2);}(_0x014e,0x16d));var _0xe014=function(_0x248658,_0x31f531){_0x248658=_0x248658-0x0;var _0x476768=_0x014e[_0x248658];return _0x476768;};'use strict';var schema=require('validate');var sh=require(_0xe014('0x0'));var _=require(_0xe014('0x1'));var utils=require(_0xe014('0x2'));var logger=require(_0xe014('0x3'))(_0xe014('0x4'));var system=schema({'command':{'type':_0xe014('0x5'),'required':!![],'message':_0xe014('0x6')}});exports[_0xe014('0x7')]=function(_0x31c63b,_0x595525){return function(_0x1e04b5){try{var _0x22ff25={'command':_0x595525[0x0]};var _0x16f81f=system[_0xe014('0x8')](_0x22ff25,{'typecast':!![]});if(_0x16f81f[_0xe014('0x9')]){logger[_0xe014('0xa')]('[%s][SYSTEM]\x20%s',_0x31c63b,_[_0xe014('0xb')](_0x16f81f,_0xe014('0xc'))[_0xe014('0xd')](',\x20'));logger[_0xe014('0xe')](_0xe014('0xf'),_0x31c63b);_0x1e04b5[_0xe014('0x10')]();}else{var _0x29d98d=this;var _0x121a6e=utils[_0xe014('0x11')](_0x595525[0x0],this);logger[_0xe014('0xe')](_0xe014('0x12'),_0x31c63b,_0x121a6e);sh['exec'](_['trim'](_0x121a6e),function(_0x380adc,_0x217a6e){logger[_0xe014('0xe')]('[%s][SYSTEM]\x20result\x20code:\x20%s',_0x31c63b,_0x380adc);if(_0x380adc==0x0){var _0x2033d6=_0x217a6e['replace'](/(\r\n|\n|\r)/gm,'');if(_['isNil'](_0x595525[0x1])||_[_0xe014('0x13')](_0x595525[0x1])){logger[_0xe014('0xe')]('[%s][SYSTEM]\x20no\x20variable',_0x31c63b);_0x29d98d[_0xe014('0x14')][_0x595525[0x1]]=_0x2033d6;}else{logger[_0xe014('0xe')](_0xe014('0x15'),_0x31c63b,_0x595525[0x1],_0x2033d6);_0x29d98d[_0xe014('0x14')][_0x595525[0x1]]=_0x2033d6;}}_0x1e04b5[_0xe014('0x10')]();});}}catch(_0x3ba210){logger['error']('[%s][SYSTEM]\x20%s',_0x31c63b,_[_0xe014('0x16')](_0x3ba210)?JSON[_0xe014('0x17')](_0x3ba210):_0x3ba210);logger[_0xe014('0xe')](_0xe014('0xf'),_0x31c63b);_0x1e04b5[_0xe014('0x10')]();}};}; \ No newline at end of file +var _0xc03d=['[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isEmpty','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','next','isObject','stringify','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','validate','shelljs','lodash','../../../../config/logger','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','error','[%s][SYSTEM]\x20%s','map','message','join','info','getMustacheRender','[%s][SYSTEM]\x20commnad:\x20%s','exec','trim'];(function(_0xfcf877,_0x4d0b1e){var _0x2145f3=function(_0x51cc4a){while(--_0x51cc4a){_0xfcf877['push'](_0xfcf877['shift']());}};_0x2145f3(++_0x4d0b1e);}(_0xc03d,0x127));var _0xdc03=function(_0x538404,_0x3988ee){_0x538404=_0x538404-0x0;var _0x45b9ba=_0xc03d[_0x538404];return _0x45b9ba;};'use strict';var schema=require(_0xdc03('0x0'));var sh=require(_0xdc03('0x1'));var _=require(_0xdc03('0x2'));var utils=require('./utils');var logger=require(_0xdc03('0x3'))('routing');var system=schema({'command':{'type':'string','required':!![],'message':_0xdc03('0x4')}});exports[_0xdc03('0x5')]=function(_0x3692a3,_0xbb2ba4){return function(_0x49e6b0){try{var _0x2fc71d={'command':_0xbb2ba4[0x0]};var _0x36ec86=system[_0xdc03('0x0')](_0x2fc71d,{'typecast':!![]});if(_0x36ec86[_0xdc03('0x6')]){logger[_0xdc03('0x7')](_0xdc03('0x8'),_0x3692a3,_[_0xdc03('0x9')](_0x36ec86,_0xdc03('0xa'))[_0xdc03('0xb')](',\x20'));logger[_0xdc03('0xc')]('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0x3692a3);_0x49e6b0['next']();}else{var _0x38c75f=this;var _0x476d76=utils[_0xdc03('0xd')](_0xbb2ba4[0x0],this);logger[_0xdc03('0xc')](_0xdc03('0xe'),_0x3692a3,_0x476d76);sh[_0xdc03('0xf')](_[_0xdc03('0x10')](_0x476d76),function(_0x50d01a,_0x364e2e){logger[_0xdc03('0xc')](_0xdc03('0x11'),_0x3692a3,_0x50d01a);if(_0x50d01a==0x0){var _0x1d27f0=_0x364e2e[_0xdc03('0x12')](/(\r\n|\n|\r)/gm,'');if(_['isNil'](_0xbb2ba4[0x1])||_[_0xdc03('0x13')](_0xbb2ba4[0x1])){logger[_0xdc03('0xc')]('[%s][SYSTEM]\x20no\x20variable',_0x3692a3);_0x38c75f[_0xdc03('0x14')][_0xbb2ba4[0x1]]=_0x1d27f0;}else{logger['info'](_0xdc03('0x15'),_0x3692a3,_0xbb2ba4[0x1],_0x1d27f0);_0x38c75f[_0xdc03('0x14')][_0xbb2ba4[0x1]]=_0x1d27f0;}}_0x49e6b0[_0xdc03('0x16')]();});}}catch(_0x16e062){logger[_0xdc03('0x7')](_0xdc03('0x8'),_0x3692a3,_[_0xdc03('0x17')](_0x16e062)?JSON[_0xdc03('0x18')](_0x16e062):_0x16e062);logger['info'](_0xdc03('0x19'),_0x3692a3);_0x49e6b0[_0xdc03('0x16')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/tag.js b/server/services/routing/server/applications/tag.js index a1e788f..b32077a 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 _0x9cc5=['../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../../../config/logger','routing','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','[%s][TAG]\x20%s','map','message','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','next','Interaction','addTags','then','interaction','catch','error','stringify','isObject','validate','lodash','../../rpc/chatInteraction','../../rpc/smsInteraction'];(function(_0x46de0a,_0x21c0d3){var _0x244f92=function(_0x5edb09){while(--_0x5edb09){_0x46de0a['push'](_0x46de0a['shift']());}};_0x244f92(++_0x21c0d3);}(_0x9cc5,0xd4));var _0x59cc=function(_0x4c0695,_0x1f9dc0){_0x4c0695=_0x4c0695-0x0;var _0x5cecc3=_0x9cc5[_0x4c0695];return _0x5cecc3;};'use strict';var schema=require(_0x59cc('0x0'));var _=require(_0x59cc('0x1'));var rpc={'chatInteraction':require(_0x59cc('0x2')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'smsInteraction':require(_0x59cc('0x3')),'mailInteraction':require(_0x59cc('0x4')),'faxInteraction':require(_0x59cc('0x5')),'whatsappInteraction':require(_0x59cc('0x6'))};var logger=require(_0x59cc('0x7'))(_0x59cc('0x8'));var tag=schema({'tag':{'type':_0x59cc('0x9'),'required':!![],'message':_0x59cc('0xa')}});exports[_0x59cc('0xb')]=function(_0x46cf90,_0x4f5c74,_0x49fa62,_0x107934){return function(_0x35d6f4){try{var _0x4e2f80={'tag':_0x4f5c74[0x0]};var _0x1023bc=tag[_0x59cc('0x0')](_0x4e2f80,{'typecast':!![]});if(_0x1023bc[_0x59cc('0xc')]){logger['error'](_0x59cc('0xd'),_0x46cf90,_[_0x59cc('0xe')](_0x1023bc,_0x59cc('0xf'))['join'](',\x20'));logger[_0x59cc('0x10')](_0x59cc('0x11'),_0x46cf90);_0x35d6f4[_0x59cc('0x12')]();}else{var _0x3b0677={'ids':[_0x4f5c74[0x0]]};if(rpc[_0x107934['channel']+_0x59cc('0x13')]){rpc[_0x107934['channel']+_0x59cc('0x13')][_0x59cc('0x14')](_0x107934['interaction']['id'],_0x3b0677)[_0x59cc('0x15')](function(_0x5e62c2){logger['info']('[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s',_0x46cf90,_0x4f5c74[0x1],_0x107934['channel'],_0x107934[_0x59cc('0x16')]['id']);})[_0x59cc('0x17')](function(_0x3ed0e3){logger[_0x59cc('0x18')]('[%s][TAG]\x20%s',_0x46cf90,JSON[_0x59cc('0x19')](_0x3ed0e3));logger['info'](_0x59cc('0x11'),_0x46cf90);})['finally'](function(){_0x35d6f4[_0x59cc('0x12')]();});}}}catch(_0x3e04ec){logger[_0x59cc('0x18')](_0x59cc('0xd'),_0x46cf90,_[_0x59cc('0x1a')](_0x3e04ec)?JSON[_0x59cc('0x19')](_0x3e04ec):_0x3e04ec);logger[_0x59cc('0x10')](_0x59cc('0x11'),_0x46cf90);_0x35d6f4[_0x59cc('0x12')]();}};}; \ No newline at end of file +var _0xb2ee=['[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','[%s][TAG]\x20%s','stringify','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','finally','isObject','validate','lodash','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/whatsappInteraction','../../../../config/logger','routing','number','consequence','length','error','message','next','Interaction','channel','interaction','then'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xb2ee,0x101));var _0xeb2e=function(_0x319380,_0x5ecd07){_0x319380=_0x319380-0x0;var _0x1f0823=_0xb2ee[_0x319380];return _0x1f0823;};'use strict';var schema=require(_0xeb2e('0x0'));var _=require(_0xeb2e('0x1'));var rpc={'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require(_0xeb2e('0x2')),'smsInteraction':require(_0xeb2e('0x3')),'mailInteraction':require(_0xeb2e('0x4')),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require(_0xeb2e('0x5'))};var logger=require(_0xeb2e('0x6'))(_0xeb2e('0x7'));var tag=schema({'tag':{'type':_0xeb2e('0x8'),'required':!![],'message':'TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required'}});exports[_0xeb2e('0x9')]=function(_0x97bab6,_0x4bbe1a,_0x34597d,_0x3e83a1){return function(_0x4b1ea2){try{var _0x5a94d0={'tag':_0x4bbe1a[0x0]};var _0x5b0821=tag[_0xeb2e('0x0')](_0x5a94d0,{'typecast':!![]});if(_0x5b0821[_0xeb2e('0xa')]){logger[_0xeb2e('0xb')]('[%s][TAG]\x20%s',_0x97bab6,_['map'](_0x5b0821,_0xeb2e('0xc'))['join'](',\x20'));logger['info']('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x97bab6);_0x4b1ea2[_0xeb2e('0xd')]();}else{var _0x382694={'ids':[_0x4bbe1a[0x0]]};if(rpc[_0x3e83a1['channel']+_0xeb2e('0xe')]){rpc[_0x3e83a1[_0xeb2e('0xf')]+'Interaction']['addTags'](_0x3e83a1[_0xeb2e('0x10')]['id'],_0x382694)[_0xeb2e('0x11')](function(_0x452d8b){logger['info'](_0xeb2e('0x12'),_0x97bab6,_0x4bbe1a[0x1],_0x3e83a1[_0xeb2e('0xf')],_0x3e83a1[_0xeb2e('0x10')]['id']);})['catch'](function(_0x418eef){logger[_0xeb2e('0xb')](_0xeb2e('0x13'),_0x97bab6,JSON[_0xeb2e('0x14')](_0x418eef));logger[_0xeb2e('0x15')](_0xeb2e('0x16'),_0x97bab6);})[_0xeb2e('0x17')](function(){_0x4b1ea2[_0xeb2e('0xd')]();});}}}catch(_0x2d3253){logger[_0xeb2e('0xb')](_0xeb2e('0x13'),_0x97bab6,_[_0xeb2e('0x18')](_0x2d3253)?JSON[_0xeb2e('0x14')](_0x2d3253):_0x2d3253);logger[_0xeb2e('0x15')](_0xeb2e('0x16'),_0x97bab6);_0x4b1ea2[_0xeb2e('0xd')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/utils.js b/server/services/routing/server/applications/utils.js index e3097f1..27a4221 100644 --- a/server/services/routing/server/applications/utils.js +++ b/server/services/routing/server/applications/utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['exports','render','merge','body','contact','message','account','interaction','list','mustache','lodash'];(function(_0x6665e1,_0x31907e){var _0x4faea0=function(_0x34aa4b){while(--_0x34aa4b){_0x6665e1['push'](_0x6665e1['shift']());}};_0x4faea0(++_0x31907e);}(_0xe706,0xa3));var _0x6e70=function(_0x9edfd5,_0x286486){_0x9edfd5=_0x9edfd5-0x0;var _0x330738=_0xe706[_0x9edfd5];return _0x330738;};'use strict';var Mustache=require(_0x6e70('0x0'));var _=require(_0x6e70('0x1'));module[_0x6e70('0x2')]={'getMustacheRender':function(_0x5e8446,_0x2cae77){return Mustache[_0x6e70('0x3')](_0x5e8446,_[_0x6e70('0x4')](_0x2cae77[_0x6e70('0x5')],{'contact':_0x2cae77[_0x6e70('0x6')],'message':_0x2cae77[_0x6e70('0x7')],'account':_0x2cae77[_0x6e70('0x8')],'interaction':_0x2cae77[_0x6e70('0x9')],'list':_0x2cae77[_0x6e70('0xa')]}))||'';}}; \ No newline at end of file +var _0xd8b0=['merge','body','contact','message','list','mustache','lodash','render'];(function(_0x3fa871,_0x50a4c7){var _0x55da0d=function(_0x252dde){while(--_0x252dde){_0x3fa871['push'](_0x3fa871['shift']());}};_0x55da0d(++_0x50a4c7);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var Mustache=require(_0x0d8b('0x0'));var _=require(_0x0d8b('0x1'));module['exports']={'getMustacheRender':function(_0x585166,_0x4b72b0){return Mustache[_0x0d8b('0x2')](_0x585166,_[_0x0d8b('0x3')](_0x4b72b0[_0x0d8b('0x4')],{'contact':_0x4b72b0[_0x0d8b('0x5')],'message':_0x4b72b0[_0x0d8b('0x6')],'account':_0x4b72b0['account'],'interaction':_0x4b72b0['interaction'],'list':_0x4b72b0[_0x0d8b('0x7')]}))||'';}}; \ No newline at end of file diff --git a/server/services/routing/server/index.js b/server/services/routing/server/index.js index 8483e13..5b8a2f5 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 _0x7799=['127.0.0.1','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','path','jayson/promise','bluebird','uuid','../../../config/logger','routing','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/smsQueueReport','format','%s.%s.%s','isNil','IntervalId','Intervals','map','interval','listen','rules','channel','message','interaction','applications','isArray','length','existsSync','app','autoreply','appdata','push','slice','join','dialogflow','split','amazonlex','TagId','%s:%s:%s','./interval','intervals','./applications/','priority','on\x20interval','\x20|\x20','error','Please\x20create\x20a\x20new\x20file\x20under','execute','info','Applications\x20executed','stringify','matchPath','emit','complete','No\x20applications\x20to\x20execute','stack','agent','agents','busy','busyQueue','end','QueueReport','update','UserId','error\x20update\x20queue\x20report','message\x20is\x20empty','capacity','hasOwnProperty','CurrentCapacity','updateRealtime','agent\x20not\x20found','chatQueues','loggedIn','name','paused','waiting','mailQueues','available','openchannelQueues','smsQueues','faxQueues','whatsappQueues','values','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','http'];(function(_0x411457,_0x4fbd5a){var _0x52b91a=function(_0x338ea5){while(--_0x338ea5){_0x411457['push'](_0x411457['shift']());}};_0x52b91a(++_0x4fbd5a);}(_0x7799,0xbc));var _0x9779=function(_0x4aa4e6,_0x278c45){_0x4aa4e6=_0x4aa4e6-0x0;var _0x322588=_0x7799[_0x4aa4e6];return _0x322588;};'use strict';var _=require(_0x9779('0x0'));var util=require('util');var path=require(_0x9779('0x1'));var fs=require('fs');var jayson=require(_0x9779('0x2'));var BPromise=require(_0x9779('0x3'));var uuid=require(_0x9779('0x4'));var config=require('../../../config/environment');var logger=require(_0x9779('0x5'))(_0x9779('0x6'));var rpc={'openchannelQueueReport':require(_0x9779('0x7')),'mailQueueReport':require(_0x9779('0x8')),'chatQueueReport':require('../rpc/chatQueueReport'),'smsQueueReport':require(_0x9779('0x9')),'faxQueueReport':require('../rpc/faxQueueReport'),'whatsappQueueReport':require('../rpc/whatsappQueueReport')};var RuleEngine=require('../lib/rule-engine');function getId(_0x1e83d0,_0x338c7c,_0x5e7187){return util[_0x9779('0xa')](_0x9779('0xb'),_0x1e83d0,_0x338c7c||0x0,_0x5e7187||0x0);}function getIntervals(_0x244f28,_0x2ab8c8){var _0x2bed54=[];if(!_[_0x9779('0xc')](_0x2ab8c8[_0x9779('0xd')])&&!_[_0x9779('0xc')](_0x244f28[_0x2ab8c8[_0x9779('0xd')]])&&!_[_0x9779('0xc')](_0x244f28[_0x2ab8c8[_0x9779('0xd')]][_0x9779('0xe')])){_0x2bed54=_[_0x9779('0xf')](_0x244f28[_0x2ab8c8[_0x9779('0xd')]][_0x9779('0xe')],_0x9779('0x10'));}else if(!_[_0x9779('0xc')](_0x2ab8c8[_0x9779('0x10')])){_0x2bed54=[_0x2ab8c8[_0x9779('0x10')]];}return _0x2bed54;}exports[_0x9779('0x11')]=function(_0x252ceb){_0x252ceb[_0x9779('0x12')]={};return new BPromise(function(_0x3cfa54,_0x1ddc6a){var _0x524f71={'Start':function(_0x542d6d){var _0x40862f=this;return new Promise(function(_0x47a55a,_0xe076e8){if(_0x542d6d){try{var _0xb179d9=[];var _0x34c6fe=getId(_0x542d6d[_0x9779('0x13')],_0x542d6d[_0x9779('0x14')]?_0x542d6d['message']['id']:0x0,_0x542d6d[_0x9779('0x15')]?_0x542d6d[_0x9779('0x15')]['id']:0x0);if(_0x542d6d[_0x9779('0x16')]&&_[_0x9779('0x17')](_0x542d6d['applications'])&&_0x542d6d[_0x9779('0x16')]['length']){for(var _0x50557b=0x0;_0x50557b<_0x542d6d[_0x9779('0x16')][_0x9779('0x18')];_0x50557b+=0x1){var _0x1caba2=_0x542d6d[_0x9779('0x16')][_0x50557b];if(fs[_0x9779('0x19')](path['join'](__dirname,'applications',_0x1caba2[_0x9779('0x1a')]+'.js'))){var _0x5e411f=[];switch(_0x1caba2[_0x9779('0x1a')]['toLowerCase']()){case _0x9779('0x1b'):var _0x2d11a8=_0x1caba2[_0x9779('0x1c')]['split'](',');if(_0x542d6d[_0x9779('0x13')]==='mail'){_0x5e411f[_0x9779('0x1d')](_0x2d11a8[0x0]);_0x5e411f[_0x9779('0x1d')](_0x2d11a8[0x1]);_0x5e411f[_0x9779('0x1d')](_0x2d11a8[_0x9779('0x1e')](0x2,_0x2d11a8[_0x9779('0x18')])['join'](','));}else{_0x5e411f[_0x9779('0x1d')](_0x2d11a8[0x0]);_0x5e411f[_0x9779('0x1d')](_0x2d11a8[_0x9779('0x1e')](0x1,_0x2d11a8[_0x9779('0x18')])[_0x9779('0x1f')](','));}break;case _0x9779('0x20'):var _0x2bba00=_0x1caba2[_0x9779('0x1c')][_0x9779('0x21')](',');_0x5e411f[_0x9779('0x1d')](_0x2bba00[0x0]);_0x5e411f[_0x9779('0x1d')](_0x2bba00[0x1]);_0x5e411f[_0x9779('0x1d')](_0x2bba00[_0x9779('0x1e')](0x2,_0x2bba00['length'])[_0x9779('0x1f')](','));break;case'dialogflowv2':var _0x1bff71=_0x1caba2[_0x9779('0x1c')][_0x9779('0x21')](',');_0x5e411f[_0x9779('0x1d')](_0x1bff71[0x0]);_0x5e411f[_0x9779('0x1d')](_0x1bff71[0x1]);_0x5e411f[_0x9779('0x1d')](_0x1bff71[0x2]);_0x5e411f['push'](_0x1bff71[0x3]);_0x5e411f[_0x9779('0x1d')](_0x1bff71[_0x9779('0x1e')](0x4,_0x1bff71[_0x9779('0x18')])[_0x9779('0x1f')](','));break;case _0x9779('0x22'):var _0x6c442a=_0x1caba2[_0x9779('0x1c')][_0x9779('0x21')](',');_0x5e411f[_0x9779('0x1d')](_0x6c442a[0x0]);_0x5e411f['push'](_0x6c442a[0x1]);_0x5e411f[_0x9779('0x1d')](_0x6c442a[0x2]);_0x5e411f[_0x9779('0x1d')](_0x6c442a[0x3]);_0x5e411f['push'](_0x6c442a[_0x9779('0x1e')](0x4,_0x6c442a[_0x9779('0x18')])[_0x9779('0x1f')](','));break;case _0x9779('0x14'):_0x5e411f[_0x9779('0x1d')](_0x1caba2[_0x9779('0x1c')]);break;case'tag':_0x5e411f['push'](_0x1caba2[_0x9779('0x23')]);_0x5e411f[_0x9779('0x1d')](_0x1caba2[_0x9779('0x1c')]);break;default:_0x5e411f=_[_0x9779('0xc')](_0x1caba2[_0x9779('0x1c')])?[]:_0x1caba2[_0x9779('0x1c')]['split'](',');}var _0x558855={'id':util[_0x9779('0xa')](_0x9779('0x24'),_0x34c6fe,_0x1caba2['id'],_0x1caba2[_0x9779('0x1a')]),'condition':require(_0x9779('0x25'))['condition'](_0x34c6fe,getIntervals(_0x252ceb[_0x9779('0x26')],_0x1caba2),_0x252ceb),'consequence':require(_0x9779('0x27')+_0x1caba2[_0x9779('0x1a')])['consequence'](_0x34c6fe,_0x5e411f,_0x252ceb,_0x542d6d),'p':_0x1caba2[_0x9779('0x28')]||0x0};logger['info']('Push\x20new\x20rule',_0x558855['id'],_0x9779('0x29'),getIntervals(_0x252ceb['intervals'],_0x1caba2)[_0x9779('0x1f')](_0x9779('0x2a')));_0xb179d9[_0x9779('0x1d')](_0x558855);}else{logger[_0x9779('0x2b')](_0x9779('0x2c'),path[_0x9779('0x1f')](__dirname,_0x9779('0x16'),_0x1caba2[_0x9779('0x1a')]+'.js'));}}_0x252ceb['rules'][_0x34c6fe]=new RuleEngine(_0xb179d9);_0x252ceb['rules'][_0x34c6fe][_0x9779('0x2d')](_0x542d6d,function(_0x4b0643){logger[_0x9779('0x2e')](_0x9779('0x2f'),JSON[_0x9779('0x30')](_0x4b0643[_0x9779('0x31')]));if(_0x252ceb[_0x9779('0x12')][_0x34c6fe]){_0x252ceb[_0x9779('0x12')][_0x34c6fe][_0x9779('0x32')](_0x9779('0x33'));}});return _0x47a55a({'code':0xc8,'message':_0x542d6d});}else{logger[_0x9779('0x2e')](_0x9779('0x34'));return _0x47a55a({'code':0xc8,'message':_0x542d6d});}}catch(_0x2b7fe1){logger[_0x9779('0x2b')](_0x2b7fe1[_0x9779('0x35')]);return _0xe076e8(_0x40862f[_0x9779('0x2b')](0x1f4,_0x2b7fe1));}}return _0xe076e8('routing\x20is\x20empty');});},'AcceptMessage':function(_0xd9728b){var _0x1e6061=this;return new Promise(function(_0xdbbc68,_0x581771){if(_0xd9728b[_0x9779('0x36')]&&_0xd9728b['agent']['id']){if(_0x252ceb[_0x9779('0x37')][_0xd9728b[_0x9779('0x36')]['id']]){_0x252ceb[_0x9779('0x37')][_0xd9728b['agent']['id']][_0x9779('0x38')]=![];_0x252ceb[_0x9779('0x37')][_0xd9728b['agent']['id']][_0x9779('0x39')]=undefined;}}if(_0xd9728b['message']&&_0xd9728b[_0x9779('0x14')]['id']){try{var _0x2f12e7=getId(_0xd9728b[_0x9779('0x13')],_0xd9728b[_0x9779('0x14')]?_0xd9728b[_0x9779('0x14')]['id']:0x0,_0xd9728b['interaction']?_0xd9728b[_0x9779('0x15')]['id']:0x0);if(_0x252ceb['rules'][_0x2f12e7]){_0x252ceb[_0x9779('0x12')][_0x2f12e7][_0x9779('0x32')](_0x9779('0x3a'));if(rpc[_0xd9728b['channel']+_0x9779('0x3b')]){rpc[_0xd9728b[_0x9779('0x13')]+'QueueReport'][_0x9779('0x3c')](_0x2f12e7,{'UserId':_0xd9728b[_0x9779('0x14')][_0x9779('0x3d')]})['catch'](function(_0x347765){logger[_0x9779('0x2b')](_0x9779('0x3e'));});}}return _0xdbbc68({'code':0xc8,'message':_0xd9728b});}catch(_0x2bc839){logger[_0x9779('0x2b')](_0x2bc839[_0x9779('0x35')]);return _0x581771(_0x1e6061['error'](0x1f4,_0x2bc839));}}logger[_0x9779('0x2b')](_0x9779('0x3f'));return _0x581771(_0x1e6061[_0x9779('0x2b')](0x1f4,'message\x20is\x20empty'));});},'RejectMessage':function(_0x9f5af4){var _0x4fd9c3=this;return new Promise(function(_0x5055c0,_0x42fbed){if(_0x9f5af4[_0x9779('0x36')]&&_0x9f5af4[_0x9779('0x36')]['id']){try{if(_0x252ceb[_0x9779('0x37')][_0x9f5af4[_0x9779('0x36')]['id']]){_0x252ceb['agents'][_0x9f5af4[_0x9779('0x36')]['id']][_0x9779('0x38')]=![];_0x252ceb[_0x9779('0x37')][_0x9f5af4['agent']['id']][_0x9779('0x39')]=undefined;}return _0x5055c0({'code':0xc8,'message':_0x9f5af4});}catch(_0x4f2cfc){logger[_0x9779('0x2b')](_0x4f2cfc[_0x9779('0x35')]);return _0x42fbed(_0x4fd9c3[_0x9779('0x2b')](0x1f4,_0x4f2cfc));}}logger[_0x9779('0x2b')](_0x9779('0x3f'));return _0x42fbed(_0x4fd9c3[_0x9779('0x2b')](0x1f4,_0x9779('0x3f')));});},'AbandonInteraction':function(_0x2b205b){var _0x225dc3=this;return new Promise(function(_0x46ae47,_0x3b977b){if(_0x2b205b[_0x9779('0x13')]&&_0x2b205b['interaction']&&_0x2b205b[_0x9779('0x15')]['id']){try{var _0x47dd79=getId(_0x2b205b[_0x9779('0x13')],_0x2b205b['message']?_0x2b205b[_0x9779('0x14')]['id']:0x0,_0x2b205b[_0x9779('0x15')]?_0x2b205b[_0x9779('0x15')]['id']:0x0);if(_0x252ceb[_0x9779('0x12')][_0x47dd79]){_0x252ceb[_0x9779('0x12')][_0x47dd79]['emit']('end');}return _0x46ae47({'code':0xc8,'message':_0x2b205b});}catch(_0xc15ccf){logger['error'](_0xc15ccf[_0x9779('0x35')]);return _0x3b977b(_0x225dc3['error'](0x1f4,_0xc15ccf));}}logger[_0x9779('0x2b')](_0x9779('0x3f'));return _0x3b977b(_0x225dc3[_0x9779('0x2b')](0x1f4,'message\x20is\x20empty'));});},'AgentCapacity':function(_0x3627ba){var _0x37d84a=this;return new Promise(function(_0xc0e6e2,_0x3c7855){if(_0x252ceb['agents']['hasOwnProperty'](_0x3627ba['id'])){for(var _0x4c4d50 in _0x3627ba['capacity']){if(_0x3627ba[_0x9779('0x40')][_0x9779('0x41')](_0x4c4d50)){if(_0x252ceb[_0x9779('0x37')][_0x3627ba['id']][_0x9779('0x41')](_0x4c4d50+_0x9779('0x42'))){_0x252ceb[_0x9779('0x37')][_0x3627ba['id']][_0x4c4d50+_0x9779('0x42')]=parseInt(_0x3627ba[_0x9779('0x40')][_0x4c4d50],0xa);}}}_0x252ceb[_0x9779('0x37')][_0x3627ba['id']][_0x9779('0x43')]();return _0xc0e6e2({'code':0xc8,'message':_0x252ceb[_0x9779('0x37')][_0x3627ba['id']]});}else{return _0x3c7855(_0x37d84a[_0x9779('0x2b')](0x1f4,_0x9779('0x44')));}});},'Agents':function(_0x139b3a){return new Promise(function(_0x5b3b83,_0x256e68){var _0x4431d6=_['values'](_0x252ceb[_0x9779('0x37')]);_0x5b3b83({'count':_0x4431d6[_0x9779('0x18')],'rows':_0x4431d6});});},'ChatQueues':function(_0x1678e8){return new Promise(function(_0x274c97,_0xc0212c){var _0x489ee4=[];for(var _0x1c80de in _0x252ceb[_0x9779('0x45')]){if(_0x252ceb[_0x9779('0x45')][_0x9779('0x41')](_0x1c80de)){var _0x2a65c0=_0x252ceb[_0x9779('0x45')][_0x1c80de];var _0x53efd3={'id':_0x2a65c0['id'],'available':_0x2a65c0['available'],'loggedIn':_0x2a65c0[_0x9779('0x46')],'name':_0x2a65c0[_0x9779('0x47')],'paused':_0x2a65c0[_0x9779('0x48')],'waiting':_0x2a65c0[_0x9779('0x49')]};_0x489ee4[_0x9779('0x1d')](_0x53efd3);}}_0x274c97({'count':_0x489ee4[_0x9779('0x18')],'rows':_0x489ee4});});},'MailQueues':function(_0x125ea9){return new Promise(function(_0x580ddc,_0x5475e7){var _0x5c7719=[];for(var _0x17a68c in _0x252ceb[_0x9779('0x4a')]){if(_0x252ceb[_0x9779('0x4a')][_0x9779('0x41')](_0x17a68c)){var _0x5b6f9a=_0x252ceb[_0x9779('0x4a')][_0x17a68c];var _0x5ecc69={'id':_0x5b6f9a['id'],'available':_0x5b6f9a[_0x9779('0x4b')],'loggedIn':_0x5b6f9a[_0x9779('0x46')],'name':_0x5b6f9a[_0x9779('0x47')],'paused':_0x5b6f9a[_0x9779('0x48')],'waiting':_0x5b6f9a[_0x9779('0x49')]};_0x5c7719['push'](_0x5ecc69);}}_0x580ddc({'count':_0x5c7719['length'],'rows':_0x5c7719});});},'OpenchannelQueues':function(_0x22aad8){return new Promise(function(_0x5b3649,_0x6a74f1){var _0x1efc13=[];for(var _0x4a97a3 in _0x252ceb[_0x9779('0x4c')]){if(_0x252ceb[_0x9779('0x4c')]['hasOwnProperty'](_0x4a97a3)){var _0x4567b6=_0x252ceb[_0x9779('0x4c')][_0x4a97a3];var _0x59329a={'id':_0x4567b6['id'],'available':_0x4567b6[_0x9779('0x4b')],'loggedIn':_0x4567b6[_0x9779('0x46')],'name':_0x4567b6['name'],'paused':_0x4567b6[_0x9779('0x48')],'waiting':_0x4567b6['waiting']};_0x1efc13[_0x9779('0x1d')](_0x59329a);}}_0x5b3649({'count':_0x1efc13[_0x9779('0x18')],'rows':_0x1efc13});});},'SmsQueues':function(_0x4a0a97){return new Promise(function(_0x5ee915,_0x452889){var _0x12b4a8=[];for(var _0x1d2aa6 in _0x252ceb[_0x9779('0x4d')]){if(_0x252ceb['smsQueues']['hasOwnProperty'](_0x1d2aa6)){var _0x2e248d=_0x252ceb['smsQueues'][_0x1d2aa6];var _0x309b5f={'id':_0x2e248d['id'],'available':_0x2e248d[_0x9779('0x4b')],'loggedIn':_0x2e248d[_0x9779('0x46')],'name':_0x2e248d['name'],'paused':_0x2e248d[_0x9779('0x48')],'waiting':_0x2e248d['waiting']};_0x12b4a8[_0x9779('0x1d')](_0x309b5f);}}_0x5ee915({'count':_0x12b4a8['length'],'rows':_0x12b4a8});});},'FaxQueues':function(_0x598d4a){return new Promise(function(_0x43cb0e,_0x4f6678){var _0x28ef80=[];for(var _0x2c136d in _0x252ceb[_0x9779('0x4e')]){if(_0x252ceb['faxQueues'][_0x9779('0x41')](_0x2c136d)){var _0x517f2b=_0x252ceb['faxQueues'][_0x2c136d];var _0x10486f={'id':_0x517f2b['id'],'available':_0x517f2b['available'],'loggedIn':_0x517f2b['loggedIn'],'name':_0x517f2b[_0x9779('0x47')],'paused':_0x517f2b[_0x9779('0x48')],'waiting':_0x517f2b[_0x9779('0x49')]};_0x28ef80[_0x9779('0x1d')](_0x10486f);}}_0x43cb0e({'count':_0x28ef80['length'],'rows':_0x28ef80});});},'WhatsappQueues':function(_0x48096b){return new Promise(function(_0x41d9e2,_0x1b0739){var _0x289954=[];for(var _0x1da211 in _0x252ceb[_0x9779('0x4f')]){if(_0x252ceb['whatsappQueues'][_0x9779('0x41')](_0x1da211)){var _0x598aa7=_0x252ceb[_0x9779('0x4f')][_0x1da211];var _0x301c91={'id':_0x598aa7['id'],'available':_0x598aa7[_0x9779('0x4b')],'loggedIn':_0x598aa7[_0x9779('0x46')],'name':_0x598aa7['name'],'paused':_0x598aa7[_0x9779('0x48')],'waiting':_0x598aa7['waiting']};_0x289954['push'](_0x301c91);}}_0x41d9e2({'count':_0x289954[_0x9779('0x18')],'rows':_0x289954});});},'ChatQueuesWaitingInteractions':function(_0x5029e3){return new Promise(function(_0x15b436,_0x579e04){var _0x975d17=_[_0x9779('0x50')](_0x252ceb[_0x9779('0x51')]);_0x15b436({'count':_0x975d17[_0x9779('0x18')],'rows':_0x975d17});});},'MailQueuesWaitingInteractions':function(_0x2db20e){return new Promise(function(_0x1d160e,_0x346037){var _0x5f5d5b=_[_0x9779('0x50')](_0x252ceb[_0x9779('0x52')]);_0x1d160e({'count':_0x5f5d5b[_0x9779('0x18')],'rows':_0x5f5d5b});});},'OpenchannelQueuesWaitingInteractions':function(_0x2ed9a2){return new Promise(function(_0x4faba0,_0x3a41e0){var _0xc446f9=_[_0x9779('0x50')](_0x252ceb['openchannelQueuesWaitingInteractions']);_0x4faba0({'count':_0xc446f9[_0x9779('0x18')],'rows':_0xc446f9});});},'SmsQueuesWaitingInteractions':function(_0x5b20e3){return new Promise(function(_0x3ac9de,_0x5e8d6a){var _0xadfe2b=_['values'](_0x252ceb[_0x9779('0x53')]);_0x3ac9de({'count':_0xadfe2b[_0x9779('0x18')],'rows':_0xadfe2b});});},'FaxQueuesWaitingInteractions':function(_0x57968d){return new Promise(function(_0x435ffc,_0x3d481e){var _0x14bd8e=_[_0x9779('0x50')](_0x252ceb[_0x9779('0x54')]);_0x435ffc({'count':_0x14bd8e[_0x9779('0x18')],'rows':_0x14bd8e});});},'WhatsappQueuesWaitingInteractions':function(_0x4bfaa4){return new Promise(function(_0x2ea63e,_0x498d6b){var _0x4d1b11=_[_0x9779('0x50')](_0x252ceb[_0x9779('0x55')]);_0x2ea63e({'count':_0x4d1b11[_0x9779('0x18')],'rows':_0x4d1b11});});}};var _0x350b3a=jayson[_0x9779('0x56')](_0x524f71)[_0x9779('0x57')]();_0x350b3a['on']('error',function(_0xec4b9f){logger[_0x9779('0x2b')](JSON[_0x9779('0x30')](_0xec4b9f));return _0x1ddc6a(_0xec4b9f);});_0x350b3a['listen'](0x232c,_0x9779('0x58'),function(){console[_0x9779('0x59')](_0x9779('0x5a'),0x232c);return _0x3cfa54(_0x9779('0x5b')+0x232c);});});}; \ No newline at end of file +var _0x7f56=['Please\x20create\x20a\x20new\x20file\x20under','rules','execute','Applications\x20executed','stringify','emit','complete','No\x20applications\x20to\x20execute','stack','routing\x20is\x20empty','agent','agents','busy','busyQueue','end','QueueReport','UserId','catch','error\x20update\x20queue\x20report','message\x20is\x20empty','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','values','chatQueues','waiting','mailQueues','available','loggedIn','name','paused','openchannelQueues','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','http','listen','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','util','path','bluebird','uuid','../../../config/environment','../../../config/logger','routing','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine','isNil','IntervalId','Intervals','map','interval','message','interaction','applications','length','existsSync','.js','toLowerCase','appdata','split','channel','mail','push','slice','join','dialogflow','dialogflowv2','amazonlex','tag','TagId','format','%s:%s:%s','app','./interval','condition','intervals','priority','info','Push\x20new\x20rule','on\x20interval','\x20|\x20','error'];(function(_0x34e37e,_0x3db1ca){var _0x4eb5a3=function(_0x9e3f45){while(--_0x9e3f45){_0x34e37e['push'](_0x34e37e['shift']());}};_0x4eb5a3(++_0x3db1ca);}(_0x7f56,0x155));var _0x67f5=function(_0x1a0600,_0x41feef){_0x1a0600=_0x1a0600-0x0;var _0x734670=_0x7f56[_0x1a0600];return _0x734670;};'use strict';var _=require(_0x67f5('0x0'));var util=require(_0x67f5('0x1'));var path=require(_0x67f5('0x2'));var fs=require('fs');var jayson=require('jayson/promise');var BPromise=require(_0x67f5('0x3'));var uuid=require(_0x67f5('0x4'));var config=require(_0x67f5('0x5'));var logger=require(_0x67f5('0x6'))(_0x67f5('0x7'));var rpc={'openchannelQueueReport':require(_0x67f5('0x8')),'mailQueueReport':require(_0x67f5('0x9')),'chatQueueReport':require(_0x67f5('0xa')),'smsQueueReport':require(_0x67f5('0xb')),'faxQueueReport':require(_0x67f5('0xc')),'whatsappQueueReport':require(_0x67f5('0xd'))};var RuleEngine=require(_0x67f5('0xe'));function getId(_0xe94053,_0xa1ae36,_0x25fa74){return util['format']('%s.%s.%s',_0xe94053,_0xa1ae36||0x0,_0x25fa74||0x0);}function getIntervals(_0xdce1ad,_0x1778b2){var _0x22194a=[];if(!_[_0x67f5('0xf')](_0x1778b2[_0x67f5('0x10')])&&!_[_0x67f5('0xf')](_0xdce1ad[_0x1778b2[_0x67f5('0x10')]])&&!_[_0x67f5('0xf')](_0xdce1ad[_0x1778b2[_0x67f5('0x10')]][_0x67f5('0x11')])){_0x22194a=_[_0x67f5('0x12')](_0xdce1ad[_0x1778b2[_0x67f5('0x10')]]['Intervals'],_0x67f5('0x13'));}else if(!_[_0x67f5('0xf')](_0x1778b2[_0x67f5('0x13')])){_0x22194a=[_0x1778b2[_0x67f5('0x13')]];}return _0x22194a;}exports['listen']=function(_0x182dbc){_0x182dbc['rules']={};return new BPromise(function(_0x19b7ac,_0x2f7dcd){var _0x3573f7={'Start':function(_0x1a2e6e){var _0x47efb9=this;return new Promise(function(_0x372e65,_0x543db7){if(_0x1a2e6e){try{var _0x1641c6=[];var _0x4f9880=getId(_0x1a2e6e['channel'],_0x1a2e6e['message']?_0x1a2e6e[_0x67f5('0x14')]['id']:0x0,_0x1a2e6e['interaction']?_0x1a2e6e[_0x67f5('0x15')]['id']:0x0);if(_0x1a2e6e[_0x67f5('0x16')]&&_['isArray'](_0x1a2e6e[_0x67f5('0x16')])&&_0x1a2e6e[_0x67f5('0x16')][_0x67f5('0x17')]){for(var _0x284573=0x0;_0x284573<_0x1a2e6e[_0x67f5('0x16')][_0x67f5('0x17')];_0x284573+=0x1){var _0x4213f0=_0x1a2e6e[_0x67f5('0x16')][_0x284573];if(fs[_0x67f5('0x18')](path['join'](__dirname,_0x67f5('0x16'),_0x4213f0['app']+_0x67f5('0x19')))){var _0x3a83fb=[];switch(_0x4213f0['app'][_0x67f5('0x1a')]()){case'autoreply':var _0x177f8c=_0x4213f0[_0x67f5('0x1b')][_0x67f5('0x1c')](',');if(_0x1a2e6e[_0x67f5('0x1d')]===_0x67f5('0x1e')){_0x3a83fb[_0x67f5('0x1f')](_0x177f8c[0x0]);_0x3a83fb['push'](_0x177f8c[0x1]);_0x3a83fb[_0x67f5('0x1f')](_0x177f8c[_0x67f5('0x20')](0x2,_0x177f8c[_0x67f5('0x17')])[_0x67f5('0x21')](','));}else{_0x3a83fb[_0x67f5('0x1f')](_0x177f8c[0x0]);_0x3a83fb[_0x67f5('0x1f')](_0x177f8c['slice'](0x1,_0x177f8c[_0x67f5('0x17')])[_0x67f5('0x21')](','));}break;case _0x67f5('0x22'):var _0x405a4d=_0x4213f0[_0x67f5('0x1b')]['split'](',');_0x3a83fb['push'](_0x405a4d[0x0]);_0x3a83fb['push'](_0x405a4d[0x1]);_0x3a83fb['push'](_0x405a4d['slice'](0x2,_0x405a4d[_0x67f5('0x17')])[_0x67f5('0x21')](','));break;case _0x67f5('0x23'):var _0x510d30=_0x4213f0[_0x67f5('0x1b')][_0x67f5('0x1c')](',');_0x3a83fb[_0x67f5('0x1f')](_0x510d30[0x0]);_0x3a83fb[_0x67f5('0x1f')](_0x510d30[0x1]);_0x3a83fb[_0x67f5('0x1f')](_0x510d30[0x2]);_0x3a83fb['push'](_0x510d30[0x3]);_0x3a83fb[_0x67f5('0x1f')](_0x510d30['slice'](0x4,_0x510d30[_0x67f5('0x17')])['join'](','));break;case _0x67f5('0x24'):var _0x21c2bb=_0x4213f0[_0x67f5('0x1b')]['split'](',');_0x3a83fb[_0x67f5('0x1f')](_0x21c2bb[0x0]);_0x3a83fb[_0x67f5('0x1f')](_0x21c2bb[0x1]);_0x3a83fb[_0x67f5('0x1f')](_0x21c2bb[0x2]);_0x3a83fb[_0x67f5('0x1f')](_0x21c2bb[0x3]);_0x3a83fb[_0x67f5('0x1f')](_0x21c2bb['slice'](0x4,_0x21c2bb[_0x67f5('0x17')])[_0x67f5('0x21')](','));break;case _0x67f5('0x14'):_0x3a83fb[_0x67f5('0x1f')](_0x4213f0[_0x67f5('0x1b')]);break;case _0x67f5('0x25'):_0x3a83fb[_0x67f5('0x1f')](_0x4213f0[_0x67f5('0x26')]);_0x3a83fb[_0x67f5('0x1f')](_0x4213f0[_0x67f5('0x1b')]);break;default:_0x3a83fb=_['isNil'](_0x4213f0[_0x67f5('0x1b')])?[]:_0x4213f0[_0x67f5('0x1b')][_0x67f5('0x1c')](',');}var _0x5f53e2={'id':util[_0x67f5('0x27')](_0x67f5('0x28'),_0x4f9880,_0x4213f0['id'],_0x4213f0[_0x67f5('0x29')]),'condition':require(_0x67f5('0x2a'))[_0x67f5('0x2b')](_0x4f9880,getIntervals(_0x182dbc[_0x67f5('0x2c')],_0x4213f0),_0x182dbc),'consequence':require('./applications/'+_0x4213f0[_0x67f5('0x29')])['consequence'](_0x4f9880,_0x3a83fb,_0x182dbc,_0x1a2e6e),'p':_0x4213f0[_0x67f5('0x2d')]||0x0};logger[_0x67f5('0x2e')](_0x67f5('0x2f'),_0x5f53e2['id'],_0x67f5('0x30'),getIntervals(_0x182dbc['intervals'],_0x4213f0)['join'](_0x67f5('0x31')));_0x1641c6[_0x67f5('0x1f')](_0x5f53e2);}else{logger[_0x67f5('0x32')](_0x67f5('0x33'),path[_0x67f5('0x21')](__dirname,'applications',_0x4213f0[_0x67f5('0x29')]+_0x67f5('0x19')));}}_0x182dbc[_0x67f5('0x34')][_0x4f9880]=new RuleEngine(_0x1641c6);_0x182dbc[_0x67f5('0x34')][_0x4f9880][_0x67f5('0x35')](_0x1a2e6e,function(_0x4977a0){logger[_0x67f5('0x2e')](_0x67f5('0x36'),JSON[_0x67f5('0x37')](_0x4977a0['matchPath']));if(_0x182dbc['rules'][_0x4f9880]){_0x182dbc[_0x67f5('0x34')][_0x4f9880][_0x67f5('0x38')](_0x67f5('0x39'));}});return _0x372e65({'code':0xc8,'message':_0x1a2e6e});}else{logger['info'](_0x67f5('0x3a'));return _0x372e65({'code':0xc8,'message':_0x1a2e6e});}}catch(_0x50b206){logger[_0x67f5('0x32')](_0x50b206[_0x67f5('0x3b')]);return _0x543db7(_0x47efb9[_0x67f5('0x32')](0x1f4,_0x50b206));}}return _0x543db7(_0x67f5('0x3c'));});},'AcceptMessage':function(_0x3e431f){var _0x24ae18=this;return new Promise(function(_0x368f2a,_0x24a620){if(_0x3e431f[_0x67f5('0x3d')]&&_0x3e431f[_0x67f5('0x3d')]['id']){if(_0x182dbc[_0x67f5('0x3e')][_0x3e431f[_0x67f5('0x3d')]['id']]){_0x182dbc[_0x67f5('0x3e')][_0x3e431f[_0x67f5('0x3d')]['id']][_0x67f5('0x3f')]=![];_0x182dbc[_0x67f5('0x3e')][_0x3e431f[_0x67f5('0x3d')]['id']][_0x67f5('0x40')]=undefined;}}if(_0x3e431f[_0x67f5('0x14')]&&_0x3e431f[_0x67f5('0x14')]['id']){try{var _0x50cbc6=getId(_0x3e431f[_0x67f5('0x1d')],_0x3e431f[_0x67f5('0x14')]?_0x3e431f[_0x67f5('0x14')]['id']:0x0,_0x3e431f['interaction']?_0x3e431f['interaction']['id']:0x0);if(_0x182dbc[_0x67f5('0x34')][_0x50cbc6]){_0x182dbc[_0x67f5('0x34')][_0x50cbc6]['emit'](_0x67f5('0x41'));if(rpc[_0x3e431f['channel']+_0x67f5('0x42')]){rpc[_0x3e431f[_0x67f5('0x1d')]+_0x67f5('0x42')]['update'](_0x50cbc6,{'UserId':_0x3e431f[_0x67f5('0x14')][_0x67f5('0x43')]})[_0x67f5('0x44')](function(_0x51418a){logger['error'](_0x67f5('0x45'));});}}return _0x368f2a({'code':0xc8,'message':_0x3e431f});}catch(_0x359a80){logger[_0x67f5('0x32')](_0x359a80[_0x67f5('0x3b')]);return _0x24a620(_0x24ae18['error'](0x1f4,_0x359a80));}}logger[_0x67f5('0x32')](_0x67f5('0x46'));return _0x24a620(_0x24ae18['error'](0x1f4,'message\x20is\x20empty'));});},'RejectMessage':function(_0x31374f){var _0x2ad0a0=this;return new Promise(function(_0x3bcc55,_0x495699){if(_0x31374f[_0x67f5('0x3d')]&&_0x31374f[_0x67f5('0x3d')]['id']){try{if(_0x182dbc[_0x67f5('0x3e')][_0x31374f[_0x67f5('0x3d')]['id']]){_0x182dbc[_0x67f5('0x3e')][_0x31374f[_0x67f5('0x3d')]['id']]['busy']=![];_0x182dbc[_0x67f5('0x3e')][_0x31374f[_0x67f5('0x3d')]['id']]['busyQueue']=undefined;}return _0x3bcc55({'code':0xc8,'message':_0x31374f});}catch(_0x191493){logger[_0x67f5('0x32')](_0x191493[_0x67f5('0x3b')]);return _0x495699(_0x2ad0a0[_0x67f5('0x32')](0x1f4,_0x191493));}}logger[_0x67f5('0x32')](_0x67f5('0x46'));return _0x495699(_0x2ad0a0[_0x67f5('0x32')](0x1f4,_0x67f5('0x46')));});},'AbandonInteraction':function(_0x492bd){var _0x38aee8=this;return new Promise(function(_0x158a22,_0x6efeca){if(_0x492bd[_0x67f5('0x1d')]&&_0x492bd[_0x67f5('0x15')]&&_0x492bd[_0x67f5('0x15')]['id']){try{var _0x6347a6=getId(_0x492bd[_0x67f5('0x1d')],_0x492bd[_0x67f5('0x14')]?_0x492bd[_0x67f5('0x14')]['id']:0x0,_0x492bd[_0x67f5('0x15')]?_0x492bd[_0x67f5('0x15')]['id']:0x0);if(_0x182dbc[_0x67f5('0x34')][_0x6347a6]){_0x182dbc[_0x67f5('0x34')][_0x6347a6][_0x67f5('0x38')]('end');}return _0x158a22({'code':0xc8,'message':_0x492bd});}catch(_0x59be6a){logger['error'](_0x59be6a['stack']);return _0x6efeca(_0x38aee8['error'](0x1f4,_0x59be6a));}}logger[_0x67f5('0x32')](_0x67f5('0x46'));return _0x6efeca(_0x38aee8[_0x67f5('0x32')](0x1f4,_0x67f5('0x46')));});},'AgentCapacity':function(_0x5bdeea){var _0x16d446=this;return new Promise(function(_0x2fd982,_0x3fec4f){if(_0x182dbc[_0x67f5('0x3e')][_0x67f5('0x47')](_0x5bdeea['id'])){for(var _0x47873b in _0x5bdeea[_0x67f5('0x48')]){if(_0x5bdeea[_0x67f5('0x48')][_0x67f5('0x47')](_0x47873b)){if(_0x182dbc['agents'][_0x5bdeea['id']][_0x67f5('0x47')](_0x47873b+_0x67f5('0x49'))){_0x182dbc[_0x67f5('0x3e')][_0x5bdeea['id']][_0x47873b+_0x67f5('0x49')]=parseInt(_0x5bdeea[_0x67f5('0x48')][_0x47873b],0xa);}}}_0x182dbc[_0x67f5('0x3e')][_0x5bdeea['id']][_0x67f5('0x4a')]();return _0x2fd982({'code':0xc8,'message':_0x182dbc['agents'][_0x5bdeea['id']]});}else{return _0x3fec4f(_0x16d446[_0x67f5('0x32')](0x1f4,'agent\x20not\x20found'));}});},'Agents':function(_0x88315e){return new Promise(function(_0x39a23b,_0x4a3ec0){var _0x3f7662=_[_0x67f5('0x4b')](_0x182dbc[_0x67f5('0x3e')]);_0x39a23b({'count':_0x3f7662[_0x67f5('0x17')],'rows':_0x3f7662});});},'ChatQueues':function(_0x392ab7){return new Promise(function(_0x55672a,_0x2e8899){var _0x12cbcf=[];for(var _0x2ab73f in _0x182dbc['chatQueues']){if(_0x182dbc['chatQueues']['hasOwnProperty'](_0x2ab73f)){var _0xe200db=_0x182dbc[_0x67f5('0x4c')][_0x2ab73f];var _0x2b49c6={'id':_0xe200db['id'],'available':_0xe200db['available'],'loggedIn':_0xe200db['loggedIn'],'name':_0xe200db['name'],'paused':_0xe200db['paused'],'waiting':_0xe200db[_0x67f5('0x4d')]};_0x12cbcf[_0x67f5('0x1f')](_0x2b49c6);}}_0x55672a({'count':_0x12cbcf['length'],'rows':_0x12cbcf});});},'MailQueues':function(_0x316e7a){return new Promise(function(_0x5f0436,_0x7d633a){var _0x3494da=[];for(var _0x2115eb in _0x182dbc[_0x67f5('0x4e')]){if(_0x182dbc['mailQueues'][_0x67f5('0x47')](_0x2115eb)){var _0x369d5e=_0x182dbc[_0x67f5('0x4e')][_0x2115eb];var _0x4ac7a3={'id':_0x369d5e['id'],'available':_0x369d5e[_0x67f5('0x4f')],'loggedIn':_0x369d5e[_0x67f5('0x50')],'name':_0x369d5e[_0x67f5('0x51')],'paused':_0x369d5e[_0x67f5('0x52')],'waiting':_0x369d5e[_0x67f5('0x4d')]};_0x3494da[_0x67f5('0x1f')](_0x4ac7a3);}}_0x5f0436({'count':_0x3494da[_0x67f5('0x17')],'rows':_0x3494da});});},'OpenchannelQueues':function(_0x5caf84){return new Promise(function(_0x3a9167,_0x15c0be){var _0x47b975=[];for(var _0x5c3658 in _0x182dbc['openchannelQueues']){if(_0x182dbc[_0x67f5('0x53')][_0x67f5('0x47')](_0x5c3658)){var _0x32c3ef=_0x182dbc['openchannelQueues'][_0x5c3658];var _0x236d21={'id':_0x32c3ef['id'],'available':_0x32c3ef[_0x67f5('0x4f')],'loggedIn':_0x32c3ef[_0x67f5('0x50')],'name':_0x32c3ef[_0x67f5('0x51')],'paused':_0x32c3ef[_0x67f5('0x52')],'waiting':_0x32c3ef[_0x67f5('0x4d')]};_0x47b975[_0x67f5('0x1f')](_0x236d21);}}_0x3a9167({'count':_0x47b975['length'],'rows':_0x47b975});});},'SmsQueues':function(_0x591df9){return new Promise(function(_0x4e532d,_0x1b83e9){var _0x5bd802=[];for(var _0x3b33fc in _0x182dbc[_0x67f5('0x54')]){if(_0x182dbc[_0x67f5('0x54')][_0x67f5('0x47')](_0x3b33fc)){var _0x1d8270=_0x182dbc[_0x67f5('0x54')][_0x3b33fc];var _0x1447e8={'id':_0x1d8270['id'],'available':_0x1d8270[_0x67f5('0x4f')],'loggedIn':_0x1d8270[_0x67f5('0x50')],'name':_0x1d8270[_0x67f5('0x51')],'paused':_0x1d8270['paused'],'waiting':_0x1d8270[_0x67f5('0x4d')]};_0x5bd802[_0x67f5('0x1f')](_0x1447e8);}}_0x4e532d({'count':_0x5bd802['length'],'rows':_0x5bd802});});},'FaxQueues':function(_0x35fc06){return new Promise(function(_0x21e2d9,_0x1badbb){var _0x4beb6c=[];for(var _0x5551be in _0x182dbc['faxQueues']){if(_0x182dbc[_0x67f5('0x55')][_0x67f5('0x47')](_0x5551be)){var _0x306cc4=_0x182dbc[_0x67f5('0x55')][_0x5551be];var _0x506c95={'id':_0x306cc4['id'],'available':_0x306cc4['available'],'loggedIn':_0x306cc4['loggedIn'],'name':_0x306cc4[_0x67f5('0x51')],'paused':_0x306cc4[_0x67f5('0x52')],'waiting':_0x306cc4[_0x67f5('0x4d')]};_0x4beb6c[_0x67f5('0x1f')](_0x506c95);}}_0x21e2d9({'count':_0x4beb6c[_0x67f5('0x17')],'rows':_0x4beb6c});});},'WhatsappQueues':function(_0x206464){return new Promise(function(_0x274089,_0x430daf){var _0x3db1a6=[];for(var _0x426010 in _0x182dbc[_0x67f5('0x56')]){if(_0x182dbc[_0x67f5('0x56')][_0x67f5('0x47')](_0x426010)){var _0x49b678=_0x182dbc[_0x67f5('0x56')][_0x426010];var _0x401ecb={'id':_0x49b678['id'],'available':_0x49b678[_0x67f5('0x4f')],'loggedIn':_0x49b678['loggedIn'],'name':_0x49b678[_0x67f5('0x51')],'paused':_0x49b678[_0x67f5('0x52')],'waiting':_0x49b678[_0x67f5('0x4d')]};_0x3db1a6[_0x67f5('0x1f')](_0x401ecb);}}_0x274089({'count':_0x3db1a6[_0x67f5('0x17')],'rows':_0x3db1a6});});},'ChatQueuesWaitingInteractions':function(_0x1d309b){return new Promise(function(_0x5d2175,_0x2a069f){var _0x3c5d2b=_[_0x67f5('0x4b')](_0x182dbc[_0x67f5('0x57')]);_0x5d2175({'count':_0x3c5d2b[_0x67f5('0x17')],'rows':_0x3c5d2b});});},'MailQueuesWaitingInteractions':function(_0x532c14){return new Promise(function(_0x1ff0f4,_0x3f6151){var _0x2d1fd8=_[_0x67f5('0x4b')](_0x182dbc[_0x67f5('0x58')]);_0x1ff0f4({'count':_0x2d1fd8[_0x67f5('0x17')],'rows':_0x2d1fd8});});},'OpenchannelQueuesWaitingInteractions':function(_0x5076d7){return new Promise(function(_0x424f6f,_0x3aa51a){var _0x51ccef=_[_0x67f5('0x4b')](_0x182dbc[_0x67f5('0x59')]);_0x424f6f({'count':_0x51ccef[_0x67f5('0x17')],'rows':_0x51ccef});});},'SmsQueuesWaitingInteractions':function(_0x432769){return new Promise(function(_0x48f408,_0x31e986){var _0x4f68d7=_[_0x67f5('0x4b')](_0x182dbc[_0x67f5('0x5a')]);_0x48f408({'count':_0x4f68d7[_0x67f5('0x17')],'rows':_0x4f68d7});});},'FaxQueuesWaitingInteractions':function(_0x43eaf3){return new Promise(function(_0x10e5e7,_0x15f6fd){var _0x18aa87=_[_0x67f5('0x4b')](_0x182dbc['faxQueuesWaitingInteractions']);_0x10e5e7({'count':_0x18aa87[_0x67f5('0x17')],'rows':_0x18aa87});});},'WhatsappQueuesWaitingInteractions':function(_0x380544){return new Promise(function(_0x345db6,_0x49926a){var _0xe97eea=_[_0x67f5('0x4b')](_0x182dbc[_0x67f5('0x5b')]);_0x345db6({'count':_0xe97eea[_0x67f5('0x17')],'rows':_0xe97eea});});}};var _0x5a4929=jayson[_0x67f5('0x5c')](_0x3573f7)[_0x67f5('0x5d')]();_0x5a4929['on'](_0x67f5('0x32'),function(_0xe9877b){logger[_0x67f5('0x32')](JSON['stringify'](_0xe9877b));return _0x2f7dcd(_0xe9877b);});_0x5a4929[_0x67f5('0x5e')](0x232c,'127.0.0.1',function(){console[_0x67f5('0x5f')](_0x67f5('0x60'),0x232c);return _0x19b7ac(_0x67f5('0x61')+0x232c);});});}; \ No newline at end of file diff --git a/server/services/routing/server/interval.js b/server/services/routing/server/interval.js index d799901..f5f2e92 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 _0x2a4f=['length','push','format','iftime\x20%s','indexOf','true','[%s][INTERVAL]\x20%s','all','[%s][INTERVAL]\x20%s\x20%s','join','when','log','\x20|\x20','stack','bluebird','jayson/promise','../../../config/logger','client','http','then','error','message','result','catch','condition','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop'];(function(_0x40b92a,_0x3ae37f){var _0x3aee1d=function(_0x1e6e52){while(--_0x1e6e52){_0x40b92a['push'](_0x40b92a['shift']());}};_0x3aee1d(++_0x3ae37f);}(_0x2a4f,0x14d));var _0xf2a4=function(_0x94f760,_0x4f1b70){_0x94f760=_0x94f760-0x0;var _0x3aec01=_0x2a4f[_0x94f760];return _0x3aec01;};'use strict';var util=require('util');var BPromise=require(_0xf2a4('0x0'));var jayson=require(_0xf2a4('0x1'));var _=require('lodash');var logger=require(_0xf2a4('0x2'))('routing');var client=jayson[_0xf2a4('0x3')][_0xf2a4('0x4')]({'port':0x232a});function request(_0x61790e,_0x2b323f){return new BPromise(function(_0x5c8d7f,_0x4e68a1){return client['request'](_0x61790e,_0x2b323f)[_0xf2a4('0x5')](function(_0x38c908){if(_0x38c908[_0xf2a4('0x6')]){return _0x4e68a1(_0x38c908[_0xf2a4('0x6')][_0xf2a4('0x7')]);}else{return _0x5c8d7f(_0x38c908[_0xf2a4('0x8')]);}})[_0xf2a4('0x9')](function(_0x3784af){return _0x4e68a1(_0x3784af);});});}exports[_0xf2a4('0xa')]=function(_0x1d8f96,_0x2bf786,_0x38bc25){return function(_0x559d61){if(_0x38bc25[_0xf2a4('0xb')]&&!_0x38bc25[_0xf2a4('0xb')][_0x1d8f96]){logger[_0xf2a4('0xc')](_0xf2a4('0xd'),_0x1d8f96);return _0x559d61[_0xf2a4('0xe')]();}var _0x33db65=[];for(var _0x54e6be=0x0;_0x54e6be<_0x2bf786[_0xf2a4('0xf')];_0x54e6be+=0x1){_0x33db65[_0xf2a4('0x10')](request('Command',{'command':util[_0xf2a4('0x11')](_0xf2a4('0x12'),_0x2bf786[_0x54e6be])})[_0xf2a4('0x5')](function(_0x35f6dc){return _0x35f6dc&&_0x35f6dc['message']&&_0x35f6dc[_0xf2a4('0x7')][_0xf2a4('0x13')](_0xf2a4('0x14'))>=0x0?!![]:![];})[_0xf2a4('0x9')](function(_0xed1fbf){logger[_0xf2a4('0x6')](_0xf2a4('0x15'),_0x1d8f96,_0x2bf786[_0x54e6be]);}));}BPromise[_0xf2a4('0x16')](_0x33db65)[_0xf2a4('0x5')](function(_0xc79050){var _0x542895=_['some'](_0xc79050);logger[_0xf2a4('0xc')](_0xf2a4('0x17'),_0x1d8f96,_0x2bf786[_0xf2a4('0x18')]('\x20|\x20'),_0x542895);_0x559d61[_0xf2a4('0x19')](_0x542895);})[_0xf2a4('0x9')](function(_0x8a4e8){console[_0xf2a4('0x1a')](_0x8a4e8);logger[_0xf2a4('0x6')](_0xf2a4('0x17'),_0x1d8f96,_0x2bf786['join'](_0xf2a4('0x1b')),_0x8a4e8[_0xf2a4('0x1c')]);_0x559d61[_0xf2a4('0xe')]();});};}; \ No newline at end of file +var _0x5456=['message','result','catch','condition','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','length','format','iftime\x20%s','true','some','[%s][INTERVAL]\x20%s\x20%s','join','\x20|\x20','when','stack','util','bluebird','jayson/promise','lodash','../../../config/logger','routing','client','http','request','then','error'];(function(_0xcd000e,_0x20e0cd){var _0x1a0ec5=function(_0x2c9750){while(--_0x2c9750){_0xcd000e['push'](_0xcd000e['shift']());}};_0x1a0ec5(++_0x20e0cd);}(_0x5456,0x18b));var _0x6545=function(_0x2ac877,_0xb277f2){_0x2ac877=_0x2ac877-0x0;var _0x27e7fe=_0x5456[_0x2ac877];return _0x27e7fe;};'use strict';var util=require(_0x6545('0x0'));var BPromise=require(_0x6545('0x1'));var jayson=require(_0x6545('0x2'));var _=require(_0x6545('0x3'));var logger=require(_0x6545('0x4'))(_0x6545('0x5'));var client=jayson[_0x6545('0x6')][_0x6545('0x7')]({'port':0x232a});function request(_0x2a3a72,_0x34f52f){return new BPromise(function(_0x4aeaf2,_0x519fc0){return client[_0x6545('0x8')](_0x2a3a72,_0x34f52f)[_0x6545('0x9')](function(_0x1c805e){if(_0x1c805e[_0x6545('0xa')]){return _0x519fc0(_0x1c805e['error'][_0x6545('0xb')]);}else{return _0x4aeaf2(_0x1c805e[_0x6545('0xc')]);}})[_0x6545('0xd')](function(_0x5e4a2a){return _0x519fc0(_0x5e4a2a);});});}exports[_0x6545('0xe')]=function(_0xdc48a4,_0x1e217a,_0x43810f){return function(_0x361925){if(_0x43810f[_0x6545('0xf')]&&!_0x43810f[_0x6545('0xf')][_0xdc48a4]){logger[_0x6545('0x10')](_0x6545('0x11'),_0xdc48a4);return _0x361925[_0x6545('0x12')]();}var _0x4d40ab=[];for(var _0x30538c=0x0;_0x30538c<_0x1e217a[_0x6545('0x13')];_0x30538c+=0x1){_0x4d40ab['push'](request('Command',{'command':util[_0x6545('0x14')](_0x6545('0x15'),_0x1e217a[_0x30538c])})['then'](function(_0x3abd27){return _0x3abd27&&_0x3abd27[_0x6545('0xb')]&&_0x3abd27['message']['indexOf'](_0x6545('0x16'))>=0x0?!![]:![];})[_0x6545('0xd')](function(_0x22ffe9){logger['error']('[%s][INTERVAL]\x20%s',_0xdc48a4,_0x1e217a[_0x30538c]);}));}BPromise['all'](_0x4d40ab)[_0x6545('0x9')](function(_0x2d73c1){var _0xa36d35=_[_0x6545('0x17')](_0x2d73c1);logger[_0x6545('0x10')](_0x6545('0x18'),_0xdc48a4,_0x1e217a[_0x6545('0x19')](_0x6545('0x1a')),_0xa36d35);_0x361925[_0x6545('0x1b')](_0xa36d35);})[_0x6545('0xd')](function(_0x33b2c9){console['log'](_0x33b2c9);logger[_0x6545('0xa')]('[%s][INTERVAL]\x20%s\x20%s',_0xdc48a4,_0x1e217a[_0x6545('0x19')](_0x6545('0x1a')),_0x33b2c9[_0x6545('0x1c')]);_0x361925[_0x6545('0x12')]();});};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index 9fa67a4..3805f07 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 _0x5c00=['queuecallerabandon','forIn','includes','agentringnoanswer','now','abandoned','[%s][agents][queuecallerabandon]','agentconnect','[%s][agents][agentconnect]','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connect','agentringnoanswerAt','answered_elsewhere','answeredelsewheremembername','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','diffTime','agentcompleteAt','complete','[%s][agents][agentcomplete]','blindtransfer','transfereruniqueid','[%s][agents][blindtransfer]','blind','transferexten','extension','transferuniqueid','[%s][agents][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','transfer','transfertype','origtransfererexten','transfereeuniqueid','agententerreason','clone','calleridname','secondtransfererexten','transfertargetuniqueid','hangup','[%s][agents][hangup]','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','agent','lodash','util','./utils','format','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','channel','membername','interface','calleridnum','connectedlinenum','queue','getVoiceQueueByName','type','agentacw','agentcomplete','acw','acwTimeout','CreateVoiceAgentReport','request','destuniqueid','debug','[%s][agents][agentcalled]','agentcalledAt','lastevent','called','connectedlinename','info','error','isNil','[%s][agents][agentringnoanswer]','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','timeout','reason','holdtime','ringtime','talktime','push'];(function(_0x4b8968,_0x5c9b44){var _0x3a0ab7=function(_0x4dade2){while(--_0x4dade2){_0x4b8968['push'](_0x4b8968['shift']());}};_0x3a0ab7(++_0x5c9b44);}(_0x5c00,0x17e));var _0x05c0=function(_0x3d4ef1,_0x5a957c){_0x3d4ef1=_0x3d4ef1-0x0;var _0x409423=_0x5c00[_0x3d4ef1];return _0x409423;};'use strict';var _=require(_0x05c0('0x0'));var util=require(_0x05c0('0x1'));var utils=require(_0x05c0('0x2'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x4e54ec,_0x1e76da){utils['info'](util[_0x05c0('0x3')](_0x05c0('0x4'),_0x4e54ec[_0x05c0('0x5')],_0x4e54ec[_0x05c0('0x6')],_0x4e54ec['queue'],_0x4e54ec[_0x05c0('0x7')],_0x4e54ec[_0x05c0('0x8')],_0x4e54ec[_0x05c0('0x9')],_0x4e54ec[_0x05c0('0xa')],_0x4e54ec['lastevent']));if(_0x4e54ec[_0x05c0('0xb')]){utils[_0x05c0('0xc')](_0x4e54ec[_0x05c0('0xb')])['then'](function(_0x32a795){if(_0x32a795){_0x4e54ec[_0x05c0('0xd')]=_0x32a795[_0x05c0('0xd')];_0x4e54ec[_0x05c0('0xe')]=_0x4e54ec[_0x05c0('0xf')]?_0x32a795[_0x05c0('0x10')]:![];_0x4e54ec['acwtime']=_0x4e54ec['agentacw']?_0x32a795[_0x05c0('0x11')]:0x0;}utils['request'](_0x05c0('0x12'),_0x4e54ec);});}else{utils[_0x05c0('0x13')](_0x05c0('0x12'),_0x4e54ec);}if(_0x1e76da){delete transfers[_0x4e54ec['uniqueid']];}else{delete agents[_0x4e54ec[_0x05c0('0x14')]];}}exports['agentcalled']=function(_0x16a290){try{utils[_0x05c0('0x15')](util[_0x05c0('0x3')](_0x05c0('0x16'),_0x16a290[_0x05c0('0x5')]),_0x16a290);agents[_0x16a290[_0x05c0('0x14')]]=_0x16a290;agents[_0x16a290[_0x05c0('0x14')]][_0x05c0('0x17')]=utils['now']();agents[_0x16a290[_0x05c0('0x14')]][_0x05c0('0x18')]=_0x05c0('0x19');agents[_0x16a290[_0x05c0('0x14')]][_0x05c0('0xa')]=null;agents[_0x16a290[_0x05c0('0x14')]][_0x05c0('0x1a')]=null;utils[_0x05c0('0x1b')](util[_0x05c0('0x3')]('[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called',_0x16a290[_0x05c0('0x5')],agents[_0x16a290[_0x05c0('0x14')]][_0x05c0('0x7')],_0x16a290['destuniqueid']));}catch(_0x40d905){utils[_0x05c0('0x1c')](util[_0x05c0('0x3')](_0x05c0('0x16'),_0x16a290[_0x05c0('0x5')]),_0x40d905);}};exports['agentringnoanswer']=function(_0x407c1f){try{if(!_[_0x05c0('0x1d')](agents[_0x407c1f['destuniqueid']])){utils['debug'](util['format'](_0x05c0('0x1e'),_0x407c1f[_0x05c0('0x5')]),_0x407c1f);utils[_0x05c0('0x1b')](util[_0x05c0('0x3')](_0x05c0('0x1f'),_0x407c1f[_0x05c0('0x5')],agents[_0x407c1f[_0x05c0('0x14')]]['membername'],_0x407c1f[_0x05c0('0x14')]));agents[_0x407c1f[_0x05c0('0x14')]]['agentringnoanswer']=!![];agents[_0x407c1f['destuniqueid']]['agentringnoanswerAt']=utils['now']();agents[_0x407c1f['destuniqueid']][_0x05c0('0x18')]=_0x05c0('0x20');agents[_0x407c1f['destuniqueid']][_0x05c0('0x21')]=_0x05c0('0x20');agents[_0x407c1f[_0x05c0('0x14')]][_0x05c0('0x22')]=_0x407c1f['ringtime']?parseInt(_0x407c1f[_0x05c0('0x23')])/0x3e8:0x0;agents[_0x407c1f[_0x05c0('0x14')]][_0x05c0('0x24')]=0x0;unanswered[_0x05c0('0x25')](_0x407c1f[_0x05c0('0x14')]);}}catch(_0x5d12e0){utils['error'](util['format'](_0x05c0('0x1e'),_0x407c1f[_0x05c0('0x5')]),_0x5d12e0);}};exports[_0x05c0('0x26')]=function(_0xd6574e){try{_[_0x05c0('0x27')](agents,function(_0x1e00c5,_0x1c4c8f){if(_0x1e00c5[_0x05c0('0x5')]==_0xd6574e[_0x05c0('0x5')]&&!_[_0x05c0('0x28')](unanswered,_0x1e00c5[_0x05c0('0x14')])){utils[_0x05c0('0x15')](util['format']('[%s][agents][queuecallerabandon]',_0xd6574e[_0x05c0('0x5')]),_0xd6574e);utils[_0x05c0('0x1b')](util[_0x05c0('0x3')]('[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned',_0xd6574e[_0x05c0('0x5')],_0x1e00c5[_0x05c0('0x7')],_0x1e00c5['destuniqueid']));_0x1e00c5[_0x05c0('0x29')]=!![];_0x1e00c5['agentringnoanswerAt']=utils[_0x05c0('0x2a')]();_0x1e00c5[_0x05c0('0x18')]=_0x05c0('0x2b');_0x1e00c5[_0x05c0('0x21')]=_0x05c0('0x2b');_0x1e00c5[_0x05c0('0x22')]=_0xd6574e[_0x05c0('0x22')];_0x1e00c5[_0x05c0('0x24')]=0x0;writeDB(_0x1e00c5);}});}catch(_0x3d8d76){utils[_0x05c0('0x1c')](util[_0x05c0('0x3')](_0x05c0('0x2c'),_0xd6574e[_0x05c0('0x5')]),_0x3d8d76);}};exports[_0x05c0('0x2d')]=function(_0x185d05){try{if(agents[_0x185d05[_0x05c0('0x14')]]){utils[_0x05c0('0x15')](util[_0x05c0('0x3')](_0x05c0('0x2e'),_0x185d05[_0x05c0('0x5')]),_0x185d05);utils[_0x05c0('0x1b')](util[_0x05c0('0x3')](_0x05c0('0x2f'),_0x185d05[_0x05c0('0x5')],agents[_0x185d05[_0x05c0('0x14')]][_0x05c0('0x7')],_0x185d05[_0x05c0('0x14')]));agents[_0x185d05[_0x05c0('0x14')]][_0x05c0('0x30')]=utils[_0x05c0('0x2a')]();agents[_0x185d05[_0x05c0('0x14')]][_0x05c0('0xa')]=_0x185d05[_0x05c0('0xa')];agents[_0x185d05['destuniqueid']][_0x05c0('0x1a')]=_0x185d05[_0x05c0('0x1a')];agents[_0x185d05[_0x05c0('0x14')]][_0x05c0('0x22')]=_0x185d05['ringtime'];agents[_0x185d05['destuniqueid']][_0x05c0('0x18')]=_0x05c0('0x31');_[_0x05c0('0x27')](agents,function(_0x4ced8e,_0x29dc87){if(_0x4ced8e[_0x05c0('0x14')]!=_0x185d05[_0x05c0('0x14')]&&_0x4ced8e[_0x05c0('0x5')]==_0x185d05['uniqueid']){_0x4ced8e[_0x05c0('0x24')]=0x0;_0x4ced8e[_0x05c0('0x22')]=_0x185d05['ringtime'];_0x4ced8e[_0x05c0('0x29')]=!![];_0x4ced8e[_0x05c0('0x32')]=utils[_0x05c0('0x2a')]();_0x4ced8e[_0x05c0('0x18')]=_0x05c0('0x33');_0x4ced8e[_0x05c0('0x21')]=_0x05c0('0x33');_0x4ced8e['answeredelsewheredestinationuniqueid']=_0x185d05['destuniqueid'];_0x4ced8e[_0x05c0('0x34')]=_0x185d05[_0x05c0('0x7')];writeDB(_0x4ced8e);}});}}catch(_0xaa5d53){utils[_0x05c0('0x1c')](util[_0x05c0('0x3')]('[%s][agents][agentconnect]',_0x185d05[_0x05c0('0x5')]),_0xaa5d53);}};exports[_0x05c0('0xf')]=function(_0x2fdfe8){try{if(!_[_0x05c0('0x1d')](agents[_0x2fdfe8[_0x05c0('0x14')]])){utils[_0x05c0('0x15')](util[_0x05c0('0x3')]('[%s][agents][agentcomplete]',_0x2fdfe8[_0x05c0('0x5')]),_0x2fdfe8);utils[_0x05c0('0x1b')](util[_0x05c0('0x3')](_0x05c0('0x35'),_0x2fdfe8[_0x05c0('0x5')],agents[_0x2fdfe8[_0x05c0('0x14')]][_0x05c0('0x7')],_0x2fdfe8[_0x05c0('0x14')]));agents[_0x2fdfe8[_0x05c0('0x14')]][_0x05c0('0xf')]=!![];agents[_0x2fdfe8[_0x05c0('0x14')]]['agentcompleteAt']=utils['now']();agents[_0x2fdfe8[_0x05c0('0x14')]][_0x05c0('0x24')]=utils[_0x05c0('0x36')](agents[_0x2fdfe8[_0x05c0('0x14')]][_0x05c0('0x37')],agents[_0x2fdfe8[_0x05c0('0x14')]]['agentconnectAt']);agents[_0x2fdfe8[_0x05c0('0x14')]][_0x05c0('0x21')]=_0x2fdfe8[_0x05c0('0x21')];agents[_0x2fdfe8[_0x05c0('0x14')]]['lastevent']=_0x05c0('0x38');writeDB(agents[_0x2fdfe8[_0x05c0('0x14')]]);}}catch(_0x3ec0bf){utils[_0x05c0('0x1c')](util['format'](_0x05c0('0x39'),_0x2fdfe8[_0x05c0('0x5')]),_0x3ec0bf);}};exports[_0x05c0('0x3a')]=function(_0x9b521b){try{if(!_['isNil'](agents[_0x9b521b[_0x05c0('0x3b')]])){utils[_0x05c0('0x15')](util['format'](_0x05c0('0x3c'),_0x9b521b['uniqueid']),_0x9b521b);utils['info'](util[_0x05c0('0x3')]('[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s',_0x9b521b[_0x05c0('0x5')],agents[_0x9b521b[_0x05c0('0x3b')]][_0x05c0('0x7')],agents[_0x9b521b[_0x05c0('0x3b')]][_0x05c0('0x5')]));agents[_0x9b521b[_0x05c0('0x3b')]]['transfer']=!![];agents[_0x9b521b[_0x05c0('0x3b')]]['transfertype']=_0x05c0('0x3d');agents[_0x9b521b[_0x05c0('0x3b')]][_0x05c0('0x3e')]=_0x9b521b[_0x05c0('0x3f')];agents[_0x9b521b[_0x05c0('0x3b')]][_0x05c0('0x40')]=agents[_0x9b521b[_0x05c0('0x3b')]]['uniqueid'];}}catch(_0x5215b4){utils['error'](util[_0x05c0('0x3')](_0x05c0('0x3c'),_0x9b521b['uniqueid']),_0x5215b4);}};exports['attendedtransfer']=function(_0xbfb9cb){try{utils[_0x05c0('0x15')](util[_0x05c0('0x3')](_0x05c0('0x41'),_0xbfb9cb[_0x05c0('0x42')]),_0xbfb9cb);if(_0xbfb9cb[_0x05c0('0x42')]==_0xbfb9cb[_0x05c0('0x43')]){if(!_['isNil'](agents[_0xbfb9cb[_0x05c0('0x44')]])){utils[_0x05c0('0x1b')](util[_0x05c0('0x3')](_0x05c0('0x45'),_0xbfb9cb['origtransfereruniqueid'],agents[_0xbfb9cb[_0x05c0('0x44')]]['membername']));agents[_0xbfb9cb[_0x05c0('0x44')]][_0x05c0('0x46')]=!![];agents[_0xbfb9cb['secondtransfereruniqueid']][_0x05c0('0x47')]='ATTENDED';agents[_0xbfb9cb[_0x05c0('0x44')]][_0x05c0('0x3e')]=_0xbfb9cb[_0x05c0('0x48')];agents[_0xbfb9cb[_0x05c0('0x44')]][_0x05c0('0x40')]=_0xbfb9cb[_0x05c0('0x42')];}if(_0xbfb9cb['transfereeuniqueid']&&agents[_0xbfb9cb[_0x05c0('0x49')]]){agents[_0xbfb9cb[_0x05c0('0x49')]][_0x05c0('0x4a')]=0x1;transfers[_0xbfb9cb[_0x05c0('0x49')]]=_[_0x05c0('0x4b')](agents[_0xbfb9cb[_0x05c0('0x49')]]);transfers[_0xbfb9cb['transfereeuniqueid']][_0x05c0('0x9')]=agents[_0xbfb9cb[_0x05c0('0x44')]][_0x05c0('0x9')];transfers[_0xbfb9cb[_0x05c0('0x49')]][_0x05c0('0x4c')]=agents[_0xbfb9cb[_0x05c0('0x44')]][_0x05c0('0x4c')];transfers[_0xbfb9cb[_0x05c0('0x49')]][_0x05c0('0x17')]=utils[_0x05c0('0x2a')]();transfers[_0xbfb9cb[_0x05c0('0x49')]][_0x05c0('0x30')]=utils['now']();transfers[_0xbfb9cb['transfereeuniqueid']]['holdtime']=0x0;transfers[_0xbfb9cb[_0x05c0('0x49')]][_0x05c0('0x4a')]=0x2;}}else if(_0xbfb9cb[_0x05c0('0x44')]==_0xbfb9cb['secondtransfererlinkedid']){if(!_[_0x05c0('0x1d')](agents[_0xbfb9cb[_0x05c0('0x42')]])){utils[_0x05c0('0x1b')](util[_0x05c0('0x3')](_0x05c0('0x45'),_0xbfb9cb[_0x05c0('0x42')],agents[_0xbfb9cb[_0x05c0('0x42')]]['membername']));agents[_0xbfb9cb[_0x05c0('0x42')]][_0x05c0('0x46')]=!![];agents[_0xbfb9cb[_0x05c0('0x42')]][_0x05c0('0x47')]='ATTENDED';agents[_0xbfb9cb['origtransfereruniqueid']]['transferexten']=_0xbfb9cb[_0x05c0('0x4d')];agents[_0xbfb9cb[_0x05c0('0x42')]][_0x05c0('0x40')]=_0xbfb9cb[_0x05c0('0x44')];}if(_0xbfb9cb[_0x05c0('0x4e')]&&agents[_0xbfb9cb[_0x05c0('0x4e')]]){agents[_0xbfb9cb[_0x05c0('0x4e')]]['agententerreason']=0x1;transfers[_0xbfb9cb[_0x05c0('0x4e')]]=_[_0x05c0('0x4b')](agents[_0xbfb9cb[_0x05c0('0x4e')]]);transfers[_0xbfb9cb[_0x05c0('0x4e')]][_0x05c0('0x9')]=agents[_0xbfb9cb['origtransfereruniqueid']]['calleridnum'];transfers[_0xbfb9cb[_0x05c0('0x4e')]][_0x05c0('0x4c')]=agents[_0xbfb9cb['origtransfereruniqueid']][_0x05c0('0x4c')];transfers[_0xbfb9cb['transfertargetuniqueid']]['agentcalledAt']=utils[_0x05c0('0x2a')]();transfers[_0xbfb9cb[_0x05c0('0x4e')]][_0x05c0('0x30')]=utils['now']();transfers[_0xbfb9cb['transfertargetuniqueid']][_0x05c0('0x22')]=0x0;transfers[_0xbfb9cb[_0x05c0('0x4e')]][_0x05c0('0x4a')]=0x2;}}}catch(_0x5b39cb){utils['error'](util['format']('[%s][agents][attendedtransfer]',_0xbfb9cb['origtransfereruniqueid']),_0x5b39cb);}};exports[_0x05c0('0x4f')]=function(_0x4f43ae){try{utils['debug'](util['format'](_0x05c0('0x50'),_0x4f43ae[_0x05c0('0x5')]),_0x4f43ae);if(agents[_0x4f43ae[_0x05c0('0x5')]]&&agents[_0x4f43ae['uniqueid']][_0x05c0('0x21')]===_0x05c0('0x20')){if(_0x4f43ae['cause']==='21'){agents[_0x4f43ae[_0x05c0('0x5')]][_0x05c0('0x21')]=_0x05c0('0x51');agents[_0x4f43ae[_0x05c0('0x5')]]['lastevent']=_0x05c0('0x51');}utils[_0x05c0('0x1b')](util[_0x05c0('0x3')](_0x05c0('0x52'),_0x4f43ae[_0x05c0('0x5')],agents[_0x4f43ae['uniqueid']]['membername'],agents[_0x4f43ae[_0x05c0('0x5')]]['reason'],agents[_0x4f43ae[_0x05c0('0x5')]][_0x05c0('0x18')]));writeDB(agents[_0x4f43ae['uniqueid']]);var _0x3135bd=unanswered['indexOf'](_0x4f43ae['uniqueid']);if(_0x3135bd>-0x1){unanswered['splice'](_0x3135bd,0x1);}}if(transfers[_0x4f43ae['uniqueid']]){transfers[_0x4f43ae[_0x05c0('0x5')]][_0x05c0('0xf')]=!![];transfers[_0x4f43ae[_0x05c0('0x5')]][_0x05c0('0x37')]=utils['now']();transfers[_0x4f43ae[_0x05c0('0x5')]][_0x05c0('0x24')]=utils[_0x05c0('0x36')](transfers[_0x4f43ae[_0x05c0('0x5')]][_0x05c0('0x37')],transfers[_0x4f43ae['uniqueid']][_0x05c0('0x30')]);transfers[_0x4f43ae['uniqueid']]['reason']=_0x05c0('0x53');transfers[_0x4f43ae[_0x05c0('0x5')]][_0x05c0('0x18')]=_0x05c0('0x38');utils[_0x05c0('0x1b')](util[_0x05c0('0x3')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x4f43ae['uniqueid'],transfers[_0x4f43ae[_0x05c0('0x5')]][_0x05c0('0x7')],transfers[_0x4f43ae[_0x05c0('0x5')]]['reason'],transfers[_0x4f43ae[_0x05c0('0x5')]][_0x05c0('0x18')]));writeDB(transfers[_0x4f43ae[_0x05c0('0x5')]],!![]);}if(agents[_0x4f43ae[_0x05c0('0x5')]]&&agents[_0x4f43ae[_0x05c0('0x5')]][_0x05c0('0x30')]){agents[_0x4f43ae['uniqueid']][_0x05c0('0xf')]=!![];agents[_0x4f43ae[_0x05c0('0x5')]]['agentcompleteAt']=utils[_0x05c0('0x2a')]();agents[_0x4f43ae[_0x05c0('0x5')]]['talktime']=utils[_0x05c0('0x36')](agents[_0x4f43ae[_0x05c0('0x5')]][_0x05c0('0x37')],agents[_0x4f43ae[_0x05c0('0x5')]][_0x05c0('0x30')]);agents[_0x4f43ae[_0x05c0('0x5')]]['reason']=agents[_0x4f43ae[_0x05c0('0x5')]]['transfer']?_0x05c0('0x46'):_0x05c0('0x53');agents[_0x4f43ae[_0x05c0('0x5')]][_0x05c0('0x18')]=_0x05c0('0x38');utils[_0x05c0('0x1b')](util[_0x05c0('0x3')](_0x05c0('0x52'),_0x4f43ae[_0x05c0('0x5')],agents[_0x4f43ae[_0x05c0('0x5')]]['membername'],agents[_0x4f43ae[_0x05c0('0x5')]]['reason'],agents[_0x4f43ae[_0x05c0('0x5')]]['lastevent']));writeDB(agents[_0x4f43ae[_0x05c0('0x5')]]);}}catch(_0x36f82a){utils[_0x05c0('0x1c')](util[_0x05c0('0x3')](_0x05c0('0x50'),_0x4f43ae[_0x05c0('0x5')]),_0x36f82a);}}; \ No newline at end of file +var _0xe706=['then','type','agentacw','agentcomplete','acw','acwtime','CreateVoiceAgentReport','request','destuniqueid','agentcalled','debug','now','called','error','[%s][agents][agentcalled]','agentringnoanswer','isNil','[%s][agents][agentringnoanswer]','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','agentringnoanswerAt','timeout','reason','ringtime','talktime','push','queuecallerabandon','forIn','includes','[%s][agents][queuecallerabandon]','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','holdtime','agentconnect','[%s][agents][agentconnect]','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','connectedlinename','connect','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','[%s][agents][agentcomplete]','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','diffTime','agentconnectAt','complete','transfereruniqueid','[%s][agents][blindtransfer]','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfer','transfertype','transferexten','extension','transferuniqueid','[%s][agents][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfereruniqueid','ATTENDED','origtransfererexten','transfereeuniqueid','agententerreason','clone','calleridname','secondtransfererlinkedid','[%s][agents][attendedtransfer]\x20agent:%s','transfertargetuniqueid','agentcalledAt','[%s][agents][hangup]','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','indexOf','splice','agent','lodash','util','./utils','info','format','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','channel','queue','membername','interface','calleridnum','connectedlinenum','lastevent','getVoiceQueueByName'];(function(_0x543eee,_0x428e5e){var _0x4c2d56=function(_0x472beb){while(--_0x472beb){_0x543eee['push'](_0x543eee['shift']());}};_0x4c2d56(++_0x428e5e);}(_0xe706,0xa3));var _0x6e70=function(_0x528622,_0xcb18f0){_0x528622=_0x528622-0x0;var _0x1b12a0=_0xe706[_0x528622];return _0x1b12a0;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var utils=require(_0x6e70('0x2'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x5e8446,_0x2cae77){utils[_0x6e70('0x3')](util[_0x6e70('0x4')](_0x6e70('0x5'),_0x5e8446[_0x6e70('0x6')],_0x5e8446[_0x6e70('0x7')],_0x5e8446[_0x6e70('0x8')],_0x5e8446[_0x6e70('0x9')],_0x5e8446[_0x6e70('0xa')],_0x5e8446[_0x6e70('0xb')],_0x5e8446[_0x6e70('0xc')],_0x5e8446[_0x6e70('0xd')]));if(_0x5e8446[_0x6e70('0x8')]){utils[_0x6e70('0xe')](_0x5e8446[_0x6e70('0x8')])[_0x6e70('0xf')](function(_0x954545){if(_0x954545){_0x5e8446[_0x6e70('0x10')]=_0x954545[_0x6e70('0x10')];_0x5e8446[_0x6e70('0x11')]=_0x5e8446[_0x6e70('0x12')]?_0x954545[_0x6e70('0x13')]:![];_0x5e8446[_0x6e70('0x14')]=_0x5e8446[_0x6e70('0x11')]?_0x954545['acwTimeout']:0x0;}utils['request'](_0x6e70('0x15'),_0x5e8446);});}else{utils[_0x6e70('0x16')](_0x6e70('0x15'),_0x5e8446);}if(_0x2cae77){delete transfers[_0x5e8446[_0x6e70('0x6')]];}else{delete agents[_0x5e8446[_0x6e70('0x17')]];}}exports[_0x6e70('0x18')]=function(_0xa1eb74){try{utils[_0x6e70('0x19')](util['format']('[%s][agents][agentcalled]',_0xa1eb74['uniqueid']),_0xa1eb74);agents[_0xa1eb74[_0x6e70('0x17')]]=_0xa1eb74;agents[_0xa1eb74['destuniqueid']]['agentcalledAt']=utils[_0x6e70('0x1a')]();agents[_0xa1eb74[_0x6e70('0x17')]]['lastevent']=_0x6e70('0x1b');agents[_0xa1eb74['destuniqueid']][_0x6e70('0xc')]=null;agents[_0xa1eb74[_0x6e70('0x17')]]['connectedlinename']=null;utils['info'](util[_0x6e70('0x4')]('[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called',_0xa1eb74[_0x6e70('0x6')],agents[_0xa1eb74[_0x6e70('0x17')]]['membername'],_0xa1eb74['destuniqueid']));}catch(_0xc238ba){utils[_0x6e70('0x1c')](util[_0x6e70('0x4')](_0x6e70('0x1d'),_0xa1eb74[_0x6e70('0x6')]),_0xc238ba);}};exports[_0x6e70('0x1e')]=function(_0x1b2453){try{if(!_[_0x6e70('0x1f')](agents[_0x1b2453[_0x6e70('0x17')]])){utils[_0x6e70('0x19')](util['format'](_0x6e70('0x20'),_0x1b2453[_0x6e70('0x6')]),_0x1b2453);utils[_0x6e70('0x3')](util['format'](_0x6e70('0x21'),_0x1b2453[_0x6e70('0x6')],agents[_0x1b2453[_0x6e70('0x17')]]['membername'],_0x1b2453[_0x6e70('0x17')]));agents[_0x1b2453['destuniqueid']]['agentringnoanswer']=!![];agents[_0x1b2453['destuniqueid']][_0x6e70('0x22')]=utils[_0x6e70('0x1a')]();agents[_0x1b2453['destuniqueid']][_0x6e70('0xd')]=_0x6e70('0x23');agents[_0x1b2453['destuniqueid']][_0x6e70('0x24')]=_0x6e70('0x23');agents[_0x1b2453[_0x6e70('0x17')]]['holdtime']=_0x1b2453['ringtime']?parseInt(_0x1b2453[_0x6e70('0x25')])/0x3e8:0x0;agents[_0x1b2453[_0x6e70('0x17')]][_0x6e70('0x26')]=0x0;unanswered[_0x6e70('0x27')](_0x1b2453[_0x6e70('0x17')]);}}catch(_0x5d772a){utils[_0x6e70('0x1c')](util[_0x6e70('0x4')](_0x6e70('0x20'),_0x1b2453[_0x6e70('0x6')]),_0x5d772a);}};exports[_0x6e70('0x28')]=function(_0x20a225){try{_[_0x6e70('0x29')](agents,function(_0x24114a,_0x3a0821){if(_0x24114a[_0x6e70('0x6')]==_0x20a225['uniqueid']&&!_[_0x6e70('0x2a')](unanswered,_0x24114a['destuniqueid'])){utils[_0x6e70('0x19')](util['format'](_0x6e70('0x2b'),_0x20a225[_0x6e70('0x6')]),_0x20a225);utils[_0x6e70('0x3')](util['format'](_0x6e70('0x2c'),_0x20a225[_0x6e70('0x6')],_0x24114a['membername'],_0x24114a[_0x6e70('0x17')]));_0x24114a[_0x6e70('0x1e')]=!![];_0x24114a['agentringnoanswerAt']=utils[_0x6e70('0x1a')]();_0x24114a[_0x6e70('0xd')]=_0x6e70('0x2d');_0x24114a[_0x6e70('0x24')]=_0x6e70('0x2d');_0x24114a[_0x6e70('0x2e')]=_0x20a225[_0x6e70('0x2e')];_0x24114a[_0x6e70('0x26')]=0x0;writeDB(_0x24114a);}});}catch(_0xf146fd){utils[_0x6e70('0x1c')](util['format'](_0x6e70('0x2b'),_0x20a225['uniqueid']),_0xf146fd);}};exports[_0x6e70('0x2f')]=function(_0x3222a2){try{if(agents[_0x3222a2[_0x6e70('0x17')]]){utils[_0x6e70('0x19')](util[_0x6e70('0x4')](_0x6e70('0x30'),_0x3222a2[_0x6e70('0x6')]),_0x3222a2);utils[_0x6e70('0x3')](util[_0x6e70('0x4')](_0x6e70('0x31'),_0x3222a2[_0x6e70('0x6')],agents[_0x3222a2[_0x6e70('0x17')]][_0x6e70('0x9')],_0x3222a2['destuniqueid']));agents[_0x3222a2['destuniqueid']]['agentconnectAt']=utils[_0x6e70('0x1a')]();agents[_0x3222a2[_0x6e70('0x17')]][_0x6e70('0xc')]=_0x3222a2[_0x6e70('0xc')];agents[_0x3222a2[_0x6e70('0x17')]][_0x6e70('0x32')]=_0x3222a2['connectedlinename'];agents[_0x3222a2[_0x6e70('0x17')]][_0x6e70('0x2e')]=_0x3222a2[_0x6e70('0x25')];agents[_0x3222a2[_0x6e70('0x17')]][_0x6e70('0xd')]=_0x6e70('0x33');_[_0x6e70('0x29')](agents,function(_0x16fc7d,_0x5be100){if(_0x16fc7d[_0x6e70('0x17')]!=_0x3222a2[_0x6e70('0x17')]&&_0x16fc7d[_0x6e70('0x6')]==_0x3222a2[_0x6e70('0x6')]){_0x16fc7d[_0x6e70('0x26')]=0x0;_0x16fc7d[_0x6e70('0x2e')]=_0x3222a2[_0x6e70('0x25')];_0x16fc7d['agentringnoanswer']=!![];_0x16fc7d['agentringnoanswerAt']=utils['now']();_0x16fc7d[_0x6e70('0xd')]=_0x6e70('0x34');_0x16fc7d[_0x6e70('0x24')]=_0x6e70('0x34');_0x16fc7d[_0x6e70('0x35')]=_0x3222a2['destuniqueid'];_0x16fc7d[_0x6e70('0x36')]=_0x3222a2[_0x6e70('0x9')];writeDB(_0x16fc7d);}});}}catch(_0x2a2aca){utils['error'](util['format']('[%s][agents][agentconnect]',_0x3222a2[_0x6e70('0x6')]),_0x2a2aca);}};exports['agentcomplete']=function(_0x42f49a){try{if(!_[_0x6e70('0x1f')](agents[_0x42f49a[_0x6e70('0x17')]])){utils[_0x6e70('0x19')](util['format'](_0x6e70('0x37'),_0x42f49a['uniqueid']),_0x42f49a);utils[_0x6e70('0x3')](util[_0x6e70('0x4')](_0x6e70('0x38'),_0x42f49a[_0x6e70('0x6')],agents[_0x42f49a['destuniqueid']][_0x6e70('0x9')],_0x42f49a[_0x6e70('0x17')]));agents[_0x42f49a[_0x6e70('0x17')]][_0x6e70('0x12')]=!![];agents[_0x42f49a[_0x6e70('0x17')]][_0x6e70('0x39')]=utils[_0x6e70('0x1a')]();agents[_0x42f49a['destuniqueid']][_0x6e70('0x26')]=utils[_0x6e70('0x3a')](agents[_0x42f49a[_0x6e70('0x17')]][_0x6e70('0x39')],agents[_0x42f49a[_0x6e70('0x17')]][_0x6e70('0x3b')]);agents[_0x42f49a[_0x6e70('0x17')]]['reason']=_0x42f49a[_0x6e70('0x24')];agents[_0x42f49a['destuniqueid']][_0x6e70('0xd')]=_0x6e70('0x3c');writeDB(agents[_0x42f49a['destuniqueid']]);}}catch(_0x53efc3){utils[_0x6e70('0x1c')](util[_0x6e70('0x4')](_0x6e70('0x37'),_0x42f49a['uniqueid']),_0x53efc3);}};exports['blindtransfer']=function(_0x238ebb){try{if(!_[_0x6e70('0x1f')](agents[_0x238ebb[_0x6e70('0x3d')]])){utils[_0x6e70('0x19')](util[_0x6e70('0x4')](_0x6e70('0x3e'),_0x238ebb['uniqueid']),_0x238ebb);utils[_0x6e70('0x3')](util[_0x6e70('0x4')](_0x6e70('0x3f'),_0x238ebb[_0x6e70('0x6')],agents[_0x238ebb[_0x6e70('0x3d')]]['membername'],agents[_0x238ebb['transfereruniqueid']][_0x6e70('0x6')]));agents[_0x238ebb[_0x6e70('0x3d')]][_0x6e70('0x40')]=!![];agents[_0x238ebb[_0x6e70('0x3d')]][_0x6e70('0x41')]='blind';agents[_0x238ebb[_0x6e70('0x3d')]][_0x6e70('0x42')]=_0x238ebb[_0x6e70('0x43')];agents[_0x238ebb[_0x6e70('0x3d')]][_0x6e70('0x44')]=agents[_0x238ebb['transfereruniqueid']][_0x6e70('0x6')];}}catch(_0x1dd242){utils[_0x6e70('0x1c')](util[_0x6e70('0x4')](_0x6e70('0x3e'),_0x238ebb[_0x6e70('0x6')]),_0x1dd242);}};exports['attendedtransfer']=function(_0x40e7c6){try{utils[_0x6e70('0x19')](util['format'](_0x6e70('0x45'),_0x40e7c6[_0x6e70('0x46')]),_0x40e7c6);if(_0x40e7c6['origtransfereruniqueid']==_0x40e7c6[_0x6e70('0x47')]){if(!_[_0x6e70('0x1f')](agents[_0x40e7c6[_0x6e70('0x48')]])){utils[_0x6e70('0x3')](util[_0x6e70('0x4')]('[%s][agents][attendedtransfer]\x20agent:%s',_0x40e7c6[_0x6e70('0x46')],agents[_0x40e7c6[_0x6e70('0x48')]][_0x6e70('0x9')]));agents[_0x40e7c6[_0x6e70('0x48')]][_0x6e70('0x40')]=!![];agents[_0x40e7c6[_0x6e70('0x48')]][_0x6e70('0x41')]=_0x6e70('0x49');agents[_0x40e7c6[_0x6e70('0x48')]][_0x6e70('0x42')]=_0x40e7c6[_0x6e70('0x4a')];agents[_0x40e7c6[_0x6e70('0x48')]][_0x6e70('0x44')]=_0x40e7c6[_0x6e70('0x46')];}if(_0x40e7c6[_0x6e70('0x4b')]&&agents[_0x40e7c6[_0x6e70('0x4b')]]){agents[_0x40e7c6[_0x6e70('0x4b')]][_0x6e70('0x4c')]=0x1;transfers[_0x40e7c6[_0x6e70('0x4b')]]=_[_0x6e70('0x4d')](agents[_0x40e7c6['transfereeuniqueid']]);transfers[_0x40e7c6[_0x6e70('0x4b')]][_0x6e70('0xb')]=agents[_0x40e7c6[_0x6e70('0x48')]][_0x6e70('0xb')];transfers[_0x40e7c6[_0x6e70('0x4b')]][_0x6e70('0x4e')]=agents[_0x40e7c6['secondtransfereruniqueid']][_0x6e70('0x4e')];transfers[_0x40e7c6[_0x6e70('0x4b')]]['agentcalledAt']=utils[_0x6e70('0x1a')]();transfers[_0x40e7c6[_0x6e70('0x4b')]][_0x6e70('0x3b')]=utils['now']();transfers[_0x40e7c6['transfereeuniqueid']][_0x6e70('0x2e')]=0x0;transfers[_0x40e7c6[_0x6e70('0x4b')]][_0x6e70('0x4c')]=0x2;}}else if(_0x40e7c6[_0x6e70('0x48')]==_0x40e7c6[_0x6e70('0x4f')]){if(!_[_0x6e70('0x1f')](agents[_0x40e7c6[_0x6e70('0x46')]])){utils['info'](util['format'](_0x6e70('0x50'),_0x40e7c6[_0x6e70('0x46')],agents[_0x40e7c6[_0x6e70('0x46')]][_0x6e70('0x9')]));agents[_0x40e7c6['origtransfereruniqueid']]['transfer']=!![];agents[_0x40e7c6[_0x6e70('0x46')]][_0x6e70('0x41')]='ATTENDED';agents[_0x40e7c6['origtransfereruniqueid']][_0x6e70('0x42')]=_0x40e7c6['secondtransfererexten'];agents[_0x40e7c6[_0x6e70('0x46')]][_0x6e70('0x44')]=_0x40e7c6[_0x6e70('0x48')];}if(_0x40e7c6[_0x6e70('0x51')]&&agents[_0x40e7c6[_0x6e70('0x51')]]){agents[_0x40e7c6[_0x6e70('0x51')]][_0x6e70('0x4c')]=0x1;transfers[_0x40e7c6[_0x6e70('0x51')]]=_['clone'](agents[_0x40e7c6[_0x6e70('0x51')]]);transfers[_0x40e7c6[_0x6e70('0x51')]][_0x6e70('0xb')]=agents[_0x40e7c6[_0x6e70('0x46')]][_0x6e70('0xb')];transfers[_0x40e7c6['transfertargetuniqueid']]['calleridname']=agents[_0x40e7c6['origtransfereruniqueid']][_0x6e70('0x4e')];transfers[_0x40e7c6[_0x6e70('0x51')]][_0x6e70('0x52')]=utils['now']();transfers[_0x40e7c6['transfertargetuniqueid']][_0x6e70('0x3b')]=utils[_0x6e70('0x1a')]();transfers[_0x40e7c6[_0x6e70('0x51')]][_0x6e70('0x2e')]=0x0;transfers[_0x40e7c6[_0x6e70('0x51')]][_0x6e70('0x4c')]=0x2;}}}catch(_0x5eb6f0){utils[_0x6e70('0x1c')](util[_0x6e70('0x4')](_0x6e70('0x45'),_0x40e7c6[_0x6e70('0x46')]),_0x5eb6f0);}};exports['hangup']=function(_0xce964b){try{utils['debug'](util['format'](_0x6e70('0x53'),_0xce964b[_0x6e70('0x6')]),_0xce964b);if(agents[_0xce964b[_0x6e70('0x6')]]&&agents[_0xce964b[_0x6e70('0x6')]][_0x6e70('0x24')]===_0x6e70('0x23')){if(_0xce964b['cause']==='21'){agents[_0xce964b[_0x6e70('0x6')]][_0x6e70('0x24')]=_0x6e70('0x54');agents[_0xce964b[_0x6e70('0x6')]][_0x6e70('0xd')]=_0x6e70('0x54');}utils[_0x6e70('0x3')](util[_0x6e70('0x4')](_0x6e70('0x55'),_0xce964b[_0x6e70('0x6')],agents[_0xce964b['uniqueid']][_0x6e70('0x9')],agents[_0xce964b[_0x6e70('0x6')]][_0x6e70('0x24')],agents[_0xce964b['uniqueid']]['lastevent']));writeDB(agents[_0xce964b[_0x6e70('0x6')]]);var _0x18ecf0=unanswered[_0x6e70('0x56')](_0xce964b[_0x6e70('0x6')]);if(_0x18ecf0>-0x1){unanswered[_0x6e70('0x57')](_0x18ecf0,0x1);}}if(transfers[_0xce964b['uniqueid']]){transfers[_0xce964b['uniqueid']][_0x6e70('0x12')]=!![];transfers[_0xce964b[_0x6e70('0x6')]]['agentcompleteAt']=utils[_0x6e70('0x1a')]();transfers[_0xce964b[_0x6e70('0x6')]][_0x6e70('0x26')]=utils[_0x6e70('0x3a')](transfers[_0xce964b[_0x6e70('0x6')]][_0x6e70('0x39')],transfers[_0xce964b[_0x6e70('0x6')]][_0x6e70('0x3b')]);transfers[_0xce964b[_0x6e70('0x6')]][_0x6e70('0x24')]=_0x6e70('0x58');transfers[_0xce964b[_0x6e70('0x6')]][_0x6e70('0xd')]=_0x6e70('0x3c');utils['info'](util['format'](_0x6e70('0x55'),_0xce964b['uniqueid'],transfers[_0xce964b[_0x6e70('0x6')]]['membername'],transfers[_0xce964b['uniqueid']][_0x6e70('0x24')],transfers[_0xce964b['uniqueid']]['lastevent']));writeDB(transfers[_0xce964b[_0x6e70('0x6')]],!![]);}if(agents[_0xce964b[_0x6e70('0x6')]]&&agents[_0xce964b[_0x6e70('0x6')]]['agentconnectAt']){agents[_0xce964b['uniqueid']]['agentcomplete']=!![];agents[_0xce964b[_0x6e70('0x6')]]['agentcompleteAt']=utils[_0x6e70('0x1a')]();agents[_0xce964b[_0x6e70('0x6')]][_0x6e70('0x26')]=utils[_0x6e70('0x3a')](agents[_0xce964b[_0x6e70('0x6')]][_0x6e70('0x39')],agents[_0xce964b[_0x6e70('0x6')]]['agentconnectAt']);agents[_0xce964b[_0x6e70('0x6')]][_0x6e70('0x24')]=agents[_0xce964b[_0x6e70('0x6')]]['transfer']?_0x6e70('0x40'):_0x6e70('0x58');agents[_0xce964b[_0x6e70('0x6')]][_0x6e70('0xd')]=_0x6e70('0x3c');utils[_0x6e70('0x3')](util[_0x6e70('0x4')](_0x6e70('0x55'),_0xce964b[_0x6e70('0x6')],agents[_0xce964b['uniqueid']][_0x6e70('0x9')],agents[_0xce964b[_0x6e70('0x6')]]['reason'],agents[_0xce964b[_0x6e70('0x6')]][_0x6e70('0xd')]));writeDB(agents[_0xce964b['uniqueid']]);}}catch(_0x596d71){utils[_0x6e70('0x1c')](util['format'](_0x6e70('0x53'),_0xce964b['uniqueid']),_0x596d71);}}; \ No newline at end of file diff --git a/server/services/xdr/calls.controller.js b/server/services/xdr/calls.controller.js index fd241f6..14e4d63 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 _0xd78c=['disposition','toNumber','callerid','calleridname','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','cause-txt','endtime','diffTime','starttime','billableseconds','answertime','[%s][calls][hangup]','localtwolinkedid','[%s][calls][attendedtransfer]','origtransfereruniqueid','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','secondtransfererchannel','_attended','transfertargetchannel','origtransfererchannel','userfield','musiconholdstart','musiconholdstartAt','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','[%s][calls][musiconholdstart]','musiconholdstop','[%s][calls][musiconholdstop]','mohtime','[%s][calls][musiconholdstop]\x20mohtime:%s','[%s][calls][varset]','variable','xmd-originatecalleridnum','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','source','value','xmd-phone','destination','\x22\x20<','xmd-callerid','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-callerid-preview','xmd-queue','xmcs-queue','lastapplication','Queue','lastdata','xmd-contactid','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','xmd-cdrtype','type','outboundrouteid','routeid','sipcallid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','newexten','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','appdata','set','toLowerCase','cdr','split','substring','lastIndexOf','includes','hangup','noop','execif','[%s][calls][newexten]','lodash','./utils','./transfers.controller','NO\x20ANSWER','FAILED','ANSWERED','BUSY','blinds','uniqueid','transfereeuniqueid','info','format','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','queue','membername','interface','connectedlinenum','lastevent','accountcode','getUserByInternal','then','UserId','request','CreateVoiceCallReport','newchannel','debug','linkedid','channel','OutgoingSpoolFailed','context','calleridnum','exten','now','DOCUMENTATION','error','[%s][calls][newchannel]','newstate','[%s][calls][newstate]','isNil','channelstate','systemanswertime','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','destinationchannel'];(function(_0x548062,_0x172078){var _0x39fefc=function(_0x1e8733){while(--_0x1e8733){_0x548062['push'](_0x548062['shift']());}};_0x39fefc(++_0x172078);}(_0xd78c,0x198));var _0xcd78=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0xd78c[_0x3bf83f];return _0x22c4a9;};'use strict';var _=require(_0xcd78('0x0'));var util=require('util');var utils=require(_0xcd78('0x1'));var transfers=require(_0xcd78('0x2'));var dispositions=[_0xcd78('0x3'),_0xcd78('0x4'),_0xcd78('0x4'),_0xcd78('0x3'),_0xcd78('0x3'),_0xcd78('0x3'),_0xcd78('0x5'),_0xcd78('0x6'),_0xcd78('0x4'),_0xcd78('0x4'),_0xcd78('0x4')];var channels={};function writeDB(_0x41be5a){var _0x14b403;if(transfers[_0xcd78('0x7')][_0x41be5a[_0xcd78('0x8')]]){_0x14b403=_0x41be5a['uniqueid'];_0x41be5a[_0xcd78('0x8')]=transfers[_0xcd78('0x7')][_0x41be5a[_0xcd78('0x8')]][_0xcd78('0x9')];}utils[_0xcd78('0xa')](util[_0xcd78('0xb')](_0xcd78('0xc'),_0x41be5a[_0xcd78('0x8')],_0x41be5a['channel'],_0x41be5a[_0xcd78('0xd')],_0x41be5a[_0xcd78('0xe')],_0x41be5a[_0xcd78('0xf')],_0x41be5a['calleridnum'],_0x41be5a[_0xcd78('0x10')],_0x41be5a[_0xcd78('0x11')]));if(_0x41be5a[_0xcd78('0x12')]){utils[_0xcd78('0x13')](_0x41be5a['accountcode'])[_0xcd78('0x14')](function(_0x206227){if(_0x206227){_0x41be5a[_0xcd78('0x15')]=_0x206227['id'];}utils[_0xcd78('0x16')](_0xcd78('0x17'),_0x41be5a);});}else{utils[_0xcd78('0x16')](_0xcd78('0x17'),_0x41be5a);}if(channels[_0x41be5a[_0xcd78('0x8')]]){delete channels[_0x41be5a[_0xcd78('0x8')]];}else if(_0x14b403&&channels[_0x14b403]){delete transfers[_0xcd78('0x7')][_0x14b403];delete channels[_0x14b403];}}exports[_0xcd78('0x18')]=function(_0x21a01d){try{utils[_0xcd78('0x19')](util[_0xcd78('0xb')]('[%s][calls][newchannel]',_0x21a01d[_0xcd78('0x8')]),_0x21a01d);if(_0x21a01d[_0xcd78('0x8')]==_0x21a01d[_0xcd78('0x1a')]&&_0x21a01d[_0xcd78('0x1b')]!=_0xcd78('0x1c')){utils[_0xcd78('0xa')](util[_0xcd78('0xb')]('[%s][calls][newchannel]\x20context:%s\x20exten:%s',_0x21a01d[_0xcd78('0x8')],_0x21a01d[_0xcd78('0x1d')],_0x21a01d['exten']));channels[_0x21a01d[_0xcd78('0x8')]]={'uniqueid':_0x21a01d[_0xcd78('0x8')],'accountcode':_0x21a01d[_0xcd78('0x12')],'source':_0x21a01d[_0xcd78('0x1e')],'destination':_0x21a01d[_0xcd78('0x1f')],'destinationcontext':_0x21a01d[_0xcd78('0x1d')],'channel':_0x21a01d[_0xcd78('0x1b')],'starttime':utils[_0xcd78('0x20')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0xcd78('0x3'),'amaflags':_0xcd78('0x21')};}}catch(_0x15b8cb){utils[_0xcd78('0x22')](util[_0xcd78('0xb')](_0xcd78('0x23'),_0x21a01d[_0xcd78('0x8')]),_0x15b8cb);}};exports[_0xcd78('0x24')]=function(_0x3504bf){try{utils[_0xcd78('0x19')](util['format'](_0xcd78('0x25'),_0x3504bf[_0xcd78('0x8')]),_0x3504bf);if(!_[_0xcd78('0x26')](channels[_0x3504bf[_0xcd78('0x8')]])&&_0x3504bf[_0xcd78('0x27')]==0x6){utils[_0xcd78('0xa')](util['format']('[%s][calls][newstate]\x20context:%s\x20channel:%s',_0x3504bf[_0xcd78('0x8')],_0x3504bf['context'],_0x3504bf[_0xcd78('0x1b')]));if(_['isNil'](channels[_0x3504bf[_0xcd78('0x8')]][_0xcd78('0x28')])){channels[_0x3504bf['uniqueid']]['systemanswertime']=utils[_0xcd78('0x20')]();}}else if(!_['isNil'](channels[_0x3504bf[_0xcd78('0x1a')]])&&_0x3504bf[_0xcd78('0x27')]==0x6&&_0x3504bf['context']!=_0xcd78('0x29')){utils[_0xcd78('0xa')](util[_0xcd78('0xb')](_0xcd78('0x2a'),_0x3504bf[_0xcd78('0x8')],_0x3504bf[_0xcd78('0x1a')],_0x3504bf[_0xcd78('0x1d')],_0x3504bf[_0xcd78('0x1b')]));channels[_0x3504bf['linkedid']][_0xcd78('0x12')]=_0x3504bf[_0xcd78('0x12')];channels[_0x3504bf[_0xcd78('0x1a')]][_0xcd78('0x2b')]=_0x3504bf[_0xcd78('0x1b')];if(_[_0xcd78('0x26')](channels[_0x3504bf[_0xcd78('0x1a')]]['answertime'])){channels[_0x3504bf[_0xcd78('0x1a')]]['answertime']=utils[_0xcd78('0x20')]();}channels[_0x3504bf['linkedid']][_0xcd78('0x2c')]=dispositions[_[_0xcd78('0x2d')](_0x3504bf[_0xcd78('0x27')])]||_0xcd78('0x5');}}catch(_0x151632){utils[_0xcd78('0x22')](util['format'](_0xcd78('0x25'),_0x3504bf[_0xcd78('0x8')]),_0x151632);}};exports['hangup']=function(_0x4ac9f0){try{if(!_[_0xcd78('0x26')](channels[_0x4ac9f0[_0xcd78('0x8')]])){utils[_0xcd78('0x19')](util['format']('[%s][calls][hangup]',_0x4ac9f0[_0xcd78('0x8')]),_0x4ac9f0);if(_[_0xcd78('0x26')](channels[_0x4ac9f0[_0xcd78('0x8')]][_0xcd78('0x2e')])){channels[_0x4ac9f0[_0xcd78('0x8')]][_0xcd78('0x2e')]=_0x4ac9f0[_0xcd78('0x2f')]+'\x20<'+_0x4ac9f0[_0xcd78('0x1e')]+'>';}utils[_0xcd78('0xa')](util[_0xcd78('0xb')](_0xcd78('0x30'),_0x4ac9f0[_0xcd78('0x8')],channels[_0x4ac9f0[_0xcd78('0x8')]][_0xcd78('0x2e')],_0x4ac9f0[_0xcd78('0x31')]));channels[_0x4ac9f0['uniqueid']][_0xcd78('0x32')]=utils[_0xcd78('0x20')]();channels[_0x4ac9f0[_0xcd78('0x8')]]['duration']=utils[_0xcd78('0x33')](channels[_0x4ac9f0['uniqueid']][_0xcd78('0x32')],channels[_0x4ac9f0[_0xcd78('0x8')]][_0xcd78('0x34')]);channels[_0x4ac9f0[_0xcd78('0x8')]][_0xcd78('0x35')]=channels[_0x4ac9f0['uniqueid']]['answertime']?utils[_0xcd78('0x33')](channels[_0x4ac9f0['uniqueid']]['endtime'],channels[_0x4ac9f0['uniqueid']][_0xcd78('0x36')]):0x0;writeDB(channels[_0x4ac9f0['uniqueid']]);}}catch(_0x38688d){utils[_0xcd78('0x22')](util[_0xcd78('0xb')](_0xcd78('0x37'),_0x4ac9f0[_0xcd78('0x8')]),_0x38688d);}};exports['attendedtransfer']=function(_0x5b8ae7){try{if(!_[_0xcd78('0x26')](channels[_0x5b8ae7[_0xcd78('0x38')]])){utils['debug'](util[_0xcd78('0xb')](_0xcd78('0x39'),_0x5b8ae7[_0xcd78('0x3a')]),_0x5b8ae7);if(channels[_0x5b8ae7['localtwolinkedid']][_0xcd78('0x1b')]==_0x5b8ae7['transfereechannel']){utils[_0xcd78('0xa')](util[_0xcd78('0xb')](_0xcd78('0x3b'),_0x5b8ae7[_0xcd78('0x3a')],_0x5b8ae7[_0xcd78('0x38')],_0x5b8ae7[_0xcd78('0x3c')]));channels[_0x5b8ae7[_0xcd78('0x38')]]['destinationchannel']=_0x5b8ae7['secondtransfererchannel'];channels[_0x5b8ae7[_0xcd78('0x38')]]['userfield']=_0xcd78('0x3d');}else if(channels[_0x5b8ae7[_0xcd78('0x38')]][_0xcd78('0x1b')]=_0x5b8ae7[_0xcd78('0x3e')]){utils[_0xcd78('0xa')](util[_0xcd78('0xb')](_0xcd78('0x3b'),_0x5b8ae7[_0xcd78('0x3a')],_0x5b8ae7[_0xcd78('0x38')],_0x5b8ae7[_0xcd78('0x3f')]));channels[_0x5b8ae7['localtwolinkedid']][_0xcd78('0x2b')]=_0x5b8ae7[_0xcd78('0x3f')];channels[_0x5b8ae7[_0xcd78('0x38')]][_0xcd78('0x40')]=_0xcd78('0x3d');}}}catch(_0x86c492){utils[_0xcd78('0x22')](util[_0xcd78('0xb')]('[%s][calls][attendedtransfer]',_0x5b8ae7[_0xcd78('0x3a')]),_0x86c492);}};exports[_0xcd78('0x41')]=function(_0x186c1f){try{if(!_[_0xcd78('0x26')](channels[_0x186c1f['uniqueid']])){utils[_0xcd78('0x19')](util[_0xcd78('0xb')]('[%s][calls][musiconholdstart]',_0x186c1f[_0xcd78('0x8')]),_0x186c1f);channels[_0x186c1f[_0xcd78('0x8')]][_0xcd78('0x42')]=utils[_0xcd78('0x20')]();utils[_0xcd78('0xa')](util[_0xcd78('0xb')](_0xcd78('0x43'),_0x186c1f['uniqueid'],channels[_0x186c1f['uniqueid']]['musiconholdstartAt']));}}catch(_0x4ab8ec){utils[_0xcd78('0x22')](util[_0xcd78('0xb')](_0xcd78('0x44'),_0x186c1f[_0xcd78('0x8')]),_0x4ab8ec);}};exports[_0xcd78('0x45')]=function(_0x215a9b){try{if(!_[_0xcd78('0x26')](channels[_0x215a9b[_0xcd78('0x8')]])){utils[_0xcd78('0x19')](util[_0xcd78('0xb')](_0xcd78('0x46'),_0x215a9b[_0xcd78('0x8')]),_0x215a9b);if(!_[_0xcd78('0x26')](channels[_0x215a9b['uniqueid']][_0xcd78('0x42')])){channels[_0x215a9b['uniqueid']][_0xcd78('0x47')]+=utils[_0xcd78('0x33')](utils[_0xcd78('0x20')](),channels[_0x215a9b[_0xcd78('0x8')]][_0xcd78('0x42')]);utils[_0xcd78('0xa')](util[_0xcd78('0xb')](_0xcd78('0x48'),_0x215a9b['uniqueid'],channels[_0x215a9b[_0xcd78('0x8')]][_0xcd78('0x47')]));delete channels[_0x215a9b['uniqueid']][_0xcd78('0x42')];}}}catch(_0x39e392){utils[_0xcd78('0x22')](util[_0xcd78('0xb')](_0xcd78('0x46'),_0x215a9b[_0xcd78('0x8')]),_0x39e392);}};exports['varset']=function(_0x2a8af0){try{if(!_['isNil'](channels[_0x2a8af0['uniqueid']])){utils['debug'](util[_0xcd78('0xb')](_0xcd78('0x49'),_0x2a8af0[_0xcd78('0x8')]),_0x2a8af0);if(!_[_0xcd78('0x26')](_0x2a8af0[_0xcd78('0x4a')][_0xcd78('0x4b')])){utils['info'](util['format'](_0xcd78('0x4c'),_0x2a8af0[_0xcd78('0x8')],_0x2a8af0['value']));channels[_0x2a8af0[_0xcd78('0x8')]][_0xcd78('0x4d')]=_0x2a8af0[_0xcd78('0x4e')];}if(!_['isNil'](_0x2a8af0[_0xcd78('0x4a')][_0xcd78('0x4f')])){utils[_0xcd78('0xa')](util[_0xcd78('0xb')]('[%s][calls][varset]\x20variable:xmd-phone\x20value:%s',_0x2a8af0[_0xcd78('0x8')],_0x2a8af0[_0xcd78('0x4e')]));channels[_0x2a8af0[_0xcd78('0x8')]][_0xcd78('0x50')]=_0x2a8af0[_0xcd78('0x4e')];channels[_0x2a8af0['uniqueid']][_0xcd78('0x2e')]='\x22'+_0x2a8af0['value']+_0xcd78('0x51')+_0x2a8af0['value']+'>';}if(!_[_0xcd78('0x26')](_0x2a8af0[_0xcd78('0x4a')]['xmd-callerid-preview'])||!_['isNil'](_0x2a8af0[_0xcd78('0x4a')][_0xcd78('0x52')])){utils[_0xcd78('0xa')](util[_0xcd78('0xb')](_0xcd78('0x53'),_0x2a8af0[_0xcd78('0x8')],!_[_0xcd78('0x26')](_0x2a8af0[_0xcd78('0x4a')][_0xcd78('0x54')])?'xmd-callerid-preview':_0xcd78('0x52'),_0x2a8af0['value']));channels[_0x2a8af0[_0xcd78('0x8')]][_0xcd78('0x2e')]=_0x2a8af0['value'];}if(!_[_0xcd78('0x26')](_0x2a8af0[_0xcd78('0x4a')][_0xcd78('0x55')])||!_[_0xcd78('0x26')](_0x2a8af0[_0xcd78('0x4a')][_0xcd78('0x56')])){utils[_0xcd78('0xa')](util[_0xcd78('0xb')](_0xcd78('0x53'),_0x2a8af0[_0xcd78('0x8')],!_[_0xcd78('0x26')](_0x2a8af0[_0xcd78('0x4a')][_0xcd78('0x55')])?'xmd-queue':_0xcd78('0x56'),_0x2a8af0[_0xcd78('0x4e')]));channels[_0x2a8af0[_0xcd78('0x8')]][_0xcd78('0x57')]=_0xcd78('0x58');channels[_0x2a8af0[_0xcd78('0x8')]][_0xcd78('0x59')]=_0x2a8af0[_0xcd78('0x4e')];channels[_0x2a8af0[_0xcd78('0x8')]][_0xcd78('0xd')]=!![];}if(!_[_0xcd78('0x26')](_0x2a8af0[_0xcd78('0x4a')][_0xcd78('0x5a')])){utils[_0xcd78('0xa')](util[_0xcd78('0xb')](_0xcd78('0x5b'),_0x2a8af0['uniqueid'],_0x2a8af0[_0xcd78('0x4e')]));channels[_0x2a8af0[_0xcd78('0x8')]]['ContactId']=_0x2a8af0[_0xcd78('0x4e')];}if(!_[_0xcd78('0x26')](_0x2a8af0['variable'][_0xcd78('0x5c')])){utils['info'](util[_0xcd78('0xb')]('[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s',_0x2a8af0[_0xcd78('0x8')],_0x2a8af0[_0xcd78('0x4e')]));channels[_0x2a8af0[_0xcd78('0x8')]][_0xcd78('0x5d')]=_0x2a8af0[_0xcd78('0x4e')];}if(!_[_0xcd78('0x26')](_0x2a8af0['variable'][_0xcd78('0x5e')])){utils['info'](util[_0xcd78('0xb')]('[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s',_0x2a8af0[_0xcd78('0x8')],_0x2a8af0['value']));channels[_0x2a8af0[_0xcd78('0x8')]][_0xcd78('0x5f')]=_0x2a8af0['value'];}if(!_[_0xcd78('0x26')](_0x2a8af0[_0xcd78('0x4a')][_0xcd78('0x60')])){utils[_0xcd78('0xa')](util[_0xcd78('0xb')](_0xcd78('0x61'),_0x2a8af0['uniqueid'],_0x2a8af0[_0xcd78('0x4e')]));channels[_0x2a8af0[_0xcd78('0x8')]][_0xcd78('0x60')]=_0x2a8af0['value'];}}}catch(_0x5f1909){utils[_0xcd78('0x22')](util[_0xcd78('0xb')](_0xcd78('0x49'),_0x2a8af0['uniqueid']),_0x5f1909);}};exports[_0xcd78('0x62')]=function(_0x3ba23b){try{if(!_[_0xcd78('0x26')](channels[_0x3ba23b[_0xcd78('0x8')]])){utils[_0xcd78('0x19')](util[_0xcd78('0xb')]('[%s][calls][newexten]',_0x3ba23b[_0xcd78('0x8')]),_0x3ba23b);utils['info'](util[_0xcd78('0xb')](_0xcd78('0x63'),_0x3ba23b[_0xcd78('0x8')],_0x3ba23b[_0xcd78('0x64')],_0x3ba23b[_0xcd78('0x65')]));if(_0x3ba23b[_0xcd78('0x64')]['toLowerCase']()==_0xcd78('0x66')&&_['startsWith'](_0x3ba23b['appdata'][_0xcd78('0x67')](),_0xcd78('0x68'))){var _0x57ce9f=_0x3ba23b['appdata'][_0xcd78('0x69')]('=');var _0x42b2f7=_0x57ce9f[0x0][_0xcd78('0x6a')](_0x57ce9f[0x0][_0xcd78('0x6b')]('(')+0x1,_0x57ce9f[0x0][_0xcd78('0x6b')](')'));var _0x5b5a0f=_0x57ce9f[0x1];channels[_0x3ba23b['uniqueid']][_0x42b2f7]=_0x5b5a0f;}if(!_[_0xcd78('0x6c')]([_0xcd78('0x6d'),_0xcd78('0x6e'),_0xcd78('0x6f'),_0xcd78('0x66'),'gotoif'],_0x3ba23b[_0xcd78('0x64')][_0xcd78('0x67')]())){channels[_0x3ba23b[_0xcd78('0x8')]]['lastapplication']=_0x3ba23b['application'];channels[_0x3ba23b[_0xcd78('0x8')]][_0xcd78('0x59')]=_0x3ba23b['appdata'];}}}catch(_0x1a3120){utils[_0xcd78('0x22')](util[_0xcd78('0xb')](_0xcd78('0x70'),_0x3ba23b[_0xcd78('0x8')]),_0x1a3120);}}; \ No newline at end of file +var _0xceb6=['UserId','request','CreateVoiceCallReport','newchannel','[%s][calls][newchannel]','OutgoingSpoolFailed','[%s][calls][newchannel]\x20context:%s\x20exten:%s','context','exten','DOCUMENTATION','error','newstate','debug','isNil','channelstate','[%s][calls][newstate]\x20context:%s\x20channel:%s','systemanswertime','now','linkedid','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','answertime','disposition','toNumber','hangup','[%s][calls][hangup]','callerid','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','cause-txt','endtime','duration','diffTime','attendedtransfer','localtwolinkedid','[%s][calls][attendedtransfer]','origtransfereruniqueid','transfereechannel','secondtransfererchannel','destinationchannel','userfield','_attended','transfertargetchannel','origtransfererchannel','musiconholdstart','musiconholdstartAt','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','musiconholdstop','[%s][calls][musiconholdstop]','mohtime','varset','variable','xmd-originatecalleridnum','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value','xmd-phone','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','\x22\x20<','xmd-callerid-preview','xmd-callerid','xmd-queue','xmcs-queue','[%s][calls][varset]\x20variable:%s\x20value:%s','lastdata','xmd-contactid','xmd-cdrtype','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','type','outboundrouteid','routeid','sipcallid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','[%s][calls][varset]','newexten','[%s][calls][newexten]\x20application:%s\x20appdata:%s','appdata','application','toLowerCase','startsWith','cdr','split','substring','lastIndexOf','noop','execif','[%s][calls][newexten]','lodash','util','NO\x20ANSWER','FAILED','ANSWERED','BUSY','blinds','uniqueid','transfereeuniqueid','info','format','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','channel','queue','membername','interface','calleridnum','connectedlinenum','accountcode','getUserByInternal','then'];(function(_0x570e36,_0x4f6e20){var _0x4ec4f3=function(_0x2846be){while(--_0x2846be){_0x570e36['push'](_0x570e36['shift']());}};_0x4ec4f3(++_0x4f6e20);}(_0xceb6,0x193));var _0x6ceb=function(_0x8ed2fe,_0x19ca78){_0x8ed2fe=_0x8ed2fe-0x0;var _0x23a751=_0xceb6[_0x8ed2fe];return _0x23a751;};'use strict';var _=require(_0x6ceb('0x0'));var util=require(_0x6ceb('0x1'));var utils=require('./utils');var transfers=require('./transfers.controller');var dispositions=[_0x6ceb('0x2'),_0x6ceb('0x3'),_0x6ceb('0x3'),_0x6ceb('0x2'),_0x6ceb('0x2'),_0x6ceb('0x2'),_0x6ceb('0x4'),_0x6ceb('0x5'),'FAILED','FAILED','FAILED'];var channels={};function writeDB(_0xe524c7){var _0x5ef6ed;if(transfers[_0x6ceb('0x6')][_0xe524c7[_0x6ceb('0x7')]]){_0x5ef6ed=_0xe524c7[_0x6ceb('0x7')];_0xe524c7[_0x6ceb('0x7')]=transfers['blinds'][_0xe524c7[_0x6ceb('0x7')]][_0x6ceb('0x8')];}utils[_0x6ceb('0x9')](util[_0x6ceb('0xa')](_0x6ceb('0xb'),_0xe524c7['uniqueid'],_0xe524c7[_0x6ceb('0xc')],_0xe524c7[_0x6ceb('0xd')],_0xe524c7[_0x6ceb('0xe')],_0xe524c7[_0x6ceb('0xf')],_0xe524c7[_0x6ceb('0x10')],_0xe524c7[_0x6ceb('0x11')],_0xe524c7['lastevent']));if(_0xe524c7[_0x6ceb('0x12')]){utils[_0x6ceb('0x13')](_0xe524c7[_0x6ceb('0x12')])[_0x6ceb('0x14')](function(_0x5b6d02){if(_0x5b6d02){_0xe524c7[_0x6ceb('0x15')]=_0x5b6d02['id'];}utils[_0x6ceb('0x16')](_0x6ceb('0x17'),_0xe524c7);});}else{utils[_0x6ceb('0x16')](_0x6ceb('0x17'),_0xe524c7);}if(channels[_0xe524c7[_0x6ceb('0x7')]]){delete channels[_0xe524c7[_0x6ceb('0x7')]];}else if(_0x5ef6ed&&channels[_0x5ef6ed]){delete transfers[_0x6ceb('0x6')][_0x5ef6ed];delete channels[_0x5ef6ed];}}exports[_0x6ceb('0x18')]=function(_0x2f95dc){try{utils['debug'](util[_0x6ceb('0xa')](_0x6ceb('0x19'),_0x2f95dc[_0x6ceb('0x7')]),_0x2f95dc);if(_0x2f95dc[_0x6ceb('0x7')]==_0x2f95dc['linkedid']&&_0x2f95dc[_0x6ceb('0xc')]!=_0x6ceb('0x1a')){utils[_0x6ceb('0x9')](util['format'](_0x6ceb('0x1b'),_0x2f95dc['uniqueid'],_0x2f95dc[_0x6ceb('0x1c')],_0x2f95dc['exten']));channels[_0x2f95dc[_0x6ceb('0x7')]]={'uniqueid':_0x2f95dc[_0x6ceb('0x7')],'accountcode':_0x2f95dc[_0x6ceb('0x12')],'source':_0x2f95dc[_0x6ceb('0x10')],'destination':_0x2f95dc[_0x6ceb('0x1d')],'destinationcontext':_0x2f95dc[_0x6ceb('0x1c')],'channel':_0x2f95dc[_0x6ceb('0xc')],'starttime':utils['now'](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0x6ceb('0x2'),'amaflags':_0x6ceb('0x1e')};}}catch(_0x3631c1){utils[_0x6ceb('0x1f')](util[_0x6ceb('0xa')](_0x6ceb('0x19'),_0x2f95dc[_0x6ceb('0x7')]),_0x3631c1);}};exports[_0x6ceb('0x20')]=function(_0x57656e){try{utils[_0x6ceb('0x21')](util['format']('[%s][calls][newstate]',_0x57656e[_0x6ceb('0x7')]),_0x57656e);if(!_[_0x6ceb('0x22')](channels[_0x57656e[_0x6ceb('0x7')]])&&_0x57656e[_0x6ceb('0x23')]==0x6){utils[_0x6ceb('0x9')](util[_0x6ceb('0xa')](_0x6ceb('0x24'),_0x57656e[_0x6ceb('0x7')],_0x57656e[_0x6ceb('0x1c')],_0x57656e[_0x6ceb('0xc')]));if(_[_0x6ceb('0x22')](channels[_0x57656e[_0x6ceb('0x7')]][_0x6ceb('0x25')])){channels[_0x57656e[_0x6ceb('0x7')]][_0x6ceb('0x25')]=utils[_0x6ceb('0x26')]();}}else if(!_[_0x6ceb('0x22')](channels[_0x57656e[_0x6ceb('0x27')]])&&_0x57656e[_0x6ceb('0x23')]==0x6&&_0x57656e[_0x6ceb('0x1c')]!=_0x6ceb('0x28')){utils[_0x6ceb('0x9')](util[_0x6ceb('0xa')](_0x6ceb('0x29'),_0x57656e[_0x6ceb('0x7')],_0x57656e['linkedid'],_0x57656e[_0x6ceb('0x1c')],_0x57656e['channel']));channels[_0x57656e[_0x6ceb('0x27')]][_0x6ceb('0x12')]=_0x57656e[_0x6ceb('0x12')];channels[_0x57656e['linkedid']]['destinationchannel']=_0x57656e['channel'];if(_['isNil'](channels[_0x57656e[_0x6ceb('0x27')]][_0x6ceb('0x2a')])){channels[_0x57656e['linkedid']]['answertime']=utils[_0x6ceb('0x26')]();}channels[_0x57656e[_0x6ceb('0x27')]][_0x6ceb('0x2b')]=dispositions[_[_0x6ceb('0x2c')](_0x57656e[_0x6ceb('0x23')])]||_0x6ceb('0x4');}}catch(_0x40cc9c){utils[_0x6ceb('0x1f')](util[_0x6ceb('0xa')]('[%s][calls][newstate]',_0x57656e[_0x6ceb('0x7')]),_0x40cc9c);}};exports[_0x6ceb('0x2d')]=function(_0xee294){try{if(!_[_0x6ceb('0x22')](channels[_0xee294[_0x6ceb('0x7')]])){utils[_0x6ceb('0x21')](util[_0x6ceb('0xa')](_0x6ceb('0x2e'),_0xee294['uniqueid']),_0xee294);if(_[_0x6ceb('0x22')](channels[_0xee294['uniqueid']][_0x6ceb('0x2f')])){channels[_0xee294[_0x6ceb('0x7')]][_0x6ceb('0x2f')]=_0xee294['calleridname']+'\x20<'+_0xee294[_0x6ceb('0x10')]+'>';}utils[_0x6ceb('0x9')](util[_0x6ceb('0xa')](_0x6ceb('0x30'),_0xee294[_0x6ceb('0x7')],channels[_0xee294[_0x6ceb('0x7')]][_0x6ceb('0x2f')],_0xee294[_0x6ceb('0x31')]));channels[_0xee294[_0x6ceb('0x7')]][_0x6ceb('0x32')]=utils[_0x6ceb('0x26')]();channels[_0xee294['uniqueid']][_0x6ceb('0x33')]=utils[_0x6ceb('0x34')](channels[_0xee294['uniqueid']][_0x6ceb('0x32')],channels[_0xee294[_0x6ceb('0x7')]]['starttime']);channels[_0xee294[_0x6ceb('0x7')]]['billableseconds']=channels[_0xee294['uniqueid']]['answertime']?utils[_0x6ceb('0x34')](channels[_0xee294[_0x6ceb('0x7')]][_0x6ceb('0x32')],channels[_0xee294['uniqueid']][_0x6ceb('0x2a')]):0x0;writeDB(channels[_0xee294[_0x6ceb('0x7')]]);}}catch(_0x53ecbf){utils[_0x6ceb('0x1f')](util['format'](_0x6ceb('0x2e'),_0xee294[_0x6ceb('0x7')]),_0x53ecbf);}};exports[_0x6ceb('0x35')]=function(_0x5efac0){try{if(!_[_0x6ceb('0x22')](channels[_0x5efac0[_0x6ceb('0x36')]])){utils[_0x6ceb('0x21')](util[_0x6ceb('0xa')](_0x6ceb('0x37'),_0x5efac0[_0x6ceb('0x38')]),_0x5efac0);if(channels[_0x5efac0[_0x6ceb('0x36')]][_0x6ceb('0xc')]==_0x5efac0[_0x6ceb('0x39')]){utils[_0x6ceb('0x9')](util[_0x6ceb('0xa')]('[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s',_0x5efac0['origtransfereruniqueid'],_0x5efac0[_0x6ceb('0x36')],_0x5efac0[_0x6ceb('0x3a')]));channels[_0x5efac0['localtwolinkedid']][_0x6ceb('0x3b')]=_0x5efac0[_0x6ceb('0x3a')];channels[_0x5efac0[_0x6ceb('0x36')]][_0x6ceb('0x3c')]=_0x6ceb('0x3d');}else if(channels[_0x5efac0['localtwolinkedid']][_0x6ceb('0xc')]=_0x5efac0[_0x6ceb('0x3e')]){utils[_0x6ceb('0x9')](util['format']('[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s',_0x5efac0['origtransfereruniqueid'],_0x5efac0['localtwolinkedid'],_0x5efac0[_0x6ceb('0x3f')]));channels[_0x5efac0[_0x6ceb('0x36')]][_0x6ceb('0x3b')]=_0x5efac0['origtransfererchannel'];channels[_0x5efac0[_0x6ceb('0x36')]][_0x6ceb('0x3c')]='_attended';}}}catch(_0x51d3fc){utils['error'](util[_0x6ceb('0xa')](_0x6ceb('0x37'),_0x5efac0['origtransfereruniqueid']),_0x51d3fc);}};exports[_0x6ceb('0x40')]=function(_0x2282b7){try{if(!_[_0x6ceb('0x22')](channels[_0x2282b7['uniqueid']])){utils['debug'](util[_0x6ceb('0xa')]('[%s][calls][musiconholdstart]',_0x2282b7['uniqueid']),_0x2282b7);channels[_0x2282b7['uniqueid']][_0x6ceb('0x41')]=utils[_0x6ceb('0x26')]();utils[_0x6ceb('0x9')](util[_0x6ceb('0xa')](_0x6ceb('0x42'),_0x2282b7[_0x6ceb('0x7')],channels[_0x2282b7[_0x6ceb('0x7')]][_0x6ceb('0x41')]));}}catch(_0x2d5e3c){utils[_0x6ceb('0x1f')](util[_0x6ceb('0xa')]('[%s][calls][musiconholdstart]',_0x2282b7[_0x6ceb('0x7')]),_0x2d5e3c);}};exports[_0x6ceb('0x43')]=function(_0x2b9d98){try{if(!_[_0x6ceb('0x22')](channels[_0x2b9d98['uniqueid']])){utils[_0x6ceb('0x21')](util['format'](_0x6ceb('0x44'),_0x2b9d98[_0x6ceb('0x7')]),_0x2b9d98);if(!_[_0x6ceb('0x22')](channels[_0x2b9d98[_0x6ceb('0x7')]]['musiconholdstartAt'])){channels[_0x2b9d98[_0x6ceb('0x7')]][_0x6ceb('0x45')]+=utils['diffTime'](utils[_0x6ceb('0x26')](),channels[_0x2b9d98[_0x6ceb('0x7')]]['musiconholdstartAt']);utils[_0x6ceb('0x9')](util[_0x6ceb('0xa')]('[%s][calls][musiconholdstop]\x20mohtime:%s',_0x2b9d98[_0x6ceb('0x7')],channels[_0x2b9d98[_0x6ceb('0x7')]][_0x6ceb('0x45')]));delete channels[_0x2b9d98[_0x6ceb('0x7')]][_0x6ceb('0x41')];}}}catch(_0xd7f821){utils[_0x6ceb('0x1f')](util['format'](_0x6ceb('0x44'),_0x2b9d98['uniqueid']),_0xd7f821);}};exports[_0x6ceb('0x46')]=function(_0xedfa67){try{if(!_['isNil'](channels[_0xedfa67['uniqueid']])){utils[_0x6ceb('0x21')](util[_0x6ceb('0xa')]('[%s][calls][varset]',_0xedfa67[_0x6ceb('0x7')]),_0xedfa67);if(!_[_0x6ceb('0x22')](_0xedfa67[_0x6ceb('0x47')][_0x6ceb('0x48')])){utils[_0x6ceb('0x9')](util['format'](_0x6ceb('0x49'),_0xedfa67[_0x6ceb('0x7')],_0xedfa67[_0x6ceb('0x4a')]));channels[_0xedfa67[_0x6ceb('0x7')]]['source']=_0xedfa67[_0x6ceb('0x4a')];}if(!_[_0x6ceb('0x22')](_0xedfa67[_0x6ceb('0x47')][_0x6ceb('0x4b')])){utils[_0x6ceb('0x9')](util[_0x6ceb('0xa')](_0x6ceb('0x4c'),_0xedfa67[_0x6ceb('0x7')],_0xedfa67['value']));channels[_0xedfa67[_0x6ceb('0x7')]]['destination']=_0xedfa67[_0x6ceb('0x4a')];channels[_0xedfa67['uniqueid']][_0x6ceb('0x2f')]='\x22'+_0xedfa67[_0x6ceb('0x4a')]+_0x6ceb('0x4d')+_0xedfa67[_0x6ceb('0x4a')]+'>';}if(!_['isNil'](_0xedfa67[_0x6ceb('0x47')][_0x6ceb('0x4e')])||!_[_0x6ceb('0x22')](_0xedfa67[_0x6ceb('0x47')][_0x6ceb('0x4f')])){utils[_0x6ceb('0x9')](util[_0x6ceb('0xa')]('[%s][calls][varset]\x20variable:%s\x20value:%s',_0xedfa67[_0x6ceb('0x7')],!_[_0x6ceb('0x22')](_0xedfa67['variable']['xmd-callerid-preview'])?_0x6ceb('0x4e'):'xmd-callerid',_0xedfa67[_0x6ceb('0x4a')]));channels[_0xedfa67[_0x6ceb('0x7')]][_0x6ceb('0x2f')]=_0xedfa67['value'];}if(!_[_0x6ceb('0x22')](_0xedfa67['variable'][_0x6ceb('0x50')])||!_[_0x6ceb('0x22')](_0xedfa67[_0x6ceb('0x47')][_0x6ceb('0x51')])){utils[_0x6ceb('0x9')](util['format'](_0x6ceb('0x52'),_0xedfa67[_0x6ceb('0x7')],!_[_0x6ceb('0x22')](_0xedfa67['variable'][_0x6ceb('0x50')])?_0x6ceb('0x50'):_0x6ceb('0x51'),_0xedfa67[_0x6ceb('0x4a')]));channels[_0xedfa67[_0x6ceb('0x7')]]['lastapplication']='Queue';channels[_0xedfa67[_0x6ceb('0x7')]][_0x6ceb('0x53')]=_0xedfa67[_0x6ceb('0x4a')];channels[_0xedfa67[_0x6ceb('0x7')]][_0x6ceb('0xd')]=!![];}if(!_['isNil'](_0xedfa67[_0x6ceb('0x47')][_0x6ceb('0x54')])){utils[_0x6ceb('0x9')](util[_0x6ceb('0xa')]('[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s',_0xedfa67[_0x6ceb('0x7')],_0xedfa67['value']));channels[_0xedfa67[_0x6ceb('0x7')]]['ContactId']=_0xedfa67[_0x6ceb('0x4a')];}if(!_[_0x6ceb('0x22')](_0xedfa67[_0x6ceb('0x47')][_0x6ceb('0x55')])){utils[_0x6ceb('0x9')](util[_0x6ceb('0xa')](_0x6ceb('0x56'),_0xedfa67[_0x6ceb('0x7')],_0xedfa67[_0x6ceb('0x4a')]));channels[_0xedfa67['uniqueid']][_0x6ceb('0x57')]=_0xedfa67[_0x6ceb('0x4a')];}if(!_[_0x6ceb('0x22')](_0xedfa67[_0x6ceb('0x47')][_0x6ceb('0x58')])){utils[_0x6ceb('0x9')](util['format']('[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s',_0xedfa67['uniqueid'],_0xedfa67[_0x6ceb('0x4a')]));channels[_0xedfa67[_0x6ceb('0x7')]][_0x6ceb('0x59')]=_0xedfa67[_0x6ceb('0x4a')];}if(!_['isNil'](_0xedfa67[_0x6ceb('0x47')][_0x6ceb('0x5a')])){utils[_0x6ceb('0x9')](util[_0x6ceb('0xa')](_0x6ceb('0x5b'),_0xedfa67[_0x6ceb('0x7')],_0xedfa67[_0x6ceb('0x4a')]));channels[_0xedfa67[_0x6ceb('0x7')]][_0x6ceb('0x5a')]=_0xedfa67['value'];}}}catch(_0xfeccba){utils[_0x6ceb('0x1f')](util[_0x6ceb('0xa')](_0x6ceb('0x5c'),_0xedfa67[_0x6ceb('0x7')]),_0xfeccba);}};exports[_0x6ceb('0x5d')]=function(_0xa83618){try{if(!_[_0x6ceb('0x22')](channels[_0xa83618[_0x6ceb('0x7')]])){utils[_0x6ceb('0x21')](util[_0x6ceb('0xa')]('[%s][calls][newexten]',_0xa83618[_0x6ceb('0x7')]),_0xa83618);utils['info'](util[_0x6ceb('0xa')](_0x6ceb('0x5e'),_0xa83618[_0x6ceb('0x7')],_0xa83618['application'],_0xa83618[_0x6ceb('0x5f')]));if(_0xa83618[_0x6ceb('0x60')][_0x6ceb('0x61')]()=='set'&&_[_0x6ceb('0x62')](_0xa83618[_0x6ceb('0x5f')][_0x6ceb('0x61')](),_0x6ceb('0x63'))){var _0x59fba0=_0xa83618[_0x6ceb('0x5f')][_0x6ceb('0x64')]('=');var _0x506fe=_0x59fba0[0x0][_0x6ceb('0x65')](_0x59fba0[0x0][_0x6ceb('0x66')]('(')+0x1,_0x59fba0[0x0][_0x6ceb('0x66')](')'));var _0x37506e=_0x59fba0[0x1];channels[_0xa83618['uniqueid']][_0x506fe]=_0x37506e;}if(!_['includes']([_0x6ceb('0x2d'),_0x6ceb('0x67'),_0x6ceb('0x68'),'set','gotoif'],_0xa83618[_0x6ceb('0x60')][_0x6ceb('0x61')]())){channels[_0xa83618['uniqueid']]['lastapplication']=_0xa83618[_0x6ceb('0x60')];channels[_0xa83618[_0x6ceb('0x7')]][_0x6ceb('0x53')]=_0xa83618[_0x6ceb('0x5f')];}}}catch(_0xdf3ec1){utils[_0x6ceb('0x1f')](util[_0x6ceb('0xa')](_0x6ceb('0x69'),_0xa83618[_0x6ceb('0x7')]),_0xdf3ec1);}}; \ No newline at end of file diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index fea4e66..b9eafc2 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 _0x95d9=['./utils','connect','info','[core]\x20connected','shutdown','[core]\x20shutdown','error','close'];(function(_0xefd519,_0xc62635){var _0x4bb882=function(_0x37e0a1){while(--_0x37e0a1){_0xefd519['push'](_0xefd519['shift']());}};_0x4bb882(++_0xc62635);}(_0x95d9,0x138));var _0x995d=function(_0x4a3898,_0x4c9853){_0x4a3898=_0x4a3898-0x0;var _0x25ceb0=_0x95d9[_0x4a3898];return _0x25ceb0;};'use strict';var utils=require(_0x995d('0x0'));exports[_0x995d('0x1')]=function(){utils[_0x995d('0x2')](_0x995d('0x3'));};exports[_0x995d('0x4')]=function(){utils[_0x995d('0x2')](_0x995d('0x5'));};exports['fullybooted']=function(){utils[_0x995d('0x2')]('[core]\x20fullybooted');};exports[_0x995d('0x6')]=function(_0x6be715){utils[_0x995d('0x6')]('[core]\x20error',_0x6be715);};exports[_0x995d('0x7')]=function(){utils[_0x995d('0x2')]('[core]\x20close');};exports['managerevent']=function(_0x373e78){}; \ No newline at end of file +var _0x771d=['[core]\x20connected','shutdown','[core]\x20shutdown','fullybooted','[core]\x20fullybooted','error','[core]\x20error','[core]\x20close','managerevent','./utils','connect','info'];(function(_0x3e99cb,_0x1d2fe0){var _0x1bc729=function(_0x40006f){while(--_0x40006f){_0x3e99cb['push'](_0x3e99cb['shift']());}};_0x1bc729(++_0x1d2fe0);}(_0x771d,0xd5));var _0xd771=function(_0x3eaece,_0x486dc6){_0x3eaece=_0x3eaece-0x0;var _0x55ef74=_0x771d[_0x3eaece];return _0x55ef74;};'use strict';var utils=require(_0xd771('0x0'));exports[_0xd771('0x1')]=function(){utils[_0xd771('0x2')](_0xd771('0x3'));};exports[_0xd771('0x4')]=function(){utils[_0xd771('0x2')](_0xd771('0x5'));};exports[_0xd771('0x6')]=function(){utils[_0xd771('0x2')](_0xd771('0x7'));};exports[_0xd771('0x8')]=function(_0x4b4973){utils['error'](_0xd771('0x9'),_0x4b4973);};exports['close']=function(){utils[_0xd771('0x2')](_0xd771('0xa'));};exports[_0xd771('0xb')]=function(_0xcd66d9){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index e33fd18..1fa10d4 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 _0x15d4=['format','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','uniqueid','channel','dialstring','calleridnum','request','CreateVoiceDialReport','newexten','debug','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','toLowerCase','set','startsWith','appdata','cdr(routeid)','split','error','[%s][dials][newexten]','varset','[%s][dials][varset]','isNil','variable','outboundrouteid','value','[%s][dials][dialbegin]','starttime','now','lastevent','called','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','dialend','[%s][dials][dialend]','dialstatus','assign','answertime','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','hangup','[%s][dials][hangup]','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','calleridname','cause-txt','complete','diffTime','endtime','lodash','./utils','info'];(function(_0x3c22e0,_0x1dc6ea){var _0x215811=function(_0x1b453c){while(--_0x1b453c){_0x3c22e0['push'](_0x3c22e0['shift']());}};_0x215811(++_0x1dc6ea);}(_0x15d4,0xc1));var _0x415d=function(_0x8f6d2c,_0x4aa009){_0x8f6d2c=_0x8f6d2c-0x0;var _0x1634e6=_0x15d4[_0x8f6d2c];return _0x1634e6;};'use strict';var _=require(_0x415d('0x0'));var util=require('util');var utils=require(_0x415d('0x1'));var dials={};function writeDB(_0x4d04f1){utils[_0x415d('0x2')](util[_0x415d('0x3')](_0x415d('0x4'),_0x4d04f1[_0x415d('0x5')],_0x4d04f1[_0x415d('0x6')],_0x4d04f1[_0x415d('0x7')],_0x4d04f1[_0x415d('0x8')],_0x4d04f1['connectedlinenum'],_0x4d04f1['dialstatus']));utils[_0x415d('0x9')](_0x415d('0xa'),_0x4d04f1);delete dials[_0x4d04f1['uniqueid']];}exports[_0x415d('0xb')]=function(_0x1b518c){try{utils[_0x415d('0xc')](util['format']('[%s][dials][newexten]',_0x1b518c[_0x415d('0x5')]),_0x1b518c);utils[_0x415d('0x2')](util[_0x415d('0x3')](_0x415d('0xd'),_0x1b518c[_0x415d('0x5')],_0x1b518c[_0x415d('0xe')],_0x1b518c['appdata']));if(_0x1b518c[_0x415d('0xe')][_0x415d('0xf')]()==_0x415d('0x10')&&_[_0x415d('0x11')](_0x1b518c[_0x415d('0x12')][_0x415d('0xf')](),_0x415d('0x13'))){var _0x3972f3=_0x1b518c[_0x415d('0x12')][_0x415d('0x14')]('=');dials[_0x1b518c[_0x415d('0x5')]]={'routeId':_0x3972f3[0x1]};}}catch(_0xaf5ed3){utils[_0x415d('0x15')](util[_0x415d('0x3')](_0x415d('0x16'),_0x1b518c[_0x415d('0x5')]),_0xaf5ed3);}};exports[_0x415d('0x17')]=function(_0x422def){try{utils[_0x415d('0xc')](util[_0x415d('0x3')](_0x415d('0x18'),_0x422def['uniqueid']),_0x422def);if(!_[_0x415d('0x19')](_0x422def[_0x415d('0x1a')][_0x415d('0x1b')])){utils['info'](util[_0x415d('0x3')]('[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s',_0x422def[_0x415d('0x5')],_0x422def[_0x415d('0x1c')]));dials[_0x422def['uniqueid']]={'routeId':_0x422def[_0x415d('0x1c')]};}}catch(_0x3d544e){utils[_0x415d('0x15')](util[_0x415d('0x3')](_0x415d('0x18'),_0x422def[_0x415d('0x5')]),_0x3d544e);}};exports['dialbegin']=function(_0x30abdd){try{if(!_[_0x415d('0x19')](dials[_0x30abdd[_0x415d('0x5')]])){utils[_0x415d('0xc')](util[_0x415d('0x3')](_0x415d('0x1d'),_0x30abdd[_0x415d('0x5')]),_0x30abdd);dials[_0x30abdd[_0x415d('0x5')]]=_['assign'](dials[_0x30abdd[_0x415d('0x5')]],_0x30abdd);dials[_0x30abdd[_0x415d('0x5')]][_0x415d('0x1e')]=utils[_0x415d('0x1f')]();dials[_0x30abdd[_0x415d('0x5')]][_0x415d('0x20')]=_0x415d('0x21');utils['info'](util[_0x415d('0x3')](_0x415d('0x22'),_0x30abdd[_0x415d('0x5')],dials[_0x30abdd[_0x415d('0x5')]][_0x415d('0x1e')]));}}catch(_0x344f98){utils[_0x415d('0x15')](util[_0x415d('0x3')]('[%s][dials][dialbegin]',_0x30abdd[_0x415d('0x5')]),_0x344f98);}};exports[_0x415d('0x23')]=function(_0x4b335e){try{if(!_[_0x415d('0x19')](dials[_0x4b335e[_0x415d('0x5')]])){utils[_0x415d('0xc')](util['format'](_0x415d('0x24'),_0x4b335e[_0x415d('0x5')]),_0x4b335e);dials[_0x4b335e[_0x415d('0x5')]][_0x415d('0x25')]=_0x4b335e[_0x415d('0x25')];if(_0x4b335e['dialstatus']=='ANSWER'){dials[_0x4b335e['uniqueid']]=_[_0x415d('0x26')](dials[_0x4b335e[_0x415d('0x5')]],_0x4b335e);dials[_0x4b335e['uniqueid']][_0x415d('0x27')]=utils[_0x415d('0x1f')]();dials[_0x4b335e['uniqueid']][_0x415d('0x20')]='connect';utils[_0x415d('0x2')](util[_0x415d('0x3')](_0x415d('0x28'),_0x4b335e['uniqueid'],_0x4b335e['dialstatus'],dials[_0x4b335e[_0x415d('0x5')]][_0x415d('0x27')]));}else{utils[_0x415d('0x2')](util[_0x415d('0x3')]('[%s][dials][dialend]\x20dialstatus:%s',_0x4b335e[_0x415d('0x5')],_0x4b335e['dialstatus']));}}}catch(_0x4a0779){utils[_0x415d('0x15')](util[_0x415d('0x3')](_0x415d('0x24'),_0x4b335e[_0x415d('0x5')]),_0x4a0779);}};exports[_0x415d('0x29')]=function(_0x449d54){try{if(!_['isNil'](dials[_0x449d54['uniqueid']])){utils[_0x415d('0xc')](util[_0x415d('0x3')](_0x415d('0x2a'),_0x449d54[_0x415d('0x5')]),_0x449d54);utils[_0x415d('0x2')](util[_0x415d('0x3')](_0x415d('0x2b'),_0x449d54[_0x415d('0x5')],_0x449d54[_0x415d('0x8')],_0x449d54[_0x415d('0x2c')],_0x449d54[_0x415d('0x2d')]));dials[_0x449d54[_0x415d('0x5')]]=_[_0x415d('0x26')](dials[_0x449d54[_0x415d('0x5')]],{'endtime':utils[_0x415d('0x1f')](),'lastevent':_0x415d('0x2e')});dials[_0x449d54['uniqueid']]['duration']=utils[_0x415d('0x2f')](dials[_0x449d54[_0x415d('0x5')]]['endtime'],dials[_0x449d54[_0x415d('0x5')]][_0x415d('0x1e')]);dials[_0x449d54[_0x415d('0x5')]]['holdtime']=utils[_0x415d('0x2f')](dials[_0x449d54[_0x415d('0x5')]][_0x415d('0x27')]||dials[_0x449d54[_0x415d('0x5')]][_0x415d('0x30')],dials[_0x449d54[_0x415d('0x5')]][_0x415d('0x1e')]);dials[_0x449d54[_0x415d('0x5')]]['billableseconds']=dials[_0x449d54[_0x415d('0x5')]]['answertime']?utils[_0x415d('0x2f')](dials[_0x449d54[_0x415d('0x5')]][_0x415d('0x30')],dials[_0x449d54[_0x415d('0x5')]][_0x415d('0x27')]):0x0;writeDB(dials[_0x449d54[_0x415d('0x5')]]);}}catch(_0x315a11){utils[_0x415d('0x15')](util[_0x415d('0x3')](_0x415d('0x2a'),_0x449d54[_0x415d('0x5')]),_0x315a11);}}; \ No newline at end of file +var _0x5d32=['connectedlinenum','request','CreateVoiceDialReport','uniqueid','newexten','[%s][dials][newexten]','application','toLowerCase','appdata','cdr(routeid)','error','debug','[%s][dials][varset]','isNil','outboundrouteid','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','dialbegin','[%s][dials][dialbegin]','assign','starttime','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','dialend','[%s][dials][dialend]','dialstatus','ANSWER','answertime','now','lastevent','connect','[%s][dials][dialend]\x20dialstatus:%s','hangup','[%s][dials][hangup]','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','calleridname','cause-txt','complete','duration','endtime','holdtime','diffTime','billableseconds','util','info','format','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','channel','dialstring','calleridnum'];(function(_0x348b29,_0x3be5e9){var _0xc260c5=function(_0x568363){while(--_0x568363){_0x348b29['push'](_0x348b29['shift']());}};_0xc260c5(++_0x3be5e9);}(_0x5d32,0xbd));var _0x25d3=function(_0x2d364e,_0x301c5e){_0x2d364e=_0x2d364e-0x0;var _0x1b9312=_0x5d32[_0x2d364e];return _0x1b9312;};'use strict';var _=require('lodash');var util=require(_0x25d3('0x0'));var utils=require('./utils');var dials={};function writeDB(_0x41b342){utils[_0x25d3('0x1')](util[_0x25d3('0x2')](_0x25d3('0x3'),_0x41b342['uniqueid'],_0x41b342[_0x25d3('0x4')],_0x41b342[_0x25d3('0x5')],_0x41b342[_0x25d3('0x6')],_0x41b342[_0x25d3('0x7')],_0x41b342['dialstatus']));utils[_0x25d3('0x8')](_0x25d3('0x9'),_0x41b342);delete dials[_0x41b342[_0x25d3('0xa')]];}exports[_0x25d3('0xb')]=function(_0xe6294a){try{utils['debug'](util['format'](_0x25d3('0xc'),_0xe6294a['uniqueid']),_0xe6294a);utils[_0x25d3('0x1')](util[_0x25d3('0x2')]('[%s][dials][newexten]\x20application:%s\x20appdata:%s',_0xe6294a['uniqueid'],_0xe6294a['application'],_0xe6294a['appdata']));if(_0xe6294a[_0x25d3('0xd')][_0x25d3('0xe')]()=='set'&&_['startsWith'](_0xe6294a[_0x25d3('0xf')]['toLowerCase'](),_0x25d3('0x10'))){var _0x427c2b=_0xe6294a[_0x25d3('0xf')]['split']('=');dials[_0xe6294a[_0x25d3('0xa')]]={'routeId':_0x427c2b[0x1]};}}catch(_0x2dccb2){utils[_0x25d3('0x11')](util['format'](_0x25d3('0xc'),_0xe6294a[_0x25d3('0xa')]),_0x2dccb2);}};exports['varset']=function(_0x12572b){try{utils[_0x25d3('0x12')](util[_0x25d3('0x2')](_0x25d3('0x13'),_0x12572b[_0x25d3('0xa')]),_0x12572b);if(!_[_0x25d3('0x14')](_0x12572b['variable'][_0x25d3('0x15')])){utils[_0x25d3('0x1')](util[_0x25d3('0x2')](_0x25d3('0x16'),_0x12572b[_0x25d3('0xa')],_0x12572b[_0x25d3('0x17')]));dials[_0x12572b[_0x25d3('0xa')]]={'routeId':_0x12572b[_0x25d3('0x17')]};}}catch(_0x47ba6c){utils[_0x25d3('0x11')](util[_0x25d3('0x2')](_0x25d3('0x13'),_0x12572b[_0x25d3('0xa')]),_0x47ba6c);}};exports[_0x25d3('0x18')]=function(_0x25ba7a){try{if(!_[_0x25d3('0x14')](dials[_0x25ba7a[_0x25d3('0xa')]])){utils[_0x25d3('0x12')](util[_0x25d3('0x2')](_0x25d3('0x19'),_0x25ba7a['uniqueid']),_0x25ba7a);dials[_0x25ba7a[_0x25d3('0xa')]]=_[_0x25d3('0x1a')](dials[_0x25ba7a[_0x25d3('0xa')]],_0x25ba7a);dials[_0x25ba7a[_0x25d3('0xa')]][_0x25d3('0x1b')]=utils['now']();dials[_0x25ba7a[_0x25d3('0xa')]]['lastevent']='called';utils[_0x25d3('0x1')](util['format'](_0x25d3('0x1c'),_0x25ba7a[_0x25d3('0xa')],dials[_0x25ba7a[_0x25d3('0xa')]][_0x25d3('0x1b')]));}}catch(_0x540927){utils['error'](util['format'](_0x25d3('0x19'),_0x25ba7a[_0x25d3('0xa')]),_0x540927);}};exports[_0x25d3('0x1d')]=function(_0x54d953){try{if(!_[_0x25d3('0x14')](dials[_0x54d953['uniqueid']])){utils[_0x25d3('0x12')](util[_0x25d3('0x2')](_0x25d3('0x1e'),_0x54d953[_0x25d3('0xa')]),_0x54d953);dials[_0x54d953['uniqueid']][_0x25d3('0x1f')]=_0x54d953[_0x25d3('0x1f')];if(_0x54d953[_0x25d3('0x1f')]==_0x25d3('0x20')){dials[_0x54d953[_0x25d3('0xa')]]=_[_0x25d3('0x1a')](dials[_0x54d953[_0x25d3('0xa')]],_0x54d953);dials[_0x54d953['uniqueid']][_0x25d3('0x21')]=utils[_0x25d3('0x22')]();dials[_0x54d953[_0x25d3('0xa')]][_0x25d3('0x23')]=_0x25d3('0x24');utils['info'](util[_0x25d3('0x2')]('[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect',_0x54d953[_0x25d3('0xa')],_0x54d953['dialstatus'],dials[_0x54d953[_0x25d3('0xa')]]['answertime']));}else{utils[_0x25d3('0x1')](util[_0x25d3('0x2')](_0x25d3('0x25'),_0x54d953[_0x25d3('0xa')],_0x54d953['dialstatus']));}}}catch(_0xf21b01){utils[_0x25d3('0x11')](util[_0x25d3('0x2')](_0x25d3('0x1e'),_0x54d953[_0x25d3('0xa')]),_0xf21b01);}};exports[_0x25d3('0x26')]=function(_0x4ee542){try{if(!_[_0x25d3('0x14')](dials[_0x4ee542[_0x25d3('0xa')]])){utils[_0x25d3('0x12')](util[_0x25d3('0x2')](_0x25d3('0x27'),_0x4ee542[_0x25d3('0xa')]),_0x4ee542);utils[_0x25d3('0x1')](util[_0x25d3('0x2')](_0x25d3('0x28'),_0x4ee542[_0x25d3('0xa')],_0x4ee542[_0x25d3('0x6')],_0x4ee542[_0x25d3('0x29')],_0x4ee542[_0x25d3('0x2a')]));dials[_0x4ee542[_0x25d3('0xa')]]=_[_0x25d3('0x1a')](dials[_0x4ee542[_0x25d3('0xa')]],{'endtime':utils[_0x25d3('0x22')](),'lastevent':_0x25d3('0x2b')});dials[_0x4ee542[_0x25d3('0xa')]][_0x25d3('0x2c')]=utils['diffTime'](dials[_0x4ee542['uniqueid']][_0x25d3('0x2d')],dials[_0x4ee542[_0x25d3('0xa')]]['starttime']);dials[_0x4ee542[_0x25d3('0xa')]][_0x25d3('0x2e')]=utils[_0x25d3('0x2f')](dials[_0x4ee542[_0x25d3('0xa')]][_0x25d3('0x21')]||dials[_0x4ee542['uniqueid']][_0x25d3('0x2d')],dials[_0x4ee542[_0x25d3('0xa')]][_0x25d3('0x1b')]);dials[_0x4ee542[_0x25d3('0xa')]][_0x25d3('0x30')]=dials[_0x4ee542[_0x25d3('0xa')]]['answertime']?utils[_0x25d3('0x2f')](dials[_0x4ee542[_0x25d3('0xa')]][_0x25d3('0x2d')],dials[_0x4ee542['uniqueid']]['answertime']):0x0;writeDB(dials[_0x4ee542[_0x25d3('0xa')]]);}}catch(_0x36d032){utils[_0x25d3('0x11')](util[_0x25d3('0x2')](_0x25d3('0x27'),_0x4ee542[_0x25d3('0xa')]),_0x36d032);}}; \ No newline at end of file diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index f45d045..fd9dcef 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 _0xa001=['./core.controller','connect','shutdown','fullybooted','error','close','managerevent','devicestatechange','debug','format','[%s][index][devicestatechange]','device','[%s][index][agentcalled]','uniqueid','agentcalled','agentringnoanswer','[%s][index][agentringnoanswer]','agentconnect','[%s][index][agentconnect]','agentcomplete','[%s][index][agentcomplete]','queuecallerabandon','[%s][index][queuecallerabandon]','[%s][index][queuecallerjoin]','queuecallerjoin','[%s][index][queuecallerleave]','queuecallerleave','musiconholdstart','[%s][index][musiconholdstart]','musiconholdstop','[%s][index][musiconholdstop]','newstate','[%s][index][newstate]','hangup','[%s][index][hangup]','cdr','[%s][index][cdr]','[%s][index][blindtransfer]','blindtransfer','attendedtransfer','[%s][index][attendedtransfer]','origtransfereruniqueid','varset','[%s][index][varset]','newexten','newchannel','[%s][index][newchannel]','dialbegin','[%s][index][dialbegin]','[%s]dialbegin','dialend','[%s][index][dialend]','asterisk-manager','./utils','util','username','asterisk','password','xdr','disabled','info','XDR\x20DISABLED','./agents.controller','./calls.controller','./queues.controller','./recordings.controller','./members.controller','./dials.controller','./transfers.controller'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa001,0xbe));var _0x1a00=function(_0x2e73e1,_0x2a6991){_0x2e73e1=_0x2e73e1-0x0;var _0x42af98=_0xa001[_0x2e73e1];return _0x42af98;};var AsteriskManager=require(_0x1a00('0x0'));var config=require('../../config/environment');var utils=require(_0x1a00('0x1'));var util=require(_0x1a00('0x2'));var ami=new AsteriskManager(config['asterisk']['port'],config['asterisk']['ip'],config['asterisk'][_0x1a00('0x3')],config[_0x1a00('0x4')][_0x1a00('0x5')],!![]);ami['keepConnected']();if(config[_0x1a00('0x6')]&&config[_0x1a00('0x6')][_0x1a00('0x7')]){utils[_0x1a00('0x8')](_0x1a00('0x9'));}else{var agents=require(_0x1a00('0xa'));var calls=require(_0x1a00('0xb'));var queues=require(_0x1a00('0xc'));var recordings=require(_0x1a00('0xd'));var members=require(_0x1a00('0xe'));var dials=require(_0x1a00('0xf'));var transfers=require(_0x1a00('0x10'));var core=require(_0x1a00('0x11'));ami['on'](_0x1a00('0x12'),core[_0x1a00('0x12')]);ami['on'](_0x1a00('0x13'),core[_0x1a00('0x13')]);ami['on'](_0x1a00('0x14'),core[_0x1a00('0x14')]);ami['on'](_0x1a00('0x15'),core[_0x1a00('0x15')]);ami['on'](_0x1a00('0x16'),core[_0x1a00('0x16')]);ami['on']('managerevent',core[_0x1a00('0x17')]);ami['on'](_0x1a00('0x18'),function(_0x1182a0){try{utils[_0x1a00('0x19')](util[_0x1a00('0x1a')](_0x1a00('0x1b'),_0x1182a0[_0x1a00('0x1c')]),_0x1182a0);members['devicestatechange'](_0x1182a0);}catch(_0x143fa2){utils['error'](util[_0x1a00('0x1a')](_0x1a00('0x1b'),_0x1182a0[_0x1a00('0x1c')]),_0x143fa2);}});ami['on']('agentcalled',function(_0x1c27dc){try{utils[_0x1a00('0x19')](util[_0x1a00('0x1a')](_0x1a00('0x1d'),_0x1c27dc[_0x1a00('0x1e')]),_0x1c27dc);agents[_0x1a00('0x1f')](_0x1c27dc);}catch(_0x2f52b9){utils[_0x1a00('0x15')](util[_0x1a00('0x1a')](_0x1a00('0x1d'),_0x1c27dc[_0x1a00('0x1e')]),_0x2f52b9);}});ami['on'](_0x1a00('0x20'),function(_0x2ac24c){try{utils[_0x1a00('0x19')](util[_0x1a00('0x1a')](_0x1a00('0x21'),_0x2ac24c[_0x1a00('0x1e')]),_0x2ac24c);agents[_0x1a00('0x20')](_0x2ac24c);}catch(_0x2b55b2){utils[_0x1a00('0x15')](util[_0x1a00('0x1a')]('[%s][index][agentringnoanswer]',_0x2ac24c[_0x1a00('0x1e')]),_0x2b55b2);}});ami['on'](_0x1a00('0x22'),function(_0x579221){try{utils[_0x1a00('0x19')](util[_0x1a00('0x1a')](_0x1a00('0x23'),_0x579221[_0x1a00('0x1e')]),_0x579221);agents[_0x1a00('0x22')](_0x579221);queues['agentconnect'](_0x579221);}catch(_0x58c612){utils[_0x1a00('0x15')](util[_0x1a00('0x1a')]('[%s][index][agentconnect]',_0x579221[_0x1a00('0x1e')]),_0x58c612);}});ami['on'](_0x1a00('0x24'),function(_0x1336e6){try{utils[_0x1a00('0x19')](util[_0x1a00('0x1a')]('[%s][index][agentcomplete]',_0x1336e6[_0x1a00('0x1e')]),_0x1336e6);agents[_0x1a00('0x24')](_0x1336e6);queues[_0x1a00('0x24')](_0x1336e6);members[_0x1a00('0x24')](_0x1336e6);}catch(_0x2e33d0){utils['error'](util[_0x1a00('0x1a')](_0x1a00('0x25'),_0x1336e6[_0x1a00('0x1e')]),_0x2e33d0);}});ami['on'](_0x1a00('0x26'),function(_0x5aaa64){try{utils['debug'](util[_0x1a00('0x1a')](_0x1a00('0x27'),_0x5aaa64[_0x1a00('0x1e')]),_0x5aaa64);agents['queuecallerabandon'](_0x5aaa64);queues['queuecallerabandon'](_0x5aaa64);}catch(_0x4eb319){utils[_0x1a00('0x15')](util[_0x1a00('0x1a')]('[%s][index][queuecallerabandon]',_0x5aaa64[_0x1a00('0x1e')]),_0x4eb319);}});ami['on']('queuecallerjoin',function(_0x4478ec){try{utils['debug'](util[_0x1a00('0x1a')](_0x1a00('0x28'),_0x4478ec['uniqueid']),_0x4478ec);queues[_0x1a00('0x29')](_0x4478ec);recordings[_0x1a00('0x29')](_0x4478ec);}catch(_0x4b965f){utils[_0x1a00('0x15')](util['format'](_0x1a00('0x28'),_0x4478ec[_0x1a00('0x1e')]),_0x4b965f);}});ami['on']('queuecallerleave',function(_0x227237){try{utils[_0x1a00('0x19')](util[_0x1a00('0x1a')](_0x1a00('0x2a'),_0x227237['uniqueid']),_0x227237);queues[_0x1a00('0x2b')](_0x227237);}catch(_0x435f0b){utils[_0x1a00('0x15')](util[_0x1a00('0x1a')](_0x1a00('0x2a'),_0x227237[_0x1a00('0x1e')]),_0x435f0b);}});ami['on'](_0x1a00('0x2c'),function(_0x14c2ea){try{utils[_0x1a00('0x19')](util[_0x1a00('0x1a')](_0x1a00('0x2d'),_0x14c2ea[_0x1a00('0x1e')]),_0x14c2ea);queues[_0x1a00('0x2c')](_0x14c2ea);calls[_0x1a00('0x2c')](_0x14c2ea);}catch(_0x23687d){utils['error'](util[_0x1a00('0x1a')](_0x1a00('0x2d'),_0x14c2ea[_0x1a00('0x1e')]),_0x23687d);}});ami['on'](_0x1a00('0x2e'),function(_0x5c1319){try{utils[_0x1a00('0x19')](util['format'](_0x1a00('0x2f'),_0x5c1319[_0x1a00('0x1e')]),_0x5c1319);queues[_0x1a00('0x2e')](_0x5c1319);calls[_0x1a00('0x2e')](_0x5c1319);}catch(_0x393b79){utils[_0x1a00('0x15')](util[_0x1a00('0x1a')]('[%s][index][musiconholdstop]',_0x5c1319[_0x1a00('0x1e')]),_0x393b79);}});ami['on']('newstate',function(_0x113416){try{utils[_0x1a00('0x19')](util[_0x1a00('0x1a')]('[%s][index][newstate]',_0x113416[_0x1a00('0x1e')]),_0x113416);calls[_0x1a00('0x30')](_0x113416);recordings[_0x1a00('0x30')](_0x113416);}catch(_0x41fa63){utils[_0x1a00('0x15')](util['format'](_0x1a00('0x31'),_0x113416['uniqueid']),_0x41fa63);}});ami['on'](_0x1a00('0x32'),function(_0x51c761){try{utils[_0x1a00('0x19')](util['format'](_0x1a00('0x33'),_0x51c761['uniqueid']),_0x51c761);calls[_0x1a00('0x32')](_0x51c761);recordings[_0x1a00('0x32')](_0x51c761);dials[_0x1a00('0x32')](_0x51c761);agents[_0x1a00('0x32')](_0x51c761);queues['hangup'](_0x51c761);}catch(_0x3ef649){utils[_0x1a00('0x15')](util['format'](_0x1a00('0x33'),_0x51c761['uniqueid']),_0x3ef649);}});ami['on'](_0x1a00('0x34'),function(_0xe3cd9d){try{utils[_0x1a00('0x19')](util[_0x1a00('0x1a')](_0x1a00('0x35'),_0xe3cd9d['uniqueid']),_0xe3cd9d);members['cdr'](_0xe3cd9d);}catch(_0x11b2c4){utils[_0x1a00('0x15')](util[_0x1a00('0x1a')]('[%s][index][cdr]',_0xe3cd9d[_0x1a00('0x1e')]),_0x11b2c4);}});ami['on']('blindtransfer',function(_0x2a281a){try{utils[_0x1a00('0x19')](util['format'](_0x1a00('0x36'),_0x2a281a[_0x1a00('0x1e')]),_0x2a281a);queues['blindtransfer'](_0x2a281a);agents[_0x1a00('0x37')](_0x2a281a);transfers[_0x1a00('0x37')](_0x2a281a);}catch(_0x268bf9){utils[_0x1a00('0x15')](util[_0x1a00('0x1a')](_0x1a00('0x36'),_0x2a281a[_0x1a00('0x1e')]),_0x268bf9);}});ami['on'](_0x1a00('0x38'),function(_0x23e1b2){try{utils['debug'](util[_0x1a00('0x1a')](_0x1a00('0x39'),_0x23e1b2[_0x1a00('0x3a')]),_0x23e1b2);queues[_0x1a00('0x38')](_0x23e1b2);transfers['attendedtransfer'](_0x23e1b2);agents['attendedtransfer'](_0x23e1b2);calls[_0x1a00('0x38')](_0x23e1b2);}catch(_0x51f7f5){utils[_0x1a00('0x15')](util[_0x1a00('0x1a')]('[%s][index][attendedtransfer]',_0x23e1b2[_0x1a00('0x3a')]),_0x51f7f5);}});ami['on'](_0x1a00('0x3b'),function(_0xcbccd0){try{utils[_0x1a00('0x19')](util['format'](_0x1a00('0x3c'),_0xcbccd0[_0x1a00('0x1e')]),_0xcbccd0);queues[_0x1a00('0x3b')](_0xcbccd0);recordings['varset'](_0xcbccd0);calls[_0x1a00('0x3b')](_0xcbccd0);dials['varset'](_0xcbccd0);}catch(_0x41ee95){utils[_0x1a00('0x15')](util[_0x1a00('0x1a')](_0x1a00('0x3c'),_0xcbccd0[_0x1a00('0x1e')]),_0x41ee95);}});ami['on'](_0x1a00('0x3d'),function(_0x3e1141){try{utils[_0x1a00('0x19')](util['format']('[%s][index][newexten]',_0x3e1141[_0x1a00('0x1e')]),_0x3e1141);calls[_0x1a00('0x3d')](_0x3e1141);recordings['newexten'](_0x3e1141);dials['newexten'](_0x3e1141);}catch(_0x5e1c19){utils[_0x1a00('0x15')](util[_0x1a00('0x1a')]('[%s][index][newexten]',_0x3e1141['uniqueid']),_0x5e1c19);}});ami['on'](_0x1a00('0x3e'),function(_0x4f7d6d){try{utils['debug'](util[_0x1a00('0x1a')](_0x1a00('0x3f'),_0x4f7d6d[_0x1a00('0x1e')]),_0x4f7d6d);calls[_0x1a00('0x3e')](_0x4f7d6d);recordings[_0x1a00('0x3e')](_0x4f7d6d);}catch(_0x39d7d8){utils[_0x1a00('0x15')](util[_0x1a00('0x1a')](_0x1a00('0x3f'),_0x4f7d6d[_0x1a00('0x1e')]),_0x39d7d8);}});ami['on'](_0x1a00('0x40'),function(_0x576640){try{utils[_0x1a00('0x19')](util[_0x1a00('0x1a')](_0x1a00('0x41'),_0x576640[_0x1a00('0x1e')]),_0x576640);dials[_0x1a00('0x40')](_0x576640);}catch(_0x280e22){utils[_0x1a00('0x15')](util[_0x1a00('0x1a')](_0x1a00('0x42'),_0x576640[_0x1a00('0x1e')]),_0x280e22);}});ami['on'](_0x1a00('0x43'),function(_0x15311c){try{utils['debug'](util[_0x1a00('0x1a')](_0x1a00('0x44'),_0x15311c['uniqueid']),_0x15311c);dials[_0x1a00('0x43')](_0x15311c);}catch(_0x349091){utils[_0x1a00('0x15')](util['format']('[%s][index][dialend]',_0x15311c[_0x1a00('0x1e')]),_0x349091);}});} \ No newline at end of file +var _0x4948=['[%s][index][queuecallerabandon]','queuecallerjoin','[%s][index][queuecallerjoin]','[%s][index][queuecallerleave]','queuecallerleave','musiconholdstart','[%s][index][musiconholdstart]','musiconholdstop','[%s][index][musiconholdstop]','newstate','[%s][index][newstate]','hangup','[%s][index][hangup]','cdr','[%s][index][cdr]','blindtransfer','[%s][index][blindtransfer]','attendedtransfer','[%s][index][attendedtransfer]','origtransfereruniqueid','varset','[%s][index][varset]','[%s][index][newexten]','newexten','newchannel','[%s][index][newchannel]','dialbegin','[%s][index][dialbegin]','[%s]dialbegin','dialend','[%s][index][dialend]','asterisk-manager','../../config/environment','util','asterisk','port','username','password','keepConnected','xdr','disabled','XDR\x20DISABLED','./agents.controller','./calls.controller','./recordings.controller','./members.controller','./dials.controller','./transfers.controller','connect','shutdown','fullybooted','close','managerevent','debug','format','device','devicestatechange','error','[%s][index][devicestatechange]','agentcalled','[%s][index][agentcalled]','agentringnoanswer','[%s][index][agentringnoanswer]','uniqueid','agentconnect','[%s][index][agentconnect]','agentcomplete','[%s][index][agentcomplete]','queuecallerabandon'];(function(_0x3c1e8a,_0x38fc3b){var _0x271c83=function(_0x294660){while(--_0x294660){_0x3c1e8a['push'](_0x3c1e8a['shift']());}};_0x271c83(++_0x38fc3b);}(_0x4948,0x64));var _0x8494=function(_0x10bf6c,_0x374250){_0x10bf6c=_0x10bf6c-0x0;var _0x6870ad=_0x4948[_0x10bf6c];return _0x6870ad;};var AsteriskManager=require(_0x8494('0x0'));var config=require(_0x8494('0x1'));var utils=require('./utils');var util=require(_0x8494('0x2'));var ami=new AsteriskManager(config[_0x8494('0x3')][_0x8494('0x4')],config['asterisk']['ip'],config[_0x8494('0x3')][_0x8494('0x5')],config[_0x8494('0x3')][_0x8494('0x6')],!![]);ami[_0x8494('0x7')]();if(config[_0x8494('0x8')]&&config['xdr'][_0x8494('0x9')]){utils['info'](_0x8494('0xa'));}else{var agents=require(_0x8494('0xb'));var calls=require(_0x8494('0xc'));var queues=require('./queues.controller');var recordings=require(_0x8494('0xd'));var members=require(_0x8494('0xe'));var dials=require(_0x8494('0xf'));var transfers=require(_0x8494('0x10'));var core=require('./core.controller');ami['on'](_0x8494('0x11'),core[_0x8494('0x11')]);ami['on'](_0x8494('0x12'),core[_0x8494('0x12')]);ami['on'](_0x8494('0x13'),core[_0x8494('0x13')]);ami['on']('error',core['error']);ami['on'](_0x8494('0x14'),core['close']);ami['on'](_0x8494('0x15'),core['managerevent']);ami['on']('devicestatechange',function(_0x107de4){try{utils[_0x8494('0x16')](util[_0x8494('0x17')]('[%s][index][devicestatechange]',_0x107de4[_0x8494('0x18')]),_0x107de4);members[_0x8494('0x19')](_0x107de4);}catch(_0x4b0930){utils[_0x8494('0x1a')](util['format'](_0x8494('0x1b'),_0x107de4['device']),_0x4b0930);}});ami['on'](_0x8494('0x1c'),function(_0x520259){try{utils[_0x8494('0x16')](util[_0x8494('0x17')](_0x8494('0x1d'),_0x520259['uniqueid']),_0x520259);agents[_0x8494('0x1c')](_0x520259);}catch(_0x1439fb){utils[_0x8494('0x1a')](util[_0x8494('0x17')]('[%s][index][agentcalled]',_0x520259['uniqueid']),_0x1439fb);}});ami['on'](_0x8494('0x1e'),function(_0x1ab8c8){try{utils[_0x8494('0x16')](util['format'](_0x8494('0x1f'),_0x1ab8c8[_0x8494('0x20')]),_0x1ab8c8);agents[_0x8494('0x1e')](_0x1ab8c8);}catch(_0x12e0e1){utils[_0x8494('0x1a')](util[_0x8494('0x17')](_0x8494('0x1f'),_0x1ab8c8[_0x8494('0x20')]),_0x12e0e1);}});ami['on'](_0x8494('0x21'),function(_0x96d3d){try{utils[_0x8494('0x16')](util['format'](_0x8494('0x22'),_0x96d3d[_0x8494('0x20')]),_0x96d3d);agents[_0x8494('0x21')](_0x96d3d);queues[_0x8494('0x21')](_0x96d3d);}catch(_0x3d46ba){utils[_0x8494('0x1a')](util[_0x8494('0x17')](_0x8494('0x22'),_0x96d3d['uniqueid']),_0x3d46ba);}});ami['on'](_0x8494('0x23'),function(_0x14d676){try{utils[_0x8494('0x16')](util['format'](_0x8494('0x24'),_0x14d676[_0x8494('0x20')]),_0x14d676);agents[_0x8494('0x23')](_0x14d676);queues[_0x8494('0x23')](_0x14d676);members[_0x8494('0x23')](_0x14d676);}catch(_0x2710f0){utils['error'](util[_0x8494('0x17')](_0x8494('0x24'),_0x14d676[_0x8494('0x20')]),_0x2710f0);}});ami['on'](_0x8494('0x25'),function(_0x25df7d){try{utils[_0x8494('0x16')](util[_0x8494('0x17')]('[%s][index][queuecallerabandon]',_0x25df7d['uniqueid']),_0x25df7d);agents[_0x8494('0x25')](_0x25df7d);queues[_0x8494('0x25')](_0x25df7d);}catch(_0x384b76){utils['error'](util[_0x8494('0x17')](_0x8494('0x26'),_0x25df7d[_0x8494('0x20')]),_0x384b76);}});ami['on'](_0x8494('0x27'),function(_0x496f86){try{utils[_0x8494('0x16')](util[_0x8494('0x17')](_0x8494('0x28'),_0x496f86[_0x8494('0x20')]),_0x496f86);queues[_0x8494('0x27')](_0x496f86);recordings[_0x8494('0x27')](_0x496f86);}catch(_0x78929){utils['error'](util[_0x8494('0x17')]('[%s][index][queuecallerjoin]',_0x496f86['uniqueid']),_0x78929);}});ami['on']('queuecallerleave',function(_0x29d3e8){try{utils[_0x8494('0x16')](util['format'](_0x8494('0x29'),_0x29d3e8['uniqueid']),_0x29d3e8);queues[_0x8494('0x2a')](_0x29d3e8);}catch(_0x2c6608){utils[_0x8494('0x1a')](util[_0x8494('0x17')]('[%s][index][queuecallerleave]',_0x29d3e8['uniqueid']),_0x2c6608);}});ami['on'](_0x8494('0x2b'),function(_0x48048f){try{utils[_0x8494('0x16')](util[_0x8494('0x17')](_0x8494('0x2c'),_0x48048f[_0x8494('0x20')]),_0x48048f);queues[_0x8494('0x2b')](_0x48048f);calls[_0x8494('0x2b')](_0x48048f);}catch(_0x34c0c6){utils[_0x8494('0x1a')](util[_0x8494('0x17')](_0x8494('0x2c'),_0x48048f[_0x8494('0x20')]),_0x34c0c6);}});ami['on'](_0x8494('0x2d'),function(_0x38c689){try{utils[_0x8494('0x16')](util[_0x8494('0x17')](_0x8494('0x2e'),_0x38c689[_0x8494('0x20')]),_0x38c689);queues[_0x8494('0x2d')](_0x38c689);calls[_0x8494('0x2d')](_0x38c689);}catch(_0x1d3f15){utils[_0x8494('0x1a')](util['format'](_0x8494('0x2e'),_0x38c689[_0x8494('0x20')]),_0x1d3f15);}});ami['on'](_0x8494('0x2f'),function(_0x340878){try{utils[_0x8494('0x16')](util[_0x8494('0x17')](_0x8494('0x30'),_0x340878['uniqueid']),_0x340878);calls['newstate'](_0x340878);recordings[_0x8494('0x2f')](_0x340878);}catch(_0x40a444){utils[_0x8494('0x1a')](util['format'](_0x8494('0x30'),_0x340878['uniqueid']),_0x40a444);}});ami['on'](_0x8494('0x31'),function(_0x8b8c9e){try{utils[_0x8494('0x16')](util[_0x8494('0x17')](_0x8494('0x32'),_0x8b8c9e['uniqueid']),_0x8b8c9e);calls['hangup'](_0x8b8c9e);recordings[_0x8494('0x31')](_0x8b8c9e);dials['hangup'](_0x8b8c9e);agents[_0x8494('0x31')](_0x8b8c9e);queues['hangup'](_0x8b8c9e);}catch(_0x482c55){utils['error'](util[_0x8494('0x17')](_0x8494('0x32'),_0x8b8c9e[_0x8494('0x20')]),_0x482c55);}});ami['on']('cdr',function(_0x365084){try{utils[_0x8494('0x16')](util[_0x8494('0x17')]('[%s][index][cdr]',_0x365084[_0x8494('0x20')]),_0x365084);members[_0x8494('0x33')](_0x365084);}catch(_0x29d7b7){utils[_0x8494('0x1a')](util[_0x8494('0x17')](_0x8494('0x34'),_0x365084[_0x8494('0x20')]),_0x29d7b7);}});ami['on'](_0x8494('0x35'),function(_0x2109ea){try{utils[_0x8494('0x16')](util['format'](_0x8494('0x36'),_0x2109ea[_0x8494('0x20')]),_0x2109ea);queues[_0x8494('0x35')](_0x2109ea);agents[_0x8494('0x35')](_0x2109ea);transfers[_0x8494('0x35')](_0x2109ea);}catch(_0x12ab6d){utils['error'](util['format'](_0x8494('0x36'),_0x2109ea[_0x8494('0x20')]),_0x12ab6d);}});ami['on'](_0x8494('0x37'),function(_0xe91ab7){try{utils[_0x8494('0x16')](util[_0x8494('0x17')](_0x8494('0x38'),_0xe91ab7[_0x8494('0x39')]),_0xe91ab7);queues['attendedtransfer'](_0xe91ab7);transfers['attendedtransfer'](_0xe91ab7);agents[_0x8494('0x37')](_0xe91ab7);calls[_0x8494('0x37')](_0xe91ab7);}catch(_0x267010){utils['error'](util[_0x8494('0x17')](_0x8494('0x38'),_0xe91ab7[_0x8494('0x39')]),_0x267010);}});ami['on'](_0x8494('0x3a'),function(_0x4b4260){try{utils[_0x8494('0x16')](util['format'](_0x8494('0x3b'),_0x4b4260['uniqueid']),_0x4b4260);queues[_0x8494('0x3a')](_0x4b4260);recordings[_0x8494('0x3a')](_0x4b4260);calls[_0x8494('0x3a')](_0x4b4260);dials[_0x8494('0x3a')](_0x4b4260);}catch(_0x50cd9a){utils[_0x8494('0x1a')](util[_0x8494('0x17')](_0x8494('0x3b'),_0x4b4260['uniqueid']),_0x50cd9a);}});ami['on']('newexten',function(_0x2d150b){try{utils['debug'](util[_0x8494('0x17')](_0x8494('0x3c'),_0x2d150b[_0x8494('0x20')]),_0x2d150b);calls[_0x8494('0x3d')](_0x2d150b);recordings['newexten'](_0x2d150b);dials[_0x8494('0x3d')](_0x2d150b);}catch(_0x4df1c7){utils[_0x8494('0x1a')](util[_0x8494('0x17')](_0x8494('0x3c'),_0x2d150b[_0x8494('0x20')]),_0x4df1c7);}});ami['on'](_0x8494('0x3e'),function(_0x474470){try{utils[_0x8494('0x16')](util[_0x8494('0x17')](_0x8494('0x3f'),_0x474470[_0x8494('0x20')]),_0x474470);calls[_0x8494('0x3e')](_0x474470);recordings['newchannel'](_0x474470);}catch(_0xbcabd8){utils[_0x8494('0x1a')](util['format'](_0x8494('0x3f'),_0x474470[_0x8494('0x20')]),_0xbcabd8);}});ami['on'](_0x8494('0x40'),function(_0x36e91b){try{utils[_0x8494('0x16')](util[_0x8494('0x17')](_0x8494('0x41'),_0x36e91b[_0x8494('0x20')]),_0x36e91b);dials[_0x8494('0x40')](_0x36e91b);}catch(_0xad1a86){utils['error'](util['format'](_0x8494('0x42'),_0x36e91b[_0x8494('0x20')]),_0xad1a86);}});ami['on']('dialend',function(_0x9c0cf3){try{utils['debug'](util[_0x8494('0x17')]('[%s][index][dialend]',_0x9c0cf3[_0x8494('0x20')]),_0x9c0cf3);dials[_0x8494('0x43')](_0x9c0cf3);}catch(_0x4ae273){utils[_0x8494('0x1a')](util[_0x8494('0x17')](_0x8494('0x44'),_0x9c0cf3[_0x8494('0x20')]),_0x4ae273);}});} \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index 75b5dee..364559b 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 _0x5044=['now','NOT_INUSE','isNil','exitAt','agentcomplete','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue','cdr','[%s][members][cdr]','assign','data1','source','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','data3','destinationchannel','util','Local/_attended@transfer','Queue:','info','format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','uniqueid','interface','data2','membername','type','getUserByInterface','then','internal','request','CreateMemberReport','getUserByName','split','name','error','[%s][members][writeDB]','devicestatechange','debug','[%s][members][devicestatechange]','device','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','INUSE','voice','TALKING'];(function(_0x256b72,_0x340985){var _0x2183e3=function(_0xf7fd37){while(--_0xf7fd37){_0x256b72['push'](_0x256b72['shift']());}};_0x2183e3(++_0x340985);}(_0x5044,0xc8));var _0x4504=function(_0x418ef7,_0x1d2ab9){_0x418ef7=_0x418ef7-0x0;var _0x34d357=_0x5044[_0x418ef7];return _0x34d357;};'use strict';var _=require('lodash');var util=require(_0x4504('0x0'));var utils=require('./utils');var members={};var exclude=[_0x4504('0x1'),_0x4504('0x2')];function writeDB(_0x2e8da7){utils[_0x4504('0x3')](util[_0x4504('0x4')](_0x4504('0x5'),_0x2e8da7[_0x4504('0x6')],_0x2e8da7[_0x4504('0x7')],_0x2e8da7['channel'],_0x2e8da7[_0x4504('0x8')],_0x2e8da7[_0x4504('0x9')],_0x2e8da7[_0x4504('0xa')]));if(_0x2e8da7[_0x4504('0x7')]){utils[_0x4504('0xb')](_0x2e8da7[_0x4504('0x7')])[_0x4504('0xc')](function(_0x43b304){if(_0x43b304){_0x2e8da7[_0x4504('0x9')]=_0x43b304['name'];_0x2e8da7[_0x4504('0xd')]=_0x43b304['internal'];utils[_0x4504('0xe')](_0x4504('0xf'),_0x2e8da7);}else{utils[_0x4504('0x10')](_0x2e8da7[_0x4504('0x7')][_0x4504('0x11')]('/')[0x1])[_0x4504('0xc')](function(_0x33d6da){if(_0x33d6da){_0x2e8da7[_0x4504('0x9')]=_0x33d6da[_0x4504('0x12')];_0x2e8da7[_0x4504('0xd')]=_0x33d6da[_0x4504('0xd')];utils[_0x4504('0xe')](_0x4504('0xf'),_0x2e8da7);}});}})['catch'](function(_0xa9b827){utils[_0x4504('0x13')](util['format'](_0x4504('0x14'),_0x2e8da7[_0x4504('0x6')]),_0xa9b827);});}delete members[_0x2e8da7[_0x4504('0x7')]];}function startsWith(_0x3e992b,_0x4c773a){return _['some'](_0x3e992b,function(_0x1b2698){return _['startsWith'](_0x4c773a,_0x1b2698);});}exports[_0x4504('0x15')]=function(_0x5ede87){try{utils[_0x4504('0x16')](util[_0x4504('0x4')](_0x4504('0x17'),members[_0x5ede87['device']]?members[_0x5ede87[_0x4504('0x18')]][_0x4504('0x6')]:_0x5ede87[_0x4504('0x18')]),_0x5ede87);utils[_0x4504('0x3')](util[_0x4504('0x4')](_0x4504('0x19'),members[_0x5ede87['device']]?members[_0x5ede87['device']]['uniqueid']:_0x5ede87[_0x4504('0x18')],_0x5ede87[_0x4504('0x1a')],_0x5ede87[_0x4504('0x18')]));switch(_0x5ede87[_0x4504('0x1a')]){case _0x4504('0x1b'):case'BUSY':if(!startsWith(exclude,_0x5ede87[_0x4504('0x18')])){members[_0x5ede87[_0x4504('0x18')]]={'channel':_0x4504('0x1c'),'interface':_0x5ede87[_0x4504('0x18')],'type':_0x4504('0x1d'),'enterAt':utils[_0x4504('0x1e')](),'role':'agent'};}break;case _0x4504('0x1f'):if(!_[_0x4504('0x20')](members[_0x5ede87['device']])){members[_0x5ede87[_0x4504('0x18')]][_0x4504('0x21')]=utils['now']();members[_0x5ede87[_0x4504('0x18')]]['duration']=utils['diffTime'](members[_0x5ede87[_0x4504('0x18')]][_0x4504('0x21')],members[_0x5ede87[_0x4504('0x18')]]['enterAt']);if(members[_0x5ede87[_0x4504('0x18')]][_0x4504('0x6')]){writeDB(members[_0x5ede87[_0x4504('0x18')]]);}}break;default:break;}}catch(_0x2a46de){utils[_0x4504('0x13')](util['format'](_0x4504('0x17'),members[_0x5ede87['device']]?members[_0x5ede87[_0x4504('0x18')]][_0x4504('0x6')]:_0x5ede87[_0x4504('0x18')]),_0x2a46de);}};exports[_0x4504('0x22')]=function(_0x3de7b0){try{if(!_[_0x4504('0x20')](members[_0x3de7b0[_0x4504('0x7')]])){utils['debug'](util[_0x4504('0x4')]('[%s][members][agentcomplete]',_0x3de7b0['uniqueid']),_0x3de7b0);utils[_0x4504('0x3')](util[_0x4504('0x4')](_0x4504('0x23'),_0x3de7b0[_0x4504('0x6')],_0x3de7b0[_0x4504('0x7')],_0x3de7b0['queue']));members[_0x3de7b0['interface']]=_['assign'](members[_0x3de7b0[_0x4504('0x7')]],{'data4':_0x3de7b0[_0x4504('0x24')],'uniqueid':_0x3de7b0[_0x4504('0x6')]});}}catch(_0x5cbee1){utils['error'](util[_0x4504('0x4')]('[%s][members][agentcomplete]',_0x3de7b0[_0x4504('0x6')]),_0x5cbee1);}};exports[_0x4504('0x25')]=function(_0x4fa20b){try{utils[_0x4504('0x16')](util[_0x4504('0x4')](_0x4504('0x26'),_0x4fa20b['uniqueid']),_0x4fa20b);if(_0x4fa20b['channel']){var _0x216e1e=_0x4fa20b['channel']['split']('-')[0x0];if(!_[_0x4504('0x20')](members[_0x216e1e])){members[_0x216e1e]=_[_0x4504('0x27')](members[_0x216e1e],{'data1':members[_0x216e1e][_0x4504('0x28')]||_0x4fa20b['type'],'data2':members[_0x216e1e][_0x4504('0x8')]||_0x4fa20b[_0x4504('0x29')],'data3':members[_0x216e1e]['data3']||_0x4fa20b[_0x4504('0x2a')],'uniqueid':members[_0x216e1e][_0x4504('0x6')]||_0x4fa20b[_0x4504('0x6')]});utils['info'](util[_0x4504('0x4')](_0x4504('0x2b'),_0x4fa20b[_0x4504('0x6')],members[_0x216e1e][_0x4504('0x28')],members[_0x216e1e][_0x4504('0x8')],members[_0x216e1e][_0x4504('0x2c')]));if(members[_0x216e1e]['exitAt']){writeDB(members[_0x216e1e]);}}}if(_0x4fa20b[_0x4504('0x2d')]){var _0xac1d96=_0x4fa20b[_0x4504('0x2d')][_0x4504('0x11')]('-')[0x0];if(!_['isNil'](members[_0xac1d96])){members[_0xac1d96]=_[_0x4504('0x27')](members[_0xac1d96],{'data1':members[_0xac1d96][_0x4504('0x28')]||_0x4fa20b['type'],'data2':members[_0xac1d96][_0x4504('0x8')]||_0x4fa20b[_0x4504('0x29')],'data3':members[_0xac1d96][_0x4504('0x2c')]||_0x4fa20b[_0x4504('0x2a')],'uniqueid':members[_0xac1d96]['uniqueid']||_0x4fa20b[_0x4504('0x6')]});utils['info'](util[_0x4504('0x4')]('[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s',_0x4fa20b[_0x4504('0x6')],members[_0xac1d96][_0x4504('0x28')],members[_0xac1d96][_0x4504('0x8')],members[_0xac1d96][_0x4504('0x2c')]));if(members[_0xac1d96]['exitAt']){writeDB(members[_0xac1d96]);}}}}catch(_0x48cfb3){utils[_0x4504('0x13')](util[_0x4504('0x4')](_0x4504('0x26'),_0x4fa20b['uniqueid']),_0x48cfb3);}}; \ No newline at end of file +var _0xfb92=['error','agentcomplete','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','assign','queue','cdr','debug','[%s][members][cdr]','split','data1','source','data3','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','destinationchannel','lodash','./utils','Local/_attended@transfer','Queue:','info','format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','uniqueid','interface','channel','data2','getUserByInterface','then','name','internal','request','getUserByName','membername','CreateMemberReport','catch','[%s][members][writeDB]','startsWith','[%s][members][devicestatechange]','device','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','INUSE','BUSY','voice','TALKING','now','agent','NOT_INUSE','isNil','exitAt','duration','diffTime'];(function(_0x599d65,_0x569eef){var _0x3af2de=function(_0x57e935){while(--_0x57e935){_0x599d65['push'](_0x599d65['shift']());}};_0x3af2de(++_0x569eef);}(_0xfb92,0x1e3));var _0x2fb9=function(_0x2d35aa,_0x4b47e6){_0x2d35aa=_0x2d35aa-0x0;var _0x5047e6=_0xfb92[_0x2d35aa];return _0x5047e6;};'use strict';var _=require(_0x2fb9('0x0'));var util=require('util');var utils=require(_0x2fb9('0x1'));var members={};var exclude=[_0x2fb9('0x2'),_0x2fb9('0x3')];function writeDB(_0x33f0c7){utils[_0x2fb9('0x4')](util[_0x2fb9('0x5')](_0x2fb9('0x6'),_0x33f0c7[_0x2fb9('0x7')],_0x33f0c7[_0x2fb9('0x8')],_0x33f0c7[_0x2fb9('0x9')],_0x33f0c7[_0x2fb9('0xa')],_0x33f0c7['membername'],_0x33f0c7['type']));if(_0x33f0c7['interface']){utils[_0x2fb9('0xb')](_0x33f0c7[_0x2fb9('0x8')])[_0x2fb9('0xc')](function(_0x4b0315){if(_0x4b0315){_0x33f0c7['membername']=_0x4b0315[_0x2fb9('0xd')];_0x33f0c7[_0x2fb9('0xe')]=_0x4b0315[_0x2fb9('0xe')];utils[_0x2fb9('0xf')]('CreateMemberReport',_0x33f0c7);}else{utils[_0x2fb9('0x10')](_0x33f0c7['interface']['split']('/')[0x1])['then'](function(_0x31d830){if(_0x31d830){_0x33f0c7[_0x2fb9('0x11')]=_0x31d830[_0x2fb9('0xd')];_0x33f0c7[_0x2fb9('0xe')]=_0x31d830[_0x2fb9('0xe')];utils[_0x2fb9('0xf')](_0x2fb9('0x12'),_0x33f0c7);}});}})[_0x2fb9('0x13')](function(_0x2d71b1){utils['error'](util[_0x2fb9('0x5')](_0x2fb9('0x14'),_0x33f0c7[_0x2fb9('0x7')]),_0x2d71b1);});}delete members[_0x33f0c7['interface']];}function startsWith(_0x1f6384,_0x4c5ded){return _['some'](_0x1f6384,function(_0x4f0aa3){return _[_0x2fb9('0x15')](_0x4c5ded,_0x4f0aa3);});}exports['devicestatechange']=function(_0x511cb9){try{utils['debug'](util[_0x2fb9('0x5')](_0x2fb9('0x16'),members[_0x511cb9[_0x2fb9('0x17')]]?members[_0x511cb9[_0x2fb9('0x17')]][_0x2fb9('0x7')]:_0x511cb9[_0x2fb9('0x17')]),_0x511cb9);utils[_0x2fb9('0x4')](util[_0x2fb9('0x5')](_0x2fb9('0x18'),members[_0x511cb9['device']]?members[_0x511cb9[_0x2fb9('0x17')]][_0x2fb9('0x7')]:_0x511cb9[_0x2fb9('0x17')],_0x511cb9[_0x2fb9('0x19')],_0x511cb9[_0x2fb9('0x17')]));switch(_0x511cb9[_0x2fb9('0x19')]){case _0x2fb9('0x1a'):case _0x2fb9('0x1b'):if(!startsWith(exclude,_0x511cb9[_0x2fb9('0x17')])){members[_0x511cb9[_0x2fb9('0x17')]]={'channel':_0x2fb9('0x1c'),'interface':_0x511cb9['device'],'type':_0x2fb9('0x1d'),'enterAt':utils[_0x2fb9('0x1e')](),'role':_0x2fb9('0x1f')};}break;case _0x2fb9('0x20'):if(!_[_0x2fb9('0x21')](members[_0x511cb9[_0x2fb9('0x17')]])){members[_0x511cb9[_0x2fb9('0x17')]][_0x2fb9('0x22')]=utils[_0x2fb9('0x1e')]();members[_0x511cb9['device']][_0x2fb9('0x23')]=utils[_0x2fb9('0x24')](members[_0x511cb9['device']][_0x2fb9('0x22')],members[_0x511cb9[_0x2fb9('0x17')]]['enterAt']);if(members[_0x511cb9[_0x2fb9('0x17')]][_0x2fb9('0x7')]){writeDB(members[_0x511cb9[_0x2fb9('0x17')]]);}}break;default:break;}}catch(_0x3909a){utils[_0x2fb9('0x25')](util['format']('[%s][members][devicestatechange]',members[_0x511cb9['device']]?members[_0x511cb9[_0x2fb9('0x17')]][_0x2fb9('0x7')]:_0x511cb9['device']),_0x3909a);}};exports[_0x2fb9('0x26')]=function(_0x3d34d8){try{if(!_[_0x2fb9('0x21')](members[_0x3d34d8[_0x2fb9('0x8')]])){utils['debug'](util['format']('[%s][members][agentcomplete]',_0x3d34d8['uniqueid']),_0x3d34d8);utils['info'](util['format'](_0x2fb9('0x27'),_0x3d34d8[_0x2fb9('0x7')],_0x3d34d8[_0x2fb9('0x8')],_0x3d34d8['queue']));members[_0x3d34d8['interface']]=_[_0x2fb9('0x28')](members[_0x3d34d8[_0x2fb9('0x8')]],{'data4':_0x3d34d8[_0x2fb9('0x29')],'uniqueid':_0x3d34d8[_0x2fb9('0x7')]});}}catch(_0x557aac){utils['error'](util[_0x2fb9('0x5')]('[%s][members][agentcomplete]',_0x3d34d8['uniqueid']),_0x557aac);}};exports[_0x2fb9('0x2a')]=function(_0x5df964){try{utils[_0x2fb9('0x2b')](util[_0x2fb9('0x5')](_0x2fb9('0x2c'),_0x5df964[_0x2fb9('0x7')]),_0x5df964);if(_0x5df964[_0x2fb9('0x9')]){var _0x1cf06d=_0x5df964['channel'][_0x2fb9('0x2d')]('-')[0x0];if(!_[_0x2fb9('0x21')](members[_0x1cf06d])){members[_0x1cf06d]=_[_0x2fb9('0x28')](members[_0x1cf06d],{'data1':members[_0x1cf06d][_0x2fb9('0x2e')]||_0x5df964['type'],'data2':members[_0x1cf06d]['data2']||_0x5df964[_0x2fb9('0x2f')],'data3':members[_0x1cf06d][_0x2fb9('0x30')]||_0x5df964[_0x2fb9('0x31')],'uniqueid':members[_0x1cf06d][_0x2fb9('0x7')]||_0x5df964[_0x2fb9('0x7')]});utils[_0x2fb9('0x4')](util[_0x2fb9('0x5')](_0x2fb9('0x32'),_0x5df964[_0x2fb9('0x7')],members[_0x1cf06d]['data1'],members[_0x1cf06d][_0x2fb9('0xa')],members[_0x1cf06d][_0x2fb9('0x30')]));if(members[_0x1cf06d][_0x2fb9('0x22')]){writeDB(members[_0x1cf06d]);}}}if(_0x5df964[_0x2fb9('0x33')]){var _0x28b500=_0x5df964['destinationchannel'][_0x2fb9('0x2d')]('-')[0x0];if(!_[_0x2fb9('0x21')](members[_0x28b500])){members[_0x28b500]=_[_0x2fb9('0x28')](members[_0x28b500],{'data1':members[_0x28b500]['data1']||_0x5df964['type'],'data2':members[_0x28b500]['data2']||_0x5df964[_0x2fb9('0x2f')],'data3':members[_0x28b500][_0x2fb9('0x30')]||_0x5df964[_0x2fb9('0x31')],'uniqueid':members[_0x28b500][_0x2fb9('0x7')]||_0x5df964[_0x2fb9('0x7')]});utils['info'](util[_0x2fb9('0x5')](_0x2fb9('0x32'),_0x5df964['uniqueid'],members[_0x28b500][_0x2fb9('0x2e')],members[_0x28b500][_0x2fb9('0xa')],members[_0x28b500][_0x2fb9('0x30')]));if(members[_0x28b500]['exitAt']){writeDB(members[_0x28b500]);}}}}catch(_0x402f03){utils['error'](util[_0x2fb9('0x5')](_0x2fb9('0x2c'),_0x5df964[_0x2fb9('0x7')]),_0x402f03);}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index 3aec506..e7289de 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 _0x8501=['[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','musiconholdstop','[%s][queues][musiconholdstop]','./utils','info','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','uniqueid','lastAssignedTo','calleridnum','accountcode','queuecallerexitreason','getVoiceQueueByName','queue','then','type','CreateVoiceQueueReport','transfereduniqueid','queuecallerjoin','debug','format','[%s][queues][queuecallerjoin]','position','assign','now','error','hangup','isNil','[%s][queues][hangup]','queuecallerexit','queuecallercomplete','COMPLETEDBYAGENT','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','name','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','queuecallerenterreason','varset','[%s][queues][varset]','variable','queuestatus','value','CONTINUE','queuecallerabandon','queuecallerabandonAt','queuecallerexitAt','toUpperCase','queueposition','EXITWITHKEY','[%s][queues][queuecallerabandon]','ABANDONED','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerleave]','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','queuecallerleave','holdtime','diffTime','queuecallerleaveAt','queuecallerjoinAt','count','connectedlinenum','agentconnect','[%s][queues][agentconnect]','membername','destaccountcode','assigned','agentcomplete','queuecallercompleteAt','reason','transfer','COMPLETEDBY','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','blindtransfer','transfereeuniqueid','[%s][queues][blindtransfer]','BLIND','transferexten','extension','transferuniqueid','[%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','origtransfererexten','transfertype','ATTENDED','ATTENDEDTRANSFER','transfereelinkedid','clone','mohtime','calleridname','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','secondtransfererexten','secondtransfereruniqueid','transfertargetlinkedid','transfertargetuniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][musiconholdstart]','musiconholdstartAt'];(function(_0x394579,_0x144e6d){var _0x111e75=function(_0x29a77b){while(--_0x29a77b){_0x394579['push'](_0x394579['shift']());}};_0x111e75(++_0x144e6d);}(_0x8501,0x67));var _0x1850=function(_0x4bf5f2,_0x48040d){_0x4bf5f2=_0x4bf5f2-0x0;var _0x9d49ee=_0x8501[_0x4bf5f2];return _0x9d49ee;};'use strict';var _=require('lodash');var util=require('util');var utils=require(_0x1850('0x0'));var queues={};function writeDB(_0x577171){utils[_0x1850('0x1')](util['format'](_0x1850('0x2'),_0x577171[_0x1850('0x3')],_0x577171['channel'],_0x577171['queue'],_0x577171[_0x1850('0x4')],_0x577171[_0x1850('0x5')],_0x577171[_0x1850('0x6')],_0x577171[_0x1850('0x7')]));if(_0x577171['queue']){utils[_0x1850('0x8')](_0x577171[_0x1850('0x9')])[_0x1850('0xa')](function(_0x2bfea2){if(_0x2bfea2){_0x577171[_0x1850('0xb')]=_0x2bfea2[_0x1850('0xb')];}utils['request'](_0x1850('0xc'),_0x577171);});}else{utils['request'](_0x1850('0xc'),_0x577171);}if(_0x577171[_0x1850('0xd')]){delete queues[_0x577171['transfereduniqueid']];}else{delete queues[_0x577171[_0x1850('0x3')]];}}exports[_0x1850('0xe')]=function(_0x8598f0){try{utils[_0x1850('0xf')](util[_0x1850('0x10')](_0x1850('0x11'),_0x8598f0[_0x1850('0x3')]),_0x8598f0);utils[_0x1850('0x1')](util['format']('[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s',_0x8598f0[_0x1850('0x3')],_0x8598f0['queue'],_0x8598f0[_0x1850('0x12')]));queues[_0x8598f0['uniqueid']]=_[_0x1850('0x13')](_0x8598f0,{'originalposition':_0x8598f0['position'],'queuecallerjoinAt':utils[_0x1850('0x14')](),'mohtime':0x0});}catch(_0x26f149){utils[_0x1850('0x15')](util[_0x1850('0x10')](_0x1850('0x11'),_0x8598f0[_0x1850('0x3')]),_0x26f149);}};exports[_0x1850('0x16')]=function(_0x3501d5){try{if(!_[_0x1850('0x17')](queues[_0x3501d5[_0x1850('0x3')]])){utils[_0x1850('0xf')](util[_0x1850('0x10')](_0x1850('0x18'),_0x3501d5['uniqueid']),_0x3501d5);if(queues[_0x3501d5['uniqueid']]['queuecallerleaveAt']){if(!queues[_0x3501d5['uniqueid']]['queuecallerabandon']&&!queues[_0x3501d5[_0x1850('0x3')]][_0x1850('0x19')]){queues[_0x3501d5['uniqueid']][_0x1850('0x1a')]=!![];queues[_0x3501d5['uniqueid']]['queuecallercompleteAt']=utils[_0x1850('0x14')]();queues[_0x3501d5[_0x1850('0x3')]]['queuecallerexitreason']=_0x1850('0x1b');}utils[_0x1850('0x1')](util[_0x1850('0x10')](_0x1850('0x1c'),_0x3501d5[_0x1850('0x3')],queues[_0x3501d5[_0x1850('0x3')]][_0x1850('0x1d')],queues[_0x3501d5[_0x1850('0x3')]][_0x1850('0x7')]));writeDB(queues[_0x3501d5[_0x1850('0x3')]]);}else if(queues[_0x3501d5[_0x1850('0x3')]][_0x1850('0xd')]){utils[_0x1850('0x1')](util[_0x1850('0x10')](_0x1850('0x1e'),_0x3501d5[_0x1850('0x3')],queues[_0x3501d5[_0x1850('0x3')]][_0x1850('0x1d')],queues[_0x3501d5[_0x1850('0x3')]][_0x1850('0xd')]));queues[queues[_0x3501d5[_0x1850('0x3')]][_0x1850('0xd')]]=queues[_0x3501d5['uniqueid']];queues[queues[_0x3501d5[_0x1850('0x3')]][_0x1850('0xd')]][_0x1850('0x1f')]=0x2;delete queues[_0x3501d5[_0x1850('0x3')]];}}}catch(_0x4c2d02){utils[_0x1850('0x15')](util[_0x1850('0x10')](_0x1850('0x18'),_0x3501d5[_0x1850('0x3')]),_0x4c2d02);}};exports[_0x1850('0x20')]=function(_0x3137f9){try{utils[_0x1850('0xf')](util[_0x1850('0x10')](_0x1850('0x21'),_0x3137f9[_0x1850('0x3')]),_0x3137f9);if(!_[_0x1850('0x17')](_0x3137f9[_0x1850('0x22')][_0x1850('0x23')])&&_0x3137f9[_0x1850('0x24')]['toUpperCase']()!==_0x1850('0x25')){if(!_['isNil'](queues[_0x3137f9[_0x1850('0x3')]])){queues[_0x3137f9['uniqueid']][_0x1850('0x26')]=![];queues[_0x3137f9[_0x1850('0x3')]][_0x1850('0x27')]=null;queues[_0x3137f9[_0x1850('0x3')]]['queuecallerexit']=!![];queues[_0x3137f9[_0x1850('0x3')]][_0x1850('0x28')]=utils[_0x1850('0x14')]();queues[_0x3137f9[_0x1850('0x3')]][_0x1850('0x7')]=_0x3137f9[_0x1850('0x24')][_0x1850('0x29')]();utils['info'](util['format']('[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s',_0x3137f9[_0x1850('0x3')],queues[_0x3137f9[_0x1850('0x3')]]['name'],_0x3137f9['value'],queues[_0x3137f9[_0x1850('0x3')]][_0x1850('0x7')]));writeDB(queues[_0x3137f9[_0x1850('0x3')]]);}}else if(!_[_0x1850('0x17')](_0x3137f9['variable'][_0x1850('0x2a')])){if(!_[_0x1850('0x17')](queues[_0x3137f9[_0x1850('0x3')]])&&!queues[_0x3137f9[_0x1850('0x3')]][_0x1850('0x26')]){queues[_0x3137f9[_0x1850('0x3')]][_0x1850('0x26')]=![];queues[_0x3137f9[_0x1850('0x3')]][_0x1850('0x27')]=null;queues[_0x3137f9[_0x1850('0x3')]][_0x1850('0x19')]=!![];queues[_0x3137f9[_0x1850('0x3')]][_0x1850('0x28')]=utils['now']();queues[_0x3137f9[_0x1850('0x3')]]['queuecallerexitreason']=_0x1850('0x2b');utils['info'](util[_0x1850('0x10')]('[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s',_0x3137f9[_0x1850('0x3')],queues[_0x3137f9['uniqueid']][_0x1850('0x1d')],_0x3137f9[_0x1850('0x24')],queues[_0x3137f9[_0x1850('0x3')]][_0x1850('0x7')]));}}}catch(_0x263185){utils['error'](util[_0x1850('0x10')](_0x1850('0x21'),_0x3137f9[_0x1850('0x3')]),_0x263185);}};exports[_0x1850('0x26')]=function(_0x22c1ee){try{if(!_['isNil'](queues[_0x22c1ee[_0x1850('0x3')]])){utils[_0x1850('0xf')](util[_0x1850('0x10')](_0x1850('0x2c'),_0x22c1ee[_0x1850('0x3')]),_0x22c1ee);queues[_0x22c1ee[_0x1850('0x3')]]['queuecallerexit']=![];queues[_0x22c1ee[_0x1850('0x3')]][_0x1850('0x28')]=null;queues[_0x22c1ee[_0x1850('0x3')]][_0x1850('0x26')]=!![];queues[_0x22c1ee[_0x1850('0x3')]][_0x1850('0x27')]=utils['now']();queues[_0x22c1ee[_0x1850('0x3')]][_0x1850('0x7')]=_0x1850('0x2d');utils[_0x1850('0x1')](util['format'](_0x1850('0x2e'),_0x22c1ee[_0x1850('0x3')],queues[_0x22c1ee[_0x1850('0x3')]][_0x1850('0x1d')],queues[_0x22c1ee[_0x1850('0x3')]][_0x1850('0x7')]));}}catch(_0xf3af3e){utils[_0x1850('0x15')](util[_0x1850('0x10')](_0x1850('0x2c'),_0x22c1ee[_0x1850('0x3')]),_0xf3af3e);}};exports['queuecallerleave']=function(_0x175a9b){try{if(!_[_0x1850('0x17')](queues[_0x175a9b[_0x1850('0x3')]])){utils[_0x1850('0xf')](util[_0x1850('0x10')](_0x1850('0x2f'),_0x175a9b[_0x1850('0x3')]),_0x175a9b);utils[_0x1850('0x1')](util[_0x1850('0x10')](_0x1850('0x30'),_0x175a9b['uniqueid'],queues[_0x175a9b['uniqueid']]['name'],_0x175a9b['connectedlinenum'],_0x175a9b['connectedlinename']));queues[_0x175a9b[_0x1850('0x3')]][_0x1850('0x31')]=!![];queues[_0x175a9b['uniqueid']]['queuecallerleaveAt']=utils[_0x1850('0x14')]();queues[_0x175a9b[_0x1850('0x3')]][_0x1850('0x32')]=utils[_0x1850('0x33')](queues[_0x175a9b['uniqueid']][_0x1850('0x34')],queues[_0x175a9b['uniqueid']][_0x1850('0x35')]);queues[_0x175a9b[_0x1850('0x3')]]['position']=_0x175a9b[_0x1850('0x12')];queues[_0x175a9b[_0x1850('0x3')]][_0x1850('0x36')]=_0x175a9b['count'];queues[_0x175a9b[_0x1850('0x3')]][_0x1850('0x37')]=_0x175a9b[_0x1850('0x37')];queues[_0x175a9b[_0x1850('0x3')]]['connectedlinename']=_0x175a9b['connectedlinename'];}}catch(_0x4efc26){utils['error'](util[_0x1850('0x10')](_0x1850('0x2f'),_0x175a9b[_0x1850('0x3')]),_0x4efc26);}};exports[_0x1850('0x38')]=function(_0x5e7068){try{if(!_['isNil'](queues[_0x5e7068[_0x1850('0x3')]])){utils[_0x1850('0xf')](util[_0x1850('0x10')](_0x1850('0x39'),_0x5e7068[_0x1850('0x3')]),_0x5e7068);utils['info'](util[_0x1850('0x10')]('[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s',_0x5e7068[_0x1850('0x3')],queues[_0x5e7068[_0x1850('0x3')]][_0x1850('0x1d')],_0x5e7068[_0x1850('0x3a')],_0x5e7068[_0x1850('0x3b')]));queues[_0x5e7068[_0x1850('0x3')]][_0x1850('0x26')]=![];queues[_0x5e7068[_0x1850('0x3')]][_0x1850('0x26')]=![];queues[_0x5e7068[_0x1850('0x3')]][_0x1850('0x27')]=null;queues[_0x5e7068[_0x1850('0x3')]][_0x1850('0x19')]=![];queues[_0x5e7068[_0x1850('0x3')]]['queuecallerexitreason']=null;queues[_0x5e7068['uniqueid']]['queuecallerexitAt']=null;queues[_0x5e7068[_0x1850('0x3')]][_0x1850('0x3c')]=!![];queues[_0x5e7068[_0x1850('0x3')]][_0x1850('0x6')]=_0x5e7068[_0x1850('0x3b')];queues[_0x5e7068[_0x1850('0x3')]][_0x1850('0x4')]=_0x5e7068[_0x1850('0x3a')];}}catch(_0xed16e8){utils[_0x1850('0x15')](util[_0x1850('0x10')]('[%s][queues][agentconnect]',_0x5e7068[_0x1850('0x3')]),_0xed16e8);}};exports[_0x1850('0x3d')]=function(_0x7194fe){try{if(!_['isNil'](queues[_0x7194fe[_0x1850('0x3')]])){if(queues[_0x7194fe['uniqueid']][_0x1850('0x34')]){utils['debug'](util[_0x1850('0x10')]('[%s][queues][agentcomplete]',_0x7194fe[_0x1850('0x3')]),_0x7194fe);queues[_0x7194fe[_0x1850('0x3')]][_0x1850('0x26')]=![];queues[_0x7194fe[_0x1850('0x3')]]['queuecallerabandon']=![];queues[_0x7194fe[_0x1850('0x3')]][_0x1850('0x27')]=null;queues[_0x7194fe[_0x1850('0x3')]][_0x1850('0x19')]=![];queues[_0x7194fe[_0x1850('0x3')]][_0x1850('0x28')]=null;queues[_0x7194fe[_0x1850('0x3')]][_0x1850('0x3c')]=!![];queues[_0x7194fe['uniqueid']][_0x1850('0x4')]=_0x7194fe[_0x1850('0x3a')];queues[_0x7194fe[_0x1850('0x3')]][_0x1850('0x1a')]=!![];queues[_0x7194fe['uniqueid']][_0x1850('0x3e')]=utils[_0x1850('0x14')]();if(_0x7194fe[_0x1850('0x3f')]==_0x1850('0x40')){if(!queues[_0x7194fe[_0x1850('0x3')]][_0x1850('0x40')]){queues[_0x7194fe[_0x1850('0x3')]][_0x1850('0x7')]='TRANSFER';}}else{queues[_0x7194fe['uniqueid']]['queuecallerexitreason']=_0x1850('0x41')+_0x7194fe['reason'][_0x1850('0x29')]();}utils[_0x1850('0x1')](util[_0x1850('0x10')](_0x1850('0x42'),_0x7194fe[_0x1850('0x3')],queues[_0x7194fe[_0x1850('0x3')]]['name'],_0x7194fe[_0x1850('0x3a')],queues[_0x7194fe[_0x1850('0x3')]][_0x1850('0x7')]));writeDB(queues[_0x7194fe[_0x1850('0x3')]]);}}}catch(_0x20546d){utils[_0x1850('0x15')](util[_0x1850('0x10')]('[%s][queues][agentcomplete]',_0x7194fe[_0x1850('0x3')]),_0x20546d);}};exports[_0x1850('0x43')]=function(_0x314f99){try{if(!_['isNil'](queues[_0x314f99[_0x1850('0x44')]])){utils[_0x1850('0xf')](util[_0x1850('0x10')](_0x1850('0x45'),_0x314f99['uniqueid']),_0x314f99);queues[_0x314f99[_0x1850('0x44')]]['transfer']=!![];queues[_0x314f99[_0x1850('0x44')]]['transfertype']=_0x1850('0x46');queues[_0x314f99[_0x1850('0x44')]][_0x1850('0x47')]=_0x314f99[_0x1850('0x48')];queues[_0x314f99[_0x1850('0x44')]][_0x1850('0x49')]=_0x314f99[_0x1850('0x44')];queues[_0x314f99[_0x1850('0x44')]][_0x1850('0x7')]='BLINDTRANSFER';utils[_0x1850('0x1')](util[_0x1850('0x10')](_0x1850('0x4a'),_0x314f99[_0x1850('0x3')],queues[_0x314f99[_0x1850('0x44')]][_0x1850('0x1d')],_0x314f99[_0x1850('0x44')],_0x314f99['extension']));}}catch(_0x3a038b){utils['error'](util[_0x1850('0x10')](_0x1850('0x45'),_0x314f99[_0x1850('0x3')]),_0x3a038b);}};exports[_0x1850('0x4b')]=function(_0x4a1b12){try{utils[_0x1850('0xf')](util[_0x1850('0x10')](_0x1850('0x4c'),_0x4a1b12[_0x1850('0x4d')]),_0x4a1b12);if(_0x4a1b12[_0x1850('0x4d')]==_0x4a1b12[_0x1850('0x4e')]){if(!_[_0x1850('0x17')](queues[_0x4a1b12[_0x1850('0x4f')]])){utils[_0x1850('0x1')](util[_0x1850('0x10')](_0x1850('0x50'),_0x4a1b12[_0x1850('0x4d')],queues[_0x4a1b12[_0x1850('0x4f')]][_0x1850('0x1d')],_0x4a1b12[_0x1850('0x51')]));queues[_0x4a1b12[_0x1850('0x4f')]][_0x1850('0x40')]=!![];queues[_0x4a1b12[_0x1850('0x4f')]][_0x1850('0x52')]=_0x1850('0x53');queues[_0x4a1b12[_0x1850('0x4f')]]['transferexten']=_0x4a1b12[_0x1850('0x51')];queues[_0x4a1b12['secondtransfererlinkedid']]['transferuniqueid']=_0x4a1b12[_0x1850('0x4d')];queues[_0x4a1b12[_0x1850('0x4f')]]['queuecallerexitreason']=_0x1850('0x54');}if(!_['isNil'](queues[_0x4a1b12[_0x1850('0x4e')]])){if(_0x4a1b12[_0x1850('0x55')]&&queues[_0x4a1b12[_0x1850('0x55')]]){queues[_0x4a1b12[_0x1850('0x55')]][_0x1850('0x1f')]=0x1;queues[_0x4a1b12[_0x1850('0x44')]]=_[_0x1850('0x56')](queues[_0x4a1b12[_0x1850('0x55')]]);queues[_0x4a1b12[_0x1850('0x44')]][_0x1850('0xd')]=_0x4a1b12['transfertargetuniqueid'];queues[_0x4a1b12[_0x1850('0x44')]][_0x1850('0x1f')]=0x2;queues[_0x4a1b12[_0x1850('0x44')]][_0x1850('0x5')]=queues[_0x4a1b12[_0x1850('0x4f')]]['calleridnum'];queues[_0x4a1b12[_0x1850('0x44')]]['calleridname']=queues[_0x4a1b12[_0x1850('0x4f')]]['calleridname'];queues[_0x4a1b12[_0x1850('0x44')]][_0x1850('0x35')]=utils[_0x1850('0x14')]();queues[_0x4a1b12[_0x1850('0x44')]][_0x1850('0x34')]=utils[_0x1850('0x14')]();queues[_0x4a1b12['transfereeuniqueid']][_0x1850('0x32')]=0x0;queues[_0x4a1b12[_0x1850('0x44')]][_0x1850('0x57')]=0x0;utils['info'](util[_0x1850('0x10')]('[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s',_0x4a1b12[_0x1850('0x4d')],queues[_0x4a1b12['transfereeuniqueid']][_0x1850('0x1d')],queues[_0x4a1b12[_0x1850('0x44')]][_0x1850('0x5')],queues[_0x4a1b12[_0x1850('0x44')]][_0x1850('0x58')]));}else{utils['info'](util[_0x1850('0x10')](_0x1850('0x59'),_0x4a1b12[_0x1850('0x4d')],queues[_0x4a1b12['origtransfererlinkedid']][_0x1850('0x1d')],_0x4a1b12[_0x1850('0x4f')]));queues[_0x4a1b12['origtransfererlinkedid']]['transfereduniqueid']=_0x4a1b12['secondtransfererlinkedid'];}}}else if(_0x4a1b12['secondtransfereruniqueid']==_0x4a1b12[_0x1850('0x4f')]){if(!_['isNil'](queues[_0x4a1b12[_0x1850('0x4e')]])){utils[_0x1850('0x1')](util[_0x1850('0x10')]('[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER',_0x4a1b12[_0x1850('0x4d')],queues[_0x4a1b12[_0x1850('0x4e')]]['name'],_0x4a1b12['secondtransfereruniqueid'],_0x4a1b12[_0x1850('0x5a')]));queues[_0x4a1b12[_0x1850('0x4e')]][_0x1850('0x40')]=!![];queues[_0x4a1b12[_0x1850('0x4e')]][_0x1850('0x52')]='ATTENDED';queues[_0x4a1b12[_0x1850('0x4e')]][_0x1850('0x47')]=_0x4a1b12[_0x1850('0x5a')];queues[_0x4a1b12[_0x1850('0x4e')]][_0x1850('0x49')]=_0x4a1b12[_0x1850('0x5b')];queues[_0x4a1b12['origtransfererlinkedid']]['queuecallerexitreason']=_0x1850('0x54');}if(!_[_0x1850('0x17')](queues[_0x4a1b12[_0x1850('0x4f')]])){if(_0x4a1b12[_0x1850('0x5c')]&&queues[_0x4a1b12[_0x1850('0x5c')]]){queues[_0x4a1b12[_0x1850('0x5c')]]['queuecallerenterreason']=0x1;queues[_0x4a1b12[_0x1850('0x5d')]]=_[_0x1850('0x56')](queues[_0x4a1b12[_0x1850('0x5c')]]);queues[_0x4a1b12[_0x1850('0x5d')]][_0x1850('0xd')]=_0x4a1b12['transfertargetuniqueid'];queues[_0x4a1b12[_0x1850('0x5d')]]['queuecallerenterreason']=0x2;queues[_0x4a1b12['transfertargetuniqueid']]['calleridnum']=queues[_0x4a1b12[_0x1850('0x4e')]][_0x1850('0x5')];queues[_0x4a1b12[_0x1850('0x5d')]][_0x1850('0x58')]=queues[_0x4a1b12[_0x1850('0x4e')]]['calleridname'];queues[_0x4a1b12[_0x1850('0x5d')]][_0x1850('0x35')]=utils[_0x1850('0x14')]();queues[_0x4a1b12[_0x1850('0x5d')]][_0x1850('0x34')]=utils[_0x1850('0x14')]();queues[_0x4a1b12[_0x1850('0x5d')]][_0x1850('0x32')]=0x0;queues[_0x4a1b12['transfertargetuniqueid']][_0x1850('0x57')]=0x0;utils[_0x1850('0x1')](util['format'](_0x1850('0x5e'),_0x4a1b12[_0x1850('0x4d')],queues[_0x4a1b12[_0x1850('0x5d')]]['name'],queues[_0x4a1b12[_0x1850('0x5d')]][_0x1850('0xd')],queues[_0x4a1b12[_0x1850('0x5d')]]['calleridnum'],queues[_0x4a1b12['transfertargetuniqueid']][_0x1850('0x58')]));}else{utils['info'](util[_0x1850('0x10')](_0x1850('0x59'),_0x4a1b12[_0x1850('0x4d')],queues[_0x4a1b12[_0x1850('0x4f')]][_0x1850('0x1d')],_0x4a1b12[_0x1850('0x4e')]));queues[_0x4a1b12[_0x1850('0x4f')]][_0x1850('0xd')]=_0x4a1b12[_0x1850('0x4e')];}}}}catch(_0x4cc67e){utils[_0x1850('0x15')](util['format'](_0x1850('0x4c'),_0x4a1b12[_0x1850('0x4d')]),_0x4cc67e);}};exports['musiconholdstart']=function(_0x5baf01){try{if(!_[_0x1850('0x17')](queues[_0x5baf01[_0x1850('0x3')]])){utils['debug'](util['format'](_0x1850('0x5f'),_0x5baf01[_0x1850('0x3')]),_0x5baf01);queues[_0x5baf01['uniqueid']][_0x1850('0x60')]=utils['now']();utils[_0x1850('0x1')](util[_0x1850('0x10')](_0x1850('0x61'),_0x5baf01[_0x1850('0x3')],queues[_0x5baf01[_0x1850('0x3')]][_0x1850('0x1d')],queues[_0x5baf01[_0x1850('0x3')]][_0x1850('0x60')]));}}catch(_0xd185d1){utils['error'](util[_0x1850('0x10')]('[%s][queues][musiconholdstart]',_0x5baf01[_0x1850('0x3')]),_0xd185d1);}};exports[_0x1850('0x62')]=function(_0x54cae3){try{if(!_[_0x1850('0x17')](queues[_0x54cae3['uniqueid']])){if(!_[_0x1850('0x17')](queues[_0x54cae3[_0x1850('0x3')]]['musiconholdstartAt'])){utils[_0x1850('0xf')](util['format'](_0x1850('0x63'),_0x54cae3[_0x1850('0x3')]),_0x54cae3);queues[_0x54cae3[_0x1850('0x3')]][_0x1850('0x57')]+=utils[_0x1850('0x33')](utils[_0x1850('0x14')](),queues[_0x54cae3[_0x1850('0x3')]][_0x1850('0x60')]);utils[_0x1850('0x1')](util[_0x1850('0x10')]('[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s',_0x54cae3[_0x1850('0x3')],queues[_0x54cae3[_0x1850('0x3')]][_0x1850('0x1d')],queues[_0x54cae3[_0x1850('0x3')]][_0x1850('0x57')]));delete queues[_0x54cae3[_0x1850('0x3')]][_0x1850('0x60')];}}}catch(_0x2077f3){utils[_0x1850('0x15')](util[_0x1850('0x10')](_0x1850('0x63'),_0x54cae3[_0x1850('0x3')]),_0x2077f3);}}; \ No newline at end of file +var _0x3c03=['channel','calleridnum','accountcode','queuecallerexitreason','getVoiceQueueByName','queue','then','type','request','CreateVoiceQueueReport','transfereduniqueid','debug','[%s][queues][queuecallerjoin]','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','position','assign','now','hangup','[%s][queues][hangup]','queuecallerexit','queuecallercomplete','COMPLETEDBYAGENT','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','name','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','varset','[%s][queues][varset]','variable','value','toUpperCase','CONTINUE','queuecallerabandon','queuecallerabandonAt','queuecallerexitAt','isNil','queueposition','EXITWITHKEY','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerabandon]','ABANDONED','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','error','queuecallerleave','[%s][queues][queuecallerleave]','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinenum','queuecallerleaveAt','diffTime','queuecallerjoinAt','count','connectedlinename','[%s][queues][agentconnect]','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','membername','destaccountcode','lastAssignedTo','[%s][queues][agentcomplete]','assigned','queuecallercompleteAt','reason','transfer','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','blindtransfer','[%s][queues][blindtransfer]','transfereeuniqueid','transfertype','BLIND','extension','transferuniqueid','BLINDTRANSFER','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','attendedtransfer','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','origtransfererexten','transferexten','ATTENDEDTRANSFER','transfereelinkedid','queuecallerenterreason','clone','transfertargetuniqueid','calleridname','holdtime','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','secondtransfereruniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererexten','ATTENDED','transfertargetlinkedid','musiconholdstart','[%s][queues][musiconholdstart]','musiconholdstartAt','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','musiconholdstop','[%s][queues][musiconholdstop]','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','util','./utils','info','format','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','uniqueid'];(function(_0x130db5,_0x293537){var _0x5e2a3b=function(_0x2444f7){while(--_0x2444f7){_0x130db5['push'](_0x130db5['shift']());}};_0x5e2a3b(++_0x293537);}(_0x3c03,0xcc));var _0x33c0=function(_0xd1d19a,_0x1933f0){_0xd1d19a=_0xd1d19a-0x0;var _0x52a79d=_0x3c03[_0xd1d19a];return _0x52a79d;};'use strict';var _=require('lodash');var util=require(_0x33c0('0x0'));var utils=require(_0x33c0('0x1'));var queues={};function writeDB(_0x5e6d5a){utils[_0x33c0('0x2')](util[_0x33c0('0x3')](_0x33c0('0x4'),_0x5e6d5a[_0x33c0('0x5')],_0x5e6d5a[_0x33c0('0x6')],_0x5e6d5a['queue'],_0x5e6d5a['lastAssignedTo'],_0x5e6d5a[_0x33c0('0x7')],_0x5e6d5a[_0x33c0('0x8')],_0x5e6d5a[_0x33c0('0x9')]));if(_0x5e6d5a['queue']){utils[_0x33c0('0xa')](_0x5e6d5a[_0x33c0('0xb')])[_0x33c0('0xc')](function(_0x4ba202){if(_0x4ba202){_0x5e6d5a[_0x33c0('0xd')]=_0x4ba202['type'];}utils[_0x33c0('0xe')](_0x33c0('0xf'),_0x5e6d5a);});}else{utils[_0x33c0('0xe')](_0x33c0('0xf'),_0x5e6d5a);}if(_0x5e6d5a[_0x33c0('0x10')]){delete queues[_0x5e6d5a[_0x33c0('0x10')]];}else{delete queues[_0x5e6d5a[_0x33c0('0x5')]];}}exports['queuecallerjoin']=function(_0x5bf2a0){try{utils[_0x33c0('0x11')](util[_0x33c0('0x3')](_0x33c0('0x12'),_0x5bf2a0[_0x33c0('0x5')]),_0x5bf2a0);utils[_0x33c0('0x2')](util['format'](_0x33c0('0x13'),_0x5bf2a0[_0x33c0('0x5')],_0x5bf2a0[_0x33c0('0xb')],_0x5bf2a0[_0x33c0('0x14')]));queues[_0x5bf2a0[_0x33c0('0x5')]]=_[_0x33c0('0x15')](_0x5bf2a0,{'originalposition':_0x5bf2a0['position'],'queuecallerjoinAt':utils[_0x33c0('0x16')](),'mohtime':0x0});}catch(_0x598ce3){utils['error'](util[_0x33c0('0x3')]('[%s][queues][queuecallerjoin]',_0x5bf2a0['uniqueid']),_0x598ce3);}};exports[_0x33c0('0x17')]=function(_0x25bbf6){try{if(!_['isNil'](queues[_0x25bbf6['uniqueid']])){utils['debug'](util[_0x33c0('0x3')](_0x33c0('0x18'),_0x25bbf6[_0x33c0('0x5')]),_0x25bbf6);if(queues[_0x25bbf6[_0x33c0('0x5')]]['queuecallerleaveAt']){if(!queues[_0x25bbf6[_0x33c0('0x5')]]['queuecallerabandon']&&!queues[_0x25bbf6[_0x33c0('0x5')]][_0x33c0('0x19')]){queues[_0x25bbf6[_0x33c0('0x5')]][_0x33c0('0x1a')]=!![];queues[_0x25bbf6[_0x33c0('0x5')]]['queuecallercompleteAt']=utils[_0x33c0('0x16')]();queues[_0x25bbf6['uniqueid']]['queuecallerexitreason']=_0x33c0('0x1b');}utils[_0x33c0('0x2')](util[_0x33c0('0x3')](_0x33c0('0x1c'),_0x25bbf6[_0x33c0('0x5')],queues[_0x25bbf6[_0x33c0('0x5')]][_0x33c0('0x1d')],queues[_0x25bbf6[_0x33c0('0x5')]][_0x33c0('0x9')]));writeDB(queues[_0x25bbf6['uniqueid']]);}else if(queues[_0x25bbf6[_0x33c0('0x5')]][_0x33c0('0x10')]){utils[_0x33c0('0x2')](util[_0x33c0('0x3')](_0x33c0('0x1e'),_0x25bbf6[_0x33c0('0x5')],queues[_0x25bbf6[_0x33c0('0x5')]][_0x33c0('0x1d')],queues[_0x25bbf6['uniqueid']][_0x33c0('0x10')]));queues[queues[_0x25bbf6[_0x33c0('0x5')]]['transfereduniqueid']]=queues[_0x25bbf6[_0x33c0('0x5')]];queues[queues[_0x25bbf6['uniqueid']]['transfereduniqueid']]['queuecallerenterreason']=0x2;delete queues[_0x25bbf6[_0x33c0('0x5')]];}}}catch(_0x226551){utils['error'](util[_0x33c0('0x3')](_0x33c0('0x18'),_0x25bbf6[_0x33c0('0x5')]),_0x226551);}};exports[_0x33c0('0x1f')]=function(_0x13c177){try{utils[_0x33c0('0x11')](util[_0x33c0('0x3')](_0x33c0('0x20'),_0x13c177[_0x33c0('0x5')]),_0x13c177);if(!_['isNil'](_0x13c177[_0x33c0('0x21')]['queuestatus'])&&_0x13c177[_0x33c0('0x22')][_0x33c0('0x23')]()!==_0x33c0('0x24')){if(!_['isNil'](queues[_0x13c177[_0x33c0('0x5')]])){queues[_0x13c177[_0x33c0('0x5')]][_0x33c0('0x25')]=![];queues[_0x13c177[_0x33c0('0x5')]][_0x33c0('0x26')]=null;queues[_0x13c177[_0x33c0('0x5')]]['queuecallerexit']=!![];queues[_0x13c177['uniqueid']][_0x33c0('0x27')]=utils[_0x33c0('0x16')]();queues[_0x13c177[_0x33c0('0x5')]]['queuecallerexitreason']=_0x13c177[_0x33c0('0x22')][_0x33c0('0x23')]();utils[_0x33c0('0x2')](util[_0x33c0('0x3')]('[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s',_0x13c177['uniqueid'],queues[_0x13c177[_0x33c0('0x5')]][_0x33c0('0x1d')],_0x13c177[_0x33c0('0x22')],queues[_0x13c177[_0x33c0('0x5')]][_0x33c0('0x9')]));writeDB(queues[_0x13c177[_0x33c0('0x5')]]);}}else if(!_[_0x33c0('0x28')](_0x13c177['variable'][_0x33c0('0x29')])){if(!_[_0x33c0('0x28')](queues[_0x13c177[_0x33c0('0x5')]])&&!queues[_0x13c177[_0x33c0('0x5')]]['queuecallerabandon']){queues[_0x13c177[_0x33c0('0x5')]][_0x33c0('0x25')]=![];queues[_0x13c177[_0x33c0('0x5')]]['queuecallerabandonAt']=null;queues[_0x13c177[_0x33c0('0x5')]][_0x33c0('0x19')]=!![];queues[_0x13c177['uniqueid']][_0x33c0('0x27')]=utils[_0x33c0('0x16')]();queues[_0x13c177['uniqueid']]['queuecallerexitreason']=_0x33c0('0x2a');utils['info'](util[_0x33c0('0x3')](_0x33c0('0x2b'),_0x13c177['uniqueid'],queues[_0x13c177[_0x33c0('0x5')]][_0x33c0('0x1d')],_0x13c177[_0x33c0('0x22')],queues[_0x13c177[_0x33c0('0x5')]]['queuecallerexitreason']));}}}catch(_0x407450){utils['error'](util[_0x33c0('0x3')](_0x33c0('0x20'),_0x13c177[_0x33c0('0x5')]),_0x407450);}};exports[_0x33c0('0x25')]=function(_0x581015){try{if(!_[_0x33c0('0x28')](queues[_0x581015['uniqueid']])){utils['debug'](util[_0x33c0('0x3')](_0x33c0('0x2c'),_0x581015[_0x33c0('0x5')]),_0x581015);queues[_0x581015[_0x33c0('0x5')]][_0x33c0('0x19')]=![];queues[_0x581015['uniqueid']][_0x33c0('0x27')]=null;queues[_0x581015[_0x33c0('0x5')]][_0x33c0('0x25')]=!![];queues[_0x581015['uniqueid']][_0x33c0('0x26')]=utils['now']();queues[_0x581015[_0x33c0('0x5')]][_0x33c0('0x9')]=_0x33c0('0x2d');utils['info'](util[_0x33c0('0x3')](_0x33c0('0x2e'),_0x581015[_0x33c0('0x5')],queues[_0x581015[_0x33c0('0x5')]]['name'],queues[_0x581015[_0x33c0('0x5')]][_0x33c0('0x9')]));}}catch(_0x28b681){utils[_0x33c0('0x2f')](util[_0x33c0('0x3')](_0x33c0('0x2c'),_0x581015['uniqueid']),_0x28b681);}};exports[_0x33c0('0x30')]=function(_0x2ca6d6){try{if(!_['isNil'](queues[_0x2ca6d6[_0x33c0('0x5')]])){utils[_0x33c0('0x11')](util[_0x33c0('0x3')](_0x33c0('0x31'),_0x2ca6d6[_0x33c0('0x5')]),_0x2ca6d6);utils['info'](util[_0x33c0('0x3')](_0x33c0('0x32'),_0x2ca6d6[_0x33c0('0x5')],queues[_0x2ca6d6[_0x33c0('0x5')]][_0x33c0('0x1d')],_0x2ca6d6[_0x33c0('0x33')],_0x2ca6d6['connectedlinename']));queues[_0x2ca6d6[_0x33c0('0x5')]]['queuecallerleave']=!![];queues[_0x2ca6d6[_0x33c0('0x5')]][_0x33c0('0x34')]=utils[_0x33c0('0x16')]();queues[_0x2ca6d6[_0x33c0('0x5')]]['holdtime']=utils[_0x33c0('0x35')](queues[_0x2ca6d6['uniqueid']][_0x33c0('0x34')],queues[_0x2ca6d6[_0x33c0('0x5')]][_0x33c0('0x36')]);queues[_0x2ca6d6['uniqueid']][_0x33c0('0x14')]=_0x2ca6d6[_0x33c0('0x14')];queues[_0x2ca6d6[_0x33c0('0x5')]][_0x33c0('0x37')]=_0x2ca6d6[_0x33c0('0x37')];queues[_0x2ca6d6[_0x33c0('0x5')]][_0x33c0('0x33')]=_0x2ca6d6[_0x33c0('0x33')];queues[_0x2ca6d6['uniqueid']][_0x33c0('0x38')]=_0x2ca6d6[_0x33c0('0x38')];}}catch(_0x45895c){utils[_0x33c0('0x2f')](util[_0x33c0('0x3')]('[%s][queues][queuecallerleave]',_0x2ca6d6['uniqueid']),_0x45895c);}};exports['agentconnect']=function(_0x26ac81){try{if(!_[_0x33c0('0x28')](queues[_0x26ac81[_0x33c0('0x5')]])){utils[_0x33c0('0x11')](util[_0x33c0('0x3')](_0x33c0('0x39'),_0x26ac81['uniqueid']),_0x26ac81);utils[_0x33c0('0x2')](util[_0x33c0('0x3')](_0x33c0('0x3a'),_0x26ac81[_0x33c0('0x5')],queues[_0x26ac81[_0x33c0('0x5')]]['name'],_0x26ac81[_0x33c0('0x3b')],_0x26ac81[_0x33c0('0x3c')]));queues[_0x26ac81[_0x33c0('0x5')]][_0x33c0('0x25')]=![];queues[_0x26ac81['uniqueid']][_0x33c0('0x25')]=![];queues[_0x26ac81[_0x33c0('0x5')]][_0x33c0('0x26')]=null;queues[_0x26ac81['uniqueid']][_0x33c0('0x19')]=![];queues[_0x26ac81['uniqueid']][_0x33c0('0x9')]=null;queues[_0x26ac81[_0x33c0('0x5')]][_0x33c0('0x27')]=null;queues[_0x26ac81['uniqueid']]['assigned']=!![];queues[_0x26ac81[_0x33c0('0x5')]][_0x33c0('0x8')]=_0x26ac81[_0x33c0('0x3c')];queues[_0x26ac81['uniqueid']][_0x33c0('0x3d')]=_0x26ac81['membername'];}}catch(_0x1ad0fb){utils['error'](util[_0x33c0('0x3')](_0x33c0('0x39'),_0x26ac81['uniqueid']),_0x1ad0fb);}};exports['agentcomplete']=function(_0x21acd8){try{if(!_[_0x33c0('0x28')](queues[_0x21acd8['uniqueid']])){if(queues[_0x21acd8[_0x33c0('0x5')]][_0x33c0('0x34')]){utils['debug'](util[_0x33c0('0x3')](_0x33c0('0x3e'),_0x21acd8[_0x33c0('0x5')]),_0x21acd8);queues[_0x21acd8[_0x33c0('0x5')]]['queuecallerabandon']=![];queues[_0x21acd8['uniqueid']][_0x33c0('0x25')]=![];queues[_0x21acd8[_0x33c0('0x5')]]['queuecallerabandonAt']=null;queues[_0x21acd8['uniqueid']][_0x33c0('0x19')]=![];queues[_0x21acd8[_0x33c0('0x5')]][_0x33c0('0x27')]=null;queues[_0x21acd8[_0x33c0('0x5')]][_0x33c0('0x3f')]=!![];queues[_0x21acd8['uniqueid']]['lastAssignedTo']=_0x21acd8['membername'];queues[_0x21acd8[_0x33c0('0x5')]][_0x33c0('0x1a')]=!![];queues[_0x21acd8[_0x33c0('0x5')]][_0x33c0('0x40')]=utils[_0x33c0('0x16')]();if(_0x21acd8[_0x33c0('0x41')]=='transfer'){if(!queues[_0x21acd8[_0x33c0('0x5')]][_0x33c0('0x42')]){queues[_0x21acd8[_0x33c0('0x5')]][_0x33c0('0x9')]='TRANSFER';}}else{queues[_0x21acd8['uniqueid']][_0x33c0('0x9')]='COMPLETEDBY'+_0x21acd8[_0x33c0('0x41')][_0x33c0('0x23')]();}utils[_0x33c0('0x2')](util['format'](_0x33c0('0x43'),_0x21acd8[_0x33c0('0x5')],queues[_0x21acd8[_0x33c0('0x5')]][_0x33c0('0x1d')],_0x21acd8[_0x33c0('0x3b')],queues[_0x21acd8[_0x33c0('0x5')]]['queuecallerexitreason']));writeDB(queues[_0x21acd8[_0x33c0('0x5')]]);}}}catch(_0x514f10){utils[_0x33c0('0x2f')](util[_0x33c0('0x3')](_0x33c0('0x3e'),_0x21acd8[_0x33c0('0x5')]),_0x514f10);}};exports[_0x33c0('0x44')]=function(_0x30026b){try{if(!_[_0x33c0('0x28')](queues[_0x30026b['transfereeuniqueid']])){utils[_0x33c0('0x11')](util[_0x33c0('0x3')](_0x33c0('0x45'),_0x30026b['uniqueid']),_0x30026b);queues[_0x30026b['transfereeuniqueid']]['transfer']=!![];queues[_0x30026b[_0x33c0('0x46')]][_0x33c0('0x47')]=_0x33c0('0x48');queues[_0x30026b['transfereeuniqueid']]['transferexten']=_0x30026b[_0x33c0('0x49')];queues[_0x30026b['transfereeuniqueid']][_0x33c0('0x4a')]=_0x30026b[_0x33c0('0x46')];queues[_0x30026b[_0x33c0('0x46')]]['queuecallerexitreason']=_0x33c0('0x4b');utils['info'](util[_0x33c0('0x3')](_0x33c0('0x4c'),_0x30026b[_0x33c0('0x5')],queues[_0x30026b['transfereeuniqueid']]['name'],_0x30026b['transfereeuniqueid'],_0x30026b['extension']));}}catch(_0x381403){utils['error'](util['format']('[%s][queues][blindtransfer]',_0x30026b[_0x33c0('0x5')]),_0x381403);}};exports[_0x33c0('0x4d')]=function(_0x94937a){try{utils[_0x33c0('0x11')](util['format']('[%s][queues][attendedtransfer]',_0x94937a['origtransfereruniqueid']),_0x94937a);if(_0x94937a[_0x33c0('0x4e')]==_0x94937a[_0x33c0('0x4f')]){if(!_[_0x33c0('0x28')](queues[_0x94937a[_0x33c0('0x50')]])){utils[_0x33c0('0x2')](util[_0x33c0('0x3')]('[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER',_0x94937a[_0x33c0('0x4e')],queues[_0x94937a['secondtransfererlinkedid']][_0x33c0('0x1d')],_0x94937a[_0x33c0('0x51')]));queues[_0x94937a[_0x33c0('0x50')]][_0x33c0('0x42')]=!![];queues[_0x94937a[_0x33c0('0x50')]][_0x33c0('0x47')]='ATTENDED';queues[_0x94937a[_0x33c0('0x50')]][_0x33c0('0x52')]=_0x94937a[_0x33c0('0x51')];queues[_0x94937a[_0x33c0('0x50')]]['transferuniqueid']=_0x94937a[_0x33c0('0x4e')];queues[_0x94937a[_0x33c0('0x50')]]['queuecallerexitreason']=_0x33c0('0x53');}if(!_['isNil'](queues[_0x94937a['origtransfererlinkedid']])){if(_0x94937a[_0x33c0('0x54')]&&queues[_0x94937a[_0x33c0('0x54')]]){queues[_0x94937a['transfereelinkedid']][_0x33c0('0x55')]=0x1;queues[_0x94937a[_0x33c0('0x46')]]=_[_0x33c0('0x56')](queues[_0x94937a['transfereelinkedid']]);queues[_0x94937a['transfereeuniqueid']][_0x33c0('0x10')]=_0x94937a[_0x33c0('0x57')];queues[_0x94937a[_0x33c0('0x46')]][_0x33c0('0x55')]=0x2;queues[_0x94937a['transfereeuniqueid']][_0x33c0('0x7')]=queues[_0x94937a[_0x33c0('0x50')]][_0x33c0('0x7')];queues[_0x94937a[_0x33c0('0x46')]][_0x33c0('0x58')]=queues[_0x94937a['secondtransfererlinkedid']]['calleridname'];queues[_0x94937a[_0x33c0('0x46')]][_0x33c0('0x36')]=utils[_0x33c0('0x16')]();queues[_0x94937a[_0x33c0('0x46')]]['queuecallerleaveAt']=utils[_0x33c0('0x16')]();queues[_0x94937a['transfereeuniqueid']][_0x33c0('0x59')]=0x0;queues[_0x94937a[_0x33c0('0x46')]][_0x33c0('0x5a')]=0x0;utils[_0x33c0('0x2')](util[_0x33c0('0x3')](_0x33c0('0x5b'),_0x94937a[_0x33c0('0x4e')],queues[_0x94937a['transfereeuniqueid']][_0x33c0('0x1d')],queues[_0x94937a['transfereeuniqueid']]['calleridnum'],queues[_0x94937a[_0x33c0('0x46')]]['calleridname']));}else{utils[_0x33c0('0x2')](util[_0x33c0('0x3')](_0x33c0('0x5c'),_0x94937a['origtransfereruniqueid'],queues[_0x94937a[_0x33c0('0x4f')]][_0x33c0('0x1d')],_0x94937a[_0x33c0('0x50')]));queues[_0x94937a['origtransfererlinkedid']][_0x33c0('0x10')]=_0x94937a[_0x33c0('0x50')];}}}else if(_0x94937a[_0x33c0('0x5d')]==_0x94937a[_0x33c0('0x50')]){if(!_[_0x33c0('0x28')](queues[_0x94937a[_0x33c0('0x4f')]])){utils['info'](util[_0x33c0('0x3')](_0x33c0('0x5e'),_0x94937a[_0x33c0('0x4e')],queues[_0x94937a[_0x33c0('0x4f')]]['name'],_0x94937a[_0x33c0('0x5d')],_0x94937a[_0x33c0('0x5f')]));queues[_0x94937a[_0x33c0('0x4f')]]['transfer']=!![];queues[_0x94937a[_0x33c0('0x4f')]][_0x33c0('0x47')]=_0x33c0('0x60');queues[_0x94937a[_0x33c0('0x4f')]][_0x33c0('0x52')]=_0x94937a[_0x33c0('0x5f')];queues[_0x94937a[_0x33c0('0x4f')]]['transferuniqueid']=_0x94937a[_0x33c0('0x5d')];queues[_0x94937a['origtransfererlinkedid']][_0x33c0('0x9')]=_0x33c0('0x53');}if(!_[_0x33c0('0x28')](queues[_0x94937a['secondtransfererlinkedid']])){if(_0x94937a[_0x33c0('0x61')]&&queues[_0x94937a[_0x33c0('0x61')]]){queues[_0x94937a[_0x33c0('0x61')]][_0x33c0('0x55')]=0x1;queues[_0x94937a[_0x33c0('0x57')]]=_[_0x33c0('0x56')](queues[_0x94937a[_0x33c0('0x61')]]);queues[_0x94937a[_0x33c0('0x57')]][_0x33c0('0x10')]=_0x94937a[_0x33c0('0x57')];queues[_0x94937a[_0x33c0('0x57')]]['queuecallerenterreason']=0x2;queues[_0x94937a[_0x33c0('0x57')]]['calleridnum']=queues[_0x94937a[_0x33c0('0x4f')]][_0x33c0('0x7')];queues[_0x94937a[_0x33c0('0x57')]][_0x33c0('0x58')]=queues[_0x94937a[_0x33c0('0x4f')]][_0x33c0('0x58')];queues[_0x94937a['transfertargetuniqueid']][_0x33c0('0x36')]=utils[_0x33c0('0x16')]();queues[_0x94937a[_0x33c0('0x57')]][_0x33c0('0x34')]=utils[_0x33c0('0x16')]();queues[_0x94937a[_0x33c0('0x57')]][_0x33c0('0x59')]=0x0;queues[_0x94937a[_0x33c0('0x57')]][_0x33c0('0x5a')]=0x0;utils[_0x33c0('0x2')](util[_0x33c0('0x3')]('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s',_0x94937a['origtransfereruniqueid'],queues[_0x94937a[_0x33c0('0x57')]][_0x33c0('0x1d')],queues[_0x94937a[_0x33c0('0x57')]][_0x33c0('0x10')],queues[_0x94937a['transfertargetuniqueid']][_0x33c0('0x7')],queues[_0x94937a[_0x33c0('0x57')]]['calleridname']));}else{utils[_0x33c0('0x2')](util['format'](_0x33c0('0x5c'),_0x94937a[_0x33c0('0x4e')],queues[_0x94937a[_0x33c0('0x50')]][_0x33c0('0x1d')],_0x94937a[_0x33c0('0x4f')]));queues[_0x94937a[_0x33c0('0x50')]][_0x33c0('0x10')]=_0x94937a[_0x33c0('0x4f')];}}}}catch(_0x289d2f){utils[_0x33c0('0x2f')](util[_0x33c0('0x3')]('[%s][queues][attendedtransfer]',_0x94937a[_0x33c0('0x4e')]),_0x289d2f);}};exports[_0x33c0('0x62')]=function(_0x255c6d){try{if(!_['isNil'](queues[_0x255c6d[_0x33c0('0x5')]])){utils[_0x33c0('0x11')](util['format'](_0x33c0('0x63'),_0x255c6d['uniqueid']),_0x255c6d);queues[_0x255c6d[_0x33c0('0x5')]][_0x33c0('0x64')]=utils[_0x33c0('0x16')]();utils[_0x33c0('0x2')](util[_0x33c0('0x3')](_0x33c0('0x65'),_0x255c6d[_0x33c0('0x5')],queues[_0x255c6d[_0x33c0('0x5')]][_0x33c0('0x1d')],queues[_0x255c6d[_0x33c0('0x5')]][_0x33c0('0x64')]));}}catch(_0x3e956e){utils[_0x33c0('0x2f')](util[_0x33c0('0x3')]('[%s][queues][musiconholdstart]',_0x255c6d[_0x33c0('0x5')]),_0x3e956e);}};exports[_0x33c0('0x66')]=function(_0x497012){try{if(!_[_0x33c0('0x28')](queues[_0x497012[_0x33c0('0x5')]])){if(!_[_0x33c0('0x28')](queues[_0x497012[_0x33c0('0x5')]][_0x33c0('0x64')])){utils['debug'](util['format'](_0x33c0('0x67'),_0x497012['uniqueid']),_0x497012);queues[_0x497012[_0x33c0('0x5')]]['mohtime']+=utils[_0x33c0('0x35')](utils[_0x33c0('0x16')](),queues[_0x497012[_0x33c0('0x5')]][_0x33c0('0x64')]);utils[_0x33c0('0x2')](util[_0x33c0('0x3')](_0x33c0('0x68'),_0x497012[_0x33c0('0x5')],queues[_0x497012['uniqueid']][_0x33c0('0x1d')],queues[_0x497012[_0x33c0('0x5')]][_0x33c0('0x5a')]));delete queues[_0x497012[_0x33c0('0x5')]][_0x33c0('0x64')];}}}catch(_0x30a7ec){utils[_0x33c0('0x2f')](util[_0x33c0('0x3')]('[%s][queues][musiconholdstop]',_0x497012[_0x33c0('0x5')]),_0x30a7ec);}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index 4de8fe5..7fcb39a 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 _0x2f60=['context','exten','channel','newstate','[%s][recordings][newstate]','isNil','channelstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s','linkedid','transfer','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','error','variable','mixmonitor_filename','[%s][recordings][varset]','[%s][recordings][varset]\x20variable:%s\x20value:%s','value','replace','.wav49','.WAV','find','monitors','push','hangup','[%s][recordings][hangup]','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridnum','calleridname','cause-txt','connectedlinenum','connectedlinename','type','outbound','forEach','clone','newexten','[%s][recordings][newexten]','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','startsWith','cdr','split','substring','lastIndexOf','queuecallerjoin','[%s][recordings][queuecallerjoin]','queue','lodash','info','format','accountcode','membername','name','CreateVoiceRecording','request','debug','[%s][recordings][newchannel]','uniqueid','[%s][recordings][newchannel]\x20context:%s\x20exten:%s'];(function(_0x20aae1,_0x51efd4){var _0x510601=function(_0x20895f){while(--_0x20895f){_0x20aae1['push'](_0x20aae1['shift']());}};_0x510601(++_0x51efd4);}(_0x2f60,0xab));var _0x02f6=function(_0x2e2ddc,_0x4ae655){_0x2e2ddc=_0x2e2ddc-0x0;var _0x41ea93=_0x2f60[_0x2e2ddc];return _0x41ea93;};'use strict';var _=require(_0x02f6('0x0'));var util=require('util');var utils=require('./utils');var recordings={};function writeDB(_0x2e025a){utils[_0x02f6('0x1')](util[_0x02f6('0x2')]('[%s][recordings][writeDB]',_0x2e025a['uniqueid']));if(_0x2e025a[_0x02f6('0x3')]){utils['getUserByInternal'](_0x2e025a[_0x02f6('0x3')])['then'](function(_0x32aa31){if(_0x32aa31){_0x2e025a[_0x02f6('0x4')]=_0x32aa31[_0x02f6('0x5')];_0x2e025a['UserId']=_0x32aa31['id'];}utils['request'](_0x02f6('0x6'),_0x2e025a);});}else{utils[_0x02f6('0x7')](_0x02f6('0x6'),_0x2e025a);}}exports['newchannel']=function(_0x1252ec){try{utils[_0x02f6('0x8')](util[_0x02f6('0x2')](_0x02f6('0x9'),_0x1252ec[_0x02f6('0xa')]),_0x1252ec);if(_0x1252ec[_0x02f6('0xa')]==_0x1252ec['linkedid']){utils[_0x02f6('0x1')](util[_0x02f6('0x2')](_0x02f6('0xb'),_0x1252ec[_0x02f6('0xa')],_0x1252ec[_0x02f6('0xc')],_0x1252ec['exten']));recordings[_0x1252ec[_0x02f6('0xa')]]={'uniqueid':_0x1252ec[_0x02f6('0xa')],'accountcode':_0x1252ec[_0x02f6('0x3')],'exten':_0x1252ec[_0x02f6('0xd')],'context':_0x1252ec['context'],'channel':_0x1252ec[_0x02f6('0xe')],'monitors':[]};}}catch(_0x9d98af){utils['error'](util['format'](_0x02f6('0x9'),_0x1252ec[_0x02f6('0xa')]),_0x9d98af);}};exports[_0x02f6('0xf')]=function(_0x549aee){try{utils[_0x02f6('0x8')](util['format'](_0x02f6('0x10'),_0x549aee['uniqueid']),_0x549aee);if(!_[_0x02f6('0x11')](recordings[_0x549aee['uniqueid']])&&_0x549aee[_0x02f6('0x12')]==0x6){utils[_0x02f6('0x1')](util[_0x02f6('0x2')](_0x02f6('0x13'),_0x549aee[_0x02f6('0xa')],_0x549aee[_0x02f6('0xc')],_0x549aee[_0x02f6('0xe')]));}else if(!_['isNil'](recordings[_0x549aee[_0x02f6('0x14')]])&&_0x549aee[_0x02f6('0x12')]==0x6&&_0x549aee[_0x02f6('0xc')]!=_0x02f6('0x15')){utils[_0x02f6('0x1')](util[_0x02f6('0x2')](_0x02f6('0x16'),_0x549aee[_0x02f6('0xa')],_0x549aee['linkedid'],_0x549aee[_0x02f6('0xc')],_0x549aee['channel']));recordings[_0x549aee[_0x02f6('0x14')]][_0x02f6('0x3')]=_0x549aee[_0x02f6('0x3')];}}catch(_0x4df489){utils[_0x02f6('0x17')](util[_0x02f6('0x2')](_0x02f6('0x10'),_0x549aee[_0x02f6('0xa')]),_0x4df489);}};exports['varset']=function(_0x33d35b){try{if(!_[_0x02f6('0x11')](_0x33d35b['variable'])&&!_[_0x02f6('0x11')](_0x33d35b[_0x02f6('0x18')][_0x02f6('0x19')])){utils[_0x02f6('0x8')](util[_0x02f6('0x2')](_0x02f6('0x1a'),_0x33d35b[_0x02f6('0xa')]),_0x33d35b);utils[_0x02f6('0x1')](util[_0x02f6('0x2')](_0x02f6('0x1b'),_0x33d35b[_0x02f6('0xa')],_0x33d35b[_0x02f6('0x18')],_0x33d35b['value']));if(_['endsWith'](_0x33d35b['value'],'.wav49')){_0x33d35b[_0x02f6('0x1c')]=_0x33d35b[_0x02f6('0x1c')][_0x02f6('0x1d')](_0x02f6('0x1e'),_0x02f6('0x1f'));}if(recordings[_0x33d35b[_0x02f6('0x14')]]){var _0x1ef92b=_[_0x02f6('0x20')](recordings[_0x33d35b[_0x02f6('0x14')]]['monitors'],{'value':_0x33d35b[_0x02f6('0x1c')]});if(_[_0x02f6('0x11')](_0x1ef92b)){recordings[_0x33d35b[_0x02f6('0x14')]][_0x02f6('0x21')][_0x02f6('0x22')]({'value':_0x33d35b[_0x02f6('0x1c')]});}}}}catch(_0x44bc60){utils[_0x02f6('0x17')](util[_0x02f6('0x2')]('[%s][recordings][varset]',_0x33d35b[_0x02f6('0xa')]),_0x44bc60);}};exports[_0x02f6('0x23')]=function(_0x303e5a){try{if(!_[_0x02f6('0x11')](recordings[_0x303e5a[_0x02f6('0xa')]])){utils[_0x02f6('0x8')](util[_0x02f6('0x2')](_0x02f6('0x24'),_0x303e5a[_0x02f6('0xa')]),_0x303e5a);utils[_0x02f6('0x1')](util[_0x02f6('0x2')](_0x02f6('0x25'),_0x303e5a['uniqueid'],_0x303e5a[_0x02f6('0x26')],_0x303e5a[_0x02f6('0x27')],_0x303e5a[_0x02f6('0x28')]));recordings[_0x303e5a['uniqueid']]['calleridnum']=_0x303e5a['calleridnum'];recordings[_0x303e5a[_0x02f6('0xa')]][_0x02f6('0x27')]=_0x303e5a['calleridname'];recordings[_0x303e5a['uniqueid']][_0x02f6('0x29')]=_0x303e5a[_0x02f6('0x29')];recordings[_0x303e5a[_0x02f6('0xa')]][_0x02f6('0x2a')]=_0x303e5a[_0x02f6('0x2a')];if(recordings[_0x303e5a[_0x02f6('0xa')]][_0x02f6('0x2b')]==_0x02f6('0x2c')&&recordings[_0x303e5a[_0x02f6('0xa')]][_0x02f6('0x3')]){recordings[_0x303e5a['uniqueid']][_0x02f6('0x29')]=recordings[_0x303e5a[_0x02f6('0xa')]][_0x02f6('0x3')];recordings[_0x303e5a['uniqueid']][_0x02f6('0x2a')]='';}recordings[_0x303e5a[_0x02f6('0xa')]][_0x02f6('0x21')][_0x02f6('0x2d')](function(_0x227b0d){var _0x3f592a=_[_0x02f6('0x2e')](recordings[_0x303e5a[_0x02f6('0xa')]]);_0x3f592a['value']=_0x227b0d[_0x02f6('0x1c')];writeDB(_0x3f592a);});delete recordings[_0x303e5a[_0x02f6('0xa')]];}}catch(_0x25511a){utils[_0x02f6('0x17')](util['format'](_0x02f6('0x24'),_0x303e5a[_0x02f6('0xa')]),_0x25511a);}};exports[_0x02f6('0x2f')]=function(_0x2dff17){try{if(!_[_0x02f6('0x11')](recordings[_0x2dff17[_0x02f6('0xa')]])){utils[_0x02f6('0x8')](util[_0x02f6('0x2')](_0x02f6('0x30'),_0x2dff17[_0x02f6('0xa')]),_0x2dff17);utils[_0x02f6('0x1')](util['format'](_0x02f6('0x31'),_0x2dff17[_0x02f6('0xa')],_0x2dff17[_0x02f6('0x32')],_0x2dff17[_0x02f6('0x33')]));if(_0x2dff17[_0x02f6('0x32')][_0x02f6('0x34')]()=='set'&&_[_0x02f6('0x35')](_0x2dff17[_0x02f6('0x33')][_0x02f6('0x34')](),_0x02f6('0x36'))){var _0x53275c=_0x2dff17[_0x02f6('0x33')][_0x02f6('0x37')]('=');var _0x1a46f8=_0x53275c[0x0][_0x02f6('0x38')](_0x53275c[0x0][_0x02f6('0x39')]('(')+0x1,_0x53275c[0x0]['lastIndexOf'](')'));var _0x50e236=_0x53275c[0x1];recordings[_0x2dff17[_0x02f6('0xa')]][_0x1a46f8]=_0x50e236;}}}catch(_0x4bde8c){utils[_0x02f6('0x17')](util[_0x02f6('0x2')]('[%s][recordings][newexten]',_0x2dff17['uniqueid']),_0x4bde8c);}};exports[_0x02f6('0x3a')]=function(_0x15ad98){try{if(!_['isNil'](recordings[_0x15ad98[_0x02f6('0xa')]])){utils[_0x02f6('0x8')](util['format'](_0x02f6('0x3b'),_0x15ad98[_0x02f6('0xa')]),_0x15ad98);utils[_0x02f6('0x1')](util[_0x02f6('0x2')]('[%s][recordings][queuecallerjoin]\x20queue:%s',_0x15ad98[_0x02f6('0xa')],_0x15ad98['queue']));recordings[_0x15ad98[_0x02f6('0xa')]][_0x02f6('0x3c')]=_0x15ad98[_0x02f6('0x3c')];}}catch(_0x85cf94){utils[_0x02f6('0x17')](util[_0x02f6('0x2')](_0x02f6('0x3b'),_0x15ad98[_0x02f6('0xa')]),_0x85cf94);}}; \ No newline at end of file +var _0x8a13=['[%s][recordings][queuecallerjoin]\x20queue:%s','queue','[%s][recordings][queuecallerjoin]','lodash','./utils','info','format','[%s][recordings][writeDB]','uniqueid','accountcode','getUserByInternal','then','membername','name','UserId','CreateVoiceRecording','debug','[%s][recordings][newchannel]','linkedid','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','exten','context','channel','error','newstate','isNil','channelstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s','[%s][recordings][newstate]','variable','mixmonitor_filename','[%s][recordings][varset]\x20variable:%s\x20value:%s','value','.wav49','replace','find','monitors','push','hangup','[%s][recordings][hangup]','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridname','calleridnum','connectedlinenum','connectedlinename','type','outbound','forEach','clone','newexten','[%s][recordings][newexten]','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','application','set','startsWith','appdata','toLowerCase','cdr','split','substring'];(function(_0x384fc4,_0x1740d6){var _0x292817=function(_0x50249c){while(--_0x50249c){_0x384fc4['push'](_0x384fc4['shift']());}};_0x292817(++_0x1740d6);}(_0x8a13,0x16b));var _0x38a1=function(_0x5d6448,_0x53522f){_0x5d6448=_0x5d6448-0x0;var _0x58c195=_0x8a13[_0x5d6448];return _0x58c195;};'use strict';var _=require(_0x38a1('0x0'));var util=require('util');var utils=require(_0x38a1('0x1'));var recordings={};function writeDB(_0x50ecd8){utils[_0x38a1('0x2')](util[_0x38a1('0x3')](_0x38a1('0x4'),_0x50ecd8[_0x38a1('0x5')]));if(_0x50ecd8[_0x38a1('0x6')]){utils[_0x38a1('0x7')](_0x50ecd8[_0x38a1('0x6')])[_0x38a1('0x8')](function(_0x1517af){if(_0x1517af){_0x50ecd8[_0x38a1('0x9')]=_0x1517af[_0x38a1('0xa')];_0x50ecd8[_0x38a1('0xb')]=_0x1517af['id'];}utils['request'](_0x38a1('0xc'),_0x50ecd8);});}else{utils['request'](_0x38a1('0xc'),_0x50ecd8);}}exports['newchannel']=function(_0x1f3be4){try{utils[_0x38a1('0xd')](util[_0x38a1('0x3')](_0x38a1('0xe'),_0x1f3be4[_0x38a1('0x5')]),_0x1f3be4);if(_0x1f3be4[_0x38a1('0x5')]==_0x1f3be4[_0x38a1('0xf')]){utils[_0x38a1('0x2')](util['format'](_0x38a1('0x10'),_0x1f3be4[_0x38a1('0x5')],_0x1f3be4['context'],_0x1f3be4[_0x38a1('0x11')]));recordings[_0x1f3be4[_0x38a1('0x5')]]={'uniqueid':_0x1f3be4[_0x38a1('0x5')],'accountcode':_0x1f3be4['accountcode'],'exten':_0x1f3be4[_0x38a1('0x11')],'context':_0x1f3be4[_0x38a1('0x12')],'channel':_0x1f3be4[_0x38a1('0x13')],'monitors':[]};}}catch(_0x4e4fc9){utils[_0x38a1('0x14')](util[_0x38a1('0x3')]('[%s][recordings][newchannel]',_0x1f3be4[_0x38a1('0x5')]),_0x4e4fc9);}};exports[_0x38a1('0x15')]=function(_0x3c0577){try{utils[_0x38a1('0xd')](util[_0x38a1('0x3')]('[%s][recordings][newstate]',_0x3c0577[_0x38a1('0x5')]),_0x3c0577);if(!_[_0x38a1('0x16')](recordings[_0x3c0577[_0x38a1('0x5')]])&&_0x3c0577[_0x38a1('0x17')]==0x6){utils[_0x38a1('0x2')](util[_0x38a1('0x3')](_0x38a1('0x18'),_0x3c0577[_0x38a1('0x5')],_0x3c0577[_0x38a1('0x12')],_0x3c0577[_0x38a1('0x13')]));}else if(!_[_0x38a1('0x16')](recordings[_0x3c0577['linkedid']])&&_0x3c0577[_0x38a1('0x17')]==0x6&&_0x3c0577['context']!='transfer'){utils[_0x38a1('0x2')](util[_0x38a1('0x3')]('[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s',_0x3c0577[_0x38a1('0x5')],_0x3c0577['linkedid'],_0x3c0577[_0x38a1('0x12')],_0x3c0577[_0x38a1('0x13')]));recordings[_0x3c0577[_0x38a1('0xf')]][_0x38a1('0x6')]=_0x3c0577[_0x38a1('0x6')];}}catch(_0xb96a40){utils[_0x38a1('0x14')](util[_0x38a1('0x3')](_0x38a1('0x19'),_0x3c0577[_0x38a1('0x5')]),_0xb96a40);}};exports['varset']=function(_0x2d5bf0){try{if(!_['isNil'](_0x2d5bf0[_0x38a1('0x1a')])&&!_[_0x38a1('0x16')](_0x2d5bf0[_0x38a1('0x1a')][_0x38a1('0x1b')])){utils[_0x38a1('0xd')](util[_0x38a1('0x3')]('[%s][recordings][varset]',_0x2d5bf0[_0x38a1('0x5')]),_0x2d5bf0);utils['info'](util[_0x38a1('0x3')](_0x38a1('0x1c'),_0x2d5bf0['uniqueid'],_0x2d5bf0[_0x38a1('0x1a')],_0x2d5bf0[_0x38a1('0x1d')]));if(_['endsWith'](_0x2d5bf0[_0x38a1('0x1d')],_0x38a1('0x1e'))){_0x2d5bf0[_0x38a1('0x1d')]=_0x2d5bf0[_0x38a1('0x1d')][_0x38a1('0x1f')](_0x38a1('0x1e'),'.WAV');}if(recordings[_0x2d5bf0['linkedid']]){var _0x925120=_[_0x38a1('0x20')](recordings[_0x2d5bf0[_0x38a1('0xf')]][_0x38a1('0x21')],{'value':_0x2d5bf0[_0x38a1('0x1d')]});if(_[_0x38a1('0x16')](_0x925120)){recordings[_0x2d5bf0[_0x38a1('0xf')]][_0x38a1('0x21')][_0x38a1('0x22')]({'value':_0x2d5bf0[_0x38a1('0x1d')]});}}}}catch(_0x5206af){utils[_0x38a1('0x14')](util['format']('[%s][recordings][varset]',_0x2d5bf0[_0x38a1('0x5')]),_0x5206af);}};exports[_0x38a1('0x23')]=function(_0x4c3d59){try{if(!_['isNil'](recordings[_0x4c3d59['uniqueid']])){utils[_0x38a1('0xd')](util[_0x38a1('0x3')](_0x38a1('0x24'),_0x4c3d59[_0x38a1('0x5')]),_0x4c3d59);utils[_0x38a1('0x2')](util[_0x38a1('0x3')](_0x38a1('0x25'),_0x4c3d59[_0x38a1('0x5')],_0x4c3d59['calleridnum'],_0x4c3d59[_0x38a1('0x26')],_0x4c3d59['cause-txt']));recordings[_0x4c3d59[_0x38a1('0x5')]][_0x38a1('0x27')]=_0x4c3d59['calleridnum'];recordings[_0x4c3d59[_0x38a1('0x5')]][_0x38a1('0x26')]=_0x4c3d59[_0x38a1('0x26')];recordings[_0x4c3d59['uniqueid']]['connectedlinenum']=_0x4c3d59[_0x38a1('0x28')];recordings[_0x4c3d59[_0x38a1('0x5')]][_0x38a1('0x29')]=_0x4c3d59[_0x38a1('0x29')];if(recordings[_0x4c3d59['uniqueid']][_0x38a1('0x2a')]==_0x38a1('0x2b')&&recordings[_0x4c3d59[_0x38a1('0x5')]]['accountcode']){recordings[_0x4c3d59[_0x38a1('0x5')]][_0x38a1('0x28')]=recordings[_0x4c3d59[_0x38a1('0x5')]][_0x38a1('0x6')];recordings[_0x4c3d59['uniqueid']][_0x38a1('0x29')]='';}recordings[_0x4c3d59[_0x38a1('0x5')]][_0x38a1('0x21')][_0x38a1('0x2c')](function(_0x2998be){var _0x4737ad=_[_0x38a1('0x2d')](recordings[_0x4c3d59['uniqueid']]);_0x4737ad[_0x38a1('0x1d')]=_0x2998be[_0x38a1('0x1d')];writeDB(_0x4737ad);});delete recordings[_0x4c3d59[_0x38a1('0x5')]];}}catch(_0x1b2923){utils[_0x38a1('0x14')](util['format']('[%s][recordings][hangup]',_0x4c3d59[_0x38a1('0x5')]),_0x1b2923);}};exports[_0x38a1('0x2e')]=function(_0x1fba81){try{if(!_[_0x38a1('0x16')](recordings[_0x1fba81[_0x38a1('0x5')]])){utils['debug'](util['format'](_0x38a1('0x2f'),_0x1fba81[_0x38a1('0x5')]),_0x1fba81);utils[_0x38a1('0x2')](util['format'](_0x38a1('0x30'),_0x1fba81[_0x38a1('0x5')],_0x1fba81[_0x38a1('0x31')],_0x1fba81['appdata']));if(_0x1fba81[_0x38a1('0x31')]['toLowerCase']()==_0x38a1('0x32')&&_[_0x38a1('0x33')](_0x1fba81[_0x38a1('0x34')][_0x38a1('0x35')](),_0x38a1('0x36'))){var _0x414698=_0x1fba81[_0x38a1('0x34')][_0x38a1('0x37')]('=');var _0x51610e=_0x414698[0x0][_0x38a1('0x38')](_0x414698[0x0]['lastIndexOf']('(')+0x1,_0x414698[0x0]['lastIndexOf'](')'));var _0x191c3f=_0x414698[0x1];recordings[_0x1fba81[_0x38a1('0x5')]][_0x51610e]=_0x191c3f;}}}catch(_0x5c13fe){utils[_0x38a1('0x14')](util['format'](_0x38a1('0x2f'),_0x1fba81[_0x38a1('0x5')]),_0x5c13fe);}};exports['queuecallerjoin']=function(_0x190025){try{if(!_[_0x38a1('0x16')](recordings[_0x190025[_0x38a1('0x5')]])){utils[_0x38a1('0xd')](util[_0x38a1('0x3')]('[%s][recordings][queuecallerjoin]',_0x190025[_0x38a1('0x5')]),_0x190025);utils[_0x38a1('0x2')](util[_0x38a1('0x3')](_0x38a1('0x39'),_0x190025[_0x38a1('0x5')],_0x190025[_0x38a1('0x3a')]));recordings[_0x190025[_0x38a1('0x5')]]['queue']=_0x190025[_0x38a1('0x3a')];}}catch(_0x1e3270){utils['error'](util['format'](_0x38a1('0x3b'),_0x190025[_0x38a1('0x5')]),_0x1e3270);}}; \ No newline at end of file diff --git a/server/services/xdr/transfers.controller.js b/server/services/xdr/transfers.controller.js index 8a8004d..2233419 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 _0x2eb2=['transfereruniqueid','[%s][transfers][attendedtransfer]','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridnum','origtransferercalleridname','transfertargetcalleridnum','transfertargetcalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','origtransferercontext','attended','isNil','transfereechannel','transfertargetchannel','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetlinkedid','./utils','info','format','type','origtransfereruniqueid','uniqueid','CreateVoiceTransferReport','blinds','blindtransfer','debug','[%s][transfers][blindtransfer]','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transferercalleridname','transfereecalleridnum','transfereecalleridname','blind'];(function(_0x5c31b8,_0x2f56a3){var _0xc90b3d=function(_0x15f0bb){while(--_0x15f0bb){_0x5c31b8['push'](_0x5c31b8['shift']());}};_0xc90b3d(++_0x2f56a3);}(_0x2eb2,0x16b));var _0x22eb=function(_0x411add,_0x1aed38){_0x411add=_0x411add-0x0;var _0x238242=_0x2eb2[_0x411add];return _0x238242;};'use strict';var _=require('lodash');var util=require('util');var utils=require(_0x22eb('0x0'));function writeDB(_0x3f7461){utils[_0x22eb('0x1')](util[_0x22eb('0x2')]('[%s][transfers][writeDB]\x20type:%s',_0x3f7461[_0x22eb('0x3')]==='attended'?_0x3f7461[_0x22eb('0x4')]:_0x3f7461[_0x22eb('0x5')],_0x3f7461['type']));utils['request'](_0x22eb('0x6'),_0x3f7461);}exports[_0x22eb('0x7')]={};exports[_0x22eb('0x8')]=function(_0x1f42f0){try{utils[_0x22eb('0x9')](util['format'](_0x22eb('0xa'),_0x1f42f0[_0x22eb('0x5')]),_0x1f42f0);utils[_0x22eb('0x1')](util['format'](_0x22eb('0xb'),_0x1f42f0[_0x22eb('0x5')],_0x1f42f0[_0x22eb('0xc')],_0x1f42f0[_0x22eb('0xd')],_0x1f42f0[_0x22eb('0xe')],_0x1f42f0[_0x22eb('0xf')]));_0x1f42f0[_0x22eb('0x3')]=_0x22eb('0x10');exports[_0x22eb('0x7')][_0x1f42f0[_0x22eb('0x11')]]=_0x1f42f0;writeDB(_0x1f42f0);}catch(_0x5eefd4){utils['error'](util[_0x22eb('0x2')](_0x22eb('0xa'),_0x1f42f0[_0x22eb('0x5')]),_0x5eefd4);}};exports['attendedtransfer']=function(_0xb64bb1){try{utils[_0x22eb('0x9')](util[_0x22eb('0x2')](_0x22eb('0x12'),_0xb64bb1[_0x22eb('0x4')]),_0xb64bb1);utils[_0x22eb('0x1')](util[_0x22eb('0x2')](_0x22eb('0x13'),_0xb64bb1[_0x22eb('0x4')],_0xb64bb1[_0x22eb('0x14')],_0xb64bb1[_0x22eb('0x15')],_0xb64bb1[_0x22eb('0x16')],_0xb64bb1[_0x22eb('0x17')]));_0xb64bb1=_['assign'](_0xb64bb1,{'transfererchannel':_0xb64bb1['origtransfererchannel'],'transferercalleridnum':_0xb64bb1['origtransferercalleridnum'],'transferercalleridname':_0xb64bb1[_0x22eb('0x15')],'transfererconnectedlinenum':_0xb64bb1[_0x22eb('0x18')],'transfererconnectedlinename':_0xb64bb1[_0x22eb('0x19')],'transfereraccountcode':_0xb64bb1[_0x22eb('0x1a')],'transferercontext':_0xb64bb1[_0x22eb('0x1b')],'transfererexten':_0xb64bb1['secondtransfererexten'],'transfererlinkedid':_0xb64bb1['origtransfererlinkedid'],'context':_0xb64bb1[_0x22eb('0x1c')],'extension':_0xb64bb1['origtransfererexten'],'type':_0x22eb('0x1d')});if(_[_0x22eb('0x1e')](_0xb64bb1[_0x22eb('0x1f')])){_0xb64bb1=_['assign'](_0xb64bb1,{'transfereechannel':_0xb64bb1[_0x22eb('0x20')],'transfereecalleridnum':_0xb64bb1[_0x22eb('0x16')],'transfereecalleridname':_0xb64bb1['transfertargetcalleridname'],'transfereeconnectedlinenum':_0xb64bb1[_0x22eb('0x21')],'transfereeconnectedlinename':_0xb64bb1[_0x22eb('0x22')],'transfereeaccountcode':_0xb64bb1[_0x22eb('0x23')],'transfereecontext':_0xb64bb1[_0x22eb('0x24')],'transfereeexten':_0xb64bb1['transfertargetexten'],'transfereelinkedid':_0xb64bb1[_0x22eb('0x25')]});}writeDB(_0xb64bb1);}catch(_0x1dd698){utils['error'](util['format'](_0x22eb('0x12'),_0xb64bb1[_0x22eb('0x4')]),_0x1dd698);}}; \ No newline at end of file +var _0x60c5=['CreateVoiceTransferReport','blinds','blindtransfer','debug','[%s][transfers][blindtransfer]','uniqueid','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridname','transfereecalleridnum','transfereecalleridname','blind','transfereruniqueid','attendedtransfer','[%s][transfers][attendedtransfer]','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridname','transfertargetcalleridname','assign','origtransfererchannel','origtransferercalleridnum','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','origtransfererexten','transfereechannel','transfertargetchannel','transfertargetcalleridnum','transfertargetconnectedlinenum','transfertargetlinkedid','error','lodash','./utils','info','format','[%s][transfers][writeDB]\x20type:%s','type','attended','origtransfereruniqueid','request'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x60c5,0xe7));var _0x560c=function(_0x1fd6b7,_0x4994b8){_0x1fd6b7=_0x1fd6b7-0x0;var _0x11fa5f=_0x60c5[_0x1fd6b7];return _0x11fa5f;};'use strict';var _=require(_0x560c('0x0'));var util=require('util');var utils=require(_0x560c('0x1'));function writeDB(_0x5b5a18){utils[_0x560c('0x2')](util[_0x560c('0x3')](_0x560c('0x4'),_0x5b5a18[_0x560c('0x5')]===_0x560c('0x6')?_0x5b5a18[_0x560c('0x7')]:_0x5b5a18['uniqueid'],_0x5b5a18[_0x560c('0x5')]));utils[_0x560c('0x8')](_0x560c('0x9'),_0x5b5a18);}exports[_0x560c('0xa')]={};exports[_0x560c('0xb')]=function(_0x3be987){try{utils[_0x560c('0xc')](util[_0x560c('0x3')](_0x560c('0xd'),_0x3be987[_0x560c('0xe')]),_0x3be987);utils[_0x560c('0x2')](util['format'](_0x560c('0xf'),_0x3be987[_0x560c('0xe')],_0x3be987['transferercalleridnum'],_0x3be987[_0x560c('0x10')],_0x3be987[_0x560c('0x11')],_0x3be987[_0x560c('0x12')]));_0x3be987[_0x560c('0x5')]=_0x560c('0x13');exports[_0x560c('0xa')][_0x3be987[_0x560c('0x14')]]=_0x3be987;writeDB(_0x3be987);}catch(_0x4166af){utils['error'](util[_0x560c('0x3')]('[%s][transfers][blindtransfer]',_0x3be987['uniqueid']),_0x4166af);}};exports[_0x560c('0x15')]=function(_0xb60931){try{utils[_0x560c('0xc')](util[_0x560c('0x3')](_0x560c('0x16'),_0xb60931[_0x560c('0x7')]),_0xb60931);utils['info'](util[_0x560c('0x3')](_0x560c('0x17'),_0xb60931['origtransfereruniqueid'],_0xb60931['origtransferercalleridnum'],_0xb60931[_0x560c('0x18')],_0xb60931['transfertargetcalleridnum'],_0xb60931[_0x560c('0x19')]));_0xb60931=_[_0x560c('0x1a')](_0xb60931,{'transfererchannel':_0xb60931[_0x560c('0x1b')],'transferercalleridnum':_0xb60931[_0x560c('0x1c')],'transferercalleridname':_0xb60931[_0x560c('0x18')],'transfererconnectedlinenum':_0xb60931['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0xb60931['secondtransfererconnectedlinename'],'transfereraccountcode':_0xb60931[_0x560c('0x1d')],'transferercontext':_0xb60931[_0x560c('0x1e')],'transfererexten':_0xb60931[_0x560c('0x1f')],'transfererlinkedid':_0xb60931[_0x560c('0x20')],'context':_0xb60931['origtransferercontext'],'extension':_0xb60931[_0x560c('0x21')],'type':_0x560c('0x6')});if(_['isNil'](_0xb60931[_0x560c('0x22')])){_0xb60931=_[_0x560c('0x1a')](_0xb60931,{'transfereechannel':_0xb60931[_0x560c('0x23')],'transfereecalleridnum':_0xb60931[_0x560c('0x24')],'transfereecalleridname':_0xb60931[_0x560c('0x19')],'transfereeconnectedlinenum':_0xb60931[_0x560c('0x25')],'transfereeconnectedlinename':_0xb60931['transfertargetconnectedlinename'],'transfereeaccountcode':_0xb60931['transfertargetaccountcode'],'transfereecontext':_0xb60931['transfertargetcontext'],'transfereeexten':_0xb60931['transfertargetexten'],'transfereelinkedid':_0xb60931[_0x560c('0x26')]});}writeDB(_0xb60931);}catch(_0x198c5d){utils[_0x560c('0x27')](util[_0x560c('0x3')](_0x560c('0x16'),_0xb60931['origtransfereruniqueid']),_0x198c5d);}}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index 4b150ea..c8988c6 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 _0xe1c0=['YYYY-MM-DD\x20HH:mm:ss','diff','sumTime','now','isAfter','isBefore','bluebird','jayson/promise','moment','util','client','info','inspect','debug','error','request','[utils][request]\x20name:%s','catch','GetUser','internal','interface','then','[utils][getUser]\x20where:%s','stringify','result','length','getUserByInternal','found','[utils][getUserByInternal]','getUserByInterface','[utils][getUserByInterface]\x20interface:%s\x20%s','[utils][getUserByInterface]','[utils][getUserByName]','getVoiceQueueByName','GetVoiceQueue','name','type','acw','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]\x20name:%s\x20%s','notfound','[utils][getVoiceQueueByName]','addTime','add','seconds','format'];(function(_0x3bbd6b,_0x498df1){var _0x1d27fc=function(_0x2d7be7){while(--_0x2d7be7){_0x3bbd6b['push'](_0x3bbd6b['shift']());}};_0x1d27fc(++_0x498df1);}(_0xe1c0,0x120));var _0x0e1c=function(_0x176647,_0x4bffd0){_0x176647=_0x176647-0x0;var _0x356bae=_0xe1c0[_0x176647];return _0x356bae;};'use strict';var BPromise=require(_0x0e1c('0x0'));var jayson=require(_0x0e1c('0x1'));var moment=require(_0x0e1c('0x2'));var util=require(_0x0e1c('0x3'));var client=jayson[_0x0e1c('0x4')]['http']({'port':0x2329});var logger=require('../../config/logger')('xdr');exports[_0x0e1c('0x5')]=function(_0x32db88,_0x297684){logger[_0x0e1c('0x5')](_0x32db88,_0x297684?util[_0x0e1c('0x6')](_0x297684,{'showHidden':![],'depth':null}):'');};exports['debug']=function(_0x5bdd62,_0x321532){logger[_0x0e1c('0x7')](_0x5bdd62,_0x321532?util[_0x0e1c('0x6')](_0x321532,{'showHidden':![],'depth':null}):'');};exports[_0x0e1c('0x8')]=function(_0x125f80,_0x416bc6){logger[_0x0e1c('0x8')](_0x125f80,_0x416bc6?util['inspect'](_0x416bc6,{'showHidden':![],'depth':null}):'');};exports[_0x0e1c('0x9')]=function(_0xf84a52,_0x2e8ce1){return client['request'](_0xf84a52,{'body':_0x2e8ce1})['then'](function(_0x46e1a7){logger[_0x0e1c('0x7')](_0x0e1c('0xa'),_0xf84a52,_0x46e1a7?util[_0x0e1c('0x6')](_0x46e1a7,{'showHidden':![],'depth':null}):'');})[_0x0e1c('0xb')](function(_0x3a258e){logger[_0x0e1c('0x8')](_0x0e1c('0xa'),_0xf84a52,_0x3a258e?util[_0x0e1c('0x6')](_0x3a258e,{'showHidden':![],'depth':null}):'');});};function getUser(_0x429aa4){return client['request'](_0x0e1c('0xc'),{'options':{'raw':!![],'attributes':['id',_0x0e1c('0xd'),'name',_0x0e1c('0xe')],'where':_0x429aa4,'limit':0x1}})[_0x0e1c('0xf')](function(_0x71c864){logger[_0x0e1c('0x7')](_0x0e1c('0x10'),JSON[_0x0e1c('0x11')](_0x429aa4),_0x71c864?util[_0x0e1c('0x6')](_0x71c864,{'showHidden':![],'depth':null}):'');return _0x71c864[_0x0e1c('0x12')][_0x0e1c('0x13')]?_0x71c864['result'][0x0]:null;});}exports[_0x0e1c('0x14')]=function(_0x20de90){return new BPromise(function(_0x3213d8,_0x15485e){if(_0x20de90){return getUser({'internal':_0x20de90})[_0x0e1c('0xf')](function(_0x5aecf9){logger[_0x0e1c('0x5')]('[utils][getUserByInternal]\x20internal:%s\x20%s',_0x20de90,_0x5aecf9?_0x0e1c('0x15'):'notfound');return _0x3213d8(_0x5aecf9);})[_0x0e1c('0xb')](function(_0x591ec7){logger[_0x0e1c('0x8')](_0x0e1c('0x16'),_0x591ec7?util[_0x0e1c('0x6')](_0x591ec7,{'showHidden':![],'depth':null}):'');return _0x3213d8(null);});}return _0x3213d8(null);});};exports[_0x0e1c('0x17')]=function(_0xeba0e2){return new BPromise(function(_0x7fe913,_0x3957c5){if(_0xeba0e2){return getUser({'interface':_0xeba0e2})['then'](function(_0x1ad80b){logger[_0x0e1c('0x5')](_0x0e1c('0x18'),_0xeba0e2,_0x1ad80b?'found':'notfound');return _0x7fe913(_0x1ad80b);})[_0x0e1c('0xb')](function(_0x2393bb){logger['error'](_0x0e1c('0x19'),_0x2393bb?util[_0x0e1c('0x6')](_0x2393bb,{'showHidden':![],'depth':null}):'');return _0x7fe913(null);});}return _0x7fe913(null);});};exports['getUserByName']=function(_0x5abda0){return new BPromise(function(_0x27c8f4,_0x1cff58){if(_0x5abda0){return getUser({'name':_0x5abda0})['then'](function(_0x416ee8){logger[_0x0e1c('0x5')]('[utils][getUserByName]\x20name:%s\x20%s',_0x5abda0,_0x416ee8?_0x0e1c('0x15'):'notfound');return _0x27c8f4(_0x416ee8);})[_0x0e1c('0xb')](function(_0x100089){logger['error'](_0x0e1c('0x1a'),_0x100089?util[_0x0e1c('0x6')](_0x100089,{'showHidden':![],'depth':null}):'');return _0x27c8f4(null);});}return _0x27c8f4(null);});};exports[_0x0e1c('0x1b')]=function(_0x2f450f){return new BPromise(function(_0x1d3013,_0x5f6bdc){if(_0x2f450f){return client[_0x0e1c('0x9')](_0x0e1c('0x1c'),{'options':{'raw':!![],'attributes':['id',_0x0e1c('0x1d'),_0x0e1c('0x1e'),_0x0e1c('0x1f'),_0x0e1c('0x20')],'where':{'name':_0x2f450f},'limit':0x1}})[_0x0e1c('0xf')](function(_0x54f5bc){logger[_0x0e1c('0x7')](_0x0e1c('0x21'),_0x2f450f,_0x54f5bc?util['inspect'](_0x54f5bc,{'showHidden':![],'depth':null}):'');logger['info'](_0x0e1c('0x22'),_0x2f450f,_0x54f5bc?'found':_0x0e1c('0x23'));return _0x1d3013(_0x54f5bc['result'][_0x0e1c('0x13')]?_0x54f5bc[_0x0e1c('0x12')][0x0]:null);})[_0x0e1c('0xb')](function(_0x4eb328){logger[_0x0e1c('0x8')](_0x0e1c('0x24'),_0x4eb328?util[_0x0e1c('0x6')](_0x4eb328,{'showHidden':![],'depth':null}):'');return _0x1d3013(null);});}return _0x1d3013(null);});};exports[_0x0e1c('0x25')]=function(_0x258350,_0x142e01){return moment(_0x258350)[_0x0e1c('0x26')](_0x142e01,_0x0e1c('0x27'))[_0x0e1c('0x28')](_0x0e1c('0x29'));};exports['subtractTime']=function(_0x23a80f,_0x234991){return moment(_0x23a80f)['subtract'](_0x234991,_0x0e1c('0x27'))['format'](_0x0e1c('0x29'));};exports['diffTime']=function(_0x494122,_0x1b2233){return moment(_0x494122)[_0x0e1c('0x2a')](moment(_0x1b2233),'seconds');};exports[_0x0e1c('0x2b')]=function(_0x2c9336,_0x51fa69){return parseInt(_0x2c9336,0xa)+parseInt(_0x51fa69,0xa);};exports[_0x0e1c('0x2c')]=function(){return moment()[_0x0e1c('0x28')]('YYYY-MM-DD\x20HH:mm:ss');};exports[_0x0e1c('0x2d')]=function(_0x210cf4,_0x4fcf4b){if(_0x4fcf4b){return moment(_0x210cf4)[_0x0e1c('0x2d')](_0x4fcf4b);}return!![];};exports[_0x0e1c('0x2e')]=function(_0x2d2dd6,_0x20f100){if(_0x20f100){return moment(_0x2d2dd6)['isBefore'](_0x20f100);}else if(_0x2d2dd6){return!![];}return![];}; \ No newline at end of file +var _0xcf30=['internal','name','interface','[utils][getUser]\x20where:%s','stringify','result','length','getUserByInternal','info','[utils][getUserByInternal]\x20internal:%s\x20%s','notfound','catch','[utils][getUserByInternal]','getUserByInterface','[utils][getUserByInterface]\x20interface:%s\x20%s','[utils][getUserByInterface]','found','[utils][getUserByName]','GetVoiceQueue','type','acw','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]\x20name:%s\x20%s','[utils][getVoiceQueueByName]','seconds','format','diff','sumTime','now','isAfter','isBefore','bluebird','jayson/promise','moment','util','http','../../config/logger','debug','inspect','error','request','then','[utils][request]\x20name:%s'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xcf30,0x128));var _0x0cf3=function(_0x1df013,_0x1aa443){_0x1df013=_0x1df013-0x0;var _0x412ace=_0xcf30[_0x1df013];return _0x412ace;};'use strict';var BPromise=require(_0x0cf3('0x0'));var jayson=require(_0x0cf3('0x1'));var moment=require(_0x0cf3('0x2'));var util=require(_0x0cf3('0x3'));var client=jayson['client'][_0x0cf3('0x4')]({'port':0x2329});var logger=require(_0x0cf3('0x5'))('xdr');exports['info']=function(_0x5be27c,_0x238cb6){logger['info'](_0x5be27c,_0x238cb6?util['inspect'](_0x238cb6,{'showHidden':![],'depth':null}):'');};exports['debug']=function(_0x126c36,_0x3e41ed){logger[_0x0cf3('0x6')](_0x126c36,_0x3e41ed?util[_0x0cf3('0x7')](_0x3e41ed,{'showHidden':![],'depth':null}):'');};exports[_0x0cf3('0x8')]=function(_0x47d53b,_0x2565bb){logger['error'](_0x47d53b,_0x2565bb?util[_0x0cf3('0x7')](_0x2565bb,{'showHidden':![],'depth':null}):'');};exports[_0x0cf3('0x9')]=function(_0x18b2d1,_0x1793a4){return client[_0x0cf3('0x9')](_0x18b2d1,{'body':_0x1793a4})[_0x0cf3('0xa')](function(_0x28e07f){logger[_0x0cf3('0x6')]('[utils][request]\x20name:%s',_0x18b2d1,_0x28e07f?util[_0x0cf3('0x7')](_0x28e07f,{'showHidden':![],'depth':null}):'');})['catch'](function(_0x50df01){logger['error'](_0x0cf3('0xb'),_0x18b2d1,_0x50df01?util[_0x0cf3('0x7')](_0x50df01,{'showHidden':![],'depth':null}):'');});};function getUser(_0x528e19){return client['request']('GetUser',{'options':{'raw':!![],'attributes':['id',_0x0cf3('0xc'),_0x0cf3('0xd'),_0x0cf3('0xe')],'where':_0x528e19,'limit':0x1}})[_0x0cf3('0xa')](function(_0x41d672){logger['debug'](_0x0cf3('0xf'),JSON[_0x0cf3('0x10')](_0x528e19),_0x41d672?util['inspect'](_0x41d672,{'showHidden':![],'depth':null}):'');return _0x41d672[_0x0cf3('0x11')][_0x0cf3('0x12')]?_0x41d672[_0x0cf3('0x11')][0x0]:null;});}exports[_0x0cf3('0x13')]=function(_0xa78c05){return new BPromise(function(_0x2ab930,_0x3f9b97){if(_0xa78c05){return getUser({'internal':_0xa78c05})[_0x0cf3('0xa')](function(_0x52eef8){logger[_0x0cf3('0x14')](_0x0cf3('0x15'),_0xa78c05,_0x52eef8?'found':_0x0cf3('0x16'));return _0x2ab930(_0x52eef8);})[_0x0cf3('0x17')](function(_0xa81872){logger[_0x0cf3('0x8')](_0x0cf3('0x18'),_0xa81872?util['inspect'](_0xa81872,{'showHidden':![],'depth':null}):'');return _0x2ab930(null);});}return _0x2ab930(null);});};exports[_0x0cf3('0x19')]=function(_0x5cf070){return new BPromise(function(_0x444fc1,_0x46cec4){if(_0x5cf070){return getUser({'interface':_0x5cf070})[_0x0cf3('0xa')](function(_0x5ed4ba){logger[_0x0cf3('0x14')](_0x0cf3('0x1a'),_0x5cf070,_0x5ed4ba?'found':_0x0cf3('0x16'));return _0x444fc1(_0x5ed4ba);})['catch'](function(_0x45ae4f){logger['error'](_0x0cf3('0x1b'),_0x45ae4f?util[_0x0cf3('0x7')](_0x45ae4f,{'showHidden':![],'depth':null}):'');return _0x444fc1(null);});}return _0x444fc1(null);});};exports['getUserByName']=function(_0x358eff){return new BPromise(function(_0x3205c0,_0x57dc10){if(_0x358eff){return getUser({'name':_0x358eff})[_0x0cf3('0xa')](function(_0x6e0ca3){logger['info']('[utils][getUserByName]\x20name:%s\x20%s',_0x358eff,_0x6e0ca3?_0x0cf3('0x1c'):_0x0cf3('0x16'));return _0x3205c0(_0x6e0ca3);})[_0x0cf3('0x17')](function(_0x319336){logger['error'](_0x0cf3('0x1d'),_0x319336?util[_0x0cf3('0x7')](_0x319336,{'showHidden':![],'depth':null}):'');return _0x3205c0(null);});}return _0x3205c0(null);});};exports['getVoiceQueueByName']=function(_0x1a1e94){return new BPromise(function(_0x19f1cf,_0x4b78a0){if(_0x1a1e94){return client[_0x0cf3('0x9')](_0x0cf3('0x1e'),{'options':{'raw':!![],'attributes':['id',_0x0cf3('0xd'),_0x0cf3('0x1f'),_0x0cf3('0x20'),_0x0cf3('0x21')],'where':{'name':_0x1a1e94},'limit':0x1}})['then'](function(_0x3a7af0){logger[_0x0cf3('0x6')](_0x0cf3('0x22'),_0x1a1e94,_0x3a7af0?util[_0x0cf3('0x7')](_0x3a7af0,{'showHidden':![],'depth':null}):'');logger['info'](_0x0cf3('0x23'),_0x1a1e94,_0x3a7af0?_0x0cf3('0x1c'):_0x0cf3('0x16'));return _0x19f1cf(_0x3a7af0[_0x0cf3('0x11')][_0x0cf3('0x12')]?_0x3a7af0[_0x0cf3('0x11')][0x0]:null);})[_0x0cf3('0x17')](function(_0x14f58d){logger['error'](_0x0cf3('0x24'),_0x14f58d?util[_0x0cf3('0x7')](_0x14f58d,{'showHidden':![],'depth':null}):'');return _0x19f1cf(null);});}return _0x19f1cf(null);});};exports['addTime']=function(_0x43320b,_0x15a460){return moment(_0x43320b)['add'](_0x15a460,_0x0cf3('0x25'))['format']('YYYY-MM-DD\x20HH:mm:ss');};exports['subtractTime']=function(_0x54f89e,_0x39cd89){return moment(_0x54f89e)['subtract'](_0x39cd89,'seconds')[_0x0cf3('0x26')]('YYYY-MM-DD\x20HH:mm:ss');};exports['diffTime']=function(_0x33a4cf,_0x280630){return moment(_0x33a4cf)[_0x0cf3('0x27')](moment(_0x280630),_0x0cf3('0x25'));};exports[_0x0cf3('0x28')]=function(_0x4bdb13,_0x5d8804){return parseInt(_0x4bdb13,0xa)+parseInt(_0x5d8804,0xa);};exports[_0x0cf3('0x29')]=function(){return moment()[_0x0cf3('0x26')]('YYYY-MM-DD\x20HH:mm:ss');};exports[_0x0cf3('0x2a')]=function(_0x4a3a97,_0x97b4c0){if(_0x97b4c0){return moment(_0x4a3a97)['isAfter'](_0x97b4c0);}return!![];};exports[_0x0cf3('0x2b')]=function(_0x3e3b2c,_0x5971e0){if(_0x5971e0){return moment(_0x3e3b2c)[_0x0cf3('0x2b')](_0x5971e0);}else if(_0x3e3b2c){return!![];}return![];}; \ No newline at end of file -- 1.7.1